From d901899ef1fe78a68ba3ed23f39dd3784deaba1b Mon Sep 17 00:00:00 2001 From: Andrea Amorese Date: Fri, 3 Sep 2021 16:47:57 +0200 Subject: [PATCH] Built motion from commit 2c427cc0.|2.5.345 --- apidoc/api_project.js | 2 +- apidoc/api_project.json | 2 +- server/api/action/action.attributes.js | 2 +- server/api/action/action.controller.js | 2 +- server/api/action/action.model.js | 2 +- server/api/action/action.rpc.js | 2 +- server/api/action/index.js | 2 +- .../analyticCustomReport.attributes.js | 2 +- .../analyticCustomReport.controller.js | 2 +- .../analyticCustomReport.model.js | 2 +- .../analyticCustomReport.rpc.js | 2 +- server/api/analyticCustomReport/index.js | 2 +- .../analyticDefaultReport.attributes.js | 2 +- .../analyticDefaultReport.controller.js | 2 +- .../analyticDefaultReport.model.js | 2 +- .../analyticDefaultReport.rpc.js | 2 +- server/api/analyticDefaultReport/index.js | 2 +- .../analyticExtractedReport.attributes.js | 2 +- .../analyticExtractedReport.controller.js | 2 +- .../analyticExtractedReport.model.js | 2 +- .../analyticExtractedReport.rpc.js | 2 +- server/api/analyticExtractedReport/index.js | 2 +- .../analyticFieldReport.attributes.js | 2 +- .../analyticFieldReport.controller.js | 2 +- .../analyticFieldReport.model.js | 2 +- .../analyticFieldReport/analyticFieldReport.rpc.js | 2 +- server/api/analyticFieldReport/index.js | 2 +- .../analyticMetric/analyticMetric.attributes.js | 2 +- .../analyticMetric/analyticMetric.controller.js | 2 +- server/api/analyticMetric/analyticMetric.model.js | 2 +- server/api/analyticMetric/analyticMetric.rpc.js | 2 +- server/api/analyticMetric/index.js | 2 +- .../analyticTreeReport.attributes.js | 2 +- .../analyticTreeReport.controller.js | 2 +- .../analyticTreeReport/analyticTreeReport.model.js | 2 +- .../analyticTreeReport/analyticTreeReport.rpc.js | 2 +- server/api/analyticTreeReport/index.js | 2 +- server/api/attachment/attachment.attributes.js | 2 +- server/api/attachment/attachment.controller.js | 2 +- server/api/attachment/attachment.model.js | 2 +- server/api/attachment/attachment.rpc.js | 2 +- server/api/attachment/index.js | 2 +- server/api/authGoogle/authGoogle.controller.js | 2 +- server/api/authGoogle/index.js | 2 +- server/api/authLocal/authLocal.controller.js | 2 +- server/api/authLocal/index.js | 2 +- server/api/automation/automation.attributes.js | 2 +- server/api/automation/automation.controller.js | 2 +- server/api/automation/automation.model.js | 2 +- server/api/automation/automation.rpc.js | 2 +- server/api/automation/index.js | 2 +- server/api/campaign/campaign.attributes.js | 2 +- server/api/campaign/campaign.controller.js | 2 +- server/api/campaign/campaign.model.js | 2 +- server/api/campaign/campaign.rpc.js | 2 +- server/api/campaign/index.js | 2 +- server/api/cannedAnswer/cannedAnswer.attributes.js | 2 +- server/api/cannedAnswer/cannedAnswer.controller.js | 2 +- server/api/cannedAnswer/cannedAnswer.model.js | 2 +- server/api/cannedAnswer/cannedAnswer.rpc.js | 2 +- server/api/cannedAnswer/index.js | 2 +- server/api/cdr/cdr.attributes.js | 2 +- server/api/cdr/cdr.controller.js | 2 +- server/api/cdr/cdr.model.js | 2 +- server/api/cdr/cdr.rpc.js | 2 +- server/api/cdr/index.js | 2 +- .../chatApplication/chatApplication.attributes.js | 2 +- .../chatApplication/chatApplication.controller.js | 2 +- .../api/chatApplication/chatApplication.model.js | 2 +- server/api/chatApplication/chatApplication.rpc.js | 2 +- server/api/chatApplication/index.js | 2 +- server/api/chatGroup/chatGroup.attributes.js | 2 +- server/api/chatGroup/chatGroup.controller.js | 2 +- server/api/chatGroup/chatGroup.events.js | 2 +- server/api/chatGroup/chatGroup.model.js | 2 +- server/api/chatGroup/chatGroup.rpc.js | 2 +- server/api/chatGroup/chatGroup.socket.js | 2 +- server/api/chatGroup/index.js | 2 +- .../chatInteraction/chatInteraction.attributes.js | 2 +- .../chatInteraction/chatInteraction.controller.js | 2 +- .../api/chatInteraction/chatInteraction.events.js | 2 +- .../api/chatInteraction/chatInteraction.model.js | 2 +- server/api/chatInteraction/chatInteraction.rpc.js | 2 +- .../api/chatInteraction/chatInteraction.socket.js | 2 +- server/api/chatInteraction/index.js | 2 +- .../chatInternalMessage.attributes.js | 2 +- .../chatInternalMessage.controller.js | 2 +- .../chatInternalMessage.events.js | 2 +- .../chatInternalMessage.model.js | 2 +- .../chatInternalMessage/chatInternalMessage.rpc.js | 2 +- .../chatInternalMessage.socket.js | 2 +- server/api/chatInternalMessage/index.js | 2 +- server/api/chatMessage/chatMessage.attributes.js | 2 +- server/api/chatMessage/chatMessage.controller.js | 2 +- server/api/chatMessage/chatMessage.events.js | 2 +- server/api/chatMessage/chatMessage.model.js | 2 +- server/api/chatMessage/chatMessage.rpc.js | 2 +- server/api/chatMessage/chatMessage.socket.js | 2 +- server/api/chatMessage/index.js | 2 +- .../chatOfflineMessage.attributes.js | 2 +- .../chatOfflineMessage.controller.js | 2 +- .../chatOfflineMessage/chatOfflineMessage.model.js | 2 +- .../chatOfflineMessage/chatOfflineMessage.rpc.js | 2 +- server/api/chatOfflineMessage/index.js | 2 +- .../chatProactiveAction.attributes.js | 2 +- .../chatProactiveAction.controller.js | 2 +- .../chatProactiveAction.model.js | 2 +- .../chatProactiveAction/chatProactiveAction.rpc.js | 2 +- server/api/chatProactiveAction/index.js | 2 +- server/api/chatQueue/chatQueue.attributes.js | 2 +- server/api/chatQueue/chatQueue.controller.js | 2 +- server/api/chatQueue/chatQueue.events.js | 2 +- server/api/chatQueue/chatQueue.model.js | 2 +- server/api/chatQueue/chatQueue.rpc.js | 2 +- server/api/chatQueue/chatQueue.socket.js | 2 +- server/api/chatQueue/index.js | 2 +- .../chatQueueReport/chatQueueReport.attributes.js | 2 +- .../chatQueueReport/chatQueueReport.controller.js | 2 +- .../api/chatQueueReport/chatQueueReport.model.js | 2 +- server/api/chatQueueReport/chatQueueReport.rpc.js | 2 +- server/api/chatQueueReport/index.js | 2 +- .../chatTransferReport.attributes.js | 2 +- .../chatTransferReport.controller.js | 2 +- .../chatTransferReport/chatTransferReport.model.js | 2 +- .../chatTransferReport/chatTransferReport.rpc.js | 2 +- server/api/chatTransferReport/index.js | 2 +- server/api/chatWebsite/chatWebsite.attributes.js | 2 +- server/api/chatWebsite/chatWebsite.controller.js | 2 +- server/api/chatWebsite/chatWebsite.events.js | 2 +- server/api/chatWebsite/chatWebsite.model.js | 2 +- server/api/chatWebsite/chatWebsite.rpc.js | 2 +- server/api/chatWebsite/chatWebsite.socket.js | 2 +- server/api/chatWebsite/index.js | 2 +- .../api/cloudProvider/cloudProvider.attributes.js | 2 +- .../api/cloudProvider/cloudProvider.controller.js | 2 +- server/api/cloudProvider/cloudProvider.model.js | 2 +- server/api/cloudProvider/cloudProvider.rpc.js | 2 +- server/api/cloudProvider/index.js | 2 +- server/api/cmCompany/cmCompany.attributes.js | 2 +- server/api/cmCompany/cmCompany.controller.js | 2 +- server/api/cmCompany/cmCompany.model.js | 2 +- server/api/cmCompany/cmCompany.rpc.js | 2 +- server/api/cmCompany/index.js | 2 +- server/api/cmContact/cmContact.attributes.js | 2 +- server/api/cmContact/cmContact.controller.js | 2 +- server/api/cmContact/cmContact.events.js | 2 +- server/api/cmContact/cmContact.model.js | 2 +- server/api/cmContact/cmContact.rpc.js | 2 +- server/api/cmContact/cmContact.socket.js | 2 +- server/api/cmContact/index.js | 2 +- .../api/cmCustomField/cmCustomField.attributes.js | 2 +- .../api/cmCustomField/cmCustomField.controller.js | 2 +- server/api/cmCustomField/cmCustomField.model.js | 2 +- server/api/cmCustomField/cmCustomField.rpc.js | 2 +- server/api/cmCustomField/index.js | 2 +- server/api/cmHopper/cmHopper.attributes.js | 2 +- server/api/cmHopper/cmHopper.controller.js | 2 +- server/api/cmHopper/cmHopper.model.js | 2 +- server/api/cmHopper/cmHopper.rpc.js | 2 +- server/api/cmHopper/index.js | 2 +- .../api/cmHopperBlack/cmHopperBlack.attributes.js | 2 +- .../api/cmHopperBlack/cmHopperBlack.controller.js | 2 +- server/api/cmHopperBlack/cmHopperBlack.model.js | 2 +- server/api/cmHopperBlack/cmHopperBlack.rpc.js | 2 +- server/api/cmHopperBlack/index.js | 2 +- .../api/cmHopperFinal/cmHopperFinal.attributes.js | 2 +- .../api/cmHopperFinal/cmHopperFinal.controller.js | 2 +- server/api/cmHopperFinal/cmHopperFinal.model.js | 2 +- server/api/cmHopperFinal/cmHopperFinal.rpc.js | 2 +- server/api/cmHopperFinal/index.js | 2 +- .../cmHopperHistory/cmHopperHistory.attributes.js | 2 +- .../cmHopperHistory/cmHopperHistory.controller.js | 2 +- .../api/cmHopperHistory/cmHopperHistory.model.js | 2 +- server/api/cmHopperHistory/cmHopperHistory.rpc.js | 2 +- server/api/cmHopperHistory/index.js | 2 +- server/api/cmList/cmList.attributes.js | 2 +- server/api/cmList/cmList.controller.js | 2 +- server/api/cmList/cmList.events.js | 2 +- server/api/cmList/cmList.model.js | 2 +- server/api/cmList/cmList.rpc.js | 2 +- server/api/cmList/cmList.socket.js | 2 +- server/api/cmList/index.js | 2 +- server/api/condition/condition.attributes.js | 2 +- server/api/condition/condition.controller.js | 2 +- server/api/condition/condition.model.js | 2 +- server/api/condition/condition.rpc.js | 2 +- server/api/condition/index.js | 2 +- server/api/dashboard/dashboard.attributes.js | 2 +- server/api/dashboard/dashboard.controller.js | 2 +- server/api/dashboard/dashboard.events.js | 2 +- server/api/dashboard/dashboard.model.js | 2 +- server/api/dashboard/dashboard.rpc.js | 2 +- server/api/dashboard/dashboard.socket.js | 2 +- server/api/dashboard/index.js | 2 +- .../api/dashboardItem/dashboardItem.attributes.js | 2 +- .../api/dashboardItem/dashboardItem.controller.js | 2 +- server/api/dashboardItem/dashboardItem.events.js | 2 +- server/api/dashboardItem/dashboardItem.model.js | 2 +- server/api/dashboardItem/dashboardItem.rpc.js | 2 +- server/api/dashboardItem/dashboardItem.socket.js | 2 +- server/api/dashboardItem/index.js | 2 +- server/api/disposition/disposition.attributes.js | 2 +- server/api/disposition/disposition.controller.js | 2 +- server/api/disposition/disposition.model.js | 2 +- server/api/disposition/disposition.rpc.js | 2 +- server/api/disposition/index.js | 2 +- server/api/faxAccount/faxAccount.attributes.js | 2 +- server/api/faxAccount/faxAccount.controller.js | 2 +- server/api/faxAccount/faxAccount.events.js | 2 +- server/api/faxAccount/faxAccount.model.js | 2 +- server/api/faxAccount/faxAccount.rpc.js | 2 +- server/api/faxAccount/faxAccount.socket.js | 2 +- server/api/faxAccount/index.js | 2 +- .../faxApplication/faxApplication.attributes.js | 2 +- .../faxApplication/faxApplication.controller.js | 2 +- server/api/faxApplication/faxApplication.model.js | 2 +- server/api/faxApplication/faxApplication.rpc.js | 2 +- server/api/faxApplication/index.js | 2 +- .../faxInteraction/faxInteraction.attributes.js | 2 +- .../faxInteraction/faxInteraction.controller.js | 2 +- server/api/faxInteraction/faxInteraction.events.js | 2 +- server/api/faxInteraction/faxInteraction.model.js | 2 +- server/api/faxInteraction/faxInteraction.rpc.js | 2 +- server/api/faxInteraction/faxInteraction.socket.js | 2 +- server/api/faxInteraction/index.js | 2 +- server/api/faxMessage/faxMessage.attributes.js | 2 +- server/api/faxMessage/faxMessage.controller.js | 2 +- server/api/faxMessage/faxMessage.events.js | 2 +- server/api/faxMessage/faxMessage.model.js | 2 +- server/api/faxMessage/faxMessage.rpc.js | 2 +- server/api/faxMessage/faxMessage.socket.js | 2 +- server/api/faxMessage/index.js | 2 +- server/api/faxQueue/faxQueue.attributes.js | 2 +- server/api/faxQueue/faxQueue.controller.js | 2 +- server/api/faxQueue/faxQueue.events.js | 2 +- server/api/faxQueue/faxQueue.model.js | 2 +- server/api/faxQueue/faxQueue.rpc.js | 2 +- server/api/faxQueue/faxQueue.socket.js | 2 +- server/api/faxQueue/index.js | 2 +- .../faxQueueReport/faxQueueReport.attributes.js | 2 +- .../faxQueueReport/faxQueueReport.controller.js | 2 +- server/api/faxQueueReport/faxQueueReport.model.js | 2 +- server/api/faxQueueReport/faxQueueReport.rpc.js | 2 +- server/api/faxQueueReport/index.js | 2 +- .../faxTransferReport.attributes.js | 2 +- .../faxTransferReport.controller.js | 2 +- .../faxTransferReport/faxTransferReport.model.js | 2 +- .../api/faxTransferReport/faxTransferReport.rpc.js | 2 +- server/api/faxTransferReport/index.js | 2 +- server/api/intDeskAccount/index.js | 2 +- .../intDeskAccount/intDeskAccount.attributes.js | 2 +- .../intDeskAccount/intDeskAccount.controller.js | 2 +- server/api/intDeskAccount/intDeskAccount.model.js | 2 +- server/api/intDeskAccount/intDeskAccount.rpc.js | 2 +- server/api/intDeskConfiguration/index.js | 2 +- .../intDeskConfiguration.attributes.js | 2 +- .../intDeskConfiguration.controller.js | 2 +- .../intDeskConfiguration.model.js | 2 +- .../intDeskConfiguration.rpc.js | 2 +- server/api/intDeskField/index.js | 2 +- server/api/intDeskField/intDeskField.attributes.js | 2 +- server/api/intDeskField/intDeskField.controller.js | 2 +- server/api/intDeskField/intDeskField.model.js | 2 +- server/api/intDeskField/intDeskField.rpc.js | 2 +- server/api/intDynamics365Account/index.js | 2 +- .../intDynamics365Account.attributes.js | 2 +- .../intDynamics365Account.controller.js | 2 +- .../intDynamics365Account.model.js | 2 +- .../intDynamics365Account.rpc.js | 2 +- server/api/intDynamics365Configuration/index.js | 2 +- .../intDynamics365Configuration.attributes.js | 2 +- .../intDynamics365Configuration.controller.js | 2 +- .../intDynamics365Configuration.model.js | 2 +- .../intDynamics365Configuration.rpc.js | 2 +- server/api/intDynamics365Field/index.js | 2 +- .../intDynamics365Field.attributes.js | 2 +- .../intDynamics365Field.controller.js | 2 +- .../intDynamics365Field.model.js | 2 +- .../intDynamics365Field/intDynamics365Field.rpc.js | 2 +- server/api/intFreshdeskAccount/index.js | 2 +- .../intFreshdeskAccount.attributes.js | 2 +- .../intFreshdeskAccount.controller.js | 2 +- .../intFreshdeskAccount.model.js | 2 +- .../intFreshdeskAccount/intFreshdeskAccount.rpc.js | 2 +- server/api/intFreshdeskConfiguration/index.js | 2 +- .../intFreshdeskConfiguration.attributes.js | 2 +- .../intFreshdeskConfiguration.controller.js | 2 +- .../intFreshdeskConfiguration.model.js | 2 +- .../intFreshdeskConfiguration.rpc.js | 2 +- server/api/intFreshdeskField/index.js | 2 +- .../intFreshdeskField.attributes.js | 2 +- .../intFreshdeskField.controller.js | 2 +- .../intFreshdeskField/intFreshdeskField.model.js | 2 +- .../api/intFreshdeskField/intFreshdeskField.rpc.js | 2 +- server/api/intFreshsalesAccount/index.js | 2 +- .../intFreshsalesAccount.attributes.js | 2 +- .../intFreshsalesAccount.controller.js | 2 +- .../intFreshsalesAccount.model.js | 2 +- .../intFreshsalesAccount.rpc.js | 2 +- server/api/intFreshsalesConfiguration/index.js | 2 +- .../intFreshsalesConfiguration.attributes.js | 2 +- .../intFreshsalesConfiguration.controller.js | 2 +- .../intFreshsalesConfiguration.model.js | 2 +- .../intFreshsalesConfiguration.rpc.js | 2 +- server/api/intFreshsalesField/index.js | 2 +- .../intFreshsalesField.attributes.js | 2 +- .../intFreshsalesField.controller.js | 2 +- .../intFreshsalesField/intFreshsalesField.model.js | 2 +- .../intFreshsalesField/intFreshsalesField.rpc.js | 2 +- server/api/intSalesforceAccount/index.js | 2 +- .../intSalesforceAccount.attributes.js | 2 +- .../intSalesforceAccount.controller.js | 2 +- .../intSalesforceAccount.model.js | 2 +- .../intSalesforceAccount.rpc.js | 2 +- server/api/intSalesforceConfiguration/index.js | 2 +- .../intSalesforceConfiguration.attributes.js | 2 +- .../intSalesforceConfiguration.controller.js | 2 +- .../intSalesforceConfiguration.model.js | 2 +- .../intSalesforceConfiguration.rpc.js | 2 +- server/api/intSalesforceField/index.js | 2 +- .../intSalesforceField.attributes.js | 2 +- .../intSalesforceField.controller.js | 2 +- .../intSalesforceField/intSalesforceField.model.js | 2 +- .../intSalesforceField/intSalesforceField.rpc.js | 2 +- server/api/intServicenowAccount/index.js | 2 +- .../intServicenowAccount.attributes.js | 2 +- .../intServicenowAccount.controller.js | 2 +- .../intServicenowAccount.model.js | 2 +- .../intServicenowAccount.rpc.js | 2 +- server/api/intServicenowConfiguration/index.js | 2 +- .../intServicenowConfiguration.attributes.js | 2 +- .../intServicenowConfiguration.controller.js | 2 +- .../intServicenowConfiguration.model.js | 2 +- .../intServicenowConfiguration.rpc.js | 2 +- server/api/intServicenowField/index.js | 2 +- .../intServicenowField.attributes.js | 2 +- .../intServicenowField.controller.js | 2 +- .../intServicenowField/intServicenowField.model.js | 2 +- .../intServicenowField/intServicenowField.rpc.js | 2 +- server/api/intSugarcrmAccount/index.js | 2 +- .../intSugarcrmAccount.attributes.js | 2 +- .../intSugarcrmAccount.controller.js | 2 +- .../intSugarcrmAccount/intSugarcrmAccount.model.js | 2 +- .../intSugarcrmAccount/intSugarcrmAccount.rpc.js | 2 +- server/api/intSugarcrmConfiguration/index.js | 2 +- .../intSugarcrmConfiguration.attributes.js | 2 +- .../intSugarcrmConfiguration.controller.js | 2 +- .../intSugarcrmConfiguration.model.js | 2 +- .../intSugarcrmConfiguration.rpc.js | 2 +- server/api/intSugarcrmField/index.js | 2 +- .../intSugarcrmField.attributes.js | 2 +- .../intSugarcrmField.controller.js | 2 +- .../api/intSugarcrmField/intSugarcrmField.model.js | 2 +- .../api/intSugarcrmField/intSugarcrmField.rpc.js | 2 +- server/api/intVtigerAccount/index.js | 2 +- .../intVtigerAccount.attributes.js | 2 +- .../intVtigerAccount.controller.js | 2 +- .../api/intVtigerAccount/intVtigerAccount.model.js | 2 +- .../api/intVtigerAccount/intVtigerAccount.rpc.js | 2 +- server/api/intVtigerConfiguration/index.js | 2 +- .../intVtigerConfiguration.attributes.js | 2 +- .../intVtigerConfiguration.controller.js | 2 +- .../intVtigerConfiguration.model.js | 2 +- .../intVtigerConfiguration.rpc.js | 2 +- server/api/intVtigerField/index.js | 2 +- .../intVtigerField/intVtigerField.attributes.js | 2 +- .../intVtigerField/intVtigerField.controller.js | 2 +- server/api/intVtigerField/intVtigerField.model.js | 2 +- server/api/intVtigerField/intVtigerField.rpc.js | 2 +- server/api/intZendeskAccount/index.js | 2 +- .../intZendeskAccount.attributes.js | 2 +- .../intZendeskAccount.controller.js | 2 +- .../intZendeskAccount/intZendeskAccount.model.js | 2 +- .../api/intZendeskAccount/intZendeskAccount.rpc.js | 2 +- server/api/intZendeskConfiguration/index.js | 2 +- .../intZendeskConfiguration.attributes.js | 2 +- .../intZendeskConfiguration.controller.js | 2 +- .../intZendeskConfiguration.model.js | 2 +- .../intZendeskConfiguration.rpc.js | 2 +- server/api/intZendeskField/index.js | 2 +- .../intZendeskField/intZendeskField.attributes.js | 2 +- .../intZendeskField/intZendeskField.controller.js | 2 +- .../api/intZendeskField/intZendeskField.model.js | 2 +- server/api/intZendeskField/intZendeskField.rpc.js | 2 +- server/api/intZohoAccount/index.js | 2 +- .../intZohoAccount/intZohoAccount.attributes.js | 2 +- .../intZohoAccount/intZohoAccount.controller.js | 2 +- server/api/intZohoAccount/intZohoAccount.model.js | 2 +- server/api/intZohoAccount/intZohoAccount.rpc.js | 2 +- server/api/intZohoConfiguration/index.js | 2 +- .../intZohoConfiguration.attributes.js | 2 +- .../intZohoConfiguration.controller.js | 2 +- .../intZohoConfiguration.model.js | 2 +- .../intZohoConfiguration.rpc.js | 2 +- server/api/intZohoField/index.js | 2 +- server/api/intZohoField/intZohoField.attributes.js | 2 +- server/api/intZohoField/intZohoField.controller.js | 2 +- server/api/intZohoField/intZohoField.model.js | 2 +- server/api/intZohoField/intZohoField.rpc.js | 2 +- server/api/integration/index.js | 2 +- server/api/integration/integration.attributes.js | 2 +- server/api/integration/integration.controller.js | 2 +- server/api/integration/integration.model.js | 2 +- server/api/integration/integration.rpc.js | 2 +- server/api/integrationReport/index.js | 2 +- .../integrationReport.attributes.js | 2 +- .../integrationReport.controller.js | 2 +- .../integrationReport/integrationReport.model.js | 2 +- .../api/integrationReport/integrationReport.rpc.js | 2 +- server/api/interval/index.js | 2 +- server/api/interval/interval.attributes.js | 2 +- server/api/interval/interval.controller.js | 2 +- server/api/interval/interval.model.js | 2 +- server/api/interval/interval.rpc.js | 2 +- server/api/jira/index.js | 2 +- server/api/jira/jira.controller.js | 2 +- server/api/jscriptyAnswerReport/index.js | 2 +- .../jscriptyAnswerReport.attributes.js | 2 +- .../jscriptyAnswerReport.controller.js | 2 +- .../jscriptyAnswerReport.model.js | 2 +- .../jscriptyAnswerReport.rpc.js | 2 +- server/api/jscriptyProject/index.js | 2 +- .../jscriptyProject/jscriptyProject.attributes.js | 2 +- .../jscriptyProject/jscriptyProject.controller.js | 2 +- .../api/jscriptyProject/jscriptyProject.model.js | 2 +- server/api/jscriptyProject/jscriptyProject.rpc.js | 2 +- server/api/jscriptyQuestionReport/index.js | 2 +- .../jscriptyQuestionReport.attributes.js | 2 +- .../jscriptyQuestionReport.controller.js | 2 +- .../jscriptyQuestionReport.model.js | 2 +- .../jscriptyQuestionReport.rpc.js | 2 +- server/api/jscriptySessionReport/index.js | 2 +- .../jscriptySessionReport.attributes.js | 2 +- .../jscriptySessionReport.controller.js | 2 +- .../jscriptySessionReport.model.js | 2 +- .../jscriptySessionReport.rpc.js | 2 +- server/api/license/index.js | 2 +- server/api/license/license.attributes.js | 2 +- server/api/license/license.controller.js | 2 +- server/api/license/license.model.js | 2 +- server/api/license/license.rpc.js | 2 +- server/api/mailAccount/index.js | 2 +- server/api/mailAccount/mailAccount.attributes.js | 2 +- server/api/mailAccount/mailAccount.controller.js | 2 +- server/api/mailAccount/mailAccount.events.js | 2 +- server/api/mailAccount/mailAccount.model.js | 2 +- server/api/mailAccount/mailAccount.rpc.js | 2 +- server/api/mailAccount/mailAccount.socket.js | 2 +- server/api/mailApplication/index.js | 2 +- .../mailApplication/mailApplication.attributes.js | 2 +- .../mailApplication/mailApplication.controller.js | 2 +- .../api/mailApplication/mailApplication.model.js | 2 +- server/api/mailApplication/mailApplication.rpc.js | 2 +- server/api/mailInteraction/index.js | 2 +- .../mailInteraction/mailInteraction.attributes.js | 2 +- .../mailInteraction/mailInteraction.controller.js | 2 +- .../api/mailInteraction/mailInteraction.events.js | 2 +- .../api/mailInteraction/mailInteraction.model.js | 2 +- server/api/mailInteraction/mailInteraction.rpc.js | 2 +- .../api/mailInteraction/mailInteraction.socket.js | 2 +- server/api/mailMessage/index.js | 2 +- server/api/mailMessage/mailMessage.attributes.js | 2 +- server/api/mailMessage/mailMessage.controller.js | 2 +- server/api/mailMessage/mailMessage.events.js | 2 +- server/api/mailMessage/mailMessage.model.js | 2 +- server/api/mailMessage/mailMessage.rpc.js | 2 +- server/api/mailMessage/mailMessage.socket.js | 2 +- server/api/mailQueue/index.js | 2 +- server/api/mailQueue/mailQueue.attributes.js | 2 +- server/api/mailQueue/mailQueue.controller.js | 2 +- server/api/mailQueue/mailQueue.events.js | 2 +- server/api/mailQueue/mailQueue.model.js | 2 +- server/api/mailQueue/mailQueue.rpc.js | 2 +- server/api/mailQueue/mailQueue.socket.js | 2 +- server/api/mailQueueReport/index.js | 2 +- .../mailQueueReport/mailQueueReport.attributes.js | 2 +- .../mailQueueReport/mailQueueReport.controller.js | 2 +- .../api/mailQueueReport/mailQueueReport.model.js | 2 +- server/api/mailQueueReport/mailQueueReport.rpc.js | 2 +- server/api/mailServerIn/index.js | 2 +- server/api/mailServerIn/mailServerIn.attributes.js | 2 +- server/api/mailServerIn/mailServerIn.model.js | 2 +- server/api/mailServerIn/mailServerIn.rpc.js | 2 +- server/api/mailServerOut/index.js | 2 +- .../api/mailServerOut/mailServerOut.attributes.js | 2 +- .../api/mailServerOut/mailServerOut.controller.js | 2 +- server/api/mailServerOut/mailServerOut.model.js | 2 +- server/api/mailServerOut/mailServerOut.rpc.js | 2 +- server/api/mailSubstatus/index.js | 2 +- .../api/mailSubstatus/mailSubstatus.attributes.js | 2 +- .../api/mailSubstatus/mailSubstatus.controller.js | 2 +- server/api/mailSubstatus/mailSubstatus.model.js | 2 +- server/api/mailSubstatus/mailSubstatus.rpc.js | 2 +- server/api/mailTransferReport/index.js | 2 +- .../mailTransferReport.attributes.js | 2 +- .../mailTransferReport.controller.js | 2 +- .../mailTransferReport/mailTransferReport.model.js | 2 +- .../mailTransferReport/mailTransferReport.rpc.js | 2 +- server/api/memberReport/index.js | 2 +- server/api/memberReport/memberReport.attributes.js | 2 +- server/api/memberReport/memberReport.controller.js | 2 +- server/api/memberReport/memberReport.model.js | 2 +- server/api/memberReport/memberReport.rpc.js | 2 +- server/api/migration/index.js | 2 +- server/api/migration/migration.attributes.js | 2 +- server/api/migration/migration.controller.js | 2 +- server/api/migration/migration.model.js | 2 +- server/api/migration/migration.rpc.js | 2 +- server/api/network/index.js | 2 +- server/api/network/network.attributes.js | 2 +- server/api/network/network.controller.js | 2 +- server/api/network/network.model.js | 2 +- server/api/network/network.rpc.js | 2 +- server/api/openchannelAccount/index.js | 2 +- .../openchannelAccount.attributes.js | 2 +- .../openchannelAccount.controller.js | 2 +- .../openchannelAccount.events.js | 2 +- .../openchannelAccount/openchannelAccount.model.js | 2 +- .../openchannelAccount/openchannelAccount.rpc.js | 2 +- .../openchannelAccount.socket.js | 2 +- server/api/openchannelApplication/index.js | 2 +- .../openchannelApplication.attributes.js | 2 +- .../openchannelApplication.controller.js | 2 +- .../openchannelApplication.model.js | 2 +- .../openchannelApplication.rpc.js | 2 +- server/api/openchannelInteraction/index.js | 2 +- .../openchannelInteraction.attributes.js | 2 +- .../openchannelInteraction.controller.js | 2 +- .../openchannelInteraction.events.js | 2 +- .../openchannelInteraction.model.js | 2 +- .../openchannelInteraction.rpc.js | 2 +- .../openchannelInteraction.socket.js | 2 +- server/api/openchannelMessage/index.js | 2 +- .../openchannelMessage.attributes.js | 2 +- .../openchannelMessage.controller.js | 2 +- .../openchannelMessage.events.js | 2 +- .../openchannelMessage/openchannelMessage.model.js | 2 +- .../openchannelMessage/openchannelMessage.rpc.js | 2 +- .../openchannelMessage.socket.js | 2 +- server/api/openchannelQueue/index.js | 2 +- .../openchannelQueue.attributes.js | 2 +- .../openchannelQueue.controller.js | 2 +- .../openchannelQueue/openchannelQueue.events.js | 2 +- .../api/openchannelQueue/openchannelQueue.model.js | 2 +- .../api/openchannelQueue/openchannelQueue.rpc.js | 2 +- .../openchannelQueue/openchannelQueue.socket.js | 2 +- server/api/openchannelQueueReport/index.js | 2 +- .../openchannelQueueReport.attributes.js | 2 +- .../openchannelQueueReport.controller.js | 2 +- .../openchannelQueueReport.model.js | 2 +- .../openchannelQueueReport.rpc.js | 2 +- server/api/openchannelTransferReport/index.js | 2 +- .../openchannelTransferReport.attributes.js | 2 +- .../openchannelTransferReport.controller.js | 2 +- .../openchannelTransferReport.model.js | 2 +- .../openchannelTransferReport.rpc.js | 2 +- server/api/pause/index.js | 2 +- server/api/pause/pause.attributes.js | 2 +- server/api/pause/pause.controller.js | 2 +- server/api/pause/pause.model.js | 2 +- server/api/pause/pause.rpc.js | 2 +- server/api/plugin/index.js | 2 +- server/api/plugin/plugin.attributes.js | 2 +- server/api/plugin/plugin.controller.js | 2 +- server/api/plugin/plugin.events.js | 2 +- server/api/plugin/plugin.model.js | 2 +- server/api/plugin/plugin.rpc.js | 2 +- server/api/plugin/plugin.socket.js | 2 +- server/api/pm2/index.js | 2 +- server/api/pm2/pm2.controller.js | 2 +- server/api/realtime/index.js | 2 +- server/api/realtime/realtime.controller.js | 2 +- server/api/reportAgentPreview/index.js | 2 +- .../reportAgentPreview.attributes.js | 2 +- .../reportAgentPreview/reportAgentPreview.model.js | 2 +- .../reportAgentPreview/reportAgentPreview.rpc.js | 2 +- server/api/rpc/index.js | 2 +- server/api/rpc/rpc.controller.js | 2 +- server/api/schedule/index.js | 2 +- server/api/schedule/schedule.attributes.js | 2 +- server/api/schedule/schedule.controller.js | 2 +- server/api/schedule/schedule.model.js | 2 +- server/api/schedule/schedule.rpc.js | 2 +- server/api/screenRecording/index.js | 2 +- .../screenRecording/screenRecording.attributes.js | 2 +- .../screenRecording/screenRecording.controller.js | 2 +- .../api/screenRecording/screenRecording.model.js | 2 +- server/api/screenRecording/screenRecording.rpc.js | 2 +- server/api/setting/index.js | 2 +- server/api/setting/setting.attributes.js | 2 +- server/api/setting/setting.controller.js | 2 +- server/api/setting/setting.model.js | 2 +- server/api/setting/setting.rpc.js | 2 +- server/api/smsAccount/index.js | 2 +- server/api/smsAccount/smsAccount.attributes.js | 2 +- server/api/smsAccount/smsAccount.controller.js | 2 +- server/api/smsAccount/smsAccount.events.js | 2 +- server/api/smsAccount/smsAccount.model.js | 2 +- server/api/smsAccount/smsAccount.rpc.js | 2 +- server/api/smsAccount/smsAccount.socket.js | 2 +- server/api/smsApplication/index.js | 2 +- .../smsApplication/smsApplication.attributes.js | 2 +- .../smsApplication/smsApplication.controller.js | 2 +- server/api/smsApplication/smsApplication.model.js | 2 +- server/api/smsApplication/smsApplication.rpc.js | 2 +- server/api/smsInteraction/index.js | 2 +- .../smsInteraction/smsInteraction.attributes.js | 2 +- .../smsInteraction/smsInteraction.controller.js | 2 +- server/api/smsInteraction/smsInteraction.events.js | 2 +- server/api/smsInteraction/smsInteraction.model.js | 2 +- server/api/smsInteraction/smsInteraction.rpc.js | 2 +- server/api/smsInteraction/smsInteraction.socket.js | 2 +- server/api/smsMessage/index.js | 2 +- server/api/smsMessage/smsMessage.attributes.js | 2 +- server/api/smsMessage/smsMessage.controller.js | 2 +- server/api/smsMessage/smsMessage.events.js | 2 +- server/api/smsMessage/smsMessage.model.js | 2 +- server/api/smsMessage/smsMessage.rpc.js | 2 +- server/api/smsMessage/smsMessage.socket.js | 2 +- server/api/smsQueue/index.js | 2 +- server/api/smsQueue/smsQueue.attributes.js | 2 +- server/api/smsQueue/smsQueue.controller.js | 2 +- server/api/smsQueue/smsQueue.events.js | 2 +- server/api/smsQueue/smsQueue.model.js | 2 +- server/api/smsQueue/smsQueue.rpc.js | 2 +- server/api/smsQueue/smsQueue.socket.js | 2 +- server/api/smsQueueReport/index.js | 2 +- .../smsQueueReport/smsQueueReport.attributes.js | 2 +- .../smsQueueReport/smsQueueReport.controller.js | 2 +- server/api/smsQueueReport/smsQueueReport.model.js | 2 +- server/api/smsQueueReport/smsQueueReport.rpc.js | 2 +- server/api/smsTransferReport/index.js | 2 +- .../smsTransferReport.attributes.js | 2 +- .../smsTransferReport.controller.js | 2 +- .../smsTransferReport/smsTransferReport.model.js | 2 +- .../api/smsTransferReport/smsTransferReport.rpc.js | 2 +- server/api/sound/index.js | 2 +- server/api/sound/sound.attributes.js | 2 +- server/api/sound/sound.controller.js | 2 +- server/api/sound/sound.model.js | 2 +- server/api/sound/sound.rpc.js | 2 +- server/api/squareMessage/index.js | 2 +- .../api/squareMessage/squareMessage.attributes.js | 2 +- .../api/squareMessage/squareMessage.controller.js | 2 +- server/api/squareMessage/squareMessage.model.js | 2 +- server/api/squareMessage/squareMessage.rpc.js | 2 +- server/api/squareOdbc/index.js | 2 +- server/api/squareOdbc/squareOdbc.attributes.js | 2 +- server/api/squareOdbc/squareOdbc.controller.js | 2 +- server/api/squareOdbc/squareOdbc.model.js | 2 +- server/api/squareOdbc/squareOdbc.rpc.js | 2 +- server/api/squareProject/index.js | 2 +- .../api/squareProject/squareProject.attributes.js | 2 +- .../api/squareProject/squareProject.controller.js | 2 +- server/api/squareProject/squareProject.events.js | 2 +- server/api/squareProject/squareProject.model.js | 2 +- server/api/squareProject/squareProject.rpc.js | 2 +- server/api/squareProject/squareProject.socket.js | 2 +- server/api/squareRecording/index.js | 2 +- .../squareRecording/squareRecording.attributes.js | 2 +- .../squareRecording/squareRecording.controller.js | 2 +- .../api/squareRecording/squareRecording.model.js | 2 +- server/api/squareRecording/squareRecording.rpc.js | 2 +- server/api/squareReport/index.js | 2 +- server/api/squareReport/squareReport.attributes.js | 2 +- server/api/squareReport/squareReport.controller.js | 2 +- server/api/squareReport/squareReport.model.js | 2 +- server/api/squareReport/squareReport.rpc.js | 2 +- server/api/squareReportDetail/index.js | 2 +- .../squareReportDetail.attributes.js | 2 +- .../squareReportDetail.controller.js | 2 +- .../squareReportDetail/squareReportDetail.model.js | 2 +- .../squareReportDetail/squareReportDetail.rpc.js | 2 +- server/api/system/index.js | 2 +- server/api/system/system.controller.js | 2 +- server/api/tag/index.js | 2 +- server/api/tag/tag.attributes.js | 2 +- server/api/tag/tag.controller.js | 2 +- server/api/tag/tag.model.js | 2 +- server/api/tag/tag.rpc.js | 2 +- server/api/team/index.js | 2 +- server/api/team/team.attributes.js | 2 +- server/api/team/team.controller.js | 2 +- server/api/team/team.events.js | 2 +- server/api/team/team.model.js | 2 +- server/api/team/team.rpc.js | 2 +- server/api/team/team.socket.js | 2 +- server/api/teamVoicePrefix/index.js | 2 +- .../teamVoicePrefix/teamVoicePrefix.attributes.js | 2 +- .../api/teamVoicePrefix/teamVoicePrefix.model.js | 2 +- server/api/teamVoicePrefix/teamVoicePrefix.rpc.js | 2 +- server/api/teamVoiceQueue/index.js | 2 +- .../teamVoiceQueue/teamVoiceQueue.attributes.js | 2 +- server/api/teamVoiceQueue/teamVoiceQueue.model.js | 2 +- server/api/teamVoiceQueue/teamVoiceQueue.rpc.js | 2 +- server/api/template/index.js | 2 +- server/api/template/template.attributes.js | 2 +- server/api/template/template.controller.js | 2 +- server/api/template/template.model.js | 2 +- server/api/template/template.rpc.js | 2 +- server/api/trigger/index.js | 2 +- server/api/trigger/trigger.attributes.js | 2 +- server/api/trigger/trigger.controller.js | 2 +- server/api/trigger/trigger.model.js | 2 +- server/api/trigger/trigger.rpc.js | 2 +- server/api/trunk/index.js | 2 +- server/api/trunk/trunk.attributes.js | 2 +- server/api/trunk/trunk.controller.js | 2 +- server/api/trunk/trunk.model.js | 2 +- server/api/trunk/trunk.rpc.js | 2 +- server/api/user/index.js | 2 +- server/api/user/user.attributes.js | 2 +- server/api/user/user.controller.js | 2 +- server/api/user/user.events.js | 2 +- server/api/user/user.model.js | 2 +- server/api/user/user.rpc.js | 2 +- server/api/user/user.socket.js | 2 +- server/api/userChatQueue/index.js | 2 +- .../api/userChatQueue/userChatQueue.attributes.js | 2 +- server/api/userChatQueue/userChatQueue.model.js | 2 +- server/api/userChatQueue/userChatQueue.rpc.js | 2 +- server/api/userFaxQueue/index.js | 2 +- server/api/userFaxQueue/userFaxQueue.attributes.js | 2 +- server/api/userFaxQueue/userFaxQueue.model.js | 2 +- server/api/userFaxQueue/userFaxQueue.rpc.js | 2 +- server/api/userMailQueue/index.js | 2 +- .../api/userMailQueue/userMailQueue.attributes.js | 2 +- server/api/userMailQueue/userMailQueue.model.js | 2 +- server/api/userMailQueue/userMailQueue.rpc.js | 2 +- server/api/userNotification/index.js | 2 +- .../userNotification.attributes.js | 2 +- .../userNotification.controller.js | 2 +- .../userNotification/userNotification.events.js | 2 +- .../api/userNotification/userNotification.model.js | 2 +- .../api/userNotification/userNotification.rpc.js | 2 +- .../userNotification/userNotification.socket.js | 2 +- server/api/userOpenchannelQueue/index.js | 2 +- .../userOpenchannelQueue.attributes.js | 2 +- .../userOpenchannelQueue.model.js | 2 +- .../userOpenchannelQueue.rpc.js | 2 +- server/api/userProfile/index.js | 2 +- server/api/userProfile/userProfile.attributes.js | 2 +- server/api/userProfile/userProfile.controller.js | 2 +- server/api/userProfile/userProfile.events.js | 2 +- server/api/userProfile/userProfile.model.js | 2 +- server/api/userProfile/userProfile.rpc.js | 2 +- server/api/userProfile/userProfile.socket.js | 2 +- server/api/userProfileResource/index.js | 2 +- .../userProfileResource.attributes.js | 2 +- .../userProfileResource.controller.js | 2 +- .../userProfileResource.model.js | 2 +- .../userProfileResource/userProfileResource.rpc.js | 2 +- server/api/userProfileSection/index.js | 2 +- .../userProfileSection.attributes.js | 2 +- .../userProfileSection.controller.js | 2 +- .../userProfileSection/userProfileSection.model.js | 2 +- .../userProfileSection/userProfileSection.rpc.js | 2 +- server/api/userSmsQueue/index.js | 2 +- server/api/userSmsQueue/userSmsQueue.attributes.js | 2 +- server/api/userSmsQueue/userSmsQueue.model.js | 2 +- server/api/userSmsQueue/userSmsQueue.rpc.js | 2 +- server/api/userVoicePrefix/index.js | 2 +- .../userVoicePrefix/userVoicePrefix.attributes.js | 2 +- .../api/userVoicePrefix/userVoicePrefix.model.js | 2 +- server/api/userVoicePrefix/userVoicePrefix.rpc.js | 2 +- server/api/userVoiceQueue/index.js | 2 +- .../userVoiceQueue/userVoiceQueue.attributes.js | 2 +- server/api/userVoiceQueue/userVoiceQueue.model.js | 2 +- server/api/userVoiceQueue/userVoiceQueue.rpc.js | 2 +- server/api/userVoiceQueueRt/index.js | 2 +- .../userVoiceQueueRt.attributes.js | 2 +- .../userVoiceQueueRt/userVoiceQueueRt.events.js | 2 +- .../api/userVoiceQueueRt/userVoiceQueueRt.model.js | 2 +- .../api/userVoiceQueueRt/userVoiceQueueRt.rpc.js | 2 +- .../userVoiceQueueRt/userVoiceQueueRt.socket.js | 2 +- server/api/userWhatsappQueue/index.js | 2 +- .../userWhatsappQueue.attributes.js | 2 +- .../userWhatsappQueue/userWhatsappQueue.model.js | 2 +- .../api/userWhatsappQueue/userWhatsappQueue.rpc.js | 2 +- server/api/variable/index.js | 2 +- server/api/variable/variable.attributes.js | 2 +- server/api/variable/variable.controller.js | 2 +- server/api/variable/variable.model.js | 2 +- server/api/variable/variable.rpc.js | 2 +- server/api/version/index.js | 2 +- server/api/version/version.controller.js | 2 +- server/api/voiceAgentReport/index.js | 2 +- .../voiceAgentReport.attributes.js | 2 +- .../voiceAgentReport.controller.js | 2 +- .../api/voiceAgentReport/voiceAgentReport.model.js | 2 +- .../api/voiceAgentReport/voiceAgentReport.rpc.js | 2 +- server/api/voiceCallReport/index.js | 2 +- .../voiceCallReport/voiceCallReport.attributes.js | 2 +- .../voiceCallReport/voiceCallReport.controller.js | 2 +- .../api/voiceCallReport/voiceCallReport.model.js | 2 +- server/api/voiceCallReport/voiceCallReport.rpc.js | 2 +- server/api/voiceChanSpy/index.js | 2 +- server/api/voiceChanSpy/voiceChanSpy.attributes.js | 2 +- server/api/voiceChanSpy/voiceChanSpy.controller.js | 2 +- server/api/voiceChanSpy/voiceChanSpy.model.js | 2 +- server/api/voiceChanSpy/voiceChanSpy.rpc.js | 2 +- server/api/voiceContext/index.js | 2 +- server/api/voiceContext/voiceContext.attributes.js | 2 +- server/api/voiceContext/voiceContext.controller.js | 2 +- server/api/voiceContext/voiceContext.model.js | 2 +- server/api/voiceContext/voiceContext.rpc.js | 2 +- server/api/voiceDialReport/index.js | 2 +- .../voiceDialReport/voiceDialReport.attributes.js | 2 +- .../voiceDialReport/voiceDialReport.controller.js | 2 +- .../api/voiceDialReport/voiceDialReport.model.js | 2 +- server/api/voiceDialReport/voiceDialReport.rpc.js | 2 +- server/api/voiceExtension/index.js | 2 +- .../voiceExtension/voiceExtension.attributes.js | 2 +- .../voiceExtension/voiceExtension.controller.js | 2 +- server/api/voiceExtension/voiceExtension.events.js | 2 +- server/api/voiceExtension/voiceExtension.model.js | 2 +- server/api/voiceExtension/voiceExtension.rpc.js | 2 +- server/api/voiceExtension/voiceExtension.socket.js | 2 +- server/api/voiceMail/index.js | 2 +- server/api/voiceMail/voiceMail.attributes.js | 2 +- server/api/voiceMail/voiceMail.controller.js | 2 +- server/api/voiceMail/voiceMail.model.js | 2 +- server/api/voiceMail/voiceMail.rpc.js | 2 +- server/api/voiceMailMessage/index.js | 2 +- .../voiceMailMessage.attributes.js | 2 +- .../voiceMailMessage.controller.js | 2 +- .../api/voiceMailMessage/voiceMailMessage.model.js | 2 +- .../api/voiceMailMessage/voiceMailMessage.rpc.js | 2 +- server/api/voiceMusicOnHold/index.js | 2 +- .../voiceMusicOnHold.attributes.js | 2 +- .../voiceMusicOnHold.controller.js | 2 +- .../api/voiceMusicOnHold/voiceMusicOnHold.model.js | 2 +- .../api/voiceMusicOnHold/voiceMusicOnHold.rpc.js | 2 +- server/api/voicePrefix/index.js | 2 +- server/api/voicePrefix/voicePrefix.attributes.js | 2 +- server/api/voicePrefix/voicePrefix.controller.js | 2 +- server/api/voicePrefix/voicePrefix.events.js | 2 +- server/api/voicePrefix/voicePrefix.model.js | 2 +- server/api/voicePrefix/voicePrefix.rpc.js | 2 +- server/api/voicePrefix/voicePrefix.socket.js | 2 +- server/api/voiceQueue/index.js | 2 +- server/api/voiceQueue/voiceQueue.attributes.js | 2 +- server/api/voiceQueue/voiceQueue.controller.js | 2 +- server/api/voiceQueue/voiceQueue.events.js | 2 +- server/api/voiceQueue/voiceQueue.model.js | 2 +- server/api/voiceQueue/voiceQueue.rpc.js | 2 +- server/api/voiceQueue/voiceQueue.socket.js | 2 +- server/api/voiceQueueReport/index.js | 2 +- .../voiceQueueReport.attributes.js | 2 +- .../voiceQueueReport.controller.js | 2 +- .../voiceQueueReport/voiceQueueReport.events.js | 2 +- .../api/voiceQueueReport/voiceQueueReport.model.js | 2 +- .../api/voiceQueueReport/voiceQueueReport.rpc.js | 2 +- .../voiceQueueReport/voiceQueueReport.socket.js | 2 +- server/api/voiceQueuesLog/index.js | 2 +- .../voiceQueuesLog/voiceQueuesLog.attributes.js | 2 +- .../voiceQueuesLog/voiceQueuesLog.controller.js | 2 +- server/api/voiceQueuesLog/voiceQueuesLog.model.js | 2 +- server/api/voiceQueuesLog/voiceQueuesLog.rpc.js | 2 +- server/api/voiceRecording/index.js | 2 +- .../voiceRecording/voiceRecording.attributes.js | 2 +- .../voiceRecording/voiceRecording.controller.js | 2 +- server/api/voiceRecording/voiceRecording.model.js | 2 +- server/api/voiceRecording/voiceRecording.rpc.js | 2 +- server/api/voiceTransferReport/index.js | 2 +- .../voiceTransferReport.attributes.js | 2 +- .../voiceTransferReport.controller.js | 2 +- .../voiceTransferReport.model.js | 2 +- .../voiceTransferReport/voiceTransferReport.rpc.js | 2 +- server/api/webbar/index.js | 2 +- server/api/webbar/webbar.controller.js | 2 +- server/api/whatsappAccount/index.js | 2 +- .../whatsappAccount/whatsappAccount.attributes.js | 2 +- .../whatsappAccount/whatsappAccount.controller.js | 2 +- .../api/whatsappAccount/whatsappAccount.events.js | 2 +- .../api/whatsappAccount/whatsappAccount.model.js | 2 +- server/api/whatsappAccount/whatsappAccount.rpc.js | 2 +- .../api/whatsappAccount/whatsappAccount.socket.js | 2 +- server/api/whatsappApplication/index.js | 2 +- .../whatsappApplication.attributes.js | 2 +- .../whatsappApplication.controller.js | 2 +- .../whatsappApplication.model.js | 2 +- .../whatsappApplication/whatsappApplication.rpc.js | 2 +- server/api/whatsappInteraction/index.js | 2 +- .../whatsappInteraction.attributes.js | 2 +- .../whatsappInteraction.controller.js | 2 +- .../whatsappInteraction.events.js | 2 +- .../whatsappInteraction.model.js | 2 +- .../whatsappInteraction/whatsappInteraction.rpc.js | 2 +- .../whatsappInteraction.socket.js | 2 +- server/api/whatsappMessage/index.js | 2 +- .../whatsappMessage/whatsappMessage.attributes.js | 2 +- .../whatsappMessage/whatsappMessage.controller.js | 2 +- .../api/whatsappMessage/whatsappMessage.events.js | 2 +- .../api/whatsappMessage/whatsappMessage.model.js | 2 +- server/api/whatsappMessage/whatsappMessage.rpc.js | 2 +- .../api/whatsappMessage/whatsappMessage.socket.js | 2 +- server/api/whatsappQueue/index.js | 2 +- .../api/whatsappQueue/whatsappQueue.attributes.js | 2 +- .../api/whatsappQueue/whatsappQueue.controller.js | 2 +- server/api/whatsappQueue/whatsappQueue.events.js | 2 +- server/api/whatsappQueue/whatsappQueue.model.js | 2 +- server/api/whatsappQueue/whatsappQueue.rpc.js | 2 +- server/api/whatsappQueue/whatsappQueue.socket.js | 2 +- server/api/whatsappQueueReport/index.js | 2 +- .../whatsappQueueReport.attributes.js | 2 +- .../whatsappQueueReport.controller.js | 2 +- .../whatsappQueueReport.model.js | 2 +- .../whatsappQueueReport/whatsappQueueReport.rpc.js | 2 +- server/api/whatsappTransferReport/index.js | 2 +- .../whatsappTransferReport.attributes.js | 2 +- .../whatsappTransferReport.controller.js | 2 +- .../whatsappTransferReport.model.js | 2 +- .../whatsappTransferReport.rpc.js | 2 +- server/app.js | 2 +- server/components/auth/service.js | 2 +- server/components/encryptor/index.js | 2 +- server/components/export/csv.js | 2 +- server/components/export/pdf.js | 2 +- server/components/export/xlsx.js | 2 +- server/components/extensions/rewrite.js | 2 +- server/components/import/cm/csv.js | 2 +- server/components/import/cm/csv2.js | 2 +- server/components/integrations/configuration.js | 2 +- server/components/interaction/service.js | 2 +- server/components/license/service.js | 2 +- server/components/parsers/advancedSearch.js | 2 +- server/components/parsers/qs.js | 2 +- server/config/express.js | 2 +- server/config/license/hardware.js | 2 +- server/config/license/index.js | 2 +- server/config/license/util.js | 2 +- server/config/local.env.js | 2 +- server/config/logger.js | 2 +- server/config/pm2/config.js | 2 +- server/config/pm2/index.js | 2 +- server/config/schedule/chat.js | 2 +- server/config/schedule/index.js | 2 +- server/config/schedule/transcribe.js | 2 +- server/config/schedule/whatsapp.js | 2 +- server/config/seedContact.js | 2 +- server/config/seedUsers.js | 2 +- server/config/socketio.js | 2 +- server/config/triggers/index.js | 2 +- server/config/utils.js | 2 +- server/errors/index.js | 2 +- server/mysqldb/index.js | 2 +- server/routes.js | 2 +- server/rpc/index.js | 2 +- server/services/agi/channel.js | 2 +- server/services/agi/error.js | 2 +- server/services/agi/graph/index.js | 2 +- server/services/agi/index.js | 2 +- server/services/agi/mailRpc/index.js | 2 +- server/services/agi/reply.js | 2 +- server/services/agi/rpc/index.js | 2 +- server/services/agi/scripts/aws/index.js | 2 +- server/services/agi/scripts/aws/lex/index.js | 2 +- server/services/agi/scripts/aws/lex/lib/api.js | 2 +- server/services/agi/scripts/aws/polly/index.js | 2 +- server/services/agi/scripts/aws/polly/lib/api.js | 2 +- server/services/agi/scripts/google/asr/index.js | 2 +- server/services/agi/scripts/google/asr/lib/api.js | 2 +- server/services/agi/scripts/google/index.js | 2 +- server/services/agi/scripts/index.js | 2 +- server/services/agi/scripts/sestek/index.js | 2 +- server/services/agi/scripts/sestek/nda/index.js | 2 +- server/services/agi/scripts/tilde/asr/index.js | 2 +- server/services/agi/scripts/tilde/asr/lib/api.js | 2 +- server/services/agi/scripts/tilde/index.js | 2 +- server/services/agi/server.js | 2 +- server/services/agi/vertices.js | 2 +- server/services/ami/acw/index.js | 2 +- server/services/ami/ami.js | 2 +- server/services/ami/client.js | 2 +- server/services/ami/dialer/action.js | 2 +- server/services/ami/dialer/agentComplete.js | 2 +- server/services/ami/dialer/final.js | 2 +- server/services/ami/dialer/hangup.js | 2 +- server/services/ami/dialer/history.js | 2 +- server/services/ami/dialer/index.js | 2 +- server/services/ami/dialer/queueCallerAbandon.js | 2 +- server/services/ami/fax/action.js | 2 +- server/services/ami/fax/index.js | 2 +- server/services/ami/fax/rpcDb.js | 2 +- server/services/ami/fax/util/gs.js | 2 +- server/services/ami/fax/util/util.js | 2 +- server/services/ami/index.js | 2 +- server/services/ami/model/agent.js | 2 +- server/services/ami/model/campaign.js | 2 +- server/services/ami/model/channel.js | 2 +- server/services/ami/model/deskAccount.js | 2 +- server/services/ami/model/dynamics365Account.js | 2 +- server/services/ami/model/faxAccount.js | 2 +- server/services/ami/model/freshdeskAccount.js | 2 +- server/services/ami/model/freshsalesAccount.js | 2 +- server/services/ami/model/queueReport.js | 2 +- server/services/ami/model/salesforceAccount.js | 2 +- server/services/ami/model/servicenowAccount.js | 2 +- server/services/ami/model/sugarcrmAccount.js | 2 +- server/services/ami/model/telephone.js | 2 +- server/services/ami/model/template.js | 2 +- server/services/ami/model/trigger.js | 2 +- server/services/ami/model/trunk.js | 2 +- server/services/ami/model/voiceExtension.js | 2 +- server/services/ami/model/voiceQueue.js | 2 +- server/services/ami/model/vtigerAccount.js | 2 +- server/services/ami/model/zendeskAccount.js | 2 +- server/services/ami/model/zohoAccount.js | 2 +- server/services/ami/preview/action.js | 2 +- server/services/ami/preview/index.js | 2 +- server/services/ami/preview/rpcDb.js | 2 +- server/services/ami/preview/util/util.js | 2 +- server/services/ami/properties.js | 2 +- server/services/ami/realtime/index.js | 2 +- server/services/ami/report/index.js | 2 +- server/services/ami/report/userReport.js | 2 +- server/services/ami/report/voiceAgentReport.js | 2 +- server/services/ami/report/voiceCallReport.js | 2 +- server/services/ami/report/voiceDialReport.js | 2 +- server/services/ami/report/voiceQueueReport.js | 2 +- server/services/ami/rpc/agentReportPreview.js | 2 +- server/services/ami/rpc/attachment.js | 2 +- server/services/ami/rpc/campaign.js | 2 +- server/services/ami/rpc/cmContact.js | 2 +- server/services/ami/rpc/cmHopper.js | 2 +- server/services/ami/rpc/cmHopperBlack.js | 2 +- server/services/ami/rpc/cmHopperFinal.js | 2 +- server/services/ami/rpc/cmHopperHistory.js | 2 +- server/services/ami/rpc/faxAccount.js | 2 +- server/services/ami/rpc/faxMessage.js | 2 +- server/services/ami/rpc/integrations/desk.js | 2 +- .../services/ami/rpc/integrations/dynamics365.js | 2 +- server/services/ami/rpc/integrations/freshdesk.js | 2 +- server/services/ami/rpc/integrations/freshsales.js | 2 +- server/services/ami/rpc/integrations/salesforce.js | 2 +- server/services/ami/rpc/integrations/servicenow.js | 2 +- server/services/ami/rpc/integrations/sugarcrm.js | 2 +- server/services/ami/rpc/integrations/vtiger.js | 2 +- server/services/ami/rpc/integrations/zendesk.js | 2 +- server/services/ami/rpc/integrations/zoho.js | 2 +- server/services/ami/rpc/memberReport.js | 2 +- server/services/ami/rpc/setting.js | 2 +- server/services/ami/rpc/template.js | 2 +- server/services/ami/rpc/trigger.js | 2 +- server/services/ami/rpc/trunk.js | 2 +- server/services/ami/rpc/user.js | 2 +- server/services/ami/rpc/voiceAgentReport.js | 2 +- server/services/ami/rpc/voiceCallReport.js | 2 +- server/services/ami/rpc/voiceDialReport.js | 2 +- server/services/ami/rpc/voiceExtension.js | 2 +- server/services/ami/rpc/voiceQueue.js | 2 +- server/services/ami/rpc/voiceQueueReport.js | 2 +- server/services/ami/rpc/voiceQueueRt.js | 2 +- server/services/ami/rpc/voiceRecording.js | 2 +- server/services/ami/rpc/voiceTransferReport.js | 2 +- server/services/ami/server/index.js | 2 +- server/services/ami/trigger/cmContact/index.js | 2 +- server/services/ami/trigger/index.js | 2 +- server/services/ami/trigger/integration/desk.js | 2 +- .../ami/trigger/integration/dynamics365.js | 2 +- .../services/ami/trigger/integration/freshdesk.js | 2 +- .../services/ami/trigger/integration/freshsales.js | 2 +- server/services/ami/trigger/integration/index.js | 2 +- .../services/ami/trigger/integration/salesforce.js | 2 +- .../services/ami/trigger/integration/servicenow.js | 2 +- .../services/ami/trigger/integration/sugarcrm.js | 2 +- server/services/ami/trigger/integration/util.js | 2 +- server/services/ami/trigger/integration/vtiger.js | 2 +- server/services/ami/trigger/integration/zendesk.js | 2 +- server/services/ami/trigger/integration/zoho.js | 2 +- server/services/ami/trigger/script/index.js | 2 +- server/services/ami/trigger/urlforward/index.js | 2 +- server/services/email/client.js | 2 +- server/services/email/index.js | 2 +- server/services/email/lib/email.js | 2 +- server/services/email/lib/imap.js | 2 +- server/services/email/lib/smtp.js | 2 +- server/services/email/lib/utils.js | 2 +- server/services/email/model/mailAccount.js | 2 +- server/services/email/realtime/index.js | 2 +- server/services/email/rpc/mailAccount.js | 2 +- server/services/email/rpc/setting.js | 2 +- server/services/email/server/index.js | 2 +- server/services/express/index.js | 2 +- server/services/routing/client.js | 2 +- server/services/routing/index.js | 2 +- server/services/routing/lib/rule-engine.js | 2 +- server/services/routing/mailRpc/index.js | 2 +- server/services/routing/model/agent.js | 2 +- server/services/routing/model/chatQueue.js | 2 +- server/services/routing/model/faxQueue.js | 2 +- server/services/routing/model/interval.js | 2 +- server/services/routing/model/mailQueue.js | 2 +- server/services/routing/model/openchannelQueue.js | 2 +- server/services/routing/model/smsQueue.js | 2 +- server/services/routing/model/whatsappQueue.js | 2 +- server/services/routing/realtime/index.js | 2 +- server/services/routing/rpc/chatInteraction.js | 2 +- server/services/routing/rpc/chatMessage.js | 2 +- server/services/routing/rpc/chatQueue.js | 2 +- server/services/routing/rpc/chatQueueReport.js | 2 +- server/services/routing/rpc/faxInteraction.js | 2 +- server/services/routing/rpc/faxMessage.js | 2 +- server/services/routing/rpc/faxQueue.js | 2 +- server/services/routing/rpc/faxQueueReport.js | 2 +- server/services/routing/rpc/interval.js | 2 +- server/services/routing/rpc/mailInteraction.js | 2 +- server/services/routing/rpc/mailMessage.js | 2 +- server/services/routing/rpc/mailQueue.js | 2 +- server/services/routing/rpc/mailQueueReport.js | 2 +- .../services/routing/rpc/openchannelInteraction.js | 2 +- server/services/routing/rpc/openchannelMessage.js | 2 +- server/services/routing/rpc/openchannelQueue.js | 2 +- .../services/routing/rpc/openchannelQueueReport.js | 2 +- server/services/routing/rpc/smsInteraction.js | 2 +- server/services/routing/rpc/smsMessage.js | 2 +- server/services/routing/rpc/smsQueue.js | 2 +- server/services/routing/rpc/smsQueueReport.js | 2 +- server/services/routing/rpc/user.js | 2 +- server/services/routing/rpc/whatsappInteraction.js | 2 +- server/services/routing/rpc/whatsappMessage.js | 2 +- server/services/routing/rpc/whatsappQueue.js | 2 +- server/services/routing/rpc/whatsappQueueReport.js | 2 +- .../services/routing/server/applications/agent.js | 2 +- .../routing/server/applications/amazonlex.js | 2 +- .../routing/server/applications/autoreply.js | 2 +- .../services/routing/server/applications/close.js | 2 +- .../routing/server/applications/dialogflow.js | 2 +- .../routing/server/applications/dialogflowV2.js | 2 +- .../services/routing/server/applications/gotoif.js | 2 +- .../services/routing/server/applications/gotop.js | 2 +- .../routing/server/applications/message.js | 2 +- .../services/routing/server/applications/noop.js | 2 +- .../services/routing/server/applications/queue.js | 2 +- .../routing/server/applications/strategy/agent.js | 2 +- .../server/applications/strategy/beepall.js | 2 +- .../routing/server/applications/strategy/index.js | 2 +- .../server/applications/strategy/rrmemory.js | 2 +- .../routing/server/applications/strategy/util.js | 2 +- .../services/routing/server/applications/system.js | 2 +- server/services/routing/server/applications/tag.js | 2 +- .../services/routing/server/applications/utils.js | 2 +- server/services/routing/server/index.js | 2 +- server/services/routing/server/interval.js | 2 +- server/services/xdr/agents.controller.js | 2 +- server/services/xdr/calls.controller.js | 2 +- server/services/xdr/core.controller.js | 2 +- server/services/xdr/dials.controller.js | 2 +- server/services/xdr/index.js | 2 +- server/services/xdr/members.controller.js | 2 +- server/services/xdr/queues.controller.js | 2 +- server/services/xdr/recordings.controller.js | 2 +- server/services/xdr/transfers.controller.js | 2 +- server/services/xdr/utils.js | 2 +- 1155 files changed, 1155 insertions(+), 1155 deletions(-) diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 2b60c5f..d435e56 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-09-03T14:25:03.223Z", + "time": "2021-09-03T14:37:22.620Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index fb92508..dea3609 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-09-03T14:25:03.223Z", + "time": "2021-09-03T14:37:22.620Z", "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 efe9f70..60d8b7a 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 _0xfc46=['TEXT','urlForward[body]','sequelize','VIRTUAL','getDataValue','STRING','contactManager','integration','motionbar','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth]','urlForward[headers],\x20browser[wsindowHeight]'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfc46,0x9a));var _0x6fc4=function(_0x3b085,_0x250543){_0x3b085=_0x3b085-0x0;var _0x476a57=_0xfc46[_0x3b085];return _0x476a57;};'use strict';var Sequelize=require(_0x6fc4('0x0'));module['exports']={'name':{'type':Sequelize[_0x6fc4('0x1')],'get':function(_0x2818de){return this[_0x6fc4('0x2')]('action');}},'action':{'type':Sequelize[_0x6fc4('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0x6fc4('0x4'),_0x6fc4('0x5'),_0x6fc4('0x6'),'jscripty',_0x6fc4('0x7'),_0x6fc4('0x8'),_0x6fc4('0x9'),_0x6fc4('0xa')]],'msg':_0x6fc4('0xb')}},'comment':_0x6fc4('0xb')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x6fc4('0xc')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0x6fc4('0xd')},'data3':{'type':Sequelize[_0x6fc4('0x3')](0x1000),'comment':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize[_0x6fc4('0x3')](0x1000),'comments':_0x6fc4('0xe')},'data5':{'type':Sequelize[_0x6fc4('0x3')](0x1000),'comments':_0x6fc4('0xf')},'data6':{'type':Sequelize[_0x6fc4('0x3')],'comments':_0x6fc4('0x10')},'data7':{'type':Sequelize[_0x6fc4('0x11')],'comments':_0x6fc4('0x12')}}; \ No newline at end of file +var _0x3f8a=['jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','exports','VIRTUAL','action','STRING','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'];(function(_0x43d0e7,_0x201b93){var _0x1bfd9c=function(_0x4ffe28){while(--_0x4ffe28){_0x43d0e7['push'](_0x43d0e7['shift']());}};_0x1bfd9c(++_0x201b93);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x271ad2,_0x2c93eb){_0x271ad2=_0x271ad2-0x0;var _0x3ee9e4=_0x3f8a[_0x271ad2];return _0x3ee9e4;};'use strict';var Sequelize=require(_0xa3f8('0x0'));module[_0xa3f8('0x1')]={'name':{'type':Sequelize[_0xa3f8('0x2')],'get':function(_0x23c224){return this['getDataValue'](_0xa3f8('0x3'));}},'action':{'type':Sequelize[_0xa3f8('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0xa3f8('0x5'),_0xa3f8('0x6'),_0xa3f8('0x7'),_0xa3f8('0x8'),_0xa3f8('0x9'),_0xa3f8('0xa'),_0xa3f8('0xb'),_0xa3f8('0xc')]],'msg':_0xa3f8('0xd')}},'comment':_0xa3f8('0xd')},'data1':{'type':Sequelize[_0xa3f8('0x4')](0x1000),'comment':_0xa3f8('0xe')},'data2':{'type':Sequelize[_0xa3f8('0x4')](0x1000),'comment':_0xa3f8('0xf')},'data3':{'type':Sequelize[_0xa3f8('0x4')](0x1000),'comment':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize[_0xa3f8('0x4')](0x1000),'comments':_0xa3f8('0x10')},'data5':{'type':Sequelize[_0xa3f8('0x4')](0x1000),'comments':_0xa3f8('0x11')},'data6':{'type':Sequelize['STRING'],'comments':_0xa3f8('0x12')},'data7':{'type':Sequelize[_0xa3f8('0x13')],'comments':_0xa3f8('0x14')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index e501ba9..2e288ea 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 _0xec4a=['error','stack','name','body','find','params','Action','eml-format','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','save','update','then','destroy'];(function(_0x53c098,_0xdea94a){var _0x4cd7=function(_0x14d334){while(--_0x14d334){_0x53c098['push'](_0x53c098['shift']());}};_0x4cd7(++_0xdea94a);}(_0xec4a,0x1ab));var _0xaec4=function(_0x30880e,_0x4c2699){_0x30880e=_0x30880e-0x0;var _0x2cc6ac=_0xec4a[_0x30880e];return _0x2cc6ac;};'use strict';var emlformat=require(_0xaec4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xaec4('0x1'));var jsonpatch=require(_0xaec4('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xaec4('0x3'));var Mustache=require(_0xaec4('0x4'));var util=require('util');var path=require(_0xaec4('0x5'));var sox=require(_0xaec4('0x6'));var csv=require(_0xaec4('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xaec4('0x8'));var crypto=require(_0xaec4('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xaec4('0xa'));var toCsv=require(_0xaec4('0x7'));var querystring=require('querystring');var Papa=require(_0xaec4('0xb'));var Redis=require('ioredis');var authService=require(_0xaec4('0xc'));var qs=require(_0xaec4('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaec4('0xe'));var logger=require(_0xaec4('0xf'))(_0xaec4('0x10'));var utils=require(_0xaec4('0x11'));var config=require(_0xaec4('0x12'));var licenseUtil=require(_0xaec4('0x13'));var db=require(_0xaec4('0x14'))['db'];function respondWithStatusCode(_0x289961,_0x479c38){_0x479c38=_0x479c38||0xcc;return function(_0x255d5f){if(_0x255d5f){return _0x289961[_0xaec4('0x15')](_0x479c38);}return _0x289961[_0xaec4('0x16')](_0x479c38)[_0xaec4('0x17')]();};}function respondWithResult(_0x19697e,_0x45007e){_0x45007e=_0x45007e||0xc8;return function(_0x5030de){if(_0x5030de){return _0x19697e['status'](_0x45007e)[_0xaec4('0x18')](_0x5030de);}};}function respondWithFilteredResult(_0x3627e9,_0x17cf23){return function(_0x391e8c){if(_0x391e8c){var _0x384c4d=typeof _0x17cf23['offset']===_0xaec4('0x19')&&typeof _0x17cf23[_0xaec4('0x1a')]===_0xaec4('0x19');var _0x305b7e=_0x391e8c[_0xaec4('0x1b')];var _0x12e65f=_0x384c4d?0x0:_0x17cf23[_0xaec4('0x1c')];var _0x57400b=_0x384c4d?_0x391e8c[_0xaec4('0x1b')]:_0x17cf23['offset']+_0x17cf23[_0xaec4('0x1a')];var _0x11810c;if(_0x57400b>=_0x305b7e){_0x57400b=_0x305b7e;_0x11810c=0xc8;}else{_0x11810c=0xce;}_0x3627e9[_0xaec4('0x16')](_0x11810c);return _0x3627e9['set'](_0xaec4('0x1d'),_0x12e65f+'-'+_0x57400b+'/'+_0x305b7e)['json'](_0x391e8c);}return null;};}function patchUpdates(_0x5464f5){return function(_0x13a487){try{jsonpatch[_0xaec4('0x1e')](_0x13a487,_0x5464f5,!![]);}catch(_0x5f1387){return BPromise['reject'](_0x5f1387);}return _0x13a487[_0xaec4('0x1f')]();};}function saveUpdates(_0x469014,_0x158aee){return function(_0x5b0925){if(_0x5b0925){return _0x5b0925[_0xaec4('0x20')](_0x469014)[_0xaec4('0x21')](function(_0xf18fd6){return _0xf18fd6;});}return null;};}function removeEntity(_0x204aa4,_0x3a3a82){return function(_0x446065){if(_0x446065){return _0x446065[_0xaec4('0x22')]()[_0xaec4('0x21')](function(){_0x204aa4[_0xaec4('0x16')](0xcc)[_0xaec4('0x17')]();});}};}function handleEntityNotFound(_0x19e240,_0x87c10e){return function(_0x5d17c9){if(!_0x5d17c9){_0x19e240[_0xaec4('0x15')](0x194);}return _0x5d17c9;};}function handleError(_0x513969,_0x53f6eb){_0x53f6eb=_0x53f6eb||0x1f4;return function(_0x2226c7){logger[_0xaec4('0x23')](_0x2226c7[_0xaec4('0x24')]);if(_0x2226c7[_0xaec4('0x25')]){delete _0x2226c7[_0xaec4('0x25')];}_0x513969['status'](_0x53f6eb)['send'](_0x2226c7);};}exports[_0xaec4('0x20')]=function(_0x7afef3,_0x2d86cb){if(_0x7afef3[_0xaec4('0x26')]['id']){delete _0x7afef3['body']['id'];}return db['Action'][_0xaec4('0x27')]({'where':{'id':_0x7afef3[_0xaec4('0x28')]['id']}})['then'](handleEntityNotFound(_0x2d86cb,null))[_0xaec4('0x21')](saveUpdates(_0x7afef3['body'],null))[_0xaec4('0x21')](respondWithResult(_0x2d86cb,null))['catch'](handleError(_0x2d86cb,null));};exports[_0xaec4('0x22')]=function(_0x58ec8a,_0x418948){return db[_0xaec4('0x29')]['find']({'where':{'id':_0x58ec8a[_0xaec4('0x28')]['id']}})[_0xaec4('0x21')](handleEntityNotFound(_0x418948,null))[_0xaec4('0x21')](removeEntity(_0x418948,null))['catch'](handleError(_0x418948,null));}; \ No newline at end of file +var _0x4cac=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','apply','reject','update','then','destroy','error','name','body','find','catch','Action','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra'];(function(_0xc86f1a,_0x54d4ba){var _0x513368=function(_0x27e711){while(--_0x27e711){_0xc86f1a['push'](_0xc86f1a['shift']());}};_0x513368(++_0x54d4ba);}(_0x4cac,0x130));var _0xc4ca=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4cac[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0xc4ca('0x0'));var rimraf=require(_0xc4ca('0x1'));var zipdir=require(_0xc4ca('0x2'));var jsonpatch=require(_0xc4ca('0x3'));var rp=require('request-promise');var moment=require(_0xc4ca('0x4'));var BPromise=require(_0xc4ca('0x5'));var Mustache=require('mustache');var util=require(_0xc4ca('0x6'));var path=require(_0xc4ca('0x7'));var sox=require('sox');var csv=require(_0xc4ca('0x8'));var ejs=require(_0xc4ca('0x9'));var fs=require('fs');var fs_extra=require(_0xc4ca('0xa'));var _=require(_0xc4ca('0xb'));var squel=require(_0xc4ca('0xc'));var crypto=require(_0xc4ca('0xd'));var jsforce=require(_0xc4ca('0xe'));var deskjs=require(_0xc4ca('0xf'));var toCsv=require(_0xc4ca('0x8'));var querystring=require(_0xc4ca('0x10'));var Papa=require(_0xc4ca('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc4ca('0x12'));var as=require(_0xc4ca('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc4ca('0x14'));var utils=require(_0xc4ca('0x15'));var config=require(_0xc4ca('0x16'));var licenseUtil=require(_0xc4ca('0x17'));var db=require(_0xc4ca('0x18'))['db'];function respondWithStatusCode(_0x3ca8d5,_0x2936dd){_0x2936dd=_0x2936dd||0xcc;return function(_0x4549e7){if(_0x4549e7){return _0x3ca8d5[_0xc4ca('0x19')](_0x2936dd);}return _0x3ca8d5['status'](_0x2936dd)[_0xc4ca('0x1a')]();};}function respondWithResult(_0x4b123b,_0x48b468){_0x48b468=_0x48b468||0xc8;return function(_0x3c38ba){if(_0x3c38ba){return _0x4b123b[_0xc4ca('0x1b')](_0x48b468)[_0xc4ca('0x1c')](_0x3c38ba);}};}function respondWithFilteredResult(_0xdade7a,_0x2590a8){return function(_0x282cc1){if(_0x282cc1){var _0x4aa478=typeof _0x2590a8['offset']===_0xc4ca('0x1d')&&typeof _0x2590a8[_0xc4ca('0x1e')]===_0xc4ca('0x1d');var _0x42db90=_0x282cc1[_0xc4ca('0x1f')];var _0x27cb3a=_0x4aa478?0x0:_0x2590a8[_0xc4ca('0x20')];var _0x29ba20=_0x4aa478?_0x282cc1[_0xc4ca('0x1f')]:_0x2590a8[_0xc4ca('0x20')]+_0x2590a8[_0xc4ca('0x1e')];var _0x5e9d7f;if(_0x29ba20>=_0x42db90){_0x29ba20=_0x42db90;_0x5e9d7f=0xc8;}else{_0x5e9d7f=0xce;}_0xdade7a[_0xc4ca('0x1b')](_0x5e9d7f);return _0xdade7a['set'](_0xc4ca('0x21'),_0x27cb3a+'-'+_0x29ba20+'/'+_0x42db90)['json'](_0x282cc1);}return null;};}function patchUpdates(_0x3262a9){return function(_0x1d38e2){try{jsonpatch[_0xc4ca('0x22')](_0x1d38e2,_0x3262a9,!![]);}catch(_0x5befbc){return BPromise[_0xc4ca('0x23')](_0x5befbc);}return _0x1d38e2['save']();};}function saveUpdates(_0x1dc4c6,_0x339f74){return function(_0x499c8e){if(_0x499c8e){return _0x499c8e[_0xc4ca('0x24')](_0x1dc4c6)[_0xc4ca('0x25')](function(_0x2939c4){return _0x2939c4;});}return null;};}function removeEntity(_0x5ac0d1,_0x9d26a4){return function(_0x87037a){if(_0x87037a){return _0x87037a[_0xc4ca('0x26')]()[_0xc4ca('0x25')](function(){_0x5ac0d1[_0xc4ca('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a8c56,_0xd2f14c){return function(_0x5553d0){if(!_0x5553d0){_0x4a8c56[_0xc4ca('0x19')](0x194);}return _0x5553d0;};}function handleError(_0x299fe1,_0x3f8e88){_0x3f8e88=_0x3f8e88||0x1f4;return function(_0x459072){logger[_0xc4ca('0x27')](_0x459072['stack']);if(_0x459072[_0xc4ca('0x28')]){delete _0x459072[_0xc4ca('0x28')];}_0x299fe1[_0xc4ca('0x1b')](_0x3f8e88)['send'](_0x459072);};}exports[_0xc4ca('0x24')]=function(_0x1383ac,_0x56c70e){if(_0x1383ac[_0xc4ca('0x29')]['id']){delete _0x1383ac[_0xc4ca('0x29')]['id'];}return db['Action'][_0xc4ca('0x2a')]({'where':{'id':_0x1383ac['params']['id']}})['then'](handleEntityNotFound(_0x56c70e,null))[_0xc4ca('0x25')](saveUpdates(_0x1383ac[_0xc4ca('0x29')],null))[_0xc4ca('0x25')](respondWithResult(_0x56c70e,null))[_0xc4ca('0x2b')](handleError(_0x56c70e,null));};exports[_0xc4ca('0x26')]=function(_0x396673,_0x5b1b36){return db[_0xc4ca('0x2c')]['find']({'where':{'id':_0x396673['params']['id']}})[_0xc4ca('0x25')](handleEntityNotFound(_0x5b1b36,null))[_0xc4ca('0x25')](removeEntity(_0x5b1b36,null))[_0xc4ca('0x2b')](handleError(_0x5b1b36,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 5033973..2632309 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 _0x50fa=['exports','Action','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./action.attributes'];(function(_0x1678a6,_0x3b85bd){var _0x58fc8a=function(_0x4d945a){while(--_0x4d945a){_0x1678a6['push'](_0x1678a6['shift']());}};_0x58fc8a(++_0x3b85bd);}(_0x50fa,0x70));var _0xa50f=function(_0x60bd21,_0x538836){_0x60bd21=_0x60bd21-0x0;var _0x2203cc=_0x50fa[_0x60bd21];return _0x2203cc;};'use strict';var _=require(_0xa50f('0x0'));var util=require(_0xa50f('0x1'));var logger=require(_0xa50f('0x2'))('api');var moment=require('moment');var BPromise=require(_0xa50f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa50f('0x4'));var rimraf=require(_0xa50f('0x5'));var config=require(_0xa50f('0x6'));var attributes=require(_0xa50f('0x7'));module[_0xa50f('0x8')]=function(_0x13d242,_0x34afd0){return _0x13d242['define'](_0xa50f('0x9'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf858=['request-promise','path','../../config/environment','./action.attributes','define','Action','tools_actions','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x35ded5,_0x4cd999){var _0x1bd1ee=function(_0xae2c9c){while(--_0xae2c9c){_0x35ded5['push'](_0x35ded5['shift']());}};_0x1bd1ee(++_0x4cd999);}(_0xf858,0x13f));var _0x8f85=function(_0x1321cd,_0x4ebce9){_0x1321cd=_0x1321cd-0x0;var _0x4137eb=_0xf858[_0x1321cd];return _0x4137eb;};'use strict';var _=require(_0x8f85('0x0'));var util=require(_0x8f85('0x1'));var logger=require(_0x8f85('0x2'))(_0x8f85('0x3'));var moment=require(_0x8f85('0x4'));var BPromise=require(_0x8f85('0x5'));var rp=require(_0x8f85('0x6'));var fs=require('fs');var path=require(_0x8f85('0x7'));var rimraf=require('rimraf');var config=require(_0x8f85('0x8'));var attributes=require(_0x8f85('0x9'));module['exports']=function(_0x453e90,_0x4f7d8b){return _0x453e90[_0x8f85('0xa')](_0x8f85('0xb'),attributes,{'tableName':_0x8f85('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index ccee75c..fc5a8eb 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 _0xf494=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','Action,\x20%s,\x20%s','request\x20sent','Action,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x347471,_0x1c9a02){var _0x422b6a=function(_0x2b6f88){while(--_0x2b6f88){_0x347471['push'](_0x347471['shift']());}};_0x422b6a(++_0x1c9a02);}(_0xf494,0x1c6));var _0x4f49=function(_0x2c1136,_0x5bdc39){_0x2c1136=_0x2c1136-0x0;var _0x4e3732=_0xf494[_0x2c1136];return _0x4e3732;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var moment=require(_0x4f49('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f49('0x3'));var fs=require('fs');var Redis=require(_0x4f49('0x4'));var db=require(_0x4f49('0x5'))['db'];var utils=require(_0x4f49('0x6'));var logger=require(_0x4f49('0x7'))(_0x4f49('0x8'));var config=require(_0x4f49('0x9'));var jayson=require(_0x4f49('0xa'));var client=jayson[_0x4f49('0xb')][_0x4f49('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42b0e8,_0x5eb186,_0x58e9a0){return new BPromise(function(_0x169c95,_0x327bd5){return client[_0x4f49('0xd')](_0x42b0e8,_0x58e9a0)[_0x4f49('0xe')](function(_0x185174){logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,_0x4f49('0x11'));logger['debug'](_0x4f49('0x12'),_0x5eb186,_0x4f49('0x11'),JSON['stringify'](_0x185174));if(_0x185174[_0x4f49('0x13')]){if(_0x185174['error']['code']===0x1f4){logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174['error'][_0x4f49('0x14')]);return _0x327bd5(_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);}logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);return _0x169c95(_0x185174['error'][_0x4f49('0x14')]);}else{logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,'request\x20sent');_0x169c95(_0x185174['result'][_0x4f49('0x14')]);}})[_0x4f49('0x15')](function(_0x74886e){logger['error'](_0x4f49('0x10'),_0x5eb186,_0x74886e);_0x327bd5(_0x74886e);});});} \ No newline at end of file +var _0x5fab=['../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Action,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x49b0bf,_0x2c50e9){var _0x4e6b5c=function(_0x2eaf9e){while(--_0x2eaf9e){_0x49b0bf['push'](_0x49b0bf['shift']());}};_0x4e6b5c(++_0x2c50e9);}(_0x5fab,0x177));var _0xb5fa=function(_0x5be892,_0x68238a){_0x5be892=_0x5be892-0x0;var _0x53fc35=_0x5fab[_0x5be892];return _0x53fc35;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var moment=require('moment');var BPromise=require(_0xb5fa('0x2'));var rs=require(_0xb5fa('0x3'));var fs=require('fs');var Redis=require(_0xb5fa('0x4'));var db=require(_0xb5fa('0x5'))['db'];var utils=require(_0xb5fa('0x6'));var logger=require(_0xb5fa('0x7'))(_0xb5fa('0x8'));var config=require(_0xb5fa('0x9'));var jayson=require(_0xb5fa('0xa'));var client=jayson[_0xb5fa('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d70f6,_0x2e3804,_0x1aec3e){return new BPromise(function(_0x9c7bce,_0x56d018){return client[_0xb5fa('0xc')](_0x5d70f6,_0x1aec3e)[_0xb5fa('0xd')](function(_0x2cf4a5){logger['info']('Action,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));logger[_0xb5fa('0xf')](_0xb5fa('0x10'),_0x2e3804,_0xb5fa('0xe'),JSON[_0xb5fa('0x11')](_0x2cf4a5));if(_0x2cf4a5[_0xb5fa('0x12')]){if(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x13')]===0x1f4){logger[_0xb5fa('0x12')]('Action,\x20%s,\x20%s',_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x56d018(_0x2cf4a5['error'][_0xb5fa('0x14')]);}logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x9c7bce(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);}else{logger['info']('Action,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));_0x9c7bce(_0x2cf4a5[_0xb5fa('0x16')][_0xb5fa('0x14')]);}})[_0xb5fa('0x17')](function(_0x56fe10){logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x56fe10);_0x56d018(_0x56fe10);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 24e59f4..7bf13ff 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 _0x44d5=['put','/:id','delete','isAuthenticated','destroy','exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x72934c,_0x504f6a){var _0x4a2dd3=function(_0x1fc920){while(--_0x1fc920){_0x72934c['push'](_0x72934c['shift']());}};_0x4a2dd3(++_0x504f6a);}(_0x44d5,0x1b3));var _0x544d=function(_0x208749,_0x2b7b66){_0x208749=_0x208749-0x0;var _0x3e0042=_0x44d5[_0x208749];return _0x3e0042;};'use strict';var multer=require(_0x544d('0x0'));var util=require(_0x544d('0x1'));var path=require(_0x544d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x544d('0x3'));var auth=require(_0x544d('0x4'));var interaction=require(_0x544d('0x5'));var config=require(_0x544d('0x6'));var controller=require('./action.controller');router[_0x544d('0x7')](_0x544d('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x544d('0x9')](_0x544d('0x8'),auth[_0x544d('0xa')](),controller[_0x544d('0xb')]);module[_0x544d('0xc')]=router; \ No newline at end of file +var _0x580e=['exports','multer','path','fs-extra','../../components/interaction/service','put','/:id','isAuthenticated','update','delete','destroy'];(function(_0x5b36ac,_0x4767aa){var _0x512bc2=function(_0x312285){while(--_0x312285){_0x5b36ac['push'](_0x5b36ac['shift']());}};_0x512bc2(++_0x4767aa);}(_0x580e,0xfe));var _0xe580=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x580e[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xe580('0x0'));var util=require('util');var path=require(_0xe580('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xe580('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xe580('0x3'));var config=require('../../config/environment');var controller=require('./action.controller');router[_0xe580('0x4')](_0xe580('0x5'),auth[_0xe580('0x6')](),controller[_0xe580('0x7')]);router[_0xe580('0x8')](_0xe580('0x5'),auth[_0xe580('0x6')](),controller[_0xe580('0x9')]);module[_0xe580('0xa')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index fea6645..70545cb 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 _0xabce=['exports','STRING','TEXT','sequelize'];(function(_0x2b7c70,_0x3e68fd){var _0x265f38=function(_0x198c71){while(--_0x198c71){_0x2b7c70['push'](_0x2b7c70['shift']());}};_0x265f38(++_0x3e68fd);}(_0xabce,0x103));var _0xeabc=function(_0x34021d,_0x753aa6){_0x34021d=_0x34021d-0x0;var _0x16597b=_0xabce[_0x34021d];return _0x16597b;};'use strict';var Sequelize=require(_0xeabc('0x0'));module[_0xeabc('0x1')]={'name':{'type':Sequelize[_0xeabc('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xeabc('0x2')]},'parent':{'type':Sequelize[_0xeabc('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xeabc('0x3')]}}; \ No newline at end of file +var _0x4819=['TEXT','exports','STRING'];(function(_0x4da356,_0x5235e1){var _0x321b07=function(_0x2bc6f4){while(--_0x2bc6f4){_0x4da356['push'](_0x4da356['shift']());}};_0x321b07(++_0x5235e1);}(_0x4819,0xcd));var _0x9481=function(_0x25b022,_0x394a08){_0x25b022=_0x25b022-0x0;var _0x2e13a5=_0x4819[_0x25b022];return _0x2e13a5;};'use strict';var Sequelize=require('sequelize');module[_0x9481('0x0')]={'name':{'type':Sequelize[_0x9481('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x9481('0x1')]},'parent':{'type':Sequelize[_0x9481('0x1')]},'table':{'type':Sequelize[_0x9481('0x1')]},'conditions':{'type':Sequelize[_0x9481('0x2')]},'joins':{'type':Sequelize[_0x9481('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 3138903..026f8b4 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 _0x3a98=['apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','name','send','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','autoAssociation','CustomReports','preview','cross_join','SUM(%s)','COUNT(DISTINCT\x20%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)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','table','MetricId','metric','function','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','join','left_join','right_join','COUNT(%s)','SEC_TO_TIME(%s)','HOUR(%s)','ValidationErrorItem','replace','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','custom','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','child_process','fork','../../components/export/','../../files/reports','savename','countTable','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','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/license/util','../../mysqldb','dbH','sendStatus','status','offset','undefined','limit','count','set','json'];(function(_0x33de88,_0x581346){var _0x105957=function(_0x52752d){while(--_0x52752d){_0x33de88['push'](_0x33de88['shift']());}};_0x105957(++_0x581346);}(_0x3a98,0x84));var _0x83a9=function(_0x1627ae,_0x2aaa24){_0x1627ae=_0x1627ae-0x0;var _0x34b38f=_0x3a98[_0x1627ae];return _0x34b38f;};'use strict';var emlformat=require(_0x83a9('0x0'));var rimraf=require(_0x83a9('0x1'));var zipdir=require(_0x83a9('0x2'));var jsonpatch=require(_0x83a9('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x83a9('0x4'));var Mustache=require('mustache');var util=require(_0x83a9('0x5'));var path=require(_0x83a9('0x6'));var sox=require(_0x83a9('0x7'));var csv=require('to-csv');var ejs=require(_0x83a9('0x8'));var fs=require('fs');var fs_extra=require(_0x83a9('0x9'));var _=require(_0x83a9('0xa'));var squel=require(_0x83a9('0xb'));var crypto=require(_0x83a9('0xc'));var jsforce=require(_0x83a9('0xd'));var deskjs=require(_0x83a9('0xe'));var toCsv=require(_0x83a9('0xf'));var querystring=require(_0x83a9('0x10'));var Papa=require('papaparse');var Redis=require(_0x83a9('0x11'));var authService=require(_0x83a9('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x83a9('0x13'));var hardwareService=require(_0x83a9('0x14'));var logger=require(_0x83a9('0x15'))(_0x83a9('0x16'));var utils=require(_0x83a9('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x83a9('0x18'));var db=require(_0x83a9('0x19'))['db'];var dbH=require(_0x83a9('0x19'))[_0x83a9('0x1a')];function respondWithStatusCode(_0x4898cf,_0x4845f5){_0x4845f5=_0x4845f5||0xcc;return function(_0x394e94){if(_0x394e94){return _0x4898cf[_0x83a9('0x1b')](_0x4845f5);}return _0x4898cf[_0x83a9('0x1c')](_0x4845f5)['end']();};}function respondWithResult(_0x3a3234,_0x3663ad){_0x3663ad=_0x3663ad||0xc8;return function(_0x6709bd){if(_0x6709bd){return _0x3a3234[_0x83a9('0x1c')](_0x3663ad)['json'](_0x6709bd);}};}function respondWithFilteredResult(_0x192071,_0x1c9361){return function(_0x3a7ef6){if(_0x3a7ef6){var _0x50da15=typeof _0x1c9361[_0x83a9('0x1d')]===_0x83a9('0x1e')&&typeof _0x1c9361[_0x83a9('0x1f')]==='undefined';var _0x272180=_0x3a7ef6[_0x83a9('0x20')];var _0x34c009=_0x50da15?0x0:_0x1c9361[_0x83a9('0x1d')];var _0x3f6f58=_0x50da15?_0x3a7ef6[_0x83a9('0x20')]:_0x1c9361['offset']+_0x1c9361['limit'];var _0x323157;if(_0x3f6f58>=_0x272180){_0x3f6f58=_0x272180;_0x323157=0xc8;}else{_0x323157=0xce;}_0x192071[_0x83a9('0x1c')](_0x323157);return _0x192071[_0x83a9('0x21')]('Content-Range',_0x34c009+'-'+_0x3f6f58+'/'+_0x272180)[_0x83a9('0x22')](_0x3a7ef6);}return null;};}function patchUpdates(_0x481f06){return function(_0x59975e){try{jsonpatch[_0x83a9('0x23')](_0x59975e,_0x481f06,!![]);}catch(_0x3a161e){return BPromise[_0x83a9('0x24')](_0x3a161e);}return _0x59975e[_0x83a9('0x25')]();};}function saveUpdates(_0x4276e6,_0x7f29e4){return function(_0x11bd18){if(_0x11bd18){return _0x11bd18[_0x83a9('0x26')](_0x4276e6)[_0x83a9('0x27')](function(_0x1a0366){return _0x1a0366;});}return null;};}function removeEntity(_0x549fd5,_0x223d37){return function(_0x2c5337){if(_0x2c5337){return _0x2c5337[_0x83a9('0x28')]()[_0x83a9('0x27')](function(){var _0x1a680d=_0x2c5337[_0x83a9('0x29')]({'plain':!![]});var _0xc6117='CustomReports';return db[_0x83a9('0x2a')][_0x83a9('0x28')]({'where':{'type':_0xc6117,'resourceId':_0x1a680d['id']}})[_0x83a9('0x27')](function(){return _0x2c5337;});})[_0x83a9('0x27')](function(){_0x549fd5[_0x83a9('0x1c')](0xcc)[_0x83a9('0x2b')]();});}};}function handleEntityNotFound(_0x242876,_0x45c77c){return function(_0x6a67ee){if(!_0x6a67ee){_0x242876[_0x83a9('0x1b')](0x194);}return _0x6a67ee;};}function handleError(_0x55c00a,_0x34e53b){_0x34e53b=_0x34e53b||0x1f4;return function(_0x48a120){logger[_0x83a9('0x2c')](_0x48a120['stack']);if(_0x48a120[_0x83a9('0x2d')]){delete _0x48a120[_0x83a9('0x2d')];}_0x55c00a[_0x83a9('0x1c')](_0x34e53b)[_0x83a9('0x2e')](_0x48a120);};}exports['index']=function(_0x363914,_0x43c104){var _0x52098d={},_0x2284d0={},_0x3d5382={'count':0x0,'rows':[]};var _0x5cd3bc=_[_0x83a9('0x2f')](db[_0x83a9('0x30')][_0x83a9('0x31')],function(_0x359806){return{'name':_0x359806[_0x83a9('0x32')],'type':_0x359806[_0x83a9('0x33')][_0x83a9('0x34')]};});_0x2284d0['model']=_[_0x83a9('0x2f')](_0x5cd3bc,_0x83a9('0x2d'));_0x2284d0['query']=_[_0x83a9('0x35')](_0x363914[_0x83a9('0x36')]);_0x2284d0[_0x83a9('0x37')]=_[_0x83a9('0x38')](_0x2284d0[_0x83a9('0x39')],_0x2284d0[_0x83a9('0x36')]);_0x52098d[_0x83a9('0x3a')]=_[_0x83a9('0x38')](_0x2284d0['model'],qs[_0x83a9('0x3b')](_0x363914[_0x83a9('0x36')][_0x83a9('0x3b')]));_0x52098d['attributes']=_0x52098d[_0x83a9('0x3a')][_0x83a9('0x3c')]?_0x52098d['attributes']:_0x2284d0[_0x83a9('0x39')];if(!_0x363914[_0x83a9('0x36')][_0x83a9('0x3d')]('nolimit')){_0x52098d[_0x83a9('0x1f')]=qs['limit'](_0x363914[_0x83a9('0x36')]['limit']);_0x52098d['offset']=qs['offset'](_0x363914[_0x83a9('0x36')][_0x83a9('0x1d')]);}_0x52098d[_0x83a9('0x3e')]=qs['sort'](_0x363914[_0x83a9('0x36')]['sort']);_0x52098d[_0x83a9('0x3f')]=qs[_0x83a9('0x37')](_[_0x83a9('0x40')](_0x363914['query'],_0x2284d0[_0x83a9('0x37')]),_0x5cd3bc);if(_0x363914[_0x83a9('0x36')][_0x83a9('0x41')]){_0x52098d[_0x83a9('0x3f')]=_[_0x83a9('0x42')](_0x52098d[_0x83a9('0x3f')],{'$or':_[_0x83a9('0x2f')](_0x5cd3bc,function(_0x3122c9){if(_0x3122c9[_0x83a9('0x33')]!==_0x83a9('0x43')){var _0x1e41b8={};_0x1e41b8[_0x3122c9[_0x83a9('0x2d')]]={'$like':'%'+_0x363914[_0x83a9('0x36')][_0x83a9('0x41')]+'%'};return _0x1e41b8;}})});}_0x52098d=_[_0x83a9('0x42')]({},_0x52098d,_0x363914[_0x83a9('0x44')]);var _0x470599={'where':_0x52098d[_0x83a9('0x3f')]};return db[_0x83a9('0x30')][_0x83a9('0x20')](_0x470599)[_0x83a9('0x27')](function(_0x58e276){_0x3d5382['count']=_0x58e276;if(_0x363914[_0x83a9('0x36')][_0x83a9('0x45')]){_0x52098d[_0x83a9('0x46')]=[{'all':!![]}];}return db[_0x83a9('0x30')]['findAll'](_0x52098d);})[_0x83a9('0x27')](function(_0x175935){_0x3d5382[_0x83a9('0x47')]=_0x175935;return _0x3d5382;})['then'](respondWithFilteredResult(_0x43c104,_0x52098d))[_0x83a9('0x48')](handleError(_0x43c104,null));};exports[_0x83a9('0x49')]=function(_0x14f707,_0x47246c){var _0x17fde3={'raw':![],'where':{'id':_0x14f707[_0x83a9('0x4a')]['id']}},_0x536b56={};_0x536b56['model']=_[_0x83a9('0x35')](db[_0x83a9('0x30')][_0x83a9('0x31')]);_0x536b56[_0x83a9('0x36')]=_[_0x83a9('0x35')](_0x14f707[_0x83a9('0x36')]);_0x536b56[_0x83a9('0x37')]=_[_0x83a9('0x38')](_0x536b56[_0x83a9('0x39')],_0x536b56[_0x83a9('0x36')]);_0x17fde3['attributes']=_[_0x83a9('0x38')](_0x536b56[_0x83a9('0x39')],qs[_0x83a9('0x3b')](_0x14f707[_0x83a9('0x36')]['fields']));_0x17fde3[_0x83a9('0x3a')]=_0x17fde3[_0x83a9('0x3a')][_0x83a9('0x3c')]?_0x17fde3[_0x83a9('0x3a')]:_0x536b56[_0x83a9('0x39')];if(_0x14f707['query']['includeAll']){_0x17fde3[_0x83a9('0x46')]=[{'all':!![]}];}_0x17fde3=_['merge']({},_0x17fde3,_0x14f707['options']);return db[_0x83a9('0x30')]['find'](_0x17fde3)['then'](handleEntityNotFound(_0x47246c,null))['then'](respondWithResult(_0x47246c,null))['catch'](handleError(_0x47246c,null));};exports[_0x83a9('0x4b')]=function(_0x2cd997,_0x21e603){return db[_0x83a9('0x30')][_0x83a9('0x4b')](_0x2cd997[_0x83a9('0x4c')],{})[_0x83a9('0x27')](function(_0x2255eb){var _0x54f3ed=_0x2cd997[_0x83a9('0x4d')][_0x83a9('0x29')]({'plain':!![]});if(!_0x54f3ed)throw new Error(_0x83a9('0x4e'));if(_0x54f3ed[_0x83a9('0x4f')]==='user'){var _0x1d03d6=_0x2255eb[_0x83a9('0x29')]({'plain':!![]});var _0x1b2997=_0x83a9('0x50');return db[_0x83a9('0x51')][_0x83a9('0x52')]({'where':{'name':_0x1b2997,'userProfileId':_0x54f3ed['userProfileId']},'raw':!![]})['then'](function(_0x1d6709){if(_0x1d6709&&_0x1d6709[_0x83a9('0x53')]===0x0){return db[_0x83a9('0x2a')][_0x83a9('0x4b')]({'name':_0x1d03d6['name'],'resourceId':_0x1d03d6['id'],'type':_0x83a9('0x54'),'sectionId':_0x1d6709['id']},{})[_0x83a9('0x27')](function(){return _0x2255eb;});}else{return _0x2255eb;}})[_0x83a9('0x48')](function(_0x2375d0){logger[_0x83a9('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2375d0);throw _0x2375d0;});}return _0x2255eb;})[_0x83a9('0x27')](respondWithResult(_0x21e603,0xc9))[_0x83a9('0x48')](handleError(_0x21e603,null));};exports[_0x83a9('0x26')]=function(_0x346d5d,_0x509f8b){if(_0x346d5d[_0x83a9('0x4c')]['id']){delete _0x346d5d[_0x83a9('0x4c')]['id'];}return db[_0x83a9('0x30')][_0x83a9('0x52')]({'where':{'id':_0x346d5d[_0x83a9('0x4a')]['id']}})[_0x83a9('0x27')](handleEntityNotFound(_0x509f8b,null))[_0x83a9('0x27')](saveUpdates(_0x346d5d[_0x83a9('0x4c')],null))[_0x83a9('0x27')](respondWithResult(_0x509f8b,null))['catch'](handleError(_0x509f8b,null));};exports[_0x83a9('0x28')]=function(_0x10b836,_0x5af70e){return db['AnalyticCustomReport'][_0x83a9('0x52')]({'where':{'id':_0x10b836['params']['id']}})[_0x83a9('0x27')](handleEntityNotFound(_0x5af70e,null))['then'](removeEntity(_0x5af70e,null))[_0x83a9('0x48')](handleError(_0x5af70e,null));};exports[_0x83a9('0x55')]=function(_0x5ce5c7,_0x436ca5){var _0x317de3=0xa;var _0x4158a9=['join','left_join','right_join',_0x83a9('0x56')];var _0x1234a6={'SUM':_0x83a9('0x57'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x83a9('0x58'),'MAX':_0x83a9('0x59'),'MIN':_0x83a9('0x5a'),'AVG':_0x83a9('0x5b'),'GROUP_CONCAT':_0x83a9('0x5c'),'GROUP_CONCAT ASC':_0x83a9('0x5d'),'GROUP_CONCAT DESC':_0x83a9('0x5e')};var _0x284107={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x83a9('0x5f'),'HOUR':'HOUR(%s)','ROUND':_0x83a9('0x60'),'UNIX_TIMESTAMP':_0x83a9('0x61')};var _0x21f814=function(_0x155190){return!_[_0x83a9('0x62')]([_0x83a9('0x63'),_0x83a9('0x64'),_0x83a9('0x65'),_0x83a9('0x66')],_0x155190);};var _0x324097=function(_0x385fb9){if(!_0x385fb9||!_0x385fb9['rules'][_0x83a9('0x3c')]){return'';}for(var _0x36ec54='(',_0x3abe07=0x0;_0x3abe07<_0x385fb9[_0x83a9('0x67')][_0x83a9('0x3c')];_0x3abe07+=0x1){_0x3abe07>0x0&&(_0x36ec54+='\x20'+_0x385fb9[_0x83a9('0x68')]+'\x20');_0x36ec54+=_0x385fb9['rules'][_0x3abe07][_0x83a9('0x69')]?_0x324097(_0x385fb9[_0x83a9('0x67')][_0x3abe07][_0x83a9('0x69')]):_0x385fb9[_0x83a9('0x67')][_0x3abe07][_0x83a9('0x6a')]+'\x20'+_0x385fb9[_0x83a9('0x67')][_0x3abe07]['condition']+(_0x21f814(_0x385fb9[_0x83a9('0x67')][_0x3abe07][_0x83a9('0x6b')])?'\x20'+_0x385fb9[_0x83a9('0x67')][_0x3abe07][_0x83a9('0x6c')]:'');}return _0x36ec54+')';};var _0x26e3d4={'where':{'id':_0x5ce5c7[_0x83a9('0x4a')]['id']}},_0x5f1169,_0x2a7604,_0x2bcc3e,_0x38c338,_0x577d6d;_0x26e3d4=_[_0x83a9('0x42')]({},_0x26e3d4,_0x5ce5c7[_0x83a9('0x44')]);return db[_0x83a9('0x30')][_0x83a9('0x52')](_0x26e3d4)[_0x83a9('0x27')](function(_0x1c6544){if(_0x1c6544){_0x5f1169=_0x1c6544;return _0x1c6544[_0x83a9('0x6d')]();}return null;})[_0x83a9('0x27')](function(_0x42c381){if(_0x42c381){if(!_0x42c381[_0x83a9('0x3c')]){throw new db[(_0x83a9('0x6e'))]['ValidationErrorItem'](_0x83a9('0x6f'),0x193);}_0x2a7604=_0x42c381;return db[_0x83a9('0x70')][_0x83a9('0x71')]({'raw':!![]});}return null;})[_0x83a9('0x27')](function(_0x222e25){if(_0x222e25){_0x2bcc3e=_[_0x83a9('0x72')](_0x222e25,'id');var _0xfa95c6;var _0x2d56b5=squel[_0x83a9('0x73')]();_0x2d56b5[_0x83a9('0x74')](_0x5f1169[_0x83a9('0x75')]);for(var _0x49afb1=0x0;_0x49afb1<_0x2a7604[_0x83a9('0x3c')];_0x49afb1+=0x1){_0xfa95c6=_0x2a7604[_0x49afb1][_0x83a9('0x76')]?_0x2bcc3e[_0x2a7604[_0x49afb1][_0x83a9('0x76')]][_0x83a9('0x77')]:_0x2a7604[_0x49afb1]['field'];_0xfa95c6=_0x2a7604[_0x49afb1][_0x83a9('0x78')]?_['replace'](_0x1234a6[_0x2a7604[_0x49afb1][_0x83a9('0x78')]],'%s',_0xfa95c6):_0xfa95c6;_0xfa95c6=_0x2a7604[_0x49afb1][_0x83a9('0x79')]?_['replace'](_0x284107[_0x2a7604[_0x49afb1][_0x83a9('0x79')]],'%s',_0xfa95c6):_0xfa95c6;if(_0x2a7604[_0x49afb1][_0x83a9('0x7a')]){_0x2d56b5[_0x83a9('0x69')](_0xfa95c6);}_0x2a7604[_0x49afb1][_0x83a9('0x7b')]&&_0x2d56b5[_0x83a9('0x3e')](_0xfa95c6,_0x2a7604[_0x49afb1][_0x83a9('0x7b')]===_0x83a9('0x7c')?![]:!![]);_0x2d56b5[_0x83a9('0x6a')](_0xfa95c6,_0x2a7604[_0x49afb1][_0x83a9('0x7d')]||_0xfa95c6);}if(_0x5f1169[_0x83a9('0x7e')]){_0x5f1169[_0x83a9('0x7e')]=JSON[_0x83a9('0x7f')](_0x5f1169[_0x83a9('0x7e')]);for(var _0x6c3503=0x0;_0x6c3503<_0x5f1169[_0x83a9('0x7e')]['length'];_0x6c3503+=0x1){if(_0x5f1169[_0x83a9('0x7e')][_0x6c3503][_0x83a9('0x33')]&&_['includes'](_0x4158a9,_0x5f1169[_0x83a9('0x7e')][_0x6c3503][_0x83a9('0x33')])&&_0x5f1169[_0x83a9('0x7e')][_0x6c3503][_0x83a9('0x80')]&&_0x5f1169[_0x83a9('0x7e')][_0x6c3503][_0x83a9('0x81')]&&_0x5f1169[_0x83a9('0x7e')][_0x6c3503][_0x83a9('0x82')]){_0x2d56b5[_0x5f1169['joins'][_0x6c3503][_0x83a9('0x33')]](_0x5f1169[_0x83a9('0x7e')][_0x6c3503][_0x83a9('0x81')],null,util[_0x83a9('0x79')](_0x83a9('0x83'),_0x5f1169[_0x83a9('0x75')],_0x5f1169[_0x83a9('0x7e')][_0x6c3503][_0x83a9('0x80')],_0x5f1169[_0x83a9('0x7e')][_0x6c3503][_0x83a9('0x81')],_0x5f1169[_0x83a9('0x7e')][_0x6c3503]['foreignKey']));}}}if(_0x5f1169[_0x83a9('0x84')]){_0x5f1169['conditions']=JSON[_0x83a9('0x7f')](_0x5f1169[_0x83a9('0x84')]);_0x2d56b5[_0x83a9('0x3f')](_0x324097(_0x5f1169[_0x83a9('0x84')][_0x83a9('0x69')]));}_0x577d6d=_0x2d56b5[_0x83a9('0x85')]();_0x2d56b5[_0x83a9('0x1f')](_0x317de3);_0x2d56b5[_0x83a9('0x1d')](0x0);logger[_0x83a9('0x86')](_0x83a9('0x87'),_0x2d56b5[_0x83a9('0x88')]());return dbH[_0x83a9('0x89')]['query'](_0x2d56b5[_0x83a9('0x88')](),{'type':dbH[_0x83a9('0x89')][_0x83a9('0x8a')][_0x83a9('0x8b')]});}})['then'](respondWithResult(_0x436ca5,null))[_0x83a9('0x48')](handleError(_0x436ca5,null));};function runReport(_0x194985,_0x3d7d3f,_0x22af3c){var _0x408e5a=_0x3d7d3f['name'];var _0x296d66=0xa;var _0x247df4=[_0x83a9('0x8c'),_0x83a9('0x8d'),_0x83a9('0x8e'),_0x83a9('0x56')];var _0x12b1f9={'SUM':_0x83a9('0x57'),'COUNT':_0x83a9('0x8f'),'COUNT DISTINCT':_0x83a9('0x58'),'MAX':_0x83a9('0x59'),'MIN':_0x83a9('0x5a'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x83a9('0x5c'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x4bb255={'SEC_TO_TIME':_0x83a9('0x90'),'DATE':_0x83a9('0x5f'),'HOUR':_0x83a9('0x91'),'ROUND':_0x83a9('0x60'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5f52e5=function(_0x47f731){return!_[_0x83a9('0x62')](['IS\x20NULL',_0x83a9('0x64'),_0x83a9('0x65'),_0x83a9('0x66')],_0x47f731);};var _0x17b43c=function(_0x48a728){if(!_0x48a728||!_0x48a728[_0x83a9('0x67')][_0x83a9('0x3c')]){return'';}for(var _0x586ba8='(',_0x2d55f3=0x0;_0x2d55f3<_0x48a728[_0x83a9('0x67')][_0x83a9('0x3c')];_0x2d55f3+=0x1){_0x2d55f3>0x0&&(_0x586ba8+='\x20'+_0x48a728[_0x83a9('0x68')]+'\x20');_0x586ba8+=_0x48a728[_0x83a9('0x67')][_0x2d55f3][_0x83a9('0x69')]?_0x17b43c(_0x48a728[_0x83a9('0x67')][_0x2d55f3]['group']):_0x48a728[_0x83a9('0x67')][_0x2d55f3][_0x83a9('0x6a')]+'\x20'+_0x48a728[_0x83a9('0x67')][_0x2d55f3][_0x83a9('0x6b')]+(_0x5f52e5(_0x48a728['rules'][_0x2d55f3]['condition'])?'\x20'+_0x48a728[_0x83a9('0x67')][_0x2d55f3]['value']:'');}return _0x586ba8+')';};var _0x10c6d9={'where':{'id':_0x194985['id']}},_0x4627d4,_0x42c077,_0x4edca2,_0x47aaf0,_0x294d72;_0x10c6d9=_[_0x83a9('0x42')]({},_0x10c6d9,_0x22af3c);return db[_0x83a9('0x30')][_0x83a9('0x52')](_0x10c6d9)['then'](function(_0x674950){if(_0x674950){_0x4627d4=_0x674950;return _0x674950['getFields']();}return null;})[_0x83a9('0x27')](function(_0x2a3dda){if(_0x2a3dda){if(!_0x2a3dda['length']){throw new db[(_0x83a9('0x6e'))][(_0x83a9('0x92'))](_0x83a9('0x6f'),0x193);}_0x42c077=_0x2a3dda;return db['AnalyticMetric'][_0x83a9('0x71')]({'raw':!![]});}return null;})['then'](function(_0xe3458a){if(_0xe3458a){_0x4edca2=_[_0x83a9('0x72')](_0xe3458a,'id');var _0x50832d;var _0x56c35b=squel[_0x83a9('0x73')]();_0x56c35b[_0x83a9('0x74')](_0x4627d4[_0x83a9('0x75')]);for(var _0x4fc3d2=0x0;_0x4fc3d2<_0x42c077[_0x83a9('0x3c')];_0x4fc3d2+=0x1){_0x50832d=_0x42c077[_0x4fc3d2]['MetricId']?_0x4edca2[_0x42c077[_0x4fc3d2]['MetricId']][_0x83a9('0x77')]:_0x42c077[_0x4fc3d2]['field'];_0x50832d=_0x42c077[_0x4fc3d2][_0x83a9('0x78')]?_[_0x83a9('0x93')](_0x12b1f9[_0x42c077[_0x4fc3d2][_0x83a9('0x78')]],'%s',_0x50832d):_0x50832d;_0x50832d=_0x42c077[_0x4fc3d2][_0x83a9('0x79')]?_[_0x83a9('0x93')](_0x4bb255[_0x42c077[_0x4fc3d2]['format']],'%s',_0x50832d):_0x50832d;if(_0x42c077[_0x4fc3d2][_0x83a9('0x7a')]){_0x56c35b['group'](_0x50832d);}_0x42c077[_0x4fc3d2]['orderBy']&&_0x56c35b[_0x83a9('0x3e')](_0x50832d,_0x42c077[_0x4fc3d2]['orderBy']===_0x83a9('0x7c')?![]:!![]);_0x56c35b['field'](_0x50832d,_0x42c077[_0x4fc3d2][_0x83a9('0x7d')]||_0x50832d);}if(_0x4627d4[_0x83a9('0x7e')]){_0x4627d4['joins']=JSON[_0x83a9('0x7f')](_0x4627d4['joins']);for(var _0x237a6a=0x0;_0x237a6a<_0x4627d4['joins'][_0x83a9('0x3c')];_0x237a6a+=0x1){if(_0x4627d4[_0x83a9('0x7e')][_0x237a6a][_0x83a9('0x33')]&&_[_0x83a9('0x62')](_0x247df4,_0x4627d4['joins'][_0x237a6a][_0x83a9('0x33')])&&_0x4627d4[_0x83a9('0x7e')][_0x237a6a][_0x83a9('0x80')]&&_0x4627d4[_0x83a9('0x7e')][_0x237a6a][_0x83a9('0x81')]&&_0x4627d4[_0x83a9('0x7e')][_0x237a6a][_0x83a9('0x82')]){_0x56c35b[_0x4627d4['joins'][_0x237a6a]['type']](_0x4627d4['joins'][_0x237a6a][_0x83a9('0x81')],null,util[_0x83a9('0x79')](_0x83a9('0x83'),_0x4627d4[_0x83a9('0x75')],_0x4627d4['joins'][_0x237a6a][_0x83a9('0x80')],_0x4627d4[_0x83a9('0x7e')][_0x237a6a][_0x83a9('0x81')],_0x4627d4[_0x83a9('0x7e')][_0x237a6a]['foreignKey']));}}}if(_0x4627d4[_0x83a9('0x84')]){_0x4627d4['conditions']=JSON[_0x83a9('0x7f')](_0x4627d4[_0x83a9('0x84')]);_0x56c35b[_0x83a9('0x3f')](_0x17b43c(_0x4627d4[_0x83a9('0x84')]['group']));}_0x294d72=_0x56c35b[_0x83a9('0x85')]();_0x56c35b['limit'](_0x296d66);_0x56c35b[_0x83a9('0x1d')](0x0);return;}})[_0x83a9('0x27')](function(){if(_0x3d7d3f[_0x83a9('0x94')]===_0x83a9('0x95')){return null;}var _0x7b468=_[_0x83a9('0x42')](_0x3d7d3f,{'name':_0x3d7d3f[_0x83a9('0x96')]||_0x3d7d3f[_0x83a9('0x2d')]||_0x4627d4['name'],'basename':_0x408e5a,'savename':util[_0x83a9('0x79')](_0x83a9('0x97'),_0x3d7d3f[_0x83a9('0x2d')]||_0x4627d4[_0x83a9('0x2d')],require(_0x83a9('0x98'))[_0x83a9('0x99')](0x4),_0x3d7d3f[_0x83a9('0x94')]||_0x83a9('0x9a')),'reportId':_0x4627d4['id'],'reportType':_0x83a9('0x9b')});return db['AnalyticExtractedReport'][_0x83a9('0x4b')](_0x7b468,{'raw':!![]});})[_0x83a9('0x27')](function(_0x14868c){if(_0x4627d4['table']===_0x83a9('0x9c')){_0x294d72[_0x83a9('0x3f')](_0x4627d4['table']+_0x83a9('0x9d'),_0x3d7d3f[_0x83a9('0x9e')],_0x3d7d3f[_0x83a9('0x9f')]);}else{_0x294d72[_0x83a9('0x3f')](_0x4627d4['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x3d7d3f['startDate'],_0x3d7d3f['endDate']);}if(_0x14868c){logger[_0x83a9('0xa0')]('Run\x20Query:',_0x294d72[_0x83a9('0x88')]());require(_0x83a9('0xa1'))[_0x83a9('0xa2')](path[_0x83a9('0x8c')](__dirname,_0x83a9('0xa3'),_0x14868c[_0x83a9('0x94')]),[_0x14868c['id'],_0x294d72[_0x83a9('0x88')](),path[_0x83a9('0x8c')](__dirname,_0x83a9('0xa4'),_0x14868c[_0x83a9('0xa5')]),_0x408e5a]);return _0x14868c;}else{var _0x389e77=squel[_0x83a9('0x73')]();_0x389e77[_0x83a9('0x74')]('('+_0x294d72['toString']()+')',_0x83a9('0xa6'));_0x389e77[_0x83a9('0x6a')]('COUNT(*)',_0x83a9('0x20'));_0x294d72[_0x83a9('0x1f')](_0x3d7d3f[_0x83a9('0x1f')]||_0x296d66);_0x294d72[_0x83a9('0x1d')](_0x3d7d3f['offset']||0x0);return dbH['sequelize']['query'](_0x389e77[_0x83a9('0x88')](),{'type':dbH[_0x83a9('0x89')][_0x83a9('0x8a')][_0x83a9('0x8b')]})[_0x83a9('0x27')](function(_0x18ff5d){if(!_0x18ff5d[_0x83a9('0x3c')]){_0x47aaf0=0x0;}else{_0x47aaf0=_0x18ff5d[0x0][_0x83a9('0x20')]||0x0;}return dbH[_0x83a9('0x89')]['query'](_0x294d72[_0x83a9('0x88')](),{'type':dbH[_0x83a9('0x89')]['QueryTypes'][_0x83a9('0x8b')]});})[_0x83a9('0x27')](function(_0x54029c){return{'rows':_0x54029c||[],'count':_0x47aaf0};});}});}exports['run']=function(_0x3dfc15,_0x52be7c){return runReport(_0x3dfc15[_0x83a9('0x4a')],_0x3dfc15[_0x83a9('0x36')],_0x3dfc15[_0x83a9('0x44')])['then'](respondWithResult(_0x52be7c,null))['catch'](handleError(_0x52be7c,null));};exports['runReport']=runReport;exports[_0x83a9('0x36')]=function(_0x395ee2,_0x5a478d){var _0x3466e5=0xa;var _0x101e91=['join',_0x83a9('0x8d'),'right_join',_0x83a9('0x56')];var _0x235742={'SUM':'SUM(%s)','COUNT':_0x83a9('0x8f'),'COUNT DISTINCT':_0x83a9('0x58'),'MAX':_0x83a9('0x59'),'MIN':_0x83a9('0x5a'),'AVG':_0x83a9('0x5b'),'GROUP_CONCAT':_0x83a9('0x5c'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x83a9('0x5e')};var _0x452d48={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x83a9('0x5f'),'HOUR':_0x83a9('0x91'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0xdcc461=function(_0x5aea98){return!_[_0x83a9('0x62')]([_0x83a9('0x63'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0x83a9('0x66')],_0x5aea98);};var _0x1bc42c=function(_0x32d005){if(!_0x32d005||!_0x32d005['rules'][_0x83a9('0x3c')]){return'';}for(var _0x5cea45='(',_0x596242=0x0;_0x596242<_0x32d005['rules'][_0x83a9('0x3c')];_0x596242+=0x1){_0x596242>0x0&&(_0x5cea45+='\x20'+_0x32d005['operator']+'\x20');_0x5cea45+=_0x32d005[_0x83a9('0x67')][_0x596242]['group']?_0x1bc42c(_0x32d005[_0x83a9('0x67')][_0x596242][_0x83a9('0x69')]):_0x32d005['rules'][_0x596242][_0x83a9('0x6a')]+'\x20'+_0x32d005[_0x83a9('0x67')][_0x596242]['condition']+(_0xdcc461(_0x32d005['rules'][_0x596242][_0x83a9('0x6b')])?'\x20'+_0x32d005[_0x83a9('0x67')][_0x596242][_0x83a9('0x6c')]:'');}return _0x5cea45+')';};var _0x365014={'where':{'id':_0x395ee2[_0x83a9('0x4a')]['id']}},_0x297fa5,_0x1ed173,_0xf30db2,_0x48060f,_0x11cd6a;_0x365014=_['merge']({},_0x365014,_0x395ee2[_0x83a9('0x44')]);return db[_0x83a9('0x30')][_0x83a9('0x52')](_0x365014)[_0x83a9('0x27')](function(_0x267136){if(_0x267136){_0x297fa5=_0x267136;return _0x267136[_0x83a9('0x6d')]();}return null;})[_0x83a9('0x27')](function(_0x939334){if(_0x939334){if(!_0x939334[_0x83a9('0x3c')]){throw new db[(_0x83a9('0x6e'))][(_0x83a9('0x92'))](_0x83a9('0x6f'),0x193);}_0x1ed173=_0x939334;return db['AnalyticMetric'][_0x83a9('0x71')]({'raw':!![]});}return null;})[_0x83a9('0x27')](function(_0x577584){if(_0x577584){_0xf30db2=_[_0x83a9('0x72')](_0x577584,'id');var _0x506bda;var _0x1111c8=squel[_0x83a9('0x73')]();_0x1111c8['from'](_0x297fa5[_0x83a9('0x75')]);for(var _0x15b577=0x0;_0x15b577<_0x1ed173[_0x83a9('0x3c')];_0x15b577+=0x1){_0x506bda=_0x1ed173[_0x15b577][_0x83a9('0x76')]?_0xf30db2[_0x1ed173[_0x15b577][_0x83a9('0x76')]]['metric']:_0x1ed173[_0x15b577][_0x83a9('0x6a')];_0x506bda=_0x1ed173[_0x15b577]['function']?_[_0x83a9('0x93')](_0x235742[_0x1ed173[_0x15b577][_0x83a9('0x78')]],'%s',_0x506bda):_0x506bda;_0x506bda=_0x1ed173[_0x15b577][_0x83a9('0x79')]?_[_0x83a9('0x93')](_0x452d48[_0x1ed173[_0x15b577]['format']],'%s',_0x506bda):_0x506bda;if(_0x1ed173[_0x15b577][_0x83a9('0x7a')]){_0x1111c8[_0x83a9('0x69')](_0x506bda);}_0x1ed173[_0x15b577][_0x83a9('0x7b')]&&_0x1111c8[_0x83a9('0x3e')](_0x506bda,_0x1ed173[_0x15b577][_0x83a9('0x7b')]==='DESC'?![]:!![]);_0x1111c8[_0x83a9('0x6a')](_0x506bda,_0x1ed173[_0x15b577][_0x83a9('0x7d')]||_0x506bda);}if(_0x297fa5[_0x83a9('0x7e')]){_0x297fa5['joins']=JSON[_0x83a9('0x7f')](_0x297fa5[_0x83a9('0x7e')]);for(var _0xc4c2b9=0x0;_0xc4c2b9<_0x297fa5[_0x83a9('0x7e')][_0x83a9('0x3c')];_0xc4c2b9+=0x1){if(_0x297fa5[_0x83a9('0x7e')][_0xc4c2b9][_0x83a9('0x33')]&&_[_0x83a9('0x62')](_0x101e91,_0x297fa5[_0x83a9('0x7e')][_0xc4c2b9][_0x83a9('0x33')])&&_0x297fa5[_0x83a9('0x7e')][_0xc4c2b9][_0x83a9('0x80')]&&_0x297fa5[_0x83a9('0x7e')][_0xc4c2b9][_0x83a9('0x81')]&&_0x297fa5['joins'][_0xc4c2b9]['foreignKey']){_0x1111c8[_0x297fa5['joins'][_0xc4c2b9][_0x83a9('0x33')]](_0x297fa5[_0x83a9('0x7e')][_0xc4c2b9]['foreignTable'],null,util['format'](_0x83a9('0x83'),_0x297fa5[_0x83a9('0x75')],_0x297fa5[_0x83a9('0x7e')][_0xc4c2b9][_0x83a9('0x80')],_0x297fa5[_0x83a9('0x7e')][_0xc4c2b9][_0x83a9('0x81')],_0x297fa5[_0x83a9('0x7e')][_0xc4c2b9][_0x83a9('0x82')]));}}}if(_0x297fa5[_0x83a9('0x84')]){_0x297fa5['conditions']=JSON['parse'](_0x297fa5[_0x83a9('0x84')]);_0x1111c8[_0x83a9('0x3f')](_0x1bc42c(_0x297fa5['conditions'][_0x83a9('0x69')]));}_0x11cd6a=_0x1111c8[_0x83a9('0x85')]();_0x1111c8[_0x83a9('0x1f')](_0x3466e5);_0x1111c8[_0x83a9('0x1d')](0x0);logger[_0x83a9('0x86')](_0x83a9('0x87'),_0x1111c8[_0x83a9('0x88')]());return dbH[_0x83a9('0x89')][_0x83a9('0x36')](_0x1111c8[_0x83a9('0x88')](),{'type':dbH[_0x83a9('0x89')]['QueryTypes'][_0x83a9('0x8b')]});}})[_0x83a9('0x27')](function(){return{'sql':_0x11cd6a[_0x83a9('0x88')]()};})[_0x83a9('0x27')](respondWithResult(_0x5a478d,null))[_0x83a9('0x48')](handleError(_0x5a478d,null));}; \ No newline at end of file +var _0xd07e=['reject','update','then','destroy','CustomReports','UserProfileResource','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','count','includeAll','include','findAll','rows','show','params','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','userProfileId','autoAssociation','catch','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','includes','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','field','function','replace','format','groupBy','orderBy','DESC','alias','joins','parentKey','foreignTable','foreignKey','table','conditions','parse','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','left_join','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','ROUND(%s)','IS\x20NULL','IS\x20NOT\x20NULL','select','MetricId','%s.%s\x20=\x20%s.%s','output','fullPath','%s-%s.%s','generate','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','Run\x20Query:','child_process','fork','../../components/export/','savename','SELECT','run','UNIX_TIMESTAMP(%s)','metric','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','end','status','json','undefined','limit','offset','Content-Range','apply'];(function(_0x47d22c,_0x2a8058){var _0x35e7da=function(_0x18bf49){while(--_0x18bf49){_0x47d22c['push'](_0x47d22c['shift']());}};_0x35e7da(++_0x2a8058);}(_0xd07e,0x80));var _0xed07=function(_0x13547d,_0xa3895e){_0x13547d=_0x13547d-0x0;var _0x22c36b=_0xd07e[_0x13547d];return _0x22c36b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xed07('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xed07('0x1'));var rp=require('request-promise');var moment=require(_0xed07('0x2'));var BPromise=require(_0xed07('0x3'));var Mustache=require('mustache');var util=require(_0xed07('0x4'));var path=require(_0xed07('0x5'));var sox=require(_0xed07('0x6'));var csv=require(_0xed07('0x7'));var ejs=require(_0xed07('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xed07('0x9'));var squel=require(_0xed07('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xed07('0xb'));var toCsv=require(_0xed07('0x7'));var querystring=require(_0xed07('0xc'));var Papa=require(_0xed07('0xd'));var Redis=require(_0xed07('0xe'));var authService=require(_0xed07('0xf'));var qs=require(_0xed07('0x10'));var as=require(_0xed07('0x11'));var hardwareService=require(_0xed07('0x12'));var logger=require(_0xed07('0x13'))(_0xed07('0x14'));var utils=require('../../config/utils');var config=require(_0xed07('0x15'));var licenseUtil=require(_0xed07('0x16'));var db=require(_0xed07('0x17'))['db'];var dbH=require(_0xed07('0x17'))[_0xed07('0x18')];function respondWithStatusCode(_0x21aa96,_0x1f9b73){_0x1f9b73=_0x1f9b73||0xcc;return function(_0x4e347f){if(_0x4e347f){return _0x21aa96[_0xed07('0x19')](_0x1f9b73);}return _0x21aa96['status'](_0x1f9b73)[_0xed07('0x1a')]();};}function respondWithResult(_0x49b071,_0x5cdad5){_0x5cdad5=_0x5cdad5||0xc8;return function(_0x52c86e){if(_0x52c86e){return _0x49b071[_0xed07('0x1b')](_0x5cdad5)[_0xed07('0x1c')](_0x52c86e);}};}function respondWithFilteredResult(_0x7dee7c,_0x38e6f7){return function(_0x4f41d9){if(_0x4f41d9){var _0x2097f0=typeof _0x38e6f7['offset']===_0xed07('0x1d')&&typeof _0x38e6f7[_0xed07('0x1e')]===_0xed07('0x1d');var _0x61a079=_0x4f41d9['count'];var _0x7a6b29=_0x2097f0?0x0:_0x38e6f7[_0xed07('0x1f')];var _0x315ba9=_0x2097f0?_0x4f41d9['count']:_0x38e6f7['offset']+_0x38e6f7['limit'];var _0x1a8387;if(_0x315ba9>=_0x61a079){_0x315ba9=_0x61a079;_0x1a8387=0xc8;}else{_0x1a8387=0xce;}_0x7dee7c[_0xed07('0x1b')](_0x1a8387);return _0x7dee7c['set'](_0xed07('0x20'),_0x7a6b29+'-'+_0x315ba9+'/'+_0x61a079)[_0xed07('0x1c')](_0x4f41d9);}return null;};}function patchUpdates(_0x11df71){return function(_0x445275){try{jsonpatch[_0xed07('0x21')](_0x445275,_0x11df71,!![]);}catch(_0x10c394){return BPromise[_0xed07('0x22')](_0x10c394);}return _0x445275['save']();};}function saveUpdates(_0x5bb7b6,_0xba74ba){return function(_0x46119f){if(_0x46119f){return _0x46119f[_0xed07('0x23')](_0x5bb7b6)[_0xed07('0x24')](function(_0x4b89c1){return _0x4b89c1;});}return null;};}function removeEntity(_0x25b3e6,_0x16edab){return function(_0x598bea){if(_0x598bea){return _0x598bea[_0xed07('0x25')]()[_0xed07('0x24')](function(){var _0x57d898=_0x598bea['get']({'plain':!![]});var _0x16266b=_0xed07('0x26');return db[_0xed07('0x27')][_0xed07('0x25')]({'where':{'type':_0x16266b,'resourceId':_0x57d898['id']}})[_0xed07('0x24')](function(){return _0x598bea;});})[_0xed07('0x24')](function(){_0x25b3e6[_0xed07('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e4c42,_0x4a6368){return function(_0x2ee303){if(!_0x2ee303){_0x1e4c42[_0xed07('0x19')](0x194);}return _0x2ee303;};}function handleError(_0x143436,_0x1e9113){_0x1e9113=_0x1e9113||0x1f4;return function(_0x7ae630){logger[_0xed07('0x28')](_0x7ae630[_0xed07('0x29')]);if(_0x7ae630[_0xed07('0x2a')]){delete _0x7ae630['name'];}_0x143436[_0xed07('0x1b')](_0x1e9113)[_0xed07('0x2b')](_0x7ae630);};}exports[_0xed07('0x2c')]=function(_0x4d42fe,_0x49e799){var _0x54bc52={},_0x17e264={},_0x51503e={'count':0x0,'rows':[]};var _0x5ab625=_[_0xed07('0x2d')](db[_0xed07('0x2e')][_0xed07('0x2f')],function(_0xfa357e){return{'name':_0xfa357e[_0xed07('0x30')],'type':_0xfa357e['type'][_0xed07('0x31')]};});_0x17e264[_0xed07('0x32')]=_['map'](_0x5ab625,'name');_0x17e264[_0xed07('0x33')]=_[_0xed07('0x34')](_0x4d42fe[_0xed07('0x33')]);_0x17e264['filters']=_[_0xed07('0x35')](_0x17e264[_0xed07('0x32')],_0x17e264[_0xed07('0x33')]);_0x54bc52[_0xed07('0x36')]=_[_0xed07('0x35')](_0x17e264[_0xed07('0x32')],qs[_0xed07('0x37')](_0x4d42fe[_0xed07('0x33')]['fields']));_0x54bc52[_0xed07('0x36')]=_0x54bc52[_0xed07('0x36')][_0xed07('0x38')]?_0x54bc52[_0xed07('0x36')]:_0x17e264[_0xed07('0x32')];if(!_0x4d42fe[_0xed07('0x33')][_0xed07('0x39')](_0xed07('0x3a'))){_0x54bc52['limit']=qs[_0xed07('0x1e')](_0x4d42fe[_0xed07('0x33')][_0xed07('0x1e')]);_0x54bc52[_0xed07('0x1f')]=qs[_0xed07('0x1f')](_0x4d42fe[_0xed07('0x33')][_0xed07('0x1f')]);}_0x54bc52[_0xed07('0x3b')]=qs[_0xed07('0x3c')](_0x4d42fe[_0xed07('0x33')][_0xed07('0x3c')]);_0x54bc52['where']=qs[_0xed07('0x3d')](_[_0xed07('0x3e')](_0x4d42fe[_0xed07('0x33')],_0x17e264[_0xed07('0x3d')]),_0x5ab625);if(_0x4d42fe[_0xed07('0x33')][_0xed07('0x3f')]){_0x54bc52[_0xed07('0x40')]=_[_0xed07('0x41')](_0x54bc52['where'],{'$or':_[_0xed07('0x2d')](_0x5ab625,function(_0x48d230){if(_0x48d230[_0xed07('0x42')]!==_0xed07('0x43')){var _0x3085d0={};_0x3085d0[_0x48d230[_0xed07('0x2a')]]={'$like':'%'+_0x4d42fe[_0xed07('0x33')]['filter']+'%'};return _0x3085d0;}})});}_0x54bc52=_[_0xed07('0x41')]({},_0x54bc52,_0x4d42fe['options']);var _0x1bbcdd={'where':_0x54bc52[_0xed07('0x40')]};return db[_0xed07('0x2e')][_0xed07('0x44')](_0x1bbcdd)[_0xed07('0x24')](function(_0x40967a){_0x51503e['count']=_0x40967a;if(_0x4d42fe[_0xed07('0x33')][_0xed07('0x45')]){_0x54bc52[_0xed07('0x46')]=[{'all':!![]}];}return db[_0xed07('0x2e')][_0xed07('0x47')](_0x54bc52);})[_0xed07('0x24')](function(_0x2e306f){_0x51503e[_0xed07('0x48')]=_0x2e306f;return _0x51503e;})[_0xed07('0x24')](respondWithFilteredResult(_0x49e799,_0x54bc52))['catch'](handleError(_0x49e799,null));};exports[_0xed07('0x49')]=function(_0x305fdc,_0xb5f6ad){var _0xae22b4={'raw':![],'where':{'id':_0x305fdc[_0xed07('0x4a')]['id']}},_0x35e8f6={};_0x35e8f6['model']=_[_0xed07('0x34')](db[_0xed07('0x2e')][_0xed07('0x2f')]);_0x35e8f6[_0xed07('0x33')]=_[_0xed07('0x34')](_0x305fdc[_0xed07('0x33')]);_0x35e8f6[_0xed07('0x3d')]=_['intersection'](_0x35e8f6[_0xed07('0x32')],_0x35e8f6['query']);_0xae22b4[_0xed07('0x36')]=_[_0xed07('0x35')](_0x35e8f6[_0xed07('0x32')],qs[_0xed07('0x37')](_0x305fdc[_0xed07('0x33')][_0xed07('0x37')]));_0xae22b4['attributes']=_0xae22b4[_0xed07('0x36')]['length']?_0xae22b4[_0xed07('0x36')]:_0x35e8f6['model'];if(_0x305fdc['query'][_0xed07('0x45')]){_0xae22b4['include']=[{'all':!![]}];}_0xae22b4=_[_0xed07('0x41')]({},_0xae22b4,_0x305fdc[_0xed07('0x4b')]);return db['AnalyticCustomReport'][_0xed07('0x4c')](_0xae22b4)[_0xed07('0x24')](handleEntityNotFound(_0xb5f6ad,null))[_0xed07('0x24')](respondWithResult(_0xb5f6ad,null))['catch'](handleError(_0xb5f6ad,null));};exports[_0xed07('0x4d')]=function(_0x11f95a,_0x185f07){return db[_0xed07('0x2e')][_0xed07('0x4d')](_0x11f95a[_0xed07('0x4e')],{})[_0xed07('0x24')](function(_0x45e03a){var _0x11d191=_0x11f95a[_0xed07('0x4f')][_0xed07('0x50')]({'plain':!![]});if(!_0x11d191)throw new Error(_0xed07('0x51'));if(_0x11d191['role']===_0xed07('0x4f')){var _0x3567a7=_0x45e03a[_0xed07('0x50')]({'plain':!![]});var _0x2e839a=_0xed07('0x52');return db[_0xed07('0x53')][_0xed07('0x4c')]({'where':{'name':_0x2e839a,'userProfileId':_0x11d191[_0xed07('0x54')]},'raw':!![]})[_0xed07('0x24')](function(_0x1ab2b4){if(_0x1ab2b4&&_0x1ab2b4[_0xed07('0x55')]===0x0){return db[_0xed07('0x27')][_0xed07('0x4d')]({'name':_0x3567a7[_0xed07('0x2a')],'resourceId':_0x3567a7['id'],'type':'CustomReports','sectionId':_0x1ab2b4['id']},{})[_0xed07('0x24')](function(){return _0x45e03a;});}else{return _0x45e03a;}})['catch'](function(_0x373443){logger[_0xed07('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x373443);throw _0x373443;});}return _0x45e03a;})['then'](respondWithResult(_0x185f07,0xc9))['catch'](handleError(_0x185f07,null));};exports[_0xed07('0x23')]=function(_0x12bcfd,_0x255316){if(_0x12bcfd[_0xed07('0x4e')]['id']){delete _0x12bcfd[_0xed07('0x4e')]['id'];}return db[_0xed07('0x2e')][_0xed07('0x4c')]({'where':{'id':_0x12bcfd['params']['id']}})[_0xed07('0x24')](handleEntityNotFound(_0x255316,null))[_0xed07('0x24')](saveUpdates(_0x12bcfd[_0xed07('0x4e')],null))[_0xed07('0x24')](respondWithResult(_0x255316,null))[_0xed07('0x56')](handleError(_0x255316,null));};exports[_0xed07('0x25')]=function(_0x320ade,_0x452278){return db[_0xed07('0x2e')][_0xed07('0x4c')]({'where':{'id':_0x320ade[_0xed07('0x4a')]['id']}})[_0xed07('0x24')](handleEntityNotFound(_0x452278,null))[_0xed07('0x24')](removeEntity(_0x452278,null))[_0xed07('0x56')](handleError(_0x452278,null));};exports[_0xed07('0x57')]=function(_0x5bd6d1,_0x56d830){var _0x30a220=0xa;var _0x5cd790=[_0xed07('0x58'),'left_join',_0xed07('0x59'),_0xed07('0x5a')];var _0x57c844={'SUM':_0xed07('0x5b'),'COUNT':_0xed07('0x5c'),'COUNT DISTINCT':_0xed07('0x5d'),'MAX':_0xed07('0x5e'),'MIN':'MIN(%s)','AVG':_0xed07('0x5f'),'GROUP_CONCAT':_0xed07('0x60'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xed07('0x61')};var _0x549fc3={'SEC_TO_TIME':_0xed07('0x62'),'DATE':_0xed07('0x63'),'HOUR':_0xed07('0x64'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x4e4db3=function(_0x1cc479){return!_[_0xed07('0x65')](['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY',_0xed07('0x66')],_0x1cc479);};var _0xf13ba3=function(_0x2c48e9){if(!_0x2c48e9||!_0x2c48e9[_0xed07('0x67')][_0xed07('0x38')]){return'';}for(var _0x367bf5='(',_0x3e54c5=0x0;_0x3e54c5<_0x2c48e9['rules'][_0xed07('0x38')];_0x3e54c5+=0x1){_0x3e54c5>0x0&&(_0x367bf5+='\x20'+_0x2c48e9[_0xed07('0x68')]+'\x20');_0x367bf5+=_0x2c48e9[_0xed07('0x67')][_0x3e54c5][_0xed07('0x69')]?_0xf13ba3(_0x2c48e9[_0xed07('0x67')][_0x3e54c5][_0xed07('0x69')]):_0x2c48e9[_0xed07('0x67')][_0x3e54c5]['field']+'\x20'+_0x2c48e9['rules'][_0x3e54c5][_0xed07('0x6a')]+(_0x4e4db3(_0x2c48e9[_0xed07('0x67')][_0x3e54c5][_0xed07('0x6a')])?'\x20'+_0x2c48e9[_0xed07('0x67')][_0x3e54c5][_0xed07('0x6b')]:'');}return _0x367bf5+')';};var _0x17a796={'where':{'id':_0x5bd6d1[_0xed07('0x4a')]['id']}},_0x22fde4,_0x45a1ac,_0x36b4f5,_0x587286,_0x1a27a8;_0x17a796=_[_0xed07('0x41')]({},_0x17a796,_0x5bd6d1['options']);return db['AnalyticCustomReport'][_0xed07('0x4c')](_0x17a796)[_0xed07('0x24')](function(_0x582089){if(_0x582089){_0x22fde4=_0x582089;return _0x582089[_0xed07('0x6c')]();}return null;})['then'](function(_0x2c8f12){if(_0x2c8f12){if(!_0x2c8f12['length']){throw new db[(_0xed07('0x6d'))][(_0xed07('0x6e'))](_0xed07('0x6f'),0x193);}_0x45a1ac=_0x2c8f12;return db[_0xed07('0x70')][_0xed07('0x47')]({'raw':!![]});}return null;})[_0xed07('0x24')](function(_0x54875f){if(_0x54875f){_0x36b4f5=_[_0xed07('0x71')](_0x54875f,'id');var _0x4835c4;var _0x1c0d52=squel['select']();_0x1c0d52[_0xed07('0x72')](_0x22fde4['table']);for(var _0x50b8e1=0x0;_0x50b8e1<_0x45a1ac[_0xed07('0x38')];_0x50b8e1+=0x1){_0x4835c4=_0x45a1ac[_0x50b8e1]['MetricId']?_0x36b4f5[_0x45a1ac[_0x50b8e1]['MetricId']]['metric']:_0x45a1ac[_0x50b8e1][_0xed07('0x73')];_0x4835c4=_0x45a1ac[_0x50b8e1][_0xed07('0x74')]?_[_0xed07('0x75')](_0x57c844[_0x45a1ac[_0x50b8e1][_0xed07('0x74')]],'%s',_0x4835c4):_0x4835c4;_0x4835c4=_0x45a1ac[_0x50b8e1]['format']?_[_0xed07('0x75')](_0x549fc3[_0x45a1ac[_0x50b8e1][_0xed07('0x76')]],'%s',_0x4835c4):_0x4835c4;if(_0x45a1ac[_0x50b8e1][_0xed07('0x77')]){_0x1c0d52['group'](_0x4835c4);}_0x45a1ac[_0x50b8e1][_0xed07('0x78')]&&_0x1c0d52['order'](_0x4835c4,_0x45a1ac[_0x50b8e1][_0xed07('0x78')]===_0xed07('0x79')?![]:!![]);_0x1c0d52[_0xed07('0x73')](_0x4835c4,_0x45a1ac[_0x50b8e1][_0xed07('0x7a')]||_0x4835c4);}if(_0x22fde4['joins']){_0x22fde4[_0xed07('0x7b')]=JSON['parse'](_0x22fde4['joins']);for(var _0x463564=0x0;_0x463564<_0x22fde4[_0xed07('0x7b')][_0xed07('0x38')];_0x463564+=0x1){if(_0x22fde4[_0xed07('0x7b')][_0x463564]['type']&&_[_0xed07('0x65')](_0x5cd790,_0x22fde4['joins'][_0x463564][_0xed07('0x42')])&&_0x22fde4[_0xed07('0x7b')][_0x463564][_0xed07('0x7c')]&&_0x22fde4[_0xed07('0x7b')][_0x463564][_0xed07('0x7d')]&&_0x22fde4[_0xed07('0x7b')][_0x463564][_0xed07('0x7e')]){_0x1c0d52[_0x22fde4[_0xed07('0x7b')][_0x463564]['type']](_0x22fde4[_0xed07('0x7b')][_0x463564]['foreignTable'],null,util['format']('%s.%s\x20=\x20%s.%s',_0x22fde4[_0xed07('0x7f')],_0x22fde4[_0xed07('0x7b')][_0x463564][_0xed07('0x7c')],_0x22fde4['joins'][_0x463564][_0xed07('0x7d')],_0x22fde4[_0xed07('0x7b')][_0x463564][_0xed07('0x7e')]));}}}if(_0x22fde4[_0xed07('0x80')]){_0x22fde4['conditions']=JSON[_0xed07('0x81')](_0x22fde4[_0xed07('0x80')]);_0x1c0d52[_0xed07('0x40')](_0xf13ba3(_0x22fde4['conditions'][_0xed07('0x69')]));}_0x1a27a8=_0x1c0d52[_0xed07('0x82')]();_0x1c0d52[_0xed07('0x1e')](_0x30a220);_0x1c0d52[_0xed07('0x1f')](0x0);logger[_0xed07('0x83')](_0xed07('0x84'),_0x1c0d52[_0xed07('0x85')]());return dbH[_0xed07('0x86')][_0xed07('0x33')](_0x1c0d52[_0xed07('0x85')](),{'type':dbH[_0xed07('0x86')][_0xed07('0x87')]['SELECT']});}})[_0xed07('0x24')](respondWithResult(_0x56d830,null))[_0xed07('0x56')](handleError(_0x56d830,null));};function runReport(_0x82d8f8,_0x29bf9d,_0x5b3e14){var _0x5bc9dd=_0x29bf9d[_0xed07('0x2a')];var _0x198f5b=0xa;var _0x3491fb=[_0xed07('0x58'),_0xed07('0x88'),_0xed07('0x59'),_0xed07('0x5a')];var _0x376d01={'SUM':'SUM(%s)','COUNT':_0xed07('0x5c'),'COUNT DISTINCT':_0xed07('0x5d'),'MAX':_0xed07('0x5e'),'MIN':_0xed07('0x89'),'AVG':_0xed07('0x5f'),'GROUP_CONCAT':_0xed07('0x60'),'GROUP_CONCAT ASC':_0xed07('0x8a'),'GROUP_CONCAT DESC':_0xed07('0x61')};var _0x12e130={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xed07('0x63'),'HOUR':_0xed07('0x64'),'ROUND':_0xed07('0x8b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1d0254=function(_0x561473){return!_[_0xed07('0x65')]([_0xed07('0x8c'),_0xed07('0x8d'),'IS\x20EMPTY',_0xed07('0x66')],_0x561473);};var _0x2ae5dd=function(_0x18938e){if(!_0x18938e||!_0x18938e['rules']['length']){return'';}for(var _0x43c4c5='(',_0x183074=0x0;_0x183074<_0x18938e[_0xed07('0x67')]['length'];_0x183074+=0x1){_0x183074>0x0&&(_0x43c4c5+='\x20'+_0x18938e[_0xed07('0x68')]+'\x20');_0x43c4c5+=_0x18938e[_0xed07('0x67')][_0x183074][_0xed07('0x69')]?_0x2ae5dd(_0x18938e[_0xed07('0x67')][_0x183074][_0xed07('0x69')]):_0x18938e[_0xed07('0x67')][_0x183074][_0xed07('0x73')]+'\x20'+_0x18938e['rules'][_0x183074][_0xed07('0x6a')]+(_0x1d0254(_0x18938e[_0xed07('0x67')][_0x183074][_0xed07('0x6a')])?'\x20'+_0x18938e[_0xed07('0x67')][_0x183074][_0xed07('0x6b')]:'');}return _0x43c4c5+')';};var _0x54be7d={'where':{'id':_0x82d8f8['id']}},_0x5ebdb5,_0x4e8421,_0xe5631f,_0x113cd0,_0x3cfc43;_0x54be7d=_[_0xed07('0x41')]({},_0x54be7d,_0x5b3e14);return db[_0xed07('0x2e')][_0xed07('0x4c')](_0x54be7d)[_0xed07('0x24')](function(_0x4ec1e6){if(_0x4ec1e6){_0x5ebdb5=_0x4ec1e6;return _0x4ec1e6[_0xed07('0x6c')]();}return null;})[_0xed07('0x24')](function(_0x5b9114){if(_0x5b9114){if(!_0x5b9114[_0xed07('0x38')]){throw new db[(_0xed07('0x6d'))][(_0xed07('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4e8421=_0x5b9114;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xed07('0x24')](function(_0x46c608){if(_0x46c608){_0xe5631f=_['keyBy'](_0x46c608,'id');var _0x2c99c2;var _0x3a42b9=squel[_0xed07('0x8e')]();_0x3a42b9[_0xed07('0x72')](_0x5ebdb5[_0xed07('0x7f')]);for(var _0x293b4d=0x0;_0x293b4d<_0x4e8421[_0xed07('0x38')];_0x293b4d+=0x1){_0x2c99c2=_0x4e8421[_0x293b4d][_0xed07('0x8f')]?_0xe5631f[_0x4e8421[_0x293b4d][_0xed07('0x8f')]]['metric']:_0x4e8421[_0x293b4d]['field'];_0x2c99c2=_0x4e8421[_0x293b4d][_0xed07('0x74')]?_['replace'](_0x376d01[_0x4e8421[_0x293b4d]['function']],'%s',_0x2c99c2):_0x2c99c2;_0x2c99c2=_0x4e8421[_0x293b4d][_0xed07('0x76')]?_[_0xed07('0x75')](_0x12e130[_0x4e8421[_0x293b4d][_0xed07('0x76')]],'%s',_0x2c99c2):_0x2c99c2;if(_0x4e8421[_0x293b4d][_0xed07('0x77')]){_0x3a42b9[_0xed07('0x69')](_0x2c99c2);}_0x4e8421[_0x293b4d]['orderBy']&&_0x3a42b9['order'](_0x2c99c2,_0x4e8421[_0x293b4d]['orderBy']===_0xed07('0x79')?![]:!![]);_0x3a42b9['field'](_0x2c99c2,_0x4e8421[_0x293b4d]['alias']||_0x2c99c2);}if(_0x5ebdb5[_0xed07('0x7b')]){_0x5ebdb5[_0xed07('0x7b')]=JSON['parse'](_0x5ebdb5['joins']);for(var _0x5c7a64=0x0;_0x5c7a64<_0x5ebdb5[_0xed07('0x7b')][_0xed07('0x38')];_0x5c7a64+=0x1){if(_0x5ebdb5[_0xed07('0x7b')][_0x5c7a64][_0xed07('0x42')]&&_['includes'](_0x3491fb,_0x5ebdb5[_0xed07('0x7b')][_0x5c7a64][_0xed07('0x42')])&&_0x5ebdb5[_0xed07('0x7b')][_0x5c7a64][_0xed07('0x7c')]&&_0x5ebdb5[_0xed07('0x7b')][_0x5c7a64]['foreignTable']&&_0x5ebdb5[_0xed07('0x7b')][_0x5c7a64][_0xed07('0x7e')]){_0x3a42b9[_0x5ebdb5['joins'][_0x5c7a64][_0xed07('0x42')]](_0x5ebdb5[_0xed07('0x7b')][_0x5c7a64]['foreignTable'],null,util[_0xed07('0x76')](_0xed07('0x90'),_0x5ebdb5['table'],_0x5ebdb5[_0xed07('0x7b')][_0x5c7a64][_0xed07('0x7c')],_0x5ebdb5['joins'][_0x5c7a64]['foreignTable'],_0x5ebdb5[_0xed07('0x7b')][_0x5c7a64][_0xed07('0x7e')]));}}}if(_0x5ebdb5[_0xed07('0x80')]){_0x5ebdb5[_0xed07('0x80')]=JSON[_0xed07('0x81')](_0x5ebdb5[_0xed07('0x80')]);_0x3a42b9[_0xed07('0x40')](_0x2ae5dd(_0x5ebdb5[_0xed07('0x80')][_0xed07('0x69')]));}_0x3cfc43=_0x3a42b9['clone']();_0x3a42b9['limit'](_0x198f5b);_0x3a42b9[_0xed07('0x1f')](0x0);return;}})[_0xed07('0x24')](function(){if(_0x29bf9d[_0xed07('0x91')]==='web'){return null;}var _0x201760=_[_0xed07('0x41')](_0x29bf9d,{'name':_0x29bf9d[_0xed07('0x92')]||_0x29bf9d[_0xed07('0x2a')]||_0x5ebdb5[_0xed07('0x2a')],'basename':_0x5bc9dd,'savename':util['format'](_0xed07('0x93'),_0x29bf9d[_0xed07('0x2a')]||_0x5ebdb5['name'],require('randomstring')[_0xed07('0x94')](0x4),_0x29bf9d['output']||'csv'),'reportId':_0x5ebdb5['id'],'reportType':_0xed07('0x95')});return db[_0xed07('0x96')]['create'](_0x201760,{'raw':!![]});})[_0xed07('0x24')](function(_0x4c23b3){if(_0x5ebdb5['table']==='cdr'){_0x3cfc43[_0xed07('0x40')](_0x5ebdb5['table']+_0xed07('0x97'),_0x29bf9d['startDate'],_0x29bf9d['endDate']);}else{_0x3cfc43[_0xed07('0x40')](_0x5ebdb5[_0xed07('0x7f')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x29bf9d['startDate'],_0x29bf9d[_0xed07('0x98')]);}if(_0x4c23b3){logger['info'](_0xed07('0x99'),_0x3cfc43[_0xed07('0x85')]());require(_0xed07('0x9a'))[_0xed07('0x9b')](path[_0xed07('0x58')](__dirname,_0xed07('0x9c'),_0x4c23b3[_0xed07('0x91')]),[_0x4c23b3['id'],_0x3cfc43[_0xed07('0x85')](),path[_0xed07('0x58')](__dirname,'../../files/reports',_0x4c23b3[_0xed07('0x9d')]),_0x5bc9dd]);return _0x4c23b3;}else{var _0x2a5549=squel[_0xed07('0x8e')]();_0x2a5549['from']('('+_0x3cfc43[_0xed07('0x85')]()+')','countTable');_0x2a5549[_0xed07('0x73')]('COUNT(*)',_0xed07('0x44'));_0x3cfc43[_0xed07('0x1e')](_0x29bf9d[_0xed07('0x1e')]||_0x198f5b);_0x3cfc43['offset'](_0x29bf9d[_0xed07('0x1f')]||0x0);return dbH[_0xed07('0x86')][_0xed07('0x33')](_0x2a5549[_0xed07('0x85')](),{'type':dbH[_0xed07('0x86')][_0xed07('0x87')][_0xed07('0x9e')]})['then'](function(_0x456720){if(!_0x456720['length']){_0x113cd0=0x0;}else{_0x113cd0=_0x456720[0x0][_0xed07('0x44')]||0x0;}return dbH[_0xed07('0x86')][_0xed07('0x33')](_0x3cfc43['toString'](),{'type':dbH[_0xed07('0x86')][_0xed07('0x87')]['SELECT']});})[_0xed07('0x24')](function(_0xad4409){return{'rows':_0xad4409||[],'count':_0x113cd0};});}});}exports[_0xed07('0x9f')]=function(_0x292963,_0x1a9e4e){return runReport(_0x292963['params'],_0x292963['query'],_0x292963['options'])[_0xed07('0x24')](respondWithResult(_0x1a9e4e,null))['catch'](handleError(_0x1a9e4e,null));};exports['runReport']=runReport;exports[_0xed07('0x33')]=function(_0x163716,_0x1ce9b6){var _0x3e8b32=0xa;var _0x57bb47=[_0xed07('0x58'),_0xed07('0x88'),'right_join',_0xed07('0x5a')];var _0x2d0556={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0xed07('0x5d'),'MAX':_0xed07('0x5e'),'MIN':_0xed07('0x89'),'AVG':_0xed07('0x5f'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xed07('0x8a'),'GROUP_CONCAT DESC':_0xed07('0x61')};var _0x50a62f={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xed07('0x63'),'HOUR':_0xed07('0x64'),'ROUND':_0xed07('0x8b'),'UNIX_TIMESTAMP':_0xed07('0xa0')};var _0x5aa118=function(_0x28554e){return!_['includes']([_0xed07('0x8c'),_0xed07('0x8d'),'IS\x20EMPTY',_0xed07('0x66')],_0x28554e);};var _0x3c400a=function(_0x468d64){if(!_0x468d64||!_0x468d64['rules'][_0xed07('0x38')]){return'';}for(var _0x1da1df='(',_0x377259=0x0;_0x377259<_0x468d64['rules'][_0xed07('0x38')];_0x377259+=0x1){_0x377259>0x0&&(_0x1da1df+='\x20'+_0x468d64['operator']+'\x20');_0x1da1df+=_0x468d64['rules'][_0x377259][_0xed07('0x69')]?_0x3c400a(_0x468d64['rules'][_0x377259][_0xed07('0x69')]):_0x468d64[_0xed07('0x67')][_0x377259][_0xed07('0x73')]+'\x20'+_0x468d64[_0xed07('0x67')][_0x377259][_0xed07('0x6a')]+(_0x5aa118(_0x468d64[_0xed07('0x67')][_0x377259][_0xed07('0x6a')])?'\x20'+_0x468d64['rules'][_0x377259][_0xed07('0x6b')]:'');}return _0x1da1df+')';};var _0x4d6f58={'where':{'id':_0x163716['params']['id']}},_0x50c2e0,_0x7ec40c,_0x1f4833,_0xcf40dc,_0x39ef0c;_0x4d6f58=_[_0xed07('0x41')]({},_0x4d6f58,_0x163716['options']);return db[_0xed07('0x2e')]['find'](_0x4d6f58)[_0xed07('0x24')](function(_0x57219a){if(_0x57219a){_0x50c2e0=_0x57219a;return _0x57219a[_0xed07('0x6c')]();}return null;})[_0xed07('0x24')](function(_0xd46710){if(_0xd46710){if(!_0xd46710[_0xed07('0x38')]){throw new db[(_0xed07('0x6d'))][(_0xed07('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x7ec40c=_0xd46710;return db[_0xed07('0x70')]['findAll']({'raw':!![]});}return null;})[_0xed07('0x24')](function(_0x12a782){if(_0x12a782){_0x1f4833=_['keyBy'](_0x12a782,'id');var _0xa50109;var _0x447158=squel[_0xed07('0x8e')]();_0x447158['from'](_0x50c2e0[_0xed07('0x7f')]);for(var _0xc26b71=0x0;_0xc26b71<_0x7ec40c[_0xed07('0x38')];_0xc26b71+=0x1){_0xa50109=_0x7ec40c[_0xc26b71][_0xed07('0x8f')]?_0x1f4833[_0x7ec40c[_0xc26b71]['MetricId']][_0xed07('0xa1')]:_0x7ec40c[_0xc26b71]['field'];_0xa50109=_0x7ec40c[_0xc26b71][_0xed07('0x74')]?_['replace'](_0x2d0556[_0x7ec40c[_0xc26b71][_0xed07('0x74')]],'%s',_0xa50109):_0xa50109;_0xa50109=_0x7ec40c[_0xc26b71][_0xed07('0x76')]?_[_0xed07('0x75')](_0x50a62f[_0x7ec40c[_0xc26b71][_0xed07('0x76')]],'%s',_0xa50109):_0xa50109;if(_0x7ec40c[_0xc26b71][_0xed07('0x77')]){_0x447158['group'](_0xa50109);}_0x7ec40c[_0xc26b71][_0xed07('0x78')]&&_0x447158[_0xed07('0x3b')](_0xa50109,_0x7ec40c[_0xc26b71]['orderBy']==='DESC'?![]:!![]);_0x447158[_0xed07('0x73')](_0xa50109,_0x7ec40c[_0xc26b71][_0xed07('0x7a')]||_0xa50109);}if(_0x50c2e0[_0xed07('0x7b')]){_0x50c2e0[_0xed07('0x7b')]=JSON[_0xed07('0x81')](_0x50c2e0[_0xed07('0x7b')]);for(var _0x59b805=0x0;_0x59b805<_0x50c2e0['joins']['length'];_0x59b805+=0x1){if(_0x50c2e0[_0xed07('0x7b')][_0x59b805][_0xed07('0x42')]&&_[_0xed07('0x65')](_0x57bb47,_0x50c2e0[_0xed07('0x7b')][_0x59b805][_0xed07('0x42')])&&_0x50c2e0[_0xed07('0x7b')][_0x59b805][_0xed07('0x7c')]&&_0x50c2e0['joins'][_0x59b805][_0xed07('0x7d')]&&_0x50c2e0[_0xed07('0x7b')][_0x59b805][_0xed07('0x7e')]){_0x447158[_0x50c2e0['joins'][_0x59b805][_0xed07('0x42')]](_0x50c2e0[_0xed07('0x7b')][_0x59b805]['foreignTable'],null,util[_0xed07('0x76')](_0xed07('0x90'),_0x50c2e0[_0xed07('0x7f')],_0x50c2e0[_0xed07('0x7b')][_0x59b805][_0xed07('0x7c')],_0x50c2e0[_0xed07('0x7b')][_0x59b805][_0xed07('0x7d')],_0x50c2e0[_0xed07('0x7b')][_0x59b805][_0xed07('0x7e')]));}}}if(_0x50c2e0['conditions']){_0x50c2e0[_0xed07('0x80')]=JSON[_0xed07('0x81')](_0x50c2e0[_0xed07('0x80')]);_0x447158['where'](_0x3c400a(_0x50c2e0[_0xed07('0x80')][_0xed07('0x69')]));}_0x39ef0c=_0x447158[_0xed07('0x82')]();_0x447158[_0xed07('0x1e')](_0x3e8b32);_0x447158[_0xed07('0x1f')](0x0);logger[_0xed07('0x83')](_0xed07('0x84'),_0x447158[_0xed07('0x85')]());return dbH[_0xed07('0x86')]['query'](_0x447158[_0xed07('0x85')](),{'type':dbH[_0xed07('0x86')]['QueryTypes'][_0xed07('0x9e')]});}})[_0xed07('0x24')](function(){return{'sql':_0x39ef0c[_0xed07('0x85')]()};})[_0xed07('0x24')](respondWithResult(_0x1ce9b6,null))[_0xed07('0x56')](handleError(_0x1ce9b6,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 5549ad4..9d93a98 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 _0x8c63=['AnalyticCustomReport','analytics_custom_reports','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0xf9bfe2,_0x1bae47){var _0x2ce92b=function(_0x32cc02){while(--_0x32cc02){_0xf9bfe2['push'](_0xf9bfe2['shift']());}};_0x2ce92b(++_0x1bae47);}(_0x8c63,0x6a));var _0x38c6=function(_0x5aa11a,_0x84cafc){_0x5aa11a=_0x5aa11a-0x0;var _0x59aec7=_0x8c63[_0x5aa11a];return _0x59aec7;};'use strict';var _=require(_0x38c6('0x0'));var util=require(_0x38c6('0x1'));var logger=require('../../config/logger')(_0x38c6('0x2'));var moment=require(_0x38c6('0x3'));var BPromise=require(_0x38c6('0x4'));var rp=require(_0x38c6('0x5'));var fs=require('fs');var path=require(_0x38c6('0x6'));var rimraf=require(_0x38c6('0x7'));var config=require(_0x38c6('0x8'));var attributes=require('./analyticCustomReport.attributes');module[_0x38c6('0x9')]=function(_0x5cc8d7,_0x312a89){return _0x5cc8d7[_0x38c6('0xa')](_0x38c6('0xb'),attributes,{'tableName':_0x38c6('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc2a4=['../../config/logger','bluebird','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util'];(function(_0x22e9fe,_0x3d019f){var _0x47cd19=function(_0x8fd5fc){while(--_0x8fd5fc){_0x22e9fe['push'](_0x22e9fe['shift']());}};_0x47cd19(++_0x3d019f);}(_0xc2a4,0x1d2));var _0x4c2a=function(_0x1354ed,_0x45b93d){_0x1354ed=_0x1354ed-0x0;var _0x5e3605=_0xc2a4[_0x1354ed];return _0x5e3605;};'use strict';var _=require(_0x4c2a('0x0'));var util=require(_0x4c2a('0x1'));var logger=require(_0x4c2a('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4c2a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4c2a('0x4'));var rimraf=require(_0x4c2a('0x5'));var config=require(_0x4c2a('0x6'));var attributes=require(_0x4c2a('0x7'));module[_0x4c2a('0x8')]=function(_0xc91c86,_0x542bcb){return _0xc91c86[_0x4c2a('0x9')](_0x4c2a('0xa'),attributes,{'tableName':_0x4c2a('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index a3db7ad..b55e466 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 _0x65fb=['debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','then','info','AnalyticCustomReport,\x20%s,\x20%s'];(function(_0x123786,_0xed12f6){var _0x45f2ce=function(_0x5912e2){while(--_0x5912e2){_0x123786['push'](_0x123786['shift']());}};_0x45f2ce(++_0xed12f6);}(_0x65fb,0x1ab));var _0xb65f=function(_0xd0cd0b,_0x490956){_0xd0cd0b=_0xd0cd0b-0x0;var _0x59cced=_0x65fb[_0xd0cd0b];return _0x59cced;};'use strict';var _=require(_0xb65f('0x0'));var util=require(_0xb65f('0x1'));var moment=require(_0xb65f('0x2'));var BPromise=require('bluebird');var rs=require(_0xb65f('0x3'));var fs=require('fs');var Redis=require(_0xb65f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb65f('0x5'));var logger=require('../../config/logger')(_0xb65f('0x6'));var config=require(_0xb65f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb65f('0x8')][_0xb65f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x233b3b,_0x3befef,_0x12e59c){return new BPromise(function(_0xf9b55a,_0x36f063){return client['request'](_0x233b3b,_0x12e59c)[_0xb65f('0xa')](function(_0x8be2bb){logger[_0xb65f('0xb')](_0xb65f('0xc'),_0x3befef,'request\x20sent');logger[_0xb65f('0xd')](_0xb65f('0xe'),_0x3befef,_0xb65f('0xf'),JSON[_0xb65f('0x10')](_0x8be2bb));if(_0x8be2bb['error']){if(_0x8be2bb[_0xb65f('0x11')][_0xb65f('0x12')]===0x1f4){logger['error'](_0xb65f('0xc'),_0x3befef,_0x8be2bb[_0xb65f('0x11')][_0xb65f('0x13')]);return _0x36f063(_0x8be2bb[_0xb65f('0x11')][_0xb65f('0x13')]);}logger[_0xb65f('0x11')]('AnalyticCustomReport,\x20%s,\x20%s',_0x3befef,_0x8be2bb[_0xb65f('0x11')][_0xb65f('0x13')]);return _0xf9b55a(_0x8be2bb['error'][_0xb65f('0x13')]);}else{logger[_0xb65f('0xb')](_0xb65f('0xc'),_0x3befef,_0xb65f('0xf'));_0xf9b55a(_0x8be2bb[_0xb65f('0x14')][_0xb65f('0x13')]);}})[_0xb65f('0x15')](function(_0x3a3167){logger[_0xb65f('0x11')](_0xb65f('0xc'),_0x3befef,_0x3a3167);_0x36f063(_0x3a3167);});});} \ No newline at end of file +var _0x9d68=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x11d447,_0x5b9c09){var _0x285004=function(_0x32ecab){while(--_0x32ecab){_0x11d447['push'](_0x11d447['shift']());}};_0x285004(++_0x5b9c09);}(_0x9d68,0xd1));var _0x89d6=function(_0x34b5ca,_0x594010){_0x34b5ca=_0x34b5ca-0x0;var _0x2d72c0=_0x9d68[_0x34b5ca];return _0x2d72c0;};'use strict';var _=require(_0x89d6('0x0'));var util=require('util');var moment=require(_0x89d6('0x1'));var BPromise=require(_0x89d6('0x2'));var rs=require(_0x89d6('0x3'));var fs=require('fs');var Redis=require(_0x89d6('0x4'));var db=require(_0x89d6('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x89d6('0x6'));var config=require(_0x89d6('0x7'));var jayson=require(_0x89d6('0x8'));var client=jayson[_0x89d6('0x9')][_0x89d6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x33ce6c,_0x2bfdb1,_0x239017){return new BPromise(function(_0x1769eb,_0x2aedf0){return client[_0x89d6('0xb')](_0x33ce6c,_0x239017)[_0x89d6('0xc')](function(_0x32bd5c){logger[_0x89d6('0xd')](_0x89d6('0xe'),_0x2bfdb1,_0x89d6('0xf'));logger[_0x89d6('0x10')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x2bfdb1,_0x89d6('0xf'),JSON[_0x89d6('0x11')](_0x32bd5c));if(_0x32bd5c[_0x89d6('0x12')]){if(_0x32bd5c['error'][_0x89d6('0x13')]===0x1f4){logger['error'](_0x89d6('0xe'),_0x2bfdb1,_0x32bd5c[_0x89d6('0x12')][_0x89d6('0x14')]);return _0x2aedf0(_0x32bd5c[_0x89d6('0x12')][_0x89d6('0x14')]);}logger[_0x89d6('0x12')](_0x89d6('0xe'),_0x2bfdb1,_0x32bd5c[_0x89d6('0x12')][_0x89d6('0x14')]);return _0x1769eb(_0x32bd5c[_0x89d6('0x12')][_0x89d6('0x14')]);}else{logger[_0x89d6('0xd')](_0x89d6('0xe'),_0x2bfdb1,'request\x20sent');_0x1769eb(_0x32bd5c[_0x89d6('0x15')][_0x89d6('0x14')]);}})[_0x89d6('0x16')](function(_0x350610){logger[_0x89d6('0x12')](_0x89d6('0xe'),_0x2bfdb1,_0x350610);_0x2aedf0(_0x350610);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index cb95b84..369e385 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 _0x4aad=['get','isAuthenticated','/:id','preview','/:id/run','run','/:id/query','query','post','create','put','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1ca820,_0x143eda){var _0x115869=function(_0x3a6b91){while(--_0x3a6b91){_0x1ca820['push'](_0x1ca820['shift']());}};_0x115869(++_0x143eda);}(_0x4aad,0x19d));var _0xd4aa=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x4aad[_0x3b0731];return _0x4204d7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd4aa('0x0'));var timeout=require(_0xd4aa('0x1'));var express=require(_0xd4aa('0x2'));var router=express[_0xd4aa('0x3')]();var fs_extra=require(_0xd4aa('0x4'));var auth=require(_0xd4aa('0x5'));var interaction=require(_0xd4aa('0x6'));var config=require('../../config/environment');var controller=require('./analyticCustomReport.controller');router[_0xd4aa('0x7')]('/',auth[_0xd4aa('0x8')](),controller['index']);router[_0xd4aa('0x7')](_0xd4aa('0x9'),auth[_0xd4aa('0x8')](),controller['show']);router[_0xd4aa('0x7')]('/:id/preview',auth[_0xd4aa('0x8')](),controller[_0xd4aa('0xa')]);router[_0xd4aa('0x7')](_0xd4aa('0xb'),auth[_0xd4aa('0x8')](),controller[_0xd4aa('0xc')]);router['get'](_0xd4aa('0xd'),auth['isAuthenticated'](),controller[_0xd4aa('0xe')]);router[_0xd4aa('0xf')]('/',auth[_0xd4aa('0x8')](),controller[_0xd4aa('0x10')]);router[_0xd4aa('0x11')](_0xd4aa('0x9'),auth[_0xd4aa('0x8')](),controller['update']);router[_0xd4aa('0x12')](_0xd4aa('0x9'),auth[_0xd4aa('0x8')](),controller[_0xd4aa('0x13')]);module[_0xd4aa('0x14')]=router; \ No newline at end of file +var _0x2c60=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','index','get','/:id','isAuthenticated','show','/:id/preview','preview','/:id/run','query','create','put','delete','destroy','exports','multer','util'];(function(_0x2d89ce,_0x24d58d){var _0x3fad10=function(_0xad0ec){while(--_0xad0ec){_0x2d89ce['push'](_0x2d89ce['shift']());}};_0x3fad10(++_0x24d58d);}(_0x2c60,0xcd));var _0x02c6=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x2c60[_0x6cf19c];return _0xce14f3;};'use strict';var multer=require(_0x02c6('0x0'));var util=require(_0x02c6('0x1'));var path=require(_0x02c6('0x2'));var timeout=require(_0x02c6('0x3'));var express=require(_0x02c6('0x4'));var router=express[_0x02c6('0x5')]();var fs_extra=require(_0x02c6('0x6'));var auth=require(_0x02c6('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x02c6('0x8'));var controller=require('./analyticCustomReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x02c6('0x9')]);router[_0x02c6('0xa')](_0x02c6('0xb'),auth[_0x02c6('0xc')](),controller[_0x02c6('0xd')]);router[_0x02c6('0xa')](_0x02c6('0xe'),auth[_0x02c6('0xc')](),controller[_0x02c6('0xf')]);router[_0x02c6('0xa')](_0x02c6('0x10'),auth[_0x02c6('0xc')](),controller['run']);router[_0x02c6('0xa')]('/:id/query',auth[_0x02c6('0xc')](),controller[_0x02c6('0x11')]);router['post']('/',auth[_0x02c6('0xc')](),controller[_0x02c6('0x12')]);router[_0x02c6('0x13')](_0x02c6('0xb'),auth[_0x02c6('0xc')](),controller['update']);router[_0x02c6('0x14')](_0x02c6('0xb'),auth['isAuthenticated'](),controller[_0x02c6('0x15')]);module[_0x02c6('0x16')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 50ee040..6e759fe 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 _0x7c09=['exports','STRING','TEXT'];(function(_0x31041b,_0x40e1e6){var _0x12721d=function(_0x1aec2b){while(--_0x1aec2b){_0x31041b['push'](_0x31041b['shift']());}};_0x12721d(++_0x40e1e6);}(_0x7c09,0x102));var _0x97c0=function(_0x39abc6,_0x252600){_0x39abc6=_0x39abc6-0x0;var _0xc1f8b5=_0x7c09[_0x39abc6];return _0xc1f8b5;};'use strict';var Sequelize=require('sequelize');module[_0x97c0('0x0')]={'name':{'type':Sequelize[_0x97c0('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x97c0('0x1')]},'table':{'type':Sequelize[_0x97c0('0x1')]},'conditions':{'type':Sequelize[_0x97c0('0x2')]},'joins':{'type':Sequelize[_0x97c0('0x2')]}}; \ No newline at end of file +var _0x326f=['STRING','TEXT','sequelize'];(function(_0x2c890a,_0x127db2){var _0x301a13=function(_0x1fae7){while(--_0x1fae7){_0x2c890a['push'](_0x2c890a['shift']());}};_0x301a13(++_0x127db2);}(_0x326f,0xd1));var _0xf326=function(_0x5a8133,_0x485c40){_0x5a8133=_0x5a8133-0x0;var _0x4d8801=_0x326f[_0x5a8133];return _0x4d8801;};'use strict';var Sequelize=require(_0xf326('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xf326('0x1')]},'parent':{'type':Sequelize[_0xf326('0x1')]},'table':{'type':Sequelize[_0xf326('0x1')]},'conditions':{'type':Sequelize[_0xf326('0x2')]},'joins':{'type':Sequelize[_0xf326('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 0faab8f..6fa57fe 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 _0xf494=['name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','includeAll','find','create','body','user','Reports','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','join','left_join','cross_join','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','group','field','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','orderBy','DESC','alias','joins','parse','foreignTable','%s.%s\x20=\x20%s.%s','parentKey','foreignKey','conditions','debug','Limited\x20Query:','sequelize','toString','QueryTypes','right_join','SUM(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','ROUND(%s)','IS\x20NULL','operator','condition','getFields','groupBy','clone','output','fullPath','%s-%s.%s','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','SELECT','run','runReport','IS\x20NOT\x20EMPTY','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','get','DefaultReports','error','stack'];(function(_0x2d2cb9,_0x3909f3){var _0x2b9554=function(_0x37b4e8){while(--_0x37b4e8){_0x2d2cb9['push'](_0x2d2cb9['shift']());}};_0x2b9554(++_0x3909f3);}(_0xf494,0x1c6));var _0x4f49=function(_0x50721d,_0xa700f1){_0x50721d=_0x50721d-0x0;var _0x4d0ec1=_0xf494[_0x50721d];return _0x4d0ec1;};'use strict';var emlformat=require(_0x4f49('0x0'));var rimraf=require(_0x4f49('0x1'));var zipdir=require(_0x4f49('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4f49('0x3'));var moment=require(_0x4f49('0x4'));var BPromise=require(_0x4f49('0x5'));var Mustache=require(_0x4f49('0x6'));var util=require(_0x4f49('0x7'));var path=require(_0x4f49('0x8'));var sox=require(_0x4f49('0x9'));var csv=require(_0x4f49('0xa'));var ejs=require(_0x4f49('0xb'));var fs=require('fs');var fs_extra=require(_0x4f49('0xc'));var _=require(_0x4f49('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4f49('0xe'));var deskjs=require(_0x4f49('0xf'));var toCsv=require(_0x4f49('0xa'));var querystring=require(_0x4f49('0x10'));var Papa=require(_0x4f49('0x11'));var Redis=require(_0x4f49('0x12'));var authService=require(_0x4f49('0x13'));var qs=require(_0x4f49('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4f49('0x15'));var logger=require(_0x4f49('0x16'))('api');var utils=require(_0x4f49('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4f49('0x18'))['db'];var dbH=require(_0x4f49('0x18'))['dbH'];function respondWithStatusCode(_0x1e1c37,_0x111a8b){_0x111a8b=_0x111a8b||0xcc;return function(_0x1b9145){if(_0x1b9145){return _0x1e1c37[_0x4f49('0x19')](_0x111a8b);}return _0x1e1c37[_0x4f49('0x1a')](_0x111a8b)[_0x4f49('0x1b')]();};}function respondWithResult(_0xfdb477,_0x5c373e){_0x5c373e=_0x5c373e||0xc8;return function(_0x515ace){if(_0x515ace){return _0xfdb477[_0x4f49('0x1a')](_0x5c373e)[_0x4f49('0x1c')](_0x515ace);}};}function respondWithFilteredResult(_0x5878f4,_0x5bdfaf){return function(_0x2f0a0d){if(_0x2f0a0d){var _0x2ecaaa=typeof _0x5bdfaf[_0x4f49('0x1d')]==='undefined'&&typeof _0x5bdfaf[_0x4f49('0x1e')]===_0x4f49('0x1f');var _0x4e85df=_0x2f0a0d['count'];var _0x5bb23b=_0x2ecaaa?0x0:_0x5bdfaf['offset'];var _0x47f1e8=_0x2ecaaa?_0x2f0a0d[_0x4f49('0x20')]:_0x5bdfaf[_0x4f49('0x1d')]+_0x5bdfaf[_0x4f49('0x1e')];var _0x407042;if(_0x47f1e8>=_0x4e85df){_0x47f1e8=_0x4e85df;_0x407042=0xc8;}else{_0x407042=0xce;}_0x5878f4['status'](_0x407042);return _0x5878f4[_0x4f49('0x21')](_0x4f49('0x22'),_0x5bb23b+'-'+_0x47f1e8+'/'+_0x4e85df)[_0x4f49('0x1c')](_0x2f0a0d);}return null;};}function patchUpdates(_0xaab5e7){return function(_0xea82f8){try{jsonpatch['apply'](_0xea82f8,_0xaab5e7,!![]);}catch(_0x3e7e28){return BPromise[_0x4f49('0x23')](_0x3e7e28);}return _0xea82f8[_0x4f49('0x24')]();};}function saveUpdates(_0x53b57d,_0x40755e){return function(_0x1d70a7){if(_0x1d70a7){return _0x1d70a7[_0x4f49('0x25')](_0x53b57d)[_0x4f49('0x26')](function(_0x9d30aa){return _0x9d30aa;});}return null;};}function removeEntity(_0x36187b,_0x559d98){return function(_0x4e9041){if(_0x4e9041){return _0x4e9041[_0x4f49('0x27')]()[_0x4f49('0x26')](function(){var _0x4fedbb=_0x4e9041[_0x4f49('0x28')]({'plain':!![]});var _0x2c1519=_0x4f49('0x29');return db['UserProfileResource'][_0x4f49('0x27')]({'where':{'type':_0x2c1519,'resourceId':_0x4fedbb['id']}})[_0x4f49('0x26')](function(){return _0x4e9041;});})[_0x4f49('0x26')](function(){_0x36187b[_0x4f49('0x1a')](0xcc)[_0x4f49('0x1b')]();});}};}function handleEntityNotFound(_0x122404,_0x4915af){return function(_0x50c571){if(!_0x50c571){_0x122404[_0x4f49('0x19')](0x194);}return _0x50c571;};}function handleError(_0x2c00ee,_0x605c91){_0x605c91=_0x605c91||0x1f4;return function(_0x560050){logger[_0x4f49('0x2a')](_0x560050[_0x4f49('0x2b')]);if(_0x560050[_0x4f49('0x2c')]){delete _0x560050['name'];}_0x2c00ee['status'](_0x605c91)[_0x4f49('0x2d')](_0x560050);};}exports[_0x4f49('0x2e')]=function(_0x7a6ea0,_0x5e7076){var _0x1eaac6={},_0x35aa33={},_0x173657={'count':0x0,'rows':[]};var _0x2ceda4=_[_0x4f49('0x2f')](db[_0x4f49('0x30')][_0x4f49('0x31')],function(_0x45ae19){return{'name':_0x45ae19[_0x4f49('0x32')],'type':_0x45ae19[_0x4f49('0x33')][_0x4f49('0x34')]};});_0x35aa33[_0x4f49('0x35')]=_[_0x4f49('0x2f')](_0x2ceda4,_0x4f49('0x2c'));_0x35aa33[_0x4f49('0x36')]=_[_0x4f49('0x37')](_0x7a6ea0[_0x4f49('0x36')]);_0x35aa33[_0x4f49('0x38')]=_[_0x4f49('0x39')](_0x35aa33['model'],_0x35aa33[_0x4f49('0x36')]);_0x1eaac6[_0x4f49('0x3a')]=_[_0x4f49('0x39')](_0x35aa33[_0x4f49('0x35')],qs[_0x4f49('0x3b')](_0x7a6ea0[_0x4f49('0x36')][_0x4f49('0x3b')]));_0x1eaac6[_0x4f49('0x3a')]=_0x1eaac6[_0x4f49('0x3a')][_0x4f49('0x3c')]?_0x1eaac6[_0x4f49('0x3a')]:_0x35aa33[_0x4f49('0x35')];if(!_0x7a6ea0[_0x4f49('0x36')]['hasOwnProperty'](_0x4f49('0x3d'))){_0x1eaac6[_0x4f49('0x1e')]=qs[_0x4f49('0x1e')](_0x7a6ea0[_0x4f49('0x36')][_0x4f49('0x1e')]);_0x1eaac6[_0x4f49('0x1d')]=qs[_0x4f49('0x1d')](_0x7a6ea0[_0x4f49('0x36')][_0x4f49('0x1d')]);}_0x1eaac6[_0x4f49('0x3e')]=qs[_0x4f49('0x3f')](_0x7a6ea0[_0x4f49('0x36')][_0x4f49('0x3f')]);_0x1eaac6[_0x4f49('0x40')]=qs['filters'](_[_0x4f49('0x41')](_0x7a6ea0[_0x4f49('0x36')],_0x35aa33['filters']),_0x2ceda4);if(_0x7a6ea0[_0x4f49('0x36')][_0x4f49('0x42')]){_0x1eaac6['where']=_[_0x4f49('0x43')](_0x1eaac6[_0x4f49('0x40')],{'$or':_[_0x4f49('0x2f')](_0x2ceda4,function(_0x200b1d){if(_0x200b1d[_0x4f49('0x33')]!==_0x4f49('0x44')){var _0x29e910={};_0x29e910[_0x200b1d['name']]={'$like':'%'+_0x7a6ea0['query']['filter']+'%'};return _0x29e910;}})});}_0x1eaac6=_[_0x4f49('0x43')]({},_0x1eaac6,_0x7a6ea0[_0x4f49('0x45')]);var _0x2e4355={'where':_0x1eaac6[_0x4f49('0x40')]};return db[_0x4f49('0x30')][_0x4f49('0x20')](_0x2e4355)[_0x4f49('0x26')](function(_0x23720a){_0x173657[_0x4f49('0x20')]=_0x23720a;if(_0x7a6ea0['query']['includeAll']){_0x1eaac6[_0x4f49('0x46')]=[{'all':!![]}];}return db[_0x4f49('0x30')][_0x4f49('0x47')](_0x1eaac6);})['then'](function(_0x2d6b56){_0x173657['rows']=_0x2d6b56;return _0x173657;})['then'](respondWithFilteredResult(_0x5e7076,_0x1eaac6))[_0x4f49('0x48')](handleError(_0x5e7076,null));};exports[_0x4f49('0x49')]=function(_0x40eadc,_0x497cb8){var _0x287781={'raw':!![],'where':{'id':_0x40eadc['params']['id']}},_0x11b4df={};_0x11b4df[_0x4f49('0x35')]=_['keys'](db[_0x4f49('0x30')][_0x4f49('0x31')]);_0x11b4df[_0x4f49('0x36')]=_['keys'](_0x40eadc[_0x4f49('0x36')]);_0x11b4df[_0x4f49('0x38')]=_[_0x4f49('0x39')](_0x11b4df[_0x4f49('0x35')],_0x11b4df[_0x4f49('0x36')]);_0x287781[_0x4f49('0x3a')]=_[_0x4f49('0x39')](_0x11b4df[_0x4f49('0x35')],qs[_0x4f49('0x3b')](_0x40eadc[_0x4f49('0x36')]['fields']));_0x287781[_0x4f49('0x3a')]=_0x287781[_0x4f49('0x3a')]['length']?_0x287781[_0x4f49('0x3a')]:_0x11b4df['model'];if(_0x40eadc[_0x4f49('0x36')][_0x4f49('0x4a')]){_0x287781[_0x4f49('0x46')]=[{'all':!![]}];}_0x287781=_[_0x4f49('0x43')]({},_0x287781,_0x40eadc['options']);return db[_0x4f49('0x30')][_0x4f49('0x4b')](_0x287781)[_0x4f49('0x26')](handleEntityNotFound(_0x497cb8,null))[_0x4f49('0x26')](respondWithResult(_0x497cb8,null))[_0x4f49('0x48')](handleError(_0x497cb8,null));};exports[_0x4f49('0x4c')]=function(_0x37fdb7,_0xd282c){return db[_0x4f49('0x30')][_0x4f49('0x4c')](_0x37fdb7[_0x4f49('0x4d')],{})[_0x4f49('0x26')](function(_0x148031){var _0x2104d0=_0x37fdb7[_0x4f49('0x4e')][_0x4f49('0x28')]({'plain':!![]});if(!_0x2104d0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2104d0['role']===_0x4f49('0x4e')){var _0x197670=_0x148031[_0x4f49('0x28')]({'plain':!![]});var _0xe46c90=_0x4f49('0x4f');return db[_0x4f49('0x50')][_0x4f49('0x4b')]({'where':{'name':_0xe46c90,'userProfileId':_0x2104d0['userProfileId']},'raw':!![]})[_0x4f49('0x26')](function(_0x4ff0a2){if(_0x4ff0a2&&_0x4ff0a2[_0x4f49('0x51')]===0x0){return db[_0x4f49('0x52')][_0x4f49('0x4c')]({'name':_0x197670[_0x4f49('0x2c')],'resourceId':_0x197670['id'],'type':'DefaultReports','sectionId':_0x4ff0a2['id']},{})[_0x4f49('0x26')](function(){return _0x148031;});}else{return _0x148031;}})['catch'](function(_0x52d18c){logger[_0x4f49('0x2a')](_0x4f49('0x53'),_0x52d18c);throw _0x52d18c;});}return _0x148031;})[_0x4f49('0x26')](respondWithResult(_0xd282c,0xc9))[_0x4f49('0x48')](handleError(_0xd282c,null));};exports['update']=function(_0x599c51,_0xd7f47b){if(_0x599c51[_0x4f49('0x4d')]['id']){delete _0x599c51['body']['id'];}return db[_0x4f49('0x30')]['find']({'where':{'id':_0x599c51['params']['id']}})[_0x4f49('0x26')](handleEntityNotFound(_0xd7f47b,null))['then'](saveUpdates(_0x599c51[_0x4f49('0x4d')],null))['then'](respondWithResult(_0xd7f47b,null))[_0x4f49('0x48')](handleError(_0xd7f47b,null));};exports[_0x4f49('0x27')]=function(_0x2472c9,_0x883408){return db[_0x4f49('0x30')][_0x4f49('0x4b')]({'where':{'id':_0x2472c9[_0x4f49('0x54')]['id']}})[_0x4f49('0x26')](handleEntityNotFound(_0x883408,null))['then'](removeEntity(_0x883408,null))[_0x4f49('0x48')](handleError(_0x883408,null));};exports['preview']=function(_0x213608,_0x1f640d){var _0xc4fc6b=0xa;var _0x467f12=[_0x4f49('0x55'),_0x4f49('0x56'),'right_join',_0x4f49('0x57')];var _0xd3689c={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4f49('0x58'),'MAX':_0x4f49('0x59'),'MIN':_0x4f49('0x5a'),'AVG':_0x4f49('0x5b'),'GROUP_CONCAT':_0x4f49('0x5c'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x4f49('0x5d')};var _0x564bf5={'SEC_TO_TIME':_0x4f49('0x5e'),'DATE':_0x4f49('0x5f'),'HOUR':_0x4f49('0x60'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x4f49('0x61')};var _0x21807e=function(_0x265988){return!_[_0x4f49('0x62')](['IS\x20NULL',_0x4f49('0x63'),_0x4f49('0x64'),'IS\x20NOT\x20EMPTY'],_0x265988);};var _0x293839=function(_0x17b15){if(!_0x17b15||!_0x17b15[_0x4f49('0x65')][_0x4f49('0x3c')]){return'';}for(var _0x28ea73='(',_0x1b80f2=0x0;_0x1b80f2<_0x17b15[_0x4f49('0x65')][_0x4f49('0x3c')];_0x1b80f2+=0x1){_0x1b80f2>0x0&&(_0x28ea73+='\x20'+_0x17b15['operator']+'\x20');_0x28ea73+=_0x17b15[_0x4f49('0x65')][_0x1b80f2][_0x4f49('0x66')]?_0x293839(_0x17b15[_0x4f49('0x65')][_0x1b80f2][_0x4f49('0x66')]):_0x17b15[_0x4f49('0x65')][_0x1b80f2][_0x4f49('0x67')]+'\x20'+_0x17b15[_0x4f49('0x65')][_0x1b80f2]['condition']+(_0x21807e(_0x17b15[_0x4f49('0x65')][_0x1b80f2]['condition'])?'\x20'+_0x17b15[_0x4f49('0x65')][_0x1b80f2][_0x4f49('0x68')]:'');}return _0x28ea73+')';};var _0x4714c7={'where':{'id':_0x213608[_0x4f49('0x54')]['id']}},_0xf29378,_0xc7743e,_0x3f2f3f,_0x61a565,_0x297698;_0x4714c7=_[_0x4f49('0x43')]({},_0x4714c7,_0x213608['options']);return db[_0x4f49('0x30')][_0x4f49('0x4b')](_0x4714c7)[_0x4f49('0x26')](function(_0x2cdaa4){if(_0x2cdaa4){_0xf29378=_0x2cdaa4;return _0x2cdaa4['getFields']();}return null;})['then'](function(_0x28e8ae){if(_0x28e8ae){if(!_0x28e8ae['length']){throw new db[(_0x4f49('0x69'))][(_0x4f49('0x6a'))](_0x4f49('0x6b'),0x193);}_0xc7743e=_0x28e8ae;return db[_0x4f49('0x6c')][_0x4f49('0x47')]({'raw':!![]});}return null;})[_0x4f49('0x26')](function(_0x179431){if(_0x179431){_0x3f2f3f=_[_0x4f49('0x6d')](_0x179431,'id');var _0x3823f0;var _0x3e9b47=squel[_0x4f49('0x6e')]();_0x3e9b47[_0x4f49('0x6f')](_0xf29378[_0x4f49('0x70')]);for(var _0xd53de8=0x0;_0xd53de8<_0xc7743e[_0x4f49('0x3c')];_0xd53de8+=0x1){_0x3823f0=_0xc7743e[_0xd53de8][_0x4f49('0x71')]?_0x3f2f3f[_0xc7743e[_0xd53de8][_0x4f49('0x71')]][_0x4f49('0x72')]:_0xc7743e[_0xd53de8][_0x4f49('0x67')];_0x3823f0=_0xc7743e[_0xd53de8][_0x4f49('0x73')]?_[_0x4f49('0x74')](_0xd3689c[_0xc7743e[_0xd53de8][_0x4f49('0x73')]],'%s',_0x3823f0):_0x3823f0;_0x3823f0=_0xc7743e[_0xd53de8][_0x4f49('0x75')]?_[_0x4f49('0x74')](_0x564bf5[_0xc7743e[_0xd53de8][_0x4f49('0x75')]],'%s',_0x3823f0):_0x3823f0;if(_0xc7743e[_0xd53de8]['groupBy']){_0x3e9b47[_0x4f49('0x66')](_0x3823f0);}_0xc7743e[_0xd53de8]['orderBy']&&_0x3e9b47[_0x4f49('0x3e')](_0x3823f0,_0xc7743e[_0xd53de8][_0x4f49('0x76')]===_0x4f49('0x77')?![]:!![]);_0x3e9b47[_0x4f49('0x67')](_0x3823f0,_0xc7743e[_0xd53de8][_0x4f49('0x78')]||_0x3823f0);}if(_0xf29378[_0x4f49('0x79')]){_0xf29378[_0x4f49('0x79')]=JSON[_0x4f49('0x7a')](_0xf29378[_0x4f49('0x79')]);for(var _0x541ac6=0x0;_0x541ac6<_0xf29378['joins'][_0x4f49('0x3c')];_0x541ac6+=0x1){if(_0xf29378['joins'][_0x541ac6][_0x4f49('0x33')]&&_[_0x4f49('0x62')](_0x467f12,_0xf29378[_0x4f49('0x79')][_0x541ac6][_0x4f49('0x33')])&&_0xf29378[_0x4f49('0x79')][_0x541ac6]['parentKey']&&_0xf29378['joins'][_0x541ac6][_0x4f49('0x7b')]&&_0xf29378[_0x4f49('0x79')][_0x541ac6]['foreignKey']){_0x3e9b47[_0xf29378[_0x4f49('0x79')][_0x541ac6][_0x4f49('0x33')]](_0xf29378['joins'][_0x541ac6][_0x4f49('0x7b')],null,util['format'](_0x4f49('0x7c'),_0xf29378[_0x4f49('0x70')],_0xf29378['joins'][_0x541ac6][_0x4f49('0x7d')],_0xf29378[_0x4f49('0x79')][_0x541ac6][_0x4f49('0x7b')],_0xf29378[_0x4f49('0x79')][_0x541ac6][_0x4f49('0x7e')]));}}}if(_0xf29378[_0x4f49('0x7f')]){_0xf29378['conditions']=JSON[_0x4f49('0x7a')](_0xf29378['conditions']);_0x3e9b47[_0x4f49('0x40')](_0x293839(_0xf29378['conditions'][_0x4f49('0x66')]));}_0x297698=_0x3e9b47['clone']();_0x3e9b47[_0x4f49('0x1e')](_0xc4fc6b);_0x3e9b47[_0x4f49('0x1d')](0x0);logger[_0x4f49('0x80')](_0x4f49('0x81'),_0x3e9b47['toString']());return dbH[_0x4f49('0x82')]['query'](_0x3e9b47[_0x4f49('0x83')](),{'type':dbH['sequelize'][_0x4f49('0x84')]['SELECT']});}})['then'](respondWithResult(_0x1f640d,null))[_0x4f49('0x48')](handleError(_0x1f640d,null));};function runReport(_0x20b2be,_0x16cb4d,_0x4c0e7a){var _0x289810=_0x16cb4d[_0x4f49('0x2c')];var _0x5c33c9=0xa;var _0x5d52ae=['join',_0x4f49('0x56'),_0x4f49('0x85'),_0x4f49('0x57')];var _0x87439={'SUM':_0x4f49('0x86'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4f49('0x58'),'MAX':_0x4f49('0x59'),'MIN':_0x4f49('0x5a'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x4f49('0x5c'),'GROUP_CONCAT ASC':_0x4f49('0x87'),'GROUP_CONCAT DESC':_0x4f49('0x5d')};var _0x2902a1={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x4f49('0x5f'),'HOUR':_0x4f49('0x60'),'ROUND':_0x4f49('0x88'),'UNIX_TIMESTAMP':_0x4f49('0x61')};var _0x389679=function(_0x5304c3){return!_[_0x4f49('0x62')]([_0x4f49('0x89'),'IS\x20NOT\x20NULL',_0x4f49('0x64'),'IS\x20NOT\x20EMPTY'],_0x5304c3);};var _0x351a33=function(_0x4d72a0){if(!_0x4d72a0||!_0x4d72a0[_0x4f49('0x65')][_0x4f49('0x3c')]){return'';}for(var _0x2ef19e='(',_0x6ad599=0x0;_0x6ad599<_0x4d72a0[_0x4f49('0x65')]['length'];_0x6ad599+=0x1){_0x6ad599>0x0&&(_0x2ef19e+='\x20'+_0x4d72a0[_0x4f49('0x8a')]+'\x20');_0x2ef19e+=_0x4d72a0[_0x4f49('0x65')][_0x6ad599][_0x4f49('0x66')]?_0x351a33(_0x4d72a0[_0x4f49('0x65')][_0x6ad599]['group']):_0x4d72a0[_0x4f49('0x65')][_0x6ad599]['field']+'\x20'+_0x4d72a0[_0x4f49('0x65')][_0x6ad599]['condition']+(_0x389679(_0x4d72a0[_0x4f49('0x65')][_0x6ad599][_0x4f49('0x8b')])?'\x20'+_0x4d72a0[_0x4f49('0x65')][_0x6ad599][_0x4f49('0x68')]:'');}return _0x2ef19e+')';};var _0x111e90={'where':{'id':_0x20b2be['id']}},_0xd253ed,_0x323a3a,_0xe0adc3,_0x3a26ff,_0x64f0ee;_0x111e90=_['merge']({},_0x111e90,_0x4c0e7a);return db[_0x4f49('0x30')][_0x4f49('0x4b')](_0x111e90)[_0x4f49('0x26')](function(_0x299849){if(_0x299849){_0xd253ed=_0x299849;return _0x299849[_0x4f49('0x8c')]();}return null;})[_0x4f49('0x26')](function(_0x55b28b){if(_0x55b28b){if(!_0x55b28b[_0x4f49('0x3c')]){throw new db[(_0x4f49('0x69'))][(_0x4f49('0x6a'))](_0x4f49('0x6b'),0x193);}_0x323a3a=_0x55b28b;return db['AnalyticMetric'][_0x4f49('0x47')]({'raw':!![]});}return null;})['then'](function(_0x3c4e88){if(_0x3c4e88){_0xe0adc3=_[_0x4f49('0x6d')](_0x3c4e88,'id');var _0x5c5d2;var _0xa880a2=squel['select']();_0xa880a2[_0x4f49('0x6f')](_0xd253ed[_0x4f49('0x70')]);for(var _0x11c0a0=0x0;_0x11c0a0<_0x323a3a[_0x4f49('0x3c')];_0x11c0a0+=0x1){_0x5c5d2=_0x323a3a[_0x11c0a0][_0x4f49('0x71')]?_0xe0adc3[_0x323a3a[_0x11c0a0][_0x4f49('0x71')]][_0x4f49('0x72')]:_0x323a3a[_0x11c0a0][_0x4f49('0x67')];_0x5c5d2=_0x323a3a[_0x11c0a0][_0x4f49('0x73')]?_[_0x4f49('0x74')](_0x87439[_0x323a3a[_0x11c0a0][_0x4f49('0x73')]],'%s',_0x5c5d2):_0x5c5d2;_0x5c5d2=_0x323a3a[_0x11c0a0][_0x4f49('0x75')]?_[_0x4f49('0x74')](_0x2902a1[_0x323a3a[_0x11c0a0][_0x4f49('0x75')]],'%s',_0x5c5d2):_0x5c5d2;if(_0x323a3a[_0x11c0a0][_0x4f49('0x8d')]){_0xa880a2[_0x4f49('0x66')](_0x5c5d2);}_0x323a3a[_0x11c0a0][_0x4f49('0x76')]&&_0xa880a2[_0x4f49('0x3e')](_0x5c5d2,_0x323a3a[_0x11c0a0]['orderBy']===_0x4f49('0x77')?![]:!![]);_0xa880a2[_0x4f49('0x67')](_0x5c5d2,_0x323a3a[_0x11c0a0][_0x4f49('0x78')]||_0x5c5d2);}if(_0xd253ed[_0x4f49('0x79')]){_0xd253ed['joins']=JSON[_0x4f49('0x7a')](_0xd253ed[_0x4f49('0x79')]);for(var _0x594460=0x0;_0x594460<_0xd253ed[_0x4f49('0x79')]['length'];_0x594460+=0x1){if(_0xd253ed[_0x4f49('0x79')][_0x594460][_0x4f49('0x33')]&&_[_0x4f49('0x62')](_0x5d52ae,_0xd253ed[_0x4f49('0x79')][_0x594460][_0x4f49('0x33')])&&_0xd253ed[_0x4f49('0x79')][_0x594460][_0x4f49('0x7d')]&&_0xd253ed[_0x4f49('0x79')][_0x594460][_0x4f49('0x7b')]&&_0xd253ed[_0x4f49('0x79')][_0x594460]['foreignKey']){_0xa880a2[_0xd253ed['joins'][_0x594460][_0x4f49('0x33')]](_0xd253ed['joins'][_0x594460][_0x4f49('0x7b')],null,util[_0x4f49('0x75')]('%s.%s\x20=\x20%s.%s',_0xd253ed['table'],_0xd253ed[_0x4f49('0x79')][_0x594460]['parentKey'],_0xd253ed[_0x4f49('0x79')][_0x594460][_0x4f49('0x7b')],_0xd253ed[_0x4f49('0x79')][_0x594460]['foreignKey']));}}}if(_0xd253ed[_0x4f49('0x7f')]){_0xd253ed['conditions']=JSON[_0x4f49('0x7a')](_0xd253ed[_0x4f49('0x7f')]);_0xa880a2[_0x4f49('0x40')](_0x351a33(_0xd253ed['conditions'][_0x4f49('0x66')]));}_0x64f0ee=_0xa880a2[_0x4f49('0x8e')]();_0xa880a2[_0x4f49('0x1e')](_0x5c33c9);_0xa880a2['offset'](0x0);return;}})['then'](function(){if(_0x16cb4d[_0x4f49('0x8f')]==='web'){return null;}var _0x2bc9df=_[_0x4f49('0x43')](_0x16cb4d,{'name':_0x16cb4d[_0x4f49('0x90')]||_0x16cb4d['name']||_0xd253ed[_0x4f49('0x2c')],'basename':_0x289810,'savename':util['format'](_0x4f49('0x91'),_0x16cb4d[_0x4f49('0x2c')]||_0xd253ed[_0x4f49('0x2c')],require('randomstring')[_0x4f49('0x92')](0x4),_0x16cb4d[_0x4f49('0x8f')]||_0x4f49('0x93')),'reportId':_0xd253ed['id'],'reportType':_0x4f49('0x94')});return db[_0x4f49('0x95')][_0x4f49('0x4c')](_0x2bc9df,{'raw':!![]});})['then'](function(_0x5b6ac7){if(_0xd253ed[_0x4f49('0x70')]===_0x4f49('0x96')){_0x64f0ee[_0x4f49('0x40')](_0xd253ed[_0x4f49('0x70')]+_0x4f49('0x97'),_0x16cb4d[_0x4f49('0x98')],_0x16cb4d[_0x4f49('0x99')]);}else{_0x64f0ee[_0x4f49('0x40')](_0xd253ed[_0x4f49('0x70')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x16cb4d[_0x4f49('0x98')],_0x16cb4d[_0x4f49('0x99')]);}if(_0x5b6ac7){logger[_0x4f49('0x9a')]('Run\x20Query:',_0x64f0ee[_0x4f49('0x83')]());require(_0x4f49('0x9b'))[_0x4f49('0x9c')](path['join'](__dirname,_0x4f49('0x9d'),_0x5b6ac7[_0x4f49('0x8f')]),[_0x5b6ac7['id'],_0x64f0ee[_0x4f49('0x83')](),path['join'](__dirname,_0x4f49('0x9e'),_0x5b6ac7[_0x4f49('0x9f')]),_0x289810]);return _0x5b6ac7;}else{var _0x5efb11=squel['select']();_0x5efb11[_0x4f49('0x6f')]('('+_0x64f0ee[_0x4f49('0x83')]()+')',_0x4f49('0xa0'));_0x5efb11[_0x4f49('0x67')](_0x4f49('0xa1'),_0x4f49('0x20'));_0x64f0ee['limit'](_0x16cb4d['limit']||_0x5c33c9);_0x64f0ee['offset'](_0x16cb4d[_0x4f49('0x1d')]||0x0);return dbH[_0x4f49('0x82')]['query'](_0x5efb11[_0x4f49('0x83')](),{'type':dbH[_0x4f49('0x82')][_0x4f49('0x84')]['SELECT']})['then'](function(_0x3633b5){if(!_0x3633b5['length']){_0x3a26ff=0x0;}else{_0x3a26ff=_0x3633b5[0x0][_0x4f49('0x20')]||0x0;}return dbH[_0x4f49('0x82')][_0x4f49('0x36')](_0x64f0ee[_0x4f49('0x83')](),{'type':dbH[_0x4f49('0x82')]['QueryTypes'][_0x4f49('0xa2')]});})[_0x4f49('0x26')](function(_0x45c938){return{'rows':_0x45c938||[],'count':_0x3a26ff};});}});}exports[_0x4f49('0xa3')]=function(_0x4a4d75,_0x93e85d){return runReport(_0x4a4d75[_0x4f49('0x54')],_0x4a4d75['query'],_0x4a4d75[_0x4f49('0x45')])[_0x4f49('0x26')](respondWithResult(_0x93e85d,null))[_0x4f49('0x48')](handleError(_0x93e85d,null));};exports[_0x4f49('0xa4')]=runReport;exports[_0x4f49('0x36')]=function(_0x40991b,_0x56290f){var _0x4994b6=0xa;var _0x1c7d87=[_0x4f49('0x55'),_0x4f49('0x56'),_0x4f49('0x85'),_0x4f49('0x57')];var _0x5cd00a={'SUM':_0x4f49('0x86'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4f49('0x58'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0x4f49('0x5b'),'GROUP_CONCAT':_0x4f49('0x5c'),'GROUP_CONCAT ASC':_0x4f49('0x87'),'GROUP_CONCAT DESC':_0x4f49('0x5d')};var _0xd876f1={'SEC_TO_TIME':_0x4f49('0x5e'),'DATE':_0x4f49('0x5f'),'HOUR':'HOUR(%s)','ROUND':_0x4f49('0x88'),'UNIX_TIMESTAMP':_0x4f49('0x61')};var _0x1ae2c9=function(_0x566634){return!_[_0x4f49('0x62')]([_0x4f49('0x89'),_0x4f49('0x63'),'IS\x20EMPTY',_0x4f49('0xa5')],_0x566634);};var _0x541dc2=function(_0x4061bf){if(!_0x4061bf||!_0x4061bf[_0x4f49('0x65')][_0x4f49('0x3c')]){return'';}for(var _0x1bc18d='(',_0x5e6103=0x0;_0x5e6103<_0x4061bf[_0x4f49('0x65')][_0x4f49('0x3c')];_0x5e6103+=0x1){_0x5e6103>0x0&&(_0x1bc18d+='\x20'+_0x4061bf[_0x4f49('0x8a')]+'\x20');_0x1bc18d+=_0x4061bf[_0x4f49('0x65')][_0x5e6103][_0x4f49('0x66')]?_0x541dc2(_0x4061bf[_0x4f49('0x65')][_0x5e6103][_0x4f49('0x66')]):_0x4061bf[_0x4f49('0x65')][_0x5e6103]['field']+'\x20'+_0x4061bf['rules'][_0x5e6103][_0x4f49('0x8b')]+(_0x1ae2c9(_0x4061bf[_0x4f49('0x65')][_0x5e6103][_0x4f49('0x8b')])?'\x20'+_0x4061bf[_0x4f49('0x65')][_0x5e6103][_0x4f49('0x68')]:'');}return _0x1bc18d+')';};var _0x29dbab={'where':{'id':_0x40991b[_0x4f49('0x54')]['id']}},_0x5f459b,_0x1d090f,_0x37d2f4,_0x5bcb36,_0x3f04fa;_0x29dbab=_[_0x4f49('0x43')]({},_0x29dbab,_0x40991b['options']);return db['AnalyticDefaultReport'][_0x4f49('0x4b')](_0x29dbab)[_0x4f49('0x26')](function(_0x200848){if(_0x200848){_0x5f459b=_0x200848;return _0x200848['getFields']();}return null;})[_0x4f49('0x26')](function(_0x48f4bc){if(_0x48f4bc){if(!_0x48f4bc[_0x4f49('0x3c')]){throw new db['Sequelize'][(_0x4f49('0x6a'))](_0x4f49('0x6b'),0x193);}_0x1d090f=_0x48f4bc;return db['AnalyticMetric'][_0x4f49('0x47')]({'raw':!![]});}return null;})[_0x4f49('0x26')](function(_0x513bc9){if(_0x513bc9){_0x37d2f4=_[_0x4f49('0x6d')](_0x513bc9,'id');var _0x47567c;var _0x5f1538=squel[_0x4f49('0x6e')]();_0x5f1538[_0x4f49('0x6f')](_0x5f459b[_0x4f49('0x70')]);for(var _0xd91e48=0x0;_0xd91e48<_0x1d090f[_0x4f49('0x3c')];_0xd91e48+=0x1){_0x47567c=_0x1d090f[_0xd91e48][_0x4f49('0x71')]?_0x37d2f4[_0x1d090f[_0xd91e48]['MetricId']][_0x4f49('0x72')]:_0x1d090f[_0xd91e48][_0x4f49('0x67')];_0x47567c=_0x1d090f[_0xd91e48][_0x4f49('0x73')]?_['replace'](_0x5cd00a[_0x1d090f[_0xd91e48][_0x4f49('0x73')]],'%s',_0x47567c):_0x47567c;_0x47567c=_0x1d090f[_0xd91e48][_0x4f49('0x75')]?_[_0x4f49('0x74')](_0xd876f1[_0x1d090f[_0xd91e48][_0x4f49('0x75')]],'%s',_0x47567c):_0x47567c;if(_0x1d090f[_0xd91e48][_0x4f49('0x8d')]){_0x5f1538[_0x4f49('0x66')](_0x47567c);}_0x1d090f[_0xd91e48][_0x4f49('0x76')]&&_0x5f1538['order'](_0x47567c,_0x1d090f[_0xd91e48][_0x4f49('0x76')]==='DESC'?![]:!![]);_0x5f1538['field'](_0x47567c,_0x1d090f[_0xd91e48][_0x4f49('0x78')]||_0x47567c);}if(_0x5f459b['joins']){_0x5f459b[_0x4f49('0x79')]=JSON[_0x4f49('0x7a')](_0x5f459b[_0x4f49('0x79')]);for(var _0x85eb3f=0x0;_0x85eb3f<_0x5f459b[_0x4f49('0x79')][_0x4f49('0x3c')];_0x85eb3f+=0x1){if(_0x5f459b['joins'][_0x85eb3f][_0x4f49('0x33')]&&_[_0x4f49('0x62')](_0x1c7d87,_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x33')])&&_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x7d')]&&_0x5f459b[_0x4f49('0x79')][_0x85eb3f]['foreignTable']&&_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x7e')]){_0x5f1538[_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x33')]](_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x7b')],null,util[_0x4f49('0x75')](_0x4f49('0x7c'),_0x5f459b[_0x4f49('0x70')],_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x7d')],_0x5f459b[_0x4f49('0x79')][_0x85eb3f]['foreignTable'],_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x7e')]));}}}if(_0x5f459b['conditions']){_0x5f459b[_0x4f49('0x7f')]=JSON[_0x4f49('0x7a')](_0x5f459b[_0x4f49('0x7f')]);_0x5f1538[_0x4f49('0x40')](_0x541dc2(_0x5f459b[_0x4f49('0x7f')][_0x4f49('0x66')]));}_0x3f04fa=_0x5f1538['clone']();_0x5f1538['limit'](_0x4994b6);_0x5f1538['offset'](0x0);logger['debug'](_0x4f49('0x81'),_0x5f1538['toString']());return dbH[_0x4f49('0x82')][_0x4f49('0x36')](_0x5f1538[_0x4f49('0x83')](),{'type':dbH[_0x4f49('0x82')][_0x4f49('0x84')][_0x4f49('0xa2')]});}})['then'](function(){return{'sql':_0x3f04fa[_0x4f49('0x83')]()};})['then'](respondWithResult(_0x56290f,null))[_0x4f49('0x48')](handleError(_0x56290f,null));}; \ No newline at end of file +var _0x2675=['AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','VIRTUAL','merge','options','includeAll','include','catch','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','find','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','left_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','select','table','MetricId','metric','field','function','replace','format','groupBy','order','orderBy','DESC','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','parse','clone','toString','sequelize','QueryTypes','right_join','SEC_TO_TIME(%s)','IS\x20EMPTY','Sequelize','keyBy','from','alias','output','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','child_process','fork','../../files/reports','savename','COUNT(*)','SELECT','run','runReport','MIN(%s)','debug','eml-format','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','get','DefaultReports','name','map'];(function(_0x348a50,_0xe211f1){var _0x29beb2=function(_0x1a4036){while(--_0x1a4036){_0x348a50['push'](_0x348a50['shift']());}};_0x29beb2(++_0xe211f1);}(_0x2675,0x75));var _0x5267=function(_0x5853e4,_0x1d5e9a){_0x5853e4=_0x5853e4-0x0;var _0x3228d7=_0x2675[_0x5853e4];return _0x3228d7;};'use strict';var emlformat=require(_0x5267('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5267('0x1'));var moment=require(_0x5267('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x5267('0x3'));var util=require(_0x5267('0x4'));var path=require('path');var sox=require(_0x5267('0x5'));var csv=require(_0x5267('0x6'));var ejs=require(_0x5267('0x7'));var fs=require('fs');var fs_extra=require(_0x5267('0x8'));var _=require(_0x5267('0x9'));var squel=require(_0x5267('0xa'));var crypto=require('crypto');var jsforce=require(_0x5267('0xb'));var deskjs=require(_0x5267('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5267('0xd'));var Papa=require('papaparse');var Redis=require(_0x5267('0xe'));var authService=require(_0x5267('0xf'));var qs=require(_0x5267('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5267('0x11'));var logger=require('../../config/logger')(_0x5267('0x12'));var utils=require('../../config/utils');var config=require(_0x5267('0x13'));var licenseUtil=require(_0x5267('0x14'));var db=require(_0x5267('0x15'))['db'];var dbH=require(_0x5267('0x15'))[_0x5267('0x16')];function respondWithStatusCode(_0x1171b9,_0x20785c){_0x20785c=_0x20785c||0xcc;return function(_0x36dc17){if(_0x36dc17){return _0x1171b9[_0x5267('0x17')](_0x20785c);}return _0x1171b9[_0x5267('0x18')](_0x20785c)[_0x5267('0x19')]();};}function respondWithResult(_0x29349a,_0x3e2bab){_0x3e2bab=_0x3e2bab||0xc8;return function(_0x548040){if(_0x548040){return _0x29349a['status'](_0x3e2bab)[_0x5267('0x1a')](_0x548040);}};}function respondWithFilteredResult(_0x40d897,_0x38a147){return function(_0x3f5344){if(_0x3f5344){var _0x46b2c2=typeof _0x38a147[_0x5267('0x1b')]===_0x5267('0x1c')&&typeof _0x38a147[_0x5267('0x1d')]===_0x5267('0x1c');var _0xb1c97a=_0x3f5344[_0x5267('0x1e')];var _0x1ab03=_0x46b2c2?0x0:_0x38a147['offset'];var _0x18f32e=_0x46b2c2?_0x3f5344[_0x5267('0x1e')]:_0x38a147['offset']+_0x38a147[_0x5267('0x1d')];var _0x56733e;if(_0x18f32e>=_0xb1c97a){_0x18f32e=_0xb1c97a;_0x56733e=0xc8;}else{_0x56733e=0xce;}_0x40d897[_0x5267('0x18')](_0x56733e);return _0x40d897[_0x5267('0x1f')](_0x5267('0x20'),_0x1ab03+'-'+_0x18f32e+'/'+_0xb1c97a)[_0x5267('0x1a')](_0x3f5344);}return null;};}function patchUpdates(_0x5ca9c6){return function(_0x4dd637){try{jsonpatch[_0x5267('0x21')](_0x4dd637,_0x5ca9c6,!![]);}catch(_0x5aebdd){return BPromise[_0x5267('0x22')](_0x5aebdd);}return _0x4dd637[_0x5267('0x23')]();};}function saveUpdates(_0x3b53ac,_0x56dd95){return function(_0x499f19){if(_0x499f19){return _0x499f19['update'](_0x3b53ac)['then'](function(_0x5ea6a6){return _0x5ea6a6;});}return null;};}function removeEntity(_0x26c7f8,_0x399e64){return function(_0x2d761d){if(_0x2d761d){return _0x2d761d[_0x5267('0x24')]()[_0x5267('0x25')](function(){var _0x40d1be=_0x2d761d[_0x5267('0x26')]({'plain':!![]});var _0x220e03=_0x5267('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x220e03,'resourceId':_0x40d1be['id']}})[_0x5267('0x25')](function(){return _0x2d761d;});})[_0x5267('0x25')](function(){_0x26c7f8['status'](0xcc)[_0x5267('0x19')]();});}};}function handleEntityNotFound(_0x52504e,_0x4d7c2a){return function(_0x43e7e7){if(!_0x43e7e7){_0x52504e[_0x5267('0x17')](0x194);}return _0x43e7e7;};}function handleError(_0x1f33b7,_0x2d2ace){_0x2d2ace=_0x2d2ace||0x1f4;return function(_0x33c431){logger['error'](_0x33c431['stack']);if(_0x33c431[_0x5267('0x28')]){delete _0x33c431[_0x5267('0x28')];}_0x1f33b7[_0x5267('0x18')](_0x2d2ace)['send'](_0x33c431);};}exports['index']=function(_0xbe7922,_0x3ef2a8){var _0x1fa725={},_0x5bec7e={},_0x59b091={'count':0x0,'rows':[]};var _0x2249a1=_[_0x5267('0x29')](db[_0x5267('0x2a')][_0x5267('0x2b')],function(_0x5bbb83){return{'name':_0x5bbb83[_0x5267('0x2c')],'type':_0x5bbb83[_0x5267('0x2d')][_0x5267('0x2e')]};});_0x5bec7e[_0x5267('0x2f')]=_[_0x5267('0x29')](_0x2249a1,_0x5267('0x28'));_0x5bec7e[_0x5267('0x30')]=_[_0x5267('0x31')](_0xbe7922['query']);_0x5bec7e['filters']=_[_0x5267('0x32')](_0x5bec7e['model'],_0x5bec7e[_0x5267('0x30')]);_0x1fa725[_0x5267('0x33')]=_[_0x5267('0x32')](_0x5bec7e[_0x5267('0x2f')],qs['fields'](_0xbe7922[_0x5267('0x30')][_0x5267('0x34')]));_0x1fa725[_0x5267('0x33')]=_0x1fa725[_0x5267('0x33')][_0x5267('0x35')]?_0x1fa725[_0x5267('0x33')]:_0x5bec7e[_0x5267('0x2f')];if(!_0xbe7922[_0x5267('0x30')]['hasOwnProperty'](_0x5267('0x36'))){_0x1fa725['limit']=qs[_0x5267('0x1d')](_0xbe7922[_0x5267('0x30')][_0x5267('0x1d')]);_0x1fa725[_0x5267('0x1b')]=qs[_0x5267('0x1b')](_0xbe7922[_0x5267('0x30')][_0x5267('0x1b')]);}_0x1fa725['order']=qs[_0x5267('0x37')](_0xbe7922[_0x5267('0x30')][_0x5267('0x37')]);_0x1fa725[_0x5267('0x38')]=qs[_0x5267('0x39')](_[_0x5267('0x3a')](_0xbe7922[_0x5267('0x30')],_0x5bec7e['filters']),_0x2249a1);if(_0xbe7922[_0x5267('0x30')]['filter']){_0x1fa725[_0x5267('0x38')]=_['merge'](_0x1fa725['where'],{'$or':_['map'](_0x2249a1,function(_0x46bfcc){if(_0x46bfcc['type']!==_0x5267('0x3b')){var _0x146476={};_0x146476[_0x46bfcc[_0x5267('0x28')]]={'$like':'%'+_0xbe7922[_0x5267('0x30')]['filter']+'%'};return _0x146476;}})});}_0x1fa725=_[_0x5267('0x3c')]({},_0x1fa725,_0xbe7922[_0x5267('0x3d')]);var _0x588edf={'where':_0x1fa725['where']};return db[_0x5267('0x2a')]['count'](_0x588edf)[_0x5267('0x25')](function(_0x1cf94a){_0x59b091[_0x5267('0x1e')]=_0x1cf94a;if(_0xbe7922[_0x5267('0x30')][_0x5267('0x3e')]){_0x1fa725[_0x5267('0x3f')]=[{'all':!![]}];}return db[_0x5267('0x2a')]['findAll'](_0x1fa725);})['then'](function(_0x28ea4a){_0x59b091['rows']=_0x28ea4a;return _0x59b091;})[_0x5267('0x25')](respondWithFilteredResult(_0x3ef2a8,_0x1fa725))[_0x5267('0x40')](handleError(_0x3ef2a8,null));};exports['show']=function(_0x1fa925,_0xc764cd){var _0x299a13={'raw':!![],'where':{'id':_0x1fa925[_0x5267('0x41')]['id']}},_0x161fed={};_0x161fed[_0x5267('0x2f')]=_[_0x5267('0x31')](db[_0x5267('0x2a')][_0x5267('0x2b')]);_0x161fed['query']=_[_0x5267('0x31')](_0x1fa925[_0x5267('0x30')]);_0x161fed[_0x5267('0x39')]=_[_0x5267('0x32')](_0x161fed[_0x5267('0x2f')],_0x161fed['query']);_0x299a13[_0x5267('0x33')]=_['intersection'](_0x161fed[_0x5267('0x2f')],qs['fields'](_0x1fa925['query'][_0x5267('0x34')]));_0x299a13['attributes']=_0x299a13[_0x5267('0x33')][_0x5267('0x35')]?_0x299a13[_0x5267('0x33')]:_0x161fed[_0x5267('0x2f')];if(_0x1fa925['query'][_0x5267('0x3e')]){_0x299a13['include']=[{'all':!![]}];}_0x299a13=_['merge']({},_0x299a13,_0x1fa925[_0x5267('0x3d')]);return db[_0x5267('0x2a')]['find'](_0x299a13)['then'](handleEntityNotFound(_0xc764cd,null))[_0x5267('0x25')](respondWithResult(_0xc764cd,null))[_0x5267('0x40')](handleError(_0xc764cd,null));};exports[_0x5267('0x42')]=function(_0x1b5a7e,_0x1c2803){return db[_0x5267('0x2a')][_0x5267('0x42')](_0x1b5a7e[_0x5267('0x43')],{})[_0x5267('0x25')](function(_0x2cfe09){var _0x21b040=_0x1b5a7e[_0x5267('0x44')][_0x5267('0x26')]({'plain':!![]});if(!_0x21b040)throw new Error(_0x5267('0x45'));if(_0x21b040['role']===_0x5267('0x44')){var _0x466d46=_0x2cfe09[_0x5267('0x26')]({'plain':!![]});var _0x4f0148=_0x5267('0x46');return db[_0x5267('0x47')][_0x5267('0x48')]({'where':{'name':_0x4f0148,'userProfileId':_0x21b040[_0x5267('0x49')]},'raw':!![]})[_0x5267('0x25')](function(_0x1457cf){if(_0x1457cf&&_0x1457cf['autoAssociation']===0x0){return db[_0x5267('0x4a')]['create']({'name':_0x466d46[_0x5267('0x28')],'resourceId':_0x466d46['id'],'type':_0x5267('0x27'),'sectionId':_0x1457cf['id']},{})[_0x5267('0x25')](function(){return _0x2cfe09;});}else{return _0x2cfe09;}})[_0x5267('0x40')](function(_0x91b932){logger[_0x5267('0x4b')](_0x5267('0x4c'),_0x91b932);throw _0x91b932;});}return _0x2cfe09;})['then'](respondWithResult(_0x1c2803,0xc9))['catch'](handleError(_0x1c2803,null));};exports[_0x5267('0x4d')]=function(_0x15b5c9,_0x566b6f){if(_0x15b5c9[_0x5267('0x43')]['id']){delete _0x15b5c9['body']['id'];}return db['AnalyticDefaultReport'][_0x5267('0x48')]({'where':{'id':_0x15b5c9[_0x5267('0x41')]['id']}})[_0x5267('0x25')](handleEntityNotFound(_0x566b6f,null))[_0x5267('0x25')](saveUpdates(_0x15b5c9[_0x5267('0x43')],null))[_0x5267('0x25')](respondWithResult(_0x566b6f,null))[_0x5267('0x40')](handleError(_0x566b6f,null));};exports[_0x5267('0x24')]=function(_0xf0b5a9,_0x43d254){return db['AnalyticDefaultReport'][_0x5267('0x48')]({'where':{'id':_0xf0b5a9[_0x5267('0x41')]['id']}})[_0x5267('0x25')](handleEntityNotFound(_0x43d254,null))[_0x5267('0x25')](removeEntity(_0x43d254,null))[_0x5267('0x40')](handleError(_0x43d254,null));};exports[_0x5267('0x4e')]=function(_0x552211,_0x195575){var _0x5ad1ce=0xa;var _0x1522d6=[_0x5267('0x4f'),_0x5267('0x50'),'right_join',_0x5267('0x51')];var _0x161dab={'SUM':_0x5267('0x52'),'COUNT':_0x5267('0x53'),'COUNT DISTINCT':_0x5267('0x54'),'MAX':_0x5267('0x55'),'MIN':'MIN(%s)','AVG':_0x5267('0x56'),'GROUP_CONCAT':_0x5267('0x57'),'GROUP_CONCAT ASC':_0x5267('0x58'),'GROUP_CONCAT DESC':_0x5267('0x59')};var _0x51220c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x5267('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x5267('0x5b'),'UNIX_TIMESTAMP':_0x5267('0x5c')};var _0x4e3771=function(_0x489780){return!_[_0x5267('0x5d')]([_0x5267('0x5e'),_0x5267('0x5f'),'IS\x20EMPTY',_0x5267('0x60')],_0x489780);};var _0xc88193=function(_0x293e61){if(!_0x293e61||!_0x293e61[_0x5267('0x61')]['length']){return'';}for(var _0x5a87b5='(',_0x540ab8=0x0;_0x540ab8<_0x293e61[_0x5267('0x61')][_0x5267('0x35')];_0x540ab8+=0x1){_0x540ab8>0x0&&(_0x5a87b5+='\x20'+_0x293e61[_0x5267('0x62')]+'\x20');_0x5a87b5+=_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x63')]?_0xc88193(_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x63')]):_0x293e61[_0x5267('0x61')][_0x540ab8]['field']+'\x20'+_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x64')]+(_0x4e3771(_0x293e61['rules'][_0x540ab8][_0x5267('0x64')])?'\x20'+_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x65')]:'');}return _0x5a87b5+')';};var _0x1b6dd7={'where':{'id':_0x552211[_0x5267('0x41')]['id']}},_0x19adf5,_0xde1ecd,_0x4915f4,_0x2ca259,_0x726410;_0x1b6dd7=_[_0x5267('0x3c')]({},_0x1b6dd7,_0x552211[_0x5267('0x3d')]);return db[_0x5267('0x2a')]['find'](_0x1b6dd7)[_0x5267('0x25')](function(_0x87465){if(_0x87465){_0x19adf5=_0x87465;return _0x87465[_0x5267('0x66')]();}return null;})[_0x5267('0x25')](function(_0x1a4016){if(_0x1a4016){if(!_0x1a4016[_0x5267('0x35')]){throw new db['Sequelize'][(_0x5267('0x67'))](_0x5267('0x68'),0x193);}_0xde1ecd=_0x1a4016;return db[_0x5267('0x69')][_0x5267('0x6a')]({'raw':!![]});}return null;})['then'](function(_0x516e6e){if(_0x516e6e){_0x4915f4=_['keyBy'](_0x516e6e,'id');var _0x910f97;var _0x5cca85=squel[_0x5267('0x6b')]();_0x5cca85['from'](_0x19adf5[_0x5267('0x6c')]);for(var _0x1150ba=0x0;_0x1150ba<_0xde1ecd[_0x5267('0x35')];_0x1150ba+=0x1){_0x910f97=_0xde1ecd[_0x1150ba][_0x5267('0x6d')]?_0x4915f4[_0xde1ecd[_0x1150ba][_0x5267('0x6d')]][_0x5267('0x6e')]:_0xde1ecd[_0x1150ba][_0x5267('0x6f')];_0x910f97=_0xde1ecd[_0x1150ba][_0x5267('0x70')]?_['replace'](_0x161dab[_0xde1ecd[_0x1150ba]['function']],'%s',_0x910f97):_0x910f97;_0x910f97=_0xde1ecd[_0x1150ba]['format']?_[_0x5267('0x71')](_0x51220c[_0xde1ecd[_0x1150ba][_0x5267('0x72')]],'%s',_0x910f97):_0x910f97;if(_0xde1ecd[_0x1150ba][_0x5267('0x73')]){_0x5cca85[_0x5267('0x63')](_0x910f97);}_0xde1ecd[_0x1150ba]['orderBy']&&_0x5cca85[_0x5267('0x74')](_0x910f97,_0xde1ecd[_0x1150ba][_0x5267('0x75')]===_0x5267('0x76')?![]:!![]);_0x5cca85[_0x5267('0x6f')](_0x910f97,_0xde1ecd[_0x1150ba]['alias']||_0x910f97);}if(_0x19adf5[_0x5267('0x77')]){_0x19adf5[_0x5267('0x77')]=JSON['parse'](_0x19adf5[_0x5267('0x77')]);for(var _0x268805=0x0;_0x268805<_0x19adf5['joins']['length'];_0x268805+=0x1){if(_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x2d')]&&_['includes'](_0x1522d6,_0x19adf5['joins'][_0x268805][_0x5267('0x2d')])&&_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x78')]&&_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x79')]&&_0x19adf5['joins'][_0x268805][_0x5267('0x7a')]){_0x5cca85[_0x19adf5[_0x5267('0x77')][_0x268805]['type']](_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x79')],null,util[_0x5267('0x72')](_0x5267('0x7b'),_0x19adf5[_0x5267('0x6c')],_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x78')],_0x19adf5[_0x5267('0x77')][_0x268805]['foreignTable'],_0x19adf5['joins'][_0x268805][_0x5267('0x7a')]));}}}if(_0x19adf5[_0x5267('0x7c')]){_0x19adf5[_0x5267('0x7c')]=JSON[_0x5267('0x7d')](_0x19adf5['conditions']);_0x5cca85[_0x5267('0x38')](_0xc88193(_0x19adf5['conditions'][_0x5267('0x63')]));}_0x726410=_0x5cca85[_0x5267('0x7e')]();_0x5cca85[_0x5267('0x1d')](_0x5ad1ce);_0x5cca85[_0x5267('0x1b')](0x0);logger['debug']('Limited\x20Query:',_0x5cca85[_0x5267('0x7f')]());return dbH[_0x5267('0x80')][_0x5267('0x30')](_0x5cca85[_0x5267('0x7f')](),{'type':dbH[_0x5267('0x80')][_0x5267('0x81')]['SELECT']});}})[_0x5267('0x25')](respondWithResult(_0x195575,null))['catch'](handleError(_0x195575,null));};function runReport(_0x418a03,_0x5b8026,_0x2c2b95){var _0x20888d=_0x5b8026[_0x5267('0x28')];var _0x87aa90=0xa;var _0x164cc1=[_0x5267('0x4f'),_0x5267('0x50'),_0x5267('0x82'),_0x5267('0x51')];var _0x28e4b6={'SUM':_0x5267('0x52'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x5267('0x54'),'MAX':_0x5267('0x55'),'MIN':'MIN(%s)','AVG':_0x5267('0x56'),'GROUP_CONCAT':_0x5267('0x57'),'GROUP_CONCAT ASC':_0x5267('0x58'),'GROUP_CONCAT DESC':_0x5267('0x59')};var _0xd18795={'SEC_TO_TIME':_0x5267('0x83'),'DATE':_0x5267('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x5267('0x5b'),'UNIX_TIMESTAMP':_0x5267('0x5c')};var _0x2543a4=function(_0x2feea8){return!_[_0x5267('0x5d')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x5267('0x84'),_0x5267('0x60')],_0x2feea8);};var _0x199ff6=function(_0xbf36fb){if(!_0xbf36fb||!_0xbf36fb['rules'][_0x5267('0x35')]){return'';}for(var _0x3cc775='(',_0x2630f2=0x0;_0x2630f2<_0xbf36fb[_0x5267('0x61')][_0x5267('0x35')];_0x2630f2+=0x1){_0x2630f2>0x0&&(_0x3cc775+='\x20'+_0xbf36fb[_0x5267('0x62')]+'\x20');_0x3cc775+=_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x63')]?_0x199ff6(_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x63')]):_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x6f')]+'\x20'+_0xbf36fb[_0x5267('0x61')][_0x2630f2]['condition']+(_0x2543a4(_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x64')])?'\x20'+_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x65')]:'');}return _0x3cc775+')';};var _0x447b5f={'where':{'id':_0x418a03['id']}},_0x25ce90,_0x257c69,_0x160c9c,_0x42694a,_0x11a2f4;_0x447b5f=_[_0x5267('0x3c')]({},_0x447b5f,_0x2c2b95);return db[_0x5267('0x2a')][_0x5267('0x48')](_0x447b5f)[_0x5267('0x25')](function(_0x35c3b7){if(_0x35c3b7){_0x25ce90=_0x35c3b7;return _0x35c3b7[_0x5267('0x66')]();}return null;})[_0x5267('0x25')](function(_0x35a4a3){if(_0x35a4a3){if(!_0x35a4a3[_0x5267('0x35')]){throw new db[(_0x5267('0x85'))][(_0x5267('0x67'))](_0x5267('0x68'),0x193);}_0x257c69=_0x35a4a3;return db[_0x5267('0x69')]['findAll']({'raw':!![]});}return null;})[_0x5267('0x25')](function(_0x318393){if(_0x318393){_0x160c9c=_[_0x5267('0x86')](_0x318393,'id');var _0x405eb4;var _0x38f5b7=squel['select']();_0x38f5b7[_0x5267('0x87')](_0x25ce90[_0x5267('0x6c')]);for(var _0x4c68cd=0x0;_0x4c68cd<_0x257c69['length'];_0x4c68cd+=0x1){_0x405eb4=_0x257c69[_0x4c68cd]['MetricId']?_0x160c9c[_0x257c69[_0x4c68cd][_0x5267('0x6d')]]['metric']:_0x257c69[_0x4c68cd][_0x5267('0x6f')];_0x405eb4=_0x257c69[_0x4c68cd]['function']?_['replace'](_0x28e4b6[_0x257c69[_0x4c68cd][_0x5267('0x70')]],'%s',_0x405eb4):_0x405eb4;_0x405eb4=_0x257c69[_0x4c68cd][_0x5267('0x72')]?_[_0x5267('0x71')](_0xd18795[_0x257c69[_0x4c68cd][_0x5267('0x72')]],'%s',_0x405eb4):_0x405eb4;if(_0x257c69[_0x4c68cd][_0x5267('0x73')]){_0x38f5b7['group'](_0x405eb4);}_0x257c69[_0x4c68cd]['orderBy']&&_0x38f5b7[_0x5267('0x74')](_0x405eb4,_0x257c69[_0x4c68cd][_0x5267('0x75')]===_0x5267('0x76')?![]:!![]);_0x38f5b7[_0x5267('0x6f')](_0x405eb4,_0x257c69[_0x4c68cd][_0x5267('0x88')]||_0x405eb4);}if(_0x25ce90['joins']){_0x25ce90[_0x5267('0x77')]=JSON['parse'](_0x25ce90['joins']);for(var _0x3dfd8d=0x0;_0x3dfd8d<_0x25ce90['joins']['length'];_0x3dfd8d+=0x1){if(_0x25ce90[_0x5267('0x77')][_0x3dfd8d][_0x5267('0x2d')]&&_['includes'](_0x164cc1,_0x25ce90['joins'][_0x3dfd8d]['type'])&&_0x25ce90[_0x5267('0x77')][_0x3dfd8d]['parentKey']&&_0x25ce90[_0x5267('0x77')][_0x3dfd8d]['foreignTable']&&_0x25ce90[_0x5267('0x77')][_0x3dfd8d][_0x5267('0x7a')]){_0x38f5b7[_0x25ce90['joins'][_0x3dfd8d][_0x5267('0x2d')]](_0x25ce90[_0x5267('0x77')][_0x3dfd8d][_0x5267('0x79')],null,util[_0x5267('0x72')](_0x5267('0x7b'),_0x25ce90[_0x5267('0x6c')],_0x25ce90['joins'][_0x3dfd8d]['parentKey'],_0x25ce90[_0x5267('0x77')][_0x3dfd8d]['foreignTable'],_0x25ce90['joins'][_0x3dfd8d][_0x5267('0x7a')]));}}}if(_0x25ce90['conditions']){_0x25ce90[_0x5267('0x7c')]=JSON['parse'](_0x25ce90[_0x5267('0x7c')]);_0x38f5b7['where'](_0x199ff6(_0x25ce90[_0x5267('0x7c')][_0x5267('0x63')]));}_0x11a2f4=_0x38f5b7[_0x5267('0x7e')]();_0x38f5b7[_0x5267('0x1d')](_0x87aa90);_0x38f5b7[_0x5267('0x1b')](0x0);return;}})[_0x5267('0x25')](function(){if(_0x5b8026[_0x5267('0x89')]==='web'){return null;}var _0x4df99f=_[_0x5267('0x3c')](_0x5b8026,{'name':_0x5b8026['fullPath']||_0x5b8026['name']||_0x25ce90['name'],'basename':_0x20888d,'savename':util['format']('%s-%s.%s',_0x5b8026['name']||_0x25ce90[_0x5267('0x28')],require(_0x5267('0x8a'))[_0x5267('0x8b')](0x4),_0x5b8026[_0x5267('0x89')]||_0x5267('0x8c')),'reportId':_0x25ce90['id'],'reportType':_0x5267('0x8d')});return db[_0x5267('0x8e')][_0x5267('0x42')](_0x4df99f,{'raw':!![]});})['then'](function(_0x5df23d){if(_0x25ce90['table']===_0x5267('0x8f')){_0x11a2f4[_0x5267('0x38')](_0x25ce90['table']+_0x5267('0x90'),_0x5b8026[_0x5267('0x91')],_0x5b8026[_0x5267('0x92')]);}else{_0x11a2f4[_0x5267('0x38')](_0x25ce90['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5b8026[_0x5267('0x91')],_0x5b8026[_0x5267('0x92')]);}if(_0x5df23d){logger[_0x5267('0x93')](_0x5267('0x94'),_0x11a2f4[_0x5267('0x7f')]());require(_0x5267('0x95'))[_0x5267('0x96')](path['join'](__dirname,'../../components/export/',_0x5df23d['output']),[_0x5df23d['id'],_0x11a2f4[_0x5267('0x7f')](),path[_0x5267('0x4f')](__dirname,_0x5267('0x97'),_0x5df23d[_0x5267('0x98')]),_0x20888d]);return _0x5df23d;}else{var _0x190ef4=squel[_0x5267('0x6b')]();_0x190ef4['from']('('+_0x11a2f4[_0x5267('0x7f')]()+')','countTable');_0x190ef4[_0x5267('0x6f')](_0x5267('0x99'),_0x5267('0x1e'));_0x11a2f4[_0x5267('0x1d')](_0x5b8026[_0x5267('0x1d')]||_0x87aa90);_0x11a2f4['offset'](_0x5b8026[_0x5267('0x1b')]||0x0);return dbH[_0x5267('0x80')][_0x5267('0x30')](_0x190ef4['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0x5267('0x9a')]})[_0x5267('0x25')](function(_0x1be763){if(!_0x1be763[_0x5267('0x35')]){_0x42694a=0x0;}else{_0x42694a=_0x1be763[0x0]['count']||0x0;}return dbH['sequelize'][_0x5267('0x30')](_0x11a2f4[_0x5267('0x7f')](),{'type':dbH['sequelize'][_0x5267('0x81')][_0x5267('0x9a')]});})['then'](function(_0x5005b3){return{'rows':_0x5005b3||[],'count':_0x42694a};});}});}exports[_0x5267('0x9b')]=function(_0x11a6f4,_0x5a16ee){return runReport(_0x11a6f4[_0x5267('0x41')],_0x11a6f4[_0x5267('0x30')],_0x11a6f4[_0x5267('0x3d')])[_0x5267('0x25')](respondWithResult(_0x5a16ee,null))[_0x5267('0x40')](handleError(_0x5a16ee,null));};exports[_0x5267('0x9c')]=runReport;exports[_0x5267('0x30')]=function(_0x1e9651,_0x66da7a){var _0x54b582=0xa;var _0x4e4724=[_0x5267('0x4f'),'left_join',_0x5267('0x82'),_0x5267('0x51')];var _0x2722f9={'SUM':_0x5267('0x52'),'COUNT':_0x5267('0x53'),'COUNT DISTINCT':_0x5267('0x54'),'MAX':_0x5267('0x55'),'MIN':_0x5267('0x9d'),'AVG':_0x5267('0x56'),'GROUP_CONCAT':_0x5267('0x57'),'GROUP_CONCAT ASC':_0x5267('0x58'),'GROUP_CONCAT DESC':_0x5267('0x59')};var _0x5909b3={'SEC_TO_TIME':_0x5267('0x83'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x5267('0x5b'),'UNIX_TIMESTAMP':_0x5267('0x5c')};var _0x1d7987=function(_0x59efe1){return!_[_0x5267('0x5d')]([_0x5267('0x5e'),_0x5267('0x5f'),_0x5267('0x84'),_0x5267('0x60')],_0x59efe1);};var _0x46c79e=function(_0xcfba51){if(!_0xcfba51||!_0xcfba51[_0x5267('0x61')][_0x5267('0x35')]){return'';}for(var _0x3c5516='(',_0x1e8367=0x0;_0x1e8367<_0xcfba51[_0x5267('0x61')]['length'];_0x1e8367+=0x1){_0x1e8367>0x0&&(_0x3c5516+='\x20'+_0xcfba51[_0x5267('0x62')]+'\x20');_0x3c5516+=_0xcfba51[_0x5267('0x61')][_0x1e8367]['group']?_0x46c79e(_0xcfba51[_0x5267('0x61')][_0x1e8367][_0x5267('0x63')]):_0xcfba51[_0x5267('0x61')][_0x1e8367][_0x5267('0x6f')]+'\x20'+_0xcfba51['rules'][_0x1e8367][_0x5267('0x64')]+(_0x1d7987(_0xcfba51[_0x5267('0x61')][_0x1e8367][_0x5267('0x64')])?'\x20'+_0xcfba51['rules'][_0x1e8367][_0x5267('0x65')]:'');}return _0x3c5516+')';};var _0x19935d={'where':{'id':_0x1e9651[_0x5267('0x41')]['id']}},_0x3102e0,_0x2d215e,_0xc0af94,_0x178080,_0x3485ab;_0x19935d=_[_0x5267('0x3c')]({},_0x19935d,_0x1e9651['options']);return db[_0x5267('0x2a')][_0x5267('0x48')](_0x19935d)['then'](function(_0x17d2d4){if(_0x17d2d4){_0x3102e0=_0x17d2d4;return _0x17d2d4['getFields']();}return null;})[_0x5267('0x25')](function(_0x4c5a26){if(_0x4c5a26){if(!_0x4c5a26[_0x5267('0x35')]){throw new db[(_0x5267('0x85'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2d215e=_0x4c5a26;return db[_0x5267('0x69')][_0x5267('0x6a')]({'raw':!![]});}return null;})[_0x5267('0x25')](function(_0x1a0883){if(_0x1a0883){_0xc0af94=_[_0x5267('0x86')](_0x1a0883,'id');var _0x501da6;var _0x3dcf73=squel['select']();_0x3dcf73['from'](_0x3102e0['table']);for(var _0x1ded05=0x0;_0x1ded05<_0x2d215e[_0x5267('0x35')];_0x1ded05+=0x1){_0x501da6=_0x2d215e[_0x1ded05][_0x5267('0x6d')]?_0xc0af94[_0x2d215e[_0x1ded05][_0x5267('0x6d')]][_0x5267('0x6e')]:_0x2d215e[_0x1ded05][_0x5267('0x6f')];_0x501da6=_0x2d215e[_0x1ded05][_0x5267('0x70')]?_['replace'](_0x2722f9[_0x2d215e[_0x1ded05]['function']],'%s',_0x501da6):_0x501da6;_0x501da6=_0x2d215e[_0x1ded05][_0x5267('0x72')]?_[_0x5267('0x71')](_0x5909b3[_0x2d215e[_0x1ded05][_0x5267('0x72')]],'%s',_0x501da6):_0x501da6;if(_0x2d215e[_0x1ded05][_0x5267('0x73')]){_0x3dcf73[_0x5267('0x63')](_0x501da6);}_0x2d215e[_0x1ded05]['orderBy']&&_0x3dcf73[_0x5267('0x74')](_0x501da6,_0x2d215e[_0x1ded05][_0x5267('0x75')]===_0x5267('0x76')?![]:!![]);_0x3dcf73[_0x5267('0x6f')](_0x501da6,_0x2d215e[_0x1ded05][_0x5267('0x88')]||_0x501da6);}if(_0x3102e0['joins']){_0x3102e0[_0x5267('0x77')]=JSON[_0x5267('0x7d')](_0x3102e0[_0x5267('0x77')]);for(var _0x4bfafd=0x0;_0x4bfafd<_0x3102e0[_0x5267('0x77')]['length'];_0x4bfafd+=0x1){if(_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x2d')]&&_['includes'](_0x4e4724,_0x3102e0[_0x5267('0x77')][_0x4bfafd]['type'])&&_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x78')]&&_0x3102e0['joins'][_0x4bfafd][_0x5267('0x79')]&&_0x3102e0[_0x5267('0x77')][_0x4bfafd]['foreignKey']){_0x3dcf73[_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x2d')]](_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x79')],null,util[_0x5267('0x72')]('%s.%s\x20=\x20%s.%s',_0x3102e0['table'],_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x78')],_0x3102e0['joins'][_0x4bfafd][_0x5267('0x79')],_0x3102e0['joins'][_0x4bfafd][_0x5267('0x7a')]));}}}if(_0x3102e0[_0x5267('0x7c')]){_0x3102e0[_0x5267('0x7c')]=JSON[_0x5267('0x7d')](_0x3102e0[_0x5267('0x7c')]);_0x3dcf73[_0x5267('0x38')](_0x46c79e(_0x3102e0[_0x5267('0x7c')][_0x5267('0x63')]));}_0x3485ab=_0x3dcf73[_0x5267('0x7e')]();_0x3dcf73[_0x5267('0x1d')](_0x54b582);_0x3dcf73[_0x5267('0x1b')](0x0);logger[_0x5267('0x9e')]('Limited\x20Query:',_0x3dcf73[_0x5267('0x7f')]());return dbH[_0x5267('0x80')][_0x5267('0x30')](_0x3dcf73[_0x5267('0x7f')](),{'type':dbH[_0x5267('0x80')][_0x5267('0x81')][_0x5267('0x9a')]});}})[_0x5267('0x25')](function(){return{'sql':_0x3485ab[_0x5267('0x7f')]()};})[_0x5267('0x25')](respondWithResult(_0x66da7a,null))[_0x5267('0x40')](handleError(_0x66da7a,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 0c93865..38c26f0 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 _0xe5d8=['moment','bluebird','request-promise','./analyticDefaultReport.attributes','AnalyticDefaultReport','analytics_default_reports','lodash','../../config/logger'];(function(_0x125502,_0xfa5273){var _0xc87605=function(_0x4f3879){while(--_0x4f3879){_0x125502['push'](_0x125502['shift']());}};_0xc87605(++_0xfa5273);}(_0xe5d8,0xfe));var _0x8e5d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe5d8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8e5d('0x0'));var util=require('util');var logger=require(_0x8e5d('0x1'))('api');var moment=require(_0x8e5d('0x2'));var BPromise=require(_0x8e5d('0x3'));var rp=require(_0x8e5d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8e5d('0x5'));module['exports']=function(_0x19d705,_0x19ff2a){return _0x19d705['define'](_0x8e5d('0x6'),attributes,{'tableName':_0x8e5d('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe6f3=['request-promise','path','rimraf','../../config/environment','exports','define','analytics_default_reports','lodash','util','../../config/logger','api','moment'];(function(_0xbf3a7b,_0x42ada8){var _0x5ad5f8=function(_0x89ee1){while(--_0x89ee1){_0xbf3a7b['push'](_0xbf3a7b['shift']());}};_0x5ad5f8(++_0x42ada8);}(_0xe6f3,0xeb));var _0x3e6f=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xe6f3[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x3e6f('0x0'));var util=require(_0x3e6f('0x1'));var logger=require(_0x3e6f('0x2'))(_0x3e6f('0x3'));var moment=require(_0x3e6f('0x4'));var BPromise=require('bluebird');var rp=require(_0x3e6f('0x5'));var fs=require('fs');var path=require(_0x3e6f('0x6'));var rimraf=require(_0x3e6f('0x7'));var config=require(_0x3e6f('0x8'));var attributes=require('./analyticDefaultReport.attributes');module[_0x3e6f('0x9')]=function(_0x222085,_0x1b2524){return _0x222085[_0x3e6f('0xa')]('AnalyticDefaultReport',attributes,{'tableName':_0x3e6f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 5eaf85e..ef7e504 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 _0xf977=['http','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1b78d4,_0x5aab9a){var _0x1eaf94=function(_0x4f1577){while(--_0x4f1577){_0x1b78d4['push'](_0x1b78d4['shift']());}};_0x1eaf94(++_0x5aab9a);}(_0xf977,0x6e));var _0x7f97=function(_0x3ebd1d,_0x36374a){_0x3ebd1d=_0x3ebd1d-0x0;var _0x43cde5=_0xf977[_0x3ebd1d];return _0x43cde5;};'use strict';var _=require(_0x7f97('0x0'));var util=require(_0x7f97('0x1'));var moment=require(_0x7f97('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7f97('0x3'));var db=require(_0x7f97('0x4'))['db'];var utils=require(_0x7f97('0x5'));var logger=require(_0x7f97('0x6'))(_0x7f97('0x7'));var config=require(_0x7f97('0x8'));var jayson=require(_0x7f97('0x9'));var client=jayson['client'][_0x7f97('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x412302,_0x294648,_0x1898b4){return new BPromise(function(_0x2a08f4,_0x580ae2){return client['request'](_0x412302,_0x1898b4)[_0x7f97('0xb')](function(_0x467d88){logger[_0x7f97('0xc')](_0x7f97('0xd'),_0x294648,_0x7f97('0xe'));logger[_0x7f97('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x294648,_0x7f97('0xe'),JSON['stringify'](_0x467d88));if(_0x467d88[_0x7f97('0x10')]){if(_0x467d88[_0x7f97('0x10')][_0x7f97('0x11')]===0x1f4){logger[_0x7f97('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x294648,_0x467d88[_0x7f97('0x10')][_0x7f97('0x12')]);return _0x580ae2(_0x467d88[_0x7f97('0x10')][_0x7f97('0x12')]);}logger[_0x7f97('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x294648,_0x467d88['error'][_0x7f97('0x12')]);return _0x2a08f4(_0x467d88[_0x7f97('0x10')][_0x7f97('0x12')]);}else{logger['info'](_0x7f97('0xd'),_0x294648,_0x7f97('0xe'));_0x2a08f4(_0x467d88[_0x7f97('0x13')][_0x7f97('0x12')]);}})['catch'](function(_0x154dd0){logger[_0x7f97('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x294648,_0x154dd0);_0x580ae2(_0x154dd0);});});} \ No newline at end of file +var _0x21e0=['then','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x1ac120,_0x3e7e45){var _0x19b703=function(_0x5f32cb){while(--_0x5f32cb){_0x1ac120['push'](_0x1ac120['shift']());}};_0x19b703(++_0x3e7e45);}(_0x21e0,0xda));var _0x021e=function(_0x305d5d,_0x41cf20){_0x305d5d=_0x305d5d-0x0;var _0x89e1dd=_0x21e0[_0x305d5d];return _0x89e1dd;};'use strict';var _=require(_0x021e('0x0'));var util=require(_0x021e('0x1'));var moment=require(_0x021e('0x2'));var BPromise=require(_0x021e('0x3'));var rs=require(_0x021e('0x4'));var fs=require('fs');var Redis=require(_0x021e('0x5'));var db=require(_0x021e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x021e('0x7'))(_0x021e('0x8'));var config=require(_0x021e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x021e('0xa')][_0x021e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2cfefa,_0x17af04,_0x9bf7f0){return new BPromise(function(_0x149b8b,_0x15e899){return client[_0x021e('0xc')](_0x2cfefa,_0x9bf7f0)[_0x021e('0xd')](function(_0x4a1296){logger['info'](_0x021e('0xe'),_0x17af04,_0x021e('0xf'));logger['debug']('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x17af04,'request\x20sent',JSON[_0x021e('0x10')](_0x4a1296));if(_0x4a1296[_0x021e('0x11')]){if(_0x4a1296[_0x021e('0x11')][_0x021e('0x12')]===0x1f4){logger[_0x021e('0x11')](_0x021e('0xe'),_0x17af04,_0x4a1296[_0x021e('0x11')][_0x021e('0x13')]);return _0x15e899(_0x4a1296[_0x021e('0x11')][_0x021e('0x13')]);}logger[_0x021e('0x11')](_0x021e('0xe'),_0x17af04,_0x4a1296['error']['message']);return _0x149b8b(_0x4a1296[_0x021e('0x11')][_0x021e('0x13')]);}else{logger['info']('AnalyticDefaultReport,\x20%s,\x20%s',_0x17af04,_0x021e('0xf'));_0x149b8b(_0x4a1296[_0x021e('0x14')]['message']);}})['catch'](function(_0x1d8e87){logger[_0x021e('0x11')](_0x021e('0xe'),_0x17af04,_0x1d8e87);_0x15e899(_0x1d8e87);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 2dd9b6f..8c8a28e 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 _0x1b8e=['run','/:id/query','query','create','put','update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/interaction/service','./analyticDefaultReport.controller','get','index','/:id','isAuthenticated','show','/:id/preview','preview'];(function(_0x4ac424,_0x554b5d){var _0xe1b890=function(_0x5e85c4){while(--_0x5e85c4){_0x4ac424['push'](_0x4ac424['shift']());}};_0xe1b890(++_0x554b5d);}(_0x1b8e,0x14b));var _0xe1b8=function(_0x2a9432,_0x42f7a8){_0x2a9432=_0x2a9432-0x0;var _0xed5d00=_0x1b8e[_0x2a9432];return _0xed5d00;};'use strict';var multer=require(_0xe1b8('0x0'));var util=require(_0xe1b8('0x1'));var path=require(_0xe1b8('0x2'));var timeout=require('connect-timeout');var express=require(_0xe1b8('0x3'));var router=express['Router']();var fs_extra=require(_0xe1b8('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe1b8('0x5'));var config=require('../../config/environment');var controller=require(_0xe1b8('0x6'));router[_0xe1b8('0x7')]('/',auth['isAuthenticated'](),controller[_0xe1b8('0x8')]);router[_0xe1b8('0x7')](_0xe1b8('0x9'),auth[_0xe1b8('0xa')](),controller[_0xe1b8('0xb')]);router[_0xe1b8('0x7')](_0xe1b8('0xc'),auth[_0xe1b8('0xa')](),controller[_0xe1b8('0xd')]);router[_0xe1b8('0x7')]('/:id/run',auth[_0xe1b8('0xa')](),controller[_0xe1b8('0xe')]);router['get'](_0xe1b8('0xf'),auth['isAuthenticated'](),controller[_0xe1b8('0x10')]);router['post']('/',auth[_0xe1b8('0xa')](),controller[_0xe1b8('0x11')]);router[_0xe1b8('0x12')](_0xe1b8('0x9'),auth[_0xe1b8('0xa')](),controller[_0xe1b8('0x13')]);router[_0xe1b8('0x14')]('/:id',auth[_0xe1b8('0xa')](),controller[_0xe1b8('0x15')]);module[_0xe1b8('0x16')]=router; \ No newline at end of file +var _0xcf53=['show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','put','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id'];(function(_0x323df1,_0x5b31f4){var _0x312757=function(_0x3bcc55){while(--_0x3bcc55){_0x323df1['push'](_0x323df1['shift']());}};_0x312757(++_0x5b31f4);}(_0xcf53,0x15a));var _0x3cf5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xcf53[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x3cf5('0x0'));var util=require(_0x3cf5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3cf5('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x3cf5('0x3'));var interaction=require(_0x3cf5('0x4'));var config=require(_0x3cf5('0x5'));var controller=require(_0x3cf5('0x6'));router[_0x3cf5('0x7')]('/',auth[_0x3cf5('0x8')](),controller[_0x3cf5('0x9')]);router[_0x3cf5('0x7')](_0x3cf5('0xa'),auth[_0x3cf5('0x8')](),controller[_0x3cf5('0xb')]);router[_0x3cf5('0x7')](_0x3cf5('0xc'),auth['isAuthenticated'](),controller[_0x3cf5('0xd')]);router[_0x3cf5('0x7')](_0x3cf5('0xe'),auth[_0x3cf5('0x8')](),controller[_0x3cf5('0xf')]);router[_0x3cf5('0x7')](_0x3cf5('0x10'),auth[_0x3cf5('0x8')](),controller[_0x3cf5('0x11')]);router[_0x3cf5('0x12')]('/',auth[_0x3cf5('0x8')](),controller[_0x3cf5('0x13')]);router[_0x3cf5('0x14')](_0x3cf5('0xa'),auth[_0x3cf5('0x8')](),controller['update']);router['delete'](_0x3cf5('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 4e895c5..d1e47b7 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 _0x50a2=['Loading','manual','scheduled','UNSIGNED','sequelize','moment','STRING','ENUM','pdf','xlsx','csv','DATE'];(function(_0x12e33b,_0x1dad53){var _0x157be8=function(_0x5af73d){while(--_0x5af73d){_0x12e33b['push'](_0x12e33b['shift']());}};_0x157be8(++_0x1dad53);}(_0x50a2,0x1f0));var _0x250a=function(_0x330805,_0x3345f2){_0x330805=_0x330805-0x0;var _0x2be51e=_0x50a2[_0x330805];return _0x2be51e;};'use strict';var Sequelize=require(_0x250a('0x0'));var moment=require(_0x250a('0x1'));module['exports']={'name':{'type':Sequelize[_0x250a('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x250a('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x250a('0x3')]('csv',_0x250a('0x4'),_0x250a('0x5')),'allowNull':![],'defaultValue':_0x250a('0x6')},'savename':{'type':Sequelize[_0x250a('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x250a('0x7')]},'endDate':{'type':Sequelize[_0x250a('0x7')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0x250a('0x8')},'type':{'type':Sequelize[_0x250a('0x3')](_0x250a('0x9'),_0x250a('0xa')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x250a('0xb')]},'reportType':{'type':Sequelize[_0x250a('0x2')]}}; \ No newline at end of file +var _0x1e34=['DATE','Loading','manual','scheduled','INTEGER','sequelize','exports','STRING','ENUM','csv','pdf','xlsx'];(function(_0x242b15,_0x546fe1){var _0x40443a=function(_0x4ed34f){while(--_0x4ed34f){_0x242b15['push'](_0x242b15['shift']());}};_0x40443a(++_0x546fe1);}(_0x1e34,0x1d9));var _0x41e3=function(_0x456432,_0x2979c3){_0x456432=_0x456432-0x0;var _0x47706f=_0x1e34[_0x456432];return _0x47706f;};'use strict';var Sequelize=require(_0x41e3('0x0'));var moment=require('moment');module[_0x41e3('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x41e3('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x41e3('0x3')](_0x41e3('0x4'),_0x41e3('0x5'),_0x41e3('0x6')),'allowNull':![],'defaultValue':_0x41e3('0x4')},'savename':{'type':Sequelize[_0x41e3('0x2')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x41e3('0x7')]},'status':{'type':Sequelize[_0x41e3('0x2')],'defaultValue':_0x41e3('0x8')},'type':{'type':Sequelize[_0x41e3('0x3')](_0x41e3('0x9'),_0x41e3('0xa')),'allowNull':![],'defaultValue':_0x41e3('0x9')},'reportId':{'type':Sequelize[_0x41e3('0xb')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x41e3('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index a2df1e9..e258c86 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 _0x49e9=['%s.%s','output','toLowerCase','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','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','offset','undefined','count','limit','Content-Range','json','reject','save','update','then','destroy','get','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','key','model','query','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','intersection','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','body','download','basename','savename','join','root','server/files/reports','Sequelize','Report\x20not\x20found\x20or\x20empty'];(function(_0x419c0c,_0x2598ad){var _0x391694=function(_0x530772){while(--_0x530772){_0x419c0c['push'](_0x419c0c['shift']());}};_0x391694(++_0x2598ad);}(_0x49e9,0xc1));var _0x949e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x49e9[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x949e('0x0'));var rp=require(_0x949e('0x1'));var moment=require(_0x949e('0x2'));var BPromise=require(_0x949e('0x3'));var Mustache=require('mustache');var util=require(_0x949e('0x4'));var path=require(_0x949e('0x5'));var sox=require(_0x949e('0x6'));var csv=require(_0x949e('0x7'));var ejs=require(_0x949e('0x8'));var fs=require('fs');var fs_extra=require(_0x949e('0x9'));var _=require(_0x949e('0xa'));var squel=require('squel');var crypto=require(_0x949e('0xb'));var jsforce=require(_0x949e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x949e('0x7'));var querystring=require('querystring');var Papa=require(_0x949e('0xd'));var Redis=require(_0x949e('0xe'));var authService=require(_0x949e('0xf'));var qs=require(_0x949e('0x10'));var as=require(_0x949e('0x11'));var hardwareService=require(_0x949e('0x12'));var logger=require(_0x949e('0x13'))('api');var utils=require(_0x949e('0x14'));var config=require(_0x949e('0x15'));var licenseUtil=require(_0x949e('0x16'));var db=require(_0x949e('0x17'))['db'];function respondWithStatusCode(_0x46212f,_0x8bdc46){_0x8bdc46=_0x8bdc46||0xcc;return function(_0x5eb80c){if(_0x5eb80c){return _0x46212f[_0x949e('0x18')](_0x8bdc46);}return _0x46212f[_0x949e('0x19')](_0x8bdc46)[_0x949e('0x1a')]();};}function respondWithResult(_0x968dfa,_0x55c212){_0x55c212=_0x55c212||0xc8;return function(_0x25a438){if(_0x25a438){return _0x968dfa[_0x949e('0x19')](_0x55c212)['json'](_0x25a438);}};}function respondWithFilteredResult(_0x56aa27,_0x1ba203){return function(_0x4d06c8){if(_0x4d06c8){var _0x35842c=typeof _0x1ba203[_0x949e('0x1b')]===_0x949e('0x1c')&&typeof _0x1ba203['limit']===_0x949e('0x1c');var _0x447b73=_0x4d06c8['count'];var _0x12696b=_0x35842c?0x0:_0x1ba203[_0x949e('0x1b')];var _0xe89613=_0x35842c?_0x4d06c8[_0x949e('0x1d')]:_0x1ba203['offset']+_0x1ba203[_0x949e('0x1e')];var _0x94ca7e;if(_0xe89613>=_0x447b73){_0xe89613=_0x447b73;_0x94ca7e=0xc8;}else{_0x94ca7e=0xce;}_0x56aa27[_0x949e('0x19')](_0x94ca7e);return _0x56aa27['set'](_0x949e('0x1f'),_0x12696b+'-'+_0xe89613+'/'+_0x447b73)[_0x949e('0x20')](_0x4d06c8);}return null;};}function patchUpdates(_0x265a1c){return function(_0x2f55c6){try{jsonpatch['apply'](_0x2f55c6,_0x265a1c,!![]);}catch(_0x4b09a6){return BPromise[_0x949e('0x21')](_0x4b09a6);}return _0x2f55c6[_0x949e('0x22')]();};}function saveUpdates(_0x52baca,_0x4a748f){return function(_0x800617){if(_0x800617){return _0x800617[_0x949e('0x23')](_0x52baca)[_0x949e('0x24')](function(_0x10181a){return _0x10181a;});}return null;};}function removeEntity(_0x5a8073,_0x2ff531){return function(_0x56333d){if(_0x56333d){return _0x56333d[_0x949e('0x25')]()[_0x949e('0x24')](function(){var _0x132a15=_0x56333d[_0x949e('0x26')]({'plain':!![]});var _0x39139a='ExtractedReports';return db['UserProfileResource'][_0x949e('0x25')]({'where':{'type':_0x39139a,'resourceId':_0x132a15['id']}})[_0x949e('0x24')](function(){return _0x56333d;});})['then'](function(){_0x5a8073[_0x949e('0x19')](0xcc)[_0x949e('0x1a')]();});}};}function handleEntityNotFound(_0x363b03,_0x409d2c){return function(_0x232ec4){if(!_0x232ec4){_0x363b03[_0x949e('0x18')](0x194);}return _0x232ec4;};}function handleError(_0x528e1a,_0x20223e){_0x20223e=_0x20223e||0x1f4;return function(_0x450be0){logger[_0x949e('0x27')](_0x450be0[_0x949e('0x28')]);if(_0x450be0[_0x949e('0x29')]){delete _0x450be0[_0x949e('0x29')];}_0x528e1a[_0x949e('0x19')](_0x20223e)[_0x949e('0x2a')](_0x450be0);};}exports[_0x949e('0x2b')]=function(_0x2b290b,_0x402965){var _0x1e6bd7={},_0xe64224={},_0x425710={'count':0x0,'rows':[]};var _0x3efc55=_[_0x949e('0x2c')](db[_0x949e('0x2d')][_0x949e('0x2e')],function(_0x338813){return{'name':_0x338813[_0x949e('0x2f')],'type':_0x338813['type'][_0x949e('0x30')]};});_0xe64224[_0x949e('0x31')]=_[_0x949e('0x2c')](_0x3efc55,_0x949e('0x29'));_0xe64224[_0x949e('0x32')]=_['keys'](_0x2b290b['query']);_0xe64224['filters']=_['intersection'](_0xe64224['model'],_0xe64224[_0x949e('0x32')]);_0x1e6bd7[_0x949e('0x33')]=_['intersection'](_0xe64224[_0x949e('0x31')],qs[_0x949e('0x34')](_0x2b290b['query'][_0x949e('0x34')]));_0x1e6bd7[_0x949e('0x33')]=_0x1e6bd7[_0x949e('0x33')][_0x949e('0x35')]?_0x1e6bd7[_0x949e('0x33')]:_0xe64224[_0x949e('0x31')];if(!_0x2b290b[_0x949e('0x32')]['hasOwnProperty'](_0x949e('0x36'))){_0x1e6bd7[_0x949e('0x1e')]=qs[_0x949e('0x1e')](_0x2b290b['query'][_0x949e('0x1e')]);_0x1e6bd7[_0x949e('0x1b')]=qs[_0x949e('0x1b')](_0x2b290b[_0x949e('0x32')][_0x949e('0x1b')]);}_0x1e6bd7[_0x949e('0x37')]=qs[_0x949e('0x38')](_0x2b290b[_0x949e('0x32')][_0x949e('0x38')]);_0x1e6bd7[_0x949e('0x39')]=qs[_0x949e('0x3a')](_[_0x949e('0x3b')](_0x2b290b[_0x949e('0x32')],_0xe64224[_0x949e('0x3a')]),_0x3efc55);if(_0x2b290b[_0x949e('0x32')][_0x949e('0x3c')]){_0x1e6bd7[_0x949e('0x39')]=_[_0x949e('0x3d')](_0x1e6bd7[_0x949e('0x39')],{'$or':_['map'](_0x3efc55,function(_0x21b71b){if(_0x21b71b[_0x949e('0x3e')]!==_0x949e('0x3f')){var _0x151211={};_0x151211[_0x21b71b[_0x949e('0x29')]]={'$like':'%'+_0x2b290b['query'][_0x949e('0x3c')]+'%'};return _0x151211;}})});}_0x1e6bd7=_['merge']({},_0x1e6bd7,_0x2b290b[_0x949e('0x40')]);var _0x318aaf={'where':_0x1e6bd7[_0x949e('0x39')]};return db[_0x949e('0x2d')][_0x949e('0x1d')](_0x318aaf)[_0x949e('0x24')](function(_0x5296fe){_0x425710[_0x949e('0x1d')]=_0x5296fe;if(_0x2b290b[_0x949e('0x32')][_0x949e('0x41')]){_0x1e6bd7[_0x949e('0x42')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x949e('0x43')](_0x1e6bd7);})[_0x949e('0x24')](function(_0x245ff9){_0x425710[_0x949e('0x44')]=_0x245ff9;return _0x425710;})[_0x949e('0x24')](respondWithFilteredResult(_0x402965,_0x1e6bd7))['catch'](handleError(_0x402965,null));};exports[_0x949e('0x45')]=function(_0x2d1dff,_0x3ec49a){var _0x7ffe80={'raw':!![],'where':{'id':_0x2d1dff[_0x949e('0x46')]['id']}},_0x2e8bba={};_0x2e8bba[_0x949e('0x31')]=_[_0x949e('0x47')](db['AnalyticExtractedReport']['rawAttributes']);_0x2e8bba[_0x949e('0x32')]=_[_0x949e('0x47')](_0x2d1dff[_0x949e('0x32')]);_0x2e8bba[_0x949e('0x3a')]=_['intersection'](_0x2e8bba[_0x949e('0x31')],_0x2e8bba[_0x949e('0x32')]);_0x7ffe80[_0x949e('0x33')]=_[_0x949e('0x48')](_0x2e8bba['model'],qs[_0x949e('0x34')](_0x2d1dff['query'][_0x949e('0x34')]));_0x7ffe80['attributes']=_0x7ffe80[_0x949e('0x33')][_0x949e('0x35')]?_0x7ffe80['attributes']:_0x2e8bba[_0x949e('0x31')];if(_0x2d1dff[_0x949e('0x32')][_0x949e('0x41')]){_0x7ffe80['include']=[{'all':!![]}];}_0x7ffe80=_['merge']({},_0x7ffe80,_0x2d1dff[_0x949e('0x40')]);return db[_0x949e('0x2d')][_0x949e('0x49')](_0x7ffe80)[_0x949e('0x24')](handleEntityNotFound(_0x3ec49a,null))['then'](respondWithResult(_0x3ec49a,null))[_0x949e('0x4a')](handleError(_0x3ec49a,null));};exports[_0x949e('0x4b')]=function(_0x49e5eb,_0x1e655d){return db['AnalyticExtractedReport'][_0x949e('0x4b')](_0x49e5eb['body'],{})[_0x949e('0x24')](function(_0x547eab){var _0x547d1e=_0x49e5eb[_0x949e('0x4c')][_0x949e('0x26')]({'plain':!![]});if(!_0x547d1e)throw new Error(_0x949e('0x4d'));if(_0x547d1e[_0x949e('0x4e')]===_0x949e('0x4c')){var _0x5d0c5b=_0x547eab[_0x949e('0x26')]({'plain':!![]});var _0x368865='ExtractedReports';return db[_0x949e('0x4f')][_0x949e('0x49')]({'where':{'name':_0x368865,'userProfileId':_0x547d1e[_0x949e('0x50')]},'raw':!![]})[_0x949e('0x24')](function(_0x37ead2){if(_0x37ead2&&_0x37ead2[_0x949e('0x51')]===0x0){return db[_0x949e('0x52')][_0x949e('0x4b')]({'name':_0x5d0c5b[_0x949e('0x29')],'resourceId':_0x5d0c5b['id'],'type':_0x37ead2[_0x949e('0x29')],'sectionId':_0x37ead2['id']},{})[_0x949e('0x24')](function(){return _0x547eab;});}else{return _0x547eab;}})['catch'](function(_0x179e04){logger[_0x949e('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x179e04);throw _0x179e04;});}return _0x547eab;})[_0x949e('0x24')](respondWithResult(_0x1e655d,0xc9))[_0x949e('0x4a')](handleError(_0x1e655d,null));};exports[_0x949e('0x23')]=function(_0x2cfa2b,_0xe82b9){if(_0x2cfa2b[_0x949e('0x53')]['id']){delete _0x2cfa2b[_0x949e('0x53')]['id'];}return db[_0x949e('0x2d')][_0x949e('0x49')]({'where':{'id':_0x2cfa2b['params']['id']}})[_0x949e('0x24')](handleEntityNotFound(_0xe82b9,null))['then'](saveUpdates(_0x2cfa2b[_0x949e('0x53')],null))[_0x949e('0x24')](respondWithResult(_0xe82b9,null))[_0x949e('0x4a')](handleError(_0xe82b9,null));};exports['destroy']=function(_0x107c53,_0x1299f1){return db[_0x949e('0x2d')][_0x949e('0x49')]({'where':{'id':_0x107c53[_0x949e('0x46')]['id']}})['then'](handleEntityNotFound(_0x1299f1,null))[_0x949e('0x24')](removeEntity(_0x1299f1,null))['catch'](handleError(_0x1299f1,null));};exports[_0x949e('0x54')]=function(_0x164f04,_0x2e2457,_0x2c162b){return db[_0x949e('0x2d')]['find']({'where':{'id':_0x164f04['params']['id']},'attributes':[_0x949e('0x29'),_0x949e('0x55'),_0x949e('0x56'),'output'],'raw':!![]})['then'](handleEntityNotFound(_0x2e2457,null))[_0x949e('0x24')](function(_0x25dc25){if(_0x25dc25){if(!fs['existsSync'](path[_0x949e('0x57')](config[_0x949e('0x58')],_0x949e('0x59'),_0x25dc25[_0x949e('0x56')]))){throw new db[(_0x949e('0x5a'))]['ValidationError'](_0x949e('0x5b'));}if(_0x164f04[_0x949e('0x32')]['exists']){return _0x2e2457[_0x949e('0x18')](0xc8);}return _0x2e2457[_0x949e('0x54')](path[_0x949e('0x57')](config[_0x949e('0x58')],_0x949e('0x59'),_0x25dc25[_0x949e('0x56')]),util['format'](_0x949e('0x5c'),_0x25dc25[_0x949e('0x55')]||_0x25dc25[_0x949e('0x29')],_0x25dc25[_0x949e('0x5d')][_0x949e('0x5e')]()));}})[_0x949e('0x4a')](handleError(_0x2e2457,null));}; \ No newline at end of file +var _0x1e6c=['savename','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','format','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','get','ExtractedReports','UserProfileResource','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','keys','intersection','query','fields','attributes','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','output','existsSync','join','root','server/files/reports'];(function(_0x4b3512,_0xb29a42){var _0x47d086=function(_0x22710f){while(--_0x22710f){_0x4b3512['push'](_0x4b3512['shift']());}};_0x47d086(++_0xb29a42);}(_0x1e6c,0x137));var _0xc1e6=function(_0x49e584,_0x2886f8){_0x49e584=_0x49e584-0x0;var _0x58b1be=_0x1e6c[_0x49e584];return _0x58b1be;};'use strict';var emlformat=require(_0xc1e6('0x0'));var rimraf=require(_0xc1e6('0x1'));var zipdir=require(_0xc1e6('0x2'));var jsonpatch=require(_0xc1e6('0x3'));var rp=require(_0xc1e6('0x4'));var moment=require(_0xc1e6('0x5'));var BPromise=require(_0xc1e6('0x6'));var Mustache=require(_0xc1e6('0x7'));var util=require(_0xc1e6('0x8'));var path=require('path');var sox=require(_0xc1e6('0x9'));var csv=require(_0xc1e6('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc1e6('0xb'));var _=require(_0xc1e6('0xc'));var squel=require(_0xc1e6('0xd'));var crypto=require('crypto');var jsforce=require(_0xc1e6('0xe'));var deskjs=require(_0xc1e6('0xf'));var toCsv=require(_0xc1e6('0xa'));var querystring=require(_0xc1e6('0x10'));var Papa=require(_0xc1e6('0x11'));var Redis=require(_0xc1e6('0x12'));var authService=require(_0xc1e6('0x13'));var qs=require(_0xc1e6('0x14'));var as=require(_0xc1e6('0x15'));var hardwareService=require(_0xc1e6('0x16'));var logger=require('../../config/logger')(_0xc1e6('0x17'));var utils=require(_0xc1e6('0x18'));var config=require(_0xc1e6('0x19'));var licenseUtil=require(_0xc1e6('0x1a'));var db=require(_0xc1e6('0x1b'))['db'];function respondWithStatusCode(_0x339e7a,_0x14af17){_0x14af17=_0x14af17||0xcc;return function(_0xa37d70){if(_0xa37d70){return _0x339e7a[_0xc1e6('0x1c')](_0x14af17);}return _0x339e7a[_0xc1e6('0x1d')](_0x14af17)[_0xc1e6('0x1e')]();};}function respondWithResult(_0x9ec315,_0x17322f){_0x17322f=_0x17322f||0xc8;return function(_0x40f393){if(_0x40f393){return _0x9ec315['status'](_0x17322f)['json'](_0x40f393);}};}function respondWithFilteredResult(_0x5d5744,_0x502f74){return function(_0x3840aa){if(_0x3840aa){var _0x33b168=typeof _0x502f74[_0xc1e6('0x1f')]===_0xc1e6('0x20')&&typeof _0x502f74[_0xc1e6('0x21')]===_0xc1e6('0x20');var _0x193b50=_0x3840aa[_0xc1e6('0x22')];var _0x52f2a8=_0x33b168?0x0:_0x502f74['offset'];var _0x18c973=_0x33b168?_0x3840aa[_0xc1e6('0x22')]:_0x502f74[_0xc1e6('0x1f')]+_0x502f74[_0xc1e6('0x21')];var _0x2feda8;if(_0x18c973>=_0x193b50){_0x18c973=_0x193b50;_0x2feda8=0xc8;}else{_0x2feda8=0xce;}_0x5d5744['status'](_0x2feda8);return _0x5d5744['set'](_0xc1e6('0x23'),_0x52f2a8+'-'+_0x18c973+'/'+_0x193b50)['json'](_0x3840aa);}return null;};}function patchUpdates(_0x3fe2c1){return function(_0x2c7662){try{jsonpatch[_0xc1e6('0x24')](_0x2c7662,_0x3fe2c1,!![]);}catch(_0x187a9b){return BPromise[_0xc1e6('0x25')](_0x187a9b);}return _0x2c7662[_0xc1e6('0x26')]();};}function saveUpdates(_0x29a4e5,_0x19ddf4){return function(_0x1729ed){if(_0x1729ed){return _0x1729ed['update'](_0x29a4e5)[_0xc1e6('0x27')](function(_0x2f1eee){return _0x2f1eee;});}return null;};}function removeEntity(_0x5c51c2,_0x38a43e){return function(_0x166485){if(_0x166485){return _0x166485[_0xc1e6('0x28')]()[_0xc1e6('0x27')](function(){var _0x36bbe8=_0x166485[_0xc1e6('0x29')]({'plain':!![]});var _0x85c465=_0xc1e6('0x2a');return db[_0xc1e6('0x2b')][_0xc1e6('0x28')]({'where':{'type':_0x85c465,'resourceId':_0x36bbe8['id']}})['then'](function(){return _0x166485;});})['then'](function(){_0x5c51c2[_0xc1e6('0x1d')](0xcc)[_0xc1e6('0x1e')]();});}};}function handleEntityNotFound(_0x219a14,_0x21abdd){return function(_0x3e17b5){if(!_0x3e17b5){_0x219a14[_0xc1e6('0x1c')](0x194);}return _0x3e17b5;};}function handleError(_0x57c979,_0x50d157){_0x50d157=_0x50d157||0x1f4;return function(_0x5ab8f1){logger[_0xc1e6('0x2c')](_0x5ab8f1[_0xc1e6('0x2d')]);if(_0x5ab8f1[_0xc1e6('0x2e')]){delete _0x5ab8f1[_0xc1e6('0x2e')];}_0x57c979['status'](_0x50d157)[_0xc1e6('0x2f')](_0x5ab8f1);};}exports[_0xc1e6('0x30')]=function(_0x12a1f2,_0x2468bb){var _0x3e9597={},_0x8db248={},_0x5cf6f3={'count':0x0,'rows':[]};var _0x25e605=_[_0xc1e6('0x31')](db[_0xc1e6('0x32')][_0xc1e6('0x33')],function(_0x17fb5b){return{'name':_0x17fb5b[_0xc1e6('0x34')],'type':_0x17fb5b[_0xc1e6('0x35')][_0xc1e6('0x36')]};});_0x8db248[_0xc1e6('0x37')]=_[_0xc1e6('0x31')](_0x25e605,_0xc1e6('0x2e'));_0x8db248['query']=_[_0xc1e6('0x38')](_0x12a1f2['query']);_0x8db248['filters']=_[_0xc1e6('0x39')](_0x8db248[_0xc1e6('0x37')],_0x8db248[_0xc1e6('0x3a')]);_0x3e9597['attributes']=_[_0xc1e6('0x39')](_0x8db248[_0xc1e6('0x37')],qs[_0xc1e6('0x3b')](_0x12a1f2[_0xc1e6('0x3a')]['fields']));_0x3e9597[_0xc1e6('0x3c')]=_0x3e9597[_0xc1e6('0x3c')][_0xc1e6('0x3d')]?_0x3e9597[_0xc1e6('0x3c')]:_0x8db248[_0xc1e6('0x37')];if(!_0x12a1f2[_0xc1e6('0x3a')]['hasOwnProperty'](_0xc1e6('0x3e'))){_0x3e9597['limit']=qs[_0xc1e6('0x21')](_0x12a1f2['query']['limit']);_0x3e9597[_0xc1e6('0x1f')]=qs[_0xc1e6('0x1f')](_0x12a1f2[_0xc1e6('0x3a')]['offset']);}_0x3e9597[_0xc1e6('0x3f')]=qs[_0xc1e6('0x40')](_0x12a1f2['query']['sort']);_0x3e9597[_0xc1e6('0x41')]=qs[_0xc1e6('0x42')](_['pick'](_0x12a1f2[_0xc1e6('0x3a')],_0x8db248[_0xc1e6('0x42')]),_0x25e605);if(_0x12a1f2[_0xc1e6('0x3a')][_0xc1e6('0x43')]){_0x3e9597[_0xc1e6('0x41')]=_[_0xc1e6('0x44')](_0x3e9597[_0xc1e6('0x41')],{'$or':_['map'](_0x25e605,function(_0x20075e){if(_0x20075e[_0xc1e6('0x35')]!==_0xc1e6('0x45')){var _0x29b1e0={};_0x29b1e0[_0x20075e['name']]={'$like':'%'+_0x12a1f2[_0xc1e6('0x3a')]['filter']+'%'};return _0x29b1e0;}})});}_0x3e9597=_[_0xc1e6('0x44')]({},_0x3e9597,_0x12a1f2[_0xc1e6('0x46')]);var _0x1b90aa={'where':_0x3e9597['where']};return db[_0xc1e6('0x32')]['count'](_0x1b90aa)['then'](function(_0x50afc4){_0x5cf6f3[_0xc1e6('0x22')]=_0x50afc4;if(_0x12a1f2[_0xc1e6('0x3a')][_0xc1e6('0x47')]){_0x3e9597[_0xc1e6('0x48')]=[{'all':!![]}];}return db[_0xc1e6('0x32')][_0xc1e6('0x49')](_0x3e9597);})[_0xc1e6('0x27')](function(_0x4724dd){_0x5cf6f3[_0xc1e6('0x4a')]=_0x4724dd;return _0x5cf6f3;})[_0xc1e6('0x27')](respondWithFilteredResult(_0x2468bb,_0x3e9597))[_0xc1e6('0x4b')](handleError(_0x2468bb,null));};exports[_0xc1e6('0x4c')]=function(_0x57a538,_0x260c1b){var _0x5ab98f={'raw':!![],'where':{'id':_0x57a538[_0xc1e6('0x4d')]['id']}},_0x4ff6dc={};_0x4ff6dc[_0xc1e6('0x37')]=_[_0xc1e6('0x38')](db[_0xc1e6('0x32')][_0xc1e6('0x33')]);_0x4ff6dc['query']=_[_0xc1e6('0x38')](_0x57a538[_0xc1e6('0x3a')]);_0x4ff6dc['filters']=_[_0xc1e6('0x39')](_0x4ff6dc[_0xc1e6('0x37')],_0x4ff6dc[_0xc1e6('0x3a')]);_0x5ab98f[_0xc1e6('0x3c')]=_['intersection'](_0x4ff6dc[_0xc1e6('0x37')],qs[_0xc1e6('0x3b')](_0x57a538[_0xc1e6('0x3a')]['fields']));_0x5ab98f[_0xc1e6('0x3c')]=_0x5ab98f[_0xc1e6('0x3c')]['length']?_0x5ab98f[_0xc1e6('0x3c')]:_0x4ff6dc[_0xc1e6('0x37')];if(_0x57a538[_0xc1e6('0x3a')][_0xc1e6('0x47')]){_0x5ab98f[_0xc1e6('0x48')]=[{'all':!![]}];}_0x5ab98f=_[_0xc1e6('0x44')]({},_0x5ab98f,_0x57a538[_0xc1e6('0x46')]);return db[_0xc1e6('0x32')][_0xc1e6('0x4e')](_0x5ab98f)[_0xc1e6('0x27')](handleEntityNotFound(_0x260c1b,null))[_0xc1e6('0x27')](respondWithResult(_0x260c1b,null))[_0xc1e6('0x4b')](handleError(_0x260c1b,null));};exports[_0xc1e6('0x4f')]=function(_0x318a4e,_0x59e2bd){return db[_0xc1e6('0x32')][_0xc1e6('0x4f')](_0x318a4e[_0xc1e6('0x50')],{})[_0xc1e6('0x27')](function(_0x58cedc){var _0x734d2c=_0x318a4e[_0xc1e6('0x51')]['get']({'plain':!![]});if(!_0x734d2c)throw new Error(_0xc1e6('0x52'));if(_0x734d2c[_0xc1e6('0x53')]===_0xc1e6('0x51')){var _0x37f496=_0x58cedc[_0xc1e6('0x29')]({'plain':!![]});var _0xbe99a0=_0xc1e6('0x2a');return db['UserProfileSection'][_0xc1e6('0x4e')]({'where':{'name':_0xbe99a0,'userProfileId':_0x734d2c[_0xc1e6('0x54')]},'raw':!![]})[_0xc1e6('0x27')](function(_0x59fadd){if(_0x59fadd&&_0x59fadd['autoAssociation']===0x0){return db[_0xc1e6('0x2b')][_0xc1e6('0x4f')]({'name':_0x37f496[_0xc1e6('0x2e')],'resourceId':_0x37f496['id'],'type':_0x59fadd[_0xc1e6('0x2e')],'sectionId':_0x59fadd['id']},{})['then'](function(){return _0x58cedc;});}else{return _0x58cedc;}})[_0xc1e6('0x4b')](function(_0x490b84){logger['error'](_0xc1e6('0x55'),_0x490b84);throw _0x490b84;});}return _0x58cedc;})['then'](respondWithResult(_0x59e2bd,0xc9))['catch'](handleError(_0x59e2bd,null));};exports['update']=function(_0x2383f0,_0x4ddfe9){if(_0x2383f0['body']['id']){delete _0x2383f0[_0xc1e6('0x50')]['id'];}return db[_0xc1e6('0x32')][_0xc1e6('0x4e')]({'where':{'id':_0x2383f0[_0xc1e6('0x4d')]['id']}})[_0xc1e6('0x27')](handleEntityNotFound(_0x4ddfe9,null))[_0xc1e6('0x27')](saveUpdates(_0x2383f0[_0xc1e6('0x50')],null))[_0xc1e6('0x27')](respondWithResult(_0x4ddfe9,null))[_0xc1e6('0x4b')](handleError(_0x4ddfe9,null));};exports[_0xc1e6('0x28')]=function(_0x51507a,_0x56407f){return db[_0xc1e6('0x32')][_0xc1e6('0x4e')]({'where':{'id':_0x51507a[_0xc1e6('0x4d')]['id']}})[_0xc1e6('0x27')](handleEntityNotFound(_0x56407f,null))[_0xc1e6('0x27')](removeEntity(_0x56407f,null))[_0xc1e6('0x4b')](handleError(_0x56407f,null));};exports[_0xc1e6('0x56')]=function(_0x5d8418,_0x10eee2,_0x267375){return db[_0xc1e6('0x32')][_0xc1e6('0x4e')]({'where':{'id':_0x5d8418[_0xc1e6('0x4d')]['id']},'attributes':[_0xc1e6('0x2e'),_0xc1e6('0x57'),'savename',_0xc1e6('0x58')],'raw':!![]})[_0xc1e6('0x27')](handleEntityNotFound(_0x10eee2,null))['then'](function(_0x2e6566){if(_0x2e6566){if(!fs[_0xc1e6('0x59')](path[_0xc1e6('0x5a')](config[_0xc1e6('0x5b')],_0xc1e6('0x5c'),_0x2e6566[_0xc1e6('0x5d')]))){throw new db[(_0xc1e6('0x5e'))][(_0xc1e6('0x5f'))](_0xc1e6('0x60'));}if(_0x5d8418['query'][_0xc1e6('0x61')]){return _0x10eee2[_0xc1e6('0x1c')](0xc8);}return _0x10eee2[_0xc1e6('0x56')](path['join'](config['root'],_0xc1e6('0x5c'),_0x2e6566[_0xc1e6('0x5d')]),util[_0xc1e6('0x62')](_0xc1e6('0x63'),_0x2e6566[_0xc1e6('0x57')]||_0x2e6566[_0xc1e6('0x2e')],_0x2e6566[_0xc1e6('0x58')][_0xc1e6('0x64')]()));}})['catch'](handleError(_0x10eee2,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index e2339ed..8d7548e 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 _0x781b=['exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','../../config/logger','api','request-promise','rimraf','../../config/environment','./analyticExtractedReport.attributes'];(function(_0xb48479,_0x5993e3){var _0x1ee04e=function(_0x32dbef){while(--_0x32dbef){_0xb48479['push'](_0xb48479['shift']());}};_0x1ee04e(++_0x5993e3);}(_0x781b,0x190));var _0xb781=function(_0x44278,_0x1bd66f){_0x44278=_0x44278-0x0;var _0x2d97f9=_0x781b[_0x44278];return _0x2d97f9;};'use strict';var _=require(_0xb781('0x0'));var util=require('util');var logger=require(_0xb781('0x1'))(_0xb781('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb781('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb781('0x4'));var config=require(_0xb781('0x5'));var attributes=require(_0xb781('0x6'));module[_0xb781('0x7')]=function(_0x4ee0b8,_0x45490a){return _0x4ee0b8[_0xb781('0x8')](_0xb781('0x9'),attributes,{'tableName':_0xb781('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf34b=['moment','bluebird','request-promise','../../config/environment','exports','AnalyticExtractedReport','analytics_extracted_reports','util','../../config/logger','api'];(function(_0x583a1f,_0x4fb9da){var _0x45f430=function(_0xc90da){while(--_0xc90da){_0x583a1f['push'](_0x583a1f['shift']());}};_0x45f430(++_0x4fb9da);}(_0xf34b,0x13d));var _0xbf34=function(_0x33d129,_0x3bc274){_0x33d129=_0x33d129-0x0;var _0x54093f=_0xf34b[_0x33d129];return _0x54093f;};'use strict';var _=require('lodash');var util=require(_0xbf34('0x0'));var logger=require(_0xbf34('0x1'))(_0xbf34('0x2'));var moment=require(_0xbf34('0x3'));var BPromise=require(_0xbf34('0x4'));var rp=require(_0xbf34('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xbf34('0x6'));var attributes=require('./analyticExtractedReport.attributes');module[_0xbf34('0x7')]=function(_0x825092,_0x7a570b){return _0x825092['define'](_0xbf34('0x8'),attributes,{'tableName':_0xbf34('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index a10737e..a6e2891 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 _0xe78b=['request','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x24e57a,_0x35a7b6){var _0x75bd3b=function(_0x2a448c){while(--_0x2a448c){_0x24e57a['push'](_0x24e57a['shift']());}};_0x75bd3b(++_0x35a7b6);}(_0xe78b,0x1c2));var _0xbe78=function(_0x130a77,_0x4aa56e){_0x130a77=_0x130a77-0x0;var _0x1e4ed7=_0xe78b[_0x130a77];return _0x1e4ed7;};'use strict';var _=require(_0xbe78('0x0'));var util=require(_0xbe78('0x1'));var moment=require('moment');var BPromise=require(_0xbe78('0x2'));var rs=require(_0xbe78('0x3'));var fs=require('fs');var Redis=require(_0xbe78('0x4'));var db=require(_0xbe78('0x5'))['db'];var utils=require(_0xbe78('0x6'));var logger=require(_0xbe78('0x7'))(_0xbe78('0x8'));var config=require(_0xbe78('0x9'));var jayson=require(_0xbe78('0xa'));var client=jayson[_0xbe78('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b82a2,_0x26eb67,_0x556406){return new BPromise(function(_0x42436b,_0x940572){return client[_0xbe78('0xc')](_0x5b82a2,_0x556406)['then'](function(_0x2a9d30){logger[_0xbe78('0xd')](_0xbe78('0xe'),_0x26eb67,_0xbe78('0xf'));logger[_0xbe78('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x26eb67,'request\x20sent',JSON['stringify'](_0x2a9d30));if(_0x2a9d30[_0xbe78('0x11')]){if(_0x2a9d30[_0xbe78('0x11')][_0xbe78('0x12')]===0x1f4){logger[_0xbe78('0x11')](_0xbe78('0xe'),_0x26eb67,_0x2a9d30[_0xbe78('0x11')][_0xbe78('0x13')]);return _0x940572(_0x2a9d30[_0xbe78('0x11')][_0xbe78('0x13')]);}logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x26eb67,_0x2a9d30[_0xbe78('0x11')][_0xbe78('0x13')]);return _0x42436b(_0x2a9d30['error'][_0xbe78('0x13')]);}else{logger[_0xbe78('0xd')](_0xbe78('0xe'),_0x26eb67,_0xbe78('0xf'));_0x42436b(_0x2a9d30[_0xbe78('0x14')][_0xbe78('0x13')]);}})['catch'](function(_0x458128){logger[_0xbe78('0x11')](_0xbe78('0xe'),_0x26eb67,_0x458128);_0x940572(_0x458128);});});} \ No newline at end of file +var _0xb230=['then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xb230,0x150));var _0x0b23=function(_0xe74d9b,_0x17a86c){_0xe74d9b=_0xe74d9b-0x0;var _0x57c1cc=_0xb230[_0xe74d9b];return _0x57c1cc;};'use strict';var _=require(_0x0b23('0x0'));var util=require(_0x0b23('0x1'));var moment=require(_0x0b23('0x2'));var BPromise=require(_0x0b23('0x3'));var rs=require(_0x0b23('0x4'));var fs=require('fs');var Redis=require(_0x0b23('0x5'));var db=require(_0x0b23('0x6'))['db'];var utils=require(_0x0b23('0x7'));var logger=require(_0x0b23('0x8'))(_0x0b23('0x9'));var config=require('../../config/environment');var jayson=require(_0x0b23('0xa'));var client=jayson[_0x0b23('0xb')][_0x0b23('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x135dd7,_0x2fd92d,_0x2ad939){return new BPromise(function(_0x3a7f46,_0x53e288){return client[_0x0b23('0xd')](_0x135dd7,_0x2ad939)[_0x0b23('0xe')](function(_0x5f3719){logger[_0x0b23('0xf')](_0x0b23('0x10'),_0x2fd92d,_0x0b23('0x11'));logger[_0x0b23('0x12')](_0x0b23('0x13'),_0x2fd92d,'request\x20sent',JSON[_0x0b23('0x14')](_0x5f3719));if(_0x5f3719[_0x0b23('0x15')]){if(_0x5f3719[_0x0b23('0x15')][_0x0b23('0x16')]===0x1f4){logger[_0x0b23('0x15')](_0x0b23('0x10'),_0x2fd92d,_0x5f3719[_0x0b23('0x15')][_0x0b23('0x17')]);return _0x53e288(_0x5f3719[_0x0b23('0x15')][_0x0b23('0x17')]);}logger[_0x0b23('0x15')](_0x0b23('0x10'),_0x2fd92d,_0x5f3719[_0x0b23('0x15')][_0x0b23('0x17')]);return _0x3a7f46(_0x5f3719[_0x0b23('0x15')][_0x0b23('0x17')]);}else{logger['info'](_0x0b23('0x10'),_0x2fd92d,_0x0b23('0x11'));_0x3a7f46(_0x5f3719[_0x0b23('0x18')][_0x0b23('0x17')]);}})['catch'](function(_0x37dd69){logger['error'](_0x0b23('0x10'),_0x2fd92d,_0x37dd69);_0x53e288(_0x37dd69);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index c8375a5..52aeff9 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 _0x7db8=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/download','download','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x4e9b5f,_0xbfb45b){var _0x23a694=function(_0x26243c){while(--_0x26243c){_0x4e9b5f['push'](_0x4e9b5f['shift']());}};_0x23a694(++_0xbfb45b);}(_0x7db8,0x1dd));var _0x87db=function(_0x571fb3,_0x35fa89){_0x571fb3=_0x571fb3-0x0;var _0x116e32=_0x7db8[_0x571fb3];return _0x116e32;};'use strict';var multer=require(_0x87db('0x0'));var util=require(_0x87db('0x1'));var path=require('path');var timeout=require(_0x87db('0x2'));var express=require(_0x87db('0x3'));var router=express[_0x87db('0x4')]();var fs_extra=require(_0x87db('0x5'));var auth=require(_0x87db('0x6'));var interaction=require(_0x87db('0x7'));var config=require(_0x87db('0x8'));var controller=require('./analyticExtractedReport.controller');router[_0x87db('0x9')]('/',auth[_0x87db('0xa')](),controller[_0x87db('0xb')]);router[_0x87db('0x9')](_0x87db('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x87db('0x9')](_0x87db('0xd'),auth[_0x87db('0xa')](),controller[_0x87db('0xe')]);router[_0x87db('0xf')]('/',auth['isAuthenticated'](),controller[_0x87db('0x10')]);router[_0x87db('0x11')](_0x87db('0xc'),auth['isAuthenticated'](),controller[_0x87db('0x12')]);router[_0x87db('0x13')](_0x87db('0xc'),auth[_0x87db('0xa')](),controller[_0x87db('0x14')]);module[_0x87db('0x15')]=router; \ No newline at end of file +var _0x0715=['Router','../../components/auth/service','../../components/interaction/service','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id/download','download','post','create','/:id','update','destroy','util','connect-timeout','express'];(function(_0xc74a5e,_0x3170aa){var _0x4bc55b=function(_0xecab7b){while(--_0xecab7b){_0xc74a5e['push'](_0xc74a5e['shift']());}};_0x4bc55b(++_0x3170aa);}(_0x0715,0xa7));var _0x5071=function(_0x417af8,_0x368246){_0x417af8=_0x417af8-0x0;var _0x3f8bf8=_0x0715[_0x417af8];return _0x3f8bf8;};'use strict';var multer=require('multer');var util=require(_0x5071('0x0'));var path=require('path');var timeout=require(_0x5071('0x1'));var express=require(_0x5071('0x2'));var router=express[_0x5071('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5071('0x4'));var interaction=require(_0x5071('0x5'));var config=require('../../config/environment');var controller=require(_0x5071('0x6'));router[_0x5071('0x7')]('/',auth[_0x5071('0x8')](),controller[_0x5071('0x9')]);router['get']('/:id',auth[_0x5071('0x8')](),controller['show']);router[_0x5071('0x7')](_0x5071('0xa'),auth[_0x5071('0x8')](),controller[_0x5071('0xb')]);router[_0x5071('0xc')]('/',auth[_0x5071('0x8')](),controller[_0x5071('0xd')]);router['put'](_0x5071('0xe'),auth['isAuthenticated'](),controller[_0x5071('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x5071('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 88f1ba5..c8dc4df 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 _0x3043=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0x2732b6,_0x5c9929){var _0x570328=function(_0x5e52ef){while(--_0x5e52ef){_0x2732b6['push'](_0x2732b6['shift']());}};_0x570328(++_0x5c9929);}(_0x3043,0x1da));var _0x3304=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x3043[_0x2e4aa2];return _0x5e6092;};'use strict';var Sequelize=require(_0x3304('0x0'));module[_0x3304('0x1')]={'field':{'type':Sequelize[_0x3304('0x2')]},'alias':{'type':Sequelize[_0x3304('0x3')]},'function':{'type':Sequelize[_0x3304('0x3')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0x3304('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x3304('0x3')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x753d=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0xf83302,_0x17aa7a){var _0x5abd74=function(_0x2b8f43){while(--_0x2b8f43){_0xf83302['push'](_0xf83302['shift']());}};_0x5abd74(++_0x17aa7a);}(_0x753d,0x1e4));var _0xd753=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x753d[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0xd753('0x0'));module[_0xd753('0x1')]={'field':{'type':Sequelize[_0xd753('0x2')]},'alias':{'type':Sequelize[_0xd753('0x3')]},'function':{'type':Sequelize[_0xd753('0x3')]},'format':{'type':Sequelize[_0xd753('0x3')]},'groupBy':{'type':Sequelize[_0xd753('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xd753('0x3')]},'custom':{'type':Sequelize[_0xd753('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 6fa938b..66319c2 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 _0x2847=['lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','create','body','bulkCreate','find','params','bulkDestroy','addFields','AnalyticCustomReport','findOne','sequelize','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x17ea08,_0x4b83ce){var _0x5c56bf=function(_0x506652){while(--_0x506652){_0x17ea08['push'](_0x17ea08['shift']());}};_0x5c56bf(++_0x4b83ce);}(_0x2847,0x1a0));var _0x7284=function(_0xf2f332,_0x299fbf){_0xf2f332=_0xf2f332-0x0;var _0x56cce3=_0x2847[_0xf2f332];return _0x56cce3;};'use strict';var emlformat=require(_0x7284('0x0'));var rimraf=require(_0x7284('0x1'));var zipdir=require(_0x7284('0x2'));var jsonpatch=require(_0x7284('0x3'));var rp=require(_0x7284('0x4'));var moment=require(_0x7284('0x5'));var BPromise=require(_0x7284('0x6'));var Mustache=require(_0x7284('0x7'));var util=require(_0x7284('0x8'));var path=require(_0x7284('0x9'));var sox=require(_0x7284('0xa'));var csv=require(_0x7284('0xb'));var ejs=require(_0x7284('0xc'));var fs=require('fs');var fs_extra=require(_0x7284('0xd'));var _=require(_0x7284('0xe'));var squel=require('squel');var crypto=require(_0x7284('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x7284('0x10'));var toCsv=require('to-csv');var querystring=require(_0x7284('0x11'));var Papa=require(_0x7284('0x12'));var Redis=require('ioredis');var authService=require(_0x7284('0x13'));var qs=require(_0x7284('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7284('0x15'));var logger=require(_0x7284('0x16'))(_0x7284('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7284('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48caba,_0x362423){_0x362423=_0x362423||0xcc;return function(_0x35d1c2){if(_0x35d1c2){return _0x48caba[_0x7284('0x19')](_0x362423);}return _0x48caba[_0x7284('0x1a')](_0x362423)[_0x7284('0x1b')]();};}function respondWithResult(_0x2dbca4,_0x22ccb0){_0x22ccb0=_0x22ccb0||0xc8;return function(_0x1a6ced){if(_0x1a6ced){return _0x2dbca4['status'](_0x22ccb0)[_0x7284('0x1c')](_0x1a6ced);}};}function respondWithFilteredResult(_0x27c227,_0x2d8cbe){return function(_0x272c5a){if(_0x272c5a){var _0x3fcaca=typeof _0x2d8cbe[_0x7284('0x1d')]===_0x7284('0x1e')&&typeof _0x2d8cbe[_0x7284('0x1f')]==='undefined';var _0x25cce5=_0x272c5a[_0x7284('0x20')];var _0xf10dae=_0x3fcaca?0x0:_0x2d8cbe[_0x7284('0x1d')];var _0x4fbdc2=_0x3fcaca?_0x272c5a['count']:_0x2d8cbe['offset']+_0x2d8cbe[_0x7284('0x1f')];var _0x162548;if(_0x4fbdc2>=_0x25cce5){_0x4fbdc2=_0x25cce5;_0x162548=0xc8;}else{_0x162548=0xce;}_0x27c227[_0x7284('0x1a')](_0x162548);return _0x27c227[_0x7284('0x21')](_0x7284('0x22'),_0xf10dae+'-'+_0x4fbdc2+'/'+_0x25cce5)['json'](_0x272c5a);}return null;};}function patchUpdates(_0x568dac){return function(_0x335dbd){try{jsonpatch[_0x7284('0x23')](_0x335dbd,_0x568dac,!![]);}catch(_0x2538c4){return BPromise[_0x7284('0x24')](_0x2538c4);}return _0x335dbd[_0x7284('0x25')]();};}function saveUpdates(_0x3c42e9,_0x123b25){return function(_0x5cefbf){if(_0x5cefbf){return _0x5cefbf[_0x7284('0x26')](_0x3c42e9)[_0x7284('0x27')](function(_0x28c2a9){return _0x28c2a9;});}return null;};}function removeEntity(_0xeca040,_0x3097e0){return function(_0x3bd8d3){if(_0x3bd8d3){return _0x3bd8d3[_0x7284('0x28')]()[_0x7284('0x27')](function(){_0xeca040[_0x7284('0x1a')](0xcc)[_0x7284('0x1b')]();});}};}function handleEntityNotFound(_0x444f60,_0xd2a21c){return function(_0x48256a){if(!_0x48256a){_0x444f60[_0x7284('0x19')](0x194);}return _0x48256a;};}function handleError(_0x3631f7,_0x478dd8){_0x478dd8=_0x478dd8||0x1f4;return function(_0x1b962d){logger[_0x7284('0x29')](_0x1b962d[_0x7284('0x2a')]);if(_0x1b962d[_0x7284('0x2b')]){delete _0x1b962d[_0x7284('0x2b')];}_0x3631f7[_0x7284('0x1a')](_0x478dd8)[_0x7284('0x2c')](_0x1b962d);};}exports[_0x7284('0x2d')]=function(_0x416fb5,_0x4ac437){var _0x3ca8be={},_0x1ce04e={},_0x55cc0a={'count':0x0,'rows':[]};var _0x1e2296=_[_0x7284('0x2e')](db[_0x7284('0x2f')][_0x7284('0x30')],function(_0x4b2a81){return{'name':_0x4b2a81[_0x7284('0x31')],'type':_0x4b2a81[_0x7284('0x32')]['key']};});_0x1ce04e[_0x7284('0x33')]=_[_0x7284('0x2e')](_0x1e2296,_0x7284('0x2b'));_0x1ce04e['query']=_[_0x7284('0x34')](_0x416fb5[_0x7284('0x35')]);_0x1ce04e[_0x7284('0x36')]=_[_0x7284('0x37')](_0x1ce04e[_0x7284('0x33')],_0x1ce04e['query']);_0x3ca8be[_0x7284('0x38')]=_['intersection'](_0x1ce04e[_0x7284('0x33')],qs[_0x7284('0x39')](_0x416fb5[_0x7284('0x35')][_0x7284('0x39')]));_0x3ca8be['attributes']=_0x3ca8be[_0x7284('0x38')][_0x7284('0x3a')]?_0x3ca8be['attributes']:_0x1ce04e[_0x7284('0x33')];if(!_0x416fb5[_0x7284('0x35')][_0x7284('0x3b')](_0x7284('0x3c'))){_0x3ca8be[_0x7284('0x1f')]=qs[_0x7284('0x1f')](_0x416fb5[_0x7284('0x35')][_0x7284('0x1f')]);_0x3ca8be[_0x7284('0x1d')]=qs['offset'](_0x416fb5[_0x7284('0x35')]['offset']);}_0x3ca8be[_0x7284('0x3d')]=qs[_0x7284('0x3e')](_0x416fb5[_0x7284('0x35')][_0x7284('0x3e')]);_0x3ca8be[_0x7284('0x3f')]=qs[_0x7284('0x36')](_[_0x7284('0x40')](_0x416fb5[_0x7284('0x35')],_0x1ce04e[_0x7284('0x36')]),_0x1e2296);if(_0x416fb5[_0x7284('0x35')][_0x7284('0x41')]){_0x3ca8be[_0x7284('0x3f')]=_['merge'](_0x3ca8be[_0x7284('0x3f')],{'$or':_[_0x7284('0x2e')](_0x1e2296,function(_0x2617e4){if(_0x2617e4[_0x7284('0x32')]!==_0x7284('0x42')){var _0x4a827a={};_0x4a827a[_0x2617e4[_0x7284('0x2b')]]={'$like':'%'+_0x416fb5[_0x7284('0x35')]['filter']+'%'};return _0x4a827a;}})});}_0x3ca8be=_[_0x7284('0x43')]({},_0x3ca8be,_0x416fb5[_0x7284('0x44')]);var _0x163d18={'where':_0x3ca8be[_0x7284('0x3f')]};return db[_0x7284('0x2f')][_0x7284('0x20')](_0x163d18)[_0x7284('0x27')](function(_0x4fc712){_0x55cc0a[_0x7284('0x20')]=_0x4fc712;if(_0x416fb5[_0x7284('0x35')][_0x7284('0x45')]){_0x3ca8be[_0x7284('0x46')]=[{'all':!![]}];}return db[_0x7284('0x2f')][_0x7284('0x47')](_0x3ca8be);})[_0x7284('0x27')](function(_0xf64c5b){_0x55cc0a[_0x7284('0x48')]=_0xf64c5b;return _0x55cc0a;})['then'](respondWithFilteredResult(_0x4ac437,_0x3ca8be))[_0x7284('0x49')](handleError(_0x4ac437,null));};exports[_0x7284('0x4a')]=function(_0x381fbc,_0xd13e36){var _0x4c0479={'raw':![],'where':{'id':_0x381fbc['params']['id']}},_0x360c2d={};_0x360c2d[_0x7284('0x33')]=_[_0x7284('0x34')](db[_0x7284('0x2f')]['rawAttributes']);_0x360c2d['query']=_[_0x7284('0x34')](_0x381fbc[_0x7284('0x35')]);_0x360c2d[_0x7284('0x36')]=_[_0x7284('0x37')](_0x360c2d[_0x7284('0x33')],_0x360c2d['query']);_0x4c0479[_0x7284('0x38')]=_['intersection'](_0x360c2d[_0x7284('0x33')],qs[_0x7284('0x39')](_0x381fbc['query'][_0x7284('0x39')]));_0x4c0479['attributes']=_0x4c0479['attributes'][_0x7284('0x3a')]?_0x4c0479['attributes']:_0x360c2d['model'];if(_0x381fbc[_0x7284('0x35')]['includeAll']){_0x4c0479[_0x7284('0x46')]=[{'all':!![]}];}_0x4c0479=_[_0x7284('0x43')]({},_0x4c0479,_0x381fbc[_0x7284('0x44')]);return db['AnalyticFieldReport']['find'](_0x4c0479)[_0x7284('0x27')](handleEntityNotFound(_0xd13e36,null))[_0x7284('0x27')](respondWithResult(_0xd13e36,null))['catch'](handleError(_0xd13e36,null));};exports[_0x7284('0x4b')]=function(_0x5c3ce5,_0x407224){return db[_0x7284('0x2f')]['create'](_0x5c3ce5[_0x7284('0x4c')],{})[_0x7284('0x27')](respondWithResult(_0x407224,0xc9))[_0x7284('0x49')](handleError(_0x407224,null));};exports[_0x7284('0x4d')]=function(_0xc8f44c,_0x15b2e6){return db[_0x7284('0x2f')]['bulkCreate'](_0xc8f44c[_0x7284('0x4c')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x15b2e6,0xc9))['catch'](handleError(_0x15b2e6,null));};exports['update']=function(_0x114aa0,_0x17be1e){if(_0x114aa0[_0x7284('0x4c')]['id']){delete _0x114aa0[_0x7284('0x4c')]['id'];}return db[_0x7284('0x2f')][_0x7284('0x4e')]({'where':{'id':_0x114aa0[_0x7284('0x4f')]['id']}})[_0x7284('0x27')](handleEntityNotFound(_0x17be1e,null))[_0x7284('0x27')](saveUpdates(_0x114aa0[_0x7284('0x4c')],null))[_0x7284('0x27')](respondWithResult(_0x17be1e,null))[_0x7284('0x49')](handleError(_0x17be1e,null));};exports['destroy']=function(_0x27a623,_0x2568ac){return db[_0x7284('0x2f')][_0x7284('0x4e')]({'where':{'id':_0x27a623[_0x7284('0x4f')]['id']}})[_0x7284('0x27')](handleEntityNotFound(_0x2568ac,null))[_0x7284('0x27')](removeEntity(_0x2568ac,null))[_0x7284('0x49')](handleError(_0x2568ac,null));};exports[_0x7284('0x50')]=function(_0xb83aa1,_0x5b6688){return db[_0x7284('0x2f')][_0x7284('0x28')]({'where':{'id':_0xb83aa1['query']['ids']||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x5b6688,0xcc))[_0x7284('0x49')](handleError(_0x5b6688,null));};exports[_0x7284('0x51')]=function(_0xd90e5c,_0x5887c1,_0x23b6e3){return db[_0x7284('0x52')][_0x7284('0x53')]({'where':{'id':_0xd90e5c['params']['id']}})['then'](handleEntityNotFound(_0x5887c1,null))['then'](function(_0x2c6889){if(_0x2c6889){return db[_0x7284('0x54')]['transaction'](function(_0x415ad9){return db[_0x7284('0x2f')][_0x7284('0x28')]({'where':{'CustomReportId':_0xd90e5c[_0x7284('0x4f')]['id']},'transaction':_0x415ad9})[_0x7284('0x27')](function(_0x5a0c95){var _0xbcf081=_[_0x7284('0x2e')](_0xd90e5c[_0x7284('0x4c')],function(_0x139e10){delete _0x139e10['id'];_0x139e10[_0x7284('0x55')]=_0xd90e5c[_0x7284('0x4f')]['id'];return _0x139e10;});return db[_0x7284('0x2f')][_0x7284('0x4d')](_0xbcf081,{'transaction':_0x415ad9});});})[_0x7284('0x27')](function(){return db['AnalyticFieldReport'][_0x7284('0x47')]({'where':{'CustomReportId':_0xd90e5c[_0x7284('0x4f')]['id']}});});}})['then'](respondWithResult(_0x5887c1,null))[_0x7284('0x49')](handleError(_0x5887c1,null));}; \ No newline at end of file +var _0x888b=['merge','where','type','VIRTUAL','includeAll','include','findAll','rows','params','options','find','catch','create','body','destroy','bulkDestroy','ids','addFields','AnalyticCustomReport','transaction','CustomReportId','bulkCreate','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter'];(function(_0x237bed,_0x2c9315){var _0x325fbf=function(_0x3e20f3){while(--_0x3e20f3){_0x237bed['push'](_0x237bed['shift']());}};_0x325fbf(++_0x2c9315);}(_0x888b,0x112));var _0xb888=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x888b[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require(_0xb888('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb888('0x1'));var jsonpatch=require(_0xb888('0x2'));var rp=require('request-promise');var moment=require(_0xb888('0x3'));var BPromise=require(_0xb888('0x4'));var Mustache=require(_0xb888('0x5'));var util=require(_0xb888('0x6'));var path=require('path');var sox=require(_0xb888('0x7'));var csv=require(_0xb888('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb888('0x9'));var squel=require(_0xb888('0xa'));var crypto=require('crypto');var jsforce=require(_0xb888('0xb'));var deskjs=require(_0xb888('0xc'));var toCsv=require(_0xb888('0x8'));var querystring=require('querystring');var Papa=require(_0xb888('0xd'));var Redis=require(_0xb888('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xb888('0xf'));var as=require(_0xb888('0x10'));var hardwareService=require(_0xb888('0x11'));var logger=require(_0xb888('0x12'))(_0xb888('0x13'));var utils=require(_0xb888('0x14'));var config=require(_0xb888('0x15'));var licenseUtil=require(_0xb888('0x16'));var db=require(_0xb888('0x17'))['db'];function respondWithStatusCode(_0x19c938,_0x593ce9){_0x593ce9=_0x593ce9||0xcc;return function(_0x2514f2){if(_0x2514f2){return _0x19c938[_0xb888('0x18')](_0x593ce9);}return _0x19c938[_0xb888('0x19')](_0x593ce9)[_0xb888('0x1a')]();};}function respondWithResult(_0x87c46f,_0x2b0d7a){_0x2b0d7a=_0x2b0d7a||0xc8;return function(_0x1d4036){if(_0x1d4036){return _0x87c46f['status'](_0x2b0d7a)[_0xb888('0x1b')](_0x1d4036);}};}function respondWithFilteredResult(_0x52c8d4,_0x48b7a5){return function(_0x591325){if(_0x591325){var _0xe4741c=typeof _0x48b7a5['offset']==='undefined'&&typeof _0x48b7a5[_0xb888('0x1c')]===_0xb888('0x1d');var _0x167ddc=_0x591325[_0xb888('0x1e')];var _0x33bc02=_0xe4741c?0x0:_0x48b7a5['offset'];var _0x4b0882=_0xe4741c?_0x591325[_0xb888('0x1e')]:_0x48b7a5[_0xb888('0x1f')]+_0x48b7a5[_0xb888('0x1c')];var _0x36e616;if(_0x4b0882>=_0x167ddc){_0x4b0882=_0x167ddc;_0x36e616=0xc8;}else{_0x36e616=0xce;}_0x52c8d4[_0xb888('0x19')](_0x36e616);return _0x52c8d4[_0xb888('0x20')](_0xb888('0x21'),_0x33bc02+'-'+_0x4b0882+'/'+_0x167ddc)[_0xb888('0x1b')](_0x591325);}return null;};}function patchUpdates(_0x224ec9){return function(_0x51d263){try{jsonpatch[_0xb888('0x22')](_0x51d263,_0x224ec9,!![]);}catch(_0x52511d){return BPromise[_0xb888('0x23')](_0x52511d);}return _0x51d263[_0xb888('0x24')]();};}function saveUpdates(_0x308829,_0x1b10a1){return function(_0x542512){if(_0x542512){return _0x542512[_0xb888('0x25')](_0x308829)[_0xb888('0x26')](function(_0x4a1ddd){return _0x4a1ddd;});}return null;};}function removeEntity(_0x263e35,_0x19f24f){return function(_0xae41bf){if(_0xae41bf){return _0xae41bf['destroy']()[_0xb888('0x26')](function(){_0x263e35[_0xb888('0x19')](0xcc)[_0xb888('0x1a')]();});}};}function handleEntityNotFound(_0x595b5e,_0x51b591){return function(_0x53ff37){if(!_0x53ff37){_0x595b5e[_0xb888('0x18')](0x194);}return _0x53ff37;};}function handleError(_0x93e96c,_0x3004e3){_0x3004e3=_0x3004e3||0x1f4;return function(_0x3d3f13){logger[_0xb888('0x27')](_0x3d3f13[_0xb888('0x28')]);if(_0x3d3f13[_0xb888('0x29')]){delete _0x3d3f13['name'];}_0x93e96c[_0xb888('0x19')](_0x3004e3)[_0xb888('0x2a')](_0x3d3f13);};}exports[_0xb888('0x2b')]=function(_0x29c958,_0x11e195){var _0x18e2fd={},_0x3d3415={},_0x5375f5={'count':0x0,'rows':[]};var _0x595bd3=_[_0xb888('0x2c')](db[_0xb888('0x2d')][_0xb888('0x2e')],function(_0x4bc3f0){return{'name':_0x4bc3f0[_0xb888('0x2f')],'type':_0x4bc3f0['type']['key']};});_0x3d3415[_0xb888('0x30')]=_[_0xb888('0x2c')](_0x595bd3,_0xb888('0x29'));_0x3d3415[_0xb888('0x31')]=_[_0xb888('0x32')](_0x29c958['query']);_0x3d3415[_0xb888('0x33')]=_['intersection'](_0x3d3415[_0xb888('0x30')],_0x3d3415['query']);_0x18e2fd[_0xb888('0x34')]=_[_0xb888('0x35')](_0x3d3415[_0xb888('0x30')],qs[_0xb888('0x36')](_0x29c958[_0xb888('0x31')][_0xb888('0x36')]));_0x18e2fd[_0xb888('0x34')]=_0x18e2fd[_0xb888('0x34')][_0xb888('0x37')]?_0x18e2fd[_0xb888('0x34')]:_0x3d3415[_0xb888('0x30')];if(!_0x29c958[_0xb888('0x31')][_0xb888('0x38')](_0xb888('0x39'))){_0x18e2fd[_0xb888('0x1c')]=qs[_0xb888('0x1c')](_0x29c958[_0xb888('0x31')][_0xb888('0x1c')]);_0x18e2fd[_0xb888('0x1f')]=qs[_0xb888('0x1f')](_0x29c958['query'][_0xb888('0x1f')]);}_0x18e2fd[_0xb888('0x3a')]=qs[_0xb888('0x3b')](_0x29c958['query']['sort']);_0x18e2fd['where']=qs[_0xb888('0x33')](_[_0xb888('0x3c')](_0x29c958['query'],_0x3d3415[_0xb888('0x33')]),_0x595bd3);if(_0x29c958[_0xb888('0x31')][_0xb888('0x3d')]){_0x18e2fd['where']=_[_0xb888('0x3e')](_0x18e2fd[_0xb888('0x3f')],{'$or':_['map'](_0x595bd3,function(_0x147da1){if(_0x147da1[_0xb888('0x40')]!==_0xb888('0x41')){var _0x262d50={};_0x262d50[_0x147da1[_0xb888('0x29')]]={'$like':'%'+_0x29c958[_0xb888('0x31')][_0xb888('0x3d')]+'%'};return _0x262d50;}})});}_0x18e2fd=_[_0xb888('0x3e')]({},_0x18e2fd,_0x29c958['options']);var _0x434ced={'where':_0x18e2fd[_0xb888('0x3f')]};return db['AnalyticFieldReport'][_0xb888('0x1e')](_0x434ced)[_0xb888('0x26')](function(_0x2aec97){_0x5375f5[_0xb888('0x1e')]=_0x2aec97;if(_0x29c958[_0xb888('0x31')][_0xb888('0x42')]){_0x18e2fd[_0xb888('0x43')]=[{'all':!![]}];}return db[_0xb888('0x2d')][_0xb888('0x44')](_0x18e2fd);})[_0xb888('0x26')](function(_0x2c83dc){_0x5375f5[_0xb888('0x45')]=_0x2c83dc;return _0x5375f5;})['then'](respondWithFilteredResult(_0x11e195,_0x18e2fd))['catch'](handleError(_0x11e195,null));};exports['show']=function(_0x3dab72,_0x48708b){var _0x1c908={'raw':![],'where':{'id':_0x3dab72[_0xb888('0x46')]['id']}},_0x6b31f1={};_0x6b31f1[_0xb888('0x30')]=_[_0xb888('0x32')](db[_0xb888('0x2d')]['rawAttributes']);_0x6b31f1[_0xb888('0x31')]=_['keys'](_0x3dab72['query']);_0x6b31f1[_0xb888('0x33')]=_[_0xb888('0x35')](_0x6b31f1[_0xb888('0x30')],_0x6b31f1[_0xb888('0x31')]);_0x1c908[_0xb888('0x34')]=_[_0xb888('0x35')](_0x6b31f1[_0xb888('0x30')],qs[_0xb888('0x36')](_0x3dab72['query']['fields']));_0x1c908[_0xb888('0x34')]=_0x1c908[_0xb888('0x34')][_0xb888('0x37')]?_0x1c908[_0xb888('0x34')]:_0x6b31f1[_0xb888('0x30')];if(_0x3dab72[_0xb888('0x31')][_0xb888('0x42')]){_0x1c908['include']=[{'all':!![]}];}_0x1c908=_[_0xb888('0x3e')]({},_0x1c908,_0x3dab72[_0xb888('0x47')]);return db[_0xb888('0x2d')][_0xb888('0x48')](_0x1c908)[_0xb888('0x26')](handleEntityNotFound(_0x48708b,null))[_0xb888('0x26')](respondWithResult(_0x48708b,null))[_0xb888('0x49')](handleError(_0x48708b,null));};exports[_0xb888('0x4a')]=function(_0x627f66,_0x35e037){return db[_0xb888('0x2d')][_0xb888('0x4a')](_0x627f66[_0xb888('0x4b')],{})[_0xb888('0x26')](respondWithResult(_0x35e037,0xc9))['catch'](handleError(_0x35e037,null));};exports['bulkCreate']=function(_0x5d374d,_0x487eef){return db['AnalyticFieldReport']['bulkCreate'](_0x5d374d[_0xb888('0x4b')],{'raw':![],'individualHooks':!![]})[_0xb888('0x26')](respondWithResult(_0x487eef,0xc9))[_0xb888('0x49')](handleError(_0x487eef,null));};exports[_0xb888('0x25')]=function(_0x3481f2,_0x12e169){if(_0x3481f2[_0xb888('0x4b')]['id']){delete _0x3481f2[_0xb888('0x4b')]['id'];}return db[_0xb888('0x2d')][_0xb888('0x48')]({'where':{'id':_0x3481f2[_0xb888('0x46')]['id']}})[_0xb888('0x26')](handleEntityNotFound(_0x12e169,null))[_0xb888('0x26')](saveUpdates(_0x3481f2['body'],null))['then'](respondWithResult(_0x12e169,null))['catch'](handleError(_0x12e169,null));};exports[_0xb888('0x4c')]=function(_0x550ebf,_0x5b0231){return db[_0xb888('0x2d')][_0xb888('0x48')]({'where':{'id':_0x550ebf[_0xb888('0x46')]['id']}})[_0xb888('0x26')](handleEntityNotFound(_0x5b0231,null))[_0xb888('0x26')](removeEntity(_0x5b0231,null))['catch'](handleError(_0x5b0231,null));};exports[_0xb888('0x4d')]=function(_0x5d768b,_0x6bb7a3){return db[_0xb888('0x2d')][_0xb888('0x4c')]({'where':{'id':_0x5d768b[_0xb888('0x31')][_0xb888('0x4e')]||[]},'raw':![],'individualHooks':!![]})[_0xb888('0x26')](respondWithResult(_0x6bb7a3,0xcc))[_0xb888('0x49')](handleError(_0x6bb7a3,null));};exports[_0xb888('0x4f')]=function(_0x2d88f1,_0x3c540c,_0x255698){return db[_0xb888('0x50')]['findOne']({'where':{'id':_0x2d88f1[_0xb888('0x46')]['id']}})[_0xb888('0x26')](handleEntityNotFound(_0x3c540c,null))[_0xb888('0x26')](function(_0x34f47b){if(_0x34f47b){return db['sequelize'][_0xb888('0x51')](function(_0x6533a){return db[_0xb888('0x2d')][_0xb888('0x4c')]({'where':{'CustomReportId':_0x2d88f1[_0xb888('0x46')]['id']},'transaction':_0x6533a})[_0xb888('0x26')](function(_0x576bed){var _0x1ec9e4=_[_0xb888('0x2c')](_0x2d88f1['body'],function(_0x39c884){delete _0x39c884['id'];_0x39c884[_0xb888('0x52')]=_0x2d88f1['params']['id'];return _0x39c884;});return db['AnalyticFieldReport'][_0xb888('0x53')](_0x1ec9e4,{'transaction':_0x6533a});});})[_0xb888('0x26')](function(){return db[_0xb888('0x2d')][_0xb888('0x44')]({'where':{'CustomReportId':_0x2d88f1[_0xb888('0x46')]['id']}});});}})['then'](respondWithResult(_0x3c540c,null))['catch'](handleError(_0x3c540c,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 14e59c2..0bd7715 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 _0x4746=['request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','../../config/logger','moment'];(function(_0x4412ab,_0x41d6f0){var _0x294573=function(_0x163bde){while(--_0x163bde){_0x4412ab['push'](_0x4412ab['shift']());}};_0x294573(++_0x41d6f0);}(_0x4746,0x1d1));var _0x6474=function(_0x6c2939,_0x5aa000){_0x6c2939=_0x6c2939-0x0;var _0xc39fdf=_0x4746[_0x6c2939];return _0xc39fdf;};'use strict';var _=require(_0x6474('0x0'));var util=require('util');var logger=require(_0x6474('0x1'))('api');var moment=require(_0x6474('0x2'));var BPromise=require('bluebird');var rp=require(_0x6474('0x3'));var fs=require('fs');var path=require(_0x6474('0x4'));var rimraf=require(_0x6474('0x5'));var config=require(_0x6474('0x6'));var attributes=require(_0x6474('0x7'));module[_0x6474('0x8')]=function(_0x19de40,_0x5c94aa){return _0x19de40[_0x6474('0x9')](_0x6474('0xa'),attributes,{'tableName':_0x6474('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd2b8=['moment','bluebird','rimraf','../../config/environment','exports','define','AnalyticFieldReport','lodash','util','../../config/logger','api'];(function(_0x3f25db,_0x1d3686){var _0x54f29d=function(_0x2963bb){while(--_0x2963bb){_0x3f25db['push'](_0x3f25db['shift']());}};_0x54f29d(++_0x1d3686);}(_0xd2b8,0xa1));var _0x8d2b=function(_0x102470,_0x31195a){_0x102470=_0x102470-0x0;var _0x21fb8b=_0xd2b8[_0x102470];return _0x21fb8b;};'use strict';var _=require(_0x8d2b('0x0'));var util=require(_0x8d2b('0x1'));var logger=require(_0x8d2b('0x2'))(_0x8d2b('0x3'));var moment=require(_0x8d2b('0x4'));var BPromise=require(_0x8d2b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8d2b('0x6'));var config=require(_0x8d2b('0x7'));var attributes=require('./analyticFieldReport.attributes');module[_0x8d2b('0x8')]=function(_0xdfba21,_0x3f84d5){return _0xdfba21[_0x8d2b('0x9')](_0x8d2b('0xa'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index dae46ab..c441b91 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 _0x73b5=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring'];(function(_0x1e4f2d,_0x22e2bb){var _0xd05ce5=function(_0x4c7b43){while(--_0x4c7b43){_0x1e4f2d['push'](_0x1e4f2d['shift']());}};_0xd05ce5(++_0x22e2bb);}(_0x73b5,0x11b));var _0x573b=function(_0x7cce8d,_0x8d7c9c){_0x7cce8d=_0x7cce8d-0x0;var _0x381b50=_0x73b5[_0x7cce8d];return _0x381b50;};'use strict';var _=require(_0x573b('0x0'));var util=require('util');var moment=require(_0x573b('0x1'));var BPromise=require('bluebird');var rs=require(_0x573b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x573b('0x3'))['db'];var utils=require(_0x573b('0x4'));var logger=require(_0x573b('0x5'))(_0x573b('0x6'));var config=require(_0x573b('0x7'));var jayson=require(_0x573b('0x8'));var client=jayson['client'][_0x573b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4855e4,_0x5b051f,_0x3865c6){return new BPromise(function(_0x1f52a3,_0x14f237){return client[_0x573b('0xa')](_0x4855e4,_0x3865c6)[_0x573b('0xb')](function(_0x44dffc){logger[_0x573b('0xc')](_0x573b('0xd'),_0x5b051f,_0x573b('0xe'));logger['debug'](_0x573b('0xf'),_0x5b051f,'request\x20sent',JSON[_0x573b('0x10')](_0x44dffc));if(_0x44dffc[_0x573b('0x11')]){if(_0x44dffc[_0x573b('0x11')][_0x573b('0x12')]===0x1f4){logger['error'](_0x573b('0xd'),_0x5b051f,_0x44dffc[_0x573b('0x11')]['message']);return _0x14f237(_0x44dffc[_0x573b('0x11')]['message']);}logger[_0x573b('0x11')](_0x573b('0xd'),_0x5b051f,_0x44dffc[_0x573b('0x11')][_0x573b('0x13')]);return _0x1f52a3(_0x44dffc['error'][_0x573b('0x13')]);}else{logger[_0x573b('0xc')]('AnalyticFieldReport,\x20%s,\x20%s',_0x5b051f,_0x573b('0xe'));_0x1f52a3(_0x44dffc[_0x573b('0x14')]['message']);}})[_0x573b('0x15')](function(_0x5bc04b){logger[_0x573b('0x11')](_0x573b('0xd'),_0x5b051f,_0x5bc04b);_0x14f237(_0x5bc04b);});});} \ No newline at end of file +var _0xd839=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x30b5f2,_0x2b8439){var _0x1509a4=function(_0x2ccee7){while(--_0x2ccee7){_0x30b5f2['push'](_0x30b5f2['shift']());}};_0x1509a4(++_0x2b8439);}(_0xd839,0x105));var _0x9d83=function(_0x2e0803,_0x20b12c){_0x2e0803=_0x2e0803-0x0;var _0x3d8c51=_0xd839[_0x2e0803];return _0x3d8c51;};'use strict';var _=require(_0x9d83('0x0'));var util=require(_0x9d83('0x1'));var moment=require(_0x9d83('0x2'));var BPromise=require(_0x9d83('0x3'));var rs=require(_0x9d83('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9d83('0x5'))['db'];var utils=require(_0x9d83('0x6'));var logger=require(_0x9d83('0x7'))('rpc');var config=require(_0x9d83('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9d83('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x430203,_0x53f9ac,_0x53d02a){return new BPromise(function(_0x353d2b,_0x4d7bf7){return client[_0x9d83('0xa')](_0x430203,_0x53d02a)[_0x9d83('0xb')](function(_0xf043d0){logger[_0x9d83('0xc')](_0x9d83('0xd'),_0x53f9ac,_0x9d83('0xe'));logger[_0x9d83('0xf')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x53f9ac,'request\x20sent',JSON[_0x9d83('0x10')](_0xf043d0));if(_0xf043d0[_0x9d83('0x11')]){if(_0xf043d0[_0x9d83('0x11')][_0x9d83('0x12')]===0x1f4){logger[_0x9d83('0x11')](_0x9d83('0xd'),_0x53f9ac,_0xf043d0['error'][_0x9d83('0x13')]);return _0x4d7bf7(_0xf043d0[_0x9d83('0x11')]['message']);}logger[_0x9d83('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x53f9ac,_0xf043d0[_0x9d83('0x11')][_0x9d83('0x13')]);return _0x353d2b(_0xf043d0['error']['message']);}else{logger[_0x9d83('0xc')](_0x9d83('0xd'),_0x53f9ac,_0x9d83('0xe'));_0x353d2b(_0xf043d0[_0x9d83('0x14')][_0x9d83('0x13')]);}})[_0x9d83('0x15')](function(_0x2ef226){logger[_0x9d83('0x11')](_0x9d83('0xd'),_0x53f9ac,_0x2ef226);_0x4d7bf7(_0x2ef226);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 721d049..ca4791b 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(_0x11e006,_0x187aa4){var _0x3d52aa=function(_0x25de3e){while(--_0x25de3e){_0x11e006['push'](_0x11e006['shift']());}};_0x3d52aa(++_0x187aa4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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(_0x457b1f,_0x13d5f6){var _0x2a782a=function(_0x28581a){while(--_0x28581a){_0x457b1f['push'](_0x457b1f['shift']());}};_0x2a782a(++_0x13d5f6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xb')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xb')](_0x0a9e('0xf'),auth['isAuthenticated'](),controller['addFields']);router['put']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);module[_0x0a9e('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 192efbd..94820a2 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 _0x9c2c=['TEXT','sequelize','exports'];(function(_0x54edc9,_0x345f01){var _0x2ae7a9=function(_0x24a545){while(--_0x24a545){_0x54edc9['push'](_0x54edc9['shift']());}};_0x2ae7a9(++_0x345f01);}(_0x9c2c,0x1c0));var _0xc9c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c2c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc9c2('0x0'));module[_0xc9c2('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0xc9c2('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbf5c=['sequelize','exports','STRING','TEXT'];(function(_0x283b17,_0x53606e){var _0x459e07=function(_0x11884d){while(--_0x11884d){_0x283b17['push'](_0x283b17['shift']());}};_0x459e07(++_0x53606e);}(_0xbf5c,0xb8));var _0xcbf5=function(_0x238a7a,_0x5807fe){_0x238a7a=_0x238a7a-0x0;var _0x5a1038=_0xbf5c[_0x238a7a];return _0x5a1038;};'use strict';var Sequelize=require(_0xcbf5('0x0'));module[_0xcbf5('0x1')]={'name':{'type':Sequelize[_0xcbf5('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0xcbf5('0x2')]},'metric':{'type':Sequelize[_0xcbf5('0x3')]},'description':{'type':Sequelize[_0xcbf5('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 9ee7c63..7fc87f8 100644 --- a/server/api/analyticMetric/analyticMetric.controller.js +++ b/server/api/analyticMetric/analyticMetric.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x24ca=['find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','limit','undefined','count','offset','set','apply','reject','save','update','then','destroy','get','Metrics','UserProfileResource','sendStatus','error','stack','name','send','map','AnalyticMetric','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params'];(function(_0x170291,_0x5bc16d){var _0x1b6f47=function(_0x13f911){while(--_0x13f911){_0x170291['push'](_0x170291['shift']());}};_0x1b6f47(++_0x5bc16d);}(_0x24ca,0x1bc));var _0xa24c=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x24ca[_0x465a0c];return _0x1e202e;};'use strict';var emlformat=require(_0xa24c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa24c('0x1'));var jsonpatch=require(_0xa24c('0x2'));var rp=require(_0xa24c('0x3'));var moment=require('moment');var BPromise=require(_0xa24c('0x4'));var Mustache=require(_0xa24c('0x5'));var util=require(_0xa24c('0x6'));var path=require(_0xa24c('0x7'));var sox=require(_0xa24c('0x8'));var csv=require(_0xa24c('0x9'));var ejs=require(_0xa24c('0xa'));var fs=require('fs');var fs_extra=require(_0xa24c('0xb'));var _=require(_0xa24c('0xc'));var squel=require(_0xa24c('0xd'));var crypto=require(_0xa24c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa24c('0xf'));var toCsv=require(_0xa24c('0x9'));var querystring=require(_0xa24c('0x10'));var Papa=require('papaparse');var Redis=require(_0xa24c('0x11'));var authService=require(_0xa24c('0x12'));var qs=require(_0xa24c('0x13'));var as=require(_0xa24c('0x14'));var hardwareService=require(_0xa24c('0x15'));var logger=require(_0xa24c('0x16'))(_0xa24c('0x17'));var utils=require(_0xa24c('0x18'));var config=require(_0xa24c('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa24c('0x1a'))['db'];function respondWithStatusCode(_0x11090c,_0xcee4fe){_0xcee4fe=_0xcee4fe||0xcc;return function(_0x2c2af8){if(_0x2c2af8){return _0x11090c['sendStatus'](_0xcee4fe);}return _0x11090c[_0xa24c('0x1b')](_0xcee4fe)[_0xa24c('0x1c')]();};}function respondWithResult(_0x26ff28,_0x2fcd8b){_0x2fcd8b=_0x2fcd8b||0xc8;return function(_0x1cb08e){if(_0x1cb08e){return _0x26ff28[_0xa24c('0x1b')](_0x2fcd8b)[_0xa24c('0x1d')](_0x1cb08e);}};}function respondWithFilteredResult(_0x5d4727,_0x47a063){return function(_0xb80781){if(_0xb80781){var _0x87aa90=typeof _0x47a063['offset']==='undefined'&&typeof _0x47a063[_0xa24c('0x1e')]===_0xa24c('0x1f');var _0x5c479e=_0xb80781[_0xa24c('0x20')];var _0x5de3e6=_0x87aa90?0x0:_0x47a063[_0xa24c('0x21')];var _0x2a610a=_0x87aa90?_0xb80781[_0xa24c('0x20')]:_0x47a063[_0xa24c('0x21')]+_0x47a063['limit'];var _0x16d363;if(_0x2a610a>=_0x5c479e){_0x2a610a=_0x5c479e;_0x16d363=0xc8;}else{_0x16d363=0xce;}_0x5d4727[_0xa24c('0x1b')](_0x16d363);return _0x5d4727[_0xa24c('0x22')]('Content-Range',_0x5de3e6+'-'+_0x2a610a+'/'+_0x5c479e)['json'](_0xb80781);}return null;};}function patchUpdates(_0x506424){return function(_0x4cd77e){try{jsonpatch[_0xa24c('0x23')](_0x4cd77e,_0x506424,!![]);}catch(_0x174b69){return BPromise[_0xa24c('0x24')](_0x174b69);}return _0x4cd77e[_0xa24c('0x25')]();};}function saveUpdates(_0x51a275,_0x30ec21){return function(_0x5f299e){if(_0x5f299e){return _0x5f299e[_0xa24c('0x26')](_0x51a275)[_0xa24c('0x27')](function(_0x4a1cda){return _0x4a1cda;});}return null;};}function removeEntity(_0x346ee8,_0x363d52){return function(_0x43a0c0){if(_0x43a0c0){return _0x43a0c0[_0xa24c('0x28')]()[_0xa24c('0x27')](function(){var _0x47e0eb=_0x43a0c0[_0xa24c('0x29')]({'plain':!![]});var _0x5cc9cb=_0xa24c('0x2a');return db[_0xa24c('0x2b')][_0xa24c('0x28')]({'where':{'type':_0x5cc9cb,'resourceId':_0x47e0eb['id']}})['then'](function(){return _0x43a0c0;});})[_0xa24c('0x27')](function(){_0x346ee8[_0xa24c('0x1b')](0xcc)[_0xa24c('0x1c')]();});}};}function handleEntityNotFound(_0x314121,_0x11e4e0){return function(_0x3ad0e6){if(!_0x3ad0e6){_0x314121[_0xa24c('0x2c')](0x194);}return _0x3ad0e6;};}function handleError(_0x5b23f4,_0xa0c48e){_0xa0c48e=_0xa0c48e||0x1f4;return function(_0x28675f){logger[_0xa24c('0x2d')](_0x28675f[_0xa24c('0x2e')]);if(_0x28675f['name']){delete _0x28675f[_0xa24c('0x2f')];}_0x5b23f4[_0xa24c('0x1b')](_0xa0c48e)[_0xa24c('0x30')](_0x28675f);};}exports['index']=function(_0x15eaaf,_0x3dcb1b){var _0x253d83={},_0x4ae35c={},_0x245fb2={'count':0x0,'rows':[]};var _0x5e0226=_[_0xa24c('0x31')](db[_0xa24c('0x32')][_0xa24c('0x33')],function(_0x5d025a){return{'name':_0x5d025a[_0xa24c('0x34')],'type':_0x5d025a[_0xa24c('0x35')][_0xa24c('0x36')]};});_0x4ae35c['model']=_[_0xa24c('0x31')](_0x5e0226,'name');_0x4ae35c[_0xa24c('0x37')]=_[_0xa24c('0x38')](_0x15eaaf['query']);_0x4ae35c['filters']=_[_0xa24c('0x39')](_0x4ae35c[_0xa24c('0x3a')],_0x4ae35c[_0xa24c('0x37')]);_0x253d83[_0xa24c('0x3b')]=_[_0xa24c('0x39')](_0x4ae35c[_0xa24c('0x3a')],qs[_0xa24c('0x3c')](_0x15eaaf['query'][_0xa24c('0x3c')]));_0x253d83[_0xa24c('0x3b')]=_0x253d83[_0xa24c('0x3b')][_0xa24c('0x3d')]?_0x253d83[_0xa24c('0x3b')]:_0x4ae35c[_0xa24c('0x3a')];if(!_0x15eaaf[_0xa24c('0x37')][_0xa24c('0x3e')](_0xa24c('0x3f'))){_0x253d83[_0xa24c('0x1e')]=qs['limit'](_0x15eaaf[_0xa24c('0x37')][_0xa24c('0x1e')]);_0x253d83[_0xa24c('0x21')]=qs[_0xa24c('0x21')](_0x15eaaf['query']['offset']);}_0x253d83[_0xa24c('0x40')]=qs['sort'](_0x15eaaf[_0xa24c('0x37')][_0xa24c('0x41')]);_0x253d83[_0xa24c('0x42')]=qs[_0xa24c('0x43')](_[_0xa24c('0x44')](_0x15eaaf['query'],_0x4ae35c['filters']),_0x5e0226);if(_0x15eaaf[_0xa24c('0x37')][_0xa24c('0x45')]){_0x253d83[_0xa24c('0x42')]=_[_0xa24c('0x46')](_0x253d83[_0xa24c('0x42')],{'$or':_[_0xa24c('0x31')](_0x5e0226,function(_0x5080d0){if(_0x5080d0['type']!==_0xa24c('0x47')){var _0x1ce83e={};_0x1ce83e[_0x5080d0[_0xa24c('0x2f')]]={'$like':'%'+_0x15eaaf[_0xa24c('0x37')][_0xa24c('0x45')]+'%'};return _0x1ce83e;}})});}_0x253d83=_['merge']({},_0x253d83,_0x15eaaf[_0xa24c('0x48')]);var _0x7895e={'where':_0x253d83['where']};return db['AnalyticMetric'][_0xa24c('0x20')](_0x7895e)[_0xa24c('0x27')](function(_0x231eea){_0x245fb2['count']=_0x231eea;if(_0x15eaaf['query'][_0xa24c('0x49')]){_0x253d83[_0xa24c('0x4a')]=[{'all':!![]}];}return db[_0xa24c('0x32')][_0xa24c('0x4b')](_0x253d83);})[_0xa24c('0x27')](function(_0x1b7faf){_0x245fb2[_0xa24c('0x4c')]=_0x1b7faf;return _0x245fb2;})[_0xa24c('0x27')](respondWithFilteredResult(_0x3dcb1b,_0x253d83))['catch'](handleError(_0x3dcb1b,null));};exports['show']=function(_0x430ba3,_0x44f7d4){var _0x455256={'raw':!![],'where':{'id':_0x430ba3[_0xa24c('0x4d')]['id']}},_0x5972d7={};_0x5972d7[_0xa24c('0x3a')]=_[_0xa24c('0x38')](db[_0xa24c('0x32')][_0xa24c('0x33')]);_0x5972d7[_0xa24c('0x37')]=_[_0xa24c('0x38')](_0x430ba3[_0xa24c('0x37')]);_0x5972d7[_0xa24c('0x43')]=_[_0xa24c('0x39')](_0x5972d7['model'],_0x5972d7[_0xa24c('0x37')]);_0x455256[_0xa24c('0x3b')]=_[_0xa24c('0x39')](_0x5972d7['model'],qs[_0xa24c('0x3c')](_0x430ba3[_0xa24c('0x37')][_0xa24c('0x3c')]));_0x455256[_0xa24c('0x3b')]=_0x455256[_0xa24c('0x3b')][_0xa24c('0x3d')]?_0x455256[_0xa24c('0x3b')]:_0x5972d7[_0xa24c('0x3a')];if(_0x430ba3[_0xa24c('0x37')][_0xa24c('0x49')]){_0x455256[_0xa24c('0x4a')]=[{'all':!![]}];}_0x455256=_['merge']({},_0x455256,_0x430ba3[_0xa24c('0x48')]);return db[_0xa24c('0x32')][_0xa24c('0x4e')](_0x455256)[_0xa24c('0x27')](handleEntityNotFound(_0x44f7d4,null))[_0xa24c('0x27')](respondWithResult(_0x44f7d4,null))[_0xa24c('0x4f')](handleError(_0x44f7d4,null));};exports[_0xa24c('0x50')]=function(_0x2250b9,_0x184179){return db['AnalyticMetric']['create'](_0x2250b9[_0xa24c('0x51')],{})['then'](function(_0xc078ef){var _0x1f436c=_0x2250b9['user'][_0xa24c('0x29')]({'plain':!![]});if(!_0x1f436c)throw new Error(_0xa24c('0x52'));if(_0x1f436c[_0xa24c('0x53')]==='user'){var _0x55978e=_0xc078ef[_0xa24c('0x29')]({'plain':!![]});var _0x5ba726=_0xa24c('0x2a');return db[_0xa24c('0x54')][_0xa24c('0x4e')]({'where':{'name':_0x5ba726,'userProfileId':_0x1f436c[_0xa24c('0x55')]},'raw':!![]})[_0xa24c('0x27')](function(_0x1fa739){if(_0x1fa739&&_0x1fa739[_0xa24c('0x56')]===0x0){return db[_0xa24c('0x2b')][_0xa24c('0x50')]({'name':_0x55978e[_0xa24c('0x2f')],'resourceId':_0x55978e['id'],'type':_0x1fa739['name'],'sectionId':_0x1fa739['id']},{})[_0xa24c('0x27')](function(){return _0xc078ef;});}else{return _0xc078ef;}})[_0xa24c('0x4f')](function(_0x233f8e){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x233f8e);throw _0x233f8e;});}return _0xc078ef;})['then'](respondWithResult(_0x184179,0xc9))[_0xa24c('0x4f')](handleError(_0x184179,null));};exports['update']=function(_0x4757ff,_0x21d0fc){if(_0x4757ff['body']['id']){delete _0x4757ff[_0xa24c('0x51')]['id'];}return db[_0xa24c('0x32')][_0xa24c('0x4e')]({'where':{'id':_0x4757ff[_0xa24c('0x4d')]['id']}})[_0xa24c('0x27')](handleEntityNotFound(_0x21d0fc,null))[_0xa24c('0x27')](saveUpdates(_0x4757ff[_0xa24c('0x51')],null))[_0xa24c('0x27')](respondWithResult(_0x21d0fc,null))['catch'](handleError(_0x21d0fc,null));};exports[_0xa24c('0x28')]=function(_0x47af80,_0x5abd45){return db['AnalyticMetric']['find']({'where':{'id':_0x47af80['params']['id']}})[_0xa24c('0x27')](handleEntityNotFound(_0x5abd45,null))['then'](removeEntity(_0x5abd45,null))[_0xa24c('0x4f')](handleError(_0x5abd45,null));}; \ No newline at end of file +var _0xe14b=['papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','save','update','then','get','Metrics','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','show','keys','length','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','params','eml-format','rimraf','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring'];(function(_0x4ab28f,_0x9619a1){var _0x452c9b=function(_0x570af4){while(--_0x570af4){_0x4ab28f['push'](_0x4ab28f['shift']());}};_0x452c9b(++_0x9619a1);}(_0xe14b,0x93));var _0xbe14=function(_0x36393d,_0x38d9e8){_0x36393d=_0x36393d-0x0;var _0x1fa70a=_0xe14b[_0x36393d];return _0x1fa70a;};'use strict';var emlformat=require(_0xbe14('0x0'));var rimraf=require(_0xbe14('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbe14('0x2'));var moment=require(_0xbe14('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xbe14('0x4'));var util=require('util');var path=require('path');var sox=require(_0xbe14('0x5'));var csv=require(_0xbe14('0x6'));var ejs=require(_0xbe14('0x7'));var fs=require('fs');var fs_extra=require(_0xbe14('0x8'));var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var authService=require(_0xbe14('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe14('0x10'));var logger=require(_0xbe14('0x11'))('api');var utils=require(_0xbe14('0x12'));var config=require(_0xbe14('0x13'));var licenseUtil=require(_0xbe14('0x14'));var db=require(_0xbe14('0x15'))['db'];function respondWithStatusCode(_0x27792f,_0x3b898d){_0x3b898d=_0x3b898d||0xcc;return function(_0x23a730){if(_0x23a730){return _0x27792f[_0xbe14('0x16')](_0x3b898d);}return _0x27792f[_0xbe14('0x17')](_0x3b898d)[_0xbe14('0x18')]();};}function respondWithResult(_0x1e4826,_0x33fd54){_0x33fd54=_0x33fd54||0xc8;return function(_0x813399){if(_0x813399){return _0x1e4826['status'](_0x33fd54)['json'](_0x813399);}};}function respondWithFilteredResult(_0x3f58f5,_0x3dc4a9){return function(_0xf4ac9){if(_0xf4ac9){var _0x37ce4e=typeof _0x3dc4a9['offset']===_0xbe14('0x19')&&typeof _0x3dc4a9[_0xbe14('0x1a')]===_0xbe14('0x19');var _0x123ede=_0xf4ac9[_0xbe14('0x1b')];var _0x29ab73=_0x37ce4e?0x0:_0x3dc4a9[_0xbe14('0x1c')];var _0x5ea1f8=_0x37ce4e?_0xf4ac9[_0xbe14('0x1b')]:_0x3dc4a9[_0xbe14('0x1c')]+_0x3dc4a9[_0xbe14('0x1a')];var _0x433459;if(_0x5ea1f8>=_0x123ede){_0x5ea1f8=_0x123ede;_0x433459=0xc8;}else{_0x433459=0xce;}_0x3f58f5[_0xbe14('0x17')](_0x433459);return _0x3f58f5[_0xbe14('0x1d')]('Content-Range',_0x29ab73+'-'+_0x5ea1f8+'/'+_0x123ede)[_0xbe14('0x1e')](_0xf4ac9);}return null;};}function patchUpdates(_0x4a1bbd){return function(_0x417c8d){try{jsonpatch[_0xbe14('0x1f')](_0x417c8d,_0x4a1bbd,!![]);}catch(_0x188ec4){return BPromise['reject'](_0x188ec4);}return _0x417c8d[_0xbe14('0x20')]();};}function saveUpdates(_0x56d845,_0x3c1c85){return function(_0x56e80c){if(_0x56e80c){return _0x56e80c[_0xbe14('0x21')](_0x56d845)['then'](function(_0x274018){return _0x274018;});}return null;};}function removeEntity(_0x3d3608,_0x505dbd){return function(_0x2da350){if(_0x2da350){return _0x2da350['destroy']()[_0xbe14('0x22')](function(){var _0x4851f8=_0x2da350[_0xbe14('0x23')]({'plain':!![]});var _0x5fa043=_0xbe14('0x24');return db[_0xbe14('0x25')][_0xbe14('0x26')]({'where':{'type':_0x5fa043,'resourceId':_0x4851f8['id']}})[_0xbe14('0x22')](function(){return _0x2da350;});})['then'](function(){_0x3d3608[_0xbe14('0x17')](0xcc)[_0xbe14('0x18')]();});}};}function handleEntityNotFound(_0x391556,_0x169369){return function(_0x5dd475){if(!_0x5dd475){_0x391556[_0xbe14('0x16')](0x194);}return _0x5dd475;};}function handleError(_0x29fc64,_0x59bf34){_0x59bf34=_0x59bf34||0x1f4;return function(_0x3c3613){logger[_0xbe14('0x27')](_0x3c3613[_0xbe14('0x28')]);if(_0x3c3613[_0xbe14('0x29')]){delete _0x3c3613[_0xbe14('0x29')];}_0x29fc64[_0xbe14('0x17')](_0x59bf34)[_0xbe14('0x2a')](_0x3c3613);};}exports[_0xbe14('0x2b')]=function(_0x4168c8,_0x16a159){var _0x40538f={},_0x3bf43c={},_0x39dc0a={'count':0x0,'rows':[]};var _0x10ae36=_[_0xbe14('0x2c')](db[_0xbe14('0x2d')][_0xbe14('0x2e')],function(_0x2ff48e){return{'name':_0x2ff48e[_0xbe14('0x2f')],'type':_0x2ff48e[_0xbe14('0x30')]['key']};});_0x3bf43c[_0xbe14('0x31')]=_['map'](_0x10ae36,'name');_0x3bf43c[_0xbe14('0x32')]=_['keys'](_0x4168c8[_0xbe14('0x32')]);_0x3bf43c[_0xbe14('0x33')]=_['intersection'](_0x3bf43c['model'],_0x3bf43c['query']);_0x40538f[_0xbe14('0x34')]=_[_0xbe14('0x35')](_0x3bf43c['model'],qs[_0xbe14('0x36')](_0x4168c8[_0xbe14('0x32')][_0xbe14('0x36')]));_0x40538f[_0xbe14('0x34')]=_0x40538f[_0xbe14('0x34')]['length']?_0x40538f['attributes']:_0x3bf43c[_0xbe14('0x31')];if(!_0x4168c8['query']['hasOwnProperty']('nolimit')){_0x40538f[_0xbe14('0x1a')]=qs[_0xbe14('0x1a')](_0x4168c8[_0xbe14('0x32')][_0xbe14('0x1a')]);_0x40538f[_0xbe14('0x1c')]=qs[_0xbe14('0x1c')](_0x4168c8[_0xbe14('0x32')][_0xbe14('0x1c')]);}_0x40538f[_0xbe14('0x37')]=qs[_0xbe14('0x38')](_0x4168c8[_0xbe14('0x32')][_0xbe14('0x38')]);_0x40538f['where']=qs['filters'](_[_0xbe14('0x39')](_0x4168c8[_0xbe14('0x32')],_0x3bf43c[_0xbe14('0x33')]),_0x10ae36);if(_0x4168c8['query'][_0xbe14('0x3a')]){_0x40538f[_0xbe14('0x3b')]=_[_0xbe14('0x3c')](_0x40538f[_0xbe14('0x3b')],{'$or':_[_0xbe14('0x2c')](_0x10ae36,function(_0x25ee1f){if(_0x25ee1f[_0xbe14('0x30')]!==_0xbe14('0x3d')){var _0x1b2608={};_0x1b2608[_0x25ee1f['name']]={'$like':'%'+_0x4168c8[_0xbe14('0x32')][_0xbe14('0x3a')]+'%'};return _0x1b2608;}})});}_0x40538f=_[_0xbe14('0x3c')]({},_0x40538f,_0x4168c8[_0xbe14('0x3e')]);var _0x3287b9={'where':_0x40538f[_0xbe14('0x3b')]};return db['AnalyticMetric'][_0xbe14('0x1b')](_0x3287b9)[_0xbe14('0x22')](function(_0x1220c9){_0x39dc0a[_0xbe14('0x1b')]=_0x1220c9;if(_0x4168c8['query']['includeAll']){_0x40538f[_0xbe14('0x3f')]=[{'all':!![]}];}return db[_0xbe14('0x2d')][_0xbe14('0x40')](_0x40538f);})['then'](function(_0x5d5318){_0x39dc0a[_0xbe14('0x41')]=_0x5d5318;return _0x39dc0a;})['then'](respondWithFilteredResult(_0x16a159,_0x40538f))['catch'](handleError(_0x16a159,null));};exports[_0xbe14('0x42')]=function(_0x1f0355,_0x8216c3){var _0x5051e4={'raw':!![],'where':{'id':_0x1f0355['params']['id']}},_0x558525={};_0x558525[_0xbe14('0x31')]=_[_0xbe14('0x43')](db[_0xbe14('0x2d')]['rawAttributes']);_0x558525[_0xbe14('0x32')]=_[_0xbe14('0x43')](_0x1f0355[_0xbe14('0x32')]);_0x558525[_0xbe14('0x33')]=_['intersection'](_0x558525['model'],_0x558525[_0xbe14('0x32')]);_0x5051e4[_0xbe14('0x34')]=_[_0xbe14('0x35')](_0x558525[_0xbe14('0x31')],qs[_0xbe14('0x36')](_0x1f0355['query']['fields']));_0x5051e4[_0xbe14('0x34')]=_0x5051e4[_0xbe14('0x34')][_0xbe14('0x44')]?_0x5051e4[_0xbe14('0x34')]:_0x558525['model'];if(_0x1f0355[_0xbe14('0x32')][_0xbe14('0x45')]){_0x5051e4['include']=[{'all':!![]}];}_0x5051e4=_[_0xbe14('0x3c')]({},_0x5051e4,_0x1f0355[_0xbe14('0x3e')]);return db[_0xbe14('0x2d')][_0xbe14('0x46')](_0x5051e4)['then'](handleEntityNotFound(_0x8216c3,null))['then'](respondWithResult(_0x8216c3,null))[_0xbe14('0x47')](handleError(_0x8216c3,null));};exports[_0xbe14('0x48')]=function(_0x4a1a37,_0x5acf90){return db[_0xbe14('0x2d')][_0xbe14('0x48')](_0x4a1a37[_0xbe14('0x49')],{})[_0xbe14('0x22')](function(_0xdbc6e1){var _0xd04fd5=_0x4a1a37[_0xbe14('0x4a')]['get']({'plain':!![]});if(!_0xd04fd5)throw new Error(_0xbe14('0x4b'));if(_0xd04fd5[_0xbe14('0x4c')]===_0xbe14('0x4a')){var _0x22b1f8=_0xdbc6e1[_0xbe14('0x23')]({'plain':!![]});var _0x494c32=_0xbe14('0x24');return db[_0xbe14('0x4d')][_0xbe14('0x46')]({'where':{'name':_0x494c32,'userProfileId':_0xd04fd5[_0xbe14('0x4e')]},'raw':!![]})[_0xbe14('0x22')](function(_0x2dbeb1){if(_0x2dbeb1&&_0x2dbeb1['autoAssociation']===0x0){return db['UserProfileResource'][_0xbe14('0x48')]({'name':_0x22b1f8[_0xbe14('0x29')],'resourceId':_0x22b1f8['id'],'type':_0x2dbeb1[_0xbe14('0x29')],'sectionId':_0x2dbeb1['id']},{})['then'](function(){return _0xdbc6e1;});}else{return _0xdbc6e1;}})['catch'](function(_0x44fe0d){logger[_0xbe14('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x44fe0d);throw _0x44fe0d;});}return _0xdbc6e1;})[_0xbe14('0x22')](respondWithResult(_0x5acf90,0xc9))[_0xbe14('0x47')](handleError(_0x5acf90,null));};exports['update']=function(_0x28f995,_0x4a40d2){if(_0x28f995[_0xbe14('0x49')]['id']){delete _0x28f995[_0xbe14('0x49')]['id'];}return db[_0xbe14('0x2d')]['find']({'where':{'id':_0x28f995[_0xbe14('0x4f')]['id']}})[_0xbe14('0x22')](handleEntityNotFound(_0x4a40d2,null))['then'](saveUpdates(_0x28f995[_0xbe14('0x49')],null))[_0xbe14('0x22')](respondWithResult(_0x4a40d2,null))[_0xbe14('0x47')](handleError(_0x4a40d2,null));};exports[_0xbe14('0x26')]=function(_0x49322f,_0x4f06a3){return db[_0xbe14('0x2d')][_0xbe14('0x46')]({'where':{'id':_0x49322f[_0xbe14('0x4f')]['id']}})[_0xbe14('0x22')](handleEntityNotFound(_0x4f06a3,null))[_0xbe14('0x22')](removeEntity(_0x4f06a3,null))[_0xbe14('0x47')](handleError(_0x4f06a3,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index fb325e9..4527e40 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 _0xeae8=['../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','moment','request-promise','rimraf'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xeae8,0x66));var _0x8eae=function(_0x5e4642,_0x3cf0d9){_0x5e4642=_0x5e4642-0x0;var _0x49c9aa=_0xeae8[_0x5e4642];return _0x49c9aa;};'use strict';var _=require(_0x8eae('0x0'));var util=require(_0x8eae('0x1'));var logger=require(_0x8eae('0x2'))('api');var moment=require(_0x8eae('0x3'));var BPromise=require('bluebird');var rp=require(_0x8eae('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8eae('0x5'));var config=require(_0x8eae('0x6'));var attributes=require(_0x8eae('0x7'));module[_0x8eae('0x8')]=function(_0xcc5f34,_0x123053){return _0xcc5f34[_0x8eae('0x9')](_0x8eae('0xa'),attributes,{'tableName':_0x8eae('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8375=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','AnalyticMetric'];(function(_0x1f4ef4,_0x525c7a){var _0x2757e9=function(_0x4f1004){while(--_0x4f1004){_0x1f4ef4['push'](_0x1f4ef4['shift']());}};_0x2757e9(++_0x525c7a);}(_0x8375,0xa8));var _0x5837=function(_0x3e65ea,_0x72471f){_0x3e65ea=_0x3e65ea-0x0;var _0x401ae8=_0x8375[_0x3e65ea];return _0x401ae8;};'use strict';var _=require(_0x5837('0x0'));var util=require(_0x5837('0x1'));var logger=require(_0x5837('0x2'))('api');var moment=require(_0x5837('0x3'));var BPromise=require(_0x5837('0x4'));var rp=require(_0x5837('0x5'));var fs=require('fs');var path=require(_0x5837('0x6'));var rimraf=require(_0x5837('0x7'));var config=require(_0x5837('0x8'));var attributes=require('./analyticMetric.attributes');module[_0x5837('0x9')]=function(_0x19491e,_0x365da3){return _0x19491e[_0x5837('0xa')](_0x5837('0xb'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index a246f57..ee24d87 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 _0xb2fe=['debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent'];(function(_0x1ddcb1,_0x3ac8da){var _0x5a35cf=function(_0x2d8ab2){while(--_0x2d8ab2){_0x1ddcb1['push'](_0x1ddcb1['shift']());}};_0x5a35cf(++_0x3ac8da);}(_0xb2fe,0x140));var _0xeb2f=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xb2fe[_0x47e7cb];return _0x2a8874;};'use strict';var _=require(_0xeb2f('0x0'));var util=require(_0xeb2f('0x1'));var moment=require(_0xeb2f('0x2'));var BPromise=require(_0xeb2f('0x3'));var rs=require(_0xeb2f('0x4'));var fs=require('fs');var Redis=require(_0xeb2f('0x5'));var db=require(_0xeb2f('0x6'))['db'];var utils=require(_0xeb2f('0x7'));var logger=require('../../config/logger')(_0xeb2f('0x8'));var config=require('../../config/environment');var jayson=require(_0xeb2f('0x9'));var client=jayson[_0xeb2f('0xa')][_0xeb2f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2fdd7a,_0x2c00af,_0x505e77){return new BPromise(function(_0x28ca39,_0x12389d){return client[_0xeb2f('0xc')](_0x2fdd7a,_0x505e77)[_0xeb2f('0xd')](function(_0x2e12d8){logger['info'](_0xeb2f('0xe'),_0x2c00af,_0xeb2f('0xf'));logger[_0xeb2f('0x10')](_0xeb2f('0x11'),_0x2c00af,_0xeb2f('0xf'),JSON[_0xeb2f('0x12')](_0x2e12d8));if(_0x2e12d8[_0xeb2f('0x13')]){if(_0x2e12d8[_0xeb2f('0x13')]['code']===0x1f4){logger[_0xeb2f('0x13')](_0xeb2f('0xe'),_0x2c00af,_0x2e12d8['error']['message']);return _0x12389d(_0x2e12d8[_0xeb2f('0x13')][_0xeb2f('0x14')]);}logger[_0xeb2f('0x13')](_0xeb2f('0xe'),_0x2c00af,_0x2e12d8['error'][_0xeb2f('0x14')]);return _0x28ca39(_0x2e12d8['error'][_0xeb2f('0x14')]);}else{logger[_0xeb2f('0x15')](_0xeb2f('0xe'),_0x2c00af,_0xeb2f('0xf'));_0x28ca39(_0x2e12d8[_0xeb2f('0x16')][_0xeb2f('0x14')]);}})[_0xeb2f('0x17')](function(_0x293483){logger[_0xeb2f('0x13')]('AnalyticMetric,\x20%s,\x20%s',_0x2c00af,_0x293483);_0x12389d(_0x293483);});});} \ No newline at end of file +var _0xa668=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','error','message','info','result','lodash','util','moment','bluebird'];(function(_0x3471e1,_0x297aeb){var _0x259194=function(_0x3d3e77){while(--_0x3d3e77){_0x3471e1['push'](_0x3471e1['shift']());}};_0x259194(++_0x297aeb);}(_0xa668,0xec));var _0x8a66=function(_0x32f9cf,_0x307d57){_0x32f9cf=_0x32f9cf-0x0;var _0x24ec66=_0xa668[_0x32f9cf];return _0x24ec66;};'use strict';var _=require(_0x8a66('0x0'));var util=require(_0x8a66('0x1'));var moment=require(_0x8a66('0x2'));var BPromise=require(_0x8a66('0x3'));var rs=require(_0x8a66('0x4'));var fs=require('fs');var Redis=require(_0x8a66('0x5'));var db=require(_0x8a66('0x6'))['db'];var utils=require(_0x8a66('0x7'));var logger=require(_0x8a66('0x8'))('rpc');var config=require(_0x8a66('0x9'));var jayson=require(_0x8a66('0xa'));var client=jayson[_0x8a66('0xb')][_0x8a66('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1dd14b,_0x23b514,_0x51dacb){return new BPromise(function(_0x355ad5,_0x504237){return client['request'](_0x1dd14b,_0x51dacb)['then'](function(_0x31170a){logger['info'](_0x8a66('0xd'),_0x23b514,_0x8a66('0xe'));logger[_0x8a66('0xf')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x23b514,_0x8a66('0xe'),JSON['stringify'](_0x31170a));if(_0x31170a[_0x8a66('0x10')]){if(_0x31170a['error']['code']===0x1f4){logger[_0x8a66('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x23b514,_0x31170a[_0x8a66('0x10')][_0x8a66('0x11')]);return _0x504237(_0x31170a[_0x8a66('0x10')]['message']);}logger[_0x8a66('0x10')](_0x8a66('0xd'),_0x23b514,_0x31170a[_0x8a66('0x10')][_0x8a66('0x11')]);return _0x355ad5(_0x31170a[_0x8a66('0x10')][_0x8a66('0x11')]);}else{logger[_0x8a66('0x12')](_0x8a66('0xd'),_0x23b514,'request\x20sent');_0x355ad5(_0x31170a[_0x8a66('0x13')][_0x8a66('0x11')]);}})['catch'](function(_0x503f22){logger[_0x8a66('0x10')](_0x8a66('0xd'),_0x23b514,_0x503f22);_0x504237(_0x503f22);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 1668054..20fc01a 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 _0xe9e8=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','./analyticMetric.controller','get','isAuthenticated','/:id','show','post','create','update','delete','destroy','exports','multer','util','path'];(function(_0x3b0be7,_0x2aa163){var _0x2a469b=function(_0x180f1c){while(--_0x180f1c){_0x3b0be7['push'](_0x3b0be7['shift']());}};_0x2a469b(++_0x2aa163);}(_0xe9e8,0x179));var _0x8e9e=function(_0xbe243e,_0x1c7902){_0xbe243e=_0xbe243e-0x0;var _0xd960f7=_0xe9e8[_0xbe243e];return _0xd960f7;};'use strict';var multer=require(_0x8e9e('0x0'));var util=require(_0x8e9e('0x1'));var path=require(_0x8e9e('0x2'));var timeout=require(_0x8e9e('0x3'));var express=require(_0x8e9e('0x4'));var router=express[_0x8e9e('0x5')]();var fs_extra=require(_0x8e9e('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x8e9e('0x7'));var config=require('../../config/environment');var controller=require(_0x8e9e('0x8'));router[_0x8e9e('0x9')]('/',auth[_0x8e9e('0xa')](),controller['index']);router['get'](_0x8e9e('0xb'),auth[_0x8e9e('0xa')](),controller[_0x8e9e('0xc')]);router[_0x8e9e('0xd')]('/',auth[_0x8e9e('0xa')](),controller[_0x8e9e('0xe')]);router['put']('/:id',auth[_0x8e9e('0xa')](),controller[_0x8e9e('0xf')]);router[_0x8e9e('0x10')](_0x8e9e('0xb'),auth[_0x8e9e('0xa')](),controller[_0x8e9e('0x11')]);module[_0x8e9e('0x12')]=router; \ No newline at end of file +var _0x7217=['Router','fs-extra','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x433850,_0x5e347c){var _0x4b8501=function(_0xb66cfe){while(--_0xb66cfe){_0x433850['push'](_0x433850['shift']());}};_0x4b8501(++_0x5e347c);}(_0x7217,0x19e));var _0x7721=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0x7217[_0x5e3b04];return _0x1fc44d;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0xd')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0xf')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller['update']);router[_0x7721('0x10')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0x11')]);module[_0x7721('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 55ff038..c43b52c 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 _0x9d42=['exports','TEXT','sequelize'];(function(_0x161e81,_0x572655){var _0x901d0d=function(_0xd75d30){while(--_0xd75d30){_0x161e81['push'](_0x161e81['shift']());}};_0x901d0d(++_0x572655);}(_0x9d42,0x113));var _0x29d4=function(_0x47e57e,_0x34a5a1){_0x47e57e=_0x47e57e-0x0;var _0x1daff3=_0x9d42[_0x47e57e];return _0x1daff3;};'use strict';var Sequelize=require(_0x29d4('0x0'));module[_0x29d4('0x1')]={'tree':{'type':Sequelize[_0x29d4('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x6e2b=['TEXT','sequelize','exports'];(function(_0x4e22e5,_0x5071c6){var _0x178be0=function(_0x461bc6){while(--_0x461bc6){_0x4e22e5['push'](_0x4e22e5['shift']());}};_0x178be0(++_0x5071c6);}(_0x6e2b,0x91));var _0xb6e2=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6e2b[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xb6e2('0x0'));module[_0xb6e2('0x1')]={'tree':{'type':Sequelize[_0xb6e2('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 259ffde..5ff182a 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 _0xb179=['fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save','then','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','keys','query','filters','model','attributes','intersection','fields','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','destroy','eml-format','rimraf','zip-dir'];(function(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0xb179,0x12d));var _0x9b17=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xb179[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require(_0x9b17('0x0'));var rimraf=require(_0x9b17('0x1'));var zipdir=require(_0x9b17('0x2'));var jsonpatch=require(_0x9b17('0x3'));var rp=require(_0x9b17('0x4'));var moment=require(_0x9b17('0x5'));var BPromise=require(_0x9b17('0x6'));var Mustache=require('mustache');var util=require(_0x9b17('0x7'));var path=require('path');var sox=require(_0x9b17('0x8'));var csv=require(_0x9b17('0x9'));var ejs=require(_0x9b17('0xa'));var fs=require('fs');var fs_extra=require(_0x9b17('0xb'));var _=require(_0x9b17('0xc'));var squel=require('squel');var crypto=require(_0x9b17('0xd'));var jsforce=require(_0x9b17('0xe'));var deskjs=require(_0x9b17('0xf'));var toCsv=require(_0x9b17('0x9'));var querystring=require(_0x9b17('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9b17('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9b17('0x12'));var hardwareService=require(_0x9b17('0x13'));var logger=require('../../config/logger')(_0x9b17('0x14'));var utils=require(_0x9b17('0x15'));var config=require(_0x9b17('0x16'));var licenseUtil=require(_0x9b17('0x17'));var db=require(_0x9b17('0x18'))['db'];function respondWithStatusCode(_0x3f768b,_0x36e601){_0x36e601=_0x36e601||0xcc;return function(_0x1c555a){if(_0x1c555a){return _0x3f768b[_0x9b17('0x19')](_0x36e601);}return _0x3f768b['status'](_0x36e601)[_0x9b17('0x1a')]();};}function respondWithResult(_0xf6339f,_0x2995df){_0x2995df=_0x2995df||0xc8;return function(_0x268ccd){if(_0x268ccd){return _0xf6339f['status'](_0x2995df)[_0x9b17('0x1b')](_0x268ccd);}};}function respondWithFilteredResult(_0x3def0c,_0x52c93f){return function(_0x463724){if(_0x463724){var _0x3ff132=typeof _0x52c93f[_0x9b17('0x1c')]===_0x9b17('0x1d')&&typeof _0x52c93f[_0x9b17('0x1e')]===_0x9b17('0x1d');var _0x149868=_0x463724[_0x9b17('0x1f')];var _0x57a2ce=_0x3ff132?0x0:_0x52c93f[_0x9b17('0x1c')];var _0xf4fa47=_0x3ff132?_0x463724[_0x9b17('0x1f')]:_0x52c93f[_0x9b17('0x1c')]+_0x52c93f['limit'];var _0x43af6f;if(_0xf4fa47>=_0x149868){_0xf4fa47=_0x149868;_0x43af6f=0xc8;}else{_0x43af6f=0xce;}_0x3def0c[_0x9b17('0x20')](_0x43af6f);return _0x3def0c[_0x9b17('0x21')](_0x9b17('0x22'),_0x57a2ce+'-'+_0xf4fa47+'/'+_0x149868)[_0x9b17('0x1b')](_0x463724);}return null;};}function patchUpdates(_0x5415e0){return function(_0x53986d){try{jsonpatch[_0x9b17('0x23')](_0x53986d,_0x5415e0,!![]);}catch(_0x41f521){return BPromise['reject'](_0x41f521);}return _0x53986d[_0x9b17('0x24')]();};}function saveUpdates(_0x3814a4,_0x13eed5){return function(_0xb070fe){if(_0xb070fe){return _0xb070fe['update'](_0x3814a4)['then'](function(_0x490b6d){return _0x490b6d;});}return null;};}function removeEntity(_0x1232d9,_0x5a14e8){return function(_0x4ecd2e){if(_0x4ecd2e){return _0x4ecd2e['destroy']()[_0x9b17('0x25')](function(){_0x1232d9['status'](0xcc)[_0x9b17('0x1a')]();});}};}function handleEntityNotFound(_0x3d66bc,_0x41b6e9){return function(_0xa76cdc){if(!_0xa76cdc){_0x3d66bc['sendStatus'](0x194);}return _0xa76cdc;};}function handleError(_0x99c679,_0x4bf03b){_0x4bf03b=_0x4bf03b||0x1f4;return function(_0x471348){logger[_0x9b17('0x26')](_0x471348[_0x9b17('0x27')]);if(_0x471348[_0x9b17('0x28')]){delete _0x471348['name'];}_0x99c679['status'](_0x4bf03b)[_0x9b17('0x29')](_0x471348);};}exports[_0x9b17('0x2a')]=function(_0x1f738c,_0x2fd0ff){var _0x33984a={},_0x16018f={},_0x50f08b={'count':0x0,'rows':[]};var _0x5eb6e6=_[_0x9b17('0x2b')](db[_0x9b17('0x2c')][_0x9b17('0x2d')],function(_0x43f7c7){return{'name':_0x43f7c7[_0x9b17('0x2e')],'type':_0x43f7c7[_0x9b17('0x2f')][_0x9b17('0x30')]};});_0x16018f['model']=_['map'](_0x5eb6e6,'name');_0x16018f['query']=_[_0x9b17('0x31')](_0x1f738c[_0x9b17('0x32')]);_0x16018f[_0x9b17('0x33')]=_['intersection'](_0x16018f[_0x9b17('0x34')],_0x16018f[_0x9b17('0x32')]);_0x33984a[_0x9b17('0x35')]=_[_0x9b17('0x36')](_0x16018f['model'],qs[_0x9b17('0x37')](_0x1f738c[_0x9b17('0x32')]['fields']));_0x33984a['attributes']=_0x33984a['attributes']['length']?_0x33984a[_0x9b17('0x35')]:_0x16018f[_0x9b17('0x34')];if(!_0x1f738c['query']['hasOwnProperty'](_0x9b17('0x38'))){_0x33984a[_0x9b17('0x1e')]=qs['limit'](_0x1f738c[_0x9b17('0x32')][_0x9b17('0x1e')]);_0x33984a[_0x9b17('0x1c')]=qs[_0x9b17('0x1c')](_0x1f738c[_0x9b17('0x32')][_0x9b17('0x1c')]);}_0x33984a[_0x9b17('0x39')]=qs['sort'](_0x1f738c[_0x9b17('0x32')][_0x9b17('0x3a')]);_0x33984a[_0x9b17('0x3b')]=qs[_0x9b17('0x33')](_[_0x9b17('0x3c')](_0x1f738c[_0x9b17('0x32')],_0x16018f[_0x9b17('0x33')]),_0x5eb6e6);if(_0x1f738c[_0x9b17('0x32')][_0x9b17('0x3d')]){_0x33984a['where']=_['merge'](_0x33984a[_0x9b17('0x3b')],{'$or':_[_0x9b17('0x2b')](_0x5eb6e6,function(_0x420081){if(_0x420081[_0x9b17('0x2f')]!==_0x9b17('0x3e')){var _0x204c28={};_0x204c28[_0x420081[_0x9b17('0x28')]]={'$like':'%'+_0x1f738c[_0x9b17('0x32')][_0x9b17('0x3d')]+'%'};return _0x204c28;}})});}_0x33984a=_[_0x9b17('0x3f')]({},_0x33984a,_0x1f738c['options']);var _0x1a0435={'where':_0x33984a[_0x9b17('0x3b')]};return db['AnalyticTreeReport'][_0x9b17('0x1f')](_0x1a0435)[_0x9b17('0x25')](function(_0x262806){_0x50f08b[_0x9b17('0x1f')]=_0x262806;if(_0x1f738c['query'][_0x9b17('0x40')]){_0x33984a[_0x9b17('0x41')]=[{'all':!![]}];}return db[_0x9b17('0x2c')][_0x9b17('0x42')](_0x33984a);})[_0x9b17('0x25')](function(_0x276f43){_0x50f08b[_0x9b17('0x43')]=_0x276f43;return _0x50f08b;})[_0x9b17('0x25')](respondWithFilteredResult(_0x2fd0ff,_0x33984a))['catch'](handleError(_0x2fd0ff,null));};exports[_0x9b17('0x44')]=function(_0x5d058e,_0x218aa1){var _0x4782e5={'raw':!![],'where':{'id':_0x5d058e[_0x9b17('0x45')]['id']}},_0x12ef2f={};_0x12ef2f[_0x9b17('0x34')]=_[_0x9b17('0x31')](db[_0x9b17('0x2c')]['rawAttributes']);_0x12ef2f['query']=_[_0x9b17('0x31')](_0x5d058e['query']);_0x12ef2f[_0x9b17('0x33')]=_[_0x9b17('0x36')](_0x12ef2f['model'],_0x12ef2f[_0x9b17('0x32')]);_0x4782e5[_0x9b17('0x35')]=_[_0x9b17('0x36')](_0x12ef2f[_0x9b17('0x34')],qs[_0x9b17('0x37')](_0x5d058e[_0x9b17('0x32')][_0x9b17('0x37')]));_0x4782e5[_0x9b17('0x35')]=_0x4782e5['attributes'][_0x9b17('0x46')]?_0x4782e5[_0x9b17('0x35')]:_0x12ef2f[_0x9b17('0x34')];if(_0x5d058e[_0x9b17('0x32')][_0x9b17('0x40')]){_0x4782e5[_0x9b17('0x41')]=[{'all':!![]}];}_0x4782e5=_[_0x9b17('0x3f')]({},_0x4782e5,_0x5d058e['options']);return db[_0x9b17('0x2c')][_0x9b17('0x47')](_0x4782e5)['then'](handleEntityNotFound(_0x218aa1,null))[_0x9b17('0x25')](respondWithResult(_0x218aa1,null))[_0x9b17('0x48')](handleError(_0x218aa1,null));};exports[_0x9b17('0x49')]=function(_0xc58a67,_0x4a5bbe){return db['AnalyticTreeReport'][_0x9b17('0x49')](_0xc58a67[_0x9b17('0x4a')],{})[_0x9b17('0x25')](respondWithResult(_0x4a5bbe,0xc9))[_0x9b17('0x48')](handleError(_0x4a5bbe,null));};exports['update']=function(_0x5af2b7,_0x379197){if(_0x5af2b7[_0x9b17('0x4a')]['id']){delete _0x5af2b7['body']['id'];}return db['AnalyticTreeReport'][_0x9b17('0x47')]({'where':{'id':_0x5af2b7[_0x9b17('0x45')]['id']}})[_0x9b17('0x25')](handleEntityNotFound(_0x379197,null))[_0x9b17('0x25')](saveUpdates(_0x5af2b7[_0x9b17('0x4a')],null))[_0x9b17('0x25')](respondWithResult(_0x379197,null))[_0x9b17('0x48')](handleError(_0x379197,null));};exports[_0x9b17('0x4b')]=function(_0x41cb89,_0x2094af){return db[_0x9b17('0x2c')][_0x9b17('0x47')]({'where':{'id':_0x41cb89[_0x9b17('0x45')]['id']}})[_0x9b17('0x25')](handleEntityNotFound(_0x2094af,null))[_0x9b17('0x25')](removeEntity(_0x2094af,null))[_0x9b17('0x48')](handleError(_0x2094af,null));}; \ No newline at end of file +var _0x0c58=['includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','end','error','send','map','AnalyticTreeReport','fieldName','type','key','name','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0xad8169,_0x565e9e){var _0x8f61e7=function(_0x5ac70e){while(--_0x5ac70e){_0xad8169['push'](_0xad8169['shift']());}};_0x8f61e7(++_0x565e9e);}(_0x0c58,0x9e));var _0x80c5=function(_0x376246,_0x305977){_0x376246=_0x376246-0x0;var _0x483010=_0x0c58[_0x376246];return _0x483010;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x80c5('0x0'));var zipdir=require(_0x80c5('0x1'));var jsonpatch=require(_0x80c5('0x2'));var rp=require(_0x80c5('0x3'));var moment=require('moment');var BPromise=require(_0x80c5('0x4'));var Mustache=require(_0x80c5('0x5'));var util=require(_0x80c5('0x6'));var path=require(_0x80c5('0x7'));var sox=require(_0x80c5('0x8'));var csv=require('to-csv');var ejs=require(_0x80c5('0x9'));var fs=require('fs');var fs_extra=require(_0x80c5('0xa'));var _=require(_0x80c5('0xb'));var squel=require(_0x80c5('0xc'));var crypto=require(_0x80c5('0xd'));var jsforce=require(_0x80c5('0xe'));var deskjs=require(_0x80c5('0xf'));var toCsv=require('to-csv');var querystring=require(_0x80c5('0x10'));var Papa=require(_0x80c5('0x11'));var Redis=require(_0x80c5('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x80c5('0x13'));var logger=require('../../config/logger')(_0x80c5('0x14'));var utils=require('../../config/utils');var config=require(_0x80c5('0x15'));var licenseUtil=require(_0x80c5('0x16'));var db=require(_0x80c5('0x17'))['db'];function respondWithStatusCode(_0x3aea1b,_0x57b744){_0x57b744=_0x57b744||0xcc;return function(_0x303cda){if(_0x303cda){return _0x3aea1b['sendStatus'](_0x57b744);}return _0x3aea1b[_0x80c5('0x18')](_0x57b744)['end']();};}function respondWithResult(_0x2dd32f,_0x302488){_0x302488=_0x302488||0xc8;return function(_0x3b38eb){if(_0x3b38eb){return _0x2dd32f[_0x80c5('0x18')](_0x302488)['json'](_0x3b38eb);}};}function respondWithFilteredResult(_0x34642e,_0x185014){return function(_0x325727){if(_0x325727){var _0x2775c8=typeof _0x185014[_0x80c5('0x19')]===_0x80c5('0x1a')&&typeof _0x185014['limit']===_0x80c5('0x1a');var _0x516331=_0x325727[_0x80c5('0x1b')];var _0x27839c=_0x2775c8?0x0:_0x185014[_0x80c5('0x19')];var _0x45c1aa=_0x2775c8?_0x325727['count']:_0x185014[_0x80c5('0x19')]+_0x185014[_0x80c5('0x1c')];var _0x5962df;if(_0x45c1aa>=_0x516331){_0x45c1aa=_0x516331;_0x5962df=0xc8;}else{_0x5962df=0xce;}_0x34642e[_0x80c5('0x18')](_0x5962df);return _0x34642e[_0x80c5('0x1d')](_0x80c5('0x1e'),_0x27839c+'-'+_0x45c1aa+'/'+_0x516331)['json'](_0x325727);}return null;};}function patchUpdates(_0x29d606){return function(_0x5b0caf){try{jsonpatch[_0x80c5('0x1f')](_0x5b0caf,_0x29d606,!![]);}catch(_0x2bfadc){return BPromise[_0x80c5('0x20')](_0x2bfadc);}return _0x5b0caf[_0x80c5('0x21')]();};}function saveUpdates(_0xc9c594,_0x5d3dab){return function(_0x4a4b68){if(_0x4a4b68){return _0x4a4b68[_0x80c5('0x22')](_0xc9c594)['then'](function(_0x35822d){return _0x35822d;});}return null;};}function removeEntity(_0x5b749d,_0x49004c){return function(_0x243ef2){if(_0x243ef2){return _0x243ef2[_0x80c5('0x23')]()[_0x80c5('0x24')](function(){_0x5b749d['status'](0xcc)[_0x80c5('0x25')]();});}};}function handleEntityNotFound(_0x4ca865,_0x53cfaf){return function(_0x1d24f9){if(!_0x1d24f9){_0x4ca865['sendStatus'](0x194);}return _0x1d24f9;};}function handleError(_0x341689,_0x1ec328){_0x1ec328=_0x1ec328||0x1f4;return function(_0x56034b){logger[_0x80c5('0x26')](_0x56034b['stack']);if(_0x56034b['name']){delete _0x56034b['name'];}_0x341689[_0x80c5('0x18')](_0x1ec328)[_0x80c5('0x27')](_0x56034b);};}exports['index']=function(_0x5d004d,_0x2cbd81){var _0x1b7890={},_0x4a26ae={},_0x4a7628={'count':0x0,'rows':[]};var _0x39d408=_[_0x80c5('0x28')](db[_0x80c5('0x29')]['rawAttributes'],function(_0x532b94){return{'name':_0x532b94[_0x80c5('0x2a')],'type':_0x532b94[_0x80c5('0x2b')][_0x80c5('0x2c')]};});_0x4a26ae['model']=_['map'](_0x39d408,_0x80c5('0x2d'));_0x4a26ae[_0x80c5('0x2e')]=_[_0x80c5('0x2f')](_0x5d004d[_0x80c5('0x2e')]);_0x4a26ae[_0x80c5('0x30')]=_['intersection'](_0x4a26ae[_0x80c5('0x31')],_0x4a26ae[_0x80c5('0x2e')]);_0x1b7890[_0x80c5('0x32')]=_[_0x80c5('0x33')](_0x4a26ae[_0x80c5('0x31')],qs[_0x80c5('0x34')](_0x5d004d['query'][_0x80c5('0x34')]));_0x1b7890[_0x80c5('0x32')]=_0x1b7890[_0x80c5('0x32')][_0x80c5('0x35')]?_0x1b7890[_0x80c5('0x32')]:_0x4a26ae['model'];if(!_0x5d004d[_0x80c5('0x2e')][_0x80c5('0x36')](_0x80c5('0x37'))){_0x1b7890[_0x80c5('0x1c')]=qs[_0x80c5('0x1c')](_0x5d004d[_0x80c5('0x2e')][_0x80c5('0x1c')]);_0x1b7890[_0x80c5('0x19')]=qs[_0x80c5('0x19')](_0x5d004d['query']['offset']);}_0x1b7890[_0x80c5('0x38')]=qs[_0x80c5('0x39')](_0x5d004d['query'][_0x80c5('0x39')]);_0x1b7890[_0x80c5('0x3a')]=qs['filters'](_[_0x80c5('0x3b')](_0x5d004d[_0x80c5('0x2e')],_0x4a26ae[_0x80c5('0x30')]),_0x39d408);if(_0x5d004d[_0x80c5('0x2e')][_0x80c5('0x3c')]){_0x1b7890[_0x80c5('0x3a')]=_[_0x80c5('0x3d')](_0x1b7890[_0x80c5('0x3a')],{'$or':_[_0x80c5('0x28')](_0x39d408,function(_0x141e56){if(_0x141e56[_0x80c5('0x2b')]!==_0x80c5('0x3e')){var _0x519413={};_0x519413[_0x141e56[_0x80c5('0x2d')]]={'$like':'%'+_0x5d004d[_0x80c5('0x2e')][_0x80c5('0x3c')]+'%'};return _0x519413;}})});}_0x1b7890=_[_0x80c5('0x3d')]({},_0x1b7890,_0x5d004d[_0x80c5('0x3f')]);var _0xee96b5={'where':_0x1b7890[_0x80c5('0x3a')]};return db[_0x80c5('0x29')][_0x80c5('0x1b')](_0xee96b5)['then'](function(_0x85bdc0){_0x4a7628['count']=_0x85bdc0;if(_0x5d004d['query'][_0x80c5('0x40')]){_0x1b7890[_0x80c5('0x41')]=[{'all':!![]}];}return db[_0x80c5('0x29')][_0x80c5('0x42')](_0x1b7890);})[_0x80c5('0x24')](function(_0x47867f){_0x4a7628['rows']=_0x47867f;return _0x4a7628;})[_0x80c5('0x24')](respondWithFilteredResult(_0x2cbd81,_0x1b7890))[_0x80c5('0x43')](handleError(_0x2cbd81,null));};exports[_0x80c5('0x44')]=function(_0x26fc8d,_0x13f35b){var _0x1edaf0={'raw':!![],'where':{'id':_0x26fc8d[_0x80c5('0x45')]['id']}},_0x4a9ccd={};_0x4a9ccd['model']=_[_0x80c5('0x2f')](db[_0x80c5('0x29')][_0x80c5('0x46')]);_0x4a9ccd[_0x80c5('0x2e')]=_[_0x80c5('0x2f')](_0x26fc8d[_0x80c5('0x2e')]);_0x4a9ccd[_0x80c5('0x30')]=_[_0x80c5('0x33')](_0x4a9ccd[_0x80c5('0x31')],_0x4a9ccd['query']);_0x1edaf0[_0x80c5('0x32')]=_['intersection'](_0x4a9ccd['model'],qs[_0x80c5('0x34')](_0x26fc8d['query'][_0x80c5('0x34')]));_0x1edaf0[_0x80c5('0x32')]=_0x1edaf0[_0x80c5('0x32')]['length']?_0x1edaf0[_0x80c5('0x32')]:_0x4a9ccd[_0x80c5('0x31')];if(_0x26fc8d[_0x80c5('0x2e')]['includeAll']){_0x1edaf0[_0x80c5('0x41')]=[{'all':!![]}];}_0x1edaf0=_[_0x80c5('0x3d')]({},_0x1edaf0,_0x26fc8d['options']);return db[_0x80c5('0x29')][_0x80c5('0x47')](_0x1edaf0)['then'](handleEntityNotFound(_0x13f35b,null))[_0x80c5('0x24')](respondWithResult(_0x13f35b,null))[_0x80c5('0x43')](handleError(_0x13f35b,null));};exports[_0x80c5('0x48')]=function(_0x4ad946,_0x1c1ed6){return db[_0x80c5('0x29')]['create'](_0x4ad946[_0x80c5('0x49')],{})[_0x80c5('0x24')](respondWithResult(_0x1c1ed6,0xc9))[_0x80c5('0x43')](handleError(_0x1c1ed6,null));};exports[_0x80c5('0x22')]=function(_0xbb3ab6,_0x38560c){if(_0xbb3ab6[_0x80c5('0x49')]['id']){delete _0xbb3ab6[_0x80c5('0x49')]['id'];}return db[_0x80c5('0x29')][_0x80c5('0x47')]({'where':{'id':_0xbb3ab6['params']['id']}})[_0x80c5('0x24')](handleEntityNotFound(_0x38560c,null))[_0x80c5('0x24')](saveUpdates(_0xbb3ab6['body'],null))[_0x80c5('0x24')](respondWithResult(_0x38560c,null))[_0x80c5('0x43')](handleError(_0x38560c,null));};exports[_0x80c5('0x23')]=function(_0x25d4b0,_0x2f7b90){return db['AnalyticTreeReport'][_0x80c5('0x47')]({'where':{'id':_0x25d4b0[_0x80c5('0x45')]['id']}})[_0x80c5('0x24')](handleEntityNotFound(_0x2f7b90,null))[_0x80c5('0x24')](removeEntity(_0x2f7b90,null))[_0x80c5('0x43')](handleError(_0x2f7b90,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index d66100b..02a7844 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 _0x7a02=['util','api','moment','bluebird','request-promise','path','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','lodash'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0x7a02,0xef));var _0x27a0=function(_0x5ddaac,_0x2697a8){_0x5ddaac=_0x5ddaac-0x0;var _0x2a9c58=_0x7a02[_0x5ddaac];return _0x2a9c58;};'use strict';var _=require(_0x27a0('0x0'));var util=require(_0x27a0('0x1'));var logger=require('../../config/logger')(_0x27a0('0x2'));var moment=require(_0x27a0('0x3'));var BPromise=require(_0x27a0('0x4'));var rp=require(_0x27a0('0x5'));var fs=require('fs');var path=require(_0x27a0('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x27a0('0x7'));module[_0x27a0('0x8')]=function(_0x10cc65,_0x35cd59){return _0x10cc65[_0x27a0('0x9')](_0x27a0('0xa'),attributes,{'tableName':_0x27a0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7e8d=['./analyticTreeReport.attributes','define','AnalyticTreeReport','analytics_report_trees','api','moment','request-promise','path','rimraf'];(function(_0x72063a,_0x1b012e){var _0x41f179=function(_0x135faf){while(--_0x135faf){_0x72063a['push'](_0x72063a['shift']());}};_0x41f179(++_0x1b012e);}(_0x7e8d,0x190));var _0xd7e8=function(_0x136619,_0x31c9b2){_0x136619=_0x136619-0x0;var _0x38c4a5=_0x7e8d[_0x136619];return _0x38c4a5;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xd7e8('0x0'));var moment=require(_0xd7e8('0x1'));var BPromise=require('bluebird');var rp=require(_0xd7e8('0x2'));var fs=require('fs');var path=require(_0xd7e8('0x3'));var rimraf=require(_0xd7e8('0x4'));var config=require('../../config/environment');var attributes=require(_0xd7e8('0x5'));module['exports']=function(_0x48ce40,_0x2361ea){return _0x48ce40[_0xd7e8('0x6')](_0xd7e8('0x7'),attributes,{'tableName':_0xd7e8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 0c4d12f..6dd4c86 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 _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x24a188,_0x4efd77){var _0x493a78=function(_0x7ac91){while(--_0x7ac91){_0x24a188['push'](_0x24a188['shift']());}};_0x493a78(++_0x4efd77);}(_0xadb5,0xad));var _0x5adb=function(_0x123039,_0x558a5e){_0x123039=_0x123039-0x0;var _0x8bba42=_0xadb5[_0x123039];return _0x8bba42;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x326054,_0x4cb01c){var _0x4b3213=function(_0x170961){while(--_0x170961){_0x326054['push'](_0x326054['shift']());}};_0x4b3213(++_0x4cb01c);}(_0x5f2f,0x73));var _0xf5f2=function(_0xead4e,_0x4b7d06){_0xead4e=_0xead4e-0x0;var _0xa7f386=_0x5f2f[_0xead4e];return _0xa7f386;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 271064e..f08880a 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 _0x26f0=['isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get'];(function(_0xa153e,_0x38ef1){var _0x5a15db=function(_0x2d6c22){while(--_0x2d6c22){_0xa153e['push'](_0xa153e['shift']());}};_0x5a15db(++_0x38ef1);}(_0x26f0,0x7c));var _0x026f=function(_0x530ec2,_0x2e4c48){_0x530ec2=_0x530ec2-0x0;var _0x5abf5e=_0x26f0[_0x530ec2];return _0x5abf5e;};'use strict';var multer=require(_0x026f('0x0'));var util=require(_0x026f('0x1'));var path=require('path');var timeout=require(_0x026f('0x2'));var express=require(_0x026f('0x3'));var router=express[_0x026f('0x4')]();var fs_extra=require(_0x026f('0x5'));var auth=require(_0x026f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x026f('0x7'));var controller=require('./analyticTreeReport.controller');router[_0x026f('0x8')]('/',auth[_0x026f('0x9')](),controller[_0x026f('0xa')]);router[_0x026f('0x8')](_0x026f('0xb'),auth[_0x026f('0x9')](),controller[_0x026f('0xc')]);router[_0x026f('0xd')]('/',auth['isAuthenticated'](),controller[_0x026f('0xe')]);router[_0x026f('0xf')]('/:id',auth[_0x026f('0x9')](),controller[_0x026f('0x10')]);router[_0x026f('0x11')](_0x026f('0xb'),auth[_0x026f('0x9')](),controller['destroy']);module[_0x026f('0x12')]=router; \ No newline at end of file +var _0x7abc=['put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','post'];(function(_0x55fa4b,_0x51bbfc){var _0x49b0cf=function(_0x4dff47){while(--_0x4dff47){_0x55fa4b['push'](_0x55fa4b['shift']());}};_0x49b0cf(++_0x51bbfc);}(_0x7abc,0x181));var _0xc7ab=function(_0x4c207b,_0x59f530){_0x4c207b=_0x4c207b-0x0;var _0x560c4f=_0x7abc[_0x4c207b];return _0x560c4f;};'use strict';var multer=require(_0xc7ab('0x0'));var util=require('util');var path=require(_0xc7ab('0x1'));var timeout=require(_0xc7ab('0x2'));var express=require(_0xc7ab('0x3'));var router=express[_0xc7ab('0x4')]();var fs_extra=require(_0xc7ab('0x5'));var auth=require(_0xc7ab('0x6'));var interaction=require(_0xc7ab('0x7'));var config=require(_0xc7ab('0x8'));var controller=require(_0xc7ab('0x9'));router[_0xc7ab('0xa')]('/',auth[_0xc7ab('0xb')](),controller[_0xc7ab('0xc')]);router[_0xc7ab('0xa')](_0xc7ab('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xc7ab('0xe')]('/',auth[_0xc7ab('0xb')](),controller['create']);router[_0xc7ab('0xf')]('/:id',auth[_0xc7ab('0xb')](),controller[_0xc7ab('0x10')]);router[_0xc7ab('0x11')](_0xc7ab('0xd'),auth[_0xc7ab('0xb')](),controller[_0xc7ab('0x12')]);module[_0xc7ab('0x13')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 5bd8555..b906312 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 _0xe189=['sequelize','STRING'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xe189,0x194));var _0x9e18=function(_0x14f6d9,_0x4bd21c){_0x14f6d9=_0x14f6d9-0x0;var _0x11953e=_0xe189[_0x14f6d9];return _0x11953e;};'use strict';var Sequelize=require(_0x9e18('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x9e18('0x1')]},'type':{'type':Sequelize[_0x9e18('0x1')]}}; \ No newline at end of file +var _0x5a8c=['sequelize','exports','STRING'];(function(_0x3e5b1e,_0x10a1fc){var _0x265956=function(_0x2c3a03){while(--_0x2c3a03){_0x3e5b1e['push'](_0x3e5b1e['shift']());}};_0x265956(++_0x10a1fc);}(_0x5a8c,0x1da));var _0xc5a8=function(_0xe27948,_0x5bfa16){_0xe27948=_0xe27948-0x0;var _0x44e57b=_0x5a8c[_0xe27948];return _0x44e57b;};'use strict';var Sequelize=require(_0xc5a8('0x0'));module[_0xc5a8('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0xc5a8('0x2')]},'type':{'type':Sequelize[_0xc5a8('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index ccd1908..a3fdbb9 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 _0xcec8=['offset','count','set','apply','reject','save','update','then','destroy','error','name','index','map','Attachment','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll','show','find','params','length','options','omit','createdAt','body','catch','create','file','originalname','basename','filename','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','rimraf','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','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit'];(function(_0x213706,_0x424157){var _0x1a7df5=function(_0x2b5293){while(--_0x2b5293){_0x213706['push'](_0x213706['shift']());}};_0x1a7df5(++_0x424157);}(_0xcec8,0x146));var _0x8cec=function(_0x4178af,_0x388652){_0x4178af=_0x4178af-0x0;var _0x20f4b1=_0xcec8[_0x4178af];return _0x20f4b1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8cec('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8cec('0x1'));var moment=require(_0x8cec('0x2'));var BPromise=require(_0x8cec('0x3'));var Mustache=require(_0x8cec('0x4'));var util=require(_0x8cec('0x5'));var path=require(_0x8cec('0x6'));var sox=require(_0x8cec('0x7'));var csv=require(_0x8cec('0x8'));var ejs=require(_0x8cec('0x9'));var fs=require('fs');var fs_extra=require(_0x8cec('0xa'));var _=require(_0x8cec('0xb'));var squel=require(_0x8cec('0xc'));var crypto=require('crypto');var jsforce=require(_0x8cec('0xd'));var deskjs=require(_0x8cec('0xe'));var toCsv=require(_0x8cec('0x8'));var querystring=require(_0x8cec('0xf'));var Papa=require(_0x8cec('0x10'));var Redis=require(_0x8cec('0x11'));var authService=require(_0x8cec('0x12'));var qs=require(_0x8cec('0x13'));var as=require(_0x8cec('0x14'));var hardwareService=require(_0x8cec('0x15'));var logger=require(_0x8cec('0x16'))(_0x8cec('0x17'));var utils=require(_0x8cec('0x18'));var config=require(_0x8cec('0x19'));var licenseUtil=require(_0x8cec('0x1a'));var db=require(_0x8cec('0x1b'))['db'];function respondWithStatusCode(_0x178399,_0x463bfa){_0x463bfa=_0x463bfa||0xcc;return function(_0x453626){if(_0x453626){return _0x178399[_0x8cec('0x1c')](_0x463bfa);}return _0x178399[_0x8cec('0x1d')](_0x463bfa)[_0x8cec('0x1e')]();};}function respondWithResult(_0x3f74dc,_0x45b2be){_0x45b2be=_0x45b2be||0xc8;return function(_0x1a240a){if(_0x1a240a){return _0x3f74dc[_0x8cec('0x1d')](_0x45b2be)[_0x8cec('0x1f')](_0x1a240a);}};}function respondWithFilteredResult(_0x4a78ab,_0x4bd371){return function(_0x54d4ca){if(_0x54d4ca){var _0x13ed67=typeof _0x4bd371['offset']===_0x8cec('0x20')&&typeof _0x4bd371[_0x8cec('0x21')]==='undefined';var _0x24e8cf=_0x54d4ca['count'];var _0x4ac9cc=_0x13ed67?0x0:_0x4bd371[_0x8cec('0x22')];var _0x117b7a=_0x13ed67?_0x54d4ca[_0x8cec('0x23')]:_0x4bd371['offset']+_0x4bd371[_0x8cec('0x21')];var _0x29e3e3;if(_0x117b7a>=_0x24e8cf){_0x117b7a=_0x24e8cf;_0x29e3e3=0xc8;}else{_0x29e3e3=0xce;}_0x4a78ab['status'](_0x29e3e3);return _0x4a78ab[_0x8cec('0x24')]('Content-Range',_0x4ac9cc+'-'+_0x117b7a+'/'+_0x24e8cf)[_0x8cec('0x1f')](_0x54d4ca);}return null;};}function patchUpdates(_0x582492){return function(_0x3dd7d5){try{jsonpatch[_0x8cec('0x25')](_0x3dd7d5,_0x582492,!![]);}catch(_0x3c2256){return BPromise[_0x8cec('0x26')](_0x3c2256);}return _0x3dd7d5[_0x8cec('0x27')]();};}function saveUpdates(_0x45aca6,_0x520e31){return function(_0x120e8f){if(_0x120e8f){return _0x120e8f[_0x8cec('0x28')](_0x45aca6)[_0x8cec('0x29')](function(_0x4da58e){return _0x4da58e;});}return null;};}function removeEntity(_0x2672ad,_0x470954){return function(_0x488965){if(_0x488965){return _0x488965[_0x8cec('0x2a')]()['then'](function(){_0x2672ad[_0x8cec('0x1d')](0xcc)[_0x8cec('0x1e')]();});}};}function handleEntityNotFound(_0x586f4f,_0x44a5de){return function(_0x2e7fb9){if(!_0x2e7fb9){_0x586f4f['sendStatus'](0x194);}return _0x2e7fb9;};}function handleError(_0x89147a,_0x2f0b77){_0x2f0b77=_0x2f0b77||0x1f4;return function(_0x269b08){logger[_0x8cec('0x2b')](_0x269b08['stack']);if(_0x269b08[_0x8cec('0x2c')]){delete _0x269b08[_0x8cec('0x2c')];}_0x89147a[_0x8cec('0x1d')](_0x2f0b77)['send'](_0x269b08);};}exports[_0x8cec('0x2d')]=function(_0x20ab95,_0x30b523){var _0x40a72d={},_0x2f72cc={},_0x22f175={'count':0x0,'rows':[]};var _0x557812=_[_0x8cec('0x2e')](db[_0x8cec('0x2f')][_0x8cec('0x30')],function(_0xa880c){return{'name':_0xa880c[_0x8cec('0x31')],'type':_0xa880c[_0x8cec('0x32')][_0x8cec('0x33')]};});_0x2f72cc[_0x8cec('0x34')]=_[_0x8cec('0x2e')](_0x557812,_0x8cec('0x2c'));_0x2f72cc[_0x8cec('0x35')]=_[_0x8cec('0x36')](_0x20ab95[_0x8cec('0x35')]);_0x2f72cc['filters']=_[_0x8cec('0x37')](_0x2f72cc[_0x8cec('0x34')],_0x2f72cc[_0x8cec('0x35')]);_0x40a72d[_0x8cec('0x38')]=_[_0x8cec('0x37')](_0x2f72cc[_0x8cec('0x34')],qs[_0x8cec('0x39')](_0x20ab95[_0x8cec('0x35')][_0x8cec('0x39')]));_0x40a72d[_0x8cec('0x38')]=_0x40a72d[_0x8cec('0x38')]['length']?_0x40a72d[_0x8cec('0x38')]:_0x2f72cc[_0x8cec('0x34')];if(!_0x20ab95[_0x8cec('0x35')][_0x8cec('0x3a')](_0x8cec('0x3b'))){_0x40a72d['limit']=qs['limit'](_0x20ab95['query'][_0x8cec('0x21')]);_0x40a72d[_0x8cec('0x22')]=qs[_0x8cec('0x22')](_0x20ab95[_0x8cec('0x35')][_0x8cec('0x22')]);}_0x40a72d['order']=qs[_0x8cec('0x3c')](_0x20ab95[_0x8cec('0x35')][_0x8cec('0x3c')]);_0x40a72d[_0x8cec('0x3d')]=qs[_0x8cec('0x3e')](_['pick'](_0x20ab95[_0x8cec('0x35')],_0x2f72cc['filters']),_0x557812);if(_0x20ab95[_0x8cec('0x35')][_0x8cec('0x3f')]){_0x40a72d[_0x8cec('0x3d')]=_[_0x8cec('0x40')](_0x40a72d[_0x8cec('0x3d')],{'$or':_[_0x8cec('0x2e')](_0x557812,function(_0x56877b){if(_0x56877b['type']!==_0x8cec('0x41')){var _0x125c92={};_0x125c92[_0x56877b[_0x8cec('0x2c')]]={'$like':'%'+_0x20ab95[_0x8cec('0x35')]['filter']+'%'};return _0x125c92;}})});}_0x40a72d=_[_0x8cec('0x40')]({},_0x40a72d,_0x20ab95['options']);var _0x5d8bda={'where':_0x40a72d['where']};return db['Attachment'][_0x8cec('0x23')](_0x5d8bda)[_0x8cec('0x29')](function(_0x4755e5){_0x22f175[_0x8cec('0x23')]=_0x4755e5;if(_0x20ab95[_0x8cec('0x35')][_0x8cec('0x42')]){_0x40a72d[_0x8cec('0x43')]=[{'all':!![]}];}return db['Attachment'][_0x8cec('0x44')](_0x40a72d);})[_0x8cec('0x29')](function(_0xc3b39){_0x22f175['rows']=_0xc3b39;return _0x22f175;})[_0x8cec('0x29')](respondWithFilteredResult(_0x30b523,_0x40a72d))['catch'](handleError(_0x30b523,null));};exports[_0x8cec('0x45')]=function(_0x564fd8,_0x3323c3){var _0x5b2080={'raw':!![],'where':{'id':_0x564fd8['params']['id']}},_0x4a3a3d={};_0x4a3a3d[_0x8cec('0x34')]=_['keys'](db[_0x8cec('0x2f')][_0x8cec('0x30')]);_0x4a3a3d[_0x8cec('0x35')]=_[_0x8cec('0x36')](_0x564fd8[_0x8cec('0x35')]);_0x4a3a3d[_0x8cec('0x3e')]=_['intersection'](_0x4a3a3d[_0x8cec('0x34')],_0x4a3a3d[_0x8cec('0x35')]);_0x5b2080['attributes']=_['intersection'](_0x4a3a3d[_0x8cec('0x34')],qs[_0x8cec('0x39')](_0x564fd8['query']['fields']));_0x5b2080[_0x8cec('0x38')]=_0x5b2080[_0x8cec('0x38')]['length']?_0x5b2080['attributes']:_0x4a3a3d['model'];if(_0x564fd8[_0x8cec('0x35')]['includeAll']){_0x5b2080['include']=[{'all':!![]}];}_0x5b2080=_[_0x8cec('0x40')]({},_0x5b2080,_0x564fd8['options']);return db[_0x8cec('0x2f')][_0x8cec('0x46')](_0x5b2080)[_0x8cec('0x29')](handleEntityNotFound(_0x3323c3,null))[_0x8cec('0x29')](respondWithResult(_0x3323c3,null))['catch'](handleError(_0x3323c3,null));};exports['clone']=function(_0x562495,_0x5b19fc){var _0x392832={'where':{'id':_0x562495[_0x8cec('0x47')]['id']}},_0x5eaf45={};_0x5eaf45[_0x8cec('0x34')]=_['keys'](db[_0x8cec('0x2f')][_0x8cec('0x30')]);_0x392832['attributes']=_[_0x8cec('0x37')](_0x5eaf45[_0x8cec('0x34')],qs[_0x8cec('0x39')](_0x562495[_0x8cec('0x35')]['fields']));_0x392832[_0x8cec('0x38')]=_0x392832[_0x8cec('0x38')][_0x8cec('0x48')]?_0x392832[_0x8cec('0x38')]:_0x5eaf45[_0x8cec('0x34')];if(_0x562495['query'][_0x8cec('0x42')]){_0x392832['include']=[{'all':!![]}];}_0x392832=_[_0x8cec('0x40')]({},_0x392832,_0x562495[_0x8cec('0x49')]);return db[_0x8cec('0x2f')]['find'](_0x392832)[_0x8cec('0x29')](handleEntityNotFound(_0x5b19fc,null))['then'](function(_0x38c9e8){if(_0x38c9e8){var _0x438eb3=_0x38c9e8['get']({'plain':!![]});_0x438eb3=qs[_0x8cec('0x4a')](_0x438eb3,['id',_0x8cec('0x4b'),'updatedAt']);_0x562495[_0x8cec('0x4c')]=_[_0x8cec('0x4a')](_0x562495[_0x8cec('0x4c')],['id',_0x8cec('0x4b'),'updatedAt']);return db[_0x8cec('0x2f')]['create'](_['merge'](_0x438eb3,_0x562495['body']),{'include':_0x562495[_0x8cec('0x35')][_0x8cec('0x42')]?[{'all':!![]}]:undefined});}})[_0x8cec('0x29')](respondWithResult(_0x5b19fc,0xc9))[_0x8cec('0x4d')](handleError(_0x5b19fc,null));};exports[_0x8cec('0x28')]=function(_0x4853ad,_0xdeb894){if(_0x4853ad[_0x8cec('0x4c')]['id']){delete _0x4853ad[_0x8cec('0x4c')]['id'];}return db[_0x8cec('0x2f')][_0x8cec('0x46')]({'where':{'id':_0x4853ad[_0x8cec('0x47')]['id']}})['then'](handleEntityNotFound(_0xdeb894,null))[_0x8cec('0x29')](saveUpdates(_0x4853ad[_0x8cec('0x4c')],null))[_0x8cec('0x29')](respondWithResult(_0xdeb894,null))[_0x8cec('0x4d')](handleError(_0xdeb894,null));};exports['destroy']=function(_0x261d91,_0x55807e){return db[_0x8cec('0x2f')][_0x8cec('0x46')]({'where':{'id':_0x261d91['params']['id']}})[_0x8cec('0x29')](handleEntityNotFound(_0x55807e,null))['then'](removeEntity(_0x55807e,null))[_0x8cec('0x4d')](handleError(_0x55807e,null));};exports[_0x8cec('0x4e')]=function(_0x3160d2,_0x206b9e,_0x5e3e34){_0x3160d2[_0x8cec('0x4c')][_0x8cec('0x2c')]=_0x3160d2[_0x8cec('0x4f')][_0x8cec('0x50')];_0x3160d2['body'][_0x8cec('0x51')]=_0x3160d2[_0x8cec('0x4f')][_0x8cec('0x52')];_0x3160d2[_0x8cec('0x4c')][_0x8cec('0x32')]=_0x3160d2[_0x8cec('0x4f')]['mimetype'];return db[_0x8cec('0x2f')][_0x8cec('0x4e')](_0x3160d2[_0x8cec('0x4c')])[_0x8cec('0x29')](respondWithResult(_0x206b9e,0xc9))[_0x8cec('0x4d')](handleError(_0x206b9e,null));};exports['download']=function(_0x45c515,_0x2f8b10,_0x42d7b8){return db['Attachment'][_0x8cec('0x53')]({'where':{'id':_0x45c515[_0x8cec('0x47')]['id']},'raw':!![]})[_0x8cec('0x29')](handleEntityNotFound(_0x2f8b10,null))[_0x8cec('0x29')](function(_0x44739f){if(_0x44739f){var _0x3946ee=_0x44739f[_0x8cec('0x54')]!==null;var _0x33b57a=path[_0x8cec('0x55')](config[_0x8cec('0x56')],_0x8cec('0x57'));if(_0x3946ee){_0x33b57a=path['join'](_0x33b57a,_0x8cec('0x58'));}var _0x37a30c=path[_0x8cec('0x55')](_0x33b57a,_0x44739f[_0x8cec('0x51')]);return _0x2f8b10[_0x8cec('0x59')](_0x37a30c);}})['catch'](handleError(_0x2f8b10,null));}; \ No newline at end of file +var _0x7446=['Content-Range','apply','save','then','destroy','error','stack','name','index','map','Attachment','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','catch','find','clone','params','get','omit','createdAt','updatedAt','body','create','update','file','basename','filename','download','ChatOfflineMessageId','join','root','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit'];(function(_0x326e5e,_0x491c33){var _0x4d0fde=function(_0xcbcedc){while(--_0xcbcedc){_0x326e5e['push'](_0x326e5e['shift']());}};_0x4d0fde(++_0x491c33);}(_0x7446,0x17f));var _0x6744=function(_0x351c0e,_0x172dd0){_0x351c0e=_0x351c0e-0x0;var _0x3ac7f1=_0x7446[_0x351c0e];return _0x3ac7f1;};'use strict';var emlformat=require(_0x6744('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6744('0x1'));var jsonpatch=require(_0x6744('0x2'));var rp=require('request-promise');var moment=require(_0x6744('0x3'));var BPromise=require(_0x6744('0x4'));var Mustache=require(_0x6744('0x5'));var util=require('util');var path=require(_0x6744('0x6'));var sox=require(_0x6744('0x7'));var csv=require('to-csv');var ejs=require(_0x6744('0x8'));var fs=require('fs');var fs_extra=require(_0x6744('0x9'));var _=require('lodash');var squel=require(_0x6744('0xa'));var crypto=require(_0x6744('0xb'));var jsforce=require(_0x6744('0xc'));var deskjs=require(_0x6744('0xd'));var toCsv=require(_0x6744('0xe'));var querystring=require(_0x6744('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6744('0x10'));var qs=require(_0x6744('0x11'));var as=require(_0x6744('0x12'));var hardwareService=require(_0x6744('0x13'));var logger=require('../../config/logger')(_0x6744('0x14'));var utils=require(_0x6744('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6744('0x16'));var db=require(_0x6744('0x17'))['db'];function respondWithStatusCode(_0x32597c,_0x416c62){_0x416c62=_0x416c62||0xcc;return function(_0x139222){if(_0x139222){return _0x32597c[_0x6744('0x18')](_0x416c62);}return _0x32597c[_0x6744('0x19')](_0x416c62)[_0x6744('0x1a')]();};}function respondWithResult(_0x132ed8,_0x25b30e){_0x25b30e=_0x25b30e||0xc8;return function(_0x5e6c22){if(_0x5e6c22){return _0x132ed8[_0x6744('0x19')](_0x25b30e)[_0x6744('0x1b')](_0x5e6c22);}};}function respondWithFilteredResult(_0x38707b,_0x4d7b8d){return function(_0x17a039){if(_0x17a039){var _0x1617fa=typeof _0x4d7b8d[_0x6744('0x1c')]==='undefined'&&typeof _0x4d7b8d['limit']===_0x6744('0x1d');var _0x5f334d=_0x17a039[_0x6744('0x1e')];var _0x50d329=_0x1617fa?0x0:_0x4d7b8d[_0x6744('0x1c')];var _0x3e5e63=_0x1617fa?_0x17a039[_0x6744('0x1e')]:_0x4d7b8d[_0x6744('0x1c')]+_0x4d7b8d[_0x6744('0x1f')];var _0xcf2ce6;if(_0x3e5e63>=_0x5f334d){_0x3e5e63=_0x5f334d;_0xcf2ce6=0xc8;}else{_0xcf2ce6=0xce;}_0x38707b['status'](_0xcf2ce6);return _0x38707b['set'](_0x6744('0x20'),_0x50d329+'-'+_0x3e5e63+'/'+_0x5f334d)['json'](_0x17a039);}return null;};}function patchUpdates(_0x34b8ef){return function(_0x4bfe68){try{jsonpatch[_0x6744('0x21')](_0x4bfe68,_0x34b8ef,!![]);}catch(_0x26f083){return BPromise['reject'](_0x26f083);}return _0x4bfe68[_0x6744('0x22')]();};}function saveUpdates(_0xa8bc4a,_0x32bfb1){return function(_0x121bb6){if(_0x121bb6){return _0x121bb6['update'](_0xa8bc4a)[_0x6744('0x23')](function(_0xc0763e){return _0xc0763e;});}return null;};}function removeEntity(_0x338a79,_0x144d15){return function(_0x3680ca){if(_0x3680ca){return _0x3680ca[_0x6744('0x24')]()[_0x6744('0x23')](function(){_0x338a79[_0x6744('0x19')](0xcc)[_0x6744('0x1a')]();});}};}function handleEntityNotFound(_0x7a5983,_0x538cd4){return function(_0x747afc){if(!_0x747afc){_0x7a5983[_0x6744('0x18')](0x194);}return _0x747afc;};}function handleError(_0x26f352,_0x835999){_0x835999=_0x835999||0x1f4;return function(_0x7e46b3){logger[_0x6744('0x25')](_0x7e46b3[_0x6744('0x26')]);if(_0x7e46b3[_0x6744('0x27')]){delete _0x7e46b3[_0x6744('0x27')];}_0x26f352[_0x6744('0x19')](_0x835999)['send'](_0x7e46b3);};}exports[_0x6744('0x28')]=function(_0x19c7d8,_0x4c6bf1){var _0x522800={},_0xa23129={},_0xb783db={'count':0x0,'rows':[]};var _0x1cef4a=_[_0x6744('0x29')](db[_0x6744('0x2a')][_0x6744('0x2b')],function(_0x427394){return{'name':_0x427394['fieldName'],'type':_0x427394[_0x6744('0x2c')][_0x6744('0x2d')]};});_0xa23129['model']=_[_0x6744('0x29')](_0x1cef4a,_0x6744('0x27'));_0xa23129[_0x6744('0x2e')]=_[_0x6744('0x2f')](_0x19c7d8[_0x6744('0x2e')]);_0xa23129[_0x6744('0x30')]=_[_0x6744('0x31')](_0xa23129[_0x6744('0x32')],_0xa23129['query']);_0x522800['attributes']=_[_0x6744('0x31')](_0xa23129[_0x6744('0x32')],qs[_0x6744('0x33')](_0x19c7d8[_0x6744('0x2e')][_0x6744('0x33')]));_0x522800['attributes']=_0x522800[_0x6744('0x34')][_0x6744('0x35')]?_0x522800[_0x6744('0x34')]:_0xa23129[_0x6744('0x32')];if(!_0x19c7d8[_0x6744('0x2e')]['hasOwnProperty'](_0x6744('0x36'))){_0x522800[_0x6744('0x1f')]=qs[_0x6744('0x1f')](_0x19c7d8[_0x6744('0x2e')][_0x6744('0x1f')]);_0x522800[_0x6744('0x1c')]=qs['offset'](_0x19c7d8[_0x6744('0x2e')]['offset']);}_0x522800[_0x6744('0x37')]=qs[_0x6744('0x38')](_0x19c7d8['query'][_0x6744('0x38')]);_0x522800['where']=qs['filters'](_['pick'](_0x19c7d8['query'],_0xa23129[_0x6744('0x30')]),_0x1cef4a);if(_0x19c7d8[_0x6744('0x2e')][_0x6744('0x39')]){_0x522800[_0x6744('0x3a')]=_['merge'](_0x522800['where'],{'$or':_[_0x6744('0x29')](_0x1cef4a,function(_0x286bf2){if(_0x286bf2[_0x6744('0x2c')]!==_0x6744('0x3b')){var _0x5788b4={};_0x5788b4[_0x286bf2[_0x6744('0x27')]]={'$like':'%'+_0x19c7d8[_0x6744('0x2e')]['filter']+'%'};return _0x5788b4;}})});}_0x522800=_[_0x6744('0x3c')]({},_0x522800,_0x19c7d8[_0x6744('0x3d')]);var _0x46faf2={'where':_0x522800[_0x6744('0x3a')]};return db[_0x6744('0x2a')][_0x6744('0x1e')](_0x46faf2)[_0x6744('0x23')](function(_0x1aff13){_0xb783db[_0x6744('0x1e')]=_0x1aff13;if(_0x19c7d8[_0x6744('0x2e')][_0x6744('0x3e')]){_0x522800[_0x6744('0x3f')]=[{'all':!![]}];}return db[_0x6744('0x2a')][_0x6744('0x40')](_0x522800);})[_0x6744('0x23')](function(_0x1a434a){_0xb783db['rows']=_0x1a434a;return _0xb783db;})[_0x6744('0x23')](respondWithFilteredResult(_0x4c6bf1,_0x522800))[_0x6744('0x41')](handleError(_0x4c6bf1,null));};exports['show']=function(_0x2357a8,_0x288db7){var _0x1d3282={'raw':!![],'where':{'id':_0x2357a8['params']['id']}},_0x19c8e2={};_0x19c8e2['model']=_['keys'](db['Attachment'][_0x6744('0x2b')]);_0x19c8e2['query']=_[_0x6744('0x2f')](_0x2357a8[_0x6744('0x2e')]);_0x19c8e2[_0x6744('0x30')]=_[_0x6744('0x31')](_0x19c8e2['model'],_0x19c8e2[_0x6744('0x2e')]);_0x1d3282[_0x6744('0x34')]=_[_0x6744('0x31')](_0x19c8e2[_0x6744('0x32')],qs[_0x6744('0x33')](_0x2357a8[_0x6744('0x2e')][_0x6744('0x33')]));_0x1d3282['attributes']=_0x1d3282['attributes'][_0x6744('0x35')]?_0x1d3282['attributes']:_0x19c8e2['model'];if(_0x2357a8[_0x6744('0x2e')]['includeAll']){_0x1d3282[_0x6744('0x3f')]=[{'all':!![]}];}_0x1d3282=_['merge']({},_0x1d3282,_0x2357a8[_0x6744('0x3d')]);return db['Attachment'][_0x6744('0x42')](_0x1d3282)['then'](handleEntityNotFound(_0x288db7,null))[_0x6744('0x23')](respondWithResult(_0x288db7,null))[_0x6744('0x41')](handleError(_0x288db7,null));};exports[_0x6744('0x43')]=function(_0x5e1991,_0x2e9954){var _0x1c349f={'where':{'id':_0x5e1991[_0x6744('0x44')]['id']}},_0x30cd47={};_0x30cd47[_0x6744('0x32')]=_[_0x6744('0x2f')](db[_0x6744('0x2a')][_0x6744('0x2b')]);_0x1c349f[_0x6744('0x34')]=_[_0x6744('0x31')](_0x30cd47[_0x6744('0x32')],qs[_0x6744('0x33')](_0x5e1991[_0x6744('0x2e')][_0x6744('0x33')]));_0x1c349f[_0x6744('0x34')]=_0x1c349f['attributes'][_0x6744('0x35')]?_0x1c349f[_0x6744('0x34')]:_0x30cd47[_0x6744('0x32')];if(_0x5e1991['query']['includeAll']){_0x1c349f[_0x6744('0x3f')]=[{'all':!![]}];}_0x1c349f=_['merge']({},_0x1c349f,_0x5e1991[_0x6744('0x3d')]);return db[_0x6744('0x2a')][_0x6744('0x42')](_0x1c349f)[_0x6744('0x23')](handleEntityNotFound(_0x2e9954,null))[_0x6744('0x23')](function(_0x406dc6){if(_0x406dc6){var _0x2a0789=_0x406dc6[_0x6744('0x45')]({'plain':!![]});_0x2a0789=qs[_0x6744('0x46')](_0x2a0789,['id',_0x6744('0x47'),_0x6744('0x48')]);_0x5e1991[_0x6744('0x49')]=_['omit'](_0x5e1991[_0x6744('0x49')],['id',_0x6744('0x47'),_0x6744('0x48')]);return db[_0x6744('0x2a')][_0x6744('0x4a')](_[_0x6744('0x3c')](_0x2a0789,_0x5e1991[_0x6744('0x49')]),{'include':_0x5e1991['query'][_0x6744('0x3e')]?[{'all':!![]}]:undefined});}})[_0x6744('0x23')](respondWithResult(_0x2e9954,0xc9))['catch'](handleError(_0x2e9954,null));};exports[_0x6744('0x4b')]=function(_0x8e8a74,_0x40fb2e){if(_0x8e8a74[_0x6744('0x49')]['id']){delete _0x8e8a74[_0x6744('0x49')]['id'];}return db[_0x6744('0x2a')][_0x6744('0x42')]({'where':{'id':_0x8e8a74['params']['id']}})[_0x6744('0x23')](handleEntityNotFound(_0x40fb2e,null))[_0x6744('0x23')](saveUpdates(_0x8e8a74[_0x6744('0x49')],null))['then'](respondWithResult(_0x40fb2e,null))[_0x6744('0x41')](handleError(_0x40fb2e,null));};exports[_0x6744('0x24')]=function(_0x4354d5,_0x2df817){return db['Attachment'][_0x6744('0x42')]({'where':{'id':_0x4354d5[_0x6744('0x44')]['id']}})[_0x6744('0x23')](handleEntityNotFound(_0x2df817,null))[_0x6744('0x23')](removeEntity(_0x2df817,null))[_0x6744('0x41')](handleError(_0x2df817,null));};exports['create']=function(_0xe1c2e4,_0x452509,_0xddc70c){_0xe1c2e4[_0x6744('0x49')][_0x6744('0x27')]=_0xe1c2e4[_0x6744('0x4c')]['originalname'];_0xe1c2e4['body'][_0x6744('0x4d')]=_0xe1c2e4[_0x6744('0x4c')][_0x6744('0x4e')];_0xe1c2e4[_0x6744('0x49')][_0x6744('0x2c')]=_0xe1c2e4[_0x6744('0x4c')]['mimetype'];return db[_0x6744('0x2a')]['create'](_0xe1c2e4[_0x6744('0x49')])[_0x6744('0x23')](respondWithResult(_0x452509,0xc9))[_0x6744('0x41')](handleError(_0x452509,null));};exports[_0x6744('0x4f')]=function(_0x5f2124,_0x2af54b,_0x408cca){return db[_0x6744('0x2a')]['findOne']({'where':{'id':_0x5f2124[_0x6744('0x44')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x2af54b,null))[_0x6744('0x23')](function(_0x31dfba){if(_0x31dfba){var _0x5331a6=_0x31dfba[_0x6744('0x50')]!==null;var _0x2df9ab=path[_0x6744('0x51')](config[_0x6744('0x52')],'server/files/attachments/');if(_0x5331a6){_0x2df9ab=path[_0x6744('0x51')](_0x2df9ab,'offline-chat/');}var _0x1f5f39=path['join'](_0x2df9ab,_0x31dfba['basename']);return _0x2af54b[_0x6744('0x4f')](_0x1f5f39);}})[_0x6744('0x41')](handleError(_0x2af54b,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 18aeacd..e6fc8c7 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 _0xe22d=['moment','bluebird','request-promise','path','rimraf','./attachment.attributes','exports','define','Attachment','attachments','lodash','util','../../config/logger','api'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xe22d,0x114));var _0xde22=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xe22d[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xde22('0x0'));var util=require(_0xde22('0x1'));var logger=require(_0xde22('0x2'))(_0xde22('0x3'));var moment=require(_0xde22('0x4'));var BPromise=require(_0xde22('0x5'));var rp=require(_0xde22('0x6'));var fs=require('fs');var path=require(_0xde22('0x7'));var rimraf=require(_0xde22('0x8'));var config=require('../../config/environment');var attributes=require(_0xde22('0x9'));module[_0xde22('0xa')]=function(_0x23e719,_0x302d28){return _0x23e719[_0xde22('0xb')](_0xde22('0xc'),attributes,{'tableName':_0xde22('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6982=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./attachment.attributes','exports','Attachment','attachments','util','../../config/logger'];(function(_0x33d97a,_0x2b0786){var _0x4580b7=function(_0xb0b9d4){while(--_0xb0b9d4){_0x33d97a['push'](_0x33d97a['shift']());}};_0x4580b7(++_0x2b0786);}(_0x6982,0x15d));var _0x2698=function(_0x5a8d19,_0x21a494){_0x5a8d19=_0x5a8d19-0x0;var _0x23c925=_0x6982[_0x5a8d19];return _0x23c925;};'use strict';var _=require('lodash');var util=require(_0x2698('0x0'));var logger=require(_0x2698('0x1'))(_0x2698('0x2'));var moment=require(_0x2698('0x3'));var BPromise=require(_0x2698('0x4'));var rp=require(_0x2698('0x5'));var fs=require('fs');var path=require(_0x2698('0x6'));var rimraf=require(_0x2698('0x7'));var config=require(_0x2698('0x8'));var attributes=require(_0x2698('0x9'));module[_0x2698('0xa')]=function(_0x52346a,_0x446e5b){return _0x52346a['define'](_0x2698('0xb'),attributes,{'tableName':_0x2698('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index c0f2fd8..3181132 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 _0xf72b=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','Attachment,\x20%s,\x20%s','request\x20sent','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','CreateAttachment','Attachment','create','body','options','raw','debug','catch','lodash','moment','randomstring'];(function(_0x5ca353,_0x21eb37){var _0x4f2fe5=function(_0x14cd1b){while(--_0x14cd1b){_0x5ca353['push'](_0x5ca353['shift']());}};_0x4f2fe5(++_0x21eb37);}(_0xf72b,0x1d9));var _0xbf72=function(_0x4b0ba0,_0x56c36e){_0x4b0ba0=_0x4b0ba0-0x0;var _0x5386fd=_0xf72b[_0x4b0ba0];return _0x5386fd;};'use strict';var _=require(_0xbf72('0x0'));var util=require('util');var moment=require(_0xbf72('0x1'));var BPromise=require('bluebird');var rs=require(_0xbf72('0x2'));var fs=require('fs');var Redis=require(_0xbf72('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbf72('0x4'));var logger=require(_0xbf72('0x5'))(_0xbf72('0x6'));var config=require(_0xbf72('0x7'));var jayson=require(_0xbf72('0x8'));var client=jayson[_0xbf72('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41c11d,_0xc0842b,_0x119807){return new BPromise(function(_0xd0402c,_0xdd6177){return client[_0xbf72('0xa')](_0x41c11d,_0x119807)['then'](function(_0x455891){logger['info'](_0xbf72('0xb'),_0xc0842b,_0xbf72('0xc'));logger['debug'](_0xbf72('0xd'),_0xc0842b,_0xbf72('0xc'),JSON[_0xbf72('0xe')](_0x455891));if(_0x455891[_0xbf72('0xf')]){if(_0x455891[_0xbf72('0xf')][_0xbf72('0x10')]===0x1f4){logger[_0xbf72('0xf')](_0xbf72('0xb'),_0xc0842b,_0x455891['error'][_0xbf72('0x11')]);return _0xdd6177(_0x455891[_0xbf72('0xf')][_0xbf72('0x11')]);}logger['error'](_0xbf72('0xb'),_0xc0842b,_0x455891['error']['message']);return _0xd0402c(_0x455891['error'][_0xbf72('0x11')]);}else{logger[_0xbf72('0x12')](_0xbf72('0xb'),_0xc0842b,_0xbf72('0xc'));_0xd0402c(_0x455891[_0xbf72('0x13')][_0xbf72('0x11')]);}})['catch'](function(_0x266ce2){logger[_0xbf72('0xf')](_0xbf72('0xb'),_0xc0842b,_0x266ce2);_0xdd6177(_0x266ce2);});});}exports[_0xbf72('0x14')]=function(_0x27dadc){var _0x5b5fc9=this;return new Promise(function(_0x51d4c9,_0x1b8d73){return db[_0xbf72('0x15')][_0xbf72('0x16')](_0x27dadc[_0xbf72('0x17')],{'raw':_0x27dadc[_0xbf72('0x18')]?_0x27dadc[_0xbf72('0x18')][_0xbf72('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x2aecae){logger[_0xbf72('0x12')](_0xbf72('0x14'),_0x27dadc);logger[_0xbf72('0x1a')](_0xbf72('0x14'),_0x27dadc,JSON['stringify'](_0x2aecae));_0x51d4c9(_0x2aecae);})[_0xbf72('0x1b')](function(_0x1de926){logger['error'](_0xbf72('0x14'),_0x1de926[_0xbf72('0x11')],_0x27dadc);_0x1b8d73(_0x5b5fc9[_0xbf72('0xf')](0x1f4,_0x1de926['message']));});});}; \ No newline at end of file +var _0xb0d9=['Attachment,\x20%s,\x20%s','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','CreateAttachment','Attachment','create','body','options','raw','then','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','jayson/promise','client','http','request','info'];(function(_0x715d76,_0x402d60){var _0x48fe88=function(_0x4dd0ea){while(--_0x4dd0ea){_0x715d76['push'](_0x715d76['shift']());}};_0x48fe88(++_0x402d60);}(_0xb0d9,0x10c));var _0x9b0d=function(_0x347528,_0x19e795){_0x347528=_0x347528-0x0;var _0x481de7=_0xb0d9[_0x347528];return _0x481de7;};'use strict';var _=require(_0x9b0d('0x0'));var util=require(_0x9b0d('0x1'));var moment=require(_0x9b0d('0x2'));var BPromise=require(_0x9b0d('0x3'));var rs=require(_0x9b0d('0x4'));var fs=require('fs');var Redis=require(_0x9b0d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9b0d('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x9b0d('0x7'));var client=jayson[_0x9b0d('0x8')][_0x9b0d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x438e0a,_0x2c519d,_0x45c371){return new BPromise(function(_0x32ee67,_0x30cd11){return client[_0x9b0d('0xa')](_0x438e0a,_0x45c371)['then'](function(_0x479a06){logger[_0x9b0d('0xb')](_0x9b0d('0xc'),_0x2c519d,'request\x20sent');logger[_0x9b0d('0xd')](_0x9b0d('0xe'),_0x2c519d,'request\x20sent',JSON[_0x9b0d('0xf')](_0x479a06));if(_0x479a06[_0x9b0d('0x10')]){if(_0x479a06['error'][_0x9b0d('0x11')]===0x1f4){logger['error'](_0x9b0d('0xc'),_0x2c519d,_0x479a06[_0x9b0d('0x10')][_0x9b0d('0x12')]);return _0x30cd11(_0x479a06['error'][_0x9b0d('0x12')]);}logger['error'](_0x9b0d('0xc'),_0x2c519d,_0x479a06[_0x9b0d('0x10')]['message']);return _0x32ee67(_0x479a06[_0x9b0d('0x10')]['message']);}else{logger[_0x9b0d('0xb')](_0x9b0d('0xc'),_0x2c519d,_0x9b0d('0x13'));_0x32ee67(_0x479a06['result'][_0x9b0d('0x12')]);}})[_0x9b0d('0x14')](function(_0x49db91){logger['error']('Attachment,\x20%s,\x20%s',_0x2c519d,_0x49db91);_0x30cd11(_0x49db91);});});}exports[_0x9b0d('0x15')]=function(_0xd8bb89){var _0x41a5e2=this;return new Promise(function(_0x27ee1a,_0x54ccf1){return db[_0x9b0d('0x16')][_0x9b0d('0x17')](_0xd8bb89[_0x9b0d('0x18')],{'raw':_0xd8bb89[_0x9b0d('0x19')]?_0xd8bb89['options'][_0x9b0d('0x1a')]===undefined?!![]:![]:!![]})[_0x9b0d('0x1b')](function(_0xe5fb08){logger[_0x9b0d('0xb')](_0x9b0d('0x15'),_0xd8bb89);logger['debug'](_0x9b0d('0x15'),_0xd8bb89,JSON[_0x9b0d('0xf')](_0xe5fb08));_0x27ee1a(_0xe5fb08);})[_0x9b0d('0x14')](function(_0x14c01b){logger[_0x9b0d('0x10')](_0x9b0d('0x15'),_0x14c01b[_0x9b0d('0x12')],_0xd8bb89);_0x54ccf1(_0x41a5e2[_0x9b0d('0x10')](0x1f4,_0x14c01b[_0x9b0d('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 9479a6a..199e745 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(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xdb28,0x106));var _0x8db2=function(_0x1bcc37,_0x2a8c09){_0x1bcc37=_0x1bcc37-0x0;var _0x11a909=_0xdb28[_0x1bcc37];return _0x11a909;};'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(_0x354164,_0x4c30de){var _0x5db9a8=function(_0x319b08){while(--_0x319b08){_0x354164['push'](_0x354164['shift']());}};_0x5db9a8(++_0x4c30de);}(_0x5f66,0x1a0));var _0x65f6=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x5f66[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./attachment.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['download']);router['post'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);var upload=multer({'storage':multer[_0x65f6('0xe')]({'destination':function(_0x50d26d,_0x41a7fd,_0x571436){_0x571436(null,path['join'](config[_0x65f6('0xf')],'server/files/attachments/'));},'filename':function(_0x419819,_0x4862a5,_0x2f964a){_0x2f964a(null,util[_0x65f6('0x10')](_0x65f6('0x11'),Date[_0x65f6('0x12')](),_0x4862a5[_0x65f6('0x13')][_0x65f6('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x65f6('0x15')]('/',upload[_0x65f6('0x16')](_0x65f6('0x17')),controller[_0x65f6('0x18')]);router['put'](_0x65f6('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x65f6('0x19')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x1a')]);module[_0x65f6('0x1b')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index aeb9210..a78a39e 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 _0x621c=['minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb','../../config/environment','signToken','../../config/utils','authenticate','/login','profile','callback','google','use','clientID','secret','callbackURL','Setting','blockDuration','then','User','find','map','emails','admin','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','add'];(function(_0x172133,_0x10246b){var _0x2460e5=function(_0x3c4918){while(--_0x3c4918){_0x172133['push'](_0x172133['shift']());}};_0x2460e5(++_0x10246b);}(_0x621c,0xae));var _0xc621=function(_0x4342a4,_0x5c38d7){_0x4342a4=_0x4342a4-0x0;var _0x48fce6=_0x621c[_0x4342a4];return _0x48fce6;};'use strict';var _=require(_0xc621('0x0'));var passport=require(_0xc621('0x1'));var GoogleStrategy=require(_0xc621('0x2'))[_0xc621('0x3')];var moment=require('moment');var db=require(_0xc621('0x4'))['db'];var config=require(_0xc621('0x5'));var signToken=require('../../components/auth/service')[_0xc621('0x6')];var utils=require(_0xc621('0x7'));exports['login']=passport[_0xc621('0x8')]('google',{'failureRedirect':_0xc621('0x9'),'scope':[_0xc621('0xa'),'email'],'session':![]});exports[_0xc621('0xb')]=passport[_0xc621('0x8')](_0xc621('0xc'),{'failureRedirect':_0xc621('0x9'),'session':![]});passport[_0xc621('0xd')](new GoogleStrategy({'clientID':config[_0xc621('0xc')]?config[_0xc621('0xc')][_0xc621('0xe')]:'id','clientSecret':config['google']?config[_0xc621('0xc')]['clientSecret']:_0xc621('0xf'),'callbackURL':config[_0xc621('0xc')]?config['google'][_0xc621('0x10')]:''},function(_0x236a80,_0x1c3ee8,_0x21ebed,_0xd213cc){var _0xf4744a,_0x21ec5f;return db[_0xc621('0x11')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xc621('0x12')],'raw':!![]})[_0xc621('0x13')](function(_0xc5115f){_0xf4744a=_0xc5115f;return db[_0xc621('0x14')][_0xc621('0x15')]({'where':{'email':_[_0xc621('0x16')](_0x21ebed[_0xc621('0x17')],'value'),'role':{'$or':[_0xc621('0x18'),'user',_0xc621('0x19')]}}});})[_0xc621('0x13')](function(_0x18e92c){_0x21ec5f=_0x18e92c;if(_0x21ec5f){if(_0x21ec5f['disabled']){return _0xd213cc(_0xc621('0x1a'));}else if(_0xf4744a[_0xc621('0x12')]>0x0){if(_0x21ec5f[_0xc621('0x1b')]){if(moment(_0x21ec5f[_0xc621('0x1c')])[_0xc621('0x1d')](_0xf4744a[_0xc621('0x12')],_0xc621('0x1e'))>moment()){return _0xd213cc(_0xc621('0x1a'));}else{return utils[_0xc621('0x1f')](_0x21ec5f,0x0,![],null)['then'](function(){return utils[_0xc621('0x20')](_0x21ec5f);})['then'](function(){return _0xd213cc(null,_0x21ec5f);});}}else{return utils[_0xc621('0x20')](_0x21ec5f)[_0xc621('0x13')](function(){return _0xd213cc(null,_0x21ec5f);});}}else{return utils[_0xc621('0x20')](_0x21ec5f)[_0xc621('0x13')](function(){return _0xd213cc(null,_0x21ec5f);});}}return _0xd213cc(_0xc621('0x1a'));})[_0xc621('0x21')](function(_0x34c24f){_0xd213cc(_0x34c24f);});})); \ No newline at end of file +var _0x53d0=['../../config/environment','../../components/auth/service','signToken','../../config/utils','login','authenticate','google','profile','email','callback','/login','use','clientID','clientSecret','secret','Setting','findOne','allowedLoginAttempts','blockDuration','then','map','emails','admin','user','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','add','minutes','getLicense','passport','passport-google-oauth20','moment','../../mysqldb'];(function(_0x130209,_0x2cc129){var _0x155fb7=function(_0x891a60){while(--_0x891a60){_0x130209['push'](_0x130209['shift']());}};_0x155fb7(++_0x2cc129);}(_0x53d0,0x8c));var _0x053d=function(_0x114c76,_0xc937df){_0x114c76=_0x114c76-0x0;var _0xb5babf=_0x53d0[_0x114c76];return _0xb5babf;};'use strict';var _=require('lodash');var passport=require(_0x053d('0x0'));var GoogleStrategy=require(_0x053d('0x1'))['Strategy'];var moment=require(_0x053d('0x2'));var db=require(_0x053d('0x3'))['db'];var config=require(_0x053d('0x4'));var signToken=require(_0x053d('0x5'))[_0x053d('0x6')];var utils=require(_0x053d('0x7'));exports[_0x053d('0x8')]=passport[_0x053d('0x9')](_0x053d('0xa'),{'failureRedirect':'/login','scope':[_0x053d('0xb'),_0x053d('0xc')],'session':![]});exports[_0x053d('0xd')]=passport['authenticate'](_0x053d('0xa'),{'failureRedirect':_0x053d('0xe'),'session':![]});passport[_0x053d('0xf')](new GoogleStrategy({'clientID':config['google']?config['google'][_0x053d('0x10')]:'id','clientSecret':config[_0x053d('0xa')]?config[_0x053d('0xa')][_0x053d('0x11')]:_0x053d('0x12'),'callbackURL':config[_0x053d('0xa')]?config[_0x053d('0xa')]['callbackURL']:''},function(_0x372a67,_0x1832bf,_0x44a7f9,_0x1768a3){var _0x2a4724,_0x21492e;return db[_0x053d('0x13')][_0x053d('0x14')]({'where':{'id':0x1},'attributes':[_0x053d('0x15'),_0x053d('0x16')],'raw':!![]})[_0x053d('0x17')](function(_0x37ef8b){_0x2a4724=_0x37ef8b;return db['User']['find']({'where':{'email':_[_0x053d('0x18')](_0x44a7f9[_0x053d('0x19')],'value'),'role':{'$or':[_0x053d('0x1a'),_0x053d('0x1b'),_0x053d('0x1c')]}}});})[_0x053d('0x17')](function(_0x22103b){_0x21492e=_0x22103b;if(_0x21492e){if(_0x21492e[_0x053d('0x1d')]){return _0x1768a3(_0x053d('0x1e'));}else if(_0x2a4724[_0x053d('0x16')]>0x0){if(_0x21492e[_0x053d('0x1f')]){if(moment(_0x21492e[_0x053d('0x20')])[_0x053d('0x21')](_0x2a4724['blockDuration'],_0x053d('0x22'))>moment()){return _0x1768a3(_0x053d('0x1e'));}else{return utils['clearBlockUser'](_0x21492e,0x0,![],null)[_0x053d('0x17')](function(){return utils[_0x053d('0x23')](_0x21492e);})[_0x053d('0x17')](function(){return _0x1768a3(null,_0x21492e);});}}else{return utils[_0x053d('0x23')](_0x21492e)['then'](function(){return _0x1768a3(null,_0x21492e);});}}else{return utils[_0x053d('0x23')](_0x21492e)[_0x053d('0x17')](function(){return _0x1768a3(null,_0x21492e);});}}return _0x1768a3(_0x053d('0x1e'));})['catch'](function(_0x2f2ff2){_0x1768a3(_0x2f2ff2);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 0609bb1..fb92233 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 _0x160c=['setTokenCookie','exports','express','passport','Router','../user/user.controller.js','../../components/auth/service','get','/callback','callback','isMiddleware','login'];(function(_0x202cb2,_0x3a7144){var _0x5b9442=function(_0x418c03){while(--_0x418c03){_0x202cb2['push'](_0x202cb2['shift']());}};_0x5b9442(++_0x3a7144);}(_0x160c,0x122));var _0xc160=function(_0x393fac,_0xbf712a){_0x393fac=_0x393fac-0x0;var _0x29c3a6=_0x160c[_0x393fac];return _0x29c3a6;};'use strict';var express=require(_0xc160('0x0'));var passport=require(_0xc160('0x1'));var router=express[_0xc160('0x2')]();var controller=require('./authGoogle.controller');var userController=require(_0xc160('0x3'));var authService=require(_0xc160('0x4'));router[_0xc160('0x5')]('/',controller['login']);router[_0xc160('0x5')](_0xc160('0x6'),controller[_0xc160('0x7')],authService[_0xc160('0x8')],userController[_0xc160('0x9')],authService[_0xc160('0xa')]);module[_0xc160('0xb')]=router; \ No newline at end of file +var _0xea52=['isMiddleware','setTokenCookie','exports','passport','Router','login','get','/callback','callback'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xea52,0x162));var _0x2ea5=function(_0x4007b1,_0x206901){_0x4007b1=_0x4007b1-0x0;var _0x108d6c=_0xea52[_0x4007b1];return _0x108d6c;};'use strict';var express=require('express');var passport=require(_0x2ea5('0x0'));var router=express[_0x2ea5('0x1')]();var controller=require('./authGoogle.controller');var userController=require('../user/user.controller.js');var authService=require('../../components/auth/service');router['get']('/',controller[_0x2ea5('0x2')]);router[_0x2ea5('0x3')](_0x2ea5('0x4'),controller[_0x2ea5('0x5')],authService[_0x2ea5('0x6')],userController['login'],authService[_0x2ea5('0x7')]);module[_0x2ea5('0x8')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 8434894..86ba300 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 _0xa0b2=['catch','MailAccount','email','MailServerOut','Smtp','service','host','port','secure','authentication','pass','merge','\x22%s\x22\x20<%s>','user','request','SendMail','error','format','message','stringify','status','login','authenticate','local','json','online','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','Reset\x20Email\x20sent!','reset','User','find','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','passwordHistoryLimit','validatePasswordPattern','enforcePasswordHistory','previousPasswords','Password\x20reset!','use','util','passport','passport-local','Strategy','randomstring','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','role','disabled','blocked','blockedAt','loginAttempts','admin','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','add','clearBlockUser','minutes','getLicense'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xa0b2,0x18c));var _0x2a0b=function(_0x33ebf5,_0x258ec6){_0x33ebf5=_0x33ebf5-0x0;var _0x66957b=_0xa0b2[_0x33ebf5];return _0x66957b;};'use strict';var util=require(_0x2a0b('0x0'));var passport=require(_0x2a0b('0x1'));var LocalStrategy=require(_0x2a0b('0x2'))[_0x2a0b('0x3')];var jayson=require('jayson/promise');var _=require('lodash');var rs=require(_0x2a0b('0x4'));var moment=require('moment');var db=require('../../mysqldb')['db'];var authService=require(_0x2a0b('0x5'));var utils=require(_0x2a0b('0x6'));var client=jayson[_0x2a0b('0x7')][_0x2a0b('0x8')]({'port':0x232b});function localAuthenticate(_0x1e570a,_0x5ef522,_0x23473f,_0x448b1d){var _0x60bfb3,_0x46b888;return db[_0x2a0b('0x9')][_0x2a0b('0xa')]({'where':{'id':0x1},'attributes':[_0x2a0b('0xb'),_0x2a0b('0xc')],'raw':!![]})[_0x2a0b('0xd')](function(_0x3937fd){_0x60bfb3=_0x3937fd;return _0x1e570a[_0x2a0b('0xa')]({'attributes':['id',_0x2a0b('0xe'),_0x2a0b('0xf'),_0x2a0b('0x10'),_0x2a0b('0x11'),_0x2a0b('0x12'),_0x2a0b('0x13'),_0x2a0b('0x14'),_0x2a0b('0x15')],'where':{'name':_0x5ef522,'role':{'$or':[_0x2a0b('0x16'),'user',_0x2a0b('0x17')]}}});})[_0x2a0b('0xd')](function(_0x34dfb9){if(!_0x34dfb9||_0x34dfb9&&_0x34dfb9[_0x2a0b('0xe')]!==_0x5ef522){throw new Error(_0x2a0b('0x18'));}else{_0x46b888=_0x34dfb9;return _0x46b888;}})[_0x2a0b('0xd')](function(){_0x46b888['authenticate'](_0x23473f,function(_0x16ce27,_0x1abf42){var _0x4d0a11=_0x46b888[_0x2a0b('0x15')]+0x1;if(_0x16ce27){return _0x448b1d(_0x16ce27);}else if(!_0x1abf42){if(_0x46b888[_0x2a0b('0x12')]){return _0x448b1d(null,![],{'message':_0x2a0b('0x18')});}else if(_0x60bfb3[_0x2a0b('0xb')]>0x0){if(_0x46b888[_0x2a0b('0x13')]){if(_0x60bfb3[_0x2a0b('0xc')]>0x0){if(moment(_0x46b888['blockedAt'])[_0x2a0b('0x19')](_0x60bfb3[_0x2a0b('0xc')],'minutes')>moment()){return _0x448b1d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['clearBlockUser'](_0x46b888,_0x4d0a11,![],null)['then'](function(){return _0x448b1d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x448b1d(null,![],{'message':_0x2a0b('0x18')});}}else{if(_0x4d0a11>=_0x60bfb3[_0x2a0b('0xb')]){return utils[_0x2a0b('0x1a')](_0x46b888,0x0,!![],moment())[_0x2a0b('0xd')](function(){return _0x448b1d(null,![],{'message':_0x2a0b('0x18')});});}else{return utils[_0x2a0b('0x1a')](_0x46b888,_0x4d0a11,![],null)['then'](function(){return _0x448b1d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x448b1d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x46b888[_0x2a0b('0x12')]){return _0x448b1d(null,![],{'message':_0x2a0b('0x18')});}else if(_0x60bfb3[_0x2a0b('0xb')]>0x0){if(_0x46b888[_0x2a0b('0x13')]){if(_0x60bfb3[_0x2a0b('0xc')]>0x0){if(moment(_0x46b888['blockedAt'])[_0x2a0b('0x19')](_0x60bfb3[_0x2a0b('0xc')],_0x2a0b('0x1b'))>moment()){return _0x448b1d(null,![],{'message':_0x2a0b('0x18')});}else{return utils['clearBlockUser'](_0x46b888,0x0,![],null)[_0x2a0b('0xd')](function(){return utils[_0x2a0b('0x1c')](_0x46b888);})[_0x2a0b('0xd')](function(){return _0x448b1d(null,_0x46b888);});}}else{return _0x448b1d(null,![],{'message':_0x2a0b('0x18')});}}else{return utils[_0x2a0b('0x1a')](_0x46b888,0x0,![],null)['then'](function(){return utils['getLicense'](_0x46b888);})['then'](function(){return _0x448b1d(null,_0x46b888);})[_0x2a0b('0x1d')](function(_0x1c5911){return _0x448b1d(null,![],_0x1c5911);});}}else{if(_0x46b888['blocked']){return _0x448b1d(null,![],{'message':_0x2a0b('0x18')});}else{return utils[_0x2a0b('0x1c')](_0x46b888)[_0x2a0b('0xd')](function(){return _0x448b1d(null,_0x46b888);});}}}});})[_0x2a0b('0x1d')](function(_0x5e55cd){return _0x448b1d(null,![],_0x5e55cd);});}function sendServiceMail(_0xa7d4f6){return db[_0x2a0b('0x1e')]['find']({'where':{'service':!![]},'attributes':['id',_0x2a0b('0xe'),_0x2a0b('0x1f')],'include':[{'model':db[_0x2a0b('0x20')],'as':_0x2a0b('0x21')}]})[_0x2a0b('0xd')](function(_0x3868ef){if(!_0x3868ef){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x2d445a={'tls':{'rejectUnauthorized':![]}};if(_0x3868ef[_0x2a0b('0x21')][_0x2a0b('0x22')]){_0x2d445a['service']=_0x3868ef['Smtp']['service'];}else{_0x2d445a[_0x2a0b('0x23')]=_0x3868ef[_0x2a0b('0x21')][_0x2a0b('0x23')];_0x2d445a[_0x2a0b('0x24')]=_0x3868ef[_0x2a0b('0x21')][_0x2a0b('0x24')];_0x2d445a[_0x2a0b('0x25')]=_0x3868ef['Smtp'][_0x2a0b('0x25')];}if(_0x3868ef['Smtp'][_0x2a0b('0x26')]){_0x2d445a['auth']={'user':_0x3868ef[_0x2a0b('0x21')]['user'],'pass':_0x3868ef[_0x2a0b('0x21')][_0x2a0b('0x27')]};}var _0x32092e={'account':_0x2d445a,'message':_[_0x2a0b('0x28')]({'from':util['format'](_0x2a0b('0x29'),_0x3868ef[_0x2a0b('0xe')],_0x3868ef[_0x2a0b('0x1f')]||_0x3868ef[_0x2a0b('0x21')][_0x2a0b('0x2a')])},_0xa7d4f6)};return client[_0x2a0b('0x2b')](_0x2a0b('0x2c'),_0x32092e);})[_0x2a0b('0xd')](function(_0x3d95f5){if(_0x3d95f5[_0x2a0b('0x2d')]){throw new Error(util[_0x2a0b('0x2e')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x3d95f5[_0x2a0b('0x2d')][_0x2a0b('0x2f')]||JSON[_0x2a0b('0x30')](_0x3d95f5['error'])));}return!![];});}function handleError(_0x2b1111,_0x5eaf23,_0x230adb){return _0x2b1111[_0x2a0b('0x31')](_0x5eaf23||0x1f4)['send']({'message':_0x230adb?_0x230adb['message']||_0x230adb:''});}exports[_0x2a0b('0x32')]=function(_0x5dd3e6,_0x5dc94f,_0x5cd81b){passport[_0x2a0b('0x33')](_0x2a0b('0x34'),function(_0x4b7d64,_0x901a81,_0x2be60a){var _0x4244b3=_0x4b7d64||_0x2be60a;if(_0x4244b3){return handleError(_0x5dc94f,0x191,_0x4244b3);}if(!_0x901a81){return handleError(_0x5dc94f,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x1f9522={'payload':{'id':_0x901a81['id'],'role':_0x901a81[_0x2a0b('0x11')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x1f9522)[_0x2a0b('0xd')](function(_0x12679d){_0x5dc94f[_0x2a0b('0x35')]({'id':_0x901a81['id'],'token':_0x12679d,'statusCall':'','isAlreadyLogged':_0x901a81[_0x2a0b('0x36')]});});}})(_0x5dd3e6,_0x5dc94f,_0x5cd81b);};exports['forgot']=function(_0x4d38aa,_0x31a7ae,_0x458ca2){if(!_0x4d38aa[_0x2a0b('0x37')][_0x2a0b('0x1f')]){return handleError(_0x31a7ae,0x1f4,{'message':_0x2a0b('0x38')});}var _0x92075b=rs[_0x2a0b('0x39')]();_0x4d38aa['body']['email']=_0x4d38aa['body'][_0x2a0b('0x1f')][_0x2a0b('0x3a')]()[_0x2a0b('0x3b')]();var _0x524f2f;return db[_0x2a0b('0x9')][_0x2a0b('0xa')]({'where':{'id':0x1},'attributes':[_0x2a0b('0xb'),_0x2a0b('0xc')],'raw':!![]})[_0x2a0b('0xd')](function(_0x4e4830){_0x524f2f=_0x4e4830;return db['User']['find']({'where':{'email':_0x4d38aa['body'][_0x2a0b('0x1f')]}});})[_0x2a0b('0xd')](function(_0x4de53b){if(!_0x4de53b){throw new Error(_0x2a0b('0x3c'));}if(_0x4de53b[_0x2a0b('0x12')]){throw new Error(_0x2a0b('0x3d'));}if(_0x4de53b[_0x2a0b('0x13')]){if(moment(_0x4de53b[_0x2a0b('0x14')])[_0x2a0b('0x19')](_0x524f2f[_0x2a0b('0xc')],_0x2a0b('0x1b'))>moment()){throw new Error(_0x2a0b('0x3e'));}else{_0x4de53b[_0x2a0b('0x13')]=![];_0x4de53b['blockedAt']=null;}}_0x4de53b[_0x2a0b('0x3f')]=_0x92075b;_0x4de53b[_0x2a0b('0x40')]=Date[_0x2a0b('0x41')]()+0x36ee80;return _0x4de53b[_0x2a0b('0x42')]();})[_0x2a0b('0xd')](function(){return sendServiceMail({'to':_0x4d38aa['body'][_0x2a0b('0x1f')],'subject':_0x2a0b('0x43'),'text':_0x2a0b('0x44')+_0x2a0b('0x45')+_0x2a0b('0x46')+_0x4d38aa['headers']['host']+'/reset/'+_0x92075b+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x2a0b('0xd')](function(){_0x31a7ae['status'](0xc8)['send']({'message':_0x2a0b('0x47')});})['catch'](function(_0x123f9c){return handleError(_0x31a7ae,0x1f4,_0x123f9c);});};exports[_0x2a0b('0x48')]=function(_0x5b8b7c,_0x417262,_0x2b0c49){return db[_0x2a0b('0x49')][_0x2a0b('0x4a')]({'where':{'resetPasswordToken':_0x5b8b7c[_0x2a0b('0x4b')][_0x2a0b('0x4c')],'resetPasswordExpires':{'$gt':Date[_0x2a0b('0x41')]()}}})['then'](function(_0xdc3f65){if(!_0xdc3f65){throw new Error(_0x2a0b('0x4d'));}return db[_0x2a0b('0x9')][_0x2a0b('0xa')]({'attributes':['id',_0x2a0b('0x4e'),'enforcePasswordHistory',_0x2a0b('0x4f')]})[_0x2a0b('0xd')](function(_0x2dfeb5){if(_0x2dfeb5[_0x2a0b('0x4e')])authService[_0x2a0b('0x50')](_0x5b8b7c['body']['password']);if(!_0x2dfeb5[_0x2a0b('0x51')]||!_0xdc3f65[_0x2a0b('0x52')])return _0xdc3f65;authService['validatePasswordHistory'](_0x5b8b7c[_0x2a0b('0x37')][_0x2a0b('0xf')],_0xdc3f65['previousPasswords'],_0x2dfeb5[_0x2a0b('0x4f')]);return _0xdc3f65;})[_0x2a0b('0xd')](function(){_0xdc3f65[_0x2a0b('0xf')]=_0x5b8b7c['body'][_0x2a0b('0xf')];_0xdc3f65[_0x2a0b('0x3f')]=null;_0xdc3f65[_0x2a0b('0x40')]=null;return _0xdc3f65[_0x2a0b('0x42')]();});})[_0x2a0b('0xd')](function(){_0x417262['status'](0xc8)['send']({'message':_0x2a0b('0x53')});})['catch'](function(_0x4c698c){return handleError(_0x417262,0x1f4,_0x4c698c);});};passport[_0x2a0b('0x54')](new LocalStrategy({'usernameField':_0x2a0b('0xe'),'passwordField':_0x2a0b('0xf')},function(_0x2cf695,_0x271a2a,_0x95809){return localAuthenticate(db[_0x2a0b('0x49')],_0x2cf695,_0x271a2a,_0x95809);})); \ No newline at end of file +var _0x2697=['json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','catch','reset','User','params','token','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','validatePasswordHistory','password','previousPasswords','save','Password\x20reset!','use','passport','passport-local','Strategy','jayson/promise','lodash','moment','../../components/auth/service','../../config/utils','client','http','Setting','allowedLoginAttempts','blockDuration','name','salt','disabled','blocked','blockedAt','admin','user','then','authenticate','loginAttempts','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','add','clearBlockUser','minutes','getLicense','find','email','MailServerOut','Smtp','service','host','port','secure','auth','merge','format','\x22%s\x22\x20<%s>','request','SendMail','error','message','stringify','status','send','Something\x20went\x20wrong,\x20please\x20try\x20again.'];(function(_0x122e3d,_0x37718b){var _0xbb3437=function(_0xf749e){while(--_0xf749e){_0x122e3d['push'](_0x122e3d['shift']());}};_0xbb3437(++_0x37718b);}(_0x2697,0x120));var _0x7269=function(_0x4df85c,_0x248dfb){_0x4df85c=_0x4df85c-0x0;var _0x4e2a61=_0x2697[_0x4df85c];return _0x4e2a61;};'use strict';var util=require('util');var passport=require(_0x7269('0x0'));var LocalStrategy=require(_0x7269('0x1'))[_0x7269('0x2')];var jayson=require(_0x7269('0x3'));var _=require(_0x7269('0x4'));var rs=require('randomstring');var moment=require(_0x7269('0x5'));var db=require('../../mysqldb')['db'];var authService=require(_0x7269('0x6'));var utils=require(_0x7269('0x7'));var client=jayson[_0x7269('0x8')][_0x7269('0x9')]({'port':0x232b});function localAuthenticate(_0x438f7c,_0x1e47e3,_0x20ddbf,_0x2c968f){var _0x328097,_0x572969;return db[_0x7269('0xa')]['findOne']({'where':{'id':0x1},'attributes':[_0x7269('0xb'),_0x7269('0xc')],'raw':!![]})['then'](function(_0x3c21f9){_0x328097=_0x3c21f9;return _0x438f7c['findOne']({'attributes':['id',_0x7269('0xd'),'password',_0x7269('0xe'),'role',_0x7269('0xf'),_0x7269('0x10'),_0x7269('0x11'),'loginAttempts'],'where':{'name':_0x1e47e3,'role':{'$or':[_0x7269('0x12'),_0x7269('0x13'),'agent']}}});})[_0x7269('0x14')](function(_0x2de29b){if(!_0x2de29b||_0x2de29b&&_0x2de29b[_0x7269('0xd')]!==_0x1e47e3){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x572969=_0x2de29b;return _0x572969;}})[_0x7269('0x14')](function(){_0x572969[_0x7269('0x15')](_0x20ddbf,function(_0x2d78a0,_0x2c28f8){var _0x26547f=_0x572969[_0x7269('0x16')]+0x1;if(_0x2d78a0){return _0x2c968f(_0x2d78a0);}else if(!_0x2c28f8){if(_0x572969[_0x7269('0xf')]){return _0x2c968f(null,![],{'message':_0x7269('0x17')});}else if(_0x328097['allowedLoginAttempts']>0x0){if(_0x572969[_0x7269('0x10')]){if(_0x328097[_0x7269('0xc')]>0x0){if(moment(_0x572969[_0x7269('0x11')])[_0x7269('0x18')](_0x328097['blockDuration'],'minutes')>moment()){return _0x2c968f(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x7269('0x19')](_0x572969,_0x26547f,![],null)[_0x7269('0x14')](function(){return _0x2c968f(null,![],{'message':_0x7269('0x17')});});}}else{return _0x2c968f(null,![],{'message':_0x7269('0x17')});}}else{if(_0x26547f>=_0x328097[_0x7269('0xb')]){return utils[_0x7269('0x19')](_0x572969,0x0,!![],moment())[_0x7269('0x14')](function(){return _0x2c968f(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils['clearBlockUser'](_0x572969,_0x26547f,![],null)['then'](function(){return _0x2c968f(null,![],{'message':_0x7269('0x17')});});}}}else{return _0x2c968f(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x572969[_0x7269('0xf')]){return _0x2c968f(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x328097[_0x7269('0xb')]>0x0){if(_0x572969[_0x7269('0x10')]){if(_0x328097['blockDuration']>0x0){if(moment(_0x572969[_0x7269('0x11')])[_0x7269('0x18')](_0x328097['blockDuration'],_0x7269('0x1a'))>moment()){return _0x2c968f(null,![],{'message':_0x7269('0x17')});}else{return utils[_0x7269('0x19')](_0x572969,0x0,![],null)[_0x7269('0x14')](function(){return utils['getLicense'](_0x572969);})[_0x7269('0x14')](function(){return _0x2c968f(null,_0x572969);});}}else{return _0x2c968f(null,![],{'message':_0x7269('0x17')});}}else{return utils[_0x7269('0x19')](_0x572969,0x0,![],null)[_0x7269('0x14')](function(){return utils[_0x7269('0x1b')](_0x572969);})[_0x7269('0x14')](function(){return _0x2c968f(null,_0x572969);})['catch'](function(_0x198b59){return _0x2c968f(null,![],_0x198b59);});}}else{if(_0x572969[_0x7269('0x10')]){return _0x2c968f(null,![],{'message':_0x7269('0x17')});}else{return utils[_0x7269('0x1b')](_0x572969)[_0x7269('0x14')](function(){return _0x2c968f(null,_0x572969);});}}}});})['catch'](function(_0x33c43a){return _0x2c968f(null,![],_0x33c43a);});}function sendServiceMail(_0x470e5c){return db['MailAccount'][_0x7269('0x1c')]({'where':{'service':!![]},'attributes':['id','name',_0x7269('0x1d')],'include':[{'model':db[_0x7269('0x1e')],'as':_0x7269('0x1f')}]})[_0x7269('0x14')](function(_0x468d0b){if(!_0x468d0b){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x43e363={'tls':{'rejectUnauthorized':![]}};if(_0x468d0b[_0x7269('0x1f')][_0x7269('0x20')]){_0x43e363[_0x7269('0x20')]=_0x468d0b['Smtp'][_0x7269('0x20')];}else{_0x43e363[_0x7269('0x21')]=_0x468d0b['Smtp']['host'];_0x43e363[_0x7269('0x22')]=_0x468d0b[_0x7269('0x1f')][_0x7269('0x22')];_0x43e363[_0x7269('0x23')]=_0x468d0b[_0x7269('0x1f')][_0x7269('0x23')];}if(_0x468d0b['Smtp']['authentication']){_0x43e363[_0x7269('0x24')]={'user':_0x468d0b[_0x7269('0x1f')]['user'],'pass':_0x468d0b[_0x7269('0x1f')]['pass']};}var _0x1f244c={'account':_0x43e363,'message':_[_0x7269('0x25')]({'from':util[_0x7269('0x26')](_0x7269('0x27'),_0x468d0b[_0x7269('0xd')],_0x468d0b[_0x7269('0x1d')]||_0x468d0b[_0x7269('0x1f')]['user'])},_0x470e5c)};return client[_0x7269('0x28')](_0x7269('0x29'),_0x1f244c);})['then'](function(_0x747178){if(_0x747178[_0x7269('0x2a')]){throw new Error(util[_0x7269('0x26')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x747178[_0x7269('0x2a')][_0x7269('0x2b')]||JSON[_0x7269('0x2c')](_0x747178[_0x7269('0x2a')])));}return!![];});}function handleError(_0x487f25,_0x285274,_0xe5d1b9){return _0x487f25[_0x7269('0x2d')](_0x285274||0x1f4)[_0x7269('0x2e')]({'message':_0xe5d1b9?_0xe5d1b9[_0x7269('0x2b')]||_0xe5d1b9:''});}exports['login']=function(_0x1deb1a,_0x223faf,_0x301a10){passport['authenticate']('local',function(_0x399efe,_0x51a7ba,_0x2873fa){var _0x492a1e=_0x399efe||_0x2873fa;if(_0x492a1e){return handleError(_0x223faf,0x191,_0x492a1e);}if(!_0x51a7ba){return handleError(_0x223faf,0x194,{'message':_0x7269('0x2f')});}else{var _0x4d4a04={'payload':{'id':_0x51a7ba['id'],'role':_0x51a7ba['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x4d4a04)[_0x7269('0x14')](function(_0x2265ac){_0x223faf[_0x7269('0x30')]({'id':_0x51a7ba['id'],'token':_0x2265ac,'statusCall':'','isAlreadyLogged':_0x51a7ba[_0x7269('0x31')]});});}})(_0x1deb1a,_0x223faf,_0x301a10);};exports[_0x7269('0x32')]=function(_0x470982,_0x1fd570,_0x1ffa92){if(!_0x470982[_0x7269('0x33')][_0x7269('0x1d')]){return handleError(_0x1fd570,0x1f4,{'message':_0x7269('0x34')});}var _0x4eb641=rs[_0x7269('0x35')]();_0x470982[_0x7269('0x33')][_0x7269('0x1d')]=_0x470982[_0x7269('0x33')][_0x7269('0x1d')][_0x7269('0x36')]()[_0x7269('0x37')]();var _0x2a67c3;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0x7269('0xb'),_0x7269('0xc')],'raw':!![]})['then'](function(_0x54676d){_0x2a67c3=_0x54676d;return db['User'][_0x7269('0x1c')]({'where':{'email':_0x470982[_0x7269('0x33')]['email']}});})[_0x7269('0x14')](function(_0x1c4901){if(!_0x1c4901){throw new Error(_0x7269('0x38'));}if(_0x1c4901[_0x7269('0xf')]){throw new Error(_0x7269('0x39'));}if(_0x1c4901['blocked']){if(moment(_0x1c4901['blockedAt'])[_0x7269('0x18')](_0x2a67c3[_0x7269('0xc')],_0x7269('0x1a'))>moment()){throw new Error(_0x7269('0x3a'));}else{_0x1c4901[_0x7269('0x10')]=![];_0x1c4901['blockedAt']=null;}}_0x1c4901[_0x7269('0x3b')]=_0x4eb641;_0x1c4901[_0x7269('0x3c')]=Date['now']()+0x36ee80;return _0x1c4901['save']();})['then'](function(){return sendServiceMail({'to':_0x470982[_0x7269('0x33')][_0x7269('0x1d')],'subject':_0x7269('0x3d'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x7269('0x3e')+_0x7269('0x3f')+_0x470982[_0x7269('0x40')][_0x7269('0x21')]+'/reset/'+_0x4eb641+'\x0a\x0a'+_0x7269('0x41')});})[_0x7269('0x14')](function(){_0x1fd570[_0x7269('0x2d')](0xc8)[_0x7269('0x2e')]({'message':_0x7269('0x42')});})[_0x7269('0x43')](function(_0x80dba9){return handleError(_0x1fd570,0x1f4,_0x80dba9);});};exports[_0x7269('0x44')]=function(_0x5f34d3,_0x23d91b,_0x51de71){return db[_0x7269('0x45')][_0x7269('0x1c')]({'where':{'resetPasswordToken':_0x5f34d3[_0x7269('0x46')][_0x7269('0x47')],'resetPasswordExpires':{'$gt':Date[_0x7269('0x48')]()}}})['then'](function(_0x52b0f0){if(!_0x52b0f0){throw new Error(_0x7269('0x49'));}return db[_0x7269('0xa')]['findOne']({'attributes':['id',_0x7269('0x4a'),_0x7269('0x4b'),_0x7269('0x4c')]})['then'](function(_0x13c173){if(_0x13c173[_0x7269('0x4a')])authService[_0x7269('0x4d')](_0x5f34d3['body']['password']);if(!_0x13c173[_0x7269('0x4b')]||!_0x52b0f0['previousPasswords'])return _0x52b0f0;authService[_0x7269('0x4e')](_0x5f34d3['body'][_0x7269('0x4f')],_0x52b0f0[_0x7269('0x50')],_0x13c173[_0x7269('0x4c')]);return _0x52b0f0;})[_0x7269('0x14')](function(){_0x52b0f0['password']=_0x5f34d3[_0x7269('0x33')]['password'];_0x52b0f0[_0x7269('0x3b')]=null;_0x52b0f0[_0x7269('0x3c')]=null;return _0x52b0f0[_0x7269('0x51')]();});})[_0x7269('0x14')](function(){_0x23d91b[_0x7269('0x2d')](0xc8)[_0x7269('0x2e')]({'message':_0x7269('0x52')});})[_0x7269('0x43')](function(_0x1e5ef1){return handleError(_0x23d91b,0x1f4,_0x1e5ef1);});};passport[_0x7269('0x53')](new LocalStrategy({'usernameField':'name','passwordField':_0x7269('0x4f')},function(_0x101470,_0x1bfc00,_0x1e564c){return localAuthenticate(db[_0x7269('0x45')],_0x101470,_0x1bfc00,_0x1e564c);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index b9c5bea..08e9b90 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 _0x85a0=['/forgot','express','Router','./authLocal.controller','post','login'];(function(_0x41bee9,_0x488434){var _0xe48148=function(_0x1d8e50){while(--_0x1d8e50){_0x41bee9['push'](_0x41bee9['shift']());}};_0xe48148(++_0x488434);}(_0x85a0,0x199));var _0x085a=function(_0x4dac50,_0x1e67da){_0x4dac50=_0x4dac50-0x0;var _0xc707cf=_0x85a0[_0x4dac50];return _0xc707cf;};'use strict';var express=require(_0x085a('0x0'));var router=express[_0x085a('0x1')]();var controller=require(_0x085a('0x2'));router[_0x085a('0x3')]('/',controller[_0x085a('0x4')]);router['post'](_0x085a('0x5'),controller['forgot']);router['post']('/reset/:token',controller['reset']);module['exports']=router; \ No newline at end of file +var _0x655b=['login','/forgot','forgot','/reset/:token','reset','exports','Router','post'];(function(_0x4508d4,_0x25d42f){var _0x220dab=function(_0x1e03e7){while(--_0x1e03e7){_0x4508d4['push'](_0x4508d4['shift']());}};_0x220dab(++_0x25d42f);}(_0x655b,0xfe));var _0xb655=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x655b[_0x5f1391];return _0x50ebe3;};'use strict';var express=require('express');var router=express[_0xb655('0x0')]();var controller=require('./authLocal.controller');router[_0xb655('0x1')]('/',controller[_0xb655('0x2')]);router[_0xb655('0x1')](_0xb655('0x3'),controller[_0xb655('0x4')]);router[_0xb655('0x1')](_0xb655('0x5'),controller[_0xb655('0x6')]);module[_0xb655('0x7')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 99393c2..491307d 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 _0x7856=['STRING','sequelize','exports'];(function(_0x3d78d7,_0x44acea){var _0x4b6784=function(_0x284157){while(--_0x284157){_0x3d78d7['push'](_0x3d78d7['shift']());}};_0x4b6784(++_0x44acea);}(_0x7856,0xa6));var _0x6785=function(_0x356d11,_0x5b8639){_0x356d11=_0x356d11-0x0;var _0x3a1bab=_0x7856[_0x356d11];return _0x3a1bab;};'use strict';var Sequelize=require(_0x6785('0x0'));module[_0x6785('0x1')]={'name':{'type':Sequelize[_0x6785('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x6785('0x2')]},'description':{'type':Sequelize[_0x6785('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file +var _0x09c4=['exports','STRING','BOOLEAN','INTEGER','sequelize'];(function(_0x21a9cf,_0x51f954){var _0x5d4ba7=function(_0x18d186){while(--_0x18d186){_0x21a9cf['push'](_0x21a9cf['shift']());}};_0x5d4ba7(++_0x51f954);}(_0x09c4,0x10d));var _0x409c=function(_0x550e29,_0x4047f){_0x550e29=_0x550e29-0x0;var _0x3515b6=_0x09c4[_0x550e29];return _0x3515b6;};'use strict';var Sequelize=require(_0x409c('0x0'));module[_0x409c('0x1')]={'name':{'type':Sequelize[_0x409c('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x409c('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x409c('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x409c('0x4')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 25ca344..132b426 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 _0x1eab=['hasOwnProperty','order','sort','where','filters','merge','filter','includeAll','include','findAll','rows','catch','show','params','options','create','body','find','addConditions','Condition','ids','omit','getConditions','findOne','nolimit','Action','getActions','pick','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','Automation','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length'];(function(_0x1211ca,_0x5c51c4){var _0xe206ad=function(_0x55e619){while(--_0x55e619){_0x1211ca['push'](_0x1211ca['shift']());}};_0xe206ad(++_0x5c51c4);}(_0x1eab,0x118));var _0xb1ea=function(_0x271ae0,_0x2e639b){_0x271ae0=_0x271ae0-0x0;var _0x383cfd=_0x1eab[_0x271ae0];return _0x383cfd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb1ea('0x0'));var zipdir=require(_0xb1ea('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb1ea('0x2'));var moment=require(_0xb1ea('0x3'));var BPromise=require(_0xb1ea('0x4'));var Mustache=require(_0xb1ea('0x5'));var util=require('util');var path=require(_0xb1ea('0x6'));var sox=require(_0xb1ea('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb1ea('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb1ea('0x9'));var jsforce=require(_0xb1ea('0xa'));var deskjs=require(_0xb1ea('0xb'));var toCsv=require('to-csv');var querystring=require(_0xb1ea('0xc'));var Papa=require(_0xb1ea('0xd'));var Redis=require(_0xb1ea('0xe'));var authService=require(_0xb1ea('0xf'));var qs=require(_0xb1ea('0x10'));var as=require(_0xb1ea('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb1ea('0x12'))(_0xb1ea('0x13'));var utils=require('../../config/utils');var config=require(_0xb1ea('0x14'));var licenseUtil=require(_0xb1ea('0x15'));var db=require(_0xb1ea('0x16'))['db'];function respondWithStatusCode(_0x15fb56,_0x2911aa){_0x2911aa=_0x2911aa||0xcc;return function(_0x5adec2){if(_0x5adec2){return _0x15fb56[_0xb1ea('0x17')](_0x2911aa);}return _0x15fb56[_0xb1ea('0x18')](_0x2911aa)[_0xb1ea('0x19')]();};}function respondWithResult(_0x20f869,_0x5e9b3d){_0x5e9b3d=_0x5e9b3d||0xc8;return function(_0x5dc937){if(_0x5dc937){return _0x20f869[_0xb1ea('0x18')](_0x5e9b3d)[_0xb1ea('0x1a')](_0x5dc937);}};}function respondWithFilteredResult(_0x186513,_0x3c8a36){return function(_0x3f431e){if(_0x3f431e){var _0x1fb520=typeof _0x3c8a36[_0xb1ea('0x1b')]==='undefined'&&typeof _0x3c8a36[_0xb1ea('0x1c')]===_0xb1ea('0x1d');var _0x2556f1=_0x3f431e[_0xb1ea('0x1e')];var _0x8b04c7=_0x1fb520?0x0:_0x3c8a36[_0xb1ea('0x1b')];var _0x5ddcba=_0x1fb520?_0x3f431e[_0xb1ea('0x1e')]:_0x3c8a36[_0xb1ea('0x1b')]+_0x3c8a36[_0xb1ea('0x1c')];var _0x3b2f22;if(_0x5ddcba>=_0x2556f1){_0x5ddcba=_0x2556f1;_0x3b2f22=0xc8;}else{_0x3b2f22=0xce;}_0x186513[_0xb1ea('0x18')](_0x3b2f22);return _0x186513[_0xb1ea('0x1f')](_0xb1ea('0x20'),_0x8b04c7+'-'+_0x5ddcba+'/'+_0x2556f1)[_0xb1ea('0x1a')](_0x3f431e);}return null;};}function patchUpdates(_0x1776e1){return function(_0x6680f6){try{jsonpatch[_0xb1ea('0x21')](_0x6680f6,_0x1776e1,!![]);}catch(_0x5a7604){return BPromise[_0xb1ea('0x22')](_0x5a7604);}return _0x6680f6[_0xb1ea('0x23')]();};}function saveUpdates(_0x3cdd79,_0x5ea4cf){return function(_0x20d2f5){if(_0x20d2f5){return _0x20d2f5[_0xb1ea('0x24')](_0x3cdd79)[_0xb1ea('0x25')](function(_0x5ddad5){return _0x5ddad5;});}return null;};}function removeEntity(_0x354efd,_0x1aad43){return function(_0x5176f7){if(_0x5176f7){return _0x5176f7[_0xb1ea('0x26')]()[_0xb1ea('0x25')](function(){_0x354efd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x35872f,_0x9db7bb){return function(_0x1de299){if(!_0x1de299){_0x35872f[_0xb1ea('0x17')](0x194);}return _0x1de299;};}function handleError(_0x11e516,_0x4f83cc){_0x4f83cc=_0x4f83cc||0x1f4;return function(_0x516bdc){logger[_0xb1ea('0x27')](_0x516bdc['stack']);if(_0x516bdc[_0xb1ea('0x28')]){delete _0x516bdc[_0xb1ea('0x28')];}_0x11e516[_0xb1ea('0x18')](_0x4f83cc)[_0xb1ea('0x29')](_0x516bdc);};}exports[_0xb1ea('0x2a')]=function(_0x5a6f09,_0x36e04a){var _0x415bea={},_0x6fd6ff={},_0x34a1a2={'count':0x0,'rows':[]};var _0x2b09c9=_[_0xb1ea('0x2b')](db[_0xb1ea('0x2c')][_0xb1ea('0x2d')],function(_0x4cc4d1){return{'name':_0x4cc4d1[_0xb1ea('0x2e')],'type':_0x4cc4d1[_0xb1ea('0x2f')][_0xb1ea('0x30')]};});_0x6fd6ff[_0xb1ea('0x31')]=_['map'](_0x2b09c9,'name');_0x6fd6ff[_0xb1ea('0x32')]=_[_0xb1ea('0x33')](_0x5a6f09['query']);_0x6fd6ff['filters']=_[_0xb1ea('0x34')](_0x6fd6ff[_0xb1ea('0x31')],_0x6fd6ff['query']);_0x415bea[_0xb1ea('0x35')]=_[_0xb1ea('0x34')](_0x6fd6ff[_0xb1ea('0x31')],qs[_0xb1ea('0x36')](_0x5a6f09['query'][_0xb1ea('0x36')]));_0x415bea[_0xb1ea('0x35')]=_0x415bea[_0xb1ea('0x35')][_0xb1ea('0x37')]?_0x415bea[_0xb1ea('0x35')]:_0x6fd6ff[_0xb1ea('0x31')];if(!_0x5a6f09[_0xb1ea('0x32')][_0xb1ea('0x38')]('nolimit')){_0x415bea['limit']=qs[_0xb1ea('0x1c')](_0x5a6f09[_0xb1ea('0x32')][_0xb1ea('0x1c')]);_0x415bea[_0xb1ea('0x1b')]=qs[_0xb1ea('0x1b')](_0x5a6f09[_0xb1ea('0x32')]['offset']);}_0x415bea[_0xb1ea('0x39')]=qs['sort'](_0x5a6f09[_0xb1ea('0x32')][_0xb1ea('0x3a')]);_0x415bea[_0xb1ea('0x3b')]=qs[_0xb1ea('0x3c')](_['pick'](_0x5a6f09['query'],_0x6fd6ff['filters']),_0x2b09c9);if(_0x5a6f09[_0xb1ea('0x32')]['filter']){_0x415bea[_0xb1ea('0x3b')]=_[_0xb1ea('0x3d')](_0x415bea['where'],{'$or':_['map'](_0x2b09c9,function(_0x45c73a){if(_0x45c73a[_0xb1ea('0x2f')]!=='VIRTUAL'){var _0x47a304={};_0x47a304[_0x45c73a['name']]={'$like':'%'+_0x5a6f09[_0xb1ea('0x32')][_0xb1ea('0x3e')]+'%'};return _0x47a304;}})});}_0x415bea=_['merge']({},_0x415bea,_0x5a6f09['options']);var _0x50a649={'where':_0x415bea[_0xb1ea('0x3b')]};return db['Automation'][_0xb1ea('0x1e')](_0x50a649)[_0xb1ea('0x25')](function(_0x589407){_0x34a1a2[_0xb1ea('0x1e')]=_0x589407;if(_0x5a6f09[_0xb1ea('0x32')][_0xb1ea('0x3f')]){_0x415bea[_0xb1ea('0x40')]=[{'all':!![]}];}return db[_0xb1ea('0x2c')][_0xb1ea('0x41')](_0x415bea);})['then'](function(_0x4e961b){_0x34a1a2[_0xb1ea('0x42')]=_0x4e961b;return _0x34a1a2;})[_0xb1ea('0x25')](respondWithFilteredResult(_0x36e04a,_0x415bea))[_0xb1ea('0x43')](handleError(_0x36e04a,null));};exports[_0xb1ea('0x44')]=function(_0x267538,_0x55c518){var _0x473dae={'raw':![],'where':{'id':_0x267538[_0xb1ea('0x45')]['id']}},_0x27d81c={};_0x27d81c['model']=_[_0xb1ea('0x33')](db[_0xb1ea('0x2c')]['rawAttributes']);_0x27d81c[_0xb1ea('0x32')]=_['keys'](_0x267538['query']);_0x27d81c[_0xb1ea('0x3c')]=_[_0xb1ea('0x34')](_0x27d81c['model'],_0x27d81c[_0xb1ea('0x32')]);_0x473dae[_0xb1ea('0x35')]=_[_0xb1ea('0x34')](_0x27d81c['model'],qs[_0xb1ea('0x36')](_0x267538[_0xb1ea('0x32')][_0xb1ea('0x36')]));_0x473dae['attributes']=_0x473dae[_0xb1ea('0x35')][_0xb1ea('0x37')]?_0x473dae[_0xb1ea('0x35')]:_0x27d81c[_0xb1ea('0x31')];if(_0x267538['query'][_0xb1ea('0x3f')]){_0x473dae[_0xb1ea('0x40')]=[{'all':!![]}];}_0x473dae=_[_0xb1ea('0x3d')]({},_0x473dae,_0x267538[_0xb1ea('0x46')]);return db[_0xb1ea('0x2c')]['find'](_0x473dae)['then'](handleEntityNotFound(_0x55c518,null))['then'](respondWithResult(_0x55c518,null))[_0xb1ea('0x43')](handleError(_0x55c518,null));};exports[_0xb1ea('0x47')]=function(_0x161c1e,_0x2a91f6){return db[_0xb1ea('0x2c')][_0xb1ea('0x47')](_0x161c1e[_0xb1ea('0x48')],{})['then'](respondWithResult(_0x2a91f6,0xc9))[_0xb1ea('0x43')](handleError(_0x2a91f6,null));};exports['update']=function(_0x4085bb,_0x457694){if(_0x4085bb[_0xb1ea('0x48')]['id']){delete _0x4085bb[_0xb1ea('0x48')]['id'];}return db[_0xb1ea('0x2c')][_0xb1ea('0x49')]({'where':{'id':_0x4085bb[_0xb1ea('0x45')]['id']}})[_0xb1ea('0x25')](handleEntityNotFound(_0x457694,null))[_0xb1ea('0x25')](saveUpdates(_0x4085bb['body'],null))['then'](respondWithResult(_0x457694,null))[_0xb1ea('0x43')](handleError(_0x457694,null));};exports['destroy']=function(_0x2e44a4,_0x1287a3){return db[_0xb1ea('0x2c')]['find']({'where':{'id':_0x2e44a4[_0xb1ea('0x45')]['id']}})[_0xb1ea('0x25')](handleEntityNotFound(_0x1287a3,null))[_0xb1ea('0x25')](removeEntity(_0x1287a3,null))[_0xb1ea('0x43')](handleError(_0x1287a3,null));};exports[_0xb1ea('0x4a')]=function(_0x67335d,_0x14a4d3,_0x417c4d){return db[_0xb1ea('0x4b')][_0xb1ea('0x49')]({'where':{'id':_0x67335d[_0xb1ea('0x45')]['id']}})[_0xb1ea('0x25')](handleEntityNotFound(_0x14a4d3,null))[_0xb1ea('0x25')](function(_0x439b08){if(_0x439b08){return _0x439b08[_0xb1ea('0x4a')](_0x67335d[_0xb1ea('0x48')][_0xb1ea('0x4c')],_[_0xb1ea('0x4d')](_0x67335d[_0xb1ea('0x48')],[_0xb1ea('0x4c'),'id'])||{});}})[_0xb1ea('0x25')](respondWithResult(_0x14a4d3,null))['catch'](handleError(_0x14a4d3,null));};exports[_0xb1ea('0x4e')]=function(_0x146ca1,_0x2d304e,_0x1b0cd4){var _0x1d69f4={};var _0x57416b={};var _0xfc1930;var _0x40e27f;return db[_0xb1ea('0x2c')][_0xb1ea('0x4f')]({'where':{'id':_0x146ca1['params']['id']}})[_0xb1ea('0x25')](handleEntityNotFound(_0x2d304e,null))[_0xb1ea('0x25')](function(_0x151981){if(_0x151981){_0xfc1930=_0x151981;_0x57416b[_0xb1ea('0x31')]=_[_0xb1ea('0x33')](db[_0xb1ea('0x4b')]['rawAttributes']);_0x57416b[_0xb1ea('0x32')]=_[_0xb1ea('0x33')](_0x146ca1['query']);_0x57416b[_0xb1ea('0x3c')]=_[_0xb1ea('0x34')](_0x57416b[_0xb1ea('0x31')],_0x57416b['query']);_0x1d69f4[_0xb1ea('0x35')]=_[_0xb1ea('0x34')](_0x57416b['model'],qs[_0xb1ea('0x36')](_0x146ca1[_0xb1ea('0x32')][_0xb1ea('0x36')]));_0x1d69f4['attributes']=_0x1d69f4['attributes']['length']?_0x1d69f4[_0xb1ea('0x35')]:_0x57416b[_0xb1ea('0x31')];_0x1d69f4[_0xb1ea('0x39')]=qs[_0xb1ea('0x3a')](_0x146ca1[_0xb1ea('0x32')][_0xb1ea('0x3a')]);_0x1d69f4[_0xb1ea('0x3b')]=qs[_0xb1ea('0x3c')](_['pick'](_0x146ca1['query'],_0x57416b[_0xb1ea('0x3c')]));if(_0x146ca1[_0xb1ea('0x32')][_0xb1ea('0x3e')]){_0x1d69f4[_0xb1ea('0x3b')]=_[_0xb1ea('0x3d')](_0x1d69f4[_0xb1ea('0x3b')],{'$or':_[_0xb1ea('0x2b')](_0x1d69f4['attributes'],function(_0x476514){var _0x4cdcdb={};_0x4cdcdb[_0x476514]={'$like':'%'+_0x146ca1[_0xb1ea('0x32')][_0xb1ea('0x3e')]+'%'};return _0x4cdcdb;})});}_0x1d69f4=_[_0xb1ea('0x3d')]({},_0x1d69f4,_0x146ca1[_0xb1ea('0x46')]);return _0xfc1930[_0xb1ea('0x4e')](_0x1d69f4);}})[_0xb1ea('0x25')](function(_0x52d614){if(_0x52d614){_0x40e27f=_0x52d614[_0xb1ea('0x37')];if(!_0x146ca1[_0xb1ea('0x32')][_0xb1ea('0x38')](_0xb1ea('0x50'))){_0x1d69f4['limit']=qs['limit'](_0x146ca1['query']['limit']);_0x1d69f4[_0xb1ea('0x1b')]=qs[_0xb1ea('0x1b')](_0x146ca1[_0xb1ea('0x32')]['offset']);}return _0xfc1930[_0xb1ea('0x4e')](_0x1d69f4);}})[_0xb1ea('0x25')](function(_0x55b739){if(_0x55b739){return _0x55b739?{'count':_0x40e27f,'rows':_0x55b739}:null;}})[_0xb1ea('0x25')](respondWithResult(_0x2d304e,null))[_0xb1ea('0x43')](handleError(_0x2d304e,null));};exports['addActions']=function(_0x58e3c9,_0x22a1d2,_0x55bb54){return db[_0xb1ea('0x51')][_0xb1ea('0x49')]({'where':{'id':_0x58e3c9[_0xb1ea('0x45')]['id']}})['then'](handleEntityNotFound(_0x22a1d2,null))[_0xb1ea('0x25')](function(_0xc36f58){if(_0xc36f58){return _0xc36f58['addActions'](_0x58e3c9[_0xb1ea('0x48')]['ids'],_[_0xb1ea('0x4d')](_0x58e3c9[_0xb1ea('0x48')],[_0xb1ea('0x4c'),'id'])||{});}})[_0xb1ea('0x25')](respondWithResult(_0x22a1d2,null))[_0xb1ea('0x43')](handleError(_0x22a1d2,null));};exports[_0xb1ea('0x52')]=function(_0x4bcf18,_0x18e99e,_0x2db8f9){var _0x3283ba={};var _0x1a6004={};var _0x4951cc;var _0x363768;return db['Automation'][_0xb1ea('0x4f')]({'where':{'id':_0x4bcf18[_0xb1ea('0x45')]['id']}})[_0xb1ea('0x25')](handleEntityNotFound(_0x18e99e,null))['then'](function(_0x5daa2e){if(_0x5daa2e){_0x4951cc=_0x5daa2e;_0x1a6004['model']=_[_0xb1ea('0x33')](db[_0xb1ea('0x51')][_0xb1ea('0x2d')]);_0x1a6004['query']=_['keys'](_0x4bcf18[_0xb1ea('0x32')]);_0x1a6004['filters']=_[_0xb1ea('0x34')](_0x1a6004['model'],_0x1a6004[_0xb1ea('0x32')]);_0x3283ba['attributes']=_['intersection'](_0x1a6004[_0xb1ea('0x31')],qs[_0xb1ea('0x36')](_0x4bcf18[_0xb1ea('0x32')][_0xb1ea('0x36')]));_0x3283ba[_0xb1ea('0x35')]=_0x3283ba[_0xb1ea('0x35')][_0xb1ea('0x37')]?_0x3283ba[_0xb1ea('0x35')]:_0x1a6004['model'];_0x3283ba[_0xb1ea('0x39')]=qs[_0xb1ea('0x3a')](_0x4bcf18[_0xb1ea('0x32')][_0xb1ea('0x3a')]);_0x3283ba[_0xb1ea('0x3b')]=qs[_0xb1ea('0x3c')](_[_0xb1ea('0x53')](_0x4bcf18[_0xb1ea('0x32')],_0x1a6004[_0xb1ea('0x3c')]));if(_0x4bcf18[_0xb1ea('0x32')][_0xb1ea('0x3e')]){_0x3283ba[_0xb1ea('0x3b')]=_[_0xb1ea('0x3d')](_0x3283ba[_0xb1ea('0x3b')],{'$or':_['map'](_0x3283ba['attributes'],function(_0x5963c8){var _0x5051e3={};_0x5051e3[_0x5963c8]={'$like':'%'+_0x4bcf18[_0xb1ea('0x32')][_0xb1ea('0x3e')]+'%'};return _0x5051e3;})});}_0x3283ba=_['merge']({},_0x3283ba,_0x4bcf18[_0xb1ea('0x46')]);return _0x4951cc[_0xb1ea('0x52')](_0x3283ba);}})[_0xb1ea('0x25')](function(_0x4b2f92){if(_0x4b2f92){_0x363768=_0x4b2f92[_0xb1ea('0x37')];if(!_0x4bcf18[_0xb1ea('0x32')][_0xb1ea('0x38')](_0xb1ea('0x50'))){_0x3283ba[_0xb1ea('0x1c')]=qs[_0xb1ea('0x1c')](_0x4bcf18[_0xb1ea('0x32')][_0xb1ea('0x1c')]);_0x3283ba[_0xb1ea('0x1b')]=qs[_0xb1ea('0x1b')](_0x4bcf18[_0xb1ea('0x32')][_0xb1ea('0x1b')]);}return _0x4951cc['getActions'](_0x3283ba);}})[_0xb1ea('0x25')](function(_0x3c045f){if(_0x3c045f){return _0x3c045f?{'count':_0x363768,'rows':_0x3c045f}:null;}})[_0xb1ea('0x25')](respondWithResult(_0x18e99e,null))[_0xb1ea('0x43')](handleError(_0x18e99e,null));}; \ No newline at end of file +var _0xefb6=['model','query','intersection','attributes','fields','length','nolimit','order','filters','filter','where','include','findAll','rows','catch','show','params','keys','includeAll','merge','options','find','create','body','addConditions','Condition','ids','findOne','sort','pick','hasOwnProperty','getConditions','addActions','Action','omit','getActions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','stack','name','send','index','map','Automation','rawAttributes','fieldName','type'];(function(_0x3c4505,_0xffe1f8){var _0x18f0cc=function(_0x21a4d4){while(--_0x21a4d4){_0x3c4505['push'](_0x3c4505['shift']());}};_0x18f0cc(++_0xffe1f8);}(_0xefb6,0x1c8));var _0x6efb=function(_0x402c8f,_0x30cc1d){_0x402c8f=_0x402c8f-0x0;var _0x11e809=_0xefb6[_0x402c8f];return _0x11e809;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6efb('0x0'));var zipdir=require(_0x6efb('0x1'));var jsonpatch=require(_0x6efb('0x2'));var rp=require(_0x6efb('0x3'));var moment=require(_0x6efb('0x4'));var BPromise=require(_0x6efb('0x5'));var Mustache=require('mustache');var util=require(_0x6efb('0x6'));var path=require(_0x6efb('0x7'));var sox=require(_0x6efb('0x8'));var csv=require(_0x6efb('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6efb('0xa'));var _=require(_0x6efb('0xb'));var squel=require(_0x6efb('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6efb('0x9'));var querystring=require('querystring');var Papa=require(_0x6efb('0xd'));var Redis=require(_0x6efb('0xe'));var authService=require(_0x6efb('0xf'));var qs=require(_0x6efb('0x10'));var as=require(_0x6efb('0x11'));var hardwareService=require(_0x6efb('0x12'));var logger=require(_0x6efb('0x13'))(_0x6efb('0x14'));var utils=require(_0x6efb('0x15'));var config=require(_0x6efb('0x16'));var licenseUtil=require(_0x6efb('0x17'));var db=require(_0x6efb('0x18'))['db'];function respondWithStatusCode(_0xbb7e96,_0x334a1e){_0x334a1e=_0x334a1e||0xcc;return function(_0x238e7c){if(_0x238e7c){return _0xbb7e96[_0x6efb('0x19')](_0x334a1e);}return _0xbb7e96[_0x6efb('0x1a')](_0x334a1e)['end']();};}function respondWithResult(_0x3ca387,_0x5c898d){_0x5c898d=_0x5c898d||0xc8;return function(_0x47d405){if(_0x47d405){return _0x3ca387[_0x6efb('0x1a')](_0x5c898d)[_0x6efb('0x1b')](_0x47d405);}};}function respondWithFilteredResult(_0x12274d,_0x27c972){return function(_0x414490){if(_0x414490){var _0x9151f=typeof _0x27c972[_0x6efb('0x1c')]===_0x6efb('0x1d')&&typeof _0x27c972['limit']===_0x6efb('0x1d');var _0x1b6eec=_0x414490[_0x6efb('0x1e')];var _0xec1fb5=_0x9151f?0x0:_0x27c972['offset'];var _0x4f9422=_0x9151f?_0x414490[_0x6efb('0x1e')]:_0x27c972[_0x6efb('0x1c')]+_0x27c972[_0x6efb('0x1f')];var _0x4a2d46;if(_0x4f9422>=_0x1b6eec){_0x4f9422=_0x1b6eec;_0x4a2d46=0xc8;}else{_0x4a2d46=0xce;}_0x12274d[_0x6efb('0x1a')](_0x4a2d46);return _0x12274d[_0x6efb('0x20')]('Content-Range',_0xec1fb5+'-'+_0x4f9422+'/'+_0x1b6eec)[_0x6efb('0x1b')](_0x414490);}return null;};}function patchUpdates(_0x1956a7){return function(_0x38d64e){try{jsonpatch[_0x6efb('0x21')](_0x38d64e,_0x1956a7,!![]);}catch(_0x7185b4){return BPromise[_0x6efb('0x22')](_0x7185b4);}return _0x38d64e[_0x6efb('0x23')]();};}function saveUpdates(_0x26cf2a,_0x201dcf){return function(_0x13cd62){if(_0x13cd62){return _0x13cd62[_0x6efb('0x24')](_0x26cf2a)[_0x6efb('0x25')](function(_0x5bc366){return _0x5bc366;});}return null;};}function removeEntity(_0x4440ff,_0x32ee0e){return function(_0x5766ae){if(_0x5766ae){return _0x5766ae[_0x6efb('0x26')]()['then'](function(){_0x4440ff[_0x6efb('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e9dfa,_0x150594){return function(_0x5a517c){if(!_0x5a517c){_0x2e9dfa['sendStatus'](0x194);}return _0x5a517c;};}function handleError(_0x28bf22,_0x105e41){_0x105e41=_0x105e41||0x1f4;return function(_0x24cdca){logger['error'](_0x24cdca[_0x6efb('0x27')]);if(_0x24cdca[_0x6efb('0x28')]){delete _0x24cdca[_0x6efb('0x28')];}_0x28bf22['status'](_0x105e41)[_0x6efb('0x29')](_0x24cdca);};}exports[_0x6efb('0x2a')]=function(_0x53cd1a,_0x3fe231){var _0x4a062e={},_0x1a1aff={},_0x4bf77d={'count':0x0,'rows':[]};var _0x3eb8ec=_[_0x6efb('0x2b')](db[_0x6efb('0x2c')][_0x6efb('0x2d')],function(_0x471d16){return{'name':_0x471d16[_0x6efb('0x2e')],'type':_0x471d16[_0x6efb('0x2f')]['key']};});_0x1a1aff[_0x6efb('0x30')]=_['map'](_0x3eb8ec,_0x6efb('0x28'));_0x1a1aff[_0x6efb('0x31')]=_['keys'](_0x53cd1a[_0x6efb('0x31')]);_0x1a1aff['filters']=_[_0x6efb('0x32')](_0x1a1aff[_0x6efb('0x30')],_0x1a1aff[_0x6efb('0x31')]);_0x4a062e[_0x6efb('0x33')]=_[_0x6efb('0x32')](_0x1a1aff['model'],qs['fields'](_0x53cd1a[_0x6efb('0x31')][_0x6efb('0x34')]));_0x4a062e['attributes']=_0x4a062e[_0x6efb('0x33')][_0x6efb('0x35')]?_0x4a062e[_0x6efb('0x33')]:_0x1a1aff[_0x6efb('0x30')];if(!_0x53cd1a[_0x6efb('0x31')]['hasOwnProperty'](_0x6efb('0x36'))){_0x4a062e[_0x6efb('0x1f')]=qs['limit'](_0x53cd1a['query'][_0x6efb('0x1f')]);_0x4a062e[_0x6efb('0x1c')]=qs[_0x6efb('0x1c')](_0x53cd1a[_0x6efb('0x31')][_0x6efb('0x1c')]);}_0x4a062e[_0x6efb('0x37')]=qs['sort'](_0x53cd1a[_0x6efb('0x31')]['sort']);_0x4a062e['where']=qs[_0x6efb('0x38')](_['pick'](_0x53cd1a[_0x6efb('0x31')],_0x1a1aff['filters']),_0x3eb8ec);if(_0x53cd1a[_0x6efb('0x31')][_0x6efb('0x39')]){_0x4a062e[_0x6efb('0x3a')]=_['merge'](_0x4a062e[_0x6efb('0x3a')],{'$or':_[_0x6efb('0x2b')](_0x3eb8ec,function(_0x3e3731){if(_0x3e3731[_0x6efb('0x2f')]!=='VIRTUAL'){var _0x34b46c={};_0x34b46c[_0x3e3731['name']]={'$like':'%'+_0x53cd1a[_0x6efb('0x31')][_0x6efb('0x39')]+'%'};return _0x34b46c;}})});}_0x4a062e=_['merge']({},_0x4a062e,_0x53cd1a['options']);var _0xd94007={'where':_0x4a062e[_0x6efb('0x3a')]};return db[_0x6efb('0x2c')][_0x6efb('0x1e')](_0xd94007)['then'](function(_0x2dadb1){_0x4bf77d[_0x6efb('0x1e')]=_0x2dadb1;if(_0x53cd1a['query']['includeAll']){_0x4a062e[_0x6efb('0x3b')]=[{'all':!![]}];}return db[_0x6efb('0x2c')][_0x6efb('0x3c')](_0x4a062e);})[_0x6efb('0x25')](function(_0x14bc95){_0x4bf77d[_0x6efb('0x3d')]=_0x14bc95;return _0x4bf77d;})[_0x6efb('0x25')](respondWithFilteredResult(_0x3fe231,_0x4a062e))[_0x6efb('0x3e')](handleError(_0x3fe231,null));};exports[_0x6efb('0x3f')]=function(_0x5e0dc0,_0x201cab){var _0x27e602={'raw':![],'where':{'id':_0x5e0dc0[_0x6efb('0x40')]['id']}},_0x1206c8={};_0x1206c8['model']=_[_0x6efb('0x41')](db[_0x6efb('0x2c')][_0x6efb('0x2d')]);_0x1206c8[_0x6efb('0x31')]=_['keys'](_0x5e0dc0[_0x6efb('0x31')]);_0x1206c8[_0x6efb('0x38')]=_[_0x6efb('0x32')](_0x1206c8[_0x6efb('0x30')],_0x1206c8[_0x6efb('0x31')]);_0x27e602['attributes']=_[_0x6efb('0x32')](_0x1206c8[_0x6efb('0x30')],qs[_0x6efb('0x34')](_0x5e0dc0['query'][_0x6efb('0x34')]));_0x27e602['attributes']=_0x27e602[_0x6efb('0x33')][_0x6efb('0x35')]?_0x27e602[_0x6efb('0x33')]:_0x1206c8[_0x6efb('0x30')];if(_0x5e0dc0['query'][_0x6efb('0x42')]){_0x27e602['include']=[{'all':!![]}];}_0x27e602=_[_0x6efb('0x43')]({},_0x27e602,_0x5e0dc0[_0x6efb('0x44')]);return db[_0x6efb('0x2c')][_0x6efb('0x45')](_0x27e602)[_0x6efb('0x25')](handleEntityNotFound(_0x201cab,null))[_0x6efb('0x25')](respondWithResult(_0x201cab,null))[_0x6efb('0x3e')](handleError(_0x201cab,null));};exports['create']=function(_0x21fb7f,_0x22b314){return db['Automation'][_0x6efb('0x46')](_0x21fb7f[_0x6efb('0x47')],{})['then'](respondWithResult(_0x22b314,0xc9))[_0x6efb('0x3e')](handleError(_0x22b314,null));};exports[_0x6efb('0x24')]=function(_0x5a05ec,_0x59136c){if(_0x5a05ec[_0x6efb('0x47')]['id']){delete _0x5a05ec[_0x6efb('0x47')]['id'];}return db[_0x6efb('0x2c')][_0x6efb('0x45')]({'where':{'id':_0x5a05ec[_0x6efb('0x40')]['id']}})[_0x6efb('0x25')](handleEntityNotFound(_0x59136c,null))['then'](saveUpdates(_0x5a05ec[_0x6efb('0x47')],null))[_0x6efb('0x25')](respondWithResult(_0x59136c,null))[_0x6efb('0x3e')](handleError(_0x59136c,null));};exports['destroy']=function(_0x13be93,_0x1f8d9b){return db[_0x6efb('0x2c')][_0x6efb('0x45')]({'where':{'id':_0x13be93['params']['id']}})[_0x6efb('0x25')](handleEntityNotFound(_0x1f8d9b,null))[_0x6efb('0x25')](removeEntity(_0x1f8d9b,null))[_0x6efb('0x3e')](handleError(_0x1f8d9b,null));};exports[_0x6efb('0x48')]=function(_0x5af036,_0x54b8be,_0x9de016){return db[_0x6efb('0x49')]['find']({'where':{'id':_0x5af036['params']['id']}})[_0x6efb('0x25')](handleEntityNotFound(_0x54b8be,null))[_0x6efb('0x25')](function(_0x295204){if(_0x295204){return _0x295204['addConditions'](_0x5af036[_0x6efb('0x47')][_0x6efb('0x4a')],_['omit'](_0x5af036[_0x6efb('0x47')],['ids','id'])||{});}})[_0x6efb('0x25')](respondWithResult(_0x54b8be,null))[_0x6efb('0x3e')](handleError(_0x54b8be,null));};exports['getConditions']=function(_0x49030e,_0x142055,_0xdde676){var _0x362603={};var _0x35b96d={};var _0x2c82d1;var _0x3c798c;return db[_0x6efb('0x2c')][_0x6efb('0x4b')]({'where':{'id':_0x49030e[_0x6efb('0x40')]['id']}})['then'](handleEntityNotFound(_0x142055,null))['then'](function(_0x2a9233){if(_0x2a9233){_0x2c82d1=_0x2a9233;_0x35b96d['model']=_['keys'](db[_0x6efb('0x49')][_0x6efb('0x2d')]);_0x35b96d[_0x6efb('0x31')]=_[_0x6efb('0x41')](_0x49030e[_0x6efb('0x31')]);_0x35b96d[_0x6efb('0x38')]=_[_0x6efb('0x32')](_0x35b96d[_0x6efb('0x30')],_0x35b96d[_0x6efb('0x31')]);_0x362603['attributes']=_[_0x6efb('0x32')](_0x35b96d['model'],qs[_0x6efb('0x34')](_0x49030e['query'][_0x6efb('0x34')]));_0x362603[_0x6efb('0x33')]=_0x362603[_0x6efb('0x33')][_0x6efb('0x35')]?_0x362603[_0x6efb('0x33')]:_0x35b96d['model'];_0x362603[_0x6efb('0x37')]=qs[_0x6efb('0x4c')](_0x49030e[_0x6efb('0x31')][_0x6efb('0x4c')]);_0x362603[_0x6efb('0x3a')]=qs['filters'](_[_0x6efb('0x4d')](_0x49030e[_0x6efb('0x31')],_0x35b96d['filters']));if(_0x49030e['query'][_0x6efb('0x39')]){_0x362603[_0x6efb('0x3a')]=_[_0x6efb('0x43')](_0x362603[_0x6efb('0x3a')],{'$or':_[_0x6efb('0x2b')](_0x362603[_0x6efb('0x33')],function(_0x5af569){var _0x744cf6={};_0x744cf6[_0x5af569]={'$like':'%'+_0x49030e[_0x6efb('0x31')][_0x6efb('0x39')]+'%'};return _0x744cf6;})});}_0x362603=_[_0x6efb('0x43')]({},_0x362603,_0x49030e['options']);return _0x2c82d1['getConditions'](_0x362603);}})[_0x6efb('0x25')](function(_0x48652f){if(_0x48652f){_0x3c798c=_0x48652f[_0x6efb('0x35')];if(!_0x49030e['query'][_0x6efb('0x4e')](_0x6efb('0x36'))){_0x362603[_0x6efb('0x1f')]=qs[_0x6efb('0x1f')](_0x49030e[_0x6efb('0x31')][_0x6efb('0x1f')]);_0x362603[_0x6efb('0x1c')]=qs[_0x6efb('0x1c')](_0x49030e['query'][_0x6efb('0x1c')]);}return _0x2c82d1[_0x6efb('0x4f')](_0x362603);}})['then'](function(_0x168eaf){if(_0x168eaf){return _0x168eaf?{'count':_0x3c798c,'rows':_0x168eaf}:null;}})[_0x6efb('0x25')](respondWithResult(_0x142055,null))[_0x6efb('0x3e')](handleError(_0x142055,null));};exports[_0x6efb('0x50')]=function(_0x603cc0,_0x5f1cfb,_0x4e0747){return db[_0x6efb('0x51')]['find']({'where':{'id':_0x603cc0[_0x6efb('0x40')]['id']}})[_0x6efb('0x25')](handleEntityNotFound(_0x5f1cfb,null))['then'](function(_0x480ced){if(_0x480ced){return _0x480ced[_0x6efb('0x50')](_0x603cc0['body']['ids'],_[_0x6efb('0x52')](_0x603cc0['body'],[_0x6efb('0x4a'),'id'])||{});}})[_0x6efb('0x25')](respondWithResult(_0x5f1cfb,null))[_0x6efb('0x3e')](handleError(_0x5f1cfb,null));};exports[_0x6efb('0x53')]=function(_0x646063,_0x22050c,_0x4f8e72){var _0xa73b4e={};var _0x5201cd={};var _0x1e5c5a;var _0x33ebf7;return db[_0x6efb('0x2c')][_0x6efb('0x4b')]({'where':{'id':_0x646063[_0x6efb('0x40')]['id']}})[_0x6efb('0x25')](handleEntityNotFound(_0x22050c,null))['then'](function(_0x18e94e){if(_0x18e94e){_0x1e5c5a=_0x18e94e;_0x5201cd[_0x6efb('0x30')]=_[_0x6efb('0x41')](db['Action'][_0x6efb('0x2d')]);_0x5201cd[_0x6efb('0x31')]=_[_0x6efb('0x41')](_0x646063[_0x6efb('0x31')]);_0x5201cd[_0x6efb('0x38')]=_['intersection'](_0x5201cd['model'],_0x5201cd['query']);_0xa73b4e['attributes']=_[_0x6efb('0x32')](_0x5201cd[_0x6efb('0x30')],qs[_0x6efb('0x34')](_0x646063[_0x6efb('0x31')][_0x6efb('0x34')]));_0xa73b4e[_0x6efb('0x33')]=_0xa73b4e[_0x6efb('0x33')][_0x6efb('0x35')]?_0xa73b4e[_0x6efb('0x33')]:_0x5201cd['model'];_0xa73b4e[_0x6efb('0x37')]=qs[_0x6efb('0x4c')](_0x646063[_0x6efb('0x31')][_0x6efb('0x4c')]);_0xa73b4e[_0x6efb('0x3a')]=qs[_0x6efb('0x38')](_['pick'](_0x646063[_0x6efb('0x31')],_0x5201cd[_0x6efb('0x38')]));if(_0x646063[_0x6efb('0x31')][_0x6efb('0x39')]){_0xa73b4e[_0x6efb('0x3a')]=_[_0x6efb('0x43')](_0xa73b4e[_0x6efb('0x3a')],{'$or':_[_0x6efb('0x2b')](_0xa73b4e[_0x6efb('0x33')],function(_0x4d0daf){var _0x1e371c={};_0x1e371c[_0x4d0daf]={'$like':'%'+_0x646063[_0x6efb('0x31')][_0x6efb('0x39')]+'%'};return _0x1e371c;})});}_0xa73b4e=_['merge']({},_0xa73b4e,_0x646063[_0x6efb('0x44')]);return _0x1e5c5a[_0x6efb('0x53')](_0xa73b4e);}})[_0x6efb('0x25')](function(_0x215bf7){if(_0x215bf7){_0x33ebf7=_0x215bf7[_0x6efb('0x35')];if(!_0x646063[_0x6efb('0x31')][_0x6efb('0x4e')](_0x6efb('0x36'))){_0xa73b4e[_0x6efb('0x1f')]=qs['limit'](_0x646063['query']['limit']);_0xa73b4e[_0x6efb('0x1c')]=qs[_0x6efb('0x1c')](_0x646063[_0x6efb('0x31')]['offset']);}return _0x1e5c5a[_0x6efb('0x53')](_0xa73b4e);}})['then'](function(_0x4bcc0b){if(_0x4bcc0b){return _0x4bcc0b?{'count':_0x33ebf7,'rows':_0x4bcc0b}:null;}})[_0x6efb('0x25')](respondWithResult(_0x22050c,null))[_0x6efb('0x3e')](handleError(_0x22050c,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 77de281..bf70cb6 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 _0xd949=['rimraf','../../config/environment','./automation.attributes','exports','Automation','tools_automations','lodash','api','moment','request-promise','path'];(function(_0x9b4f1e,_0x50dfbc){var _0x204ac9=function(_0x455781){while(--_0x455781){_0x9b4f1e['push'](_0x9b4f1e['shift']());}};_0x204ac9(++_0x50dfbc);}(_0xd949,0x166));var _0x9d94=function(_0x47d830,_0x134494){_0x47d830=_0x47d830-0x0;var _0x8fa212=_0xd949[_0x47d830];return _0x8fa212;};'use strict';var _=require(_0x9d94('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9d94('0x1'));var moment=require(_0x9d94('0x2'));var BPromise=require('bluebird');var rp=require(_0x9d94('0x3'));var fs=require('fs');var path=require(_0x9d94('0x4'));var rimraf=require(_0x9d94('0x5'));var config=require(_0x9d94('0x6'));var attributes=require(_0x9d94('0x7'));module[_0x9d94('0x8')]=function(_0x45fb8a,_0xa0a8fa){return _0x45fb8a['define'](_0x9d94('0x9'),attributes,{'tableName':_0x9d94('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfedd=['lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./automation.attributes','exports','define','Automation'];(function(_0x30ff0d,_0x385305){var _0x958560=function(_0xfd1229){while(--_0xfd1229){_0x30ff0d['push'](_0x30ff0d['shift']());}};_0x958560(++_0x385305);}(_0xfedd,0x9c));var _0xdfed=function(_0x55490e,_0x23f25c){_0x55490e=_0x55490e-0x0;var _0x4e4708=_0xfedd[_0x55490e];return _0x4e4708;};'use strict';var _=require(_0xdfed('0x0'));var util=require(_0xdfed('0x1'));var logger=require(_0xdfed('0x2'))('api');var moment=require('moment');var BPromise=require(_0xdfed('0x3'));var rp=require(_0xdfed('0x4'));var fs=require('fs');var path=require(_0xdfed('0x5'));var rimraf=require(_0xdfed('0x6'));var config=require(_0xdfed('0x7'));var attributes=require(_0xdfed('0x8'));module[_0xdfed('0x9')]=function(_0x4bc5a9,_0x4c47bd){return _0x4bc5a9[_0xdfed('0xa')](_0xdfed('0xb'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index a7bfefd..5266ab8 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 _0x7275=['util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','then','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash'];(function(_0x57978e,_0xc9bb61){var _0x11e501=function(_0x268212){while(--_0x268212){_0x57978e['push'](_0x57978e['shift']());}};_0x11e501(++_0xc9bb61);}(_0x7275,0x143));var _0x5727=function(_0x2b15d8,_0x1dd7ef){_0x2b15d8=_0x2b15d8-0x0;var _0x4db55e=_0x7275[_0x2b15d8];return _0x4db55e;};'use strict';var _=require(_0x5727('0x0'));var util=require(_0x5727('0x1'));var moment=require(_0x5727('0x2'));var BPromise=require('bluebird');var rs=require(_0x5727('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5727('0x4'))['db'];var utils=require(_0x5727('0x5'));var logger=require('../../config/logger')(_0x5727('0x6'));var config=require(_0x5727('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x336262,_0x49184a,_0x33a6fe){return new BPromise(function(_0x4de37c,_0x129402){return client['request'](_0x336262,_0x33a6fe)[_0x5727('0x8')](function(_0x18e712){logger['info'](_0x5727('0x9'),_0x49184a,_0x5727('0xa'));logger['debug'](_0x5727('0xb'),_0x49184a,_0x5727('0xa'),JSON['stringify'](_0x18e712));if(_0x18e712[_0x5727('0xc')]){if(_0x18e712[_0x5727('0xc')][_0x5727('0xd')]===0x1f4){logger[_0x5727('0xc')](_0x5727('0x9'),_0x49184a,_0x18e712[_0x5727('0xc')]['message']);return _0x129402(_0x18e712[_0x5727('0xc')][_0x5727('0xe')]);}logger[_0x5727('0xc')](_0x5727('0x9'),_0x49184a,_0x18e712[_0x5727('0xc')][_0x5727('0xe')]);return _0x4de37c(_0x18e712[_0x5727('0xc')]['message']);}else{logger[_0x5727('0xf')](_0x5727('0x9'),_0x49184a,_0x5727('0xa'));_0x4de37c(_0x18e712[_0x5727('0x10')][_0x5727('0xe')]);}})[_0x5727('0x11')](function(_0x273dc9){logger['error'](_0x5727('0x9'),_0x49184a,_0x273dc9);_0x129402(_0x273dc9);});});} \ No newline at end of file +var _0xc1d3=['stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s'];(function(_0x178dbe,_0x969fba){var _0x2c6ea5=function(_0x3fcac7){while(--_0x3fcac7){_0x178dbe['push'](_0x178dbe['shift']());}};_0x2c6ea5(++_0x969fba);}(_0xc1d3,0x147));var _0x3c1d=function(_0x2ec3c3,_0xc744cd){_0x2ec3c3=_0x2ec3c3-0x0;var _0x5b374a=_0xc1d3[_0x2ec3c3];return _0x5b374a;};'use strict';var _=require(_0x3c1d('0x0'));var util=require(_0x3c1d('0x1'));var moment=require(_0x3c1d('0x2'));var BPromise=require(_0x3c1d('0x3'));var rs=require(_0x3c1d('0x4'));var fs=require('fs');var Redis=require(_0x3c1d('0x5'));var db=require(_0x3c1d('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3c1d('0x7'));var config=require(_0x3c1d('0x8'));var jayson=require(_0x3c1d('0x9'));var client=jayson['client'][_0x3c1d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36863b,_0x3bef1a,_0x28793c){return new BPromise(function(_0x1796a0,_0x58e08c){return client[_0x3c1d('0xb')](_0x36863b,_0x28793c)[_0x3c1d('0xc')](function(_0x33cb1b){logger[_0x3c1d('0xd')](_0x3c1d('0xe'),_0x3bef1a,_0x3c1d('0xf'));logger[_0x3c1d('0x10')](_0x3c1d('0x11'),_0x3bef1a,'request\x20sent',JSON[_0x3c1d('0x12')](_0x33cb1b));if(_0x33cb1b[_0x3c1d('0x13')]){if(_0x33cb1b[_0x3c1d('0x13')][_0x3c1d('0x14')]===0x1f4){logger[_0x3c1d('0x13')]('Automation,\x20%s,\x20%s',_0x3bef1a,_0x33cb1b[_0x3c1d('0x13')][_0x3c1d('0x15')]);return _0x58e08c(_0x33cb1b['error'][_0x3c1d('0x15')]);}logger['error']('Automation,\x20%s,\x20%s',_0x3bef1a,_0x33cb1b['error'][_0x3c1d('0x15')]);return _0x1796a0(_0x33cb1b[_0x3c1d('0x13')][_0x3c1d('0x15')]);}else{logger[_0x3c1d('0xd')](_0x3c1d('0xe'),_0x3bef1a,_0x3c1d('0xf'));_0x1796a0(_0x33cb1b['result']['message']);}})[_0x3c1d('0x16')](function(_0x5ab3b0){logger[_0x3c1d('0x13')](_0x3c1d('0xe'),_0x3bef1a,_0x5ab3b0);_0x58e08c(_0x5ab3b0);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 1d3c5a2..d5b8b42 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 _0x7846=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','show','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addConditions','addActions','put','update','delete','/:id','destroy'];(function(_0x17b85e,_0x3cf19a){var _0x34c9e0=function(_0x4eb448){while(--_0x4eb448){_0x17b85e['push'](_0x17b85e['shift']());}};_0x34c9e0(++_0x3cf19a);}(_0x7846,0xf4));var _0x6784=function(_0x2caf3a,_0x1d65d6){_0x2caf3a=_0x2caf3a-0x0;var _0x34f044=_0x7846[_0x2caf3a];return _0x34f044;};'use strict';var multer=require('multer');var util=require(_0x6784('0x0'));var path=require(_0x6784('0x1'));var timeout=require(_0x6784('0x2'));var express=require(_0x6784('0x3'));var router=express[_0x6784('0x4')]();var fs_extra=require(_0x6784('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6784('0x6'));var config=require(_0x6784('0x7'));var controller=require(_0x6784('0x8'));router[_0x6784('0x9')]('/',auth[_0x6784('0xa')](),controller[_0x6784('0xb')]);router[_0x6784('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x6784('0xc')]);router[_0x6784('0x9')](_0x6784('0xd'),auth[_0x6784('0xa')](),controller[_0x6784('0xe')]);router[_0x6784('0x9')](_0x6784('0xf'),auth[_0x6784('0xa')](),controller[_0x6784('0x10')]);router[_0x6784('0x11')]('/',auth[_0x6784('0xa')](),controller[_0x6784('0x12')]);router[_0x6784('0x11')](_0x6784('0xd'),auth[_0x6784('0xa')](),controller[_0x6784('0x13')]);router['post'](_0x6784('0xf'),auth[_0x6784('0xa')](),controller[_0x6784('0x14')]);router[_0x6784('0x15')]('/:id',auth[_0x6784('0xa')](),controller[_0x6784('0x16')]);router[_0x6784('0x17')](_0x6784('0x18'),auth[_0x6784('0xa')](),controller[_0x6784('0x19')]);module[_0x6784('0x1a')]=router; \ No newline at end of file +var _0x9cff=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions','create','addConditions','/:id/actions','addActions','put','update','delete','destroy','exports'];(function(_0x374ada,_0x27b3a5){var _0x449ed8=function(_0x3efc46){while(--_0x3efc46){_0x374ada['push'](_0x374ada['shift']());}};_0x449ed8(++_0x27b3a5);}(_0x9cff,0x1b0));var _0xf9cf=function(_0xa9af46,_0x32ab25){_0xa9af46=_0xa9af46-0x0;var _0x24822d=_0x9cff[_0xa9af46];return _0x24822d;};'use strict';var multer=require('multer');var util=require(_0xf9cf('0x0'));var path=require(_0xf9cf('0x1'));var timeout=require(_0xf9cf('0x2'));var express=require('express');var router=express[_0xf9cf('0x3')]();var fs_extra=require(_0xf9cf('0x4'));var auth=require(_0xf9cf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf9cf('0x6'));var controller=require(_0xf9cf('0x7'));router[_0xf9cf('0x8')]('/',auth[_0xf9cf('0x9')](),controller[_0xf9cf('0xa')]);router[_0xf9cf('0x8')](_0xf9cf('0xb'),auth[_0xf9cf('0x9')](),controller[_0xf9cf('0xc')]);router[_0xf9cf('0x8')](_0xf9cf('0xd'),auth['isAuthenticated'](),controller[_0xf9cf('0xe')]);router[_0xf9cf('0x8')]('/:id/actions',auth[_0xf9cf('0x9')](),controller['getActions']);router['post']('/',auth[_0xf9cf('0x9')](),controller[_0xf9cf('0xf')]);router['post'](_0xf9cf('0xd'),auth['isAuthenticated'](),controller[_0xf9cf('0x10')]);router['post'](_0xf9cf('0x11'),auth['isAuthenticated'](),controller[_0xf9cf('0x12')]);router[_0xf9cf('0x13')](_0xf9cf('0xb'),auth[_0xf9cf('0x9')](),controller[_0xf9cf('0x14')]);router[_0xf9cf('0x15')](_0xf9cf('0xb'),auth['isAuthenticated'](),controller[_0xf9cf('0x16')]);module[_0xf9cf('0x17')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 15a2e3b..be9c658 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 _0x7285=['#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','ENUM','ivr','STRING','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)'];(function(_0x23869b,_0x28d453){var _0x378f88=function(_0x1e6c40){while(--_0x1e6c40){_0x23869b['push'](_0x23869b['shift']());}};_0x378f88(++_0x28d453);}(_0x7285,0x102));var _0x5728=function(_0x4ddeb2,_0x4ed0b6){_0x4ddeb2=_0x4ddeb2-0x0;var _0x12dce6=_0x7285[_0x4ddeb2];return _0x12dce6;};'use strict';var Sequelize=require('sequelize');module[_0x5728('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x5728('0x1')]('ivr'),'allowNull':![],'defaultValue':_0x5728('0x2')},'description':{'type':Sequelize[_0x5728('0x3')]},'active':{'type':Sequelize[_0x5728('0x4')],'defaultValue':0x0,'comment':_0x5728('0x5')},'limitCalls':{'type':Sequelize[_0x5728('0x6')](0x4)[_0x5728('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0x5728('0x3')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x5728('0x3')]},'dialOriginateTimeout':{'type':Sequelize[_0x5728('0x6')](0x3)[_0x5728('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5728('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0x5728('0x6')](0x3)[_0x5728('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5728('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x5728('0x6')](0x5)[_0x5728('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5728('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0x5728('0x6')](0x3)[_0x5728('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5728('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5728('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x5728('0x6')](0x3)[_0x5728('0x7')],'defaultValue':0x3,'comment':_0x5728('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x5728('0x6')](0x5)[_0x5728('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5728('0xd')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5728('0x7')],'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[_0x5728('0x3')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x5728('0x1')](_0x5728('0xe'),'never','onlyIfOpen'),'defaultValue':_0x5728('0xe')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x5728('0xf')},'dialAMDInitialSilence':{'type':Sequelize[_0x5728('0x6')](0x9)[_0x5728('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x5728('0x10')},'dialAMDGreeting':{'type':Sequelize[_0x5728('0x6')](0x9)[_0x5728('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x5728('0x6')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x5728('0x11')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x5728('0x6')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x5728('0x6')](0x9)[_0x5728('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x5728('0x12')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x5728('0x6')](0x9)[_0x5728('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x5728('0x6')](0x9)[_0x5728('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x5728('0x13')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x5728('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x5728('0x14')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x5728('0x6')](0x9)[_0x5728('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5728('0x15')},'dialOrderByScheduledAt':{'type':Sequelize[_0x5728('0x1')](_0x5728('0x16'),_0x5728('0x17')),'defaultValue':_0x5728('0x16')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x5728('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5728('0x18')},'dialCutDigit':{'type':Sequelize[_0x5728('0x6')](0x3)[_0x5728('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5728('0x19')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5728('0x1a')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5728('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5728('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5728('0x1b')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x5728('0x6')](0x3)[_0x5728('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x5728('0x6')](0x5)[_0x5728('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5728('0x1c')},'dialMachineMaxRetry':{'type':Sequelize[_0x5728('0x6')](0x3)[_0x5728('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5728('0x1d')},'dialMachineRetryFrequency':{'type':Sequelize[_0x5728('0x6')](0x5)[_0x5728('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x5728('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5728('0x1e')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x5728('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5728('0x1f')}}; \ No newline at end of file +var _0x2675=['STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports'];(function(_0x303c0a,_0x1b2e62){var _0x233310=function(_0x358546){while(--_0x358546){_0x303c0a['push'](_0x303c0a['shift']());}};_0x233310(++_0x1b2e62);}(_0x2675,0x1ab));var _0x5267=function(_0x49e066,_0x27e060){_0x49e066=_0x49e066-0x0;var _0x49ba9b=_0x2675[_0x49e066];return _0x49ba9b;};'use strict';var Sequelize=require(_0x5267('0x0'));module[_0x5267('0x1')]={'name':{'type':Sequelize[_0x5267('0x2')],'unique':_0x5267('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x5267('0x4')](_0x5267('0x5')),'allowNull':![],'defaultValue':_0x5267('0x5')},'description':{'type':Sequelize[_0x5267('0x2')]},'active':{'type':Sequelize[_0x5267('0x6')],'defaultValue':0x0,'comment':_0x5267('0x7')},'limitCalls':{'type':Sequelize[_0x5267('0x8')](0x4)[_0x5267('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x5267('0xa')},'dialOriginateCallerIdName':{'type':Sequelize[_0x5267('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x5267('0x8')](0x3)[_0x5267('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5267('0xb')},'dialCongestionMaxRetry':{'type':Sequelize[_0x5267('0x8')](0x3)[_0x5267('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5267('0xc')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5267('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5267('0xd')},'dialBusyMaxRetry':{'type':Sequelize[_0x5267('0x8')](0x3)[_0x5267('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5267('0xe')},'dialBusyRetryFrequency':{'type':Sequelize[_0x5267('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5267('0xf')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x5267('0x8')](0x3)[_0x5267('0x9')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x5267('0x8')](0x5)[_0x5267('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5267('0x10')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5267('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x5267('0x11')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x5267('0x2')],'defaultValue':_0x5267('0x12')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x5267('0x13'),'never',_0x5267('0x14')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x5267('0x6')],'defaultValue':0x0,'comment':_0x5267('0x15')},'dialAMDInitialSilence':{'type':Sequelize[_0x5267('0x8')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x5267('0x16')},'dialAMDGreeting':{'type':Sequelize[_0x5267('0x8')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x5267('0x8')](0x9)[_0x5267('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x5267('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5267('0x17')},'dialAMDMinWordLength':{'type':Sequelize[_0x5267('0x8')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x5267('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x5267('0x8')](0x9)[_0x5267('0x9')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x5267('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x5267('0x9')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x5267('0x1a')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x5267('0x8')](0x9)[_0x5267('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5267('0x1b')},'dialOrderByScheduledAt':{'type':Sequelize[_0x5267('0x4')](_0x5267('0x1c'),'ASC'),'defaultValue':_0x5267('0x1c')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x5267('0x8')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5267('0x1d')},'dialCutDigit':{'type':Sequelize[_0x5267('0x8')](0x3)[_0x5267('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5267('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x5267('0x8')](0x3)[_0x5267('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5267('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5267('0x1f')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5267('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5267('0x20')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5267('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5267('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x5267('0x8')](0x3)[_0x5267('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5267('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x5267('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5267('0x23')},'dialMachineRetryFrequency':{'type':Sequelize[_0x5267('0x8')](0x5)[_0x5267('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5267('0x24')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x5267('0x8')](0x3)[_0x5267('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5267('0x25')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x5267('0x8')](0x5)[_0x5267('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5267('0x26')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 7251a4c..fe20d45 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 _0x218f=['createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','CmHopper','rawAttributes','nolimit','CampaignId','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','cm_hopper','fromQuery','ContactId','ListId','select','phone','field','NOW()','scheduledAt','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','COALESCE(phone,\x27\x27)','CampaignId\x20=\x20?','onlyIfOpen','insert','into','push','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','apply','update','then','get','UserProfileResource','destroy','error','stack','name','index','map','Campaign','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','user','role','IvrCampaigns','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit'];(function(_0x1303b5,_0x1f3d11){var _0x59f0f4=function(_0x273773){while(--_0x273773){_0x1303b5['push'](_0x1303b5['shift']());}};_0x59f0f4(++_0x1f3d11);}(_0x218f,0x139));var _0xf218=function(_0x1f00cc,_0x2b4ced){_0x1f00cc=_0x1f00cc-0x0;var _0x68036b=_0x218f[_0x1f00cc];return _0x68036b;};'use strict';var emlformat=require(_0xf218('0x0'));var rimraf=require(_0xf218('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf218('0x2'));var moment=require(_0xf218('0x3'));var BPromise=require(_0xf218('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf218('0x5'));var sox=require(_0xf218('0x6'));var csv=require(_0xf218('0x7'));var ejs=require(_0xf218('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf218('0x9'));var squel=require(_0xf218('0xa'));var crypto=require(_0xf218('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf218('0xc'));var toCsv=require(_0xf218('0x7'));var querystring=require(_0xf218('0xd'));var Papa=require('papaparse');var Redis=require(_0xf218('0xe'));var authService=require(_0xf218('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xf218('0x10'));var hardwareService=require(_0xf218('0x11'));var logger=require(_0xf218('0x12'))(_0xf218('0x13'));var utils=require('../../config/utils');var config=require(_0xf218('0x14'));var licenseUtil=require(_0xf218('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d4d63,_0x585e90){_0x585e90=_0x585e90||0xcc;return function(_0x22fedc){if(_0x22fedc){return _0x5d4d63[_0xf218('0x16')](_0x585e90);}return _0x5d4d63[_0xf218('0x17')](_0x585e90)[_0xf218('0x18')]();};}function respondWithResult(_0x5e81df,_0x461928){_0x461928=_0x461928||0xc8;return function(_0x186bd6){if(_0x186bd6){return _0x5e81df[_0xf218('0x17')](_0x461928)[_0xf218('0x19')](_0x186bd6);}};}function respondWithFilteredResult(_0x3d0771,_0x47c1f0){return function(_0x276bfa){if(_0x276bfa){var _0x22efaa=typeof _0x47c1f0[_0xf218('0x1a')]===_0xf218('0x1b')&&typeof _0x47c1f0[_0xf218('0x1c')]===_0xf218('0x1b');var _0x1c4f23=_0x276bfa['count'];var _0x2174de=_0x22efaa?0x0:_0x47c1f0[_0xf218('0x1a')];var _0x340f20=_0x22efaa?_0x276bfa[_0xf218('0x1d')]:_0x47c1f0[_0xf218('0x1a')]+_0x47c1f0[_0xf218('0x1c')];var _0x5c52a4;if(_0x340f20>=_0x1c4f23){_0x340f20=_0x1c4f23;_0x5c52a4=0xc8;}else{_0x5c52a4=0xce;}_0x3d0771['status'](_0x5c52a4);return _0x3d0771['set']('Content-Range',_0x2174de+'-'+_0x340f20+'/'+_0x1c4f23)['json'](_0x276bfa);}return null;};}function patchUpdates(_0x60a1dd){return function(_0x372d06){try{jsonpatch[_0xf218('0x1e')](_0x372d06,_0x60a1dd,!![]);}catch(_0x4ec4c5){return BPromise['reject'](_0x4ec4c5);}return _0x372d06['save']();};}function saveUpdates(_0x4dd0bf,_0x407d6f){return function(_0x21536e){if(_0x21536e){return _0x21536e[_0xf218('0x1f')](_0x4dd0bf)[_0xf218('0x20')](function(_0x490666){return _0x490666;});}return null;};}function removeEntity(_0x271f41,_0xbd5ee7){return function(_0x409b65){if(_0x409b65){return _0x409b65['destroy']()[_0xf218('0x20')](function(){var _0x6fcbc9=_0x409b65[_0xf218('0x21')]({'plain':!![]});var _0x275c2c='IvrCampaigns';return db[_0xf218('0x22')][_0xf218('0x23')]({'where':{'type':_0x275c2c,'resourceId':_0x6fcbc9['id']}})[_0xf218('0x20')](function(){return _0x409b65;});})[_0xf218('0x20')](function(){_0x271f41[_0xf218('0x17')](0xcc)[_0xf218('0x18')]();});}};}function handleEntityNotFound(_0x273ace,_0x21a392){return function(_0x5beea7){if(!_0x5beea7){_0x273ace[_0xf218('0x16')](0x194);}return _0x5beea7;};}function handleError(_0x537429,_0x196ae4){_0x196ae4=_0x196ae4||0x1f4;return function(_0x272b65){logger[_0xf218('0x24')](_0x272b65[_0xf218('0x25')]);if(_0x272b65[_0xf218('0x26')]){delete _0x272b65[_0xf218('0x26')];}_0x537429[_0xf218('0x17')](_0x196ae4)['send'](_0x272b65);};}exports[_0xf218('0x27')]=function(_0x2ad6ee,_0x1fdb33){var _0x5019be={},_0x196006={},_0x2e41d1={'count':0x0,'rows':[]};var _0x31cc80=_[_0xf218('0x28')](db[_0xf218('0x29')]['rawAttributes'],function(_0xfe859c){return{'name':_0xfe859c[_0xf218('0x2a')],'type':_0xfe859c[_0xf218('0x2b')][_0xf218('0x2c')]};});_0x196006[_0xf218('0x2d')]=_[_0xf218('0x28')](_0x31cc80,_0xf218('0x26'));_0x196006[_0xf218('0x2e')]=_[_0xf218('0x2f')](_0x2ad6ee[_0xf218('0x2e')]);_0x196006[_0xf218('0x30')]=_[_0xf218('0x31')](_0x196006[_0xf218('0x2d')],_0x196006[_0xf218('0x2e')]);_0x5019be['attributes']=_['intersection'](_0x196006[_0xf218('0x2d')],qs[_0xf218('0x32')](_0x2ad6ee[_0xf218('0x2e')]['fields']));_0x5019be[_0xf218('0x33')]=_0x5019be[_0xf218('0x33')][_0xf218('0x34')]?_0x5019be[_0xf218('0x33')]:_0x196006['model'];if(!_0x2ad6ee[_0xf218('0x2e')][_0xf218('0x35')]('nolimit')){_0x5019be[_0xf218('0x1c')]=qs[_0xf218('0x1c')](_0x2ad6ee['query'][_0xf218('0x1c')]);_0x5019be[_0xf218('0x1a')]=qs['offset'](_0x2ad6ee[_0xf218('0x2e')]['offset']);}_0x5019be[_0xf218('0x36')]=qs['sort'](_0x2ad6ee[_0xf218('0x2e')][_0xf218('0x37')]);_0x5019be[_0xf218('0x38')]=qs[_0xf218('0x30')](_[_0xf218('0x39')](_0x2ad6ee['query'],_0x196006['filters']),_0x31cc80);if(_0x2ad6ee['query'][_0xf218('0x3a')]){_0x5019be['where']=_[_0xf218('0x3b')](_0x5019be[_0xf218('0x38')],{'$or':_[_0xf218('0x28')](_0x31cc80,function(_0x30bb40){if(_0x30bb40['type']!==_0xf218('0x3c')){var _0x44af9d={};_0x44af9d[_0x30bb40[_0xf218('0x26')]]={'$like':'%'+_0x2ad6ee[_0xf218('0x2e')]['filter']+'%'};return _0x44af9d;}})});}_0x5019be=_['merge']({},_0x5019be,_0x2ad6ee[_0xf218('0x3d')]);var _0xc2f54a={'where':_0x5019be[_0xf218('0x38')]};return db[_0xf218('0x29')]['count'](_0xc2f54a)[_0xf218('0x20')](function(_0x16e38c){_0x2e41d1['count']=_0x16e38c;if(_0x2ad6ee[_0xf218('0x2e')][_0xf218('0x3e')]){_0x5019be[_0xf218('0x3f')]=[{'all':!![]}];}return db[_0xf218('0x29')][_0xf218('0x40')](_0x5019be);})['then'](function(_0x3389d7){_0x2e41d1[_0xf218('0x41')]=_0x3389d7;return _0x2e41d1;})['then'](respondWithFilteredResult(_0x1fdb33,_0x5019be))[_0xf218('0x42')](handleError(_0x1fdb33,null));};exports[_0xf218('0x43')]=function(_0x1c60d7,_0x4c9222){var _0x58d2ff={'raw':![],'where':{'id':_0x1c60d7[_0xf218('0x44')]['id']}},_0x2e4381={};_0x2e4381[_0xf218('0x2d')]=_[_0xf218('0x2f')](db[_0xf218('0x29')]['rawAttributes']);_0x2e4381[_0xf218('0x2e')]=_[_0xf218('0x2f')](_0x1c60d7[_0xf218('0x2e')]);_0x2e4381[_0xf218('0x30')]=_['intersection'](_0x2e4381['model'],_0x2e4381['query']);_0x58d2ff[_0xf218('0x33')]=_[_0xf218('0x31')](_0x2e4381[_0xf218('0x2d')],qs[_0xf218('0x32')](_0x1c60d7[_0xf218('0x2e')][_0xf218('0x32')]));_0x58d2ff[_0xf218('0x33')]=_0x58d2ff[_0xf218('0x33')]['length']?_0x58d2ff['attributes']:_0x2e4381[_0xf218('0x2d')];if(_0x1c60d7[_0xf218('0x2e')][_0xf218('0x3e')]){_0x58d2ff[_0xf218('0x3f')]=[{'all':!![]}];}_0x58d2ff=_[_0xf218('0x3b')]({},_0x58d2ff,_0x1c60d7[_0xf218('0x3d')]);return db[_0xf218('0x29')]['find'](_0x58d2ff)[_0xf218('0x20')](handleEntityNotFound(_0x4c9222,null))['then'](respondWithResult(_0x4c9222,null))[_0xf218('0x42')](handleError(_0x4c9222,null));};exports['create']=function(_0x574965,_0x369cb7){return db[_0xf218('0x29')][_0xf218('0x45')](_0x574965[_0xf218('0x46')],{})['then'](function(_0x4226c1){var _0x40e74d=_0x574965[_0xf218('0x47')][_0xf218('0x21')]({'plain':!![]});if(!_0x40e74d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x40e74d[_0xf218('0x48')]===_0xf218('0x47')){var _0x340c8f=_0x4226c1[_0xf218('0x21')]({'plain':!![]});var _0x4a6ee8=_0xf218('0x49');return db['UserProfileSection'][_0xf218('0x4a')]({'where':{'name':_0x4a6ee8,'userProfileId':_0x40e74d[_0xf218('0x4b')]},'raw':!![]})['then'](function(_0x13f119){if(_0x13f119&&_0x13f119[_0xf218('0x4c')]===0x0){return db[_0xf218('0x22')][_0xf218('0x45')]({'name':_0x340c8f[_0xf218('0x26')],'resourceId':_0x340c8f['id'],'type':_0x13f119['name'],'sectionId':_0x13f119['id']},{})[_0xf218('0x20')](function(){return _0x4226c1;});}else{return _0x4226c1;}})['catch'](function(_0x18726f){logger['error'](_0xf218('0x4d'),_0x18726f);throw _0x18726f;});}return _0x4226c1;})[_0xf218('0x20')](respondWithResult(_0x369cb7,0xc9))[_0xf218('0x42')](handleError(_0x369cb7,null));};exports[_0xf218('0x4e')]=function(_0x14e69d,_0x42ba6b){var _0x5b28e4={'where':{'id':_0x14e69d[_0xf218('0x44')]['id']}},_0xd6231f={};_0xd6231f[_0xf218('0x2d')]=_[_0xf218('0x2f')](db['Campaign']['rawAttributes']);_0x5b28e4[_0xf218('0x33')]=_['intersection'](_0xd6231f[_0xf218('0x2d')],qs['fields'](_0x14e69d['query'][_0xf218('0x32')]));_0x5b28e4[_0xf218('0x33')]=_0x5b28e4[_0xf218('0x33')][_0xf218('0x34')]?_0x5b28e4[_0xf218('0x33')]:_0xd6231f[_0xf218('0x2d')];if(_0x14e69d[_0xf218('0x2e')][_0xf218('0x3e')]){_0x5b28e4[_0xf218('0x3f')]=[{'all':!![]}];}_0x5b28e4=_[_0xf218('0x3b')]({},_0x5b28e4,_0x14e69d[_0xf218('0x3d')]);return db[_0xf218('0x29')]['find'](_0x5b28e4)[_0xf218('0x20')](handleEntityNotFound(_0x42ba6b,null))[_0xf218('0x20')](function(_0xca0b77){if(_0xca0b77){var _0x567532=_0xca0b77[_0xf218('0x21')]({'plain':!![]});_0x567532=qs[_0xf218('0x4f')](_0x567532,['id',_0xf218('0x50'),_0xf218('0x51')]);_0x14e69d[_0xf218('0x46')]=_['omit'](_0x14e69d[_0xf218('0x46')],['id','createdAt',_0xf218('0x51')]);return db[_0xf218('0x29')][_0xf218('0x45')](_[_0xf218('0x3b')](_0x567532,_0x14e69d[_0xf218('0x46')]),{'include':_0x14e69d[_0xf218('0x2e')][_0xf218('0x3e')]?[{'all':!![]}]:undefined})[_0xf218('0x20')](function(_0x138de7){var _0x5e184e=_0x14e69d[_0xf218('0x47')][_0xf218('0x21')]({'plain':!![]});if(!_0x5e184e)throw new Error(_0xf218('0x52'));if(_0x5e184e[_0xf218('0x48')]===_0xf218('0x47')){var _0xa4d458=_0x138de7[_0xf218('0x21')]({'plain':!![]});var _0x1702fb=_0xf218('0x49');return db[_0xf218('0x53')][_0xf218('0x4a')]({'where':{'name':_0x1702fb,'userProfileId':_0x5e184e[_0xf218('0x4b')]},'raw':!![]})['then'](function(_0x17fc43){if(_0x17fc43&&_0x17fc43[_0xf218('0x4c')]===0x0){return db[_0xf218('0x22')][_0xf218('0x45')]({'name':_0xa4d458[_0xf218('0x26')],'resourceId':_0xa4d458['id'],'type':_0x17fc43[_0xf218('0x26')],'sectionId':_0x17fc43['id']},{})[_0xf218('0x20')](function(){return _0x138de7;});}else{return _0x138de7;}})[_0xf218('0x42')](function(_0x32f83a){logger['error'](_0xf218('0x4d'),_0x32f83a);throw _0x32f83a;});}return _0x138de7;});}})[_0xf218('0x20')](respondWithResult(_0x42ba6b,0xc9))['catch'](handleError(_0x42ba6b,null));};exports[_0xf218('0x1f')]=function(_0x116295,_0xa75067){if(_0x116295[_0xf218('0x46')]['id']){delete _0x116295[_0xf218('0x46')]['id'];}return db['Campaign'][_0xf218('0x4a')]({'where':{'id':_0x116295['params']['id']}})[_0xf218('0x20')](handleEntityNotFound(_0xa75067,null))[_0xf218('0x20')](saveUpdates(_0x116295[_0xf218('0x46')],null))[_0xf218('0x20')](respondWithResult(_0xa75067,null))[_0xf218('0x42')](handleError(_0xa75067,null));};exports[_0xf218('0x23')]=function(_0x2cd065,_0x472410){return db[_0xf218('0x29')]['find']({'where':{'id':_0x2cd065[_0xf218('0x44')]['id']}})[_0xf218('0x20')](handleEntityNotFound(_0x472410,null))[_0xf218('0x20')](removeEntity(_0x472410,null))[_0xf218('0x42')](handleError(_0x472410,null));};exports['getHoppers']=function(_0x343b4e,_0x1879c4,_0x2c0ae0){var _0x167ea7={'raw':!![],'where':{}};var _0x5b95f8={};var _0x42882f={'count':0x0,'rows':[]};return db[_0xf218('0x29')]['findOne']({'where':{'id':_0x343b4e[_0xf218('0x44')]['id']}})[_0xf218('0x20')](handleEntityNotFound(_0x1879c4,null))[_0xf218('0x20')](function(_0x49e82b){if(_0x49e82b){_0x5b95f8[_0xf218('0x2d')]=_[_0xf218('0x2f')](db[_0xf218('0x54')][_0xf218('0x55')]);_0x5b95f8[_0xf218('0x2e')]=_[_0xf218('0x2f')](_0x343b4e[_0xf218('0x2e')]);_0x5b95f8['filters']=_[_0xf218('0x31')](_0x5b95f8[_0xf218('0x2d')],_0x5b95f8['query']);_0x167ea7[_0xf218('0x33')]=_[_0xf218('0x31')](_0x5b95f8[_0xf218('0x2d')],qs[_0xf218('0x32')](_0x343b4e[_0xf218('0x2e')][_0xf218('0x32')]));_0x167ea7[_0xf218('0x33')]=_0x167ea7[_0xf218('0x33')][_0xf218('0x34')]?_0x167ea7[_0xf218('0x33')]:_0x5b95f8[_0xf218('0x2d')];if(!_0x343b4e['query'][_0xf218('0x35')](_0xf218('0x56'))){_0x167ea7[_0xf218('0x1c')]=qs[_0xf218('0x1c')](_0x343b4e[_0xf218('0x2e')][_0xf218('0x1c')]);_0x167ea7[_0xf218('0x1a')]=qs[_0xf218('0x1a')](_0x343b4e[_0xf218('0x2e')]['offset']);}_0x167ea7[_0xf218('0x36')]=qs['sort'](_0x343b4e[_0xf218('0x2e')][_0xf218('0x37')]);_0x167ea7['where']=qs['filters'](_[_0xf218('0x39')](_0x343b4e[_0xf218('0x2e')],_0x5b95f8[_0xf218('0x30')]));_0x167ea7[_0xf218('0x38')][_0xf218('0x57')]=_0x49e82b['id'];if(_0x343b4e[_0xf218('0x2e')][_0xf218('0x3a')]){_0x167ea7[_0xf218('0x38')]=_['merge'](_0x167ea7[_0xf218('0x38')],{'$or':_[_0xf218('0x28')](_0x167ea7[_0xf218('0x33')],function(_0x32d6a4){var _0x5dabb3={};_0x5dabb3[_0x32d6a4]={'$like':'%'+_0x343b4e[_0xf218('0x2e')][_0xf218('0x3a')]+'%'};return _0x5dabb3;})});}_0x167ea7=_[_0xf218('0x3b')]({},_0x167ea7,_0x343b4e[_0xf218('0x3d')]);return db[_0xf218('0x54')]['count']({'where':_0x167ea7[_0xf218('0x38')]})['then'](function(_0x1419a7){_0x42882f[_0xf218('0x1d')]=_0x1419a7;if(_0x343b4e[_0xf218('0x2e')][_0xf218('0x3e')]){_0x167ea7[_0xf218('0x3f')]=[{'all':!![]}];}return db[_0xf218('0x54')][_0xf218('0x40')](_0x167ea7);})[_0xf218('0x20')](function(_0x364bf6){_0x42882f[_0xf218('0x41')]=_0x364bf6;return _0x42882f;});}})[_0xf218('0x20')](respondWithFilteredResult(_0x1879c4,_0x167ea7))[_0xf218('0x42')](handleError(_0x1879c4,null));};exports[_0xf218('0x58')]=function(_0x161519,_0x1b727f,_0x2cc9b9){var _0x5e4de5={'raw':!![],'where':{}};var _0x4121a1={};var _0x4f998f={'count':0x0,'rows':[]};return db[_0xf218('0x29')][_0xf218('0x59')]({'where':{'id':_0x161519[_0xf218('0x44')]['id']}})[_0xf218('0x20')](handleEntityNotFound(_0x1b727f,null))['then'](function(_0x1556ab){if(_0x1556ab){_0x4121a1['model']=_['keys'](db[_0xf218('0x5a')]['rawAttributes']);_0x4121a1[_0xf218('0x2e')]=_[_0xf218('0x2f')](_0x161519['query']);_0x4121a1[_0xf218('0x30')]=_[_0xf218('0x31')](_0x4121a1['model'],_0x4121a1[_0xf218('0x2e')]);_0x5e4de5['attributes']=_[_0xf218('0x31')](_0x4121a1[_0xf218('0x2d')],qs[_0xf218('0x32')](_0x161519[_0xf218('0x2e')][_0xf218('0x32')]));_0x5e4de5[_0xf218('0x33')]=_0x5e4de5[_0xf218('0x33')][_0xf218('0x34')]?_0x5e4de5[_0xf218('0x33')]:_0x4121a1[_0xf218('0x2d')];if(!_0x161519[_0xf218('0x2e')][_0xf218('0x35')](_0xf218('0x56'))){_0x5e4de5[_0xf218('0x1c')]=qs['limit'](_0x161519[_0xf218('0x2e')][_0xf218('0x1c')]);_0x5e4de5[_0xf218('0x1a')]=qs['offset'](_0x161519[_0xf218('0x2e')][_0xf218('0x1a')]);}_0x5e4de5[_0xf218('0x36')]=qs[_0xf218('0x37')](_0x161519[_0xf218('0x2e')]['sort']);_0x5e4de5[_0xf218('0x38')]=qs[_0xf218('0x30')](_[_0xf218('0x39')](_0x161519['query'],_0x4121a1[_0xf218('0x30')]));_0x5e4de5[_0xf218('0x38')][_0xf218('0x57')]=_0x1556ab['id'];if(_0x161519[_0xf218('0x2e')][_0xf218('0x3a')]){_0x5e4de5['where']=_[_0xf218('0x3b')](_0x5e4de5[_0xf218('0x38')],{'$or':_['map'](_0x5e4de5['attributes'],function(_0xef26ca){var _0x38b714={};_0x38b714[_0xef26ca]={'$like':'%'+_0x161519[_0xf218('0x2e')][_0xf218('0x3a')]+'%'};return _0x38b714;})});}_0x5e4de5=_[_0xf218('0x3b')]({},_0x5e4de5,_0x161519[_0xf218('0x3d')]);return db[_0xf218('0x5a')][_0xf218('0x1d')]({'where':_0x5e4de5[_0xf218('0x38')]})[_0xf218('0x20')](function(_0xb6d716){_0x4f998f[_0xf218('0x1d')]=_0xb6d716;if(_0x161519[_0xf218('0x2e')][_0xf218('0x3e')]){_0x5e4de5['include']=[{'all':!![]}];}return db[_0xf218('0x5a')][_0xf218('0x40')](_0x5e4de5);})[_0xf218('0x20')](function(_0xabba67){_0x4f998f[_0xf218('0x41')]=_0xabba67;return _0x4f998f;});}})[_0xf218('0x20')](respondWithFilteredResult(_0x1b727f,_0x5e4de5))['catch'](handleError(_0x1b727f,null));};exports[_0xf218('0x5b')]=function(_0x58f944,_0x51fbab,_0x267aed){var _0x424605={'raw':!![],'where':{}};var _0xff599={};var _0x52b676={'count':0x0,'rows':[]};return db[_0xf218('0x29')][_0xf218('0x59')]({'where':{'id':_0x58f944[_0xf218('0x44')]['id']}})[_0xf218('0x20')](handleEntityNotFound(_0x51fbab,null))[_0xf218('0x20')](function(_0x1f0cdc){if(_0x1f0cdc){_0xff599[_0xf218('0x2d')]=_[_0xf218('0x2f')](db[_0xf218('0x5c')]['rawAttributes']);_0xff599[_0xf218('0x2e')]=_[_0xf218('0x2f')](_0x58f944[_0xf218('0x2e')]);_0xff599['filters']=_['intersection'](_0xff599[_0xf218('0x2d')],_0xff599['query']);_0x424605[_0xf218('0x33')]=_[_0xf218('0x31')](_0xff599['model'],qs['fields'](_0x58f944[_0xf218('0x2e')][_0xf218('0x32')]));_0x424605[_0xf218('0x33')]=_0x424605[_0xf218('0x33')][_0xf218('0x34')]?_0x424605[_0xf218('0x33')]:_0xff599[_0xf218('0x2d')];if(!_0x58f944[_0xf218('0x2e')][_0xf218('0x35')](_0xf218('0x56'))){_0x424605[_0xf218('0x1c')]=qs[_0xf218('0x1c')](_0x58f944[_0xf218('0x2e')][_0xf218('0x1c')]);_0x424605['offset']=qs[_0xf218('0x1a')](_0x58f944[_0xf218('0x2e')][_0xf218('0x1a')]);}_0x424605[_0xf218('0x36')]=qs['sort'](_0x58f944[_0xf218('0x2e')]['sort']);_0x424605[_0xf218('0x38')]=qs[_0xf218('0x30')](_['pick'](_0x58f944[_0xf218('0x2e')],_0xff599[_0xf218('0x30')]));_0x424605['where'][_0xf218('0x57')]=_0x1f0cdc['id'];if(_0x58f944[_0xf218('0x2e')][_0xf218('0x3a')]){_0x424605[_0xf218('0x38')]=_[_0xf218('0x3b')](_0x424605[_0xf218('0x38')],{'$or':_['map'](_0x424605[_0xf218('0x33')],function(_0x579760){var _0x25d91e={};_0x25d91e[_0x579760]={'$like':'%'+_0x58f944[_0xf218('0x2e')]['filter']+'%'};return _0x25d91e;})});}_0x424605=_[_0xf218('0x3b')]({},_0x424605,_0x58f944[_0xf218('0x3d')]);return db[_0xf218('0x5c')]['count']({'where':_0x424605[_0xf218('0x38')]})[_0xf218('0x20')](function(_0x1b0500){_0x52b676[_0xf218('0x1d')]=_0x1b0500;if(_0x58f944[_0xf218('0x2e')][_0xf218('0x3e')]){_0x424605[_0xf218('0x3f')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x424605);})[_0xf218('0x20')](function(_0x1727aa){_0x52b676[_0xf218('0x41')]=_0x1727aa;return _0x52b676;});}})['then'](respondWithFilteredResult(_0x51fbab,_0x424605))['catch'](handleError(_0x51fbab,null));};exports[_0xf218('0x5d')]=function(_0xf2560a,_0x1232b1,_0xd8abfc){var _0x4bf8af={'raw':!![],'where':{}};var _0x4694f8={};var _0x23a8e5={'count':0x0,'rows':[]};return db[_0xf218('0x29')][_0xf218('0x59')]({'where':{'id':_0xf2560a[_0xf218('0x44')]['id']}})[_0xf218('0x20')](handleEntityNotFound(_0x1232b1,null))[_0xf218('0x20')](function(_0x507d16){if(_0x507d16){_0x4694f8[_0xf218('0x2d')]=_[_0xf218('0x2f')](db[_0xf218('0x5e')][_0xf218('0x55')]);_0x4694f8['query']=_[_0xf218('0x2f')](_0xf2560a['query']);_0x4694f8['filters']=_[_0xf218('0x31')](_0x4694f8['model'],_0x4694f8['query']);_0x4bf8af[_0xf218('0x33')]=_[_0xf218('0x31')](_0x4694f8[_0xf218('0x2d')],qs[_0xf218('0x32')](_0xf2560a[_0xf218('0x2e')][_0xf218('0x32')]));_0x4bf8af[_0xf218('0x33')]=_0x4bf8af[_0xf218('0x33')]['length']?_0x4bf8af[_0xf218('0x33')]:_0x4694f8[_0xf218('0x2d')];if(!_0xf2560a[_0xf218('0x2e')][_0xf218('0x35')](_0xf218('0x56'))){_0x4bf8af[_0xf218('0x1c')]=qs[_0xf218('0x1c')](_0xf2560a['query'][_0xf218('0x1c')]);_0x4bf8af[_0xf218('0x1a')]=qs[_0xf218('0x1a')](_0xf2560a[_0xf218('0x2e')][_0xf218('0x1a')]);}_0x4bf8af[_0xf218('0x36')]=qs['sort'](_0xf2560a[_0xf218('0x2e')][_0xf218('0x37')]);_0x4bf8af['where']=qs[_0xf218('0x30')](_[_0xf218('0x39')](_0xf2560a['query'],_0x4694f8[_0xf218('0x30')]));_0x4bf8af[_0xf218('0x38')][_0xf218('0x57')]=_0x507d16['id'];if(_0xf2560a[_0xf218('0x2e')][_0xf218('0x3a')]){_0x4bf8af['where']=_[_0xf218('0x3b')](_0x4bf8af[_0xf218('0x38')],{'$or':_[_0xf218('0x28')](_0x4bf8af[_0xf218('0x33')],function(_0x3c187f){var _0x237cb3={};_0x237cb3[_0x3c187f]={'$like':'%'+_0xf2560a[_0xf218('0x2e')][_0xf218('0x3a')]+'%'};return _0x237cb3;})});}_0x4bf8af=_[_0xf218('0x3b')]({},_0x4bf8af,_0xf2560a[_0xf218('0x3d')]);return db[_0xf218('0x5e')][_0xf218('0x1d')]({'where':_0x4bf8af['where']})['then'](function(_0x165507){_0x23a8e5[_0xf218('0x1d')]=_0x165507;if(_0xf2560a[_0xf218('0x2e')][_0xf218('0x3e')]){_0x4bf8af['include']=[{'all':!![]}];}return db[_0xf218('0x5e')]['findAll'](_0x4bf8af);})[_0xf218('0x20')](function(_0x3cf6be){_0x23a8e5['rows']=_0x3cf6be;return _0x23a8e5;});}})[_0xf218('0x20')](respondWithFilteredResult(_0x1232b1,_0x4bf8af))['catch'](handleError(_0x1232b1,null));};exports[_0xf218('0x5f')]=function(_0x1b6d2e,_0x434c72,_0x16184a){var _0x398461={};var _0x1b46a8={};var _0x640a4c;var _0x548995;return db[_0xf218('0x29')][_0xf218('0x59')]({'where':{'id':_0x1b6d2e[_0xf218('0x44')]['id']}})[_0xf218('0x20')](handleEntityNotFound(_0x434c72,null))[_0xf218('0x20')](function(_0x143ea7){if(_0x143ea7){_0x640a4c=_0x143ea7;_0x1b46a8['model']=_['keys'](db[_0xf218('0x60')][_0xf218('0x55')]);_0x1b46a8[_0xf218('0x2e')]=_[_0xf218('0x2f')](_0x1b6d2e[_0xf218('0x2e')]);_0x1b46a8[_0xf218('0x30')]=_['intersection'](_0x1b46a8[_0xf218('0x2d')],_0x1b46a8[_0xf218('0x2e')]);_0x398461[_0xf218('0x33')]=_['intersection'](_0x1b46a8[_0xf218('0x2d')],qs[_0xf218('0x32')](_0x1b6d2e[_0xf218('0x2e')]['fields']));_0x398461[_0xf218('0x33')]=_0x398461['attributes']['length']?_0x398461[_0xf218('0x33')]:_0x1b46a8[_0xf218('0x2d')];_0x398461[_0xf218('0x36')]=qs[_0xf218('0x37')](_0x1b6d2e[_0xf218('0x2e')][_0xf218('0x37')]);_0x398461['where']=qs['filters'](_[_0xf218('0x39')](_0x1b6d2e[_0xf218('0x2e')],_0x1b46a8[_0xf218('0x30')]));if(_0x1b6d2e[_0xf218('0x2e')]['filter']){_0x398461[_0xf218('0x38')]=_[_0xf218('0x3b')](_0x398461[_0xf218('0x38')],{'$or':_['map'](_0x398461[_0xf218('0x33')],function(_0x5eff2d){var _0x26d588={};_0x26d588[_0x5eff2d]={'$like':'%'+_0x1b6d2e['query']['filter']+'%'};return _0x26d588;})});}_0x398461=_[_0xf218('0x3b')]({},_0x398461,_0x1b6d2e[_0xf218('0x3d')]);return _0x640a4c[_0xf218('0x5f')](_0x398461);}})[_0xf218('0x20')](function(_0x4d2982){if(_0x4d2982){_0x548995=_0x4d2982[_0xf218('0x34')];if(!_0x1b6d2e[_0xf218('0x2e')][_0xf218('0x35')](_0xf218('0x56'))){_0x398461[_0xf218('0x1c')]=qs[_0xf218('0x1c')](_0x1b6d2e[_0xf218('0x2e')]['limit']);_0x398461[_0xf218('0x1a')]=qs[_0xf218('0x1a')](_0x1b6d2e[_0xf218('0x2e')][_0xf218('0x1a')]);}return _0x640a4c[_0xf218('0x5f')](_0x398461);}})[_0xf218('0x20')](function(_0x55f80f){if(_0x55f80f){return _0x55f80f?{'count':_0x548995,'rows':_0x55f80f}:null;}})['then'](respondWithResult(_0x434c72,null))[_0xf218('0x42')](handleError(_0x434c72,null));};exports[_0xf218('0x61')]=function(_0x40ac6f,_0x3964d4,_0x44658c){var _0xc0c0e5,_0x396a0a;return db[_0xf218('0x29')][_0xf218('0x4a')]({'where':{'id':_0x40ac6f[_0xf218('0x44')]['id']}})[_0xf218('0x20')](handleEntityNotFound(_0x3964d4,null))[_0xf218('0x20')](function(_0x14e7df){if(_0x14e7df){_0x396a0a=_0x14e7df;return _0x14e7df[_0xf218('0x61')](_0x40ac6f[_0xf218('0x46')][_0xf218('0x62')],_[_0xf218('0x4f')](_0x40ac6f['body'],[_0xf218('0x62'),'id'])||{});}return null;})[_0xf218('0x63')](function(_0x439c44){var _0x5064cf;_0xc0c0e5=_0x439c44||[];var _0x3e96c2=[];if(_0x439c44){for(var _0x13e32d=0x0;_0x13e32d<_0x439c44[_0xf218('0x34')];_0x13e32d+=0x1){var _0x48fe5b=_0x439c44[_0x13e32d]['get']({'plain':!![]});_0x396a0a[_0xf218('0x64')]=_0x40ac6f[_0xf218('0x46')][_0xf218('0x64')]?_0x40ac6f['body'][_0xf218('0x64')]:_0x396a0a[_0xf218('0x64')];switch(_0x396a0a['dialCheckDuplicateType']){case'always':_0x5064cf=squel['insert']()['into'](_0xf218('0x65'))[_0xf218('0x66')](['phone','scheduledAt',_0xf218('0x67'),_0xf218('0x68'),_0xf218('0x57'),_0xf218('0x50'),_0xf218('0x51')],squel[_0xf218('0x69')]()['field'](_0xf218('0x6a'),_0xf218('0x6a'))[_0xf218('0x6b')](_0xf218('0x6c'),_0xf218('0x6d'))[_0xf218('0x6b')]('id',_0xf218('0x67'))[_0xf218('0x6b')](_0x48fe5b[_0xf218('0x6e')]['toString'](),_0xf218('0x68'))[_0xf218('0x6b')](_0x40ac6f[_0xf218('0x44')]['id'][_0xf218('0x6f')](),_0xf218('0x57'))[_0xf218('0x6b')](_0xf218('0x6c'),_0xf218('0x50'))[_0xf218('0x6b')](_0xf218('0x6c'),_0xf218('0x51'))[_0xf218('0x70')](_0xf218('0x71'))[_0xf218('0x38')](_0xf218('0x72'))[_0xf218('0x38')](_0xf218('0x73'),_0x48fe5b['CmListId'][_0xf218('0x6f')]())[_0xf218('0x38')](_0xf218('0x74'))[_0xf218('0x38')](_0xf218('0x75'),squel[_0xf218('0x69')]()[_0xf218('0x6b')](_0xf218('0x76'))[_0xf218('0x70')]('cm_hopper_final')[_0xf218('0x38')]('CampaignId\x20=\x20?',_0x40ac6f[_0xf218('0x44')]['id'][_0xf218('0x6f')]()))['where'](_0xf218('0x75'),squel['select']()[_0xf218('0x6b')](_0xf218('0x77'))['from']('cm_hopper')[_0xf218('0x38')](_0xf218('0x78'),_0x40ac6f[_0xf218('0x44')]['id'][_0xf218('0x6f')]())))[_0xf218('0x6f')]();break;case _0xf218('0x79'):_0x5064cf=squel[_0xf218('0x7a')]()[_0xf218('0x7b')](_0xf218('0x65'))[_0xf218('0x66')]([_0xf218('0x6a'),'scheduledAt',_0xf218('0x67'),'ListId',_0xf218('0x57'),_0xf218('0x50'),_0xf218('0x51')],squel[_0xf218('0x69')]()[_0xf218('0x6b')](_0xf218('0x6a'),_0xf218('0x6a'))[_0xf218('0x6b')]('NOW()','scheduledAt')[_0xf218('0x6b')]('id',_0xf218('0x67'))[_0xf218('0x6b')](_0x48fe5b[_0xf218('0x6e')]['toString'](),_0xf218('0x68'))[_0xf218('0x6b')](_0x40ac6f['params']['id']['toString'](),'CampaignId')[_0xf218('0x6b')](_0xf218('0x6c'),_0xf218('0x50'))[_0xf218('0x6b')](_0xf218('0x6c'),'updatedAt')[_0xf218('0x70')](_0xf218('0x71'))[_0xf218('0x38')](_0xf218('0x72'))[_0xf218('0x38')]('ListId\x20=\x20?',_0x48fe5b[_0xf218('0x6e')]['toString']())[_0xf218('0x38')]('phone\x20IS\x20NOT\x20NULL')[_0xf218('0x38')]('phone\x20NOT\x20IN\x20(?)',squel[_0xf218('0x69')]()[_0xf218('0x6b')](_0xf218('0x77'))[_0xf218('0x70')](_0xf218('0x65'))[_0xf218('0x38')](_0xf218('0x78'),_0x40ac6f[_0xf218('0x44')]['id'][_0xf218('0x6f')]())))[_0xf218('0x6f')]();break;default:_0x5064cf=squel['insert']()[_0xf218('0x7b')](_0xf218('0x65'))[_0xf218('0x66')]([_0xf218('0x6a'),_0xf218('0x6d'),_0xf218('0x67'),_0xf218('0x68'),'CampaignId',_0xf218('0x50'),_0xf218('0x51')],squel[_0xf218('0x69')]()['field'](_0xf218('0x6a'),_0xf218('0x6a'))[_0xf218('0x6b')](_0xf218('0x6c'),_0xf218('0x6d'))[_0xf218('0x6b')]('id',_0xf218('0x67'))[_0xf218('0x6b')](_0x48fe5b['CmListId'][_0xf218('0x6f')](),'ListId')['field'](_0x40ac6f[_0xf218('0x44')]['id']['toString'](),_0xf218('0x57'))[_0xf218('0x6b')](_0xf218('0x6c'),'createdAt')['field'](_0xf218('0x6c'),_0xf218('0x51'))[_0xf218('0x70')]('cm_contacts')['where'](_0xf218('0x72'))[_0xf218('0x38')](_0xf218('0x73'),_0x48fe5b[_0xf218('0x6e')][_0xf218('0x6f')]())[_0xf218('0x38')](_0xf218('0x74')))[_0xf218('0x6f')]();}_0x3e96c2[_0xf218('0x7c')](db['sequelize'][_0xf218('0x2e')](_0x5064cf));}return BPromise[_0xf218('0x7d')](_0x3e96c2);}})['then'](function(){return _0xc0c0e5;})[_0xf218('0x20')](respondWithResult(_0x3964d4,null))['catch'](handleError(_0x3964d4,null));};exports[_0xf218('0x7e')]=function(_0x5bdaa3,_0x4ee4c1,_0x345d96){return db[_0xf218('0x29')][_0xf218('0x4a')]({'where':{'id':_0x5bdaa3[_0xf218('0x44')]['id']}})[_0xf218('0x20')](handleEntityNotFound(_0x4ee4c1,null))[_0xf218('0x20')](function(_0x2f74af){if(_0x2f74af){return _0x2f74af[_0xf218('0x7e')](_0x5bdaa3[_0xf218('0x2e')][_0xf218('0x62')]);}})[_0xf218('0x20')](function(_0x2ede61){if(_0x2ede61){return db[_0xf218('0x54')][_0xf218('0x23')]({'where':{'ListId':_0x5bdaa3[_0xf218('0x2e')][_0xf218('0x62')],'CampaignId':_0x5bdaa3[_0xf218('0x44')]['id']}})[_0xf218('0x20')](function(){return _0x2ede61;});}})[_0xf218('0x20')](respondWithStatusCode(_0x4ee4c1,null))['catch'](handleError(_0x4ee4c1,null));};exports[_0xf218('0x7f')]=function(_0x53133d,_0x545321,_0x113416){var _0xa7935a={};var _0xf79e45={};var _0x14d435;var _0x55f83b;return db['Campaign']['findOne']({'where':{'id':_0x53133d[_0xf218('0x44')]['id']}})[_0xf218('0x20')](handleEntityNotFound(_0x545321,null))[_0xf218('0x20')](function(_0x58189e){if(_0x58189e){_0x14d435=_0x58189e;_0xf79e45[_0xf218('0x2d')]=_[_0xf218('0x2f')](db[_0xf218('0x60')][_0xf218('0x55')]);_0xf79e45[_0xf218('0x2e')]=_['keys'](_0x53133d['query']);_0xf79e45['filters']=_[_0xf218('0x31')](_0xf79e45[_0xf218('0x2d')],_0xf79e45[_0xf218('0x2e')]);_0xa7935a['attributes']=_[_0xf218('0x31')](_0xf79e45[_0xf218('0x2d')],qs['fields'](_0x53133d[_0xf218('0x2e')][_0xf218('0x32')]));_0xa7935a['attributes']=_0xa7935a[_0xf218('0x33')]['length']?_0xa7935a['attributes']:_0xf79e45[_0xf218('0x2d')];_0xa7935a[_0xf218('0x36')]=qs[_0xf218('0x37')](_0x53133d[_0xf218('0x2e')][_0xf218('0x37')]);_0xa7935a[_0xf218('0x38')]=qs[_0xf218('0x30')](_[_0xf218('0x39')](_0x53133d['query'],_0xf79e45['filters']));if(_0x53133d[_0xf218('0x2e')]['filter']){_0xa7935a['where']=_[_0xf218('0x3b')](_0xa7935a['where'],{'$or':_[_0xf218('0x28')](_0xa7935a[_0xf218('0x33')],function(_0x3fb180){var _0x48531c={};_0x48531c[_0x3fb180]={'$like':'%'+_0x53133d[_0xf218('0x2e')][_0xf218('0x3a')]+'%'};return _0x48531c;})});}_0xa7935a=_[_0xf218('0x3b')]({},_0xa7935a,_0x53133d[_0xf218('0x3d')]);return _0x14d435[_0xf218('0x7f')](_0xa7935a);}})['then'](function(_0x2de61c){if(_0x2de61c){_0x55f83b=_0x2de61c[_0xf218('0x34')];if(!_0x53133d[_0xf218('0x2e')][_0xf218('0x35')](_0xf218('0x56'))){_0xa7935a['limit']=qs[_0xf218('0x1c')](_0x53133d[_0xf218('0x2e')]['limit']);_0xa7935a[_0xf218('0x1a')]=qs[_0xf218('0x1a')](_0x53133d[_0xf218('0x2e')]['offset']);}return _0x14d435[_0xf218('0x7f')](_0xa7935a);}})[_0xf218('0x20')](function(_0x4c1528){if(_0x4c1528){return _0x4c1528?{'count':_0x55f83b,'rows':_0x4c1528}:null;}})[_0xf218('0x20')](respondWithResult(_0x545321,null))[_0xf218('0x42')](handleError(_0x545321,null));};exports[_0xf218('0x80')]=function(_0x381cb3,_0x82df99,_0x131df3){var _0x67308c,_0x32eda8;return db[_0xf218('0x29')][_0xf218('0x4a')]({'where':{'id':_0x381cb3[_0xf218('0x44')]['id']}})[_0xf218('0x20')](handleEntityNotFound(_0x82df99,null))[_0xf218('0x20')](function(_0x356d84){if(_0x356d84){_0x32eda8=_0x356d84;return _0x356d84[_0xf218('0x80')](_0x381cb3[_0xf218('0x46')][_0xf218('0x62')],_[_0xf218('0x4f')](_0x381cb3['body'],[_0xf218('0x62'),'id'])||{});}return null;})[_0xf218('0x63')](function(_0x5a8ec1){var _0x3f9645;_0x67308c=_0x5a8ec1||[];var _0x38ed22=[];if(_0x5a8ec1){for(var _0x215d80=0x0;_0x215d80<_0x5a8ec1[_0xf218('0x34')];_0x215d80+=0x1){var _0x5a6ca8=_0x5a8ec1[_0x215d80][_0xf218('0x21')]({'plain':!![]});_0x3f9645=squel['insert']()[_0xf218('0x7b')](_0xf218('0x81'))['fromQuery'](['phone',_0xf218('0x67'),_0xf218('0x68'),_0xf218('0x57'),_0xf218('0x50'),_0xf218('0x51')],squel[_0xf218('0x69')]()['field']('phone',_0xf218('0x6a'))[_0xf218('0x6b')]('id',_0xf218('0x67'))[_0xf218('0x6b')](_0x5a6ca8[_0xf218('0x6e')][_0xf218('0x6f')](),_0xf218('0x68'))[_0xf218('0x6b')](_0x381cb3[_0xf218('0x44')]['id'][_0xf218('0x6f')](),'CampaignId')[_0xf218('0x6b')](_0xf218('0x6c'),_0xf218('0x50'))[_0xf218('0x6b')](_0xf218('0x6c'),_0xf218('0x51'))['from']('cm_contacts')['where'](_0xf218('0x72'))[_0xf218('0x38')](_0xf218('0x73'),_0x5a6ca8[_0xf218('0x6e')]['toString']())['where'](_0xf218('0x74')))[_0xf218('0x6f')]();_0x38ed22['push'](db['sequelize'][_0xf218('0x2e')](_0x3f9645));}return BPromise[_0xf218('0x7d')](_0x38ed22);}})[_0xf218('0x20')](function(){return _0x67308c;})[_0xf218('0x20')](respondWithResult(_0x82df99,null))[_0xf218('0x42')](handleError(_0x82df99,null));};exports[_0xf218('0x82')]=function(_0x37688f,_0x3bb6f6,_0x4d5fa4){return db['Campaign'][_0xf218('0x4a')]({'where':{'id':_0x37688f[_0xf218('0x44')]['id']}})[_0xf218('0x20')](handleEntityNotFound(_0x3bb6f6,null))[_0xf218('0x20')](function(_0x2f0af8){if(_0x2f0af8){return _0x2f0af8[_0xf218('0x82')](_0x37688f[_0xf218('0x2e')][_0xf218('0x62')]);}})[_0xf218('0x20')](function(_0x4a7643){if(_0x4a7643){return db[_0xf218('0x5e')][_0xf218('0x23')]({'where':{'ListId':_0x37688f[_0xf218('0x2e')]['ids'],'CampaignId':_0x37688f['params']['id']}})[_0xf218('0x20')](function(){return _0x4a7643;});}})[_0xf218('0x20')](respondWithStatusCode(_0x3bb6f6,null))[_0xf218('0x42')](handleError(_0x3bb6f6,null));}; \ No newline at end of file +var _0x7792=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','IvrCampaigns','UserProfileResource','end','stack','name','send','index','map','Campaign','rawAttributes','type','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','include','findAll','rows','catch','show','params','keys','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','UserProfileSection','userProfileId','autoAssociation','error','getHoppers','findOne','CmHopper','CampaignId','getHopperHistories','CmHopperHistory','nolimit','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','CmList','getLists','addLists','ids','spread','dialCheckDuplicateType','into','cm_hopper','phone','scheduledAt','ContactId','NOW()','field','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','CmListId','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','select','COALESCE(phone,\x27\x27)','insert','fromQuery','ListId','phone\x20IS\x20NOT\x20NULL','ListId\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','removeBlackLists','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs'];(function(_0x460f81,_0x553431){var _0x423f0d=function(_0x267a6b){while(--_0x267a6b){_0x460f81['push'](_0x460f81['shift']());}};_0x423f0d(++_0x553431);}(_0x7792,0x184));var _0x2779=function(_0x229f5e,_0x433f0f){_0x229f5e=_0x229f5e-0x0;var _0x2d62ff=_0x7792[_0x229f5e];return _0x2d62ff;};'use strict';var emlformat=require(_0x2779('0x0'));var rimraf=require(_0x2779('0x1'));var zipdir=require(_0x2779('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2779('0x3'));var moment=require(_0x2779('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2779('0x5'));var util=require(_0x2779('0x6'));var path=require(_0x2779('0x7'));var sox=require(_0x2779('0x8'));var csv=require('to-csv');var ejs=require(_0x2779('0x9'));var fs=require('fs');var fs_extra=require(_0x2779('0xa'));var _=require(_0x2779('0xb'));var squel=require(_0x2779('0xc'));var crypto=require(_0x2779('0xd'));var jsforce=require(_0x2779('0xe'));var deskjs=require(_0x2779('0xf'));var toCsv=require(_0x2779('0x10'));var querystring=require(_0x2779('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2779('0x12'));var qs=require(_0x2779('0x13'));var as=require(_0x2779('0x14'));var hardwareService=require(_0x2779('0x15'));var logger=require('../../config/logger')(_0x2779('0x16'));var utils=require(_0x2779('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x2779('0x18'));var db=require(_0x2779('0x19'))['db'];function respondWithStatusCode(_0x285786,_0xd98fe0){_0xd98fe0=_0xd98fe0||0xcc;return function(_0x503fac){if(_0x503fac){return _0x285786[_0x2779('0x1a')](_0xd98fe0);}return _0x285786[_0x2779('0x1b')](_0xd98fe0)['end']();};}function respondWithResult(_0x3e28a1,_0x22122b){_0x22122b=_0x22122b||0xc8;return function(_0x3ac775){if(_0x3ac775){return _0x3e28a1[_0x2779('0x1b')](_0x22122b)[_0x2779('0x1c')](_0x3ac775);}};}function respondWithFilteredResult(_0xdca5d5,_0xffe5b1){return function(_0x1cfd85){if(_0x1cfd85){var _0xb29e28=typeof _0xffe5b1[_0x2779('0x1d')]===_0x2779('0x1e')&&typeof _0xffe5b1[_0x2779('0x1f')]===_0x2779('0x1e');var _0x103498=_0x1cfd85[_0x2779('0x20')];var _0x27ea78=_0xb29e28?0x0:_0xffe5b1[_0x2779('0x1d')];var _0x492fe0=_0xb29e28?_0x1cfd85[_0x2779('0x20')]:_0xffe5b1[_0x2779('0x1d')]+_0xffe5b1[_0x2779('0x1f')];var _0x2786aa;if(_0x492fe0>=_0x103498){_0x492fe0=_0x103498;_0x2786aa=0xc8;}else{_0x2786aa=0xce;}_0xdca5d5['status'](_0x2786aa);return _0xdca5d5[_0x2779('0x21')](_0x2779('0x22'),_0x27ea78+'-'+_0x492fe0+'/'+_0x103498)[_0x2779('0x1c')](_0x1cfd85);}return null;};}function patchUpdates(_0x989416){return function(_0x206644){try{jsonpatch['apply'](_0x206644,_0x989416,!![]);}catch(_0x2ddfd3){return BPromise[_0x2779('0x23')](_0x2ddfd3);}return _0x206644[_0x2779('0x24')]();};}function saveUpdates(_0x441648,_0x6ff722){return function(_0x4d6d5a){if(_0x4d6d5a){return _0x4d6d5a[_0x2779('0x25')](_0x441648)[_0x2779('0x26')](function(_0xdbc38a){return _0xdbc38a;});}return null;};}function removeEntity(_0x45e2da,_0x5a728d){return function(_0x338336){if(_0x338336){return _0x338336[_0x2779('0x27')]()[_0x2779('0x26')](function(){var _0x289af4=_0x338336[_0x2779('0x28')]({'plain':!![]});var _0x10b63e=_0x2779('0x29');return db[_0x2779('0x2a')][_0x2779('0x27')]({'where':{'type':_0x10b63e,'resourceId':_0x289af4['id']}})[_0x2779('0x26')](function(){return _0x338336;});})[_0x2779('0x26')](function(){_0x45e2da[_0x2779('0x1b')](0xcc)[_0x2779('0x2b')]();});}};}function handleEntityNotFound(_0x375a68,_0x327e43){return function(_0x51dced){if(!_0x51dced){_0x375a68['sendStatus'](0x194);}return _0x51dced;};}function handleError(_0x34b4ea,_0x32081c){_0x32081c=_0x32081c||0x1f4;return function(_0x4cf2f4){logger['error'](_0x4cf2f4[_0x2779('0x2c')]);if(_0x4cf2f4[_0x2779('0x2d')]){delete _0x4cf2f4['name'];}_0x34b4ea['status'](_0x32081c)[_0x2779('0x2e')](_0x4cf2f4);};}exports[_0x2779('0x2f')]=function(_0x3ce4cd,_0xaf4276){var _0x3f4f9c={},_0x56a5e2={},_0x26baf7={'count':0x0,'rows':[]};var _0x48b092=_[_0x2779('0x30')](db[_0x2779('0x31')][_0x2779('0x32')],function(_0x35a9bf){return{'name':_0x35a9bf['fieldName'],'type':_0x35a9bf[_0x2779('0x33')]['key']};});_0x56a5e2['model']=_[_0x2779('0x30')](_0x48b092,_0x2779('0x2d'));_0x56a5e2[_0x2779('0x34')]=_['keys'](_0x3ce4cd['query']);_0x56a5e2[_0x2779('0x35')]=_['intersection'](_0x56a5e2[_0x2779('0x36')],_0x56a5e2[_0x2779('0x34')]);_0x3f4f9c[_0x2779('0x37')]=_[_0x2779('0x38')](_0x56a5e2['model'],qs[_0x2779('0x39')](_0x3ce4cd[_0x2779('0x34')][_0x2779('0x39')]));_0x3f4f9c[_0x2779('0x37')]=_0x3f4f9c[_0x2779('0x37')][_0x2779('0x3a')]?_0x3f4f9c[_0x2779('0x37')]:_0x56a5e2[_0x2779('0x36')];if(!_0x3ce4cd[_0x2779('0x34')][_0x2779('0x3b')]('nolimit')){_0x3f4f9c[_0x2779('0x1f')]=qs['limit'](_0x3ce4cd[_0x2779('0x34')][_0x2779('0x1f')]);_0x3f4f9c[_0x2779('0x1d')]=qs[_0x2779('0x1d')](_0x3ce4cd[_0x2779('0x34')][_0x2779('0x1d')]);}_0x3f4f9c[_0x2779('0x3c')]=qs[_0x2779('0x3d')](_0x3ce4cd[_0x2779('0x34')]['sort']);_0x3f4f9c[_0x2779('0x3e')]=qs[_0x2779('0x35')](_[_0x2779('0x3f')](_0x3ce4cd['query'],_0x56a5e2[_0x2779('0x35')]),_0x48b092);if(_0x3ce4cd[_0x2779('0x34')][_0x2779('0x40')]){_0x3f4f9c['where']=_[_0x2779('0x41')](_0x3f4f9c['where'],{'$or':_[_0x2779('0x30')](_0x48b092,function(_0xd03271){if(_0xd03271[_0x2779('0x33')]!=='VIRTUAL'){var _0x4af19a={};_0x4af19a[_0xd03271[_0x2779('0x2d')]]={'$like':'%'+_0x3ce4cd[_0x2779('0x34')][_0x2779('0x40')]+'%'};return _0x4af19a;}})});}_0x3f4f9c=_[_0x2779('0x41')]({},_0x3f4f9c,_0x3ce4cd['options']);var _0xfe97b4={'where':_0x3f4f9c[_0x2779('0x3e')]};return db['Campaign'][_0x2779('0x20')](_0xfe97b4)[_0x2779('0x26')](function(_0x2a24f8){_0x26baf7[_0x2779('0x20')]=_0x2a24f8;if(_0x3ce4cd[_0x2779('0x34')]['includeAll']){_0x3f4f9c[_0x2779('0x42')]=[{'all':!![]}];}return db[_0x2779('0x31')][_0x2779('0x43')](_0x3f4f9c);})[_0x2779('0x26')](function(_0x1b711c){_0x26baf7[_0x2779('0x44')]=_0x1b711c;return _0x26baf7;})[_0x2779('0x26')](respondWithFilteredResult(_0xaf4276,_0x3f4f9c))[_0x2779('0x45')](handleError(_0xaf4276,null));};exports[_0x2779('0x46')]=function(_0x26ddee,_0x38ced1){var _0x15be23={'raw':![],'where':{'id':_0x26ddee[_0x2779('0x47')]['id']}},_0x6de4c0={};_0x6de4c0[_0x2779('0x36')]=_[_0x2779('0x48')](db[_0x2779('0x31')][_0x2779('0x32')]);_0x6de4c0[_0x2779('0x34')]=_[_0x2779('0x48')](_0x26ddee[_0x2779('0x34')]);_0x6de4c0[_0x2779('0x35')]=_[_0x2779('0x38')](_0x6de4c0[_0x2779('0x36')],_0x6de4c0[_0x2779('0x34')]);_0x15be23['attributes']=_[_0x2779('0x38')](_0x6de4c0[_0x2779('0x36')],qs['fields'](_0x26ddee[_0x2779('0x34')]['fields']));_0x15be23[_0x2779('0x37')]=_0x15be23[_0x2779('0x37')][_0x2779('0x3a')]?_0x15be23[_0x2779('0x37')]:_0x6de4c0[_0x2779('0x36')];if(_0x26ddee[_0x2779('0x34')][_0x2779('0x49')]){_0x15be23[_0x2779('0x42')]=[{'all':!![]}];}_0x15be23=_[_0x2779('0x41')]({},_0x15be23,_0x26ddee[_0x2779('0x4a')]);return db[_0x2779('0x31')][_0x2779('0x4b')](_0x15be23)[_0x2779('0x26')](handleEntityNotFound(_0x38ced1,null))[_0x2779('0x26')](respondWithResult(_0x38ced1,null))[_0x2779('0x45')](handleError(_0x38ced1,null));};exports[_0x2779('0x4c')]=function(_0x381c9c,_0x4bb1ba){return db[_0x2779('0x31')]['create'](_0x381c9c[_0x2779('0x4d')],{})[_0x2779('0x26')](function(_0xdd93ad){var _0x3bb6d2=_0x381c9c[_0x2779('0x4e')]['get']({'plain':!![]});if(!_0x3bb6d2)throw new Error(_0x2779('0x4f'));if(_0x3bb6d2[_0x2779('0x50')]===_0x2779('0x4e')){var _0x11a94f=_0xdd93ad[_0x2779('0x28')]({'plain':!![]});var _0x3c67bf=_0x2779('0x29');return db['UserProfileSection'][_0x2779('0x4b')]({'where':{'name':_0x3c67bf,'userProfileId':_0x3bb6d2['userProfileId']},'raw':!![]})['then'](function(_0x468c25){if(_0x468c25&&_0x468c25['autoAssociation']===0x0){return db[_0x2779('0x2a')][_0x2779('0x4c')]({'name':_0x11a94f[_0x2779('0x2d')],'resourceId':_0x11a94f['id'],'type':_0x468c25['name'],'sectionId':_0x468c25['id']},{})[_0x2779('0x26')](function(){return _0xdd93ad;});}else{return _0xdd93ad;}})[_0x2779('0x45')](function(_0x16dee7){logger['error'](_0x2779('0x51'),_0x16dee7);throw _0x16dee7;});}return _0xdd93ad;})['then'](respondWithResult(_0x4bb1ba,0xc9))[_0x2779('0x45')](handleError(_0x4bb1ba,null));};exports[_0x2779('0x52')]=function(_0x190f4a,_0x10a90a){var _0x282d06={'where':{'id':_0x190f4a[_0x2779('0x47')]['id']}},_0x1f6940={};_0x1f6940[_0x2779('0x36')]=_[_0x2779('0x48')](db[_0x2779('0x31')][_0x2779('0x32')]);_0x282d06['attributes']=_[_0x2779('0x38')](_0x1f6940[_0x2779('0x36')],qs[_0x2779('0x39')](_0x190f4a[_0x2779('0x34')][_0x2779('0x39')]));_0x282d06[_0x2779('0x37')]=_0x282d06[_0x2779('0x37')][_0x2779('0x3a')]?_0x282d06[_0x2779('0x37')]:_0x1f6940[_0x2779('0x36')];if(_0x190f4a[_0x2779('0x34')]['includeAll']){_0x282d06[_0x2779('0x42')]=[{'all':!![]}];}_0x282d06=_[_0x2779('0x41')]({},_0x282d06,_0x190f4a[_0x2779('0x4a')]);return db[_0x2779('0x31')][_0x2779('0x4b')](_0x282d06)[_0x2779('0x26')](handleEntityNotFound(_0x10a90a,null))['then'](function(_0x33924c){if(_0x33924c){var _0x1103ed=_0x33924c[_0x2779('0x28')]({'plain':!![]});_0x1103ed=qs[_0x2779('0x53')](_0x1103ed,['id',_0x2779('0x54'),_0x2779('0x55')]);_0x190f4a[_0x2779('0x4d')]=_[_0x2779('0x53')](_0x190f4a[_0x2779('0x4d')],['id',_0x2779('0x54'),_0x2779('0x55')]);return db['Campaign'][_0x2779('0x4c')](_[_0x2779('0x41')](_0x1103ed,_0x190f4a['body']),{'include':_0x190f4a[_0x2779('0x34')][_0x2779('0x49')]?[{'all':!![]}]:undefined})[_0x2779('0x26')](function(_0x463ba1){var _0x465c4a=_0x190f4a['user']['get']({'plain':!![]});if(!_0x465c4a)throw new Error(_0x2779('0x4f'));if(_0x465c4a[_0x2779('0x50')]===_0x2779('0x4e')){var _0x23f7f1=_0x463ba1['get']({'plain':!![]});var _0x306a8b=_0x2779('0x29');return db[_0x2779('0x56')]['find']({'where':{'name':_0x306a8b,'userProfileId':_0x465c4a[_0x2779('0x57')]},'raw':!![]})['then'](function(_0x28804d){if(_0x28804d&&_0x28804d[_0x2779('0x58')]===0x0){return db['UserProfileResource'][_0x2779('0x4c')]({'name':_0x23f7f1[_0x2779('0x2d')],'resourceId':_0x23f7f1['id'],'type':_0x28804d[_0x2779('0x2d')],'sectionId':_0x28804d['id']},{})[_0x2779('0x26')](function(){return _0x463ba1;});}else{return _0x463ba1;}})['catch'](function(_0x5b19b7){logger[_0x2779('0x59')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b19b7);throw _0x5b19b7;});}return _0x463ba1;});}})[_0x2779('0x26')](respondWithResult(_0x10a90a,0xc9))[_0x2779('0x45')](handleError(_0x10a90a,null));};exports['update']=function(_0x2559b8,_0xa02fd0){if(_0x2559b8[_0x2779('0x4d')]['id']){delete _0x2559b8[_0x2779('0x4d')]['id'];}return db[_0x2779('0x31')][_0x2779('0x4b')]({'where':{'id':_0x2559b8[_0x2779('0x47')]['id']}})['then'](handleEntityNotFound(_0xa02fd0,null))[_0x2779('0x26')](saveUpdates(_0x2559b8[_0x2779('0x4d')],null))[_0x2779('0x26')](respondWithResult(_0xa02fd0,null))[_0x2779('0x45')](handleError(_0xa02fd0,null));};exports[_0x2779('0x27')]=function(_0x125de4,_0x382c0f){return db['Campaign']['find']({'where':{'id':_0x125de4[_0x2779('0x47')]['id']}})[_0x2779('0x26')](handleEntityNotFound(_0x382c0f,null))['then'](removeEntity(_0x382c0f,null))['catch'](handleError(_0x382c0f,null));};exports[_0x2779('0x5a')]=function(_0xb8a57b,_0x1479a2,_0x56ba09){var _0x4b3b98={'raw':!![],'where':{}};var _0x2b4252={};var _0x5c5a22={'count':0x0,'rows':[]};return db[_0x2779('0x31')][_0x2779('0x5b')]({'where':{'id':_0xb8a57b['params']['id']}})[_0x2779('0x26')](handleEntityNotFound(_0x1479a2,null))[_0x2779('0x26')](function(_0x1e14ed){if(_0x1e14ed){_0x2b4252[_0x2779('0x36')]=_['keys'](db[_0x2779('0x5c')][_0x2779('0x32')]);_0x2b4252[_0x2779('0x34')]=_['keys'](_0xb8a57b[_0x2779('0x34')]);_0x2b4252[_0x2779('0x35')]=_[_0x2779('0x38')](_0x2b4252[_0x2779('0x36')],_0x2b4252[_0x2779('0x34')]);_0x4b3b98['attributes']=_[_0x2779('0x38')](_0x2b4252['model'],qs[_0x2779('0x39')](_0xb8a57b[_0x2779('0x34')][_0x2779('0x39')]));_0x4b3b98['attributes']=_0x4b3b98[_0x2779('0x37')][_0x2779('0x3a')]?_0x4b3b98[_0x2779('0x37')]:_0x2b4252[_0x2779('0x36')];if(!_0xb8a57b[_0x2779('0x34')][_0x2779('0x3b')]('nolimit')){_0x4b3b98[_0x2779('0x1f')]=qs[_0x2779('0x1f')](_0xb8a57b[_0x2779('0x34')][_0x2779('0x1f')]);_0x4b3b98[_0x2779('0x1d')]=qs[_0x2779('0x1d')](_0xb8a57b[_0x2779('0x34')][_0x2779('0x1d')]);}_0x4b3b98['order']=qs['sort'](_0xb8a57b[_0x2779('0x34')][_0x2779('0x3d')]);_0x4b3b98['where']=qs[_0x2779('0x35')](_[_0x2779('0x3f')](_0xb8a57b[_0x2779('0x34')],_0x2b4252[_0x2779('0x35')]));_0x4b3b98[_0x2779('0x3e')][_0x2779('0x5d')]=_0x1e14ed['id'];if(_0xb8a57b[_0x2779('0x34')]['filter']){_0x4b3b98[_0x2779('0x3e')]=_[_0x2779('0x41')](_0x4b3b98[_0x2779('0x3e')],{'$or':_[_0x2779('0x30')](_0x4b3b98[_0x2779('0x37')],function(_0x27873d){var _0x13fc70={};_0x13fc70[_0x27873d]={'$like':'%'+_0xb8a57b[_0x2779('0x34')][_0x2779('0x40')]+'%'};return _0x13fc70;})});}_0x4b3b98=_[_0x2779('0x41')]({},_0x4b3b98,_0xb8a57b[_0x2779('0x4a')]);return db[_0x2779('0x5c')]['count']({'where':_0x4b3b98[_0x2779('0x3e')]})[_0x2779('0x26')](function(_0x3b5a32){_0x5c5a22[_0x2779('0x20')]=_0x3b5a32;if(_0xb8a57b[_0x2779('0x34')][_0x2779('0x49')]){_0x4b3b98[_0x2779('0x42')]=[{'all':!![]}];}return db[_0x2779('0x5c')][_0x2779('0x43')](_0x4b3b98);})[_0x2779('0x26')](function(_0x4b3719){_0x5c5a22[_0x2779('0x44')]=_0x4b3719;return _0x5c5a22;});}})[_0x2779('0x26')](respondWithFilteredResult(_0x1479a2,_0x4b3b98))[_0x2779('0x45')](handleError(_0x1479a2,null));};exports[_0x2779('0x5e')]=function(_0x579bbd,_0x4f1779,_0x38754f){var _0x178984={'raw':!![],'where':{}};var _0x21d08c={};var _0x3c5f54={'count':0x0,'rows':[]};return db[_0x2779('0x31')]['findOne']({'where':{'id':_0x579bbd[_0x2779('0x47')]['id']}})[_0x2779('0x26')](handleEntityNotFound(_0x4f1779,null))[_0x2779('0x26')](function(_0x4b04e1){if(_0x4b04e1){_0x21d08c['model']=_[_0x2779('0x48')](db[_0x2779('0x5f')]['rawAttributes']);_0x21d08c[_0x2779('0x34')]=_[_0x2779('0x48')](_0x579bbd[_0x2779('0x34')]);_0x21d08c[_0x2779('0x35')]=_[_0x2779('0x38')](_0x21d08c[_0x2779('0x36')],_0x21d08c[_0x2779('0x34')]);_0x178984['attributes']=_[_0x2779('0x38')](_0x21d08c[_0x2779('0x36')],qs[_0x2779('0x39')](_0x579bbd['query'][_0x2779('0x39')]));_0x178984[_0x2779('0x37')]=_0x178984[_0x2779('0x37')][_0x2779('0x3a')]?_0x178984['attributes']:_0x21d08c['model'];if(!_0x579bbd[_0x2779('0x34')]['hasOwnProperty'](_0x2779('0x60'))){_0x178984[_0x2779('0x1f')]=qs['limit'](_0x579bbd[_0x2779('0x34')][_0x2779('0x1f')]);_0x178984[_0x2779('0x1d')]=qs[_0x2779('0x1d')](_0x579bbd['query'][_0x2779('0x1d')]);}_0x178984[_0x2779('0x3c')]=qs[_0x2779('0x3d')](_0x579bbd[_0x2779('0x34')][_0x2779('0x3d')]);_0x178984[_0x2779('0x3e')]=qs['filters'](_[_0x2779('0x3f')](_0x579bbd[_0x2779('0x34')],_0x21d08c[_0x2779('0x35')]));_0x178984[_0x2779('0x3e')][_0x2779('0x5d')]=_0x4b04e1['id'];if(_0x579bbd['query'][_0x2779('0x40')]){_0x178984[_0x2779('0x3e')]=_[_0x2779('0x41')](_0x178984[_0x2779('0x3e')],{'$or':_['map'](_0x178984['attributes'],function(_0x13655f){var _0xa49cdb={};_0xa49cdb[_0x13655f]={'$like':'%'+_0x579bbd[_0x2779('0x34')][_0x2779('0x40')]+'%'};return _0xa49cdb;})});}_0x178984=_[_0x2779('0x41')]({},_0x178984,_0x579bbd[_0x2779('0x4a')]);return db[_0x2779('0x5f')][_0x2779('0x20')]({'where':_0x178984[_0x2779('0x3e')]})[_0x2779('0x26')](function(_0x42c715){_0x3c5f54[_0x2779('0x20')]=_0x42c715;if(_0x579bbd[_0x2779('0x34')]['includeAll']){_0x178984['include']=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x178984);})[_0x2779('0x26')](function(_0x2ca465){_0x3c5f54[_0x2779('0x44')]=_0x2ca465;return _0x3c5f54;});}})['then'](respondWithFilteredResult(_0x4f1779,_0x178984))['catch'](handleError(_0x4f1779,null));};exports[_0x2779('0x61')]=function(_0x54a231,_0x9bf0e5,_0x388e64){var _0x2163e2={'raw':!![],'where':{}};var _0x1e4d3c={};var _0x32b16f={'count':0x0,'rows':[]};return db[_0x2779('0x31')][_0x2779('0x5b')]({'where':{'id':_0x54a231[_0x2779('0x47')]['id']}})[_0x2779('0x26')](handleEntityNotFound(_0x9bf0e5,null))[_0x2779('0x26')](function(_0x2c4223){if(_0x2c4223){_0x1e4d3c[_0x2779('0x36')]=_[_0x2779('0x48')](db['CmHopperFinal']['rawAttributes']);_0x1e4d3c['query']=_[_0x2779('0x48')](_0x54a231['query']);_0x1e4d3c[_0x2779('0x35')]=_[_0x2779('0x38')](_0x1e4d3c[_0x2779('0x36')],_0x1e4d3c[_0x2779('0x34')]);_0x2163e2[_0x2779('0x37')]=_[_0x2779('0x38')](_0x1e4d3c['model'],qs[_0x2779('0x39')](_0x54a231[_0x2779('0x34')]['fields']));_0x2163e2[_0x2779('0x37')]=_0x2163e2[_0x2779('0x37')][_0x2779('0x3a')]?_0x2163e2[_0x2779('0x37')]:_0x1e4d3c[_0x2779('0x36')];if(!_0x54a231[_0x2779('0x34')][_0x2779('0x3b')](_0x2779('0x60'))){_0x2163e2[_0x2779('0x1f')]=qs[_0x2779('0x1f')](_0x54a231['query'][_0x2779('0x1f')]);_0x2163e2[_0x2779('0x1d')]=qs[_0x2779('0x1d')](_0x54a231[_0x2779('0x34')][_0x2779('0x1d')]);}_0x2163e2[_0x2779('0x3c')]=qs[_0x2779('0x3d')](_0x54a231['query'][_0x2779('0x3d')]);_0x2163e2[_0x2779('0x3e')]=qs['filters'](_[_0x2779('0x3f')](_0x54a231['query'],_0x1e4d3c['filters']));_0x2163e2[_0x2779('0x3e')][_0x2779('0x5d')]=_0x2c4223['id'];if(_0x54a231[_0x2779('0x34')][_0x2779('0x40')]){_0x2163e2['where']=_[_0x2779('0x41')](_0x2163e2[_0x2779('0x3e')],{'$or':_[_0x2779('0x30')](_0x2163e2['attributes'],function(_0x1c5e83){var _0x2af93a={};_0x2af93a[_0x1c5e83]={'$like':'%'+_0x54a231[_0x2779('0x34')][_0x2779('0x40')]+'%'};return _0x2af93a;})});}_0x2163e2=_[_0x2779('0x41')]({},_0x2163e2,_0x54a231[_0x2779('0x4a')]);return db['CmHopperFinal'][_0x2779('0x20')]({'where':_0x2163e2[_0x2779('0x3e')]})[_0x2779('0x26')](function(_0xec2725){_0x32b16f['count']=_0xec2725;if(_0x54a231[_0x2779('0x34')]['includeAll']){_0x2163e2[_0x2779('0x42')]=[{'all':!![]}];}return db[_0x2779('0x62')]['findAll'](_0x2163e2);})['then'](function(_0x457072){_0x32b16f[_0x2779('0x44')]=_0x457072;return _0x32b16f;});}})['then'](respondWithFilteredResult(_0x9bf0e5,_0x2163e2))[_0x2779('0x45')](handleError(_0x9bf0e5,null));};exports[_0x2779('0x63')]=function(_0x3f2bae,_0x2906e9,_0x1df165){var _0x5b37a8={'raw':!![],'where':{}};var _0x42b8fd={};var _0x596df3={'count':0x0,'rows':[]};return db[_0x2779('0x31')][_0x2779('0x5b')]({'where':{'id':_0x3f2bae[_0x2779('0x47')]['id']}})[_0x2779('0x26')](handleEntityNotFound(_0x2906e9,null))['then'](function(_0x37c7dd){if(_0x37c7dd){_0x42b8fd[_0x2779('0x36')]=_['keys'](db[_0x2779('0x64')][_0x2779('0x32')]);_0x42b8fd[_0x2779('0x34')]=_['keys'](_0x3f2bae[_0x2779('0x34')]);_0x42b8fd[_0x2779('0x35')]=_[_0x2779('0x38')](_0x42b8fd[_0x2779('0x36')],_0x42b8fd[_0x2779('0x34')]);_0x5b37a8['attributes']=_[_0x2779('0x38')](_0x42b8fd['model'],qs['fields'](_0x3f2bae[_0x2779('0x34')][_0x2779('0x39')]));_0x5b37a8[_0x2779('0x37')]=_0x5b37a8[_0x2779('0x37')][_0x2779('0x3a')]?_0x5b37a8[_0x2779('0x37')]:_0x42b8fd['model'];if(!_0x3f2bae[_0x2779('0x34')][_0x2779('0x3b')]('nolimit')){_0x5b37a8[_0x2779('0x1f')]=qs[_0x2779('0x1f')](_0x3f2bae[_0x2779('0x34')][_0x2779('0x1f')]);_0x5b37a8[_0x2779('0x1d')]=qs[_0x2779('0x1d')](_0x3f2bae[_0x2779('0x34')][_0x2779('0x1d')]);}_0x5b37a8[_0x2779('0x3c')]=qs[_0x2779('0x3d')](_0x3f2bae[_0x2779('0x34')][_0x2779('0x3d')]);_0x5b37a8[_0x2779('0x3e')]=qs['filters'](_[_0x2779('0x3f')](_0x3f2bae[_0x2779('0x34')],_0x42b8fd[_0x2779('0x35')]));_0x5b37a8[_0x2779('0x3e')][_0x2779('0x5d')]=_0x37c7dd['id'];if(_0x3f2bae[_0x2779('0x34')][_0x2779('0x40')]){_0x5b37a8[_0x2779('0x3e')]=_[_0x2779('0x41')](_0x5b37a8['where'],{'$or':_[_0x2779('0x30')](_0x5b37a8[_0x2779('0x37')],function(_0x3aeef2){var _0x5b2981={};_0x5b2981[_0x3aeef2]={'$like':'%'+_0x3f2bae[_0x2779('0x34')]['filter']+'%'};return _0x5b2981;})});}_0x5b37a8=_[_0x2779('0x41')]({},_0x5b37a8,_0x3f2bae[_0x2779('0x4a')]);return db[_0x2779('0x64')][_0x2779('0x20')]({'where':_0x5b37a8['where']})[_0x2779('0x26')](function(_0x469b33){_0x596df3['count']=_0x469b33;if(_0x3f2bae[_0x2779('0x34')][_0x2779('0x49')]){_0x5b37a8[_0x2779('0x42')]=[{'all':!![]}];}return db[_0x2779('0x64')][_0x2779('0x43')](_0x5b37a8);})[_0x2779('0x26')](function(_0x2e5ebc){_0x596df3['rows']=_0x2e5ebc;return _0x596df3;});}})[_0x2779('0x26')](respondWithFilteredResult(_0x2906e9,_0x5b37a8))['catch'](handleError(_0x2906e9,null));};exports['getLists']=function(_0x11c7ba,_0x583f0e,_0x27a26e){var _0x5a5e41={};var _0x10bafc={};var _0xd42767;var _0x5e21f2;return db['Campaign'][_0x2779('0x5b')]({'where':{'id':_0x11c7ba[_0x2779('0x47')]['id']}})[_0x2779('0x26')](handleEntityNotFound(_0x583f0e,null))[_0x2779('0x26')](function(_0x259b2f){if(_0x259b2f){_0xd42767=_0x259b2f;_0x10bafc[_0x2779('0x36')]=_[_0x2779('0x48')](db[_0x2779('0x65')][_0x2779('0x32')]);_0x10bafc['query']=_[_0x2779('0x48')](_0x11c7ba['query']);_0x10bafc[_0x2779('0x35')]=_[_0x2779('0x38')](_0x10bafc[_0x2779('0x36')],_0x10bafc[_0x2779('0x34')]);_0x5a5e41['attributes']=_[_0x2779('0x38')](_0x10bafc[_0x2779('0x36')],qs[_0x2779('0x39')](_0x11c7ba['query']['fields']));_0x5a5e41[_0x2779('0x37')]=_0x5a5e41['attributes']['length']?_0x5a5e41[_0x2779('0x37')]:_0x10bafc[_0x2779('0x36')];_0x5a5e41['order']=qs['sort'](_0x11c7ba[_0x2779('0x34')][_0x2779('0x3d')]);_0x5a5e41['where']=qs['filters'](_[_0x2779('0x3f')](_0x11c7ba[_0x2779('0x34')],_0x10bafc[_0x2779('0x35')]));if(_0x11c7ba[_0x2779('0x34')][_0x2779('0x40')]){_0x5a5e41[_0x2779('0x3e')]=_['merge'](_0x5a5e41[_0x2779('0x3e')],{'$or':_[_0x2779('0x30')](_0x5a5e41[_0x2779('0x37')],function(_0x568212){var _0x704b83={};_0x704b83[_0x568212]={'$like':'%'+_0x11c7ba[_0x2779('0x34')][_0x2779('0x40')]+'%'};return _0x704b83;})});}_0x5a5e41=_[_0x2779('0x41')]({},_0x5a5e41,_0x11c7ba[_0x2779('0x4a')]);return _0xd42767[_0x2779('0x66')](_0x5a5e41);}})[_0x2779('0x26')](function(_0x23cfeb){if(_0x23cfeb){_0x5e21f2=_0x23cfeb[_0x2779('0x3a')];if(!_0x11c7ba[_0x2779('0x34')][_0x2779('0x3b')](_0x2779('0x60'))){_0x5a5e41[_0x2779('0x1f')]=qs[_0x2779('0x1f')](_0x11c7ba['query'][_0x2779('0x1f')]);_0x5a5e41[_0x2779('0x1d')]=qs['offset'](_0x11c7ba[_0x2779('0x34')][_0x2779('0x1d')]);}return _0xd42767[_0x2779('0x66')](_0x5a5e41);}})['then'](function(_0x17e53f){if(_0x17e53f){return _0x17e53f?{'count':_0x5e21f2,'rows':_0x17e53f}:null;}})[_0x2779('0x26')](respondWithResult(_0x583f0e,null))[_0x2779('0x45')](handleError(_0x583f0e,null));};exports[_0x2779('0x67')]=function(_0x24451c,_0x23e3e2,_0x1dfccd){var _0x1d1167,_0x47b241;return db[_0x2779('0x31')][_0x2779('0x4b')]({'where':{'id':_0x24451c[_0x2779('0x47')]['id']}})[_0x2779('0x26')](handleEntityNotFound(_0x23e3e2,null))[_0x2779('0x26')](function(_0x409d51){if(_0x409d51){_0x47b241=_0x409d51;return _0x409d51[_0x2779('0x67')](_0x24451c['body'][_0x2779('0x68')],_[_0x2779('0x53')](_0x24451c[_0x2779('0x4d')],[_0x2779('0x68'),'id'])||{});}return null;})[_0x2779('0x69')](function(_0x315141){var _0x4fbf08;_0x1d1167=_0x315141||[];var _0x1b643c=[];if(_0x315141){for(var _0x2cc7b2=0x0;_0x2cc7b2<_0x315141['length'];_0x2cc7b2+=0x1){var _0x464df7=_0x315141[_0x2cc7b2]['get']({'plain':!![]});_0x47b241['dialCheckDuplicateType']=_0x24451c[_0x2779('0x4d')][_0x2779('0x6a')]?_0x24451c['body'][_0x2779('0x6a')]:_0x47b241[_0x2779('0x6a')];switch(_0x47b241['dialCheckDuplicateType']){case'always':_0x4fbf08=squel['insert']()[_0x2779('0x6b')](_0x2779('0x6c'))['fromQuery']([_0x2779('0x6d'),_0x2779('0x6e'),_0x2779('0x6f'),'ListId',_0x2779('0x5d'),'createdAt',_0x2779('0x55')],squel['select']()['field'](_0x2779('0x6d'),_0x2779('0x6d'))['field'](_0x2779('0x70'),'scheduledAt')['field']('id',_0x2779('0x6f'))[_0x2779('0x71')](_0x464df7['CmListId']['toString'](),'ListId')['field'](_0x24451c['params']['id'][_0x2779('0x72')](),_0x2779('0x5d'))[_0x2779('0x71')](_0x2779('0x70'),'createdAt')[_0x2779('0x71')]('NOW()',_0x2779('0x55'))[_0x2779('0x73')](_0x2779('0x74'))[_0x2779('0x3e')](_0x2779('0x75'))[_0x2779('0x3e')]('ListId\x20=\x20?',_0x464df7[_0x2779('0x76')]['toString']())[_0x2779('0x3e')]('phone\x20IS\x20NOT\x20NULL')[_0x2779('0x3e')](_0x2779('0x77'),squel['select']()[_0x2779('0x71')](_0x2779('0x78'))[_0x2779('0x73')]('cm_hopper_final')[_0x2779('0x3e')](_0x2779('0x79'),_0x24451c[_0x2779('0x47')]['id'][_0x2779('0x72')]()))['where'](_0x2779('0x77'),squel[_0x2779('0x7a')]()['field'](_0x2779('0x7b'))[_0x2779('0x73')](_0x2779('0x6c'))[_0x2779('0x3e')](_0x2779('0x79'),_0x24451c[_0x2779('0x47')]['id'][_0x2779('0x72')]())))[_0x2779('0x72')]();break;case'onlyIfOpen':_0x4fbf08=squel[_0x2779('0x7c')]()[_0x2779('0x6b')](_0x2779('0x6c'))[_0x2779('0x7d')]([_0x2779('0x6d'),_0x2779('0x6e'),_0x2779('0x6f'),_0x2779('0x7e'),_0x2779('0x5d'),_0x2779('0x54'),_0x2779('0x55')],squel['select']()[_0x2779('0x71')](_0x2779('0x6d'),_0x2779('0x6d'))[_0x2779('0x71')](_0x2779('0x70'),'scheduledAt')[_0x2779('0x71')]('id',_0x2779('0x6f'))[_0x2779('0x71')](_0x464df7[_0x2779('0x76')]['toString'](),'ListId')[_0x2779('0x71')](_0x24451c[_0x2779('0x47')]['id'][_0x2779('0x72')](),_0x2779('0x5d'))[_0x2779('0x71')](_0x2779('0x70'),'createdAt')['field']('NOW()',_0x2779('0x55'))['from'](_0x2779('0x74'))[_0x2779('0x3e')]('deletedAt\x20IS\x20NULL')[_0x2779('0x3e')]('ListId\x20=\x20?',_0x464df7['CmListId'][_0x2779('0x72')]())[_0x2779('0x3e')](_0x2779('0x7f'))[_0x2779('0x3e')](_0x2779('0x77'),squel['select']()['field'](_0x2779('0x7b'))[_0x2779('0x73')](_0x2779('0x6c'))[_0x2779('0x3e')](_0x2779('0x79'),_0x24451c[_0x2779('0x47')]['id'][_0x2779('0x72')]())))[_0x2779('0x72')]();break;default:_0x4fbf08=squel[_0x2779('0x7c')]()['into'](_0x2779('0x6c'))['fromQuery']([_0x2779('0x6d'),'scheduledAt',_0x2779('0x6f'),_0x2779('0x7e'),_0x2779('0x5d'),_0x2779('0x54'),_0x2779('0x55')],squel[_0x2779('0x7a')]()[_0x2779('0x71')]('phone',_0x2779('0x6d'))[_0x2779('0x71')](_0x2779('0x70'),_0x2779('0x6e'))['field']('id',_0x2779('0x6f'))[_0x2779('0x71')](_0x464df7['CmListId'][_0x2779('0x72')](),_0x2779('0x7e'))[_0x2779('0x71')](_0x24451c[_0x2779('0x47')]['id'][_0x2779('0x72')](),_0x2779('0x5d'))[_0x2779('0x71')]('NOW()',_0x2779('0x54'))[_0x2779('0x71')]('NOW()',_0x2779('0x55'))[_0x2779('0x73')](_0x2779('0x74'))['where']('deletedAt\x20IS\x20NULL')['where'](_0x2779('0x80'),_0x464df7['CmListId'][_0x2779('0x72')]())[_0x2779('0x3e')](_0x2779('0x7f')))[_0x2779('0x72')]();}_0x1b643c[_0x2779('0x81')](db[_0x2779('0x82')]['query'](_0x4fbf08));}return BPromise[_0x2779('0x83')](_0x1b643c);}})['then'](function(){return _0x1d1167;})['then'](respondWithResult(_0x23e3e2,null))['catch'](handleError(_0x23e3e2,null));};exports[_0x2779('0x84')]=function(_0x55f2eb,_0x5c4738,_0x29c619){return db[_0x2779('0x31')][_0x2779('0x4b')]({'where':{'id':_0x55f2eb[_0x2779('0x47')]['id']}})[_0x2779('0x26')](handleEntityNotFound(_0x5c4738,null))[_0x2779('0x26')](function(_0x176423){if(_0x176423){return _0x176423[_0x2779('0x84')](_0x55f2eb[_0x2779('0x34')][_0x2779('0x68')]);}})['then'](function(_0x48e793){if(_0x48e793){return db[_0x2779('0x5c')][_0x2779('0x27')]({'where':{'ListId':_0x55f2eb['query'][_0x2779('0x68')],'CampaignId':_0x55f2eb[_0x2779('0x47')]['id']}})[_0x2779('0x26')](function(){return _0x48e793;});}})[_0x2779('0x26')](respondWithStatusCode(_0x5c4738,null))['catch'](handleError(_0x5c4738,null));};exports[_0x2779('0x85')]=function(_0x37ccd1,_0xd7f97e,_0x404c4d){var _0x76886d={};var _0xc8f55f={};var _0x3283e0;var _0x5b3437;return db[_0x2779('0x31')][_0x2779('0x5b')]({'where':{'id':_0x37ccd1['params']['id']}})[_0x2779('0x26')](handleEntityNotFound(_0xd7f97e,null))[_0x2779('0x26')](function(_0x127b37){if(_0x127b37){_0x3283e0=_0x127b37;_0xc8f55f['model']=_[_0x2779('0x48')](db[_0x2779('0x65')][_0x2779('0x32')]);_0xc8f55f['query']=_[_0x2779('0x48')](_0x37ccd1[_0x2779('0x34')]);_0xc8f55f[_0x2779('0x35')]=_['intersection'](_0xc8f55f['model'],_0xc8f55f[_0x2779('0x34')]);_0x76886d[_0x2779('0x37')]=_[_0x2779('0x38')](_0xc8f55f[_0x2779('0x36')],qs[_0x2779('0x39')](_0x37ccd1['query'][_0x2779('0x39')]));_0x76886d['attributes']=_0x76886d[_0x2779('0x37')]['length']?_0x76886d[_0x2779('0x37')]:_0xc8f55f[_0x2779('0x36')];_0x76886d[_0x2779('0x3c')]=qs[_0x2779('0x3d')](_0x37ccd1[_0x2779('0x34')]['sort']);_0x76886d[_0x2779('0x3e')]=qs['filters'](_['pick'](_0x37ccd1[_0x2779('0x34')],_0xc8f55f[_0x2779('0x35')]));if(_0x37ccd1[_0x2779('0x34')][_0x2779('0x40')]){_0x76886d[_0x2779('0x3e')]=_[_0x2779('0x41')](_0x76886d[_0x2779('0x3e')],{'$or':_[_0x2779('0x30')](_0x76886d['attributes'],function(_0x15a51f){var _0x689b92={};_0x689b92[_0x15a51f]={'$like':'%'+_0x37ccd1[_0x2779('0x34')][_0x2779('0x40')]+'%'};return _0x689b92;})});}_0x76886d=_['merge']({},_0x76886d,_0x37ccd1['options']);return _0x3283e0[_0x2779('0x85')](_0x76886d);}})[_0x2779('0x26')](function(_0x2d0a87){if(_0x2d0a87){_0x5b3437=_0x2d0a87[_0x2779('0x3a')];if(!_0x37ccd1[_0x2779('0x34')]['hasOwnProperty'](_0x2779('0x60'))){_0x76886d['limit']=qs[_0x2779('0x1f')](_0x37ccd1[_0x2779('0x34')][_0x2779('0x1f')]);_0x76886d['offset']=qs['offset'](_0x37ccd1['query']['offset']);}return _0x3283e0[_0x2779('0x85')](_0x76886d);}})['then'](function(_0x5a3ec8){if(_0x5a3ec8){return _0x5a3ec8?{'count':_0x5b3437,'rows':_0x5a3ec8}:null;}})['then'](respondWithResult(_0xd7f97e,null))['catch'](handleError(_0xd7f97e,null));};exports['addBlackLists']=function(_0xbf82b1,_0xc6e727,_0x4a8957){var _0x3b9d5e,_0x4ee401;return db[_0x2779('0x31')]['find']({'where':{'id':_0xbf82b1['params']['id']}})[_0x2779('0x26')](handleEntityNotFound(_0xc6e727,null))['then'](function(_0x58841c){if(_0x58841c){_0x4ee401=_0x58841c;return _0x58841c[_0x2779('0x86')](_0xbf82b1[_0x2779('0x4d')]['ids'],_[_0x2779('0x53')](_0xbf82b1[_0x2779('0x4d')],[_0x2779('0x68'),'id'])||{});}return null;})[_0x2779('0x69')](function(_0x5c8203){var _0x5be33e;_0x3b9d5e=_0x5c8203||[];var _0x37c8c7=[];if(_0x5c8203){for(var _0x51c6f5=0x0;_0x51c6f5<_0x5c8203[_0x2779('0x3a')];_0x51c6f5+=0x1){var _0x252b5a=_0x5c8203[_0x51c6f5]['get']({'plain':!![]});_0x5be33e=squel[_0x2779('0x7c')]()[_0x2779('0x6b')]('cm_hopper_black')['fromQuery']([_0x2779('0x6d'),_0x2779('0x6f'),'ListId',_0x2779('0x5d'),_0x2779('0x54'),'updatedAt'],squel[_0x2779('0x7a')]()['field'](_0x2779('0x6d'),'phone')['field']('id',_0x2779('0x6f'))[_0x2779('0x71')](_0x252b5a[_0x2779('0x76')][_0x2779('0x72')](),_0x2779('0x7e'))['field'](_0xbf82b1[_0x2779('0x47')]['id'][_0x2779('0x72')](),_0x2779('0x5d'))[_0x2779('0x71')](_0x2779('0x70'),_0x2779('0x54'))[_0x2779('0x71')](_0x2779('0x70'),_0x2779('0x55'))[_0x2779('0x73')]('cm_contacts')['where'](_0x2779('0x75'))[_0x2779('0x3e')](_0x2779('0x80'),_0x252b5a['CmListId'][_0x2779('0x72')]())['where'](_0x2779('0x7f')))['toString']();_0x37c8c7[_0x2779('0x81')](db[_0x2779('0x82')][_0x2779('0x34')](_0x5be33e));}return BPromise[_0x2779('0x83')](_0x37c8c7);}})[_0x2779('0x26')](function(){return _0x3b9d5e;})[_0x2779('0x26')](respondWithResult(_0xc6e727,null))[_0x2779('0x45')](handleError(_0xc6e727,null));};exports[_0x2779('0x87')]=function(_0x398ce7,_0x4a960d,_0x20753b){return db[_0x2779('0x31')][_0x2779('0x4b')]({'where':{'id':_0x398ce7['params']['id']}})[_0x2779('0x26')](handleEntityNotFound(_0x4a960d,null))[_0x2779('0x26')](function(_0x5eafab){if(_0x5eafab){return _0x5eafab[_0x2779('0x87')](_0x398ce7[_0x2779('0x34')][_0x2779('0x68')]);}})[_0x2779('0x26')](function(_0x34f9fc){if(_0x34f9fc){return db[_0x2779('0x64')][_0x2779('0x27')]({'where':{'ListId':_0x398ce7['query'][_0x2779('0x68')],'CampaignId':_0x398ce7['params']['id']}})[_0x2779('0x26')](function(){return _0x34f9fc;});}})[_0x2779('0x26')](respondWithStatusCode(_0x4a960d,null))['catch'](handleError(_0x4a960d,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 7e09217..c120076 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x507ef4,_0x4441f9){var _0x2c6986=function(_0xd1fc6c){while(--_0xd1fc6c){_0x507ef4['push'](_0x507ef4['shift']());}};_0x2c6986(++_0x4441f9);}(_0x7a54,0x106));var _0x47a5=function(_0x292532,_0x244b41){_0x292532=_0x292532-0x0;var _0x1571ec=_0x7a54[_0x292532];return _0x1571ec;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x221927,_0x1cd547){var _0x5c7399=function(_0x19b6ca){while(--_0x19b6ca){_0x221927['push'](_0x221927['shift']());}};_0x5c7399(++_0x1cd547);}(_0x7a54,0x106));var _0x47a5=function(_0x531d6f,_0x4fb825){_0x531d6f=_0x531d6f-0x0;var _0x2bdce7=_0x7a54[_0x531d6f];return _0x2bdce7;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 8198690..3dab695 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 _0x3f49=['randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','options','where','attributes','limit','include','map','model','GetCampaign','debug','lodash','util','bluebird'];(function(_0x275df6,_0x273871){var _0x1573c6=function(_0x104bcf){while(--_0x104bcf){_0x275df6['push'](_0x275df6['shift']());}};_0x1573c6(++_0x273871);}(_0x3f49,0x11f));var _0x93f4=function(_0x1bc36c,_0x10239a){_0x1bc36c=_0x1bc36c-0x0;var _0x8ce4e0=_0x3f49[_0x1bc36c];return _0x8ce4e0;};'use strict';var _=require(_0x93f4('0x0'));var util=require(_0x93f4('0x1'));var moment=require('moment');var BPromise=require(_0x93f4('0x2'));var rs=require(_0x93f4('0x3'));var fs=require('fs');var Redis=require(_0x93f4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x93f4('0x5'));var logger=require(_0x93f4('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x93f4('0x7'));var client=jayson[_0x93f4('0x8')][_0x93f4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5a86ad,_0x956b50,_0x5d22d9){return new BPromise(function(_0x144f31,_0x5e5b4d){return client[_0x93f4('0xa')](_0x5a86ad,_0x5d22d9)[_0x93f4('0xb')](function(_0x325984){logger[_0x93f4('0xc')](_0x93f4('0xd'),_0x956b50,_0x93f4('0xe'));logger['debug']('Campaign,\x20%s,\x20%s,\x20%s',_0x956b50,_0x93f4('0xe'),JSON[_0x93f4('0xf')](_0x325984));if(_0x325984[_0x93f4('0x10')]){if(_0x325984[_0x93f4('0x10')][_0x93f4('0x11')]===0x1f4){logger[_0x93f4('0x10')](_0x93f4('0xd'),_0x956b50,_0x325984[_0x93f4('0x10')]['message']);return _0x5e5b4d(_0x325984[_0x93f4('0x10')]['message']);}logger['error'](_0x93f4('0xd'),_0x956b50,_0x325984[_0x93f4('0x10')][_0x93f4('0x12')]);return _0x144f31(_0x325984['error']['message']);}else{logger[_0x93f4('0xc')](_0x93f4('0xd'),_0x956b50,_0x93f4('0xe'));_0x144f31(_0x325984['result'][_0x93f4('0x12')]);}})[_0x93f4('0x13')](function(_0x53151e){logger[_0x93f4('0x10')]('Campaign,\x20%s,\x20%s',_0x956b50,_0x53151e);_0x5e5b4d(_0x53151e);});});}exports['GetCampaign']=function(_0x1d4773){var _0x5b6488=this;return new Promise(function(_0x38d8b6,_0x556fc6){return db['Campaign']['findAll']({'raw':_0x1d4773[_0x93f4('0x14')]?_0x1d4773[_0x93f4('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x1d4773[_0x93f4('0x14')]?_0x1d4773['options'][_0x93f4('0x15')]||null:null,'attributes':_0x1d4773[_0x93f4('0x14')]?_0x1d4773[_0x93f4('0x14')][_0x93f4('0x16')]||null:null,'limit':_0x1d4773['options']?_0x1d4773['options'][_0x93f4('0x17')]||null:null,'include':_0x1d4773[_0x93f4('0x14')]?_0x1d4773['options']['include']?_['map'](_0x1d4773[_0x93f4('0x14')][_0x93f4('0x18')],function(_0x475f0b){return{'model':db[_0x475f0b['model']],'as':_0x475f0b['as'],'attributes':_0x475f0b[_0x93f4('0x16')],'include':_0x475f0b['include']?_[_0x93f4('0x19')](_0x475f0b[_0x93f4('0x18')],function(_0x5afabf){return{'model':db[_0x5afabf[_0x93f4('0x1a')]],'as':_0x5afabf['as'],'attributes':_0x5afabf[_0x93f4('0x16')],'include':_0x5afabf[_0x93f4('0x18')]?_[_0x93f4('0x19')](_0x5afabf['include'],function(_0x454b5b){return{'model':db[_0x454b5b[_0x93f4('0x1a')]],'as':_0x454b5b['as'],'attributes':_0x454b5b[_0x93f4('0x16')]};}):[]};}):[]};}):[]:[]})[_0x93f4('0xb')](function(_0x590d52){logger[_0x93f4('0xc')](_0x93f4('0x1b'),_0x1d4773);logger[_0x93f4('0x1c')](_0x93f4('0x1b'),_0x1d4773,JSON[_0x93f4('0xf')](_0x590d52));_0x38d8b6(_0x590d52);})[_0x93f4('0x13')](function(_0x47776e){logger[_0x93f4('0x10')]('GetCampaign',_0x47776e[_0x93f4('0x12')],_0x1d4773);_0x556fc6(_0x5b6488[_0x93f4('0x10')](0x1f4,_0x47776e['message']));});});}; \ No newline at end of file +var _0xc6d8=['request','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','findAll','options','raw','model','attributes','map','include','then','GetCampaign','lodash','moment','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x35ec9a,_0x174edd){var _0x491fa3=function(_0x45eea8){while(--_0x45eea8){_0x35ec9a['push'](_0x35ec9a['shift']());}};_0x491fa3(++_0x174edd);}(_0xc6d8,0xd7));var _0x8c6d=function(_0x426cad,_0x45810d){_0x426cad=_0x426cad-0x0;var _0x50c00f=_0xc6d8[_0x426cad];return _0x50c00f;};'use strict';var _=require(_0x8c6d('0x0'));var util=require('util');var moment=require(_0x8c6d('0x1'));var BPromise=require('bluebird');var rs=require(_0x8c6d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8c6d('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8c6d('0x4'));var config=require(_0x8c6d('0x5'));var jayson=require(_0x8c6d('0x6'));var client=jayson[_0x8c6d('0x7')][_0x8c6d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2dbb52,_0x98cae4,_0x5529f1){return new BPromise(function(_0x1496ba,_0x75c49f){return client[_0x8c6d('0x9')](_0x2dbb52,_0x5529f1)['then'](function(_0x3cecc1){logger[_0x8c6d('0xa')](_0x8c6d('0xb'),_0x98cae4,_0x8c6d('0xc'));logger[_0x8c6d('0xd')](_0x8c6d('0xe'),_0x98cae4,_0x8c6d('0xc'),JSON[_0x8c6d('0xf')](_0x3cecc1));if(_0x3cecc1['error']){if(_0x3cecc1[_0x8c6d('0x10')]['code']===0x1f4){logger['error'](_0x8c6d('0xb'),_0x98cae4,_0x3cecc1[_0x8c6d('0x10')][_0x8c6d('0x11')]);return _0x75c49f(_0x3cecc1[_0x8c6d('0x10')][_0x8c6d('0x11')]);}logger[_0x8c6d('0x10')](_0x8c6d('0xb'),_0x98cae4,_0x3cecc1[_0x8c6d('0x10')][_0x8c6d('0x11')]);return _0x1496ba(_0x3cecc1[_0x8c6d('0x10')]['message']);}else{logger[_0x8c6d('0xa')]('Campaign,\x20%s,\x20%s',_0x98cae4,_0x8c6d('0xc'));_0x1496ba(_0x3cecc1['result'][_0x8c6d('0x11')]);}})[_0x8c6d('0x12')](function(_0x52ed7b){logger[_0x8c6d('0x10')](_0x8c6d('0xb'),_0x98cae4,_0x52ed7b);_0x75c49f(_0x52ed7b);});});}exports['GetCampaign']=function(_0x3e5495){var _0x5a22de=this;return new Promise(function(_0x4c2f8d,_0x21b8ee){return db['Campaign'][_0x8c6d('0x13')]({'raw':_0x3e5495[_0x8c6d('0x14')]?_0x3e5495[_0x8c6d('0x14')][_0x8c6d('0x15')]===undefined?!![]:![]:!![],'where':_0x3e5495[_0x8c6d('0x14')]?_0x3e5495['options']['where']||null:null,'attributes':_0x3e5495['options']?_0x3e5495[_0x8c6d('0x14')]['attributes']||null:null,'limit':_0x3e5495[_0x8c6d('0x14')]?_0x3e5495['options']['limit']||null:null,'include':_0x3e5495[_0x8c6d('0x14')]?_0x3e5495[_0x8c6d('0x14')]['include']?_['map'](_0x3e5495['options']['include'],function(_0x2a85b5){return{'model':db[_0x2a85b5[_0x8c6d('0x16')]],'as':_0x2a85b5['as'],'attributes':_0x2a85b5[_0x8c6d('0x17')],'include':_0x2a85b5['include']?_[_0x8c6d('0x18')](_0x2a85b5['include'],function(_0x15a9c4){return{'model':db[_0x15a9c4['model']],'as':_0x15a9c4['as'],'attributes':_0x15a9c4[_0x8c6d('0x17')],'include':_0x15a9c4[_0x8c6d('0x19')]?_[_0x8c6d('0x18')](_0x15a9c4[_0x8c6d('0x19')],function(_0x1e6755){return{'model':db[_0x1e6755[_0x8c6d('0x16')]],'as':_0x1e6755['as'],'attributes':_0x1e6755[_0x8c6d('0x17')]};}):[]};}):[]};}):[]:[]})[_0x8c6d('0x1a')](function(_0x3eab38){logger['info']('GetCampaign',_0x3e5495);logger[_0x8c6d('0xd')](_0x8c6d('0x1b'),_0x3e5495,JSON[_0x8c6d('0xf')](_0x3eab38));_0x4c2f8d(_0x3eab38);})[_0x8c6d('0x12')](function(_0x370626){logger[_0x8c6d('0x10')](_0x8c6d('0x1b'),_0x370626[_0x8c6d('0x11')],_0x3e5495);_0x21b8ee(_0x5a22de[_0x8c6d('0x10')](0x1f4,_0x370626[_0x8c6d('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 9375345..7b1f9bd 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 _0x2d70=['getHoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','/:id/clone','clone','addBlackLists','put','delete','destroy','removeLists','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','show'];(function(_0x271059,_0x2d63fc){var _0x4d0010=function(_0x14cc4d){while(--_0x14cc4d){_0x271059['push'](_0x271059['shift']());}};_0x4d0010(++_0x2d63fc);}(_0x2d70,0xd2));var _0x02d7=function(_0x4667b2,_0x135b67){_0x4667b2=_0x4667b2-0x0;var _0x1070f2=_0x2d70[_0x4667b2];return _0x1070f2;};'use strict';var multer=require(_0x02d7('0x0'));var util=require('util');var path=require(_0x02d7('0x1'));var timeout=require(_0x02d7('0x2'));var express=require(_0x02d7('0x3'));var router=express['Router']();var fs_extra=require(_0x02d7('0x4'));var auth=require(_0x02d7('0x5'));var interaction=require(_0x02d7('0x6'));var config=require(_0x02d7('0x7'));var controller=require(_0x02d7('0x8'));router[_0x02d7('0x9')]('/',auth[_0x02d7('0xa')](),controller[_0x02d7('0xb')]);router[_0x02d7('0x9')](_0x02d7('0xc'),auth[_0x02d7('0xa')](),controller[_0x02d7('0xd')]);router[_0x02d7('0x9')]('/:id/hoppers',auth[_0x02d7('0xa')](),controller[_0x02d7('0xe')]);router[_0x02d7('0x9')]('/:id/hopper_histories',auth[_0x02d7('0xa')](),controller[_0x02d7('0xf')]);router[_0x02d7('0x9')](_0x02d7('0x10'),auth[_0x02d7('0xa')](),controller[_0x02d7('0x11')]);router[_0x02d7('0x9')](_0x02d7('0x12'),auth[_0x02d7('0xa')](),controller[_0x02d7('0x13')]);router[_0x02d7('0x9')](_0x02d7('0x14'),auth[_0x02d7('0xa')](),controller[_0x02d7('0x15')]);router['get'](_0x02d7('0x16'),auth[_0x02d7('0xa')](),controller[_0x02d7('0x17')]);router[_0x02d7('0x18')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x02d7('0x19'),auth[_0x02d7('0xa')](),controller[_0x02d7('0x1a')]);router[_0x02d7('0x18')]('/:id/lists',auth[_0x02d7('0xa')](),controller['addLists']);router[_0x02d7('0x18')](_0x02d7('0x16'),auth[_0x02d7('0xa')](),controller[_0x02d7('0x1b')]);router[_0x02d7('0x1c')](_0x02d7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x02d7('0x1d')](_0x02d7('0xc'),auth['isAuthenticated'](),controller[_0x02d7('0x1e')]);router[_0x02d7('0x1d')](_0x02d7('0x14'),auth[_0x02d7('0xa')](),controller[_0x02d7('0x1f')]);router[_0x02d7('0x1d')](_0x02d7('0x16'),auth[_0x02d7('0xa')](),controller['removeBlackLists']);module['exports']=router; \ No newline at end of file +var _0x9aee=['../../components/auth/service','../../components/interaction/service','isAuthenticated','/:id','show','get','getHoppers','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','post','create','/:id/clone','clone','addBlackLists','put','delete','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x24a863,_0x255d66){var _0x564910=function(_0x3d59d){while(--_0x3d59d){_0x24a863['push'](_0x24a863['shift']());}};_0x564910(++_0x255d66);}(_0x9aee,0x71));var _0xe9ae=function(_0x515d8c,_0x305407){_0x515d8c=_0x515d8c-0x0;var _0x1297e7=_0x9aee[_0x515d8c];return _0x1297e7;};'use strict';var multer=require(_0xe9ae('0x0'));var util=require(_0xe9ae('0x1'));var path=require(_0xe9ae('0x2'));var timeout=require(_0xe9ae('0x3'));var express=require(_0xe9ae('0x4'));var router=express[_0xe9ae('0x5')]();var fs_extra=require(_0xe9ae('0x6'));var auth=require(_0xe9ae('0x7'));var interaction=require(_0xe9ae('0x8'));var config=require('../../config/environment');var controller=require('./campaign.controller');router['get']('/',auth[_0xe9ae('0x9')](),controller['index']);router['get'](_0xe9ae('0xa'),auth['isAuthenticated'](),controller[_0xe9ae('0xb')]);router[_0xe9ae('0xc')]('/:id/hoppers',auth[_0xe9ae('0x9')](),controller[_0xe9ae('0xd')]);router[_0xe9ae('0xc')]('/:id/hopper_histories',auth[_0xe9ae('0x9')](),controller[_0xe9ae('0xe')]);router[_0xe9ae('0xc')]('/:id/hopper_finals',auth[_0xe9ae('0x9')](),controller['getHopperFinals']);router[_0xe9ae('0xc')](_0xe9ae('0xf'),auth[_0xe9ae('0x9')](),controller[_0xe9ae('0x10')]);router[_0xe9ae('0xc')](_0xe9ae('0x11'),auth[_0xe9ae('0x9')](),controller[_0xe9ae('0x12')]);router['get'](_0xe9ae('0x13'),auth[_0xe9ae('0x9')](),controller['getBlackLists']);router[_0xe9ae('0x14')]('/',auth[_0xe9ae('0x9')](),controller[_0xe9ae('0x15')]);router[_0xe9ae('0x14')](_0xe9ae('0x16'),auth[_0xe9ae('0x9')](),controller[_0xe9ae('0x17')]);router[_0xe9ae('0x14')](_0xe9ae('0x11'),auth['isAuthenticated'](),controller['addLists']);router[_0xe9ae('0x14')]('/:id/blacklists',auth[_0xe9ae('0x9')](),controller[_0xe9ae('0x18')]);router[_0xe9ae('0x19')](_0xe9ae('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xe9ae('0xa'),auth[_0xe9ae('0x9')](),controller['destroy']);router[_0xe9ae('0x1a')]('/:id/lists',auth[_0xe9ae('0x9')](),controller[_0xe9ae('0x1b')]);router[_0xe9ae('0x1a')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0xe9ae('0x1c')]);module[_0xe9ae('0x1d')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 89a47b9..485b78e 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 _0x3a88=['VIRTUAL','getDataValue','key','sequelize','STRING'];(function(_0x104ef5,_0x2d0d89){var _0x11907e=function(_0x303536){while(--_0x303536){_0x104ef5['push'](_0x104ef5['shift']());}};_0x11907e(++_0x2d0d89);}(_0x3a88,0x148));var _0x83a8=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0x3a88[_0x31a371];return _0x2a5bd6;};'use strict';var Sequelize=require(_0x83a8('0x0'));module['exports']={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x83a8('0x1')]},'name':{'type':Sequelize[_0x83a8('0x2')],'get':function(){return this[_0x83a8('0x3')](_0x83a8('0x4'));}}}; \ No newline at end of file +var _0xe94f=['key','sequelize','exports','STRING','VIRTUAL'];(function(_0x2b9075,_0x25b39c){var _0x256ac2=function(_0x388e28){while(--_0x388e28){_0x2b9075['push'](_0x2b9075['shift']());}};_0x256ac2(++_0x25b39c);}(_0xe94f,0x178));var _0xfe94=function(_0x51e79c,_0x51485e){_0x51e79c=_0x51e79c-0x0;var _0x2467be=_0xe94f[_0x51e79c];return _0x2467be;};'use strict';var Sequelize=require(_0xfe94('0x0'));module[_0xfe94('0x1')]={'key':{'type':Sequelize[_0xfe94('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0xfe94('0x2')]},'name':{'type':Sequelize[_0xfe94('0x3')],'get':function(){return this['getDataValue'](_0xfe94('0x4'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 30cb5aa..1567ddc 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 _0x9bc7=['set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','CannedAnswer','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','body','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','CannedAnswers','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','limit','count','offset'];(function(_0x311909,_0x414bf7){var _0x8d3163=function(_0x226f55){while(--_0x226f55){_0x311909['push'](_0x311909['shift']());}};_0x8d3163(++_0x414bf7);}(_0x9bc7,0x1ab));var _0x79bc=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x9bc7[_0xfae23b];return _0x200640;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x79bc('0x0'));var zipdir=require(_0x79bc('0x1'));var jsonpatch=require(_0x79bc('0x2'));var rp=require(_0x79bc('0x3'));var moment=require(_0x79bc('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x79bc('0x5'));var path=require(_0x79bc('0x6'));var sox=require(_0x79bc('0x7'));var csv=require(_0x79bc('0x8'));var ejs=require(_0x79bc('0x9'));var fs=require('fs');var fs_extra=require(_0x79bc('0xa'));var _=require(_0x79bc('0xb'));var squel=require(_0x79bc('0xc'));var crypto=require(_0x79bc('0xd'));var jsforce=require(_0x79bc('0xe'));var deskjs=require(_0x79bc('0xf'));var toCsv=require(_0x79bc('0x8'));var querystring=require(_0x79bc('0x10'));var Papa=require(_0x79bc('0x11'));var Redis=require('ioredis');var authService=require(_0x79bc('0x12'));var qs=require(_0x79bc('0x13'));var as=require(_0x79bc('0x14'));var hardwareService=require(_0x79bc('0x15'));var logger=require(_0x79bc('0x16'))(_0x79bc('0x17'));var utils=require(_0x79bc('0x18'));var config=require(_0x79bc('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x79bc('0x1a'))['db'];function respondWithStatusCode(_0x736d6,_0x44ec78){_0x44ec78=_0x44ec78||0xcc;return function(_0x588f2f){if(_0x588f2f){return _0x736d6['sendStatus'](_0x44ec78);}return _0x736d6[_0x79bc('0x1b')](_0x44ec78)[_0x79bc('0x1c')]();};}function respondWithResult(_0x209c03,_0x4eddd0){_0x4eddd0=_0x4eddd0||0xc8;return function(_0x314012){if(_0x314012){return _0x209c03[_0x79bc('0x1b')](_0x4eddd0)[_0x79bc('0x1d')](_0x314012);}};}function respondWithFilteredResult(_0x3d3e8b,_0x2ce107){return function(_0x436149){if(_0x436149){var _0x2eff35=typeof _0x2ce107['offset']==='undefined'&&typeof _0x2ce107[_0x79bc('0x1e')]==='undefined';var _0x44c478=_0x436149[_0x79bc('0x1f')];var _0x20d3ea=_0x2eff35?0x0:_0x2ce107[_0x79bc('0x20')];var _0x2ac62c=_0x2eff35?_0x436149[_0x79bc('0x1f')]:_0x2ce107['offset']+_0x2ce107[_0x79bc('0x1e')];var _0x1623c7;if(_0x2ac62c>=_0x44c478){_0x2ac62c=_0x44c478;_0x1623c7=0xc8;}else{_0x1623c7=0xce;}_0x3d3e8b['status'](_0x1623c7);return _0x3d3e8b[_0x79bc('0x21')](_0x79bc('0x22'),_0x20d3ea+'-'+_0x2ac62c+'/'+_0x44c478)[_0x79bc('0x1d')](_0x436149);}return null;};}function patchUpdates(_0x481285){return function(_0x18b122){try{jsonpatch[_0x79bc('0x23')](_0x18b122,_0x481285,!![]);}catch(_0x28e5ec){return BPromise[_0x79bc('0x24')](_0x28e5ec);}return _0x18b122[_0x79bc('0x25')]();};}function saveUpdates(_0x5c7d09,_0x2db509){return function(_0x4b4965){if(_0x4b4965){return _0x4b4965[_0x79bc('0x26')](_0x5c7d09)[_0x79bc('0x27')](function(_0x5a8f3b){return _0x5a8f3b;});}return null;};}function removeEntity(_0x9ee21c,_0x46b519){return function(_0x17edfa){if(_0x17edfa){return _0x17edfa[_0x79bc('0x28')]()[_0x79bc('0x27')](function(){var _0x2ecc8b=_0x17edfa[_0x79bc('0x29')]({'plain':!![]});var _0x11d3b9='CannedAnswers';return db[_0x79bc('0x2a')][_0x79bc('0x28')]({'where':{'type':_0x11d3b9,'resourceId':_0x2ecc8b['id']}})[_0x79bc('0x27')](function(){return _0x17edfa;});})[_0x79bc('0x27')](function(){_0x9ee21c[_0x79bc('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f9869,_0x4d801b){return function(_0x50de59){if(!_0x50de59){_0x1f9869['sendStatus'](0x194);}return _0x50de59;};}function handleError(_0x2a5d67,_0x5580ba){_0x5580ba=_0x5580ba||0x1f4;return function(_0x3b86d8){logger[_0x79bc('0x2b')](_0x3b86d8[_0x79bc('0x2c')]);if(_0x3b86d8[_0x79bc('0x2d')]){delete _0x3b86d8[_0x79bc('0x2d')];}_0x2a5d67['status'](_0x5580ba)[_0x79bc('0x2e')](_0x3b86d8);};}exports[_0x79bc('0x2f')]=function(_0x52f779,_0x3c9f42){var _0x3c0773={},_0x4e6f84={},_0xd6e003={'count':0x0,'rows':[]};var _0x16b987=_[_0x79bc('0x30')](db[_0x79bc('0x31')][_0x79bc('0x32')],function(_0x2e2a5a){return{'name':_0x2e2a5a[_0x79bc('0x33')],'type':_0x2e2a5a[_0x79bc('0x34')][_0x79bc('0x35')]};});_0x4e6f84['model']=_[_0x79bc('0x30')](_0x16b987,_0x79bc('0x2d'));_0x4e6f84[_0x79bc('0x36')]=_[_0x79bc('0x37')](_0x52f779['query']);_0x4e6f84[_0x79bc('0x38')]=_['intersection'](_0x4e6f84[_0x79bc('0x39')],_0x4e6f84[_0x79bc('0x36')]);_0x3c0773[_0x79bc('0x3a')]=_[_0x79bc('0x3b')](_0x4e6f84[_0x79bc('0x39')],qs[_0x79bc('0x3c')](_0x52f779[_0x79bc('0x36')][_0x79bc('0x3c')]));_0x3c0773['attributes']=_0x3c0773['attributes'][_0x79bc('0x3d')]?_0x3c0773[_0x79bc('0x3a')]:_0x4e6f84[_0x79bc('0x39')];if(!_0x52f779[_0x79bc('0x36')][_0x79bc('0x3e')]('nolimit')){_0x3c0773[_0x79bc('0x1e')]=qs[_0x79bc('0x1e')](_0x52f779[_0x79bc('0x36')]['limit']);_0x3c0773[_0x79bc('0x20')]=qs[_0x79bc('0x20')](_0x52f779['query'][_0x79bc('0x20')]);}_0x3c0773[_0x79bc('0x3f')]=qs['sort'](_0x52f779['query'][_0x79bc('0x40')]);_0x3c0773[_0x79bc('0x41')]=qs[_0x79bc('0x38')](_[_0x79bc('0x42')](_0x52f779[_0x79bc('0x36')],_0x4e6f84[_0x79bc('0x38')]),_0x16b987);if(_0x52f779[_0x79bc('0x36')][_0x79bc('0x43')]){_0x3c0773[_0x79bc('0x41')]=_[_0x79bc('0x44')](_0x3c0773['where'],{'$or':[{'key':{'$like':'%'+_0x52f779[_0x79bc('0x36')][_0x79bc('0x43')]+'%'}},{'value':{'$like':'%'+_0x52f779[_0x79bc('0x36')]['filter']+'%'}}]});}_0x3c0773=_[_0x79bc('0x44')]({},_0x3c0773,_0x52f779[_0x79bc('0x45')]);var _0x3f7313={'where':_0x3c0773[_0x79bc('0x41')]};return db['CannedAnswer'][_0x79bc('0x1f')](_0x3f7313)[_0x79bc('0x27')](function(_0x261d7f){_0xd6e003[_0x79bc('0x1f')]=_0x261d7f;if(_0x52f779['query'][_0x79bc('0x46')]){_0x3c0773[_0x79bc('0x47')]=[{'all':!![]}];}return db[_0x79bc('0x31')][_0x79bc('0x48')](_0x3c0773);})[_0x79bc('0x27')](function(_0x12788d){_0xd6e003[_0x79bc('0x49')]=_0x12788d;return _0xd6e003;})['then'](respondWithFilteredResult(_0x3c9f42,_0x3c0773))[_0x79bc('0x4a')](handleError(_0x3c9f42,null));};exports[_0x79bc('0x4b')]=function(_0xc93c7d,_0x7d644f){var _0x48aba3={'raw':!![],'where':{'id':_0xc93c7d[_0x79bc('0x4c')]['id']}},_0x5300a7={};_0x5300a7[_0x79bc('0x39')]=_['keys'](db['CannedAnswer']['rawAttributes']);_0x5300a7[_0x79bc('0x36')]=_[_0x79bc('0x37')](_0xc93c7d['query']);_0x5300a7[_0x79bc('0x38')]=_[_0x79bc('0x3b')](_0x5300a7[_0x79bc('0x39')],_0x5300a7['query']);_0x48aba3[_0x79bc('0x3a')]=_[_0x79bc('0x3b')](_0x5300a7[_0x79bc('0x39')],qs['fields'](_0xc93c7d['query'][_0x79bc('0x3c')]));_0x48aba3[_0x79bc('0x3a')]=_0x48aba3[_0x79bc('0x3a')][_0x79bc('0x3d')]?_0x48aba3[_0x79bc('0x3a')]:_0x5300a7[_0x79bc('0x39')];if(_0xc93c7d[_0x79bc('0x36')][_0x79bc('0x46')]){_0x48aba3[_0x79bc('0x47')]=[{'all':!![]}];}_0x48aba3=_['merge']({},_0x48aba3,_0xc93c7d['options']);return db[_0x79bc('0x31')][_0x79bc('0x4d')](_0x48aba3)[_0x79bc('0x27')](handleEntityNotFound(_0x7d644f,null))[_0x79bc('0x27')](respondWithResult(_0x7d644f,null))[_0x79bc('0x4a')](handleError(_0x7d644f,null));};exports['update']=function(_0x156ca1,_0x13843c){if(_0x156ca1['body']['id']){delete _0x156ca1[_0x79bc('0x4e')]['id'];}return db[_0x79bc('0x31')][_0x79bc('0x4d')]({'where':{'id':_0x156ca1[_0x79bc('0x4c')]['id']}})[_0x79bc('0x27')](handleEntityNotFound(_0x13843c,null))[_0x79bc('0x27')](saveUpdates(_0x156ca1[_0x79bc('0x4e')],null))[_0x79bc('0x27')](respondWithResult(_0x13843c,null))[_0x79bc('0x4a')](handleError(_0x13843c,null));};exports[_0x79bc('0x28')]=function(_0x13b86a,_0x18c94d){return db[_0x79bc('0x31')][_0x79bc('0x4d')]({'where':{'id':_0x13b86a[_0x79bc('0x4c')]['id']}})[_0x79bc('0x27')](handleEntityNotFound(_0x18c94d,null))[_0x79bc('0x27')](removeEntity(_0x18c94d,null))[_0x79bc('0x4a')](handleError(_0x18c94d,null));};exports['create']=function(_0x37c878,_0x3037cc){var _0x48e446={'key':_0x37c878[_0x79bc('0x4e')][_0x79bc('0x35')]};if(_0x37c878[_0x79bc('0x4e')][_0x79bc('0x4f')]){_0x48e446['MailAccountId']=_0x37c878[_0x79bc('0x4e')][_0x79bc('0x4f')];}else if(_0x37c878[_0x79bc('0x4e')][_0x79bc('0x50')]){_0x48e446[_0x79bc('0x50')]=_0x37c878[_0x79bc('0x4e')][_0x79bc('0x50')];}else if(_0x37c878['body'][_0x79bc('0x51')]){_0x48e446[_0x79bc('0x51')]=_0x37c878[_0x79bc('0x4e')]['OpenchannelAccountId'];}else if(_0x37c878[_0x79bc('0x4e')]['ChatWebsiteId']){_0x48e446['ChatWebsiteId']=_0x37c878['body'][_0x79bc('0x52')];}return db[_0x79bc('0x31')][_0x79bc('0x4d')]({'where':_0x48e446})[_0x79bc('0x27')](function(_0x543577){if(_0x543577){throw new db[(_0x79bc('0x53'))][(_0x79bc('0x54'))](_0x79bc('0x55'));}return db[_0x79bc('0x31')]['create'](_0x37c878[_0x79bc('0x4e')]);})['then'](function(_0x5632f1){var _0x46d0c7=_0x37c878[_0x79bc('0x56')][_0x79bc('0x29')]({'plain':!![]});if(!_0x46d0c7)throw new Error(_0x79bc('0x57'));if(_0x46d0c7['role']===_0x79bc('0x56')){var _0xd61955=_0x5632f1[_0x79bc('0x29')]({'plain':!![]});return db['UserProfileSection'][_0x79bc('0x4d')]({'where':{'name':_0x79bc('0x58'),'userProfileId':_0x46d0c7[_0x79bc('0x59')]},'raw':!![]})['then'](function(_0x11ec38){if(_0x11ec38&&_0x11ec38['autoAssociation']===0x0){return db[_0x79bc('0x2a')][_0x79bc('0x5a')]({'name':_0xd61955[_0x79bc('0x2d')],'resourceId':_0xd61955['id'],'type':_0x11ec38[_0x79bc('0x2d')],'sectionId':_0x11ec38['id']},{})[_0x79bc('0x27')](function(){return _0x5632f1;});}else{return _0x5632f1;}})[_0x79bc('0x4a')](function(_0x170615){logger[_0x79bc('0x2b')](_0x79bc('0x5b'),_0x170615);throw _0x170615;});}return _0x5632f1;})[_0x79bc('0x27')](respondWithResult(_0x3037cc,0xc9))[_0x79bc('0x4a')](handleError(_0x3037cc,null));}; \ No newline at end of file +var _0x29dd=['../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','stack','name','index','map','CannedAnswer','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','options','includeAll','findAll','rows','catch','params','include','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','CannedAnswers','userProfileId','error','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x29dd,0x13d));var _0xd29d=function(_0x2bea1d,_0xc4d88a){_0x2bea1d=_0x2bea1d-0x0;var _0x22cee5=_0x29dd[_0x2bea1d];return _0x22cee5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd29d('0x0'));var zipdir=require(_0xd29d('0x1'));var jsonpatch=require(_0xd29d('0x2'));var rp=require(_0xd29d('0x3'));var moment=require('moment');var BPromise=require(_0xd29d('0x4'));var Mustache=require(_0xd29d('0x5'));var util=require(_0xd29d('0x6'));var path=require(_0xd29d('0x7'));var sox=require(_0xd29d('0x8'));var csv=require(_0xd29d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd29d('0xa'));var _=require(_0xd29d('0xb'));var squel=require(_0xd29d('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd29d('0xd'));var toCsv=require(_0xd29d('0x9'));var querystring=require(_0xd29d('0xe'));var Papa=require(_0xd29d('0xf'));var Redis=require(_0xd29d('0x10'));var authService=require(_0xd29d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd29d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd29d('0x13'));var utils=require(_0xd29d('0x14'));var config=require(_0xd29d('0x15'));var licenseUtil=require(_0xd29d('0x16'));var db=require(_0xd29d('0x17'))['db'];function respondWithStatusCode(_0x5b77cc,_0x212076){_0x212076=_0x212076||0xcc;return function(_0x1c41c9){if(_0x1c41c9){return _0x5b77cc['sendStatus'](_0x212076);}return _0x5b77cc[_0xd29d('0x18')](_0x212076)[_0xd29d('0x19')]();};}function respondWithResult(_0xbf4306,_0x3ae90f){_0x3ae90f=_0x3ae90f||0xc8;return function(_0x5b3727){if(_0x5b3727){return _0xbf4306[_0xd29d('0x18')](_0x3ae90f)[_0xd29d('0x1a')](_0x5b3727);}};}function respondWithFilteredResult(_0x3ddb24,_0x4e9ae1){return function(_0x1f96fb){if(_0x1f96fb){var _0x12855e=typeof _0x4e9ae1[_0xd29d('0x1b')]===_0xd29d('0x1c')&&typeof _0x4e9ae1[_0xd29d('0x1d')]===_0xd29d('0x1c');var _0x587c97=_0x1f96fb[_0xd29d('0x1e')];var _0x1d90ee=_0x12855e?0x0:_0x4e9ae1[_0xd29d('0x1b')];var _0x2e7897=_0x12855e?_0x1f96fb[_0xd29d('0x1e')]:_0x4e9ae1[_0xd29d('0x1b')]+_0x4e9ae1['limit'];var _0x30bdd5;if(_0x2e7897>=_0x587c97){_0x2e7897=_0x587c97;_0x30bdd5=0xc8;}else{_0x30bdd5=0xce;}_0x3ddb24[_0xd29d('0x18')](_0x30bdd5);return _0x3ddb24[_0xd29d('0x1f')](_0xd29d('0x20'),_0x1d90ee+'-'+_0x2e7897+'/'+_0x587c97)[_0xd29d('0x1a')](_0x1f96fb);}return null;};}function patchUpdates(_0x4be369){return function(_0x4558ca){try{jsonpatch[_0xd29d('0x21')](_0x4558ca,_0x4be369,!![]);}catch(_0x4a9541){return BPromise[_0xd29d('0x22')](_0x4a9541);}return _0x4558ca['save']();};}function saveUpdates(_0x1645ee,_0x5c3507){return function(_0x23d78c){if(_0x23d78c){return _0x23d78c[_0xd29d('0x23')](_0x1645ee)[_0xd29d('0x24')](function(_0x1cd80b){return _0x1cd80b;});}return null;};}function removeEntity(_0x352fab,_0x682fd2){return function(_0x367767){if(_0x367767){return _0x367767[_0xd29d('0x25')]()[_0xd29d('0x24')](function(){var _0x4a755b=_0x367767[_0xd29d('0x26')]({'plain':!![]});var _0x2bef3f='CannedAnswers';return db['UserProfileResource'][_0xd29d('0x25')]({'where':{'type':_0x2bef3f,'resourceId':_0x4a755b['id']}})[_0xd29d('0x24')](function(){return _0x367767;});})[_0xd29d('0x24')](function(){_0x352fab[_0xd29d('0x18')](0xcc)[_0xd29d('0x19')]();});}};}function handleEntityNotFound(_0x2ee346,_0x59e7d6){return function(_0x1e4bba){if(!_0x1e4bba){_0x2ee346['sendStatus'](0x194);}return _0x1e4bba;};}function handleError(_0x242517,_0x129bdf){_0x129bdf=_0x129bdf||0x1f4;return function(_0x2f6d82){logger['error'](_0x2f6d82[_0xd29d('0x27')]);if(_0x2f6d82[_0xd29d('0x28')]){delete _0x2f6d82['name'];}_0x242517[_0xd29d('0x18')](_0x129bdf)['send'](_0x2f6d82);};}exports[_0xd29d('0x29')]=function(_0x52421f,_0x41f563){var _0x128d1c={},_0x194fca={},_0x3ea0a8={'count':0x0,'rows':[]};var _0x1ec288=_[_0xd29d('0x2a')](db[_0xd29d('0x2b')][_0xd29d('0x2c')],function(_0x2ca882){return{'name':_0x2ca882['fieldName'],'type':_0x2ca882[_0xd29d('0x2d')]['key']};});_0x194fca[_0xd29d('0x2e')]=_['map'](_0x1ec288,'name');_0x194fca[_0xd29d('0x2f')]=_[_0xd29d('0x30')](_0x52421f['query']);_0x194fca[_0xd29d('0x31')]=_[_0xd29d('0x32')](_0x194fca[_0xd29d('0x2e')],_0x194fca[_0xd29d('0x2f')]);_0x128d1c['attributes']=_[_0xd29d('0x32')](_0x194fca[_0xd29d('0x2e')],qs[_0xd29d('0x33')](_0x52421f[_0xd29d('0x2f')][_0xd29d('0x33')]));_0x128d1c['attributes']=_0x128d1c[_0xd29d('0x34')][_0xd29d('0x35')]?_0x128d1c[_0xd29d('0x34')]:_0x194fca['model'];if(!_0x52421f['query'][_0xd29d('0x36')](_0xd29d('0x37'))){_0x128d1c[_0xd29d('0x1d')]=qs[_0xd29d('0x1d')](_0x52421f['query'][_0xd29d('0x1d')]);_0x128d1c[_0xd29d('0x1b')]=qs[_0xd29d('0x1b')](_0x52421f[_0xd29d('0x2f')][_0xd29d('0x1b')]);}_0x128d1c[_0xd29d('0x38')]=qs[_0xd29d('0x39')](_0x52421f[_0xd29d('0x2f')][_0xd29d('0x39')]);_0x128d1c['where']=qs['filters'](_['pick'](_0x52421f[_0xd29d('0x2f')],_0x194fca[_0xd29d('0x31')]),_0x1ec288);if(_0x52421f[_0xd29d('0x2f')][_0xd29d('0x3a')]){_0x128d1c['where']=_[_0xd29d('0x3b')](_0x128d1c[_0xd29d('0x3c')],{'$or':[{'key':{'$like':'%'+_0x52421f[_0xd29d('0x2f')]['filter']+'%'}},{'value':{'$like':'%'+_0x52421f['query'][_0xd29d('0x3a')]+'%'}}]});}_0x128d1c=_[_0xd29d('0x3b')]({},_0x128d1c,_0x52421f[_0xd29d('0x3d')]);var _0x16469e={'where':_0x128d1c[_0xd29d('0x3c')]};return db['CannedAnswer'][_0xd29d('0x1e')](_0x16469e)[_0xd29d('0x24')](function(_0x2cef3d){_0x3ea0a8[_0xd29d('0x1e')]=_0x2cef3d;if(_0x52421f['query'][_0xd29d('0x3e')]){_0x128d1c['include']=[{'all':!![]}];}return db[_0xd29d('0x2b')][_0xd29d('0x3f')](_0x128d1c);})[_0xd29d('0x24')](function(_0x307fd9){_0x3ea0a8[_0xd29d('0x40')]=_0x307fd9;return _0x3ea0a8;})[_0xd29d('0x24')](respondWithFilteredResult(_0x41f563,_0x128d1c))[_0xd29d('0x41')](handleError(_0x41f563,null));};exports['show']=function(_0x417e7f,_0x14b636){var _0x4ae26d={'raw':!![],'where':{'id':_0x417e7f[_0xd29d('0x42')]['id']}},_0x2e3e4a={};_0x2e3e4a[_0xd29d('0x2e')]=_[_0xd29d('0x30')](db[_0xd29d('0x2b')][_0xd29d('0x2c')]);_0x2e3e4a['query']=_['keys'](_0x417e7f[_0xd29d('0x2f')]);_0x2e3e4a['filters']=_[_0xd29d('0x32')](_0x2e3e4a[_0xd29d('0x2e')],_0x2e3e4a[_0xd29d('0x2f')]);_0x4ae26d['attributes']=_[_0xd29d('0x32')](_0x2e3e4a[_0xd29d('0x2e')],qs['fields'](_0x417e7f[_0xd29d('0x2f')][_0xd29d('0x33')]));_0x4ae26d[_0xd29d('0x34')]=_0x4ae26d[_0xd29d('0x34')]['length']?_0x4ae26d['attributes']:_0x2e3e4a[_0xd29d('0x2e')];if(_0x417e7f[_0xd29d('0x2f')][_0xd29d('0x3e')]){_0x4ae26d[_0xd29d('0x43')]=[{'all':!![]}];}_0x4ae26d=_[_0xd29d('0x3b')]({},_0x4ae26d,_0x417e7f[_0xd29d('0x3d')]);return db[_0xd29d('0x2b')][_0xd29d('0x44')](_0x4ae26d)['then'](handleEntityNotFound(_0x14b636,null))[_0xd29d('0x24')](respondWithResult(_0x14b636,null))['catch'](handleError(_0x14b636,null));};exports[_0xd29d('0x23')]=function(_0x379837,_0x1a533d){if(_0x379837['body']['id']){delete _0x379837[_0xd29d('0x45')]['id'];}return db[_0xd29d('0x2b')][_0xd29d('0x44')]({'where':{'id':_0x379837['params']['id']}})[_0xd29d('0x24')](handleEntityNotFound(_0x1a533d,null))[_0xd29d('0x24')](saveUpdates(_0x379837[_0xd29d('0x45')],null))[_0xd29d('0x24')](respondWithResult(_0x1a533d,null))['catch'](handleError(_0x1a533d,null));};exports['destroy']=function(_0x532817,_0x2999d6){return db[_0xd29d('0x2b')][_0xd29d('0x44')]({'where':{'id':_0x532817[_0xd29d('0x42')]['id']}})[_0xd29d('0x24')](handleEntityNotFound(_0x2999d6,null))[_0xd29d('0x24')](removeEntity(_0x2999d6,null))[_0xd29d('0x41')](handleError(_0x2999d6,null));};exports[_0xd29d('0x46')]=function(_0x4de7f5,_0x4e0465){var _0x386f5d={'key':_0x4de7f5[_0xd29d('0x45')]['key']};if(_0x4de7f5[_0xd29d('0x45')]['MailAccountId']){_0x386f5d[_0xd29d('0x47')]=_0x4de7f5[_0xd29d('0x45')][_0xd29d('0x47')];}else if(_0x4de7f5[_0xd29d('0x45')]['SmsAccountId']){_0x386f5d[_0xd29d('0x48')]=_0x4de7f5['body']['SmsAccountId'];}else if(_0x4de7f5[_0xd29d('0x45')]['OpenchannelAccountId']){_0x386f5d['OpenchannelAccountId']=_0x4de7f5[_0xd29d('0x45')][_0xd29d('0x49')];}else if(_0x4de7f5[_0xd29d('0x45')][_0xd29d('0x4a')]){_0x386f5d[_0xd29d('0x4a')]=_0x4de7f5[_0xd29d('0x45')][_0xd29d('0x4a')];}return db[_0xd29d('0x2b')][_0xd29d('0x44')]({'where':_0x386f5d})[_0xd29d('0x24')](function(_0xa66974){if(_0xa66974){throw new db[(_0xd29d('0x4b'))][(_0xd29d('0x4c'))](_0xd29d('0x4d'));}return db[_0xd29d('0x2b')]['create'](_0x4de7f5[_0xd29d('0x45')]);})['then'](function(_0x46bb3d){var _0x153c11=_0x4de7f5[_0xd29d('0x4e')][_0xd29d('0x26')]({'plain':!![]});if(!_0x153c11)throw new Error(_0xd29d('0x4f'));if(_0x153c11[_0xd29d('0x50')]==='user'){var _0x190b63=_0x46bb3d[_0xd29d('0x26')]({'plain':!![]});return db[_0xd29d('0x51')][_0xd29d('0x44')]({'where':{'name':_0xd29d('0x52'),'userProfileId':_0x153c11[_0xd29d('0x53')]},'raw':!![]})[_0xd29d('0x24')](function(_0x1a50db){if(_0x1a50db&&_0x1a50db['autoAssociation']===0x0){return db['UserProfileResource'][_0xd29d('0x46')]({'name':_0x190b63[_0xd29d('0x28')],'resourceId':_0x190b63['id'],'type':_0x1a50db['name'],'sectionId':_0x1a50db['id']},{})[_0xd29d('0x24')](function(){return _0x46bb3d;});}else{return _0x46bb3d;}})['catch'](function(_0x431120){logger[_0xd29d('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x431120);throw _0x431120;});}return _0x46bb3d;})[_0xd29d('0x24')](respondWithResult(_0x4e0465,0xc9))['catch'](handleError(_0x4e0465,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 350f084..fc7cbae 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 _0x62d5=['exports','define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0x62d5,0xbc));var _0x562d=function(_0xafa225,_0xd29c03){_0xafa225=_0xafa225-0x0;var _0x4f546a=_0x62d5[_0xafa225];return _0x4f546a;};'use strict';var _=require(_0x562d('0x0'));var util=require(_0x562d('0x1'));var logger=require(_0x562d('0x2'))(_0x562d('0x3'));var moment=require('moment');var BPromise=require(_0x562d('0x4'));var rp=require(_0x562d('0x5'));var fs=require('fs');var path=require(_0x562d('0x6'));var rimraf=require('rimraf');var config=require(_0x562d('0x7'));var attributes=require('./cannedAnswer.attributes');module[_0x562d('0x8')]=function(_0x28d7c6,_0x505f16){return _0x28d7c6[_0x562d('0x9')](_0x562d('0xa'),attributes,{'tableName':_0x562d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x562d('0xc'),'collate':_0x562d('0xd')});}; \ No newline at end of file +var _0xdc78=['moment','request-promise','path','../../config/environment','./cannedAnswer.attributes','define','CannedAnswer','tools_canned_answers','utf8mb4_unicode_ci','lodash','../../config/logger','api'];(function(_0x3761c6,_0x2a5f2f){var _0x16ec0b=function(_0x1c04a3){while(--_0x1c04a3){_0x3761c6['push'](_0x3761c6['shift']());}};_0x16ec0b(++_0x2a5f2f);}(_0xdc78,0x14d));var _0x8dc7=function(_0x5d860f,_0x467498){_0x5d860f=_0x5d860f-0x0;var _0x236490=_0xdc78[_0x5d860f];return _0x236490;};'use strict';var _=require(_0x8dc7('0x0'));var util=require('util');var logger=require(_0x8dc7('0x1'))(_0x8dc7('0x2'));var moment=require(_0x8dc7('0x3'));var BPromise=require('bluebird');var rp=require(_0x8dc7('0x4'));var fs=require('fs');var path=require(_0x8dc7('0x5'));var rimraf=require('rimraf');var config=require(_0x8dc7('0x6'));var attributes=require(_0x8dc7('0x7'));module['exports']=function(_0x44088c,_0x3ad5db){return _0x44088c[_0x8dc7('0x8')](_0x8dc7('0x9'),attributes,{'tableName':_0x8dc7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x8dc7('0xb')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 5155c46..4abe925 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(_0x54489d,_0x3fc85b){var _0x3b6f73=function(_0x176886){while(--_0x176886){_0x54489d['push'](_0x54489d['shift']());}};_0x3b6f73(++_0x3fc85b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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(_0x46cece,_0x1729fd){var _0x382eea=function(_0x251d3b){while(--_0x251d3b){_0x46cece['push'](_0x46cece['shift']());}};_0x382eea(++_0x1729fd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 0755faa..a4f7334 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 _0x026e=['../../config/environment','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3c7007,_0x1bc65a){var _0x4c6f08=function(_0x172a85){while(--_0x172a85){_0x3c7007['push'](_0x3c7007['shift']());}};_0x4c6f08(++_0x1bc65a);}(_0x026e,0x188));var _0xe026=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x026e[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xe026('0x0'));var util=require(_0xe026('0x1'));var path=require('path');var timeout=require(_0xe026('0x2'));var express=require(_0xe026('0x3'));var router=express[_0xe026('0x4')]();var fs_extra=require(_0xe026('0x5'));var auth=require(_0xe026('0x6'));var interaction=require(_0xe026('0x7'));var config=require(_0xe026('0x8'));var controller=require('./cannedAnswer.controller');router['get']('/',auth[_0xe026('0x9')](),controller[_0xe026('0xa')]);router[_0xe026('0xb')](_0xe026('0xc'),auth[_0xe026('0x9')](),controller[_0xe026('0xd')]);router[_0xe026('0xe')]('/',auth[_0xe026('0x9')](),controller[_0xe026('0xf')]);router[_0xe026('0x10')](_0xe026('0xc'),auth[_0xe026('0x9')](),controller[_0xe026('0x11')]);router[_0xe026('0x12')](_0xe026('0xc'),auth[_0xe026('0x9')](),controller['destroy']);module[_0xe026('0x13')]=router; \ No newline at end of file +var _0xe488=['./cannedAnswer.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3d3d96,_0x28998e){var _0x2e479a=function(_0x1349ba){while(--_0x1349ba){_0x3d3d96['push'](_0x3d3d96['shift']());}};_0x2e479a(++_0x28998e);}(_0xe488,0x19a));var _0x8e48=function(_0x43aee5,_0x11268b){_0x43aee5=_0x43aee5-0x0;var _0x76d1d0=_0xe488[_0x43aee5];return _0x76d1d0;};'use strict';var multer=require(_0x8e48('0x0'));var util=require(_0x8e48('0x1'));var path=require(_0x8e48('0x2'));var timeout=require('connect-timeout');var express=require(_0x8e48('0x3'));var router=express[_0x8e48('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8e48('0x5'));var interaction=require(_0x8e48('0x6'));var config=require(_0x8e48('0x7'));var controller=require(_0x8e48('0x8'));router[_0x8e48('0x9')]('/',auth[_0x8e48('0xa')](),controller[_0x8e48('0xb')]);router[_0x8e48('0x9')](_0x8e48('0xc'),auth[_0x8e48('0xa')](),controller['show']);router[_0x8e48('0xd')]('/',auth[_0x8e48('0xa')](),controller[_0x8e48('0xe')]);router[_0x8e48('0xf')](_0x8e48('0xc'),auth['isAuthenticated'](),controller[_0x8e48('0x10')]);router[_0x8e48('0x11')](_0x8e48('0xc'),auth[_0x8e48('0xa')](),controller[_0x8e48('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 97e6286..07674ba 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 _0x9b5b=['INTEGER','sequelize','exports','DATE','1970-01-01\x2000:00:01','STRING'];(function(_0x2f27ff,_0xf08829){var _0x23ca86=function(_0x212a57){while(--_0x212a57){_0x2f27ff['push'](_0x2f27ff['shift']());}};_0x23ca86(++_0xf08829);}(_0x9b5b,0x7f));var _0xb9b5=function(_0x22a544,_0x4b9c1a){_0x22a544=_0x22a544-0x0;var _0x1e7a05=_0x9b5b[_0x22a544];return _0x1e7a05;};'use strict';var Sequelize=require(_0xb9b5('0x0'));module[_0xb9b5('0x1')]={'calldate':{'type':Sequelize[_0xb9b5('0x2')],'allowNull':![],'defaultValue':_0xb9b5('0x3')},'clid':{'type':Sequelize[_0xb9b5('0x4')]},'src':{'type':Sequelize[_0xb9b5('0x4')]},'dst':{'type':Sequelize[_0xb9b5('0x4')]},'dcontext':{'type':Sequelize[_0xb9b5('0x4')]},'channel':{'type':Sequelize[_0xb9b5('0x4')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0xb9b5('0x4')]},'lastdata':{'type':Sequelize[_0xb9b5('0x4')]},'duration':{'type':Sequelize[_0xb9b5('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xb9b5('0x4')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xb9b5('0x4')]},'linkedid':{'type':Sequelize[_0xb9b5('0x4')]},'sequence':{'type':Sequelize[_0xb9b5('0x4')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xb9b5('0x4')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6584=['INTEGER','sequelize','exports','DATE','1970-01-01\x2000:00:01','STRING'];(function(_0x318abe,_0x48c571){var _0x28f734=function(_0x27bac8){while(--_0x27bac8){_0x318abe['push'](_0x318abe['shift']());}};_0x28f734(++_0x48c571);}(_0x6584,0x175));var _0x4658=function(_0x32b993,_0x1c5989){_0x32b993=_0x32b993-0x0;var _0x482780=_0x6584[_0x32b993];return _0x482780;};'use strict';var Sequelize=require(_0x4658('0x0'));module[_0x4658('0x1')]={'calldate':{'type':Sequelize[_0x4658('0x2')],'allowNull':![],'defaultValue':_0x4658('0x3')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x4658('0x4')]},'dst':{'type':Sequelize[_0x4658('0x4')]},'dcontext':{'type':Sequelize[_0x4658('0x4')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0x4658('0x4')]},'lastdata':{'type':Sequelize[_0x4658('0x4')]},'duration':{'type':Sequelize[_0x4658('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x4658('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x4658('0x4')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x4658('0x4')]},'userfield':{'type':Sequelize[_0x4658('0x4')]},'uniqueid':{'type':Sequelize[_0x4658('0x4')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0x4658('0x4')]},'peeraccount':{'type':Sequelize[_0x4658('0x4')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 1109169..ee60b21 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 _0xa23f=['../../config/utils','../../config/environment','../../config/license/util','end','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','update','then','sendStatus','stack','send','index','Cdr','rawAttributes','fieldName','type','key','model','map','name','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','filters','VIRTUAL','filter','merge','options','includeAll','findAll','rows','catch','length','find','create','body','params','destroy','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x28d7b5,_0x1305a4){var _0x1ed035=function(_0x57e1f6){while(--_0x57e1f6){_0x28d7b5['push'](_0x28d7b5['shift']());}};_0x1ed035(++_0x1305a4);}(_0xa23f,0x7c));var _0xfa23=function(_0x22c3c1,_0x4f7c0d){_0x22c3c1=_0x22c3c1-0x0;var _0x51b308=_0xa23f[_0x22c3c1];return _0x51b308;};'use strict';var emlformat=require(_0xfa23('0x0'));var rimraf=require(_0xfa23('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfa23('0x2'));var moment=require(_0xfa23('0x3'));var BPromise=require(_0xfa23('0x4'));var Mustache=require(_0xfa23('0x5'));var util=require('util');var path=require(_0xfa23('0x6'));var sox=require('sox');var csv=require(_0xfa23('0x7'));var ejs=require(_0xfa23('0x8'));var fs=require('fs');var fs_extra=require(_0xfa23('0x9'));var _=require(_0xfa23('0xa'));var squel=require('squel');var crypto=require(_0xfa23('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xfa23('0xc'));var toCsv=require(_0xfa23('0x7'));var querystring=require(_0xfa23('0xd'));var Papa=require(_0xfa23('0xe'));var Redis=require(_0xfa23('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfa23('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfa23('0x11'))('api');var utils=require(_0xfa23('0x12'));var config=require(_0xfa23('0x13'));var licenseUtil=require(_0xfa23('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e5ffe,_0x42380){_0x42380=_0x42380||0xcc;return function(_0x46f991){if(_0x46f991){return _0x1e5ffe['sendStatus'](_0x42380);}return _0x1e5ffe['status'](_0x42380)[_0xfa23('0x15')]();};}function respondWithResult(_0x23712b,_0x3f50f0){_0x3f50f0=_0x3f50f0||0xc8;return function(_0x36252c){if(_0x36252c){return _0x23712b['status'](_0x3f50f0)[_0xfa23('0x16')](_0x36252c);}};}function respondWithFilteredResult(_0xb7d11a,_0x2095a5){return function(_0x9611e0){if(_0x9611e0){var _0x542d9a=typeof _0x2095a5[_0xfa23('0x17')]===_0xfa23('0x18')&&typeof _0x2095a5[_0xfa23('0x19')]===_0xfa23('0x18');var _0x3fa5f6=_0x9611e0['count'];var _0x59610c=_0x542d9a?0x0:_0x2095a5['offset'];var _0x445bd0=_0x542d9a?_0x9611e0[_0xfa23('0x1a')]:_0x2095a5['offset']+_0x2095a5[_0xfa23('0x19')];var _0x2c456b;if(_0x445bd0>=_0x3fa5f6){_0x445bd0=_0x3fa5f6;_0x2c456b=0xc8;}else{_0x2c456b=0xce;}_0xb7d11a[_0xfa23('0x1b')](_0x2c456b);return _0xb7d11a['set'](_0xfa23('0x1c'),_0x59610c+'-'+_0x445bd0+'/'+_0x3fa5f6)[_0xfa23('0x16')](_0x9611e0);}return null;};}function patchUpdates(_0x47c323){return function(_0x16e4f9){try{jsonpatch[_0xfa23('0x1d')](_0x16e4f9,_0x47c323,!![]);}catch(_0x148f3b){return BPromise[_0xfa23('0x1e')](_0x148f3b);}return _0x16e4f9[_0xfa23('0x1f')]();};}function saveUpdates(_0x10ef95,_0x31eedb){return function(_0x485838){if(_0x485838){return _0x485838[_0xfa23('0x20')](_0x10ef95)[_0xfa23('0x21')](function(_0x34a2ce){return _0x34a2ce;});}return null;};}function removeEntity(_0xe4680f,_0x542cde){return function(_0x4500a2){if(_0x4500a2){return _0x4500a2['destroy']()[_0xfa23('0x21')](function(){_0xe4680f[_0xfa23('0x1b')](0xcc)[_0xfa23('0x15')]();});}};}function handleEntityNotFound(_0x26bdce,_0x3362f3){return function(_0x1340d9){if(!_0x1340d9){_0x26bdce[_0xfa23('0x22')](0x194);}return _0x1340d9;};}function handleError(_0x499407,_0x5e1780){_0x5e1780=_0x5e1780||0x1f4;return function(_0x2ae826){logger['error'](_0x2ae826[_0xfa23('0x23')]);if(_0x2ae826['name']){delete _0x2ae826['name'];}_0x499407[_0xfa23('0x1b')](_0x5e1780)[_0xfa23('0x24')](_0x2ae826);};}exports[_0xfa23('0x25')]=function(_0x3b00a8,_0x374169){var _0x24da31={},_0x3c9d9d={},_0x4c1ab0={'count':0x0,'rows':[]};var _0x591797=_['map'](db[_0xfa23('0x26')][_0xfa23('0x27')],function(_0x5df1f9){return{'name':_0x5df1f9[_0xfa23('0x28')],'type':_0x5df1f9[_0xfa23('0x29')][_0xfa23('0x2a')]};});_0x3c9d9d[_0xfa23('0x2b')]=_[_0xfa23('0x2c')](_0x591797,_0xfa23('0x2d'));_0x3c9d9d[_0xfa23('0x2e')]=_[_0xfa23('0x2f')](_0x3b00a8[_0xfa23('0x2e')]);_0x3c9d9d['filters']=_[_0xfa23('0x30')](_0x3c9d9d['model'],_0x3c9d9d[_0xfa23('0x2e')]);_0x24da31[_0xfa23('0x31')]=_[_0xfa23('0x30')](_0x3c9d9d[_0xfa23('0x2b')],qs[_0xfa23('0x32')](_0x3b00a8[_0xfa23('0x2e')][_0xfa23('0x32')]));_0x24da31[_0xfa23('0x31')]=_0x24da31[_0xfa23('0x31')]['length']?_0x24da31[_0xfa23('0x31')]:_0x3c9d9d['model'];if(!_0x3b00a8[_0xfa23('0x2e')][_0xfa23('0x33')](_0xfa23('0x34'))){_0x24da31[_0xfa23('0x19')]=qs[_0xfa23('0x19')](_0x3b00a8[_0xfa23('0x2e')][_0xfa23('0x19')]);_0x24da31['offset']=qs[_0xfa23('0x17')](_0x3b00a8[_0xfa23('0x2e')][_0xfa23('0x17')]);}_0x24da31[_0xfa23('0x35')]=qs['sort'](_0x3b00a8['query']['sort']);_0x24da31[_0xfa23('0x36')]=qs[_0xfa23('0x37')](_['pick'](_0x3b00a8[_0xfa23('0x2e')],_0x3c9d9d[_0xfa23('0x37')]),_0x591797);if(_0x3b00a8[_0xfa23('0x2e')]['filter']){_0x24da31[_0xfa23('0x36')]=_['merge'](_0x24da31[_0xfa23('0x36')],{'$or':_[_0xfa23('0x2c')](_0x591797,function(_0x329985){if(_0x329985[_0xfa23('0x29')]!==_0xfa23('0x38')){var _0x80827f={};_0x80827f[_0x329985['name']]={'$like':'%'+_0x3b00a8[_0xfa23('0x2e')][_0xfa23('0x39')]+'%'};return _0x80827f;}})});}_0x24da31=_[_0xfa23('0x3a')]({},_0x24da31,_0x3b00a8[_0xfa23('0x3b')]);var _0x48c3a4={'where':_0x24da31[_0xfa23('0x36')]};return db[_0xfa23('0x26')][_0xfa23('0x1a')](_0x48c3a4)[_0xfa23('0x21')](function(_0x113552){_0x4c1ab0[_0xfa23('0x1a')]=_0x113552;if(_0x3b00a8['query'][_0xfa23('0x3c')]){_0x24da31['include']=[{'all':!![]}];}return db['Cdr'][_0xfa23('0x3d')](_0x24da31);})[_0xfa23('0x21')](function(_0x5937e0){_0x4c1ab0[_0xfa23('0x3e')]=_0x5937e0;return _0x4c1ab0;})[_0xfa23('0x21')](respondWithFilteredResult(_0x374169,_0x24da31))[_0xfa23('0x3f')](handleError(_0x374169,null));};exports['show']=function(_0x3de346,_0x37f4c5){var _0xb73ed9={'raw':!![],'where':{'id':_0x3de346['params']['id']}},_0x539271={};_0x539271[_0xfa23('0x2b')]=_['keys'](db[_0xfa23('0x26')][_0xfa23('0x27')]);_0x539271[_0xfa23('0x2e')]=_['keys'](_0x3de346[_0xfa23('0x2e')]);_0x539271[_0xfa23('0x37')]=_[_0xfa23('0x30')](_0x539271[_0xfa23('0x2b')],_0x539271['query']);_0xb73ed9[_0xfa23('0x31')]=_[_0xfa23('0x30')](_0x539271[_0xfa23('0x2b')],qs['fields'](_0x3de346['query'][_0xfa23('0x32')]));_0xb73ed9['attributes']=_0xb73ed9[_0xfa23('0x31')][_0xfa23('0x40')]?_0xb73ed9[_0xfa23('0x31')]:_0x539271[_0xfa23('0x2b')];if(_0x3de346[_0xfa23('0x2e')][_0xfa23('0x3c')]){_0xb73ed9['include']=[{'all':!![]}];}_0xb73ed9=_[_0xfa23('0x3a')]({},_0xb73ed9,_0x3de346[_0xfa23('0x3b')]);return db[_0xfa23('0x26')][_0xfa23('0x41')](_0xb73ed9)[_0xfa23('0x21')](handleEntityNotFound(_0x37f4c5,null))[_0xfa23('0x21')](respondWithResult(_0x37f4c5,null))['catch'](handleError(_0x37f4c5,null));};exports[_0xfa23('0x42')]=function(_0x36a02c,_0x6ba64c){return db[_0xfa23('0x26')][_0xfa23('0x42')](_0x36a02c['body'],{})[_0xfa23('0x21')](respondWithResult(_0x6ba64c,0xc9))[_0xfa23('0x3f')](handleError(_0x6ba64c,null));};exports[_0xfa23('0x20')]=function(_0x5e4633,_0x253faf){if(_0x5e4633[_0xfa23('0x43')]['id']){delete _0x5e4633[_0xfa23('0x43')]['id'];}return db[_0xfa23('0x26')][_0xfa23('0x41')]({'where':{'id':_0x5e4633[_0xfa23('0x44')]['id']}})[_0xfa23('0x21')](handleEntityNotFound(_0x253faf,null))['then'](saveUpdates(_0x5e4633[_0xfa23('0x43')],null))['then'](respondWithResult(_0x253faf,null))[_0xfa23('0x3f')](handleError(_0x253faf,null));};exports[_0xfa23('0x45')]=function(_0x3824a9,_0xf24dd5){return db[_0xfa23('0x26')][_0xfa23('0x41')]({'where':{'id':_0x3824a9['params']['id']}})[_0xfa23('0x21')](handleEntityNotFound(_0xf24dd5,null))[_0xfa23('0x21')](removeEntity(_0xf24dd5,null))[_0xfa23('0x3f')](handleError(_0xf24dd5,null));};exports[_0xfa23('0x46')]=function(_0x13c37d,_0x22be14){return db[_0xfa23('0x26')]['describe']()[_0xfa23('0x21')](respondWithResult(_0x22be14,null))[_0xfa23('0x3f')](handleError(_0x22be14,null));}; \ No newline at end of file +var _0xf006=['fieldName','keys','filters','intersection','model','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','type','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','destroy','describe','zip-dir','fast-json-patch','moment','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','count','set','Content-Range','reject','save','update','then','error','stack','name','send','index','map','Cdr','rawAttributes'];(function(_0x5341ff,_0x1de6df){var _0x53be58=function(_0x4da0da){while(--_0x4da0da){_0x5341ff['push'](_0x5341ff['shift']());}};_0x53be58(++_0x1de6df);}(_0xf006,0x146));var _0x6f00=function(_0x50723d,_0x1f48eb){_0x50723d=_0x50723d-0x0;var _0x3a1534=_0xf006[_0x50723d];return _0x3a1534;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6f00('0x0'));var jsonpatch=require(_0x6f00('0x1'));var rp=require('request-promise');var moment=require(_0x6f00('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x6f00('0x3'));var util=require('util');var path=require('path');var sox=require(_0x6f00('0x4'));var csv=require(_0x6f00('0x5'));var ejs=require(_0x6f00('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6f00('0x7'));var squel=require('squel');var crypto=require(_0x6f00('0x8'));var jsforce=require(_0x6f00('0x9'));var deskjs=require(_0x6f00('0xa'));var toCsv=require(_0x6f00('0x5'));var querystring=require(_0x6f00('0xb'));var Papa=require(_0x6f00('0xc'));var Redis=require(_0x6f00('0xd'));var authService=require(_0x6f00('0xe'));var qs=require(_0x6f00('0xf'));var as=require(_0x6f00('0x10'));var hardwareService=require(_0x6f00('0x11'));var logger=require(_0x6f00('0x12'))(_0x6f00('0x13'));var utils=require('../../config/utils');var config=require(_0x6f00('0x14'));var licenseUtil=require(_0x6f00('0x15'));var db=require(_0x6f00('0x16'))['db'];function respondWithStatusCode(_0x36a2ec,_0x289fe9){_0x289fe9=_0x289fe9||0xcc;return function(_0x5e3264){if(_0x5e3264){return _0x36a2ec[_0x6f00('0x17')](_0x289fe9);}return _0x36a2ec['status'](_0x289fe9)[_0x6f00('0x18')]();};}function respondWithResult(_0x5047f5,_0x324e67){_0x324e67=_0x324e67||0xc8;return function(_0x220e68){if(_0x220e68){return _0x5047f5[_0x6f00('0x19')](_0x324e67)[_0x6f00('0x1a')](_0x220e68);}};}function respondWithFilteredResult(_0xa6e7a1,_0x411203){return function(_0x46bc2c){if(_0x46bc2c){var _0x4d8aee=typeof _0x411203[_0x6f00('0x1b')]==='undefined'&&typeof _0x411203[_0x6f00('0x1c')]==='undefined';var _0x534275=_0x46bc2c[_0x6f00('0x1d')];var _0x6cf83f=_0x4d8aee?0x0:_0x411203[_0x6f00('0x1b')];var _0x340f78=_0x4d8aee?_0x46bc2c[_0x6f00('0x1d')]:_0x411203[_0x6f00('0x1b')]+_0x411203[_0x6f00('0x1c')];var _0x295640;if(_0x340f78>=_0x534275){_0x340f78=_0x534275;_0x295640=0xc8;}else{_0x295640=0xce;}_0xa6e7a1[_0x6f00('0x19')](_0x295640);return _0xa6e7a1[_0x6f00('0x1e')](_0x6f00('0x1f'),_0x6cf83f+'-'+_0x340f78+'/'+_0x534275)[_0x6f00('0x1a')](_0x46bc2c);}return null;};}function patchUpdates(_0x4e11de){return function(_0x4f3031){try{jsonpatch['apply'](_0x4f3031,_0x4e11de,!![]);}catch(_0x2a5286){return BPromise[_0x6f00('0x20')](_0x2a5286);}return _0x4f3031[_0x6f00('0x21')]();};}function saveUpdates(_0x57340f,_0xe301e5){return function(_0x9066ff){if(_0x9066ff){return _0x9066ff[_0x6f00('0x22')](_0x57340f)[_0x6f00('0x23')](function(_0x388983){return _0x388983;});}return null;};}function removeEntity(_0x1cbf1c,_0x90d74c){return function(_0x1ea061){if(_0x1ea061){return _0x1ea061['destroy']()[_0x6f00('0x23')](function(){_0x1cbf1c[_0x6f00('0x19')](0xcc)[_0x6f00('0x18')]();});}};}function handleEntityNotFound(_0x4d41ef,_0x37f062){return function(_0x4f7e29){if(!_0x4f7e29){_0x4d41ef[_0x6f00('0x17')](0x194);}return _0x4f7e29;};}function handleError(_0x511293,_0x434735){_0x434735=_0x434735||0x1f4;return function(_0x39375d){logger[_0x6f00('0x24')](_0x39375d[_0x6f00('0x25')]);if(_0x39375d[_0x6f00('0x26')]){delete _0x39375d['name'];}_0x511293[_0x6f00('0x19')](_0x434735)[_0x6f00('0x27')](_0x39375d);};}exports[_0x6f00('0x28')]=function(_0x4366a4,_0x2671fe){var _0x235a86={},_0xff36ce={},_0x451849={'count':0x0,'rows':[]};var _0x22f107=_[_0x6f00('0x29')](db[_0x6f00('0x2a')][_0x6f00('0x2b')],function(_0x29555d){return{'name':_0x29555d[_0x6f00('0x2c')],'type':_0x29555d['type']['key']};});_0xff36ce['model']=_['map'](_0x22f107,'name');_0xff36ce['query']=_[_0x6f00('0x2d')](_0x4366a4['query']);_0xff36ce[_0x6f00('0x2e')]=_[_0x6f00('0x2f')](_0xff36ce[_0x6f00('0x30')],_0xff36ce[_0x6f00('0x31')]);_0x235a86[_0x6f00('0x32')]=_[_0x6f00('0x2f')](_0xff36ce['model'],qs[_0x6f00('0x33')](_0x4366a4[_0x6f00('0x31')][_0x6f00('0x33')]));_0x235a86[_0x6f00('0x32')]=_0x235a86[_0x6f00('0x32')]['length']?_0x235a86['attributes']:_0xff36ce['model'];if(!_0x4366a4[_0x6f00('0x31')][_0x6f00('0x34')](_0x6f00('0x35'))){_0x235a86[_0x6f00('0x1c')]=qs[_0x6f00('0x1c')](_0x4366a4['query'][_0x6f00('0x1c')]);_0x235a86[_0x6f00('0x1b')]=qs[_0x6f00('0x1b')](_0x4366a4[_0x6f00('0x31')][_0x6f00('0x1b')]);}_0x235a86[_0x6f00('0x36')]=qs[_0x6f00('0x37')](_0x4366a4['query'][_0x6f00('0x37')]);_0x235a86[_0x6f00('0x38')]=qs[_0x6f00('0x2e')](_['pick'](_0x4366a4[_0x6f00('0x31')],_0xff36ce[_0x6f00('0x2e')]),_0x22f107);if(_0x4366a4[_0x6f00('0x31')]['filter']){_0x235a86[_0x6f00('0x38')]=_['merge'](_0x235a86[_0x6f00('0x38')],{'$or':_['map'](_0x22f107,function(_0x3dc8e3){if(_0x3dc8e3[_0x6f00('0x39')]!==_0x6f00('0x3a')){var _0x896b3f={};_0x896b3f[_0x3dc8e3['name']]={'$like':'%'+_0x4366a4[_0x6f00('0x31')]['filter']+'%'};return _0x896b3f;}})});}_0x235a86=_[_0x6f00('0x3b')]({},_0x235a86,_0x4366a4['options']);var _0x7785e1={'where':_0x235a86[_0x6f00('0x38')]};return db[_0x6f00('0x2a')][_0x6f00('0x1d')](_0x7785e1)['then'](function(_0x53dc8c){_0x451849[_0x6f00('0x1d')]=_0x53dc8c;if(_0x4366a4['query'][_0x6f00('0x3c')]){_0x235a86[_0x6f00('0x3d')]=[{'all':!![]}];}return db['Cdr'][_0x6f00('0x3e')](_0x235a86);})['then'](function(_0x4cac2c){_0x451849[_0x6f00('0x3f')]=_0x4cac2c;return _0x451849;})[_0x6f00('0x23')](respondWithFilteredResult(_0x2671fe,_0x235a86))[_0x6f00('0x40')](handleError(_0x2671fe,null));};exports[_0x6f00('0x41')]=function(_0x56399a,_0x38ee25){var _0x4523f2={'raw':!![],'where':{'id':_0x56399a[_0x6f00('0x42')]['id']}},_0x2bb5aa={};_0x2bb5aa[_0x6f00('0x30')]=_[_0x6f00('0x2d')](db['Cdr'][_0x6f00('0x2b')]);_0x2bb5aa[_0x6f00('0x31')]=_[_0x6f00('0x2d')](_0x56399a[_0x6f00('0x31')]);_0x2bb5aa[_0x6f00('0x2e')]=_[_0x6f00('0x2f')](_0x2bb5aa['model'],_0x2bb5aa[_0x6f00('0x31')]);_0x4523f2[_0x6f00('0x32')]=_[_0x6f00('0x2f')](_0x2bb5aa['model'],qs[_0x6f00('0x33')](_0x56399a['query'][_0x6f00('0x33')]));_0x4523f2[_0x6f00('0x32')]=_0x4523f2['attributes'][_0x6f00('0x43')]?_0x4523f2['attributes']:_0x2bb5aa[_0x6f00('0x30')];if(_0x56399a[_0x6f00('0x31')][_0x6f00('0x3c')]){_0x4523f2[_0x6f00('0x3d')]=[{'all':!![]}];}_0x4523f2=_['merge']({},_0x4523f2,_0x56399a[_0x6f00('0x44')]);return db['Cdr'][_0x6f00('0x45')](_0x4523f2)['then'](handleEntityNotFound(_0x38ee25,null))[_0x6f00('0x23')](respondWithResult(_0x38ee25,null))[_0x6f00('0x40')](handleError(_0x38ee25,null));};exports[_0x6f00('0x46')]=function(_0x9b003,_0x470ff3){return db[_0x6f00('0x2a')][_0x6f00('0x46')](_0x9b003[_0x6f00('0x47')],{})['then'](respondWithResult(_0x470ff3,0xc9))[_0x6f00('0x40')](handleError(_0x470ff3,null));};exports['update']=function(_0x265666,_0x31fb17){if(_0x265666[_0x6f00('0x47')]['id']){delete _0x265666['body']['id'];}return db['Cdr'][_0x6f00('0x45')]({'where':{'id':_0x265666[_0x6f00('0x42')]['id']}})['then'](handleEntityNotFound(_0x31fb17,null))[_0x6f00('0x23')](saveUpdates(_0x265666['body'],null))[_0x6f00('0x23')](respondWithResult(_0x31fb17,null))['catch'](handleError(_0x31fb17,null));};exports[_0x6f00('0x48')]=function(_0x222b4c,_0x4c6e06){return db['Cdr'][_0x6f00('0x45')]({'where':{'id':_0x222b4c[_0x6f00('0x42')]['id']}})['then'](handleEntityNotFound(_0x4c6e06,null))[_0x6f00('0x23')](removeEntity(_0x4c6e06,null))['catch'](handleError(_0x4c6e06,null));};exports[_0x6f00('0x49')]=function(_0x7f80ed,_0x3100ee){return db[_0x6f00('0x2a')][_0x6f00('0x49')]()[_0x6f00('0x23')](respondWithResult(_0x3100ee,null))[_0x6f00('0x40')](handleError(_0x3100ee,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 436ec62..fa45554 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(_0x3f5262,_0x1ad642){var _0x113366=function(_0x3facd9){while(--_0x3facd9){_0x3f5262['push'](_0x3f5262['shift']());}};_0x113366(++_0x1ad642);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x51ebc4,_0x2a4d0e){var _0x4dba4d=function(_0x54daaa){while(--_0x54daaa){_0x51ebc4['push'](_0x51ebc4['shift']());}};_0x4dba4d(++_0x2a4d0e);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 559c5c3..6487303 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 _0xf28f=['util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','info','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','Cdr,\x20%s,\x20%s','message','result','lodash'];(function(_0x2d8fbf,_0x319810){var _0x46bd15=function(_0x44b807){while(--_0x44b807){_0x2d8fbf['push'](_0x2d8fbf['shift']());}};_0x46bd15(++_0x319810);}(_0xf28f,0x92));var _0xff28=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xf28f[_0x484e36];return _0xafc85d;};'use strict';var _=require(_0xff28('0x0'));var util=require(_0xff28('0x1'));var moment=require(_0xff28('0x2'));var BPromise=require(_0xff28('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xff28('0x4'));var db=require(_0xff28('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xff28('0x6'))(_0xff28('0x7'));var config=require(_0xff28('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xff28('0x9')][_0xff28('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57a365,_0xd55879,_0x6ba9c5){return new BPromise(function(_0xef5d83,_0x27c1a6){return client[_0xff28('0xb')](_0x57a365,_0x6ba9c5)['then'](function(_0x452cd8){logger[_0xff28('0xc')]('Cdr,\x20%s,\x20%s',_0xd55879,_0xff28('0xd'));logger['debug'](_0xff28('0xe'),_0xd55879,_0xff28('0xd'),JSON[_0xff28('0xf')](_0x452cd8));if(_0x452cd8[_0xff28('0x10')]){if(_0x452cd8[_0xff28('0x10')][_0xff28('0x11')]===0x1f4){logger[_0xff28('0x10')](_0xff28('0x12'),_0xd55879,_0x452cd8[_0xff28('0x10')][_0xff28('0x13')]);return _0x27c1a6(_0x452cd8[_0xff28('0x10')]['message']);}logger[_0xff28('0x10')](_0xff28('0x12'),_0xd55879,_0x452cd8[_0xff28('0x10')][_0xff28('0x13')]);return _0xef5d83(_0x452cd8[_0xff28('0x10')][_0xff28('0x13')]);}else{logger[_0xff28('0xc')](_0xff28('0x12'),_0xd55879,_0xff28('0xd'));_0xef5d83(_0x452cd8[_0xff28('0x14')][_0xff28('0x13')]);}})['catch'](function(_0x3c302e){logger[_0xff28('0x10')](_0xff28('0x12'),_0xd55879,_0x3c302e);_0x27c1a6(_0x3c302e);});});} \ No newline at end of file +var _0x62b9=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','request','then','info','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','error','code','message','Cdr,\x20%s,\x20%s','result','catch','util','bluebird'];(function(_0x200e46,_0x5acacf){var _0x18467d=function(_0x30e26a){while(--_0x30e26a){_0x200e46['push'](_0x200e46['shift']());}};_0x18467d(++_0x5acacf);}(_0x62b9,0xa9));var _0x962b=function(_0xf0b34,_0x1dd2da){_0xf0b34=_0xf0b34-0x0;var _0x35e678=_0x62b9[_0xf0b34];return _0x35e678;};'use strict';var _=require('lodash');var util=require(_0x962b('0x0'));var moment=require('moment');var BPromise=require(_0x962b('0x1'));var rs=require(_0x962b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x962b('0x3'))['db'];var utils=require(_0x962b('0x4'));var logger=require(_0x962b('0x5'))(_0x962b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x46d6c7,_0x46d1d4,_0xd40ced){return new BPromise(function(_0x458254,_0x5be397){return client[_0x962b('0x7')](_0x46d6c7,_0xd40ced)[_0x962b('0x8')](function(_0x1e8c4e){logger[_0x962b('0x9')]('Cdr,\x20%s,\x20%s',_0x46d1d4,_0x962b('0xa'));logger[_0x962b('0xb')](_0x962b('0xc'),_0x46d1d4,_0x962b('0xa'),JSON['stringify'](_0x1e8c4e));if(_0x1e8c4e[_0x962b('0xd')]){if(_0x1e8c4e[_0x962b('0xd')][_0x962b('0xe')]===0x1f4){logger[_0x962b('0xd')]('Cdr,\x20%s,\x20%s',_0x46d1d4,_0x1e8c4e[_0x962b('0xd')]['message']);return _0x5be397(_0x1e8c4e[_0x962b('0xd')][_0x962b('0xf')]);}logger[_0x962b('0xd')](_0x962b('0x10'),_0x46d1d4,_0x1e8c4e[_0x962b('0xd')][_0x962b('0xf')]);return _0x458254(_0x1e8c4e[_0x962b('0xd')][_0x962b('0xf')]);}else{logger[_0x962b('0x9')]('Cdr,\x20%s,\x20%s',_0x46d1d4,_0x962b('0xa'));_0x458254(_0x1e8c4e[_0x962b('0x11')][_0x962b('0xf')]);}})[_0x962b('0x12')](function(_0x28c7bf){logger[_0x962b('0xd')]('Cdr,\x20%s,\x20%s',_0x46d1d4,_0x28c7bf);_0x5be397(_0x28c7bf);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index aa44268..e1cc707 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0x504df1,_0x289598){var _0x1063b5=function(_0x627abd){while(--_0x627abd){_0x504df1['push'](_0x504df1['shift']());}};_0x1063b5(++_0x289598);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file +var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0x548627,_0x4ec392){var _0x844a84=function(_0x2ffdd2){while(--_0x2ffdd2){_0x548627['push'](_0x548627['shift']());}};_0x844a84(++_0x4ec392);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 077ddc8..a79b988 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 _0xee19=['sequelize','exports','noop','TEXT','STRING'];(function(_0x857c02,_0x3cc0b3){var _0x5bbbab=function(_0x4c7733){while(--_0x4c7733){_0x857c02['push'](_0x857c02['shift']());}};_0x5bbbab(++_0x3cc0b3);}(_0xee19,0x131));var _0x9ee1=function(_0x41bc59,_0x770db7){_0x41bc59=_0x41bc59-0x0;var _0x278319=_0xee19[_0x41bc59];return _0x278319;};'use strict';var Sequelize=require(_0x9ee1('0x0'));module[_0x9ee1('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9ee1('0x2')},'appdata':{'type':Sequelize[_0x9ee1('0x3')]()},'description':{'type':Sequelize[_0x9ee1('0x4')]},'interval':{'type':Sequelize[_0x9ee1('0x4')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xf0e4=['STRING','noop','TEXT','sequelize','exports','INTEGER'];(function(_0x1fe7fe,_0x41cc8a){var _0x119376=function(_0x4e66d9){while(--_0x4e66d9){_0x1fe7fe['push'](_0x1fe7fe['shift']());}};_0x119376(++_0x41cc8a);}(_0xf0e4,0xb1));var _0x4f0e=function(_0x16268d,_0x340078){_0x16268d=_0x16268d-0x0;var _0x36799c=_0xf0e4[_0x16268d];return _0x36799c;};'use strict';var Sequelize=require(_0x4f0e('0x0'));module[_0x4f0e('0x1')]={'priority':{'type':Sequelize[_0x4f0e('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x4f0e('0x3')],'allowNull':![],'defaultValue':_0x4f0e('0x4')},'appdata':{'type':Sequelize[_0x4f0e('0x5')]()},'description':{'type':Sequelize[_0x4f0e('0x3')]},'interval':{'type':Sequelize[_0x4f0e('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index d9ff54b..f812e2f 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 _0x235a=['offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','show','ChatApplication','rawAttributes','query','keys','filters','intersection','attributes','fields','length','model','includeAll','merge','options','find','catch','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x235a,0x1ef));var _0xa235=function(_0x448391,_0x500aa6){_0x448391=_0x448391-0x0;var _0x8f3854=_0x235a[_0x448391];return _0x8f3854;};'use strict';var emlformat=require(_0xa235('0x0'));var rimraf=require(_0xa235('0x1'));var zipdir=require(_0xa235('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa235('0x3'));var moment=require('moment');var BPromise=require(_0xa235('0x4'));var Mustache=require(_0xa235('0x5'));var util=require(_0xa235('0x6'));var path=require(_0xa235('0x7'));var sox=require(_0xa235('0x8'));var csv=require(_0xa235('0x9'));var ejs=require(_0xa235('0xa'));var fs=require('fs');var fs_extra=require(_0xa235('0xb'));var _=require('lodash');var squel=require(_0xa235('0xc'));var crypto=require(_0xa235('0xd'));var jsforce=require(_0xa235('0xe'));var deskjs=require(_0xa235('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa235('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa235('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa235('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xa235('0x13'));var config=require(_0xa235('0x14'));var licenseUtil=require(_0xa235('0x15'));var db=require(_0xa235('0x16'))['db'];function respondWithStatusCode(_0x5330db,_0x5510ff){_0x5510ff=_0x5510ff||0xcc;return function(_0x47aad7){if(_0x47aad7){return _0x5330db[_0xa235('0x17')](_0x5510ff);}return _0x5330db[_0xa235('0x18')](_0x5510ff)[_0xa235('0x19')]();};}function respondWithResult(_0x3bf6fc,_0x36b4b1){_0x36b4b1=_0x36b4b1||0xc8;return function(_0x44ea6a){if(_0x44ea6a){return _0x3bf6fc[_0xa235('0x18')](_0x36b4b1)[_0xa235('0x1a')](_0x44ea6a);}};}function respondWithFilteredResult(_0x1369de,_0x4aceee){return function(_0x352463){if(_0x352463){var _0x20cd67=typeof _0x4aceee[_0xa235('0x1b')]===_0xa235('0x1c')&&typeof _0x4aceee[_0xa235('0x1d')]===_0xa235('0x1c');var _0x5c6e95=_0x352463['count'];var _0x446ea2=_0x20cd67?0x0:_0x4aceee[_0xa235('0x1b')];var _0x2b3769=_0x20cd67?_0x352463['count']:_0x4aceee[_0xa235('0x1b')]+_0x4aceee[_0xa235('0x1d')];var _0x3ca514;if(_0x2b3769>=_0x5c6e95){_0x2b3769=_0x5c6e95;_0x3ca514=0xc8;}else{_0x3ca514=0xce;}_0x1369de[_0xa235('0x18')](_0x3ca514);return _0x1369de[_0xa235('0x1e')](_0xa235('0x1f'),_0x446ea2+'-'+_0x2b3769+'/'+_0x5c6e95)[_0xa235('0x1a')](_0x352463);}return null;};}function patchUpdates(_0x483771){return function(_0x5a3bea){try{jsonpatch[_0xa235('0x20')](_0x5a3bea,_0x483771,!![]);}catch(_0x21940f){return BPromise[_0xa235('0x21')](_0x21940f);}return _0x5a3bea[_0xa235('0x22')]();};}function saveUpdates(_0x2e38e,_0x3deeea){return function(_0x3d9f70){if(_0x3d9f70){return _0x3d9f70[_0xa235('0x23')](_0x2e38e)[_0xa235('0x24')](function(_0x216083){return _0x216083;});}return null;};}function removeEntity(_0x3219f1,_0x20292c){return function(_0xee45e1){if(_0xee45e1){return _0xee45e1[_0xa235('0x25')]()[_0xa235('0x24')](function(){_0x3219f1[_0xa235('0x18')](0xcc)[_0xa235('0x19')]();});}};}function handleEntityNotFound(_0x13c868,_0x976c9f){return function(_0x1cb892){if(!_0x1cb892){_0x13c868[_0xa235('0x17')](0x194);}return _0x1cb892;};}function handleError(_0x57f591,_0xe1176c){_0xe1176c=_0xe1176c||0x1f4;return function(_0x533b15){logger[_0xa235('0x26')](_0x533b15['stack']);if(_0x533b15[_0xa235('0x27')]){delete _0x533b15[_0xa235('0x27')];}_0x57f591[_0xa235('0x18')](_0xe1176c)[_0xa235('0x28')](_0x533b15);};}exports[_0xa235('0x29')]=function(_0x5d811a,_0x2585c7){var _0x612f2={'raw':!![],'where':{'id':_0x5d811a['params']['id']}},_0x55a21e={};_0x55a21e['model']=_['keys'](db[_0xa235('0x2a')][_0xa235('0x2b')]);_0x55a21e[_0xa235('0x2c')]=_[_0xa235('0x2d')](_0x5d811a[_0xa235('0x2c')]);_0x55a21e[_0xa235('0x2e')]=_[_0xa235('0x2f')](_0x55a21e['model'],_0x55a21e['query']);_0x612f2[_0xa235('0x30')]=_[_0xa235('0x2f')](_0x55a21e['model'],qs[_0xa235('0x31')](_0x5d811a[_0xa235('0x2c')][_0xa235('0x31')]));_0x612f2[_0xa235('0x30')]=_0x612f2[_0xa235('0x30')][_0xa235('0x32')]?_0x612f2[_0xa235('0x30')]:_0x55a21e[_0xa235('0x33')];if(_0x5d811a['query'][_0xa235('0x34')]){_0x612f2['include']=[{'all':!![]}];}_0x612f2=_[_0xa235('0x35')]({},_0x612f2,_0x5d811a[_0xa235('0x36')]);return db[_0xa235('0x2a')][_0xa235('0x37')](_0x612f2)[_0xa235('0x24')](handleEntityNotFound(_0x2585c7,null))[_0xa235('0x24')](respondWithResult(_0x2585c7,null))[_0xa235('0x38')](handleError(_0x2585c7,null));};exports[_0xa235('0x23')]=function(_0xa1b9d2,_0x34bba1){if(_0xa1b9d2[_0xa235('0x39')]['id']){delete _0xa1b9d2[_0xa235('0x39')]['id'];}return db[_0xa235('0x2a')]['find']({'where':{'id':_0xa1b9d2['params']['id']}})['then'](handleEntityNotFound(_0x34bba1,null))[_0xa235('0x24')](saveUpdates(_0xa1b9d2['body'],null))[_0xa235('0x24')](respondWithResult(_0x34bba1,null))[_0xa235('0x38')](handleError(_0x34bba1,null));};exports[_0xa235('0x25')]=function(_0x21a835,_0x473af7){return db[_0xa235('0x2a')][_0xa235('0x37')]({'where':{'id':_0x21a835['params']['id']}})[_0xa235('0x24')](handleEntityNotFound(_0x473af7,null))[_0xa235('0x24')](removeEntity(_0x473af7,null))['catch'](handleError(_0x473af7,null));}; \ No newline at end of file +var _0xe3ed=['Content-Range','apply','reject','save','then','destroy','error','stack','name','params','model','rawAttributes','query','filters','intersection','attributes','fields','length','include','merge','options','ChatApplication','find','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','set'];(function(_0x36c28f,_0x331ff7){var _0x1cda15=function(_0x4a2ff5){while(--_0x4a2ff5){_0x36c28f['push'](_0x36c28f['shift']());}};_0x1cda15(++_0x331ff7);}(_0xe3ed,0x8d));var _0xde3e=function(_0x532880,_0xaf724d){_0x532880=_0x532880-0x0;var _0x418bbe=_0xe3ed[_0x532880];return _0x418bbe;};'use strict';var emlformat=require(_0xde3e('0x0'));var rimraf=require(_0xde3e('0x1'));var zipdir=require(_0xde3e('0x2'));var jsonpatch=require(_0xde3e('0x3'));var rp=require(_0xde3e('0x4'));var moment=require(_0xde3e('0x5'));var BPromise=require(_0xde3e('0x6'));var Mustache=require(_0xde3e('0x7'));var util=require('util');var path=require(_0xde3e('0x8'));var sox=require(_0xde3e('0x9'));var csv=require('to-csv');var ejs=require(_0xde3e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xde3e('0xb'));var squel=require(_0xde3e('0xc'));var crypto=require('crypto');var jsforce=require(_0xde3e('0xd'));var deskjs=require(_0xde3e('0xe'));var toCsv=require(_0xde3e('0xf'));var querystring=require(_0xde3e('0x10'));var Papa=require(_0xde3e('0x11'));var Redis=require('ioredis');var authService=require(_0xde3e('0x12'));var qs=require(_0xde3e('0x13'));var as=require(_0xde3e('0x14'));var hardwareService=require(_0xde3e('0x15'));var logger=require('../../config/logger')(_0xde3e('0x16'));var utils=require(_0xde3e('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xde3e('0x18'));var db=require(_0xde3e('0x19'))['db'];function respondWithStatusCode(_0x5d0240,_0x22ffc2){_0x22ffc2=_0x22ffc2||0xcc;return function(_0x4e0f23){if(_0x4e0f23){return _0x5d0240[_0xde3e('0x1a')](_0x22ffc2);}return _0x5d0240[_0xde3e('0x1b')](_0x22ffc2)[_0xde3e('0x1c')]();};}function respondWithResult(_0x4fe882,_0x167fa7){_0x167fa7=_0x167fa7||0xc8;return function(_0x1fee7b){if(_0x1fee7b){return _0x4fe882['status'](_0x167fa7)['json'](_0x1fee7b);}};}function respondWithFilteredResult(_0x120077,_0x11db96){return function(_0x6543f7){if(_0x6543f7){var _0x552fc4=typeof _0x11db96['offset']===_0xde3e('0x1d')&&typeof _0x11db96['limit']==='undefined';var _0xc3ee05=_0x6543f7[_0xde3e('0x1e')];var _0x4aa02c=_0x552fc4?0x0:_0x11db96[_0xde3e('0x1f')];var _0x276e83=_0x552fc4?_0x6543f7[_0xde3e('0x1e')]:_0x11db96['offset']+_0x11db96['limit'];var _0x4fa0d2;if(_0x276e83>=_0xc3ee05){_0x276e83=_0xc3ee05;_0x4fa0d2=0xc8;}else{_0x4fa0d2=0xce;}_0x120077[_0xde3e('0x1b')](_0x4fa0d2);return _0x120077[_0xde3e('0x20')](_0xde3e('0x21'),_0x4aa02c+'-'+_0x276e83+'/'+_0xc3ee05)['json'](_0x6543f7);}return null;};}function patchUpdates(_0x2ceb3e){return function(_0x11dd22){try{jsonpatch[_0xde3e('0x22')](_0x11dd22,_0x2ceb3e,!![]);}catch(_0x8c8ace){return BPromise[_0xde3e('0x23')](_0x8c8ace);}return _0x11dd22[_0xde3e('0x24')]();};}function saveUpdates(_0x26c5ca,_0x1eda88){return function(_0x443e8d){if(_0x443e8d){return _0x443e8d['update'](_0x26c5ca)[_0xde3e('0x25')](function(_0x334093){return _0x334093;});}return null;};}function removeEntity(_0x37615f,_0x57df9e){return function(_0x361511){if(_0x361511){return _0x361511[_0xde3e('0x26')]()[_0xde3e('0x25')](function(){_0x37615f['status'](0xcc)[_0xde3e('0x1c')]();});}};}function handleEntityNotFound(_0x78647,_0x1d9432){return function(_0xd795ac){if(!_0xd795ac){_0x78647[_0xde3e('0x1a')](0x194);}return _0xd795ac;};}function handleError(_0x5ec4b6,_0x5313cb){_0x5313cb=_0x5313cb||0x1f4;return function(_0x6c0db0){logger[_0xde3e('0x27')](_0x6c0db0[_0xde3e('0x28')]);if(_0x6c0db0['name']){delete _0x6c0db0[_0xde3e('0x29')];}_0x5ec4b6[_0xde3e('0x1b')](_0x5313cb)['send'](_0x6c0db0);};}exports['show']=function(_0x245fbc,_0x3c83c8){var _0x582c8d={'raw':!![],'where':{'id':_0x245fbc[_0xde3e('0x2a')]['id']}},_0x2e4c62={};_0x2e4c62[_0xde3e('0x2b')]=_['keys'](db['ChatApplication'][_0xde3e('0x2c')]);_0x2e4c62['query']=_['keys'](_0x245fbc[_0xde3e('0x2d')]);_0x2e4c62[_0xde3e('0x2e')]=_[_0xde3e('0x2f')](_0x2e4c62[_0xde3e('0x2b')],_0x2e4c62[_0xde3e('0x2d')]);_0x582c8d[_0xde3e('0x30')]=_[_0xde3e('0x2f')](_0x2e4c62[_0xde3e('0x2b')],qs[_0xde3e('0x31')](_0x245fbc[_0xde3e('0x2d')][_0xde3e('0x31')]));_0x582c8d[_0xde3e('0x30')]=_0x582c8d[_0xde3e('0x30')][_0xde3e('0x32')]?_0x582c8d[_0xde3e('0x30')]:_0x2e4c62[_0xde3e('0x2b')];if(_0x245fbc[_0xde3e('0x2d')]['includeAll']){_0x582c8d[_0xde3e('0x33')]=[{'all':!![]}];}_0x582c8d=_[_0xde3e('0x34')]({},_0x582c8d,_0x245fbc[_0xde3e('0x35')]);return db[_0xde3e('0x36')][_0xde3e('0x37')](_0x582c8d)[_0xde3e('0x25')](handleEntityNotFound(_0x3c83c8,null))[_0xde3e('0x25')](respondWithResult(_0x3c83c8,null))[_0xde3e('0x38')](handleError(_0x3c83c8,null));};exports['update']=function(_0x50f1e3,_0x47793d){if(_0x50f1e3['body']['id']){delete _0x50f1e3['body']['id'];}return db[_0xde3e('0x36')][_0xde3e('0x37')]({'where':{'id':_0x50f1e3[_0xde3e('0x2a')]['id']}})[_0xde3e('0x25')](handleEntityNotFound(_0x47793d,null))[_0xde3e('0x25')](saveUpdates(_0x50f1e3[_0xde3e('0x39')],null))['then'](respondWithResult(_0x47793d,null))['catch'](handleError(_0x47793d,null));};exports[_0xde3e('0x26')]=function(_0x24adee,_0x1ade0c){return db[_0xde3e('0x36')][_0xde3e('0x37')]({'where':{'id':_0x24adee[_0xde3e('0x2a')]['id']}})['then'](handleEntityNotFound(_0x1ade0c,null))[_0xde3e('0x25')](removeEntity(_0x1ade0c,null))['catch'](handleError(_0x1ade0c,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index a8fd45f..e56b5bd 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 _0x5e93=['request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','exports','define','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4a2266,_0x53e92f){var _0x1d7b9f=function(_0x3dafff){while(--_0x3dafff){_0x4a2266['push'](_0x4a2266['shift']());}};_0x1d7b9f(++_0x53e92f);}(_0x5e93,0x174));var _0x35e9=function(_0x5b560a,_0x47d8a7){_0x5b560a=_0x5b560a-0x0;var _0x3cc47d=_0x5e93[_0x5b560a];return _0x3cc47d;};'use strict';var _=require(_0x35e9('0x0'));var util=require(_0x35e9('0x1'));var logger=require(_0x35e9('0x2'))(_0x35e9('0x3'));var moment=require(_0x35e9('0x4'));var BPromise=require(_0x35e9('0x5'));var rp=require(_0x35e9('0x6'));var fs=require('fs');var path=require(_0x35e9('0x7'));var rimraf=require(_0x35e9('0x8'));var config=require(_0x35e9('0x9'));var attributes=require(_0x35e9('0xa'));module[_0x35e9('0xb')]=function(_0x47d2a8,_0x115d4c){return _0x47d2a8[_0x35e9('0xc')]('ChatApplication',attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x35e9('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x4f88=['chat_applications','lodash','util','api','moment','bluebird','rimraf','../../config/environment','./chatApplication.attributes','exports','ChatApplication'];(function(_0x1a7536,_0x30c791){var _0x4660d9=function(_0x1db222){while(--_0x1db222){_0x1a7536['push'](_0x1a7536['shift']());}};_0x4660d9(++_0x30c791);}(_0x4f88,0xf3));var _0x84f8=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0x4f88[_0xbf8ebe];return _0x1e25e8;};'use strict';var _=require(_0x84f8('0x0'));var util=require(_0x84f8('0x1'));var logger=require('../../config/logger')(_0x84f8('0x2'));var moment=require(_0x84f8('0x3'));var BPromise=require(_0x84f8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x84f8('0x5'));var config=require(_0x84f8('0x6'));var attributes=require(_0x84f8('0x7'));module[_0x84f8('0x8')]=function(_0x79dcec,_0x1ac0c8){return _0x79dcec['define'](_0x84f8('0x9'),attributes,{'tableName':_0x84f8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index b2d7e17..fb497d6 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 _0x7c21=['catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','error','ChatApplication,\x20%s,\x20%s','message','info'];(function(_0x6f77d6,_0x32ddb6){var _0x454143=function(_0x1bbb3b){while(--_0x1bbb3b){_0x6f77d6['push'](_0x6f77d6['shift']());}};_0x454143(++_0x32ddb6);}(_0x7c21,0x141));var _0x17c2=function(_0x5bd696,_0x32ab61){_0x5bd696=_0x5bd696-0x0;var _0x5d6af7=_0x7c21[_0x5bd696];return _0x5d6af7;};'use strict';var _=require(_0x17c2('0x0'));var util=require(_0x17c2('0x1'));var moment=require('moment');var BPromise=require(_0x17c2('0x2'));var rs=require(_0x17c2('0x3'));var fs=require('fs');var Redis=require(_0x17c2('0x4'));var db=require(_0x17c2('0x5'))['db'];var utils=require(_0x17c2('0x6'));var logger=require('../../config/logger')(_0x17c2('0x7'));var config=require(_0x17c2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x17c2('0x9')][_0x17c2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x104969,_0x107f61,_0x3869a0){return new BPromise(function(_0x3433d4,_0x76b2de){return client[_0x17c2('0xb')](_0x104969,_0x3869a0)['then'](function(_0x15d882){logger['info']('ChatApplication,\x20%s,\x20%s',_0x107f61,_0x17c2('0xc'));logger[_0x17c2('0xd')](_0x17c2('0xe'),_0x107f61,'request\x20sent',JSON['stringify'](_0x15d882));if(_0x15d882[_0x17c2('0xf')]){if(_0x15d882[_0x17c2('0xf')]['code']===0x1f4){logger[_0x17c2('0xf')](_0x17c2('0x10'),_0x107f61,_0x15d882[_0x17c2('0xf')][_0x17c2('0x11')]);return _0x76b2de(_0x15d882[_0x17c2('0xf')][_0x17c2('0x11')]);}logger['error'](_0x17c2('0x10'),_0x107f61,_0x15d882[_0x17c2('0xf')]['message']);return _0x3433d4(_0x15d882[_0x17c2('0xf')][_0x17c2('0x11')]);}else{logger[_0x17c2('0x12')](_0x17c2('0x10'),_0x107f61,_0x17c2('0xc'));_0x3433d4(_0x15d882['result'][_0x17c2('0x11')]);}})[_0x17c2('0x13')](function(_0x477673){logger['error'](_0x17c2('0x10'),_0x107f61,_0x477673);_0x76b2de(_0x477673);});});} \ No newline at end of file +var _0xed1d=['info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0xed1d,0x127));var _0xded1=function(_0x3cf76d,_0xb29031){_0x3cf76d=_0x3cf76d-0x0;var _0xb2c522=_0xed1d[_0x3cf76d];return _0xb2c522;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xded1('0x0'));var BPromise=require(_0xded1('0x1'));var rs=require(_0xded1('0x2'));var fs=require('fs');var Redis=require(_0xded1('0x3'));var db=require(_0xded1('0x4'))['db'];var utils=require(_0xded1('0x5'));var logger=require(_0xded1('0x6'))(_0xded1('0x7'));var config=require(_0xded1('0x8'));var jayson=require(_0xded1('0x9'));var client=jayson[_0xded1('0xa')][_0xded1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f79d4,_0x5a4dc6,_0x1aee31){return new BPromise(function(_0x37d971,_0x51febd){return client[_0xded1('0xc')](_0x1f79d4,_0x1aee31)['then'](function(_0x13d98f){logger[_0xded1('0xd')](_0xded1('0xe'),_0x5a4dc6,_0xded1('0xf'));logger[_0xded1('0x10')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x5a4dc6,_0xded1('0xf'),JSON[_0xded1('0x11')](_0x13d98f));if(_0x13d98f[_0xded1('0x12')]){if(_0x13d98f[_0xded1('0x12')][_0xded1('0x13')]===0x1f4){logger[_0xded1('0x12')](_0xded1('0xe'),_0x5a4dc6,_0x13d98f[_0xded1('0x12')][_0xded1('0x14')]);return _0x51febd(_0x13d98f[_0xded1('0x12')][_0xded1('0x14')]);}logger[_0xded1('0x12')](_0xded1('0xe'),_0x5a4dc6,_0x13d98f[_0xded1('0x12')][_0xded1('0x14')]);return _0x37d971(_0x13d98f[_0xded1('0x12')][_0xded1('0x14')]);}else{logger['info'](_0xded1('0xe'),_0x5a4dc6,'request\x20sent');_0x37d971(_0x13d98f['result'][_0xded1('0x14')]);}})[_0xded1('0x15')](function(_0x556c5e){logger[_0xded1('0x12')]('ChatApplication,\x20%s,\x20%s',_0x5a4dc6,_0x556c5e);_0x51febd(_0x556c5e);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 195dbe3..3adfa67 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 _0xb985=['multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','update','exports'];(function(_0x52fdcd,_0x15cddd){var _0x110eab=function(_0x325338){while(--_0x325338){_0x52fdcd['push'](_0x52fdcd['shift']());}};_0x110eab(++_0x15cddd);}(_0xb985,0x142));var _0x5b98=function(_0x4e2148,_0x382a2c){_0x4e2148=_0x4e2148-0x0;var _0x323345=_0xb985[_0x4e2148];return _0x323345;};'use strict';var multer=require(_0x5b98('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5b98('0x1'));var express=require(_0x5b98('0x2'));var router=express[_0x5b98('0x3')]();var fs_extra=require(_0x5b98('0x4'));var auth=require(_0x5b98('0x5'));var interaction=require(_0x5b98('0x6'));var config=require(_0x5b98('0x7'));var controller=require(_0x5b98('0x8'));router[_0x5b98('0x9')](_0x5b98('0xa'),auth[_0x5b98('0xb')](),controller['show']);router['put']('/:id',auth[_0x5b98('0xb')](),controller[_0x5b98('0xc')]);router['delete'](_0x5b98('0xa'),auth[_0x5b98('0xb')](),controller['destroy']);module[_0x5b98('0xd')]=router; \ No newline at end of file +var _0x665f=['show','put','delete','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./chatApplication.controller','get','/:id','isAuthenticated'];(function(_0x572a16,_0x4d5089){var _0x4a0803=function(_0x55b517){while(--_0x55b517){_0x572a16['push'](_0x572a16['shift']());}};_0x4a0803(++_0x4d5089);}(_0x665f,0x1c4));var _0xf665=function(_0xb74774,_0x33681d){_0xb74774=_0xb74774-0x0;var _0x57e076=_0x665f[_0xb74774];return _0x57e076;};'use strict';var multer=require('multer');var util=require(_0xf665('0x0'));var path=require(_0xf665('0x1'));var timeout=require(_0xf665('0x2'));var express=require(_0xf665('0x3'));var router=express['Router']();var fs_extra=require(_0xf665('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf665('0x5'));var config=require('../../config/environment');var controller=require(_0xf665('0x6'));router[_0xf665('0x7')](_0xf665('0x8'),auth[_0xf665('0x9')](),controller[_0xf665('0xa')]);router[_0xf665('0xb')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xf665('0xc')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xf665('0xd')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 1d32305..b157cee 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 _0x4d0a=['STRING','BOOLEAN','sequelize','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4d0a,0x176));var _0xa4d0=function(_0xe37698,_0x19fa57){_0xe37698=_0xe37698-0x0;var _0xdb2276=_0x4d0a[_0xe37698];return _0xdb2276;};'use strict';var Sequelize=require(_0xa4d0('0x0'));module[_0xa4d0('0x1')]={'name':{'type':Sequelize[_0xa4d0('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0xa4d0('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x02bd=['sequelize','exports','STRING'];(function(_0x3be174,_0x393350){var _0x5ec09c=function(_0x28a9aa){while(--_0x28a9aa){_0x3be174['push'](_0x3be174['shift']());}};_0x5ec09c(++_0x393350);}(_0x02bd,0x6c));var _0xd02b=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x02bd[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0xd02b('0x0'));module[_0xd02b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xd02b('0x2')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 740918e..fd63adc 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 _0x7c16=['nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','then','includeAll','catch','show','include','create','body','find','params','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','findOne','removeMembers','ChatGroupId','getMessages','$gte','split','format','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','status','end','json','offset','limit','undefined','count','set','apply','reject','update','destroy','error','stack','name','send','index','map','ChatGroup','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x593e5c,_0x14f512){var _0x31c87a=function(_0x4820c4){while(--_0x4820c4){_0x593e5c['push'](_0x593e5c['shift']());}};_0x31c87a(++_0x14f512);}(_0x7c16,0x7e));var _0x67c1=function(_0x1298ed,_0x39ba63){_0x1298ed=_0x1298ed-0x0;var _0x56b532=_0x7c16[_0x1298ed];return _0x56b532;};'use strict';var emlformat=require(_0x67c1('0x0'));var rimraf=require(_0x67c1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x67c1('0x2'));var rp=require(_0x67c1('0x3'));var moment=require(_0x67c1('0x4'));var BPromise=require(_0x67c1('0x5'));var Mustache=require(_0x67c1('0x6'));var util=require(_0x67c1('0x7'));var path=require('path');var sox=require(_0x67c1('0x8'));var csv=require(_0x67c1('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x67c1('0xa'));var _=require(_0x67c1('0xb'));var squel=require(_0x67c1('0xc'));var crypto=require('crypto');var jsforce=require(_0x67c1('0xd'));var deskjs=require(_0x67c1('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x67c1('0xf'));var Redis=require(_0x67c1('0x10'));var authService=require(_0x67c1('0x11'));var qs=require(_0x67c1('0x12'));var as=require(_0x67c1('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x67c1('0x14'));var utils=require(_0x67c1('0x15'));var config=require(_0x67c1('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x67c1('0x17'))['db'];config[_0x67c1('0x18')]=_[_0x67c1('0x19')](config[_0x67c1('0x18')],{'host':_0x67c1('0x1a'),'port':0x18eb});var socket=require(_0x67c1('0x1b'))(new Redis(config[_0x67c1('0x18')]));require(_0x67c1('0x1c'))['register'](socket);function respondWithStatusCode(_0x1ad911,_0x3e2037){_0x3e2037=_0x3e2037||0xcc;return function(_0x31a60f){if(_0x31a60f){return _0x1ad911['sendStatus'](_0x3e2037);}return _0x1ad911[_0x67c1('0x1d')](_0x3e2037)[_0x67c1('0x1e')]();};}function respondWithResult(_0x30894e,_0x3d5b84){_0x3d5b84=_0x3d5b84||0xc8;return function(_0xf4fb80){if(_0xf4fb80){return _0x30894e[_0x67c1('0x1d')](_0x3d5b84)[_0x67c1('0x1f')](_0xf4fb80);}};}function respondWithFilteredResult(_0x50520d,_0x44819c){return function(_0x5c9b99){if(_0x5c9b99){var _0xd1d412=typeof _0x44819c[_0x67c1('0x20')]==='undefined'&&typeof _0x44819c[_0x67c1('0x21')]===_0x67c1('0x22');var _0x4941a1=_0x5c9b99[_0x67c1('0x23')];var _0x16132e=_0xd1d412?0x0:_0x44819c[_0x67c1('0x20')];var _0x31b457=_0xd1d412?_0x5c9b99[_0x67c1('0x23')]:_0x44819c[_0x67c1('0x20')]+_0x44819c['limit'];var _0x1683bc;if(_0x31b457>=_0x4941a1){_0x31b457=_0x4941a1;_0x1683bc=0xc8;}else{_0x1683bc=0xce;}_0x50520d[_0x67c1('0x1d')](_0x1683bc);return _0x50520d[_0x67c1('0x24')]('Content-Range',_0x16132e+'-'+_0x31b457+'/'+_0x4941a1)[_0x67c1('0x1f')](_0x5c9b99);}return null;};}function patchUpdates(_0x350b3c){return function(_0x302ffc){try{jsonpatch[_0x67c1('0x25')](_0x302ffc,_0x350b3c,!![]);}catch(_0x467b39){return BPromise[_0x67c1('0x26')](_0x467b39);}return _0x302ffc['save']();};}function saveUpdates(_0xb8323f,_0x416f3f){return function(_0x3efbbe){if(_0x3efbbe){return _0x3efbbe[_0x67c1('0x27')](_0xb8323f)['then'](function(_0x38982a){return _0x38982a;});}return null;};}function removeEntity(_0x3c356a,_0x2e9f31){return function(_0x474c6f){if(_0x474c6f){return _0x474c6f[_0x67c1('0x28')]()['then'](function(){_0x3c356a[_0x67c1('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a02e6,_0xb1a62d){return function(_0x4734a4){if(!_0x4734a4){_0x3a02e6['sendStatus'](0x194);}return _0x4734a4;};}function handleError(_0x467565,_0x15afd7){_0x15afd7=_0x15afd7||0x1f4;return function(_0x29280f){logger[_0x67c1('0x29')](_0x29280f[_0x67c1('0x2a')]);if(_0x29280f[_0x67c1('0x2b')]){delete _0x29280f[_0x67c1('0x2b')];}_0x467565[_0x67c1('0x1d')](_0x15afd7)[_0x67c1('0x2c')](_0x29280f);};}exports[_0x67c1('0x2d')]=function(_0x1db4ae,_0x35ef8a){var _0x9642f5={},_0x3e39e0={},_0x39606a={'count':0x0,'rows':[]};var _0x3aa9c5=_[_0x67c1('0x2e')](db[_0x67c1('0x2f')][_0x67c1('0x30')],function(_0x444c49){return{'name':_0x444c49[_0x67c1('0x31')],'type':_0x444c49[_0x67c1('0x32')][_0x67c1('0x33')]};});_0x3e39e0[_0x67c1('0x34')]=_[_0x67c1('0x2e')](_0x3aa9c5,'name');_0x3e39e0['query']=_[_0x67c1('0x35')](_0x1db4ae[_0x67c1('0x36')]);_0x3e39e0['filters']=_[_0x67c1('0x37')](_0x3e39e0['model'],_0x3e39e0[_0x67c1('0x36')]);_0x9642f5['attributes']=_[_0x67c1('0x37')](_0x3e39e0[_0x67c1('0x34')],qs[_0x67c1('0x38')](_0x1db4ae['query'][_0x67c1('0x38')]));_0x9642f5[_0x67c1('0x39')]=_0x9642f5[_0x67c1('0x39')][_0x67c1('0x3a')]?_0x9642f5[_0x67c1('0x39')]:_0x3e39e0[_0x67c1('0x34')];if(!_0x1db4ae[_0x67c1('0x36')][_0x67c1('0x3b')](_0x67c1('0x3c'))){_0x9642f5[_0x67c1('0x21')]=qs[_0x67c1('0x21')](_0x1db4ae['query'][_0x67c1('0x21')]);_0x9642f5[_0x67c1('0x20')]=qs[_0x67c1('0x20')](_0x1db4ae[_0x67c1('0x36')][_0x67c1('0x20')]);}_0x9642f5[_0x67c1('0x3d')]=qs[_0x67c1('0x3e')](_0x1db4ae['query'][_0x67c1('0x3e')]);_0x9642f5[_0x67c1('0x3f')]=qs['filters'](_[_0x67c1('0x40')](_0x1db4ae[_0x67c1('0x36')],_0x3e39e0[_0x67c1('0x41')]),_0x3aa9c5);if(_0x1db4ae[_0x67c1('0x36')][_0x67c1('0x42')]){_0x9642f5[_0x67c1('0x3f')]=_[_0x67c1('0x43')](_0x9642f5[_0x67c1('0x3f')],{'$or':_[_0x67c1('0x2e')](_0x3aa9c5,function(_0x1c42ff){if(_0x1c42ff[_0x67c1('0x32')]!==_0x67c1('0x44')){var _0x2e9641={};_0x2e9641[_0x1c42ff[_0x67c1('0x2b')]]={'$like':'%'+_0x1db4ae[_0x67c1('0x36')]['filter']+'%'};return _0x2e9641;}})});}_0x9642f5=_[_0x67c1('0x43')]({},_0x9642f5,_0x1db4ae[_0x67c1('0x45')]);var _0x59f6e3={'where':_0x9642f5[_0x67c1('0x3f')]};return db[_0x67c1('0x2f')][_0x67c1('0x23')](_0x59f6e3)[_0x67c1('0x46')](function(_0x5725b0){_0x39606a[_0x67c1('0x23')]=_0x5725b0;if(_0x1db4ae[_0x67c1('0x36')][_0x67c1('0x47')]){_0x9642f5['include']=[{'all':!![]}];}return db[_0x67c1('0x2f')]['findAll'](_0x9642f5);})[_0x67c1('0x46')](function(_0x12e873){_0x39606a['rows']=_0x12e873;return _0x39606a;})[_0x67c1('0x46')](respondWithFilteredResult(_0x35ef8a,_0x9642f5))[_0x67c1('0x48')](handleError(_0x35ef8a,null));};exports[_0x67c1('0x49')]=function(_0x502e56,_0x3ecea8){var _0xd5ac0f={'raw':!![],'where':{'id':_0x502e56['params']['id']}},_0x6dcf8={};_0x6dcf8[_0x67c1('0x34')]=_['keys'](db[_0x67c1('0x2f')]['rawAttributes']);_0x6dcf8['query']=_[_0x67c1('0x35')](_0x502e56[_0x67c1('0x36')]);_0x6dcf8[_0x67c1('0x41')]=_[_0x67c1('0x37')](_0x6dcf8[_0x67c1('0x34')],_0x6dcf8[_0x67c1('0x36')]);_0xd5ac0f['attributes']=_[_0x67c1('0x37')](_0x6dcf8[_0x67c1('0x34')],qs[_0x67c1('0x38')](_0x502e56[_0x67c1('0x36')][_0x67c1('0x38')]));_0xd5ac0f[_0x67c1('0x39')]=_0xd5ac0f[_0x67c1('0x39')][_0x67c1('0x3a')]?_0xd5ac0f['attributes']:_0x6dcf8['model'];if(_0x502e56[_0x67c1('0x36')][_0x67c1('0x47')]){_0xd5ac0f[_0x67c1('0x4a')]=[{'all':!![]}];}_0xd5ac0f=_[_0x67c1('0x43')]({},_0xd5ac0f,_0x502e56[_0x67c1('0x45')]);return db[_0x67c1('0x2f')]['find'](_0xd5ac0f)['then'](handleEntityNotFound(_0x3ecea8,null))[_0x67c1('0x46')](respondWithResult(_0x3ecea8,null))['catch'](handleError(_0x3ecea8,null));};exports[_0x67c1('0x4b')]=function(_0x722df3,_0x1ce910){return db[_0x67c1('0x2f')]['create'](_0x722df3[_0x67c1('0x4c')],{})[_0x67c1('0x46')](respondWithResult(_0x1ce910,0xc9))[_0x67c1('0x48')](handleError(_0x1ce910,null));};exports[_0x67c1('0x27')]=function(_0x35109a,_0xeb052c){if(_0x35109a[_0x67c1('0x4c')]['id']){delete _0x35109a['body']['id'];}return db['ChatGroup'][_0x67c1('0x4d')]({'where':{'id':_0x35109a[_0x67c1('0x4e')]['id']}})[_0x67c1('0x46')](handleEntityNotFound(_0xeb052c,null))['then'](saveUpdates(_0x35109a[_0x67c1('0x4c')],null))[_0x67c1('0x46')](respondWithResult(_0xeb052c,null))[_0x67c1('0x48')](handleError(_0xeb052c,null));};exports['destroy']=function(_0x480a42,_0x3c5204){return db[_0x67c1('0x2f')][_0x67c1('0x4d')]({'where':{'id':_0x480a42[_0x67c1('0x4e')]['id']}})[_0x67c1('0x46')](handleEntityNotFound(_0x3c5204,null))[_0x67c1('0x46')](removeEntity(_0x3c5204,null))['catch'](handleError(_0x3c5204,null));};exports['describe']=function(_0x56bbf9,_0x3da836){return db[_0x67c1('0x2f')][_0x67c1('0x4f')]()[_0x67c1('0x46')](respondWithResult(_0x3da836,null))[_0x67c1('0x48')](handleError(_0x3da836,null));};exports[_0x67c1('0x50')]=function(_0x1585a7,_0x1b8d7d,_0x82dab1){return db[_0x67c1('0x51')]['count']({'where':{'ChatGroupId':_0x1585a7['params']['id'],'ToId':_0x1585a7[_0x67c1('0x52')]['id'],'read':![]}})[_0x67c1('0x46')](function(_0x477b1d){return{'id':_[_0x67c1('0x53')](_0x1585a7['params']['id']),'count':_0x477b1d};})[_0x67c1('0x46')](respondWithResult(_0x1b8d7d,null))['catch'](handleError(_0x1b8d7d,null));};exports[_0x67c1('0x54')]=function(_0x415352,_0x1cfb08,_0x5278db){return db[_0x67c1('0x2f')][_0x67c1('0x4d')]({'where':{'id':_0x415352['params']['id']}})['then'](handleEntityNotFound(_0x1cfb08,null))[_0x67c1('0x46')](function(_0x263f04){if(_0x263f04){return _0x263f04['addMembers'](_0x415352['body']['ids'],_['omit'](_0x415352[_0x67c1('0x4c')],[_0x67c1('0x55'),'id'])||{});}})[_0x67c1('0x46')](respondWithResult(_0x1cfb08,null))['catch'](handleError(_0x1cfb08,null));};exports['getMembers']=function(_0x20156d,_0x45422c,_0x30fea9){var _0x3e8d95={};var _0x1df802={};var _0x3a4079;var _0x2b91ae;return db[_0x67c1('0x2f')][_0x67c1('0x56')]({'where':{'id':_0x20156d[_0x67c1('0x4e')]['id']}})['then'](handleEntityNotFound(_0x45422c,null))['then'](function(_0x3b31e5){if(_0x3b31e5){_0x3a4079=_0x3b31e5;_0x1df802[_0x67c1('0x34')]=_[_0x67c1('0x35')](db['User']['rawAttributes']);_0x1df802[_0x67c1('0x36')]=_[_0x67c1('0x35')](_0x20156d[_0x67c1('0x36')]);_0x1df802[_0x67c1('0x41')]=_[_0x67c1('0x37')](_0x1df802['model'],_0x1df802[_0x67c1('0x36')]);_0x3e8d95[_0x67c1('0x39')]=_[_0x67c1('0x37')](_0x1df802[_0x67c1('0x34')],qs[_0x67c1('0x38')](_0x20156d['query'][_0x67c1('0x38')]));_0x3e8d95[_0x67c1('0x39')]=_0x3e8d95[_0x67c1('0x39')]['length']?_0x3e8d95[_0x67c1('0x39')]:_0x1df802[_0x67c1('0x34')];_0x3e8d95[_0x67c1('0x3d')]=qs[_0x67c1('0x3e')](_0x20156d['query']['sort']);_0x3e8d95[_0x67c1('0x3f')]=qs[_0x67c1('0x41')](_['pick'](_0x20156d[_0x67c1('0x36')],_0x1df802[_0x67c1('0x41')]));if(_0x20156d[_0x67c1('0x36')][_0x67c1('0x42')]){_0x3e8d95[_0x67c1('0x3f')]=_[_0x67c1('0x43')](_0x3e8d95[_0x67c1('0x3f')],{'$or':_[_0x67c1('0x2e')](_0x3e8d95[_0x67c1('0x39')],function(_0x27bf18){var _0x3b835b={};_0x3b835b[_0x27bf18]={'$like':'%'+_0x20156d['query'][_0x67c1('0x42')]+'%'};return _0x3b835b;})});}_0x3e8d95=_[_0x67c1('0x43')]({},_0x3e8d95,_0x20156d[_0x67c1('0x45')]);return _0x3a4079['getMembers'](_0x3e8d95);}})[_0x67c1('0x46')](function(_0x2f2ff8){if(_0x2f2ff8){_0x2b91ae=_0x2f2ff8['length'];if(!_0x20156d[_0x67c1('0x36')][_0x67c1('0x3b')](_0x67c1('0x3c'))){_0x3e8d95[_0x67c1('0x21')]=qs[_0x67c1('0x21')](_0x20156d['query'][_0x67c1('0x21')]);_0x3e8d95['offset']=qs['offset'](_0x20156d[_0x67c1('0x36')][_0x67c1('0x20')]);}return _0x3a4079['getMembers'](_0x3e8d95);}})[_0x67c1('0x46')](function(_0x5c9412){if(_0x5c9412){return _0x5c9412?{'count':_0x2b91ae,'rows':_0x5c9412}:null;}})['then'](respondWithResult(_0x45422c,null))[_0x67c1('0x48')](handleError(_0x45422c,null));};exports['removeMembers']=function(_0x1f0e38,_0x5a80ef,_0x38d6b3){return db[_0x67c1('0x2f')][_0x67c1('0x4d')]({'where':{'id':_0x1f0e38[_0x67c1('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5a80ef,null))[_0x67c1('0x46')](function(_0x133ec4){if(_0x133ec4){return _0x133ec4[_0x67c1('0x57')](_0x1f0e38[_0x67c1('0x36')][_0x67c1('0x55')]);}})[_0x67c1('0x46')](respondWithStatusCode(_0x5a80ef,null))['catch'](handleError(_0x5a80ef,null));};exports['addMessage']=function(_0x1568a1,_0x315cb9,_0xb8ab2){if(_0x1568a1[_0x67c1('0x4c')]['id']){delete _0x1568a1[_0x67c1('0x4c')]['id'];}return db[_0x67c1('0x2f')][_0x67c1('0x4d')]({'where':{'id':_0x1568a1[_0x67c1('0x4e')]['id']}})['then'](handleEntityNotFound(_0x315cb9,null))[_0x67c1('0x46')](function(_0x3df7e9){if(_0x3df7e9){_0x1568a1['body'][_0x67c1('0x58')]=_0x3df7e9['id'];return db[_0x67c1('0x51')][_0x67c1('0x4b')](_0x1568a1['body']);}})['then'](respondWithResult(_0x315cb9,null))['catch'](handleError(_0x315cb9,null));};exports[_0x67c1('0x59')]=function(_0x4096f4,_0xc21e2a,_0x3ff54b){var _0x74afe4={};var _0x4a032f={};var _0x49813a;var _0x45ef81;return db[_0x67c1('0x2f')][_0x67c1('0x56')]({'where':{'id':_0x4096f4['params']['id']}})[_0x67c1('0x46')](handleEntityNotFound(_0xc21e2a,null))[_0x67c1('0x46')](function(_0x1f7623){if(_0x1f7623){_0x49813a=_0x1f7623;_0x4a032f['model']=_['keys'](db['ChatInternalMessage'][_0x67c1('0x30')]);_0x4a032f['query']=_['keys'](_0x4096f4[_0x67c1('0x36')]);_0x4a032f[_0x67c1('0x41')]=_[_0x67c1('0x37')](_0x4a032f[_0x67c1('0x34')],_0x4a032f[_0x67c1('0x36')]);_0x74afe4[_0x67c1('0x39')]=_[_0x67c1('0x37')](_0x4a032f[_0x67c1('0x34')],qs[_0x67c1('0x38')](_0x4096f4[_0x67c1('0x36')][_0x67c1('0x38')]));_0x74afe4[_0x67c1('0x39')]=_0x74afe4[_0x67c1('0x39')][_0x67c1('0x3a')]?_0x74afe4[_0x67c1('0x39')]:_0x4a032f[_0x67c1('0x34')];_0x74afe4[_0x67c1('0x3d')]=qs[_0x67c1('0x3e')](_0x4096f4[_0x67c1('0x36')]['sort']);_0x74afe4[_0x67c1('0x3f')]=qs[_0x67c1('0x41')](_[_0x67c1('0x40')](_0x4096f4[_0x67c1('0x36')],_0x4a032f['filters']));if(_0x4096f4['query'][_0x67c1('0x42')]){_0x74afe4[_0x67c1('0x3f')]=_[_0x67c1('0x43')](_0x74afe4[_0x67c1('0x3f')],{'$or':_[_0x67c1('0x2e')](_0x74afe4[_0x67c1('0x39')],function(_0x2418bd){var _0x59a033={};_0x59a033[_0x2418bd]={'$like':'%'+_0x4096f4[_0x67c1('0x36')][_0x67c1('0x42')]+'%'};return _0x59a033;})});}if(_0x4096f4['query'][_0x67c1('0x5a')]){var _0x1d714f=_0x4096f4[_0x67c1('0x36')][_0x67c1('0x5a')][_0x67c1('0x5b')](',');var _0xb94775={};_0xb94775[_0x1d714f[0x0]]={'$gte':moment(_0x1d714f[0x1])[_0x67c1('0x5c')]('YYYY-MM-DD\x20HH:mm:ss')};_0x74afe4['where']=_['merge'](_0x74afe4['where'],_0xb94775);}_0x74afe4=_[_0x67c1('0x43')]({},_0x74afe4,_0x4096f4[_0x67c1('0x45')]);return _0x49813a[_0x67c1('0x59')](_0x74afe4);}})[_0x67c1('0x46')](function(_0x3a899e){if(_0x3a899e){_0x45ef81=_0x3a899e[_0x67c1('0x3a')];if(!_0x4096f4[_0x67c1('0x36')][_0x67c1('0x3b')](_0x67c1('0x3c'))){_0x74afe4['limit']=qs[_0x67c1('0x21')](_0x4096f4['query']['limit']);_0x74afe4[_0x67c1('0x20')]=qs[_0x67c1('0x20')](_0x4096f4[_0x67c1('0x36')]['offset']);}return _0x49813a[_0x67c1('0x59')](_0x74afe4);}})[_0x67c1('0x46')](function(_0x1810de){if(_0x1810de){return _0x1810de?{'count':_0x45ef81,'rows':_0x1810de}:null;}})[_0x67c1('0x46')](respondWithResult(_0xc21e2a,null))[_0x67c1('0x48')](handleError(_0xc21e2a,null));}; \ No newline at end of file +var _0x812e=['redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','map','ChatGroup','fieldName','type','key','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','sort','pick','filter','merge','where','VIRTUAL','includeAll','include','findAll','catch','show','params','options','find','create','body','update','describe','getUnread','user','toInteger','addMembers','ids','omit','User','getMembers','nolimit','removeMembers','ChatGroupId','ChatInternalMessage','findOne','order','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x812e,0x117));var _0xe812=function(_0x5839fa,_0xacd507){_0x5839fa=_0x5839fa-0x0;var _0x5d514e=_0x812e[_0x5839fa];return _0x5d514e;};'use strict';var emlformat=require(_0xe812('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe812('0x1'));var jsonpatch=require(_0xe812('0x2'));var rp=require(_0xe812('0x3'));var moment=require(_0xe812('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe812('0x5'));var util=require('util');var path=require(_0xe812('0x6'));var sox=require(_0xe812('0x7'));var csv=require('to-csv');var ejs=require(_0xe812('0x8'));var fs=require('fs');var fs_extra=require(_0xe812('0x9'));var _=require(_0xe812('0xa'));var squel=require(_0xe812('0xb'));var crypto=require(_0xe812('0xc'));var jsforce=require(_0xe812('0xd'));var deskjs=require(_0xe812('0xe'));var toCsv=require(_0xe812('0xf'));var querystring=require(_0xe812('0x10'));var Papa=require(_0xe812('0x11'));var Redis=require(_0xe812('0x12'));var authService=require(_0xe812('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xe812('0x14'));var hardwareService=require(_0xe812('0x15'));var logger=require(_0xe812('0x16'))(_0xe812('0x17'));var utils=require(_0xe812('0x18'));var config=require(_0xe812('0x19'));var licenseUtil=require(_0xe812('0x1a'));var db=require('../../mysqldb')['db'];config[_0xe812('0x1b')]=_[_0xe812('0x1c')](config[_0xe812('0x1b')],{'host':_0xe812('0x1d'),'port':0x18eb});var socket=require(_0xe812('0x1e'))(new Redis(config[_0xe812('0x1b')]));require('./chatGroup.socket')[_0xe812('0x1f')](socket);function respondWithStatusCode(_0x2b0bb6,_0x1f9be0){_0x1f9be0=_0x1f9be0||0xcc;return function(_0x9c4402){if(_0x9c4402){return _0x2b0bb6[_0xe812('0x20')](_0x1f9be0);}return _0x2b0bb6[_0xe812('0x21')](_0x1f9be0)[_0xe812('0x22')]();};}function respondWithResult(_0x3c496e,_0x4ee593){_0x4ee593=_0x4ee593||0xc8;return function(_0x267233){if(_0x267233){return _0x3c496e[_0xe812('0x21')](_0x4ee593)['json'](_0x267233);}};}function respondWithFilteredResult(_0x13b6c6,_0x5ef3dd){return function(_0x1d7e4e){if(_0x1d7e4e){var _0x774e45=typeof _0x5ef3dd[_0xe812('0x23')]===_0xe812('0x24')&&typeof _0x5ef3dd['limit']===_0xe812('0x24');var _0x290d7b=_0x1d7e4e[_0xe812('0x25')];var _0xa8adc8=_0x774e45?0x0:_0x5ef3dd[_0xe812('0x23')];var _0x2427f3=_0x774e45?_0x1d7e4e[_0xe812('0x25')]:_0x5ef3dd['offset']+_0x5ef3dd[_0xe812('0x26')];var _0x3cc7d9;if(_0x2427f3>=_0x290d7b){_0x2427f3=_0x290d7b;_0x3cc7d9=0xc8;}else{_0x3cc7d9=0xce;}_0x13b6c6[_0xe812('0x21')](_0x3cc7d9);return _0x13b6c6[_0xe812('0x27')](_0xe812('0x28'),_0xa8adc8+'-'+_0x2427f3+'/'+_0x290d7b)[_0xe812('0x29')](_0x1d7e4e);}return null;};}function patchUpdates(_0x35e946){return function(_0x1d26a6){try{jsonpatch[_0xe812('0x2a')](_0x1d26a6,_0x35e946,!![]);}catch(_0x553e42){return BPromise[_0xe812('0x2b')](_0x553e42);}return _0x1d26a6[_0xe812('0x2c')]();};}function saveUpdates(_0x35b066,_0x4b4fb1){return function(_0xb76d88){if(_0xb76d88){return _0xb76d88['update'](_0x35b066)[_0xe812('0x2d')](function(_0x1e11b5){return _0x1e11b5;});}return null;};}function removeEntity(_0x580cc3,_0x125fdd){return function(_0x159482){if(_0x159482){return _0x159482[_0xe812('0x2e')]()[_0xe812('0x2d')](function(){_0x580cc3[_0xe812('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44efa7,_0x16bf81){return function(_0x1e0de2){if(!_0x1e0de2){_0x44efa7[_0xe812('0x20')](0x194);}return _0x1e0de2;};}function handleError(_0x5c5ce6,_0x4f65ff){_0x4f65ff=_0x4f65ff||0x1f4;return function(_0x373036){logger[_0xe812('0x2f')](_0x373036[_0xe812('0x30')]);if(_0x373036[_0xe812('0x31')]){delete _0x373036['name'];}_0x5c5ce6[_0xe812('0x21')](_0x4f65ff)[_0xe812('0x32')](_0x373036);};}exports['index']=function(_0xebcad3,_0x478dfc){var _0x240a22={},_0x173721={},_0xc4988c={'count':0x0,'rows':[]};var _0x241bc3=_[_0xe812('0x33')](db[_0xe812('0x34')]['rawAttributes'],function(_0x2d94c4){return{'name':_0x2d94c4[_0xe812('0x35')],'type':_0x2d94c4[_0xe812('0x36')][_0xe812('0x37')]};});_0x173721['model']=_['map'](_0x241bc3,_0xe812('0x31'));_0x173721[_0xe812('0x38')]=_[_0xe812('0x39')](_0xebcad3[_0xe812('0x38')]);_0x173721[_0xe812('0x3a')]=_[_0xe812('0x3b')](_0x173721['model'],_0x173721[_0xe812('0x38')]);_0x240a22[_0xe812('0x3c')]=_[_0xe812('0x3b')](_0x173721['model'],qs[_0xe812('0x3d')](_0xebcad3['query'][_0xe812('0x3d')]));_0x240a22[_0xe812('0x3c')]=_0x240a22['attributes'][_0xe812('0x3e')]?_0x240a22[_0xe812('0x3c')]:_0x173721[_0xe812('0x3f')];if(!_0xebcad3[_0xe812('0x38')][_0xe812('0x40')]('nolimit')){_0x240a22[_0xe812('0x26')]=qs[_0xe812('0x26')](_0xebcad3[_0xe812('0x38')]['limit']);_0x240a22[_0xe812('0x23')]=qs[_0xe812('0x23')](_0xebcad3[_0xe812('0x38')][_0xe812('0x23')]);}_0x240a22['order']=qs[_0xe812('0x41')](_0xebcad3['query'][_0xe812('0x41')]);_0x240a22['where']=qs[_0xe812('0x3a')](_[_0xe812('0x42')](_0xebcad3[_0xe812('0x38')],_0x173721[_0xe812('0x3a')]),_0x241bc3);if(_0xebcad3[_0xe812('0x38')][_0xe812('0x43')]){_0x240a22['where']=_[_0xe812('0x44')](_0x240a22[_0xe812('0x45')],{'$or':_[_0xe812('0x33')](_0x241bc3,function(_0x24860c){if(_0x24860c[_0xe812('0x36')]!==_0xe812('0x46')){var _0x5d20b9={};_0x5d20b9[_0x24860c[_0xe812('0x31')]]={'$like':'%'+_0xebcad3['query'][_0xe812('0x43')]+'%'};return _0x5d20b9;}})});}_0x240a22=_['merge']({},_0x240a22,_0xebcad3['options']);var _0x48155f={'where':_0x240a22[_0xe812('0x45')]};return db[_0xe812('0x34')][_0xe812('0x25')](_0x48155f)[_0xe812('0x2d')](function(_0x53c6d1){_0xc4988c[_0xe812('0x25')]=_0x53c6d1;if(_0xebcad3[_0xe812('0x38')][_0xe812('0x47')]){_0x240a22[_0xe812('0x48')]=[{'all':!![]}];}return db[_0xe812('0x34')][_0xe812('0x49')](_0x240a22);})[_0xe812('0x2d')](function(_0x5b1ebd){_0xc4988c['rows']=_0x5b1ebd;return _0xc4988c;})[_0xe812('0x2d')](respondWithFilteredResult(_0x478dfc,_0x240a22))[_0xe812('0x4a')](handleError(_0x478dfc,null));};exports[_0xe812('0x4b')]=function(_0x89568d,_0x777e3c){var _0x509827={'raw':!![],'where':{'id':_0x89568d[_0xe812('0x4c')]['id']}},_0x1fcba9={};_0x1fcba9[_0xe812('0x3f')]=_[_0xe812('0x39')](db[_0xe812('0x34')]['rawAttributes']);_0x1fcba9['query']=_[_0xe812('0x39')](_0x89568d['query']);_0x1fcba9[_0xe812('0x3a')]=_['intersection'](_0x1fcba9[_0xe812('0x3f')],_0x1fcba9['query']);_0x509827[_0xe812('0x3c')]=_[_0xe812('0x3b')](_0x1fcba9['model'],qs[_0xe812('0x3d')](_0x89568d[_0xe812('0x38')][_0xe812('0x3d')]));_0x509827[_0xe812('0x3c')]=_0x509827[_0xe812('0x3c')]['length']?_0x509827[_0xe812('0x3c')]:_0x1fcba9[_0xe812('0x3f')];if(_0x89568d[_0xe812('0x38')][_0xe812('0x47')]){_0x509827[_0xe812('0x48')]=[{'all':!![]}];}_0x509827=_['merge']({},_0x509827,_0x89568d[_0xe812('0x4d')]);return db[_0xe812('0x34')][_0xe812('0x4e')](_0x509827)[_0xe812('0x2d')](handleEntityNotFound(_0x777e3c,null))[_0xe812('0x2d')](respondWithResult(_0x777e3c,null))['catch'](handleError(_0x777e3c,null));};exports[_0xe812('0x4f')]=function(_0x2b266f,_0x16fe5c){return db[_0xe812('0x34')][_0xe812('0x4f')](_0x2b266f[_0xe812('0x50')],{})[_0xe812('0x2d')](respondWithResult(_0x16fe5c,0xc9))['catch'](handleError(_0x16fe5c,null));};exports[_0xe812('0x51')]=function(_0x1c151b,_0x48eb4d){if(_0x1c151b[_0xe812('0x50')]['id']){delete _0x1c151b[_0xe812('0x50')]['id'];}return db[_0xe812('0x34')][_0xe812('0x4e')]({'where':{'id':_0x1c151b[_0xe812('0x4c')]['id']}})['then'](handleEntityNotFound(_0x48eb4d,null))[_0xe812('0x2d')](saveUpdates(_0x1c151b['body'],null))[_0xe812('0x2d')](respondWithResult(_0x48eb4d,null))[_0xe812('0x4a')](handleError(_0x48eb4d,null));};exports['destroy']=function(_0x3deffd,_0x26052a){return db[_0xe812('0x34')][_0xe812('0x4e')]({'where':{'id':_0x3deffd[_0xe812('0x4c')]['id']}})['then'](handleEntityNotFound(_0x26052a,null))[_0xe812('0x2d')](removeEntity(_0x26052a,null))['catch'](handleError(_0x26052a,null));};exports[_0xe812('0x52')]=function(_0x568791,_0x236187){return db[_0xe812('0x34')][_0xe812('0x52')]()[_0xe812('0x2d')](respondWithResult(_0x236187,null))[_0xe812('0x4a')](handleError(_0x236187,null));};exports[_0xe812('0x53')]=function(_0x1dda33,_0x1c7fce,_0x590b08){return db['ChatInternalMessage'][_0xe812('0x25')]({'where':{'ChatGroupId':_0x1dda33[_0xe812('0x4c')]['id'],'ToId':_0x1dda33[_0xe812('0x54')]['id'],'read':![]}})[_0xe812('0x2d')](function(_0x155b93){return{'id':_[_0xe812('0x55')](_0x1dda33[_0xe812('0x4c')]['id']),'count':_0x155b93};})[_0xe812('0x2d')](respondWithResult(_0x1c7fce,null))[_0xe812('0x4a')](handleError(_0x1c7fce,null));};exports[_0xe812('0x56')]=function(_0x2a1bc6,_0x51c687,_0x46ce96){return db[_0xe812('0x34')][_0xe812('0x4e')]({'where':{'id':_0x2a1bc6['params']['id']}})[_0xe812('0x2d')](handleEntityNotFound(_0x51c687,null))[_0xe812('0x2d')](function(_0x2d194f){if(_0x2d194f){return _0x2d194f[_0xe812('0x56')](_0x2a1bc6[_0xe812('0x50')][_0xe812('0x57')],_[_0xe812('0x58')](_0x2a1bc6['body'],[_0xe812('0x57'),'id'])||{});}})[_0xe812('0x2d')](respondWithResult(_0x51c687,null))[_0xe812('0x4a')](handleError(_0x51c687,null));};exports['getMembers']=function(_0x588e0e,_0x286d80,_0x32c672){var _0x2b4c68={};var _0x32a588={};var _0x1b1de6;var _0x25b584;return db[_0xe812('0x34')]['findOne']({'where':{'id':_0x588e0e[_0xe812('0x4c')]['id']}})[_0xe812('0x2d')](handleEntityNotFound(_0x286d80,null))[_0xe812('0x2d')](function(_0x3420cb){if(_0x3420cb){_0x1b1de6=_0x3420cb;_0x32a588[_0xe812('0x3f')]=_['keys'](db[_0xe812('0x59')]['rawAttributes']);_0x32a588[_0xe812('0x38')]=_[_0xe812('0x39')](_0x588e0e[_0xe812('0x38')]);_0x32a588['filters']=_['intersection'](_0x32a588[_0xe812('0x3f')],_0x32a588[_0xe812('0x38')]);_0x2b4c68[_0xe812('0x3c')]=_[_0xe812('0x3b')](_0x32a588['model'],qs[_0xe812('0x3d')](_0x588e0e[_0xe812('0x38')][_0xe812('0x3d')]));_0x2b4c68[_0xe812('0x3c')]=_0x2b4c68['attributes'][_0xe812('0x3e')]?_0x2b4c68['attributes']:_0x32a588[_0xe812('0x3f')];_0x2b4c68['order']=qs['sort'](_0x588e0e[_0xe812('0x38')]['sort']);_0x2b4c68[_0xe812('0x45')]=qs[_0xe812('0x3a')](_[_0xe812('0x42')](_0x588e0e[_0xe812('0x38')],_0x32a588['filters']));if(_0x588e0e[_0xe812('0x38')][_0xe812('0x43')]){_0x2b4c68[_0xe812('0x45')]=_['merge'](_0x2b4c68[_0xe812('0x45')],{'$or':_[_0xe812('0x33')](_0x2b4c68[_0xe812('0x3c')],function(_0x478a3f){var _0x1716bf={};_0x1716bf[_0x478a3f]={'$like':'%'+_0x588e0e[_0xe812('0x38')][_0xe812('0x43')]+'%'};return _0x1716bf;})});}_0x2b4c68=_[_0xe812('0x44')]({},_0x2b4c68,_0x588e0e[_0xe812('0x4d')]);return _0x1b1de6[_0xe812('0x5a')](_0x2b4c68);}})[_0xe812('0x2d')](function(_0x1df0d0){if(_0x1df0d0){_0x25b584=_0x1df0d0[_0xe812('0x3e')];if(!_0x588e0e[_0xe812('0x38')]['hasOwnProperty'](_0xe812('0x5b'))){_0x2b4c68[_0xe812('0x26')]=qs[_0xe812('0x26')](_0x588e0e[_0xe812('0x38')][_0xe812('0x26')]);_0x2b4c68[_0xe812('0x23')]=qs[_0xe812('0x23')](_0x588e0e[_0xe812('0x38')][_0xe812('0x23')]);}return _0x1b1de6[_0xe812('0x5a')](_0x2b4c68);}})[_0xe812('0x2d')](function(_0x71e7a3){if(_0x71e7a3){return _0x71e7a3?{'count':_0x25b584,'rows':_0x71e7a3}:null;}})['then'](respondWithResult(_0x286d80,null))[_0xe812('0x4a')](handleError(_0x286d80,null));};exports[_0xe812('0x5c')]=function(_0x6a0aba,_0x39dd5b,_0xae2751){return db['ChatGroup']['find']({'where':{'id':_0x6a0aba[_0xe812('0x4c')]['id']}})[_0xe812('0x2d')](handleEntityNotFound(_0x39dd5b,null))[_0xe812('0x2d')](function(_0x35074a){if(_0x35074a){return _0x35074a[_0xe812('0x5c')](_0x6a0aba[_0xe812('0x38')]['ids']);}})[_0xe812('0x2d')](respondWithStatusCode(_0x39dd5b,null))[_0xe812('0x4a')](handleError(_0x39dd5b,null));};exports['addMessage']=function(_0x534234,_0x24c6ea,_0xa3567e){if(_0x534234[_0xe812('0x50')]['id']){delete _0x534234[_0xe812('0x50')]['id'];}return db[_0xe812('0x34')][_0xe812('0x4e')]({'where':{'id':_0x534234[_0xe812('0x4c')]['id']}})['then'](handleEntityNotFound(_0x24c6ea,null))['then'](function(_0x1f1625){if(_0x1f1625){_0x534234[_0xe812('0x50')][_0xe812('0x5d')]=_0x1f1625['id'];return db[_0xe812('0x5e')][_0xe812('0x4f')](_0x534234[_0xe812('0x50')]);}})[_0xe812('0x2d')](respondWithResult(_0x24c6ea,null))['catch'](handleError(_0x24c6ea,null));};exports['getMessages']=function(_0x530d19,_0x4ef0a4,_0x137b55){var _0x1e3e99={};var _0x52cf6b={};var _0x112eb1;var _0x4f4149;return db[_0xe812('0x34')][_0xe812('0x5f')]({'where':{'id':_0x530d19[_0xe812('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4ef0a4,null))[_0xe812('0x2d')](function(_0x1a2fcf){if(_0x1a2fcf){_0x112eb1=_0x1a2fcf;_0x52cf6b[_0xe812('0x3f')]=_['keys'](db[_0xe812('0x5e')]['rawAttributes']);_0x52cf6b[_0xe812('0x38')]=_[_0xe812('0x39')](_0x530d19['query']);_0x52cf6b[_0xe812('0x3a')]=_[_0xe812('0x3b')](_0x52cf6b[_0xe812('0x3f')],_0x52cf6b['query']);_0x1e3e99[_0xe812('0x3c')]=_[_0xe812('0x3b')](_0x52cf6b['model'],qs[_0xe812('0x3d')](_0x530d19[_0xe812('0x38')][_0xe812('0x3d')]));_0x1e3e99[_0xe812('0x3c')]=_0x1e3e99['attributes']['length']?_0x1e3e99[_0xe812('0x3c')]:_0x52cf6b[_0xe812('0x3f')];_0x1e3e99[_0xe812('0x60')]=qs[_0xe812('0x41')](_0x530d19['query']['sort']);_0x1e3e99['where']=qs['filters'](_[_0xe812('0x42')](_0x530d19[_0xe812('0x38')],_0x52cf6b[_0xe812('0x3a')]));if(_0x530d19[_0xe812('0x38')]['filter']){_0x1e3e99['where']=_[_0xe812('0x44')](_0x1e3e99[_0xe812('0x45')],{'$or':_['map'](_0x1e3e99[_0xe812('0x3c')],function(_0x99439c){var _0x458c19={};_0x458c19[_0x99439c]={'$like':'%'+_0x530d19[_0xe812('0x38')][_0xe812('0x43')]+'%'};return _0x458c19;})});}if(_0x530d19[_0xe812('0x38')]['$gte']){var _0x3d2d8e=_0x530d19['query'][_0xe812('0x61')][_0xe812('0x62')](',');var _0x44df2e={};_0x44df2e[_0x3d2d8e[0x0]]={'$gte':moment(_0x3d2d8e[0x1])[_0xe812('0x63')](_0xe812('0x64'))};_0x1e3e99['where']=_['merge'](_0x1e3e99[_0xe812('0x45')],_0x44df2e);}_0x1e3e99=_[_0xe812('0x44')]({},_0x1e3e99,_0x530d19[_0xe812('0x4d')]);return _0x112eb1[_0xe812('0x65')](_0x1e3e99);}})['then'](function(_0x294395){if(_0x294395){_0x4f4149=_0x294395[_0xe812('0x3e')];if(!_0x530d19['query'][_0xe812('0x40')](_0xe812('0x5b'))){_0x1e3e99[_0xe812('0x26')]=qs['limit'](_0x530d19[_0xe812('0x38')][_0xe812('0x26')]);_0x1e3e99[_0xe812('0x23')]=qs[_0xe812('0x23')](_0x530d19['query'][_0xe812('0x23')]);}return _0x112eb1[_0xe812('0x65')](_0x1e3e99);}})['then'](function(_0x19969e){if(_0x19969e){return _0x19969e?{'count':_0x4f4149,'rows':_0x19969e}:null;}})[_0xe812('0x2d')](respondWithResult(_0x4ef0a4,null))[_0xe812('0x4a')](handleError(_0x4ef0a4,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index d7886b2..114b4d5 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 _0xb7de=['hook','events','../../mysqldb','ChatGroup','save','update','remove','emit','hasOwnProperty'];(function(_0x4cb272,_0x52c0e9){var _0x57b4aa=function(_0x1efefb){while(--_0x1efefb){_0x4cb272['push'](_0x4cb272['shift']());}};_0x57b4aa(++_0x52c0e9);}(_0xb7de,0xc7));var _0xeb7d=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xb7de[_0x1facfa];return _0x9ec701;};'use strict';var EventEmitter=require(_0xeb7d('0x0'));var ChatGroup=require(_0xeb7d('0x1'))['db'][_0xeb7d('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xeb7d('0x3'),'afterUpdate':_0xeb7d('0x4'),'afterDestroy':_0xeb7d('0x5')};function emitEvent(_0x219063){return function(_0x6b96c8,_0x57a908,_0x16d106){ChatGroupEvents[_0xeb7d('0x6')](_0x219063+':'+_0x6b96c8['id'],_0x6b96c8);ChatGroupEvents[_0xeb7d('0x6')](_0x219063,_0x6b96c8);_0x16d106(null);};}for(var e in events){if(events[_0xeb7d('0x7')](e)){var event=events[e];ChatGroup[_0xeb7d('0x8')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0x8ff4=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0xb3ba57,_0x3c90a8){var _0x5ce9d6=function(_0x4d66a9){while(--_0x4d66a9){_0xb3ba57['push'](_0xb3ba57['shift']());}};_0x5ce9d6(++_0x3c90a8);}(_0x8ff4,0x11f));var _0x48ff=function(_0x53be8d,_0x2cb53f){_0x53be8d=_0x53be8d-0x0;var _0x396d2c=_0x8ff4[_0x53be8d];return _0x396d2c;};'use strict';var EventEmitter=require(_0x48ff('0x0'));var ChatGroup=require('../../mysqldb')['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x48ff('0x1')](0x0);var events={'afterCreate':_0x48ff('0x2'),'afterUpdate':'update','afterDestroy':_0x48ff('0x3')};function emitEvent(_0xc4b32e){return function(_0x2e6166,_0x3fa416,_0x46de8a){ChatGroupEvents[_0x48ff('0x4')](_0xc4b32e+':'+_0x2e6166['id'],_0x2e6166);ChatGroupEvents[_0x48ff('0x4')](_0xc4b32e,_0x2e6166);_0x46de8a(null);};}for(var e in events){if(events[_0x48ff('0x5')](e)){var event=events[e];ChatGroup[_0x48ff('0x6')](e,emitEvent(event));}}module[_0x48ff('0x7')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 5ab3fe4..0ee351c 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 _0x6a46=['path','rimraf','../../config/environment','./chatGroup.attributes','exports','define','chat_groups','lodash','util','api','bluebird','request-promise'];(function(_0x38d823,_0x27e64e){var _0x309d97=function(_0x230c68){while(--_0x230c68){_0x38d823['push'](_0x38d823['shift']());}};_0x309d97(++_0x27e64e);}(_0x6a46,0x1ab));var _0x66a4=function(_0x28df53,_0xb65281){_0x28df53=_0x28df53-0x0;var _0x1bc5a7=_0x6a46[_0x28df53];return _0x1bc5a7;};'use strict';var _=require(_0x66a4('0x0'));var util=require(_0x66a4('0x1'));var logger=require('../../config/logger')(_0x66a4('0x2'));var moment=require('moment');var BPromise=require(_0x66a4('0x3'));var rp=require(_0x66a4('0x4'));var fs=require('fs');var path=require(_0x66a4('0x5'));var rimraf=require(_0x66a4('0x6'));var config=require(_0x66a4('0x7'));var attributes=require(_0x66a4('0x8'));module[_0x66a4('0x9')]=function(_0xa4a946,_0xf6df99){return _0xa4a946[_0x66a4('0xa')]('ChatGroup',attributes,{'tableName':_0x66a4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa5d7=['rimraf','../../config/environment','./chatGroup.attributes','define','ChatGroup','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x505473,_0x358249){var _0x1c466d=function(_0x525a9f){while(--_0x525a9f){_0x505473['push'](_0x505473['shift']());}};_0x1c466d(++_0x358249);}(_0xa5d7,0x94));var _0x7a5d=function(_0xba185f,_0x7c5e61){_0xba185f=_0xba185f-0x0;var _0x50c684=_0xa5d7[_0xba185f];return _0x50c684;};'use strict';var _=require(_0x7a5d('0x0'));var util=require(_0x7a5d('0x1'));var logger=require(_0x7a5d('0x2'))(_0x7a5d('0x3'));var moment=require(_0x7a5d('0x4'));var BPromise=require(_0x7a5d('0x5'));var rp=require(_0x7a5d('0x6'));var fs=require('fs');var path=require(_0x7a5d('0x7'));var rimraf=require(_0x7a5d('0x8'));var config=require(_0x7a5d('0x9'));var attributes=require(_0x7a5d('0xa'));module['exports']=function(_0x7fa601,_0x27022e){return _0x7fa601[_0x7a5d('0xb')](_0x7a5d('0xc'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 5c021aa..b820020 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 _0x181d=['../../config/utils','rpc','../../config/environment','http','defaults','redis','localhost','./chatGroup.socket','register','then','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','moment','randomstring','ioredis','../../mysqldb'];(function(_0x13f95e,_0x2d0e36){var _0x5bfb57=function(_0x40f78a){while(--_0x40f78a){_0x13f95e['push'](_0x13f95e['shift']());}};_0x5bfb57(++_0x2d0e36);}(_0x181d,0x10f));var _0xd181=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x181d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd181('0x0'));var BPromise=require('bluebird');var rs=require(_0xd181('0x1'));var fs=require('fs');var Redis=require(_0xd181('0x2'));var db=require(_0xd181('0x3'))['db'];var utils=require(_0xd181('0x4'));var logger=require('../../config/logger')(_0xd181('0x5'));var config=require(_0xd181('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd181('0x7')]({'port':0x232a});config['redis']=_[_0xd181('0x8')](config[_0xd181('0x9')],{'host':_0xd181('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd181('0x9')]));require(_0xd181('0xb'))[_0xd181('0xc')](socket);function respondWithRpcPromise(_0x74ef22,_0x103eee,_0x589470){return new BPromise(function(_0x51d3ce,_0x549dd2){return client['request'](_0x74ef22,_0x589470)[_0xd181('0xd')](function(_0x4cb3f6){logger['info'](_0xd181('0xe'),_0x103eee,_0xd181('0xf'));logger[_0xd181('0x10')](_0xd181('0x11'),_0x103eee,_0xd181('0xf'),JSON[_0xd181('0x12')](_0x4cb3f6));if(_0x4cb3f6[_0xd181('0x13')]){if(_0x4cb3f6[_0xd181('0x13')][_0xd181('0x14')]===0x1f4){logger[_0xd181('0x13')](_0xd181('0xe'),_0x103eee,_0x4cb3f6[_0xd181('0x13')][_0xd181('0x15')]);return _0x549dd2(_0x4cb3f6[_0xd181('0x13')][_0xd181('0x15')]);}logger[_0xd181('0x13')]('ChatGroup,\x20%s,\x20%s',_0x103eee,_0x4cb3f6[_0xd181('0x13')][_0xd181('0x15')]);return _0x51d3ce(_0x4cb3f6[_0xd181('0x13')]['message']);}else{logger[_0xd181('0x16')](_0xd181('0xe'),_0x103eee,_0xd181('0xf'));_0x51d3ce(_0x4cb3f6[_0xd181('0x17')][_0xd181('0x15')]);}})[_0xd181('0x18')](function(_0x483615){logger[_0xd181('0x13')](_0xd181('0xe'),_0x103eee,_0x483615);_0x549dd2(_0x483615);});});} \ No newline at end of file +var _0xc15b=['randomstring','ioredis','../../config/logger','rpc','../../config/environment','redis','defaults','./chatGroup.socket','request','info','ChatGroup,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird'];(function(_0x50eb38,_0x2ee6ba){var _0x5de7bf=function(_0x3558c7){while(--_0x3558c7){_0x50eb38['push'](_0x50eb38['shift']());}};_0x5de7bf(++_0x2ee6ba);}(_0xc15b,0xe4));var _0xbc15=function(_0x1a9204,_0x1c9e00){_0x1a9204=_0x1a9204-0x0;var _0x17ca68=_0xc15b[_0x1a9204];return _0x17ca68;};'use strict';var _=require(_0xbc15('0x0'));var util=require('util');var moment=require(_0xbc15('0x1'));var BPromise=require(_0xbc15('0x2'));var rs=require(_0xbc15('0x3'));var fs=require('fs');var Redis=require(_0xbc15('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbc15('0x5'))(_0xbc15('0x6'));var config=require(_0xbc15('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xbc15('0x8')]=_[_0xbc15('0x9')](config[_0xbc15('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xbc15('0xa'))['register'](socket);function respondWithRpcPromise(_0x2189d4,_0x42f0b9,_0x359eb9){return new BPromise(function(_0x551a7b,_0x413eda){return client[_0xbc15('0xb')](_0x2189d4,_0x359eb9)['then'](function(_0xc677d5){logger[_0xbc15('0xc')](_0xbc15('0xd'),_0x42f0b9,'request\x20sent');logger['debug']('ChatGroup,\x20%s,\x20%s,\x20%s',_0x42f0b9,_0xbc15('0xe'),JSON[_0xbc15('0xf')](_0xc677d5));if(_0xc677d5[_0xbc15('0x10')]){if(_0xc677d5[_0xbc15('0x10')][_0xbc15('0x11')]===0x1f4){logger[_0xbc15('0x10')](_0xbc15('0xd'),_0x42f0b9,_0xc677d5[_0xbc15('0x10')][_0xbc15('0x12')]);return _0x413eda(_0xc677d5[_0xbc15('0x10')][_0xbc15('0x12')]);}logger[_0xbc15('0x10')](_0xbc15('0xd'),_0x42f0b9,_0xc677d5[_0xbc15('0x10')]['message']);return _0x551a7b(_0xc677d5[_0xbc15('0x10')]['message']);}else{logger[_0xbc15('0xc')](_0xbc15('0xd'),_0x42f0b9,_0xbc15('0xe'));_0x551a7b(_0xc677d5[_0xbc15('0x13')][_0xbc15('0x12')]);}})[_0xbc15('0x14')](function(_0x7e7826){logger[_0xbc15('0x10')](_0xbc15('0xd'),_0x42f0b9,_0x7e7826);_0x413eda(_0x7e7826);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index be0e261..54db341 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 _0xb45f=['chatGroup:','./chatGroup.events','update','emit','removeListener','register','length'];(function(_0x1918e5,_0x30391b){var _0x5b194a=function(_0x3529ca){while(--_0x3529ca){_0x1918e5['push'](_0x1918e5['shift']());}};_0x5b194a(++_0x30391b);}(_0xb45f,0x6a));var _0xfb45=function(_0x23ed63,_0x2b031f){_0x23ed63=_0x23ed63-0x0;var _0x33aa6d=_0xb45f[_0x23ed63];return _0x33aa6d;};'use strict';var ChatGroupEvents=require(_0xfb45('0x0'));var events=['save','remove',_0xfb45('0x1')];function createListener(_0x78cef3,_0x3846d1){return function(_0x16242f){_0x3846d1[_0xfb45('0x2')](_0x78cef3,_0x16242f);};}function removeListener(_0x1ad7d5,_0x190adc){return function(){ChatGroupEvents[_0xfb45('0x3')](_0x1ad7d5,_0x190adc);};}exports[_0xfb45('0x4')]=function(_0x33109e){for(var _0x5a4386=0x0,_0x188b56=events[_0xfb45('0x5')];_0x5a4386<_0x188b56;_0x5a4386++){var _0x2c8cb9=events[_0x5a4386];var _0x5ec958=createListener(_0xfb45('0x6')+_0x2c8cb9,_0x33109e);ChatGroupEvents['on'](_0x2c8cb9,_0x5ec958);}}; \ No newline at end of file +var _0x299b=['./chatGroup.events','remove','update','emit','removeListener','register','chatGroup:'];(function(_0x20a35e,_0x477112){var _0x52bbe7=function(_0x494529){while(--_0x494529){_0x20a35e['push'](_0x20a35e['shift']());}};_0x52bbe7(++_0x477112);}(_0x299b,0x118));var _0xb299=function(_0x13843f,_0x50422d){_0x13843f=_0x13843f-0x0;var _0x1063ae=_0x299b[_0x13843f];return _0x1063ae;};'use strict';var ChatGroupEvents=require(_0xb299('0x0'));var events=['save',_0xb299('0x1'),_0xb299('0x2')];function createListener(_0x25aaba,_0x500567){return function(_0x3a10ce){_0x500567[_0xb299('0x3')](_0x25aaba,_0x3a10ce);};}function removeListener(_0x1ca9ec,_0x26139d){return function(){ChatGroupEvents[_0xb299('0x4')](_0x1ca9ec,_0x26139d);};}exports[_0xb299('0x5')]=function(_0x5b3f02){for(var _0x37dc00=0x0,_0x3ed409=events['length'];_0x37dc00<_0x3ed409;_0x37dc00++){var _0x1eb304=events[_0x37dc00];var _0x41edbb=createListener(_0xb299('0x6')+_0x1eb304,_0x5b3f02);ChatGroupEvents['on'](_0x1eb304,_0x41edbb);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 8a95bf1..13ad9d6 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 _0x6dfc=['create','/:id/members','addMessage','put','/:id','update','delete','removeMembers','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','show','getUnread','getMembers','/:id/messages','getMessages','post'];(function(_0x5bffa9,_0xc8bc4d){var _0x2c1643=function(_0x47ea52){while(--_0x47ea52){_0x5bffa9['push'](_0x5bffa9['shift']());}};_0x2c1643(++_0xc8bc4d);}(_0x6dfc,0x1d9));var _0xc6df=function(_0x496b41,_0x2678de){_0x496b41=_0x496b41-0x0;var _0x4e0c51=_0x6dfc[_0x496b41];return _0x4e0c51;};'use strict';var multer=require('multer');var util=require(_0xc6df('0x0'));var path=require(_0xc6df('0x1'));var timeout=require(_0xc6df('0x2'));var express=require(_0xc6df('0x3'));var router=express['Router']();var fs_extra=require(_0xc6df('0x4'));var auth=require(_0xc6df('0x5'));var interaction=require(_0xc6df('0x6'));var config=require(_0xc6df('0x7'));var controller=require(_0xc6df('0x8'));router[_0xc6df('0x9')]('/',auth[_0xc6df('0xa')](),controller[_0xc6df('0xb')]);router[_0xc6df('0x9')](_0xc6df('0xc'),auth[_0xc6df('0xa')](),controller[_0xc6df('0xd')]);router[_0xc6df('0x9')]('/:id',auth[_0xc6df('0xa')](),controller[_0xc6df('0xe')]);router[_0xc6df('0x9')]('/:id/unread',auth[_0xc6df('0xa')](),controller[_0xc6df('0xf')]);router[_0xc6df('0x9')]('/:id/members',auth[_0xc6df('0xa')](),controller[_0xc6df('0x10')]);router['get'](_0xc6df('0x11'),auth[_0xc6df('0xa')](),controller[_0xc6df('0x12')]);router[_0xc6df('0x13')]('/',auth['isAuthenticated'](),controller[_0xc6df('0x14')]);router['post'](_0xc6df('0x15'),auth[_0xc6df('0xa')](),controller['addMembers']);router[_0xc6df('0x13')](_0xc6df('0x11'),auth[_0xc6df('0xa')](),controller[_0xc6df('0x16')]);router[_0xc6df('0x17')](_0xc6df('0x18'),auth[_0xc6df('0xa')](),controller[_0xc6df('0x19')]);router[_0xc6df('0x1a')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0xc6df('0x1a')](_0xc6df('0x15'),auth[_0xc6df('0xa')](),controller[_0xc6df('0x1b')]);module[_0xc6df('0x1c')]=router; \ No newline at end of file +var _0xe0d8=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./chatGroup.controller','get','isAuthenticated','index','describe','/:id','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','post','create','addMembers','put','delete','destroy','removeMembers','multer'];(function(_0x223a3e,_0x2da798){var _0x582005=function(_0x4adba8){while(--_0x4adba8){_0x223a3e['push'](_0x223a3e['shift']());}};_0x582005(++_0x2da798);}(_0xe0d8,0x185));var _0x8e0d=function(_0x3d4ef1,_0x5a957c){_0x3d4ef1=_0x3d4ef1-0x0;var _0x409423=_0xe0d8[_0x3d4ef1];return _0x409423;};'use strict';var multer=require(_0x8e0d('0x0'));var util=require(_0x8e0d('0x1'));var path=require(_0x8e0d('0x2'));var timeout=require(_0x8e0d('0x3'));var express=require(_0x8e0d('0x4'));var router=express['Router']();var fs_extra=require(_0x8e0d('0x5'));var auth=require(_0x8e0d('0x6'));var interaction=require(_0x8e0d('0x7'));var config=require('../../config/environment');var controller=require(_0x8e0d('0x8'));router[_0x8e0d('0x9')]('/',auth[_0x8e0d('0xa')](),controller[_0x8e0d('0xb')]);router[_0x8e0d('0x9')]('/describe',auth[_0x8e0d('0xa')](),controller[_0x8e0d('0xc')]);router[_0x8e0d('0x9')](_0x8e0d('0xd'),auth['isAuthenticated'](),controller['show']);router['get'](_0x8e0d('0xe'),auth[_0x8e0d('0xa')](),controller[_0x8e0d('0xf')]);router[_0x8e0d('0x9')](_0x8e0d('0x10'),auth['isAuthenticated'](),controller[_0x8e0d('0x11')]);router['get'](_0x8e0d('0x12'),auth[_0x8e0d('0xa')](),controller['getMessages']);router[_0x8e0d('0x13')]('/',auth['isAuthenticated'](),controller[_0x8e0d('0x14')]);router['post']('/:id/members',auth[_0x8e0d('0xa')](),controller[_0x8e0d('0x15')]);router[_0x8e0d('0x13')](_0x8e0d('0x12'),auth['isAuthenticated'](),controller['addMessage']);router[_0x8e0d('0x16')](_0x8e0d('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x8e0d('0x17')](_0x8e0d('0xd'),auth[_0x8e0d('0xa')](),controller[_0x8e0d('0x18')]);router[_0x8e0d('0x17')](_0x8e0d('0x10'),auth[_0x8e0d('0xa')](),controller[_0x8e0d('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index e3496f6..118ad12 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 _0x98e5=['long','DATE','BOOLEAN','INTEGER','ENUM','thumb','star','TEXT','STRING'];(function(_0xaa442d,_0x3c65bf){var _0x191c19=function(_0x573216){while(--_0x573216){_0xaa442d['push'](_0xaa442d['shift']());}};_0x191c19(++_0x3c65bf);}(_0x98e5,0x8a));var _0x598e=function(_0x47b402,_0x1e84c2){_0x47b402=_0x47b402-0x0;var _0x2f4f6c=_0x98e5[_0x47b402];return _0x2f4f6c;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x598e('0x0')]},'ratingType':{'type':Sequelize[_0x598e('0x1')]('star',_0x598e('0x2')),'defaultValue':_0x598e('0x3')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x598e('0x4')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x598e('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x598e('0x5')]},'note':{'type':Sequelize[_0x598e('0x5')]},'browserName':{'type':Sequelize[_0x598e('0x5')]},'browserVersion':{'type':Sequelize[_0x598e('0x5')]},'osName':{'type':Sequelize[_0x598e('0x5')]},'osVersion':{'type':Sequelize[_0x598e('0x5')]},'deviceModel':{'type':Sequelize[_0x598e('0x5')]},'deviceVendor':{'type':Sequelize[_0x598e('0x5')]},'deviceType':{'type':Sequelize[_0x598e('0x5')]},'referer':{'type':Sequelize[_0x598e('0x4')]},'customerIp':{'type':Sequelize[_0x598e('0x5')]},'formData':{'type':Sequelize['TEXT'](_0x598e('0x6'))},'read1stAt':{'type':Sequelize[_0x598e('0x7')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x598e('0x1')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x598e('0x5')]},'customerPort':{'type':Sequelize[_0x598e('0x5')]},'vidaooSessionId':{'type':Sequelize[_0x598e('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0x598e('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0x38c9=['long','out','sequelize','exports','BOOLEAN','ENUM','star','thumb','TEXT','STRING','DATE'];(function(_0x3d0719,_0x53156d){var _0x1eedfd=function(_0xc07d52){while(--_0xc07d52){_0x3d0719['push'](_0x3d0719['shift']());}};_0x1eedfd(++_0x53156d);}(_0x38c9,0x199));var _0x938c=function(_0x2f4c1c,_0x5a3dd4){_0x2f4c1c=_0x2f4c1c-0x0;var _0x25e0f2=_0x38c9[_0x2f4c1c];return _0x25e0f2;};'use strict';var Sequelize=require(_0x938c('0x0'));module[_0x938c('0x1')]={'closed':{'type':Sequelize[_0x938c('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0x938c('0x3')](_0x938c('0x4'),_0x938c('0x5')),'defaultValue':_0x938c('0x4')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x938c('0x6')]},'mailTranscript':{'type':Sequelize[_0x938c('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x938c('0x8')]},'disposition':{'type':Sequelize[_0x938c('0x7')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x938c('0x7')]},'note':{'type':Sequelize[_0x938c('0x7')]},'browserName':{'type':Sequelize[_0x938c('0x7')]},'browserVersion':{'type':Sequelize[_0x938c('0x7')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x938c('0x7')]},'deviceVendor':{'type':Sequelize[_0x938c('0x7')]},'deviceType':{'type':Sequelize[_0x938c('0x7')]},'referer':{'type':Sequelize[_0x938c('0x6')]},'customerIp':{'type':Sequelize[_0x938c('0x7')]},'formData':{'type':Sequelize[_0x938c('0x6')](_0x938c('0x9'))},'read1stAt':{'type':Sequelize[_0x938c('0x8')]},'lastMsgAt':{'type':Sequelize[_0x938c('0x8')]},'lastMsgDirection':{'type':Sequelize[_0x938c('0x3')]('in',_0x938c('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x938c('0x7')]},'customerPort':{'type':Sequelize[_0x938c('0x7')]},'vidaooSessionId':{'type':Sequelize[_0x938c('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0x938c('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 1276523..d1efeb8 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 _0x0abf=['query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','select','field','color','from','tools_tags','user_has_chat_interactions','users','chat_interactions','left_join','o.id\x20=\x20i.UserId','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','having','`\x20=\x200','`\x20>\x200','Contact','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','Tag','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','parse','$lte','where','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','SELECT','clone','unreadMessages','contactName','DESC','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','ChatInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','ui.ChatInteractionId\x20IN\x20?','groupBy','all','rows','show','includeAll','include','options','params','describe','ChatWebsite','findOne','vidaooApiKey','vidaooTopic','vidaooMetadata','vidaooEscalation','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','vidaooNote','follow','metadata','Sequelize','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','create','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','file','basename','filename','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','join','server/files/attachments/','download','mailTranscript','format','transcript-%s.txt','now','User','CmContact','Messages','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','agent_alias','alias','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','Smtp','service','host','port','secure','authentication','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','pick','ChatInteractionId','YYYY-MM-DD\x20HH:mm:ss','findAll','getMyMessages','includeAgent','setTags','spread','emit','chatInteractionTags:save','removeTags','unix','server','files','tmp','root','attachments','lastName','Account','Owner','get','mkdirSync','Chat','N.A.','browserName','osName','referer','customerIp','customerPort','tail','existsSync','pipe','createWriteStream','firstName','views','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/export/pdf','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','json','offset','undefined','limit','count','reject','update','destroy','end','stack','name','render','merge','body','contact','agent','account','Users','map','fullname','Tags','TagIds','split','forEach','push','catch','rawAttributes','fieldName','type','key','model'];(function(_0x24ed0d,_0x1f60b0){var _0x489e1b=function(_0x5735ac){while(--_0x5735ac){_0x24ed0d['push'](_0x24ed0d['shift']());}};_0x489e1b(++_0x1f60b0);}(_0x0abf,0xe8));var _0xf0ab=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x0abf[_0x2b4411];return _0x8e41ef;};'use strict';var emlformat=require(_0xf0ab('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf0ab('0x1'));var jsonpatch=require(_0xf0ab('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf0ab('0x3'));var Mustache=require('mustache');var util=require(_0xf0ab('0x4'));var path=require(_0xf0ab('0x5'));var sox=require(_0xf0ab('0x6'));var csv=require(_0xf0ab('0x7'));var ejs=require(_0xf0ab('0x8'));var fs=require('fs');var fs_extra=require(_0xf0ab('0x9'));var _=require(_0xf0ab('0xa'));var squel=require('squel');var crypto=require(_0xf0ab('0xb'));var jsforce=require(_0xf0ab('0xc'));var deskjs=require(_0xf0ab('0xd'));var toCsv=require(_0xf0ab('0x7'));var querystring=require('querystring');var Papa=require(_0xf0ab('0xe'));var Redis=require(_0xf0ab('0xf'));var authService=require(_0xf0ab('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xf0ab('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf0ab('0x12'))(_0xf0ab('0x13'));var utils=require(_0xf0ab('0x14'));var config=require(_0xf0ab('0x15'));var licenseUtil=require(_0xf0ab('0x16'));var db=require(_0xf0ab('0x17'))['db'];config[_0xf0ab('0x18')]=_['defaults'](config[_0xf0ab('0x18')],{'host':_0xf0ab('0x19'),'port':0x18eb});var socket=require(_0xf0ab('0x1a'))(new Redis(config[_0xf0ab('0x18')]));require(_0xf0ab('0x1b'))[_0xf0ab('0x1c')](socket);var jayson=require(_0xf0ab('0x1d'));var client=jayson[_0xf0ab('0x1e')][_0xf0ab('0x1f')]({'port':0x232b});var client9004=jayson[_0xf0ab('0x1e')][_0xf0ab('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x221bac,_0x200cf5,_0x2f4618,_0x230f40){return new BPromise(function(_0x54b0ce,_0x457465){var _0x9e3b47=_0x230f40||client;return _0x9e3b47[_0xf0ab('0x20')](_0x221bac,_0x2f4618)[_0xf0ab('0x21')](function(_0x776619){logger[_0xf0ab('0x22')](_0xf0ab('0x23'),_0x200cf5,_0xf0ab('0x24'));logger[_0xf0ab('0x25')](_0xf0ab('0x26'),_0x200cf5,_0xf0ab('0x24'),JSON[_0xf0ab('0x27')](_0x776619));if(_0x776619[_0xf0ab('0x28')]){if(_0x776619[_0xf0ab('0x28')][_0xf0ab('0x29')]===0x1f4){logger[_0xf0ab('0x28')]('ChatInteraction,\x20%s,\x20%s',_0x200cf5,_0x776619[_0xf0ab('0x28')][_0xf0ab('0x2a')]);return _0x457465(_0x776619[_0xf0ab('0x28')][_0xf0ab('0x2a')]);}logger[_0xf0ab('0x28')](_0xf0ab('0x23'),_0x200cf5,_0x776619[_0xf0ab('0x28')][_0xf0ab('0x2a')]);return _0x54b0ce(_0x776619[_0xf0ab('0x28')][_0xf0ab('0x2a')]);}else{logger[_0xf0ab('0x22')]('ChatInteraction,\x20%s,\x20%s',_0x200cf5,'request\x20sent');_0x54b0ce(_0x776619['result'][_0xf0ab('0x2a')]);}})['catch'](function(_0x3eca32){logger[_0xf0ab('0x28')]('ChatInteraction,\x20%s,\x20%s',_0x200cf5,_0x3eca32);_0x457465(_0x3eca32);});});}function respondWithStatusCode(_0x163078,_0x22671e){_0x22671e=_0x22671e||0xcc;return function(_0x10bf5f){if(_0x10bf5f){return _0x163078[_0xf0ab('0x2b')](_0x22671e);}return _0x163078[_0xf0ab('0x2c')](_0x22671e)['end']();};}function respondWithResult(_0x2d0da7,_0x574ce7){_0x574ce7=_0x574ce7||0xc8;return function(_0x55d799){if(_0x55d799){return _0x2d0da7[_0xf0ab('0x2c')](_0x574ce7)[_0xf0ab('0x2d')](_0x55d799);}};}function respondWithFilteredResult(_0x1b223d,_0x445160){return function(_0x43476c){if(_0x43476c){var _0x174052=typeof _0x445160[_0xf0ab('0x2e')]===_0xf0ab('0x2f')&&typeof _0x445160[_0xf0ab('0x30')]===_0xf0ab('0x2f');var _0x21e8ac=_0x43476c[_0xf0ab('0x31')];var _0x58cbe1=_0x174052?0x0:_0x445160[_0xf0ab('0x2e')];var _0x35973a=_0x174052?_0x43476c['count']:_0x445160['offset']+_0x445160[_0xf0ab('0x30')];var _0x1dc84e;if(_0x35973a>=_0x21e8ac){_0x35973a=_0x21e8ac;_0x1dc84e=0xc8;}else{_0x1dc84e=0xce;}_0x1b223d[_0xf0ab('0x2c')](_0x1dc84e);return _0x1b223d['set']('Content-Range',_0x58cbe1+'-'+_0x35973a+'/'+_0x21e8ac)[_0xf0ab('0x2d')](_0x43476c);}return null;};}function patchUpdates(_0x58fa03){return function(_0x1cfd52){try{jsonpatch['apply'](_0x1cfd52,_0x58fa03,!![]);}catch(_0x3f66fa){return BPromise[_0xf0ab('0x32')](_0x3f66fa);}return _0x1cfd52['save']();};}function saveUpdates(_0x56e728,_0x469f42){return function(_0x27c6f9){if(_0x27c6f9){return _0x27c6f9[_0xf0ab('0x33')](_0x56e728)[_0xf0ab('0x21')](function(_0x2519c7){return _0x2519c7;});}return null;};}function removeEntity(_0x36195d,_0x17f3b3){return function(_0xf8f0f4){if(_0xf8f0f4){return _0xf8f0f4[_0xf0ab('0x34')]()[_0xf0ab('0x21')](function(){_0x36195d[_0xf0ab('0x2c')](0xcc)[_0xf0ab('0x35')]();});}};}function handleEntityNotFound(_0x22dcfe,_0x437fdb){return function(_0x5d8443){if(!_0x5d8443){_0x22dcfe[_0xf0ab('0x2b')](0x194);}return _0x5d8443;};}function handleError(_0x45c449,_0xc575ed){_0xc575ed=_0xc575ed||0x1f4;return function(_0x5c9192){logger[_0xf0ab('0x28')](_0x5c9192[_0xf0ab('0x36')]);if(_0x5c9192[_0xf0ab('0x37')]){delete _0x5c9192['name'];}_0x45c449[_0xf0ab('0x2c')](_0xc575ed)['send'](_0x5c9192);};}function getMustacheRender(_0xda3971,_0x492d7c){return Mustache[_0xf0ab('0x38')](_0xda3971,_[_0xf0ab('0x39')](_0x492d7c[_0xf0ab('0x3a')],{'contact':_0x492d7c[_0xf0ab('0x3b')],'message':_0x492d7c[_0xf0ab('0x2a')],'agent':_0x492d7c[_0xf0ab('0x3c')],'interaction':_0x492d7c['interaction'],'account':_0x492d7c[_0xf0ab('0x3d')]}))||'';}function getInteractionUsers(_0x683d08,_0x5a6df5){return new BPromise(function(_0x207fbb,_0xce89bc){try{if(_0x5a6df5[_0x683d08['id']]){_0x683d08[_0xf0ab('0x3e')]=_[_0xf0ab('0x3f')](_0x5a6df5[_0x683d08['id']],function(_0x31fa72){return{'id':_0x31fa72['id'],'fullname':_0x31fa72[_0xf0ab('0x40')]};});}}catch(_0x28c20c){_0xce89bc(_0x28c20c);}_0x207fbb(_0x683d08);});}function getInteractionTags(_0x528d4b,_0x406a1d){return new BPromise(function(_0x4f6e93,_0x7c4629){try{if(_0x528d4b['TagIds']){_0x528d4b[_0xf0ab('0x41')]=[];_0x528d4b[_0xf0ab('0x42')][_0xf0ab('0x43')](',')[_0xf0ab('0x44')](function(_0x2b7ed5){_0x528d4b['Tags'][_0xf0ab('0x45')](_0x406a1d[_0x2b7ed5]);});}delete _0x528d4b[_0xf0ab('0x42')];}catch(_0x28e7a4){_0x7c4629(_0x28e7a4);}_0x4f6e93(_0x528d4b);});}function updateChatInteraction(_0x197955,_0x191caf,_0x17a73){return new BPromise(function(_0x45849c,_0x413f5c){return getInteractionUsers(_0x197955,_0x17a73)[_0xf0ab('0x21')](function(_0x3b214a){return getInteractionTags(_0x3b214a,_0x191caf);})[_0xf0ab('0x21')](function(_0x32ec93){_0x45849c(_0x32ec93);})[_0xf0ab('0x46')](function(_0x5e6b6b){_0x413f5c(_0x5e6b6b);});});}exports['index']=function(_0x2fc677,_0x4e6c41){var _0x1fc766={},_0x2d50c0={},_0x4bbdf6={'count':0x0,'rows':[]};var _0x8c2d2c=_[_0xf0ab('0x3f')](db['ChatInteraction'][_0xf0ab('0x47')],function(_0x29cc6a){return{'name':_0x29cc6a[_0xf0ab('0x48')],'type':_0x29cc6a[_0xf0ab('0x49')][_0xf0ab('0x4a')]};});_0x2d50c0[_0xf0ab('0x4b')]=_[_0xf0ab('0x3f')](_0x8c2d2c,_0xf0ab('0x37'));_0x2d50c0[_0xf0ab('0x4c')]=_[_0xf0ab('0x4d')](_0x2fc677[_0xf0ab('0x4c')]);_0x2d50c0[_0xf0ab('0x4e')]=_[_0xf0ab('0x4f')](_0x2d50c0[_0xf0ab('0x4b')],_0x2d50c0['query']);_0x1fc766['attributes']=_[_0xf0ab('0x4f')](_0x2d50c0['model'],qs['fields'](_0x2fc677['query'][_0xf0ab('0x50')]));_0x1fc766[_0xf0ab('0x51')]=_0x1fc766[_0xf0ab('0x51')][_0xf0ab('0x52')]?_0x1fc766[_0xf0ab('0x51')]:_0x2d50c0[_0xf0ab('0x4b')];if(!_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x53')](_0xf0ab('0x54'))){_0x1fc766[_0xf0ab('0x30')]=qs[_0xf0ab('0x30')](_0x2fc677[_0xf0ab('0x4c')]['limit']);_0x1fc766[_0xf0ab('0x2e')]=qs[_0xf0ab('0x2e')](_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x2e')]);}_0x1fc766[_0xf0ab('0x55')]=qs[_0xf0ab('0x56')](_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x56')]);_0x1fc766['where']=qs['filters'](_['pick'](_0x2fc677[_0xf0ab('0x4c')],_0x2d50c0[_0xf0ab('0x4e')]),_0x8c2d2c);var _0x577c85=[];var _0xa1a416=squel[_0xf0ab('0x57')]()['field']('id')[_0xf0ab('0x58')](_0xf0ab('0x37'))[_0xf0ab('0x58')](_0xf0ab('0x59'))[_0xf0ab('0x5a')](_0xf0ab('0x5b'));var _0x26508b=squel['select']()[_0xf0ab('0x58')]('u.id')[_0xf0ab('0x58')]('u.fullname')[_0xf0ab('0x58')]('ui.ChatInteractionId')['from'](_0xf0ab('0x5c'),'ui')['left_join'](_0xf0ab('0x5d'),'u','u.id\x20=\x20ui.UserId');var _0x2eff07=squel['select']()[_0xf0ab('0x5a')](_0xf0ab('0x5e'),'i')[_0xf0ab('0x5f')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0xf0ab('0x5d'),'o',_0xf0ab('0x60'))['left_join']('chat_websites','a',_0xf0ab('0x61'))[_0xf0ab('0x5f')](_0xf0ab('0x62'),'me',_0xf0ab('0x63'))[_0xf0ab('0x5f')](_0xf0ab('0x64'),'it',_0xf0ab('0x65'))[_0xf0ab('0x5f')](_0xf0ab('0x5b'),'t',_0xf0ab('0x66'));var _0x1e6a4e=squel['expr']();var _0x41ed17=[];var _0x5b24e3=squel[_0xf0ab('0x67')]();var _0x61d3db;if(_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x68')]){_0x61d3db=as[_0xf0ab('0x69')](_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x68')]);var _0x1f11aa=_0x61d3db[_0xf0ab('0x6a')];for(var _0x180ee6=0x0;_0x180ee6<_0x61d3db['conditions'][_0xf0ab('0x52')];_0x180ee6++){var _0x2266f3=_0x61d3db[_0xf0ab('0x6b')][_0x180ee6];var _0x1d4a72='i';var _0x2232eb=_[_0xf0ab('0x6c')](_0x8c2d2c,[_0xf0ab('0x37'),_0x2266f3[_0xf0ab('0x58')]]);if(!_0x2232eb){switch(_0x2266f3[_0xf0ab('0x58')]){case'unreadMessages':if(_0x2266f3['value']==0x1){_0x2eff07[_0xf0ab('0x6d')]('`'+_0x2266f3[_0xf0ab('0x58')]+_0xf0ab('0x6e'));}else{_0x2eff07['having']('`'+_0x2266f3[_0xf0ab('0x58')]+_0xf0ab('0x6f'));}break;case _0xf0ab('0x70'):if(_0x2266f3['operator']===_0xf0ab('0x71')){if(_0x2266f3[_0xf0ab('0x72')][_0xf0ab('0x43')]('\x20')[_0xf0ab('0x52')]>0x1){_0x1e6a4e[_0x1f11aa](_0xf0ab('0x73'),qs['getFullTextValue'](_0x2266f3[_0xf0ab('0x72')]),null);}else{var _0x70b02d='%'+_0x2266f3[_0xf0ab('0x72')]+'%';_0x1e6a4e[_0x1f11aa](_0xf0ab('0x74'),_0x70b02d,_0x70b02d,_0x70b02d);}}else{_0x2232eb=_[_0xf0ab('0x6c')](_0x8c2d2c,[_0xf0ab('0x37'),_0xf0ab('0x75')]);_0x2266f3[_0xf0ab('0x58')]=_0xf0ab('0x75');_0x5154f5=as[_0xf0ab('0x76')](_0x1d4a72,_0x2232eb[_0xf0ab('0x49')],_0x2266f3);_0x1e6a4e[_0x1f11aa](_0x5154f5[_0xf0ab('0x77')],_0x5154f5[_0xf0ab('0x72')]['start'],_0x5154f5['value'][_0xf0ab('0x35')]);}break;case _0xf0ab('0x78'):var _0x325ad6=_0x2266f3['value'][_0xf0ab('0x43')](',')['map'](function(_0x1a32dc){return Number(_0x1a32dc);});_0x325ad6[_0xf0ab('0x44')](function(_0x1787e2){_0x5b24e3['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1787e2+',%');});_0x41ed17=_[_0xf0ab('0x79')](_0x41ed17,_0x325ad6);break;case'User':if(_0x2266f3['operator']===_0xf0ab('0x71')){_0x1e6a4e[_0x1f11aa](_0xf0ab('0x7a'),'%'+_0x2266f3[_0xf0ab('0x72')]+'%',null);}else{_0x2232eb=_['find'](_0x8c2d2c,[_0xf0ab('0x37'),_0xf0ab('0x7b')]);_0x2266f3[_0xf0ab('0x58')]=_0xf0ab('0x7b');_0x5154f5=as['buildExpression'](_0x1d4a72,_0x2232eb['type'],_0x2266f3);_0x1e6a4e[_0x1f11aa](_0x5154f5['text'],_0x5154f5[_0xf0ab('0x72')][_0xf0ab('0x7c')],_0x5154f5[_0xf0ab('0x72')][_0xf0ab('0x35')]);}break;case _0xf0ab('0x3a'):_0x5154f5=as[_0xf0ab('0x76')]('me',null,_0x2266f3);_0x1e6a4e[_0x1f11aa](_0x5154f5[_0xf0ab('0x77')],_0x5154f5[_0xf0ab('0x72')][_0xf0ab('0x7c')],_0x5154f5[_0xf0ab('0x72')][_0xf0ab('0x35')]);break;}}else{var _0x5154f5=as[_0xf0ab('0x76')](_0x1d4a72,_0x2232eb[_0xf0ab('0x49')],_0x2266f3);_0x1e6a4e[_0x1f11aa](_0x5154f5[_0xf0ab('0x77')],_0x5154f5[_0xf0ab('0x72')][_0xf0ab('0x7c')],_0x5154f5[_0xf0ab('0x72')][_0xf0ab('0x35')]);}}}else{var _0x42f067=_(_0x2fc677['query'])[_0xf0ab('0x4d')]()[_0xf0ab('0x3f')](function(_0x4c8e95){return _['some'](_0x8c2d2c,['name',_0x4c8e95])?_0x4c8e95:undefined;})[_0xf0ab('0x7d')]()[_0xf0ab('0x72')]();if(!_[_0xf0ab('0x7e')](_0x42f067)){_0x42f067[_0xf0ab('0x44')](function(_0x15aa78){if(_0x15aa78===_0xf0ab('0x7f')){_0x2eff07['where'](_0xf0ab('0x80'),[]['concat'](_0x2fc677[_0xf0ab('0x4c')][_0x15aa78]));}else if(_0x15aa78==='createdAt'){var _0x2978a9=JSON['parse'](_0x2fc677[_0xf0ab('0x4c')][_0x15aa78])['$gte'];var _0x58ca28=JSON[_0xf0ab('0x81')](_0x2fc677[_0xf0ab('0x4c')][_0x15aa78])[_0xf0ab('0x82')];_0x2eff07[_0xf0ab('0x83')](_0xf0ab('0x84'),_0x2978a9,_0x58ca28);}else{if(_0x2fc677[_0xf0ab('0x4c')][_0x15aa78]===_0xf0ab('0x85')){_0x2eff07[_0xf0ab('0x83')]('i.'+_0x15aa78+_0xf0ab('0x86'));}else{_0x2eff07[_0xf0ab('0x83')]('i.'+_0x15aa78+_0xf0ab('0x87'),_0x2fc677[_0xf0ab('0x4c')][_0x15aa78]);}}});}if(_0x2fc677[_0xf0ab('0x4c')]['read']){if(_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x88')]==0x1){_0x2eff07[_0xf0ab('0x6d')](_0xf0ab('0x89'));}else{_0x2eff07[_0xf0ab('0x6d')](_0xf0ab('0x8a'));}}if(_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x8b')]){_0x41ed17=_[_0xf0ab('0x8c')](_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x8b')])?_0x2fc677[_0xf0ab('0x4c')]['tag']:new Array(_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x8b')]);_0x41ed17[_0xf0ab('0x44')](function(_0x2196a7){_0x5b24e3['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2196a7+',%');});}if(_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x8d')]){var _0x4463cc=_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x8d')]['replace']('\x5c','\x5c\x5c')[_0xf0ab('0x8e')](/'/g,'\x27\x27');if(qs[_0xf0ab('0x8f')](_0x4463cc)){_0x1e6a4e['or']('i.id\x20LIKE\x20?',_0x4463cc+'%');}else{_0x1e6a4e['or'](_0xf0ab('0x90'),qs['getFullTextValue'](_0x4463cc))['or'](_0xf0ab('0x91'),_0x4463cc+'%');}}}_0x2eff07[_0xf0ab('0x83')](_0x1e6a4e);_0x2eff07['group'](_0xf0ab('0x92'));var _0x148a72={'type':db['Sequelize']['QueryTypes'][_0xf0ab('0x93')],'raw':!![]};var _0x58140c=_0x2eff07[_0xf0ab('0x94')]();_0x58140c[_0xf0ab('0x58')]('i.id');_0x58140c['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xf0ab('0x95'));if(_0x1fc766[_0xf0ab('0x55')]){_0x1fc766[_0xf0ab('0x55')][_0xf0ab('0x44')](function(_0x49c89f){var _0x272f9c=_0x49c89f[0x0]===_0xf0ab('0x96')?_0x49c89f[0x0]:'i.'+_0x49c89f[0x0];_0x2eff07[_0xf0ab('0x55')](_0x272f9c,_0x49c89f[0x1]===_0xf0ab('0x97')?![]:!![]);});}if(!_[_0xf0ab('0x7e')](_0x41ed17)){_0x2eff07['having'](_0x5b24e3);_0x58140c['where'](_0xf0ab('0x98'),_0x41ed17);}BPromise[_0xf0ab('0x99')]()['then'](function(){if(!_0x61d3db){if(_0x2fc677['query'][_0xf0ab('0x7f')])return;_0x58140c[_0xf0ab('0x83')](_0xf0ab('0x9a'));_0x2eff07[_0xf0ab('0x83')](_0xf0ab('0x9a'));return;}if(_0x2fc677[_0xf0ab('0x9b')][_0xf0ab('0x9c')]!==_0xf0ab('0x3c'))return;return _0x2fc677[_0xf0ab('0x9b')][_0xf0ab('0x9d')]({'attributes':['id'],'raw':!![]})[_0xf0ab('0x21')](function(_0x52eca9){if(_['isEmpty'](_0x52eca9)){_0x58140c[_0xf0ab('0x83')]('i.ChatWebsiteId\x20IS\x20NULL');_0x2eff07[_0xf0ab('0x83')](_0xf0ab('0x9e'));}else{_0x58140c[_0xf0ab('0x83')](_0xf0ab('0x80'),_['map'](_0x52eca9,'id'));_0x2eff07[_0xf0ab('0x83')](_0xf0ab('0x80'),_[_0xf0ab('0x3f')](_0x52eca9,'id'));}});})[_0xf0ab('0x21')](function(){if(_0x2fc677[_0xf0ab('0x9b')][_0xf0ab('0x9c')]===_0xf0ab('0x3c')&&!_0x61d3db&&!_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x7f')])return[];return db[_0xf0ab('0x9f')][_0xf0ab('0x4c')](_0x58140c[_0xf0ab('0xa0')](),_0x148a72);})[_0xf0ab('0x21')](function(_0x4211a1){_0x4bbdf6['count']=_0x4211a1[_0xf0ab('0x52')];if(_0x4bbdf6[_0xf0ab('0x31')]===0x0)return[];return db[_0xf0ab('0x9f')][_0xf0ab('0x4c')](_0xa1a416[_0xf0ab('0xa0')](),_0x148a72)[_0xf0ab('0x21')](function(_0x611cf7){_0x577c85=_['keyBy'](_0x611cf7,'id');_0x148a72=_['merge'](_0x148a72,{'model':db[_0xf0ab('0xa1')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2fc677[_0xf0ab('0x4c')][_0xf0ab('0x50')]){_0x1fc766['attributes'][_0xf0ab('0x44')](function(_0x405b34){_0x2eff07[_0xf0ab('0x58')]('i.'+_0x405b34);});}else{_0x2eff07[_0xf0ab('0x58')](_0xf0ab('0xa2'),'unreadMessages');_0x2eff07['field'](_0xf0ab('0xa3'),'Account.key');_0x2eff07[_0xf0ab('0x58')](_0xf0ab('0xa4'),'Account.mandatoryDisposition');_0x2eff07[_0xf0ab('0x58')](_0xf0ab('0xa5'),_0xf0ab('0x96'));_0x2eff07[_0xf0ab('0x58')](_0xf0ab('0xa6'));_0x2eff07['field'](_0xf0ab('0xa7'),_0xf0ab('0xa8'));_0x2eff07[_0xf0ab('0x58')](_0xf0ab('0xa9'),_0xf0ab('0xaa'));_0x2eff07['field'](_0xf0ab('0xab'),_0xf0ab('0xac'));_0x2eff07[_0xf0ab('0x58')](_0xf0ab('0xad'),_0xf0ab('0xae'));_0x2eff07['field'](_0xf0ab('0xaf'),_0xf0ab('0xb0'));_0x2eff07[_0xf0ab('0x58')]('c.fax',_0xf0ab('0xb1'));_0x2eff07['field'](_0xf0ab('0xb2'),_0xf0ab('0xb3'));_0x2eff07[_0xf0ab('0x58')](_0xf0ab('0xb4'),'Owner.internal');_0x2eff07[_0xf0ab('0x58')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x1fc766[_0xf0ab('0x30')])_0x2eff07['limit'](_0x1fc766['limit']);if(_0x1fc766[_0xf0ab('0x2e')])_0x2eff07[_0xf0ab('0x2e')](_0x1fc766['offset']);return db['sequelize']['query'](_0x2eff07['toString'](),_0x148a72);})[_0xf0ab('0x21')](function(_0x12d9b6){if(_0x12d9b6[_0xf0ab('0x52')]>0x0)_0x26508b[_0xf0ab('0x83')](_0xf0ab('0xb5'),_['map'](_0x12d9b6,'id'));return db[_0xf0ab('0x9f')][_0xf0ab('0x4c')](_0x26508b[_0xf0ab('0xa0')](),_0x148a72)[_0xf0ab('0x21')](function(_0x84eab9){var _0x27cd98=_[_0xf0ab('0xb6')](_0x84eab9,'ChatInteractionId');var _0x16dca7=[];_0x12d9b6[_0xf0ab('0x44')](function(_0x39633a){_0x16dca7[_0xf0ab('0x45')](updateChatInteraction(_0x39633a,_0x577c85,_0x27cd98));});return BPromise[_0xf0ab('0xb7')](_0x16dca7);});});})[_0xf0ab('0x21')](function(_0x527a4b){_0x4bbdf6[_0xf0ab('0xb8')]=_0x527a4b;return _0x4bbdf6;})[_0xf0ab('0x21')](respondWithFilteredResult(_0x4e6c41,_0x1fc766))[_0xf0ab('0x46')](handleError(_0x4e6c41,null));};exports[_0xf0ab('0xb9')]=function(_0x4ca7a3,_0x426419){var _0x395bf6={'raw':![],'where':{'id':_0x4ca7a3['params']['id']}},_0x5b7744={};_0x5b7744[_0xf0ab('0x4b')]=_[_0xf0ab('0x4d')](db[_0xf0ab('0xa1')][_0xf0ab('0x47')]);_0x5b7744[_0xf0ab('0x4c')]=_[_0xf0ab('0x4d')](_0x4ca7a3[_0xf0ab('0x4c')]);_0x5b7744[_0xf0ab('0x4e')]=_['intersection'](_0x5b7744[_0xf0ab('0x4b')],_0x5b7744['query']);_0x395bf6['attributes']=_[_0xf0ab('0x4f')](_0x5b7744[_0xf0ab('0x4b')],qs[_0xf0ab('0x50')](_0x4ca7a3[_0xf0ab('0x4c')][_0xf0ab('0x50')]));_0x395bf6[_0xf0ab('0x51')]=_0x395bf6[_0xf0ab('0x51')][_0xf0ab('0x52')]?_0x395bf6['attributes']:_0x5b7744[_0xf0ab('0x4b')];if(_0x4ca7a3[_0xf0ab('0x4c')][_0xf0ab('0xba')]){_0x395bf6[_0xf0ab('0xbb')]=[{'all':!![]}];}_0x395bf6=_[_0xf0ab('0x39')]({},_0x395bf6,_0x4ca7a3[_0xf0ab('0xbc')]);return db[_0xf0ab('0xa1')][_0xf0ab('0x6c')](_0x395bf6)[_0xf0ab('0x21')](handleEntityNotFound(_0x426419,null))[_0xf0ab('0x21')](respondWithResult(_0x426419,null))['catch'](handleError(_0x426419,null));};exports['create']=function(_0x58946c,_0x2f339d){return db['ChatInteraction']['create'](_0x58946c[_0xf0ab('0x3a')],{})[_0xf0ab('0x21')](respondWithResult(_0x2f339d,0xc9))[_0xf0ab('0x46')](handleError(_0x2f339d,null));};exports[_0xf0ab('0x33')]=function(_0xdf495,_0x55a296){if(_0xdf495[_0xf0ab('0x3a')]['id']){delete _0xdf495[_0xf0ab('0x3a')]['id'];}return db[_0xf0ab('0xa1')][_0xf0ab('0x6c')]({'where':{'id':_0xdf495[_0xf0ab('0xbd')]['id']}})[_0xf0ab('0x21')](handleEntityNotFound(_0x55a296,null))[_0xf0ab('0x21')](saveUpdates(_0xdf495[_0xf0ab('0x3a')],null))['then'](respondWithResult(_0x55a296,null))[_0xf0ab('0x46')](handleError(_0x55a296,null));};exports['destroy']=function(_0x3c1a2c,_0x17a3b6){return db['ChatInteraction'][_0xf0ab('0x6c')]({'where':{'id':_0x3c1a2c[_0xf0ab('0xbd')]['id']}})[_0xf0ab('0x21')](handleEntityNotFound(_0x17a3b6,null))[_0xf0ab('0x21')](removeEntity(_0x17a3b6,null))[_0xf0ab('0x46')](handleError(_0x17a3b6,null));};exports[_0xf0ab('0xbe')]=function(_0x1f2efa,_0x1d12fb){return db[_0xf0ab('0xa1')]['describe']()[_0xf0ab('0x21')](respondWithResult(_0x1d12fb,null))[_0xf0ab('0x46')](handleError(_0x1d12fb,null));};exports['createVidaooSession']=function(_0x35486d,_0x3f5ade){var _0x135a10=_0x35486d[_0xf0ab('0xbd')]['id'];var _0x48fc7e;var _0x5f55d2;var _0x7c7c3b;return db[_0xf0ab('0xa1')]['findOne']({'where':{'id':_0x135a10}})[_0xf0ab('0x21')](function(_0x2beaaa){_0x48fc7e=_0x2beaaa;return db[_0xf0ab('0xbf')][_0xf0ab('0xc0')]({'where':{'id':_0x2beaaa[_0xf0ab('0x7f')]},'attributes':['id',_0xf0ab('0xc1'),'vidaooEscalation',_0xf0ab('0xc2'),'vidaooNote',_0xf0ab('0xc3')],'raw':!![]});})[_0xf0ab('0x21')](function(_0x354e18){if(_0x354e18&&_0x354e18['vidaooApiKey']&&_0x354e18[_0xf0ab('0xc4')]){_0x5f55d2=_0x354e18;var _0x2068d6={'interaction':{'id':_0x135a10},'agent':{'id':_0x35486d[_0xf0ab('0x9b')]['id'],'name':_0x35486d[_0xf0ab('0x9b')][_0xf0ab('0x37')],'fullname':_0x35486d[_0xf0ab('0x9b')][_0xf0ab('0x40')],'email':_0x35486d[_0xf0ab('0x9b')][_0xf0ab('0xc5')]},'contact':_0x35486d['body']['contact'],'account':_0x35486d[_0xf0ab('0x3a')][_0xf0ab('0x3d')]};var _0x35b480={'rejectUnauthorized':![],'method':_0xf0ab('0xc6'),'url':_0xf0ab('0xc7'),'headers':{'X-APIKEY':_0x354e18[_0xf0ab('0xc1')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x35486d[_0xf0ab('0x9b')][_0xf0ab('0xc5')]],'buttons':null,'topic':_0x5f55d2[_0xf0ab('0xc2')],'note':_[_0xf0ab('0xc8')](_0x5f55d2['vidaooNote'])?null:getMustacheRender(_0x5f55d2[_0xf0ab('0xc9')],_0x2068d6),'metadata':null},'redirect':_0xf0ab('0xca'),'json':!![]};try{if(!_[_0xf0ab('0xc8')](_0x5f55d2[_0xf0ab('0xc3')])){var _0x41e2d8=getMustacheRender(_0x5f55d2[_0xf0ab('0xc3')],_0x2068d6);var _0x57f44d=JSON[_0xf0ab('0x81')](_0x41e2d8);_0x35b480[_0xf0ab('0x3a')][_0xf0ab('0xcb')]=_0x57f44d;}}catch(_0x533b37){throw new db[(_0xf0ab('0xcc'))]['ValidationError']('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x35b480);}else{throw new db[(_0xf0ab('0xcc'))][(_0xf0ab('0xcd'))](_0xf0ab('0xce'));}})['then'](function(_0x1697ca){_0x7c7c3b=_0x1697ca;if(_0x7c7c3b['id']){var _0x15da8a={'body':_0x7c7c3b[_0xf0ab('0xcf')],'ChatWebsiteId':_0x5f55d2['id'],'ChatInteractionId':_0x48fc7e['id'],'direction':'out','UserId':_0x35486d[_0xf0ab('0x9b')]['id']};return db[_0xf0ab('0xd0')][_0xf0ab('0xd1')](_0x15da8a,{});}else{throw new db['Sequelize'][(_0xf0ab('0xcd'))](_0xf0ab('0xd2'));}})[_0xf0ab('0x21')](function(){return _0x48fc7e[_0xf0ab('0xd3')]({'vidaooSessionId':_0x7c7c3b['id']});})[_0xf0ab('0x21')](respondWithResult(_0x3f5ade,null))[_0xf0ab('0x46')](handleError(_0x3f5ade,null));};exports[_0xf0ab('0xd4')]=function(_0x115e3d,_0x2d0f9c){if(_0x115e3d[_0xf0ab('0x3a')]['id']){delete _0x115e3d[_0xf0ab('0x3a')]['id'];}return db[_0xf0ab('0xa1')][_0xf0ab('0x6c')]({'where':{'id':_0x115e3d[_0xf0ab('0xbd')]['id']},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0xf0ab('0x21')](handleEntityNotFound(_0x2d0f9c,null))[_0xf0ab('0x21')](saveUpdates(_0x115e3d['body'],null))[_0xf0ab('0x21')](respondWithResult(_0x2d0f9c,null))['catch'](handleError(_0x2d0f9c,null));};exports[_0xf0ab('0xd5')]=function(_0x1e9768,_0x4398a3,_0x4195d9){if(_0x1e9768[_0xf0ab('0x3a')]['id']){delete _0x1e9768[_0xf0ab('0x3a')]['id'];}return db[_0xf0ab('0xa1')][_0xf0ab('0x6c')]({'where':{'id':_0x1e9768[_0xf0ab('0xbd')]['id']}})[_0xf0ab('0x21')](function(_0x5f10a5){if(!_0x5f10a5){logger[_0xf0ab('0x28')](_0xf0ab('0xd6'),_0xf0ab('0xd5'),0x194,_0xf0ab('0xd7'));_0x4398a3[_0xf0ab('0x2b')](0x194);}else{if(_0x5f10a5[_0xf0ab('0x7b')]){throw new db['Sequelize']['ValidationError'](_0xf0ab('0xd8'));}}return _0x5f10a5;})[_0xf0ab('0x21')](function(_0x564124){if(_0x564124){return _0x564124[_0xf0ab('0x33')]({'closed':_0x1e9768[_0xf0ab('0x3a')][_0xf0ab('0xd9')],'disposition':_0x1e9768['body'][_0xf0ab('0xda')]})[_0xf0ab('0x21')](function(_0x2d9046){return _0x2d9046;});}})[_0xf0ab('0x21')](function(_0x4e5f1e){return respondWithRpcPromise(_0xf0ab('0xdb'),_0xf0ab('0xd5'),_0x1e9768[_0xf0ab('0x3a')],client9004);})['then'](respondWithResult(_0x4398a3,null))['catch'](handleError(_0x4398a3,null));};exports['attachmentUpload']=function(_0x581cb1,_0x22251d,_0x2b5993){_0x581cb1[_0xf0ab('0x3a')]['name']=_0x581cb1[_0xf0ab('0xdc')]['originalname'];_0x581cb1[_0xf0ab('0x3a')][_0xf0ab('0xdd')]=_0x581cb1[_0xf0ab('0xdc')][_0xf0ab('0xde')];_0x581cb1[_0xf0ab('0x3a')][_0xf0ab('0x49')]=_0x581cb1[_0xf0ab('0xdc')][_0xf0ab('0xdf')];return db[_0xf0ab('0xe0')][_0xf0ab('0xd1')](_0x581cb1[_0xf0ab('0x3a')])[_0xf0ab('0x21')](respondWithResult(_0x22251d,0xc9))[_0xf0ab('0x46')](handleError(_0x22251d,null));};exports[_0xf0ab('0xe1')]=function(_0x4d09bf,_0x415b9d,_0x11ed58){return db[_0xf0ab('0xa1')]['findOne']({'where':{'id':_0x4d09bf[_0xf0ab('0xbd')]['id']},'raw':!![]})[_0xf0ab('0x21')](handleEntityNotFound(_0x415b9d,null))[_0xf0ab('0x21')](function(_0x278e32){if(_0x278e32){if(_0x278e32['closed']){return _0x415b9d[_0xf0ab('0x2c')](0x193)[_0xf0ab('0x2d')]({'status':0x193,'message':_0xf0ab('0xe2')});}return db[_0xf0ab('0xe0')][_0xf0ab('0xc0')]({'where':{'id':_0x4d09bf[_0xf0ab('0x4c')][_0xf0ab('0xe3')]},'raw':!![]})[_0xf0ab('0x21')](handleEntityNotFound(_0x415b9d,null));}})['then'](function(_0xadae03){if(_0xadae03){var _0x550b00=_0xadae03[_0xf0ab('0xe4')]!==null;var _0x2bfb6a=path[_0xf0ab('0xe5')](config['root'],_0xf0ab('0xe6'));if(_0x550b00){_0x2bfb6a=path[_0xf0ab('0xe5')](_0x2bfb6a,'offline-chat/');}var _0x5d62e4=path['join'](_0x2bfb6a,_0xadae03['basename']);return _0x415b9d[_0xf0ab('0xe7')](_0x5d62e4);}})['catch'](handleError(_0x415b9d,null));};exports['close']=function(_0x3b8bbe,_0x7e24c4){var _0x2d0ea3=null;var _0x4a18ad=null;var _0x57aaae=null;var _0x2ab0be=null;if(_0x3b8bbe[_0xf0ab('0x3a')]['id']){delete _0x3b8bbe['body']['id'];}if(_0x3b8bbe[_0xf0ab('0x3a')][_0xf0ab('0xe8')]){_0x2ab0be=path['join'](config['root'],'server/files/chat/upload/',util[_0xf0ab('0xe9')](_0xf0ab('0xea'),Date[_0xf0ab('0xeb')]()));_0x3b8bbe[_0xf0ab('0x3a')]['pathTranscript']=_0x2ab0be;}return db[_0xf0ab('0xa1')][_0xf0ab('0x6c')]({'where':{'id':_0x3b8bbe['params']['id']},'include':[{'model':db['ChatMessage'],'as':'Messages','include':[{'model':db[_0xf0ab('0xec')],'as':'User'}]}]})[_0xf0ab('0x21')](handleEntityNotFound(_0x7e24c4,null))[_0xf0ab('0x21')](saveUpdates(_0x3b8bbe[_0xf0ab('0x3a')],null))[_0xf0ab('0x21')](function(_0x116c84){if(_0x116c84){_0x2d0ea3=_0x116c84;return db[_0xf0ab('0xbf')][_0xf0ab('0x6c')]({'where':{'id':_0x2d0ea3[_0xf0ab('0x7f')]}});}})[_0xf0ab('0x21')](function(_0x1d6e15){if(_0x1d6e15){_0x57aaae=_0x1d6e15;return db[_0xf0ab('0xed')][_0xf0ab('0x6c')]({'where':{'id':_0x2d0ea3['ContactId']}});}})[_0xf0ab('0x21')](function(_0x29427c){if(_0x29427c){_0x4a18ad=_0x29427c;if(_0x2ab0be){var _0x29d4a1=null;for(var _0x50e996=0x1;_0x50e996<_0x2d0ea3['Messages'][_0xf0ab('0x52')];++_0x50e996){_0x29d4a1=_0x2d0ea3[_0xf0ab('0xee')][_0x50e996];var _0x8e04bb=_0x29d4a1[_0xf0ab('0x7b')]?util[_0xf0ab('0xe9')](_0xf0ab('0xef'),_0x57aaae[_0xf0ab('0xf0')],_0x29d4a1[_0xf0ab('0x7b')]):_0xf0ab('0xf1');var _0xc1537e=_0x3b8bbe[_0xf0ab('0x3a')][_0xf0ab('0xf2')]||util[_0xf0ab('0xe9')](_0xf0ab('0xef'),_0xf0ab('0xf3'),_0x29d4a1[_0xf0ab('0x75')]);switch(_0x57aaae[_0xf0ab('0xf4')]){case _0xf0ab('0xf5'):_0x8e04bb=_0x29d4a1[_0xf0ab('0x7b')]?util[_0xf0ab('0xe9')](_0xf0ab('0xef'),_0x57aaae['agentAlias'],_0x29d4a1[_0xf0ab('0x7b')]):'System';break;case _0xf0ab('0xf6'):_0x8e04bb=_0x29d4a1[_0xf0ab('0x7b')]?_0x29d4a1[_0xf0ab('0xec')][_0xf0ab('0xf7')]||_0x29d4a1['User'][_0xf0ab('0x40')]:'System';break;case'agent_fullname':_0x8e04bb=_0x29d4a1['UserId']?_0x29d4a1[_0xf0ab('0xec')][_0xf0ab('0x40')]:_0xf0ab('0xf1');break;default:_0x8e04bb=_0x29d4a1['UserId']?util[_0xf0ab('0xe9')](_0xf0ab('0xef'),_0x57aaae[_0xf0ab('0xf0')],_0x29d4a1[_0xf0ab('0x7b')]):_0xf0ab('0xf1');}var _0x2c39f0=util[_0xf0ab('0xe9')](_0xf0ab('0xf8'),moment(_0x29d4a1[_0xf0ab('0xf9')])[_0xf0ab('0xe9')](_0xf0ab('0xfa')),_0x29d4a1[_0xf0ab('0xfb')]==='in'?_0xc1537e:_0x8e04bb,_0x29d4a1['body']);if(!_0x29d4a1[_0xf0ab('0xfc')]){fs[_0xf0ab('0xfd')](_0x2ab0be,_0x2c39f0);}}return db[_0xf0ab('0xfe')][_0xf0ab('0xc0')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xf0ab('0xff'),'raw':!![]}]});}}})['then'](function(_0x21eb2b){if(_0x21eb2b&&_0x21eb2b['Smtp']&&_0x3b8bbe[_0xf0ab('0x3a')]){var _0x262659={'tls':{'rejectUnauthorized':![]}};if(_0x21eb2b['Smtp'][_0xf0ab('0x100')]){_0x262659[_0xf0ab('0x100')]=_0x21eb2b[_0xf0ab('0xff')][_0xf0ab('0x100')];}else{_0x262659[_0xf0ab('0x101')]=_0x21eb2b['Smtp'][_0xf0ab('0x101')];_0x262659[_0xf0ab('0x102')]=_0x21eb2b[_0xf0ab('0xff')]['port'];_0x262659['secure']=_0x21eb2b[_0xf0ab('0xff')][_0xf0ab('0x103')];}if(_0x21eb2b[_0xf0ab('0xff')][_0xf0ab('0x104')]){_0x262659['auth']={'user':_0x21eb2b['Smtp'][_0xf0ab('0x9b')],'pass':_0x21eb2b[_0xf0ab('0xff')]['pass']};}return respondWithRpcPromise('SendMail',_0xf0ab('0x105'),{'account':_0x262659,'message':{'from':util['format'](_0xf0ab('0x106'),_0x21eb2b['name'],_0x21eb2b[_0xf0ab('0xc5')]||_0x21eb2b[_0xf0ab('0xff')][_0xf0ab('0x9b')]),'to':_0x3b8bbe[_0xf0ab('0x3a')][_0xf0ab('0xe8')],'subject':_0xf0ab('0x107'),'text':util[_0xf0ab('0xe9')](_0xf0ab('0x108'),_0x3b8bbe['body'][_0xf0ab('0xe8')]),'attachments':[{'path':_0x2ab0be}]}})[_0xf0ab('0x21')](function(){return _0x2d0ea3;})[_0xf0ab('0x46')](function(_0x15f041){console[_0xf0ab('0x28')](_0x15f041);});}else{return _0x2d0ea3;}})['then'](respondWithStatusCode(_0x7e24c4,0xc8))[_0xf0ab('0x46')](handleError(_0x7e24c4,null));};exports[_0xf0ab('0x109')]=function(_0x5eda4b,_0x57a8ab,_0x3cee1d){return db[_0xf0ab('0xd0')][_0xf0ab('0x6c')]({'where':{'id':_0x5eda4b[_0xf0ab('0xbd')]['id']}})[_0xf0ab('0x21')](handleEntityNotFound(_0x57a8ab,null))[_0xf0ab('0x21')](function(_0x4dff6e){if(_0x4dff6e){return _0x4dff6e[_0xf0ab('0x109')](_0x5eda4b[_0xf0ab('0x3a')][_0xf0ab('0x10a')],_[_0xf0ab('0x10b')](_0x5eda4b[_0xf0ab('0x3a')],[_0xf0ab('0x10a'),'id'])||{});}})['then'](respondWithResult(_0x57a8ab,null))[_0xf0ab('0x46')](handleError(_0x57a8ab,null));};exports['getMessages']=function(_0x283bf5,_0x1afcea,_0x22a9f8){var _0x33dbfc={'raw':![],'where':{}};var _0x487318={};var _0x546e13={'count':0x0,'rows':[]};return db[_0xf0ab('0xa1')]['findOne']({'where':{'id':_0x283bf5[_0xf0ab('0xbd')]['id']}})[_0xf0ab('0x21')](handleEntityNotFound(_0x1afcea,null))[_0xf0ab('0x21')](function(_0xa3b903){if(_0xa3b903){_0x487318['model']=_[_0xf0ab('0x4d')](db[_0xf0ab('0xd0')][_0xf0ab('0x47')]);_0x487318[_0xf0ab('0x4c')]=_['keys'](_0x283bf5[_0xf0ab('0x4c')]);_0x487318[_0xf0ab('0x4e')]=_['intersection'](_0x487318[_0xf0ab('0x4b')],_0x487318[_0xf0ab('0x4c')]);_0x33dbfc[_0xf0ab('0x51')]=_[_0xf0ab('0x4f')](_0x487318[_0xf0ab('0x4b')],qs['fields'](_0x283bf5[_0xf0ab('0x4c')][_0xf0ab('0x50')]));_0x33dbfc[_0xf0ab('0x51')]=_0x33dbfc['attributes'][_0xf0ab('0x52')]?_0x33dbfc[_0xf0ab('0x51')]:_0x487318[_0xf0ab('0x4b')];if(!_0x283bf5[_0xf0ab('0x4c')][_0xf0ab('0x53')](_0xf0ab('0x54'))){_0x33dbfc[_0xf0ab('0x30')]=qs[_0xf0ab('0x30')](_0x283bf5[_0xf0ab('0x4c')][_0xf0ab('0x30')]);_0x33dbfc['offset']=qs['offset'](_0x283bf5[_0xf0ab('0x4c')]['offset']);}_0x33dbfc['order']=qs[_0xf0ab('0x56')](_0x283bf5[_0xf0ab('0x4c')]['sort']);_0x33dbfc[_0xf0ab('0x83')]=qs[_0xf0ab('0x4e')](_[_0xf0ab('0x10c')](_0x283bf5['query'],_0x487318[_0xf0ab('0x4e')]));_0x33dbfc['where'][_0xf0ab('0x10d')]=_0xa3b903['id'];if(_0x283bf5['query'][_0xf0ab('0x8d')]){_0x33dbfc[_0xf0ab('0x83')]=_[_0xf0ab('0x39')](_0x33dbfc['where'],{'$or':_[_0xf0ab('0x3f')](_0x33dbfc[_0xf0ab('0x51')],function(_0x2ddc1d){var _0x3cef14={};_0x3cef14[_0x2ddc1d]={'$like':'%'+_0x283bf5['query'][_0xf0ab('0x8d')]+'%'};return _0x3cef14;})});}if(_0x283bf5[_0xf0ab('0x4c')]['$gte']){var _0x38ea18=_0x283bf5[_0xf0ab('0x4c')]['$gte']['split'](',');var _0x7ee6b3={};_0x7ee6b3[_0x38ea18[0x0]]={'$gte':moment(_0x38ea18[0x1])[_0xf0ab('0xe9')](_0xf0ab('0x10e'))};_0x33dbfc['where']=_[_0xf0ab('0x39')](_0x33dbfc['where'],_0x7ee6b3);}_0x33dbfc=_[_0xf0ab('0x39')]({},_0x33dbfc,_0x283bf5['options']);return db[_0xf0ab('0xd0')]['count']({'where':_0x33dbfc['where']})['then'](function(_0x1d1451){_0x546e13['count']=_0x1d1451;if(_0x283bf5[_0xf0ab('0x4c')][_0xf0ab('0xba')]){_0x33dbfc[_0xf0ab('0xbb')]=[{'all':!![]}];}return db[_0xf0ab('0xd0')][_0xf0ab('0x10f')](_0x33dbfc);})['then'](function(_0x16a1d2){_0x546e13[_0xf0ab('0xb8')]=_0x16a1d2;return _0x546e13;});}})[_0xf0ab('0x21')](respondWithFilteredResult(_0x1afcea,_0x33dbfc))[_0xf0ab('0x46')](handleError(_0x1afcea,null));};exports[_0xf0ab('0x110')]=function(_0x4b91de,_0x3a602f,_0x47788a){var _0x3592f1={'where':{}},_0x577f13={},_0x2f99c2={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xf0ab('0xc0')]({'where':{'id':_0x4b91de[_0xf0ab('0xbd')]['id']}})['then'](handleEntityNotFound(_0x3a602f,null))['then'](function(_0x43c6b8){if(_0x43c6b8){_0x577f13['model']=_[_0xf0ab('0x4d')](db[_0xf0ab('0xd0')][_0xf0ab('0x47')]);_0x577f13[_0xf0ab('0x4c')]=_[_0xf0ab('0x4d')](_0x4b91de[_0xf0ab('0x4c')]);_0x577f13['filters']=_[_0xf0ab('0x4f')](_0x577f13[_0xf0ab('0x4b')],_0x577f13[_0xf0ab('0x4c')]);_0x3592f1[_0xf0ab('0x51')]=_[_0xf0ab('0x4f')](_0x577f13[_0xf0ab('0x4b')],qs[_0xf0ab('0x50')](_0x4b91de['query'][_0xf0ab('0x50')]));_0x3592f1[_0xf0ab('0x51')]=_0x3592f1['attributes'][_0xf0ab('0x52')]?_0x3592f1['attributes']:_0x577f13[_0xf0ab('0x4b')];if(!_0x4b91de['query']['hasOwnProperty']('nolimit')){_0x3592f1[_0xf0ab('0x30')]=qs[_0xf0ab('0x30')](_0x4b91de[_0xf0ab('0x4c')][_0xf0ab('0x30')]);_0x3592f1[_0xf0ab('0x2e')]=qs[_0xf0ab('0x2e')](_0x4b91de[_0xf0ab('0x4c')][_0xf0ab('0x2e')]);}_0x3592f1[_0xf0ab('0x55')]=qs[_0xf0ab('0x56')](_0x4b91de[_0xf0ab('0x4c')][_0xf0ab('0x56')]);_0x3592f1[_0xf0ab('0x83')]=qs[_0xf0ab('0x4e')](_[_0xf0ab('0x10c')](_0x4b91de[_0xf0ab('0x4c')],_0x577f13[_0xf0ab('0x4e')]));_0x3592f1['where'][_0xf0ab('0x10d')]=_0x43c6b8['id'];if(_0x4b91de['query'][_0xf0ab('0x8d')]){_0x3592f1['where']=_[_0xf0ab('0x39')](_0x3592f1[_0xf0ab('0x83')],{'$or':_[_0xf0ab('0x3f')](_0x3592f1['attributes'],function(_0x58f64c){var _0x5dc7d4={};_0x5dc7d4[_0x58f64c]={'$like':'%'+_0x4b91de[_0xf0ab('0x4c')][_0xf0ab('0x8d')]+'%'};return _0x5dc7d4;})});}_0x3592f1['where'][_0xf0ab('0xfc')]=![];if(_0x4b91de[_0xf0ab('0x4c')]['id']){_0x3592f1[_0xf0ab('0x83')]['id']={'$gt':_0x4b91de[_0xf0ab('0x4c')]['id']};}_0x3592f1=_['merge']({},_0x3592f1,_0x4b91de['options']);return db[_0xf0ab('0xd0')][_0xf0ab('0x31')]({'where':_0x3592f1[_0xf0ab('0x83')]})[_0xf0ab('0x21')](function(_0x2ab983){_0x2f99c2['count']=_0x2ab983;_0x3592f1[_0xf0ab('0xbb')]=[];if(_0x4b91de['query'][_0xf0ab('0x111')]){_0x3592f1[_0xf0ab('0xbb')][_0xf0ab('0x45')]({'model':db['User'],'as':_0xf0ab('0xec'),'attributes':['id',_0xf0ab('0x40'),_0xf0ab('0xf7')]});}if(_0x4b91de[_0xf0ab('0x4c')]['includeAll']){_0x3592f1[_0xf0ab('0xbb')]=[{'all':!![]}];}return db[_0xf0ab('0xd0')][_0xf0ab('0x10f')](_0x3592f1);})[_0xf0ab('0x21')](function(_0x3d70c0){_0x2f99c2[_0xf0ab('0xb8')]=_0x3d70c0;return _0x2f99c2;});}})[_0xf0ab('0x21')](respondWithFilteredResult(_0x3a602f,_0x3592f1))[_0xf0ab('0x46')](handleError(_0x3a602f,null));};exports['addTags']=function(_0x4d10af,_0x5cf4bd,_0x368523){return db['ChatInteraction'][_0xf0ab('0x6c')]({'where':{'id':_0x4d10af['params']['id']}})[_0xf0ab('0x21')](handleEntityNotFound(_0x5cf4bd,null))[_0xf0ab('0x21')](function(_0x46a38a){if(_0x46a38a){return _0x46a38a[_0xf0ab('0x112')](_0x4d10af[_0xf0ab('0x3a')][_0xf0ab('0x10a')],_['omit'](_0x4d10af[_0xf0ab('0x3a')],[_0xf0ab('0x10a'),'id'])||{})[_0xf0ab('0x113')](function(){return db['Tag'][_0xf0ab('0x10f')]({'attributes':['id',_0xf0ab('0x37'),_0xf0ab('0x59')],'where':{'id':_0x4d10af[_0xf0ab('0x3a')][_0xf0ab('0x10a')]}});})[_0xf0ab('0x21')](function(_0x1df97b){socket[_0xf0ab('0x114')](_0xf0ab('0x115'),{'id':Number(_0x4d10af[_0xf0ab('0xbd')]['id']),'tags':_0x1df97b||[]});return{'id':Number(_0x4d10af[_0xf0ab('0xbd')]['id']),'tags':_0x1df97b||[]};});}})[_0xf0ab('0x21')](respondWithResult(_0x5cf4bd,null))['catch'](handleError(_0x5cf4bd,null));};exports[_0xf0ab('0x116')]=function(_0x3ca465,_0x4e379d,_0x122e66){return db['ChatInteraction'][_0xf0ab('0x6c')]({'where':{'id':_0x3ca465[_0xf0ab('0xbd')]['id']}})[_0xf0ab('0x21')](handleEntityNotFound(_0x4e379d,null))[_0xf0ab('0x21')](function(_0x5c56e0){if(_0x5c56e0){return _0x5c56e0[_0xf0ab('0x116')](_0x3ca465[_0xf0ab('0x4c')][_0xf0ab('0x10a')]);}})['then'](respondWithStatusCode(_0x4e379d,null))[_0xf0ab('0x46')](handleError(_0x4e379d,null));};exports[_0xf0ab('0xe7')]=function(_0x2baa40,_0x4ff52d){var _0x2a2fea=moment()[_0xf0ab('0x117')]()[_0xf0ab('0xa0')]();var _0x4eccbd=path['join'](config['root'],_0xf0ab('0x118'),_0xf0ab('0x119'),_0xf0ab('0x11a'));var _0x5b6475=path[_0xf0ab('0xe5')](config[_0xf0ab('0x11b')],'server',_0xf0ab('0x119'),_0xf0ab('0x11c'));var _0x595bda=path[_0xf0ab('0xe5')](_0x4eccbd,_0x2a2fea);var _0x2bd3e3=util['format']('transcript-%d-%s.zip',_0x2baa40[_0xf0ab('0xbd')]['id'],_0x2a2fea);var _0x25242e=path[_0xf0ab('0xe5')](_0x4eccbd,_0x2bd3e3);var _0x3d8794=[];_0x3d8794[_0xf0ab('0x45')]({'model':db['User'],'as':_0xf0ab('0xec'),'attributes':['id','fullname'],'raw':!![]});_0x3d8794[_0xf0ab('0x45')]({'model':db[_0xf0ab('0xed')],'as':_0xf0ab('0x70'),'attributes':['id','firstName',_0xf0ab('0x11d')],'raw':!![]});if(_0x2baa40[_0xf0ab('0x4c')][_0xf0ab('0x11c')]){_0x3d8794[_0xf0ab('0x45')]({'model':db[_0xf0ab('0xe0')],'as':'Attachment','raw':!![]});}var _0x243763=[{'model':db[_0xf0ab('0xd0')],'as':_0xf0ab('0xee'),'attributes':['id',_0xf0ab('0x3a'),'createdAt',_0xf0ab('0xfb'),_0xf0ab('0xfc'),_0xf0ab('0x88')],'include':_0x3d8794}];_0x243763['push']({'model':db[_0xf0ab('0xbf')],'as':_0xf0ab('0x11e'),'attributes':['id',_0xf0ab('0x37')]});_0x243763['push']({'model':db[_0xf0ab('0xec')],'as':_0xf0ab('0x11f'),'attributes':['id',_0xf0ab('0x40')]});return db[_0xf0ab('0xa1')]['find']({'where':{'id':_0x2baa40[_0xf0ab('0xbd')]['id']},'include':_0x243763})[_0xf0ab('0x21')](handleEntityNotFound(_0x4ff52d,null))[_0xf0ab('0x21')](function(_0x2c2e20){if(_0x2c2e20){var _0x57bd77=_0x2c2e20[_0xf0ab('0x120')]({'plain':!![]});fs[_0xf0ab('0x121')](_0x595bda);var _0x169b02={'channel':_0xf0ab('0x122'),'account':_0x57bd77[_0xf0ab('0x11e')]['name'],'agent':_0x57bd77[_0xf0ab('0x11f')]?_0x57bd77['Owner'][_0xf0ab('0x40')]:_0xf0ab('0x123'),'createdAt':moment(_0x57bd77[_0xf0ab('0xf9')])['format'](_0xf0ab('0x10e'))['toString'](),'closedAt':_0x57bd77['closed']?moment(_0x57bd77['closedAt'])[_0xf0ab('0xe9')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x57bd77[_0xf0ab('0xda')],'chatInfo':{'browser':_0x57bd77[_0xf0ab('0x124')],'os':_0x57bd77[_0xf0ab('0x125')],'referer':_0x57bd77[_0xf0ab('0x126')],'customerIp':_0x57bd77[_0xf0ab('0x127')],'customerPort':_0x57bd77['customerPort']?_0x57bd77[_0xf0ab('0x128')]:_0xf0ab('0x123')},'messages':_(_0x57bd77['Messages'])[_0xf0ab('0x129')]()[_0xf0ab('0x8d')]({'secret':![]})[_0xf0ab('0x3f')](function(_0x2aa512){if(_0x2aa512['Attachment']){var _0x26009e=path[_0xf0ab('0xe5')](_0x5b6475,_0x2aa512['Attachment'][_0xf0ab('0xdd')]);if(fs[_0xf0ab('0x12a')](_0x26009e)){fs['createReadStream'](_0x26009e)[_0xf0ab('0x12b')](fs[_0xf0ab('0x12c')](path['join'](_0x595bda,_0x2aa512[_0xf0ab('0xe0')][_0xf0ab('0xdd')])));}}return{'date':moment(_0x2aa512[_0xf0ab('0xf9')])[_0xf0ab('0xe9')](_0xf0ab('0x10e'))['toString'](),'sender':_0x2aa512[_0xf0ab('0xfb')]==='out'?_0x2aa512[_0xf0ab('0xec')]?_0x2aa512['User'][_0xf0ab('0x40')]:_0xf0ab('0xf1'):_0x2aa512[_0xf0ab('0x70')][_0xf0ab('0x12d')]+(_0x2aa512[_0xf0ab('0x70')][_0xf0ab('0x11d')]?'\x20'+_0x2aa512[_0xf0ab('0x70')]['lastName']:''),'body':_0x2aa512[_0xf0ab('0xe0')]?_0x2aa512[_0xf0ab('0xe0')][_0xf0ab('0xdd')]:_0x2aa512[_0xf0ab('0x3a')],'direction':_0x2aa512[_0xf0ab('0xfb')]==='out'?'A':'C','secret':_0x2aa512[_0xf0ab('0xfc')],'read':_0x2aa512[_0xf0ab('0x88')],'attachment':_0x2aa512[_0xf0ab('0xe0')]};})[_0xf0ab('0x72')]()};return ejs['renderFile'](path[_0xf0ab('0xe5')](config[_0xf0ab('0x11b')],_0xf0ab('0x118'),_0xf0ab('0x12e'),'downloadInteraction.ejs'),{'interaction':_0x169b02})['then'](function(_0x3ad886){var _0x3df4a2=path['join'](_0x595bda,'transcript-'+_0x57bd77['id']+'-'+_0x2a2fea+_0xf0ab('0x12f'));var _0x378d44={'path':_0x3df4a2,'channel':_0xf0ab('0x122'),'interactionId':_0x57bd77['id']};return pdf[_0xf0ab('0x130')](_0x3ad886,_0x378d44);})[_0xf0ab('0x21')](function(){return new BPromise(function(_0x1e4acb,_0x25a1eb){zipdir(_0x595bda,{'saveTo':_0x25242e},function(_0x406090,_0x414d09){if(_0x406090)return _0x25a1eb(_0x406090);return _0x1e4acb(_0x414d09);});})[_0xf0ab('0x21')](function(){return new BPromise(function(_0x235528,_0x581c80){rimraf(_0x595bda,function(_0x14332a){if(_0x14332a)_0x581c80(_0x14332a);return _0x235528();});});})[_0xf0ab('0x21')](function(){return _0x4ff52d[_0xf0ab('0xe7')](_0x25242e,_0x2bd3e3,function(_0x4f9211){if(_0x4f9211){console[_0xf0ab('0x131')](_0xf0ab('0x132'),_0x4f9211);}else{fs[_0xf0ab('0x133')](_0x25242e);}});});});}else{return _0x4ff52d['sendStatus'](0xc8);}})[_0xf0ab('0x46')](handleError(_0x4ff52d,null));}; \ No newline at end of file +var _0xbaf0=['../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','stack','name','body','contact','agent','interaction','account','Users','map','fullname','TagIds','Tags','split','forEach','push','index','ChatInteraction','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','tools_tags','u.id','u.fullname','ui.ChatInteractionId','from','user_has_chat_interactions','left_join','users','chat_interactions','cm_contacts','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','having','`\x20=\x200','`\x20>\x200','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','value','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','UserId','compact','isEmpty','ChatWebsiteId','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','DESC','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','role','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','sequelize','toString','merge','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','c.mobile','Contact.mobile','c.fax','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','rows','show','params','rawAttributes','includeAll','include','options','create','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooMetadata','email','POST','isNull','vidaooNote','follow','Sequelize','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','updateAttributes','CmContact','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','AbandonInteraction','file','originalname','basename','filename','mimetype','attachId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','format','transcript-%s.txt','pathTranscript','ChatMessage','Messages','User','%s%d','agentAlias','System','customer','website_alias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','findAll','getMyMessages','includeAgent','addTags','setTags','emit','chatInteractionTags:save','removeTags','unix','tmp','server','files','attachments','firstName','lastName','Attachment','Owner','get','mkdirSync','Chat','YYYY-MM-DD\x20HH:mm:ss','disposition','browserName','osName','referer','customerIp','customerPort','N.A.','tail','existsSync','createReadStream','pipe','createWriteStream','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x10c988,_0x1a5956){var _0x4a4dcd=function(_0x4d96da){while(--_0x4d96da){_0x10c988['push'](_0x10c988['shift']());}};_0x4a4dcd(++_0x1a5956);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0baf('0x0'));var zipdir=require(_0x0baf('0x1'));var jsonpatch=require(_0x0baf('0x2'));var rp=require(_0x0baf('0x3'));var moment=require(_0x0baf('0x4'));var BPromise=require(_0x0baf('0x5'));var Mustache=require('mustache');var util=require(_0x0baf('0x6'));var path=require(_0x0baf('0x7'));var sox=require(_0x0baf('0x8'));var csv=require(_0x0baf('0x9'));var ejs=require(_0x0baf('0xa'));var fs=require('fs');var fs_extra=require(_0x0baf('0xb'));var _=require(_0x0baf('0xc'));var squel=require(_0x0baf('0xd'));var crypto=require(_0x0baf('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0baf('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0baf('0x10'));var Papa=require(_0x0baf('0x11'));var Redis=require(_0x0baf('0x12'));var authService=require(_0x0baf('0x13'));var qs=require(_0x0baf('0x14'));var as=require(_0x0baf('0x15'));var pdf=require(_0x0baf('0x16'));var hardwareService=require(_0x0baf('0x17'));var logger=require(_0x0baf('0x18'))(_0x0baf('0x19'));var utils=require(_0x0baf('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0baf('0x1b'))['db'];config[_0x0baf('0x1c')]=_[_0x0baf('0x1d')](config[_0x0baf('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x0baf('0x1e'))(new Redis(config['redis']));require(_0x0baf('0x1f'))[_0x0baf('0x20')](socket);var jayson=require(_0x0baf('0x21'));var client=jayson[_0x0baf('0x22')][_0x0baf('0x23')]({'port':0x232b});var client9004=jayson[_0x0baf('0x22')]['http']({'port':0x232c});function respondWithRpcPromise(_0x4cd79d,_0x2312c7,_0x38395b,_0x283408){return new BPromise(function(_0x3d83a3,_0x2cf7da){var _0x288a98=_0x283408||client;return _0x288a98['request'](_0x4cd79d,_0x38395b)[_0x0baf('0x24')](function(_0xfbecec){logger[_0x0baf('0x25')](_0x0baf('0x26'),_0x2312c7,_0x0baf('0x27'));logger[_0x0baf('0x28')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x2312c7,'request\x20sent',JSON[_0x0baf('0x29')](_0xfbecec));if(_0xfbecec[_0x0baf('0x2a')]){if(_0xfbecec[_0x0baf('0x2a')][_0x0baf('0x2b')]===0x1f4){logger[_0x0baf('0x2a')](_0x0baf('0x26'),_0x2312c7,_0xfbecec[_0x0baf('0x2a')][_0x0baf('0x2c')]);return _0x2cf7da(_0xfbecec[_0x0baf('0x2a')][_0x0baf('0x2c')]);}logger['error'](_0x0baf('0x26'),_0x2312c7,_0xfbecec['error'][_0x0baf('0x2c')]);return _0x3d83a3(_0xfbecec['error']['message']);}else{logger[_0x0baf('0x25')]('ChatInteraction,\x20%s,\x20%s',_0x2312c7,'request\x20sent');_0x3d83a3(_0xfbecec[_0x0baf('0x2d')][_0x0baf('0x2c')]);}})[_0x0baf('0x2e')](function(_0x19d9fd){logger[_0x0baf('0x2a')]('ChatInteraction,\x20%s,\x20%s',_0x2312c7,_0x19d9fd);_0x2cf7da(_0x19d9fd);});});}function respondWithStatusCode(_0x448617,_0x4681c5){_0x4681c5=_0x4681c5||0xcc;return function(_0x1ca35a){if(_0x1ca35a){return _0x448617[_0x0baf('0x2f')](_0x4681c5);}return _0x448617[_0x0baf('0x30')](_0x4681c5)[_0x0baf('0x31')]();};}function respondWithResult(_0x453525,_0x549fd0){_0x549fd0=_0x549fd0||0xc8;return function(_0x1590b4){if(_0x1590b4){return _0x453525[_0x0baf('0x30')](_0x549fd0)[_0x0baf('0x32')](_0x1590b4);}};}function respondWithFilteredResult(_0x265915,_0x55c715){return function(_0x29dbdf){if(_0x29dbdf){var _0x34a58a=typeof _0x55c715['offset']===_0x0baf('0x33')&&typeof _0x55c715[_0x0baf('0x34')]===_0x0baf('0x33');var _0xb4dbb1=_0x29dbdf[_0x0baf('0x35')];var _0x366924=_0x34a58a?0x0:_0x55c715[_0x0baf('0x36')];var _0x57476f=_0x34a58a?_0x29dbdf[_0x0baf('0x35')]:_0x55c715[_0x0baf('0x36')]+_0x55c715[_0x0baf('0x34')];var _0x3ed995;if(_0x57476f>=_0xb4dbb1){_0x57476f=_0xb4dbb1;_0x3ed995=0xc8;}else{_0x3ed995=0xce;}_0x265915[_0x0baf('0x30')](_0x3ed995);return _0x265915[_0x0baf('0x37')](_0x0baf('0x38'),_0x366924+'-'+_0x57476f+'/'+_0xb4dbb1)[_0x0baf('0x32')](_0x29dbdf);}return null;};}function patchUpdates(_0x59431b){return function(_0x3ded64){try{jsonpatch[_0x0baf('0x39')](_0x3ded64,_0x59431b,!![]);}catch(_0x165d14){return BPromise[_0x0baf('0x3a')](_0x165d14);}return _0x3ded64[_0x0baf('0x3b')]();};}function saveUpdates(_0x57a6bb,_0x2fd426){return function(_0x53ae1d){if(_0x53ae1d){return _0x53ae1d[_0x0baf('0x3c')](_0x57a6bb)[_0x0baf('0x24')](function(_0x35e534){return _0x35e534;});}return null;};}function removeEntity(_0x3d65f2,_0x5300a5){return function(_0x1a2b03){if(_0x1a2b03){return _0x1a2b03[_0x0baf('0x3d')]()['then'](function(){_0x3d65f2[_0x0baf('0x30')](0xcc)[_0x0baf('0x31')]();});}};}function handleEntityNotFound(_0x62a2ed,_0xbaa9a7){return function(_0x1f60bd){if(!_0x1f60bd){_0x62a2ed[_0x0baf('0x2f')](0x194);}return _0x1f60bd;};}function handleError(_0xe03d82,_0x675461){_0x675461=_0x675461||0x1f4;return function(_0x4aa6ed){logger[_0x0baf('0x2a')](_0x4aa6ed[_0x0baf('0x3e')]);if(_0x4aa6ed['name']){delete _0x4aa6ed[_0x0baf('0x3f')];}_0xe03d82['status'](_0x675461)['send'](_0x4aa6ed);};}function getMustacheRender(_0x11bc49,_0x81af83){return Mustache['render'](_0x11bc49,_['merge'](_0x81af83[_0x0baf('0x40')],{'contact':_0x81af83[_0x0baf('0x41')],'message':_0x81af83[_0x0baf('0x2c')],'agent':_0x81af83[_0x0baf('0x42')],'interaction':_0x81af83[_0x0baf('0x43')],'account':_0x81af83[_0x0baf('0x44')]}))||'';}function getInteractionUsers(_0x290464,_0x37c038){return new BPromise(function(_0x631f74,_0x36c6d2){try{if(_0x37c038[_0x290464['id']]){_0x290464[_0x0baf('0x45')]=_[_0x0baf('0x46')](_0x37c038[_0x290464['id']],function(_0x354cb1){return{'id':_0x354cb1['id'],'fullname':_0x354cb1[_0x0baf('0x47')]};});}}catch(_0x53d6b7){_0x36c6d2(_0x53d6b7);}_0x631f74(_0x290464);});}function getInteractionTags(_0x3573ce,_0x1435d5){return new BPromise(function(_0x4f1de9,_0x38006a){try{if(_0x3573ce[_0x0baf('0x48')]){_0x3573ce[_0x0baf('0x49')]=[];_0x3573ce[_0x0baf('0x48')][_0x0baf('0x4a')](',')[_0x0baf('0x4b')](function(_0x57b581){_0x3573ce[_0x0baf('0x49')][_0x0baf('0x4c')](_0x1435d5[_0x57b581]);});}delete _0x3573ce['TagIds'];}catch(_0x35d442){_0x38006a(_0x35d442);}_0x4f1de9(_0x3573ce);});}function updateChatInteraction(_0x412e6f,_0x45c6aa,_0x57903e){return new BPromise(function(_0x504031,_0x193fd3){return getInteractionUsers(_0x412e6f,_0x57903e)[_0x0baf('0x24')](function(_0x301412){return getInteractionTags(_0x301412,_0x45c6aa);})[_0x0baf('0x24')](function(_0x2b6d54){_0x504031(_0x2b6d54);})[_0x0baf('0x2e')](function(_0x33da34){_0x193fd3(_0x33da34);});});}exports[_0x0baf('0x4d')]=function(_0xce1bf0,_0x355033){var _0x56270e={},_0x2a2a7c={},_0x2bc755={'count':0x0,'rows':[]};var _0x1daf1d=_[_0x0baf('0x46')](db[_0x0baf('0x4e')]['rawAttributes'],function(_0x1e7364){return{'name':_0x1e7364[_0x0baf('0x4f')],'type':_0x1e7364[_0x0baf('0x50')][_0x0baf('0x51')]};});_0x2a2a7c[_0x0baf('0x52')]=_['map'](_0x1daf1d,_0x0baf('0x3f'));_0x2a2a7c[_0x0baf('0x53')]=_[_0x0baf('0x54')](_0xce1bf0[_0x0baf('0x53')]);_0x2a2a7c[_0x0baf('0x55')]=_[_0x0baf('0x56')](_0x2a2a7c[_0x0baf('0x52')],_0x2a2a7c['query']);_0x56270e[_0x0baf('0x57')]=_[_0x0baf('0x56')](_0x2a2a7c[_0x0baf('0x52')],qs['fields'](_0xce1bf0[_0x0baf('0x53')][_0x0baf('0x58')]));_0x56270e[_0x0baf('0x57')]=_0x56270e[_0x0baf('0x57')][_0x0baf('0x59')]?_0x56270e[_0x0baf('0x57')]:_0x2a2a7c[_0x0baf('0x52')];if(!_0xce1bf0['query'][_0x0baf('0x5a')](_0x0baf('0x5b'))){_0x56270e[_0x0baf('0x34')]=qs[_0x0baf('0x34')](_0xce1bf0[_0x0baf('0x53')][_0x0baf('0x34')]);_0x56270e[_0x0baf('0x36')]=qs[_0x0baf('0x36')](_0xce1bf0[_0x0baf('0x53')][_0x0baf('0x36')]);}_0x56270e[_0x0baf('0x5c')]=qs['sort'](_0xce1bf0['query'][_0x0baf('0x5d')]);_0x56270e[_0x0baf('0x5e')]=qs[_0x0baf('0x55')](_[_0x0baf('0x5f')](_0xce1bf0[_0x0baf('0x53')],_0x2a2a7c[_0x0baf('0x55')]),_0x1daf1d);var _0x3403d5=[];var _0x4b492c=squel[_0x0baf('0x60')]()[_0x0baf('0x61')]('id')[_0x0baf('0x61')](_0x0baf('0x3f'))[_0x0baf('0x61')](_0x0baf('0x62'))['from'](_0x0baf('0x63'));var _0x5f123c=squel[_0x0baf('0x60')]()['field'](_0x0baf('0x64'))['field'](_0x0baf('0x65'))['field'](_0x0baf('0x66'))[_0x0baf('0x67')](_0x0baf('0x68'),'ui')[_0x0baf('0x69')](_0x0baf('0x6a'),'u','u.id\x20=\x20ui.UserId');var _0x21f179=squel[_0x0baf('0x60')]()[_0x0baf('0x67')](_0x0baf('0x6b'),'i')[_0x0baf('0x69')](_0x0baf('0x6c'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x0baf('0x69')](_0x0baf('0x6a'),'o',_0x0baf('0x6d'))[_0x0baf('0x69')](_0x0baf('0x6e'),'a',_0x0baf('0x6f'))[_0x0baf('0x69')]('chat_messages','me','me.ChatInteractionId\x20=\x20i.id')[_0x0baf('0x69')](_0x0baf('0x70'),'it',_0x0baf('0x71'))[_0x0baf('0x69')](_0x0baf('0x63'),'t',_0x0baf('0x72'));var _0xaa4293=squel[_0x0baf('0x73')]();var _0x3d9a32=[];var _0x585969=squel[_0x0baf('0x73')]();var _0x268be8;if(_0xce1bf0[_0x0baf('0x53')][_0x0baf('0x74')]){_0x268be8=as[_0x0baf('0x75')](_0xce1bf0[_0x0baf('0x53')][_0x0baf('0x74')]);var _0x51d75f=_0x268be8[_0x0baf('0x76')];for(var _0x27f580=0x0;_0x27f580<_0x268be8[_0x0baf('0x77')][_0x0baf('0x59')];_0x27f580++){var _0x1c7d88=_0x268be8[_0x0baf('0x77')][_0x27f580];var _0x14e6d0='i';var _0x12543e=_['find'](_0x1daf1d,[_0x0baf('0x3f'),_0x1c7d88['field']]);if(!_0x12543e){switch(_0x1c7d88[_0x0baf('0x61')]){case'unreadMessages':if(_0x1c7d88['value']==0x1){_0x21f179[_0x0baf('0x78')]('`'+_0x1c7d88['field']+_0x0baf('0x79'));}else{_0x21f179[_0x0baf('0x78')]('`'+_0x1c7d88['field']+_0x0baf('0x7a'));}break;case _0x0baf('0x7b'):if(_0x1c7d88[_0x0baf('0x7c')]==='$substring'){if(_0x1c7d88['value'][_0x0baf('0x4a')]('\x20')[_0x0baf('0x59')]>0x1){_0xaa4293[_0x51d75f](_0x0baf('0x7d'),qs[_0x0baf('0x7e')](_0x1c7d88[_0x0baf('0x7f')]),null);}else{var _0x588b88='%'+_0x1c7d88[_0x0baf('0x7f')]+'%';_0xaa4293[_0x51d75f]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x588b88,_0x588b88,_0x588b88);}}else{_0x12543e=_['find'](_0x1daf1d,['name',_0x0baf('0x80')]);_0x1c7d88['field']='ContactId';_0xf45ec3=as[_0x0baf('0x81')](_0x14e6d0,_0x12543e[_0x0baf('0x50')],_0x1c7d88);_0xaa4293[_0x51d75f](_0xf45ec3[_0x0baf('0x82')],_0xf45ec3[_0x0baf('0x7f')][_0x0baf('0x83')],_0xf45ec3[_0x0baf('0x7f')]['end']);}break;case _0x0baf('0x84'):var _0x1a0a67=_0x1c7d88[_0x0baf('0x7f')][_0x0baf('0x4a')](',')[_0x0baf('0x46')](function(_0x1273f4){return Number(_0x1273f4);});_0x1a0a67['forEach'](function(_0x42e8ad){_0x585969['or'](_0x0baf('0x85'),'%,'+_0x42e8ad+',%');});_0x3d9a32=_[_0x0baf('0x86')](_0x3d9a32,_0x1a0a67);break;case'User':if(_0x1c7d88[_0x0baf('0x7c')]===_0x0baf('0x87')){_0xaa4293[_0x51d75f](_0x0baf('0x88'),'%'+_0x1c7d88[_0x0baf('0x7f')]+'%',null);}else{_0x12543e=_[_0x0baf('0x89')](_0x1daf1d,[_0x0baf('0x3f'),_0x0baf('0x8a')]);_0x1c7d88['field']='UserId';_0xf45ec3=as['buildExpression'](_0x14e6d0,_0x12543e[_0x0baf('0x50')],_0x1c7d88);_0xaa4293[_0x51d75f](_0xf45ec3[_0x0baf('0x82')],_0xf45ec3[_0x0baf('0x7f')][_0x0baf('0x83')],_0xf45ec3[_0x0baf('0x7f')][_0x0baf('0x31')]);}break;case'body':_0xf45ec3=as['buildExpression']('me',null,_0x1c7d88);_0xaa4293[_0x51d75f](_0xf45ec3[_0x0baf('0x82')],_0xf45ec3['value'][_0x0baf('0x83')],_0xf45ec3[_0x0baf('0x7f')]['end']);break;}}else{var _0xf45ec3=as[_0x0baf('0x81')](_0x14e6d0,_0x12543e[_0x0baf('0x50')],_0x1c7d88);_0xaa4293[_0x51d75f](_0xf45ec3[_0x0baf('0x82')],_0xf45ec3[_0x0baf('0x7f')][_0x0baf('0x83')],_0xf45ec3[_0x0baf('0x7f')][_0x0baf('0x31')]);}}}else{var _0xfcc697=_(_0xce1bf0['query'])['keys']()['map'](function(_0x493784){return _['some'](_0x1daf1d,[_0x0baf('0x3f'),_0x493784])?_0x493784:undefined;})[_0x0baf('0x8b')]()[_0x0baf('0x7f')]();if(!_[_0x0baf('0x8c')](_0xfcc697)){_0xfcc697['forEach'](function(_0x1be7f2){if(_0x1be7f2===_0x0baf('0x8d')){_0x21f179['where']('i.ChatWebsiteId\x20IN\x20?',[][_0x0baf('0x8e')](_0xce1bf0[_0x0baf('0x53')][_0x1be7f2]));}else if(_0x1be7f2===_0x0baf('0x8f')){var _0x442e5f=JSON[_0x0baf('0x90')](_0xce1bf0[_0x0baf('0x53')][_0x1be7f2])[_0x0baf('0x91')];var _0x399f40=JSON['parse'](_0xce1bf0[_0x0baf('0x53')][_0x1be7f2])[_0x0baf('0x92')];_0x21f179['where'](_0x0baf('0x93'),_0x442e5f,_0x399f40);}else{if(_0xce1bf0[_0x0baf('0x53')][_0x1be7f2]==='null'){_0x21f179[_0x0baf('0x5e')]('i.'+_0x1be7f2+_0x0baf('0x94'));}else{_0x21f179[_0x0baf('0x5e')]('i.'+_0x1be7f2+_0x0baf('0x95'),_0xce1bf0[_0x0baf('0x53')][_0x1be7f2]);}}});}if(_0xce1bf0['query']['read']){if(_0xce1bf0[_0x0baf('0x53')][_0x0baf('0x96')]==0x1){_0x21f179['having'](_0x0baf('0x97'));}else{_0x21f179[_0x0baf('0x78')](_0x0baf('0x98'));}}if(_0xce1bf0['query'][_0x0baf('0x99')]){_0x3d9a32=_[_0x0baf('0x9a')](_0xce1bf0[_0x0baf('0x53')]['tag'])?_0xce1bf0[_0x0baf('0x53')]['tag']:new Array(_0xce1bf0[_0x0baf('0x53')][_0x0baf('0x99')]);_0x3d9a32[_0x0baf('0x4b')](function(_0x2f009f){_0x585969['or'](_0x0baf('0x85'),'%,'+_0x2f009f+',%');});}if(_0xce1bf0['query'][_0x0baf('0x9b')]){var _0x57f33c=_0xce1bf0['query'][_0x0baf('0x9b')][_0x0baf('0x9c')]('\x5c','\x5c\x5c')[_0x0baf('0x9c')](/'/g,'\x27\x27');if(qs[_0x0baf('0x9d')](_0x57f33c)){_0xaa4293['or'](_0x0baf('0x9e'),_0x57f33c+'%');}else{_0xaa4293['or'](_0x0baf('0x9f'),qs[_0x0baf('0x7e')](_0x57f33c))['or'](_0x0baf('0xa0'),_0x57f33c+'%');}}}_0x21f179[_0x0baf('0x5e')](_0xaa4293);_0x21f179[_0x0baf('0xa1')](_0x0baf('0xa2'));var _0x2c2f09={'type':db['Sequelize']['QueryTypes'][_0x0baf('0xa3')],'raw':!![]};var _0x322a09=_0x21f179[_0x0baf('0xa4')]();_0x322a09['field']('i.id');_0x322a09[_0x0baf('0x61')](_0x0baf('0xa5'),_0x0baf('0xa6'));if(_0x56270e[_0x0baf('0x5c')]){_0x56270e[_0x0baf('0x5c')][_0x0baf('0x4b')](function(_0x191d35){var _0xa2d315=_0x191d35[0x0]===_0x0baf('0xa7')?_0x191d35[0x0]:'i.'+_0x191d35[0x0];_0x21f179['order'](_0xa2d315,_0x191d35[0x1]===_0x0baf('0xa8')?![]:!![]);});}if(!_[_0x0baf('0x8c')](_0x3d9a32)){_0x21f179[_0x0baf('0x78')](_0x585969);_0x322a09[_0x0baf('0x5e')]('t.id\x20IN\x20?',_0x3d9a32);}BPromise['resolve']()['then'](function(){if(!_0x268be8){if(_0xce1bf0[_0x0baf('0x53')][_0x0baf('0x8d')])return;_0x322a09['where']('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x21f179[_0x0baf('0x5e')](_0x0baf('0xa9'));return;}if(_0xce1bf0['user'][_0x0baf('0xaa')]!==_0x0baf('0x42'))return;return _0xce1bf0[_0x0baf('0xab')][_0x0baf('0xac')]({'attributes':['id'],'raw':!![]})[_0x0baf('0x24')](function(_0x25081e){if(_[_0x0baf('0x8c')](_0x25081e)){_0x322a09[_0x0baf('0x5e')](_0x0baf('0xad'));_0x21f179[_0x0baf('0x5e')](_0x0baf('0xad'));}else{_0x322a09[_0x0baf('0x5e')]('i.ChatWebsiteId\x20IN\x20?',_[_0x0baf('0x46')](_0x25081e,'id'));_0x21f179[_0x0baf('0x5e')](_0x0baf('0xae'),_[_0x0baf('0x46')](_0x25081e,'id'));}});})[_0x0baf('0x24')](function(){if(_0xce1bf0[_0x0baf('0xab')]['role']===_0x0baf('0x42')&&!_0x268be8&&!_0xce1bf0[_0x0baf('0x53')][_0x0baf('0x8d')])return[];return db[_0x0baf('0xaf')][_0x0baf('0x53')](_0x322a09['toString'](),_0x2c2f09);})[_0x0baf('0x24')](function(_0x30eac8){_0x2bc755[_0x0baf('0x35')]=_0x30eac8[_0x0baf('0x59')];if(_0x2bc755[_0x0baf('0x35')]===0x0)return[];return db['sequelize']['query'](_0x4b492c[_0x0baf('0xb0')](),_0x2c2f09)['then'](function(_0x477cd5){_0x3403d5=_['keyBy'](_0x477cd5,'id');_0x2c2f09=_[_0x0baf('0xb1')](_0x2c2f09,{'model':db[_0x0baf('0x4e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xce1bf0[_0x0baf('0x53')][_0x0baf('0x58')]){_0x56270e['attributes'][_0x0baf('0x4b')](function(_0x106ffa){_0x21f179[_0x0baf('0x61')]('i.'+_0x106ffa);});}else{_0x21f179['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x21f179['field'](_0x0baf('0xb2'),_0x0baf('0xb3'));_0x21f179[_0x0baf('0x61')](_0x0baf('0xb4'),'Account.mandatoryDisposition');_0x21f179[_0x0baf('0x61')](_0x0baf('0xb5'),_0x0baf('0xa7'));_0x21f179['field'](_0x0baf('0xb6'));_0x21f179[_0x0baf('0x61')]('c.firstName',_0x0baf('0xb7'));_0x21f179['field'](_0x0baf('0xb8'),_0x0baf('0xb9'));_0x21f179[_0x0baf('0x61')](_0x0baf('0xba'),'Contact.email');_0x21f179['field'](_0x0baf('0xbb'),'Contact.phone');_0x21f179[_0x0baf('0x61')](_0x0baf('0xbc'),_0x0baf('0xbd'));_0x21f179[_0x0baf('0x61')](_0x0baf('0xbe'),'Contact.fax');_0x21f179[_0x0baf('0x61')]('o.fullname',_0x0baf('0xbf'));_0x21f179['field'](_0x0baf('0xc0'),'Owner.internal');_0x21f179[_0x0baf('0x61')](_0x0baf('0xc1'),_0x0baf('0x48'));}if(_0x56270e['limit'])_0x21f179['limit'](_0x56270e[_0x0baf('0x34')]);if(_0x56270e[_0x0baf('0x36')])_0x21f179[_0x0baf('0x36')](_0x56270e[_0x0baf('0x36')]);return db[_0x0baf('0xaf')][_0x0baf('0x53')](_0x21f179['toString'](),_0x2c2f09);})[_0x0baf('0x24')](function(_0x5ee37f){if(_0x5ee37f[_0x0baf('0x59')]>0x0)_0x5f123c['where'](_0x0baf('0xc2'),_[_0x0baf('0x46')](_0x5ee37f,'id'));return db[_0x0baf('0xaf')]['query'](_0x5f123c[_0x0baf('0xb0')](),_0x2c2f09)[_0x0baf('0x24')](function(_0x4879b4){var _0x544498=_[_0x0baf('0xc3')](_0x4879b4,_0x0baf('0xc4'));var _0x20dd04=[];_0x5ee37f[_0x0baf('0x4b')](function(_0x4823a3){_0x20dd04['push'](updateChatInteraction(_0x4823a3,_0x3403d5,_0x544498));});return BPromise[_0x0baf('0xc5')](_0x20dd04);});});})[_0x0baf('0x24')](function(_0x116d52){_0x2bc755[_0x0baf('0xc6')]=_0x116d52;return _0x2bc755;})[_0x0baf('0x24')](respondWithFilteredResult(_0x355033,_0x56270e))[_0x0baf('0x2e')](handleError(_0x355033,null));};exports[_0x0baf('0xc7')]=function(_0xe0b67c,_0x205de6){var _0x2369f0={'raw':![],'where':{'id':_0xe0b67c[_0x0baf('0xc8')]['id']}},_0x58f95c={};_0x58f95c['model']=_[_0x0baf('0x54')](db[_0x0baf('0x4e')][_0x0baf('0xc9')]);_0x58f95c[_0x0baf('0x53')]=_['keys'](_0xe0b67c[_0x0baf('0x53')]);_0x58f95c[_0x0baf('0x55')]=_[_0x0baf('0x56')](_0x58f95c[_0x0baf('0x52')],_0x58f95c[_0x0baf('0x53')]);_0x2369f0[_0x0baf('0x57')]=_[_0x0baf('0x56')](_0x58f95c[_0x0baf('0x52')],qs[_0x0baf('0x58')](_0xe0b67c['query'][_0x0baf('0x58')]));_0x2369f0[_0x0baf('0x57')]=_0x2369f0['attributes'][_0x0baf('0x59')]?_0x2369f0[_0x0baf('0x57')]:_0x58f95c[_0x0baf('0x52')];if(_0xe0b67c[_0x0baf('0x53')][_0x0baf('0xca')]){_0x2369f0[_0x0baf('0xcb')]=[{'all':!![]}];}_0x2369f0=_[_0x0baf('0xb1')]({},_0x2369f0,_0xe0b67c[_0x0baf('0xcc')]);return db[_0x0baf('0x4e')]['find'](_0x2369f0)[_0x0baf('0x24')](handleEntityNotFound(_0x205de6,null))[_0x0baf('0x24')](respondWithResult(_0x205de6,null))[_0x0baf('0x2e')](handleError(_0x205de6,null));};exports[_0x0baf('0xcd')]=function(_0x4328d5,_0x270d69){return db['ChatInteraction'][_0x0baf('0xcd')](_0x4328d5[_0x0baf('0x40')],{})[_0x0baf('0x24')](respondWithResult(_0x270d69,0xc9))['catch'](handleError(_0x270d69,null));};exports['update']=function(_0x5adbd9,_0x1adb84){if(_0x5adbd9[_0x0baf('0x40')]['id']){delete _0x5adbd9['body']['id'];}return db[_0x0baf('0x4e')]['find']({'where':{'id':_0x5adbd9[_0x0baf('0xc8')]['id']}})['then'](handleEntityNotFound(_0x1adb84,null))[_0x0baf('0x24')](saveUpdates(_0x5adbd9[_0x0baf('0x40')],null))['then'](respondWithResult(_0x1adb84,null))[_0x0baf('0x2e')](handleError(_0x1adb84,null));};exports[_0x0baf('0x3d')]=function(_0x25d25e,_0x4494de){return db[_0x0baf('0x4e')][_0x0baf('0x89')]({'where':{'id':_0x25d25e[_0x0baf('0xc8')]['id']}})['then'](handleEntityNotFound(_0x4494de,null))[_0x0baf('0x24')](removeEntity(_0x4494de,null))[_0x0baf('0x2e')](handleError(_0x4494de,null));};exports[_0x0baf('0xce')]=function(_0x2e1629,_0x275cc4){return db[_0x0baf('0x4e')][_0x0baf('0xce')]()[_0x0baf('0x24')](respondWithResult(_0x275cc4,null))[_0x0baf('0x2e')](handleError(_0x275cc4,null));};exports[_0x0baf('0xcf')]=function(_0x308b3f,_0xae8bc2){var _0x1390cd=_0x308b3f[_0x0baf('0xc8')]['id'];var _0x59dd6c;var _0x57b64b;var _0x1cd215;return db[_0x0baf('0x4e')][_0x0baf('0xd0')]({'where':{'id':_0x1390cd}})[_0x0baf('0x24')](function(_0x52e98a){_0x59dd6c=_0x52e98a;return db[_0x0baf('0xd1')][_0x0baf('0xd0')]({'where':{'id':_0x52e98a[_0x0baf('0x8d')]},'attributes':['id',_0x0baf('0xd2'),_0x0baf('0xd3'),_0x0baf('0xd4'),'vidaooNote',_0x0baf('0xd5')],'raw':!![]});})[_0x0baf('0x24')](function(_0x347c39){if(_0x347c39&&_0x347c39['vidaooApiKey']&&_0x347c39[_0x0baf('0xd3')]){_0x57b64b=_0x347c39;var _0x106c6e={'interaction':{'id':_0x1390cd},'agent':{'id':_0x308b3f[_0x0baf('0xab')]['id'],'name':_0x308b3f['user']['name'],'fullname':_0x308b3f['user'][_0x0baf('0x47')],'email':_0x308b3f['user'][_0x0baf('0xd6')]},'contact':_0x308b3f[_0x0baf('0x40')]['contact'],'account':_0x308b3f[_0x0baf('0x40')]['account']};var _0x5737b0={'rejectUnauthorized':![],'method':_0x0baf('0xd7'),'url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x347c39[_0x0baf('0xd2')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x308b3f['user']['email']],'buttons':null,'topic':_0x57b64b['vidaooTopic'],'note':_[_0x0baf('0xd8')](_0x57b64b[_0x0baf('0xd9')])?null:getMustacheRender(_0x57b64b[_0x0baf('0xd9')],_0x106c6e),'metadata':null},'redirect':_0x0baf('0xda'),'json':!![]};try{if(!_[_0x0baf('0xd8')](_0x57b64b[_0x0baf('0xd5')])){var _0x20582a=getMustacheRender(_0x57b64b['vidaooMetadata'],_0x106c6e);var _0x36cd08=JSON[_0x0baf('0x90')](_0x20582a);_0x5737b0[_0x0baf('0x40')]['metadata']=_0x36cd08;}}catch(_0x24672f){throw new db[(_0x0baf('0xdb'))][(_0x0baf('0xdc'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x5737b0);}else{throw new db[(_0x0baf('0xdb'))]['ValidationError'](_0x0baf('0xdd'));}})[_0x0baf('0x24')](function(_0x57846e){_0x1cd215=_0x57846e;if(_0x1cd215['id']){var _0xd4ed40={'body':_0x1cd215[_0x0baf('0xde')],'ChatWebsiteId':_0x57b64b['id'],'ChatInteractionId':_0x59dd6c['id'],'direction':_0x0baf('0xdf'),'UserId':_0x308b3f[_0x0baf('0xab')]['id']};return db['ChatMessage'][_0x0baf('0xcd')](_0xd4ed40,{});}else{throw new db[(_0x0baf('0xdb'))]['ValidationError']('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0x0baf('0x24')](function(){return _0x59dd6c[_0x0baf('0xe0')]({'vidaooSessionId':_0x1cd215['id']});})[_0x0baf('0x24')](respondWithResult(_0xae8bc2,null))[_0x0baf('0x2e')](handleError(_0xae8bc2,null));};exports['customUpdate']=function(_0x5571d4,_0x16579f){if(_0x5571d4[_0x0baf('0x40')]['id']){delete _0x5571d4[_0x0baf('0x40')]['id'];}return db[_0x0baf('0x4e')][_0x0baf('0x89')]({'where':{'id':_0x5571d4['params']['id']},'include':[{'model':db[_0x0baf('0xe1')],'as':_0x0baf('0x7b')}]})['then'](handleEntityNotFound(_0x16579f,null))[_0x0baf('0x24')](saveUpdates(_0x5571d4[_0x0baf('0x40')],null))['then'](respondWithResult(_0x16579f,null))[_0x0baf('0x2e')](handleError(_0x16579f,null));};exports[_0x0baf('0xe2')]=function(_0x19457c,_0x1f0b00,_0x2484d4){if(_0x19457c[_0x0baf('0x40')]['id']){delete _0x19457c[_0x0baf('0x40')]['id'];}return db[_0x0baf('0x4e')]['find']({'where':{'id':_0x19457c[_0x0baf('0xc8')]['id']}})[_0x0baf('0x24')](function(_0x226edd){if(!_0x226edd){logger[_0x0baf('0x2a')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0x0baf('0xe2'),0x194,_0x0baf('0xe3'));_0x1f0b00['sendStatus'](0x194);}else{if(_0x226edd[_0x0baf('0x8a')]){throw new db[(_0x0baf('0xdb'))][(_0x0baf('0xdc'))](_0x0baf('0xe4'));}}return _0x226edd;})['then'](function(_0x3ca1a6){if(_0x3ca1a6){return _0x3ca1a6[_0x0baf('0x3c')]({'closed':_0x19457c[_0x0baf('0x40')][_0x0baf('0xe5')],'disposition':_0x19457c[_0x0baf('0x40')]['disposition']})[_0x0baf('0x24')](function(_0xc5ec1a){return _0xc5ec1a;});}})[_0x0baf('0x24')](function(_0x5d33b4){return respondWithRpcPromise(_0x0baf('0xe6'),_0x0baf('0xe2'),_0x19457c[_0x0baf('0x40')],client9004);})[_0x0baf('0x24')](respondWithResult(_0x1f0b00,null))[_0x0baf('0x2e')](handleError(_0x1f0b00,null));};exports['attachmentUpload']=function(_0x553084,_0x19898e,_0x315ada){_0x553084[_0x0baf('0x40')]['name']=_0x553084[_0x0baf('0xe7')][_0x0baf('0xe8')];_0x553084[_0x0baf('0x40')][_0x0baf('0xe9')]=_0x553084[_0x0baf('0xe7')][_0x0baf('0xea')];_0x553084[_0x0baf('0x40')][_0x0baf('0x50')]=_0x553084[_0x0baf('0xe7')][_0x0baf('0xeb')];return db['Attachment'][_0x0baf('0xcd')](_0x553084[_0x0baf('0x40')])[_0x0baf('0x24')](respondWithResult(_0x19898e,0xc9))[_0x0baf('0x2e')](handleError(_0x19898e,null));};exports['attachmentDownload']=function(_0x413d0d,_0x3d7667,_0x386928){return db['ChatInteraction'][_0x0baf('0xd0')]({'where':{'id':_0x413d0d[_0x0baf('0xc8')]['id']},'raw':!![]})[_0x0baf('0x24')](handleEntityNotFound(_0x3d7667,null))[_0x0baf('0x24')](function(_0x1e4bf1){if(_0x1e4bf1){if(_0x1e4bf1['closed']){return _0x3d7667[_0x0baf('0x30')](0x193)[_0x0baf('0x32')]({'status':0x193,'message':'Unauthorized'});}return db['Attachment'][_0x0baf('0xd0')]({'where':{'id':_0x413d0d[_0x0baf('0x53')][_0x0baf('0xec')]},'raw':!![]})[_0x0baf('0x24')](handleEntityNotFound(_0x3d7667,null));}})[_0x0baf('0x24')](function(_0xb22125){if(_0xb22125){var _0x37c83a=_0xb22125['ChatOfflineMessageId']!==null;var _0x5deb7b=path[_0x0baf('0xed')](config[_0x0baf('0xee')],_0x0baf('0xef'));if(_0x37c83a){_0x5deb7b=path['join'](_0x5deb7b,_0x0baf('0xf0'));}var _0x3a6bf8=path['join'](_0x5deb7b,_0xb22125[_0x0baf('0xe9')]);return _0x3d7667[_0x0baf('0xf1')](_0x3a6bf8);}})['catch'](handleError(_0x3d7667,null));};exports[_0x0baf('0xf2')]=function(_0x9d6974,_0x939365){var _0x4d6ac4=null;var _0x1d86c9=null;var _0x95fe84=null;var _0x2a7138=null;if(_0x9d6974[_0x0baf('0x40')]['id']){delete _0x9d6974[_0x0baf('0x40')]['id'];}if(_0x9d6974[_0x0baf('0x40')][_0x0baf('0xf3')]){_0x2a7138=path['join'](config[_0x0baf('0xee')],'server/files/chat/upload/',util[_0x0baf('0xf4')](_0x0baf('0xf5'),Date['now']()));_0x9d6974['body'][_0x0baf('0xf6')]=_0x2a7138;}return db[_0x0baf('0x4e')][_0x0baf('0x89')]({'where':{'id':_0x9d6974['params']['id']},'include':[{'model':db[_0x0baf('0xf7')],'as':_0x0baf('0xf8'),'include':[{'model':db[_0x0baf('0xf9')],'as':_0x0baf('0xf9')}]}]})[_0x0baf('0x24')](handleEntityNotFound(_0x939365,null))[_0x0baf('0x24')](saveUpdates(_0x9d6974[_0x0baf('0x40')],null))[_0x0baf('0x24')](function(_0x5f3691){if(_0x5f3691){_0x4d6ac4=_0x5f3691;return db['ChatWebsite'][_0x0baf('0x89')]({'where':{'id':_0x4d6ac4[_0x0baf('0x8d')]}});}})['then'](function(_0x210047){if(_0x210047){_0x95fe84=_0x210047;return db[_0x0baf('0xe1')][_0x0baf('0x89')]({'where':{'id':_0x4d6ac4[_0x0baf('0x80')]}});}})[_0x0baf('0x24')](function(_0x8806f9){if(_0x8806f9){_0x1d86c9=_0x8806f9;if(_0x2a7138){var _0x1cb69a=null;for(var _0x4bc31f=0x1;_0x4bc31f<_0x4d6ac4[_0x0baf('0xf8')]['length'];++_0x4bc31f){_0x1cb69a=_0x4d6ac4[_0x0baf('0xf8')][_0x4bc31f];var _0x32abf2=_0x1cb69a['UserId']?util['format'](_0x0baf('0xfa'),_0x95fe84[_0x0baf('0xfb')],_0x1cb69a[_0x0baf('0x8a')]):_0x0baf('0xfc');var _0x4759d5=_0x9d6974[_0x0baf('0x40')][_0x0baf('0xfd')]||util['format']('%s%d','Visitor',_0x1cb69a[_0x0baf('0x80')]);switch(_0x95fe84['agentIdentifier']){case _0x0baf('0xfe'):_0x32abf2=_0x1cb69a[_0x0baf('0x8a')]?util['format']('%s%d',_0x95fe84[_0x0baf('0xfb')],_0x1cb69a[_0x0baf('0x8a')]):_0x0baf('0xfc');break;case _0x0baf('0xff'):_0x32abf2=_0x1cb69a[_0x0baf('0x8a')]?_0x1cb69a['User'][_0x0baf('0x100')]||_0x1cb69a[_0x0baf('0xf9')][_0x0baf('0x47')]:_0x0baf('0xfc');break;case _0x0baf('0x101'):_0x32abf2=_0x1cb69a[_0x0baf('0x8a')]?_0x1cb69a['User'][_0x0baf('0x47')]:_0x0baf('0xfc');break;default:_0x32abf2=_0x1cb69a[_0x0baf('0x8a')]?util['format'](_0x0baf('0xfa'),_0x95fe84[_0x0baf('0xfb')],_0x1cb69a['UserId']):_0x0baf('0xfc');}var _0xe93008=util[_0x0baf('0xf4')](_0x0baf('0x102'),moment(_0x1cb69a['createdAt'])['format'](_0x0baf('0x103')),_0x1cb69a[_0x0baf('0x104')]==='in'?_0x4759d5:_0x32abf2,_0x1cb69a['body']);if(!_0x1cb69a[_0x0baf('0x105')]){fs[_0x0baf('0x106')](_0x2a7138,_0xe93008);}}return db[_0x0baf('0x107')][_0x0baf('0xd0')]({'where':{'service':!![]},'include':[{'model':db[_0x0baf('0x108')],'as':'Smtp','raw':!![]}]});}}})[_0x0baf('0x24')](function(_0x1fe362){if(_0x1fe362&&_0x1fe362[_0x0baf('0x109')]&&_0x9d6974[_0x0baf('0x40')]){var _0x51287e={'tls':{'rejectUnauthorized':![]}};if(_0x1fe362[_0x0baf('0x109')]['service']){_0x51287e[_0x0baf('0x10a')]=_0x1fe362[_0x0baf('0x109')][_0x0baf('0x10a')];}else{_0x51287e['host']=_0x1fe362[_0x0baf('0x109')][_0x0baf('0x10b')];_0x51287e[_0x0baf('0x10c')]=_0x1fe362[_0x0baf('0x109')][_0x0baf('0x10c')];_0x51287e[_0x0baf('0x10d')]=_0x1fe362[_0x0baf('0x109')][_0x0baf('0x10d')];}if(_0x1fe362[_0x0baf('0x109')][_0x0baf('0x10e')]){_0x51287e[_0x0baf('0x10f')]={'user':_0x1fe362[_0x0baf('0x109')]['user'],'pass':_0x1fe362['Smtp'][_0x0baf('0x110')]};}return respondWithRpcPromise('SendMail','sendMail',{'account':_0x51287e,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x1fe362[_0x0baf('0x3f')],_0x1fe362[_0x0baf('0xd6')]||_0x1fe362['Smtp']['user']),'to':_0x9d6974['body']['mailTranscript'],'subject':_0x0baf('0x111'),'text':util['format'](_0x0baf('0x112'),_0x9d6974[_0x0baf('0x40')][_0x0baf('0xf3')]),'attachments':[{'path':_0x2a7138}]}})[_0x0baf('0x24')](function(){return _0x4d6ac4;})[_0x0baf('0x2e')](function(_0x292469){console[_0x0baf('0x2a')](_0x292469);});}else{return _0x4d6ac4;}})[_0x0baf('0x24')](respondWithStatusCode(_0x939365,0xc8))['catch'](handleError(_0x939365,null));};exports['addMessage']=function(_0x2d7ec3,_0x2a4d79,_0x5ebcad){return db[_0x0baf('0xf7')]['find']({'where':{'id':_0x2d7ec3[_0x0baf('0xc8')]['id']}})['then'](handleEntityNotFound(_0x2a4d79,null))['then'](function(_0x4621ba){if(_0x4621ba){return _0x4621ba[_0x0baf('0x113')](_0x2d7ec3[_0x0baf('0x40')][_0x0baf('0x114')],_[_0x0baf('0x115')](_0x2d7ec3[_0x0baf('0x40')],[_0x0baf('0x114'),'id'])||{});}})[_0x0baf('0x24')](respondWithResult(_0x2a4d79,null))[_0x0baf('0x2e')](handleError(_0x2a4d79,null));};exports[_0x0baf('0x116')]=function(_0x425869,_0x4059e1,_0x2c94ff){var _0x738da0={'raw':![],'where':{}};var _0x268a1c={};var _0x34cb32={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x0baf('0xd0')]({'where':{'id':_0x425869[_0x0baf('0xc8')]['id']}})['then'](handleEntityNotFound(_0x4059e1,null))[_0x0baf('0x24')](function(_0x39526b){if(_0x39526b){_0x268a1c['model']=_[_0x0baf('0x54')](db['ChatMessage'][_0x0baf('0xc9')]);_0x268a1c['query']=_[_0x0baf('0x54')](_0x425869['query']);_0x268a1c[_0x0baf('0x55')]=_[_0x0baf('0x56')](_0x268a1c[_0x0baf('0x52')],_0x268a1c[_0x0baf('0x53')]);_0x738da0['attributes']=_[_0x0baf('0x56')](_0x268a1c[_0x0baf('0x52')],qs[_0x0baf('0x58')](_0x425869[_0x0baf('0x53')]['fields']));_0x738da0['attributes']=_0x738da0[_0x0baf('0x57')][_0x0baf('0x59')]?_0x738da0[_0x0baf('0x57')]:_0x268a1c[_0x0baf('0x52')];if(!_0x425869['query'][_0x0baf('0x5a')](_0x0baf('0x5b'))){_0x738da0[_0x0baf('0x34')]=qs['limit'](_0x425869['query'][_0x0baf('0x34')]);_0x738da0['offset']=qs[_0x0baf('0x36')](_0x425869['query'][_0x0baf('0x36')]);}_0x738da0[_0x0baf('0x5c')]=qs[_0x0baf('0x5d')](_0x425869['query'][_0x0baf('0x5d')]);_0x738da0[_0x0baf('0x5e')]=qs['filters'](_['pick'](_0x425869[_0x0baf('0x53')],_0x268a1c['filters']));_0x738da0[_0x0baf('0x5e')][_0x0baf('0xc4')]=_0x39526b['id'];if(_0x425869['query']['filter']){_0x738da0[_0x0baf('0x5e')]=_[_0x0baf('0xb1')](_0x738da0['where'],{'$or':_[_0x0baf('0x46')](_0x738da0['attributes'],function(_0x309220){var _0x376eb3={};_0x376eb3[_0x309220]={'$like':'%'+_0x425869['query'][_0x0baf('0x9b')]+'%'};return _0x376eb3;})});}if(_0x425869[_0x0baf('0x53')][_0x0baf('0x91')]){var _0x2ef76b=_0x425869[_0x0baf('0x53')]['$gte'][_0x0baf('0x4a')](',');var _0x4ca9ea={};_0x4ca9ea[_0x2ef76b[0x0]]={'$gte':moment(_0x2ef76b[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x738da0[_0x0baf('0x5e')]=_[_0x0baf('0xb1')](_0x738da0['where'],_0x4ca9ea);}_0x738da0=_[_0x0baf('0xb1')]({},_0x738da0,_0x425869[_0x0baf('0xcc')]);return db['ChatMessage'][_0x0baf('0x35')]({'where':_0x738da0[_0x0baf('0x5e')]})[_0x0baf('0x24')](function(_0x3d6ece){_0x34cb32[_0x0baf('0x35')]=_0x3d6ece;if(_0x425869[_0x0baf('0x53')][_0x0baf('0xca')]){_0x738da0[_0x0baf('0xcb')]=[{'all':!![]}];}return db[_0x0baf('0xf7')][_0x0baf('0x117')](_0x738da0);})['then'](function(_0x19727f){_0x34cb32[_0x0baf('0xc6')]=_0x19727f;return _0x34cb32;});}})[_0x0baf('0x24')](respondWithFilteredResult(_0x4059e1,_0x738da0))[_0x0baf('0x2e')](handleError(_0x4059e1,null));};exports[_0x0baf('0x118')]=function(_0x57b26e,_0x3a0a2f,_0x5b676d){var _0x298155={'where':{}},_0xff9b69={},_0x5398c6={'count':0x0,'rows':[]};return db[_0x0baf('0x4e')][_0x0baf('0xd0')]({'where':{'id':_0x57b26e[_0x0baf('0xc8')]['id']}})[_0x0baf('0x24')](handleEntityNotFound(_0x3a0a2f,null))['then'](function(_0x2edcf9){if(_0x2edcf9){_0xff9b69[_0x0baf('0x52')]=_[_0x0baf('0x54')](db[_0x0baf('0xf7')][_0x0baf('0xc9')]);_0xff9b69[_0x0baf('0x53')]=_[_0x0baf('0x54')](_0x57b26e[_0x0baf('0x53')]);_0xff9b69[_0x0baf('0x55')]=_[_0x0baf('0x56')](_0xff9b69[_0x0baf('0x52')],_0xff9b69[_0x0baf('0x53')]);_0x298155[_0x0baf('0x57')]=_[_0x0baf('0x56')](_0xff9b69[_0x0baf('0x52')],qs[_0x0baf('0x58')](_0x57b26e[_0x0baf('0x53')][_0x0baf('0x58')]));_0x298155['attributes']=_0x298155[_0x0baf('0x57')][_0x0baf('0x59')]?_0x298155[_0x0baf('0x57')]:_0xff9b69[_0x0baf('0x52')];if(!_0x57b26e[_0x0baf('0x53')][_0x0baf('0x5a')](_0x0baf('0x5b'))){_0x298155['limit']=qs[_0x0baf('0x34')](_0x57b26e[_0x0baf('0x53')][_0x0baf('0x34')]);_0x298155[_0x0baf('0x36')]=qs[_0x0baf('0x36')](_0x57b26e[_0x0baf('0x53')][_0x0baf('0x36')]);}_0x298155['order']=qs[_0x0baf('0x5d')](_0x57b26e[_0x0baf('0x53')][_0x0baf('0x5d')]);_0x298155[_0x0baf('0x5e')]=qs[_0x0baf('0x55')](_[_0x0baf('0x5f')](_0x57b26e['query'],_0xff9b69[_0x0baf('0x55')]));_0x298155[_0x0baf('0x5e')][_0x0baf('0xc4')]=_0x2edcf9['id'];if(_0x57b26e[_0x0baf('0x53')][_0x0baf('0x9b')]){_0x298155['where']=_['merge'](_0x298155[_0x0baf('0x5e')],{'$or':_[_0x0baf('0x46')](_0x298155[_0x0baf('0x57')],function(_0x2d43ac){var _0x34126b={};_0x34126b[_0x2d43ac]={'$like':'%'+_0x57b26e[_0x0baf('0x53')][_0x0baf('0x9b')]+'%'};return _0x34126b;})});}_0x298155[_0x0baf('0x5e')][_0x0baf('0x105')]=![];if(_0x57b26e[_0x0baf('0x53')]['id']){_0x298155[_0x0baf('0x5e')]['id']={'$gt':_0x57b26e[_0x0baf('0x53')]['id']};}_0x298155=_[_0x0baf('0xb1')]({},_0x298155,_0x57b26e[_0x0baf('0xcc')]);return db[_0x0baf('0xf7')][_0x0baf('0x35')]({'where':_0x298155[_0x0baf('0x5e')]})[_0x0baf('0x24')](function(_0x18d219){_0x5398c6[_0x0baf('0x35')]=_0x18d219;_0x298155[_0x0baf('0xcb')]=[];if(_0x57b26e[_0x0baf('0x53')][_0x0baf('0x119')]){_0x298155[_0x0baf('0xcb')][_0x0baf('0x4c')]({'model':db[_0x0baf('0xf9')],'as':_0x0baf('0xf9'),'attributes':['id','fullname',_0x0baf('0x100')]});}if(_0x57b26e[_0x0baf('0x53')][_0x0baf('0xca')]){_0x298155[_0x0baf('0xcb')]=[{'all':!![]}];}return db[_0x0baf('0xf7')]['findAll'](_0x298155);})[_0x0baf('0x24')](function(_0x344fef){_0x5398c6[_0x0baf('0xc6')]=_0x344fef;return _0x5398c6;});}})[_0x0baf('0x24')](respondWithFilteredResult(_0x3a0a2f,_0x298155))[_0x0baf('0x2e')](handleError(_0x3a0a2f,null));};exports[_0x0baf('0x11a')]=function(_0x3358f5,_0x237a20,_0x26dd4c){return db[_0x0baf('0x4e')][_0x0baf('0x89')]({'where':{'id':_0x3358f5[_0x0baf('0xc8')]['id']}})[_0x0baf('0x24')](handleEntityNotFound(_0x237a20,null))[_0x0baf('0x24')](function(_0x2867b7){if(_0x2867b7){return _0x2867b7[_0x0baf('0x11b')](_0x3358f5[_0x0baf('0x40')][_0x0baf('0x114')],_['omit'](_0x3358f5[_0x0baf('0x40')],['ids','id'])||{})['spread'](function(){return db[_0x0baf('0x84')][_0x0baf('0x117')]({'attributes':['id',_0x0baf('0x3f'),'color'],'where':{'id':_0x3358f5[_0x0baf('0x40')][_0x0baf('0x114')]}});})[_0x0baf('0x24')](function(_0x24bc8f){socket[_0x0baf('0x11c')](_0x0baf('0x11d'),{'id':Number(_0x3358f5['params']['id']),'tags':_0x24bc8f||[]});return{'id':Number(_0x3358f5[_0x0baf('0xc8')]['id']),'tags':_0x24bc8f||[]};});}})[_0x0baf('0x24')](respondWithResult(_0x237a20,null))[_0x0baf('0x2e')](handleError(_0x237a20,null));};exports[_0x0baf('0x11e')]=function(_0x262063,_0x216897,_0x4c2bae){return db[_0x0baf('0x4e')]['find']({'where':{'id':_0x262063[_0x0baf('0xc8')]['id']}})[_0x0baf('0x24')](handleEntityNotFound(_0x216897,null))['then'](function(_0x56da3e){if(_0x56da3e){return _0x56da3e[_0x0baf('0x11e')](_0x262063[_0x0baf('0x53')][_0x0baf('0x114')]);}})['then'](respondWithStatusCode(_0x216897,null))[_0x0baf('0x2e')](handleError(_0x216897,null));};exports[_0x0baf('0xf1')]=function(_0x51d2aa,_0x26d73d){var _0x20cc18=moment()[_0x0baf('0x11f')]()[_0x0baf('0xb0')]();var _0x3fa8eb=path[_0x0baf('0xed')](config[_0x0baf('0xee')],'server','files',_0x0baf('0x120'));var _0x1bd67f=path[_0x0baf('0xed')](config[_0x0baf('0xee')],_0x0baf('0x121'),_0x0baf('0x122'),_0x0baf('0x123'));var _0x4316c5=path[_0x0baf('0xed')](_0x3fa8eb,_0x20cc18);var _0x1d5b73=util['format']('transcript-%d-%s.zip',_0x51d2aa[_0x0baf('0xc8')]['id'],_0x20cc18);var _0x2a84f8=path[_0x0baf('0xed')](_0x3fa8eb,_0x1d5b73);var _0x552504=[];_0x552504['push']({'model':db[_0x0baf('0xf9')],'as':_0x0baf('0xf9'),'attributes':['id',_0x0baf('0x47')],'raw':!![]});_0x552504[_0x0baf('0x4c')]({'model':db['CmContact'],'as':_0x0baf('0x7b'),'attributes':['id',_0x0baf('0x124'),_0x0baf('0x125')],'raw':!![]});if(_0x51d2aa[_0x0baf('0x53')][_0x0baf('0x123')]){_0x552504[_0x0baf('0x4c')]({'model':db[_0x0baf('0x126')],'as':_0x0baf('0x126'),'raw':!![]});}var _0x5bbd33=[{'model':db[_0x0baf('0xf7')],'as':_0x0baf('0xf8'),'attributes':['id',_0x0baf('0x40'),_0x0baf('0x8f'),_0x0baf('0x104'),_0x0baf('0x105'),'read'],'include':_0x552504}];_0x5bbd33[_0x0baf('0x4c')]({'model':db[_0x0baf('0xd1')],'as':'Account','attributes':['id','name']});_0x5bbd33[_0x0baf('0x4c')]({'model':db['User'],'as':_0x0baf('0x127'),'attributes':['id',_0x0baf('0x47')]});return db[_0x0baf('0x4e')][_0x0baf('0x89')]({'where':{'id':_0x51d2aa['params']['id']},'include':_0x5bbd33})[_0x0baf('0x24')](handleEntityNotFound(_0x26d73d,null))[_0x0baf('0x24')](function(_0x32c2a8){if(_0x32c2a8){var _0x58fea2=_0x32c2a8[_0x0baf('0x128')]({'plain':!![]});fs[_0x0baf('0x129')](_0x4316c5);var _0x5f5d45={'channel':_0x0baf('0x12a'),'account':_0x58fea2['Account'][_0x0baf('0x3f')],'agent':_0x58fea2[_0x0baf('0x127')]?_0x58fea2[_0x0baf('0x127')][_0x0baf('0x47')]:'N.A.','createdAt':moment(_0x58fea2[_0x0baf('0x8f')])[_0x0baf('0xf4')]('YYYY-MM-DD\x20HH:mm:ss')[_0x0baf('0xb0')](),'closedAt':_0x58fea2[_0x0baf('0xe5')]?moment(_0x58fea2['closedAt'])[_0x0baf('0xf4')](_0x0baf('0x12b'))['toString']():'','disposition':_0x58fea2[_0x0baf('0x12c')],'chatInfo':{'browser':_0x58fea2[_0x0baf('0x12d')],'os':_0x58fea2[_0x0baf('0x12e')],'referer':_0x58fea2[_0x0baf('0x12f')],'customerIp':_0x58fea2[_0x0baf('0x130')],'customerPort':_0x58fea2[_0x0baf('0x131')]?_0x58fea2['customerPort']:_0x0baf('0x132')},'messages':_(_0x58fea2[_0x0baf('0xf8')])[_0x0baf('0x133')]()[_0x0baf('0x9b')]({'secret':![]})[_0x0baf('0x46')](function(_0x1ca912){if(_0x1ca912[_0x0baf('0x126')]){var _0x70e2e=path[_0x0baf('0xed')](_0x1bd67f,_0x1ca912[_0x0baf('0x126')][_0x0baf('0xe9')]);if(fs[_0x0baf('0x134')](_0x70e2e)){fs[_0x0baf('0x135')](_0x70e2e)[_0x0baf('0x136')](fs[_0x0baf('0x137')](path[_0x0baf('0xed')](_0x4316c5,_0x1ca912[_0x0baf('0x126')][_0x0baf('0xe9')])));}}return{'date':moment(_0x1ca912[_0x0baf('0x8f')])[_0x0baf('0xf4')](_0x0baf('0x12b'))[_0x0baf('0xb0')](),'sender':_0x1ca912['direction']===_0x0baf('0xdf')?_0x1ca912[_0x0baf('0xf9')]?_0x1ca912['User']['fullname']:'System':_0x1ca912[_0x0baf('0x7b')]['firstName']+(_0x1ca912['Contact']['lastName']?'\x20'+_0x1ca912[_0x0baf('0x7b')][_0x0baf('0x125')]:''),'body':_0x1ca912[_0x0baf('0x126')]?_0x1ca912['Attachment'][_0x0baf('0xe9')]:_0x1ca912['body'],'direction':_0x1ca912['direction']===_0x0baf('0xdf')?'A':'C','secret':_0x1ca912[_0x0baf('0x105')],'read':_0x1ca912[_0x0baf('0x96')],'attachment':_0x1ca912['Attachment']};})['value']()};return ejs[_0x0baf('0x138')](path[_0x0baf('0xed')](config[_0x0baf('0xee')],_0x0baf('0x121'),_0x0baf('0x139'),_0x0baf('0x13a')),{'interaction':_0x5f5d45})['then'](function(_0x4c1f01){var _0x217cd8=path[_0x0baf('0xed')](_0x4316c5,'transcript-'+_0x58fea2['id']+'-'+_0x20cc18+_0x0baf('0x13b'));var _0x223d32={'path':_0x217cd8,'channel':_0x0baf('0x12a'),'interactionId':_0x58fea2['id']};return pdf[_0x0baf('0x13c')](_0x4c1f01,_0x223d32);})['then'](function(){return new BPromise(function(_0xcca408,_0x557ec9){zipdir(_0x4316c5,{'saveTo':_0x2a84f8},function(_0x479231,_0x320409){if(_0x479231)return _0x557ec9(_0x479231);return _0xcca408(_0x320409);});})['then'](function(){return new BPromise(function(_0x4a0f32,_0xc6fc4d){rimraf(_0x4316c5,function(_0x46b904){if(_0x46b904)_0xc6fc4d(_0x46b904);return _0x4a0f32();});});})['then'](function(){return _0x26d73d[_0x0baf('0xf1')](_0x2a84f8,_0x1d5b73,function(_0x2dea20){if(_0x2dea20){console[_0x0baf('0x13d')](_0x0baf('0x13e'),_0x2dea20);}else{fs[_0x0baf('0x13f')](_0x2a84f8);}});});});}else{return _0x26d73d[_0x0baf('0x2f')](0xc8);}})['catch'](handleError(_0x26d73d,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 8305c13..28d6f88 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 _0x0d7f=['exports','../../mysqldb','ChatInteraction','ChatMessage','save','update','getUsers','then','Users','map','findAll','setDataValue','unreadMessages','emit','catch','hasOwnProperty','hook'];(function(_0x5841c1,_0x575a6f){var _0x41ad9c=function(_0x28b5fe){while(--_0x28b5fe){_0x5841c1['push'](_0x5841c1['shift']());}};_0x41ad9c(++_0x575a6f);}(_0x0d7f,0x78));var _0xf0d7=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x0d7f[_0x17b6e3];return _0x3906f3;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0xf0d7('0x0'))['db'][_0xf0d7('0x1')];var ChatMessage=require('../../mysqldb')['db'][_0xf0d7('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf0d7('0x3'),'afterUpdate':_0xf0d7('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1cca63){return function(_0x22f4e9,_0x176add,_0x27d8f0){_0x22f4e9[_0xf0d7('0x5')]({'attributes':['id'],'raw':!![]})[_0xf0d7('0x6')](function(_0x259131){_0x22f4e9['setDataValue'](_0xf0d7('0x7'),_0x259131[_0xf0d7('0x8')](function(_0x120d91){return{'id':_0x120d91['id']};}));return ChatMessage[_0xf0d7('0x9')]({'where':{'ChatInteractionId':_0x22f4e9['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf0d7('0x6')](function(_0x5f3602){_0x22f4e9[_0xf0d7('0xa')](_0xf0d7('0xb'),_0x5f3602['length']);ChatInteractionEvents[_0xf0d7('0xc')](_0x1cca63+':'+_0x22f4e9['id'],_0x22f4e9);ChatInteractionEvents['emit'](_0x1cca63,_0x22f4e9);_0x27d8f0(null);})[_0xf0d7('0xd')](_0x27d8f0(null));};}for(var e in events){if(events[_0xf0d7('0xe')](e)){var event=events[e];ChatInteraction[_0xf0d7('0xf')](e,emitEvent(event));}}module[_0xf0d7('0x10')]=ChatInteractionEvents; \ No newline at end of file +var _0x4ecc=['map','unreadMessages','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','ChatMessage','setMaxListeners','save','update','remove','getUsers','then','Users'];(function(_0x408753,_0x5176e1){var _0x1ba6f1=function(_0x2ed00d){while(--_0x2ed00d){_0x408753['push'](_0x408753['shift']());}};_0x1ba6f1(++_0x5176e1);}(_0x4ecc,0x177));var _0xc4ec=function(_0xca1f0e,_0x2713d5){_0xca1f0e=_0xca1f0e-0x0;var _0x35e4ef=_0x4ecc[_0xca1f0e];return _0x35e4ef;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0xc4ec('0x0'))['db']['ChatInteraction'];var ChatMessage=require(_0xc4ec('0x0'))['db'][_0xc4ec('0x1')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xc4ec('0x2')](0x0);var events={'afterCreate':_0xc4ec('0x3'),'afterUpdate':_0xc4ec('0x4'),'afterDestroy':_0xc4ec('0x5')};function emitEvent(_0x448c21){return function(_0x4624a4,_0x86ef0d,_0x147f2c){_0x4624a4[_0xc4ec('0x6')]({'attributes':['id'],'raw':!![]})[_0xc4ec('0x7')](function(_0x29e24f){_0x4624a4['setDataValue'](_0xc4ec('0x8'),_0x29e24f[_0xc4ec('0x9')](function(_0x129175){return{'id':_0x129175['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x4624a4['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3fc874){_0x4624a4['setDataValue'](_0xc4ec('0xa'),_0x3fc874['length']);ChatInteractionEvents[_0xc4ec('0xb')](_0x448c21+':'+_0x4624a4['id'],_0x4624a4);ChatInteractionEvents['emit'](_0x448c21,_0x4624a4);_0x147f2c(null);})[_0xc4ec('0xc')](_0x147f2c(null));};}for(var e in events){if(events[_0xc4ec('0xd')](e)){var event=events[e];ChatInteraction[_0xc4ec('0xe')](e,emitEvent(event));}}module[_0xc4ec('0xf')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index eb78894..601220b 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 _0x16c4=['YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closedAt','format'];(function(_0x543e6b,_0x218c9a){var _0xffb501=function(_0x8e7b6b){while(--_0x8e7b6b){_0x543e6b['push'](_0x543e6b['shift']());}};_0xffb501(++_0x218c9a);}(_0x16c4,0x120));var _0x416c=function(_0x494d1f,_0x3f72ff){_0x494d1f=_0x494d1f-0x0;var _0x457b6e=_0x16c4[_0x494d1f];return _0x457b6e;};'use strict';var _=require(_0x416c('0x0'));var util=require(_0x416c('0x1'));var logger=require('../../config/logger')(_0x416c('0x2'));var moment=require('moment');var BPromise=require(_0x416c('0x3'));var rp=require(_0x416c('0x4'));var fs=require('fs');var path=require(_0x416c('0x5'));var rimraf=require(_0x416c('0x6'));var config=require(_0x416c('0x7'));var attributes=require(_0x416c('0x8'));module[_0x416c('0x9')]=function(_0xa69c0d,_0x1d5e9d){return _0xa69c0d[_0x416c('0xa')](_0x416c('0xb'),attributes,{'tableName':_0x416c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x431bf9,_0xfb133,_0x459bb4){if(_0x431bf9[_0x416c('0xd')]('closed')){_0x431bf9[_0x416c('0xe')]=moment()[_0x416c('0xf')](_0x416c('0x10'));}_0x459bb4(null,_0x431bf9);}},'charset':_0x416c('0x11'),'collate':_0x416c('0x12')});}; \ No newline at end of file +var _0xc23c=['request-promise','path','../../config/environment','./chatInteraction.attributes','exports','define','chat_interactions','changed','closed','closedAt','format','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird'];(function(_0x28f1de,_0x355054){var _0x5b5dad=function(_0x399b72){while(--_0x399b72){_0x28f1de['push'](_0x28f1de['shift']());}};_0x5b5dad(++_0x355054);}(_0xc23c,0x187));var _0xcc23=function(_0x2a9f4,_0x25c14a){_0x2a9f4=_0x2a9f4-0x0;var _0x3c39e0=_0xc23c[_0x2a9f4];return _0x3c39e0;};'use strict';var _=require(_0xcc23('0x0'));var util=require(_0xcc23('0x1'));var logger=require('../../config/logger')(_0xcc23('0x2'));var moment=require(_0xcc23('0x3'));var BPromise=require(_0xcc23('0x4'));var rp=require(_0xcc23('0x5'));var fs=require('fs');var path=require(_0xcc23('0x6'));var rimraf=require('rimraf');var config=require(_0xcc23('0x7'));var attributes=require(_0xcc23('0x8'));module[_0xcc23('0x9')]=function(_0x5a6a89,_0x2a3791){return _0x5a6a89[_0xcc23('0xa')]('ChatInteraction',attributes,{'tableName':_0xcc23('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x298aed,_0x115710,_0x54d54e){if(_0x298aed[_0xcc23('0xc')](_0xcc23('0xd'))){_0x298aed[_0xcc23('0xe')]=moment()[_0xcc23('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x54d54e(null,_0x298aed);}},'charset':_0xcc23('0x10'),'collate':_0xcc23('0x11')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index abae7c3..0be062f 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 _0x7cc5=['error','code','message','ChatInteraction,\x20%s,\x20%s','result','UpdateChatInteraction','ChatInteraction','body','options','attributes','limit','then','AddTagsToChatInteraction','where','addTags','omit','ids','AddTags','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','redis','defaults','socket.io-emitter','./chatInteraction.socket','register','request','info','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x1aa21c,_0xe7dedd){var _0x45edb8=function(_0xa003be){while(--_0xa003be){_0x1aa21c['push'](_0x1aa21c['shift']());}};_0x45edb8(++_0xe7dedd);}(_0x7cc5,0x153));var _0x57cc=function(_0x197005,_0x1d8b1b){_0x197005=_0x197005-0x0;var _0x5501e1=_0x7cc5[_0x197005];return _0x5501e1;};'use strict';var _=require(_0x57cc('0x0'));var util=require(_0x57cc('0x1'));var moment=require(_0x57cc('0x2'));var BPromise=require('bluebird');var rs=require(_0x57cc('0x3'));var fs=require('fs');var Redis=require(_0x57cc('0x4'));var db=require(_0x57cc('0x5'))['db'];var utils=require(_0x57cc('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x57cc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x57cc('0x8')][_0x57cc('0x9')]({'port':0x232a});config[_0x57cc('0xa')]=_[_0x57cc('0xb')](config[_0x57cc('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x57cc('0xc'))(new Redis(config[_0x57cc('0xa')]));require(_0x57cc('0xd'))[_0x57cc('0xe')](socket);function respondWithRpcPromise(_0x1a7063,_0x5704d2,_0x45b7c5){return new BPromise(function(_0x47d340,_0x32b349){return client[_0x57cc('0xf')](_0x1a7063,_0x45b7c5)['then'](function(_0x3b214c){logger[_0x57cc('0x10')]('ChatInteraction,\x20%s,\x20%s',_0x5704d2,'request\x20sent');logger[_0x57cc('0x11')](_0x57cc('0x12'),_0x5704d2,_0x57cc('0x13'),JSON[_0x57cc('0x14')](_0x3b214c));if(_0x3b214c[_0x57cc('0x15')]){if(_0x3b214c['error'][_0x57cc('0x16')]===0x1f4){logger[_0x57cc('0x15')]('ChatInteraction,\x20%s,\x20%s',_0x5704d2,_0x3b214c['error']['message']);return _0x32b349(_0x3b214c[_0x57cc('0x15')][_0x57cc('0x17')]);}logger[_0x57cc('0x15')](_0x57cc('0x18'),_0x5704d2,_0x3b214c['error'][_0x57cc('0x17')]);return _0x47d340(_0x3b214c[_0x57cc('0x15')]['message']);}else{logger[_0x57cc('0x10')](_0x57cc('0x18'),_0x5704d2,_0x57cc('0x13'));_0x47d340(_0x3b214c[_0x57cc('0x19')]['message']);}})['catch'](function(_0x2c29db){logger[_0x57cc('0x15')](_0x57cc('0x18'),_0x5704d2,_0x2c29db);_0x32b349(_0x2c29db);});});}exports[_0x57cc('0x1a')]=function(_0x4dceb9){var _0x5e8c5b=this;return new Promise(function(_0x3b3c94,_0x201242){return db[_0x57cc('0x1b')]['update'](_0x4dceb9[_0x57cc('0x1c')],{'raw':_0x4dceb9[_0x57cc('0x1d')]?_0x4dceb9[_0x57cc('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4dceb9[_0x57cc('0x1d')]?_0x4dceb9[_0x57cc('0x1d')]['where']||null:null,'attributes':_0x4dceb9[_0x57cc('0x1d')]?_0x4dceb9['options'][_0x57cc('0x1e')]||null:null,'limit':_0x4dceb9[_0x57cc('0x1d')]?_0x4dceb9[_0x57cc('0x1d')][_0x57cc('0x1f')]||null:null})[_0x57cc('0x20')](function(_0x1bc7fa){logger[_0x57cc('0x10')](_0x57cc('0x1a'),_0x4dceb9);logger[_0x57cc('0x11')](_0x57cc('0x1a'),_0x4dceb9,JSON[_0x57cc('0x14')](_0x1bc7fa));_0x3b3c94(_0x1bc7fa);})['catch'](function(_0x479be5){logger[_0x57cc('0x15')](_0x57cc('0x1a'),_0x479be5[_0x57cc('0x17')],_0x4dceb9);_0x201242(_0x5e8c5b[_0x57cc('0x15')](0x1f4,_0x479be5['message']));});});};exports[_0x57cc('0x21')]=function(_0x18a8a4){return new Promise(function(_0x2b2b37,_0x1fc45b){return db['ChatInteraction']['find']({'where':_0x18a8a4['options']?_0x18a8a4[_0x57cc('0x1d')][_0x57cc('0x22')]||null:null})[_0x57cc('0x20')](function(_0x39efaf){if(_0x39efaf){return _0x39efaf[_0x57cc('0x23')](_0x18a8a4[_0x57cc('0x1c')]['ids'],_[_0x57cc('0x24')](_0x18a8a4[_0x57cc('0x1c')],[_0x57cc('0x25'),'id'])||{});}})['spread'](function(_0x3356c9){logger['info'](_0x57cc('0x26'),_0x18a8a4);logger[_0x57cc('0x11')](_0x57cc('0x26'),_0x18a8a4,JSON['stringify'](_0x3356c9));_0x2b2b37(_0x3356c9);})[_0x57cc('0x27')](function(_0x336b86){logger[_0x57cc('0x15')]('AddTags',_0x336b86[_0x57cc('0x17')],_0x18a8a4);_0x1fc45b(_this['error'](0x1f4,_0x336b86[_0x57cc('0x17')]));});});}; \ No newline at end of file +var _0x620f=['spread','AddTags','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','ChatInteraction','update','body','options','raw','attributes','limit','UpdateChatInteraction','catch','AddTagsToChatInteraction','omit'];(function(_0xf13d0d,_0x3df04c){var _0x4e55f2=function(_0xe546eb){while(--_0xe546eb){_0xf13d0d['push'](_0xf13d0d['shift']());}};_0x4e55f2(++_0x3df04c);}(_0x620f,0x1af));var _0xf620=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x620f[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var util=require(_0xf620('0x0'));var moment=require(_0xf620('0x1'));var BPromise=require(_0xf620('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf620('0x3'));var db=require(_0xf620('0x4'))['db'];var utils=require(_0xf620('0x5'));var logger=require(_0xf620('0x6'))(_0xf620('0x7'));var config=require(_0xf620('0x8'));var jayson=require(_0xf620('0x9'));var client=jayson['client'][_0xf620('0xa')]({'port':0x232a});config[_0xf620('0xb')]=_[_0xf620('0xc')](config[_0xf620('0xb')],{'host':_0xf620('0xd'),'port':0x18eb});var socket=require(_0xf620('0xe'))(new Redis(config[_0xf620('0xb')]));require(_0xf620('0xf'))['register'](socket);function respondWithRpcPromise(_0x5ed84c,_0x1e7b1e,_0x2d059d){return new BPromise(function(_0x8bd8f3,_0x1d627f){return client['request'](_0x5ed84c,_0x2d059d)[_0xf620('0x10')](function(_0x4a462d){logger['info'](_0xf620('0x11'),_0x1e7b1e,_0xf620('0x12'));logger[_0xf620('0x13')](_0xf620('0x14'),_0x1e7b1e,'request\x20sent',JSON[_0xf620('0x15')](_0x4a462d));if(_0x4a462d[_0xf620('0x16')]){if(_0x4a462d[_0xf620('0x16')]['code']===0x1f4){logger[_0xf620('0x16')](_0xf620('0x11'),_0x1e7b1e,_0x4a462d['error'][_0xf620('0x17')]);return _0x1d627f(_0x4a462d[_0xf620('0x16')]['message']);}logger[_0xf620('0x16')](_0xf620('0x11'),_0x1e7b1e,_0x4a462d[_0xf620('0x16')][_0xf620('0x17')]);return _0x8bd8f3(_0x4a462d['error'][_0xf620('0x17')]);}else{logger[_0xf620('0x18')](_0xf620('0x11'),_0x1e7b1e,_0xf620('0x12'));_0x8bd8f3(_0x4a462d[_0xf620('0x19')][_0xf620('0x17')]);}})['catch'](function(_0x1e63b8){logger[_0xf620('0x16')](_0xf620('0x11'),_0x1e7b1e,_0x1e63b8);_0x1d627f(_0x1e63b8);});});}exports['UpdateChatInteraction']=function(_0x1d9be0){var _0x15d6d2=this;return new Promise(function(_0xd20a4c,_0x14a1ed){return db[_0xf620('0x1a')][_0xf620('0x1b')](_0x1d9be0[_0xf620('0x1c')],{'raw':_0x1d9be0['options']?_0x1d9be0[_0xf620('0x1d')][_0xf620('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d9be0[_0xf620('0x1d')]?_0x1d9be0[_0xf620('0x1d')]['where']||null:null,'attributes':_0x1d9be0[_0xf620('0x1d')]?_0x1d9be0['options'][_0xf620('0x1f')]||null:null,'limit':_0x1d9be0['options']?_0x1d9be0['options'][_0xf620('0x20')]||null:null})[_0xf620('0x10')](function(_0x539650){logger[_0xf620('0x18')]('UpdateChatInteraction',_0x1d9be0);logger[_0xf620('0x13')](_0xf620('0x21'),_0x1d9be0,JSON['stringify'](_0x539650));_0xd20a4c(_0x539650);})[_0xf620('0x22')](function(_0x154b82){logger[_0xf620('0x16')]('UpdateChatInteraction',_0x154b82[_0xf620('0x17')],_0x1d9be0);_0x14a1ed(_0x15d6d2[_0xf620('0x16')](0x1f4,_0x154b82['message']));});});};exports[_0xf620('0x23')]=function(_0x11b6bf){return new Promise(function(_0x12ffe4,_0x594806){return db[_0xf620('0x1a')]['find']({'where':_0x11b6bf[_0xf620('0x1d')]?_0x11b6bf['options']['where']||null:null})[_0xf620('0x10')](function(_0xc7bb29){if(_0xc7bb29){return _0xc7bb29['addTags'](_0x11b6bf[_0xf620('0x1c')]['ids'],_[_0xf620('0x24')](_0x11b6bf[_0xf620('0x1c')],['ids','id'])||{});}})[_0xf620('0x25')](function(_0x4e5def){logger[_0xf620('0x18')](_0xf620('0x26'),_0x11b6bf);logger[_0xf620('0x13')](_0xf620('0x26'),_0x11b6bf,JSON[_0xf620('0x15')](_0x4e5def));_0x12ffe4(_0x4e5def);})[_0xf620('0x22')](function(_0x589793){logger[_0xf620('0x16')]('AddTags',_0x589793[_0xf620('0x17')],_0x11b6bf);_0x594806(_this[_0xf620('0x16')](0x1f4,_0x589793['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index ca203e8..8044e52 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 _0xe444=['./chatInteraction.events','save','emit','removeListener','register','length','chatInteraction:'];(function(_0x5473aa,_0x494457){var _0x1c2368=function(_0x251c07){while(--_0x251c07){_0x5473aa['push'](_0x5473aa['shift']());}};_0x1c2368(++_0x494457);}(_0xe444,0xe0));var _0x4e44=function(_0x3a343f,_0x135325){_0x3a343f=_0x3a343f-0x0;var _0x36c538=_0xe444[_0x3a343f];return _0x36c538;};'use strict';var ChatInteractionEvents=require(_0x4e44('0x0'));var events=[_0x4e44('0x1'),'remove','update'];function createListener(_0x234992,_0x31b323){return function(_0x33fde8){_0x31b323[_0x4e44('0x2')](_0x234992,_0x33fde8);};}function removeListener(_0x5aa738,_0x4c8454){return function(){ChatInteractionEvents[_0x4e44('0x3')](_0x5aa738,_0x4c8454);};}exports[_0x4e44('0x4')]=function(_0x31b783){for(var _0x59c7d1=0x0,_0x276d09=events[_0x4e44('0x5')];_0x59c7d1<_0x276d09;_0x59c7d1++){var _0x1af927=events[_0x59c7d1];var _0x5c021f=createListener(_0x4e44('0x6')+_0x1af927,_0x31b783);ChatInteractionEvents['on'](_0x1af927,_0x5c021f);}}; \ No newline at end of file +var _0x8734=['removeListener','chatInteraction:','./chatInteraction.events','remove','update','emit'];(function(_0x2e11d3,_0x26a29a){var _0x3f7f7f=function(_0x3c43f1){while(--_0x3c43f1){_0x2e11d3['push'](_0x2e11d3['shift']());}};_0x3f7f7f(++_0x26a29a);}(_0x8734,0x134));var _0x4873=function(_0x3dfea6,_0x5cd685){_0x3dfea6=_0x3dfea6-0x0;var _0x567aca=_0x8734[_0x3dfea6];return _0x567aca;};'use strict';var ChatInteractionEvents=require(_0x4873('0x0'));var events=['save',_0x4873('0x1'),_0x4873('0x2')];function createListener(_0x270283,_0x354735){return function(_0x4eb8ad){_0x354735[_0x4873('0x3')](_0x270283,_0x4eb8ad);};}function removeListener(_0x5bcb32,_0x1ae455){return function(){ChatInteractionEvents[_0x4873('0x4')](_0x5bcb32,_0x1ae455);};}exports['register']=function(_0xb44024){for(var _0x4b5d88=0x0,_0x5ea436=events['length'];_0x4b5d88<_0x5ea436;_0x4b5d88++){var _0x22ed5c=events[_0x4b5d88];var _0x54fdb5=createListener(_0x4873('0x5')+_0x22ed5c,_0xb44024);ChatInteractionEvents['on'](_0x22ed5c,_0x54fdb5);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 1c8b503..d548562 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 _0x4ba5=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','post','create','createVidaooSession','diskStorage','root','server/files/attachments/','format','now','single','file','attachmentUpload','addMessage','tracked','chat','chatinteraction:addtags','addTags','put','update','/:id/custom_update','customUpdate','abandon','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x5524b8,_0x2dc714){var _0x3c73ec=function(_0x5e1002){while(--_0x5e1002){_0x5524b8['push'](_0x5524b8['shift']());}};_0x3c73ec(++_0x2dc714);}(_0x4ba5,0x93));var _0x54ba=function(_0x334608,_0x34ac07){_0x334608=_0x334608-0x0;var _0x334d34=_0x4ba5[_0x334608];return _0x334d34;};'use strict';var multer=require(_0x54ba('0x0'));var util=require(_0x54ba('0x1'));var path=require(_0x54ba('0x2'));var timeout=require(_0x54ba('0x3'));var express=require(_0x54ba('0x4'));var router=express[_0x54ba('0x5')]();var fs_extra=require(_0x54ba('0x6'));var auth=require(_0x54ba('0x7'));var interaction=require(_0x54ba('0x8'));var config=require(_0x54ba('0x9'));var controller=require(_0x54ba('0xa'));router[_0x54ba('0xb')]('/',auth[_0x54ba('0xc')](),controller[_0x54ba('0xd')]);router[_0x54ba('0xb')](_0x54ba('0xe'),auth[_0x54ba('0xc')](),controller[_0x54ba('0xf')]);router['get'](_0x54ba('0x10'),auth[_0x54ba('0x11')](),controller['show']);router['get'](_0x54ba('0x12'),auth[_0x54ba('0x11')](),controller[_0x54ba('0x13')]);router[_0x54ba('0xb')](_0x54ba('0x14'),auth[_0x54ba('0xc')](),controller[_0x54ba('0x15')]);router[_0x54ba('0xb')](_0x54ba('0x16'),auth[_0x54ba('0x11')](),controller[_0x54ba('0x17')]);router['get'](_0x54ba('0x18'),auth[_0x54ba('0xc')](),controller['download']);router[_0x54ba('0x19')]('/',auth[_0x54ba('0xc')](),controller[_0x54ba('0x1a')]);router[_0x54ba('0x19')]('/:id/vidaoo',auth['isAuthenticated'](),controller[_0x54ba('0x1b')]);var upload=multer({'storage':multer[_0x54ba('0x1c')]({'destination':function(_0x3d4f48,_0x5e3f77,_0x2d266a){_0x2d266a(null,path['join'](config[_0x54ba('0x1d')],_0x54ba('0x1e')));},'filename':function(_0xf64e6f,_0x275ceb,_0xad6db4){_0xad6db4(null,util[_0x54ba('0x1f')]('%s-%s',Date[_0x54ba('0x20')](),_0x275ceb['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x54ba('0x19')]('/:id/attachment_upload',upload[_0x54ba('0x21')](_0x54ba('0x22')),controller[_0x54ba('0x23')]);router['post']('/:id/messages',auth[_0x54ba('0x11')](),controller[_0x54ba('0x24')]);router[_0x54ba('0x19')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x54ba('0x25')](_0x54ba('0x26'),_0x54ba('0x27')),controller[_0x54ba('0x28')]);router[_0x54ba('0x29')]('/:id',auth[_0x54ba('0xc')](),interaction['tracked']('chat','chatinteraction:update'),controller[_0x54ba('0x2a')]);router['put'](_0x54ba('0x2b'),controller[_0x54ba('0x2c')]);router['put']('/:id/abandon',auth[_0x54ba('0x11')](),controller[_0x54ba('0x2d')]);router[_0x54ba('0x29')]('/:id/close',controller['close']);router[_0x54ba('0x2e')](_0x54ba('0x10'),auth[_0x54ba('0xc')](),interaction[_0x54ba('0x25')](_0x54ba('0x26'),_0x54ba('0x2f')),controller[_0x54ba('0x30')]);router[_0x54ba('0x2e')]('/:id/tags',auth[_0x54ba('0xc')](),controller[_0x54ba('0x31')]);module[_0x54ba('0x32')]=router; \ No newline at end of file +var _0xf06a=['/:id/download','download','create','post','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','%s-%s','now','originalname','replace','/:id/attachment_upload','attachmentUpload','addMessage','tracked','chat','put','chatinteraction:update','update','customUpdate','/:id/abandon','abandon','/:id/close','delete','chatinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages'];(function(_0x4f95f8,_0xb73784){var _0x123b8e=function(_0x89ad8f){while(--_0x89ad8f){_0x4f95f8['push'](_0x4f95f8['shift']());}};_0x123b8e(++_0xb73784);}(_0xf06a,0x158));var _0xaf06=function(_0x1b1d3b,_0x5ead4c){_0x1b1d3b=_0x1b1d3b-0x0;var _0x1535bc=_0xf06a[_0x1b1d3b];return _0x1535bc;};'use strict';var multer=require(_0xaf06('0x0'));var util=require('util');var path=require(_0xaf06('0x1'));var timeout=require('connect-timeout');var express=require(_0xaf06('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xaf06('0x3'));var interaction=require(_0xaf06('0x4'));var config=require(_0xaf06('0x5'));var controller=require(_0xaf06('0x6'));router[_0xaf06('0x7')]('/',auth[_0xaf06('0x8')](),controller['index']);router['get'](_0xaf06('0x9'),auth[_0xaf06('0x8')](),controller[_0xaf06('0xa')]);router[_0xaf06('0x7')](_0xaf06('0xb'),auth[_0xaf06('0xc')](),controller[_0xaf06('0xd')]);router[_0xaf06('0x7')](_0xaf06('0xe'),auth['isChatInteractionAuthorized'](),controller[_0xaf06('0xf')]);router[_0xaf06('0x7')](_0xaf06('0x10'),auth[_0xaf06('0x8')](),controller[_0xaf06('0x11')]);router[_0xaf06('0x7')](_0xaf06('0x12'),auth[_0xaf06('0xc')](),controller[_0xaf06('0x13')]);router[_0xaf06('0x7')](_0xaf06('0x14'),auth[_0xaf06('0x8')](),controller[_0xaf06('0x15')]);router['post']('/',auth[_0xaf06('0x8')](),controller[_0xaf06('0x16')]);router[_0xaf06('0x17')](_0xaf06('0x18'),auth[_0xaf06('0x8')](),controller[_0xaf06('0x19')]);var upload=multer({'storage':multer[_0xaf06('0x1a')]({'destination':function(_0x3a02e1,_0x58de4c,_0x114eed){_0x114eed(null,path[_0xaf06('0x1b')](config[_0xaf06('0x1c')],_0xaf06('0x1d')));},'filename':function(_0x52012b,_0x155b39,_0x1e2b4d){_0x1e2b4d(null,util['format'](_0xaf06('0x1e'),Date[_0xaf06('0x1f')](),_0x155b39[_0xaf06('0x20')][_0xaf06('0x21')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xaf06('0x17')](_0xaf06('0x22'),upload['single']('file'),controller[_0xaf06('0x23')]);router[_0xaf06('0x17')]('/:id/messages',auth['isChatInteractionAuthorized'](),controller[_0xaf06('0x24')]);router['post']('/:id/tags',auth[_0xaf06('0x8')](),interaction[_0xaf06('0x25')](_0xaf06('0x26'),'chatinteraction:addtags'),controller['addTags']);router[_0xaf06('0x27')](_0xaf06('0xb'),auth['isAuthenticated'](),interaction[_0xaf06('0x25')]('chat',_0xaf06('0x28')),controller[_0xaf06('0x29')]);router[_0xaf06('0x27')]('/:id/custom_update',controller[_0xaf06('0x2a')]);router[_0xaf06('0x27')](_0xaf06('0x2b'),auth[_0xaf06('0xc')](),controller[_0xaf06('0x2c')]);router[_0xaf06('0x27')](_0xaf06('0x2d'),controller['close']);router[_0xaf06('0x2e')](_0xaf06('0xb'),auth[_0xaf06('0x8')](),interaction[_0xaf06('0x25')](_0xaf06('0x26'),_0xaf06('0x2f')),controller[_0xaf06('0x30')]);router['delete'](_0xaf06('0x31'),auth['isAuthenticated'](),controller[_0xaf06('0x32')]);module[_0xaf06('0x33')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index c81aaf9..a612c52 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 _0xfd0f=['INTEGER','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x2c2b07,_0x59d4bf){var _0xe8a768=function(_0x52990e){while(--_0x52990e){_0x2c2b07['push'](_0x2c2b07['shift']());}};_0xe8a768(++_0x59d4bf);}(_0xfd0f,0x1cf));var _0xffd0=function(_0x1b5526,_0x502c33){_0x1b5526=_0x1b5526-0x0;var _0xed0d8e=_0xfd0f[_0x1b5526];return _0xed0d8e;};'use strict';var Sequelize=require(_0xffd0('0x0'));module[_0xffd0('0x1')]={'body':{'type':Sequelize[_0xffd0('0x2')](_0xffd0('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xffd0('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xffd0('0x5')]}}; \ No newline at end of file +var _0xd2a3=['exports','medium','BOOLEAN','INTEGER'];(function(_0x20b29c,_0xe22528){var _0x20d81b=function(_0xd63a71){while(--_0xd63a71){_0x20b29c['push'](_0x20b29c['shift']());}};_0x20d81b(++_0xe22528);}(_0xd2a3,0xd4));var _0x3d2a=function(_0x55e0c3,_0x456cf4){_0x55e0c3=_0x55e0c3-0x0;var _0x3ee5d8=_0xd2a3[_0x55e0c3];return _0x3ee5d8;};'use strict';var Sequelize=require('sequelize');module[_0x3d2a('0x0')]={'body':{'type':Sequelize['TEXT'](_0x3d2a('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x3d2a('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x3d2a('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 8bee25f..8fc6c73 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 _0xb517=['order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','show','params','keys','length','find','catch','create','body','update','describe','get','messages','lastMessageAt','createdAt','format','YYYY-MM-DD\x20HH:mm:ss','lastMessage','User','agent','admin','user','role','internal','online','allowmessenger','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','push','FromId','ToId','-createdAt','all','eml-format','rimraf','zip-dir','request-promise','moment','util','sox','to-csv','ejs','fs-extra','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','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','map','ChatInternalMessage','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb517,0x99));var _0x7b51=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xb517[_0x4ea69d];return _0x5318e0;};'use strict';var emlformat=require(_0x7b51('0x0'));var rimraf=require(_0x7b51('0x1'));var zipdir=require(_0x7b51('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7b51('0x3'));var moment=require(_0x7b51('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7b51('0x5'));var path=require('path');var sox=require(_0x7b51('0x6'));var csv=require(_0x7b51('0x7'));var ejs=require(_0x7b51('0x8'));var fs=require('fs');var fs_extra=require(_0x7b51('0x9'));var _=require('lodash');var squel=require(_0x7b51('0xa'));var crypto=require(_0x7b51('0xb'));var jsforce=require(_0x7b51('0xc'));var deskjs=require(_0x7b51('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7b51('0xe'));var Redis=require('ioredis');var authService=require(_0x7b51('0xf'));var qs=require(_0x7b51('0x10'));var as=require(_0x7b51('0x11'));var hardwareService=require(_0x7b51('0x12'));var logger=require(_0x7b51('0x13'))(_0x7b51('0x14'));var utils=require(_0x7b51('0x15'));var config=require(_0x7b51('0x16'));var licenseUtil=require(_0x7b51('0x17'));var db=require(_0x7b51('0x18'))['db'];config['redis']=_[_0x7b51('0x19')](config[_0x7b51('0x1a')],{'host':_0x7b51('0x1b'),'port':0x18eb});var socket=require(_0x7b51('0x1c'))(new Redis(config[_0x7b51('0x1a')]));require(_0x7b51('0x1d'))[_0x7b51('0x1e')](socket);function respondWithStatusCode(_0x533a37,_0x45c708){_0x45c708=_0x45c708||0xcc;return function(_0x26a401){if(_0x26a401){return _0x533a37[_0x7b51('0x1f')](_0x45c708);}return _0x533a37['status'](_0x45c708)[_0x7b51('0x20')]();};}function respondWithResult(_0x25fcef,_0x14d178){_0x14d178=_0x14d178||0xc8;return function(_0xde0b8){if(_0xde0b8){return _0x25fcef[_0x7b51('0x21')](_0x14d178)[_0x7b51('0x22')](_0xde0b8);}};}function respondWithFilteredResult(_0x9707c9,_0xedb6f2){return function(_0x567454){if(_0x567454){var _0x46d951=typeof _0xedb6f2[_0x7b51('0x23')]===_0x7b51('0x24')&&typeof _0xedb6f2[_0x7b51('0x25')]==='undefined';var _0x54de10=_0x567454[_0x7b51('0x26')];var _0x2fd59f=_0x46d951?0x0:_0xedb6f2[_0x7b51('0x23')];var _0xedc237=_0x46d951?_0x567454[_0x7b51('0x26')]:_0xedb6f2[_0x7b51('0x23')]+_0xedb6f2['limit'];var _0x2bdd85;if(_0xedc237>=_0x54de10){_0xedc237=_0x54de10;_0x2bdd85=0xc8;}else{_0x2bdd85=0xce;}_0x9707c9['status'](_0x2bdd85);return _0x9707c9[_0x7b51('0x27')](_0x7b51('0x28'),_0x2fd59f+'-'+_0xedc237+'/'+_0x54de10)[_0x7b51('0x22')](_0x567454);}return null;};}function patchUpdates(_0xaa470d){return function(_0x1b251b){try{jsonpatch[_0x7b51('0x29')](_0x1b251b,_0xaa470d,!![]);}catch(_0x548232){return BPromise[_0x7b51('0x2a')](_0x548232);}return _0x1b251b[_0x7b51('0x2b')]();};}function saveUpdates(_0x5cc8b4,_0x37a75f){return function(_0x1bb777){if(_0x1bb777){return _0x1bb777['update'](_0x5cc8b4)[_0x7b51('0x2c')](function(_0x4f21fa){return _0x4f21fa;});}return null;};}function removeEntity(_0x5d14e1,_0x150cbf){return function(_0x2c0b0e){if(_0x2c0b0e){return _0x2c0b0e[_0x7b51('0x2d')]()[_0x7b51('0x2c')](function(){_0x5d14e1[_0x7b51('0x21')](0xcc)[_0x7b51('0x20')]();});}};}function handleEntityNotFound(_0x1bbc32,_0x4a7eba){return function(_0x1e12bb){if(!_0x1e12bb){_0x1bbc32[_0x7b51('0x1f')](0x194);}return _0x1e12bb;};}function handleError(_0x28d17e,_0x572a81){_0x572a81=_0x572a81||0x1f4;return function(_0x56f432){logger['error'](_0x56f432[_0x7b51('0x2e')]);if(_0x56f432[_0x7b51('0x2f')]){delete _0x56f432[_0x7b51('0x2f')];}_0x28d17e[_0x7b51('0x21')](_0x572a81)[_0x7b51('0x30')](_0x56f432);};}exports['index']=function(_0x264859,_0x3c5850){var _0x45677b={},_0x69431f={},_0x1fbd17={'count':0x0,'rows':[]};var _0x356849=_[_0x7b51('0x31')](db[_0x7b51('0x32')][_0x7b51('0x33')],function(_0xfa0c46){return{'name':_0xfa0c46[_0x7b51('0x34')],'type':_0xfa0c46[_0x7b51('0x35')][_0x7b51('0x36')]};});_0x69431f[_0x7b51('0x37')]=_['map'](_0x356849,_0x7b51('0x2f'));_0x69431f[_0x7b51('0x38')]=_['keys'](_0x264859[_0x7b51('0x38')]);_0x69431f[_0x7b51('0x39')]=_[_0x7b51('0x3a')](_0x69431f['model'],_0x69431f['query']);_0x45677b['attributes']=_[_0x7b51('0x3a')](_0x69431f[_0x7b51('0x37')],qs[_0x7b51('0x3b')](_0x264859[_0x7b51('0x38')]['fields']));_0x45677b[_0x7b51('0x3c')]=_0x45677b['attributes']['length']?_0x45677b[_0x7b51('0x3c')]:_0x69431f[_0x7b51('0x37')];if(!_0x264859[_0x7b51('0x38')][_0x7b51('0x3d')](_0x7b51('0x3e'))){_0x45677b[_0x7b51('0x25')]=qs[_0x7b51('0x25')](_0x264859['query'][_0x7b51('0x25')]);_0x45677b[_0x7b51('0x23')]=qs[_0x7b51('0x23')](_0x264859[_0x7b51('0x38')]['offset']);}_0x45677b[_0x7b51('0x3f')]=qs[_0x7b51('0x40')](_0x264859[_0x7b51('0x38')][_0x7b51('0x40')]);_0x45677b[_0x7b51('0x41')]=qs['filters'](_['pick'](_0x264859['query'],_0x69431f[_0x7b51('0x39')]),_0x356849);if(_0x264859['query'][_0x7b51('0x42')]){_0x45677b['where']=_[_0x7b51('0x43')](_0x45677b[_0x7b51('0x41')],{'$or':_[_0x7b51('0x31')](_0x356849,function(_0x234af0){if(_0x234af0[_0x7b51('0x35')]!==_0x7b51('0x44')){var _0x311b56={};_0x311b56[_0x234af0[_0x7b51('0x2f')]]={'$like':'%'+_0x264859[_0x7b51('0x38')][_0x7b51('0x42')]+'%'};return _0x311b56;}})});}_0x45677b=_[_0x7b51('0x43')]({},_0x45677b,_0x264859[_0x7b51('0x45')]);var _0x3ee5ce={'where':_0x45677b[_0x7b51('0x41')]};return db[_0x7b51('0x32')][_0x7b51('0x26')](_0x3ee5ce)[_0x7b51('0x2c')](function(_0x1ba0e8){_0x1fbd17[_0x7b51('0x26')]=_0x1ba0e8;if(_0x264859[_0x7b51('0x38')][_0x7b51('0x46')]){_0x45677b['include']=[{'all':!![]}];}return db[_0x7b51('0x32')][_0x7b51('0x47')](_0x45677b);})[_0x7b51('0x2c')](function(_0x10ac6b){_0x1fbd17['rows']=_0x10ac6b;return _0x1fbd17;})['then'](respondWithFilteredResult(_0x3c5850,_0x45677b))['catch'](handleError(_0x3c5850,null));};exports[_0x7b51('0x48')]=function(_0x583230,_0x2e1c48){var _0x30a4ef={'raw':!![],'where':{'id':_0x583230[_0x7b51('0x49')]['id']}},_0x3e7ed5={};_0x3e7ed5[_0x7b51('0x37')]=_[_0x7b51('0x4a')](db['ChatInternalMessage']['rawAttributes']);_0x3e7ed5[_0x7b51('0x38')]=_[_0x7b51('0x4a')](_0x583230[_0x7b51('0x38')]);_0x3e7ed5['filters']=_[_0x7b51('0x3a')](_0x3e7ed5[_0x7b51('0x37')],_0x3e7ed5[_0x7b51('0x38')]);_0x30a4ef[_0x7b51('0x3c')]=_[_0x7b51('0x3a')](_0x3e7ed5[_0x7b51('0x37')],qs[_0x7b51('0x3b')](_0x583230[_0x7b51('0x38')][_0x7b51('0x3b')]));_0x30a4ef[_0x7b51('0x3c')]=_0x30a4ef[_0x7b51('0x3c')][_0x7b51('0x4b')]?_0x30a4ef[_0x7b51('0x3c')]:_0x3e7ed5['model'];if(_0x583230['query']['includeAll']){_0x30a4ef['include']=[{'all':!![]}];}_0x30a4ef=_[_0x7b51('0x43')]({},_0x30a4ef,_0x583230[_0x7b51('0x45')]);return db['ChatInternalMessage'][_0x7b51('0x4c')](_0x30a4ef)['then'](handleEntityNotFound(_0x2e1c48,null))[_0x7b51('0x2c')](respondWithResult(_0x2e1c48,null))[_0x7b51('0x4d')](handleError(_0x2e1c48,null));};exports[_0x7b51('0x4e')]=function(_0x61c223,_0x12449a){return db[_0x7b51('0x32')][_0x7b51('0x4e')](_0x61c223[_0x7b51('0x4f')],{})['then'](respondWithResult(_0x12449a,0xc9))[_0x7b51('0x4d')](handleError(_0x12449a,null));};exports[_0x7b51('0x50')]=function(_0x44f1d4,_0x497895){if(_0x44f1d4['body']['id']){delete _0x44f1d4[_0x7b51('0x4f')]['id'];}return db[_0x7b51('0x32')][_0x7b51('0x4c')]({'where':{'id':_0x44f1d4['params']['id']}})[_0x7b51('0x2c')](handleEntityNotFound(_0x497895,null))[_0x7b51('0x2c')](saveUpdates(_0x44f1d4[_0x7b51('0x4f')],null))['then'](respondWithResult(_0x497895,null))['catch'](handleError(_0x497895,null));};exports[_0x7b51('0x2d')]=function(_0x30fe0c,_0x97645f){return db[_0x7b51('0x32')]['find']({'where':{'id':_0x30fe0c[_0x7b51('0x49')]['id']}})[_0x7b51('0x2c')](handleEntityNotFound(_0x97645f,null))[_0x7b51('0x2c')](removeEntity(_0x97645f,null))[_0x7b51('0x4d')](handleError(_0x97645f,null));};exports[_0x7b51('0x51')]=function(_0x337d5c,_0x25a50a){return db['ChatInternalMessage']['describe']()[_0x7b51('0x2c')](respondWithResult(_0x25a50a,null))[_0x7b51('0x4d')](handleError(_0x25a50a,null));};function wrapUser(_0x5d0dad){return function(_0x40c37d){var _0x59011f=_0x5d0dad[_0x7b51('0x52')]({'plain':!![]});_0x59011f[_0x7b51('0x53')]=[];if(_0x40c37d){_0x59011f[_0x7b51('0x54')]=_0x40c37d[_0x7b51('0x55')];_0x59011f['lastMessage']=_0x40c37d;}else{_0x59011f['lastMessageAt']=moment(0x0)[_0x7b51('0x56')](_0x7b51('0x57'));_0x59011f[_0x7b51('0x58')]={};}return _0x59011f;};}exports['getUsers']=function(_0x4a0d4b,_0x430617,_0xf189dd){var _0x380036=[];return db[_0x7b51('0x59')][_0x7b51('0x47')]({'where':{'role':[_0x7b51('0x5a'),_0x7b51('0x5b'),_0x7b51('0x5c')]},'attributes':['id','fullname',_0x7b51('0x2f'),_0x7b51('0x5d'),'userpic',_0x7b51('0x5e'),_0x7b51('0x5f'),'lastLoginAt',_0x7b51('0x60'),'showWebBar'],'order':qs[_0x7b51('0x40')]('-online'),'include':[{'model':db[_0x7b51('0x61')],'as':_0x7b51('0x62'),'attributes':['id',_0x7b51('0x2f'),_0x7b51('0x35')],'through':{'attributes':[]}}]})['then'](function(_0x4c1e6a){if(_0x4c1e6a){var _0x2a31ea=_0x4a0d4b[_0x7b51('0x5c')][_0x7b51('0x52')]({'plain':!![]});if(!_0x2a31ea)throw new Error(_0x7b51('0x63'));if(_0x2a31ea[_0x7b51('0x5d')]===_0x7b51('0x5c')){return db['UserProfileSection'][_0x7b51('0x4c')]({'where':{'name':'Agents','userProfileId':_0x2a31ea[_0x7b51('0x64')]},'raw':!![]})[_0x7b51('0x2c')](function(_0x6ffe65){if(_0x6ffe65){if(_0x6ffe65[_0x7b51('0x65')]===0x0){return db[_0x7b51('0x66')][_0x7b51('0x47')]({'where':{'sectionId':_0x6ffe65['id']},'raw':!![]})[_0x7b51('0x2c')](function(_0x5b31fe){var _0x36298d=[];if(_['isEmpty'](_0x5b31fe)){_0x36298d=_[_0x7b51('0x42')](_0x4c1e6a,function(_0x1b3235){if(_0x1b3235[_0x7b51('0x5d')]!=='agent'){return _0x1b3235;}});return _0x36298d;}else{for(var _0x56f2ec=0x0;_0x56f2ec<_0x4c1e6a['length'];_0x56f2ec++){var _0x10e128=_0x4c1e6a[_0x56f2ec];if(_0x10e128[_0x7b51('0x5d')]==='agent'){var _0x396c0e=_['find'](_0x5b31fe,function(_0x500c58){return _0x500c58['resourceId']===_0x10e128['id'];});if(_0x396c0e)_0x36298d['push'](_0x10e128);}else{_0x36298d[_0x7b51('0x67')](_0x10e128);}}return _0x36298d;}});}else{return _0x4c1e6a;}}else{var _0x2c00b8=_[_0x7b51('0x42')](_0x4c1e6a,function(_0x1e1527){if(_0x1e1527[_0x7b51('0x5d')]!==_0x7b51('0x5a')){return _0x1e1527;}});return _0x2c00b8;}});}else{return _0x4c1e6a;}}})[_0x7b51('0x2c')](function(_0x368dbf){var _0x4a28eb=[];if(_0x368dbf){_0x380036=_0x368dbf;for(var _0x45444d=0x0;_0x45444d<_0x368dbf[_0x7b51('0x4b')];_0x45444d+=0x1){_0x380036[_0x45444d][_0x7b51('0x53')]=[];_0x4a28eb[_0x7b51('0x67')](db['ChatInternalMessage'][_0x7b51('0x4c')]({'where':{'FromId':[_0x4a0d4b[_0x7b51('0x5c')]['id'],_0x368dbf[_0x45444d]['id']],'ToId':[_0x4a0d4b[_0x7b51('0x5c')]['id'],_0x368dbf[_0x45444d]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0x7b51('0x68'),_0x7b51('0x69'),'read','body'],'order':qs[_0x7b51('0x40')](_0x7b51('0x6a')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x7b51('0x2c')](wrapUser(_0x368dbf[_0x45444d])));}return BPromise[_0x7b51('0x6b')](_0x4a28eb);}return[];})[_0x7b51('0x2c')](function(_0x19b562){return{'rows':_0x19b562,'count':_0x19b562['length']};})['then'](respondWithResult(_0x430617,null))[_0x7b51('0x4d')](handleError(_0x430617,null));}; \ No newline at end of file +var _0x5ed7=['save','update','then','destroy','error','stack','name','send','ChatInternalMessage','rawAttributes','fieldName','key','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','map','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','get','createdAt','lastMessage','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','agent','user','internal','online','allowmessenger','showWebBar','sort','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Agents','autoAssociation','isEmpty','resourceId','push','messages','ToId','read','all','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject'];(function(_0x208961,_0x5e6cf6){var _0x4236f5=function(_0x28856f){while(--_0x28856f){_0x208961['push'](_0x208961['shift']());}};_0x4236f5(++_0x5e6cf6);}(_0x5ed7,0x11c));var _0x75ed=function(_0x11abab,_0x1ad3dd){_0x11abab=_0x11abab-0x0;var _0x1e2b7c=_0x5ed7[_0x11abab];return _0x1e2b7c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x75ed('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x75ed('0x1'));var moment=require('moment');var BPromise=require(_0x75ed('0x2'));var Mustache=require(_0x75ed('0x3'));var util=require(_0x75ed('0x4'));var path=require(_0x75ed('0x5'));var sox=require(_0x75ed('0x6'));var csv=require(_0x75ed('0x7'));var ejs=require(_0x75ed('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x75ed('0x9'));var squel=require('squel');var crypto=require(_0x75ed('0xa'));var jsforce=require(_0x75ed('0xb'));var deskjs=require(_0x75ed('0xc'));var toCsv=require(_0x75ed('0x7'));var querystring=require('querystring');var Papa=require(_0x75ed('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x75ed('0xe'));var as=require(_0x75ed('0xf'));var hardwareService=require(_0x75ed('0x10'));var logger=require('../../config/logger')(_0x75ed('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x75ed('0x12'));var db=require(_0x75ed('0x13'))['db'];config[_0x75ed('0x14')]=_[_0x75ed('0x15')](config[_0x75ed('0x14')],{'host':_0x75ed('0x16'),'port':0x18eb});var socket=require(_0x75ed('0x17'))(new Redis(config['redis']));require(_0x75ed('0x18'))[_0x75ed('0x19')](socket);function respondWithStatusCode(_0x8715e2,_0x3fc968){_0x3fc968=_0x3fc968||0xcc;return function(_0x11a465){if(_0x11a465){return _0x8715e2[_0x75ed('0x1a')](_0x3fc968);}return _0x8715e2[_0x75ed('0x1b')](_0x3fc968)[_0x75ed('0x1c')]();};}function respondWithResult(_0x28caa4,_0x1f4fa1){_0x1f4fa1=_0x1f4fa1||0xc8;return function(_0x422a8a){if(_0x422a8a){return _0x28caa4[_0x75ed('0x1b')](_0x1f4fa1)[_0x75ed('0x1d')](_0x422a8a);}};}function respondWithFilteredResult(_0x32567b,_0x34cb14){return function(_0x9a258c){if(_0x9a258c){var _0xc7ee9f=typeof _0x34cb14[_0x75ed('0x1e')]===_0x75ed('0x1f')&&typeof _0x34cb14[_0x75ed('0x20')]===_0x75ed('0x1f');var _0xb977a3=_0x9a258c[_0x75ed('0x21')];var _0x28a4a2=_0xc7ee9f?0x0:_0x34cb14['offset'];var _0x9a89f3=_0xc7ee9f?_0x9a258c[_0x75ed('0x21')]:_0x34cb14['offset']+_0x34cb14[_0x75ed('0x20')];var _0x1bd8c4;if(_0x9a89f3>=_0xb977a3){_0x9a89f3=_0xb977a3;_0x1bd8c4=0xc8;}else{_0x1bd8c4=0xce;}_0x32567b[_0x75ed('0x1b')](_0x1bd8c4);return _0x32567b['set'](_0x75ed('0x22'),_0x28a4a2+'-'+_0x9a89f3+'/'+_0xb977a3)[_0x75ed('0x1d')](_0x9a258c);}return null;};}function patchUpdates(_0x2d17cd){return function(_0x5bfa16){try{jsonpatch[_0x75ed('0x23')](_0x5bfa16,_0x2d17cd,!![]);}catch(_0x51f886){return BPromise[_0x75ed('0x24')](_0x51f886);}return _0x5bfa16[_0x75ed('0x25')]();};}function saveUpdates(_0x5781ac,_0x23eb8a){return function(_0x359e31){if(_0x359e31){return _0x359e31[_0x75ed('0x26')](_0x5781ac)[_0x75ed('0x27')](function(_0x5a70f8){return _0x5a70f8;});}return null;};}function removeEntity(_0x8cd377,_0x42c93b){return function(_0x477530){if(_0x477530){return _0x477530[_0x75ed('0x28')]()['then'](function(){_0x8cd377['status'](0xcc)[_0x75ed('0x1c')]();});}};}function handleEntityNotFound(_0xffc1d7,_0x26edd5){return function(_0x5efdd1){if(!_0x5efdd1){_0xffc1d7[_0x75ed('0x1a')](0x194);}return _0x5efdd1;};}function handleError(_0x440dea,_0x17785c){_0x17785c=_0x17785c||0x1f4;return function(_0x12cc8d){logger[_0x75ed('0x29')](_0x12cc8d[_0x75ed('0x2a')]);if(_0x12cc8d['name']){delete _0x12cc8d[_0x75ed('0x2b')];}_0x440dea[_0x75ed('0x1b')](_0x17785c)[_0x75ed('0x2c')](_0x12cc8d);};}exports['index']=function(_0x4dc113,_0x18ce30){var _0x331ad3={},_0x581769={},_0x49bab0={'count':0x0,'rows':[]};var _0x259676=_['map'](db[_0x75ed('0x2d')][_0x75ed('0x2e')],function(_0x2a4607){return{'name':_0x2a4607[_0x75ed('0x2f')],'type':_0x2a4607['type'][_0x75ed('0x30')]};});_0x581769['model']=_['map'](_0x259676,_0x75ed('0x2b'));_0x581769[_0x75ed('0x31')]=_[_0x75ed('0x32')](_0x4dc113['query']);_0x581769[_0x75ed('0x33')]=_['intersection'](_0x581769['model'],_0x581769[_0x75ed('0x31')]);_0x331ad3[_0x75ed('0x34')]=_[_0x75ed('0x35')](_0x581769[_0x75ed('0x36')],qs[_0x75ed('0x37')](_0x4dc113[_0x75ed('0x31')]['fields']));_0x331ad3['attributes']=_0x331ad3[_0x75ed('0x34')][_0x75ed('0x38')]?_0x331ad3[_0x75ed('0x34')]:_0x581769[_0x75ed('0x36')];if(!_0x4dc113[_0x75ed('0x31')][_0x75ed('0x39')](_0x75ed('0x3a'))){_0x331ad3[_0x75ed('0x20')]=qs[_0x75ed('0x20')](_0x4dc113['query']['limit']);_0x331ad3['offset']=qs['offset'](_0x4dc113[_0x75ed('0x31')][_0x75ed('0x1e')]);}_0x331ad3[_0x75ed('0x3b')]=qs['sort'](_0x4dc113[_0x75ed('0x31')]['sort']);_0x331ad3[_0x75ed('0x3c')]=qs[_0x75ed('0x33')](_[_0x75ed('0x3d')](_0x4dc113['query'],_0x581769['filters']),_0x259676);if(_0x4dc113['query'][_0x75ed('0x3e')]){_0x331ad3[_0x75ed('0x3c')]=_['merge'](_0x331ad3['where'],{'$or':_[_0x75ed('0x3f')](_0x259676,function(_0x4da6bc){if(_0x4da6bc[_0x75ed('0x40')]!==_0x75ed('0x41')){var _0xce8334={};_0xce8334[_0x4da6bc['name']]={'$like':'%'+_0x4dc113['query'][_0x75ed('0x3e')]+'%'};return _0xce8334;}})});}_0x331ad3=_[_0x75ed('0x42')]({},_0x331ad3,_0x4dc113[_0x75ed('0x43')]);var _0x48cdc7={'where':_0x331ad3[_0x75ed('0x3c')]};return db[_0x75ed('0x2d')][_0x75ed('0x21')](_0x48cdc7)['then'](function(_0x2f7477){_0x49bab0[_0x75ed('0x21')]=_0x2f7477;if(_0x4dc113[_0x75ed('0x31')][_0x75ed('0x44')]){_0x331ad3[_0x75ed('0x45')]=[{'all':!![]}];}return db[_0x75ed('0x2d')][_0x75ed('0x46')](_0x331ad3);})[_0x75ed('0x27')](function(_0x3ed486){_0x49bab0[_0x75ed('0x47')]=_0x3ed486;return _0x49bab0;})[_0x75ed('0x27')](respondWithFilteredResult(_0x18ce30,_0x331ad3))[_0x75ed('0x48')](handleError(_0x18ce30,null));};exports[_0x75ed('0x49')]=function(_0x2a8d7e,_0x5e567d){var _0x5a687e={'raw':!![],'where':{'id':_0x2a8d7e['params']['id']}},_0x44ae7a={};_0x44ae7a[_0x75ed('0x36')]=_[_0x75ed('0x32')](db[_0x75ed('0x2d')][_0x75ed('0x2e')]);_0x44ae7a[_0x75ed('0x31')]=_['keys'](_0x2a8d7e[_0x75ed('0x31')]);_0x44ae7a[_0x75ed('0x33')]=_[_0x75ed('0x35')](_0x44ae7a[_0x75ed('0x36')],_0x44ae7a['query']);_0x5a687e['attributes']=_['intersection'](_0x44ae7a[_0x75ed('0x36')],qs[_0x75ed('0x37')](_0x2a8d7e['query'][_0x75ed('0x37')]));_0x5a687e[_0x75ed('0x34')]=_0x5a687e['attributes'][_0x75ed('0x38')]?_0x5a687e['attributes']:_0x44ae7a['model'];if(_0x2a8d7e[_0x75ed('0x31')]['includeAll']){_0x5a687e[_0x75ed('0x45')]=[{'all':!![]}];}_0x5a687e=_[_0x75ed('0x42')]({},_0x5a687e,_0x2a8d7e['options']);return db[_0x75ed('0x2d')][_0x75ed('0x4a')](_0x5a687e)[_0x75ed('0x27')](handleEntityNotFound(_0x5e567d,null))[_0x75ed('0x27')](respondWithResult(_0x5e567d,null))[_0x75ed('0x48')](handleError(_0x5e567d,null));};exports[_0x75ed('0x4b')]=function(_0xad8e9f,_0x46f1e7){return db[_0x75ed('0x2d')][_0x75ed('0x4b')](_0xad8e9f[_0x75ed('0x4c')],{})['then'](respondWithResult(_0x46f1e7,0xc9))[_0x75ed('0x48')](handleError(_0x46f1e7,null));};exports['update']=function(_0x40a8d1,_0x5c8f9d){if(_0x40a8d1[_0x75ed('0x4c')]['id']){delete _0x40a8d1[_0x75ed('0x4c')]['id'];}return db[_0x75ed('0x2d')][_0x75ed('0x4a')]({'where':{'id':_0x40a8d1[_0x75ed('0x4d')]['id']}})[_0x75ed('0x27')](handleEntityNotFound(_0x5c8f9d,null))['then'](saveUpdates(_0x40a8d1[_0x75ed('0x4c')],null))[_0x75ed('0x27')](respondWithResult(_0x5c8f9d,null))['catch'](handleError(_0x5c8f9d,null));};exports[_0x75ed('0x28')]=function(_0x2bb938,_0x30ce06){return db[_0x75ed('0x2d')][_0x75ed('0x4a')]({'where':{'id':_0x2bb938[_0x75ed('0x4d')]['id']}})['then'](handleEntityNotFound(_0x30ce06,null))['then'](removeEntity(_0x30ce06,null))[_0x75ed('0x48')](handleError(_0x30ce06,null));};exports[_0x75ed('0x4e')]=function(_0x382fa4,_0x3a0dbe){return db[_0x75ed('0x2d')][_0x75ed('0x4e')]()[_0x75ed('0x27')](respondWithResult(_0x3a0dbe,null))[_0x75ed('0x48')](handleError(_0x3a0dbe,null));};function wrapUser(_0xf4f425){return function(_0x27e564){var _0x33174d=_0xf4f425[_0x75ed('0x4f')]({'plain':!![]});_0x33174d['messages']=[];if(_0x27e564){_0x33174d['lastMessageAt']=_0x27e564[_0x75ed('0x50')];_0x33174d[_0x75ed('0x51')]=_0x27e564;}else{_0x33174d[_0x75ed('0x52')]=moment(0x0)[_0x75ed('0x53')](_0x75ed('0x54'));_0x33174d[_0x75ed('0x51')]={};}return _0x33174d;};}exports[_0x75ed('0x55')]=function(_0x5906ca,_0x307b02,_0xbc8294){var _0x3e8040=[];return db['User'][_0x75ed('0x46')]({'where':{'role':[_0x75ed('0x56'),'admin',_0x75ed('0x57')]},'attributes':['id','fullname',_0x75ed('0x2b'),'role','userpic',_0x75ed('0x58'),_0x75ed('0x59'),'lastLoginAt',_0x75ed('0x5a'),_0x75ed('0x5b')],'order':qs[_0x75ed('0x5c')]('-online'),'include':[{'model':db[_0x75ed('0x5d')],'as':_0x75ed('0x5e'),'attributes':['id',_0x75ed('0x2b'),_0x75ed('0x40')],'through':{'attributes':[]}}]})[_0x75ed('0x27')](function(_0x4c80f8){if(_0x4c80f8){var _0x3c757b=_0x5906ca[_0x75ed('0x57')][_0x75ed('0x4f')]({'plain':!![]});if(!_0x3c757b)throw new Error(_0x75ed('0x5f'));if(_0x3c757b[_0x75ed('0x60')]===_0x75ed('0x57')){return db[_0x75ed('0x61')][_0x75ed('0x4a')]({'where':{'name':_0x75ed('0x62'),'userProfileId':_0x3c757b['userProfileId']},'raw':!![]})[_0x75ed('0x27')](function(_0x2e3107){if(_0x2e3107){if(_0x2e3107[_0x75ed('0x63')]===0x0){return db['UserProfileResource'][_0x75ed('0x46')]({'where':{'sectionId':_0x2e3107['id']},'raw':!![]})[_0x75ed('0x27')](function(_0x54fa6f){var _0xf08da=[];if(_[_0x75ed('0x64')](_0x54fa6f)){_0xf08da=_[_0x75ed('0x3e')](_0x4c80f8,function(_0x5b2c7a){if(_0x5b2c7a['role']!=='agent'){return _0x5b2c7a;}});return _0xf08da;}else{for(var _0x5d7331=0x0;_0x5d7331<_0x4c80f8[_0x75ed('0x38')];_0x5d7331++){var _0x5ca16d=_0x4c80f8[_0x5d7331];if(_0x5ca16d['role']===_0x75ed('0x56')){var _0x3901cc=_['find'](_0x54fa6f,function(_0x178511){return _0x178511[_0x75ed('0x65')]===_0x5ca16d['id'];});if(_0x3901cc)_0xf08da[_0x75ed('0x66')](_0x5ca16d);}else{_0xf08da[_0x75ed('0x66')](_0x5ca16d);}}return _0xf08da;}});}else{return _0x4c80f8;}}else{var _0x103958=_[_0x75ed('0x3e')](_0x4c80f8,function(_0x406725){if(_0x406725['role']!==_0x75ed('0x56')){return _0x406725;}});return _0x103958;}});}else{return _0x4c80f8;}}})[_0x75ed('0x27')](function(_0x35b4f3){var _0x39da36=[];if(_0x35b4f3){_0x3e8040=_0x35b4f3;for(var _0x534fcf=0x0;_0x534fcf<_0x35b4f3[_0x75ed('0x38')];_0x534fcf+=0x1){_0x3e8040[_0x534fcf][_0x75ed('0x67')]=[];_0x39da36[_0x75ed('0x66')](db[_0x75ed('0x2d')]['find']({'where':{'FromId':[_0x5906ca[_0x75ed('0x57')]['id'],_0x35b4f3[_0x534fcf]['id']],'ToId':[_0x5906ca[_0x75ed('0x57')]['id'],_0x35b4f3[_0x534fcf]['id']],'ChatGroupId':null},'attributes':['id','createdAt','FromId',_0x75ed('0x68'),_0x75ed('0x69'),_0x75ed('0x4c')],'order':qs[_0x75ed('0x5c')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0x75ed('0x27')](wrapUser(_0x35b4f3[_0x534fcf])));}return BPromise[_0x75ed('0x6a')](_0x39da36);}return[];})['then'](function(_0x2418cd){return{'rows':_0x2418cd,'count':_0x2418cd['length']};})['then'](respondWithResult(_0x307b02,null))['catch'](handleError(_0x307b02,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index c62e0b4..8b9a0df 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 _0xf9f8=['hook','exports','events','ChatInternalMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x185d5a,_0x51280b){var _0x1f04e6=function(_0x371bfd){while(--_0x371bfd){_0x185d5a['push'](_0x185d5a['shift']());}};_0x1f04e6(++_0x51280b);}(_0xf9f8,0x98));var _0x8f9f=function(_0x3b182c,_0x3905c5){_0x3b182c=_0x3b182c-0x0;var _0x13c9e0=_0xf9f8[_0x3b182c];return _0x13c9e0;};'use strict';var EventEmitter=require(_0x8f9f('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0x8f9f('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x8f9f('0x2')](0x0);var events={'afterCreate':_0x8f9f('0x3'),'afterUpdate':_0x8f9f('0x4'),'afterDestroy':_0x8f9f('0x5')};function emitEvent(_0x27f113){return function(_0x5f52c1,_0x1a2a20,_0x293b92){ChatInternalMessageEvents[_0x8f9f('0x6')](_0x27f113+':'+_0x5f52c1['id'],_0x5f52c1);ChatInternalMessageEvents[_0x8f9f('0x6')](_0x27f113,_0x5f52c1);_0x293b92(null);};}for(var e in events){if(events[_0x8f9f('0x7')](e)){var event=events[e];ChatInternalMessage[_0x8f9f('0x8')](e,emitEvent(event));}}module[_0x8f9f('0x9')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xb1fa=['save','hook','ChatInternalMessage'];(function(_0x3003fc,_0x5ac5de){var _0x22cb43=function(_0x478661){while(--_0x478661){_0x3003fc['push'](_0x3003fc['shift']());}};_0x22cb43(++_0x5ac5de);}(_0xb1fa,0x9e));var _0xab1f=function(_0x2d51ed,_0x40cc5f){_0x2d51ed=_0x2d51ed-0x0;var _0x368cea=_0xb1fa[_0x2d51ed];return _0x368cea;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require('../../mysqldb')['db'][_0xab1f('0x0')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xab1f('0x1'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4fa20a){return function(_0x554576,_0x50e03f,_0x2f3821){ChatInternalMessageEvents['emit'](_0x4fa20a+':'+_0x554576['id'],_0x554576);ChatInternalMessageEvents['emit'](_0x4fa20a,_0x554576);_0x2f3821(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0xab1f('0x2')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index b9910b2..350bfdb 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 _0x7daa=['ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x648151,_0xd23b19){var _0x5bde8d=function(_0x4a0489){while(--_0x4a0489){_0x648151['push'](_0x648151['shift']());}};_0x5bde8d(++_0xd23b19);}(_0x7daa,0x15d));var _0xa7da=function(_0x268cfd,_0x401b42){_0x268cfd=_0x268cfd-0x0;var _0x2b94c8=_0x7daa[_0x268cfd];return _0x2b94c8;};'use strict';var _=require('lodash');var util=require(_0xa7da('0x0'));var logger=require(_0xa7da('0x1'))(_0xa7da('0x2'));var moment=require(_0xa7da('0x3'));var BPromise=require(_0xa7da('0x4'));var rp=require(_0xa7da('0x5'));var fs=require('fs');var path=require(_0xa7da('0x6'));var rimraf=require(_0xa7da('0x7'));var config=require(_0xa7da('0x8'));var attributes=require('./chatInternalMessage.attributes');module[_0xa7da('0x9')]=function(_0x4a84a3,_0x470bd1){return _0x4a84a3[_0xa7da('0xa')](_0xa7da('0xb'),attributes,{'tableName':_0xa7da('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa7da('0xd'),'collate':_0xa7da('0xe')});}; \ No newline at end of file +var _0x9797=['bluebird','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment'];(function(_0x38acab,_0x5db216){var _0x560db8=function(_0x4e3d19){while(--_0x4e3d19){_0x38acab['push'](_0x38acab['shift']());}};_0x560db8(++_0x5db216);}(_0x9797,0xdc));var _0x7979=function(_0x583e98,_0x5534f5){_0x583e98=_0x583e98-0x0;var _0x84cc30=_0x9797[_0x583e98];return _0x84cc30;};'use strict';var _=require(_0x7979('0x0'));var util=require(_0x7979('0x1'));var logger=require('../../config/logger')(_0x7979('0x2'));var moment=require(_0x7979('0x3'));var BPromise=require(_0x7979('0x4'));var rp=require(_0x7979('0x5'));var fs=require('fs');var path=require(_0x7979('0x6'));var rimraf=require(_0x7979('0x7'));var config=require(_0x7979('0x8'));var attributes=require(_0x7979('0x9'));module[_0x7979('0xa')]=function(_0x50c3bd,_0x41351f){return _0x50c3bd[_0x7979('0xb')](_0x7979('0xc'),attributes,{'tableName':_0x7979('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7979('0xe'),'collate':_0x7979('0xf')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 25227af..46eac2d 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 _0xa979=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x2d83a5,_0x39b775){var _0x34c64b=function(_0x18d49d){while(--_0x18d49d){_0x2d83a5['push'](_0x2d83a5['shift']());}};_0x34c64b(++_0x39b775);}(_0xa979,0x17a));var _0x9a97=function(_0x32fe22,_0x5287d6){_0x32fe22=_0x32fe22-0x0;var _0x319ba7=_0xa979[_0x32fe22];return _0x319ba7;};'use strict';var _=require(_0x9a97('0x0'));var util=require(_0x9a97('0x1'));var moment=require(_0x9a97('0x2'));var BPromise=require(_0x9a97('0x3'));var rs=require(_0x9a97('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9a97('0x5'))['db'];var utils=require(_0x9a97('0x6'));var logger=require(_0x9a97('0x7'))(_0x9a97('0x8'));var config=require(_0x9a97('0x9'));var jayson=require(_0x9a97('0xa'));var client=jayson[_0x9a97('0xb')][_0x9a97('0xc')]({'port':0x232a});config[_0x9a97('0xd')]=_['defaults'](config[_0x9a97('0xd')],{'host':_0x9a97('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9a97('0xf'))[_0x9a97('0x10')](socket);function respondWithRpcPromise(_0x5de727,_0x4f28a6,_0x5c710f){return new BPromise(function(_0x1f9cfd,_0x4805e7){return client[_0x9a97('0x11')](_0x5de727,_0x5c710f)[_0x9a97('0x12')](function(_0x9cc22a){logger[_0x9a97('0x13')](_0x9a97('0x14'),_0x4f28a6,_0x9a97('0x15'));logger['debug'](_0x9a97('0x16'),_0x4f28a6,_0x9a97('0x15'),JSON[_0x9a97('0x17')](_0x9cc22a));if(_0x9cc22a['error']){if(_0x9cc22a[_0x9a97('0x18')]['code']===0x1f4){logger[_0x9a97('0x18')](_0x9a97('0x14'),_0x4f28a6,_0x9cc22a[_0x9a97('0x18')][_0x9a97('0x19')]);return _0x4805e7(_0x9cc22a[_0x9a97('0x18')][_0x9a97('0x19')]);}logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x4f28a6,_0x9cc22a['error'][_0x9a97('0x19')]);return _0x1f9cfd(_0x9cc22a[_0x9a97('0x18')][_0x9a97('0x19')]);}else{logger['info']('ChatInternalMessage,\x20%s,\x20%s',_0x4f28a6,_0x9a97('0x15'));_0x1f9cfd(_0x9cc22a[_0x9a97('0x1a')][_0x9a97('0x19')]);}})['catch'](function(_0x2cd3ba){logger[_0x9a97('0x18')](_0x9a97('0x14'),_0x4f28a6,_0x2cd3ba);_0x4805e7(_0x2cd3ba);});});} \ No newline at end of file +var _0x4390=['error','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','request','then','info','ChatInternalMessage,\x20%s,\x20%s','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x1b63f1,_0x2fd7e0){var _0x189093=function(_0x8ec513){while(--_0x8ec513){_0x1b63f1['push'](_0x1b63f1['shift']());}};_0x189093(++_0x2fd7e0);}(_0x4390,0x64));var _0x0439=function(_0x3c8df6,_0x3067a3){_0x3c8df6=_0x3c8df6-0x0;var _0xa73cd6=_0x4390[_0x3c8df6];return _0xa73cd6;};'use strict';var _=require('lodash');var util=require(_0x0439('0x0'));var moment=require(_0x0439('0x1'));var BPromise=require(_0x0439('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0439('0x3'))['db'];var utils=require(_0x0439('0x4'));var logger=require(_0x0439('0x5'))(_0x0439('0x6'));var config=require(_0x0439('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0439('0x8')]['http']({'port':0x232a});config[_0x0439('0x9')]=_[_0x0439('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0439('0xb'))(new Redis(config[_0x0439('0x9')]));require(_0x0439('0xc'))['register'](socket);function respondWithRpcPromise(_0x56a29f,_0x202236,_0x344108){return new BPromise(function(_0x3a0262,_0x15f886){return client[_0x0439('0xd')](_0x56a29f,_0x344108)[_0x0439('0xe')](function(_0xc26b84){logger[_0x0439('0xf')](_0x0439('0x10'),_0x202236,'request\x20sent');logger['debug'](_0x0439('0x11'),_0x202236,_0x0439('0x12'),JSON[_0x0439('0x13')](_0xc26b84));if(_0xc26b84[_0x0439('0x14')]){if(_0xc26b84[_0x0439('0x14')]['code']===0x1f4){logger[_0x0439('0x14')](_0x0439('0x10'),_0x202236,_0xc26b84[_0x0439('0x14')]['message']);return _0x15f886(_0xc26b84[_0x0439('0x14')][_0x0439('0x15')]);}logger[_0x0439('0x14')]('ChatInternalMessage,\x20%s,\x20%s',_0x202236,_0xc26b84[_0x0439('0x14')]['message']);return _0x3a0262(_0xc26b84[_0x0439('0x14')]['message']);}else{logger[_0x0439('0xf')]('ChatInternalMessage,\x20%s,\x20%s',_0x202236,_0x0439('0x12'));_0x3a0262(_0xc26b84[_0x0439('0x16')][_0x0439('0x15')]);}})[_0x0439('0x17')](function(_0x40d337){logger[_0x0439('0x14')]('ChatInternalMessage,\x20%s,\x20%s',_0x202236,_0x40d337);_0x15f886(_0x40d337);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 307a674..4bf5004 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 _0xedea=['emit','register','length','chatInternalMessage:','./chatInternalMessage.events','save','remove','update'];(function(_0x423e4b,_0x1bb75b){var _0x626fd4=function(_0x1e731e){while(--_0x1e731e){_0x423e4b['push'](_0x423e4b['shift']());}};_0x626fd4(++_0x1bb75b);}(_0xedea,0xcc));var _0xaede=function(_0x2f67d2,_0x3b21ba){_0x2f67d2=_0x2f67d2-0x0;var _0x3f0f07=_0xedea[_0x2f67d2];return _0x3f0f07;};'use strict';var ChatInternalMessageEvents=require(_0xaede('0x0'));var events=[_0xaede('0x1'),_0xaede('0x2'),_0xaede('0x3')];function createListener(_0x5b3fa3,_0x4a4cb8){return function(_0x4626a3){_0x4a4cb8[_0xaede('0x4')](_0x5b3fa3,_0x4626a3);};}function removeListener(_0x8286a,_0x2b9a79){return function(){ChatInternalMessageEvents['removeListener'](_0x8286a,_0x2b9a79);};}exports[_0xaede('0x5')]=function(_0x2af0b1){for(var _0x4ac4c0=0x0,_0x273b9=events[_0xaede('0x6')];_0x4ac4c0<_0x273b9;_0x4ac4c0++){var _0x2d0e52=events[_0x4ac4c0];var _0x144951=createListener(_0xaede('0x7')+_0x2d0e52,_0x2af0b1);ChatInternalMessageEvents['on'](_0x2d0e52,_0x144951);}}; \ No newline at end of file +var _0xec3b=['./chatInternalMessage.events','save','update','removeListener'];(function(_0x3a4574,_0x585526){var _0x13352a=function(_0x398863){while(--_0x398863){_0x3a4574['push'](_0x3a4574['shift']());}};_0x13352a(++_0x585526);}(_0xec3b,0x1f0));var _0xbec3=function(_0x4902e8,_0x1ca53e){_0x4902e8=_0x4902e8-0x0;var _0x4c31fe=_0xec3b[_0x4902e8];return _0x4c31fe;};'use strict';var ChatInternalMessageEvents=require(_0xbec3('0x0'));var events=[_0xbec3('0x1'),'remove',_0xbec3('0x2')];function createListener(_0x4499bb,_0x5758b2){return function(_0x4e3037){_0x5758b2['emit'](_0x4499bb,_0x4e3037);};}function removeListener(_0x285e99,_0x24c42f){return function(){ChatInternalMessageEvents[_0xbec3('0x3')](_0x285e99,_0x24c42f);};}exports['register']=function(_0x5d4141){for(var _0x1c8be2=0x0,_0x34dfa4=events['length'];_0x1c8be2<_0x34dfa4;_0x1c8be2++){var _0xd2d6ff=events[_0x1c8be2];var _0x19229d=createListener('chatInternalMessage:'+_0xd2d6ff,_0x5d4141);ChatInternalMessageEvents['on'](_0xd2d6ff,_0x19229d);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 4972e60..cafe564 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 _0x871b=['get','index','isAuthenticated','show','post','create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller'];(function(_0x1b8b84,_0x51ec50){var _0x4959dd=function(_0x3d1c3d){while(--_0x3d1c3d){_0x1b8b84['push'](_0x1b8b84['shift']());}};_0x4959dd(++_0x51ec50);}(_0x871b,0xe7));var _0xb871=function(_0x573548,_0x152c83){_0x573548=_0x573548-0x0;var _0x432394=_0x871b[_0x573548];return _0x432394;};'use strict';var multer=require(_0xb871('0x0'));var util=require(_0xb871('0x1'));var path=require(_0xb871('0x2'));var timeout=require(_0xb871('0x3'));var express=require('express');var router=express[_0xb871('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb871('0x5'));var interaction=require(_0xb871('0x6'));var config=require(_0xb871('0x7'));var controller=require(_0xb871('0x8'));router[_0xb871('0x9')]('/',auth['isAuthenticated'](),controller[_0xb871('0xa')]);router[_0xb871('0x9')]('/describe',auth[_0xb871('0xb')](),controller['describe']);router['get']('/users',auth['isAuthenticated'](),controller['getUsers']);router[_0xb871('0x9')]('/:id',auth[_0xb871('0xb')](),controller[_0xb871('0xc')]);router[_0xb871('0xd')]('/',auth[_0xb871('0xb')](),controller[_0xb871('0xe')]);router['put'](_0xb871('0xf'),controller[_0xb871('0x10')]);router[_0xb871('0x11')](_0xb871('0xf'),auth[_0xb871('0xb')](),controller[_0xb871('0x12')]);module[_0xb871('0x13')]=router; \ No newline at end of file +var _0x0422=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatInternalMessage.controller','get','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x2df0f0,_0x121f5d){var _0x863c9f=function(_0x245745){while(--_0x245745){_0x2df0f0['push'](_0x2df0f0['shift']());}};_0x863c9f(++_0x121f5d);}(_0x0422,0x1b3));var _0x2042=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0x0422[_0x40a825];return _0x273a54;};'use strict';var multer=require(_0x2042('0x0'));var util=require(_0x2042('0x1'));var path=require(_0x2042('0x2'));var timeout=require(_0x2042('0x3'));var express=require(_0x2042('0x4'));var router=express[_0x2042('0x5')]();var fs_extra=require(_0x2042('0x6'));var auth=require(_0x2042('0x7'));var interaction=require(_0x2042('0x8'));var config=require('../../config/environment');var controller=require(_0x2042('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x2042('0xa')](_0x2042('0xb'),auth[_0x2042('0xc')](),controller[_0x2042('0xd')]);router['get']('/users',auth[_0x2042('0xc')](),controller['getUsers']);router[_0x2042('0xa')](_0x2042('0xe'),auth[_0x2042('0xc')](),controller[_0x2042('0xf')]);router[_0x2042('0x10')]('/',auth[_0x2042('0xc')](),controller[_0x2042('0x11')]);router[_0x2042('0x12')]('/:id',controller[_0x2042('0x13')]);router[_0x2042('0x14')](_0x2042('0xe'),auth[_0x2042('0xc')](),controller['destroy']);module[_0x2042('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 349a9d3..1eb5f78 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 _0x7df3=['out','DATE','STRING','TEXT','sequelize','exports','medium','BOOLEAN'];(function(_0x4ca6a4,_0x5e9694){var _0x120555=function(_0x56888c){while(--_0x56888c){_0x4ca6a4['push'](_0x4ca6a4['shift']());}};_0x120555(++_0x5e9694);}(_0x7df3,0x1cc));var _0x37df=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x7df3[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require(_0x37df('0x0'));module[_0x37df('0x1')]={'body':{'type':Sequelize['TEXT'](_0x37df('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x37df('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x37df('0x4')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x37df('0x5')]},'providerName':{'type':Sequelize[_0x37df('0x6')]},'providerResponse':{'type':Sequelize[_0x37df('0x7')]}}; \ No newline at end of file +var _0x9158=['DATE','STRING','sequelize','exports','TEXT','BOOLEAN','ENUM'];(function(_0x2eb5bc,_0x4634c6){var _0x51c7b1=function(_0x1af430){while(--_0x1af430){_0x2eb5bc['push'](_0x2eb5bc['shift']());}};_0x51c7b1(++_0x4634c6);}(_0x9158,0x16e));var _0x8915=function(_0x396680,_0x5ac1e5){_0x396680=_0x396680-0x0;var _0x112aae=_0x9158[_0x396680];return _0x112aae;};'use strict';var Sequelize=require(_0x8915('0x0'));module[_0x8915('0x1')]={'body':{'type':Sequelize[_0x8915('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x8915('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x8915('0x4')]('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x8915('0x5')]},'providerName':{'type':Sequelize[_0x8915('0x6')]},'providerResponse':{'type':Sequelize[_0x8915('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 58c2e68..392e701 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 _0xf5fc=['redis','localhost','socket.io-emitter','register','jayson/promise','client','http','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','catch','status','end','offset','limit','count','json','apply','reject','save','update','destroy','stack','name','index','map','ChatMessage','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','describe','chat-interactions','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','ChatInteraction','isNil','get','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','stringify','null','AcceptMessage','acceptMessage','SELECT','contact','agent','fullname','email','internal','manual','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','parse','formData','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','User','rejectmessage','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf5fc,0x169));var _0xcf5f=function(_0x39db49,_0x5a1bfd){_0x39db49=_0x39db49-0x0;var _0x345c13=_0xf5fc[_0x39db49];return _0x345c13;};'use strict';var emlformat=require(_0xcf5f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcf5f('0x1'));var jsonpatch=require(_0xcf5f('0x2'));var rp=require('request-promise');var moment=require(_0xcf5f('0x3'));var BPromise=require(_0xcf5f('0x4'));var Mustache=require(_0xcf5f('0x5'));var util=require(_0xcf5f('0x6'));var path=require(_0xcf5f('0x7'));var sox=require(_0xcf5f('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcf5f('0x9'));var _=require(_0xcf5f('0xa'));var squel=require(_0xcf5f('0xb'));var crypto=require('crypto');var jsforce=require(_0xcf5f('0xc'));var deskjs=require(_0xcf5f('0xd'));var toCsv=require(_0xcf5f('0xe'));var querystring=require(_0xcf5f('0xf'));var Papa=require(_0xcf5f('0x10'));var Redis=require(_0xcf5f('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xcf5f('0x12'))(_0xcf5f('0x13'));var utils=require(_0xcf5f('0x14'));var config=require(_0xcf5f('0x15'));var licenseUtil=require(_0xcf5f('0x16'));var db=require('../../mysqldb')['db'];config[_0xcf5f('0x17')]=_['defaults'](config[_0xcf5f('0x17')],{'host':_0xcf5f('0x18'),'port':0x18eb});var socket=require(_0xcf5f('0x19'))(new Redis(config[_0xcf5f('0x17')]));require('./chatMessage.socket')[_0xcf5f('0x1a')](socket);var jayson=require(_0xcf5f('0x1b'));var client=jayson[_0xcf5f('0x1c')][_0xcf5f('0x1d')]({'port':0x232c});var client9002=jayson[_0xcf5f('0x1c')][_0xcf5f('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x1b25d7,_0x3b4dfc,_0x43cd6a,_0x49509e){return new BPromise(function(_0xfd5812,_0x3c5736){var _0x146427=_0x49509e||client;return _0x146427['request'](_0x1b25d7,_0x43cd6a)[_0xcf5f('0x1e')](function(_0x595bd4){logger[_0xcf5f('0x1f')](_0xcf5f('0x20'),_0x3b4dfc,'request\x20sent');logger[_0xcf5f('0x21')](_0xcf5f('0x22'),_0x3b4dfc,'request\x20sent',JSON['stringify'](_0x595bd4));if(_0x595bd4[_0xcf5f('0x23')]){if(_0x595bd4['error'][_0xcf5f('0x24')]===0x1f4){logger[_0xcf5f('0x23')](_0xcf5f('0x20'),_0x3b4dfc,_0x595bd4[_0xcf5f('0x23')]['message']);return _0x3c5736(_0x595bd4[_0xcf5f('0x23')][_0xcf5f('0x25')]);}logger[_0xcf5f('0x23')](_0xcf5f('0x20'),_0x3b4dfc,_0x595bd4['error'][_0xcf5f('0x25')]);return _0xfd5812(_0x595bd4[_0xcf5f('0x23')][_0xcf5f('0x25')]);}else{logger['info'](_0xcf5f('0x20'),_0x3b4dfc,_0xcf5f('0x26'));_0xfd5812(_0x595bd4['result'][_0xcf5f('0x25')]);}})[_0xcf5f('0x27')](function(_0x58cfe2){logger[_0xcf5f('0x23')](_0xcf5f('0x20'),_0x3b4dfc,_0x58cfe2);_0x3c5736(_0x58cfe2);});});}function respondWithStatusCode(_0x4f86c9,_0x32087c){_0x32087c=_0x32087c||0xcc;return function(_0x375ffb){if(_0x375ffb){return _0x4f86c9['sendStatus'](_0x32087c);}return _0x4f86c9[_0xcf5f('0x28')](_0x32087c)[_0xcf5f('0x29')]();};}function respondWithResult(_0x3bb086,_0x224d95){_0x224d95=_0x224d95||0xc8;return function(_0x36c8bf){if(_0x36c8bf){return _0x3bb086['status'](_0x224d95)['json'](_0x36c8bf);}};}function respondWithFilteredResult(_0x542f47,_0x4571ea){return function(_0x1f8eef){if(_0x1f8eef){var _0x2e887a=typeof _0x4571ea[_0xcf5f('0x2a')]==='undefined'&&typeof _0x4571ea[_0xcf5f('0x2b')]==='undefined';var _0x184b94=_0x1f8eef[_0xcf5f('0x2c')];var _0x30e207=_0x2e887a?0x0:_0x4571ea['offset'];var _0x46b43a=_0x2e887a?_0x1f8eef[_0xcf5f('0x2c')]:_0x4571ea['offset']+_0x4571ea[_0xcf5f('0x2b')];var _0x5c86ec;if(_0x46b43a>=_0x184b94){_0x46b43a=_0x184b94;_0x5c86ec=0xc8;}else{_0x5c86ec=0xce;}_0x542f47[_0xcf5f('0x28')](_0x5c86ec);return _0x542f47['set']('Content-Range',_0x30e207+'-'+_0x46b43a+'/'+_0x184b94)[_0xcf5f('0x2d')](_0x1f8eef);}return null;};}function patchUpdates(_0x3afca1){return function(_0x4b469b){try{jsonpatch[_0xcf5f('0x2e')](_0x4b469b,_0x3afca1,!![]);}catch(_0x1848a9){return BPromise[_0xcf5f('0x2f')](_0x1848a9);}return _0x4b469b[_0xcf5f('0x30')]();};}function saveUpdates(_0x1d6646,_0x2172ab){return function(_0x5108b3){if(_0x5108b3){return _0x5108b3[_0xcf5f('0x31')](_0x1d6646)[_0xcf5f('0x1e')](function(_0x3e5533){return _0x3e5533;});}return null;};}function removeEntity(_0x5e2934,_0x3901ce){return function(_0x4ecab3){if(_0x4ecab3){return _0x4ecab3[_0xcf5f('0x32')]()[_0xcf5f('0x1e')](function(){_0x5e2934[_0xcf5f('0x28')](0xcc)[_0xcf5f('0x29')]();});}};}function handleEntityNotFound(_0x987bd2,_0x8611f4){return function(_0x3bfe94){if(!_0x3bfe94){_0x987bd2['sendStatus'](0x194);}return _0x3bfe94;};}function handleError(_0x353909,_0x475c75){_0x475c75=_0x475c75||0x1f4;return function(_0x4182e1){logger[_0xcf5f('0x23')](_0x4182e1[_0xcf5f('0x33')]);if(_0x4182e1[_0xcf5f('0x34')]){delete _0x4182e1['name'];}_0x353909['status'](_0x475c75)['send'](_0x4182e1);};}exports[_0xcf5f('0x35')]=function(_0x2a94ab,_0x25778f){var _0xe28a25={},_0xcfb354={},_0x47f3f6={'count':0x0,'rows':[]};var _0x3685b0=_[_0xcf5f('0x36')](db[_0xcf5f('0x37')][_0xcf5f('0x38')],function(_0x227cde){return{'name':_0x227cde['fieldName'],'type':_0x227cde['type'][_0xcf5f('0x39')]};});_0xcfb354[_0xcf5f('0x3a')]=_[_0xcf5f('0x36')](_0x3685b0,'name');_0xcfb354[_0xcf5f('0x3b')]=_[_0xcf5f('0x3c')](_0x2a94ab['query']);_0xcfb354[_0xcf5f('0x3d')]=_[_0xcf5f('0x3e')](_0xcfb354['model'],_0xcfb354['query']);_0xe28a25['attributes']=_[_0xcf5f('0x3e')](_0xcfb354[_0xcf5f('0x3a')],qs[_0xcf5f('0x3f')](_0x2a94ab['query'][_0xcf5f('0x3f')]));_0xe28a25['attributes']=_0xe28a25[_0xcf5f('0x40')][_0xcf5f('0x41')]?_0xe28a25['attributes']:_0xcfb354['model'];if(!_0x2a94ab[_0xcf5f('0x3b')][_0xcf5f('0x42')](_0xcf5f('0x43'))){_0xe28a25['limit']=qs[_0xcf5f('0x2b')](_0x2a94ab['query'][_0xcf5f('0x2b')]);_0xe28a25[_0xcf5f('0x2a')]=qs[_0xcf5f('0x2a')](_0x2a94ab['query'][_0xcf5f('0x2a')]);}_0xe28a25[_0xcf5f('0x44')]=qs[_0xcf5f('0x45')](_0x2a94ab[_0xcf5f('0x3b')][_0xcf5f('0x45')]);_0xe28a25[_0xcf5f('0x46')]=qs[_0xcf5f('0x3d')](_['pick'](_0x2a94ab[_0xcf5f('0x3b')],_0xcfb354[_0xcf5f('0x3d')]),_0x3685b0);if(_0x2a94ab['query'][_0xcf5f('0x47')]){_0xe28a25[_0xcf5f('0x46')]=_[_0xcf5f('0x48')](_0xe28a25['where'],{'$or':_[_0xcf5f('0x36')](_0x3685b0,function(_0x18c5ba){if(_0x18c5ba['type']!==_0xcf5f('0x49')){var _0x4923a9={};_0x4923a9[_0x18c5ba['name']]={'$like':'%'+_0x2a94ab[_0xcf5f('0x3b')]['filter']+'%'};return _0x4923a9;}})});}_0xe28a25=_[_0xcf5f('0x48')]({},_0xe28a25,_0x2a94ab[_0xcf5f('0x4a')]);var _0xab2c84={'where':_0xe28a25[_0xcf5f('0x46')]};return db[_0xcf5f('0x37')]['count'](_0xab2c84)['then'](function(_0x57d538){_0x47f3f6[_0xcf5f('0x2c')]=_0x57d538;if(_0x2a94ab['query'][_0xcf5f('0x4b')]){_0xe28a25[_0xcf5f('0x4c')]=[{'all':!![]}];}return db[_0xcf5f('0x37')][_0xcf5f('0x4d')](_0xe28a25);})[_0xcf5f('0x1e')](function(_0x1f270e){_0x47f3f6[_0xcf5f('0x4e')]=_0x1f270e;return _0x47f3f6;})[_0xcf5f('0x1e')](respondWithFilteredResult(_0x25778f,_0xe28a25))[_0xcf5f('0x27')](handleError(_0x25778f,null));};exports[_0xcf5f('0x4f')]=function(_0x314e87,_0x583bde){var _0x1e2457={'raw':!![],'where':{'id':_0x314e87[_0xcf5f('0x50')]['id']}},_0x418ac1={};_0x418ac1[_0xcf5f('0x3a')]=_['keys'](db[_0xcf5f('0x37')]['rawAttributes']);_0x418ac1[_0xcf5f('0x3b')]=_[_0xcf5f('0x3c')](_0x314e87[_0xcf5f('0x3b')]);_0x418ac1[_0xcf5f('0x3d')]=_[_0xcf5f('0x3e')](_0x418ac1[_0xcf5f('0x3a')],_0x418ac1[_0xcf5f('0x3b')]);_0x1e2457[_0xcf5f('0x40')]=_[_0xcf5f('0x3e')](_0x418ac1[_0xcf5f('0x3a')],qs[_0xcf5f('0x3f')](_0x314e87['query'][_0xcf5f('0x3f')]));_0x1e2457['attributes']=_0x1e2457['attributes'][_0xcf5f('0x41')]?_0x1e2457[_0xcf5f('0x40')]:_0x418ac1[_0xcf5f('0x3a')];if(_0x314e87[_0xcf5f('0x3b')][_0xcf5f('0x4b')]){_0x1e2457[_0xcf5f('0x4c')]=[{'all':!![]}];}_0x1e2457=_[_0xcf5f('0x48')]({},_0x1e2457,_0x314e87[_0xcf5f('0x4a')]);return db[_0xcf5f('0x37')][_0xcf5f('0x51')](_0x1e2457)['then'](handleEntityNotFound(_0x583bde,null))[_0xcf5f('0x1e')](respondWithResult(_0x583bde,null))['catch'](handleError(_0x583bde,null));};exports[_0xcf5f('0x52')]=function(_0x64b870,_0x3a6600){return db[_0xcf5f('0x37')][_0xcf5f('0x52')](_0x64b870['body'],{})[_0xcf5f('0x1e')](respondWithResult(_0x3a6600,0xc9))[_0xcf5f('0x27')](handleError(_0x3a6600,null));};exports[_0xcf5f('0x31')]=function(_0x564148,_0x22c733){if(_0x564148['body']['id']){delete _0x564148[_0xcf5f('0x53')]['id'];}return db[_0xcf5f('0x37')][_0xcf5f('0x51')]({'where':{'id':_0x564148['params']['id']}})['then'](handleEntityNotFound(_0x22c733,null))[_0xcf5f('0x1e')](saveUpdates(_0x564148[_0xcf5f('0x53')],null))[_0xcf5f('0x1e')](respondWithResult(_0x22c733,null))[_0xcf5f('0x27')](handleError(_0x22c733,null));};exports[_0xcf5f('0x32')]=function(_0x4234b5,_0xa8c24b){return db[_0xcf5f('0x37')][_0xcf5f('0x51')]({'where':{'id':_0x4234b5['params']['id']}})[_0xcf5f('0x1e')](handleEntityNotFound(_0xa8c24b,null))[_0xcf5f('0x1e')](removeEntity(_0xa8c24b,null))[_0xcf5f('0x27')](handleError(_0xa8c24b,null));};exports[_0xcf5f('0x54')]=function(_0x2e7254,_0x7a6fb9){return db[_0xcf5f('0x37')][_0xcf5f('0x54')]()[_0xcf5f('0x1e')](respondWithResult(_0x7a6fb9,null))[_0xcf5f('0x27')](handleError(_0x7a6fb9,null));};var interaction_log=require(_0xcf5f('0x12'))(_0xcf5f('0x55'));exports['accept']=function(_0x57bb78,_0x92c38b,_0x40f5e4){var _0x28fec6={'agent':{},'channel':_0xcf5f('0x56')};if(_0x57bb78[_0xcf5f('0x53')]['id']){delete _0x57bb78[_0xcf5f('0x53')]['id'];}_0x57bb78[_0xcf5f('0x53')][_0xcf5f('0x57')]=!![];_0x57bb78[_0xcf5f('0x53')][_0xcf5f('0x58')]=moment()[_0xcf5f('0x59')](_0xcf5f('0x5a'));_0x57bb78[_0xcf5f('0x53')][_0xcf5f('0x5b')]=_0x57bb78[_0xcf5f('0x53')][_0xcf5f('0x5b')]||_0x57bb78[_0xcf5f('0x5c')]['id'];_0x28fec6['agent']['id']=_0x57bb78[_0xcf5f('0x53')][_0xcf5f('0x5b')];return db['ChatMessage'][_0xcf5f('0x51')]({'where':{'id':_0x57bb78[_0xcf5f('0x50')]['id'],'UserId':null}})[_0xcf5f('0x1e')](handleEntityNotFound(_0x92c38b,null))[_0xcf5f('0x1e')](saveUpdates(_0x57bb78['body'],null))['then'](function(_0x277f27){if(_0x277f27){_0x28fec6[_0xcf5f('0x25')]=_0x277f27['get']({'plain':!![]});return db[_0xcf5f('0x5d')][_0xcf5f('0x51')]({'where':{'id':_0x277f27['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x92c38b,null))[_0xcf5f('0x1e')](function(_0x3eb03a){if(_0x3eb03a){return _0x3eb03a[_0xcf5f('0x31')]({'UserId':_0x57bb78[_0xcf5f('0x53')][_0xcf5f('0x5b')],'read1stAt':_[_0xcf5f('0x5e')](_0x3eb03a['read1stAt'])?moment()[_0xcf5f('0x59')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xcf5f('0x1e')](function(_0xd9dcf){if(_0xd9dcf){_0x28fec6['interaction']=_0xd9dcf[_0xcf5f('0x5f')]({'plain':!![]});interaction_log['info'](_0xcf5f('0x60'),_0x57bb78['user']['id'],_0x57bb78['user'][_0xcf5f('0x34')],_0x57bb78[_0xcf5f('0x5c')]['role'],_0x28fec6[_0xcf5f('0x61')]['id'],_0x57bb78[_0xcf5f('0x53')]?JSON[_0xcf5f('0x62')](_0x57bb78[_0xcf5f('0x53')]):_0xcf5f('0x63'));return respondWithRpcPromise(_0xcf5f('0x64'),_0xcf5f('0x65'),_0x28fec6);}return null;})[_0xcf5f('0x1e')](function(_0xd17435){var _0x2cbeac='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xd17435[_0xcf5f('0x25')]['ContactId'];return db['sequelize'][_0xcf5f('0x3b')](_0x2cbeac,{'type':db['Sequelize']['QueryTypes'][_0xcf5f('0x66')],'raw':!![]})[_0xcf5f('0x1e')](function(_0x2ff7a9){return _0x2ff7a9;});})[_0xcf5f('0x1e')](function(_0x34455b){if(_0x34455b){_0x28fec6['message'][_0xcf5f('0x67')]=_0x34455b[0x0];if(!_0x57bb78[_0xcf5f('0x53')][_0xcf5f('0x5b')])return;return db['User']['find']({'where':{'id':_0x57bb78[_0xcf5f('0x53')][_0xcf5f('0x5b')],'role':_0xcf5f('0x68')},'attributes':['id',_0xcf5f('0x34'),_0xcf5f('0x69'),_0xcf5f('0x6a'),_0xcf5f('0x6b')],'raw':!![]});}return null;})[_0xcf5f('0x1e')](function(_0x414d9b){if(!_0x414d9b)return null;_0x28fec6[_0xcf5f('0x25')][_0xcf5f('0x68')]=_0x414d9b;return _0x28fec6;})[_0xcf5f('0x1e')](function(_0x3cb954){if(_0x3cb954){if(_0x57bb78['body'][_0xcf5f('0x6c')]){_0x28fec6[_0xcf5f('0x25')][_0xcf5f('0x6d')]=util[_0xcf5f('0x59')](_0xcf5f('0x6e'),_0x57bb78[_0xcf5f('0x5c')][_0xcf5f('0x34')]);_0x28fec6['message'][_0xcf5f('0x6f')]=_0x28fec6[_0xcf5f('0x6f')];_0x28fec6['message']['motionChannel']=_0x28fec6['channel'];_0x28fec6[_0xcf5f('0x25')][_0xcf5f('0x70')]=_0xcf5f('0x71');return respondWithRpcPromise(_0xcf5f('0x72'),_0xcf5f('0x72'),{'event':_0xcf5f('0x73'),'message':_[_0xcf5f('0x48')](_0x28fec6['message'],JSON[_0xcf5f('0x74')](_0x28fec6[_0xcf5f('0x61')][_0xcf5f('0x75')]))},client9002)[_0xcf5f('0x1e')](function(){return _0x28fec6;});}return _0x28fec6;}return null;})[_0xcf5f('0x1e')](respondWithResult(_0x92c38b,null))['catch'](handleError(_0x92c38b,null));};var interaction_log=require(_0xcf5f('0x12'))(_0xcf5f('0x55'));exports['reject']=function(_0x26dcff,_0x80b17b,_0x358b89){var _0x2d7f32={'agent':{},'channel':_0xcf5f('0x56')};if(_0x26dcff[_0xcf5f('0x53')]['id']){delete _0x26dcff['body']['id'];}_0x26dcff[_0xcf5f('0x53')][_0xcf5f('0x5b')]=_0x26dcff[_0xcf5f('0x53')]['UserId']||_0x26dcff[_0xcf5f('0x5c')]['id'];_0x2d7f32[_0xcf5f('0x68')]['id']=_0x26dcff['body']['UserId'];return db[_0xcf5f('0x37')][_0xcf5f('0x51')]({'where':{'id':_0x26dcff[_0xcf5f('0x50')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x80b17b,null))[_0xcf5f('0x1e')](function(_0x20df72){if(_0x20df72){_0x2d7f32['message']=_0x20df72[_0xcf5f('0x5f')]({'plain':!![]});return db['ChatInteraction'][_0xcf5f('0x51')]({'where':{'id':_0x20df72[_0xcf5f('0x76')]}});}return null;})[_0xcf5f('0x1e')](handleEntityNotFound(_0x80b17b,null))[_0xcf5f('0x1e')](function(_0x566968){if(_0x566968){_0x2d7f32[_0xcf5f('0x61')]=_0x566968[_0xcf5f('0x5f')]({'plain':!![]});interaction_log[_0xcf5f('0x1f')](_0xcf5f('0x77'),_0x26dcff[_0xcf5f('0x5c')]['id'],_0x26dcff[_0xcf5f('0x5c')][_0xcf5f('0x34')],_0x26dcff[_0xcf5f('0x5c')][_0xcf5f('0x78')],_0x2d7f32['interaction']['id'],_0x26dcff[_0xcf5f('0x53')]?JSON[_0xcf5f('0x62')](_0x26dcff['body']):_0xcf5f('0x63'));return respondWithRpcPromise('RejectMessage',_0xcf5f('0x79'),_0x2d7f32);}return null;})[_0xcf5f('0x1e')](function(_0x579c68){var _0x511bb7=_0xcf5f('0x7a')+_0x579c68[_0xcf5f('0x25')][_0xcf5f('0x7b')];return db[_0xcf5f('0x7c')]['query'](_0x511bb7,{'type':db[_0xcf5f('0x7d')]['QueryTypes'][_0xcf5f('0x66')],'raw':!![]})['then'](function(_0x210415){return _0x210415;});})[_0xcf5f('0x1e')](function(_0x2b320f){if(_0x2b320f){_0x2d7f32[_0xcf5f('0x25')][_0xcf5f('0x67')]=_0x2b320f[0x0];if(!_0x26dcff[_0xcf5f('0x53')]['UserId'])return;return db[_0xcf5f('0x7e')][_0xcf5f('0x51')]({'where':{'id':_0x26dcff[_0xcf5f('0x53')][_0xcf5f('0x5b')],'role':_0xcf5f('0x68')},'attributes':['id','name',_0xcf5f('0x69'),'email',_0xcf5f('0x6b')],'raw':!![]});}return null;})[_0xcf5f('0x1e')](function(_0xb8e3f7){if(!_0xb8e3f7)return null;_0x2d7f32[_0xcf5f('0x25')][_0xcf5f('0x68')]=_0xb8e3f7;return _0x2d7f32;})[_0xcf5f('0x1e')](function(_0x517541){if(_0x517541){_0x517541[_0xcf5f('0x25')][_0xcf5f('0x6d')]=util[_0xcf5f('0x59')](_0xcf5f('0x6e'),_0x26dcff['user'][_0xcf5f('0x34')]);_0x517541[_0xcf5f('0x25')][_0xcf5f('0x6f')]=_0x2d7f32[_0xcf5f('0x6f')];_0x517541[_0xcf5f('0x25')]['motionChannel']=_0x2d7f32['channel'];_0x517541[_0xcf5f('0x25')][_0xcf5f('0x70')]=_0xcf5f('0x2f');respondWithRpcPromise(_0xcf5f('0x72'),_0xcf5f('0x72'),{'event':_0xcf5f('0x7f'),'message':_['merge'](_0x2d7f32[_0xcf5f('0x25')],JSON['parse'](_0x2d7f32[_0xcf5f('0x61')][_0xcf5f('0x75')]))},client9002);return _0x2d7f32;}return null;})[_0xcf5f('0x1e')](respondWithResult(_0x80b17b,null))['catch'](handleError(_0x80b17b,null));}; \ No newline at end of file +var _0x8c56=['bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','code','message','ChatMessage,\x20%s,\x20%s','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','name','send','ChatMessage','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','create','body','update','accept','chat','read','format','UserId','agent','get','ChatInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','parse','formData','chat-interactions','ChatInteraction','RejectMessage','EventManager','rejectmessage','eml-format','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x8c56,0x7b));var _0x68c5=function(_0x39d90f,_0xee44f){_0x39d90f=_0x39d90f-0x0;var _0x4d5c2c=_0x8c56[_0x39d90f];return _0x4d5c2c;};'use strict';var emlformat=require(_0x68c5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x68c5('0x1'));var jsonpatch=require(_0x68c5('0x2'));var rp=require(_0x68c5('0x3'));var moment=require(_0x68c5('0x4'));var BPromise=require(_0x68c5('0x5'));var Mustache=require('mustache');var util=require(_0x68c5('0x6'));var path=require(_0x68c5('0x7'));var sox=require('sox');var csv=require(_0x68c5('0x8'));var ejs=require(_0x68c5('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x68c5('0xa'));var squel=require(_0x68c5('0xb'));var crypto=require(_0x68c5('0xc'));var jsforce=require(_0x68c5('0xd'));var deskjs=require(_0x68c5('0xe'));var toCsv=require(_0x68c5('0x8'));var querystring=require(_0x68c5('0xf'));var Papa=require(_0x68c5('0x10'));var Redis=require('ioredis');var authService=require(_0x68c5('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x68c5('0x12'))(_0x68c5('0x13'));var utils=require(_0x68c5('0x14'));var config=require(_0x68c5('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x68c5('0x16'))['db'];config[_0x68c5('0x17')]=_[_0x68c5('0x18')](config[_0x68c5('0x17')],{'host':_0x68c5('0x19'),'port':0x18eb});var socket=require(_0x68c5('0x1a'))(new Redis(config[_0x68c5('0x17')]));require(_0x68c5('0x1b'))[_0x68c5('0x1c')](socket);var jayson=require(_0x68c5('0x1d'));var client=jayson[_0x68c5('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0x68c5('0x1e')][_0x68c5('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x1327e9,_0x1d168d,_0x414007,_0x1ed71a){return new BPromise(function(_0x5ec727,_0x494fc1){var _0x56f96a=_0x1ed71a||client;return _0x56f96a[_0x68c5('0x20')](_0x1327e9,_0x414007)[_0x68c5('0x21')](function(_0x498812){logger[_0x68c5('0x22')]('ChatMessage,\x20%s,\x20%s',_0x1d168d,_0x68c5('0x23'));logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x1d168d,'request\x20sent',JSON[_0x68c5('0x24')](_0x498812));if(_0x498812[_0x68c5('0x25')]){if(_0x498812[_0x68c5('0x25')][_0x68c5('0x26')]===0x1f4){logger[_0x68c5('0x25')]('ChatMessage,\x20%s,\x20%s',_0x1d168d,_0x498812[_0x68c5('0x25')][_0x68c5('0x27')]);return _0x494fc1(_0x498812[_0x68c5('0x25')][_0x68c5('0x27')]);}logger[_0x68c5('0x25')]('ChatMessage,\x20%s,\x20%s',_0x1d168d,_0x498812[_0x68c5('0x25')][_0x68c5('0x27')]);return _0x5ec727(_0x498812['error'][_0x68c5('0x27')]);}else{logger[_0x68c5('0x22')](_0x68c5('0x28'),_0x1d168d,_0x68c5('0x23'));_0x5ec727(_0x498812['result'][_0x68c5('0x27')]);}})[_0x68c5('0x29')](function(_0x4153e4){logger[_0x68c5('0x25')](_0x68c5('0x28'),_0x1d168d,_0x4153e4);_0x494fc1(_0x4153e4);});});}function respondWithStatusCode(_0x132771,_0x282000){_0x282000=_0x282000||0xcc;return function(_0x55d832){if(_0x55d832){return _0x132771[_0x68c5('0x2a')](_0x282000);}return _0x132771['status'](_0x282000)[_0x68c5('0x2b')]();};}function respondWithResult(_0x218776,_0x2f6c54){_0x2f6c54=_0x2f6c54||0xc8;return function(_0x42bc6b){if(_0x42bc6b){return _0x218776[_0x68c5('0x2c')](_0x2f6c54)[_0x68c5('0x2d')](_0x42bc6b);}};}function respondWithFilteredResult(_0x359a23,_0x20229d){return function(_0x8d243e){if(_0x8d243e){var _0x1f155c=typeof _0x20229d[_0x68c5('0x2e')]===_0x68c5('0x2f')&&typeof _0x20229d[_0x68c5('0x30')]==='undefined';var _0x2ee639=_0x8d243e[_0x68c5('0x31')];var _0x251b26=_0x1f155c?0x0:_0x20229d[_0x68c5('0x2e')];var _0x58e770=_0x1f155c?_0x8d243e['count']:_0x20229d['offset']+_0x20229d[_0x68c5('0x30')];var _0x57ef7f;if(_0x58e770>=_0x2ee639){_0x58e770=_0x2ee639;_0x57ef7f=0xc8;}else{_0x57ef7f=0xce;}_0x359a23[_0x68c5('0x2c')](_0x57ef7f);return _0x359a23[_0x68c5('0x32')](_0x68c5('0x33'),_0x251b26+'-'+_0x58e770+'/'+_0x2ee639)[_0x68c5('0x2d')](_0x8d243e);}return null;};}function patchUpdates(_0x2b5675){return function(_0x519dcd){try{jsonpatch[_0x68c5('0x34')](_0x519dcd,_0x2b5675,!![]);}catch(_0x5b3f19){return BPromise[_0x68c5('0x35')](_0x5b3f19);}return _0x519dcd[_0x68c5('0x36')]();};}function saveUpdates(_0x4b9804,_0x331d0d){return function(_0x2012cb){if(_0x2012cb){return _0x2012cb['update'](_0x4b9804)[_0x68c5('0x21')](function(_0x462019){return _0x462019;});}return null;};}function removeEntity(_0x1022f5,_0x3f2e89){return function(_0x18aaad){if(_0x18aaad){return _0x18aaad[_0x68c5('0x37')]()[_0x68c5('0x21')](function(){_0x1022f5[_0x68c5('0x2c')](0xcc)[_0x68c5('0x2b')]();});}};}function handleEntityNotFound(_0x4362a8,_0x11fe46){return function(_0x449f91){if(!_0x449f91){_0x4362a8[_0x68c5('0x2a')](0x194);}return _0x449f91;};}function handleError(_0x3da050,_0xc0037b){_0xc0037b=_0xc0037b||0x1f4;return function(_0x3fb261){logger[_0x68c5('0x25')](_0x3fb261['stack']);if(_0x3fb261['name']){delete _0x3fb261[_0x68c5('0x38')];}_0x3da050[_0x68c5('0x2c')](_0xc0037b)[_0x68c5('0x39')](_0x3fb261);};}exports['index']=function(_0x285ee8,_0x20e90e){var _0x57dcb7={},_0xb29df7={},_0x261cb8={'count':0x0,'rows':[]};var _0x13f4ba=_['map'](db[_0x68c5('0x3a')][_0x68c5('0x3b')],function(_0x2f3680){return{'name':_0x2f3680['fieldName'],'type':_0x2f3680[_0x68c5('0x3c')][_0x68c5('0x3d')]};});_0xb29df7[_0x68c5('0x3e')]=_[_0x68c5('0x3f')](_0x13f4ba,_0x68c5('0x38'));_0xb29df7[_0x68c5('0x40')]=_[_0x68c5('0x41')](_0x285ee8[_0x68c5('0x40')]);_0xb29df7[_0x68c5('0x42')]=_[_0x68c5('0x43')](_0xb29df7[_0x68c5('0x3e')],_0xb29df7['query']);_0x57dcb7[_0x68c5('0x44')]=_[_0x68c5('0x43')](_0xb29df7[_0x68c5('0x3e')],qs['fields'](_0x285ee8[_0x68c5('0x40')][_0x68c5('0x45')]));_0x57dcb7[_0x68c5('0x44')]=_0x57dcb7['attributes']['length']?_0x57dcb7[_0x68c5('0x44')]:_0xb29df7[_0x68c5('0x3e')];if(!_0x285ee8[_0x68c5('0x40')][_0x68c5('0x46')](_0x68c5('0x47'))){_0x57dcb7[_0x68c5('0x30')]=qs['limit'](_0x285ee8[_0x68c5('0x40')][_0x68c5('0x30')]);_0x57dcb7[_0x68c5('0x2e')]=qs[_0x68c5('0x2e')](_0x285ee8['query'][_0x68c5('0x2e')]);}_0x57dcb7[_0x68c5('0x48')]=qs[_0x68c5('0x49')](_0x285ee8[_0x68c5('0x40')][_0x68c5('0x49')]);_0x57dcb7['where']=qs['filters'](_['pick'](_0x285ee8[_0x68c5('0x40')],_0xb29df7['filters']),_0x13f4ba);if(_0x285ee8['query']['filter']){_0x57dcb7['where']=_[_0x68c5('0x4a')](_0x57dcb7['where'],{'$or':_[_0x68c5('0x3f')](_0x13f4ba,function(_0x5d418b){if(_0x5d418b[_0x68c5('0x3c')]!==_0x68c5('0x4b')){var _0x38c899={};_0x38c899[_0x5d418b[_0x68c5('0x38')]]={'$like':'%'+_0x285ee8[_0x68c5('0x40')]['filter']+'%'};return _0x38c899;}})});}_0x57dcb7=_[_0x68c5('0x4a')]({},_0x57dcb7,_0x285ee8[_0x68c5('0x4c')]);var _0x2354da={'where':_0x57dcb7['where']};return db['ChatMessage'][_0x68c5('0x31')](_0x2354da)['then'](function(_0x1351c5){_0x261cb8[_0x68c5('0x31')]=_0x1351c5;if(_0x285ee8[_0x68c5('0x40')]['includeAll']){_0x57dcb7[_0x68c5('0x4d')]=[{'all':!![]}];}return db[_0x68c5('0x3a')][_0x68c5('0x4e')](_0x57dcb7);})['then'](function(_0x2da353){_0x261cb8[_0x68c5('0x4f')]=_0x2da353;return _0x261cb8;})[_0x68c5('0x21')](respondWithFilteredResult(_0x20e90e,_0x57dcb7))['catch'](handleError(_0x20e90e,null));};exports[_0x68c5('0x50')]=function(_0x33f6d8,_0x522a2e){var _0xc827e7={'raw':!![],'where':{'id':_0x33f6d8[_0x68c5('0x51')]['id']}},_0x45e64d={};_0x45e64d[_0x68c5('0x3e')]=_[_0x68c5('0x41')](db[_0x68c5('0x3a')][_0x68c5('0x3b')]);_0x45e64d[_0x68c5('0x40')]=_[_0x68c5('0x41')](_0x33f6d8['query']);_0x45e64d['filters']=_[_0x68c5('0x43')](_0x45e64d['model'],_0x45e64d['query']);_0xc827e7[_0x68c5('0x44')]=_[_0x68c5('0x43')](_0x45e64d[_0x68c5('0x3e')],qs['fields'](_0x33f6d8[_0x68c5('0x40')][_0x68c5('0x45')]));_0xc827e7[_0x68c5('0x44')]=_0xc827e7[_0x68c5('0x44')]['length']?_0xc827e7[_0x68c5('0x44')]:_0x45e64d['model'];if(_0x33f6d8[_0x68c5('0x40')][_0x68c5('0x52')]){_0xc827e7[_0x68c5('0x4d')]=[{'all':!![]}];}_0xc827e7=_[_0x68c5('0x4a')]({},_0xc827e7,_0x33f6d8['options']);return db[_0x68c5('0x3a')][_0x68c5('0x53')](_0xc827e7)[_0x68c5('0x21')](handleEntityNotFound(_0x522a2e,null))[_0x68c5('0x21')](respondWithResult(_0x522a2e,null))[_0x68c5('0x29')](handleError(_0x522a2e,null));};exports[_0x68c5('0x54')]=function(_0x79212b,_0x4a962d){return db['ChatMessage']['create'](_0x79212b[_0x68c5('0x55')],{})[_0x68c5('0x21')](respondWithResult(_0x4a962d,0xc9))[_0x68c5('0x29')](handleError(_0x4a962d,null));};exports[_0x68c5('0x56')]=function(_0x5dd14a,_0x4e953a){if(_0x5dd14a['body']['id']){delete _0x5dd14a['body']['id'];}return db[_0x68c5('0x3a')][_0x68c5('0x53')]({'where':{'id':_0x5dd14a[_0x68c5('0x51')]['id']}})['then'](handleEntityNotFound(_0x4e953a,null))[_0x68c5('0x21')](saveUpdates(_0x5dd14a[_0x68c5('0x55')],null))[_0x68c5('0x21')](respondWithResult(_0x4e953a,null))[_0x68c5('0x29')](handleError(_0x4e953a,null));};exports[_0x68c5('0x37')]=function(_0x122ad3,_0x5805e4){return db[_0x68c5('0x3a')][_0x68c5('0x53')]({'where':{'id':_0x122ad3[_0x68c5('0x51')]['id']}})['then'](handleEntityNotFound(_0x5805e4,null))[_0x68c5('0x21')](removeEntity(_0x5805e4,null))[_0x68c5('0x29')](handleError(_0x5805e4,null));};exports['describe']=function(_0x4a21f5,_0x3aa43d){return db[_0x68c5('0x3a')]['describe']()[_0x68c5('0x21')](respondWithResult(_0x3aa43d,null))[_0x68c5('0x29')](handleError(_0x3aa43d,null));};var interaction_log=require(_0x68c5('0x12'))('chat-interactions');exports[_0x68c5('0x57')]=function(_0x1bd9f,_0x3c4284,_0x471320){var _0x423cac={'agent':{},'channel':_0x68c5('0x58')};if(_0x1bd9f[_0x68c5('0x55')]['id']){delete _0x1bd9f['body']['id'];}_0x1bd9f[_0x68c5('0x55')][_0x68c5('0x59')]=!![];_0x1bd9f[_0x68c5('0x55')]['readAt']=moment()[_0x68c5('0x5a')]('YYYY-MM-DD\x20HH:mm:ss');_0x1bd9f[_0x68c5('0x55')]['UserId']=_0x1bd9f[_0x68c5('0x55')][_0x68c5('0x5b')]||_0x1bd9f['user']['id'];_0x423cac[_0x68c5('0x5c')]['id']=_0x1bd9f['body'][_0x68c5('0x5b')];return db[_0x68c5('0x3a')][_0x68c5('0x53')]({'where':{'id':_0x1bd9f[_0x68c5('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3c4284,null))[_0x68c5('0x21')](saveUpdates(_0x1bd9f[_0x68c5('0x55')],null))[_0x68c5('0x21')](function(_0xb61f2b){if(_0xb61f2b){_0x423cac['message']=_0xb61f2b[_0x68c5('0x5d')]({'plain':!![]});return db['ChatInteraction']['find']({'where':{'id':_0xb61f2b[_0x68c5('0x5e')]}});}return null;})[_0x68c5('0x21')](handleEntityNotFound(_0x3c4284,null))['then'](function(_0x3beed7){if(_0x3beed7){return _0x3beed7[_0x68c5('0x56')]({'UserId':_0x1bd9f[_0x68c5('0x55')][_0x68c5('0x5b')],'read1stAt':_[_0x68c5('0x5f')](_0x3beed7[_0x68c5('0x60')])?moment()['format'](_0x68c5('0x61')):undefined});}return null;})[_0x68c5('0x21')](function(_0x286190){if(_0x286190){_0x423cac['interaction']=_0x286190[_0x68c5('0x5d')]({'plain':!![]});interaction_log[_0x68c5('0x22')](_0x68c5('0x62'),_0x1bd9f[_0x68c5('0x63')]['id'],_0x1bd9f[_0x68c5('0x63')][_0x68c5('0x38')],_0x1bd9f[_0x68c5('0x63')][_0x68c5('0x64')],_0x423cac[_0x68c5('0x65')]['id'],_0x1bd9f['body']?JSON[_0x68c5('0x24')](_0x1bd9f[_0x68c5('0x55')]):_0x68c5('0x66'));return respondWithRpcPromise(_0x68c5('0x67'),_0x68c5('0x68'),_0x423cac);}return null;})[_0x68c5('0x21')](function(_0x6bd594){var _0x529148=_0x68c5('0x69')+_0x6bd594[_0x68c5('0x27')][_0x68c5('0x6a')];return db[_0x68c5('0x6b')][_0x68c5('0x40')](_0x529148,{'type':db[_0x68c5('0x6c')][_0x68c5('0x6d')][_0x68c5('0x6e')],'raw':!![]})[_0x68c5('0x21')](function(_0x33a06c){return _0x33a06c;});})[_0x68c5('0x21')](function(_0x4bd448){if(_0x4bd448){_0x423cac[_0x68c5('0x27')][_0x68c5('0x6f')]=_0x4bd448[0x0];if(!_0x1bd9f[_0x68c5('0x55')][_0x68c5('0x5b')])return;return db[_0x68c5('0x70')][_0x68c5('0x53')]({'where':{'id':_0x1bd9f['body'][_0x68c5('0x5b')],'role':_0x68c5('0x5c')},'attributes':['id',_0x68c5('0x38'),_0x68c5('0x71'),_0x68c5('0x72'),_0x68c5('0x73')],'raw':!![]});}return null;})[_0x68c5('0x21')](function(_0x569bf8){if(!_0x569bf8)return null;_0x423cac[_0x68c5('0x27')]['agent']=_0x569bf8;return _0x423cac;})[_0x68c5('0x21')](function(_0xa2fa22){if(_0xa2fa22){if(_0x1bd9f[_0x68c5('0x55')]['manual']){_0x423cac[_0x68c5('0x27')][_0x68c5('0x74')]=util[_0x68c5('0x5a')](_0x68c5('0x75'),_0x1bd9f[_0x68c5('0x63')][_0x68c5('0x38')]);_0x423cac[_0x68c5('0x27')][_0x68c5('0x76')]=_0x423cac[_0x68c5('0x76')];_0x423cac[_0x68c5('0x27')][_0x68c5('0x77')]=_0x423cac[_0x68c5('0x76')];_0x423cac['message'][_0x68c5('0x78')]='accept';return respondWithRpcPromise('EventManager','EventManager',{'event':'acceptmessage','message':_[_0x68c5('0x4a')](_0x423cac[_0x68c5('0x27')],JSON[_0x68c5('0x79')](_0x423cac[_0x68c5('0x65')][_0x68c5('0x7a')]))},client9002)[_0x68c5('0x21')](function(){return _0x423cac;});}return _0x423cac;}return null;})[_0x68c5('0x21')](respondWithResult(_0x3c4284,null))[_0x68c5('0x29')](handleError(_0x3c4284,null));};var interaction_log=require(_0x68c5('0x12'))(_0x68c5('0x7b'));exports[_0x68c5('0x35')]=function(_0xb6a0f9,_0x350841,_0x17aee8){var _0x35c4a8={'agent':{},'channel':_0x68c5('0x58')};if(_0xb6a0f9['body']['id']){delete _0xb6a0f9[_0x68c5('0x55')]['id'];}_0xb6a0f9[_0x68c5('0x55')][_0x68c5('0x5b')]=_0xb6a0f9['body'][_0x68c5('0x5b')]||_0xb6a0f9['user']['id'];_0x35c4a8[_0x68c5('0x5c')]['id']=_0xb6a0f9[_0x68c5('0x55')][_0x68c5('0x5b')];return db['ChatMessage']['find']({'where':{'id':_0xb6a0f9[_0x68c5('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x350841,null))['then'](function(_0x15d98c){if(_0x15d98c){_0x35c4a8[_0x68c5('0x27')]=_0x15d98c[_0x68c5('0x5d')]({'plain':!![]});return db[_0x68c5('0x7c')][_0x68c5('0x53')]({'where':{'id':_0x15d98c[_0x68c5('0x5e')]}});}return null;})['then'](handleEntityNotFound(_0x350841,null))['then'](function(_0xd1dc66){if(_0xd1dc66){_0x35c4a8['interaction']=_0xd1dc66[_0x68c5('0x5d')]({'plain':!![]});interaction_log[_0x68c5('0x22')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xb6a0f9[_0x68c5('0x63')]['id'],_0xb6a0f9[_0x68c5('0x63')]['name'],_0xb6a0f9[_0x68c5('0x63')][_0x68c5('0x64')],_0x35c4a8[_0x68c5('0x65')]['id'],_0xb6a0f9[_0x68c5('0x55')]?JSON[_0x68c5('0x24')](_0xb6a0f9[_0x68c5('0x55')]):'null');return respondWithRpcPromise(_0x68c5('0x7d'),'rejectMessage',_0x35c4a8);}return null;})[_0x68c5('0x21')](function(_0x1cf959){var _0x2a832d='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1cf959['message'][_0x68c5('0x6a')];return db[_0x68c5('0x6b')][_0x68c5('0x40')](_0x2a832d,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0x68c5('0x21')](function(_0x48e00a){return _0x48e00a;});})[_0x68c5('0x21')](function(_0x41baba){if(_0x41baba){_0x35c4a8[_0x68c5('0x27')][_0x68c5('0x6f')]=_0x41baba[0x0];if(!_0xb6a0f9[_0x68c5('0x55')][_0x68c5('0x5b')])return;return db[_0x68c5('0x70')]['find']({'where':{'id':_0xb6a0f9[_0x68c5('0x55')][_0x68c5('0x5b')],'role':'agent'},'attributes':['id',_0x68c5('0x38'),_0x68c5('0x71'),'email',_0x68c5('0x73')],'raw':!![]});}return null;})[_0x68c5('0x21')](function(_0x1d5772){if(!_0x1d5772)return null;_0x35c4a8[_0x68c5('0x27')]['agent']=_0x1d5772;return _0x35c4a8;})['then'](function(_0xf61fba){if(_0xf61fba){_0xf61fba['message']['interface']=util[_0x68c5('0x5a')](_0x68c5('0x75'),_0xb6a0f9[_0x68c5('0x63')][_0x68c5('0x38')]);_0xf61fba[_0x68c5('0x27')]['channel']=_0x35c4a8[_0x68c5('0x76')];_0xf61fba[_0x68c5('0x27')][_0x68c5('0x77')]=_0x35c4a8[_0x68c5('0x76')];_0xf61fba['message'][_0x68c5('0x78')]='reject';respondWithRpcPromise(_0x68c5('0x7e'),_0x68c5('0x7e'),{'event':_0x68c5('0x7f'),'message':_[_0x68c5('0x4a')](_0x35c4a8[_0x68c5('0x27')],JSON['parse'](_0x35c4a8[_0x68c5('0x65')][_0x68c5('0x7a')]))},client9002);return _0x35c4a8;}return null;})[_0x68c5('0x21')](respondWithResult(_0x350841,null))['catch'](handleError(_0x350841,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 1fa1344..a577bc1 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 _0x0bc8=['events','../../mysqldb','ChatMessage','setMaxListeners','save','emit','hook','exports'];(function(_0x2ea087,_0x17f324){var _0x23ebac=function(_0x5575d8){while(--_0x5575d8){_0x2ea087['push'](_0x2ea087['shift']());}};_0x23ebac(++_0x17f324);}(_0x0bc8,0x178));var _0x80bc=function(_0x359f09,_0x6f7568){_0x359f09=_0x359f09-0x0;var _0x49f719=_0x0bc8[_0x359f09];return _0x49f719;};'use strict';var EventEmitter=require(_0x80bc('0x0'));var ChatMessage=require(_0x80bc('0x1'))['db'][_0x80bc('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x80bc('0x3')](0x0);var events={'afterCreate':_0x80bc('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x97f2c8){return function(_0x1b9b14,_0x5bc350,_0xa54026){ChatMessageEvents[_0x80bc('0x5')](_0x97f2c8+':'+_0x1b9b14['id'],_0x1b9b14);ChatMessageEvents[_0x80bc('0x5')](_0x97f2c8,_0x1b9b14);_0xa54026(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0x80bc('0x6')](e,emitEvent(event));}}module[_0x80bc('0x7')]=ChatMessageEvents; \ No newline at end of file +var _0xf9eb=['events','../../mysqldb','ChatMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x5c588f,_0x425a0d){var _0x19125e=function(_0x325792){while(--_0x325792){_0x5c588f['push'](_0x5c588f['shift']());}};_0x19125e(++_0x425a0d);}(_0xf9eb,0x1a2));var _0xbf9e=function(_0x376e18,_0x4273c6){_0x376e18=_0x376e18-0x0;var _0x247ca1=_0xf9eb[_0x376e18];return _0x247ca1;};'use strict';var EventEmitter=require(_0xbf9e('0x0'));var ChatMessage=require(_0xbf9e('0x1'))['db'][_0xbf9e('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xbf9e('0x3')](0x0);var events={'afterCreate':_0xbf9e('0x4'),'afterUpdate':_0xbf9e('0x5'),'afterDestroy':_0xbf9e('0x6')};function emitEvent(_0x4c8680){return function(_0x111f7e,_0x5ba57c,_0x566fcf){ChatMessageEvents[_0xbf9e('0x7')](_0x4c8680+':'+_0x111f7e['id'],_0x111f7e);ChatMessageEvents[_0xbf9e('0x7')](_0x4c8680,_0x111f7e);_0x566fcf(null);};}for(var e in events){if(events[_0xbf9e('0x8')](e)){var event=events[e];ChatMessage[_0xbf9e('0x9')](e,emitEvent(event));}}module[_0xbf9e('0xa')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 06536f3..e64e902 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 _0x9ce8=['request-promise','rimraf','../../config/environment','./chatMessage.attributes','exports','ChatMessage','chat_messages','fti_chat_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','error','utf8mb4','lodash','../../config/logger','api','moment','bluebird'];(function(_0x4b24c3,_0x1192d1){var _0x95d352=function(_0x3c05fb){while(--_0x3c05fb){_0x4b24c3['push'](_0x4b24c3['shift']());}};_0x95d352(++_0x1192d1);}(_0x9ce8,0x163));var _0x89ce=function(_0x47e549,_0x2e53d6){_0x47e549=_0x47e549-0x0;var _0x251374=_0x9ce8[_0x47e549];return _0x251374;};'use strict';var _=require(_0x89ce('0x0'));var util=require('util');var logger=require(_0x89ce('0x1'))(_0x89ce('0x2'));var moment=require(_0x89ce('0x3'));var BPromise=require(_0x89ce('0x4'));var rp=require(_0x89ce('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x89ce('0x6'));var config=require(_0x89ce('0x7'));var attributes=require(_0x89ce('0x8'));module[_0x89ce('0x9')]=function(_0x3c67c4,_0x24e85b){return _0x3c67c4['define'](_0x89ce('0xa'),attributes,{'tableName':_0x89ce('0xb'),'paranoid':![],'indexes':[{'name':_0x89ce('0xc'),'fields':['body'],'type':_0x89ce('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2a04c9,_0x56051e,_0x442042){var _0x2aacc8=_0x3c67c4[_0x89ce('0xe')];var _0x546dbb=_0x2a04c9[_0x89ce('0xf')]({'plain':!![]});if(_0x546dbb[_0x89ce('0x10')][_0x89ce('0x11')]()==='in'||_0x546dbb['direction'][_0x89ce('0x11')]()===_0x89ce('0x12')&&!_0x546dbb[_0x89ce('0x13')]&&!_[_0x89ce('0x14')](_0x546dbb[_0x89ce('0x15')])){_0x2aacc8[_0x89ce('0x16')][_0x89ce('0x17')]({'where':{'id':_0x546dbb[_0x89ce('0x18')]}})[_0x89ce('0x19')](function(_0x3420fd){if(_0x3420fd){_0x3420fd[_0x89ce('0x1a')]({'lastMsgAt':_0x546dbb[_0x89ce('0x1b')],'lastMsgDirection':_0x546dbb['direction'][_0x89ce('0x11')]()});}})['catch'](function(_0x1b8c30){console[_0x89ce('0x1c')](_0x1b8c30);});}_0x442042();}},'charset':_0x89ce('0x1d'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x640e=['../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','ChatInteractionId','then','update','createdAt','catch','error','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x34802f,_0x161127){var _0x18e109=function(_0x209311){while(--_0x209311){_0x34802f['push'](_0x34802f['shift']());}};_0x18e109(++_0x161127);}(_0x640e,0xde));var _0xe640=function(_0x209fcd,_0x1ecccc){_0x209fcd=_0x209fcd-0x0;var _0x501d5e=_0x640e[_0x209fcd];return _0x501d5e;};'use strict';var _=require(_0xe640('0x0'));var util=require(_0xe640('0x1'));var logger=require(_0xe640('0x2'))(_0xe640('0x3'));var moment=require(_0xe640('0x4'));var BPromise=require(_0xe640('0x5'));var rp=require(_0xe640('0x6'));var fs=require('fs');var path=require(_0xe640('0x7'));var rimraf=require(_0xe640('0x8'));var config=require(_0xe640('0x9'));var attributes=require(_0xe640('0xa'));module[_0xe640('0xb')]=function(_0x3cb4c2,_0x2412f3){return _0x3cb4c2[_0xe640('0xc')](_0xe640('0xd'),attributes,{'tableName':_0xe640('0xe'),'paranoid':![],'indexes':[{'name':_0xe640('0xf'),'fields':[_0xe640('0x10')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3b0f3f,_0x28d3a5,_0x596884){var _0x4c26b6=_0x3cb4c2[_0xe640('0x11')];var _0x50df97=_0x3b0f3f[_0xe640('0x12')]({'plain':!![]});if(_0x50df97[_0xe640('0x13')]['toLowerCase']()==='in'||_0x50df97[_0xe640('0x13')][_0xe640('0x14')]()===_0xe640('0x15')&&!_0x50df97[_0xe640('0x16')]&&!_[_0xe640('0x17')](_0x50df97[_0xe640('0x18')])){_0x4c26b6[_0xe640('0x19')]['findOne']({'where':{'id':_0x50df97[_0xe640('0x1a')]}})[_0xe640('0x1b')](function(_0x5b0e16){if(_0x5b0e16){_0x5b0e16[_0xe640('0x1c')]({'lastMsgAt':_0x50df97[_0xe640('0x1d')],'lastMsgDirection':_0x50df97[_0xe640('0x13')][_0xe640('0x14')]()});}})[_0xe640('0x1e')](function(_0x43e209){console[_0xe640('0x1f')](_0x43e209);});}_0x596884();}},'charset':_0xe640('0x20'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 50b0571..ab7924e 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 _0x38ad=['./chatMessage.socket','register','request','then','info','request\x20sent','debug','error','code','ChatMessage,\x20%s,\x20%s','message','catch','CreateChatMessage','ChatMessage','create','body','options','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','localhost','socket.io-emitter'];(function(_0x134192,_0x36adc5){var _0x3cd080=function(_0x134371){while(--_0x134371){_0x134192['push'](_0x134192['shift']());}};_0x3cd080(++_0x36adc5);}(_0x38ad,0x1d2));var _0xd38a=function(_0x41c943,_0x540db4){_0x41c943=_0x41c943-0x0;var _0x13eb93=_0x38ad[_0x41c943];return _0x13eb93;};'use strict';var _=require(_0xd38a('0x0'));var util=require(_0xd38a('0x1'));var moment=require('moment');var BPromise=require(_0xd38a('0x2'));var rs=require(_0xd38a('0x3'));var fs=require('fs');var Redis=require(_0xd38a('0x4'));var db=require(_0xd38a('0x5'))['db'];var utils=require(_0xd38a('0x6'));var logger=require(_0xd38a('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd38a('0x8'));var client=jayson[_0xd38a('0x9')][_0xd38a('0xa')]({'port':0x232a});config[_0xd38a('0xb')]=_['defaults'](config[_0xd38a('0xb')],{'host':_0xd38a('0xc'),'port':0x18eb});var socket=require(_0xd38a('0xd'))(new Redis(config['redis']));require(_0xd38a('0xe'))[_0xd38a('0xf')](socket);function respondWithRpcPromise(_0x45729a,_0x57c136,_0x1825d8){return new BPromise(function(_0x1714ef,_0xe4f833){return client[_0xd38a('0x10')](_0x45729a,_0x1825d8)[_0xd38a('0x11')](function(_0x1e9692){logger[_0xd38a('0x12')]('ChatMessage,\x20%s,\x20%s',_0x57c136,_0xd38a('0x13'));logger[_0xd38a('0x14')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x57c136,_0xd38a('0x13'),JSON['stringify'](_0x1e9692));if(_0x1e9692[_0xd38a('0x15')]){if(_0x1e9692[_0xd38a('0x15')][_0xd38a('0x16')]===0x1f4){logger['error'](_0xd38a('0x17'),_0x57c136,_0x1e9692['error'][_0xd38a('0x18')]);return _0xe4f833(_0x1e9692[_0xd38a('0x15')]['message']);}logger['error'](_0xd38a('0x17'),_0x57c136,_0x1e9692[_0xd38a('0x15')][_0xd38a('0x18')]);return _0x1714ef(_0x1e9692['error']['message']);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x57c136,_0xd38a('0x13'));_0x1714ef(_0x1e9692['result'][_0xd38a('0x18')]);}})[_0xd38a('0x19')](function(_0x58b627){logger[_0xd38a('0x15')](_0xd38a('0x17'),_0x57c136,_0x58b627);_0xe4f833(_0x58b627);});});}exports[_0xd38a('0x1a')]=function(_0x2ee3a6){var _0x5d9ba6=this;return new Promise(function(_0x27d9c8,_0x11e7c0){return db[_0xd38a('0x1b')][_0xd38a('0x1c')](_0x2ee3a6[_0xd38a('0x1d')],{'raw':_0x2ee3a6[_0xd38a('0x1e')]?_0x2ee3a6[_0xd38a('0x1e')][_0xd38a('0x1f')]===undefined?!![]:![]:!![]})[_0xd38a('0x11')](function(_0x4cf53f){logger['info'](_0xd38a('0x1a'),_0x2ee3a6);logger['debug'](_0xd38a('0x1a'),_0x2ee3a6,JSON['stringify'](_0x4cf53f));_0x27d9c8(_0x4cf53f);})[_0xd38a('0x19')](function(_0x1b3298){logger[_0xd38a('0x15')](_0xd38a('0x1a'),_0x1b3298[_0xd38a('0x18')],_0x2ee3a6);_0x11e7c0(_0x5d9ba6['error'](0x1f4,_0x1b3298[_0xd38a('0x18')]));});});}; \ No newline at end of file +var _0xdcb8=['register','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateChatMessage','ChatMessage','create','body','options','raw','then','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatMessage.socket'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0xdcb8,0x13b));var _0x8dcb=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xdcb8[_0x3b380d];return _0x54502b;};'use strict';var _=require('lodash');var util=require(_0x8dcb('0x0'));var moment=require(_0x8dcb('0x1'));var BPromise=require('bluebird');var rs=require(_0x8dcb('0x2'));var fs=require('fs');var Redis=require(_0x8dcb('0x3'));var db=require(_0x8dcb('0x4'))['db'];var utils=require(_0x8dcb('0x5'));var logger=require(_0x8dcb('0x6'))(_0x8dcb('0x7'));var config=require('../../config/environment');var jayson=require(_0x8dcb('0x8'));var client=jayson[_0x8dcb('0x9')][_0x8dcb('0xa')]({'port':0x232a});config[_0x8dcb('0xb')]=_[_0x8dcb('0xc')](config[_0x8dcb('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x8dcb('0xd'))(new Redis(config['redis']));require(_0x8dcb('0xe'))[_0x8dcb('0xf')](socket);function respondWithRpcPromise(_0x4e0494,_0x25916d,_0x49d06d){return new BPromise(function(_0x480639,_0x30b4e2){return client[_0x8dcb('0x10')](_0x4e0494,_0x49d06d)['then'](function(_0x23bfaa){logger[_0x8dcb('0x11')](_0x8dcb('0x12'),_0x25916d,_0x8dcb('0x13'));logger['debug'](_0x8dcb('0x14'),_0x25916d,_0x8dcb('0x13'),JSON['stringify'](_0x23bfaa));if(_0x23bfaa[_0x8dcb('0x15')]){if(_0x23bfaa['error'][_0x8dcb('0x16')]===0x1f4){logger[_0x8dcb('0x15')]('ChatMessage,\x20%s,\x20%s',_0x25916d,_0x23bfaa[_0x8dcb('0x15')][_0x8dcb('0x17')]);return _0x30b4e2(_0x23bfaa[_0x8dcb('0x15')]['message']);}logger[_0x8dcb('0x15')](_0x8dcb('0x12'),_0x25916d,_0x23bfaa[_0x8dcb('0x15')]['message']);return _0x480639(_0x23bfaa['error'][_0x8dcb('0x17')]);}else{logger[_0x8dcb('0x11')](_0x8dcb('0x12'),_0x25916d,'request\x20sent');_0x480639(_0x23bfaa[_0x8dcb('0x18')][_0x8dcb('0x17')]);}})[_0x8dcb('0x19')](function(_0x45f918){logger[_0x8dcb('0x15')](_0x8dcb('0x12'),_0x25916d,_0x45f918);_0x30b4e2(_0x45f918);});});}exports[_0x8dcb('0x1a')]=function(_0x109bca){var _0x103bf0=this;return new Promise(function(_0x1837c6,_0x34df68){return db[_0x8dcb('0x1b')][_0x8dcb('0x1c')](_0x109bca[_0x8dcb('0x1d')],{'raw':_0x109bca[_0x8dcb('0x1e')]?_0x109bca[_0x8dcb('0x1e')][_0x8dcb('0x1f')]===undefined?!![]:![]:!![]})[_0x8dcb('0x20')](function(_0x4925de){logger[_0x8dcb('0x11')](_0x8dcb('0x1a'),_0x109bca);logger['debug'](_0x8dcb('0x1a'),_0x109bca,JSON['stringify'](_0x4925de));_0x1837c6(_0x4925de);})[_0x8dcb('0x19')](function(_0x432028){logger[_0x8dcb('0x15')](_0x8dcb('0x1a'),_0x432028[_0x8dcb('0x17')],_0x109bca);_0x34df68(_0x103bf0[_0x8dcb('0x15')](0x1f4,_0x432028[_0x8dcb('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index d1ecd55..6a8658d 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 _0x7d55=['emit','removeListener','register','length','./chatMessage.events','save','remove','update'];(function(_0x9a6ed7,_0x174916){var _0x13d571=function(_0x3d9902){while(--_0x3d9902){_0x9a6ed7['push'](_0x9a6ed7['shift']());}};_0x13d571(++_0x174916);}(_0x7d55,0x1bc));var _0x57d5=function(_0x4a5439,_0x228af){_0x4a5439=_0x4a5439-0x0;var _0x2f5150=_0x7d55[_0x4a5439];return _0x2f5150;};'use strict';var ChatMessageEvents=require(_0x57d5('0x0'));var events=[_0x57d5('0x1'),_0x57d5('0x2'),_0x57d5('0x3')];function createListener(_0x517d62,_0x541e22){return function(_0x3ce441){_0x541e22[_0x57d5('0x4')](_0x517d62,_0x3ce441);};}function removeListener(_0x2b6dc5,_0x48b5aa){return function(){ChatMessageEvents[_0x57d5('0x5')](_0x2b6dc5,_0x48b5aa);};}exports[_0x57d5('0x6')]=function(_0x15c349){for(var _0x30fcfe=0x0,_0x4393ed=events[_0x57d5('0x7')];_0x30fcfe<_0x4393ed;_0x30fcfe++){var _0x599ec5=events[_0x30fcfe];var _0x50bc50=createListener('chatMessage:'+_0x599ec5,_0x15c349);ChatMessageEvents['on'](_0x599ec5,_0x50bc50);}}; \ No newline at end of file +var _0x818f=['update','emit','removeListener','register','length','chatMessage:','./chatMessage.events','save','remove'];(function(_0x1974a6,_0xdb12ff){var _0x8f6b8c=function(_0x4655d1){while(--_0x4655d1){_0x1974a6['push'](_0x1974a6['shift']());}};_0x8f6b8c(++_0xdb12ff);}(_0x818f,0x1da));var _0xf818=function(_0x8cc1ce,_0x120de3){_0x8cc1ce=_0x8cc1ce-0x0;var _0x293189=_0x818f[_0x8cc1ce];return _0x293189;};'use strict';var ChatMessageEvents=require(_0xf818('0x0'));var events=[_0xf818('0x1'),_0xf818('0x2'),_0xf818('0x3')];function createListener(_0x121db7,_0x39b430){return function(_0x58f142){_0x39b430[_0xf818('0x4')](_0x121db7,_0x58f142);};}function removeListener(_0xd6c86,_0x2c1bb0){return function(){ChatMessageEvents[_0xf818('0x5')](_0xd6c86,_0x2c1bb0);};}exports[_0xf818('0x6')]=function(_0x41310f){for(var _0x27119b=0x0,_0x42a23e=events[_0xf818('0x7')];_0x27119b<_0x42a23e;_0x27119b++){var _0x55540d=events[_0x27119b];var _0x1dbfc8=createListener(_0xf818('0x8')+_0x55540d,_0x41310f);ChatMessageEvents['on'](_0x55540d,_0x1dbfc8);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 4e06e7f..d153cf9 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 _0x4f23=['show','post','tracked','chat','create','put','/:id','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x23dcb3,_0x37f439){var _0x15e3e1=function(_0x5d3a85){while(--_0x5d3a85){_0x23dcb3['push'](_0x23dcb3['shift']());}};_0x15e3e1(++_0x37f439);}(_0x4f23,0x83));var _0x34f2=function(_0x5879dd,_0x31f7f4){_0x5879dd=_0x5879dd-0x0;var _0x271b41=_0x4f23[_0x5879dd];return _0x271b41;};'use strict';var multer=require('multer');var util=require(_0x34f2('0x0'));var path=require('path');var timeout=require(_0x34f2('0x1'));var express=require(_0x34f2('0x2'));var router=express[_0x34f2('0x3')]();var fs_extra=require(_0x34f2('0x4'));var auth=require(_0x34f2('0x5'));var interaction=require(_0x34f2('0x6'));var config=require(_0x34f2('0x7'));var controller=require(_0x34f2('0x8'));router[_0x34f2('0x9')]('/',auth[_0x34f2('0xa')](),controller[_0x34f2('0xb')]);router['get'](_0x34f2('0xc'),auth['isAuthenticated'](),controller[_0x34f2('0xd')]);router[_0x34f2('0x9')]('/:id',auth[_0x34f2('0xa')](),controller[_0x34f2('0xe')]);router[_0x34f2('0xf')]('/',auth['isAuthenticated'](),interaction[_0x34f2('0x10')](_0x34f2('0x11'),'chatmessage:create'),controller[_0x34f2('0x12')]);router[_0x34f2('0x13')](_0x34f2('0x14'),controller[_0x34f2('0x15')]);router['put'](_0x34f2('0x16'),auth['isAuthenticated'](),controller[_0x34f2('0x17')]);router[_0x34f2('0x13')](_0x34f2('0x18'),auth['isAuthenticated'](),controller[_0x34f2('0x19')]);router[_0x34f2('0x1a')](_0x34f2('0x14'),auth[_0x34f2('0xa')](),controller[_0x34f2('0x1b')]);module[_0x34f2('0x1c')]=router; \ No newline at end of file +var _0xa1d6=['chat','chatmessage:create','create','/:id/accept','accept','put','/:id/reject','reject','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','post','tracked'];(function(_0x56f561,_0x7f75f4){var _0x15ed6f=function(_0xc13416){while(--_0xc13416){_0x56f561['push'](_0x56f561['shift']());}};_0x15ed6f(++_0x7f75f4);}(_0xa1d6,0x10f));var _0x6a1d=function(_0x35ce0e,_0x13f34e){_0x35ce0e=_0x35ce0e-0x0;var _0x17d179=_0xa1d6[_0x35ce0e];return _0x17d179;};'use strict';var multer=require(_0x6a1d('0x0'));var util=require(_0x6a1d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6a1d('0x2'));var router=express[_0x6a1d('0x3')]();var fs_extra=require(_0x6a1d('0x4'));var auth=require(_0x6a1d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6a1d('0x6'));var controller=require('./chatMessage.controller');router[_0x6a1d('0x7')]('/',auth[_0x6a1d('0x8')](),controller['index']);router['get'](_0x6a1d('0x9'),auth[_0x6a1d('0x8')](),controller[_0x6a1d('0xa')]);router[_0x6a1d('0x7')](_0x6a1d('0xb'),auth[_0x6a1d('0x8')](),controller[_0x6a1d('0xc')]);router[_0x6a1d('0xd')]('/',auth[_0x6a1d('0x8')](),interaction[_0x6a1d('0xe')](_0x6a1d('0xf'),_0x6a1d('0x10')),controller[_0x6a1d('0x11')]);router['put'](_0x6a1d('0xb'),controller['update']);router['put'](_0x6a1d('0x12'),auth[_0x6a1d('0x8')](),controller[_0x6a1d('0x13')]);router[_0x6a1d('0x14')](_0x6a1d('0x15'),auth[_0x6a1d('0x8')](),controller[_0x6a1d('0x16')]);router[_0x6a1d('0x17')](_0x6a1d('0xb'),auth[_0x6a1d('0x8')](),controller[_0x6a1d('0x18')]);module[_0x6a1d('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index a12f17a..92640e3 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 _0xd1a0=['sequelize','TEXT','medium'];(function(_0xf4b05a,_0x301123){var _0x29812f=function(_0x535463){while(--_0x535463){_0xf4b05a['push'](_0xf4b05a['shift']());}};_0x29812f(++_0x301123);}(_0xd1a0,0x132));var _0x0d1a=function(_0xc94ca0,_0x363c2a){_0xc94ca0=_0xc94ca0-0x0;var _0x1871b8=_0xd1a0[_0xc94ca0];return _0x1871b8;};'use strict';var Sequelize=require(_0x0d1a('0x0'));module['exports']={'body':{'type':Sequelize[_0x0d1a('0x1')](_0x0d1a('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0x47c8=['exports','TEXT','medium','sequelize'];(function(_0x369cae,_0x45a057){var _0xc7a297=function(_0x1e81bf){while(--_0x1e81bf){_0x369cae['push'](_0x369cae['shift']());}};_0xc7a297(++_0x45a057);}(_0x47c8,0xcf));var _0x847c=function(_0x2f1351,_0xb5203){_0x2f1351=_0x2f1351-0x0;var _0xe88511=_0x47c8[_0x2f1351];return _0xe88511;};'use strict';var Sequelize=require(_0x847c('0x0'));module[_0x847c('0x1')]={'body':{'type':Sequelize[_0x847c('0x2')](_0x847c('0x3')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 632d606..7b43f5a 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x7a54,0x106));var _0x47a5=function(_0x1b3f8b,_0x218dc6){_0x1b3f8b=_0x1b3f8b-0x0;var _0x413fb0=_0x7a54[_0x1b3f8b];return _0x413fb0;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x7a54,0x106));var _0x47a5=function(_0x11d73e,_0x3f4882){_0x11d73e=_0x11d73e-0x0;var _0xfd3d73=_0x7a54[_0x11d73e];return _0xfd3d73;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 631331c..b9c4474 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 _0x7484=['chat_offline_messages','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatOfflineMessage.attributes','exports','ChatOfflineMessage'];(function(_0x23bed6,_0x45f84f){var _0x1f9d5b=function(_0x96df66){while(--_0x96df66){_0x23bed6['push'](_0x23bed6['shift']());}};_0x1f9d5b(++_0x45f84f);}(_0x7484,0x71));var _0x4748=function(_0x16fedc,_0x254475){_0x16fedc=_0x16fedc-0x0;var _0xff9a07=_0x7484[_0x16fedc];return _0xff9a07;};'use strict';var _=require(_0x4748('0x0'));var util=require(_0x4748('0x1'));var logger=require(_0x4748('0x2'))(_0x4748('0x3'));var moment=require(_0x4748('0x4'));var BPromise=require(_0x4748('0x5'));var rp=require(_0x4748('0x6'));var fs=require('fs');var path=require(_0x4748('0x7'));var rimraf=require(_0x4748('0x8'));var config=require(_0x4748('0x9'));var attributes=require(_0x4748('0xa'));module[_0x4748('0xb')]=function(_0x260c5c,_0x209a1b){return _0x260c5c['define'](_0x4748('0xc'),attributes,{'tableName':_0x4748('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x74f1=['rimraf','../../config/environment','./chatOfflineMessage.attributes','exports','define','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','request-promise','path'];(function(_0x582d0b,_0x28f609){var _0x2e93e1=function(_0xb6a81c){while(--_0xb6a81c){_0x582d0b['push'](_0x582d0b['shift']());}};_0x2e93e1(++_0x28f609);}(_0x74f1,0x14a));var _0x174f=function(_0x1ee0a1,_0x51058e){_0x1ee0a1=_0x1ee0a1-0x0;var _0x1d2d5b=_0x74f1[_0x1ee0a1];return _0x1d2d5b;};'use strict';var _=require('lodash');var util=require(_0x174f('0x0'));var logger=require(_0x174f('0x1'))(_0x174f('0x2'));var moment=require(_0x174f('0x3'));var BPromise=require('bluebird');var rp=require(_0x174f('0x4'));var fs=require('fs');var path=require(_0x174f('0x5'));var rimraf=require(_0x174f('0x6'));var config=require(_0x174f('0x7'));var attributes=require(_0x174f('0x8'));module[_0x174f('0x9')]=function(_0xc8fdce,_0x1a4cff){return _0xc8fdce[_0x174f('0xa')]('ChatOfflineMessage',attributes,{'tableName':_0x174f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x174f('0xc'),'collate':_0x174f('0xd')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 3bb70b6..64f2b9d 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 _0xd139=['catch','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result'];(function(_0x114626,_0xa10843){var _0x109aef=function(_0x14c4fe){while(--_0x14c4fe){_0x114626['push'](_0x114626['shift']());}};_0x109aef(++_0xa10843);}(_0xd139,0x1ef));var _0x9d13=function(_0xca70d,_0x11827e){_0xca70d=_0xca70d-0x0;var _0x1a17f1=_0xd139[_0xca70d];return _0x1a17f1;};'use strict';var _=require(_0x9d13('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9d13('0x1'));var fs=require('fs');var Redis=require(_0x9d13('0x2'));var db=require(_0x9d13('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9d13('0x4'))(_0x9d13('0x5'));var config=require('../../config/environment');var jayson=require(_0x9d13('0x6'));var client=jayson[_0x9d13('0x7')][_0x9d13('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d7993,_0x4d47e0,_0x75b3d2){return new BPromise(function(_0x5f3551,_0x1eafba){return client['request'](_0x1d7993,_0x75b3d2)[_0x9d13('0x9')](function(_0xdce21d){logger[_0x9d13('0xa')](_0x9d13('0xb'),_0x4d47e0,_0x9d13('0xc'));logger[_0x9d13('0xd')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x4d47e0,_0x9d13('0xc'),JSON['stringify'](_0xdce21d));if(_0xdce21d[_0x9d13('0xe')]){if(_0xdce21d['error'][_0x9d13('0xf')]===0x1f4){logger[_0x9d13('0xe')](_0x9d13('0xb'),_0x4d47e0,_0xdce21d['error'][_0x9d13('0x10')]);return _0x1eafba(_0xdce21d[_0x9d13('0xe')][_0x9d13('0x10')]);}logger[_0x9d13('0xe')](_0x9d13('0xb'),_0x4d47e0,_0xdce21d[_0x9d13('0xe')][_0x9d13('0x10')]);return _0x5f3551(_0xdce21d[_0x9d13('0xe')][_0x9d13('0x10')]);}else{logger[_0x9d13('0xa')](_0x9d13('0xb'),_0x4d47e0,_0x9d13('0xc'));_0x5f3551(_0xdce21d[_0x9d13('0x11')][_0x9d13('0x10')]);}})[_0x9d13('0x12')](function(_0x3cbfc9){logger[_0x9d13('0xe')](_0x9d13('0xb'),_0x4d47e0,_0x3cbfc9);_0x1eafba(_0x3cbfc9);});});} \ No newline at end of file +var _0x9ea2=['then','info','ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9ea2,0x147));var _0x29ea=function(_0x383ea8,_0x5d5797){_0x383ea8=_0x383ea8-0x0;var _0x3736b8=_0x9ea2[_0x383ea8];return _0x3736b8;};'use strict';var _=require(_0x29ea('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x29ea('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x29ea('0x2'));var db=require(_0x29ea('0x3'))['db'];var utils=require(_0x29ea('0x4'));var logger=require(_0x29ea('0x5'))(_0x29ea('0x6'));var config=require(_0x29ea('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19f3b7,_0x50e60f,_0x36dbd7){return new BPromise(function(_0x25b1aa,_0x724c09){return client[_0x29ea('0x8')](_0x19f3b7,_0x36dbd7)[_0x29ea('0x9')](function(_0x96d254){logger[_0x29ea('0xa')](_0x29ea('0xb'),_0x50e60f,'request\x20sent');logger[_0x29ea('0xc')](_0x29ea('0xd'),_0x50e60f,_0x29ea('0xe'),JSON[_0x29ea('0xf')](_0x96d254));if(_0x96d254['error']){if(_0x96d254['error'][_0x29ea('0x10')]===0x1f4){logger[_0x29ea('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x50e60f,_0x96d254[_0x29ea('0x11')][_0x29ea('0x12')]);return _0x724c09(_0x96d254[_0x29ea('0x11')]['message']);}logger[_0x29ea('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x50e60f,_0x96d254[_0x29ea('0x11')][_0x29ea('0x12')]);return _0x25b1aa(_0x96d254[_0x29ea('0x11')][_0x29ea('0x12')]);}else{logger[_0x29ea('0xa')](_0x29ea('0xb'),_0x50e60f,_0x29ea('0xe'));_0x25b1aa(_0x96d254[_0x29ea('0x13')][_0x29ea('0x12')]);}})[_0x29ea('0x14')](function(_0x303ceb){logger[_0x29ea('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x50e60f,_0x303ceb);_0x724c09(_0x303ceb);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index d9778b2..72ef751 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 _0x4ee6=['get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller'];(function(_0xe49a87,_0x405df8){var _0x54a107=function(_0x4cd5cb){while(--_0x4cd5cb){_0xe49a87['push'](_0xe49a87['shift']());}};_0x54a107(++_0x405df8);}(_0x4ee6,0x1c2));var _0x64ee=function(_0xa4a87d,_0x3b8229){_0xa4a87d=_0xa4a87d-0x0;var _0xc064ed=_0x4ee6[_0xa4a87d];return _0xc064ed;};'use strict';var multer=require('multer');var util=require(_0x64ee('0x0'));var path=require(_0x64ee('0x1'));var timeout=require(_0x64ee('0x2'));var express=require(_0x64ee('0x3'));var router=express[_0x64ee('0x4')]();var fs_extra=require(_0x64ee('0x5'));var auth=require(_0x64ee('0x6'));var interaction=require(_0x64ee('0x7'));var config=require(_0x64ee('0x8'));var controller=require(_0x64ee('0x9'));router[_0x64ee('0xa')]('/',auth['isAuthenticated'](),controller[_0x64ee('0xb')]);router[_0x64ee('0xa')](_0x64ee('0xc'),auth[_0x64ee('0xd')](),controller[_0x64ee('0xe')]);router[_0x64ee('0xa')](_0x64ee('0xf'),auth[_0x64ee('0xd')](),controller[_0x64ee('0x10')]);router[_0x64ee('0x11')]('/',auth[_0x64ee('0xd')](),controller[_0x64ee('0x12')]);router[_0x64ee('0x13')](_0x64ee('0xf'),auth[_0x64ee('0xd')](),controller[_0x64ee('0x14')]);router[_0x64ee('0x15')](_0x64ee('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x64ee('0x16')]=router; \ No newline at end of file +var _0x1591=['../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','update','destroy','exports','path','express','fs-extra','../../components/interaction/service'];(function(_0x16061c,_0xc37b21){var _0x190355=function(_0x3fe799){while(--_0x3fe799){_0x16061c['push'](_0x16061c['shift']());}};_0x190355(++_0xc37b21);}(_0x1591,0x84));var _0x1159=function(_0x5311e8,_0x57c5bb){_0x5311e8=_0x5311e8-0x0;var _0x582ad8=_0x1591[_0x5311e8];return _0x582ad8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1159('0x0'));var timeout=require('connect-timeout');var express=require(_0x1159('0x1'));var router=express['Router']();var fs_extra=require(_0x1159('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x1159('0x3'));var config=require(_0x1159('0x4'));var controller=require(_0x1159('0x5'));router[_0x1159('0x6')]('/',auth[_0x1159('0x7')](),controller['index']);router[_0x1159('0x6')](_0x1159('0x8'),auth[_0x1159('0x7')](),controller[_0x1159('0x9')]);router['get'](_0x1159('0xa'),auth[_0x1159('0x7')](),controller[_0x1159('0xb')]);router[_0x1159('0xc')]('/',auth[_0x1159('0x7')](),controller[_0x1159('0xd')]);router['put'](_0x1159('0xa'),auth['isAuthenticated'](),controller[_0x1159('0xe')]);router['delete'](_0x1159('0xa'),auth[_0x1159('0x7')](),controller[_0x1159('0xf')]);module[_0x1159('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 53e5b4b..65f53bf 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 _0x9619=['mouseOver','timeout','STRING','exports','ENUM'];(function(_0x192772,_0x100b16){var _0x2b50bd=function(_0x3cbf90){while(--_0x3cbf90){_0x192772['push'](_0x192772['shift']());}};_0x2b50bd(++_0x100b16);}(_0x9619,0x175));var _0x9961=function(_0x83a927,_0x2737b9){_0x83a927=_0x83a927-0x0;var _0x54825c=_0x9619[_0x83a927];return _0x54825c;};'use strict';var Sequelize=require('sequelize');module[_0x9961('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x9961('0x1')](_0x9961('0x2'),_0x9961('0x3')),'defaultValue':_0x9961('0x2')},'selector':{'type':Sequelize[_0x9961('0x4')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x086f=['INTEGER','sequelize','exports','STRING','ENUM','mouseOver','timeout'];(function(_0x941f4b,_0x2881e4){var _0x5b4e5b=function(_0x1ab59e){while(--_0x1ab59e){_0x941f4b['push'](_0x941f4b['shift']());}};_0x5b4e5b(++_0x2881e4);}(_0x086f,0xd3));var _0xf086=function(_0x521884,_0x29a522){_0x521884=_0x521884-0x0;var _0x35d60b=_0x086f[_0x521884];return _0x35d60b;};'use strict';var Sequelize=require(_0xf086('0x0'));module[_0xf086('0x1')]={'name':{'type':Sequelize[_0xf086('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf086('0x3')](_0xf086('0x4'),_0xf086('0x5')),'defaultValue':_0xf086('0x4')},'selector':{'type':Sequelize[_0xf086('0x2')]},'timeout':{'type':Sequelize[_0xf086('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index d8bd8d5..bbad025 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 _0x8958=['json','undefined','limit','count','offset','apply','reject','save','update','then','error','name','send','show','params','model','keys','query','filters','intersection','fields','attributes','includeAll','include','options','find','catch','create','body','ChatProactiveAction','destroy','rimraf','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x129cfc,_0x406219){var _0x1fddd5=function(_0x15c845){while(--_0x15c845){_0x129cfc['push'](_0x129cfc['shift']());}};_0x1fddd5(++_0x406219);}(_0x8958,0x93));var _0x8895=function(_0x1dddc0,_0xb87b48){_0x1dddc0=_0x1dddc0-0x0;var _0x38c199=_0x8958[_0x1dddc0];return _0x38c199;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8895('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8895('0x1'));var Mustache=require('mustache');var util=require(_0x8895('0x2'));var path=require(_0x8895('0x3'));var sox=require(_0x8895('0x4'));var csv=require('to-csv');var ejs=require(_0x8895('0x5'));var fs=require('fs');var fs_extra=require(_0x8895('0x6'));var _=require(_0x8895('0x7'));var squel=require(_0x8895('0x8'));var crypto=require(_0x8895('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x8895('0xa'));var toCsv=require(_0x8895('0xb'));var querystring=require(_0x8895('0xc'));var Papa=require(_0x8895('0xd'));var Redis=require(_0x8895('0xe'));var authService=require(_0x8895('0xf'));var qs=require(_0x8895('0x10'));var as=require(_0x8895('0x11'));var hardwareService=require(_0x8895('0x12'));var logger=require(_0x8895('0x13'))('api');var utils=require(_0x8895('0x14'));var config=require(_0x8895('0x15'));var licenseUtil=require(_0x8895('0x16'));var db=require(_0x8895('0x17'))['db'];function respondWithStatusCode(_0x446e1a,_0xaf93bc){_0xaf93bc=_0xaf93bc||0xcc;return function(_0x5af0ef){if(_0x5af0ef){return _0x446e1a[_0x8895('0x18')](_0xaf93bc);}return _0x446e1a[_0x8895('0x19')](_0xaf93bc)[_0x8895('0x1a')]();};}function respondWithResult(_0x57d40a,_0x47b9fe){_0x47b9fe=_0x47b9fe||0xc8;return function(_0x9191b8){if(_0x9191b8){return _0x57d40a['status'](_0x47b9fe)[_0x8895('0x1b')](_0x9191b8);}};}function respondWithFilteredResult(_0x337101,_0x195789){return function(_0x3d7b59){if(_0x3d7b59){var _0x2c9d40=typeof _0x195789['offset']===_0x8895('0x1c')&&typeof _0x195789[_0x8895('0x1d')]===_0x8895('0x1c');var _0xcdd661=_0x3d7b59[_0x8895('0x1e')];var _0x1b5c82=_0x2c9d40?0x0:_0x195789[_0x8895('0x1f')];var _0x26cee0=_0x2c9d40?_0x3d7b59[_0x8895('0x1e')]:_0x195789[_0x8895('0x1f')]+_0x195789[_0x8895('0x1d')];var _0x6b8a16;if(_0x26cee0>=_0xcdd661){_0x26cee0=_0xcdd661;_0x6b8a16=0xc8;}else{_0x6b8a16=0xce;}_0x337101[_0x8895('0x19')](_0x6b8a16);return _0x337101['set']('Content-Range',_0x1b5c82+'-'+_0x26cee0+'/'+_0xcdd661)['json'](_0x3d7b59);}return null;};}function patchUpdates(_0x3daf43){return function(_0x456282){try{jsonpatch[_0x8895('0x20')](_0x456282,_0x3daf43,!![]);}catch(_0x29449a){return BPromise[_0x8895('0x21')](_0x29449a);}return _0x456282[_0x8895('0x22')]();};}function saveUpdates(_0x461346,_0xc1ce17){return function(_0x5219ca){if(_0x5219ca){return _0x5219ca[_0x8895('0x23')](_0x461346)[_0x8895('0x24')](function(_0x2a403){return _0x2a403;});}return null;};}function removeEntity(_0x1f71f3,_0x29223d){return function(_0x4d092d){if(_0x4d092d){return _0x4d092d['destroy']()[_0x8895('0x24')](function(){_0x1f71f3[_0x8895('0x19')](0xcc)[_0x8895('0x1a')]();});}};}function handleEntityNotFound(_0x24a376,_0x4fc150){return function(_0x25da11){if(!_0x25da11){_0x24a376[_0x8895('0x18')](0x194);}return _0x25da11;};}function handleError(_0x187a15,_0x5486a6){_0x5486a6=_0x5486a6||0x1f4;return function(_0x4aee03){logger[_0x8895('0x25')](_0x4aee03['stack']);if(_0x4aee03[_0x8895('0x26')]){delete _0x4aee03[_0x8895('0x26')];}_0x187a15[_0x8895('0x19')](_0x5486a6)[_0x8895('0x27')](_0x4aee03);};}exports[_0x8895('0x28')]=function(_0x5c03ea,_0x4d567a){var _0x6e449d={'raw':!![],'where':{'id':_0x5c03ea[_0x8895('0x29')]['id']}},_0x37ac3a={};_0x37ac3a[_0x8895('0x2a')]=_[_0x8895('0x2b')](db['ChatProactiveAction']['rawAttributes']);_0x37ac3a[_0x8895('0x2c')]=_[_0x8895('0x2b')](_0x5c03ea[_0x8895('0x2c')]);_0x37ac3a[_0x8895('0x2d')]=_[_0x8895('0x2e')](_0x37ac3a['model'],_0x37ac3a[_0x8895('0x2c')]);_0x6e449d['attributes']=_[_0x8895('0x2e')](_0x37ac3a['model'],qs[_0x8895('0x2f')](_0x5c03ea[_0x8895('0x2c')][_0x8895('0x2f')]));_0x6e449d[_0x8895('0x30')]=_0x6e449d[_0x8895('0x30')]['length']?_0x6e449d[_0x8895('0x30')]:_0x37ac3a[_0x8895('0x2a')];if(_0x5c03ea[_0x8895('0x2c')][_0x8895('0x31')]){_0x6e449d[_0x8895('0x32')]=[{'all':!![]}];}_0x6e449d=_['merge']({},_0x6e449d,_0x5c03ea[_0x8895('0x33')]);return db['ChatProactiveAction'][_0x8895('0x34')](_0x6e449d)['then'](handleEntityNotFound(_0x4d567a,null))[_0x8895('0x24')](respondWithResult(_0x4d567a,null))[_0x8895('0x35')](handleError(_0x4d567a,null));};exports[_0x8895('0x36')]=function(_0x418e53,_0xd08bf3){return db['ChatProactiveAction'][_0x8895('0x36')](_0x418e53['body'],{})[_0x8895('0x24')](respondWithResult(_0xd08bf3,0xc9))[_0x8895('0x35')](handleError(_0xd08bf3,null));};exports[_0x8895('0x23')]=function(_0x9297ea,_0x25fa39){if(_0x9297ea[_0x8895('0x37')]['id']){delete _0x9297ea['body']['id'];}return db[_0x8895('0x38')][_0x8895('0x34')]({'where':{'id':_0x9297ea['params']['id']}})[_0x8895('0x24')](handleEntityNotFound(_0x25fa39,null))['then'](saveUpdates(_0x9297ea[_0x8895('0x37')],null))[_0x8895('0x24')](respondWithResult(_0x25fa39,null))['catch'](handleError(_0x25fa39,null));};exports[_0x8895('0x39')]=function(_0x418250,_0x5b7204){return db['ChatProactiveAction'][_0x8895('0x34')]({'where':{'id':_0x418250[_0x8895('0x29')]['id']}})[_0x8895('0x24')](handleEntityNotFound(_0x5b7204,null))[_0x8895('0x24')](removeEntity(_0x5b7204,null))[_0x8895('0x35')](handleError(_0x5b7204,null));}; \ No newline at end of file +var _0x97d5=['catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','show','params','model','ChatProactiveAction','rawAttributes','query','filters','attributes','includeAll','include','merge','options','find'];(function(_0x527382,_0x15ba60){var _0x157add=function(_0x452261){while(--_0x452261){_0x527382['push'](_0x527382['shift']());}};_0x157add(++_0x15ba60);}(_0x97d5,0x199));var _0x597d=function(_0x484630,_0x24ca02){_0x484630=_0x484630-0x0;var _0x2e187e=_0x97d5[_0x484630];return _0x2e187e;};'use strict';var emlformat=require(_0x597d('0x0'));var rimraf=require(_0x597d('0x1'));var zipdir=require(_0x597d('0x2'));var jsonpatch=require(_0x597d('0x3'));var rp=require(_0x597d('0x4'));var moment=require(_0x597d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x597d('0x6'));var util=require(_0x597d('0x7'));var path=require(_0x597d('0x8'));var sox=require('sox');var csv=require(_0x597d('0x9'));var ejs=require(_0x597d('0xa'));var fs=require('fs');var fs_extra=require(_0x597d('0xb'));var _=require(_0x597d('0xc'));var squel=require(_0x597d('0xd'));var crypto=require(_0x597d('0xe'));var jsforce=require(_0x597d('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x597d('0x9'));var querystring=require(_0x597d('0x10'));var Papa=require('papaparse');var Redis=require(_0x597d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x597d('0x12'));var as=require(_0x597d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x597d('0x14'));var utils=require(_0x597d('0x15'));var config=require(_0x597d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x597d('0x17'))['db'];function respondWithStatusCode(_0x2f464a,_0x355fbd){_0x355fbd=_0x355fbd||0xcc;return function(_0x1664e5){if(_0x1664e5){return _0x2f464a[_0x597d('0x18')](_0x355fbd);}return _0x2f464a[_0x597d('0x19')](_0x355fbd)[_0x597d('0x1a')]();};}function respondWithResult(_0x465ebc,_0x810dce){_0x810dce=_0x810dce||0xc8;return function(_0x11147c){if(_0x11147c){return _0x465ebc[_0x597d('0x19')](_0x810dce)[_0x597d('0x1b')](_0x11147c);}};}function respondWithFilteredResult(_0x290db2,_0x394d1d){return function(_0x4ca1b1){if(_0x4ca1b1){var _0x17b021=typeof _0x394d1d['offset']===_0x597d('0x1c')&&typeof _0x394d1d[_0x597d('0x1d')]==='undefined';var _0x38844b=_0x4ca1b1['count'];var _0x68a5c6=_0x17b021?0x0:_0x394d1d[_0x597d('0x1e')];var _0x525f28=_0x17b021?_0x4ca1b1['count']:_0x394d1d['offset']+_0x394d1d[_0x597d('0x1d')];var _0x32717e;if(_0x525f28>=_0x38844b){_0x525f28=_0x38844b;_0x32717e=0xc8;}else{_0x32717e=0xce;}_0x290db2[_0x597d('0x19')](_0x32717e);return _0x290db2[_0x597d('0x1f')](_0x597d('0x20'),_0x68a5c6+'-'+_0x525f28+'/'+_0x38844b)[_0x597d('0x1b')](_0x4ca1b1);}return null;};}function patchUpdates(_0x4173c9){return function(_0x1f8966){try{jsonpatch[_0x597d('0x21')](_0x1f8966,_0x4173c9,!![]);}catch(_0x349d8a){return BPromise['reject'](_0x349d8a);}return _0x1f8966[_0x597d('0x22')]();};}function saveUpdates(_0x330794,_0x639ac){return function(_0x2d4e7b){if(_0x2d4e7b){return _0x2d4e7b[_0x597d('0x23')](_0x330794)[_0x597d('0x24')](function(_0x529af4){return _0x529af4;});}return null;};}function removeEntity(_0xc6ca7,_0xa0a6da){return function(_0x104476){if(_0x104476){return _0x104476[_0x597d('0x25')]()[_0x597d('0x24')](function(){_0xc6ca7['status'](0xcc)[_0x597d('0x1a')]();});}};}function handleEntityNotFound(_0x8e3c80,_0x1379a2){return function(_0x5a551f){if(!_0x5a551f){_0x8e3c80[_0x597d('0x18')](0x194);}return _0x5a551f;};}function handleError(_0x1713d1,_0x30d783){_0x30d783=_0x30d783||0x1f4;return function(_0x6f424f){logger[_0x597d('0x26')](_0x6f424f[_0x597d('0x27')]);if(_0x6f424f[_0x597d('0x28')]){delete _0x6f424f[_0x597d('0x28')];}_0x1713d1[_0x597d('0x19')](_0x30d783)[_0x597d('0x29')](_0x6f424f);};}exports[_0x597d('0x2a')]=function(_0x249e81,_0x25ffc6){var _0x2fcb0d={'raw':!![],'where':{'id':_0x249e81[_0x597d('0x2b')]['id']}},_0x106b92={};_0x106b92[_0x597d('0x2c')]=_['keys'](db[_0x597d('0x2d')][_0x597d('0x2e')]);_0x106b92['query']=_['keys'](_0x249e81[_0x597d('0x2f')]);_0x106b92[_0x597d('0x30')]=_['intersection'](_0x106b92[_0x597d('0x2c')],_0x106b92[_0x597d('0x2f')]);_0x2fcb0d[_0x597d('0x31')]=_['intersection'](_0x106b92[_0x597d('0x2c')],qs['fields'](_0x249e81[_0x597d('0x2f')]['fields']));_0x2fcb0d['attributes']=_0x2fcb0d['attributes']['length']?_0x2fcb0d['attributes']:_0x106b92[_0x597d('0x2c')];if(_0x249e81[_0x597d('0x2f')][_0x597d('0x32')]){_0x2fcb0d[_0x597d('0x33')]=[{'all':!![]}];}_0x2fcb0d=_[_0x597d('0x34')]({},_0x2fcb0d,_0x249e81[_0x597d('0x35')]);return db[_0x597d('0x2d')][_0x597d('0x36')](_0x2fcb0d)['then'](handleEntityNotFound(_0x25ffc6,null))[_0x597d('0x24')](respondWithResult(_0x25ffc6,null))[_0x597d('0x37')](handleError(_0x25ffc6,null));};exports[_0x597d('0x38')]=function(_0x2d56a1,_0x581541){return db[_0x597d('0x2d')][_0x597d('0x38')](_0x2d56a1[_0x597d('0x39')],{})[_0x597d('0x24')](respondWithResult(_0x581541,0xc9))[_0x597d('0x37')](handleError(_0x581541,null));};exports[_0x597d('0x23')]=function(_0x3807ca,_0x1cf849){if(_0x3807ca[_0x597d('0x39')]['id']){delete _0x3807ca[_0x597d('0x39')]['id'];}return db[_0x597d('0x2d')][_0x597d('0x36')]({'where':{'id':_0x3807ca[_0x597d('0x2b')]['id']}})[_0x597d('0x24')](handleEntityNotFound(_0x1cf849,null))[_0x597d('0x24')](saveUpdates(_0x3807ca[_0x597d('0x39')],null))[_0x597d('0x24')](respondWithResult(_0x1cf849,null))[_0x597d('0x37')](handleError(_0x1cf849,null));};exports[_0x597d('0x25')]=function(_0x13d8ba,_0x5b46cc){return db['ChatProactiveAction'][_0x597d('0x36')]({'where':{'id':_0x13d8ba['params']['id']}})[_0x597d('0x24')](handleEntityNotFound(_0x5b46cc,null))[_0x597d('0x24')](removeEntity(_0x5b46cc,null))['catch'](handleError(_0x5b46cc,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 0625de7..6922b7d 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 _0x1312=['path','../../config/environment','./chatProactiveAction.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1312,0x16d));var _0x2131=function(_0x99c2dd,_0x1d32eb){_0x99c2dd=_0x99c2dd-0x0;var _0x173349=_0x1312[_0x99c2dd];return _0x173349;};'use strict';var _=require(_0x2131('0x0'));var util=require(_0x2131('0x1'));var logger=require(_0x2131('0x2'))(_0x2131('0x3'));var moment=require(_0x2131('0x4'));var BPromise=require(_0x2131('0x5'));var rp=require(_0x2131('0x6'));var fs=require('fs');var path=require(_0x2131('0x7'));var rimraf=require('rimraf');var config=require(_0x2131('0x8'));var attributes=require(_0x2131('0x9'));module[_0x2131('0xa')]=function(_0x44a2ee,_0x4c412b){return _0x44a2ee[_0x2131('0xb')]('ChatProactiveAction',attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1216=['exports','define','ChatProactiveAction','lodash','api','moment','bluebird','path','../../config/environment'];(function(_0x89f002,_0x576460){var _0x3e6340=function(_0x1117f4){while(--_0x1117f4){_0x89f002['push'](_0x89f002['shift']());}};_0x3e6340(++_0x576460);}(_0x1216,0x1c5));var _0x6121=function(_0x243cca,_0x514c2d){_0x243cca=_0x243cca-0x0;var _0xf94771=_0x1216[_0x243cca];return _0xf94771;};'use strict';var _=require(_0x6121('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6121('0x1'));var moment=require(_0x6121('0x2'));var BPromise=require(_0x6121('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6121('0x4'));var rimraf=require('rimraf');var config=require(_0x6121('0x5'));var attributes=require('./chatProactiveAction.attributes');module[_0x6121('0x6')]=function(_0x48f5ab,_0x18c7bf){return _0x48f5ab[_0x6121('0x7')](_0x6121('0x8'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index ecf0f59..7e582ea 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 _0xfe11=['jayson/promise','client','request','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatProactiveAction,\x20%s,\x20%s','result','catch','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x583ae6,_0x13a7da){var _0x56c9b6=function(_0x2e12fc){while(--_0x2e12fc){_0x583ae6['push'](_0x583ae6['shift']());}};_0x56c9b6(++_0x13a7da);}(_0xfe11,0x103));var _0x1fe1=function(_0xc4966b,_0x6cd5e0){_0xc4966b=_0xc4966b-0x0;var _0x1802bb=_0xfe11[_0xc4966b];return _0x1802bb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1fe1('0x0'));var BPromise=require(_0x1fe1('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1fe1('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x1fe1('0x3'));var logger=require(_0x1fe1('0x4'))(_0x1fe1('0x5'));var config=require(_0x1fe1('0x6'));var jayson=require(_0x1fe1('0x7'));var client=jayson[_0x1fe1('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd00b24,_0x204aa7,_0x15aa12){return new BPromise(function(_0x102eb5,_0x4c76ff){return client[_0x1fe1('0x9')](_0xd00b24,_0x15aa12)['then'](function(_0x688254){logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x204aa7,_0x1fe1('0xa'));logger['debug'](_0x1fe1('0xb'),_0x204aa7,_0x1fe1('0xa'),JSON[_0x1fe1('0xc')](_0x688254));if(_0x688254[_0x1fe1('0xd')]){if(_0x688254['error'][_0x1fe1('0xe')]===0x1f4){logger[_0x1fe1('0xd')]('ChatProactiveAction,\x20%s,\x20%s',_0x204aa7,_0x688254[_0x1fe1('0xd')]['message']);return _0x4c76ff(_0x688254[_0x1fe1('0xd')][_0x1fe1('0xf')]);}logger['error'](_0x1fe1('0x10'),_0x204aa7,_0x688254[_0x1fe1('0xd')]['message']);return _0x102eb5(_0x688254[_0x1fe1('0xd')][_0x1fe1('0xf')]);}else{logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x204aa7,_0x1fe1('0xa'));_0x102eb5(_0x688254[_0x1fe1('0x11')]['message']);}})[_0x1fe1('0x12')](function(_0x559755){logger[_0x1fe1('0xd')]('ChatProactiveAction,\x20%s,\x20%s',_0x204aa7,_0x559755);_0x4c76ff(_0x559755);});});} \ No newline at end of file +var _0x3b42=['../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring'];(function(_0x43f631,_0x519107){var _0x241582=function(_0x3f3616){while(--_0x3f3616){_0x43f631['push'](_0x43f631['shift']());}};_0x241582(++_0x519107);}(_0x3b42,0x1a1));var _0x23b4=function(_0x1c2d05,_0x1b5545){_0x1c2d05=_0x1c2d05-0x0;var _0xcc38af=_0x3b42[_0x1c2d05];return _0xcc38af;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x23b4('0x0'));var BPromise=require(_0x23b4('0x1'));var rs=require(_0x23b4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x23b4('0x3'))['db'];var utils=require(_0x23b4('0x4'));var logger=require(_0x23b4('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x23b4('0x6'));var client=jayson[_0x23b4('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x15bf82,_0x4fe583,_0x466075){return new BPromise(function(_0xa6a581,_0x381530){return client['request'](_0x15bf82,_0x466075)[_0x23b4('0x8')](function(_0x1451dd){logger[_0x23b4('0x9')](_0x23b4('0xa'),_0x4fe583,_0x23b4('0xb'));logger[_0x23b4('0xc')](_0x23b4('0xd'),_0x4fe583,'request\x20sent',JSON[_0x23b4('0xe')](_0x1451dd));if(_0x1451dd[_0x23b4('0xf')]){if(_0x1451dd[_0x23b4('0xf')][_0x23b4('0x10')]===0x1f4){logger[_0x23b4('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x4fe583,_0x1451dd['error'][_0x23b4('0x11')]);return _0x381530(_0x1451dd[_0x23b4('0xf')]['message']);}logger[_0x23b4('0xf')](_0x23b4('0xa'),_0x4fe583,_0x1451dd[_0x23b4('0xf')][_0x23b4('0x11')]);return _0xa6a581(_0x1451dd['error']['message']);}else{logger[_0x23b4('0x9')](_0x23b4('0xa'),_0x4fe583,_0x23b4('0xb'));_0xa6a581(_0x1451dd[_0x23b4('0x12')][_0x23b4('0x11')]);}})[_0x23b4('0x13')](function(_0x5ea951){logger[_0x23b4('0xf')](_0x23b4('0xa'),_0x4fe583,_0x5ea951);_0x381530(_0x5ea951);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index e626cd5..be2f198 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 _0x8d0e=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','isAuthenticated','show','post','create','put','/:id','delete','multer','util','path','connect-timeout','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x32924e,_0x1c46bf){_0x32924e=_0x32924e-0x0;var _0xc7804a=_0x8d0e[_0x32924e];return _0xc7804a;};'use strict';var multer=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var path=require(_0xe8d0('0x2'));var timeout=require(_0xe8d0('0x3'));var express=require(_0xe8d0('0x4'));var router=express[_0xe8d0('0x5')]();var fs_extra=require(_0xe8d0('0x6'));var auth=require(_0xe8d0('0x7'));var interaction=require(_0xe8d0('0x8'));var config=require('../../config/environment');var controller=require(_0xe8d0('0x9'));router['get']('/:id',auth[_0xe8d0('0xa')](),controller[_0xe8d0('0xb')]);router[_0xe8d0('0xc')]('/',auth[_0xe8d0('0xa')](),controller[_0xe8d0('0xd')]);router[_0xe8d0('0xe')](_0xe8d0('0xf'),auth[_0xe8d0('0xa')](),controller['update']);router[_0xe8d0('0x10')](_0xe8d0('0xf'),auth[_0xe8d0('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xeda8=['get','/:id','isAuthenticated','show','create','put','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller'];(function(_0x4b8aa8,_0x44d6b8){var _0x1467fe=function(_0x440908){while(--_0x440908){_0x4b8aa8['push'](_0x4b8aa8['shift']());}};_0x1467fe(++_0x44d6b8);}(_0xeda8,0x104));var _0x8eda=function(_0x26631e,_0x52ea53){_0x26631e=_0x26631e-0x0;var _0x19dafd=_0xeda8[_0x26631e];return _0x19dafd;};'use strict';var multer=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var path=require('path');var timeout=require(_0x8eda('0x2'));var express=require(_0x8eda('0x3'));var router=express[_0x8eda('0x4')]();var fs_extra=require(_0x8eda('0x5'));var auth=require(_0x8eda('0x6'));var interaction=require(_0x8eda('0x7'));var config=require(_0x8eda('0x8'));var controller=require(_0x8eda('0x9'));router[_0x8eda('0xa')](_0x8eda('0xb'),auth[_0x8eda('0xc')](),controller[_0x8eda('0xd')]);router['post']('/',auth[_0x8eda('0xc')](),controller[_0x8eda('0xe')]);router[_0x8eda('0xf')](_0x8eda('0xb'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x8eda('0xc')](),controller[_0x8eda('0x10')]);module[_0x8eda('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 0809dbf..fd55b5e 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 _0xc60a=['STRING','INTEGER','rrmemory','beepall','exports','name'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0xc60a,0x17e));var _0xac60=function(_0x2c3d62,_0x533913){_0x2c3d62=_0x2c3d62-0x0;var _0x2bf4c1=_0xc60a[_0x2c3d62];return _0x2bf4c1;};'use strict';var Sequelize=require('sequelize');module[_0xac60('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xac60('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xac60('0x2')]},'timeout':{'type':Sequelize[_0xac60('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xac60('0x4'),_0xac60('0x5'),'roundrobin')}}; \ No newline at end of file +var _0xb767=['name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x5eef05,_0x1be989){var _0x56d4b8=function(_0x57993d){while(--_0x57993d){_0x5eef05['push'](_0x5eef05['shift']());}};_0x56d4b8(++_0x1be989);}(_0xb767,0x1bf));var _0x7b76=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xb767[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x7b76('0x0'));module[_0x7b76('0x1')]={'name':{'type':Sequelize[_0x7b76('0x2')],'unique':_0x7b76('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7b76('0x2')]},'timeout':{'type':Sequelize[_0x7b76('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7b76('0x5')](_0x7b76('0x6'),_0x7b76('0x7'),_0x7b76('0x8'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 955afa7..dbf581c 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 _0x17f1=['json','reject','update','ChatQueues','UserProfileResource','stack','name','send','index','map','ChatQueue','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filters','pick','where','merge','VIRTUAL','filter','show','params','includeAll','include','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','describe','getMembers','findOne','UserChatQueue','rawAttributes','order','ChatQueueId','options','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','Team','addTeams','findAll','Agents','online','sequelize','transaction','each','forEach','emit','userChatQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','union','compact','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range'];(function(_0x3d4c8b,_0x3e6ad6){var _0x1d1bc3=function(_0x155297){while(--_0x155297){_0x3d4c8b['push'](_0x3d4c8b['shift']());}};_0x1d1bc3(++_0x3e6ad6);}(_0x17f1,0x19d));var _0x117f=function(_0x4a92f9,_0x32b570){_0x4a92f9=_0x4a92f9-0x0;var _0x3c6448=_0x17f1[_0x4a92f9];return _0x3c6448;};'use strict';var emlformat=require(_0x117f('0x0'));var rimraf=require(_0x117f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x117f('0x2'));var moment=require(_0x117f('0x3'));var BPromise=require(_0x117f('0x4'));var Mustache=require(_0x117f('0x5'));var util=require(_0x117f('0x6'));var path=require('path');var sox=require(_0x117f('0x7'));var csv=require(_0x117f('0x8'));var ejs=require(_0x117f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x117f('0xa'));var squel=require(_0x117f('0xb'));var crypto=require(_0x117f('0xc'));var jsforce=require(_0x117f('0xd'));var deskjs=require(_0x117f('0xe'));var toCsv=require(_0x117f('0x8'));var querystring=require(_0x117f('0xf'));var Papa=require(_0x117f('0x10'));var Redis=require(_0x117f('0x11'));var authService=require(_0x117f('0x12'));var qs=require(_0x117f('0x13'));var as=require(_0x117f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x117f('0x15'))(_0x117f('0x16'));var utils=require(_0x117f('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x117f('0x18'));var db=require(_0x117f('0x19'))['db'];config[_0x117f('0x1a')]=_[_0x117f('0x1b')](config[_0x117f('0x1a')],{'host':_0x117f('0x1c'),'port':0x18eb});var socket=require(_0x117f('0x1d'))(new Redis(config[_0x117f('0x1a')]));require(_0x117f('0x1e'))[_0x117f('0x1f')](socket);var jayson=require(_0x117f('0x20'));var client=jayson[_0x117f('0x21')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2734bd,_0x593c32,_0x319c83,_0x58099e){return new BPromise(function(_0xc538f5,_0x5cbb15){var _0x340097=_0x58099e||client;return _0x340097[_0x117f('0x22')](_0x2734bd,_0x319c83)[_0x117f('0x23')](function(_0x29c886){logger[_0x117f('0x24')](_0x117f('0x25'),_0x593c32,_0x117f('0x26'));logger[_0x117f('0x27')](_0x117f('0x28'),_0x593c32,_0x117f('0x26'),JSON[_0x117f('0x29')](_0x29c886));if(_0x29c886[_0x117f('0x2a')]){if(_0x29c886['error'][_0x117f('0x2b')]===0x1f4){logger[_0x117f('0x2a')](_0x117f('0x25'),_0x593c32,_0x29c886[_0x117f('0x2a')]['message']);return _0x5cbb15(_0x29c886[_0x117f('0x2a')][_0x117f('0x2c')]);}logger[_0x117f('0x2a')](_0x117f('0x25'),_0x593c32,_0x29c886[_0x117f('0x2a')][_0x117f('0x2c')]);return _0xc538f5(_0x29c886['error'][_0x117f('0x2c')]);}else{logger[_0x117f('0x24')](_0x117f('0x25'),_0x593c32,_0x117f('0x26'));_0xc538f5(_0x29c886[_0x117f('0x2d')][_0x117f('0x2c')]);}})['catch'](function(_0x3ed598){logger[_0x117f('0x2a')]('ChatQueue,\x20%s,\x20%s',_0x593c32,_0x3ed598);_0x5cbb15(_0x3ed598);});});}function respondWithStatusCode(_0x4a11cd,_0x4e2fb5){_0x4e2fb5=_0x4e2fb5||0xcc;return function(_0x553166){if(_0x553166){return _0x4a11cd[_0x117f('0x2e')](_0x4e2fb5);}return _0x4a11cd[_0x117f('0x2f')](_0x4e2fb5)[_0x117f('0x30')]();};}function respondWithResult(_0x4ca19d,_0x2b5005){_0x2b5005=_0x2b5005||0xc8;return function(_0x52a7a8){if(_0x52a7a8){return _0x4ca19d[_0x117f('0x2f')](_0x2b5005)['json'](_0x52a7a8);}};}function respondWithFilteredResult(_0x3506fd,_0x4f4510){return function(_0x390587){if(_0x390587){var _0xcd3d15=typeof _0x4f4510[_0x117f('0x31')]===_0x117f('0x32')&&typeof _0x4f4510[_0x117f('0x33')]===_0x117f('0x32');var _0x5aaac6=_0x390587['count'];var _0x2ed25d=_0xcd3d15?0x0:_0x4f4510[_0x117f('0x31')];var _0x1f40b7=_0xcd3d15?_0x390587[_0x117f('0x34')]:_0x4f4510['offset']+_0x4f4510[_0x117f('0x33')];var _0x5382ee;if(_0x1f40b7>=_0x5aaac6){_0x1f40b7=_0x5aaac6;_0x5382ee=0xc8;}else{_0x5382ee=0xce;}_0x3506fd[_0x117f('0x2f')](_0x5382ee);return _0x3506fd[_0x117f('0x35')](_0x117f('0x36'),_0x2ed25d+'-'+_0x1f40b7+'/'+_0x5aaac6)[_0x117f('0x37')](_0x390587);}return null;};}function patchUpdates(_0xc84ff8){return function(_0x15beba){try{jsonpatch['apply'](_0x15beba,_0xc84ff8,!![]);}catch(_0x12b7c8){return BPromise[_0x117f('0x38')](_0x12b7c8);}return _0x15beba['save']();};}function saveUpdates(_0x293d1b,_0x8b7098){return function(_0x40751e){if(_0x40751e){return _0x40751e[_0x117f('0x39')](_0x293d1b)[_0x117f('0x23')](function(_0x380eee){return _0x380eee;});}return null;};}function removeEntity(_0x20328a,_0x266c9b){return function(_0x5d605f){if(_0x5d605f){return _0x5d605f['destroy']()[_0x117f('0x23')](function(){var _0x19427c=_0x5d605f['get']({'plain':!![]});var _0x2bd910=_0x117f('0x3a');return db[_0x117f('0x3b')]['destroy']({'where':{'type':_0x2bd910,'resourceId':_0x19427c['id']}})['then'](function(){return _0x5d605f;});})[_0x117f('0x23')](function(){_0x20328a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f9ae1,_0x4cb399){return function(_0x3a6238){if(!_0x3a6238){_0x4f9ae1[_0x117f('0x2e')](0x194);}return _0x3a6238;};}function handleError(_0x1e793f,_0x2b104b){_0x2b104b=_0x2b104b||0x1f4;return function(_0x2bf468){logger[_0x117f('0x2a')](_0x2bf468[_0x117f('0x3c')]);if(_0x2bf468[_0x117f('0x3d')]){delete _0x2bf468[_0x117f('0x3d')];}_0x1e793f[_0x117f('0x2f')](_0x2b104b)[_0x117f('0x3e')](_0x2bf468);};}exports[_0x117f('0x3f')]=function(_0x4ff5af,_0x514cad){var _0x2026c4={},_0x406242={},_0x30cf71={'count':0x0,'rows':[]};var _0x56968a=_[_0x117f('0x40')](db[_0x117f('0x41')]['rawAttributes'],function(_0x54f5d2){return{'name':_0x54f5d2['fieldName'],'type':_0x54f5d2[_0x117f('0x42')][_0x117f('0x43')]};});_0x406242[_0x117f('0x44')]=_[_0x117f('0x40')](_0x56968a,'name');_0x406242[_0x117f('0x45')]=_[_0x117f('0x46')](_0x4ff5af['query']);_0x406242['filters']=_[_0x117f('0x47')](_0x406242[_0x117f('0x44')],_0x406242[_0x117f('0x45')]);_0x2026c4['attributes']=_[_0x117f('0x47')](_0x406242['model'],qs[_0x117f('0x48')](_0x4ff5af[_0x117f('0x45')][_0x117f('0x48')]));_0x2026c4[_0x117f('0x49')]=_0x2026c4[_0x117f('0x49')][_0x117f('0x4a')]?_0x2026c4['attributes']:_0x406242['model'];if(!_0x4ff5af[_0x117f('0x45')][_0x117f('0x4b')](_0x117f('0x4c'))){_0x2026c4[_0x117f('0x33')]=qs[_0x117f('0x33')](_0x4ff5af[_0x117f('0x45')][_0x117f('0x33')]);_0x2026c4['offset']=qs[_0x117f('0x31')](_0x4ff5af[_0x117f('0x45')]['offset']);}_0x2026c4['order']=qs[_0x117f('0x4d')](_0x4ff5af[_0x117f('0x45')][_0x117f('0x4d')]);_0x2026c4['where']=qs[_0x117f('0x4e')](_[_0x117f('0x4f')](_0x4ff5af[_0x117f('0x45')],_0x406242[_0x117f('0x4e')]),_0x56968a);if(_0x4ff5af[_0x117f('0x45')]['filter']){_0x2026c4[_0x117f('0x50')]=_[_0x117f('0x51')](_0x2026c4['where'],{'$or':_[_0x117f('0x40')](_0x56968a,function(_0x32d16e){if(_0x32d16e[_0x117f('0x42')]!==_0x117f('0x52')){var _0x325736={};_0x325736[_0x32d16e['name']]={'$like':'%'+_0x4ff5af[_0x117f('0x45')][_0x117f('0x53')]+'%'};return _0x325736;}})});}_0x2026c4=_[_0x117f('0x51')]({},_0x2026c4,_0x4ff5af['options']);var _0x330efe={'where':_0x2026c4[_0x117f('0x50')]};return db[_0x117f('0x41')][_0x117f('0x34')](_0x330efe)[_0x117f('0x23')](function(_0x3f7493){_0x30cf71[_0x117f('0x34')]=_0x3f7493;if(_0x4ff5af[_0x117f('0x45')]['includeAll']){_0x2026c4['include']=[{'all':!![]}];}return db['ChatQueue']['findAll'](_0x2026c4);})[_0x117f('0x23')](function(_0x209aab){_0x30cf71['rows']=_0x209aab;return _0x30cf71;})[_0x117f('0x23')](respondWithFilteredResult(_0x514cad,_0x2026c4))['catch'](handleError(_0x514cad,null));};exports[_0x117f('0x54')]=function(_0x13dda9,_0x54e38f){var _0xe5334e={'raw':!![],'where':{'id':_0x13dda9[_0x117f('0x55')]['id']}},_0x2e2f60={};_0x2e2f60['model']=_[_0x117f('0x46')](db[_0x117f('0x41')]['rawAttributes']);_0x2e2f60[_0x117f('0x45')]=_[_0x117f('0x46')](_0x13dda9['query']);_0x2e2f60['filters']=_[_0x117f('0x47')](_0x2e2f60[_0x117f('0x44')],_0x2e2f60['query']);_0xe5334e[_0x117f('0x49')]=_['intersection'](_0x2e2f60[_0x117f('0x44')],qs['fields'](_0x13dda9[_0x117f('0x45')][_0x117f('0x48')]));_0xe5334e[_0x117f('0x49')]=_0xe5334e[_0x117f('0x49')]['length']?_0xe5334e[_0x117f('0x49')]:_0x2e2f60['model'];if(_0x13dda9[_0x117f('0x45')][_0x117f('0x56')]){_0xe5334e[_0x117f('0x57')]=[{'all':!![]}];}_0xe5334e=_[_0x117f('0x51')]({},_0xe5334e,_0x13dda9['options']);return db[_0x117f('0x41')]['find'](_0xe5334e)[_0x117f('0x23')](handleEntityNotFound(_0x54e38f,null))[_0x117f('0x23')](respondWithResult(_0x54e38f,null))[_0x117f('0x58')](handleError(_0x54e38f,null));};exports[_0x117f('0x59')]=function(_0x549a1e,_0x4fef2b){return db[_0x117f('0x41')][_0x117f('0x59')](_0x549a1e['body'],{})[_0x117f('0x23')](function(_0xf6f268){var _0x109809=_0x549a1e[_0x117f('0x5a')][_0x117f('0x5b')]({'plain':!![]});if(!_0x109809)throw new Error(_0x117f('0x5c'));if(_0x109809['role']===_0x117f('0x5a')){var _0x11d246=_0xf6f268[_0x117f('0x5b')]({'plain':!![]});var _0x225db0=_0x117f('0x3a');return db[_0x117f('0x5d')][_0x117f('0x5e')]({'where':{'name':_0x225db0,'userProfileId':_0x109809['userProfileId']},'raw':!![]})['then'](function(_0x56da6d){if(_0x56da6d&&_0x56da6d['autoAssociation']===0x0){return db[_0x117f('0x3b')][_0x117f('0x59')]({'name':_0x11d246['name'],'resourceId':_0x11d246['id'],'type':_0x56da6d[_0x117f('0x3d')],'sectionId':_0x56da6d['id']},{})[_0x117f('0x23')](function(){return _0xf6f268;});}else{return _0xf6f268;}})[_0x117f('0x58')](function(_0x2378d5){logger[_0x117f('0x2a')](_0x117f('0x5f'),_0x2378d5);throw _0x2378d5;});}return _0xf6f268;})['then'](respondWithResult(_0x4fef2b,0xc9))[_0x117f('0x58')](handleError(_0x4fef2b,null));};exports[_0x117f('0x39')]=function(_0x2017ed,_0x3917bc){if(_0x2017ed[_0x117f('0x60')]['id']){delete _0x2017ed[_0x117f('0x60')]['id'];}return db[_0x117f('0x41')][_0x117f('0x5e')]({'where':{'id':_0x2017ed['params']['id']}})['then'](handleEntityNotFound(_0x3917bc,null))[_0x117f('0x23')](saveUpdates(_0x2017ed['body'],null))[_0x117f('0x23')](respondWithResult(_0x3917bc,null))[_0x117f('0x58')](handleError(_0x3917bc,null));};exports[_0x117f('0x61')]=function(_0x2c21c1,_0xfec564){return db[_0x117f('0x41')][_0x117f('0x5e')]({'where':{'id':_0x2c21c1[_0x117f('0x55')]['id']}})[_0x117f('0x23')](handleEntityNotFound(_0xfec564,null))['then'](removeEntity(_0xfec564,null))[_0x117f('0x58')](handleError(_0xfec564,null));};exports[_0x117f('0x62')]=function(_0xe83a54,_0xb32ab6){return db['ChatQueue'][_0x117f('0x62')]()[_0x117f('0x23')](respondWithResult(_0xb32ab6,null))[_0x117f('0x58')](handleError(_0xb32ab6,null));};exports[_0x117f('0x63')]=function(_0x359fd0,_0x2e9895,_0x1b86f6){var _0x13c8a9={'raw':!![],'where':{}},_0x6dc3ca={},_0x57c663;return db[_0x117f('0x41')][_0x117f('0x64')]({'where':{'id':_0x359fd0[_0x117f('0x55')]['id']}})[_0x117f('0x23')](handleEntityNotFound(_0x2e9895,null))[_0x117f('0x23')](function(_0x1bcf0c){if(_0x1bcf0c){_0x57c663=_0x1bcf0c[_0x117f('0x5b')]({'plain':!![]});_0x6dc3ca['model']=_['keys'](db[_0x117f('0x65')][_0x117f('0x66')]);_0x6dc3ca['query']=_[_0x117f('0x46')](_0x359fd0[_0x117f('0x45')]);_0x6dc3ca[_0x117f('0x4e')]=_[_0x117f('0x47')](_0x6dc3ca[_0x117f('0x44')],_0x6dc3ca[_0x117f('0x45')]);_0x13c8a9[_0x117f('0x49')]=_['intersection'](_0x6dc3ca[_0x117f('0x44')],qs[_0x117f('0x48')](_0x359fd0[_0x117f('0x45')][_0x117f('0x48')]));_0x13c8a9[_0x117f('0x49')]=_0x13c8a9['attributes']['length']?_0x13c8a9['attributes']:_0x6dc3ca[_0x117f('0x44')];if(!_0x359fd0[_0x117f('0x45')][_0x117f('0x4b')](_0x117f('0x4c'))){_0x13c8a9[_0x117f('0x33')]=qs['limit'](_0x359fd0[_0x117f('0x45')][_0x117f('0x33')]);_0x13c8a9[_0x117f('0x31')]=qs[_0x117f('0x31')](_0x359fd0[_0x117f('0x45')][_0x117f('0x31')]);}_0x13c8a9[_0x117f('0x67')]=qs[_0x117f('0x4d')](_0x359fd0[_0x117f('0x45')][_0x117f('0x4d')]);_0x13c8a9['where']=qs[_0x117f('0x4e')](_[_0x117f('0x4f')](_0x359fd0[_0x117f('0x45')],_0x6dc3ca[_0x117f('0x4e')]));_0x13c8a9[_0x117f('0x50')][_0x117f('0x68')]=_0x1bcf0c['id'];if(_0x359fd0[_0x117f('0x45')][_0x117f('0x53')]){_0x13c8a9[_0x117f('0x50')]=_[_0x117f('0x51')](_0x13c8a9['where'],{'$or':_[_0x117f('0x40')](_0x13c8a9[_0x117f('0x49')],function(_0x3d0cbf){var _0x3e96d7={};_0x3e96d7[_0x3d0cbf]={'$like':'%'+_0x359fd0['query'][_0x117f('0x53')]+'%'};return _0x3e96d7;})});}_0x13c8a9=_[_0x117f('0x51')]({},_0x13c8a9,_0x359fd0[_0x117f('0x69')]);return db['UserChatQueue']['findAll'](_0x13c8a9);}})[_0x117f('0x23')](function(_0x194e05){if(_0x194e05){return db[_0x117f('0x6a')][_0x117f('0x6b')]({'where':{'id':_[_0x117f('0x40')](_0x194e05,_0x117f('0x6c')),'role':_0x117f('0x6d')},'attributes':['id','name',_0x117f('0x6e'),_0x117f('0x6f'),_0x117f('0x70')]});}})[_0x117f('0x23')](function(_0x3d45df){if(_0x3d45df){return{'count':_0x3d45df[_0x117f('0x34')],'rows':_[_0x117f('0x40')](_0x3d45df[_0x117f('0x71')],function(_0x4eae74){return{'membername':_0x4eae74['name'],'UserId':_0x4eae74['id'],'queue_name':_0x57c663[_0x117f('0x3d')],'ChatQueueId':_0x57c663['id'],'interface':util[_0x117f('0x72')](_0x117f('0x73'),_0x117f('0x74'),_0x4eae74[_0x117f('0x3d')]),'penalty':0x0,'paused':_0x4eae74[_0x117f('0x6e')],'createdAt':_0x4eae74['createdAt'],'updatedAt':_0x4eae74[_0x117f('0x6f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x117f('0x23')](respondWithFilteredResult(_0x2e9895,_0x13c8a9))[_0x117f('0x58')](handleError(_0x2e9895,null));};exports[_0x117f('0x75')]=function(_0x1a19a6,_0xa27a4f,_0x20ebd0){var _0x4584ae={};var _0x5ac082={};var _0x5a2fa9;var _0x29f1d8;return db[_0x117f('0x41')]['findOne']({'where':{'id':_0x1a19a6[_0x117f('0x55')]['id']}})[_0x117f('0x23')](handleEntityNotFound(_0xa27a4f,null))['then'](function(_0x5e73ca){if(_0x5e73ca){_0x5a2fa9=_0x5e73ca;_0x5ac082[_0x117f('0x44')]=_['keys'](db[_0x117f('0x76')][_0x117f('0x66')]);_0x5ac082[_0x117f('0x45')]=_[_0x117f('0x46')](_0x1a19a6['query']);_0x5ac082[_0x117f('0x4e')]=_['intersection'](_0x5ac082['model'],_0x5ac082[_0x117f('0x45')]);_0x4584ae[_0x117f('0x49')]=_[_0x117f('0x47')](_0x5ac082[_0x117f('0x44')],qs[_0x117f('0x48')](_0x1a19a6['query']['fields']));_0x4584ae[_0x117f('0x49')]=_0x4584ae[_0x117f('0x49')][_0x117f('0x4a')]?_0x4584ae[_0x117f('0x49')]:_0x5ac082[_0x117f('0x44')];_0x4584ae[_0x117f('0x67')]=qs[_0x117f('0x4d')](_0x1a19a6[_0x117f('0x45')][_0x117f('0x4d')]);_0x4584ae[_0x117f('0x50')]=qs['filters'](_['pick'](_0x1a19a6['query'],_0x5ac082['filters']));if(_0x1a19a6[_0x117f('0x45')]['filter']){_0x4584ae[_0x117f('0x50')]=_[_0x117f('0x51')](_0x4584ae[_0x117f('0x50')],{'$or':_[_0x117f('0x40')](_0x4584ae[_0x117f('0x49')],function(_0x1568ad){var _0x359751={};_0x359751[_0x1568ad]={'$like':'%'+_0x1a19a6['query'][_0x117f('0x53')]+'%'};return _0x359751;})});}_0x4584ae=_[_0x117f('0x51')]({},_0x4584ae,_0x1a19a6[_0x117f('0x69')]);return _0x5a2fa9['getTeams'](_0x4584ae);}})[_0x117f('0x23')](function(_0x38d955){if(_0x38d955){_0x29f1d8=_0x38d955[_0x117f('0x4a')];if(!_0x1a19a6['query'][_0x117f('0x4b')](_0x117f('0x4c'))){_0x4584ae['limit']=qs[_0x117f('0x33')](_0x1a19a6[_0x117f('0x45')][_0x117f('0x33')]);_0x4584ae[_0x117f('0x31')]=qs[_0x117f('0x31')](_0x1a19a6[_0x117f('0x45')]['offset']);}return _0x5a2fa9[_0x117f('0x75')](_0x4584ae);}})[_0x117f('0x23')](function(_0x2ce91b){if(_0x2ce91b){return _0x2ce91b?{'count':_0x29f1d8,'rows':_0x2ce91b}:null;}})['then'](respondWithResult(_0xa27a4f,null))[_0x117f('0x58')](handleError(_0xa27a4f,null));};exports[_0x117f('0x77')]=function(_0x2ae6d3,_0x5e019a,_0x463d20){var _0x215e26=_0x2ae6d3[_0x117f('0x60')]['ids'];return db[_0x117f('0x76')][_0x117f('0x78')]({'where':{'id':_0x215e26},'attributes':['id'],'include':[{'model':db[_0x117f('0x6a')],'as':_0x117f('0x79'),'attributes':['id','name',_0x117f('0x7a'),'voicePause','interface'],'raw':!![]}]})[_0x117f('0x23')](function(_0x3cf8e0){if(_0x3cf8e0){var _0x2f3177=_['flatMap'](_0x3cf8e0,function(_0x1d2cf1){var _0x12279b=_0x1d2cf1[_0x117f('0x5b')]({'plain':!![]});return _0x12279b[_0x117f('0x79')];});return db[_0x117f('0x41')]['find']({'where':{'id':_0x2ae6d3[_0x117f('0x55')]['id']}})[_0x117f('0x23')](function(_0x1092b1){return db[_0x117f('0x7b')][_0x117f('0x7c')](function(_0x8b8709){return _0x1092b1[_0x117f('0x77')](_0x215e26,{'transaction':_0x8b8709})[_0x117f('0x23')](function(){return BPromise[_0x117f('0x7d')](_0x2f3177,function(_0xde679e){return db[_0x117f('0x65')]['findOrCreate']({'where':{'UserId':_0xde679e['id'],'ChatQueueId':_0x2ae6d3['params']['id']},'transaction':_0x8b8709});});})[_0x117f('0x23')](function(){_0x2f3177[_0x117f('0x7e')](function(_0x2a915e){socket[_0x117f('0x7f')](_0x117f('0x80'),{'UserId':_0x2a915e['id'],'ChatQueueId':_0x1092b1['id']});});});});});}})['then'](respondWithStatusCode(_0x5e019a,null))['catch'](handleError(_0x5e019a,null));};exports[_0x117f('0x81')]=function(_0x17d18d,_0x3d4efd,_0xa06151){return db['Team'][_0x117f('0x78')]({'where':{'id':_0x17d18d[_0x117f('0x45')][_0x117f('0x82')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x117f('0x79'),'attributes':['id'],'raw':!![]}]})[_0x117f('0x23')](handleEntityNotFound(_0x3d4efd,null))['then'](function(_0x5a8ae3){var _0x3dfe2f=_['map'](_0x5a8ae3,'id');var _0x15e0a0=[];var _0x4e951d=[];var _0x1e494a=squel[_0x117f('0x83')]();_0x1e494a[_0x117f('0x84')](_0x117f('0x85'))[_0x117f('0x86')](_0x117f('0x87'),'tq')[_0x117f('0x88')](_0x117f('0x89'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x117f('0x50')]('ChatQueueId\x20=\x20?',_0x17d18d['params']['id']);for(var _0x527e77=0x0;_0x527e77<_0x5a8ae3[_0x117f('0x4a')];_0x527e77+=0x1){let _0x372b29=_0x5a8ae3[_0x527e77];for(var _0x432482=0x0;_0x432482<_0x372b29[_0x117f('0x79')][_0x117f('0x4a')];_0x432482+=0x1){let _0x5e9a6f=_0x372b29[_0x117f('0x79')][_0x432482];var _0x24acdb=_0x1e494a['clone']();_0x24acdb[_0x117f('0x50')](_0x117f('0x8a'),_0x5e9a6f['id']);_0x4e951d[_0x117f('0x8b')](db['sequelize'][_0x117f('0x45')](_0x24acdb[_0x117f('0x8c')](),{'type':db[_0x117f('0x7b')]['QueryTypes'][_0x117f('0x8d')]})['then'](function(_0x8b4320){if(_0x8b4320[_0x117f('0x4a')]===0x1){return _0x5e9a6f['id'];}else{var _0x277b36=_[_0x117f('0x8e')](_['map'](_0x8b4320,_0x117f('0x8f')),function(_0x909208){return _[_0x117f('0x90')](_0x3dfe2f,_0x909208);});if(_0x277b36){return _0x5e9a6f['id'];}}}));}}return BPromise['all'](_0x4e951d)[_0x117f('0x23')](function(_0x2b1fcf){_0x15e0a0=_(_0x15e0a0)[_0x117f('0x91')](_0x2b1fcf)[_0x117f('0x92')]()[_0x117f('0x93')]();return db[_0x117f('0x41')][_0x117f('0x5e')]({'where':{'id':_0x17d18d[_0x117f('0x55')]['id']}})[_0x117f('0x23')](function(_0x18d8f0){return db[_0x117f('0x7b')][_0x117f('0x7c')](function(_0x5a7c60){return _0x18d8f0['removeTeams'](_0x17d18d[_0x117f('0x45')]['ids'],{'transaction':_0x5a7c60})[_0x117f('0x23')](function(){if(!_[_0x117f('0x94')](_0x15e0a0)){return _0x18d8f0[_0x117f('0x95')](_0x15e0a0,{'transaction':_0x5a7c60});}})['then'](function(){_0x15e0a0[_0x117f('0x7e')](function(_0x5fdbcb){socket[_0x117f('0x7f')](_0x117f('0x96'),{'UserId':_0x5fdbcb,'ChatQueueId':_0x18d8f0['id']});});});});});});})[_0x117f('0x23')](respondWithStatusCode(_0x3d4efd,null))[_0x117f('0x58')](handleError(_0x3d4efd,null));};exports[_0x117f('0x97')]=function(_0x3a4150,_0x18e11b,_0x284157){return db[_0x117f('0x41')][_0x117f('0x5e')]({'where':{'id':_0x3a4150[_0x117f('0x55')]['id']}})[_0x117f('0x23')](handleEntityNotFound(_0x18e11b,null))[_0x117f('0x23')](function(_0x33cac6){if(_0x33cac6){return _0x33cac6[_0x117f('0x97')](_0x3a4150['body'][_0x117f('0x82')],_[_0x117f('0x98')](_0x3a4150[_0x117f('0x60')],[_0x117f('0x82'),'id'])||{})[_0x117f('0x99')](function(_0x2948c9){for(var _0x56a19b=0x0;_0x56a19b<_0x3a4150[_0x117f('0x60')][_0x117f('0x82')]['length'];_0x56a19b+=0x1){socket['emit'](_0x117f('0x80'),{'UserId':Number(_0x3a4150[_0x117f('0x60')]['ids'][_0x56a19b]),'ChatQueueId':Number(_0x3a4150['params']['id'])});}return _0x2948c9;});}})[_0x117f('0x23')](respondWithResult(_0x18e11b,null))[_0x117f('0x58')](handleError(_0x18e11b,null));};exports['removeAgents']=function(_0x2217c5,_0x27de13,_0x16ad55){return db['ChatQueue'][_0x117f('0x5e')]({'where':{'id':_0x2217c5[_0x117f('0x55')]['id']}})[_0x117f('0x23')](handleEntityNotFound(_0x27de13,null))[_0x117f('0x23')](function(_0x47c8ed){if(_0x47c8ed){return _0x47c8ed[_0x117f('0x95')](_0x2217c5[_0x117f('0x45')][_0x117f('0x82')])[_0x117f('0x23')](function(){if(_[_0x117f('0x9a')](_0x2217c5[_0x117f('0x45')][_0x117f('0x82')])){for(var _0x5affe1=0x0;_0x5affe1<_0x2217c5[_0x117f('0x45')][_0x117f('0x82')]['length'];_0x5affe1+=0x1){socket[_0x117f('0x7f')](_0x117f('0x96'),{'UserId':Number(_0x2217c5['query'][_0x117f('0x82')][_0x5affe1]),'ChatQueueId':Number(_0x2217c5[_0x117f('0x55')]['id'])});}}else{socket['emit'](_0x117f('0x96'),{'UserId':Number(_0x2217c5[_0x117f('0x45')][_0x117f('0x82')]),'ChatQueueId':Number(_0x2217c5['params']['id'])});}});}})[_0x117f('0x23')](respondWithStatusCode(_0x27de13,null))['catch'](handleError(_0x27de13,null));};exports['getAgents']=function(_0x354162,_0x2afef0,_0x4cd5ac){var _0x4d63e3={};var _0x464714={};var _0x278a53;var _0x547c5a;return db[_0x117f('0x41')][_0x117f('0x64')]({'where':{'id':_0x354162['params']['id']}})[_0x117f('0x23')](handleEntityNotFound(_0x2afef0,null))[_0x117f('0x23')](function(_0x339dd8){if(_0x339dd8){_0x278a53=_0x339dd8;_0x464714['model']=_[_0x117f('0x46')](db['User']['rawAttributes']);_0x464714[_0x117f('0x45')]=_[_0x117f('0x46')](_0x354162[_0x117f('0x45')]);_0x464714[_0x117f('0x4e')]=_[_0x117f('0x47')](_0x464714[_0x117f('0x44')],_0x464714[_0x117f('0x45')]);_0x4d63e3['attributes']=_[_0x117f('0x47')](_0x464714[_0x117f('0x44')],qs[_0x117f('0x48')](_0x354162['query']['fields']));_0x4d63e3[_0x117f('0x49')]=_0x4d63e3[_0x117f('0x49')][_0x117f('0x4a')]?_0x4d63e3[_0x117f('0x49')]:_0x464714[_0x117f('0x44')];_0x4d63e3['order']=qs[_0x117f('0x4d')](_0x354162[_0x117f('0x45')][_0x117f('0x4d')]);_0x4d63e3['where']=qs[_0x117f('0x4e')](_[_0x117f('0x4f')](_0x354162['query'],_0x464714[_0x117f('0x4e')]));if(_0x354162[_0x117f('0x45')][_0x117f('0x53')]){_0x4d63e3[_0x117f('0x50')]=_[_0x117f('0x51')](_0x4d63e3[_0x117f('0x50')],{'$or':_['map'](_0x4d63e3[_0x117f('0x49')],function(_0x442e35){var _0xb67838={};_0xb67838[_0x442e35]={'$like':'%'+_0x354162[_0x117f('0x45')][_0x117f('0x53')]+'%'};return _0xb67838;})});}_0x4d63e3=_[_0x117f('0x51')]({},_0x4d63e3,_0x354162[_0x117f('0x69')]);return _0x278a53[_0x117f('0x9b')](_0x4d63e3);}})[_0x117f('0x23')](function(_0x228e96){if(_0x228e96){_0x547c5a=_0x228e96[_0x117f('0x4a')];if(!_0x354162[_0x117f('0x45')][_0x117f('0x4b')](_0x117f('0x4c'))){_0x4d63e3[_0x117f('0x33')]=qs[_0x117f('0x33')](_0x354162[_0x117f('0x45')][_0x117f('0x33')]);_0x4d63e3['offset']=qs[_0x117f('0x31')](_0x354162[_0x117f('0x45')][_0x117f('0x31')]);}return _0x278a53[_0x117f('0x9b')](_0x4d63e3);}})[_0x117f('0x23')](function(_0x311970){if(_0x311970){return _0x311970?{'count':_0x547c5a,'rows':_0x311970}:null;}})[_0x117f('0x23')](respondWithResult(_0x2afef0,null))[_0x117f('0x58')](handleError(_0x2afef0,null));}; \ No newline at end of file +var _0x4adb=['end','json','undefined','count','offset','limit','set','Content-Range','reject','save','update','destroy','ChatQueues','UserProfileResource','stack','name','send','index','fieldName','type','key','map','query','keys','intersection','model','fields','attributes','length','nolimit','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','ChatQueue','rows','show','params','rawAttributes','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','describe','getMembers','findOne','UserChatQueue','hasOwnProperty','order','pick','findAll','User','agent','updatedAt','createdAt','format','%s/%s','SIP','chatPause','getTeams','Team','addTeams','ids','Agents','voicePause','transaction','each','findOrCreate','forEach','userChatQueue:save','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','value','sequelize','isEmpty','emit','userChatQueue:remove','addAgents','omit','spread','removeAgents','getAgents','eml-format','zip-dir','request-promise','moment','mustache','util','sox','ejs','lodash','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','http','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status'];(function(_0x124298,_0x542004){var _0x35ac24=function(_0x49afe8){while(--_0x49afe8){_0x124298['push'](_0x124298['shift']());}};_0x35ac24(++_0x542004);}(_0x4adb,0x105));var _0xb4ad=function(_0x4f44b1,_0x3598cc){_0x4f44b1=_0x4f44b1-0x0;var _0x38ba9e=_0x4adb[_0x4f44b1];return _0x38ba9e;};'use strict';var emlformat=require(_0xb4ad('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb4ad('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb4ad('0x2'));var moment=require(_0xb4ad('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb4ad('0x4'));var util=require(_0xb4ad('0x5'));var path=require('path');var sox=require(_0xb4ad('0x6'));var csv=require('to-csv');var ejs=require(_0xb4ad('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb4ad('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb4ad('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xb4ad('0xa'));var querystring=require(_0xb4ad('0xb'));var Papa=require('papaparse');var Redis=require(_0xb4ad('0xc'));var authService=require(_0xb4ad('0xd'));var qs=require(_0xb4ad('0xe'));var as=require(_0xb4ad('0xf'));var hardwareService=require(_0xb4ad('0x10'));var logger=require(_0xb4ad('0x11'))(_0xb4ad('0x12'));var utils=require(_0xb4ad('0x13'));var config=require(_0xb4ad('0x14'));var licenseUtil=require(_0xb4ad('0x15'));var db=require(_0xb4ad('0x16'))['db'];config[_0xb4ad('0x17')]=_[_0xb4ad('0x18')](config[_0xb4ad('0x17')],{'host':_0xb4ad('0x19'),'port':0x18eb});var socket=require(_0xb4ad('0x1a'))(new Redis(config[_0xb4ad('0x17')]));require(_0xb4ad('0x1b'))[_0xb4ad('0x1c')](socket);var jayson=require(_0xb4ad('0x1d'));var client=jayson[_0xb4ad('0x1e')][_0xb4ad('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x2400f,_0x3f89f7,_0x1ae24e,_0x278451){return new BPromise(function(_0x2f7824,_0x31f6d3){var _0x2a22a0=_0x278451||client;return _0x2a22a0[_0xb4ad('0x20')](_0x2400f,_0x1ae24e)[_0xb4ad('0x21')](function(_0x1de2cb){logger[_0xb4ad('0x22')](_0xb4ad('0x23'),_0x3f89f7,_0xb4ad('0x24'));logger['debug'](_0xb4ad('0x25'),_0x3f89f7,'request\x20sent',JSON['stringify'](_0x1de2cb));if(_0x1de2cb['error']){if(_0x1de2cb[_0xb4ad('0x26')][_0xb4ad('0x27')]===0x1f4){logger[_0xb4ad('0x26')]('ChatQueue,\x20%s,\x20%s',_0x3f89f7,_0x1de2cb['error'][_0xb4ad('0x28')]);return _0x31f6d3(_0x1de2cb[_0xb4ad('0x26')]['message']);}logger[_0xb4ad('0x26')](_0xb4ad('0x23'),_0x3f89f7,_0x1de2cb[_0xb4ad('0x26')][_0xb4ad('0x28')]);return _0x2f7824(_0x1de2cb['error'][_0xb4ad('0x28')]);}else{logger['info'](_0xb4ad('0x23'),_0x3f89f7,'request\x20sent');_0x2f7824(_0x1de2cb[_0xb4ad('0x29')][_0xb4ad('0x28')]);}})[_0xb4ad('0x2a')](function(_0x515815){logger[_0xb4ad('0x26')]('ChatQueue,\x20%s,\x20%s',_0x3f89f7,_0x515815);_0x31f6d3(_0x515815);});});}function respondWithStatusCode(_0x3fec40,_0x4204b3){_0x4204b3=_0x4204b3||0xcc;return function(_0x359c18){if(_0x359c18){return _0x3fec40[_0xb4ad('0x2b')](_0x4204b3);}return _0x3fec40[_0xb4ad('0x2c')](_0x4204b3)[_0xb4ad('0x2d')]();};}function respondWithResult(_0x4ec5cc,_0x28b5d7){_0x28b5d7=_0x28b5d7||0xc8;return function(_0x757a03){if(_0x757a03){return _0x4ec5cc['status'](_0x28b5d7)[_0xb4ad('0x2e')](_0x757a03);}};}function respondWithFilteredResult(_0xde5ea3,_0x2684fe){return function(_0x4c94d2){if(_0x4c94d2){var _0x280931=typeof _0x2684fe['offset']===_0xb4ad('0x2f')&&typeof _0x2684fe['limit']==='undefined';var _0x235be6=_0x4c94d2['count'];var _0x319a4d=_0x280931?0x0:_0x2684fe['offset'];var _0x457538=_0x280931?_0x4c94d2[_0xb4ad('0x30')]:_0x2684fe[_0xb4ad('0x31')]+_0x2684fe[_0xb4ad('0x32')];var _0x587fc4;if(_0x457538>=_0x235be6){_0x457538=_0x235be6;_0x587fc4=0xc8;}else{_0x587fc4=0xce;}_0xde5ea3[_0xb4ad('0x2c')](_0x587fc4);return _0xde5ea3[_0xb4ad('0x33')](_0xb4ad('0x34'),_0x319a4d+'-'+_0x457538+'/'+_0x235be6)['json'](_0x4c94d2);}return null;};}function patchUpdates(_0x3b6a8c){return function(_0x296880){try{jsonpatch['apply'](_0x296880,_0x3b6a8c,!![]);}catch(_0x56db03){return BPromise[_0xb4ad('0x35')](_0x56db03);}return _0x296880[_0xb4ad('0x36')]();};}function saveUpdates(_0x67ebfd,_0x5c2142){return function(_0x132e6c){if(_0x132e6c){return _0x132e6c[_0xb4ad('0x37')](_0x67ebfd)[_0xb4ad('0x21')](function(_0x35a6af){return _0x35a6af;});}return null;};}function removeEntity(_0x57c7c8,_0x288514){return function(_0x4cbaf8){if(_0x4cbaf8){return _0x4cbaf8[_0xb4ad('0x38')]()['then'](function(){var _0x111ec6=_0x4cbaf8['get']({'plain':!![]});var _0x1d8ff4=_0xb4ad('0x39');return db[_0xb4ad('0x3a')]['destroy']({'where':{'type':_0x1d8ff4,'resourceId':_0x111ec6['id']}})[_0xb4ad('0x21')](function(){return _0x4cbaf8;});})[_0xb4ad('0x21')](function(){_0x57c7c8[_0xb4ad('0x2c')](0xcc)[_0xb4ad('0x2d')]();});}};}function handleEntityNotFound(_0x102b7a,_0xf061bc){return function(_0x3a5d88){if(!_0x3a5d88){_0x102b7a[_0xb4ad('0x2b')](0x194);}return _0x3a5d88;};}function handleError(_0x33b6e9,_0x41a94d){_0x41a94d=_0x41a94d||0x1f4;return function(_0x149103){logger[_0xb4ad('0x26')](_0x149103[_0xb4ad('0x3b')]);if(_0x149103[_0xb4ad('0x3c')]){delete _0x149103[_0xb4ad('0x3c')];}_0x33b6e9[_0xb4ad('0x2c')](_0x41a94d)[_0xb4ad('0x3d')](_0x149103);};}exports[_0xb4ad('0x3e')]=function(_0x8bad9d,_0x5cb5dd){var _0x192b28={},_0x539c8b={},_0x1501ed={'count':0x0,'rows':[]};var _0xb17a47=_['map'](db['ChatQueue']['rawAttributes'],function(_0x51fc96){return{'name':_0x51fc96[_0xb4ad('0x3f')],'type':_0x51fc96[_0xb4ad('0x40')][_0xb4ad('0x41')]};});_0x539c8b['model']=_[_0xb4ad('0x42')](_0xb17a47,_0xb4ad('0x3c'));_0x539c8b[_0xb4ad('0x43')]=_[_0xb4ad('0x44')](_0x8bad9d[_0xb4ad('0x43')]);_0x539c8b['filters']=_[_0xb4ad('0x45')](_0x539c8b['model'],_0x539c8b['query']);_0x192b28['attributes']=_[_0xb4ad('0x45')](_0x539c8b[_0xb4ad('0x46')],qs[_0xb4ad('0x47')](_0x8bad9d[_0xb4ad('0x43')]['fields']));_0x192b28[_0xb4ad('0x48')]=_0x192b28[_0xb4ad('0x48')][_0xb4ad('0x49')]?_0x192b28[_0xb4ad('0x48')]:_0x539c8b[_0xb4ad('0x46')];if(!_0x8bad9d[_0xb4ad('0x43')]['hasOwnProperty'](_0xb4ad('0x4a'))){_0x192b28[_0xb4ad('0x32')]=qs[_0xb4ad('0x32')](_0x8bad9d[_0xb4ad('0x43')][_0xb4ad('0x32')]);_0x192b28[_0xb4ad('0x31')]=qs['offset'](_0x8bad9d['query']['offset']);}_0x192b28['order']=qs['sort'](_0x8bad9d[_0xb4ad('0x43')][_0xb4ad('0x4b')]);_0x192b28[_0xb4ad('0x4c')]=qs[_0xb4ad('0x4d')](_['pick'](_0x8bad9d['query'],_0x539c8b[_0xb4ad('0x4d')]),_0xb17a47);if(_0x8bad9d[_0xb4ad('0x43')]['filter']){_0x192b28[_0xb4ad('0x4c')]=_[_0xb4ad('0x4e')](_0x192b28[_0xb4ad('0x4c')],{'$or':_[_0xb4ad('0x42')](_0xb17a47,function(_0x18d90e){if(_0x18d90e[_0xb4ad('0x40')]!==_0xb4ad('0x4f')){var _0x57df88={};_0x57df88[_0x18d90e[_0xb4ad('0x3c')]]={'$like':'%'+_0x8bad9d[_0xb4ad('0x43')][_0xb4ad('0x50')]+'%'};return _0x57df88;}})});}_0x192b28=_[_0xb4ad('0x4e')]({},_0x192b28,_0x8bad9d[_0xb4ad('0x51')]);var _0x4e7ac2={'where':_0x192b28[_0xb4ad('0x4c')]};return db['ChatQueue']['count'](_0x4e7ac2)['then'](function(_0x4519e9){_0x1501ed[_0xb4ad('0x30')]=_0x4519e9;if(_0x8bad9d[_0xb4ad('0x43')][_0xb4ad('0x52')]){_0x192b28[_0xb4ad('0x53')]=[{'all':!![]}];}return db[_0xb4ad('0x54')]['findAll'](_0x192b28);})[_0xb4ad('0x21')](function(_0x3ee04d){_0x1501ed[_0xb4ad('0x55')]=_0x3ee04d;return _0x1501ed;})['then'](respondWithFilteredResult(_0x5cb5dd,_0x192b28))['catch'](handleError(_0x5cb5dd,null));};exports[_0xb4ad('0x56')]=function(_0x569489,_0x58765b){var _0x37cef5={'raw':!![],'where':{'id':_0x569489[_0xb4ad('0x57')]['id']}},_0x33e338={};_0x33e338[_0xb4ad('0x46')]=_[_0xb4ad('0x44')](db[_0xb4ad('0x54')][_0xb4ad('0x58')]);_0x33e338[_0xb4ad('0x43')]=_['keys'](_0x569489[_0xb4ad('0x43')]);_0x33e338[_0xb4ad('0x4d')]=_['intersection'](_0x33e338[_0xb4ad('0x46')],_0x33e338[_0xb4ad('0x43')]);_0x37cef5[_0xb4ad('0x48')]=_[_0xb4ad('0x45')](_0x33e338[_0xb4ad('0x46')],qs[_0xb4ad('0x47')](_0x569489[_0xb4ad('0x43')][_0xb4ad('0x47')]));_0x37cef5[_0xb4ad('0x48')]=_0x37cef5['attributes'][_0xb4ad('0x49')]?_0x37cef5[_0xb4ad('0x48')]:_0x33e338['model'];if(_0x569489[_0xb4ad('0x43')][_0xb4ad('0x52')]){_0x37cef5[_0xb4ad('0x53')]=[{'all':!![]}];}_0x37cef5=_[_0xb4ad('0x4e')]({},_0x37cef5,_0x569489[_0xb4ad('0x51')]);return db[_0xb4ad('0x54')]['find'](_0x37cef5)[_0xb4ad('0x21')](handleEntityNotFound(_0x58765b,null))[_0xb4ad('0x21')](respondWithResult(_0x58765b,null))[_0xb4ad('0x2a')](handleError(_0x58765b,null));};exports[_0xb4ad('0x59')]=function(_0x283b88,_0x320ab4){return db['ChatQueue'][_0xb4ad('0x59')](_0x283b88[_0xb4ad('0x5a')],{})['then'](function(_0x468686){var _0x4e97d3=_0x283b88[_0xb4ad('0x5b')][_0xb4ad('0x5c')]({'plain':!![]});if(!_0x4e97d3)throw new Error(_0xb4ad('0x5d'));if(_0x4e97d3[_0xb4ad('0x5e')]===_0xb4ad('0x5b')){var _0x5c9d64=_0x468686[_0xb4ad('0x5c')]({'plain':!![]});var _0x5bb9dc=_0xb4ad('0x39');return db[_0xb4ad('0x5f')][_0xb4ad('0x60')]({'where':{'name':_0x5bb9dc,'userProfileId':_0x4e97d3[_0xb4ad('0x61')]},'raw':!![]})[_0xb4ad('0x21')](function(_0x3f2603){if(_0x3f2603&&_0x3f2603[_0xb4ad('0x62')]===0x0){return db[_0xb4ad('0x3a')][_0xb4ad('0x59')]({'name':_0x5c9d64[_0xb4ad('0x3c')],'resourceId':_0x5c9d64['id'],'type':_0x3f2603[_0xb4ad('0x3c')],'sectionId':_0x3f2603['id']},{})[_0xb4ad('0x21')](function(){return _0x468686;});}else{return _0x468686;}})['catch'](function(_0x3f3111){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3f3111);throw _0x3f3111;});}return _0x468686;})[_0xb4ad('0x21')](respondWithResult(_0x320ab4,0xc9))[_0xb4ad('0x2a')](handleError(_0x320ab4,null));};exports[_0xb4ad('0x37')]=function(_0x50b3d9,_0x7a3be7){if(_0x50b3d9[_0xb4ad('0x5a')]['id']){delete _0x50b3d9['body']['id'];}return db[_0xb4ad('0x54')][_0xb4ad('0x60')]({'where':{'id':_0x50b3d9[_0xb4ad('0x57')]['id']}})[_0xb4ad('0x21')](handleEntityNotFound(_0x7a3be7,null))['then'](saveUpdates(_0x50b3d9[_0xb4ad('0x5a')],null))[_0xb4ad('0x21')](respondWithResult(_0x7a3be7,null))[_0xb4ad('0x2a')](handleError(_0x7a3be7,null));};exports['destroy']=function(_0x9fac7d,_0x5f2726){return db['ChatQueue'][_0xb4ad('0x60')]({'where':{'id':_0x9fac7d['params']['id']}})[_0xb4ad('0x21')](handleEntityNotFound(_0x5f2726,null))['then'](removeEntity(_0x5f2726,null))[_0xb4ad('0x2a')](handleError(_0x5f2726,null));};exports[_0xb4ad('0x63')]=function(_0x2862e6,_0x3b3d71){return db[_0xb4ad('0x54')][_0xb4ad('0x63')]()[_0xb4ad('0x21')](respondWithResult(_0x3b3d71,null))[_0xb4ad('0x2a')](handleError(_0x3b3d71,null));};exports[_0xb4ad('0x64')]=function(_0x3bbbd5,_0x51b7da,_0x46fdab){var _0x28544f={'raw':!![],'where':{}},_0x54a7e7={},_0x29cd8d;return db[_0xb4ad('0x54')][_0xb4ad('0x65')]({'where':{'id':_0x3bbbd5['params']['id']}})[_0xb4ad('0x21')](handleEntityNotFound(_0x51b7da,null))[_0xb4ad('0x21')](function(_0x33cd37){if(_0x33cd37){_0x29cd8d=_0x33cd37[_0xb4ad('0x5c')]({'plain':!![]});_0x54a7e7[_0xb4ad('0x46')]=_[_0xb4ad('0x44')](db[_0xb4ad('0x66')]['rawAttributes']);_0x54a7e7[_0xb4ad('0x43')]=_[_0xb4ad('0x44')](_0x3bbbd5['query']);_0x54a7e7['filters']=_[_0xb4ad('0x45')](_0x54a7e7['model'],_0x54a7e7[_0xb4ad('0x43')]);_0x28544f[_0xb4ad('0x48')]=_['intersection'](_0x54a7e7[_0xb4ad('0x46')],qs[_0xb4ad('0x47')](_0x3bbbd5[_0xb4ad('0x43')][_0xb4ad('0x47')]));_0x28544f[_0xb4ad('0x48')]=_0x28544f['attributes']['length']?_0x28544f[_0xb4ad('0x48')]:_0x54a7e7[_0xb4ad('0x46')];if(!_0x3bbbd5['query'][_0xb4ad('0x67')](_0xb4ad('0x4a'))){_0x28544f[_0xb4ad('0x32')]=qs[_0xb4ad('0x32')](_0x3bbbd5[_0xb4ad('0x43')][_0xb4ad('0x32')]);_0x28544f[_0xb4ad('0x31')]=qs['offset'](_0x3bbbd5['query']['offset']);}_0x28544f[_0xb4ad('0x68')]=qs['sort'](_0x3bbbd5['query']['sort']);_0x28544f['where']=qs['filters'](_[_0xb4ad('0x69')](_0x3bbbd5[_0xb4ad('0x43')],_0x54a7e7[_0xb4ad('0x4d')]));_0x28544f[_0xb4ad('0x4c')]['ChatQueueId']=_0x33cd37['id'];if(_0x3bbbd5[_0xb4ad('0x43')][_0xb4ad('0x50')]){_0x28544f[_0xb4ad('0x4c')]=_[_0xb4ad('0x4e')](_0x28544f[_0xb4ad('0x4c')],{'$or':_[_0xb4ad('0x42')](_0x28544f['attributes'],function(_0x4cc63d){var _0x2954c2={};_0x2954c2[_0x4cc63d]={'$like':'%'+_0x3bbbd5[_0xb4ad('0x43')][_0xb4ad('0x50')]+'%'};return _0x2954c2;})});}_0x28544f=_[_0xb4ad('0x4e')]({},_0x28544f,_0x3bbbd5[_0xb4ad('0x51')]);return db[_0xb4ad('0x66')][_0xb4ad('0x6a')](_0x28544f);}})[_0xb4ad('0x21')](function(_0x4f2e56){if(_0x4f2e56){return db[_0xb4ad('0x6b')]['findAndCountAll']({'where':{'id':_[_0xb4ad('0x42')](_0x4f2e56,'UserId'),'role':_0xb4ad('0x6c')},'attributes':['id',_0xb4ad('0x3c'),'chatPause',_0xb4ad('0x6d'),_0xb4ad('0x6e')]});}})[_0xb4ad('0x21')](function(_0x5bc72c){if(_0x5bc72c){return{'count':_0x5bc72c['count'],'rows':_[_0xb4ad('0x42')](_0x5bc72c[_0xb4ad('0x55')],function(_0x13359b){return{'membername':_0x13359b['name'],'UserId':_0x13359b['id'],'queue_name':_0x29cd8d[_0xb4ad('0x3c')],'ChatQueueId':_0x29cd8d['id'],'interface':util[_0xb4ad('0x6f')](_0xb4ad('0x70'),_0xb4ad('0x71'),_0x13359b['name']),'penalty':0x0,'paused':_0x13359b[_0xb4ad('0x72')],'createdAt':_0x13359b[_0xb4ad('0x6e')],'updatedAt':_0x13359b[_0xb4ad('0x6d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb4ad('0x21')](respondWithFilteredResult(_0x51b7da,_0x28544f))[_0xb4ad('0x2a')](handleError(_0x51b7da,null));};exports[_0xb4ad('0x73')]=function(_0x281537,_0x189910,_0x43271f){var _0x464207={};var _0x315714={};var _0x1ff24c;var _0x32c412;return db[_0xb4ad('0x54')]['findOne']({'where':{'id':_0x281537[_0xb4ad('0x57')]['id']}})['then'](handleEntityNotFound(_0x189910,null))[_0xb4ad('0x21')](function(_0x69559a){if(_0x69559a){_0x1ff24c=_0x69559a;_0x315714[_0xb4ad('0x46')]=_[_0xb4ad('0x44')](db[_0xb4ad('0x74')][_0xb4ad('0x58')]);_0x315714[_0xb4ad('0x43')]=_[_0xb4ad('0x44')](_0x281537[_0xb4ad('0x43')]);_0x315714[_0xb4ad('0x4d')]=_[_0xb4ad('0x45')](_0x315714['model'],_0x315714[_0xb4ad('0x43')]);_0x464207['attributes']=_[_0xb4ad('0x45')](_0x315714[_0xb4ad('0x46')],qs[_0xb4ad('0x47')](_0x281537[_0xb4ad('0x43')][_0xb4ad('0x47')]));_0x464207[_0xb4ad('0x48')]=_0x464207[_0xb4ad('0x48')][_0xb4ad('0x49')]?_0x464207[_0xb4ad('0x48')]:_0x315714[_0xb4ad('0x46')];_0x464207[_0xb4ad('0x68')]=qs[_0xb4ad('0x4b')](_0x281537[_0xb4ad('0x43')]['sort']);_0x464207[_0xb4ad('0x4c')]=qs[_0xb4ad('0x4d')](_[_0xb4ad('0x69')](_0x281537[_0xb4ad('0x43')],_0x315714[_0xb4ad('0x4d')]));if(_0x281537[_0xb4ad('0x43')][_0xb4ad('0x50')]){_0x464207[_0xb4ad('0x4c')]=_[_0xb4ad('0x4e')](_0x464207[_0xb4ad('0x4c')],{'$or':_[_0xb4ad('0x42')](_0x464207[_0xb4ad('0x48')],function(_0x4049e5){var _0x2c9d33={};_0x2c9d33[_0x4049e5]={'$like':'%'+_0x281537[_0xb4ad('0x43')][_0xb4ad('0x50')]+'%'};return _0x2c9d33;})});}_0x464207=_[_0xb4ad('0x4e')]({},_0x464207,_0x281537[_0xb4ad('0x51')]);return _0x1ff24c[_0xb4ad('0x73')](_0x464207);}})[_0xb4ad('0x21')](function(_0x47ae6a){if(_0x47ae6a){_0x32c412=_0x47ae6a[_0xb4ad('0x49')];if(!_0x281537[_0xb4ad('0x43')][_0xb4ad('0x67')](_0xb4ad('0x4a'))){_0x464207[_0xb4ad('0x32')]=qs[_0xb4ad('0x32')](_0x281537[_0xb4ad('0x43')][_0xb4ad('0x32')]);_0x464207['offset']=qs['offset'](_0x281537[_0xb4ad('0x43')][_0xb4ad('0x31')]);}return _0x1ff24c[_0xb4ad('0x73')](_0x464207);}})['then'](function(_0x14ed3d){if(_0x14ed3d){return _0x14ed3d?{'count':_0x32c412,'rows':_0x14ed3d}:null;}})[_0xb4ad('0x21')](respondWithResult(_0x189910,null))['catch'](handleError(_0x189910,null));};exports[_0xb4ad('0x75')]=function(_0x2303b7,_0x4e0e07,_0x5baca3){var _0x1bb472=_0x2303b7[_0xb4ad('0x5a')][_0xb4ad('0x76')];return db[_0xb4ad('0x74')]['findAll']({'where':{'id':_0x1bb472},'attributes':['id'],'include':[{'model':db['User'],'as':_0xb4ad('0x77'),'attributes':['id',_0xb4ad('0x3c'),'online',_0xb4ad('0x78'),'interface'],'raw':!![]}]})[_0xb4ad('0x21')](function(_0x5147a7){if(_0x5147a7){var _0xf4ef09=_['flatMap'](_0x5147a7,function(_0x1407b8){var _0x3202e4=_0x1407b8['get']({'plain':!![]});return _0x3202e4['Agents'];});return db['ChatQueue']['find']({'where':{'id':_0x2303b7[_0xb4ad('0x57')]['id']}})['then'](function(_0x302d79){return db['sequelize'][_0xb4ad('0x79')](function(_0x1c1603){return _0x302d79[_0xb4ad('0x75')](_0x1bb472,{'transaction':_0x1c1603})[_0xb4ad('0x21')](function(){return BPromise[_0xb4ad('0x7a')](_0xf4ef09,function(_0x31264a){return db[_0xb4ad('0x66')][_0xb4ad('0x7b')]({'where':{'UserId':_0x31264a['id'],'ChatQueueId':_0x2303b7[_0xb4ad('0x57')]['id']},'transaction':_0x1c1603});});})[_0xb4ad('0x21')](function(){_0xf4ef09[_0xb4ad('0x7c')](function(_0xc52cb8){socket['emit'](_0xb4ad('0x7d'),{'UserId':_0xc52cb8['id'],'ChatQueueId':_0x302d79['id']});});});});});}})[_0xb4ad('0x21')](respondWithStatusCode(_0x4e0e07,null))[_0xb4ad('0x2a')](handleError(_0x4e0e07,null));};exports[_0xb4ad('0x7e')]=function(_0x40b8b0,_0x44cbaa,_0x1ba239){return db[_0xb4ad('0x74')][_0xb4ad('0x6a')]({'where':{'id':_0x40b8b0[_0xb4ad('0x43')]['ids']},'attributes':['id'],'include':[{'model':db[_0xb4ad('0x6b')],'as':_0xb4ad('0x77'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x44cbaa,null))[_0xb4ad('0x21')](function(_0x20f493){var _0x26230a=_['map'](_0x20f493,'id');var _0x48ac9b=[];var _0x30ef30=[];var _0x21fd29=squel[_0xb4ad('0x7f')]();_0x21fd29[_0xb4ad('0x80')](_0xb4ad('0x81'))[_0xb4ad('0x82')]('team_has_chat_queues','tq')[_0xb4ad('0x83')](_0xb4ad('0x84'),'ut',_0xb4ad('0x85'))[_0xb4ad('0x4c')](_0xb4ad('0x86'),_0x40b8b0[_0xb4ad('0x57')]['id']);for(var _0x5051de=0x0;_0x5051de<_0x20f493[_0xb4ad('0x49')];_0x5051de+=0x1){let _0x4a7783=_0x20f493[_0x5051de];for(var _0x37c351=0x0;_0x37c351<_0x4a7783[_0xb4ad('0x77')][_0xb4ad('0x49')];_0x37c351+=0x1){let _0x3e0acd=_0x4a7783['Agents'][_0x37c351];var _0x3fbbff=_0x21fd29['clone']();_0x3fbbff[_0xb4ad('0x4c')]('ut.UserId\x20=\x20?',_0x3e0acd['id']);_0x30ef30[_0xb4ad('0x87')](db['sequelize'][_0xb4ad('0x43')](_0x3fbbff[_0xb4ad('0x88')](),{'type':db['sequelize'][_0xb4ad('0x89')][_0xb4ad('0x8a')]})['then'](function(_0x1aeb2a){if(_0x1aeb2a[_0xb4ad('0x49')]===0x1){return _0x3e0acd['id'];}else{var _0x93cc98=_[_0xb4ad('0x8b')](_[_0xb4ad('0x42')](_0x1aeb2a,_0xb4ad('0x8c')),function(_0x27daa4){return _['includes'](_0x26230a,_0x27daa4);});if(_0x93cc98){return _0x3e0acd['id'];}}}));}}return BPromise[_0xb4ad('0x8d')](_0x30ef30)[_0xb4ad('0x21')](function(_0x18106a){_0x48ac9b=_(_0x48ac9b)[_0xb4ad('0x8e')](_0x18106a)['compact']()[_0xb4ad('0x8f')]();return db[_0xb4ad('0x54')]['find']({'where':{'id':_0x40b8b0[_0xb4ad('0x57')]['id']}})[_0xb4ad('0x21')](function(_0x4caeb3){return db[_0xb4ad('0x90')][_0xb4ad('0x79')](function(_0x2fcf95){return _0x4caeb3['removeTeams'](_0x40b8b0[_0xb4ad('0x43')][_0xb4ad('0x76')],{'transaction':_0x2fcf95})[_0xb4ad('0x21')](function(){if(!_[_0xb4ad('0x91')](_0x48ac9b)){return _0x4caeb3['removeAgents'](_0x48ac9b,{'transaction':_0x2fcf95});}})[_0xb4ad('0x21')](function(){_0x48ac9b['forEach'](function(_0x5d7d71){socket[_0xb4ad('0x92')](_0xb4ad('0x93'),{'UserId':_0x5d7d71,'ChatQueueId':_0x4caeb3['id']});});});});});});})[_0xb4ad('0x21')](respondWithStatusCode(_0x44cbaa,null))[_0xb4ad('0x2a')](handleError(_0x44cbaa,null));};exports[_0xb4ad('0x94')]=function(_0x49d7a8,_0x1ad58c,_0x52a709){return db[_0xb4ad('0x54')][_0xb4ad('0x60')]({'where':{'id':_0x49d7a8[_0xb4ad('0x57')]['id']}})['then'](handleEntityNotFound(_0x1ad58c,null))[_0xb4ad('0x21')](function(_0x18c381){if(_0x18c381){return _0x18c381['addAgents'](_0x49d7a8[_0xb4ad('0x5a')]['ids'],_[_0xb4ad('0x95')](_0x49d7a8[_0xb4ad('0x5a')],['ids','id'])||{})[_0xb4ad('0x96')](function(_0x12e8a3){for(var _0x4388d3=0x0;_0x4388d3<_0x49d7a8[_0xb4ad('0x5a')][_0xb4ad('0x76')][_0xb4ad('0x49')];_0x4388d3+=0x1){socket['emit'](_0xb4ad('0x7d'),{'UserId':Number(_0x49d7a8[_0xb4ad('0x5a')][_0xb4ad('0x76')][_0x4388d3]),'ChatQueueId':Number(_0x49d7a8[_0xb4ad('0x57')]['id'])});}return _0x12e8a3;});}})[_0xb4ad('0x21')](respondWithResult(_0x1ad58c,null))[_0xb4ad('0x2a')](handleError(_0x1ad58c,null));};exports[_0xb4ad('0x97')]=function(_0xa02048,_0x13c694,_0x367329){return db[_0xb4ad('0x54')][_0xb4ad('0x60')]({'where':{'id':_0xa02048[_0xb4ad('0x57')]['id']}})['then'](handleEntityNotFound(_0x13c694,null))[_0xb4ad('0x21')](function(_0x300186){if(_0x300186){return _0x300186[_0xb4ad('0x97')](_0xa02048[_0xb4ad('0x43')][_0xb4ad('0x76')])[_0xb4ad('0x21')](function(){if(_['isArray'](_0xa02048[_0xb4ad('0x43')][_0xb4ad('0x76')])){for(var _0x490dcf=0x0;_0x490dcf<_0xa02048[_0xb4ad('0x43')][_0xb4ad('0x76')][_0xb4ad('0x49')];_0x490dcf+=0x1){socket[_0xb4ad('0x92')](_0xb4ad('0x93'),{'UserId':Number(_0xa02048[_0xb4ad('0x43')][_0xb4ad('0x76')][_0x490dcf]),'ChatQueueId':Number(_0xa02048['params']['id'])});}}else{socket[_0xb4ad('0x92')](_0xb4ad('0x93'),{'UserId':Number(_0xa02048[_0xb4ad('0x43')][_0xb4ad('0x76')]),'ChatQueueId':Number(_0xa02048['params']['id'])});}});}})['then'](respondWithStatusCode(_0x13c694,null))['catch'](handleError(_0x13c694,null));};exports[_0xb4ad('0x98')]=function(_0xc1598c,_0x596d2c,_0x206f53){var _0x56ac1e={};var _0x14605a={};var _0x22dea7;var _0xd3a446;return db[_0xb4ad('0x54')]['findOne']({'where':{'id':_0xc1598c[_0xb4ad('0x57')]['id']}})[_0xb4ad('0x21')](handleEntityNotFound(_0x596d2c,null))[_0xb4ad('0x21')](function(_0x4fa312){if(_0x4fa312){_0x22dea7=_0x4fa312;_0x14605a[_0xb4ad('0x46')]=_[_0xb4ad('0x44')](db[_0xb4ad('0x6b')][_0xb4ad('0x58')]);_0x14605a['query']=_[_0xb4ad('0x44')](_0xc1598c[_0xb4ad('0x43')]);_0x14605a[_0xb4ad('0x4d')]=_['intersection'](_0x14605a[_0xb4ad('0x46')],_0x14605a[_0xb4ad('0x43')]);_0x56ac1e[_0xb4ad('0x48')]=_[_0xb4ad('0x45')](_0x14605a[_0xb4ad('0x46')],qs['fields'](_0xc1598c[_0xb4ad('0x43')][_0xb4ad('0x47')]));_0x56ac1e[_0xb4ad('0x48')]=_0x56ac1e[_0xb4ad('0x48')][_0xb4ad('0x49')]?_0x56ac1e[_0xb4ad('0x48')]:_0x14605a['model'];_0x56ac1e[_0xb4ad('0x68')]=qs['sort'](_0xc1598c[_0xb4ad('0x43')][_0xb4ad('0x4b')]);_0x56ac1e[_0xb4ad('0x4c')]=qs[_0xb4ad('0x4d')](_['pick'](_0xc1598c[_0xb4ad('0x43')],_0x14605a['filters']));if(_0xc1598c['query'][_0xb4ad('0x50')]){_0x56ac1e[_0xb4ad('0x4c')]=_[_0xb4ad('0x4e')](_0x56ac1e[_0xb4ad('0x4c')],{'$or':_['map'](_0x56ac1e[_0xb4ad('0x48')],function(_0x2c6472){var _0x36b259={};_0x36b259[_0x2c6472]={'$like':'%'+_0xc1598c[_0xb4ad('0x43')][_0xb4ad('0x50')]+'%'};return _0x36b259;})});}_0x56ac1e=_[_0xb4ad('0x4e')]({},_0x56ac1e,_0xc1598c[_0xb4ad('0x51')]);return _0x22dea7['getAgents'](_0x56ac1e);}})[_0xb4ad('0x21')](function(_0x6b113f){if(_0x6b113f){_0xd3a446=_0x6b113f[_0xb4ad('0x49')];if(!_0xc1598c['query'][_0xb4ad('0x67')](_0xb4ad('0x4a'))){_0x56ac1e[_0xb4ad('0x32')]=qs[_0xb4ad('0x32')](_0xc1598c['query'][_0xb4ad('0x32')]);_0x56ac1e[_0xb4ad('0x31')]=qs[_0xb4ad('0x31')](_0xc1598c[_0xb4ad('0x43')][_0xb4ad('0x31')]);}return _0x22dea7['getAgents'](_0x56ac1e);}})[_0xb4ad('0x21')](function(_0x211068){if(_0x211068){return _0x211068?{'count':_0xd3a446,'rows':_0x211068}:null;}})[_0xb4ad('0x21')](respondWithResult(_0x596d2c,null))[_0xb4ad('0x2a')](handleError(_0x596d2c,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 69d0a6a..c66dfb8 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 _0xeb79=['ChatQueue','save','remove','emit','hook'];(function(_0x4f6464,_0x19ce0b){var _0x2970c0=function(_0x30b705){while(--_0x30b705){_0x4f6464['push'](_0x4f6464['shift']());}};_0x2970c0(++_0x19ce0b);}(_0xeb79,0x87));var _0x9eb7=function(_0x3c0a09,_0x3db8d7){_0x3c0a09=_0x3c0a09-0x0;var _0x463015=_0xeb79[_0x3c0a09];return _0x463015;};'use strict';var EventEmitter=require('events');var ChatQueue=require('../../mysqldb')['db'][_0x9eb7('0x0')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9eb7('0x1'),'afterUpdate':'update','afterDestroy':_0x9eb7('0x2')};function emitEvent(_0x47e1e5){return function(_0x3ee5c6,_0x2987e1,_0x385233){ChatQueueEvents[_0x9eb7('0x3')](_0x47e1e5+':'+_0x3ee5c6['id'],_0x3ee5c6);ChatQueueEvents['emit'](_0x47e1e5,_0x3ee5c6);_0x385233(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0x9eb7('0x4')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0x4e8e=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','save','update'];(function(_0x5bd4ce,_0x40f4f2){var _0x1bd0f1=function(_0x399c73){while(--_0x399c73){_0x5bd4ce['push'](_0x5bd4ce['shift']());}};_0x1bd0f1(++_0x40f4f2);}(_0x4e8e,0x95));var _0xe4e8=function(_0x255c9a,_0x50c1db){_0x255c9a=_0x255c9a-0x0;var _0x57491d=_0x4e8e[_0x255c9a];return _0x57491d;};'use strict';var EventEmitter=require(_0xe4e8('0x0'));var ChatQueue=require(_0xe4e8('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe4e8('0x2'),'afterUpdate':_0xe4e8('0x3'),'afterDestroy':_0xe4e8('0x4')};function emitEvent(_0xb45e41){return function(_0x53cfb5,_0x46c61f,_0x209be6){ChatQueueEvents[_0xe4e8('0x5')](_0xb45e41+':'+_0x53cfb5['id'],_0x53cfb5);ChatQueueEvents['emit'](_0xb45e41,_0x53cfb5);_0x209be6(null);};}for(var e in events){if(events[_0xe4e8('0x6')](e)){var event=events[e];ChatQueue[_0xe4e8('0x7')](e,emitEvent(event));}}module[_0xe4e8('0x8')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index aceb077..2dca84a 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 _0x553c=['chat_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x1dbf7c,_0x14cf12){var _0x132e52=function(_0x57e292){while(--_0x57e292){_0x1dbf7c['push'](_0x1dbf7c['shift']());}};_0x132e52(++_0x14cf12);}(_0x553c,0x121));var _0xc553=function(_0x4f65a9,_0x296b49){_0x4f65a9=_0x4f65a9-0x0;var _0x5bb921=_0x553c[_0x4f65a9];return _0x5bb921;};'use strict';var _=require(_0xc553('0x0'));var util=require(_0xc553('0x1'));var logger=require(_0xc553('0x2'))(_0xc553('0x3'));var moment=require(_0xc553('0x4'));var BPromise=require('bluebird');var rp=require(_0xc553('0x5'));var fs=require('fs');var path=require(_0xc553('0x6'));var rimraf=require(_0xc553('0x7'));var config=require(_0xc553('0x8'));var attributes=require('./chatQueue.attributes');module[_0xc553('0x9')]=function(_0x2ef105,_0x269284){return _0x2ef105[_0xc553('0xa')]('ChatQueue',attributes,{'tableName':_0xc553('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfdf3=['ChatQueue','chat_queues','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./chatQueue.attributes','exports'];(function(_0xef4fc0,_0x33cc41){var _0x57dade=function(_0xe75b3e){while(--_0xe75b3e){_0xef4fc0['push'](_0xef4fc0['shift']());}};_0x57dade(++_0x33cc41);}(_0xfdf3,0x176));var _0x3fdf=function(_0x77e70,_0xd75f49){_0x77e70=_0x77e70-0x0;var _0x38f7aa=_0xfdf3[_0x77e70];return _0x38f7aa;};'use strict';var _=require(_0x3fdf('0x0'));var util=require(_0x3fdf('0x1'));var logger=require('../../config/logger')(_0x3fdf('0x2'));var moment=require(_0x3fdf('0x3'));var BPromise=require(_0x3fdf('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3fdf('0x5'));var rimraf=require(_0x3fdf('0x6'));var config=require(_0x3fdf('0x7'));var attributes=require(_0x3fdf('0x8'));module[_0x3fdf('0x9')]=function(_0xd23d22,_0x30c2a8){return _0xd23d22['define'](_0x3fdf('0xa'),attributes,{'tableName':_0x3fdf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 4176f55..5895393 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 _0x0e3b=['redis','socket.io-emitter','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','ChatQueue','options','raw','where','attributes','include','map','model','GetChatQueue','stringify','ShowChatQueue','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x17c3df,_0x57fb6c){var _0x4fea8d=function(_0x27aa4d){while(--_0x27aa4d){_0x17c3df['push'](_0x17c3df['shift']());}};_0x4fea8d(++_0x57fb6c);}(_0x0e3b,0x125));var _0xb0e3=function(_0x11f9ac,_0xcb2915){_0x11f9ac=_0x11f9ac-0x0;var _0x269817=_0x0e3b[_0x11f9ac];return _0x269817;};'use strict';var _=require(_0xb0e3('0x0'));var util=require(_0xb0e3('0x1'));var moment=require(_0xb0e3('0x2'));var BPromise=require('bluebird');var rs=require(_0xb0e3('0x3'));var fs=require('fs');var Redis=require(_0xb0e3('0x4'));var db=require(_0xb0e3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb0e3('0x6'))(_0xb0e3('0x7'));var config=require('../../config/environment');var jayson=require(_0xb0e3('0x8'));var client=jayson[_0xb0e3('0x9')][_0xb0e3('0xa')]({'port':0x232a});config[_0xb0e3('0xb')]=_['defaults'](config[_0xb0e3('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xb0e3('0xc'))(new Redis(config[_0xb0e3('0xb')]));require(_0xb0e3('0xd'))[_0xb0e3('0xe')](socket);function respondWithRpcPromise(_0x53b526,_0x4b90aa,_0x384684){return new BPromise(function(_0x3ff132,_0x3eefcd){return client[_0xb0e3('0xf')](_0x53b526,_0x384684)[_0xb0e3('0x10')](function(_0x1507c3){logger[_0xb0e3('0x11')](_0xb0e3('0x12'),_0x4b90aa,_0xb0e3('0x13'));logger[_0xb0e3('0x14')](_0xb0e3('0x15'),_0x4b90aa,'request\x20sent',JSON['stringify'](_0x1507c3));if(_0x1507c3[_0xb0e3('0x16')]){if(_0x1507c3[_0xb0e3('0x16')]['code']===0x1f4){logger[_0xb0e3('0x16')](_0xb0e3('0x12'),_0x4b90aa,_0x1507c3['error'][_0xb0e3('0x17')]);return _0x3eefcd(_0x1507c3['error'][_0xb0e3('0x17')]);}logger['error'](_0xb0e3('0x12'),_0x4b90aa,_0x1507c3['error'][_0xb0e3('0x17')]);return _0x3ff132(_0x1507c3['error']['message']);}else{logger[_0xb0e3('0x11')](_0xb0e3('0x12'),_0x4b90aa,_0xb0e3('0x13'));_0x3ff132(_0x1507c3[_0xb0e3('0x18')][_0xb0e3('0x17')]);}})[_0xb0e3('0x19')](function(_0x5042bc){logger['error'](_0xb0e3('0x12'),_0x4b90aa,_0x5042bc);_0x3eefcd(_0x5042bc);});});}exports['GetChatQueue']=function(_0x17c83c){var _0x593bb6=this;return new Promise(function(_0x4a3f9b,_0x37be78){return db[_0xb0e3('0x1a')]['findAll']({'raw':_0x17c83c[_0xb0e3('0x1b')]?_0x17c83c[_0xb0e3('0x1b')][_0xb0e3('0x1c')]===undefined?!![]:![]:!![],'where':_0x17c83c['options']?_0x17c83c[_0xb0e3('0x1b')][_0xb0e3('0x1d')]||null:null,'attributes':_0x17c83c[_0xb0e3('0x1b')]?_0x17c83c[_0xb0e3('0x1b')][_0xb0e3('0x1e')]||null:null,'limit':_0x17c83c['options']?_0x17c83c[_0xb0e3('0x1b')]['limit']||null:null,'include':_0x17c83c[_0xb0e3('0x1b')]?_0x17c83c[_0xb0e3('0x1b')][_0xb0e3('0x1f')]?_['map'](_0x17c83c[_0xb0e3('0x1b')]['include'],function(_0xc5286){return{'model':db[_0xc5286['model']],'as':_0xc5286['as'],'attributes':_0xc5286['attributes'],'include':_0xc5286['include']?_[_0xb0e3('0x20')](_0xc5286[_0xb0e3('0x1f')],function(_0x453e94){return{'model':db[_0x453e94['model']],'as':_0x453e94['as'],'attributes':_0x453e94[_0xb0e3('0x1e')],'include':_0x453e94[_0xb0e3('0x1f')]?_[_0xb0e3('0x20')](_0x453e94[_0xb0e3('0x1f')],function(_0x246da2){return{'model':db[_0x246da2[_0xb0e3('0x21')]],'as':_0x246da2['as'],'attributes':_0x246da2[_0xb0e3('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb0e3('0x10')](function(_0x20dd68){logger[_0xb0e3('0x11')](_0xb0e3('0x22'),_0x17c83c);logger[_0xb0e3('0x14')](_0xb0e3('0x22'),_0x17c83c,JSON[_0xb0e3('0x23')](_0x20dd68));_0x4a3f9b(_0x20dd68);})[_0xb0e3('0x19')](function(_0x8a3727){logger['error'](_0xb0e3('0x22'),_0x8a3727[_0xb0e3('0x17')],_0x17c83c);_0x37be78(_0x593bb6[_0xb0e3('0x16')](0x1f4,_0x8a3727[_0xb0e3('0x17')]));});});};exports[_0xb0e3('0x24')]=function(_0x8fe215){var _0xc7a53f=this;return new Promise(function(_0x2ebb29,_0x563591){return db[_0xb0e3('0x1a')][_0xb0e3('0x25')]({'raw':_0x8fe215['options']?_0x8fe215['options']['raw']===undefined?!![]:![]:!![],'where':_0x8fe215[_0xb0e3('0x1b')]?_0x8fe215[_0xb0e3('0x1b')]['where']||null:null,'attributes':_0x8fe215[_0xb0e3('0x1b')]?_0x8fe215[_0xb0e3('0x1b')][_0xb0e3('0x1e')]||null:null,'include':_0x8fe215['options']?_0x8fe215['options'][_0xb0e3('0x1f')]?_['map'](_0x8fe215[_0xb0e3('0x1b')][_0xb0e3('0x1f')],function(_0x278e98){return{'model':db[_0x278e98[_0xb0e3('0x21')]],'as':_0x278e98['as'],'attributes':_0x278e98[_0xb0e3('0x1e')],'include':_0x278e98['include']?_[_0xb0e3('0x20')](_0x278e98['include'],function(_0x4ca1da){return{'model':db[_0x4ca1da[_0xb0e3('0x21')]],'as':_0x4ca1da['as'],'attributes':_0x4ca1da[_0xb0e3('0x1e')],'include':_0x4ca1da['include']?_[_0xb0e3('0x20')](_0x4ca1da[_0xb0e3('0x1f')],function(_0x3fd3fa){return{'model':db[_0x3fd3fa[_0xb0e3('0x21')]],'as':_0x3fd3fa['as'],'attributes':_0x3fd3fa[_0xb0e3('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb0e3('0x10')](function(_0x2b4788){logger[_0xb0e3('0x11')](_0xb0e3('0x24'),_0x8fe215);logger[_0xb0e3('0x14')](_0xb0e3('0x24'),_0x8fe215,JSON[_0xb0e3('0x23')](_0x2b4788));_0x2ebb29(_0x2b4788);})[_0xb0e3('0x19')](function(_0x1e02c3){logger['error']('ShowChatQueue',_0x1e02c3[_0xb0e3('0x17')],_0x8fe215);_0x563591(_0xc7a53f['error'](0x1f4,_0x1e02c3[_0xb0e3('0x17')]));});});}; \ No newline at end of file +var _0x3264=['attributes','limit','include','map','model','GetChatQueue','ShowChatQueue','find','then','stringify','util','moment','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','register','request','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','ChatQueue,\x20%s,\x20%s','message','catch','ChatQueue','findAll','options','raw','where'];(function(_0x335141,_0x52b910){var _0x4f84da=function(_0x4514ea){while(--_0x4514ea){_0x335141['push'](_0x335141['shift']());}};_0x4f84da(++_0x52b910);}(_0x3264,0x7f));var _0x4326=function(_0x45bf86,_0x75586e){_0x45bf86=_0x45bf86-0x0;var _0x1f02b7=_0x3264[_0x45bf86];return _0x1f02b7;};'use strict';var _=require('lodash');var util=require(_0x4326('0x0'));var moment=require(_0x4326('0x1'));var BPromise=require(_0x4326('0x2'));var rs=require(_0x4326('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4326('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x4326('0x5'));var jayson=require(_0x4326('0x6'));var client=jayson[_0x4326('0x7')][_0x4326('0x8')]({'port':0x232a});config['redis']=_[_0x4326('0x9')](config[_0x4326('0xa')],{'host':_0x4326('0xb'),'port':0x18eb});var socket=require(_0x4326('0xc'))(new Redis(config[_0x4326('0xa')]));require(_0x4326('0xd'))[_0x4326('0xe')](socket);function respondWithRpcPromise(_0x5cde0b,_0x58bade,_0x51323a){return new BPromise(function(_0x97d63e,_0x9daa3f){return client[_0x4326('0xf')](_0x5cde0b,_0x51323a)['then'](function(_0x5ac227){logger[_0x4326('0x10')]('ChatQueue,\x20%s,\x20%s',_0x58bade,_0x4326('0x11'));logger[_0x4326('0x12')](_0x4326('0x13'),_0x58bade,'request\x20sent',JSON['stringify'](_0x5ac227));if(_0x5ac227[_0x4326('0x14')]){if(_0x5ac227['error']['code']===0x1f4){logger[_0x4326('0x14')](_0x4326('0x15'),_0x58bade,_0x5ac227[_0x4326('0x14')][_0x4326('0x16')]);return _0x9daa3f(_0x5ac227['error'][_0x4326('0x16')]);}logger[_0x4326('0x14')](_0x4326('0x15'),_0x58bade,_0x5ac227['error'][_0x4326('0x16')]);return _0x97d63e(_0x5ac227[_0x4326('0x14')][_0x4326('0x16')]);}else{logger[_0x4326('0x10')]('ChatQueue,\x20%s,\x20%s',_0x58bade,_0x4326('0x11'));_0x97d63e(_0x5ac227['result'][_0x4326('0x16')]);}})[_0x4326('0x17')](function(_0x35f24b){logger[_0x4326('0x14')](_0x4326('0x15'),_0x58bade,_0x35f24b);_0x9daa3f(_0x35f24b);});});}exports['GetChatQueue']=function(_0x42e4e8){var _0x3d5045=this;return new Promise(function(_0x54e4c4,_0x377a83){return db[_0x4326('0x18')][_0x4326('0x19')]({'raw':_0x42e4e8['options']?_0x42e4e8[_0x4326('0x1a')][_0x4326('0x1b')]===undefined?!![]:![]:!![],'where':_0x42e4e8[_0x4326('0x1a')]?_0x42e4e8[_0x4326('0x1a')][_0x4326('0x1c')]||null:null,'attributes':_0x42e4e8[_0x4326('0x1a')]?_0x42e4e8[_0x4326('0x1a')][_0x4326('0x1d')]||null:null,'limit':_0x42e4e8['options']?_0x42e4e8[_0x4326('0x1a')][_0x4326('0x1e')]||null:null,'include':_0x42e4e8['options']?_0x42e4e8[_0x4326('0x1a')][_0x4326('0x1f')]?_[_0x4326('0x20')](_0x42e4e8[_0x4326('0x1a')][_0x4326('0x1f')],function(_0x4b5e63){return{'model':db[_0x4b5e63['model']],'as':_0x4b5e63['as'],'attributes':_0x4b5e63[_0x4326('0x1d')],'include':_0x4b5e63[_0x4326('0x1f')]?_[_0x4326('0x20')](_0x4b5e63[_0x4326('0x1f')],function(_0x4a1de7){return{'model':db[_0x4a1de7[_0x4326('0x21')]],'as':_0x4a1de7['as'],'attributes':_0x4a1de7[_0x4326('0x1d')],'include':_0x4a1de7[_0x4326('0x1f')]?_['map'](_0x4a1de7[_0x4326('0x1f')],function(_0x5a1c44){return{'model':db[_0x5a1c44[_0x4326('0x21')]],'as':_0x5a1c44['as'],'attributes':_0x5a1c44[_0x4326('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c56d5){logger[_0x4326('0x10')](_0x4326('0x22'),_0x42e4e8);logger[_0x4326('0x12')]('GetChatQueue',_0x42e4e8,JSON['stringify'](_0x3c56d5));_0x54e4c4(_0x3c56d5);})['catch'](function(_0x430f06){logger[_0x4326('0x14')](_0x4326('0x22'),_0x430f06[_0x4326('0x16')],_0x42e4e8);_0x377a83(_0x3d5045[_0x4326('0x14')](0x1f4,_0x430f06[_0x4326('0x16')]));});});};exports[_0x4326('0x23')]=function(_0xd54ee0){var _0x2a94e7=this;return new Promise(function(_0x28c48a,_0x49a2d1){return db[_0x4326('0x18')][_0x4326('0x24')]({'raw':_0xd54ee0[_0x4326('0x1a')]?_0xd54ee0[_0x4326('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0xd54ee0[_0x4326('0x1a')]?_0xd54ee0[_0x4326('0x1a')][_0x4326('0x1c')]||null:null,'attributes':_0xd54ee0[_0x4326('0x1a')]?_0xd54ee0[_0x4326('0x1a')][_0x4326('0x1d')]||null:null,'include':_0xd54ee0['options']?_0xd54ee0[_0x4326('0x1a')][_0x4326('0x1f')]?_[_0x4326('0x20')](_0xd54ee0[_0x4326('0x1a')][_0x4326('0x1f')],function(_0x2138ed){return{'model':db[_0x2138ed[_0x4326('0x21')]],'as':_0x2138ed['as'],'attributes':_0x2138ed['attributes'],'include':_0x2138ed['include']?_[_0x4326('0x20')](_0x2138ed['include'],function(_0x2d5385){return{'model':db[_0x2d5385[_0x4326('0x21')]],'as':_0x2d5385['as'],'attributes':_0x2d5385[_0x4326('0x1d')],'include':_0x2d5385[_0x4326('0x1f')]?_['map'](_0x2d5385['include'],function(_0x1db617){return{'model':db[_0x1db617[_0x4326('0x21')]],'as':_0x1db617['as'],'attributes':_0x1db617['attributes']};}):[]};}):[]};}):[]:[]})[_0x4326('0x25')](function(_0x1233ad){logger[_0x4326('0x10')](_0x4326('0x23'),_0xd54ee0);logger[_0x4326('0x12')](_0x4326('0x23'),_0xd54ee0,JSON[_0x4326('0x26')](_0x1233ad));_0x28c48a(_0x1233ad);})[_0x4326('0x17')](function(_0x3496ac){logger[_0x4326('0x14')]('ShowChatQueue',_0x3496ac['message'],_0xd54ee0);_0x49a2d1(_0x2a94e7['error'](0x1f4,_0x3496ac[_0x4326('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 86de0ba..444b0bb 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 _0xedd9=['removeListener','register','length','chatQueue:','save','remove','update','emit'];(function(_0x47027e,_0xb7bb40){var _0xabcfc=function(_0x254f1c){while(--_0x254f1c){_0x47027e['push'](_0x47027e['shift']());}};_0xabcfc(++_0xb7bb40);}(_0xedd9,0xfc));var _0x9edd=function(_0x15fd40,_0x11d3ae){_0x15fd40=_0x15fd40-0x0;var _0x1d151d=_0xedd9[_0x15fd40];return _0x1d151d;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0x9edd('0x0'),_0x9edd('0x1'),_0x9edd('0x2')];function createListener(_0x2c16b8,_0x3b51bc){return function(_0x127cbe){_0x3b51bc[_0x9edd('0x3')](_0x2c16b8,_0x127cbe);};}function removeListener(_0x36b53f,_0x5943b3){return function(){ChatQueueEvents[_0x9edd('0x4')](_0x36b53f,_0x5943b3);};}exports[_0x9edd('0x5')]=function(_0x268f9e){for(var _0x34c1a7=0x0,_0x5319f7=events[_0x9edd('0x6')];_0x34c1a7<_0x5319f7;_0x34c1a7++){var _0x571af9=events[_0x34c1a7];var _0x172522=createListener(_0x9edd('0x7')+_0x571af9,_0x268f9e);ChatQueueEvents['on'](_0x571af9,_0x172522);}}; \ No newline at end of file +var _0x6334=['length','chatQueue:','./chatQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x476718,_0x4fb3c6){var _0x1a2b16=function(_0x5b93b0){while(--_0x5b93b0){_0x476718['push'](_0x476718['shift']());}};_0x1a2b16(++_0x4fb3c6);}(_0x6334,0x119));var _0x4633=function(_0x3ae34a,_0x143082){_0x3ae34a=_0x3ae34a-0x0;var _0x4c9edc=_0x6334[_0x3ae34a];return _0x4c9edc;};'use strict';var ChatQueueEvents=require(_0x4633('0x0'));var events=[_0x4633('0x1'),_0x4633('0x2'),_0x4633('0x3')];function createListener(_0x1e53a0,_0x47254b){return function(_0x5109db){_0x47254b[_0x4633('0x4')](_0x1e53a0,_0x5109db);};}function removeListener(_0x205442,_0x2a2b3c){return function(){ChatQueueEvents[_0x4633('0x5')](_0x205442,_0x2a2b3c);};}exports[_0x4633('0x6')]=function(_0x6493dc){for(var _0x175e14=0x0,_0x4a8997=events[_0x4633('0x7')];_0x175e14<_0x4a8997;_0x175e14++){var _0x56891d=events[_0x175e14];var _0x21af74=createListener(_0x4633('0x8')+_0x56891d,_0x6493dc);ChatQueueEvents['on'](_0x56891d,_0x21af74);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index e1c1be6..c033c15 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(_0x33085e,_0x571ae7){var _0x43928b=function(_0x2cc736){while(--_0x2cc736){_0x33085e['push'](_0x33085e['shift']());}};_0x43928b(++_0x571ae7);}(_0xe14b,0x93));var _0xbe14=function(_0x593433,_0x462bd1){_0x593433=_0x593433-0x0;var _0x25f371=_0xe14b[_0x593433];return _0x25f371;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['describe']);router['get']('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0x6')](_0xbe14('0xb'),auth['isAuthenticated'](),controller['getMembers']);router[_0xbe14('0x6')](_0xbe14('0xc'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0x6')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xf')]);router[_0xbe14('0x10')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x11')]);router[_0xbe14('0x10')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x12')]);router[_0xbe14('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0xbe14('0x13')]);router[_0xbe14('0x14')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0x16')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x17')]);router[_0xbe14('0x16')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['removeTeams']);router[_0xbe14('0x16')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x18')]);module[_0xbe14('0x19')]=router; \ No newline at end of file +var _0x55ca=['post','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','addTeams'];(function(_0x46ae97,_0x1457ea){var _0x4d0c37=function(_0x387581){while(--_0x387581){_0x46ae97['push'](_0x46ae97['shift']());}};_0x4d0c37(++_0x1457ea);}(_0x55ca,0x126));var _0xa55c=function(_0x1877e2,_0x2b76d4){_0x1877e2=_0x1877e2-0x0;var _0x44e96a=_0x55ca[_0x1877e2];return _0x44e96a;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/describe',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['show']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getAgents']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/teams',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x13')]);router['put'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router[_0xa55c('0x15')](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x16')]);router[_0xa55c('0x15')](_0xa55c('0xe'),auth['isAuthenticated'](),controller[_0xa55c('0x17')]);router[_0xa55c('0x15')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x18')]);module[_0xa55c('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 25d1374..0e2cc20 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 _0xf9d9=['STRING','DATE','exports'];(function(_0x3c749c,_0x1c78d0){var _0x12f6e6=function(_0x467dd0){while(--_0x467dd0){_0x3c749c['push'](_0x3c749c['shift']());}};_0x12f6e6(++_0x1c78d0);}(_0xf9d9,0x182));var _0x9f9d=function(_0x2ab251,_0x41f7bb){_0x2ab251=_0x2ab251-0x0;var _0x4461c4=_0xf9d9[_0x2ab251];return _0x4461c4;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x9f9d('0x0')]={'uniqueid':{'type':Sequelize[_0x9f9d('0x1')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x9f9d('0x2')]},'acceptAt':{'type':Sequelize[_0x9f9d('0x2')]},'exitAt':{'type':Sequelize[_0x9f9d('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3870=['STRING','DATE','moment','sequelize'];(function(_0x73d817,_0x54eed1){var _0x178cf8=function(_0x3cdf24){while(--_0x3cdf24){_0x73d817['push'](_0x73d817['shift']());}};_0x178cf8(++_0x54eed1);}(_0x3870,0x19e));var _0x0387=function(_0x42a6b9,_0x164483){_0x42a6b9=_0x42a6b9-0x0;var _0x420139=_0x3870[_0x42a6b9];return _0x420139;};'use strict';var moment=require(_0x0387('0x0'));var Sequelize=require(_0x0387('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x0387('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x0387('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x0387('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x0387('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index badfe1d..b5cfddc 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 _0x1c75=['jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','end','status','undefined','limit','count','offset','json','apply','reject','save','then','error','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','options','includeAll','include','findAll','rows','show','params','keys','catch','body','update','find','destroy','describe','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto'];(function(_0x354fc7,_0x10bd45){var _0x462135=function(_0x8d4cd2){while(--_0x8d4cd2){_0x354fc7['push'](_0x354fc7['shift']());}};_0x462135(++_0x10bd45);}(_0x1c75,0xce));var _0x51c7=function(_0x1fd675,_0x587658){_0x1fd675=_0x1fd675-0x0;var _0x521d1c=_0x1c75[_0x1fd675];return _0x521d1c;};'use strict';var emlformat=require(_0x51c7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x51c7('0x1'));var moment=require(_0x51c7('0x2'));var BPromise=require(_0x51c7('0x3'));var Mustache=require(_0x51c7('0x4'));var util=require(_0x51c7('0x5'));var path=require(_0x51c7('0x6'));var sox=require(_0x51c7('0x7'));var csv=require(_0x51c7('0x8'));var ejs=require(_0x51c7('0x9'));var fs=require('fs');var fs_extra=require(_0x51c7('0xa'));var _=require(_0x51c7('0xb'));var squel=require('squel');var crypto=require(_0x51c7('0xc'));var jsforce=require(_0x51c7('0xd'));var deskjs=require(_0x51c7('0xe'));var toCsv=require(_0x51c7('0x8'));var querystring=require('querystring');var Papa=require(_0x51c7('0xf'));var Redis=require('ioredis');var authService=require(_0x51c7('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x51c7('0x11'));var hardwareService=require(_0x51c7('0x12'));var logger=require('../../config/logger')(_0x51c7('0x13'));var utils=require(_0x51c7('0x14'));var config=require(_0x51c7('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52fa27,_0xedfd17){_0xedfd17=_0xedfd17||0xcc;return function(_0xefc2ff){if(_0xefc2ff){return _0x52fa27[_0x51c7('0x16')](_0xedfd17);}return _0x52fa27['status'](_0xedfd17)[_0x51c7('0x17')]();};}function respondWithResult(_0x51e0be,_0x2c8db4){_0x2c8db4=_0x2c8db4||0xc8;return function(_0x5a5ea9){if(_0x5a5ea9){return _0x51e0be[_0x51c7('0x18')](_0x2c8db4)['json'](_0x5a5ea9);}};}function respondWithFilteredResult(_0x730429,_0x317fa7){return function(_0x44c13d){if(_0x44c13d){var _0x39da99=typeof _0x317fa7['offset']===_0x51c7('0x19')&&typeof _0x317fa7[_0x51c7('0x1a')]===_0x51c7('0x19');var _0x3079b7=_0x44c13d[_0x51c7('0x1b')];var _0x36b29a=_0x39da99?0x0:_0x317fa7['offset'];var _0xe4cf49=_0x39da99?_0x44c13d[_0x51c7('0x1b')]:_0x317fa7[_0x51c7('0x1c')]+_0x317fa7['limit'];var _0x3c1f43;if(_0xe4cf49>=_0x3079b7){_0xe4cf49=_0x3079b7;_0x3c1f43=0xc8;}else{_0x3c1f43=0xce;}_0x730429[_0x51c7('0x18')](_0x3c1f43);return _0x730429['set']('Content-Range',_0x36b29a+'-'+_0xe4cf49+'/'+_0x3079b7)[_0x51c7('0x1d')](_0x44c13d);}return null;};}function patchUpdates(_0x1881f3){return function(_0x45b181){try{jsonpatch[_0x51c7('0x1e')](_0x45b181,_0x1881f3,!![]);}catch(_0x4072b9){return BPromise[_0x51c7('0x1f')](_0x4072b9);}return _0x45b181[_0x51c7('0x20')]();};}function saveUpdates(_0x5248e2,_0x3dbfbc){return function(_0x11c83d){if(_0x11c83d){return _0x11c83d['update'](_0x5248e2)[_0x51c7('0x21')](function(_0x48b259){return _0x48b259;});}return null;};}function removeEntity(_0x2a8a7d,_0x3f7858){return function(_0x414de0){if(_0x414de0){return _0x414de0['destroy']()[_0x51c7('0x21')](function(){_0x2a8a7d[_0x51c7('0x18')](0xcc)[_0x51c7('0x17')]();});}};}function handleEntityNotFound(_0x13a3ad,_0x44de99){return function(_0x1c3935){if(!_0x1c3935){_0x13a3ad['sendStatus'](0x194);}return _0x1c3935;};}function handleError(_0x438887,_0x528c19){_0x528c19=_0x528c19||0x1f4;return function(_0x3d9ec8){logger[_0x51c7('0x22')](_0x3d9ec8[_0x51c7('0x23')]);if(_0x3d9ec8[_0x51c7('0x24')]){delete _0x3d9ec8[_0x51c7('0x24')];}_0x438887[_0x51c7('0x18')](_0x528c19)[_0x51c7('0x25')](_0x3d9ec8);};}exports[_0x51c7('0x26')]=function(_0x42745b,_0x2a18e0){var _0x104315={},_0x16db1b={},_0x59cb23={'count':0x0,'rows':[]};var _0xc1688f=_[_0x51c7('0x27')](db[_0x51c7('0x28')][_0x51c7('0x29')],function(_0x588fbb){return{'name':_0x588fbb[_0x51c7('0x2a')],'type':_0x588fbb[_0x51c7('0x2b')][_0x51c7('0x2c')]};});_0x16db1b[_0x51c7('0x2d')]=_[_0x51c7('0x27')](_0xc1688f,'name');_0x16db1b[_0x51c7('0x2e')]=_['keys'](_0x42745b[_0x51c7('0x2e')]);_0x16db1b[_0x51c7('0x2f')]=_[_0x51c7('0x30')](_0x16db1b[_0x51c7('0x2d')],_0x16db1b[_0x51c7('0x2e')]);_0x104315[_0x51c7('0x31')]=_[_0x51c7('0x30')](_0x16db1b[_0x51c7('0x2d')],qs[_0x51c7('0x32')](_0x42745b[_0x51c7('0x2e')]['fields']));_0x104315[_0x51c7('0x31')]=_0x104315['attributes'][_0x51c7('0x33')]?_0x104315[_0x51c7('0x31')]:_0x16db1b['model'];if(!_0x42745b[_0x51c7('0x2e')][_0x51c7('0x34')](_0x51c7('0x35'))){_0x104315[_0x51c7('0x1a')]=qs['limit'](_0x42745b[_0x51c7('0x2e')][_0x51c7('0x1a')]);_0x104315[_0x51c7('0x1c')]=qs[_0x51c7('0x1c')](_0x42745b['query'][_0x51c7('0x1c')]);}_0x104315[_0x51c7('0x36')]=qs[_0x51c7('0x37')](_0x42745b[_0x51c7('0x2e')][_0x51c7('0x37')]);_0x104315['where']=qs[_0x51c7('0x2f')](_['pick'](_0x42745b[_0x51c7('0x2e')],_0x16db1b['filters']),_0xc1688f);if(_0x42745b[_0x51c7('0x2e')][_0x51c7('0x38')]){_0x104315['where']=_[_0x51c7('0x39')](_0x104315[_0x51c7('0x3a')],{'$or':_[_0x51c7('0x27')](_0xc1688f,function(_0x2b02d6){if(_0x2b02d6['type']!=='VIRTUAL'){var _0xde9936={};_0xde9936[_0x2b02d6[_0x51c7('0x24')]]={'$like':'%'+_0x42745b[_0x51c7('0x2e')][_0x51c7('0x38')]+'%'};return _0xde9936;}})});}_0x104315=_['merge']({},_0x104315,_0x42745b[_0x51c7('0x3b')]);var _0x4c0a28={'where':_0x104315[_0x51c7('0x3a')]};return db[_0x51c7('0x28')][_0x51c7('0x1b')](_0x4c0a28)[_0x51c7('0x21')](function(_0x53a154){_0x59cb23[_0x51c7('0x1b')]=_0x53a154;if(_0x42745b[_0x51c7('0x2e')][_0x51c7('0x3c')]){_0x104315[_0x51c7('0x3d')]=[{'all':!![]}];}return db[_0x51c7('0x28')][_0x51c7('0x3e')](_0x104315);})['then'](function(_0x4e908a){_0x59cb23[_0x51c7('0x3f')]=_0x4e908a;return _0x59cb23;})[_0x51c7('0x21')](respondWithFilteredResult(_0x2a18e0,_0x104315))['catch'](handleError(_0x2a18e0,null));};exports[_0x51c7('0x40')]=function(_0x20aa9f,_0xe82611){var _0x3d8994={'raw':!![],'where':{'id':_0x20aa9f[_0x51c7('0x41')]['id']}},_0x3add13={};_0x3add13[_0x51c7('0x2d')]=_[_0x51c7('0x42')](db[_0x51c7('0x28')][_0x51c7('0x29')]);_0x3add13['query']=_['keys'](_0x20aa9f[_0x51c7('0x2e')]);_0x3add13[_0x51c7('0x2f')]=_[_0x51c7('0x30')](_0x3add13[_0x51c7('0x2d')],_0x3add13['query']);_0x3d8994['attributes']=_[_0x51c7('0x30')](_0x3add13[_0x51c7('0x2d')],qs[_0x51c7('0x32')](_0x20aa9f['query'][_0x51c7('0x32')]));_0x3d8994[_0x51c7('0x31')]=_0x3d8994[_0x51c7('0x31')][_0x51c7('0x33')]?_0x3d8994['attributes']:_0x3add13[_0x51c7('0x2d')];if(_0x20aa9f['query'][_0x51c7('0x3c')]){_0x3d8994[_0x51c7('0x3d')]=[{'all':!![]}];}_0x3d8994=_[_0x51c7('0x39')]({},_0x3d8994,_0x20aa9f[_0x51c7('0x3b')]);return db['ChatQueueReport']['find'](_0x3d8994)['then'](handleEntityNotFound(_0xe82611,null))[_0x51c7('0x21')](respondWithResult(_0xe82611,null))[_0x51c7('0x43')](handleError(_0xe82611,null));};exports['create']=function(_0x57c878,_0x54b156){return db[_0x51c7('0x28')]['create'](_0x57c878[_0x51c7('0x44')],{})[_0x51c7('0x21')](respondWithResult(_0x54b156,0xc9))[_0x51c7('0x43')](handleError(_0x54b156,null));};exports[_0x51c7('0x45')]=function(_0x513743,_0x44f2ad){if(_0x513743[_0x51c7('0x44')]['id']){delete _0x513743[_0x51c7('0x44')]['id'];}return db[_0x51c7('0x28')][_0x51c7('0x46')]({'where':{'id':_0x513743[_0x51c7('0x41')]['id']}})[_0x51c7('0x21')](handleEntityNotFound(_0x44f2ad,null))[_0x51c7('0x21')](saveUpdates(_0x513743['body'],null))[_0x51c7('0x21')](respondWithResult(_0x44f2ad,null))[_0x51c7('0x43')](handleError(_0x44f2ad,null));};exports[_0x51c7('0x47')]=function(_0x5b3023,_0x1134ac){return db['ChatQueueReport'][_0x51c7('0x46')]({'where':{'id':_0x5b3023[_0x51c7('0x41')]['id']}})[_0x51c7('0x21')](handleEntityNotFound(_0x1134ac,null))[_0x51c7('0x21')](removeEntity(_0x1134ac,null))[_0x51c7('0x43')](handleError(_0x1134ac,null));};exports[_0x51c7('0x48')]=function(_0x58097b,_0x59c57b){return db[_0x51c7('0x28')][_0x51c7('0x48')]()[_0x51c7('0x21')](respondWithResult(_0x59c57b,null))[_0x51c7('0x43')](handleError(_0x59c57b,null));}; \ No newline at end of file +var _0xdd68=['name','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','catch','show','params','options','find','create','body','update','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','then','error','stack'];(function(_0x1f8223,_0x2e2b29){var _0x4aa535=function(_0x338b17){while(--_0x338b17){_0x1f8223['push'](_0x1f8223['shift']());}};_0x4aa535(++_0x2e2b29);}(_0xdd68,0x196));var _0x8dd6=function(_0x39780c,_0x5782c9){_0x39780c=_0x39780c-0x0;var _0x53c19b=_0xdd68[_0x39780c];return _0x53c19b;};'use strict';var emlformat=require(_0x8dd6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8dd6('0x1'));var jsonpatch=require(_0x8dd6('0x2'));var rp=require(_0x8dd6('0x3'));var moment=require(_0x8dd6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8dd6('0x5'));var util=require(_0x8dd6('0x6'));var path=require('path');var sox=require(_0x8dd6('0x7'));var csv=require(_0x8dd6('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8dd6('0x9'));var _=require('lodash');var squel=require(_0x8dd6('0xa'));var crypto=require('crypto');var jsforce=require(_0x8dd6('0xb'));var deskjs=require(_0x8dd6('0xc'));var toCsv=require(_0x8dd6('0x8'));var querystring=require('querystring');var Papa=require(_0x8dd6('0xd'));var Redis=require(_0x8dd6('0xe'));var authService=require(_0x8dd6('0xf'));var qs=require(_0x8dd6('0x10'));var as=require(_0x8dd6('0x11'));var hardwareService=require(_0x8dd6('0x12'));var logger=require(_0x8dd6('0x13'))(_0x8dd6('0x14'));var utils=require(_0x8dd6('0x15'));var config=require(_0x8dd6('0x16'));var licenseUtil=require(_0x8dd6('0x17'));var db=require(_0x8dd6('0x18'))['db'];function respondWithStatusCode(_0x3e7182,_0x59456c){_0x59456c=_0x59456c||0xcc;return function(_0x3bf24f){if(_0x3bf24f){return _0x3e7182[_0x8dd6('0x19')](_0x59456c);}return _0x3e7182[_0x8dd6('0x1a')](_0x59456c)['end']();};}function respondWithResult(_0x5957be,_0x41b21f){_0x41b21f=_0x41b21f||0xc8;return function(_0x4c8ff4){if(_0x4c8ff4){return _0x5957be['status'](_0x41b21f)[_0x8dd6('0x1b')](_0x4c8ff4);}};}function respondWithFilteredResult(_0xd906ee,_0x2e9882){return function(_0x469c11){if(_0x469c11){var _0x124e1d=typeof _0x2e9882[_0x8dd6('0x1c')]===_0x8dd6('0x1d')&&typeof _0x2e9882[_0x8dd6('0x1e')]===_0x8dd6('0x1d');var _0x5496cc=_0x469c11[_0x8dd6('0x1f')];var _0x1f910a=_0x124e1d?0x0:_0x2e9882[_0x8dd6('0x1c')];var _0x168a30=_0x124e1d?_0x469c11[_0x8dd6('0x1f')]:_0x2e9882[_0x8dd6('0x1c')]+_0x2e9882[_0x8dd6('0x1e')];var _0x40f9eb;if(_0x168a30>=_0x5496cc){_0x168a30=_0x5496cc;_0x40f9eb=0xc8;}else{_0x40f9eb=0xce;}_0xd906ee['status'](_0x40f9eb);return _0xd906ee[_0x8dd6('0x20')](_0x8dd6('0x21'),_0x1f910a+'-'+_0x168a30+'/'+_0x5496cc)['json'](_0x469c11);}return null;};}function patchUpdates(_0x40d5a5){return function(_0x107bdd){try{jsonpatch[_0x8dd6('0x22')](_0x107bdd,_0x40d5a5,!![]);}catch(_0x2c67e8){return BPromise['reject'](_0x2c67e8);}return _0x107bdd['save']();};}function saveUpdates(_0x488b47,_0x138216){return function(_0xe6b099){if(_0xe6b099){return _0xe6b099['update'](_0x488b47)[_0x8dd6('0x23')](function(_0x31b588){return _0x31b588;});}return null;};}function removeEntity(_0x29d4c8,_0x1485d4){return function(_0x3a4c9f){if(_0x3a4c9f){return _0x3a4c9f['destroy']()[_0x8dd6('0x23')](function(){_0x29d4c8[_0x8dd6('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50f513,_0x1784a9){return function(_0xeeda3){if(!_0xeeda3){_0x50f513['sendStatus'](0x194);}return _0xeeda3;};}function handleError(_0x2d3205,_0x3e05fa){_0x3e05fa=_0x3e05fa||0x1f4;return function(_0x14cce1){logger[_0x8dd6('0x24')](_0x14cce1[_0x8dd6('0x25')]);if(_0x14cce1['name']){delete _0x14cce1[_0x8dd6('0x26')];}_0x2d3205[_0x8dd6('0x1a')](_0x3e05fa)['send'](_0x14cce1);};}exports['index']=function(_0x25eba7,_0x3f4975){var _0x4328c4={},_0x44c282={},_0x2bbe93={'count':0x0,'rows':[]};var _0x3da00d=_[_0x8dd6('0x27')](db[_0x8dd6('0x28')][_0x8dd6('0x29')],function(_0x35c9ae){return{'name':_0x35c9ae[_0x8dd6('0x2a')],'type':_0x35c9ae[_0x8dd6('0x2b')][_0x8dd6('0x2c')]};});_0x44c282[_0x8dd6('0x2d')]=_[_0x8dd6('0x27')](_0x3da00d,_0x8dd6('0x26'));_0x44c282[_0x8dd6('0x2e')]=_[_0x8dd6('0x2f')](_0x25eba7[_0x8dd6('0x2e')]);_0x44c282[_0x8dd6('0x30')]=_[_0x8dd6('0x31')](_0x44c282[_0x8dd6('0x2d')],_0x44c282['query']);_0x4328c4[_0x8dd6('0x32')]=_[_0x8dd6('0x31')](_0x44c282[_0x8dd6('0x2d')],qs[_0x8dd6('0x33')](_0x25eba7['query'][_0x8dd6('0x33')]));_0x4328c4['attributes']=_0x4328c4['attributes'][_0x8dd6('0x34')]?_0x4328c4[_0x8dd6('0x32')]:_0x44c282['model'];if(!_0x25eba7[_0x8dd6('0x2e')][_0x8dd6('0x35')](_0x8dd6('0x36'))){_0x4328c4[_0x8dd6('0x1e')]=qs[_0x8dd6('0x1e')](_0x25eba7['query'][_0x8dd6('0x1e')]);_0x4328c4[_0x8dd6('0x1c')]=qs[_0x8dd6('0x1c')](_0x25eba7[_0x8dd6('0x2e')][_0x8dd6('0x1c')]);}_0x4328c4[_0x8dd6('0x37')]=qs[_0x8dd6('0x38')](_0x25eba7['query'][_0x8dd6('0x38')]);_0x4328c4[_0x8dd6('0x39')]=qs[_0x8dd6('0x30')](_[_0x8dd6('0x3a')](_0x25eba7[_0x8dd6('0x2e')],_0x44c282[_0x8dd6('0x30')]),_0x3da00d);if(_0x25eba7['query'][_0x8dd6('0x3b')]){_0x4328c4[_0x8dd6('0x39')]=_[_0x8dd6('0x3c')](_0x4328c4[_0x8dd6('0x39')],{'$or':_[_0x8dd6('0x27')](_0x3da00d,function(_0x1bf125){if(_0x1bf125[_0x8dd6('0x2b')]!=='VIRTUAL'){var _0x1b3f5d={};_0x1b3f5d[_0x1bf125[_0x8dd6('0x26')]]={'$like':'%'+_0x25eba7[_0x8dd6('0x2e')]['filter']+'%'};return _0x1b3f5d;}})});}_0x4328c4=_[_0x8dd6('0x3c')]({},_0x4328c4,_0x25eba7['options']);var _0x83ec4b={'where':_0x4328c4[_0x8dd6('0x39')]};return db[_0x8dd6('0x28')][_0x8dd6('0x1f')](_0x83ec4b)['then'](function(_0x1fea6d){_0x2bbe93[_0x8dd6('0x1f')]=_0x1fea6d;if(_0x25eba7[_0x8dd6('0x2e')][_0x8dd6('0x3d')]){_0x4328c4[_0x8dd6('0x3e')]=[{'all':!![]}];}return db[_0x8dd6('0x28')][_0x8dd6('0x3f')](_0x4328c4);})[_0x8dd6('0x23')](function(_0x1e1830){_0x2bbe93['rows']=_0x1e1830;return _0x2bbe93;})[_0x8dd6('0x23')](respondWithFilteredResult(_0x3f4975,_0x4328c4))[_0x8dd6('0x40')](handleError(_0x3f4975,null));};exports[_0x8dd6('0x41')]=function(_0x4309a6,_0x22d3b8){var _0x45577e={'raw':!![],'where':{'id':_0x4309a6[_0x8dd6('0x42')]['id']}},_0x31f1d3={};_0x31f1d3[_0x8dd6('0x2d')]=_[_0x8dd6('0x2f')](db['ChatQueueReport'][_0x8dd6('0x29')]);_0x31f1d3['query']=_[_0x8dd6('0x2f')](_0x4309a6[_0x8dd6('0x2e')]);_0x31f1d3['filters']=_[_0x8dd6('0x31')](_0x31f1d3[_0x8dd6('0x2d')],_0x31f1d3[_0x8dd6('0x2e')]);_0x45577e[_0x8dd6('0x32')]=_[_0x8dd6('0x31')](_0x31f1d3[_0x8dd6('0x2d')],qs['fields'](_0x4309a6[_0x8dd6('0x2e')]['fields']));_0x45577e[_0x8dd6('0x32')]=_0x45577e[_0x8dd6('0x32')]['length']?_0x45577e[_0x8dd6('0x32')]:_0x31f1d3['model'];if(_0x4309a6['query'][_0x8dd6('0x3d')]){_0x45577e['include']=[{'all':!![]}];}_0x45577e=_[_0x8dd6('0x3c')]({},_0x45577e,_0x4309a6[_0x8dd6('0x43')]);return db[_0x8dd6('0x28')][_0x8dd6('0x44')](_0x45577e)['then'](handleEntityNotFound(_0x22d3b8,null))[_0x8dd6('0x23')](respondWithResult(_0x22d3b8,null))[_0x8dd6('0x40')](handleError(_0x22d3b8,null));};exports[_0x8dd6('0x45')]=function(_0x22a0b1,_0x701549){return db[_0x8dd6('0x28')][_0x8dd6('0x45')](_0x22a0b1[_0x8dd6('0x46')],{})['then'](respondWithResult(_0x701549,0xc9))[_0x8dd6('0x40')](handleError(_0x701549,null));};exports[_0x8dd6('0x47')]=function(_0x212929,_0x4a1550){if(_0x212929['body']['id']){delete _0x212929[_0x8dd6('0x46')]['id'];}return db[_0x8dd6('0x28')][_0x8dd6('0x44')]({'where':{'id':_0x212929['params']['id']}})[_0x8dd6('0x23')](handleEntityNotFound(_0x4a1550,null))[_0x8dd6('0x23')](saveUpdates(_0x212929['body'],null))['then'](respondWithResult(_0x4a1550,null))['catch'](handleError(_0x4a1550,null));};exports[_0x8dd6('0x48')]=function(_0x513178,_0x1a919a){return db['ChatQueueReport'][_0x8dd6('0x44')]({'where':{'id':_0x513178[_0x8dd6('0x42')]['id']}})[_0x8dd6('0x23')](handleEntityNotFound(_0x1a919a,null))['then'](removeEntity(_0x1a919a,null))[_0x8dd6('0x40')](handleError(_0x1a919a,null));};exports[_0x8dd6('0x49')]=function(_0x4699be,_0x75dfcc){return db[_0x8dd6('0x28')][_0x8dd6('0x49')]()[_0x8dd6('0x23')](respondWithResult(_0x75dfcc,null))[_0x8dd6('0x40')](handleError(_0x75dfcc,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 6af70a5..2f1e0b6 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','uniqueid','lodash'];(function(_0x4fb2dd,_0x6f90bb){var _0x2156d9=function(_0x4d1f06){while(--_0x4d1f06){_0x4fb2dd['push'](_0x4fb2dd['shift']());}};_0x2156d9(++_0x6f90bb);}(_0xb7e7,0x121));var _0x7b7e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xb7e7[_0x9aada2];return _0x196dff;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['define','report_chat_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x26bae4,_0x59cb48){var _0xa38b80=function(_0x401077){while(--_0x401077){_0x26bae4['push'](_0x26bae4['shift']());}};_0xa38b80(++_0x59cb48);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./chatQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('ChatQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 1bc2975..2967576 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 _0xcc5e=['message','catch','CreateChatQueueReport','create','body','options','raw','then','attributes','limit','UpdateChatQueueReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueueReport,\x20%s,\x20%s'];(function(_0x165f3f,_0x3605d2){var _0xeb50aa=function(_0x50105c){while(--_0x50105c){_0x165f3f['push'](_0x165f3f['shift']());}};_0xeb50aa(++_0x3605d2);}(_0xcc5e,0x12b));var _0xecc5=function(_0x5944e9,_0xf3da60){_0x5944e9=_0x5944e9-0x0;var _0x1098b8=_0xcc5e[_0x5944e9];return _0x1098b8;};'use strict';var _=require(_0xecc5('0x0'));var util=require('util');var moment=require(_0xecc5('0x1'));var BPromise=require(_0xecc5('0x2'));var rs=require(_0xecc5('0x3'));var fs=require('fs');var Redis=require(_0xecc5('0x4'));var db=require(_0xecc5('0x5'))['db'];var utils=require(_0xecc5('0x6'));var logger=require('../../config/logger')(_0xecc5('0x7'));var config=require(_0xecc5('0x8'));var jayson=require(_0xecc5('0x9'));var client=jayson[_0xecc5('0xa')][_0xecc5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4184f8,_0x6ab1cb,_0x3db0d6){return new BPromise(function(_0x3ab37f,_0x458eb7){return client[_0xecc5('0xc')](_0x4184f8,_0x3db0d6)['then'](function(_0x13624b){logger[_0xecc5('0xd')]('ChatQueueReport,\x20%s,\x20%s',_0x6ab1cb,_0xecc5('0xe'));logger[_0xecc5('0xf')](_0xecc5('0x10'),_0x6ab1cb,_0xecc5('0xe'),JSON[_0xecc5('0x11')](_0x13624b));if(_0x13624b[_0xecc5('0x12')]){if(_0x13624b[_0xecc5('0x12')][_0xecc5('0x13')]===0x1f4){logger[_0xecc5('0x12')](_0xecc5('0x14'),_0x6ab1cb,_0x13624b[_0xecc5('0x12')][_0xecc5('0x15')]);return _0x458eb7(_0x13624b[_0xecc5('0x12')][_0xecc5('0x15')]);}logger[_0xecc5('0x12')](_0xecc5('0x14'),_0x6ab1cb,_0x13624b[_0xecc5('0x12')]['message']);return _0x3ab37f(_0x13624b['error']['message']);}else{logger[_0xecc5('0xd')](_0xecc5('0x14'),_0x6ab1cb,_0xecc5('0xe'));_0x3ab37f(_0x13624b['result'][_0xecc5('0x15')]);}})[_0xecc5('0x16')](function(_0x5e8447){logger[_0xecc5('0x12')]('ChatQueueReport,\x20%s,\x20%s',_0x6ab1cb,_0x5e8447);_0x458eb7(_0x5e8447);});});}exports[_0xecc5('0x17')]=function(_0x1f17cb){var _0x230b5b=this;return new Promise(function(_0x513884,_0x4022f8){return db['ChatQueueReport'][_0xecc5('0x18')](_0x1f17cb[_0xecc5('0x19')],{'raw':_0x1f17cb[_0xecc5('0x1a')]?_0x1f17cb[_0xecc5('0x1a')][_0xecc5('0x1b')]===undefined?!![]:![]:!![]})[_0xecc5('0x1c')](function(_0x209887){logger[_0xecc5('0xd')](_0xecc5('0x17'),_0x1f17cb);logger[_0xecc5('0xf')](_0xecc5('0x17'),_0x1f17cb,JSON[_0xecc5('0x11')](_0x209887));_0x513884(_0x209887);})[_0xecc5('0x16')](function(_0x3e5ea9){logger[_0xecc5('0x12')](_0xecc5('0x17'),_0x3e5ea9[_0xecc5('0x15')],_0x1f17cb);_0x4022f8(_0x230b5b['error'](0x1f4,_0x3e5ea9[_0xecc5('0x15')]));});});};exports['UpdateChatQueueReport']=function(_0x201114){var _0x594dd3=this;return new Promise(function(_0x3698e8,_0x275726){return db['ChatQueueReport']['update'](_0x201114[_0xecc5('0x19')],{'raw':_0x201114['options']?_0x201114['options'][_0xecc5('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x201114[_0xecc5('0x1a')]?_0x201114['options']['where']||null:null,'attributes':_0x201114[_0xecc5('0x1a')]?_0x201114[_0xecc5('0x1a')][_0xecc5('0x1d')]||null:null,'limit':_0x201114[_0xecc5('0x1a')]?_0x201114[_0xecc5('0x1a')][_0xecc5('0x1e')]||null:null})[_0xecc5('0x1c')](function(_0x4cbc08){logger[_0xecc5('0xd')](_0xecc5('0x1f'),_0x201114);logger['debug'](_0xecc5('0x1f'),_0x201114,JSON[_0xecc5('0x11')](_0x4cbc08));_0x3698e8(_0x4cbc08);})['catch'](function(_0x2dd470){logger[_0xecc5('0x12')]('UpdateChatQueueReport',_0x2dd470[_0xecc5('0x15')],_0x201114);_0x275726(_0x594dd3[_0xecc5('0x12')](0x1f4,_0x2dd470[_0xecc5('0x15')]));});});}; \ No newline at end of file +var _0x37e9=['client','http','request','then','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueueReport,\x20%s,\x20%s','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','update','attributes','limit','info','UpdateChatQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x37e9,0x1f4));var _0x937e=function(_0x3db6cb,_0x558f96){_0x3db6cb=_0x3db6cb-0x0;var _0xffd156=_0x37e9[_0x3db6cb];return _0xffd156;};'use strict';var _=require('lodash');var util=require(_0x937e('0x0'));var moment=require(_0x937e('0x1'));var BPromise=require(_0x937e('0x2'));var rs=require(_0x937e('0x3'));var fs=require('fs');var Redis=require(_0x937e('0x4'));var db=require(_0x937e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x937e('0x6'))(_0x937e('0x7'));var config=require(_0x937e('0x8'));var jayson=require(_0x937e('0x9'));var client=jayson[_0x937e('0xa')][_0x937e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a648d,_0x3bc4c4,_0x214b0d){return new BPromise(function(_0x327f70,_0x54a357){return client[_0x937e('0xc')](_0x5a648d,_0x214b0d)[_0x937e('0xd')](function(_0x109aa3){logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x3bc4c4,_0x937e('0xe'));logger['debug'](_0x937e('0xf'),_0x3bc4c4,_0x937e('0xe'),JSON[_0x937e('0x10')](_0x109aa3));if(_0x109aa3['error']){if(_0x109aa3[_0x937e('0x11')][_0x937e('0x12')]===0x1f4){logger['error'](_0x937e('0x13'),_0x3bc4c4,_0x109aa3[_0x937e('0x11')][_0x937e('0x14')]);return _0x54a357(_0x109aa3[_0x937e('0x11')][_0x937e('0x14')]);}logger[_0x937e('0x11')](_0x937e('0x13'),_0x3bc4c4,_0x109aa3[_0x937e('0x11')]['message']);return _0x327f70(_0x109aa3[_0x937e('0x11')][_0x937e('0x14')]);}else{logger['info'](_0x937e('0x13'),_0x3bc4c4,_0x937e('0xe'));_0x327f70(_0x109aa3[_0x937e('0x15')][_0x937e('0x14')]);}})[_0x937e('0x16')](function(_0x3b2647){logger[_0x937e('0x11')](_0x937e('0x13'),_0x3bc4c4,_0x3b2647);_0x54a357(_0x3b2647);});});}exports[_0x937e('0x17')]=function(_0xe76e5b){var _0x1a059f=this;return new Promise(function(_0x4ae425,_0x4da5b6){return db[_0x937e('0x18')][_0x937e('0x19')](_0xe76e5b[_0x937e('0x1a')],{'raw':_0xe76e5b[_0x937e('0x1b')]?_0xe76e5b[_0x937e('0x1b')][_0x937e('0x1c')]===undefined?!![]:![]:!![]})[_0x937e('0xd')](function(_0xb3fdfe){logger['info'](_0x937e('0x17'),_0xe76e5b);logger['debug'](_0x937e('0x17'),_0xe76e5b,JSON[_0x937e('0x10')](_0xb3fdfe));_0x4ae425(_0xb3fdfe);})[_0x937e('0x16')](function(_0x35d7ef){logger[_0x937e('0x11')](_0x937e('0x17'),_0x35d7ef[_0x937e('0x14')],_0xe76e5b);_0x4da5b6(_0x1a059f['error'](0x1f4,_0x35d7ef[_0x937e('0x14')]));});});};exports['UpdateChatQueueReport']=function(_0x2e5a16){var _0x2c7e2c=this;return new Promise(function(_0x3ac0fb,_0x578b72){return db[_0x937e('0x18')][_0x937e('0x1d')](_0x2e5a16[_0x937e('0x1a')],{'raw':_0x2e5a16[_0x937e('0x1b')]?_0x2e5a16[_0x937e('0x1b')][_0x937e('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e5a16[_0x937e('0x1b')]?_0x2e5a16[_0x937e('0x1b')]['where']||null:null,'attributes':_0x2e5a16['options']?_0x2e5a16[_0x937e('0x1b')][_0x937e('0x1e')]||null:null,'limit':_0x2e5a16[_0x937e('0x1b')]?_0x2e5a16[_0x937e('0x1b')][_0x937e('0x1f')]||null:null})['then'](function(_0x511fe4){logger[_0x937e('0x20')](_0x937e('0x21'),_0x2e5a16);logger['debug'](_0x937e('0x21'),_0x2e5a16,JSON['stringify'](_0x511fe4));_0x3ac0fb(_0x511fe4);})[_0x937e('0x16')](function(_0x2ee7c3){logger[_0x937e('0x11')]('UpdateChatQueueReport',_0x2ee7c3['message'],_0x2e5a16);_0x578b72(_0x2c7e2c[_0x937e('0x11')](0x1f4,_0x2ee7c3['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 74493bc..7e867fc 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 _0xfdfe=['/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','put'];(function(_0x4fd533,_0x32eb4b){var _0x3c7964=function(_0x30de83){while(--_0x30de83){_0x4fd533['push'](_0x4fd533['shift']());}};_0x3c7964(++_0x32eb4b);}(_0xfdfe,0xf5));var _0xefdf=function(_0x521aa0,_0x1a71c2){_0x521aa0=_0x521aa0-0x0;var _0x2e102c=_0xfdfe[_0x521aa0];return _0x2e102c;};'use strict';var multer=require(_0xefdf('0x0'));var util=require(_0xefdf('0x1'));var path=require(_0xefdf('0x2'));var timeout=require(_0xefdf('0x3'));var express=require('express');var router=express[_0xefdf('0x4')]();var fs_extra=require(_0xefdf('0x5'));var auth=require(_0xefdf('0x6'));var interaction=require(_0xefdf('0x7'));var config=require(_0xefdf('0x8'));var controller=require('./chatQueueReport.controller');router[_0xefdf('0x9')]('/',auth['isAuthenticated'](),controller[_0xefdf('0xa')]);router[_0xefdf('0x9')](_0xefdf('0xb'),auth[_0xefdf('0xc')](),controller[_0xefdf('0xd')]);router[_0xefdf('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xefdf('0xc')](),controller['create']);router[_0xefdf('0xe')](_0xefdf('0xf'),auth[_0xefdf('0xc')](),controller[_0xefdf('0x10')]);router[_0xefdf('0x11')]('/:id',auth[_0xefdf('0xc')](),controller[_0xefdf('0x12')]);module[_0xefdf('0x13')]=router; \ No newline at end of file +var _0xedfb=['delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','index','isAuthenticated','describe','show','post','create','put','/:id'];(function(_0x18a5a0,_0x55f44a){var _0x4854e9=function(_0x5ec295){while(--_0x5ec295){_0x18a5a0['push'](_0x18a5a0['shift']());}};_0x4854e9(++_0x55f44a);}(_0xedfb,0x192));var _0xbedf=function(_0x3079b9,_0x58d2f4){_0x3079b9=_0x3079b9-0x0;var _0x105101=_0xedfb[_0x3079b9];return _0x105101;};'use strict';var multer=require(_0xbedf('0x0'));var util=require(_0xbedf('0x1'));var path=require(_0xbedf('0x2'));var timeout=require(_0xbedf('0x3'));var express=require(_0xbedf('0x4'));var router=express['Router']();var fs_extra=require(_0xbedf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xbedf('0x6'));var config=require(_0xbedf('0x7'));var controller=require(_0xbedf('0x8'));router[_0xbedf('0x9')]('/',auth['isAuthenticated'](),controller[_0xbedf('0xa')]);router[_0xbedf('0x9')]('/describe',auth[_0xbedf('0xb')](),controller[_0xbedf('0xc')]);router['get']('/:id',auth[_0xbedf('0xb')](),controller[_0xbedf('0xd')]);router[_0xbedf('0xe')]('/',auth[_0xbedf('0xb')](),controller[_0xbedf('0xf')]);router[_0xbedf('0x10')](_0xbedf('0x11'),auth[_0xbedf('0xb')](),controller['update']);router[_0xbedf('0x12')](_0xbedf('0x11'),auth[_0xbedf('0xb')](),controller[_0xbedf('0x13')]);module[_0xbedf('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 7e4ed11..11cd549 100644 --- a/server/api/chatTransferReport/chatTransferReport.attributes.js +++ b/server/api/chatTransferReport/chatTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x53832d,_0x49cec2){var _0x20efe2=function(_0x7fd41c){while(--_0x7fd41c){_0x53832d['push'](_0x53832d['shift']());}};_0x20efe2(++_0x49cec2);}(_0x008c,0x188));var _0xc008=function(_0xcc26d2,_0x20c921){_0xcc26d2=_0xcc26d2-0x0;var _0x3841e2=_0x008c[_0xcc26d2];return _0x3841e2;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file +var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x3cdfeb,_0x1ff1ad){var _0x23b4e6=function(_0x1c2581){while(--_0x1c2581){_0x3cdfeb['push'](_0x3cdfeb['shift']());}};_0x23b4e6(++_0x1ff1ad);}(_0xf4eb,0xec));var _0xbf4e=function(_0x445068,_0x250944){_0x445068=_0x445068-0x0;var _0x234ca9=_0xf4eb[_0x445068];return _0x234ca9;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index debebba..7ff0412 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 _0xd574=['eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','map','ChatTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','include','options','find','create','body','params','describe'];(function(_0xe7a4b5,_0x200412){var _0xe5bb55=function(_0x3ab258){while(--_0x3ab258){_0xe7a4b5['push'](_0xe7a4b5['shift']());}};_0xe5bb55(++_0x200412);}(_0xd574,0x18b));var _0x4d57=function(_0x4074ea,_0x2a0627){_0x4074ea=_0x4074ea-0x0;var _0x1bb15d=_0xd574[_0x4074ea];return _0x1bb15d;};'use strict';var emlformat=require(_0x4d57('0x0'));var rimraf=require(_0x4d57('0x1'));var zipdir=require(_0x4d57('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4d57('0x3'));var moment=require(_0x4d57('0x4'));var BPromise=require(_0x4d57('0x5'));var Mustache=require(_0x4d57('0x6'));var util=require(_0x4d57('0x7'));var path=require(_0x4d57('0x8'));var sox=require(_0x4d57('0x9'));var csv=require(_0x4d57('0xa'));var ejs=require(_0x4d57('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4d57('0xc'));var squel=require(_0x4d57('0xd'));var crypto=require(_0x4d57('0xe'));var jsforce=require(_0x4d57('0xf'));var deskjs=require(_0x4d57('0x10'));var toCsv=require('to-csv');var querystring=require(_0x4d57('0x11'));var Papa=require('papaparse');var Redis=require(_0x4d57('0x12'));var authService=require(_0x4d57('0x13'));var qs=require(_0x4d57('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4d57('0x15'));var logger=require('../../config/logger')(_0x4d57('0x16'));var utils=require(_0x4d57('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4d57('0x18'));var db=require(_0x4d57('0x19'))['db'];function respondWithStatusCode(_0x33840d,_0x42855c){_0x42855c=_0x42855c||0xcc;return function(_0x20b846){if(_0x20b846){return _0x33840d[_0x4d57('0x1a')](_0x42855c);}return _0x33840d[_0x4d57('0x1b')](_0x42855c)['end']();};}function respondWithResult(_0x9b6f66,_0x1ee587){_0x1ee587=_0x1ee587||0xc8;return function(_0x23a102){if(_0x23a102){return _0x9b6f66['status'](_0x1ee587)['json'](_0x23a102);}};}function respondWithFilteredResult(_0x586480,_0x3b2956){return function(_0x20ed64){if(_0x20ed64){var _0x319f5f=typeof _0x3b2956[_0x4d57('0x1c')]==='undefined'&&typeof _0x3b2956[_0x4d57('0x1d')]===_0x4d57('0x1e');var _0x298df0=_0x20ed64[_0x4d57('0x1f')];var _0x41a0af=_0x319f5f?0x0:_0x3b2956[_0x4d57('0x1c')];var _0x84dfbc=_0x319f5f?_0x20ed64['count']:_0x3b2956['offset']+_0x3b2956[_0x4d57('0x1d')];var _0x446005;if(_0x84dfbc>=_0x298df0){_0x84dfbc=_0x298df0;_0x446005=0xc8;}else{_0x446005=0xce;}_0x586480[_0x4d57('0x1b')](_0x446005);return _0x586480[_0x4d57('0x20')](_0x4d57('0x21'),_0x41a0af+'-'+_0x84dfbc+'/'+_0x298df0)['json'](_0x20ed64);}return null;};}function patchUpdates(_0x200ad9){return function(_0x6c097d){try{jsonpatch[_0x4d57('0x22')](_0x6c097d,_0x200ad9,!![]);}catch(_0x135da0){return BPromise[_0x4d57('0x23')](_0x135da0);}return _0x6c097d[_0x4d57('0x24')]();};}function saveUpdates(_0x109352,_0x17cdb8){return function(_0x639625){if(_0x639625){return _0x639625[_0x4d57('0x25')](_0x109352)[_0x4d57('0x26')](function(_0x39d0da){return _0x39d0da;});}return null;};}function removeEntity(_0x16a37d,_0x34c215){return function(_0x5c2dcb){if(_0x5c2dcb){return _0x5c2dcb[_0x4d57('0x27')]()[_0x4d57('0x26')](function(){_0x16a37d[_0x4d57('0x1b')](0xcc)[_0x4d57('0x28')]();});}};}function handleEntityNotFound(_0x1ee597,_0x4017c7){return function(_0x223880){if(!_0x223880){_0x1ee597[_0x4d57('0x1a')](0x194);}return _0x223880;};}function handleError(_0x585649,_0x212a6f){_0x212a6f=_0x212a6f||0x1f4;return function(_0x4c05ad){logger['error'](_0x4c05ad[_0x4d57('0x29')]);if(_0x4c05ad[_0x4d57('0x2a')]){delete _0x4c05ad[_0x4d57('0x2a')];}_0x585649[_0x4d57('0x1b')](_0x212a6f)[_0x4d57('0x2b')](_0x4c05ad);};}exports['index']=function(_0x3d2efc,_0x17f2a3){var _0xa00024={},_0x1909e0={},_0x55e3f4={'count':0x0,'rows':[]};var _0x1a2673=_[_0x4d57('0x2c')](db[_0x4d57('0x2d')][_0x4d57('0x2e')],function(_0x2c99f8){return{'name':_0x2c99f8[_0x4d57('0x2f')],'type':_0x2c99f8[_0x4d57('0x30')][_0x4d57('0x31')]};});_0x1909e0[_0x4d57('0x32')]=_[_0x4d57('0x2c')](_0x1a2673,_0x4d57('0x2a'));_0x1909e0[_0x4d57('0x33')]=_[_0x4d57('0x34')](_0x3d2efc[_0x4d57('0x33')]);_0x1909e0[_0x4d57('0x35')]=_[_0x4d57('0x36')](_0x1909e0[_0x4d57('0x32')],_0x1909e0[_0x4d57('0x33')]);_0xa00024['attributes']=_[_0x4d57('0x36')](_0x1909e0[_0x4d57('0x32')],qs['fields'](_0x3d2efc['query'][_0x4d57('0x37')]));_0xa00024[_0x4d57('0x38')]=_0xa00024[_0x4d57('0x38')][_0x4d57('0x39')]?_0xa00024['attributes']:_0x1909e0[_0x4d57('0x32')];if(!_0x3d2efc['query'][_0x4d57('0x3a')](_0x4d57('0x3b'))){_0xa00024[_0x4d57('0x1d')]=qs[_0x4d57('0x1d')](_0x3d2efc['query']['limit']);_0xa00024[_0x4d57('0x1c')]=qs['offset'](_0x3d2efc[_0x4d57('0x33')]['offset']);}_0xa00024[_0x4d57('0x3c')]=qs[_0x4d57('0x3d')](_0x3d2efc['query'][_0x4d57('0x3d')]);_0xa00024[_0x4d57('0x3e')]=qs[_0x4d57('0x35')](_[_0x4d57('0x3f')](_0x3d2efc[_0x4d57('0x33')],_0x1909e0[_0x4d57('0x35')]),_0x1a2673);if(_0x3d2efc[_0x4d57('0x33')][_0x4d57('0x40')]){_0xa00024[_0x4d57('0x3e')]=_[_0x4d57('0x41')](_0xa00024[_0x4d57('0x3e')],{'$or':_[_0x4d57('0x2c')](_0x1a2673,function(_0x2fabc4){if(_0x2fabc4[_0x4d57('0x30')]!==_0x4d57('0x42')){var _0x167120={};_0x167120[_0x2fabc4[_0x4d57('0x2a')]]={'$like':'%'+_0x3d2efc[_0x4d57('0x33')][_0x4d57('0x40')]+'%'};return _0x167120;}})});}_0xa00024=_[_0x4d57('0x41')]({},_0xa00024,_0x3d2efc['options']);var _0x5d89b5={'where':_0xa00024[_0x4d57('0x3e')]};return db[_0x4d57('0x2d')]['count'](_0x5d89b5)['then'](function(_0x42cab4){_0x55e3f4[_0x4d57('0x1f')]=_0x42cab4;if(_0x3d2efc[_0x4d57('0x33')][_0x4d57('0x43')]){_0xa00024['include']=[{'all':!![]}];}return db['ChatTransferReport'][_0x4d57('0x44')](_0xa00024);})['then'](function(_0x72a11){_0x55e3f4[_0x4d57('0x45')]=_0x72a11;return _0x55e3f4;})[_0x4d57('0x26')](respondWithFilteredResult(_0x17f2a3,_0xa00024))[_0x4d57('0x46')](handleError(_0x17f2a3,null));};exports[_0x4d57('0x47')]=function(_0x418ad0,_0x36d113){var _0x114ff2={'raw':!![],'where':{'id':_0x418ad0['params']['id']}},_0x578810={};_0x578810['model']=_['keys'](db[_0x4d57('0x2d')][_0x4d57('0x2e')]);_0x578810[_0x4d57('0x33')]=_['keys'](_0x418ad0[_0x4d57('0x33')]);_0x578810[_0x4d57('0x35')]=_[_0x4d57('0x36')](_0x578810['model'],_0x578810[_0x4d57('0x33')]);_0x114ff2['attributes']=_[_0x4d57('0x36')](_0x578810[_0x4d57('0x32')],qs[_0x4d57('0x37')](_0x418ad0['query'][_0x4d57('0x37')]));_0x114ff2['attributes']=_0x114ff2['attributes'][_0x4d57('0x39')]?_0x114ff2['attributes']:_0x578810[_0x4d57('0x32')];if(_0x418ad0[_0x4d57('0x33')][_0x4d57('0x43')]){_0x114ff2[_0x4d57('0x48')]=[{'all':!![]}];}_0x114ff2=_[_0x4d57('0x41')]({},_0x114ff2,_0x418ad0[_0x4d57('0x49')]);return db[_0x4d57('0x2d')][_0x4d57('0x4a')](_0x114ff2)[_0x4d57('0x26')](handleEntityNotFound(_0x36d113,null))[_0x4d57('0x26')](respondWithResult(_0x36d113,null))['catch'](handleError(_0x36d113,null));};exports[_0x4d57('0x4b')]=function(_0x24262f,_0xaad5f4){return db[_0x4d57('0x2d')][_0x4d57('0x4b')](_0x24262f[_0x4d57('0x4c')],{})[_0x4d57('0x26')](respondWithResult(_0xaad5f4,0xc9))[_0x4d57('0x46')](handleError(_0xaad5f4,null));};exports[_0x4d57('0x25')]=function(_0x9529f5,_0x401a48){if(_0x9529f5[_0x4d57('0x4c')]['id']){delete _0x9529f5['body']['id'];}return db['ChatTransferReport'][_0x4d57('0x4a')]({'where':{'id':_0x9529f5[_0x4d57('0x4d')]['id']}})[_0x4d57('0x26')](handleEntityNotFound(_0x401a48,null))[_0x4d57('0x26')](saveUpdates(_0x9529f5[_0x4d57('0x4c')],null))[_0x4d57('0x26')](respondWithResult(_0x401a48,null))['catch'](handleError(_0x401a48,null));};exports[_0x4d57('0x27')]=function(_0x2e2686,_0x146274){return db['ChatTransferReport'][_0x4d57('0x4a')]({'where':{'id':_0x2e2686[_0x4d57('0x4d')]['id']}})[_0x4d57('0x26')](handleEntityNotFound(_0x146274,null))[_0x4d57('0x26')](removeEntity(_0x146274,null))['catch'](handleError(_0x146274,null));};exports[_0x4d57('0x4e')]=function(_0x2bb32c,_0x402304){return db[_0x4d57('0x2d')][_0x4d57('0x4e')]()[_0x4d57('0x26')](respondWithResult(_0x402304,null))[_0x4d57('0x46')](handleError(_0x402304,null));}; \ No newline at end of file +var _0x6a49=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','end','json','undefined','limit','count','offset','status','set','apply','reject','save','update','then','destroy','error','stack','send','index','map','ChatTransferReport','rawAttributes','fieldName','key','model','name','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x44e4e1,_0x5637b2){var _0x300cd2=function(_0x189eeb){while(--_0x189eeb){_0x44e4e1['push'](_0x44e4e1['shift']());}};_0x300cd2(++_0x5637b2);}(_0x6a49,0x176));var _0x96a4=function(_0x4fcd39,_0x13594a){_0x4fcd39=_0x4fcd39-0x0;var _0x151cf0=_0x6a49[_0x4fcd39];return _0x151cf0;};'use strict';var emlformat=require(_0x96a4('0x0'));var rimraf=require(_0x96a4('0x1'));var zipdir=require(_0x96a4('0x2'));var jsonpatch=require(_0x96a4('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x96a4('0x4'));var Mustache=require('mustache');var util=require(_0x96a4('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x96a4('0x6'));var ejs=require(_0x96a4('0x7'));var fs=require('fs');var fs_extra=require(_0x96a4('0x8'));var _=require(_0x96a4('0x9'));var squel=require(_0x96a4('0xa'));var crypto=require(_0x96a4('0xb'));var jsforce=require(_0x96a4('0xc'));var deskjs=require(_0x96a4('0xd'));var toCsv=require(_0x96a4('0x6'));var querystring=require(_0x96a4('0xe'));var Papa=require(_0x96a4('0xf'));var Redis=require(_0x96a4('0x10'));var authService=require(_0x96a4('0x11'));var qs=require(_0x96a4('0x12'));var as=require(_0x96a4('0x13'));var hardwareService=require(_0x96a4('0x14'));var logger=require(_0x96a4('0x15'))(_0x96a4('0x16'));var utils=require(_0x96a4('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f1356,_0x3ec4d3){_0x3ec4d3=_0x3ec4d3||0xcc;return function(_0x52782e){if(_0x52782e){return _0x4f1356[_0x96a4('0x18')](_0x3ec4d3);}return _0x4f1356['status'](_0x3ec4d3)[_0x96a4('0x19')]();};}function respondWithResult(_0x5178ce,_0x396878){_0x396878=_0x396878||0xc8;return function(_0x99a567){if(_0x99a567){return _0x5178ce['status'](_0x396878)[_0x96a4('0x1a')](_0x99a567);}};}function respondWithFilteredResult(_0xa8e3de,_0x382486){return function(_0x1e58bc){if(_0x1e58bc){var _0x59b65a=typeof _0x382486['offset']===_0x96a4('0x1b')&&typeof _0x382486[_0x96a4('0x1c')]===_0x96a4('0x1b');var _0x13bddc=_0x1e58bc['count'];var _0x28237a=_0x59b65a?0x0:_0x382486['offset'];var _0x296752=_0x59b65a?_0x1e58bc[_0x96a4('0x1d')]:_0x382486[_0x96a4('0x1e')]+_0x382486[_0x96a4('0x1c')];var _0xb55b8b;if(_0x296752>=_0x13bddc){_0x296752=_0x13bddc;_0xb55b8b=0xc8;}else{_0xb55b8b=0xce;}_0xa8e3de[_0x96a4('0x1f')](_0xb55b8b);return _0xa8e3de[_0x96a4('0x20')]('Content-Range',_0x28237a+'-'+_0x296752+'/'+_0x13bddc)[_0x96a4('0x1a')](_0x1e58bc);}return null;};}function patchUpdates(_0x3b875e){return function(_0x5597e0){try{jsonpatch[_0x96a4('0x21')](_0x5597e0,_0x3b875e,!![]);}catch(_0x138936){return BPromise[_0x96a4('0x22')](_0x138936);}return _0x5597e0[_0x96a4('0x23')]();};}function saveUpdates(_0x5d1941,_0x5e989c){return function(_0x34efbc){if(_0x34efbc){return _0x34efbc[_0x96a4('0x24')](_0x5d1941)[_0x96a4('0x25')](function(_0x3f026b){return _0x3f026b;});}return null;};}function removeEntity(_0xba7c2f,_0x5a5bbd){return function(_0x5def61){if(_0x5def61){return _0x5def61[_0x96a4('0x26')]()[_0x96a4('0x25')](function(){_0xba7c2f[_0x96a4('0x1f')](0xcc)[_0x96a4('0x19')]();});}};}function handleEntityNotFound(_0x160cd3,_0x3a3990){return function(_0x4bb7d3){if(!_0x4bb7d3){_0x160cd3[_0x96a4('0x18')](0x194);}return _0x4bb7d3;};}function handleError(_0x38ffa4,_0x52e326){_0x52e326=_0x52e326||0x1f4;return function(_0x446197){logger[_0x96a4('0x27')](_0x446197[_0x96a4('0x28')]);if(_0x446197['name']){delete _0x446197['name'];}_0x38ffa4[_0x96a4('0x1f')](_0x52e326)[_0x96a4('0x29')](_0x446197);};}exports[_0x96a4('0x2a')]=function(_0x1a539f,_0x1fba24){var _0x4a797c={},_0x4aad83={},_0x50d2a2={'count':0x0,'rows':[]};var _0x58b022=_[_0x96a4('0x2b')](db[_0x96a4('0x2c')][_0x96a4('0x2d')],function(_0x12fa4c){return{'name':_0x12fa4c[_0x96a4('0x2e')],'type':_0x12fa4c['type'][_0x96a4('0x2f')]};});_0x4aad83[_0x96a4('0x30')]=_['map'](_0x58b022,_0x96a4('0x31'));_0x4aad83[_0x96a4('0x32')]=_[_0x96a4('0x33')](_0x1a539f[_0x96a4('0x32')]);_0x4aad83[_0x96a4('0x34')]=_[_0x96a4('0x35')](_0x4aad83[_0x96a4('0x30')],_0x4aad83[_0x96a4('0x32')]);_0x4a797c[_0x96a4('0x36')]=_[_0x96a4('0x35')](_0x4aad83[_0x96a4('0x30')],qs[_0x96a4('0x37')](_0x1a539f[_0x96a4('0x32')][_0x96a4('0x37')]));_0x4a797c[_0x96a4('0x36')]=_0x4a797c[_0x96a4('0x36')][_0x96a4('0x38')]?_0x4a797c['attributes']:_0x4aad83[_0x96a4('0x30')];if(!_0x1a539f[_0x96a4('0x32')]['hasOwnProperty'](_0x96a4('0x39'))){_0x4a797c[_0x96a4('0x1c')]=qs['limit'](_0x1a539f['query'][_0x96a4('0x1c')]);_0x4a797c['offset']=qs[_0x96a4('0x1e')](_0x1a539f['query']['offset']);}_0x4a797c[_0x96a4('0x3a')]=qs['sort'](_0x1a539f[_0x96a4('0x32')][_0x96a4('0x3b')]);_0x4a797c['where']=qs[_0x96a4('0x34')](_[_0x96a4('0x3c')](_0x1a539f['query'],_0x4aad83[_0x96a4('0x34')]),_0x58b022);if(_0x1a539f[_0x96a4('0x32')][_0x96a4('0x3d')]){_0x4a797c[_0x96a4('0x3e')]=_['merge'](_0x4a797c[_0x96a4('0x3e')],{'$or':_[_0x96a4('0x2b')](_0x58b022,function(_0x5aa2fa){if(_0x5aa2fa[_0x96a4('0x3f')]!==_0x96a4('0x40')){var _0x2fe685={};_0x2fe685[_0x5aa2fa[_0x96a4('0x31')]]={'$like':'%'+_0x1a539f['query'][_0x96a4('0x3d')]+'%'};return _0x2fe685;}})});}_0x4a797c=_[_0x96a4('0x41')]({},_0x4a797c,_0x1a539f[_0x96a4('0x42')]);var _0x273dcb={'where':_0x4a797c['where']};return db[_0x96a4('0x2c')][_0x96a4('0x1d')](_0x273dcb)[_0x96a4('0x25')](function(_0x49737f){_0x50d2a2[_0x96a4('0x1d')]=_0x49737f;if(_0x1a539f['query'][_0x96a4('0x43')]){_0x4a797c[_0x96a4('0x44')]=[{'all':!![]}];}return db['ChatTransferReport'][_0x96a4('0x45')](_0x4a797c);})['then'](function(_0x3858a8){_0x50d2a2['rows']=_0x3858a8;return _0x50d2a2;})[_0x96a4('0x25')](respondWithFilteredResult(_0x1fba24,_0x4a797c))[_0x96a4('0x46')](handleError(_0x1fba24,null));};exports[_0x96a4('0x47')]=function(_0x334149,_0x1a2658){var _0x317a97={'raw':!![],'where':{'id':_0x334149[_0x96a4('0x48')]['id']}},_0x47e8a0={};_0x47e8a0[_0x96a4('0x30')]=_[_0x96a4('0x33')](db[_0x96a4('0x2c')][_0x96a4('0x2d')]);_0x47e8a0['query']=_['keys'](_0x334149[_0x96a4('0x32')]);_0x47e8a0[_0x96a4('0x34')]=_[_0x96a4('0x35')](_0x47e8a0['model'],_0x47e8a0['query']);_0x317a97[_0x96a4('0x36')]=_[_0x96a4('0x35')](_0x47e8a0['model'],qs[_0x96a4('0x37')](_0x334149[_0x96a4('0x32')][_0x96a4('0x37')]));_0x317a97[_0x96a4('0x36')]=_0x317a97[_0x96a4('0x36')][_0x96a4('0x38')]?_0x317a97[_0x96a4('0x36')]:_0x47e8a0[_0x96a4('0x30')];if(_0x334149['query']['includeAll']){_0x317a97[_0x96a4('0x44')]=[{'all':!![]}];}_0x317a97=_['merge']({},_0x317a97,_0x334149[_0x96a4('0x42')]);return db['ChatTransferReport'][_0x96a4('0x49')](_0x317a97)[_0x96a4('0x25')](handleEntityNotFound(_0x1a2658,null))['then'](respondWithResult(_0x1a2658,null))[_0x96a4('0x46')](handleError(_0x1a2658,null));};exports[_0x96a4('0x4a')]=function(_0x52115f,_0x52b87c){return db['ChatTransferReport'][_0x96a4('0x4a')](_0x52115f['body'],{})['then'](respondWithResult(_0x52b87c,0xc9))[_0x96a4('0x46')](handleError(_0x52b87c,null));};exports[_0x96a4('0x24')]=function(_0x50985b,_0x41fb0b){if(_0x50985b[_0x96a4('0x4b')]['id']){delete _0x50985b['body']['id'];}return db[_0x96a4('0x2c')][_0x96a4('0x49')]({'where':{'id':_0x50985b[_0x96a4('0x48')]['id']}})[_0x96a4('0x25')](handleEntityNotFound(_0x41fb0b,null))[_0x96a4('0x25')](saveUpdates(_0x50985b[_0x96a4('0x4b')],null))[_0x96a4('0x25')](respondWithResult(_0x41fb0b,null))[_0x96a4('0x46')](handleError(_0x41fb0b,null));};exports['destroy']=function(_0x4ae79b,_0x1f4c72){return db[_0x96a4('0x2c')]['find']({'where':{'id':_0x4ae79b[_0x96a4('0x48')]['id']}})[_0x96a4('0x25')](handleEntityNotFound(_0x1f4c72,null))[_0x96a4('0x25')](removeEntity(_0x1f4c72,null))['catch'](handleError(_0x1f4c72,null));};exports[_0x96a4('0x4c')]=function(_0x316663,_0x5c79bd){return db[_0x96a4('0x2c')][_0x96a4('0x4c')]()[_0x96a4('0x25')](respondWithResult(_0x5c79bd,null))['catch'](handleError(_0x5c79bd,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 992942d..652ce15 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 _0x0e5e=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatTransferReport.attributes','exports','ChatTransferReport','report_chat_transfer'];(function(_0x13aa15,_0x54e773){var _0x4fba46=function(_0x502698){while(--_0x502698){_0x13aa15['push'](_0x13aa15['shift']());}};_0x4fba46(++_0x54e773);}(_0x0e5e,0xef));var _0xe0e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0e5e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe0e5('0x0'));var util=require(_0xe0e5('0x1'));var logger=require(_0xe0e5('0x2'))(_0xe0e5('0x3'));var moment=require(_0xe0e5('0x4'));var BPromise=require(_0xe0e5('0x5'));var rp=require(_0xe0e5('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe0e5('0x7'));var config=require(_0xe0e5('0x8'));var attributes=require(_0xe0e5('0x9'));module[_0xe0e5('0xa')]=function(_0xd70a03,_0x1a2337){return _0xd70a03['define'](_0xe0e5('0xb'),attributes,{'tableName':_0xe0e5('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xe0e5('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbcca=['./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','lodash','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xbcca,0x1cd));var _0xabcc=function(_0xb1fcde,_0x1a23ea){_0xb1fcde=_0xb1fcde-0x0;var _0x175df2=_0xbcca[_0xb1fcde];return _0x175df2;};'use strict';var _=require(_0xabcc('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xabcc('0x1'));var moment=require(_0xabcc('0x2'));var BPromise=require(_0xabcc('0x3'));var rp=require(_0xabcc('0x4'));var fs=require('fs');var path=require(_0xabcc('0x5'));var rimraf=require('rimraf');var config=require(_0xabcc('0x6'));var attributes=require(_0xabcc('0x7'));module[_0xabcc('0x8')]=function(_0x35ffe2,_0x1e3593){return _0x35ffe2[_0xabcc('0x9')](_0xabcc('0xa'),attributes,{'tableName':_0xabcc('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 6aa6de5..72222ad 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 _0x07be=['jayson/promise','http','request','then','info','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','code','ChatTransferReport,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4bfbae,_0x2f3d5c){var _0x28a223=function(_0x445d55){while(--_0x445d55){_0x4bfbae['push'](_0x4bfbae['shift']());}};_0x28a223(++_0x2f3d5c);}(_0x07be,0x1db));var _0xe07b=function(_0x1119a2,_0x31d95b){_0x1119a2=_0x1119a2-0x0;var _0x1e633a=_0x07be[_0x1119a2];return _0x1e633a;};'use strict';var _=require(_0xe07b('0x0'));var util=require(_0xe07b('0x1'));var moment=require('moment');var BPromise=require(_0xe07b('0x2'));var rs=require(_0xe07b('0x3'));var fs=require('fs');var Redis=require(_0xe07b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe07b('0x5'));var logger=require(_0xe07b('0x6'))(_0xe07b('0x7'));var config=require(_0xe07b('0x8'));var jayson=require(_0xe07b('0x9'));var client=jayson['client'][_0xe07b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x342d14,_0x2c61d5,_0xae23e7){return new BPromise(function(_0x483b79,_0x5a55be){return client[_0xe07b('0xb')](_0x342d14,_0xae23e7)[_0xe07b('0xc')](function(_0x236f12){logger[_0xe07b('0xd')]('ChatTransferReport,\x20%s,\x20%s',_0x2c61d5,_0xe07b('0xe'));logger[_0xe07b('0xf')](_0xe07b('0x10'),_0x2c61d5,_0xe07b('0xe'),JSON['stringify'](_0x236f12));if(_0x236f12[_0xe07b('0x11')]){if(_0x236f12[_0xe07b('0x11')][_0xe07b('0x12')]===0x1f4){logger['error'](_0xe07b('0x13'),_0x2c61d5,_0x236f12[_0xe07b('0x11')]['message']);return _0x5a55be(_0x236f12[_0xe07b('0x11')][_0xe07b('0x14')]);}logger[_0xe07b('0x11')](_0xe07b('0x13'),_0x2c61d5,_0x236f12[_0xe07b('0x11')][_0xe07b('0x14')]);return _0x483b79(_0x236f12['error']['message']);}else{logger[_0xe07b('0xd')](_0xe07b('0x13'),_0x2c61d5,_0xe07b('0xe'));_0x483b79(_0x236f12[_0xe07b('0x15')][_0xe07b('0x14')]);}})['catch'](function(_0x346515){logger[_0xe07b('0x11')]('ChatTransferReport,\x20%s,\x20%s',_0x2c61d5,_0x346515);_0x5a55be(_0x346515);});});} \ No newline at end of file +var _0x7efc=['rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','ChatTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x18b027,_0x4d0486){var _0x19643f=function(_0x36753b){while(--_0x36753b){_0x18b027['push'](_0x18b027['shift']());}};_0x19643f(++_0x4d0486);}(_0x7efc,0x180));var _0xc7ef=function(_0x280c4b,_0xfe785d){_0x280c4b=_0x280c4b-0x0;var _0x2a5e90=_0x7efc[_0x280c4b];return _0x2a5e90;};'use strict';var _=require(_0xc7ef('0x0'));var util=require(_0xc7ef('0x1'));var moment=require(_0xc7ef('0x2'));var BPromise=require(_0xc7ef('0x3'));var rs=require(_0xc7ef('0x4'));var fs=require('fs');var Redis=require(_0xc7ef('0x5'));var db=require(_0xc7ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc7ef('0x7'));var config=require(_0xc7ef('0x8'));var jayson=require(_0xc7ef('0x9'));var client=jayson[_0xc7ef('0xa')][_0xc7ef('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x36fb25,_0x278d32,_0x2729c2){return new BPromise(function(_0x4fc9bf,_0x2a7701){return client['request'](_0x36fb25,_0x2729c2)[_0xc7ef('0xc')](function(_0x3ba427){logger[_0xc7ef('0xd')]('ChatTransferReport,\x20%s,\x20%s',_0x278d32,_0xc7ef('0xe'));logger[_0xc7ef('0xf')](_0xc7ef('0x10'),_0x278d32,_0xc7ef('0xe'),JSON[_0xc7ef('0x11')](_0x3ba427));if(_0x3ba427[_0xc7ef('0x12')]){if(_0x3ba427[_0xc7ef('0x12')]['code']===0x1f4){logger['error'](_0xc7ef('0x13'),_0x278d32,_0x3ba427[_0xc7ef('0x12')][_0xc7ef('0x14')]);return _0x2a7701(_0x3ba427[_0xc7ef('0x12')][_0xc7ef('0x14')]);}logger[_0xc7ef('0x12')]('ChatTransferReport,\x20%s,\x20%s',_0x278d32,_0x3ba427['error'][_0xc7ef('0x14')]);return _0x4fc9bf(_0x3ba427['error'][_0xc7ef('0x14')]);}else{logger['info'](_0xc7ef('0x13'),_0x278d32,_0xc7ef('0xe'));_0x4fc9bf(_0x3ba427[_0xc7ef('0x15')][_0xc7ef('0x14')]);}})[_0xc7ef('0x16')](function(_0x5563a0){logger[_0xc7ef('0x12')]('ChatTransferReport,\x20%s,\x20%s',_0x278d32,_0x5563a0);_0x2a7701(_0x5563a0);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 06d9d25..178d7e9 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 _0xf68a=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','post','create','put','delete','destroy','exports','multer','util','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf68a,0x66));var _0xaf68=function(_0x477d6e,_0x15001b){_0x477d6e=_0x477d6e-0x0;var _0x151daf=_0xf68a[_0x477d6e];return _0x151daf;};'use strict';var multer=require(_0xaf68('0x0'));var util=require(_0xaf68('0x1'));var path=require(_0xaf68('0x2'));var timeout=require(_0xaf68('0x3'));var express=require('express');var router=express[_0xaf68('0x4')]();var fs_extra=require(_0xaf68('0x5'));var auth=require(_0xaf68('0x6'));var interaction=require(_0xaf68('0x7'));var config=require(_0xaf68('0x8'));var controller=require('./chatTransferReport.controller');router[_0xaf68('0x9')]('/',auth['isAuthenticated'](),controller[_0xaf68('0xa')]);router['get'](_0xaf68('0xb'),auth[_0xaf68('0xc')](),controller[_0xaf68('0xd')]);router['get'](_0xaf68('0xe'),auth[_0xaf68('0xc')](),controller['show']);router[_0xaf68('0xf')]('/',auth['isAuthenticated'](),controller[_0xaf68('0x10')]);router[_0xaf68('0x11')](_0xaf68('0xe'),auth['isAuthenticated'](),controller['update']);router[_0xaf68('0x12')](_0xaf68('0xe'),auth[_0xaf68('0xc')](),controller[_0xaf68('0x13')]);module[_0xaf68('0x14')]=router; \ No newline at end of file +var _0x8e2b=['index','describe','/:id','show','post','create','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated'];(function(_0x502ed1,_0xd79589){var _0x3dd009=function(_0x41d675){while(--_0x41d675){_0x502ed1['push'](_0x502ed1['shift']());}};_0x3dd009(++_0xd79589);}(_0x8e2b,0x95));var _0xb8e2=function(_0x3e522f,_0x5c7a86){_0x3e522f=_0x3e522f-0x0;var _0x289067=_0x8e2b[_0x3e522f];return _0x289067;};'use strict';var multer=require(_0xb8e2('0x0'));var util=require('util');var path=require(_0xb8e2('0x1'));var timeout=require(_0xb8e2('0x2'));var express=require(_0xb8e2('0x3'));var router=express[_0xb8e2('0x4')]();var fs_extra=require(_0xb8e2('0x5'));var auth=require(_0xb8e2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb8e2('0x7'));var controller=require(_0xb8e2('0x8'));router[_0xb8e2('0x9')]('/',auth[_0xb8e2('0xa')](),controller[_0xb8e2('0xb')]);router[_0xb8e2('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xb8e2('0xc')]);router['get'](_0xb8e2('0xd'),auth[_0xb8e2('0xa')](),controller[_0xb8e2('0xe')]);router[_0xb8e2('0xf')]('/',auth[_0xb8e2('0xa')](),controller[_0xb8e2('0x10')]);router['put'](_0xb8e2('0xd'),auth[_0xb8e2('0xa')](),controller[_0xb8e2('0x11')]);router[_0xb8e2('0x12')](_0xb8e2('0xd'),auth[_0xb8e2('0xa')](),controller[_0xb8e2('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 22f5da4..eedee10 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 _0xd60e=['onlineForm','Comments','offlineForm','setDataValue','generate','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','alternate','#fafafa','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','address','email','Agent','INTEGER','BOOLEAN','squared','rounded','We\x20are\x20here!','Chat','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Send','Skip','Feedback','ENUM','thumb','stringify','input','name','getDataValue'];(function(_0x3c5916,_0x90a4f4){var _0x5575af=function(_0x1f0e66){while(--_0x1f0e66){_0x3c5916['push'](_0x3c5916['shift']());}};_0x5575af(++_0x90a4f4);}(_0xd60e,0x180));var _0xed60=function(_0x52989a,_0x7cee7c){_0x52989a=_0x52989a-0x0;var _0x316d89=_0xd60e[_0x52989a];return _0x316d89;};'use strict';var Sequelize=require(_0xed60('0x0'));var rs=require(_0xed60('0x1'));module[_0xed60('0x2')]={'name':{'type':Sequelize[_0xed60('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0xed60('0x3')],'allowNull':![],'unique':_0xed60('0x4')},'description':{'type':Sequelize[_0xed60('0x3')]},'mapKey':{'type':Sequelize[_0xed60('0x3')],'defaultValue':_0xed60('0x5')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0xed60('0x5')},'key':{'type':Sequelize[_0xed60('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xed60('0x3')],'defaultValue':_0xed60('0x6')},'customerAlias':{'type':Sequelize[_0xed60('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xed60('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xed60('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xed60('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xed60('0x3')]},'animation':{'type':Sequelize[_0xed60('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM']('rounded',_0xed60('0x9')),'defaultValue':_0xed60('0xa')},'header_online':{'type':Sequelize[_0xed60('0x3')],'defaultValue':_0xed60('0xb')},'start_chat_button':{'type':Sequelize[_0xed60('0x3')],'defaultValue':_0xed60('0xc')},'offline_chat_button':{'type':Sequelize[_0xed60('0x3')],'defaultValue':'Send'},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0xed60('0xd')},'download_transcript':{'type':Sequelize[_0xed60('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xed60('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xed60('0x3')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0xed60('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xed60('0xe')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0xed60('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0xed60('0x3')],'defaultValue':_0xed60('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0xed60('0x3')],'defaultValue':_0xed60('0x11')},'noteTitle':{'type':Sequelize[_0xed60('0x3')],'defaultValue':_0xed60('0x12')},'placeholderMessage':{'type':Sequelize[_0xed60('0x3')],'defaultValue':_0xed60('0x13')},'closingMessage':{'type':Sequelize[_0xed60('0x3')],'defaultValue':_0xed60('0x14')},'closingMessageButton':{'type':Sequelize[_0xed60('0x3')],'defaultValue':_0xed60('0x15')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xed60('0x16')},'conditionAgreement':{'type':Sequelize[_0xed60('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xed60('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xed60('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0xed60('0x17')},'ratingType':{'type':Sequelize[_0xed60('0x18')]('star',_0xed60('0x19')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0xed60('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xed60('0xe')],'defaultValue':function(){return JSON[_0xed60('0x1a')]({'items':[{'type':_0xed60('0x1b'),'variable':null,'config':{'placeholder':_0xed60('0x1c'),'type':'text','required':!![]},'props':{'title':'name','helpText':''}},{'type':_0xed60('0x1b'),'props':{'title':_0xed60('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0xed60('0x5'),'type':_0xed60('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xed60('0x1d')](_0xed60('0x1e'))?JSON['parse'](this[_0xed60('0x1d')](_0xed60('0x1e'))):{};},'set':function(_0x5b97a0){return this['setDataValue']('onlineForm',JSON[_0xed60('0x1a')](_0x5b97a0));}},'offlineForm':{'type':Sequelize[_0xed60('0xe')],'defaultValue':function(){return JSON[_0xed60('0x1a')]({'items':[{'type':_0xed60('0x1b'),'props':{'title':_0xed60('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0xed60('0x5'),'type':_0xed60('0x5')},'variable':null},{'type':'textarea','config':{'placeholder':_0xed60('0x1f')},'props':{'title':_0xed60('0x1f'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0xed60('0x1d')](_0xed60('0x20'))?JSON['parse'](this[_0xed60('0x1d')]('offlineForm')):{};},'set':function(_0x4ffbad){return this[_0xed60('0x21')](_0xed60('0x20'),JSON['stringify'](_0x4ffbad));}},'token':{'type':Sequelize[_0xed60('0x3')],'defaultValue':function(){return rs[_0xed60('0x22')]();}},'autoclose':{'type':Sequelize[_0xed60('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xed60('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xed60('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xed60('0x3')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0xed60('0x3')],'defaultValue':_0xed60('0x23')},'offlineMessageSubject':{'type':Sequelize[_0xed60('0x3')],'defaultValue':_0xed60('0x24')},'offlineMessageBody':{'type':Sequelize[_0xed60('0x3')],'defaultValue':_0xed60('0x25')},'enableUnmanagedNote':{'type':Sequelize[_0xed60('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xed60('0x3')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0xed60('0x3')],'defaultValue':_0xed60('0x16')},'sendUnmanaged':{'type':Sequelize[_0xed60('0x3')],'defaultValue':_0xed60('0x15')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xed60('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xed60('0xe')]},'showAgentAvatar':{'type':Sequelize[_0xed60('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xed60('0xe')],'defaultValue':function(){return _0xed60('0x26');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xed60('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xed60('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0xed60('0x27')},'waitForTheAssignedAgent':{'type':Sequelize[_0xed60('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xed60('0x3')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0xed60('0x7')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xed60('0x3')],'defaultValue':_0xed60('0x28')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0xed60('0xe')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xed60('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xed60('0x29'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xed60('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xed60('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xed60('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xed60('0x3')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xed60('0x7')],'comment':_0xed60('0x2a')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xed60('0x2b'),'set':function(_0x60be0a){if(!_0x60be0a)this['setDataValue'](_0xed60('0x2c'),null);this[_0xed60('0x21')](_0xed60('0x2d'),_0x60be0a);}},'vidaooEscalation':{'type':Sequelize[_0xed60('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xed60('0x3')]},'vidaooTopic':{'type':Sequelize[_0xed60('0x3')],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0xed60('0xe')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xed60('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xed60('0xe')]}}; \ No newline at end of file +var _0x09b6=['website_alias','bottom_right','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDisposition','sequelize','exports','STRING','address','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Send','Contact\x20us','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Note','Thanks\x20you\x20for\x20your\x20time!','Skip','star','thumb','TEXT','stringify','name','text','email','getDataValue','onlineForm','parse','setDataValue','input','Comments','Leave\x20your\x20comments','offlineForm','generate','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x17a0a0,_0x1befaa){var _0x4da752=function(_0x429829){while(--_0x429829){_0x17a0a0['push'](_0x17a0a0['shift']());}};_0x4da752(++_0x1befaa);}(_0x09b6,0x121));var _0x609b=function(_0x539533,_0x59b89b){_0x539533=_0x539533-0x0;var _0x3942f3=_0x09b6[_0x539533];return _0x3942f3;};'use strict';var Sequelize=require(_0x609b('0x0'));var rs=require('randomstring');module[_0x609b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x609b('0x2')],'allowNull':![],'unique':_0x609b('0x3')},'description':{'type':Sequelize[_0x609b('0x2')]},'mapKey':{'type':Sequelize[_0x609b('0x2')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':'email'},'key':{'type':Sequelize[_0x609b('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x609b('0x2')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x609b('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x609b('0x2')],'allowNull':![],'defaultValue':_0x609b('0x4'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x609b('0x2')],'allowNull':![],'defaultValue':_0x609b('0x4'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x609b('0x2')],'allowNull':![],'defaultValue':_0x609b('0x5'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x609b('0x6')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x609b('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x609b('0x8')](_0x609b('0x9'),_0x609b('0xa')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0x609b('0x2')],'defaultValue':_0x609b('0xb')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0x609b('0x2')],'defaultValue':_0x609b('0xc')},'header_offline':{'type':Sequelize[_0x609b('0x2')],'defaultValue':_0x609b('0xd')},'download_transcript':{'type':Sequelize[_0x609b('0x7')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x609b('0x6')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x609b('0x2')],'defaultValue':_0x609b('0xe')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0x609b('0x2')],'defaultValue':_0x609b('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0x609b('0x2')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x609b('0x2')],'defaultValue':_0x609b('0x10')},'noteTitle':{'type':Sequelize[_0x609b('0x2')],'defaultValue':_0x609b('0x11')},'placeholderMessage':{'type':Sequelize[_0x609b('0x2')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x609b('0x2')],'defaultValue':_0x609b('0x12')},'closingMessageButton':{'type':Sequelize[_0x609b('0x2')],'defaultValue':_0x609b('0xc')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x609b('0x13')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x609b('0x7')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x609b('0x7')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x609b('0x7')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x609b('0x2')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0x609b('0x8')](_0x609b('0x14'),_0x609b('0x15')),'defaultValue':_0x609b('0x14')},'ratingStarsNumber':{'type':Sequelize[_0x609b('0x6')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x609b('0x16')],'defaultValue':function(){return JSON[_0x609b('0x17')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x609b('0x18'),'type':_0x609b('0x19'),'required':!![]},'props':{'title':_0x609b('0x18'),'helpText':''}},{'type':'input','props':{'title':_0x609b('0x1a'),'helpText':''},'config':{'required':!![],'placeholder':_0x609b('0x1a'),'type':_0x609b('0x1a')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x609b('0x1b')](_0x609b('0x1c'))?JSON[_0x609b('0x1d')](this[_0x609b('0x1b')](_0x609b('0x1c'))):{};},'set':function(_0x23c8c6){return this[_0x609b('0x1e')]('onlineForm',JSON[_0x609b('0x17')](_0x23c8c6));}},'offlineForm':{'type':Sequelize[_0x609b('0x16')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x609b('0x1f'),'props':{'title':_0x609b('0x1a'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x609b('0x1a')},'variable':null},{'type':'textarea','config':{'placeholder':_0x609b('0x20')},'props':{'title':_0x609b('0x20'),'helpText':_0x609b('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0x609b('0x1b')]('offlineForm')?JSON['parse'](this[_0x609b('0x1b')](_0x609b('0x22'))):{};},'set':function(_0xc5ee97){return this[_0x609b('0x1e')]('offlineForm',JSON[_0x609b('0x17')](_0xc5ee97));}},'token':{'type':Sequelize[_0x609b('0x2')],'defaultValue':function(){return rs[_0x609b('0x23')]();}},'autoclose':{'type':Sequelize[_0x609b('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x609b('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x609b('0x7')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x609b('0x2')]},'forwardOffline':{'type':Sequelize[_0x609b('0x7')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x609b('0x2')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x609b('0x24')},'offlineMessageSubject':{'type':Sequelize[_0x609b('0x2')],'defaultValue':_0x609b('0x25')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0x609b('0x7')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x609b('0x26')},'skipUnmanaged':{'type':Sequelize[_0x609b('0x2')],'defaultValue':_0x609b('0x13')},'sendUnmanaged':{'type':Sequelize[_0x609b('0x2')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x609b('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x609b('0x16')]},'showAgentAvatar':{'type':Sequelize[_0x609b('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x609b('0x2')]},'notificationTemplate':{'type':Sequelize[_0x609b('0x16')],'defaultValue':function(){return _0x609b('0x27');}},'notificationSound':{'type':Sequelize[_0x609b('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x609b('0x7')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x609b('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x609b('0x2')],'defaultValue':_0x609b('0x28')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x609b('0x2')],'defaultValue':_0x609b('0x29')},'verticalAlignment':{'type':Sequelize[_0x609b('0x6')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x609b('0x2')],'defaultValue':_0x609b('0x2a')},'defaultTitle':{'type':Sequelize[_0x609b('0x2')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x609b('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x609b('0x6')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x609b('0x2b'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x609b('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x609b('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x609b('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x609b('0x2')],'defaultValue':_0x609b('0x2c')},'systemAvatar':{'type':Sequelize[_0x609b('0x16')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x609b('0x2d')},'mandatoryDisposition':{'type':Sequelize[_0x609b('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x272290){if(!_0x272290)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x609b('0x1e')](_0x609b('0x2e'),_0x272290);}},'vidaooEscalation':{'type':Sequelize[_0x609b('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x609b('0x2')]},'vidaooTopic':{'type':Sequelize[_0x609b('0x2')],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize[_0x609b('0x2')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x609b('0x7')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index fc95c64..bf8098c 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 _0x960f=['removeAnswers','ids','addLogo','sitepic','file','addAvatar','agentAvatar','filename','addCustomerAvatar','addSystemAvatar','systemAvatar','getLogo','root','server/files/images/logos/default_logo.svg','getLicense','custom','isNil','existsSync','join','server/files/images/logos/','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','download','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','customerAvatar','getSystemAvatar','notify','setUA','headers','user-agent','getResult','chat','CmContact','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','from','ValidationError','from\x20is\x20mandatory','Sequelize','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','Applications','List','account','applications','list','orderBy','asc','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','referer','browser','version','format','%s\x20%s','unknown','device','%s\x20%s\x20%s','vendor','threadId','ChatInteraction','externalUrl','ContactId','interaction','contact','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','files','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','MailAccount','findOrCreate','spread','utf8','ChatOfflineMessage','originalname','mimetype','server','attachments','offline-chat','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','sendMail','\x22%s\x22\x20<%s>','email','MailAccountId','subjectOffline','toPairsIn','mapValues','Chat','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','fullname','Tags','color','tag','Command','getSnippet','iftime\x20%s,%s','interval','timezone','iftime\x20%s','OFFLINE','No\x20timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','Interval','Intervals','getProactiveActions','virtual','increment','all','some','readFileSync','server/files/chat/iframe.ejs','remote','x-real-ip','connection','replace','render','alignment','verticalAlignment','backgroundColor','addApplications','ChatApplication','findAndCountAll','priority','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','userChatWebsite:save','removeAgents','emit','userChatWebsite:remove','getAgents','rimraf','fast-json-patch','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','ChatWebsite,\x20%s,\x20%s','message','result','catch','status','end','offset','undefined','limit','count','Content-Range','json','reject','save','update','destroy','get','ChatWebsites','UserProfileResource','sendStatus','stack','name','send','index','mandatoryDispositionPause','ChatWebsite','rawAttributes','key','model','map','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','sort','where','type','VIRTUAL','merge','options','include','findAll','rows','show','intersection','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','ChatWebsiteId','Disposition','create','getDispositions','findOne','pick','filter','includeAll','removeDispositions','CannedAnswer','order'];(function(_0x767aa3,_0x3b82b1){var _0x39bf0f=function(_0x5f2bf8){while(--_0x5f2bf8){_0x767aa3['push'](_0x767aa3['shift']());}};_0x39bf0f(++_0x3b82b1);}(_0x960f,0xc7));var _0xf960=function(_0x40f991,_0x576819){_0x40f991=_0x40f991-0x0;var _0x38eca2=_0x960f[_0x40f991];return _0x38eca2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf960('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf960('0x1'));var rp=require('request-promise');var moment=require(_0xf960('0x2'));var BPromise=require(_0xf960('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xf960('0x4'));var csv=require(_0xf960('0x5'));var ejs=require(_0xf960('0x6'));var fs=require('fs');var fs_extra=require(_0xf960('0x7'));var _=require(_0xf960('0x8'));var squel=require(_0xf960('0x9'));var crypto=require('crypto');var jsforce=require(_0xf960('0xa'));var deskjs=require(_0xf960('0xb'));var toCsv=require(_0xf960('0x5'));var querystring=require(_0xf960('0xc'));var Papa=require(_0xf960('0xd'));var Redis=require(_0xf960('0xe'));var authService=require(_0xf960('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xf960('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xf960('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xf960('0x12'));var db=require(_0xf960('0x13'))['db'];config[_0xf960('0x14')]=_[_0xf960('0x15')](config['redis'],{'host':_0xf960('0x16'),'port':0x18eb});var socket=require(_0xf960('0x17'))(new Redis(config[_0xf960('0x14')]));require(_0xf960('0x18'))[_0xf960('0x19')](socket);var jayson=require(_0xf960('0x1a'));var client=jayson[_0xf960('0x1b')][_0xf960('0x1c')]({'port':0x232c});var client9002=jayson[_0xf960('0x1b')]['http']({'port':0x232a});var client9003=jayson[_0xf960('0x1b')][_0xf960('0x1c')]({'port':0x232b});var client9001=jayson[_0xf960('0x1b')]['http']({'port':0x2329});function respondWithRpcPromise(_0xd9b88b,_0x18726a,_0x228ae0,_0x3b0bf6){return new BPromise(function(_0x327d0b,_0x3029e2){var _0x513677=_0x3b0bf6||client;return _0x513677[_0xf960('0x1d')](_0xd9b88b,_0x228ae0)[_0xf960('0x1e')](function(_0x53bff0){logger[_0xf960('0x1f')]('ChatWebsite,\x20%s,\x20%s',_0x18726a,_0xf960('0x20'));logger[_0xf960('0x21')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x18726a,_0xf960('0x20'),JSON[_0xf960('0x22')](_0x53bff0));if(_0x53bff0['error']){if(_0x53bff0[_0xf960('0x23')]['code']===0x1f4){logger[_0xf960('0x23')](_0xf960('0x24'),_0x18726a,_0x53bff0[_0xf960('0x23')]['message']);return _0x3029e2(_0x53bff0[_0xf960('0x23')][_0xf960('0x25')]);}logger[_0xf960('0x23')](_0xf960('0x24'),_0x18726a,_0x53bff0['error'][_0xf960('0x25')]);return _0x327d0b(_0x53bff0[_0xf960('0x23')]['message']);}else{logger[_0xf960('0x1f')]('ChatWebsite,\x20%s,\x20%s',_0x18726a,'request\x20sent');_0x327d0b(_0x53bff0[_0xf960('0x26')][_0xf960('0x25')]);}})[_0xf960('0x27')](function(_0x2ce86c){logger[_0xf960('0x23')]('ChatWebsite,\x20%s,\x20%s',_0x18726a,_0x2ce86c);_0x3029e2(_0x2ce86c);});});}function respondWithStatusCode(_0x209ff0,_0x26440f){_0x26440f=_0x26440f||0xcc;return function(_0x1e945b){if(_0x1e945b){return _0x209ff0['sendStatus'](_0x26440f);}return _0x209ff0[_0xf960('0x28')](_0x26440f)[_0xf960('0x29')]();};}function respondWithResult(_0x3fe388,_0x29e7ac){_0x29e7ac=_0x29e7ac||0xc8;return function(_0x5741ef){if(_0x5741ef){return _0x3fe388[_0xf960('0x28')](_0x29e7ac)['json'](_0x5741ef);}};}function respondWithFilteredResult(_0x3263d5,_0x2697c1){return function(_0x240951){if(_0x240951){var _0xc7adca=typeof _0x2697c1[_0xf960('0x2a')]===_0xf960('0x2b')&&typeof _0x2697c1[_0xf960('0x2c')]===_0xf960('0x2b');var _0x5dc6d1=_0x240951[_0xf960('0x2d')];var _0x1dcb7d=_0xc7adca?0x0:_0x2697c1[_0xf960('0x2a')];var _0x127d34=_0xc7adca?_0x240951['count']:_0x2697c1[_0xf960('0x2a')]+_0x2697c1[_0xf960('0x2c')];var _0x199f78;if(_0x127d34>=_0x5dc6d1){_0x127d34=_0x5dc6d1;_0x199f78=0xc8;}else{_0x199f78=0xce;}_0x3263d5[_0xf960('0x28')](_0x199f78);return _0x3263d5['set'](_0xf960('0x2e'),_0x1dcb7d+'-'+_0x127d34+'/'+_0x5dc6d1)[_0xf960('0x2f')](_0x240951);}return null;};}function patchUpdates(_0x15b692){return function(_0x519abc){try{jsonpatch['apply'](_0x519abc,_0x15b692,!![]);}catch(_0x9efc33){return BPromise[_0xf960('0x30')](_0x9efc33);}return _0x519abc[_0xf960('0x31')]();};}function saveUpdates(_0x4baba1,_0x554400){return function(_0x4e4b71){if(_0x4e4b71){return _0x4e4b71[_0xf960('0x32')](_0x4baba1)[_0xf960('0x1e')](function(_0x3dd7f2){return _0x3dd7f2;});}return null;};}function removeEntity(_0x21ab8b,_0x524a95){return function(_0x4ebbbb){if(_0x4ebbbb){return _0x4ebbbb[_0xf960('0x33')]()[_0xf960('0x1e')](function(){var _0x26b47a=_0x4ebbbb[_0xf960('0x34')]({'plain':!![]});var _0x305fe9=_0xf960('0x35');return db[_0xf960('0x36')][_0xf960('0x33')]({'where':{'type':_0x305fe9,'resourceId':_0x26b47a['id']}})[_0xf960('0x1e')](function(){return _0x4ebbbb;});})['then'](function(){_0x21ab8b['status'](0xcc)[_0xf960('0x29')]();});}};}function handleEntityNotFound(_0x560635,_0x3b1f2e){return function(_0x590b29){if(!_0x590b29){_0x560635[_0xf960('0x37')](0x194);}return _0x590b29;};}function handleError(_0x4bd210,_0x471fb3){_0x471fb3=_0x471fb3||0x1f4;return function(_0x1bb02f){logger[_0xf960('0x23')](_0x1bb02f[_0xf960('0x38')]);if(_0x1bb02f[_0xf960('0x39')]){delete _0x1bb02f[_0xf960('0x39')];}_0x4bd210[_0xf960('0x28')](_0x471fb3)[_0xf960('0x3a')](_0x1bb02f);};}exports[_0xf960('0x3b')]=function(_0x1bc376,_0x5ba98c){var _0x3e1c03={'include':[{'model':db['Pause'],'as':_0xf960('0x3c')}]},_0x5ab036={},_0x479135={'count':0x0,'rows':[]};var _0x3120e5=_['map'](db[_0xf960('0x3d')][_0xf960('0x3e')],function(_0x3fe149){return{'name':_0x3fe149['fieldName'],'type':_0x3fe149['type'][_0xf960('0x3f')]};});_0x5ab036[_0xf960('0x40')]=_[_0xf960('0x41')](_0x3120e5,_0xf960('0x39'));_0x5ab036[_0xf960('0x42')]=_[_0xf960('0x43')](_0x1bc376[_0xf960('0x42')]);_0x5ab036[_0xf960('0x44')]=_['intersection'](_0x5ab036[_0xf960('0x40')],_0x5ab036[_0xf960('0x42')]);_0x3e1c03['attributes']=_['intersection'](_0x5ab036[_0xf960('0x40')],qs[_0xf960('0x45')](_0x1bc376[_0xf960('0x42')][_0xf960('0x45')]));_0x3e1c03[_0xf960('0x46')]=_0x3e1c03[_0xf960('0x46')][_0xf960('0x47')]?_0x3e1c03[_0xf960('0x46')]:_0x5ab036[_0xf960('0x40')];if(!_0x1bc376[_0xf960('0x42')][_0xf960('0x48')](_0xf960('0x49'))){_0x3e1c03['limit']=qs['limit'](_0x1bc376['query'][_0xf960('0x2c')]);_0x3e1c03[_0xf960('0x2a')]=qs[_0xf960('0x2a')](_0x1bc376[_0xf960('0x42')][_0xf960('0x2a')]);}_0x3e1c03['order']=qs['sort'](_0x1bc376[_0xf960('0x42')][_0xf960('0x4a')]);_0x3e1c03[_0xf960('0x4b')]=qs['filters'](_['pick'](_0x1bc376[_0xf960('0x42')],_0x5ab036[_0xf960('0x44')]),_0x3120e5);if(_0x1bc376[_0xf960('0x42')]['filter']){_0x3e1c03[_0xf960('0x4b')]=_['merge'](_0x3e1c03[_0xf960('0x4b')],{'$or':_[_0xf960('0x41')](_0x3120e5,function(_0x4122e0){if(_0x4122e0[_0xf960('0x4c')]!==_0xf960('0x4d')){var _0x14d3f8={};_0x14d3f8[_0x4122e0[_0xf960('0x39')]]={'$like':'%'+_0x1bc376[_0xf960('0x42')]['filter']+'%'};return _0x14d3f8;}})});}_0x3e1c03=_[_0xf960('0x4e')]({},_0x3e1c03,_0x1bc376[_0xf960('0x4f')]);var _0x7a0e13={'where':_0x3e1c03['where']};return db[_0xf960('0x3d')][_0xf960('0x2d')](_0x7a0e13)[_0xf960('0x1e')](function(_0x2c9c24){_0x479135[_0xf960('0x2d')]=_0x2c9c24;if(_0x1bc376['query']['includeAll']){_0x3e1c03[_0xf960('0x50')]=[{'all':!![]}];}return db['ChatWebsite'][_0xf960('0x51')](_0x3e1c03);})[_0xf960('0x1e')](function(_0x1cef87){_0x479135[_0xf960('0x52')]=_0x1cef87;return _0x479135;})[_0xf960('0x1e')](respondWithFilteredResult(_0x5ba98c,_0x3e1c03))['catch'](handleError(_0x5ba98c,null));};exports[_0xf960('0x53')]=function(_0x59ef84,_0x4c7f39){var _0x1e5b8b={'raw':![],'where':{'id':_0x59ef84['params']['id']},'include':[{'model':db['Pause'],'as':_0xf960('0x3c')}]},_0x295318={};_0x295318[_0xf960('0x40')]=_[_0xf960('0x43')](db[_0xf960('0x3d')][_0xf960('0x3e')]);_0x295318[_0xf960('0x42')]=_[_0xf960('0x43')](_0x59ef84[_0xf960('0x42')]);_0x295318[_0xf960('0x44')]=_['intersection'](_0x295318[_0xf960('0x40')],_0x295318[_0xf960('0x42')]);_0x1e5b8b['attributes']=_[_0xf960('0x54')](_0x295318[_0xf960('0x40')],qs[_0xf960('0x45')](_0x59ef84[_0xf960('0x42')]['fields']));_0x1e5b8b[_0xf960('0x46')]=_0x1e5b8b[_0xf960('0x46')][_0xf960('0x47')]?_0x1e5b8b[_0xf960('0x46')]:_0x295318[_0xf960('0x40')];if(_0x59ef84[_0xf960('0x42')]['includeAll']){_0x1e5b8b[_0xf960('0x50')]=[{'all':!![]}];}_0x1e5b8b=_['merge']({},_0x1e5b8b,_0x59ef84[_0xf960('0x4f')]);return db[_0xf960('0x3d')][_0xf960('0x55')](_0x1e5b8b)[_0xf960('0x1e')](handleEntityNotFound(_0x4c7f39,null))[_0xf960('0x1e')](respondWithResult(_0x4c7f39,null))[_0xf960('0x27')](handleError(_0x4c7f39,null));};exports['create']=function(_0x5a2e68,_0x392128){return db[_0xf960('0x3d')]['create'](_0x5a2e68[_0xf960('0x56')],{})[_0xf960('0x1e')](function(_0x4d19dc){var _0x2975a5=_0x5a2e68[_0xf960('0x57')]['get']({'plain':!![]});if(!_0x2975a5)throw new Error(_0xf960('0x58'));if(_0x2975a5[_0xf960('0x59')]===_0xf960('0x57')){var _0x4de0bc=_0x4d19dc[_0xf960('0x34')]({'plain':!![]});var _0x3d341b=_0xf960('0x35');return db['UserProfileSection'][_0xf960('0x55')]({'where':{'name':_0x3d341b,'userProfileId':_0x2975a5[_0xf960('0x5a')]},'raw':!![]})[_0xf960('0x1e')](function(_0x21868b){if(_0x21868b&&_0x21868b[_0xf960('0x5b')]===0x0){return db[_0xf960('0x36')]['create']({'name':_0x4de0bc[_0xf960('0x39')],'resourceId':_0x4de0bc['id'],'type':_0x21868b[_0xf960('0x39')],'sectionId':_0x21868b['id']},{})[_0xf960('0x1e')](function(){return _0x4d19dc;});}else{return _0x4d19dc;}})[_0xf960('0x27')](function(_0xc9d5dd){logger[_0xf960('0x23')](_0xf960('0x5c'),_0xc9d5dd);throw _0xc9d5dd;});}return _0x4d19dc;})[_0xf960('0x1e')](respondWithResult(_0x392128,0xc9))['catch'](handleError(_0x392128,null));};exports[_0xf960('0x32')]=function(_0x1a5321,_0x262a97){if(_0x1a5321[_0xf960('0x56')]['id']){delete _0x1a5321[_0xf960('0x56')]['id'];}return db[_0xf960('0x3d')]['find']({'where':{'id':_0x1a5321[_0xf960('0x5d')]['id']},'include':[{'model':db['Pause'],'as':_0xf960('0x3c')}]})[_0xf960('0x1e')](handleEntityNotFound(_0x262a97,null))[_0xf960('0x1e')](saveUpdates(_0x1a5321[_0xf960('0x56')],null))['then'](respondWithResult(_0x262a97,null))['catch'](handleError(_0x262a97,null));};exports[_0xf960('0x33')]=function(_0x871965,_0x19a85c){return db[_0xf960('0x3d')][_0xf960('0x55')]({'where':{'id':_0x871965[_0xf960('0x5d')]['id']}})['then'](handleEntityNotFound(_0x19a85c,null))[_0xf960('0x1e')](removeEntity(_0x19a85c,null))['catch'](handleError(_0x19a85c,null));};exports[_0xf960('0x5e')]=function(_0x52ac54,_0x27a25b){return db['ChatWebsite'][_0xf960('0x5e')]()[_0xf960('0x1e')](respondWithResult(_0x27a25b,null))[_0xf960('0x27')](handleError(_0x27a25b,null));};exports[_0xf960('0x5f')]=function(_0x344e86,_0x363004,_0x932428){if(_0x344e86[_0xf960('0x56')]['id']){delete _0x344e86[_0xf960('0x56')]['id'];}return db[_0xf960('0x3d')][_0xf960('0x55')]({'where':{'id':_0x344e86['params']['id']}})[_0xf960('0x1e')](handleEntityNotFound(_0x363004,null))['then'](function(_0x34d24f){if(_0x34d24f){_0x344e86[_0xf960('0x56')][_0xf960('0x60')]=_0x34d24f['id'];return db[_0xf960('0x61')][_0xf960('0x62')](_0x344e86[_0xf960('0x56')]);}})[_0xf960('0x1e')](respondWithResult(_0x363004,null))[_0xf960('0x27')](handleError(_0x363004,null));};exports[_0xf960('0x63')]=function(_0x1d5c57,_0x493cca,_0x54ec3d){var _0x152e54={'raw':![],'where':{}};var _0x2541fa={};var _0x4e5950={'count':0x0,'rows':[]};return db[_0xf960('0x3d')][_0xf960('0x64')]({'where':{'id':_0x1d5c57['params']['id']}})[_0xf960('0x1e')](handleEntityNotFound(_0x493cca,null))[_0xf960('0x1e')](function(_0x439619){if(_0x439619){_0x2541fa[_0xf960('0x40')]=_['keys'](db[_0xf960('0x61')][_0xf960('0x3e')]);_0x2541fa[_0xf960('0x42')]=_['keys'](_0x1d5c57[_0xf960('0x42')]);_0x2541fa['filters']=_[_0xf960('0x54')](_0x2541fa[_0xf960('0x40')],_0x2541fa[_0xf960('0x42')]);_0x152e54['attributes']=_[_0xf960('0x54')](_0x2541fa['model'],qs[_0xf960('0x45')](_0x1d5c57[_0xf960('0x42')][_0xf960('0x45')]));_0x152e54[_0xf960('0x46')]=_0x152e54[_0xf960('0x46')][_0xf960('0x47')]?_0x152e54[_0xf960('0x46')]:_0x2541fa[_0xf960('0x40')];if(!_0x1d5c57['query'][_0xf960('0x48')](_0xf960('0x49'))){_0x152e54[_0xf960('0x2c')]=qs['limit'](_0x1d5c57['query'][_0xf960('0x2c')]);_0x152e54['offset']=qs['offset'](_0x1d5c57[_0xf960('0x42')]['offset']);}_0x152e54['order']=qs['sort'](_0x1d5c57[_0xf960('0x42')][_0xf960('0x4a')]);_0x152e54[_0xf960('0x4b')]=qs[_0xf960('0x44')](_[_0xf960('0x65')](_0x1d5c57[_0xf960('0x42')],_0x2541fa[_0xf960('0x44')]));_0x152e54[_0xf960('0x4b')][_0xf960('0x60')]=_0x439619['id'];if(_0x1d5c57[_0xf960('0x42')][_0xf960('0x66')]){_0x152e54['where']=_[_0xf960('0x4e')](_0x152e54[_0xf960('0x4b')],{'$or':_[_0xf960('0x41')](_0x152e54[_0xf960('0x46')],function(_0x4127dc){var _0xf897bc={};_0xf897bc[_0x4127dc]={'$like':'%'+_0x1d5c57[_0xf960('0x42')][_0xf960('0x66')]+'%'};return _0xf897bc;})});}_0x152e54=_[_0xf960('0x4e')]({},_0x152e54,_0x1d5c57[_0xf960('0x4f')]);return db['Disposition'][_0xf960('0x2d')]({'where':_0x152e54[_0xf960('0x4b')]})[_0xf960('0x1e')](function(_0x2be2d6){_0x4e5950[_0xf960('0x2d')]=_0x2be2d6;if(_0x1d5c57[_0xf960('0x42')][_0xf960('0x67')]){_0x152e54[_0xf960('0x50')]=[{'all':!![]}];}return db[_0xf960('0x61')]['findAll'](_0x152e54);})['then'](function(_0xd69038){_0x4e5950[_0xf960('0x52')]=_0xd69038;return _0x4e5950;});}})[_0xf960('0x1e')](respondWithFilteredResult(_0x493cca,_0x152e54))['catch'](handleError(_0x493cca,null));};exports[_0xf960('0x68')]=function(_0x14e7f1,_0x5b45a0,_0x54769c){return db[_0xf960('0x3d')][_0xf960('0x55')]({'where':{'id':_0x14e7f1[_0xf960('0x5d')]['id']}})[_0xf960('0x1e')](handleEntityNotFound(_0x5b45a0,null))[_0xf960('0x1e')](function(_0x57176e){if(_0x57176e){return _0x57176e[_0xf960('0x68')](_0x14e7f1[_0xf960('0x42')]['ids']);}})[_0xf960('0x1e')](respondWithStatusCode(_0x5b45a0,null))['catch'](handleError(_0x5b45a0,null));};exports['addAnswer']=function(_0xa78f31,_0x564e75,_0x65d7f4){if(_0xa78f31[_0xf960('0x56')]['id']){delete _0xa78f31[_0xf960('0x56')]['id'];}return db['ChatWebsite'][_0xf960('0x55')]({'where':{'id':_0xa78f31[_0xf960('0x5d')]['id']}})['then'](handleEntityNotFound(_0x564e75,null))[_0xf960('0x1e')](function(_0x5e6c47){if(_0x5e6c47){_0xa78f31[_0xf960('0x56')][_0xf960('0x60')]=_0x5e6c47['id'];return db[_0xf960('0x69')][_0xf960('0x62')](_0xa78f31[_0xf960('0x56')]);}})[_0xf960('0x1e')](respondWithResult(_0x564e75,null))[_0xf960('0x27')](handleError(_0x564e75,null));};exports['getAnswers']=function(_0xa64df7,_0x18a108,_0x9fc466){var _0x17ccc6={'raw':![],'where':{}};var _0x163b22={};var _0x218b83={'count':0x0,'rows':[]};return db[_0xf960('0x3d')][_0xf960('0x64')]({'where':{'id':_0xa64df7['params']['id']}})[_0xf960('0x1e')](handleEntityNotFound(_0x18a108,null))['then'](function(_0x47091e){if(_0x47091e){_0x163b22[_0xf960('0x40')]=_[_0xf960('0x43')](db['CannedAnswer'][_0xf960('0x3e')]);_0x163b22[_0xf960('0x42')]=_[_0xf960('0x43')](_0xa64df7[_0xf960('0x42')]);_0x163b22[_0xf960('0x44')]=_['intersection'](_0x163b22[_0xf960('0x40')],_0x163b22[_0xf960('0x42')]);_0x17ccc6[_0xf960('0x46')]=_[_0xf960('0x54')](_0x163b22[_0xf960('0x40')],qs[_0xf960('0x45')](_0xa64df7[_0xf960('0x42')][_0xf960('0x45')]));_0x17ccc6[_0xf960('0x46')]=_0x17ccc6['attributes'][_0xf960('0x47')]?_0x17ccc6['attributes']:_0x163b22[_0xf960('0x40')];if(!_0xa64df7[_0xf960('0x42')][_0xf960('0x48')](_0xf960('0x49'))){_0x17ccc6[_0xf960('0x2c')]=qs['limit'](_0xa64df7[_0xf960('0x42')][_0xf960('0x2c')]);_0x17ccc6[_0xf960('0x2a')]=qs[_0xf960('0x2a')](_0xa64df7[_0xf960('0x42')]['offset']);}_0x17ccc6[_0xf960('0x6a')]=qs[_0xf960('0x4a')](_0xa64df7[_0xf960('0x42')][_0xf960('0x4a')]);_0x17ccc6['where']=qs[_0xf960('0x44')](_[_0xf960('0x65')](_0xa64df7[_0xf960('0x42')],_0x163b22['filters']));_0x17ccc6[_0xf960('0x4b')][_0xf960('0x60')]=_0x47091e['id'];if(_0xa64df7[_0xf960('0x42')]['filter']){_0x17ccc6[_0xf960('0x4b')]=_['merge'](_0x17ccc6[_0xf960('0x4b')],{'$or':_[_0xf960('0x41')](_0x17ccc6[_0xf960('0x46')],function(_0x498448){var _0x2e73f6={};_0x2e73f6[_0x498448]={'$like':'%'+_0xa64df7[_0xf960('0x42')][_0xf960('0x66')]+'%'};return _0x2e73f6;})});}_0x17ccc6=_[_0xf960('0x4e')]({},_0x17ccc6,_0xa64df7[_0xf960('0x4f')]);return db[_0xf960('0x69')][_0xf960('0x2d')]({'where':_0x17ccc6['where']})[_0xf960('0x1e')](function(_0xfcfb8c){_0x218b83[_0xf960('0x2d')]=_0xfcfb8c;if(_0xa64df7['query']['includeAll']){_0x17ccc6[_0xf960('0x50')]=[{'all':!![]}];}return db[_0xf960('0x69')][_0xf960('0x51')](_0x17ccc6);})[_0xf960('0x1e')](function(_0x372803){_0x218b83[_0xf960('0x52')]=_0x372803;return _0x218b83;});}})['then'](respondWithFilteredResult(_0x18a108,_0x17ccc6))['catch'](handleError(_0x18a108,null));};exports[_0xf960('0x6b')]=function(_0x1be26e,_0x23c611,_0x13aba8){return db[_0xf960('0x3d')][_0xf960('0x55')]({'where':{'id':_0x1be26e[_0xf960('0x5d')]['id']}})[_0xf960('0x1e')](handleEntityNotFound(_0x23c611,null))[_0xf960('0x1e')](function(_0x41232c){if(_0x41232c){return _0x41232c['removeAnswers'](_0x1be26e[_0xf960('0x42')][_0xf960('0x6c')]);}})[_0xf960('0x1e')](respondWithStatusCode(_0x23c611,null))[_0xf960('0x27')](handleError(_0x23c611,null));};exports[_0xf960('0x6d')]=function(_0x364ded,_0x2f15c9,_0x316c45){_0x364ded[_0xf960('0x56')][_0xf960('0x6e')]=_0x364ded[_0xf960('0x6f')]['filename'];return db[_0xf960('0x3d')]['find']({'where':{'id':_0x364ded[_0xf960('0x5d')]['id']}})[_0xf960('0x1e')](handleEntityNotFound(_0x2f15c9,null))[_0xf960('0x1e')](saveUpdates(_0x364ded[_0xf960('0x56')],null))['then'](respondWithResult(_0x2f15c9,null))[_0xf960('0x27')](handleError(_0x2f15c9,null));};exports[_0xf960('0x70')]=function(_0x4e6767,_0x366a7a,_0x4a3269){_0x4e6767['body'][_0xf960('0x71')]=_0x4e6767[_0xf960('0x6f')][_0xf960('0x72')];return db[_0xf960('0x3d')]['find']({'where':{'id':_0x4e6767[_0xf960('0x5d')]['id']}})[_0xf960('0x1e')](handleEntityNotFound(_0x366a7a,null))[_0xf960('0x1e')](saveUpdates(_0x4e6767[_0xf960('0x56')],null))[_0xf960('0x1e')](respondWithResult(_0x366a7a,null))['catch'](handleError(_0x366a7a,null));};exports[_0xf960('0x73')]=function(_0x459a17,_0x5071d6,_0x18ac14){_0x459a17[_0xf960('0x56')]['customerAvatar']=_0x459a17['file'][_0xf960('0x72')];return db[_0xf960('0x3d')]['find']({'where':{'id':_0x459a17[_0xf960('0x5d')]['id']}})[_0xf960('0x1e')](handleEntityNotFound(_0x5071d6,null))[_0xf960('0x1e')](saveUpdates(_0x459a17[_0xf960('0x56')],null))[_0xf960('0x1e')](respondWithResult(_0x5071d6,null))[_0xf960('0x27')](handleError(_0x5071d6,null));};exports[_0xf960('0x74')]=function(_0x2ed276,_0x725a9d,_0x5dc744){_0x2ed276['body'][_0xf960('0x75')]=_0x2ed276[_0xf960('0x6f')]['filename'];return db[_0xf960('0x3d')]['find']({'where':{'id':_0x2ed276['params']['id']}})[_0xf960('0x1e')](handleEntityNotFound(_0x725a9d,null))[_0xf960('0x1e')](saveUpdates(_0x2ed276['body'],null))['then'](respondWithResult(_0x725a9d,null))[_0xf960('0x27')](handleError(_0x725a9d,null));};exports[_0xf960('0x76')]=function(_0x5c5b9e,_0x1808fb,_0x3a4eac){var _0x20a003=path['join'](config[_0xf960('0x77')],_0xf960('0x78'));var _0x44200a={'where':{'id':_0x5c5b9e[_0xf960('0x5d')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x2d4913=![];return require('../../config/license/util')[_0xf960('0x79')]()['then'](function(_0x2d1ef6){if(_0x2d1ef6){_0x2d4913=_0x2d1ef6[_0xf960('0x7a')];}})[_0xf960('0x1e')](function(){return db[_0xf960('0x3d')]['find'](_0x44200a);})[_0xf960('0x1e')](handleEntityNotFound(_0x1808fb,null))[_0xf960('0x1e')](function(_0x2e7393){if(_0x2e7393){if(!_[_0xf960('0x7b')](_0x2e7393[_0xf960('0x6e')])){if(fs[_0xf960('0x7c')](path[_0xf960('0x7d')](config[_0xf960('0x77')],'server/files/images/logos/',_0x2e7393[_0xf960('0x6e')]))&&_0x2d4913){_0x20a003=path['join'](config[_0xf960('0x77')],_0xf960('0x7e'),_0x2e7393[_0xf960('0x6e')]);}}return _0x1808fb['download'](_0x20a003);}})[_0xf960('0x27')](handleError(_0x1808fb,null));};exports[_0xf960('0x7f')]=function(_0x5d127b,_0x2f9de4,_0x4f2349){var _0xe55c1b=path['join'](config[_0xf960('0x77')],_0xf960('0x80'));var _0x506c51={'where':{'id':_0x5d127b[_0xf960('0x5d')]['id']},'attributes':['id',_0xf960('0x71')],'raw':!![]};return db[_0xf960('0x3d')][_0xf960('0x55')](_0x506c51)[_0xf960('0x1e')](handleEntityNotFound(_0x2f9de4,null))[_0xf960('0x1e')](function(_0x34bdb3){if(_0x34bdb3){if(!_[_0xf960('0x7b')](_0x34bdb3[_0xf960('0x71')])){if(fs[_0xf960('0x7c')](path[_0xf960('0x7d')](config['root'],_0xf960('0x81'),_0x34bdb3[_0xf960('0x71')]))){_0xe55c1b=path[_0xf960('0x7d')](config[_0xf960('0x77')],_0xf960('0x81'),_0x34bdb3['agentAvatar']);}}return _0x2f9de4[_0xf960('0x82')](_0xe55c1b);}})[_0xf960('0x27')](handleError(_0x2f9de4,null));};exports[_0xf960('0x83')]=function(_0x743e76,_0x578224,_0xa7ee44){var _0x161051=path[_0xf960('0x7d')](config['root'],_0xf960('0x84'));var _0x1578ce={'where':{'id':_0x743e76[_0xf960('0x5d')]['id']},'attributes':['id','customerAvatar',_0xf960('0x85')],'raw':!![]};return db['ChatWebsite'][_0xf960('0x55')](_0x1578ce)[_0xf960('0x1e')](handleEntityNotFound(_0x578224,null))['then'](function(_0x2e6543){if(_0x2e6543){if(!_[_0xf960('0x7b')](_0x2e6543[_0xf960('0x86')])){if(fs[_0xf960('0x7c')](path[_0xf960('0x7d')](config['root'],'server/files/images/avatars/',_0x2e6543[_0xf960('0x86')]))&&_0x2e6543[_0xf960('0x85')]){_0x161051=path[_0xf960('0x7d')](config['root'],_0xf960('0x81'),_0x2e6543['customerAvatar']);}}return _0x578224[_0xf960('0x82')](_0x161051);}})['catch'](handleError(_0x578224,null));};exports[_0xf960('0x87')]=function(_0x3445d4,_0x2e9ef1,_0x43146f){var _0x477fe2=path[_0xf960('0x7d')](config[_0xf960('0x77')],'server/files/images/avatars/system_avatar.png');var _0x51a9a6={'where':{'id':_0x3445d4[_0xf960('0x5d')]['id']},'attributes':['id',_0xf960('0x75')],'raw':!![]};return db[_0xf960('0x3d')]['find'](_0x51a9a6)[_0xf960('0x1e')](handleEntityNotFound(_0x2e9ef1,null))[_0xf960('0x1e')](function(_0x220a1b){if(_0x220a1b){if(!_[_0xf960('0x7b')](_0x220a1b[_0xf960('0x75')])){if(fs[_0xf960('0x7c')](path[_0xf960('0x7d')](config[_0xf960('0x77')],_0xf960('0x81'),_0x220a1b[_0xf960('0x75')]))){_0x477fe2=path['join'](config[_0xf960('0x77')],_0xf960('0x81'),_0x220a1b[_0xf960('0x75')]);}}return _0x2e9ef1['download'](_0x477fe2);}})[_0xf960('0x27')](handleError(_0x2e9ef1,null));};exports[_0xf960('0x88')]=function(_0x3b61f3,_0x96a8d8,_0x2193fd){var _0x312e85=require('user-agent-parser');var _0x2af62d=new _0x312e85();var _0x4a77ba=_0x2af62d[_0xf960('0x89')](_0x3b61f3[_0xf960('0x8a')][_0xf960('0x8b')])[_0xf960('0x8c')]();var _0x1093cd={'body':_0x3b61f3[_0xf960('0x56')],'channel':_0xf960('0x8d')};var _0x3067ca=[];var _0x3fa2c3=[];var _0x52265e={};var _0x184caa=![];return db[_0xf960('0x8e')][_0xf960('0x5e')]()[_0xf960('0x1e')](function(_0x419e84){if(!_0x419e84){throw new db['Sequelize']['ValidationError'](_0xf960('0x8f'));}_0x3067ca=_[_0xf960('0x90')](_[_0xf960('0x43')](_0x419e84),['createdAt',_0xf960('0x91')]);_0x3fa2c3=_['difference'](_[_0xf960('0x43')](_0x419e84),[_0xf960('0x92'),_0xf960('0x91'),_0xf960('0x93'),_0xf960('0x94')]);if(_0x3b61f3[_0xf960('0x56')]['id']){delete _0x3b61f3[_0xf960('0x56')]['id'];}if(_[_0xf960('0x7b')](_0x3b61f3[_0xf960('0x56')][_0xf960('0x95')])){throw new db['Sequelize'][(_0xf960('0x96'))](_0xf960('0x97'));}if(_[_0xf960('0x7b')](_0x3b61f3[_0xf960('0x56')][_0xf960('0x56')])||_0x3b61f3[_0xf960('0x56')]['body']===''){throw new db[(_0xf960('0x98'))]['ValidationError'](_0xf960('0x99'));}if(_['isNil'](_0x3b61f3['body'][_0xf960('0x9a')])){throw new db[(_0xf960('0x98'))][(_0xf960('0x96'))](_0xf960('0x9b')+_0x3fa2c3);}if(!_[_0xf960('0x9c')](_0x3fa2c3,_0x3b61f3['body'][_0xf960('0x9a')])){throw new db[(_0xf960('0x98'))]['ValidationError'](_0xf960('0x9d')+_0x3fa2c3);}_0x52265e[_0x3b61f3[_0xf960('0x56')][_0xf960('0x9a')]]=_0x3b61f3[_0xf960('0x56')][_0xf960('0x95')];})[_0xf960('0x1e')](function(){return db[_0xf960('0x3d')]['find']({'where':{'id':_0x3b61f3[_0xf960('0x5d')]['id']},'include':[{'model':db[_0xf960('0x9e')],'as':'List','include':[{'model':db[_0xf960('0x8e')],'as':_0xf960('0x9f'),'where':_0x52265e,'limit':0x1,'order':[[_0xf960('0x91'),'DESC']]}]},{'model':db['ChatApplication'],'as':_0xf960('0xa0')}]});})['then'](handleEntityNotFound(_0x96a8d8,null))[_0xf960('0x1e')](function(_0x481c27){if(_0x481c27&&_0x481c27[_0xf960('0xa1')]){_0x1093cd[_0xf960('0xa2')]=_0x481c27;_0x1093cd[_0xf960('0xa3')]=_0x481c27[_0xf960('0xa0')];_0x1093cd[_0xf960('0xa4')]=_0x481c27[_0xf960('0xa1')];_0x1093cd[_0xf960('0xa3')]=_[_0xf960('0xa5')](_0x1093cd['applications'],['priority'],[_0xf960('0xa6')]);if(_0x1093cd[_0xf960('0xa2')][_0xf960('0xa0')]){delete _0x1093cd['account'][_0xf960('0xa0')];}if(_0x1093cd['account']['List']&&_0x1093cd[_0xf960('0xa2')]['List']['Contacts']['length']){return _0x1093cd[_0xf960('0xa2')][_0xf960('0xa1')][_0xf960('0x9f')][0x0];}var _0x1be185=_[_0xf960('0x15')](_0x3b61f3[_0xf960('0x56')],{'firstName':_0x3b61f3[_0xf960('0x56')][_0xf960('0x95')],'ListId':_0x481c27['ListId']});_0x1be185[_0x3b61f3['body'][_0xf960('0x9a')]]=_0x3b61f3[_0xf960('0x56')]['from'];return db[_0xf960('0x8e')]['create'](_0x1be185,{'fields':_0x3067ca,'raw':!![]});}})['then'](handleEntityNotFound(_0x96a8d8,null))['then'](function(_0x3b2399){_0x1093cd['contact']=_0x3b2399;var _0x3854e0=_0x3b61f3[_0xf960('0x56')]['customerIp'];if(_0x3b61f3['headers'][_0xf960('0xa7')]){_0x3854e0=_0x3b61f3[_0xf960('0x8a')]['cf-connecting-ip'];}else if(_0x3b61f3[_0xf960('0x8a')][_0xf960('0xa8')]){_0x3854e0=_[_0xf960('0xa9')](_0x3b61f3[_0xf960('0x8a')][_0xf960('0xa8')][_0xf960('0xaa')](','));}if(_0x3b2399){var _0x2fc28c={'ContactId':_0x3b2399['id'],'ChatWebsiteId':_0x3b61f3[_0xf960('0x5d')]['id'],'from':(_0x3b2399[_0xf960('0xab')]||'')+'\x20'+(_0x3b2399[_0xf960('0xac')]||''),'customerIp':_0x3854e0,'customerPort':_0x3b61f3[_0xf960('0x8a')]['x-real-port']?_0x3b61f3['headers']['x-real-port']:null,'referer':_0x3b61f3[_0xf960('0x56')][_0xf960('0xad')],'browserName':_0x4a77ba[_0xf960('0xae')]['name']&&_0x4a77ba[_0xf960('0xae')][_0xf960('0xaf')]?util[_0xf960('0xb0')](_0xf960('0xb1'),_0x4a77ba['browser'][_0xf960('0x39')],_0x4a77ba[_0xf960('0xae')]['version']):'unknown','browserVersion':_0x4a77ba[_0xf960('0xae')]['version']||_0xf960('0xb2'),'osName':util[_0xf960('0xb0')]('%s\x20%s',_0x4a77ba['os'][_0xf960('0x39')],_0x4a77ba['os'][_0xf960('0xaf')]),'osVersion':_0x4a77ba['os'][_0xf960('0xaf')],'deviceModel':_0x4a77ba[_0xf960('0xb3')][_0xf960('0x40')]&&_0x4a77ba[_0xf960('0xb3')]['vendor']?util[_0xf960('0xb0')](_0xf960('0xb4'),_0x4a77ba[_0xf960('0xb3')][_0xf960('0x40')],_0x4a77ba['device'][_0xf960('0xb5')],_0x4a77ba['device'][_0xf960('0x4c')]):null,'deviceVendor':_0x4a77ba[_0xf960('0xb3')][_0xf960('0xb5')],'deviceType':_0x4a77ba[_0xf960('0xb3')][_0xf960('0x4c')],'formData':JSON[_0xf960('0x22')](_0x3b61f3['body'])};var _0x4efc06={'ChatWebsiteId':_0x3b61f3[_0xf960('0x5d')]['id'],'closed':![]};if(_0x3b61f3[_0xf960('0x56')][_0xf960('0xb6')]){_0x4efc06[_0xf960('0xb6')]=_0x3b61f3['body']['threadId'];return db[_0xf960('0xb7')][_0xf960('0x55')]({'where':_0x4efc06})[_0xf960('0x1e')](function(_0x4c99af){if(_0x4c99af){return[_0x4c99af,![]];}_0x2fc28c['threadId']=_0x3b61f3['body']['threadId'];_0x2fc28c['externalUrl']=_0x3b61f3['body'][_0xf960('0xb8')];return db[_0xf960('0xb7')]['create'](_0x2fc28c)[_0xf960('0x1e')](function(_0x783929){return[_0x783929,!![]];});});}_0x4efc06[_0xf960('0xb9')]=_0x3b2399['id'];if(_0x3b61f3[_0xf960('0x56')][_0xf960('0xba')]&&_0x3b61f3[_0xf960('0x56')]['interaction']['id']){_0x4efc06['id']=_0x3b61f3[_0xf960('0x56')]['interaction']['id'];return db[_0xf960('0xb7')]['find']({'where':_0x4efc06})[_0xf960('0x1e')](function(_0x6ecfda){if(_0x6ecfda){return[_0x6ecfda,![]];}return db[_0xf960('0xb7')][_0xf960('0x62')](_0x2fc28c)[_0xf960('0x1e')](function(_0xbe1d22){return[_0xbe1d22,!![]];});});}return db['ChatInteraction'][_0xf960('0x62')](_0x2fc28c)['then'](function(_0x41e6e1){return[_0x41e6e1,!![]];});}})['spread'](function(_0x1aa0a7,_0x45bd0c){if(_0x1aa0a7){_0x184caa=_0x45bd0c;if(!_0x45bd0c){var _0x155abe={'from':(_0x1093cd[_0xf960('0xbb')][_0xf960('0xab')]||'')+'\x20'+(_0x1093cd['contact'][_0xf960('0xac')]||'')};if(_0x3b61f3[_0xf960('0x56')][_0xf960('0xb6')]&&_0x3b61f3[_0xf960('0x56')][_0xf960('0xbc')]&&_0x3b61f3[_0xf960('0x56')][_0xf960('0xb6')]!=_0x3b61f3['body'][_0xf960('0xbc')]){_0x155abe['threadId']=_0x3b61f3[_0xf960('0x56')][_0xf960('0xbc')];}return _0x1aa0a7['update'](_0x155abe);}else{return _0x1aa0a7;}}})[_0xf960('0x1e')](function(_0x2f2ea6){_0x1093cd[_0xf960('0xba')]=_0x2f2ea6[_0xf960('0x34')]({'plain':!![]});_0x1093cd['interaction'][_0xf960('0xbd')]=_0x184caa;if(_0x1093cd['interaction']['created']){if(_0x1093cd[_0xf960('0xa2')][_0xf960('0xbe')]){_0x1093cd['applications'][_0xf960('0xbf')]({'id':0x0,'priority':_0x1093cd['applications']['length']+0x1,'app':_0xf960('0xc0'),'appdata':_0xf960('0xc1'),'interval':_0xf960('0xc2')});}}return db[_0xf960('0xc3')][_0xf960('0x62')]({'body':_0x3b61f3[_0xf960('0x56')]['body'],'ChatWebsiteId':_0x3b61f3[_0xf960('0x5d')]['id'],'ChatInteractionId':_0x2f2ea6['id'],'direction':'in','ContactId':_0x1093cd['contact']['id'],'AttachmentId':_0x3b61f3['body'][_0xf960('0xc4')]});})[_0xf960('0x1e')](function(_0xfcd725){_0x1093cd[_0xf960('0x25')]=_0xfcd725;if(_0x1093cd[_0xf960('0xba')][_0xf960('0xc5')]){return db['User'][_0xf960('0x55')]({'attributes':['id','name'],'where':{'id':_0x1093cd[_0xf960('0xba')][_0xf960('0xc5')]}})[_0xf960('0x1e')](function(_0x128d92){if(_0x128d92){_0x1093cd[_0xf960('0xa3')][_0xf960('0xc6')]({'id':0x0,'priority':0x0,'app':_0xf960('0xc7'),'appdata':_0x128d92['name']+','+(_0x1093cd[_0xf960('0xa2')][_0xf960('0xc8')]||0xa),'interval':_0xf960('0xc2')});_0x1093cd[_0xf960('0xc9')]=!![];}return respondWithRpcPromise(_0xf960('0xca'),_0xf960('0xcb'),_0x1093cd);});}return respondWithRpcPromise('Start',_0xf960('0xcb'),_0x1093cd);})[_0xf960('0x1e')](function(_0x159403){respondWithRpcPromise(_0xf960('0xcc'),_0xf960('0xcc'),{'event':'notify','message':_0x159403},client9002);return _0x159403;})[_0xf960('0x1e')](respondWithResult(_0x96a8d8,null))[_0xf960('0x27')](handleError(_0x96a8d8,null));};exports['offline']=function(_0x1ece76,_0x395d41,_0xce94bf){var _0x52c7ce,_0xd81aa6,_0x4d135c;var _0x25d599=[];var _0x2f1a6b=[];var _0x36ecde={};var _0x191b92=_0x1ece76[_0xf960('0xcd')]||[];var _0x45b02=[];var _0x569c97;return db[_0xf960('0x8e')][_0xf960('0x5e')]()[_0xf960('0x1e')](function(_0x15e004){if(!_0x15e004){throw new db[(_0xf960('0x98'))]['ValidationError'](_0xf960('0x8f'));}_0x2f1a6b=_['difference'](_['keys'](_0x15e004),[_0xf960('0x92'),'updatedAt']);_0x25d599=_['difference'](_[_0xf960('0x43')](_0x15e004),[_0xf960('0x92'),_0xf960('0x91'),'CompanyId',_0xf960('0x94')]);if(_0x1ece76['body']['id']){delete _0x1ece76[_0xf960('0x56')]['id'];}if(_['isNil'](_0x1ece76[_0xf960('0x56')][_0xf960('0x95')])){throw _0x395d41[_0xf960('0x28')](0x1f4)[_0xf960('0x3a')](new db[(_0xf960('0x98'))][(_0xf960('0x96'))](_0xf960('0x97')));}if(_[_0xf960('0x7b')](_0x1ece76['body']['body'])||_0x1ece76[_0xf960('0x56')][_0xf960('0x56')]===''){throw _0x395d41['status'](0x1f4)[_0xf960('0x3a')](new db[(_0xf960('0x98'))][(_0xf960('0x96'))](_0xf960('0x99')));}if(_[_0xf960('0x7b')](_0x1ece76[_0xf960('0x56')]['mapKeyOffline'])){throw _0x395d41[_0xf960('0x28')](0x1f4)[_0xf960('0x3a')](new db['Sequelize'][(_0xf960('0x96'))](_0xf960('0xce')+_0x25d599));}if(!_[_0xf960('0x9c')](_0x25d599,_0x1ece76[_0xf960('0x56')][_0xf960('0xcf')])){throw _0x395d41['status'](0x1f4)[_0xf960('0x3a')](new db[(_0xf960('0x98'))][(_0xf960('0x96'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x25d599));}_0x36ecde[_0x1ece76[_0xf960('0x56')]['mapKeyOffline']]=_0x1ece76[_0xf960('0x56')][_0xf960('0x95')];})['then'](function(){return db[_0xf960('0x3d')][_0xf960('0x55')]({'where':{'id':_0x1ece76[_0xf960('0x5d')]['id']},'include':[{'model':db[_0xf960('0x9e')],'as':'List'},{'model':db[_0xf960('0xd0')],'as':_0xf960('0xd0')}]});})[_0xf960('0x1e')](handleEntityNotFound(_0x395d41,null))[_0xf960('0x1e')](function(_0x3d0811){if(_0x3d0811&&_0x3d0811[_0xf960('0xa1')]){_0xd81aa6=_0x3d0811;var _0x2d9f5a=_[_0xf960('0x15')](_0x1ece76[_0xf960('0x56')],{'firstName':_0x1ece76[_0xf960('0x56')][_0xf960('0x95')],'phone':_0x1ece76[_0xf960('0x56')]['from'],'ListId':_0x3d0811[_0xf960('0x94')]});_0x2d9f5a[_0x1ece76['body'][_0xf960('0xcf')]]=_0x1ece76[_0xf960('0x56')]['from'];return db[_0xf960('0x8e')][_0xf960('0xd1')]({'where':_0x36ecde,'defaults':_0x2d9f5a});}})[_0xf960('0xd2')](function(_0xbea8da){if(_0xbea8da){_0x4d135c=_0xbea8da;var _0xff2b82=fs['readFileSync'](path[_0xf960('0x7d')](config[_0xf960('0x77')],'server/files/templates/chatOfflineMessage.ejs'),_0xf960('0xd3'));var _0x1e1762=ejs['render'](_0xff2b82,{'body':_['toPairs'](_0x1ece76['body']['body']),'bodyTitle':_0xd81aa6['offlineMessageBody']});return db[_0xf960('0xd4')]['create']({'body':_0x1e1762,'ContactId':_0xbea8da['id'],'ChatWebsiteId':_0xd81aa6['id']});}})[_0xf960('0x1e')](function(_0xdf6e34){_0x569c97=_0xdf6e34;if(_0x191b92[_0xf960('0x47')]){var _0x59dd7d=_0x191b92[_0xf960('0x41')](function(_0x5189aa){return{'name':_0x5189aa[_0xf960('0xd5')],'basename':_0x5189aa[_0xf960('0x72')],'type':_0x5189aa[_0xf960('0xd6')],'ChatOfflineMessageId':_0xdf6e34['id']};});_0x45b02=_0x59dd7d['map'](_0x29eb5d=>{var _0x2fb038={'filename':_0x29eb5d[_0xf960('0x39')],'path':path[_0xf960('0x7d')](config[_0xf960('0x77')],_0xf960('0xd7'),_0xf960('0xcd'),_0xf960('0xd8'),_0xf960('0xd9'),_0x29eb5d[_0xf960('0xda')])};return _0x2fb038;});if(!_0xd81aa6[_0xf960('0xdb')]){return db[_0xf960('0xdc')][_0xf960('0xdd')](function(_0x107d31){return db[_0xf960('0xde')][_0xf960('0xdf')](_0x59dd7d,{'transaction':_0x107d31});});}}})[_0xf960('0x1e')](function(){if(_0x569c97){_0x52c7ce=_0x569c97;return db[_0xf960('0xd0')]['findOne']({'where':{'active':!![]},'include':[{'model':db[_0xf960('0xe0')],'as':_0xf960('0xe1'),'raw':!![]}]});}})[_0xf960('0x1e')](function(_0x38e91d){if(_0x38e91d&&_0x38e91d[_0xf960('0xe1')]&&_0xd81aa6[_0xf960('0xe2')]&&_0xd81aa6[_0xf960('0xe3')]){var _0x29a6c5={'tls':{'rejectUnauthorized':![]}};if(_0x38e91d['Smtp'][_0xf960('0xe4')]){_0x29a6c5['service']=_0x38e91d[_0xf960('0xe1')][_0xf960('0xe4')];}else{_0x29a6c5[_0xf960('0xe5')]=_0x38e91d[_0xf960('0xe1')][_0xf960('0xe5')];_0x29a6c5[_0xf960('0xe6')]=_0x38e91d[_0xf960('0xe1')][_0xf960('0xe6')];_0x29a6c5[_0xf960('0xe7')]=_0x38e91d[_0xf960('0xe1')][_0xf960('0xe7')];}if(_0x38e91d[_0xf960('0xe1')][_0xf960('0xe8')]){_0x29a6c5[_0xf960('0xe9')]={'user':_0x38e91d[_0xf960('0xe1')][_0xf960('0x57')],'pass':_0x38e91d[_0xf960('0xe1')][_0xf960('0xea')]};}return respondWithRpcPromise('SendMail',_0xf960('0xeb'),{'account':_0x29a6c5,'message':{'from':util['format'](_0xf960('0xec'),_0x38e91d[_0xf960('0x39')],_0x38e91d[_0xf960('0xed')]||_0x38e91d[_0xf960('0xe1')][_0xf960('0x57')]),'to':_0xd81aa6[_0xf960('0xe3')],'subject':_0xd81aa6['offlineMessageSubject'],'html':_0x52c7ce[_0xf960('0x56')],'attachments':_0x45b02}},client9003)[_0xf960('0x1e')](function(){return _0x52c7ce;})[_0xf960('0x27')](function(_0x5d4f1e){console['error'](_0x5d4f1e);});}})['then'](function(){if(_0xd81aa6&&_0xd81aa6[_0xf960('0xdb')]&&_0xd81aa6[_0xf960('0xee')]){var _0x2686d2=[];if(_0x191b92['length']){_0x2686d2=_0x191b92[_0xf960('0x41')](function(_0x57221e){return{'name':_0x57221e[_0xf960('0xd5')],'basename':_0x57221e[_0xf960('0x72')],'type':_0x57221e[_0xf960('0xd6')],'ChatOfflineMessageId':_0x569c97['id']};});}var _0x39f532;if(!_['isNil'](_0xd81aa6[_0xf960('0xef')])){var _0x6132ef=_[_0xf960('0x41')](_0x1ece76[_0xf960('0x56')],function(_0x3fabae){return _0x3fabae;});var _0x1e461f=_[_0xf960('0xf0')](_0x6132ef)[0x0];var _0x492952=_[_0xf960('0xf1')](_0x1e461f,function(_0x3eda44){return _0x3eda44;});_0x39f532=_0x492952[0x1][_0xd81aa6[_0xf960('0xef')]];}var _0x3a732a={'from':_0x4d135c[_0xf960('0xed')],'firstName':_0x4d135c[_0xf960('0xab')],'lastName':_0x4d135c[_0xf960('0xac')],'mapKey':_0xf960('0xed'),'message':{'from':_0x4d135c[_0xf960('0xed')],'to':_0xd81aa6['MailAccount']['email'],'cc':'','subject':_[_0xf960('0x7b')](_0x39f532)?_0xd81aa6['offlineMessageSubject']:_0x39f532,'messageId':'','sentAt':new Date(),'attach':_0x2686d2[_0xf960('0x47')],'attachments':_0x2686d2,'originChannel':_0xf960('0xf2'),'ChatWebsiteId':_0xd81aa6['id'],'ChatOfflineMessageId':_0x52c7ce['id'],'originTo':_0xd81aa6[_0xf960('0xd0')]['email']},'body':_0x52c7ce[_0xf960('0x56')]};var _0x29ce95={'account':{'id':_0xd81aa6[_0xf960('0xee')]},'body':_0x3a732a,'log':_0xf960('0xf3')};return respondWithRpcPromise(_0xf960('0xf3'),_0xf960('0xf4'),_0x29ce95,client9001)[_0xf960('0x1e')](function(){return _0x52c7ce;})[_0xf960('0x27')](function(_0x5b86e1){console[_0xf960('0x23')](_0x5b86e1);});}return;})[_0xf960('0x1e')](function(){if(_0x52c7ce){return _0x52c7ce;}})[_0xf960('0x1e')](respondWithResult(_0x395d41,null))['catch'](function(_0xa59c7f){console[_0xf960('0x23')]('catch',_0xa59c7f);for(var _0x2542f5 of _0x191b92){var _0x530d17=path['join'](config[_0xf960('0x77')],'server',_0xf960('0xcd'),_0xf960('0xd8'),_0xf960('0xd9'),_0x2542f5[_0xf960('0x72')]);fs_extra[_0xf960('0xf5')](_0x530d17)[_0xf960('0x27')](function(_0x12a64f){console[_0xf960('0x23')](_0xf960('0xf6'),_0x530d17,_0x12a64f);});}});};exports[_0xf960('0xf7')]=function(_0x101b34,_0x305da5,_0x24a411){return db[_0xf960('0xb7')][_0xf960('0x55')]({'where':{'id':_0x101b34[_0xf960('0x5d')]['id']}})[_0xf960('0x1e')](handleEntityNotFound(_0x305da5,null))['then'](function(_0x1199ab){if(_0x1199ab){return _0x1199ab['addInteraction'](_0x101b34[_0xf960('0x56')][_0xf960('0x6c')],_[_0xf960('0xf8')](_0x101b34[_0xf960('0x56')],['ids','id'])||{});}})[_0xf960('0x1e')](respondWithResult(_0x305da5,null))[_0xf960('0x27')](handleError(_0x305da5,null));};exports[_0xf960('0xf9')]=function(_0x5a0675,_0x5549cb,_0x4a939e){var _0x331ed8={'raw':![],'where':{}};var _0xed5e69={};var _0x3ef694={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xf960('0x64')]({'where':{'id':_0x5a0675[_0xf960('0x5d')]['id']}})[_0xf960('0x1e')](handleEntityNotFound(_0x5549cb,null))[_0xf960('0x1e')](function(_0x6e7ff){if(_0x6e7ff){_0xed5e69['model']=_[_0xf960('0x43')](db['ChatInteraction'][_0xf960('0x3e')]);_0xed5e69['query']=_[_0xf960('0x43')](_0x5a0675[_0xf960('0x42')]);_0xed5e69[_0xf960('0x44')]=_['intersection'](_0xed5e69['model'],_0xed5e69[_0xf960('0x42')]);_0x331ed8[_0xf960('0x46')]=_[_0xf960('0x54')](_0xed5e69['model'],qs[_0xf960('0x45')](_0x5a0675['query'][_0xf960('0x45')]));_0x331ed8[_0xf960('0x46')]=_0x331ed8[_0xf960('0x46')][_0xf960('0x47')]?_0x331ed8[_0xf960('0x46')]:_0xed5e69[_0xf960('0x40')];if(!_0x5a0675[_0xf960('0x42')][_0xf960('0x48')]('nolimit')){_0x331ed8[_0xf960('0x2c')]=qs['limit'](_0x5a0675[_0xf960('0x42')][_0xf960('0x2c')]);_0x331ed8[_0xf960('0x2a')]=qs['offset'](_0x5a0675['query'][_0xf960('0x2a')]);}_0x331ed8['order']=qs[_0xf960('0x4a')](_0x5a0675[_0xf960('0x42')][_0xf960('0x4a')]);_0x331ed8[_0xf960('0x4b')]=qs['filters'](_[_0xf960('0x65')](_0x5a0675['query'],_0xed5e69['filters']));_0x331ed8['where'][_0xf960('0x60')]=_0x6e7ff['id'];if(_0x5a0675[_0xf960('0x42')][_0xf960('0x66')]){_0x331ed8[_0xf960('0x4b')]=_[_0xf960('0x4e')](_0x331ed8['where'],{'$or':_[_0xf960('0x41')](_0x331ed8[_0xf960('0x46')],function(_0x166ba7){var _0x57c1f6={};_0x57c1f6[_0x166ba7]={'$like':'%'+_0x5a0675[_0xf960('0x42')]['filter']+'%'};return _0x57c1f6;})});}_0x331ed8=_[_0xf960('0x4e')]({},_0x331ed8,_0x5a0675[_0xf960('0x4f')]);return db['ChatInteraction']['count']({'where':_0x331ed8[_0xf960('0x4b')]})[_0xf960('0x1e')](function(_0x52bc2a){_0x3ef694[_0xf960('0x2d')]=_0x52bc2a;if(_0x5a0675[_0xf960('0x42')][_0xf960('0x67')]){_0x331ed8[_0xf960('0x50')]=[{'model':db['CmContact'],'as':_0xf960('0xfa'),'required':![]},{'model':db['User'],'as':_0xf960('0xfb'),'attributes':[_0xf960('0x39'),_0xf960('0xfc'),'internal'],'required':![]},{'model':db['Tag'],'as':_0xf960('0xfd'),'attributes':['id','name',_0xf960('0xfe')],'where':_0x5a0675[_0xf960('0x42')]['tag']?{'id':_0x5a0675[_0xf960('0x42')][_0xf960('0xff')]}:undefined,'required':_0x5a0675['query'][_0xf960('0xff')]?!![]:![]}];}return db[_0xf960('0xb7')][_0xf960('0x51')](_0x331ed8);})['then'](function(_0x193c2d){_0x3ef694[_0xf960('0x52')]=_0x193c2d;return _0x3ef694;});}})[_0xf960('0x1e')](respondWithFilteredResult(_0x5549cb,_0x331ed8))[_0xf960('0x27')](handleError(_0x5549cb,null));};function iftimePromise(_0x444eef,_0x2bd268){return respondWithRpcPromise(_0xf960('0x100'),_0xf960('0x101'),{'command':_0x2bd268['timezone']?util[_0xf960('0xb0')](_0xf960('0x102'),_0x444eef[_0xf960('0x103')],_0x2bd268[_0xf960('0x104')]):util[_0xf960('0xb0')](_0xf960('0x105'),_0x444eef[_0xf960('0x103')])},client9002)[_0xf960('0x1e')](function(_0x1e4c11){var _0x1062f8=_0x1e4c11&&_0x1e4c11['indexOf']('true')>=0x0?!![]:![];logger[_0xf960('0x1f')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x2bd268['id'],_0x444eef['id'],_0x444eef[_0xf960('0x103')],_0x1062f8?'ONLINE':_0xf960('0x106'),_0x2bd268[_0xf960('0x104')]?_0x2bd268[_0xf960('0x104')]:_0xf960('0x107'));return _0x1062f8;})[_0xf960('0x27')](function(_0xdff9f3){logger['error'](_0xf960('0x108'),_0x2bd268['id'],_0x444eef['id'],_0x444eef[_0xf960('0x103')],util[_0xf960('0x109')](_0xdff9f3,{'showHidden':![],'depth':null}),_0x2bd268[_0xf960('0x104')]?_0x2bd268['timezone']:_0xf960('0x107'));return![];});}exports[_0xf960('0x101')]=function(_0x550fe5,_0x2f623d,_0x519818){var _0x120514=0x0;var _0x39caf=0x0;var _0x11e847=![];var _0x3c90ad;var _0x5a2c4e;return db[_0xf960('0x3d')]['find']({'where':{'id':_0x550fe5[_0xf960('0x5d')]['id']},'include':[{'model':db[_0xf960('0x10a')],'as':'Interval','include':[{'model':db[_0xf960('0x10a')],'as':_0xf960('0x10b'),'attributes':['id',_0xf960('0x103')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x2f623d,null))[_0xf960('0x1e')](function(_0x4ee288){if(_0x4ee288){_0x3c90ad=_0x4ee288;return _0x4ee288[_0xf960('0x10c')]({'raw':!![]});}})[_0xf960('0x1e')](function(_0x589997){if(_0x3c90ad){if(_0x589997){_0x5a2c4e=_0x589997;}}return require(_0xf960('0x12'))[_0xf960('0x79')]();})['then'](function(_0x5ec79e){if(_0x5ec79e){_0x39caf=_0x5ec79e[_0xf960('0x10d')];_0x11e847=_0x5ec79e['custom'];}})[_0xf960('0x1e')](function(){return db[_0xf960('0xb7')][_0xf960('0x2d')]({'where':{'closed':![]}});})[_0xf960('0x1e')](function(_0x2b211c){_0x120514=_0x2b211c;if(_0x39caf&&_0x2b211c>_0x39caf){return db['License']['findOne']({'where':{'id':0x1}})[_0xf960('0x1e')](function(_0x5cc845){if(_0x5cc845){_0x5cc845[_0xf960('0x10e')]('chatLicenseExceeded');}});}})[_0xf960('0x1e')](function(){if(_0x3c90ad[_0xf960('0x10a')]&&_0x3c90ad[_0xf960('0x10a')][_0xf960('0x10b')]){var _0xc288c5=[];for(var _0x538578=0x0;_0x538578<_0x3c90ad[_0xf960('0x10a')][_0xf960('0x10b')][_0xf960('0x47')];_0x538578++){var _0x17481f=_0x3c90ad['Interval'][_0xf960('0x10b')][_0x538578]['get']({'plain':!![]});_0xc288c5[_0xf960('0xbf')](iftimePromise(_0x17481f,_0x3c90ad));}return BPromise[_0xf960('0x10f')](_0xc288c5)[_0xf960('0x1e')](function(_0x538118){return _[_0xf960('0x110')](_0x538118);});}else{return!![];}})[_0xf960('0x1e')](function(_0x22ef50){var _0x5cd547=fs[_0xf960('0x111')](path['join'](config[_0xf960('0x77')],_0xf960('0x112')),_0xf960('0xd3'));var _0x393b55={'remote':_0x3c90ad[_0xf960('0x113')],'query':querystring[_0xf960('0x22')](_[_0xf960('0x4e')](_0x3c90ad['get']({'plain':!![]}),{'customerIp':_0x550fe5[_0xf960('0x8a')][_0xf960('0xa8')]||_0x550fe5[_0xf960('0x8a')][_0xf960('0x114')]||_0x550fe5[_0xf960('0x115')]['remoteAddress']||_0x550fe5['ip'],'referer':_0x550fe5['headers']['referer'],'openedInteractions':_0x120514,'maxInteractions':_0x39caf,'virtual':_0x11e847[_0xf960('0x10d')],'online':_0x22ef50,'custom':_0x11e847}))[_0xf960('0x116')](/'/g,'\x5c\x27')};_0x2f623d[_0xf960('0x3a')](ejs['render'](Mustache[_0xf960('0x117')](_0x5cd547,_0x393b55),{'proactiveActions':_0x5a2c4e,'alignment':_0x3c90ad[_0xf960('0x118')],'verticalAlignment':_0x3c90ad[_0xf960('0x119')],'div_color':_0x3c90ad[_0xf960('0xfe')],'text_color':_0x3c90ad['textColor'],'button_color':_0x3c90ad['color_button'],'background_color':_0x3c90ad[_0xf960('0x11a')]}));})[_0xf960('0x27')](handleError(_0x2f623d,null));};exports[_0xf960('0x11b')]=function(_0x3fe4c2,_0x638332,_0x240c7d){return db[_0xf960('0x3d')][_0xf960('0x64')]({'where':{'id':_0x3fe4c2[_0xf960('0x5d')]['id']}})[_0xf960('0x1e')](handleEntityNotFound(_0x638332,null))[_0xf960('0x1e')](function(_0x219c17){if(_0x219c17){return db[_0xf960('0xdc')]['transaction'](function(_0x4cb23e){return db['ChatApplication'][_0xf960('0x33')]({'where':{'ChatWebsiteId':_0x3fe4c2['params']['id']},'transaction':_0x4cb23e})[_0xf960('0x1e')](function(_0x317d15){var _0xac4397=_[_0xf960('0x41')](_0x3fe4c2['body'],function(_0x4bfacc){_0x4bfacc[_0xf960('0x60')]=_0x3fe4c2[_0xf960('0x5d')]['id'];return _0x4bfacc;});return db[_0xf960('0x11c')][_0xf960('0xdf')](_0xac4397,{'transaction':_0x4cb23e});});})['then'](function(){return db[_0xf960('0x11c')][_0xf960('0x11d')]({'where':{'ChatWebsiteId':_0x3fe4c2[_0xf960('0x5d')]['id']},'order':_0xf960('0x11e')});});}})[_0xf960('0x1e')](respondWithResult(_0x638332,null))[_0xf960('0x27')](handleError(_0x638332,null));};exports[_0xf960('0x11f')]=function(_0x23f967,_0x378b9b,_0xed9686){var _0x458033={};var _0x543066={};var _0x799da6;var _0x1ee811;return db[_0xf960('0x3d')][_0xf960('0x64')]({'where':{'id':_0x23f967[_0xf960('0x5d')]['id']}})[_0xf960('0x1e')](handleEntityNotFound(_0x378b9b,null))['then'](function(_0x4d354f){if(_0x4d354f){_0x799da6=_0x4d354f;_0x543066[_0xf960('0x40')]=_[_0xf960('0x43')](db[_0xf960('0x11c')][_0xf960('0x3e')]);_0x543066[_0xf960('0x42')]=_[_0xf960('0x43')](_0x23f967[_0xf960('0x42')]);_0x543066['filters']=_[_0xf960('0x54')](_0x543066[_0xf960('0x40')],_0x543066[_0xf960('0x42')]);_0x458033[_0xf960('0x46')]=_[_0xf960('0x54')](_0x543066['model'],qs['fields'](_0x23f967['query'][_0xf960('0x45')]));_0x458033[_0xf960('0x46')]=_0x458033['attributes'][_0xf960('0x47')]?_0x458033[_0xf960('0x46')]:_0x543066[_0xf960('0x40')];_0x458033[_0xf960('0x6a')]=qs[_0xf960('0x4a')](_0x23f967['query'][_0xf960('0x4a')]);_0x458033[_0xf960('0x4b')]=qs[_0xf960('0x44')](_[_0xf960('0x65')](_0x23f967[_0xf960('0x42')],_0x543066[_0xf960('0x44')]));if(_0x23f967[_0xf960('0x42')][_0xf960('0x66')]){_0x458033['where']=_[_0xf960('0x4e')](_0x458033[_0xf960('0x4b')],{'$or':_[_0xf960('0x41')](_0x458033[_0xf960('0x46')],function(_0x471431){var _0x1cac34={};_0x1cac34[_0x471431]={'$like':'%'+_0x23f967[_0xf960('0x42')][_0xf960('0x66')]+'%'};return _0x1cac34;})});}_0x458033=_[_0xf960('0x4e')]({},_0x458033,_0x23f967['options']);return _0x799da6[_0xf960('0x11f')](_0x458033);}})[_0xf960('0x1e')](function(_0x54b345){if(_0x54b345){_0x1ee811=_0x54b345[_0xf960('0x47')];if(!_0x23f967[_0xf960('0x42')][_0xf960('0x48')](_0xf960('0x49'))){_0x458033[_0xf960('0x2c')]=qs[_0xf960('0x2c')](_0x23f967[_0xf960('0x42')][_0xf960('0x2c')]);_0x458033[_0xf960('0x2a')]=qs[_0xf960('0x2a')](_0x23f967[_0xf960('0x42')][_0xf960('0x2a')]);}return _0x799da6[_0xf960('0x11f')](_0x458033);}})[_0xf960('0x1e')](function(_0xd9cfe2){if(_0xd9cfe2){return _0xd9cfe2?{'count':_0x1ee811,'rows':_0xd9cfe2}:null;}})[_0xf960('0x1e')](respondWithResult(_0x378b9b,null))[_0xf960('0x27')](handleError(_0x378b9b,null));};exports[_0xf960('0x120')]=function(_0x77bc03,_0x24d953,_0x2b7b2c){return db[_0xf960('0x121')][_0xf960('0x55')]({'where':{'id':_0x77bc03[_0xf960('0x5d')]['id']}})[_0xf960('0x1e')](handleEntityNotFound(_0x24d953,null))['then'](function(_0x2407da){if(_0x2407da){return _0x2407da[_0xf960('0x120')](_0x77bc03[_0xf960('0x56')][_0xf960('0x6c')],_[_0xf960('0xf8')](_0x77bc03[_0xf960('0x56')],['ids','id'])||{});}})['then'](respondWithResult(_0x24d953,null))[_0xf960('0x27')](handleError(_0x24d953,null));};exports[_0xf960('0x10c')]=function(_0x4b03af,_0x29be6c,_0x8e190e){var _0x3047b5={};var _0x1e19db={};var _0x995e52;var _0x43a7e7;return db['ChatWebsite'][_0xf960('0x64')]({'where':{'id':_0x4b03af[_0xf960('0x5d')]['id']}})[_0xf960('0x1e')](handleEntityNotFound(_0x29be6c,null))['then'](function(_0x66b1d6){if(_0x66b1d6){_0x995e52=_0x66b1d6;_0x1e19db[_0xf960('0x40')]=_['keys'](db[_0xf960('0x122')][_0xf960('0x3e')]);_0x1e19db[_0xf960('0x42')]=_[_0xf960('0x43')](_0x4b03af[_0xf960('0x42')]);_0x1e19db['filters']=_['intersection'](_0x1e19db[_0xf960('0x40')],_0x1e19db[_0xf960('0x42')]);_0x3047b5[_0xf960('0x46')]=_[_0xf960('0x54')](_0x1e19db[_0xf960('0x40')],qs['fields'](_0x4b03af[_0xf960('0x42')]['fields']));_0x3047b5[_0xf960('0x46')]=_0x3047b5[_0xf960('0x46')][_0xf960('0x47')]?_0x3047b5[_0xf960('0x46')]:_0x1e19db['model'];_0x3047b5[_0xf960('0x6a')]=qs['sort'](_0x4b03af[_0xf960('0x42')][_0xf960('0x4a')]);_0x3047b5['where']=qs[_0xf960('0x44')](_[_0xf960('0x65')](_0x4b03af[_0xf960('0x42')],_0x1e19db[_0xf960('0x44')]));if(_0x4b03af[_0xf960('0x42')]['filter']){_0x3047b5[_0xf960('0x4b')]=_[_0xf960('0x4e')](_0x3047b5[_0xf960('0x4b')],{'$or':_[_0xf960('0x41')](_0x3047b5[_0xf960('0x46')],function(_0x4701f3){var _0x1164d7={};_0x1164d7[_0x4701f3]={'$like':'%'+_0x4b03af[_0xf960('0x42')][_0xf960('0x66')]+'%'};return _0x1164d7;})});}_0x3047b5=_[_0xf960('0x4e')]({},_0x3047b5,_0x4b03af[_0xf960('0x4f')]);return _0x995e52[_0xf960('0x10c')](_0x3047b5);}})['then'](function(_0x37a8a3){if(_0x37a8a3){_0x43a7e7=_0x37a8a3['length'];if(!_0x4b03af[_0xf960('0x42')][_0xf960('0x48')]('nolimit')){_0x3047b5[_0xf960('0x2c')]=qs['limit'](_0x4b03af[_0xf960('0x42')]['limit']);_0x3047b5[_0xf960('0x2a')]=qs['offset'](_0x4b03af[_0xf960('0x42')][_0xf960('0x2a')]);}return _0x995e52[_0xf960('0x10c')](_0x3047b5);}})[_0xf960('0x1e')](function(_0xa0beaf){if(_0xa0beaf){return _0xa0beaf?{'count':_0x43a7e7,'rows':_0xa0beaf}:null;}})[_0xf960('0x1e')](respondWithResult(_0x29be6c,null))[_0xf960('0x27')](handleError(_0x29be6c,null));};exports[_0xf960('0x123')]=function(_0xfdbf2c,_0x7ee2f5,_0x4b9f23){var _0x49e11b=_0xfdbf2c['query'][_0xf960('0x124')]===_0xf960('0x125')?_0xf960('0x126'):_0xf960('0x127');return db[_0xf960('0x3d')][_0xf960('0x55')]({'attributes':['id',_0x49e11b],'where':{'id':_0xfdbf2c['params']['id']}})[_0xf960('0x1e')](handleEntityNotFound(_0x7ee2f5,null))['then'](function(_0x3659f8){if(_0x3659f8){var _0x1e33d5=_0x3659f8[_0x49e11b];var _0x376952=_0x1e33d5&&_0x1e33d5[_0xf960('0x128')]?_0x1e33d5[_0xf960('0x128')]:[];_0x7ee2f5[_0xf960('0x3a')]({'fromKey':_[_0xf960('0x7b')](_0x1e33d5['fromKey'])?undefined:_0x1e33d5[_0xf960('0x129')],'count':_0x376952[_0xf960('0x47')],'rows':_0x376952});}})['catch'](handleError(_0x7ee2f5,null));};exports[_0xf960('0x12a')]=function(_0x17e461,_0x4a0429,_0x38770f){var _0xb57568={'raw':![],'where':{}};var _0x597371={};var _0x38f0a6={'count':0x0,'rows':[]};return db[_0xf960('0x3d')]['findOne']({'where':{'id':_0x17e461[_0xf960('0x5d')]['id']}})[_0xf960('0x1e')](handleEntityNotFound(_0x4a0429,null))[_0xf960('0x1e')](function(_0x5d8b23){if(_0x5d8b23){_0x597371[_0xf960('0x40')]=_[_0xf960('0x43')](db[_0xf960('0xd4')][_0xf960('0x3e')]);_0x597371[_0xf960('0x42')]=_[_0xf960('0x43')](_0x17e461['query']);_0x597371['filters']=_[_0xf960('0x54')](_0x597371['model'],_0x597371[_0xf960('0x42')]);_0xb57568[_0xf960('0x46')]=_['intersection'](_0x597371[_0xf960('0x40')],qs['fields'](_0x17e461['query'][_0xf960('0x45')]));_0xb57568[_0xf960('0x46')]=_0xb57568[_0xf960('0x46')][_0xf960('0x47')]?_0xb57568[_0xf960('0x46')]:_0x597371[_0xf960('0x40')];if(!_0x17e461[_0xf960('0x42')]['hasOwnProperty'](_0xf960('0x49'))){_0xb57568['limit']=qs[_0xf960('0x2c')](_0x17e461[_0xf960('0x42')][_0xf960('0x2c')]);_0xb57568[_0xf960('0x2a')]=qs[_0xf960('0x2a')](_0x17e461[_0xf960('0x42')]['offset']);}_0xb57568[_0xf960('0x6a')]=qs[_0xf960('0x4a')](_0x17e461[_0xf960('0x42')][_0xf960('0x4a')]);_0xb57568[_0xf960('0x4b')]=qs['filters'](_[_0xf960('0x65')](_0x17e461[_0xf960('0x42')],_0x597371[_0xf960('0x44')]));_0xb57568[_0xf960('0x4b')]['ChatWebsiteId']=_0x5d8b23['id'];if(_0x17e461[_0xf960('0x42')][_0xf960('0x66')]){_0xb57568['where']=_[_0xf960('0x4e')](_0xb57568[_0xf960('0x4b')],{'$or':_[_0xf960('0x41')](_0xb57568['attributes'],function(_0x3bfb98){var _0x50440e={};_0x50440e[_0x3bfb98]={'$like':'%'+_0x17e461[_0xf960('0x42')]['filter']+'%'};return _0x50440e;})});}_0xb57568=_[_0xf960('0x4e')]({},_0xb57568,_0x17e461[_0xf960('0x4f')]);return db['ChatOfflineMessage'][_0xf960('0x2d')]({'where':_0xb57568[_0xf960('0x4b')]})[_0xf960('0x1e')](function(_0x508254){_0x38f0a6[_0xf960('0x2d')]=_0x508254;if(_0x17e461[_0xf960('0x42')][_0xf960('0x67')]){_0xb57568['include']=[{'all':!![]}];}else{_0xb57568[_0xf960('0x50')]=[{'model':db['CmContact'],'as':_0xf960('0xfa'),'required':![]},{'model':db[_0xf960('0xde')],'as':_0xf960('0x12b'),'required':![]}];}return db[_0xf960('0xd4')][_0xf960('0x51')](_0xb57568);})[_0xf960('0x1e')](function(_0x3b733b){_0x38f0a6[_0xf960('0x52')]=_0x3b733b;return _0x38f0a6;});}})[_0xf960('0x1e')](respondWithFilteredResult(_0x4a0429,_0xb57568))['catch'](handleError(_0x4a0429,null));};exports[_0xf960('0x12c')]=function(_0x5dd607,_0x49c96a,_0x54095b){return db[_0xf960('0x3d')]['find']({'where':{'id':_0x5dd607[_0xf960('0x5d')]['id']}})[_0xf960('0x1e')](handleEntityNotFound(_0x49c96a,null))[_0xf960('0x1e')](function(_0x35e302){if(_0x35e302){return _0x35e302[_0xf960('0x12c')](_0x5dd607[_0xf960('0x56')]['ids'],_['omit'](_0x5dd607[_0xf960('0x56')],[_0xf960('0x6c'),'id'])||{})['spread'](function(_0x430fcd){for(var _0x5455b4=0x0;_0x5455b4<_0x5dd607[_0xf960('0x56')][_0xf960('0x6c')][_0xf960('0x47')];_0x5455b4+=0x1){socket['emit'](_0xf960('0x12d'),{'UserId':Number(_0x5dd607[_0xf960('0x56')][_0xf960('0x6c')][_0x5455b4]),'ChatWebsiteId':Number(_0x5dd607[_0xf960('0x5d')]['id'])});}return _0x430fcd;});}})[_0xf960('0x1e')](respondWithResult(_0x49c96a,null))['catch'](handleError(_0x49c96a,null));};exports[_0xf960('0x12e')]=function(_0x2b84c5,_0x2cd2c4,_0x224fe4){return db[_0xf960('0x3d')]['find']({'where':{'id':_0x2b84c5[_0xf960('0x5d')]['id']}})[_0xf960('0x1e')](handleEntityNotFound(_0x2cd2c4,null))[_0xf960('0x1e')](function(_0x518f7b){if(_0x518f7b){return _0x518f7b[_0xf960('0x12e')](_0x2b84c5[_0xf960('0x42')][_0xf960('0x6c')])[_0xf960('0x1e')](function(){if(_['isArray'](_0x2b84c5['query'][_0xf960('0x6c')])){for(var _0x7b76b4=0x0;_0x7b76b4<_0x2b84c5[_0xf960('0x42')]['ids'][_0xf960('0x47')];_0x7b76b4+=0x1){socket[_0xf960('0x12f')](_0xf960('0x130'),{'UserId':Number(_0x2b84c5['query']['ids'][_0x7b76b4]),'ChatWebsiteId':Number(_0x2b84c5['params']['id'])});}}else{socket[_0xf960('0x12f')](_0xf960('0x130'),{'UserId':Number(_0x2b84c5[_0xf960('0x42')][_0xf960('0x6c')]),'ChatWebsiteId':Number(_0x2b84c5[_0xf960('0x5d')]['id'])});}});}})[_0xf960('0x1e')](respondWithStatusCode(_0x2cd2c4,null))[_0xf960('0x27')](handleError(_0x2cd2c4,null));};exports[_0xf960('0x131')]=function(_0x436dbb,_0xa712ef,_0x3322f5){var _0x329f82={};var _0x22f372={};var _0x3a7b93;var _0x1852c6;return db['ChatWebsite'][_0xf960('0x64')]({'where':{'id':_0x436dbb[_0xf960('0x5d')]['id']}})['then'](handleEntityNotFound(_0xa712ef,null))[_0xf960('0x1e')](function(_0x349817){if(_0x349817){_0x3a7b93=_0x349817;_0x22f372[_0xf960('0x40')]=_[_0xf960('0x43')](db['User']['rawAttributes']);_0x22f372[_0xf960('0x42')]=_[_0xf960('0x43')](_0x436dbb[_0xf960('0x42')]);_0x22f372[_0xf960('0x44')]=_[_0xf960('0x54')](_0x22f372[_0xf960('0x40')],_0x22f372[_0xf960('0x42')]);_0x329f82[_0xf960('0x46')]=_[_0xf960('0x54')](_0x22f372['model'],qs[_0xf960('0x45')](_0x436dbb[_0xf960('0x42')][_0xf960('0x45')]));_0x329f82['attributes']=_0x329f82['attributes'][_0xf960('0x47')]?_0x329f82[_0xf960('0x46')]:_0x22f372[_0xf960('0x40')];_0x329f82[_0xf960('0x6a')]=qs[_0xf960('0x4a')](_0x436dbb[_0xf960('0x42')][_0xf960('0x4a')]);_0x329f82[_0xf960('0x4b')]=qs[_0xf960('0x44')](_[_0xf960('0x65')](_0x436dbb[_0xf960('0x42')],_0x22f372[_0xf960('0x44')]));if(_0x436dbb[_0xf960('0x42')][_0xf960('0x66')]){_0x329f82[_0xf960('0x4b')]=_['merge'](_0x329f82[_0xf960('0x4b')],{'$or':_['map'](_0x329f82[_0xf960('0x46')],function(_0x581ab8){var _0x4f99cf={};_0x4f99cf[_0x581ab8]={'$like':'%'+_0x436dbb[_0xf960('0x42')][_0xf960('0x66')]+'%'};return _0x4f99cf;})});}_0x329f82=_['merge']({},_0x329f82,_0x436dbb[_0xf960('0x4f')]);return _0x3a7b93[_0xf960('0x131')](_0x329f82);}})['then'](function(_0x4a9eb7){if(_0x4a9eb7){_0x1852c6=_0x4a9eb7['length'];if(!_0x436dbb[_0xf960('0x42')]['hasOwnProperty']('nolimit')){_0x329f82[_0xf960('0x2c')]=qs['limit'](_0x436dbb['query'][_0xf960('0x2c')]);_0x329f82['offset']=qs[_0xf960('0x2a')](_0x436dbb[_0xf960('0x42')][_0xf960('0x2a')]);}return _0x3a7b93[_0xf960('0x131')](_0x329f82);}})[_0xf960('0x1e')](function(_0x45c81e){if(_0x45c81e){return _0x45c81e?{'count':_0x1852c6,'rows':_0x45c81e}:null;}})[_0xf960('0x1e')](respondWithResult(_0xa712ef,null))[_0xf960('0x27')](handleError(_0xa712ef,null));}; \ No newline at end of file +var _0x64cd=['length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','includeAll','include','rows','params','merge','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','order','findAll','removeDispositions','ids','CannedAnswer','getAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','user-agent-parser','setUA','user-agent','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','ChatApplication','Applications','account','applications','list','orderBy','priority','asc','customerIp','cf-connecting-ip','headers','x-forwarded-for','first','firstName','lastName','x-real-port','referer','version','format','%s\x20%s','browser','unknown','device','%s\x20%s\x20%s','type','vendor','threadId','externalUrl','ChatInteraction','ContactId','interaction','spread','messageId','update','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','contact','AttachmentId','UserId','unshift','agent','forcedOwnership','Start','EventManager','notify','offline','files','from\x20is\x20mandatory','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','ChatOfflineMessage','originalname','mimetype','server','attachments','basename','sequelize','Attachment','bulkCreate','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','email','offlineMessageSubject','openNewInteraction','MailAccountId','toPairsIn','subjectOffline','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','OFFLINE','No\x20timezone','Interval','getProactiveActions','getLicense','virtual','custom','License','increment','chatLicenseExceeded','Intervals','all','some','server/files/chat/iframe.ejs','remoteAddress','alignment','verticalAlignment','backgroundColor','addApplications','transaction','findAndCountAll','getApplications','addProactiveActions','ChatProactiveAction','offlineForm','onlineForm','fromKey','addAgents','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./chatWebsite.socket','register','jayson/promise','client','http','info','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','apply','then','get','ChatWebsites','UserProfileResource','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x64cd,0xe2));var _0xd64c=function(_0x5519a9,_0x1c5147){_0x5519a9=_0x5519a9-0x0;var _0x32f2cc=_0x64cd[_0x5519a9];return _0x32f2cc;};'use strict';var emlformat=require(_0xd64c('0x0'));var rimraf=require(_0xd64c('0x1'));var zipdir=require(_0xd64c('0x2'));var jsonpatch=require(_0xd64c('0x3'));var rp=require(_0xd64c('0x4'));var moment=require(_0xd64c('0x5'));var BPromise=require(_0xd64c('0x6'));var Mustache=require('mustache');var util=require(_0xd64c('0x7'));var path=require(_0xd64c('0x8'));var sox=require(_0xd64c('0x9'));var csv=require(_0xd64c('0xa'));var ejs=require(_0xd64c('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd64c('0xc'));var crypto=require('crypto');var jsforce=require(_0xd64c('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd64c('0xe'));var qs=require(_0xd64c('0xf'));var as=require(_0xd64c('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd64c('0x11'));var utils=require('../../config/utils');var config=require(_0xd64c('0x12'));var licenseUtil=require(_0xd64c('0x13'));var db=require(_0xd64c('0x14'))['db'];config[_0xd64c('0x15')]=_[_0xd64c('0x16')](config[_0xd64c('0x15')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd64c('0x15')]));require(_0xd64c('0x17'))[_0xd64c('0x18')](socket);var jayson=require(_0xd64c('0x19'));var client=jayson[_0xd64c('0x1a')][_0xd64c('0x1b')]({'port':0x232c});var client9002=jayson[_0xd64c('0x1a')][_0xd64c('0x1b')]({'port':0x232a});var client9003=jayson['client']['http']({'port':0x232b});var client9001=jayson[_0xd64c('0x1a')]['http']({'port':0x2329});function respondWithRpcPromise(_0x3af324,_0x70b536,_0x3b9d15,_0x4006e9){return new BPromise(function(_0x4946bb,_0x1392f5){var _0x296f41=_0x4006e9||client;return _0x296f41['request'](_0x3af324,_0x3b9d15)['then'](function(_0x324750){logger[_0xd64c('0x1c')]('ChatWebsite,\x20%s,\x20%s',_0x70b536,_0xd64c('0x1d'));logger['debug'](_0xd64c('0x1e'),_0x70b536,_0xd64c('0x1d'),JSON[_0xd64c('0x1f')](_0x324750));if(_0x324750['error']){if(_0x324750[_0xd64c('0x20')][_0xd64c('0x21')]===0x1f4){logger[_0xd64c('0x20')](_0xd64c('0x22'),_0x70b536,_0x324750[_0xd64c('0x20')]['message']);return _0x1392f5(_0x324750[_0xd64c('0x20')]['message']);}logger[_0xd64c('0x20')](_0xd64c('0x22'),_0x70b536,_0x324750[_0xd64c('0x20')][_0xd64c('0x23')]);return _0x4946bb(_0x324750[_0xd64c('0x20')][_0xd64c('0x23')]);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x70b536,_0xd64c('0x1d'));_0x4946bb(_0x324750[_0xd64c('0x24')][_0xd64c('0x23')]);}})[_0xd64c('0x25')](function(_0xe4bde1){logger[_0xd64c('0x20')](_0xd64c('0x22'),_0x70b536,_0xe4bde1);_0x1392f5(_0xe4bde1);});});}function respondWithStatusCode(_0x4b8fd5,_0x5b9e47){_0x5b9e47=_0x5b9e47||0xcc;return function(_0x278eb2){if(_0x278eb2){return _0x4b8fd5[_0xd64c('0x26')](_0x5b9e47);}return _0x4b8fd5[_0xd64c('0x27')](_0x5b9e47)['end']();};}function respondWithResult(_0xd17fc1,_0x4b523f){_0x4b523f=_0x4b523f||0xc8;return function(_0x43de1f){if(_0x43de1f){return _0xd17fc1['status'](_0x4b523f)[_0xd64c('0x28')](_0x43de1f);}};}function respondWithFilteredResult(_0x4ea696,_0x2119e1){return function(_0x8e5d4a){if(_0x8e5d4a){var _0x27ef7a=typeof _0x2119e1[_0xd64c('0x29')]===_0xd64c('0x2a')&&typeof _0x2119e1[_0xd64c('0x2b')]===_0xd64c('0x2a');var _0x17ed38=_0x8e5d4a[_0xd64c('0x2c')];var _0x1379fa=_0x27ef7a?0x0:_0x2119e1[_0xd64c('0x29')];var _0x3b3f06=_0x27ef7a?_0x8e5d4a['count']:_0x2119e1['offset']+_0x2119e1['limit'];var _0x3a4b10;if(_0x3b3f06>=_0x17ed38){_0x3b3f06=_0x17ed38;_0x3a4b10=0xc8;}else{_0x3a4b10=0xce;}_0x4ea696[_0xd64c('0x27')](_0x3a4b10);return _0x4ea696['set']('Content-Range',_0x1379fa+'-'+_0x3b3f06+'/'+_0x17ed38)['json'](_0x8e5d4a);}return null;};}function patchUpdates(_0x3221c7){return function(_0x212f93){try{jsonpatch[_0xd64c('0x2d')](_0x212f93,_0x3221c7,!![]);}catch(_0xbeaeae){return BPromise['reject'](_0xbeaeae);}return _0x212f93['save']();};}function saveUpdates(_0x39dabd,_0x22070e){return function(_0x872806){if(_0x872806){return _0x872806['update'](_0x39dabd)[_0xd64c('0x2e')](function(_0x2917c3){return _0x2917c3;});}return null;};}function removeEntity(_0x36eebe,_0x5c2b73){return function(_0x40a72a){if(_0x40a72a){return _0x40a72a['destroy']()[_0xd64c('0x2e')](function(){var _0x58b0f2=_0x40a72a[_0xd64c('0x2f')]({'plain':!![]});var _0x41d0a3=_0xd64c('0x30');return db[_0xd64c('0x31')][_0xd64c('0x32')]({'where':{'type':_0x41d0a3,'resourceId':_0x58b0f2['id']}})['then'](function(){return _0x40a72a;});})[_0xd64c('0x2e')](function(){_0x36eebe[_0xd64c('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa46e42,_0x1ec5a7){return function(_0xb4174d){if(!_0xb4174d){_0xa46e42[_0xd64c('0x26')](0x194);}return _0xb4174d;};}function handleError(_0x163932,_0x26600c){_0x26600c=_0x26600c||0x1f4;return function(_0x3be5eb){logger[_0xd64c('0x20')](_0x3be5eb[_0xd64c('0x33')]);if(_0x3be5eb[_0xd64c('0x34')]){delete _0x3be5eb[_0xd64c('0x34')];}_0x163932['status'](_0x26600c)[_0xd64c('0x35')](_0x3be5eb);};}exports[_0xd64c('0x36')]=function(_0x266b78,_0x5c1241){var _0x323fa6={'include':[{'model':db[_0xd64c('0x37')],'as':_0xd64c('0x38')}]},_0x1a1854={},_0x3f98fd={'count':0x0,'rows':[]};var _0x25b429=_[_0xd64c('0x39')](db[_0xd64c('0x3a')][_0xd64c('0x3b')],function(_0xbaa12d){return{'name':_0xbaa12d[_0xd64c('0x3c')],'type':_0xbaa12d['type'][_0xd64c('0x3d')]};});_0x1a1854[_0xd64c('0x3e')]=_[_0xd64c('0x39')](_0x25b429,_0xd64c('0x34'));_0x1a1854[_0xd64c('0x3f')]=_[_0xd64c('0x40')](_0x266b78[_0xd64c('0x3f')]);_0x1a1854[_0xd64c('0x41')]=_[_0xd64c('0x42')](_0x1a1854[_0xd64c('0x3e')],_0x1a1854['query']);_0x323fa6[_0xd64c('0x43')]=_[_0xd64c('0x42')](_0x1a1854[_0xd64c('0x3e')],qs[_0xd64c('0x44')](_0x266b78[_0xd64c('0x3f')][_0xd64c('0x44')]));_0x323fa6['attributes']=_0x323fa6[_0xd64c('0x43')][_0xd64c('0x45')]?_0x323fa6[_0xd64c('0x43')]:_0x1a1854[_0xd64c('0x3e')];if(!_0x266b78[_0xd64c('0x3f')][_0xd64c('0x46')](_0xd64c('0x47'))){_0x323fa6[_0xd64c('0x2b')]=qs[_0xd64c('0x2b')](_0x266b78['query']['limit']);_0x323fa6['offset']=qs[_0xd64c('0x29')](_0x266b78[_0xd64c('0x3f')][_0xd64c('0x29')]);}_0x323fa6['order']=qs[_0xd64c('0x48')](_0x266b78[_0xd64c('0x3f')][_0xd64c('0x48')]);_0x323fa6[_0xd64c('0x49')]=qs[_0xd64c('0x41')](_[_0xd64c('0x4a')](_0x266b78[_0xd64c('0x3f')],_0x1a1854['filters']),_0x25b429);if(_0x266b78[_0xd64c('0x3f')][_0xd64c('0x4b')]){_0x323fa6[_0xd64c('0x49')]=_['merge'](_0x323fa6[_0xd64c('0x49')],{'$or':_['map'](_0x25b429,function(_0x50ab26){if(_0x50ab26['type']!==_0xd64c('0x4c')){var _0x171a7b={};_0x171a7b[_0x50ab26[_0xd64c('0x34')]]={'$like':'%'+_0x266b78[_0xd64c('0x3f')]['filter']+'%'};return _0x171a7b;}})});}_0x323fa6=_['merge']({},_0x323fa6,_0x266b78[_0xd64c('0x4d')]);var _0x2afa24={'where':_0x323fa6[_0xd64c('0x49')]};return db[_0xd64c('0x3a')][_0xd64c('0x2c')](_0x2afa24)['then'](function(_0x5f1fe9){_0x3f98fd[_0xd64c('0x2c')]=_0x5f1fe9;if(_0x266b78[_0xd64c('0x3f')][_0xd64c('0x4e')]){_0x323fa6[_0xd64c('0x4f')]=[{'all':!![]}];}return db['ChatWebsite']['findAll'](_0x323fa6);})[_0xd64c('0x2e')](function(_0xc08422){_0x3f98fd[_0xd64c('0x50')]=_0xc08422;return _0x3f98fd;})[_0xd64c('0x2e')](respondWithFilteredResult(_0x5c1241,_0x323fa6))['catch'](handleError(_0x5c1241,null));};exports['show']=function(_0x4b4f13,_0x28d976){var _0x29f368={'raw':![],'where':{'id':_0x4b4f13[_0xd64c('0x51')]['id']},'include':[{'model':db['Pause'],'as':_0xd64c('0x38')}]},_0x445d57={};_0x445d57['model']=_[_0xd64c('0x40')](db[_0xd64c('0x3a')][_0xd64c('0x3b')]);_0x445d57[_0xd64c('0x3f')]=_[_0xd64c('0x40')](_0x4b4f13[_0xd64c('0x3f')]);_0x445d57['filters']=_['intersection'](_0x445d57[_0xd64c('0x3e')],_0x445d57[_0xd64c('0x3f')]);_0x29f368[_0xd64c('0x43')]=_[_0xd64c('0x42')](_0x445d57[_0xd64c('0x3e')],qs[_0xd64c('0x44')](_0x4b4f13[_0xd64c('0x3f')][_0xd64c('0x44')]));_0x29f368[_0xd64c('0x43')]=_0x29f368['attributes'][_0xd64c('0x45')]?_0x29f368[_0xd64c('0x43')]:_0x445d57[_0xd64c('0x3e')];if(_0x4b4f13[_0xd64c('0x3f')][_0xd64c('0x4e')]){_0x29f368[_0xd64c('0x4f')]=[{'all':!![]}];}_0x29f368=_[_0xd64c('0x52')]({},_0x29f368,_0x4b4f13[_0xd64c('0x4d')]);return db[_0xd64c('0x3a')][_0xd64c('0x53')](_0x29f368)[_0xd64c('0x2e')](handleEntityNotFound(_0x28d976,null))['then'](respondWithResult(_0x28d976,null))[_0xd64c('0x25')](handleError(_0x28d976,null));};exports[_0xd64c('0x54')]=function(_0x414ed8,_0x51ff78){return db[_0xd64c('0x3a')][_0xd64c('0x54')](_0x414ed8[_0xd64c('0x55')],{})[_0xd64c('0x2e')](function(_0x2b6114){var _0x4ba468=_0x414ed8[_0xd64c('0x56')][_0xd64c('0x2f')]({'plain':!![]});if(!_0x4ba468)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4ba468[_0xd64c('0x57')]===_0xd64c('0x56')){var _0x592d48=_0x2b6114[_0xd64c('0x2f')]({'plain':!![]});var _0x20aa7e=_0xd64c('0x30');return db[_0xd64c('0x58')][_0xd64c('0x53')]({'where':{'name':_0x20aa7e,'userProfileId':_0x4ba468[_0xd64c('0x59')]},'raw':!![]})[_0xd64c('0x2e')](function(_0x250d3f){if(_0x250d3f&&_0x250d3f[_0xd64c('0x5a')]===0x0){return db[_0xd64c('0x31')][_0xd64c('0x54')]({'name':_0x592d48[_0xd64c('0x34')],'resourceId':_0x592d48['id'],'type':_0x250d3f[_0xd64c('0x34')],'sectionId':_0x250d3f['id']},{})['then'](function(){return _0x2b6114;});}else{return _0x2b6114;}})[_0xd64c('0x25')](function(_0x258844){logger[_0xd64c('0x20')](_0xd64c('0x5b'),_0x258844);throw _0x258844;});}return _0x2b6114;})[_0xd64c('0x2e')](respondWithResult(_0x51ff78,0xc9))[_0xd64c('0x25')](handleError(_0x51ff78,null));};exports['update']=function(_0x237280,_0x498ae2){if(_0x237280['body']['id']){delete _0x237280[_0xd64c('0x55')]['id'];}return db[_0xd64c('0x3a')]['find']({'where':{'id':_0x237280[_0xd64c('0x51')]['id']},'include':[{'model':db[_0xd64c('0x37')],'as':_0xd64c('0x38')}]})[_0xd64c('0x2e')](handleEntityNotFound(_0x498ae2,null))[_0xd64c('0x2e')](saveUpdates(_0x237280[_0xd64c('0x55')],null))[_0xd64c('0x2e')](respondWithResult(_0x498ae2,null))[_0xd64c('0x25')](handleError(_0x498ae2,null));};exports['destroy']=function(_0x353b91,_0x146fff){return db['ChatWebsite'][_0xd64c('0x53')]({'where':{'id':_0x353b91['params']['id']}})[_0xd64c('0x2e')](handleEntityNotFound(_0x146fff,null))[_0xd64c('0x2e')](removeEntity(_0x146fff,null))[_0xd64c('0x25')](handleError(_0x146fff,null));};exports[_0xd64c('0x5c')]=function(_0x15f2fe,_0x46a794){return db[_0xd64c('0x3a')][_0xd64c('0x5c')]()[_0xd64c('0x2e')](respondWithResult(_0x46a794,null))['catch'](handleError(_0x46a794,null));};exports[_0xd64c('0x5d')]=function(_0x403d7e,_0x4f7e09,_0x31efa8){if(_0x403d7e[_0xd64c('0x55')]['id']){delete _0x403d7e[_0xd64c('0x55')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x403d7e[_0xd64c('0x51')]['id']}})[_0xd64c('0x2e')](handleEntityNotFound(_0x4f7e09,null))['then'](function(_0x51053f){if(_0x51053f){_0x403d7e[_0xd64c('0x55')][_0xd64c('0x5e')]=_0x51053f['id'];return db[_0xd64c('0x5f')]['create'](_0x403d7e['body']);}})[_0xd64c('0x2e')](respondWithResult(_0x4f7e09,null))[_0xd64c('0x25')](handleError(_0x4f7e09,null));};exports[_0xd64c('0x60')]=function(_0x585617,_0x703f6c,_0x1ca934){var _0x4ad6de={'raw':![],'where':{}};var _0x2977b3={};var _0x56f4bc={'count':0x0,'rows':[]};return db[_0xd64c('0x3a')][_0xd64c('0x61')]({'where':{'id':_0x585617[_0xd64c('0x51')]['id']}})['then'](handleEntityNotFound(_0x703f6c,null))['then'](function(_0x2878ca){if(_0x2878ca){_0x2977b3[_0xd64c('0x3e')]=_['keys'](db[_0xd64c('0x5f')]['rawAttributes']);_0x2977b3[_0xd64c('0x3f')]=_[_0xd64c('0x40')](_0x585617[_0xd64c('0x3f')]);_0x2977b3[_0xd64c('0x41')]=_[_0xd64c('0x42')](_0x2977b3[_0xd64c('0x3e')],_0x2977b3[_0xd64c('0x3f')]);_0x4ad6de['attributes']=_[_0xd64c('0x42')](_0x2977b3['model'],qs[_0xd64c('0x44')](_0x585617[_0xd64c('0x3f')][_0xd64c('0x44')]));_0x4ad6de[_0xd64c('0x43')]=_0x4ad6de['attributes']['length']?_0x4ad6de['attributes']:_0x2977b3[_0xd64c('0x3e')];if(!_0x585617[_0xd64c('0x3f')][_0xd64c('0x46')](_0xd64c('0x47'))){_0x4ad6de['limit']=qs[_0xd64c('0x2b')](_0x585617[_0xd64c('0x3f')][_0xd64c('0x2b')]);_0x4ad6de[_0xd64c('0x29')]=qs['offset'](_0x585617['query'][_0xd64c('0x29')]);}_0x4ad6de[_0xd64c('0x62')]=qs['sort'](_0x585617[_0xd64c('0x3f')]['sort']);_0x4ad6de[_0xd64c('0x49')]=qs[_0xd64c('0x41')](_[_0xd64c('0x4a')](_0x585617[_0xd64c('0x3f')],_0x2977b3[_0xd64c('0x41')]));_0x4ad6de['where'][_0xd64c('0x5e')]=_0x2878ca['id'];if(_0x585617[_0xd64c('0x3f')][_0xd64c('0x4b')]){_0x4ad6de[_0xd64c('0x49')]=_['merge'](_0x4ad6de[_0xd64c('0x49')],{'$or':_['map'](_0x4ad6de['attributes'],function(_0x23e94c){var _0xbd581f={};_0xbd581f[_0x23e94c]={'$like':'%'+_0x585617[_0xd64c('0x3f')][_0xd64c('0x4b')]+'%'};return _0xbd581f;})});}_0x4ad6de=_[_0xd64c('0x52')]({},_0x4ad6de,_0x585617['options']);return db[_0xd64c('0x5f')][_0xd64c('0x2c')]({'where':_0x4ad6de['where']})['then'](function(_0xafa053){_0x56f4bc[_0xd64c('0x2c')]=_0xafa053;if(_0x585617[_0xd64c('0x3f')][_0xd64c('0x4e')]){_0x4ad6de['include']=[{'all':!![]}];}return db[_0xd64c('0x5f')][_0xd64c('0x63')](_0x4ad6de);})['then'](function(_0x27ebc4){_0x56f4bc['rows']=_0x27ebc4;return _0x56f4bc;});}})[_0xd64c('0x2e')](respondWithFilteredResult(_0x703f6c,_0x4ad6de))[_0xd64c('0x25')](handleError(_0x703f6c,null));};exports[_0xd64c('0x64')]=function(_0x331593,_0x3aac41,_0x28e45b){return db[_0xd64c('0x3a')][_0xd64c('0x53')]({'where':{'id':_0x331593[_0xd64c('0x51')]['id']}})['then'](handleEntityNotFound(_0x3aac41,null))[_0xd64c('0x2e')](function(_0xe86ba2){if(_0xe86ba2){return _0xe86ba2[_0xd64c('0x64')](_0x331593[_0xd64c('0x3f')][_0xd64c('0x65')]);}})[_0xd64c('0x2e')](respondWithStatusCode(_0x3aac41,null))['catch'](handleError(_0x3aac41,null));};exports['addAnswer']=function(_0x47c618,_0x4eca8a,_0x25a644){if(_0x47c618[_0xd64c('0x55')]['id']){delete _0x47c618[_0xd64c('0x55')]['id'];}return db[_0xd64c('0x3a')]['find']({'where':{'id':_0x47c618[_0xd64c('0x51')]['id']}})[_0xd64c('0x2e')](handleEntityNotFound(_0x4eca8a,null))[_0xd64c('0x2e')](function(_0x6d3616){if(_0x6d3616){_0x47c618[_0xd64c('0x55')][_0xd64c('0x5e')]=_0x6d3616['id'];return db[_0xd64c('0x66')][_0xd64c('0x54')](_0x47c618[_0xd64c('0x55')]);}})[_0xd64c('0x2e')](respondWithResult(_0x4eca8a,null))[_0xd64c('0x25')](handleError(_0x4eca8a,null));};exports[_0xd64c('0x67')]=function(_0x19c8cd,_0x28a517,_0x1be8d3){var _0x32007a={'raw':![],'where':{}};var _0x5b9313={};var _0x28fc09={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x19c8cd[_0xd64c('0x51')]['id']}})[_0xd64c('0x2e')](handleEntityNotFound(_0x28a517,null))[_0xd64c('0x2e')](function(_0x1de2f5){if(_0x1de2f5){_0x5b9313['model']=_['keys'](db[_0xd64c('0x66')][_0xd64c('0x3b')]);_0x5b9313[_0xd64c('0x3f')]=_[_0xd64c('0x40')](_0x19c8cd[_0xd64c('0x3f')]);_0x5b9313[_0xd64c('0x41')]=_[_0xd64c('0x42')](_0x5b9313[_0xd64c('0x3e')],_0x5b9313[_0xd64c('0x3f')]);_0x32007a[_0xd64c('0x43')]=_['intersection'](_0x5b9313['model'],qs[_0xd64c('0x44')](_0x19c8cd[_0xd64c('0x3f')]['fields']));_0x32007a[_0xd64c('0x43')]=_0x32007a['attributes'][_0xd64c('0x45')]?_0x32007a[_0xd64c('0x43')]:_0x5b9313['model'];if(!_0x19c8cd['query']['hasOwnProperty'](_0xd64c('0x47'))){_0x32007a['limit']=qs[_0xd64c('0x2b')](_0x19c8cd[_0xd64c('0x3f')][_0xd64c('0x2b')]);_0x32007a[_0xd64c('0x29')]=qs['offset'](_0x19c8cd[_0xd64c('0x3f')]['offset']);}_0x32007a[_0xd64c('0x62')]=qs['sort'](_0x19c8cd[_0xd64c('0x3f')][_0xd64c('0x48')]);_0x32007a[_0xd64c('0x49')]=qs[_0xd64c('0x41')](_[_0xd64c('0x4a')](_0x19c8cd['query'],_0x5b9313[_0xd64c('0x41')]));_0x32007a[_0xd64c('0x49')]['ChatWebsiteId']=_0x1de2f5['id'];if(_0x19c8cd['query'][_0xd64c('0x4b')]){_0x32007a[_0xd64c('0x49')]=_[_0xd64c('0x52')](_0x32007a[_0xd64c('0x49')],{'$or':_[_0xd64c('0x39')](_0x32007a['attributes'],function(_0x289235){var _0x1ebe34={};_0x1ebe34[_0x289235]={'$like':'%'+_0x19c8cd[_0xd64c('0x3f')][_0xd64c('0x4b')]+'%'};return _0x1ebe34;})});}_0x32007a=_[_0xd64c('0x52')]({},_0x32007a,_0x19c8cd[_0xd64c('0x4d')]);return db[_0xd64c('0x66')][_0xd64c('0x2c')]({'where':_0x32007a[_0xd64c('0x49')]})['then'](function(_0x1d012d){_0x28fc09[_0xd64c('0x2c')]=_0x1d012d;if(_0x19c8cd[_0xd64c('0x3f')][_0xd64c('0x4e')]){_0x32007a[_0xd64c('0x4f')]=[{'all':!![]}];}return db[_0xd64c('0x66')][_0xd64c('0x63')](_0x32007a);})[_0xd64c('0x2e')](function(_0x12d99a){_0x28fc09[_0xd64c('0x50')]=_0x12d99a;return _0x28fc09;});}})[_0xd64c('0x2e')](respondWithFilteredResult(_0x28a517,_0x32007a))[_0xd64c('0x25')](handleError(_0x28a517,null));};exports['removeAnswers']=function(_0x56e5dd,_0x33e477,_0x2be9d9){return db[_0xd64c('0x3a')][_0xd64c('0x53')]({'where':{'id':_0x56e5dd[_0xd64c('0x51')]['id']}})[_0xd64c('0x2e')](handleEntityNotFound(_0x33e477,null))['then'](function(_0xf5c89b){if(_0xf5c89b){return _0xf5c89b['removeAnswers'](_0x56e5dd[_0xd64c('0x3f')]['ids']);}})[_0xd64c('0x2e')](respondWithStatusCode(_0x33e477,null))[_0xd64c('0x25')](handleError(_0x33e477,null));};exports[_0xd64c('0x68')]=function(_0x1af79f,_0xd39937,_0x3f08c7){_0x1af79f['body'][_0xd64c('0x69')]=_0x1af79f[_0xd64c('0x6a')][_0xd64c('0x6b')];return db[_0xd64c('0x3a')][_0xd64c('0x53')]({'where':{'id':_0x1af79f[_0xd64c('0x51')]['id']}})['then'](handleEntityNotFound(_0xd39937,null))[_0xd64c('0x2e')](saveUpdates(_0x1af79f[_0xd64c('0x55')],null))['then'](respondWithResult(_0xd39937,null))[_0xd64c('0x25')](handleError(_0xd39937,null));};exports[_0xd64c('0x6c')]=function(_0x8b17f,_0x1d5555,_0x5410ac){_0x8b17f[_0xd64c('0x55')][_0xd64c('0x6d')]=_0x8b17f['file'][_0xd64c('0x6b')];return db['ChatWebsite'][_0xd64c('0x53')]({'where':{'id':_0x8b17f[_0xd64c('0x51')]['id']}})[_0xd64c('0x2e')](handleEntityNotFound(_0x1d5555,null))[_0xd64c('0x2e')](saveUpdates(_0x8b17f[_0xd64c('0x55')],null))[_0xd64c('0x2e')](respondWithResult(_0x1d5555,null))[_0xd64c('0x25')](handleError(_0x1d5555,null));};exports[_0xd64c('0x6e')]=function(_0x14db15,_0x226156,_0xc289ad){_0x14db15[_0xd64c('0x55')][_0xd64c('0x6f')]=_0x14db15[_0xd64c('0x6a')][_0xd64c('0x6b')];return db[_0xd64c('0x3a')][_0xd64c('0x53')]({'where':{'id':_0x14db15['params']['id']}})[_0xd64c('0x2e')](handleEntityNotFound(_0x226156,null))['then'](saveUpdates(_0x14db15[_0xd64c('0x55')],null))[_0xd64c('0x2e')](respondWithResult(_0x226156,null))[_0xd64c('0x25')](handleError(_0x226156,null));};exports['addSystemAvatar']=function(_0x22fde7,_0x35306f,_0x50a142){_0x22fde7[_0xd64c('0x55')][_0xd64c('0x70')]=_0x22fde7[_0xd64c('0x6a')]['filename'];return db['ChatWebsite']['find']({'where':{'id':_0x22fde7[_0xd64c('0x51')]['id']}})[_0xd64c('0x2e')](handleEntityNotFound(_0x35306f,null))['then'](saveUpdates(_0x22fde7[_0xd64c('0x55')],null))[_0xd64c('0x2e')](respondWithResult(_0x35306f,null))[_0xd64c('0x25')](handleError(_0x35306f,null));};exports[_0xd64c('0x71')]=function(_0x29f6d7,_0x527283,_0x470d94){var _0x33fd8e=path[_0xd64c('0x72')](config[_0xd64c('0x73')],_0xd64c('0x74'));var _0x1b570b={'where':{'id':_0x29f6d7['params']['id']},'attributes':['id',_0xd64c('0x69')],'raw':!![]};var _0x1b9fa4=![];return require(_0xd64c('0x13'))['getLicense']()[_0xd64c('0x2e')](function(_0x5c11b8){if(_0x5c11b8){_0x1b9fa4=_0x5c11b8['custom'];}})[_0xd64c('0x2e')](function(){return db['ChatWebsite']['find'](_0x1b570b);})[_0xd64c('0x2e')](handleEntityNotFound(_0x527283,null))[_0xd64c('0x2e')](function(_0x2d8da1){if(_0x2d8da1){if(!_[_0xd64c('0x75')](_0x2d8da1[_0xd64c('0x69')])){if(fs[_0xd64c('0x76')](path[_0xd64c('0x72')](config[_0xd64c('0x73')],_0xd64c('0x77'),_0x2d8da1[_0xd64c('0x69')]))&&_0x1b9fa4){_0x33fd8e=path['join'](config[_0xd64c('0x73')],_0xd64c('0x77'),_0x2d8da1['sitepic']);}}return _0x527283[_0xd64c('0x78')](_0x33fd8e);}})[_0xd64c('0x25')](handleError(_0x527283,null));};exports[_0xd64c('0x79')]=function(_0x2e4913,_0x2f37a7,_0x3f68f2){var _0x19dc0f=path[_0xd64c('0x72')](config[_0xd64c('0x73')],_0xd64c('0x7a'));var _0x37810={'where':{'id':_0x2e4913[_0xd64c('0x51')]['id']},'attributes':['id',_0xd64c('0x6d')],'raw':!![]};return db['ChatWebsite'][_0xd64c('0x53')](_0x37810)[_0xd64c('0x2e')](handleEntityNotFound(_0x2f37a7,null))[_0xd64c('0x2e')](function(_0x319cdd){if(_0x319cdd){if(!_[_0xd64c('0x75')](_0x319cdd['agentAvatar'])){if(fs['existsSync'](path[_0xd64c('0x72')](config[_0xd64c('0x73')],_0xd64c('0x7b'),_0x319cdd[_0xd64c('0x6d')]))){_0x19dc0f=path[_0xd64c('0x72')](config[_0xd64c('0x73')],_0xd64c('0x7b'),_0x319cdd[_0xd64c('0x6d')]);}}return _0x2f37a7['download'](_0x19dc0f);}})[_0xd64c('0x25')](handleError(_0x2f37a7,null));};exports[_0xd64c('0x7c')]=function(_0x9a58b,_0x234678,_0x5af6c8){var _0x5ba061=path[_0xd64c('0x72')](config['root'],_0xd64c('0x7d'));var _0x40eb1b={'where':{'id':_0x9a58b[_0xd64c('0x51')]['id']},'attributes':['id','customerAvatar',_0xd64c('0x7e')],'raw':!![]};return db[_0xd64c('0x3a')][_0xd64c('0x53')](_0x40eb1b)[_0xd64c('0x2e')](handleEntityNotFound(_0x234678,null))[_0xd64c('0x2e')](function(_0x4c5829){if(_0x4c5829){if(!_[_0xd64c('0x75')](_0x4c5829[_0xd64c('0x6f')])){if(fs[_0xd64c('0x76')](path[_0xd64c('0x72')](config['root'],_0xd64c('0x7b'),_0x4c5829[_0xd64c('0x6f')]))&&_0x4c5829[_0xd64c('0x7e')]){_0x5ba061=path[_0xd64c('0x72')](config[_0xd64c('0x73')],_0xd64c('0x7b'),_0x4c5829[_0xd64c('0x6f')]);}}return _0x234678[_0xd64c('0x78')](_0x5ba061);}})[_0xd64c('0x25')](handleError(_0x234678,null));};exports[_0xd64c('0x7f')]=function(_0x22a69c,_0x53a674,_0x32d822){var _0x4baa50=path[_0xd64c('0x72')](config[_0xd64c('0x73')],_0xd64c('0x80'));var _0x11cacb={'where':{'id':_0x22a69c[_0xd64c('0x51')]['id']},'attributes':['id',_0xd64c('0x70')],'raw':!![]};return db[_0xd64c('0x3a')][_0xd64c('0x53')](_0x11cacb)[_0xd64c('0x2e')](handleEntityNotFound(_0x53a674,null))['then'](function(_0xf20ff9){if(_0xf20ff9){if(!_['isNil'](_0xf20ff9[_0xd64c('0x70')])){if(fs[_0xd64c('0x76')](path[_0xd64c('0x72')](config['root'],_0xd64c('0x7b'),_0xf20ff9[_0xd64c('0x70')]))){_0x4baa50=path['join'](config[_0xd64c('0x73')],_0xd64c('0x7b'),_0xf20ff9[_0xd64c('0x70')]);}}return _0x53a674[_0xd64c('0x78')](_0x4baa50);}})['catch'](handleError(_0x53a674,null));};exports['notify']=function(_0x168bd6,_0x5e6b44,_0x4b26f2){var _0xf6300c=require(_0xd64c('0x81'));var _0x173fbc=new _0xf6300c();var _0x1b0f15=_0x173fbc[_0xd64c('0x82')](_0x168bd6['headers'][_0xd64c('0x83')])['getResult']();var _0x2fd0f7={'body':_0x168bd6[_0xd64c('0x55')],'channel':'chat'};var _0x114913=[];var _0x3dd435=[];var _0x4a2102={};var _0x53085c=![];return db[_0xd64c('0x84')][_0xd64c('0x5c')]()[_0xd64c('0x2e')](function(_0x377173){if(!_0x377173){throw new db[(_0xd64c('0x85'))][(_0xd64c('0x86'))](_0xd64c('0x87'));}_0x114913=_[_0xd64c('0x88')](_['keys'](_0x377173),['createdAt','updatedAt']);_0x3dd435=_['difference'](_[_0xd64c('0x40')](_0x377173),[_0xd64c('0x89'),_0xd64c('0x8a'),_0xd64c('0x8b'),_0xd64c('0x8c')]);if(_0x168bd6[_0xd64c('0x55')]['id']){delete _0x168bd6[_0xd64c('0x55')]['id'];}if(_['isNil'](_0x168bd6[_0xd64c('0x55')][_0xd64c('0x8d')])){throw new db[(_0xd64c('0x85'))][(_0xd64c('0x86'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x168bd6[_0xd64c('0x55')][_0xd64c('0x55')])||_0x168bd6['body'][_0xd64c('0x55')]===''){throw new db[(_0xd64c('0x85'))][(_0xd64c('0x86'))](_0xd64c('0x8e'));}if(_[_0xd64c('0x75')](_0x168bd6['body'][_0xd64c('0x8f')])){throw new db[(_0xd64c('0x85'))]['ValidationError'](_0xd64c('0x90')+_0x3dd435);}if(!_['includes'](_0x3dd435,_0x168bd6[_0xd64c('0x55')][_0xd64c('0x8f')])){throw new db[(_0xd64c('0x85'))][(_0xd64c('0x86'))](_0xd64c('0x91')+_0x3dd435);}_0x4a2102[_0x168bd6[_0xd64c('0x55')][_0xd64c('0x8f')]]=_0x168bd6[_0xd64c('0x55')][_0xd64c('0x8d')];})[_0xd64c('0x2e')](function(){return db[_0xd64c('0x3a')]['find']({'where':{'id':_0x168bd6[_0xd64c('0x51')]['id']},'include':[{'model':db[_0xd64c('0x92')],'as':_0xd64c('0x93'),'include':[{'model':db[_0xd64c('0x84')],'as':_0xd64c('0x94'),'where':_0x4a2102,'limit':0x1,'order':[[_0xd64c('0x8a'),_0xd64c('0x95')]]}]},{'model':db[_0xd64c('0x96')],'as':_0xd64c('0x97')}]});})[_0xd64c('0x2e')](handleEntityNotFound(_0x5e6b44,null))[_0xd64c('0x2e')](function(_0x1db47e){if(_0x1db47e&&_0x1db47e[_0xd64c('0x93')]){_0x2fd0f7[_0xd64c('0x98')]=_0x1db47e;_0x2fd0f7[_0xd64c('0x99')]=_0x1db47e['Applications'];_0x2fd0f7[_0xd64c('0x9a')]=_0x1db47e['List'];_0x2fd0f7['applications']=_[_0xd64c('0x9b')](_0x2fd0f7[_0xd64c('0x99')],[_0xd64c('0x9c')],[_0xd64c('0x9d')]);if(_0x2fd0f7['account'][_0xd64c('0x97')]){delete _0x2fd0f7[_0xd64c('0x98')][_0xd64c('0x97')];}if(_0x2fd0f7[_0xd64c('0x98')][_0xd64c('0x93')]&&_0x2fd0f7[_0xd64c('0x98')]['List']['Contacts'][_0xd64c('0x45')]){return _0x2fd0f7['account'][_0xd64c('0x93')]['Contacts'][0x0];}var _0x5e3002=_[_0xd64c('0x16')](_0x168bd6[_0xd64c('0x55')],{'firstName':_0x168bd6[_0xd64c('0x55')][_0xd64c('0x8d')],'ListId':_0x1db47e['ListId']});_0x5e3002[_0x168bd6['body'][_0xd64c('0x8f')]]=_0x168bd6[_0xd64c('0x55')][_0xd64c('0x8d')];return db['CmContact']['create'](_0x5e3002,{'fields':_0x114913,'raw':!![]});}})[_0xd64c('0x2e')](handleEntityNotFound(_0x5e6b44,null))['then'](function(_0x3ba1a6){_0x2fd0f7['contact']=_0x3ba1a6;var _0x15a973=_0x168bd6['body'][_0xd64c('0x9e')];if(_0x168bd6['headers'][_0xd64c('0x9f')]){_0x15a973=_0x168bd6[_0xd64c('0xa0')][_0xd64c('0x9f')];}else if(_0x168bd6['headers'][_0xd64c('0xa1')]){_0x15a973=_[_0xd64c('0xa2')](_0x168bd6[_0xd64c('0xa0')]['x-forwarded-for']['split'](','));}if(_0x3ba1a6){var _0x1e420c={'ContactId':_0x3ba1a6['id'],'ChatWebsiteId':_0x168bd6[_0xd64c('0x51')]['id'],'from':(_0x3ba1a6[_0xd64c('0xa3')]||'')+'\x20'+(_0x3ba1a6[_0xd64c('0xa4')]||''),'customerIp':_0x15a973,'customerPort':_0x168bd6[_0xd64c('0xa0')]['x-real-port']?_0x168bd6['headers'][_0xd64c('0xa5')]:null,'referer':_0x168bd6[_0xd64c('0x55')][_0xd64c('0xa6')],'browserName':_0x1b0f15['browser'][_0xd64c('0x34')]&&_0x1b0f15['browser'][_0xd64c('0xa7')]?util[_0xd64c('0xa8')](_0xd64c('0xa9'),_0x1b0f15[_0xd64c('0xaa')]['name'],_0x1b0f15[_0xd64c('0xaa')][_0xd64c('0xa7')]):_0xd64c('0xab'),'browserVersion':_0x1b0f15['browser']['version']||_0xd64c('0xab'),'osName':util['format'](_0xd64c('0xa9'),_0x1b0f15['os'][_0xd64c('0x34')],_0x1b0f15['os'][_0xd64c('0xa7')]),'osVersion':_0x1b0f15['os'][_0xd64c('0xa7')],'deviceModel':_0x1b0f15[_0xd64c('0xac')][_0xd64c('0x3e')]&&_0x1b0f15[_0xd64c('0xac')]['vendor']?util[_0xd64c('0xa8')](_0xd64c('0xad'),_0x1b0f15[_0xd64c('0xac')][_0xd64c('0x3e')],_0x1b0f15[_0xd64c('0xac')]['vendor'],_0x1b0f15[_0xd64c('0xac')][_0xd64c('0xae')]):null,'deviceVendor':_0x1b0f15[_0xd64c('0xac')][_0xd64c('0xaf')],'deviceType':_0x1b0f15[_0xd64c('0xac')][_0xd64c('0xae')],'formData':JSON[_0xd64c('0x1f')](_0x168bd6['body'])};var _0x2c8326={'ChatWebsiteId':_0x168bd6[_0xd64c('0x51')]['id'],'closed':![]};if(_0x168bd6['body'][_0xd64c('0xb0')]){_0x2c8326['threadId']=_0x168bd6[_0xd64c('0x55')][_0xd64c('0xb0')];return db['ChatInteraction'][_0xd64c('0x53')]({'where':_0x2c8326})[_0xd64c('0x2e')](function(_0x162f2c){if(_0x162f2c){return[_0x162f2c,![]];}_0x1e420c['threadId']=_0x168bd6[_0xd64c('0x55')][_0xd64c('0xb0')];_0x1e420c['externalUrl']=_0x168bd6[_0xd64c('0x55')][_0xd64c('0xb1')];return db[_0xd64c('0xb2')][_0xd64c('0x54')](_0x1e420c)[_0xd64c('0x2e')](function(_0x50f922){return[_0x50f922,!![]];});});}_0x2c8326[_0xd64c('0xb3')]=_0x3ba1a6['id'];if(_0x168bd6['body'][_0xd64c('0xb4')]&&_0x168bd6[_0xd64c('0x55')]['interaction']['id']){_0x2c8326['id']=_0x168bd6['body'][_0xd64c('0xb4')]['id'];return db[_0xd64c('0xb2')][_0xd64c('0x53')]({'where':_0x2c8326})[_0xd64c('0x2e')](function(_0x158ddc){if(_0x158ddc){return[_0x158ddc,![]];}return db[_0xd64c('0xb2')][_0xd64c('0x54')](_0x1e420c)[_0xd64c('0x2e')](function(_0x2d24a7){return[_0x2d24a7,!![]];});});}return db[_0xd64c('0xb2')][_0xd64c('0x54')](_0x1e420c)[_0xd64c('0x2e')](function(_0x2fb8bc){return[_0x2fb8bc,!![]];});}})[_0xd64c('0xb5')](function(_0x500d1e,_0x2ecf74){if(_0x500d1e){_0x53085c=_0x2ecf74;if(!_0x2ecf74){var _0x306a65={'from':(_0x2fd0f7['contact'][_0xd64c('0xa3')]||'')+'\x20'+(_0x2fd0f7['contact'][_0xd64c('0xa4')]||'')};if(_0x168bd6[_0xd64c('0x55')][_0xd64c('0xb0')]&&_0x168bd6[_0xd64c('0x55')][_0xd64c('0xb6')]&&_0x168bd6[_0xd64c('0x55')][_0xd64c('0xb0')]!=_0x168bd6[_0xd64c('0x55')][_0xd64c('0xb6')]){_0x306a65['threadId']=_0x168bd6[_0xd64c('0x55')][_0xd64c('0xb6')];}return _0x500d1e[_0xd64c('0xb7')](_0x306a65);}else{return _0x500d1e;}}})[_0xd64c('0x2e')](function(_0x23ebaa){_0x2fd0f7[_0xd64c('0xb4')]=_0x23ebaa['get']({'plain':!![]});_0x2fd0f7[_0xd64c('0xb4')]['created']=_0x53085c;if(_0x2fd0f7[_0xd64c('0xb4')][_0xd64c('0xb8')]){if(_0x2fd0f7[_0xd64c('0x98')][_0xd64c('0xb9')]){_0x2fd0f7['applications'][_0xd64c('0xba')]({'id':0x0,'priority':_0x2fd0f7[_0xd64c('0x99')][_0xd64c('0x45')]+0x1,'app':_0xd64c('0xbb'),'appdata':_0xd64c('0xbc'),'interval':_0xd64c('0xbd')});}}return db[_0xd64c('0xbe')][_0xd64c('0x54')]({'body':_0x168bd6[_0xd64c('0x55')][_0xd64c('0x55')],'ChatWebsiteId':_0x168bd6[_0xd64c('0x51')]['id'],'ChatInteractionId':_0x23ebaa['id'],'direction':'in','ContactId':_0x2fd0f7[_0xd64c('0xbf')]['id'],'AttachmentId':_0x168bd6[_0xd64c('0x55')][_0xd64c('0xc0')]});})['then'](function(_0x500105){_0x2fd0f7[_0xd64c('0x23')]=_0x500105;if(_0x2fd0f7['interaction'][_0xd64c('0xc1')]){return db['User'][_0xd64c('0x53')]({'attributes':['id',_0xd64c('0x34')],'where':{'id':_0x2fd0f7['interaction'][_0xd64c('0xc1')]}})[_0xd64c('0x2e')](function(_0x3007d0){if(_0x3007d0){_0x2fd0f7[_0xd64c('0x99')][_0xd64c('0xc2')]({'id':0x0,'priority':0x0,'app':_0xd64c('0xc3'),'appdata':_0x3007d0[_0xd64c('0x34')]+','+(_0x2fd0f7[_0xd64c('0x98')]['waitForTheAssignedAgent']||0xa),'interval':_0xd64c('0xbd')});_0x2fd0f7[_0xd64c('0xc4')]=!![];}return respondWithRpcPromise('Start','startRouting',_0x2fd0f7);});}return respondWithRpcPromise(_0xd64c('0xc5'),'startRouting',_0x2fd0f7);})[_0xd64c('0x2e')](function(_0x5c9aeb){respondWithRpcPromise(_0xd64c('0xc6'),_0xd64c('0xc6'),{'event':_0xd64c('0xc7'),'message':_0x5c9aeb},client9002);return _0x5c9aeb;})[_0xd64c('0x2e')](respondWithResult(_0x5e6b44,null))[_0xd64c('0x25')](handleError(_0x5e6b44,null));};exports[_0xd64c('0xc8')]=function(_0x4d55d6,_0x1fc382,_0x2c42eb){var _0x2caf0c,_0x2c3cb3,_0x1171bc;var _0x326e8f=[];var _0x11be0d=[];var _0x162870={};var _0x465035=_0x4d55d6[_0xd64c('0xc9')]||[];var _0x59e80f=[];var _0x32a600;return db[_0xd64c('0x84')]['describe']()[_0xd64c('0x2e')](function(_0x1c3d0f){if(!_0x1c3d0f){throw new db[(_0xd64c('0x85'))][(_0xd64c('0x86'))](_0xd64c('0x87'));}_0x11be0d=_[_0xd64c('0x88')](_[_0xd64c('0x40')](_0x1c3d0f),[_0xd64c('0x89'),_0xd64c('0x8a')]);_0x326e8f=_[_0xd64c('0x88')](_['keys'](_0x1c3d0f),[_0xd64c('0x89'),_0xd64c('0x8a'),_0xd64c('0x8b'),'ListId']);if(_0x4d55d6[_0xd64c('0x55')]['id']){delete _0x4d55d6[_0xd64c('0x55')]['id'];}if(_['isNil'](_0x4d55d6[_0xd64c('0x55')]['from'])){throw _0x1fc382['status'](0x1f4)[_0xd64c('0x35')](new db['Sequelize'][(_0xd64c('0x86'))](_0xd64c('0xca')));}if(_[_0xd64c('0x75')](_0x4d55d6[_0xd64c('0x55')][_0xd64c('0x55')])||_0x4d55d6[_0xd64c('0x55')][_0xd64c('0x55')]===''){throw _0x1fc382[_0xd64c('0x27')](0x1f4)[_0xd64c('0x35')](new db[(_0xd64c('0x85'))][(_0xd64c('0x86'))](_0xd64c('0x8e')));}if(_['isNil'](_0x4d55d6[_0xd64c('0x55')][_0xd64c('0xcb')])){throw _0x1fc382[_0xd64c('0x27')](0x1f4)[_0xd64c('0x35')](new db[(_0xd64c('0x85'))]['ValidationError'](_0xd64c('0xcc')+_0x326e8f));}if(!_[_0xd64c('0xcd')](_0x326e8f,_0x4d55d6['body'][_0xd64c('0xcb')])){throw _0x1fc382[_0xd64c('0x27')](0x1f4)[_0xd64c('0x35')](new db[(_0xd64c('0x85'))][(_0xd64c('0x86'))](_0xd64c('0xce')+_0x326e8f));}_0x162870[_0x4d55d6[_0xd64c('0x55')][_0xd64c('0xcb')]]=_0x4d55d6[_0xd64c('0x55')][_0xd64c('0x8d')];})['then'](function(){return db[_0xd64c('0x3a')][_0xd64c('0x53')]({'where':{'id':_0x4d55d6[_0xd64c('0x51')]['id']},'include':[{'model':db[_0xd64c('0x92')],'as':_0xd64c('0x93')},{'model':db[_0xd64c('0xcf')],'as':_0xd64c('0xcf')}]});})['then'](handleEntityNotFound(_0x1fc382,null))[_0xd64c('0x2e')](function(_0x39c317){if(_0x39c317&&_0x39c317[_0xd64c('0x93')]){_0x2c3cb3=_0x39c317;var _0x35183e=_[_0xd64c('0x16')](_0x4d55d6['body'],{'firstName':_0x4d55d6[_0xd64c('0x55')][_0xd64c('0x8d')],'phone':_0x4d55d6[_0xd64c('0x55')][_0xd64c('0x8d')],'ListId':_0x39c317['ListId']});_0x35183e[_0x4d55d6[_0xd64c('0x55')][_0xd64c('0xcb')]]=_0x4d55d6[_0xd64c('0x55')][_0xd64c('0x8d')];return db[_0xd64c('0x84')]['findOrCreate']({'where':_0x162870,'defaults':_0x35183e});}})[_0xd64c('0xb5')](function(_0xf9cf37){if(_0xf9cf37){_0x1171bc=_0xf9cf37;var _0x516556=fs[_0xd64c('0xd0')](path['join'](config[_0xd64c('0x73')],_0xd64c('0xd1')),_0xd64c('0xd2'));var _0x29bd2b=ejs[_0xd64c('0xd3')](_0x516556,{'body':_[_0xd64c('0xd4')](_0x4d55d6[_0xd64c('0x55')][_0xd64c('0x55')]),'bodyTitle':_0x2c3cb3['offlineMessageBody']});return db[_0xd64c('0xd5')][_0xd64c('0x54')]({'body':_0x29bd2b,'ContactId':_0xf9cf37['id'],'ChatWebsiteId':_0x2c3cb3['id']});}})[_0xd64c('0x2e')](function(_0x26b169){_0x32a600=_0x26b169;if(_0x465035[_0xd64c('0x45')]){var _0xe9a295=_0x465035[_0xd64c('0x39')](function(_0x409f6b){return{'name':_0x409f6b[_0xd64c('0xd6')],'basename':_0x409f6b['filename'],'type':_0x409f6b[_0xd64c('0xd7')],'ChatOfflineMessageId':_0x26b169['id']};});_0x59e80f=_0xe9a295[_0xd64c('0x39')](_0x48e5d6=>{var _0x340a03={'filename':_0x48e5d6[_0xd64c('0x34')],'path':path['join'](config[_0xd64c('0x73')],_0xd64c('0xd8'),_0xd64c('0xc9'),_0xd64c('0xd9'),'offline-chat',_0x48e5d6[_0xd64c('0xda')])};return _0x340a03;});if(!_0x2c3cb3['openNewInteraction']){return db[_0xd64c('0xdb')]['transaction'](function(_0x23b42c){return db[_0xd64c('0xdc')][_0xd64c('0xdd')](_0xe9a295,{'transaction':_0x23b42c});});}}})[_0xd64c('0x2e')](function(){if(_0x32a600){_0x2caf0c=_0x32a600;return db[_0xd64c('0xcf')][_0xd64c('0x61')]({'where':{'active':!![]},'include':[{'model':db[_0xd64c('0xde')],'as':_0xd64c('0xdf'),'raw':!![]}]});}})[_0xd64c('0x2e')](function(_0x698179){if(_0x698179&&_0x698179[_0xd64c('0xdf')]&&_0x2c3cb3[_0xd64c('0xe0')]&&_0x2c3cb3[_0xd64c('0xe1')]){var _0x2e6dd3={'tls':{'rejectUnauthorized':![]}};if(_0x698179['Smtp']['service']){_0x2e6dd3[_0xd64c('0xe2')]=_0x698179[_0xd64c('0xdf')]['service'];}else{_0x2e6dd3[_0xd64c('0xe3')]=_0x698179['Smtp'][_0xd64c('0xe3')];_0x2e6dd3[_0xd64c('0xe4')]=_0x698179[_0xd64c('0xdf')][_0xd64c('0xe4')];_0x2e6dd3[_0xd64c('0xe5')]=_0x698179[_0xd64c('0xdf')]['secure'];}if(_0x698179[_0xd64c('0xdf')][_0xd64c('0xe6')]){_0x2e6dd3[_0xd64c('0xe7')]={'user':_0x698179[_0xd64c('0xdf')][_0xd64c('0x56')],'pass':_0x698179[_0xd64c('0xdf')][_0xd64c('0xe8')]};}return respondWithRpcPromise(_0xd64c('0xe9'),_0xd64c('0xea'),{'account':_0x2e6dd3,'message':{'from':util[_0xd64c('0xa8')]('\x22%s\x22\x20<%s>',_0x698179[_0xd64c('0x34')],_0x698179[_0xd64c('0xeb')]||_0x698179[_0xd64c('0xdf')][_0xd64c('0x56')]),'to':_0x2c3cb3[_0xd64c('0xe1')],'subject':_0x2c3cb3[_0xd64c('0xec')],'html':_0x2caf0c[_0xd64c('0x55')],'attachments':_0x59e80f}},client9003)['then'](function(){return _0x2caf0c;})[_0xd64c('0x25')](function(_0xc3124a){console[_0xd64c('0x20')](_0xc3124a);});}})[_0xd64c('0x2e')](function(){if(_0x2c3cb3&&_0x2c3cb3[_0xd64c('0xed')]&&_0x2c3cb3[_0xd64c('0xee')]){var _0x49ec6b=[];if(_0x465035[_0xd64c('0x45')]){_0x49ec6b=_0x465035['map'](function(_0x12aa65){return{'name':_0x12aa65[_0xd64c('0xd6')],'basename':_0x12aa65[_0xd64c('0x6b')],'type':_0x12aa65[_0xd64c('0xd7')],'ChatOfflineMessageId':_0x32a600['id']};});}var _0xab5dfb;if(!_[_0xd64c('0x75')](_0x2c3cb3['subjectOffline'])){var _0x497631=_['map'](_0x4d55d6[_0xd64c('0x55')],function(_0x3d8e3a){return _0x3d8e3a;});var _0x2a74cd=_[_0xd64c('0xef')](_0x497631)[0x0];var _0x1a8096=_['mapValues'](_0x2a74cd,function(_0x344504){return _0x344504;});_0xab5dfb=_0x1a8096[0x1][_0x2c3cb3[_0xd64c('0xf0')]];}var _0x928eea={'from':_0x1171bc[_0xd64c('0xeb')],'firstName':_0x1171bc[_0xd64c('0xa3')],'lastName':_0x1171bc[_0xd64c('0xa4')],'mapKey':'email','message':{'from':_0x1171bc[_0xd64c('0xeb')],'to':_0x2c3cb3[_0xd64c('0xcf')][_0xd64c('0xeb')],'cc':'','subject':_[_0xd64c('0x75')](_0xab5dfb)?_0x2c3cb3['offlineMessageSubject']:_0xab5dfb,'messageId':'','sentAt':new Date(),'attach':_0x49ec6b[_0xd64c('0x45')],'attachments':_0x49ec6b,'originChannel':'Chat','ChatWebsiteId':_0x2c3cb3['id'],'ChatOfflineMessageId':_0x2caf0c['id'],'originTo':_0x2c3cb3['MailAccount']['email']},'body':_0x2caf0c[_0xd64c('0x55')]};var _0x4f2f66={'account':{'id':_0x2c3cb3[_0xd64c('0xee')]},'body':_0x928eea,'log':_0xd64c('0xf1')};return respondWithRpcPromise(_0xd64c('0xf1'),_0xd64c('0xf2'),_0x4f2f66,client9001)[_0xd64c('0x2e')](function(){return _0x2caf0c;})[_0xd64c('0x25')](function(_0x2b71f6){console[_0xd64c('0x20')](_0x2b71f6);});}return;})[_0xd64c('0x2e')](function(){if(_0x2caf0c){return _0x2caf0c;}})[_0xd64c('0x2e')](respondWithResult(_0x1fc382,null))[_0xd64c('0x25')](function(_0x5750fd){console['error'](_0xd64c('0x25'),_0x5750fd);for(var _0x2031d6 of _0x465035){var _0x17a462=path[_0xd64c('0x72')](config['root'],'server',_0xd64c('0xc9'),_0xd64c('0xd9'),'offline-chat',_0x2031d6[_0xd64c('0x6b')]);fs_extra[_0xd64c('0xf3')](_0x17a462)[_0xd64c('0x25')](function(_0x1eb49f){console[_0xd64c('0x20')](_0xd64c('0xf4'),_0x17a462,_0x1eb49f);});}});};exports[_0xd64c('0xf5')]=function(_0x41b2c7,_0x3b6758,_0x30540c){return db[_0xd64c('0xb2')][_0xd64c('0x53')]({'where':{'id':_0x41b2c7[_0xd64c('0x51')]['id']}})[_0xd64c('0x2e')](handleEntityNotFound(_0x3b6758,null))[_0xd64c('0x2e')](function(_0x302b92){if(_0x302b92){return _0x302b92[_0xd64c('0xf5')](_0x41b2c7[_0xd64c('0x55')][_0xd64c('0x65')],_[_0xd64c('0xf6')](_0x41b2c7['body'],[_0xd64c('0x65'),'id'])||{});}})[_0xd64c('0x2e')](respondWithResult(_0x3b6758,null))[_0xd64c('0x25')](handleError(_0x3b6758,null));};exports[_0xd64c('0xf7')]=function(_0x47ed30,_0x3cac25,_0x2173ee){var _0x4df8a6={'raw':![],'where':{}};var _0x46f897={};var _0x517080={'count':0x0,'rows':[]};return db[_0xd64c('0x3a')][_0xd64c('0x61')]({'where':{'id':_0x47ed30['params']['id']}})[_0xd64c('0x2e')](handleEntityNotFound(_0x3cac25,null))['then'](function(_0x9a9dd1){if(_0x9a9dd1){_0x46f897['model']=_['keys'](db[_0xd64c('0xb2')][_0xd64c('0x3b')]);_0x46f897[_0xd64c('0x3f')]=_[_0xd64c('0x40')](_0x47ed30[_0xd64c('0x3f')]);_0x46f897['filters']=_['intersection'](_0x46f897['model'],_0x46f897[_0xd64c('0x3f')]);_0x4df8a6[_0xd64c('0x43')]=_[_0xd64c('0x42')](_0x46f897[_0xd64c('0x3e')],qs[_0xd64c('0x44')](_0x47ed30[_0xd64c('0x3f')]['fields']));_0x4df8a6[_0xd64c('0x43')]=_0x4df8a6[_0xd64c('0x43')]['length']?_0x4df8a6[_0xd64c('0x43')]:_0x46f897['model'];if(!_0x47ed30['query']['hasOwnProperty'](_0xd64c('0x47'))){_0x4df8a6['limit']=qs[_0xd64c('0x2b')](_0x47ed30['query']['limit']);_0x4df8a6[_0xd64c('0x29')]=qs[_0xd64c('0x29')](_0x47ed30[_0xd64c('0x3f')]['offset']);}_0x4df8a6['order']=qs[_0xd64c('0x48')](_0x47ed30[_0xd64c('0x3f')][_0xd64c('0x48')]);_0x4df8a6[_0xd64c('0x49')]=qs[_0xd64c('0x41')](_[_0xd64c('0x4a')](_0x47ed30['query'],_0x46f897[_0xd64c('0x41')]));_0x4df8a6['where'][_0xd64c('0x5e')]=_0x9a9dd1['id'];if(_0x47ed30[_0xd64c('0x3f')][_0xd64c('0x4b')]){_0x4df8a6[_0xd64c('0x49')]=_['merge'](_0x4df8a6[_0xd64c('0x49')],{'$or':_[_0xd64c('0x39')](_0x4df8a6[_0xd64c('0x43')],function(_0x4d9e1a){var _0x2c6a9e={};_0x2c6a9e[_0x4d9e1a]={'$like':'%'+_0x47ed30[_0xd64c('0x3f')][_0xd64c('0x4b')]+'%'};return _0x2c6a9e;})});}_0x4df8a6=_['merge']({},_0x4df8a6,_0x47ed30[_0xd64c('0x4d')]);return db[_0xd64c('0xb2')][_0xd64c('0x2c')]({'where':_0x4df8a6['where']})[_0xd64c('0x2e')](function(_0x1783cc){_0x517080['count']=_0x1783cc;if(_0x47ed30['query'][_0xd64c('0x4e')]){_0x4df8a6[_0xd64c('0x4f')]=[{'model':db[_0xd64c('0x84')],'as':_0xd64c('0xf8'),'required':![]},{'model':db['User'],'as':_0xd64c('0xf9'),'attributes':['name',_0xd64c('0xfa'),_0xd64c('0xfb')],'required':![]},{'model':db[_0xd64c('0xfc')],'as':_0xd64c('0xfd'),'attributes':['id',_0xd64c('0x34'),_0xd64c('0xfe')],'where':_0x47ed30[_0xd64c('0x3f')]['tag']?{'id':_0x47ed30[_0xd64c('0x3f')]['tag']}:undefined,'required':_0x47ed30[_0xd64c('0x3f')]['tag']?!![]:![]}];}return db[_0xd64c('0xb2')][_0xd64c('0x63')](_0x4df8a6);})[_0xd64c('0x2e')](function(_0x12697a){_0x517080[_0xd64c('0x50')]=_0x12697a;return _0x517080;});}})[_0xd64c('0x2e')](respondWithFilteredResult(_0x3cac25,_0x4df8a6))[_0xd64c('0x25')](handleError(_0x3cac25,null));};function iftimePromise(_0x425c5b,_0x14c93e){return respondWithRpcPromise(_0xd64c('0xff'),_0xd64c('0x100'),{'command':_0x14c93e[_0xd64c('0x101')]?util[_0xd64c('0xa8')](_0xd64c('0x102'),_0x425c5b[_0xd64c('0x103')],_0x14c93e[_0xd64c('0x101')]):util['format'](_0xd64c('0x104'),_0x425c5b['interval'])},client9002)['then'](function(_0x5dc790){var _0x1432bf=_0x5dc790&&_0x5dc790['indexOf']('true')>=0x0?!![]:![];logger[_0xd64c('0x1c')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x14c93e['id'],_0x425c5b['id'],_0x425c5b[_0xd64c('0x103')],_0x1432bf?'ONLINE':_0xd64c('0x105'),_0x14c93e[_0xd64c('0x101')]?_0x14c93e[_0xd64c('0x101')]:_0xd64c('0x106'));return _0x1432bf;})[_0xd64c('0x25')](function(_0x358a1b){logger[_0xd64c('0x20')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x14c93e['id'],_0x425c5b['id'],_0x425c5b[_0xd64c('0x103')],util['inspect'](_0x358a1b,{'showHidden':![],'depth':null}),_0x14c93e[_0xd64c('0x101')]?_0x14c93e[_0xd64c('0x101')]:_0xd64c('0x106'));return![];});}exports[_0xd64c('0x100')]=function(_0x19b8ff,_0x5e6255,_0x559b7d){var _0x3e5b6c=0x0;var _0x21fddc=0x0;var _0xd33e07=![];var _0x66e23;var _0x524d23;return db[_0xd64c('0x3a')][_0xd64c('0x53')]({'where':{'id':_0x19b8ff['params']['id']},'include':[{'model':db[_0xd64c('0x107')],'as':_0xd64c('0x107'),'include':[{'model':db['Interval'],'as':'Intervals','attributes':['id','interval'],'raw':!![]}]}]})[_0xd64c('0x2e')](handleEntityNotFound(_0x5e6255,null))[_0xd64c('0x2e')](function(_0x165059){if(_0x165059){_0x66e23=_0x165059;return _0x165059[_0xd64c('0x108')]({'raw':!![]});}})[_0xd64c('0x2e')](function(_0x51e3e9){if(_0x66e23){if(_0x51e3e9){_0x524d23=_0x51e3e9;}}return require(_0xd64c('0x13'))[_0xd64c('0x109')]();})[_0xd64c('0x2e')](function(_0x5f31df){if(_0x5f31df){_0x21fddc=_0x5f31df[_0xd64c('0x10a')];_0xd33e07=_0x5f31df[_0xd64c('0x10b')];}})[_0xd64c('0x2e')](function(){return db[_0xd64c('0xb2')][_0xd64c('0x2c')]({'where':{'closed':![]}});})[_0xd64c('0x2e')](function(_0x610d2d){_0x3e5b6c=_0x610d2d;if(_0x21fddc&&_0x610d2d>_0x21fddc){return db[_0xd64c('0x10c')][_0xd64c('0x61')]({'where':{'id':0x1}})[_0xd64c('0x2e')](function(_0x57e7b8){if(_0x57e7b8){_0x57e7b8[_0xd64c('0x10d')](_0xd64c('0x10e'));}});}})[_0xd64c('0x2e')](function(){if(_0x66e23[_0xd64c('0x107')]&&_0x66e23[_0xd64c('0x107')]['Intervals']){var _0x2402b3=[];for(var _0x17407c=0x0;_0x17407c<_0x66e23[_0xd64c('0x107')][_0xd64c('0x10f')][_0xd64c('0x45')];_0x17407c++){var _0x532bb4=_0x66e23[_0xd64c('0x107')][_0xd64c('0x10f')][_0x17407c][_0xd64c('0x2f')]({'plain':!![]});_0x2402b3['push'](iftimePromise(_0x532bb4,_0x66e23));}return BPromise[_0xd64c('0x110')](_0x2402b3)[_0xd64c('0x2e')](function(_0x134492){return _[_0xd64c('0x111')](_0x134492);});}else{return!![];}})[_0xd64c('0x2e')](function(_0x4f1f13){var _0x47c0a7=fs[_0xd64c('0xd0')](path['join'](config[_0xd64c('0x73')],_0xd64c('0x112')),_0xd64c('0xd2'));var _0x2900c1={'remote':_0x66e23['remote'],'query':querystring[_0xd64c('0x1f')](_[_0xd64c('0x52')](_0x66e23['get']({'plain':!![]}),{'customerIp':_0x19b8ff[_0xd64c('0xa0')][_0xd64c('0xa1')]||_0x19b8ff[_0xd64c('0xa0')]['x-real-ip']||_0x19b8ff['connection'][_0xd64c('0x113')]||_0x19b8ff['ip'],'referer':_0x19b8ff[_0xd64c('0xa0')][_0xd64c('0xa6')],'openedInteractions':_0x3e5b6c,'maxInteractions':_0x21fddc,'virtual':_0xd33e07[_0xd64c('0x10a')],'online':_0x4f1f13,'custom':_0xd33e07}))['replace'](/'/g,'\x5c\x27')};_0x5e6255[_0xd64c('0x35')](ejs[_0xd64c('0xd3')](Mustache[_0xd64c('0xd3')](_0x47c0a7,_0x2900c1),{'proactiveActions':_0x524d23,'alignment':_0x66e23[_0xd64c('0x114')],'verticalAlignment':_0x66e23[_0xd64c('0x115')],'div_color':_0x66e23[_0xd64c('0xfe')],'text_color':_0x66e23['textColor'],'button_color':_0x66e23['color_button'],'background_color':_0x66e23[_0xd64c('0x116')]}));})[_0xd64c('0x25')](handleError(_0x5e6255,null));};exports[_0xd64c('0x117')]=function(_0x1c496f,_0x293306,_0x530932){return db[_0xd64c('0x3a')][_0xd64c('0x61')]({'where':{'id':_0x1c496f[_0xd64c('0x51')]['id']}})[_0xd64c('0x2e')](handleEntityNotFound(_0x293306,null))[_0xd64c('0x2e')](function(_0x6293e0){if(_0x6293e0){return db[_0xd64c('0xdb')][_0xd64c('0x118')](function(_0x4e11aa){return db[_0xd64c('0x96')][_0xd64c('0x32')]({'where':{'ChatWebsiteId':_0x1c496f['params']['id']},'transaction':_0x4e11aa})[_0xd64c('0x2e')](function(_0x3d4547){var _0x56327e=_[_0xd64c('0x39')](_0x1c496f[_0xd64c('0x55')],function(_0xa5d4e1){_0xa5d4e1[_0xd64c('0x5e')]=_0x1c496f[_0xd64c('0x51')]['id'];return _0xa5d4e1;});return db['ChatApplication']['bulkCreate'](_0x56327e,{'transaction':_0x4e11aa});});})[_0xd64c('0x2e')](function(){return db['ChatApplication'][_0xd64c('0x119')]({'where':{'ChatWebsiteId':_0x1c496f['params']['id']},'order':_0xd64c('0x9c')});});}})[_0xd64c('0x2e')](respondWithResult(_0x293306,null))[_0xd64c('0x25')](handleError(_0x293306,null));};exports[_0xd64c('0x11a')]=function(_0x48d285,_0x413314,_0x5f20fc){var _0x2d87da={};var _0x3c65a7={};var _0x31dbd3;var _0x4192cc;return db['ChatWebsite']['findOne']({'where':{'id':_0x48d285['params']['id']}})[_0xd64c('0x2e')](handleEntityNotFound(_0x413314,null))[_0xd64c('0x2e')](function(_0x228ba1){if(_0x228ba1){_0x31dbd3=_0x228ba1;_0x3c65a7['model']=_[_0xd64c('0x40')](db['ChatApplication'][_0xd64c('0x3b')]);_0x3c65a7[_0xd64c('0x3f')]=_[_0xd64c('0x40')](_0x48d285[_0xd64c('0x3f')]);_0x3c65a7['filters']=_['intersection'](_0x3c65a7[_0xd64c('0x3e')],_0x3c65a7['query']);_0x2d87da['attributes']=_[_0xd64c('0x42')](_0x3c65a7[_0xd64c('0x3e')],qs[_0xd64c('0x44')](_0x48d285[_0xd64c('0x3f')][_0xd64c('0x44')]));_0x2d87da[_0xd64c('0x43')]=_0x2d87da[_0xd64c('0x43')][_0xd64c('0x45')]?_0x2d87da[_0xd64c('0x43')]:_0x3c65a7[_0xd64c('0x3e')];_0x2d87da[_0xd64c('0x62')]=qs[_0xd64c('0x48')](_0x48d285[_0xd64c('0x3f')][_0xd64c('0x48')]);_0x2d87da[_0xd64c('0x49')]=qs['filters'](_['pick'](_0x48d285['query'],_0x3c65a7['filters']));if(_0x48d285['query']['filter']){_0x2d87da[_0xd64c('0x49')]=_[_0xd64c('0x52')](_0x2d87da[_0xd64c('0x49')],{'$or':_[_0xd64c('0x39')](_0x2d87da[_0xd64c('0x43')],function(_0x14437b){var _0x50b8fd={};_0x50b8fd[_0x14437b]={'$like':'%'+_0x48d285['query'][_0xd64c('0x4b')]+'%'};return _0x50b8fd;})});}_0x2d87da=_['merge']({},_0x2d87da,_0x48d285[_0xd64c('0x4d')]);return _0x31dbd3[_0xd64c('0x11a')](_0x2d87da);}})[_0xd64c('0x2e')](function(_0x573494){if(_0x573494){_0x4192cc=_0x573494[_0xd64c('0x45')];if(!_0x48d285['query'][_0xd64c('0x46')](_0xd64c('0x47'))){_0x2d87da[_0xd64c('0x2b')]=qs[_0xd64c('0x2b')](_0x48d285[_0xd64c('0x3f')][_0xd64c('0x2b')]);_0x2d87da[_0xd64c('0x29')]=qs[_0xd64c('0x29')](_0x48d285[_0xd64c('0x3f')]['offset']);}return _0x31dbd3['getApplications'](_0x2d87da);}})[_0xd64c('0x2e')](function(_0x4dcc6e){if(_0x4dcc6e){return _0x4dcc6e?{'count':_0x4192cc,'rows':_0x4dcc6e}:null;}})['then'](respondWithResult(_0x413314,null))['catch'](handleError(_0x413314,null));};exports[_0xd64c('0x11b')]=function(_0x3389f6,_0x21b7c,_0x4236e8){return db['chatProactiveAction'][_0xd64c('0x53')]({'where':{'id':_0x3389f6[_0xd64c('0x51')]['id']}})[_0xd64c('0x2e')](handleEntityNotFound(_0x21b7c,null))['then'](function(_0xc351a8){if(_0xc351a8){return _0xc351a8[_0xd64c('0x11b')](_0x3389f6['body'][_0xd64c('0x65')],_[_0xd64c('0xf6')](_0x3389f6[_0xd64c('0x55')],[_0xd64c('0x65'),'id'])||{});}})[_0xd64c('0x2e')](respondWithResult(_0x21b7c,null))[_0xd64c('0x25')](handleError(_0x21b7c,null));};exports[_0xd64c('0x108')]=function(_0x4bf270,_0x2bef91,_0x678774){var _0x5e00d9={};var _0x34875a={};var _0x4ce6e2;var _0x2a2020;return db[_0xd64c('0x3a')][_0xd64c('0x61')]({'where':{'id':_0x4bf270[_0xd64c('0x51')]['id']}})[_0xd64c('0x2e')](handleEntityNotFound(_0x2bef91,null))[_0xd64c('0x2e')](function(_0x41e2fd){if(_0x41e2fd){_0x4ce6e2=_0x41e2fd;_0x34875a[_0xd64c('0x3e')]=_[_0xd64c('0x40')](db[_0xd64c('0x11c')][_0xd64c('0x3b')]);_0x34875a[_0xd64c('0x3f')]=_['keys'](_0x4bf270[_0xd64c('0x3f')]);_0x34875a[_0xd64c('0x41')]=_[_0xd64c('0x42')](_0x34875a['model'],_0x34875a['query']);_0x5e00d9[_0xd64c('0x43')]=_[_0xd64c('0x42')](_0x34875a[_0xd64c('0x3e')],qs['fields'](_0x4bf270[_0xd64c('0x3f')][_0xd64c('0x44')]));_0x5e00d9[_0xd64c('0x43')]=_0x5e00d9[_0xd64c('0x43')][_0xd64c('0x45')]?_0x5e00d9['attributes']:_0x34875a['model'];_0x5e00d9[_0xd64c('0x62')]=qs[_0xd64c('0x48')](_0x4bf270[_0xd64c('0x3f')][_0xd64c('0x48')]);_0x5e00d9[_0xd64c('0x49')]=qs['filters'](_[_0xd64c('0x4a')](_0x4bf270[_0xd64c('0x3f')],_0x34875a[_0xd64c('0x41')]));if(_0x4bf270['query'][_0xd64c('0x4b')]){_0x5e00d9[_0xd64c('0x49')]=_[_0xd64c('0x52')](_0x5e00d9[_0xd64c('0x49')],{'$or':_[_0xd64c('0x39')](_0x5e00d9[_0xd64c('0x43')],function(_0x262d25){var _0x335950={};_0x335950[_0x262d25]={'$like':'%'+_0x4bf270[_0xd64c('0x3f')][_0xd64c('0x4b')]+'%'};return _0x335950;})});}_0x5e00d9=_[_0xd64c('0x52')]({},_0x5e00d9,_0x4bf270[_0xd64c('0x4d')]);return _0x4ce6e2[_0xd64c('0x108')](_0x5e00d9);}})[_0xd64c('0x2e')](function(_0x54a125){if(_0x54a125){_0x2a2020=_0x54a125[_0xd64c('0x45')];if(!_0x4bf270['query'][_0xd64c('0x46')](_0xd64c('0x47'))){_0x5e00d9[_0xd64c('0x2b')]=qs[_0xd64c('0x2b')](_0x4bf270[_0xd64c('0x3f')][_0xd64c('0x2b')]);_0x5e00d9[_0xd64c('0x29')]=qs[_0xd64c('0x29')](_0x4bf270[_0xd64c('0x3f')][_0xd64c('0x29')]);}return _0x4ce6e2['getProactiveActions'](_0x5e00d9);}})[_0xd64c('0x2e')](function(_0x36755e){if(_0x36755e){return _0x36755e?{'count':_0x2a2020,'rows':_0x36755e}:null;}})[_0xd64c('0x2e')](respondWithResult(_0x2bef91,null))[_0xd64c('0x25')](handleError(_0x2bef91,null));};exports['getFields']=function(_0x16ca70,_0x51da11,_0xac1ddc){var _0x79fd2f=_0x16ca70[_0xd64c('0x3f')]['online']==='false'?_0xd64c('0x11d'):_0xd64c('0x11e');return db[_0xd64c('0x3a')][_0xd64c('0x53')]({'attributes':['id',_0x79fd2f],'where':{'id':_0x16ca70[_0xd64c('0x51')]['id']}})[_0xd64c('0x2e')](handleEntityNotFound(_0x51da11,null))[_0xd64c('0x2e')](function(_0x184d2d){if(_0x184d2d){var _0x57ea35=_0x184d2d[_0x79fd2f];var _0x56dbf0=_0x57ea35&&_0x57ea35['items']?_0x57ea35['items']:[];_0x51da11['send']({'fromKey':_[_0xd64c('0x75')](_0x57ea35['fromKey'])?undefined:_0x57ea35[_0xd64c('0x11f')],'count':_0x56dbf0[_0xd64c('0x45')],'rows':_0x56dbf0});}})[_0xd64c('0x25')](handleError(_0x51da11,null));};exports['getOfflineMessages']=function(_0x2292af,_0x46b00a,_0x5d524f){var _0x289f39={'raw':![],'where':{}};var _0x43ab37={};var _0x432b26={'count':0x0,'rows':[]};return db[_0xd64c('0x3a')]['findOne']({'where':{'id':_0x2292af['params']['id']}})[_0xd64c('0x2e')](handleEntityNotFound(_0x46b00a,null))[_0xd64c('0x2e')](function(_0x39e2a2){if(_0x39e2a2){_0x43ab37[_0xd64c('0x3e')]=_[_0xd64c('0x40')](db['ChatOfflineMessage'][_0xd64c('0x3b')]);_0x43ab37[_0xd64c('0x3f')]=_['keys'](_0x2292af[_0xd64c('0x3f')]);_0x43ab37[_0xd64c('0x41')]=_['intersection'](_0x43ab37[_0xd64c('0x3e')],_0x43ab37[_0xd64c('0x3f')]);_0x289f39[_0xd64c('0x43')]=_[_0xd64c('0x42')](_0x43ab37[_0xd64c('0x3e')],qs[_0xd64c('0x44')](_0x2292af['query'][_0xd64c('0x44')]));_0x289f39['attributes']=_0x289f39[_0xd64c('0x43')]['length']?_0x289f39[_0xd64c('0x43')]:_0x43ab37[_0xd64c('0x3e')];if(!_0x2292af[_0xd64c('0x3f')][_0xd64c('0x46')](_0xd64c('0x47'))){_0x289f39[_0xd64c('0x2b')]=qs[_0xd64c('0x2b')](_0x2292af['query'][_0xd64c('0x2b')]);_0x289f39[_0xd64c('0x29')]=qs[_0xd64c('0x29')](_0x2292af[_0xd64c('0x3f')][_0xd64c('0x29')]);}_0x289f39[_0xd64c('0x62')]=qs[_0xd64c('0x48')](_0x2292af[_0xd64c('0x3f')]['sort']);_0x289f39[_0xd64c('0x49')]=qs[_0xd64c('0x41')](_[_0xd64c('0x4a')](_0x2292af[_0xd64c('0x3f')],_0x43ab37[_0xd64c('0x41')]));_0x289f39[_0xd64c('0x49')][_0xd64c('0x5e')]=_0x39e2a2['id'];if(_0x2292af[_0xd64c('0x3f')][_0xd64c('0x4b')]){_0x289f39[_0xd64c('0x49')]=_[_0xd64c('0x52')](_0x289f39['where'],{'$or':_[_0xd64c('0x39')](_0x289f39['attributes'],function(_0x421cd9){var _0x530f6c={};_0x530f6c[_0x421cd9]={'$like':'%'+_0x2292af[_0xd64c('0x3f')]['filter']+'%'};return _0x530f6c;})});}_0x289f39=_[_0xd64c('0x52')]({},_0x289f39,_0x2292af[_0xd64c('0x4d')]);return db[_0xd64c('0xd5')][_0xd64c('0x2c')]({'where':_0x289f39['where']})[_0xd64c('0x2e')](function(_0x2ed3f2){_0x432b26[_0xd64c('0x2c')]=_0x2ed3f2;if(_0x2292af[_0xd64c('0x3f')][_0xd64c('0x4e')]){_0x289f39['include']=[{'all':!![]}];}else{_0x289f39[_0xd64c('0x4f')]=[{'model':db[_0xd64c('0x84')],'as':_0xd64c('0xf8'),'required':![]},{'model':db[_0xd64c('0xdc')],'as':'Attachments','required':![]}];}return db[_0xd64c('0xd5')][_0xd64c('0x63')](_0x289f39);})['then'](function(_0x386cd0){_0x432b26['rows']=_0x386cd0;return _0x432b26;});}})[_0xd64c('0x2e')](respondWithFilteredResult(_0x46b00a,_0x289f39))[_0xd64c('0x25')](handleError(_0x46b00a,null));};exports[_0xd64c('0x120')]=function(_0x4aebf7,_0x2e058e,_0x51a048){return db[_0xd64c('0x3a')][_0xd64c('0x53')]({'where':{'id':_0x4aebf7[_0xd64c('0x51')]['id']}})['then'](handleEntityNotFound(_0x2e058e,null))['then'](function(_0x1879f9){if(_0x1879f9){return _0x1879f9[_0xd64c('0x120')](_0x4aebf7[_0xd64c('0x55')]['ids'],_[_0xd64c('0xf6')](_0x4aebf7[_0xd64c('0x55')],[_0xd64c('0x65'),'id'])||{})[_0xd64c('0xb5')](function(_0x1cd860){for(var _0x2a0ea9=0x0;_0x2a0ea9<_0x4aebf7[_0xd64c('0x55')][_0xd64c('0x65')][_0xd64c('0x45')];_0x2a0ea9+=0x1){socket['emit']('userChatWebsite:save',{'UserId':Number(_0x4aebf7[_0xd64c('0x55')][_0xd64c('0x65')][_0x2a0ea9]),'ChatWebsiteId':Number(_0x4aebf7[_0xd64c('0x51')]['id'])});}return _0x1cd860;});}})[_0xd64c('0x2e')](respondWithResult(_0x2e058e,null))[_0xd64c('0x25')](handleError(_0x2e058e,null));};exports[_0xd64c('0x121')]=function(_0xa4800d,_0x4c0372,_0x8f8652){return db['ChatWebsite'][_0xd64c('0x53')]({'where':{'id':_0xa4800d[_0xd64c('0x51')]['id']}})[_0xd64c('0x2e')](handleEntityNotFound(_0x4c0372,null))[_0xd64c('0x2e')](function(_0x4a9930){if(_0x4a9930){return _0x4a9930[_0xd64c('0x121')](_0xa4800d[_0xd64c('0x3f')][_0xd64c('0x65')])[_0xd64c('0x2e')](function(){if(_[_0xd64c('0x122')](_0xa4800d['query']['ids'])){for(var _0x48c04d=0x0;_0x48c04d<_0xa4800d['query'][_0xd64c('0x65')][_0xd64c('0x45')];_0x48c04d+=0x1){socket[_0xd64c('0x123')]('userChatWebsite:remove',{'UserId':Number(_0xa4800d[_0xd64c('0x3f')][_0xd64c('0x65')][_0x48c04d]),'ChatWebsiteId':Number(_0xa4800d[_0xd64c('0x51')]['id'])});}}else{socket[_0xd64c('0x123')](_0xd64c('0x124'),{'UserId':Number(_0xa4800d['query'][_0xd64c('0x65')]),'ChatWebsiteId':Number(_0xa4800d[_0xd64c('0x51')]['id'])});}});}})[_0xd64c('0x2e')](respondWithStatusCode(_0x4c0372,null))[_0xd64c('0x25')](handleError(_0x4c0372,null));};exports[_0xd64c('0x125')]=function(_0x440c1a,_0x13590e,_0x1f6ec8){var _0x4a3e1c={};var _0x103175={};var _0x5c9173;var _0x5d3007;return db[_0xd64c('0x3a')]['findOne']({'where':{'id':_0x440c1a['params']['id']}})[_0xd64c('0x2e')](handleEntityNotFound(_0x13590e,null))[_0xd64c('0x2e')](function(_0x3340ef){if(_0x3340ef){_0x5c9173=_0x3340ef;_0x103175['model']=_[_0xd64c('0x40')](db[_0xd64c('0x126')][_0xd64c('0x3b')]);_0x103175[_0xd64c('0x3f')]=_[_0xd64c('0x40')](_0x440c1a['query']);_0x103175[_0xd64c('0x41')]=_[_0xd64c('0x42')](_0x103175['model'],_0x103175[_0xd64c('0x3f')]);_0x4a3e1c[_0xd64c('0x43')]=_[_0xd64c('0x42')](_0x103175[_0xd64c('0x3e')],qs[_0xd64c('0x44')](_0x440c1a[_0xd64c('0x3f')][_0xd64c('0x44')]));_0x4a3e1c[_0xd64c('0x43')]=_0x4a3e1c[_0xd64c('0x43')][_0xd64c('0x45')]?_0x4a3e1c[_0xd64c('0x43')]:_0x103175[_0xd64c('0x3e')];_0x4a3e1c[_0xd64c('0x62')]=qs[_0xd64c('0x48')](_0x440c1a[_0xd64c('0x3f')]['sort']);_0x4a3e1c[_0xd64c('0x49')]=qs[_0xd64c('0x41')](_[_0xd64c('0x4a')](_0x440c1a[_0xd64c('0x3f')],_0x103175[_0xd64c('0x41')]));if(_0x440c1a['query'][_0xd64c('0x4b')]){_0x4a3e1c[_0xd64c('0x49')]=_['merge'](_0x4a3e1c[_0xd64c('0x49')],{'$or':_['map'](_0x4a3e1c[_0xd64c('0x43')],function(_0x296c0c){var _0x880a58={};_0x880a58[_0x296c0c]={'$like':'%'+_0x440c1a[_0xd64c('0x3f')][_0xd64c('0x4b')]+'%'};return _0x880a58;})});}_0x4a3e1c=_[_0xd64c('0x52')]({},_0x4a3e1c,_0x440c1a[_0xd64c('0x4d')]);return _0x5c9173['getAgents'](_0x4a3e1c);}})[_0xd64c('0x2e')](function(_0x4f9666){if(_0x4f9666){_0x5d3007=_0x4f9666[_0xd64c('0x45')];if(!_0x440c1a['query'][_0xd64c('0x46')](_0xd64c('0x47'))){_0x4a3e1c['limit']=qs[_0xd64c('0x2b')](_0x440c1a['query'][_0xd64c('0x2b')]);_0x4a3e1c[_0xd64c('0x29')]=qs[_0xd64c('0x29')](_0x440c1a[_0xd64c('0x3f')][_0xd64c('0x29')]);}return _0x5c9173[_0xd64c('0x125')](_0x4a3e1c);}})[_0xd64c('0x2e')](function(_0x49d8a2){if(_0x49d8a2){return _0x49d8a2?{'count':_0x5d3007,'rows':_0x49d8a2}:null;}})[_0xd64c('0x2e')](respondWithResult(_0x13590e,null))[_0xd64c('0x25')](handleError(_0x13590e,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index fdb1289..a90428c 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 _0x1782=['hasOwnProperty','hook','../../mysqldb','ChatWebsite','update','emit'];(function(_0x11ad65,_0x352d3c){var _0x35590c=function(_0x2c3845){while(--_0x2c3845){_0x11ad65['push'](_0x11ad65['shift']());}};_0x35590c(++_0x352d3c);}(_0x1782,0x188));var _0x2178=function(_0x59941b,_0x121697){_0x59941b=_0x59941b-0x0;var _0x43d0b2=_0x1782[_0x59941b];return _0x43d0b2;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0x2178('0x0'))['db'][_0x2178('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x2178('0x2'),'afterDestroy':'remove'};function emitEvent(_0xf336e1){return function(_0x24c4cd,_0x4a3e99,_0x40f25d){ChatWebsiteEvents['emit'](_0xf336e1+':'+_0x24c4cd['id'],_0x24c4cd);ChatWebsiteEvents[_0x2178('0x3')](_0xf336e1,_0x24c4cd);_0x40f25d(null);};}for(var e in events){if(events[_0x2178('0x4')](e)){var event=events[e];ChatWebsite[_0x2178('0x5')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0xc7b4=['ChatWebsite','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x326863,_0x48bc96){var _0x3cc1e9=function(_0x54cd54){while(--_0x54cd54){_0x326863['push'](_0x326863['shift']());}};_0x3cc1e9(++_0x48bc96);}(_0xc7b4,0x15e));var _0x4c7b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc7b4[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x4c7b('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0x4c7b('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x4c7b('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4c7b('0x3'),'afterDestroy':_0x4c7b('0x4')};function emitEvent(_0x279c21){return function(_0x2a8b1d,_0x109687,_0x5a20ca){ChatWebsiteEvents[_0x4c7b('0x5')](_0x279c21+':'+_0x2a8b1d['id'],_0x2a8b1d);ChatWebsiteEvents[_0x4c7b('0x5')](_0x279c21,_0x2a8b1d);_0x5a20ca(null);};}for(var e in events){if(events[_0x4c7b('0x6')](e)){var event=events[e];ChatWebsite[_0x4c7b('0x7')](e,emitEvent(event));}}module[_0x4c7b('0x8')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index d99e90d..afa2562 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 _0x2ad7=['exports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes'];(function(_0x535929,_0x2729d9){var _0x571dfd=function(_0x17e260){while(--_0x17e260){_0x535929['push'](_0x535929['shift']());}};_0x571dfd(++_0x2729d9);}(_0x2ad7,0xb5));var _0x72ad=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x2ad7[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x72ad('0x0'));var util=require(_0x72ad('0x1'));var logger=require(_0x72ad('0x2'))(_0x72ad('0x3'));var moment=require(_0x72ad('0x4'));var BPromise=require(_0x72ad('0x5'));var rp=require(_0x72ad('0x6'));var fs=require('fs');var path=require(_0x72ad('0x7'));var rimraf=require(_0x72ad('0x8'));var config=require(_0x72ad('0x9'));var attributes=require(_0x72ad('0xa'));module[_0x72ad('0xb')]=function(_0x307874,_0x5f5cda){return _0x307874['define']('ChatWebsite',attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a92=['chat_websites','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite'];(function(_0x2f62a5,_0x43985d){var _0x32f3a7=function(_0x487d0b){while(--_0x487d0b){_0x2f62a5['push'](_0x2f62a5['shift']());}};_0x32f3a7(++_0x43985d);}(_0x7a92,0x1e5));var _0x27a9=function(_0x3149da,_0x49d0a3){_0x3149da=_0x3149da-0x0;var _0x180dc3=_0x7a92[_0x3149da];return _0x180dc3;};'use strict';var _=require('lodash');var util=require(_0x27a9('0x0'));var logger=require(_0x27a9('0x1'))('api');var moment=require(_0x27a9('0x2'));var BPromise=require(_0x27a9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x27a9('0x4'));var config=require(_0x27a9('0x5'));var attributes=require(_0x27a9('0x6'));module[_0x27a9('0x7')]=function(_0x1845c4,_0x2083ef){return _0x1845c4[_0x27a9('0x8')](_0x27a9('0x9'),attributes,{'tableName':_0x27a9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 8121226..b5d997b 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 _0xad7e=['stringify','code','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x4358f5,_0x5b1ac6){var _0x4d8104=function(_0x1d4aee){while(--_0x1d4aee){_0x4358f5['push'](_0x4358f5['shift']());}};_0x4d8104(++_0x5b1ac6);}(_0xad7e,0x1e6));var _0xead7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xad7e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xead7('0x0'));var util=require(_0xead7('0x1'));var moment=require('moment');var BPromise=require(_0xead7('0x2'));var rs=require(_0xead7('0x3'));var fs=require('fs');var Redis=require(_0xead7('0x4'));var db=require(_0xead7('0x5'))['db'];var utils=require(_0xead7('0x6'));var logger=require('../../config/logger')(_0xead7('0x7'));var config=require(_0xead7('0x8'));var jayson=require(_0xead7('0x9'));var client=jayson[_0xead7('0xa')][_0xead7('0xb')]({'port':0x232a});config['redis']=_[_0xead7('0xc')](config[_0xead7('0xd')],{'host':_0xead7('0xe'),'port':0x18eb});var socket=require(_0xead7('0xf'))(new Redis(config[_0xead7('0xd')]));require(_0xead7('0x10'))[_0xead7('0x11')](socket);function respondWithRpcPromise(_0x540d38,_0x50f248,_0x400a2f){return new BPromise(function(_0x4674db,_0x4ec4b9){return client[_0xead7('0x12')](_0x540d38,_0x400a2f)[_0xead7('0x13')](function(_0xe75e9f){logger[_0xead7('0x14')](_0xead7('0x15'),_0x50f248,'request\x20sent');logger[_0xead7('0x16')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x50f248,_0xead7('0x17'),JSON[_0xead7('0x18')](_0xe75e9f));if(_0xe75e9f['error']){if(_0xe75e9f['error'][_0xead7('0x19')]===0x1f4){logger[_0xead7('0x1a')](_0xead7('0x15'),_0x50f248,_0xe75e9f[_0xead7('0x1a')][_0xead7('0x1b')]);return _0x4ec4b9(_0xe75e9f['error']['message']);}logger[_0xead7('0x1a')]('ChatWebsite,\x20%s,\x20%s',_0x50f248,_0xe75e9f[_0xead7('0x1a')][_0xead7('0x1b')]);return _0x4674db(_0xe75e9f['error']['message']);}else{logger['info'](_0xead7('0x15'),_0x50f248,_0xead7('0x17'));_0x4674db(_0xe75e9f[_0xead7('0x1c')][_0xead7('0x1b')]);}})[_0xead7('0x1d')](function(_0x4c703f){logger[_0xead7('0x1a')](_0xead7('0x15'),_0x50f248,_0x4c703f);_0x4ec4b9(_0x4c703f);});});} \ No newline at end of file +var _0x1017=['request','then','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','rpc','http','redis','defaults','localhost','./chatWebsite.socket'];(function(_0x384a44,_0xdc4c20){var _0x314396=function(_0x5dba0c){while(--_0x5dba0c){_0x384a44['push'](_0x384a44['shift']());}};_0x314396(++_0xdc4c20);}(_0x1017,0x1d8));var _0x7101=function(_0x74069a,_0x4f93ee){_0x74069a=_0x74069a-0x0;var _0x2bdc85=_0x1017[_0x74069a];return _0x2bdc85;};'use strict';var _=require(_0x7101('0x0'));var util=require(_0x7101('0x1'));var moment=require('moment');var BPromise=require(_0x7101('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7101('0x3'))['db'];var utils=require(_0x7101('0x4'));var logger=require('../../config/logger')(_0x7101('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x7101('0x6')]({'port':0x232a});config[_0x7101('0x7')]=_[_0x7101('0x8')](config[_0x7101('0x7')],{'host':_0x7101('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7101('0xa'))['register'](socket);function respondWithRpcPromise(_0x29abf7,_0x5b3d55,_0x296a9d){return new BPromise(function(_0x486c9e,_0x569952){return client[_0x7101('0xb')](_0x29abf7,_0x296a9d)[_0x7101('0xc')](function(_0xa90941){logger[_0x7101('0xd')](_0x7101('0xe'),_0x5b3d55,'request\x20sent');logger[_0x7101('0xf')](_0x7101('0x10'),_0x5b3d55,_0x7101('0x11'),JSON[_0x7101('0x12')](_0xa90941));if(_0xa90941[_0x7101('0x13')]){if(_0xa90941[_0x7101('0x13')][_0x7101('0x14')]===0x1f4){logger[_0x7101('0x13')](_0x7101('0xe'),_0x5b3d55,_0xa90941[_0x7101('0x13')][_0x7101('0x15')]);return _0x569952(_0xa90941[_0x7101('0x13')][_0x7101('0x15')]);}logger[_0x7101('0x13')](_0x7101('0xe'),_0x5b3d55,_0xa90941['error']['message']);return _0x486c9e(_0xa90941[_0x7101('0x13')][_0x7101('0x15')]);}else{logger[_0x7101('0xd')](_0x7101('0xe'),_0x5b3d55,_0x7101('0x11'));_0x486c9e(_0xa90941['result'][_0x7101('0x15')]);}})[_0x7101('0x16')](function(_0xd5be9b){logger[_0x7101('0x13')](_0x7101('0xe'),_0x5b3d55,_0xd5be9b);_0x569952(_0xd5be9b);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 4df5df6..063aea5 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 _0x2ffa=['./chatWebsite.events','save','remove','update','register','length','chatWebsite:'];(function(_0x126d9e,_0x2939b0){var _0xd7be62=function(_0x407930){while(--_0x407930){_0x126d9e['push'](_0x126d9e['shift']());}};_0xd7be62(++_0x2939b0);}(_0x2ffa,0x7e));var _0xa2ff=function(_0x26ba4c,_0x45387a){_0x26ba4c=_0x26ba4c-0x0;var _0x52a42c=_0x2ffa[_0x26ba4c];return _0x52a42c;};'use strict';var ChatWebsiteEvents=require(_0xa2ff('0x0'));var events=[_0xa2ff('0x1'),_0xa2ff('0x2'),_0xa2ff('0x3')];function createListener(_0x51510d,_0x569e86){return function(_0x159131){_0x569e86['emit'](_0x51510d,_0x159131);};}function removeListener(_0x5601ba,_0x518bfa){return function(){ChatWebsiteEvents['removeListener'](_0x5601ba,_0x518bfa);};}exports[_0xa2ff('0x4')]=function(_0x443d6f){for(var _0x16f9b2=0x0,_0xa37c9c=events[_0xa2ff('0x5')];_0x16f9b2<_0xa37c9c;_0x16f9b2++){var _0x5a868c=events[_0x16f9b2];var _0x140f66=createListener(_0xa2ff('0x6')+_0x5a868c,_0x443d6f);ChatWebsiteEvents['on'](_0x5a868c,_0x140f66);}}; \ No newline at end of file +var _0xaddb=['length','chatWebsite:','save','update','emit','removeListener','register'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0xaddb,0xc6));var _0xbadd=function(_0x3820b5,_0x504325){_0x3820b5=_0x3820b5-0x0;var _0xb749d2=_0xaddb[_0x3820b5];return _0xb749d2;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0xbadd('0x0'),'remove',_0xbadd('0x1')];function createListener(_0x250cd4,_0x34b7f2){return function(_0x6092b6){_0x34b7f2[_0xbadd('0x2')](_0x250cd4,_0x6092b6);};}function removeListener(_0x2edee6,_0x98f5d5){return function(){ChatWebsiteEvents[_0xbadd('0x3')](_0x2edee6,_0x98f5d5);};}exports[_0xbadd('0x4')]=function(_0x2a8b4d){for(var _0x1d26a0=0x0,_0xe1eb9f=events[_0xbadd('0x5')];_0x1d26a0<_0xe1eb9f;_0x1d26a0++){var _0x14fcbf=events[_0x1d26a0];var _0x27f06a=createListener(_0xbadd('0x6')+_0x14fcbf,_0x2a8b4d);ChatWebsiteEvents['on'](_0x14fcbf,_0x27f06a);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 7e25703..b4f7245 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 _0x775e=['util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','describe','/:id','/:id/dispositions','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','/:id/fields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','diskStorage','join','root','server/files/images/logos/','originalname','single','addLogo','server/files/images/avatars/','format','%s-%s','now','file','addAvatar','/:id/customer_avatar','addCustomerAvatar','/:id/notify','notify','server/files','offline-chat','ensureDir','replace','/:id/offline','any','offline','addInteraction','addAgents','put','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer'];(function(_0x2daf18,_0x3db257){var _0x3b1e89=function(_0x27185f){while(--_0x27185f){_0x2daf18['push'](_0x2daf18['shift']());}};_0x3b1e89(++_0x3db257);}(_0x775e,0x87));var _0xe775=function(_0x1dfa23,_0x19e069){_0x1dfa23=_0x1dfa23-0x0;var _0x134989=_0x775e[_0x1dfa23];return _0x134989;};'use strict';var multer=require(_0xe775('0x0'));var util=require(_0xe775('0x1'));var path=require(_0xe775('0x2'));var timeout=require('connect-timeout');var express=require(_0xe775('0x3'));var router=express['Router']();var fs_extra=require(_0xe775('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe775('0x5'));var config=require(_0xe775('0x6'));var controller=require(_0xe775('0x7'));router[_0xe775('0x8')]('/',auth[_0xe775('0x9')](),controller[_0xe775('0xa')]);router[_0xe775('0x8')]('/describe',auth[_0xe775('0x9')](),controller[_0xe775('0xb')]);router[_0xe775('0x8')](_0xe775('0xc'),auth[_0xe775('0x9')](),controller['show']);router['get'](_0xe775('0xd'),auth['isAuthenticated'](),controller['getDispositions']);router[_0xe775('0x8')]('/:id/canned_answers',auth[_0xe775('0x9')](),controller['getAnswers']);router[_0xe775('0x8')](_0xe775('0xe'),controller[_0xe775('0xf')]);router[_0xe775('0x8')](_0xe775('0x10'),controller[_0xe775('0x11')]);router[_0xe775('0x8')]('/:id/customer_avatar',controller['getCustomerAvatar']);router['get'](_0xe775('0x12'),controller[_0xe775('0x13')]);router['get'](_0xe775('0x14'),auth[_0xe775('0x9')](),controller[_0xe775('0x15')]);router['get'](_0xe775('0x16'),controller[_0xe775('0x17')]);router['get'](_0xe775('0x18'),auth[_0xe775('0x9')](),controller[_0xe775('0x19')]);router[_0xe775('0x8')](_0xe775('0x1a'),auth[_0xe775('0x9')](),controller['getProactiveActions']);router['get'](_0xe775('0x1b'),controller['getFields']);router[_0xe775('0x8')](_0xe775('0x1c'),auth[_0xe775('0x9')](),controller[_0xe775('0x1d')]);router[_0xe775('0x8')](_0xe775('0x1e'),auth[_0xe775('0x9')](),controller[_0xe775('0x1f')]);router[_0xe775('0x20')]('/',auth[_0xe775('0x9')](),controller[_0xe775('0x21')]);router['post'](_0xe775('0xd'),auth[_0xe775('0x9')](),controller[_0xe775('0x22')]);router['post'](_0xe775('0x23'),auth[_0xe775('0x9')](),controller['addAnswer']);var upload=multer({'storage':multer[_0xe775('0x24')]({'destination':function(_0x8fff0,_0x1a08da,_0x1958dc){_0x1958dc(null,path[_0xe775('0x25')](config[_0xe775('0x26')],_0xe775('0x27')));},'filename':function(_0x15624f,_0x5cbd2c,_0x62d1a){_0x62d1a(null,util['format']('%s-%s',Date['now'](),_0x5cbd2c[_0xe775('0x28')]));}})});router[_0xe775('0x20')]('/:id/logo',upload[_0xe775('0x29')]('file'),controller[_0xe775('0x2a')]);var upload=multer({'storage':multer[_0xe775('0x24')]({'destination':function(_0x425f7c,_0x1535f6,_0x577569){_0x577569(null,path[_0xe775('0x25')](config['root'],_0xe775('0x2b')));},'filename':function(_0x18b963,_0x2acadc,_0x2c8c63){_0x2c8c63(null,util[_0xe775('0x2c')](_0xe775('0x2d'),Date[_0xe775('0x2e')](),_0x2acadc[_0xe775('0x28')]));}})});router[_0xe775('0x20')](_0xe775('0x10'),upload['single'](_0xe775('0x2f')),controller[_0xe775('0x30')]);var upload=multer({'storage':multer[_0xe775('0x24')]({'destination':function(_0x3fac92,_0x55f12d,_0x1f7249){_0x1f7249(null,path['join'](config[_0xe775('0x26')],_0xe775('0x2b')));},'filename':function(_0x1c8172,_0x4e4db5,_0x51b5bd){_0x51b5bd(null,util[_0xe775('0x2c')](_0xe775('0x2d'),Date[_0xe775('0x2e')](),_0x4e4db5[_0xe775('0x28')]));}})});router[_0xe775('0x20')](_0xe775('0x31'),upload[_0xe775('0x29')](_0xe775('0x2f')),controller[_0xe775('0x32')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4fee22,_0x555420,_0x235d45){_0x235d45(null,path[_0xe775('0x25')](config[_0xe775('0x26')],_0xe775('0x2b')));},'filename':function(_0x28bdd9,_0x4723e9,_0x1d7507){_0x1d7507(null,util[_0xe775('0x2c')](_0xe775('0x2d'),Date[_0xe775('0x2e')](),_0x4723e9[_0xe775('0x28')]));}})});router['post'](_0xe775('0x12'),upload[_0xe775('0x29')](_0xe775('0x2f')),controller['addSystemAvatar']);router['post'](_0xe775('0x33'),controller[_0xe775('0x34')]);const offlineUploadMulter=multer({'storage':multer[_0xe775('0x24')]({'destination':function(_0x3d04ab,_0x59cfba,_0x16f6c8){const _0x2c49ee=path['join'](config['root'],_0xe775('0x35'),'attachments',_0xe775('0x36'));fs_extra[_0xe775('0x37')](_0x2c49ee,function(){_0x16f6c8(null,_0x2c49ee);});},'filename':function(_0x34b1d5,_0x153f18,_0x2417b5){const _0x147b0c=_0x153f18[_0xe775('0x28')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x8334ae=path['extname'](_0x147b0c);const _0x149710=Date[_0xe775('0x2e')]()+'-'+_0x147b0c[_0xe775('0x38')](_0x8334ae,'')+_0x8334ae;_0x2417b5(null,_0x149710);}})});router[_0xe775('0x20')](_0xe775('0x39'),offlineUploadMulter[_0xe775('0x3a')](),controller[_0xe775('0x3b')]);router[_0xe775('0x20')]('/:id/interactions',auth[_0xe775('0x9')](),controller[_0xe775('0x3c')]);router[_0xe775('0x20')](_0xe775('0x18'),auth[_0xe775('0x9')](),controller['addApplications']);router[_0xe775('0x20')](_0xe775('0x1a'),auth[_0xe775('0x9')](),controller['addProactiveActions']);router[_0xe775('0x20')](_0xe775('0x1e'),auth[_0xe775('0x9')](),controller[_0xe775('0x3d')]);router[_0xe775('0x3e')]('/:id',auth[_0xe775('0x9')](),controller['update']);router[_0xe775('0x3f')](_0xe775('0xc'),auth[_0xe775('0x9')](),controller[_0xe775('0x40')]);router[_0xe775('0x3f')](_0xe775('0xd'),auth[_0xe775('0x9')](),controller[_0xe775('0x41')]);router[_0xe775('0x3f')](_0xe775('0x23'),auth[_0xe775('0x9')](),controller[_0xe775('0x42')]);router[_0xe775('0x3f')]('/:id/users',auth[_0xe775('0x9')](),controller[_0xe775('0x43')]);module['exports']=router; \ No newline at end of file +var _0xb071=['getInteractions','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','getFields','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','join','root','format','%s-%s','now','originalname','single','file','addLogo','diskStorage','addAvatar','server/files/images/avatars/','addCustomerAvatar','addSystemAvatar','server/files','offline-chat','ensureDir','replace','extname','/:id/offline','offline','addInteraction','addProactiveActions','addAgents','put','update','delete','removeDispositions','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./chatWebsite.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions'];(function(_0x53df25,_0x2a7f81){var _0x434a1b=function(_0x398750){while(--_0x398750){_0x53df25['push'](_0x53df25['shift']());}};_0x434a1b(++_0x2a7f81);}(_0xb071,0xb9));var _0x1b07=function(_0x2881e2,_0x341293){_0x2881e2=_0x2881e2-0x0;var _0x5c1e1f=_0xb071[_0x2881e2];return _0x5c1e1f;};'use strict';var multer=require(_0x1b07('0x0'));var util=require(_0x1b07('0x1'));var path=require(_0x1b07('0x2'));var timeout=require(_0x1b07('0x3'));var express=require(_0x1b07('0x4'));var router=express[_0x1b07('0x5')]();var fs_extra=require(_0x1b07('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1b07('0x7'));var controller=require(_0x1b07('0x8'));router['get']('/',auth[_0x1b07('0x9')](),controller[_0x1b07('0xa')]);router[_0x1b07('0xb')](_0x1b07('0xc'),auth[_0x1b07('0x9')](),controller[_0x1b07('0xd')]);router[_0x1b07('0xb')](_0x1b07('0xe'),auth[_0x1b07('0x9')](),controller[_0x1b07('0xf')]);router[_0x1b07('0xb')](_0x1b07('0x10'),auth[_0x1b07('0x9')](),controller[_0x1b07('0x11')]);router[_0x1b07('0xb')](_0x1b07('0x12'),auth[_0x1b07('0x9')](),controller[_0x1b07('0x13')]);router[_0x1b07('0xb')](_0x1b07('0x14'),controller[_0x1b07('0x15')]);router[_0x1b07('0xb')]('/:id/avatar',controller[_0x1b07('0x16')]);router[_0x1b07('0xb')](_0x1b07('0x17'),controller[_0x1b07('0x18')]);router[_0x1b07('0xb')](_0x1b07('0x19'),controller[_0x1b07('0x1a')]);router[_0x1b07('0xb')](_0x1b07('0x1b'),auth[_0x1b07('0x9')](),controller[_0x1b07('0x1c')]);router['get']('/:id/snippet',controller[_0x1b07('0x1d')]);router[_0x1b07('0xb')](_0x1b07('0x1e'),auth['isAuthenticated'](),controller[_0x1b07('0x1f')]);router['get'](_0x1b07('0x20'),auth[_0x1b07('0x9')](),controller[_0x1b07('0x21')]);router[_0x1b07('0xb')]('/:id/fields',controller[_0x1b07('0x22')]);router[_0x1b07('0xb')]('/:id/offline_messages',auth[_0x1b07('0x9')](),controller[_0x1b07('0x23')]);router[_0x1b07('0xb')](_0x1b07('0x24'),auth[_0x1b07('0x9')](),controller[_0x1b07('0x25')]);router[_0x1b07('0x26')]('/',auth[_0x1b07('0x9')](),controller[_0x1b07('0x27')]);router['post'](_0x1b07('0x10'),auth[_0x1b07('0x9')](),controller[_0x1b07('0x28')]);router[_0x1b07('0x26')](_0x1b07('0x12'),auth[_0x1b07('0x9')](),controller['addAnswer']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x7d0d04,_0x11915b,_0x2e61d5){_0x2e61d5(null,path[_0x1b07('0x29')](config[_0x1b07('0x2a')],'server/files/images/logos/'));},'filename':function(_0x422715,_0x28da9e,_0xf87018){_0xf87018(null,util[_0x1b07('0x2b')](_0x1b07('0x2c'),Date[_0x1b07('0x2d')](),_0x28da9e[_0x1b07('0x2e')]));}})});router[_0x1b07('0x26')](_0x1b07('0x14'),upload[_0x1b07('0x2f')](_0x1b07('0x30')),controller[_0x1b07('0x31')]);var upload=multer({'storage':multer[_0x1b07('0x32')]({'destination':function(_0x4dff8a,_0x4dbc33,_0x1f5e62){_0x1f5e62(null,path[_0x1b07('0x29')](config['root'],'server/files/images/avatars/'));},'filename':function(_0x5cc4f1,_0x121ae1,_0xceb55a){_0xceb55a(null,util[_0x1b07('0x2b')](_0x1b07('0x2c'),Date['now'](),_0x121ae1['originalname']));}})});router[_0x1b07('0x26')]('/:id/avatar',upload[_0x1b07('0x2f')](_0x1b07('0x30')),controller[_0x1b07('0x33')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3c461c,_0x101fd1,_0x89254f){_0x89254f(null,path[_0x1b07('0x29')](config[_0x1b07('0x2a')],_0x1b07('0x34')));},'filename':function(_0x1319ef,_0x123d6b,_0x4a9510){_0x4a9510(null,util[_0x1b07('0x2b')](_0x1b07('0x2c'),Date[_0x1b07('0x2d')](),_0x123d6b[_0x1b07('0x2e')]));}})});router['post'](_0x1b07('0x17'),upload[_0x1b07('0x2f')](_0x1b07('0x30')),controller[_0x1b07('0x35')]);var upload=multer({'storage':multer[_0x1b07('0x32')]({'destination':function(_0x26ea11,_0xe47d4d,_0x102a0){_0x102a0(null,path[_0x1b07('0x29')](config[_0x1b07('0x2a')],_0x1b07('0x34')));},'filename':function(_0x19bc0d,_0x314c71,_0x124614){_0x124614(null,util[_0x1b07('0x2b')](_0x1b07('0x2c'),Date[_0x1b07('0x2d')](),_0x314c71['originalname']));}})});router[_0x1b07('0x26')](_0x1b07('0x19'),upload['single'](_0x1b07('0x30')),controller[_0x1b07('0x36')]);router[_0x1b07('0x26')]('/:id/notify',controller['notify']);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x40c83f,_0xed8481,_0x50507d){const _0x5cde78=path[_0x1b07('0x29')](config[_0x1b07('0x2a')],_0x1b07('0x37'),'attachments',_0x1b07('0x38'));fs_extra[_0x1b07('0x39')](_0x5cde78,function(){_0x50507d(null,_0x5cde78);});},'filename':function(_0x3e8fa3,_0x13ee3b,_0x47efd1){const _0x26d7c3=_0x13ee3b[_0x1b07('0x2e')][_0x1b07('0x3a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x307560=path[_0x1b07('0x3b')](_0x26d7c3);const _0x560697=Date[_0x1b07('0x2d')]()+'-'+_0x26d7c3[_0x1b07('0x3a')](_0x307560,'')+_0x307560;_0x47efd1(null,_0x560697);}})});router[_0x1b07('0x26')](_0x1b07('0x3c'),offlineUploadMulter['any'](),controller[_0x1b07('0x3d')]);router[_0x1b07('0x26')]('/:id/interactions',auth[_0x1b07('0x9')](),controller[_0x1b07('0x3e')]);router[_0x1b07('0x26')](_0x1b07('0x1e'),auth[_0x1b07('0x9')](),controller['addApplications']);router[_0x1b07('0x26')](_0x1b07('0x20'),auth[_0x1b07('0x9')](),controller[_0x1b07('0x3f')]);router[_0x1b07('0x26')]('/:id/users',auth[_0x1b07('0x9')](),controller[_0x1b07('0x40')]);router[_0x1b07('0x41')](_0x1b07('0xe'),auth[_0x1b07('0x9')](),controller[_0x1b07('0x42')]);router[_0x1b07('0x43')]('/:id',auth[_0x1b07('0x9')](),controller['destroy']);router[_0x1b07('0x43')](_0x1b07('0x10'),auth[_0x1b07('0x9')](),controller[_0x1b07('0x44')]);router[_0x1b07('0x43')](_0x1b07('0x12'),auth[_0x1b07('0x9')](),controller[_0x1b07('0x45')]);router[_0x1b07('0x43')](_0x1b07('0x24'),auth['isAuthenticated'](),controller[_0x1b07('0x46')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index c912bcd..54d4ef1 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 _0x1623=['STRING','sequelize','ENUM','AmazonAWS','Google'];(function(_0xe91163,_0x52f7cc){var _0x2d5c78=function(_0x42da10){while(--_0x42da10){_0xe91163['push'](_0xe91163['shift']());}};_0x2d5c78(++_0x52f7cc);}(_0x1623,0xab));var _0x3162=function(_0x4b565b,_0x40842a){_0x4b565b=_0x4b565b-0x0;var _0x3aa783=_0x1623[_0x4b565b];return _0x3aa783;};'use strict';var Sequelize=require(_0x3162('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x3162('0x1')](_0x3162('0x2'),_0x3162('0x3')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x3162('0x4')]},'data2':{'type':Sequelize[_0x3162('0x4')]}}; \ No newline at end of file +var _0x8ace=['sequelize','exports','STRING','ENUM','AmazonAWS','Google'];(function(_0x37e498,_0x2df21a){var _0x1ab2e4=function(_0x5f142b){while(--_0x5f142b){_0x37e498['push'](_0x37e498['shift']());}};_0x1ab2e4(++_0x2df21a);}(_0x8ace,0x1bc));var _0xe8ac=function(_0x327c12,_0x2874c9){_0x327c12=_0x327c12-0x0;var _0x4cd602=_0x8ace[_0x327c12];return _0x4cd602;};'use strict';var Sequelize=require(_0xe8ac('0x0'));module[_0xe8ac('0x1')]={'name':{'type':Sequelize[_0xe8ac('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xe8ac('0x3')](_0xe8ac('0x4'),_0xe8ac('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0xe8ac('0x2')]},'data2':{'type':Sequelize[_0xe8ac('0x2')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 0f21ef8..e1fe9ec 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 _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(_0x192153,_0x3be477){var _0x257fe0=function(_0x442272){while(--_0x442272){_0x192153['push'](_0x192153['shift']());}};_0x257fe0(++_0x3be477);}(_0x2032,0xd9));var _0x2203=function(_0xedb4f0,_0x30d7bf){_0xedb4f0=_0xedb4f0-0x0;var _0x41b807=_0x2032[_0xedb4f0];return _0x41b807;};'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 +var _0x2ef3=['update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','CloudProvider','then','includeAll','include','findAll','catch','show','params','keys','create','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x47ad9a,_0x300d49){var _0x24b4b1=function(_0x4ef3f8){while(--_0x4ef3f8){_0x47ad9a['push'](_0x47ad9a['shift']());}};_0x24b4b1(++_0x300d49);}(_0x2ef3,0xba));var _0x32ef=function(_0x5ad1c6,_0x1dfc41){_0x5ad1c6=_0x5ad1c6-0x0;var _0x1fdb68=_0x2ef3[_0x5ad1c6];return _0x1fdb68;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['CloudProvider'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'all':!![]}];}return db[_0x32ef('0x3d')][_0x32ef('0x41')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x3c0e44){_0x3c569d['rows']=_0x3c0e44;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x42')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x43')]=function(_0x2a33dd,_0x765c63){var _0x5dca14={'raw':!![],'where':{'id':_0x2a33dd[_0x32ef('0x44')]['id']}},_0x2901a1={};_0x2901a1['model']=_[_0x32ef('0x45')](db['CloudProvider'][_0x32ef('0x2a')]);_0x2901a1[_0x32ef('0x2f')]=_[_0x32ef('0x45')](_0x2a33dd[_0x32ef('0x2f')]);_0x2901a1[_0x32ef('0x30')]=_[_0x32ef('0x32')](_0x2901a1[_0x32ef('0x2e')],_0x2901a1[_0x32ef('0x2f')]);_0x5dca14[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x2901a1['model'],qs[_0x32ef('0x33')](_0x2a33dd['query'][_0x32ef('0x33')]));_0x5dca14[_0x32ef('0x31')]=_0x5dca14[_0x32ef('0x31')]['length']?_0x5dca14[_0x32ef('0x31')]:_0x2901a1[_0x32ef('0x2e')];if(_0x2a33dd[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5dca14[_0x32ef('0x40')]=[{'all':!![]}];}_0x5dca14=_[_0x32ef('0x3b')]({},_0x5dca14,_0x2a33dd[_0x32ef('0x3c')]);return db['CloudProvider']['find'](_0x5dca14)[_0x32ef('0x3e')](handleEntityNotFound(_0x765c63,null))[_0x32ef('0x3e')](respondWithResult(_0x765c63,null))[_0x32ef('0x42')](handleError(_0x765c63,null));};exports[_0x32ef('0x46')]=function(_0x209361,_0xd67dc9){return db[_0x32ef('0x3d')][_0x32ef('0x46')](_0x209361[_0x32ef('0x47')],{})[_0x32ef('0x3e')](respondWithResult(_0xd67dc9,0xc9))[_0x32ef('0x42')](handleError(_0xd67dc9,null));};exports[_0x32ef('0x24')]=function(_0x36a65c,_0x4c2534){if(_0x36a65c[_0x32ef('0x47')]['id']){delete _0x36a65c[_0x32ef('0x47')]['id'];}return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x36a65c[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x4c2534,null))[_0x32ef('0x3e')](saveUpdates(_0x36a65c[_0x32ef('0x47')],null))[_0x32ef('0x3e')](respondWithResult(_0x4c2534,null))[_0x32ef('0x42')](handleError(_0x4c2534,null));};exports[_0x32ef('0x49')]=function(_0x29d456,_0x272377){return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x29d456[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x272377,null))[_0x32ef('0x3e')](removeEntity(_0x272377,null))['catch'](handleError(_0x272377,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index e89d85b..0aef948 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 _0x6ab1=['CloudProvider','cloud_providers','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cloudProvider.attributes','exports','define'];(function(_0x356054,_0x1c96bf){var _0x434b91=function(_0x25a2a7){while(--_0x25a2a7){_0x356054['push'](_0x356054['shift']());}};_0x434b91(++_0x1c96bf);}(_0x6ab1,0xec));var _0x16ab=function(_0x590a38,_0x2bc65c){_0x590a38=_0x590a38-0x0;var _0xf36626=_0x6ab1[_0x590a38];return _0xf36626;};'use strict';var _=require('lodash');var util=require(_0x16ab('0x0'));var logger=require(_0x16ab('0x1'))(_0x16ab('0x2'));var moment=require(_0x16ab('0x3'));var BPromise=require(_0x16ab('0x4'));var rp=require(_0x16ab('0x5'));var fs=require('fs');var path=require(_0x16ab('0x6'));var rimraf=require(_0x16ab('0x7'));var config=require('../../config/environment');var attributes=require(_0x16ab('0x8'));module[_0x16ab('0x9')]=function(_0x3cc848,_0x5c2274){return _0x3cc848[_0x16ab('0xa')](_0x16ab('0xb'),attributes,{'tableName':_0x16ab('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd037=['CloudProvider','cloud_providers','../../config/logger','moment','bluebird','request-promise','path','rimraf','exports','define'];(function(_0x6f929,_0x1ee1bd){var _0x2402f1=function(_0x895feb){while(--_0x895feb){_0x6f929['push'](_0x6f929['shift']());}};_0x2402f1(++_0x1ee1bd);}(_0xd037,0xb6));var _0x7d03=function(_0x10553b,_0x40493a){_0x10553b=_0x10553b-0x0;var _0x2a4d03=_0xd037[_0x10553b];return _0x2a4d03;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7d03('0x0'))('api');var moment=require(_0x7d03('0x1'));var BPromise=require(_0x7d03('0x2'));var rp=require(_0x7d03('0x3'));var fs=require('fs');var path=require(_0x7d03('0x4'));var rimraf=require(_0x7d03('0x5'));var config=require('../../config/environment');var attributes=require('./cloudProvider.attributes');module[_0x7d03('0x6')]=function(_0xd71fc,_0x431e54){return _0xd71fc[_0x7d03('0x7')](_0x7d03('0x8'),attributes,{'tableName':_0x7d03('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 24e7fae..2c38b33 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=['bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment'];(function(_0x2f8b40,_0x3439bc){var _0x8a8999=function(_0x1e8236){while(--_0x1e8236){_0x2f8b40['push'](_0x2f8b40['shift']());}};_0x8a8999(++_0x3439bc);}(_0x7880,0x10f));var _0x0788=function(_0x3779eb,_0xc19002){_0x3779eb=_0x3779eb-0x0;var _0x50423a=_0x7880[_0x3779eb];return _0x50423a;};'use strict';var _=require(_0x0788('0x0'));var util=require('util');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('../../config/logger')(_0x0788('0x6'));var config=require('../../config/environment');var jayson=require(_0x0788('0x7'));var client=jayson[_0x0788('0x8')][_0x0788('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ece1c,_0x14cfa5,_0x450b71){return new BPromise(function(_0x5366c7,_0x1662a2){return client[_0x0788('0xa')](_0x5ece1c,_0x450b71)[_0x0788('0xb')](function(_0x95ebe3){logger[_0x0788('0xc')](_0x0788('0xd'),_0x14cfa5,_0x0788('0xe'));logger[_0x0788('0xf')](_0x0788('0x10'),_0x14cfa5,_0x0788('0xe'),JSON[_0x0788('0x11')](_0x95ebe3));if(_0x95ebe3['error']){if(_0x95ebe3[_0x0788('0x12')]['code']===0x1f4){logger[_0x0788('0x12')](_0x0788('0xd'),_0x14cfa5,_0x95ebe3[_0x0788('0x12')][_0x0788('0x13')]);return _0x1662a2(_0x95ebe3[_0x0788('0x12')]['message']);}logger[_0x0788('0x12')]('CloudProvider,\x20%s,\x20%s',_0x14cfa5,_0x95ebe3[_0x0788('0x12')]['message']);return _0x5366c7(_0x95ebe3['error'][_0x0788('0x13')]);}else{logger[_0x0788('0xc')](_0x0788('0xd'),_0x14cfa5,'request\x20sent');_0x5366c7(_0x95ebe3[_0x0788('0x14')][_0x0788('0x13')]);}})['catch'](function(_0x334f58){logger[_0x0788('0x12')](_0x0788('0xd'),_0x14cfa5,_0x334f58);_0x1662a2(_0x334f58);});});} \ No newline at end of file +var _0x4329=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x10be58,_0x41cdad){var _0x14deb3=function(_0x2a5121){while(--_0x2a5121){_0x10be58['push'](_0x10be58['shift']());}};_0x14deb3(++_0x41cdad);}(_0x4329,0x13b));var _0x9432=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x4329[_0x9df060];return _0x338dfe;};'use strict';var _=require(_0x9432('0x0'));var util=require(_0x9432('0x1'));var moment=require(_0x9432('0x2'));var BPromise=require(_0x9432('0x3'));var rs=require(_0x9432('0x4'));var fs=require('fs');var Redis=require(_0x9432('0x5'));var db=require(_0x9432('0x6'))['db'];var utils=require(_0x9432('0x7'));var logger=require(_0x9432('0x8'))(_0x9432('0x9'));var config=require(_0x9432('0xa'));var jayson=require(_0x9432('0xb'));var client=jayson[_0x9432('0xc')][_0x9432('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5568ad,_0x376967,_0x5346c3){return new BPromise(function(_0x10509f,_0x4563c4){return client['request'](_0x5568ad,_0x5346c3)[_0x9432('0xe')](function(_0x2b06c7){logger[_0x9432('0xf')](_0x9432('0x10'),_0x376967,_0x9432('0x11'));logger['debug'](_0x9432('0x12'),_0x376967,_0x9432('0x11'),JSON['stringify'](_0x2b06c7));if(_0x2b06c7['error']){if(_0x2b06c7[_0x9432('0x13')][_0x9432('0x14')]===0x1f4){logger[_0x9432('0x13')](_0x9432('0x10'),_0x376967,_0x2b06c7['error'][_0x9432('0x15')]);return _0x4563c4(_0x2b06c7[_0x9432('0x13')][_0x9432('0x15')]);}logger[_0x9432('0x13')](_0x9432('0x10'),_0x376967,_0x2b06c7['error'][_0x9432('0x15')]);return _0x10509f(_0x2b06c7[_0x9432('0x13')]['message']);}else{logger[_0x9432('0xf')](_0x9432('0x10'),_0x376967,'request\x20sent');_0x10509f(_0x2b06c7[_0x9432('0x16')][_0x9432('0x15')]);}})['catch'](function(_0x5c4360){logger['error']('CloudProvider,\x20%s,\x20%s',_0x376967,_0x5c4360);_0x4563c4(_0x5c4360);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 7fe6e6e..a8b5674 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 _0x2deb=['delete','/:id','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','create','put','update'];(function(_0x3e7775,_0x259e7c){var _0x364dcb=function(_0x2c5851){while(--_0x2c5851){_0x3e7775['push'](_0x3e7775['shift']());}};_0x364dcb(++_0x259e7c);}(_0x2deb,0xdb));var _0xb2de=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2deb[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xb2de('0x0'));var util=require(_0xb2de('0x1'));var path=require(_0xb2de('0x2'));var timeout=require(_0xb2de('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb2de('0x4'));var auth=require(_0xb2de('0x5'));var interaction=require(_0xb2de('0x6'));var config=require(_0xb2de('0x7'));var controller=require('./cloudProvider.controller');router['get']('/',auth[_0xb2de('0x8')](),controller[_0xb2de('0x9')]);router[_0xb2de('0xa')]('/:id',auth[_0xb2de('0x8')](),controller[_0xb2de('0xb')]);router['post']('/',auth[_0xb2de('0x8')](),controller[_0xb2de('0xc')]);router[_0xb2de('0xd')]('/:id',auth[_0xb2de('0x8')](),controller[_0xb2de('0xe')]);router[_0xb2de('0xf')](_0xb2de('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0xb2de('0x11')]=router; \ No newline at end of file +var _0x0a1c=['show','post','create','put','delete','exports','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cloudProvider.controller','get','isAuthenticated','index','/:id'];(function(_0x2519d0,_0x305dd4){var _0x5656e3=function(_0x5c317a){while(--_0x5c317a){_0x2519d0['push'](_0x2519d0['shift']());}};_0x5656e3(++_0x305dd4);}(_0x0a1c,0xd2));var _0xc0a1=function(_0x445101,_0x2414bf){_0x445101=_0x445101-0x0;var _0x3c3d04=_0x0a1c[_0x445101];return _0x3c3d04;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc0a1('0x0'));var timeout=require(_0xc0a1('0x1'));var express=require(_0xc0a1('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc0a1('0x3'));var interaction=require(_0xc0a1('0x4'));var config=require(_0xc0a1('0x5'));var controller=require(_0xc0a1('0x6'));router[_0xc0a1('0x7')]('/',auth[_0xc0a1('0x8')](),controller[_0xc0a1('0x9')]);router[_0xc0a1('0x7')](_0xc0a1('0xa'),auth[_0xc0a1('0x8')](),controller[_0xc0a1('0xb')]);router[_0xc0a1('0xc')]('/',auth[_0xc0a1('0x8')](),controller[_0xc0a1('0xd')]);router[_0xc0a1('0xe')](_0xc0a1('0xa'),auth[_0xc0a1('0x8')](),controller['update']);router[_0xc0a1('0xf')](_0xc0a1('0xa'),auth[_0xc0a1('0x8')](),controller['destroy']);module[_0xc0a1('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 90f37ac..3f81763 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 _0xb439=['sequelize','exports','STRING'];(function(_0x2c1616,_0x32ff80){var _0x3722ec=function(_0x4c4588){while(--_0x4c4588){_0x2c1616['push'](_0x2c1616['shift']());}};_0x3722ec(++_0x32ff80);}(_0xb439,0x87));var _0x9b43=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xb439[_0x1d1779];return _0x2377e9;};'use strict';var Sequelize=require(_0x9b43('0x0'));module[_0x9b43('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x9b43('0x2')]},'companyId':{'type':Sequelize[_0x9b43('0x2')]},'website':{'type':Sequelize[_0x9b43('0x2')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x9b43('0x2')]},'type':{'type':Sequelize[_0x9b43('0x2')]},'street':{'type':Sequelize[_0x9b43('0x2')]},'postalCode':{'type':Sequelize[_0x9b43('0x2')]},'city':{'type':Sequelize[_0x9b43('0x2')]},'country':{'type':Sequelize[_0x9b43('0x2')]},'email':{'type':Sequelize[_0x9b43('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x9b43('0x2')]},'sStreet':{'type':Sequelize[_0x9b43('0x2')]},'sPostalCode':{'type':Sequelize[_0x9b43('0x2')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x9b43('0x2')]},'description':{'type':Sequelize[_0x9b43('0x2')]}}; \ No newline at end of file +var _0xe033=['STRING','exports'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0xe033,0x8b));var _0x3e03=function(_0x1f61a3,_0x524e29){_0x1f61a3=_0x1f61a3-0x0;var _0x5c5818=_0xe033[_0x1f61a3];return _0x5c5818;};'use strict';var Sequelize=require('sequelize');module[_0x3e03('0x0')]={'name':{'type':Sequelize[_0x3e03('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x3e03('0x1')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x3e03('0x1')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x3e03('0x1')]},'sPostalCode':{'type':Sequelize[_0x3e03('0x1')]},'sCity':{'type':Sequelize[_0x3e03('0x1')]},'sCountry':{'type':Sequelize[_0x3e03('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index e9f3b74..c8a059b 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 _0x0769=['update','then','destroy','get','UserProfileResource','stack','name','index','describe','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','map','merge','options','CmCompany','findAll','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Companies','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','CmContact','ids','omit','getContacts','hasOwnProperty','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0x50a865,_0x5a2510){var _0x50cc4e=function(_0x25d969){while(--_0x25d969){_0x50a865['push'](_0x50a865['shift']());}};_0x50cc4e(++_0x5a2510);}(_0x0769,0x83));var _0x9076=function(_0x4d9a4f,_0x4d1ca5){_0x4d9a4f=_0x4d9a4f-0x0;var _0x390fbc=_0x0769[_0x4d9a4f];return _0x390fbc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9076('0x0'));var zipdir=require(_0x9076('0x1'));var jsonpatch=require(_0x9076('0x2'));var rp=require(_0x9076('0x3'));var moment=require('moment');var BPromise=require(_0x9076('0x4'));var Mustache=require(_0x9076('0x5'));var util=require('util');var path=require(_0x9076('0x6'));var sox=require(_0x9076('0x7'));var csv=require(_0x9076('0x8'));var ejs=require(_0x9076('0x9'));var fs=require('fs');var fs_extra=require(_0x9076('0xa'));var _=require(_0x9076('0xb'));var squel=require(_0x9076('0xc'));var crypto=require(_0x9076('0xd'));var jsforce=require(_0x9076('0xe'));var deskjs=require(_0x9076('0xf'));var toCsv=require(_0x9076('0x8'));var querystring=require(_0x9076('0x10'));var Papa=require('papaparse');var Redis=require(_0x9076('0x11'));var authService=require(_0x9076('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x9076('0x13'));var hardwareService=require(_0x9076('0x14'));var logger=require(_0x9076('0x15'))(_0x9076('0x16'));var utils=require(_0x9076('0x17'));var config=require(_0x9076('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x9076('0x19'))['db'];function respondWithStatusCode(_0x1b64b6,_0x1b1137){_0x1b1137=_0x1b1137||0xcc;return function(_0x1abba7){if(_0x1abba7){return _0x1b64b6[_0x9076('0x1a')](_0x1b1137);}return _0x1b64b6[_0x9076('0x1b')](_0x1b1137)[_0x9076('0x1c')]();};}function respondWithResult(_0x3d651c,_0x2123b6){_0x2123b6=_0x2123b6||0xc8;return function(_0x5dfe90){if(_0x5dfe90){return _0x3d651c['status'](_0x2123b6)[_0x9076('0x1d')](_0x5dfe90);}};}function respondWithFilteredResult(_0x8936d3,_0x4417be){return function(_0x2bb884){if(_0x2bb884){var _0x5b0074=typeof _0x4417be[_0x9076('0x1e')]===_0x9076('0x1f')&&typeof _0x4417be[_0x9076('0x20')]===_0x9076('0x1f');var _0x3e72c4=_0x2bb884[_0x9076('0x21')];var _0x2440d0=_0x5b0074?0x0:_0x4417be[_0x9076('0x1e')];var _0x2da783=_0x5b0074?_0x2bb884[_0x9076('0x21')]:_0x4417be['offset']+_0x4417be[_0x9076('0x20')];var _0x23985a;if(_0x2da783>=_0x3e72c4){_0x2da783=_0x3e72c4;_0x23985a=0xc8;}else{_0x23985a=0xce;}_0x8936d3[_0x9076('0x1b')](_0x23985a);return _0x8936d3[_0x9076('0x22')]('Content-Range',_0x2440d0+'-'+_0x2da783+'/'+_0x3e72c4)[_0x9076('0x1d')](_0x2bb884);}return null;};}function patchUpdates(_0x5e56ce){return function(_0x4daaf8){try{jsonpatch['apply'](_0x4daaf8,_0x5e56ce,!![]);}catch(_0x3089ec){return BPromise['reject'](_0x3089ec);}return _0x4daaf8['save']();};}function saveUpdates(_0x577e2f,_0x3c6ecb){return function(_0x6b053b){if(_0x6b053b){return _0x6b053b[_0x9076('0x23')](_0x577e2f)[_0x9076('0x24')](function(_0x2cc0ae){return _0x2cc0ae;});}return null;};}function removeEntity(_0x5722d8,_0x16b292){return function(_0xd0d150){if(_0xd0d150){return _0xd0d150[_0x9076('0x25')]()[_0x9076('0x24')](function(){var _0x11688a=_0xd0d150[_0x9076('0x26')]({'plain':!![]});var _0x2702c6='Companies';return db[_0x9076('0x27')]['destroy']({'where':{'type':_0x2702c6,'resourceId':_0x11688a['id']}})['then'](function(){return _0xd0d150;});})[_0x9076('0x24')](function(){_0x5722d8[_0x9076('0x1b')](0xcc)[_0x9076('0x1c')]();});}};}function handleEntityNotFound(_0x53e1c5,_0x5230c4){return function(_0x359758){if(!_0x359758){_0x53e1c5[_0x9076('0x1a')](0x194);}return _0x359758;};}function handleError(_0x2c69d0,_0x5c5ec1){_0x5c5ec1=_0x5c5ec1||0x1f4;return function(_0x5c99a3){logger['error'](_0x5c99a3[_0x9076('0x28')]);if(_0x5c99a3[_0x9076('0x29')]){delete _0x5c99a3[_0x9076('0x29')];}_0x2c69d0[_0x9076('0x1b')](_0x5c5ec1)['send'](_0x5c99a3);};}exports[_0x9076('0x2a')]=function(_0x46e9b1,_0x34b3c2){var _0x4e79e1={},_0x2232ff={},_0x57dfe1={'count':0x0,'rows':[]};return db['CmCompany'][_0x9076('0x2b')]()[_0x9076('0x24')](function(_0x2188a3){_0x2232ff[_0x9076('0x2c')]=_[_0x9076('0x2d')](_0x2188a3);_0x2232ff[_0x9076('0x2e')]=_[_0x9076('0x2d')](_0x46e9b1[_0x9076('0x2e')]);_0x2232ff[_0x9076('0x2f')]=_['intersection'](_0x2232ff[_0x9076('0x2c')],_0x2232ff[_0x9076('0x2e')]);_0x4e79e1['attributes']=_[_0x9076('0x30')](_0x2232ff[_0x9076('0x2c')],qs['fields'](_0x46e9b1['query'][_0x9076('0x31')]));_0x4e79e1[_0x9076('0x32')]=_0x4e79e1[_0x9076('0x32')][_0x9076('0x33')]?_0x4e79e1[_0x9076('0x32')]:_0x2232ff['model'];if(!_0x46e9b1['query']['hasOwnProperty'](_0x9076('0x34'))){_0x4e79e1['limit']=qs[_0x9076('0x20')](_0x46e9b1['query']['limit']);_0x4e79e1[_0x9076('0x1e')]=qs[_0x9076('0x1e')](_0x46e9b1[_0x9076('0x2e')][_0x9076('0x1e')]);}_0x4e79e1[_0x9076('0x35')]=qs[_0x9076('0x36')](_0x46e9b1['query'][_0x9076('0x36')]);_0x4e79e1[_0x9076('0x37')]=qs[_0x9076('0x2f')](_[_0x9076('0x38')](_0x46e9b1[_0x9076('0x2e')],_0x2232ff[_0x9076('0x2f')]),_0x2188a3);if(_0x46e9b1[_0x9076('0x2e')][_0x9076('0x39')]){_0x4e79e1[_0x9076('0x37')]=_['merge'](_0x4e79e1[_0x9076('0x37')],{'$or':_[_0x9076('0x3a')](_0x4e79e1[_0x9076('0x32')],function(_0x2526ad){var _0x2de19b={};_0x2de19b[_0x2526ad]={'$like':'%'+_0x46e9b1['query'][_0x9076('0x39')]+'%'};return _0x2de19b;})});}_0x4e79e1=_[_0x9076('0x3b')]({},_0x4e79e1,_0x46e9b1[_0x9076('0x3c')]);var _0x58ace9={'where':_0x4e79e1[_0x9076('0x37')]};return db[_0x9076('0x3d')][_0x9076('0x21')](_0x58ace9)[_0x9076('0x24')](function(_0x4a1b6a){_0x57dfe1['count']=_0x4a1b6a;if(_0x46e9b1[_0x9076('0x2e')]['includeAll']){_0x4e79e1['include']=[{'all':!![]}];}return db['CmCompany'][_0x9076('0x3e')](_0x4e79e1);})[_0x9076('0x24')](function(_0x2cd5ef){_0x57dfe1['rows']=_0x2cd5ef;return _0x57dfe1;})[_0x9076('0x24')](respondWithFilteredResult(_0x34b3c2,_0x4e79e1))[_0x9076('0x3f')](handleError(_0x34b3c2,null));})['catch'](handleError(_0x34b3c2,null));};exports[_0x9076('0x40')]=function(_0x5b866d,_0x589725){var _0x5329ce={'raw':![],'where':{'id':_0x5b866d[_0x9076('0x41')]['id']}},_0x395587={};_0x395587[_0x9076('0x2c')]=_[_0x9076('0x2d')](db[_0x9076('0x3d')]['rawAttributes']);_0x395587[_0x9076('0x2e')]=_[_0x9076('0x2d')](_0x5b866d[_0x9076('0x2e')]);_0x395587['filters']=_[_0x9076('0x30')](_0x395587[_0x9076('0x2c')],_0x395587[_0x9076('0x2e')]);_0x5329ce[_0x9076('0x32')]=_[_0x9076('0x30')](_0x395587[_0x9076('0x2c')],qs[_0x9076('0x31')](_0x5b866d[_0x9076('0x2e')][_0x9076('0x31')]));_0x5329ce[_0x9076('0x32')]=_0x5329ce[_0x9076('0x32')][_0x9076('0x33')]?_0x5329ce[_0x9076('0x32')]:_0x395587[_0x9076('0x2c')];if(_0x5b866d[_0x9076('0x2e')][_0x9076('0x42')]){_0x5329ce['include']=[{'all':!![]}];}_0x5329ce=_[_0x9076('0x3b')]({},_0x5329ce,_0x5b866d['options']);return db[_0x9076('0x3d')][_0x9076('0x43')](_0x5329ce)['then'](handleEntityNotFound(_0x589725,null))[_0x9076('0x24')](respondWithResult(_0x589725,null))[_0x9076('0x3f')](handleError(_0x589725,null));};exports[_0x9076('0x44')]=function(_0x2c14ba,_0x131ebb){return db[_0x9076('0x3d')]['create'](_0x2c14ba[_0x9076('0x45')],{})[_0x9076('0x24')](function(_0x5b9201){var _0xf717f5=_0x2c14ba[_0x9076('0x46')][_0x9076('0x26')]({'plain':!![]});if(!_0xf717f5)throw new Error(_0x9076('0x47'));if(_0xf717f5[_0x9076('0x48')]===_0x9076('0x46')){var _0x532ec7=_0x5b9201[_0x9076('0x26')]({'plain':!![]});var _0x1ec739=_0x9076('0x49');return db[_0x9076('0x4a')]['find']({'where':{'name':_0x1ec739,'userProfileId':_0xf717f5['userProfileId']},'raw':!![]})[_0x9076('0x24')](function(_0x54a3ad){if(_0x54a3ad&&_0x54a3ad['autoAssociation']===0x0){return db[_0x9076('0x27')][_0x9076('0x44')]({'name':_0x532ec7['name'],'resourceId':_0x532ec7['id'],'type':_0x54a3ad[_0x9076('0x29')],'sectionId':_0x54a3ad['id']},{})[_0x9076('0x24')](function(){return _0x5b9201;});}else{return _0x5b9201;}})[_0x9076('0x3f')](function(_0x43ff11){logger[_0x9076('0x4b')](_0x9076('0x4c'),_0x43ff11);throw _0x43ff11;});}return _0x5b9201;})[_0x9076('0x24')](respondWithResult(_0x131ebb,0xc9))[_0x9076('0x3f')](handleError(_0x131ebb,null));};exports[_0x9076('0x23')]=function(_0x5a79ab,_0x521788){if(_0x5a79ab[_0x9076('0x45')]['id']){delete _0x5a79ab['body']['id'];}return db[_0x9076('0x3d')][_0x9076('0x43')]({'where':{'id':_0x5a79ab[_0x9076('0x41')]['id']}})[_0x9076('0x24')](handleEntityNotFound(_0x521788,null))[_0x9076('0x24')](saveUpdates(_0x5a79ab['body'],null))['then'](respondWithResult(_0x521788,null))[_0x9076('0x3f')](handleError(_0x521788,null));};exports['destroy']=function(_0x49ef98,_0x1af5e2){return db[_0x9076('0x3d')][_0x9076('0x43')]({'where':{'id':_0x49ef98[_0x9076('0x41')]['id']}})['then'](handleEntityNotFound(_0x1af5e2,null))[_0x9076('0x24')](removeEntity(_0x1af5e2,null))['catch'](handleError(_0x1af5e2,null));};exports[_0x9076('0x2b')]=function(_0x1a2ca0,_0x4f5b02){return db['CmCompany']['describe']()['then'](respondWithResult(_0x4f5b02,null))['catch'](handleError(_0x4f5b02,null));};exports[_0x9076('0x4d')]=function(_0x48a386,_0x1ab38c,_0x26878b){return db[_0x9076('0x4e')]['find']({'where':{'id':_0x48a386[_0x9076('0x41')]['id']}})[_0x9076('0x24')](handleEntityNotFound(_0x1ab38c,null))[_0x9076('0x24')](function(_0x5b69cc){if(_0x5b69cc){return _0x5b69cc[_0x9076('0x4d')](_0x48a386[_0x9076('0x45')][_0x9076('0x4f')],_[_0x9076('0x50')](_0x48a386[_0x9076('0x45')],[_0x9076('0x4f'),'id'])||{});}})['then'](respondWithResult(_0x1ab38c,null))[_0x9076('0x3f')](handleError(_0x1ab38c,null));};exports[_0x9076('0x51')]=function(_0x2188e4,_0x3bc0dd,_0x590f77){var _0x1376a5={};var _0xd5260b={};var _0x5296d1;var _0x3f52d5;return db[_0x9076('0x3d')]['findOne']({'where':{'id':_0x2188e4[_0x9076('0x41')]['id']}})[_0x9076('0x24')](handleEntityNotFound(_0x3bc0dd,null))[_0x9076('0x24')](function(_0xd367af){if(_0xd367af){_0x5296d1=_0xd367af;_0xd5260b[_0x9076('0x2c')]=_[_0x9076('0x2d')](db['CmContact']['rawAttributes']);_0xd5260b[_0x9076('0x2e')]=_[_0x9076('0x2d')](_0x2188e4[_0x9076('0x2e')]);_0xd5260b[_0x9076('0x2f')]=_[_0x9076('0x30')](_0xd5260b[_0x9076('0x2c')],_0xd5260b[_0x9076('0x2e')]);_0x1376a5[_0x9076('0x32')]=_['intersection'](_0xd5260b[_0x9076('0x2c')],qs['fields'](_0x2188e4[_0x9076('0x2e')][_0x9076('0x31')]));_0x1376a5[_0x9076('0x32')]=_0x1376a5['attributes']['length']?_0x1376a5[_0x9076('0x32')]:_0xd5260b[_0x9076('0x2c')];_0x1376a5['order']=qs[_0x9076('0x36')](_0x2188e4['query'][_0x9076('0x36')]);_0x1376a5[_0x9076('0x37')]=qs[_0x9076('0x2f')](_[_0x9076('0x38')](_0x2188e4[_0x9076('0x2e')],_0xd5260b[_0x9076('0x2f')]));if(_0x2188e4[_0x9076('0x2e')][_0x9076('0x39')]){_0x1376a5['where']=_['merge'](_0x1376a5['where'],{'$or':_[_0x9076('0x3a')](_0x1376a5[_0x9076('0x32')],function(_0x533a84){var _0x126f21={};_0x126f21[_0x533a84]={'$like':'%'+_0x2188e4['query'][_0x9076('0x39')]+'%'};return _0x126f21;})});}_0x1376a5=_[_0x9076('0x3b')]({},_0x1376a5,_0x2188e4[_0x9076('0x3c')]);return _0x5296d1['getContacts'](_0x1376a5);}})[_0x9076('0x24')](function(_0x215742){if(_0x215742){_0x3f52d5=_0x215742['length'];if(!_0x2188e4['query'][_0x9076('0x52')]('nolimit')){_0x1376a5[_0x9076('0x20')]=qs[_0x9076('0x20')](_0x2188e4[_0x9076('0x2e')][_0x9076('0x20')]);_0x1376a5[_0x9076('0x1e')]=qs['offset'](_0x2188e4[_0x9076('0x2e')]['offset']);}return _0x5296d1[_0x9076('0x51')](_0x1376a5);}})[_0x9076('0x24')](function(_0x3bf269){if(_0x3bf269){return _0x3bf269?{'count':_0x3f52d5,'rows':_0x3bf269}:null;}})[_0x9076('0x24')](respondWithResult(_0x3bc0dd,null))[_0x9076('0x3f')](handleError(_0x3bc0dd,null));}; \ No newline at end of file +var _0x3c0d=['to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','destroy','get','UserProfileResource','then','error','stack','name','index','CmCompany','describe','model','keys','query','intersection','attributes','fields','length','nolimit','sort','filters','filter','merge','where','map','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Companies','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','CmContact','ids','order','pick','getContacts','hasOwnProperty','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0xd26750,_0x2c1103){var _0x3e310b=function(_0x28ae2b){while(--_0x28ae2b){_0xd26750['push'](_0xd26750['shift']());}};_0x3e310b(++_0x2c1103);}(_0x3c0d,0x149));var _0xd3c0=function(_0x220b7e,_0x2eed81){_0x220b7e=_0x220b7e-0x0;var _0x4ac073=_0x3c0d[_0x220b7e];return _0x4ac073;};'use strict';var emlformat=require(_0xd3c0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd3c0('0x1'));var jsonpatch=require(_0xd3c0('0x2'));var rp=require(_0xd3c0('0x3'));var moment=require('moment');var BPromise=require(_0xd3c0('0x4'));var Mustache=require(_0xd3c0('0x5'));var util=require(_0xd3c0('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xd3c0('0x7'));var ejs=require(_0xd3c0('0x8'));var fs=require('fs');var fs_extra=require(_0xd3c0('0x9'));var _=require('lodash');var squel=require(_0xd3c0('0xa'));var crypto=require(_0xd3c0('0xb'));var jsforce=require(_0xd3c0('0xc'));var deskjs=require(_0xd3c0('0xd'));var toCsv=require(_0xd3c0('0x7'));var querystring=require(_0xd3c0('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd3c0('0xf'));var qs=require(_0xd3c0('0x10'));var as=require(_0xd3c0('0x11'));var hardwareService=require(_0xd3c0('0x12'));var logger=require('../../config/logger')(_0xd3c0('0x13'));var utils=require('../../config/utils');var config=require(_0xd3c0('0x14'));var licenseUtil=require(_0xd3c0('0x15'));var db=require(_0xd3c0('0x16'))['db'];function respondWithStatusCode(_0x52043f,_0x286379){_0x286379=_0x286379||0xcc;return function(_0x3df5c8){if(_0x3df5c8){return _0x52043f[_0xd3c0('0x17')](_0x286379);}return _0x52043f[_0xd3c0('0x18')](_0x286379)[_0xd3c0('0x19')]();};}function respondWithResult(_0x274b98,_0x1a6e53){_0x1a6e53=_0x1a6e53||0xc8;return function(_0xd2bf53){if(_0xd2bf53){return _0x274b98[_0xd3c0('0x18')](_0x1a6e53)[_0xd3c0('0x1a')](_0xd2bf53);}};}function respondWithFilteredResult(_0x458dc4,_0x49f6ab){return function(_0x451235){if(_0x451235){var _0x4fa7d4=typeof _0x49f6ab['offset']===_0xd3c0('0x1b')&&typeof _0x49f6ab[_0xd3c0('0x1c')]===_0xd3c0('0x1b');var _0x567efe=_0x451235[_0xd3c0('0x1d')];var _0x5b09a0=_0x4fa7d4?0x0:_0x49f6ab[_0xd3c0('0x1e')];var _0x3fd7c9=_0x4fa7d4?_0x451235[_0xd3c0('0x1d')]:_0x49f6ab['offset']+_0x49f6ab[_0xd3c0('0x1c')];var _0x486142;if(_0x3fd7c9>=_0x567efe){_0x3fd7c9=_0x567efe;_0x486142=0xc8;}else{_0x486142=0xce;}_0x458dc4['status'](_0x486142);return _0x458dc4[_0xd3c0('0x1f')]('Content-Range',_0x5b09a0+'-'+_0x3fd7c9+'/'+_0x567efe)['json'](_0x451235);}return null;};}function patchUpdates(_0x219592){return function(_0x4d74b8){try{jsonpatch[_0xd3c0('0x20')](_0x4d74b8,_0x219592,!![]);}catch(_0x54a11d){return BPromise[_0xd3c0('0x21')](_0x54a11d);}return _0x4d74b8[_0xd3c0('0x22')]();};}function saveUpdates(_0x3264bd,_0x89c3c2){return function(_0x526b00){if(_0x526b00){return _0x526b00['update'](_0x3264bd)['then'](function(_0x4546fd){return _0x4546fd;});}return null;};}function removeEntity(_0x45b12f,_0x3246da){return function(_0x4653b3){if(_0x4653b3){return _0x4653b3[_0xd3c0('0x23')]()['then'](function(){var _0x4ea830=_0x4653b3[_0xd3c0('0x24')]({'plain':!![]});var _0xa1136e='Companies';return db[_0xd3c0('0x25')][_0xd3c0('0x23')]({'where':{'type':_0xa1136e,'resourceId':_0x4ea830['id']}})[_0xd3c0('0x26')](function(){return _0x4653b3;});})[_0xd3c0('0x26')](function(){_0x45b12f[_0xd3c0('0x18')](0xcc)[_0xd3c0('0x19')]();});}};}function handleEntityNotFound(_0x515f0a,_0x2fb3e8){return function(_0x484f5a){if(!_0x484f5a){_0x515f0a[_0xd3c0('0x17')](0x194);}return _0x484f5a;};}function handleError(_0x185370,_0x4031e6){_0x4031e6=_0x4031e6||0x1f4;return function(_0x525c72){logger[_0xd3c0('0x27')](_0x525c72[_0xd3c0('0x28')]);if(_0x525c72[_0xd3c0('0x29')]){delete _0x525c72[_0xd3c0('0x29')];}_0x185370[_0xd3c0('0x18')](_0x4031e6)['send'](_0x525c72);};}exports[_0xd3c0('0x2a')]=function(_0x2b92ca,_0x3dbbc1){var _0x4e1117={},_0x124228={},_0xeaf45d={'count':0x0,'rows':[]};return db[_0xd3c0('0x2b')][_0xd3c0('0x2c')]()[_0xd3c0('0x26')](function(_0x5500ca){_0x124228[_0xd3c0('0x2d')]=_[_0xd3c0('0x2e')](_0x5500ca);_0x124228[_0xd3c0('0x2f')]=_[_0xd3c0('0x2e')](_0x2b92ca[_0xd3c0('0x2f')]);_0x124228['filters']=_[_0xd3c0('0x30')](_0x124228[_0xd3c0('0x2d')],_0x124228[_0xd3c0('0x2f')]);_0x4e1117[_0xd3c0('0x31')]=_[_0xd3c0('0x30')](_0x124228[_0xd3c0('0x2d')],qs[_0xd3c0('0x32')](_0x2b92ca[_0xd3c0('0x2f')][_0xd3c0('0x32')]));_0x4e1117[_0xd3c0('0x31')]=_0x4e1117['attributes'][_0xd3c0('0x33')]?_0x4e1117[_0xd3c0('0x31')]:_0x124228[_0xd3c0('0x2d')];if(!_0x2b92ca[_0xd3c0('0x2f')]['hasOwnProperty'](_0xd3c0('0x34'))){_0x4e1117['limit']=qs['limit'](_0x2b92ca[_0xd3c0('0x2f')][_0xd3c0('0x1c')]);_0x4e1117[_0xd3c0('0x1e')]=qs['offset'](_0x2b92ca[_0xd3c0('0x2f')][_0xd3c0('0x1e')]);}_0x4e1117['order']=qs[_0xd3c0('0x35')](_0x2b92ca['query'][_0xd3c0('0x35')]);_0x4e1117['where']=qs[_0xd3c0('0x36')](_['pick'](_0x2b92ca[_0xd3c0('0x2f')],_0x124228[_0xd3c0('0x36')]),_0x5500ca);if(_0x2b92ca[_0xd3c0('0x2f')][_0xd3c0('0x37')]){_0x4e1117['where']=_[_0xd3c0('0x38')](_0x4e1117[_0xd3c0('0x39')],{'$or':_[_0xd3c0('0x3a')](_0x4e1117[_0xd3c0('0x31')],function(_0x129261){var _0x3818cc={};_0x3818cc[_0x129261]={'$like':'%'+_0x2b92ca[_0xd3c0('0x2f')]['filter']+'%'};return _0x3818cc;})});}_0x4e1117=_[_0xd3c0('0x38')]({},_0x4e1117,_0x2b92ca[_0xd3c0('0x3b')]);var _0x4738f2={'where':_0x4e1117[_0xd3c0('0x39')]};return db[_0xd3c0('0x2b')][_0xd3c0('0x1d')](_0x4738f2)[_0xd3c0('0x26')](function(_0x337fba){_0xeaf45d['count']=_0x337fba;if(_0x2b92ca['query'][_0xd3c0('0x3c')]){_0x4e1117[_0xd3c0('0x3d')]=[{'all':!![]}];}return db['CmCompany'][_0xd3c0('0x3e')](_0x4e1117);})[_0xd3c0('0x26')](function(_0x34b251){_0xeaf45d['rows']=_0x34b251;return _0xeaf45d;})[_0xd3c0('0x26')](respondWithFilteredResult(_0x3dbbc1,_0x4e1117))[_0xd3c0('0x3f')](handleError(_0x3dbbc1,null));})['catch'](handleError(_0x3dbbc1,null));};exports[_0xd3c0('0x40')]=function(_0x2f6dc6,_0xc846db){var _0x44af89={'raw':![],'where':{'id':_0x2f6dc6[_0xd3c0('0x41')]['id']}},_0x5a2944={};_0x5a2944[_0xd3c0('0x2d')]=_['keys'](db[_0xd3c0('0x2b')][_0xd3c0('0x42')]);_0x5a2944[_0xd3c0('0x2f')]=_[_0xd3c0('0x2e')](_0x2f6dc6['query']);_0x5a2944[_0xd3c0('0x36')]=_[_0xd3c0('0x30')](_0x5a2944[_0xd3c0('0x2d')],_0x5a2944[_0xd3c0('0x2f')]);_0x44af89[_0xd3c0('0x31')]=_[_0xd3c0('0x30')](_0x5a2944[_0xd3c0('0x2d')],qs[_0xd3c0('0x32')](_0x2f6dc6['query'][_0xd3c0('0x32')]));_0x44af89[_0xd3c0('0x31')]=_0x44af89[_0xd3c0('0x31')][_0xd3c0('0x33')]?_0x44af89[_0xd3c0('0x31')]:_0x5a2944[_0xd3c0('0x2d')];if(_0x2f6dc6[_0xd3c0('0x2f')][_0xd3c0('0x3c')]){_0x44af89[_0xd3c0('0x3d')]=[{'all':!![]}];}_0x44af89=_[_0xd3c0('0x38')]({},_0x44af89,_0x2f6dc6[_0xd3c0('0x3b')]);return db['CmCompany'][_0xd3c0('0x43')](_0x44af89)[_0xd3c0('0x26')](handleEntityNotFound(_0xc846db,null))[_0xd3c0('0x26')](respondWithResult(_0xc846db,null))[_0xd3c0('0x3f')](handleError(_0xc846db,null));};exports[_0xd3c0('0x44')]=function(_0x18b1cd,_0x517494){return db['CmCompany']['create'](_0x18b1cd[_0xd3c0('0x45')],{})[_0xd3c0('0x26')](function(_0x54294b){var _0x287db3=_0x18b1cd[_0xd3c0('0x46')][_0xd3c0('0x24')]({'plain':!![]});if(!_0x287db3)throw new Error(_0xd3c0('0x47'));if(_0x287db3[_0xd3c0('0x48')]==='user'){var _0x4b0440=_0x54294b[_0xd3c0('0x24')]({'plain':!![]});var _0x2c64bd=_0xd3c0('0x49');return db[_0xd3c0('0x4a')][_0xd3c0('0x43')]({'where':{'name':_0x2c64bd,'userProfileId':_0x287db3['userProfileId']},'raw':!![]})[_0xd3c0('0x26')](function(_0x32dec3){if(_0x32dec3&&_0x32dec3[_0xd3c0('0x4b')]===0x0){return db[_0xd3c0('0x25')]['create']({'name':_0x4b0440[_0xd3c0('0x29')],'resourceId':_0x4b0440['id'],'type':_0x32dec3['name'],'sectionId':_0x32dec3['id']},{})[_0xd3c0('0x26')](function(){return _0x54294b;});}else{return _0x54294b;}})[_0xd3c0('0x3f')](function(_0x1d565d){logger[_0xd3c0('0x27')](_0xd3c0('0x4c'),_0x1d565d);throw _0x1d565d;});}return _0x54294b;})[_0xd3c0('0x26')](respondWithResult(_0x517494,0xc9))[_0xd3c0('0x3f')](handleError(_0x517494,null));};exports['update']=function(_0x241bbf,_0x3ea555){if(_0x241bbf['body']['id']){delete _0x241bbf[_0xd3c0('0x45')]['id'];}return db[_0xd3c0('0x2b')][_0xd3c0('0x43')]({'where':{'id':_0x241bbf[_0xd3c0('0x41')]['id']}})['then'](handleEntityNotFound(_0x3ea555,null))['then'](saveUpdates(_0x241bbf[_0xd3c0('0x45')],null))[_0xd3c0('0x26')](respondWithResult(_0x3ea555,null))[_0xd3c0('0x3f')](handleError(_0x3ea555,null));};exports[_0xd3c0('0x23')]=function(_0xd88da4,_0x55e3ae){return db[_0xd3c0('0x2b')][_0xd3c0('0x43')]({'where':{'id':_0xd88da4[_0xd3c0('0x41')]['id']}})[_0xd3c0('0x26')](handleEntityNotFound(_0x55e3ae,null))[_0xd3c0('0x26')](removeEntity(_0x55e3ae,null))[_0xd3c0('0x3f')](handleError(_0x55e3ae,null));};exports[_0xd3c0('0x2c')]=function(_0x2c5ef0,_0x3eeb34){return db[_0xd3c0('0x2b')][_0xd3c0('0x2c')]()[_0xd3c0('0x26')](respondWithResult(_0x3eeb34,null))[_0xd3c0('0x3f')](handleError(_0x3eeb34,null));};exports[_0xd3c0('0x4d')]=function(_0xc9088a,_0x5ba47d,_0x50787a){return db[_0xd3c0('0x4e')]['find']({'where':{'id':_0xc9088a[_0xd3c0('0x41')]['id']}})[_0xd3c0('0x26')](handleEntityNotFound(_0x5ba47d,null))['then'](function(_0x707f07){if(_0x707f07){return _0x707f07[_0xd3c0('0x4d')](_0xc9088a[_0xd3c0('0x45')][_0xd3c0('0x4f')],_['omit'](_0xc9088a[_0xd3c0('0x45')],[_0xd3c0('0x4f'),'id'])||{});}})[_0xd3c0('0x26')](respondWithResult(_0x5ba47d,null))[_0xd3c0('0x3f')](handleError(_0x5ba47d,null));};exports['getContacts']=function(_0x3fd934,_0x2aaa7d,_0x3d9375){var _0x24cdd4={};var _0x16f027={};var _0x44319d;var _0x187e9b;return db[_0xd3c0('0x2b')]['findOne']({'where':{'id':_0x3fd934['params']['id']}})[_0xd3c0('0x26')](handleEntityNotFound(_0x2aaa7d,null))['then'](function(_0x1dfdd3){if(_0x1dfdd3){_0x44319d=_0x1dfdd3;_0x16f027[_0xd3c0('0x2d')]=_['keys'](db[_0xd3c0('0x4e')]['rawAttributes']);_0x16f027['query']=_[_0xd3c0('0x2e')](_0x3fd934['query']);_0x16f027['filters']=_[_0xd3c0('0x30')](_0x16f027['model'],_0x16f027['query']);_0x24cdd4[_0xd3c0('0x31')]=_['intersection'](_0x16f027[_0xd3c0('0x2d')],qs[_0xd3c0('0x32')](_0x3fd934[_0xd3c0('0x2f')][_0xd3c0('0x32')]));_0x24cdd4['attributes']=_0x24cdd4['attributes'][_0xd3c0('0x33')]?_0x24cdd4[_0xd3c0('0x31')]:_0x16f027[_0xd3c0('0x2d')];_0x24cdd4[_0xd3c0('0x50')]=qs[_0xd3c0('0x35')](_0x3fd934['query'][_0xd3c0('0x35')]);_0x24cdd4['where']=qs[_0xd3c0('0x36')](_[_0xd3c0('0x51')](_0x3fd934['query'],_0x16f027[_0xd3c0('0x36')]));if(_0x3fd934[_0xd3c0('0x2f')][_0xd3c0('0x37')]){_0x24cdd4[_0xd3c0('0x39')]=_[_0xd3c0('0x38')](_0x24cdd4[_0xd3c0('0x39')],{'$or':_[_0xd3c0('0x3a')](_0x24cdd4[_0xd3c0('0x31')],function(_0x2f6d79){var _0x3cbf1c={};_0x3cbf1c[_0x2f6d79]={'$like':'%'+_0x3fd934['query'][_0xd3c0('0x37')]+'%'};return _0x3cbf1c;})});}_0x24cdd4=_[_0xd3c0('0x38')]({},_0x24cdd4,_0x3fd934[_0xd3c0('0x3b')]);return _0x44319d[_0xd3c0('0x52')](_0x24cdd4);}})[_0xd3c0('0x26')](function(_0x45d558){if(_0x45d558){_0x187e9b=_0x45d558[_0xd3c0('0x33')];if(!_0x3fd934[_0xd3c0('0x2f')][_0xd3c0('0x53')]('nolimit')){_0x24cdd4[_0xd3c0('0x1c')]=qs[_0xd3c0('0x1c')](_0x3fd934[_0xd3c0('0x2f')][_0xd3c0('0x1c')]);_0x24cdd4['offset']=qs[_0xd3c0('0x1e')](_0x3fd934[_0xd3c0('0x2f')][_0xd3c0('0x1e')]);}return _0x44319d[_0xd3c0('0x52')](_0x24cdd4);}})[_0xd3c0('0x26')](function(_0x4136de){if(_0x4136de){return _0x4136de?{'count':_0x187e9b,'rows':_0x4136de}:null;}})['then'](respondWithResult(_0x2aaa7d,null))['catch'](handleError(_0x2aaa7d,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 276d15f..d5782d5 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 _0xf39c=['bluebird','request-promise','rimraf','./cmCompany.attributes','exports','lodash','util','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf39c,0x165));var _0xcf39=function(_0x528941,_0x2f50ed){_0x528941=_0x528941-0x0;var _0xbfd8f9=_0xf39c[_0x528941];return _0xbfd8f9;};'use strict';var _=require(_0xcf39('0x0'));var util=require(_0xcf39('0x1'));var logger=require('../../config/logger')(_0xcf39('0x2'));var moment=require('moment');var BPromise=require(_0xcf39('0x3'));var rp=require(_0xcf39('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcf39('0x5'));var config=require('../../config/environment');var attributes=require(_0xcf39('0x6'));module[_0xcf39('0x7')]=function(_0x180c7a,_0x25cd47){return _0x180c7a['define']('CmCompany',attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x828f=['../../config/environment','./cmCompany.attributes','exports','define','CmCompany','cm_companies','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x237398,_0xc0ef22){var _0x5598de=function(_0x3118fa){while(--_0x3118fa){_0x237398['push'](_0x237398['shift']());}};_0x5598de(++_0xc0ef22);}(_0x828f,0x164));var _0xf828=function(_0x5ddaac,_0x2697a8){_0x5ddaac=_0x5ddaac-0x0;var _0x2a9c58=_0x828f[_0x5ddaac];return _0x2a9c58;};'use strict';var _=require(_0xf828('0x0'));var util=require(_0xf828('0x1'));var logger=require('../../config/logger')(_0xf828('0x2'));var moment=require(_0xf828('0x3'));var BPromise=require(_0xf828('0x4'));var rp=require(_0xf828('0x5'));var fs=require('fs');var path=require(_0xf828('0x6'));var rimraf=require(_0xf828('0x7'));var config=require(_0xf828('0x8'));var attributes=require(_0xf828('0x9'));module[_0xf828('0xa')]=function(_0x3c539b,_0x6c62e2){return _0x3c539b[_0xf828('0xb')](_0xf828('0xc'),attributes,{'tableName':_0xf828('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 675a770..263157a 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 _0x4cc5=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCompany,\x20%s,\x20%s','message','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4cc5,0x120));var _0x54cc=function(_0x1915b9,_0x4929bc){_0x1915b9=_0x1915b9-0x0;var _0x2b6658=_0x4cc5[_0x1915b9];return _0x2b6658;};'use strict';var _=require(_0x54cc('0x0'));var util=require(_0x54cc('0x1'));var moment=require(_0x54cc('0x2'));var BPromise=require(_0x54cc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x54cc('0x4'));var db=require(_0x54cc('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x54cc('0x6'))('rpc');var config=require(_0x54cc('0x7'));var jayson=require(_0x54cc('0x8'));var client=jayson[_0x54cc('0x9')][_0x54cc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2fdd4a,_0x172bf1,_0x28e0ea){return new BPromise(function(_0x5261b1,_0x564cc8){return client[_0x54cc('0xb')](_0x2fdd4a,_0x28e0ea)[_0x54cc('0xc')](function(_0x1e3944){logger[_0x54cc('0xd')]('CmCompany,\x20%s,\x20%s',_0x172bf1,_0x54cc('0xe'));logger['debug'](_0x54cc('0xf'),_0x172bf1,_0x54cc('0xe'),JSON[_0x54cc('0x10')](_0x1e3944));if(_0x1e3944['error']){if(_0x1e3944[_0x54cc('0x11')][_0x54cc('0x12')]===0x1f4){logger[_0x54cc('0x11')](_0x54cc('0x13'),_0x172bf1,_0x1e3944['error'][_0x54cc('0x14')]);return _0x564cc8(_0x1e3944[_0x54cc('0x11')][_0x54cc('0x14')]);}logger[_0x54cc('0x11')](_0x54cc('0x13'),_0x172bf1,_0x1e3944['error']['message']);return _0x5261b1(_0x1e3944[_0x54cc('0x11')][_0x54cc('0x14')]);}else{logger[_0x54cc('0xd')](_0x54cc('0x13'),_0x172bf1,_0x54cc('0xe'));_0x5261b1(_0x1e3944['result'][_0x54cc('0x14')]);}})['catch'](function(_0x494a9f){logger[_0x54cc('0x11')](_0x54cc('0x13'),_0x172bf1,_0x494a9f);_0x564cc8(_0x494a9f);});});} \ No newline at end of file +var _0x95b0=['client','request','then','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3579ad,_0x31c43d){var _0x33bcad=function(_0x443171){while(--_0x443171){_0x3579ad['push'](_0x3579ad['shift']());}};_0x33bcad(++_0x31c43d);}(_0x95b0,0xbc));var _0x095b=function(_0x545acc,_0x3d188a){_0x545acc=_0x545acc-0x0;var _0x5b5e30=_0x95b0[_0x545acc];return _0x5b5e30;};'use strict';var _=require(_0x095b('0x0'));var util=require(_0x095b('0x1'));var moment=require(_0x095b('0x2'));var BPromise=require(_0x095b('0x3'));var rs=require(_0x095b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x095b('0x5'))['db'];var utils=require(_0x095b('0x6'));var logger=require(_0x095b('0x7'))(_0x095b('0x8'));var config=require(_0x095b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x095b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f3545,_0x4f130d,_0x155354){return new BPromise(function(_0x2890c1,_0x227bd7){return client[_0x095b('0xb')](_0x2f3545,_0x155354)[_0x095b('0xc')](function(_0xab6b1a){logger['info'](_0x095b('0xd'),_0x4f130d,_0x095b('0xe'));logger[_0x095b('0xf')](_0x095b('0x10'),_0x4f130d,_0x095b('0xe'),JSON['stringify'](_0xab6b1a));if(_0xab6b1a['error']){if(_0xab6b1a[_0x095b('0x11')][_0x095b('0x12')]===0x1f4){logger[_0x095b('0x11')](_0x095b('0xd'),_0x4f130d,_0xab6b1a[_0x095b('0x11')][_0x095b('0x13')]);return _0x227bd7(_0xab6b1a[_0x095b('0x11')]['message']);}logger['error']('CmCompany,\x20%s,\x20%s',_0x4f130d,_0xab6b1a[_0x095b('0x11')]['message']);return _0x2890c1(_0xab6b1a[_0x095b('0x11')]['message']);}else{logger[_0x095b('0x14')](_0x095b('0xd'),_0x4f130d,'request\x20sent');_0x2890c1(_0xab6b1a['result']['message']);}})[_0x095b('0x15')](function(_0x44c9d8){logger[_0x095b('0x11')](_0x095b('0xd'),_0x4f130d,_0x44c9d8);_0x227bd7(_0x44c9d8);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 918e749..f557864 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 _0x3760=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/contacts','getContacts','addContacts','put','update','delete','exports','multer','path','connect-timeout'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0x3760,0x81));var _0x0376=function(_0x48a96f,_0x530059){_0x48a96f=_0x48a96f-0x0;var _0x3ff3ef=_0x3760[_0x48a96f];return _0x3ff3ef;};'use strict';var multer=require(_0x0376('0x0'));var util=require('util');var path=require(_0x0376('0x1'));var timeout=require(_0x0376('0x2'));var express=require(_0x0376('0x3'));var router=express['Router']();var fs_extra=require(_0x0376('0x4'));var auth=require(_0x0376('0x5'));var interaction=require(_0x0376('0x6'));var config=require(_0x0376('0x7'));var controller=require(_0x0376('0x8'));router[_0x0376('0x9')]('/',auth[_0x0376('0xa')](),controller[_0x0376('0xb')]);router[_0x0376('0x9')](_0x0376('0xc'),auth['isAuthenticated'](),controller[_0x0376('0xd')]);router['get'](_0x0376('0xe'),auth[_0x0376('0xa')](),controller['show']);router[_0x0376('0x9')](_0x0376('0xf'),auth[_0x0376('0xa')](),controller[_0x0376('0x10')]);router['post']('/',auth[_0x0376('0xa')](),controller['create']);router['post'](_0x0376('0xf'),auth['isAuthenticated'](),controller[_0x0376('0x11')]);router[_0x0376('0x12')](_0x0376('0xe'),auth['isAuthenticated'](),controller[_0x0376('0x13')]);router[_0x0376('0x14')](_0x0376('0xe'),auth[_0x0376('0xa')](),controller['destroy']);module[_0x0376('0x15')]=router; \ No newline at end of file +var _0x0fb4=['update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','describe','/:id','show','/:id/contacts','post','create','addContacts'];(function(_0x56f56d,_0x366e03){var _0x16d690=function(_0x3e99d5){while(--_0x3e99d5){_0x56f56d['push'](_0x56f56d['shift']());}};_0x16d690(++_0x366e03);}(_0x0fb4,0x17e));var _0x40fb=function(_0x3c6ae2,_0x5c52d8){_0x3c6ae2=_0x3c6ae2-0x0;var _0x4edda=_0x0fb4[_0x3c6ae2];return _0x4edda;};'use strict';var multer=require(_0x40fb('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x40fb('0x1'));var express=require(_0x40fb('0x2'));var router=express[_0x40fb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x40fb('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x40fb('0x5'));var controller=require(_0x40fb('0x6'));router[_0x40fb('0x7')]('/',auth[_0x40fb('0x8')](),controller[_0x40fb('0x9')]);router[_0x40fb('0x7')]('/describe',auth[_0x40fb('0x8')](),controller[_0x40fb('0xa')]);router['get'](_0x40fb('0xb'),auth[_0x40fb('0x8')](),controller[_0x40fb('0xc')]);router['get'](_0x40fb('0xd'),auth[_0x40fb('0x8')](),controller['getContacts']);router[_0x40fb('0xe')]('/',auth[_0x40fb('0x8')](),controller[_0x40fb('0xf')]);router['post']('/:id/contacts',auth[_0x40fb('0x8')](),controller[_0x40fb('0x10')]);router['put'](_0x40fb('0xb'),auth[_0x40fb('0x8')](),controller[_0x40fb('0x11')]);router[_0x40fb('0x12')](_0x40fb('0xb'),auth['isAuthenticated'](),controller[_0x40fb('0x13')]);module[_0x40fb('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index cf1f892..6a58e0e 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 _0x01eb=['DATE','NOW','lodash','sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x01eb,0x1e8));var _0xb01e=function(_0x52b7a2,_0x5458c3){_0x52b7a2=_0x52b7a2-0x0;var _0xa34627=_0x01eb[_0x52b7a2];return _0xa34627;};'use strict';var _=require(_0xb01e('0x0'));var Sequelize=require(_0xb01e('0x1'));module[_0xb01e('0x2')]={'firstName':{'type':Sequelize[_0xb01e('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0xb01e('0x3')]},'street':{'type':Sequelize[_0xb01e('0x3')]},'postalCode':{'type':Sequelize[_0xb01e('0x3')]},'city':{'type':Sequelize[_0xb01e('0x3')]},'country':{'type':Sequelize[_0xb01e('0x3')]},'dateOfBirth':{'type':Sequelize[_0xb01e('0x3')]},'description':{'type':Sequelize[_0xb01e('0x4')]},'phone':{'type':Sequelize[_0xb01e('0x3')]},'mobile':{'type':Sequelize[_0xb01e('0x3')]},'fax':{'type':Sequelize[_0xb01e('0x3')]},'email':{'type':Sequelize[_0xb01e('0x3')]},'url':{'type':Sequelize[_0xb01e('0x3')]},'facebook':{'type':Sequelize[_0xb01e('0x3')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0xb01e('0x3')]},'skype':{'type':Sequelize[_0xb01e('0x3')]},'teams':{'type':Sequelize[_0xb01e('0x3')]},'viber':{'type':Sequelize[_0xb01e('0x3')]},'line':{'type':Sequelize[_0xb01e('0x3')]},'wechat':{'type':Sequelize[_0xb01e('0x3')]},'telegram':{'type':Sequelize[_0xb01e('0x3')]},'UserId':{'type':Sequelize['INTEGER']},'priority':{'type':Sequelize[_0xb01e('0x5')](0x2)[_0xb01e('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xb01e('0x7')],'defaultValue':Sequelize[_0xb01e('0x8')]}}; \ No newline at end of file +var _0xe3ff=['UNSIGNED','NOW','lodash','sequelize','exports','STRING','TEXT','INTEGER'];(function(_0x4b9b90,_0x148e57){var _0x137e8d=function(_0x97a4d4){while(--_0x97a4d4){_0x4b9b90['push'](_0x4b9b90['shift']());}};_0x137e8d(++_0x148e57);}(_0xe3ff,0x142));var _0xfe3f=function(_0x48447c,_0x2cd985){_0x48447c=_0x48447c-0x0;var _0x7a4cfd=_0xe3ff[_0x48447c];return _0x7a4cfd;};'use strict';var _=require(_0xfe3f('0x0'));var Sequelize=require(_0xfe3f('0x1'));module[_0xfe3f('0x2')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0xfe3f('0x3')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xfe3f('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xfe3f('0x3')]},'dateOfBirth':{'type':Sequelize[_0xfe3f('0x3')]},'description':{'type':Sequelize[_0xfe3f('0x4')]},'phone':{'type':Sequelize[_0xfe3f('0x3')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xfe3f('0x3')]},'email':{'type':Sequelize[_0xfe3f('0x3')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0xfe3f('0x3')]},'fb_data':{'type':Sequelize[_0xfe3f('0x3')]},'twitter':{'type':Sequelize[_0xfe3f('0x3')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0xfe3f('0x3')]},'viber':{'type':Sequelize[_0xfe3f('0x3')]},'line':{'type':Sequelize[_0xfe3f('0x3')]},'wechat':{'type':Sequelize[_0xfe3f('0x3')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0xfe3f('0x5')]},'priority':{'type':Sequelize[_0xfe3f('0x5')](0x2)[_0xfe3f('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0xfe3f('0x7')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 52fa248..6f54f06 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 _0x457f=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','CmContact','keys','startsWith','push','CmCustomField','cf_','all','length','fieldType','type','model','query','intersection','fields','attributes','nolimit','sort','where','filters','pick','select','field','color','from','cm_contacts','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','left_join','tools_tags','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','sqlOperator','conditions','find','Tag','split','forEach','User','and','uc.UserId\x20=\x20?','dateOfBirth','datetime','castTo','DATE','buildExpression','text','value','start','map','hasOwnProperty','filter','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','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','c.id','Sequelize','QueryTypes','clone','order','DESC','having','t.id\x20IN\x20?','resolve','role','agent','some','user','getLists','c.ListId\x20IS\x20NULL','toString','sequelize','keyBy','merge','c.firstName','c.phone','c.mobile','c.fax','c.ListId','c.createdAt','c.deletedAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','rows','params','catch','describe','tags','columnName','displayName','findAll','alias','custom','values','body','get','mergeWith','info','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','create','join','bulkCreate','each','duplicates','$or','findOrCreate','spread','error','show','$and','omit','cf_%d','pickBy','format','table','setFields','id\x20=\x20?','phone','getTags','findOne','rawAttributes','options','setTags','getHoppers','ContactId','includeAll','include','getHopperHistories','getHopperFinals','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','root','server/files/tmp','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','pid','upload','file','meta','import','binding','No\x20firstName\x20column\x20specified','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','chat','sms','fax','whatsapp','voice','-createdAt','channel','includes','toLowerCase','Invalid\x20channel','parse','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','destination','callerid','starttime','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','VoiceCallReport','findAndCountAll','startCase','Website','closed','closedAt','disposition','secondDisposition','thirdDisposition','key','browserName','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingType','ratingValue','referer','subject','substatus','openchannel','externalUrl','threadId','Owner','flatten','sortBy','reverse','slice','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','lodash','squel','desk.js','querystring','papaparse'];(function(_0x1b0f40,_0x5ec41b){var _0xfc7db4=function(_0x22dc93){while(--_0x22dc93){_0x1b0f40['push'](_0x1b0f40['shift']());}};_0xfc7db4(++_0x5ec41b);}(_0x457f,0x129));var _0xf457=function(_0x3a827d,_0x28fad4){_0x3a827d=_0x3a827d-0x0;var _0x3571c0=_0x457f[_0x3a827d];return _0x3571c0;};'use strict';var emlformat=require(_0xf457('0x0'));var rimraf=require(_0xf457('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf457('0x2'));var rp=require(_0xf457('0x3'));var moment=require(_0xf457('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf457('0x5'));var path=require(_0xf457('0x6'));var sox=require(_0xf457('0x7'));var csv=require(_0xf457('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf457('0x9'));var squel=require(_0xf457('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf457('0xb'));var toCsv=require(_0xf457('0x8'));var querystring=require(_0xf457('0xc'));var Papa=require(_0xf457('0xd'));var Redis=require('ioredis');var authService=require(_0xf457('0xe'));var qs=require(_0xf457('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf457('0x10'));var logger=require(_0xf457('0x11'))(_0xf457('0x12'));var utils=require('../../config/utils');var config=require(_0xf457('0x13'));var licenseUtil=require(_0xf457('0x14'));var db=require(_0xf457('0x15'))['db'];config[_0xf457('0x16')]=_[_0xf457('0x17')](config[_0xf457('0x16')],{'host':_0xf457('0x18'),'port':0x18eb});var socket=require(_0xf457('0x19'))(new Redis(config[_0xf457('0x16')]));require(_0xf457('0x1a'))[_0xf457('0x1b')](socket);function respondWithStatusCode(_0x17fd80,_0x496bb8){_0x496bb8=_0x496bb8||0xcc;return function(_0xc9575a){if(_0xc9575a){return _0x17fd80[_0xf457('0x1c')](_0x496bb8);}return _0x17fd80[_0xf457('0x1d')](_0x496bb8)[_0xf457('0x1e')]();};}function respondWithResult(_0x18abeb,_0x1ced6b){_0x1ced6b=_0x1ced6b||0xc8;return function(_0x3be575){if(_0x3be575){return _0x18abeb[_0xf457('0x1d')](_0x1ced6b)[_0xf457('0x1f')](_0x3be575);}};}function respondWithFilteredResult(_0x1e0aa7,_0x4decf6){return function(_0xbd8935){if(_0xbd8935){var _0x76eefe=typeof _0x4decf6[_0xf457('0x20')]===_0xf457('0x21')&&typeof _0x4decf6[_0xf457('0x22')]===_0xf457('0x21');var _0x4fc8a6=_0xbd8935[_0xf457('0x23')];var _0x427280=_0x76eefe?0x0:_0x4decf6['offset'];var _0x33c0d0=_0x76eefe?_0xbd8935['count']:_0x4decf6[_0xf457('0x20')]+_0x4decf6['limit'];var _0x5c741f;if(_0x33c0d0>=_0x4fc8a6){_0x33c0d0=_0x4fc8a6;_0x5c741f=0xc8;}else{_0x5c741f=0xce;}_0x1e0aa7[_0xf457('0x1d')](_0x5c741f);return _0x1e0aa7[_0xf457('0x24')](_0xf457('0x25'),_0x427280+'-'+_0x33c0d0+'/'+_0x4fc8a6)[_0xf457('0x1f')](_0xbd8935);}return null;};}function patchUpdates(_0x11247c){return function(_0x5c0551){try{jsonpatch[_0xf457('0x26')](_0x5c0551,_0x11247c,!![]);}catch(_0x3f9f9d){return BPromise[_0xf457('0x27')](_0x3f9f9d);}return _0x5c0551[_0xf457('0x28')]();};}function saveUpdates(_0x1083f9,_0x2bfc8f){return function(_0x3e7f93){if(_0x3e7f93){return _0x3e7f93[_0xf457('0x29')](_0x1083f9)[_0xf457('0x2a')](function(_0x5d72e3){return _0x5d72e3;});}return null;};}function removeEntity(_0x4c7b1c,_0x20031a){return function(_0x41edc8){if(_0x41edc8){return _0x41edc8[_0xf457('0x2b')]()[_0xf457('0x2a')](function(){_0x4c7b1c[_0xf457('0x1d')](0xcc)[_0xf457('0x1e')]();});}};}function handleEntityNotFound(_0x56858b,_0x36823d){return function(_0x338ac6){if(!_0x338ac6){_0x56858b['sendStatus'](0x194);}return _0x338ac6;};}function handleError(_0x2c3f67,_0x271441){_0x271441=_0x271441||0x1f4;return function(_0x34834e){logger['error'](_0x34834e[_0xf457('0x2c')]);if(_0x34834e[_0xf457('0x2d')]){delete _0x34834e[_0xf457('0x2d')];}_0x2c3f67['status'](_0x271441)[_0xf457('0x2e')](_0x34834e);};}exports[_0xf457('0x2f')]=function(_0x209029,_0x2266fc){var _0x56b0e4={},_0x1f4cc4={},_0x3eccce={'count':0x0,'rows':[]};return db[_0xf457('0x30')]['describe']()[_0xf457('0x2a')](function(_0x484fd1){var _0x5a0a85=[];for(var _0x56d4ca=0x0;_0x56d4ca0x1){_0x418a00['or'](_0xf457('0x70'),qs[_0xf457('0x71')](_0x5968af),null);}else{if(qs[_0xf457('0x72')](_0x5968af)){_0x418a00['or'](_0xf457('0x73'),_0x5968af+'%');_0x418a00['or'](_0xf457('0x74'),_0x5968af+'%');_0x418a00['or']('c.mobile\x20LIKE\x20?',_0x5968af+'%');_0x418a00['or']('c.fax\x20LIKE\x20?',_0x5968af+'%');}else if(qs[_0xf457('0x75')](_0x5968af)){_0x418a00['or'](_0xf457('0x76'),_0x5968af+'%');}else{_0x418a00['or'](_0xf457('0x77'),'%'+_0x5968af+'%');_0x418a00['or'](_0xf457('0x78'),'%'+_0x5968af+'%');_0x418a00['or'](_0xf457('0x76'),'%'+_0x5968af+'%');}}}}_0x5117cc[_0xf457('0x41')](_0x418a00);_0x5117cc['group'](_0xf457('0x79'));var _0x31d255={'type':db[_0xf457('0x7a')][_0xf457('0x7b')]['SELECT'],'raw':!![]};var _0x559dd1=_0x5117cc[_0xf457('0x7c')]()[_0xf457('0x45')](_0xf457('0x79'));if(_0x56b0e4[_0xf457('0x7d')]){_0x56b0e4['order']['forEach'](function(_0x3d8839){_0x5117cc['order']('c.'+_0x3d8839[0x0],_0x3d8839[0x1]===_0xf457('0x7e')?![]:!![]);});}if(!_[_0xf457('0x66')](_0x486739)){_0x5117cc[_0xf457('0x7f')](_0x501140);_0x559dd1[_0xf457('0x41')](_0xf457('0x80'),_0x486739);}BPromise[_0xf457('0x81')]()[_0xf457('0x2a')](function(){if(!_0xd2e9d3)return;if(_0x209029['user'][_0xf457('0x82')]!==_0xf457('0x83'))return;if(!_[_0xf457('0x84')](_0xd2e9d3[_0xf457('0x52')],['field',_0xf457('0x57')])){return _0x209029[_0xf457('0x85')][_0xf457('0x86')]({'attributes':['id'],'raw':!![]})['then'](function(_0x11673e){if(_[_0xf457('0x66')](_0x11673e)){_0x559dd1['where'](_0xf457('0x87'));_0x5117cc[_0xf457('0x41')]('c.ListId\x20IS\x20NULL');}else{_0x559dd1['where'](_0xf457('0x68'),_[_0xf457('0x62')](_0x11673e,'id'));_0x5117cc[_0xf457('0x41')](_0xf457('0x68'),_[_0xf457('0x62')](_0x11673e,'id'));}});}})['then'](function(){if(_0x209029[_0xf457('0x85')][_0xf457('0x82')]===_0xf457('0x83')&&!_0xd2e9d3&&!_0x209029['query'][_0xf457('0x67')])return[];return db['sequelize'][_0xf457('0x3b')](_0x559dd1[_0xf457('0x88')](),_0x31d255);})['then'](function(_0x384e3b){_0x3eccce[_0xf457('0x23')]=_0x384e3b[_0xf457('0x37')];if(_0x3eccce[_0xf457('0x23')]===0x0)return[];return db[_0xf457('0x89')][_0xf457('0x3b')](_0x509d95[_0xf457('0x88')](),_0x31d255)['then'](function(_0x5f549b){_0x4ac04c=_[_0xf457('0x8a')](_0x5f549b,'id');_0x31d255=_[_0xf457('0x8b')](_0x31d255,{'model':db[_0xf457('0x30')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x209029[_0xf457('0x3b')][_0xf457('0x3d')]){_0x56b0e4['attributes'][_0xf457('0x56')](function(_0x5d6b97){_0x5117cc[_0xf457('0x45')]('c.'+_0x5d6b97);});}else{_0x5117cc[_0xf457('0x45')](_0xf457('0x79'));_0x5117cc[_0xf457('0x45')](_0xf457('0x8c'));_0x5117cc[_0xf457('0x45')]('c.lastName');_0x5117cc[_0xf457('0x45')](_0xf457('0x8d'));_0x5117cc[_0xf457('0x45')](_0xf457('0x8e'));_0x5117cc[_0xf457('0x45')](_0xf457('0x8f'));_0x5117cc[_0xf457('0x45')]('c.email');_0x5117cc[_0xf457('0x45')](_0xf457('0x90'));_0x5117cc[_0xf457('0x45')](_0xf457('0x91'));_0x5117cc['field'](_0xf457('0x92'));_0x5117cc[_0xf457('0x45')](_0xf457('0x93'));_0x5117cc[_0xf457('0x45')](_0xf457('0x94'),_0xf457('0x95'));}if(_0x56b0e4[_0xf457('0x22')])_0x5117cc[_0xf457('0x22')](_0x56b0e4[_0xf457('0x22')]);if(_0x56b0e4[_0xf457('0x20')])_0x5117cc['offset'](_0x56b0e4[_0xf457('0x20')]);return db[_0xf457('0x89')]['query'](_0x5117cc[_0xf457('0x88')](),_0x31d255);});})[_0xf457('0x2a')](function(_0x2c6738){_0x2c6738['forEach'](function(_0x1284e3){if(_0x1284e3['TagIds']){_0x1284e3[_0xf457('0x96')]=[];_0x1284e3['TagIds']['split'](',')['forEach'](function(_0x1b7d48){_0x1284e3['Tags'][_0xf457('0x33')](_0x4ac04c[_0x1b7d48]);});}delete _0x1284e3[_0xf457('0x95')];});_0x3eccce[_0xf457('0x97')]=_0x2c6738;return _0x3eccce;})[_0xf457('0x2a')](respondWithFilteredResult(_0x2266fc,_0x56b0e4));})['catch'](handleError(_0x2266fc,null));};exports[_0xf457('0x2b')]=function(_0x2bb994,_0x3fddd8){return db[_0xf457('0x30')][_0xf457('0x53')]({'where':{'id':_0x2bb994[_0xf457('0x98')]['id']}})[_0xf457('0x2a')](handleEntityNotFound(_0x3fddd8,null))[_0xf457('0x2a')](removeEntity(_0x3fddd8,null))[_0xf457('0x99')](handleError(_0x3fddd8,null));};exports['describe']=function(_0x510bd2,_0x11baf4){return db['CmContact'][_0xf457('0x9a')]()[_0xf457('0x2a')](function(_0x155c63){delete _0x155c63[_0xf457('0x9b')];for(var _0x5e4c00=0x0;_0x5e4c00=_0x3ce620){_0x5613b7=_0x3ce620;_0x1fa2dc=0xc8;}else{_0x1fa2dc=0xce;}_0x2a3128[_0xe63f('0x21')](_0x1fa2dc);return _0x2a3128[_0xe63f('0x27')](_0xe63f('0x28'),_0x34afe7+'-'+_0x5613b7+'/'+_0x3ce620)[_0xe63f('0x29')](_0x2586ae);}return null;};}function patchUpdates(_0x10e7f6){return function(_0x30e760){try{jsonpatch['apply'](_0x30e760,_0x10e7f6,!![]);}catch(_0x261cda){return BPromise[_0xe63f('0x2a')](_0x261cda);}return _0x30e760[_0xe63f('0x2b')]();};}function saveUpdates(_0xd60cd9,_0x201813){return function(_0x34f868){if(_0x34f868){return _0x34f868[_0xe63f('0x2c')](_0xd60cd9)[_0xe63f('0x2d')](function(_0x2dca5c){return _0x2dca5c;});}return null;};}function removeEntity(_0x1f88db,_0x3be8a3){return function(_0x3f9b67){if(_0x3f9b67){return _0x3f9b67['destroy']()['then'](function(){_0x1f88db[_0xe63f('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x423483,_0x11301f){return function(_0x3d7e23){if(!_0x3d7e23){_0x423483['sendStatus'](0x194);}return _0x3d7e23;};}function handleError(_0x4768a5,_0x1a701f){_0x1a701f=_0x1a701f||0x1f4;return function(_0x37c5df){logger[_0xe63f('0x2e')](_0x37c5df['stack']);if(_0x37c5df['name']){delete _0x37c5df[_0xe63f('0x2f')];}_0x4768a5[_0xe63f('0x21')](_0x1a701f)[_0xe63f('0x30')](_0x37c5df);};}exports[_0xe63f('0x31')]=function(_0x5d66ba,_0x2a7374){var _0x1b7c04={},_0x304b28={},_0x17f2bf={'count':0x0,'rows':[]};return db['CmContact']['describe']()[_0xe63f('0x2d')](function(_0x366dce){var _0x5cf370=[];for(var _0x124f84=0x0;_0x124f840x1){_0x1ee7ea['or'](_0xe63f('0x6e'),qs[_0xe63f('0x6f')](_0xbb7072),null);}else{if(qs[_0xe63f('0x70')](_0xbb7072)){_0x1ee7ea['or'](_0xe63f('0x71'),_0xbb7072+'%');_0x1ee7ea['or'](_0xe63f('0x72'),_0xbb7072+'%');_0x1ee7ea['or'](_0xe63f('0x73'),_0xbb7072+'%');_0x1ee7ea['or'](_0xe63f('0x74'),_0xbb7072+'%');}else if(qs[_0xe63f('0x75')](_0xbb7072)){_0x1ee7ea['or'](_0xe63f('0x76'),_0xbb7072+'%');}else{_0x1ee7ea['or'](_0xe63f('0x77'),'%'+_0xbb7072+'%');_0x1ee7ea['or'](_0xe63f('0x78'),'%'+_0xbb7072+'%');_0x1ee7ea['or']('c.email\x20LIKE\x20?','%'+_0xbb7072+'%');}}}}_0x4cc4b1['where'](_0x1ee7ea);_0x4cc4b1[_0xe63f('0x79')](_0xe63f('0x7a'));var _0x49e02c={'type':db[_0xe63f('0x7b')][_0xe63f('0x7c')][_0xe63f('0x7d')],'raw':!![]};var _0x455258=_0x4cc4b1[_0xe63f('0x7e')]()[_0xe63f('0x45')](_0xe63f('0x7a'));if(_0x1b7c04[_0xe63f('0x7f')]){_0x1b7c04[_0xe63f('0x7f')][_0xe63f('0x67')](function(_0x5327b8){_0x4cc4b1[_0xe63f('0x7f')]('c.'+_0x5327b8[0x0],_0x5327b8[0x1]===_0xe63f('0x80')?![]:!![]);});}if(!_['isEmpty'](_0x30d9a6)){_0x4cc4b1[_0xe63f('0x81')](_0x49aacc);_0x455258[_0xe63f('0x4f')]('t.id\x20IN\x20?',_0x30d9a6);}BPromise[_0xe63f('0x82')]()[_0xe63f('0x2d')](function(){if(!_0x3814c4)return;if(_0x5d66ba[_0xe63f('0x83')]['role']!==_0xe63f('0x84'))return;if(!_[_0xe63f('0x85')](_0x3814c4[_0xe63f('0x54')],[_0xe63f('0x45'),_0xe63f('0x5a')])){return _0x5d66ba[_0xe63f('0x83')][_0xe63f('0x86')]({'attributes':['id'],'raw':!![]})[_0xe63f('0x2d')](function(_0x4fced5){if(_['isEmpty'](_0x4fced5)){_0x455258['where']('c.ListId\x20IS\x20NULL');_0x4cc4b1[_0xe63f('0x4f')](_0xe63f('0x87'));}else{_0x455258[_0xe63f('0x4f')](_0xe63f('0x69'),_[_0xe63f('0x57')](_0x4fced5,'id'));_0x4cc4b1['where'](_0xe63f('0x69'),_['map'](_0x4fced5,'id'));}});}})[_0xe63f('0x2d')](function(){if(_0x5d66ba[_0xe63f('0x83')][_0xe63f('0x88')]===_0xe63f('0x84')&&!_0x3814c4&&!_0x5d66ba[_0xe63f('0x3c')]['ListId'])return[];return db[_0xe63f('0x89')][_0xe63f('0x3c')](_0x455258[_0xe63f('0x8a')](),_0x49e02c);})[_0xe63f('0x2d')](function(_0x30e7a5){_0x17f2bf[_0xe63f('0x25')]=_0x30e7a5['length'];if(_0x17f2bf[_0xe63f('0x25')]===0x0)return[];return db[_0xe63f('0x89')][_0xe63f('0x3c')](_0x2e88a5[_0xe63f('0x8a')](),_0x49e02c)[_0xe63f('0x2d')](function(_0x1dcc58){_0x4e239b=_[_0xe63f('0x8b')](_0x1dcc58,'id');_0x49e02c=_[_0xe63f('0x8c')](_0x49e02c,{'model':db[_0xe63f('0x8d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5d66ba['query'][_0xe63f('0x40')]){_0x1b7c04[_0xe63f('0x3e')]['forEach'](function(_0x4d550b){_0x4cc4b1[_0xe63f('0x45')]('c.'+_0x4d550b);});}else{_0x4cc4b1[_0xe63f('0x45')](_0xe63f('0x7a'));_0x4cc4b1[_0xe63f('0x45')](_0xe63f('0x8e'));_0x4cc4b1[_0xe63f('0x45')](_0xe63f('0x8f'));_0x4cc4b1[_0xe63f('0x45')](_0xe63f('0x90'));_0x4cc4b1['field'](_0xe63f('0x91'));_0x4cc4b1['field'](_0xe63f('0x92'));_0x4cc4b1[_0xe63f('0x45')](_0xe63f('0x93'));_0x4cc4b1['field']('c.ListId');_0x4cc4b1[_0xe63f('0x45')](_0xe63f('0x94'));_0x4cc4b1['field'](_0xe63f('0x95'));_0x4cc4b1[_0xe63f('0x45')](_0xe63f('0x96'));_0x4cc4b1['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0xe63f('0x97'));}if(_0x1b7c04['limit'])_0x4cc4b1['limit'](_0x1b7c04[_0xe63f('0x26')]);if(_0x1b7c04['offset'])_0x4cc4b1[_0xe63f('0x23')](_0x1b7c04[_0xe63f('0x23')]);return db[_0xe63f('0x89')][_0xe63f('0x3c')](_0x4cc4b1[_0xe63f('0x8a')](),_0x49e02c);});})[_0xe63f('0x2d')](function(_0x5d0456){_0x5d0456['forEach'](function(_0x235956){if(_0x235956['TagIds']){_0x235956[_0xe63f('0x98')]=[];_0x235956[_0xe63f('0x97')][_0xe63f('0x56')](',')[_0xe63f('0x67')](function(_0x53fd23){_0x235956['Tags'][_0xe63f('0x99')](_0x4e239b[_0x53fd23]);});}delete _0x235956['TagIds'];});_0x17f2bf[_0xe63f('0x9a')]=_0x5d0456;return _0x17f2bf;})[_0xe63f('0x2d')](respondWithFilteredResult(_0x2a7374,_0x1b7c04));})[_0xe63f('0x9b')](handleError(_0x2a7374,null));};exports[_0xe63f('0x9c')]=function(_0x1a4d64,_0x9a7560){return db[_0xe63f('0x8d')][_0xe63f('0x9d')]({'where':{'id':_0x1a4d64[_0xe63f('0x9e')]['id']}})['then'](handleEntityNotFound(_0x9a7560,null))[_0xe63f('0x2d')](removeEntity(_0x9a7560,null))['catch'](handleError(_0x9a7560,null));};exports['describe']=function(_0x27d909,_0x312faf){return db[_0xe63f('0x8d')][_0xe63f('0x9f')]()[_0xe63f('0x2d')](function(_0x31b6c8){delete _0x31b6c8[_0xe63f('0xa0')];for(var _0x2506ce=0x0;_0x2506ce{}\s\\|]/g,'-');_0x313d96(null,util[_0x1441('0x21')](_0x1441('0x22'),path['basename'](_0x201d70[_0x1441('0x1f')],path[_0x1441('0x23')](_0x201d70[_0x1441('0x1f')])),Date['now'](),path[_0x1441('0x23')](_0x201d70[_0x1441('0x1f')])));}})});router[_0x1441('0x17')](_0x1441('0x24'),upload['single']('file'),controller[_0x1441('0x25')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x13827c,_0x1e373a,_0x101e3d){_0x101e3d(null,path[_0x1441('0x1c')](config[_0x1441('0x1d')],_0x1441('0x1e')));},'filename':function(_0x46a763,_0x35b811,_0x5e1cf2){_0x35b811[_0x1441('0x1f')]=_0x35b811['originalname'][_0x1441('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5e1cf2(null,util[_0x1441('0x21')](_0x1441('0x22'),path[_0x1441('0x26')](_0x35b811[_0x1441('0x1f')],path[_0x1441('0x23')](_0x35b811[_0x1441('0x1f')])),Date[_0x1441('0x27')](),path[_0x1441('0x23')](_0x35b811[_0x1441('0x1f')])));}})});router[_0x1441('0x17')]('/upload',upload[_0x1441('0x28')](_0x1441('0x29')),controller[_0x1441('0x2a')]);router['post'](_0x1441('0x2b'),auth['isAuthenticated'](),controller[_0x1441('0x2c')]);router['put'](_0x1441('0x2d'),auth[_0x1441('0xd')](),controller[_0x1441('0x2e')]);router[_0x1441('0x2f')](_0x1441('0x2d'),auth[_0x1441('0xd')](),controller[_0x1441('0x30')]);module[_0x1441('0x31')]=router; \ No newline at end of file +var _0xd9c6=['single','file','uploadCsv','root','/upload','upload','/upload/:id','import','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','isAuthenticated','index','describe','/:id','show','/:id/tags','getTags','/:id/hoppers','/:id/hopper_histories','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','getJourney','post','/merge','merge','create','/create_many','bulkCreate','setTags','diskStorage','join','server/files/tmp','originalname','replace','format','%s-%s%s','basename','now','extname'];(function(_0xefe961,_0xa2a726){var _0x51d375=function(_0x1db691){while(--_0x1db691){_0xefe961['push'](_0xefe961['shift']());}};_0x51d375(++_0xa2a726);}(_0xd9c6,0x17f));var _0x6d9c=function(_0x25a1da,_0x7d20ce){_0x25a1da=_0x25a1da-0x0;var _0x3bb61f=_0xd9c6[_0x25a1da];return _0x3bb61f;};'use strict';var multer=require(_0x6d9c('0x0'));var util=require('util');var path=require(_0x6d9c('0x1'));var timeout=require(_0x6d9c('0x2'));var express=require(_0x6d9c('0x3'));var router=express[_0x6d9c('0x4')]();var fs_extra=require(_0x6d9c('0x5'));var auth=require(_0x6d9c('0x6'));var interaction=require(_0x6d9c('0x7'));var config=require(_0x6d9c('0x8'));var controller=require(_0x6d9c('0x9'));router[_0x6d9c('0xa')]('/',auth[_0x6d9c('0xb')](),controller[_0x6d9c('0xc')]);router[_0x6d9c('0xa')]('/describe',auth[_0x6d9c('0xb')](),controller[_0x6d9c('0xd')]);router['get'](_0x6d9c('0xe'),auth[_0x6d9c('0xb')](),controller[_0x6d9c('0xf')]);router[_0x6d9c('0xa')](_0x6d9c('0x10'),auth[_0x6d9c('0xb')](),controller[_0x6d9c('0x11')]);router['get'](_0x6d9c('0x12'),auth[_0x6d9c('0xb')](),controller['getHoppers']);router[_0x6d9c('0xa')](_0x6d9c('0x13'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0x6d9c('0xa')]('/:id/hopper_finals',auth[_0x6d9c('0xb')](),controller[_0x6d9c('0x14')]);router[_0x6d9c('0xa')](_0x6d9c('0x15'),auth['isAuthenticated'](),controller[_0x6d9c('0x16')]);router[_0x6d9c('0xa')]('/:id/journey',auth[_0x6d9c('0xb')](),controller[_0x6d9c('0x17')]);router[_0x6d9c('0x18')](_0x6d9c('0x19'),auth[_0x6d9c('0xb')](),controller[_0x6d9c('0x1a')]);router[_0x6d9c('0x18')]('/',auth[_0x6d9c('0xb')](),controller[_0x6d9c('0x1b')]);router[_0x6d9c('0x18')](_0x6d9c('0x1c'),auth['isAuthenticated'](),controller[_0x6d9c('0x1d')]);router[_0x6d9c('0x18')](_0x6d9c('0x10'),auth['isAuthenticated'](),controller[_0x6d9c('0x1e')]);var upload=multer({'storage':multer[_0x6d9c('0x1f')]({'destination':function(_0x205b19,_0x571ce7,_0x3889af){_0x3889af(null,path[_0x6d9c('0x20')](config['root'],_0x6d9c('0x21')));},'filename':function(_0x129aba,_0x12efe8,_0x3ba1d2){_0x12efe8[_0x6d9c('0x22')]=_0x12efe8[_0x6d9c('0x22')][_0x6d9c('0x23')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3ba1d2(null,util[_0x6d9c('0x24')](_0x6d9c('0x25'),path[_0x6d9c('0x26')](_0x12efe8[_0x6d9c('0x22')],path['extname'](_0x12efe8[_0x6d9c('0x22')])),Date[_0x6d9c('0x27')](),path[_0x6d9c('0x28')](_0x12efe8['originalname'])));}})});router[_0x6d9c('0x18')]('/csv',upload[_0x6d9c('0x29')](_0x6d9c('0x2a')),controller[_0x6d9c('0x2b')]);var upload=multer({'storage':multer[_0x6d9c('0x1f')]({'destination':function(_0x7216b9,_0x3f1b1a,_0x5f2813){_0x5f2813(null,path[_0x6d9c('0x20')](config[_0x6d9c('0x2c')],_0x6d9c('0x21')));},'filename':function(_0x9dcdfd,_0x776def,_0x3525f7){_0x776def['originalname']=_0x776def[_0x6d9c('0x22')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3525f7(null,util[_0x6d9c('0x24')]('%s-%s%s',path['basename'](_0x776def[_0x6d9c('0x22')],path['extname'](_0x776def['originalname'])),Date[_0x6d9c('0x27')](),path[_0x6d9c('0x28')](_0x776def[_0x6d9c('0x22')])));}})});router[_0x6d9c('0x18')](_0x6d9c('0x2d'),upload[_0x6d9c('0x29')](_0x6d9c('0x2a')),controller[_0x6d9c('0x2e')]);router['post'](_0x6d9c('0x2f'),auth['isAuthenticated'](),controller[_0x6d9c('0x30')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x6d9c('0x31')]);router[_0x6d9c('0x32')](_0x6d9c('0xe'),auth[_0x6d9c('0xb')](),controller[_0x6d9c('0x33')]);module[_0x6d9c('0x34')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 430baee..e6686b7 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 _0x82b6=['long','parse','values','isArray','stringify','BOOLEAN','voice','sequelize','lodash','exports','VIRTUAL','getDataValue','setDataValue','name','STRING','TEXT'];(function(_0x184dbf,_0x1c3272){var _0x321edf=function(_0x3cb3a4){while(--_0x3cb3a4){_0x184dbf['push'](_0x184dbf['shift']());}};_0x321edf(++_0x1c3272);}(_0x82b6,0xf7));var _0x682b=function(_0x924c29,_0x309120){_0x924c29=_0x924c29-0x0;var _0x24ddd6=_0x82b6[_0x924c29];return _0x24ddd6;};'use strict';var Sequelize=require(_0x682b('0x0'));var _=require(_0x682b('0x1'));module[_0x682b('0x2')]={'name':{'type':Sequelize[_0x682b('0x3')],'get':function(_0x5b2b3b){return this[_0x682b('0x4')]('alias');}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x4adf92){this[_0x682b('0x5')]('alias',_0x4adf92?_0x4adf92:this[_0x682b('0x4')](_0x682b('0x6')));}},'type':{'type':Sequelize[_0x682b('0x7')],'allowNull':![]},'values':{'type':Sequelize[_0x682b('0x8')](_0x682b('0x9')),'get':function(){if(this[_0x682b('0x4')]('type')==='select'){return JSON[_0x682b('0xa')](this[_0x682b('0x4')](_0x682b('0xb')));}else{return this[_0x682b('0x4')](_0x682b('0xb'));}},'set':function(_0x3c7dd1){if(Array[_0x682b('0xc')](_0x3c7dd1)){this[_0x682b('0x5')](_0x682b('0xb'),JSON[_0x682b('0xd')](_0x3c7dd1));}else{this['setDataValue']('values',_0x3c7dd1);}}},'required':{'type':Sequelize[_0x682b('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x682b('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0x682b('0xf'))}}; \ No newline at end of file +var _0x1246=['ENUM','voice','sequelize','lodash','exports','VIRTUAL','getDataValue','STRING','setDataValue','type','values','isArray','BOOLEAN'];(function(_0x54f4c6,_0x3281df){var _0x215141=function(_0x3d1ffa){while(--_0x3d1ffa){_0x54f4c6['push'](_0x54f4c6['shift']());}};_0x215141(++_0x3281df);}(_0x1246,0x1bc));var _0x6124=function(_0x3d5a46,_0x5e2a3f){_0x3d5a46=_0x3d5a46-0x0;var _0x3e60c2=_0x1246[_0x3d5a46];return _0x3e60c2;};'use strict';var Sequelize=require(_0x6124('0x0'));var _=require(_0x6124('0x1'));module[_0x6124('0x2')]={'name':{'type':Sequelize[_0x6124('0x3')],'get':function(_0x2b22c8){return this[_0x6124('0x4')]('alias');}},'alias':{'type':Sequelize[_0x6124('0x5')],'allowNull':![],'set':function(_0x2f9628){this[_0x6124('0x6')]('alias',_0x2f9628?_0x2f9628:this[_0x6124('0x4')]('name'));}},'type':{'type':Sequelize[_0x6124('0x5')],'allowNull':![]},'values':{'type':Sequelize['TEXT']('long'),'get':function(){if(this[_0x6124('0x4')](_0x6124('0x7'))==='select'){return JSON['parse'](this[_0x6124('0x4')](_0x6124('0x8')));}else{return this[_0x6124('0x4')](_0x6124('0x8'));}},'set':function(_0x1a3d80){if(Array[_0x6124('0x9')](_0x1a3d80)){this[_0x6124('0x6')](_0x6124('0x8'),JSON['stringify'](_0x1a3d80));}else{this[_0x6124('0x6')]('values',_0x1a3d80);}}},'required':{'type':Sequelize[_0x6124('0xa')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x6124('0xa')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x6124('0xb')](_0x6124('0xc'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 0fce0b2..0b60858 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 _0xc677=['mustache','path','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','index','map','CmCustomField','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','body','find','create','sequelize','Sequelize','TEXT','text','number','INTEGER','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','zip-dir','request-promise','moment','bluebird'];(function(_0x24e262,_0x2db87f){var _0x9251da=function(_0x6641fe){while(--_0x6641fe){_0x24e262['push'](_0x24e262['shift']());}};_0x9251da(++_0x2db87f);}(_0xc677,0x154));var _0x7c67=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xc677[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7c67('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7c67('0x1'));var moment=require(_0x7c67('0x2'));var BPromise=require(_0x7c67('0x3'));var Mustache=require(_0x7c67('0x4'));var util=require('util');var path=require(_0x7c67('0x5'));var sox=require(_0x7c67('0x6'));var csv=require('to-csv');var ejs=require(_0x7c67('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x7c67('0x8'));var jsforce=require(_0x7c67('0x9'));var deskjs=require(_0x7c67('0xa'));var toCsv=require(_0x7c67('0xb'));var querystring=require(_0x7c67('0xc'));var Papa=require(_0x7c67('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7c67('0xe'));var as=require(_0x7c67('0xf'));var hardwareService=require(_0x7c67('0x10'));var logger=require(_0x7c67('0x11'))(_0x7c67('0x12'));var utils=require(_0x7c67('0x13'));var config=require(_0x7c67('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x7c67('0x15'))['db'];function respondWithStatusCode(_0x2a636a,_0x24a540){_0x24a540=_0x24a540||0xcc;return function(_0x29b367){if(_0x29b367){return _0x2a636a[_0x7c67('0x16')](_0x24a540);}return _0x2a636a[_0x7c67('0x17')](_0x24a540)[_0x7c67('0x18')]();};}function respondWithResult(_0x2accb7,_0x513874){_0x513874=_0x513874||0xc8;return function(_0x2f4f2b){if(_0x2f4f2b){return _0x2accb7[_0x7c67('0x17')](_0x513874)[_0x7c67('0x19')](_0x2f4f2b);}};}function respondWithFilteredResult(_0x261b33,_0x29356a){return function(_0x518363){if(_0x518363){var _0x4e1856=typeof _0x29356a[_0x7c67('0x1a')]===_0x7c67('0x1b')&&typeof _0x29356a[_0x7c67('0x1c')]==='undefined';var _0x5a609d=_0x518363[_0x7c67('0x1d')];var _0x2128df=_0x4e1856?0x0:_0x29356a[_0x7c67('0x1a')];var _0x3d15f6=_0x4e1856?_0x518363['count']:_0x29356a[_0x7c67('0x1a')]+_0x29356a[_0x7c67('0x1c')];var _0x1989f5;if(_0x3d15f6>=_0x5a609d){_0x3d15f6=_0x5a609d;_0x1989f5=0xc8;}else{_0x1989f5=0xce;}_0x261b33[_0x7c67('0x17')](_0x1989f5);return _0x261b33[_0x7c67('0x1e')](_0x7c67('0x1f'),_0x2128df+'-'+_0x3d15f6+'/'+_0x5a609d)[_0x7c67('0x19')](_0x518363);}return null;};}function patchUpdates(_0x1c7289){return function(_0x2df2bf){try{jsonpatch[_0x7c67('0x20')](_0x2df2bf,_0x1c7289,!![]);}catch(_0x82e55a){return BPromise[_0x7c67('0x21')](_0x82e55a);}return _0x2df2bf[_0x7c67('0x22')]();};}function saveUpdates(_0xae7423,_0x1faca2){return function(_0x19ffa6){if(_0x19ffa6){return _0x19ffa6['update'](_0xae7423)[_0x7c67('0x23')](function(_0x2e7f68){return _0x2e7f68;});}return null;};}function removeEntity(_0x4a5932,_0x2067b2){return function(_0x15e965){if(_0x15e965){return _0x15e965[_0x7c67('0x24')]()['then'](function(){_0x4a5932['status'](0xcc)[_0x7c67('0x18')]();});}};}function handleEntityNotFound(_0x210b3c,_0xa46919){return function(_0x3d9194){if(!_0x3d9194){_0x210b3c[_0x7c67('0x16')](0x194);}return _0x3d9194;};}function handleError(_0x1b84e5,_0x1174f2){_0x1174f2=_0x1174f2||0x1f4;return function(_0xb59a26){logger['error'](_0xb59a26[_0x7c67('0x25')]);if(_0xb59a26[_0x7c67('0x26')]){delete _0xb59a26[_0x7c67('0x26')];}_0x1b84e5[_0x7c67('0x17')](_0x1174f2)['send'](_0xb59a26);};}exports[_0x7c67('0x27')]=function(_0x314575,_0x46bc53){var _0xd60942={},_0x1a35b6={},_0x21a360={'count':0x0,'rows':[]};var _0x227c87=_[_0x7c67('0x28')](db[_0x7c67('0x29')][_0x7c67('0x2a')],function(_0x3dd280){return{'name':_0x3dd280[_0x7c67('0x2b')],'type':_0x3dd280[_0x7c67('0x2c')][_0x7c67('0x2d')]};});_0x1a35b6[_0x7c67('0x2e')]=_['differenceBy'](_['map'](_0x227c87,_0x7c67('0x26')),['name']);_0x1a35b6[_0x7c67('0x2f')]=_[_0x7c67('0x30')](_0x314575[_0x7c67('0x2f')]);_0x1a35b6['filters']=_['intersection'](_0x1a35b6[_0x7c67('0x2e')],_0x1a35b6[_0x7c67('0x2f')]);_0xd60942[_0x7c67('0x31')]=_[_0x7c67('0x32')](_0x1a35b6[_0x7c67('0x2e')],qs[_0x7c67('0x33')](_0x314575[_0x7c67('0x2f')][_0x7c67('0x33')]));_0xd60942['attributes']=_0xd60942[_0x7c67('0x31')][_0x7c67('0x34')]?_0xd60942['attributes']:_0x1a35b6['model'];if(!_0x314575[_0x7c67('0x2f')][_0x7c67('0x35')](_0x7c67('0x36'))){_0xd60942['limit']=qs[_0x7c67('0x1c')](_0x314575[_0x7c67('0x2f')]['limit']);_0xd60942['offset']=qs[_0x7c67('0x1a')](_0x314575[_0x7c67('0x2f')]['offset']);}_0xd60942[_0x7c67('0x37')]=qs[_0x7c67('0x38')](_0x314575[_0x7c67('0x2f')]['sort']);_0xd60942[_0x7c67('0x39')]=qs[_0x7c67('0x3a')](_[_0x7c67('0x3b')](_0x314575[_0x7c67('0x2f')],_0x1a35b6[_0x7c67('0x3a')]),_0x227c87);if(_0x314575[_0x7c67('0x2f')][_0x7c67('0x3c')]){_0xd60942[_0x7c67('0x39')]=_[_0x7c67('0x3d')](_0xd60942['where'],{'$or':_[_0x7c67('0x28')](_0x227c87,function(_0x2020fc){if(_0x2020fc[_0x7c67('0x2c')]!==_0x7c67('0x3e')){var _0x381d73={};_0x381d73[_0x2020fc[_0x7c67('0x26')]]={'$like':'%'+_0x314575[_0x7c67('0x2f')][_0x7c67('0x3c')]+'%'};return _0x381d73;}})});}_0xd60942=_['merge']({},_0xd60942,_0x314575[_0x7c67('0x3f')]);var _0x5570ea={'where':_0xd60942['where']};return db['CmCustomField'][_0x7c67('0x1d')](_0x5570ea)['then'](function(_0x30f2fa){_0x21a360[_0x7c67('0x1d')]=_0x30f2fa;if(_0x314575['query'][_0x7c67('0x40')]){_0xd60942[_0x7c67('0x41')]=[{'all':!![]}];}return db[_0x7c67('0x29')]['findAll'](_0xd60942);})[_0x7c67('0x23')](function(_0x56513a){_0x21a360[_0x7c67('0x42')]=_0x56513a;return _0x21a360;})[_0x7c67('0x23')](respondWithFilteredResult(_0x46bc53,_0xd60942))[_0x7c67('0x43')](handleError(_0x46bc53,null));};exports[_0x7c67('0x44')]=function(_0x42c440,_0xc8c9ee){var _0x37fae0={'raw':!![],'where':{'id':_0x42c440[_0x7c67('0x45')]['id']}},_0x3b3855={};_0x3b3855[_0x7c67('0x2e')]=_[_0x7c67('0x30')](db[_0x7c67('0x29')][_0x7c67('0x2a')]);_0x3b3855[_0x7c67('0x2f')]=_[_0x7c67('0x30')](_0x42c440[_0x7c67('0x2f')]);_0x3b3855['filters']=_['intersection'](_0x3b3855[_0x7c67('0x2e')],_0x3b3855[_0x7c67('0x2f')]);_0x37fae0['attributes']=_[_0x7c67('0x32')](_0x3b3855[_0x7c67('0x2e')],qs[_0x7c67('0x33')](_0x42c440[_0x7c67('0x2f')][_0x7c67('0x33')]));_0x37fae0[_0x7c67('0x31')]=_0x37fae0['attributes']['length']?_0x37fae0[_0x7c67('0x31')]:_0x3b3855[_0x7c67('0x2e')];if(_0x42c440['query']['includeAll']){_0x37fae0[_0x7c67('0x41')]=[{'all':!![]}];}_0x37fae0=_[_0x7c67('0x3d')]({},_0x37fae0,_0x42c440[_0x7c67('0x3f')]);return db[_0x7c67('0x29')]['find'](_0x37fae0)[_0x7c67('0x23')](handleEntityNotFound(_0xc8c9ee,null))[_0x7c67('0x23')](respondWithResult(_0xc8c9ee,null))[_0x7c67('0x43')](handleError(_0xc8c9ee,null));};exports['update']=function(_0x408c11,_0xe5b8d7){if(_0x408c11[_0x7c67('0x46')]['id']){delete _0x408c11['body']['id'];}return db['CmCustomField'][_0x7c67('0x47')]({'where':{'id':_0x408c11[_0x7c67('0x45')]['id']}})[_0x7c67('0x23')](handleEntityNotFound(_0xe5b8d7,null))['then'](saveUpdates(_0x408c11[_0x7c67('0x46')],null))[_0x7c67('0x23')](respondWithResult(_0xe5b8d7,null))[_0x7c67('0x43')](handleError(_0xe5b8d7,null));};exports[_0x7c67('0x24')]=function(_0x416f1c,_0x14d16e){return db[_0x7c67('0x29')][_0x7c67('0x47')]({'where':{'id':_0x416f1c[_0x7c67('0x45')]['id']}})[_0x7c67('0x23')](handleEntityNotFound(_0x14d16e,null))['then'](removeEntity(_0x14d16e,null))[_0x7c67('0x43')](handleError(_0x14d16e,null));};exports[_0x7c67('0x48')]=function(_0x2d7aa6,_0x59592b){var _0x231d9b;return db[_0x7c67('0x49')]['transaction'](function(_0x4ae07c){return db[_0x7c67('0x29')][_0x7c67('0x48')](_0x2d7aa6['body'],{'transaction':_0x4ae07c})[_0x7c67('0x23')](function(_0x28d118){_0x231d9b=_0x28d118;var _0x132bae={'type':db[_0x7c67('0x4a')][_0x7c67('0x4b')],'transaction':_0x4ae07c};switch(_0x2d7aa6['body'][_0x7c67('0x2c')]){case _0x7c67('0x4c'):_0x132bae['type']=db['Sequelize'][_0x7c67('0x4b')];break;case _0x7c67('0x4d'):_0x132bae[_0x7c67('0x2c')]=db[_0x7c67('0x4a')][_0x7c67('0x4e')];break;case'switch':_0x132bae['type']=db[_0x7c67('0x4a')][_0x7c67('0x4f')];_0x132bae[_0x7c67('0x50')]=![];break;default:}return db[_0x7c67('0x49')][_0x7c67('0x51')][_0x7c67('0x52')](_0x7c67('0x53'),util[_0x7c67('0x54')](_0x7c67('0x55'),_0x231d9b['id']),_0x132bae);})['then'](function(){return _0x231d9b;});})['then'](respondWithResult(_0x59592b,0xc9))['catch'](handleError(_0x59592b,null));}; \ No newline at end of file +var _0xfc25=['type','text','Sequelize','number','switch','BOOLEAN','defaultValue','addColumn','cm_contacts','format','cf_%d','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','name','send','index','rawAttributes','fieldName','key','model','differenceBy','map','query','keys','intersection','attributes','fields','length','order','sort','where','pick','filters','filter','VIRTUAL','merge','options','CmCustomField','include','rows','catch','show','params','includeAll','find','body','destroy','create','sequelize','TEXT'];(function(_0x24a0ff,_0x1e6192){var _0xc45157=function(_0x5160d1){while(--_0x5160d1){_0x24a0ff['push'](_0x24a0ff['shift']());}};_0xc45157(++_0x1e6192);}(_0xfc25,0x163));var _0x5fc2=function(_0x1e0cde,_0x22735b){_0x1e0cde=_0x1e0cde-0x0;var _0x41f8c5=_0xfc25[_0x1e0cde];return _0x41f8c5;};'use strict';var emlformat=require(_0x5fc2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5fc2('0x1'));var jsonpatch=require(_0x5fc2('0x2'));var rp=require(_0x5fc2('0x3'));var moment=require(_0x5fc2('0x4'));var BPromise=require(_0x5fc2('0x5'));var Mustache=require(_0x5fc2('0x6'));var util=require(_0x5fc2('0x7'));var path=require(_0x5fc2('0x8'));var sox=require(_0x5fc2('0x9'));var csv=require(_0x5fc2('0xa'));var ejs=require(_0x5fc2('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5fc2('0xc'));var squel=require(_0x5fc2('0xd'));var crypto=require(_0x5fc2('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5fc2('0xf'));var toCsv=require(_0x5fc2('0xa'));var querystring=require(_0x5fc2('0x10'));var Papa=require(_0x5fc2('0x11'));var Redis=require(_0x5fc2('0x12'));var authService=require(_0x5fc2('0x13'));var qs=require(_0x5fc2('0x14'));var as=require(_0x5fc2('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5fc2('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x5fc2('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x147d45,_0x545c9d){_0x545c9d=_0x545c9d||0xcc;return function(_0x287035){if(_0x287035){return _0x147d45[_0x5fc2('0x18')](_0x545c9d);}return _0x147d45[_0x5fc2('0x19')](_0x545c9d)[_0x5fc2('0x1a')]();};}function respondWithResult(_0x4cbf5c,_0x1da56f){_0x1da56f=_0x1da56f||0xc8;return function(_0x45f510){if(_0x45f510){return _0x4cbf5c[_0x5fc2('0x19')](_0x1da56f)[_0x5fc2('0x1b')](_0x45f510);}};}function respondWithFilteredResult(_0x31d99f,_0x4827be){return function(_0x373dfa){if(_0x373dfa){var _0x47a645=typeof _0x4827be[_0x5fc2('0x1c')]===_0x5fc2('0x1d')&&typeof _0x4827be[_0x5fc2('0x1e')]===_0x5fc2('0x1d');var _0x2e3964=_0x373dfa['count'];var _0x524ebf=_0x47a645?0x0:_0x4827be[_0x5fc2('0x1c')];var _0x1e9753=_0x47a645?_0x373dfa[_0x5fc2('0x1f')]:_0x4827be[_0x5fc2('0x1c')]+_0x4827be[_0x5fc2('0x1e')];var _0x4862df;if(_0x1e9753>=_0x2e3964){_0x1e9753=_0x2e3964;_0x4862df=0xc8;}else{_0x4862df=0xce;}_0x31d99f[_0x5fc2('0x19')](_0x4862df);return _0x31d99f[_0x5fc2('0x20')](_0x5fc2('0x21'),_0x524ebf+'-'+_0x1e9753+'/'+_0x2e3964)['json'](_0x373dfa);}return null;};}function patchUpdates(_0x513a32){return function(_0x43503a){try{jsonpatch['apply'](_0x43503a,_0x513a32,!![]);}catch(_0x57b6a8){return BPromise[_0x5fc2('0x22')](_0x57b6a8);}return _0x43503a[_0x5fc2('0x23')]();};}function saveUpdates(_0x4edb67,_0x4be9fa){return function(_0x4f0386){if(_0x4f0386){return _0x4f0386[_0x5fc2('0x24')](_0x4edb67)['then'](function(_0xfe8ffc){return _0xfe8ffc;});}return null;};}function removeEntity(_0x2ef03d,_0x5af7b7){return function(_0x7e7ff4){if(_0x7e7ff4){return _0x7e7ff4['destroy']()[_0x5fc2('0x25')](function(){_0x2ef03d[_0x5fc2('0x19')](0xcc)[_0x5fc2('0x1a')]();});}};}function handleEntityNotFound(_0x370caf,_0x4b8d81){return function(_0x23be65){if(!_0x23be65){_0x370caf['sendStatus'](0x194);}return _0x23be65;};}function handleError(_0x2e87fc,_0x1896a2){_0x1896a2=_0x1896a2||0x1f4;return function(_0x4d4721){logger['error'](_0x4d4721['stack']);if(_0x4d4721['name']){delete _0x4d4721[_0x5fc2('0x26')];}_0x2e87fc[_0x5fc2('0x19')](_0x1896a2)[_0x5fc2('0x27')](_0x4d4721);};}exports[_0x5fc2('0x28')]=function(_0x3e7e3b,_0x15225c){var _0x44b50f={},_0x1d35b1={},_0xbcce73={'count':0x0,'rows':[]};var _0x2235d4=_['map'](db['CmCustomField'][_0x5fc2('0x29')],function(_0x42fd20){return{'name':_0x42fd20[_0x5fc2('0x2a')],'type':_0x42fd20['type'][_0x5fc2('0x2b')]};});_0x1d35b1[_0x5fc2('0x2c')]=_[_0x5fc2('0x2d')](_[_0x5fc2('0x2e')](_0x2235d4,'name'),[_0x5fc2('0x26')]);_0x1d35b1[_0x5fc2('0x2f')]=_[_0x5fc2('0x30')](_0x3e7e3b[_0x5fc2('0x2f')]);_0x1d35b1['filters']=_[_0x5fc2('0x31')](_0x1d35b1[_0x5fc2('0x2c')],_0x1d35b1[_0x5fc2('0x2f')]);_0x44b50f[_0x5fc2('0x32')]=_[_0x5fc2('0x31')](_0x1d35b1[_0x5fc2('0x2c')],qs[_0x5fc2('0x33')](_0x3e7e3b[_0x5fc2('0x2f')][_0x5fc2('0x33')]));_0x44b50f[_0x5fc2('0x32')]=_0x44b50f['attributes'][_0x5fc2('0x34')]?_0x44b50f[_0x5fc2('0x32')]:_0x1d35b1[_0x5fc2('0x2c')];if(!_0x3e7e3b[_0x5fc2('0x2f')]['hasOwnProperty']('nolimit')){_0x44b50f['limit']=qs['limit'](_0x3e7e3b[_0x5fc2('0x2f')]['limit']);_0x44b50f['offset']=qs[_0x5fc2('0x1c')](_0x3e7e3b[_0x5fc2('0x2f')][_0x5fc2('0x1c')]);}_0x44b50f[_0x5fc2('0x35')]=qs[_0x5fc2('0x36')](_0x3e7e3b['query'][_0x5fc2('0x36')]);_0x44b50f[_0x5fc2('0x37')]=qs['filters'](_[_0x5fc2('0x38')](_0x3e7e3b[_0x5fc2('0x2f')],_0x1d35b1[_0x5fc2('0x39')]),_0x2235d4);if(_0x3e7e3b[_0x5fc2('0x2f')][_0x5fc2('0x3a')]){_0x44b50f['where']=_['merge'](_0x44b50f[_0x5fc2('0x37')],{'$or':_[_0x5fc2('0x2e')](_0x2235d4,function(_0x5419b9){if(_0x5419b9['type']!==_0x5fc2('0x3b')){var _0x36d336={};_0x36d336[_0x5419b9[_0x5fc2('0x26')]]={'$like':'%'+_0x3e7e3b[_0x5fc2('0x2f')]['filter']+'%'};return _0x36d336;}})});}_0x44b50f=_[_0x5fc2('0x3c')]({},_0x44b50f,_0x3e7e3b[_0x5fc2('0x3d')]);var _0x298ebc={'where':_0x44b50f[_0x5fc2('0x37')]};return db[_0x5fc2('0x3e')]['count'](_0x298ebc)[_0x5fc2('0x25')](function(_0x54781d){_0xbcce73[_0x5fc2('0x1f')]=_0x54781d;if(_0x3e7e3b[_0x5fc2('0x2f')]['includeAll']){_0x44b50f[_0x5fc2('0x3f')]=[{'all':!![]}];}return db[_0x5fc2('0x3e')]['findAll'](_0x44b50f);})[_0x5fc2('0x25')](function(_0x50153f){_0xbcce73[_0x5fc2('0x40')]=_0x50153f;return _0xbcce73;})[_0x5fc2('0x25')](respondWithFilteredResult(_0x15225c,_0x44b50f))[_0x5fc2('0x41')](handleError(_0x15225c,null));};exports[_0x5fc2('0x42')]=function(_0x1d1950,_0x4f5ea2){var _0x105d60={'raw':!![],'where':{'id':_0x1d1950[_0x5fc2('0x43')]['id']}},_0x233e28={};_0x233e28['model']=_[_0x5fc2('0x30')](db[_0x5fc2('0x3e')]['rawAttributes']);_0x233e28[_0x5fc2('0x2f')]=_['keys'](_0x1d1950[_0x5fc2('0x2f')]);_0x233e28['filters']=_['intersection'](_0x233e28[_0x5fc2('0x2c')],_0x233e28['query']);_0x105d60['attributes']=_[_0x5fc2('0x31')](_0x233e28[_0x5fc2('0x2c')],qs['fields'](_0x1d1950['query'][_0x5fc2('0x33')]));_0x105d60['attributes']=_0x105d60[_0x5fc2('0x32')][_0x5fc2('0x34')]?_0x105d60['attributes']:_0x233e28[_0x5fc2('0x2c')];if(_0x1d1950[_0x5fc2('0x2f')][_0x5fc2('0x44')]){_0x105d60[_0x5fc2('0x3f')]=[{'all':!![]}];}_0x105d60=_[_0x5fc2('0x3c')]({},_0x105d60,_0x1d1950[_0x5fc2('0x3d')]);return db[_0x5fc2('0x3e')][_0x5fc2('0x45')](_0x105d60)['then'](handleEntityNotFound(_0x4f5ea2,null))[_0x5fc2('0x25')](respondWithResult(_0x4f5ea2,null))[_0x5fc2('0x41')](handleError(_0x4f5ea2,null));};exports[_0x5fc2('0x24')]=function(_0x8e1bf8,_0x20ec1f){if(_0x8e1bf8[_0x5fc2('0x46')]['id']){delete _0x8e1bf8['body']['id'];}return db[_0x5fc2('0x3e')][_0x5fc2('0x45')]({'where':{'id':_0x8e1bf8['params']['id']}})[_0x5fc2('0x25')](handleEntityNotFound(_0x20ec1f,null))[_0x5fc2('0x25')](saveUpdates(_0x8e1bf8[_0x5fc2('0x46')],null))['then'](respondWithResult(_0x20ec1f,null))[_0x5fc2('0x41')](handleError(_0x20ec1f,null));};exports[_0x5fc2('0x47')]=function(_0x4e20d3,_0x3742cc){return db[_0x5fc2('0x3e')][_0x5fc2('0x45')]({'where':{'id':_0x4e20d3[_0x5fc2('0x43')]['id']}})[_0x5fc2('0x25')](handleEntityNotFound(_0x3742cc,null))[_0x5fc2('0x25')](removeEntity(_0x3742cc,null))[_0x5fc2('0x41')](handleError(_0x3742cc,null));};exports[_0x5fc2('0x48')]=function(_0x52aa43,_0x37371e){var _0x345e72;return db[_0x5fc2('0x49')]['transaction'](function(_0xb463f7){return db[_0x5fc2('0x3e')][_0x5fc2('0x48')](_0x52aa43['body'],{'transaction':_0xb463f7})[_0x5fc2('0x25')](function(_0x2bfd88){_0x345e72=_0x2bfd88;var _0x13d1d6={'type':db['Sequelize'][_0x5fc2('0x4a')],'transaction':_0xb463f7};switch(_0x52aa43[_0x5fc2('0x46')][_0x5fc2('0x4b')]){case _0x5fc2('0x4c'):_0x13d1d6['type']=db[_0x5fc2('0x4d')][_0x5fc2('0x4a')];break;case _0x5fc2('0x4e'):_0x13d1d6['type']=db[_0x5fc2('0x4d')]['INTEGER'];break;case _0x5fc2('0x4f'):_0x13d1d6[_0x5fc2('0x4b')]=db[_0x5fc2('0x4d')][_0x5fc2('0x50')];_0x13d1d6[_0x5fc2('0x51')]=![];break;default:}return db[_0x5fc2('0x49')]['queryInterface'][_0x5fc2('0x52')](_0x5fc2('0x53'),util[_0x5fc2('0x54')](_0x5fc2('0x55'),_0x345e72['id']),_0x13d1d6);})['then'](function(){return _0x345e72;});})[_0x5fc2('0x25')](respondWithResult(_0x37371e,0xc9))['catch'](handleError(_0x37371e,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 03c56d2..8d40c9a 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 _0x8555=['cm_custom_fields','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField'];(function(_0x737a1f,_0x235fef){var _0x16eba1=function(_0x292aa8){while(--_0x292aa8){_0x737a1f['push'](_0x737a1f['shift']());}};_0x16eba1(++_0x235fef);}(_0x8555,0x79));var _0x5855=function(_0x1ea782,_0x490d24){_0x1ea782=_0x1ea782-0x0;var _0x20a853=_0x8555[_0x1ea782];return _0x20a853;};'use strict';var _=require(_0x5855('0x0'));var util=require(_0x5855('0x1'));var logger=require(_0x5855('0x2'))(_0x5855('0x3'));var moment=require(_0x5855('0x4'));var BPromise=require(_0x5855('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5855('0x6'));var attributes=require(_0x5855('0x7'));module[_0x5855('0x8')]=function(_0xeacbd6,_0x47507f){return _0xeacbd6[_0x5855('0x9')](_0x5855('0xa'),attributes,{'tableName':_0x5855('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa55c=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','CmCustomField','lodash'];(function(_0x1776b7,_0x2fb32e){var _0x50543c=function(_0x1de375){while(--_0x1de375){_0x1776b7['push'](_0x1776b7['shift']());}};_0x50543c(++_0x2fb32e);}(_0xa55c,0x6d));var _0xca55=function(_0x6a4611,_0x529a49){_0x6a4611=_0x6a4611-0x0;var _0x2f2a8b=_0xa55c[_0x6a4611];return _0x2f2a8b;};'use strict';var _=require(_0xca55('0x0'));var util=require(_0xca55('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xca55('0x2'));var BPromise=require(_0xca55('0x3'));var rp=require(_0xca55('0x4'));var fs=require('fs');var path=require(_0xca55('0x5'));var rimraf=require(_0xca55('0x6'));var config=require(_0xca55('0x7'));var attributes=require('./cmCustomField.attributes');module[_0xca55('0x8')]=function(_0x37a371,_0x142b78){return _0x37a371[_0xca55('0x9')](_0xca55('0xa'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 0ce02f7..91ff507 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 _0x0c47=['../../config/environment','jayson/promise','client','http','request','then','CmCustomField,\x20%s,\x20%s','request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x5a79e2,_0x319b1a){var _0x266c45=function(_0x172478){while(--_0x172478){_0x5a79e2['push'](_0x5a79e2['shift']());}};_0x266c45(++_0x319b1a);}(_0x0c47,0xff));var _0x70c4=function(_0x15ec4e,_0x40b7e0){_0x15ec4e=_0x15ec4e-0x0;var _0xb5e5dd=_0x0c47[_0x15ec4e];return _0xb5e5dd;};'use strict';var _=require(_0x70c4('0x0'));var util=require(_0x70c4('0x1'));var moment=require(_0x70c4('0x2'));var BPromise=require(_0x70c4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x70c4('0x4'));var db=require(_0x70c4('0x5'))['db'];var utils=require(_0x70c4('0x6'));var logger=require(_0x70c4('0x7'))(_0x70c4('0x8'));var config=require(_0x70c4('0x9'));var jayson=require(_0x70c4('0xa'));var client=jayson[_0x70c4('0xb')][_0x70c4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x79bba9,_0x4769b6,_0x42623f){return new BPromise(function(_0x159ae2,_0x1d98e9){return client[_0x70c4('0xd')](_0x79bba9,_0x42623f)[_0x70c4('0xe')](function(_0x3ad9b4){logger['info'](_0x70c4('0xf'),_0x4769b6,_0x70c4('0x10'));logger['debug'](_0x70c4('0x11'),_0x4769b6,_0x70c4('0x10'),JSON[_0x70c4('0x12')](_0x3ad9b4));if(_0x3ad9b4[_0x70c4('0x13')]){if(_0x3ad9b4['error'][_0x70c4('0x14')]===0x1f4){logger[_0x70c4('0x13')]('CmCustomField,\x20%s,\x20%s',_0x4769b6,_0x3ad9b4['error'][_0x70c4('0x15')]);return _0x1d98e9(_0x3ad9b4[_0x70c4('0x13')][_0x70c4('0x15')]);}logger['error'](_0x70c4('0xf'),_0x4769b6,_0x3ad9b4[_0x70c4('0x13')][_0x70c4('0x15')]);return _0x159ae2(_0x3ad9b4[_0x70c4('0x13')][_0x70c4('0x15')]);}else{logger[_0x70c4('0x16')]('CmCustomField,\x20%s,\x20%s',_0x4769b6,_0x70c4('0x10'));_0x159ae2(_0x3ad9b4[_0x70c4('0x17')][_0x70c4('0x15')]);}})['catch'](function(_0x551adb){logger[_0x70c4('0x13')](_0x70c4('0xf'),_0x4769b6,_0x551adb);_0x1d98e9(_0x551adb);});});} \ No newline at end of file +var _0x0396=['then','info','CmCustomField,\x20%s,\x20%s','debug','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x725b8e,_0xc22b48){var _0x43ac45=function(_0x46bb4a){while(--_0x46bb4a){_0x725b8e['push'](_0x725b8e['shift']());}};_0x43ac45(++_0xc22b48);}(_0x0396,0xb4));var _0x6039=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x0396[_0x5608a3];return _0x1ed50a;};'use strict';var _=require(_0x6039('0x0'));var util=require(_0x6039('0x1'));var moment=require(_0x6039('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6039('0x3'));var db=require(_0x6039('0x4'))['db'];var utils=require(_0x6039('0x5'));var logger=require(_0x6039('0x6'))(_0x6039('0x7'));var config=require(_0x6039('0x8'));var jayson=require(_0x6039('0x9'));var client=jayson[_0x6039('0xa')][_0x6039('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x402da8,_0x4d5527,_0x4c8e07){return new BPromise(function(_0x34d1ae,_0x3495b4){return client['request'](_0x402da8,_0x4c8e07)[_0x6039('0xc')](function(_0x2ef167){logger[_0x6039('0xd')](_0x6039('0xe'),_0x4d5527,'request\x20sent');logger[_0x6039('0xf')](_0x6039('0x10'),_0x4d5527,_0x6039('0x11'),JSON[_0x6039('0x12')](_0x2ef167));if(_0x2ef167['error']){if(_0x2ef167[_0x6039('0x13')][_0x6039('0x14')]===0x1f4){logger[_0x6039('0x13')](_0x6039('0xe'),_0x4d5527,_0x2ef167[_0x6039('0x13')][_0x6039('0x15')]);return _0x3495b4(_0x2ef167[_0x6039('0x13')][_0x6039('0x15')]);}logger[_0x6039('0x13')](_0x6039('0xe'),_0x4d5527,_0x2ef167[_0x6039('0x13')]['message']);return _0x34d1ae(_0x2ef167[_0x6039('0x13')][_0x6039('0x15')]);}else{logger[_0x6039('0xd')](_0x6039('0xe'),_0x4d5527,_0x6039('0x11'));_0x34d1ae(_0x2ef167[_0x6039('0x16')][_0x6039('0x15')]);}})[_0x6039('0x17')](function(_0x20deb0){logger['error']('CmCustomField,\x20%s,\x20%s',_0x4d5527,_0x20deb0);_0x3495b4(_0x20deb0);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index adc7949..1d70b06 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 _0xfe65=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','./cmCustomField.controller','get','index','/:id','show','post','isAuthenticated','create','delete','destroy','exports','multer','util'];(function(_0x5f4ec0,_0x1092e7){var _0xa57cc6=function(_0x1f0f55){while(--_0x1f0f55){_0x5f4ec0['push'](_0x5f4ec0['shift']());}};_0xa57cc6(++_0x1092e7);}(_0xfe65,0xc4));var _0x5fe6=function(_0x17db83,_0x380065){_0x17db83=_0x17db83-0x0;var _0x387835=_0xfe65[_0x17db83];return _0x387835;};'use strict';var multer=require(_0x5fe6('0x0'));var util=require(_0x5fe6('0x1'));var path=require('path');var timeout=require(_0x5fe6('0x2'));var express=require(_0x5fe6('0x3'));var router=express[_0x5fe6('0x4')]();var fs_extra=require(_0x5fe6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5fe6('0x6'));var config=require('../../config/environment');var controller=require(_0x5fe6('0x7'));router[_0x5fe6('0x8')]('/',auth['isAuthenticated'](),controller[_0x5fe6('0x9')]);router[_0x5fe6('0x8')](_0x5fe6('0xa'),auth['isAuthenticated'](),controller[_0x5fe6('0xb')]);router[_0x5fe6('0xc')]('/',auth[_0x5fe6('0xd')](),controller[_0x5fe6('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x5fe6('0xf')]('/:id',auth[_0x5fe6('0xd')](),controller[_0x5fe6('0x10')]);module[_0x5fe6('0x11')]=router; \ No newline at end of file +var _0x46cb=['./cmCustomField.controller','get','isAuthenticated','index','/:id','post','create','put','destroy','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3cefbb,_0x1bfb4e){var _0xb62b94=function(_0x51cd66){while(--_0x51cd66){_0x3cefbb['push'](_0x3cefbb['shift']());}};_0xb62b94(++_0x1bfb4e);}(_0x46cb,0xd6));var _0xb46c=function(_0xad15c7,_0x210cb4){_0xad15c7=_0xad15c7-0x0;var _0x520045=_0x46cb[_0xad15c7];return _0x520045;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xb46c('0x0'));var express=require(_0xb46c('0x1'));var router=express[_0xb46c('0x2')]();var fs_extra=require(_0xb46c('0x3'));var auth=require(_0xb46c('0x4'));var interaction=require(_0xb46c('0x5'));var config=require(_0xb46c('0x6'));var controller=require(_0xb46c('0x7'));router[_0xb46c('0x8')]('/',auth[_0xb46c('0x9')](),controller[_0xb46c('0xa')]);router[_0xb46c('0x8')](_0xb46c('0xb'),auth[_0xb46c('0x9')](),controller['show']);router[_0xb46c('0xc')]('/',auth[_0xb46c('0x9')](),controller[_0xb46c('0xd')]);router[_0xb46c('0xe')](_0xb46c('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xb46c('0xb'),auth[_0xb46c('0x9')](),controller[_0xb46c('0xf')]);module[_0xb46c('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index eea5d22..bae9c47 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 _0x62cc=['STRING','BOOLEAN','DATE','INTEGER','UNSIGNED','contactListQueue','moment','sequelize'];(function(_0x4f6c8f,_0x2735b0){var _0x308297=function(_0x2e1782){while(--_0x2e1782){_0x4f6c8f['push'](_0x4f6c8f['shift']());}};_0x308297(++_0x2735b0);}(_0x62cc,0x156));var _0xc62c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x62cc[_0x321bb2];return _0x9c12ed;};'use strict';var moment=require(_0xc62c('0x0'));var Sequelize=require(_0xc62c('0x1'));module['exports']={'phone':{'type':Sequelize[_0xc62c('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0xc62c('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xc62c('0x4')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xc62c('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xc62c('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xc62c('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xc62c('0x4')]},'priority':{'type':Sequelize[_0xc62c('0x5')](0x2)[_0xc62c('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xc62c('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xc62c('0x5')],'unique':_0xc62c('0x7')},'ListId':{'type':Sequelize[_0xc62c('0x5')],'unique':'contactListQueue'},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0xc62c('0x5')],'unique':_0xc62c('0x7')},'CampaignId':{'type':Sequelize[_0xc62c('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0xc62c('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xc62c('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xc62c('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xc62c('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe5e6=['exports','STRING','BOOLEAN','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','DATE','UNSIGNED','contactListQueue','sequelize'];(function(_0x51b96e,_0x1add51){var _0x46b4d9=function(_0x22572a){while(--_0x22572a){_0x51b96e['push'](_0x51b96e['shift']());}};_0x46b4d9(++_0x1add51);}(_0xe5e6,0x1e9));var _0x6e5e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe5e6[_0x20a584];return _0x4b41a8;};'use strict';var moment=require('moment');var Sequelize=require(_0x6e5e('0x0'));module[_0x6e5e('0x1')]={'phone':{'type':Sequelize[_0x6e5e('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x6e5e('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x6e5e('0x4')](_0x6e5e('0x5'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6e5e('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6e5e('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x6e5e('0x7')]},'priority':{'type':Sequelize[_0x6e5e('0x6')](0x2)[_0x6e5e('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x6e5e('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x6e5e('0x6')],'unique':_0x6e5e('0x9')},'ListId':{'type':Sequelize[_0x6e5e('0x6')],'unique':_0x6e5e('0x9')},'UserId':{'type':Sequelize[_0x6e5e('0x6')]},'VoiceQueueId':{'type':Sequelize[_0x6e5e('0x6')],'unique':_0x6e5e('0x9')},'CampaignId':{'type':Sequelize[_0x6e5e('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0x6e5e('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6e5e('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6e5e('0x6')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 01e6f2d..0c5c661 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 _0x43ec=['type','key','model','query','filters','concat','$and','$or','$gt','$gte','$lt','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$contained','$any','intersection','fields','attributes','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','name','includeAll','include','findAll','rows','catch','show','params','keys','length','options','find','create','body','update','describe','VoiceQueueId','CampaignId','Campaign','updatedAt','state','deleted','campaign','membername','UserId','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getPreview','preview','dialOrderByScheduledAt','sequelize','transaction','direction','prev','hopperIds','ASC','scheduledAt','DESC','literal','priority','findOne','scheduledat','CmCompany','CmList','List','VoiceQueue','dialActive','getOpenContacts','outbound','entity\x20not\x20found','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','save','then','destroy','error','stack','send','index','map','CmHopper','rawAttributes','fieldName'];(function(_0x17fdef,_0x596d74){var _0x437e3b=function(_0x5cc21c){while(--_0x5cc21c){_0x17fdef['push'](_0x17fdef['shift']());}};_0x437e3b(++_0x596d74);}(_0x43ec,0x17d));var _0xc43e=function(_0x4e8165,_0x4a0e3f){_0x4e8165=_0x4e8165-0x0;var _0x2e2213=_0x43ec[_0x4e8165];return _0x2e2213;};'use strict';var emlformat=require(_0xc43e('0x0'));var rimraf=require(_0xc43e('0x1'));var zipdir=require(_0xc43e('0x2'));var jsonpatch=require(_0xc43e('0x3'));var rp=require(_0xc43e('0x4'));var moment=require(_0xc43e('0x5'));var BPromise=require(_0xc43e('0x6'));var Mustache=require(_0xc43e('0x7'));var util=require(_0xc43e('0x8'));var path=require(_0xc43e('0x9'));var sox=require(_0xc43e('0xa'));var csv=require(_0xc43e('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc43e('0xc'));var _=require(_0xc43e('0xd'));var squel=require('squel');var crypto=require(_0xc43e('0xe'));var jsforce=require(_0xc43e('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xc43e('0xb'));var querystring=require('querystring');var Papa=require(_0xc43e('0x10'));var Redis=require(_0xc43e('0x11'));var authService=require(_0xc43e('0x12'));var qs=require(_0xc43e('0x13'));var as=require(_0xc43e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc43e('0x15'))(_0xc43e('0x16'));var utils=require(_0xc43e('0x17'));var config=require(_0xc43e('0x18'));var licenseUtil=require(_0xc43e('0x19'));var db=require(_0xc43e('0x1a'))['db'];function respondWithStatusCode(_0x3f9279,_0x138b7a){_0x138b7a=_0x138b7a||0xcc;return function(_0x465f48){if(_0x465f48){return _0x3f9279[_0xc43e('0x1b')](_0x138b7a);}return _0x3f9279[_0xc43e('0x1c')](_0x138b7a)[_0xc43e('0x1d')]();};}function respondWithResult(_0x240f4d,_0x9118ab){_0x9118ab=_0x9118ab||0xc8;return function(_0x529e5d){if(_0x529e5d){return _0x240f4d[_0xc43e('0x1c')](_0x9118ab)[_0xc43e('0x1e')](_0x529e5d);}};}function respondWithFilteredResult(_0x511e3c,_0x1f6cd7){return function(_0x432c21){if(_0x432c21){var _0x4b6682=typeof _0x1f6cd7['offset']===_0xc43e('0x1f')&&typeof _0x1f6cd7[_0xc43e('0x20')]==='undefined';var _0x413de3=_0x432c21[_0xc43e('0x21')];var _0x465b0b=_0x4b6682?0x0:_0x1f6cd7[_0xc43e('0x22')];var _0x556ce2=_0x4b6682?_0x432c21['count']:_0x1f6cd7[_0xc43e('0x22')]+_0x1f6cd7['limit'];var _0x5edd8d;if(_0x556ce2>=_0x413de3){_0x556ce2=_0x413de3;_0x5edd8d=0xc8;}else{_0x5edd8d=0xce;}_0x511e3c['status'](_0x5edd8d);return _0x511e3c[_0xc43e('0x23')]('Content-Range',_0x465b0b+'-'+_0x556ce2+'/'+_0x413de3)[_0xc43e('0x1e')](_0x432c21);}return null;};}function patchUpdates(_0x1279c3){return function(_0x2235c1){try{jsonpatch[_0xc43e('0x24')](_0x2235c1,_0x1279c3,!![]);}catch(_0x376134){return BPromise['reject'](_0x376134);}return _0x2235c1[_0xc43e('0x25')]();};}function saveUpdates(_0x5bacec,_0x33822e){return function(_0xf46241){if(_0xf46241){return _0xf46241['update'](_0x5bacec)[_0xc43e('0x26')](function(_0x15f790){return _0x15f790;});}return null;};}function removeEntity(_0x5819fa,_0x3c3b4d){return function(_0x270f63){if(_0x270f63){return _0x270f63[_0xc43e('0x27')]()[_0xc43e('0x26')](function(){_0x5819fa[_0xc43e('0x1c')](0xcc)[_0xc43e('0x1d')]();});}};}function handleEntityNotFound(_0x355533,_0x318c68){return function(_0x16b94f){if(!_0x16b94f){_0x355533[_0xc43e('0x1b')](0x194);}return _0x16b94f;};}function handleError(_0x2ffdce,_0x18b496){_0x18b496=_0x18b496||0x1f4;return function(_0x428708){logger[_0xc43e('0x28')](_0x428708[_0xc43e('0x29')]);if(_0x428708['name']){delete _0x428708['name'];}_0x2ffdce[_0xc43e('0x1c')](_0x18b496)[_0xc43e('0x2a')](_0x428708);};}exports[_0xc43e('0x2b')]=function(_0x1e802c,_0x5540b9){var _0x454af5={},_0x1e736f={},_0x91c27b={'count':0x0,'rows':[]};var _0x49b6ce=_[_0xc43e('0x2c')](db[_0xc43e('0x2d')][_0xc43e('0x2e')],function(_0x511819){return{'name':_0x511819[_0xc43e('0x2f')],'type':_0x511819[_0xc43e('0x30')][_0xc43e('0x31')]};});_0x1e736f[_0xc43e('0x32')]=_[_0xc43e('0x2c')](_0x49b6ce,'name');_0x1e736f[_0xc43e('0x33')]=_['keys'](_0x1e802c[_0xc43e('0x33')]);_0x1e736f[_0xc43e('0x34')]=_['intersection'](_0x1e736f['model'],_0x1e736f[_0xc43e('0x33')]);_0x1e736f[_0xc43e('0x34')]=_[_0xc43e('0x35')](_0x1e736f[_0xc43e('0x34')],[_0xc43e('0x36'),_0xc43e('0x37'),_0xc43e('0x38'),_0xc43e('0x39'),_0xc43e('0x3a'),'$lte','$ne',_0xc43e('0x3b'),_0xc43e('0x3c'),_0xc43e('0x3d'),_0xc43e('0x3e'),_0xc43e('0x3f'),_0xc43e('0x40'),_0xc43e('0x41'),_0xc43e('0x42'),_0xc43e('0x43'),_0xc43e('0x44'),'$like','$overlap','$contains',_0xc43e('0x45'),_0xc43e('0x46')]);_0x454af5['attributes']=_[_0xc43e('0x47')](_0x1e736f[_0xc43e('0x32')],qs[_0xc43e('0x48')](_0x1e802c[_0xc43e('0x33')]['fields']));_0x454af5[_0xc43e('0x49')]=_0x454af5[_0xc43e('0x49')]['length']?_0x454af5['attributes']:_0x1e736f['model'];if(!_0x1e802c[_0xc43e('0x33')][_0xc43e('0x4a')]('nolimit')){_0x454af5['limit']=qs['limit'](_0x1e802c[_0xc43e('0x33')][_0xc43e('0x20')]);_0x454af5[_0xc43e('0x22')]=qs[_0xc43e('0x22')](_0x1e802c[_0xc43e('0x33')][_0xc43e('0x22')]);}_0x454af5['order']=qs['sort'](_0x1e802c[_0xc43e('0x33')][_0xc43e('0x4b')]);_0x454af5[_0xc43e('0x4c')]=qs['filters'](_[_0xc43e('0x4d')](_0x1e802c[_0xc43e('0x33')],_0x1e736f['filters']),_0x49b6ce);if(_0x1e802c[_0xc43e('0x33')][_0xc43e('0x4e')]){_0x454af5[_0xc43e('0x4c')]=_[_0xc43e('0x4f')](_0x454af5[_0xc43e('0x4c')],{'$or':_[_0xc43e('0x2c')](_0x49b6ce,function(_0x539048){if(_0x539048['type']!==_0xc43e('0x50')){var _0xad3336={};_0xad3336[_0x539048[_0xc43e('0x51')]]={'$like':'%'+_0x1e802c[_0xc43e('0x33')][_0xc43e('0x4e')]+'%'};return _0xad3336;}})});}_0x454af5=_[_0xc43e('0x4f')]({},_0x454af5,_0x1e802c['options']);var _0xdf8047={'where':_0x454af5['where']};return db[_0xc43e('0x2d')][_0xc43e('0x21')](_0xdf8047)[_0xc43e('0x26')](function(_0x3f5d3c){_0x91c27b['count']=_0x3f5d3c;if(_0x1e802c[_0xc43e('0x33')][_0xc43e('0x52')]){_0x454af5[_0xc43e('0x53')]=[{'all':!![]}];}return db[_0xc43e('0x2d')][_0xc43e('0x54')](_0x454af5);})[_0xc43e('0x26')](function(_0x3436d2){_0x91c27b[_0xc43e('0x55')]=_0x3436d2;return _0x91c27b;})['then'](respondWithFilteredResult(_0x5540b9,_0x454af5))[_0xc43e('0x56')](handleError(_0x5540b9,null));};exports[_0xc43e('0x57')]=function(_0x25105b,_0x4041bf){var _0x6ed0da={'raw':!![],'where':{'id':_0x25105b[_0xc43e('0x58')]['id']}},_0x2beb41={};_0x2beb41[_0xc43e('0x32')]=_['keys'](db[_0xc43e('0x2d')][_0xc43e('0x2e')]);_0x2beb41[_0xc43e('0x33')]=_[_0xc43e('0x59')](_0x25105b[_0xc43e('0x33')]);_0x2beb41[_0xc43e('0x34')]=_['intersection'](_0x2beb41[_0xc43e('0x32')],_0x2beb41[_0xc43e('0x33')]);_0x6ed0da[_0xc43e('0x49')]=_[_0xc43e('0x47')](_0x2beb41['model'],qs[_0xc43e('0x48')](_0x25105b[_0xc43e('0x33')][_0xc43e('0x48')]));_0x6ed0da[_0xc43e('0x49')]=_0x6ed0da[_0xc43e('0x49')][_0xc43e('0x5a')]?_0x6ed0da['attributes']:_0x2beb41[_0xc43e('0x32')];if(_0x25105b['query'][_0xc43e('0x52')]){_0x6ed0da[_0xc43e('0x53')]=[{'all':!![]}];}_0x6ed0da=_[_0xc43e('0x4f')]({},_0x6ed0da,_0x25105b[_0xc43e('0x5b')]);return db[_0xc43e('0x2d')][_0xc43e('0x5c')](_0x6ed0da)['then'](handleEntityNotFound(_0x4041bf,null))[_0xc43e('0x26')](respondWithResult(_0x4041bf,null))[_0xc43e('0x56')](handleError(_0x4041bf,null));};exports['create']=function(_0x26bdd9,_0x6ed44d){return db['CmHopper'][_0xc43e('0x5d')](_0x26bdd9[_0xc43e('0x5e')],{})[_0xc43e('0x26')](respondWithResult(_0x6ed44d,0xc9))[_0xc43e('0x56')](handleError(_0x6ed44d,null));};exports[_0xc43e('0x5f')]=function(_0x708b16,_0x19b769){if(_0x708b16[_0xc43e('0x5e')]['id']){delete _0x708b16[_0xc43e('0x5e')]['id'];}return db['CmHopper'][_0xc43e('0x5c')]({'where':{'id':_0x708b16[_0xc43e('0x58')]['id']}})['then'](handleEntityNotFound(_0x19b769,null))[_0xc43e('0x26')](saveUpdates(_0x708b16[_0xc43e('0x5e')],null))[_0xc43e('0x26')](respondWithResult(_0x19b769,null))[_0xc43e('0x56')](handleError(_0x19b769,null));};exports[_0xc43e('0x60')]=function(_0x18adfd,_0x271d09){return db['CmHopper'][_0xc43e('0x60')]()[_0xc43e('0x26')](respondWithResult(_0x271d09,null))['catch'](handleError(_0x271d09,null));};exports[_0xc43e('0x27')]=function(_0x5b3ad6,_0x320b97){var _0x1ffe2c;return db[_0xc43e('0x2d')][_0xc43e('0x5c')]({'where':{'id':_0x5b3ad6[_0xc43e('0x58')]['id']}})[_0xc43e('0x26')](handleEntityNotFound(_0x320b97,null))[_0xc43e('0x26')](function(_0x45c2ee){if(_0x45c2ee){return _0x45c2ee['destroy']()[_0xc43e('0x26')](function(_0x1354de){return _0x1354de;});}})['then'](function(_0x4ee365){_0x1ffe2c=_0x4ee365;if(_0x4ee365){if(_0x4ee365[_0xc43e('0x61')]||_0x4ee365[_0xc43e('0x62')]){return db[_0x4ee365['VoiceQueueId']?'VoiceQueue':_0xc43e('0x63')][_0xc43e('0x5c')]({'where':{'id':_0x4ee365[_0xc43e('0x61')]?_0x4ee365[_0xc43e('0x61')]:_0x4ee365['CampaignId']},'attributes':['id',_0xc43e('0x51')],'raw':!![]});}}})['then'](function(_0x2fe9c1){var _0x34b62f={};if(_0x2fe9c1){_[_0xc43e('0x4f')](_0x34b62f,_['omit'](_0x1ffe2c['dataValues'],['createdAt',_0xc43e('0x64'),'id']));_0x34b62f[_0xc43e('0x65')]=0x15;_0x34b62f['statedesc']=_0xc43e('0x66');_0x34b62f[_0xc43e('0x67')]=_0x2fe9c1[_0xc43e('0x51')];_0x34b62f[_0xc43e('0x68')]=_0x5b3ad6['user']['name'];_0x34b62f[_0xc43e('0x69')]=_0x5b3ad6[_0xc43e('0x6a')]['id'];_0x34b62f[_0xc43e('0x66')]=!![];_0x34b62f[_0xc43e('0x6b')]=moment()[_0xc43e('0x6c')](_0xc43e('0x6d'));_0x34b62f[_0xc43e('0x6e')]=_0x1ffe2c['phone'];_0x34b62f[_0xc43e('0x6f')]=_0x1ffe2c[_0xc43e('0x61')]?'queue':'ivr';return db[_0xc43e('0x70')][_0xc43e('0x5c')]({'where':{'id':_0x34b62f[_0xc43e('0x71')]},'attributes':[_0xc43e('0x72'),_0xc43e('0x73')]})['then'](function(_0x3802f5){if(!_[_0xc43e('0x74')](_0x320b97)&&!_[_0xc43e('0x74')](_0x3802f5[_0xc43e('0x72')])){_0x34b62f[_0xc43e('0x75')]=_0x3802f5['firstName'];if(!_['isNil'](_0x3802f5[_0xc43e('0x73')])){_0x34b62f['calleridname']+='\x20'+_0x3802f5[_0xc43e('0x73')];}}})[_0xc43e('0x76')](function(){return db[_0xc43e('0x77')][_0xc43e('0x5d')](_0x34b62f);});}})[_0xc43e('0x26')](function(){return _0x320b97[_0xc43e('0x1c')](0xcc)[_0xc43e('0x1d')]();})[_0xc43e('0x56')](handleError(_0x320b97,null));};exports[_0xc43e('0x78')]=function(_0x3dd224,_0x2d8bfd,_0x1dee24){var _0x48a2e3=[];return db[_0xc43e('0x70')][_0xc43e('0x60')]()[_0xc43e('0x26')](function(_0x7b2064){_0x48a2e3=_[_0xc43e('0x59')](_0x7b2064);return _0x3dd224[_0xc43e('0x6a')]['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xc43e('0x79')},'attributes':['id',_0xc43e('0x7a')],'raw':!![]});})[_0xc43e('0x26')](function(_0x4b9aff){if(_0x4b9aff&&_0x4b9aff[_0xc43e('0x5a')]){return db[_0xc43e('0x7b')][_0xc43e('0x7c')](function(_0x21698d){var _0x1a2c57={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xc43e('0x6c')](_0xc43e('0x6d'))},'VoiceQueueId':{'$in':_[_0xc43e('0x2c')](_0x4b9aff,'id')},'$or':[{'UserId':null},{'UserId':_0x3dd224[_0xc43e('0x6a')]['id']}]};var _0x1f41f7=[];if(_0x3dd224[_0xc43e('0x5e')][_0xc43e('0x7d')]&&_0x3dd224[_0xc43e('0x5e')]['direction']===_0xc43e('0x7e')){if(!_['isEmpty'](_0x3dd224[_0xc43e('0x5e')]['hopperIds'])){_0x1a2c57['id']={'$in':_0x3dd224[_0xc43e('0x5e')][_0xc43e('0x7f')]};}_0x1f41f7=[['priority',_0xc43e('0x80')],[_0xc43e('0x81'),_0x4b9aff[0x0][_0xc43e('0x7a')]==='ASC'?_0xc43e('0x82'):_0xc43e('0x80')],db[_0xc43e('0x7b')][_0xc43e('0x83')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0xc43e('0x82')]];}else{if(!_['isEmpty'](_0x3dd224[_0xc43e('0x5e')]['hopperIds'])){_0x1a2c57['id']={'$notIn':_0x3dd224['body'][_0xc43e('0x7f')]};}_0x1f41f7=[[_0xc43e('0x84'),_0xc43e('0x82')],['scheduledAt',_0x4b9aff[0x0][_0xc43e('0x7a')]],db['sequelize'][_0xc43e('0x83')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0xc43e('0x80')]];}return db['CmHopper'][_0xc43e('0x85')]({'attributes':['id',_0xc43e('0x86')],'where':_0x1a2c57,'order':_0x1f41f7,'transaction':_0x21698d,'lock':_0x21698d['LOCK']['UPDATE'],'include':[{'model':db[_0xc43e('0x70')],'as':'Contact','attributes':_0x48a2e3,'include':[{'model':db[_0xc43e('0x87')],'as':'Company','attributes':['id',_0xc43e('0x51')]}]},{'model':db[_0xc43e('0x88')],'as':_0xc43e('0x89'),'attributes':['id',_0xc43e('0x51')]},{'model':db[_0xc43e('0x8a')],'as':'Queue','attributes':['id','name',_0xc43e('0x8b')]}]})['then'](function(_0x108461){if(_0x108461){return _0x108461[_0xc43e('0x5f')]({'UserId':_0x3dd224[_0xc43e('0x6a')]['id']},{'transaction':_0x21698d});}});});}})['then'](handleEntityNotFound(_0x2d8bfd,null))[_0xc43e('0x26')](respondWithResult(_0x2d8bfd,null))['catch'](handleError(_0x2d8bfd,null));};exports[_0xc43e('0x8c')]=function(_0x62072f,_0x20f3b0,_0x5e2d1f){return _0x62072f[_0xc43e('0x6a')]['getVoiceQueues']({'where':{'type':_0xc43e('0x8d'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0xc43e('0x26')](function(_0x511f87){if(_0x511f87&&_0x511f87[_0xc43e('0x5a')]){return db[_0xc43e('0x2d')][_0xc43e('0x21')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xc43e('0x6c')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0xc43e('0x2c')](_0x511f87,'id')},'$or':[{'UserId':null},{'UserId':_0x62072f[_0xc43e('0x6a')]['id']}]}});}return 0x0;})[_0xc43e('0x26')](function(_0x4924f8){if(!_[_0xc43e('0x74')](_0x4924f8)&&_['isNumber'](_0x4924f8)){return _0x20f3b0['status'](0xc8)[_0xc43e('0x1e')]({'contacts':_0x4924f8});}else{logger[_0xc43e('0x28')]('CmHopper,\x20%s,\x20%s,\x20%s',_0xc43e('0x8c'),0x194,_0xc43e('0x8e'));_0x20f3b0[_0xc43e('0x1b')](0x194);}})['catch'](handleError(_0x20f3b0,null));}; \ No newline at end of file +var _0x8b47=['merge','VIRTUAL','options','findAll','rows','catch','show','params','keys','includeAll','include','find','create','body','describe','CampaignId','VoiceQueueId','VoiceQueue','omit','createdAt','statedesc','user','UserId','deletedat','YYYY-MM-DD\x20HH:mm:ss','phone','queue','ivr','CmContact','ContactId','lastName','isNil','firstName','calleridname','finally','getPreview','sequelize','format','direction','prev','hopperIds','priority','ASC','scheduledAt','dialOrderByScheduledAt','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','isEmpty','COALESCE(CmHopper.UserId,\x200)\x20DESC','UPDATE','CmList','dialActive','getOpenContacts','getVoiceQueues','preview','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','error','name','send','index','CmHopper','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','$gt','$gte','$lt','$lte','$notBetween','$in','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x1c30aa,_0x4cd5e8){var _0x27731e=function(_0x2d07d8){while(--_0x2d07d8){_0x1c30aa['push'](_0x1c30aa['shift']());}};_0x27731e(++_0x4cd5e8);}(_0x8b47,0xbe));var _0x78b4=function(_0x4fb9ae,_0x4d2b95){_0x4fb9ae=_0x4fb9ae-0x0;var _0x4e4be7=_0x8b47[_0x4fb9ae];return _0x4e4be7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x78b4('0x0'));var jsonpatch=require(_0x78b4('0x1'));var rp=require(_0x78b4('0x2'));var moment=require(_0x78b4('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x78b4('0x4'));var path=require('path');var sox=require(_0x78b4('0x5'));var csv=require(_0x78b4('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x78b4('0x7'));var _=require(_0x78b4('0x8'));var squel=require(_0x78b4('0x9'));var crypto=require(_0x78b4('0xa'));var jsforce=require(_0x78b4('0xb'));var deskjs=require(_0x78b4('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x78b4('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x78b4('0xe'));var as=require(_0x78b4('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x78b4('0x10'))(_0x78b4('0x11'));var utils=require(_0x78b4('0x12'));var config=require(_0x78b4('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x78b4('0x14'))['db'];function respondWithStatusCode(_0x3f8835,_0x39bd44){_0x39bd44=_0x39bd44||0xcc;return function(_0x1556c4){if(_0x1556c4){return _0x3f8835[_0x78b4('0x15')](_0x39bd44);}return _0x3f8835[_0x78b4('0x16')](_0x39bd44)[_0x78b4('0x17')]();};}function respondWithResult(_0x2866ab,_0x3751a6){_0x3751a6=_0x3751a6||0xc8;return function(_0x31c3d6){if(_0x31c3d6){return _0x2866ab['status'](_0x3751a6)['json'](_0x31c3d6);}};}function respondWithFilteredResult(_0x3b5a2e,_0x4a1606){return function(_0x226dad){if(_0x226dad){var _0x624540=typeof _0x4a1606[_0x78b4('0x18')]==='undefined'&&typeof _0x4a1606[_0x78b4('0x19')]==='undefined';var _0x2e4c37=_0x226dad[_0x78b4('0x1a')];var _0x434a25=_0x624540?0x0:_0x4a1606[_0x78b4('0x18')];var _0x2b35f8=_0x624540?_0x226dad['count']:_0x4a1606[_0x78b4('0x18')]+_0x4a1606[_0x78b4('0x19')];var _0x514daf;if(_0x2b35f8>=_0x2e4c37){_0x2b35f8=_0x2e4c37;_0x514daf=0xc8;}else{_0x514daf=0xce;}_0x3b5a2e[_0x78b4('0x16')](_0x514daf);return _0x3b5a2e[_0x78b4('0x1b')](_0x78b4('0x1c'),_0x434a25+'-'+_0x2b35f8+'/'+_0x2e4c37)[_0x78b4('0x1d')](_0x226dad);}return null;};}function patchUpdates(_0x26c4dc){return function(_0x400bd3){try{jsonpatch[_0x78b4('0x1e')](_0x400bd3,_0x26c4dc,!![]);}catch(_0xf0b5cf){return BPromise[_0x78b4('0x1f')](_0xf0b5cf);}return _0x400bd3[_0x78b4('0x20')]();};}function saveUpdates(_0x18cd9e,_0x4dbc3a){return function(_0x1e423f){if(_0x1e423f){return _0x1e423f[_0x78b4('0x21')](_0x18cd9e)['then'](function(_0x40b6d5){return _0x40b6d5;});}return null;};}function removeEntity(_0x5f04cb,_0x35a1eb){return function(_0x3d31cc){if(_0x3d31cc){return _0x3d31cc[_0x78b4('0x22')]()[_0x78b4('0x23')](function(){_0x5f04cb[_0x78b4('0x16')](0xcc)[_0x78b4('0x17')]();});}};}function handleEntityNotFound(_0x2d0f4,_0x319e0a){return function(_0x455bc0){if(!_0x455bc0){_0x2d0f4['sendStatus'](0x194);}return _0x455bc0;};}function handleError(_0x1c1755,_0x45c3ef){_0x45c3ef=_0x45c3ef||0x1f4;return function(_0x160ba0){logger[_0x78b4('0x24')](_0x160ba0['stack']);if(_0x160ba0[_0x78b4('0x25')]){delete _0x160ba0[_0x78b4('0x25')];}_0x1c1755[_0x78b4('0x16')](_0x45c3ef)[_0x78b4('0x26')](_0x160ba0);};}exports[_0x78b4('0x27')]=function(_0x23ad59,_0x2d4eef){var _0x5de5b2={},_0x32b44e={},_0x510218={'count':0x0,'rows':[]};var _0x5b4d4e=_['map'](db[_0x78b4('0x28')][_0x78b4('0x29')],function(_0xb62e16){return{'name':_0xb62e16[_0x78b4('0x2a')],'type':_0xb62e16[_0x78b4('0x2b')][_0x78b4('0x2c')]};});_0x32b44e[_0x78b4('0x2d')]=_[_0x78b4('0x2e')](_0x5b4d4e,'name');_0x32b44e['query']=_['keys'](_0x23ad59[_0x78b4('0x2f')]);_0x32b44e[_0x78b4('0x30')]=_[_0x78b4('0x31')](_0x32b44e[_0x78b4('0x2d')],_0x32b44e['query']);_0x32b44e['filters']=_['concat'](_0x32b44e[_0x78b4('0x30')],['$and','$or',_0x78b4('0x32'),_0x78b4('0x33'),_0x78b4('0x34'),_0x78b4('0x35'),'$ne','$eq','$not','$between',_0x78b4('0x36'),_0x78b4('0x37'),'$notIn',_0x78b4('0x38'),_0x78b4('0x39'),_0x78b4('0x3a'),_0x78b4('0x3b'),_0x78b4('0x38'),_0x78b4('0x3c'),_0x78b4('0x3d'),_0x78b4('0x3e'),_0x78b4('0x3f')]);_0x5de5b2[_0x78b4('0x40')]=_[_0x78b4('0x31')](_0x32b44e[_0x78b4('0x2d')],qs[_0x78b4('0x41')](_0x23ad59[_0x78b4('0x2f')][_0x78b4('0x41')]));_0x5de5b2['attributes']=_0x5de5b2['attributes'][_0x78b4('0x42')]?_0x5de5b2[_0x78b4('0x40')]:_0x32b44e['model'];if(!_0x23ad59['query'][_0x78b4('0x43')](_0x78b4('0x44'))){_0x5de5b2['limit']=qs['limit'](_0x23ad59[_0x78b4('0x2f')][_0x78b4('0x19')]);_0x5de5b2['offset']=qs['offset'](_0x23ad59[_0x78b4('0x2f')]['offset']);}_0x5de5b2[_0x78b4('0x45')]=qs[_0x78b4('0x46')](_0x23ad59[_0x78b4('0x2f')]['sort']);_0x5de5b2[_0x78b4('0x47')]=qs[_0x78b4('0x30')](_[_0x78b4('0x48')](_0x23ad59[_0x78b4('0x2f')],_0x32b44e[_0x78b4('0x30')]),_0x5b4d4e);if(_0x23ad59['query'][_0x78b4('0x49')]){_0x5de5b2[_0x78b4('0x47')]=_[_0x78b4('0x4a')](_0x5de5b2[_0x78b4('0x47')],{'$or':_['map'](_0x5b4d4e,function(_0x96b744){if(_0x96b744['type']!==_0x78b4('0x4b')){var _0x4134ba={};_0x4134ba[_0x96b744[_0x78b4('0x25')]]={'$like':'%'+_0x23ad59[_0x78b4('0x2f')][_0x78b4('0x49')]+'%'};return _0x4134ba;}})});}_0x5de5b2=_[_0x78b4('0x4a')]({},_0x5de5b2,_0x23ad59[_0x78b4('0x4c')]);var _0x2b380f={'where':_0x5de5b2['where']};return db[_0x78b4('0x28')][_0x78b4('0x1a')](_0x2b380f)[_0x78b4('0x23')](function(_0x5cf3f2){_0x510218[_0x78b4('0x1a')]=_0x5cf3f2;if(_0x23ad59[_0x78b4('0x2f')]['includeAll']){_0x5de5b2['include']=[{'all':!![]}];}return db[_0x78b4('0x28')][_0x78b4('0x4d')](_0x5de5b2);})[_0x78b4('0x23')](function(_0x3d4d62){_0x510218[_0x78b4('0x4e')]=_0x3d4d62;return _0x510218;})['then'](respondWithFilteredResult(_0x2d4eef,_0x5de5b2))[_0x78b4('0x4f')](handleError(_0x2d4eef,null));};exports[_0x78b4('0x50')]=function(_0x37316f,_0x3ff0b5){var _0x4714d6={'raw':!![],'where':{'id':_0x37316f[_0x78b4('0x51')]['id']}},_0x27b65e={};_0x27b65e['model']=_[_0x78b4('0x52')](db[_0x78b4('0x28')]['rawAttributes']);_0x27b65e[_0x78b4('0x2f')]=_[_0x78b4('0x52')](_0x37316f['query']);_0x27b65e['filters']=_[_0x78b4('0x31')](_0x27b65e[_0x78b4('0x2d')],_0x27b65e[_0x78b4('0x2f')]);_0x4714d6['attributes']=_[_0x78b4('0x31')](_0x27b65e['model'],qs[_0x78b4('0x41')](_0x37316f[_0x78b4('0x2f')]['fields']));_0x4714d6[_0x78b4('0x40')]=_0x4714d6['attributes'][_0x78b4('0x42')]?_0x4714d6[_0x78b4('0x40')]:_0x27b65e['model'];if(_0x37316f[_0x78b4('0x2f')][_0x78b4('0x53')]){_0x4714d6[_0x78b4('0x54')]=[{'all':!![]}];}_0x4714d6=_[_0x78b4('0x4a')]({},_0x4714d6,_0x37316f[_0x78b4('0x4c')]);return db[_0x78b4('0x28')][_0x78b4('0x55')](_0x4714d6)[_0x78b4('0x23')](handleEntityNotFound(_0x3ff0b5,null))[_0x78b4('0x23')](respondWithResult(_0x3ff0b5,null))[_0x78b4('0x4f')](handleError(_0x3ff0b5,null));};exports['create']=function(_0x5f0a55,_0x5a27db){return db['CmHopper'][_0x78b4('0x56')](_0x5f0a55[_0x78b4('0x57')],{})['then'](respondWithResult(_0x5a27db,0xc9))['catch'](handleError(_0x5a27db,null));};exports['update']=function(_0x1e88a2,_0x86aa45){if(_0x1e88a2[_0x78b4('0x57')]['id']){delete _0x1e88a2['body']['id'];}return db['CmHopper'][_0x78b4('0x55')]({'where':{'id':_0x1e88a2[_0x78b4('0x51')]['id']}})[_0x78b4('0x23')](handleEntityNotFound(_0x86aa45,null))[_0x78b4('0x23')](saveUpdates(_0x1e88a2[_0x78b4('0x57')],null))[_0x78b4('0x23')](respondWithResult(_0x86aa45,null))[_0x78b4('0x4f')](handleError(_0x86aa45,null));};exports[_0x78b4('0x58')]=function(_0x1be1ea,_0x5b3e9f){return db['CmHopper'][_0x78b4('0x58')]()[_0x78b4('0x23')](respondWithResult(_0x5b3e9f,null))[_0x78b4('0x4f')](handleError(_0x5b3e9f,null));};exports['destroy']=function(_0x48986d,_0x4482e4){var _0x139a45;return db[_0x78b4('0x28')][_0x78b4('0x55')]({'where':{'id':_0x48986d[_0x78b4('0x51')]['id']}})[_0x78b4('0x23')](handleEntityNotFound(_0x4482e4,null))[_0x78b4('0x23')](function(_0x5f44d2){if(_0x5f44d2){return _0x5f44d2['destroy']()['then'](function(_0x447628){return _0x447628;});}})[_0x78b4('0x23')](function(_0x49d313){_0x139a45=_0x49d313;if(_0x49d313){if(_0x49d313['VoiceQueueId']||_0x49d313[_0x78b4('0x59')]){return db[_0x49d313[_0x78b4('0x5a')]?_0x78b4('0x5b'):'Campaign']['find']({'where':{'id':_0x49d313[_0x78b4('0x5a')]?_0x49d313[_0x78b4('0x5a')]:_0x49d313[_0x78b4('0x59')]},'attributes':['id',_0x78b4('0x25')],'raw':!![]});}}})[_0x78b4('0x23')](function(_0x57cef9){var _0xc19621={};if(_0x57cef9){_['merge'](_0xc19621,_[_0x78b4('0x5c')](_0x139a45['dataValues'],[_0x78b4('0x5d'),'updatedAt','id']));_0xc19621['state']=0x15;_0xc19621[_0x78b4('0x5e')]='deleted';_0xc19621['campaign']=_0x57cef9[_0x78b4('0x25')];_0xc19621['membername']=_0x48986d[_0x78b4('0x5f')][_0x78b4('0x25')];_0xc19621[_0x78b4('0x60')]=_0x48986d[_0x78b4('0x5f')]['id'];_0xc19621['deleted']=!![];_0xc19621[_0x78b4('0x61')]=moment()['format'](_0x78b4('0x62'));_0xc19621['calleridnum']=_0x139a45[_0x78b4('0x63')];_0xc19621['campaigntype']=_0x139a45[_0x78b4('0x5a')]?_0x78b4('0x64'):_0x78b4('0x65');return db[_0x78b4('0x66')][_0x78b4('0x55')]({'where':{'id':_0xc19621[_0x78b4('0x67')]},'attributes':['firstName',_0x78b4('0x68')]})[_0x78b4('0x23')](function(_0x1f04a5){if(!_[_0x78b4('0x69')](_0x4482e4)&&!_['isNil'](_0x1f04a5[_0x78b4('0x6a')])){_0xc19621[_0x78b4('0x6b')]=_0x1f04a5[_0x78b4('0x6a')];if(!_[_0x78b4('0x69')](_0x1f04a5['lastName'])){_0xc19621[_0x78b4('0x6b')]+='\x20'+_0x1f04a5[_0x78b4('0x68')];}}})[_0x78b4('0x6c')](function(){return db['CmHopperFinal']['create'](_0xc19621);});}})['then'](function(){return _0x4482e4[_0x78b4('0x16')](0xcc)[_0x78b4('0x17')]();})[_0x78b4('0x4f')](handleError(_0x4482e4,null));};exports[_0x78b4('0x6d')]=function(_0x496896,_0x33836f,_0x4f9a4c){var _0x42d6c1=[];return db[_0x78b4('0x66')][_0x78b4('0x58')]()[_0x78b4('0x23')](function(_0x3c37f5){_0x42d6c1=_[_0x78b4('0x52')](_0x3c37f5);return _0x496896['user']['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id','dialOrderByScheduledAt'],'raw':!![]});})['then'](function(_0x4721b5){if(_0x4721b5&&_0x4721b5[_0x78b4('0x42')]){return db[_0x78b4('0x6e')]['transaction'](function(_0x439383){var _0x5d13bd={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x78b4('0x6f')](_0x78b4('0x62'))},'VoiceQueueId':{'$in':_['map'](_0x4721b5,'id')},'$or':[{'UserId':null},{'UserId':_0x496896[_0x78b4('0x5f')]['id']}]};var _0x2b6c72=[];if(_0x496896['body']['direction']&&_0x496896[_0x78b4('0x57')][_0x78b4('0x70')]===_0x78b4('0x71')){if(!_['isEmpty'](_0x496896['body'][_0x78b4('0x72')])){_0x5d13bd['id']={'$in':_0x496896['body'][_0x78b4('0x72')]};}_0x2b6c72=[[_0x78b4('0x73'),_0x78b4('0x74')],[_0x78b4('0x75'),_0x4721b5[0x0][_0x78b4('0x76')]==='ASC'?'DESC':_0x78b4('0x74')],db['sequelize'][_0x78b4('0x77')](_0x78b4('0x78')),['id',_0x78b4('0x79')]];}else{if(!_[_0x78b4('0x7a')](_0x496896[_0x78b4('0x57')][_0x78b4('0x72')])){_0x5d13bd['id']={'$notIn':_0x496896[_0x78b4('0x57')]['hopperIds']};}_0x2b6c72=[[_0x78b4('0x73'),_0x78b4('0x79')],[_0x78b4('0x75'),_0x4721b5[0x0]['dialOrderByScheduledAt']],db[_0x78b4('0x6e')][_0x78b4('0x77')](_0x78b4('0x7b')),['id','ASC']];}return db[_0x78b4('0x28')]['findOne']({'attributes':['id','scheduledat'],'where':_0x5d13bd,'order':_0x2b6c72,'transaction':_0x439383,'lock':_0x439383['LOCK'][_0x78b4('0x7c')],'include':[{'model':db[_0x78b4('0x66')],'as':'Contact','attributes':_0x42d6c1,'include':[{'model':db['CmCompany'],'as':'Company','attributes':['id',_0x78b4('0x25')]}]},{'model':db[_0x78b4('0x7d')],'as':'List','attributes':['id','name']},{'model':db[_0x78b4('0x5b')],'as':'Queue','attributes':['id',_0x78b4('0x25'),_0x78b4('0x7e')]}]})[_0x78b4('0x23')](function(_0x340172){if(_0x340172){return _0x340172['update']({'UserId':_0x496896[_0x78b4('0x5f')]['id']},{'transaction':_0x439383});}});});}})['then'](handleEntityNotFound(_0x33836f,null))['then'](respondWithResult(_0x33836f,null))[_0x78b4('0x4f')](handleError(_0x33836f,null));};exports[_0x78b4('0x7f')]=function(_0x4cf420,_0x1d1899,_0x28520b){return _0x4cf420[_0x78b4('0x5f')][_0x78b4('0x80')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x78b4('0x81')},'attributes':['id'],'raw':!![]})['then'](function(_0xe1dbbb){if(_0xe1dbbb&&_0xe1dbbb[_0x78b4('0x42')]){return db[_0x78b4('0x28')][_0x78b4('0x1a')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x78b4('0x6f')](_0x78b4('0x62'))},'VoiceQueueId':{'$in':_[_0x78b4('0x2e')](_0xe1dbbb,'id')},'$or':[{'UserId':null},{'UserId':_0x4cf420[_0x78b4('0x5f')]['id']}]}});}return 0x0;})[_0x78b4('0x23')](function(_0x4242d3){if(!_[_0x78b4('0x69')](_0x4242d3)&&_['isNumber'](_0x4242d3)){return _0x1d1899[_0x78b4('0x16')](0xc8)['json']({'contacts':_0x4242d3});}else{logger[_0x78b4('0x24')](_0x78b4('0x82'),_0x78b4('0x7f'),0x194,_0x78b4('0x83'));_0x1d1899[_0x78b4('0x15')](0x194);}})['catch'](handleError(_0x1d1899,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index ddb6e6a..f90f1e3 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 _0x814b=['phone','priority','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','scheduledat'];(function(_0x3e231b,_0x126ff3){var _0x867a46=function(_0x21ca7a){while(--_0x21ca7a){_0x3e231b['push'](_0x3e231b['shift']());}};_0x867a46(++_0x126ff3);}(_0x814b,0x1a2));var _0xb814=function(_0x7642c,_0x2ec4b0){_0x7642c=_0x7642c-0x0;var _0x5412fd=_0x814b[_0x7642c];return _0x5412fd;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]},{'name':_0xb814('0xe'),'fields':[_0xb814('0xe')]},{'name':_0xb814('0xf'),'fields':[_0xb814('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5d58=['priority','bluebird','request-promise','rimraf','../../config/environment','exports','define','cm_hopper','scheduledat','phone'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5d58,0x187));var _0x85d5=function(_0x4950b8,_0x15aadf){_0x4950b8=_0x4950b8-0x0;var _0x19a4b5=_0x5d58[_0x4950b8];return _0x19a4b5;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x85d5('0x0'));var rp=require(_0x85d5('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x85d5('0x2'));var config=require(_0x85d5('0x3'));var attributes=require('./cmHopper.attributes');module[_0x85d5('0x4')]=function(_0x2d457a,_0x578fad){return _0x2d457a[_0x85d5('0x5')]('CmHopper',attributes,{'tableName':_0x85d5('0x6'),'paranoid':![],'indexes':[{'name':_0x85d5('0x7'),'fields':['scheduledat']},{'name':_0x85d5('0x8'),'fields':['phone']},{'name':_0x85d5('0x9'),'fields':[_0x85d5('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 32f9c32..8a5bc09 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 _0x3335=['order','LOCK','UPDATE','CmContact','Contact','keys','User','Agent','name','voicePause','length','UserId','includes','push','all','MoveContactManagedDialer','transaction','CmHopperFinal','create','destroy','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','describe','GetCmHopperPreview','lodash','bluebird','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','CmHopper,\x20%s,\x20%s','message','request\x20sent','catch','findAll','options','where','attributes','limit','map','include','model','GetCmHopper','debug','CmHopper','raw','ShowCmHopper','CreateCmHopper','body','UpdateCmHopper','update','DestroyCmHopper','GetContactDialer','sequelize'];(function(_0x2824ae,_0x42ca51){var _0x2cc86f=function(_0x1ca716){while(--_0x1ca716){_0x2824ae['push'](_0x2824ae['shift']());}};_0x2cc86f(++_0x42ca51);}(_0x3335,0x66));var _0x5333=function(_0x245afe,_0x319cde){_0x245afe=_0x245afe-0x0;var _0x4eefde=_0x3335[_0x245afe];return _0x4eefde;};'use strict';var _=require(_0x5333('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5333('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5333('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5333('0x3'))('rpc');var config=require(_0x5333('0x4'));var jayson=require(_0x5333('0x5'));var client=jayson[_0x5333('0x6')][_0x5333('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x54570c,_0x4d7eb6,_0x7459fe){return new BPromise(function(_0x3d3ab0,_0x5a5214){return client[_0x5333('0x8')](_0x54570c,_0x7459fe)[_0x5333('0x9')](function(_0x3fb8e7){logger[_0x5333('0xa')]('CmHopper,\x20%s,\x20%s',_0x4d7eb6,'request\x20sent');logger['debug'](_0x5333('0xb'),_0x4d7eb6,'request\x20sent',JSON[_0x5333('0xc')](_0x3fb8e7));if(_0x3fb8e7[_0x5333('0xd')]){if(_0x3fb8e7['error']['code']===0x1f4){logger['error'](_0x5333('0xe'),_0x4d7eb6,_0x3fb8e7['error'][_0x5333('0xf')]);return _0x5a5214(_0x3fb8e7[_0x5333('0xd')][_0x5333('0xf')]);}logger[_0x5333('0xd')](_0x5333('0xe'),_0x4d7eb6,_0x3fb8e7['error'][_0x5333('0xf')]);return _0x3d3ab0(_0x3fb8e7[_0x5333('0xd')]['message']);}else{logger[_0x5333('0xa')](_0x5333('0xe'),_0x4d7eb6,_0x5333('0x10'));_0x3d3ab0(_0x3fb8e7['result'][_0x5333('0xf')]);}})[_0x5333('0x11')](function(_0x56b355){logger[_0x5333('0xd')](_0x5333('0xe'),_0x4d7eb6,_0x56b355);_0x5a5214(_0x56b355);});});}exports['GetCmHopper']=function(_0x55d8f4){var _0x5963f9=this;return new Promise(function(_0x2e2cc4,_0x52ab3b){return db['CmHopper'][_0x5333('0x12')]({'raw':_0x55d8f4[_0x5333('0x13')]?_0x55d8f4[_0x5333('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x55d8f4[_0x5333('0x13')]?_0x55d8f4[_0x5333('0x13')][_0x5333('0x14')]||null:null,'attributes':_0x55d8f4['options']?_0x55d8f4[_0x5333('0x13')][_0x5333('0x15')]||null:null,'limit':_0x55d8f4['options']?_0x55d8f4[_0x5333('0x13')][_0x5333('0x16')]||null:null,'include':_0x55d8f4[_0x5333('0x13')]?_0x55d8f4[_0x5333('0x13')]['include']?_[_0x5333('0x17')](_0x55d8f4[_0x5333('0x13')][_0x5333('0x18')],function(_0x1d1a4a){return{'model':db[_0x1d1a4a[_0x5333('0x19')]],'as':_0x1d1a4a['as'],'attributes':_0x1d1a4a[_0x5333('0x15')],'include':_0x1d1a4a[_0x5333('0x18')]?_[_0x5333('0x17')](_0x1d1a4a[_0x5333('0x18')],function(_0x4d95e0){return{'model':db[_0x4d95e0['model']],'as':_0x4d95e0['as'],'attributes':_0x4d95e0[_0x5333('0x15')],'include':_0x4d95e0['include']?_[_0x5333('0x17')](_0x4d95e0[_0x5333('0x18')],function(_0x5a7469){return{'model':db[_0x5a7469[_0x5333('0x19')]],'as':_0x5a7469['as'],'attributes':_0x5a7469['attributes']};}):[]};}):[]};}):[]:[]})[_0x5333('0x9')](function(_0x198abb){logger[_0x5333('0xa')](_0x5333('0x1a'),_0x55d8f4);logger[_0x5333('0x1b')](_0x5333('0x1a'),_0x55d8f4,JSON[_0x5333('0xc')](_0x198abb));_0x2e2cc4(_0x198abb);})[_0x5333('0x11')](function(_0x3ccce8){logger[_0x5333('0xd')](_0x5333('0x1a'),_0x3ccce8['message'],_0x55d8f4);_0x52ab3b(_0x5963f9['error'](0x1f4,_0x3ccce8[_0x5333('0xf')]));});});};exports['ShowCmHopper']=function(_0x37417b){var _0x10ec59=this;return new Promise(function(_0x53e5aa,_0x518a0d){return db[_0x5333('0x1c')]['find']({'raw':_0x37417b[_0x5333('0x13')]?_0x37417b['options'][_0x5333('0x1d')]===undefined?!![]:![]:!![],'where':_0x37417b['options']?_0x37417b[_0x5333('0x13')][_0x5333('0x14')]||null:null,'attributes':_0x37417b[_0x5333('0x13')]?_0x37417b[_0x5333('0x13')][_0x5333('0x15')]||null:null,'include':_0x37417b['options']?_0x37417b[_0x5333('0x13')][_0x5333('0x18')]?_[_0x5333('0x17')](_0x37417b[_0x5333('0x13')][_0x5333('0x18')],function(_0x1d104b){return{'model':db[_0x1d104b[_0x5333('0x19')]],'as':_0x1d104b['as'],'attributes':_0x1d104b[_0x5333('0x15')],'include':_0x1d104b['include']?_[_0x5333('0x17')](_0x1d104b[_0x5333('0x18')],function(_0x30fd78){return{'model':db[_0x30fd78[_0x5333('0x19')]],'as':_0x30fd78['as'],'attributes':_0x30fd78[_0x5333('0x15')],'include':_0x30fd78['include']?_[_0x5333('0x17')](_0x30fd78['include'],function(_0x48d751){return{'model':db[_0x48d751[_0x5333('0x19')]],'as':_0x48d751['as'],'attributes':_0x48d751[_0x5333('0x15')]};}):[]};}):[]};}):[]:[]})[_0x5333('0x9')](function(_0x2d9ada){logger[_0x5333('0xa')](_0x5333('0x1e'),_0x37417b);logger[_0x5333('0x1b')]('ShowCmHopper',_0x37417b,JSON['stringify'](_0x2d9ada));_0x53e5aa(_0x2d9ada);})['catch'](function(_0x20aace){logger[_0x5333('0xd')](_0x5333('0x1e'),_0x20aace[_0x5333('0xf')],_0x37417b);_0x518a0d(_0x10ec59[_0x5333('0xd')](0x1f4,_0x20aace[_0x5333('0xf')]));});});};exports[_0x5333('0x1f')]=function(_0x398e20){var _0x38b255=this;return new Promise(function(_0x2c9c6e,_0x5e5aac){return db[_0x5333('0x1c')]['create'](_0x398e20[_0x5333('0x20')],{'raw':_0x398e20[_0x5333('0x13')]?_0x398e20[_0x5333('0x13')]['raw']===undefined?!![]:![]:!![]})[_0x5333('0x9')](function(_0x12aa35){logger[_0x5333('0xa')]('CreateCmHopper',_0x398e20);logger[_0x5333('0x1b')](_0x5333('0x1f'),_0x398e20,JSON[_0x5333('0xc')](_0x12aa35));_0x2c9c6e(_0x12aa35);})[_0x5333('0x11')](function(_0x67a681){logger[_0x5333('0xd')](_0x5333('0x1f'),_0x67a681[_0x5333('0xf')],_0x398e20);_0x5e5aac(_0x38b255[_0x5333('0xd')](0x1f4,_0x67a681[_0x5333('0xf')]));});});};exports[_0x5333('0x21')]=function(_0x40cc4e){var _0x367b5d=this;return new Promise(function(_0x40a1e6,_0x1890eb){return db[_0x5333('0x1c')][_0x5333('0x22')](_0x40cc4e['body'],{'raw':_0x40cc4e[_0x5333('0x13')]?_0x40cc4e['options'][_0x5333('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40cc4e[_0x5333('0x13')]?_0x40cc4e[_0x5333('0x13')][_0x5333('0x14')]||null:null,'attributes':_0x40cc4e['options']?_0x40cc4e[_0x5333('0x13')][_0x5333('0x15')]||null:null,'limit':_0x40cc4e[_0x5333('0x13')]?_0x40cc4e[_0x5333('0x13')][_0x5333('0x16')]||null:null})['then'](function(_0x1b45b3){logger[_0x5333('0xa')](_0x5333('0x21'),_0x40cc4e);logger['debug'](_0x5333('0x21'),_0x40cc4e,JSON[_0x5333('0xc')](_0x1b45b3));_0x40a1e6(_0x1b45b3);})[_0x5333('0x11')](function(_0x41f7fb){logger[_0x5333('0xd')](_0x5333('0x21'),_0x41f7fb[_0x5333('0xf')],_0x40cc4e);_0x1890eb(_0x367b5d['error'](0x1f4,_0x41f7fb[_0x5333('0xf')]));});});};exports[_0x5333('0x23')]=function(_0xa737d3){var _0x14291d=this;return new Promise(function(_0x23c40b,_0x52abc4){return db[_0x5333('0x1c')]['destroy']({'where':_0xa737d3[_0x5333('0x13')]?_0xa737d3['options']['where']||null:null})[_0x5333('0x9')](function(_0x4fc9b5){logger[_0x5333('0xa')](_0x5333('0x23'),_0xa737d3);logger[_0x5333('0x1b')](_0x5333('0x23'),_0xa737d3,JSON[_0x5333('0xc')](_0x4fc9b5));_0x23c40b(_0x4fc9b5);})[_0x5333('0x11')](function(_0x329875){logger[_0x5333('0xd')](_0x5333('0x23'),_0x329875['message'],_0xa737d3);_0x52abc4(_0x14291d['error'](0x1f4,_0x329875[_0x5333('0xf')]));});});};exports[_0x5333('0x24')]=function(_0x3ad4a8){var _0x4a0af9=this;return new Promise(function(_0x5d8349,_0xea2199){return db['CmContact']['describe']()['then'](function(_0x4392e6){return db[_0x5333('0x25')]['transaction'](function(_0x3faa46){return db['CmHopper'][_0x5333('0x12')]({'where':_0x3ad4a8[_0x5333('0x13')]?_0x3ad4a8[_0x5333('0x13')]['where']||null:null,'attributes':_0x3ad4a8['options']?_0x3ad4a8['options'][_0x5333('0x15')]||null:null,'limit':_0x3ad4a8[_0x5333('0x13')]?_0x3ad4a8[_0x5333('0x13')][_0x5333('0x16')]||null:null,'order':_0x3ad4a8[_0x5333('0x13')]?_0x3ad4a8[_0x5333('0x13')][_0x5333('0x26')]||null:null,'transaction':_0x3faa46,'lock':_0x3faa46[_0x5333('0x27')][_0x5333('0x28')],'include':[{'model':db[_0x5333('0x29')],'as':_0x5333('0x2a'),'attributes':_[_0x5333('0x2b')](_0x4392e6)},{'model':db[_0x5333('0x2c')],'as':_0x5333('0x2d'),'attributes':['id',_0x5333('0x2e'),_0x5333('0x2f')]}]})[_0x5333('0x9')](function(_0x2e90e9){var _0x1c2585=[];var _0x19e33f=[];for(var _0x6ad4ec=0x0;_0x6ad4ec<_0x2e90e9[_0x5333('0x30')];_0x6ad4ec+=0x1){var _0x495866=_0x2e90e9[_0x6ad4ec][_0x5333('0x31')];if(_0x495866===null){_0x1c2585['push'](_0x2e90e9[_0x6ad4ec][_0x5333('0x22')](_0x3ad4a8[_0x5333('0x20')],{'transaction':_0x3faa46}));}else if(!_0x19e33f[_0x5333('0x32')](_0x495866)){_0x19e33f[_0x5333('0x33')](_0x495866);_0x1c2585[_0x5333('0x33')](_0x2e90e9[_0x6ad4ec]['update'](_0x3ad4a8[_0x5333('0x20')],{'transaction':_0x3faa46}));}}return BPromise[_0x5333('0x34')](_0x1c2585);});})['then'](function(_0x2a6631){logger['info']('GetContactDialer',_0x3ad4a8);logger['debug']('GetContactDialer',_0x3ad4a8,JSON[_0x5333('0xc')](_0x2a6631));_0x5d8349(_0x2a6631);})[_0x5333('0x11')](function(_0x2cd07f){logger[_0x5333('0xd')](_0x5333('0x24'),_0x2cd07f[_0x5333('0xf')],_0x3ad4a8);_0xea2199(_0x4a0af9['error'](0x1f4,_0x2cd07f['message']));});});});};exports[_0x5333('0x35')]=function(_0x422f5e){var _0x770015=this;return new Promise(function(_0x2b3dd3,_0x4df174){return db['sequelize'][_0x5333('0x36')](function(_0x3ddf5f){return db[_0x5333('0x37')][_0x5333('0x38')](_0x422f5e[_0x5333('0x20')],{'raw':_0x422f5e[_0x5333('0x13')]?_0x422f5e['options'][_0x5333('0x1d')]===undefined?!![]:![]:!![],'transaction':_0x3ddf5f})['then'](function(){return db['CmHopper'][_0x5333('0x39')]({'where':_0x422f5e[_0x5333('0x13')]?_0x422f5e[_0x5333('0x13')][_0x5333('0x14')]||null:null,'transaction':_0x3ddf5f});});})[_0x5333('0x9')](function(_0x505d9a){logger[_0x5333('0xa')](_0x5333('0x35'),_0x422f5e);logger[_0x5333('0x1b')]('MoveContactManagedDialer',_0x422f5e,JSON[_0x5333('0xc')](_0x505d9a));_0x2b3dd3(_0x505d9a);})['catch'](function(_0x2f8287){logger[_0x5333('0xd')](_0x5333('0x35'),_0x2f8287['message'],_0x422f5e);_0x4df174(_0x770015[_0x5333('0xd')](0x1f4,_0x2f8287[_0x5333('0xf')]));});});};exports[_0x5333('0x3a')]=function(_0xed54cb){var _0x5656b7=this;return new Promise(function(_0xe05bf9,_0x538966){return db['CmHopper'][_0x5333('0x12')]({'raw':_0xed54cb['options']?_0xed54cb[_0x5333('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0xed54cb[_0x5333('0x13')]?_0xed54cb[_0x5333('0x13')][_0x5333('0x14')]||null:null,'attributes':[[db[_0x5333('0x25')]['fn'](_0x5333('0x3b'),db[_0x5333('0x25')]['fn']('IF',db[_0x5333('0x25')][_0x5333('0x3c')](_0x5333('0x3d')+util[_0x5333('0x3e')](_0x5333('0x3f'),moment()[_0x5333('0x3e')](_0x5333('0x40')))+_0x5333('0x41')))),_0x5333('0x42')]]})[_0x5333('0x9')](function(_0x5e9018){logger[_0x5333('0xa')](_0x5333('0x3a'),_0xed54cb);logger[_0x5333('0x1b')](_0x5333('0x3a'),_0xed54cb,JSON[_0x5333('0xc')](_0x5e9018));_0xe05bf9(_0x5e9018);})[_0x5333('0x11')](function(_0x257f34){logger[_0x5333('0xd')](_0x5333('0x3a'),_0x257f34[_0x5333('0xf')],_0xed54cb);_0x538966(_0x5656b7[_0x5333('0xd')](0x1f4,_0x257f34[_0x5333('0xf')]));});});};exports[_0x5333('0x43')]=function(_0x323845){var _0x251d61=this;return new Promise(function(_0x387265,_0x14560e){return db['CmContact'][_0x5333('0x44')]()[_0x5333('0x9')](function(_0x2e2d6c){return db['sequelize'][_0x5333('0x36')](function(_0x59e6eb){return db['CmHopper'][_0x5333('0x12')]({'where':_0x323845[_0x5333('0x13')]?_0x323845[_0x5333('0x13')][_0x5333('0x14')]||null:null,'attributes':_0x323845[_0x5333('0x13')]?_0x323845[_0x5333('0x13')][_0x5333('0x15')]||null:null,'limit':0x1,'order':_0x323845[_0x5333('0x13')]?_0x323845[_0x5333('0x13')][_0x5333('0x26')]||null:null,'group':db['CmHopper'][_0x5333('0x31')],'transaction':_0x59e6eb,'lock':_0x59e6eb['LOCK'][_0x5333('0x28')],'include':_0x323845[_0x5333('0x13')]?_0x323845[_0x5333('0x13')][_0x5333('0x18')]?_[_0x5333('0x17')](_0x323845[_0x5333('0x13')][_0x5333('0x18')],function(_0x14ccf0){return{'model':db[_0x14ccf0[_0x5333('0x19')]],'as':_0x14ccf0['as'],'attributes':_0x14ccf0[_0x5333('0x15')],'include':_0x14ccf0['include']?_[_0x5333('0x17')](_0x14ccf0[_0x5333('0x18')],function(_0x16297c){return{'model':db[_0x16297c[_0x5333('0x19')]],'as':_0x16297c['as'],'attributes':_0x16297c['attributes'],'include':_0x16297c[_0x5333('0x18')]?_['map'](_0x16297c['include'],function(_0x1f7df9){return{'model':db[_0x1f7df9['model']],'as':_0x1f7df9['as'],'attributes':_0x1f7df9[_0x5333('0x15')]};}):[]};}):[]};}):[]:[]})[_0x5333('0x9')](function(_0x2b279c){var _0x2c0510=[];for(var _0x1b4edf=0x0;_0x1b4edf<_0x2b279c[_0x5333('0x30')];_0x1b4edf+=0x1){_0x2c0510[_0x5333('0x33')](_0x2b279c[_0x1b4edf]['update'](_0x323845[_0x5333('0x20')],{'transaction':_0x59e6eb}));}return BPromise[_0x5333('0x34')](_0x2c0510);});})[_0x5333('0x9')](function(_0x32e8d0){logger[_0x5333('0xa')](_0x5333('0x43'),_0x323845);logger['debug'](_0x5333('0x43'),_0x323845,JSON['stringify'](_0x32e8d0));_0x387265(_0x32e8d0);})[_0x5333('0x11')](function(_0xd342ae){logger[_0x5333('0xd')](_0x5333('0x43'),_0xd342ae[_0x5333('0xf')],_0x323845);_0x14560e(_0x251d61[_0x5333('0xd')](0x1f4,_0xd342ae[_0x5333('0xf')]));});});});};exports[_0x5333('0x45')]=function(_0x4fa186){var _0x8c3ddf=this;return new Promise(function(_0x3fb2dd,_0x256756){db[_0x5333('0x29')][_0x5333('0x44')]()[_0x5333('0x9')](function(_0x5373d8){return db[_0x5333('0x1c')]['findAll']({'raw':_0x4fa186['options']?_0x4fa186['options']['raw']===undefined?!![]:![]:!![],'where':_0x4fa186[_0x5333('0x13')]?_0x4fa186[_0x5333('0x13')][_0x5333('0x14')]||null:null,'attributes':_0x4fa186[_0x5333('0x13')]?_0x4fa186[_0x5333('0x13')][_0x5333('0x15')]||null:null,'limit':_0x4fa186[_0x5333('0x13')]?_0x4fa186[_0x5333('0x13')][_0x5333('0x16')]||null:null,'include':_0x4fa186[_0x5333('0x13')]?_0x4fa186[_0x5333('0x13')][_0x5333('0x18')]?_['map'](_0x4fa186[_0x5333('0x13')]['include'],function(_0x2329db){return{'model':db[_0x2329db[_0x5333('0x19')]],'as':_0x2329db['as'],'attributes':_0x2329db['as']===_0x5333('0x2a')?_[_0x5333('0x2b')](_0x5373d8):_0x2329db[_0x5333('0x15')],'include':_0x2329db[_0x5333('0x18')]?_['map'](_0x2329db[_0x5333('0x18')],function(_0x336b8a){return{'model':db[_0x336b8a['model']],'as':_0x336b8a['as'],'attributes':_0x336b8a[_0x5333('0x15')],'include':_0x336b8a[_0x5333('0x18')]?_[_0x5333('0x17')](_0x336b8a[_0x5333('0x18')],function(_0x54532a){return{'model':db[_0x54532a[_0x5333('0x19')]],'as':_0x54532a['as'],'attributes':_0x54532a[_0x5333('0x15')]};}):[]};}):[]};}):[]:[]})[_0x5333('0x9')](function(_0x459d3f){logger[_0x5333('0xa')](_0x5333('0x1a'),_0x4fa186);logger[_0x5333('0x1b')](_0x5333('0x1a'),_0x4fa186,JSON['stringify'](_0x459d3f));_0x3fb2dd(_0x459d3f);})[_0x5333('0x11')](function(_0x38d560){logger['error'](_0x5333('0x1a'),_0x38d560[_0x5333('0xf')],_0x4fa186);_0x256756(_0x8c3ddf[_0x5333('0xd')](0x1f4,_0x38d560['message']));});});});}; \ No newline at end of file +var _0x840f=['code','CmHopper,\x20%s,\x20%s','info','message','catch','CmHopper','options','raw','where','attributes','limit','include','map','model','then','GetCmHopper','ShowCmHopper','find','CreateCmHopper','body','UpdateCmHopper','update','DestroyCmHopper','GetContactDialer','CmContact','sequelize','transaction','LOCK','UPDATE','Contact','keys','Agent','name','voicePause','length','UserId','includes','push','all','MoveContactManagedDialer','destroy','CountReScheduled','COUNT','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','describe','findAll','order','GetCmHopperPreview','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2c00cb,_0x44745f){var _0x2b6b96=function(_0x3b1775){while(--_0x3b1775){_0x2c00cb['push'](_0x2c00cb['shift']());}};_0x2b6b96(++_0x44745f);}(_0x840f,0x10b));var _0xf840=function(_0x3c3021,_0x189015){_0x3c3021=_0x3c3021-0x0;var _0x347432=_0x840f[_0x3c3021];return _0x347432;};'use strict';var _=require(_0xf840('0x0'));var util=require(_0xf840('0x1'));var moment=require(_0xf840('0x2'));var BPromise=require(_0xf840('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf840('0x4'));var db=require(_0xf840('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf840('0x6'));var config=require(_0xf840('0x7'));var jayson=require(_0xf840('0x8'));var client=jayson[_0xf840('0x9')][_0xf840('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b59cd,_0x28d719,_0x2482cb){return new BPromise(function(_0x1b2115,_0xb86091){return client[_0xf840('0xb')](_0x4b59cd,_0x2482cb)['then'](function(_0x28675b){logger['info']('CmHopper,\x20%s,\x20%s',_0x28d719,_0xf840('0xc'));logger[_0xf840('0xd')](_0xf840('0xe'),_0x28d719,_0xf840('0xc'),JSON[_0xf840('0xf')](_0x28675b));if(_0x28675b[_0xf840('0x10')]){if(_0x28675b['error'][_0xf840('0x11')]===0x1f4){logger['error'](_0xf840('0x12'),_0x28d719,_0x28675b[_0xf840('0x10')]['message']);return _0xb86091(_0x28675b[_0xf840('0x10')]['message']);}logger[_0xf840('0x10')](_0xf840('0x12'),_0x28d719,_0x28675b[_0xf840('0x10')]['message']);return _0x1b2115(_0x28675b['error']['message']);}else{logger[_0xf840('0x13')]('CmHopper,\x20%s,\x20%s',_0x28d719,_0xf840('0xc'));_0x1b2115(_0x28675b['result'][_0xf840('0x14')]);}})[_0xf840('0x15')](function(_0x4f7642){logger[_0xf840('0x10')](_0xf840('0x12'),_0x28d719,_0x4f7642);_0xb86091(_0x4f7642);});});}exports['GetCmHopper']=function(_0x15be64){var _0x3fe0c3=this;return new Promise(function(_0x16fe1c,_0x1c39ea){return db[_0xf840('0x16')]['findAll']({'raw':_0x15be64[_0xf840('0x17')]?_0x15be64[_0xf840('0x17')][_0xf840('0x18')]===undefined?!![]:![]:!![],'where':_0x15be64['options']?_0x15be64['options'][_0xf840('0x19')]||null:null,'attributes':_0x15be64[_0xf840('0x17')]?_0x15be64[_0xf840('0x17')][_0xf840('0x1a')]||null:null,'limit':_0x15be64[_0xf840('0x17')]?_0x15be64[_0xf840('0x17')][_0xf840('0x1b')]||null:null,'include':_0x15be64[_0xf840('0x17')]?_0x15be64['options'][_0xf840('0x1c')]?_[_0xf840('0x1d')](_0x15be64[_0xf840('0x17')][_0xf840('0x1c')],function(_0x1b8155){return{'model':db[_0x1b8155[_0xf840('0x1e')]],'as':_0x1b8155['as'],'attributes':_0x1b8155[_0xf840('0x1a')],'include':_0x1b8155['include']?_['map'](_0x1b8155[_0xf840('0x1c')],function(_0x4b3499){return{'model':db[_0x4b3499[_0xf840('0x1e')]],'as':_0x4b3499['as'],'attributes':_0x4b3499[_0xf840('0x1a')],'include':_0x4b3499['include']?_[_0xf840('0x1d')](_0x4b3499[_0xf840('0x1c')],function(_0x4e3bd3){return{'model':db[_0x4e3bd3[_0xf840('0x1e')]],'as':_0x4e3bd3['as'],'attributes':_0x4e3bd3[_0xf840('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf840('0x1f')](function(_0x120015){logger[_0xf840('0x13')](_0xf840('0x20'),_0x15be64);logger[_0xf840('0xd')]('GetCmHopper',_0x15be64,JSON[_0xf840('0xf')](_0x120015));_0x16fe1c(_0x120015);})[_0xf840('0x15')](function(_0xe078ff){logger['error'](_0xf840('0x20'),_0xe078ff[_0xf840('0x14')],_0x15be64);_0x1c39ea(_0x3fe0c3[_0xf840('0x10')](0x1f4,_0xe078ff[_0xf840('0x14')]));});});};exports[_0xf840('0x21')]=function(_0x244135){var _0x1f9c1a=this;return new Promise(function(_0x2a053b,_0x3df038){return db[_0xf840('0x16')][_0xf840('0x22')]({'raw':_0x244135[_0xf840('0x17')]?_0x244135[_0xf840('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x244135[_0xf840('0x17')]?_0x244135[_0xf840('0x17')]['where']||null:null,'attributes':_0x244135[_0xf840('0x17')]?_0x244135[_0xf840('0x17')][_0xf840('0x1a')]||null:null,'include':_0x244135[_0xf840('0x17')]?_0x244135[_0xf840('0x17')]['include']?_['map'](_0x244135[_0xf840('0x17')][_0xf840('0x1c')],function(_0x144046){return{'model':db[_0x144046[_0xf840('0x1e')]],'as':_0x144046['as'],'attributes':_0x144046['attributes'],'include':_0x144046[_0xf840('0x1c')]?_[_0xf840('0x1d')](_0x144046[_0xf840('0x1c')],function(_0x110f8d){return{'model':db[_0x110f8d[_0xf840('0x1e')]],'as':_0x110f8d['as'],'attributes':_0x110f8d[_0xf840('0x1a')],'include':_0x110f8d[_0xf840('0x1c')]?_['map'](_0x110f8d[_0xf840('0x1c')],function(_0x310fc2){return{'model':db[_0x310fc2[_0xf840('0x1e')]],'as':_0x310fc2['as'],'attributes':_0x310fc2[_0xf840('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf840('0x1f')](function(_0x4a79b1){logger[_0xf840('0x13')](_0xf840('0x21'),_0x244135);logger[_0xf840('0xd')](_0xf840('0x21'),_0x244135,JSON[_0xf840('0xf')](_0x4a79b1));_0x2a053b(_0x4a79b1);})[_0xf840('0x15')](function(_0x6ec793){logger[_0xf840('0x10')](_0xf840('0x21'),_0x6ec793[_0xf840('0x14')],_0x244135);_0x3df038(_0x1f9c1a[_0xf840('0x10')](0x1f4,_0x6ec793[_0xf840('0x14')]));});});};exports[_0xf840('0x23')]=function(_0x522a7a){var _0x1d3602=this;return new Promise(function(_0x3a046c,_0x40be5b){return db[_0xf840('0x16')]['create'](_0x522a7a[_0xf840('0x24')],{'raw':_0x522a7a[_0xf840('0x17')]?_0x522a7a['options']['raw']===undefined?!![]:![]:!![]})[_0xf840('0x1f')](function(_0x2bdea8){logger[_0xf840('0x13')](_0xf840('0x23'),_0x522a7a);logger[_0xf840('0xd')]('CreateCmHopper',_0x522a7a,JSON[_0xf840('0xf')](_0x2bdea8));_0x3a046c(_0x2bdea8);})[_0xf840('0x15')](function(_0x372c4e){logger[_0xf840('0x10')](_0xf840('0x23'),_0x372c4e[_0xf840('0x14')],_0x522a7a);_0x40be5b(_0x1d3602[_0xf840('0x10')](0x1f4,_0x372c4e['message']));});});};exports[_0xf840('0x25')]=function(_0x444352){var _0x487090=this;return new Promise(function(_0x204814,_0x5f467b){return db[_0xf840('0x16')][_0xf840('0x26')](_0x444352[_0xf840('0x24')],{'raw':_0x444352[_0xf840('0x17')]?_0x444352[_0xf840('0x17')][_0xf840('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x444352[_0xf840('0x17')]?_0x444352['options']['where']||null:null,'attributes':_0x444352['options']?_0x444352[_0xf840('0x17')]['attributes']||null:null,'limit':_0x444352[_0xf840('0x17')]?_0x444352[_0xf840('0x17')][_0xf840('0x1b')]||null:null})[_0xf840('0x1f')](function(_0x28df2b){logger[_0xf840('0x13')](_0xf840('0x25'),_0x444352);logger[_0xf840('0xd')]('UpdateCmHopper',_0x444352,JSON[_0xf840('0xf')](_0x28df2b));_0x204814(_0x28df2b);})[_0xf840('0x15')](function(_0x1a7545){logger[_0xf840('0x10')](_0xf840('0x25'),_0x1a7545[_0xf840('0x14')],_0x444352);_0x5f467b(_0x487090['error'](0x1f4,_0x1a7545['message']));});});};exports[_0xf840('0x27')]=function(_0x102391){var _0x8a8704=this;return new Promise(function(_0x5b2061,_0x4226df){return db[_0xf840('0x16')]['destroy']({'where':_0x102391[_0xf840('0x17')]?_0x102391[_0xf840('0x17')][_0xf840('0x19')]||null:null})[_0xf840('0x1f')](function(_0x3418fb){logger[_0xf840('0x13')]('DestroyCmHopper',_0x102391);logger[_0xf840('0xd')](_0xf840('0x27'),_0x102391,JSON[_0xf840('0xf')](_0x3418fb));_0x5b2061(_0x3418fb);})[_0xf840('0x15')](function(_0x23eb8e){logger[_0xf840('0x10')]('DestroyCmHopper',_0x23eb8e[_0xf840('0x14')],_0x102391);_0x4226df(_0x8a8704[_0xf840('0x10')](0x1f4,_0x23eb8e[_0xf840('0x14')]));});});};exports[_0xf840('0x28')]=function(_0x8f8f49){var _0x6642bc=this;return new Promise(function(_0x31a008,_0x26c3e4){return db[_0xf840('0x29')]['describe']()[_0xf840('0x1f')](function(_0x4d292c){return db[_0xf840('0x2a')][_0xf840('0x2b')](function(_0x3321d0){return db[_0xf840('0x16')]['findAll']({'where':_0x8f8f49['options']?_0x8f8f49['options'][_0xf840('0x19')]||null:null,'attributes':_0x8f8f49[_0xf840('0x17')]?_0x8f8f49['options'][_0xf840('0x1a')]||null:null,'limit':_0x8f8f49['options']?_0x8f8f49[_0xf840('0x17')][_0xf840('0x1b')]||null:null,'order':_0x8f8f49[_0xf840('0x17')]?_0x8f8f49['options']['order']||null:null,'transaction':_0x3321d0,'lock':_0x3321d0[_0xf840('0x2c')][_0xf840('0x2d')],'include':[{'model':db[_0xf840('0x29')],'as':_0xf840('0x2e'),'attributes':_[_0xf840('0x2f')](_0x4d292c)},{'model':db['User'],'as':_0xf840('0x30'),'attributes':['id',_0xf840('0x31'),_0xf840('0x32')]}]})[_0xf840('0x1f')](function(_0x7fad44){var _0x9a0c65=[];var _0x159d76=[];for(var _0x41495a=0x0;_0x41495a<_0x7fad44[_0xf840('0x33')];_0x41495a+=0x1){var _0x487d75=_0x7fad44[_0x41495a][_0xf840('0x34')];if(_0x487d75===null){_0x9a0c65['push'](_0x7fad44[_0x41495a][_0xf840('0x26')](_0x8f8f49[_0xf840('0x24')],{'transaction':_0x3321d0}));}else if(!_0x159d76[_0xf840('0x35')](_0x487d75)){_0x159d76[_0xf840('0x36')](_0x487d75);_0x9a0c65[_0xf840('0x36')](_0x7fad44[_0x41495a][_0xf840('0x26')](_0x8f8f49['body'],{'transaction':_0x3321d0}));}}return BPromise[_0xf840('0x37')](_0x9a0c65);});})[_0xf840('0x1f')](function(_0x3c8b18){logger['info'](_0xf840('0x28'),_0x8f8f49);logger[_0xf840('0xd')](_0xf840('0x28'),_0x8f8f49,JSON['stringify'](_0x3c8b18));_0x31a008(_0x3c8b18);})[_0xf840('0x15')](function(_0x1ca0fe){logger[_0xf840('0x10')](_0xf840('0x28'),_0x1ca0fe[_0xf840('0x14')],_0x8f8f49);_0x26c3e4(_0x6642bc[_0xf840('0x10')](0x1f4,_0x1ca0fe[_0xf840('0x14')]));});});});};exports[_0xf840('0x38')]=function(_0x3e844a){var _0x4b6cc4=this;return new Promise(function(_0x3dc52e,_0x4ed4e6){return db[_0xf840('0x2a')]['transaction'](function(_0x3b967c){return db['CmHopperFinal']['create'](_0x3e844a[_0xf840('0x24')],{'raw':_0x3e844a['options']?_0x3e844a[_0xf840('0x17')][_0xf840('0x18')]===undefined?!![]:![]:!![],'transaction':_0x3b967c})[_0xf840('0x1f')](function(){return db[_0xf840('0x16')][_0xf840('0x39')]({'where':_0x3e844a['options']?_0x3e844a[_0xf840('0x17')]['where']||null:null,'transaction':_0x3b967c});});})['then'](function(_0x316197){logger[_0xf840('0x13')](_0xf840('0x38'),_0x3e844a);logger['debug'](_0xf840('0x38'),_0x3e844a,JSON[_0xf840('0xf')](_0x316197));_0x3dc52e(_0x316197);})[_0xf840('0x15')](function(_0x3fe3bf){logger['error'](_0xf840('0x38'),_0x3fe3bf['message'],_0x3e844a);_0x4ed4e6(_0x4b6cc4[_0xf840('0x10')](0x1f4,_0x3fe3bf['message']));});});};exports[_0xf840('0x3a')]=function(_0x5e1c3c){var _0x298a7b=this;return new Promise(function(_0x53439f,_0x2693b9){return db[_0xf840('0x16')]['findAll']({'raw':_0x5e1c3c[_0xf840('0x17')]?_0x5e1c3c[_0xf840('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x5e1c3c['options']?_0x5e1c3c[_0xf840('0x17')]['where']||null:null,'attributes':[[db[_0xf840('0x2a')]['fn'](_0xf840('0x3b'),db[_0xf840('0x2a')]['fn']('IF',db[_0xf840('0x2a')]['literal'](_0xf840('0x3c')+util[_0xf840('0x3d')](_0xf840('0x3e'),moment()['format'](_0xf840('0x3f')))+_0xf840('0x40')))),_0xf840('0x41')]]})[_0xf840('0x1f')](function(_0x29c446){logger['info']('CountReScheduled',_0x5e1c3c);logger[_0xf840('0xd')](_0xf840('0x3a'),_0x5e1c3c,JSON[_0xf840('0xf')](_0x29c446));_0x53439f(_0x29c446);})[_0xf840('0x15')](function(_0xbb034a){logger[_0xf840('0x10')](_0xf840('0x3a'),_0xbb034a[_0xf840('0x14')],_0x5e1c3c);_0x2693b9(_0x298a7b[_0xf840('0x10')](0x1f4,_0xbb034a[_0xf840('0x14')]));});});};exports[_0xf840('0x42')]=function(_0xa679fc){var _0x396afd=this;return new Promise(function(_0x4ed2fa,_0x3fac76){return db['CmContact'][_0xf840('0x43')]()[_0xf840('0x1f')](function(_0x2f3a94){return db[_0xf840('0x2a')]['transaction'](function(_0x340ed7){return db[_0xf840('0x16')][_0xf840('0x44')]({'where':_0xa679fc[_0xf840('0x17')]?_0xa679fc[_0xf840('0x17')][_0xf840('0x19')]||null:null,'attributes':_0xa679fc[_0xf840('0x17')]?_0xa679fc['options'][_0xf840('0x1a')]||null:null,'limit':0x1,'order':_0xa679fc['options']?_0xa679fc[_0xf840('0x17')][_0xf840('0x45')]||null:null,'group':db[_0xf840('0x16')][_0xf840('0x34')],'transaction':_0x340ed7,'lock':_0x340ed7[_0xf840('0x2c')][_0xf840('0x2d')],'include':_0xa679fc['options']?_0xa679fc[_0xf840('0x17')][_0xf840('0x1c')]?_[_0xf840('0x1d')](_0xa679fc[_0xf840('0x17')][_0xf840('0x1c')],function(_0x14d2ec){return{'model':db[_0x14d2ec[_0xf840('0x1e')]],'as':_0x14d2ec['as'],'attributes':_0x14d2ec[_0xf840('0x1a')],'include':_0x14d2ec[_0xf840('0x1c')]?_[_0xf840('0x1d')](_0x14d2ec[_0xf840('0x1c')],function(_0x3c9819){return{'model':db[_0x3c9819[_0xf840('0x1e')]],'as':_0x3c9819['as'],'attributes':_0x3c9819[_0xf840('0x1a')],'include':_0x3c9819[_0xf840('0x1c')]?_[_0xf840('0x1d')](_0x3c9819[_0xf840('0x1c')],function(_0x1b85bb){return{'model':db[_0x1b85bb[_0xf840('0x1e')]],'as':_0x1b85bb['as'],'attributes':_0x1b85bb[_0xf840('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf840('0x1f')](function(_0x580273){var _0x32d1a7=[];for(var _0x5f41ae=0x0;_0x5f41ae<_0x580273['length'];_0x5f41ae+=0x1){_0x32d1a7['push'](_0x580273[_0x5f41ae]['update'](_0xa679fc[_0xf840('0x24')],{'transaction':_0x340ed7}));}return BPromise[_0xf840('0x37')](_0x32d1a7);});})[_0xf840('0x1f')](function(_0x54239){logger[_0xf840('0x13')]('GetContactRecallMe',_0xa679fc);logger[_0xf840('0xd')](_0xf840('0x42'),_0xa679fc,JSON[_0xf840('0xf')](_0x54239));_0x4ed2fa(_0x54239);})[_0xf840('0x15')](function(_0x246b38){logger[_0xf840('0x10')](_0xf840('0x42'),_0x246b38[_0xf840('0x14')],_0xa679fc);_0x3fac76(_0x396afd['error'](0x1f4,_0x246b38[_0xf840('0x14')]));});});});};exports[_0xf840('0x46')]=function(_0x3a9160){var _0x20869d=this;return new Promise(function(_0x3e013e,_0x5f2782){db[_0xf840('0x29')][_0xf840('0x43')]()[_0xf840('0x1f')](function(_0xfdfdd1){return db[_0xf840('0x16')][_0xf840('0x44')]({'raw':_0x3a9160[_0xf840('0x17')]?_0x3a9160['options']['raw']===undefined?!![]:![]:!![],'where':_0x3a9160[_0xf840('0x17')]?_0x3a9160['options'][_0xf840('0x19')]||null:null,'attributes':_0x3a9160['options']?_0x3a9160[_0xf840('0x17')][_0xf840('0x1a')]||null:null,'limit':_0x3a9160['options']?_0x3a9160['options'][_0xf840('0x1b')]||null:null,'include':_0x3a9160['options']?_0x3a9160[_0xf840('0x17')][_0xf840('0x1c')]?_[_0xf840('0x1d')](_0x3a9160[_0xf840('0x17')]['include'],function(_0x2d0882){return{'model':db[_0x2d0882[_0xf840('0x1e')]],'as':_0x2d0882['as'],'attributes':_0x2d0882['as']===_0xf840('0x2e')?_[_0xf840('0x2f')](_0xfdfdd1):_0x2d0882[_0xf840('0x1a')],'include':_0x2d0882[_0xf840('0x1c')]?_[_0xf840('0x1d')](_0x2d0882[_0xf840('0x1c')],function(_0x21a8fc){return{'model':db[_0x21a8fc['model']],'as':_0x21a8fc['as'],'attributes':_0x21a8fc[_0xf840('0x1a')],'include':_0x21a8fc[_0xf840('0x1c')]?_[_0xf840('0x1d')](_0x21a8fc['include'],function(_0x593731){return{'model':db[_0x593731[_0xf840('0x1e')]],'as':_0x593731['as'],'attributes':_0x593731[_0xf840('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf840('0x1f')](function(_0x5ac6b6){logger['info'](_0xf840('0x20'),_0x3a9160);logger[_0xf840('0xd')](_0xf840('0x20'),_0x3a9160,JSON[_0xf840('0xf')](_0x5ac6b6));_0x3e013e(_0x5ac6b6);})[_0xf840('0x15')](function(_0x177544){logger[_0xf840('0x10')]('GetCmHopper',_0x177544[_0xf840('0x14')],_0x3a9160);_0x5f2782(_0x20869d[_0xf840('0x10')](0x1f4,_0x177544[_0xf840('0x14')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index a280671..d1ff4c8 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 _0x5d3f=['../../components/interaction/service','../../config/environment','./cmHopper.controller','get','isAuthenticated','index','/describe','describe','/opencontacts','getOpenContacts','/:id','post','create','/preview','getPreview','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x3a8852,_0x128955){var _0x11624b=function(_0x19f3a6){while(--_0x19f3a6){_0x3a8852['push'](_0x3a8852['shift']());}};_0x11624b(++_0x128955);}(_0x5d3f,0xaf));var _0xf5d3=function(_0x19ed4b,_0x1cbea4){_0x19ed4b=_0x19ed4b-0x0;var _0x4fe222=_0x5d3f[_0x19ed4b];return _0x4fe222;};'use strict';var multer=require(_0xf5d3('0x0'));var util=require(_0xf5d3('0x1'));var path=require(_0xf5d3('0x2'));var timeout=require(_0xf5d3('0x3'));var express=require(_0xf5d3('0x4'));var router=express[_0xf5d3('0x5')]();var fs_extra=require(_0xf5d3('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xf5d3('0x7'));var config=require(_0xf5d3('0x8'));var controller=require(_0xf5d3('0x9'));router[_0xf5d3('0xa')]('/',auth[_0xf5d3('0xb')](),controller[_0xf5d3('0xc')]);router['get'](_0xf5d3('0xd'),auth[_0xf5d3('0xb')](),controller[_0xf5d3('0xe')]);router[_0xf5d3('0xa')](_0xf5d3('0xf'),auth[_0xf5d3('0xb')](),controller[_0xf5d3('0x10')]);router[_0xf5d3('0xa')](_0xf5d3('0x11'),auth[_0xf5d3('0xb')](),controller['show']);router[_0xf5d3('0x12')]('/',auth[_0xf5d3('0xb')](),controller[_0xf5d3('0x13')]);router[_0xf5d3('0x12')](_0xf5d3('0x14'),auth[_0xf5d3('0xb')](),controller[_0xf5d3('0x15')]);router[_0xf5d3('0x16')](_0xf5d3('0x11'),auth[_0xf5d3('0xb')](),controller[_0xf5d3('0x17')]);router[_0xf5d3('0x18')](_0xf5d3('0x11'),auth[_0xf5d3('0xb')](),controller[_0xf5d3('0x19')]);module['exports']=router; \ No newline at end of file +var _0x312d=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/opencontacts','getOpenContacts','/:id','create','post','/preview','destroy','multer','util','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x312d,0x14d));var _0xd312=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0x312d[_0x288f5e];return _0x476cc9;};'use strict';var multer=require(_0xd312('0x0'));var util=require(_0xd312('0x1'));var path=require(_0xd312('0x2'));var timeout=require(_0xd312('0x3'));var express=require(_0xd312('0x4'));var router=express[_0xd312('0x5')]();var fs_extra=require(_0xd312('0x6'));var auth=require(_0xd312('0x7'));var interaction=require(_0xd312('0x8'));var config=require(_0xd312('0x9'));var controller=require('./cmHopper.controller');router[_0xd312('0xa')]('/',auth[_0xd312('0xb')](),controller['index']);router[_0xd312('0xa')](_0xd312('0xc'),auth['isAuthenticated'](),controller[_0xd312('0xd')]);router[_0xd312('0xa')](_0xd312('0xe'),auth[_0xd312('0xb')](),controller[_0xd312('0xf')]);router[_0xd312('0xa')](_0xd312('0x10'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xd312('0xb')](),controller[_0xd312('0x11')]);router[_0xd312('0x12')](_0xd312('0x13'),auth[_0xd312('0xb')](),controller['getPreview']);router['put']('/:id',auth[_0xd312('0xb')](),controller['update']);router['delete']('/:id',auth[_0xd312('0xb')](),controller[_0xd312('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index ac3fc53..3299946 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 _0x2409=['INTEGER','contactListQueue','moment','sequelize','exports','STRING'];(function(_0x907e97,_0x43eac8){var _0x429387=function(_0x129183){while(--_0x129183){_0x907e97['push'](_0x907e97['shift']());}};_0x429387(++_0x43eac8);}(_0x2409,0x128));var _0x9240=function(_0x40bbf5,_0x20da60){_0x40bbf5=_0x40bbf5-0x0;var _0x572ca7=_0x2409[_0x40bbf5];return _0x572ca7;};'use strict';var moment=require(_0x9240('0x0'));var Sequelize=require(_0x9240('0x1'));module[_0x9240('0x2')]={'phone':{'type':Sequelize[_0x9240('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x9240('0x4')],'unique':_0x9240('0x5')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x9240('0x5')},'VoiceQueueId':{'type':Sequelize[_0x9240('0x4')],'unique':_0x9240('0x5')}}; \ No newline at end of file +var _0x3b40=['exports','STRING','INTEGER','contactListQueue','sequelize'];(function(_0x5728b6,_0xfe983e){var _0x45e938=function(_0x338124){while(--_0x338124){_0x5728b6['push'](_0x5728b6['shift']());}};_0x45e938(++_0xfe983e);}(_0x3b40,0x13a));var _0x03b4=function(_0x413584,_0x2aa074){_0x413584=_0x413584-0x0;var _0x5f1e8f=_0x3b40[_0x413584];return _0x5f1e8f;};'use strict';var moment=require('moment');var Sequelize=require(_0x03b4('0x0'));module[_0x03b4('0x1')]={'phone':{'type':Sequelize[_0x03b4('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x03b4('0x3')],'unique':_0x03b4('0x4')},'ListId':{'type':Sequelize[_0x03b4('0x3')],'unique':_0x03b4('0x4')},'VoiceQueueId':{'type':Sequelize[_0x03b4('0x3')],'unique':_0x03b4('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 73c7d39..2d0951e 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 _0x8e49=['length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','include','find','body','params','describe','eml-format','zip-dir','fast-json-patch','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../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','error','stack','name','index','map','CmHopperBlack','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes'];(function(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0x8e49,0xf4));var _0x98e4=function(_0x18b191,_0x4e0684){_0x18b191=_0x18b191-0x0;var _0x43e146=_0x8e49[_0x18b191];return _0x43e146;};'use strict';var emlformat=require(_0x98e4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x98e4('0x1'));var jsonpatch=require(_0x98e4('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x98e4('0x3'));var util=require(_0x98e4('0x4'));var path=require(_0x98e4('0x5'));var sox=require('sox');var csv=require(_0x98e4('0x6'));var ejs=require(_0x98e4('0x7'));var fs=require('fs');var fs_extra=require(_0x98e4('0x8'));var _=require(_0x98e4('0x9'));var squel=require('squel');var crypto=require(_0x98e4('0xa'));var jsforce=require(_0x98e4('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x98e4('0xc'));var Papa=require('papaparse');var Redis=require(_0x98e4('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x98e4('0xe'));var logger=require(_0x98e4('0xf'))(_0x98e4('0x10'));var utils=require(_0x98e4('0x11'));var config=require(_0x98e4('0x12'));var licenseUtil=require(_0x98e4('0x13'));var db=require(_0x98e4('0x14'))['db'];function respondWithStatusCode(_0xcfdb3f,_0x518fce){_0x518fce=_0x518fce||0xcc;return function(_0x5a814a){if(_0x5a814a){return _0xcfdb3f[_0x98e4('0x15')](_0x518fce);}return _0xcfdb3f[_0x98e4('0x16')](_0x518fce)[_0x98e4('0x17')]();};}function respondWithResult(_0x1ca8ac,_0x5f2c9c){_0x5f2c9c=_0x5f2c9c||0xc8;return function(_0xbda637){if(_0xbda637){return _0x1ca8ac[_0x98e4('0x16')](_0x5f2c9c)['json'](_0xbda637);}};}function respondWithFilteredResult(_0x14ce91,_0x4aec8a){return function(_0x4f7546){if(_0x4f7546){var _0x3c62fb=typeof _0x4aec8a['offset']===_0x98e4('0x18')&&typeof _0x4aec8a[_0x98e4('0x19')]===_0x98e4('0x18');var _0xc6cf4a=_0x4f7546[_0x98e4('0x1a')];var _0x4dc22e=_0x3c62fb?0x0:_0x4aec8a['offset'];var _0x3c3eab=_0x3c62fb?_0x4f7546[_0x98e4('0x1a')]:_0x4aec8a[_0x98e4('0x1b')]+_0x4aec8a['limit'];var _0x4f5d7a;if(_0x3c3eab>=_0xc6cf4a){_0x3c3eab=_0xc6cf4a;_0x4f5d7a=0xc8;}else{_0x4f5d7a=0xce;}_0x14ce91[_0x98e4('0x16')](_0x4f5d7a);return _0x14ce91[_0x98e4('0x1c')](_0x98e4('0x1d'),_0x4dc22e+'-'+_0x3c3eab+'/'+_0xc6cf4a)[_0x98e4('0x1e')](_0x4f7546);}return null;};}function patchUpdates(_0x2c8ec3){return function(_0x2e3bd6){try{jsonpatch[_0x98e4('0x1f')](_0x2e3bd6,_0x2c8ec3,!![]);}catch(_0x2111a2){return BPromise[_0x98e4('0x20')](_0x2111a2);}return _0x2e3bd6[_0x98e4('0x21')]();};}function saveUpdates(_0x5b9d9e,_0x4cec15){return function(_0x37dca6){if(_0x37dca6){return _0x37dca6[_0x98e4('0x22')](_0x5b9d9e)[_0x98e4('0x23')](function(_0x4dacf4){return _0x4dacf4;});}return null;};}function removeEntity(_0x25c01e,_0x3c894f){return function(_0x53bb62){if(_0x53bb62){return _0x53bb62[_0x98e4('0x24')]()['then'](function(){_0x25c01e[_0x98e4('0x16')](0xcc)[_0x98e4('0x17')]();});}};}function handleEntityNotFound(_0x448e33,_0x1c7e7f){return function(_0x4f574a){if(!_0x4f574a){_0x448e33[_0x98e4('0x15')](0x194);}return _0x4f574a;};}function handleError(_0x1b5f65,_0x235079){_0x235079=_0x235079||0x1f4;return function(_0x5c2b8f){logger[_0x98e4('0x25')](_0x5c2b8f[_0x98e4('0x26')]);if(_0x5c2b8f[_0x98e4('0x27')]){delete _0x5c2b8f['name'];}_0x1b5f65[_0x98e4('0x16')](_0x235079)['send'](_0x5c2b8f);};}exports[_0x98e4('0x28')]=function(_0x29bf7c,_0x46186f){var _0x17bca4={},_0x102f64={},_0x51ca51={'count':0x0,'rows':[]};var _0x1c9a41=_[_0x98e4('0x29')](db[_0x98e4('0x2a')][_0x98e4('0x2b')],function(_0x1dd875){return{'name':_0x1dd875[_0x98e4('0x2c')],'type':_0x1dd875['type'][_0x98e4('0x2d')]};});_0x102f64[_0x98e4('0x2e')]=_['map'](_0x1c9a41,_0x98e4('0x27'));_0x102f64[_0x98e4('0x2f')]=_[_0x98e4('0x30')](_0x29bf7c[_0x98e4('0x2f')]);_0x102f64['filters']=_['intersection'](_0x102f64[_0x98e4('0x2e')],_0x102f64['query']);_0x17bca4['attributes']=_[_0x98e4('0x31')](_0x102f64['model'],qs[_0x98e4('0x32')](_0x29bf7c['query']['fields']));_0x17bca4[_0x98e4('0x33')]=_0x17bca4[_0x98e4('0x33')][_0x98e4('0x34')]?_0x17bca4[_0x98e4('0x33')]:_0x102f64['model'];if(!_0x29bf7c[_0x98e4('0x2f')][_0x98e4('0x35')]('nolimit')){_0x17bca4[_0x98e4('0x19')]=qs[_0x98e4('0x19')](_0x29bf7c['query'][_0x98e4('0x19')]);_0x17bca4[_0x98e4('0x1b')]=qs[_0x98e4('0x1b')](_0x29bf7c[_0x98e4('0x2f')][_0x98e4('0x1b')]);}_0x17bca4[_0x98e4('0x36')]=qs[_0x98e4('0x37')](_0x29bf7c[_0x98e4('0x2f')][_0x98e4('0x37')]);_0x17bca4[_0x98e4('0x38')]=qs[_0x98e4('0x39')](_[_0x98e4('0x3a')](_0x29bf7c[_0x98e4('0x2f')],_0x102f64[_0x98e4('0x39')]),_0x1c9a41);if(_0x29bf7c[_0x98e4('0x2f')][_0x98e4('0x3b')]){_0x17bca4['where']=_[_0x98e4('0x3c')](_0x17bca4['where'],{'$or':_['map'](_0x1c9a41,function(_0x58516a){if(_0x58516a[_0x98e4('0x3d')]!==_0x98e4('0x3e')){var _0x9a76f4={};_0x9a76f4[_0x58516a[_0x98e4('0x27')]]={'$like':'%'+_0x29bf7c['query']['filter']+'%'};return _0x9a76f4;}})});}_0x17bca4=_['merge']({},_0x17bca4,_0x29bf7c[_0x98e4('0x3f')]);var _0x24652f={'where':_0x17bca4['where']};return db[_0x98e4('0x2a')]['count'](_0x24652f)['then'](function(_0x440412){_0x51ca51[_0x98e4('0x1a')]=_0x440412;if(_0x29bf7c[_0x98e4('0x2f')][_0x98e4('0x40')]){_0x17bca4['include']=[{'all':!![]}];}return db[_0x98e4('0x2a')][_0x98e4('0x41')](_0x17bca4);})['then'](function(_0x2e4828){_0x51ca51[_0x98e4('0x42')]=_0x2e4828;return _0x51ca51;})[_0x98e4('0x23')](respondWithFilteredResult(_0x46186f,_0x17bca4))[_0x98e4('0x43')](handleError(_0x46186f,null));};exports[_0x98e4('0x44')]=function(_0x9ee135,_0x13506d){var _0x275c7a={'raw':!![],'where':{'id':_0x9ee135['params']['id']}},_0x3db48c={};_0x3db48c[_0x98e4('0x2e')]=_[_0x98e4('0x30')](db[_0x98e4('0x2a')][_0x98e4('0x2b')]);_0x3db48c[_0x98e4('0x2f')]=_['keys'](_0x9ee135[_0x98e4('0x2f')]);_0x3db48c['filters']=_[_0x98e4('0x31')](_0x3db48c[_0x98e4('0x2e')],_0x3db48c[_0x98e4('0x2f')]);_0x275c7a[_0x98e4('0x33')]=_['intersection'](_0x3db48c[_0x98e4('0x2e')],qs['fields'](_0x9ee135[_0x98e4('0x2f')][_0x98e4('0x32')]));_0x275c7a['attributes']=_0x275c7a[_0x98e4('0x33')][_0x98e4('0x34')]?_0x275c7a[_0x98e4('0x33')]:_0x3db48c[_0x98e4('0x2e')];if(_0x9ee135[_0x98e4('0x2f')][_0x98e4('0x40')]){_0x275c7a[_0x98e4('0x45')]=[{'all':!![]}];}_0x275c7a=_[_0x98e4('0x3c')]({},_0x275c7a,_0x9ee135[_0x98e4('0x3f')]);return db[_0x98e4('0x2a')][_0x98e4('0x46')](_0x275c7a)[_0x98e4('0x23')](handleEntityNotFound(_0x13506d,null))['then'](respondWithResult(_0x13506d,null))[_0x98e4('0x43')](handleError(_0x13506d,null));};exports[_0x98e4('0x22')]=function(_0x16edc1,_0x444f0e){if(_0x16edc1[_0x98e4('0x47')]['id']){delete _0x16edc1[_0x98e4('0x47')]['id'];}return db['CmHopperBlack']['find']({'where':{'id':_0x16edc1[_0x98e4('0x48')]['id']}})[_0x98e4('0x23')](handleEntityNotFound(_0x444f0e,null))['then'](saveUpdates(_0x16edc1[_0x98e4('0x47')],null))[_0x98e4('0x23')](respondWithResult(_0x444f0e,null))['catch'](handleError(_0x444f0e,null));};exports[_0x98e4('0x24')]=function(_0x95b99f,_0x51e145){return db[_0x98e4('0x2a')][_0x98e4('0x46')]({'where':{'id':_0x95b99f[_0x98e4('0x48')]['id']}})[_0x98e4('0x23')](handleEntityNotFound(_0x51e145,null))[_0x98e4('0x23')](removeEntity(_0x51e145,null))['catch'](handleError(_0x51e145,null));};exports[_0x98e4('0x49')]=function(_0x19d4df,_0x3606be){return db['CmHopperBlack'][_0x98e4('0x49')]()[_0x98e4('0x23')](respondWithResult(_0x3606be,null))['catch'](handleError(_0x3606be,null));}; \ No newline at end of file +var _0x4bab=['set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','filter','where','merge','type','VIRTUAL','options','CmHopperBlack','includeAll','findAll','rows','catch','show','include','find','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0x4bab,0xc8));var _0xb4ba=function(_0x542672,_0x5aa7ba){_0x542672=_0x542672-0x0;var _0x233b88=_0x4bab[_0x542672];return _0x233b88;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb4ba('0x0'));var zipdir=require(_0xb4ba('0x1'));var jsonpatch=require(_0xb4ba('0x2'));var rp=require(_0xb4ba('0x3'));var moment=require(_0xb4ba('0x4'));var BPromise=require(_0xb4ba('0x5'));var Mustache=require(_0xb4ba('0x6'));var util=require(_0xb4ba('0x7'));var path=require('path');var sox=require(_0xb4ba('0x8'));var csv=require(_0xb4ba('0x9'));var ejs=require(_0xb4ba('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb4ba('0xb'));var squel=require(_0xb4ba('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb4ba('0x9'));var querystring=require(_0xb4ba('0xd'));var Papa=require(_0xb4ba('0xe'));var Redis=require(_0xb4ba('0xf'));var authService=require(_0xb4ba('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb4ba('0x11'));var hardwareService=require(_0xb4ba('0x12'));var logger=require(_0xb4ba('0x13'))(_0xb4ba('0x14'));var utils=require(_0xb4ba('0x15'));var config=require(_0xb4ba('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xb4ba('0x17'))['db'];function respondWithStatusCode(_0x2ff2ee,_0x5ccd64){_0x5ccd64=_0x5ccd64||0xcc;return function(_0x3d2b37){if(_0x3d2b37){return _0x2ff2ee[_0xb4ba('0x18')](_0x5ccd64);}return _0x2ff2ee[_0xb4ba('0x19')](_0x5ccd64)[_0xb4ba('0x1a')]();};}function respondWithResult(_0x17124b,_0xf59cbd){_0xf59cbd=_0xf59cbd||0xc8;return function(_0x414cf9){if(_0x414cf9){return _0x17124b[_0xb4ba('0x19')](_0xf59cbd)[_0xb4ba('0x1b')](_0x414cf9);}};}function respondWithFilteredResult(_0x3208b8,_0x5efb5a){return function(_0x2fcf29){if(_0x2fcf29){var _0x588028=typeof _0x5efb5a[_0xb4ba('0x1c')]===_0xb4ba('0x1d')&&typeof _0x5efb5a['limit']==='undefined';var _0x52038d=_0x2fcf29[_0xb4ba('0x1e')];var _0x1fea10=_0x588028?0x0:_0x5efb5a[_0xb4ba('0x1c')];var _0x5cfb95=_0x588028?_0x2fcf29[_0xb4ba('0x1e')]:_0x5efb5a[_0xb4ba('0x1c')]+_0x5efb5a['limit'];var _0x241bf8;if(_0x5cfb95>=_0x52038d){_0x5cfb95=_0x52038d;_0x241bf8=0xc8;}else{_0x241bf8=0xce;}_0x3208b8[_0xb4ba('0x19')](_0x241bf8);return _0x3208b8[_0xb4ba('0x1f')]('Content-Range',_0x1fea10+'-'+_0x5cfb95+'/'+_0x52038d)[_0xb4ba('0x1b')](_0x2fcf29);}return null;};}function patchUpdates(_0x2fc858){return function(_0x11db73){try{jsonpatch[_0xb4ba('0x20')](_0x11db73,_0x2fc858,!![]);}catch(_0x59b2cd){return BPromise[_0xb4ba('0x21')](_0x59b2cd);}return _0x11db73[_0xb4ba('0x22')]();};}function saveUpdates(_0x1ee113,_0x30925b){return function(_0x3ec220){if(_0x3ec220){return _0x3ec220[_0xb4ba('0x23')](_0x1ee113)[_0xb4ba('0x24')](function(_0x141cb6){return _0x141cb6;});}return null;};}function removeEntity(_0x5153ac,_0x48269a){return function(_0x53d189){if(_0x53d189){return _0x53d189[_0xb4ba('0x25')]()[_0xb4ba('0x24')](function(){_0x5153ac['status'](0xcc)[_0xb4ba('0x1a')]();});}};}function handleEntityNotFound(_0x15d06e,_0x488a14){return function(_0x4a1e6b){if(!_0x4a1e6b){_0x15d06e[_0xb4ba('0x18')](0x194);}return _0x4a1e6b;};}function handleError(_0x1257e0,_0x5d4509){_0x5d4509=_0x5d4509||0x1f4;return function(_0x224ace){logger[_0xb4ba('0x26')](_0x224ace[_0xb4ba('0x27')]);if(_0x224ace[_0xb4ba('0x28')]){delete _0x224ace['name'];}_0x1257e0['status'](_0x5d4509)[_0xb4ba('0x29')](_0x224ace);};}exports[_0xb4ba('0x2a')]=function(_0x22fe53,_0x329510){var _0x3350dd={},_0x448b37={},_0x6a3ab8={'count':0x0,'rows':[]};var _0x206136=_[_0xb4ba('0x2b')](db['CmHopperBlack'][_0xb4ba('0x2c')],function(_0x4a39ab){return{'name':_0x4a39ab[_0xb4ba('0x2d')],'type':_0x4a39ab['type'][_0xb4ba('0x2e')]};});_0x448b37[_0xb4ba('0x2f')]=_['map'](_0x206136,_0xb4ba('0x28'));_0x448b37['query']=_[_0xb4ba('0x30')](_0x22fe53[_0xb4ba('0x31')]);_0x448b37['filters']=_['intersection'](_0x448b37[_0xb4ba('0x2f')],_0x448b37[_0xb4ba('0x31')]);_0x3350dd[_0xb4ba('0x32')]=_[_0xb4ba('0x33')](_0x448b37['model'],qs[_0xb4ba('0x34')](_0x22fe53[_0xb4ba('0x31')][_0xb4ba('0x34')]));_0x3350dd[_0xb4ba('0x32')]=_0x3350dd[_0xb4ba('0x32')][_0xb4ba('0x35')]?_0x3350dd[_0xb4ba('0x32')]:_0x448b37[_0xb4ba('0x2f')];if(!_0x22fe53[_0xb4ba('0x31')][_0xb4ba('0x36')](_0xb4ba('0x37'))){_0x3350dd[_0xb4ba('0x38')]=qs[_0xb4ba('0x38')](_0x22fe53[_0xb4ba('0x31')][_0xb4ba('0x38')]);_0x3350dd['offset']=qs[_0xb4ba('0x1c')](_0x22fe53[_0xb4ba('0x31')][_0xb4ba('0x1c')]);}_0x3350dd[_0xb4ba('0x39')]=qs[_0xb4ba('0x3a')](_0x22fe53[_0xb4ba('0x31')]['sort']);_0x3350dd['where']=qs[_0xb4ba('0x3b')](_['pick'](_0x22fe53['query'],_0x448b37[_0xb4ba('0x3b')]),_0x206136);if(_0x22fe53[_0xb4ba('0x31')][_0xb4ba('0x3c')]){_0x3350dd[_0xb4ba('0x3d')]=_[_0xb4ba('0x3e')](_0x3350dd[_0xb4ba('0x3d')],{'$or':_[_0xb4ba('0x2b')](_0x206136,function(_0x16f35e){if(_0x16f35e[_0xb4ba('0x3f')]!==_0xb4ba('0x40')){var _0x52c3c2={};_0x52c3c2[_0x16f35e[_0xb4ba('0x28')]]={'$like':'%'+_0x22fe53['query'][_0xb4ba('0x3c')]+'%'};return _0x52c3c2;}})});}_0x3350dd=_[_0xb4ba('0x3e')]({},_0x3350dd,_0x22fe53[_0xb4ba('0x41')]);var _0x24a40d={'where':_0x3350dd[_0xb4ba('0x3d')]};return db[_0xb4ba('0x42')][_0xb4ba('0x1e')](_0x24a40d)[_0xb4ba('0x24')](function(_0xc03daf){_0x6a3ab8[_0xb4ba('0x1e')]=_0xc03daf;if(_0x22fe53['query'][_0xb4ba('0x43')]){_0x3350dd['include']=[{'all':!![]}];}return db[_0xb4ba('0x42')][_0xb4ba('0x44')](_0x3350dd);})[_0xb4ba('0x24')](function(_0x49f947){_0x6a3ab8[_0xb4ba('0x45')]=_0x49f947;return _0x6a3ab8;})[_0xb4ba('0x24')](respondWithFilteredResult(_0x329510,_0x3350dd))[_0xb4ba('0x46')](handleError(_0x329510,null));};exports[_0xb4ba('0x47')]=function(_0x44470a,_0x4fad16){var _0x265f99={'raw':!![],'where':{'id':_0x44470a['params']['id']}},_0x44c8c6={};_0x44c8c6[_0xb4ba('0x2f')]=_[_0xb4ba('0x30')](db[_0xb4ba('0x42')][_0xb4ba('0x2c')]);_0x44c8c6[_0xb4ba('0x31')]=_[_0xb4ba('0x30')](_0x44470a[_0xb4ba('0x31')]);_0x44c8c6[_0xb4ba('0x3b')]=_[_0xb4ba('0x33')](_0x44c8c6[_0xb4ba('0x2f')],_0x44c8c6['query']);_0x265f99[_0xb4ba('0x32')]=_['intersection'](_0x44c8c6[_0xb4ba('0x2f')],qs[_0xb4ba('0x34')](_0x44470a[_0xb4ba('0x31')]['fields']));_0x265f99[_0xb4ba('0x32')]=_0x265f99['attributes'][_0xb4ba('0x35')]?_0x265f99[_0xb4ba('0x32')]:_0x44c8c6[_0xb4ba('0x2f')];if(_0x44470a[_0xb4ba('0x31')][_0xb4ba('0x43')]){_0x265f99[_0xb4ba('0x48')]=[{'all':!![]}];}_0x265f99=_[_0xb4ba('0x3e')]({},_0x265f99,_0x44470a[_0xb4ba('0x41')]);return db[_0xb4ba('0x42')][_0xb4ba('0x49')](_0x265f99)[_0xb4ba('0x24')](handleEntityNotFound(_0x4fad16,null))[_0xb4ba('0x24')](respondWithResult(_0x4fad16,null))['catch'](handleError(_0x4fad16,null));};exports[_0xb4ba('0x23')]=function(_0x481321,_0x294c82){if(_0x481321['body']['id']){delete _0x481321[_0xb4ba('0x4a')]['id'];}return db[_0xb4ba('0x42')][_0xb4ba('0x49')]({'where':{'id':_0x481321[_0xb4ba('0x4b')]['id']}})[_0xb4ba('0x24')](handleEntityNotFound(_0x294c82,null))['then'](saveUpdates(_0x481321['body'],null))[_0xb4ba('0x24')](respondWithResult(_0x294c82,null))['catch'](handleError(_0x294c82,null));};exports[_0xb4ba('0x25')]=function(_0x50bb7b,_0x18fd2e){return db['CmHopperBlack'][_0xb4ba('0x49')]({'where':{'id':_0x50bb7b['params']['id']}})[_0xb4ba('0x24')](handleEntityNotFound(_0x18fd2e,null))['then'](removeEntity(_0x18fd2e,null))[_0xb4ba('0x46')](handleError(_0x18fd2e,null));};exports[_0xb4ba('0x4c')]=function(_0x2db964,_0xc88303){return db[_0xb4ba('0x42')]['describe']()['then'](respondWithResult(_0xc88303,null))[_0xb4ba('0x46')](handleError(_0xc88303,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 3f9257b..91059e1 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 _0xe020=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./cmHopperBlack.attributes','exports','define','cm_hopper_black'];(function(_0x2b1a3d,_0x11e132){var _0x3b6352=function(_0x2397e6){while(--_0x2397e6){_0x2b1a3d['push'](_0x2b1a3d['shift']());}};_0x3b6352(++_0x11e132);}(_0xe020,0x1ba));var _0x0e02=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0xe020[_0x29d915];return _0x160f86;};'use strict';var _=require(_0x0e02('0x0'));var util=require(_0x0e02('0x1'));var logger=require(_0x0e02('0x2'))(_0x0e02('0x3'));var moment=require(_0x0e02('0x4'));var BPromise=require(_0x0e02('0x5'));var rp=require(_0x0e02('0x6'));var fs=require('fs');var path=require(_0x0e02('0x7'));var rimraf=require('rimraf');var config=require(_0x0e02('0x8'));var attributes=require(_0x0e02('0x9'));module[_0x0e02('0xa')]=function(_0x427e4b,_0x2a860a){return _0x427e4b[_0x0e02('0xb')]('CmHopperBlack',attributes,{'tableName':_0x0e02('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe36b=['exports','define','CmHopperBlack','cm_hopper_black','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes'];(function(_0xed9d13,_0x5f5331){var _0xdcd9ae=function(_0x53844f){while(--_0x53844f){_0xed9d13['push'](_0xed9d13['shift']());}};_0xdcd9ae(++_0x5f5331);}(_0xe36b,0x19a));var _0xbe36=function(_0x316ca0,_0x1fae95){_0x316ca0=_0x316ca0-0x0;var _0x42240=_0xe36b[_0x316ca0];return _0x42240;};'use strict';var _=require('lodash');var util=require(_0xbe36('0x0'));var logger=require(_0xbe36('0x1'))(_0xbe36('0x2'));var moment=require(_0xbe36('0x3'));var BPromise=require(_0xbe36('0x4'));var rp=require(_0xbe36('0x5'));var fs=require('fs');var path=require(_0xbe36('0x6'));var rimraf=require(_0xbe36('0x7'));var config=require(_0xbe36('0x8'));var attributes=require(_0xbe36('0x9'));module[_0xbe36('0xa')]=function(_0x1aec35,_0x275d8e){return _0x1aec35[_0xbe36('0xb')](_0xbe36('0xc'),attributes,{'tableName':_0xbe36('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 4192745..f0734cd 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 _0xdf89=['request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','include','map','model','UpdateCmHopperBlack','update','body','DestroyCmHopperBlack','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s'];(function(_0x4f6259,_0x35094b){var _0x35f1bb=function(_0x2ecb4e){while(--_0x2ecb4e){_0x4f6259['push'](_0x4f6259['shift']());}};_0x35f1bb(++_0x35094b);}(_0xdf89,0x1eb));var _0x9df8=function(_0x51e346,_0x4090d8){_0x51e346=_0x51e346-0x0;var _0x360d3f=_0xdf89[_0x51e346];return _0x360d3f;};'use strict';var _=require(_0x9df8('0x0'));var util=require(_0x9df8('0x1'));var moment=require(_0x9df8('0x2'));var BPromise=require(_0x9df8('0x3'));var rs=require(_0x9df8('0x4'));var fs=require('fs');var Redis=require(_0x9df8('0x5'));var db=require(_0x9df8('0x6'))['db'];var utils=require(_0x9df8('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x9df8('0x8'));var jayson=require(_0x9df8('0x9'));var client=jayson[_0x9df8('0xa')][_0x9df8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x11acb0,_0x30e8ee,_0x17d96a){return new BPromise(function(_0xc087aa,_0x559cee){return client[_0x9df8('0xc')](_0x11acb0,_0x17d96a)[_0x9df8('0xd')](function(_0x856543){logger[_0x9df8('0xe')](_0x9df8('0xf'),_0x30e8ee,_0x9df8('0x10'));logger[_0x9df8('0x11')](_0x9df8('0x12'),_0x30e8ee,_0x9df8('0x10'),JSON[_0x9df8('0x13')](_0x856543));if(_0x856543[_0x9df8('0x14')]){if(_0x856543['error'][_0x9df8('0x15')]===0x1f4){logger[_0x9df8('0x14')](_0x9df8('0xf'),_0x30e8ee,_0x856543[_0x9df8('0x14')][_0x9df8('0x16')]);return _0x559cee(_0x856543[_0x9df8('0x14')][_0x9df8('0x16')]);}logger[_0x9df8('0x14')](_0x9df8('0xf'),_0x30e8ee,_0x856543[_0x9df8('0x14')][_0x9df8('0x16')]);return _0xc087aa(_0x856543[_0x9df8('0x14')]['message']);}else{logger[_0x9df8('0xe')](_0x9df8('0xf'),_0x30e8ee,_0x9df8('0x10'));_0xc087aa(_0x856543[_0x9df8('0x17')][_0x9df8('0x16')]);}})[_0x9df8('0x18')](function(_0xc6835e){logger['error'](_0x9df8('0xf'),_0x30e8ee,_0xc6835e);_0x559cee(_0xc6835e);});});}exports[_0x9df8('0x19')]=function(_0x4f724b){var _0x42188f=this;return new Promise(function(_0x2b2a0a,_0x48e2d7){return db[_0x9df8('0x1a')][_0x9df8('0x1b')]({'raw':_0x4f724b[_0x9df8('0x1c')]?_0x4f724b[_0x9df8('0x1c')][_0x9df8('0x1d')]===undefined?!![]:![]:!![],'where':_0x4f724b[_0x9df8('0x1c')]?_0x4f724b[_0x9df8('0x1c')][_0x9df8('0x1e')]||null:null,'attributes':_0x4f724b[_0x9df8('0x1c')]?_0x4f724b[_0x9df8('0x1c')][_0x9df8('0x1f')]||null:null,'limit':_0x4f724b[_0x9df8('0x1c')]?_0x4f724b['options']['limit']||null:null,'include':_0x4f724b[_0x9df8('0x1c')]?_0x4f724b[_0x9df8('0x1c')][_0x9df8('0x20')]?_[_0x9df8('0x21')](_0x4f724b[_0x9df8('0x1c')][_0x9df8('0x20')],function(_0x4d6815){return{'model':db[_0x4d6815[_0x9df8('0x22')]],'as':_0x4d6815['as'],'attributes':_0x4d6815[_0x9df8('0x1f')],'include':_0x4d6815['include']?_['map'](_0x4d6815[_0x9df8('0x20')],function(_0x1b7c15){return{'model':db[_0x1b7c15[_0x9df8('0x22')]],'as':_0x1b7c15['as'],'attributes':_0x1b7c15[_0x9df8('0x1f')],'include':_0x1b7c15[_0x9df8('0x20')]?_[_0x9df8('0x21')](_0x1b7c15[_0x9df8('0x20')],function(_0x35acee){return{'model':db[_0x35acee[_0x9df8('0x22')]],'as':_0x35acee['as'],'attributes':_0x35acee[_0x9df8('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x9df8('0xd')](function(_0x50e259){logger[_0x9df8('0xe')](_0x9df8('0x19'),_0x4f724b);logger[_0x9df8('0x11')]('GetCmHopperBlack',_0x4f724b,JSON['stringify'](_0x50e259));_0x2b2a0a(_0x50e259);})[_0x9df8('0x18')](function(_0x56fe65){logger[_0x9df8('0x14')]('GetCmHopperBlack',_0x56fe65[_0x9df8('0x16')],_0x4f724b);_0x48e2d7(_0x42188f[_0x9df8('0x14')](0x1f4,_0x56fe65['message']));});});};exports[_0x9df8('0x23')]=function(_0x10e985){var _0x22bced=this;return new Promise(function(_0xec972f,_0x18eb77){return db[_0x9df8('0x1a')][_0x9df8('0x24')](_0x10e985[_0x9df8('0x25')],{'raw':_0x10e985[_0x9df8('0x1c')]?_0x10e985[_0x9df8('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10e985[_0x9df8('0x1c')]?_0x10e985[_0x9df8('0x1c')][_0x9df8('0x1e')]||null:null,'attributes':_0x10e985[_0x9df8('0x1c')]?_0x10e985[_0x9df8('0x1c')]['attributes']||null:null,'limit':_0x10e985['options']?_0x10e985['options']['limit']||null:null})[_0x9df8('0xd')](function(_0x3aa6a2){logger['info'](_0x9df8('0x23'),_0x10e985);logger['debug'](_0x9df8('0x23'),_0x10e985,JSON['stringify'](_0x3aa6a2));_0xec972f(_0x3aa6a2);})[_0x9df8('0x18')](function(_0x2593f6){logger[_0x9df8('0x14')](_0x9df8('0x23'),_0x2593f6[_0x9df8('0x16')],_0x10e985);_0x18eb77(_0x22bced[_0x9df8('0x14')](0x1f4,_0x2593f6[_0x9df8('0x16')]));});});};exports[_0x9df8('0x26')]=function(_0x35a09f){var _0x470f92=this;return new Promise(function(_0x2c3082,_0x4dcf8e){return db['CmHopperBlack']['destroy']({'where':_0x35a09f[_0x9df8('0x1c')]?_0x35a09f[_0x9df8('0x1c')][_0x9df8('0x1e')]||null:null})[_0x9df8('0xd')](function(_0x1a26ca){logger['info'](_0x9df8('0x26'),_0x35a09f);logger[_0x9df8('0x11')](_0x9df8('0x26'),_0x35a09f,JSON[_0x9df8('0x13')](_0x1a26ca));_0x2c3082(_0x1a26ca);})[_0x9df8('0x18')](function(_0x542ff1){logger[_0x9df8('0x14')]('DestroyCmHopperBlack',_0x542ff1[_0x9df8('0x16')],_0x35a09f);_0x4dcf8e(_0x470f92[_0x9df8('0x14')](0x1f4,_0x542ff1[_0x9df8('0x16')]));});});}; \ No newline at end of file +var _0x67c6=['debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','CmHopperBlack,\x20%s,\x20%s','message','result','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','map','model','include','stringify','catch','UpdateCmHopperBlack','body','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x4a81d6,_0x15524d){var _0x23bf3f=function(_0x2dc614){while(--_0x2dc614){_0x4a81d6['push'](_0x4a81d6['shift']());}};_0x23bf3f(++_0x15524d);}(_0x67c6,0x8a));var _0x667c=function(_0xf7cbb,_0x11582f){_0xf7cbb=_0xf7cbb-0x0;var _0x5e80a4=_0x67c6[_0xf7cbb];return _0x5e80a4;};'use strict';var _=require(_0x667c('0x0'));var util=require(_0x667c('0x1'));var moment=require(_0x667c('0x2'));var BPromise=require(_0x667c('0x3'));var rs=require(_0x667c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x667c('0x5'))['db'];var utils=require(_0x667c('0x6'));var logger=require('../../config/logger')(_0x667c('0x7'));var config=require(_0x667c('0x8'));var jayson=require(_0x667c('0x9'));var client=jayson[_0x667c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4cfc1e,_0x42fe02,_0x145e33){return new BPromise(function(_0x286c24,_0x1d35c6){return client[_0x667c('0xb')](_0x4cfc1e,_0x145e33)[_0x667c('0xc')](function(_0x5e6b3d){logger[_0x667c('0xd')]('CmHopperBlack,\x20%s,\x20%s',_0x42fe02,'request\x20sent');logger[_0x667c('0xe')](_0x667c('0xf'),_0x42fe02,_0x667c('0x10'),JSON['stringify'](_0x5e6b3d));if(_0x5e6b3d[_0x667c('0x11')]){if(_0x5e6b3d[_0x667c('0x11')][_0x667c('0x12')]===0x1f4){logger[_0x667c('0x11')](_0x667c('0x13'),_0x42fe02,_0x5e6b3d['error'][_0x667c('0x14')]);return _0x1d35c6(_0x5e6b3d[_0x667c('0x11')][_0x667c('0x14')]);}logger[_0x667c('0x11')](_0x667c('0x13'),_0x42fe02,_0x5e6b3d[_0x667c('0x11')][_0x667c('0x14')]);return _0x286c24(_0x5e6b3d[_0x667c('0x11')][_0x667c('0x14')]);}else{logger[_0x667c('0xd')]('CmHopperBlack,\x20%s,\x20%s',_0x42fe02,_0x667c('0x10'));_0x286c24(_0x5e6b3d[_0x667c('0x15')][_0x667c('0x14')]);}})['catch'](function(_0x478506){logger[_0x667c('0x11')]('CmHopperBlack,\x20%s,\x20%s',_0x42fe02,_0x478506);_0x1d35c6(_0x478506);});});}exports[_0x667c('0x16')]=function(_0x5c108d){var _0x4eb26a=this;return new Promise(function(_0x5dc900,_0x233aaa){return db[_0x667c('0x17')][_0x667c('0x18')]({'raw':_0x5c108d[_0x667c('0x19')]?_0x5c108d[_0x667c('0x19')][_0x667c('0x1a')]===undefined?!![]:![]:!![],'where':_0x5c108d['options']?_0x5c108d[_0x667c('0x19')][_0x667c('0x1b')]||null:null,'attributes':_0x5c108d[_0x667c('0x19')]?_0x5c108d['options'][_0x667c('0x1c')]||null:null,'limit':_0x5c108d[_0x667c('0x19')]?_0x5c108d[_0x667c('0x19')]['limit']||null:null,'include':_0x5c108d['options']?_0x5c108d['options']['include']?_[_0x667c('0x1d')](_0x5c108d[_0x667c('0x19')]['include'],function(_0x51e198){return{'model':db[_0x51e198[_0x667c('0x1e')]],'as':_0x51e198['as'],'attributes':_0x51e198[_0x667c('0x1c')],'include':_0x51e198[_0x667c('0x1f')]?_[_0x667c('0x1d')](_0x51e198['include'],function(_0xe4caff){return{'model':db[_0xe4caff['model']],'as':_0xe4caff['as'],'attributes':_0xe4caff[_0x667c('0x1c')],'include':_0xe4caff['include']?_['map'](_0xe4caff[_0x667c('0x1f')],function(_0x1fb027){return{'model':db[_0x1fb027[_0x667c('0x1e')]],'as':_0x1fb027['as'],'attributes':_0x1fb027[_0x667c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x667c('0xc')](function(_0x5295f1){logger[_0x667c('0xd')](_0x667c('0x16'),_0x5c108d);logger[_0x667c('0xe')]('GetCmHopperBlack',_0x5c108d,JSON[_0x667c('0x20')](_0x5295f1));_0x5dc900(_0x5295f1);})[_0x667c('0x21')](function(_0xa8f63){logger[_0x667c('0x11')](_0x667c('0x16'),_0xa8f63[_0x667c('0x14')],_0x5c108d);_0x233aaa(_0x4eb26a[_0x667c('0x11')](0x1f4,_0xa8f63[_0x667c('0x14')]));});});};exports[_0x667c('0x22')]=function(_0x5714f1){var _0x1bf12f=this;return new Promise(function(_0x36eae7,_0x35b495){return db[_0x667c('0x17')]['update'](_0x5714f1[_0x667c('0x23')],{'raw':_0x5714f1['options']?_0x5714f1[_0x667c('0x19')][_0x667c('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5714f1[_0x667c('0x19')]?_0x5714f1['options']['where']||null:null,'attributes':_0x5714f1[_0x667c('0x19')]?_0x5714f1[_0x667c('0x19')][_0x667c('0x1c')]||null:null,'limit':_0x5714f1[_0x667c('0x19')]?_0x5714f1[_0x667c('0x19')]['limit']||null:null})[_0x667c('0xc')](function(_0x1c3c57){logger[_0x667c('0xd')](_0x667c('0x22'),_0x5714f1);logger[_0x667c('0xe')]('UpdateCmHopperBlack',_0x5714f1,JSON[_0x667c('0x20')](_0x1c3c57));_0x36eae7(_0x1c3c57);})[_0x667c('0x21')](function(_0x5ab8dd){logger[_0x667c('0x11')](_0x667c('0x22'),_0x5ab8dd[_0x667c('0x14')],_0x5714f1);_0x35b495(_0x1bf12f[_0x667c('0x11')](0x1f4,_0x5ab8dd['message']));});});};exports[_0x667c('0x24')]=function(_0x2026ef){var _0xf1d3fb=this;return new Promise(function(_0x4d428b,_0x15f2b7){return db[_0x667c('0x17')][_0x667c('0x25')]({'where':_0x2026ef[_0x667c('0x19')]?_0x2026ef[_0x667c('0x19')]['where']||null:null})[_0x667c('0xc')](function(_0x2ebf17){logger[_0x667c('0xd')](_0x667c('0x24'),_0x2026ef);logger[_0x667c('0xe')](_0x667c('0x24'),_0x2026ef,JSON[_0x667c('0x20')](_0x2ebf17));_0x4d428b(_0x2ebf17);})['catch'](function(_0x450d55){logger[_0x667c('0x11')]('DestroyCmHopperBlack',_0x450d55[_0x667c('0x14')],_0x2026ef);_0x15f2b7(_0xf1d3fb['error'](0x1f4,_0x450d55[_0x667c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index edc8d49..c37bbaf 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 _0x524e=['../../config/environment','./cmHopperBlack.controller','get','index','/describe','describe','/:id','isAuthenticated','show','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4be2fd,_0x4995a9){var _0x1bfa94=function(_0x30f7b8){while(--_0x30f7b8){_0x4be2fd['push'](_0x4be2fd['shift']());}};_0x1bfa94(++_0x4995a9);}(_0x524e,0x15e));var _0xe524=function(_0x547929,_0x58a703){_0x547929=_0x547929-0x0;var _0x22802b=_0x524e[_0x547929];return _0x22802b;};'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')](_0xe524('0xd'),auth[_0xe524('0xe')](),controller[_0xe524('0x11')]);router[_0xe524('0x12')](_0xe524('0xd'),auth[_0xe524('0xe')](),controller[_0xe524('0x13')]);module[_0xe524('0x14')]=router; \ No newline at end of file +var _0x741c=['get','isAuthenticated','index','/describe','/:id','show','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./cmHopperBlack.controller'];(function(_0x88b9f8,_0x82c64e){var _0x5562d3=function(_0x28c185){while(--_0x28c185){_0x88b9f8['push'](_0x88b9f8['shift']());}};_0x5562d3(++_0x82c64e);}(_0x741c,0x196));var _0xc741=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x741c[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0xc741('0x0'));var util=require(_0xc741('0x1'));var path=require(_0xc741('0x2'));var timeout=require(_0xc741('0x3'));var express=require(_0xc741('0x4'));var router=express[_0xc741('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc741('0x6'));var config=require('../../config/environment');var controller=require(_0xc741('0x7'));router[_0xc741('0x8')]('/',auth[_0xc741('0x9')](),controller[_0xc741('0xa')]);router[_0xc741('0x8')](_0xc741('0xb'),auth[_0xc741('0x9')](),controller['describe']);router[_0xc741('0x8')](_0xc741('0xc'),auth['isAuthenticated'](),controller[_0xc741('0xd')]);router['put']('/:id',auth[_0xc741('0x9')](),controller[_0xc741('0xe')]);router[_0xc741('0xf')](_0xc741('0xc'),auth[_0xc741('0x9')](),controller[_0xc741('0x10')]);module[_0xc741('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index b71d5ce..030305e 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 _0xc76d=['dispositionat','BOOLEAN','moment','INTEGER','STRING','DATE','endtime','followuptime','seconds','setDataValue'];(function(_0x16e6d7,_0xbdff33){var _0x1c644b=function(_0x23015f){while(--_0x23015f){_0x16e6d7['push'](_0x16e6d7['shift']());}};_0x1c644b(++_0xbdff33);}(_0xc76d,0x106));var _0xdc76=function(_0x1116ac,_0xcbe059){_0x1116ac=_0x1116ac-0x0;var _0x3e806b=_0xc76d[_0x1116ac];return _0x3e806b;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xdc76('0x0'));module['exports']={'state':{'type':Sequelize[_0xdc76('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xdc76('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xdc76('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xdc76('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xdc76('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xdc76('0x2')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xdc76('0x2')]},'calleridnum':{'type':Sequelize[_0xdc76('0x2')]},'calleridname':{'type':Sequelize[_0xdc76('0x2')]},'starttime':{'type':Sequelize[_0xdc76('0x3')]},'responsetime':{'type':Sequelize[_0xdc76('0x3')]},'answertime':{'type':Sequelize[_0xdc76('0x3')]},'droptime':{'type':Sequelize[_0xdc76('0x3')]},'endtime':{'type':Sequelize[_0xdc76('0x3')]},'ringtime':{'type':Sequelize[_0xdc76('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xdc76('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xdc76('0x2')]},'campaigntype':{'type':Sequelize[_0xdc76('0x2')]},'membername':{'type':Sequelize[_0xdc76('0x2')]},'reason':{'type':Sequelize[_0xdc76('0x2')]},'disposition':{'type':Sequelize[_0xdc76('0x2')]},'secondDisposition':{'type':Sequelize[_0xdc76('0x2')]},'thirdDisposition':{'type':Sequelize[_0xdc76('0x2')]},'dispositionat':{'type':Sequelize[_0xdc76('0x3')],'set':function(_0x1805ba){var _0x224f05=this['getDataValue'](_0xdc76('0x4'));if(_0x224f05&&_0x1805ba){this['setDataValue'](_0xdc76('0x5'),moment(_0x1805ba)['diff'](moment(_0x224f05),_0xdc76('0x6')));}return this[_0xdc76('0x7')](_0xdc76('0x8'),_0x1805ba);}},'amd':{'type':Sequelize[_0xdc76('0x9')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xdc76('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xdc76('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xdc76('0x3')]},'callback':{'type':Sequelize[_0xdc76('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xdc76('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xdc76('0x3')]},'deleted':{'type':Sequelize[_0xdc76('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xdc76('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xdc76('0x3')]},'countnosuchnumberretry':{'type':Sequelize[_0xdc76('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xdc76('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xdc76('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xdc76('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xfe34=['BOOLEAN','moment','exports','INTEGER','STRING','DATE','getDataValue','setDataValue','diff','dispositionat'];(function(_0x435928,_0x2e2f62){var _0x269156=function(_0xcca49d){while(--_0xcca49d){_0x435928['push'](_0x435928['shift']());}};_0x269156(++_0x2e2f62);}(_0xfe34,0x141));var _0x4fe3=function(_0x365789,_0x366c54){_0x365789=_0x365789-0x0;var _0x3e0030=_0xfe34[_0x365789];return _0x3e0030;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x4fe3('0x0'));module[_0x4fe3('0x1')]={'state':{'type':Sequelize[_0x4fe3('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x4fe3('0x3')]},'scheduledat':{'type':Sequelize[_0x4fe3('0x4')]},'countbusyretry':{'type':Sequelize[_0x4fe3('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4fe3('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x4fe3('0x3')]},'calleridname':{'type':Sequelize[_0x4fe3('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x4fe3('0x4')]},'droptime':{'type':Sequelize[_0x4fe3('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x4fe3('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x4fe3('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x4fe3('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x4fe3('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x4fe3('0x3')]},'disposition':{'type':Sequelize[_0x4fe3('0x3')]},'secondDisposition':{'type':Sequelize[_0x4fe3('0x3')]},'thirdDisposition':{'type':Sequelize[_0x4fe3('0x3')]},'dispositionat':{'type':Sequelize[_0x4fe3('0x4')],'set':function(_0x3dbb58){var _0xf8102b=this[_0x4fe3('0x5')]('endtime');if(_0xf8102b&&_0x3dbb58){this[_0x4fe3('0x6')]('followuptime',moment(_0x3dbb58)[_0x4fe3('0x7')](moment(_0xf8102b),'seconds'));}return this[_0x4fe3('0x6')](_0x4fe3('0x8'),_0x3dbb58);}},'amd':{'type':Sequelize[_0x4fe3('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0x4fe3('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x4fe3('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x4fe3('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x4fe3('0x4')]},'callback':{'type':Sequelize[_0x4fe3('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x4fe3('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x4fe3('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x4fe3('0x4')]},'recallme':{'type':Sequelize[_0x4fe3('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x4fe3('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x4fe3('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x4fe3('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x4fe3('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index c90b78e..b725482 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 _0x7a54=['calleridnum\x20NOT\x20IN\x20(?)','calleridnum','Campaign','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state\x20=\x204','group','checkContactHopper','findOne','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','CmHopperFinal','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','uniqueid','body','countContactsQueueCampaignHopperFinal','COUNT','sequelize','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','literal','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','ContactId','ListId','VoiceQueueId','createdAt','select','field','ANY_VALUE(calleridnum)','phone','NOW()','scheduledAt','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','updatedAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL'];(function(_0xfeae58,_0x43ee8e){var _0x17a06b=function(_0x1a5b1f){while(--_0x1a5b1f){_0xfeae58['push'](_0xfeae58['shift']());}};_0x17a06b(++_0x43ee8e);}(_0x7a54,0x106));var _0x47a5=function(_0x2ceac4,_0x297e0f){_0x2ceac4=_0x2ceac4-0x0;var _0x75295b=_0x7a54[_0x2ceac4];return _0x75295b;};'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['CmHopperFinal'][_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['CmHopperFinal']['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['describe']=function(_0x2d38de,_0x23bb04){return db['CmHopperFinal']['describe']()[_0x47a5('0x23')](respondWithResult(_0x23bb04,null))['catch'](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0xd93e37,_0x54c35f){if(_0xd93e37['body'][_0x47a5('0x47')]){delete _0xd93e37['body'][_0x47a5('0x47')];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'uniqueid':_0xd93e37[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x54c35f,null))[_0x47a5('0x23')](saveUpdates(_0xd93e37[_0x47a5('0x48')],null))['then'](respondWithResult(_0x54c35f,null))['catch'](handleError(_0x54c35f,null));};exports[_0x47a5('0x49')]=function(_0x411230,_0x1163e3,_0x9ea93e){return db[_0x47a5('0x2a')][_0x47a5('0x3e')]({'raw':![],'where':{'VoiceQueueId':_0x411230[_0x47a5('0x41')]['id']},'attributes':[[db['sequelize']['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db[_0x47a5('0x4b')]['literal'](_0x47a5('0x4c')))),'noSuchContacts'],[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db[_0x47a5('0x4b')]['literal'](_0x47a5('0x4d')))),_0x47a5('0x4e')],[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db[_0x47a5('0x4b')][_0x47a5('0x4f')]('`state`\x20=\x205,\x201,\x20null'))),_0x47a5('0x50')],[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db[_0x47a5('0x4b')][_0x47a5('0x4f')]('`state`\x20=\x208,\x201,\x20null'))),_0x47a5('0x51')],[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db['sequelize']['fn']('IF',db[_0x47a5('0x4b')][_0x47a5('0x4f')](_0x47a5('0x52')))),'dropContacts'],[db['sequelize']['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db['sequelize']['literal'](_0x47a5('0x53')))),'abandonedContacts'],[db[_0x47a5('0x4b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x47a5('0x4b')][_0x47a5('0x4f')]('`state`\x20=\x2022,\x201,\x20null'))),_0x47a5('0x54')],[db[_0x47a5('0x4b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x47a5('0x4b')][_0x47a5('0x4f')](_0x47a5('0x55')))),_0x47a5('0x56')]]})['then'](handleEntityNotFound(_0x1163e3,null))[_0x47a5('0x23')](respondWithResult(_0x1163e3,null))[_0x47a5('0x46')](handleError(_0x1163e3,null));};exports[_0x47a5('0x57')]=function(_0x5a33b8,_0x30ea7a,_0x4db625){return db[_0x47a5('0x2a')][_0x47a5('0x3e')]({'raw':![],'where':{'CampaignId':_0x5a33b8[_0x47a5('0x41')]['id']},'attributes':[[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db['sequelize']['fn']('IF',db[_0x47a5('0x4b')]['literal']('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db['sequelize']['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db[_0x47a5('0x4b')]['literal']('`state`\x20=\x203,\x201,\x20null'))),_0x47a5('0x4e')],[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db[_0x47a5('0x4b')]['literal'](_0x47a5('0x58')))),'busyContacts'],[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db['sequelize']['fn']('IF',db[_0x47a5('0x4b')][_0x47a5('0x4f')](_0x47a5('0x59')))),_0x47a5('0x51')],[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db[_0x47a5('0x4b')]['literal'](_0x47a5('0x52')))),_0x47a5('0x5a')],[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db['sequelize'][_0x47a5('0x4f')](_0x47a5('0x53')))),_0x47a5('0x5b')],[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db[_0x47a5('0x4b')][_0x47a5('0x4f')](_0x47a5('0x5c')))),_0x47a5('0x54')],[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db[_0x47a5('0x4b')][_0x47a5('0x4f')]('`state`\x20=\x2019,\x201,\x20null'))),_0x47a5('0x56')]]})[_0x47a5('0x23')](handleEntityNotFound(_0x30ea7a,null))[_0x47a5('0x23')](respondWithResult(_0x30ea7a,null))['catch'](handleError(_0x30ea7a,null));};exports[_0x47a5('0x5d')]=function(_0x2e46af,_0x36c67,_0x26f1ac){return db['VoiceQueue'][_0x47a5('0x45')]({'where':{'id':_0x2e46af['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x36c67,null))['then'](function(_0x43f649){var _0x4cf7c5;if(_0x43f649){_0x4cf7c5=squel[_0x47a5('0x5e')]()[_0x47a5('0x5f')](_0x47a5('0x60'))['fromQuery'](['phone','scheduledAt',_0x47a5('0x61'),_0x47a5('0x62'),_0x47a5('0x63'),_0x47a5('0x64'),'updatedAt'],squel[_0x47a5('0x65')]()[_0x47a5('0x66')](_0x47a5('0x67'),_0x47a5('0x68'))[_0x47a5('0x66')](_0x47a5('0x69'),_0x47a5('0x6a'))[_0x47a5('0x66')](_0x47a5('0x6b'),_0x47a5('0x61'))[_0x47a5('0x66')](_0x47a5('0x6c'),'ListId')[_0x47a5('0x66')]('ANY_VALUE(VoiceQueueId)',_0x47a5('0x63'))[_0x47a5('0x66')](_0x47a5('0x69'),_0x47a5('0x64'))[_0x47a5('0x66')](_0x47a5('0x69'),_0x47a5('0x6d'))[_0x47a5('0x6e')](_0x47a5('0x6f'))[_0x47a5('0x38')](_0x47a5('0x70'),_0x2e46af[_0x47a5('0x41')]['id'][_0x47a5('0x71')]())[_0x47a5('0x38')](_0x47a5('0x72'),_0x2e46af['body']['state']['toString']())['where'](_0x47a5('0x73'))[_0x47a5('0x38')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x47a5('0x65')]()[_0x47a5('0x66')](_0x47a5('0x68'))[_0x47a5('0x6e')](_0x47a5('0x60'))[_0x47a5('0x38')](_0x47a5('0x70'),_0x2e46af[_0x47a5('0x41')]['id'][_0x47a5('0x71')]()))[_0x47a5('0x38')](_0x47a5('0x74'),squel['select']()[_0x47a5('0x66')](_0x47a5('0x75'))[_0x47a5('0x6e')]('cm_hopper_final')[_0x47a5('0x38')](_0x47a5('0x70'),_0x2e46af[_0x47a5('0x41')]['id']['toString']())[_0x47a5('0x38')]('state\x20=\x204'))['group'](_0x47a5('0x61')))[_0x47a5('0x71')]();return db[_0x47a5('0x4b')][_0x47a5('0x2f')](_0x4cf7c5);}return[];})[_0x47a5('0x23')](respondWithResult(_0x36c67,null))[_0x47a5('0x46')](handleError(_0x36c67,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x592322,_0x3e0dbd,_0x4f2361){return db[_0x47a5('0x76')][_0x47a5('0x45')]({'where':{'id':_0x592322[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x3e0dbd,null))['then'](function(_0x3c66e3){var _0x550bde;if(_0x3c66e3){_0x550bde=squel['insert']()[_0x47a5('0x5f')](_0x47a5('0x60'))['fromQuery']([_0x47a5('0x68'),_0x47a5('0x6a'),_0x47a5('0x61'),'ListId',_0x47a5('0x77'),'createdAt',_0x47a5('0x6d')],squel[_0x47a5('0x65')]()[_0x47a5('0x66')]('ANY_VALUE(calleridnum)',_0x47a5('0x68'))[_0x47a5('0x66')](_0x47a5('0x69'),'scheduledAt')[_0x47a5('0x66')]('ANY_VALUE(ContactId)',_0x47a5('0x61'))['field'](_0x47a5('0x6c'),_0x47a5('0x62'))[_0x47a5('0x66')](_0x47a5('0x78'),'CampaignId')[_0x47a5('0x66')](_0x47a5('0x69'),_0x47a5('0x64'))[_0x47a5('0x66')](_0x47a5('0x69'),'updatedAt')['from'](_0x47a5('0x6f'))['where'](_0x47a5('0x79'),_0x592322[_0x47a5('0x41')]['id'][_0x47a5('0x71')]())['where'](_0x47a5('0x72'),_0x592322[_0x47a5('0x48')]['state'][_0x47a5('0x71')]())[_0x47a5('0x38')](_0x47a5('0x73'))[_0x47a5('0x38')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0x47a5('0x66')](_0x47a5('0x68'))['from'](_0x47a5('0x60'))[_0x47a5('0x38')]('CampaignId\x20=\x20?',_0x592322[_0x47a5('0x41')]['id'][_0x47a5('0x71')]()))[_0x47a5('0x38')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x47a5('0x65')]()['field'](_0x47a5('0x75'))['from'](_0x47a5('0x6f'))[_0x47a5('0x38')]('CampaignId\x20=\x20?',_0x592322[_0x47a5('0x41')]['id']['toString']())[_0x47a5('0x38')](_0x47a5('0x7a')))[_0x47a5('0x7b')](_0x47a5('0x61')))['toString']();return db[_0x47a5('0x4b')]['query'](_0x550bde);}return[];})['then'](respondWithResult(_0x3e0dbd,null))[_0x47a5('0x46')](handleError(_0x3e0dbd,null));};exports[_0x47a5('0x7c')]=function(_0x352238,_0x96fb22,_0x380c8b){return db['CmHopper'][_0x47a5('0x7d')]({'where':{'VoiceQueueId':_0x352238[_0x47a5('0x48')][_0x47a5('0x63')],'CampaignId':_0x352238[_0x47a5('0x48')]['CampaignId'],'ContactId':_0x352238[_0x47a5('0x48')]['ContactId']}})[_0x47a5('0x23')](handleEntityNotFound(_0x96fb22,null))[_0x47a5('0x23')](function(_0x3f93f0){if(_0x3f93f0){return _0x3f93f0;}return null;})[_0x47a5('0x23')](respondWithResult(_0x96fb22,null))[_0x47a5('0x46')](handleError(_0x96fb22,null));}; \ No newline at end of file +var _0x7096=['group','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state\x20=\x20?','findOne','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','params','CmHopperFinal','find','catch','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','findAll','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','noSuchContacts','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','createdAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum','state\x20=\x204'];(function(_0x923f9b,_0x911264){var _0xfdf48e=function(_0x49bd30){while(--_0x49bd30){_0x923f9b['push'](_0x923f9b['shift']());}};_0xfdf48e(++_0x911264);}(_0x7096,0x10c));var _0x6709=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x7096[_0xae7c2f];return _0x5d7001;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6709('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6709('0x1'));var rp=require('request-promise');var moment=require(_0x6709('0x2'));var BPromise=require(_0x6709('0x3'));var Mustache=require(_0x6709('0x4'));var util=require(_0x6709('0x5'));var path=require(_0x6709('0x6'));var sox=require(_0x6709('0x7'));var csv=require(_0x6709('0x8'));var ejs=require(_0x6709('0x9'));var fs=require('fs');var fs_extra=require(_0x6709('0xa'));var _=require(_0x6709('0xb'));var squel=require(_0x6709('0xc'));var crypto=require(_0x6709('0xd'));var jsforce=require(_0x6709('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6709('0xf'));var Papa=require(_0x6709('0x10'));var Redis=require(_0x6709('0x11'));var authService=require(_0x6709('0x12'));var qs=require(_0x6709('0x13'));var as=require(_0x6709('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6709('0x15'));var utils=require(_0x6709('0x16'));var config=require(_0x6709('0x17'));var licenseUtil=require(_0x6709('0x18'));var db=require(_0x6709('0x19'))['db'];function respondWithStatusCode(_0x288f51,_0x1d56a5){_0x1d56a5=_0x1d56a5||0xcc;return function(_0x1ac547){if(_0x1ac547){return _0x288f51['sendStatus'](_0x1d56a5);}return _0x288f51[_0x6709('0x1a')](_0x1d56a5)[_0x6709('0x1b')]();};}function respondWithResult(_0x4d5255,_0x3706e1){_0x3706e1=_0x3706e1||0xc8;return function(_0x4e4587){if(_0x4e4587){return _0x4d5255[_0x6709('0x1a')](_0x3706e1)['json'](_0x4e4587);}};}function respondWithFilteredResult(_0x41af1f,_0x4bc059){return function(_0x149233){if(_0x149233){var _0x28866a=typeof _0x4bc059[_0x6709('0x1c')]===_0x6709('0x1d')&&typeof _0x4bc059['limit']==='undefined';var _0x5c4f94=_0x149233[_0x6709('0x1e')];var _0x235a54=_0x28866a?0x0:_0x4bc059['offset'];var _0x9c1fd8=_0x28866a?_0x149233[_0x6709('0x1e')]:_0x4bc059[_0x6709('0x1c')]+_0x4bc059['limit'];var _0x13cf04;if(_0x9c1fd8>=_0x5c4f94){_0x9c1fd8=_0x5c4f94;_0x13cf04=0xc8;}else{_0x13cf04=0xce;}_0x41af1f[_0x6709('0x1a')](_0x13cf04);return _0x41af1f[_0x6709('0x1f')](_0x6709('0x20'),_0x235a54+'-'+_0x9c1fd8+'/'+_0x5c4f94)['json'](_0x149233);}return null;};}function patchUpdates(_0x3c4971){return function(_0x1edac3){try{jsonpatch[_0x6709('0x21')](_0x1edac3,_0x3c4971,!![]);}catch(_0x3cf882){return BPromise[_0x6709('0x22')](_0x3cf882);}return _0x1edac3[_0x6709('0x23')]();};}function saveUpdates(_0x45921e,_0x17763d){return function(_0x386224){if(_0x386224){return _0x386224[_0x6709('0x24')](_0x45921e)[_0x6709('0x25')](function(_0xa36371){return _0xa36371;});}return null;};}function removeEntity(_0x5cf48b,_0x29f25f){return function(_0x81138e){if(_0x81138e){return _0x81138e[_0x6709('0x26')]()['then'](function(){_0x5cf48b[_0x6709('0x1a')](0xcc)[_0x6709('0x1b')]();});}};}function handleEntityNotFound(_0x20a347,_0x44b465){return function(_0x588e00){if(!_0x588e00){_0x20a347[_0x6709('0x27')](0x194);}return _0x588e00;};}function handleError(_0x3076fe,_0x50f7d6){_0x50f7d6=_0x50f7d6||0x1f4;return function(_0x585073){logger[_0x6709('0x28')](_0x585073['stack']);if(_0x585073[_0x6709('0x29')]){delete _0x585073[_0x6709('0x29')];}_0x3076fe['status'](_0x50f7d6)[_0x6709('0x2a')](_0x585073);};}exports['index']=function(_0x46a325,_0x3cd555){var _0x5b6906={},_0x137137={},_0x4e6989={'count':0x0,'rows':[]};var _0xe066d8=_[_0x6709('0x2b')](db['CmHopperFinal'][_0x6709('0x2c')],function(_0x5deff5){return{'name':_0x5deff5[_0x6709('0x2d')],'type':_0x5deff5[_0x6709('0x2e')]['key']};});_0x137137['model']=_[_0x6709('0x2b')](_0xe066d8,_0x6709('0x29'));_0x137137[_0x6709('0x2f')]=_[_0x6709('0x30')](_0x46a325[_0x6709('0x2f')]);_0x137137[_0x6709('0x31')]=_[_0x6709('0x32')](_0x137137[_0x6709('0x33')],_0x137137[_0x6709('0x2f')]);_0x5b6906['attributes']=_[_0x6709('0x32')](_0x137137[_0x6709('0x33')],qs[_0x6709('0x34')](_0x46a325[_0x6709('0x2f')]['fields']));_0x5b6906[_0x6709('0x35')]=_0x5b6906[_0x6709('0x35')][_0x6709('0x36')]?_0x5b6906[_0x6709('0x35')]:_0x137137['model'];if(!_0x46a325[_0x6709('0x2f')][_0x6709('0x37')]('nolimit')){_0x5b6906[_0x6709('0x38')]=qs[_0x6709('0x38')](_0x46a325['query'][_0x6709('0x38')]);_0x5b6906[_0x6709('0x1c')]=qs[_0x6709('0x1c')](_0x46a325[_0x6709('0x2f')][_0x6709('0x1c')]);}_0x5b6906[_0x6709('0x39')]=qs[_0x6709('0x3a')](_0x46a325['query'][_0x6709('0x3a')]);_0x5b6906[_0x6709('0x3b')]=qs['filters'](_[_0x6709('0x3c')](_0x46a325[_0x6709('0x2f')],_0x137137[_0x6709('0x31')]),_0xe066d8);if(_0x46a325[_0x6709('0x2f')][_0x6709('0x3d')]){_0x5b6906[_0x6709('0x3b')]=_['merge'](_0x5b6906[_0x6709('0x3b')],{'$or':_['map'](_0xe066d8,function(_0x31e05a){if(_0x31e05a[_0x6709('0x2e')]!==_0x6709('0x3e')){var _0x48492f={};_0x48492f[_0x31e05a[_0x6709('0x29')]]={'$like':'%'+_0x46a325[_0x6709('0x2f')][_0x6709('0x3d')]+'%'};return _0x48492f;}})});}_0x5b6906=_[_0x6709('0x3f')]({},_0x5b6906,_0x46a325[_0x6709('0x40')]);var _0x1030ee={'where':_0x5b6906[_0x6709('0x3b')]};return db['CmHopperFinal'][_0x6709('0x1e')](_0x1030ee)[_0x6709('0x25')](function(_0x50fbcd){_0x4e6989[_0x6709('0x1e')]=_0x50fbcd;if(_0x46a325[_0x6709('0x2f')][_0x6709('0x41')]){_0x5b6906[_0x6709('0x42')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x5b6906);})[_0x6709('0x25')](function(_0x3f0da1){_0x4e6989[_0x6709('0x43')]=_0x3f0da1;return _0x4e6989;})[_0x6709('0x25')](respondWithFilteredResult(_0x3cd555,_0x5b6906))['catch'](handleError(_0x3cd555,null));};exports['show']=function(_0x5af1fb,_0x3d4237){var _0x293577={'raw':!![],'where':{'id':_0x5af1fb[_0x6709('0x44')]['id']}},_0x54f74e={};_0x54f74e[_0x6709('0x33')]=_['keys'](db['CmHopperFinal'][_0x6709('0x2c')]);_0x54f74e[_0x6709('0x2f')]=_[_0x6709('0x30')](_0x5af1fb[_0x6709('0x2f')]);_0x54f74e[_0x6709('0x31')]=_['intersection'](_0x54f74e[_0x6709('0x33')],_0x54f74e['query']);_0x293577[_0x6709('0x35')]=_[_0x6709('0x32')](_0x54f74e[_0x6709('0x33')],qs['fields'](_0x5af1fb[_0x6709('0x2f')]['fields']));_0x293577['attributes']=_0x293577[_0x6709('0x35')][_0x6709('0x36')]?_0x293577[_0x6709('0x35')]:_0x54f74e[_0x6709('0x33')];if(_0x5af1fb[_0x6709('0x2f')][_0x6709('0x41')]){_0x293577[_0x6709('0x42')]=[{'all':!![]}];}_0x293577=_[_0x6709('0x3f')]({},_0x293577,_0x5af1fb[_0x6709('0x40')]);return db[_0x6709('0x45')][_0x6709('0x46')](_0x293577)[_0x6709('0x25')](handleEntityNotFound(_0x3d4237,null))[_0x6709('0x25')](respondWithResult(_0x3d4237,null))[_0x6709('0x47')](handleError(_0x3d4237,null));};exports[_0x6709('0x48')]=function(_0x4f82a0,_0xfbb810){return db['CmHopperFinal']['describe']()[_0x6709('0x25')](respondWithResult(_0xfbb810,null))[_0x6709('0x47')](handleError(_0xfbb810,null));};exports[_0x6709('0x24')]=function(_0xe8dd1,_0x22363b){if(_0xe8dd1[_0x6709('0x49')][_0x6709('0x4a')]){delete _0xe8dd1[_0x6709('0x49')]['uniqueid'];}return db[_0x6709('0x45')][_0x6709('0x46')]({'where':{'uniqueid':_0xe8dd1[_0x6709('0x44')]['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x22363b,null))['then'](saveUpdates(_0xe8dd1[_0x6709('0x49')],null))['then'](respondWithResult(_0x22363b,null))[_0x6709('0x47')](handleError(_0x22363b,null));};exports[_0x6709('0x4b')]=function(_0x2a563b,_0xb257b5,_0x35c9cd){return db['CmHopperFinal'][_0x6709('0x4c')]({'raw':![],'where':{'VoiceQueueId':_0x2a563b[_0x6709('0x44')]['id']},'attributes':[[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db[_0x6709('0x4d')]['fn']('IF',db['sequelize']['literal'](_0x6709('0x4f')))),'noSuchContacts'],[db['sequelize']['fn'](_0x6709('0x4e'),db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x51')))),_0x6709('0x52')],[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')]('`state`\x20=\x205,\x201,\x20null'))),_0x6709('0x53')],[db[_0x6709('0x4d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x54')))),_0x6709('0x55')],[db['sequelize']['fn'](_0x6709('0x4e'),db['sequelize']['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x56')))),_0x6709('0x57')],[db[_0x6709('0x4d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x6709('0x58')],[db[_0x6709('0x4d')]['fn']('COUNT',db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x59')))),'reCallContacts'],[db['sequelize']['fn'](_0x6709('0x4e'),db['sequelize']['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x5a')))),'answeringMachine']]})[_0x6709('0x25')](handleEntityNotFound(_0xb257b5,null))['then'](respondWithResult(_0xb257b5,null))['catch'](handleError(_0xb257b5,null));};exports[_0x6709('0x5b')]=function(_0x511bae,_0x124199,_0x5cf7c0){return db[_0x6709('0x45')][_0x6709('0x4c')]({'raw':![],'where':{'CampaignId':_0x511bae[_0x6709('0x44')]['id']},'attributes':[[db[_0x6709('0x4d')]['fn']('COUNT',db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x4f')))),_0x6709('0x5c')],[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db['sequelize']['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x51')))),_0x6709('0x52')],[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')]('`state`\x20=\x205,\x201,\x20null'))),_0x6709('0x53')],[db[_0x6709('0x4d')]['fn']('COUNT',db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x54')))),_0x6709('0x55')],[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')]['literal'](_0x6709('0x56')))),_0x6709('0x57')],[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x5d')))),_0x6709('0x58')],[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db['sequelize']['fn']('IF',db[_0x6709('0x4d')]['literal']('`state`\x20=\x2022,\x201,\x20null'))),_0x6709('0x5e')],[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x5a')))),'answeringMachine']]})['then'](handleEntityNotFound(_0x124199,null))[_0x6709('0x25')](respondWithResult(_0x124199,null))['catch'](handleError(_0x124199,null));};exports[_0x6709('0x5f')]=function(_0x47b7d9,_0x123183,_0x2f1faf){return db['VoiceQueue']['find']({'where':{'id':_0x47b7d9['params']['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x123183,null))[_0x6709('0x25')](function(_0x24c584){var _0xbbfc50;if(_0x24c584){_0xbbfc50=squel[_0x6709('0x60')]()[_0x6709('0x61')](_0x6709('0x62'))[_0x6709('0x63')]([_0x6709('0x64'),_0x6709('0x65'),_0x6709('0x66'),_0x6709('0x67'),_0x6709('0x68'),'createdAt',_0x6709('0x69')],squel[_0x6709('0x6a')]()[_0x6709('0x6b')](_0x6709('0x6c'),'phone')['field'](_0x6709('0x6d'),'scheduledAt')['field'](_0x6709('0x6e'),_0x6709('0x66'))['field'](_0x6709('0x6f'),_0x6709('0x67'))[_0x6709('0x6b')](_0x6709('0x70'),_0x6709('0x68'))['field']('NOW()',_0x6709('0x71'))[_0x6709('0x6b')]('NOW()',_0x6709('0x69'))[_0x6709('0x72')](_0x6709('0x73'))['where'](_0x6709('0x74'),_0x47b7d9[_0x6709('0x44')]['id'][_0x6709('0x75')]())[_0x6709('0x3b')]('state\x20=\x20?',_0x47b7d9['body'][_0x6709('0x76')][_0x6709('0x75')]())[_0x6709('0x3b')](_0x6709('0x77'))[_0x6709('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x6709('0x6a')]()[_0x6709('0x6b')]('phone')[_0x6709('0x72')](_0x6709('0x62'))[_0x6709('0x3b')](_0x6709('0x74'),_0x47b7d9[_0x6709('0x44')]['id']['toString']()))[_0x6709('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x6709('0x6a')]()['field'](_0x6709('0x78'))[_0x6709('0x72')](_0x6709('0x73'))[_0x6709('0x3b')]('VoiceQueueId\x20=\x20?',_0x47b7d9[_0x6709('0x44')]['id'][_0x6709('0x75')]())[_0x6709('0x3b')](_0x6709('0x79')))[_0x6709('0x7a')](_0x6709('0x66')))['toString']();return db[_0x6709('0x4d')][_0x6709('0x2f')](_0xbbfc50);}return[];})[_0x6709('0x25')](respondWithResult(_0x123183,null))['catch'](handleError(_0x123183,null));};exports[_0x6709('0x7b')]=function(_0x124270,_0x57f14e,_0x4388a1){return db[_0x6709('0x7c')][_0x6709('0x46')]({'where':{'id':_0x124270['params']['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x57f14e,null))[_0x6709('0x25')](function(_0x409723){var _0x5c8564;if(_0x409723){_0x5c8564=squel[_0x6709('0x60')]()[_0x6709('0x61')](_0x6709('0x62'))[_0x6709('0x63')]([_0x6709('0x64'),_0x6709('0x65'),'ContactId',_0x6709('0x67'),_0x6709('0x7d'),'createdAt',_0x6709('0x69')],squel[_0x6709('0x6a')]()[_0x6709('0x6b')]('ANY_VALUE(calleridnum)',_0x6709('0x64'))[_0x6709('0x6b')](_0x6709('0x6d'),_0x6709('0x65'))[_0x6709('0x6b')](_0x6709('0x6e'),_0x6709('0x66'))['field'](_0x6709('0x6f'),_0x6709('0x67'))[_0x6709('0x6b')](_0x6709('0x7e'),_0x6709('0x7d'))[_0x6709('0x6b')](_0x6709('0x6d'),'createdAt')[_0x6709('0x6b')]('NOW()',_0x6709('0x69'))[_0x6709('0x72')](_0x6709('0x73'))[_0x6709('0x3b')](_0x6709('0x7f'),_0x124270[_0x6709('0x44')]['id'][_0x6709('0x75')]())[_0x6709('0x3b')](_0x6709('0x80'),_0x124270[_0x6709('0x49')][_0x6709('0x76')][_0x6709('0x75')]())[_0x6709('0x3b')](_0x6709('0x77'))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x6709('0x6a')]()[_0x6709('0x6b')]('phone')[_0x6709('0x72')](_0x6709('0x62'))[_0x6709('0x3b')](_0x6709('0x7f'),_0x124270[_0x6709('0x44')]['id'][_0x6709('0x75')]()))[_0x6709('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x6709('0x6a')]()[_0x6709('0x6b')](_0x6709('0x78'))[_0x6709('0x72')]('cm_hopper_final')['where'](_0x6709('0x7f'),_0x124270[_0x6709('0x44')]['id'][_0x6709('0x75')]())[_0x6709('0x3b')](_0x6709('0x79')))[_0x6709('0x7a')](_0x6709('0x66')))[_0x6709('0x75')]();return db[_0x6709('0x4d')][_0x6709('0x2f')](_0x5c8564);}return[];})[_0x6709('0x25')](respondWithResult(_0x57f14e,null))[_0x6709('0x47')](handleError(_0x57f14e,null));};exports['checkContactHopper']=function(_0x4767b7,_0x5f7adc,_0x393934){return db['CmHopper'][_0x6709('0x81')]({'where':{'VoiceQueueId':_0x4767b7[_0x6709('0x49')]['VoiceQueueId'],'CampaignId':_0x4767b7[_0x6709('0x49')]['CampaignId'],'ContactId':_0x4767b7[_0x6709('0x49')][_0x6709('0x66')]}})[_0x6709('0x25')](handleEntityNotFound(_0x5f7adc,null))[_0x6709('0x25')](function(_0x45cd4e){if(_0x45cd4e){return _0x45cd4e;}return null;})[_0x6709('0x25')](respondWithResult(_0x5f7adc,null))[_0x6709('0x47')](handleError(_0x5f7adc,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index ed352d3..24bbe78 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 _0xcae5=['../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x4d3b25,_0x140a35){var _0x49e203=function(_0x2d80f3){while(--_0x2d80f3){_0x4d3b25['push'](_0x4d3b25['shift']());}};_0x49e203(++_0x140a35);}(_0xcae5,0xf8));var _0x5cae=function(_0x128241,_0x277491){_0x128241=_0x128241-0x0;var _0x27cbc5=_0xcae5[_0x128241];return _0x27cbc5;};'use strict';var _=require(_0x5cae('0x0'));var util=require(_0x5cae('0x1'));var logger=require(_0x5cae('0x2'))(_0x5cae('0x3'));var moment=require('moment');var BPromise=require(_0x5cae('0x4'));var rp=require(_0x5cae('0x5'));var fs=require('fs');var path=require(_0x5cae('0x6'));var rimraf=require('rimraf');var config=require(_0x5cae('0x7'));var attributes=require(_0x5cae('0x8'));module[_0x5cae('0x9')]=function(_0x139d37,_0x283798){return _0x139d37[_0x5cae('0xa')](_0x5cae('0xb'),attributes,{'tableName':_0x5cae('0xc'),'paranoid':![],'indexes':[{'name':_0x5cae('0xd'),'fields':[_0x5cae('0xd')]},{'name':_0x5cae('0xe'),'fields':[_0x5cae('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3af2=['define','CmHopperFinal','cm_hopper_final','calleridnum','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes'];(function(_0x51bb74,_0x3af26f){var _0x5a124b=function(_0x292fb6){while(--_0x292fb6){_0x51bb74['push'](_0x51bb74['shift']());}};_0x5a124b(++_0x3af26f);}(_0x3af2,0xac));var _0x23af=function(_0x2351c4,_0x1dca54){_0x2351c4=_0x2351c4-0x0;var _0x1dd3f8=_0x3af2[_0x2351c4];return _0x1dd3f8;};'use strict';var _=require('lodash');var util=require(_0x23af('0x0'));var logger=require(_0x23af('0x1'))(_0x23af('0x2'));var moment=require(_0x23af('0x3'));var BPromise=require(_0x23af('0x4'));var rp=require(_0x23af('0x5'));var fs=require('fs');var path=require(_0x23af('0x6'));var rimraf=require(_0x23af('0x7'));var config=require(_0x23af('0x8'));var attributes=require(_0x23af('0x9'));module['exports']=function(_0x1b8ae8,_0x4ae80f){return _0x1b8ae8[_0x23af('0xa')](_0x23af('0xb'),attributes,{'tableName':_0x23af('0xc'),'paranoid':![],'indexes':[{'name':_0x23af('0xd'),'fields':[_0x23af('0xd')]},{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index e0701b7..36f0d7f 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0xf4734c,_0x428885){var _0x22b138=function(_0x211f28){while(--_0x211f28){_0xf4734c['push'](_0xf4734c['shift']());}};_0x22b138(++_0x428885);}(_0x7a54,0x106));var _0x47a5=function(_0x491884,_0x1fffc8){_0x491884=_0x491884-0x0;var _0x1f7eb5=_0x7a54[_0x491884];return _0x1f7eb5;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x26592b,_0x1ee506){var _0x4ee592=function(_0xa6a9af){while(--_0xa6a9af){_0x26592b['push'](_0x26592b['shift']());}};_0x4ee592(++_0x1ee506);}(_0xb10b,0x12a));var _0xbb10=function(_0x21f7c2,_0x1b2426){_0x21f7c2=_0x21f7c2-0x0;var _0x3f3279=_0xb10b[_0x21f7c2];return _0x3f3279;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index b193e96..1a95a37 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 _0xb271=['/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','checkContactHopper','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','show','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id'];(function(_0x3d52f6,_0x20b22f){var _0x50c7c7=function(_0x33381b){while(--_0x33381b){_0x3d52f6['push'](_0x3d52f6['shift']());}};_0x50c7c7(++_0x20b22f);}(_0xb271,0xf6));var _0x1b27=function(_0x2e2020,_0x746cbd){_0x2e2020=_0x2e2020-0x0;var _0x4aea6f=_0xb271[_0x2e2020];return _0x4aea6f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1b27('0x0'));var timeout=require(_0x1b27('0x1'));var express=require(_0x1b27('0x2'));var router=express[_0x1b27('0x3')]();var fs_extra=require(_0x1b27('0x4'));var auth=require(_0x1b27('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1b27('0x6'));router[_0x1b27('0x7')]('/',auth[_0x1b27('0x8')](),controller[_0x1b27('0x9')]);router[_0x1b27('0x7')](_0x1b27('0xa'),auth[_0x1b27('0x8')](),controller[_0x1b27('0xb')]);router[_0x1b27('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x1b27('0xc')]);router[_0x1b27('0x7')]('/voice/queue/countAttributes/:id',auth[_0x1b27('0x8')](),controller[_0x1b27('0xd')]);router[_0x1b27('0x7')](_0x1b27('0xe'),auth[_0x1b27('0x8')](),controller[_0x1b27('0xf')]);router[_0x1b27('0x10')](_0x1b27('0x11'),auth[_0x1b27('0x8')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0x1b27('0x10')](_0x1b27('0x12'),auth[_0x1b27('0x8')](),controller[_0x1b27('0x13')]);router[_0x1b27('0x10')]('/checkContactHopper',auth[_0x1b27('0x8')](),controller[_0x1b27('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);module[_0x1b27('0x15')]=router; \ No newline at end of file +var _0xaf42=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','index','/describe','isAuthenticated','/:id','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','post','/voice/queue/moveContacts/:id','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','exports','util'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0xaf42,0x11f));var _0x2af4=function(_0x368850,_0x32bb6f){_0x368850=_0x368850-0x0;var _0x417f93=_0xaf42[_0x368850];return _0x417f93;};'use strict';var multer=require('multer');var util=require(_0x2af4('0x0'));var path=require(_0x2af4('0x1'));var timeout=require(_0x2af4('0x2'));var express=require(_0x2af4('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2af4('0x4'));var interaction=require(_0x2af4('0x5'));var config=require(_0x2af4('0x6'));var controller=require(_0x2af4('0x7'));router[_0x2af4('0x8')]('/',auth['isAuthenticated'](),controller[_0x2af4('0x9')]);router[_0x2af4('0x8')](_0x2af4('0xa'),auth[_0x2af4('0xb')](),controller['describe']);router[_0x2af4('0x8')](_0x2af4('0xc'),auth[_0x2af4('0xb')](),controller['show']);router[_0x2af4('0x8')](_0x2af4('0xd'),auth['isAuthenticated'](),controller[_0x2af4('0xe')]);router[_0x2af4('0x8')](_0x2af4('0xf'),auth['isAuthenticated'](),controller['countContactsIvrCampaignHopperFinal']);router[_0x2af4('0x10')](_0x2af4('0x11'),auth[_0x2af4('0xb')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0x2af4('0x10')](_0x2af4('0x12'),auth[_0x2af4('0xb')](),controller[_0x2af4('0x13')]);router[_0x2af4('0x10')](_0x2af4('0x14'),auth[_0x2af4('0xb')](),controller[_0x2af4('0x15')]);router[_0x2af4('0x16')]('/:id',auth[_0x2af4('0xb')](),controller['update']);module[_0x2af4('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index ffd84e7..6472588 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 _0x540e=['sequelize','exports','INTEGER','STRING','DATE','BOOLEAN'];(function(_0x2c962d,_0x4a9c3f){var _0x3b38bd=function(_0x52f8d1){while(--_0x52f8d1){_0x2c962d['push'](_0x2c962d['shift']());}};_0x3b38bd(++_0x4a9c3f);}(_0x540e,0x6c));var _0xe540=function(_0x2f384e,_0x237f8b){_0x2f384e=_0x2f384e-0x0;var _0x56f0dd=_0x540e[_0x2f384e];return _0x56f0dd;};'use strict';var Sequelize=require(_0xe540('0x0'));module[_0xe540('0x1')]={'state':{'type':Sequelize[_0xe540('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xe540('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xe540('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xe540('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xe540('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xe540('0x3')]},'originatecalleridname':{'type':Sequelize[_0xe540('0x3')]},'calleridnum':{'type':Sequelize[_0xe540('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xe540('0x4')]},'responsetime':{'type':Sequelize[_0xe540('0x4')]},'answertime':{'type':Sequelize[_0xe540('0x4')]},'droptime':{'type':Sequelize[_0xe540('0x4')]},'endtime':{'type':Sequelize[_0xe540('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xe540('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xe540('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xe540('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xe540('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xe540('0x3')]},'membername':{'type':Sequelize[_0xe540('0x3')]},'reason':{'type':Sequelize[_0xe540('0x3')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xe540('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xe540('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xe540('0x4')]},'recallme':{'type':Sequelize[_0xe540('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0xe540('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xe540('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xe540('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xe540('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xe540('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1300=['STRING','DATE','BOOLEAN','sequelize','exports','INTEGER'];(function(_0x5a3299,_0x1f7bc0){var _0x5c51d7=function(_0x4d77db){while(--_0x4d77db){_0x5a3299['push'](_0x5a3299['shift']());}};_0x5c51d7(++_0x1f7bc0);}(_0x1300,0x1bf));var _0x0130=function(_0x5c83e3,_0x482f2b){_0x5c83e3=_0x5c83e3-0x0;var _0x3f7ace=_0x1300[_0x5c83e3];return _0x3f7ace;};'use strict';var Sequelize=require(_0x0130('0x0'));module[_0x0130('0x1')]={'state':{'type':Sequelize[_0x0130('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x0130('0x3')]},'scheduledat':{'type':Sequelize[_0x0130('0x4')]},'countbusyretry':{'type':Sequelize[_0x0130('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0130('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x0130('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x0130('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x0130('0x3')]},'originatecalleridname':{'type':Sequelize[_0x0130('0x3')]},'calleridnum':{'type':Sequelize[_0x0130('0x3')]},'calleridname':{'type':Sequelize[_0x0130('0x3')]},'starttime':{'type':Sequelize[_0x0130('0x4')]},'responsetime':{'type':Sequelize[_0x0130('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x0130('0x4')]},'endtime':{'type':Sequelize[_0x0130('0x4')]},'ringtime':{'type':Sequelize[_0x0130('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x0130('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x0130('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x0130('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x0130('0x3')]},'campaigntype':{'type':Sequelize[_0x0130('0x3')]},'membername':{'type':Sequelize[_0x0130('0x3')]},'reason':{'type':Sequelize[_0x0130('0x3')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x0130('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x0130('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x0130('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x0130('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x0130('0x4')]},'edited':{'type':Sequelize[_0x0130('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0130('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0130('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x0130('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0130('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index b27ac37..e140f97 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 _0x3db8=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','uniqueid','eml-format'];(function(_0x3c04eb,_0x9de4d9){var _0x37fa4a=function(_0x28fdec){while(--_0x28fdec){_0x3c04eb['push'](_0x3c04eb['shift']());}};_0x37fa4a(++_0x9de4d9);}(_0x3db8,0x9d));var _0x83db=function(_0x5d4408,_0x19aa01){_0x5d4408=_0x5d4408-0x0;var _0x2166bf=_0x3db8[_0x5d4408];return _0x2166bf;};'use strict';var emlformat=require(_0x83db('0x0'));var rimraf=require(_0x83db('0x1'));var zipdir=require(_0x83db('0x2'));var jsonpatch=require(_0x83db('0x3'));var rp=require(_0x83db('0x4'));var moment=require(_0x83db('0x5'));var BPromise=require(_0x83db('0x6'));var Mustache=require('mustache');var util=require(_0x83db('0x7'));var path=require(_0x83db('0x8'));var sox=require(_0x83db('0x9'));var csv=require(_0x83db('0xa'));var ejs=require(_0x83db('0xb'));var fs=require('fs');var fs_extra=require(_0x83db('0xc'));var _=require('lodash');var squel=require(_0x83db('0xd'));var crypto=require(_0x83db('0xe'));var jsforce=require(_0x83db('0xf'));var deskjs=require(_0x83db('0x10'));var toCsv=require('to-csv');var querystring=require(_0x83db('0x11'));var Papa=require(_0x83db('0x12'));var Redis=require('ioredis');var authService=require(_0x83db('0x13'));var qs=require(_0x83db('0x14'));var as=require(_0x83db('0x15'));var hardwareService=require(_0x83db('0x16'));var logger=require(_0x83db('0x17'))(_0x83db('0x18'));var utils=require(_0x83db('0x19'));var config=require(_0x83db('0x1a'));var licenseUtil=require(_0x83db('0x1b'));var db=require(_0x83db('0x1c'))['db'];function respondWithStatusCode(_0x35a895,_0x48ec0b){_0x48ec0b=_0x48ec0b||0xcc;return function(_0x4f4815){if(_0x4f4815){return _0x35a895[_0x83db('0x1d')](_0x48ec0b);}return _0x35a895[_0x83db('0x1e')](_0x48ec0b)[_0x83db('0x1f')]();};}function respondWithResult(_0x4d4199,_0x5cbca0){_0x5cbca0=_0x5cbca0||0xc8;return function(_0x23583f){if(_0x23583f){return _0x4d4199[_0x83db('0x1e')](_0x5cbca0)['json'](_0x23583f);}};}function respondWithFilteredResult(_0x4f3bbb,_0x3ae87a){return function(_0x22cdce){if(_0x22cdce){var _0x75be82=typeof _0x3ae87a[_0x83db('0x20')]===_0x83db('0x21')&&typeof _0x3ae87a[_0x83db('0x22')]==='undefined';var _0xb80abe=_0x22cdce[_0x83db('0x23')];var _0x3effa4=_0x75be82?0x0:_0x3ae87a[_0x83db('0x20')];var _0x149ed3=_0x75be82?_0x22cdce['count']:_0x3ae87a[_0x83db('0x20')]+_0x3ae87a['limit'];var _0x5dc9a1;if(_0x149ed3>=_0xb80abe){_0x149ed3=_0xb80abe;_0x5dc9a1=0xc8;}else{_0x5dc9a1=0xce;}_0x4f3bbb['status'](_0x5dc9a1);return _0x4f3bbb['set'](_0x83db('0x24'),_0x3effa4+'-'+_0x149ed3+'/'+_0xb80abe)['json'](_0x22cdce);}return null;};}function patchUpdates(_0x3d9ea0){return function(_0x4618bf){try{jsonpatch[_0x83db('0x25')](_0x4618bf,_0x3d9ea0,!![]);}catch(_0x2ecdc0){return BPromise[_0x83db('0x26')](_0x2ecdc0);}return _0x4618bf['save']();};}function saveUpdates(_0x40237a,_0x1879ab){return function(_0xc666cd){if(_0xc666cd){return _0xc666cd[_0x83db('0x27')](_0x40237a)[_0x83db('0x28')](function(_0x5e8c7b){return _0x5e8c7b;});}return null;};}function removeEntity(_0x504b86,_0x89db5e){return function(_0x490dbe){if(_0x490dbe){return _0x490dbe[_0x83db('0x29')]()[_0x83db('0x28')](function(){_0x504b86[_0x83db('0x1e')](0xcc)[_0x83db('0x1f')]();});}};}function handleEntityNotFound(_0x42a072,_0x35c373){return function(_0x192933){if(!_0x192933){_0x42a072[_0x83db('0x1d')](0x194);}return _0x192933;};}function handleError(_0xe9cea3,_0x3bedcd){_0x3bedcd=_0x3bedcd||0x1f4;return function(_0x8b722d){logger[_0x83db('0x2a')](_0x8b722d[_0x83db('0x2b')]);if(_0x8b722d[_0x83db('0x2c')]){delete _0x8b722d[_0x83db('0x2c')];}_0xe9cea3[_0x83db('0x1e')](_0x3bedcd)['send'](_0x8b722d);};}exports[_0x83db('0x2d')]=function(_0x322b41,_0x23c186){var _0x5d3f53={},_0x5592a4={},_0x57f3c7={'count':0x0,'rows':[]};var _0x3fc353=_[_0x83db('0x2e')](db[_0x83db('0x2f')][_0x83db('0x30')],function(_0x548cd6){return{'name':_0x548cd6[_0x83db('0x31')],'type':_0x548cd6[_0x83db('0x32')][_0x83db('0x33')]};});_0x5592a4['model']=_[_0x83db('0x2e')](_0x3fc353,_0x83db('0x2c'));_0x5592a4[_0x83db('0x34')]=_[_0x83db('0x35')](_0x322b41[_0x83db('0x34')]);_0x5592a4[_0x83db('0x36')]=_[_0x83db('0x37')](_0x5592a4[_0x83db('0x38')],_0x5592a4['query']);_0x5d3f53[_0x83db('0x39')]=_[_0x83db('0x37')](_0x5592a4[_0x83db('0x38')],qs[_0x83db('0x3a')](_0x322b41[_0x83db('0x34')][_0x83db('0x3a')]));_0x5d3f53[_0x83db('0x39')]=_0x5d3f53[_0x83db('0x39')][_0x83db('0x3b')]?_0x5d3f53[_0x83db('0x39')]:_0x5592a4['model'];if(!_0x322b41[_0x83db('0x34')][_0x83db('0x3c')](_0x83db('0x3d'))){_0x5d3f53[_0x83db('0x22')]=qs[_0x83db('0x22')](_0x322b41[_0x83db('0x34')][_0x83db('0x22')]);_0x5d3f53[_0x83db('0x20')]=qs[_0x83db('0x20')](_0x322b41['query'][_0x83db('0x20')]);}_0x5d3f53['order']=qs[_0x83db('0x3e')](_0x322b41[_0x83db('0x34')]['sort']);_0x5d3f53[_0x83db('0x3f')]=qs[_0x83db('0x36')](_['pick'](_0x322b41['query'],_0x5592a4['filters']),_0x3fc353);if(_0x322b41[_0x83db('0x34')][_0x83db('0x40')]){_0x5d3f53[_0x83db('0x3f')]=_[_0x83db('0x41')](_0x5d3f53[_0x83db('0x3f')],{'$or':_[_0x83db('0x2e')](_0x3fc353,function(_0x285bac){if(_0x285bac['type']!=='VIRTUAL'){var _0x51e11e={};_0x51e11e[_0x285bac['name']]={'$like':'%'+_0x322b41[_0x83db('0x34')][_0x83db('0x40')]+'%'};return _0x51e11e;}})});}_0x5d3f53=_[_0x83db('0x41')]({},_0x5d3f53,_0x322b41[_0x83db('0x42')]);var _0x63c890={'where':_0x5d3f53[_0x83db('0x3f')]};return db[_0x83db('0x2f')][_0x83db('0x23')](_0x63c890)['then'](function(_0x2b02a1){_0x57f3c7[_0x83db('0x23')]=_0x2b02a1;if(_0x322b41[_0x83db('0x34')][_0x83db('0x43')]){_0x5d3f53[_0x83db('0x44')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x83db('0x45')](_0x5d3f53);})['then'](function(_0x342b49){_0x57f3c7[_0x83db('0x46')]=_0x342b49;return _0x57f3c7;})[_0x83db('0x28')](respondWithFilteredResult(_0x23c186,_0x5d3f53))[_0x83db('0x47')](handleError(_0x23c186,null));};exports[_0x83db('0x48')]=function(_0x2fc3bc,_0x1184c6){var _0x299f9c={'raw':!![],'where':{'id':_0x2fc3bc[_0x83db('0x49')]['id']}},_0x38f779={};_0x38f779[_0x83db('0x38')]=_[_0x83db('0x35')](db[_0x83db('0x2f')][_0x83db('0x30')]);_0x38f779[_0x83db('0x34')]=_[_0x83db('0x35')](_0x2fc3bc[_0x83db('0x34')]);_0x38f779['filters']=_[_0x83db('0x37')](_0x38f779['model'],_0x38f779['query']);_0x299f9c[_0x83db('0x39')]=_['intersection'](_0x38f779[_0x83db('0x38')],qs['fields'](_0x2fc3bc['query']['fields']));_0x299f9c[_0x83db('0x39')]=_0x299f9c[_0x83db('0x39')][_0x83db('0x3b')]?_0x299f9c[_0x83db('0x39')]:_0x38f779[_0x83db('0x38')];if(_0x2fc3bc[_0x83db('0x34')][_0x83db('0x43')]){_0x299f9c[_0x83db('0x44')]=[{'all':!![]}];}_0x299f9c=_[_0x83db('0x41')]({},_0x299f9c,_0x2fc3bc['options']);return db['CmHopperHistory'][_0x83db('0x4a')](_0x299f9c)[_0x83db('0x28')](handleEntityNotFound(_0x1184c6,null))[_0x83db('0x28')](respondWithResult(_0x1184c6,null))[_0x83db('0x47')](handleError(_0x1184c6,null));};exports[_0x83db('0x4b')]=function(_0xbba727,_0x1563a6){return db['CmHopperHistory'][_0x83db('0x4b')](_0xbba727[_0x83db('0x4c')],{})[_0x83db('0x28')](respondWithResult(_0x1563a6,0xc9))[_0x83db('0x47')](handleError(_0x1563a6,null));};exports['describe']=function(_0x3ffba8,_0xceaf4){return db[_0x83db('0x2f')][_0x83db('0x4d')]()['then'](respondWithResult(_0xceaf4,null))[_0x83db('0x47')](handleError(_0xceaf4,null));};exports[_0x83db('0x27')]=function(_0x1603a0,_0x44c1c9){if(_0x1603a0[_0x83db('0x4c')]['uniqueid']){delete _0x1603a0[_0x83db('0x4c')][_0x83db('0x4e')];}return db[_0x83db('0x2f')][_0x83db('0x4a')]({'where':{'uniqueid':_0x1603a0[_0x83db('0x49')]['id']}})[_0x83db('0x28')](handleEntityNotFound(_0x44c1c9,null))[_0x83db('0x28')](saveUpdates(_0x1603a0[_0x83db('0x4c')],null))[_0x83db('0x28')](respondWithResult(_0x44c1c9,null))[_0x83db('0x47')](handleError(_0x44c1c9,null));}; \ No newline at end of file +var _0xfffc=['model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','describe','uniqueid','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','key'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xfffc,0x6b));var _0xcfff=function(_0x2985ac,_0x38254e){_0x2985ac=_0x2985ac-0x0;var _0x382b19=_0xfffc[_0x2985ac];return _0x382b19;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcfff('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcfff('0x1'));var rp=require('request-promise');var moment=require(_0xcfff('0x2'));var BPromise=require(_0xcfff('0x3'));var Mustache=require(_0xcfff('0x4'));var util=require(_0xcfff('0x5'));var path=require(_0xcfff('0x6'));var sox=require(_0xcfff('0x7'));var csv=require(_0xcfff('0x8'));var ejs=require(_0xcfff('0x9'));var fs=require('fs');var fs_extra=require(_0xcfff('0xa'));var _=require(_0xcfff('0xb'));var squel=require(_0xcfff('0xc'));var crypto=require(_0xcfff('0xd'));var jsforce=require(_0xcfff('0xe'));var deskjs=require(_0xcfff('0xf'));var toCsv=require(_0xcfff('0x8'));var querystring=require(_0xcfff('0x10'));var Papa=require(_0xcfff('0x11'));var Redis=require(_0xcfff('0x12'));var authService=require(_0xcfff('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcfff('0x14'));var logger=require(_0xcfff('0x15'))(_0xcfff('0x16'));var utils=require(_0xcfff('0x17'));var config=require(_0xcfff('0x18'));var licenseUtil=require(_0xcfff('0x19'));var db=require(_0xcfff('0x1a'))['db'];function respondWithStatusCode(_0x299a68,_0x3019fb){_0x3019fb=_0x3019fb||0xcc;return function(_0x4c4332){if(_0x4c4332){return _0x299a68[_0xcfff('0x1b')](_0x3019fb);}return _0x299a68[_0xcfff('0x1c')](_0x3019fb)[_0xcfff('0x1d')]();};}function respondWithResult(_0x3e309f,_0x5e8c83){_0x5e8c83=_0x5e8c83||0xc8;return function(_0x2888e4){if(_0x2888e4){return _0x3e309f[_0xcfff('0x1c')](_0x5e8c83)[_0xcfff('0x1e')](_0x2888e4);}};}function respondWithFilteredResult(_0x1f0bc5,_0x1fbdf5){return function(_0x10fc47){if(_0x10fc47){var _0x21be65=typeof _0x1fbdf5[_0xcfff('0x1f')]===_0xcfff('0x20')&&typeof _0x1fbdf5[_0xcfff('0x21')]===_0xcfff('0x20');var _0x9da6d2=_0x10fc47[_0xcfff('0x22')];var _0xbc7b63=_0x21be65?0x0:_0x1fbdf5[_0xcfff('0x1f')];var _0x1fcbdb=_0x21be65?_0x10fc47[_0xcfff('0x22')]:_0x1fbdf5[_0xcfff('0x1f')]+_0x1fbdf5[_0xcfff('0x21')];var _0x3c6998;if(_0x1fcbdb>=_0x9da6d2){_0x1fcbdb=_0x9da6d2;_0x3c6998=0xc8;}else{_0x3c6998=0xce;}_0x1f0bc5[_0xcfff('0x1c')](_0x3c6998);return _0x1f0bc5[_0xcfff('0x23')](_0xcfff('0x24'),_0xbc7b63+'-'+_0x1fcbdb+'/'+_0x9da6d2)[_0xcfff('0x1e')](_0x10fc47);}return null;};}function patchUpdates(_0x5288a9){return function(_0x1cf7b8){try{jsonpatch['apply'](_0x1cf7b8,_0x5288a9,!![]);}catch(_0x4bce91){return BPromise[_0xcfff('0x25')](_0x4bce91);}return _0x1cf7b8[_0xcfff('0x26')]();};}function saveUpdates(_0xb75f96,_0x26b3f6){return function(_0x22c7da){if(_0x22c7da){return _0x22c7da[_0xcfff('0x27')](_0xb75f96)[_0xcfff('0x28')](function(_0x288a53){return _0x288a53;});}return null;};}function removeEntity(_0x309a74,_0x4a4b77){return function(_0x367928){if(_0x367928){return _0x367928[_0xcfff('0x29')]()[_0xcfff('0x28')](function(){_0x309a74['status'](0xcc)[_0xcfff('0x1d')]();});}};}function handleEntityNotFound(_0x1055cc,_0x232502){return function(_0x1c296f){if(!_0x1c296f){_0x1055cc[_0xcfff('0x1b')](0x194);}return _0x1c296f;};}function handleError(_0x68669b,_0x23d4cf){_0x23d4cf=_0x23d4cf||0x1f4;return function(_0x575b78){logger[_0xcfff('0x2a')](_0x575b78[_0xcfff('0x2b')]);if(_0x575b78[_0xcfff('0x2c')]){delete _0x575b78[_0xcfff('0x2c')];}_0x68669b[_0xcfff('0x1c')](_0x23d4cf)[_0xcfff('0x2d')](_0x575b78);};}exports[_0xcfff('0x2e')]=function(_0x47766b,_0x78b954){var _0x3cc9d8={},_0xf1c77b={},_0x2a85ff={'count':0x0,'rows':[]};var _0x21288a=_[_0xcfff('0x2f')](db[_0xcfff('0x30')][_0xcfff('0x31')],function(_0x3071fa){return{'name':_0x3071fa[_0xcfff('0x32')],'type':_0x3071fa[_0xcfff('0x33')][_0xcfff('0x34')]};});_0xf1c77b[_0xcfff('0x35')]=_[_0xcfff('0x2f')](_0x21288a,_0xcfff('0x2c'));_0xf1c77b[_0xcfff('0x36')]=_[_0xcfff('0x37')](_0x47766b[_0xcfff('0x36')]);_0xf1c77b['filters']=_[_0xcfff('0x38')](_0xf1c77b['model'],_0xf1c77b[_0xcfff('0x36')]);_0x3cc9d8[_0xcfff('0x39')]=_[_0xcfff('0x38')](_0xf1c77b[_0xcfff('0x35')],qs[_0xcfff('0x3a')](_0x47766b['query'][_0xcfff('0x3a')]));_0x3cc9d8['attributes']=_0x3cc9d8[_0xcfff('0x39')][_0xcfff('0x3b')]?_0x3cc9d8['attributes']:_0xf1c77b[_0xcfff('0x35')];if(!_0x47766b[_0xcfff('0x36')][_0xcfff('0x3c')]('nolimit')){_0x3cc9d8[_0xcfff('0x21')]=qs[_0xcfff('0x21')](_0x47766b[_0xcfff('0x36')][_0xcfff('0x21')]);_0x3cc9d8[_0xcfff('0x1f')]=qs[_0xcfff('0x1f')](_0x47766b['query'][_0xcfff('0x1f')]);}_0x3cc9d8[_0xcfff('0x3d')]=qs['sort'](_0x47766b[_0xcfff('0x36')][_0xcfff('0x3e')]);_0x3cc9d8['where']=qs[_0xcfff('0x3f')](_[_0xcfff('0x40')](_0x47766b[_0xcfff('0x36')],_0xf1c77b['filters']),_0x21288a);if(_0x47766b[_0xcfff('0x36')][_0xcfff('0x41')]){_0x3cc9d8[_0xcfff('0x42')]=_[_0xcfff('0x43')](_0x3cc9d8[_0xcfff('0x42')],{'$or':_['map'](_0x21288a,function(_0x37929f){if(_0x37929f[_0xcfff('0x33')]!=='VIRTUAL'){var _0x5abf79={};_0x5abf79[_0x37929f[_0xcfff('0x2c')]]={'$like':'%'+_0x47766b['query'][_0xcfff('0x41')]+'%'};return _0x5abf79;}})});}_0x3cc9d8=_['merge']({},_0x3cc9d8,_0x47766b[_0xcfff('0x44')]);var _0x5e67a5={'where':_0x3cc9d8['where']};return db[_0xcfff('0x30')][_0xcfff('0x22')](_0x5e67a5)[_0xcfff('0x28')](function(_0x2bfc75){_0x2a85ff['count']=_0x2bfc75;if(_0x47766b[_0xcfff('0x36')][_0xcfff('0x45')]){_0x3cc9d8[_0xcfff('0x46')]=[{'all':!![]}];}return db[_0xcfff('0x30')][_0xcfff('0x47')](_0x3cc9d8);})[_0xcfff('0x28')](function(_0x18bce4){_0x2a85ff[_0xcfff('0x48')]=_0x18bce4;return _0x2a85ff;})[_0xcfff('0x28')](respondWithFilteredResult(_0x78b954,_0x3cc9d8))[_0xcfff('0x49')](handleError(_0x78b954,null));};exports[_0xcfff('0x4a')]=function(_0x34b4d3,_0x54b76f){var _0x4a767c={'raw':!![],'where':{'id':_0x34b4d3['params']['id']}},_0x38bf87={};_0x38bf87[_0xcfff('0x35')]=_[_0xcfff('0x37')](db[_0xcfff('0x30')][_0xcfff('0x31')]);_0x38bf87[_0xcfff('0x36')]=_[_0xcfff('0x37')](_0x34b4d3[_0xcfff('0x36')]);_0x38bf87[_0xcfff('0x3f')]=_[_0xcfff('0x38')](_0x38bf87[_0xcfff('0x35')],_0x38bf87['query']);_0x4a767c[_0xcfff('0x39')]=_[_0xcfff('0x38')](_0x38bf87[_0xcfff('0x35')],qs['fields'](_0x34b4d3[_0xcfff('0x36')][_0xcfff('0x3a')]));_0x4a767c[_0xcfff('0x39')]=_0x4a767c[_0xcfff('0x39')]['length']?_0x4a767c[_0xcfff('0x39')]:_0x38bf87[_0xcfff('0x35')];if(_0x34b4d3[_0xcfff('0x36')]['includeAll']){_0x4a767c[_0xcfff('0x46')]=[{'all':!![]}];}_0x4a767c=_[_0xcfff('0x43')]({},_0x4a767c,_0x34b4d3[_0xcfff('0x44')]);return db[_0xcfff('0x30')][_0xcfff('0x4b')](_0x4a767c)['then'](handleEntityNotFound(_0x54b76f,null))[_0xcfff('0x28')](respondWithResult(_0x54b76f,null))['catch'](handleError(_0x54b76f,null));};exports[_0xcfff('0x4c')]=function(_0x409542,_0x38e55e){return db['CmHopperHistory'][_0xcfff('0x4c')](_0x409542[_0xcfff('0x4d')],{})[_0xcfff('0x28')](respondWithResult(_0x38e55e,0xc9))[_0xcfff('0x49')](handleError(_0x38e55e,null));};exports[_0xcfff('0x4e')]=function(_0x460fa8,_0x3aed11){return db['CmHopperHistory'][_0xcfff('0x4e')]()[_0xcfff('0x28')](respondWithResult(_0x3aed11,null))['catch'](handleError(_0x3aed11,null));};exports[_0xcfff('0x27')]=function(_0x2a44b6,_0xdf9bd7){if(_0x2a44b6[_0xcfff('0x4d')][_0xcfff('0x4f')]){delete _0x2a44b6['body'][_0xcfff('0x4f')];}return db['CmHopperHistory'][_0xcfff('0x4b')]({'where':{'uniqueid':_0x2a44b6['params']['id']}})[_0xcfff('0x28')](handleEntityNotFound(_0xdf9bd7,null))['then'](saveUpdates(_0x2a44b6[_0xcfff('0x4d')],null))[_0xcfff('0x28')](respondWithResult(_0xdf9bd7,null))[_0xcfff('0x49')](handleError(_0xdf9bd7,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 2e79a7d..b36fa15 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 _0x8814=['lodash','api','bluebird','request-promise','path','rimraf','./cmHopperHistory.attributes','exports','CmHopperHistory','endtime','uniqueid'];(function(_0x485cd4,_0x506e1b){var _0x528199=function(_0x8472b3){while(--_0x8472b3){_0x485cd4['push'](_0x485cd4['shift']());}};_0x528199(++_0x506e1b);}(_0x8814,0x1b8));var _0x4881=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0x8814[_0xda464c];return _0x19e222;};'use strict';var _=require(_0x4881('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4881('0x1'));var moment=require('moment');var BPromise=require(_0x4881('0x2'));var rp=require(_0x4881('0x3'));var fs=require('fs');var path=require(_0x4881('0x4'));var rimraf=require(_0x4881('0x5'));var config=require('../../config/environment');var attributes=require(_0x4881('0x6'));module[_0x4881('0x7')]=function(_0x20bc6c,_0x1f292f){return _0x20bc6c['define'](_0x4881('0x8'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0x4881('0x9'),'fields':[_0x4881('0x9')]},{'name':_0x4881('0xa'),'fields':[_0x4881('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4f2f=['define','CmHopperHistory','endtime','uniqueid','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports'];(function(_0x3d486f,_0x13af81){var _0x3af020=function(_0x4ac395){while(--_0x4ac395){_0x3d486f['push'](_0x3d486f['shift']());}};_0x3af020(++_0x13af81);}(_0x4f2f,0x1cb));var _0xf4f2=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x4f2f[_0x1d24eb];return _0x1dc576;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf4f2('0x0'))(_0xf4f2('0x1'));var moment=require('moment');var BPromise=require(_0xf4f2('0x2'));var rp=require(_0xf4f2('0x3'));var fs=require('fs');var path=require(_0xf4f2('0x4'));var rimraf=require(_0xf4f2('0x5'));var config=require(_0xf4f2('0x6'));var attributes=require(_0xf4f2('0x7'));module[_0xf4f2('0x8')]=function(_0x2d7c29,_0x1e0ceb){return _0x2d7c29[_0xf4f2('0x9')](_0xf4f2('0xa'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0xf4f2('0xb'),'fields':[_0xf4f2('0xb')]},{'name':'uniqueid','fields':[_0xf4f2('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index dd91eee..b018917 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 _0x43c8=['findAll','where','campaign','name','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','col','ivrTotalCallsDays','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','CmHopperHistory,\x20%s,\x20%s','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','AvgHandleTime','sequelize','COUNT','predictiveIntervalTotalCalls','literal','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','`state`\x20=\x204,\x20`talktime`,\x20null'];(function(_0x34c78a,_0x4b227f){var _0x498e41=function(_0x3e3810){while(--_0x3e3810){_0x34c78a['push'](_0x34c78a['shift']());}};_0x498e41(++_0x4b227f);}(_0x43c8,0xaf));var _0x843c=function(_0x2fe51c,_0x5d55b5){_0x2fe51c=_0x2fe51c-0x0;var _0x1ddf0f=_0x43c8[_0x2fe51c];return _0x1ddf0f;};'use strict';var _=require('lodash');var util=require(_0x843c('0x0'));var moment=require('moment');var BPromise=require(_0x843c('0x1'));var rs=require(_0x843c('0x2'));var fs=require('fs');var Redis=require(_0x843c('0x3'));var db=require(_0x843c('0x4'))['db'];var utils=require(_0x843c('0x5'));var logger=require(_0x843c('0x6'))(_0x843c('0x7'));var config=require('../../config/environment');var jayson=require(_0x843c('0x8'));var client=jayson[_0x843c('0x9')][_0x843c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15bb1f,_0xd198e5,_0x49aee7){return new BPromise(function(_0x327327,_0x41f56d){return client['request'](_0x15bb1f,_0x49aee7)[_0x843c('0xb')](function(_0x566777){logger['info'](_0x843c('0xc'),_0xd198e5,'request\x20sent');logger[_0x843c('0xd')](_0x843c('0xe'),_0xd198e5,_0x843c('0xf'),JSON[_0x843c('0x10')](_0x566777));if(_0x566777['error']){if(_0x566777[_0x843c('0x11')][_0x843c('0x12')]===0x1f4){logger[_0x843c('0x11')](_0x843c('0xc'),_0xd198e5,_0x566777[_0x843c('0x11')][_0x843c('0x13')]);return _0x41f56d(_0x566777[_0x843c('0x11')][_0x843c('0x13')]);}logger[_0x843c('0x11')](_0x843c('0xc'),_0xd198e5,_0x566777[_0x843c('0x11')][_0x843c('0x13')]);return _0x327327(_0x566777[_0x843c('0x11')][_0x843c('0x13')]);}else{logger[_0x843c('0x14')]('CmHopperHistory,\x20%s,\x20%s',_0xd198e5,_0x843c('0xf'));_0x327327(_0x566777[_0x843c('0x15')][_0x843c('0x13')]);}})[_0x843c('0x16')](function(_0x16e8f6){logger['error'](_0x843c('0xc'),_0xd198e5,_0x16e8f6);_0x41f56d(_0x16e8f6);});});}exports[_0x843c('0x17')]=function(_0x1a7966){var _0x2acf94=this;return new Promise(function(_0x47d16a,_0xf53b50){return db[_0x843c('0x18')][_0x843c('0x19')](_0x1a7966[_0x843c('0x1a')],{'raw':_0x1a7966[_0x843c('0x1b')]?_0x1a7966['options'][_0x843c('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x505d5c){logger['info'](_0x843c('0x17'),_0x1a7966);logger[_0x843c('0xd')]('CreateCmHopperHistory',_0x1a7966,JSON[_0x843c('0x10')](_0x505d5c));_0x47d16a(_0x505d5c);})[_0x843c('0x16')](function(_0x2d1d43){logger[_0x843c('0x11')]('CreateCmHopperHistory',_0x2d1d43['message'],_0x1a7966);_0xf53b50(_0x2acf94['error'](0x1f4,_0x2d1d43[_0x843c('0x13')]));});});};exports[_0x843c('0x1d')]=function(_0x2d90f9){var _0x408bf1=this;return new Promise(function(_0x714f6,_0x35c3b1){return db[_0x843c('0x18')]['findAll']({'raw':_0x2d90f9[_0x843c('0x1b')]?_0x2d90f9[_0x843c('0x1b')][_0x843c('0x1c')]===undefined?!![]:![]:!![],'where':_0x2d90f9['options']?_0x2d90f9[_0x843c('0x1b')]['where']||null:null,'attributes':[[db[_0x843c('0x1e')]['fn'](_0x843c('0x1f'),db[_0x843c('0x1e')]['col']('id')),_0x843c('0x20')],[db[_0x843c('0x1e')]['fn'](_0x843c('0x1f'),db[_0x843c('0x1e')]['fn']('IF',db[_0x843c('0x1e')][_0x843c('0x21')]('`state`\x20=\x204,\x201,\x20null'))),_0x843c('0x22')],[db['sequelize']['fn'](_0x843c('0x1f'),db[_0x843c('0x1e')]['fn']('IF',db[_0x843c('0x1e')][_0x843c('0x21')]('`state`\x20=\x2010,\x201,\x20null'))),_0x843c('0x23')],[db[_0x843c('0x1e')]['fn'](_0x843c('0x1f'),db[_0x843c('0x1e')]['fn']('IF',db[_0x843c('0x1e')][_0x843c('0x21')](_0x843c('0x24')))),_0x843c('0x25')],[db[_0x843c('0x1e')]['fn'](_0x843c('0x26'),db[_0x843c('0x1e')]['fn']('IF',db[_0x843c('0x1e')]['literal'](_0x843c('0x27')))),'predictiveIntervalAvgHoldtime'],[db[_0x843c('0x1e')]['fn'](_0x843c('0x26'),db['sequelize']['fn']('IF',db[_0x843c('0x1e')][_0x843c('0x21')](_0x843c('0x28')))),'predictiveIntervalAvgTalktime']]})[_0x843c('0xb')](function(_0x770e0b){logger['info'](_0x843c('0x1d'),_0x2d90f9);logger['debug'](_0x843c('0x1d'),_0x2d90f9,JSON[_0x843c('0x10')](_0x770e0b));_0x714f6(_0x770e0b);})[_0x843c('0x16')](function(_0x53f0e5){logger[_0x843c('0x11')](_0x843c('0x1d'),_0x53f0e5[_0x843c('0x13')],_0x2d90f9);_0x35c3b1(_0x408bf1[_0x843c('0x11')](0x1f4,_0x53f0e5[_0x843c('0x13')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x11a182){var _0x17309a=this;return new Promise(function(_0x6932cc,_0x16d3d1){return db[_0x843c('0x18')][_0x843c('0x29')]({'raw':_0x11a182['options']?_0x11a182[_0x843c('0x1b')][_0x843c('0x1c')]===undefined?!![]:![]:!![],'where':_0x11a182[_0x843c('0x1b')]?_0x11a182[_0x843c('0x1b')][_0x843c('0x2a')]||null:null,'attributes':[[_0x843c('0x2b'),_0x843c('0x2c')],[db['sequelize']['fn']('COUNT',db[_0x843c('0x1e')]['fn']('IF',db[_0x843c('0x1e')][_0x843c('0x21')]('`state`\x20=\x200,\x201,\x20null'))),_0x843c('0x2d')],[db[_0x843c('0x1e')]['fn'](_0x843c('0x1f'),db[_0x843c('0x1e')]['fn']('IF',db[_0x843c('0x1e')]['literal'](_0x843c('0x2e')))),_0x843c('0x2f')],[db[_0x843c('0x1e')]['fn'](_0x843c('0x1f'),db[_0x843c('0x1e')]['fn']('IF',db[_0x843c('0x1e')][_0x843c('0x21')](_0x843c('0x30')))),_0x843c('0x31')],[db[_0x843c('0x1e')]['fn'](_0x843c('0x1f'),db[_0x843c('0x1e')]['fn']('IF',db[_0x843c('0x1e')][_0x843c('0x21')](_0x843c('0x32')))),'outboundBusyCallsDay'],[db['sequelize']['fn']('COUNT',db[_0x843c('0x1e')]['fn']('IF',db['sequelize'][_0x843c('0x21')](_0x843c('0x33')))),'outboundCongestionCallsDay'],[db[_0x843c('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x843c('0x21')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x843c('0x34')],[db[_0x843c('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x843c('0x1e')][_0x843c('0x21')](_0x843c('0x35')))),_0x843c('0x36')],[db[_0x843c('0x1e')]['fn']('COUNT',db[_0x843c('0x1e')]['fn']('IF',db['sequelize'][_0x843c('0x21')](_0x843c('0x37')))),_0x843c('0x38')],[db[_0x843c('0x1e')]['fn'](_0x843c('0x1f'),db[_0x843c('0x1e')]['fn']('IF',db[_0x843c('0x1e')][_0x843c('0x21')](_0x843c('0x39')))),_0x843c('0x3a')],[db[_0x843c('0x1e')]['fn'](_0x843c('0x1f'),db[_0x843c('0x1e')]['fn']('IF',db[_0x843c('0x1e')][_0x843c('0x21')](_0x843c('0x3b')))),_0x843c('0x3c')],[db['sequelize']['fn'](_0x843c('0x1f'),db[_0x843c('0x1e')]['fn']('IF',db[_0x843c('0x1e')][_0x843c('0x21')](_0x843c('0x3d')))),'outboundRejectCallsDay'],[db[_0x843c('0x1e')]['fn']('COUNT',db[_0x843c('0x1e')]['fn']('IF',db['sequelize'][_0x843c('0x21')](_0x843c('0x3e')))),_0x843c('0x3f')],[db[_0x843c('0x1e')]['fn'](_0x843c('0x1f'),db[_0x843c('0x1e')]['fn']('IF',db[_0x843c('0x1e')][_0x843c('0x21')](_0x843c('0x40')))),_0x843c('0x41')],[db['sequelize']['fn'](_0x843c('0x1f'),db[_0x843c('0x1e')]['fn']('IF',db[_0x843c('0x1e')][_0x843c('0x21')](_0x843c('0x42')))),_0x843c('0x43')]],'group':[_0x843c('0x2b')]})[_0x843c('0xb')](function(_0x29fe16){logger[_0x843c('0x14')]('GetVoiceQueueHopperHistory',_0x11a182);logger[_0x843c('0xd')](_0x843c('0x44'),_0x11a182,JSON[_0x843c('0x10')](_0x29fe16));_0x6932cc(_0x29fe16);})['catch'](function(_0x3294ad){logger[_0x843c('0x11')](_0x843c('0x44'),_0x3294ad[_0x843c('0x13')],_0x11a182);_0x16d3d1(_0x17309a[_0x843c('0x11')](0x1f4,_0x3294ad[_0x843c('0x13')]));});});};exports[_0x843c('0x45')]=function(_0x1b97bd){var _0x481d5d=this;return new Promise(function(_0x5a3d3d,_0x3463ec){return db[_0x843c('0x18')][_0x843c('0x29')]({'raw':_0x1b97bd['options']?_0x1b97bd[_0x843c('0x1b')][_0x843c('0x1c')]===undefined?!![]:![]:!![],'where':_0x1b97bd[_0x843c('0x1b')]?_0x1b97bd[_0x843c('0x1b')][_0x843c('0x2a')]||null:null,'attributes':[['campaign',_0x843c('0x2c')],[db['sequelize']['fn'](_0x843c('0x1f'),db[_0x843c('0x1e')][_0x843c('0x46')]('id')),_0x843c('0x47')],[db[_0x843c('0x1e')]['fn']('COUNT',db[_0x843c('0x1e')]['fn']('IF',db['sequelize'][_0x843c('0x21')](_0x843c('0x30')))),'ivrAnswerCallsDay']],'group':[_0x843c('0x2b')]})[_0x843c('0xb')](function(_0x2fe476){logger[_0x843c('0x14')](_0x843c('0x45'),_0x1b97bd);logger[_0x843c('0xd')](_0x843c('0x45'),_0x1b97bd,JSON[_0x843c('0x10')](_0x2fe476));_0x5a3d3d(_0x2fe476);})[_0x843c('0x16')](function(_0x5df9af){logger[_0x843c('0x11')](_0x843c('0x45'),_0x5df9af['message'],_0x1b97bd);_0x3463ec(_0x481d5d[_0x843c('0x11')](0x1f4,_0x5df9af[_0x843c('0x13')]));});});}; \ No newline at end of file +var _0x3445=['request\x20sent','debug','stringify','error','code','message','info','result','catch','CreateCmHopperHistory','CmHopperHistory','body','options','raw','then','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgTalktime','AvgHandleTime','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','ivrTotalCallsDays','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','CmHopperHistory,\x20%s,\x20%s'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x3445,0x13a));var _0x5344=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3445[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5344('0x0'));var util=require(_0x5344('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5344('0x2'));var fs=require('fs');var Redis=require(_0x5344('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5344('0x4'));var logger=require(_0x5344('0x5'))(_0x5344('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5344('0x7')][_0x5344('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xea8222,_0x3c4589,_0x9f237f){return new BPromise(function(_0xb805dc,_0x530ebb){return client[_0x5344('0x9')](_0xea8222,_0x9f237f)['then'](function(_0x271c86){logger['info'](_0x5344('0xa'),_0x3c4589,_0x5344('0xb'));logger[_0x5344('0xc')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x3c4589,_0x5344('0xb'),JSON[_0x5344('0xd')](_0x271c86));if(_0x271c86[_0x5344('0xe')]){if(_0x271c86[_0x5344('0xe')][_0x5344('0xf')]===0x1f4){logger['error'](_0x5344('0xa'),_0x3c4589,_0x271c86[_0x5344('0xe')][_0x5344('0x10')]);return _0x530ebb(_0x271c86[_0x5344('0xe')]['message']);}logger[_0x5344('0xe')]('CmHopperHistory,\x20%s,\x20%s',_0x3c4589,_0x271c86[_0x5344('0xe')][_0x5344('0x10')]);return _0xb805dc(_0x271c86[_0x5344('0xe')]['message']);}else{logger[_0x5344('0x11')]('CmHopperHistory,\x20%s,\x20%s',_0x3c4589,_0x5344('0xb'));_0xb805dc(_0x271c86[_0x5344('0x12')][_0x5344('0x10')]);}})[_0x5344('0x13')](function(_0x2b4963){logger[_0x5344('0xe')]('CmHopperHistory,\x20%s,\x20%s',_0x3c4589,_0x2b4963);_0x530ebb(_0x2b4963);});});}exports[_0x5344('0x14')]=function(_0x5ee0a3){var _0xd2740c=this;return new Promise(function(_0x193492,_0xf2811d){return db[_0x5344('0x15')]['create'](_0x5ee0a3[_0x5344('0x16')],{'raw':_0x5ee0a3[_0x5344('0x17')]?_0x5ee0a3['options'][_0x5344('0x18')]===undefined?!![]:![]:!![]})[_0x5344('0x19')](function(_0x3418da){logger[_0x5344('0x11')](_0x5344('0x14'),_0x5ee0a3);logger[_0x5344('0xc')](_0x5344('0x14'),_0x5ee0a3,JSON[_0x5344('0xd')](_0x3418da));_0x193492(_0x3418da);})[_0x5344('0x13')](function(_0x1ebec4){logger[_0x5344('0xe')]('CreateCmHopperHistory',_0x1ebec4['message'],_0x5ee0a3);_0xf2811d(_0xd2740c[_0x5344('0xe')](0x1f4,_0x1ebec4[_0x5344('0x10')]));});});};exports['AvgHandleTime']=function(_0x487993){var _0x20472=this;return new Promise(function(_0x20f228,_0x2f000d){return db['CmHopperHistory'][_0x5344('0x1a')]({'raw':_0x487993[_0x5344('0x17')]?_0x487993['options'][_0x5344('0x18')]===undefined?!![]:![]:!![],'where':_0x487993[_0x5344('0x17')]?_0x487993[_0x5344('0x17')][_0x5344('0x1b')]||null:null,'attributes':[[db[_0x5344('0x1c')]['fn'](_0x5344('0x1d'),db[_0x5344('0x1c')][_0x5344('0x1e')]('id')),_0x5344('0x1f')],[db[_0x5344('0x1c')]['fn']('COUNT',db[_0x5344('0x1c')]['fn']('IF',db[_0x5344('0x1c')][_0x5344('0x20')](_0x5344('0x21')))),'predictiveIntervalAnsweredCalls'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x5344('0x1c')][_0x5344('0x20')](_0x5344('0x22')))),_0x5344('0x23')],[db[_0x5344('0x1c')]['fn'](_0x5344('0x1d'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x5344('0x24')))),_0x5344('0x25')],[db[_0x5344('0x1c')]['fn'](_0x5344('0x26'),db['sequelize']['fn']('IF',db[_0x5344('0x1c')]['literal'](_0x5344('0x27')))),'predictiveIntervalAvgHoldtime'],[db[_0x5344('0x1c')]['fn'](_0x5344('0x26'),db['sequelize']['fn']('IF',db[_0x5344('0x1c')][_0x5344('0x20')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x5344('0x28')]]})['then'](function(_0x217c43){logger[_0x5344('0x11')](_0x5344('0x29'),_0x487993);logger[_0x5344('0xc')](_0x5344('0x29'),_0x487993,JSON[_0x5344('0xd')](_0x217c43));_0x20f228(_0x217c43);})[_0x5344('0x13')](function(_0x1e7070){logger['error'](_0x5344('0x29'),_0x1e7070['message'],_0x487993);_0x2f000d(_0x20472[_0x5344('0xe')](0x1f4,_0x1e7070[_0x5344('0x10')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x35c7d0){var _0x2bb695=this;return new Promise(function(_0x29d396,_0x2eaffa){return db[_0x5344('0x15')][_0x5344('0x1a')]({'raw':_0x35c7d0['options']?_0x35c7d0[_0x5344('0x17')][_0x5344('0x18')]===undefined?!![]:![]:!![],'where':_0x35c7d0[_0x5344('0x17')]?_0x35c7d0[_0x5344('0x17')][_0x5344('0x1b')]||null:null,'attributes':[[_0x5344('0x2a'),_0x5344('0x2b')],[db[_0x5344('0x1c')]['fn'](_0x5344('0x1d'),db[_0x5344('0x1c')]['fn']('IF',db['sequelize'][_0x5344('0x20')](_0x5344('0x2c')))),_0x5344('0x2d')],[db[_0x5344('0x1c')]['fn'](_0x5344('0x1d'),db[_0x5344('0x1c')]['fn']('IF',db[_0x5344('0x1c')][_0x5344('0x20')](_0x5344('0x2e')))),'outboundNoAnswerCallsDay'],[db[_0x5344('0x1c')]['fn'](_0x5344('0x1d'),db[_0x5344('0x1c')]['fn']('IF',db[_0x5344('0x1c')][_0x5344('0x20')](_0x5344('0x21')))),_0x5344('0x2f')],[db[_0x5344('0x1c')]['fn']('COUNT',db[_0x5344('0x1c')]['fn']('IF',db[_0x5344('0x1c')][_0x5344('0x20')]('`state`\x20=\x205,\x201,\x20null'))),_0x5344('0x30')],[db[_0x5344('0x1c')]['fn'](_0x5344('0x1d'),db['sequelize']['fn']('IF',db[_0x5344('0x1c')][_0x5344('0x20')]('`state`\x20=\x208,\x201,\x20null'))),'outboundCongestionCallsDay'],[db[_0x5344('0x1c')]['fn']('COUNT',db[_0x5344('0x1c')]['fn']('IF',db[_0x5344('0x1c')][_0x5344('0x20')](_0x5344('0x31')))),_0x5344('0x32')],[db[_0x5344('0x1c')]['fn'](_0x5344('0x1d'),db[_0x5344('0x1c')]['fn']('IF',db[_0x5344('0x1c')][_0x5344('0x20')](_0x5344('0x33')))),_0x5344('0x34')],[db['sequelize']['fn']('COUNT',db[_0x5344('0x1c')]['fn']('IF',db[_0x5344('0x1c')][_0x5344('0x20')]('`state`\x20=\x2012,\x201,\x20null'))),_0x5344('0x35')],[db[_0x5344('0x1c')]['fn'](_0x5344('0x1d'),db[_0x5344('0x1c')]['fn']('IF',db[_0x5344('0x1c')][_0x5344('0x20')](_0x5344('0x36')))),_0x5344('0x37')],[db[_0x5344('0x1c')]['fn'](_0x5344('0x1d'),db[_0x5344('0x1c')]['fn']('IF',db[_0x5344('0x1c')]['literal']('`state`\x20=\x2014,\x201,\x20null'))),_0x5344('0x38')],[db[_0x5344('0x1c')]['fn'](_0x5344('0x1d'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x5344('0x39')))),_0x5344('0x3a')],[db['sequelize']['fn'](_0x5344('0x1d'),db[_0x5344('0x1c')]['fn']('IF',db[_0x5344('0x1c')][_0x5344('0x20')](_0x5344('0x3b')))),_0x5344('0x3c')],[db[_0x5344('0x1c')]['fn'](_0x5344('0x1d'),db[_0x5344('0x1c')]['fn']('IF',db[_0x5344('0x1c')][_0x5344('0x20')](_0x5344('0x3d')))),'outboundRejectCallsDay'],[db[_0x5344('0x1c')]['fn']('COUNT',db[_0x5344('0x1c')]['fn']('IF',db[_0x5344('0x1c')]['literal']('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),'outboundReCallsDay']],'group':[_0x5344('0x2a')]})[_0x5344('0x19')](function(_0x54d2b0){logger['info'](_0x5344('0x3e'),_0x35c7d0);logger[_0x5344('0xc')](_0x5344('0x3e'),_0x35c7d0,JSON[_0x5344('0xd')](_0x54d2b0));_0x29d396(_0x54d2b0);})[_0x5344('0x13')](function(_0x534b32){logger[_0x5344('0xe')](_0x5344('0x3e'),_0x534b32[_0x5344('0x10')],_0x35c7d0);_0x2eaffa(_0x2bb695['error'](0x1f4,_0x534b32['message']));});});};exports[_0x5344('0x3f')]=function(_0x2e71f4){var _0x37409e=this;return new Promise(function(_0xaae044,_0x52882e){return db[_0x5344('0x15')][_0x5344('0x1a')]({'raw':_0x2e71f4[_0x5344('0x17')]?_0x2e71f4[_0x5344('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x2e71f4[_0x5344('0x17')]?_0x2e71f4[_0x5344('0x17')][_0x5344('0x1b')]||null:null,'attributes':[[_0x5344('0x2a'),_0x5344('0x2b')],[db[_0x5344('0x1c')]['fn']('COUNT',db['sequelize'][_0x5344('0x1e')]('id')),_0x5344('0x40')],[db[_0x5344('0x1c')]['fn'](_0x5344('0x1d'),db['sequelize']['fn']('IF',db['sequelize'][_0x5344('0x20')]('`state`\x20=\x204,\x201,\x20null'))),'ivrAnswerCallsDay']],'group':[_0x5344('0x2a')]})[_0x5344('0x19')](function(_0x32cfa4){logger['info'](_0x5344('0x3f'),_0x2e71f4);logger[_0x5344('0xc')]('GetCampaignHopperHistory',_0x2e71f4,JSON[_0x5344('0xd')](_0x32cfa4));_0xaae044(_0x32cfa4);})['catch'](function(_0x56dc43){logger[_0x5344('0xe')](_0x5344('0x3f'),_0x56dc43['message'],_0x2e71f4);_0x52882e(_0x37409e[_0x5344('0xe')](0x1f4,_0x56dc43['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 6bed36e..f52ae22 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 _0x5f58=['update','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperHistory.controller','isAuthenticated','get','describe','/:id','put'];(function(_0x575495,_0x1fce92){var _0x1ade36=function(_0x2f9aac){while(--_0x2f9aac){_0x575495['push'](_0x575495['shift']());}};_0x1ade36(++_0x1fce92);}(_0x5f58,0xb7));var _0x85f5=function(_0x61b4c7,_0xf6eafa){_0x61b4c7=_0x61b4c7-0x0;var _0x5f57a1=_0x5f58[_0x61b4c7];return _0x5f57a1;};'use strict';var multer=require('multer');var util=require(_0x85f5('0x0'));var path=require(_0x85f5('0x1'));var timeout=require(_0x85f5('0x2'));var express=require(_0x85f5('0x3'));var router=express['Router']();var fs_extra=require(_0x85f5('0x4'));var auth=require(_0x85f5('0x5'));var interaction=require(_0x85f5('0x6'));var config=require('../../config/environment');var controller=require(_0x85f5('0x7'));router['get']('/',auth[_0x85f5('0x8')](),controller['index']);router[_0x85f5('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x85f5('0xa')]);router[_0x85f5('0x9')](_0x85f5('0xb'),auth[_0x85f5('0x8')](),controller['show']);router['post']('/',auth[_0x85f5('0x8')](),controller['create']);router[_0x85f5('0xc')](_0x85f5('0xb'),auth[_0x85f5('0x8')](),controller[_0x85f5('0xd')]);module['exports']=router; \ No newline at end of file +var _0x3e0f=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','index','/describe','isAuthenticated','post','create','put','/:id','update','multer','util','path','connect-timeout'];(function(_0xec9d02,_0x32d164){var _0x5b9eba=function(_0x28a5ae){while(--_0x28a5ae){_0xec9d02['push'](_0xec9d02['shift']());}};_0x5b9eba(++_0x32d164);}(_0x3e0f,0x1ea));var _0xf3e0=function(_0x47408e,_0x481428){_0x47408e=_0x47408e-0x0;var _0x1636bc=_0x3e0f[_0x47408e];return _0x1636bc;};'use strict';var multer=require(_0xf3e0('0x0'));var util=require(_0xf3e0('0x1'));var path=require(_0xf3e0('0x2'));var timeout=require(_0xf3e0('0x3'));var express=require('express');var router=express[_0xf3e0('0x4')]();var fs_extra=require(_0xf3e0('0x5'));var auth=require(_0xf3e0('0x6'));var interaction=require(_0xf3e0('0x7'));var config=require(_0xf3e0('0x8'));var controller=require(_0xf3e0('0x9'));router[_0xf3e0('0xa')]('/',auth['isAuthenticated'](),controller[_0xf3e0('0xb')]);router[_0xf3e0('0xa')](_0xf3e0('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xf3e0('0xa')]('/:id',auth[_0xf3e0('0xd')](),controller['show']);router[_0xf3e0('0xe')]('/',auth['isAuthenticated'](),controller[_0xf3e0('0xf')]);router[_0xf3e0('0x10')](_0xf3e0('0x11'),auth['isAuthenticated'](),controller[_0xf3e0('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 2e0f477..200dcf6 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 _0x1793=['STRING','name','sequelize','exports'];(function(_0x2d6077,_0x5754f0){var _0x571132=function(_0x58a68f){while(--_0x58a68f){_0x2d6077['push'](_0x2d6077['shift']());}};_0x571132(++_0x5754f0);}(_0x1793,0x1ce));var _0x3179=function(_0x51ec5c,_0x3506ef){_0x51ec5c=_0x51ec5c-0x0;var _0x5b04b8=_0x1793[_0x51ec5c];return _0x5b04b8;};'use strict';var Sequelize=require(_0x3179('0x0'));module[_0x3179('0x1')]={'name':{'type':Sequelize[_0x3179('0x2')],'unique':_0x3179('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x3179('0x2')]}}; \ No newline at end of file +var _0x64f5=['sequelize','STRING'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x64f5,0x17e));var _0x564f=function(_0x4e3103,_0x2b16fe){_0x4e3103=_0x4e3103-0x0;var _0x5ba646=_0x64f5[_0x4e3103];return _0x5ba646;};'use strict';var Sequelize=require(_0x564f('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x564f('0x1')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index cb3bf71..30b827e 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 _0x6709=['defaultValue','queryInterface','addColumn','cf_%s','getCustomFields','addAgents','omit','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./cmList.socket','register','end','status','json','undefined','count','limit','set','Content-Range','apply','update','then','get','Lists','UserProfileResource','destroy','stack','name','index','CmList','type','key','model','map','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','ListId','getDispositions','findOne','Disposition','includeAll','removeDispositions','ids','addContacts','describe','tags','join','isArray','push','each','CmContact','dataValues','errors','CmCustomField','CustomFields','concat','format','raw','getContactsCsv','getContacts','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','download','sendStatus','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','INTEGER'];(function(_0x42ed7e,_0x63c145){var _0x22b326=function(_0x5d27a3){while(--_0x5d27a3){_0x42ed7e['push'](_0x42ed7e['shift']());}};_0x22b326(++_0x63c145);}(_0x6709,0x12f));var _0x9670=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x6709[_0x32f7d7];return _0x133d09;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9670('0x0'));var zipdir=require(_0x9670('0x1'));var jsonpatch=require(_0x9670('0x2'));var rp=require(_0x9670('0x3'));var moment=require(_0x9670('0x4'));var BPromise=require(_0x9670('0x5'));var Mustache=require(_0x9670('0x6'));var util=require('util');var path=require(_0x9670('0x7'));var sox=require(_0x9670('0x8'));var csv=require(_0x9670('0x9'));var ejs=require(_0x9670('0xa'));var fs=require('fs');var fs_extra=require(_0x9670('0xb'));var _=require(_0x9670('0xc'));var squel=require(_0x9670('0xd'));var crypto=require(_0x9670('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x9670('0xf'));var toCsv=require(_0x9670('0x9'));var querystring=require(_0x9670('0x10'));var Papa=require('papaparse');var Redis=require(_0x9670('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9670('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9670('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x9670('0x14'));var config=require(_0x9670('0x15'));var licenseUtil=require(_0x9670('0x16'));var db=require(_0x9670('0x17'))['db'];config[_0x9670('0x18')]=_[_0x9670('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9670('0x1a'))(new Redis(config[_0x9670('0x18')]));require(_0x9670('0x1b'))[_0x9670('0x1c')](socket);function respondWithStatusCode(_0x35280a,_0x73eb3e){_0x73eb3e=_0x73eb3e||0xcc;return function(_0x2a1af5){if(_0x2a1af5){return _0x35280a['sendStatus'](_0x73eb3e);}return _0x35280a['status'](_0x73eb3e)[_0x9670('0x1d')]();};}function respondWithResult(_0x182414,_0x113b6f){_0x113b6f=_0x113b6f||0xc8;return function(_0x3efa5c){if(_0x3efa5c){return _0x182414[_0x9670('0x1e')](_0x113b6f)[_0x9670('0x1f')](_0x3efa5c);}};}function respondWithFilteredResult(_0x318403,_0x40106a){return function(_0x1199b8){if(_0x1199b8){var _0x2aa69a=typeof _0x40106a['offset']===_0x9670('0x20')&&typeof _0x40106a['limit']==='undefined';var _0x17e53a=_0x1199b8[_0x9670('0x21')];var _0x508028=_0x2aa69a?0x0:_0x40106a['offset'];var _0x296207=_0x2aa69a?_0x1199b8[_0x9670('0x21')]:_0x40106a['offset']+_0x40106a[_0x9670('0x22')];var _0x4d2bd8;if(_0x296207>=_0x17e53a){_0x296207=_0x17e53a;_0x4d2bd8=0xc8;}else{_0x4d2bd8=0xce;}_0x318403['status'](_0x4d2bd8);return _0x318403[_0x9670('0x23')](_0x9670('0x24'),_0x508028+'-'+_0x296207+'/'+_0x17e53a)[_0x9670('0x1f')](_0x1199b8);}return null;};}function patchUpdates(_0x231fb4){return function(_0x5c2635){try{jsonpatch[_0x9670('0x25')](_0x5c2635,_0x231fb4,!![]);}catch(_0x314f07){return BPromise['reject'](_0x314f07);}return _0x5c2635['save']();};}function saveUpdates(_0x4adb61,_0x1f630e){return function(_0x17927b){if(_0x17927b){return _0x17927b[_0x9670('0x26')](_0x4adb61)[_0x9670('0x27')](function(_0xda071b){return _0xda071b;});}return null;};}function removeEntity(_0x527555,_0x55e6e6){return function(_0x360aec){if(_0x360aec){return _0x360aec['destroy']()['then'](function(){var _0x24a95d=_0x360aec[_0x9670('0x28')]({'plain':!![]});var _0x177981=_0x9670('0x29');return db[_0x9670('0x2a')][_0x9670('0x2b')]({'where':{'type':_0x177981,'resourceId':_0x24a95d['id']}})[_0x9670('0x27')](function(){return _0x360aec;});})[_0x9670('0x27')](function(){_0x527555[_0x9670('0x1e')](0xcc)[_0x9670('0x1d')]();});}};}function handleEntityNotFound(_0x3f777f,_0xe36438){return function(_0x4fbbfb){if(!_0x4fbbfb){_0x3f777f['sendStatus'](0x194);}return _0x4fbbfb;};}function handleError(_0x207fc4,_0x5e4a91){_0x5e4a91=_0x5e4a91||0x1f4;return function(_0x16b810){logger['error'](_0x16b810[_0x9670('0x2c')]);if(_0x16b810[_0x9670('0x2d')]){delete _0x16b810['name'];}_0x207fc4[_0x9670('0x1e')](_0x5e4a91)['send'](_0x16b810);};}exports[_0x9670('0x2e')]=function(_0x399f2f,_0x15041e){var _0x33c102={},_0x163225={},_0x44652d={'count':0x0,'rows':[]};var _0x13460c=_['map'](db[_0x9670('0x2f')]['rawAttributes'],function(_0x52a754){return{'name':_0x52a754['fieldName'],'type':_0x52a754[_0x9670('0x30')][_0x9670('0x31')]};});_0x163225[_0x9670('0x32')]=_[_0x9670('0x33')](_0x13460c,_0x9670('0x2d'));_0x163225['query']=_[_0x9670('0x34')](_0x399f2f['query']);_0x163225[_0x9670('0x35')]=_['intersection'](_0x163225['model'],_0x163225[_0x9670('0x36')]);_0x33c102[_0x9670('0x37')]=_[_0x9670('0x38')](_0x163225['model'],qs[_0x9670('0x39')](_0x399f2f[_0x9670('0x36')][_0x9670('0x39')]));_0x33c102[_0x9670('0x37')]=_0x33c102[_0x9670('0x37')][_0x9670('0x3a')]?_0x33c102[_0x9670('0x37')]:_0x163225[_0x9670('0x32')];if(!_0x399f2f['query'][_0x9670('0x3b')](_0x9670('0x3c'))){_0x33c102[_0x9670('0x22')]=qs[_0x9670('0x22')](_0x399f2f[_0x9670('0x36')]['limit']);_0x33c102[_0x9670('0x3d')]=qs[_0x9670('0x3d')](_0x399f2f[_0x9670('0x36')]['offset']);}_0x33c102[_0x9670('0x3e')]=qs['sort'](_0x399f2f['query'][_0x9670('0x3f')]);_0x33c102['where']=qs[_0x9670('0x35')](_[_0x9670('0x40')](_0x399f2f[_0x9670('0x36')],_0x163225[_0x9670('0x35')]),_0x13460c);if(_0x399f2f[_0x9670('0x36')][_0x9670('0x41')]){_0x33c102[_0x9670('0x42')]=_[_0x9670('0x43')](_0x33c102[_0x9670('0x42')],{'$or':_['map'](_0x13460c,function(_0x148810){if(_0x148810[_0x9670('0x30')]!==_0x9670('0x44')){var _0x290a65={};_0x290a65[_0x148810[_0x9670('0x2d')]]={'$like':'%'+_0x399f2f[_0x9670('0x36')][_0x9670('0x41')]+'%'};return _0x290a65;}})});}_0x33c102=_[_0x9670('0x43')]({},_0x33c102,_0x399f2f[_0x9670('0x45')]);var _0xd20e45={'where':_0x33c102[_0x9670('0x42')]};return db[_0x9670('0x2f')]['count'](_0xd20e45)[_0x9670('0x27')](function(_0x17c076){_0x44652d[_0x9670('0x21')]=_0x17c076;if(_0x399f2f[_0x9670('0x36')]['includeAll']){_0x33c102[_0x9670('0x46')]=[{'all':!![]}];}return db[_0x9670('0x2f')][_0x9670('0x47')](_0x33c102);})[_0x9670('0x27')](function(_0x1bd410){_0x44652d[_0x9670('0x48')]=_0x1bd410;return _0x44652d;})[_0x9670('0x27')](respondWithFilteredResult(_0x15041e,_0x33c102))[_0x9670('0x49')](handleError(_0x15041e,null));};exports[_0x9670('0x4a')]=function(_0x531647,_0x42fe2e){var _0x1f7bc4={'raw':![],'where':{'id':_0x531647['params']['id']}},_0x20a747={};_0x20a747[_0x9670('0x32')]=_['keys'](db[_0x9670('0x2f')][_0x9670('0x4b')]);_0x20a747[_0x9670('0x36')]=_[_0x9670('0x34')](_0x531647[_0x9670('0x36')]);_0x20a747[_0x9670('0x35')]=_[_0x9670('0x38')](_0x20a747['model'],_0x20a747[_0x9670('0x36')]);_0x1f7bc4[_0x9670('0x37')]=_[_0x9670('0x38')](_0x20a747[_0x9670('0x32')],qs[_0x9670('0x39')](_0x531647[_0x9670('0x36')][_0x9670('0x39')]));_0x1f7bc4['attributes']=_0x1f7bc4[_0x9670('0x37')][_0x9670('0x3a')]?_0x1f7bc4[_0x9670('0x37')]:_0x20a747[_0x9670('0x32')];if(_0x531647['query']['includeAll']){_0x1f7bc4[_0x9670('0x46')]=[{'all':!![]}];}_0x1f7bc4=_[_0x9670('0x43')]({},_0x1f7bc4,_0x531647[_0x9670('0x45')]);return db[_0x9670('0x2f')][_0x9670('0x4c')](_0x1f7bc4)['then'](handleEntityNotFound(_0x42fe2e,null))[_0x9670('0x27')](respondWithResult(_0x42fe2e,null))['catch'](handleError(_0x42fe2e,null));};exports[_0x9670('0x4d')]=function(_0x354c0a,_0x15ab46){return db[_0x9670('0x2f')]['create'](_0x354c0a[_0x9670('0x4e')],{})['then'](function(_0x52c99a){var _0x541658=_0x354c0a[_0x9670('0x4f')][_0x9670('0x28')]({'plain':!![]});if(!_0x541658)throw new Error(_0x9670('0x50'));if(_0x541658[_0x9670('0x51')]==='user'){var _0x48012f=_0x52c99a[_0x9670('0x28')]({'plain':!![]});var _0x3eacb9=_0x9670('0x29');return db[_0x9670('0x52')][_0x9670('0x4c')]({'where':{'name':_0x3eacb9,'userProfileId':_0x541658[_0x9670('0x53')]},'raw':!![]})[_0x9670('0x27')](function(_0x3c0061){if(_0x3c0061&&_0x3c0061[_0x9670('0x54')]===0x0){return db[_0x9670('0x2a')]['create']({'name':_0x48012f[_0x9670('0x2d')],'resourceId':_0x48012f['id'],'type':_0x3c0061[_0x9670('0x2d')],'sectionId':_0x3c0061['id']},{})[_0x9670('0x27')](function(){return _0x52c99a;});}else{return _0x52c99a;}})['catch'](function(_0x30aeec){logger[_0x9670('0x55')](_0x9670('0x56'),_0x30aeec);throw _0x30aeec;});}return _0x52c99a;})[_0x9670('0x27')](respondWithResult(_0x15ab46,0xc9))[_0x9670('0x49')](handleError(_0x15ab46,null));};exports['update']=function(_0x119a91,_0x27369a){if(_0x119a91[_0x9670('0x4e')]['id']){delete _0x119a91[_0x9670('0x4e')]['id'];}return db[_0x9670('0x2f')][_0x9670('0x4c')]({'where':{'id':_0x119a91['params']['id']}})['then'](handleEntityNotFound(_0x27369a,null))['then'](saveUpdates(_0x119a91[_0x9670('0x4e')],null))[_0x9670('0x27')](respondWithResult(_0x27369a,null))[_0x9670('0x49')](handleError(_0x27369a,null));};exports[_0x9670('0x2b')]=function(_0x81cad7,_0x1f3b20){return db['CmList'][_0x9670('0x4c')]({'where':{'id':_0x81cad7[_0x9670('0x57')]['id']}})[_0x9670('0x27')](handleEntityNotFound(_0x1f3b20,null))[_0x9670('0x27')](removeEntity(_0x1f3b20,null))['catch'](handleError(_0x1f3b20,null));};exports['describe']=function(_0x3c48af,_0x167146){return db[_0x9670('0x2f')]['describe']()['then'](respondWithResult(_0x167146,null))[_0x9670('0x49')](handleError(_0x167146,null));};exports['addDisposition']=function(_0x16292d,_0x13702a,_0x2a574d){if(_0x16292d[_0x9670('0x4e')]['id']){delete _0x16292d['body']['id'];}return db[_0x9670('0x2f')][_0x9670('0x4c')]({'where':{'id':_0x16292d[_0x9670('0x57')]['id']}})[_0x9670('0x27')](handleEntityNotFound(_0x13702a,null))[_0x9670('0x27')](function(_0x2be47e){if(_0x2be47e){_0x16292d['body'][_0x9670('0x58')]=_0x2be47e['id'];return db['Disposition']['create'](_0x16292d[_0x9670('0x4e')]);}})[_0x9670('0x27')](respondWithResult(_0x13702a,null))[_0x9670('0x49')](handleError(_0x13702a,null));};exports[_0x9670('0x59')]=function(_0x176bb3,_0x4a649e,_0x2379b4){var _0x269446={'raw':![],'where':{}};var _0x2edecb={};var _0x219e82={'count':0x0,'rows':[]};return db[_0x9670('0x2f')][_0x9670('0x5a')]({'where':{'id':_0x176bb3['params']['id']}})[_0x9670('0x27')](handleEntityNotFound(_0x4a649e,null))[_0x9670('0x27')](function(_0x2f0181){if(_0x2f0181){_0x2edecb['model']=_[_0x9670('0x34')](db['Disposition']['rawAttributes']);_0x2edecb[_0x9670('0x36')]=_[_0x9670('0x34')](_0x176bb3[_0x9670('0x36')]);_0x2edecb[_0x9670('0x35')]=_[_0x9670('0x38')](_0x2edecb[_0x9670('0x32')],_0x2edecb['query']);_0x269446['attributes']=_[_0x9670('0x38')](_0x2edecb[_0x9670('0x32')],qs[_0x9670('0x39')](_0x176bb3[_0x9670('0x36')][_0x9670('0x39')]));_0x269446['attributes']=_0x269446[_0x9670('0x37')]['length']?_0x269446[_0x9670('0x37')]:_0x2edecb[_0x9670('0x32')];if(!_0x176bb3[_0x9670('0x36')]['hasOwnProperty'](_0x9670('0x3c'))){_0x269446[_0x9670('0x22')]=qs[_0x9670('0x22')](_0x176bb3[_0x9670('0x36')][_0x9670('0x22')]);_0x269446['offset']=qs[_0x9670('0x3d')](_0x176bb3[_0x9670('0x36')][_0x9670('0x3d')]);}_0x269446['order']=qs[_0x9670('0x3f')](_0x176bb3[_0x9670('0x36')]['sort']);_0x269446[_0x9670('0x42')]=qs[_0x9670('0x35')](_[_0x9670('0x40')](_0x176bb3['query'],_0x2edecb['filters']));_0x269446[_0x9670('0x42')][_0x9670('0x58')]=_0x2f0181['id'];if(_0x176bb3['query'][_0x9670('0x41')]){_0x269446[_0x9670('0x42')]=_[_0x9670('0x43')](_0x269446[_0x9670('0x42')],{'$or':_[_0x9670('0x33')](_0x269446[_0x9670('0x37')],function(_0x3827f3){var _0x4b5e48={};_0x4b5e48[_0x3827f3]={'$like':'%'+_0x176bb3[_0x9670('0x36')][_0x9670('0x41')]+'%'};return _0x4b5e48;})});}_0x269446=_[_0x9670('0x43')]({},_0x269446,_0x176bb3[_0x9670('0x45')]);return db[_0x9670('0x5b')]['count']({'where':_0x269446[_0x9670('0x42')]})['then'](function(_0x4b7a19){_0x219e82['count']=_0x4b7a19;if(_0x176bb3[_0x9670('0x36')][_0x9670('0x5c')]){_0x269446[_0x9670('0x46')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x269446);})[_0x9670('0x27')](function(_0x5d3623){_0x219e82[_0x9670('0x48')]=_0x5d3623;return _0x219e82;});}})[_0x9670('0x27')](respondWithFilteredResult(_0x4a649e,_0x269446))[_0x9670('0x49')](handleError(_0x4a649e,null));};exports[_0x9670('0x5d')]=function(_0x4db48c,_0x3cbc16,_0x10a1e3){return db[_0x9670('0x2f')][_0x9670('0x4c')]({'where':{'id':_0x4db48c['params']['id']}})[_0x9670('0x27')](handleEntityNotFound(_0x3cbc16,null))[_0x9670('0x27')](function(_0x2260c9){if(_0x2260c9){return _0x2260c9[_0x9670('0x5d')](_0x4db48c[_0x9670('0x36')][_0x9670('0x5e')]);}})[_0x9670('0x27')](respondWithStatusCode(_0x3cbc16,null))[_0x9670('0x49')](handleError(_0x3cbc16,null));};exports[_0x9670('0x5f')]=function(_0x84a6a9,_0xee9312,_0x29d2ab){return db[_0x9670('0x2f')][_0x9670('0x4c')]({'where':{'id':_0x84a6a9['params']['id']}})[_0x9670('0x27')](handleEntityNotFound(_0xee9312,null))[_0x9670('0x27')](function(_0x5be672){if(_0x5be672){var _0x27efa8=[];var _0x418a2d={'success':[],'errors':[]};return db['CmContact'][_0x9670('0x60')]()[_0x9670('0x27')](function(_0x5e1a95){if(_0x84a6a9[_0x9670('0x4e')][_0x9670('0x61')]&&_['isArray'](_0x84a6a9[_0x9670('0x4e')][_0x9670('0x61')])){if(_0x84a6a9[_0x9670('0x4e')][_0x9670('0x61')][_0x9670('0x3a')]){_0x84a6a9['body'][_0x9670('0x61')]=_0x84a6a9['body'][_0x9670('0x61')][_0x9670('0x62')](';')+';';}else{_0x84a6a9['body'][_0x9670('0x61')]=null;}}else{_0x84a6a9[_0x9670('0x4e')][_0x9670('0x61')]=null;}if(_0x84a6a9['body']&&_[_0x9670('0x63')](_0x84a6a9[_0x9670('0x4e')])){for(var _0x18624a=0x0;_0x18624a<_0x84a6a9[_0x9670('0x4e')]['length'];_0x18624a+=0x1){_0x84a6a9[_0x9670('0x4e')][_0x18624a]['ListId']=_0x84a6a9['params']['id'];_0x27efa8[_0x9670('0x64')](_0x84a6a9[_0x9670('0x4e')][_0x18624a]);}return BPromise[_0x9670('0x65')](_0x27efa8,function(_0x50cd22){return db[_0x9670('0x66')]['create'](_['omit'](_0x50cd22,[_0x9670('0x5e'),'id'])||{},{'fields':_[_0x9670('0x34')](_0x5e1a95),'raw':!![]})[_0x9670('0x27')](function(_0x32a3ec){_0x418a2d['success']['push'](_0x32a3ec[_0x9670('0x67')]);})[_0x9670('0x49')](function(_0x114ab9){_0x418a2d[_0x9670('0x68')][_0x9670('0x64')]({'data':_0x50cd22,'error':_0x114ab9['message']});});})[_0x9670('0x27')](function(_0x5a3741){return _0x418a2d;})[_0x9670('0x49')](function(_0x3a21e5){return _0x3a21e5;});}else{_0xee9312[_0x9670('0x1e')](0x190)['json']({'message':'Malformed\x20request\x20syntax'});}});}})[_0x9670('0x27')](respondWithResult(_0xee9312,null))[_0x9670('0x49')](handleError(_0xee9312,null));};exports['getContacts']=function(_0x4ffa27,_0x253f70,_0xfb1171){var _0x3079f9;return db['CmList'][_0x9670('0x4c')]({'where':{'id':_0x4ffa27[_0x9670('0x57')]['id']},'include':[{'model':db[_0x9670('0x69')],'as':_0x9670('0x6a')}]})['then'](handleEntityNotFound(_0x253f70,null))['then'](function(_0x31857a){if(_0x31857a){_0x3079f9=_0x31857a;return db['CmContact'][_0x9670('0x4b')];}})[_0x9670('0x27')](function(_0x2ed5d4){if(_0x2ed5d4){var _0x2fde68={};var _0x4314c6={};_0x4314c6[_0x9670('0x32')]=_[_0x9670('0x6b')](_[_0x9670('0x34')](_0x2ed5d4),_['map'](_0x3079f9[_0x9670('0x6a')],function(_0x966899){return util[_0x9670('0x6c')]('cf_%d',_0x966899['id']);}));_0x4314c6['query']=_[_0x9670('0x34')](_0x4ffa27[_0x9670('0x36')]);_0x4314c6[_0x9670('0x35')]=_['intersection'](_0x4314c6[_0x9670('0x32')],_0x4314c6['query']);_0x2fde68['attributes']=_[_0x9670('0x38')](_0x4314c6[_0x9670('0x32')],qs['fields'](_0x4ffa27[_0x9670('0x36')][_0x9670('0x39')]));_0x2fde68[_0x9670('0x37')]=_0x2fde68['attributes'][_0x9670('0x3a')]?_0x2fde68[_0x9670('0x37')]:_0x4314c6['model'];if(!_0x4ffa27[_0x9670('0x36')][_0x9670('0x3b')](_0x9670('0x3c'))){_0x2fde68[_0x9670('0x22')]=qs[_0x9670('0x22')](_0x4ffa27['query']['limit']);_0x2fde68[_0x9670('0x3d')]=qs['offset'](_0x4ffa27[_0x9670('0x36')][_0x9670('0x3d')]);}_0x2fde68['order']=qs['sort'](_0x4ffa27[_0x9670('0x36')][_0x9670('0x3f')]);_0x2fde68[_0x9670('0x42')]=qs[_0x9670('0x35')](_[_0x9670('0x40')](_0x4ffa27[_0x9670('0x36')],_0x4314c6[_0x9670('0x35')]));_0x2fde68[_0x9670('0x6d')]=!![];if(_0x4ffa27[_0x9670('0x36')][_0x9670('0x41')]){_0x2fde68['where']=_[_0x9670('0x43')](_0x2fde68[_0x9670('0x42')],{'$or':_[_0x9670('0x33')](_0x2fde68[_0x9670('0x37')],function(_0x28d5fc){var _0x336149={};_0x336149[_0x28d5fc]={'$like':'%'+_0x4ffa27[_0x9670('0x36')][_0x9670('0x41')]+'%'};return _0x336149;})});}_0x2fde68=_[_0x9670('0x43')]({},_0x2fde68,_0x4ffa27[_0x9670('0x45')]);return _0x3079f9['getContacts'](_0x2fde68);}})[_0x9670('0x27')](respondWithResult(_0x253f70,null))[_0x9670('0x49')](handleError(_0x253f70,null));};exports[_0x9670('0x6e')]=function(_0x52717c,_0x3f0c13,_0x5bb4f1){var _0x4a0779;return db[_0x9670('0x2f')][_0x9670('0x4c')]({'where':{'id':_0x52717c[_0x9670('0x57')]['id']},'include':[{'model':db[_0x9670('0x69')],'as':_0x9670('0x6a')}]})['then'](handleEntityNotFound(_0x3f0c13,null))[_0x9670('0x27')](function(_0x35c0f8){if(_0x35c0f8){_0x4a0779=_0x35c0f8;return db[_0x9670('0x66')][_0x9670('0x4b')];}})[_0x9670('0x27')](function(_0x4add3d){if(_0x4add3d){var _0x405951={};var _0x101c83={};_0x101c83[_0x9670('0x32')]=_[_0x9670('0x6b')](_['keys'](_0x4add3d),_[_0x9670('0x33')](_0x4a0779['CustomFields'],function(_0x4e058c){return util[_0x9670('0x6c')]('cf_%d',_0x4e058c['id']);}));_0x101c83[_0x9670('0x36')]=_[_0x9670('0x34')](_0x52717c[_0x9670('0x36')]);_0x101c83[_0x9670('0x35')]=_[_0x9670('0x38')](_0x101c83[_0x9670('0x32')],_0x101c83[_0x9670('0x36')]);_0x405951[_0x9670('0x37')]=_['intersection'](_0x101c83[_0x9670('0x32')],qs[_0x9670('0x39')](_0x52717c[_0x9670('0x36')]['fields']));_0x405951[_0x9670('0x37')]=_0x405951[_0x9670('0x37')]['length']?_0x405951[_0x9670('0x37')]:_0x101c83[_0x9670('0x32')];if(!_0x52717c[_0x9670('0x36')][_0x9670('0x3b')](_0x9670('0x3c'))){_0x405951[_0x9670('0x22')]=qs[_0x9670('0x22')](_0x52717c[_0x9670('0x36')][_0x9670('0x22')]);_0x405951[_0x9670('0x3d')]=qs[_0x9670('0x3d')](_0x52717c[_0x9670('0x36')]['offset']);}_0x405951[_0x9670('0x3e')]=qs[_0x9670('0x3f')](_0x52717c[_0x9670('0x36')][_0x9670('0x3f')]);_0x405951[_0x9670('0x42')]=qs[_0x9670('0x35')](_['pick'](_0x52717c[_0x9670('0x36')],_0x101c83[_0x9670('0x35')]));_0x405951[_0x9670('0x6d')]=!![];if(_0x52717c[_0x9670('0x36')]['filter']){_0x405951['where']=_[_0x9670('0x43')](_0x405951['where'],{'$or':_['map'](_0x405951[_0x9670('0x37')],function(_0x41d513){var _0xb75948={};_0xb75948[_0x41d513]={'$like':'%'+_0x52717c[_0x9670('0x36')][_0x9670('0x41')]+'%'};return _0xb75948;})});}_0x405951=_[_0x9670('0x43')]({},_0x405951,_0x52717c['options']);return _0x4a0779[_0x9670('0x6f')](_0x405951);}})[_0x9670('0x27')](function(_0x4feca6){if(!_[_0x9670('0x70')](_0x4feca6)){var _0x1113ea=toCsv(_0x4feca6);var _0x4aba6d=Date[_0x9670('0x71')]();fs[_0x9670('0x72')](util[_0x9670('0x6c')](_0x9670('0x73'),_0x4a0779['id'],_0x4aba6d),_0x1113ea);_0x3f0c13[_0x9670('0x74')](_0x9670('0x75'),_0x9670('0x76')+util[_0x9670('0x6c')](_0x9670('0x77'),_0x4a0779['id'],_0x4aba6d));_0x3f0c13['setHeader'](_0x9670('0x78'),'text/csv');return _0x3f0c13[_0x9670('0x79')](util[_0x9670('0x6c')](_0x9670('0x73'),_0x4a0779['id'],_0x4aba6d));}else{return _0x3f0c13[_0x9670('0x7a')](0xcc);}})['catch'](handleError(_0x3f0c13,null));};exports[_0x9670('0x7b')]=function(_0x3cbb04,_0x322bf0,_0x6ece0f){var _0x48c137;delete _0x3cbb04['body']['id'];return db['CmList'][_0x9670('0x5a')]({'where':{'id':_0x3cbb04[_0x9670('0x57')]['id']}})[_0x9670('0x27')](handleEntityNotFound(_0x322bf0,null))[_0x9670('0x27')](function(_0x2f0671){if(_0x2f0671){return db[_0x9670('0x7c')][_0x9670('0x7d')](function(_0x46ae17){return db['CmCustomField']['create'](_0x3cbb04['body'],{'transaction':_0x46ae17})[_0x9670('0x27')](function(_0x1e7f2f){_0x48c137=_0x1e7f2f;return _0x2f0671[_0x9670('0x7e')](_0x1e7f2f,{'transaction':_0x46ae17});})[_0x9670('0x27')](function(){var _0x479916={'type':db[_0x9670('0x7f')][_0x9670('0x80')],'transaction':_0x46ae17};switch(_0x3cbb04['body'][_0x9670('0x30')]){case _0x9670('0x81'):_0x479916['type']=db[_0x9670('0x7f')][_0x9670('0x80')];break;case _0x9670('0x82'):_0x479916[_0x9670('0x30')]=db[_0x9670('0x7f')][_0x9670('0x83')];break;case'switch':_0x479916[_0x9670('0x30')]=db[_0x9670('0x7f')]['BOOLEAN'];_0x479916[_0x9670('0x84')]=![];break;default:}return db['sequelize'][_0x9670('0x85')][_0x9670('0x86')]('cm_contacts',util[_0x9670('0x6c')](_0x9670('0x87'),_0x48c137['id']),_0x479916);})[_0x9670('0x27')](function(){return _0x48c137;});});}})[_0x9670('0x27')](respondWithResult(_0x322bf0,null))[_0x9670('0x49')](handleError(_0x322bf0,null));};exports[_0x9670('0x88')]=function(_0x30359a,_0x10ed98,_0x55be68){var _0x4f40d8={};var _0x542201={};var _0x30117b;var _0x1a228d;return db['CmList'][_0x9670('0x5a')]({'where':{'id':_0x30359a[_0x9670('0x57')]['id']}})['then'](handleEntityNotFound(_0x10ed98,null))[_0x9670('0x27')](function(_0x21144f){if(_0x21144f){_0x30117b=_0x21144f;_0x542201[_0x9670('0x32')]=_[_0x9670('0x34')](db[_0x9670('0x69')][_0x9670('0x4b')]);_0x542201[_0x9670('0x36')]=_[_0x9670('0x34')](_0x30359a[_0x9670('0x36')]);_0x542201[_0x9670('0x35')]=_[_0x9670('0x38')](_0x542201[_0x9670('0x32')],_0x542201[_0x9670('0x36')]);_0x4f40d8[_0x9670('0x37')]=_[_0x9670('0x38')](_0x542201[_0x9670('0x32')],qs[_0x9670('0x39')](_0x30359a[_0x9670('0x36')][_0x9670('0x39')]));_0x4f40d8[_0x9670('0x37')]=_0x4f40d8[_0x9670('0x37')][_0x9670('0x3a')]?_0x4f40d8[_0x9670('0x37')]:_0x542201['model'];_0x4f40d8[_0x9670('0x3e')]=qs[_0x9670('0x3f')](_0x30359a[_0x9670('0x36')][_0x9670('0x3f')]);_0x4f40d8[_0x9670('0x42')]=qs[_0x9670('0x35')](_['pick'](_0x30359a[_0x9670('0x36')],_0x542201[_0x9670('0x35')]));_0x4f40d8[_0x9670('0x42')]=_['merge'](_0x4f40d8['where'],{'$or':[{'ListId':_0x21144f['id']},{'ListId':null}]});if(_0x30359a['query']['filter']){_0x4f40d8[_0x9670('0x42')]=_[_0x9670('0x43')](_0x4f40d8[_0x9670('0x42')],{'$or':_['map'](_0x4f40d8['attributes'],function(_0x14a434){var _0x2cd0e8={};_0x2cd0e8[_0x14a434]={'$like':'%'+_0x30359a[_0x9670('0x36')][_0x9670('0x41')]+'%'};return _0x2cd0e8;})});}_0x4f40d8=_[_0x9670('0x43')]({},_0x4f40d8,_0x30359a[_0x9670('0x45')]);return db[_0x9670('0x69')]['findAndCountAll'](_0x4f40d8);}})[_0x9670('0x27')](respondWithResult(_0x10ed98,null))[_0x9670('0x49')](handleError(_0x10ed98,null));};exports[_0x9670('0x89')]=function(_0x136456,_0x4b9678,_0x15f315){return db[_0x9670('0x2f')][_0x9670('0x4c')]({'where':{'id':_0x136456['params']['id']}})[_0x9670('0x27')](handleEntityNotFound(_0x4b9678,null))['then'](function(_0x1038da){if(_0x1038da){return _0x1038da[_0x9670('0x89')](_0x136456[_0x9670('0x4e')]['ids'],_[_0x9670('0x8a')](_0x136456[_0x9670('0x4e')],[_0x9670('0x5e'),'id'])||{})[_0x9670('0x8b')](function(_0x1908e9){for(var _0xe8abcd=0x0;_0xe8abcd<_0x136456[_0x9670('0x4e')][_0x9670('0x5e')]['length'];_0xe8abcd+=0x1){socket[_0x9670('0x8c')](_0x9670('0x8d'),{'UserId':Number(_0x136456[_0x9670('0x4e')][_0x9670('0x5e')][_0xe8abcd]),'CmListId':Number(_0x136456[_0x9670('0x57')]['id'])});}return _0x1908e9;});}})['then'](respondWithResult(_0x4b9678,null))[_0x9670('0x49')](handleError(_0x4b9678,null));};exports[_0x9670('0x8e')]=function(_0x58ed71,_0x5a665b,_0x20bdf7){return db[_0x9670('0x2f')][_0x9670('0x4c')]({'where':{'id':_0x58ed71['params']['id']}})[_0x9670('0x27')](handleEntityNotFound(_0x5a665b,null))['then'](function(_0x4a7f13){if(_0x4a7f13){return _0x4a7f13[_0x9670('0x8e')](_0x58ed71[_0x9670('0x36')][_0x9670('0x5e')])['then'](function(){if(_['isArray'](_0x58ed71[_0x9670('0x36')][_0x9670('0x5e')])){for(var _0x1c1dc8=0x0;_0x1c1dc8<_0x58ed71[_0x9670('0x36')]['ids']['length'];_0x1c1dc8+=0x1){socket[_0x9670('0x8c')](_0x9670('0x8f'),{'UserId':Number(_0x58ed71[_0x9670('0x36')][_0x9670('0x5e')][_0x1c1dc8]),'CmListId':Number(_0x58ed71[_0x9670('0x57')]['id'])});}}else{socket[_0x9670('0x8c')](_0x9670('0x8f'),{'UserId':Number(_0x58ed71['query']['ids']),'CmListId':Number(_0x58ed71[_0x9670('0x57')]['id'])});}});}})['then'](respondWithStatusCode(_0x5a665b,null))[_0x9670('0x49')](handleError(_0x5a665b,null));};exports[_0x9670('0x90')]=function(_0x3f58d0,_0x3a844d,_0x4f302a){var _0x13096c={};var _0x2ba64f={};var _0xb014fb;var _0x452653;return db['CmList'][_0x9670('0x5a')]({'where':{'id':_0x3f58d0[_0x9670('0x57')]['id']}})[_0x9670('0x27')](handleEntityNotFound(_0x3a844d,null))[_0x9670('0x27')](function(_0x4a1c3d){if(_0x4a1c3d){_0xb014fb=_0x4a1c3d;_0x2ba64f['model']=_['keys'](db['User']['rawAttributes']);_0x2ba64f[_0x9670('0x36')]=_[_0x9670('0x34')](_0x3f58d0[_0x9670('0x36')]);_0x2ba64f['filters']=_['intersection'](_0x2ba64f['model'],_0x2ba64f['query']);_0x13096c[_0x9670('0x37')]=_[_0x9670('0x38')](_0x2ba64f[_0x9670('0x32')],qs[_0x9670('0x39')](_0x3f58d0[_0x9670('0x36')][_0x9670('0x39')]));_0x13096c[_0x9670('0x37')]=_0x13096c[_0x9670('0x37')][_0x9670('0x3a')]?_0x13096c[_0x9670('0x37')]:_0x2ba64f[_0x9670('0x32')];_0x13096c[_0x9670('0x3e')]=qs[_0x9670('0x3f')](_0x3f58d0['query']['sort']);_0x13096c[_0x9670('0x42')]=qs[_0x9670('0x35')](_[_0x9670('0x40')](_0x3f58d0[_0x9670('0x36')],_0x2ba64f[_0x9670('0x35')]));if(_0x3f58d0[_0x9670('0x36')][_0x9670('0x41')]){_0x13096c['where']=_['merge'](_0x13096c[_0x9670('0x42')],{'$or':_[_0x9670('0x33')](_0x13096c[_0x9670('0x37')],function(_0x42f381){var _0x23abd2={};_0x23abd2[_0x42f381]={'$like':'%'+_0x3f58d0['query'][_0x9670('0x41')]+'%'};return _0x23abd2;})});}_0x13096c=_[_0x9670('0x43')]({},_0x13096c,_0x3f58d0['options']);return _0xb014fb[_0x9670('0x90')](_0x13096c);}})[_0x9670('0x27')](function(_0x57ee33){if(_0x57ee33){_0x452653=_0x57ee33[_0x9670('0x3a')];if(!_0x3f58d0[_0x9670('0x36')][_0x9670('0x3b')](_0x9670('0x3c'))){_0x13096c['limit']=qs[_0x9670('0x22')](_0x3f58d0[_0x9670('0x36')][_0x9670('0x22')]);_0x13096c[_0x9670('0x3d')]=qs[_0x9670('0x3d')](_0x3f58d0[_0x9670('0x36')]['offset']);}return _0xb014fb[_0x9670('0x90')](_0x13096c);}})[_0x9670('0x27')](function(_0x520ff5){if(_0x520ff5){return _0x520ff5?{'count':_0x452653,'rows':_0x520ff5}:null;}})[_0x9670('0x27')](respondWithResult(_0x3a844d,null))[_0x9670('0x49')](handleError(_0x3a844d,null));}; \ No newline at end of file +var _0x4f09=['dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','raw','format','cf_%d','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','list_%d_%s.csv','Content-type','download','sequelize','transaction','TEXT','text','type','Sequelize','INTEGER','switch','BOOLEAN','queryInterface','cm_contacts','getCustomFields','findAndCountAll','addAgents','omit','spread','userCmList:save','removeAgents','isArray','userCmList:remove','User','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','reject','save','update','then','destroy','Lists','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','describe','addDisposition','ListId','Disposition','getDispositions','findOne','removeDispositions','ids','CmContact','tags','push','each','success'];(function(_0x307d7b,_0x6212aa){var _0x45a278=function(_0x4e79ce){while(--_0x4e79ce){_0x307d7b['push'](_0x307d7b['shift']());}};_0x45a278(++_0x6212aa);}(_0x4f09,0xbe));var _0x94f0=function(_0x266c43,_0x12bc29){_0x266c43=_0x266c43-0x0;var _0x360a3d=_0x4f09[_0x266c43];return _0x360a3d;};'use strict';var emlformat=require(_0x94f0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x94f0('0x1'));var jsonpatch=require(_0x94f0('0x2'));var rp=require(_0x94f0('0x3'));var moment=require(_0x94f0('0x4'));var BPromise=require(_0x94f0('0x5'));var Mustache=require(_0x94f0('0x6'));var util=require(_0x94f0('0x7'));var path=require(_0x94f0('0x8'));var sox=require(_0x94f0('0x9'));var csv=require(_0x94f0('0xa'));var ejs=require(_0x94f0('0xb'));var fs=require('fs');var fs_extra=require(_0x94f0('0xc'));var _=require(_0x94f0('0xd'));var squel=require('squel');var crypto=require(_0x94f0('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x94f0('0xf'));var toCsv=require(_0x94f0('0xa'));var querystring=require(_0x94f0('0x10'));var Papa=require('papaparse');var Redis=require(_0x94f0('0x11'));var authService=require(_0x94f0('0x12'));var qs=require(_0x94f0('0x13'));var as=require(_0x94f0('0x14'));var hardwareService=require(_0x94f0('0x15'));var logger=require(_0x94f0('0x16'))(_0x94f0('0x17'));var utils=require(_0x94f0('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x94f0('0x19'));var db=require(_0x94f0('0x1a'))['db'];config[_0x94f0('0x1b')]=_[_0x94f0('0x1c')](config[_0x94f0('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x94f0('0x1d'))(new Redis(config[_0x94f0('0x1b')]));require(_0x94f0('0x1e'))[_0x94f0('0x1f')](socket);function respondWithStatusCode(_0x4936c6,_0x23e546){_0x23e546=_0x23e546||0xcc;return function(_0x249fb9){if(_0x249fb9){return _0x4936c6[_0x94f0('0x20')](_0x23e546);}return _0x4936c6[_0x94f0('0x21')](_0x23e546)[_0x94f0('0x22')]();};}function respondWithResult(_0x489ca2,_0x12e74c){_0x12e74c=_0x12e74c||0xc8;return function(_0x50aae1){if(_0x50aae1){return _0x489ca2[_0x94f0('0x21')](_0x12e74c)['json'](_0x50aae1);}};}function respondWithFilteredResult(_0x37cc47,_0x54372f){return function(_0x51b146){if(_0x51b146){var _0x4042df=typeof _0x54372f[_0x94f0('0x23')]==='undefined'&&typeof _0x54372f[_0x94f0('0x24')]===_0x94f0('0x25');var _0x5c49e6=_0x51b146['count'];var _0x182a2c=_0x4042df?0x0:_0x54372f[_0x94f0('0x23')];var _0x45ad63=_0x4042df?_0x51b146[_0x94f0('0x26')]:_0x54372f[_0x94f0('0x23')]+_0x54372f[_0x94f0('0x24')];var _0x444576;if(_0x45ad63>=_0x5c49e6){_0x45ad63=_0x5c49e6;_0x444576=0xc8;}else{_0x444576=0xce;}_0x37cc47[_0x94f0('0x21')](_0x444576);return _0x37cc47['set'](_0x94f0('0x27'),_0x182a2c+'-'+_0x45ad63+'/'+_0x5c49e6)[_0x94f0('0x28')](_0x51b146);}return null;};}function patchUpdates(_0x5c7a52){return function(_0x5845f4){try{jsonpatch['apply'](_0x5845f4,_0x5c7a52,!![]);}catch(_0xfa2abe){return BPromise[_0x94f0('0x29')](_0xfa2abe);}return _0x5845f4[_0x94f0('0x2a')]();};}function saveUpdates(_0x44e254,_0x40d1ab){return function(_0x562242){if(_0x562242){return _0x562242[_0x94f0('0x2b')](_0x44e254)[_0x94f0('0x2c')](function(_0x1650c5){return _0x1650c5;});}return null;};}function removeEntity(_0x57aad2,_0x381d07){return function(_0xaaf158){if(_0xaaf158){return _0xaaf158[_0x94f0('0x2d')]()[_0x94f0('0x2c')](function(){var _0xeeb574=_0xaaf158['get']({'plain':!![]});var _0x4cf24b=_0x94f0('0x2e');return db['UserProfileResource']['destroy']({'where':{'type':_0x4cf24b,'resourceId':_0xeeb574['id']}})['then'](function(){return _0xaaf158;});})[_0x94f0('0x2c')](function(){_0x57aad2[_0x94f0('0x21')](0xcc)[_0x94f0('0x22')]();});}};}function handleEntityNotFound(_0xc16d6a,_0x475a69){return function(_0x37577e){if(!_0x37577e){_0xc16d6a[_0x94f0('0x20')](0x194);}return _0x37577e;};}function handleError(_0x4145ef,_0x1067ee){_0x1067ee=_0x1067ee||0x1f4;return function(_0x37e162){logger[_0x94f0('0x2f')](_0x37e162[_0x94f0('0x30')]);if(_0x37e162[_0x94f0('0x31')]){delete _0x37e162[_0x94f0('0x31')];}_0x4145ef['status'](_0x1067ee)[_0x94f0('0x32')](_0x37e162);};}exports[_0x94f0('0x33')]=function(_0x327448,_0x1a65b1){var _0x21b29f={},_0x221b5c={},_0xdfe1d0={'count':0x0,'rows':[]};var _0x362a97=_[_0x94f0('0x34')](db[_0x94f0('0x35')][_0x94f0('0x36')],function(_0x47695){return{'name':_0x47695[_0x94f0('0x37')],'type':_0x47695['type'][_0x94f0('0x38')]};});_0x221b5c[_0x94f0('0x39')]=_[_0x94f0('0x34')](_0x362a97,_0x94f0('0x31'));_0x221b5c[_0x94f0('0x3a')]=_['keys'](_0x327448[_0x94f0('0x3a')]);_0x221b5c['filters']=_[_0x94f0('0x3b')](_0x221b5c['model'],_0x221b5c[_0x94f0('0x3a')]);_0x21b29f[_0x94f0('0x3c')]=_[_0x94f0('0x3b')](_0x221b5c[_0x94f0('0x39')],qs[_0x94f0('0x3d')](_0x327448['query'][_0x94f0('0x3d')]));_0x21b29f[_0x94f0('0x3c')]=_0x21b29f[_0x94f0('0x3c')][_0x94f0('0x3e')]?_0x21b29f['attributes']:_0x221b5c[_0x94f0('0x39')];if(!_0x327448[_0x94f0('0x3a')][_0x94f0('0x3f')](_0x94f0('0x40'))){_0x21b29f[_0x94f0('0x24')]=qs[_0x94f0('0x24')](_0x327448[_0x94f0('0x3a')][_0x94f0('0x24')]);_0x21b29f['offset']=qs['offset'](_0x327448[_0x94f0('0x3a')][_0x94f0('0x23')]);}_0x21b29f[_0x94f0('0x41')]=qs['sort'](_0x327448[_0x94f0('0x3a')][_0x94f0('0x42')]);_0x21b29f['where']=qs[_0x94f0('0x43')](_[_0x94f0('0x44')](_0x327448[_0x94f0('0x3a')],_0x221b5c[_0x94f0('0x43')]),_0x362a97);if(_0x327448[_0x94f0('0x3a')][_0x94f0('0x45')]){_0x21b29f[_0x94f0('0x46')]=_[_0x94f0('0x47')](_0x21b29f['where'],{'$or':_[_0x94f0('0x34')](_0x362a97,function(_0x5197d2){if(_0x5197d2['type']!==_0x94f0('0x48')){var _0x579786={};_0x579786[_0x5197d2[_0x94f0('0x31')]]={'$like':'%'+_0x327448['query'][_0x94f0('0x45')]+'%'};return _0x579786;}})});}_0x21b29f=_[_0x94f0('0x47')]({},_0x21b29f,_0x327448[_0x94f0('0x49')]);var _0x42e4b1={'where':_0x21b29f['where']};return db[_0x94f0('0x35')]['count'](_0x42e4b1)['then'](function(_0x58489e){_0xdfe1d0[_0x94f0('0x26')]=_0x58489e;if(_0x327448['query'][_0x94f0('0x4a')]){_0x21b29f[_0x94f0('0x4b')]=[{'all':!![]}];}return db[_0x94f0('0x35')][_0x94f0('0x4c')](_0x21b29f);})[_0x94f0('0x2c')](function(_0x2367eb){_0xdfe1d0[_0x94f0('0x4d')]=_0x2367eb;return _0xdfe1d0;})[_0x94f0('0x2c')](respondWithFilteredResult(_0x1a65b1,_0x21b29f))[_0x94f0('0x4e')](handleError(_0x1a65b1,null));};exports[_0x94f0('0x4f')]=function(_0x3fc445,_0x237b98){var _0x4ddee2={'raw':![],'where':{'id':_0x3fc445[_0x94f0('0x50')]['id']}},_0x5e0586={};_0x5e0586[_0x94f0('0x39')]=_[_0x94f0('0x51')](db['CmList'][_0x94f0('0x36')]);_0x5e0586[_0x94f0('0x3a')]=_[_0x94f0('0x51')](_0x3fc445[_0x94f0('0x3a')]);_0x5e0586[_0x94f0('0x43')]=_['intersection'](_0x5e0586[_0x94f0('0x39')],_0x5e0586[_0x94f0('0x3a')]);_0x4ddee2['attributes']=_[_0x94f0('0x3b')](_0x5e0586[_0x94f0('0x39')],qs['fields'](_0x3fc445[_0x94f0('0x3a')][_0x94f0('0x3d')]));_0x4ddee2['attributes']=_0x4ddee2[_0x94f0('0x3c')][_0x94f0('0x3e')]?_0x4ddee2['attributes']:_0x5e0586[_0x94f0('0x39')];if(_0x3fc445[_0x94f0('0x3a')]['includeAll']){_0x4ddee2['include']=[{'all':!![]}];}_0x4ddee2=_[_0x94f0('0x47')]({},_0x4ddee2,_0x3fc445[_0x94f0('0x49')]);return db['CmList'][_0x94f0('0x52')](_0x4ddee2)['then'](handleEntityNotFound(_0x237b98,null))[_0x94f0('0x2c')](respondWithResult(_0x237b98,null))[_0x94f0('0x4e')](handleError(_0x237b98,null));};exports[_0x94f0('0x53')]=function(_0x4758b1,_0x147bac){return db[_0x94f0('0x35')][_0x94f0('0x53')](_0x4758b1[_0x94f0('0x54')],{})[_0x94f0('0x2c')](function(_0x4bfe22){var _0x359076=_0x4758b1[_0x94f0('0x55')][_0x94f0('0x56')]({'plain':!![]});if(!_0x359076)throw new Error(_0x94f0('0x57'));if(_0x359076[_0x94f0('0x58')]===_0x94f0('0x55')){var _0x603827=_0x4bfe22[_0x94f0('0x56')]({'plain':!![]});var _0x224d7c='Lists';return db[_0x94f0('0x59')]['find']({'where':{'name':_0x224d7c,'userProfileId':_0x359076[_0x94f0('0x5a')]},'raw':!![]})[_0x94f0('0x2c')](function(_0x39f441){if(_0x39f441&&_0x39f441[_0x94f0('0x5b')]===0x0){return db[_0x94f0('0x5c')]['create']({'name':_0x603827[_0x94f0('0x31')],'resourceId':_0x603827['id'],'type':_0x39f441['name'],'sectionId':_0x39f441['id']},{})[_0x94f0('0x2c')](function(){return _0x4bfe22;});}else{return _0x4bfe22;}})[_0x94f0('0x4e')](function(_0x141b18){logger[_0x94f0('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x141b18);throw _0x141b18;});}return _0x4bfe22;})['then'](respondWithResult(_0x147bac,0xc9))['catch'](handleError(_0x147bac,null));};exports['update']=function(_0x459ecb,_0x424c78){if(_0x459ecb[_0x94f0('0x54')]['id']){delete _0x459ecb[_0x94f0('0x54')]['id'];}return db[_0x94f0('0x35')][_0x94f0('0x52')]({'where':{'id':_0x459ecb[_0x94f0('0x50')]['id']}})[_0x94f0('0x2c')](handleEntityNotFound(_0x424c78,null))['then'](saveUpdates(_0x459ecb['body'],null))['then'](respondWithResult(_0x424c78,null))[_0x94f0('0x4e')](handleError(_0x424c78,null));};exports['destroy']=function(_0x1a6d88,_0x306dbb){return db[_0x94f0('0x35')][_0x94f0('0x52')]({'where':{'id':_0x1a6d88['params']['id']}})[_0x94f0('0x2c')](handleEntityNotFound(_0x306dbb,null))[_0x94f0('0x2c')](removeEntity(_0x306dbb,null))[_0x94f0('0x4e')](handleError(_0x306dbb,null));};exports[_0x94f0('0x5d')]=function(_0x4eff9a,_0x5dd51f){return db['CmList'][_0x94f0('0x5d')]()['then'](respondWithResult(_0x5dd51f,null))[_0x94f0('0x4e')](handleError(_0x5dd51f,null));};exports[_0x94f0('0x5e')]=function(_0x6751e2,_0x15fd05,_0x30c69c){if(_0x6751e2['body']['id']){delete _0x6751e2[_0x94f0('0x54')]['id'];}return db[_0x94f0('0x35')][_0x94f0('0x52')]({'where':{'id':_0x6751e2[_0x94f0('0x50')]['id']}})[_0x94f0('0x2c')](handleEntityNotFound(_0x15fd05,null))['then'](function(_0x545980){if(_0x545980){_0x6751e2[_0x94f0('0x54')][_0x94f0('0x5f')]=_0x545980['id'];return db[_0x94f0('0x60')][_0x94f0('0x53')](_0x6751e2[_0x94f0('0x54')]);}})[_0x94f0('0x2c')](respondWithResult(_0x15fd05,null))[_0x94f0('0x4e')](handleError(_0x15fd05,null));};exports[_0x94f0('0x61')]=function(_0x6d9153,_0x17347e,_0x4104c3){var _0x50c6b6={'raw':![],'where':{}};var _0x301650={};var _0x243b27={'count':0x0,'rows':[]};return db['CmList'][_0x94f0('0x62')]({'where':{'id':_0x6d9153['params']['id']}})[_0x94f0('0x2c')](handleEntityNotFound(_0x17347e,null))['then'](function(_0x46c782){if(_0x46c782){_0x301650[_0x94f0('0x39')]=_[_0x94f0('0x51')](db[_0x94f0('0x60')][_0x94f0('0x36')]);_0x301650[_0x94f0('0x3a')]=_['keys'](_0x6d9153[_0x94f0('0x3a')]);_0x301650[_0x94f0('0x43')]=_[_0x94f0('0x3b')](_0x301650[_0x94f0('0x39')],_0x301650[_0x94f0('0x3a')]);_0x50c6b6[_0x94f0('0x3c')]=_['intersection'](_0x301650[_0x94f0('0x39')],qs[_0x94f0('0x3d')](_0x6d9153[_0x94f0('0x3a')]['fields']));_0x50c6b6[_0x94f0('0x3c')]=_0x50c6b6[_0x94f0('0x3c')][_0x94f0('0x3e')]?_0x50c6b6[_0x94f0('0x3c')]:_0x301650[_0x94f0('0x39')];if(!_0x6d9153[_0x94f0('0x3a')]['hasOwnProperty'](_0x94f0('0x40'))){_0x50c6b6[_0x94f0('0x24')]=qs[_0x94f0('0x24')](_0x6d9153[_0x94f0('0x3a')][_0x94f0('0x24')]);_0x50c6b6[_0x94f0('0x23')]=qs['offset'](_0x6d9153[_0x94f0('0x3a')]['offset']);}_0x50c6b6[_0x94f0('0x41')]=qs[_0x94f0('0x42')](_0x6d9153[_0x94f0('0x3a')][_0x94f0('0x42')]);_0x50c6b6[_0x94f0('0x46')]=qs['filters'](_[_0x94f0('0x44')](_0x6d9153[_0x94f0('0x3a')],_0x301650['filters']));_0x50c6b6[_0x94f0('0x46')][_0x94f0('0x5f')]=_0x46c782['id'];if(_0x6d9153[_0x94f0('0x3a')][_0x94f0('0x45')]){_0x50c6b6[_0x94f0('0x46')]=_['merge'](_0x50c6b6[_0x94f0('0x46')],{'$or':_['map'](_0x50c6b6[_0x94f0('0x3c')],function(_0x315ade){var _0x3c2909={};_0x3c2909[_0x315ade]={'$like':'%'+_0x6d9153[_0x94f0('0x3a')][_0x94f0('0x45')]+'%'};return _0x3c2909;})});}_0x50c6b6=_[_0x94f0('0x47')]({},_0x50c6b6,_0x6d9153['options']);return db[_0x94f0('0x60')][_0x94f0('0x26')]({'where':_0x50c6b6[_0x94f0('0x46')]})['then'](function(_0x44e5df){_0x243b27[_0x94f0('0x26')]=_0x44e5df;if(_0x6d9153[_0x94f0('0x3a')]['includeAll']){_0x50c6b6[_0x94f0('0x4b')]=[{'all':!![]}];}return db[_0x94f0('0x60')]['findAll'](_0x50c6b6);})[_0x94f0('0x2c')](function(_0x1f3d26){_0x243b27['rows']=_0x1f3d26;return _0x243b27;});}})[_0x94f0('0x2c')](respondWithFilteredResult(_0x17347e,_0x50c6b6))[_0x94f0('0x4e')](handleError(_0x17347e,null));};exports[_0x94f0('0x63')]=function(_0x45dca4,_0x5b80b2,_0xdd3359){return db[_0x94f0('0x35')][_0x94f0('0x52')]({'where':{'id':_0x45dca4[_0x94f0('0x50')]['id']}})[_0x94f0('0x2c')](handleEntityNotFound(_0x5b80b2,null))[_0x94f0('0x2c')](function(_0x3fbe9d){if(_0x3fbe9d){return _0x3fbe9d[_0x94f0('0x63')](_0x45dca4[_0x94f0('0x3a')][_0x94f0('0x64')]);}})[_0x94f0('0x2c')](respondWithStatusCode(_0x5b80b2,null))['catch'](handleError(_0x5b80b2,null));};exports['addContacts']=function(_0x359060,_0x2a38f3,_0x570585){return db['CmList'][_0x94f0('0x52')]({'where':{'id':_0x359060['params']['id']}})['then'](handleEntityNotFound(_0x2a38f3,null))[_0x94f0('0x2c')](function(_0x53e19a){if(_0x53e19a){var _0x5ad853=[];var _0x4ecd7c={'success':[],'errors':[]};return db[_0x94f0('0x65')][_0x94f0('0x5d')]()[_0x94f0('0x2c')](function(_0x276319){if(_0x359060[_0x94f0('0x54')][_0x94f0('0x66')]&&_['isArray'](_0x359060[_0x94f0('0x54')][_0x94f0('0x66')])){if(_0x359060[_0x94f0('0x54')][_0x94f0('0x66')]['length']){_0x359060[_0x94f0('0x54')]['tags']=_0x359060[_0x94f0('0x54')][_0x94f0('0x66')]['join'](';')+';';}else{_0x359060[_0x94f0('0x54')][_0x94f0('0x66')]=null;}}else{_0x359060[_0x94f0('0x54')]['tags']=null;}if(_0x359060[_0x94f0('0x54')]&&_['isArray'](_0x359060[_0x94f0('0x54')])){for(var _0x348e75=0x0;_0x348e75<_0x359060[_0x94f0('0x54')][_0x94f0('0x3e')];_0x348e75+=0x1){_0x359060[_0x94f0('0x54')][_0x348e75][_0x94f0('0x5f')]=_0x359060[_0x94f0('0x50')]['id'];_0x5ad853[_0x94f0('0x67')](_0x359060[_0x94f0('0x54')][_0x348e75]);}return BPromise[_0x94f0('0x68')](_0x5ad853,function(_0x35c36e){return db['CmContact'][_0x94f0('0x53')](_['omit'](_0x35c36e,['ids','id'])||{},{'fields':_[_0x94f0('0x51')](_0x276319),'raw':!![]})['then'](function(_0x38ecb3){_0x4ecd7c[_0x94f0('0x69')]['push'](_0x38ecb3[_0x94f0('0x6a')]);})[_0x94f0('0x4e')](function(_0x2e91ec){_0x4ecd7c[_0x94f0('0x6b')][_0x94f0('0x67')]({'data':_0x35c36e,'error':_0x2e91ec[_0x94f0('0x6c')]});});})[_0x94f0('0x2c')](function(_0xe28390){return _0x4ecd7c;})['catch'](function(_0x2c4ffa){return _0x2c4ffa;});}else{_0x2a38f3['status'](0x190)[_0x94f0('0x28')]({'message':_0x94f0('0x6d')});}});}})[_0x94f0('0x2c')](respondWithResult(_0x2a38f3,null))[_0x94f0('0x4e')](handleError(_0x2a38f3,null));};exports[_0x94f0('0x6e')]=function(_0x9cd2f2,_0x5b035c,_0x5d82d2){var _0x37f190;return db[_0x94f0('0x35')][_0x94f0('0x52')]({'where':{'id':_0x9cd2f2[_0x94f0('0x50')]['id']},'include':[{'model':db[_0x94f0('0x6f')],'as':_0x94f0('0x70')}]})['then'](handleEntityNotFound(_0x5b035c,null))[_0x94f0('0x2c')](function(_0x531a2f){if(_0x531a2f){_0x37f190=_0x531a2f;return db['CmContact'][_0x94f0('0x36')];}})[_0x94f0('0x2c')](function(_0x5261d0){if(_0x5261d0){var _0x17d570={};var _0x5241a8={};_0x5241a8['model']=_[_0x94f0('0x71')](_[_0x94f0('0x51')](_0x5261d0),_['map'](_0x37f190[_0x94f0('0x70')],function(_0x340365){return util['format']('cf_%d',_0x340365['id']);}));_0x5241a8['query']=_[_0x94f0('0x51')](_0x9cd2f2[_0x94f0('0x3a')]);_0x5241a8[_0x94f0('0x43')]=_[_0x94f0('0x3b')](_0x5241a8['model'],_0x5241a8['query']);_0x17d570[_0x94f0('0x3c')]=_[_0x94f0('0x3b')](_0x5241a8[_0x94f0('0x39')],qs['fields'](_0x9cd2f2['query'][_0x94f0('0x3d')]));_0x17d570[_0x94f0('0x3c')]=_0x17d570['attributes']['length']?_0x17d570[_0x94f0('0x3c')]:_0x5241a8[_0x94f0('0x39')];if(!_0x9cd2f2[_0x94f0('0x3a')][_0x94f0('0x3f')](_0x94f0('0x40'))){_0x17d570[_0x94f0('0x24')]=qs[_0x94f0('0x24')](_0x9cd2f2['query'][_0x94f0('0x24')]);_0x17d570[_0x94f0('0x23')]=qs['offset'](_0x9cd2f2[_0x94f0('0x3a')][_0x94f0('0x23')]);}_0x17d570['order']=qs[_0x94f0('0x42')](_0x9cd2f2[_0x94f0('0x3a')][_0x94f0('0x42')]);_0x17d570[_0x94f0('0x46')]=qs['filters'](_[_0x94f0('0x44')](_0x9cd2f2[_0x94f0('0x3a')],_0x5241a8['filters']));_0x17d570[_0x94f0('0x72')]=!![];if(_0x9cd2f2[_0x94f0('0x3a')][_0x94f0('0x45')]){_0x17d570[_0x94f0('0x46')]=_[_0x94f0('0x47')](_0x17d570['where'],{'$or':_[_0x94f0('0x34')](_0x17d570[_0x94f0('0x3c')],function(_0x5f5be1){var _0x618072={};_0x618072[_0x5f5be1]={'$like':'%'+_0x9cd2f2[_0x94f0('0x3a')][_0x94f0('0x45')]+'%'};return _0x618072;})});}_0x17d570=_[_0x94f0('0x47')]({},_0x17d570,_0x9cd2f2[_0x94f0('0x49')]);return _0x37f190[_0x94f0('0x6e')](_0x17d570);}})[_0x94f0('0x2c')](respondWithResult(_0x5b035c,null))['catch'](handleError(_0x5b035c,null));};exports['getContactsCsv']=function(_0x5236b9,_0x3ddc99,_0x14d1f6){var _0x31eec6;return db['CmList'][_0x94f0('0x52')]({'where':{'id':_0x5236b9[_0x94f0('0x50')]['id']},'include':[{'model':db['CmCustomField'],'as':'CustomFields'}]})[_0x94f0('0x2c')](handleEntityNotFound(_0x3ddc99,null))[_0x94f0('0x2c')](function(_0x315be8){if(_0x315be8){_0x31eec6=_0x315be8;return db[_0x94f0('0x65')][_0x94f0('0x36')];}})['then'](function(_0x147574){if(_0x147574){var _0x619a72={};var _0x11ede8={};_0x11ede8[_0x94f0('0x39')]=_['concat'](_[_0x94f0('0x51')](_0x147574),_[_0x94f0('0x34')](_0x31eec6['CustomFields'],function(_0x9f6449){return util[_0x94f0('0x73')](_0x94f0('0x74'),_0x9f6449['id']);}));_0x11ede8['query']=_['keys'](_0x5236b9[_0x94f0('0x3a')]);_0x11ede8[_0x94f0('0x43')]=_[_0x94f0('0x3b')](_0x11ede8['model'],_0x11ede8[_0x94f0('0x3a')]);_0x619a72[_0x94f0('0x3c')]=_[_0x94f0('0x3b')](_0x11ede8[_0x94f0('0x39')],qs[_0x94f0('0x3d')](_0x5236b9['query']['fields']));_0x619a72[_0x94f0('0x3c')]=_0x619a72[_0x94f0('0x3c')]['length']?_0x619a72['attributes']:_0x11ede8[_0x94f0('0x39')];if(!_0x5236b9[_0x94f0('0x3a')][_0x94f0('0x3f')](_0x94f0('0x40'))){_0x619a72[_0x94f0('0x24')]=qs[_0x94f0('0x24')](_0x5236b9[_0x94f0('0x3a')]['limit']);_0x619a72[_0x94f0('0x23')]=qs['offset'](_0x5236b9[_0x94f0('0x3a')][_0x94f0('0x23')]);}_0x619a72[_0x94f0('0x41')]=qs[_0x94f0('0x42')](_0x5236b9[_0x94f0('0x3a')][_0x94f0('0x42')]);_0x619a72[_0x94f0('0x46')]=qs['filters'](_[_0x94f0('0x44')](_0x5236b9['query'],_0x11ede8[_0x94f0('0x43')]));_0x619a72[_0x94f0('0x72')]=!![];if(_0x5236b9['query'][_0x94f0('0x45')]){_0x619a72[_0x94f0('0x46')]=_[_0x94f0('0x47')](_0x619a72[_0x94f0('0x46')],{'$or':_[_0x94f0('0x34')](_0x619a72[_0x94f0('0x3c')],function(_0x3fb089){var _0x1c82e3={};_0x1c82e3[_0x3fb089]={'$like':'%'+_0x5236b9[_0x94f0('0x3a')][_0x94f0('0x45')]+'%'};return _0x1c82e3;})});}_0x619a72=_['merge']({},_0x619a72,_0x5236b9[_0x94f0('0x49')]);return _0x31eec6[_0x94f0('0x6e')](_0x619a72);}})[_0x94f0('0x2c')](function(_0x40813d){if(!_[_0x94f0('0x75')](_0x40813d)){var _0x4a3587=toCsv(_0x40813d);var _0x29ee2e=Date[_0x94f0('0x76')]();fs[_0x94f0('0x77')](util[_0x94f0('0x73')](_0x94f0('0x78'),_0x31eec6['id'],_0x29ee2e),_0x4a3587);_0x3ddc99[_0x94f0('0x79')](_0x94f0('0x7a'),'attachment;\x20filename='+util[_0x94f0('0x73')](_0x94f0('0x7b'),_0x31eec6['id'],_0x29ee2e));_0x3ddc99[_0x94f0('0x79')](_0x94f0('0x7c'),'text/csv');return _0x3ddc99[_0x94f0('0x7d')](util[_0x94f0('0x73')](_0x94f0('0x78'),_0x31eec6['id'],_0x29ee2e));}else{return _0x3ddc99[_0x94f0('0x20')](0xcc);}})[_0x94f0('0x4e')](handleError(_0x3ddc99,null));};exports['addCustomField']=function(_0x278d65,_0x25fb1b,_0x1a0cbd){var _0x1d0daa;delete _0x278d65[_0x94f0('0x54')]['id'];return db[_0x94f0('0x35')]['findOne']({'where':{'id':_0x278d65[_0x94f0('0x50')]['id']}})['then'](handleEntityNotFound(_0x25fb1b,null))[_0x94f0('0x2c')](function(_0x236926){if(_0x236926){return db[_0x94f0('0x7e')][_0x94f0('0x7f')](function(_0x212887){return db[_0x94f0('0x6f')][_0x94f0('0x53')](_0x278d65[_0x94f0('0x54')],{'transaction':_0x212887})['then'](function(_0x257272){_0x1d0daa=_0x257272;return _0x236926['addCustomFields'](_0x257272,{'transaction':_0x212887});})[_0x94f0('0x2c')](function(){var _0x4c5569={'type':db['Sequelize'][_0x94f0('0x80')],'transaction':_0x212887};switch(_0x278d65['body']['type']){case _0x94f0('0x81'):_0x4c5569[_0x94f0('0x82')]=db[_0x94f0('0x83')][_0x94f0('0x80')];break;case'number':_0x4c5569[_0x94f0('0x82')]=db[_0x94f0('0x83')][_0x94f0('0x84')];break;case _0x94f0('0x85'):_0x4c5569[_0x94f0('0x82')]=db[_0x94f0('0x83')][_0x94f0('0x86')];_0x4c5569['defaultValue']=![];break;default:}return db[_0x94f0('0x7e')][_0x94f0('0x87')]['addColumn'](_0x94f0('0x88'),util['format']('cf_%s',_0x1d0daa['id']),_0x4c5569);})[_0x94f0('0x2c')](function(){return _0x1d0daa;});});}})[_0x94f0('0x2c')](respondWithResult(_0x25fb1b,null))[_0x94f0('0x4e')](handleError(_0x25fb1b,null));};exports[_0x94f0('0x89')]=function(_0x580413,_0x519c93,_0x1e7b5b){var _0x3d0b53={};var _0x4b2fda={};var _0x404eb8;var _0x3bd3d8;return db[_0x94f0('0x35')][_0x94f0('0x62')]({'where':{'id':_0x580413[_0x94f0('0x50')]['id']}})[_0x94f0('0x2c')](handleEntityNotFound(_0x519c93,null))['then'](function(_0x5a4953){if(_0x5a4953){_0x404eb8=_0x5a4953;_0x4b2fda['model']=_['keys'](db[_0x94f0('0x6f')][_0x94f0('0x36')]);_0x4b2fda['query']=_[_0x94f0('0x51')](_0x580413[_0x94f0('0x3a')]);_0x4b2fda[_0x94f0('0x43')]=_[_0x94f0('0x3b')](_0x4b2fda[_0x94f0('0x39')],_0x4b2fda[_0x94f0('0x3a')]);_0x3d0b53[_0x94f0('0x3c')]=_[_0x94f0('0x3b')](_0x4b2fda[_0x94f0('0x39')],qs[_0x94f0('0x3d')](_0x580413['query'][_0x94f0('0x3d')]));_0x3d0b53[_0x94f0('0x3c')]=_0x3d0b53[_0x94f0('0x3c')][_0x94f0('0x3e')]?_0x3d0b53[_0x94f0('0x3c')]:_0x4b2fda[_0x94f0('0x39')];_0x3d0b53[_0x94f0('0x41')]=qs[_0x94f0('0x42')](_0x580413[_0x94f0('0x3a')][_0x94f0('0x42')]);_0x3d0b53['where']=qs[_0x94f0('0x43')](_[_0x94f0('0x44')](_0x580413[_0x94f0('0x3a')],_0x4b2fda[_0x94f0('0x43')]));_0x3d0b53[_0x94f0('0x46')]=_[_0x94f0('0x47')](_0x3d0b53[_0x94f0('0x46')],{'$or':[{'ListId':_0x5a4953['id']},{'ListId':null}]});if(_0x580413[_0x94f0('0x3a')][_0x94f0('0x45')]){_0x3d0b53['where']=_[_0x94f0('0x47')](_0x3d0b53[_0x94f0('0x46')],{'$or':_[_0x94f0('0x34')](_0x3d0b53[_0x94f0('0x3c')],function(_0x195f12){var _0x27a5b7={};_0x27a5b7[_0x195f12]={'$like':'%'+_0x580413['query']['filter']+'%'};return _0x27a5b7;})});}_0x3d0b53=_[_0x94f0('0x47')]({},_0x3d0b53,_0x580413[_0x94f0('0x49')]);return db[_0x94f0('0x6f')][_0x94f0('0x8a')](_0x3d0b53);}})[_0x94f0('0x2c')](respondWithResult(_0x519c93,null))[_0x94f0('0x4e')](handleError(_0x519c93,null));};exports[_0x94f0('0x8b')]=function(_0x43a4f6,_0x48faa8,_0x28592b){return db['CmList']['find']({'where':{'id':_0x43a4f6[_0x94f0('0x50')]['id']}})[_0x94f0('0x2c')](handleEntityNotFound(_0x48faa8,null))[_0x94f0('0x2c')](function(_0x4525a5){if(_0x4525a5){return _0x4525a5[_0x94f0('0x8b')](_0x43a4f6[_0x94f0('0x54')]['ids'],_[_0x94f0('0x8c')](_0x43a4f6[_0x94f0('0x54')],[_0x94f0('0x64'),'id'])||{})[_0x94f0('0x8d')](function(_0x30ac58){for(var _0x6e3e1=0x0;_0x6e3e1<_0x43a4f6['body'][_0x94f0('0x64')][_0x94f0('0x3e')];_0x6e3e1+=0x1){socket['emit'](_0x94f0('0x8e'),{'UserId':Number(_0x43a4f6[_0x94f0('0x54')][_0x94f0('0x64')][_0x6e3e1]),'CmListId':Number(_0x43a4f6[_0x94f0('0x50')]['id'])});}return _0x30ac58;});}})[_0x94f0('0x2c')](respondWithResult(_0x48faa8,null))['catch'](handleError(_0x48faa8,null));};exports[_0x94f0('0x8f')]=function(_0x56e87b,_0x3be19b,_0x1d14d9){return db[_0x94f0('0x35')][_0x94f0('0x52')]({'where':{'id':_0x56e87b[_0x94f0('0x50')]['id']}})['then'](handleEntityNotFound(_0x3be19b,null))['then'](function(_0x3c11f9){if(_0x3c11f9){return _0x3c11f9['removeAgents'](_0x56e87b['query'][_0x94f0('0x64')])['then'](function(){if(_[_0x94f0('0x90')](_0x56e87b[_0x94f0('0x3a')][_0x94f0('0x64')])){for(var _0xe2ba8b=0x0;_0xe2ba8b<_0x56e87b[_0x94f0('0x3a')][_0x94f0('0x64')]['length'];_0xe2ba8b+=0x1){socket['emit'](_0x94f0('0x91'),{'UserId':Number(_0x56e87b[_0x94f0('0x3a')][_0x94f0('0x64')][_0xe2ba8b]),'CmListId':Number(_0x56e87b[_0x94f0('0x50')]['id'])});}}else{socket['emit']('userCmList:remove',{'UserId':Number(_0x56e87b[_0x94f0('0x3a')]['ids']),'CmListId':Number(_0x56e87b['params']['id'])});}});}})[_0x94f0('0x2c')](respondWithStatusCode(_0x3be19b,null))[_0x94f0('0x4e')](handleError(_0x3be19b,null));};exports['getAgents']=function(_0x58a4a5,_0x686249,_0x954809){var _0x132971={};var _0x176c97={};var _0x328367;var _0x3b643e;return db[_0x94f0('0x35')][_0x94f0('0x62')]({'where':{'id':_0x58a4a5[_0x94f0('0x50')]['id']}})['then'](handleEntityNotFound(_0x686249,null))[_0x94f0('0x2c')](function(_0x97efe8){if(_0x97efe8){_0x328367=_0x97efe8;_0x176c97[_0x94f0('0x39')]=_[_0x94f0('0x51')](db[_0x94f0('0x92')][_0x94f0('0x36')]);_0x176c97[_0x94f0('0x3a')]=_[_0x94f0('0x51')](_0x58a4a5[_0x94f0('0x3a')]);_0x176c97[_0x94f0('0x43')]=_[_0x94f0('0x3b')](_0x176c97[_0x94f0('0x39')],_0x176c97[_0x94f0('0x3a')]);_0x132971[_0x94f0('0x3c')]=_[_0x94f0('0x3b')](_0x176c97[_0x94f0('0x39')],qs[_0x94f0('0x3d')](_0x58a4a5[_0x94f0('0x3a')]['fields']));_0x132971[_0x94f0('0x3c')]=_0x132971[_0x94f0('0x3c')]['length']?_0x132971[_0x94f0('0x3c')]:_0x176c97[_0x94f0('0x39')];_0x132971[_0x94f0('0x41')]=qs[_0x94f0('0x42')](_0x58a4a5[_0x94f0('0x3a')][_0x94f0('0x42')]);_0x132971[_0x94f0('0x46')]=qs[_0x94f0('0x43')](_['pick'](_0x58a4a5[_0x94f0('0x3a')],_0x176c97['filters']));if(_0x58a4a5['query'][_0x94f0('0x45')]){_0x132971[_0x94f0('0x46')]=_[_0x94f0('0x47')](_0x132971[_0x94f0('0x46')],{'$or':_['map'](_0x132971[_0x94f0('0x3c')],function(_0x591f5a){var _0x59c31b={};_0x59c31b[_0x591f5a]={'$like':'%'+_0x58a4a5[_0x94f0('0x3a')][_0x94f0('0x45')]+'%'};return _0x59c31b;})});}_0x132971=_[_0x94f0('0x47')]({},_0x132971,_0x58a4a5[_0x94f0('0x49')]);return _0x328367[_0x94f0('0x93')](_0x132971);}})[_0x94f0('0x2c')](function(_0xa64e83){if(_0xa64e83){_0x3b643e=_0xa64e83[_0x94f0('0x3e')];if(!_0x58a4a5[_0x94f0('0x3a')][_0x94f0('0x3f')](_0x94f0('0x40'))){_0x132971['limit']=qs[_0x94f0('0x24')](_0x58a4a5['query'][_0x94f0('0x24')]);_0x132971[_0x94f0('0x23')]=qs['offset'](_0x58a4a5[_0x94f0('0x3a')][_0x94f0('0x23')]);}return _0x328367[_0x94f0('0x93')](_0x132971);}})[_0x94f0('0x2c')](function(_0x417e3b){if(_0x417e3b){return _0x417e3b?{'count':_0x3b643e,'rows':_0x417e3b}:null;}})['then'](respondWithResult(_0x686249,null))[_0x94f0('0x4e')](handleError(_0x686249,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 40a3a47..6d10fe7 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(_0x3d6973,_0x2e5f76){_0x3d6973=_0x3d6973-0x0;var _0x521009=_0xe14b[_0x3d6973];return _0x521009;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var CmList=require(_0xbe14('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){CmListEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);CmListEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];CmList[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=CmListEvents; \ No newline at end of file +var _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xe14b,0x93));var _0xbe14=function(_0x2350bf,_0x37288a){_0x2350bf=_0x2350bf-0x0;var _0x14211e=_0xe14b[_0x2350bf];return _0x14211e;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var CmList=require(_0xbe14('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){CmListEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);CmListEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];CmList[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 3fdb9ec..c7e3b2f 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 _0x878f=['path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x878f,0x173));var _0xf878=function(_0x5addc7,_0x548bdf){_0x5addc7=_0x5addc7-0x0;var _0x33f2ad=_0x878f[_0x5addc7];return _0x33f2ad;};'use strict';var _=require('lodash');var util=require(_0xf878('0x0'));var logger=require(_0xf878('0x1'))(_0xf878('0x2'));var moment=require(_0xf878('0x3'));var BPromise=require(_0xf878('0x4'));var rp=require(_0xf878('0x5'));var fs=require('fs');var path=require(_0xf878('0x6'));var rimraf=require(_0xf878('0x7'));var config=require(_0xf878('0x8'));var attributes=require(_0xf878('0x9'));module[_0xf878('0xa')]=function(_0x4bc9aa,_0x4ac8d8){return _0x4bc9aa[_0xf878('0xb')](_0xf878('0xc'),attributes,{'tableName':'cm_lists','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(_0x44e16b,_0x479c8e){var _0x921f41=function(_0x5b74f6){while(--_0x5b74f6){_0x44e16b['push'](_0x44e16b['shift']());}};_0x921f41(++_0x479c8e);}(_0x9bde,0xe1));var _0xe9bd=function(_0x4bb40d,_0x541949){_0x4bb40d=_0x4bb40d-0x0;var _0x41ede2=_0x9bde[_0x4bb40d];return _0x41ede2;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var logger=require('../../config/logger')(_0xe9bd('0x1'));var moment=require('moment');var BPromise=require(_0xe9bd('0x2'));var rp=require(_0xe9bd('0x3'));var fs=require('fs');var path=require(_0xe9bd('0x4'));var rimraf=require(_0xe9bd('0x5'));var config=require(_0xe9bd('0x6'));var attributes=require(_0xe9bd('0x7'));module[_0xe9bd('0x8')]=function(_0x4fd7b8,_0x4763e9){return _0x4fd7b8[_0xe9bd('0x9')](_0xe9bd('0xa'),attributes,{'tableName':_0xe9bd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 0c9496b..9b812f3 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 _0xc54e=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./cmList.socket','register','request','info','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','CmList,\x20%s,\x20%s','message','result','catch','lodash','moment','ioredis'];(function(_0x2302a7,_0xe38d1){var _0x159bc1=function(_0x52da0e){while(--_0x52da0e){_0x2302a7['push'](_0x2302a7['shift']());}};_0x159bc1(++_0xe38d1);}(_0xc54e,0x141));var _0xec54=function(_0x6ea8a2,_0x561d6c){_0x6ea8a2=_0x6ea8a2-0x0;var _0x4fe938=_0xc54e[_0x6ea8a2];return _0x4fe938;};'use strict';var _=require(_0xec54('0x0'));var util=require('util');var moment=require(_0xec54('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xec54('0x2'));var db=require(_0xec54('0x3'))['db'];var utils=require(_0xec54('0x4'));var logger=require(_0xec54('0x5'))(_0xec54('0x6'));var config=require(_0xec54('0x7'));var jayson=require(_0xec54('0x8'));var client=jayson[_0xec54('0x9')][_0xec54('0xa')]({'port':0x232a});config[_0xec54('0xb')]=_[_0xec54('0xc')](config[_0xec54('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xec54('0xd'))(new Redis(config[_0xec54('0xb')]));require(_0xec54('0xe'))[_0xec54('0xf')](socket);function respondWithRpcPromise(_0x3df15b,_0x3a0aa5,_0x3cad50){return new BPromise(function(_0x57e457,_0x306ec9){return client[_0xec54('0x10')](_0x3df15b,_0x3cad50)['then'](function(_0x1a23fd){logger[_0xec54('0x11')]('CmList,\x20%s,\x20%s',_0x3a0aa5,_0xec54('0x12'));logger[_0xec54('0x13')](_0xec54('0x14'),_0x3a0aa5,_0xec54('0x12'),JSON[_0xec54('0x15')](_0x1a23fd));if(_0x1a23fd[_0xec54('0x16')]){if(_0x1a23fd['error']['code']===0x1f4){logger[_0xec54('0x16')](_0xec54('0x17'),_0x3a0aa5,_0x1a23fd[_0xec54('0x16')]['message']);return _0x306ec9(_0x1a23fd['error'][_0xec54('0x18')]);}logger['error']('CmList,\x20%s,\x20%s',_0x3a0aa5,_0x1a23fd[_0xec54('0x16')]['message']);return _0x57e457(_0x1a23fd[_0xec54('0x16')][_0xec54('0x18')]);}else{logger[_0xec54('0x11')](_0xec54('0x17'),_0x3a0aa5,_0xec54('0x12'));_0x57e457(_0x1a23fd[_0xec54('0x19')][_0xec54('0x18')]);}})[_0xec54('0x1a')](function(_0x384bbf){logger[_0xec54('0x16')](_0xec54('0x17'),_0x3a0aa5,_0x384bbf);_0x306ec9(_0x384bbf);});});} \ No newline at end of file +var _0x94a6=['debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','CmList,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','info','request\x20sent'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x94a6,0x17f));var _0x694a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x94a6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x694a('0x0'));var util=require(_0x694a('0x1'));var moment=require(_0x694a('0x2'));var BPromise=require(_0x694a('0x3'));var rs=require(_0x694a('0x4'));var fs=require('fs');var Redis=require(_0x694a('0x5'));var db=require(_0x694a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x694a('0x7'))(_0x694a('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x694a('0x9')]=_[_0x694a('0xa')](config[_0x694a('0x9')],{'host':_0x694a('0xb'),'port':0x18eb});var socket=require(_0x694a('0xc'))(new Redis(config[_0x694a('0x9')]));require(_0x694a('0xd'))[_0x694a('0xe')](socket);function respondWithRpcPromise(_0x135126,_0x54e175,_0x1ef86f){return new BPromise(function(_0x4e7696,_0x28bc30){return client['request'](_0x135126,_0x1ef86f)['then'](function(_0x31558f){logger[_0x694a('0xf')]('CmList,\x20%s,\x20%s',_0x54e175,_0x694a('0x10'));logger[_0x694a('0x11')](_0x694a('0x12'),_0x54e175,_0x694a('0x10'),JSON[_0x694a('0x13')](_0x31558f));if(_0x31558f[_0x694a('0x14')]){if(_0x31558f['error'][_0x694a('0x15')]===0x1f4){logger[_0x694a('0x14')](_0x694a('0x16'),_0x54e175,_0x31558f['error'][_0x694a('0x17')]);return _0x28bc30(_0x31558f[_0x694a('0x14')][_0x694a('0x17')]);}logger['error'](_0x694a('0x16'),_0x54e175,_0x31558f['error'][_0x694a('0x17')]);return _0x4e7696(_0x31558f[_0x694a('0x14')][_0x694a('0x17')]);}else{logger[_0x694a('0xf')](_0x694a('0x16'),_0x54e175,_0x694a('0x10'));_0x4e7696(_0x31558f[_0x694a('0x18')]['message']);}})['catch'](function(_0x2977de){logger[_0x694a('0x14')](_0x694a('0x16'),_0x54e175,_0x2977de);_0x28bc30(_0x2977de);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index bd8a1dc..fdf94e2 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 _0x28db=['save','remove','removeListener','register','length','./cmList.events'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x28db,0xd7));var _0xb28d=function(_0x235575,_0x583f2e){_0x235575=_0x235575-0x0;var _0x5c15b3=_0x28db[_0x235575];return _0x5c15b3;};'use strict';var CmListEvents=require(_0xb28d('0x0'));var events=[_0xb28d('0x1'),_0xb28d('0x2'),'update'];function createListener(_0x269dae,_0x394e0){return function(_0x2187c1){_0x394e0['emit'](_0x269dae,_0x2187c1);};}function removeListener(_0x593ca8,_0x5225dd){return function(){CmListEvents[_0xb28d('0x3')](_0x593ca8,_0x5225dd);};}exports[_0xb28d('0x4')]=function(_0x500282){for(var _0x281529=0x0,_0x1e6197=events[_0xb28d('0x5')];_0x281529<_0x1e6197;_0x281529++){var _0x30ce44=events[_0x281529];var _0x597997=createListener('cmList:'+_0x30ce44,_0x500282);CmListEvents['on'](_0x30ce44,_0x597997);}}; \ No newline at end of file +var _0xce0a=['cmList:','remove','emit','removeListener','register','length'];(function(_0x320800,_0x1ddb58){var _0x1cbdf3=function(_0x49a114){while(--_0x49a114){_0x320800['push'](_0x320800['shift']());}};_0x1cbdf3(++_0x1ddb58);}(_0xce0a,0xbb));var _0xace0=function(_0x4e9274,_0x49576e){_0x4e9274=_0x4e9274-0x0;var _0x8b474c=_0xce0a[_0x4e9274];return _0x8b474c;};'use strict';var CmListEvents=require('./cmList.events');var events=['save',_0xace0('0x0'),'update'];function createListener(_0x3bebd1,_0x1f6554){return function(_0x3eda18){_0x1f6554[_0xace0('0x1')](_0x3bebd1,_0x3eda18);};}function removeListener(_0x3a4706,_0x543209){return function(){CmListEvents[_0xace0('0x2')](_0x3a4706,_0x543209);};}exports[_0xace0('0x3')]=function(_0x25eb90){for(var _0x273ae1=0x0,_0x16a130=events[_0xace0('0x4')];_0x273ae1<_0x16a130;_0x273ae1++){var _0x30bd97=events[_0x273ae1];var _0x2dc450=createListener(_0xace0('0x5')+_0x30bd97,_0x25eb90);CmListEvents['on'](_0x30bd97,_0x2dc450);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 0a89f45..6a31b46 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 _0x4c3e=['../../config/environment','./cmList.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/fields','getCustomFields','getAgents','post','create','addDisposition','/:id/contacts','addContacts','update','delete','destroy','removeDispositions','/:id/users','multer','path','express','Router','../../components/auth/service'];(function(_0x32a767,_0x4e3e76){var _0x2b4e6d=function(_0x5e0702){while(--_0x5e0702){_0x32a767['push'](_0x32a767['shift']());}};_0x2b4e6d(++_0x4e3e76);}(_0x4c3e,0xbf));var _0xe4c3=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x4c3e[_0xf50820];return _0x2a9b10;};'use strict';var multer=require(_0xe4c3('0x0'));var util=require('util');var path=require(_0xe4c3('0x1'));var timeout=require('connect-timeout');var express=require(_0xe4c3('0x2'));var router=express[_0xe4c3('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe4c3('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe4c3('0x5'));var controller=require(_0xe4c3('0x6'));router[_0xe4c3('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe4c3('0x7')](_0xe4c3('0x8'),auth[_0xe4c3('0x9')](),controller[_0xe4c3('0xa')]);router[_0xe4c3('0x7')](_0xe4c3('0xb'),auth['isAuthenticated'](),controller[_0xe4c3('0xc')]);router['get'](_0xe4c3('0xd'),auth['isAuthenticated'](),controller[_0xe4c3('0xe')]);router[_0xe4c3('0x7')]('/:id/contacts',auth[_0xe4c3('0x9')](),controller['getContacts']);router[_0xe4c3('0x7')]('/:id/contacts/csv',auth[_0xe4c3('0x9')](),controller['getContactsCsv']);router[_0xe4c3('0x7')](_0xe4c3('0xf'),auth[_0xe4c3('0x9')](),controller[_0xe4c3('0x10')]);router[_0xe4c3('0x7')]('/:id/users',auth['isAuthenticated'](),controller[_0xe4c3('0x11')]);router[_0xe4c3('0x12')]('/',auth['isAuthenticated'](),controller[_0xe4c3('0x13')]);router[_0xe4c3('0x12')]('/:id/dispositions',auth[_0xe4c3('0x9')](),controller[_0xe4c3('0x14')]);router[_0xe4c3('0x12')](_0xe4c3('0x15'),auth[_0xe4c3('0x9')](),controller[_0xe4c3('0x16')]);router[_0xe4c3('0x12')](_0xe4c3('0xf'),auth['isAuthenticated'](),controller['addCustomField']);router[_0xe4c3('0x12')]('/:id/users',auth[_0xe4c3('0x9')](),controller['addAgents']);router['put'](_0xe4c3('0xb'),auth[_0xe4c3('0x9')](),controller[_0xe4c3('0x17')]);router[_0xe4c3('0x18')]('/:id',auth[_0xe4c3('0x9')](),controller[_0xe4c3('0x19')]);router[_0xe4c3('0x18')](_0xe4c3('0xd'),auth['isAuthenticated'](),controller[_0xe4c3('0x1a')]);router['delete'](_0xe4c3('0x1b'),auth[_0xe4c3('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x50ef=['../../components/interaction/service','./cmList.controller','get','isAuthenticated','index','/describe','/:id','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','getCustomFields','/:id/users','getAgents','post','/:id/dispositions','addContacts','addCustomField','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0xfa1bdd,_0x1416f9){var _0x497408=function(_0x475876){while(--_0x475876){_0xfa1bdd['push'](_0xfa1bdd['shift']());}};_0x497408(++_0x1416f9);}(_0x50ef,0x81));var _0xf50e=function(_0x5b0e88,_0x396dad){_0x5b0e88=_0x5b0e88-0x0;var _0x583a8e=_0x50ef[_0x5b0e88];return _0x583a8e;};'use strict';var multer=require(_0xf50e('0x0'));var util=require('util');var path=require(_0xf50e('0x1'));var timeout=require(_0xf50e('0x2'));var express=require(_0xf50e('0x3'));var router=express[_0xf50e('0x4')]();var fs_extra=require(_0xf50e('0x5'));var auth=require(_0xf50e('0x6'));var interaction=require(_0xf50e('0x7'));var config=require('../../config/environment');var controller=require(_0xf50e('0x8'));router[_0xf50e('0x9')]('/',auth[_0xf50e('0xa')](),controller[_0xf50e('0xb')]);router[_0xf50e('0x9')](_0xf50e('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xf50e('0x9')](_0xf50e('0xd'),auth[_0xf50e('0xa')](),controller['show']);router[_0xf50e('0x9')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xf50e('0xe')]);router[_0xf50e('0x9')](_0xf50e('0xf'),auth[_0xf50e('0xa')](),controller[_0xf50e('0x10')]);router[_0xf50e('0x9')](_0xf50e('0x11'),auth[_0xf50e('0xa')](),controller[_0xf50e('0x12')]);router[_0xf50e('0x9')]('/:id/fields',auth[_0xf50e('0xa')](),controller[_0xf50e('0x13')]);router['get'](_0xf50e('0x14'),auth['isAuthenticated'](),controller[_0xf50e('0x15')]);router['post']('/',auth[_0xf50e('0xa')](),controller['create']);router[_0xf50e('0x16')](_0xf50e('0x17'),auth[_0xf50e('0xa')](),controller['addDisposition']);router['post'](_0xf50e('0xf'),auth[_0xf50e('0xa')](),controller[_0xf50e('0x18')]);router[_0xf50e('0x16')]('/:id/fields',auth['isAuthenticated'](),controller[_0xf50e('0x19')]);router[_0xf50e('0x16')](_0xf50e('0x14'),auth[_0xf50e('0xa')](),controller[_0xf50e('0x1a')]);router[_0xf50e('0x1b')](_0xf50e('0xd'),auth[_0xf50e('0xa')](),controller[_0xf50e('0x1c')]);router[_0xf50e('0x1d')](_0xf50e('0xd'),auth['isAuthenticated'](),controller[_0xf50e('0x1e')]);router['delete'](_0xf50e('0x17'),auth['isAuthenticated'](),controller[_0xf50e('0x1f')]);router[_0xf50e('0x1d')](_0xf50e('0x14'),auth[_0xf50e('0xa')](),controller[_0xf50e('0x20')]);module[_0xf50e('0x21')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 33b7b5d..b2302c5 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 _0x4777=['field','STRING','exports','VIRTUAL','getDataValue'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0x4777,0x1ba));var _0x7477=function(_0x54a2e4,_0x1ff92c){_0x54a2e4=_0x54a2e4-0x0;var _0x4742d0=_0x4777[_0x54a2e4];return _0x4742d0;};'use strict';var Sequelize=require('sequelize');module[_0x7477('0x0')]={'name':{'type':Sequelize[_0x7477('0x1')],'get':function(_0x3794fb){return this[_0x7477('0x2')](_0x7477('0x3'));}},'field':{'type':Sequelize[_0x7477('0x4')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x7477('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0xdde7=['STRING','sequelize','exports','VIRTUAL','getDataValue','field'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdde7,0x1db));var _0x7dde=function(_0x4a7458,_0x5e0843){_0x4a7458=_0x4a7458-0x0;var _0x35226d=_0xdde7[_0x4a7458];return _0x35226d;};'use strict';var Sequelize=require(_0x7dde('0x0'));module[_0x7dde('0x1')]={'name':{'type':Sequelize[_0x7dde('0x2')],'get':function(_0x37788e){return this[_0x7dde('0x3')](_0x7dde('0x4'));}},'field':{'type':Sequelize[_0x7dde('0x5')],'allowNull':![]},'operator':{'type':Sequelize[_0x7dde('0x5')],'allowNull':![]},'value':{'type':Sequelize[_0x7dde('0x5')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 2078c2a..5424454 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x5f30e3,_0x3e9679){var _0x24fbbd=function(_0x5c37f4){while(--_0x5c37f4){_0x5f30e3['push'](_0x5f30e3['shift']());}};_0x24fbbd(++_0x3e9679);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x3692a9,_0x15b170){var _0x2a29f3=function(_0x5f1ebb){while(--_0x5f1ebb){_0x3692a9['push'](_0x3692a9['shift']());}};_0x2a29f3(++_0x15b170);}(_0x7a54,0x106));var _0x47a5=function(_0x17bbe9,_0x48062e){_0x17bbe9=_0x17bbe9-0x0;var _0x8f0634=_0x7a54[_0x17bbe9];return _0x8f0634;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index ac3805a..cbc1ac2 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 _0xc1a0=['../../config/environment','exports','tools_conditions','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x207342,_0x244cfc){var _0x2f60e1=function(_0x12ec7){while(--_0x12ec7){_0x207342['push'](_0x207342['shift']());}};_0x2f60e1(++_0x244cfc);}(_0xc1a0,0x143));var _0x0c1a=function(_0x3a3b9e,_0xc59037){_0x3a3b9e=_0x3a3b9e-0x0;var _0x148103=_0xc1a0[_0x3a3b9e];return _0x148103;};'use strict';var _=require('lodash');var util=require(_0x0c1a('0x0'));var logger=require(_0x0c1a('0x1'))(_0x0c1a('0x2'));var moment=require(_0x0c1a('0x3'));var BPromise=require('bluebird');var rp=require(_0x0c1a('0x4'));var fs=require('fs');var path=require(_0x0c1a('0x5'));var rimraf=require(_0x0c1a('0x6'));var config=require(_0x0c1a('0x7'));var attributes=require('./condition.attributes');module[_0x0c1a('0x8')]=function(_0xdbbe98,_0x425953){return _0xdbbe98['define']('Condition',attributes,{'tableName':_0x0c1a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5a24=['path','rimraf','./condition.attributes','exports','define','tools_conditions','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x299504,_0x1f3008){var _0x1908ee=function(_0x23e4e9){while(--_0x23e4e9){_0x299504['push'](_0x299504['shift']());}};_0x1908ee(++_0x1f3008);}(_0x5a24,0x74));var _0x45a2=function(_0x3865ad,_0x2db7b1){_0x3865ad=_0x3865ad-0x0;var _0x3b41df=_0x5a24[_0x3865ad];return _0x3b41df;};'use strict';var _=require('lodash');var util=require(_0x45a2('0x0'));var logger=require(_0x45a2('0x1'))('api');var moment=require(_0x45a2('0x2'));var BPromise=require(_0x45a2('0x3'));var rp=require(_0x45a2('0x4'));var fs=require('fs');var path=require(_0x45a2('0x5'));var rimraf=require(_0x45a2('0x6'));var config=require('../../config/environment');var attributes=require(_0x45a2('0x7'));module[_0x45a2('0x8')]=function(_0x352fdc,_0x4bd814){return _0x352fdc[_0x45a2('0x9')]('Condition',attributes,{'tableName':_0x45a2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 828e2e3..e15dbfa 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 _0x9e51=['Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','../../mysqldb','../../config/utils','../../config/logger','rpc','then','info'];(function(_0x4851ff,_0x1c9a8d){var _0x26773b=function(_0x26c33e){while(--_0x26c33e){_0x4851ff['push'](_0x4851ff['shift']());}};_0x26773b(++_0x1c9a8d);}(_0x9e51,0x189));var _0x19e5=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x9e51[_0xd1d19a];return _0x52a79d;};'use strict';var _=require('lodash');var util=require(_0x19e5('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x19e5('0x1'))['db'];var utils=require(_0x19e5('0x2'));var logger=require(_0x19e5('0x3'))(_0x19e5('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3665c7,_0x58b195,_0x5f3a1b){return new BPromise(function(_0x82ef54,_0x91ff13){return client['request'](_0x3665c7,_0x5f3a1b)[_0x19e5('0x5')](function(_0x56af8b){logger[_0x19e5('0x6')](_0x19e5('0x7'),_0x58b195,_0x19e5('0x8'));logger[_0x19e5('0x9')](_0x19e5('0xa'),_0x58b195,_0x19e5('0x8'),JSON[_0x19e5('0xb')](_0x56af8b));if(_0x56af8b[_0x19e5('0xc')]){if(_0x56af8b[_0x19e5('0xc')]['code']===0x1f4){logger['error']('Condition,\x20%s,\x20%s',_0x58b195,_0x56af8b[_0x19e5('0xc')]['message']);return _0x91ff13(_0x56af8b[_0x19e5('0xc')]['message']);}logger[_0x19e5('0xc')](_0x19e5('0x7'),_0x58b195,_0x56af8b[_0x19e5('0xc')][_0x19e5('0xd')]);return _0x82ef54(_0x56af8b[_0x19e5('0xc')][_0x19e5('0xd')]);}else{logger[_0x19e5('0x6')](_0x19e5('0x7'),_0x58b195,_0x19e5('0x8'));_0x82ef54(_0x56af8b[_0x19e5('0xe')][_0x19e5('0xd')]);}})[_0x19e5('0xf')](function(_0x59fac5){logger[_0x19e5('0xc')](_0x19e5('0x7'),_0x58b195,_0x59fac5);_0x91ff13(_0x59fac5);});});} \ No newline at end of file +var _0x2f40=['code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2f40,0x124));var _0x02f4=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x2f40[_0x5783f4];return _0x28e380;};'use strict';var _=require(_0x02f4('0x0'));var util=require(_0x02f4('0x1'));var moment=require(_0x02f4('0x2'));var BPromise=require('bluebird');var rs=require(_0x02f4('0x3'));var fs=require('fs');var Redis=require(_0x02f4('0x4'));var db=require(_0x02f4('0x5'))['db'];var utils=require(_0x02f4('0x6'));var logger=require(_0x02f4('0x7'))(_0x02f4('0x8'));var config=require('../../config/environment');var jayson=require(_0x02f4('0x9'));var client=jayson['client'][_0x02f4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ef593,_0xde2024,_0x5724cb){return new BPromise(function(_0x256799,_0x34328a){return client[_0x02f4('0xb')](_0x4ef593,_0x5724cb)[_0x02f4('0xc')](function(_0x293b14){logger[_0x02f4('0xd')](_0x02f4('0xe'),_0xde2024,_0x02f4('0xf'));logger[_0x02f4('0x10')](_0x02f4('0x11'),_0xde2024,_0x02f4('0xf'),JSON[_0x02f4('0x12')](_0x293b14));if(_0x293b14[_0x02f4('0x13')]){if(_0x293b14[_0x02f4('0x13')][_0x02f4('0x14')]===0x1f4){logger['error'](_0x02f4('0xe'),_0xde2024,_0x293b14[_0x02f4('0x13')][_0x02f4('0x15')]);return _0x34328a(_0x293b14[_0x02f4('0x13')]['message']);}logger[_0x02f4('0x13')](_0x02f4('0xe'),_0xde2024,_0x293b14['error']['message']);return _0x256799(_0x293b14[_0x02f4('0x13')][_0x02f4('0x15')]);}else{logger[_0x02f4('0xd')](_0x02f4('0xe'),_0xde2024,'request\x20sent');_0x256799(_0x293b14[_0x02f4('0x16')][_0x02f4('0x15')]);}})[_0x02f4('0x17')](function(_0x937da0){logger[_0x02f4('0x13')](_0x02f4('0xe'),_0xde2024,_0x937da0);_0x34328a(_0x937da0);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index bb76e61..3095acc 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 _0xc2df=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./condition.controller','put','/:id','update'];(function(_0x5db666,_0x239940){var _0x42d839=function(_0x3ee479){while(--_0x3ee479){_0x5db666['push'](_0x5db666['shift']());}};_0x42d839(++_0x239940);}(_0xc2df,0x9d));var _0xfc2d=function(_0x1e6be9,_0x2d3186){_0x1e6be9=_0x1e6be9-0x0;var _0x21f2d5=_0xc2df[_0x1e6be9];return _0x21f2d5;};'use strict';var multer=require(_0xfc2d('0x0'));var util=require(_0xfc2d('0x1'));var path=require(_0xfc2d('0x2'));var timeout=require(_0xfc2d('0x3'));var express=require(_0xfc2d('0x4'));var router=express[_0xfc2d('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfc2d('0x6'));var config=require('../../config/environment');var controller=require(_0xfc2d('0x7'));router[_0xfc2d('0x8')](_0xfc2d('0x9'),auth['isAuthenticated'](),controller[_0xfc2d('0xa')]);router[_0xfc2d('0xb')](_0xfc2d('0x9'),auth['isAuthenticated'](),controller[_0xfc2d('0xc')]);module[_0xfc2d('0xd')]=router; \ No newline at end of file +var _0x5f70=['destroy','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated','update'];(function(_0x4b980d,_0x32fc6a){var _0x5c7974=function(_0x3b7af4){while(--_0x3b7af4){_0x4b980d['push'](_0x4b980d['shift']());}};_0x5c7974(++_0x32fc6a);}(_0x5f70,0x1a5));var _0x05f7=function(_0x552b92,_0x1e2e17){_0x552b92=_0x552b92-0x0;var _0x213901=_0x5f70[_0x552b92];return _0x213901;};'use strict';var multer=require(_0x05f7('0x0'));var util=require(_0x05f7('0x1'));var path=require('path');var timeout=require(_0x05f7('0x2'));var express=require(_0x05f7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x05f7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x05f7('0x5'));var controller=require(_0x05f7('0x6'));router[_0x05f7('0x7')](_0x05f7('0x8'),auth[_0x05f7('0x9')](),controller[_0x05f7('0xa')]);router['delete']('/:id',auth[_0x05f7('0x9')](),controller[_0x05f7('0xb')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 86d64b1..21f2acf 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(_0x5f5477,_0x406dec){var _0x277186=function(_0x482955){while(--_0x482955){_0x5f5477['push'](_0x5f5477['shift']());}};_0x277186(++_0x406dec);}(_0xb10b,0x12a));var _0xbb10=function(_0x5a7cbc,_0x573d85){_0x5a7cbc=_0x5a7cbc-0x0;var _0x44d2cc=_0xb10b[_0x5a7cbc];return _0x44d2cc;};'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 _0x0713=['STRING','name'];(function(_0x8e5431,_0xac0957){var _0x259c87=function(_0x3cd86c){while(--_0x3cd86c){_0x8e5431['push'](_0x8e5431['shift']());}};_0x259c87(++_0xac0957);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 041627d..f758e1b 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 _0x14bd=['offset','undefined','count','limit','set','Content-Range','apply','reject','save','destroy','then','get','CustomDashboards','UserProfileResource','stack','name','send','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','Dashboard','includeAll','include','findAll','rows','catch','params','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body','UserProfileSection','update','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardId','DashboardItem','getItems','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','sendStatus','end','status','json'];(function(_0x57da06,_0x4c9d35){var _0x118c39=function(_0x501a24){while(--_0x501a24){_0x57da06['push'](_0x57da06['shift']());}};_0x118c39(++_0x4c9d35);}(_0x14bd,0x159));var _0xd14b=function(_0x16eadc,_0x3fc953){_0x16eadc=_0x16eadc-0x0;var _0x5b05c8=_0x14bd[_0x16eadc];return _0x5b05c8;};'use strict';var emlformat=require(_0xd14b('0x0'));var rimraf=require(_0xd14b('0x1'));var zipdir=require(_0xd14b('0x2'));var jsonpatch=require(_0xd14b('0x3'));var rp=require(_0xd14b('0x4'));var moment=require(_0xd14b('0x5'));var BPromise=require(_0xd14b('0x6'));var Mustache=require('mustache');var util=require(_0xd14b('0x7'));var path=require(_0xd14b('0x8'));var sox=require(_0xd14b('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd14b('0xa'));var _=require(_0xd14b('0xb'));var squel=require(_0xd14b('0xc'));var crypto=require(_0xd14b('0xd'));var jsforce=require(_0xd14b('0xe'));var deskjs=require(_0xd14b('0xf'));var toCsv=require(_0xd14b('0x10'));var querystring=require(_0xd14b('0x11'));var Papa=require(_0xd14b('0x12'));var Redis=require(_0xd14b('0x13'));var authService=require(_0xd14b('0x14'));var qs=require(_0xd14b('0x15'));var as=require(_0xd14b('0x16'));var hardwareService=require(_0xd14b('0x17'));var logger=require(_0xd14b('0x18'))(_0xd14b('0x19'));var utils=require(_0xd14b('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0xd14b('0x1b'));var db=require('../../mysqldb')['db'];config[_0xd14b('0x1c')]=_[_0xd14b('0x1d')](config[_0xd14b('0x1c')],{'host':_0xd14b('0x1e'),'port':0x18eb});var socket=require(_0xd14b('0x1f'))(new Redis(config[_0xd14b('0x1c')]));require('./dashboard.socket')['register'](socket);function respondWithStatusCode(_0x5087f3,_0x29349f){_0x29349f=_0x29349f||0xcc;return function(_0x4bd196){if(_0x4bd196){return _0x5087f3[_0xd14b('0x20')](_0x29349f);}return _0x5087f3['status'](_0x29349f)[_0xd14b('0x21')]();};}function respondWithResult(_0x2b8dec,_0x5279a3){_0x5279a3=_0x5279a3||0xc8;return function(_0x18aa0e){if(_0x18aa0e){return _0x2b8dec[_0xd14b('0x22')](_0x5279a3)[_0xd14b('0x23')](_0x18aa0e);}};}function respondWithFilteredResult(_0x210693,_0x4f04f8){return function(_0x3c8a73){if(_0x3c8a73){var _0x1e1687=typeof _0x4f04f8[_0xd14b('0x24')]==='undefined'&&typeof _0x4f04f8['limit']===_0xd14b('0x25');var _0x20b119=_0x3c8a73[_0xd14b('0x26')];var _0xa284fa=_0x1e1687?0x0:_0x4f04f8[_0xd14b('0x24')];var _0x3d4ee0=_0x1e1687?_0x3c8a73[_0xd14b('0x26')]:_0x4f04f8[_0xd14b('0x24')]+_0x4f04f8[_0xd14b('0x27')];var _0x362cf3;if(_0x3d4ee0>=_0x20b119){_0x3d4ee0=_0x20b119;_0x362cf3=0xc8;}else{_0x362cf3=0xce;}_0x210693['status'](_0x362cf3);return _0x210693[_0xd14b('0x28')](_0xd14b('0x29'),_0xa284fa+'-'+_0x3d4ee0+'/'+_0x20b119)['json'](_0x3c8a73);}return null;};}function patchUpdates(_0x35d593){return function(_0x246dc8){try{jsonpatch[_0xd14b('0x2a')](_0x246dc8,_0x35d593,!![]);}catch(_0x33810d){return BPromise[_0xd14b('0x2b')](_0x33810d);}return _0x246dc8[_0xd14b('0x2c')]();};}function saveUpdates(_0x38c448,_0x4ee475){return function(_0x5792a9){if(_0x5792a9){return _0x5792a9['update'](_0x38c448)['then'](function(_0x111cbd){return _0x111cbd;});}return null;};}function removeEntity(_0x211296,_0x2e7aeb){return function(_0x3315e7){if(_0x3315e7){return _0x3315e7[_0xd14b('0x2d')]()[_0xd14b('0x2e')](function(){var _0x3162f0=_0x3315e7[_0xd14b('0x2f')]({'plain':!![]});var _0x586e0a=_0xd14b('0x30');return db[_0xd14b('0x31')][_0xd14b('0x2d')]({'where':{'type':_0x586e0a,'resourceId':_0x3162f0['id']}})['then'](function(){return _0x3315e7;});})[_0xd14b('0x2e')](function(){_0x211296['status'](0xcc)[_0xd14b('0x21')]();});}};}function handleEntityNotFound(_0x595c3d,_0x5d9d3a){return function(_0x3b0a36){if(!_0x3b0a36){_0x595c3d['sendStatus'](0x194);}return _0x3b0a36;};}function handleError(_0x397714,_0x24e454){_0x24e454=_0x24e454||0x1f4;return function(_0x51f3bd){logger['error'](_0x51f3bd[_0xd14b('0x32')]);if(_0x51f3bd[_0xd14b('0x33')]){delete _0x51f3bd[_0xd14b('0x33')];}_0x397714[_0xd14b('0x22')](_0x24e454)[_0xd14b('0x34')](_0x51f3bd);};}exports['index']=function(_0x153e47,_0x3a4f52){var _0x35ca69={},_0x241022={},_0x2d4ebb={'count':0x0,'rows':[]};var _0x39bf64=_['map'](db['Dashboard'][_0xd14b('0x35')],function(_0x7a2bf8){return{'name':_0x7a2bf8[_0xd14b('0x36')],'type':_0x7a2bf8[_0xd14b('0x37')][_0xd14b('0x38')]};});_0x241022[_0xd14b('0x39')]=_[_0xd14b('0x3a')](_0x39bf64,'name');_0x241022['query']=_['keys'](_0x153e47[_0xd14b('0x3b')]);_0x241022['filters']=_[_0xd14b('0x3c')](_0x241022['model'],_0x241022[_0xd14b('0x3b')]);_0x35ca69[_0xd14b('0x3d')]=_[_0xd14b('0x3c')](_0x241022[_0xd14b('0x39')],qs[_0xd14b('0x3e')](_0x153e47[_0xd14b('0x3b')][_0xd14b('0x3e')]));_0x35ca69[_0xd14b('0x3d')]=_0x35ca69[_0xd14b('0x3d')][_0xd14b('0x3f')]?_0x35ca69[_0xd14b('0x3d')]:_0x241022[_0xd14b('0x39')];if(!_0x153e47['query'][_0xd14b('0x40')](_0xd14b('0x41'))){_0x35ca69[_0xd14b('0x27')]=qs['limit'](_0x153e47[_0xd14b('0x3b')]['limit']);_0x35ca69[_0xd14b('0x24')]=qs[_0xd14b('0x24')](_0x153e47['query'][_0xd14b('0x24')]);}_0x35ca69[_0xd14b('0x42')]=qs['sort'](_0x153e47[_0xd14b('0x3b')][_0xd14b('0x43')]);_0x35ca69[_0xd14b('0x44')]=qs[_0xd14b('0x45')](_[_0xd14b('0x46')](_0x153e47[_0xd14b('0x3b')],_0x241022[_0xd14b('0x45')]),_0x39bf64);if(_0x153e47[_0xd14b('0x3b')][_0xd14b('0x47')]){_0x35ca69[_0xd14b('0x44')]=_['merge'](_0x35ca69[_0xd14b('0x44')],{'$or':_[_0xd14b('0x3a')](_0x39bf64,function(_0x4eff56){if(_0x4eff56[_0xd14b('0x37')]!=='VIRTUAL'){var _0xfece82={};_0xfece82[_0x4eff56[_0xd14b('0x33')]]={'$like':'%'+_0x153e47['query'][_0xd14b('0x47')]+'%'};return _0xfece82;}})});}_0x35ca69=_[_0xd14b('0x48')]({},_0x35ca69,_0x153e47[_0xd14b('0x49')]);var _0x4c92ce={'where':_0x35ca69[_0xd14b('0x44')]};return db[_0xd14b('0x4a')][_0xd14b('0x26')](_0x4c92ce)[_0xd14b('0x2e')](function(_0x31f34b){_0x2d4ebb['count']=_0x31f34b;if(_0x153e47[_0xd14b('0x3b')][_0xd14b('0x4b')]){_0x35ca69[_0xd14b('0x4c')]=[{'all':!![]}];}return db[_0xd14b('0x4a')][_0xd14b('0x4d')](_0x35ca69);})[_0xd14b('0x2e')](function(_0xed9fd7){_0x2d4ebb[_0xd14b('0x4e')]=_0xed9fd7;return _0x2d4ebb;})['then'](respondWithFilteredResult(_0x3a4f52,_0x35ca69))[_0xd14b('0x4f')](handleError(_0x3a4f52,null));};exports['show']=function(_0x42a54c,_0x3bc410){var _0x240c12={'raw':![],'where':{'id':_0x42a54c[_0xd14b('0x50')]['id']}},_0x1a5e85={};_0x1a5e85[_0xd14b('0x39')]=_[_0xd14b('0x51')](db['Dashboard']['rawAttributes']);_0x1a5e85[_0xd14b('0x3b')]=_[_0xd14b('0x51')](_0x42a54c['query']);_0x1a5e85[_0xd14b('0x45')]=_['intersection'](_0x1a5e85[_0xd14b('0x39')],_0x1a5e85[_0xd14b('0x3b')]);_0x240c12[_0xd14b('0x3d')]=_[_0xd14b('0x3c')](_0x1a5e85[_0xd14b('0x39')],qs[_0xd14b('0x3e')](_0x42a54c[_0xd14b('0x3b')][_0xd14b('0x3e')]));_0x240c12[_0xd14b('0x3d')]=_0x240c12['attributes']['length']?_0x240c12['attributes']:_0x1a5e85[_0xd14b('0x39')];if(_0x42a54c[_0xd14b('0x3b')]['includeAll']){_0x240c12[_0xd14b('0x4c')]=[{'all':!![]}];}_0x240c12=_[_0xd14b('0x48')]({},_0x240c12,_0x42a54c[_0xd14b('0x49')]);return db[_0xd14b('0x4a')][_0xd14b('0x52')](_0x240c12)[_0xd14b('0x2e')](handleEntityNotFound(_0x3bc410,null))[_0xd14b('0x2e')](respondWithResult(_0x3bc410,null))[_0xd14b('0x4f')](handleError(_0x3bc410,null));};exports[_0xd14b('0x53')]=function(_0x5a76b8,_0x22a61e){return db[_0xd14b('0x4a')][_0xd14b('0x53')](_0x5a76b8['body'],{})['then'](function(_0x3724f4){var _0x1948df=_0x5a76b8[_0xd14b('0x54')]['get']({'plain':!![]});if(!_0x1948df)throw new Error(_0xd14b('0x55'));if(_0x1948df[_0xd14b('0x56')]===_0xd14b('0x54')){var _0x5a5b49=_0x3724f4[_0xd14b('0x2f')]({'plain':!![]});var _0xbbb4a4=_0xd14b('0x30');return db['UserProfileSection'][_0xd14b('0x52')]({'where':{'name':_0xbbb4a4,'userProfileId':_0x1948df[_0xd14b('0x57')]},'raw':!![]})[_0xd14b('0x2e')](function(_0x2dc542){if(_0x2dc542&&_0x2dc542[_0xd14b('0x58')]===0x0){return db['UserProfileResource']['create']({'name':_0x5a5b49[_0xd14b('0x33')],'resourceId':_0x5a5b49['id'],'type':_0x2dc542[_0xd14b('0x33')],'sectionId':_0x2dc542['id']},{})[_0xd14b('0x2e')](function(){return _0x3724f4;});}else{return _0x3724f4;}})[_0xd14b('0x4f')](function(_0x6181ef){logger[_0xd14b('0x59')](_0xd14b('0x5a'),_0x6181ef);throw _0x6181ef;});}return _0x3724f4;})['then'](respondWithResult(_0x22a61e,0xc9))[_0xd14b('0x4f')](handleError(_0x22a61e,null));};exports[_0xd14b('0x5b')]=function(_0x4d32f2,_0x190693){var _0x2fdced={'where':{'id':_0x4d32f2[_0xd14b('0x50')]['id']}},_0x39b05a={};_0x39b05a[_0xd14b('0x39')]=_[_0xd14b('0x51')](db[_0xd14b('0x4a')][_0xd14b('0x35')]);_0x2fdced[_0xd14b('0x3d')]=_[_0xd14b('0x3c')](_0x39b05a[_0xd14b('0x39')],qs[_0xd14b('0x3e')](_0x4d32f2[_0xd14b('0x3b')][_0xd14b('0x3e')]));_0x2fdced[_0xd14b('0x3d')]=_0x2fdced[_0xd14b('0x3d')][_0xd14b('0x3f')]?_0x2fdced[_0xd14b('0x3d')]:_0x39b05a[_0xd14b('0x39')];if(_0x4d32f2['query']['includeAll']){_0x2fdced[_0xd14b('0x4c')]=[{'all':!![]}];}_0x2fdced=_['merge']({},_0x2fdced,_0x4d32f2[_0xd14b('0x49')]);return db['Dashboard']['find'](_0x2fdced)[_0xd14b('0x2e')](handleEntityNotFound(_0x190693,null))[_0xd14b('0x2e')](function(_0x376c3a){if(_0x376c3a){var _0x24efb6=_0x376c3a[_0xd14b('0x2f')]({'plain':!![]});_0x24efb6=qs[_0xd14b('0x5c')](_0x24efb6,['id',_0xd14b('0x5d'),_0xd14b('0x5e')]);_0x4d32f2['body']=_[_0xd14b('0x5c')](_0x4d32f2[_0xd14b('0x5f')],['id',_0xd14b('0x5d'),_0xd14b('0x5e')]);return db[_0xd14b('0x4a')]['create'](_[_0xd14b('0x48')](_0x24efb6,_0x4d32f2[_0xd14b('0x5f')]),{'include':_0x4d32f2['query'][_0xd14b('0x4b')]?[{'all':!![]}]:undefined})[_0xd14b('0x2e')](function(_0x4b7710){var _0x425032=_0x4d32f2[_0xd14b('0x54')][_0xd14b('0x2f')]({'plain':!![]});if(!_0x425032)throw new Error(_0xd14b('0x55'));if(_0x425032[_0xd14b('0x56')]==='user'){var _0x5e4859=_0x4b7710[_0xd14b('0x2f')]({'plain':!![]});var _0x461935='CustomDashboards';return db[_0xd14b('0x60')][_0xd14b('0x52')]({'where':{'name':_0x461935,'userProfileId':_0x425032[_0xd14b('0x57')]},'raw':!![]})[_0xd14b('0x2e')](function(_0x295cff){if(_0x295cff&&_0x295cff[_0xd14b('0x58')]===0x0){return db['UserProfileResource'][_0xd14b('0x53')]({'name':_0x5e4859[_0xd14b('0x33')],'resourceId':_0x5e4859['id'],'type':_0x295cff['name'],'sectionId':_0x295cff['id']},{})[_0xd14b('0x2e')](function(){return _0x4b7710;});}else{return _0x4b7710;}})[_0xd14b('0x4f')](function(_0x17c557){logger['error'](_0xd14b('0x5a'),_0x17c557);throw _0x17c557;});}return _0x4b7710;});}})[_0xd14b('0x2e')](respondWithResult(_0x190693,0xc9))['catch'](handleError(_0x190693,null));};exports[_0xd14b('0x61')]=function(_0x110567,_0x51897b){if(_0x110567[_0xd14b('0x5f')]['id']){delete _0x110567['body']['id'];}return db[_0xd14b('0x4a')][_0xd14b('0x52')]({'where':{'id':_0x110567[_0xd14b('0x50')]['id']}})['then'](handleEntityNotFound(_0x51897b,null))['then'](saveUpdates(_0x110567[_0xd14b('0x5f')],null))[_0xd14b('0x2e')](respondWithResult(_0x51897b,null))[_0xd14b('0x4f')](handleError(_0x51897b,null));};exports[_0xd14b('0x2d')]=function(_0x14a9ca,_0x18c5bf){return db['Dashboard'][_0xd14b('0x52')]({'where':{'id':_0x14a9ca[_0xd14b('0x50')]['id']}})[_0xd14b('0x2e')](handleEntityNotFound(_0x18c5bf,null))[_0xd14b('0x2e')](removeEntity(_0x18c5bf,null))[_0xd14b('0x4f')](handleError(_0x18c5bf,null));};function widgetAttributes(_0x3a4b94){try{switch(_0x3a4b94['type']){case'iframe':return[{'name':_0xd14b('0x62'),'value':_0x3a4b94[_0xd14b('0x62')]||(_0x3a4b94[_0xd14b('0x63')]&&_0x3a4b94['attrs'][0x0]?_0x3a4b94[_0xd14b('0x63')][0x0][_0xd14b('0x64')]:undefined)||_0xd14b('0x65')}];case _0xd14b('0x66'):return[{'name':_0xd14b('0x67'),'value':_0x3a4b94['attrPath']||(_0x3a4b94[_0xd14b('0x63')]&&_0x3a4b94['attrs'][0x0]?_0x3a4b94[_0xd14b('0x63')][0x0][_0xd14b('0x64')]:undefined)||''}];case _0xd14b('0x68'):return[{'name':_0xd14b('0x69'),'value':_0x3a4b94[_0xd14b('0x69')]||(_0x3a4b94[_0xd14b('0x63')]&&_0x3a4b94[_0xd14b('0x63')][0x0]?_0x3a4b94['attrs'][0x0][_0xd14b('0x64')]:undefined)||_0xd14b('0x6a')},{'name':_0xd14b('0x6b'),'value':_0x3a4b94['attrTimezone']||(_0x3a4b94[_0xd14b('0x63')]&&_0x3a4b94[_0xd14b('0x63')][0x1]?_0x3a4b94[_0xd14b('0x63')][0x1][_0xd14b('0x64')]:undefined)||'0.00'},{'name':_0xd14b('0x6c'),'value':_0x3a4b94[_0xd14b('0x6c')]||(_0x3a4b94[_0xd14b('0x63')]&&_0x3a4b94[_0xd14b('0x63')][0x2]?_0x3a4b94[_0xd14b('0x63')][0x2][_0xd14b('0x64')]:undefined)||0xc}];case _0xd14b('0x6d'):return[{'name':'attrMetric','value':_0x3a4b94[_0xd14b('0x6e')]||(_0x3a4b94[_0xd14b('0x63')]&&_0x3a4b94['attrs'][0x0]?_0x3a4b94[_0xd14b('0x63')][0x0][_0xd14b('0x64')]:undefined)||'total'},{'name':_0xd14b('0x6f'),'value':_0x3a4b94[_0xd14b('0x6f')]||(_0x3a4b94[_0xd14b('0x63')]&&_0x3a4b94[_0xd14b('0x63')][0x1]?_0x3a4b94[_0xd14b('0x63')][0x1][_0xd14b('0x64')]:undefined)||[]},{'name':_0xd14b('0x6c'),'value':_0x3a4b94['attrFontSize']||(_0x3a4b94['attrs']&&_0x3a4b94[_0xd14b('0x63')][0x2]?_0x3a4b94[_0xd14b('0x63')][0x2][_0xd14b('0x64')]:undefined)||0x14}];case _0xd14b('0x70'):case'pie-chart':return[{'name':_0xd14b('0x71'),'value':_0x3a4b94[_0xd14b('0x71')]||(_0x3a4b94['attrs']&&_0x3a4b94[_0xd14b('0x63')][0x0]?_0x3a4b94['attrs'][0x0][_0xd14b('0x64')]:undefined)||_0xd14b('0x72')},{'name':'attrSerie2','value':_0x3a4b94[_0xd14b('0x73')]||(_0x3a4b94[_0xd14b('0x63')]&&_0x3a4b94[_0xd14b('0x63')][0x1]?_0x3a4b94[_0xd14b('0x63')][0x1][_0xd14b('0x64')]:undefined)||null},{'name':_0xd14b('0x74'),'value':_0x3a4b94[_0xd14b('0x74')]||(_0x3a4b94[_0xd14b('0x63')]&&_0x3a4b94[_0xd14b('0x63')][0x2]?_0x3a4b94['attrs'][0x2][_0xd14b('0x64')]:undefined)||null},{'name':_0xd14b('0x6f'),'value':_0x3a4b94[_0xd14b('0x6f')]||(_0x3a4b94[_0xd14b('0x63')]&&_0x3a4b94[_0xd14b('0x63')][0x3]?_0x3a4b94[_0xd14b('0x63')][0x3][_0xd14b('0x64')]:undefined)||[]}];case _0xd14b('0x75'):return[{'name':_0xd14b('0x76'),'type':_0x3a4b94[_0xd14b('0x77')]||(_0x3a4b94[_0xd14b('0x63')]&&_0x3a4b94[_0xd14b('0x63')][0x0]?_0x3a4b94[_0xd14b('0x63')][0x0][_0xd14b('0x37')]:undefined)||null,'value':_0x3a4b94[_0xd14b('0x76')]||(_0x3a4b94[_0xd14b('0x63')]&&_0x3a4b94[_0xd14b('0x63')][0x0]?_0x3a4b94['attrs'][0x0]['value']:undefined)||null},{'name':_0xd14b('0x78'),'value':_0x3a4b94[_0xd14b('0x78')]||(_0x3a4b94['attrs']&&_0x3a4b94[_0xd14b('0x63')][0x1]?_0x3a4b94[_0xd14b('0x63')][0x1][_0xd14b('0x64')]:undefined)||0x0}];default:return[];}}catch(_0x28b9a1){logger[_0xd14b('0x59')](_0xd14b('0x79'),JSON[_0xd14b('0x7a')](_0x28b9a1));return[];}}exports['addItem']=function(_0x3abdc7,_0x328a93,_0x43d897){if(_0x3abdc7[_0xd14b('0x5f')]['id']){delete _0x3abdc7['body']['id'];}return db[_0xd14b('0x4a')][_0xd14b('0x52')]({'where':{'id':_0x3abdc7[_0xd14b('0x50')]['id']}})[_0xd14b('0x2e')](handleEntityNotFound(_0x328a93,null))[_0xd14b('0x2e')](function(_0x37aac0){if(_0x37aac0){_0x3abdc7[_0xd14b('0x5f')][_0xd14b('0x7b')]=_0x37aac0['id'];_0x3abdc7[_0xd14b('0x5f')][_0xd14b('0x63')]=widgetAttributes(_0x3abdc7['body']);return db[_0xd14b('0x7c')][_0xd14b('0x53')](_0x3abdc7[_0xd14b('0x5f')]);}})['then'](respondWithResult(_0x328a93,null))[_0xd14b('0x4f')](handleError(_0x328a93,null));};exports[_0xd14b('0x7d')]=function(_0x559ba3,_0x2bfba7,_0x37d3cc){var _0x12f49a={};var _0x20651b={};var _0x4953b1;var _0x328640;return db['Dashboard'][_0xd14b('0x7e')]({'where':{'id':_0x559ba3[_0xd14b('0x50')]['id']}})[_0xd14b('0x2e')](handleEntityNotFound(_0x2bfba7,null))[_0xd14b('0x2e')](function(_0x149e31){if(_0x149e31){_0x4953b1=_0x149e31;_0x20651b[_0xd14b('0x39')]=_[_0xd14b('0x51')](db[_0xd14b('0x7c')][_0xd14b('0x35')]);_0x20651b['query']=_[_0xd14b('0x51')](_0x559ba3['query']);_0x20651b['filters']=_[_0xd14b('0x3c')](_0x20651b[_0xd14b('0x39')],_0x20651b['query']);_0x12f49a[_0xd14b('0x3d')]=_[_0xd14b('0x3c')](_0x20651b[_0xd14b('0x39')],qs[_0xd14b('0x3e')](_0x559ba3[_0xd14b('0x3b')][_0xd14b('0x3e')]));_0x12f49a[_0xd14b('0x3d')]=_0x12f49a['attributes'][_0xd14b('0x3f')]?_0x12f49a[_0xd14b('0x3d')]:_0x20651b[_0xd14b('0x39')];_0x12f49a[_0xd14b('0x42')]=qs[_0xd14b('0x43')](_0x559ba3[_0xd14b('0x3b')]['sort']);_0x12f49a[_0xd14b('0x44')]=qs[_0xd14b('0x45')](_[_0xd14b('0x46')](_0x559ba3[_0xd14b('0x3b')],_0x20651b[_0xd14b('0x45')]));if(_0x559ba3[_0xd14b('0x3b')]['filter']){_0x12f49a[_0xd14b('0x44')]=_['merge'](_0x12f49a[_0xd14b('0x44')],{'$or':_[_0xd14b('0x3a')](_0x12f49a['attributes'],function(_0x6dcbb5){var _0x499844={};_0x499844[_0x6dcbb5]={'$like':'%'+_0x559ba3[_0xd14b('0x3b')][_0xd14b('0x47')]+'%'};return _0x499844;})});}_0x12f49a=_[_0xd14b('0x48')]({},_0x12f49a,_0x559ba3[_0xd14b('0x49')]);return _0x4953b1['getItems'](_0x12f49a);}})[_0xd14b('0x2e')](function(_0x2af757){if(_0x2af757){_0x328640=_0x2af757[_0xd14b('0x3f')];if(!_0x559ba3[_0xd14b('0x3b')]['hasOwnProperty'](_0xd14b('0x41'))){_0x12f49a['limit']=qs[_0xd14b('0x27')](_0x559ba3[_0xd14b('0x3b')][_0xd14b('0x27')]);_0x12f49a[_0xd14b('0x24')]=qs[_0xd14b('0x24')](_0x559ba3[_0xd14b('0x3b')]['offset']);}return _0x4953b1[_0xd14b('0x7d')](_0x12f49a);}})[_0xd14b('0x2e')](function(_0x6dd4b4){if(_0x6dd4b4){return _0x6dd4b4?{'count':_0x328640,'rows':_0x6dd4b4}:null;}})['then'](respondWithResult(_0x2bfba7,null))[_0xd14b('0x4f')](handleError(_0x2bfba7,null));}; \ No newline at end of file +var _0x7963=['eml-format','rimraf','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./dashboard.socket','sendStatus','status','undefined','limit','offset','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','end','error','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','order','sort','pick','filter','where','merge','options','includeAll','findAll','catch','show','include','create','body','user','role','CustomDashboards','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','find','omit','createdAt','updatedAt','UserProfileResource','iframe','attrUrl','attrs','value','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','stringify','DashboardId','DashboardItem','getItems','hasOwnProperty','nolimit'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7963,0x16e));var _0x3796=function(_0x19a49f,_0x444d74){_0x19a49f=_0x19a49f-0x0;var _0x5351ae=_0x7963[_0x19a49f];return _0x5351ae;};'use strict';var emlformat=require(_0x3796('0x0'));var rimraf=require(_0x3796('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3796('0x2'));var moment=require('moment');var BPromise=require(_0x3796('0x3'));var Mustache=require('mustache');var util=require(_0x3796('0x4'));var path=require(_0x3796('0x5'));var sox=require(_0x3796('0x6'));var csv=require(_0x3796('0x7'));var ejs=require(_0x3796('0x8'));var fs=require('fs');var fs_extra=require(_0x3796('0x9'));var _=require(_0x3796('0xa'));var squel=require(_0x3796('0xb'));var crypto=require(_0x3796('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3796('0xd'));var toCsv=require(_0x3796('0x7'));var querystring=require(_0x3796('0xe'));var Papa=require(_0x3796('0xf'));var Redis=require(_0x3796('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3796('0x11'));var as=require(_0x3796('0x12'));var hardwareService=require(_0x3796('0x13'));var logger=require(_0x3796('0x14'))(_0x3796('0x15'));var utils=require(_0x3796('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x3796('0x17'));var db=require(_0x3796('0x18'))['db'];config[_0x3796('0x19')]=_[_0x3796('0x1a')](config['redis'],{'host':_0x3796('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3796('0x19')]));require(_0x3796('0x1c'))['register'](socket);function respondWithStatusCode(_0x2381dc,_0x3a6aeb){_0x3a6aeb=_0x3a6aeb||0xcc;return function(_0x345d02){if(_0x345d02){return _0x2381dc[_0x3796('0x1d')](_0x3a6aeb);}return _0x2381dc['status'](_0x3a6aeb)['end']();};}function respondWithResult(_0xc39772,_0x5fe2ab){_0x5fe2ab=_0x5fe2ab||0xc8;return function(_0x5d4131){if(_0x5d4131){return _0xc39772[_0x3796('0x1e')](_0x5fe2ab)['json'](_0x5d4131);}};}function respondWithFilteredResult(_0x267e3e,_0x49f139){return function(_0x3aa884){if(_0x3aa884){var _0x53bb2a=typeof _0x49f139['offset']===_0x3796('0x1f')&&typeof _0x49f139[_0x3796('0x20')]==='undefined';var _0x9894b0=_0x3aa884['count'];var _0x378eba=_0x53bb2a?0x0:_0x49f139[_0x3796('0x21')];var _0x53209c=_0x53bb2a?_0x3aa884[_0x3796('0x22')]:_0x49f139['offset']+_0x49f139[_0x3796('0x20')];var _0x5cd491;if(_0x53209c>=_0x9894b0){_0x53209c=_0x9894b0;_0x5cd491=0xc8;}else{_0x5cd491=0xce;}_0x267e3e['status'](_0x5cd491);return _0x267e3e[_0x3796('0x23')](_0x3796('0x24'),_0x378eba+'-'+_0x53209c+'/'+_0x9894b0)[_0x3796('0x25')](_0x3aa884);}return null;};}function patchUpdates(_0x4c9194){return function(_0x13b17c){try{jsonpatch[_0x3796('0x26')](_0x13b17c,_0x4c9194,!![]);}catch(_0x2a7923){return BPromise[_0x3796('0x27')](_0x2a7923);}return _0x13b17c[_0x3796('0x28')]();};}function saveUpdates(_0x57163c,_0x4dc53d){return function(_0xb933fa){if(_0xb933fa){return _0xb933fa[_0x3796('0x29')](_0x57163c)[_0x3796('0x2a')](function(_0x2cd1ff){return _0x2cd1ff;});}return null;};}function removeEntity(_0x58b6e1,_0x310828){return function(_0x1664e5){if(_0x1664e5){return _0x1664e5[_0x3796('0x2b')]()[_0x3796('0x2a')](function(){var _0x3a6072=_0x1664e5[_0x3796('0x2c')]({'plain':!![]});var _0x32289c='CustomDashboards';return db['UserProfileResource'][_0x3796('0x2b')]({'where':{'type':_0x32289c,'resourceId':_0x3a6072['id']}})[_0x3796('0x2a')](function(){return _0x1664e5;});})[_0x3796('0x2a')](function(){_0x58b6e1[_0x3796('0x1e')](0xcc)[_0x3796('0x2d')]();});}};}function handleEntityNotFound(_0x2c54a1,_0x1aa4f3){return function(_0x4dfe73){if(!_0x4dfe73){_0x2c54a1[_0x3796('0x1d')](0x194);}return _0x4dfe73;};}function handleError(_0x2eb360,_0x2c660c){_0x2c660c=_0x2c660c||0x1f4;return function(_0x37ba2f){logger[_0x3796('0x2e')](_0x37ba2f[_0x3796('0x2f')]);if(_0x37ba2f[_0x3796('0x30')]){delete _0x37ba2f['name'];}_0x2eb360['status'](_0x2c660c)[_0x3796('0x31')](_0x37ba2f);};}exports[_0x3796('0x32')]=function(_0x506df2,_0x92d377){var _0xb018f1={},_0x5b17da={},_0x13148d={'count':0x0,'rows':[]};var _0x16b034=_[_0x3796('0x33')](db[_0x3796('0x34')][_0x3796('0x35')],function(_0x368090){return{'name':_0x368090[_0x3796('0x36')],'type':_0x368090[_0x3796('0x37')][_0x3796('0x38')]};});_0x5b17da['model']=_[_0x3796('0x33')](_0x16b034,_0x3796('0x30'));_0x5b17da[_0x3796('0x39')]=_[_0x3796('0x3a')](_0x506df2[_0x3796('0x39')]);_0x5b17da[_0x3796('0x3b')]=_[_0x3796('0x3c')](_0x5b17da['model'],_0x5b17da[_0x3796('0x39')]);_0xb018f1[_0x3796('0x3d')]=_[_0x3796('0x3c')](_0x5b17da[_0x3796('0x3e')],qs[_0x3796('0x3f')](_0x506df2['query'][_0x3796('0x3f')]));_0xb018f1[_0x3796('0x3d')]=_0xb018f1[_0x3796('0x3d')][_0x3796('0x40')]?_0xb018f1[_0x3796('0x3d')]:_0x5b17da[_0x3796('0x3e')];if(!_0x506df2['query']['hasOwnProperty']('nolimit')){_0xb018f1[_0x3796('0x20')]=qs[_0x3796('0x20')](_0x506df2['query'][_0x3796('0x20')]);_0xb018f1[_0x3796('0x21')]=qs['offset'](_0x506df2['query'][_0x3796('0x21')]);}_0xb018f1[_0x3796('0x41')]=qs[_0x3796('0x42')](_0x506df2['query'][_0x3796('0x42')]);_0xb018f1['where']=qs[_0x3796('0x3b')](_[_0x3796('0x43')](_0x506df2['query'],_0x5b17da[_0x3796('0x3b')]),_0x16b034);if(_0x506df2['query'][_0x3796('0x44')]){_0xb018f1[_0x3796('0x45')]=_[_0x3796('0x46')](_0xb018f1['where'],{'$or':_[_0x3796('0x33')](_0x16b034,function(_0x216420){if(_0x216420[_0x3796('0x37')]!=='VIRTUAL'){var _0x465658={};_0x465658[_0x216420[_0x3796('0x30')]]={'$like':'%'+_0x506df2[_0x3796('0x39')][_0x3796('0x44')]+'%'};return _0x465658;}})});}_0xb018f1=_[_0x3796('0x46')]({},_0xb018f1,_0x506df2[_0x3796('0x47')]);var _0x489615={'where':_0xb018f1['where']};return db[_0x3796('0x34')]['count'](_0x489615)[_0x3796('0x2a')](function(_0xcb6b77){_0x13148d[_0x3796('0x22')]=_0xcb6b77;if(_0x506df2['query'][_0x3796('0x48')]){_0xb018f1['include']=[{'all':!![]}];}return db[_0x3796('0x34')][_0x3796('0x49')](_0xb018f1);})['then'](function(_0x1c2190){_0x13148d['rows']=_0x1c2190;return _0x13148d;})[_0x3796('0x2a')](respondWithFilteredResult(_0x92d377,_0xb018f1))[_0x3796('0x4a')](handleError(_0x92d377,null));};exports[_0x3796('0x4b')]=function(_0x243e97,_0x436ca0){var _0x476271={'raw':![],'where':{'id':_0x243e97['params']['id']}},_0x140366={};_0x140366[_0x3796('0x3e')]=_['keys'](db[_0x3796('0x34')][_0x3796('0x35')]);_0x140366['query']=_['keys'](_0x243e97[_0x3796('0x39')]);_0x140366[_0x3796('0x3b')]=_['intersection'](_0x140366[_0x3796('0x3e')],_0x140366[_0x3796('0x39')]);_0x476271['attributes']=_[_0x3796('0x3c')](_0x140366[_0x3796('0x3e')],qs[_0x3796('0x3f')](_0x243e97[_0x3796('0x39')][_0x3796('0x3f')]));_0x476271[_0x3796('0x3d')]=_0x476271[_0x3796('0x3d')][_0x3796('0x40')]?_0x476271[_0x3796('0x3d')]:_0x140366[_0x3796('0x3e')];if(_0x243e97[_0x3796('0x39')][_0x3796('0x48')]){_0x476271[_0x3796('0x4c')]=[{'all':!![]}];}_0x476271=_[_0x3796('0x46')]({},_0x476271,_0x243e97[_0x3796('0x47')]);return db['Dashboard']['find'](_0x476271)[_0x3796('0x2a')](handleEntityNotFound(_0x436ca0,null))[_0x3796('0x2a')](respondWithResult(_0x436ca0,null))['catch'](handleError(_0x436ca0,null));};exports[_0x3796('0x4d')]=function(_0x17494b,_0x391515){return db[_0x3796('0x34')]['create'](_0x17494b[_0x3796('0x4e')],{})[_0x3796('0x2a')](function(_0x275604){var _0x232452=_0x17494b[_0x3796('0x4f')][_0x3796('0x2c')]({'plain':!![]});if(!_0x232452)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x232452[_0x3796('0x50')]===_0x3796('0x4f')){var _0x2f80c6=_0x275604[_0x3796('0x2c')]({'plain':!![]});var _0x1f40a7=_0x3796('0x51');return db[_0x3796('0x52')]['find']({'where':{'name':_0x1f40a7,'userProfileId':_0x232452[_0x3796('0x53')]},'raw':!![]})[_0x3796('0x2a')](function(_0x4fc39c){if(_0x4fc39c&&_0x4fc39c[_0x3796('0x54')]===0x0){return db['UserProfileResource'][_0x3796('0x4d')]({'name':_0x2f80c6[_0x3796('0x30')],'resourceId':_0x2f80c6['id'],'type':_0x4fc39c[_0x3796('0x30')],'sectionId':_0x4fc39c['id']},{})[_0x3796('0x2a')](function(){return _0x275604;});}else{return _0x275604;}})['catch'](function(_0x405072){logger[_0x3796('0x2e')](_0x3796('0x55'),_0x405072);throw _0x405072;});}return _0x275604;})[_0x3796('0x2a')](respondWithResult(_0x391515,0xc9))['catch'](handleError(_0x391515,null));};exports[_0x3796('0x56')]=function(_0x1c9c83,_0x5539d9){var _0xfabea3={'where':{'id':_0x1c9c83[_0x3796('0x57')]['id']}},_0x530dee={};_0x530dee[_0x3796('0x3e')]=_[_0x3796('0x3a')](db[_0x3796('0x34')][_0x3796('0x35')]);_0xfabea3[_0x3796('0x3d')]=_[_0x3796('0x3c')](_0x530dee[_0x3796('0x3e')],qs[_0x3796('0x3f')](_0x1c9c83[_0x3796('0x39')]['fields']));_0xfabea3[_0x3796('0x3d')]=_0xfabea3[_0x3796('0x3d')][_0x3796('0x40')]?_0xfabea3[_0x3796('0x3d')]:_0x530dee[_0x3796('0x3e')];if(_0x1c9c83['query']['includeAll']){_0xfabea3['include']=[{'all':!![]}];}_0xfabea3=_['merge']({},_0xfabea3,_0x1c9c83['options']);return db[_0x3796('0x34')][_0x3796('0x58')](_0xfabea3)['then'](handleEntityNotFound(_0x5539d9,null))[_0x3796('0x2a')](function(_0x5ac90b){if(_0x5ac90b){var _0x488dae=_0x5ac90b[_0x3796('0x2c')]({'plain':!![]});_0x488dae=qs[_0x3796('0x59')](_0x488dae,['id',_0x3796('0x5a'),_0x3796('0x5b')]);_0x1c9c83[_0x3796('0x4e')]=_[_0x3796('0x59')](_0x1c9c83[_0x3796('0x4e')],['id',_0x3796('0x5a'),_0x3796('0x5b')]);return db[_0x3796('0x34')][_0x3796('0x4d')](_['merge'](_0x488dae,_0x1c9c83['body']),{'include':_0x1c9c83[_0x3796('0x39')][_0x3796('0x48')]?[{'all':!![]}]:undefined})['then'](function(_0x418250){var _0x1f780c=_0x1c9c83[_0x3796('0x4f')]['get']({'plain':!![]});if(!_0x1f780c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1f780c['role']===_0x3796('0x4f')){var _0x1a1d4e=_0x418250[_0x3796('0x2c')]({'plain':!![]});var _0x6d5d0c='CustomDashboards';return db[_0x3796('0x52')][_0x3796('0x58')]({'where':{'name':_0x6d5d0c,'userProfileId':_0x1f780c['userProfileId']},'raw':!![]})[_0x3796('0x2a')](function(_0x4a5ed0){if(_0x4a5ed0&&_0x4a5ed0['autoAssociation']===0x0){return db[_0x3796('0x5c')][_0x3796('0x4d')]({'name':_0x1a1d4e[_0x3796('0x30')],'resourceId':_0x1a1d4e['id'],'type':_0x4a5ed0[_0x3796('0x30')],'sectionId':_0x4a5ed0['id']},{})[_0x3796('0x2a')](function(){return _0x418250;});}else{return _0x418250;}})['catch'](function(_0x1c842d){logger['error'](_0x3796('0x55'),_0x1c842d);throw _0x1c842d;});}return _0x418250;});}})[_0x3796('0x2a')](respondWithResult(_0x5539d9,0xc9))[_0x3796('0x4a')](handleError(_0x5539d9,null));};exports[_0x3796('0x29')]=function(_0x22356d,_0x5d0ffb){if(_0x22356d[_0x3796('0x4e')]['id']){delete _0x22356d[_0x3796('0x4e')]['id'];}return db[_0x3796('0x34')]['find']({'where':{'id':_0x22356d[_0x3796('0x57')]['id']}})[_0x3796('0x2a')](handleEntityNotFound(_0x5d0ffb,null))['then'](saveUpdates(_0x22356d[_0x3796('0x4e')],null))[_0x3796('0x2a')](respondWithResult(_0x5d0ffb,null))[_0x3796('0x4a')](handleError(_0x5d0ffb,null));};exports[_0x3796('0x2b')]=function(_0x16b512,_0x18f48f){return db[_0x3796('0x34')][_0x3796('0x58')]({'where':{'id':_0x16b512[_0x3796('0x57')]['id']}})['then'](handleEntityNotFound(_0x18f48f,null))['then'](removeEntity(_0x18f48f,null))[_0x3796('0x4a')](handleError(_0x18f48f,null));};function widgetAttributes(_0x4f2634){try{switch(_0x4f2634['type']){case _0x3796('0x5d'):return[{'name':_0x3796('0x5e'),'value':_0x4f2634['attrUrl']||(_0x4f2634[_0x3796('0x5f')]&&_0x4f2634[_0x3796('0x5f')][0x0]?_0x4f2634[_0x3796('0x5f')][0x0][_0x3796('0x60')]:undefined)||'https://'}];case'custom':return[{'name':_0x3796('0x61'),'value':_0x4f2634[_0x3796('0x61')]||(_0x4f2634[_0x3796('0x5f')]&&_0x4f2634[_0x3796('0x5f')][0x0]?_0x4f2634[_0x3796('0x5f')][0x0][_0x3796('0x60')]:undefined)||''}];case _0x3796('0x62'):return[{'name':_0x3796('0x63'),'value':_0x4f2634[_0x3796('0x63')]||(_0x4f2634[_0x3796('0x5f')]&&_0x4f2634[_0x3796('0x5f')][0x0]?_0x4f2634[_0x3796('0x5f')][0x0][_0x3796('0x60')]:undefined)||_0x3796('0x64')},{'name':_0x3796('0x65'),'value':_0x4f2634['attrTimezone']||(_0x4f2634['attrs']&&_0x4f2634['attrs'][0x1]?_0x4f2634['attrs'][0x1][_0x3796('0x60')]:undefined)||_0x3796('0x66')},{'name':_0x3796('0x67'),'value':_0x4f2634['attrFontSize']||(_0x4f2634[_0x3796('0x5f')]&&_0x4f2634[_0x3796('0x5f')][0x2]?_0x4f2634[_0x3796('0x5f')][0x2][_0x3796('0x60')]:undefined)||0xc}];case'counter':return[{'name':_0x3796('0x68'),'value':_0x4f2634[_0x3796('0x68')]||(_0x4f2634[_0x3796('0x5f')]&&_0x4f2634[_0x3796('0x5f')][0x0]?_0x4f2634[_0x3796('0x5f')][0x0][_0x3796('0x60')]:undefined)||_0x3796('0x69')},{'name':_0x3796('0x6a'),'value':_0x4f2634[_0x3796('0x6a')]||(_0x4f2634[_0x3796('0x5f')]&&_0x4f2634[_0x3796('0x5f')][0x1]?_0x4f2634[_0x3796('0x5f')][0x1][_0x3796('0x60')]:undefined)||[]},{'name':_0x3796('0x67'),'value':_0x4f2634[_0x3796('0x67')]||(_0x4f2634[_0x3796('0x5f')]&&_0x4f2634[_0x3796('0x5f')][0x2]?_0x4f2634[_0x3796('0x5f')][0x2][_0x3796('0x60')]:undefined)||0x14}];case _0x3796('0x6b'):case _0x3796('0x6c'):return[{'name':_0x3796('0x6d'),'value':_0x4f2634[_0x3796('0x6d')]||(_0x4f2634['attrs']&&_0x4f2634[_0x3796('0x5f')][0x0]?_0x4f2634[_0x3796('0x5f')][0x0]['value']:undefined)||_0x3796('0x69')},{'name':_0x3796('0x6e'),'value':_0x4f2634[_0x3796('0x6e')]||(_0x4f2634['attrs']&&_0x4f2634[_0x3796('0x5f')][0x1]?_0x4f2634[_0x3796('0x5f')][0x1][_0x3796('0x60')]:undefined)||null},{'name':_0x3796('0x6f'),'value':_0x4f2634['attrSerie3']||(_0x4f2634[_0x3796('0x5f')]&&_0x4f2634['attrs'][0x2]?_0x4f2634[_0x3796('0x5f')][0x2]['value']:undefined)||null},{'name':_0x3796('0x6a'),'value':_0x4f2634['attrVoiceQueues']||(_0x4f2634[_0x3796('0x5f')]&&_0x4f2634[_0x3796('0x5f')][0x3]?_0x4f2634[_0x3796('0x5f')][0x3][_0x3796('0x60')]:undefined)||[]}];case _0x3796('0x70'):return[{'name':_0x3796('0x71'),'type':_0x4f2634[_0x3796('0x72')]||(_0x4f2634['attrs']&&_0x4f2634['attrs'][0x0]?_0x4f2634[_0x3796('0x5f')][0x0]['type']:undefined)||null,'value':_0x4f2634[_0x3796('0x71')]||(_0x4f2634[_0x3796('0x5f')]&&_0x4f2634[_0x3796('0x5f')][0x0]?_0x4f2634[_0x3796('0x5f')][0x0][_0x3796('0x60')]:undefined)||null},{'name':_0x3796('0x73'),'value':_0x4f2634['attrRefresh']||(_0x4f2634[_0x3796('0x5f')]&&_0x4f2634[_0x3796('0x5f')][0x1]?_0x4f2634[_0x3796('0x5f')][0x1][_0x3796('0x60')]:undefined)||0x0}];default:return[];}}catch(_0x4d14a0){logger[_0x3796('0x2e')]('widgetAttributes:\x20%s',JSON[_0x3796('0x74')](_0x4d14a0));return[];}}exports['addItem']=function(_0x5d8474,_0x2dbbf3,_0x5c9483){if(_0x5d8474[_0x3796('0x4e')]['id']){delete _0x5d8474['body']['id'];}return db[_0x3796('0x34')]['find']({'where':{'id':_0x5d8474[_0x3796('0x57')]['id']}})[_0x3796('0x2a')](handleEntityNotFound(_0x2dbbf3,null))['then'](function(_0x4f3f8c){if(_0x4f3f8c){_0x5d8474['body'][_0x3796('0x75')]=_0x4f3f8c['id'];_0x5d8474[_0x3796('0x4e')]['attrs']=widgetAttributes(_0x5d8474[_0x3796('0x4e')]);return db[_0x3796('0x76')]['create'](_0x5d8474['body']);}})['then'](respondWithResult(_0x2dbbf3,null))[_0x3796('0x4a')](handleError(_0x2dbbf3,null));};exports[_0x3796('0x77')]=function(_0x30cd0f,_0x6cbfed,_0x1190b4){var _0x3a0720={};var _0x4825f0={};var _0x673e87;var _0x12889d;return db[_0x3796('0x34')]['findOne']({'where':{'id':_0x30cd0f[_0x3796('0x57')]['id']}})[_0x3796('0x2a')](handleEntityNotFound(_0x6cbfed,null))[_0x3796('0x2a')](function(_0xdfe1d4){if(_0xdfe1d4){_0x673e87=_0xdfe1d4;_0x4825f0['model']=_[_0x3796('0x3a')](db[_0x3796('0x76')][_0x3796('0x35')]);_0x4825f0[_0x3796('0x39')]=_[_0x3796('0x3a')](_0x30cd0f[_0x3796('0x39')]);_0x4825f0[_0x3796('0x3b')]=_[_0x3796('0x3c')](_0x4825f0[_0x3796('0x3e')],_0x4825f0['query']);_0x3a0720['attributes']=_[_0x3796('0x3c')](_0x4825f0[_0x3796('0x3e')],qs['fields'](_0x30cd0f[_0x3796('0x39')]['fields']));_0x3a0720[_0x3796('0x3d')]=_0x3a0720['attributes'][_0x3796('0x40')]?_0x3a0720[_0x3796('0x3d')]:_0x4825f0[_0x3796('0x3e')];_0x3a0720[_0x3796('0x41')]=qs['sort'](_0x30cd0f['query'][_0x3796('0x42')]);_0x3a0720[_0x3796('0x45')]=qs['filters'](_[_0x3796('0x43')](_0x30cd0f[_0x3796('0x39')],_0x4825f0[_0x3796('0x3b')]));if(_0x30cd0f['query'][_0x3796('0x44')]){_0x3a0720[_0x3796('0x45')]=_['merge'](_0x3a0720[_0x3796('0x45')],{'$or':_[_0x3796('0x33')](_0x3a0720[_0x3796('0x3d')],function(_0x3568fc){var _0x1f04f9={};_0x1f04f9[_0x3568fc]={'$like':'%'+_0x30cd0f['query'][_0x3796('0x44')]+'%'};return _0x1f04f9;})});}_0x3a0720=_[_0x3796('0x46')]({},_0x3a0720,_0x30cd0f['options']);return _0x673e87[_0x3796('0x77')](_0x3a0720);}})['then'](function(_0x307b65){if(_0x307b65){_0x12889d=_0x307b65['length'];if(!_0x30cd0f[_0x3796('0x39')][_0x3796('0x78')](_0x3796('0x79'))){_0x3a0720[_0x3796('0x20')]=qs[_0x3796('0x20')](_0x30cd0f[_0x3796('0x39')][_0x3796('0x20')]);_0x3a0720[_0x3796('0x21')]=qs[_0x3796('0x21')](_0x30cd0f[_0x3796('0x39')][_0x3796('0x21')]);}return _0x673e87[_0x3796('0x77')](_0x3a0720);}})[_0x3796('0x2a')](function(_0xa6cf7a){if(_0xa6cf7a){return _0xa6cf7a?{'count':_0x12889d,'rows':_0xa6cf7a}:null;}})[_0x3796('0x2a')](respondWithResult(_0x6cbfed,null))[_0x3796('0x4a')](handleError(_0x6cbfed,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index dfd2f56..4492269 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 _0xff4f=['Dashboard','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xff4f,0x156));var _0xfff4=function(_0x625462,_0x323140){_0x625462=_0x625462-0x0;var _0x4ea399=_0xff4f[_0x625462];return _0x4ea399;};'use strict';var EventEmitter=require(_0xfff4('0x0'));var Dashboard=require(_0xfff4('0x1'))['db'][_0xfff4('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xfff4('0x3'),'afterDestroy':_0xfff4('0x4')};function emitEvent(_0x11b5e1){return function(_0x4ab645,_0x3c2b7b,_0x2fe17c){DashboardEvents[_0xfff4('0x5')](_0x11b5e1+':'+_0x4ab645['id'],_0x4ab645);DashboardEvents[_0xfff4('0x5')](_0x11b5e1,_0x4ab645);_0x2fe17c(null);};}for(var e in events){if(events[_0xfff4('0x6')](e)){var event=events[e];Dashboard[_0xfff4('0x7')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0x2bbc=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','Dashboard','setMaxListeners','update'];(function(_0x56039b,_0x3de8d8){var _0xc90792=function(_0x300c35){while(--_0x300c35){_0x56039b['push'](_0x56039b['shift']());}};_0xc90792(++_0x3de8d8);}(_0x2bbc,0x1ea));var _0xc2bb=function(_0x25c314,_0x4b0b63){_0x25c314=_0x25c314-0x0;var _0x4d335d=_0x2bbc[_0x25c314];return _0x4d335d;};'use strict';var EventEmitter=require(_0xc2bb('0x0'));var Dashboard=require(_0xc2bb('0x1'))['db'][_0xc2bb('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xc2bb('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc2bb('0x4'),'afterDestroy':_0xc2bb('0x5')};function emitEvent(_0x2b170c){return function(_0x407c7c,_0xe5ffb0,_0x3f9e2d){DashboardEvents['emit'](_0x2b170c+':'+_0x407c7c['id'],_0x407c7c);DashboardEvents[_0xc2bb('0x6')](_0x2b170c,_0x407c7c);_0x3f9e2d(null);};}for(var e in events){if(events[_0xc2bb('0x7')](e)){var event=events[e];Dashboard[_0xc2bb('0x8')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 39cc32c..648220b 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 _0xd002=['dashboards','../../config/logger','api','moment','bluebird','path','../../config/environment','./dashboard.attributes','exports','define'];(function(_0x406fb4,_0x224e00){var _0x32baab=function(_0x26e7c0){while(--_0x26e7c0){_0x406fb4['push'](_0x406fb4['shift']());}};_0x32baab(++_0x224e00);}(_0xd002,0x10f));var _0x2d00=function(_0x4a39f9,_0x3c5271){_0x4a39f9=_0x4a39f9-0x0;var _0x4a2022=_0xd002[_0x4a39f9];return _0x4a2022;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2d00('0x0'))(_0x2d00('0x1'));var moment=require(_0x2d00('0x2'));var BPromise=require(_0x2d00('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2d00('0x4'));var rimraf=require('rimraf');var config=require(_0x2d00('0x5'));var attributes=require(_0x2d00('0x6'));module[_0x2d00('0x7')]=function(_0xa3d13,_0x557f35){return _0xa3d13[_0x2d00('0x8')]('Dashboard',attributes,{'tableName':_0x2d00('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xad3b=['rimraf','../../config/environment','./dashboard.attributes','Dashboard','dashboards','util','../../config/logger','api','moment','request-promise','path'];(function(_0x46ed01,_0x5af9e6){var _0x809d68=function(_0x43c8b8){while(--_0x43c8b8){_0x46ed01['push'](_0x46ed01['shift']());}};_0x809d68(++_0x5af9e6);}(_0xad3b,0xec));var _0xbad3=function(_0x5463c2,_0x22c4cc){_0x5463c2=_0x5463c2-0x0;var _0x5a7da7=_0xad3b[_0x5463c2];return _0x5a7da7;};'use strict';var _=require('lodash');var util=require(_0xbad3('0x0'));var logger=require(_0xbad3('0x1'))(_0xbad3('0x2'));var moment=require(_0xbad3('0x3'));var BPromise=require('bluebird');var rp=require(_0xbad3('0x4'));var fs=require('fs');var path=require(_0xbad3('0x5'));var rimraf=require(_0xbad3('0x6'));var config=require(_0xbad3('0x7'));var attributes=require(_0xbad3('0x8'));module['exports']=function(_0x4e0a06,_0x477af0){return _0x4e0a06['define'](_0xbad3('0x9'),attributes,{'tableName':_0xbad3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index cbccf43..96af295 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 _0xf6a6=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','register','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x23785c,_0x1c6e72){var _0x2dc080=function(_0x353f41){while(--_0x353f41){_0x23785c['push'](_0x23785c['shift']());}};_0x2dc080(++_0x1c6e72);}(_0xf6a6,0x1d4));var _0x6f6a=function(_0x2b901c,_0x24c65f){_0x2b901c=_0x2b901c-0x0;var _0x13c8e1=_0xf6a6[_0x2b901c];return _0x13c8e1;};'use strict';var _=require(_0x6f6a('0x0'));var util=require('util');var moment=require(_0x6f6a('0x1'));var BPromise=require(_0x6f6a('0x2'));var rs=require(_0x6f6a('0x3'));var fs=require('fs');var Redis=require(_0x6f6a('0x4'));var db=require(_0x6f6a('0x5'))['db'];var utils=require(_0x6f6a('0x6'));var logger=require(_0x6f6a('0x7'))('rpc');var config=require(_0x6f6a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6f6a('0x9')][_0x6f6a('0xa')]({'port':0x232a});config[_0x6f6a('0xb')]=_[_0x6f6a('0xc')](config[_0x6f6a('0xb')],{'host':_0x6f6a('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6f6a('0xb')]));require('./dashboard.socket')[_0x6f6a('0xe')](socket);function respondWithRpcPromise(_0x30d018,_0x39b69f,_0x254d5d){return new BPromise(function(_0x4224ed,_0x2800f8){return client['request'](_0x30d018,_0x254d5d)[_0x6f6a('0xf')](function(_0x406036){logger[_0x6f6a('0x10')](_0x6f6a('0x11'),_0x39b69f,_0x6f6a('0x12'));logger[_0x6f6a('0x13')](_0x6f6a('0x14'),_0x39b69f,_0x6f6a('0x12'),JSON[_0x6f6a('0x15')](_0x406036));if(_0x406036[_0x6f6a('0x16')]){if(_0x406036[_0x6f6a('0x16')][_0x6f6a('0x17')]===0x1f4){logger[_0x6f6a('0x16')](_0x6f6a('0x11'),_0x39b69f,_0x406036[_0x6f6a('0x16')]['message']);return _0x2800f8(_0x406036[_0x6f6a('0x16')][_0x6f6a('0x18')]);}logger['error'](_0x6f6a('0x11'),_0x39b69f,_0x406036['error'][_0x6f6a('0x18')]);return _0x4224ed(_0x406036[_0x6f6a('0x16')][_0x6f6a('0x18')]);}else{logger[_0x6f6a('0x10')](_0x6f6a('0x11'),_0x39b69f,'request\x20sent');_0x4224ed(_0x406036['result'][_0x6f6a('0x18')]);}})[_0x6f6a('0x19')](function(_0x138ef9){logger['error'](_0x6f6a('0x11'),_0x39b69f,_0x138ef9);_0x2800f8(_0x138ef9);});});} \ No newline at end of file +var _0xfb8f=['debug','stringify','error','code','message','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./dashboard.socket','request','info','Dashboard,\x20%s,\x20%s','request\x20sent'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0xfb8f,0x18c));var _0xffb8=function(_0x5d952b,_0x395c8d){_0x5d952b=_0x5d952b-0x0;var _0xb8517a=_0xfb8f[_0x5d952b];return _0xb8517a;};'use strict';var _=require('lodash');var util=require(_0xffb8('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xffb8('0x1'));var fs=require('fs');var Redis=require(_0xffb8('0x2'));var db=require(_0xffb8('0x3'))['db'];var utils=require(_0xffb8('0x4'));var logger=require(_0xffb8('0x5'))('rpc');var config=require(_0xffb8('0x6'));var jayson=require(_0xffb8('0x7'));var client=jayson[_0xffb8('0x8')][_0xffb8('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xffb8('0xa')],{'host':_0xffb8('0xb'),'port':0x18eb});var socket=require(_0xffb8('0xc'))(new Redis(config[_0xffb8('0xa')]));require(_0xffb8('0xd'))['register'](socket);function respondWithRpcPromise(_0x4e3508,_0x3dbb54,_0x2fcc2f){return new BPromise(function(_0x1614b5,_0x2b2197){return client[_0xffb8('0xe')](_0x4e3508,_0x2fcc2f)['then'](function(_0x1eabeb){logger[_0xffb8('0xf')](_0xffb8('0x10'),_0x3dbb54,_0xffb8('0x11'));logger[_0xffb8('0x12')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x3dbb54,_0xffb8('0x11'),JSON[_0xffb8('0x13')](_0x1eabeb));if(_0x1eabeb[_0xffb8('0x14')]){if(_0x1eabeb['error'][_0xffb8('0x15')]===0x1f4){logger['error']('Dashboard,\x20%s,\x20%s',_0x3dbb54,_0x1eabeb[_0xffb8('0x14')][_0xffb8('0x16')]);return _0x2b2197(_0x1eabeb[_0xffb8('0x14')][_0xffb8('0x16')]);}logger[_0xffb8('0x14')](_0xffb8('0x10'),_0x3dbb54,_0x1eabeb[_0xffb8('0x14')][_0xffb8('0x16')]);return _0x1614b5(_0x1eabeb[_0xffb8('0x14')]['message']);}else{logger['info'](_0xffb8('0x10'),_0x3dbb54,'request\x20sent');_0x1614b5(_0x1eabeb['result']['message']);}})['catch'](function(_0x377463){logger[_0xffb8('0x14')](_0xffb8('0x10'),_0x3dbb54,_0x377463);_0x2b2197(_0x377463);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 8ee3be0..9cb1cbf 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 _0xe357=['removeListener','register','dashboard:','./dashboard.events','update','emit'];(function(_0x146a97,_0x2d8483){var _0x259d5c=function(_0x3ca436){while(--_0x3ca436){_0x146a97['push'](_0x146a97['shift']());}};_0x259d5c(++_0x2d8483);}(_0xe357,0x1d1));var _0x7e35=function(_0x3ccc5f,_0x17ba72){_0x3ccc5f=_0x3ccc5f-0x0;var _0x15de37=_0xe357[_0x3ccc5f];return _0x15de37;};'use strict';var DashboardEvents=require(_0x7e35('0x0'));var events=['save','remove',_0x7e35('0x1')];function createListener(_0x2e5afa,_0x33bbed){return function(_0x16f4dd){_0x33bbed[_0x7e35('0x2')](_0x2e5afa,_0x16f4dd);};}function removeListener(_0x52616c,_0x3bf3d9){return function(){DashboardEvents[_0x7e35('0x3')](_0x52616c,_0x3bf3d9);};}exports[_0x7e35('0x4')]=function(_0x44c0a7){for(var _0x4cd979=0x0,_0x511a92=events['length'];_0x4cd979<_0x511a92;_0x4cd979++){var _0x558427=events[_0x4cd979];var _0x3bde6d=createListener(_0x7e35('0x5')+_0x558427,_0x44c0a7);DashboardEvents['on'](_0x558427,_0x3bde6d);}}; \ No newline at end of file +var _0x4edb=['removeListener','register','length','dashboard:','./dashboard.events','save','remove','emit'];(function(_0xb4a153,_0x2ff110){var _0x2c4036=function(_0x19abcf){while(--_0x19abcf){_0xb4a153['push'](_0xb4a153['shift']());}};_0x2c4036(++_0x2ff110);}(_0x4edb,0x10c));var _0xb4ed=function(_0x5f8000,_0x4a56b1){_0x5f8000=_0x5f8000-0x0;var _0xc8f261=_0x4edb[_0x5f8000];return _0xc8f261;};'use strict';var DashboardEvents=require(_0xb4ed('0x0'));var events=[_0xb4ed('0x1'),_0xb4ed('0x2'),'update'];function createListener(_0x4ec39d,_0x241ac8){return function(_0xbd261a){_0x241ac8[_0xb4ed('0x3')](_0x4ec39d,_0xbd261a);};}function removeListener(_0x16a1a5,_0x7fdd2f){return function(){DashboardEvents[_0xb4ed('0x4')](_0x16a1a5,_0x7fdd2f);};}exports[_0xb4ed('0x5')]=function(_0x10bdc8){for(var _0x4de441=0x0,_0x4f0431=events[_0xb4ed('0x6')];_0x4de441<_0x4f0431;_0x4de441++){var _0x531ea1=events[_0x4de441];var _0x407255=createListener(_0xb4ed('0x7')+_0x531ea1,_0x10bdc8);DashboardEvents['on'](_0x531ea1,_0x407255);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 427db6f..c5b6cc6 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 _0x0741=['clone','put','update','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./dashboard.controller','get','isAuthenticated','index','show','/:id/items','getItems','create','post','/:id/clone'];(function(_0x3343e3,_0x2835b8){var _0x31f3d6=function(_0x323fb2){while(--_0x323fb2){_0x3343e3['push'](_0x3343e3['shift']());}};_0x31f3d6(++_0x2835b8);}(_0x0741,0x119));var _0x1074=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0x0741[_0x341e0f];return _0x59555a;};'use strict';var multer=require(_0x1074('0x0'));var util=require(_0x1074('0x1'));var path=require(_0x1074('0x2'));var timeout=require(_0x1074('0x3'));var express=require(_0x1074('0x4'));var router=express[_0x1074('0x5')]();var fs_extra=require(_0x1074('0x6'));var auth=require(_0x1074('0x7'));var interaction=require(_0x1074('0x8'));var config=require('../../config/environment');var controller=require(_0x1074('0x9'));router[_0x1074('0xa')]('/',auth[_0x1074('0xb')](),controller[_0x1074('0xc')]);router[_0x1074('0xa')]('/:id',auth[_0x1074('0xb')](),controller[_0x1074('0xd')]);router[_0x1074('0xa')](_0x1074('0xe'),auth[_0x1074('0xb')](),controller[_0x1074('0xf')]);router['post']('/',auth[_0x1074('0xb')](),controller[_0x1074('0x10')]);router[_0x1074('0x11')](_0x1074('0x12'),auth['isAuthenticated'](),controller[_0x1074('0x13')]);router['post'](_0x1074('0xe'),auth['isAuthenticated'](),controller['addItem']);router[_0x1074('0x14')]('/:id',auth[_0x1074('0xb')](),controller[_0x1074('0x15')]);router['delete'](_0x1074('0x16'),auth[_0x1074('0xb')](),controller[_0x1074('0x17')]);module[_0x1074('0x18')]=router; \ No newline at end of file +var _0xf8bf=['show','/:id/items','getItems','post','create','/:id/clone','clone','addItem','put','/:id','delete','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','index','isAuthenticated'];(function(_0x5de237,_0x2058e8){var _0x3b3d4d=function(_0x3debe1){while(--_0x3debe1){_0x5de237['push'](_0x5de237['shift']());}};_0x3b3d4d(++_0x2058e8);}(_0xf8bf,0xa5));var _0xff8b=function(_0x175080,_0x2a901d){_0x175080=_0x175080-0x0;var _0x29f1a5=_0xf8bf[_0x175080];return _0x29f1a5;};'use strict';var multer=require('multer');var util=require(_0xff8b('0x0'));var path=require('path');var timeout=require(_0xff8b('0x1'));var express=require(_0xff8b('0x2'));var router=express[_0xff8b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xff8b('0x4'));var interaction=require(_0xff8b('0x5'));var config=require(_0xff8b('0x6'));var controller=require(_0xff8b('0x7'));router[_0xff8b('0x8')]('/',auth['isAuthenticated'](),controller[_0xff8b('0x9')]);router[_0xff8b('0x8')]('/:id',auth[_0xff8b('0xa')](),controller[_0xff8b('0xb')]);router['get'](_0xff8b('0xc'),auth['isAuthenticated'](),controller[_0xff8b('0xd')]);router[_0xff8b('0xe')]('/',auth[_0xff8b('0xa')](),controller[_0xff8b('0xf')]);router[_0xff8b('0xe')](_0xff8b('0x10'),auth[_0xff8b('0xa')](),controller[_0xff8b('0x11')]);router['post'](_0xff8b('0xc'),auth[_0xff8b('0xa')](),controller[_0xff8b('0x12')]);router[_0xff8b('0x13')](_0xff8b('0x14'),auth['isAuthenticated'](),controller['update']);router[_0xff8b('0x15')]('/:id',auth[_0xff8b('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 6e49893..a56e01e 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 _0x2eb2=['STRING','TEXT','parse','setDataValue','attrs','stringify','INTEGER','#2196f3','squel','lodash','exports'];(function(_0x5b4666,_0x198f5f){var _0x5a410b=function(_0x58759e){while(--_0x58759e){_0x5b4666['push'](_0x5b4666['shift']());}};_0x5a410b(++_0x198f5f);}(_0x2eb2,0x19f));var _0x22eb=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0x2eb2[_0x4ae625];return _0x31accf;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x22eb('0x0'));var _=require(_0x22eb('0x1'));module[_0x22eb('0x2')]={'title':{'type':Sequelize[_0x22eb('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x22eb('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x22eb('0x4')]('long'),'get':function(){try{return JSON[_0x22eb('0x5')](this['getDataValue']('attrs'));}catch(_0x1dfef7){return[];}},'set':function(_0x10e116){try{this[_0x22eb('0x6')](_0x22eb('0x7'),JSON[_0x22eb('0x8')](_0x10e116));}catch(_0x396806){this[_0x22eb('0x6')](_0x22eb('0x7'),JSON[_0x22eb('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0x22eb('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x22eb('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x22eb('0x9')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0x22eb('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x22eb('0xa'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0x22eb('0x9')],'defaultValue':0xc}}; \ No newline at end of file +var _0x0295=['#ffffff','sequelize','exports','TEXT','long','parse','getDataValue','attrs','setDataValue','INTEGER','STRING'];(function(_0xa8b370,_0x2b77db){var _0x643e37=function(_0x1486eb){while(--_0x1486eb){_0xa8b370['push'](_0xa8b370['shift']());}};_0x643e37(++_0x2b77db);}(_0x0295,0x1f0));var _0x5029=function(_0x52fc63,_0x5a2f5e){_0x52fc63=_0x52fc63-0x0;var _0x5183aa=_0x0295[_0x52fc63];return _0x5183aa;};'use strict';var Sequelize=require(_0x5029('0x0'));var squel=require('squel');var _=require('lodash');module[_0x5029('0x1')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x5029('0x2')](_0x5029('0x3')),'get':function(){try{return JSON[_0x5029('0x4')](this[_0x5029('0x5')](_0x5029('0x6')));}catch(_0x69a497){return[];}},'set':function(_0x200217){try{this[_0x5029('0x7')](_0x5029('0x6'),JSON['stringify'](_0x200217));}catch(_0x54978f){this['setDataValue'](_0x5029('0x6'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x5029('0x8')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x5029('0x8')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0x5029('0x9')],'allowNull':![],'defaultValue':_0x5029('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x5029('0x9')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x5029('0x9')]},'titleFontSize':{'type':Sequelize[_0x5029('0x8')],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 22d86d4..ef8a680 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 _0x958f=['pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./dashboardItem.socket','register','status','json','offset','undefined','limit','Content-Range','apply','reject','save','then','destroy','end','sendStatus','stack','name','send','show','params','keys','DashboardItem','rawAttributes','query','intersection','model','attributes','fields','length','includeAll','include','options','catch','type','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','attrMetric','total','attrVoiceQueues','multibar-chart'];(function(_0x3520a3,_0x585b4e){var _0x266257=function(_0x4d763a){while(--_0x4d763a){_0x3520a3['push'](_0x3520a3['shift']());}};_0x266257(++_0x585b4e);}(_0x958f,0x114));var _0xf958=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x958f[_0x2be8c2];return _0x97f531;};'use strict';var emlformat=require(_0xf958('0x0'));var rimraf=require(_0xf958('0x1'));var zipdir=require(_0xf958('0x2'));var jsonpatch=require(_0xf958('0x3'));var rp=require(_0xf958('0x4'));var moment=require('moment');var BPromise=require(_0xf958('0x5'));var Mustache=require('mustache');var util=require(_0xf958('0x6'));var path=require('path');var sox=require(_0xf958('0x7'));var csv=require(_0xf958('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf958('0x9'));var _=require(_0xf958('0xa'));var squel=require('squel');var crypto=require(_0xf958('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf958('0xc'));var toCsv=require(_0xf958('0x8'));var querystring=require(_0xf958('0xd'));var Papa=require(_0xf958('0xe'));var Redis=require(_0xf958('0xf'));var authService=require(_0xf958('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xf958('0x11'));var hardwareService=require(_0xf958('0x12'));var logger=require(_0xf958('0x13'))(_0xf958('0x14'));var utils=require(_0xf958('0x15'));var config=require(_0xf958('0x16'));var licenseUtil=require(_0xf958('0x17'));var db=require(_0xf958('0x18'))['db'];config[_0xf958('0x19')]=_['defaults'](config[_0xf958('0x19')],{'host':_0xf958('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf958('0x19')]));require(_0xf958('0x1b'))[_0xf958('0x1c')](socket);function respondWithStatusCode(_0x466cc0,_0x426283){_0x426283=_0x426283||0xcc;return function(_0x16f81d){if(_0x16f81d){return _0x466cc0['sendStatus'](_0x426283);}return _0x466cc0[_0xf958('0x1d')](_0x426283)['end']();};}function respondWithResult(_0x8b3e96,_0x498be4){_0x498be4=_0x498be4||0xc8;return function(_0x5271cb){if(_0x5271cb){return _0x8b3e96[_0xf958('0x1d')](_0x498be4)[_0xf958('0x1e')](_0x5271cb);}};}function respondWithFilteredResult(_0x5ee009,_0x8595e8){return function(_0x52ec5e){if(_0x52ec5e){var _0x51ddee=typeof _0x8595e8[_0xf958('0x1f')]===_0xf958('0x20')&&typeof _0x8595e8[_0xf958('0x21')]===_0xf958('0x20');var _0x4bc937=_0x52ec5e['count'];var _0x5d6678=_0x51ddee?0x0:_0x8595e8[_0xf958('0x1f')];var _0x4d569a=_0x51ddee?_0x52ec5e['count']:_0x8595e8[_0xf958('0x1f')]+_0x8595e8['limit'];var _0xa12e89;if(_0x4d569a>=_0x4bc937){_0x4d569a=_0x4bc937;_0xa12e89=0xc8;}else{_0xa12e89=0xce;}_0x5ee009[_0xf958('0x1d')](_0xa12e89);return _0x5ee009['set'](_0xf958('0x22'),_0x5d6678+'-'+_0x4d569a+'/'+_0x4bc937)['json'](_0x52ec5e);}return null;};}function patchUpdates(_0x34b961){return function(_0x2702a7){try{jsonpatch[_0xf958('0x23')](_0x2702a7,_0x34b961,!![]);}catch(_0x28c4a2){return BPromise[_0xf958('0x24')](_0x28c4a2);}return _0x2702a7[_0xf958('0x25')]();};}function saveUpdates(_0x53a66c,_0x14e629){return function(_0xe8c259){if(_0xe8c259){return _0xe8c259['update'](_0x53a66c)[_0xf958('0x26')](function(_0x43afd9){return _0x43afd9;});}return null;};}function removeEntity(_0x1a9b4a,_0xd42573){return function(_0x2f950c){if(_0x2f950c){return _0x2f950c[_0xf958('0x27')]()[_0xf958('0x26')](function(){_0x1a9b4a[_0xf958('0x1d')](0xcc)[_0xf958('0x28')]();});}};}function handleEntityNotFound(_0x95ca22,_0x4c5060){return function(_0x510cfd){if(!_0x510cfd){_0x95ca22[_0xf958('0x29')](0x194);}return _0x510cfd;};}function handleError(_0x46ce10,_0x41f792){_0x41f792=_0x41f792||0x1f4;return function(_0x1ee8b2){logger['error'](_0x1ee8b2[_0xf958('0x2a')]);if(_0x1ee8b2[_0xf958('0x2b')]){delete _0x1ee8b2[_0xf958('0x2b')];}_0x46ce10['status'](_0x41f792)[_0xf958('0x2c')](_0x1ee8b2);};}exports[_0xf958('0x2d')]=function(_0x2efca5,_0x466a71){var _0x1207c0={'raw':![],'where':{'id':_0x2efca5[_0xf958('0x2e')]['id']}},_0x76c7e0={};_0x76c7e0['model']=_[_0xf958('0x2f')](db[_0xf958('0x30')][_0xf958('0x31')]);_0x76c7e0[_0xf958('0x32')]=_[_0xf958('0x2f')](_0x2efca5['query']);_0x76c7e0['filters']=_[_0xf958('0x33')](_0x76c7e0[_0xf958('0x34')],_0x76c7e0[_0xf958('0x32')]);_0x1207c0[_0xf958('0x35')]=_[_0xf958('0x33')](_0x76c7e0[_0xf958('0x34')],qs[_0xf958('0x36')](_0x2efca5[_0xf958('0x32')][_0xf958('0x36')]));_0x1207c0[_0xf958('0x35')]=_0x1207c0[_0xf958('0x35')][_0xf958('0x37')]?_0x1207c0[_0xf958('0x35')]:_0x76c7e0['model'];if(_0x2efca5['query'][_0xf958('0x38')]){_0x1207c0[_0xf958('0x39')]=[{'all':!![]}];}_0x1207c0=_['merge']({},_0x1207c0,_0x2efca5[_0xf958('0x3a')]);return db[_0xf958('0x30')]['find'](_0x1207c0)[_0xf958('0x26')](handleEntityNotFound(_0x466a71,null))[_0xf958('0x26')](respondWithResult(_0x466a71,null))['catch'](handleError(_0x466a71,null));};exports[_0xf958('0x27')]=function(_0x39ef11,_0x3a703b){return db['DashboardItem']['find']({'where':{'id':_0x39ef11['params']['id']}})[_0xf958('0x26')](handleEntityNotFound(_0x3a703b,null))['then'](removeEntity(_0x3a703b,null))[_0xf958('0x3b')](handleError(_0x3a703b,null));};function widgetAttributes(_0x286737){try{switch(_0x286737[_0xf958('0x3c')]){case _0xf958('0x3d'):return[{'name':_0xf958('0x3e'),'value':_0x286737[_0xf958('0x3e')]||(_0x286737[_0xf958('0x3f')]&&_0x286737[_0xf958('0x3f')][0x0]?_0x286737[_0xf958('0x3f')][0x0][_0xf958('0x40')]:undefined)||'https://'}];case _0xf958('0x41'):return[{'name':_0xf958('0x42'),'value':_0x286737['attrPath']||(_0x286737['attrs']&&_0x286737['attrs'][0x0]?_0x286737[_0xf958('0x3f')][0x0][_0xf958('0x40')]:undefined)||''}];case _0xf958('0x43'):return[{'name':'attrHourFormat','value':_0x286737[_0xf958('0x44')]||(_0x286737[_0xf958('0x3f')]&&_0x286737['attrs'][0x0]?_0x286737[_0xf958('0x3f')][0x0][_0xf958('0x40')]:undefined)||_0xf958('0x45')},{'name':_0xf958('0x46'),'value':_0x286737[_0xf958('0x46')]||(_0x286737[_0xf958('0x3f')]&&_0x286737['attrs'][0x1]?_0x286737[_0xf958('0x3f')][0x1][_0xf958('0x40')]:undefined)||'0.00'},{'name':_0xf958('0x47'),'value':_0x286737[_0xf958('0x47')]||(_0x286737[_0xf958('0x3f')]&&_0x286737[_0xf958('0x3f')][0x2]?_0x286737[_0xf958('0x3f')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0xf958('0x48'),'value':_0x286737['attrMetric']||(_0x286737[_0xf958('0x3f')]&&_0x286737[_0xf958('0x3f')][0x0]?_0x286737[_0xf958('0x3f')][0x0][_0xf958('0x40')]:undefined)||_0xf958('0x49')},{'name':_0xf958('0x4a'),'value':_0x286737[_0xf958('0x4a')]||(_0x286737['attrs']&&_0x286737['attrs'][0x1]?_0x286737['attrs'][0x1][_0xf958('0x40')]:undefined)||[]},{'name':_0xf958('0x47'),'value':_0x286737[_0xf958('0x47')]||(_0x286737[_0xf958('0x3f')]&&_0x286737[_0xf958('0x3f')][0x2]?_0x286737[_0xf958('0x3f')][0x2][_0xf958('0x40')]:undefined)||0x14}];case _0xf958('0x4b'):case _0xf958('0x4c'):return[{'name':'attrSerie1','value':_0x286737[_0xf958('0x4d')]||(_0x286737['attrs']&&_0x286737[_0xf958('0x3f')][0x0]?_0x286737['attrs'][0x0][_0xf958('0x40')]:undefined)||_0xf958('0x49')},{'name':'attrSerie2','value':_0x286737[_0xf958('0x4e')]||(_0x286737[_0xf958('0x3f')]&&_0x286737[_0xf958('0x3f')][0x1]?_0x286737[_0xf958('0x3f')][0x1][_0xf958('0x40')]:undefined)||null},{'name':'attrSerie3','value':_0x286737[_0xf958('0x4f')]||(_0x286737[_0xf958('0x3f')]&&_0x286737['attrs'][0x2]?_0x286737[_0xf958('0x3f')][0x2][_0xf958('0x40')]:undefined)||null},{'name':_0xf958('0x4a'),'value':_0x286737[_0xf958('0x4a')]||(_0x286737[_0xf958('0x3f')]&&_0x286737[_0xf958('0x3f')][0x3]?_0x286737[_0xf958('0x3f')][0x3][_0xf958('0x40')]:undefined)||[]}];case'web-report':return[{'name':_0xf958('0x50'),'type':_0x286737[_0xf958('0x51')]||(_0x286737[_0xf958('0x3f')]&&_0x286737[_0xf958('0x3f')][0x0]?_0x286737[_0xf958('0x3f')][0x0]['type']:undefined)||null,'value':_0x286737[_0xf958('0x50')]||(_0x286737[_0xf958('0x3f')]&&_0x286737[_0xf958('0x3f')][0x0]?_0x286737[_0xf958('0x3f')][0x0][_0xf958('0x40')]:undefined)||null},{'name':_0xf958('0x52'),'value':_0x286737[_0xf958('0x52')]||(_0x286737[_0xf958('0x3f')]&&_0x286737[_0xf958('0x3f')][0x1]?_0x286737[_0xf958('0x3f')][0x1][_0xf958('0x40')]:undefined)||0x0}];default:return[];}}catch(_0x514708){logger['error'](_0xf958('0x53'),JSON[_0xf958('0x54')](_0x514708));return[];}}exports[_0xf958('0x55')]=function(_0x4e9ccf,_0x1e74ae){if(_0x4e9ccf[_0xf958('0x56')]){_0x4e9ccf[_0xf958('0x56')]['attrs']=widgetAttributes(_0x4e9ccf[_0xf958('0x56')]);}return db[_0xf958('0x30')][_0xf958('0x55')](_0x4e9ccf[_0xf958('0x56')],{})[_0xf958('0x26')](respondWithResult(_0x1e74ae,0xc9))[_0xf958('0x3b')](handleError(_0x1e74ae,null));};exports['update']=function(_0x504bbd,_0x478e80){if(_0x504bbd[_0xf958('0x56')]['id']){delete _0x504bbd[_0xf958('0x56')]['id'];}_0x504bbd['body'][_0xf958('0x3f')]=widgetAttributes(_0x504bbd[_0xf958('0x56')]);return db['DashboardItem'][_0xf958('0x57')]({'where':{'id':_0x504bbd['params']['id']}})[_0xf958('0x26')](handleEntityNotFound(_0x478e80,null))['then'](saveUpdates(_0x504bbd[_0xf958('0x56')],null))[_0xf958('0x26')](respondWithResult(_0x478e80,null))[_0xf958('0x3b')](handleError(_0x478e80,null));}; \ No newline at end of file +var _0xac15=['web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','show','params','model','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','type','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3'];(function(_0x20f3bc,_0x34c2fd){var _0x2e0502=function(_0x14dd1a){while(--_0x14dd1a){_0x20f3bc['push'](_0x20f3bc['shift']());}};_0x2e0502(++_0x34c2fd);}(_0xac15,0x11f));var _0x5ac1=function(_0x53ab07,_0x516f40){_0x53ab07=_0x53ab07-0x0;var _0xf9ee72=_0xac15[_0x53ab07];return _0xf9ee72;};'use strict';var emlformat=require(_0x5ac1('0x0'));var rimraf=require(_0x5ac1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5ac1('0x2'));var moment=require('moment');var BPromise=require(_0x5ac1('0x3'));var Mustache=require(_0x5ac1('0x4'));var util=require('util');var path=require(_0x5ac1('0x5'));var sox=require('sox');var csv=require(_0x5ac1('0x6'));var ejs=require(_0x5ac1('0x7'));var fs=require('fs');var fs_extra=require(_0x5ac1('0x8'));var _=require('lodash');var squel=require(_0x5ac1('0x9'));var crypto=require(_0x5ac1('0xa'));var jsforce=require(_0x5ac1('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x5ac1('0x6'));var querystring=require(_0x5ac1('0xc'));var Papa=require(_0x5ac1('0xd'));var Redis=require(_0x5ac1('0xe'));var authService=require(_0x5ac1('0xf'));var qs=require(_0x5ac1('0x10'));var as=require(_0x5ac1('0x11'));var hardwareService=require(_0x5ac1('0x12'));var logger=require(_0x5ac1('0x13'))(_0x5ac1('0x14'));var utils=require('../../config/utils');var config=require(_0x5ac1('0x15'));var licenseUtil=require(_0x5ac1('0x16'));var db=require(_0x5ac1('0x17'))['db'];config[_0x5ac1('0x18')]=_[_0x5ac1('0x19')](config['redis'],{'host':_0x5ac1('0x1a'),'port':0x18eb});var socket=require(_0x5ac1('0x1b'))(new Redis(config[_0x5ac1('0x18')]));require(_0x5ac1('0x1c'))['register'](socket);function respondWithStatusCode(_0x2ad765,_0x2af927){_0x2af927=_0x2af927||0xcc;return function(_0x43626b){if(_0x43626b){return _0x2ad765[_0x5ac1('0x1d')](_0x2af927);}return _0x2ad765[_0x5ac1('0x1e')](_0x2af927)['end']();};}function respondWithResult(_0x544fc1,_0x251865){_0x251865=_0x251865||0xc8;return function(_0x579ccd){if(_0x579ccd){return _0x544fc1[_0x5ac1('0x1e')](_0x251865)[_0x5ac1('0x1f')](_0x579ccd);}};}function respondWithFilteredResult(_0x58a2ee,_0x1c28ac){return function(_0x59ff37){if(_0x59ff37){var _0x99e7c3=typeof _0x1c28ac[_0x5ac1('0x20')]===_0x5ac1('0x21')&&typeof _0x1c28ac[_0x5ac1('0x22')]===_0x5ac1('0x21');var _0xddb768=_0x59ff37[_0x5ac1('0x23')];var _0x54a9f8=_0x99e7c3?0x0:_0x1c28ac[_0x5ac1('0x20')];var _0x41ef1e=_0x99e7c3?_0x59ff37[_0x5ac1('0x23')]:_0x1c28ac['offset']+_0x1c28ac['limit'];var _0x588b74;if(_0x41ef1e>=_0xddb768){_0x41ef1e=_0xddb768;_0x588b74=0xc8;}else{_0x588b74=0xce;}_0x58a2ee[_0x5ac1('0x1e')](_0x588b74);return _0x58a2ee[_0x5ac1('0x24')](_0x5ac1('0x25'),_0x54a9f8+'-'+_0x41ef1e+'/'+_0xddb768)[_0x5ac1('0x1f')](_0x59ff37);}return null;};}function patchUpdates(_0x814e7e){return function(_0x562505){try{jsonpatch['apply'](_0x562505,_0x814e7e,!![]);}catch(_0x2f878d){return BPromise[_0x5ac1('0x26')](_0x2f878d);}return _0x562505[_0x5ac1('0x27')]();};}function saveUpdates(_0x23bb51,_0x727d68){return function(_0x2337c4){if(_0x2337c4){return _0x2337c4[_0x5ac1('0x28')](_0x23bb51)[_0x5ac1('0x29')](function(_0x4b6885){return _0x4b6885;});}return null;};}function removeEntity(_0x899424,_0x299d59){return function(_0x1478b5){if(_0x1478b5){return _0x1478b5[_0x5ac1('0x2a')]()['then'](function(){_0x899424[_0x5ac1('0x1e')](0xcc)[_0x5ac1('0x2b')]();});}};}function handleEntityNotFound(_0x415684,_0x1f5ece){return function(_0x1f8bd5){if(!_0x1f8bd5){_0x415684['sendStatus'](0x194);}return _0x1f8bd5;};}function handleError(_0x5efc09,_0x150f69){_0x150f69=_0x150f69||0x1f4;return function(_0x4d2f11){logger[_0x5ac1('0x2c')](_0x4d2f11[_0x5ac1('0x2d')]);if(_0x4d2f11['name']){delete _0x4d2f11[_0x5ac1('0x2e')];}_0x5efc09['status'](_0x150f69)[_0x5ac1('0x2f')](_0x4d2f11);};}exports[_0x5ac1('0x30')]=function(_0x325685,_0x5ce791){var _0x50c351={'raw':![],'where':{'id':_0x325685[_0x5ac1('0x31')]['id']}},_0x409387={};_0x409387[_0x5ac1('0x32')]=_['keys'](db[_0x5ac1('0x33')][_0x5ac1('0x34')]);_0x409387['query']=_['keys'](_0x325685[_0x5ac1('0x35')]);_0x409387[_0x5ac1('0x36')]=_[_0x5ac1('0x37')](_0x409387[_0x5ac1('0x32')],_0x409387[_0x5ac1('0x35')]);_0x50c351[_0x5ac1('0x38')]=_['intersection'](_0x409387[_0x5ac1('0x32')],qs[_0x5ac1('0x39')](_0x325685[_0x5ac1('0x35')][_0x5ac1('0x39')]));_0x50c351[_0x5ac1('0x38')]=_0x50c351[_0x5ac1('0x38')][_0x5ac1('0x3a')]?_0x50c351['attributes']:_0x409387[_0x5ac1('0x32')];if(_0x325685[_0x5ac1('0x35')][_0x5ac1('0x3b')]){_0x50c351[_0x5ac1('0x3c')]=[{'all':!![]}];}_0x50c351=_[_0x5ac1('0x3d')]({},_0x50c351,_0x325685[_0x5ac1('0x3e')]);return db[_0x5ac1('0x33')][_0x5ac1('0x3f')](_0x50c351)['then'](handleEntityNotFound(_0x5ce791,null))[_0x5ac1('0x29')](respondWithResult(_0x5ce791,null))[_0x5ac1('0x40')](handleError(_0x5ce791,null));};exports[_0x5ac1('0x2a')]=function(_0xa5e7a8,_0x545469){return db[_0x5ac1('0x33')][_0x5ac1('0x3f')]({'where':{'id':_0xa5e7a8[_0x5ac1('0x31')]['id']}})['then'](handleEntityNotFound(_0x545469,null))[_0x5ac1('0x29')](removeEntity(_0x545469,null))['catch'](handleError(_0x545469,null));};function widgetAttributes(_0x509396){try{switch(_0x509396[_0x5ac1('0x41')]){case _0x5ac1('0x42'):return[{'name':_0x5ac1('0x43'),'value':_0x509396[_0x5ac1('0x43')]||(_0x509396[_0x5ac1('0x44')]&&_0x509396['attrs'][0x0]?_0x509396[_0x5ac1('0x44')][0x0][_0x5ac1('0x45')]:undefined)||'https://'}];case _0x5ac1('0x46'):return[{'name':'attrPath','value':_0x509396[_0x5ac1('0x47')]||(_0x509396[_0x5ac1('0x44')]&&_0x509396['attrs'][0x0]?_0x509396[_0x5ac1('0x44')][0x0][_0x5ac1('0x45')]:undefined)||''}];case _0x5ac1('0x48'):return[{'name':'attrHourFormat','value':_0x509396[_0x5ac1('0x49')]||(_0x509396['attrs']&&_0x509396[_0x5ac1('0x44')][0x0]?_0x509396[_0x5ac1('0x44')][0x0][_0x5ac1('0x45')]:undefined)||_0x5ac1('0x4a')},{'name':_0x5ac1('0x4b'),'value':_0x509396['attrTimezone']||(_0x509396[_0x5ac1('0x44')]&&_0x509396['attrs'][0x1]?_0x509396['attrs'][0x1]['value']:undefined)||'0.00'},{'name':'attrFontSize','value':_0x509396[_0x5ac1('0x4c')]||(_0x509396[_0x5ac1('0x44')]&&_0x509396[_0x5ac1('0x44')][0x2]?_0x509396[_0x5ac1('0x44')][0x2][_0x5ac1('0x45')]:undefined)||0xc}];case _0x5ac1('0x4d'):return[{'name':_0x5ac1('0x4e'),'value':_0x509396[_0x5ac1('0x4e')]||(_0x509396['attrs']&&_0x509396[_0x5ac1('0x44')][0x0]?_0x509396['attrs'][0x0][_0x5ac1('0x45')]:undefined)||'total'},{'name':_0x5ac1('0x4f'),'value':_0x509396['attrVoiceQueues']||(_0x509396[_0x5ac1('0x44')]&&_0x509396[_0x5ac1('0x44')][0x1]?_0x509396[_0x5ac1('0x44')][0x1][_0x5ac1('0x45')]:undefined)||[]},{'name':'attrFontSize','value':_0x509396[_0x5ac1('0x4c')]||(_0x509396[_0x5ac1('0x44')]&&_0x509396[_0x5ac1('0x44')][0x2]?_0x509396[_0x5ac1('0x44')][0x2]['value']:undefined)||0x14}];case _0x5ac1('0x50'):case _0x5ac1('0x51'):return[{'name':_0x5ac1('0x52'),'value':_0x509396[_0x5ac1('0x52')]||(_0x509396[_0x5ac1('0x44')]&&_0x509396['attrs'][0x0]?_0x509396[_0x5ac1('0x44')][0x0]['value']:undefined)||'total'},{'name':_0x5ac1('0x53'),'value':_0x509396[_0x5ac1('0x53')]||(_0x509396[_0x5ac1('0x44')]&&_0x509396[_0x5ac1('0x44')][0x1]?_0x509396[_0x5ac1('0x44')][0x1][_0x5ac1('0x45')]:undefined)||null},{'name':_0x5ac1('0x54'),'value':_0x509396['attrSerie3']||(_0x509396[_0x5ac1('0x44')]&&_0x509396[_0x5ac1('0x44')][0x2]?_0x509396['attrs'][0x2][_0x5ac1('0x45')]:undefined)||null},{'name':_0x5ac1('0x4f'),'value':_0x509396[_0x5ac1('0x4f')]||(_0x509396[_0x5ac1('0x44')]&&_0x509396[_0x5ac1('0x44')][0x3]?_0x509396[_0x5ac1('0x44')][0x3][_0x5ac1('0x45')]:undefined)||[]}];case _0x5ac1('0x55'):return[{'name':_0x5ac1('0x56'),'type':_0x509396[_0x5ac1('0x57')]||(_0x509396['attrs']&&_0x509396[_0x5ac1('0x44')][0x0]?_0x509396[_0x5ac1('0x44')][0x0]['type']:undefined)||null,'value':_0x509396[_0x5ac1('0x56')]||(_0x509396[_0x5ac1('0x44')]&&_0x509396[_0x5ac1('0x44')][0x0]?_0x509396[_0x5ac1('0x44')][0x0][_0x5ac1('0x45')]:undefined)||null},{'name':_0x5ac1('0x58'),'value':_0x509396['attrRefresh']||(_0x509396['attrs']&&_0x509396['attrs'][0x1]?_0x509396[_0x5ac1('0x44')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x65f69c){logger[_0x5ac1('0x2c')](_0x5ac1('0x59'),JSON[_0x5ac1('0x5a')](_0x65f69c));return[];}}exports[_0x5ac1('0x5b')]=function(_0x215496,_0x5ebc6d){if(_0x215496[_0x5ac1('0x5c')]){_0x215496['body']['attrs']=widgetAttributes(_0x215496['body']);}return db[_0x5ac1('0x33')][_0x5ac1('0x5b')](_0x215496['body'],{})[_0x5ac1('0x29')](respondWithResult(_0x5ebc6d,0xc9))['catch'](handleError(_0x5ebc6d,null));};exports[_0x5ac1('0x28')]=function(_0x5ac594,_0x43c89b){if(_0x5ac594[_0x5ac1('0x5c')]['id']){delete _0x5ac594[_0x5ac1('0x5c')]['id'];}_0x5ac594['body'][_0x5ac1('0x44')]=widgetAttributes(_0x5ac594[_0x5ac1('0x5c')]);return db[_0x5ac1('0x33')][_0x5ac1('0x3f')]({'where':{'id':_0x5ac594[_0x5ac1('0x31')]['id']}})['then'](handleEntityNotFound(_0x43c89b,null))[_0x5ac1('0x29')](saveUpdates(_0x5ac594[_0x5ac1('0x5c')],null))[_0x5ac1('0x29')](respondWithResult(_0x43c89b,null))[_0x5ac1('0x40')](handleError(_0x43c89b,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 0996c1b..34ded14 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 _0x382b=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','save','update'];(function(_0x165e4f,_0x3df561){var _0x1ed64b=function(_0x55e56f){while(--_0x55e56f){_0x165e4f['push'](_0x165e4f['shift']());}};_0x1ed64b(++_0x3df561);}(_0x382b,0x11c));var _0xb382=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x382b[_0x122ef9];return _0x42fba0;};'use strict';var EventEmitter=require(_0xb382('0x0'));var DashboardItem=require(_0xb382('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb382('0x2'),'afterUpdate':_0xb382('0x3'),'afterDestroy':_0xb382('0x4')};function emitEvent(_0x140071){return function(_0x15116,_0x2539ba,_0x3dc1fe){DashboardItemEvents[_0xb382('0x5')](_0x140071+':'+_0x15116['id'],_0x15116);DashboardItemEvents[_0xb382('0x5')](_0x140071,_0x15116);_0x3dc1fe(null);};}for(var e in events){if(events[_0xb382('0x6')](e)){var event=events[e];DashboardItem[_0xb382('0x7')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0xef74=['exports','events','../../mysqldb','DashboardItem','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xef74,0x8d));var _0x4ef7=function(_0x4ed520,_0x21be63){_0x4ed520=_0x4ed520-0x0;var _0x4415a6=_0xef74[_0x4ed520];return _0x4415a6;};'use strict';var EventEmitter=require(_0x4ef7('0x0'));var DashboardItem=require(_0x4ef7('0x1'))['db'][_0x4ef7('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x4ef7('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4ef7('0x4'),'afterDestroy':_0x4ef7('0x5')};function emitEvent(_0x5c5066){return function(_0x50f650,_0x3eee59,_0x1af99e){DashboardItemEvents[_0x4ef7('0x6')](_0x5c5066+':'+_0x50f650['id'],_0x50f650);DashboardItemEvents[_0x4ef7('0x6')](_0x5c5066,_0x50f650);_0x1af99e(null);};}for(var e in events){if(events[_0x4ef7('0x7')](e)){var event=events[e];DashboardItem[_0x4ef7('0x8')](e,emitEvent(event));}}module[_0x4ef7('0x9')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index e8a6f40..9c5b363 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 _0xe4ef=['path','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','dashboard_items','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x12049a,_0x10cdc0){var _0x4ad2f6=function(_0x1d28a2){while(--_0x1d28a2){_0x12049a['push'](_0x12049a['shift']());}};_0x4ad2f6(++_0x10cdc0);}(_0xe4ef,0x17b));var _0xfe4e=function(_0x412ea7,_0x4ca138){_0x412ea7=_0x412ea7-0x0;var _0x1bdf58=_0xe4ef[_0x412ea7];return _0x1bdf58;};'use strict';var _=require(_0xfe4e('0x0'));var util=require('util');var logger=require(_0xfe4e('0x1'))('api');var moment=require(_0xfe4e('0x2'));var BPromise=require(_0xfe4e('0x3'));var rp=require(_0xfe4e('0x4'));var fs=require('fs');var path=require(_0xfe4e('0x5'));var rimraf=require(_0xfe4e('0x6'));var config=require(_0xfe4e('0x7'));var attributes=require(_0xfe4e('0x8'));module[_0xfe4e('0x9')]=function(_0x1d32dd,_0x5393a6){return _0x1d32dd[_0xfe4e('0xa')]('DashboardItem',attributes,{'tableName':_0xfe4e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3d2a=['moment','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','DashboardItem','dashboard_items','../../config/logger','api'];(function(_0x465d11,_0x37e1ad){var _0x29225d=function(_0xb3283){while(--_0xb3283){_0x465d11['push'](_0x465d11['shift']());}};_0x29225d(++_0x37e1ad);}(_0x3d2a,0x1d4));var _0xa3d2=function(_0x41b06b,_0x34d7bb){_0x41b06b=_0x41b06b-0x0;var _0x52fce1=_0x3d2a[_0x41b06b];return _0x52fce1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa3d2('0x0'))(_0xa3d2('0x1'));var moment=require(_0xa3d2('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa3d2('0x3'));var rimraf=require(_0xa3d2('0x4'));var config=require(_0xa3d2('0x5'));var attributes=require(_0xa3d2('0x6'));module[_0xa3d2('0x7')]=function(_0x3de50d,_0x17ec0d){return _0x3de50d['define'](_0xa3d2('0x8'),attributes,{'tableName':_0xa3d2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index c4ac49c..76e5909 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 _0x4c10=['debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','DashboardItem,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','localhost','socket.io-emitter','redis','./dashboardItem.socket','register','then','info','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4c10,0x183));var _0x04c1=function(_0x5bb3b0,_0x170853){_0x5bb3b0=_0x5bb3b0-0x0;var _0x266567=_0x4c10[_0x5bb3b0];return _0x266567;};'use strict';var _=require(_0x04c1('0x0'));var util=require('util');var moment=require(_0x04c1('0x1'));var BPromise=require(_0x04c1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x04c1('0x3'))['db'];var utils=require(_0x04c1('0x4'));var logger=require(_0x04c1('0x5'))(_0x04c1('0x6'));var config=require('../../config/environment');var jayson=require(_0x04c1('0x7'));var client=jayson['client'][_0x04c1('0x8')]({'port':0x232a});config['redis']=_[_0x04c1('0x9')](config['redis'],{'host':_0x04c1('0xa'),'port':0x18eb});var socket=require(_0x04c1('0xb'))(new Redis(config[_0x04c1('0xc')]));require(_0x04c1('0xd'))[_0x04c1('0xe')](socket);function respondWithRpcPromise(_0x5f1442,_0xe3b27b,_0x32be6a){return new BPromise(function(_0x1df56e,_0x2ee481){return client['request'](_0x5f1442,_0x32be6a)[_0x04c1('0xf')](function(_0x1c0969){logger[_0x04c1('0x10')]('DashboardItem,\x20%s,\x20%s',_0xe3b27b,_0x04c1('0x11'));logger[_0x04c1('0x12')](_0x04c1('0x13'),_0xe3b27b,_0x04c1('0x11'),JSON[_0x04c1('0x14')](_0x1c0969));if(_0x1c0969[_0x04c1('0x15')]){if(_0x1c0969['error'][_0x04c1('0x16')]===0x1f4){logger[_0x04c1('0x15')](_0x04c1('0x17'),_0xe3b27b,_0x1c0969[_0x04c1('0x15')][_0x04c1('0x18')]);return _0x2ee481(_0x1c0969[_0x04c1('0x15')][_0x04c1('0x18')]);}logger[_0x04c1('0x15')]('DashboardItem,\x20%s,\x20%s',_0xe3b27b,_0x1c0969[_0x04c1('0x15')][_0x04c1('0x18')]);return _0x1df56e(_0x1c0969[_0x04c1('0x15')][_0x04c1('0x18')]);}else{logger[_0x04c1('0x10')]('DashboardItem,\x20%s,\x20%s',_0xe3b27b,_0x04c1('0x11'));_0x1df56e(_0x1c0969[_0x04c1('0x19')][_0x04c1('0x18')]);}})[_0x04c1('0x1a')](function(_0x551c61){logger[_0x04c1('0x15')](_0x04c1('0x17'),_0xe3b27b,_0x551c61);_0x2ee481(_0x551c61);});});} \ No newline at end of file +var _0x0012=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','lodash','util'];(function(_0xbd6e0f,_0x58fb03){var _0x3f5e97=function(_0x1d66dd){while(--_0x1d66dd){_0xbd6e0f['push'](_0xbd6e0f['shift']());}};_0x3f5e97(++_0x58fb03);}(_0x0012,0x127));var _0x2001=function(_0x39d576,_0xad8bca){_0x39d576=_0x39d576-0x0;var _0x38d81a=_0x0012[_0x39d576];return _0x38d81a;};'use strict';var _=require(_0x2001('0x0'));var util=require(_0x2001('0x1'));var moment=require(_0x2001('0x2'));var BPromise=require('bluebird');var rs=require(_0x2001('0x3'));var fs=require('fs');var Redis=require(_0x2001('0x4'));var db=require(_0x2001('0x5'))['db'];var utils=require(_0x2001('0x6'));var logger=require(_0x2001('0x7'))(_0x2001('0x8'));var config=require(_0x2001('0x9'));var jayson=require(_0x2001('0xa'));var client=jayson[_0x2001('0xb')][_0x2001('0xc')]({'port':0x232a});config[_0x2001('0xd')]=_[_0x2001('0xe')](config['redis'],{'host':_0x2001('0xf'),'port':0x18eb});var socket=require(_0x2001('0x10'))(new Redis(config[_0x2001('0xd')]));require('./dashboardItem.socket')[_0x2001('0x11')](socket);function respondWithRpcPromise(_0x4d57c3,_0x5620e8,_0x1e7b22){return new BPromise(function(_0xbd2348,_0x36bba4){return client[_0x2001('0x12')](_0x4d57c3,_0x1e7b22)['then'](function(_0x1f1060){logger[_0x2001('0x13')](_0x2001('0x14'),_0x5620e8,_0x2001('0x15'));logger[_0x2001('0x16')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x5620e8,'request\x20sent',JSON['stringify'](_0x1f1060));if(_0x1f1060[_0x2001('0x17')]){if(_0x1f1060[_0x2001('0x17')]['code']===0x1f4){logger[_0x2001('0x17')](_0x2001('0x14'),_0x5620e8,_0x1f1060[_0x2001('0x17')][_0x2001('0x18')]);return _0x36bba4(_0x1f1060[_0x2001('0x17')]['message']);}logger['error'](_0x2001('0x14'),_0x5620e8,_0x1f1060['error'][_0x2001('0x18')]);return _0xbd2348(_0x1f1060['error']['message']);}else{logger[_0x2001('0x13')](_0x2001('0x14'),_0x5620e8,_0x2001('0x15'));_0xbd2348(_0x1f1060[_0x2001('0x19')]['message']);}})[_0x2001('0x1a')](function(_0x115ae4){logger[_0x2001('0x17')](_0x2001('0x14'),_0x5620e8,_0x115ae4);_0x36bba4(_0x115ae4);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index f85772d..79c100a 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 _0xc2b9=['length','dashboardItem:','./dashboardItem.events','save'];(function(_0x1adcf9,_0x3229b2){var _0x200daa=function(_0x5db75c){while(--_0x5db75c){_0x1adcf9['push'](_0x1adcf9['shift']());}};_0x200daa(++_0x3229b2);}(_0xc2b9,0x1d2));var _0x9c2b=function(_0x1746a5,_0x136c04){_0x1746a5=_0x1746a5-0x0;var _0x369652=_0xc2b9[_0x1746a5];return _0x369652;};'use strict';var DashboardItemEvents=require(_0x9c2b('0x0'));var events=[_0x9c2b('0x1'),'remove','update'];function createListener(_0x496f99,_0xd3132b){return function(_0x35f038){_0xd3132b['emit'](_0x496f99,_0x35f038);};}function removeListener(_0x565e66,_0x2fb490){return function(){DashboardItemEvents['removeListener'](_0x565e66,_0x2fb490);};}exports['register']=function(_0x4fe60a){for(var _0x4c021a=0x0,_0x49ea74=events[_0x9c2b('0x2')];_0x4c021a<_0x49ea74;_0x4c021a++){var _0x19a5fc=events[_0x4c021a];var _0x32139a=createListener(_0x9c2b('0x3')+_0x19a5fc,_0x4fe60a);DashboardItemEvents['on'](_0x19a5fc,_0x32139a);}}; \ No newline at end of file +var _0x8413=['register','length','./dashboardItem.events','remove','update','removeListener'];(function(_0x5491e5,_0x37a869){var _0x214eb5=function(_0x13a469){while(--_0x13a469){_0x5491e5['push'](_0x5491e5['shift']());}};_0x214eb5(++_0x37a869);}(_0x8413,0x152));var _0x3841=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x8413[_0x6131cd];return _0x47e916;};'use strict';var DashboardItemEvents=require(_0x3841('0x0'));var events=['save',_0x3841('0x1'),_0x3841('0x2')];function createListener(_0x4b3e89,_0x330992){return function(_0x3498d5){_0x330992['emit'](_0x4b3e89,_0x3498d5);};}function removeListener(_0x52af13,_0x473c5d){return function(){DashboardItemEvents[_0x3841('0x3')](_0x52af13,_0x473c5d);};}exports[_0x3841('0x4')]=function(_0x725a04){for(var _0x3cc74b=0x0,_0x4f5e91=events[_0x3841('0x5')];_0x3cc74b<_0x4f5e91;_0x3cc74b++){var _0x5ea1cb=events[_0x3cc74b];var _0x892b8f=createListener('dashboardItem:'+_0x5ea1cb,_0x725a04);DashboardItemEvents['on'](_0x5ea1cb,_0x892b8f);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 7581b75..e6780c5 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 _0x6a11=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','/:id','post','isAuthenticated','create','delete','destroy','exports','multer'];(function(_0x4255ed,_0x195ff6){var _0x1de65b=function(_0x2ab9d6){while(--_0x2ab9d6){_0x4255ed['push'](_0x4255ed['shift']());}};_0x1de65b(++_0x195ff6);}(_0x6a11,0x1ee));var _0x16a1=function(_0x26b03a,_0x119b59){_0x26b03a=_0x26b03a-0x0;var _0x57381b=_0x6a11[_0x26b03a];return _0x57381b;};'use strict';var multer=require(_0x16a1('0x0'));var util=require(_0x16a1('0x1'));var path=require(_0x16a1('0x2'));var timeout=require(_0x16a1('0x3'));var express=require('express');var router=express[_0x16a1('0x4')]();var fs_extra=require(_0x16a1('0x5'));var auth=require(_0x16a1('0x6'));var interaction=require(_0x16a1('0x7'));var config=require('../../config/environment');var controller=require('./dashboardItem.controller');router['get'](_0x16a1('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x16a1('0x9')]('/',auth[_0x16a1('0xa')](),controller[_0x16a1('0xb')]);router['put']('/:id',auth[_0x16a1('0xa')](),controller['update']);router[_0x16a1('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x16a1('0xd')]);module[_0x16a1('0xe')]=router; \ No newline at end of file +var _0xe333=['create','put','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./dashboardItem.controller','get','/:id','isAuthenticated','show','post'];(function(_0x3566a3,_0x40cdaf){var _0x1ea920=function(_0x5ecbb1){while(--_0x5ecbb1){_0x3566a3['push'](_0x3566a3['shift']());}};_0x1ea920(++_0x40cdaf);}(_0xe333,0x1eb));var _0x3e33=function(_0x4d108b,_0x20fcfc){_0x4d108b=_0x4d108b-0x0;var _0x16c26c=_0xe333[_0x4d108b];return _0x16c26c;};'use strict';var multer=require(_0x3e33('0x0'));var util=require('util');var path=require(_0x3e33('0x1'));var timeout=require(_0x3e33('0x2'));var express=require(_0x3e33('0x3'));var router=express['Router']();var fs_extra=require(_0x3e33('0x4'));var auth=require(_0x3e33('0x5'));var interaction=require(_0x3e33('0x6'));var config=require('../../config/environment');var controller=require(_0x3e33('0x7'));router[_0x3e33('0x8')](_0x3e33('0x9'),auth[_0x3e33('0xa')](),controller[_0x3e33('0xb')]);router[_0x3e33('0xc')]('/',auth[_0x3e33('0xa')](),controller[_0x3e33('0xd')]);router[_0x3e33('0xe')](_0x3e33('0x9'),auth[_0x3e33('0xa')](),controller[_0x3e33('0xf')]);router['delete'](_0x3e33('0x9'),auth['isAuthenticated'](),controller[_0x3e33('0x10')]);module[_0x3e33('0x11')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 36dcca7..a8d9b6b 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 _0x49c0=['third','STRING','sequelize','ENUM','first'];(function(_0x2a065e,_0x47e1fe){var _0x15a533=function(_0x29aed0){while(--_0x29aed0){_0x2a065e['push'](_0x2a065e['shift']());}};_0x15a533(++_0x47e1fe);}(_0x49c0,0x179));var _0x049c=function(_0x51c062,_0x56e2ff){_0x51c062=_0x51c062-0x0;var _0x4d7799=_0x49c0[_0x51c062];return _0x4d7799;};'use strict';var Sequelize=require(_0x049c('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0x049c('0x1')](_0x049c('0x2'),'second',_0x049c('0x3')),'allowNull':![],'defaultValue':_0x049c('0x2')},'description':{'type':Sequelize[_0x049c('0x4')]}}; \ No newline at end of file +var _0x0be6=['exports','STRING','ENUM','first','second','sequelize'];(function(_0x1e77ea,_0x5442bf){var _0x193925=function(_0x529587){while(--_0x529587){_0x1e77ea['push'](_0x1e77ea['shift']());}};_0x193925(++_0x5442bf);}(_0x0be6,0x1c7));var _0x60be=function(_0x11fbfe,_0x170dbb){_0x11fbfe=_0x11fbfe-0x0;var _0xc54685=_0x0be6[_0x11fbfe];return _0xc54685;};'use strict';var Sequelize=require(_0x60be('0x0'));module[_0x60be('0x1')]={'name':{'type':Sequelize[_0x60be('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x60be('0x3')](_0x60be('0x4'),_0x60be('0x5'),'third'),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 8a8e815..3bb5af9 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 _0x2427=['length','hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','options','count','includeAll','findAll','rows','show','params','rawAttributes','keys','include','find','catch','create','body','user','get','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','end','status','json','offset','limit','undefined','set','apply','reject','save','update','destroy','then','Dispositions','UserProfileResource','sendStatus','error','stack','name','send','index','map','Disposition','fieldName','key','model','query','filters','attributes','intersection','fields'];(function(_0x2ac3cf,_0x465bb6){var _0x27dcca=function(_0x33f954){while(--_0x33f954){_0x2ac3cf['push'](_0x2ac3cf['shift']());}};_0x27dcca(++_0x465bb6);}(_0x2427,0x165));var _0x7242=function(_0x1a43e2,_0x5552b1){_0x1a43e2=_0x1a43e2-0x0;var _0x2f37ed=_0x2427[_0x1a43e2];return _0x2f37ed;};'use strict';var emlformat=require(_0x7242('0x0'));var rimraf=require(_0x7242('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7242('0x2'));var rp=require('request-promise');var moment=require(_0x7242('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7242('0x4'));var util=require(_0x7242('0x5'));var path=require(_0x7242('0x6'));var sox=require('sox');var csv=require(_0x7242('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7242('0x8'));var _=require(_0x7242('0x9'));var squel=require(_0x7242('0xa'));var crypto=require(_0x7242('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7242('0xc'));var toCsv=require(_0x7242('0x7'));var querystring=require('querystring');var Papa=require(_0x7242('0xd'));var Redis=require(_0x7242('0xe'));var authService=require(_0x7242('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x7242('0x10'));var hardwareService=require(_0x7242('0x11'));var logger=require(_0x7242('0x12'))(_0x7242('0x13'));var utils=require('../../config/utils');var config=require(_0x7242('0x14'));var licenseUtil=require(_0x7242('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2efc1e,_0x406138){_0x406138=_0x406138||0xcc;return function(_0x438ff5){if(_0x438ff5){return _0x2efc1e['sendStatus'](_0x406138);}return _0x2efc1e['status'](_0x406138)[_0x7242('0x16')]();};}function respondWithResult(_0x4e8042,_0x22af73){_0x22af73=_0x22af73||0xc8;return function(_0x375ca6){if(_0x375ca6){return _0x4e8042[_0x7242('0x17')](_0x22af73)[_0x7242('0x18')](_0x375ca6);}};}function respondWithFilteredResult(_0x461f20,_0x13e8c9){return function(_0x3ef574){if(_0x3ef574){var _0x4db26b=typeof _0x13e8c9[_0x7242('0x19')]==='undefined'&&typeof _0x13e8c9[_0x7242('0x1a')]===_0x7242('0x1b');var _0x4828a0=_0x3ef574['count'];var _0x58ccfc=_0x4db26b?0x0:_0x13e8c9[_0x7242('0x19')];var _0xf7f7f9=_0x4db26b?_0x3ef574['count']:_0x13e8c9['offset']+_0x13e8c9['limit'];var _0x1214c4;if(_0xf7f7f9>=_0x4828a0){_0xf7f7f9=_0x4828a0;_0x1214c4=0xc8;}else{_0x1214c4=0xce;}_0x461f20['status'](_0x1214c4);return _0x461f20[_0x7242('0x1c')]('Content-Range',_0x58ccfc+'-'+_0xf7f7f9+'/'+_0x4828a0)[_0x7242('0x18')](_0x3ef574);}return null;};}function patchUpdates(_0x32f42b){return function(_0xb3a27f){try{jsonpatch[_0x7242('0x1d')](_0xb3a27f,_0x32f42b,!![]);}catch(_0xd68b73){return BPromise[_0x7242('0x1e')](_0xd68b73);}return _0xb3a27f[_0x7242('0x1f')]();};}function saveUpdates(_0x4bf6a6,_0x2fd572){return function(_0x36fc79){if(_0x36fc79){return _0x36fc79[_0x7242('0x20')](_0x4bf6a6)['then'](function(_0x32cef6){return _0x32cef6;});}return null;};}function removeEntity(_0x69b776,_0xee9c58){return function(_0x28ea5d){if(_0x28ea5d){return _0x28ea5d[_0x7242('0x21')]()[_0x7242('0x22')](function(){var _0x3c8a86=_0x28ea5d['get']({'plain':!![]});var _0x4ce2b2=_0x7242('0x23');return db[_0x7242('0x24')][_0x7242('0x21')]({'where':{'type':_0x4ce2b2,'resourceId':_0x3c8a86['id']}})[_0x7242('0x22')](function(){return _0x28ea5d;});})[_0x7242('0x22')](function(){_0x69b776[_0x7242('0x17')](0xcc)[_0x7242('0x16')]();});}};}function handleEntityNotFound(_0x58da69,_0xe41fb0){return function(_0xf28340){if(!_0xf28340){_0x58da69[_0x7242('0x25')](0x194);}return _0xf28340;};}function handleError(_0x4bc615,_0x11f963){_0x11f963=_0x11f963||0x1f4;return function(_0x37b063){logger[_0x7242('0x26')](_0x37b063[_0x7242('0x27')]);if(_0x37b063[_0x7242('0x28')]){delete _0x37b063[_0x7242('0x28')];}_0x4bc615['status'](_0x11f963)[_0x7242('0x29')](_0x37b063);};}exports[_0x7242('0x2a')]=function(_0x3fe364,_0x6cfd48){var _0x586885={},_0x13f986={},_0x31adf5={'count':0x0,'rows':[]};var _0x3ac1df=_[_0x7242('0x2b')](db[_0x7242('0x2c')]['rawAttributes'],function(_0x2d00e8){return{'name':_0x2d00e8[_0x7242('0x2d')],'type':_0x2d00e8['type'][_0x7242('0x2e')]};});_0x13f986[_0x7242('0x2f')]=_[_0x7242('0x2b')](_0x3ac1df,'name');_0x13f986[_0x7242('0x30')]=_['keys'](_0x3fe364['query']);_0x13f986[_0x7242('0x31')]=_['intersection'](_0x13f986[_0x7242('0x2f')],_0x13f986['query']);_0x586885[_0x7242('0x32')]=_[_0x7242('0x33')](_0x13f986[_0x7242('0x2f')],qs['fields'](_0x3fe364['query'][_0x7242('0x34')]));_0x586885[_0x7242('0x32')]=_0x586885[_0x7242('0x32')][_0x7242('0x35')]?_0x586885[_0x7242('0x32')]:_0x13f986[_0x7242('0x2f')];if(!_0x3fe364['query'][_0x7242('0x36')]('nolimit')){_0x586885[_0x7242('0x1a')]=qs[_0x7242('0x1a')](_0x3fe364[_0x7242('0x30')][_0x7242('0x1a')]);_0x586885[_0x7242('0x19')]=qs['offset'](_0x3fe364[_0x7242('0x30')][_0x7242('0x19')]);}_0x586885[_0x7242('0x37')]=qs[_0x7242('0x38')](_0x3fe364[_0x7242('0x30')][_0x7242('0x38')]);_0x586885[_0x7242('0x39')]=qs[_0x7242('0x31')](_[_0x7242('0x3a')](_0x3fe364['query'],_0x13f986[_0x7242('0x31')]),_0x3ac1df);if(_0x3fe364[_0x7242('0x30')][_0x7242('0x3b')]){_0x586885[_0x7242('0x39')]=_['merge'](_0x586885['where'],{'$or':_[_0x7242('0x2b')](_0x3ac1df,function(_0x4c0eaa){if(_0x4c0eaa[_0x7242('0x3c')]!==_0x7242('0x3d')){var _0x581f16={};_0x581f16[_0x4c0eaa[_0x7242('0x28')]]={'$like':'%'+_0x3fe364['query'][_0x7242('0x3b')]+'%'};return _0x581f16;}})});}_0x586885=_['merge']({},_0x586885,_0x3fe364[_0x7242('0x3e')]);var _0x418b94={'where':_0x586885['where']};return db[_0x7242('0x2c')][_0x7242('0x3f')](_0x418b94)[_0x7242('0x22')](function(_0x43e516){_0x31adf5[_0x7242('0x3f')]=_0x43e516;if(_0x3fe364['query'][_0x7242('0x40')]){_0x586885['include']=[{'all':!![]}];}return db[_0x7242('0x2c')][_0x7242('0x41')](_0x586885);})[_0x7242('0x22')](function(_0x4deec6){_0x31adf5[_0x7242('0x42')]=_0x4deec6;return _0x31adf5;})['then'](respondWithFilteredResult(_0x6cfd48,_0x586885))['catch'](handleError(_0x6cfd48,null));};exports[_0x7242('0x43')]=function(_0x278593,_0x5158a8){var _0x5e79be={'raw':!![],'where':{'id':_0x278593[_0x7242('0x44')]['id']}},_0x5e4a6f={};_0x5e4a6f[_0x7242('0x2f')]=_['keys'](db[_0x7242('0x2c')][_0x7242('0x45')]);_0x5e4a6f[_0x7242('0x30')]=_[_0x7242('0x46')](_0x278593[_0x7242('0x30')]);_0x5e4a6f[_0x7242('0x31')]=_[_0x7242('0x33')](_0x5e4a6f[_0x7242('0x2f')],_0x5e4a6f[_0x7242('0x30')]);_0x5e79be[_0x7242('0x32')]=_['intersection'](_0x5e4a6f['model'],qs[_0x7242('0x34')](_0x278593[_0x7242('0x30')]['fields']));_0x5e79be[_0x7242('0x32')]=_0x5e79be[_0x7242('0x32')][_0x7242('0x35')]?_0x5e79be[_0x7242('0x32')]:_0x5e4a6f[_0x7242('0x2f')];if(_0x278593[_0x7242('0x30')][_0x7242('0x40')]){_0x5e79be[_0x7242('0x47')]=[{'all':!![]}];}_0x5e79be=_['merge']({},_0x5e79be,_0x278593['options']);return db['Disposition'][_0x7242('0x48')](_0x5e79be)[_0x7242('0x22')](handleEntityNotFound(_0x5158a8,null))['then'](respondWithResult(_0x5158a8,null))[_0x7242('0x49')](handleError(_0x5158a8,null));};exports[_0x7242('0x4a')]=function(_0x502193,_0x317f80){return db[_0x7242('0x2c')][_0x7242('0x4a')](_0x502193[_0x7242('0x4b')],{})[_0x7242('0x22')](function(_0x21dc4f){var _0x121ba3=_0x502193[_0x7242('0x4c')][_0x7242('0x4d')]({'plain':!![]});if(!_0x121ba3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x121ba3[_0x7242('0x4e')]===_0x7242('0x4c')){var _0xbfdeeb=_0x21dc4f[_0x7242('0x4d')]({'plain':!![]});var _0x246bf0=_0x7242('0x23');return db['UserProfileSection']['find']({'where':{'name':_0x246bf0,'userProfileId':_0x121ba3[_0x7242('0x4f')]},'raw':!![]})[_0x7242('0x22')](function(_0x2314d3){if(_0x2314d3&&_0x2314d3[_0x7242('0x50')]===0x0){return db[_0x7242('0x24')]['create']({'name':_0xbfdeeb[_0x7242('0x28')],'resourceId':_0xbfdeeb['id'],'type':_0x2314d3[_0x7242('0x28')],'sectionId':_0x2314d3['id']},{})['then'](function(){return _0x21dc4f;});}else{return _0x21dc4f;}})[_0x7242('0x49')](function(_0x34cbbc){logger[_0x7242('0x26')](_0x7242('0x51'),_0x34cbbc);throw _0x34cbbc;});}return _0x21dc4f;})[_0x7242('0x22')](respondWithResult(_0x317f80,0xc9))[_0x7242('0x49')](handleError(_0x317f80,null));};exports['update']=function(_0x3559bf,_0xed538d){if(_0x3559bf[_0x7242('0x4b')]['id']){delete _0x3559bf['body']['id'];}return db['Disposition'][_0x7242('0x48')]({'where':{'id':_0x3559bf[_0x7242('0x44')]['id']}})[_0x7242('0x22')](handleEntityNotFound(_0xed538d,null))[_0x7242('0x22')](saveUpdates(_0x3559bf[_0x7242('0x4b')],null))[_0x7242('0x22')](respondWithResult(_0xed538d,null))[_0x7242('0x49')](handleError(_0xed538d,null));};exports[_0x7242('0x21')]=function(_0x17cbe0,_0x5e8557){return db[_0x7242('0x2c')][_0x7242('0x48')]({'where':{'id':_0x17cbe0[_0x7242('0x44')]['id']}})[_0x7242('0x22')](handleEntityNotFound(_0x5e8557,null))[_0x7242('0x22')](removeEntity(_0x5e8557,null))[_0x7242('0x49')](handleError(_0x5e8557,null));}; \ No newline at end of file +var _0xcc20=['map','Disposition','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','rows','show','params','rawAttributes','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','fast-json-patch','request-promise','bluebird','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','get','Dispositions','end','error','name','send'];(function(_0x33302a,_0x5432ec){var _0x588bcc=function(_0x370cc2){while(--_0x370cc2){_0x33302a['push'](_0x33302a['shift']());}};_0x588bcc(++_0x5432ec);}(_0xcc20,0x114));var _0x0cc2=function(_0x2402b8,_0x574be8){_0x2402b8=_0x2402b8-0x0;var _0x378906=_0xcc20[_0x2402b8];return _0x378906;};'use strict';var emlformat=require(_0x0cc2('0x0'));var rimraf=require(_0x0cc2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0cc2('0x2'));var rp=require(_0x0cc2('0x3'));var moment=require('moment');var BPromise=require(_0x0cc2('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0cc2('0x5'));var sox=require(_0x0cc2('0x6'));var csv=require(_0x0cc2('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0cc2('0x8'));var _=require(_0x0cc2('0x9'));var squel=require('squel');var crypto=require(_0x0cc2('0xa'));var jsforce=require(_0x0cc2('0xb'));var deskjs=require(_0x0cc2('0xc'));var toCsv=require(_0x0cc2('0x7'));var querystring=require(_0x0cc2('0xd'));var Papa=require(_0x0cc2('0xe'));var Redis=require('ioredis');var authService=require(_0x0cc2('0xf'));var qs=require(_0x0cc2('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0cc2('0x11'));var logger=require(_0x0cc2('0x12'))(_0x0cc2('0x13'));var utils=require(_0x0cc2('0x14'));var config=require(_0x0cc2('0x15'));var licenseUtil=require(_0x0cc2('0x16'));var db=require(_0x0cc2('0x17'))['db'];function respondWithStatusCode(_0x2db4af,_0x23e350){_0x23e350=_0x23e350||0xcc;return function(_0x1ca175){if(_0x1ca175){return _0x2db4af[_0x0cc2('0x18')](_0x23e350);}return _0x2db4af['status'](_0x23e350)['end']();};}function respondWithResult(_0x50c282,_0x26a506){_0x26a506=_0x26a506||0xc8;return function(_0x39fb38){if(_0x39fb38){return _0x50c282[_0x0cc2('0x19')](_0x26a506)['json'](_0x39fb38);}};}function respondWithFilteredResult(_0x151644,_0x29b1fd){return function(_0x305d9e){if(_0x305d9e){var _0x2741aa=typeof _0x29b1fd['offset']===_0x0cc2('0x1a')&&typeof _0x29b1fd['limit']===_0x0cc2('0x1a');var _0x215c0e=_0x305d9e[_0x0cc2('0x1b')];var _0x48522a=_0x2741aa?0x0:_0x29b1fd['offset'];var _0xc04f31=_0x2741aa?_0x305d9e[_0x0cc2('0x1b')]:_0x29b1fd[_0x0cc2('0x1c')]+_0x29b1fd[_0x0cc2('0x1d')];var _0x1b1b0d;if(_0xc04f31>=_0x215c0e){_0xc04f31=_0x215c0e;_0x1b1b0d=0xc8;}else{_0x1b1b0d=0xce;}_0x151644[_0x0cc2('0x19')](_0x1b1b0d);return _0x151644[_0x0cc2('0x1e')](_0x0cc2('0x1f'),_0x48522a+'-'+_0xc04f31+'/'+_0x215c0e)[_0x0cc2('0x20')](_0x305d9e);}return null;};}function patchUpdates(_0x102cb2){return function(_0x2f7a42){try{jsonpatch[_0x0cc2('0x21')](_0x2f7a42,_0x102cb2,!![]);}catch(_0x234bc8){return BPromise[_0x0cc2('0x22')](_0x234bc8);}return _0x2f7a42[_0x0cc2('0x23')]();};}function saveUpdates(_0x533bc5,_0x3aefc5){return function(_0x350edd){if(_0x350edd){return _0x350edd['update'](_0x533bc5)[_0x0cc2('0x24')](function(_0x35793c){return _0x35793c;});}return null;};}function removeEntity(_0x18cad3,_0x52289f){return function(_0x50c68c){if(_0x50c68c){return _0x50c68c[_0x0cc2('0x25')]()['then'](function(){var _0x2f55c4=_0x50c68c[_0x0cc2('0x26')]({'plain':!![]});var _0x54702c=_0x0cc2('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x54702c,'resourceId':_0x2f55c4['id']}})[_0x0cc2('0x24')](function(){return _0x50c68c;});})[_0x0cc2('0x24')](function(){_0x18cad3[_0x0cc2('0x19')](0xcc)[_0x0cc2('0x28')]();});}};}function handleEntityNotFound(_0x10c027,_0x230a43){return function(_0x1996da){if(!_0x1996da){_0x10c027['sendStatus'](0x194);}return _0x1996da;};}function handleError(_0x4239ae,_0x41c89a){_0x41c89a=_0x41c89a||0x1f4;return function(_0x5c7fb1){logger[_0x0cc2('0x29')](_0x5c7fb1['stack']);if(_0x5c7fb1[_0x0cc2('0x2a')]){delete _0x5c7fb1[_0x0cc2('0x2a')];}_0x4239ae[_0x0cc2('0x19')](_0x41c89a)[_0x0cc2('0x2b')](_0x5c7fb1);};}exports['index']=function(_0x3e3a53,_0x2d72ab){var _0x499174={},_0x57de66={},_0x52dfbf={'count':0x0,'rows':[]};var _0xc63152=_[_0x0cc2('0x2c')](db[_0x0cc2('0x2d')]['rawAttributes'],function(_0x34c28c){return{'name':_0x34c28c['fieldName'],'type':_0x34c28c['type'][_0x0cc2('0x2e')]};});_0x57de66[_0x0cc2('0x2f')]=_['map'](_0xc63152,'name');_0x57de66[_0x0cc2('0x30')]=_[_0x0cc2('0x31')](_0x3e3a53[_0x0cc2('0x30')]);_0x57de66['filters']=_[_0x0cc2('0x32')](_0x57de66['model'],_0x57de66[_0x0cc2('0x30')]);_0x499174[_0x0cc2('0x33')]=_['intersection'](_0x57de66[_0x0cc2('0x2f')],qs['fields'](_0x3e3a53[_0x0cc2('0x30')][_0x0cc2('0x34')]));_0x499174['attributes']=_0x499174[_0x0cc2('0x33')][_0x0cc2('0x35')]?_0x499174[_0x0cc2('0x33')]:_0x57de66['model'];if(!_0x3e3a53[_0x0cc2('0x30')][_0x0cc2('0x36')](_0x0cc2('0x37'))){_0x499174[_0x0cc2('0x1d')]=qs[_0x0cc2('0x1d')](_0x3e3a53[_0x0cc2('0x30')][_0x0cc2('0x1d')]);_0x499174[_0x0cc2('0x1c')]=qs['offset'](_0x3e3a53[_0x0cc2('0x30')][_0x0cc2('0x1c')]);}_0x499174[_0x0cc2('0x38')]=qs['sort'](_0x3e3a53[_0x0cc2('0x30')][_0x0cc2('0x39')]);_0x499174[_0x0cc2('0x3a')]=qs[_0x0cc2('0x3b')](_[_0x0cc2('0x3c')](_0x3e3a53['query'],_0x57de66[_0x0cc2('0x3b')]),_0xc63152);if(_0x3e3a53[_0x0cc2('0x30')][_0x0cc2('0x3d')]){_0x499174[_0x0cc2('0x3a')]=_['merge'](_0x499174[_0x0cc2('0x3a')],{'$or':_[_0x0cc2('0x2c')](_0xc63152,function(_0x59448e){if(_0x59448e['type']!=='VIRTUAL'){var _0x183865={};_0x183865[_0x59448e[_0x0cc2('0x2a')]]={'$like':'%'+_0x3e3a53[_0x0cc2('0x30')][_0x0cc2('0x3d')]+'%'};return _0x183865;}})});}_0x499174=_[_0x0cc2('0x3e')]({},_0x499174,_0x3e3a53[_0x0cc2('0x3f')]);var _0x4cfc24={'where':_0x499174['where']};return db['Disposition'][_0x0cc2('0x1b')](_0x4cfc24)[_0x0cc2('0x24')](function(_0x5ebaef){_0x52dfbf[_0x0cc2('0x1b')]=_0x5ebaef;if(_0x3e3a53[_0x0cc2('0x30')][_0x0cc2('0x40')]){_0x499174[_0x0cc2('0x41')]=[{'all':!![]}];}return db[_0x0cc2('0x2d')]['findAll'](_0x499174);})[_0x0cc2('0x24')](function(_0x3f3453){_0x52dfbf[_0x0cc2('0x42')]=_0x3f3453;return _0x52dfbf;})[_0x0cc2('0x24')](respondWithFilteredResult(_0x2d72ab,_0x499174))['catch'](handleError(_0x2d72ab,null));};exports[_0x0cc2('0x43')]=function(_0x1d646b,_0x4f05bf){var _0x3c95e9={'raw':!![],'where':{'id':_0x1d646b[_0x0cc2('0x44')]['id']}},_0x3c6e1d={};_0x3c6e1d['model']=_[_0x0cc2('0x31')](db[_0x0cc2('0x2d')][_0x0cc2('0x45')]);_0x3c6e1d[_0x0cc2('0x30')]=_[_0x0cc2('0x31')](_0x1d646b[_0x0cc2('0x30')]);_0x3c6e1d[_0x0cc2('0x3b')]=_['intersection'](_0x3c6e1d[_0x0cc2('0x2f')],_0x3c6e1d[_0x0cc2('0x30')]);_0x3c95e9['attributes']=_[_0x0cc2('0x32')](_0x3c6e1d['model'],qs[_0x0cc2('0x34')](_0x1d646b[_0x0cc2('0x30')][_0x0cc2('0x34')]));_0x3c95e9[_0x0cc2('0x33')]=_0x3c95e9[_0x0cc2('0x33')]['length']?_0x3c95e9[_0x0cc2('0x33')]:_0x3c6e1d[_0x0cc2('0x2f')];if(_0x1d646b[_0x0cc2('0x30')]['includeAll']){_0x3c95e9['include']=[{'all':!![]}];}_0x3c95e9=_[_0x0cc2('0x3e')]({},_0x3c95e9,_0x1d646b[_0x0cc2('0x3f')]);return db[_0x0cc2('0x2d')][_0x0cc2('0x46')](_0x3c95e9)[_0x0cc2('0x24')](handleEntityNotFound(_0x4f05bf,null))[_0x0cc2('0x24')](respondWithResult(_0x4f05bf,null))[_0x0cc2('0x47')](handleError(_0x4f05bf,null));};exports['create']=function(_0x3b74bb,_0x493f3a){return db[_0x0cc2('0x2d')][_0x0cc2('0x48')](_0x3b74bb[_0x0cc2('0x49')],{})[_0x0cc2('0x24')](function(_0x2f6404){var _0x304bc1=_0x3b74bb['user'][_0x0cc2('0x26')]({'plain':!![]});if(!_0x304bc1)throw new Error(_0x0cc2('0x4a'));if(_0x304bc1['role']==='user'){var _0x26acc8=_0x2f6404[_0x0cc2('0x26')]({'plain':!![]});var _0x249272=_0x0cc2('0x27');return db[_0x0cc2('0x4b')][_0x0cc2('0x46')]({'where':{'name':_0x249272,'userProfileId':_0x304bc1['userProfileId']},'raw':!![]})[_0x0cc2('0x24')](function(_0x29cc29){if(_0x29cc29&&_0x29cc29[_0x0cc2('0x4c')]===0x0){return db[_0x0cc2('0x4d')][_0x0cc2('0x48')]({'name':_0x26acc8[_0x0cc2('0x2a')],'resourceId':_0x26acc8['id'],'type':_0x29cc29[_0x0cc2('0x2a')],'sectionId':_0x29cc29['id']},{})['then'](function(){return _0x2f6404;});}else{return _0x2f6404;}})[_0x0cc2('0x47')](function(_0x3d36d7){logger['error'](_0x0cc2('0x4e'),_0x3d36d7);throw _0x3d36d7;});}return _0x2f6404;})[_0x0cc2('0x24')](respondWithResult(_0x493f3a,0xc9))[_0x0cc2('0x47')](handleError(_0x493f3a,null));};exports[_0x0cc2('0x4f')]=function(_0xa0101a,_0x4b2e75){if(_0xa0101a[_0x0cc2('0x49')]['id']){delete _0xa0101a[_0x0cc2('0x49')]['id'];}return db['Disposition'][_0x0cc2('0x46')]({'where':{'id':_0xa0101a['params']['id']}})['then'](handleEntityNotFound(_0x4b2e75,null))['then'](saveUpdates(_0xa0101a[_0x0cc2('0x49')],null))[_0x0cc2('0x24')](respondWithResult(_0x4b2e75,null))[_0x0cc2('0x47')](handleError(_0x4b2e75,null));};exports[_0x0cc2('0x25')]=function(_0x506f53,_0x243fba){return db['Disposition'][_0x0cc2('0x46')]({'where':{'id':_0x506f53[_0x0cc2('0x44')]['id']}})[_0x0cc2('0x24')](handleEntityNotFound(_0x243fba,null))[_0x0cc2('0x24')](removeEntity(_0x243fba,null))[_0x0cc2('0x47')](handleError(_0x243fba,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index b770c5b..258c9b2 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 _0x33bc=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','ListId','ChatWebsiteId','name_mail','name','MailAccountId','name_sms','SmsAccountId','name_fax','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util'];(function(_0x5aa44a,_0x3bb996){var _0x5d0549=function(_0x40b6c1){while(--_0x40b6c1){_0x5aa44a['push'](_0x5aa44a['shift']());}};_0x5d0549(++_0x3bb996);}(_0x33bc,0x15c));var _0xc33b=function(_0x2f4018,_0x2bb2c9){_0x2f4018=_0x2f4018-0x0;var _0x12ac45=_0x33bc[_0x2f4018];return _0x12ac45;};'use strict';var _=require(_0xc33b('0x0'));var util=require(_0xc33b('0x1'));var logger=require(_0xc33b('0x2'))(_0xc33b('0x3'));var moment=require(_0xc33b('0x4'));var BPromise=require(_0xc33b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc33b('0x6'));var config=require(_0xc33b('0x7'));var attributes=require(_0xc33b('0x8'));module[_0xc33b('0x9')]=function(_0x55fe1d,_0x4caccd){return _0x55fe1d[_0xc33b('0xa')](_0xc33b('0xb'),attributes,{'tableName':_0xc33b('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':['name',_0xc33b('0xd')]},{'unique':!![],'name':'name_chat','fields':['name',_0xc33b('0xe')]},{'unique':!![],'name':_0xc33b('0xf'),'fields':[_0xc33b('0x10'),_0xc33b('0x11')]},{'unique':!![],'name':_0xc33b('0x12'),'fields':[_0xc33b('0x10'),_0xc33b('0x13')]},{'unique':!![],'name':_0xc33b('0x14'),'fields':[_0xc33b('0x10'),'FaxAccountId']},{'unique':!![],'name':_0xc33b('0x15'),'fields':['name',_0xc33b('0x16')]},{'unique':!![],'name':_0xc33b('0x17'),'fields':[_0xc33b('0x10'),_0xc33b('0x18')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa633=['ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','SmsAccountId','name_fax','FaxAccountId','name_openchannel','WhatsappAccountId','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./disposition.attributes','Disposition','name_voice','name'];(function(_0x1b4057,_0x58212a){var _0x1d749a=function(_0x1fa30b){while(--_0x1fa30b){_0x1b4057['push'](_0x1b4057['shift']());}};_0x1d749a(++_0x58212a);}(_0xa633,0x128));var _0x3a63=function(_0x567709,_0x6ec004){_0x567709=_0x567709-0x0;var _0x1d2cdb=_0xa633[_0x567709];return _0x1d2cdb;};'use strict';var _=require(_0x3a63('0x0'));var util=require(_0x3a63('0x1'));var logger=require(_0x3a63('0x2'))('api');var moment=require(_0x3a63('0x3'));var BPromise=require(_0x3a63('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3a63('0x5'));var rimraf=require(_0x3a63('0x6'));var config=require(_0x3a63('0x7'));var attributes=require(_0x3a63('0x8'));module['exports']=function(_0x130d7f,_0x94a681){return _0x130d7f['define'](_0x3a63('0x9'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x3a63('0xa'),'fields':[_0x3a63('0xb'),_0x3a63('0xc')]},{'unique':!![],'name':_0x3a63('0xd'),'fields':['name',_0x3a63('0xe')]},{'unique':!![],'name':_0x3a63('0xf'),'fields':[_0x3a63('0xb'),_0x3a63('0x10')]},{'unique':!![],'name':'name_sms','fields':[_0x3a63('0xb'),_0x3a63('0x11')]},{'unique':!![],'name':_0x3a63('0x12'),'fields':[_0x3a63('0xb'),_0x3a63('0x13')]},{'unique':!![],'name':_0x3a63('0x14'),'fields':['name','OpenchannelAccountId']},{'unique':!![],'name':'name_whatsapp','fields':[_0x3a63('0xb'),_0x3a63('0x15')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 4fc845b..c805c17 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(_0x4d3337,_0x3d1c1f){var _0xe4697c=function(_0x12dde9){while(--_0x12dde9){_0x4d3337['push'](_0x4d3337['shift']());}};_0xe4697c(++_0x3d1c1f);}(_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 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(_0x2a9a86,_0x36780d){var _0x278e71=function(_0x2b716c){while(--_0x2b716c){_0x2a9a86['push'](_0x2a9a86['shift']());}};_0x278e71(++_0x36780d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 1c8c3d8..fa6bc04 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 _0xad44=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','/:id','isAuthenticated','show','post','create','put','update','multer','util'];(function(_0x4f6371,_0x56f889){var _0x38651f=function(_0x27be99){while(--_0x27be99){_0x4f6371['push'](_0x4f6371['shift']());}};_0x38651f(++_0x56f889);}(_0xad44,0x141));var _0x4ad4=function(_0x55a89d,_0x584ea7){_0x55a89d=_0x55a89d-0x0;var _0x1b0e5a=_0xad44[_0x55a89d];return _0x1b0e5a;};'use strict';var multer=require(_0x4ad4('0x0'));var util=require(_0x4ad4('0x1'));var path=require(_0x4ad4('0x2'));var timeout=require('connect-timeout');var express=require(_0x4ad4('0x3'));var router=express[_0x4ad4('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4ad4('0x5'));var interaction=require(_0x4ad4('0x6'));var config=require(_0x4ad4('0x7'));var controller=require(_0x4ad4('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x4ad4('0x9')](_0x4ad4('0xa'),auth[_0x4ad4('0xb')](),controller[_0x4ad4('0xc')]);router[_0x4ad4('0xd')]('/',auth[_0x4ad4('0xb')](),controller[_0x4ad4('0xe')]);router[_0x4ad4('0xf')](_0x4ad4('0xa'),auth['isAuthenticated'](),controller[_0x4ad4('0x10')]);router['delete'](_0x4ad4('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc035=['show','post','isAuthenticated','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','/:id'];(function(_0x214266,_0x1f6f52){var _0x568f75=function(_0x541904){while(--_0x541904){_0x214266['push'](_0x214266['shift']());}};_0x568f75(++_0x1f6f52);}(_0xc035,0xf6));var _0x5c03=function(_0x116b75,_0x4d994e){_0x116b75=_0x116b75-0x0;var _0x4e4eee=_0xc035[_0x116b75];return _0x4e4eee;};'use strict';var multer=require(_0x5c03('0x0'));var util=require('util');var path=require(_0x5c03('0x1'));var timeout=require(_0x5c03('0x2'));var express=require(_0x5c03('0x3'));var router=express['Router']();var fs_extra=require(_0x5c03('0x4'));var auth=require(_0x5c03('0x5'));var interaction=require(_0x5c03('0x6'));var config=require('../../config/environment');var controller=require('./disposition.controller');router[_0x5c03('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5c03('0x7')](_0x5c03('0x8'),auth['isAuthenticated'](),controller[_0x5c03('0x9')]);router[_0x5c03('0xa')]('/',auth[_0x5c03('0xb')](),controller['create']);router['put']('/:id',auth[_0x5c03('0xb')](),controller[_0x5c03('0xc')]);router['delete'](_0x5c03('0x8'),auth[_0x5c03('0xb')](),controller[_0x5c03('0xd')]);module[_0x5c03('0xe')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 8c1a90e..2b706f7 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 _0x012b=['exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','7200','9600','12000','14400','4800','v17,v27,v29','INTEGER','SIP','IAX','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','sequelize'];(function(_0x144adf,_0x41eeab){var _0xbbedd7=function(_0x10a060){while(--_0x10a060){_0x144adf['push'](_0x144adf['shift']());}};_0xbbedd7(++_0x41eeab);}(_0x012b,0x137));var _0xb012=function(_0x719d9a,_0x12196c){_0x719d9a=_0x719d9a-0x0;var _0x3ead62=_0x012b[_0x719d9a];return _0x3ead62;};'use strict';var Sequelize=require(_0xb012('0x0'));module[_0xb012('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb012('0x2')]},'ecm':{'type':Sequelize[_0xb012('0x3')]('yes','no'),'defaultValue':_0xb012('0x4')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0xb012('0x5')},'localstationid':{'type':Sequelize[_0xb012('0x2')],'unique':_0xb012('0x6')},'minrate':{'type':Sequelize[_0xb012('0x3')](_0xb012('0x7'),'4800',_0xb012('0x8'),_0xb012('0x9'),_0xb012('0xa'),_0xb012('0xb')),'defaultValue':_0xb012('0xc')},'maxrate':{'type':Sequelize[_0xb012('0x3')](_0xb012('0x7'),_0xb012('0xc'),_0xb012('0x8'),_0xb012('0x9'),_0xb012('0xa'),_0xb012('0xb')),'defaultValue':_0xb012('0xb')},'modem':{'type':Sequelize[_0xb012('0x2')],'defaultValue':_0xb012('0xd')},'gateway':{'type':Sequelize[_0xb012('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xb012('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xb012('0xe')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0xb012('0xf'),_0xb012('0x10'),_0xb012('0x11'),_0xb012('0x12')),'defaultValue':_0xb012('0xf')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xb012('0x13')],'defaultValue':function(){return _0xb012('0x14');}},'notificationSound':{'type':Sequelize[_0xb012('0x15')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb012('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xb012('0x15')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb012('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb012('0x15')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb012('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb012('0xe')],'allowNull':!![],'defaultValue':null,'comment':_0xb012('0x16')},'mandatoryDisposition':{'type':Sequelize[_0xb012('0x15')],'defaultValue':![],'comment':_0xb012('0x17'),'set':function(_0x2ce7d3){if(!_0x2ce7d3)this[_0xb012('0x18')]('mandatoryDispositionPauseId',null);this[_0xb012('0x18')](_0xb012('0x19'),_0x2ce7d3);}}}; \ No newline at end of file +var _0x2005=['mandatoryDisposition','sequelize','exports','STRING','ENUM','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','9600','14400','12000','v17,v27,v29','SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x5eb045,_0x44506e){var _0x270fb9=function(_0xfe4320){while(--_0xfe4320){_0x5eb045['push'](_0x5eb045['shift']());}};_0x270fb9(++_0x44506e);}(_0x2005,0xc9));var _0x5200=function(_0x391635,_0x25d933){_0x391635=_0x391635-0x0;var _0x11c075=_0x2005[_0x391635];return _0x11c075;};'use strict';var Sequelize=require(_0x5200('0x0'));module[_0x5200('0x1')]={'name':{'type':Sequelize[_0x5200('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x5200('0x2')]},'ecm':{'type':Sequelize[_0x5200('0x3')]('yes','no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x5200('0x2')],'defaultValue':_0x5200('0x4')},'localstationid':{'type':Sequelize['STRING'],'unique':_0x5200('0x5')},'minrate':{'type':Sequelize['ENUM'](_0x5200('0x6'),_0x5200('0x7'),_0x5200('0x8'),_0x5200('0x9'),'12000',_0x5200('0xa')),'defaultValue':_0x5200('0x7')},'maxrate':{'type':Sequelize[_0x5200('0x3')](_0x5200('0x6'),_0x5200('0x7'),_0x5200('0x8'),_0x5200('0x9'),_0x5200('0xb'),_0x5200('0xa')),'defaultValue':'14400'},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x5200('0xc')},'gateway':{'type':Sequelize[_0x5200('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x5200('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x5200('0x3')](_0x5200('0xd'),_0x5200('0xe'),_0x5200('0xf'),_0x5200('0x10')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0x5200('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x5200('0x11')],'defaultValue':function(){return _0x5200('0x12');}},'notificationSound':{'type':Sequelize[_0x5200('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5200('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5200('0x14')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x5200('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5200('0x14')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5200('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5200('0x14')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5200('0x14')],'allowNull':!![],'defaultValue':null,'comment':_0x5200('0x15')},'mandatoryDisposition':{'type':Sequelize[_0x5200('0x13')],'defaultValue':![],'comment':_0x5200('0x16'),'set':function(_0xa8a1bf){if(!_0xa8a1bf)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x5200('0x17')](_0x5200('0x18'),_0xa8a1bf);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index dad731b..61d16c8 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 _0x17fc=['getDispositions','findOne','Disposition','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','includeAll','removeAnswers','addInteraction','FaxInteraction','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tags','color','addApplications','sequelize','transaction','FaxApplication','priority','getApplications','context','from-voip-provider','exten','localstationid','app','description','appdata','Answer','push','CDR(type)=inbound-fax','Set','ecm','faxdetect','headerinfo','minrate','modem','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','bulkCreate','VoiceExtension','tech','createdAt','updatedAt','TrunkId','ListId','findById','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','DESC','attachments','server/files/attachments','basename','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','fax','Send\x20Fax\x20failed','filename','Messages','out','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','omit','emit','userFaxAccount:save','removeAgents','isArray','getAgents','eml-format','zip-dir','request-promise','bluebird','mustache','util','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','offset','limit','undefined','count','set','json','apply','reject','save','update','destroy','FaxAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','FaxAccountId'];(function(_0x3a64d1,_0x4314d8){var _0x449e12=function(_0x2abb13){while(--_0x2abb13){_0x3a64d1['push'](_0x3a64d1['shift']());}};_0x449e12(++_0x4314d8);}(_0x17fc,0x117));var _0xc17f=function(_0x4efc27,_0x479bae){_0x4efc27=_0x4efc27-0x0;var _0x26d952=_0x17fc[_0x4efc27];return _0x26d952;};'use strict';var emlformat=require(_0xc17f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc17f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc17f('0x2'));var moment=require('moment');var BPromise=require(_0xc17f('0x3'));var Mustache=require(_0xc17f('0x4'));var util=require(_0xc17f('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc17f('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc17f('0x7'));var squel=require('squel');var crypto=require(_0xc17f('0x8'));var jsforce=require(_0xc17f('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc17f('0xa'));var Papa=require(_0xc17f('0xb'));var Redis=require(_0xc17f('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xc17f('0xd'));var as=require(_0xc17f('0xe'));var hardwareService=require(_0xc17f('0xf'));var logger=require('../../config/logger')(_0xc17f('0x10'));var utils=require(_0xc17f('0x11'));var config=require(_0xc17f('0x12'));var licenseUtil=require(_0xc17f('0x13'));var db=require(_0xc17f('0x14'))['db'];config[_0xc17f('0x15')]=_[_0xc17f('0x16')](config[_0xc17f('0x15')],{'host':_0xc17f('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxAccount.socket')[_0xc17f('0x18')](socket);var jayson=require(_0xc17f('0x19'));var client=jayson[_0xc17f('0x1a')]['http']({'port':0x232c});var client9002=jayson[_0xc17f('0x1a')][_0xc17f('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x2516b1,_0x597473,_0x4f18b3,_0x313b9b){return new BPromise(function(_0x39eb4e,_0x30119d){var _0x13eebb=_0x313b9b||client;return _0x13eebb[_0xc17f('0x1c')](_0x2516b1,_0x4f18b3)[_0xc17f('0x1d')](function(_0x3f7017){logger[_0xc17f('0x1e')](_0xc17f('0x1f'),_0x597473,'request\x20sent');logger[_0xc17f('0x20')](_0xc17f('0x21'),_0x597473,_0xc17f('0x22'),JSON['stringify'](_0x3f7017));if(_0x3f7017[_0xc17f('0x23')]){if(_0x3f7017[_0xc17f('0x23')][_0xc17f('0x24')]===0x1f4){logger[_0xc17f('0x23')](_0xc17f('0x1f'),_0x597473,_0x3f7017['error'][_0xc17f('0x25')]);return _0x30119d(_0x3f7017[_0xc17f('0x23')][_0xc17f('0x25')]);}logger[_0xc17f('0x23')](_0xc17f('0x1f'),_0x597473,_0x3f7017[_0xc17f('0x23')][_0xc17f('0x25')]);return _0x39eb4e(_0x3f7017[_0xc17f('0x23')][_0xc17f('0x25')]);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x597473,_0xc17f('0x22'));_0x39eb4e(_0x3f7017[_0xc17f('0x26')][_0xc17f('0x25')]);}})[_0xc17f('0x27')](function(_0x54bfca){logger[_0xc17f('0x23')](_0xc17f('0x1f'),_0x597473,_0x54bfca);_0x30119d(_0x54bfca);});});}function respondWithStatusCode(_0x31a2a4,_0x3f7d43){_0x3f7d43=_0x3f7d43||0xcc;return function(_0x133650){if(_0x133650){return _0x31a2a4[_0xc17f('0x28')](_0x3f7d43);}return _0x31a2a4[_0xc17f('0x29')](_0x3f7d43)[_0xc17f('0x2a')]();};}function respondWithResult(_0x2dab5b,_0x20b2f9){_0x20b2f9=_0x20b2f9||0xc8;return function(_0x9c3585){if(_0x9c3585){return _0x2dab5b[_0xc17f('0x29')](_0x20b2f9)['json'](_0x9c3585);}};}function respondWithFilteredResult(_0x2a87bc,_0x3e6481){return function(_0x48429c){if(_0x48429c){var _0x229784=typeof _0x3e6481[_0xc17f('0x2b')]==='undefined'&&typeof _0x3e6481[_0xc17f('0x2c')]===_0xc17f('0x2d');var _0x3a0b90=_0x48429c[_0xc17f('0x2e')];var _0x3dff2e=_0x229784?0x0:_0x3e6481[_0xc17f('0x2b')];var _0x490526=_0x229784?_0x48429c[_0xc17f('0x2e')]:_0x3e6481['offset']+_0x3e6481[_0xc17f('0x2c')];var _0x3234fb;if(_0x490526>=_0x3a0b90){_0x490526=_0x3a0b90;_0x3234fb=0xc8;}else{_0x3234fb=0xce;}_0x2a87bc[_0xc17f('0x29')](_0x3234fb);return _0x2a87bc[_0xc17f('0x2f')]('Content-Range',_0x3dff2e+'-'+_0x490526+'/'+_0x3a0b90)[_0xc17f('0x30')](_0x48429c);}return null;};}function patchUpdates(_0xfbf7c6){return function(_0xd41fab){try{jsonpatch[_0xc17f('0x31')](_0xd41fab,_0xfbf7c6,!![]);}catch(_0x4aeaff){return BPromise[_0xc17f('0x32')](_0x4aeaff);}return _0xd41fab[_0xc17f('0x33')]();};}function saveUpdates(_0x260b9d,_0x1a99f0){return function(_0x206212){if(_0x206212){return _0x206212[_0xc17f('0x34')](_0x260b9d)[_0xc17f('0x1d')](function(_0x22a2d4){return _0x22a2d4;});}return null;};}function removeEntity(_0x19293b,_0x435430){return function(_0x22de0b){if(_0x22de0b){return _0x22de0b[_0xc17f('0x35')]()[_0xc17f('0x1d')](function(){var _0x5a1a92=_0x22de0b['get']({'plain':!![]});var _0xabac48=_0xc17f('0x36');return db[_0xc17f('0x37')][_0xc17f('0x35')]({'where':{'type':_0xabac48,'resourceId':_0x5a1a92['id']}})[_0xc17f('0x1d')](function(){return _0x22de0b;});})[_0xc17f('0x1d')](function(){_0x19293b[_0xc17f('0x29')](0xcc)[_0xc17f('0x2a')]();});}};}function handleEntityNotFound(_0x1aef92,_0x3a35c8){return function(_0x23a9c1){if(!_0x23a9c1){_0x1aef92['sendStatus'](0x194);}return _0x23a9c1;};}function handleError(_0x49d009,_0x87a758){_0x87a758=_0x87a758||0x1f4;return function(_0x193202){logger[_0xc17f('0x23')](_0x193202[_0xc17f('0x38')]);if(_0x193202[_0xc17f('0x39')]){delete _0x193202[_0xc17f('0x39')];}_0x49d009[_0xc17f('0x29')](_0x87a758)[_0xc17f('0x3a')](_0x193202);};}exports[_0xc17f('0x3b')]=function(_0x179812,_0x1056f9){var _0x2d725d={'include':[{'model':db[_0xc17f('0x3c')],'as':_0xc17f('0x3d')}]},_0x5ce452={},_0x4a6f90={'count':0x0,'rows':[]};var _0x5740df=_[_0xc17f('0x3e')](db[_0xc17f('0x3f')][_0xc17f('0x40')],function(_0x2b8de4){return{'name':_0x2b8de4[_0xc17f('0x41')],'type':_0x2b8de4[_0xc17f('0x42')][_0xc17f('0x43')]};});_0x5ce452[_0xc17f('0x44')]=_['map'](_0x5740df,'name');_0x5ce452['query']=_[_0xc17f('0x45')](_0x179812['query']);_0x5ce452[_0xc17f('0x46')]=_[_0xc17f('0x47')](_0x5ce452[_0xc17f('0x44')],_0x5ce452[_0xc17f('0x48')]);_0x2d725d['attributes']=_[_0xc17f('0x47')](_0x5ce452[_0xc17f('0x44')],qs[_0xc17f('0x49')](_0x179812[_0xc17f('0x48')][_0xc17f('0x49')]));_0x2d725d[_0xc17f('0x4a')]=_0x2d725d[_0xc17f('0x4a')][_0xc17f('0x4b')]?_0x2d725d[_0xc17f('0x4a')]:_0x5ce452[_0xc17f('0x44')];if(!_0x179812[_0xc17f('0x48')][_0xc17f('0x4c')](_0xc17f('0x4d'))){_0x2d725d['limit']=qs[_0xc17f('0x2c')](_0x179812[_0xc17f('0x48')][_0xc17f('0x2c')]);_0x2d725d[_0xc17f('0x2b')]=qs[_0xc17f('0x2b')](_0x179812[_0xc17f('0x48')][_0xc17f('0x2b')]);}_0x2d725d[_0xc17f('0x4e')]=qs[_0xc17f('0x4f')](_0x179812[_0xc17f('0x48')][_0xc17f('0x4f')]);_0x2d725d[_0xc17f('0x50')]=qs[_0xc17f('0x46')](_[_0xc17f('0x51')](_0x179812['query'],_0x5ce452[_0xc17f('0x46')]),_0x5740df);if(_0x179812[_0xc17f('0x48')][_0xc17f('0x52')]){_0x2d725d[_0xc17f('0x50')]=_[_0xc17f('0x53')](_0x2d725d[_0xc17f('0x50')],{'$or':_[_0xc17f('0x3e')](_0x5740df,function(_0x17aae1){if(_0x17aae1[_0xc17f('0x42')]!==_0xc17f('0x54')){var _0x34c26e={};_0x34c26e[_0x17aae1['name']]={'$like':'%'+_0x179812[_0xc17f('0x48')]['filter']+'%'};return _0x34c26e;}})});}_0x2d725d=_[_0xc17f('0x53')]({},_0x2d725d,_0x179812[_0xc17f('0x55')]);var _0xac8a91={'where':_0x2d725d[_0xc17f('0x50')]};return db[_0xc17f('0x3f')][_0xc17f('0x2e')](_0xac8a91)[_0xc17f('0x1d')](function(_0x1cf163){_0x4a6f90[_0xc17f('0x2e')]=_0x1cf163;if(_0x179812[_0xc17f('0x48')]['includeAll']){_0x2d725d[_0xc17f('0x56')]=[{'all':!![]}];}return db[_0xc17f('0x3f')][_0xc17f('0x57')](_0x2d725d);})[_0xc17f('0x1d')](function(_0x35a148){_0x4a6f90[_0xc17f('0x58')]=_0x35a148;return _0x4a6f90;})[_0xc17f('0x1d')](respondWithFilteredResult(_0x1056f9,_0x2d725d))[_0xc17f('0x27')](handleError(_0x1056f9,null));};exports[_0xc17f('0x59')]=function(_0x5a9450,_0x257fd8){var _0x4d759e={'raw':![],'where':{'id':_0x5a9450[_0xc17f('0x5a')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x165e81={};_0x165e81[_0xc17f('0x44')]=_[_0xc17f('0x45')](db[_0xc17f('0x3f')][_0xc17f('0x40')]);_0x165e81[_0xc17f('0x48')]=_[_0xc17f('0x45')](_0x5a9450[_0xc17f('0x48')]);_0x165e81[_0xc17f('0x46')]=_[_0xc17f('0x47')](_0x165e81['model'],_0x165e81['query']);_0x4d759e['attributes']=_[_0xc17f('0x47')](_0x165e81['model'],qs[_0xc17f('0x49')](_0x5a9450['query'][_0xc17f('0x49')]));_0x4d759e['attributes']=_0x4d759e[_0xc17f('0x4a')][_0xc17f('0x4b')]?_0x4d759e[_0xc17f('0x4a')]:_0x165e81[_0xc17f('0x44')];if(_0x5a9450[_0xc17f('0x48')]['includeAll']){_0x4d759e['include']=[{'all':!![]}];}_0x4d759e=_[_0xc17f('0x53')]({},_0x4d759e,_0x5a9450[_0xc17f('0x55')]);return db[_0xc17f('0x3f')]['find'](_0x4d759e)[_0xc17f('0x1d')](handleEntityNotFound(_0x257fd8,null))[_0xc17f('0x1d')](respondWithResult(_0x257fd8,null))['catch'](handleError(_0x257fd8,null));};exports[_0xc17f('0x5b')]=function(_0x1990e1,_0x3374af){return db[_0xc17f('0x3f')][_0xc17f('0x5b')](_0x1990e1[_0xc17f('0x5c')],{})[_0xc17f('0x1d')](function(_0x29dc99){var _0x3b0535=_0x1990e1['user'][_0xc17f('0x5d')]({'plain':!![]});if(!_0x3b0535)throw new Error(_0xc17f('0x5e'));if(_0x3b0535[_0xc17f('0x5f')]===_0xc17f('0x60')){var _0x366412=_0x29dc99[_0xc17f('0x5d')]({'plain':!![]});var _0x34f621=_0xc17f('0x36');return db[_0xc17f('0x61')]['find']({'where':{'name':_0x34f621,'userProfileId':_0x3b0535[_0xc17f('0x62')]},'raw':!![]})[_0xc17f('0x1d')](function(_0x2a15b7){if(_0x2a15b7&&_0x2a15b7['autoAssociation']===0x0){return db[_0xc17f('0x37')]['create']({'name':_0x366412[_0xc17f('0x39')],'resourceId':_0x366412['id'],'type':_0x2a15b7[_0xc17f('0x39')],'sectionId':_0x2a15b7['id']},{})[_0xc17f('0x1d')](function(){return _0x29dc99;});}else{return _0x29dc99;}})[_0xc17f('0x27')](function(_0x17464a){logger[_0xc17f('0x23')](_0xc17f('0x63'),_0x17464a);throw _0x17464a;});}return _0x29dc99;})[_0xc17f('0x1d')](respondWithResult(_0x3374af,0xc9))[_0xc17f('0x27')](handleError(_0x3374af,null));};exports[_0xc17f('0x34')]=function(_0x3b525d,_0xc84c2f){if(_0x3b525d[_0xc17f('0x5c')]['id']){delete _0x3b525d['body']['id'];}return db[_0xc17f('0x3f')][_0xc17f('0x64')]({'where':{'id':_0x3b525d[_0xc17f('0x5a')]['id']},'include':[{'model':db['Pause'],'as':_0xc17f('0x3d')}]})['then'](handleEntityNotFound(_0xc84c2f,null))['then'](saveUpdates(_0x3b525d[_0xc17f('0x5c')],null))[_0xc17f('0x1d')](respondWithResult(_0xc84c2f,null))[_0xc17f('0x27')](handleError(_0xc84c2f,null));};exports['destroy']=function(_0x144b55,_0x2108b8){return db[_0xc17f('0x3f')][_0xc17f('0x64')]({'where':{'id':_0x144b55[_0xc17f('0x5a')]['id']}})[_0xc17f('0x1d')](handleEntityNotFound(_0x2108b8,null))['then'](removeEntity(_0x2108b8,null))[_0xc17f('0x27')](handleError(_0x2108b8,null));};exports[_0xc17f('0x65')]=function(_0x5ea3f0,_0x4e6a12){return db['FaxAccount']['describe']()[_0xc17f('0x1d')](respondWithResult(_0x4e6a12,null))[_0xc17f('0x27')](handleError(_0x4e6a12,null));};exports['addDisposition']=function(_0x186e89,_0x573dab,_0x19b146){if(_0x186e89[_0xc17f('0x5c')]['id']){delete _0x186e89[_0xc17f('0x5c')]['id'];}return db[_0xc17f('0x3f')]['find']({'where':{'id':_0x186e89[_0xc17f('0x5a')]['id']}})[_0xc17f('0x1d')](handleEntityNotFound(_0x573dab,null))[_0xc17f('0x1d')](function(_0x439b7a){if(_0x439b7a){_0x186e89[_0xc17f('0x5c')][_0xc17f('0x66')]=_0x439b7a['id'];return db['Disposition'][_0xc17f('0x5b')](_0x186e89[_0xc17f('0x5c')]);}})[_0xc17f('0x1d')](respondWithResult(_0x573dab,null))[_0xc17f('0x27')](handleError(_0x573dab,null));};exports[_0xc17f('0x67')]=function(_0xcaa9c3,_0x27541f,_0x56e7c8){var _0x268a5a={'raw':![],'where':{}};var _0x2c12cf={};var _0x12e3d3={'count':0x0,'rows':[]};return db[_0xc17f('0x3f')][_0xc17f('0x68')]({'where':{'id':_0xcaa9c3[_0xc17f('0x5a')]['id']}})[_0xc17f('0x1d')](handleEntityNotFound(_0x27541f,null))[_0xc17f('0x1d')](function(_0x42dc53){if(_0x42dc53){_0x2c12cf[_0xc17f('0x44')]=_['keys'](db[_0xc17f('0x69')][_0xc17f('0x40')]);_0x2c12cf[_0xc17f('0x48')]=_['keys'](_0xcaa9c3[_0xc17f('0x48')]);_0x2c12cf[_0xc17f('0x46')]=_[_0xc17f('0x47')](_0x2c12cf['model'],_0x2c12cf[_0xc17f('0x48')]);_0x268a5a['attributes']=_[_0xc17f('0x47')](_0x2c12cf['model'],qs[_0xc17f('0x49')](_0xcaa9c3['query'][_0xc17f('0x49')]));_0x268a5a[_0xc17f('0x4a')]=_0x268a5a[_0xc17f('0x4a')][_0xc17f('0x4b')]?_0x268a5a[_0xc17f('0x4a')]:_0x2c12cf['model'];if(!_0xcaa9c3[_0xc17f('0x48')][_0xc17f('0x4c')](_0xc17f('0x4d'))){_0x268a5a[_0xc17f('0x2c')]=qs[_0xc17f('0x2c')](_0xcaa9c3[_0xc17f('0x48')][_0xc17f('0x2c')]);_0x268a5a[_0xc17f('0x2b')]=qs[_0xc17f('0x2b')](_0xcaa9c3['query'][_0xc17f('0x2b')]);}_0x268a5a[_0xc17f('0x4e')]=qs[_0xc17f('0x4f')](_0xcaa9c3[_0xc17f('0x48')][_0xc17f('0x4f')]);_0x268a5a[_0xc17f('0x50')]=qs[_0xc17f('0x46')](_[_0xc17f('0x51')](_0xcaa9c3[_0xc17f('0x48')],_0x2c12cf[_0xc17f('0x46')]));_0x268a5a[_0xc17f('0x50')][_0xc17f('0x66')]=_0x42dc53['id'];if(_0xcaa9c3['query'][_0xc17f('0x52')]){_0x268a5a['where']=_[_0xc17f('0x53')](_0x268a5a['where'],{'$or':_[_0xc17f('0x3e')](_0x268a5a['attributes'],function(_0xeab239){var _0x11e694={};_0x11e694[_0xeab239]={'$like':'%'+_0xcaa9c3[_0xc17f('0x48')][_0xc17f('0x52')]+'%'};return _0x11e694;})});}_0x268a5a=_['merge']({},_0x268a5a,_0xcaa9c3['options']);return db[_0xc17f('0x69')]['count']({'where':_0x268a5a[_0xc17f('0x50')]})[_0xc17f('0x1d')](function(_0x117ba1){_0x12e3d3[_0xc17f('0x2e')]=_0x117ba1;if(_0xcaa9c3[_0xc17f('0x48')]['includeAll']){_0x268a5a[_0xc17f('0x56')]=[{'all':!![]}];}return db[_0xc17f('0x69')][_0xc17f('0x57')](_0x268a5a);})[_0xc17f('0x1d')](function(_0x232d16){_0x12e3d3[_0xc17f('0x58')]=_0x232d16;return _0x12e3d3;});}})[_0xc17f('0x1d')](respondWithFilteredResult(_0x27541f,_0x268a5a))[_0xc17f('0x27')](handleError(_0x27541f,null));};exports[_0xc17f('0x6a')]=function(_0x1d7e49,_0x50e440,_0xf3af57){return db[_0xc17f('0x3f')]['find']({'where':{'id':_0x1d7e49[_0xc17f('0x5a')]['id']}})['then'](handleEntityNotFound(_0x50e440,null))[_0xc17f('0x1d')](function(_0x42bf85){if(_0x42bf85){return _0x42bf85['removeDispositions'](_0x1d7e49[_0xc17f('0x48')][_0xc17f('0x6b')]);}})['then'](respondWithStatusCode(_0x50e440,null))['catch'](handleError(_0x50e440,null));};exports[_0xc17f('0x6c')]=function(_0x25379b,_0x3b0fa8,_0x4f1f71){if(_0x25379b['body']['id']){delete _0x25379b[_0xc17f('0x5c')]['id'];}return db['FaxAccount'][_0xc17f('0x64')]({'where':{'id':_0x25379b[_0xc17f('0x5a')]['id']}})[_0xc17f('0x1d')](handleEntityNotFound(_0x3b0fa8,null))['then'](function(_0x349502){if(_0x349502){_0x25379b[_0xc17f('0x5c')]['FaxAccountId']=_0x349502['id'];return db['CannedAnswer'][_0xc17f('0x5b')](_0x25379b[_0xc17f('0x5c')]);}})['then'](respondWithResult(_0x3b0fa8,null))['catch'](handleError(_0x3b0fa8,null));};exports[_0xc17f('0x6d')]=function(_0x1116fa,_0x2d4209,_0x4e03b2){var _0x26161a={'raw':![],'where':{}};var _0x5bc9db={};var _0x3b3459={'count':0x0,'rows':[]};return db['FaxAccount'][_0xc17f('0x68')]({'where':{'id':_0x1116fa['params']['id']}})[_0xc17f('0x1d')](handleEntityNotFound(_0x2d4209,null))['then'](function(_0x336a50){if(_0x336a50){_0x5bc9db[_0xc17f('0x44')]=_[_0xc17f('0x45')](db['CannedAnswer'][_0xc17f('0x40')]);_0x5bc9db['query']=_[_0xc17f('0x45')](_0x1116fa[_0xc17f('0x48')]);_0x5bc9db['filters']=_[_0xc17f('0x47')](_0x5bc9db['model'],_0x5bc9db[_0xc17f('0x48')]);_0x26161a['attributes']=_[_0xc17f('0x47')](_0x5bc9db[_0xc17f('0x44')],qs[_0xc17f('0x49')](_0x1116fa[_0xc17f('0x48')]['fields']));_0x26161a[_0xc17f('0x4a')]=_0x26161a[_0xc17f('0x4a')][_0xc17f('0x4b')]?_0x26161a['attributes']:_0x5bc9db[_0xc17f('0x44')];if(!_0x1116fa[_0xc17f('0x48')][_0xc17f('0x4c')]('nolimit')){_0x26161a['limit']=qs[_0xc17f('0x2c')](_0x1116fa[_0xc17f('0x48')][_0xc17f('0x2c')]);_0x26161a[_0xc17f('0x2b')]=qs[_0xc17f('0x2b')](_0x1116fa[_0xc17f('0x48')][_0xc17f('0x2b')]);}_0x26161a[_0xc17f('0x4e')]=qs[_0xc17f('0x4f')](_0x1116fa[_0xc17f('0x48')][_0xc17f('0x4f')]);_0x26161a[_0xc17f('0x50')]=qs[_0xc17f('0x46')](_[_0xc17f('0x51')](_0x1116fa[_0xc17f('0x48')],_0x5bc9db['filters']));_0x26161a['where'][_0xc17f('0x66')]=_0x336a50['id'];if(_0x1116fa[_0xc17f('0x48')]['filter']){_0x26161a['where']=_['merge'](_0x26161a[_0xc17f('0x50')],{'$or':_[_0xc17f('0x3e')](_0x26161a[_0xc17f('0x4a')],function(_0x5ccd71){var _0x4cd642={};_0x4cd642[_0x5ccd71]={'$like':'%'+_0x1116fa['query'][_0xc17f('0x52')]+'%'};return _0x4cd642;})});}_0x26161a=_[_0xc17f('0x53')]({},_0x26161a,_0x1116fa[_0xc17f('0x55')]);return db[_0xc17f('0x6e')][_0xc17f('0x2e')]({'where':_0x26161a[_0xc17f('0x50')]})['then'](function(_0x49f55b){_0x3b3459[_0xc17f('0x2e')]=_0x49f55b;if(_0x1116fa[_0xc17f('0x48')][_0xc17f('0x6f')]){_0x26161a[_0xc17f('0x56')]=[{'all':!![]}];}return db[_0xc17f('0x6e')]['findAll'](_0x26161a);})['then'](function(_0x7663b2){_0x3b3459[_0xc17f('0x58')]=_0x7663b2;return _0x3b3459;});}})['then'](respondWithFilteredResult(_0x2d4209,_0x26161a))[_0xc17f('0x27')](handleError(_0x2d4209,null));};exports[_0xc17f('0x70')]=function(_0x26261c,_0x13a3f1,_0x351ccc){return db['FaxAccount'][_0xc17f('0x64')]({'where':{'id':_0x26261c[_0xc17f('0x5a')]['id']}})['then'](handleEntityNotFound(_0x13a3f1,null))[_0xc17f('0x1d')](function(_0x2998fa){if(_0x2998fa){return _0x2998fa[_0xc17f('0x70')](_0x26261c[_0xc17f('0x48')][_0xc17f('0x6b')]);}})[_0xc17f('0x1d')](respondWithStatusCode(_0x13a3f1,null))[_0xc17f('0x27')](handleError(_0x13a3f1,null));};exports[_0xc17f('0x71')]=function(_0x26ca23,_0x5debb8,_0x5dde78){return db[_0xc17f('0x72')][_0xc17f('0x64')]({'where':{'id':_0x26ca23[_0xc17f('0x5a')]['id']}})[_0xc17f('0x1d')](handleEntityNotFound(_0x5debb8,null))[_0xc17f('0x1d')](function(_0x18e00f){if(_0x18e00f){return _0x18e00f['addInteraction'](_0x26ca23['body'][_0xc17f('0x6b')],_['omit'](_0x26ca23[_0xc17f('0x5c')],[_0xc17f('0x6b'),'id'])||{});}})[_0xc17f('0x1d')](respondWithResult(_0x5debb8,null))[_0xc17f('0x27')](handleError(_0x5debb8,null));};exports[_0xc17f('0x73')]=function(_0x3f3b78,_0x4b3bc7,_0x41f55e){var _0x30bf7a={'raw':![],'where':{}};var _0x43ee45={};var _0x235e5b={'count':0x0,'rows':[]};return db['FaxAccount'][_0xc17f('0x68')]({'where':{'id':_0x3f3b78[_0xc17f('0x5a')]['id']}})[_0xc17f('0x1d')](handleEntityNotFound(_0x4b3bc7,null))[_0xc17f('0x1d')](function(_0x20c96b){if(_0x20c96b){_0x43ee45['model']=_[_0xc17f('0x45')](db[_0xc17f('0x72')][_0xc17f('0x40')]);_0x43ee45[_0xc17f('0x48')]=_[_0xc17f('0x45')](_0x3f3b78['query']);_0x43ee45[_0xc17f('0x46')]=_['intersection'](_0x43ee45[_0xc17f('0x44')],_0x43ee45['query']);_0x30bf7a[_0xc17f('0x4a')]=_['intersection'](_0x43ee45['model'],qs[_0xc17f('0x49')](_0x3f3b78[_0xc17f('0x48')][_0xc17f('0x49')]));_0x30bf7a[_0xc17f('0x4a')]=_0x30bf7a[_0xc17f('0x4a')]['length']?_0x30bf7a[_0xc17f('0x4a')]:_0x43ee45[_0xc17f('0x44')];if(!_0x3f3b78['query']['hasOwnProperty'](_0xc17f('0x4d'))){_0x30bf7a[_0xc17f('0x2c')]=qs['limit'](_0x3f3b78[_0xc17f('0x48')][_0xc17f('0x2c')]);_0x30bf7a[_0xc17f('0x2b')]=qs[_0xc17f('0x2b')](_0x3f3b78[_0xc17f('0x48')][_0xc17f('0x2b')]);}_0x30bf7a[_0xc17f('0x4e')]=qs[_0xc17f('0x4f')](_0x3f3b78[_0xc17f('0x48')]['sort']);_0x30bf7a['where']=qs[_0xc17f('0x46')](_[_0xc17f('0x51')](_0x3f3b78[_0xc17f('0x48')],_0x43ee45[_0xc17f('0x46')]));_0x30bf7a['where'][_0xc17f('0x66')]=_0x20c96b['id'];if(_0x3f3b78['query'][_0xc17f('0x52')]){_0x30bf7a[_0xc17f('0x50')]=_[_0xc17f('0x53')](_0x30bf7a[_0xc17f('0x50')],{'$or':_[_0xc17f('0x3e')](_0x30bf7a['attributes'],function(_0x7e061b){var _0x46f48e={};_0x46f48e[_0x7e061b]={'$like':'%'+_0x3f3b78[_0xc17f('0x48')][_0xc17f('0x52')]+'%'};return _0x46f48e;})});}_0x30bf7a=_[_0xc17f('0x53')]({},_0x30bf7a,_0x3f3b78[_0xc17f('0x55')]);return db[_0xc17f('0x72')][_0xc17f('0x2e')]({'where':_0x30bf7a['where']})['then'](function(_0x20afb1){_0x235e5b[_0xc17f('0x2e')]=_0x20afb1;if(_0x3f3b78[_0xc17f('0x48')][_0xc17f('0x6f')]){_0x30bf7a[_0xc17f('0x56')]=[{'model':db[_0xc17f('0x74')],'as':_0xc17f('0x75'),'required':![]},{'model':db[_0xc17f('0x76')],'as':_0xc17f('0x77'),'attributes':['name',_0xc17f('0x78'),_0xc17f('0x79')],'required':![]},{'model':db['Tag'],'as':_0xc17f('0x7a'),'attributes':['id',_0xc17f('0x39'),_0xc17f('0x7b')],'where':_0x3f3b78[_0xc17f('0x48')]['tag']?{'id':_0x3f3b78['query']['tag']}:undefined,'required':_0x3f3b78[_0xc17f('0x48')]['tag']?!![]:![]}];}return db[_0xc17f('0x72')][_0xc17f('0x57')](_0x30bf7a);})[_0xc17f('0x1d')](function(_0x315214){_0x235e5b['rows']=_0x315214;return _0x235e5b;});}})[_0xc17f('0x1d')](respondWithFilteredResult(_0x4b3bc7,_0x30bf7a))['catch'](handleError(_0x4b3bc7,null));};exports[_0xc17f('0x7c')]=function(_0x26f739,_0x502c97,_0xb119b9){return db[_0xc17f('0x3f')][_0xc17f('0x68')]({'where':{'id':_0x26f739[_0xc17f('0x5a')]['id']}})[_0xc17f('0x1d')](handleEntityNotFound(_0x502c97,null))[_0xc17f('0x1d')](function(_0x441b7b){if(_0x441b7b){return db[_0xc17f('0x7d')][_0xc17f('0x7e')](function(_0x2941e2){return db[_0xc17f('0x7f')][_0xc17f('0x35')]({'where':{'FaxAccountId':_0x26f739[_0xc17f('0x5a')]['id']},'transaction':_0x2941e2})['then'](function(_0xbfe101){var _0x4593f9=_[_0xc17f('0x3e')](_0x26f739[_0xc17f('0x5c')],function(_0x3902a2){_0x3902a2[_0xc17f('0x66')]=_0x26f739[_0xc17f('0x5a')]['id'];return _0x3902a2;});return db[_0xc17f('0x7f')]['bulkCreate'](_0x4593f9,{'transaction':_0x2941e2});});})['then'](function(){return db[_0xc17f('0x7f')]['findAndCountAll']({'where':{'FaxAccountId':_0x26f739[_0xc17f('0x5a')]['id']},'order':_0xc17f('0x80')});});}})[_0xc17f('0x1d')](respondWithResult(_0x502c97,null))[_0xc17f('0x27')](handleError(_0x502c97,null));};exports['getApplications']=function(_0x34d396,_0x3a3af7,_0x220942){var _0x8140ef={};var _0x26a091={};var _0x5f0b23;var _0x27858a;return db[_0xc17f('0x3f')][_0xc17f('0x68')]({'where':{'id':_0x34d396['params']['id']}})[_0xc17f('0x1d')](handleEntityNotFound(_0x3a3af7,null))[_0xc17f('0x1d')](function(_0x123c5e){if(_0x123c5e){_0x5f0b23=_0x123c5e;_0x26a091[_0xc17f('0x44')]=_[_0xc17f('0x45')](db[_0xc17f('0x7f')][_0xc17f('0x40')]);_0x26a091[_0xc17f('0x48')]=_[_0xc17f('0x45')](_0x34d396[_0xc17f('0x48')]);_0x26a091[_0xc17f('0x46')]=_['intersection'](_0x26a091[_0xc17f('0x44')],_0x26a091['query']);_0x8140ef[_0xc17f('0x4a')]=_[_0xc17f('0x47')](_0x26a091['model'],qs[_0xc17f('0x49')](_0x34d396['query'][_0xc17f('0x49')]));_0x8140ef[_0xc17f('0x4a')]=_0x8140ef[_0xc17f('0x4a')][_0xc17f('0x4b')]?_0x8140ef['attributes']:_0x26a091[_0xc17f('0x44')];_0x8140ef['order']=qs['sort'](_0x34d396[_0xc17f('0x48')][_0xc17f('0x4f')]);_0x8140ef[_0xc17f('0x50')]=qs['filters'](_['pick'](_0x34d396[_0xc17f('0x48')],_0x26a091[_0xc17f('0x46')]));if(_0x34d396[_0xc17f('0x48')][_0xc17f('0x52')]){_0x8140ef[_0xc17f('0x50')]=_[_0xc17f('0x53')](_0x8140ef[_0xc17f('0x50')],{'$or':_[_0xc17f('0x3e')](_0x8140ef['attributes'],function(_0x4d5c8d){var _0x19422f={};_0x19422f[_0x4d5c8d]={'$like':'%'+_0x34d396[_0xc17f('0x48')][_0xc17f('0x52')]+'%'};return _0x19422f;})});}_0x8140ef=_[_0xc17f('0x53')]({},_0x8140ef,_0x34d396[_0xc17f('0x55')]);return _0x5f0b23['getApplications'](_0x8140ef);}})['then'](function(_0x27f777){if(_0x27f777){_0x27858a=_0x27f777[_0xc17f('0x4b')];if(!_0x34d396[_0xc17f('0x48')][_0xc17f('0x4c')](_0xc17f('0x4d'))){_0x8140ef[_0xc17f('0x2c')]=qs[_0xc17f('0x2c')](_0x34d396[_0xc17f('0x48')]['limit']);_0x8140ef['offset']=qs['offset'](_0x34d396['query'][_0xc17f('0x2b')]);}return _0x5f0b23[_0xc17f('0x81')](_0x8140ef);}})[_0xc17f('0x1d')](function(_0x207fbd){if(_0x207fbd){return _0x207fbd?{'count':_0x27858a,'rows':_0x207fbd}:null;}})[_0xc17f('0x1d')](respondWithResult(_0x3a3af7,null))[_0xc17f('0x27')](handleError(_0x3a3af7,null));};function Extension(_0x1ecefe,_0x2a34fc,_0x2646c7,_0x14cf9a){this[_0xc17f('0x82')]=_0xc17f('0x83');this[_0xc17f('0x84')]=_0x1ecefe[_0xc17f('0x85')];this[_0xc17f('0x86')]=_0x14cf9a;this['type']='system';this[_0xc17f('0x87')]='Fax\x20Extension';this[_0xc17f('0x66')]=_0x1ecefe['id'];this[_0xc17f('0x80')]=_0x2a34fc;this[_0xc17f('0x88')]=_0x2646c7;}function createExtensionsReciveFax(_0x9edaa3){var _0x9456a7=0x1;var _0x3ef665=[];_0x3ef665['push'](new Extension(_0x9edaa3,_0x9456a7,'',_0xc17f('0x89')));_0x9456a7+=0x1;_0x3ef665[_0xc17f('0x8a')](new Extension(_0x9edaa3,_0x9456a7,_0xc17f('0x8b'),_0xc17f('0x8c')));_0x9456a7+=0x1;for(var _0x10adb9 in _0x9edaa3){if(_0x9edaa3[_0xc17f('0x4c')](_0x10adb9)&&(_0x10adb9===_0xc17f('0x8d')||_0x10adb9===_0xc17f('0x85')||_0x10adb9==='gateway'||_0x10adb9===_0xc17f('0x8e')||_0x10adb9===_0xc17f('0x8f')||_0x10adb9==='maxrate'||_0x10adb9===_0xc17f('0x90')||_0x10adb9===_0xc17f('0x91')||_0x10adb9===_0xc17f('0x92'))){_0x3ef665[_0xc17f('0x8a')](new Extension(_0x9edaa3,_0x9456a7,_0xc17f('0x93')+_0x10adb9+')='+_0x9edaa3[_0x10adb9],_0xc17f('0x8c')));_0x9456a7+=0x1;}}_0x3ef665[_0xc17f('0x8a')](new Extension(_0x9edaa3,_0x9456a7,'6',_0xc17f('0x94')));_0x9456a7+=0x1;_0x3ef665[_0xc17f('0x8a')](new Extension(_0x9edaa3,_0x9456a7,_0xc17f('0x95'),_0xc17f('0x96')));_0x9456a7=0x0;return _0x3ef665;}exports['addAccountApplications']=function(_0x50e40e,_0x396600,_0x49767a){var _0x1d0a0a;return db[_0xc17f('0x7d')][_0xc17f('0x7e')](function(_0x52cf4b){return db['FaxAccount']['create'](_0x50e40e[_0xc17f('0x5c')],{'transaction':_0x52cf4b})[_0xc17f('0x1d')](function(_0x4e66fd){_0x1d0a0a=_0x4e66fd[_0xc17f('0x5d')]({'plain':!![]});return db['VoiceExtension'][_0xc17f('0x97')](createExtensionsReciveFax(_0x1d0a0a),{'transaction':_0x52cf4b});});})['then'](function(){return _0x1d0a0a;})[_0xc17f('0x1d')](respondWithResult(_0x396600,null))[_0xc17f('0x27')](handleError(_0x396600,null));};exports['updateAccountApplications']=function(_0x27fc8a,_0xbbe8df,_0xe1ff16){var _0x447764;return db['sequelize'][_0xc17f('0x7e')](function(_0x1f721a){return db[_0xc17f('0x3f')]['update'](_0x27fc8a[_0xc17f('0x5c')],{'where':{'id':_0x27fc8a[_0xc17f('0x5c')]['id']},'transaction':_0x1f721a})[_0xc17f('0x1d')](function(_0xc483ef){return db['VoiceExtension']['destroy']({'where':{'FaxAccountId':_0x27fc8a[_0xc17f('0x5c')]['id']},'transaction':_0x1f721a})[_0xc17f('0x1d')](function(_0x5714fb){return db[_0xc17f('0x98')]['bulkCreate'](createExtensionsReciveFax(_['omit'](_0x27fc8a['body'],[_0xc17f('0x99'),_0xc17f('0x43'),_0xc17f('0x9a'),_0xc17f('0x9b'),_0xc17f('0x9c'),_0xc17f('0x9d')])),{'transaction':_0x1f721a});});});})[_0xc17f('0x1d')](function(){return db[_0xc17f('0x3f')][_0xc17f('0x9e')](_0x27fc8a[_0xc17f('0x5c')]['id']);})[_0xc17f('0x1d')](respondWithResult(_0xbbe8df,null))[_0xc17f('0x27')](handleError(_0xbbe8df,null));};exports['getMessages']=function(_0x233a24,_0x74d4e9,_0x4fd7d3){var _0x191111={'raw':!![],'where':{}};var _0x493ebf={};var _0x1d03ee={'count':0x0,'rows':[]};return db['FaxAccount'][_0xc17f('0x68')]({'where':{'id':_0x233a24[_0xc17f('0x5a')]['id']}})[_0xc17f('0x1d')](handleEntityNotFound(_0x74d4e9,null))[_0xc17f('0x1d')](function(_0x152566){if(_0x152566){_0x493ebf[_0xc17f('0x44')]=_[_0xc17f('0x45')](db[_0xc17f('0x9f')]['rawAttributes']);_0x493ebf[_0xc17f('0x48')]=_[_0xc17f('0x45')](_0x233a24[_0xc17f('0x48')]);_0x493ebf[_0xc17f('0x46')]=_[_0xc17f('0x47')](_0x493ebf['model'],_0x493ebf[_0xc17f('0x48')]);_0x191111[_0xc17f('0x4a')]=_[_0xc17f('0x47')](_0x493ebf[_0xc17f('0x44')],qs[_0xc17f('0x49')](_0x233a24['query'][_0xc17f('0x49')]));_0x191111[_0xc17f('0x4a')]=_0x191111[_0xc17f('0x4a')][_0xc17f('0x4b')]?_0x191111[_0xc17f('0x4a')]:_0x493ebf[_0xc17f('0x44')];if(!_0x233a24['query']['hasOwnProperty'](_0xc17f('0x4d'))){_0x191111[_0xc17f('0x2c')]=qs[_0xc17f('0x2c')](_0x233a24[_0xc17f('0x48')][_0xc17f('0x2c')]);_0x191111[_0xc17f('0x2b')]=qs['offset'](_0x233a24['query'][_0xc17f('0x2b')]);}_0x191111['order']=qs['sort'](_0x233a24[_0xc17f('0x48')][_0xc17f('0x4f')]);_0x191111[_0xc17f('0x50')]=qs[_0xc17f('0x46')](_['pick'](_0x233a24['query'],_0x493ebf['filters']));_0x191111[_0xc17f('0x50')]['FaxAccountId']=_0x152566['id'];if(_0x233a24[_0xc17f('0x48')][_0xc17f('0x52')]){_0x191111[_0xc17f('0x50')]=_[_0xc17f('0x53')](_0x191111[_0xc17f('0x50')],{'$or':_[_0xc17f('0x3e')](_0x191111[_0xc17f('0x4a')],function(_0x3707cd){var _0x149314={};_0x149314[_0x3707cd]={'$like':'%'+_0x233a24[_0xc17f('0x48')][_0xc17f('0x52')]+'%'};return _0x149314;})});}if(_0x233a24[_0xc17f('0x48')][_0xc17f('0xa0')]){var _0x3aa067=_0x233a24[_0xc17f('0x48')][_0xc17f('0xa0')][_0xc17f('0xa1')](',');var _0x441ce7={};_0x441ce7[_0x3aa067[0x0]]={'$gte':moment(_0x3aa067[0x1])[_0xc17f('0xa2')](_0xc17f('0xa3'))};_0x191111['where']=_[_0xc17f('0x53')](_0x191111[_0xc17f('0x50')],_0x441ce7);}_0x191111=_[_0xc17f('0x53')]({},_0x191111,_0x233a24[_0xc17f('0x55')]);return db[_0xc17f('0x9f')]['count']({'where':_0x191111[_0xc17f('0x50')]})[_0xc17f('0x1d')](function(_0x3caa8f){_0x1d03ee[_0xc17f('0x2e')]=_0x3caa8f;if(_0x233a24['query'][_0xc17f('0x6f')]){_0x191111[_0xc17f('0x56')]=[{'all':!![]}];}return db['FaxMessage'][_0xc17f('0x57')](_0x191111);})[_0xc17f('0x1d')](function(_0x5c6f0a){_0x1d03ee[_0xc17f('0x58')]=_0x5c6f0a;return _0x1d03ee;});}})[_0xc17f('0x1d')](respondWithFilteredResult(_0x74d4e9,_0x191111))[_0xc17f('0x27')](handleError(_0x74d4e9,null));};exports[_0xc17f('0x3a')]=function(_0x323535,_0x4b2730,_0x3c29da){var _0x3d008c,_0x5740b2={},_0x335cc9;if(_0x323535['body']['to']){_0x335cc9=_0x323535[_0xc17f('0x5c')]['to'][0x0];}return db['FaxAccount'][_0xc17f('0x64')]({'where':{'id':_0x323535[_0xc17f('0x5a')]['id']},'include':[{'model':db[_0xc17f('0xa4')],'as':_0xc17f('0xa5'),'include':[{'model':db['CmContact'],'as':_0xc17f('0xa6'),'where':{'fax':_0x335cc9},'limit':0x1,'order':[[_0xc17f('0x9b'),_0xc17f('0xa7')]]}]}]})[_0xc17f('0x1d')](handleEntityNotFound(_0x4b2730,null))[_0xc17f('0x1d')](function(_0x2a4846){_0x3d008c=_0x2a4846;if(_0x323535['body']['attachments']&&_0x323535[_0xc17f('0x5c')][_0xc17f('0xa8')][_0xc17f('0x4b')]){for(var _0x6ab203=0x0;_0x6ab203<_0x323535[_0xc17f('0x5c')][_0xc17f('0xa8')][_0xc17f('0x4b')];_0x6ab203+=0x1){_0x323535[_0xc17f('0x5c')][_0xc17f('0xa8')][_0x6ab203]={'filename':_0x323535['body'][_0xc17f('0xa8')][_0x6ab203]['name'],'id':_0x323535[_0xc17f('0x5c')][_0xc17f('0xa8')][_0x6ab203]['id'],'path':path['join'](config['root'],_0xc17f('0xa9'),_0x323535[_0xc17f('0x5c')][_0xc17f('0xa8')][_0x6ab203][_0xc17f('0xaa')])};}}return respondWithRpcPromise(_0xc17f('0xab'),_0xc17f('0xab'),{'FaxAccountId':_[_0xc17f('0xac')](_0x323535[_0xc17f('0x5a')]['id'])?undefined:_0x323535[_0xc17f('0x5a')]['id'],'path':_[_0xc17f('0xac')](_0x323535[_0xc17f('0x5c')][_0xc17f('0xa8')][0x0][_0xc17f('0xad')])?undefined:_0x323535[_0xc17f('0x5c')]['attachments'][0x0][_0xc17f('0xad')],'fax':_[_0xc17f('0xac')](_0x323535[_0xc17f('0x5c')]['to'][0x0])?undefined:_0x323535[_0xc17f('0x5c')]['to'][0x0]},client9002);})[_0xc17f('0x1d')](function(){if(_0x3d008c){if(_[_0xc17f('0xac')](_0x323535['body'][_0xc17f('0xae')])){_0x323535['body'][_0xc17f('0xae')]=util[_0xc17f('0xa2')](_0xc17f('0xaf'),_0x3d008c[_0xc17f('0x39')],_0x3d008c[_0xc17f('0xb0')]);}if(_0x3d008c[_0xc17f('0xa5')]){if(_0x3d008c[_0xc17f('0xa5')]['Contacts']['length']){return _0x3d008c[_0xc17f('0xa5')]['Contacts'][0x0];}else{return db[_0xc17f('0x74')][_0xc17f('0x5b')](_['defaults'](_0x323535[_0xc17f('0x5c')],{'firstName':_0x323535['body']['to'][0x0],'phone':_0x323535[_0xc17f('0x5c')]['to'][0x0],'fax':_0x323535[_0xc17f('0x5c')]['to'][0x0],'ListId':_0x3d008c[_0xc17f('0x9d')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0xc17f('0xb1'));}})[_0xc17f('0x1d')](function(_0x1acefb){if(_0x1acefb){return db[_0xc17f('0x72')][_0xc17f('0x64')]({'where':{'ContactId':_0x1acefb['id'],'closed':![],'FaxAccountId':_0x3d008c['id']}})[_0xc17f('0x1d')](function(_0x572855){if(_0x572855){return[_0x572855,![]];}return db[_0xc17f('0x72')]['create']({'UserId':_0x323535[_0xc17f('0x60')]['id'],'ContactId':_0x1acefb['id'],'FaxAccountId':_0x3d008c['id'],'fax':_0x323535['body']['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0xc17f('0x53')](_0x323535['body'],{'read':![],'body':_0x323535[_0xc17f('0x5c')][_0xc17f('0xa8')][0x0][_0xc17f('0xb2')],'FaxAccountId':_0x3d008c['id'],'UserId':_0x323535[_0xc17f('0x60')]['id'],'ContactId':_0x1acefb['id'],'AttachmentId':_0x323535[_0xc17f('0x5c')][_0xc17f('0xa8')][0x0]['id']})]},{'include':[{'model':db[_0xc17f('0x9f')],'as':_0xc17f('0xb3')}]})[_0xc17f('0x1d')](function(_0x3aca79){return[_0x3aca79,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0xef4931,_0x1956e5){if(_0x1956e5){return _0xef4931;}return db['FaxMessage'][_0xc17f('0x5b')]({'direction':_0xc17f('0xb4'),'read':![],'body':_0x323535['body'][_0xc17f('0xa8')][0x0][_0xc17f('0xb2')],'FaxAccountId':_0x3d008c['id'],'FaxInteractionId':_0xef4931['id'],'UserId':_0x323535[_0xc17f('0x60')]['id'],'ContactId':_0xef4931['ContactId'],'AttachmentId':_0x323535['body'][_0xc17f('0xa8')][0x0]['id']})[_0xc17f('0x1d')](function(_0x2630b1){_0xef4931[_0xc17f('0xb5')][_0xc17f('0xb3')]=[];_0xef4931['dataValues'][_0xc17f('0xb3')][_0xc17f('0x8a')](_0x2630b1['dataValues']);return _0xef4931;});})[_0xc17f('0x1d')](function(_0xe1432a){respondWithRpcPromise('SendFax',_0xc17f('0xb6'),{'FaxAccountId':_['isNil'](_0x323535[_0xc17f('0x5a')]['id'])?undefined:_0x323535[_0xc17f('0x5a')]['id'],'path':_[_0xc17f('0xac')](_0x323535[_0xc17f('0x5c')][_0xc17f('0xa8')][0x0][_0xc17f('0xad')])?undefined:_0x323535['body'][_0xc17f('0xa8')][0x0]['path'],'fax':_['isNil'](_0x323535[_0xc17f('0x5c')]['to'][0x0])?undefined:_0x323535[_0xc17f('0x5c')]['to'][0x0],'AttachmentId':_0x323535['body'][_0xc17f('0xa8')][0x0]['id']},client9002)[_0xc17f('0x1d')](function(_0x57b3e7){logger[_0xc17f('0x1e')]('SendFaxRpc,\x20%s',_0x57b3e7);})[_0xc17f('0x27')](function(_0x533ee0){logger[_0xc17f('0x1e')](_0xc17f('0xb7'),_0x533ee0);});return _0xe1432a;})[_0xc17f('0x1d')](respondWithResult(_0x4b2730,null))[_0xc17f('0x27')](handleError(_0x4b2730,null));};exports[_0xc17f('0xb8')]=function(_0x82feb7,_0x354904,_0xaf2116){return db[_0xc17f('0x3f')][_0xc17f('0x64')]({'where':{'id':_0x82feb7[_0xc17f('0x5a')]['id']}})['then'](handleEntityNotFound(_0x354904,null))[_0xc17f('0x1d')](function(_0x28d969){if(_0x28d969){return _0x28d969[_0xc17f('0xb8')](_0x82feb7[_0xc17f('0x5c')][_0xc17f('0x6b')],_[_0xc17f('0xb9')](_0x82feb7[_0xc17f('0x5c')],['ids','id'])||{})['spread'](function(_0x5d796a){for(var _0x188d34=0x0;_0x188d34<_0x82feb7[_0xc17f('0x5c')][_0xc17f('0x6b')][_0xc17f('0x4b')];_0x188d34+=0x1){socket[_0xc17f('0xba')](_0xc17f('0xbb'),{'UserId':Number(_0x82feb7[_0xc17f('0x5c')]['ids'][_0x188d34]),'FaxAccountId':Number(_0x82feb7['params']['id'])});}return _0x5d796a;});}})[_0xc17f('0x1d')](respondWithResult(_0x354904,null))[_0xc17f('0x27')](handleError(_0x354904,null));};exports[_0xc17f('0xbc')]=function(_0x3efe2a,_0x5bd5e2,_0x232782){return db[_0xc17f('0x3f')][_0xc17f('0x64')]({'where':{'id':_0x3efe2a['params']['id']}})[_0xc17f('0x1d')](handleEntityNotFound(_0x5bd5e2,null))['then'](function(_0x4c1a24){if(_0x4c1a24){return _0x4c1a24[_0xc17f('0xbc')](_0x3efe2a[_0xc17f('0x48')][_0xc17f('0x6b')])['then'](function(){if(_[_0xc17f('0xbd')](_0x3efe2a[_0xc17f('0x48')]['ids'])){for(var _0xcdc65c=0x0;_0xcdc65c<_0x3efe2a[_0xc17f('0x48')]['ids']['length'];_0xcdc65c+=0x1){socket[_0xc17f('0xba')]('userFaxAccount:remove',{'UserId':Number(_0x3efe2a[_0xc17f('0x48')][_0xc17f('0x6b')][_0xcdc65c]),'FaxAccountId':Number(_0x3efe2a[_0xc17f('0x5a')]['id'])});}}else{socket[_0xc17f('0xba')]('userFaxAccount:remove',{'UserId':Number(_0x3efe2a['query']['ids']),'FaxAccountId':Number(_0x3efe2a['params']['id'])});}});}})[_0xc17f('0x1d')](respondWithStatusCode(_0x5bd5e2,null))[_0xc17f('0x27')](handleError(_0x5bd5e2,null));};exports[_0xc17f('0xbe')]=function(_0x3600b1,_0x2feed6,_0xa1ed2d){var _0x361a41={};var _0x4fad4a={};var _0xe53cc1;var _0x22e1dc;return db[_0xc17f('0x3f')]['findOne']({'where':{'id':_0x3600b1['params']['id']}})['then'](handleEntityNotFound(_0x2feed6,null))[_0xc17f('0x1d')](function(_0xb95d2e){if(_0xb95d2e){_0xe53cc1=_0xb95d2e;_0x4fad4a[_0xc17f('0x44')]=_[_0xc17f('0x45')](db[_0xc17f('0x76')][_0xc17f('0x40')]);_0x4fad4a[_0xc17f('0x48')]=_[_0xc17f('0x45')](_0x3600b1[_0xc17f('0x48')]);_0x4fad4a['filters']=_[_0xc17f('0x47')](_0x4fad4a['model'],_0x4fad4a[_0xc17f('0x48')]);_0x361a41['attributes']=_[_0xc17f('0x47')](_0x4fad4a[_0xc17f('0x44')],qs['fields'](_0x3600b1[_0xc17f('0x48')][_0xc17f('0x49')]));_0x361a41[_0xc17f('0x4a')]=_0x361a41[_0xc17f('0x4a')][_0xc17f('0x4b')]?_0x361a41[_0xc17f('0x4a')]:_0x4fad4a['model'];_0x361a41['order']=qs[_0xc17f('0x4f')](_0x3600b1['query']['sort']);_0x361a41[_0xc17f('0x50')]=qs['filters'](_[_0xc17f('0x51')](_0x3600b1[_0xc17f('0x48')],_0x4fad4a[_0xc17f('0x46')]));if(_0x3600b1[_0xc17f('0x48')][_0xc17f('0x52')]){_0x361a41[_0xc17f('0x50')]=_['merge'](_0x361a41[_0xc17f('0x50')],{'$or':_[_0xc17f('0x3e')](_0x361a41[_0xc17f('0x4a')],function(_0x36918b){var _0x34ca9b={};_0x34ca9b[_0x36918b]={'$like':'%'+_0x3600b1[_0xc17f('0x48')][_0xc17f('0x52')]+'%'};return _0x34ca9b;})});}_0x361a41=_[_0xc17f('0x53')]({},_0x361a41,_0x3600b1[_0xc17f('0x55')]);return _0xe53cc1[_0xc17f('0xbe')](_0x361a41);}})['then'](function(_0x598255){if(_0x598255){_0x22e1dc=_0x598255[_0xc17f('0x4b')];if(!_0x3600b1[_0xc17f('0x48')][_0xc17f('0x4c')](_0xc17f('0x4d'))){_0x361a41[_0xc17f('0x2c')]=qs[_0xc17f('0x2c')](_0x3600b1['query'][_0xc17f('0x2c')]);_0x361a41[_0xc17f('0x2b')]=qs[_0xc17f('0x2b')](_0x3600b1[_0xc17f('0x48')][_0xc17f('0x2b')]);}return _0xe53cc1['getAgents'](_0x361a41);}})['then'](function(_0x108ebc){if(_0x108ebc){return _0x108ebc?{'count':_0x22e1dc,'rows':_0x108ebc}:null;}})[_0xc17f('0x1d')](respondWithResult(_0x2feed6,null))[_0xc17f('0x27')](handleError(_0x2feed6,null));}; \ No newline at end of file +var _0x384b=['Tags','color','tag','addApplications','sequelize','FaxApplication','bulkCreate','findAndCountAll','getApplications','context','from-voip-provider','exten','localstationid','app','system','description','priority','appdata','push','Answer','Set','ecm','headerinfo','maxrate','minrate','t38timeout','FAXOPT(','Wait','transaction','VoiceExtension','key','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','$gte','split','format','FaxMessage','send','CmList','Contacts','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List','defaults','List\x20not\x20found','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxAccount.socket','register','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','status','end','json','limit','undefined','count','set','Content-Range','apply','save','update','destroy','get','FaxAccounts','UserProfileResource','stack','name','index','mandatoryDispositionPause','map','FaxAccount','type','query','filters','intersection','model','fields','length','attributes','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','merge','VIRTUAL','include','findAll','rows','params','Pause','keys','rawAttributes','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','getDispositions','findOne','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x384b,0x1d7));var _0xb384=function(_0x54e570,_0x4713d6){_0x54e570=_0x54e570-0x0;var _0x426b77=_0x384b[_0x54e570];return _0x426b77;};'use strict';var emlformat=require(_0xb384('0x0'));var rimraf=require(_0xb384('0x1'));var zipdir=require(_0xb384('0x2'));var jsonpatch=require(_0xb384('0x3'));var rp=require(_0xb384('0x4'));var moment=require(_0xb384('0x5'));var BPromise=require(_0xb384('0x6'));var Mustache=require(_0xb384('0x7'));var util=require(_0xb384('0x8'));var path=require(_0xb384('0x9'));var sox=require(_0xb384('0xa'));var csv=require('to-csv');var ejs=require(_0xb384('0xb'));var fs=require('fs');var fs_extra=require(_0xb384('0xc'));var _=require(_0xb384('0xd'));var squel=require('squel');var crypto=require(_0xb384('0xe'));var jsforce=require(_0xb384('0xf'));var deskjs=require(_0xb384('0x10'));var toCsv=require(_0xb384('0x11'));var querystring=require(_0xb384('0x12'));var Papa=require('papaparse');var Redis=require(_0xb384('0x13'));var authService=require(_0xb384('0x14'));var qs=require(_0xb384('0x15'));var as=require(_0xb384('0x16'));var hardwareService=require(_0xb384('0x17'));var logger=require(_0xb384('0x18'))(_0xb384('0x19'));var utils=require(_0xb384('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0xb384('0x1b'));var db=require(_0xb384('0x1c'))['db'];config[_0xb384('0x1d')]=_['defaults'](config['redis'],{'host':_0xb384('0x1e'),'port':0x18eb});var socket=require(_0xb384('0x1f'))(new Redis(config[_0xb384('0x1d')]));require(_0xb384('0x20'))[_0xb384('0x21')](socket);var jayson=require('jayson/promise');var client=jayson[_0xb384('0x22')][_0xb384('0x23')]({'port':0x232c});var client9002=jayson[_0xb384('0x22')][_0xb384('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x7ccf03,_0x4bbbf6,_0x343029,_0x4f2997){return new BPromise(function(_0x35249c,_0x265893){var _0x4e4f50=_0x4f2997||client;return _0x4e4f50[_0xb384('0x24')](_0x7ccf03,_0x343029)[_0xb384('0x25')](function(_0x5bf32b){logger[_0xb384('0x26')](_0xb384('0x27'),_0x4bbbf6,_0xb384('0x28'));logger[_0xb384('0x29')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x4bbbf6,_0xb384('0x28'),JSON[_0xb384('0x2a')](_0x5bf32b));if(_0x5bf32b[_0xb384('0x2b')]){if(_0x5bf32b[_0xb384('0x2b')][_0xb384('0x2c')]===0x1f4){logger[_0xb384('0x2b')](_0xb384('0x27'),_0x4bbbf6,_0x5bf32b[_0xb384('0x2b')][_0xb384('0x2d')]);return _0x265893(_0x5bf32b['error'][_0xb384('0x2d')]);}logger[_0xb384('0x2b')]('FaxAccount,\x20%s,\x20%s',_0x4bbbf6,_0x5bf32b[_0xb384('0x2b')][_0xb384('0x2d')]);return _0x35249c(_0x5bf32b[_0xb384('0x2b')][_0xb384('0x2d')]);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x4bbbf6,_0xb384('0x28'));_0x35249c(_0x5bf32b['result'][_0xb384('0x2d')]);}})[_0xb384('0x2e')](function(_0x5ebc17){logger['error']('FaxAccount,\x20%s,\x20%s',_0x4bbbf6,_0x5ebc17);_0x265893(_0x5ebc17);});});}function respondWithStatusCode(_0x44fff1,_0x338405){_0x338405=_0x338405||0xcc;return function(_0x5e6911){if(_0x5e6911){return _0x44fff1[_0xb384('0x2f')](_0x338405);}return _0x44fff1[_0xb384('0x30')](_0x338405)[_0xb384('0x31')]();};}function respondWithResult(_0x1f5548,_0x57aafe){_0x57aafe=_0x57aafe||0xc8;return function(_0x451f86){if(_0x451f86){return _0x1f5548[_0xb384('0x30')](_0x57aafe)[_0xb384('0x32')](_0x451f86);}};}function respondWithFilteredResult(_0x1c481c,_0x31c3cc){return function(_0x50119a){if(_0x50119a){var _0x4d9f8d=typeof _0x31c3cc['offset']==='undefined'&&typeof _0x31c3cc[_0xb384('0x33')]===_0xb384('0x34');var _0x1a0961=_0x50119a[_0xb384('0x35')];var _0x16ba56=_0x4d9f8d?0x0:_0x31c3cc['offset'];var _0x2e2121=_0x4d9f8d?_0x50119a[_0xb384('0x35')]:_0x31c3cc['offset']+_0x31c3cc[_0xb384('0x33')];var _0x40c48b;if(_0x2e2121>=_0x1a0961){_0x2e2121=_0x1a0961;_0x40c48b=0xc8;}else{_0x40c48b=0xce;}_0x1c481c[_0xb384('0x30')](_0x40c48b);return _0x1c481c[_0xb384('0x36')](_0xb384('0x37'),_0x16ba56+'-'+_0x2e2121+'/'+_0x1a0961)[_0xb384('0x32')](_0x50119a);}return null;};}function patchUpdates(_0x204bcd){return function(_0x3db909){try{jsonpatch[_0xb384('0x38')](_0x3db909,_0x204bcd,!![]);}catch(_0x290ed3){return BPromise['reject'](_0x290ed3);}return _0x3db909[_0xb384('0x39')]();};}function saveUpdates(_0x5ed071,_0x23481b){return function(_0x3130a2){if(_0x3130a2){return _0x3130a2[_0xb384('0x3a')](_0x5ed071)['then'](function(_0x5de9df){return _0x5de9df;});}return null;};}function removeEntity(_0x4d1a58,_0x1d5c7f){return function(_0x28fbf3){if(_0x28fbf3){return _0x28fbf3[_0xb384('0x3b')]()[_0xb384('0x25')](function(){var _0x51a6e7=_0x28fbf3[_0xb384('0x3c')]({'plain':!![]});var _0x3fb313=_0xb384('0x3d');return db[_0xb384('0x3e')][_0xb384('0x3b')]({'where':{'type':_0x3fb313,'resourceId':_0x51a6e7['id']}})[_0xb384('0x25')](function(){return _0x28fbf3;});})[_0xb384('0x25')](function(){_0x4d1a58[_0xb384('0x30')](0xcc)[_0xb384('0x31')]();});}};}function handleEntityNotFound(_0x1c32d2,_0x589296){return function(_0x7707fc){if(!_0x7707fc){_0x1c32d2[_0xb384('0x2f')](0x194);}return _0x7707fc;};}function handleError(_0x38f302,_0x2cd72a){_0x2cd72a=_0x2cd72a||0x1f4;return function(_0x2e1ce5){logger[_0xb384('0x2b')](_0x2e1ce5[_0xb384('0x3f')]);if(_0x2e1ce5[_0xb384('0x40')]){delete _0x2e1ce5[_0xb384('0x40')];}_0x38f302[_0xb384('0x30')](_0x2cd72a)['send'](_0x2e1ce5);};}exports[_0xb384('0x41')]=function(_0x22b574,_0x31f236){var _0x4b7759={'include':[{'model':db['Pause'],'as':_0xb384('0x42')}]},_0x3540b0={},_0x113946={'count':0x0,'rows':[]};var _0x3af09f=_[_0xb384('0x43')](db[_0xb384('0x44')]['rawAttributes'],function(_0x137854){return{'name':_0x137854['fieldName'],'type':_0x137854[_0xb384('0x45')]['key']};});_0x3540b0['model']=_[_0xb384('0x43')](_0x3af09f,_0xb384('0x40'));_0x3540b0[_0xb384('0x46')]=_['keys'](_0x22b574[_0xb384('0x46')]);_0x3540b0[_0xb384('0x47')]=_[_0xb384('0x48')](_0x3540b0[_0xb384('0x49')],_0x3540b0[_0xb384('0x46')]);_0x4b7759['attributes']=_[_0xb384('0x48')](_0x3540b0['model'],qs[_0xb384('0x4a')](_0x22b574[_0xb384('0x46')][_0xb384('0x4a')]));_0x4b7759['attributes']=_0x4b7759['attributes'][_0xb384('0x4b')]?_0x4b7759[_0xb384('0x4c')]:_0x3540b0['model'];if(!_0x22b574[_0xb384('0x46')][_0xb384('0x4d')](_0xb384('0x4e'))){_0x4b7759[_0xb384('0x33')]=qs[_0xb384('0x33')](_0x22b574[_0xb384('0x46')][_0xb384('0x33')]);_0x4b7759['offset']=qs[_0xb384('0x4f')](_0x22b574[_0xb384('0x46')]['offset']);}_0x4b7759[_0xb384('0x50')]=qs[_0xb384('0x51')](_0x22b574[_0xb384('0x46')][_0xb384('0x51')]);_0x4b7759['where']=qs[_0xb384('0x47')](_[_0xb384('0x52')](_0x22b574['query'],_0x3540b0[_0xb384('0x47')]),_0x3af09f);if(_0x22b574['query'][_0xb384('0x53')]){_0x4b7759[_0xb384('0x54')]=_[_0xb384('0x55')](_0x4b7759[_0xb384('0x54')],{'$or':_[_0xb384('0x43')](_0x3af09f,function(_0x505d82){if(_0x505d82[_0xb384('0x45')]!==_0xb384('0x56')){var _0x52dfe9={};_0x52dfe9[_0x505d82[_0xb384('0x40')]]={'$like':'%'+_0x22b574[_0xb384('0x46')][_0xb384('0x53')]+'%'};return _0x52dfe9;}})});}_0x4b7759=_[_0xb384('0x55')]({},_0x4b7759,_0x22b574['options']);var _0x4e95d2={'where':_0x4b7759[_0xb384('0x54')]};return db['FaxAccount'][_0xb384('0x35')](_0x4e95d2)[_0xb384('0x25')](function(_0x27056c){_0x113946[_0xb384('0x35')]=_0x27056c;if(_0x22b574['query']['includeAll']){_0x4b7759[_0xb384('0x57')]=[{'all':!![]}];}return db['FaxAccount'][_0xb384('0x58')](_0x4b7759);})[_0xb384('0x25')](function(_0x1d3923){_0x113946[_0xb384('0x59')]=_0x1d3923;return _0x113946;})['then'](respondWithFilteredResult(_0x31f236,_0x4b7759))['catch'](handleError(_0x31f236,null));};exports['show']=function(_0x171217,_0x59c77d){var _0x4f769b={'raw':![],'where':{'id':_0x171217[_0xb384('0x5a')]['id']},'include':[{'model':db[_0xb384('0x5b')],'as':_0xb384('0x42')}]},_0x3e5260={};_0x3e5260[_0xb384('0x49')]=_[_0xb384('0x5c')](db[_0xb384('0x44')][_0xb384('0x5d')]);_0x3e5260[_0xb384('0x46')]=_[_0xb384('0x5c')](_0x171217[_0xb384('0x46')]);_0x3e5260[_0xb384('0x47')]=_[_0xb384('0x48')](_0x3e5260[_0xb384('0x49')],_0x3e5260[_0xb384('0x46')]);_0x4f769b['attributes']=_[_0xb384('0x48')](_0x3e5260['model'],qs[_0xb384('0x4a')](_0x171217[_0xb384('0x46')]['fields']));_0x4f769b[_0xb384('0x4c')]=_0x4f769b[_0xb384('0x4c')][_0xb384('0x4b')]?_0x4f769b['attributes']:_0x3e5260[_0xb384('0x49')];if(_0x171217[_0xb384('0x46')][_0xb384('0x5e')]){_0x4f769b[_0xb384('0x57')]=[{'all':!![]}];}_0x4f769b=_[_0xb384('0x55')]({},_0x4f769b,_0x171217[_0xb384('0x5f')]);return db[_0xb384('0x44')][_0xb384('0x60')](_0x4f769b)['then'](handleEntityNotFound(_0x59c77d,null))[_0xb384('0x25')](respondWithResult(_0x59c77d,null))[_0xb384('0x2e')](handleError(_0x59c77d,null));};exports[_0xb384('0x61')]=function(_0xe50f75,_0x49e414){return db[_0xb384('0x44')][_0xb384('0x61')](_0xe50f75[_0xb384('0x62')],{})[_0xb384('0x25')](function(_0x5beeb3){var _0x5bd5ca=_0xe50f75[_0xb384('0x63')][_0xb384('0x3c')]({'plain':!![]});if(!_0x5bd5ca)throw new Error(_0xb384('0x64'));if(_0x5bd5ca['role']===_0xb384('0x63')){var _0xb1f786=_0x5beeb3[_0xb384('0x3c')]({'plain':!![]});var _0x4c8bdf=_0xb384('0x3d');return db[_0xb384('0x65')][_0xb384('0x60')]({'where':{'name':_0x4c8bdf,'userProfileId':_0x5bd5ca[_0xb384('0x66')]},'raw':!![]})[_0xb384('0x25')](function(_0x27d695){if(_0x27d695&&_0x27d695['autoAssociation']===0x0){return db[_0xb384('0x3e')][_0xb384('0x61')]({'name':_0xb1f786['name'],'resourceId':_0xb1f786['id'],'type':_0x27d695[_0xb384('0x40')],'sectionId':_0x27d695['id']},{})[_0xb384('0x25')](function(){return _0x5beeb3;});}else{return _0x5beeb3;}})[_0xb384('0x2e')](function(_0x3af5a9){logger[_0xb384('0x2b')](_0xb384('0x67'),_0x3af5a9);throw _0x3af5a9;});}return _0x5beeb3;})['then'](respondWithResult(_0x49e414,0xc9))[_0xb384('0x2e')](handleError(_0x49e414,null));};exports['update']=function(_0x2b5c12,_0x2140f4){if(_0x2b5c12[_0xb384('0x62')]['id']){delete _0x2b5c12[_0xb384('0x62')]['id'];}return db[_0xb384('0x44')]['find']({'where':{'id':_0x2b5c12['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0xb384('0x25')](handleEntityNotFound(_0x2140f4,null))[_0xb384('0x25')](saveUpdates(_0x2b5c12[_0xb384('0x62')],null))['then'](respondWithResult(_0x2140f4,null))[_0xb384('0x2e')](handleError(_0x2140f4,null));};exports[_0xb384('0x3b')]=function(_0x564eec,_0x18e866){return db[_0xb384('0x44')][_0xb384('0x60')]({'where':{'id':_0x564eec[_0xb384('0x5a')]['id']}})[_0xb384('0x25')](handleEntityNotFound(_0x18e866,null))['then'](removeEntity(_0x18e866,null))['catch'](handleError(_0x18e866,null));};exports[_0xb384('0x68')]=function(_0x46042d,_0x1937d4){return db['FaxAccount'][_0xb384('0x68')]()[_0xb384('0x25')](respondWithResult(_0x1937d4,null))[_0xb384('0x2e')](handleError(_0x1937d4,null));};exports[_0xb384('0x69')]=function(_0x51b836,_0x4b865a,_0x5c6643){if(_0x51b836['body']['id']){delete _0x51b836[_0xb384('0x62')]['id'];}return db[_0xb384('0x44')][_0xb384('0x60')]({'where':{'id':_0x51b836[_0xb384('0x5a')]['id']}})[_0xb384('0x25')](handleEntityNotFound(_0x4b865a,null))[_0xb384('0x25')](function(_0x1237f7){if(_0x1237f7){_0x51b836[_0xb384('0x62')][_0xb384('0x6a')]=_0x1237f7['id'];return db['Disposition'][_0xb384('0x61')](_0x51b836[_0xb384('0x62')]);}})[_0xb384('0x25')](respondWithResult(_0x4b865a,null))['catch'](handleError(_0x4b865a,null));};exports[_0xb384('0x6b')]=function(_0x4224c4,_0x42da91,_0x22e317){var _0x10bf56={'raw':![],'where':{}};var _0xb2dd92={};var _0x1075e2={'count':0x0,'rows':[]};return db[_0xb384('0x44')][_0xb384('0x6c')]({'where':{'id':_0x4224c4[_0xb384('0x5a')]['id']}})[_0xb384('0x25')](handleEntityNotFound(_0x42da91,null))[_0xb384('0x25')](function(_0x2ded74){if(_0x2ded74){_0xb2dd92[_0xb384('0x49')]=_[_0xb384('0x5c')](db['Disposition'][_0xb384('0x5d')]);_0xb2dd92[_0xb384('0x46')]=_[_0xb384('0x5c')](_0x4224c4[_0xb384('0x46')]);_0xb2dd92[_0xb384('0x47')]=_['intersection'](_0xb2dd92[_0xb384('0x49')],_0xb2dd92[_0xb384('0x46')]);_0x10bf56[_0xb384('0x4c')]=_[_0xb384('0x48')](_0xb2dd92[_0xb384('0x49')],qs[_0xb384('0x4a')](_0x4224c4[_0xb384('0x46')][_0xb384('0x4a')]));_0x10bf56[_0xb384('0x4c')]=_0x10bf56[_0xb384('0x4c')]['length']?_0x10bf56[_0xb384('0x4c')]:_0xb2dd92['model'];if(!_0x4224c4[_0xb384('0x46')][_0xb384('0x4d')](_0xb384('0x4e'))){_0x10bf56['limit']=qs['limit'](_0x4224c4[_0xb384('0x46')][_0xb384('0x33')]);_0x10bf56[_0xb384('0x4f')]=qs['offset'](_0x4224c4['query'][_0xb384('0x4f')]);}_0x10bf56['order']=qs[_0xb384('0x51')](_0x4224c4['query'][_0xb384('0x51')]);_0x10bf56['where']=qs[_0xb384('0x47')](_['pick'](_0x4224c4[_0xb384('0x46')],_0xb2dd92[_0xb384('0x47')]));_0x10bf56['where'][_0xb384('0x6a')]=_0x2ded74['id'];if(_0x4224c4[_0xb384('0x46')]['filter']){_0x10bf56[_0xb384('0x54')]=_[_0xb384('0x55')](_0x10bf56['where'],{'$or':_[_0xb384('0x43')](_0x10bf56[_0xb384('0x4c')],function(_0x41d36b){var _0x1daedb={};_0x1daedb[_0x41d36b]={'$like':'%'+_0x4224c4[_0xb384('0x46')]['filter']+'%'};return _0x1daedb;})});}_0x10bf56=_[_0xb384('0x55')]({},_0x10bf56,_0x4224c4[_0xb384('0x5f')]);return db[_0xb384('0x6d')][_0xb384('0x35')]({'where':_0x10bf56['where']})[_0xb384('0x25')](function(_0x24842d){_0x1075e2[_0xb384('0x35')]=_0x24842d;if(_0x4224c4[_0xb384('0x46')][_0xb384('0x5e')]){_0x10bf56[_0xb384('0x57')]=[{'all':!![]}];}return db[_0xb384('0x6d')][_0xb384('0x58')](_0x10bf56);})[_0xb384('0x25')](function(_0x16b2cc){_0x1075e2['rows']=_0x16b2cc;return _0x1075e2;});}})[_0xb384('0x25')](respondWithFilteredResult(_0x42da91,_0x10bf56))[_0xb384('0x2e')](handleError(_0x42da91,null));};exports[_0xb384('0x6e')]=function(_0x4f5929,_0x25b7d2,_0x48800b){return db[_0xb384('0x44')][_0xb384('0x60')]({'where':{'id':_0x4f5929['params']['id']}})[_0xb384('0x25')](handleEntityNotFound(_0x25b7d2,null))[_0xb384('0x25')](function(_0x578e3d){if(_0x578e3d){return _0x578e3d[_0xb384('0x6e')](_0x4f5929[_0xb384('0x46')][_0xb384('0x6f')]);}})[_0xb384('0x25')](respondWithStatusCode(_0x25b7d2,null))['catch'](handleError(_0x25b7d2,null));};exports[_0xb384('0x70')]=function(_0x416fff,_0x12351d,_0x475bbc){if(_0x416fff['body']['id']){delete _0x416fff[_0xb384('0x62')]['id'];}return db['FaxAccount'][_0xb384('0x60')]({'where':{'id':_0x416fff['params']['id']}})[_0xb384('0x25')](handleEntityNotFound(_0x12351d,null))[_0xb384('0x25')](function(_0x54872e){if(_0x54872e){_0x416fff[_0xb384('0x62')]['FaxAccountId']=_0x54872e['id'];return db[_0xb384('0x71')][_0xb384('0x61')](_0x416fff[_0xb384('0x62')]);}})['then'](respondWithResult(_0x12351d,null))[_0xb384('0x2e')](handleError(_0x12351d,null));};exports['getAnswers']=function(_0x1daf04,_0x581173,_0x9ccfa1){var _0x4d5333={'raw':![],'where':{}};var _0x599fb7={};var _0x46ba4f={'count':0x0,'rows':[]};return db[_0xb384('0x44')][_0xb384('0x6c')]({'where':{'id':_0x1daf04['params']['id']}})[_0xb384('0x25')](handleEntityNotFound(_0x581173,null))[_0xb384('0x25')](function(_0x11cfb3){if(_0x11cfb3){_0x599fb7['model']=_['keys'](db[_0xb384('0x71')][_0xb384('0x5d')]);_0x599fb7[_0xb384('0x46')]=_[_0xb384('0x5c')](_0x1daf04[_0xb384('0x46')]);_0x599fb7[_0xb384('0x47')]=_[_0xb384('0x48')](_0x599fb7[_0xb384('0x49')],_0x599fb7['query']);_0x4d5333['attributes']=_['intersection'](_0x599fb7[_0xb384('0x49')],qs[_0xb384('0x4a')](_0x1daf04[_0xb384('0x46')][_0xb384('0x4a')]));_0x4d5333['attributes']=_0x4d5333['attributes']['length']?_0x4d5333['attributes']:_0x599fb7[_0xb384('0x49')];if(!_0x1daf04[_0xb384('0x46')][_0xb384('0x4d')]('nolimit')){_0x4d5333[_0xb384('0x33')]=qs[_0xb384('0x33')](_0x1daf04[_0xb384('0x46')]['limit']);_0x4d5333[_0xb384('0x4f')]=qs[_0xb384('0x4f')](_0x1daf04[_0xb384('0x46')]['offset']);}_0x4d5333[_0xb384('0x50')]=qs[_0xb384('0x51')](_0x1daf04[_0xb384('0x46')][_0xb384('0x51')]);_0x4d5333[_0xb384('0x54')]=qs['filters'](_[_0xb384('0x52')](_0x1daf04['query'],_0x599fb7[_0xb384('0x47')]));_0x4d5333[_0xb384('0x54')][_0xb384('0x6a')]=_0x11cfb3['id'];if(_0x1daf04[_0xb384('0x46')][_0xb384('0x53')]){_0x4d5333[_0xb384('0x54')]=_[_0xb384('0x55')](_0x4d5333[_0xb384('0x54')],{'$or':_[_0xb384('0x43')](_0x4d5333[_0xb384('0x4c')],function(_0x31037f){var _0x352645={};_0x352645[_0x31037f]={'$like':'%'+_0x1daf04[_0xb384('0x46')][_0xb384('0x53')]+'%'};return _0x352645;})});}_0x4d5333=_[_0xb384('0x55')]({},_0x4d5333,_0x1daf04[_0xb384('0x5f')]);return db['CannedAnswer']['count']({'where':_0x4d5333[_0xb384('0x54')]})[_0xb384('0x25')](function(_0x49a23d){_0x46ba4f[_0xb384('0x35')]=_0x49a23d;if(_0x1daf04[_0xb384('0x46')][_0xb384('0x5e')]){_0x4d5333['include']=[{'all':!![]}];}return db[_0xb384('0x71')][_0xb384('0x58')](_0x4d5333);})[_0xb384('0x25')](function(_0x443626){_0x46ba4f['rows']=_0x443626;return _0x46ba4f;});}})[_0xb384('0x25')](respondWithFilteredResult(_0x581173,_0x4d5333))['catch'](handleError(_0x581173,null));};exports[_0xb384('0x72')]=function(_0x4e73bf,_0x1eee72,_0x40752f){return db[_0xb384('0x44')][_0xb384('0x60')]({'where':{'id':_0x4e73bf[_0xb384('0x5a')]['id']}})[_0xb384('0x25')](handleEntityNotFound(_0x1eee72,null))[_0xb384('0x25')](function(_0xfbc0ea){if(_0xfbc0ea){return _0xfbc0ea[_0xb384('0x72')](_0x4e73bf[_0xb384('0x46')]['ids']);}})[_0xb384('0x25')](respondWithStatusCode(_0x1eee72,null))[_0xb384('0x2e')](handleError(_0x1eee72,null));};exports[_0xb384('0x73')]=function(_0x530f14,_0x21b778,_0x4c6c26){return db[_0xb384('0x74')][_0xb384('0x60')]({'where':{'id':_0x530f14[_0xb384('0x5a')]['id']}})[_0xb384('0x25')](handleEntityNotFound(_0x21b778,null))[_0xb384('0x25')](function(_0x46dd66){if(_0x46dd66){return _0x46dd66[_0xb384('0x73')](_0x530f14['body'][_0xb384('0x6f')],_[_0xb384('0x75')](_0x530f14['body'],[_0xb384('0x6f'),'id'])||{});}})[_0xb384('0x25')](respondWithResult(_0x21b778,null))[_0xb384('0x2e')](handleError(_0x21b778,null));};exports[_0xb384('0x76')]=function(_0x1748d7,_0x4cf80b,_0x13283d){var _0x55de99={'raw':![],'where':{}};var _0x3e5140={};var _0x40c178={'count':0x0,'rows':[]};return db[_0xb384('0x44')][_0xb384('0x6c')]({'where':{'id':_0x1748d7[_0xb384('0x5a')]['id']}})[_0xb384('0x25')](handleEntityNotFound(_0x4cf80b,null))[_0xb384('0x25')](function(_0x4fe9ed){if(_0x4fe9ed){_0x3e5140[_0xb384('0x49')]=_[_0xb384('0x5c')](db[_0xb384('0x74')][_0xb384('0x5d')]);_0x3e5140[_0xb384('0x46')]=_['keys'](_0x1748d7['query']);_0x3e5140[_0xb384('0x47')]=_['intersection'](_0x3e5140[_0xb384('0x49')],_0x3e5140[_0xb384('0x46')]);_0x55de99[_0xb384('0x4c')]=_['intersection'](_0x3e5140[_0xb384('0x49')],qs[_0xb384('0x4a')](_0x1748d7[_0xb384('0x46')][_0xb384('0x4a')]));_0x55de99[_0xb384('0x4c')]=_0x55de99[_0xb384('0x4c')][_0xb384('0x4b')]?_0x55de99[_0xb384('0x4c')]:_0x3e5140[_0xb384('0x49')];if(!_0x1748d7[_0xb384('0x46')]['hasOwnProperty']('nolimit')){_0x55de99['limit']=qs[_0xb384('0x33')](_0x1748d7['query'][_0xb384('0x33')]);_0x55de99[_0xb384('0x4f')]=qs['offset'](_0x1748d7['query'][_0xb384('0x4f')]);}_0x55de99[_0xb384('0x50')]=qs[_0xb384('0x51')](_0x1748d7[_0xb384('0x46')]['sort']);_0x55de99[_0xb384('0x54')]=qs['filters'](_[_0xb384('0x52')](_0x1748d7[_0xb384('0x46')],_0x3e5140[_0xb384('0x47')]));_0x55de99[_0xb384('0x54')]['FaxAccountId']=_0x4fe9ed['id'];if(_0x1748d7[_0xb384('0x46')][_0xb384('0x53')]){_0x55de99['where']=_[_0xb384('0x55')](_0x55de99[_0xb384('0x54')],{'$or':_[_0xb384('0x43')](_0x55de99['attributes'],function(_0x3c0c53){var _0x5c81c8={};_0x5c81c8[_0x3c0c53]={'$like':'%'+_0x1748d7[_0xb384('0x46')][_0xb384('0x53')]+'%'};return _0x5c81c8;})});}_0x55de99=_[_0xb384('0x55')]({},_0x55de99,_0x1748d7[_0xb384('0x5f')]);return db[_0xb384('0x74')][_0xb384('0x35')]({'where':_0x55de99['where']})['then'](function(_0x491e03){_0x40c178['count']=_0x491e03;if(_0x1748d7[_0xb384('0x46')]['includeAll']){_0x55de99[_0xb384('0x57')]=[{'model':db[_0xb384('0x77')],'as':_0xb384('0x78'),'required':![]},{'model':db[_0xb384('0x79')],'as':_0xb384('0x7a'),'attributes':[_0xb384('0x40'),_0xb384('0x7b'),_0xb384('0x7c')],'required':![]},{'model':db[_0xb384('0x7d')],'as':_0xb384('0x7e'),'attributes':['id',_0xb384('0x40'),_0xb384('0x7f')],'where':_0x1748d7[_0xb384('0x46')]['tag']?{'id':_0x1748d7[_0xb384('0x46')][_0xb384('0x80')]}:undefined,'required':_0x1748d7[_0xb384('0x46')][_0xb384('0x80')]?!![]:![]}];}return db[_0xb384('0x74')][_0xb384('0x58')](_0x55de99);})[_0xb384('0x25')](function(_0x50b42b){_0x40c178[_0xb384('0x59')]=_0x50b42b;return _0x40c178;});}})[_0xb384('0x25')](respondWithFilteredResult(_0x4cf80b,_0x55de99))[_0xb384('0x2e')](handleError(_0x4cf80b,null));};exports[_0xb384('0x81')]=function(_0x17bf4b,_0xf6c8cb,_0x252cc5){return db[_0xb384('0x44')][_0xb384('0x6c')]({'where':{'id':_0x17bf4b['params']['id']}})['then'](handleEntityNotFound(_0xf6c8cb,null))['then'](function(_0x42cc35){if(_0x42cc35){return db[_0xb384('0x82')]['transaction'](function(_0x3470a9){return db[_0xb384('0x83')][_0xb384('0x3b')]({'where':{'FaxAccountId':_0x17bf4b[_0xb384('0x5a')]['id']},'transaction':_0x3470a9})['then'](function(_0x3319a8){var _0x6fe0b=_[_0xb384('0x43')](_0x17bf4b['body'],function(_0x477281){_0x477281[_0xb384('0x6a')]=_0x17bf4b['params']['id'];return _0x477281;});return db[_0xb384('0x83')][_0xb384('0x84')](_0x6fe0b,{'transaction':_0x3470a9});});})['then'](function(){return db[_0xb384('0x83')][_0xb384('0x85')]({'where':{'FaxAccountId':_0x17bf4b[_0xb384('0x5a')]['id']},'order':'priority'});});}})[_0xb384('0x25')](respondWithResult(_0xf6c8cb,null))[_0xb384('0x2e')](handleError(_0xf6c8cb,null));};exports[_0xb384('0x86')]=function(_0x217ca2,_0xcc6bb,_0x118b65){var _0x443c09={};var _0x3a53f2={};var _0x1e31af;var _0x52c6c2;return db[_0xb384('0x44')][_0xb384('0x6c')]({'where':{'id':_0x217ca2[_0xb384('0x5a')]['id']}})['then'](handleEntityNotFound(_0xcc6bb,null))[_0xb384('0x25')](function(_0x1df790){if(_0x1df790){_0x1e31af=_0x1df790;_0x3a53f2['model']=_[_0xb384('0x5c')](db[_0xb384('0x83')][_0xb384('0x5d')]);_0x3a53f2['query']=_['keys'](_0x217ca2['query']);_0x3a53f2[_0xb384('0x47')]=_[_0xb384('0x48')](_0x3a53f2[_0xb384('0x49')],_0x3a53f2[_0xb384('0x46')]);_0x443c09[_0xb384('0x4c')]=_[_0xb384('0x48')](_0x3a53f2[_0xb384('0x49')],qs[_0xb384('0x4a')](_0x217ca2[_0xb384('0x46')][_0xb384('0x4a')]));_0x443c09[_0xb384('0x4c')]=_0x443c09['attributes'][_0xb384('0x4b')]?_0x443c09[_0xb384('0x4c')]:_0x3a53f2[_0xb384('0x49')];_0x443c09[_0xb384('0x50')]=qs[_0xb384('0x51')](_0x217ca2[_0xb384('0x46')][_0xb384('0x51')]);_0x443c09['where']=qs[_0xb384('0x47')](_[_0xb384('0x52')](_0x217ca2[_0xb384('0x46')],_0x3a53f2[_0xb384('0x47')]));if(_0x217ca2[_0xb384('0x46')][_0xb384('0x53')]){_0x443c09['where']=_[_0xb384('0x55')](_0x443c09['where'],{'$or':_['map'](_0x443c09[_0xb384('0x4c')],function(_0xa2909d){var _0x254a34={};_0x254a34[_0xa2909d]={'$like':'%'+_0x217ca2[_0xb384('0x46')]['filter']+'%'};return _0x254a34;})});}_0x443c09=_[_0xb384('0x55')]({},_0x443c09,_0x217ca2[_0xb384('0x5f')]);return _0x1e31af[_0xb384('0x86')](_0x443c09);}})[_0xb384('0x25')](function(_0x5d6f12){if(_0x5d6f12){_0x52c6c2=_0x5d6f12['length'];if(!_0x217ca2[_0xb384('0x46')][_0xb384('0x4d')](_0xb384('0x4e'))){_0x443c09[_0xb384('0x33')]=qs[_0xb384('0x33')](_0x217ca2[_0xb384('0x46')]['limit']);_0x443c09[_0xb384('0x4f')]=qs[_0xb384('0x4f')](_0x217ca2[_0xb384('0x46')]['offset']);}return _0x1e31af[_0xb384('0x86')](_0x443c09);}})[_0xb384('0x25')](function(_0x241ace){if(_0x241ace){return _0x241ace?{'count':_0x52c6c2,'rows':_0x241ace}:null;}})[_0xb384('0x25')](respondWithResult(_0xcc6bb,null))[_0xb384('0x2e')](handleError(_0xcc6bb,null));};function Extension(_0x10099b,_0xcbfc0e,_0x1e37b4,_0x15c83d){this[_0xb384('0x87')]=_0xb384('0x88');this[_0xb384('0x89')]=_0x10099b[_0xb384('0x8a')];this[_0xb384('0x8b')]=_0x15c83d;this['type']=_0xb384('0x8c');this[_0xb384('0x8d')]='Fax\x20Extension';this[_0xb384('0x6a')]=_0x10099b['id'];this[_0xb384('0x8e')]=_0xcbfc0e;this[_0xb384('0x8f')]=_0x1e37b4;}function createExtensionsReciveFax(_0x1dfe11){var _0x50781f=0x1;var _0x32e930=[];_0x32e930[_0xb384('0x90')](new Extension(_0x1dfe11,_0x50781f,'',_0xb384('0x91')));_0x50781f+=0x1;_0x32e930['push'](new Extension(_0x1dfe11,_0x50781f,'CDR(type)=inbound-fax',_0xb384('0x92')));_0x50781f+=0x1;for(var _0x4366d4 in _0x1dfe11){if(_0x1dfe11['hasOwnProperty'](_0x4366d4)&&(_0x4366d4===_0xb384('0x93')||_0x4366d4==='localstationid'||_0x4366d4==='gateway'||_0x4366d4==='faxdetect'||_0x4366d4===_0xb384('0x94')||_0x4366d4===_0xb384('0x95')||_0x4366d4===_0xb384('0x96')||_0x4366d4==='modem'||_0x4366d4===_0xb384('0x97'))){_0x32e930[_0xb384('0x90')](new Extension(_0x1dfe11,_0x50781f,_0xb384('0x98')+_0x4366d4+')='+_0x1dfe11[_0x4366d4],'Set'));_0x50781f+=0x1;}}_0x32e930[_0xb384('0x90')](new Extension(_0x1dfe11,_0x50781f,'6',_0xb384('0x99')));_0x50781f+=0x1;_0x32e930[_0xb384('0x90')](new Extension(_0x1dfe11,_0x50781f,'/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax'));_0x50781f=0x0;return _0x32e930;}exports['addAccountApplications']=function(_0x4c4f4b,_0x29f56e,_0x3c55a9){var _0x329133;return db[_0xb384('0x82')][_0xb384('0x9a')](function(_0x5f3bc7){return db[_0xb384('0x44')][_0xb384('0x61')](_0x4c4f4b[_0xb384('0x62')],{'transaction':_0x5f3bc7})[_0xb384('0x25')](function(_0x30ea33){_0x329133=_0x30ea33[_0xb384('0x3c')]({'plain':!![]});return db[_0xb384('0x9b')][_0xb384('0x84')](createExtensionsReciveFax(_0x329133),{'transaction':_0x5f3bc7});});})['then'](function(){return _0x329133;})[_0xb384('0x25')](respondWithResult(_0x29f56e,null))[_0xb384('0x2e')](handleError(_0x29f56e,null));};exports['updateAccountApplications']=function(_0xb5ae40,_0x295c8a,_0x4b3d0f){var _0xcd7c23;return db['sequelize'][_0xb384('0x9a')](function(_0x5ea6d3){return db['FaxAccount'][_0xb384('0x3a')](_0xb5ae40[_0xb384('0x62')],{'where':{'id':_0xb5ae40[_0xb384('0x62')]['id']},'transaction':_0x5ea6d3})[_0xb384('0x25')](function(_0x52fef6){return db[_0xb384('0x9b')]['destroy']({'where':{'FaxAccountId':_0xb5ae40[_0xb384('0x62')]['id']},'transaction':_0x5ea6d3})[_0xb384('0x25')](function(_0x445855){return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_[_0xb384('0x75')](_0xb5ae40[_0xb384('0x62')],['tech',_0xb384('0x9c'),_0xb384('0x9d'),_0xb384('0x9e'),_0xb384('0x9f'),_0xb384('0xa0')])),{'transaction':_0x5ea6d3});});});})['then'](function(){return db[_0xb384('0x44')][_0xb384('0xa1')](_0xb5ae40[_0xb384('0x62')]['id']);})[_0xb384('0x25')](respondWithResult(_0x295c8a,null))[_0xb384('0x2e')](handleError(_0x295c8a,null));};exports[_0xb384('0xa2')]=function(_0x59eafc,_0x39bee7,_0x49403e){var _0x4cce30={'raw':!![],'where':{}};var _0x2ecee1={};var _0x3f415b={'count':0x0,'rows':[]};return db[_0xb384('0x44')]['findOne']({'where':{'id':_0x59eafc[_0xb384('0x5a')]['id']}})[_0xb384('0x25')](handleEntityNotFound(_0x39bee7,null))['then'](function(_0x13a472){if(_0x13a472){_0x2ecee1[_0xb384('0x49')]=_[_0xb384('0x5c')](db['FaxMessage'][_0xb384('0x5d')]);_0x2ecee1[_0xb384('0x46')]=_[_0xb384('0x5c')](_0x59eafc[_0xb384('0x46')]);_0x2ecee1['filters']=_[_0xb384('0x48')](_0x2ecee1[_0xb384('0x49')],_0x2ecee1['query']);_0x4cce30[_0xb384('0x4c')]=_['intersection'](_0x2ecee1['model'],qs[_0xb384('0x4a')](_0x59eafc[_0xb384('0x46')]['fields']));_0x4cce30[_0xb384('0x4c')]=_0x4cce30[_0xb384('0x4c')]['length']?_0x4cce30[_0xb384('0x4c')]:_0x2ecee1[_0xb384('0x49')];if(!_0x59eafc[_0xb384('0x46')][_0xb384('0x4d')](_0xb384('0x4e'))){_0x4cce30[_0xb384('0x33')]=qs[_0xb384('0x33')](_0x59eafc[_0xb384('0x46')][_0xb384('0x33')]);_0x4cce30[_0xb384('0x4f')]=qs['offset'](_0x59eafc['query'][_0xb384('0x4f')]);}_0x4cce30['order']=qs[_0xb384('0x51')](_0x59eafc[_0xb384('0x46')][_0xb384('0x51')]);_0x4cce30[_0xb384('0x54')]=qs[_0xb384('0x47')](_[_0xb384('0x52')](_0x59eafc[_0xb384('0x46')],_0x2ecee1[_0xb384('0x47')]));_0x4cce30[_0xb384('0x54')]['FaxAccountId']=_0x13a472['id'];if(_0x59eafc[_0xb384('0x46')][_0xb384('0x53')]){_0x4cce30[_0xb384('0x54')]=_[_0xb384('0x55')](_0x4cce30[_0xb384('0x54')],{'$or':_['map'](_0x4cce30[_0xb384('0x4c')],function(_0x784032){var _0x1a2c9c={};_0x1a2c9c[_0x784032]={'$like':'%'+_0x59eafc['query'][_0xb384('0x53')]+'%'};return _0x1a2c9c;})});}if(_0x59eafc[_0xb384('0x46')][_0xb384('0xa3')]){var _0x37c0b5=_0x59eafc[_0xb384('0x46')][_0xb384('0xa3')][_0xb384('0xa4')](',');var _0x24b7ab={};_0x24b7ab[_0x37c0b5[0x0]]={'$gte':moment(_0x37c0b5[0x1])[_0xb384('0xa5')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4cce30['where']=_[_0xb384('0x55')](_0x4cce30[_0xb384('0x54')],_0x24b7ab);}_0x4cce30=_['merge']({},_0x4cce30,_0x59eafc[_0xb384('0x5f')]);return db['FaxMessage'][_0xb384('0x35')]({'where':_0x4cce30[_0xb384('0x54')]})[_0xb384('0x25')](function(_0x41c67f){_0x3f415b['count']=_0x41c67f;if(_0x59eafc[_0xb384('0x46')][_0xb384('0x5e')]){_0x4cce30[_0xb384('0x57')]=[{'all':!![]}];}return db[_0xb384('0xa6')][_0xb384('0x58')](_0x4cce30);})['then'](function(_0x48d600){_0x3f415b['rows']=_0x48d600;return _0x3f415b;});}})[_0xb384('0x25')](respondWithFilteredResult(_0x39bee7,_0x4cce30))[_0xb384('0x2e')](handleError(_0x39bee7,null));};exports[_0xb384('0xa7')]=function(_0x2dc80f,_0x16dc50,_0xc8aab5){var _0x22c485,_0x144d25={},_0x5807e6;if(_0x2dc80f[_0xb384('0x62')]['to']){_0x5807e6=_0x2dc80f[_0xb384('0x62')]['to'][0x0];}return db[_0xb384('0x44')][_0xb384('0x60')]({'where':{'id':_0x2dc80f['params']['id']},'include':[{'model':db[_0xb384('0xa8')],'as':'List','include':[{'model':db[_0xb384('0x77')],'as':_0xb384('0xa9'),'where':{'fax':_0x5807e6},'limit':0x1,'order':[[_0xb384('0x9e'),'DESC']]}]}]})[_0xb384('0x25')](handleEntityNotFound(_0x16dc50,null))['then'](function(_0x4eceb2){_0x22c485=_0x4eceb2;if(_0x2dc80f[_0xb384('0x62')]['attachments']&&_0x2dc80f[_0xb384('0x62')]['attachments'][_0xb384('0x4b')]){for(var _0x51a0c9=0x0;_0x51a0c9<_0x2dc80f[_0xb384('0x62')][_0xb384('0xaa')]['length'];_0x51a0c9+=0x1){_0x2dc80f[_0xb384('0x62')][_0xb384('0xaa')][_0x51a0c9]={'filename':_0x2dc80f[_0xb384('0x62')]['attachments'][_0x51a0c9][_0xb384('0x40')],'id':_0x2dc80f[_0xb384('0x62')]['attachments'][_0x51a0c9]['id'],'path':path[_0xb384('0xab')](config[_0xb384('0xac')],_0xb384('0xad'),_0x2dc80f[_0xb384('0x62')][_0xb384('0xaa')][_0x51a0c9][_0xb384('0xae')])};}}return respondWithRpcPromise(_0xb384('0xaf'),_0xb384('0xaf'),{'FaxAccountId':_[_0xb384('0xb0')](_0x2dc80f[_0xb384('0x5a')]['id'])?undefined:_0x2dc80f[_0xb384('0x5a')]['id'],'path':_['isNil'](_0x2dc80f[_0xb384('0x62')][_0xb384('0xaa')][0x0][_0xb384('0x9')])?undefined:_0x2dc80f[_0xb384('0x62')]['attachments'][0x0]['path'],'fax':_['isNil'](_0x2dc80f[_0xb384('0x62')]['to'][0x0])?undefined:_0x2dc80f[_0xb384('0x62')]['to'][0x0]},client9002);})[_0xb384('0x25')](function(){if(_0x22c485){if(_[_0xb384('0xb0')](_0x2dc80f['body'][_0xb384('0xb1')])){_0x2dc80f[_0xb384('0x62')][_0xb384('0xb1')]=util[_0xb384('0xa5')](_0xb384('0xb2'),_0x22c485[_0xb384('0x40')],_0x22c485[_0xb384('0xb3')]);}if(_0x22c485[_0xb384('0xb4')]){if(_0x22c485[_0xb384('0xb4')]['Contacts']['length']){return _0x22c485[_0xb384('0xb4')][_0xb384('0xa9')][0x0];}else{return db[_0xb384('0x77')][_0xb384('0x61')](_[_0xb384('0xb5')](_0x2dc80f[_0xb384('0x62')],{'firstName':_0x2dc80f[_0xb384('0x62')]['to'][0x0],'phone':_0x2dc80f[_0xb384('0x62')]['to'][0x0],'fax':_0x2dc80f[_0xb384('0x62')]['to'][0x0],'ListId':_0x22c485[_0xb384('0xa0')]}));}}else{throw new Error(_0xb384('0xb6'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0xb384('0x25')](function(_0x45ff4b){if(_0x45ff4b){return db[_0xb384('0x74')]['find']({'where':{'ContactId':_0x45ff4b['id'],'closed':![],'FaxAccountId':_0x22c485['id']}})[_0xb384('0x25')](function(_0x1104ce){if(_0x1104ce){return[_0x1104ce,![]];}return db[_0xb384('0x74')][_0xb384('0x61')]({'UserId':_0x2dc80f[_0xb384('0x63')]['id'],'ContactId':_0x45ff4b['id'],'FaxAccountId':_0x22c485['id'],'fax':_0x2dc80f[_0xb384('0x62')]['to'][0x0],'firstMsgDirection':_0xb384('0xb7'),'Messages':[_[_0xb384('0x55')](_0x2dc80f['body'],{'read':![],'body':_0x2dc80f['body'][_0xb384('0xaa')][0x0][_0xb384('0xb8')],'FaxAccountId':_0x22c485['id'],'UserId':_0x2dc80f[_0xb384('0x63')]['id'],'ContactId':_0x45ff4b['id'],'AttachmentId':_0x2dc80f['body'][_0xb384('0xaa')][0x0]['id']})]},{'include':[{'model':db[_0xb384('0xa6')],'as':_0xb384('0xb9')}]})['then'](function(_0x59b5f9){return[_0x59b5f9,!![]];});});}else{throw new Error(_0xb384('0xba'));}})[_0xb384('0xbb')](function(_0x3567a6,_0x3ebb29){if(_0x3ebb29){return _0x3567a6;}return db[_0xb384('0xa6')][_0xb384('0x61')]({'direction':'out','read':![],'body':_0x2dc80f[_0xb384('0x62')]['attachments'][0x0]['filename'],'FaxAccountId':_0x22c485['id'],'FaxInteractionId':_0x3567a6['id'],'UserId':_0x2dc80f['user']['id'],'ContactId':_0x3567a6[_0xb384('0xbc')],'AttachmentId':_0x2dc80f[_0xb384('0x62')][_0xb384('0xaa')][0x0]['id']})[_0xb384('0x25')](function(_0x23c292){_0x3567a6['dataValues'][_0xb384('0xb9')]=[];_0x3567a6[_0xb384('0xbd')][_0xb384('0xb9')]['push'](_0x23c292[_0xb384('0xbd')]);return _0x3567a6;});})['then'](function(_0x4f1257){respondWithRpcPromise('SendFax',_0xb384('0xbe'),{'FaxAccountId':_[_0xb384('0xb0')](_0x2dc80f[_0xb384('0x5a')]['id'])?undefined:_0x2dc80f[_0xb384('0x5a')]['id'],'path':_[_0xb384('0xb0')](_0x2dc80f[_0xb384('0x62')][_0xb384('0xaa')][0x0][_0xb384('0x9')])?undefined:_0x2dc80f[_0xb384('0x62')]['attachments'][0x0][_0xb384('0x9')],'fax':_[_0xb384('0xb0')](_0x2dc80f[_0xb384('0x62')]['to'][0x0])?undefined:_0x2dc80f[_0xb384('0x62')]['to'][0x0],'AttachmentId':_0x2dc80f[_0xb384('0x62')][_0xb384('0xaa')][0x0]['id']},client9002)['then'](function(_0x12a175){logger['info'](_0xb384('0xbf'),_0x12a175);})[_0xb384('0x2e')](function(_0x11725f){logger[_0xb384('0x26')](_0xb384('0xbf'),_0x11725f);});return _0x4f1257;})[_0xb384('0x25')](respondWithResult(_0x16dc50,null))[_0xb384('0x2e')](handleError(_0x16dc50,null));};exports[_0xb384('0xc0')]=function(_0x169be5,_0x3a42cc,_0x1aec18){return db[_0xb384('0x44')][_0xb384('0x60')]({'where':{'id':_0x169be5[_0xb384('0x5a')]['id']}})[_0xb384('0x25')](handleEntityNotFound(_0x3a42cc,null))['then'](function(_0x2ed7f5){if(_0x2ed7f5){return _0x2ed7f5[_0xb384('0xc0')](_0x169be5[_0xb384('0x62')][_0xb384('0x6f')],_[_0xb384('0x75')](_0x169be5[_0xb384('0x62')],['ids','id'])||{})[_0xb384('0xbb')](function(_0x4298c7){for(var _0x58c567=0x0;_0x58c567<_0x169be5[_0xb384('0x62')][_0xb384('0x6f')][_0xb384('0x4b')];_0x58c567+=0x1){socket[_0xb384('0xc1')](_0xb384('0xc2'),{'UserId':Number(_0x169be5[_0xb384('0x62')]['ids'][_0x58c567]),'FaxAccountId':Number(_0x169be5['params']['id'])});}return _0x4298c7;});}})[_0xb384('0x25')](respondWithResult(_0x3a42cc,null))[_0xb384('0x2e')](handleError(_0x3a42cc,null));};exports[_0xb384('0xc3')]=function(_0x1b873b,_0x42b058,_0x111429){return db['FaxAccount'][_0xb384('0x60')]({'where':{'id':_0x1b873b[_0xb384('0x5a')]['id']}})['then'](handleEntityNotFound(_0x42b058,null))[_0xb384('0x25')](function(_0x1de55f){if(_0x1de55f){return _0x1de55f[_0xb384('0xc3')](_0x1b873b[_0xb384('0x46')][_0xb384('0x6f')])[_0xb384('0x25')](function(){if(_[_0xb384('0xc4')](_0x1b873b[_0xb384('0x46')][_0xb384('0x6f')])){for(var _0x320c75=0x0;_0x320c75<_0x1b873b[_0xb384('0x46')][_0xb384('0x6f')]['length'];_0x320c75+=0x1){socket['emit'](_0xb384('0xc5'),{'UserId':Number(_0x1b873b[_0xb384('0x46')][_0xb384('0x6f')][_0x320c75]),'FaxAccountId':Number(_0x1b873b[_0xb384('0x5a')]['id'])});}}else{socket[_0xb384('0xc1')](_0xb384('0xc5'),{'UserId':Number(_0x1b873b['query']['ids']),'FaxAccountId':Number(_0x1b873b[_0xb384('0x5a')]['id'])});}});}})[_0xb384('0x25')](respondWithStatusCode(_0x42b058,null))[_0xb384('0x2e')](handleError(_0x42b058,null));};exports[_0xb384('0xc6')]=function(_0x117474,_0x24138c,_0x1f620e){var _0x591a81={};var _0x45a970={};var _0x137175;var _0x43b40c;return db[_0xb384('0x44')][_0xb384('0x6c')]({'where':{'id':_0x117474['params']['id']}})[_0xb384('0x25')](handleEntityNotFound(_0x24138c,null))[_0xb384('0x25')](function(_0x29e76b){if(_0x29e76b){_0x137175=_0x29e76b;_0x45a970[_0xb384('0x49')]=_[_0xb384('0x5c')](db[_0xb384('0x79')]['rawAttributes']);_0x45a970[_0xb384('0x46')]=_[_0xb384('0x5c')](_0x117474[_0xb384('0x46')]);_0x45a970[_0xb384('0x47')]=_[_0xb384('0x48')](_0x45a970['model'],_0x45a970['query']);_0x591a81[_0xb384('0x4c')]=_[_0xb384('0x48')](_0x45a970[_0xb384('0x49')],qs[_0xb384('0x4a')](_0x117474[_0xb384('0x46')]['fields']));_0x591a81['attributes']=_0x591a81['attributes'][_0xb384('0x4b')]?_0x591a81[_0xb384('0x4c')]:_0x45a970['model'];_0x591a81[_0xb384('0x50')]=qs['sort'](_0x117474[_0xb384('0x46')][_0xb384('0x51')]);_0x591a81[_0xb384('0x54')]=qs[_0xb384('0x47')](_[_0xb384('0x52')](_0x117474[_0xb384('0x46')],_0x45a970['filters']));if(_0x117474['query']['filter']){_0x591a81[_0xb384('0x54')]=_[_0xb384('0x55')](_0x591a81[_0xb384('0x54')],{'$or':_['map'](_0x591a81['attributes'],function(_0x1a8a51){var _0x2b228e={};_0x2b228e[_0x1a8a51]={'$like':'%'+_0x117474[_0xb384('0x46')][_0xb384('0x53')]+'%'};return _0x2b228e;})});}_0x591a81=_['merge']({},_0x591a81,_0x117474[_0xb384('0x5f')]);return _0x137175[_0xb384('0xc6')](_0x591a81);}})[_0xb384('0x25')](function(_0x12fa2d){if(_0x12fa2d){_0x43b40c=_0x12fa2d[_0xb384('0x4b')];if(!_0x117474[_0xb384('0x46')][_0xb384('0x4d')](_0xb384('0x4e'))){_0x591a81[_0xb384('0x33')]=qs[_0xb384('0x33')](_0x117474['query'][_0xb384('0x33')]);_0x591a81[_0xb384('0x4f')]=qs[_0xb384('0x4f')](_0x117474[_0xb384('0x46')]['offset']);}return _0x137175[_0xb384('0xc6')](_0x591a81);}})[_0xb384('0x25')](function(_0x5012af){if(_0x5012af){return _0x5012af?{'count':_0x43b40c,'rows':_0x5012af}:null;}})[_0xb384('0x25')](respondWithResult(_0x24138c,null))[_0xb384('0x2e')](handleError(_0x24138c,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 30ef265..9389e97 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 _0x25b4=['remove','emit','hook','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x2bf2eb,_0x1aafeb){var _0x660889=function(_0x33207c){while(--_0x33207c){_0x2bf2eb['push'](_0x2bf2eb['shift']());}};_0x660889(++_0x1aafeb);}(_0x25b4,0x94));var _0x425b=function(_0x47f719,_0x2e559d){_0x47f719=_0x47f719-0x0;var _0x407f4e=_0x25b4[_0x47f719];return _0x407f4e;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0x425b('0x0'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x425b('0x1')](0x0);var events={'afterCreate':_0x425b('0x2'),'afterUpdate':_0x425b('0x3'),'afterDestroy':_0x425b('0x4')};function emitEvent(_0x2c95c2){return function(_0xa48e7d,_0x353f74,_0x369ab4){FaxAccountEvents[_0x425b('0x5')](_0x2c95c2+':'+_0xa48e7d['id'],_0xa48e7d);FaxAccountEvents[_0x425b('0x5')](_0x2c95c2,_0xa48e7d);_0x369ab4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x425b('0x6')](e,emitEvent(event));}}module[_0x425b('0x7')]=FaxAccountEvents; \ No newline at end of file +var _0x60d7=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x1104ed,_0x578ff9){var _0x27d221=function(_0xa83f7b){while(--_0xa83f7b){_0x1104ed['push'](_0x1104ed['shift']());}};_0x27d221(++_0x578ff9);}(_0x60d7,0xe9));var _0x760d=function(_0x392b8e,_0x18b263){_0x392b8e=_0x392b8e-0x0;var _0x5e4efe=_0x60d7[_0x392b8e];return _0x5e4efe;};'use strict';var EventEmitter=require(_0x760d('0x0'));var FaxAccount=require(_0x760d('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x760d('0x2')](0x0);var events={'afterCreate':_0x760d('0x3'),'afterUpdate':_0x760d('0x4'),'afterDestroy':_0x760d('0x5')};function emitEvent(_0x18da70){return function(_0x46c40d,_0x3f8202,_0x39ab66){FaxAccountEvents[_0x760d('0x6')](_0x18da70+':'+_0x46c40d['id'],_0x46c40d);FaxAccountEvents[_0x760d('0x6')](_0x18da70,_0x46c40d);_0x39ab66(null);};}for(var e in events){if(events[_0x760d('0x7')](e)){var event=events[e];FaxAccount[_0x760d('0x8')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 60bb930..a6267a3 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 _0x4973=['../../config/logger','api','moment','path','rimraf','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','lodash','util'];(function(_0x47f603,_0x179d94){var _0x516e77=function(_0x3618e4){while(--_0x3618e4){_0x47f603['push'](_0x47f603['shift']());}};_0x516e77(++_0x179d94);}(_0x4973,0x1ba));var _0x3497=function(_0x226b19,_0x4bdfb8){_0x226b19=_0x226b19-0x0;var _0x6bfc30=_0x4973[_0x226b19];return _0x6bfc30;};'use strict';var _=require(_0x3497('0x0'));var util=require(_0x3497('0x1'));var logger=require(_0x3497('0x2'))(_0x3497('0x3'));var moment=require(_0x3497('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3497('0x5'));var rimraf=require(_0x3497('0x6'));var config=require(_0x3497('0x7'));var attributes=require(_0x3497('0x8'));module[_0x3497('0x9')]=function(_0x22d6f4,_0x248723){return _0x22d6f4[_0x3497('0xa')](_0x3497('0xb'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5472=['exports','define','fax_accounts','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./faxAccount.attributes'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x5472,0x1d1));var _0x2547=function(_0x38ff3c,_0x53525b){_0x38ff3c=_0x38ff3c-0x0;var _0x339faa=_0x5472[_0x38ff3c];return _0x339faa;};'use strict';var _=require(_0x2547('0x0'));var util=require('util');var logger=require(_0x2547('0x1'))(_0x2547('0x2'));var moment=require('moment');var BPromise=require(_0x2547('0x3'));var rp=require(_0x2547('0x4'));var fs=require('fs');var path=require(_0x2547('0x5'));var rimraf=require('rimraf');var config=require(_0x2547('0x6'));var attributes=require(_0x2547('0x7'));module[_0x2547('0x8')]=function(_0x2cc241,_0x2f4569){return _0x2cc241[_0x2547('0x9')]('FaxAccount',attributes,{'tableName':_0x2547('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 4f9b8bd..4bb33ce 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 _0x48e6=['info','result','catch','GetFaxAccount','findAll','options','raw','where','attributes','limit','map','model','include','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','keys','createdAt','updatedAt','CompanyId','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','FaxAccount','account','Contacts','FaxApplication','Applications','List','get','list','applications','orderBy','asc','ListId','create','FaxInteraction','spread','close','unmanaged','created','interaction','ContactId','UserId','User','find','name','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','request','then','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message'];(function(_0x1421f,_0x681da5){var _0x2706b9=function(_0x3269a9){while(--_0x3269a9){_0x1421f['push'](_0x1421f['shift']());}};_0x2706b9(++_0x681da5);}(_0x48e6,0x1e1));var _0x648e=function(_0x13d87a,_0x30c2d7){_0x13d87a=_0x13d87a-0x0;var _0x34de4d=_0x48e6[_0x13d87a];return _0x34de4d;};'use strict';var _=require(_0x648e('0x0'));var util=require(_0x648e('0x1'));var moment=require(_0x648e('0x2'));var BPromise=require('bluebird');var rs=require(_0x648e('0x3'));var fs=require('fs');var Redis=require(_0x648e('0x4'));var db=require(_0x648e('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x648e('0x6'));var config=require(_0x648e('0x7'));var jayson=require(_0x648e('0x8'));var client=jayson[_0x648e('0x9')]['http']({'port':0x232c});config[_0x648e('0xa')]=_[_0x648e('0xb')](config[_0x648e('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x648e('0xc'))(new Redis(config[_0x648e('0xa')]));require('./faxAccount.socket')['register'](socket);function respondWithRpcPromise(_0x425bdf,_0x2b4da2,_0x5c2362){return new BPromise(function(_0x2e5024,_0x52ebae){return client[_0x648e('0xd')](_0x425bdf,_0x5c2362)[_0x648e('0xe')](function(_0x31faca){logger['info']('FaxAccount,\x20%s,\x20%s',_0x2b4da2,_0x648e('0xf'));logger[_0x648e('0x10')](_0x648e('0x11'),_0x2b4da2,_0x648e('0xf'),JSON[_0x648e('0x12')](_0x31faca));if(_0x31faca[_0x648e('0x13')]){if(_0x31faca[_0x648e('0x13')][_0x648e('0x14')]===0x1f4){logger['error'](_0x648e('0x15'),_0x2b4da2,_0x31faca[_0x648e('0x13')][_0x648e('0x16')]);return _0x52ebae(_0x31faca[_0x648e('0x13')][_0x648e('0x16')]);}logger['error'](_0x648e('0x15'),_0x2b4da2,_0x31faca[_0x648e('0x13')]['message']);return _0x2e5024(_0x31faca[_0x648e('0x13')][_0x648e('0x16')]);}else{logger[_0x648e('0x17')]('FaxAccount,\x20%s,\x20%s',_0x2b4da2,'request\x20sent');_0x2e5024(_0x31faca[_0x648e('0x18')][_0x648e('0x16')]);}})[_0x648e('0x19')](function(_0x14dd6f){logger[_0x648e('0x13')](_0x648e('0x15'),_0x2b4da2,_0x14dd6f);_0x52ebae(_0x14dd6f);});});}exports[_0x648e('0x1a')]=function(_0x1e7823){var _0x29a4cd=this;return new Promise(function(_0x386407,_0x32d7cf){return db['FaxAccount'][_0x648e('0x1b')]({'raw':_0x1e7823[_0x648e('0x1c')]?_0x1e7823[_0x648e('0x1c')][_0x648e('0x1d')]===undefined?!![]:![]:!![],'where':_0x1e7823[_0x648e('0x1c')]?_0x1e7823[_0x648e('0x1c')][_0x648e('0x1e')]||null:null,'attributes':_0x1e7823[_0x648e('0x1c')]?_0x1e7823['options'][_0x648e('0x1f')]||null:null,'limit':_0x1e7823[_0x648e('0x1c')]?_0x1e7823[_0x648e('0x1c')][_0x648e('0x20')]||null:null,'include':_0x1e7823[_0x648e('0x1c')]?_0x1e7823['options']['include']?_[_0x648e('0x21')](_0x1e7823[_0x648e('0x1c')]['include'],function(_0x8601b5){return{'model':db[_0x8601b5[_0x648e('0x22')]],'as':_0x8601b5['as'],'attributes':_0x8601b5['attributes'],'include':_0x8601b5[_0x648e('0x23')]?_[_0x648e('0x21')](_0x8601b5['include'],function(_0x1cc901){return{'model':db[_0x1cc901[_0x648e('0x22')]],'as':_0x1cc901['as'],'attributes':_0x1cc901[_0x648e('0x1f')],'include':_0x1cc901['include']?_['map'](_0x1cc901[_0x648e('0x23')],function(_0x2478ef){return{'model':db[_0x2478ef['model']],'as':_0x2478ef['as'],'attributes':_0x2478ef['attributes']};}):[]};}):[]};}):[]:[]})[_0x648e('0xe')](function(_0x10725c){logger['info']('GetFaxAccount',_0x1e7823);logger[_0x648e('0x10')]('GetFaxAccount',_0x1e7823,JSON[_0x648e('0x12')](_0x10725c));_0x386407(_0x10725c);})['catch'](function(_0x22820d){logger['error'](_0x648e('0x1a'),_0x22820d[_0x648e('0x16')],_0x1e7823);_0x32d7cf(_0x29a4cd['error'](0x1f4,_0x22820d['message']));});});};exports[_0x648e('0x24')]=function(_0x5d26b6,_0x4ea67a,_0xf51f16){var _0x2bde53=this;return new Promise(function(_0x3c4772,_0x11ba74){var _0x22e9bd={'body':_0x5d26b6[_0x648e('0x25')],'channel':_0x648e('0x26')};var _0x579111=[];var _0x8458f7=[];var _0xb3ab97={};return db[_0x648e('0x27')][_0x648e('0x28')]()[_0x648e('0xe')](function(_0x5bfa68){if(!_0x5bfa68){throw new db[(_0x648e('0x29'))][(_0x648e('0x2a'))](_0x648e('0x2b'));}_0x579111=_['difference'](_[_0x648e('0x2c')](_0x5bfa68),[_0x648e('0x2d'),_0x648e('0x2e')]);_0x8458f7=_['difference'](_['keys'](_0x5bfa68),[_0x648e('0x2d'),_0x648e('0x2e'),_0x648e('0x2f'),'ListId']);if(_0x5d26b6[_0x648e('0x25')]['id']){delete _0x5d26b6[_0x648e('0x25')]['id'];}if(_['isNil'](_0x5d26b6[_0x648e('0x25')][_0x648e('0x30')])){throw new db[(_0x648e('0x29'))][(_0x648e('0x2a'))](_0x648e('0x31'));}if(_[_0x648e('0x32')](_0x5d26b6[_0x648e('0x25')][_0x648e('0x25')])||_0x5d26b6[_0x648e('0x25')][_0x648e('0x25')]===''){throw new db[(_0x648e('0x29'))][(_0x648e('0x2a'))](_0x648e('0x33'));}if(_[_0x648e('0x32')](_0x5d26b6[_0x648e('0x25')][_0x648e('0x34')])){throw new db[(_0x648e('0x29'))][(_0x648e('0x2a'))](_0x648e('0x35')+_0x8458f7);}if(!_['includes'](_0x8458f7,_0x5d26b6['body'][_0x648e('0x34')])){throw new db[(_0x648e('0x29'))][(_0x648e('0x2a'))](_0x648e('0x36')+_0x8458f7);}_0xb3ab97[_0x5d26b6[_0x648e('0x25')][_0x648e('0x34')]]=_0x5d26b6[_0x648e('0x25')]['from'];})[_0x648e('0xe')](function(){return db[_0x648e('0x37')]['find']({'where':{'id':_0x5d26b6[_0x648e('0x38')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x648e('0x27')],'as':_0x648e('0x39'),'where':_0xb3ab97,'limit':0x1,'order':[[_0x648e('0x2e'),'DESC']]}]},{'model':db[_0x648e('0x3a')],'as':_0x648e('0x3b')}]});})[_0x648e('0xe')](function(_0x1b0ddc){if(_0x1b0ddc&&_0x1b0ddc[_0x648e('0x3c')]){var _0x1a8963=_0x1b0ddc[_0x648e('0x3d')]({'plain':!![]});_0x22e9bd[_0x648e('0x38')]=_0x1a8963;_0x22e9bd['applications']=_0x1a8963['Applications'];_0x22e9bd[_0x648e('0x3e')]=_0x1a8963['List'];_0x22e9bd[_0x648e('0x3f')]=_[_0x648e('0x40')](_0x22e9bd[_0x648e('0x3f')],['priority'],[_0x648e('0x41')]);if(_0x22e9bd['account'][_0x648e('0x3b')]){delete _0x22e9bd[_0x648e('0x38')]['Applications'];}if(_0x22e9bd[_0x648e('0x38')][_0x648e('0x3c')]&&_0x22e9bd[_0x648e('0x38')][_0x648e('0x3c')][_0x648e('0x39')]['length']){return _0x22e9bd[_0x648e('0x38')][_0x648e('0x3c')]['Contacts'][0x0];}var _0x4b8617=_['defaults'](_0x5d26b6[_0x648e('0x25')],{'firstName':_0x5d26b6['body'][_0x648e('0x30')],'ListId':_0x1a8963[_0x648e('0x42')]});_0x4b8617[_0x5d26b6[_0x648e('0x25')]['mapKey']]=_0x5d26b6['body'][_0x648e('0x30')];return db[_0x648e('0x27')][_0x648e('0x43')](_0x4b8617,{'fields':_0x579111,'raw':!![]});}})[_0x648e('0xe')](function(_0x3c3843){_0x22e9bd['contact']=_0x3c3843;if(_0x3c3843){var _0x159c41={'ContactId':_0x3c3843['id'],'FaxAccountId':_0x5d26b6[_0x648e('0x38')]['id'],'fax':_0x3c3843[_0x648e('0x26')]};return db[_0x648e('0x44')]['find']({'where':{'ContactId':_0x3c3843['id'],'closed':![],'FaxAccountId':_0x5d26b6[_0x648e('0x38')]['id']}})['then'](function(_0x551a9d){if(_0x551a9d){return[_0x551a9d,![]];}return db[_0x648e('0x44')][_0x648e('0x43')](_0x159c41)[_0x648e('0xe')](function(_0x2f5ead){return[_0x2f5ead,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x648e('0x45')](function(_0x17955b,_0x1cb0a0){var _0x283261=_0x17955b['get']({'plain':!![]});if(_0x1cb0a0){if(_0x22e9bd['account']['autoclose']){_0x22e9bd[_0x648e('0x3f')]['push']({'id':0x0,'priority':_0x22e9bd['applications']['length']+0x1,'app':_0x648e('0x46'),'appdata':_0x648e('0x47'),'interval':'*,*,*,*'});}_0x283261[_0x648e('0x48')]=!![];}else{_0x283261[_0x648e('0x48')]=![];}_0x22e9bd[_0x648e('0x49')]=_0x283261;return db['FaxMessage'][_0x648e('0x43')]({'body':_0x5d26b6[_0x648e('0x25')]['body'],'FaxAccountId':_0x5d26b6[_0x648e('0x38')]['id'],'FaxInteractionId':_0x17955b['id'],'direction':'in','ContactId':_0x17955b[_0x648e('0x4a')],'AttachmentId':_0x5d26b6['body']['AttachmentId']});})[_0x648e('0xe')](function(_0x1696b1){_0x22e9bd[_0x648e('0x16')]=_0x1696b1;if(_0x22e9bd[_0x648e('0x49')][_0x648e('0x4b')]){return db[_0x648e('0x4c')][_0x648e('0x4d')]({'attributes':['id',_0x648e('0x4e')],'where':{'id':_0x22e9bd[_0x648e('0x49')][_0x648e('0x4b')]}})['then'](function(_0x293c5e){if(_0x293c5e){_0x22e9bd[_0x648e('0x3f')]['unshift']({'id':0x0,'priority':0x0,'app':_0x648e('0x4f'),'appdata':_0x293c5e['name']+','+(_0x22e9bd[_0x648e('0x38')][_0x648e('0x50')]||0xa),'interval':_0x648e('0x51')});}return respondWithRpcPromise(_0x648e('0x52'),_0x648e('0x53'),_0x22e9bd);});}return respondWithRpcPromise('Start',_0x648e('0x53'),_0x22e9bd);})[_0x648e('0xe')](function(_0x526403){_0x3c4772(_0x526403);})['catch'](function(_0x231ad8){_0x11ba74(_0x2bde53[_0x648e('0x13')](0x1f4,_0x231ad8[_0x648e('0x16')]));});});}; \ No newline at end of file +var _0xcfaf=['interaction','FaxMessage','ContactId','AttachmentId','UserId','User','unshift','startRouting','Start','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./faxAccount.socket','register','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','attributes','limit','include','map','model','then','body','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','updatedAt','createdAt','CompanyId','ListId','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','List','Applications','get','account','applications','list','orderBy','asc','Contacts','length','from','create','contact','FaxInteraction','Contact\x20not\x20found','spread','push','unmanaged','*,*,*,*','created'];(function(_0x3db199,_0x43f3c1){var _0x580d61=function(_0x24d45c){while(--_0x24d45c){_0x3db199['push'](_0x3db199['shift']());}};_0x580d61(++_0x43f3c1);}(_0xcfaf,0xb9));var _0xfcfa=function(_0x3f1678,_0x195928){_0x3f1678=_0x3f1678-0x0;var _0x2e4da2=_0xcfaf[_0x3f1678];return _0x2e4da2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfcfa('0x0'));var BPromise=require('bluebird');var rs=require(_0xfcfa('0x1'));var fs=require('fs');var Redis=require(_0xfcfa('0x2'));var db=require(_0xfcfa('0x3'))['db'];var utils=require(_0xfcfa('0x4'));var logger=require(_0xfcfa('0x5'))(_0xfcfa('0x6'));var config=require(_0xfcfa('0x7'));var jayson=require(_0xfcfa('0x8'));var client=jayson[_0xfcfa('0x9')][_0xfcfa('0xa')]({'port':0x232c});config[_0xfcfa('0xb')]=_[_0xfcfa('0xc')](config[_0xfcfa('0xb')],{'host':_0xfcfa('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xfcfa('0xe'))[_0xfcfa('0xf')](socket);function respondWithRpcPromise(_0x300a70,_0x55b888,_0x257f84){return new BPromise(function(_0x3bc287,_0x153763){return client[_0xfcfa('0x10')](_0x300a70,_0x257f84)['then'](function(_0x471464){logger[_0xfcfa('0x11')](_0xfcfa('0x12'),_0x55b888,_0xfcfa('0x13'));logger[_0xfcfa('0x14')](_0xfcfa('0x15'),_0x55b888,_0xfcfa('0x13'),JSON[_0xfcfa('0x16')](_0x471464));if(_0x471464[_0xfcfa('0x17')]){if(_0x471464[_0xfcfa('0x17')][_0xfcfa('0x18')]===0x1f4){logger[_0xfcfa('0x17')](_0xfcfa('0x12'),_0x55b888,_0x471464[_0xfcfa('0x17')][_0xfcfa('0x19')]);return _0x153763(_0x471464[_0xfcfa('0x17')][_0xfcfa('0x19')]);}logger[_0xfcfa('0x17')]('FaxAccount,\x20%s,\x20%s',_0x55b888,_0x471464[_0xfcfa('0x17')][_0xfcfa('0x19')]);return _0x3bc287(_0x471464[_0xfcfa('0x17')]['message']);}else{logger[_0xfcfa('0x11')](_0xfcfa('0x12'),_0x55b888,_0xfcfa('0x13'));_0x3bc287(_0x471464[_0xfcfa('0x1a')]['message']);}})[_0xfcfa('0x1b')](function(_0x9e1adb){logger[_0xfcfa('0x17')]('FaxAccount,\x20%s,\x20%s',_0x55b888,_0x9e1adb);_0x153763(_0x9e1adb);});});}exports[_0xfcfa('0x1c')]=function(_0x4c3c93){var _0x4859f4=this;return new Promise(function(_0x19e99b,_0x24a078){return db[_0xfcfa('0x1d')][_0xfcfa('0x1e')]({'raw':_0x4c3c93[_0xfcfa('0x1f')]?_0x4c3c93[_0xfcfa('0x1f')][_0xfcfa('0x20')]===undefined?!![]:![]:!![],'where':_0x4c3c93['options']?_0x4c3c93['options']['where']||null:null,'attributes':_0x4c3c93[_0xfcfa('0x1f')]?_0x4c3c93[_0xfcfa('0x1f')][_0xfcfa('0x21')]||null:null,'limit':_0x4c3c93['options']?_0x4c3c93[_0xfcfa('0x1f')][_0xfcfa('0x22')]||null:null,'include':_0x4c3c93[_0xfcfa('0x1f')]?_0x4c3c93[_0xfcfa('0x1f')][_0xfcfa('0x23')]?_[_0xfcfa('0x24')](_0x4c3c93[_0xfcfa('0x1f')]['include'],function(_0x5754bd){return{'model':db[_0x5754bd[_0xfcfa('0x25')]],'as':_0x5754bd['as'],'attributes':_0x5754bd[_0xfcfa('0x21')],'include':_0x5754bd[_0xfcfa('0x23')]?_['map'](_0x5754bd[_0xfcfa('0x23')],function(_0x1efc13){return{'model':db[_0x1efc13[_0xfcfa('0x25')]],'as':_0x1efc13['as'],'attributes':_0x1efc13['attributes'],'include':_0x1efc13[_0xfcfa('0x23')]?_['map'](_0x1efc13['include'],function(_0x2317ab){return{'model':db[_0x2317ab[_0xfcfa('0x25')]],'as':_0x2317ab['as'],'attributes':_0x2317ab[_0xfcfa('0x21')]};}):[]};}):[]};}):[]:[]})[_0xfcfa('0x26')](function(_0x494635){logger['info'](_0xfcfa('0x1c'),_0x4c3c93);logger[_0xfcfa('0x14')](_0xfcfa('0x1c'),_0x4c3c93,JSON['stringify'](_0x494635));_0x19e99b(_0x494635);})['catch'](function(_0x5c0f37){logger[_0xfcfa('0x17')](_0xfcfa('0x1c'),_0x5c0f37[_0xfcfa('0x19')],_0x4c3c93);_0x24a078(_0x4859f4['error'](0x1f4,_0x5c0f37[_0xfcfa('0x19')]));});});};exports['NotifyFaxAccount']=function(_0x860170,_0x218c91,_0x131cb4){var _0x30db4d=this;return new Promise(function(_0x2e5ae0,_0x3ba05f){var _0x1c1cf5={'body':_0x860170[_0xfcfa('0x27')],'channel':_0xfcfa('0x28')};var _0xe9fdf4=[];var _0x5129f5=[];var _0x4adfb3={};return db[_0xfcfa('0x29')][_0xfcfa('0x2a')]()[_0xfcfa('0x26')](function(_0x2cc6c6){if(!_0x2cc6c6){throw new db[(_0xfcfa('0x2b'))][(_0xfcfa('0x2c'))](_0xfcfa('0x2d'));}_0xe9fdf4=_[_0xfcfa('0x2e')](_[_0xfcfa('0x2f')](_0x2cc6c6),['createdAt',_0xfcfa('0x30')]);_0x5129f5=_['difference'](_[_0xfcfa('0x2f')](_0x2cc6c6),[_0xfcfa('0x31'),_0xfcfa('0x30'),_0xfcfa('0x32'),_0xfcfa('0x33')]);if(_0x860170['body']['id']){delete _0x860170[_0xfcfa('0x27')]['id'];}if(_[_0xfcfa('0x34')](_0x860170[_0xfcfa('0x27')]['from'])){throw new db[(_0xfcfa('0x2b'))][(_0xfcfa('0x2c'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x860170[_0xfcfa('0x27')][_0xfcfa('0x27')])||_0x860170[_0xfcfa('0x27')][_0xfcfa('0x27')]===''){throw new db[(_0xfcfa('0x2b'))][(_0xfcfa('0x2c'))](_0xfcfa('0x35'));}if(_[_0xfcfa('0x34')](_0x860170[_0xfcfa('0x27')]['mapKey'])){throw new db[(_0xfcfa('0x2b'))][(_0xfcfa('0x2c'))](_0xfcfa('0x36')+_0x5129f5);}if(!_[_0xfcfa('0x37')](_0x5129f5,_0x860170[_0xfcfa('0x27')][_0xfcfa('0x38')])){throw new db[(_0xfcfa('0x2b'))][(_0xfcfa('0x2c'))](_0xfcfa('0x39')+_0x5129f5);}_0x4adfb3[_0x860170['body'][_0xfcfa('0x38')]]=_0x860170['body']['from'];})[_0xfcfa('0x26')](function(){return db['FaxAccount'][_0xfcfa('0x3a')]({'where':{'id':_0x860170['account']['id']},'include':[{'model':db['CmList'],'as':_0xfcfa('0x3b'),'include':[{'model':db[_0xfcfa('0x29')],'as':'Contacts','where':_0x4adfb3,'limit':0x1,'order':[[_0xfcfa('0x30'),'DESC']]}]},{'model':db['FaxApplication'],'as':_0xfcfa('0x3c')}]});})[_0xfcfa('0x26')](function(_0x4e2989){if(_0x4e2989&&_0x4e2989['List']){var _0x44c771=_0x4e2989[_0xfcfa('0x3d')]({'plain':!![]});_0x1c1cf5[_0xfcfa('0x3e')]=_0x44c771;_0x1c1cf5[_0xfcfa('0x3f')]=_0x44c771[_0xfcfa('0x3c')];_0x1c1cf5[_0xfcfa('0x40')]=_0x44c771[_0xfcfa('0x3b')];_0x1c1cf5[_0xfcfa('0x3f')]=_[_0xfcfa('0x41')](_0x1c1cf5['applications'],['priority'],[_0xfcfa('0x42')]);if(_0x1c1cf5[_0xfcfa('0x3e')]['Applications']){delete _0x1c1cf5[_0xfcfa('0x3e')][_0xfcfa('0x3c')];}if(_0x1c1cf5[_0xfcfa('0x3e')][_0xfcfa('0x3b')]&&_0x1c1cf5[_0xfcfa('0x3e')][_0xfcfa('0x3b')][_0xfcfa('0x43')][_0xfcfa('0x44')]){return _0x1c1cf5[_0xfcfa('0x3e')]['List'][_0xfcfa('0x43')][0x0];}var _0x8d5199=_[_0xfcfa('0xc')](_0x860170[_0xfcfa('0x27')],{'firstName':_0x860170[_0xfcfa('0x27')][_0xfcfa('0x45')],'ListId':_0x44c771[_0xfcfa('0x33')]});_0x8d5199[_0x860170[_0xfcfa('0x27')]['mapKey']]=_0x860170[_0xfcfa('0x27')][_0xfcfa('0x45')];return db[_0xfcfa('0x29')][_0xfcfa('0x46')](_0x8d5199,{'fields':_0xe9fdf4,'raw':!![]});}})[_0xfcfa('0x26')](function(_0x285b3c){_0x1c1cf5[_0xfcfa('0x47')]=_0x285b3c;if(_0x285b3c){var _0xa9e40c={'ContactId':_0x285b3c['id'],'FaxAccountId':_0x860170[_0xfcfa('0x3e')]['id'],'fax':_0x285b3c[_0xfcfa('0x28')]};return db[_0xfcfa('0x48')][_0xfcfa('0x3a')]({'where':{'ContactId':_0x285b3c['id'],'closed':![],'FaxAccountId':_0x860170[_0xfcfa('0x3e')]['id']}})[_0xfcfa('0x26')](function(_0x4bd94c){if(_0x4bd94c){return[_0x4bd94c,![]];}return db[_0xfcfa('0x48')][_0xfcfa('0x46')](_0xa9e40c)[_0xfcfa('0x26')](function(_0x26895b){return[_0x26895b,!![]];});});}else{throw new Error(_0xfcfa('0x49'));}})[_0xfcfa('0x4a')](function(_0xa8830a,_0x105300){var _0x2e765f=_0xa8830a['get']({'plain':!![]});if(_0x105300){if(_0x1c1cf5['account']['autoclose']){_0x1c1cf5[_0xfcfa('0x3f')][_0xfcfa('0x4b')]({'id':0x0,'priority':_0x1c1cf5[_0xfcfa('0x3f')]['length']+0x1,'app':'close','appdata':_0xfcfa('0x4c'),'interval':_0xfcfa('0x4d')});}_0x2e765f[_0xfcfa('0x4e')]=!![];}else{_0x2e765f[_0xfcfa('0x4e')]=![];}_0x1c1cf5[_0xfcfa('0x4f')]=_0x2e765f;return db[_0xfcfa('0x50')][_0xfcfa('0x46')]({'body':_0x860170[_0xfcfa('0x27')]['body'],'FaxAccountId':_0x860170[_0xfcfa('0x3e')]['id'],'FaxInteractionId':_0xa8830a['id'],'direction':'in','ContactId':_0xa8830a[_0xfcfa('0x51')],'AttachmentId':_0x860170[_0xfcfa('0x27')][_0xfcfa('0x52')]});})[_0xfcfa('0x26')](function(_0x29af05){_0x1c1cf5[_0xfcfa('0x19')]=_0x29af05;if(_0x1c1cf5[_0xfcfa('0x4f')][_0xfcfa('0x53')]){return db[_0xfcfa('0x54')][_0xfcfa('0x3a')]({'attributes':['id','name'],'where':{'id':_0x1c1cf5[_0xfcfa('0x4f')]['UserId']}})[_0xfcfa('0x26')](function(_0xf2c1eb){if(_0xf2c1eb){_0x1c1cf5[_0xfcfa('0x3f')][_0xfcfa('0x55')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0xf2c1eb['name']+','+(_0x1c1cf5[_0xfcfa('0x3e')]['waitForTheAssignedAgent']||0xa),'interval':_0xfcfa('0x4d')});}return respondWithRpcPromise('Start',_0xfcfa('0x56'),_0x1c1cf5);});}return respondWithRpcPromise(_0xfcfa('0x57'),_0xfcfa('0x56'),_0x1c1cf5);})[_0xfcfa('0x26')](function(_0x527a40){_0x2e5ae0(_0x527a40);})[_0xfcfa('0x1b')](function(_0x296a21){_0x3ba05f(_0x30db4d[_0xfcfa('0x17')](0x1f4,_0x296a21[_0xfcfa('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 0e1ce68..ab71590 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 _0x7686=['length','save','update','emit','removeListener'];(function(_0x382e16,_0x366b43){var _0x19c67c=function(_0x3b5c1a){while(--_0x3b5c1a){_0x382e16['push'](_0x382e16['shift']());}};_0x19c67c(++_0x366b43);}(_0x7686,0x1e1));var _0x6768=function(_0x4e8a00,_0x157837){_0x4e8a00=_0x4e8a00-0x0;var _0x4208a5=_0x7686[_0x4e8a00];return _0x4208a5;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0x6768('0x0'),'remove',_0x6768('0x1')];function createListener(_0x6fd40,_0x3a2bab){return function(_0x33ed48){_0x3a2bab[_0x6768('0x2')](_0x6fd40,_0x33ed48);};}function removeListener(_0x483b5a,_0x4b6911){return function(){FaxAccountEvents[_0x6768('0x3')](_0x483b5a,_0x4b6911);};}exports['register']=function(_0x5bc459){for(var _0x9a23d4=0x0,_0x17fc74=events[_0x6768('0x4')];_0x9a23d4<_0x17fc74;_0x9a23d4++){var _0x63484=events[_0x9a23d4];var _0x42d857=createListener('faxAccount:'+_0x63484,_0x5bc459);FaxAccountEvents['on'](_0x63484,_0x42d857);}}; \ No newline at end of file +var _0x475b=['./faxAccount.events','update','removeListener','register','length'];(function(_0x3bc958,_0x45d34a){var _0x3d136e=function(_0x3602f8){while(--_0x3602f8){_0x3bc958['push'](_0x3bc958['shift']());}};_0x3d136e(++_0x45d34a);}(_0x475b,0xb4));var _0xb475=function(_0x3b29cf,_0x171bc9){_0x3b29cf=_0x3b29cf-0x0;var _0x1dc73b=_0x475b[_0x3b29cf];return _0x1dc73b;};'use strict';var FaxAccountEvents=require(_0xb475('0x0'));var events=['save','remove',_0xb475('0x1')];function createListener(_0x30f3ee,_0x560f55){return function(_0x9ae2c0){_0x560f55['emit'](_0x30f3ee,_0x9ae2c0);};}function removeListener(_0x127656,_0x2d37a9){return function(){FaxAccountEvents[_0xb475('0x2')](_0x127656,_0x2d37a9);};}exports[_0xb475('0x3')]=function(_0x1cac01){for(var _0x2ecb3d=0x0,_0x2a3429=events[_0xb475('0x4')];_0x2ecb3d<_0x2a3429;_0x2ecb3d++){var _0x216a46=events[_0x2ecb3d];var _0x222096=createListener('faxAccount:'+_0x216a46,_0x1cac01);FaxAccountEvents['on'](_0x216a46,_0x222096);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 8f18f93..9ab1070 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(_0x2e33d3,_0x4375d2){var _0x5cd87d=function(_0x2ae53c){while(--_0x2ae53c){_0x2e33d3['push'](_0x2e33d3['shift']());}};_0x5cd87d(++_0x4375d2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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(_0x2f029b,_0x5c393c){var _0x3df1aa=function(_0x11f2b4){while(--_0x11f2b4){_0x2f029b['push'](_0x2f029b['shift']());}};_0x3df1aa(++_0x5c393c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index e7caf53..6ec8a7c 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 _0x27d0=['INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x322fc6,_0x5087f5){var _0x211c6a=function(_0x6d9ed1){while(--_0x6d9ed1){_0x322fc6['push'](_0x322fc6['shift']());}};_0x211c6a(++_0x5087f5);}(_0x27d0,0x127));var _0x027d=function(_0x18e897,_0x241953){_0x18e897=_0x18e897-0x0;var _0x181e4e=_0x27d0[_0x18e897];return _0x181e4e;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x027d('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x027d('0x1')],'allowNull':![],'defaultValue':_0x027d('0x2')},'appdata':{'type':Sequelize[_0x027d('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x027d('0x4')}}; \ No newline at end of file +var _0xdc3f=['exports','STRING','TEXT','*,*,*,*','sequelize'];(function(_0x414a95,_0x3d54bf){var _0xe7abb0=function(_0x426a76){while(--_0x426a76){_0x414a95['push'](_0x414a95['shift']());}};_0xe7abb0(++_0x3d54bf);}(_0xdc3f,0x8b));var _0xfdc3=function(_0x16e768,_0xde568c){_0x16e768=_0x16e768-0x0;var _0x13139e=_0xdc3f[_0x16e768];return _0x13139e;};'use strict';var Sequelize=require(_0xfdc3('0x0'));module[_0xfdc3('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xfdc3('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xfdc3('0x3')]()},'description':{'type':Sequelize[_0xfdc3('0x2')]},'interval':{'type':Sequelize[_0xfdc3('0x2')],'defaultValue':_0xfdc3('0x4')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 7d17b18..7d741f7 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 _0xa2ac=['crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','name','send','index','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','map','options','FaxApplication','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel'];(function(_0x343b74,_0x5f1402){var _0x33a789=function(_0x1011ac){while(--_0x1011ac){_0x343b74['push'](_0x343b74['shift']());}};_0x33a789(++_0x5f1402);}(_0xa2ac,0x1c1));var _0xca2a=function(_0x5b9823,_0x5b2da8){_0x5b9823=_0x5b9823-0x0;var _0x1a4a49=_0xa2ac[_0x5b9823];return _0x1a4a49;};'use strict';var emlformat=require(_0xca2a('0x0'));var rimraf=require(_0xca2a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xca2a('0x2'));var rp=require(_0xca2a('0x3'));var moment=require(_0xca2a('0x4'));var BPromise=require(_0xca2a('0x5'));var Mustache=require(_0xca2a('0x6'));var util=require('util');var path=require(_0xca2a('0x7'));var sox=require(_0xca2a('0x8'));var csv=require(_0xca2a('0x9'));var ejs=require(_0xca2a('0xa'));var fs=require('fs');var fs_extra=require(_0xca2a('0xb'));var _=require('lodash');var squel=require(_0xca2a('0xc'));var crypto=require(_0xca2a('0xd'));var jsforce=require(_0xca2a('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xca2a('0xf'));var Papa=require(_0xca2a('0x10'));var Redis=require(_0xca2a('0x11'));var authService=require(_0xca2a('0x12'));var qs=require(_0xca2a('0x13'));var as=require(_0xca2a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xca2a('0x15'))(_0xca2a('0x16'));var utils=require(_0xca2a('0x17'));var config=require(_0xca2a('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xca2a('0x19'))['db'];function respondWithStatusCode(_0x27057f,_0x4e7867){_0x4e7867=_0x4e7867||0xcc;return function(_0x40843c){if(_0x40843c){return _0x27057f['sendStatus'](_0x4e7867);}return _0x27057f[_0xca2a('0x1a')](_0x4e7867)[_0xca2a('0x1b')]();};}function respondWithResult(_0x391bde,_0x4b488a){_0x4b488a=_0x4b488a||0xc8;return function(_0x444041){if(_0x444041){return _0x391bde[_0xca2a('0x1a')](_0x4b488a)[_0xca2a('0x1c')](_0x444041);}};}function respondWithFilteredResult(_0x1a4ae1,_0x2b18da){return function(_0x192d21){if(_0x192d21){var _0x37a0df=typeof _0x2b18da[_0xca2a('0x1d')]===_0xca2a('0x1e')&&typeof _0x2b18da[_0xca2a('0x1f')]===_0xca2a('0x1e');var _0x37f8bf=_0x192d21['count'];var _0xe01944=_0x37a0df?0x0:_0x2b18da[_0xca2a('0x1d')];var _0xecdfd4=_0x37a0df?_0x192d21[_0xca2a('0x20')]:_0x2b18da['offset']+_0x2b18da['limit'];var _0x40b5fc;if(_0xecdfd4>=_0x37f8bf){_0xecdfd4=_0x37f8bf;_0x40b5fc=0xc8;}else{_0x40b5fc=0xce;}_0x1a4ae1[_0xca2a('0x1a')](_0x40b5fc);return _0x1a4ae1[_0xca2a('0x21')](_0xca2a('0x22'),_0xe01944+'-'+_0xecdfd4+'/'+_0x37f8bf)[_0xca2a('0x1c')](_0x192d21);}return null;};}function patchUpdates(_0x2aea0e){return function(_0x40242b){try{jsonpatch[_0xca2a('0x23')](_0x40242b,_0x2aea0e,!![]);}catch(_0x366f51){return BPromise[_0xca2a('0x24')](_0x366f51);}return _0x40242b['save']();};}function saveUpdates(_0x33edc3,_0xd7c9b0){return function(_0x39c83d){if(_0x39c83d){return _0x39c83d[_0xca2a('0x25')](_0x33edc3)[_0xca2a('0x26')](function(_0x219e1b){return _0x219e1b;});}return null;};}function removeEntity(_0x5d6472,_0x5faa94){return function(_0x197ef7){if(_0x197ef7){return _0x197ef7[_0xca2a('0x27')]()[_0xca2a('0x26')](function(){_0x5d6472[_0xca2a('0x1a')](0xcc)[_0xca2a('0x1b')]();});}};}function handleEntityNotFound(_0x3bd5d3,_0x1a42e7){return function(_0x1f0033){if(!_0x1f0033){_0x3bd5d3[_0xca2a('0x28')](0x194);}return _0x1f0033;};}function handleError(_0x363325,_0x3f16b4){_0x3f16b4=_0x3f16b4||0x1f4;return function(_0x307a67){logger[_0xca2a('0x29')](_0x307a67['stack']);if(_0x307a67[_0xca2a('0x2a')]){delete _0x307a67[_0xca2a('0x2a')];}_0x363325[_0xca2a('0x1a')](_0x3f16b4)[_0xca2a('0x2b')](_0x307a67);};}exports[_0xca2a('0x2c')]=function(_0x5d6e2e,_0x5ebac5){var _0x4723fe={},_0x371218={},_0x312462={'count':0x0,'rows':[]};var _0x3a562d=_['map'](db['FaxApplication'][_0xca2a('0x2d')],function(_0x19a50f){return{'name':_0x19a50f[_0xca2a('0x2e')],'type':_0x19a50f[_0xca2a('0x2f')][_0xca2a('0x30')]};});_0x371218['model']=_['map'](_0x3a562d,_0xca2a('0x2a'));_0x371218[_0xca2a('0x31')]=_[_0xca2a('0x32')](_0x5d6e2e[_0xca2a('0x31')]);_0x371218['filters']=_[_0xca2a('0x33')](_0x371218[_0xca2a('0x34')],_0x371218[_0xca2a('0x31')]);_0x4723fe[_0xca2a('0x35')]=_[_0xca2a('0x33')](_0x371218['model'],qs[_0xca2a('0x36')](_0x5d6e2e[_0xca2a('0x31')]['fields']));_0x4723fe[_0xca2a('0x35')]=_0x4723fe[_0xca2a('0x35')][_0xca2a('0x37')]?_0x4723fe[_0xca2a('0x35')]:_0x371218[_0xca2a('0x34')];if(!_0x5d6e2e['query'][_0xca2a('0x38')](_0xca2a('0x39'))){_0x4723fe[_0xca2a('0x1f')]=qs[_0xca2a('0x1f')](_0x5d6e2e[_0xca2a('0x31')][_0xca2a('0x1f')]);_0x4723fe[_0xca2a('0x1d')]=qs[_0xca2a('0x1d')](_0x5d6e2e['query'][_0xca2a('0x1d')]);}_0x4723fe[_0xca2a('0x3a')]=qs[_0xca2a('0x3b')](_0x5d6e2e['query']['sort']);_0x4723fe[_0xca2a('0x3c')]=qs['filters'](_[_0xca2a('0x3d')](_0x5d6e2e['query'],_0x371218[_0xca2a('0x3e')]),_0x3a562d);if(_0x5d6e2e[_0xca2a('0x31')][_0xca2a('0x3f')]){_0x4723fe['where']=_[_0xca2a('0x40')](_0x4723fe[_0xca2a('0x3c')],{'$or':_[_0xca2a('0x41')](_0x3a562d,function(_0x92e8bf){if(_0x92e8bf[_0xca2a('0x2f')]!=='VIRTUAL'){var _0x189c71={};_0x189c71[_0x92e8bf['name']]={'$like':'%'+_0x5d6e2e['query'][_0xca2a('0x3f')]+'%'};return _0x189c71;}})});}_0x4723fe=_[_0xca2a('0x40')]({},_0x4723fe,_0x5d6e2e[_0xca2a('0x42')]);var _0x24a23a={'where':_0x4723fe[_0xca2a('0x3c')]};return db[_0xca2a('0x43')][_0xca2a('0x20')](_0x24a23a)[_0xca2a('0x26')](function(_0x1f646c){_0x312462['count']=_0x1f646c;if(_0x5d6e2e[_0xca2a('0x31')]['includeAll']){_0x4723fe[_0xca2a('0x44')]=[{'all':!![]}];}return db[_0xca2a('0x43')][_0xca2a('0x45')](_0x4723fe);})[_0xca2a('0x26')](function(_0x45a226){_0x312462[_0xca2a('0x46')]=_0x45a226;return _0x312462;})[_0xca2a('0x26')](respondWithFilteredResult(_0x5ebac5,_0x4723fe))[_0xca2a('0x47')](handleError(_0x5ebac5,null));};exports[_0xca2a('0x48')]=function(_0x31679d,_0x4d6555){var _0x551248={'raw':!![],'where':{'id':_0x31679d[_0xca2a('0x49')]['id']}},_0xba1fa5={};_0xba1fa5[_0xca2a('0x34')]=_[_0xca2a('0x32')](db[_0xca2a('0x43')]['rawAttributes']);_0xba1fa5[_0xca2a('0x31')]=_[_0xca2a('0x32')](_0x31679d[_0xca2a('0x31')]);_0xba1fa5[_0xca2a('0x3e')]=_[_0xca2a('0x33')](_0xba1fa5[_0xca2a('0x34')],_0xba1fa5[_0xca2a('0x31')]);_0x551248[_0xca2a('0x35')]=_[_0xca2a('0x33')](_0xba1fa5[_0xca2a('0x34')],qs['fields'](_0x31679d['query'][_0xca2a('0x36')]));_0x551248[_0xca2a('0x35')]=_0x551248['attributes'][_0xca2a('0x37')]?_0x551248['attributes']:_0xba1fa5[_0xca2a('0x34')];if(_0x31679d[_0xca2a('0x31')]['includeAll']){_0x551248[_0xca2a('0x44')]=[{'all':!![]}];}_0x551248=_['merge']({},_0x551248,_0x31679d[_0xca2a('0x42')]);return db[_0xca2a('0x43')][_0xca2a('0x4a')](_0x551248)[_0xca2a('0x26')](handleEntityNotFound(_0x4d6555,null))[_0xca2a('0x26')](respondWithResult(_0x4d6555,null))[_0xca2a('0x47')](handleError(_0x4d6555,null));};exports[_0xca2a('0x4b')]=function(_0x1cd5a7,_0x3e55d0){return db[_0xca2a('0x43')][_0xca2a('0x4b')](_0x1cd5a7[_0xca2a('0x4c')],{})[_0xca2a('0x26')](respondWithResult(_0x3e55d0,0xc9))[_0xca2a('0x47')](handleError(_0x3e55d0,null));};exports[_0xca2a('0x25')]=function(_0x4c397d,_0x3b0901){if(_0x4c397d[_0xca2a('0x4c')]['id']){delete _0x4c397d['body']['id'];}return db[_0xca2a('0x43')][_0xca2a('0x4a')]({'where':{'id':_0x4c397d['params']['id']}})[_0xca2a('0x26')](handleEntityNotFound(_0x3b0901,null))[_0xca2a('0x26')](saveUpdates(_0x4c397d[_0xca2a('0x4c')],null))[_0xca2a('0x26')](respondWithResult(_0x3b0901,null))[_0xca2a('0x47')](handleError(_0x3b0901,null));};exports['destroy']=function(_0x40b175,_0x377094){return db['FaxApplication'][_0xca2a('0x4a')]({'where':{'id':_0x40b175[_0xca2a('0x49')]['id']}})[_0xca2a('0x26')](handleEntityNotFound(_0x377094,null))[_0xca2a('0x26')](removeEntity(_0x377094,null))[_0xca2a('0x47')](handleError(_0x377094,null));}; \ No newline at end of file +var _0x471c=['crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','then','destroy','end','error','stack','name','send','map','FaxApplication','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','update','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','squel'];(function(_0x4dca75,_0x1ea147){var _0x3192f1=function(_0x2d9a60){while(--_0x2d9a60){_0x4dca75['push'](_0x4dca75['shift']());}};_0x3192f1(++_0x1ea147);}(_0x471c,0x128));var _0xc471=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x471c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xc471('0x0'));var rimraf=require(_0xc471('0x1'));var zipdir=require(_0xc471('0x2'));var jsonpatch=require(_0xc471('0x3'));var rp=require(_0xc471('0x4'));var moment=require(_0xc471('0x5'));var BPromise=require(_0xc471('0x6'));var Mustache=require(_0xc471('0x7'));var util=require(_0xc471('0x8'));var path=require(_0xc471('0x9'));var sox=require(_0xc471('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc471('0xb'));var crypto=require(_0xc471('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc471('0xd'));var toCsv=require(_0xc471('0xe'));var querystring=require(_0xc471('0xf'));var Papa=require(_0xc471('0x10'));var Redis=require(_0xc471('0x11'));var authService=require(_0xc471('0x12'));var qs=require(_0xc471('0x13'));var as=require(_0xc471('0x14'));var hardwareService=require(_0xc471('0x15'));var logger=require('../../config/logger')(_0xc471('0x16'));var utils=require(_0xc471('0x17'));var config=require(_0xc471('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xc471('0x19'))['db'];function respondWithStatusCode(_0x37b2ca,_0x3f3ee5){_0x3f3ee5=_0x3f3ee5||0xcc;return function(_0x1da0d1){if(_0x1da0d1){return _0x37b2ca[_0xc471('0x1a')](_0x3f3ee5);}return _0x37b2ca[_0xc471('0x1b')](_0x3f3ee5)['end']();};}function respondWithResult(_0x20b85b,_0x3a705f){_0x3a705f=_0x3a705f||0xc8;return function(_0x420eef){if(_0x420eef){return _0x20b85b[_0xc471('0x1b')](_0x3a705f)['json'](_0x420eef);}};}function respondWithFilteredResult(_0x1d699b,_0x2163f5){return function(_0x36755a){if(_0x36755a){var _0x4057e5=typeof _0x2163f5[_0xc471('0x1c')]==='undefined'&&typeof _0x2163f5[_0xc471('0x1d')]===_0xc471('0x1e');var _0x3dae7d=_0x36755a[_0xc471('0x1f')];var _0x2f5ae2=_0x4057e5?0x0:_0x2163f5['offset'];var _0x4d72f8=_0x4057e5?_0x36755a['count']:_0x2163f5[_0xc471('0x1c')]+_0x2163f5[_0xc471('0x1d')];var _0x2a2204;if(_0x4d72f8>=_0x3dae7d){_0x4d72f8=_0x3dae7d;_0x2a2204=0xc8;}else{_0x2a2204=0xce;}_0x1d699b[_0xc471('0x1b')](_0x2a2204);return _0x1d699b[_0xc471('0x20')](_0xc471('0x21'),_0x2f5ae2+'-'+_0x4d72f8+'/'+_0x3dae7d)[_0xc471('0x22')](_0x36755a);}return null;};}function patchUpdates(_0x2014b5){return function(_0x251895){try{jsonpatch[_0xc471('0x23')](_0x251895,_0x2014b5,!![]);}catch(_0x595ed0){return BPromise[_0xc471('0x24')](_0x595ed0);}return _0x251895[_0xc471('0x25')]();};}function saveUpdates(_0x2733f9,_0x2c4168){return function(_0x161469){if(_0x161469){return _0x161469['update'](_0x2733f9)[_0xc471('0x26')](function(_0x4d9dda){return _0x4d9dda;});}return null;};}function removeEntity(_0x28503f,_0x529350){return function(_0x2544df){if(_0x2544df){return _0x2544df[_0xc471('0x27')]()[_0xc471('0x26')](function(){_0x28503f[_0xc471('0x1b')](0xcc)[_0xc471('0x28')]();});}};}function handleEntityNotFound(_0x420273,_0x3dc6af){return function(_0x1eead5){if(!_0x1eead5){_0x420273[_0xc471('0x1a')](0x194);}return _0x1eead5;};}function handleError(_0x372eda,_0x5b8be1){_0x5b8be1=_0x5b8be1||0x1f4;return function(_0xcd98cf){logger[_0xc471('0x29')](_0xcd98cf[_0xc471('0x2a')]);if(_0xcd98cf[_0xc471('0x2b')]){delete _0xcd98cf[_0xc471('0x2b')];}_0x372eda[_0xc471('0x1b')](_0x5b8be1)[_0xc471('0x2c')](_0xcd98cf);};}exports['index']=function(_0x49fe0b,_0x5458ae){var _0x453d66={},_0x35ca08={},_0x5c7d0c={'count':0x0,'rows':[]};var _0x24dec8=_[_0xc471('0x2d')](db[_0xc471('0x2e')][_0xc471('0x2f')],function(_0x18b537){return{'name':_0x18b537[_0xc471('0x30')],'type':_0x18b537['type'][_0xc471('0x31')]};});_0x35ca08[_0xc471('0x32')]=_['map'](_0x24dec8,_0xc471('0x2b'));_0x35ca08[_0xc471('0x33')]=_[_0xc471('0x34')](_0x49fe0b[_0xc471('0x33')]);_0x35ca08['filters']=_['intersection'](_0x35ca08[_0xc471('0x32')],_0x35ca08[_0xc471('0x33')]);_0x453d66[_0xc471('0x35')]=_[_0xc471('0x36')](_0x35ca08[_0xc471('0x32')],qs[_0xc471('0x37')](_0x49fe0b[_0xc471('0x33')][_0xc471('0x37')]));_0x453d66[_0xc471('0x35')]=_0x453d66[_0xc471('0x35')]['length']?_0x453d66[_0xc471('0x35')]:_0x35ca08[_0xc471('0x32')];if(!_0x49fe0b['query'][_0xc471('0x38')]('nolimit')){_0x453d66[_0xc471('0x1d')]=qs[_0xc471('0x1d')](_0x49fe0b[_0xc471('0x33')][_0xc471('0x1d')]);_0x453d66[_0xc471('0x1c')]=qs['offset'](_0x49fe0b[_0xc471('0x33')][_0xc471('0x1c')]);}_0x453d66[_0xc471('0x39')]=qs['sort'](_0x49fe0b[_0xc471('0x33')][_0xc471('0x3a')]);_0x453d66[_0xc471('0x3b')]=qs[_0xc471('0x3c')](_[_0xc471('0x3d')](_0x49fe0b[_0xc471('0x33')],_0x35ca08[_0xc471('0x3c')]),_0x24dec8);if(_0x49fe0b[_0xc471('0x33')][_0xc471('0x3e')]){_0x453d66['where']=_[_0xc471('0x3f')](_0x453d66['where'],{'$or':_['map'](_0x24dec8,function(_0x22dfd5){if(_0x22dfd5['type']!==_0xc471('0x40')){var _0xa8cb46={};_0xa8cb46[_0x22dfd5[_0xc471('0x2b')]]={'$like':'%'+_0x49fe0b[_0xc471('0x33')][_0xc471('0x3e')]+'%'};return _0xa8cb46;}})});}_0x453d66=_['merge']({},_0x453d66,_0x49fe0b[_0xc471('0x41')]);var _0x381bf3={'where':_0x453d66[_0xc471('0x3b')]};return db[_0xc471('0x2e')][_0xc471('0x1f')](_0x381bf3)[_0xc471('0x26')](function(_0x5aa0f2){_0x5c7d0c['count']=_0x5aa0f2;if(_0x49fe0b['query'][_0xc471('0x42')]){_0x453d66[_0xc471('0x43')]=[{'all':!![]}];}return db[_0xc471('0x2e')][_0xc471('0x44')](_0x453d66);})['then'](function(_0x27eed4){_0x5c7d0c[_0xc471('0x45')]=_0x27eed4;return _0x5c7d0c;})[_0xc471('0x26')](respondWithFilteredResult(_0x5458ae,_0x453d66))[_0xc471('0x46')](handleError(_0x5458ae,null));};exports[_0xc471('0x47')]=function(_0x13c913,_0x20b0e0){var _0x187761={'raw':!![],'where':{'id':_0x13c913['params']['id']}},_0x3e05cb={};_0x3e05cb[_0xc471('0x32')]=_['keys'](db[_0xc471('0x2e')][_0xc471('0x2f')]);_0x3e05cb[_0xc471('0x33')]=_['keys'](_0x13c913['query']);_0x3e05cb[_0xc471('0x3c')]=_['intersection'](_0x3e05cb[_0xc471('0x32')],_0x3e05cb[_0xc471('0x33')]);_0x187761['attributes']=_[_0xc471('0x36')](_0x3e05cb[_0xc471('0x32')],qs['fields'](_0x13c913[_0xc471('0x33')][_0xc471('0x37')]));_0x187761[_0xc471('0x35')]=_0x187761['attributes']['length']?_0x187761[_0xc471('0x35')]:_0x3e05cb['model'];if(_0x13c913[_0xc471('0x33')][_0xc471('0x42')]){_0x187761['include']=[{'all':!![]}];}_0x187761=_['merge']({},_0x187761,_0x13c913[_0xc471('0x41')]);return db[_0xc471('0x2e')][_0xc471('0x48')](_0x187761)[_0xc471('0x26')](handleEntityNotFound(_0x20b0e0,null))[_0xc471('0x26')](respondWithResult(_0x20b0e0,null))[_0xc471('0x46')](handleError(_0x20b0e0,null));};exports[_0xc471('0x49')]=function(_0x365687,_0x4821df){return db['FaxApplication'][_0xc471('0x49')](_0x365687[_0xc471('0x4a')],{})[_0xc471('0x26')](respondWithResult(_0x4821df,0xc9))[_0xc471('0x46')](handleError(_0x4821df,null));};exports[_0xc471('0x4b')]=function(_0x227baf,_0x4c2d47){if(_0x227baf[_0xc471('0x4a')]['id']){delete _0x227baf[_0xc471('0x4a')]['id'];}return db[_0xc471('0x2e')][_0xc471('0x48')]({'where':{'id':_0x227baf[_0xc471('0x4c')]['id']}})[_0xc471('0x26')](handleEntityNotFound(_0x4c2d47,null))[_0xc471('0x26')](saveUpdates(_0x227baf['body'],null))['then'](respondWithResult(_0x4c2d47,null))[_0xc471('0x46')](handleError(_0x4c2d47,null));};exports[_0xc471('0x27')]=function(_0x5f01aa,_0x484ac1){return db['FaxApplication'][_0xc471('0x48')]({'where':{'id':_0x5f01aa['params']['id']}})[_0xc471('0x26')](handleEntityNotFound(_0x484ac1,null))[_0xc471('0x26')](removeEntity(_0x484ac1,null))[_0xc471('0x46')](handleError(_0x484ac1,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 5b0fe22..4b41caa 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 _0xb075=['fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./faxApplication.attributes','exports','define','FaxApplication'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb075,0xf3));var _0x5b07=function(_0x32ce2a,_0x5504ff){_0x32ce2a=_0x32ce2a-0x0;var _0x2ecfc5=_0xb075[_0x32ce2a];return _0x2ecfc5;};'use strict';var _=require(_0x5b07('0x0'));var util=require(_0x5b07('0x1'));var logger=require('../../config/logger')(_0x5b07('0x2'));var moment=require(_0x5b07('0x3'));var BPromise=require(_0x5b07('0x4'));var rp=require(_0x5b07('0x5'));var fs=require('fs');var path=require(_0x5b07('0x6'));var rimraf=require(_0x5b07('0x7'));var config=require('../../config/environment');var attributes=require(_0x5b07('0x8'));module[_0x5b07('0x9')]=function(_0x1977a5,_0x4e605f){return _0x1977a5[_0x5b07('0xa')](_0x5b07('0xb'),attributes,{'tableName':_0x5b07('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5b07('0xd'),'collate':_0x5b07('0xe')});}; \ No newline at end of file +var _0x169e=['./faxApplication.attributes','exports','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1f31cb,_0x49ed49){var _0x188f8d=function(_0x27c5fd){while(--_0x27c5fd){_0x1f31cb['push'](_0x1f31cb['shift']());}};_0x188f8d(++_0x49ed49);}(_0x169e,0x1bf));var _0xe169=function(_0x5bc43e,_0x193c60){_0x5bc43e=_0x5bc43e-0x0;var _0x17d113=_0x169e[_0x5bc43e];return _0x17d113;};'use strict';var _=require(_0xe169('0x0'));var util=require(_0xe169('0x1'));var logger=require(_0xe169('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe169('0x3'));var rp=require(_0xe169('0x4'));var fs=require('fs');var path=require(_0xe169('0x5'));var rimraf=require(_0xe169('0x6'));var config=require(_0xe169('0x7'));var attributes=require(_0xe169('0x8'));module[_0xe169('0x9')]=function(_0x1790b6,_0x4f9b7e){return _0x1790b6['define']('FaxApplication',attributes,{'tableName':_0xe169('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe169('0xb'),'collate':_0xe169('0xc')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index d15acf3..7fcd739 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 _0xa3e2=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','stringify','error','code','FaxApplication,\x20%s,\x20%s','message','result','FaxApplication','options','raw','where','limit','then','UpdateFaxApplication','debug','catch','util','moment','bluebird'];(function(_0x216c7f,_0x5af6fb){var _0x885fa=function(_0x3c8d8d){while(--_0x3c8d8d){_0x216c7f['push'](_0x216c7f['shift']());}};_0x885fa(++_0x5af6fb);}(_0xa3e2,0x75));var _0x2a3e=function(_0x4caade,_0x549ce1){_0x4caade=_0x4caade-0x0;var _0x2041ff=_0xa3e2[_0x4caade];return _0x2041ff;};'use strict';var _=require('lodash');var util=require(_0x2a3e('0x0'));var moment=require(_0x2a3e('0x1'));var BPromise=require(_0x2a3e('0x2'));var rs=require(_0x2a3e('0x3'));var fs=require('fs');var Redis=require(_0x2a3e('0x4'));var db=require(_0x2a3e('0x5'))['db'];var utils=require(_0x2a3e('0x6'));var logger=require('../../config/logger')(_0x2a3e('0x7'));var config=require(_0x2a3e('0x8'));var jayson=require(_0x2a3e('0x9'));var client=jayson[_0x2a3e('0xa')][_0x2a3e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5df7e5,_0x4b0fc1,_0x545b0d){return new BPromise(function(_0x43ec7d,_0x1a3fec){return client[_0x2a3e('0xc')](_0x5df7e5,_0x545b0d)['then'](function(_0xcb9d3d){logger[_0x2a3e('0xd')]('FaxApplication,\x20%s,\x20%s',_0x4b0fc1,_0x2a3e('0xe'));logger['debug']('FaxApplication,\x20%s,\x20%s,\x20%s',_0x4b0fc1,_0x2a3e('0xe'),JSON[_0x2a3e('0xf')](_0xcb9d3d));if(_0xcb9d3d[_0x2a3e('0x10')]){if(_0xcb9d3d[_0x2a3e('0x10')][_0x2a3e('0x11')]===0x1f4){logger[_0x2a3e('0x10')](_0x2a3e('0x12'),_0x4b0fc1,_0xcb9d3d[_0x2a3e('0x10')][_0x2a3e('0x13')]);return _0x1a3fec(_0xcb9d3d[_0x2a3e('0x10')][_0x2a3e('0x13')]);}logger[_0x2a3e('0x10')]('FaxApplication,\x20%s,\x20%s',_0x4b0fc1,_0xcb9d3d[_0x2a3e('0x10')]['message']);return _0x43ec7d(_0xcb9d3d['error'][_0x2a3e('0x13')]);}else{logger[_0x2a3e('0xd')]('FaxApplication,\x20%s,\x20%s',_0x4b0fc1,_0x2a3e('0xe'));_0x43ec7d(_0xcb9d3d[_0x2a3e('0x14')][_0x2a3e('0x13')]);}})['catch'](function(_0x5ddb45){logger[_0x2a3e('0x10')](_0x2a3e('0x12'),_0x4b0fc1,_0x5ddb45);_0x1a3fec(_0x5ddb45);});});}exports['UpdateFaxApplication']=function(_0x1bba47){var _0x1e3794=this;return new Promise(function(_0x40e112,_0x564334){return db[_0x2a3e('0x15')]['update'](_0x1bba47['body'],{'raw':_0x1bba47['options']?_0x1bba47[_0x2a3e('0x16')][_0x2a3e('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1bba47[_0x2a3e('0x16')]?_0x1bba47['options'][_0x2a3e('0x18')]||null:null,'attributes':_0x1bba47['options']?_0x1bba47[_0x2a3e('0x16')]['attributes']||null:null,'limit':_0x1bba47['options']?_0x1bba47[_0x2a3e('0x16')][_0x2a3e('0x19')]||null:null})[_0x2a3e('0x1a')](function(_0x3ab221){logger['info'](_0x2a3e('0x1b'),_0x1bba47);logger[_0x2a3e('0x1c')](_0x2a3e('0x1b'),_0x1bba47,JSON[_0x2a3e('0xf')](_0x3ab221));_0x40e112(_0x3ab221);})[_0x2a3e('0x1d')](function(_0x66f6cf){logger[_0x2a3e('0x10')](_0x2a3e('0x1b'),_0x66f6cf[_0x2a3e('0x13')],_0x1bba47);_0x564334(_0x1e3794[_0x2a3e('0x10')](0x1f4,_0x66f6cf[_0x2a3e('0x13')]));});});}; \ No newline at end of file +var _0xa7dc=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','info','FaxApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','UpdateFaxApplication','FaxApplication','update','body','options','raw','where','limit','then'];(function(_0x3b150c,_0x2f93f8){var _0x5cd414=function(_0x26305e){while(--_0x26305e){_0x3b150c['push'](_0x3b150c['shift']());}};_0x5cd414(++_0x2f93f8);}(_0xa7dc,0x1ba));var _0xca7d=function(_0x5299ce,_0x55b39f){_0x5299ce=_0x5299ce-0x0;var _0x23281a=_0xa7dc[_0x5299ce];return _0x23281a;};'use strict';var _=require('lodash');var util=require(_0xca7d('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xca7d('0x1'));var fs=require('fs');var Redis=require(_0xca7d('0x2'));var db=require(_0xca7d('0x3'))['db'];var utils=require(_0xca7d('0x4'));var logger=require(_0xca7d('0x5'))(_0xca7d('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xca7d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5bc6b9,_0x2516a4,_0xf09cfc){return new BPromise(function(_0xc5cbf7,_0x4803ed){return client[_0xca7d('0x8')](_0x5bc6b9,_0xf09cfc)['then'](function(_0x3e5d51){logger[_0xca7d('0x9')](_0xca7d('0xa'),_0x2516a4,'request\x20sent');logger['debug']('FaxApplication,\x20%s,\x20%s,\x20%s',_0x2516a4,_0xca7d('0xb'),JSON[_0xca7d('0xc')](_0x3e5d51));if(_0x3e5d51['error']){if(_0x3e5d51[_0xca7d('0xd')][_0xca7d('0xe')]===0x1f4){logger[_0xca7d('0xd')](_0xca7d('0xa'),_0x2516a4,_0x3e5d51[_0xca7d('0xd')][_0xca7d('0xf')]);return _0x4803ed(_0x3e5d51['error'][_0xca7d('0xf')]);}logger['error'](_0xca7d('0xa'),_0x2516a4,_0x3e5d51['error'][_0xca7d('0xf')]);return _0xc5cbf7(_0x3e5d51['error'][_0xca7d('0xf')]);}else{logger[_0xca7d('0x9')](_0xca7d('0xa'),_0x2516a4,_0xca7d('0xb'));_0xc5cbf7(_0x3e5d51['result']['message']);}})[_0xca7d('0x10')](function(_0x95cfea){logger[_0xca7d('0xd')](_0xca7d('0xa'),_0x2516a4,_0x95cfea);_0x4803ed(_0x95cfea);});});}exports[_0xca7d('0x11')]=function(_0x59bb6e){var _0x358aa6=this;return new Promise(function(_0x1cd002,_0x44fe0e){return db[_0xca7d('0x12')][_0xca7d('0x13')](_0x59bb6e[_0xca7d('0x14')],{'raw':_0x59bb6e[_0xca7d('0x15')]?_0x59bb6e['options'][_0xca7d('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59bb6e[_0xca7d('0x15')]?_0x59bb6e['options'][_0xca7d('0x17')]||null:null,'attributes':_0x59bb6e[_0xca7d('0x15')]?_0x59bb6e['options']['attributes']||null:null,'limit':_0x59bb6e[_0xca7d('0x15')]?_0x59bb6e['options'][_0xca7d('0x18')]||null:null})[_0xca7d('0x19')](function(_0x13c8e0){logger[_0xca7d('0x9')]('UpdateFaxApplication',_0x59bb6e);logger['debug'](_0xca7d('0x11'),_0x59bb6e,JSON['stringify'](_0x13c8e0));_0x1cd002(_0x13c8e0);})[_0xca7d('0x10')](function(_0x39113a){logger['error']('UpdateFaxApplication',_0x39113a[_0xca7d('0xf')],_0x59bb6e);_0x44fe0e(_0x358aa6[_0xca7d('0xd')](0x1f4,_0x39113a[_0xca7d('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 17bf5e3..38f5196 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 _0xe605=['../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','create','put','/:id','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x22e1dd,_0x22f367){var _0x107f70=function(_0x5747da){while(--_0x5747da){_0x22e1dd['push'](_0x22e1dd['shift']());}};_0x107f70(++_0x22f367);}(_0xe605,0x92));var _0x5e60=function(_0x37f1d8,_0x225b80){_0x37f1d8=_0x37f1d8-0x0;var _0x3cd595=_0xe605[_0x37f1d8];return _0x3cd595;};'use strict';var multer=require(_0x5e60('0x0'));var util=require(_0x5e60('0x1'));var path=require('path');var timeout=require(_0x5e60('0x2'));var express=require(_0x5e60('0x3'));var router=express[_0x5e60('0x4')]();var fs_extra=require(_0x5e60('0x5'));var auth=require(_0x5e60('0x6'));var interaction=require(_0x5e60('0x7'));var config=require(_0x5e60('0x8'));var controller=require(_0x5e60('0x9'));router[_0x5e60('0xa')]('/',auth[_0x5e60('0xb')](),controller[_0x5e60('0xc')]);router[_0x5e60('0xa')]('/:id',auth[_0x5e60('0xb')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x5e60('0xd')]);router[_0x5e60('0xe')](_0x5e60('0xf'),auth[_0x5e60('0xb')](),controller[_0x5e60('0x10')]);router[_0x5e60('0x11')]('/:id',auth[_0x5e60('0xb')](),controller['destroy']);module[_0x5e60('0x12')]=router; \ No newline at end of file +var _0xef0f=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./faxApplication.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer'];(function(_0x3987a1,_0x447793){var _0xe2596e=function(_0x546925){while(--_0x546925){_0x3987a1['push'](_0x3987a1['shift']());}};_0xe2596e(++_0x447793);}(_0xef0f,0x168));var _0xfef0=function(_0x168ef1,_0x13edfc){_0x168ef1=_0x168ef1-0x0;var _0x4770ec=_0xef0f[_0x168ef1];return _0x4770ec;};'use strict';var multer=require(_0xfef0('0x0'));var util=require('util');var path=require(_0xfef0('0x1'));var timeout=require(_0xfef0('0x2'));var express=require(_0xfef0('0x3'));var router=express['Router']();var fs_extra=require(_0xfef0('0x4'));var auth=require(_0xfef0('0x5'));var interaction=require(_0xfef0('0x6'));var config=require('../../config/environment');var controller=require(_0xfef0('0x7'));router[_0xfef0('0x8')]('/',auth[_0xfef0('0x9')](),controller[_0xfef0('0xa')]);router[_0xfef0('0x8')](_0xfef0('0xb'),auth['isAuthenticated'](),controller[_0xfef0('0xc')]);router['post']('/',auth[_0xfef0('0x9')](),controller[_0xfef0('0xd')]);router[_0xfef0('0xe')](_0xfef0('0xb'),auth[_0xfef0('0x9')](),controller[_0xfef0('0xf')]);router[_0xfef0('0x10')](_0xfef0('0xb'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x11')]);module[_0xfef0('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 09cc91e..e857be2 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 _0x2cc0=['STRING','out','ENUM','DATE'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x2cc0,0x17f));var _0x02cc=function(_0x5d9060,_0x4c745e){_0x5d9060=_0x5d9060-0x0;var _0x11630=_0x2cc0[_0x5d9060];return _0x11630;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x02cc('0x0')]},'disposition':{'type':Sequelize[_0x02cc('0x1')]},'secondDisposition':{'type':Sequelize[_0x02cc('0x1')]},'thirdDisposition':{'type':Sequelize[_0x02cc('0x1')]},'note':{'type':Sequelize[_0x02cc('0x1')]},'read1stAt':{'type':Sequelize[_0x02cc('0x0')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x02cc('0x2')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x02cc('0x3')]('in',_0x02cc('0x2')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xff1b=['DATE','STRING','out','sequelize','exports','BOOLEAN'];(function(_0x24c835,_0x57262a){var _0x22f985=function(_0x493491){while(--_0x493491){_0x24c835['push'](_0x24c835['shift']());}};_0x22f985(++_0x57262a);}(_0xff1b,0x171));var _0xbff1=function(_0x1f618f,_0x13e460){_0x1f618f=_0x1f618f-0x0;var _0x520d48=_0xff1b[_0x1f618f];return _0x520d48;};'use strict';var Sequelize=require(_0xbff1('0x0'));module[_0xbff1('0x1')]={'closed':{'type':Sequelize[_0xbff1('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xbff1('0x3')]},'disposition':{'type':Sequelize[_0xbff1('0x4')]},'secondDisposition':{'type':Sequelize[_0xbff1('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xbff1('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0xbff1('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xbff1('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xbff1('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xbff1('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 64fc6ea..20b12f7 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 _0xbe7f=['jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./faxInteraction.socket','sendStatus','status','end','offset','count','Content-Range','apply','reject','save','update','then','destroy','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','index','FaxInteraction','rawAttributes','fieldName','type','key','model','query','keys','fields','attributes','length','nolimit','limit','order','sort','where','filters','pick','select','field','color','from','u.id','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','fax_messages','me.FaxInteractionId\x20=\x20i.id','tools_tags','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','i.FaxAccountId\x20IN\x20?','createdAt','parse','$gte','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','FaxAccountId','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','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','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','ui.FaxInteractionId\x20IN\x20?','toString','FaxInteractionId','all','rows','show','params','intersection','options','create','describe','addMessage','FaxMessage','ids','omit','getMessages','hasOwnProperty','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','spread','findAll','faxInteractionTags:save','removeTags','download','unix','join','root','files','Attachment','get','mkdirSync','Messages','existsSync','pipe','createWriteStream','log','err','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','ejs','lodash','squel','crypto'];(function(_0x5908f6,_0x5bbbc6){var _0x487e30=function(_0x28a4dd){while(--_0x28a4dd){_0x5908f6['push'](_0x5908f6['shift']());}};_0x487e30(++_0x5bbbc6);}(_0xbe7f,0xc2));var _0xfbe7=function(_0x5305c8,_0x4f36e2){_0x5305c8=_0x5305c8-0x0;var _0x1efddc=_0xbe7f[_0x5305c8];return _0x1efddc;};'use strict';var emlformat=require(_0xfbe7('0x0'));var rimraf=require(_0xfbe7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfbe7('0x2'));var rp=require(_0xfbe7('0x3'));var moment=require(_0xfbe7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xfbe7('0x5'));var util=require('util');var path=require(_0xfbe7('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xfbe7('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfbe7('0x8'));var squel=require(_0xfbe7('0x9'));var crypto=require(_0xfbe7('0xa'));var jsforce=require(_0xfbe7('0xb'));var deskjs=require(_0xfbe7('0xc'));var toCsv=require(_0xfbe7('0xd'));var querystring=require(_0xfbe7('0xe'));var Papa=require(_0xfbe7('0xf'));var Redis=require(_0xfbe7('0x10'));var authService=require(_0xfbe7('0x11'));var qs=require(_0xfbe7('0x12'));var as=require(_0xfbe7('0x13'));var hardwareService=require(_0xfbe7('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xfbe7('0x15'));var config=require(_0xfbe7('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xfbe7('0x17'))['db'];config[_0xfbe7('0x18')]=_[_0xfbe7('0x19')](config[_0xfbe7('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xfbe7('0x1a'))(new Redis(config['redis']));require(_0xfbe7('0x1b'))['register'](socket);function respondWithStatusCode(_0x28ee59,_0x33f0a5){_0x33f0a5=_0x33f0a5||0xcc;return function(_0x17ecdb){if(_0x17ecdb){return _0x28ee59[_0xfbe7('0x1c')](_0x33f0a5);}return _0x28ee59[_0xfbe7('0x1d')](_0x33f0a5)[_0xfbe7('0x1e')]();};}function respondWithResult(_0x4fbc78,_0x267e9a){_0x267e9a=_0x267e9a||0xc8;return function(_0x325755){if(_0x325755){return _0x4fbc78[_0xfbe7('0x1d')](_0x267e9a)['json'](_0x325755);}};}function respondWithFilteredResult(_0x3d22b6,_0x28e283){return function(_0x4713d6){if(_0x4713d6){var _0x11a192=typeof _0x28e283[_0xfbe7('0x1f')]==='undefined'&&typeof _0x28e283['limit']==='undefined';var _0xb0b1d5=_0x4713d6[_0xfbe7('0x20')];var _0x2098e8=_0x11a192?0x0:_0x28e283[_0xfbe7('0x1f')];var _0x5ad274=_0x11a192?_0x4713d6['count']:_0x28e283[_0xfbe7('0x1f')]+_0x28e283['limit'];var _0x582bb8;if(_0x5ad274>=_0xb0b1d5){_0x5ad274=_0xb0b1d5;_0x582bb8=0xc8;}else{_0x582bb8=0xce;}_0x3d22b6['status'](_0x582bb8);return _0x3d22b6['set'](_0xfbe7('0x21'),_0x2098e8+'-'+_0x5ad274+'/'+_0xb0b1d5)['json'](_0x4713d6);}return null;};}function patchUpdates(_0x54b029){return function(_0x4b3f40){try{jsonpatch[_0xfbe7('0x22')](_0x4b3f40,_0x54b029,!![]);}catch(_0x206a2d){return BPromise[_0xfbe7('0x23')](_0x206a2d);}return _0x4b3f40[_0xfbe7('0x24')]();};}function saveUpdates(_0x18594d,_0x1ec60a){return function(_0x2aaf9f){if(_0x2aaf9f){return _0x2aaf9f[_0xfbe7('0x25')](_0x18594d)[_0xfbe7('0x26')](function(_0x5c5c8f){return _0x5c5c8f;});}return null;};}function removeEntity(_0x39fd18,_0x2b306b){return function(_0x18a381){if(_0x18a381){return _0x18a381[_0xfbe7('0x27')]()[_0xfbe7('0x26')](function(){_0x39fd18[_0xfbe7('0x1d')](0xcc)[_0xfbe7('0x1e')]();});}};}function handleEntityNotFound(_0x279234,_0x47ac26){return function(_0x5628a1){if(!_0x5628a1){_0x279234[_0xfbe7('0x1c')](0x194);}return _0x5628a1;};}function handleError(_0x581048,_0x34bd95){_0x34bd95=_0x34bd95||0x1f4;return function(_0x1ccade){logger['error'](_0x1ccade['stack']);if(_0x1ccade['name']){delete _0x1ccade[_0xfbe7('0x28')];}_0x581048[_0xfbe7('0x1d')](_0x34bd95)[_0xfbe7('0x29')](_0x1ccade);};}function getInteractionUsers(_0x49f582,_0x2b98f3){return new BPromise(function(_0x812ab7,_0x308419){try{if(_0x2b98f3[_0x49f582['id']]){_0x49f582[_0xfbe7('0x2a')]=_[_0xfbe7('0x2b')](_0x2b98f3[_0x49f582['id']],function(_0x3aa4b1){return{'id':_0x3aa4b1['id'],'fullname':_0x3aa4b1[_0xfbe7('0x2c')]};});}}catch(_0x30196f){_0x308419(_0x30196f);}_0x812ab7(_0x49f582);});}function getInteractionTags(_0x469876,_0x450c06){return new BPromise(function(_0x2d56f7,_0x322541){try{if(_0x469876[_0xfbe7('0x2d')]){_0x469876[_0xfbe7('0x2e')]=[];_0x469876[_0xfbe7('0x2d')][_0xfbe7('0x2f')](',')[_0xfbe7('0x30')](function(_0x3859af){_0x469876[_0xfbe7('0x2e')][_0xfbe7('0x31')](_0x450c06[_0x3859af]);});}delete _0x469876[_0xfbe7('0x2d')];}catch(_0x30bf52){_0x322541(_0x30bf52);}_0x2d56f7(_0x469876);});}function updateFaxInteraction(_0x37dbf1,_0x582c40,_0xb807af){return new BPromise(function(_0x1da4b3,_0x4e86e2){return getInteractionUsers(_0x37dbf1,_0xb807af)['then'](function(_0x55002b){return getInteractionTags(_0x55002b,_0x582c40);})[_0xfbe7('0x26')](function(_0x33de4d){_0x1da4b3(_0x33de4d);})[_0xfbe7('0x32')](function(_0x589182){_0x4e86e2(_0x589182);});});}exports[_0xfbe7('0x33')]=function(_0xadcc21,_0x787bb0){var _0x74eb01={},_0x4e706c={},_0x1f2141={'count':0x0,'rows':[]};var _0x18b578=_[_0xfbe7('0x2b')](db[_0xfbe7('0x34')][_0xfbe7('0x35')],function(_0x40007){return{'name':_0x40007[_0xfbe7('0x36')],'type':_0x40007[_0xfbe7('0x37')][_0xfbe7('0x38')]};});_0x4e706c[_0xfbe7('0x39')]=_[_0xfbe7('0x2b')](_0x18b578,_0xfbe7('0x28'));_0x4e706c[_0xfbe7('0x3a')]=_[_0xfbe7('0x3b')](_0xadcc21[_0xfbe7('0x3a')]);_0x4e706c['filters']=_['intersection'](_0x4e706c[_0xfbe7('0x39')],_0x4e706c['query']);_0x74eb01['attributes']=_['intersection'](_0x4e706c[_0xfbe7('0x39')],qs[_0xfbe7('0x3c')](_0xadcc21[_0xfbe7('0x3a')][_0xfbe7('0x3c')]));_0x74eb01['attributes']=_0x74eb01[_0xfbe7('0x3d')][_0xfbe7('0x3e')]?_0x74eb01[_0xfbe7('0x3d')]:_0x4e706c[_0xfbe7('0x39')];if(!_0xadcc21['query']['hasOwnProperty'](_0xfbe7('0x3f'))){_0x74eb01['limit']=qs[_0xfbe7('0x40')](_0xadcc21[_0xfbe7('0x3a')]['limit']);_0x74eb01[_0xfbe7('0x1f')]=qs[_0xfbe7('0x1f')](_0xadcc21['query']['offset']);}_0x74eb01[_0xfbe7('0x41')]=qs[_0xfbe7('0x42')](_0xadcc21[_0xfbe7('0x3a')][_0xfbe7('0x42')]);_0x74eb01[_0xfbe7('0x43')]=qs[_0xfbe7('0x44')](_[_0xfbe7('0x45')](_0xadcc21[_0xfbe7('0x3a')],_0x4e706c[_0xfbe7('0x44')]),_0x18b578);var _0x2ce4c2=[];var _0x5ed2db=squel[_0xfbe7('0x46')]()['field']('id')[_0xfbe7('0x47')](_0xfbe7('0x28'))['field'](_0xfbe7('0x48'))[_0xfbe7('0x49')]('tools_tags');var _0x5eedc7=squel['select']()[_0xfbe7('0x47')](_0xfbe7('0x4a'))[_0xfbe7('0x47')]('u.fullname')[_0xfbe7('0x47')](_0xfbe7('0x4b'))['from'](_0xfbe7('0x4c'),'ui')[_0xfbe7('0x4d')](_0xfbe7('0x4e'),'u','u.id\x20=\x20ui.UserId');var _0x3a78ef=squel[_0xfbe7('0x46')]()[_0xfbe7('0x49')](_0xfbe7('0x4f'),'i')['left_join'](_0xfbe7('0x50'),'c',_0xfbe7('0x51'))[_0xfbe7('0x4d')](_0xfbe7('0x4e'),'o',_0xfbe7('0x52'))[_0xfbe7('0x4d')](_0xfbe7('0x53'),'a','a.id\x20=\x20i.FaxAccountId')[_0xfbe7('0x4d')](_0xfbe7('0x54'),'me',_0xfbe7('0x55'))[_0xfbe7('0x4d')]('fax_interaction_has_tags','it','it.FaxInteractionId\x20=\x20i.id')[_0xfbe7('0x4d')](_0xfbe7('0x56'),'t','t.id\x20=\x20it.TagId');var _0x3fa729=squel['expr']();var _0x27b6d6=[];var _0x24ef3c=squel['expr']();var _0x1b73b0;if(_0xadcc21[_0xfbe7('0x3a')][_0xfbe7('0x57')]){_0x1b73b0=as[_0xfbe7('0x58')](_0xadcc21['query']['search']);var _0x2e7f02=_0x1b73b0[_0xfbe7('0x59')];for(var _0x58d9b7=0x0;_0x58d9b7<_0x1b73b0[_0xfbe7('0x5a')]['length'];_0x58d9b7++){var _0x439133=_0x1b73b0[_0xfbe7('0x5a')][_0x58d9b7];var _0x321824='i';var _0x3e60f6=_[_0xfbe7('0x5b')](_0x18b578,[_0xfbe7('0x28'),_0x439133[_0xfbe7('0x47')]]);if(!_0x3e60f6){switch(_0x439133[_0xfbe7('0x47')]){case _0xfbe7('0x5c'):if(_0x439133['value']==0x1){_0x3a78ef[_0xfbe7('0x5d')]('`'+_0x439133['field']+_0xfbe7('0x5e'));}else{_0x3a78ef['having']('`'+_0x439133[_0xfbe7('0x47')]+_0xfbe7('0x5f'));}break;case _0xfbe7('0x60'):if(_0x439133['operator']===_0xfbe7('0x61')){if(_0x439133[_0xfbe7('0x62')][_0xfbe7('0x2f')]('\x20')[_0xfbe7('0x3e')]>0x1){_0x3fa729[_0x2e7f02](_0xfbe7('0x63'),qs[_0xfbe7('0x64')](_0x439133[_0xfbe7('0x62')]),null);}else{var _0x262c51='%'+_0x439133[_0xfbe7('0x62')]+'%';_0x3fa729[_0x2e7f02](_0xfbe7('0x65'),_0x262c51,_0x262c51,_0x262c51);}}else{_0x3e60f6=_[_0xfbe7('0x5b')](_0x18b578,[_0xfbe7('0x28'),_0xfbe7('0x66')]);_0x439133['field']=_0xfbe7('0x66');_0x5edb70=as[_0xfbe7('0x67')](_0x321824,_0x3e60f6[_0xfbe7('0x37')],_0x439133);_0x3fa729[_0x2e7f02](_0x5edb70[_0xfbe7('0x68')],_0x5edb70[_0xfbe7('0x62')][_0xfbe7('0x69')],_0x5edb70[_0xfbe7('0x62')]['end']);}break;case _0xfbe7('0x6a'):var _0xa28dbd=_0x439133['value']['split'](',')['map'](function(_0x37b811){return Number(_0x37b811);});_0xa28dbd[_0xfbe7('0x30')](function(_0x1509b5){_0x24ef3c['or'](_0xfbe7('0x6b'),'%,'+_0x1509b5+',%');});_0x27b6d6=_[_0xfbe7('0x6c')](_0x27b6d6,_0xa28dbd);break;case'User':if(_0x439133[_0xfbe7('0x6d')]===_0xfbe7('0x61')){_0x3fa729[_0x2e7f02](_0xfbe7('0x6e'),'%'+_0x439133[_0xfbe7('0x62')]+'%',null);}else{_0x3e60f6=_['find'](_0x18b578,[_0xfbe7('0x28'),_0xfbe7('0x6f')]);_0x439133[_0xfbe7('0x47')]='UserId';_0x5edb70=as[_0xfbe7('0x67')](_0x321824,_0x3e60f6[_0xfbe7('0x37')],_0x439133);_0x3fa729[_0x2e7f02](_0x5edb70[_0xfbe7('0x68')],_0x5edb70[_0xfbe7('0x62')][_0xfbe7('0x69')],_0x5edb70[_0xfbe7('0x62')][_0xfbe7('0x1e')]);}break;case _0xfbe7('0x70'):_0x5edb70=as[_0xfbe7('0x67')]('me',null,_0x439133);_0x3fa729[_0x2e7f02](_0x5edb70[_0xfbe7('0x68')],_0x5edb70[_0xfbe7('0x62')][_0xfbe7('0x69')],_0x5edb70[_0xfbe7('0x62')][_0xfbe7('0x1e')]);break;}}else{var _0x5edb70=as[_0xfbe7('0x67')](_0x321824,_0x3e60f6['type'],_0x439133);_0x3fa729[_0x2e7f02](_0x5edb70[_0xfbe7('0x68')],_0x5edb70['value'][_0xfbe7('0x69')],_0x5edb70['value'][_0xfbe7('0x1e')]);}}}else{var _0x1e27d2=_(_0xadcc21[_0xfbe7('0x3a')])['keys']()[_0xfbe7('0x2b')](function(_0x470ff8){return _[_0xfbe7('0x71')](_0x18b578,['name',_0x470ff8])?_0x470ff8:undefined;})[_0xfbe7('0x72')]()[_0xfbe7('0x62')]();if(!_[_0xfbe7('0x73')](_0x1e27d2)){_0x1e27d2['forEach'](function(_0x2f2623){if(_0x2f2623==='FaxAccountId'){_0x3a78ef[_0xfbe7('0x43')](_0xfbe7('0x74'),[]['concat'](_0xadcc21['query'][_0x2f2623]));}else if(_0x2f2623===_0xfbe7('0x75')){var _0x2112e4=JSON[_0xfbe7('0x76')](_0xadcc21['query'][_0x2f2623])[_0xfbe7('0x77')];var _0x11d62b=JSON['parse'](_0xadcc21[_0xfbe7('0x3a')][_0x2f2623])['$lte'];_0x3a78ef[_0xfbe7('0x43')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2112e4,_0x11d62b);}else{if(_0xadcc21['query'][_0x2f2623]==='null'){_0x3a78ef[_0xfbe7('0x43')]('i.'+_0x2f2623+_0xfbe7('0x78'));}else{_0x3a78ef['where']('i.'+_0x2f2623+'\x20=\x20?',_0xadcc21[_0xfbe7('0x3a')][_0x2f2623]);}}});}if(_0xadcc21[_0xfbe7('0x3a')][_0xfbe7('0x79')]){if(_0xadcc21[_0xfbe7('0x3a')]['read']==0x1){_0x3a78ef[_0xfbe7('0x5d')](_0xfbe7('0x7a'));}else{_0x3a78ef[_0xfbe7('0x5d')](_0xfbe7('0x7b'));}}if(_0xadcc21['query'][_0xfbe7('0x7c')]){_0x27b6d6=_['isArray'](_0xadcc21[_0xfbe7('0x3a')][_0xfbe7('0x7c')])?_0xadcc21['query']['tag']:new Array(_0xadcc21[_0xfbe7('0x3a')][_0xfbe7('0x7c')]);_0x27b6d6['forEach'](function(_0x2a2aae){_0x24ef3c['or'](_0xfbe7('0x6b'),'%,'+_0x2a2aae+',%');});}if(_0xadcc21['query'][_0xfbe7('0x7d')]){var _0x1243a9=_0xadcc21[_0xfbe7('0x3a')][_0xfbe7('0x7d')][_0xfbe7('0x7e')]('\x5c','\x5c\x5c')[_0xfbe7('0x7e')](/'/g,'\x27\x27');if(qs[_0xfbe7('0x7f')](_0x1243a9)){_0x3fa729['or'](_0xfbe7('0x80'),_0x1243a9+'%')['or']('i.fax\x20LIKE\x20?',_0x1243a9+'%');}_0x3fa729['or'](_0xfbe7('0x81'),_0x1243a9+'%');}}_0x3a78ef[_0xfbe7('0x43')](_0x3fa729);_0x3a78ef[_0xfbe7('0x82')](_0xfbe7('0x83'));var _0x2eec49={'type':db[_0xfbe7('0x84')]['QueryTypes'][_0xfbe7('0x85')],'raw':!![]};var _0x1456b2=_0x3a78ef[_0xfbe7('0x86')]();_0x1456b2['field']('i.id');_0x1456b2['field'](_0xfbe7('0x87'),_0xfbe7('0x5c'));if(_0x74eb01[_0xfbe7('0x41')]){_0x74eb01[_0xfbe7('0x41')][_0xfbe7('0x30')](function(_0x1a9bae){var _0x36c507=_0x1a9bae[0x0]===_0xfbe7('0x88')?_0x1a9bae[0x0]:'i.'+_0x1a9bae[0x0];_0x3a78ef[_0xfbe7('0x41')](_0x36c507,_0x1a9bae[0x1]===_0xfbe7('0x89')?![]:!![]);});}if(!_[_0xfbe7('0x73')](_0x27b6d6)){_0x3a78ef[_0xfbe7('0x5d')](_0x24ef3c);_0x1456b2[_0xfbe7('0x43')](_0xfbe7('0x8a'),_0x27b6d6);}BPromise[_0xfbe7('0x8b')]()[_0xfbe7('0x26')](function(){if(!_0x1b73b0){if(_0xadcc21['query'][_0xfbe7('0x8c')])return;_0x1456b2[_0xfbe7('0x43')](_0xfbe7('0x8d'));_0x3a78ef[_0xfbe7('0x43')](_0xfbe7('0x8d'));return;}if(_0xadcc21[_0xfbe7('0x8e')][_0xfbe7('0x8f')]!==_0xfbe7('0x90'))return;return _0xadcc21[_0xfbe7('0x8e')][_0xfbe7('0x91')]({'attributes':['id'],'raw':!![]})[_0xfbe7('0x26')](function(_0x55896a){if(_[_0xfbe7('0x73')](_0x55896a)){_0x1456b2[_0xfbe7('0x43')]('i.FaxAccountId\x20IS\x20NULL');_0x3a78ef[_0xfbe7('0x43')](_0xfbe7('0x92'));}else{_0x1456b2[_0xfbe7('0x43')](_0xfbe7('0x74'),_['map'](_0x55896a,'id'));_0x3a78ef[_0xfbe7('0x43')](_0xfbe7('0x74'),_['map'](_0x55896a,'id'));}});})[_0xfbe7('0x26')](function(){if(_0xadcc21[_0xfbe7('0x8e')][_0xfbe7('0x8f')]===_0xfbe7('0x90')&&!_0x1b73b0&&!_0xadcc21['query']['FaxAccountId'])return[];return db[_0xfbe7('0x93')][_0xfbe7('0x3a')](_0x1456b2['toString'](),_0x2eec49);})[_0xfbe7('0x26')](function(_0x11d4d8){_0x1f2141[_0xfbe7('0x20')]=_0x11d4d8['length'];if(_0x1f2141[_0xfbe7('0x20')]===0x0)return[];return db['sequelize']['query'](_0x5ed2db['toString'](),_0x2eec49)[_0xfbe7('0x26')](function(_0x19606e){_0x2ce4c2=_['keyBy'](_0x19606e,'id');_0x2eec49=_[_0xfbe7('0x94')](_0x2eec49,{'model':db[_0xfbe7('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xadcc21['query'][_0xfbe7('0x3c')]){_0x74eb01['attributes'][_0xfbe7('0x30')](function(_0x19fd7f){_0x3a78ef[_0xfbe7('0x47')]('i.'+_0x19fd7f);});}else{_0x3a78ef[_0xfbe7('0x47')](_0xfbe7('0x87'),'unreadMessages');_0x3a78ef[_0xfbe7('0x47')](_0xfbe7('0x95'),_0xfbe7('0x96'));_0x3a78ef[_0xfbe7('0x47')](_0xfbe7('0x97'),_0xfbe7('0x98'));_0x3a78ef[_0xfbe7('0x47')](_0xfbe7('0x99'),_0xfbe7('0x88'));_0x3a78ef[_0xfbe7('0x47')]('i.*');_0x3a78ef[_0xfbe7('0x47')](_0xfbe7('0x9a'),_0xfbe7('0x9b'));_0x3a78ef[_0xfbe7('0x47')]('c.lastName',_0xfbe7('0x9c'));_0x3a78ef['field']('c.email',_0xfbe7('0x9d'));_0x3a78ef['field'](_0xfbe7('0x9e'),_0xfbe7('0x9f'));_0x3a78ef[_0xfbe7('0x47')](_0xfbe7('0xa0'),_0xfbe7('0xa1'));_0x3a78ef[_0xfbe7('0x47')](_0xfbe7('0xa2'),'Contact.fax');_0x3a78ef['field'](_0xfbe7('0xa3'),_0xfbe7('0xa4'));_0x3a78ef[_0xfbe7('0x47')](_0xfbe7('0xa5'),'Owner.internal');_0x3a78ef['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0xfbe7('0x2d'));}if(_0x74eb01[_0xfbe7('0x40')])_0x3a78ef['limit'](_0x74eb01[_0xfbe7('0x40')]);if(_0x74eb01['offset'])_0x3a78ef[_0xfbe7('0x1f')](_0x74eb01['offset']);return db['sequelize']['query'](_0x3a78ef['toString'](),_0x2eec49);})[_0xfbe7('0x26')](function(_0x273b88){if(_0x273b88[_0xfbe7('0x3e')]>0x0)_0x5eedc7[_0xfbe7('0x43')](_0xfbe7('0xa6'),_[_0xfbe7('0x2b')](_0x273b88,'id'));return db[_0xfbe7('0x93')][_0xfbe7('0x3a')](_0x5eedc7[_0xfbe7('0xa7')](),_0x2eec49)[_0xfbe7('0x26')](function(_0x322f39){var _0x5044a=_['groupBy'](_0x322f39,_0xfbe7('0xa8'));var _0x384efa=[];_0x273b88[_0xfbe7('0x30')](function(_0x37a413){_0x384efa[_0xfbe7('0x31')](updateFaxInteraction(_0x37a413,_0x2ce4c2,_0x5044a));});return BPromise[_0xfbe7('0xa9')](_0x384efa);});});})[_0xfbe7('0x26')](function(_0x36d8c3){_0x1f2141[_0xfbe7('0xaa')]=_0x36d8c3;return _0x1f2141;})['then'](respondWithFilteredResult(_0x787bb0,_0x74eb01))[_0xfbe7('0x32')](handleError(_0x787bb0,null));};exports[_0xfbe7('0xab')]=function(_0x304ff1,_0x2a48b0){var _0x41ef47={'raw':![],'where':{'id':_0x304ff1[_0xfbe7('0xac')]['id']}},_0x20f843={};_0x20f843['model']=_['keys'](db[_0xfbe7('0x34')][_0xfbe7('0x35')]);_0x20f843['query']=_['keys'](_0x304ff1[_0xfbe7('0x3a')]);_0x20f843[_0xfbe7('0x44')]=_['intersection'](_0x20f843[_0xfbe7('0x39')],_0x20f843['query']);_0x41ef47[_0xfbe7('0x3d')]=_[_0xfbe7('0xad')](_0x20f843[_0xfbe7('0x39')],qs[_0xfbe7('0x3c')](_0x304ff1['query'][_0xfbe7('0x3c')]));_0x41ef47['attributes']=_0x41ef47[_0xfbe7('0x3d')][_0xfbe7('0x3e')]?_0x41ef47[_0xfbe7('0x3d')]:_0x20f843[_0xfbe7('0x39')];if(_0x304ff1[_0xfbe7('0x3a')]['includeAll']){_0x41ef47['include']=[{'all':!![]}];}_0x41ef47=_[_0xfbe7('0x94')]({},_0x41ef47,_0x304ff1[_0xfbe7('0xae')]);return db[_0xfbe7('0x34')][_0xfbe7('0x5b')](_0x41ef47)[_0xfbe7('0x26')](handleEntityNotFound(_0x2a48b0,null))[_0xfbe7('0x26')](respondWithResult(_0x2a48b0,null))[_0xfbe7('0x32')](handleError(_0x2a48b0,null));};exports[_0xfbe7('0xaf')]=function(_0x23fdfa,_0x110424){return db[_0xfbe7('0x34')][_0xfbe7('0xaf')](_0x23fdfa[_0xfbe7('0x70')],{})[_0xfbe7('0x26')](respondWithResult(_0x110424,0xc9))[_0xfbe7('0x32')](handleError(_0x110424,null));};exports[_0xfbe7('0x25')]=function(_0x6bece3,_0x48c4dd){if(_0x6bece3['body']['id']){delete _0x6bece3[_0xfbe7('0x70')]['id'];}return db[_0xfbe7('0x34')][_0xfbe7('0x5b')]({'where':{'id':_0x6bece3[_0xfbe7('0xac')]['id']}})[_0xfbe7('0x26')](handleEntityNotFound(_0x48c4dd,null))[_0xfbe7('0x26')](saveUpdates(_0x6bece3[_0xfbe7('0x70')],null))[_0xfbe7('0x26')](respondWithResult(_0x48c4dd,null))['catch'](handleError(_0x48c4dd,null));};exports[_0xfbe7('0x27')]=function(_0x33899c,_0x3b7fdb){return db[_0xfbe7('0x34')]['find']({'where':{'id':_0x33899c[_0xfbe7('0xac')]['id']}})['then'](handleEntityNotFound(_0x3b7fdb,null))[_0xfbe7('0x26')](removeEntity(_0x3b7fdb,null))['catch'](handleError(_0x3b7fdb,null));};exports[_0xfbe7('0xb0')]=function(_0x424da2,_0x49de69){return db[_0xfbe7('0x34')][_0xfbe7('0xb0')]()['then'](respondWithResult(_0x49de69,null))[_0xfbe7('0x32')](handleError(_0x49de69,null));};exports[_0xfbe7('0xb1')]=function(_0x69bd1a,_0x15fe34,_0x25a910){return db[_0xfbe7('0xb2')]['find']({'where':{'id':_0x69bd1a[_0xfbe7('0xac')]['id']}})[_0xfbe7('0x26')](handleEntityNotFound(_0x15fe34,null))[_0xfbe7('0x26')](function(_0x3ee5ee){if(_0x3ee5ee){return _0x3ee5ee['addMessage'](_0x69bd1a[_0xfbe7('0x70')][_0xfbe7('0xb3')],_[_0xfbe7('0xb4')](_0x69bd1a[_0xfbe7('0x70')],[_0xfbe7('0xb3'),'id'])||{});}})['then'](respondWithResult(_0x15fe34,null))[_0xfbe7('0x32')](handleError(_0x15fe34,null));};exports[_0xfbe7('0xb5')]=function(_0x49abf6,_0x359624,_0x1e7160){var _0x4c4746={'raw':![],'where':{}};var _0x544492={};var _0x56f2fe={'count':0x0,'rows':[]};return db[_0xfbe7('0x34')]['findOne']({'where':{'id':_0x49abf6[_0xfbe7('0xac')]['id']}})['then'](handleEntityNotFound(_0x359624,null))['then'](function(_0x457fec){if(_0x457fec){_0x544492[_0xfbe7('0x39')]=_[_0xfbe7('0x3b')](db[_0xfbe7('0xb2')]['rawAttributes']);_0x544492[_0xfbe7('0x3a')]=_[_0xfbe7('0x3b')](_0x49abf6['query']);_0x544492[_0xfbe7('0x44')]=_[_0xfbe7('0xad')](_0x544492['model'],_0x544492[_0xfbe7('0x3a')]);_0x4c4746[_0xfbe7('0x3d')]=_[_0xfbe7('0xad')](_0x544492[_0xfbe7('0x39')],qs[_0xfbe7('0x3c')](_0x49abf6['query'][_0xfbe7('0x3c')]));_0x4c4746[_0xfbe7('0x3d')]=_0x4c4746[_0xfbe7('0x3d')][_0xfbe7('0x3e')]?_0x4c4746['attributes']:_0x544492[_0xfbe7('0x39')];if(!_0x49abf6[_0xfbe7('0x3a')][_0xfbe7('0xb6')]('nolimit')){_0x4c4746[_0xfbe7('0x40')]=qs[_0xfbe7('0x40')](_0x49abf6[_0xfbe7('0x3a')][_0xfbe7('0x40')]);_0x4c4746[_0xfbe7('0x1f')]=qs['offset'](_0x49abf6[_0xfbe7('0x3a')][_0xfbe7('0x1f')]);}_0x4c4746[_0xfbe7('0x41')]=qs[_0xfbe7('0x42')](_0x49abf6['query'][_0xfbe7('0x42')]);_0x4c4746[_0xfbe7('0x43')]=qs[_0xfbe7('0x44')](_['pick'](_0x49abf6[_0xfbe7('0x3a')],_0x544492['filters']));_0x4c4746['where']['FaxInteractionId']=_0x457fec['id'];if(_0x49abf6['query'][_0xfbe7('0x7d')]){_0x4c4746[_0xfbe7('0x43')]=_[_0xfbe7('0x94')](_0x4c4746[_0xfbe7('0x43')],{'$or':_[_0xfbe7('0x2b')](_0x4c4746[_0xfbe7('0x3d')],function(_0x2109bf){var _0x46f3f7={};_0x46f3f7[_0x2109bf]={'$like':'%'+_0x49abf6[_0xfbe7('0x3a')][_0xfbe7('0x7d')]+'%'};return _0x46f3f7;})});}if(_0x49abf6[_0xfbe7('0x3a')][_0xfbe7('0x77')]){var _0x494e5d=_0x49abf6[_0xfbe7('0x3a')][_0xfbe7('0x77')][_0xfbe7('0x2f')](',');var _0x37cd48={};_0x37cd48[_0x494e5d[0x0]]={'$gte':moment(_0x494e5d[0x1])[_0xfbe7('0xb7')](_0xfbe7('0xb8'))};_0x4c4746[_0xfbe7('0x43')]=_[_0xfbe7('0x94')](_0x4c4746[_0xfbe7('0x43')],_0x37cd48);}_0x4c4746=_[_0xfbe7('0x94')]({},_0x4c4746,_0x49abf6['options']);return db[_0xfbe7('0xb2')][_0xfbe7('0x20')]({'where':_0x4c4746[_0xfbe7('0x43')]})[_0xfbe7('0x26')](function(_0x14f2e5){_0x56f2fe['count']=_0x14f2e5;if(_0x49abf6[_0xfbe7('0x3a')]['includeAll']){_0x4c4746['include']=[{'all':!![]}];}return db[_0xfbe7('0xb2')]['findAll'](_0x4c4746);})[_0xfbe7('0x26')](function(_0x4424e2){_0x56f2fe[_0xfbe7('0xaa')]=_0x4424e2;return _0x56f2fe;});}})['then'](respondWithFilteredResult(_0x359624,_0x4c4746))['catch'](handleError(_0x359624,null));};exports[_0xfbe7('0xb9')]=function(_0xdd2d09,_0xde59c6,_0x520023){return db[_0xfbe7('0x34')][_0xfbe7('0x5b')]({'where':{'id':_0xdd2d09['params']['id']}})[_0xfbe7('0x26')](handleEntityNotFound(_0xde59c6,null))[_0xfbe7('0x26')](function(_0xaf9130){if(_0xaf9130){return _0xaf9130[_0xfbe7('0xba')](_0xdd2d09[_0xfbe7('0x70')][_0xfbe7('0xb3')],_['omit'](_0xdd2d09[_0xfbe7('0x70')],[_0xfbe7('0xb3'),'id'])||{})[_0xfbe7('0xbb')](function(){return db[_0xfbe7('0x6a')][_0xfbe7('0xbc')]({'attributes':['id',_0xfbe7('0x28'),_0xfbe7('0x48')],'where':{'id':_0xdd2d09[_0xfbe7('0x70')][_0xfbe7('0xb3')]}});})[_0xfbe7('0x26')](function(_0x2718f4){socket['emit'](_0xfbe7('0xbd'),{'id':Number(_0xdd2d09['params']['id']),'tags':_0x2718f4||[]});return{'id':Number(_0xdd2d09['params']['id']),'tags':_0x2718f4||[]};});}})['then'](respondWithResult(_0xde59c6,null))[_0xfbe7('0x32')](handleError(_0xde59c6,null));};exports['removeTags']=function(_0x24b4a3,_0x1746bb,_0x572a9a){return db[_0xfbe7('0x34')][_0xfbe7('0x5b')]({'where':{'id':_0x24b4a3[_0xfbe7('0xac')]['id']}})[_0xfbe7('0x26')](handleEntityNotFound(_0x1746bb,null))[_0xfbe7('0x26')](function(_0xeb0f97){if(_0xeb0f97){return _0xeb0f97[_0xfbe7('0xbe')](_0x24b4a3[_0xfbe7('0x3a')]['ids']);}})['then'](respondWithStatusCode(_0x1746bb,null))[_0xfbe7('0x32')](handleError(_0x1746bb,null));};exports[_0xfbe7('0xbf')]=function(_0xc37bb9,_0x1e958d){var _0x56f37b=moment()[_0xfbe7('0xc0')]()[_0xfbe7('0xa7')]();var _0x1764b1=path[_0xfbe7('0xc1')](config[_0xfbe7('0xc2')],'server',_0xfbe7('0xc3'),'tmp');var _0x5e59c9=path[_0xfbe7('0xc1')](config['root'],'server',_0xfbe7('0xc3'),'attachments');var _0x760bf1=path['join'](_0x1764b1,_0x56f37b);var _0x540b4f=util[_0xfbe7('0xb7')]('transcript-%d-%s.zip',_0xc37bb9[_0xfbe7('0xac')]['id'],_0x56f37b);var _0x1fef59=path['join'](_0x1764b1,_0x540b4f);var _0x835493=[];_0x835493[_0xfbe7('0x31')]({'model':db['Attachment'],'as':_0xfbe7('0xc4'),'raw':!![]});var _0x21757c=[{'model':db[_0xfbe7('0xb2')],'as':'Messages','attributes':['id',_0xfbe7('0x70'),_0xfbe7('0x75')],'include':_0x835493}];return db[_0xfbe7('0x34')][_0xfbe7('0x5b')]({'where':{'id':_0xc37bb9[_0xfbe7('0xac')]['id']},'include':_0x21757c})[_0xfbe7('0x26')](handleEntityNotFound(_0x1e958d,null))[_0xfbe7('0x26')](function(_0x339d10){if(_0x339d10&&_0x339d10['Messages']){var _0x3cb1e7=_0x339d10[_0xfbe7('0xc5')]({'plain':!![]});fs[_0xfbe7('0xc6')](_0x760bf1);for(var _0x4d3933=0x0;_0x4d3933<_0x3cb1e7[_0xfbe7('0xc7')][_0xfbe7('0x3e')];_0x4d3933++){var _0x369810=_0x3cb1e7['Messages'][_0x4d3933][_0xfbe7('0xc4')];if(_0x369810){var _0x2655a2=path[_0xfbe7('0xc1')](_0x5e59c9,_0x369810['basename']);if(fs[_0xfbe7('0xc8')](_0x2655a2)){fs['createReadStream'](_0x2655a2)[_0xfbe7('0xc9')](fs[_0xfbe7('0xca')](path[_0xfbe7('0xc1')](_0x760bf1,_0x369810['basename'])));}}}return BPromise['resolve']()[_0xfbe7('0x26')](function(){return new BPromise(function(_0x7c799e,_0x1d247f){zipdir(_0x760bf1,{'saveTo':_0x1fef59},function(_0x396843,_0x40d40a){if(_0x396843)return _0x1d247f(_0x396843);return _0x7c799e(_0x40d40a);});})[_0xfbe7('0x26')](function(){return new BPromise(function(_0x137d6f,_0x1a7840){rimraf(_0x760bf1,function(_0x3615ee){if(_0x3615ee)_0x1a7840(_0x3615ee);return _0x137d6f();});});})['then'](function(){return _0x1e958d[_0xfbe7('0xbf')](_0x1fef59,_0x540b4f,function(_0x3503c4){if(_0x3503c4){console[_0xfbe7('0xcb')](_0xfbe7('0xcc'),_0x3503c4);}else{fs['unlinkSync'](_0x1fef59);}});});});}else{return _0x1e958d['sendStatus'](0xc8);}})['catch'](handleError(_0x1e958d,null));}; \ No newline at end of file +var _0x33da=['name','send','Users','map','fullname','TagIds','Tags','split','catch','index','FaxInteraction','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','select','field','color','tools_tags','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','from','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','length','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','type','body','buildExpression','start','some','isEmpty','FaxAccountId','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','where','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','i.FaxAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','i.*','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','push','rows','show','includeAll','include','create','params','describe','addMessage','FaxMessage','omit','ids','format','findAll','setTags','spread','faxInteractionTags:save','removeTags','unix','join','root','server','tmp','files','transcript-%d-%s.zip','Attachment','Messages','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','download','err','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./faxInteraction.socket','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','sendStatus','stack'];(function(_0x25388c,_0x38f391){var _0x198dbb=function(_0x50c60c){while(--_0x50c60c){_0x25388c['push'](_0x25388c['shift']());}};_0x198dbb(++_0x38f391);}(_0x33da,0xa6));var _0xa33d=function(_0x539533,_0x59b89b){_0x539533=_0x539533-0x0;var _0x3942f3=_0x33da[_0x539533];return _0x3942f3;};'use strict';var emlformat=require(_0xa33d('0x0'));var rimraf=require(_0xa33d('0x1'));var zipdir=require(_0xa33d('0x2'));var jsonpatch=require(_0xa33d('0x3'));var rp=require(_0xa33d('0x4'));var moment=require('moment');var BPromise=require(_0xa33d('0x5'));var Mustache=require('mustache');var util=require(_0xa33d('0x6'));var path=require(_0xa33d('0x7'));var sox=require(_0xa33d('0x8'));var csv=require('to-csv');var ejs=require(_0xa33d('0x9'));var fs=require('fs');var fs_extra=require(_0xa33d('0xa'));var _=require(_0xa33d('0xb'));var squel=require(_0xa33d('0xc'));var crypto=require(_0xa33d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa33d('0xe'));var toCsv=require(_0xa33d('0xf'));var querystring=require(_0xa33d('0x10'));var Papa=require(_0xa33d('0x11'));var Redis=require(_0xa33d('0x12'));var authService=require(_0xa33d('0x13'));var qs=require(_0xa33d('0x14'));var as=require(_0xa33d('0x15'));var hardwareService=require(_0xa33d('0x16'));var logger=require(_0xa33d('0x17'))(_0xa33d('0x18'));var utils=require(_0xa33d('0x19'));var config=require(_0xa33d('0x1a'));var licenseUtil=require(_0xa33d('0x1b'));var db=require(_0xa33d('0x1c'))['db'];config[_0xa33d('0x1d')]=_[_0xa33d('0x1e')](config[_0xa33d('0x1d')],{'host':'localhost','port':0x18eb});var socket=require(_0xa33d('0x1f'))(new Redis(config[_0xa33d('0x1d')]));require(_0xa33d('0x20'))['register'](socket);function respondWithStatusCode(_0x40c220,_0x424a79){_0x424a79=_0x424a79||0xcc;return function(_0x55cad9){if(_0x55cad9){return _0x40c220['sendStatus'](_0x424a79);}return _0x40c220[_0xa33d('0x21')](_0x424a79)[_0xa33d('0x22')]();};}function respondWithResult(_0x3880ca,_0x29f0ee){_0x29f0ee=_0x29f0ee||0xc8;return function(_0x4787ed){if(_0x4787ed){return _0x3880ca['status'](_0x29f0ee)[_0xa33d('0x23')](_0x4787ed);}};}function respondWithFilteredResult(_0x3b684d,_0xbde8d3){return function(_0x4300bd){if(_0x4300bd){var _0x579072=typeof _0xbde8d3[_0xa33d('0x24')]===_0xa33d('0x25')&&typeof _0xbde8d3[_0xa33d('0x26')]===_0xa33d('0x25');var _0x8b2f5a=_0x4300bd[_0xa33d('0x27')];var _0xd80ba2=_0x579072?0x0:_0xbde8d3['offset'];var _0x9f5dc3=_0x579072?_0x4300bd[_0xa33d('0x27')]:_0xbde8d3['offset']+_0xbde8d3[_0xa33d('0x26')];var _0x2d4111;if(_0x9f5dc3>=_0x8b2f5a){_0x9f5dc3=_0x8b2f5a;_0x2d4111=0xc8;}else{_0x2d4111=0xce;}_0x3b684d[_0xa33d('0x21')](_0x2d4111);return _0x3b684d[_0xa33d('0x28')](_0xa33d('0x29'),_0xd80ba2+'-'+_0x9f5dc3+'/'+_0x8b2f5a)[_0xa33d('0x23')](_0x4300bd);}return null;};}function patchUpdates(_0x4bac75){return function(_0x20609f){try{jsonpatch['apply'](_0x20609f,_0x4bac75,!![]);}catch(_0x594345){return BPromise['reject'](_0x594345);}return _0x20609f[_0xa33d('0x2a')]();};}function saveUpdates(_0x1daa76,_0x57fce7){return function(_0xcd4cde){if(_0xcd4cde){return _0xcd4cde[_0xa33d('0x2b')](_0x1daa76)[_0xa33d('0x2c')](function(_0x1ca1f7){return _0x1ca1f7;});}return null;};}function removeEntity(_0x1708fc,_0x24af54){return function(_0x1b0051){if(_0x1b0051){return _0x1b0051[_0xa33d('0x2d')]()[_0xa33d('0x2c')](function(){_0x1708fc[_0xa33d('0x21')](0xcc)[_0xa33d('0x22')]();});}};}function handleEntityNotFound(_0x284d43,_0x205504){return function(_0x248147){if(!_0x248147){_0x284d43[_0xa33d('0x2e')](0x194);}return _0x248147;};}function handleError(_0x12be8c,_0x1b2525){_0x1b2525=_0x1b2525||0x1f4;return function(_0x2a1097){logger['error'](_0x2a1097[_0xa33d('0x2f')]);if(_0x2a1097[_0xa33d('0x30')]){delete _0x2a1097[_0xa33d('0x30')];}_0x12be8c[_0xa33d('0x21')](_0x1b2525)[_0xa33d('0x31')](_0x2a1097);};}function getInteractionUsers(_0x37742c,_0x1985d7){return new BPromise(function(_0x4a1cee,_0x3f505c){try{if(_0x1985d7[_0x37742c['id']]){_0x37742c[_0xa33d('0x32')]=_[_0xa33d('0x33')](_0x1985d7[_0x37742c['id']],function(_0x319fa6){return{'id':_0x319fa6['id'],'fullname':_0x319fa6[_0xa33d('0x34')]};});}}catch(_0x8bd9e5){_0x3f505c(_0x8bd9e5);}_0x4a1cee(_0x37742c);});}function getInteractionTags(_0x17b5c5,_0x12c124){return new BPromise(function(_0x35a234,_0x34d648){try{if(_0x17b5c5[_0xa33d('0x35')]){_0x17b5c5[_0xa33d('0x36')]=[];_0x17b5c5['TagIds'][_0xa33d('0x37')](',')['forEach'](function(_0x3e6b8a){_0x17b5c5[_0xa33d('0x36')]['push'](_0x12c124[_0x3e6b8a]);});}delete _0x17b5c5['TagIds'];}catch(_0x435288){_0x34d648(_0x435288);}_0x35a234(_0x17b5c5);});}function updateFaxInteraction(_0x4b69df,_0x5c1989,_0x1d19ce){return new BPromise(function(_0x4c37a6,_0x412614){return getInteractionUsers(_0x4b69df,_0x1d19ce)['then'](function(_0x55bc0a){return getInteractionTags(_0x55bc0a,_0x5c1989);})[_0xa33d('0x2c')](function(_0x3f0d3d){_0x4c37a6(_0x3f0d3d);})[_0xa33d('0x38')](function(_0x427881){_0x412614(_0x427881);});});}exports[_0xa33d('0x39')]=function(_0x28f202,_0x46c171){var _0x2486ce={},_0x4ba047={},_0xbaba97={'count':0x0,'rows':[]};var _0x298580=_['map'](db[_0xa33d('0x3a')][_0xa33d('0x3b')],function(_0x255afc){return{'name':_0x255afc[_0xa33d('0x3c')],'type':_0x255afc['type'][_0xa33d('0x3d')]};});_0x4ba047['model']=_[_0xa33d('0x33')](_0x298580,_0xa33d('0x30'));_0x4ba047[_0xa33d('0x3e')]=_[_0xa33d('0x3f')](_0x28f202[_0xa33d('0x3e')]);_0x4ba047['filters']=_[_0xa33d('0x40')](_0x4ba047[_0xa33d('0x41')],_0x4ba047['query']);_0x2486ce[_0xa33d('0x42')]=_[_0xa33d('0x40')](_0x4ba047['model'],qs['fields'](_0x28f202[_0xa33d('0x3e')][_0xa33d('0x43')]));_0x2486ce[_0xa33d('0x42')]=_0x2486ce[_0xa33d('0x42')]['length']?_0x2486ce[_0xa33d('0x42')]:_0x4ba047[_0xa33d('0x41')];if(!_0x28f202[_0xa33d('0x3e')][_0xa33d('0x44')](_0xa33d('0x45'))){_0x2486ce[_0xa33d('0x26')]=qs['limit'](_0x28f202[_0xa33d('0x3e')][_0xa33d('0x26')]);_0x2486ce['offset']=qs['offset'](_0x28f202[_0xa33d('0x3e')][_0xa33d('0x24')]);}_0x2486ce[_0xa33d('0x46')]=qs['sort'](_0x28f202[_0xa33d('0x3e')][_0xa33d('0x47')]);_0x2486ce['where']=qs[_0xa33d('0x48')](_[_0xa33d('0x49')](_0x28f202[_0xa33d('0x3e')],_0x4ba047['filters']),_0x298580);var _0x19a07a=[];var _0x25448c=squel[_0xa33d('0x4a')]()[_0xa33d('0x4b')]('id')[_0xa33d('0x4b')](_0xa33d('0x30'))[_0xa33d('0x4b')](_0xa33d('0x4c'))['from'](_0xa33d('0x4d'));var _0x208c0c=squel['select']()[_0xa33d('0x4b')]('u.id')[_0xa33d('0x4b')]('u.fullname')[_0xa33d('0x4b')](_0xa33d('0x4e'))['from'](_0xa33d('0x4f'),'ui')[_0xa33d('0x50')](_0xa33d('0x51'),'u',_0xa33d('0x52'));var _0x488e18=squel[_0xa33d('0x4a')]()[_0xa33d('0x53')]('fax_interactions','i')[_0xa33d('0x50')](_0xa33d('0x54'),'c',_0xa33d('0x55'))[_0xa33d('0x50')]('users','o',_0xa33d('0x56'))[_0xa33d('0x50')](_0xa33d('0x57'),'a',_0xa33d('0x58'))[_0xa33d('0x50')]('fax_messages','me','me.FaxInteractionId\x20=\x20i.id')[_0xa33d('0x50')]('fax_interaction_has_tags','it',_0xa33d('0x59'))[_0xa33d('0x50')](_0xa33d('0x4d'),'t',_0xa33d('0x5a'));var _0x5f45dc=squel['expr']();var _0x3c3935=[];var _0x1cfcb9=squel[_0xa33d('0x5b')]();var _0x2f4590;if(_0x28f202['query'][_0xa33d('0x5c')]){_0x2f4590=as[_0xa33d('0x5d')](_0x28f202[_0xa33d('0x3e')][_0xa33d('0x5c')]);var _0x24a4b9=_0x2f4590[_0xa33d('0x5e')];for(var _0x1d2995=0x0;_0x1d2995<_0x2f4590['conditions'][_0xa33d('0x5f')];_0x1d2995++){var _0x584285=_0x2f4590[_0xa33d('0x60')][_0x1d2995];var _0x3f8a6c='i';var _0x2c61c7=_[_0xa33d('0x61')](_0x298580,[_0xa33d('0x30'),_0x584285[_0xa33d('0x4b')]]);if(!_0x2c61c7){switch(_0x584285[_0xa33d('0x4b')]){case _0xa33d('0x62'):if(_0x584285['value']==0x1){_0x488e18[_0xa33d('0x63')]('`'+_0x584285[_0xa33d('0x4b')]+_0xa33d('0x64'));}else{_0x488e18[_0xa33d('0x63')]('`'+_0x584285[_0xa33d('0x4b')]+_0xa33d('0x65'));}break;case _0xa33d('0x66'):if(_0x584285['operator']===_0xa33d('0x67')){if(_0x584285[_0xa33d('0x68')][_0xa33d('0x37')]('\x20')['length']>0x1){_0x5f45dc[_0x24a4b9](_0xa33d('0x69'),qs['getFullTextValue'](_0x584285[_0xa33d('0x68')]),null);}else{var _0x160a2d='%'+_0x584285[_0xa33d('0x68')]+'%';_0x5f45dc[_0x24a4b9](_0xa33d('0x6a'),_0x160a2d,_0x160a2d,_0x160a2d);}}else{_0x2c61c7=_['find'](_0x298580,[_0xa33d('0x30'),_0xa33d('0x6b')]);_0x584285[_0xa33d('0x4b')]=_0xa33d('0x6b');_0x59aa1a=as['buildExpression'](_0x3f8a6c,_0x2c61c7['type'],_0x584285);_0x5f45dc[_0x24a4b9](_0x59aa1a[_0xa33d('0x6c')],_0x59aa1a[_0xa33d('0x68')]['start'],_0x59aa1a[_0xa33d('0x68')][_0xa33d('0x22')]);}break;case _0xa33d('0x6d'):var _0x3034bd=_0x584285['value'][_0xa33d('0x37')](',')[_0xa33d('0x33')](function(_0x499153){return Number(_0x499153);});_0x3034bd[_0xa33d('0x6e')](function(_0x1fab0f){_0x1cfcb9['or'](_0xa33d('0x6f'),'%,'+_0x1fab0f+',%');});_0x3c3935=_[_0xa33d('0x70')](_0x3c3935,_0x3034bd);break;case _0xa33d('0x71'):if(_0x584285['operator']===_0xa33d('0x67')){_0x5f45dc[_0x24a4b9](_0xa33d('0x72'),'%'+_0x584285[_0xa33d('0x68')]+'%',null);}else{_0x2c61c7=_['find'](_0x298580,[_0xa33d('0x30'),_0xa33d('0x73')]);_0x584285[_0xa33d('0x4b')]=_0xa33d('0x73');_0x59aa1a=as['buildExpression'](_0x3f8a6c,_0x2c61c7[_0xa33d('0x74')],_0x584285);_0x5f45dc[_0x24a4b9](_0x59aa1a[_0xa33d('0x6c')],_0x59aa1a[_0xa33d('0x68')]['start'],_0x59aa1a[_0xa33d('0x68')][_0xa33d('0x22')]);}break;case _0xa33d('0x75'):_0x59aa1a=as[_0xa33d('0x76')]('me',null,_0x584285);_0x5f45dc[_0x24a4b9](_0x59aa1a[_0xa33d('0x6c')],_0x59aa1a[_0xa33d('0x68')][_0xa33d('0x77')],_0x59aa1a[_0xa33d('0x68')][_0xa33d('0x22')]);break;}}else{var _0x59aa1a=as['buildExpression'](_0x3f8a6c,_0x2c61c7[_0xa33d('0x74')],_0x584285);_0x5f45dc[_0x24a4b9](_0x59aa1a[_0xa33d('0x6c')],_0x59aa1a[_0xa33d('0x68')]['start'],_0x59aa1a[_0xa33d('0x68')][_0xa33d('0x22')]);}}}else{var _0x2530fc=_(_0x28f202['query'])['keys']()['map'](function(_0x48ce4d){return _[_0xa33d('0x78')](_0x298580,['name',_0x48ce4d])?_0x48ce4d:undefined;})['compact']()['value']();if(!_[_0xa33d('0x79')](_0x2530fc)){_0x2530fc['forEach'](function(_0x16ae78){if(_0x16ae78===_0xa33d('0x7a')){_0x488e18['where']('i.FaxAccountId\x20IN\x20?',[]['concat'](_0x28f202[_0xa33d('0x3e')][_0x16ae78]));}else if(_0x16ae78===_0xa33d('0x7b')){var _0xda47e3=JSON[_0xa33d('0x7c')](_0x28f202[_0xa33d('0x3e')][_0x16ae78])[_0xa33d('0x7d')];var _0x3bf1fb=JSON['parse'](_0x28f202[_0xa33d('0x3e')][_0x16ae78])['$lte'];_0x488e18['where'](_0xa33d('0x7e'),_0xda47e3,_0x3bf1fb);}else{if(_0x28f202[_0xa33d('0x3e')][_0x16ae78]===_0xa33d('0x7f')){_0x488e18[_0xa33d('0x80')]('i.'+_0x16ae78+_0xa33d('0x81'));}else{_0x488e18[_0xa33d('0x80')]('i.'+_0x16ae78+_0xa33d('0x82'),_0x28f202[_0xa33d('0x3e')][_0x16ae78]);}}});}if(_0x28f202['query'][_0xa33d('0x83')]){if(_0x28f202[_0xa33d('0x3e')][_0xa33d('0x83')]==0x1){_0x488e18[_0xa33d('0x63')]('`unreadMessages`\x20=\x200');}else{_0x488e18['having'](_0xa33d('0x84'));}}if(_0x28f202['query'][_0xa33d('0x85')]){_0x3c3935=_[_0xa33d('0x86')](_0x28f202[_0xa33d('0x3e')][_0xa33d('0x85')])?_0x28f202['query']['tag']:new Array(_0x28f202['query'][_0xa33d('0x85')]);_0x3c3935['forEach'](function(_0x4ce6bb){_0x1cfcb9['or'](_0xa33d('0x6f'),'%,'+_0x4ce6bb+',%');});}if(_0x28f202[_0xa33d('0x3e')][_0xa33d('0x87')]){var _0x435482=_0x28f202[_0xa33d('0x3e')][_0xa33d('0x87')][_0xa33d('0x88')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x435482)){_0x5f45dc['or'](_0xa33d('0x89'),_0x435482+'%')['or']('i.fax\x20LIKE\x20?',_0x435482+'%');}_0x5f45dc['or'](_0xa33d('0x8a'),_0x435482+'%');}}_0x488e18[_0xa33d('0x80')](_0x5f45dc);_0x488e18[_0xa33d('0x8b')]('i.id');var _0x4771aa={'type':db[_0xa33d('0x8c')][_0xa33d('0x8d')][_0xa33d('0x8e')],'raw':!![]};var _0x57db68=_0x488e18[_0xa33d('0x8f')]();_0x57db68[_0xa33d('0x4b')]('i.id');_0x57db68[_0xa33d('0x4b')](_0xa33d('0x90'),'unreadMessages');if(_0x2486ce['order']){_0x2486ce[_0xa33d('0x46')][_0xa33d('0x6e')](function(_0x2fa9d0){var _0x143a2c=_0x2fa9d0[0x0]===_0xa33d('0x91')?_0x2fa9d0[0x0]:'i.'+_0x2fa9d0[0x0];_0x488e18[_0xa33d('0x46')](_0x143a2c,_0x2fa9d0[0x1]===_0xa33d('0x92')?![]:!![]);});}if(!_[_0xa33d('0x79')](_0x3c3935)){_0x488e18[_0xa33d('0x63')](_0x1cfcb9);_0x57db68[_0xa33d('0x80')]('t.id\x20IN\x20?',_0x3c3935);}BPromise[_0xa33d('0x93')]()[_0xa33d('0x2c')](function(){if(!_0x2f4590){if(_0x28f202['query']['FaxAccountId'])return;_0x57db68[_0xa33d('0x80')](_0xa33d('0x94'));_0x488e18[_0xa33d('0x80')](_0xa33d('0x94'));return;}if(_0x28f202[_0xa33d('0x95')][_0xa33d('0x96')]!==_0xa33d('0x97'))return;return _0x28f202[_0xa33d('0x95')][_0xa33d('0x98')]({'attributes':['id'],'raw':!![]})[_0xa33d('0x2c')](function(_0x554e76){if(_[_0xa33d('0x79')](_0x554e76)){_0x57db68[_0xa33d('0x80')]('i.FaxAccountId\x20IS\x20NULL');_0x488e18['where']('i.FaxAccountId\x20IS\x20NULL');}else{_0x57db68['where'](_0xa33d('0x99'),_[_0xa33d('0x33')](_0x554e76,'id'));_0x488e18['where'](_0xa33d('0x99'),_[_0xa33d('0x33')](_0x554e76,'id'));}});})['then'](function(){if(_0x28f202['user'][_0xa33d('0x96')]===_0xa33d('0x97')&&!_0x2f4590&&!_0x28f202[_0xa33d('0x3e')][_0xa33d('0x7a')])return[];return db[_0xa33d('0x9a')]['query'](_0x57db68[_0xa33d('0x9b')](),_0x4771aa);})[_0xa33d('0x2c')](function(_0x2dd590){_0xbaba97[_0xa33d('0x27')]=_0x2dd590['length'];if(_0xbaba97[_0xa33d('0x27')]===0x0)return[];return db[_0xa33d('0x9a')][_0xa33d('0x3e')](_0x25448c[_0xa33d('0x9b')](),_0x4771aa)[_0xa33d('0x2c')](function(_0x4042eb){_0x19a07a=_[_0xa33d('0x9c')](_0x4042eb,'id');_0x4771aa=_[_0xa33d('0x9d')](_0x4771aa,{'model':db[_0xa33d('0x3a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x28f202['query'][_0xa33d('0x43')]){_0x2486ce[_0xa33d('0x42')][_0xa33d('0x6e')](function(_0x143eae){_0x488e18[_0xa33d('0x4b')]('i.'+_0x143eae);});}else{_0x488e18['field'](_0xa33d('0x90'),_0xa33d('0x62'));_0x488e18['field'](_0xa33d('0x9e'),_0xa33d('0x9f'));_0x488e18['field'](_0xa33d('0xa0'),'Account.mandatoryDisposition');_0x488e18[_0xa33d('0x4b')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0xa33d('0x91'));_0x488e18['field'](_0xa33d('0xa1'));_0x488e18[_0xa33d('0x4b')]('c.firstName',_0xa33d('0xa2'));_0x488e18[_0xa33d('0x4b')](_0xa33d('0xa3'),'Contact.lastName');_0x488e18[_0xa33d('0x4b')](_0xa33d('0xa4'),_0xa33d('0xa5'));_0x488e18[_0xa33d('0x4b')](_0xa33d('0xa6'),'Contact.phone');_0x488e18[_0xa33d('0x4b')](_0xa33d('0xa7'),_0xa33d('0xa8'));_0x488e18[_0xa33d('0x4b')](_0xa33d('0xa9'),_0xa33d('0xaa'));_0x488e18[_0xa33d('0x4b')](_0xa33d('0xab'),_0xa33d('0xac'));_0x488e18[_0xa33d('0x4b')](_0xa33d('0xad'),_0xa33d('0xae'));_0x488e18[_0xa33d('0x4b')](_0xa33d('0xaf'),_0xa33d('0x35'));}if(_0x2486ce[_0xa33d('0x26')])_0x488e18[_0xa33d('0x26')](_0x2486ce[_0xa33d('0x26')]);if(_0x2486ce[_0xa33d('0x24')])_0x488e18['offset'](_0x2486ce[_0xa33d('0x24')]);return db[_0xa33d('0x9a')]['query'](_0x488e18[_0xa33d('0x9b')](),_0x4771aa);})[_0xa33d('0x2c')](function(_0x13ec25){if(_0x13ec25['length']>0x0)_0x208c0c['where'](_0xa33d('0xb0'),_[_0xa33d('0x33')](_0x13ec25,'id'));return db['sequelize'][_0xa33d('0x3e')](_0x208c0c[_0xa33d('0x9b')](),_0x4771aa)[_0xa33d('0x2c')](function(_0x47f20c){var _0x191920=_[_0xa33d('0xb1')](_0x47f20c,_0xa33d('0xb2'));var _0x31875d=[];_0x13ec25['forEach'](function(_0x162f6d){_0x31875d[_0xa33d('0xb3')](updateFaxInteraction(_0x162f6d,_0x19a07a,_0x191920));});return BPromise['all'](_0x31875d);});});})[_0xa33d('0x2c')](function(_0x4304bb){_0xbaba97[_0xa33d('0xb4')]=_0x4304bb;return _0xbaba97;})[_0xa33d('0x2c')](respondWithFilteredResult(_0x46c171,_0x2486ce))[_0xa33d('0x38')](handleError(_0x46c171,null));};exports[_0xa33d('0xb5')]=function(_0x2a98f6,_0x378d03){var _0x4735bb={'raw':![],'where':{'id':_0x2a98f6['params']['id']}},_0x18ed9d={};_0x18ed9d[_0xa33d('0x41')]=_[_0xa33d('0x3f')](db[_0xa33d('0x3a')][_0xa33d('0x3b')]);_0x18ed9d[_0xa33d('0x3e')]=_[_0xa33d('0x3f')](_0x2a98f6[_0xa33d('0x3e')]);_0x18ed9d['filters']=_[_0xa33d('0x40')](_0x18ed9d[_0xa33d('0x41')],_0x18ed9d[_0xa33d('0x3e')]);_0x4735bb[_0xa33d('0x42')]=_[_0xa33d('0x40')](_0x18ed9d[_0xa33d('0x41')],qs['fields'](_0x2a98f6[_0xa33d('0x3e')][_0xa33d('0x43')]));_0x4735bb[_0xa33d('0x42')]=_0x4735bb[_0xa33d('0x42')]['length']?_0x4735bb['attributes']:_0x18ed9d[_0xa33d('0x41')];if(_0x2a98f6[_0xa33d('0x3e')][_0xa33d('0xb6')]){_0x4735bb[_0xa33d('0xb7')]=[{'all':!![]}];}_0x4735bb=_['merge']({},_0x4735bb,_0x2a98f6['options']);return db[_0xa33d('0x3a')][_0xa33d('0x61')](_0x4735bb)[_0xa33d('0x2c')](handleEntityNotFound(_0x378d03,null))[_0xa33d('0x2c')](respondWithResult(_0x378d03,null))['catch'](handleError(_0x378d03,null));};exports[_0xa33d('0xb8')]=function(_0x44444e,_0x440a9e){return db[_0xa33d('0x3a')][_0xa33d('0xb8')](_0x44444e[_0xa33d('0x75')],{})[_0xa33d('0x2c')](respondWithResult(_0x440a9e,0xc9))['catch'](handleError(_0x440a9e,null));};exports['update']=function(_0x47db1d,_0x1489f1){if(_0x47db1d[_0xa33d('0x75')]['id']){delete _0x47db1d[_0xa33d('0x75')]['id'];}return db[_0xa33d('0x3a')]['find']({'where':{'id':_0x47db1d[_0xa33d('0xb9')]['id']}})[_0xa33d('0x2c')](handleEntityNotFound(_0x1489f1,null))['then'](saveUpdates(_0x47db1d['body'],null))['then'](respondWithResult(_0x1489f1,null))[_0xa33d('0x38')](handleError(_0x1489f1,null));};exports[_0xa33d('0x2d')]=function(_0x1dc57e,_0x4ca96b){return db['FaxInteraction'][_0xa33d('0x61')]({'where':{'id':_0x1dc57e[_0xa33d('0xb9')]['id']}})[_0xa33d('0x2c')](handleEntityNotFound(_0x4ca96b,null))['then'](removeEntity(_0x4ca96b,null))[_0xa33d('0x38')](handleError(_0x4ca96b,null));};exports[_0xa33d('0xba')]=function(_0x550ab7,_0x1d5ad7){return db['FaxInteraction'][_0xa33d('0xba')]()[_0xa33d('0x2c')](respondWithResult(_0x1d5ad7,null))[_0xa33d('0x38')](handleError(_0x1d5ad7,null));};exports[_0xa33d('0xbb')]=function(_0x110040,_0x4d1312,_0x463fde){return db[_0xa33d('0xbc')]['find']({'where':{'id':_0x110040[_0xa33d('0xb9')]['id']}})[_0xa33d('0x2c')](handleEntityNotFound(_0x4d1312,null))[_0xa33d('0x2c')](function(_0x4aa514){if(_0x4aa514){return _0x4aa514['addMessage'](_0x110040['body']['ids'],_[_0xa33d('0xbd')](_0x110040['body'],[_0xa33d('0xbe'),'id'])||{});}})[_0xa33d('0x2c')](respondWithResult(_0x4d1312,null))[_0xa33d('0x38')](handleError(_0x4d1312,null));};exports['getMessages']=function(_0x308681,_0xbbd8d9,_0x1e5399){var _0x2c8603={'raw':![],'where':{}};var _0x2e36c0={};var _0x5200ef={'count':0x0,'rows':[]};return db[_0xa33d('0x3a')]['findOne']({'where':{'id':_0x308681['params']['id']}})[_0xa33d('0x2c')](handleEntityNotFound(_0xbbd8d9,null))[_0xa33d('0x2c')](function(_0x1e8713){if(_0x1e8713){_0x2e36c0['model']=_[_0xa33d('0x3f')](db['FaxMessage'][_0xa33d('0x3b')]);_0x2e36c0[_0xa33d('0x3e')]=_[_0xa33d('0x3f')](_0x308681[_0xa33d('0x3e')]);_0x2e36c0[_0xa33d('0x48')]=_['intersection'](_0x2e36c0[_0xa33d('0x41')],_0x2e36c0[_0xa33d('0x3e')]);_0x2c8603[_0xa33d('0x42')]=_[_0xa33d('0x40')](_0x2e36c0[_0xa33d('0x41')],qs[_0xa33d('0x43')](_0x308681['query'][_0xa33d('0x43')]));_0x2c8603[_0xa33d('0x42')]=_0x2c8603[_0xa33d('0x42')][_0xa33d('0x5f')]?_0x2c8603[_0xa33d('0x42')]:_0x2e36c0[_0xa33d('0x41')];if(!_0x308681[_0xa33d('0x3e')][_0xa33d('0x44')]('nolimit')){_0x2c8603[_0xa33d('0x26')]=qs[_0xa33d('0x26')](_0x308681[_0xa33d('0x3e')][_0xa33d('0x26')]);_0x2c8603[_0xa33d('0x24')]=qs[_0xa33d('0x24')](_0x308681[_0xa33d('0x3e')]['offset']);}_0x2c8603['order']=qs['sort'](_0x308681[_0xa33d('0x3e')][_0xa33d('0x47')]);_0x2c8603['where']=qs['filters'](_[_0xa33d('0x49')](_0x308681[_0xa33d('0x3e')],_0x2e36c0[_0xa33d('0x48')]));_0x2c8603['where']['FaxInteractionId']=_0x1e8713['id'];if(_0x308681[_0xa33d('0x3e')][_0xa33d('0x87')]){_0x2c8603['where']=_[_0xa33d('0x9d')](_0x2c8603['where'],{'$or':_[_0xa33d('0x33')](_0x2c8603['attributes'],function(_0x58dfed){var _0xc66ded={};_0xc66ded[_0x58dfed]={'$like':'%'+_0x308681[_0xa33d('0x3e')][_0xa33d('0x87')]+'%'};return _0xc66ded;})});}if(_0x308681[_0xa33d('0x3e')][_0xa33d('0x7d')]){var _0x3f5eb1=_0x308681[_0xa33d('0x3e')][_0xa33d('0x7d')][_0xa33d('0x37')](',');var _0x2e038d={};_0x2e038d[_0x3f5eb1[0x0]]={'$gte':moment(_0x3f5eb1[0x1])[_0xa33d('0xbf')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2c8603[_0xa33d('0x80')]=_['merge'](_0x2c8603[_0xa33d('0x80')],_0x2e038d);}_0x2c8603=_['merge']({},_0x2c8603,_0x308681['options']);return db[_0xa33d('0xbc')][_0xa33d('0x27')]({'where':_0x2c8603['where']})[_0xa33d('0x2c')](function(_0xfb6bfe){_0x5200ef[_0xa33d('0x27')]=_0xfb6bfe;if(_0x308681[_0xa33d('0x3e')][_0xa33d('0xb6')]){_0x2c8603[_0xa33d('0xb7')]=[{'all':!![]}];}return db[_0xa33d('0xbc')][_0xa33d('0xc0')](_0x2c8603);})[_0xa33d('0x2c')](function(_0x5ca8fa){_0x5200ef[_0xa33d('0xb4')]=_0x5ca8fa;return _0x5200ef;});}})[_0xa33d('0x2c')](respondWithFilteredResult(_0xbbd8d9,_0x2c8603))['catch'](handleError(_0xbbd8d9,null));};exports['addTags']=function(_0x26f895,_0x54752b,_0x4d2aaa){return db['FaxInteraction'][_0xa33d('0x61')]({'where':{'id':_0x26f895[_0xa33d('0xb9')]['id']}})[_0xa33d('0x2c')](handleEntityNotFound(_0x54752b,null))[_0xa33d('0x2c')](function(_0x189617){if(_0x189617){return _0x189617[_0xa33d('0xc1')](_0x26f895[_0xa33d('0x75')]['ids'],_[_0xa33d('0xbd')](_0x26f895[_0xa33d('0x75')],[_0xa33d('0xbe'),'id'])||{})[_0xa33d('0xc2')](function(){return db[_0xa33d('0x6d')][_0xa33d('0xc0')]({'attributes':['id',_0xa33d('0x30'),'color'],'where':{'id':_0x26f895[_0xa33d('0x75')][_0xa33d('0xbe')]}});})['then'](function(_0x243f8f){socket['emit'](_0xa33d('0xc3'),{'id':Number(_0x26f895[_0xa33d('0xb9')]['id']),'tags':_0x243f8f||[]});return{'id':Number(_0x26f895[_0xa33d('0xb9')]['id']),'tags':_0x243f8f||[]};});}})['then'](respondWithResult(_0x54752b,null))[_0xa33d('0x38')](handleError(_0x54752b,null));};exports[_0xa33d('0xc4')]=function(_0xdcd40c,_0x470455,_0x481de6){return db[_0xa33d('0x3a')][_0xa33d('0x61')]({'where':{'id':_0xdcd40c[_0xa33d('0xb9')]['id']}})[_0xa33d('0x2c')](handleEntityNotFound(_0x470455,null))[_0xa33d('0x2c')](function(_0x4dc167){if(_0x4dc167){return _0x4dc167[_0xa33d('0xc4')](_0xdcd40c['query'][_0xa33d('0xbe')]);}})[_0xa33d('0x2c')](respondWithStatusCode(_0x470455,null))[_0xa33d('0x38')](handleError(_0x470455,null));};exports['download']=function(_0x58c191,_0x3a0a78){var _0x40d18b=moment()[_0xa33d('0xc5')]()['toString']();var _0x5d17a6=path[_0xa33d('0xc6')](config[_0xa33d('0xc7')],_0xa33d('0xc8'),'files',_0xa33d('0xc9'));var _0x1efa0b=path['join'](config['root'],_0xa33d('0xc8'),_0xa33d('0xca'),'attachments');var _0x25c6fd=path[_0xa33d('0xc6')](_0x5d17a6,_0x40d18b);var _0x57e73c=util[_0xa33d('0xbf')](_0xa33d('0xcb'),_0x58c191[_0xa33d('0xb9')]['id'],_0x40d18b);var _0x518536=path['join'](_0x5d17a6,_0x57e73c);var _0x224bcc=[];_0x224bcc['push']({'model':db[_0xa33d('0xcc')],'as':_0xa33d('0xcc'),'raw':!![]});var _0x5612c7=[{'model':db['FaxMessage'],'as':'Messages','attributes':['id','body',_0xa33d('0x7b')],'include':_0x224bcc}];return db['FaxInteraction'][_0xa33d('0x61')]({'where':{'id':_0x58c191[_0xa33d('0xb9')]['id']},'include':_0x5612c7})[_0xa33d('0x2c')](handleEntityNotFound(_0x3a0a78,null))['then'](function(_0x338c33){if(_0x338c33&&_0x338c33[_0xa33d('0xcd')]){var _0xae653c=_0x338c33['get']({'plain':!![]});fs[_0xa33d('0xce')](_0x25c6fd);for(var _0x2d7bb5=0x0;_0x2d7bb5<_0xae653c[_0xa33d('0xcd')][_0xa33d('0x5f')];_0x2d7bb5++){var _0xcf0e9f=_0xae653c['Messages'][_0x2d7bb5][_0xa33d('0xcc')];if(_0xcf0e9f){var _0x2dcba1=path[_0xa33d('0xc6')](_0x1efa0b,_0xcf0e9f[_0xa33d('0xcf')]);if(fs[_0xa33d('0xd0')](_0x2dcba1)){fs[_0xa33d('0xd1')](_0x2dcba1)[_0xa33d('0xd2')](fs[_0xa33d('0xd3')](path[_0xa33d('0xc6')](_0x25c6fd,_0xcf0e9f[_0xa33d('0xcf')])));}}}return BPromise[_0xa33d('0x93')]()[_0xa33d('0x2c')](function(){return new BPromise(function(_0x3fb677,_0x5b27e3){zipdir(_0x25c6fd,{'saveTo':_0x518536},function(_0x161a66,_0x3296f1){if(_0x161a66)return _0x5b27e3(_0x161a66);return _0x3fb677(_0x3296f1);});})[_0xa33d('0x2c')](function(){return new BPromise(function(_0x5464b6,_0x4e5a3c){rimraf(_0x25c6fd,function(_0x4ea167){if(_0x4ea167)_0x4e5a3c(_0x4ea167);return _0x5464b6();});});})[_0xa33d('0x2c')](function(){return _0x3a0a78[_0xa33d('0xd4')](_0x518536,_0x57e73c,function(_0x5261f8){if(_0x5261f8){console['log'](_0xa33d('0xd5'),_0x5261f8);}else{fs['unlinkSync'](_0x518536);}});});});}else{return _0x3a0a78[_0xa33d('0x2e')](0xc8);}})[_0xa33d('0x38')](handleError(_0x3a0a78,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index ff23da1..f857b12 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 _0x8500=['save','update','remove','getUsers','then','map','findAll','setDataValue','unreadMessages','length','catch','hasOwnProperty','hook','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8500,0xaf));var _0x0850=function(_0x8ee634,_0x4ec6dc){_0x8ee634=_0x8ee634-0x0;var _0x5597bd=_0x8500[_0x8ee634];return _0x5597bd;};'use strict';var EventEmitter=require(_0x0850('0x0'));var FaxInteraction=require(_0x0850('0x1'))['db'][_0x0850('0x2')];var FaxMessage=require(_0x0850('0x1'))['db'][_0x0850('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x0850('0x4')](0x0);var events={'afterCreate':_0x0850('0x5'),'afterUpdate':_0x0850('0x6'),'afterDestroy':_0x0850('0x7')};function emitEvent(_0x508773){return function(_0x238ded,_0x2dab51,_0x266896){_0x238ded[_0x0850('0x8')]({'attributes':['id'],'raw':!![]})[_0x0850('0x9')](function(_0x469685){_0x238ded['setDataValue']('Users',_0x469685[_0x0850('0xa')](function(_0x599ae1){return{'id':_0x599ae1['id']};}));return FaxMessage[_0x0850('0xb')]({'where':{'FaxInteractionId':_0x238ded['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0850('0x9')](function(_0x30c8d6){_0x238ded[_0x0850('0xc')](_0x0850('0xd'),_0x30c8d6[_0x0850('0xe')]);FaxInteractionEvents['emit'](_0x508773+':'+_0x238ded['id'],_0x238ded);FaxInteractionEvents['emit'](_0x508773,_0x238ded);_0x266896(null);})[_0x0850('0xf')](_0x266896(null));};}for(var e in events){if(events[_0x0850('0x10')](e)){var event=events[e];FaxInteraction[_0x0850('0x11')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file +var _0x1519=['remove','then','setDataValue','map','findAll','unreadMessages','length','emit','catch','hook','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update'];(function(_0x1756f3,_0x60f2ce){var _0x2795f1=function(_0x1dbd52){while(--_0x1dbd52){_0x1756f3['push'](_0x1756f3['shift']());}};_0x2795f1(++_0x60f2ce);}(_0x1519,0x1a9));var _0x9151=function(_0x145e04,_0x82a7b3){_0x145e04=_0x145e04-0x0;var _0x531f0d=_0x1519[_0x145e04];return _0x531f0d;};'use strict';var EventEmitter=require(_0x9151('0x0'));var FaxInteraction=require(_0x9151('0x1'))['db'][_0x9151('0x2')];var FaxMessage=require(_0x9151('0x1'))['db'][_0x9151('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x9151('0x4')](0x0);var events={'afterCreate':_0x9151('0x5'),'afterUpdate':_0x9151('0x6'),'afterDestroy':_0x9151('0x7')};function emitEvent(_0x3016cf){return function(_0x5400dd,_0x128a9e,_0x373dc0){_0x5400dd['getUsers']({'attributes':['id'],'raw':!![]})[_0x9151('0x8')](function(_0x154efe){_0x5400dd[_0x9151('0x9')]('Users',_0x154efe[_0x9151('0xa')](function(_0x19cc40){return{'id':_0x19cc40['id']};}));return FaxMessage[_0x9151('0xb')]({'where':{'FaxInteractionId':_0x5400dd['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x46196c){_0x5400dd[_0x9151('0x9')](_0x9151('0xc'),_0x46196c[_0x9151('0xd')]);FaxInteractionEvents['emit'](_0x3016cf+':'+_0x5400dd['id'],_0x5400dd);FaxInteractionEvents[_0x9151('0xe')](_0x3016cf,_0x5400dd);_0x373dc0(null);})[_0x9151('0xf')](_0x373dc0(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0x9151('0x10')](e,emitEvent(event));}}module[_0x9151('0x11')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index e28a900..65c843c 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 _0xf188=['define','FaxInteraction','fax_interactions','closed','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','request-promise','path','../../config/environment','exports'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xf188,0xfd));var _0x8f18=function(_0x2a6bda,_0x20c031){_0x2a6bda=_0x2a6bda-0x0;var _0x29ede1=_0xf188[_0x2a6bda];return _0x29ede1;};'use strict';var _=require('lodash');var util=require(_0x8f18('0x0'));var logger=require(_0x8f18('0x1'))(_0x8f18('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8f18('0x3'));var fs=require('fs');var path=require(_0x8f18('0x4'));var rimraf=require('rimraf');var config=require(_0x8f18('0x5'));var attributes=require('./faxInteraction.attributes');module[_0x8f18('0x6')]=function(_0x1f70a3,_0x243b21){return _0x1f70a3[_0x8f18('0x7')](_0x8f18('0x8'),attributes,{'tableName':_0x8f18('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1dca1c,_0x14b643,_0x1a9046){if(_0x1dca1c['changed'](_0x8f18('0xa'))){_0x1dca1c['closedAt']=moment()[_0x8f18('0xb')](_0x8f18('0xc'));}_0x1a9046(null,_0x1dca1c);}}});}; \ No newline at end of file +var _0x897e=['fax_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define'];(function(_0x20f32e,_0x17dc84){var _0x395bf9=function(_0x54a448){while(--_0x54a448){_0x20f32e['push'](_0x20f32e['shift']());}};_0x395bf9(++_0x17dc84);}(_0x897e,0x1d6));var _0xe897=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x897e[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xe897('0x0'));var util=require('util');var logger=require(_0xe897('0x1'))('api');var moment=require(_0xe897('0x2'));var BPromise=require(_0xe897('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe897('0x4'));var rimraf=require(_0xe897('0x5'));var config=require(_0xe897('0x6'));var attributes=require(_0xe897('0x7'));module[_0xe897('0x8')]=function(_0x415d0f,_0x3c769b){return _0x415d0f[_0xe897('0x9')]('FaxInteraction',attributes,{'tableName':_0xe897('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x401848,_0x33add6,_0x303190){if(_0x401848[_0xe897('0xb')](_0xe897('0xc'))){_0x401848[_0xe897('0xd')]=moment()[_0xe897('0xe')](_0xe897('0xf'));}_0x303190(null,_0x401848);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index dc3f5aa..1117a13 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 _0xbccc=['AddTagsToFaxInteraction','FaxInteraction','find','addTags','ids','omit','AddTags','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./faxInteraction.socket','register','then','FaxInteraction,\x20%s,\x20%s','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxInteraction','update','body','options','raw','where','attributes','limit','info','debug'];(function(_0xd76a0b,_0x38e96c){var _0x903c4f=function(_0x288774){while(--_0x288774){_0xd76a0b['push'](_0xd76a0b['shift']());}};_0x903c4f(++_0x38e96c);}(_0xbccc,0xd9));var _0xcbcc=function(_0x59c560,_0x4b421f){_0x59c560=_0x59c560-0x0;var _0x37c3c4=_0xbccc[_0x59c560];return _0x37c3c4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xcbcc('0x0'));var BPromise=require(_0xcbcc('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcbcc('0x2'));var db=require(_0xcbcc('0x3'))['db'];var utils=require(_0xcbcc('0x4'));var logger=require(_0xcbcc('0x5'))(_0xcbcc('0x6'));var config=require(_0xcbcc('0x7'));var jayson=require(_0xcbcc('0x8'));var client=jayson[_0xcbcc('0x9')]['http']({'port':0x232a});config[_0xcbcc('0xa')]=_[_0xcbcc('0xb')](config[_0xcbcc('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xcbcc('0xc'))(new Redis(config[_0xcbcc('0xa')]));require(_0xcbcc('0xd'))[_0xcbcc('0xe')](socket);function respondWithRpcPromise(_0x49046e,_0x3dbc39,_0x46c06e){return new BPromise(function(_0x4b06fa,_0x575606){return client['request'](_0x49046e,_0x46c06e)[_0xcbcc('0xf')](function(_0x20281a){logger['info'](_0xcbcc('0x10'),_0x3dbc39,_0xcbcc('0x11'));logger['debug'](_0xcbcc('0x12'),_0x3dbc39,_0xcbcc('0x11'),JSON[_0xcbcc('0x13')](_0x20281a));if(_0x20281a[_0xcbcc('0x14')]){if(_0x20281a['error'][_0xcbcc('0x15')]===0x1f4){logger['error'](_0xcbcc('0x10'),_0x3dbc39,_0x20281a[_0xcbcc('0x14')][_0xcbcc('0x16')]);return _0x575606(_0x20281a['error']['message']);}logger[_0xcbcc('0x14')](_0xcbcc('0x10'),_0x3dbc39,_0x20281a['error'][_0xcbcc('0x16')]);return _0x4b06fa(_0x20281a[_0xcbcc('0x14')][_0xcbcc('0x16')]);}else{logger['info'](_0xcbcc('0x10'),_0x3dbc39,'request\x20sent');_0x4b06fa(_0x20281a[_0xcbcc('0x17')][_0xcbcc('0x16')]);}})[_0xcbcc('0x18')](function(_0xa33419){logger[_0xcbcc('0x14')](_0xcbcc('0x10'),_0x3dbc39,_0xa33419);_0x575606(_0xa33419);});});}exports[_0xcbcc('0x19')]=function(_0x4e3de4){var _0x44b65f=this;return new Promise(function(_0x300693,_0x1ad60a){return db['FaxInteraction'][_0xcbcc('0x1a')](_0x4e3de4[_0xcbcc('0x1b')],{'raw':_0x4e3de4[_0xcbcc('0x1c')]?_0x4e3de4['options'][_0xcbcc('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e3de4[_0xcbcc('0x1c')]?_0x4e3de4[_0xcbcc('0x1c')][_0xcbcc('0x1e')]||null:null,'attributes':_0x4e3de4[_0xcbcc('0x1c')]?_0x4e3de4[_0xcbcc('0x1c')][_0xcbcc('0x1f')]||null:null,'limit':_0x4e3de4[_0xcbcc('0x1c')]?_0x4e3de4[_0xcbcc('0x1c')][_0xcbcc('0x20')]||null:null})[_0xcbcc('0xf')](function(_0x2d59b6){logger[_0xcbcc('0x21')](_0xcbcc('0x19'),_0x4e3de4);logger[_0xcbcc('0x22')]('UpdateFaxInteraction',_0x4e3de4,JSON[_0xcbcc('0x13')](_0x2d59b6));_0x300693(_0x2d59b6);})[_0xcbcc('0x18')](function(_0x4804a7){logger[_0xcbcc('0x14')](_0xcbcc('0x19'),_0x4804a7[_0xcbcc('0x16')],_0x4e3de4);_0x1ad60a(_0x44b65f['error'](0x1f4,_0x4804a7['message']));});});};exports[_0xcbcc('0x23')]=function(_0x27cb35){return new Promise(function(_0x2ef4be,_0x42ce4e){return db[_0xcbcc('0x24')][_0xcbcc('0x25')]({'where':_0x27cb35['options']?_0x27cb35[_0xcbcc('0x1c')][_0xcbcc('0x1e')]||null:null})['then'](function(_0x57b648){if(_0x57b648){return _0x57b648[_0xcbcc('0x26')](_0x27cb35[_0xcbcc('0x1b')][_0xcbcc('0x27')],_[_0xcbcc('0x28')](_0x27cb35[_0xcbcc('0x1b')],[_0xcbcc('0x27'),'id'])||{});}})['spread'](function(_0x142c13){logger[_0xcbcc('0x21')]('AddTags',_0x27cb35);logger['debug']('AddTags',_0x27cb35,JSON[_0xcbcc('0x13')](_0x142c13));_0x2ef4be(_0x142c13);})[_0xcbcc('0x18')](function(_0x1cb66e){logger[_0xcbcc('0x14')](_0xcbcc('0x29'),_0x1cb66e['message'],_0x27cb35);_0x42ce4e(_this[_0xcbcc('0x14')](0x1f4,_0x1cb66e[_0xcbcc('0x16')]));});});}; \ No newline at end of file +var _0x4cd0=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','request','then','info','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxInteraction,\x20%s,\x20%s','message','result','UpdateFaxInteraction','update','body','options','raw','where','attributes','limit','AddTagsToFaxInteraction','FaxInteraction','find','addTags','omit','AddTags','catch','util','moment','randomstring'];(function(_0x5954d2,_0x15db93){var _0x316928=function(_0x278bd3){while(--_0x278bd3){_0x5954d2['push'](_0x5954d2['shift']());}};_0x316928(++_0x15db93);}(_0x4cd0,0x11c));var _0x04cd=function(_0x8f7850,_0x235a05){_0x8f7850=_0x8f7850-0x0;var _0x2c5bc9=_0x4cd0[_0x8f7850];return _0x2c5bc9;};'use strict';var _=require('lodash');var util=require(_0x04cd('0x0'));var moment=require(_0x04cd('0x1'));var BPromise=require('bluebird');var rs=require(_0x04cd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x04cd('0x3'));var logger=require(_0x04cd('0x4'))(_0x04cd('0x5'));var config=require('../../config/environment');var jayson=require(_0x04cd('0x6'));var client=jayson[_0x04cd('0x7')][_0x04cd('0x8')]({'port':0x232a});config['redis']=_[_0x04cd('0x9')](config[_0x04cd('0xa')],{'host':_0x04cd('0xb'),'port':0x18eb});var socket=require(_0x04cd('0xc'))(new Redis(config[_0x04cd('0xa')]));require(_0x04cd('0xd'))['register'](socket);function respondWithRpcPromise(_0x48b6b,_0x34e326,_0x1803cc){return new BPromise(function(_0x1c70a8,_0x5c83d1){return client[_0x04cd('0xe')](_0x48b6b,_0x1803cc)[_0x04cd('0xf')](function(_0x7376d0){logger[_0x04cd('0x10')]('FaxInteraction,\x20%s,\x20%s',_0x34e326,_0x04cd('0x11'));logger[_0x04cd('0x12')](_0x04cd('0x13'),_0x34e326,_0x04cd('0x11'),JSON[_0x04cd('0x14')](_0x7376d0));if(_0x7376d0['error']){if(_0x7376d0[_0x04cd('0x15')][_0x04cd('0x16')]===0x1f4){logger[_0x04cd('0x15')](_0x04cd('0x17'),_0x34e326,_0x7376d0[_0x04cd('0x15')][_0x04cd('0x18')]);return _0x5c83d1(_0x7376d0[_0x04cd('0x15')]['message']);}logger[_0x04cd('0x15')](_0x04cd('0x17'),_0x34e326,_0x7376d0[_0x04cd('0x15')][_0x04cd('0x18')]);return _0x1c70a8(_0x7376d0[_0x04cd('0x15')][_0x04cd('0x18')]);}else{logger[_0x04cd('0x10')](_0x04cd('0x17'),_0x34e326,'request\x20sent');_0x1c70a8(_0x7376d0[_0x04cd('0x19')]['message']);}})['catch'](function(_0x321df1){logger[_0x04cd('0x15')](_0x04cd('0x17'),_0x34e326,_0x321df1);_0x5c83d1(_0x321df1);});});}exports[_0x04cd('0x1a')]=function(_0x4949da){var _0xb8fe84=this;return new Promise(function(_0x1854b4,_0x38357c){return db['FaxInteraction'][_0x04cd('0x1b')](_0x4949da[_0x04cd('0x1c')],{'raw':_0x4949da[_0x04cd('0x1d')]?_0x4949da[_0x04cd('0x1d')][_0x04cd('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4949da['options']?_0x4949da['options'][_0x04cd('0x1f')]||null:null,'attributes':_0x4949da[_0x04cd('0x1d')]?_0x4949da[_0x04cd('0x1d')][_0x04cd('0x20')]||null:null,'limit':_0x4949da[_0x04cd('0x1d')]?_0x4949da[_0x04cd('0x1d')][_0x04cd('0x21')]||null:null})[_0x04cd('0xf')](function(_0xcc99c8){logger[_0x04cd('0x10')](_0x04cd('0x1a'),_0x4949da);logger[_0x04cd('0x12')](_0x04cd('0x1a'),_0x4949da,JSON[_0x04cd('0x14')](_0xcc99c8));_0x1854b4(_0xcc99c8);})['catch'](function(_0x4cdf53){logger[_0x04cd('0x15')](_0x04cd('0x1a'),_0x4cdf53['message'],_0x4949da);_0x38357c(_0xb8fe84['error'](0x1f4,_0x4cdf53['message']));});});};exports[_0x04cd('0x22')]=function(_0x4e2566){return new Promise(function(_0x55d944,_0x44bc73){return db[_0x04cd('0x23')][_0x04cd('0x24')]({'where':_0x4e2566['options']?_0x4e2566['options'][_0x04cd('0x1f')]||null:null})[_0x04cd('0xf')](function(_0x5ade72){if(_0x5ade72){return _0x5ade72[_0x04cd('0x25')](_0x4e2566['body']['ids'],_[_0x04cd('0x26')](_0x4e2566[_0x04cd('0x1c')],['ids','id'])||{});}})['spread'](function(_0x11c3d6){logger[_0x04cd('0x10')]('AddTags',_0x4e2566);logger[_0x04cd('0x12')](_0x04cd('0x27'),_0x4e2566,JSON[_0x04cd('0x14')](_0x11c3d6));_0x55d944(_0x11c3d6);})[_0x04cd('0x28')](function(_0x458813){logger[_0x04cd('0x15')]('AddTags',_0x458813[_0x04cd('0x18')],_0x4e2566);_0x44bc73(_this[_0x04cd('0x15')](0x1f4,_0x458813['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index d034ae1..626ba09 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 _0x6a14=['register','length','save','remove','update','emit','removeListener'];(function(_0x2bbda1,_0x2e8080){var _0x565b0f=function(_0x49b78a){while(--_0x49b78a){_0x2bbda1['push'](_0x2bbda1['shift']());}};_0x565b0f(++_0x2e8080);}(_0x6a14,0x10c));var _0x46a1=function(_0x2937ba,_0x184659){_0x2937ba=_0x2937ba-0x0;var _0x3db49f=_0x6a14[_0x2937ba];return _0x3db49f;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0x46a1('0x0'),_0x46a1('0x1'),_0x46a1('0x2')];function createListener(_0x1aa3aa,_0x249720){return function(_0x20d46a){_0x249720[_0x46a1('0x3')](_0x1aa3aa,_0x20d46a);};}function removeListener(_0x2c2395,_0x7b8e88){return function(){FaxInteractionEvents[_0x46a1('0x4')](_0x2c2395,_0x7b8e88);};}exports[_0x46a1('0x5')]=function(_0x32b231){for(var _0x9f6427=0x0,_0x118207=events[_0x46a1('0x6')];_0x9f6427<_0x118207;_0x9f6427++){var _0x123c94=events[_0x9f6427];var _0x1dc8c2=createListener('faxInteraction:'+_0x123c94,_0x32b231);FaxInteractionEvents['on'](_0x123c94,_0x1dc8c2);}}; \ No newline at end of file +var _0x107f=['emit','register','faxInteraction:','./faxInteraction.events','save','remove'];(function(_0xa8fe9d,_0x147a47){var _0x595f32=function(_0x150343){while(--_0x150343){_0xa8fe9d['push'](_0xa8fe9d['shift']());}};_0x595f32(++_0x147a47);}(_0x107f,0x1bf));var _0xf107=function(_0x3a6642,_0x217c49){_0x3a6642=_0x3a6642-0x0;var _0x2a4f0c=_0x107f[_0x3a6642];return _0x2a4f0c;};'use strict';var FaxInteractionEvents=require(_0xf107('0x0'));var events=[_0xf107('0x1'),_0xf107('0x2'),'update'];function createListener(_0x2611a0,_0x160b1f){return function(_0xcb7fe9){_0x160b1f[_0xf107('0x3')](_0x2611a0,_0xcb7fe9);};}function removeListener(_0x2b476d,_0x1c21eb){return function(){FaxInteractionEvents['removeListener'](_0x2b476d,_0x1c21eb);};}exports[_0xf107('0x4')]=function(_0x41c82a){for(var _0x13a3f1=0x0,_0x4e1843=events['length'];_0x13a3f1<_0x4e1843;_0x13a3f1++){var _0x4a9b00=events[_0x13a3f1];var _0x29387d=createListener(_0xf107('0x5')+_0x4a9b00,_0x41c82a);FaxInteractionEvents['on'](_0x4a9b00,_0x29387d);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index dad9abb..1b4dc17 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 _0x5c44=['fax','addTags','put','tracked','faxinteraction:update','update','faxinteraction:destroy','delete','/:id/tags','removeTags','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./faxInteraction.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage'];(function(_0x486244,_0x5b52ec){var _0x1d1ae8=function(_0x374d14){while(--_0x374d14){_0x486244['push'](_0x486244['shift']());}};_0x1d1ae8(++_0x5b52ec);}(_0x5c44,0x10b));var _0x45c4=function(_0x6ab3bb,_0x1e2f91){_0x6ab3bb=_0x6ab3bb-0x0;var _0x14c807=_0x5c44[_0x6ab3bb];return _0x14c807;};'use strict';var multer=require('multer');var util=require(_0x45c4('0x0'));var path=require(_0x45c4('0x1'));var timeout=require(_0x45c4('0x2'));var express=require(_0x45c4('0x3'));var router=express[_0x45c4('0x4')]();var fs_extra=require(_0x45c4('0x5'));var auth=require(_0x45c4('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x45c4('0x7'));router[_0x45c4('0x8')]('/',auth[_0x45c4('0x9')](),controller[_0x45c4('0xa')]);router[_0x45c4('0x8')](_0x45c4('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x45c4('0xc'),auth[_0x45c4('0x9')](),controller[_0x45c4('0xd')]);router['get'](_0x45c4('0xe'),auth['isAuthenticated'](),controller[_0x45c4('0xf')]);router[_0x45c4('0x8')](_0x45c4('0x10'),auth[_0x45c4('0x9')](),controller[_0x45c4('0x11')]);router[_0x45c4('0x12')]('/',auth[_0x45c4('0x9')](),controller[_0x45c4('0x13')]);router[_0x45c4('0x12')]('/:id/messages',auth[_0x45c4('0x9')](),controller[_0x45c4('0x14')]);router[_0x45c4('0x12')]('/:id/tags',auth[_0x45c4('0x9')](),interaction['tracked'](_0x45c4('0x15'),'faxinteraction:addtags'),controller[_0x45c4('0x16')]);router[_0x45c4('0x17')](_0x45c4('0xc'),auth[_0x45c4('0x9')](),interaction[_0x45c4('0x18')](_0x45c4('0x15'),_0x45c4('0x19')),controller[_0x45c4('0x1a')]);router['delete'](_0x45c4('0xc'),auth[_0x45c4('0x9')](),interaction[_0x45c4('0x18')](_0x45c4('0x15'),_0x45c4('0x1b')),controller['destroy']);router[_0x45c4('0x1c')](_0x45c4('0x1d'),auth['isAuthenticated'](),controller[_0x45c4('0x1e')]);module[_0x45c4('0x1f')]=router; \ No newline at end of file +var _0xd1d6=['/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','faxinteraction:addtags','addTags','put','tracked','fax','faxinteraction:update','update','faxinteraction:destroy','destroy','/:id/tags','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated'];(function(_0x1b04ec,_0x1df13d){var _0xae7265=function(_0x290d83){while(--_0x290d83){_0x1b04ec['push'](_0x1b04ec['shift']());}};_0xae7265(++_0x1df13d);}(_0xd1d6,0x1c7));var _0x6d1d=function(_0x421826,_0x447ef2){_0x421826=_0x421826-0x0;var _0x584192=_0xd1d6[_0x421826];return _0x584192;};'use strict';var multer=require('multer');var util=require(_0x6d1d('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6d1d('0x1'));var router=express[_0x6d1d('0x2')]();var fs_extra=require(_0x6d1d('0x3'));var auth=require(_0x6d1d('0x4'));var interaction=require(_0x6d1d('0x5'));var config=require(_0x6d1d('0x6'));var controller=require(_0x6d1d('0x7'));router[_0x6d1d('0x8')]('/',auth[_0x6d1d('0x9')](),controller['index']);router[_0x6d1d('0x8')](_0x6d1d('0xa'),auth[_0x6d1d('0x9')](),controller[_0x6d1d('0xb')]);router[_0x6d1d('0x8')](_0x6d1d('0xc'),auth[_0x6d1d('0x9')](),controller[_0x6d1d('0xd')]);router['get'](_0x6d1d('0xe'),auth[_0x6d1d('0x9')](),controller[_0x6d1d('0xf')]);router[_0x6d1d('0x8')](_0x6d1d('0x10'),auth[_0x6d1d('0x9')](),controller[_0x6d1d('0x11')]);router['post']('/',auth[_0x6d1d('0x9')](),controller[_0x6d1d('0x12')]);router['post'](_0x6d1d('0xe'),auth[_0x6d1d('0x9')](),controller['addMessage']);router[_0x6d1d('0x13')]('/:id/tags',auth[_0x6d1d('0x9')](),interaction['tracked']('fax',_0x6d1d('0x14')),controller[_0x6d1d('0x15')]);router[_0x6d1d('0x16')](_0x6d1d('0xc'),auth['isAuthenticated'](),interaction[_0x6d1d('0x17')](_0x6d1d('0x18'),_0x6d1d('0x19')),controller[_0x6d1d('0x1a')]);router['delete'](_0x6d1d('0xc'),auth[_0x6d1d('0x9')](),interaction[_0x6d1d('0x17')](_0x6d1d('0x18'),_0x6d1d('0x1b')),controller[_0x6d1d('0x1c')]);router['delete'](_0x6d1d('0x1d'),auth[_0x6d1d('0x9')](),controller['removeTags']);module[_0x6d1d('0x1e')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 369b7c4..2e6ab21 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 _0x3fc6=['out','DATE','sequelize','exports','TEXT','BOOLEAN','ENUM'];(function(_0x4ab9a7,_0x291df1){var _0xd08799=function(_0x32bd6a){while(--_0x32bd6a){_0x4ab9a7['push'](_0x4ab9a7['shift']());}};_0xd08799(++_0x291df1);}(_0x3fc6,0x159));var _0x63fc=function(_0x138f22,_0xe5ce8c){_0x138f22=_0x138f22-0x0;var _0x44b0fa=_0x3fc6[_0x138f22];return _0x44b0fa;};'use strict';var Sequelize=require(_0x63fc('0x0'));module[_0x63fc('0x1')]={'body':{'type':Sequelize[_0x63fc('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x63fc('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x63fc('0x4')]('in',_0x63fc('0x5')),'defaultValue':_0x63fc('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x63fc('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x63fc('0x6')]}}; \ No newline at end of file +var _0xd6d6=['DATE','sequelize','exports','TEXT','medium','ENUM','out'];(function(_0x18ae6d,_0x255d00){var _0x3deb94=function(_0x44b04c){while(--_0x44b04c){_0x18ae6d['push'](_0x18ae6d['shift']());}};_0x3deb94(++_0x255d00);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x5aae69,_0x67da18){_0x5aae69=_0x5aae69-0x0;var _0x254f5c=_0xd6d6[_0x5aae69];return _0x254f5c;};'use strict';var Sequelize=require(_0x6d6d('0x0'));module[_0x6d6d('0x1')]={'body':{'type':Sequelize[_0x6d6d('0x2')](_0x6d6d('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x6d6d('0x4')]('in',_0x6d6d('0x5')),'defaultValue':_0x6d6d('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x6d6d('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x6d6d('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 26998d5..1b33f46 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 _0x3648=['filter','merge','VIRTUAL','FaxMessage','includeAll','include','findAll','rows','show','params','find','body','destroy','describe','fax-interactions','accept','fax','read','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','FaxInteraction','isNil','read1stAt','format','interaction','role','null','AcceptMessage','acceptMessage','ContactId','SELECT','contact','SIP/%s','channel','event','EventManager','acceptmessage','get','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','fullname','email','internal','interface','motionChannel','rejectmessage','CmContact','findOne','Attachment','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','join','root','server','attachments','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','end','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','where'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x3648,0xd0));var _0x8364=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3648[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x8364('0x0'));var rimraf=require(_0x8364('0x1'));var zipdir=require(_0x8364('0x2'));var jsonpatch=require(_0x8364('0x3'));var rp=require(_0x8364('0x4'));var moment=require(_0x8364('0x5'));var BPromise=require(_0x8364('0x6'));var Mustache=require(_0x8364('0x7'));var util=require('util');var path=require(_0x8364('0x8'));var sox=require(_0x8364('0x9'));var csv=require(_0x8364('0xa'));var ejs=require(_0x8364('0xb'));var fs=require('fs');var fs_extra=require(_0x8364('0xc'));var _=require(_0x8364('0xd'));var squel=require(_0x8364('0xe'));var crypto=require('crypto');var jsforce=require(_0x8364('0xf'));var deskjs=require(_0x8364('0x10'));var toCsv=require(_0x8364('0xa'));var querystring=require(_0x8364('0x11'));var Papa=require(_0x8364('0x12'));var Redis=require(_0x8364('0x13'));var authService=require(_0x8364('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x8364('0x15'));var hardwareService=require(_0x8364('0x16'));var logger=require(_0x8364('0x17'))(_0x8364('0x18'));var utils=require(_0x8364('0x19'));var config=require(_0x8364('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x8364('0x1b'))['db'];config[_0x8364('0x1c')]=_[_0x8364('0x1d')](config[_0x8364('0x1c')],{'host':_0x8364('0x1e'),'port':0x18eb});var socket=require(_0x8364('0x1f'))(new Redis(config[_0x8364('0x1c')]));require(_0x8364('0x20'))[_0x8364('0x21')](socket);var jayson=require(_0x8364('0x22'));var client=jayson[_0x8364('0x23')][_0x8364('0x24')]({'port':0x232c});var client9002=jayson[_0x8364('0x23')][_0x8364('0x24')]({'port':0x232a});function respondWithRpcPromise(_0xc92af,_0x43c271,_0x1f362c,_0x28d36f){return new BPromise(function(_0x2b6667,_0x5c0d4a){var _0x3c277d=_0x28d36f||client;return _0x3c277d['request'](_0xc92af,_0x1f362c)[_0x8364('0x25')](function(_0x738fba){logger[_0x8364('0x26')](_0x8364('0x27'),_0x43c271,_0x8364('0x28'));logger[_0x8364('0x29')](_0x8364('0x2a'),_0x43c271,_0x8364('0x28'),JSON[_0x8364('0x2b')](_0x738fba));if(_0x738fba[_0x8364('0x2c')]){if(_0x738fba[_0x8364('0x2c')][_0x8364('0x2d')]===0x1f4){logger['error'](_0x8364('0x27'),_0x43c271,_0x738fba[_0x8364('0x2c')][_0x8364('0x2e')]);return _0x5c0d4a(_0x738fba['error'][_0x8364('0x2e')]);}logger['error'](_0x8364('0x27'),_0x43c271,_0x738fba[_0x8364('0x2c')][_0x8364('0x2e')]);return _0x2b6667(_0x738fba[_0x8364('0x2c')][_0x8364('0x2e')]);}else{logger[_0x8364('0x26')](_0x8364('0x27'),_0x43c271,_0x8364('0x28'));_0x2b6667(_0x738fba[_0x8364('0x2f')][_0x8364('0x2e')]);}})[_0x8364('0x30')](function(_0x551241){logger['error'](_0x8364('0x27'),_0x43c271,_0x551241);_0x5c0d4a(_0x551241);});});}function respondWithStatusCode(_0xd52b91,_0xb8ccc8){_0xb8ccc8=_0xb8ccc8||0xcc;return function(_0x11289e){if(_0x11289e){return _0xd52b91[_0x8364('0x31')](_0xb8ccc8);}return _0xd52b91[_0x8364('0x32')](_0xb8ccc8)['end']();};}function respondWithResult(_0x9b1ff3,_0x3f07cb){_0x3f07cb=_0x3f07cb||0xc8;return function(_0xf28ee0){if(_0xf28ee0){return _0x9b1ff3['status'](_0x3f07cb)[_0x8364('0x33')](_0xf28ee0);}};}function respondWithFilteredResult(_0x266824,_0x267287){return function(_0x1f73bb){if(_0x1f73bb){var _0x3db7be=typeof _0x267287[_0x8364('0x34')]===_0x8364('0x35')&&typeof _0x267287[_0x8364('0x36')]==='undefined';var _0x2e1689=_0x1f73bb['count'];var _0x5a60bc=_0x3db7be?0x0:_0x267287[_0x8364('0x34')];var _0x43d01d=_0x3db7be?_0x1f73bb[_0x8364('0x37')]:_0x267287[_0x8364('0x34')]+_0x267287[_0x8364('0x36')];var _0x117a13;if(_0x43d01d>=_0x2e1689){_0x43d01d=_0x2e1689;_0x117a13=0xc8;}else{_0x117a13=0xce;}_0x266824[_0x8364('0x32')](_0x117a13);return _0x266824[_0x8364('0x38')](_0x8364('0x39'),_0x5a60bc+'-'+_0x43d01d+'/'+_0x2e1689)[_0x8364('0x33')](_0x1f73bb);}return null;};}function patchUpdates(_0x188809){return function(_0xdbb152){try{jsonpatch[_0x8364('0x3a')](_0xdbb152,_0x188809,!![]);}catch(_0x53ff60){return BPromise[_0x8364('0x3b')](_0x53ff60);}return _0xdbb152[_0x8364('0x3c')]();};}function saveUpdates(_0x3530ca,_0x22c5ae){return function(_0x22eed8){if(_0x22eed8){return _0x22eed8[_0x8364('0x3d')](_0x3530ca)[_0x8364('0x25')](function(_0x347fbf){return _0x347fbf;});}return null;};}function removeEntity(_0x2ef27a,_0x5b309b){return function(_0x5a302f){if(_0x5a302f){return _0x5a302f['destroy']()[_0x8364('0x25')](function(){_0x2ef27a[_0x8364('0x32')](0xcc)[_0x8364('0x3e')]();});}};}function handleEntityNotFound(_0x559c42,_0x14e820){return function(_0x442a99){if(!_0x442a99){_0x559c42[_0x8364('0x31')](0x194);}return _0x442a99;};}function handleError(_0x4bf045,_0x3ab49c){_0x3ab49c=_0x3ab49c||0x1f4;return function(_0x270ffa){logger[_0x8364('0x2c')](_0x270ffa[_0x8364('0x3f')]);if(_0x270ffa[_0x8364('0x40')]){delete _0x270ffa[_0x8364('0x40')];}_0x4bf045[_0x8364('0x32')](_0x3ab49c)['send'](_0x270ffa);};}exports[_0x8364('0x41')]=function(_0x41bcb8,_0x520121){var _0x4ee820={},_0x1d5bd9={},_0x3e9f3e={'count':0x0,'rows':[]};var _0x248b6d=_[_0x8364('0x42')](db['FaxMessage'][_0x8364('0x43')],function(_0x5ca028){return{'name':_0x5ca028[_0x8364('0x44')],'type':_0x5ca028[_0x8364('0x45')][_0x8364('0x46')]};});_0x1d5bd9[_0x8364('0x47')]=_[_0x8364('0x42')](_0x248b6d,_0x8364('0x40'));_0x1d5bd9[_0x8364('0x48')]=_[_0x8364('0x49')](_0x41bcb8[_0x8364('0x48')]);_0x1d5bd9[_0x8364('0x4a')]=_[_0x8364('0x4b')](_0x1d5bd9['model'],_0x1d5bd9[_0x8364('0x48')]);_0x4ee820['attributes']=_[_0x8364('0x4b')](_0x1d5bd9[_0x8364('0x47')],qs[_0x8364('0x4c')](_0x41bcb8[_0x8364('0x48')]['fields']));_0x4ee820[_0x8364('0x4d')]=_0x4ee820[_0x8364('0x4d')][_0x8364('0x4e')]?_0x4ee820[_0x8364('0x4d')]:_0x1d5bd9[_0x8364('0x47')];if(!_0x41bcb8[_0x8364('0x48')][_0x8364('0x4f')](_0x8364('0x50'))){_0x4ee820[_0x8364('0x36')]=qs[_0x8364('0x36')](_0x41bcb8['query'][_0x8364('0x36')]);_0x4ee820[_0x8364('0x34')]=qs[_0x8364('0x34')](_0x41bcb8[_0x8364('0x48')][_0x8364('0x34')]);}_0x4ee820['order']=qs['sort'](_0x41bcb8['query']['sort']);_0x4ee820[_0x8364('0x51')]=qs['filters'](_['pick'](_0x41bcb8[_0x8364('0x48')],_0x1d5bd9[_0x8364('0x4a')]),_0x248b6d);if(_0x41bcb8[_0x8364('0x48')][_0x8364('0x52')]){_0x4ee820[_0x8364('0x51')]=_[_0x8364('0x53')](_0x4ee820[_0x8364('0x51')],{'$or':_[_0x8364('0x42')](_0x248b6d,function(_0x19f6a4){if(_0x19f6a4[_0x8364('0x45')]!==_0x8364('0x54')){var _0x1072d9={};_0x1072d9[_0x19f6a4[_0x8364('0x40')]]={'$like':'%'+_0x41bcb8[_0x8364('0x48')][_0x8364('0x52')]+'%'};return _0x1072d9;}})});}_0x4ee820=_['merge']({},_0x4ee820,_0x41bcb8['options']);var _0x3dbcce={'where':_0x4ee820[_0x8364('0x51')]};return db[_0x8364('0x55')][_0x8364('0x37')](_0x3dbcce)[_0x8364('0x25')](function(_0x2851d4){_0x3e9f3e[_0x8364('0x37')]=_0x2851d4;if(_0x41bcb8[_0x8364('0x48')][_0x8364('0x56')]){_0x4ee820[_0x8364('0x57')]=[{'all':!![]}];}return db[_0x8364('0x55')][_0x8364('0x58')](_0x4ee820);})[_0x8364('0x25')](function(_0x28fda0){_0x3e9f3e[_0x8364('0x59')]=_0x28fda0;return _0x3e9f3e;})[_0x8364('0x25')](respondWithFilteredResult(_0x520121,_0x4ee820))[_0x8364('0x30')](handleError(_0x520121,null));};exports[_0x8364('0x5a')]=function(_0x5a919e,_0x3b0e2a){var _0x40082c={'raw':!![],'where':{'id':_0x5a919e[_0x8364('0x5b')]['id']}},_0x198ca0={};_0x198ca0[_0x8364('0x47')]=_[_0x8364('0x49')](db['FaxMessage'][_0x8364('0x43')]);_0x198ca0[_0x8364('0x48')]=_[_0x8364('0x49')](_0x5a919e[_0x8364('0x48')]);_0x198ca0[_0x8364('0x4a')]=_['intersection'](_0x198ca0[_0x8364('0x47')],_0x198ca0[_0x8364('0x48')]);_0x40082c[_0x8364('0x4d')]=_['intersection'](_0x198ca0[_0x8364('0x47')],qs[_0x8364('0x4c')](_0x5a919e[_0x8364('0x48')]['fields']));_0x40082c['attributes']=_0x40082c[_0x8364('0x4d')][_0x8364('0x4e')]?_0x40082c[_0x8364('0x4d')]:_0x198ca0[_0x8364('0x47')];if(_0x5a919e[_0x8364('0x48')][_0x8364('0x56')]){_0x40082c[_0x8364('0x57')]=[{'all':!![]}];}_0x40082c=_[_0x8364('0x53')]({},_0x40082c,_0x5a919e['options']);return db[_0x8364('0x55')][_0x8364('0x5c')](_0x40082c)[_0x8364('0x25')](handleEntityNotFound(_0x3b0e2a,null))[_0x8364('0x25')](respondWithResult(_0x3b0e2a,null))['catch'](handleError(_0x3b0e2a,null));};exports[_0x8364('0x3d')]=function(_0x26c0a1,_0x4e1f5c){if(_0x26c0a1[_0x8364('0x5d')]['id']){delete _0x26c0a1['body']['id'];}return db[_0x8364('0x55')][_0x8364('0x5c')]({'where':{'id':_0x26c0a1[_0x8364('0x5b')]['id']}})[_0x8364('0x25')](handleEntityNotFound(_0x4e1f5c,null))['then'](saveUpdates(_0x26c0a1['body'],null))['then'](respondWithResult(_0x4e1f5c,null))[_0x8364('0x30')](handleError(_0x4e1f5c,null));};exports[_0x8364('0x5e')]=function(_0x4efd76,_0x23aa51){return db[_0x8364('0x55')]['find']({'where':{'id':_0x4efd76[_0x8364('0x5b')]['id']}})[_0x8364('0x25')](handleEntityNotFound(_0x23aa51,null))['then'](removeEntity(_0x23aa51,null))[_0x8364('0x30')](handleError(_0x23aa51,null));};exports[_0x8364('0x5f')]=function(_0x140610,_0x3cd9b9){return db[_0x8364('0x55')][_0x8364('0x5f')]()[_0x8364('0x25')](respondWithResult(_0x3cd9b9,null))[_0x8364('0x30')](handleError(_0x3cd9b9,null));};var interaction_log=require('../../config/logger')(_0x8364('0x60'));exports[_0x8364('0x61')]=function(_0x1cd706,_0x2500aa,_0x194fc6){var _0x32a586={'agent':{},'channel':_0x8364('0x62')};if(_0x1cd706[_0x8364('0x5d')]['id']){delete _0x1cd706[_0x8364('0x5d')]['id'];}_0x1cd706[_0x8364('0x5d')][_0x8364('0x63')]=!![];_0x1cd706[_0x8364('0x5d')]['readAt']=moment()['format'](_0x8364('0x64'));_0x1cd706[_0x8364('0x5d')][_0x8364('0x65')]=_0x1cd706[_0x8364('0x5d')][_0x8364('0x65')]||_0x1cd706[_0x8364('0x66')]['id'];_0x32a586[_0x8364('0x67')]['id']=_0x1cd706[_0x8364('0x5d')][_0x8364('0x65')];return db[_0x8364('0x55')][_0x8364('0x5c')]({'where':{'id':_0x1cd706['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2500aa,null))[_0x8364('0x25')](saveUpdates(_0x1cd706[_0x8364('0x5d')],null))['then'](function(_0x229233){if(_0x229233){_0x32a586[_0x8364('0x2e')]=_0x229233['get']({'plain':!![]});return db[_0x8364('0x68')][_0x8364('0x5c')]({'where':{'id':_0x229233['FaxInteractionId']}});}return null;})[_0x8364('0x25')](handleEntityNotFound(_0x2500aa,null))['then'](function(_0x3c5c2e){if(_0x3c5c2e){return _0x3c5c2e[_0x8364('0x3d')]({'UserId':_0x1cd706[_0x8364('0x5d')]['UserId'],'read1stAt':_[_0x8364('0x69')](_0x3c5c2e[_0x8364('0x6a')])?moment()[_0x8364('0x6b')](_0x8364('0x64')):undefined});}return null;})['then'](function(_0x42563f){if(_0x42563f){_0x32a586[_0x8364('0x6c')]=_0x42563f['get']({'plain':!![]});interaction_log[_0x8364('0x26')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1cd706[_0x8364('0x66')]['id'],_0x1cd706[_0x8364('0x66')][_0x8364('0x40')],_0x1cd706[_0x8364('0x66')][_0x8364('0x6d')],_0x32a586[_0x8364('0x6c')]['id'],_0x1cd706[_0x8364('0x5d')]?JSON[_0x8364('0x2b')](_0x1cd706[_0x8364('0x5d')]):_0x8364('0x6e'));return respondWithRpcPromise(_0x8364('0x6f'),_0x8364('0x70'),_0x32a586);}return null;})['then'](function(_0x42217c){var _0xf69cac='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x42217c[_0x8364('0x2e')][_0x8364('0x71')];return db['sequelize'][_0x8364('0x48')](_0xf69cac,{'type':db['Sequelize']['QueryTypes'][_0x8364('0x72')],'raw':!![]})[_0x8364('0x25')](function(_0x2430fa){return _0x2430fa;});})[_0x8364('0x25')](function(_0x1fae9f){if(_0x1fae9f){_0x32a586[_0x8364('0x2e')][_0x8364('0x73')]=_0x1fae9f[0x0];if(!_0x1cd706[_0x8364('0x5d')][_0x8364('0x65')])return;return db['User'][_0x8364('0x5c')]({'where':{'id':_0x1cd706[_0x8364('0x5d')]['UserId'],'role':_0x8364('0x67')},'attributes':['id',_0x8364('0x40'),'fullname','email','internal'],'raw':!![]});}return null;})[_0x8364('0x25')](function(_0x8f0cd5){if(!_0x8f0cd5)return null;_0x32a586[_0x8364('0x2e')][_0x8364('0x67')]=_0x8f0cd5;return _0x32a586;})[_0x8364('0x25')](function(_0x401d72){if(_0x401d72){if(_0x1cd706[_0x8364('0x5d')]['manual']){_0x32a586[_0x8364('0x2e')]['interface']=util['format'](_0x8364('0x74'),_0x1cd706[_0x8364('0x66')]['name']);_0x32a586['message']['channel']=_0x32a586['channel'];_0x32a586['message']['motionChannel']=_0x32a586[_0x8364('0x75')];_0x32a586['message'][_0x8364('0x76')]=_0x8364('0x61');return respondWithRpcPromise(_0x8364('0x77'),_0x8364('0x77'),{'event':_0x8364('0x78'),'message':_0x32a586[_0x8364('0x2e')]},client9002)['then'](function(){return _0x32a586;});}return _0x32a586;}return null;})[_0x8364('0x25')](respondWithResult(_0x2500aa,null))[_0x8364('0x30')](handleError(_0x2500aa,null));};var interaction_log=require(_0x8364('0x17'))(_0x8364('0x60'));exports[_0x8364('0x3b')]=function(_0x3ed244,_0x2d028d,_0x411193){var _0x4b172e={'agent':{},'channel':_0x8364('0x62')};if(_0x3ed244[_0x8364('0x5d')]['id']){delete _0x3ed244['body']['id'];}_0x3ed244[_0x8364('0x5d')][_0x8364('0x65')]=_0x3ed244[_0x8364('0x5d')][_0x8364('0x65')]||_0x3ed244[_0x8364('0x66')]['id'];_0x4b172e[_0x8364('0x67')]['id']=_0x3ed244[_0x8364('0x5d')]['UserId'];return db[_0x8364('0x55')][_0x8364('0x5c')]({'where':{'id':_0x3ed244[_0x8364('0x5b')]['id'],'UserId':null}})[_0x8364('0x25')](handleEntityNotFound(_0x2d028d,null))[_0x8364('0x25')](function(_0x50a24d){if(_0x50a24d){_0x4b172e['message']=_0x50a24d[_0x8364('0x79')]({'plain':!![]});return db[_0x8364('0x68')][_0x8364('0x5c')]({'where':{'id':_0x50a24d[_0x8364('0x7a')]}});}return null;})[_0x8364('0x25')](handleEntityNotFound(_0x2d028d,null))[_0x8364('0x25')](function(_0x13c370){if(_0x13c370){_0x4b172e[_0x8364('0x6c')]=_0x13c370[_0x8364('0x79')]({'plain':!![]});interaction_log[_0x8364('0x26')](_0x8364('0x7b'),_0x3ed244['user']['id'],_0x3ed244[_0x8364('0x66')][_0x8364('0x40')],_0x3ed244[_0x8364('0x66')][_0x8364('0x6d')],_0x4b172e[_0x8364('0x6c')]['id'],_0x3ed244[_0x8364('0x5d')]?JSON[_0x8364('0x2b')](_0x3ed244[_0x8364('0x5d')]):_0x8364('0x6e'));return respondWithRpcPromise('RejectMessage',_0x8364('0x7c'),_0x4b172e);}return null;})[_0x8364('0x25')](function(_0x3d8a6e){var _0x362060=_0x8364('0x7d')+_0x3d8a6e[_0x8364('0x2e')][_0x8364('0x71')];return db[_0x8364('0x7e')][_0x8364('0x48')](_0x362060,{'type':db[_0x8364('0x7f')]['QueryTypes'][_0x8364('0x72')],'raw':!![]})[_0x8364('0x25')](function(_0x134f7e){return _0x134f7e;});})[_0x8364('0x25')](function(_0x43f060){if(_0x43f060){_0x4b172e[_0x8364('0x2e')]['contact']=_0x43f060[0x0];if(!_0x3ed244[_0x8364('0x5d')][_0x8364('0x65')])return;return db['User'][_0x8364('0x5c')]({'where':{'id':_0x3ed244[_0x8364('0x5d')]['UserId'],'role':_0x8364('0x67')},'attributes':['id',_0x8364('0x40'),_0x8364('0x80'),_0x8364('0x81'),_0x8364('0x82')],'raw':!![]});}return null;})[_0x8364('0x25')](function(_0x34ce6e){if(!_0x34ce6e)return null;_0x4b172e['message'][_0x8364('0x67')]=_0x34ce6e;return _0x4b172e;})[_0x8364('0x25')](function(_0x12d28){if(_0x12d28){_0x12d28['message'][_0x8364('0x83')]=util['format'](_0x8364('0x74'),_0x3ed244[_0x8364('0x66')][_0x8364('0x40')]);_0x12d28[_0x8364('0x2e')][_0x8364('0x75')]=_0x4b172e['channel'];_0x12d28['message'][_0x8364('0x84')]=_0x4b172e[_0x8364('0x75')];_0x12d28[_0x8364('0x2e')][_0x8364('0x76')]=_0x8364('0x3b');respondWithRpcPromise('EventManager',_0x8364('0x77'),{'event':_0x8364('0x85'),'message':_0x12d28[_0x8364('0x2e')]},client9002);return _0x4b172e;}return null;})[_0x8364('0x25')](respondWithResult(_0x2d028d,null))['catch'](handleError(_0x2d028d,null));};exports['create']=function(_0x5ee0b7,_0xd4e04d){var _0x336c0b;return db['FaxMessage']['create'](_0x5ee0b7[_0x8364('0x5d')],{})[_0x8364('0x25')](function(_0xa2ab28){_0x336c0b=_0xa2ab28;return db[_0x8364('0x86')][_0x8364('0x87')]({'where':{'id':_0x336c0b['ContactId']}});})[_0x8364('0x25')](function(_0x2089b7){if(_[_0x8364('0x69')](_0x2089b7)){return;}else{_0x336c0b[_0x8364('0x62')]=_0x2089b7[_0x8364('0x62')];return db[_0x8364('0x88')][_0x8364('0x87')]({'where':{'id':_0x336c0b['AttachmentId']}});}})[_0x8364('0x25')](function(_0x55e32e){return respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_[_0x8364('0x69')](_0x5ee0b7[_0x8364('0x5d')])?undefined:_0x5ee0b7[_0x8364('0x5d')][_0x8364('0x89')],'path':_[_0x8364('0x69')](_0x55e32e)?undefined:util[_0x8364('0x6b')](_0x8364('0x8a'),_0x55e32e[_0x8364('0x8b')]),'fax':_[_0x8364('0x69')](_0x336c0b[_0x8364('0x62')])?undefined:_0x336c0b[_0x8364('0x62')],'AttachmentId':_0x336c0b['AttachmentId']},client9002);})[_0x8364('0x25')](respondWithResult(_0xd4e04d,0xc9))[_0x8364('0x30')](handleError(_0xd4e04d,null));};exports['download']=function(_0x3b358f,_0x1ad45d){var _0x338e15=path[_0x8364('0x8c')](config[_0x8364('0x8d')],_0x8364('0x8e'),'files',_0x8364('0x8f'));return db['FaxMessage'][_0x8364('0x5c')]({'where':{'id':_0x3b358f['params']['id']},'include':[{'model':db[_0x8364('0x88')],'as':_0x8364('0x88')}]})[_0x8364('0x25')](handleEntityNotFound(_0x1ad45d,null))[_0x8364('0x25')](function(_0x42d745){if(_0x42d745){return _0x1ad45d[_0x8364('0x90')](path[_0x8364('0x8c')](_0x338e15,_0x42d745['Attachment'][_0x8364('0x8b')]));}})[_0x8364('0x30')](handleError(_0x1ad45d,null));}; \ No newline at end of file +var _0x43f3=['attachments','basename','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','destroy','stack','name','send','index','map','FaxMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','include','findAll','show','params','includeAll','options','find','body','describe','accept','fax','read','readAt','YYYY-MM-DD\x20HH:mm:ss','agent','UserId','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','format','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','stringify','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','fax-interactions','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','User','email','rejectmessage','create','CmContact','findOne','Attachment','AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s','download','join','root','files'];(function(_0x390a19,_0x5dd137){var _0x5d8230=function(_0x2e6234){while(--_0x2e6234){_0x390a19['push'](_0x390a19['shift']());}};_0x5d8230(++_0x5dd137);}(_0x43f3,0x1b2));var _0x343f=function(_0x67f95e,_0x3ca797){_0x67f95e=_0x67f95e-0x0;var _0x538f5a=_0x43f3[_0x67f95e];return _0x538f5a;};'use strict';var emlformat=require(_0x343f('0x0'));var rimraf=require(_0x343f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x343f('0x2'));var rp=require('request-promise');var moment=require(_0x343f('0x3'));var BPromise=require(_0x343f('0x4'));var Mustache=require(_0x343f('0x5'));var util=require(_0x343f('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x343f('0x7'));var ejs=require(_0x343f('0x8'));var fs=require('fs');var fs_extra=require(_0x343f('0x9'));var _=require(_0x343f('0xa'));var squel=require(_0x343f('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x343f('0xc'));var toCsv=require(_0x343f('0x7'));var querystring=require(_0x343f('0xd'));var Papa=require(_0x343f('0xe'));var Redis=require(_0x343f('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x343f('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x343f('0x11'));var logger=require(_0x343f('0x12'))(_0x343f('0x13'));var utils=require(_0x343f('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x343f('0x15'));var db=require(_0x343f('0x16'))['db'];config[_0x343f('0x17')]=_[_0x343f('0x18')](config[_0x343f('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x343f('0x19'))(new Redis(config['redis']));require(_0x343f('0x1a'))[_0x343f('0x1b')](socket);var jayson=require(_0x343f('0x1c'));var client=jayson[_0x343f('0x1d')][_0x343f('0x1e')]({'port':0x232c});var client9002=jayson[_0x343f('0x1d')][_0x343f('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x3b6d3e,_0x555ef5,_0x125d00,_0x253fe8){return new BPromise(function(_0x57437d,_0x3417cf){var _0x58b031=_0x253fe8||client;return _0x58b031[_0x343f('0x1f')](_0x3b6d3e,_0x125d00)[_0x343f('0x20')](function(_0x242bc2){logger['info'](_0x343f('0x21'),_0x555ef5,_0x343f('0x22'));logger[_0x343f('0x23')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x555ef5,_0x343f('0x22'),JSON['stringify'](_0x242bc2));if(_0x242bc2[_0x343f('0x24')]){if(_0x242bc2[_0x343f('0x24')][_0x343f('0x25')]===0x1f4){logger[_0x343f('0x24')]('FaxMessage,\x20%s,\x20%s',_0x555ef5,_0x242bc2['error']['message']);return _0x3417cf(_0x242bc2['error'][_0x343f('0x26')]);}logger[_0x343f('0x24')]('FaxMessage,\x20%s,\x20%s',_0x555ef5,_0x242bc2['error']['message']);return _0x57437d(_0x242bc2[_0x343f('0x24')][_0x343f('0x26')]);}else{logger[_0x343f('0x27')](_0x343f('0x21'),_0x555ef5,_0x343f('0x22'));_0x57437d(_0x242bc2['result'][_0x343f('0x26')]);}})[_0x343f('0x28')](function(_0x50bf13){logger[_0x343f('0x24')]('FaxMessage,\x20%s,\x20%s',_0x555ef5,_0x50bf13);_0x3417cf(_0x50bf13);});});}function respondWithStatusCode(_0x4665e8,_0x38a203){_0x38a203=_0x38a203||0xcc;return function(_0x568fed){if(_0x568fed){return _0x4665e8[_0x343f('0x29')](_0x38a203);}return _0x4665e8[_0x343f('0x2a')](_0x38a203)[_0x343f('0x2b')]();};}function respondWithResult(_0x33340d,_0x1b455a){_0x1b455a=_0x1b455a||0xc8;return function(_0x1be320){if(_0x1be320){return _0x33340d['status'](_0x1b455a)[_0x343f('0x2c')](_0x1be320);}};}function respondWithFilteredResult(_0x176c78,_0x201da4){return function(_0x457296){if(_0x457296){var _0x2c3ed9=typeof _0x201da4[_0x343f('0x2d')]===_0x343f('0x2e')&&typeof _0x201da4[_0x343f('0x2f')]===_0x343f('0x2e');var _0x1a57cc=_0x457296[_0x343f('0x30')];var _0x3f594d=_0x2c3ed9?0x0:_0x201da4[_0x343f('0x2d')];var _0x2652d1=_0x2c3ed9?_0x457296['count']:_0x201da4[_0x343f('0x2d')]+_0x201da4[_0x343f('0x2f')];var _0x19906e;if(_0x2652d1>=_0x1a57cc){_0x2652d1=_0x1a57cc;_0x19906e=0xc8;}else{_0x19906e=0xce;}_0x176c78[_0x343f('0x2a')](_0x19906e);return _0x176c78[_0x343f('0x31')]('Content-Range',_0x3f594d+'-'+_0x2652d1+'/'+_0x1a57cc)[_0x343f('0x2c')](_0x457296);}return null;};}function patchUpdates(_0x5f0453){return function(_0x488748){try{jsonpatch['apply'](_0x488748,_0x5f0453,!![]);}catch(_0x3b2e62){return BPromise[_0x343f('0x32')](_0x3b2e62);}return _0x488748[_0x343f('0x33')]();};}function saveUpdates(_0x155645,_0x5a8b7f){return function(_0x5f3998){if(_0x5f3998){return _0x5f3998[_0x343f('0x34')](_0x155645)['then'](function(_0x2d4e3a){return _0x2d4e3a;});}return null;};}function removeEntity(_0x28e793,_0x47e6ca){return function(_0x3b616b){if(_0x3b616b){return _0x3b616b[_0x343f('0x35')]()['then'](function(){_0x28e793[_0x343f('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16d58d,_0x3e08d2){return function(_0x523a9a){if(!_0x523a9a){_0x16d58d[_0x343f('0x29')](0x194);}return _0x523a9a;};}function handleError(_0x1ef511,_0x3a4252){_0x3a4252=_0x3a4252||0x1f4;return function(_0x51d255){logger[_0x343f('0x24')](_0x51d255[_0x343f('0x36')]);if(_0x51d255['name']){delete _0x51d255[_0x343f('0x37')];}_0x1ef511[_0x343f('0x2a')](_0x3a4252)[_0x343f('0x38')](_0x51d255);};}exports[_0x343f('0x39')]=function(_0x4e7b75,_0x46a516){var _0x110dd5={},_0x304c7d={},_0x10ff15={'count':0x0,'rows':[]};var _0x137fa6=_[_0x343f('0x3a')](db[_0x343f('0x3b')][_0x343f('0x3c')],function(_0x110360){return{'name':_0x110360[_0x343f('0x3d')],'type':_0x110360[_0x343f('0x3e')][_0x343f('0x3f')]};});_0x304c7d[_0x343f('0x40')]=_[_0x343f('0x3a')](_0x137fa6,_0x343f('0x37'));_0x304c7d[_0x343f('0x41')]=_[_0x343f('0x42')](_0x4e7b75[_0x343f('0x41')]);_0x304c7d[_0x343f('0x43')]=_[_0x343f('0x44')](_0x304c7d['model'],_0x304c7d[_0x343f('0x41')]);_0x110dd5['attributes']=_['intersection'](_0x304c7d[_0x343f('0x40')],qs['fields'](_0x4e7b75[_0x343f('0x41')][_0x343f('0x45')]));_0x110dd5[_0x343f('0x46')]=_0x110dd5[_0x343f('0x46')]['length']?_0x110dd5[_0x343f('0x46')]:_0x304c7d[_0x343f('0x40')];if(!_0x4e7b75['query'][_0x343f('0x47')](_0x343f('0x48'))){_0x110dd5[_0x343f('0x2f')]=qs['limit'](_0x4e7b75['query']['limit']);_0x110dd5[_0x343f('0x2d')]=qs[_0x343f('0x2d')](_0x4e7b75[_0x343f('0x41')][_0x343f('0x2d')]);}_0x110dd5['order']=qs[_0x343f('0x49')](_0x4e7b75[_0x343f('0x41')]['sort']);_0x110dd5[_0x343f('0x4a')]=qs[_0x343f('0x43')](_['pick'](_0x4e7b75['query'],_0x304c7d['filters']),_0x137fa6);if(_0x4e7b75[_0x343f('0x41')][_0x343f('0x4b')]){_0x110dd5[_0x343f('0x4a')]=_[_0x343f('0x4c')](_0x110dd5[_0x343f('0x4a')],{'$or':_[_0x343f('0x3a')](_0x137fa6,function(_0x1153df){if(_0x1153df[_0x343f('0x3e')]!==_0x343f('0x4d')){var _0x4e3583={};_0x4e3583[_0x1153df['name']]={'$like':'%'+_0x4e7b75[_0x343f('0x41')][_0x343f('0x4b')]+'%'};return _0x4e3583;}})});}_0x110dd5=_[_0x343f('0x4c')]({},_0x110dd5,_0x4e7b75['options']);var _0x16a21c={'where':_0x110dd5['where']};return db['FaxMessage']['count'](_0x16a21c)['then'](function(_0x125d9f){_0x10ff15[_0x343f('0x30')]=_0x125d9f;if(_0x4e7b75['query']['includeAll']){_0x110dd5[_0x343f('0x4e')]=[{'all':!![]}];}return db['FaxMessage'][_0x343f('0x4f')](_0x110dd5);})[_0x343f('0x20')](function(_0x4ff004){_0x10ff15['rows']=_0x4ff004;return _0x10ff15;})[_0x343f('0x20')](respondWithFilteredResult(_0x46a516,_0x110dd5))['catch'](handleError(_0x46a516,null));};exports[_0x343f('0x50')]=function(_0x3ee71a,_0x2d6099){var _0x5f3a3a={'raw':!![],'where':{'id':_0x3ee71a[_0x343f('0x51')]['id']}},_0x42995a={};_0x42995a[_0x343f('0x40')]=_['keys'](db['FaxMessage'][_0x343f('0x3c')]);_0x42995a[_0x343f('0x41')]=_['keys'](_0x3ee71a[_0x343f('0x41')]);_0x42995a[_0x343f('0x43')]=_[_0x343f('0x44')](_0x42995a[_0x343f('0x40')],_0x42995a['query']);_0x5f3a3a[_0x343f('0x46')]=_[_0x343f('0x44')](_0x42995a[_0x343f('0x40')],qs[_0x343f('0x45')](_0x3ee71a[_0x343f('0x41')][_0x343f('0x45')]));_0x5f3a3a[_0x343f('0x46')]=_0x5f3a3a[_0x343f('0x46')]['length']?_0x5f3a3a[_0x343f('0x46')]:_0x42995a[_0x343f('0x40')];if(_0x3ee71a['query'][_0x343f('0x52')]){_0x5f3a3a[_0x343f('0x4e')]=[{'all':!![]}];}_0x5f3a3a=_['merge']({},_0x5f3a3a,_0x3ee71a[_0x343f('0x53')]);return db[_0x343f('0x3b')][_0x343f('0x54')](_0x5f3a3a)['then'](handleEntityNotFound(_0x2d6099,null))['then'](respondWithResult(_0x2d6099,null))[_0x343f('0x28')](handleError(_0x2d6099,null));};exports[_0x343f('0x34')]=function(_0x1e10aa,_0x29ef76){if(_0x1e10aa[_0x343f('0x55')]['id']){delete _0x1e10aa['body']['id'];}return db['FaxMessage'][_0x343f('0x54')]({'where':{'id':_0x1e10aa[_0x343f('0x51')]['id']}})[_0x343f('0x20')](handleEntityNotFound(_0x29ef76,null))[_0x343f('0x20')](saveUpdates(_0x1e10aa['body'],null))['then'](respondWithResult(_0x29ef76,null))['catch'](handleError(_0x29ef76,null));};exports[_0x343f('0x35')]=function(_0x4bcda0,_0x4d3153){return db['FaxMessage']['find']({'where':{'id':_0x4bcda0['params']['id']}})[_0x343f('0x20')](handleEntityNotFound(_0x4d3153,null))[_0x343f('0x20')](removeEntity(_0x4d3153,null))[_0x343f('0x28')](handleError(_0x4d3153,null));};exports[_0x343f('0x56')]=function(_0x57d5bf,_0x3d238b){return db[_0x343f('0x3b')][_0x343f('0x56')]()[_0x343f('0x20')](respondWithResult(_0x3d238b,null))[_0x343f('0x28')](handleError(_0x3d238b,null));};var interaction_log=require(_0x343f('0x12'))('fax-interactions');exports[_0x343f('0x57')]=function(_0x2f8dc8,_0x40c81f,_0x222c3f){var _0x43749d={'agent':{},'channel':_0x343f('0x58')};if(_0x2f8dc8[_0x343f('0x55')]['id']){delete _0x2f8dc8[_0x343f('0x55')]['id'];}_0x2f8dc8[_0x343f('0x55')][_0x343f('0x59')]=!![];_0x2f8dc8[_0x343f('0x55')][_0x343f('0x5a')]=moment()['format'](_0x343f('0x5b'));_0x2f8dc8['body']['UserId']=_0x2f8dc8[_0x343f('0x55')]['UserId']||_0x2f8dc8['user']['id'];_0x43749d[_0x343f('0x5c')]['id']=_0x2f8dc8[_0x343f('0x55')][_0x343f('0x5d')];return db['FaxMessage'][_0x343f('0x54')]({'where':{'id':_0x2f8dc8[_0x343f('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x40c81f,null))[_0x343f('0x20')](saveUpdates(_0x2f8dc8['body'],null))[_0x343f('0x20')](function(_0x4f9f72){if(_0x4f9f72){_0x43749d[_0x343f('0x26')]=_0x4f9f72[_0x343f('0x5e')]({'plain':!![]});return db[_0x343f('0x5f')][_0x343f('0x54')]({'where':{'id':_0x4f9f72[_0x343f('0x60')]}});}return null;})[_0x343f('0x20')](handleEntityNotFound(_0x40c81f,null))[_0x343f('0x20')](function(_0x95a3f4){if(_0x95a3f4){return _0x95a3f4[_0x343f('0x34')]({'UserId':_0x2f8dc8['body'][_0x343f('0x5d')],'read1stAt':_[_0x343f('0x61')](_0x95a3f4[_0x343f('0x62')])?moment()[_0x343f('0x63')](_0x343f('0x5b')):undefined});}return null;})[_0x343f('0x20')](function(_0x2d98d2){if(_0x2d98d2){_0x43749d[_0x343f('0x64')]=_0x2d98d2[_0x343f('0x5e')]({'plain':!![]});interaction_log[_0x343f('0x27')](_0x343f('0x65'),_0x2f8dc8[_0x343f('0x66')]['id'],_0x2f8dc8[_0x343f('0x66')][_0x343f('0x37')],_0x2f8dc8[_0x343f('0x66')][_0x343f('0x67')],_0x43749d[_0x343f('0x64')]['id'],_0x2f8dc8['body']?JSON[_0x343f('0x68')](_0x2f8dc8[_0x343f('0x55')]):'null');return respondWithRpcPromise(_0x343f('0x69'),'acceptMessage',_0x43749d);}return null;})[_0x343f('0x20')](function(_0x125754){var _0x25571f=_0x343f('0x6a')+_0x125754['message'][_0x343f('0x6b')];return db[_0x343f('0x6c')][_0x343f('0x41')](_0x25571f,{'type':db[_0x343f('0x6d')][_0x343f('0x6e')][_0x343f('0x6f')],'raw':!![]})['then'](function(_0xd73b9d){return _0xd73b9d;});})['then'](function(_0x2517b8){if(_0x2517b8){_0x43749d['message'][_0x343f('0x70')]=_0x2517b8[0x0];if(!_0x2f8dc8[_0x343f('0x55')]['UserId'])return;return db['User'][_0x343f('0x54')]({'where':{'id':_0x2f8dc8[_0x343f('0x55')][_0x343f('0x5d')],'role':_0x343f('0x5c')},'attributes':['id','name',_0x343f('0x71'),'email',_0x343f('0x72')],'raw':!![]});}return null;})[_0x343f('0x20')](function(_0x435609){if(!_0x435609)return null;_0x43749d[_0x343f('0x26')]['agent']=_0x435609;return _0x43749d;})[_0x343f('0x20')](function(_0x1fc117){if(_0x1fc117){if(_0x2f8dc8[_0x343f('0x55')][_0x343f('0x73')]){_0x43749d[_0x343f('0x26')][_0x343f('0x74')]=util[_0x343f('0x63')](_0x343f('0x75'),_0x2f8dc8[_0x343f('0x66')][_0x343f('0x37')]);_0x43749d[_0x343f('0x26')][_0x343f('0x76')]=_0x43749d[_0x343f('0x76')];_0x43749d[_0x343f('0x26')][_0x343f('0x77')]=_0x43749d[_0x343f('0x76')];_0x43749d[_0x343f('0x26')][_0x343f('0x78')]=_0x343f('0x57');return respondWithRpcPromise(_0x343f('0x79'),_0x343f('0x79'),{'event':_0x343f('0x7a'),'message':_0x43749d[_0x343f('0x26')]},client9002)[_0x343f('0x20')](function(){return _0x43749d;});}return _0x43749d;}return null;})[_0x343f('0x20')](respondWithResult(_0x40c81f,null))['catch'](handleError(_0x40c81f,null));};var interaction_log=require(_0x343f('0x12'))(_0x343f('0x7b'));exports[_0x343f('0x32')]=function(_0x35949f,_0x40c947,_0x24a24f){var _0x2961ca={'agent':{},'channel':'fax'};if(_0x35949f[_0x343f('0x55')]['id']){delete _0x35949f[_0x343f('0x55')]['id'];}_0x35949f['body'][_0x343f('0x5d')]=_0x35949f[_0x343f('0x55')][_0x343f('0x5d')]||_0x35949f[_0x343f('0x66')]['id'];_0x2961ca['agent']['id']=_0x35949f[_0x343f('0x55')][_0x343f('0x5d')];return db[_0x343f('0x3b')][_0x343f('0x54')]({'where':{'id':_0x35949f[_0x343f('0x51')]['id'],'UserId':null}})[_0x343f('0x20')](handleEntityNotFound(_0x40c947,null))['then'](function(_0x505e5b){if(_0x505e5b){_0x2961ca[_0x343f('0x26')]=_0x505e5b['get']({'plain':!![]});return db[_0x343f('0x5f')][_0x343f('0x54')]({'where':{'id':_0x505e5b['FaxInteractionId']}});}return null;})[_0x343f('0x20')](handleEntityNotFound(_0x40c947,null))[_0x343f('0x20')](function(_0x509e30){if(_0x509e30){_0x2961ca[_0x343f('0x64')]=_0x509e30[_0x343f('0x5e')]({'plain':!![]});interaction_log['info'](_0x343f('0x7c'),_0x35949f['user']['id'],_0x35949f[_0x343f('0x66')][_0x343f('0x37')],_0x35949f[_0x343f('0x66')][_0x343f('0x67')],_0x2961ca['interaction']['id'],_0x35949f[_0x343f('0x55')]?JSON[_0x343f('0x68')](_0x35949f['body']):_0x343f('0x7d'));return respondWithRpcPromise(_0x343f('0x7e'),_0x343f('0x7f'),_0x2961ca);}return null;})[_0x343f('0x20')](function(_0x4afcf4){var _0x374ab6='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4afcf4[_0x343f('0x26')][_0x343f('0x6b')];return db[_0x343f('0x6c')][_0x343f('0x41')](_0x374ab6,{'type':db['Sequelize'][_0x343f('0x6e')][_0x343f('0x6f')],'raw':!![]})[_0x343f('0x20')](function(_0x306bfd){return _0x306bfd;});})[_0x343f('0x20')](function(_0x22c016){if(_0x22c016){_0x2961ca[_0x343f('0x26')][_0x343f('0x70')]=_0x22c016[0x0];if(!_0x35949f[_0x343f('0x55')][_0x343f('0x5d')])return;return db[_0x343f('0x80')][_0x343f('0x54')]({'where':{'id':_0x35949f[_0x343f('0x55')][_0x343f('0x5d')],'role':_0x343f('0x5c')},'attributes':['id',_0x343f('0x37'),'fullname',_0x343f('0x81'),'internal'],'raw':!![]});}return null;})[_0x343f('0x20')](function(_0x3ea8f3){if(!_0x3ea8f3)return null;_0x2961ca[_0x343f('0x26')][_0x343f('0x5c')]=_0x3ea8f3;return _0x2961ca;})[_0x343f('0x20')](function(_0x8acf3){if(_0x8acf3){_0x8acf3['message'][_0x343f('0x74')]=util[_0x343f('0x63')]('SIP/%s',_0x35949f[_0x343f('0x66')][_0x343f('0x37')]);_0x8acf3[_0x343f('0x26')]['channel']=_0x2961ca[_0x343f('0x76')];_0x8acf3[_0x343f('0x26')]['motionChannel']=_0x2961ca[_0x343f('0x76')];_0x8acf3[_0x343f('0x26')][_0x343f('0x78')]=_0x343f('0x32');respondWithRpcPromise(_0x343f('0x79'),_0x343f('0x79'),{'event':_0x343f('0x82'),'message':_0x8acf3[_0x343f('0x26')]},client9002);return _0x2961ca;}return null;})[_0x343f('0x20')](respondWithResult(_0x40c947,null))['catch'](handleError(_0x40c947,null));};exports[_0x343f('0x83')]=function(_0x2d8fbc,_0x29df17){var _0x22b553;return db[_0x343f('0x3b')][_0x343f('0x83')](_0x2d8fbc[_0x343f('0x55')],{})[_0x343f('0x20')](function(_0x143229){_0x22b553=_0x143229;return db[_0x343f('0x84')][_0x343f('0x85')]({'where':{'id':_0x22b553[_0x343f('0x6b')]}});})['then'](function(_0x2c6408){if(_[_0x343f('0x61')](_0x2c6408)){return;}else{_0x22b553[_0x343f('0x58')]=_0x2c6408[_0x343f('0x58')];return db[_0x343f('0x86')][_0x343f('0x85')]({'where':{'id':_0x22b553[_0x343f('0x87')]}});}})[_0x343f('0x20')](function(_0x44957d){return respondWithRpcPromise(_0x343f('0x88'),_0x343f('0x88'),{'FaxAccountId':_['isNil'](_0x2d8fbc['body'])?undefined:_0x2d8fbc[_0x343f('0x55')]['FaxAccountId'],'path':_[_0x343f('0x61')](_0x44957d)?undefined:util[_0x343f('0x63')](_0x343f('0x89'),_0x44957d['basename']),'fax':_[_0x343f('0x61')](_0x22b553[_0x343f('0x58')])?undefined:_0x22b553[_0x343f('0x58')],'AttachmentId':_0x22b553[_0x343f('0x87')]},client9002);})[_0x343f('0x20')](respondWithResult(_0x29df17,0xc9))[_0x343f('0x28')](handleError(_0x29df17,null));};exports[_0x343f('0x8a')]=function(_0x4a1de2,_0x1365ff){var _0x13eb56=path[_0x343f('0x8b')](config[_0x343f('0x8c')],'server',_0x343f('0x8d'),_0x343f('0x8e'));return db[_0x343f('0x3b')][_0x343f('0x54')]({'where':{'id':_0x4a1de2[_0x343f('0x51')]['id']},'include':[{'model':db[_0x343f('0x86')],'as':_0x343f('0x86')}]})[_0x343f('0x20')](handleEntityNotFound(_0x1365ff,null))[_0x343f('0x20')](function(_0x363835){if(_0x363835){return _0x1365ff[_0x343f('0x8a')](path[_0x343f('0x8b')](_0x13eb56,_0x363835[_0x343f('0x86')][_0x343f('0x8f')]));}})[_0x343f('0x28')](handleError(_0x1365ff,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 957ac0e..5056cd8 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 _0xf966=['FaxMessage','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x58c80b,_0x555b70){var _0x736f71=function(_0x6f9f8a){while(--_0x6f9f8a){_0x58c80b['push'](_0x58c80b['shift']());}};_0x736f71(++_0x555b70);}(_0xf966,0x184));var _0x6f96=function(_0x77f18c,_0x5cb1ad){_0x77f18c=_0x77f18c-0x0;var _0xb8910c=_0xf966[_0x77f18c];return _0xb8910c;};'use strict';var EventEmitter=require(_0x6f96('0x0'));var FaxMessage=require(_0x6f96('0x1'))['db'][_0x6f96('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6f96('0x3'),'afterUpdate':_0x6f96('0x4'),'afterDestroy':_0x6f96('0x5')};function emitEvent(_0x5500f4){return function(_0x1820d1,_0x33a4e6,_0x23019c){FaxMessageEvents['emit'](_0x5500f4+':'+_0x1820d1['id'],_0x1820d1);FaxMessageEvents[_0x6f96('0x6')](_0x5500f4,_0x1820d1);_0x23019c(null);};}for(var e in events){if(events[_0x6f96('0x7')](e)){var event=events[e];FaxMessage[_0x6f96('0x8')](e,emitEvent(event));}}module[_0x6f96('0x9')]=FaxMessageEvents; \ No newline at end of file +var _0x7676=['events','../../mysqldb','FaxMessage','save','emit','hasOwnProperty','hook','exports'];(function(_0x3bf3b8,_0xf0dea6){var _0x1e26bf=function(_0x17b1a9){while(--_0x17b1a9){_0x3bf3b8['push'](_0x3bf3b8['shift']());}};_0x1e26bf(++_0xf0dea6);}(_0x7676,0xb8));var _0x6767=function(_0x5a595c,_0xf3116){_0x5a595c=_0x5a595c-0x0;var _0x452d13=_0x7676[_0x5a595c];return _0x452d13;};'use strict';var EventEmitter=require(_0x6767('0x0'));var FaxMessage=require(_0x6767('0x1'))['db'][_0x6767('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6767('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1e86fc){return function(_0x4bd37b,_0x4005ff,_0x10d505){FaxMessageEvents[_0x6767('0x4')](_0x1e86fc+':'+_0x4bd37b['id'],_0x4bd37b);FaxMessageEvents['emit'](_0x1e86fc,_0x4bd37b);_0x10d505(null);};}for(var e in events){if(events[_0x6767('0x5')](e)){var event=events[e];FaxMessage[_0x6767('0x6')](e,emitEvent(event));}}module[_0x6767('0x7')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 539b172..b241ab4 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 _0x4e8f=['createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x4e8f,0x1e5));var _0xf4e8=function(_0x284cc3,_0x5072a4){_0x284cc3=_0x284cc3-0x0;var _0x209b52=_0x4e8f[_0x284cc3];return _0x209b52;};'use strict';var _=require('lodash');var util=require(_0xf4e8('0x0'));var logger=require(_0xf4e8('0x1'))(_0xf4e8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf4e8('0x3'));var fs=require('fs');var path=require(_0xf4e8('0x4'));var rimraf=require(_0xf4e8('0x5'));var config=require(_0xf4e8('0x6'));var attributes=require(_0xf4e8('0x7'));module['exports']=function(_0x33ed88,_0x3abaf2){return _0x33ed88[_0xf4e8('0x8')](_0xf4e8('0x9'),attributes,{'tableName':_0xf4e8('0xa'),'paranoid':![],'indexes':[{'name':_0xf4e8('0xb'),'fields':[_0xf4e8('0xc')],'type':_0xf4e8('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1c0c23,_0x485e24,_0x230584){var _0xfa2e6e=_0x33ed88[_0xf4e8('0xe')];var _0x1d6ce0=_0x1c0c23[_0xf4e8('0xf')]({'plain':!![]});if(_0x1d6ce0['direction']['toLowerCase']()==='in'||_0x1d6ce0[_0xf4e8('0x10')][_0xf4e8('0x11')]()==='out'&&!_0x1d6ce0[_0xf4e8('0x12')]&&!_[_0xf4e8('0x13')](_0x1d6ce0[_0xf4e8('0x14')])){_0xfa2e6e[_0xf4e8('0x15')][_0xf4e8('0x16')]({'where':{'id':_0x1d6ce0[_0xf4e8('0x17')]}})[_0xf4e8('0x18')](function(_0x20f77e){if(_0x20f77e){_0x20f77e['update']({'lastMsgAt':_0x1d6ce0[_0xf4e8('0x19')],'lastMsgDirection':_0x1d6ce0[_0xf4e8('0x10')][_0xf4e8('0x11')]()});}})[_0xf4e8('0x1a')](function(_0x547396){console[_0xf4e8('0x1b')](_0x547396);});}_0x230584();}},'charset':_0xf4e8('0x1c'),'collate':_0xf4e8('0x1d')});}; \ No newline at end of file +var _0xcc90=['get','direction','toLowerCase','out','secret','isNil','UserId','findOne','FaxInteractionId','then','update','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','path','rimraf','exports','FaxMessage','fti_fax_messages','body','FULLTEXT','models'];(function(_0x2e6c19,_0x131233){var _0x52885d=function(_0x38f224){while(--_0x38f224){_0x2e6c19['push'](_0x2e6c19['shift']());}};_0x52885d(++_0x131233);}(_0xcc90,0x1f4));var _0x0cc9=function(_0x2b4048,_0x579711){_0x2b4048=_0x2b4048-0x0;var _0x22783f=_0xcc90[_0x2b4048];return _0x22783f;};'use strict';var _=require(_0x0cc9('0x0'));var util=require(_0x0cc9('0x1'));var logger=require(_0x0cc9('0x2'))('api');var moment=require(_0x0cc9('0x3'));var BPromise=require('bluebird');var rp=require(_0x0cc9('0x4'));var fs=require('fs');var path=require(_0x0cc9('0x5'));var rimraf=require(_0x0cc9('0x6'));var config=require('../../config/environment');var attributes=require('./faxMessage.attributes');module[_0x0cc9('0x7')]=function(_0x304536,_0x58ed26){return _0x304536['define'](_0x0cc9('0x8'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0x0cc9('0x9'),'fields':[_0x0cc9('0xa')],'type':_0x0cc9('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x392adb,_0x3170a4,_0xc275bb){var _0x5408e1=_0x304536[_0x0cc9('0xc')];var _0x3e757b=_0x392adb[_0x0cc9('0xd')]({'plain':!![]});if(_0x3e757b[_0x0cc9('0xe')]['toLowerCase']()==='in'||_0x3e757b[_0x0cc9('0xe')][_0x0cc9('0xf')]()===_0x0cc9('0x10')&&!_0x3e757b[_0x0cc9('0x11')]&&!_[_0x0cc9('0x12')](_0x3e757b[_0x0cc9('0x13')])){_0x5408e1['FaxInteraction'][_0x0cc9('0x14')]({'where':{'id':_0x3e757b[_0x0cc9('0x15')]}})[_0x0cc9('0x16')](function(_0x2a50c1){if(_0x2a50c1){_0x2a50c1[_0x0cc9('0x17')]({'lastMsgAt':_0x3e757b['createdAt'],'lastMsgDirection':_0x3e757b[_0x0cc9('0xe')]['toLowerCase']()});}})[_0x0cc9('0x18')](function(_0xe0564){console[_0x0cc9('0x19')](_0xe0564);});}_0xc275bb();}},'charset':'utf8mb4','collate':_0x0cc9('0x1a')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 1dc0486..79d7a48 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 _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(_0x4f1714,_0x560d1f){var _0x1c2cec=function(_0x5759a0){while(--_0x5759a0){_0x4f1714['push'](_0x4f1714['shift']());}};_0x1c2cec(++_0x560d1f);}(_0x55e0,0xdc));var _0x055e=function(_0x4d16a2,_0x25fad8){_0x4d16a2=_0x4d16a2-0x0;var _0x4529f2=_0x55e0[_0x4d16a2];return _0x4529f2;};'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 +var _0xb903=['options','raw','then','stringify','UpdateFaxMessage','update','where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','request','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','FaxMessage,\x20%s,\x20%s','message','result','catch','CreateFaxMessage','FaxMessage','create','body'];(function(_0x5dc078,_0x38a683){var _0x3d6953=function(_0x56dcfb){while(--_0x56dcfb){_0x5dc078['push'](_0x5dc078['shift']());}};_0x3d6953(++_0x38a683);}(_0xb903,0x185));var _0x3b90=function(_0x503d00,_0x237017){_0x503d00=_0x503d00-0x0;var _0x2c48c8=_0xb903[_0x503d00];return _0x2c48c8;};'use strict';var _=require(_0x3b90('0x0'));var util=require(_0x3b90('0x1'));var moment=require(_0x3b90('0x2'));var BPromise=require(_0x3b90('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3b90('0x4'));var db=require(_0x3b90('0x5'))['db'];var utils=require(_0x3b90('0x6'));var logger=require(_0x3b90('0x7'))(_0x3b90('0x8'));var config=require(_0x3b90('0x9'));var jayson=require(_0x3b90('0xa'));var client=jayson['client'][_0x3b90('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x3b90('0xc')],{'host':_0x3b90('0xd'),'port':0x18eb});var socket=require(_0x3b90('0xe'))(new Redis(config[_0x3b90('0xc')]));require('./faxMessage.socket')['register'](socket);function respondWithRpcPromise(_0x52401e,_0x51f916,_0x56261b){return new BPromise(function(_0x55db3f,_0x336913){return client[_0x3b90('0xf')](_0x52401e,_0x56261b)['then'](function(_0x30c49c){logger[_0x3b90('0x10')]('FaxMessage,\x20%s,\x20%s',_0x51f916,_0x3b90('0x11'));logger[_0x3b90('0x12')](_0x3b90('0x13'),_0x51f916,'request\x20sent',JSON['stringify'](_0x30c49c));if(_0x30c49c[_0x3b90('0x14')]){if(_0x30c49c['error']['code']===0x1f4){logger[_0x3b90('0x14')](_0x3b90('0x15'),_0x51f916,_0x30c49c['error']['message']);return _0x336913(_0x30c49c[_0x3b90('0x14')][_0x3b90('0x16')]);}logger[_0x3b90('0x14')](_0x3b90('0x15'),_0x51f916,_0x30c49c[_0x3b90('0x14')]['message']);return _0x55db3f(_0x30c49c['error'][_0x3b90('0x16')]);}else{logger[_0x3b90('0x10')]('FaxMessage,\x20%s,\x20%s',_0x51f916,_0x3b90('0x11'));_0x55db3f(_0x30c49c[_0x3b90('0x17')][_0x3b90('0x16')]);}})[_0x3b90('0x18')](function(_0x4f388b){logger[_0x3b90('0x14')]('FaxMessage,\x20%s,\x20%s',_0x51f916,_0x4f388b);_0x336913(_0x4f388b);});});}exports[_0x3b90('0x19')]=function(_0x231690){var _0x535894=this;return new Promise(function(_0x39ae7c,_0x12e1cf){return db[_0x3b90('0x1a')][_0x3b90('0x1b')](_0x231690[_0x3b90('0x1c')],{'raw':_0x231690[_0x3b90('0x1d')]?_0x231690[_0x3b90('0x1d')][_0x3b90('0x1e')]===undefined?!![]:![]:!![]})[_0x3b90('0x1f')](function(_0x3e5bb8){logger['info'](_0x3b90('0x19'),_0x231690);logger[_0x3b90('0x12')](_0x3b90('0x19'),_0x231690,JSON[_0x3b90('0x20')](_0x3e5bb8));_0x39ae7c(_0x3e5bb8);})[_0x3b90('0x18')](function(_0x93b8e7){logger['error']('CreateFaxMessage',_0x93b8e7[_0x3b90('0x16')],_0x231690);_0x12e1cf(_0x535894[_0x3b90('0x14')](0x1f4,_0x93b8e7[_0x3b90('0x16')]));});});};exports[_0x3b90('0x21')]=function(_0x583523){var _0x414462=this;return new Promise(function(_0x2936d7,_0x1787d1){return db['FaxMessage'][_0x3b90('0x22')](_0x583523[_0x3b90('0x1c')],{'raw':_0x583523[_0x3b90('0x1d')]?_0x583523[_0x3b90('0x1d')][_0x3b90('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x583523[_0x3b90('0x1d')]?_0x583523['options'][_0x3b90('0x23')]||null:null,'attributes':_0x583523['options']?_0x583523[_0x3b90('0x1d')][_0x3b90('0x24')]||null:null,'limit':_0x583523[_0x3b90('0x1d')]?_0x583523[_0x3b90('0x1d')][_0x3b90('0x25')]||null:null})[_0x3b90('0x1f')](function(_0x290283){logger[_0x3b90('0x10')]('UpdateFaxMessage',_0x583523);logger['debug'](_0x3b90('0x21'),_0x583523,JSON[_0x3b90('0x20')](_0x290283));_0x2936d7(_0x290283);})[_0x3b90('0x18')](function(_0x1c2e84){logger['error']('UpdateFaxMessage',_0x1c2e84[_0x3b90('0x16')],_0x583523);_0x1787d1(_0x414462[_0x3b90('0x14')](0x1f4,_0x1c2e84[_0x3b90('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 4a44ea2..6940a80 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 _0xe978=['emit','register','faxMessage:','./faxMessage.events','save','remove','update'];(function(_0xe1037,_0x42e8ac){var _0x259d35=function(_0xa21d5d){while(--_0xa21d5d){_0xe1037['push'](_0xe1037['shift']());}};_0x259d35(++_0x42e8ac);}(_0xe978,0xb9));var _0x8e97=function(_0x268dc7,_0x3d5b2a){_0x268dc7=_0x268dc7-0x0;var _0x47d68e=_0xe978[_0x268dc7];return _0x47d68e;};'use strict';var FaxMessageEvents=require(_0x8e97('0x0'));var events=[_0x8e97('0x1'),_0x8e97('0x2'),_0x8e97('0x3')];function createListener(_0x956b15,_0x41be3f){return function(_0x3a5b56){_0x41be3f[_0x8e97('0x4')](_0x956b15,_0x3a5b56);};}function removeListener(_0x54d7f2,_0x10fb6f){return function(){FaxMessageEvents['removeListener'](_0x54d7f2,_0x10fb6f);};}exports[_0x8e97('0x5')]=function(_0x10f1e5){for(var _0xd8f882=0x0,_0x4ce46b=events['length'];_0xd8f882<_0x4ce46b;_0xd8f882++){var _0x4a4727=events[_0xd8f882];var _0x4d26f2=createListener(_0x8e97('0x6')+_0x4a4727,_0x10f1e5);FaxMessageEvents['on'](_0x4a4727,_0x4d26f2);}}; \ No newline at end of file +var _0x95d8=['faxMessage:','remove','update','emit','removeListener','register','length'];(function(_0x3b5530,_0x1a263a){var _0xf59680=function(_0x4fd1d8){while(--_0x4fd1d8){_0x3b5530['push'](_0x3b5530['shift']());}};_0xf59680(++_0x1a263a);}(_0x95d8,0x1b3));var _0x895d=function(_0x35d144,_0x48dae8){_0x35d144=_0x35d144-0x0;var _0xb83cfa=_0x95d8[_0x35d144];return _0xb83cfa;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=['save',_0x895d('0x0'),_0x895d('0x1')];function createListener(_0x134ab8,_0x28a87c){return function(_0x5ccac1){_0x28a87c[_0x895d('0x2')](_0x134ab8,_0x5ccac1);};}function removeListener(_0x178a29,_0x190360){return function(){FaxMessageEvents[_0x895d('0x3')](_0x178a29,_0x190360);};}exports[_0x895d('0x4')]=function(_0x2ee1c8){for(var _0x380a2c=0x0,_0x34f6cc=events[_0x895d('0x5')];_0x380a2c<_0x34f6cc;_0x380a2c++){var _0x100e90=events[_0x380a2c];var _0x50acdc=createListener(_0x895d('0x6')+_0x100e90,_0x2ee1c8);FaxMessageEvents['on'](_0x100e90,_0x50acdc);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index dd582e6..873c4b2 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 _0xf72b=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','post','tracked','fax','faxmessage:create','create','put','update','/:id/accept','accept','reject','delete','destroy','exports','multer','path','express'];(function(_0x49b9cf,_0x1a4003){var _0x217140=function(_0x260ae8){while(--_0x260ae8){_0x49b9cf['push'](_0x49b9cf['shift']());}};_0x217140(++_0x1a4003);}(_0xf72b,0x1d9));var _0xbf72=function(_0x2b6c88,_0x5883b2){_0x2b6c88=_0x2b6c88-0x0;var _0x21dca9=_0xf72b[_0x2b6c88];return _0x21dca9;};'use strict';var multer=require(_0xbf72('0x0'));var util=require('util');var path=require(_0xbf72('0x1'));var timeout=require('connect-timeout');var express=require(_0xbf72('0x2'));var router=express[_0xbf72('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbf72('0x4'));var interaction=require(_0xbf72('0x5'));var config=require(_0xbf72('0x6'));var controller=require(_0xbf72('0x7'));router[_0xbf72('0x8')]('/',auth[_0xbf72('0x9')](),controller['index']);router[_0xbf72('0x8')](_0xbf72('0xa'),auth[_0xbf72('0x9')](),controller[_0xbf72('0xb')]);router[_0xbf72('0x8')](_0xbf72('0xc'),auth['isAuthenticated'](),controller[_0xbf72('0xd')]);router['get'](_0xbf72('0xe'),auth[_0xbf72('0x9')](),controller['download']);router[_0xbf72('0xf')]('/',auth[_0xbf72('0x9')](),interaction[_0xbf72('0x10')](_0xbf72('0x11'),_0xbf72('0x12')),controller[_0xbf72('0x13')]);router[_0xbf72('0x14')](_0xbf72('0xc'),auth['isAuthenticated'](),controller[_0xbf72('0x15')]);router[_0xbf72('0x14')](_0xbf72('0x16'),auth['isAuthenticated'](),controller[_0xbf72('0x17')]);router['put']('/:id/reject',auth['isAuthenticated'](),controller[_0xbf72('0x18')]);router[_0xbf72('0x19')](_0xbf72('0xc'),auth[_0xbf72('0x9')](),controller[_0xbf72('0x1a')]);module[_0xbf72('0x1b')]=router; \ No newline at end of file +var _0x702d=['get','index','/describe','describe','/:id','isAuthenticated','show','/:id/download','download','post','tracked','create','put','update','/:id/accept','accept','reject','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x257170,_0x40f5b1){var _0x149834=function(_0x1f5da4){while(--_0x1f5da4){_0x257170['push'](_0x257170['shift']());}};_0x149834(++_0x40f5b1);}(_0x702d,0x147));var _0xd702=function(_0x11f518,_0x4f30dc){_0x11f518=_0x11f518-0x0;var _0x34ab8f=_0x702d[_0x11f518];return _0x34ab8f;};'use strict';var multer=require(_0xd702('0x0'));var util=require(_0xd702('0x1'));var path=require(_0xd702('0x2'));var timeout=require(_0xd702('0x3'));var express=require(_0xd702('0x4'));var router=express['Router']();var fs_extra=require(_0xd702('0x5'));var auth=require(_0xd702('0x6'));var interaction=require(_0xd702('0x7'));var config=require(_0xd702('0x8'));var controller=require('./faxMessage.controller');router[_0xd702('0x9')]('/',auth['isAuthenticated'](),controller[_0xd702('0xa')]);router[_0xd702('0x9')](_0xd702('0xb'),auth['isAuthenticated'](),controller[_0xd702('0xc')]);router['get'](_0xd702('0xd'),auth[_0xd702('0xe')](),controller[_0xd702('0xf')]);router[_0xd702('0x9')](_0xd702('0x10'),auth[_0xd702('0xe')](),controller[_0xd702('0x11')]);router[_0xd702('0x12')]('/',auth[_0xd702('0xe')](),interaction[_0xd702('0x13')]('fax','faxmessage:create'),controller[_0xd702('0x14')]);router[_0xd702('0x15')](_0xd702('0xd'),auth['isAuthenticated'](),controller[_0xd702('0x16')]);router[_0xd702('0x15')](_0xd702('0x17'),auth[_0xd702('0xe')](),controller[_0xd702('0x18')]);router[_0xd702('0x15')]('/:id/reject',auth[_0xd702('0xe')](),controller[_0xd702('0x19')]);router['delete'](_0xd702('0xd'),auth['isAuthenticated'](),controller[_0xd702('0x1a')]);module[_0xd702('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 3ebd338..bc3bed4 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 _0x311d=['sequelize','exports','STRING','name','INTEGER','ENUM','beepall','roundrobin'];(function(_0x332a17,_0x52d653){var _0x15416a=function(_0x7fd97e){while(--_0x7fd97e){_0x332a17['push'](_0x332a17['shift']());}};_0x15416a(++_0x52d653);}(_0x311d,0x78));var _0xd311=function(_0x5a88ea,_0x33a066){_0x5a88ea=_0x5a88ea-0x0;var _0x482a88=_0x311d[_0x5a88ea];return _0x482a88;};'use strict';var Sequelize=require(_0xd311('0x0'));module[_0xd311('0x1')]={'name':{'type':Sequelize[_0xd311('0x2')],'unique':_0xd311('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd311('0x2')]},'timeout':{'type':Sequelize[_0xd311('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd311('0x5')]('rrmemory',_0xd311('0x6'),_0xd311('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xd311('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1173=['exports','STRING','INTEGER','ENUM','rrmemory','roundrobin'];(function(_0x26bd9a,_0x5d6f00){var _0x158159=function(_0x40a123){while(--_0x40a123){_0x26bd9a['push'](_0x26bd9a['shift']());}};_0x158159(++_0x5d6f00);}(_0x1173,0x138));var _0x3117=function(_0x3bc730,_0xa7112b){_0x3bc730=_0x3bc730-0x0;var _0x4a7d76=_0x1173[_0x3bc730];return _0x4a7d76;};'use strict';var Sequelize=require('sequelize');module[_0x3117('0x0')]={'name':{'type':Sequelize[_0x3117('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x3117('0x2')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3117('0x3')](_0x3117('0x4'),'beepall',_0x3117('0x5')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x3117('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index b6db822..0543867 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 _0x646c=['sequelize','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','select','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','value','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','isArray','getAgents','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','./faxQueue.socket','register','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','destroy','get','FaxQueues','UserProfileResource','then','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','FaxQueue','include','findAll','rows','show','includeAll','options','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','describe','findOne','UserFaxQueue','FaxQueueId','User','agent','faxPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x646c,0x1cc));var _0xc646=function(_0x1a7846,_0x59723e){_0x1a7846=_0x1a7846-0x0;var _0x48049=_0x646c[_0x1a7846];return _0x48049;};'use strict';var emlformat=require(_0xc646('0x0'));var rimraf=require(_0xc646('0x1'));var zipdir=require(_0xc646('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc646('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc646('0x4'));var util=require(_0xc646('0x5'));var path=require(_0xc646('0x6'));var sox=require(_0xc646('0x7'));var csv=require(_0xc646('0x8'));var ejs=require(_0xc646('0x9'));var fs=require('fs');var fs_extra=require(_0xc646('0xa'));var _=require(_0xc646('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc646('0xc'));var deskjs=require(_0xc646('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc646('0xe'));var Papa=require('papaparse');var Redis=require(_0xc646('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc646('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc646('0x11'));var utils=require(_0xc646('0x12'));var config=require(_0xc646('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xc646('0x14'))['db'];config['redis']=_[_0xc646('0x15')](config[_0xc646('0x16')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc646('0x16')]));require(_0xc646('0x17'))[_0xc646('0x18')](socket);function respondWithStatusCode(_0xd340f9,_0x1e08da){_0x1e08da=_0x1e08da||0xcc;return function(_0x23c730){if(_0x23c730){return _0xd340f9[_0xc646('0x19')](_0x1e08da);}return _0xd340f9['status'](_0x1e08da)[_0xc646('0x1a')]();};}function respondWithResult(_0xe75518,_0x183382){_0x183382=_0x183382||0xc8;return function(_0x4b9851){if(_0x4b9851){return _0xe75518[_0xc646('0x1b')](_0x183382)['json'](_0x4b9851);}};}function respondWithFilteredResult(_0xea9b33,_0x5a8e71){return function(_0x498f17){if(_0x498f17){var _0x191287=typeof _0x5a8e71[_0xc646('0x1c')]==='undefined'&&typeof _0x5a8e71[_0xc646('0x1d')]===_0xc646('0x1e');var _0x47b77a=_0x498f17[_0xc646('0x1f')];var _0x373e38=_0x191287?0x0:_0x5a8e71['offset'];var _0x3daf34=_0x191287?_0x498f17['count']:_0x5a8e71[_0xc646('0x1c')]+_0x5a8e71['limit'];var _0x5c5486;if(_0x3daf34>=_0x47b77a){_0x3daf34=_0x47b77a;_0x5c5486=0xc8;}else{_0x5c5486=0xce;}_0xea9b33[_0xc646('0x1b')](_0x5c5486);return _0xea9b33[_0xc646('0x20')](_0xc646('0x21'),_0x373e38+'-'+_0x3daf34+'/'+_0x47b77a)[_0xc646('0x22')](_0x498f17);}return null;};}function patchUpdates(_0xaf5040){return function(_0x213334){try{jsonpatch[_0xc646('0x23')](_0x213334,_0xaf5040,!![]);}catch(_0x50323f){return BPromise[_0xc646('0x24')](_0x50323f);}return _0x213334[_0xc646('0x25')]();};}function saveUpdates(_0x4e42aa,_0x56aa75){return function(_0x1f811c){if(_0x1f811c){return _0x1f811c['update'](_0x4e42aa)['then'](function(_0x188293){return _0x188293;});}return null;};}function removeEntity(_0x6129b6,_0xc6f8f8){return function(_0x101e15){if(_0x101e15){return _0x101e15[_0xc646('0x26')]()['then'](function(){var _0x1033c1=_0x101e15[_0xc646('0x27')]({'plain':!![]});var _0x5a67bb=_0xc646('0x28');return db[_0xc646('0x29')][_0xc646('0x26')]({'where':{'type':_0x5a67bb,'resourceId':_0x1033c1['id']}})[_0xc646('0x2a')](function(){return _0x101e15;});})['then'](function(){_0x6129b6[_0xc646('0x1b')](0xcc)[_0xc646('0x1a')]();});}};}function handleEntityNotFound(_0x293f00,_0x56a581){return function(_0x5252d5){if(!_0x5252d5){_0x293f00[_0xc646('0x19')](0x194);}return _0x5252d5;};}function handleError(_0x101d35,_0x5d7096){_0x5d7096=_0x5d7096||0x1f4;return function(_0x4fdcef){logger[_0xc646('0x2b')](_0x4fdcef[_0xc646('0x2c')]);if(_0x4fdcef[_0xc646('0x2d')]){delete _0x4fdcef[_0xc646('0x2d')];}_0x101d35[_0xc646('0x1b')](_0x5d7096)[_0xc646('0x2e')](_0x4fdcef);};}exports[_0xc646('0x2f')]=function(_0x135e91,_0xb00477){var _0x8ad673={},_0x216eb0={},_0x27359e={'count':0x0,'rows':[]};var _0x29e3bb=_['map'](db['FaxQueue'][_0xc646('0x30')],function(_0x4f8dc6){return{'name':_0x4f8dc6[_0xc646('0x31')],'type':_0x4f8dc6[_0xc646('0x32')][_0xc646('0x33')]};});_0x216eb0[_0xc646('0x34')]=_[_0xc646('0x35')](_0x29e3bb,_0xc646('0x2d'));_0x216eb0[_0xc646('0x36')]=_[_0xc646('0x37')](_0x135e91[_0xc646('0x36')]);_0x216eb0['filters']=_[_0xc646('0x38')](_0x216eb0[_0xc646('0x34')],_0x216eb0[_0xc646('0x36')]);_0x8ad673[_0xc646('0x39')]=_['intersection'](_0x216eb0[_0xc646('0x34')],qs[_0xc646('0x3a')](_0x135e91['query'][_0xc646('0x3a')]));_0x8ad673[_0xc646('0x39')]=_0x8ad673['attributes'][_0xc646('0x3b')]?_0x8ad673[_0xc646('0x39')]:_0x216eb0[_0xc646('0x34')];if(!_0x135e91[_0xc646('0x36')][_0xc646('0x3c')](_0xc646('0x3d'))){_0x8ad673['limit']=qs[_0xc646('0x1d')](_0x135e91[_0xc646('0x36')][_0xc646('0x1d')]);_0x8ad673[_0xc646('0x1c')]=qs['offset'](_0x135e91[_0xc646('0x36')][_0xc646('0x1c')]);}_0x8ad673[_0xc646('0x3e')]=qs[_0xc646('0x3f')](_0x135e91['query'][_0xc646('0x3f')]);_0x8ad673[_0xc646('0x40')]=qs[_0xc646('0x41')](_[_0xc646('0x42')](_0x135e91[_0xc646('0x36')],_0x216eb0[_0xc646('0x41')]),_0x29e3bb);if(_0x135e91['query'][_0xc646('0x43')]){_0x8ad673[_0xc646('0x40')]=_['merge'](_0x8ad673['where'],{'$or':_[_0xc646('0x35')](_0x29e3bb,function(_0x163e87){if(_0x163e87[_0xc646('0x32')]!==_0xc646('0x44')){var _0x204ed={};_0x204ed[_0x163e87[_0xc646('0x2d')]]={'$like':'%'+_0x135e91['query'][_0xc646('0x43')]+'%'};return _0x204ed;}})});}_0x8ad673=_[_0xc646('0x45')]({},_0x8ad673,_0x135e91['options']);var _0x1af7e2={'where':_0x8ad673[_0xc646('0x40')]};return db[_0xc646('0x46')][_0xc646('0x1f')](_0x1af7e2)[_0xc646('0x2a')](function(_0x319cb1){_0x27359e[_0xc646('0x1f')]=_0x319cb1;if(_0x135e91['query']['includeAll']){_0x8ad673[_0xc646('0x47')]=[{'all':!![]}];}return db['FaxQueue'][_0xc646('0x48')](_0x8ad673);})[_0xc646('0x2a')](function(_0x37f2eb){_0x27359e[_0xc646('0x49')]=_0x37f2eb;return _0x27359e;})[_0xc646('0x2a')](respondWithFilteredResult(_0xb00477,_0x8ad673))['catch'](handleError(_0xb00477,null));};exports[_0xc646('0x4a')]=function(_0x2aca0a,_0x3102d8){var _0x50fdbd={'raw':!![],'where':{'id':_0x2aca0a['params']['id']}},_0x2c8016={};_0x2c8016[_0xc646('0x34')]=_[_0xc646('0x37')](db[_0xc646('0x46')][_0xc646('0x30')]);_0x2c8016[_0xc646('0x36')]=_[_0xc646('0x37')](_0x2aca0a['query']);_0x2c8016[_0xc646('0x41')]=_[_0xc646('0x38')](_0x2c8016[_0xc646('0x34')],_0x2c8016[_0xc646('0x36')]);_0x50fdbd[_0xc646('0x39')]=_['intersection'](_0x2c8016[_0xc646('0x34')],qs[_0xc646('0x3a')](_0x2aca0a[_0xc646('0x36')][_0xc646('0x3a')]));_0x50fdbd[_0xc646('0x39')]=_0x50fdbd[_0xc646('0x39')]['length']?_0x50fdbd['attributes']:_0x2c8016['model'];if(_0x2aca0a[_0xc646('0x36')][_0xc646('0x4b')]){_0x50fdbd[_0xc646('0x47')]=[{'all':!![]}];}_0x50fdbd=_[_0xc646('0x45')]({},_0x50fdbd,_0x2aca0a[_0xc646('0x4c')]);return db['FaxQueue']['find'](_0x50fdbd)['then'](handleEntityNotFound(_0x3102d8,null))['then'](respondWithResult(_0x3102d8,null))['catch'](handleError(_0x3102d8,null));};exports[_0xc646('0x4d')]=function(_0x525db8,_0x5eabdf){return db['FaxQueue']['create'](_0x525db8['body'],{})[_0xc646('0x2a')](function(_0x47aaa4){var _0x369c4f=_0x525db8['user'][_0xc646('0x27')]({'plain':!![]});if(!_0x369c4f)throw new Error(_0xc646('0x4e'));if(_0x369c4f[_0xc646('0x4f')]===_0xc646('0x50')){var _0x3ce195=_0x47aaa4[_0xc646('0x27')]({'plain':!![]});var _0x160c77=_0xc646('0x28');return db['UserProfileSection'][_0xc646('0x51')]({'where':{'name':_0x160c77,'userProfileId':_0x369c4f[_0xc646('0x52')]},'raw':!![]})[_0xc646('0x2a')](function(_0x2e799f){if(_0x2e799f&&_0x2e799f[_0xc646('0x53')]===0x0){return db[_0xc646('0x29')][_0xc646('0x4d')]({'name':_0x3ce195['name'],'resourceId':_0x3ce195['id'],'type':_0x2e799f[_0xc646('0x2d')],'sectionId':_0x2e799f['id']},{})['then'](function(){return _0x47aaa4;});}else{return _0x47aaa4;}})[_0xc646('0x54')](function(_0xbdd75f){logger[_0xc646('0x2b')](_0xc646('0x55'),_0xbdd75f);throw _0xbdd75f;});}return _0x47aaa4;})[_0xc646('0x2a')](respondWithResult(_0x5eabdf,0xc9))['catch'](handleError(_0x5eabdf,null));};exports[_0xc646('0x56')]=function(_0x25ee89,_0x3076fd){if(_0x25ee89[_0xc646('0x57')]['id']){delete _0x25ee89[_0xc646('0x57')]['id'];}return db['FaxQueue'][_0xc646('0x51')]({'where':{'id':_0x25ee89[_0xc646('0x58')]['id']}})[_0xc646('0x2a')](handleEntityNotFound(_0x3076fd,null))['then'](saveUpdates(_0x25ee89[_0xc646('0x57')],null))[_0xc646('0x2a')](respondWithResult(_0x3076fd,null))[_0xc646('0x54')](handleError(_0x3076fd,null));};exports[_0xc646('0x26')]=function(_0x4a34f1,_0x48a0f9){return db[_0xc646('0x46')]['find']({'where':{'id':_0x4a34f1[_0xc646('0x58')]['id']}})[_0xc646('0x2a')](handleEntityNotFound(_0x48a0f9,null))['then'](removeEntity(_0x48a0f9,null))[_0xc646('0x54')](handleError(_0x48a0f9,null));};exports[_0xc646('0x59')]=function(_0x292118,_0x200a3c){return db['FaxQueue'][_0xc646('0x59')]()[_0xc646('0x2a')](respondWithResult(_0x200a3c,null))[_0xc646('0x54')](handleError(_0x200a3c,null));};exports['getMembers']=function(_0x340841,_0x5f28d2,_0x283279){var _0x538aa5={'raw':!![],'where':{}},_0x1e1e8e={},_0x3d208e;return db[_0xc646('0x46')][_0xc646('0x5a')]({'where':{'id':_0x340841[_0xc646('0x58')]['id']}})[_0xc646('0x2a')](handleEntityNotFound(_0x5f28d2,null))[_0xc646('0x2a')](function(_0xe1e2e0){if(_0xe1e2e0){_0x3d208e=_0xe1e2e0[_0xc646('0x27')]({'plain':!![]});_0x1e1e8e['model']=_[_0xc646('0x37')](db[_0xc646('0x5b')][_0xc646('0x30')]);_0x1e1e8e['query']=_[_0xc646('0x37')](_0x340841[_0xc646('0x36')]);_0x1e1e8e[_0xc646('0x41')]=_['intersection'](_0x1e1e8e[_0xc646('0x34')],_0x1e1e8e[_0xc646('0x36')]);_0x538aa5[_0xc646('0x39')]=_[_0xc646('0x38')](_0x1e1e8e[_0xc646('0x34')],qs[_0xc646('0x3a')](_0x340841[_0xc646('0x36')][_0xc646('0x3a')]));_0x538aa5[_0xc646('0x39')]=_0x538aa5[_0xc646('0x39')][_0xc646('0x3b')]?_0x538aa5[_0xc646('0x39')]:_0x1e1e8e[_0xc646('0x34')];if(!_0x340841[_0xc646('0x36')][_0xc646('0x3c')](_0xc646('0x3d'))){_0x538aa5[_0xc646('0x1d')]=qs['limit'](_0x340841[_0xc646('0x36')][_0xc646('0x1d')]);_0x538aa5[_0xc646('0x1c')]=qs[_0xc646('0x1c')](_0x340841['query']['offset']);}_0x538aa5[_0xc646('0x3e')]=qs[_0xc646('0x3f')](_0x340841[_0xc646('0x36')]['sort']);_0x538aa5[_0xc646('0x40')]=qs[_0xc646('0x41')](_['pick'](_0x340841[_0xc646('0x36')],_0x1e1e8e[_0xc646('0x41')]));_0x538aa5['where'][_0xc646('0x5c')]=_0xe1e2e0['id'];if(_0x340841[_0xc646('0x36')][_0xc646('0x43')]){_0x538aa5['where']=_[_0xc646('0x45')](_0x538aa5[_0xc646('0x40')],{'$or':_['map'](_0x538aa5[_0xc646('0x39')],function(_0x412a51){var _0x260bd2={};_0x260bd2[_0x412a51]={'$like':'%'+_0x340841['query']['filter']+'%'};return _0x260bd2;})});}_0x538aa5=_['merge']({},_0x538aa5,_0x340841[_0xc646('0x4c')]);return db['UserFaxQueue'][_0xc646('0x48')](_0x538aa5);}})['then'](function(_0x18aca5){if(_0x18aca5){return db[_0xc646('0x5d')]['findAndCountAll']({'where':{'id':_[_0xc646('0x35')](_0x18aca5,'UserId'),'role':_0xc646('0x5e')},'attributes':['id',_0xc646('0x2d'),_0xc646('0x5f'),_0xc646('0x60'),_0xc646('0x61')]});}})[_0xc646('0x2a')](function(_0x3c37ee){if(_0x3c37ee){return{'count':_0x3c37ee['count'],'rows':_[_0xc646('0x35')](_0x3c37ee[_0xc646('0x49')],function(_0x550f56){return{'membername':_0x550f56[_0xc646('0x2d')],'UserId':_0x550f56['id'],'queue_name':_0x3d208e[_0xc646('0x2d')],'FaxQueueId':_0x3d208e['id'],'interface':util[_0xc646('0x62')](_0xc646('0x63'),'SIP',_0x550f56[_0xc646('0x2d')]),'penalty':0x0,'paused':_0x550f56[_0xc646('0x5f')],'createdAt':_0x550f56[_0xc646('0x61')],'updatedAt':_0x550f56[_0xc646('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc646('0x2a')](respondWithFilteredResult(_0x5f28d2,_0x538aa5))[_0xc646('0x54')](handleError(_0x5f28d2,null));};exports[_0xc646('0x64')]=function(_0x43fd8f,_0x45dadb,_0x5e8f51){var _0x109b5e={};var _0x127c4d={};var _0x441ec4;var _0x50005e;return db['FaxQueue']['findOne']({'where':{'id':_0x43fd8f[_0xc646('0x58')]['id']}})['then'](handleEntityNotFound(_0x45dadb,null))[_0xc646('0x2a')](function(_0x4adb26){if(_0x4adb26){_0x441ec4=_0x4adb26;_0x127c4d['model']=_[_0xc646('0x37')](db[_0xc646('0x65')][_0xc646('0x30')]);_0x127c4d[_0xc646('0x36')]=_[_0xc646('0x37')](_0x43fd8f[_0xc646('0x36')]);_0x127c4d['filters']=_[_0xc646('0x38')](_0x127c4d['model'],_0x127c4d[_0xc646('0x36')]);_0x109b5e['attributes']=_[_0xc646('0x38')](_0x127c4d['model'],qs['fields'](_0x43fd8f['query'][_0xc646('0x3a')]));_0x109b5e[_0xc646('0x39')]=_0x109b5e[_0xc646('0x39')]['length']?_0x109b5e[_0xc646('0x39')]:_0x127c4d[_0xc646('0x34')];_0x109b5e[_0xc646('0x3e')]=qs['sort'](_0x43fd8f['query'][_0xc646('0x3f')]);_0x109b5e[_0xc646('0x40')]=qs[_0xc646('0x41')](_['pick'](_0x43fd8f[_0xc646('0x36')],_0x127c4d[_0xc646('0x41')]));if(_0x43fd8f[_0xc646('0x36')][_0xc646('0x43')]){_0x109b5e[_0xc646('0x40')]=_[_0xc646('0x45')](_0x109b5e[_0xc646('0x40')],{'$or':_['map'](_0x109b5e[_0xc646('0x39')],function(_0x1316ef){var _0xf4c8b0={};_0xf4c8b0[_0x1316ef]={'$like':'%'+_0x43fd8f[_0xc646('0x36')]['filter']+'%'};return _0xf4c8b0;})});}_0x109b5e=_[_0xc646('0x45')]({},_0x109b5e,_0x43fd8f[_0xc646('0x4c')]);return _0x441ec4[_0xc646('0x64')](_0x109b5e);}})[_0xc646('0x2a')](function(_0x362aee){if(_0x362aee){_0x50005e=_0x362aee[_0xc646('0x3b')];if(!_0x43fd8f[_0xc646('0x36')][_0xc646('0x3c')](_0xc646('0x3d'))){_0x109b5e[_0xc646('0x1d')]=qs[_0xc646('0x1d')](_0x43fd8f['query']['limit']);_0x109b5e['offset']=qs[_0xc646('0x1c')](_0x43fd8f[_0xc646('0x36')][_0xc646('0x1c')]);}return _0x441ec4[_0xc646('0x64')](_0x109b5e);}})[_0xc646('0x2a')](function(_0x5358df){if(_0x5358df){return _0x5358df?{'count':_0x50005e,'rows':_0x5358df}:null;}})[_0xc646('0x2a')](respondWithResult(_0x45dadb,null))[_0xc646('0x54')](handleError(_0x45dadb,null));};exports[_0xc646('0x66')]=function(_0xb9d650,_0x34dce3,_0x4dd997){var _0x432a60=_0xb9d650['body'][_0xc646('0x67')];return db['Team'][_0xc646('0x48')]({'where':{'id':_0x432a60},'attributes':['id'],'include':[{'model':db['User'],'as':_0xc646('0x68'),'attributes':['id',_0xc646('0x2d'),_0xc646('0x69'),_0xc646('0x6a'),_0xc646('0x6b')],'raw':!![]}]})[_0xc646('0x2a')](function(_0x3ab369){if(_0x3ab369){var _0x2fbaae=_['flatMap'](_0x3ab369,function(_0x1f2004){var _0x11f8f4=_0x1f2004['get']({'plain':!![]});return _0x11f8f4['Agents'];});return db[_0xc646('0x46')][_0xc646('0x51')]({'where':{'id':_0xb9d650[_0xc646('0x58')]['id']}})[_0xc646('0x2a')](function(_0x5cca34){return db[_0xc646('0x6c')][_0xc646('0x6d')](function(_0x4baac2){return _0x5cca34[_0xc646('0x66')](_0x432a60,{'transaction':_0x4baac2})[_0xc646('0x2a')](function(){return BPromise[_0xc646('0x6e')](_0x2fbaae,function(_0x37b12b){return db[_0xc646('0x5b')][_0xc646('0x6f')]({'where':{'UserId':_0x37b12b['id'],'FaxQueueId':_0xb9d650['params']['id']},'transaction':_0x4baac2});});})['then'](function(){_0x2fbaae[_0xc646('0x70')](function(_0x1aee1d){socket[_0xc646('0x71')](_0xc646('0x72'),{'UserId':_0x1aee1d['id'],'FaxQueueId':_0x5cca34['id']});});});});});}})[_0xc646('0x2a')](respondWithStatusCode(_0x34dce3,null))[_0xc646('0x54')](handleError(_0x34dce3,null));};exports['removeTeams']=function(_0x3c37b3,_0x57772b,_0xd3e366){return db['Team']['findAll']({'where':{'id':_0x3c37b3['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xc646('0x5d')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xc646('0x2a')](handleEntityNotFound(_0x57772b,null))['then'](function(_0x1d3585){var _0xf455f1=_[_0xc646('0x35')](_0x1d3585,'id');var _0x51ab64=[];var _0x1cd235=[];var _0x5b4b8a=squel[_0xc646('0x73')]();_0x5b4b8a[_0xc646('0x74')](_0xc646('0x75'))[_0xc646('0x76')](_0xc646('0x77'),'tq')[_0xc646('0x78')](_0xc646('0x79'),'ut',_0xc646('0x7a'))[_0xc646('0x40')](_0xc646('0x7b'),_0x3c37b3[_0xc646('0x58')]['id']);for(var _0xd96a07=0x0;_0xd96a07<_0x1d3585[_0xc646('0x3b')];_0xd96a07+=0x1){let _0x24ad77=_0x1d3585[_0xd96a07];for(var _0x3d25b2=0x0;_0x3d25b2<_0x24ad77[_0xc646('0x68')]['length'];_0x3d25b2+=0x1){let _0x169fba=_0x24ad77[_0xc646('0x68')][_0x3d25b2];var _0xedbe1f=_0x5b4b8a[_0xc646('0x7c')]();_0xedbe1f[_0xc646('0x40')](_0xc646('0x7d'),_0x169fba['id']);_0x1cd235[_0xc646('0x7e')](db[_0xc646('0x6c')][_0xc646('0x36')](_0xedbe1f[_0xc646('0x7f')](),{'type':db['sequelize'][_0xc646('0x80')][_0xc646('0x81')]})[_0xc646('0x2a')](function(_0x309052){if(_0x309052[_0xc646('0x3b')]===0x1){return _0x169fba['id'];}else{var _0x46f379=_[_0xc646('0x82')](_[_0xc646('0x35')](_0x309052,_0xc646('0x83')),function(_0x3c5157){return _[_0xc646('0x84')](_0xf455f1,_0x3c5157);});if(_0x46f379){return _0x169fba['id'];}}}));}}return BPromise[_0xc646('0x85')](_0x1cd235)[_0xc646('0x2a')](function(_0x1f4d29){_0x51ab64=_(_0x51ab64)['union'](_0x1f4d29)['compact']()[_0xc646('0x86')]();return db[_0xc646('0x46')]['find']({'where':{'id':_0x3c37b3[_0xc646('0x58')]['id']}})[_0xc646('0x2a')](function(_0x4b6d35){return db[_0xc646('0x6c')]['transaction'](function(_0x6496c5){return _0x4b6d35['removeTeams'](_0x3c37b3[_0xc646('0x36')][_0xc646('0x67')],{'transaction':_0x6496c5})[_0xc646('0x2a')](function(){if(!_[_0xc646('0x87')](_0x51ab64)){return _0x4b6d35[_0xc646('0x88')](_0x51ab64,{'transaction':_0x6496c5});}})['then'](function(){_0x51ab64[_0xc646('0x70')](function(_0x305ba5){socket[_0xc646('0x71')](_0xc646('0x89'),{'UserId':_0x305ba5,'FaxQueueId':_0x4b6d35['id']});});});});});});})[_0xc646('0x2a')](respondWithStatusCode(_0x57772b,null))[_0xc646('0x54')](handleError(_0x57772b,null));};exports['addAgents']=function(_0x1077fa,_0x1c2056,_0x3adb8d){return db[_0xc646('0x46')][_0xc646('0x51')]({'where':{'id':_0x1077fa['params']['id']}})[_0xc646('0x2a')](handleEntityNotFound(_0x1c2056,null))[_0xc646('0x2a')](function(_0x5bc157){if(_0x5bc157){return _0x5bc157[_0xc646('0x8a')](_0x1077fa[_0xc646('0x57')][_0xc646('0x67')],_[_0xc646('0x8b')](_0x1077fa['body'],['ids','id'])||{})['spread'](function(_0x9603d9){for(var _0x1bdbca=0x0;_0x1bdbca<_0x1077fa['body'][_0xc646('0x67')][_0xc646('0x3b')];_0x1bdbca+=0x1){socket[_0xc646('0x71')]('userFaxQueue:save',{'UserId':Number(_0x1077fa['body']['ids'][_0x1bdbca]),'FaxQueueId':Number(_0x1077fa['params']['id'])});}return _0x9603d9;});}})[_0xc646('0x2a')](respondWithResult(_0x1c2056,null))[_0xc646('0x54')](handleError(_0x1c2056,null));};exports['removeAgents']=function(_0x1393ed,_0x18c011,_0x1fbad0){return db['FaxQueue'][_0xc646('0x51')]({'where':{'id':_0x1393ed[_0xc646('0x58')]['id']}})[_0xc646('0x2a')](handleEntityNotFound(_0x18c011,null))[_0xc646('0x2a')](function(_0xf7a821){if(_0xf7a821){return _0xf7a821[_0xc646('0x88')](_0x1393ed[_0xc646('0x36')]['ids'])[_0xc646('0x2a')](function(){if(_[_0xc646('0x8c')](_0x1393ed[_0xc646('0x36')][_0xc646('0x67')])){for(var _0x549a3a=0x0;_0x549a3a<_0x1393ed['query']['ids'][_0xc646('0x3b')];_0x549a3a+=0x1){socket[_0xc646('0x71')]('userFaxQueue:remove',{'UserId':Number(_0x1393ed[_0xc646('0x36')][_0xc646('0x67')][_0x549a3a]),'FaxQueueId':Number(_0x1393ed[_0xc646('0x58')]['id'])});}}else{socket[_0xc646('0x71')](_0xc646('0x89'),{'UserId':Number(_0x1393ed[_0xc646('0x36')][_0xc646('0x67')]),'FaxQueueId':Number(_0x1393ed[_0xc646('0x58')]['id'])});}});}})[_0xc646('0x2a')](respondWithStatusCode(_0x18c011,null))[_0xc646('0x54')](handleError(_0x18c011,null));};exports[_0xc646('0x8d')]=function(_0x1e9be0,_0x10fe75,_0x3a0b85){var _0x50244d={};var _0x2d023d={};var _0x91b6f1;var _0xbf9d9d;return db[_0xc646('0x46')][_0xc646('0x5a')]({'where':{'id':_0x1e9be0[_0xc646('0x58')]['id']}})[_0xc646('0x2a')](handleEntityNotFound(_0x10fe75,null))[_0xc646('0x2a')](function(_0x26a6c0){if(_0x26a6c0){_0x91b6f1=_0x26a6c0;_0x2d023d[_0xc646('0x34')]=_[_0xc646('0x37')](db['User']['rawAttributes']);_0x2d023d[_0xc646('0x36')]=_[_0xc646('0x37')](_0x1e9be0['query']);_0x2d023d[_0xc646('0x41')]=_['intersection'](_0x2d023d[_0xc646('0x34')],_0x2d023d['query']);_0x50244d['attributes']=_[_0xc646('0x38')](_0x2d023d['model'],qs[_0xc646('0x3a')](_0x1e9be0[_0xc646('0x36')][_0xc646('0x3a')]));_0x50244d[_0xc646('0x39')]=_0x50244d['attributes'][_0xc646('0x3b')]?_0x50244d['attributes']:_0x2d023d[_0xc646('0x34')];_0x50244d[_0xc646('0x3e')]=qs[_0xc646('0x3f')](_0x1e9be0[_0xc646('0x36')][_0xc646('0x3f')]);_0x50244d['where']=qs[_0xc646('0x41')](_[_0xc646('0x42')](_0x1e9be0['query'],_0x2d023d['filters']));if(_0x1e9be0[_0xc646('0x36')][_0xc646('0x43')]){_0x50244d['where']=_[_0xc646('0x45')](_0x50244d['where'],{'$or':_['map'](_0x50244d[_0xc646('0x39')],function(_0x43eb24){var _0x566cf9={};_0x566cf9[_0x43eb24]={'$like':'%'+_0x1e9be0[_0xc646('0x36')][_0xc646('0x43')]+'%'};return _0x566cf9;})});}_0x50244d=_[_0xc646('0x45')]({},_0x50244d,_0x1e9be0['options']);return _0x91b6f1[_0xc646('0x8d')](_0x50244d);}})[_0xc646('0x2a')](function(_0x5550f7){if(_0x5550f7){_0xbf9d9d=_0x5550f7[_0xc646('0x3b')];if(!_0x1e9be0[_0xc646('0x36')][_0xc646('0x3c')](_0xc646('0x3d'))){_0x50244d[_0xc646('0x1d')]=qs['limit'](_0x1e9be0[_0xc646('0x36')][_0xc646('0x1d')]);_0x50244d[_0xc646('0x1c')]=qs['offset'](_0x1e9be0[_0xc646('0x36')][_0xc646('0x1c')]);}return _0x91b6f1['getAgents'](_0x50244d);}})[_0xc646('0x2a')](function(_0x430345){if(_0x430345){return _0x430345?{'count':_0xbf9d9d,'rows':_0x430345}:null;}})[_0xc646('0x2a')](respondWithResult(_0x10fe75,null))[_0xc646('0x54')](handleError(_0x10fe75,null));}; \ No newline at end of file +var _0x09c9=['removeAgents','emit','addAgents','omit','spread','userFaxQueue:save','isArray','userFaxQueue:remove','getAgents','findOne','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','redis','defaults','localhost','./faxQueue.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','destroy','then','FaxQueues','UserProfileResource','error','stack','name','map','FaxQueue','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','keys','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','update','params','describe','getMembers','UserFaxQueue','FaxQueueId','findAndCountAll','createdAt','format','%s/%s','faxPause','getTeams','Team','ids','Agents','online','voicePause','interface','sequelize','transaction','addTeams','each','findOrCreate','removeTeams','User','select','tq.TeamId','team_has_fax_queues','join','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','isEmpty'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x09c9,0x116));var _0x909c=function(_0x1c9cad,_0x2e0fd4){_0x1c9cad=_0x1c9cad-0x0;var _0x417d45=_0x09c9[_0x1c9cad];return _0x417d45;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x909c('0x0'));var jsonpatch=require(_0x909c('0x1'));var rp=require(_0x909c('0x2'));var moment=require(_0x909c('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x909c('0x4'));var sox=require(_0x909c('0x5'));var csv=require(_0x909c('0x6'));var ejs=require(_0x909c('0x7'));var fs=require('fs');var fs_extra=require(_0x909c('0x8'));var _=require(_0x909c('0x9'));var squel=require('squel');var crypto=require(_0x909c('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x909c('0xb'));var toCsv=require('to-csv');var querystring=require(_0x909c('0xc'));var Papa=require(_0x909c('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x909c('0xe'));var as=require(_0x909c('0xf'));var hardwareService=require(_0x909c('0x10'));var logger=require(_0x909c('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x909c('0x12'));var licenseUtil=require(_0x909c('0x13'));var db=require('../../mysqldb')['db'];config[_0x909c('0x14')]=_[_0x909c('0x15')](config[_0x909c('0x14')],{'host':_0x909c('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x909c('0x14')]));require(_0x909c('0x17'))[_0x909c('0x18')](socket);function respondWithStatusCode(_0x5aebe9,_0x250ccd){_0x250ccd=_0x250ccd||0xcc;return function(_0x4ec37f){if(_0x4ec37f){return _0x5aebe9[_0x909c('0x19')](_0x250ccd);}return _0x5aebe9[_0x909c('0x1a')](_0x250ccd)[_0x909c('0x1b')]();};}function respondWithResult(_0xcdf5aa,_0x1ab2da){_0x1ab2da=_0x1ab2da||0xc8;return function(_0x12e951){if(_0x12e951){return _0xcdf5aa[_0x909c('0x1a')](_0x1ab2da)['json'](_0x12e951);}};}function respondWithFilteredResult(_0x3a5f7f,_0x1efd2d){return function(_0x35cebf){if(_0x35cebf){var _0x41df19=typeof _0x1efd2d[_0x909c('0x1c')]===_0x909c('0x1d')&&typeof _0x1efd2d[_0x909c('0x1e')]==='undefined';var _0x2e88f3=_0x35cebf[_0x909c('0x1f')];var _0x4ac7dc=_0x41df19?0x0:_0x1efd2d[_0x909c('0x1c')];var _0x4fd4b3=_0x41df19?_0x35cebf[_0x909c('0x1f')]:_0x1efd2d[_0x909c('0x1c')]+_0x1efd2d['limit'];var _0x2254df;if(_0x4fd4b3>=_0x2e88f3){_0x4fd4b3=_0x2e88f3;_0x2254df=0xc8;}else{_0x2254df=0xce;}_0x3a5f7f['status'](_0x2254df);return _0x3a5f7f[_0x909c('0x20')](_0x909c('0x21'),_0x4ac7dc+'-'+_0x4fd4b3+'/'+_0x2e88f3)[_0x909c('0x22')](_0x35cebf);}return null;};}function patchUpdates(_0x20d5db){return function(_0x563c9b){try{jsonpatch[_0x909c('0x23')](_0x563c9b,_0x20d5db,!![]);}catch(_0x46a4f5){return BPromise[_0x909c('0x24')](_0x46a4f5);}return _0x563c9b[_0x909c('0x25')]();};}function saveUpdates(_0x3f0168,_0xffc4d3){return function(_0x20ca0b){if(_0x20ca0b){return _0x20ca0b['update'](_0x3f0168)['then'](function(_0x469164){return _0x469164;});}return null;};}function removeEntity(_0x19d72b,_0x49a723){return function(_0x58d582){if(_0x58d582){return _0x58d582[_0x909c('0x26')]()[_0x909c('0x27')](function(){var _0x2d3714=_0x58d582['get']({'plain':!![]});var _0x1b7738=_0x909c('0x28');return db[_0x909c('0x29')][_0x909c('0x26')]({'where':{'type':_0x1b7738,'resourceId':_0x2d3714['id']}})[_0x909c('0x27')](function(){return _0x58d582;});})['then'](function(){_0x19d72b['status'](0xcc)[_0x909c('0x1b')]();});}};}function handleEntityNotFound(_0x17cbdd,_0x5069eb){return function(_0x40b0f7){if(!_0x40b0f7){_0x17cbdd[_0x909c('0x19')](0x194);}return _0x40b0f7;};}function handleError(_0x849d62,_0x308de8){_0x308de8=_0x308de8||0x1f4;return function(_0xe9b65a){logger[_0x909c('0x2a')](_0xe9b65a[_0x909c('0x2b')]);if(_0xe9b65a['name']){delete _0xe9b65a[_0x909c('0x2c')];}_0x849d62[_0x909c('0x1a')](_0x308de8)['send'](_0xe9b65a);};}exports['index']=function(_0x1a1da2,_0x4ea6f2){var _0x52f66f={},_0x34f07a={},_0xba6e33={'count':0x0,'rows':[]};var _0x2e56a4=_[_0x909c('0x2d')](db[_0x909c('0x2e')][_0x909c('0x2f')],function(_0x60e77){return{'name':_0x60e77[_0x909c('0x30')],'type':_0x60e77[_0x909c('0x31')][_0x909c('0x32')]};});_0x34f07a['model']=_[_0x909c('0x2d')](_0x2e56a4,_0x909c('0x2c'));_0x34f07a[_0x909c('0x33')]=_['keys'](_0x1a1da2[_0x909c('0x33')]);_0x34f07a[_0x909c('0x34')]=_[_0x909c('0x35')](_0x34f07a[_0x909c('0x36')],_0x34f07a['query']);_0x52f66f[_0x909c('0x37')]=_[_0x909c('0x35')](_0x34f07a[_0x909c('0x36')],qs['fields'](_0x1a1da2['query'][_0x909c('0x38')]));_0x52f66f['attributes']=_0x52f66f[_0x909c('0x37')][_0x909c('0x39')]?_0x52f66f[_0x909c('0x37')]:_0x34f07a['model'];if(!_0x1a1da2[_0x909c('0x33')][_0x909c('0x3a')](_0x909c('0x3b'))){_0x52f66f[_0x909c('0x1e')]=qs['limit'](_0x1a1da2[_0x909c('0x33')]['limit']);_0x52f66f[_0x909c('0x1c')]=qs[_0x909c('0x1c')](_0x1a1da2[_0x909c('0x33')]['offset']);}_0x52f66f[_0x909c('0x3c')]=qs[_0x909c('0x3d')](_0x1a1da2['query'][_0x909c('0x3d')]);_0x52f66f[_0x909c('0x3e')]=qs['filters'](_[_0x909c('0x3f')](_0x1a1da2['query'],_0x34f07a['filters']),_0x2e56a4);if(_0x1a1da2[_0x909c('0x33')]['filter']){_0x52f66f[_0x909c('0x3e')]=_['merge'](_0x52f66f['where'],{'$or':_[_0x909c('0x2d')](_0x2e56a4,function(_0x51fbb0){if(_0x51fbb0[_0x909c('0x31')]!=='VIRTUAL'){var _0x4e7289={};_0x4e7289[_0x51fbb0[_0x909c('0x2c')]]={'$like':'%'+_0x1a1da2[_0x909c('0x33')][_0x909c('0x40')]+'%'};return _0x4e7289;}})});}_0x52f66f=_[_0x909c('0x41')]({},_0x52f66f,_0x1a1da2[_0x909c('0x42')]);var _0xbdbecf={'where':_0x52f66f['where']};return db[_0x909c('0x2e')][_0x909c('0x1f')](_0xbdbecf)[_0x909c('0x27')](function(_0x43137f){_0xba6e33[_0x909c('0x1f')]=_0x43137f;if(_0x1a1da2[_0x909c('0x33')][_0x909c('0x43')]){_0x52f66f[_0x909c('0x44')]=[{'all':!![]}];}return db['FaxQueue'][_0x909c('0x45')](_0x52f66f);})['then'](function(_0x1ada0a){_0xba6e33[_0x909c('0x46')]=_0x1ada0a;return _0xba6e33;})['then'](respondWithFilteredResult(_0x4ea6f2,_0x52f66f))['catch'](handleError(_0x4ea6f2,null));};exports[_0x909c('0x47')]=function(_0x4a1c22,_0x551b32){var _0x5e1abc={'raw':!![],'where':{'id':_0x4a1c22['params']['id']}},_0x4767ca={};_0x4767ca['model']=_[_0x909c('0x48')](db[_0x909c('0x2e')][_0x909c('0x2f')]);_0x4767ca[_0x909c('0x33')]=_[_0x909c('0x48')](_0x4a1c22[_0x909c('0x33')]);_0x4767ca[_0x909c('0x34')]=_[_0x909c('0x35')](_0x4767ca[_0x909c('0x36')],_0x4767ca[_0x909c('0x33')]);_0x5e1abc[_0x909c('0x37')]=_[_0x909c('0x35')](_0x4767ca[_0x909c('0x36')],qs[_0x909c('0x38')](_0x4a1c22[_0x909c('0x33')][_0x909c('0x38')]));_0x5e1abc[_0x909c('0x37')]=_0x5e1abc[_0x909c('0x37')][_0x909c('0x39')]?_0x5e1abc[_0x909c('0x37')]:_0x4767ca[_0x909c('0x36')];if(_0x4a1c22[_0x909c('0x33')]['includeAll']){_0x5e1abc[_0x909c('0x44')]=[{'all':!![]}];}_0x5e1abc=_[_0x909c('0x41')]({},_0x5e1abc,_0x4a1c22[_0x909c('0x42')]);return db[_0x909c('0x2e')]['find'](_0x5e1abc)[_0x909c('0x27')](handleEntityNotFound(_0x551b32,null))[_0x909c('0x27')](respondWithResult(_0x551b32,null))[_0x909c('0x49')](handleError(_0x551b32,null));};exports[_0x909c('0x4a')]=function(_0x14ba9a,_0x13eb9a){return db[_0x909c('0x2e')][_0x909c('0x4a')](_0x14ba9a[_0x909c('0x4b')],{})[_0x909c('0x27')](function(_0x42d3fe){var _0x3812e0=_0x14ba9a['user'][_0x909c('0x4c')]({'plain':!![]});if(!_0x3812e0)throw new Error(_0x909c('0x4d'));if(_0x3812e0['role']==='user'){var _0x631a9=_0x42d3fe[_0x909c('0x4c')]({'plain':!![]});var _0x3eea1e=_0x909c('0x28');return db[_0x909c('0x4e')][_0x909c('0x4f')]({'where':{'name':_0x3eea1e,'userProfileId':_0x3812e0[_0x909c('0x50')]},'raw':!![]})[_0x909c('0x27')](function(_0x17df58){if(_0x17df58&&_0x17df58[_0x909c('0x51')]===0x0){return db[_0x909c('0x29')]['create']({'name':_0x631a9['name'],'resourceId':_0x631a9['id'],'type':_0x17df58[_0x909c('0x2c')],'sectionId':_0x17df58['id']},{})['then'](function(){return _0x42d3fe;});}else{return _0x42d3fe;}})[_0x909c('0x49')](function(_0x59ca1d){logger[_0x909c('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x59ca1d);throw _0x59ca1d;});}return _0x42d3fe;})[_0x909c('0x27')](respondWithResult(_0x13eb9a,0xc9))[_0x909c('0x49')](handleError(_0x13eb9a,null));};exports[_0x909c('0x52')]=function(_0x3a0e15,_0x17c00f){if(_0x3a0e15[_0x909c('0x4b')]['id']){delete _0x3a0e15[_0x909c('0x4b')]['id'];}return db['FaxQueue']['find']({'where':{'id':_0x3a0e15[_0x909c('0x53')]['id']}})[_0x909c('0x27')](handleEntityNotFound(_0x17c00f,null))[_0x909c('0x27')](saveUpdates(_0x3a0e15[_0x909c('0x4b')],null))[_0x909c('0x27')](respondWithResult(_0x17c00f,null))['catch'](handleError(_0x17c00f,null));};exports[_0x909c('0x26')]=function(_0x56efbc,_0x252db3){return db[_0x909c('0x2e')][_0x909c('0x4f')]({'where':{'id':_0x56efbc[_0x909c('0x53')]['id']}})[_0x909c('0x27')](handleEntityNotFound(_0x252db3,null))[_0x909c('0x27')](removeEntity(_0x252db3,null))[_0x909c('0x49')](handleError(_0x252db3,null));};exports[_0x909c('0x54')]=function(_0x5971cc,_0x26a1f1){return db[_0x909c('0x2e')][_0x909c('0x54')]()[_0x909c('0x27')](respondWithResult(_0x26a1f1,null))[_0x909c('0x49')](handleError(_0x26a1f1,null));};exports[_0x909c('0x55')]=function(_0x307106,_0x31b7ca,_0x12bf86){var _0xc25e4d={'raw':!![],'where':{}},_0xda3ae4={},_0x71ea64;return db[_0x909c('0x2e')]['findOne']({'where':{'id':_0x307106[_0x909c('0x53')]['id']}})[_0x909c('0x27')](handleEntityNotFound(_0x31b7ca,null))[_0x909c('0x27')](function(_0x475731){if(_0x475731){_0x71ea64=_0x475731[_0x909c('0x4c')]({'plain':!![]});_0xda3ae4['model']=_[_0x909c('0x48')](db[_0x909c('0x56')][_0x909c('0x2f')]);_0xda3ae4['query']=_['keys'](_0x307106['query']);_0xda3ae4[_0x909c('0x34')]=_['intersection'](_0xda3ae4[_0x909c('0x36')],_0xda3ae4[_0x909c('0x33')]);_0xc25e4d[_0x909c('0x37')]=_['intersection'](_0xda3ae4['model'],qs[_0x909c('0x38')](_0x307106[_0x909c('0x33')][_0x909c('0x38')]));_0xc25e4d[_0x909c('0x37')]=_0xc25e4d[_0x909c('0x37')][_0x909c('0x39')]?_0xc25e4d[_0x909c('0x37')]:_0xda3ae4[_0x909c('0x36')];if(!_0x307106[_0x909c('0x33')][_0x909c('0x3a')](_0x909c('0x3b'))){_0xc25e4d['limit']=qs['limit'](_0x307106['query']['limit']);_0xc25e4d[_0x909c('0x1c')]=qs['offset'](_0x307106['query'][_0x909c('0x1c')]);}_0xc25e4d[_0x909c('0x3c')]=qs[_0x909c('0x3d')](_0x307106[_0x909c('0x33')]['sort']);_0xc25e4d['where']=qs[_0x909c('0x34')](_['pick'](_0x307106[_0x909c('0x33')],_0xda3ae4[_0x909c('0x34')]));_0xc25e4d[_0x909c('0x3e')][_0x909c('0x57')]=_0x475731['id'];if(_0x307106[_0x909c('0x33')][_0x909c('0x40')]){_0xc25e4d[_0x909c('0x3e')]=_['merge'](_0xc25e4d['where'],{'$or':_[_0x909c('0x2d')](_0xc25e4d[_0x909c('0x37')],function(_0x27d233){var _0x3c32aa={};_0x3c32aa[_0x27d233]={'$like':'%'+_0x307106[_0x909c('0x33')][_0x909c('0x40')]+'%'};return _0x3c32aa;})});}_0xc25e4d=_[_0x909c('0x41')]({},_0xc25e4d,_0x307106[_0x909c('0x42')]);return db[_0x909c('0x56')][_0x909c('0x45')](_0xc25e4d);}})[_0x909c('0x27')](function(_0x314e6f){if(_0x314e6f){return db['User'][_0x909c('0x58')]({'where':{'id':_[_0x909c('0x2d')](_0x314e6f,'UserId'),'role':'agent'},'attributes':['id',_0x909c('0x2c'),'faxPause','updatedAt',_0x909c('0x59')]});}})[_0x909c('0x27')](function(_0x5db30a){if(_0x5db30a){return{'count':_0x5db30a[_0x909c('0x1f')],'rows':_['map'](_0x5db30a['rows'],function(_0x1bfb8b){return{'membername':_0x1bfb8b['name'],'UserId':_0x1bfb8b['id'],'queue_name':_0x71ea64['name'],'FaxQueueId':_0x71ea64['id'],'interface':util[_0x909c('0x5a')](_0x909c('0x5b'),'SIP',_0x1bfb8b['name']),'penalty':0x0,'paused':_0x1bfb8b[_0x909c('0x5c')],'createdAt':_0x1bfb8b[_0x909c('0x59')],'updatedAt':_0x1bfb8b['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x909c('0x27')](respondWithFilteredResult(_0x31b7ca,_0xc25e4d))[_0x909c('0x49')](handleError(_0x31b7ca,null));};exports[_0x909c('0x5d')]=function(_0xb4c1aa,_0x37f58a,_0x259b53){var _0x4a2ac8={};var _0x5a2387={};var _0x4a9a43;var _0x5b5ed6;return db[_0x909c('0x2e')]['findOne']({'where':{'id':_0xb4c1aa[_0x909c('0x53')]['id']}})[_0x909c('0x27')](handleEntityNotFound(_0x37f58a,null))[_0x909c('0x27')](function(_0x2fb49a){if(_0x2fb49a){_0x4a9a43=_0x2fb49a;_0x5a2387[_0x909c('0x36')]=_[_0x909c('0x48')](db[_0x909c('0x5e')][_0x909c('0x2f')]);_0x5a2387[_0x909c('0x33')]=_[_0x909c('0x48')](_0xb4c1aa['query']);_0x5a2387[_0x909c('0x34')]=_[_0x909c('0x35')](_0x5a2387['model'],_0x5a2387[_0x909c('0x33')]);_0x4a2ac8[_0x909c('0x37')]=_[_0x909c('0x35')](_0x5a2387[_0x909c('0x36')],qs[_0x909c('0x38')](_0xb4c1aa['query'][_0x909c('0x38')]));_0x4a2ac8[_0x909c('0x37')]=_0x4a2ac8[_0x909c('0x37')][_0x909c('0x39')]?_0x4a2ac8[_0x909c('0x37')]:_0x5a2387[_0x909c('0x36')];_0x4a2ac8[_0x909c('0x3c')]=qs['sort'](_0xb4c1aa[_0x909c('0x33')][_0x909c('0x3d')]);_0x4a2ac8[_0x909c('0x3e')]=qs[_0x909c('0x34')](_[_0x909c('0x3f')](_0xb4c1aa['query'],_0x5a2387[_0x909c('0x34')]));if(_0xb4c1aa['query'][_0x909c('0x40')]){_0x4a2ac8[_0x909c('0x3e')]=_[_0x909c('0x41')](_0x4a2ac8[_0x909c('0x3e')],{'$or':_[_0x909c('0x2d')](_0x4a2ac8[_0x909c('0x37')],function(_0x3784db){var _0x43c0bf={};_0x43c0bf[_0x3784db]={'$like':'%'+_0xb4c1aa['query'][_0x909c('0x40')]+'%'};return _0x43c0bf;})});}_0x4a2ac8=_[_0x909c('0x41')]({},_0x4a2ac8,_0xb4c1aa[_0x909c('0x42')]);return _0x4a9a43[_0x909c('0x5d')](_0x4a2ac8);}})[_0x909c('0x27')](function(_0x343d7c){if(_0x343d7c){_0x5b5ed6=_0x343d7c[_0x909c('0x39')];if(!_0xb4c1aa[_0x909c('0x33')][_0x909c('0x3a')]('nolimit')){_0x4a2ac8[_0x909c('0x1e')]=qs[_0x909c('0x1e')](_0xb4c1aa[_0x909c('0x33')][_0x909c('0x1e')]);_0x4a2ac8[_0x909c('0x1c')]=qs[_0x909c('0x1c')](_0xb4c1aa[_0x909c('0x33')][_0x909c('0x1c')]);}return _0x4a9a43[_0x909c('0x5d')](_0x4a2ac8);}})[_0x909c('0x27')](function(_0x34b493){if(_0x34b493){return _0x34b493?{'count':_0x5b5ed6,'rows':_0x34b493}:null;}})[_0x909c('0x27')](respondWithResult(_0x37f58a,null))[_0x909c('0x49')](handleError(_0x37f58a,null));};exports['addTeams']=function(_0x37ee19,_0x4681e9,_0x466fd1){var _0x2adf72=_0x37ee19[_0x909c('0x4b')][_0x909c('0x5f')];return db[_0x909c('0x5e')]['findAll']({'where':{'id':_0x2adf72},'attributes':['id'],'include':[{'model':db['User'],'as':_0x909c('0x60'),'attributes':['id','name',_0x909c('0x61'),_0x909c('0x62'),_0x909c('0x63')],'raw':!![]}]})[_0x909c('0x27')](function(_0x447fb0){if(_0x447fb0){var _0x513e53=_['flatMap'](_0x447fb0,function(_0x5be009){var _0x41f581=_0x5be009['get']({'plain':!![]});return _0x41f581[_0x909c('0x60')];});return db[_0x909c('0x2e')][_0x909c('0x4f')]({'where':{'id':_0x37ee19[_0x909c('0x53')]['id']}})[_0x909c('0x27')](function(_0x59eb08){return db[_0x909c('0x64')][_0x909c('0x65')](function(_0x408120){return _0x59eb08[_0x909c('0x66')](_0x2adf72,{'transaction':_0x408120})[_0x909c('0x27')](function(){return BPromise[_0x909c('0x67')](_0x513e53,function(_0x5de2c2){return db[_0x909c('0x56')][_0x909c('0x68')]({'where':{'UserId':_0x5de2c2['id'],'FaxQueueId':_0x37ee19[_0x909c('0x53')]['id']},'transaction':_0x408120});});})[_0x909c('0x27')](function(){_0x513e53['forEach'](function(_0x539550){socket['emit']('userFaxQueue:save',{'UserId':_0x539550['id'],'FaxQueueId':_0x59eb08['id']});});});});});}})[_0x909c('0x27')](respondWithStatusCode(_0x4681e9,null))[_0x909c('0x49')](handleError(_0x4681e9,null));};exports[_0x909c('0x69')]=function(_0x5970cb,_0x64a63a,_0x3363ac){return db['Team'][_0x909c('0x45')]({'where':{'id':_0x5970cb[_0x909c('0x33')]['ids']},'attributes':['id'],'include':[{'model':db[_0x909c('0x6a')],'as':_0x909c('0x60'),'attributes':['id'],'raw':!![]}]})[_0x909c('0x27')](handleEntityNotFound(_0x64a63a,null))[_0x909c('0x27')](function(_0x45739d){var _0x3961ed=_[_0x909c('0x2d')](_0x45739d,'id');var _0x37be10=[];var _0x435ea8=[];var _0x2e8abb=squel[_0x909c('0x6b')]();_0x2e8abb['field'](_0x909c('0x6c'))['from'](_0x909c('0x6d'),'tq')[_0x909c('0x6e')]('user_has_teams','ut',_0x909c('0x6f'))['where'](_0x909c('0x70'),_0x5970cb[_0x909c('0x53')]['id']);for(var _0x23ea41=0x0;_0x23ea41<_0x45739d['length'];_0x23ea41+=0x1){let _0x5c0b36=_0x45739d[_0x23ea41];for(var _0x348545=0x0;_0x348545<_0x5c0b36[_0x909c('0x60')][_0x909c('0x39')];_0x348545+=0x1){let _0x5239b4=_0x5c0b36[_0x909c('0x60')][_0x348545];var _0x4c0c6d=_0x2e8abb['clone']();_0x4c0c6d[_0x909c('0x3e')](_0x909c('0x71'),_0x5239b4['id']);_0x435ea8[_0x909c('0x72')](db[_0x909c('0x64')][_0x909c('0x33')](_0x4c0c6d[_0x909c('0x73')](),{'type':db[_0x909c('0x64')][_0x909c('0x74')][_0x909c('0x75')]})[_0x909c('0x27')](function(_0x30e7c1){if(_0x30e7c1[_0x909c('0x39')]===0x1){return _0x5239b4['id'];}else{var _0x20339f=_[_0x909c('0x76')](_[_0x909c('0x2d')](_0x30e7c1,_0x909c('0x77')),function(_0x5133d6){return _[_0x909c('0x78')](_0x3961ed,_0x5133d6);});if(_0x20339f){return _0x5239b4['id'];}}}));}}return BPromise['all'](_0x435ea8)[_0x909c('0x27')](function(_0x4c6bb0){_0x37be10=_(_0x37be10)[_0x909c('0x79')](_0x4c6bb0)[_0x909c('0x7a')]()['value']();return db[_0x909c('0x2e')]['find']({'where':{'id':_0x5970cb['params']['id']}})[_0x909c('0x27')](function(_0x12c956){return db[_0x909c('0x64')][_0x909c('0x65')](function(_0xfd50e4){return _0x12c956['removeTeams'](_0x5970cb[_0x909c('0x33')][_0x909c('0x5f')],{'transaction':_0xfd50e4})[_0x909c('0x27')](function(){if(!_[_0x909c('0x7b')](_0x37be10)){return _0x12c956[_0x909c('0x7c')](_0x37be10,{'transaction':_0xfd50e4});}})['then'](function(){_0x37be10['forEach'](function(_0x2ba33f){socket[_0x909c('0x7d')]('userFaxQueue:remove',{'UserId':_0x2ba33f,'FaxQueueId':_0x12c956['id']});});});});});});})[_0x909c('0x27')](respondWithStatusCode(_0x64a63a,null))[_0x909c('0x49')](handleError(_0x64a63a,null));};exports[_0x909c('0x7e')]=function(_0x43eac4,_0x1e5069,_0x1f2427){return db[_0x909c('0x2e')][_0x909c('0x4f')]({'where':{'id':_0x43eac4[_0x909c('0x53')]['id']}})['then'](handleEntityNotFound(_0x1e5069,null))[_0x909c('0x27')](function(_0xa6f85d){if(_0xa6f85d){return _0xa6f85d[_0x909c('0x7e')](_0x43eac4[_0x909c('0x4b')][_0x909c('0x5f')],_[_0x909c('0x7f')](_0x43eac4['body'],[_0x909c('0x5f'),'id'])||{})[_0x909c('0x80')](function(_0x1a4312){for(var _0x25c813=0x0;_0x25c813<_0x43eac4[_0x909c('0x4b')][_0x909c('0x5f')][_0x909c('0x39')];_0x25c813+=0x1){socket[_0x909c('0x7d')](_0x909c('0x81'),{'UserId':Number(_0x43eac4[_0x909c('0x4b')][_0x909c('0x5f')][_0x25c813]),'FaxQueueId':Number(_0x43eac4[_0x909c('0x53')]['id'])});}return _0x1a4312;});}})[_0x909c('0x27')](respondWithResult(_0x1e5069,null))['catch'](handleError(_0x1e5069,null));};exports[_0x909c('0x7c')]=function(_0x276260,_0x2c4a17,_0x53d9bb){return db['FaxQueue'][_0x909c('0x4f')]({'where':{'id':_0x276260[_0x909c('0x53')]['id']}})[_0x909c('0x27')](handleEntityNotFound(_0x2c4a17,null))[_0x909c('0x27')](function(_0x4e4ab6){if(_0x4e4ab6){return _0x4e4ab6[_0x909c('0x7c')](_0x276260[_0x909c('0x33')][_0x909c('0x5f')])[_0x909c('0x27')](function(){if(_[_0x909c('0x82')](_0x276260['query'][_0x909c('0x5f')])){for(var _0x193404=0x0;_0x193404<_0x276260[_0x909c('0x33')]['ids']['length'];_0x193404+=0x1){socket['emit'](_0x909c('0x83'),{'UserId':Number(_0x276260[_0x909c('0x33')][_0x909c('0x5f')][_0x193404]),'FaxQueueId':Number(_0x276260['params']['id'])});}}else{socket[_0x909c('0x7d')](_0x909c('0x83'),{'UserId':Number(_0x276260[_0x909c('0x33')]['ids']),'FaxQueueId':Number(_0x276260['params']['id'])});}});}})[_0x909c('0x27')](respondWithStatusCode(_0x2c4a17,null))['catch'](handleError(_0x2c4a17,null));};exports[_0x909c('0x84')]=function(_0x4be9e9,_0x2389c9,_0x4489cb){var _0x1dcd96={};var _0x477577={};var _0x316adf;var _0x4f62fd;return db[_0x909c('0x2e')][_0x909c('0x85')]({'where':{'id':_0x4be9e9[_0x909c('0x53')]['id']}})['then'](handleEntityNotFound(_0x2389c9,null))[_0x909c('0x27')](function(_0x4d7820){if(_0x4d7820){_0x316adf=_0x4d7820;_0x477577[_0x909c('0x36')]=_[_0x909c('0x48')](db['User']['rawAttributes']);_0x477577['query']=_[_0x909c('0x48')](_0x4be9e9['query']);_0x477577[_0x909c('0x34')]=_[_0x909c('0x35')](_0x477577['model'],_0x477577[_0x909c('0x33')]);_0x1dcd96[_0x909c('0x37')]=_[_0x909c('0x35')](_0x477577[_0x909c('0x36')],qs[_0x909c('0x38')](_0x4be9e9[_0x909c('0x33')][_0x909c('0x38')]));_0x1dcd96[_0x909c('0x37')]=_0x1dcd96['attributes']['length']?_0x1dcd96['attributes']:_0x477577['model'];_0x1dcd96[_0x909c('0x3c')]=qs[_0x909c('0x3d')](_0x4be9e9[_0x909c('0x33')][_0x909c('0x3d')]);_0x1dcd96[_0x909c('0x3e')]=qs['filters'](_['pick'](_0x4be9e9[_0x909c('0x33')],_0x477577[_0x909c('0x34')]));if(_0x4be9e9[_0x909c('0x33')][_0x909c('0x40')]){_0x1dcd96[_0x909c('0x3e')]=_[_0x909c('0x41')](_0x1dcd96[_0x909c('0x3e')],{'$or':_[_0x909c('0x2d')](_0x1dcd96[_0x909c('0x37')],function(_0x10fb20){var _0x5d9b84={};_0x5d9b84[_0x10fb20]={'$like':'%'+_0x4be9e9[_0x909c('0x33')][_0x909c('0x40')]+'%'};return _0x5d9b84;})});}_0x1dcd96=_[_0x909c('0x41')]({},_0x1dcd96,_0x4be9e9[_0x909c('0x42')]);return _0x316adf['getAgents'](_0x1dcd96);}})[_0x909c('0x27')](function(_0x3de8c8){if(_0x3de8c8){_0x4f62fd=_0x3de8c8['length'];if(!_0x4be9e9[_0x909c('0x33')][_0x909c('0x3a')](_0x909c('0x3b'))){_0x1dcd96[_0x909c('0x1e')]=qs['limit'](_0x4be9e9[_0x909c('0x33')]['limit']);_0x1dcd96['offset']=qs[_0x909c('0x1c')](_0x4be9e9[_0x909c('0x33')][_0x909c('0x1c')]);}return _0x316adf[_0x909c('0x84')](_0x1dcd96);}})[_0x909c('0x27')](function(_0x59d4ab){if(_0x59d4ab){return _0x59d4ab?{'count':_0x4f62fd,'rows':_0x59d4ab}:null;}})[_0x909c('0x27')](respondWithResult(_0x2389c9,null))['catch'](handleError(_0x2389c9,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 133ab6e..8f7d9fc 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 _0x5899=['exports','events','../../mysqldb','FaxQueue','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x31d4f1,_0x3b6f3c){var _0x15a3fc=function(_0x24c55e){while(--_0x24c55e){_0x31d4f1['push'](_0x31d4f1['shift']());}};_0x15a3fc(++_0x3b6f3c);}(_0x5899,0x12d));var _0x9589=function(_0x2d8c82,_0x82c0a){_0x2d8c82=_0x2d8c82-0x0;var _0x382843=_0x5899[_0x2d8c82];return _0x382843;};'use strict';var EventEmitter=require(_0x9589('0x0'));var FaxQueue=require(_0x9589('0x1'))['db'][_0x9589('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9589('0x3'),'afterUpdate':_0x9589('0x4'),'afterDestroy':_0x9589('0x5')};function emitEvent(_0x3074b4){return function(_0x2bb2e3,_0x36caca,_0x194242){FaxQueueEvents[_0x9589('0x6')](_0x3074b4+':'+_0x2bb2e3['id'],_0x2bb2e3);FaxQueueEvents[_0x9589('0x6')](_0x3074b4,_0x2bb2e3);_0x194242(null);};}for(var e in events){if(events[_0x9589('0x7')](e)){var event=events[e];FaxQueue[_0x9589('0x8')](e,emitEvent(event));}}module[_0x9589('0x9')]=FaxQueueEvents; \ No newline at end of file +var _0x0cd1=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x0cd1,0x114));var _0x10cd=function(_0x47d804,_0x5cc88f){_0x47d804=_0x47d804-0x0;var _0x284c47=_0x0cd1[_0x47d804];return _0x284c47;};'use strict';var EventEmitter=require(_0x10cd('0x0'));var FaxQueue=require(_0x10cd('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x10cd('0x2')](0x0);var events={'afterCreate':_0x10cd('0x3'),'afterUpdate':_0x10cd('0x4'),'afterDestroy':_0x10cd('0x5')};function emitEvent(_0x13bcb6){return function(_0x4714c3,_0x97e1e4,_0x13a372){FaxQueueEvents[_0x10cd('0x6')](_0x13bcb6+':'+_0x4714c3['id'],_0x4714c3);FaxQueueEvents[_0x10cd('0x6')](_0x13bcb6,_0x4714c3);_0x13a372(null);};}for(var e in events){if(events[_0x10cd('0x7')](e)){var event=events[e];FaxQueue[_0x10cd('0x8')](e,emitEvent(event));}}module[_0x10cd('0x9')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 7b4ad65..b3471b3 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 _0x2cc1=['./faxQueue.attributes','exports','define','FaxQueue','fax_queues','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x4c783d,_0x3a86cc){var _0x541562=function(_0x2f1658){while(--_0x2f1658){_0x4c783d['push'](_0x4c783d['shift']());}};_0x541562(++_0x3a86cc);}(_0x2cc1,0x87));var _0x12cc=function(_0x16bb1c,_0x58f468){_0x16bb1c=_0x16bb1c-0x0;var _0xace56c=_0x2cc1[_0x16bb1c];return _0xace56c;};'use strict';var _=require('lodash');var util=require(_0x12cc('0x0'));var logger=require(_0x12cc('0x1'))(_0x12cc('0x2'));var moment=require(_0x12cc('0x3'));var BPromise=require('bluebird');var rp=require(_0x12cc('0x4'));var fs=require('fs');var path=require(_0x12cc('0x5'));var rimraf=require(_0x12cc('0x6'));var config=require(_0x12cc('0x7'));var attributes=require(_0x12cc('0x8'));module[_0x12cc('0x9')]=function(_0x1bf089,_0x46d96d){return _0x1bf089[_0x12cc('0xa')](_0x12cc('0xb'),attributes,{'tableName':_0x12cc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda94=['define','FaxQueue','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes'];(function(_0x4c0622,_0x5dacaf){var _0x1799d8=function(_0x2ba801){while(--_0x2ba801){_0x4c0622['push'](_0x4c0622['shift']());}};_0x1799d8(++_0x5dacaf);}(_0xda94,0x15e));var _0x4da9=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xda94[_0x11005e];return _0x29338f;};'use strict';var _=require(_0x4da9('0x0'));var util=require(_0x4da9('0x1'));var logger=require(_0x4da9('0x2'))('api');var moment=require(_0x4da9('0x3'));var BPromise=require(_0x4da9('0x4'));var rp=require(_0x4da9('0x5'));var fs=require('fs');var path=require(_0x4da9('0x6'));var rimraf=require(_0x4da9('0x7'));var config=require(_0x4da9('0x8'));var attributes=require(_0x4da9('0x9'));module['exports']=function(_0x20660d,_0x32674d){return _0x20660d[_0x4da9('0xa')](_0x4da9('0xb'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index b17062d..8a55382 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 _0xc541=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','FaxQueue,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','GetFaxQueue','FaxQueue','options','where','attributes','limit','include','map','model','ShowFaxQueue','find','catch','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc541,0x1a1));var _0x1c54=function(_0x544072,_0xc41ee1){_0x544072=_0x544072-0x0;var _0x590bf6=_0xc541[_0x544072];return _0x590bf6;};'use strict';var _=require(_0x1c54('0x0'));var util=require('util');var moment=require(_0x1c54('0x1'));var BPromise=require(_0x1c54('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1c54('0x3'));var db=require(_0x1c54('0x4'))['db'];var utils=require(_0x1c54('0x5'));var logger=require('../../config/logger')(_0x1c54('0x6'));var config=require(_0x1c54('0x7'));var jayson=require(_0x1c54('0x8'));var client=jayson[_0x1c54('0x9')]['http']({'port':0x232a});config[_0x1c54('0xa')]=_[_0x1c54('0xb')](config['redis'],{'host':_0x1c54('0xc'),'port':0x18eb});var socket=require(_0x1c54('0xd'))(new Redis(config['redis']));require('./faxQueue.socket')[_0x1c54('0xe')](socket);function respondWithRpcPromise(_0x10dfd9,_0x3c2108,_0x29fd05){return new BPromise(function(_0x457df7,_0x15f2e6){return client[_0x1c54('0xf')](_0x10dfd9,_0x29fd05)[_0x1c54('0x10')](function(_0x465c4e){logger[_0x1c54('0x11')](_0x1c54('0x12'),_0x3c2108,'request\x20sent');logger[_0x1c54('0x13')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x3c2108,'request\x20sent',JSON[_0x1c54('0x14')](_0x465c4e));if(_0x465c4e['error']){if(_0x465c4e[_0x1c54('0x15')][_0x1c54('0x16')]===0x1f4){logger['error']('FaxQueue,\x20%s,\x20%s',_0x3c2108,_0x465c4e[_0x1c54('0x15')][_0x1c54('0x17')]);return _0x15f2e6(_0x465c4e[_0x1c54('0x15')]['message']);}logger[_0x1c54('0x15')]('FaxQueue,\x20%s,\x20%s',_0x3c2108,_0x465c4e[_0x1c54('0x15')][_0x1c54('0x17')]);return _0x457df7(_0x465c4e['error'][_0x1c54('0x17')]);}else{logger['info'](_0x1c54('0x12'),_0x3c2108,_0x1c54('0x18'));_0x457df7(_0x465c4e[_0x1c54('0x19')][_0x1c54('0x17')]);}})['catch'](function(_0x5c8777){logger[_0x1c54('0x15')]('FaxQueue,\x20%s,\x20%s',_0x3c2108,_0x5c8777);_0x15f2e6(_0x5c8777);});});}exports[_0x1c54('0x1a')]=function(_0x56eeac){var _0x1278e8=this;return new Promise(function(_0xf2e694,_0x523e4d){return db[_0x1c54('0x1b')]['findAll']({'raw':_0x56eeac[_0x1c54('0x1c')]?_0x56eeac['options']['raw']===undefined?!![]:![]:!![],'where':_0x56eeac[_0x1c54('0x1c')]?_0x56eeac[_0x1c54('0x1c')][_0x1c54('0x1d')]||null:null,'attributes':_0x56eeac[_0x1c54('0x1c')]?_0x56eeac['options'][_0x1c54('0x1e')]||null:null,'limit':_0x56eeac['options']?_0x56eeac[_0x1c54('0x1c')][_0x1c54('0x1f')]||null:null,'include':_0x56eeac[_0x1c54('0x1c')]?_0x56eeac[_0x1c54('0x1c')][_0x1c54('0x20')]?_[_0x1c54('0x21')](_0x56eeac[_0x1c54('0x1c')][_0x1c54('0x20')],function(_0x46701e){return{'model':db[_0x46701e[_0x1c54('0x22')]],'as':_0x46701e['as'],'attributes':_0x46701e['attributes'],'include':_0x46701e['include']?_[_0x1c54('0x21')](_0x46701e[_0x1c54('0x20')],function(_0x1fe82a){return{'model':db[_0x1fe82a[_0x1c54('0x22')]],'as':_0x1fe82a['as'],'attributes':_0x1fe82a[_0x1c54('0x1e')],'include':_0x1fe82a[_0x1c54('0x20')]?_[_0x1c54('0x21')](_0x1fe82a[_0x1c54('0x20')],function(_0x47ff71){return{'model':db[_0x47ff71[_0x1c54('0x22')]],'as':_0x47ff71['as'],'attributes':_0x47ff71[_0x1c54('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1c54('0x10')](function(_0x597f3c){logger[_0x1c54('0x11')](_0x1c54('0x1a'),_0x56eeac);logger[_0x1c54('0x13')](_0x1c54('0x1a'),_0x56eeac,JSON['stringify'](_0x597f3c));_0xf2e694(_0x597f3c);})['catch'](function(_0x4af5ce){logger[_0x1c54('0x15')](_0x1c54('0x1a'),_0x4af5ce[_0x1c54('0x17')],_0x56eeac);_0x523e4d(_0x1278e8[_0x1c54('0x15')](0x1f4,_0x4af5ce[_0x1c54('0x17')]));});});};exports[_0x1c54('0x23')]=function(_0x41d13a){var _0x5a44b0=this;return new Promise(function(_0x296c5e,_0x233906){return db[_0x1c54('0x1b')][_0x1c54('0x24')]({'raw':_0x41d13a['options']?_0x41d13a[_0x1c54('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x41d13a[_0x1c54('0x1c')]?_0x41d13a[_0x1c54('0x1c')][_0x1c54('0x1d')]||null:null,'attributes':_0x41d13a[_0x1c54('0x1c')]?_0x41d13a[_0x1c54('0x1c')]['attributes']||null:null,'include':_0x41d13a[_0x1c54('0x1c')]?_0x41d13a['options'][_0x1c54('0x20')]?_[_0x1c54('0x21')](_0x41d13a['options']['include'],function(_0x1aca19){return{'model':db[_0x1aca19[_0x1c54('0x22')]],'as':_0x1aca19['as'],'attributes':_0x1aca19[_0x1c54('0x1e')],'include':_0x1aca19['include']?_[_0x1c54('0x21')](_0x1aca19['include'],function(_0x2b993c){return{'model':db[_0x2b993c[_0x1c54('0x22')]],'as':_0x2b993c['as'],'attributes':_0x2b993c[_0x1c54('0x1e')],'include':_0x2b993c[_0x1c54('0x20')]?_[_0x1c54('0x21')](_0x2b993c[_0x1c54('0x20')],function(_0x33c1c5){return{'model':db[_0x33c1c5['model']],'as':_0x33c1c5['as'],'attributes':_0x33c1c5[_0x1c54('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1c54('0x10')](function(_0x3d7484){logger['info'](_0x1c54('0x23'),_0x41d13a);logger['debug'](_0x1c54('0x23'),_0x41d13a,JSON[_0x1c54('0x14')](_0x3d7484));_0x296c5e(_0x3d7484);})[_0x1c54('0x25')](function(_0x1c6080){logger[_0x1c54('0x15')]('ShowFaxQueue',_0x1c6080[_0x1c54('0x17')],_0x41d13a);_0x233906(_0x5a44b0[_0x1c54('0x15')](0x1f4,_0x1c6080['message']));});});}; \ No newline at end of file +var _0x5e14=['jayson/promise','client','http','redis','defaults','socket.io-emitter','request','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxQueue','FaxQueue','options','raw','attributes','limit','include','map','model','ShowFaxQueue','find','where','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0xb0072b,_0x564ce4){var _0x5ea422=function(_0x11e9d3){while(--_0x11e9d3){_0xb0072b['push'](_0xb0072b['shift']());}};_0x5ea422(++_0x564ce4);}(_0x5e14,0x187));var _0x45e1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e14[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x45e1('0x0'));var util=require(_0x45e1('0x1'));var moment=require(_0x45e1('0x2'));var BPromise=require(_0x45e1('0x3'));var rs=require(_0x45e1('0x4'));var fs=require('fs');var Redis=require(_0x45e1('0x5'));var db=require(_0x45e1('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x45e1('0x7'))(_0x45e1('0x8'));var config=require('../../config/environment');var jayson=require(_0x45e1('0x9'));var client=jayson[_0x45e1('0xa')][_0x45e1('0xb')]({'port':0x232a});config[_0x45e1('0xc')]=_[_0x45e1('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x45e1('0xe'))(new Redis(config[_0x45e1('0xc')]));require('./faxQueue.socket')['register'](socket);function respondWithRpcPromise(_0x142cca,_0x390c6a,_0xcd089b){return new BPromise(function(_0x22ddd7,_0x3154b5){return client[_0x45e1('0xf')](_0x142cca,_0xcd089b)['then'](function(_0x460556){logger[_0x45e1('0x10')](_0x45e1('0x11'),_0x390c6a,_0x45e1('0x12'));logger[_0x45e1('0x13')](_0x45e1('0x14'),_0x390c6a,_0x45e1('0x12'),JSON[_0x45e1('0x15')](_0x460556));if(_0x460556[_0x45e1('0x16')]){if(_0x460556['error'][_0x45e1('0x17')]===0x1f4){logger[_0x45e1('0x16')](_0x45e1('0x11'),_0x390c6a,_0x460556['error'][_0x45e1('0x18')]);return _0x3154b5(_0x460556['error'][_0x45e1('0x18')]);}logger[_0x45e1('0x16')](_0x45e1('0x11'),_0x390c6a,_0x460556['error'][_0x45e1('0x18')]);return _0x22ddd7(_0x460556['error'][_0x45e1('0x18')]);}else{logger[_0x45e1('0x10')]('FaxQueue,\x20%s,\x20%s',_0x390c6a,_0x45e1('0x12'));_0x22ddd7(_0x460556[_0x45e1('0x19')][_0x45e1('0x18')]);}})[_0x45e1('0x1a')](function(_0x58efe9){logger[_0x45e1('0x16')]('FaxQueue,\x20%s,\x20%s',_0x390c6a,_0x58efe9);_0x3154b5(_0x58efe9);});});}exports[_0x45e1('0x1b')]=function(_0x3b5a4e){var _0x57b907=this;return new Promise(function(_0x31c882,_0x219f09){return db[_0x45e1('0x1c')]['findAll']({'raw':_0x3b5a4e[_0x45e1('0x1d')]?_0x3b5a4e['options'][_0x45e1('0x1e')]===undefined?!![]:![]:!![],'where':_0x3b5a4e[_0x45e1('0x1d')]?_0x3b5a4e[_0x45e1('0x1d')]['where']||null:null,'attributes':_0x3b5a4e['options']?_0x3b5a4e['options'][_0x45e1('0x1f')]||null:null,'limit':_0x3b5a4e['options']?_0x3b5a4e[_0x45e1('0x1d')][_0x45e1('0x20')]||null:null,'include':_0x3b5a4e[_0x45e1('0x1d')]?_0x3b5a4e[_0x45e1('0x1d')][_0x45e1('0x21')]?_[_0x45e1('0x22')](_0x3b5a4e[_0x45e1('0x1d')]['include'],function(_0x49910a){return{'model':db[_0x49910a['model']],'as':_0x49910a['as'],'attributes':_0x49910a[_0x45e1('0x1f')],'include':_0x49910a[_0x45e1('0x21')]?_[_0x45e1('0x22')](_0x49910a[_0x45e1('0x21')],function(_0x5b440b){return{'model':db[_0x5b440b[_0x45e1('0x23')]],'as':_0x5b440b['as'],'attributes':_0x5b440b['attributes'],'include':_0x5b440b[_0x45e1('0x21')]?_['map'](_0x5b440b[_0x45e1('0x21')],function(_0x4af75c){return{'model':db[_0x4af75c['model']],'as':_0x4af75c['as'],'attributes':_0x4af75c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f2fad){logger[_0x45e1('0x10')](_0x45e1('0x1b'),_0x3b5a4e);logger['debug'](_0x45e1('0x1b'),_0x3b5a4e,JSON['stringify'](_0x1f2fad));_0x31c882(_0x1f2fad);})[_0x45e1('0x1a')](function(_0x2aeb03){logger[_0x45e1('0x16')]('GetFaxQueue',_0x2aeb03['message'],_0x3b5a4e);_0x219f09(_0x57b907['error'](0x1f4,_0x2aeb03[_0x45e1('0x18')]));});});};exports[_0x45e1('0x24')]=function(_0x5d0ec8){var _0xc0c175=this;return new Promise(function(_0x199910,_0x3fbd72){return db[_0x45e1('0x1c')][_0x45e1('0x25')]({'raw':_0x5d0ec8[_0x45e1('0x1d')]?_0x5d0ec8[_0x45e1('0x1d')][_0x45e1('0x1e')]===undefined?!![]:![]:!![],'where':_0x5d0ec8[_0x45e1('0x1d')]?_0x5d0ec8[_0x45e1('0x1d')][_0x45e1('0x26')]||null:null,'attributes':_0x5d0ec8['options']?_0x5d0ec8[_0x45e1('0x1d')][_0x45e1('0x1f')]||null:null,'include':_0x5d0ec8[_0x45e1('0x1d')]?_0x5d0ec8[_0x45e1('0x1d')][_0x45e1('0x21')]?_[_0x45e1('0x22')](_0x5d0ec8[_0x45e1('0x1d')][_0x45e1('0x21')],function(_0x1bea1e){return{'model':db[_0x1bea1e[_0x45e1('0x23')]],'as':_0x1bea1e['as'],'attributes':_0x1bea1e[_0x45e1('0x1f')],'include':_0x1bea1e[_0x45e1('0x21')]?_[_0x45e1('0x22')](_0x1bea1e[_0x45e1('0x21')],function(_0x4a8cc6){return{'model':db[_0x4a8cc6['model']],'as':_0x4a8cc6['as'],'attributes':_0x4a8cc6[_0x45e1('0x1f')],'include':_0x4a8cc6[_0x45e1('0x21')]?_[_0x45e1('0x22')](_0x4a8cc6['include'],function(_0x241636){return{'model':db[_0x241636[_0x45e1('0x23')]],'as':_0x241636['as'],'attributes':_0x241636[_0x45e1('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x45e1('0x27')](function(_0x4eae0f){logger[_0x45e1('0x10')](_0x45e1('0x24'),_0x5d0ec8);logger[_0x45e1('0x13')](_0x45e1('0x24'),_0x5d0ec8,JSON[_0x45e1('0x15')](_0x4eae0f));_0x199910(_0x4eae0f);})[_0x45e1('0x1a')](function(_0x34f03b){logger[_0x45e1('0x16')](_0x45e1('0x24'),_0x34f03b['message'],_0x5d0ec8);_0x3fbd72(_0xc0c175[_0x45e1('0x16')](0x1f4,_0x34f03b['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 025ff6f..c2c5b4a 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 _0xbc82=['removeListener','faxQueue:','./faxQueue.events','emit'];(function(_0x38f737,_0x54f685){var _0x7afda3=function(_0x1ac1d7){while(--_0x1ac1d7){_0x38f737['push'](_0x38f737['shift']());}};_0x7afda3(++_0x54f685);}(_0xbc82,0x13e));var _0x2bc8=function(_0x32b425,_0xad2119){_0x32b425=_0x32b425-0x0;var _0x2ed879=_0xbc82[_0x32b425];return _0x2ed879;};'use strict';var FaxQueueEvents=require(_0x2bc8('0x0'));var events=['save','remove','update'];function createListener(_0x3bc1d0,_0x592f73){return function(_0x4af601){_0x592f73[_0x2bc8('0x1')](_0x3bc1d0,_0x4af601);};}function removeListener(_0x5c8329,_0x528bc4){return function(){FaxQueueEvents[_0x2bc8('0x2')](_0x5c8329,_0x528bc4);};}exports['register']=function(_0x54d303){for(var _0x3d12fc=0x0,_0x52fde0=events['length'];_0x3d12fc<_0x52fde0;_0x3d12fc++){var _0x20a193=events[_0x3d12fc];var _0x88fae1=createListener(_0x2bc8('0x3')+_0x20a193,_0x54d303);FaxQueueEvents['on'](_0x20a193,_0x88fae1);}}; \ No newline at end of file +var _0xcbf6=['./faxQueue.events','remove','update','emit','removeListener','faxQueue:'];(function(_0x5365e3,_0x264205){var _0x15d9be=function(_0x2497b1){while(--_0x2497b1){_0x5365e3['push'](_0x5365e3['shift']());}};_0x15d9be(++_0x264205);}(_0xcbf6,0xd8));var _0x6cbf=function(_0xba0394,_0x2c6844){_0xba0394=_0xba0394-0x0;var _0x1789dd=_0xcbf6[_0xba0394];return _0x1789dd;};'use strict';var FaxQueueEvents=require(_0x6cbf('0x0'));var events=['save',_0x6cbf('0x1'),_0x6cbf('0x2')];function createListener(_0x288727,_0x5a3ea3){return function(_0x243650){_0x5a3ea3[_0x6cbf('0x3')](_0x288727,_0x243650);};}function removeListener(_0x581716,_0x366fbc){return function(){FaxQueueEvents[_0x6cbf('0x4')](_0x581716,_0x366fbc);};}exports['register']=function(_0x1fb618){for(var _0x54a974=0x0,_0x4e226f=events['length'];_0x54a974<_0x4e226f;_0x54a974++){var _0x14f27a=events[_0x54a974];var _0x5d4306=createListener(_0x6cbf('0x5')+_0x14f27a,_0x1fb618);FaxQueueEvents['on'](_0x14f27a,_0x5d4306);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index dfea107..a41c21b 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 _0xafc4=['exports','multer','path','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','/:id','show','/:id/members','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','update','delete','destroy','removeTeams','removeAgents'];(function(_0x123096,_0x2a12f9){var _0x574b96=function(_0x59ef70){while(--_0x59ef70){_0x123096['push'](_0x123096['shift']());}};_0x574b96(++_0x2a12f9);}(_0xafc4,0x69));var _0x4afc=function(_0x4441e9,_0x36c7d4){_0x4441e9=_0x4441e9-0x0;var _0x1f9a88=_0xafc4[_0x4441e9];return _0x1f9a88;};'use strict';var multer=require(_0x4afc('0x0'));var util=require('util');var path=require(_0x4afc('0x1'));var timeout=require('connect-timeout');var express=require(_0x4afc('0x2'));var router=express[_0x4afc('0x3')]();var fs_extra=require(_0x4afc('0x4'));var auth=require(_0x4afc('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./faxQueue.controller');router[_0x4afc('0x6')]('/',auth[_0x4afc('0x7')](),controller[_0x4afc('0x8')]);router[_0x4afc('0x6')](_0x4afc('0x9'),auth[_0x4afc('0x7')](),controller['describe']);router[_0x4afc('0x6')](_0x4afc('0xa'),auth[_0x4afc('0x7')](),controller[_0x4afc('0xb')]);router[_0x4afc('0x6')](_0x4afc('0xc'),auth['isAuthenticated'](),controller['getMembers']);router[_0x4afc('0x6')]('/:id/teams',auth[_0x4afc('0x7')](),controller[_0x4afc('0xd')]);router['get'](_0x4afc('0xe'),auth[_0x4afc('0x7')](),controller[_0x4afc('0xf')]);router[_0x4afc('0x10')]('/',auth[_0x4afc('0x7')](),controller[_0x4afc('0x11')]);router[_0x4afc('0x10')](_0x4afc('0x12'),auth['isAuthenticated'](),controller[_0x4afc('0x13')]);router[_0x4afc('0x10')](_0x4afc('0xe'),auth[_0x4afc('0x7')](),controller['addAgents']);router['put'](_0x4afc('0xa'),auth['isAuthenticated'](),controller[_0x4afc('0x14')]);router[_0x4afc('0x15')](_0x4afc('0xa'),auth[_0x4afc('0x7')](),controller[_0x4afc('0x16')]);router[_0x4afc('0x15')](_0x4afc('0x12'),auth[_0x4afc('0x7')](),controller[_0x4afc('0x17')]);router[_0x4afc('0x15')](_0x4afc('0xe'),auth['isAuthenticated'](),controller[_0x4afc('0x18')]);module[_0x4afc('0x19')]=router; \ No newline at end of file +var _0x01d9=['post','addTeams','addAgents','put','update','delete','destroy','removeTeams','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create'];(function(_0x3ce3c6,_0x1115ba){var _0x1a2c99=function(_0x25c448){while(--_0x25c448){_0x3ce3c6['push'](_0x3ce3c6['shift']());}};_0x1a2c99(++_0x1115ba);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var path=require(_0x901d('0x2'));var timeout=require(_0x901d('0x3'));var express=require('express');var router=express[_0x901d('0x4')]();var fs_extra=require(_0x901d('0x5'));var auth=require(_0x901d('0x6'));var interaction=require(_0x901d('0x7'));var config=require(_0x901d('0x8'));var controller=require(_0x901d('0x9'));router[_0x901d('0xa')]('/',auth['isAuthenticated'](),controller[_0x901d('0xb')]);router[_0x901d('0xa')](_0x901d('0xc'),auth[_0x901d('0xd')](),controller[_0x901d('0xe')]);router[_0x901d('0xa')](_0x901d('0xf'),auth[_0x901d('0xd')](),controller[_0x901d('0x10')]);router[_0x901d('0xa')](_0x901d('0x11'),auth[_0x901d('0xd')](),controller[_0x901d('0x12')]);router['get'](_0x901d('0x13'),auth['isAuthenticated'](),controller[_0x901d('0x14')]);router[_0x901d('0xa')](_0x901d('0x15'),auth[_0x901d('0xd')](),controller[_0x901d('0x16')]);router['post']('/',auth[_0x901d('0xd')](),controller[_0x901d('0x17')]);router[_0x901d('0x18')](_0x901d('0x13'),auth[_0x901d('0xd')](),controller[_0x901d('0x19')]);router['post'](_0x901d('0x15'),auth[_0x901d('0xd')](),controller[_0x901d('0x1a')]);router[_0x901d('0x1b')](_0x901d('0xf'),auth[_0x901d('0xd')](),controller[_0x901d('0x1c')]);router[_0x901d('0x1d')](_0x901d('0xf'),auth[_0x901d('0xd')](),controller[_0x901d('0x1e')]);router[_0x901d('0x1d')](_0x901d('0x13'),auth[_0x901d('0xd')](),controller[_0x901d('0x1f')]);router[_0x901d('0x1d')](_0x901d('0x15'),auth[_0x901d('0xd')](),controller['removeAgents']);module[_0x901d('0x20')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 455847e..2bdef5a 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 _0x8440=['DATE','moment','sequelize','exports','STRING'];(function(_0x3a04ab,_0x31b9fd){var _0x4bff6d=function(_0x125f7e){while(--_0x125f7e){_0x3a04ab['push'](_0x3a04ab['shift']());}};_0x4bff6d(++_0x31b9fd);}(_0x8440,0x187));var _0x0844=function(_0x31a51b,_0x4775e8){_0x31a51b=_0x31a51b-0x0;var _0x38d5d8=_0x8440[_0x31a51b];return _0x38d5d8;};'use strict';var moment=require(_0x0844('0x0'));var Sequelize=require(_0x0844('0x1'));module[_0x0844('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x0844('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x0844('0x4')]},'acceptAt':{'type':Sequelize[_0x0844('0x4')]},'exitAt':{'type':Sequelize[_0x0844('0x4')]},'reason':{'type':Sequelize[_0x0844('0x3')]}}; \ No newline at end of file +var _0x490c=['STRING','DATE','moment','exports'];(function(_0x1562a2,_0x2e4655){var _0x39a636=function(_0x25483a){while(--_0x25483a){_0x1562a2['push'](_0x1562a2['shift']());}};_0x39a636(++_0x2e4655);}(_0x490c,0x186));var _0xc490=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0x490c[_0x2d8fc2];return _0x3a9e53;};'use strict';var moment=require(_0xc490('0x0'));var Sequelize=require('sequelize');module[_0xc490('0x1')]={'uniqueid':{'type':Sequelize[_0xc490('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xc490('0x2')]},'joinAt':{'type':Sequelize[_0xc490('0x3')]},'leaveAt':{'type':Sequelize[_0xc490('0x3')]},'acceptAt':{'type':Sequelize[_0xc490('0x3')]},'exitAt':{'type':Sequelize[_0xc490('0x3')]},'reason':{'type':Sequelize[_0xc490('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 8d6c483..a49ce87 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 _0xa62c=['error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','FaxQueueReport','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','save','update','then','destroy','end'];(function(_0x5897f5,_0x5c375f){var _0x4fbceb=function(_0x53edf6){while(--_0x53edf6){_0x5897f5['push'](_0x5897f5['shift']());}};_0x4fbceb(++_0x5c375f);}(_0xa62c,0x70));var _0xca62=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0xa62c[_0x51c819];return _0x15c5d2;};'use strict';var emlformat=require(_0xca62('0x0'));var rimraf=require(_0xca62('0x1'));var zipdir=require(_0xca62('0x2'));var jsonpatch=require(_0xca62('0x3'));var rp=require(_0xca62('0x4'));var moment=require(_0xca62('0x5'));var BPromise=require(_0xca62('0x6'));var Mustache=require('mustache');var util=require(_0xca62('0x7'));var path=require(_0xca62('0x8'));var sox=require(_0xca62('0x9'));var csv=require(_0xca62('0xa'));var ejs=require(_0xca62('0xb'));var fs=require('fs');var fs_extra=require(_0xca62('0xc'));var _=require(_0xca62('0xd'));var squel=require(_0xca62('0xe'));var crypto=require('crypto');var jsforce=require(_0xca62('0xf'));var deskjs=require(_0xca62('0x10'));var toCsv=require(_0xca62('0xa'));var querystring=require('querystring');var Papa=require(_0xca62('0x11'));var Redis=require(_0xca62('0x12'));var authService=require(_0xca62('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xca62('0x14'));var hardwareService=require(_0xca62('0x15'));var logger=require(_0xca62('0x16'))(_0xca62('0x17'));var utils=require(_0xca62('0x18'));var config=require(_0xca62('0x19'));var licenseUtil=require(_0xca62('0x1a'));var db=require(_0xca62('0x1b'))['db'];function respondWithStatusCode(_0x2ba621,_0x59cfd8){_0x59cfd8=_0x59cfd8||0xcc;return function(_0x23a20b){if(_0x23a20b){return _0x2ba621[_0xca62('0x1c')](_0x59cfd8);}return _0x2ba621[_0xca62('0x1d')](_0x59cfd8)['end']();};}function respondWithResult(_0x4a0835,_0x5446a3){_0x5446a3=_0x5446a3||0xc8;return function(_0x307a30){if(_0x307a30){return _0x4a0835['status'](_0x5446a3)[_0xca62('0x1e')](_0x307a30);}};}function respondWithFilteredResult(_0x1634b2,_0x539a04){return function(_0x4f93fc){if(_0x4f93fc){var _0x21eae8=typeof _0x539a04[_0xca62('0x1f')]===_0xca62('0x20')&&typeof _0x539a04['limit']===_0xca62('0x20');var _0x98db4c=_0x4f93fc[_0xca62('0x21')];var _0x58d6f6=_0x21eae8?0x0:_0x539a04[_0xca62('0x1f')];var _0x34a370=_0x21eae8?_0x4f93fc[_0xca62('0x21')]:_0x539a04[_0xca62('0x1f')]+_0x539a04[_0xca62('0x22')];var _0x1b62bb;if(_0x34a370>=_0x98db4c){_0x34a370=_0x98db4c;_0x1b62bb=0xc8;}else{_0x1b62bb=0xce;}_0x1634b2[_0xca62('0x1d')](_0x1b62bb);return _0x1634b2[_0xca62('0x23')](_0xca62('0x24'),_0x58d6f6+'-'+_0x34a370+'/'+_0x98db4c)[_0xca62('0x1e')](_0x4f93fc);}return null;};}function patchUpdates(_0x133132){return function(_0x1dff07){try{jsonpatch['apply'](_0x1dff07,_0x133132,!![]);}catch(_0x4c05c2){return BPromise['reject'](_0x4c05c2);}return _0x1dff07[_0xca62('0x25')]();};}function saveUpdates(_0x138177,_0x3f2a52){return function(_0x3d4730){if(_0x3d4730){return _0x3d4730[_0xca62('0x26')](_0x138177)[_0xca62('0x27')](function(_0x364c8d){return _0x364c8d;});}return null;};}function removeEntity(_0x3eb516,_0x4b1c5a){return function(_0x486763){if(_0x486763){return _0x486763[_0xca62('0x28')]()['then'](function(){_0x3eb516[_0xca62('0x1d')](0xcc)[_0xca62('0x29')]();});}};}function handleEntityNotFound(_0x32933c,_0x3e90eb){return function(_0x20e970){if(!_0x20e970){_0x32933c[_0xca62('0x1c')](0x194);}return _0x20e970;};}function handleError(_0x4e05d4,_0x483aae){_0x483aae=_0x483aae||0x1f4;return function(_0xd03a0b){logger[_0xca62('0x2a')](_0xd03a0b['stack']);if(_0xd03a0b['name']){delete _0xd03a0b[_0xca62('0x2b')];}_0x4e05d4['status'](_0x483aae)[_0xca62('0x2c')](_0xd03a0b);};}exports[_0xca62('0x2d')]=function(_0x1ed588,_0x107187){var _0x37dd79={},_0x4e4c0c={},_0x4958d7={'count':0x0,'rows':[]};var _0x403208=_[_0xca62('0x2e')](db['FaxQueueReport'][_0xca62('0x2f')],function(_0x2b8aee){return{'name':_0x2b8aee[_0xca62('0x30')],'type':_0x2b8aee[_0xca62('0x31')][_0xca62('0x32')]};});_0x4e4c0c[_0xca62('0x33')]=_[_0xca62('0x2e')](_0x403208,_0xca62('0x2b'));_0x4e4c0c[_0xca62('0x34')]=_[_0xca62('0x35')](_0x1ed588[_0xca62('0x34')]);_0x4e4c0c[_0xca62('0x36')]=_[_0xca62('0x37')](_0x4e4c0c[_0xca62('0x33')],_0x4e4c0c[_0xca62('0x34')]);_0x37dd79[_0xca62('0x38')]=_[_0xca62('0x37')](_0x4e4c0c[_0xca62('0x33')],qs[_0xca62('0x39')](_0x1ed588[_0xca62('0x34')]['fields']));_0x37dd79['attributes']=_0x37dd79[_0xca62('0x38')][_0xca62('0x3a')]?_0x37dd79['attributes']:_0x4e4c0c['model'];if(!_0x1ed588[_0xca62('0x34')][_0xca62('0x3b')](_0xca62('0x3c'))){_0x37dd79[_0xca62('0x22')]=qs['limit'](_0x1ed588[_0xca62('0x34')][_0xca62('0x22')]);_0x37dd79['offset']=qs['offset'](_0x1ed588['query'][_0xca62('0x1f')]);}_0x37dd79['order']=qs[_0xca62('0x3d')](_0x1ed588[_0xca62('0x34')][_0xca62('0x3d')]);_0x37dd79[_0xca62('0x3e')]=qs[_0xca62('0x36')](_[_0xca62('0x3f')](_0x1ed588[_0xca62('0x34')],_0x4e4c0c['filters']),_0x403208);if(_0x1ed588[_0xca62('0x34')][_0xca62('0x40')]){_0x37dd79[_0xca62('0x3e')]=_[_0xca62('0x41')](_0x37dd79[_0xca62('0x3e')],{'$or':_[_0xca62('0x2e')](_0x403208,function(_0x45cc1a){if(_0x45cc1a[_0xca62('0x31')]!=='VIRTUAL'){var _0xa66fa4={};_0xa66fa4[_0x45cc1a[_0xca62('0x2b')]]={'$like':'%'+_0x1ed588['query']['filter']+'%'};return _0xa66fa4;}})});}_0x37dd79=_[_0xca62('0x41')]({},_0x37dd79,_0x1ed588[_0xca62('0x42')]);var _0x14645c={'where':_0x37dd79[_0xca62('0x3e')]};return db['FaxQueueReport'][_0xca62('0x21')](_0x14645c)[_0xca62('0x27')](function(_0x117035){_0x4958d7['count']=_0x117035;if(_0x1ed588[_0xca62('0x34')][_0xca62('0x43')]){_0x37dd79[_0xca62('0x44')]=[{'all':!![]}];}return db[_0xca62('0x45')]['findAll'](_0x37dd79);})[_0xca62('0x27')](function(_0x3fe8e4){_0x4958d7['rows']=_0x3fe8e4;return _0x4958d7;})['then'](respondWithFilteredResult(_0x107187,_0x37dd79))[_0xca62('0x46')](handleError(_0x107187,null));};exports[_0xca62('0x47')]=function(_0x19e605,_0xd80dd3){var _0x2c1132={'raw':!![],'where':{'id':_0x19e605[_0xca62('0x48')]['id']}},_0x51f7f8={};_0x51f7f8['model']=_[_0xca62('0x35')](db[_0xca62('0x45')][_0xca62('0x2f')]);_0x51f7f8[_0xca62('0x34')]=_[_0xca62('0x35')](_0x19e605[_0xca62('0x34')]);_0x51f7f8['filters']=_['intersection'](_0x51f7f8['model'],_0x51f7f8[_0xca62('0x34')]);_0x2c1132[_0xca62('0x38')]=_['intersection'](_0x51f7f8[_0xca62('0x33')],qs['fields'](_0x19e605[_0xca62('0x34')][_0xca62('0x39')]));_0x2c1132[_0xca62('0x38')]=_0x2c1132['attributes']['length']?_0x2c1132[_0xca62('0x38')]:_0x51f7f8[_0xca62('0x33')];if(_0x19e605[_0xca62('0x34')]['includeAll']){_0x2c1132[_0xca62('0x44')]=[{'all':!![]}];}_0x2c1132=_['merge']({},_0x2c1132,_0x19e605[_0xca62('0x42')]);return db[_0xca62('0x45')][_0xca62('0x49')](_0x2c1132)[_0xca62('0x27')](handleEntityNotFound(_0xd80dd3,null))[_0xca62('0x27')](respondWithResult(_0xd80dd3,null))[_0xca62('0x46')](handleError(_0xd80dd3,null));};exports[_0xca62('0x4a')]=function(_0x31e256,_0x1c14aa){return db[_0xca62('0x45')][_0xca62('0x4a')](_0x31e256[_0xca62('0x4b')],{})[_0xca62('0x27')](respondWithResult(_0x1c14aa,0xc9))[_0xca62('0x46')](handleError(_0x1c14aa,null));};exports[_0xca62('0x26')]=function(_0x510330,_0x39d3bf){if(_0x510330[_0xca62('0x4b')]['id']){delete _0x510330[_0xca62('0x4b')]['id'];}return db[_0xca62('0x45')]['find']({'where':{'id':_0x510330['params']['id']}})['then'](handleEntityNotFound(_0x39d3bf,null))[_0xca62('0x27')](saveUpdates(_0x510330[_0xca62('0x4b')],null))[_0xca62('0x27')](respondWithResult(_0x39d3bf,null))[_0xca62('0x46')](handleError(_0x39d3bf,null));};exports['destroy']=function(_0xe610f2,_0x363203){return db[_0xca62('0x45')][_0xca62('0x49')]({'where':{'id':_0xe610f2[_0xca62('0x48')]['id']}})[_0xca62('0x27')](handleEntityNotFound(_0x363203,null))[_0xca62('0x27')](removeEntity(_0x363203,null))[_0xca62('0x46')](handleError(_0x363203,null));};exports[_0xca62('0x4c')]=function(_0x3f4d4b,_0x3dd4df){return db[_0xca62('0x45')][_0xca62('0x4c')]()[_0xca62('0x27')](respondWithResult(_0x3dd4df,null))['catch'](handleError(_0x3dd4df,null));}; \ No newline at end of file +var _0xe739=['../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','index','FaxQueueReport','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','include','params','includeAll','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils'];(function(_0x5e8e0c,_0x38fbda){var _0x2f8770=function(_0x3d5ab5){while(--_0x3d5ab5){_0x5e8e0c['push'](_0x5e8e0c['shift']());}};_0x2f8770(++_0x38fbda);}(_0xe739,0x105));var _0x9e73=function(_0x5425ec,_0x588424){_0x5425ec=_0x5425ec-0x0;var _0x51359b=_0xe739[_0x5425ec];return _0x51359b;};'use strict';var emlformat=require(_0x9e73('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9e73('0x1'));var jsonpatch=require(_0x9e73('0x2'));var rp=require(_0x9e73('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9e73('0x4'));var path=require(_0x9e73('0x5'));var sox=require(_0x9e73('0x6'));var csv=require(_0x9e73('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9e73('0x8'));var _=require(_0x9e73('0x9'));var squel=require(_0x9e73('0xa'));var crypto=require('crypto');var jsforce=require(_0x9e73('0xb'));var deskjs=require(_0x9e73('0xc'));var toCsv=require(_0x9e73('0x7'));var querystring=require(_0x9e73('0xd'));var Papa=require(_0x9e73('0xe'));var Redis=require(_0x9e73('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9e73('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9e73('0x11'))('api');var utils=require(_0x9e73('0x12'));var config=require(_0x9e73('0x13'));var licenseUtil=require(_0x9e73('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x102bb9,_0x4696e2){_0x4696e2=_0x4696e2||0xcc;return function(_0x45c2d0){if(_0x45c2d0){return _0x102bb9[_0x9e73('0x15')](_0x4696e2);}return _0x102bb9['status'](_0x4696e2)[_0x9e73('0x16')]();};}function respondWithResult(_0x607981,_0x3a7bd5){_0x3a7bd5=_0x3a7bd5||0xc8;return function(_0x5be2fa){if(_0x5be2fa){return _0x607981[_0x9e73('0x17')](_0x3a7bd5)[_0x9e73('0x18')](_0x5be2fa);}};}function respondWithFilteredResult(_0x597492,_0x367857){return function(_0x327305){if(_0x327305){var _0x21bd3a=typeof _0x367857['offset']===_0x9e73('0x19')&&typeof _0x367857['limit']===_0x9e73('0x19');var _0x58bbaa=_0x327305[_0x9e73('0x1a')];var _0x48b1db=_0x21bd3a?0x0:_0x367857['offset'];var _0x419c5b=_0x21bd3a?_0x327305[_0x9e73('0x1a')]:_0x367857[_0x9e73('0x1b')]+_0x367857[_0x9e73('0x1c')];var _0x3e56d8;if(_0x419c5b>=_0x58bbaa){_0x419c5b=_0x58bbaa;_0x3e56d8=0xc8;}else{_0x3e56d8=0xce;}_0x597492[_0x9e73('0x17')](_0x3e56d8);return _0x597492[_0x9e73('0x1d')](_0x9e73('0x1e'),_0x48b1db+'-'+_0x419c5b+'/'+_0x58bbaa)[_0x9e73('0x18')](_0x327305);}return null;};}function patchUpdates(_0x3f56bf){return function(_0x4a5cd1){try{jsonpatch[_0x9e73('0x1f')](_0x4a5cd1,_0x3f56bf,!![]);}catch(_0x5c6bae){return BPromise[_0x9e73('0x20')](_0x5c6bae);}return _0x4a5cd1['save']();};}function saveUpdates(_0x31d354,_0x589a5d){return function(_0x2c2b32){if(_0x2c2b32){return _0x2c2b32[_0x9e73('0x21')](_0x31d354)['then'](function(_0x55704a){return _0x55704a;});}return null;};}function removeEntity(_0x127afd,_0x5c6322){return function(_0x256ea1){if(_0x256ea1){return _0x256ea1[_0x9e73('0x22')]()[_0x9e73('0x23')](function(){_0x127afd['status'](0xcc)[_0x9e73('0x16')]();});}};}function handleEntityNotFound(_0x3a845c,_0x566cd8){return function(_0x539560){if(!_0x539560){_0x3a845c[_0x9e73('0x15')](0x194);}return _0x539560;};}function handleError(_0x5031eb,_0x5356ce){_0x5356ce=_0x5356ce||0x1f4;return function(_0x23b2cd){logger[_0x9e73('0x24')](_0x23b2cd[_0x9e73('0x25')]);if(_0x23b2cd['name']){delete _0x23b2cd[_0x9e73('0x26')];}_0x5031eb[_0x9e73('0x17')](_0x5356ce)['send'](_0x23b2cd);};}exports[_0x9e73('0x27')]=function(_0x24532d,_0x3fd13d){var _0x397bd6={},_0x2363f6={},_0x511e35={'count':0x0,'rows':[]};var _0x312e08=_['map'](db[_0x9e73('0x28')][_0x9e73('0x29')],function(_0xb3ef4f){return{'name':_0xb3ef4f[_0x9e73('0x2a')],'type':_0xb3ef4f[_0x9e73('0x2b')]['key']};});_0x2363f6[_0x9e73('0x2c')]=_[_0x9e73('0x2d')](_0x312e08,'name');_0x2363f6['query']=_[_0x9e73('0x2e')](_0x24532d[_0x9e73('0x2f')]);_0x2363f6[_0x9e73('0x30')]=_[_0x9e73('0x31')](_0x2363f6[_0x9e73('0x2c')],_0x2363f6[_0x9e73('0x2f')]);_0x397bd6['attributes']=_[_0x9e73('0x31')](_0x2363f6[_0x9e73('0x2c')],qs[_0x9e73('0x32')](_0x24532d[_0x9e73('0x2f')][_0x9e73('0x32')]));_0x397bd6[_0x9e73('0x33')]=_0x397bd6[_0x9e73('0x33')][_0x9e73('0x34')]?_0x397bd6[_0x9e73('0x33')]:_0x2363f6[_0x9e73('0x2c')];if(!_0x24532d['query'][_0x9e73('0x35')](_0x9e73('0x36'))){_0x397bd6[_0x9e73('0x1c')]=qs[_0x9e73('0x1c')](_0x24532d['query'][_0x9e73('0x1c')]);_0x397bd6[_0x9e73('0x1b')]=qs['offset'](_0x24532d['query'][_0x9e73('0x1b')]);}_0x397bd6[_0x9e73('0x37')]=qs[_0x9e73('0x38')](_0x24532d[_0x9e73('0x2f')][_0x9e73('0x38')]);_0x397bd6[_0x9e73('0x39')]=qs['filters'](_['pick'](_0x24532d['query'],_0x2363f6[_0x9e73('0x30')]),_0x312e08);if(_0x24532d[_0x9e73('0x2f')][_0x9e73('0x3a')]){_0x397bd6['where']=_['merge'](_0x397bd6['where'],{'$or':_[_0x9e73('0x2d')](_0x312e08,function(_0xb5bb10){if(_0xb5bb10[_0x9e73('0x2b')]!==_0x9e73('0x3b')){var _0x541171={};_0x541171[_0xb5bb10[_0x9e73('0x26')]]={'$like':'%'+_0x24532d[_0x9e73('0x2f')][_0x9e73('0x3a')]+'%'};return _0x541171;}})});}_0x397bd6=_[_0x9e73('0x3c')]({},_0x397bd6,_0x24532d[_0x9e73('0x3d')]);var _0x40bbda={'where':_0x397bd6[_0x9e73('0x39')]};return db[_0x9e73('0x28')][_0x9e73('0x1a')](_0x40bbda)[_0x9e73('0x23')](function(_0x5d8e77){_0x511e35['count']=_0x5d8e77;if(_0x24532d['query']['includeAll']){_0x397bd6[_0x9e73('0x3e')]=[{'all':!![]}];}return db[_0x9e73('0x28')]['findAll'](_0x397bd6);})[_0x9e73('0x23')](function(_0x2038fb){_0x511e35['rows']=_0x2038fb;return _0x511e35;})['then'](respondWithFilteredResult(_0x3fd13d,_0x397bd6))['catch'](handleError(_0x3fd13d,null));};exports['show']=function(_0x51036a,_0x1e3a56){var _0x2a0166={'raw':!![],'where':{'id':_0x51036a[_0x9e73('0x3f')]['id']}},_0xee1f5={};_0xee1f5['model']=_['keys'](db[_0x9e73('0x28')][_0x9e73('0x29')]);_0xee1f5[_0x9e73('0x2f')]=_[_0x9e73('0x2e')](_0x51036a[_0x9e73('0x2f')]);_0xee1f5[_0x9e73('0x30')]=_['intersection'](_0xee1f5[_0x9e73('0x2c')],_0xee1f5[_0x9e73('0x2f')]);_0x2a0166['attributes']=_[_0x9e73('0x31')](_0xee1f5[_0x9e73('0x2c')],qs['fields'](_0x51036a[_0x9e73('0x2f')][_0x9e73('0x32')]));_0x2a0166['attributes']=_0x2a0166[_0x9e73('0x33')][_0x9e73('0x34')]?_0x2a0166[_0x9e73('0x33')]:_0xee1f5[_0x9e73('0x2c')];if(_0x51036a[_0x9e73('0x2f')][_0x9e73('0x40')]){_0x2a0166[_0x9e73('0x3e')]=[{'all':!![]}];}_0x2a0166=_[_0x9e73('0x3c')]({},_0x2a0166,_0x51036a[_0x9e73('0x3d')]);return db[_0x9e73('0x28')][_0x9e73('0x41')](_0x2a0166)[_0x9e73('0x23')](handleEntityNotFound(_0x1e3a56,null))[_0x9e73('0x23')](respondWithResult(_0x1e3a56,null))[_0x9e73('0x42')](handleError(_0x1e3a56,null));};exports[_0x9e73('0x43')]=function(_0x2d6ed4,_0x4e7891){return db[_0x9e73('0x28')]['create'](_0x2d6ed4['body'],{})[_0x9e73('0x23')](respondWithResult(_0x4e7891,0xc9))[_0x9e73('0x42')](handleError(_0x4e7891,null));};exports['update']=function(_0x4baaf7,_0x308e86){if(_0x4baaf7[_0x9e73('0x44')]['id']){delete _0x4baaf7[_0x9e73('0x44')]['id'];}return db[_0x9e73('0x28')][_0x9e73('0x41')]({'where':{'id':_0x4baaf7[_0x9e73('0x3f')]['id']}})[_0x9e73('0x23')](handleEntityNotFound(_0x308e86,null))[_0x9e73('0x23')](saveUpdates(_0x4baaf7[_0x9e73('0x44')],null))[_0x9e73('0x23')](respondWithResult(_0x308e86,null))[_0x9e73('0x42')](handleError(_0x308e86,null));};exports[_0x9e73('0x22')]=function(_0x230249,_0xe70028){return db['FaxQueueReport'][_0x9e73('0x41')]({'where':{'id':_0x230249[_0x9e73('0x3f')]['id']}})[_0x9e73('0x23')](handleEntityNotFound(_0xe70028,null))[_0x9e73('0x23')](removeEntity(_0xe70028,null))[_0x9e73('0x42')](handleError(_0xe70028,null));};exports[_0x9e73('0x45')]=function(_0x2c2003,_0x1e6655){return db['FaxQueueReport']['describe']()['then'](respondWithResult(_0x1e6655,null))[_0x9e73('0x42')](handleError(_0x1e6655,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index d9743ca..b1b60fb 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 _0x0295=['rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','uniqueid','lodash','api','request-promise','path'];(function(_0x308da9,_0x2d3f2f){var _0x152007=function(_0x24140b){while(--_0x24140b){_0x308da9['push'](_0x308da9['shift']());}};_0x152007(++_0x2d3f2f);}(_0x0295,0x1f0));var _0x5029=function(_0x4cafb1,_0x2954df){_0x4cafb1=_0x4cafb1-0x0;var _0x5d0869=_0x0295[_0x4cafb1];return _0x5d0869;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5029('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5029('0x2'));var fs=require('fs');var path=require(_0x5029('0x3'));var rimraf=require(_0x5029('0x4'));var config=require(_0x5029('0x5'));var attributes=require(_0x5029('0x6'));module[_0x5029('0x7')]=function(_0x200217,_0x215955){return _0x200217[_0x5029('0x8')]('FaxQueueReport',attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x5029('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7fbe=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','../../config/logger','api'];(function(_0x3657e5,_0x7b4384){var _0x25c13d=function(_0x1b8677){while(--_0x1b8677){_0x3657e5['push'](_0x3657e5['shift']());}};_0x25c13d(++_0x7b4384);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x49d77e,_0x47b0ca){_0x49d77e=_0x49d77e-0x0;var _0x37895e=_0x7fbe[_0x49d77e];return _0x37895e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xe7fb('0xc'),'fields':[_0xe7fb('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 7cdb2ce..9a7129d 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 _0xe989=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateFaxQueueReport','FaxQueueReport','body','options','raw','update','where','attributes','UpdateFaxQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xe4ecb6,_0x3c97b1){var _0x2575de=function(_0x8923f){while(--_0x8923f){_0xe4ecb6['push'](_0xe4ecb6['shift']());}};_0x2575de(++_0x3c97b1);}(_0xe989,0x10f));var _0x9e98=function(_0x324e86,_0x81b1cb){_0x324e86=_0x324e86-0x0;var _0x592846=_0xe989[_0x324e86];return _0x592846;};'use strict';var _=require(_0x9e98('0x0'));var util=require(_0x9e98('0x1'));var moment=require(_0x9e98('0x2'));var BPromise=require(_0x9e98('0x3'));var rs=require(_0x9e98('0x4'));var fs=require('fs');var Redis=require(_0x9e98('0x5'));var db=require(_0x9e98('0x6'))['db'];var utils=require(_0x9e98('0x7'));var logger=require(_0x9e98('0x8'))(_0x9e98('0x9'));var config=require(_0x9e98('0xa'));var jayson=require(_0x9e98('0xb'));var client=jayson[_0x9e98('0xc')][_0x9e98('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3dad51,_0x1ffc2,_0x402901){return new BPromise(function(_0x1047e1,_0x52ee9b){return client[_0x9e98('0xe')](_0x3dad51,_0x402901)[_0x9e98('0xf')](function(_0x3396ef){logger[_0x9e98('0x10')](_0x9e98('0x11'),_0x1ffc2,_0x9e98('0x12'));logger[_0x9e98('0x13')](_0x9e98('0x14'),_0x1ffc2,_0x9e98('0x12'),JSON[_0x9e98('0x15')](_0x3396ef));if(_0x3396ef[_0x9e98('0x16')]){if(_0x3396ef['error']['code']===0x1f4){logger[_0x9e98('0x16')](_0x9e98('0x11'),_0x1ffc2,_0x3396ef[_0x9e98('0x16')][_0x9e98('0x17')]);return _0x52ee9b(_0x3396ef[_0x9e98('0x16')][_0x9e98('0x17')]);}logger[_0x9e98('0x16')]('FaxQueueReport,\x20%s,\x20%s',_0x1ffc2,_0x3396ef[_0x9e98('0x16')][_0x9e98('0x17')]);return _0x1047e1(_0x3396ef[_0x9e98('0x16')][_0x9e98('0x17')]);}else{logger[_0x9e98('0x10')](_0x9e98('0x11'),_0x1ffc2,_0x9e98('0x12'));_0x1047e1(_0x3396ef[_0x9e98('0x18')][_0x9e98('0x17')]);}})[_0x9e98('0x19')](function(_0x2b1d93){logger[_0x9e98('0x16')](_0x9e98('0x11'),_0x1ffc2,_0x2b1d93);_0x52ee9b(_0x2b1d93);});});}exports[_0x9e98('0x1a')]=function(_0x281f76){var _0x39a8f4=this;return new Promise(function(_0xecc69b,_0x104161){return db[_0x9e98('0x1b')]['create'](_0x281f76[_0x9e98('0x1c')],{'raw':_0x281f76['options']?_0x281f76[_0x9e98('0x1d')][_0x9e98('0x1e')]===undefined?!![]:![]:!![]})[_0x9e98('0xf')](function(_0x3f5ad6){logger[_0x9e98('0x10')]('CreateFaxQueueReport',_0x281f76);logger[_0x9e98('0x13')](_0x9e98('0x1a'),_0x281f76,JSON[_0x9e98('0x15')](_0x3f5ad6));_0xecc69b(_0x3f5ad6);})[_0x9e98('0x19')](function(_0x21b4fe){logger[_0x9e98('0x16')](_0x9e98('0x1a'),_0x21b4fe['message'],_0x281f76);_0x104161(_0x39a8f4[_0x9e98('0x16')](0x1f4,_0x21b4fe[_0x9e98('0x17')]));});});};exports['UpdateFaxQueueReport']=function(_0x6fbd93){var _0x320e79=this;return new Promise(function(_0x51689f,_0xcb9b84){return db['FaxQueueReport'][_0x9e98('0x1f')](_0x6fbd93[_0x9e98('0x1c')],{'raw':_0x6fbd93[_0x9e98('0x1d')]?_0x6fbd93['options'][_0x9e98('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6fbd93['options']?_0x6fbd93[_0x9e98('0x1d')][_0x9e98('0x20')]||null:null,'attributes':_0x6fbd93[_0x9e98('0x1d')]?_0x6fbd93['options'][_0x9e98('0x21')]||null:null,'limit':_0x6fbd93[_0x9e98('0x1d')]?_0x6fbd93[_0x9e98('0x1d')]['limit']||null:null})[_0x9e98('0xf')](function(_0x435e94){logger[_0x9e98('0x10')](_0x9e98('0x22'),_0x6fbd93);logger['debug'](_0x9e98('0x22'),_0x6fbd93,JSON[_0x9e98('0x15')](_0x435e94));_0x51689f(_0x435e94);})[_0x9e98('0x19')](function(_0x43f5ea){logger[_0x9e98('0x16')]('UpdateFaxQueueReport',_0x43f5ea[_0x9e98('0x17')],_0x6fbd93);_0xcb9b84(_0x320e79[_0x9e98('0x16')](0x1f4,_0x43f5ea[_0x9e98('0x17')]));});});}; \ No newline at end of file +var _0xb6eb=['limit','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','http','request','info','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','FaxQueueReport,\x20%s,\x20%s','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','then','stringify','UpdateFaxQueueReport','update','where','attributes'];(function(_0x363b81,_0x81e6ca){var _0x1d92fb=function(_0x129644){while(--_0x129644){_0x363b81['push'](_0x363b81['shift']());}};_0x1d92fb(++_0x81e6ca);}(_0xb6eb,0xe1));var _0xbb6e=function(_0x421aa9,_0xd5d28d){_0x421aa9=_0x421aa9-0x0;var _0x2b2b14=_0xb6eb[_0x421aa9];return _0x2b2b14;};'use strict';var _=require(_0xbb6e('0x0'));var util=require(_0xbb6e('0x1'));var moment=require('moment');var BPromise=require(_0xbb6e('0x2'));var rs=require(_0xbb6e('0x3'));var fs=require('fs');var Redis=require(_0xbb6e('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbb6e('0x5'))(_0xbb6e('0x6'));var config=require('../../config/environment');var jayson=require(_0xbb6e('0x7'));var client=jayson['client'][_0xbb6e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2362c5,_0x23df53,_0x55aa17){return new BPromise(function(_0x55c8e0,_0xa49efa){return client[_0xbb6e('0x9')](_0x2362c5,_0x55aa17)['then'](function(_0x56747b){logger[_0xbb6e('0xa')]('FaxQueueReport,\x20%s,\x20%s',_0x23df53,_0xbb6e('0xb'));logger[_0xbb6e('0xc')](_0xbb6e('0xd'),_0x23df53,_0xbb6e('0xb'),JSON['stringify'](_0x56747b));if(_0x56747b[_0xbb6e('0xe')]){if(_0x56747b[_0xbb6e('0xe')]['code']===0x1f4){logger[_0xbb6e('0xe')](_0xbb6e('0xf'),_0x23df53,_0x56747b['error']['message']);return _0xa49efa(_0x56747b[_0xbb6e('0xe')][_0xbb6e('0x10')]);}logger[_0xbb6e('0xe')](_0xbb6e('0xf'),_0x23df53,_0x56747b[_0xbb6e('0xe')][_0xbb6e('0x10')]);return _0x55c8e0(_0x56747b[_0xbb6e('0xe')][_0xbb6e('0x10')]);}else{logger[_0xbb6e('0xa')]('FaxQueueReport,\x20%s,\x20%s',_0x23df53,_0xbb6e('0xb'));_0x55c8e0(_0x56747b[_0xbb6e('0x11')][_0xbb6e('0x10')]);}})[_0xbb6e('0x12')](function(_0x6b6e72){logger['error'](_0xbb6e('0xf'),_0x23df53,_0x6b6e72);_0xa49efa(_0x6b6e72);});});}exports[_0xbb6e('0x13')]=function(_0x40a00d){var _0x19b908=this;return new Promise(function(_0x3ae7be,_0x30867e){return db[_0xbb6e('0x14')][_0xbb6e('0x15')](_0x40a00d[_0xbb6e('0x16')],{'raw':_0x40a00d[_0xbb6e('0x17')]?_0x40a00d[_0xbb6e('0x17')][_0xbb6e('0x18')]===undefined?!![]:![]:!![]})[_0xbb6e('0x19')](function(_0x2f3eac){logger[_0xbb6e('0xa')](_0xbb6e('0x13'),_0x40a00d);logger['debug']('CreateFaxQueueReport',_0x40a00d,JSON[_0xbb6e('0x1a')](_0x2f3eac));_0x3ae7be(_0x2f3eac);})['catch'](function(_0x485508){logger[_0xbb6e('0xe')](_0xbb6e('0x13'),_0x485508[_0xbb6e('0x10')],_0x40a00d);_0x30867e(_0x19b908[_0xbb6e('0xe')](0x1f4,_0x485508['message']));});});};exports[_0xbb6e('0x1b')]=function(_0x4183ba){var _0x328b99=this;return new Promise(function(_0x246770,_0x4443cf){return db[_0xbb6e('0x14')][_0xbb6e('0x1c')](_0x4183ba[_0xbb6e('0x16')],{'raw':_0x4183ba['options']?_0x4183ba['options'][_0xbb6e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4183ba[_0xbb6e('0x17')]?_0x4183ba['options'][_0xbb6e('0x1d')]||null:null,'attributes':_0x4183ba['options']?_0x4183ba[_0xbb6e('0x17')][_0xbb6e('0x1e')]||null:null,'limit':_0x4183ba['options']?_0x4183ba[_0xbb6e('0x17')][_0xbb6e('0x1f')]||null:null})['then'](function(_0xc43ee4){logger[_0xbb6e('0xa')](_0xbb6e('0x1b'),_0x4183ba);logger[_0xbb6e('0xc')](_0xbb6e('0x1b'),_0x4183ba,JSON[_0xbb6e('0x1a')](_0xc43ee4));_0x246770(_0xc43ee4);})['catch'](function(_0x32c39d){logger[_0xbb6e('0xe')](_0xbb6e('0x1b'),_0x32c39d['message'],_0x4183ba);_0x4443cf(_0x328b99[_0xbb6e('0xe')](0x1f4,_0x32c39d['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index c7619de..bf3c0d8 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 _0x3e39=['get','isAuthenticated','/describe','describe','/:id','show','post','create','delete','destroy','exports','path','connect-timeout','Router','../../components/auth/service','./faxQueueReport.controller'];(function(_0x1a60d1,_0x56647c){var _0x5e630d=function(_0x158832){while(--_0x158832){_0x1a60d1['push'](_0x1a60d1['shift']());}};_0x5e630d(++_0x56647c);}(_0x3e39,0x15b));var _0x93e3=function(_0x276b6b,_0xe85216){_0x276b6b=_0x276b6b-0x0;var _0x16855c=_0x3e39[_0x276b6b];return _0x16855c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x93e3('0x0'));var timeout=require(_0x93e3('0x1'));var express=require('express');var router=express[_0x93e3('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x93e3('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x93e3('0x4'));router[_0x93e3('0x5')]('/',auth[_0x93e3('0x6')](),controller['index']);router[_0x93e3('0x5')](_0x93e3('0x7'),auth[_0x93e3('0x6')](),controller[_0x93e3('0x8')]);router[_0x93e3('0x5')](_0x93e3('0x9'),auth[_0x93e3('0x6')](),controller[_0x93e3('0xa')]);router[_0x93e3('0xb')]('/',auth[_0x93e3('0x6')](),controller[_0x93e3('0xc')]);router['put'](_0x93e3('0x9'),auth[_0x93e3('0x6')](),controller['update']);router[_0x93e3('0xd')](_0x93e3('0x9'),auth['isAuthenticated'](),controller[_0x93e3('0xe')]);module[_0x93e3('0xf')]=router; \ No newline at end of file +var _0xafcb=['../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','/describe','describe','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x15497f,_0x15ecb3){var _0x3dff4e=function(_0x539f9c){while(--_0x539f9c){_0x15497f['push'](_0x15497f['shift']());}};_0x3dff4e(++_0x15ecb3);}(_0xafcb,0xb7));var _0xbafc=function(_0x357f25,_0x3c9914){_0x357f25=_0x357f25-0x0;var _0x19e18e=_0xafcb[_0x357f25];return _0x19e18e;};'use strict';var multer=require(_0xbafc('0x0'));var util=require(_0xbafc('0x1'));var path=require(_0xbafc('0x2'));var timeout=require(_0xbafc('0x3'));var express=require(_0xbafc('0x4'));var router=express[_0xbafc('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xbafc('0x6'));var interaction=require(_0xbafc('0x7'));var config=require(_0xbafc('0x8'));var controller=require(_0xbafc('0x9'));router[_0xbafc('0xa')]('/',auth[_0xbafc('0xb')](),controller['index']);router[_0xbafc('0xa')](_0xbafc('0xc'),auth[_0xbafc('0xb')](),controller[_0xbafc('0xd')]);router[_0xbafc('0xa')]('/:id',auth[_0xbafc('0xb')](),controller[_0xbafc('0xe')]);router[_0xbafc('0xf')]('/',auth['isAuthenticated'](),controller[_0xbafc('0x10')]);router[_0xbafc('0x11')]('/:id',auth[_0xbafc('0xb')](),controller[_0xbafc('0x12')]);router['delete']('/:id',auth[_0xbafc('0xb')](),controller[_0xbafc('0x13')]);module[_0xbafc('0x14')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index ad6cff3..3f42f70 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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x39c960,_0x21ff39){var _0x88aced=function(_0x48ddf4){while(--_0x48ddf4){_0x39c960['push'](_0x39c960['shift']());}};_0x88aced(++_0x21ff39);}(_0x00bb,0x1d8));var _0xb00b=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x00bb[_0x491a7f];return _0x3d8f44;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file +var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x524c06,_0x348a82){var _0x4b16ec=function(_0x5d16e0){while(--_0x5d16e0){_0x524c06['push'](_0x524c06['shift']());}};_0x4b16ec(++_0x348a82);}(_0x70e0,0x17b));var _0x070e=function(_0x1ec6f2,_0x51d0b8){_0x1ec6f2=_0x1ec6f2-0x0;var _0xd0e9dc=_0x70e0[_0x1ec6f2];return _0xd0e9dc;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index a117f1d..44b874c 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 _0x1cec=['map','FaxTransferReport','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','then','rows','catch','show','params','keys','create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','update','destroy','error','stack','name','send','index'];(function(_0x3d2e4b,_0x1f6653){var _0x509e78=function(_0x307037){while(--_0x307037){_0x3d2e4b['push'](_0x3d2e4b['shift']());}};_0x509e78(++_0x1f6653);}(_0x1cec,0xc4));var _0xc1ce=function(_0x2f4819,_0x3b4b03){_0x2f4819=_0x2f4819-0x0;var _0x2363e0=_0x1cec[_0x2f4819];return _0x2363e0;};'use strict';var emlformat=require(_0xc1ce('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc1ce('0x1'));var jsonpatch=require(_0xc1ce('0x2'));var rp=require(_0xc1ce('0x3'));var moment=require(_0xc1ce('0x4'));var BPromise=require(_0xc1ce('0x5'));var Mustache=require(_0xc1ce('0x6'));var util=require(_0xc1ce('0x7'));var path=require(_0xc1ce('0x8'));var sox=require(_0xc1ce('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc1ce('0xa'));var _=require(_0xc1ce('0xb'));var squel=require(_0xc1ce('0xc'));var crypto=require(_0xc1ce('0xd'));var jsforce=require(_0xc1ce('0xe'));var deskjs=require(_0xc1ce('0xf'));var toCsv=require(_0xc1ce('0x10'));var querystring=require(_0xc1ce('0x11'));var Papa=require(_0xc1ce('0x12'));var Redis=require(_0xc1ce('0x13'));var authService=require(_0xc1ce('0x14'));var qs=require(_0xc1ce('0x15'));var as=require(_0xc1ce('0x16'));var hardwareService=require(_0xc1ce('0x17'));var logger=require(_0xc1ce('0x18'))(_0xc1ce('0x19'));var utils=require(_0xc1ce('0x1a'));var config=require(_0xc1ce('0x1b'));var licenseUtil=require(_0xc1ce('0x1c'));var db=require(_0xc1ce('0x1d'))['db'];function respondWithStatusCode(_0xc164a9,_0x285a14){_0x285a14=_0x285a14||0xcc;return function(_0x1fb9b9){if(_0x1fb9b9){return _0xc164a9[_0xc1ce('0x1e')](_0x285a14);}return _0xc164a9[_0xc1ce('0x1f')](_0x285a14)[_0xc1ce('0x20')]();};}function respondWithResult(_0x5dd1f9,_0x35167d){_0x35167d=_0x35167d||0xc8;return function(_0x57760e){if(_0x57760e){return _0x5dd1f9[_0xc1ce('0x1f')](_0x35167d)[_0xc1ce('0x21')](_0x57760e);}};}function respondWithFilteredResult(_0x1e5d0d,_0x336807){return function(_0x5c8fcf){if(_0x5c8fcf){var _0x19b1bf=typeof _0x336807[_0xc1ce('0x22')]===_0xc1ce('0x23')&&typeof _0x336807[_0xc1ce('0x24')]===_0xc1ce('0x23');var _0x2f362e=_0x5c8fcf['count'];var _0x1549a6=_0x19b1bf?0x0:_0x336807[_0xc1ce('0x22')];var _0x3f7234=_0x19b1bf?_0x5c8fcf[_0xc1ce('0x25')]:_0x336807[_0xc1ce('0x22')]+_0x336807[_0xc1ce('0x24')];var _0xa7b10c;if(_0x3f7234>=_0x2f362e){_0x3f7234=_0x2f362e;_0xa7b10c=0xc8;}else{_0xa7b10c=0xce;}_0x1e5d0d[_0xc1ce('0x1f')](_0xa7b10c);return _0x1e5d0d[_0xc1ce('0x26')]('Content-Range',_0x1549a6+'-'+_0x3f7234+'/'+_0x2f362e)[_0xc1ce('0x21')](_0x5c8fcf);}return null;};}function patchUpdates(_0xccddb4){return function(_0x154581){try{jsonpatch['apply'](_0x154581,_0xccddb4,!![]);}catch(_0x27d0aa){return BPromise[_0xc1ce('0x27')](_0x27d0aa);}return _0x154581['save']();};}function saveUpdates(_0x24161e,_0x467eee){return function(_0x527393){if(_0x527393){return _0x527393[_0xc1ce('0x28')](_0x24161e)['then'](function(_0x3133ee){return _0x3133ee;});}return null;};}function removeEntity(_0x9dc0d,_0x441222){return function(_0x486fe4){if(_0x486fe4){return _0x486fe4[_0xc1ce('0x29')]()['then'](function(){_0x9dc0d[_0xc1ce('0x1f')](0xcc)[_0xc1ce('0x20')]();});}};}function handleEntityNotFound(_0x38a8b0,_0x224ed1){return function(_0x2c8840){if(!_0x2c8840){_0x38a8b0[_0xc1ce('0x1e')](0x194);}return _0x2c8840;};}function handleError(_0x1e5332,_0x33c9e3){_0x33c9e3=_0x33c9e3||0x1f4;return function(_0x53351d){logger[_0xc1ce('0x2a')](_0x53351d[_0xc1ce('0x2b')]);if(_0x53351d[_0xc1ce('0x2c')]){delete _0x53351d['name'];}_0x1e5332[_0xc1ce('0x1f')](_0x33c9e3)[_0xc1ce('0x2d')](_0x53351d);};}exports[_0xc1ce('0x2e')]=function(_0x5f14f3,_0x27d90f){var _0xb764d9={},_0x13174f={},_0x131885={'count':0x0,'rows':[]};var _0x28a4f1=_[_0xc1ce('0x2f')](db[_0xc1ce('0x30')][_0xc1ce('0x31')],function(_0x2c5e33){return{'name':_0x2c5e33[_0xc1ce('0x32')],'type':_0x2c5e33['type'][_0xc1ce('0x33')]};});_0x13174f['model']=_['map'](_0x28a4f1,_0xc1ce('0x2c'));_0x13174f[_0xc1ce('0x34')]=_['keys'](_0x5f14f3['query']);_0x13174f[_0xc1ce('0x35')]=_[_0xc1ce('0x36')](_0x13174f[_0xc1ce('0x37')],_0x13174f['query']);_0xb764d9[_0xc1ce('0x38')]=_['intersection'](_0x13174f[_0xc1ce('0x37')],qs[_0xc1ce('0x39')](_0x5f14f3['query']['fields']));_0xb764d9[_0xc1ce('0x38')]=_0xb764d9[_0xc1ce('0x38')][_0xc1ce('0x3a')]?_0xb764d9[_0xc1ce('0x38')]:_0x13174f[_0xc1ce('0x37')];if(!_0x5f14f3[_0xc1ce('0x34')][_0xc1ce('0x3b')](_0xc1ce('0x3c'))){_0xb764d9[_0xc1ce('0x24')]=qs[_0xc1ce('0x24')](_0x5f14f3[_0xc1ce('0x34')][_0xc1ce('0x24')]);_0xb764d9[_0xc1ce('0x22')]=qs[_0xc1ce('0x22')](_0x5f14f3['query'][_0xc1ce('0x22')]);}_0xb764d9['order']=qs[_0xc1ce('0x3d')](_0x5f14f3['query'][_0xc1ce('0x3d')]);_0xb764d9[_0xc1ce('0x3e')]=qs[_0xc1ce('0x35')](_['pick'](_0x5f14f3['query'],_0x13174f['filters']),_0x28a4f1);if(_0x5f14f3[_0xc1ce('0x34')]['filter']){_0xb764d9[_0xc1ce('0x3e')]=_[_0xc1ce('0x3f')](_0xb764d9[_0xc1ce('0x3e')],{'$or':_['map'](_0x28a4f1,function(_0x40c70d){if(_0x40c70d[_0xc1ce('0x40')]!==_0xc1ce('0x41')){var _0x450a0f={};_0x450a0f[_0x40c70d[_0xc1ce('0x2c')]]={'$like':'%'+_0x5f14f3[_0xc1ce('0x34')][_0xc1ce('0x42')]+'%'};return _0x450a0f;}})});}_0xb764d9=_[_0xc1ce('0x3f')]({},_0xb764d9,_0x5f14f3[_0xc1ce('0x43')]);var _0x4014dc={'where':_0xb764d9[_0xc1ce('0x3e')]};return db[_0xc1ce('0x30')][_0xc1ce('0x25')](_0x4014dc)['then'](function(_0x3a8af9){_0x131885[_0xc1ce('0x25')]=_0x3a8af9;if(_0x5f14f3[_0xc1ce('0x34')][_0xc1ce('0x44')]){_0xb764d9[_0xc1ce('0x45')]=[{'all':!![]}];}return db[_0xc1ce('0x30')][_0xc1ce('0x46')](_0xb764d9);})[_0xc1ce('0x47')](function(_0x97df47){_0x131885[_0xc1ce('0x48')]=_0x97df47;return _0x131885;})['then'](respondWithFilteredResult(_0x27d90f,_0xb764d9))[_0xc1ce('0x49')](handleError(_0x27d90f,null));};exports[_0xc1ce('0x4a')]=function(_0x3f5b66,_0x5973b4){var _0x944934={'raw':!![],'where':{'id':_0x3f5b66[_0xc1ce('0x4b')]['id']}},_0x314933={};_0x314933[_0xc1ce('0x37')]=_[_0xc1ce('0x4c')](db[_0xc1ce('0x30')][_0xc1ce('0x31')]);_0x314933[_0xc1ce('0x34')]=_['keys'](_0x3f5b66[_0xc1ce('0x34')]);_0x314933[_0xc1ce('0x35')]=_['intersection'](_0x314933[_0xc1ce('0x37')],_0x314933[_0xc1ce('0x34')]);_0x944934[_0xc1ce('0x38')]=_['intersection'](_0x314933[_0xc1ce('0x37')],qs[_0xc1ce('0x39')](_0x3f5b66[_0xc1ce('0x34')][_0xc1ce('0x39')]));_0x944934[_0xc1ce('0x38')]=_0x944934['attributes']['length']?_0x944934[_0xc1ce('0x38')]:_0x314933[_0xc1ce('0x37')];if(_0x3f5b66[_0xc1ce('0x34')][_0xc1ce('0x44')]){_0x944934[_0xc1ce('0x45')]=[{'all':!![]}];}_0x944934=_[_0xc1ce('0x3f')]({},_0x944934,_0x3f5b66['options']);return db[_0xc1ce('0x30')]['find'](_0x944934)['then'](handleEntityNotFound(_0x5973b4,null))[_0xc1ce('0x47')](respondWithResult(_0x5973b4,null))[_0xc1ce('0x49')](handleError(_0x5973b4,null));};exports[_0xc1ce('0x4d')]=function(_0x31d580,_0x539021){return db[_0xc1ce('0x30')][_0xc1ce('0x4d')](_0x31d580[_0xc1ce('0x4e')],{})[_0xc1ce('0x47')](respondWithResult(_0x539021,0xc9))['catch'](handleError(_0x539021,null));};exports[_0xc1ce('0x28')]=function(_0x298542,_0x58f478){if(_0x298542[_0xc1ce('0x4e')]['id']){delete _0x298542[_0xc1ce('0x4e')]['id'];}return db[_0xc1ce('0x30')][_0xc1ce('0x4f')]({'where':{'id':_0x298542[_0xc1ce('0x4b')]['id']}})[_0xc1ce('0x47')](handleEntityNotFound(_0x58f478,null))[_0xc1ce('0x47')](saveUpdates(_0x298542[_0xc1ce('0x4e')],null))[_0xc1ce('0x47')](respondWithResult(_0x58f478,null))[_0xc1ce('0x49')](handleError(_0x58f478,null));};exports[_0xc1ce('0x29')]=function(_0x4c210b,_0x3a3b24){return db[_0xc1ce('0x30')][_0xc1ce('0x4f')]({'where':{'id':_0x4c210b[_0xc1ce('0x4b')]['id']}})[_0xc1ce('0x47')](handleEntityNotFound(_0x3a3b24,null))[_0xc1ce('0x47')](removeEntity(_0x3a3b24,null))['catch'](handleError(_0x3a3b24,null));};exports[_0xc1ce('0x50')]=function(_0x1bf45f,_0x44406f){return db[_0xc1ce('0x30')][_0xc1ce('0x50')]()[_0xc1ce('0x47')](respondWithResult(_0x44406f,null))[_0xc1ce('0x49')](handleError(_0x44406f,null));}; \ No newline at end of file +var _0x755e=['apply','reject','save','update','then','destroy','stack','name','send','index','map','FaxTransferReport','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','offset','order','sort','where','filter','merge','VIRTUAL','findAll','rows','catch','show','params','rawAttributes','includeAll','include','options','find','create','body','describe','rimraf','zip-dir','fast-json-patch','moment','mustache','to-csv','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','set'];(function(_0x487d0a,_0x1b7cb4){var _0x3d740c=function(_0xa714f2){while(--_0xa714f2){_0x487d0a['push'](_0x487d0a['shift']());}};_0x3d740c(++_0x1b7cb4);}(_0x755e,0x71));var _0xe755=function(_0x4ece58,_0x50922a){_0x4ece58=_0x4ece58-0x0;var _0x20d209=_0x755e[_0x4ece58];return _0x20d209;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe755('0x0'));var zipdir=require(_0xe755('0x1'));var jsonpatch=require(_0xe755('0x2'));var rp=require('request-promise');var moment=require(_0xe755('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe755('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xe755('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe755('0x6'));var squel=require(_0xe755('0x7'));var crypto=require(_0xe755('0x8'));var jsforce=require(_0xe755('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xe755('0x5'));var querystring=require(_0xe755('0xa'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe755('0xb'));var qs=require(_0xe755('0xc'));var as=require(_0xe755('0xd'));var hardwareService=require(_0xe755('0xe'));var logger=require(_0xe755('0xf'))('api');var utils=require(_0xe755('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0xe755('0x11'));var db=require(_0xe755('0x12'))['db'];function respondWithStatusCode(_0x269791,_0x45926c){_0x45926c=_0x45926c||0xcc;return function(_0x38ddb2){if(_0x38ddb2){return _0x269791[_0xe755('0x13')](_0x45926c);}return _0x269791[_0xe755('0x14')](_0x45926c)[_0xe755('0x15')]();};}function respondWithResult(_0x357d58,_0x239697){_0x239697=_0x239697||0xc8;return function(_0x13def9){if(_0x13def9){return _0x357d58[_0xe755('0x14')](_0x239697)[_0xe755('0x16')](_0x13def9);}};}function respondWithFilteredResult(_0x2e47c9,_0x1924e0){return function(_0x5ebbc0){if(_0x5ebbc0){var _0xb2ba6c=typeof _0x1924e0['offset']===_0xe755('0x17')&&typeof _0x1924e0[_0xe755('0x18')]===_0xe755('0x17');var _0x34ca40=_0x5ebbc0[_0xe755('0x19')];var _0x2fcc92=_0xb2ba6c?0x0:_0x1924e0['offset'];var _0x4f1c7c=_0xb2ba6c?_0x5ebbc0[_0xe755('0x19')]:_0x1924e0['offset']+_0x1924e0[_0xe755('0x18')];var _0x320a92;if(_0x4f1c7c>=_0x34ca40){_0x4f1c7c=_0x34ca40;_0x320a92=0xc8;}else{_0x320a92=0xce;}_0x2e47c9[_0xe755('0x14')](_0x320a92);return _0x2e47c9[_0xe755('0x1a')]('Content-Range',_0x2fcc92+'-'+_0x4f1c7c+'/'+_0x34ca40)[_0xe755('0x16')](_0x5ebbc0);}return null;};}function patchUpdates(_0x3797e5){return function(_0x14accc){try{jsonpatch[_0xe755('0x1b')](_0x14accc,_0x3797e5,!![]);}catch(_0x3823df){return BPromise[_0xe755('0x1c')](_0x3823df);}return _0x14accc[_0xe755('0x1d')]();};}function saveUpdates(_0x330a4f,_0x413fe2){return function(_0x36e36c){if(_0x36e36c){return _0x36e36c[_0xe755('0x1e')](_0x330a4f)[_0xe755('0x1f')](function(_0x17070b){return _0x17070b;});}return null;};}function removeEntity(_0x4a5f19,_0x490911){return function(_0x3f96e8){if(_0x3f96e8){return _0x3f96e8[_0xe755('0x20')]()[_0xe755('0x1f')](function(){_0x4a5f19[_0xe755('0x14')](0xcc)[_0xe755('0x15')]();});}};}function handleEntityNotFound(_0x586da0,_0x42e8d4){return function(_0x4b2a08){if(!_0x4b2a08){_0x586da0[_0xe755('0x13')](0x194);}return _0x4b2a08;};}function handleError(_0x569960,_0x3b55a4){_0x3b55a4=_0x3b55a4||0x1f4;return function(_0x83d7b8){logger['error'](_0x83d7b8[_0xe755('0x21')]);if(_0x83d7b8[_0xe755('0x22')]){delete _0x83d7b8[_0xe755('0x22')];}_0x569960['status'](_0x3b55a4)[_0xe755('0x23')](_0x83d7b8);};}exports[_0xe755('0x24')]=function(_0xf1f3a5,_0x49d2d7){var _0x376a1d={},_0x3b631d={},_0x5986ad={'count':0x0,'rows':[]};var _0x5ad315=_[_0xe755('0x25')](db[_0xe755('0x26')]['rawAttributes'],function(_0x258004){return{'name':_0x258004['fieldName'],'type':_0x258004[_0xe755('0x27')][_0xe755('0x28')]};});_0x3b631d[_0xe755('0x29')]=_[_0xe755('0x25')](_0x5ad315,'name');_0x3b631d[_0xe755('0x2a')]=_[_0xe755('0x2b')](_0xf1f3a5[_0xe755('0x2a')]);_0x3b631d[_0xe755('0x2c')]=_[_0xe755('0x2d')](_0x3b631d['model'],_0x3b631d[_0xe755('0x2a')]);_0x376a1d['attributes']=_[_0xe755('0x2d')](_0x3b631d[_0xe755('0x29')],qs[_0xe755('0x2e')](_0xf1f3a5[_0xe755('0x2a')]['fields']));_0x376a1d[_0xe755('0x2f')]=_0x376a1d[_0xe755('0x2f')]['length']?_0x376a1d[_0xe755('0x2f')]:_0x3b631d['model'];if(!_0xf1f3a5[_0xe755('0x2a')][_0xe755('0x30')](_0xe755('0x31'))){_0x376a1d['limit']=qs[_0xe755('0x18')](_0xf1f3a5[_0xe755('0x2a')][_0xe755('0x18')]);_0x376a1d[_0xe755('0x32')]=qs['offset'](_0xf1f3a5['query'][_0xe755('0x32')]);}_0x376a1d[_0xe755('0x33')]=qs[_0xe755('0x34')](_0xf1f3a5[_0xe755('0x2a')][_0xe755('0x34')]);_0x376a1d[_0xe755('0x35')]=qs[_0xe755('0x2c')](_['pick'](_0xf1f3a5['query'],_0x3b631d[_0xe755('0x2c')]),_0x5ad315);if(_0xf1f3a5['query'][_0xe755('0x36')]){_0x376a1d[_0xe755('0x35')]=_[_0xe755('0x37')](_0x376a1d[_0xe755('0x35')],{'$or':_[_0xe755('0x25')](_0x5ad315,function(_0x2c7d15){if(_0x2c7d15[_0xe755('0x27')]!==_0xe755('0x38')){var _0x1a6a30={};_0x1a6a30[_0x2c7d15[_0xe755('0x22')]]={'$like':'%'+_0xf1f3a5[_0xe755('0x2a')][_0xe755('0x36')]+'%'};return _0x1a6a30;}})});}_0x376a1d=_[_0xe755('0x37')]({},_0x376a1d,_0xf1f3a5['options']);var _0x37429f={'where':_0x376a1d[_0xe755('0x35')]};return db[_0xe755('0x26')]['count'](_0x37429f)['then'](function(_0x5b6bfb){_0x5986ad['count']=_0x5b6bfb;if(_0xf1f3a5[_0xe755('0x2a')]['includeAll']){_0x376a1d['include']=[{'all':!![]}];}return db[_0xe755('0x26')][_0xe755('0x39')](_0x376a1d);})[_0xe755('0x1f')](function(_0x304c5e){_0x5986ad[_0xe755('0x3a')]=_0x304c5e;return _0x5986ad;})[_0xe755('0x1f')](respondWithFilteredResult(_0x49d2d7,_0x376a1d))[_0xe755('0x3b')](handleError(_0x49d2d7,null));};exports[_0xe755('0x3c')]=function(_0x175fde,_0x33cf5a){var _0x2d9963={'raw':!![],'where':{'id':_0x175fde[_0xe755('0x3d')]['id']}},_0x2a5f46={};_0x2a5f46[_0xe755('0x29')]=_['keys'](db[_0xe755('0x26')][_0xe755('0x3e')]);_0x2a5f46[_0xe755('0x2a')]=_[_0xe755('0x2b')](_0x175fde[_0xe755('0x2a')]);_0x2a5f46['filters']=_[_0xe755('0x2d')](_0x2a5f46['model'],_0x2a5f46[_0xe755('0x2a')]);_0x2d9963[_0xe755('0x2f')]=_['intersection'](_0x2a5f46[_0xe755('0x29')],qs[_0xe755('0x2e')](_0x175fde[_0xe755('0x2a')][_0xe755('0x2e')]));_0x2d9963[_0xe755('0x2f')]=_0x2d9963[_0xe755('0x2f')]['length']?_0x2d9963['attributes']:_0x2a5f46[_0xe755('0x29')];if(_0x175fde[_0xe755('0x2a')][_0xe755('0x3f')]){_0x2d9963[_0xe755('0x40')]=[{'all':!![]}];}_0x2d9963=_[_0xe755('0x37')]({},_0x2d9963,_0x175fde[_0xe755('0x41')]);return db[_0xe755('0x26')][_0xe755('0x42')](_0x2d9963)[_0xe755('0x1f')](handleEntityNotFound(_0x33cf5a,null))['then'](respondWithResult(_0x33cf5a,null))[_0xe755('0x3b')](handleError(_0x33cf5a,null));};exports[_0xe755('0x43')]=function(_0x2d40e7,_0x439b01){return db[_0xe755('0x26')][_0xe755('0x43')](_0x2d40e7['body'],{})['then'](respondWithResult(_0x439b01,0xc9))[_0xe755('0x3b')](handleError(_0x439b01,null));};exports[_0xe755('0x1e')]=function(_0x5534e3,_0x3ff67a){if(_0x5534e3['body']['id']){delete _0x5534e3[_0xe755('0x44')]['id'];}return db[_0xe755('0x26')]['find']({'where':{'id':_0x5534e3[_0xe755('0x3d')]['id']}})[_0xe755('0x1f')](handleEntityNotFound(_0x3ff67a,null))[_0xe755('0x1f')](saveUpdates(_0x5534e3[_0xe755('0x44')],null))['then'](respondWithResult(_0x3ff67a,null))[_0xe755('0x3b')](handleError(_0x3ff67a,null));};exports[_0xe755('0x20')]=function(_0x2f3c11,_0x812a83){return db[_0xe755('0x26')]['find']({'where':{'id':_0x2f3c11[_0xe755('0x3d')]['id']}})[_0xe755('0x1f')](handleEntityNotFound(_0x812a83,null))[_0xe755('0x1f')](removeEntity(_0x812a83,null))[_0xe755('0x3b')](handleError(_0x812a83,null));};exports['describe']=function(_0x9d1361,_0x4b184d){return db[_0xe755('0x26')][_0xe755('0x45')]()[_0xe755('0x1f')](respondWithResult(_0x4b184d,null))[_0xe755('0x3b')](handleError(_0x4b184d,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 745bae1..0505f9c 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 _0xa7fa=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxTransferReport.attributes','exports','report_fax_transfer','uniqueid','lodash'];(function(_0x444f91,_0x2a61f2){var _0x3248ab=function(_0x2b2279){while(--_0x2b2279){_0x444f91['push'](_0x444f91['shift']());}};_0x3248ab(++_0x2a61f2);}(_0xa7fa,0xfc));var _0xaa7f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa7fa[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xaa7f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xaa7f('0x1'));var moment=require(_0xaa7f('0x2'));var BPromise=require(_0xaa7f('0x3'));var rp=require(_0xaa7f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaa7f('0x5'));var config=require(_0xaa7f('0x6'));var attributes=require(_0xaa7f('0x7'));module[_0xaa7f('0x8')]=function(_0x48e98f,_0xf79d63){return _0x48e98f['define']('FaxTransferReport',attributes,{'tableName':_0xaa7f('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xaa7f('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf2a2=['api','moment','request-promise','path','rimraf','../../config/environment','exports','define','uniqueid','lodash','../../config/logger'];(function(_0xf98d20,_0x39a333){var _0x496c3d=function(_0x30c2a8){while(--_0x30c2a8){_0xf98d20['push'](_0xf98d20['shift']());}};_0x496c3d(++_0x39a333);}(_0xf2a2,0x1d7));var _0x2f2a=function(_0x129c1,_0x144d9b){_0x129c1=_0x129c1-0x0;var _0x42cde2=_0xf2a2[_0x129c1];return _0x42cde2;};'use strict';var _=require(_0x2f2a('0x0'));var util=require('util');var logger=require(_0x2f2a('0x1'))(_0x2f2a('0x2'));var moment=require(_0x2f2a('0x3'));var BPromise=require('bluebird');var rp=require(_0x2f2a('0x4'));var fs=require('fs');var path=require(_0x2f2a('0x5'));var rimraf=require(_0x2f2a('0x6'));var config=require(_0x2f2a('0x7'));var attributes=require('./faxTransferReport.attributes');module[_0x2f2a('0x8')]=function(_0x17be3e,_0x10508d){return _0x17be3e[_0x2f2a('0x9')]('FaxTransferReport',attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x2f2a('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 0bcac65..aa4ab01 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 _0xa360=['result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','debug','request\x20sent','stringify','error','code','FaxTransferReport,\x20%s,\x20%s','message'];(function(_0x7fd3a,_0x1c825b){var _0x252b23=function(_0x1ed03e){while(--_0x1ed03e){_0x7fd3a['push'](_0x7fd3a['shift']());}};_0x252b23(++_0x1c825b);}(_0xa360,0x167));var _0x0a36=function(_0x4935ec,_0x523210){_0x4935ec=_0x4935ec-0x0;var _0x13aabe=_0xa360[_0x4935ec];return _0x13aabe;};'use strict';var _=require(_0x0a36('0x0'));var util=require(_0x0a36('0x1'));var moment=require(_0x0a36('0x2'));var BPromise=require(_0x0a36('0x3'));var rs=require(_0x0a36('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0a36('0x5'))['db'];var utils=require(_0x0a36('0x6'));var logger=require(_0x0a36('0x7'))(_0x0a36('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0a36('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4bd605,_0x953773,_0x5eb6e7){return new BPromise(function(_0x25a431,_0x3a4a5b){return client[_0x0a36('0xa')](_0x4bd605,_0x5eb6e7)[_0x0a36('0xb')](function(_0x54f8cc){logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x953773,'request\x20sent');logger[_0x0a36('0xc')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x953773,_0x0a36('0xd'),JSON[_0x0a36('0xe')](_0x54f8cc));if(_0x54f8cc['error']){if(_0x54f8cc[_0x0a36('0xf')][_0x0a36('0x10')]===0x1f4){logger[_0x0a36('0xf')](_0x0a36('0x11'),_0x953773,_0x54f8cc[_0x0a36('0xf')]['message']);return _0x3a4a5b(_0x54f8cc[_0x0a36('0xf')][_0x0a36('0x12')]);}logger[_0x0a36('0xf')]('FaxTransferReport,\x20%s,\x20%s',_0x953773,_0x54f8cc['error'][_0x0a36('0x12')]);return _0x25a431(_0x54f8cc[_0x0a36('0xf')][_0x0a36('0x12')]);}else{logger['info'](_0x0a36('0x11'),_0x953773,'request\x20sent');_0x25a431(_0x54f8cc[_0x0a36('0x13')][_0x0a36('0x12')]);}})[_0x0a36('0x14')](function(_0x81c7d9){logger[_0x0a36('0xf')]('FaxTransferReport,\x20%s,\x20%s',_0x953773,_0x81c7d9);_0x3a4a5b(_0x81c7d9);});});} \ No newline at end of file +var _0x1f2e=['request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','FaxTransferReport,\x20%s,\x20%s','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x2f257e,_0x49af2c){var _0x16293c=function(_0x59f6d9){while(--_0x59f6d9){_0x2f257e['push'](_0x2f257e['shift']());}};_0x16293c(++_0x49af2c);}(_0x1f2e,0xb7));var _0xe1f2=function(_0x405883,_0x2ce7d5){_0x405883=_0x405883-0x0;var _0x1374d3=_0x1f2e[_0x405883];return _0x1374d3;};'use strict';var _=require(_0xe1f2('0x0'));var util=require(_0xe1f2('0x1'));var moment=require(_0xe1f2('0x2'));var BPromise=require(_0xe1f2('0x3'));var rs=require(_0xe1f2('0x4'));var fs=require('fs');var Redis=require(_0xe1f2('0x5'));var db=require(_0xe1f2('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe1f2('0x7'))(_0xe1f2('0x8'));var config=require(_0xe1f2('0x9'));var jayson=require(_0xe1f2('0xa'));var client=jayson[_0xe1f2('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x190685,_0xe82c1e,_0x4268fe){return new BPromise(function(_0x563399,_0x255e55){return client[_0xe1f2('0xc')](_0x190685,_0x4268fe)[_0xe1f2('0xd')](function(_0x326cce){logger['info'](_0xe1f2('0xe'),_0xe82c1e,'request\x20sent');logger[_0xe1f2('0xf')](_0xe1f2('0x10'),_0xe82c1e,_0xe1f2('0x11'),JSON[_0xe1f2('0x12')](_0x326cce));if(_0x326cce['error']){if(_0x326cce[_0xe1f2('0x13')][_0xe1f2('0x14')]===0x1f4){logger[_0xe1f2('0x13')](_0xe1f2('0xe'),_0xe82c1e,_0x326cce['error'][_0xe1f2('0x15')]);return _0x255e55(_0x326cce[_0xe1f2('0x13')][_0xe1f2('0x15')]);}logger[_0xe1f2('0x13')]('FaxTransferReport,\x20%s,\x20%s',_0xe82c1e,_0x326cce[_0xe1f2('0x13')][_0xe1f2('0x15')]);return _0x563399(_0x326cce[_0xe1f2('0x13')][_0xe1f2('0x15')]);}else{logger[_0xe1f2('0x16')]('FaxTransferReport,\x20%s,\x20%s',_0xe82c1e,_0xe1f2('0x11'));_0x563399(_0x326cce[_0xe1f2('0x17')][_0xe1f2('0x15')]);}})[_0xe1f2('0x18')](function(_0x732db4){logger['error'](_0xe1f2('0xe'),_0xe82c1e,_0x732db4);_0x255e55(_0x732db4);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 990bd84..45e5a96 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 _0xf7fd=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','index','isAuthenticated','describe','/:id','show','post','create','put','update','delete','exports','multer','path','express'];(function(_0x8d5cf2,_0x373c6d){var _0x3f449d=function(_0xf9897d){while(--_0xf9897d){_0x8d5cf2['push'](_0x8d5cf2['shift']());}};_0x3f449d(++_0x373c6d);}(_0xf7fd,0x138));var _0xdf7f=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0xf7fd[_0x3ab9ee];return _0x82ee88;};'use strict';var multer=require(_0xdf7f('0x0'));var util=require('util');var path=require(_0xdf7f('0x1'));var timeout=require('connect-timeout');var express=require(_0xdf7f('0x2'));var router=express[_0xdf7f('0x3')]();var fs_extra=require(_0xdf7f('0x4'));var auth=require(_0xdf7f('0x5'));var interaction=require(_0xdf7f('0x6'));var config=require(_0xdf7f('0x7'));var controller=require(_0xdf7f('0x8'));router[_0xdf7f('0x9')]('/',auth['isAuthenticated'](),controller[_0xdf7f('0xa')]);router[_0xdf7f('0x9')]('/describe',auth[_0xdf7f('0xb')](),controller[_0xdf7f('0xc')]);router[_0xdf7f('0x9')](_0xdf7f('0xd'),auth[_0xdf7f('0xb')](),controller[_0xdf7f('0xe')]);router[_0xdf7f('0xf')]('/',auth[_0xdf7f('0xb')](),controller[_0xdf7f('0x10')]);router[_0xdf7f('0x11')](_0xdf7f('0xd'),auth[_0xdf7f('0xb')](),controller[_0xdf7f('0x12')]);router[_0xdf7f('0x13')](_0xdf7f('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xdf7f('0x14')]=router; \ No newline at end of file +var _0xc02a=['fs-extra','../../components/interaction/service','./faxTransferReport.controller','get','/describe','isAuthenticated','describe','show','post','create','put','/:id','update','delete','destroy','exports','multer','path','express'];(function(_0x1bac0e,_0x1cc32b){var _0x37f932=function(_0x4f9704){while(--_0x4f9704){_0x1bac0e['push'](_0x1bac0e['shift']());}};_0x37f932(++_0x1cc32b);}(_0xc02a,0x107));var _0xac02=function(_0x487496,_0x249683){_0x487496=_0x487496-0x0;var _0x539dc8=_0xc02a[_0x487496];return _0x539dc8;};'use strict';var multer=require(_0xac02('0x0'));var util=require('util');var path=require(_0xac02('0x1'));var timeout=require('connect-timeout');var express=require(_0xac02('0x2'));var router=express['Router']();var fs_extra=require(_0xac02('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xac02('0x4'));var config=require('../../config/environment');var controller=require(_0xac02('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xac02('0x6')](_0xac02('0x7'),auth[_0xac02('0x8')](),controller[_0xac02('0x9')]);router[_0xac02('0x6')]('/:id',auth[_0xac02('0x8')](),controller[_0xac02('0xa')]);router[_0xac02('0xb')]('/',auth[_0xac02('0x8')](),controller[_0xac02('0xc')]);router[_0xac02('0xd')](_0xac02('0xe'),auth[_0xac02('0x8')](),controller[_0xac02('0xf')]);router[_0xac02('0x10')](_0xac02('0xe'),auth['isAuthenticated'](),controller[_0xac02('0x11')]);module[_0xac02('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 1fbd8ef..bfc57fa 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 _0xdc5e=['create','post','update','delete','exports','multer','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations'];(function(_0x282ccc,_0x5d66a1){var _0x27c2dd=function(_0x58431a){while(--_0x58431a){_0x282ccc['push'](_0x282ccc['shift']());}};_0x27c2dd(++_0x5d66a1);}(_0xdc5e,0x1f3));var _0xedc5=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xdc5e[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xedc5('0x0'));var util=require('util');var path=require(_0xedc5('0x1'));var timeout=require(_0xedc5('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xedc5('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xedc5('0x4'));var config=require(_0xedc5('0x5'));var controller=require(_0xedc5('0x6'));router[_0xedc5('0x7')]('/',auth['isAuthenticated'](),controller[_0xedc5('0x8')]);router[_0xedc5('0x7')](_0xedc5('0x9'),auth[_0xedc5('0xa')](),controller[_0xedc5('0xb')]);router[_0xedc5('0x7')](_0xedc5('0xc'),auth[_0xedc5('0xa')](),controller[_0xedc5('0xd')]);router[_0xedc5('0x7')]('/:id/fields',auth[_0xedc5('0xa')](),controller['getFields']);router['post']('/',auth[_0xedc5('0xa')](),controller[_0xedc5('0xe')]);router[_0xedc5('0xf')](_0xedc5('0xc'),auth[_0xedc5('0xa')](),controller['addConfiguration']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xedc5('0x10')]);router[_0xedc5('0x11')](_0xedc5('0x9'),auth[_0xedc5('0xa')](),controller['destroy']);module[_0xedc5('0x12')]=router; \ No newline at end of file +var _0xc869=['getConfigurations','get','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskAccount.controller','isAuthenticated','index','show'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0xc869,0x1a3));var _0x9c86=function(_0x5c0529,_0x3d9507){_0x5c0529=_0x5c0529-0x0;var _0x3505c8=_0xc869[_0x5c0529];return _0x3505c8;};'use strict';var multer=require(_0x9c86('0x0'));var util=require(_0x9c86('0x1'));var path=require(_0x9c86('0x2'));var timeout=require(_0x9c86('0x3'));var express=require(_0x9c86('0x4'));var router=express[_0x9c86('0x5')]();var fs_extra=require(_0x9c86('0x6'));var auth=require(_0x9c86('0x7'));var interaction=require(_0x9c86('0x8'));var config=require('../../config/environment');var controller=require(_0x9c86('0x9'));router['get']('/',auth[_0x9c86('0xa')](),controller[_0x9c86('0xb')]);router['get']('/:id',auth[_0x9c86('0xa')](),controller[_0x9c86('0xc')]);router['get']('/:id/configurations',auth[_0x9c86('0xa')](),controller[_0x9c86('0xd')]);router[_0x9c86('0xe')](_0x9c86('0xf'),auth[_0x9c86('0xa')](),controller[_0x9c86('0x10')]);router[_0x9c86('0x11')]('/',auth['isAuthenticated'](),controller[_0x9c86('0x12')]);router[_0x9c86('0x11')](_0x9c86('0x13'),auth[_0x9c86('0xa')](),controller[_0x9c86('0x14')]);router[_0x9c86('0x15')](_0x9c86('0x16'),auth[_0x9c86('0xa')](),controller[_0x9c86('0x17')]);router[_0x9c86('0x18')](_0x9c86('0x16'),auth[_0x9c86('0xa')](),controller[_0x9c86('0x19')]);module[_0x9c86('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 485d073..af88943 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 _0x9ebf=['basic','integrationTab','newTab','sequelize','exports','STRING','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9ebf,0xce));var _0xf9eb=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x9ebf[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require(_0xf9eb('0x0'));module[_0xf9eb('0x1')]={'name':{'type':Sequelize[_0xf9eb('0x2')]},'description':{'type':Sequelize[_0xf9eb('0x2')]},'username':{'type':Sequelize[_0xf9eb('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0xf9eb('0x3')](_0xf9eb('0x4')),'defaultValue':_0xf9eb('0x4')},'password':{'type':Sequelize[_0xf9eb('0x2')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0xf9eb('0x2')]},'token':{'type':Sequelize[_0xf9eb('0x2')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xf9eb('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf9eb('0x3')](_0xf9eb('0x5'),_0xf9eb('0x6')),'defaultValue':_0xf9eb('0x5')}}; \ No newline at end of file +var _0x20e7=['basic','integrationTab','newTab','STRING'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x20e7,0xc7));var _0x720e=function(_0x3eb943,_0x5c9b25){_0x3eb943=_0x3eb943-0x0;var _0x34206f=_0x20e7[_0x3eb943];return _0x34206f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x720e('0x0')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x720e('0x0')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize['ENUM'](_0x720e('0x1')),'defaultValue':_0x720e('0x1')},'password':{'type':Sequelize[_0x720e('0x0')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0x720e('0x0')]},'token':{'type':Sequelize[_0x720e('0x0')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x720e('0x0')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x720e('0x2'),_0x720e('0x3')),'defaultValue':_0x720e('0x2')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 2d3c769..48bf8fa 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 _0x5940=['map','VIRTUAL','filter','options','includeAll','include','rows','catch','find','create','body','params','getConfigurations','findOne','DeskConfiguration','length','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','DeskField','getFields','priority','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','remoteUri','slice','substring','lastIndexOf','%s/custom_fields','application/json','basic','headers','format','Basic\x20%s','base64','concat','_embedded','entries','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','then','destroy','error','name','send','DeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','pick','where','merge'];(function(_0x5d6482,_0x1c9b00){var _0x32e681=function(_0x398459){while(--_0x398459){_0x5d6482['push'](_0x5d6482['shift']());}};_0x32e681(++_0x1c9b00);}(_0x5940,0x178));var _0x0594=function(_0x7c7843,_0x2f5468){_0x7c7843=_0x7c7843-0x0;var _0x393bc0=_0x5940[_0x7c7843];return _0x393bc0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0594('0x0'));var rp=require(_0x0594('0x1'));var moment=require(_0x0594('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x0594('0x3'));var util=require('util');var path=require(_0x0594('0x4'));var sox=require(_0x0594('0x5'));var csv=require(_0x0594('0x6'));var ejs=require(_0x0594('0x7'));var fs=require('fs');var fs_extra=require(_0x0594('0x8'));var _=require(_0x0594('0x9'));var squel=require(_0x0594('0xa'));var crypto=require(_0x0594('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0594('0xc'));var toCsv=require(_0x0594('0x6'));var querystring=require('querystring');var Papa=require(_0x0594('0xd'));var Redis=require(_0x0594('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x0594('0xf'));var as=require(_0x0594('0x10'));var hardwareService=require(_0x0594('0x11'));var logger=require(_0x0594('0x12'))('api');var utils=require(_0x0594('0x13'));var config=require(_0x0594('0x14'));var licenseUtil=require(_0x0594('0x15'));var db=require(_0x0594('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x309d36,_0x30b3e7){_0x30b3e7=_0x30b3e7||0xcc;return function(_0x3562bf){if(_0x3562bf){return _0x309d36['sendStatus'](_0x30b3e7);}return _0x309d36[_0x0594('0x17')](_0x30b3e7)[_0x0594('0x18')]();};}function respondWithResult(_0x1aa7c8,_0x21ff2b){_0x21ff2b=_0x21ff2b||0xc8;return function(_0x25f3fd){if(_0x25f3fd){return _0x1aa7c8[_0x0594('0x17')](_0x21ff2b)[_0x0594('0x19')](_0x25f3fd);}};}function respondWithFilteredResult(_0x5a0df6,_0x270ce5){return function(_0x55a734){if(_0x55a734){var _0x53c55b=typeof _0x270ce5[_0x0594('0x1a')]===_0x0594('0x1b')&&typeof _0x270ce5[_0x0594('0x1c')]==='undefined';var _0x1f0baa=_0x55a734[_0x0594('0x1d')];var _0x1ba5bc=_0x53c55b?0x0:_0x270ce5['offset'];var _0x88c69e=_0x53c55b?_0x55a734[_0x0594('0x1d')]:_0x270ce5[_0x0594('0x1a')]+_0x270ce5[_0x0594('0x1c')];var _0xc84fb9;if(_0x88c69e>=_0x1f0baa){_0x88c69e=_0x1f0baa;_0xc84fb9=0xc8;}else{_0xc84fb9=0xce;}_0x5a0df6[_0x0594('0x17')](_0xc84fb9);return _0x5a0df6['set'](_0x0594('0x1e'),_0x1ba5bc+'-'+_0x88c69e+'/'+_0x1f0baa)[_0x0594('0x19')](_0x55a734);}return null;};}function patchUpdates(_0x5af316){return function(_0x1fbeb8){try{jsonpatch[_0x0594('0x1f')](_0x1fbeb8,_0x5af316,!![]);}catch(_0x52ebb4){return BPromise['reject'](_0x52ebb4);}return _0x1fbeb8[_0x0594('0x20')]();};}function saveUpdates(_0x57f5f7,_0x3edd7e){return function(_0x11bfb5){if(_0x11bfb5){return _0x11bfb5['update'](_0x57f5f7)[_0x0594('0x21')](function(_0x27295d){return _0x27295d;});}return null;};}function removeEntity(_0x56d24e,_0xa014f2){return function(_0x37d8df){if(_0x37d8df){return _0x37d8df[_0x0594('0x22')]()[_0x0594('0x21')](function(){_0x56d24e[_0x0594('0x17')](0xcc)[_0x0594('0x18')]();});}};}function handleEntityNotFound(_0x3352c9,_0x478434){return function(_0xc30000){if(!_0xc30000){_0x3352c9['sendStatus'](0x194);}return _0xc30000;};}function handleError(_0x35d5e4,_0x34079d){_0x34079d=_0x34079d||0x1f4;return function(_0x347d61){logger[_0x0594('0x23')](_0x347d61['stack']);if(_0x347d61[_0x0594('0x24')]){delete _0x347d61[_0x0594('0x24')];}_0x35d5e4['status'](_0x34079d)[_0x0594('0x25')](_0x347d61);};}exports['index']=function(_0x1624e8,_0xdc6c70){var _0x29c7a6={},_0x31fb70={},_0xffeb23={'count':0x0,'rows':[]};var _0x376fd0=_['map'](db[_0x0594('0x26')][_0x0594('0x27')],function(_0x5d3a5c){return{'name':_0x5d3a5c[_0x0594('0x28')],'type':_0x5d3a5c[_0x0594('0x29')][_0x0594('0x2a')]};});_0x31fb70[_0x0594('0x2b')]=_['map'](_0x376fd0,_0x0594('0x24'));_0x31fb70[_0x0594('0x2c')]=_[_0x0594('0x2d')](_0x1624e8['query']);_0x31fb70[_0x0594('0x2e')]=_[_0x0594('0x2f')](_0x31fb70[_0x0594('0x2b')],_0x31fb70[_0x0594('0x2c')]);_0x29c7a6['attributes']=_[_0x0594('0x2f')](_0x31fb70[_0x0594('0x2b')],qs['fields'](_0x1624e8[_0x0594('0x2c')][_0x0594('0x30')]));_0x29c7a6['attributes']=_0x29c7a6[_0x0594('0x31')]['length']?_0x29c7a6['attributes']:_0x31fb70[_0x0594('0x2b')];if(!_0x1624e8[_0x0594('0x2c')][_0x0594('0x32')]('nolimit')){_0x29c7a6[_0x0594('0x1c')]=qs[_0x0594('0x1c')](_0x1624e8[_0x0594('0x2c')]['limit']);_0x29c7a6['offset']=qs['offset'](_0x1624e8[_0x0594('0x2c')][_0x0594('0x1a')]);}_0x29c7a6[_0x0594('0x33')]=qs[_0x0594('0x34')](_0x1624e8[_0x0594('0x2c')][_0x0594('0x34')]);_0x29c7a6['where']=qs[_0x0594('0x2e')](_[_0x0594('0x35')](_0x1624e8[_0x0594('0x2c')],_0x31fb70['filters']),_0x376fd0);if(_0x1624e8[_0x0594('0x2c')]['filter']){_0x29c7a6[_0x0594('0x36')]=_[_0x0594('0x37')](_0x29c7a6[_0x0594('0x36')],{'$or':_[_0x0594('0x38')](_0x376fd0,function(_0x267b28){if(_0x267b28[_0x0594('0x29')]!==_0x0594('0x39')){var _0x2b4f91={};_0x2b4f91[_0x267b28[_0x0594('0x24')]]={'$like':'%'+_0x1624e8[_0x0594('0x2c')][_0x0594('0x3a')]+'%'};return _0x2b4f91;}})});}_0x29c7a6=_[_0x0594('0x37')]({},_0x29c7a6,_0x1624e8[_0x0594('0x3b')]);var _0xc93dd6={'where':_0x29c7a6[_0x0594('0x36')]};return db[_0x0594('0x26')][_0x0594('0x1d')](_0xc93dd6)[_0x0594('0x21')](function(_0xaf6d27){_0xffeb23[_0x0594('0x1d')]=_0xaf6d27;if(_0x1624e8[_0x0594('0x2c')][_0x0594('0x3c')]){_0x29c7a6[_0x0594('0x3d')]=[{'all':!![]}];}return db[_0x0594('0x26')]['findAll'](_0x29c7a6);})[_0x0594('0x21')](function(_0x5e4db6){_0xffeb23[_0x0594('0x3e')]=_0x5e4db6;return _0xffeb23;})[_0x0594('0x21')](respondWithFilteredResult(_0xdc6c70,_0x29c7a6))[_0x0594('0x3f')](handleError(_0xdc6c70,null));};exports['show']=function(_0x3324ab,_0x56d3b5){var _0x3fa0d3={'raw':![],'where':{'id':_0x3324ab['params']['id']}},_0xb79519={};_0xb79519[_0x0594('0x2b')]=_[_0x0594('0x2d')](db[_0x0594('0x26')][_0x0594('0x27')]);_0xb79519[_0x0594('0x2c')]=_[_0x0594('0x2d')](_0x3324ab[_0x0594('0x2c')]);_0xb79519[_0x0594('0x2e')]=_[_0x0594('0x2f')](_0xb79519[_0x0594('0x2b')],_0xb79519[_0x0594('0x2c')]);_0x3fa0d3[_0x0594('0x31')]=_[_0x0594('0x2f')](_0xb79519[_0x0594('0x2b')],qs[_0x0594('0x30')](_0x3324ab[_0x0594('0x2c')]['fields']));_0x3fa0d3[_0x0594('0x31')]=_0x3fa0d3[_0x0594('0x31')]['length']?_0x3fa0d3['attributes']:_0xb79519[_0x0594('0x2b')];if(_0x3324ab[_0x0594('0x2c')][_0x0594('0x3c')]){_0x3fa0d3[_0x0594('0x3d')]=[{'all':!![]}];}_0x3fa0d3=_['merge']({},_0x3fa0d3,_0x3324ab[_0x0594('0x3b')]);return db[_0x0594('0x26')][_0x0594('0x40')](_0x3fa0d3)[_0x0594('0x21')](handleEntityNotFound(_0x56d3b5,null))[_0x0594('0x21')](respondWithResult(_0x56d3b5,null))[_0x0594('0x3f')](handleError(_0x56d3b5,null));};exports[_0x0594('0x41')]=function(_0x33a0c2,_0x3046d4){return db[_0x0594('0x26')][_0x0594('0x41')](_0x33a0c2[_0x0594('0x42')],{})[_0x0594('0x21')](respondWithResult(_0x3046d4,0xc9))[_0x0594('0x3f')](handleError(_0x3046d4,null));};exports['update']=function(_0x1443b5,_0x54e467){if(_0x1443b5[_0x0594('0x42')]['id']){delete _0x1443b5[_0x0594('0x42')]['id'];}return db[_0x0594('0x26')]['find']({'where':{'id':_0x1443b5[_0x0594('0x43')]['id']}})[_0x0594('0x21')](handleEntityNotFound(_0x54e467,null))[_0x0594('0x21')](saveUpdates(_0x1443b5[_0x0594('0x42')],null))[_0x0594('0x21')](respondWithResult(_0x54e467,null))[_0x0594('0x3f')](handleError(_0x54e467,null));};exports[_0x0594('0x22')]=function(_0x5a8d9b,_0x4945df){return db[_0x0594('0x26')][_0x0594('0x40')]({'where':{'id':_0x5a8d9b['params']['id']}})[_0x0594('0x21')](handleEntityNotFound(_0x4945df,null))[_0x0594('0x21')](removeEntity(_0x4945df,null))[_0x0594('0x3f')](handleError(_0x4945df,null));};exports[_0x0594('0x44')]=function(_0x50d9b9,_0x89ac41,_0x21a11b){var _0x11a12e={};var _0x1dace6={};var _0x1af7c3;var _0x38f803;return db[_0x0594('0x26')][_0x0594('0x45')]({'where':{'id':_0x50d9b9['params']['id']}})['then'](handleEntityNotFound(_0x89ac41,null))['then'](function(_0x3ace93){if(_0x3ace93){_0x1af7c3=_0x3ace93;_0x1dace6[_0x0594('0x2b')]=_[_0x0594('0x2d')](db[_0x0594('0x46')][_0x0594('0x27')]);_0x1dace6[_0x0594('0x2c')]=_[_0x0594('0x2d')](_0x50d9b9[_0x0594('0x2c')]);_0x1dace6['filters']=_[_0x0594('0x2f')](_0x1dace6[_0x0594('0x2b')],_0x1dace6[_0x0594('0x2c')]);_0x11a12e[_0x0594('0x31')]=_[_0x0594('0x2f')](_0x1dace6[_0x0594('0x2b')],qs[_0x0594('0x30')](_0x50d9b9[_0x0594('0x2c')][_0x0594('0x30')]));_0x11a12e[_0x0594('0x31')]=_0x11a12e[_0x0594('0x31')]['length']?_0x11a12e[_0x0594('0x31')]:_0x1dace6[_0x0594('0x2b')];_0x11a12e[_0x0594('0x33')]=qs[_0x0594('0x34')](_0x50d9b9[_0x0594('0x2c')][_0x0594('0x34')]);_0x11a12e[_0x0594('0x36')]=qs[_0x0594('0x2e')](_[_0x0594('0x35')](_0x50d9b9[_0x0594('0x2c')],_0x1dace6[_0x0594('0x2e')]));if(_0x50d9b9[_0x0594('0x2c')]['filter']){_0x11a12e[_0x0594('0x36')]=_[_0x0594('0x37')](_0x11a12e['where'],{'$or':_[_0x0594('0x38')](_0x11a12e[_0x0594('0x31')],function(_0xf83387){var _0x51a21a={};_0x51a21a[_0xf83387]={'$like':'%'+_0x50d9b9[_0x0594('0x2c')][_0x0594('0x3a')]+'%'};return _0x51a21a;})});}_0x11a12e=_['merge']({},_0x11a12e,_0x50d9b9['options']);return _0x1af7c3['getConfigurations'](_0x11a12e);}})[_0x0594('0x21')](function(_0x5d061b){if(_0x5d061b){_0x38f803=_0x5d061b[_0x0594('0x47')];if(!_0x50d9b9[_0x0594('0x2c')][_0x0594('0x32')]('nolimit')){_0x11a12e['limit']=qs[_0x0594('0x1c')](_0x50d9b9['query'][_0x0594('0x1c')]);_0x11a12e[_0x0594('0x1a')]=qs[_0x0594('0x1a')](_0x50d9b9[_0x0594('0x2c')][_0x0594('0x1a')]);}return _0x1af7c3[_0x0594('0x44')](_0x11a12e);}})['then'](function(_0x420996){if(_0x420996){return _0x420996?{'count':_0x38f803,'rows':_0x420996}:null;}})[_0x0594('0x21')](respondWithResult(_0x89ac41,null))[_0x0594('0x3f')](handleError(_0x89ac41,null));};exports[_0x0594('0x48')]=function(_0x249db4,_0x19eead,_0x3b24d5){if(_0x249db4[_0x0594('0x42')]['id']){delete _0x249db4[_0x0594('0x42')]['id'];}return db[_0x0594('0x26')]['findOne']({'where':{'id':_0x249db4['params']['id']}})[_0x0594('0x21')](handleEntityNotFound(_0x19eead,null))[_0x0594('0x21')](function(_0xa536d8){if(_0xa536d8){_0x249db4['body'][_0x0594('0x49')]=_0xa536d8['id'];_0x249db4[_0x0594('0x42')][_0x0594('0x4a')]=integrations[_0x0594('0x4b')](_0x249db4[_0x0594('0x42')]['channel'],_0x249db4[_0x0594('0x42')][_0x0594('0x29')]);_0x249db4['body'][_0x0594('0x4c')]=integrations[_0x0594('0x4d')](_0x249db4[_0x0594('0x42')][_0x0594('0x4e')],_0x249db4['body'][_0x0594('0x29')]);return db['DeskConfiguration'][_0x0594('0x41')](_0x249db4['body'],{'include':[{'model':db[_0x0594('0x4f')],'as':'Subjects'},{'model':db['DeskField'],'as':'Descriptions'}]});}return null;})[_0x0594('0x21')](respondWithResult(_0x19eead,null))['catch'](handleError(_0x19eead,null));};exports[_0x0594('0x50')]=function(_0x2ef38a,_0x12299c,_0x3cca2f){var _0x23bbc9=[{'name':_0x0594('0x51'),'label':_0x0594('0x51'),'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 _0x886552='';return db[_0x0594('0x26')][_0x0594('0x45')]({'where':{'id':_0x2ef38a['params']['id']},'attributes':['id','remoteUri',_0x0594('0x52'),_0x0594('0x53'),_0x0594('0x54'),_0x0594('0x55'),_0x0594('0x56'),_0x0594('0x57'),_0x0594('0x58')]})[_0x0594('0x21')](handleEntityNotFound(_0x12299c,null))[_0x0594('0x21')](function(_0x5366b2){if(_0x5366b2){_0x886552=_0x5366b2[_0x0594('0x59')];var _0x104dd4=_0x886552[_0x0594('0x5a')](-0x1);if(_0x104dd4==='/'){_0x886552=_0x886552[_0x0594('0x5b')](0x0,_0x886552[_0x0594('0x5c')](_0x104dd4));}var _0x4afaad={'method':'GET','uri':util['format'](_0x0594('0x5d'),_0x886552),'headers':{'Content-Type':_0x0594('0x5e'),'Accept':_0x0594('0x5e')},'json':!![]};if(_0x5366b2[_0x0594('0x52')]===_0x0594('0x5f')){_0x4afaad[_0x0594('0x60')]['Authorization']=util[_0x0594('0x61')](_0x0594('0x62'),new Buffer(util[_0x0594('0x61')]('%s:%s',_0x5366b2[_0x0594('0x53')],_0x5366b2['password']))['toString'](_0x0594('0x63')));}return rp(_0x4afaad)[_0x0594('0x21')](function(_0x161e70){return _0x23bbc9[_0x0594('0x64')](_['map'](_0x161e70[_0x0594('0x65')][_0x0594('0x66')],function(_0xd74b9e){return{'id':_0xd74b9e[_0x0594('0x24')],'name':_0xd74b9e['name'],'type':_0xd74b9e[_0x0594('0x29')],'active':_0xd74b9e['active'],'label':_0xd74b9e['label'],'custom':!![]};}));});}})[_0x0594('0x21')](function(_0x3334bc){return{'count':_0x3334bc[_0x0594('0x47')],'rows':_0x3334bc};})[_0x0594('0x21')](respondWithResult(_0x12299c,null))[_0x0594('0x3f')](function(_0x596ccf){var _0xa617e9=_0x2ef38a[_0x0594('0x2c')][_0x0594('0x67')]?0x1f4:_0x596ccf[_0x0594('0x68')]||0x1f4;logger[_0x0594('0x23')](_0x0594('0x69'),_0x0594('0x50'),_0xa617e9,JSON[_0x0594('0x6a')](_0x596ccf));delete _0x596ccf[_0x0594('0x24')];if(_0xa617e9===0x191){_0xa617e9=0x190;}_0x12299c[_0x0594('0x17')](_0xa617e9)[_0x0594('0x25')](_0x2ef38a[_0x0594('0x2c')][_0x0594('0x67')]?{'message':_0x0594('0x6b'),'statusCode':_0x596ccf[_0x0594('0x68')]}:_0x596ccf);});}; \ No newline at end of file +var _0xb50a=['merge','where','VIRTUAL','options','count','includeAll','include','findAll','params','keys','find','catch','create','body','destroy','getConfigurations','findOne','DeskConfiguration','filter','nolimit','addConfiguration','AccountId','Subjects','getSubjects','type','Descriptions','DeskField','getFields','priority','remoteUri','authType','username','consumerKey','consumerSecret','token','tokenSecret','slice','lastIndexOf','GET','format','%s/custom_fields','application/json','headers','Authorization','Basic\x20%s','%s:%s','toString','base64','concat','_embedded','entries','active','label','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','undefined','limit','offset','status','Content-Range','json','apply','reject','save','update','then','error','name','index','map','DeskAccount','rawAttributes','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick'];(function(_0x1cd297,_0x4b2b98){var _0x2ea65f=function(_0x3dea33){while(--_0x3dea33){_0x1cd297['push'](_0x1cd297['shift']());}};_0x2ea65f(++_0x4b2b98);}(_0xb50a,0x18f));var _0xab50=function(_0x1c4071,_0x8ca88d){_0x1c4071=_0x1c4071-0x0;var _0x4afb04=_0xb50a[_0x1c4071];return _0x4afb04;};'use strict';var emlformat=require(_0xab50('0x0'));var rimraf=require(_0xab50('0x1'));var zipdir=require(_0xab50('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xab50('0x3'));var moment=require(_0xab50('0x4'));var BPromise=require(_0xab50('0x5'));var Mustache=require(_0xab50('0x6'));var util=require(_0xab50('0x7'));var path=require(_0xab50('0x8'));var sox=require(_0xab50('0x9'));var csv=require(_0xab50('0xa'));var ejs=require(_0xab50('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xab50('0xc'));var crypto=require(_0xab50('0xd'));var jsforce=require(_0xab50('0xe'));var deskjs=require(_0xab50('0xf'));var toCsv=require(_0xab50('0xa'));var querystring=require(_0xab50('0x10'));var Papa=require(_0xab50('0x11'));var Redis=require(_0xab50('0x12'));var authService=require(_0xab50('0x13'));var qs=require(_0xab50('0x14'));var as=require(_0xab50('0x15'));var hardwareService=require(_0xab50('0x16'));var logger=require(_0xab50('0x17'))('api');var utils=require(_0xab50('0x18'));var config=require(_0xab50('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xab50('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x208e92,_0x22dbf4){_0x22dbf4=_0x22dbf4||0xcc;return function(_0x19fe75){if(_0x19fe75){return _0x208e92[_0xab50('0x1b')](_0x22dbf4);}return _0x208e92['status'](_0x22dbf4)[_0xab50('0x1c')]();};}function respondWithResult(_0x1a372e,_0x561232){_0x561232=_0x561232||0xc8;return function(_0x22db29){if(_0x22db29){return _0x1a372e['status'](_0x561232)['json'](_0x22db29);}};}function respondWithFilteredResult(_0x33eba5,_0x52dde6){return function(_0x5a2b93){if(_0x5a2b93){var _0xa28843=typeof _0x52dde6['offset']===_0xab50('0x1d')&&typeof _0x52dde6[_0xab50('0x1e')]===_0xab50('0x1d');var _0x89a5ac=_0x5a2b93['count'];var _0x356123=_0xa28843?0x0:_0x52dde6[_0xab50('0x1f')];var _0x18f219=_0xa28843?_0x5a2b93['count']:_0x52dde6[_0xab50('0x1f')]+_0x52dde6[_0xab50('0x1e')];var _0x3dcd6d;if(_0x18f219>=_0x89a5ac){_0x18f219=_0x89a5ac;_0x3dcd6d=0xc8;}else{_0x3dcd6d=0xce;}_0x33eba5[_0xab50('0x20')](_0x3dcd6d);return _0x33eba5['set'](_0xab50('0x21'),_0x356123+'-'+_0x18f219+'/'+_0x89a5ac)[_0xab50('0x22')](_0x5a2b93);}return null;};}function patchUpdates(_0x2891ea){return function(_0x4c06c8){try{jsonpatch[_0xab50('0x23')](_0x4c06c8,_0x2891ea,!![]);}catch(_0x2fd666){return BPromise[_0xab50('0x24')](_0x2fd666);}return _0x4c06c8[_0xab50('0x25')]();};}function saveUpdates(_0x4276cd,_0x530da9){return function(_0x34c41c){if(_0x34c41c){return _0x34c41c[_0xab50('0x26')](_0x4276cd)[_0xab50('0x27')](function(_0x2aaceb){return _0x2aaceb;});}return null;};}function removeEntity(_0x4cdee7,_0x393c6a){return function(_0x2f8849){if(_0x2f8849){return _0x2f8849['destroy']()[_0xab50('0x27')](function(){_0x4cdee7[_0xab50('0x20')](0xcc)[_0xab50('0x1c')]();});}};}function handleEntityNotFound(_0x2ccab8,_0x345330){return function(_0x3eb879){if(!_0x3eb879){_0x2ccab8[_0xab50('0x1b')](0x194);}return _0x3eb879;};}function handleError(_0x362f41,_0xb35ebc){_0xb35ebc=_0xb35ebc||0x1f4;return function(_0x316214){logger[_0xab50('0x28')](_0x316214['stack']);if(_0x316214[_0xab50('0x29')]){delete _0x316214['name'];}_0x362f41[_0xab50('0x20')](_0xb35ebc)['send'](_0x316214);};}exports[_0xab50('0x2a')]=function(_0x5599ed,_0x41dc84){var _0x2cfec5={},_0x41dae5={},_0x32eb24={'count':0x0,'rows':[]};var _0x1aefae=_[_0xab50('0x2b')](db[_0xab50('0x2c')][_0xab50('0x2d')],function(_0x13dea9){return{'name':_0x13dea9['fieldName'],'type':_0x13dea9['type']['key']};});_0x41dae5[_0xab50('0x2e')]=_[_0xab50('0x2b')](_0x1aefae,_0xab50('0x29'));_0x41dae5['query']=_['keys'](_0x5599ed[_0xab50('0x2f')]);_0x41dae5[_0xab50('0x30')]=_['intersection'](_0x41dae5[_0xab50('0x2e')],_0x41dae5['query']);_0x2cfec5[_0xab50('0x31')]=_[_0xab50('0x32')](_0x41dae5[_0xab50('0x2e')],qs[_0xab50('0x33')](_0x5599ed['query'][_0xab50('0x33')]));_0x2cfec5[_0xab50('0x31')]=_0x2cfec5[_0xab50('0x31')][_0xab50('0x34')]?_0x2cfec5[_0xab50('0x31')]:_0x41dae5[_0xab50('0x2e')];if(!_0x5599ed['query'][_0xab50('0x35')]('nolimit')){_0x2cfec5['limit']=qs['limit'](_0x5599ed['query']['limit']);_0x2cfec5[_0xab50('0x1f')]=qs[_0xab50('0x1f')](_0x5599ed[_0xab50('0x2f')][_0xab50('0x1f')]);}_0x2cfec5[_0xab50('0x36')]=qs[_0xab50('0x37')](_0x5599ed[_0xab50('0x2f')]['sort']);_0x2cfec5['where']=qs['filters'](_[_0xab50('0x38')](_0x5599ed[_0xab50('0x2f')],_0x41dae5[_0xab50('0x30')]),_0x1aefae);if(_0x5599ed[_0xab50('0x2f')]['filter']){_0x2cfec5['where']=_[_0xab50('0x39')](_0x2cfec5[_0xab50('0x3a')],{'$or':_['map'](_0x1aefae,function(_0xb7f3d1){if(_0xb7f3d1['type']!==_0xab50('0x3b')){var _0x10e76b={};_0x10e76b[_0xb7f3d1[_0xab50('0x29')]]={'$like':'%'+_0x5599ed[_0xab50('0x2f')]['filter']+'%'};return _0x10e76b;}})});}_0x2cfec5=_[_0xab50('0x39')]({},_0x2cfec5,_0x5599ed[_0xab50('0x3c')]);var _0x4a1b85={'where':_0x2cfec5[_0xab50('0x3a')]};return db[_0xab50('0x2c')]['count'](_0x4a1b85)['then'](function(_0x31368f){_0x32eb24[_0xab50('0x3d')]=_0x31368f;if(_0x5599ed[_0xab50('0x2f')][_0xab50('0x3e')]){_0x2cfec5[_0xab50('0x3f')]=[{'all':!![]}];}return db[_0xab50('0x2c')][_0xab50('0x40')](_0x2cfec5);})[_0xab50('0x27')](function(_0x184cc9){_0x32eb24['rows']=_0x184cc9;return _0x32eb24;})[_0xab50('0x27')](respondWithFilteredResult(_0x41dc84,_0x2cfec5))['catch'](handleError(_0x41dc84,null));};exports['show']=function(_0x5753b2,_0x48ee11){var _0x4056a9={'raw':![],'where':{'id':_0x5753b2[_0xab50('0x41')]['id']}},_0x51400c={};_0x51400c[_0xab50('0x2e')]=_[_0xab50('0x42')](db[_0xab50('0x2c')][_0xab50('0x2d')]);_0x51400c['query']=_['keys'](_0x5753b2[_0xab50('0x2f')]);_0x51400c[_0xab50('0x30')]=_['intersection'](_0x51400c['model'],_0x51400c[_0xab50('0x2f')]);_0x4056a9['attributes']=_[_0xab50('0x32')](_0x51400c[_0xab50('0x2e')],qs['fields'](_0x5753b2['query'][_0xab50('0x33')]));_0x4056a9['attributes']=_0x4056a9[_0xab50('0x31')][_0xab50('0x34')]?_0x4056a9[_0xab50('0x31')]:_0x51400c['model'];if(_0x5753b2[_0xab50('0x2f')][_0xab50('0x3e')]){_0x4056a9[_0xab50('0x3f')]=[{'all':!![]}];}_0x4056a9=_[_0xab50('0x39')]({},_0x4056a9,_0x5753b2[_0xab50('0x3c')]);return db[_0xab50('0x2c')][_0xab50('0x43')](_0x4056a9)[_0xab50('0x27')](handleEntityNotFound(_0x48ee11,null))['then'](respondWithResult(_0x48ee11,null))[_0xab50('0x44')](handleError(_0x48ee11,null));};exports[_0xab50('0x45')]=function(_0x12ed19,_0x173441){return db[_0xab50('0x2c')][_0xab50('0x45')](_0x12ed19[_0xab50('0x46')],{})[_0xab50('0x27')](respondWithResult(_0x173441,0xc9))[_0xab50('0x44')](handleError(_0x173441,null));};exports[_0xab50('0x26')]=function(_0x5548e4,_0x11a7aa){if(_0x5548e4[_0xab50('0x46')]['id']){delete _0x5548e4[_0xab50('0x46')]['id'];}return db[_0xab50('0x2c')]['find']({'where':{'id':_0x5548e4[_0xab50('0x41')]['id']}})[_0xab50('0x27')](handleEntityNotFound(_0x11a7aa,null))[_0xab50('0x27')](saveUpdates(_0x5548e4[_0xab50('0x46')],null))[_0xab50('0x27')](respondWithResult(_0x11a7aa,null))[_0xab50('0x44')](handleError(_0x11a7aa,null));};exports[_0xab50('0x47')]=function(_0x2ab1fe,_0x5353a3){return db['DeskAccount'][_0xab50('0x43')]({'where':{'id':_0x2ab1fe[_0xab50('0x41')]['id']}})[_0xab50('0x27')](handleEntityNotFound(_0x5353a3,null))['then'](removeEntity(_0x5353a3,null))[_0xab50('0x44')](handleError(_0x5353a3,null));};exports[_0xab50('0x48')]=function(_0x1f2740,_0x4b078a,_0x3da7cf){var _0x3a7c94={};var _0x234af3={};var _0x4b9bf3;var _0x4f2d2d;return db['DeskAccount'][_0xab50('0x49')]({'where':{'id':_0x1f2740[_0xab50('0x41')]['id']}})['then'](handleEntityNotFound(_0x4b078a,null))['then'](function(_0x2ffb8b){if(_0x2ffb8b){_0x4b9bf3=_0x2ffb8b;_0x234af3[_0xab50('0x2e')]=_[_0xab50('0x42')](db[_0xab50('0x4a')][_0xab50('0x2d')]);_0x234af3[_0xab50('0x2f')]=_[_0xab50('0x42')](_0x1f2740['query']);_0x234af3[_0xab50('0x30')]=_[_0xab50('0x32')](_0x234af3[_0xab50('0x2e')],_0x234af3[_0xab50('0x2f')]);_0x3a7c94[_0xab50('0x31')]=_['intersection'](_0x234af3[_0xab50('0x2e')],qs['fields'](_0x1f2740['query'][_0xab50('0x33')]));_0x3a7c94[_0xab50('0x31')]=_0x3a7c94[_0xab50('0x31')][_0xab50('0x34')]?_0x3a7c94[_0xab50('0x31')]:_0x234af3[_0xab50('0x2e')];_0x3a7c94[_0xab50('0x36')]=qs[_0xab50('0x37')](_0x1f2740[_0xab50('0x2f')][_0xab50('0x37')]);_0x3a7c94[_0xab50('0x3a')]=qs[_0xab50('0x30')](_[_0xab50('0x38')](_0x1f2740[_0xab50('0x2f')],_0x234af3[_0xab50('0x30')]));if(_0x1f2740['query']['filter']){_0x3a7c94[_0xab50('0x3a')]=_[_0xab50('0x39')](_0x3a7c94['where'],{'$or':_['map'](_0x3a7c94[_0xab50('0x31')],function(_0x81e936){var _0x494593={};_0x494593[_0x81e936]={'$like':'%'+_0x1f2740[_0xab50('0x2f')][_0xab50('0x4b')]+'%'};return _0x494593;})});}_0x3a7c94=_[_0xab50('0x39')]({},_0x3a7c94,_0x1f2740[_0xab50('0x3c')]);return _0x4b9bf3[_0xab50('0x48')](_0x3a7c94);}})[_0xab50('0x27')](function(_0x3bbeaf){if(_0x3bbeaf){_0x4f2d2d=_0x3bbeaf[_0xab50('0x34')];if(!_0x1f2740[_0xab50('0x2f')][_0xab50('0x35')](_0xab50('0x4c'))){_0x3a7c94[_0xab50('0x1e')]=qs['limit'](_0x1f2740[_0xab50('0x2f')][_0xab50('0x1e')]);_0x3a7c94[_0xab50('0x1f')]=qs['offset'](_0x1f2740[_0xab50('0x2f')]['offset']);}return _0x4b9bf3['getConfigurations'](_0x3a7c94);}})['then'](function(_0x4b7a2f){if(_0x4b7a2f){return _0x4b7a2f?{'count':_0x4f2d2d,'rows':_0x4b7a2f}:null;}})[_0xab50('0x27')](respondWithResult(_0x4b078a,null))['catch'](handleError(_0x4b078a,null));};exports[_0xab50('0x4d')]=function(_0x882119,_0x3a10ff,_0xa80086){if(_0x882119[_0xab50('0x46')]['id']){delete _0x882119[_0xab50('0x46')]['id'];}return db[_0xab50('0x2c')][_0xab50('0x49')]({'where':{'id':_0x882119[_0xab50('0x41')]['id']}})['then'](handleEntityNotFound(_0x3a10ff,null))['then'](function(_0x1f21c5){if(_0x1f21c5){_0x882119[_0xab50('0x46')][_0xab50('0x4e')]=_0x1f21c5['id'];_0x882119[_0xab50('0x46')][_0xab50('0x4f')]=integrations[_0xab50('0x50')](_0x882119[_0xab50('0x46')]['channel'],_0x882119[_0xab50('0x46')][_0xab50('0x51')]);_0x882119[_0xab50('0x46')][_0xab50('0x52')]=integrations['getDescriptions'](_0x882119[_0xab50('0x46')]['channel'],_0x882119['body'][_0xab50('0x51')]);return db['DeskConfiguration'][_0xab50('0x45')](_0x882119[_0xab50('0x46')],{'include':[{'model':db['DeskField'],'as':_0xab50('0x4f')},{'model':db[_0xab50('0x53')],'as':'Descriptions'}]});}return null;})[_0xab50('0x27')](respondWithResult(_0x3a10ff,null))['catch'](handleError(_0x3a10ff,null));};exports[_0xab50('0x54')]=function(_0x1c4041,_0x1f4196,_0x3dbce1){var _0x2fbc3f=[{'name':_0xab50('0x55'),'label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x486b06='';return db[_0xab50('0x2c')]['findOne']({'where':{'id':_0x1c4041[_0xab50('0x41')]['id']},'attributes':['id',_0xab50('0x56'),_0xab50('0x57'),_0xab50('0x58'),'password',_0xab50('0x59'),_0xab50('0x5a'),_0xab50('0x5b'),_0xab50('0x5c')]})['then'](handleEntityNotFound(_0x1f4196,null))[_0xab50('0x27')](function(_0x42ec69){if(_0x42ec69){_0x486b06=_0x42ec69[_0xab50('0x56')];var _0x53e5d7=_0x486b06[_0xab50('0x5d')](-0x1);if(_0x53e5d7==='/'){_0x486b06=_0x486b06['substring'](0x0,_0x486b06[_0xab50('0x5e')](_0x53e5d7));}var _0x2b9695={'method':_0xab50('0x5f'),'uri':util[_0xab50('0x60')](_0xab50('0x61'),_0x486b06),'headers':{'Content-Type':_0xab50('0x62'),'Accept':_0xab50('0x62')},'json':!![]};if(_0x42ec69[_0xab50('0x57')]==='basic'){_0x2b9695[_0xab50('0x63')][_0xab50('0x64')]=util[_0xab50('0x60')](_0xab50('0x65'),new Buffer(util['format'](_0xab50('0x66'),_0x42ec69['username'],_0x42ec69['password']))[_0xab50('0x67')](_0xab50('0x68')));}return rp(_0x2b9695)[_0xab50('0x27')](function(_0x52bed6){return _0x2fbc3f[_0xab50('0x69')](_[_0xab50('0x2b')](_0x52bed6[_0xab50('0x6a')][_0xab50('0x6b')],function(_0x173d19){return{'id':_0x173d19['name'],'name':_0x173d19[_0xab50('0x29')],'type':_0x173d19[_0xab50('0x51')],'active':_0x173d19[_0xab50('0x6c')],'label':_0x173d19[_0xab50('0x6d')],'custom':!![]};}));});}})['then'](function(_0x29ac6c){return{'count':_0x29ac6c[_0xab50('0x34')],'rows':_0x29ac6c};})[_0xab50('0x27')](respondWithResult(_0x1f4196,null))[_0xab50('0x44')](function(_0x2cf06e){var _0x3c3c74=_0x1c4041[_0xab50('0x2f')]['test']?0x1f4:_0x2cf06e['statusCode']||0x1f4;logger[_0xab50('0x28')](_0xab50('0x6e'),_0xab50('0x54'),_0x3c3c74,JSON[_0xab50('0x6f')](_0x2cf06e));delete _0x2cf06e[_0xab50('0x29')];if(_0x3c3c74===0x191){_0x3c3c74=0x190;}_0x1f4196[_0xab50('0x20')](_0x3c3c74)['send'](_0x1c4041[_0xab50('0x2f')][_0xab50('0x70')]?{'message':_0xab50('0x71'),'statusCode':_0x2cf06e['statusCode']}:_0x2cf06e);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 6272d3c..e63f932 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 _0x2e1f=['DeskAccount','int_desk_accounts','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','../../components/integrations/configuration','exports','define'];(function(_0x112375,_0x2cebbd){var _0x481f0d=function(_0x9d5b62){while(--_0x9d5b62){_0x112375['push'](_0x112375['shift']());}};_0x481f0d(++_0x2cebbd);}(_0x2e1f,0x84));var _0xf2e1=function(_0x13137e,_0x29c0f3){_0x13137e=_0x13137e-0x0;var _0x346261=_0x2e1f[_0x13137e];return _0x346261;};'use strict';var _=require(_0xf2e1('0x0'));var util=require(_0xf2e1('0x1'));var logger=require(_0xf2e1('0x2'))(_0xf2e1('0x3'));var moment=require(_0xf2e1('0x4'));var BPromise=require(_0xf2e1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf2e1('0x6'));var config=require(_0xf2e1('0x7'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0xf2e1('0x8'));module[_0xf2e1('0x9')]=function(_0x150017,_0x59983f){return _0x150017[_0xf2e1('0xa')](_0xf2e1('0xb'),attributes,{'tableName':_0xf2e1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f9e=['lodash','api','moment','bluebird','request-promise','rimraf','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','int_desk_accounts'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x6f9e,0x155));var _0xe6f9=function(_0x32126f,_0xb8d4e6){_0x32126f=_0x32126f-0x0;var _0x492842=_0x6f9e[_0x32126f];return _0x492842;};'use strict';var _=require(_0xe6f9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe6f9('0x1'));var moment=require(_0xe6f9('0x2'));var BPromise=require(_0xe6f9('0x3'));var rp=require(_0xe6f9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe6f9('0x5'));var config=require('../../config/environment');var attributes=require(_0xe6f9('0x6'));var integrations=require(_0xe6f9('0x7'));module[_0xe6f9('0x8')]=function(_0x47ffe1,_0x44e7d9){return _0x47ffe1[_0xe6f9('0x9')]('DeskAccount',attributes,{'tableName':_0xe6f9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 8e05854..f572263 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 _0x293e=['catch','GetDeskAccount','DeskAccount','options','raw','where','attributes','limit','include','map','model','ShowDeskAccount','find','then','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x1ebeea,_0x2f54f4){var _0x576465=function(_0x47fc77){while(--_0x47fc77){_0x1ebeea['push'](_0x1ebeea['shift']());}};_0x576465(++_0x2f54f4);}(_0x293e,0x164));var _0xe293=function(_0x493af0,_0xedb428){_0x493af0=_0x493af0-0x0;var _0x227fd8=_0x293e[_0x493af0];return _0x227fd8;};'use strict';var _=require(_0xe293('0x0'));var util=require(_0xe293('0x1'));var moment=require(_0xe293('0x2'));var BPromise=require('bluebird');var rs=require(_0xe293('0x3'));var fs=require('fs');var Redis=require(_0xe293('0x4'));var db=require(_0xe293('0x5'))['db'];var utils=require(_0xe293('0x6'));var logger=require(_0xe293('0x7'))(_0xe293('0x8'));var config=require(_0xe293('0x9'));var jayson=require(_0xe293('0xa'));var client=jayson[_0xe293('0xb')][_0xe293('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x54a9e7,_0x4aa62e,_0x459c24){return new BPromise(function(_0x4004c8,_0x59889f){return client[_0xe293('0xd')](_0x54a9e7,_0x459c24)['then'](function(_0x5e4a3c){logger[_0xe293('0xe')](_0xe293('0xf'),_0x4aa62e,'request\x20sent');logger[_0xe293('0x10')](_0xe293('0x11'),_0x4aa62e,_0xe293('0x12'),JSON[_0xe293('0x13')](_0x5e4a3c));if(_0x5e4a3c[_0xe293('0x14')]){if(_0x5e4a3c['error'][_0xe293('0x15')]===0x1f4){logger[_0xe293('0x14')](_0xe293('0xf'),_0x4aa62e,_0x5e4a3c['error']['message']);return _0x59889f(_0x5e4a3c['error'][_0xe293('0x16')]);}logger[_0xe293('0x14')]('DeskAccount,\x20%s,\x20%s',_0x4aa62e,_0x5e4a3c[_0xe293('0x14')][_0xe293('0x16')]);return _0x4004c8(_0x5e4a3c[_0xe293('0x14')][_0xe293('0x16')]);}else{logger[_0xe293('0xe')](_0xe293('0xf'),_0x4aa62e,_0xe293('0x12'));_0x4004c8(_0x5e4a3c[_0xe293('0x17')][_0xe293('0x16')]);}})[_0xe293('0x18')](function(_0x141f45){logger[_0xe293('0x14')](_0xe293('0xf'),_0x4aa62e,_0x141f45);_0x59889f(_0x141f45);});});}exports[_0xe293('0x19')]=function(_0x50fa8d){var _0x1c07dc=this;return new Promise(function(_0x4f01c0,_0x2f2cb0){return db[_0xe293('0x1a')]['findAll']({'raw':_0x50fa8d[_0xe293('0x1b')]?_0x50fa8d[_0xe293('0x1b')][_0xe293('0x1c')]===undefined?!![]:![]:!![],'where':_0x50fa8d['options']?_0x50fa8d[_0xe293('0x1b')][_0xe293('0x1d')]||null:null,'attributes':_0x50fa8d['options']?_0x50fa8d[_0xe293('0x1b')][_0xe293('0x1e')]||null:null,'limit':_0x50fa8d[_0xe293('0x1b')]?_0x50fa8d[_0xe293('0x1b')][_0xe293('0x1f')]||null:null,'include':_0x50fa8d[_0xe293('0x1b')]?_0x50fa8d['options'][_0xe293('0x20')]?_[_0xe293('0x21')](_0x50fa8d[_0xe293('0x1b')][_0xe293('0x20')],function(_0x459253){return{'model':db[_0x459253[_0xe293('0x22')]],'as':_0x459253['as'],'attributes':_0x459253['attributes'],'include':_0x459253[_0xe293('0x20')]?_[_0xe293('0x21')](_0x459253[_0xe293('0x20')],function(_0x1a4240){return{'model':db[_0x1a4240[_0xe293('0x22')]],'as':_0x1a4240['as'],'attributes':_0x1a4240[_0xe293('0x1e')],'include':_0x1a4240['include']?_[_0xe293('0x21')](_0x1a4240[_0xe293('0x20')],function(_0x36bdeb){return{'model':db[_0x36bdeb[_0xe293('0x22')]],'as':_0x36bdeb['as'],'attributes':_0x36bdeb[_0xe293('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x49019a){logger['info'](_0xe293('0x19'),_0x50fa8d);logger[_0xe293('0x10')](_0xe293('0x19'),_0x50fa8d,JSON[_0xe293('0x13')](_0x49019a));_0x4f01c0(_0x49019a);})[_0xe293('0x18')](function(_0x360fe8){logger['error'](_0xe293('0x19'),_0x360fe8[_0xe293('0x16')],_0x50fa8d);_0x2f2cb0(_0x1c07dc['error'](0x1f4,_0x360fe8[_0xe293('0x16')]));});});};exports[_0xe293('0x23')]=function(_0x136679){var _0xaa3378=this;return new Promise(function(_0xe5bb8f,_0x3ec69c){return db[_0xe293('0x1a')][_0xe293('0x24')]({'raw':_0x136679[_0xe293('0x1b')]?_0x136679[_0xe293('0x1b')][_0xe293('0x1c')]===undefined?!![]:![]:!![],'where':_0x136679[_0xe293('0x1b')]?_0x136679[_0xe293('0x1b')]['where']||null:null,'attributes':_0x136679[_0xe293('0x1b')]?_0x136679['options'][_0xe293('0x1e')]||null:null,'include':_0x136679['options']?_0x136679['options']['include']?_[_0xe293('0x21')](_0x136679['options']['include'],function(_0x52fcd9){return{'model':db[_0x52fcd9[_0xe293('0x22')]],'as':_0x52fcd9['as'],'attributes':_0x52fcd9[_0xe293('0x1e')],'include':_0x52fcd9[_0xe293('0x20')]?_['map'](_0x52fcd9[_0xe293('0x20')],function(_0x775a28){return{'model':db[_0x775a28['model']],'as':_0x775a28['as'],'attributes':_0x775a28[_0xe293('0x1e')],'include':_0x775a28['include']?_['map'](_0x775a28['include'],function(_0x1c6ab4){return{'model':db[_0x1c6ab4['model']],'as':_0x1c6ab4['as'],'attributes':_0x1c6ab4[_0xe293('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xe293('0x25')](function(_0x3b9235){logger['info'](_0xe293('0x23'),_0x136679);logger[_0xe293('0x10')](_0xe293('0x23'),_0x136679,JSON[_0xe293('0x13')](_0x3b9235));_0xe5bb8f(_0x3b9235);})[_0xe293('0x18')](function(_0x1827a1){logger[_0xe293('0x14')](_0xe293('0x23'),_0x1827a1[_0xe293('0x16')],_0x136679);_0x3ec69c(_0xaa3378[_0xe293('0x14')](0x1f4,_0x1827a1[_0xe293('0x16')]));});});}; \ No newline at end of file +var _0x9a5d=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','catch','GetDeskAccount','DeskAccount','findAll','options','raw','limit','map','model','attributes','include','then','stringify','ShowDeskAccount','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x35c021,_0x1b1c07){var _0xca7a81=function(_0x366f71){while(--_0x366f71){_0x35c021['push'](_0x35c021['shift']());}};_0xca7a81(++_0x1b1c07);}(_0x9a5d,0xf6));var _0xd9a5=function(_0x41cec2,_0xe1e3d6){_0x41cec2=_0x41cec2-0x0;var _0x524cb6=_0x9a5d[_0x41cec2];return _0x524cb6;};'use strict';var _=require(_0xd9a5('0x0'));var util=require(_0xd9a5('0x1'));var moment=require(_0xd9a5('0x2'));var BPromise=require(_0xd9a5('0x3'));var rs=require(_0xd9a5('0x4'));var fs=require('fs');var Redis=require(_0xd9a5('0x5'));var db=require(_0xd9a5('0x6'))['db'];var utils=require(_0xd9a5('0x7'));var logger=require(_0xd9a5('0x8'))(_0xd9a5('0x9'));var config=require(_0xd9a5('0xa'));var jayson=require(_0xd9a5('0xb'));var client=jayson[_0xd9a5('0xc')][_0xd9a5('0xd')]({'port':0x232a});function respondWithRpcPromise(_0xb9a379,_0x3a4d98,_0x4f6bd3){return new BPromise(function(_0x9d365,_0x39a9ab){return client[_0xd9a5('0xe')](_0xb9a379,_0x4f6bd3)['then'](function(_0x33c00e){logger[_0xd9a5('0xf')](_0xd9a5('0x10'),_0x3a4d98,'request\x20sent');logger[_0xd9a5('0x11')](_0xd9a5('0x12'),_0x3a4d98,'request\x20sent',JSON['stringify'](_0x33c00e));if(_0x33c00e['error']){if(_0x33c00e[_0xd9a5('0x13')]['code']===0x1f4){logger[_0xd9a5('0x13')]('DeskAccount,\x20%s,\x20%s',_0x3a4d98,_0x33c00e[_0xd9a5('0x13')][_0xd9a5('0x14')]);return _0x39a9ab(_0x33c00e['error'][_0xd9a5('0x14')]);}logger[_0xd9a5('0x13')](_0xd9a5('0x10'),_0x3a4d98,_0x33c00e[_0xd9a5('0x13')]['message']);return _0x9d365(_0x33c00e[_0xd9a5('0x13')][_0xd9a5('0x14')]);}else{logger[_0xd9a5('0xf')](_0xd9a5('0x10'),_0x3a4d98,_0xd9a5('0x15'));_0x9d365(_0x33c00e['result']['message']);}})[_0xd9a5('0x16')](function(_0x3ead53){logger[_0xd9a5('0x13')](_0xd9a5('0x10'),_0x3a4d98,_0x3ead53);_0x39a9ab(_0x3ead53);});});}exports[_0xd9a5('0x17')]=function(_0x5d099b){var _0x10d59b=this;return new Promise(function(_0x45df1d,_0x10bca5){return db[_0xd9a5('0x18')][_0xd9a5('0x19')]({'raw':_0x5d099b[_0xd9a5('0x1a')]?_0x5d099b[_0xd9a5('0x1a')][_0xd9a5('0x1b')]===undefined?!![]:![]:!![],'where':_0x5d099b[_0xd9a5('0x1a')]?_0x5d099b['options']['where']||null:null,'attributes':_0x5d099b[_0xd9a5('0x1a')]?_0x5d099b[_0xd9a5('0x1a')]['attributes']||null:null,'limit':_0x5d099b[_0xd9a5('0x1a')]?_0x5d099b[_0xd9a5('0x1a')][_0xd9a5('0x1c')]||null:null,'include':_0x5d099b[_0xd9a5('0x1a')]?_0x5d099b[_0xd9a5('0x1a')]['include']?_[_0xd9a5('0x1d')](_0x5d099b[_0xd9a5('0x1a')]['include'],function(_0x37c772){return{'model':db[_0x37c772[_0xd9a5('0x1e')]],'as':_0x37c772['as'],'attributes':_0x37c772[_0xd9a5('0x1f')],'include':_0x37c772[_0xd9a5('0x20')]?_[_0xd9a5('0x1d')](_0x37c772['include'],function(_0x3e483e){return{'model':db[_0x3e483e[_0xd9a5('0x1e')]],'as':_0x3e483e['as'],'attributes':_0x3e483e[_0xd9a5('0x1f')],'include':_0x3e483e[_0xd9a5('0x20')]?_['map'](_0x3e483e[_0xd9a5('0x20')],function(_0x1e9948){return{'model':db[_0x1e9948[_0xd9a5('0x1e')]],'as':_0x1e9948['as'],'attributes':_0x1e9948['attributes']};}):[]};}):[]};}):[]:[]})[_0xd9a5('0x21')](function(_0x33a6d2){logger[_0xd9a5('0xf')](_0xd9a5('0x17'),_0x5d099b);logger['debug'](_0xd9a5('0x17'),_0x5d099b,JSON[_0xd9a5('0x22')](_0x33a6d2));_0x45df1d(_0x33a6d2);})['catch'](function(_0x3e8b83){logger[_0xd9a5('0x13')](_0xd9a5('0x17'),_0x3e8b83['message'],_0x5d099b);_0x10bca5(_0x10d59b[_0xd9a5('0x13')](0x1f4,_0x3e8b83['message']));});});};exports[_0xd9a5('0x23')]=function(_0x2ccdba){var _0x1b5f3c=this;return new Promise(function(_0x1822db,_0xa702ee){return db[_0xd9a5('0x18')]['find']({'raw':_0x2ccdba['options']?_0x2ccdba[_0xd9a5('0x1a')][_0xd9a5('0x1b')]===undefined?!![]:![]:!![],'where':_0x2ccdba[_0xd9a5('0x1a')]?_0x2ccdba[_0xd9a5('0x1a')]['where']||null:null,'attributes':_0x2ccdba[_0xd9a5('0x1a')]?_0x2ccdba[_0xd9a5('0x1a')]['attributes']||null:null,'include':_0x2ccdba['options']?_0x2ccdba[_0xd9a5('0x1a')][_0xd9a5('0x20')]?_['map'](_0x2ccdba['options'][_0xd9a5('0x20')],function(_0x27108c){return{'model':db[_0x27108c['model']],'as':_0x27108c['as'],'attributes':_0x27108c[_0xd9a5('0x1f')],'include':_0x27108c['include']?_[_0xd9a5('0x1d')](_0x27108c[_0xd9a5('0x20')],function(_0x564b17){return{'model':db[_0x564b17[_0xd9a5('0x1e')]],'as':_0x564b17['as'],'attributes':_0x564b17['attributes'],'include':_0x564b17[_0xd9a5('0x20')]?_[_0xd9a5('0x1d')](_0x564b17[_0xd9a5('0x20')],function(_0x53301e){return{'model':db[_0x53301e[_0xd9a5('0x1e')]],'as':_0x53301e['as'],'attributes':_0x53301e[_0xd9a5('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x52374c){logger[_0xd9a5('0xf')](_0xd9a5('0x23'),_0x2ccdba);logger[_0xd9a5('0x11')](_0xd9a5('0x23'),_0x2ccdba,JSON[_0xd9a5('0x22')](_0x52374c));_0x1822db(_0x52374c);})[_0xd9a5('0x16')](function(_0x1053fb){logger[_0xd9a5('0x13')](_0xd9a5('0x23'),_0x1053fb[_0xd9a5('0x14')],_0x2ccdba);_0xa702ee(_0x1b5f3c[_0xd9a5('0x13')](0x1f4,_0x1053fb[_0xd9a5('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 9cdde31..eb9e9ed 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 _0x7217=['getDescriptions','/:id/tags','post','setTags','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x4c8ff4,_0x55b36b){var _0x381dd4=function(_0x4782d5){while(--_0x4782d5){_0x4c8ff4['push'](_0x4c8ff4['shift']());}};_0x381dd4(++_0x55b36b);}(_0x7217,0x19e));var _0x7721=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x7217[_0x9df060];return _0x338dfe;};'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('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getTags']);router[_0x7721('0x14')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x14')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x15')]);router['put'](_0x7721('0xb'),auth[_0x7721('0x9')](),controller['update']);router['delete']('/:id',auth[_0x7721('0x9')](),controller[_0x7721('0x16')]);module[_0x7721('0x17')]=router; \ No newline at end of file +var _0xedd9=['getTags','post','create','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','/:id/tags'];(function(_0x2d59a7,_0x264bb1){var _0x2a63e9=function(_0x1da851){while(--_0x1da851){_0x2d59a7['push'](_0x2d59a7['shift']());}};_0x2a63e9(++_0x264bb1);}(_0xedd9,0xfc));var _0x9edd=function(_0x4b064e,_0x129d1a){_0x4b064e=_0x4b064e-0x0;var _0x182dd0=_0xedd9[_0x4b064e];return _0x182dd0;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['getFields']);router[_0x9edd('0x9')]('/:id/subjects',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['get'](_0x9edd('0x10'),auth[_0x9edd('0xa')](),controller['getDescriptions']);router[_0x9edd('0x9')](_0x9edd('0x11'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')]('/:id/tags',auth[_0x9edd('0xa')](),controller[_0x9edd('0x15')]);router[_0x9edd('0x16')](_0x9edd('0xc'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x17')]);router[_0x9edd('0x18')](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x19')]);module[_0x9edd('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 4b8d51a..981778f 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 _0xd1a7=['sequelize','exports'];(function(_0x383241,_0x594d5f){var _0x5cc3ce=function(_0x1cf073){while(--_0x1cf073){_0x383241['push'](_0x383241['shift']());}};_0x5cc3ce(++_0x594d5f);}(_0xd1a7,0xce));var _0x7d1a=function(_0x4e6098,_0x249be6){_0x4e6098=_0x4e6098-0x0;var _0x38fe32=_0xd1a7[_0x4e6098];return _0x38fe32;};'use strict';var Sequelize=require(_0x7d1a('0x0'));module[_0x7d1a('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0fc6=['STRING','sequelize'];(function(_0x5c9916,_0x20cb76){var _0x3a45f8=function(_0x58fd1d){while(--_0x58fd1d){_0x5c9916['push'](_0x5c9916['shift']());}};_0x3a45f8(++_0x20cb76);}(_0x0fc6,0x167));var _0x60fc=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x0fc6[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require(_0x60fc('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x60fc('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 24074cf..74ad6aa 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 _0x5daf=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','undefined','limit','count','offset','set','Content-Range','json','update','then','destroy','sendStatus','error','stack','name','send','index','map','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','sort','where','filters','merge','type','includeAll','include','findAll','rows','catch','DeskConfiguration','rawAttributes','length','options','find','create','body','params','getFields','DeskField','order','filter','nolimit','findOne','getSubjects','pick','getDescriptions','Tag','getTags','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0x5daf,0x1e5));var _0xf5da=function(_0x4e068f,_0x3654ff){_0x4e068f=_0x4e068f-0x0;var _0x1ebdef=_0x5daf[_0x4e068f];return _0x1ebdef;};'use strict';var emlformat=require(_0xf5da('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf5da('0x1'));var jsonpatch=require(_0xf5da('0x2'));var rp=require(_0xf5da('0x3'));var moment=require(_0xf5da('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf5da('0x5'));var path=require(_0xf5da('0x6'));var sox=require(_0xf5da('0x7'));var csv=require(_0xf5da('0x8'));var ejs=require(_0xf5da('0x9'));var fs=require('fs');var fs_extra=require(_0xf5da('0xa'));var _=require(_0xf5da('0xb'));var squel=require('squel');var crypto=require(_0xf5da('0xc'));var jsforce=require(_0xf5da('0xd'));var deskjs=require(_0xf5da('0xe'));var toCsv=require(_0xf5da('0x8'));var querystring=require('querystring');var Papa=require(_0xf5da('0xf'));var Redis=require(_0xf5da('0x10'));var authService=require(_0xf5da('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf5da('0x12'));var hardwareService=require(_0xf5da('0x13'));var logger=require(_0xf5da('0x14'))(_0xf5da('0x15'));var utils=require(_0xf5da('0x16'));var config=require(_0xf5da('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf5da('0x18'))['db'];function respondWithStatusCode(_0x26d717,_0x3a6776){_0x3a6776=_0x3a6776||0xcc;return function(_0x2fa3d5){if(_0x2fa3d5){return _0x26d717['sendStatus'](_0x3a6776);}return _0x26d717['status'](_0x3a6776)[_0xf5da('0x19')]();};}function respondWithResult(_0x12539f,_0x454ae1){_0x454ae1=_0x454ae1||0xc8;return function(_0x2f6984){if(_0x2f6984){return _0x12539f[_0xf5da('0x1a')](_0x454ae1)['json'](_0x2f6984);}};}function respondWithFilteredResult(_0x208418,_0x4647e1){return function(_0x57af49){if(_0x57af49){var _0x48745d=typeof _0x4647e1['offset']===_0xf5da('0x1b')&&typeof _0x4647e1[_0xf5da('0x1c')]==='undefined';var _0x25e7a7=_0x57af49[_0xf5da('0x1d')];var _0x3dd8e8=_0x48745d?0x0:_0x4647e1[_0xf5da('0x1e')];var _0x73f276=_0x48745d?_0x57af49[_0xf5da('0x1d')]:_0x4647e1[_0xf5da('0x1e')]+_0x4647e1[_0xf5da('0x1c')];var _0x49212a;if(_0x73f276>=_0x25e7a7){_0x73f276=_0x25e7a7;_0x49212a=0xc8;}else{_0x49212a=0xce;}_0x208418[_0xf5da('0x1a')](_0x49212a);return _0x208418[_0xf5da('0x1f')](_0xf5da('0x20'),_0x3dd8e8+'-'+_0x73f276+'/'+_0x25e7a7)[_0xf5da('0x21')](_0x57af49);}return null;};}function patchUpdates(_0xba7287){return function(_0x8af129){try{jsonpatch['apply'](_0x8af129,_0xba7287,!![]);}catch(_0x3c981a){return BPromise['reject'](_0x3c981a);}return _0x8af129['save']();};}function saveUpdates(_0x2b7267,_0x4e4e79){return function(_0x15a186){if(_0x15a186){return _0x15a186[_0xf5da('0x22')](_0x2b7267)[_0xf5da('0x23')](function(_0x4b8337){return _0x4b8337;});}return null;};}function removeEntity(_0x32395d,_0x2d3274){return function(_0x1449e1){if(_0x1449e1){return _0x1449e1[_0xf5da('0x24')]()[_0xf5da('0x23')](function(){_0x32395d[_0xf5da('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x463a3c,_0x547364){return function(_0x26532e){if(!_0x26532e){_0x463a3c[_0xf5da('0x25')](0x194);}return _0x26532e;};}function handleError(_0x2be1fc,_0x779bba){_0x779bba=_0x779bba||0x1f4;return function(_0x3707c1){logger[_0xf5da('0x26')](_0x3707c1[_0xf5da('0x27')]);if(_0x3707c1[_0xf5da('0x28')]){delete _0x3707c1[_0xf5da('0x28')];}_0x2be1fc[_0xf5da('0x1a')](_0x779bba)[_0xf5da('0x29')](_0x3707c1);};}exports[_0xf5da('0x2a')]=function(_0x50b1a8,_0x80c3c2){var _0x26a81c={},_0x294306={},_0xdf23dc={'count':0x0,'rows':[]};var _0x436a81=_[_0xf5da('0x2b')](db['DeskConfiguration']['rawAttributes'],function(_0x47a0ef){return{'name':_0x47a0ef[_0xf5da('0x2c')],'type':_0x47a0ef['type'][_0xf5da('0x2d')]};});_0x294306[_0xf5da('0x2e')]=_[_0xf5da('0x2b')](_0x436a81,'name');_0x294306[_0xf5da('0x2f')]=_[_0xf5da('0x30')](_0x50b1a8[_0xf5da('0x2f')]);_0x294306['filters']=_[_0xf5da('0x31')](_0x294306[_0xf5da('0x2e')],_0x294306['query']);_0x26a81c[_0xf5da('0x32')]=_['intersection'](_0x294306[_0xf5da('0x2e')],qs[_0xf5da('0x33')](_0x50b1a8[_0xf5da('0x2f')][_0xf5da('0x33')]));_0x26a81c[_0xf5da('0x32')]=_0x26a81c[_0xf5da('0x32')]['length']?_0x26a81c['attributes']:_0x294306[_0xf5da('0x2e')];if(!_0x50b1a8[_0xf5da('0x2f')][_0xf5da('0x34')]('nolimit')){_0x26a81c[_0xf5da('0x1c')]=qs['limit'](_0x50b1a8[_0xf5da('0x2f')][_0xf5da('0x1c')]);_0x26a81c[_0xf5da('0x1e')]=qs[_0xf5da('0x1e')](_0x50b1a8[_0xf5da('0x2f')][_0xf5da('0x1e')]);}_0x26a81c['order']=qs[_0xf5da('0x35')](_0x50b1a8[_0xf5da('0x2f')][_0xf5da('0x35')]);_0x26a81c[_0xf5da('0x36')]=qs[_0xf5da('0x37')](_['pick'](_0x50b1a8[_0xf5da('0x2f')],_0x294306['filters']),_0x436a81);if(_0x50b1a8[_0xf5da('0x2f')]['filter']){_0x26a81c[_0xf5da('0x36')]=_[_0xf5da('0x38')](_0x26a81c[_0xf5da('0x36')],{'$or':_[_0xf5da('0x2b')](_0x436a81,function(_0x1ea16a){if(_0x1ea16a[_0xf5da('0x39')]!=='VIRTUAL'){var _0x413833={};_0x413833[_0x1ea16a[_0xf5da('0x28')]]={'$like':'%'+_0x50b1a8['query']['filter']+'%'};return _0x413833;}})});}_0x26a81c=_[_0xf5da('0x38')]({},_0x26a81c,_0x50b1a8['options']);var _0x15e84a={'where':_0x26a81c['where']};return db['DeskConfiguration'][_0xf5da('0x1d')](_0x15e84a)[_0xf5da('0x23')](function(_0x318ede){_0xdf23dc[_0xf5da('0x1d')]=_0x318ede;if(_0x50b1a8[_0xf5da('0x2f')][_0xf5da('0x3a')]){_0x26a81c[_0xf5da('0x3b')]=[{'all':!![]}];}return db['DeskConfiguration'][_0xf5da('0x3c')](_0x26a81c);})[_0xf5da('0x23')](function(_0x2c1f74){_0xdf23dc[_0xf5da('0x3d')]=_0x2c1f74;return _0xdf23dc;})[_0xf5da('0x23')](respondWithFilteredResult(_0x80c3c2,_0x26a81c))[_0xf5da('0x3e')](handleError(_0x80c3c2,null));};exports['show']=function(_0x2b56e2,_0x115bba){var _0x52dda2={'raw':![],'where':{'id':_0x2b56e2['params']['id']}},_0x45764c={};_0x45764c[_0xf5da('0x2e')]=_['keys'](db[_0xf5da('0x3f')][_0xf5da('0x40')]);_0x45764c[_0xf5da('0x2f')]=_[_0xf5da('0x30')](_0x2b56e2[_0xf5da('0x2f')]);_0x45764c[_0xf5da('0x37')]=_['intersection'](_0x45764c[_0xf5da('0x2e')],_0x45764c['query']);_0x52dda2[_0xf5da('0x32')]=_[_0xf5da('0x31')](_0x45764c[_0xf5da('0x2e')],qs[_0xf5da('0x33')](_0x2b56e2[_0xf5da('0x2f')][_0xf5da('0x33')]));_0x52dda2['attributes']=_0x52dda2['attributes'][_0xf5da('0x41')]?_0x52dda2['attributes']:_0x45764c[_0xf5da('0x2e')];if(_0x2b56e2[_0xf5da('0x2f')]['includeAll']){_0x52dda2[_0xf5da('0x3b')]=[{'all':!![]}];}_0x52dda2=_[_0xf5da('0x38')]({},_0x52dda2,_0x2b56e2[_0xf5da('0x42')]);return db[_0xf5da('0x3f')][_0xf5da('0x43')](_0x52dda2)[_0xf5da('0x23')](handleEntityNotFound(_0x115bba,null))['then'](respondWithResult(_0x115bba,null))[_0xf5da('0x3e')](handleError(_0x115bba,null));};exports[_0xf5da('0x44')]=function(_0x13b9e2,_0xa6104a){return db[_0xf5da('0x3f')]['create'](_0x13b9e2[_0xf5da('0x45')],{})['then'](respondWithResult(_0xa6104a,0xc9))['catch'](handleError(_0xa6104a,null));};exports['update']=function(_0x17a5aa,_0x94620f){if(_0x17a5aa[_0xf5da('0x45')]['id']){delete _0x17a5aa[_0xf5da('0x45')]['id'];}return db[_0xf5da('0x3f')][_0xf5da('0x43')]({'where':{'id':_0x17a5aa[_0xf5da('0x46')]['id']}})['then'](handleEntityNotFound(_0x94620f,null))[_0xf5da('0x23')](saveUpdates(_0x17a5aa[_0xf5da('0x45')],null))[_0xf5da('0x23')](respondWithResult(_0x94620f,null))[_0xf5da('0x3e')](handleError(_0x94620f,null));};exports[_0xf5da('0x24')]=function(_0x2ffa79,_0xfbbe3f){return db['DeskConfiguration']['find']({'where':{'id':_0x2ffa79[_0xf5da('0x46')]['id']}})[_0xf5da('0x23')](handleEntityNotFound(_0xfbbe3f,null))['then'](removeEntity(_0xfbbe3f,null))[_0xf5da('0x3e')](handleError(_0xfbbe3f,null));};exports[_0xf5da('0x47')]=function(_0x499996,_0x13815c,_0x46eb36){var _0x48d3a7={};var _0x5ed549={};var _0x21be4e;var _0x142550;return db[_0xf5da('0x3f')]['findOne']({'where':{'id':_0x499996[_0xf5da('0x46')]['id']}})[_0xf5da('0x23')](handleEntityNotFound(_0x13815c,null))[_0xf5da('0x23')](function(_0x5ce53f){if(_0x5ce53f){_0x21be4e=_0x5ce53f;_0x5ed549[_0xf5da('0x2e')]=_[_0xf5da('0x30')](db[_0xf5da('0x48')][_0xf5da('0x40')]);_0x5ed549['query']=_[_0xf5da('0x30')](_0x499996['query']);_0x5ed549[_0xf5da('0x37')]=_['intersection'](_0x5ed549['model'],_0x5ed549[_0xf5da('0x2f')]);_0x48d3a7[_0xf5da('0x32')]=_[_0xf5da('0x31')](_0x5ed549['model'],qs[_0xf5da('0x33')](_0x499996['query'][_0xf5da('0x33')]));_0x48d3a7[_0xf5da('0x32')]=_0x48d3a7['attributes'][_0xf5da('0x41')]?_0x48d3a7[_0xf5da('0x32')]:_0x5ed549[_0xf5da('0x2e')];_0x48d3a7[_0xf5da('0x49')]=qs[_0xf5da('0x35')](_0x499996[_0xf5da('0x2f')][_0xf5da('0x35')]);_0x48d3a7[_0xf5da('0x36')]=qs[_0xf5da('0x37')](_['pick'](_0x499996[_0xf5da('0x2f')],_0x5ed549['filters']));if(_0x499996[_0xf5da('0x2f')][_0xf5da('0x4a')]){_0x48d3a7[_0xf5da('0x36')]=_['merge'](_0x48d3a7[_0xf5da('0x36')],{'$or':_['map'](_0x48d3a7[_0xf5da('0x32')],function(_0x5efb2e){var _0x29cb4f={};_0x29cb4f[_0x5efb2e]={'$like':'%'+_0x499996[_0xf5da('0x2f')][_0xf5da('0x4a')]+'%'};return _0x29cb4f;})});}_0x48d3a7=_[_0xf5da('0x38')]({},_0x48d3a7,_0x499996['options']);return _0x21be4e[_0xf5da('0x47')](_0x48d3a7);}})[_0xf5da('0x23')](function(_0x89be21){if(_0x89be21){_0x142550=_0x89be21[_0xf5da('0x41')];if(!_0x499996['query'][_0xf5da('0x34')](_0xf5da('0x4b'))){_0x48d3a7[_0xf5da('0x1c')]=qs[_0xf5da('0x1c')](_0x499996[_0xf5da('0x2f')][_0xf5da('0x1c')]);_0x48d3a7[_0xf5da('0x1e')]=qs[_0xf5da('0x1e')](_0x499996[_0xf5da('0x2f')][_0xf5da('0x1e')]);}return _0x21be4e[_0xf5da('0x47')](_0x48d3a7);}})[_0xf5da('0x23')](function(_0x7707b9){if(_0x7707b9){return _0x7707b9?{'count':_0x142550,'rows':_0x7707b9}:null;}})[_0xf5da('0x23')](respondWithResult(_0x13815c,null))['catch'](handleError(_0x13815c,null));};exports['getSubjects']=function(_0x945629,_0x4fc19e,_0x465d3d){var _0x1f13e9={};var _0x5373aa={};var _0x4880b8;var _0x3a6f88;return db[_0xf5da('0x3f')][_0xf5da('0x4c')]({'where':{'id':_0x945629[_0xf5da('0x46')]['id']}})['then'](handleEntityNotFound(_0x4fc19e,null))[_0xf5da('0x23')](function(_0x4a7a4c){if(_0x4a7a4c){_0x4880b8=_0x4a7a4c;_0x5373aa[_0xf5da('0x2e')]=_[_0xf5da('0x30')](db[_0xf5da('0x48')]['rawAttributes']);_0x5373aa[_0xf5da('0x2f')]=_[_0xf5da('0x30')](_0x945629['query']);_0x5373aa[_0xf5da('0x37')]=_['intersection'](_0x5373aa[_0xf5da('0x2e')],_0x5373aa[_0xf5da('0x2f')]);_0x1f13e9[_0xf5da('0x32')]=_[_0xf5da('0x31')](_0x5373aa[_0xf5da('0x2e')],qs['fields'](_0x945629['query'][_0xf5da('0x33')]));_0x1f13e9[_0xf5da('0x32')]=_0x1f13e9[_0xf5da('0x32')]['length']?_0x1f13e9['attributes']:_0x5373aa['model'];_0x1f13e9[_0xf5da('0x49')]=qs[_0xf5da('0x35')](_0x945629[_0xf5da('0x2f')]['sort']);_0x1f13e9[_0xf5da('0x36')]=qs['filters'](_['pick'](_0x945629['query'],_0x5373aa['filters']));if(_0x945629[_0xf5da('0x2f')][_0xf5da('0x4a')]){_0x1f13e9[_0xf5da('0x36')]=_['merge'](_0x1f13e9[_0xf5da('0x36')],{'$or':_[_0xf5da('0x2b')](_0x1f13e9[_0xf5da('0x32')],function(_0x1ec82c){var _0x51dd48={};_0x51dd48[_0x1ec82c]={'$like':'%'+_0x945629[_0xf5da('0x2f')][_0xf5da('0x4a')]+'%'};return _0x51dd48;})});}_0x1f13e9=_[_0xf5da('0x38')]({},_0x1f13e9,_0x945629['options']);return _0x4880b8[_0xf5da('0x4d')](_0x1f13e9);}})[_0xf5da('0x23')](function(_0x2eaf31){if(_0x2eaf31){_0x3a6f88=_0x2eaf31[_0xf5da('0x41')];if(!_0x945629[_0xf5da('0x2f')][_0xf5da('0x34')]('nolimit')){_0x1f13e9['limit']=qs[_0xf5da('0x1c')](_0x945629[_0xf5da('0x2f')][_0xf5da('0x1c')]);_0x1f13e9[_0xf5da('0x1e')]=qs[_0xf5da('0x1e')](_0x945629[_0xf5da('0x2f')][_0xf5da('0x1e')]);}return _0x4880b8[_0xf5da('0x4d')](_0x1f13e9);}})[_0xf5da('0x23')](function(_0xf41bd5){if(_0xf41bd5){return _0xf41bd5?{'count':_0x3a6f88,'rows':_0xf41bd5}:null;}})['then'](respondWithResult(_0x4fc19e,null))[_0xf5da('0x3e')](handleError(_0x4fc19e,null));};exports['getDescriptions']=function(_0x4d040d,_0x30ab55,_0x3e5a61){var _0x4aeea2={};var _0x2dd140={};var _0x80f910;var _0x2623ab;return db[_0xf5da('0x3f')][_0xf5da('0x4c')]({'where':{'id':_0x4d040d[_0xf5da('0x46')]['id']}})[_0xf5da('0x23')](handleEntityNotFound(_0x30ab55,null))[_0xf5da('0x23')](function(_0x20ea4d){if(_0x20ea4d){_0x80f910=_0x20ea4d;_0x2dd140[_0xf5da('0x2e')]=_[_0xf5da('0x30')](db[_0xf5da('0x48')][_0xf5da('0x40')]);_0x2dd140[_0xf5da('0x2f')]=_[_0xf5da('0x30')](_0x4d040d[_0xf5da('0x2f')]);_0x2dd140['filters']=_[_0xf5da('0x31')](_0x2dd140[_0xf5da('0x2e')],_0x2dd140[_0xf5da('0x2f')]);_0x4aeea2[_0xf5da('0x32')]=_[_0xf5da('0x31')](_0x2dd140[_0xf5da('0x2e')],qs[_0xf5da('0x33')](_0x4d040d[_0xf5da('0x2f')][_0xf5da('0x33')]));_0x4aeea2['attributes']=_0x4aeea2[_0xf5da('0x32')][_0xf5da('0x41')]?_0x4aeea2[_0xf5da('0x32')]:_0x2dd140['model'];_0x4aeea2[_0xf5da('0x49')]=qs[_0xf5da('0x35')](_0x4d040d['query']['sort']);_0x4aeea2[_0xf5da('0x36')]=qs[_0xf5da('0x37')](_[_0xf5da('0x4e')](_0x4d040d[_0xf5da('0x2f')],_0x2dd140['filters']));if(_0x4d040d[_0xf5da('0x2f')][_0xf5da('0x4a')]){_0x4aeea2['where']=_[_0xf5da('0x38')](_0x4aeea2['where'],{'$or':_[_0xf5da('0x2b')](_0x4aeea2[_0xf5da('0x32')],function(_0x4faa04){var _0x1a088e={};_0x1a088e[_0x4faa04]={'$like':'%'+_0x4d040d[_0xf5da('0x2f')][_0xf5da('0x4a')]+'%'};return _0x1a088e;})});}_0x4aeea2=_[_0xf5da('0x38')]({},_0x4aeea2,_0x4d040d[_0xf5da('0x42')]);return _0x80f910[_0xf5da('0x4f')](_0x4aeea2);}})[_0xf5da('0x23')](function(_0x330d4a){if(_0x330d4a){_0x2623ab=_0x330d4a['length'];if(!_0x4d040d[_0xf5da('0x2f')][_0xf5da('0x34')]('nolimit')){_0x4aeea2[_0xf5da('0x1c')]=qs[_0xf5da('0x1c')](_0x4d040d[_0xf5da('0x2f')][_0xf5da('0x1c')]);_0x4aeea2['offset']=qs[_0xf5da('0x1e')](_0x4d040d['query'][_0xf5da('0x1e')]);}return _0x80f910[_0xf5da('0x4f')](_0x4aeea2);}})[_0xf5da('0x23')](function(_0x2ff849){if(_0x2ff849){return _0x2ff849?{'count':_0x2623ab,'rows':_0x2ff849}:null;}})[_0xf5da('0x23')](respondWithResult(_0x30ab55,null))[_0xf5da('0x3e')](handleError(_0x30ab55,null));};exports['getTags']=function(_0x3c35a1,_0x5de49c,_0x23790e){var _0x156851={};var _0x4034c6={};var _0x2f1699;var _0x18a0ee;return db[_0xf5da('0x3f')][_0xf5da('0x4c')]({'where':{'id':_0x3c35a1[_0xf5da('0x46')]['id']}})[_0xf5da('0x23')](handleEntityNotFound(_0x5de49c,null))[_0xf5da('0x23')](function(_0x37eb59){if(_0x37eb59){_0x2f1699=_0x37eb59;_0x4034c6[_0xf5da('0x2e')]=_[_0xf5da('0x30')](db[_0xf5da('0x50')][_0xf5da('0x40')]);_0x4034c6[_0xf5da('0x2f')]=_[_0xf5da('0x30')](_0x3c35a1[_0xf5da('0x2f')]);_0x4034c6[_0xf5da('0x37')]=_['intersection'](_0x4034c6[_0xf5da('0x2e')],_0x4034c6[_0xf5da('0x2f')]);_0x156851[_0xf5da('0x32')]=_[_0xf5da('0x31')](_0x4034c6[_0xf5da('0x2e')],qs[_0xf5da('0x33')](_0x3c35a1[_0xf5da('0x2f')][_0xf5da('0x33')]));_0x156851[_0xf5da('0x32')]=_0x156851[_0xf5da('0x32')][_0xf5da('0x41')]?_0x156851[_0xf5da('0x32')]:_0x4034c6['model'];_0x156851[_0xf5da('0x49')]=qs[_0xf5da('0x35')](_0x3c35a1[_0xf5da('0x2f')]['sort']);_0x156851[_0xf5da('0x36')]=qs[_0xf5da('0x37')](_[_0xf5da('0x4e')](_0x3c35a1['query'],_0x4034c6[_0xf5da('0x37')]));if(_0x3c35a1[_0xf5da('0x2f')][_0xf5da('0x4a')]){_0x156851[_0xf5da('0x36')]=_[_0xf5da('0x38')](_0x156851['where'],{'$or':_[_0xf5da('0x2b')](_0x156851['attributes'],function(_0x2da10b){var _0x5b6e25={};_0x5b6e25[_0x2da10b]={'$like':'%'+_0x3c35a1['query']['filter']+'%'};return _0x5b6e25;})});}_0x156851=_[_0xf5da('0x38')]({},_0x156851,_0x3c35a1[_0xf5da('0x42')]);return _0x2f1699[_0xf5da('0x51')](_0x156851);}})['then'](function(_0x4fb8b3){if(_0x4fb8b3){_0x18a0ee=_0x4fb8b3['length'];if(!_0x3c35a1['query'][_0xf5da('0x34')](_0xf5da('0x4b'))){_0x156851[_0xf5da('0x1c')]=qs['limit'](_0x3c35a1['query'][_0xf5da('0x1c')]);_0x156851[_0xf5da('0x1e')]=qs[_0xf5da('0x1e')](_0x3c35a1['query'][_0xf5da('0x1e')]);}return _0x2f1699['getTags'](_0x156851);}})[_0xf5da('0x23')](function(_0x2874ed){if(_0x2874ed){return _0x2874ed?{'count':_0x18a0ee,'rows':_0x2874ed}:null;}})[_0xf5da('0x23')](respondWithResult(_0x5de49c,null))[_0xf5da('0x3e')](handleError(_0x5de49c,null));};exports[_0xf5da('0x52')]=function(_0x541ea7,_0x1b711e,_0xc9d8bf){if(_0x541ea7[_0xf5da('0x45')]['id']){delete _0x541ea7[_0xf5da('0x45')]['id'];}return db[_0xf5da('0x3f')][_0xf5da('0x4c')]({'where':{'id':_0x541ea7[_0xf5da('0x46')]['id']}})[_0xf5da('0x23')](handleEntityNotFound(_0x1b711e,null))['then'](function(_0x3bd6bd){if(_0x3bd6bd){return _0x3bd6bd['setTags'](_0x541ea7[_0xf5da('0x45')][_0xf5da('0x53')]||[]);}return null;})['then'](respondWithResult(_0x1b711e,null))[_0xf5da('0x3e')](handleError(_0x1b711e,null));}; \ No newline at end of file +var _0x8f15=['limit','count','set','apply','reject','update','then','error','stack','name','map','DeskConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','intersection','create','body','params','destroy','find','getFields','findOne','DeskField','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x2243f7,_0x4402c7){var _0x3c0b01=function(_0x357db5){while(--_0x357db5){_0x2243f7['push'](_0x2243f7['shift']());}};_0x3c0b01(++_0x4402c7);}(_0x8f15,0xde));var _0x58f1=function(_0x56330a,_0xa51f9f){_0x56330a=_0x56330a-0x0;var _0x3b1d74=_0x8f15[_0x56330a];return _0x3b1d74;};'use strict';var emlformat=require(_0x58f1('0x0'));var rimraf=require(_0x58f1('0x1'));var zipdir=require(_0x58f1('0x2'));var jsonpatch=require(_0x58f1('0x3'));var rp=require(_0x58f1('0x4'));var moment=require(_0x58f1('0x5'));var BPromise=require(_0x58f1('0x6'));var Mustache=require(_0x58f1('0x7'));var util=require('util');var path=require('path');var sox=require(_0x58f1('0x8'));var csv=require(_0x58f1('0x9'));var ejs=require(_0x58f1('0xa'));var fs=require('fs');var fs_extra=require(_0x58f1('0xb'));var _=require(_0x58f1('0xc'));var squel=require(_0x58f1('0xd'));var crypto=require(_0x58f1('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x58f1('0xf'));var toCsv=require(_0x58f1('0x9'));var querystring=require(_0x58f1('0x10'));var Papa=require(_0x58f1('0x11'));var Redis=require('ioredis');var authService=require(_0x58f1('0x12'));var qs=require(_0x58f1('0x13'));var as=require(_0x58f1('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x58f1('0x15'))(_0x58f1('0x16'));var utils=require(_0x58f1('0x17'));var config=require(_0x58f1('0x18'));var licenseUtil=require(_0x58f1('0x19'));var db=require(_0x58f1('0x1a'))['db'];function respondWithStatusCode(_0x217f30,_0x1e85dc){_0x1e85dc=_0x1e85dc||0xcc;return function(_0x1c9450){if(_0x1c9450){return _0x217f30[_0x58f1('0x1b')](_0x1e85dc);}return _0x217f30[_0x58f1('0x1c')](_0x1e85dc)[_0x58f1('0x1d')]();};}function respondWithResult(_0x36b4ea,_0x483849){_0x483849=_0x483849||0xc8;return function(_0x4b0de9){if(_0x4b0de9){return _0x36b4ea[_0x58f1('0x1c')](_0x483849)[_0x58f1('0x1e')](_0x4b0de9);}};}function respondWithFilteredResult(_0x2a8b9e,_0x1ff2cc){return function(_0x2836c7){if(_0x2836c7){var _0x20323b=typeof _0x1ff2cc[_0x58f1('0x1f')]===_0x58f1('0x20')&&typeof _0x1ff2cc[_0x58f1('0x21')]===_0x58f1('0x20');var _0x33cdf9=_0x2836c7[_0x58f1('0x22')];var _0x91bae7=_0x20323b?0x0:_0x1ff2cc[_0x58f1('0x1f')];var _0xff5918=_0x20323b?_0x2836c7['count']:_0x1ff2cc[_0x58f1('0x1f')]+_0x1ff2cc[_0x58f1('0x21')];var _0x660803;if(_0xff5918>=_0x33cdf9){_0xff5918=_0x33cdf9;_0x660803=0xc8;}else{_0x660803=0xce;}_0x2a8b9e['status'](_0x660803);return _0x2a8b9e[_0x58f1('0x23')]('Content-Range',_0x91bae7+'-'+_0xff5918+'/'+_0x33cdf9)['json'](_0x2836c7);}return null;};}function patchUpdates(_0x182579){return function(_0x1f17d2){try{jsonpatch[_0x58f1('0x24')](_0x1f17d2,_0x182579,!![]);}catch(_0x18714c){return BPromise[_0x58f1('0x25')](_0x18714c);}return _0x1f17d2['save']();};}function saveUpdates(_0x9d582a,_0x58d961){return function(_0x5e5309){if(_0x5e5309){return _0x5e5309[_0x58f1('0x26')](_0x9d582a)[_0x58f1('0x27')](function(_0x1a44a5){return _0x1a44a5;});}return null;};}function removeEntity(_0x431fe8,_0x3e1ebc){return function(_0x3b95cd){if(_0x3b95cd){return _0x3b95cd['destroy']()['then'](function(){_0x431fe8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x55be38,_0x484e59){return function(_0x2b0200){if(!_0x2b0200){_0x55be38[_0x58f1('0x1b')](0x194);}return _0x2b0200;};}function handleError(_0x3b6003,_0x306932){_0x306932=_0x306932||0x1f4;return function(_0x3b3b20){logger[_0x58f1('0x28')](_0x3b3b20[_0x58f1('0x29')]);if(_0x3b3b20[_0x58f1('0x2a')]){delete _0x3b3b20[_0x58f1('0x2a')];}_0x3b6003['status'](_0x306932)['send'](_0x3b3b20);};}exports['index']=function(_0x26b8e0,_0x45a7b9){var _0x491fb6={},_0x2570e6={},_0x1f7342={'count':0x0,'rows':[]};var _0x31acd9=_[_0x58f1('0x2b')](db[_0x58f1('0x2c')][_0x58f1('0x2d')],function(_0xb414bf){return{'name':_0xb414bf[_0x58f1('0x2e')],'type':_0xb414bf['type'][_0x58f1('0x2f')]};});_0x2570e6[_0x58f1('0x30')]=_['map'](_0x31acd9,_0x58f1('0x2a'));_0x2570e6[_0x58f1('0x31')]=_[_0x58f1('0x32')](_0x26b8e0[_0x58f1('0x31')]);_0x2570e6[_0x58f1('0x33')]=_['intersection'](_0x2570e6[_0x58f1('0x30')],_0x2570e6[_0x58f1('0x31')]);_0x491fb6[_0x58f1('0x34')]=_['intersection'](_0x2570e6[_0x58f1('0x30')],qs[_0x58f1('0x35')](_0x26b8e0[_0x58f1('0x31')]['fields']));_0x491fb6[_0x58f1('0x34')]=_0x491fb6[_0x58f1('0x34')][_0x58f1('0x36')]?_0x491fb6['attributes']:_0x2570e6[_0x58f1('0x30')];if(!_0x26b8e0[_0x58f1('0x31')][_0x58f1('0x37')]('nolimit')){_0x491fb6[_0x58f1('0x21')]=qs[_0x58f1('0x21')](_0x26b8e0['query'][_0x58f1('0x21')]);_0x491fb6[_0x58f1('0x1f')]=qs[_0x58f1('0x1f')](_0x26b8e0[_0x58f1('0x31')][_0x58f1('0x1f')]);}_0x491fb6[_0x58f1('0x38')]=qs[_0x58f1('0x39')](_0x26b8e0[_0x58f1('0x31')][_0x58f1('0x39')]);_0x491fb6[_0x58f1('0x3a')]=qs[_0x58f1('0x33')](_[_0x58f1('0x3b')](_0x26b8e0['query'],_0x2570e6['filters']),_0x31acd9);if(_0x26b8e0[_0x58f1('0x31')][_0x58f1('0x3c')]){_0x491fb6['where']=_['merge'](_0x491fb6['where'],{'$or':_[_0x58f1('0x2b')](_0x31acd9,function(_0x1c4c54){if(_0x1c4c54['type']!==_0x58f1('0x3d')){var _0x5de1d5={};_0x5de1d5[_0x1c4c54['name']]={'$like':'%'+_0x26b8e0['query'][_0x58f1('0x3c')]+'%'};return _0x5de1d5;}})});}_0x491fb6=_[_0x58f1('0x3e')]({},_0x491fb6,_0x26b8e0[_0x58f1('0x3f')]);var _0x395281={'where':_0x491fb6['where']};return db[_0x58f1('0x2c')]['count'](_0x395281)['then'](function(_0x482bc0){_0x1f7342[_0x58f1('0x22')]=_0x482bc0;if(_0x26b8e0[_0x58f1('0x31')][_0x58f1('0x40')]){_0x491fb6[_0x58f1('0x41')]=[{'all':!![]}];}return db[_0x58f1('0x2c')][_0x58f1('0x42')](_0x491fb6);})['then'](function(_0x13651b){_0x1f7342['rows']=_0x13651b;return _0x1f7342;})['then'](respondWithFilteredResult(_0x45a7b9,_0x491fb6))[_0x58f1('0x43')](handleError(_0x45a7b9,null));};exports[_0x58f1('0x44')]=function(_0x1db307,_0x5c5bf0){var _0x29d65f={'raw':![],'where':{'id':_0x1db307['params']['id']}},_0x356f23={};_0x356f23['model']=_[_0x58f1('0x32')](db[_0x58f1('0x2c')][_0x58f1('0x2d')]);_0x356f23[_0x58f1('0x31')]=_['keys'](_0x1db307[_0x58f1('0x31')]);_0x356f23[_0x58f1('0x33')]=_['intersection'](_0x356f23['model'],_0x356f23[_0x58f1('0x31')]);_0x29d65f[_0x58f1('0x34')]=_[_0x58f1('0x45')](_0x356f23[_0x58f1('0x30')],qs[_0x58f1('0x35')](_0x1db307[_0x58f1('0x31')][_0x58f1('0x35')]));_0x29d65f[_0x58f1('0x34')]=_0x29d65f[_0x58f1('0x34')][_0x58f1('0x36')]?_0x29d65f[_0x58f1('0x34')]:_0x356f23[_0x58f1('0x30')];if(_0x1db307[_0x58f1('0x31')][_0x58f1('0x40')]){_0x29d65f[_0x58f1('0x41')]=[{'all':!![]}];}_0x29d65f=_[_0x58f1('0x3e')]({},_0x29d65f,_0x1db307[_0x58f1('0x3f')]);return db[_0x58f1('0x2c')]['find'](_0x29d65f)[_0x58f1('0x27')](handleEntityNotFound(_0x5c5bf0,null))[_0x58f1('0x27')](respondWithResult(_0x5c5bf0,null))[_0x58f1('0x43')](handleError(_0x5c5bf0,null));};exports[_0x58f1('0x46')]=function(_0x390cb3,_0x1724be){return db[_0x58f1('0x2c')][_0x58f1('0x46')](_0x390cb3[_0x58f1('0x47')],{})[_0x58f1('0x27')](respondWithResult(_0x1724be,0xc9))['catch'](handleError(_0x1724be,null));};exports[_0x58f1('0x26')]=function(_0x4b7a27,_0x2b6fe0){if(_0x4b7a27[_0x58f1('0x47')]['id']){delete _0x4b7a27[_0x58f1('0x47')]['id'];}return db[_0x58f1('0x2c')]['find']({'where':{'id':_0x4b7a27[_0x58f1('0x48')]['id']}})[_0x58f1('0x27')](handleEntityNotFound(_0x2b6fe0,null))[_0x58f1('0x27')](saveUpdates(_0x4b7a27[_0x58f1('0x47')],null))[_0x58f1('0x27')](respondWithResult(_0x2b6fe0,null))[_0x58f1('0x43')](handleError(_0x2b6fe0,null));};exports[_0x58f1('0x49')]=function(_0x513484,_0x5a20eb){return db[_0x58f1('0x2c')][_0x58f1('0x4a')]({'where':{'id':_0x513484[_0x58f1('0x48')]['id']}})[_0x58f1('0x27')](handleEntityNotFound(_0x5a20eb,null))[_0x58f1('0x27')](removeEntity(_0x5a20eb,null))[_0x58f1('0x43')](handleError(_0x5a20eb,null));};exports[_0x58f1('0x4b')]=function(_0x2d2c66,_0x44ca1a,_0x26754c){var _0x11e25c={};var _0x13cc69={};var _0x23ae39;var _0x1a7e58;return db[_0x58f1('0x2c')][_0x58f1('0x4c')]({'where':{'id':_0x2d2c66[_0x58f1('0x48')]['id']}})['then'](handleEntityNotFound(_0x44ca1a,null))[_0x58f1('0x27')](function(_0x52ea94){if(_0x52ea94){_0x23ae39=_0x52ea94;_0x13cc69[_0x58f1('0x30')]=_[_0x58f1('0x32')](db[_0x58f1('0x4d')][_0x58f1('0x2d')]);_0x13cc69[_0x58f1('0x31')]=_[_0x58f1('0x32')](_0x2d2c66[_0x58f1('0x31')]);_0x13cc69['filters']=_[_0x58f1('0x45')](_0x13cc69[_0x58f1('0x30')],_0x13cc69['query']);_0x11e25c[_0x58f1('0x34')]=_[_0x58f1('0x45')](_0x13cc69[_0x58f1('0x30')],qs[_0x58f1('0x35')](_0x2d2c66[_0x58f1('0x31')][_0x58f1('0x35')]));_0x11e25c[_0x58f1('0x34')]=_0x11e25c['attributes']['length']?_0x11e25c[_0x58f1('0x34')]:_0x13cc69[_0x58f1('0x30')];_0x11e25c[_0x58f1('0x38')]=qs[_0x58f1('0x39')](_0x2d2c66[_0x58f1('0x31')][_0x58f1('0x39')]);_0x11e25c[_0x58f1('0x3a')]=qs[_0x58f1('0x33')](_[_0x58f1('0x3b')](_0x2d2c66['query'],_0x13cc69[_0x58f1('0x33')]));if(_0x2d2c66[_0x58f1('0x31')][_0x58f1('0x3c')]){_0x11e25c[_0x58f1('0x3a')]=_[_0x58f1('0x3e')](_0x11e25c['where'],{'$or':_['map'](_0x11e25c[_0x58f1('0x34')],function(_0x5633d4){var _0x180e4a={};_0x180e4a[_0x5633d4]={'$like':'%'+_0x2d2c66['query'][_0x58f1('0x3c')]+'%'};return _0x180e4a;})});}_0x11e25c=_['merge']({},_0x11e25c,_0x2d2c66['options']);return _0x23ae39[_0x58f1('0x4b')](_0x11e25c);}})[_0x58f1('0x27')](function(_0x897ab9){if(_0x897ab9){_0x1a7e58=_0x897ab9['length'];if(!_0x2d2c66[_0x58f1('0x31')][_0x58f1('0x37')](_0x58f1('0x4e'))){_0x11e25c['limit']=qs[_0x58f1('0x21')](_0x2d2c66[_0x58f1('0x31')][_0x58f1('0x21')]);_0x11e25c['offset']=qs[_0x58f1('0x1f')](_0x2d2c66['query']['offset']);}return _0x23ae39[_0x58f1('0x4b')](_0x11e25c);}})[_0x58f1('0x27')](function(_0x712e3c){if(_0x712e3c){return _0x712e3c?{'count':_0x1a7e58,'rows':_0x712e3c}:null;}})[_0x58f1('0x27')](respondWithResult(_0x44ca1a,null))[_0x58f1('0x43')](handleError(_0x44ca1a,null));};exports[_0x58f1('0x4f')]=function(_0xc2b9b7,_0x159b31,_0x2ccdcb){var _0x17feea={};var _0x5f5977={};var _0x4f3d58;var _0x370daa;return db[_0x58f1('0x2c')]['findOne']({'where':{'id':_0xc2b9b7[_0x58f1('0x48')]['id']}})['then'](handleEntityNotFound(_0x159b31,null))[_0x58f1('0x27')](function(_0x34ff97){if(_0x34ff97){_0x4f3d58=_0x34ff97;_0x5f5977[_0x58f1('0x30')]=_[_0x58f1('0x32')](db[_0x58f1('0x4d')][_0x58f1('0x2d')]);_0x5f5977[_0x58f1('0x31')]=_[_0x58f1('0x32')](_0xc2b9b7['query']);_0x5f5977['filters']=_['intersection'](_0x5f5977[_0x58f1('0x30')],_0x5f5977[_0x58f1('0x31')]);_0x17feea[_0x58f1('0x34')]=_['intersection'](_0x5f5977[_0x58f1('0x30')],qs[_0x58f1('0x35')](_0xc2b9b7[_0x58f1('0x31')][_0x58f1('0x35')]));_0x17feea[_0x58f1('0x34')]=_0x17feea[_0x58f1('0x34')][_0x58f1('0x36')]?_0x17feea['attributes']:_0x5f5977[_0x58f1('0x30')];_0x17feea['order']=qs[_0x58f1('0x39')](_0xc2b9b7[_0x58f1('0x31')][_0x58f1('0x39')]);_0x17feea[_0x58f1('0x3a')]=qs[_0x58f1('0x33')](_[_0x58f1('0x3b')](_0xc2b9b7['query'],_0x5f5977[_0x58f1('0x33')]));if(_0xc2b9b7[_0x58f1('0x31')][_0x58f1('0x3c')]){_0x17feea[_0x58f1('0x3a')]=_[_0x58f1('0x3e')](_0x17feea[_0x58f1('0x3a')],{'$or':_[_0x58f1('0x2b')](_0x17feea['attributes'],function(_0x2b4ec7){var _0xd857fa={};_0xd857fa[_0x2b4ec7]={'$like':'%'+_0xc2b9b7[_0x58f1('0x31')][_0x58f1('0x3c')]+'%'};return _0xd857fa;})});}_0x17feea=_[_0x58f1('0x3e')]({},_0x17feea,_0xc2b9b7[_0x58f1('0x3f')]);return _0x4f3d58['getSubjects'](_0x17feea);}})[_0x58f1('0x27')](function(_0x4bc54c){if(_0x4bc54c){_0x370daa=_0x4bc54c[_0x58f1('0x36')];if(!_0xc2b9b7[_0x58f1('0x31')][_0x58f1('0x37')](_0x58f1('0x4e'))){_0x17feea['limit']=qs[_0x58f1('0x21')](_0xc2b9b7[_0x58f1('0x31')]['limit']);_0x17feea[_0x58f1('0x1f')]=qs['offset'](_0xc2b9b7[_0x58f1('0x31')]['offset']);}return _0x4f3d58['getSubjects'](_0x17feea);}})[_0x58f1('0x27')](function(_0x4f385e){if(_0x4f385e){return _0x4f385e?{'count':_0x370daa,'rows':_0x4f385e}:null;}})[_0x58f1('0x27')](respondWithResult(_0x159b31,null))[_0x58f1('0x43')](handleError(_0x159b31,null));};exports[_0x58f1('0x50')]=function(_0x1535d6,_0x435e3a,_0xd58ad1){var _0x44681c={};var _0xe5c5f6={};var _0x1ce052;var _0x18296d;return db[_0x58f1('0x2c')][_0x58f1('0x4c')]({'where':{'id':_0x1535d6['params']['id']}})[_0x58f1('0x27')](handleEntityNotFound(_0x435e3a,null))[_0x58f1('0x27')](function(_0x531349){if(_0x531349){_0x1ce052=_0x531349;_0xe5c5f6[_0x58f1('0x30')]=_['keys'](db[_0x58f1('0x4d')]['rawAttributes']);_0xe5c5f6[_0x58f1('0x31')]=_[_0x58f1('0x32')](_0x1535d6['query']);_0xe5c5f6[_0x58f1('0x33')]=_[_0x58f1('0x45')](_0xe5c5f6[_0x58f1('0x30')],_0xe5c5f6[_0x58f1('0x31')]);_0x44681c['attributes']=_['intersection'](_0xe5c5f6[_0x58f1('0x30')],qs['fields'](_0x1535d6[_0x58f1('0x31')][_0x58f1('0x35')]));_0x44681c['attributes']=_0x44681c[_0x58f1('0x34')][_0x58f1('0x36')]?_0x44681c['attributes']:_0xe5c5f6[_0x58f1('0x30')];_0x44681c[_0x58f1('0x38')]=qs['sort'](_0x1535d6['query'][_0x58f1('0x39')]);_0x44681c['where']=qs['filters'](_[_0x58f1('0x3b')](_0x1535d6[_0x58f1('0x31')],_0xe5c5f6[_0x58f1('0x33')]));if(_0x1535d6[_0x58f1('0x31')][_0x58f1('0x3c')]){_0x44681c[_0x58f1('0x3a')]=_['merge'](_0x44681c['where'],{'$or':_[_0x58f1('0x2b')](_0x44681c[_0x58f1('0x34')],function(_0x48a120){var _0x37bab0={};_0x37bab0[_0x48a120]={'$like':'%'+_0x1535d6[_0x58f1('0x31')][_0x58f1('0x3c')]+'%'};return _0x37bab0;})});}_0x44681c=_[_0x58f1('0x3e')]({},_0x44681c,_0x1535d6['options']);return _0x1ce052[_0x58f1('0x50')](_0x44681c);}})['then'](function(_0x1d5715){if(_0x1d5715){_0x18296d=_0x1d5715[_0x58f1('0x36')];if(!_0x1535d6[_0x58f1('0x31')][_0x58f1('0x37')]('nolimit')){_0x44681c['limit']=qs[_0x58f1('0x21')](_0x1535d6[_0x58f1('0x31')]['limit']);_0x44681c['offset']=qs['offset'](_0x1535d6['query'][_0x58f1('0x1f')]);}return _0x1ce052[_0x58f1('0x50')](_0x44681c);}})['then'](function(_0x3cde15){if(_0x3cde15){return _0x3cde15?{'count':_0x18296d,'rows':_0x3cde15}:null;}})[_0x58f1('0x27')](respondWithResult(_0x435e3a,null))[_0x58f1('0x43')](handleError(_0x435e3a,null));};exports[_0x58f1('0x51')]=function(_0x57909f,_0x20c71a,_0x306022){var _0x1a0004={};var _0x110a7b={};var _0x34386e;var _0x1bdc6b;return db[_0x58f1('0x2c')][_0x58f1('0x4c')]({'where':{'id':_0x57909f[_0x58f1('0x48')]['id']}})[_0x58f1('0x27')](handleEntityNotFound(_0x20c71a,null))[_0x58f1('0x27')](function(_0x5932ab){if(_0x5932ab){_0x34386e=_0x5932ab;_0x110a7b[_0x58f1('0x30')]=_[_0x58f1('0x32')](db[_0x58f1('0x52')][_0x58f1('0x2d')]);_0x110a7b['query']=_[_0x58f1('0x32')](_0x57909f[_0x58f1('0x31')]);_0x110a7b[_0x58f1('0x33')]=_[_0x58f1('0x45')](_0x110a7b[_0x58f1('0x30')],_0x110a7b[_0x58f1('0x31')]);_0x1a0004[_0x58f1('0x34')]=_[_0x58f1('0x45')](_0x110a7b[_0x58f1('0x30')],qs[_0x58f1('0x35')](_0x57909f['query']['fields']));_0x1a0004[_0x58f1('0x34')]=_0x1a0004[_0x58f1('0x34')][_0x58f1('0x36')]?_0x1a0004[_0x58f1('0x34')]:_0x110a7b[_0x58f1('0x30')];_0x1a0004[_0x58f1('0x38')]=qs[_0x58f1('0x39')](_0x57909f[_0x58f1('0x31')][_0x58f1('0x39')]);_0x1a0004['where']=qs[_0x58f1('0x33')](_[_0x58f1('0x3b')](_0x57909f[_0x58f1('0x31')],_0x110a7b[_0x58f1('0x33')]));if(_0x57909f[_0x58f1('0x31')][_0x58f1('0x3c')]){_0x1a0004[_0x58f1('0x3a')]=_[_0x58f1('0x3e')](_0x1a0004['where'],{'$or':_['map'](_0x1a0004[_0x58f1('0x34')],function(_0x24fb1c){var _0x1247f1={};_0x1247f1[_0x24fb1c]={'$like':'%'+_0x57909f[_0x58f1('0x31')]['filter']+'%'};return _0x1247f1;})});}_0x1a0004=_[_0x58f1('0x3e')]({},_0x1a0004,_0x57909f['options']);return _0x34386e['getTags'](_0x1a0004);}})[_0x58f1('0x27')](function(_0x499745){if(_0x499745){_0x1bdc6b=_0x499745['length'];if(!_0x57909f['query'][_0x58f1('0x37')](_0x58f1('0x4e'))){_0x1a0004[_0x58f1('0x21')]=qs[_0x58f1('0x21')](_0x57909f[_0x58f1('0x31')][_0x58f1('0x21')]);_0x1a0004['offset']=qs[_0x58f1('0x1f')](_0x57909f['query'][_0x58f1('0x1f')]);}return _0x34386e[_0x58f1('0x51')](_0x1a0004);}})[_0x58f1('0x27')](function(_0x3d7e4e){if(_0x3d7e4e){return _0x3d7e4e?{'count':_0x1bdc6b,'rows':_0x3d7e4e}:null;}})[_0x58f1('0x27')](respondWithResult(_0x20c71a,null))[_0x58f1('0x43')](handleError(_0x20c71a,null));};exports[_0x58f1('0x53')]=function(_0x5046f2,_0x4c14d2,_0x3c005f){if(_0x5046f2['body']['id']){delete _0x5046f2[_0x58f1('0x47')]['id'];}return db[_0x58f1('0x2c')][_0x58f1('0x4c')]({'where':{'id':_0x5046f2[_0x58f1('0x48')]['id']}})['then'](handleEntityNotFound(_0x4c14d2,null))[_0x58f1('0x27')](function(_0x236426){if(_0x236426){return _0x236426['setTags'](_0x5046f2['body'][_0x58f1('0x54')]||[]);}return null;})[_0x58f1('0x27')](respondWithResult(_0x4c14d2,null))[_0x58f1('0x43')](handleError(_0x4c14d2,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 8af5e66..3e6e98b 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 _0x1fb8=['api','moment','bluebird','request-promise','../../config/environment','./intDeskConfiguration.attributes','exports','DeskConfiguration','int_desk_configurations','lodash','util'];(function(_0x53f177,_0x51135c){var _0x13943a=function(_0x46b558){while(--_0x46b558){_0x53f177['push'](_0x53f177['shift']());}};_0x13943a(++_0x51135c);}(_0x1fb8,0x174));var _0x81fb=function(_0x46ce98,_0x52d764){_0x46ce98=_0x46ce98-0x0;var _0x172f46=_0x1fb8[_0x46ce98];return _0x172f46;};'use strict';var _=require(_0x81fb('0x0'));var util=require(_0x81fb('0x1'));var logger=require('../../config/logger')(_0x81fb('0x2'));var moment=require(_0x81fb('0x3'));var BPromise=require(_0x81fb('0x4'));var rp=require(_0x81fb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x81fb('0x6'));var attributes=require(_0x81fb('0x7'));module[_0x81fb('0x8')]=function(_0x342277,_0x72f433){return _0x342277['define'](_0x81fb('0x9'),attributes,{'tableName':_0x81fb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb32f=['./intDeskConfiguration.attributes','exports','define','DeskConfiguration','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x5399ab,_0x531515){var _0x4b5122=function(_0x19e6b1){while(--_0x19e6b1){_0x5399ab['push'](_0x5399ab['shift']());}};_0x4b5122(++_0x531515);}(_0xb32f,0xd0));var _0xfb32=function(_0xe15b15,_0x4d9458){_0xe15b15=_0xe15b15-0x0;var _0x415066=_0xb32f[_0xe15b15];return _0x415066;};'use strict';var _=require(_0xfb32('0x0'));var util=require('util');var logger=require(_0xfb32('0x1'))(_0xfb32('0x2'));var moment=require(_0xfb32('0x3'));var BPromise=require(_0xfb32('0x4'));var rp=require(_0xfb32('0x5'));var fs=require('fs');var path=require(_0xfb32('0x6'));var rimraf=require('rimraf');var config=require(_0xfb32('0x7'));var attributes=require(_0xfb32('0x8'));module[_0xfb32('0x9')]=function(_0x107fdd,_0x106346){return _0x107fdd[_0xfb32('0xa')](_0xfb32('0xb'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 95ab0ea..8b907ba 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 _0x7b77=['debug','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent'];(function(_0x4b9e80,_0x2b3179){var _0xc73b33=function(_0x256723){while(--_0x256723){_0x4b9e80['push'](_0x4b9e80['shift']());}};_0xc73b33(++_0x2b3179);}(_0x7b77,0x179));var _0x77b7=function(_0x81dcac,_0x8ff7db){_0x81dcac=_0x81dcac-0x0;var _0xc7803b=_0x7b77[_0x81dcac];return _0xc7803b;};'use strict';var _=require(_0x77b7('0x0'));var util=require(_0x77b7('0x1'));var moment=require(_0x77b7('0x2'));var BPromise=require(_0x77b7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x77b7('0x4'));var db=require(_0x77b7('0x5'))['db'];var utils=require(_0x77b7('0x6'));var logger=require('../../config/logger')(_0x77b7('0x7'));var config=require(_0x77b7('0x8'));var jayson=require(_0x77b7('0x9'));var client=jayson[_0x77b7('0xa')][_0x77b7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xe3c16b,_0x5c9387,_0x39d8e4){return new BPromise(function(_0x32b8ab,_0x33d439){return client['request'](_0xe3c16b,_0x39d8e4)[_0x77b7('0xc')](function(_0x4cfd3f){logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x5c9387,_0x77b7('0xd'));logger[_0x77b7('0xe')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x5c9387,_0x77b7('0xd'),JSON[_0x77b7('0xf')](_0x4cfd3f));if(_0x4cfd3f[_0x77b7('0x10')]){if(_0x4cfd3f[_0x77b7('0x10')][_0x77b7('0x11')]===0x1f4){logger[_0x77b7('0x10')](_0x77b7('0x12'),_0x5c9387,_0x4cfd3f['error'][_0x77b7('0x13')]);return _0x33d439(_0x4cfd3f[_0x77b7('0x10')]['message']);}logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x5c9387,_0x4cfd3f[_0x77b7('0x10')][_0x77b7('0x13')]);return _0x32b8ab(_0x4cfd3f[_0x77b7('0x10')][_0x77b7('0x13')]);}else{logger[_0x77b7('0x14')](_0x77b7('0x12'),_0x5c9387,'request\x20sent');_0x32b8ab(_0x4cfd3f[_0x77b7('0x15')][_0x77b7('0x13')]);}})[_0x77b7('0x16')](function(_0x2060df){logger[_0x77b7('0x10')](_0x77b7('0x12'),_0x5c9387,_0x2060df);_0x33d439(_0x2060df);});});} \ No newline at end of file +var _0xcd6f=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','debug','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','info','result','lodash'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xcd6f,0x17b));var _0xfcd6=function(_0x227af0,_0x4af0a4){_0x227af0=_0x227af0-0x0;var _0x14c9ed=_0xcd6f[_0x227af0];return _0x14c9ed;};'use strict';var _=require(_0xfcd6('0x0'));var util=require(_0xfcd6('0x1'));var moment=require(_0xfcd6('0x2'));var BPromise=require(_0xfcd6('0x3'));var rs=require(_0xfcd6('0x4'));var fs=require('fs');var Redis=require(_0xfcd6('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xfcd6('0x6'));var logger=require(_0xfcd6('0x7'))(_0xfcd6('0x8'));var config=require(_0xfcd6('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xfcd6('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x16a180,_0x51329c,_0x135b7e){return new BPromise(function(_0xfc5139,_0x544104){return client[_0xfcd6('0xb')](_0x16a180,_0x135b7e)['then'](function(_0x12dc78){logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x51329c,'request\x20sent');logger[_0xfcd6('0xc')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x51329c,'request\x20sent',JSON[_0xfcd6('0xd')](_0x12dc78));if(_0x12dc78[_0xfcd6('0xe')]){if(_0x12dc78['error'][_0xfcd6('0xf')]===0x1f4){logger[_0xfcd6('0xe')](_0xfcd6('0x10'),_0x51329c,_0x12dc78[_0xfcd6('0xe')][_0xfcd6('0x11')]);return _0x544104(_0x12dc78[_0xfcd6('0xe')][_0xfcd6('0x11')]);}logger[_0xfcd6('0xe')](_0xfcd6('0x10'),_0x51329c,_0x12dc78[_0xfcd6('0xe')][_0xfcd6('0x11')]);return _0xfc5139(_0x12dc78[_0xfcd6('0xe')][_0xfcd6('0x11')]);}else{logger[_0xfcd6('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0x51329c,'request\x20sent');_0xfc5139(_0x12dc78[_0xfcd6('0x13')][_0xfcd6('0x11')]);}})['catch'](function(_0x29d25d){logger[_0xfcd6('0xe')](_0xfcd6('0x10'),_0x51329c,_0x29d25d);_0x544104(_0x29d25d);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index ea5083b..5956023 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 _0x4a4b=['update','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','post','create','put','/:id'];(function(_0x34345f,_0x28a261){var _0x15202b=function(_0x118768){while(--_0x118768){_0x34345f['push'](_0x34345f['shift']());}};_0x15202b(++_0x28a261);}(_0x4a4b,0x9c));var _0xb4a4=function(_0xfc7389,_0x11b3ab){_0xfc7389=_0xfc7389-0x0;var _0x516b10=_0x4a4b[_0xfc7389];return _0x516b10;};'use strict';var multer=require(_0xb4a4('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb4a4('0x1'));var express=require('express');var router=express[_0xb4a4('0x2')]();var fs_extra=require(_0xb4a4('0x3'));var auth=require(_0xb4a4('0x4'));var interaction=require(_0xb4a4('0x5'));var config=require(_0xb4a4('0x6'));var controller=require('./intDeskField.controller');router[_0xb4a4('0x7')]('/',auth[_0xb4a4('0x8')](),controller['index']);router[_0xb4a4('0x7')]('/:id',auth[_0xb4a4('0x8')](),controller[_0xb4a4('0x9')]);router[_0xb4a4('0xa')]('/',auth[_0xb4a4('0x8')](),controller[_0xb4a4('0xb')]);router[_0xb4a4('0xc')](_0xb4a4('0xd'),auth[_0xb4a4('0x8')](),controller[_0xb4a4('0xe')]);router['delete'](_0xb4a4('0xd'),auth['isAuthenticated'](),controller[_0xb4a4('0xf')]);module[_0xb4a4('0x10')]=router; \ No newline at end of file +var _0x909e=['../../components/auth/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','/:id','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x909e,0x174));var _0xe909=function(_0x50bdb1,_0x47baf3){_0x50bdb1=_0x50bdb1-0x0;var _0x3a60ac=_0x909e[_0x50bdb1];return _0x3a60ac;};'use strict';var multer=require(_0xe909('0x0'));var util=require(_0xe909('0x1'));var path=require(_0xe909('0x2'));var timeout=require(_0xe909('0x3'));var express=require(_0xe909('0x4'));var router=express['Router']();var fs_extra=require(_0xe909('0x5'));var auth=require(_0xe909('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe909('0x7'));var controller=require(_0xe909('0x8'));router[_0xe909('0x9')]('/',auth[_0xe909('0xa')](),controller[_0xe909('0xb')]);router[_0xe909('0x9')](_0xe909('0xc'),auth[_0xe909('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xe909('0xd')]);router[_0xe909('0xe')](_0xe909('0xc'),auth['isAuthenticated'](),controller[_0xe909('0xf')]);router['delete'](_0xe909('0xc'),auth['isAuthenticated'](),controller[_0xe909('0x10')]);module[_0xe909('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 5e017dd..d5f641b 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 _0x147b=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x1d49bb,_0x1c2094){var _0x559d5d=function(_0x5a1aea){while(--_0x5a1aea){_0x1d49bb['push'](_0x1d49bb['shift']());}};_0x559d5d(++_0x1c2094);}(_0x147b,0x1cd));var _0xb147=function(_0x43a4c2,_0x4e400f){_0x43a4c2=_0x43a4c2-0x0;var _0x3cd4fb=_0x147b[_0x43a4c2];return _0x3cd4fb;};'use strict';var Sequelize=require(_0xb147('0x0'));module[_0xb147('0x1')]={'type':{'type':Sequelize[_0xb147('0x2')](_0xb147('0x3'),_0xb147('0x4'),_0xb147('0x5'),_0xb147('0x6'),_0xb147('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0xb147('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xb147('0x2')](_0xb147('0x3'),_0xb147('0x4'),_0xb147('0x5'))},'keyContent':{'type':Sequelize[_0xb147('0x8')]},'idField':{'type':Sequelize[_0xb147('0x8')]},'nameField':{'type':Sequelize[_0xb147('0x8')]},'customField':{'type':Sequelize[_0xb147('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x49e2=['variable','customVariable','keyValue','STRING','ENUM','BOOLEAN','sequelize','string'];(function(_0x219196,_0x5b61ef){var _0x1cfd79=function(_0x13d89e){while(--_0x13d89e){_0x219196['push'](_0x219196['shift']());}};_0x1cfd79(++_0x5b61ef);}(_0x49e2,0xa6));var _0x249e=function(_0x5178d8,_0x93a25d){_0x5178d8=_0x5178d8-0x0;var _0x33e667=_0x49e2[_0x5178d8];return _0x33e667;};'use strict';var Sequelize=require(_0x249e('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x249e('0x1'),_0x249e('0x2'),_0x249e('0x3'),_0x249e('0x4'),'picklist'),'defaultValue':_0x249e('0x1')},'content':{'type':Sequelize[_0x249e('0x5')]},'key':{'type':Sequelize[_0x249e('0x5')]},'keyType':{'type':Sequelize[_0x249e('0x6')]('string',_0x249e('0x2'),_0x249e('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x249e('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x249e('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x249e('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 657a00b..0f9863d 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 _0x8dbd=['status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','error','stack','name','index','map','DeskField','rawAttributes','type','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','order','where','pick','filter','merge','options','includeAll','findAll','rows','catch','include','find','create','body','params','destroy','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','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0x4251eb,_0x405027){var _0x7bdcd7=function(_0x146d5d){while(--_0x146d5d){_0x4251eb['push'](_0x4251eb['shift']());}};_0x7bdcd7(++_0x405027);}(_0x8dbd,0x159));var _0xd8db=function(_0x4a09cb,_0xae7b93){_0x4a09cb=_0x4a09cb-0x0;var _0x42eebd=_0x8dbd[_0x4a09cb];return _0x42eebd;};'use strict';var emlformat=require(_0xd8db('0x0'));var rimraf=require(_0xd8db('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd8db('0x2'));var rp=require(_0xd8db('0x3'));var moment=require(_0xd8db('0x4'));var BPromise=require(_0xd8db('0x5'));var Mustache=require(_0xd8db('0x6'));var util=require(_0xd8db('0x7'));var path=require(_0xd8db('0x8'));var sox=require(_0xd8db('0x9'));var csv=require(_0xd8db('0xa'));var ejs=require(_0xd8db('0xb'));var fs=require('fs');var fs_extra=require(_0xd8db('0xc'));var _=require(_0xd8db('0xd'));var squel=require(_0xd8db('0xe'));var crypto=require(_0xd8db('0xf'));var jsforce=require(_0xd8db('0x10'));var deskjs=require(_0xd8db('0x11'));var toCsv=require(_0xd8db('0xa'));var querystring=require('querystring');var Papa=require(_0xd8db('0x12'));var Redis=require(_0xd8db('0x13'));var authService=require(_0xd8db('0x14'));var qs=require(_0xd8db('0x15'));var as=require(_0xd8db('0x16'));var hardwareService=require(_0xd8db('0x17'));var logger=require(_0xd8db('0x18'))(_0xd8db('0x19'));var utils=require(_0xd8db('0x1a'));var config=require(_0xd8db('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0xd8db('0x1c'))['db'];function respondWithStatusCode(_0x23b404,_0x300fbd){_0x300fbd=_0x300fbd||0xcc;return function(_0xbfeb55){if(_0xbfeb55){return _0x23b404[_0xd8db('0x1d')](_0x300fbd);}return _0x23b404[_0xd8db('0x1e')](_0x300fbd)[_0xd8db('0x1f')]();};}function respondWithResult(_0x1eaa93,_0x491503){_0x491503=_0x491503||0xc8;return function(_0x5c0512){if(_0x5c0512){return _0x1eaa93[_0xd8db('0x1e')](_0x491503)[_0xd8db('0x20')](_0x5c0512);}};}function respondWithFilteredResult(_0x4c10a6,_0x221681){return function(_0x2eeed7){if(_0x2eeed7){var _0x54ad20=typeof _0x221681[_0xd8db('0x21')]===_0xd8db('0x22')&&typeof _0x221681[_0xd8db('0x23')]===_0xd8db('0x22');var _0x29d0b8=_0x2eeed7[_0xd8db('0x24')];var _0x2d0a0c=_0x54ad20?0x0:_0x221681[_0xd8db('0x21')];var _0x29026e=_0x54ad20?_0x2eeed7[_0xd8db('0x24')]:_0x221681[_0xd8db('0x21')]+_0x221681['limit'];var _0x4b5c1e;if(_0x29026e>=_0x29d0b8){_0x29026e=_0x29d0b8;_0x4b5c1e=0xc8;}else{_0x4b5c1e=0xce;}_0x4c10a6[_0xd8db('0x1e')](_0x4b5c1e);return _0x4c10a6[_0xd8db('0x25')](_0xd8db('0x26'),_0x2d0a0c+'-'+_0x29026e+'/'+_0x29d0b8)[_0xd8db('0x20')](_0x2eeed7);}return null;};}function patchUpdates(_0x2207bd){return function(_0xe8a2f){try{jsonpatch[_0xd8db('0x27')](_0xe8a2f,_0x2207bd,!![]);}catch(_0x44041c){return BPromise[_0xd8db('0x28')](_0x44041c);}return _0xe8a2f[_0xd8db('0x29')]();};}function saveUpdates(_0xf901a5,_0x1b32d9){return function(_0x11db7a){if(_0x11db7a){return _0x11db7a['update'](_0xf901a5)[_0xd8db('0x2a')](function(_0xd540b){return _0xd540b;});}return null;};}function removeEntity(_0x312024,_0x107292){return function(_0x2524ea){if(_0x2524ea){return _0x2524ea['destroy']()['then'](function(){_0x312024[_0xd8db('0x1e')](0xcc)[_0xd8db('0x1f')]();});}};}function handleEntityNotFound(_0x269f42,_0x65940e){return function(_0x6fae60){if(!_0x6fae60){_0x269f42[_0xd8db('0x1d')](0x194);}return _0x6fae60;};}function handleError(_0x595257,_0x1bbefe){_0x1bbefe=_0x1bbefe||0x1f4;return function(_0x5bbb91){logger[_0xd8db('0x2b')](_0x5bbb91[_0xd8db('0x2c')]);if(_0x5bbb91[_0xd8db('0x2d')]){delete _0x5bbb91['name'];}_0x595257[_0xd8db('0x1e')](_0x1bbefe)['send'](_0x5bbb91);};}exports[_0xd8db('0x2e')]=function(_0x3249f3,_0x90e6b6){var _0x45bfbe={},_0x1f0e11={},_0x4a866f={'count':0x0,'rows':[]};var _0x23020b=_[_0xd8db('0x2f')](db[_0xd8db('0x30')][_0xd8db('0x31')],function(_0x4f0024){return{'name':_0x4f0024['fieldName'],'type':_0x4f0024[_0xd8db('0x32')]['key']};});_0x1f0e11[_0xd8db('0x33')]=_[_0xd8db('0x2f')](_0x23020b,'name');_0x1f0e11['query']=_[_0xd8db('0x34')](_0x3249f3[_0xd8db('0x35')]);_0x1f0e11[_0xd8db('0x36')]=_['intersection'](_0x1f0e11[_0xd8db('0x33')],_0x1f0e11[_0xd8db('0x35')]);_0x45bfbe['attributes']=_[_0xd8db('0x37')](_0x1f0e11[_0xd8db('0x33')],qs[_0xd8db('0x38')](_0x3249f3[_0xd8db('0x35')][_0xd8db('0x38')]));_0x45bfbe[_0xd8db('0x39')]=_0x45bfbe[_0xd8db('0x39')]['length']?_0x45bfbe[_0xd8db('0x39')]:_0x1f0e11[_0xd8db('0x33')];if(!_0x3249f3['query'][_0xd8db('0x3a')]('nolimit')){_0x45bfbe[_0xd8db('0x23')]=qs['limit'](_0x3249f3[_0xd8db('0x35')][_0xd8db('0x23')]);_0x45bfbe[_0xd8db('0x21')]=qs[_0xd8db('0x21')](_0x3249f3[_0xd8db('0x35')][_0xd8db('0x21')]);}_0x45bfbe[_0xd8db('0x3b')]=qs['sort'](_0x3249f3['query']['sort']);_0x45bfbe[_0xd8db('0x3c')]=qs[_0xd8db('0x36')](_[_0xd8db('0x3d')](_0x3249f3['query'],_0x1f0e11['filters']),_0x23020b);if(_0x3249f3[_0xd8db('0x35')][_0xd8db('0x3e')]){_0x45bfbe[_0xd8db('0x3c')]=_[_0xd8db('0x3f')](_0x45bfbe[_0xd8db('0x3c')],{'$or':_[_0xd8db('0x2f')](_0x23020b,function(_0x2db4e7){if(_0x2db4e7[_0xd8db('0x32')]!=='VIRTUAL'){var _0x265010={};_0x265010[_0x2db4e7[_0xd8db('0x2d')]]={'$like':'%'+_0x3249f3[_0xd8db('0x35')][_0xd8db('0x3e')]+'%'};return _0x265010;}})});}_0x45bfbe=_[_0xd8db('0x3f')]({},_0x45bfbe,_0x3249f3[_0xd8db('0x40')]);var _0x51f06c={'where':_0x45bfbe['where']};return db[_0xd8db('0x30')][_0xd8db('0x24')](_0x51f06c)[_0xd8db('0x2a')](function(_0x52ef63){_0x4a866f[_0xd8db('0x24')]=_0x52ef63;if(_0x3249f3[_0xd8db('0x35')][_0xd8db('0x41')]){_0x45bfbe['include']=[{'all':!![]}];}return db[_0xd8db('0x30')][_0xd8db('0x42')](_0x45bfbe);})[_0xd8db('0x2a')](function(_0x2f7a0c){_0x4a866f[_0xd8db('0x43')]=_0x2f7a0c;return _0x4a866f;})['then'](respondWithFilteredResult(_0x90e6b6,_0x45bfbe))[_0xd8db('0x44')](handleError(_0x90e6b6,null));};exports['show']=function(_0x3e9565,_0x48e63d){var _0x5d69b8={'raw':!![],'where':{'id':_0x3e9565['params']['id']}},_0x1e7dd8={};_0x1e7dd8[_0xd8db('0x33')]=_[_0xd8db('0x34')](db[_0xd8db('0x30')][_0xd8db('0x31')]);_0x1e7dd8['query']=_[_0xd8db('0x34')](_0x3e9565[_0xd8db('0x35')]);_0x1e7dd8[_0xd8db('0x36')]=_[_0xd8db('0x37')](_0x1e7dd8[_0xd8db('0x33')],_0x1e7dd8[_0xd8db('0x35')]);_0x5d69b8[_0xd8db('0x39')]=_['intersection'](_0x1e7dd8[_0xd8db('0x33')],qs[_0xd8db('0x38')](_0x3e9565['query'][_0xd8db('0x38')]));_0x5d69b8[_0xd8db('0x39')]=_0x5d69b8[_0xd8db('0x39')]['length']?_0x5d69b8[_0xd8db('0x39')]:_0x1e7dd8['model'];if(_0x3e9565[_0xd8db('0x35')][_0xd8db('0x41')]){_0x5d69b8[_0xd8db('0x45')]=[{'all':!![]}];}_0x5d69b8=_[_0xd8db('0x3f')]({},_0x5d69b8,_0x3e9565['options']);return db[_0xd8db('0x30')][_0xd8db('0x46')](_0x5d69b8)[_0xd8db('0x2a')](handleEntityNotFound(_0x48e63d,null))[_0xd8db('0x2a')](respondWithResult(_0x48e63d,null))['catch'](handleError(_0x48e63d,null));};exports[_0xd8db('0x47')]=function(_0x10f700,_0x3be9c3){return db['DeskField']['create'](_0x10f700[_0xd8db('0x48')],{})[_0xd8db('0x2a')](respondWithResult(_0x3be9c3,0xc9))[_0xd8db('0x44')](handleError(_0x3be9c3,null));};exports['update']=function(_0x215907,_0x57cd75){if(_0x215907['body']['id']){delete _0x215907[_0xd8db('0x48')]['id'];}return db['DeskField'][_0xd8db('0x46')]({'where':{'id':_0x215907[_0xd8db('0x49')]['id']}})[_0xd8db('0x2a')](handleEntityNotFound(_0x57cd75,null))[_0xd8db('0x2a')](saveUpdates(_0x215907[_0xd8db('0x48')],null))[_0xd8db('0x2a')](respondWithResult(_0x57cd75,null))[_0xd8db('0x44')](handleError(_0x57cd75,null));};exports[_0xd8db('0x4a')]=function(_0x206f34,_0x14bef4){return db[_0xd8db('0x30')][_0xd8db('0x46')]({'where':{'id':_0x206f34[_0xd8db('0x49')]['id']}})[_0xd8db('0x2a')](handleEntityNotFound(_0x14bef4,null))[_0xd8db('0x2a')](removeEntity(_0x14bef4,null))['catch'](handleError(_0x14bef4,null));}; \ No newline at end of file +var _0xe08b=['status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','DeskField','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','length','include','create','body','find','params','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus'];(function(_0x2f3790,_0x5c24d9){var _0x353e28=function(_0x2ac3d8){while(--_0x2ac3d8){_0x2f3790['push'](_0x2f3790['shift']());}};_0x353e28(++_0x5c24d9);}(_0xe08b,0x10e));var _0xbe08=function(_0x38854e,_0x23cbc9){_0x38854e=_0x38854e-0x0;var _0x3f8415=_0xe08b[_0x38854e];return _0x3f8415;};'use strict';var emlformat=require(_0xbe08('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbe08('0x1'));var jsonpatch=require(_0xbe08('0x2'));var rp=require('request-promise');var moment=require(_0xbe08('0x3'));var BPromise=require(_0xbe08('0x4'));var Mustache=require(_0xbe08('0x5'));var util=require(_0xbe08('0x6'));var path=require(_0xbe08('0x7'));var sox=require(_0xbe08('0x8'));var csv=require(_0xbe08('0x9'));var ejs=require(_0xbe08('0xa'));var fs=require('fs');var fs_extra=require(_0xbe08('0xb'));var _=require(_0xbe08('0xc'));var squel=require(_0xbe08('0xd'));var crypto=require(_0xbe08('0xe'));var jsforce=require(_0xbe08('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xbe08('0x9'));var querystring=require(_0xbe08('0x10'));var Papa=require('papaparse');var Redis=require(_0xbe08('0x11'));var authService=require(_0xbe08('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xbe08('0x13'));var hardwareService=require(_0xbe08('0x14'));var logger=require('../../config/logger')(_0xbe08('0x15'));var utils=require(_0xbe08('0x16'));var config=require(_0xbe08('0x17'));var licenseUtil=require(_0xbe08('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x42ab71,_0x49410b){_0x49410b=_0x49410b||0xcc;return function(_0x18ee13){if(_0x18ee13){return _0x42ab71[_0xbe08('0x19')](_0x49410b);}return _0x42ab71[_0xbe08('0x1a')](_0x49410b)[_0xbe08('0x1b')]();};}function respondWithResult(_0xe1dafa,_0x3050f1){_0x3050f1=_0x3050f1||0xc8;return function(_0x434646){if(_0x434646){return _0xe1dafa[_0xbe08('0x1a')](_0x3050f1)[_0xbe08('0x1c')](_0x434646);}};}function respondWithFilteredResult(_0x191f51,_0x457129){return function(_0x2b0901){if(_0x2b0901){var _0x122f44=typeof _0x457129[_0xbe08('0x1d')]===_0xbe08('0x1e')&&typeof _0x457129[_0xbe08('0x1f')]===_0xbe08('0x1e');var _0x344019=_0x2b0901['count'];var _0x2fa9b3=_0x122f44?0x0:_0x457129[_0xbe08('0x1d')];var _0x154559=_0x122f44?_0x2b0901[_0xbe08('0x20')]:_0x457129[_0xbe08('0x1d')]+_0x457129[_0xbe08('0x1f')];var _0x1f9808;if(_0x154559>=_0x344019){_0x154559=_0x344019;_0x1f9808=0xc8;}else{_0x1f9808=0xce;}_0x191f51['status'](_0x1f9808);return _0x191f51[_0xbe08('0x21')](_0xbe08('0x22'),_0x2fa9b3+'-'+_0x154559+'/'+_0x344019)['json'](_0x2b0901);}return null;};}function patchUpdates(_0x5ab5f5){return function(_0x439a78){try{jsonpatch[_0xbe08('0x23')](_0x439a78,_0x5ab5f5,!![]);}catch(_0x3785e4){return BPromise['reject'](_0x3785e4);}return _0x439a78[_0xbe08('0x24')]();};}function saveUpdates(_0x25ce24,_0x42143c){return function(_0x45697b){if(_0x45697b){return _0x45697b[_0xbe08('0x25')](_0x25ce24)[_0xbe08('0x26')](function(_0xf1c94a){return _0xf1c94a;});}return null;};}function removeEntity(_0x451732,_0x2d6493){return function(_0x493d13){if(_0x493d13){return _0x493d13[_0xbe08('0x27')]()[_0xbe08('0x26')](function(){_0x451732[_0xbe08('0x1a')](0xcc)[_0xbe08('0x1b')]();});}};}function handleEntityNotFound(_0x3310be,_0x28d47b){return function(_0x368122){if(!_0x368122){_0x3310be[_0xbe08('0x19')](0x194);}return _0x368122;};}function handleError(_0x628624,_0x361b06){_0x361b06=_0x361b06||0x1f4;return function(_0x5e470c){logger[_0xbe08('0x28')](_0x5e470c[_0xbe08('0x29')]);if(_0x5e470c[_0xbe08('0x2a')]){delete _0x5e470c[_0xbe08('0x2a')];}_0x628624[_0xbe08('0x1a')](_0x361b06)[_0xbe08('0x2b')](_0x5e470c);};}exports['index']=function(_0x415da3,_0x2aaa12){var _0x3b77bb={},_0x465b7b={},_0x1135c3={'count':0x0,'rows':[]};var _0x523be0=_[_0xbe08('0x2c')](db[_0xbe08('0x2d')][_0xbe08('0x2e')],function(_0x54c913){return{'name':_0x54c913[_0xbe08('0x2f')],'type':_0x54c913[_0xbe08('0x30')]['key']};});_0x465b7b[_0xbe08('0x31')]=_[_0xbe08('0x2c')](_0x523be0,'name');_0x465b7b[_0xbe08('0x32')]=_[_0xbe08('0x33')](_0x415da3[_0xbe08('0x32')]);_0x465b7b[_0xbe08('0x34')]=_[_0xbe08('0x35')](_0x465b7b[_0xbe08('0x31')],_0x465b7b[_0xbe08('0x32')]);_0x3b77bb[_0xbe08('0x36')]=_[_0xbe08('0x35')](_0x465b7b[_0xbe08('0x31')],qs[_0xbe08('0x37')](_0x415da3[_0xbe08('0x32')][_0xbe08('0x37')]));_0x3b77bb[_0xbe08('0x36')]=_0x3b77bb[_0xbe08('0x36')]['length']?_0x3b77bb['attributes']:_0x465b7b[_0xbe08('0x31')];if(!_0x415da3[_0xbe08('0x32')]['hasOwnProperty'](_0xbe08('0x38'))){_0x3b77bb[_0xbe08('0x1f')]=qs[_0xbe08('0x1f')](_0x415da3[_0xbe08('0x32')]['limit']);_0x3b77bb[_0xbe08('0x1d')]=qs[_0xbe08('0x1d')](_0x415da3['query']['offset']);}_0x3b77bb[_0xbe08('0x39')]=qs[_0xbe08('0x3a')](_0x415da3[_0xbe08('0x32')][_0xbe08('0x3a')]);_0x3b77bb['where']=qs[_0xbe08('0x34')](_['pick'](_0x415da3[_0xbe08('0x32')],_0x465b7b[_0xbe08('0x34')]),_0x523be0);if(_0x415da3['query'][_0xbe08('0x3b')]){_0x3b77bb[_0xbe08('0x3c')]=_[_0xbe08('0x3d')](_0x3b77bb[_0xbe08('0x3c')],{'$or':_[_0xbe08('0x2c')](_0x523be0,function(_0x56db9c){if(_0x56db9c[_0xbe08('0x30')]!==_0xbe08('0x3e')){var _0x2c80d7={};_0x2c80d7[_0x56db9c[_0xbe08('0x2a')]]={'$like':'%'+_0x415da3[_0xbe08('0x32')][_0xbe08('0x3b')]+'%'};return _0x2c80d7;}})});}_0x3b77bb=_[_0xbe08('0x3d')]({},_0x3b77bb,_0x415da3[_0xbe08('0x3f')]);var _0x357158={'where':_0x3b77bb['where']};return db[_0xbe08('0x2d')][_0xbe08('0x20')](_0x357158)['then'](function(_0x4f0bbe){_0x1135c3[_0xbe08('0x20')]=_0x4f0bbe;if(_0x415da3['query'][_0xbe08('0x40')]){_0x3b77bb['include']=[{'all':!![]}];}return db[_0xbe08('0x2d')][_0xbe08('0x41')](_0x3b77bb);})[_0xbe08('0x26')](function(_0x337c2b){_0x1135c3[_0xbe08('0x42')]=_0x337c2b;return _0x1135c3;})[_0xbe08('0x26')](respondWithFilteredResult(_0x2aaa12,_0x3b77bb))[_0xbe08('0x43')](handleError(_0x2aaa12,null));};exports['show']=function(_0x274139,_0x16d412){var _0x4b4d7a={'raw':!![],'where':{'id':_0x274139['params']['id']}},_0x59179f={};_0x59179f[_0xbe08('0x31')]=_[_0xbe08('0x33')](db['DeskField']['rawAttributes']);_0x59179f[_0xbe08('0x32')]=_[_0xbe08('0x33')](_0x274139[_0xbe08('0x32')]);_0x59179f[_0xbe08('0x34')]=_[_0xbe08('0x35')](_0x59179f[_0xbe08('0x31')],_0x59179f[_0xbe08('0x32')]);_0x4b4d7a[_0xbe08('0x36')]=_['intersection'](_0x59179f[_0xbe08('0x31')],qs[_0xbe08('0x37')](_0x274139[_0xbe08('0x32')][_0xbe08('0x37')]));_0x4b4d7a[_0xbe08('0x36')]=_0x4b4d7a[_0xbe08('0x36')][_0xbe08('0x44')]?_0x4b4d7a['attributes']:_0x59179f['model'];if(_0x274139[_0xbe08('0x32')][_0xbe08('0x40')]){_0x4b4d7a[_0xbe08('0x45')]=[{'all':!![]}];}_0x4b4d7a=_[_0xbe08('0x3d')]({},_0x4b4d7a,_0x274139[_0xbe08('0x3f')]);return db['DeskField']['find'](_0x4b4d7a)['then'](handleEntityNotFound(_0x16d412,null))[_0xbe08('0x26')](respondWithResult(_0x16d412,null))['catch'](handleError(_0x16d412,null));};exports['create']=function(_0x1e6e6e,_0x9a9e38){return db[_0xbe08('0x2d')][_0xbe08('0x46')](_0x1e6e6e[_0xbe08('0x47')],{})[_0xbe08('0x26')](respondWithResult(_0x9a9e38,0xc9))[_0xbe08('0x43')](handleError(_0x9a9e38,null));};exports[_0xbe08('0x25')]=function(_0x592a7e,_0x2bd33a){if(_0x592a7e[_0xbe08('0x47')]['id']){delete _0x592a7e[_0xbe08('0x47')]['id'];}return db['DeskField'][_0xbe08('0x48')]({'where':{'id':_0x592a7e[_0xbe08('0x49')]['id']}})['then'](handleEntityNotFound(_0x2bd33a,null))[_0xbe08('0x26')](saveUpdates(_0x592a7e[_0xbe08('0x47')],null))['then'](respondWithResult(_0x2bd33a,null))[_0xbe08('0x43')](handleError(_0x2bd33a,null));};exports[_0xbe08('0x27')]=function(_0x50c0ec,_0x52c6f1){return db['DeskField']['find']({'where':{'id':_0x50c0ec['params']['id']}})[_0xbe08('0x26')](handleEntityNotFound(_0x52c6f1,null))[_0xbe08('0x26')](removeEntity(_0x52c6f1,null))['catch'](handleError(_0x52c6f1,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index e0c8e71..a727221 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 _0x3777=['FieldId','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','DeskField','desk_unique_index','idField'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x3777,0x109));var _0x7377=function(_0x58afd5,_0x534a48){_0x58afd5=_0x58afd5-0x0;var _0x3e503b=_0x3777[_0x58afd5];return _0x3e503b;};'use strict';var _=require('lodash');var util=require(_0x7377('0x0'));var logger=require(_0x7377('0x1'))('api');var moment=require(_0x7377('0x2'));var BPromise=require(_0x7377('0x3'));var rp=require(_0x7377('0x4'));var fs=require('fs');var path=require(_0x7377('0x5'));var rimraf=require('rimraf');var config=require(_0x7377('0x6'));var attributes=require('./intDeskField.attributes');module['exports']=function(_0x439369,_0x2f0630){return _0x439369['define'](_0x7377('0x7'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x7377('0x8'),'fields':[_0x7377('0x9'),_0x7377('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd735=['../../config/environment','./intDeskField.attributes','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x17ac5b,_0x1a2d16){var _0x2dcec9=function(_0x4bbe8d){while(--_0x4bbe8d){_0x17ac5b['push'](_0x17ac5b['shift']());}};_0x2dcec9(++_0x1a2d16);}(_0xd735,0xd3));var _0x5d73=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xd735[_0x27af45];return _0x18df21;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5d73('0x0'))(_0x5d73('0x1'));var moment=require(_0x5d73('0x2'));var BPromise=require('bluebird');var rp=require(_0x5d73('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5d73('0x4'));var config=require(_0x5d73('0x5'));var attributes=require(_0x5d73('0x6'));module['exports']=function(_0x565175,_0x4ee39b){return _0x565175['define'](_0x5d73('0x7'),attributes,{'tableName':_0x5d73('0x8'),'paranoid':![],'indexes':[{'name':_0x5d73('0x9'),'fields':[_0x5d73('0xa'),_0x5d73('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index a546e6a..85ee5f2 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 _0x04bf=['http','request','then','DeskField,\x20%s,\x20%s','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','randomstring','ioredis','rpc','client'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x04bf,0x13d));var _0xf04b=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x04bf[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0xf04b('0x0'));var util=require('util');var moment=require(_0xf04b('0x1'));var BPromise=require('bluebird');var rs=require(_0xf04b('0x2'));var fs=require('fs');var Redis=require(_0xf04b('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf04b('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf04b('0x5')][_0xf04b('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2a2ae0,_0x245bad,_0xbcb761){return new BPromise(function(_0x18e1e0,_0x319441){return client[_0xf04b('0x7')](_0x2a2ae0,_0xbcb761)[_0xf04b('0x8')](function(_0x162897){logger['info'](_0xf04b('0x9'),_0x245bad,_0xf04b('0xa'));logger['debug'](_0xf04b('0xb'),_0x245bad,_0xf04b('0xa'),JSON[_0xf04b('0xc')](_0x162897));if(_0x162897[_0xf04b('0xd')]){if(_0x162897['error'][_0xf04b('0xe')]===0x1f4){logger['error']('DeskField,\x20%s,\x20%s',_0x245bad,_0x162897[_0xf04b('0xd')][_0xf04b('0xf')]);return _0x319441(_0x162897[_0xf04b('0xd')]['message']);}logger[_0xf04b('0xd')](_0xf04b('0x9'),_0x245bad,_0x162897[_0xf04b('0xd')][_0xf04b('0xf')]);return _0x18e1e0(_0x162897[_0xf04b('0xd')]['message']);}else{logger[_0xf04b('0x10')](_0xf04b('0x9'),_0x245bad,_0xf04b('0xa'));_0x18e1e0(_0x162897[_0xf04b('0x11')][_0xf04b('0xf')]);}})[_0xf04b('0x12')](function(_0x195514){logger[_0xf04b('0xd')](_0xf04b('0x9'),_0x245bad,_0x195514);_0x319441(_0x195514);});});} \ No newline at end of file +var _0xf916=['http','request','then','info','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskField,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client'];(function(_0x1bb812,_0x23eacc){var _0x372adb=function(_0x5ad456){while(--_0x5ad456){_0x1bb812['push'](_0x1bb812['shift']());}};_0x372adb(++_0x23eacc);}(_0xf916,0x97));var _0x6f91=function(_0x559d6c,_0x124742){_0x559d6c=_0x559d6c-0x0;var _0x40efda=_0xf916[_0x559d6c];return _0x40efda;};'use strict';var _=require(_0x6f91('0x0'));var util=require(_0x6f91('0x1'));var moment=require(_0x6f91('0x2'));var BPromise=require(_0x6f91('0x3'));var rs=require(_0x6f91('0x4'));var fs=require('fs');var Redis=require(_0x6f91('0x5'));var db=require(_0x6f91('0x6'))['db'];var utils=require(_0x6f91('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x6f91('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6f91('0x9')][_0x6f91('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1552e7,_0x41545c,_0x203496){return new BPromise(function(_0x27eabc,_0x243d55){return client[_0x6f91('0xb')](_0x1552e7,_0x203496)[_0x6f91('0xc')](function(_0x31a66f){logger[_0x6f91('0xd')]('DeskField,\x20%s,\x20%s',_0x41545c,_0x6f91('0xe'));logger[_0x6f91('0xf')](_0x6f91('0x10'),_0x41545c,_0x6f91('0xe'),JSON[_0x6f91('0x11')](_0x31a66f));if(_0x31a66f['error']){if(_0x31a66f[_0x6f91('0x12')][_0x6f91('0x13')]===0x1f4){logger[_0x6f91('0x12')](_0x6f91('0x14'),_0x41545c,_0x31a66f[_0x6f91('0x12')][_0x6f91('0x15')]);return _0x243d55(_0x31a66f['error'][_0x6f91('0x15')]);}logger[_0x6f91('0x12')]('DeskField,\x20%s,\x20%s',_0x41545c,_0x31a66f[_0x6f91('0x12')][_0x6f91('0x15')]);return _0x27eabc(_0x31a66f[_0x6f91('0x12')]['message']);}else{logger[_0x6f91('0xd')](_0x6f91('0x14'),_0x41545c,_0x6f91('0xe'));_0x27eabc(_0x31a66f[_0x6f91('0x16')][_0x6f91('0x15')]);}})['catch'](function(_0x1a61a0){logger[_0x6f91('0x12')](_0x6f91('0x14'),_0x41545c,_0x1a61a0);_0x243d55(_0x1a61a0);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 54eaf7b..ffb4923 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 _0xbdc0=['destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','getConfigurations','getFields','post','create','/:id/configurations','addConfiguration','/:id','update','delete'];(function(_0x1d0f0b,_0x1b8898){var _0x4ed5b8=function(_0x10412d){while(--_0x10412d){_0x1d0f0b['push'](_0x1d0f0b['shift']());}};_0x4ed5b8(++_0x1b8898);}(_0xbdc0,0x151));var _0x0bdc=function(_0x3fd9ca,_0x526713){_0x3fd9ca=_0x3fd9ca-0x0;var _0x297a11=_0xbdc0[_0x3fd9ca];return _0x297a11;};'use strict';var multer=require(_0x0bdc('0x0'));var util=require(_0x0bdc('0x1'));var path=require(_0x0bdc('0x2'));var timeout=require('connect-timeout');var express=require(_0x0bdc('0x3'));var router=express[_0x0bdc('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0bdc('0x5'));var interaction=require(_0x0bdc('0x6'));var config=require(_0x0bdc('0x7'));var controller=require('./intDynamics365Account.controller');router[_0x0bdc('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0bdc('0x8')]('/:id',auth[_0x0bdc('0x9')](),controller[_0x0bdc('0xa')]);router[_0x0bdc('0x8')]('/:id/configurations',auth[_0x0bdc('0x9')](),controller[_0x0bdc('0xb')]);router[_0x0bdc('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0x0bdc('0xc')]);router[_0x0bdc('0xd')]('/',auth[_0x0bdc('0x9')](),controller[_0x0bdc('0xe')]);router['post'](_0x0bdc('0xf'),auth[_0x0bdc('0x9')](),controller[_0x0bdc('0x10')]);router['put'](_0x0bdc('0x11'),auth[_0x0bdc('0x9')](),controller[_0x0bdc('0x12')]);router[_0x0bdc('0x13')]('/:id',auth[_0x0bdc('0x9')](),controller[_0x0bdc('0x14')]);module['exports']=router; \ No newline at end of file +var _0x2e67=['./intDynamics365Account.controller','get','/:id','isAuthenticated','show','/:id/configurations','getFields','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x4adf48,_0x43a2e3){var _0x2499d7=function(_0x582896){while(--_0x582896){_0x4adf48['push'](_0x4adf48['shift']());}};_0x2499d7(++_0x43a2e3);}(_0x2e67,0xac));var _0x72e6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2e67[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x72e6('0x0'));var util=require(_0x72e6('0x1'));var path=require(_0x72e6('0x2'));var timeout=require('connect-timeout');var express=require(_0x72e6('0x3'));var router=express[_0x72e6('0x4')]();var fs_extra=require(_0x72e6('0x5'));var auth=require(_0x72e6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x72e6('0x7'));var controller=require(_0x72e6('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x72e6('0x9')](_0x72e6('0xa'),auth[_0x72e6('0xb')](),controller[_0x72e6('0xc')]);router['get'](_0x72e6('0xd'),auth[_0x72e6('0xb')](),controller['getConfigurations']);router['get']('/:id/fields',auth[_0x72e6('0xb')](),controller[_0x72e6('0xe')]);router[_0x72e6('0xf')]('/',auth['isAuthenticated'](),controller[_0x72e6('0x10')]);router['post'](_0x72e6('0xd'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x72e6('0x11')](_0x72e6('0xa'),auth[_0x72e6('0xb')](),controller['update']);router['delete'](_0x72e6('0xa'),auth[_0x72e6('0xb')](),controller[_0x72e6('0x12')]);module[_0x72e6('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index f5a8b93..6a487a5 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 _0x9402=['exports','STRING','sequelize'];(function(_0x377f0a,_0x33817a){var _0x31c810=function(_0x11863c){while(--_0x11863c){_0x377f0a['push'](_0x377f0a['shift']());}};_0x31c810(++_0x33817a);}(_0x9402,0x14f));var _0x2940=function(_0x363622,_0x59a8c5){_0x363622=_0x363622-0x0;var _0x32315c=_0x9402[_0x363622];return _0x32315c;};'use strict';var Sequelize=require(_0x2940('0x0'));module[_0x2940('0x1')]={'name':{'type':Sequelize[_0x2940('0x2')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x2940('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0x2940('0x2')]},'clientId':{'type':Sequelize[_0x2940('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x2940('0x2')]}}; \ No newline at end of file +var _0x6d60=['exports','STRING','sequelize'];(function(_0x5b10aa,_0xd1d127){var _0x528daf=function(_0x21957b){while(--_0x21957b){_0x5b10aa['push'](_0x5b10aa['shift']());}};_0x528daf(++_0xd1d127);}(_0x6d60,0x16a));var _0x06d6=function(_0x26d386,_0x1660c0){_0x26d386=_0x26d386-0x0;var _0x4ef9a8=_0x6d60[_0x26d386];return _0x4ef9a8;};'use strict';var Sequelize=require(_0x06d6('0x0'));module[_0x06d6('0x1')]={'name':{'type':Sequelize[_0x06d6('0x2')]},'username':{'type':Sequelize[_0x06d6('0x2')]},'password':{'type':Sequelize[_0x06d6('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0x06d6('0x2')]},'clientId':{'type':Sequelize[_0x06d6('0x2')]},'clientSecret':{'type':Sequelize[_0x06d6('0x2')]},'serverUrl':{'type':Sequelize[_0x06d6('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x06d6('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index f854c79..460e012 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 _0x39b3=['true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','Bearer\x20','eml-format','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','then','destroy','error','stack','name','send','index','map','Dynamics365Account','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','getConfigurations','findOne','hasOwnProperty','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','incident','Incident','title','description','customerid','ownerid','caseorigincode','phonenumber','accountidname','accountidyominame','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyyominame','createdbyyominame','createdon','createdonbehalfbyyominame','customeridtype','customeridyominame','entityimage_timestamp','escalatedon','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','statecode','statuscode','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','versionnumber','concat','username','remoteUri','clientId','clientSecret','slice','substring','lastIndexOf','%s/api/data/v9.0/','POST','tenantId','/oauth2/token','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','LogicalName','forEach','@odata.type','all','isNil','BooleanAttributeMetadata','push','StringAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','test','statusCode','Wrong\x20credentials',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','UserLocalizedLabel','Label','Value','DisplayName',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','TrueOption'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0x39b3,0xc9));var _0x339b=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x39b3[_0x2763f2];return _0x3ef471;};'use strict';var emlformat=require(_0x339b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x339b('0x1'));var rp=require('request-promise');var moment=require(_0x339b('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x339b('0x3'));var util=require(_0x339b('0x4'));var path=require(_0x339b('0x5'));var sox=require(_0x339b('0x6'));var csv=require(_0x339b('0x7'));var ejs=require(_0x339b('0x8'));var fs=require('fs');var fs_extra=require(_0x339b('0x9'));var _=require(_0x339b('0xa'));var squel=require(_0x339b('0xb'));var crypto=require(_0x339b('0xc'));var jsforce=require(_0x339b('0xd'));var deskjs=require(_0x339b('0xe'));var toCsv=require(_0x339b('0x7'));var querystring=require(_0x339b('0xf'));var Papa=require(_0x339b('0x10'));var Redis=require(_0x339b('0x11'));var authService=require(_0x339b('0x12'));var qs=require(_0x339b('0x13'));var as=require(_0x339b('0x14'));var hardwareService=require(_0x339b('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x339b('0x16'));var db=require(_0x339b('0x17'))['db'];var integrations=require(_0x339b('0x18'));function respondWithStatusCode(_0x6dbe0f,_0x58d0fc){_0x58d0fc=_0x58d0fc||0xcc;return function(_0x31e38b){if(_0x31e38b){return _0x6dbe0f[_0x339b('0x19')](_0x58d0fc);}return _0x6dbe0f[_0x339b('0x1a')](_0x58d0fc)[_0x339b('0x1b')]();};}function respondWithResult(_0x494be9,_0x4f5bd6){_0x4f5bd6=_0x4f5bd6||0xc8;return function(_0x47cb4d){if(_0x47cb4d){return _0x494be9[_0x339b('0x1a')](_0x4f5bd6)[_0x339b('0x1c')](_0x47cb4d);}};}function respondWithFilteredResult(_0x497a52,_0x362305){return function(_0x5b3b00){if(_0x5b3b00){var _0x535405=typeof _0x362305[_0x339b('0x1d')]===_0x339b('0x1e')&&typeof _0x362305[_0x339b('0x1f')]===_0x339b('0x1e');var _0x259203=_0x5b3b00['count'];var _0x457919=_0x535405?0x0:_0x362305[_0x339b('0x1d')];var _0x3e6445=_0x535405?_0x5b3b00[_0x339b('0x20')]:_0x362305[_0x339b('0x1d')]+_0x362305['limit'];var _0x3e1d5d;if(_0x3e6445>=_0x259203){_0x3e6445=_0x259203;_0x3e1d5d=0xc8;}else{_0x3e1d5d=0xce;}_0x497a52[_0x339b('0x1a')](_0x3e1d5d);return _0x497a52[_0x339b('0x21')]('Content-Range',_0x457919+'-'+_0x3e6445+'/'+_0x259203)[_0x339b('0x1c')](_0x5b3b00);}return null;};}function patchUpdates(_0x108454){return function(_0x49ca22){try{jsonpatch[_0x339b('0x22')](_0x49ca22,_0x108454,!![]);}catch(_0x28bd77){return BPromise[_0x339b('0x23')](_0x28bd77);}return _0x49ca22['save']();};}function saveUpdates(_0x1465b5,_0x50d720){return function(_0x2cc10d){if(_0x2cc10d){return _0x2cc10d['update'](_0x1465b5)[_0x339b('0x24')](function(_0x43ab06){return _0x43ab06;});}return null;};}function removeEntity(_0x469683,_0xbed408){return function(_0x141e68){if(_0x141e68){return _0x141e68[_0x339b('0x25')]()[_0x339b('0x24')](function(){_0x469683[_0x339b('0x1a')](0xcc)[_0x339b('0x1b')]();});}};}function handleEntityNotFound(_0x482ca1,_0x4315ea){return function(_0x51c083){if(!_0x51c083){_0x482ca1[_0x339b('0x19')](0x194);}return _0x51c083;};}function handleError(_0x298857,_0x2722b7){_0x2722b7=_0x2722b7||0x1f4;return function(_0x55fe99){logger[_0x339b('0x26')](_0x55fe99[_0x339b('0x27')]);if(_0x55fe99[_0x339b('0x28')]){delete _0x55fe99[_0x339b('0x28')];}_0x298857['status'](_0x2722b7)[_0x339b('0x29')](_0x55fe99);};}exports[_0x339b('0x2a')]=function(_0x4e36da,_0x19df3b){var _0x5bd485={},_0x60e2a1={},_0x27c8c9={'count':0x0,'rows':[]};var _0x5cc530=_[_0x339b('0x2b')](db[_0x339b('0x2c')]['rawAttributes'],function(_0x975dec){return{'name':_0x975dec['fieldName'],'type':_0x975dec[_0x339b('0x2d')][_0x339b('0x2e')]};});_0x60e2a1[_0x339b('0x2f')]=_[_0x339b('0x2b')](_0x5cc530,_0x339b('0x28'));_0x60e2a1[_0x339b('0x30')]=_[_0x339b('0x31')](_0x4e36da[_0x339b('0x30')]);_0x60e2a1[_0x339b('0x32')]=_[_0x339b('0x33')](_0x60e2a1[_0x339b('0x2f')],_0x60e2a1['query']);_0x5bd485[_0x339b('0x34')]=_['intersection'](_0x60e2a1['model'],qs[_0x339b('0x35')](_0x4e36da[_0x339b('0x30')]['fields']));_0x5bd485[_0x339b('0x34')]=_0x5bd485[_0x339b('0x34')][_0x339b('0x36')]?_0x5bd485[_0x339b('0x34')]:_0x60e2a1[_0x339b('0x2f')];if(!_0x4e36da[_0x339b('0x30')]['hasOwnProperty'](_0x339b('0x37'))){_0x5bd485['limit']=qs[_0x339b('0x1f')](_0x4e36da[_0x339b('0x30')]['limit']);_0x5bd485[_0x339b('0x1d')]=qs['offset'](_0x4e36da[_0x339b('0x30')][_0x339b('0x1d')]);}_0x5bd485[_0x339b('0x38')]=qs[_0x339b('0x39')](_0x4e36da[_0x339b('0x30')][_0x339b('0x39')]);_0x5bd485['where']=qs['filters'](_[_0x339b('0x3a')](_0x4e36da[_0x339b('0x30')],_0x60e2a1[_0x339b('0x32')]),_0x5cc530);if(_0x4e36da[_0x339b('0x30')][_0x339b('0x3b')]){_0x5bd485[_0x339b('0x3c')]=_['merge'](_0x5bd485[_0x339b('0x3c')],{'$or':_['map'](_0x5cc530,function(_0xecd33a){if(_0xecd33a[_0x339b('0x2d')]!=='VIRTUAL'){var _0x13a393={};_0x13a393[_0xecd33a[_0x339b('0x28')]]={'$like':'%'+_0x4e36da[_0x339b('0x30')][_0x339b('0x3b')]+'%'};return _0x13a393;}})});}_0x5bd485=_[_0x339b('0x3d')]({},_0x5bd485,_0x4e36da[_0x339b('0x3e')]);var _0x29ba8d={'where':_0x5bd485[_0x339b('0x3c')]};return db['Dynamics365Account'][_0x339b('0x20')](_0x29ba8d)[_0x339b('0x24')](function(_0x21a7d4){_0x27c8c9[_0x339b('0x20')]=_0x21a7d4;if(_0x4e36da[_0x339b('0x30')][_0x339b('0x3f')]){_0x5bd485[_0x339b('0x40')]=[{'all':!![]}];}return db[_0x339b('0x2c')][_0x339b('0x41')](_0x5bd485);})[_0x339b('0x24')](function(_0x2f6052){_0x27c8c9[_0x339b('0x42')]=_0x2f6052;return _0x27c8c9;})[_0x339b('0x24')](respondWithFilteredResult(_0x19df3b,_0x5bd485))[_0x339b('0x43')](handleError(_0x19df3b,null));};exports[_0x339b('0x44')]=function(_0x159ad7,_0x3fe3b2){var _0x161d29={'raw':![],'where':{'id':_0x159ad7[_0x339b('0x45')]['id']}},_0x8ac2b2={};_0x8ac2b2['model']=_[_0x339b('0x31')](db[_0x339b('0x2c')][_0x339b('0x46')]);_0x8ac2b2[_0x339b('0x30')]=_[_0x339b('0x31')](_0x159ad7[_0x339b('0x30')]);_0x8ac2b2[_0x339b('0x32')]=_['intersection'](_0x8ac2b2[_0x339b('0x2f')],_0x8ac2b2[_0x339b('0x30')]);_0x161d29[_0x339b('0x34')]=_['intersection'](_0x8ac2b2['model'],qs[_0x339b('0x35')](_0x159ad7[_0x339b('0x30')][_0x339b('0x35')]));_0x161d29[_0x339b('0x34')]=_0x161d29[_0x339b('0x34')][_0x339b('0x36')]?_0x161d29[_0x339b('0x34')]:_0x8ac2b2['model'];if(_0x159ad7[_0x339b('0x30')][_0x339b('0x3f')]){_0x161d29[_0x339b('0x40')]=[{'all':!![]}];}_0x161d29=_[_0x339b('0x3d')]({},_0x161d29,_0x159ad7[_0x339b('0x3e')]);return db[_0x339b('0x2c')][_0x339b('0x47')](_0x161d29)[_0x339b('0x24')](handleEntityNotFound(_0x3fe3b2,null))[_0x339b('0x24')](respondWithResult(_0x3fe3b2,null))['catch'](handleError(_0x3fe3b2,null));};exports['create']=function(_0x23caff,_0x2975f6){return db['Dynamics365Account'][_0x339b('0x48')](_0x23caff[_0x339b('0x49')],{})[_0x339b('0x24')](respondWithResult(_0x2975f6,0xc9))[_0x339b('0x43')](handleError(_0x2975f6,null));};exports['update']=function(_0x48beb1,_0x2f484d){if(_0x48beb1[_0x339b('0x49')]['id']){delete _0x48beb1['body']['id'];}return db[_0x339b('0x2c')]['find']({'where':{'id':_0x48beb1[_0x339b('0x45')]['id']}})[_0x339b('0x24')](handleEntityNotFound(_0x2f484d,null))[_0x339b('0x24')](saveUpdates(_0x48beb1[_0x339b('0x49')],null))['then'](respondWithResult(_0x2f484d,null))[_0x339b('0x43')](handleError(_0x2f484d,null));};exports[_0x339b('0x25')]=function(_0xc3008e,_0x5ec44a){return db[_0x339b('0x2c')][_0x339b('0x47')]({'where':{'id':_0xc3008e[_0x339b('0x45')]['id']}})[_0x339b('0x24')](handleEntityNotFound(_0x5ec44a,null))[_0x339b('0x24')](removeEntity(_0x5ec44a,null))[_0x339b('0x43')](handleError(_0x5ec44a,null));};exports[_0x339b('0x4a')]=function(_0x2bd743,_0x4a8b0b,_0x2ad92c){var _0x230f62={};var _0x23823f={};var _0x1faf63;var _0x500ef2;return db['Dynamics365Account'][_0x339b('0x4b')]({'where':{'id':_0x2bd743[_0x339b('0x45')]['id']}})[_0x339b('0x24')](handleEntityNotFound(_0x4a8b0b,null))[_0x339b('0x24')](function(_0x34b4f6){if(_0x34b4f6){_0x1faf63=_0x34b4f6;_0x23823f['model']=_[_0x339b('0x31')](db['Dynamics365Configuration'][_0x339b('0x46')]);_0x23823f['query']=_[_0x339b('0x31')](_0x2bd743['query']);_0x23823f[_0x339b('0x32')]=_[_0x339b('0x33')](_0x23823f['model'],_0x23823f[_0x339b('0x30')]);_0x230f62['attributes']=_[_0x339b('0x33')](_0x23823f['model'],qs[_0x339b('0x35')](_0x2bd743[_0x339b('0x30')][_0x339b('0x35')]));_0x230f62[_0x339b('0x34')]=_0x230f62[_0x339b('0x34')]['length']?_0x230f62[_0x339b('0x34')]:_0x23823f[_0x339b('0x2f')];_0x230f62[_0x339b('0x38')]=qs['sort'](_0x2bd743['query']['sort']);_0x230f62['where']=qs[_0x339b('0x32')](_[_0x339b('0x3a')](_0x2bd743[_0x339b('0x30')],_0x23823f[_0x339b('0x32')]));if(_0x2bd743[_0x339b('0x30')][_0x339b('0x3b')]){_0x230f62[_0x339b('0x3c')]=_['merge'](_0x230f62[_0x339b('0x3c')],{'$or':_[_0x339b('0x2b')](_0x230f62[_0x339b('0x34')],function(_0x1d2e8e){var _0x4d5ba0={};_0x4d5ba0[_0x1d2e8e]={'$like':'%'+_0x2bd743[_0x339b('0x30')][_0x339b('0x3b')]+'%'};return _0x4d5ba0;})});}_0x230f62=_[_0x339b('0x3d')]({},_0x230f62,_0x2bd743[_0x339b('0x3e')]);return _0x1faf63[_0x339b('0x4a')](_0x230f62);}})['then'](function(_0x3da336){if(_0x3da336){_0x500ef2=_0x3da336['length'];if(!_0x2bd743[_0x339b('0x30')][_0x339b('0x4c')]('nolimit')){_0x230f62['limit']=qs[_0x339b('0x1f')](_0x2bd743[_0x339b('0x30')][_0x339b('0x1f')]);_0x230f62[_0x339b('0x1d')]=qs['offset'](_0x2bd743[_0x339b('0x30')][_0x339b('0x1d')]);}return _0x1faf63['getConfigurations'](_0x230f62);}})['then'](function(_0x1ee52f){if(_0x1ee52f){return _0x1ee52f?{'count':_0x500ef2,'rows':_0x1ee52f}:null;}})[_0x339b('0x24')](respondWithResult(_0x4a8b0b,null))[_0x339b('0x43')](handleError(_0x4a8b0b,null));};exports['addConfiguration']=function(_0x5adff6,_0x1af60f,_0x5e91ce){if(_0x5adff6[_0x339b('0x49')]['id']){delete _0x5adff6['body']['id'];}return db[_0x339b('0x2c')][_0x339b('0x4b')]({'where':{'id':_0x5adff6[_0x339b('0x45')]['id']}})[_0x339b('0x24')](handleEntityNotFound(_0x1af60f,null))[_0x339b('0x24')](function(_0x54c490){if(_0x54c490){_0x5adff6[_0x339b('0x49')][_0x339b('0x4d')]=_0x54c490['id'];_0x5adff6['body'][_0x339b('0x4e')]=integrations[_0x339b('0x4f')](_0x5adff6[_0x339b('0x49')][_0x339b('0x50')],_0x5adff6[_0x339b('0x49')]['type']);_0x5adff6[_0x339b('0x49')][_0x339b('0x51')]=integrations[_0x339b('0x52')](_0x5adff6[_0x339b('0x49')][_0x339b('0x50')],_0x5adff6['body'][_0x339b('0x2d')]);return db['Dynamics365Configuration']['create'](_0x5adff6['body'],{'include':[{'model':db['Dynamics365Field'],'as':_0x339b('0x4e')},{'model':db[_0x339b('0x53')],'as':'Descriptions'}]});}return null;})[_0x339b('0x24')](respondWithResult(_0x1af60f,null))[_0x339b('0x43')](handleError(_0x1af60f,null));};exports['getFields']=function(_0x500e51,_0x6d245,_0x4429ef){var _0x2a3c0b=_0x500e51[_0x339b('0x30')]['ticketType'];var _0xc6faa5=_0x2a3c0b===_0x339b('0x54')?_0x339b('0x55'):'PhoneCall';var _0x279c66='';var _0x3f34b7='';var _0x513a0b='';var _0x1c4e54='';var _0x1b048a='';var _0x3e5dfa='';var _0x5dfab5='';var _0x5d82fa='';var _0xaf413a=[_0x339b('0x56'),_0x339b('0x57'),_0x339b('0x58'),_0x339b('0x59'),_0x339b('0x5a'),'subject',_0x339b('0x5b'),'regardingobjectid','directioncode','phonecall_activity_parties'];var _0x2a8d03=[_0x339b('0x5c'),_0x339b('0x5d'),'actualserviceunits',_0x339b('0x5e'),_0x339b('0x5f'),_0x339b('0x60'),_0x339b('0x61'),_0x339b('0x62'),'createdbyexternalpartyname',_0x339b('0x63'),'createdbyname',_0x339b('0x64'),_0x339b('0x65'),'createdonbehalfbyname',_0x339b('0x66'),'customeridname',_0x339b('0x67'),_0x339b('0x68'),'emailaddress','entitlementidname',_0x339b('0x69'),'entityimage_url',_0x339b('0x6a'),'exchangerate','firstresponsebykpiidname',_0x339b('0x6b'),_0x339b('0x6c'),_0x339b('0x6d'),_0x339b('0x6e'),_0x339b('0x6f'),_0x339b('0x70'),_0x339b('0x71'),'modifiedbyexternalpartyyominame','modifiedbyname',_0x339b('0x72'),_0x339b('0x73'),_0x339b('0x74'),_0x339b('0x75'),_0x339b('0x76'),'msdyn_iotalertname',_0x339b('0x77'),_0x339b('0x78'),_0x339b('0x79'),_0x339b('0x7a'),'owneridtype',_0x339b('0x7b'),_0x339b('0x7c'),_0x339b('0x7d'),_0x339b('0x7e'),'prioritycodename','productidname','productserialnumber',_0x339b('0x7f'),_0x339b('0x80'),_0x339b('0x81'),_0x339b('0x82'),_0x339b('0x83'),_0x339b('0x84'),_0x339b('0x85'),_0x339b('0x86'),'socialprofileidname',_0x339b('0x87'),_0x339b('0x88'),'subjectidname',_0x339b('0x89'),_0x339b('0x8a'),_0x339b('0x8b'),_0x339b('0x8c'),'utcconversiontimezonecode',_0x339b('0x8d')];var _0x3538f2=_0xaf413a[_0x339b('0x8e')](_0x2a8d03);return db['Dynamics365Account'][_0x339b('0x4b')]({'where':{'id':_0x500e51['params']['id']},'attributes':['id',_0x339b('0x8f'),'password',_0x339b('0x90'),'tenantId',_0x339b('0x91'),_0x339b('0x92')]})[_0x339b('0x24')](handleEntityNotFound(_0x6d245,null))[_0x339b('0x24')](function(_0x4a9603){if(_0x4a9603){_0x5d82fa=_0x4a9603[_0x339b('0x90')];var _0x471b91=_0x5d82fa[_0x339b('0x93')](-0x1);if(_0x471b91==='/'){_0x5d82fa=_0x5d82fa[_0x339b('0x94')](0x0,_0x5d82fa[_0x339b('0x95')](_0x471b91));}_0x5dfab5=util['format'](_0x339b('0x96'),_0x5d82fa);var _0x36b61c={'method':_0x339b('0x97'),'uri':'https://login.microsoftonline.com/'+_0x4a9603[_0x339b('0x98')]+_0x339b('0x99'),'form':{'client_id':_0x4a9603[_0x339b('0x91')],'resource':_0x5d82fa,'username':_0x4a9603[_0x339b('0x8f')],'password':_0x4a9603['password'],'grant_type':'password','client_secret':_0x4a9603[_0x339b('0x92')]},'json':!![]};return rp(_0x36b61c);}})['then'](function(_0x24543d){_0x3e5dfa=_0x24543d[_0x339b('0x9a')];var _0x1d1b7e={'method':_0x339b('0x9b'),'uri':encodeURI(_0x5dfab5+_0x339b('0x9c')+_0xc6faa5+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x3e5dfa,'If-None-Match':null,'OData-Version':_0x339b('0x9d')},'json':!![]};return rp(_0x1d1b7e);})[_0x339b('0x24')](function(_0x169286){var _0x342aa7=_0x169286['value'][0x0];var _0x184de7=_0x342aa7[_0x339b('0x9e')];var _0x792af0={'method':_0x339b('0x9b'),'uri':_0x5dfab5+_0x339b('0x9f')+_0x184de7+_0x339b('0xa0'),'headers':{'Authorization':'Bearer\x20'+_0x3e5dfa,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x792af0);})[_0x339b('0x24')](function(_0x371497){_0x279c66=_0x371497;_0x3f34b7=_0x279c66[_0x339b('0xa1')];_0x3f34b7=_[_0x339b('0xa2')](_0x3f34b7,function(_0x407aec){return!_0x3538f2['includes'](_0x407aec[_0x339b('0xa3')]);});var _0x373b63=[];var _0x2c11cd=[];_0x3f34b7[_0x339b('0xa4')](function(_0x416c81){if(_0x416c81[_0x339b('0xa5')]){var _0x5899da=_0x416c81[_0x339b('0xa5')]['substring'](_0x416c81[_0x339b('0xa5')][_0x339b('0x95')]('.')+0x1);if(_0x5899da==='PicklistAttributeMetadata'){_0x373b63['push'](getSelectList(_0x5dfab5,_0x2a3c0b,_0x2c11cd,_0x279c66[_0x339b('0x9e')],_0x416c81[_0x339b('0x9e')],_0x3e5dfa));}}});return Promise[_0x339b('0xa6')](_0x373b63);})[_0x339b('0x24')](function(_0x20ae13){_0x513a0b=_0x20ae13[0x0];var _0x4a8961=[];var _0x2312c4=[];_0x3f34b7[_0x339b('0xa4')](function(_0x5cd7f8){if(!_[_0x339b('0xa7')](_0x5cd7f8['@odata.type'])){var _0x568414=_0x5cd7f8['@odata.type']['substring'](_0x5cd7f8['@odata.type'][_0x339b('0x95')]('.')+0x1);if(_0x568414===_0x339b('0xa8')){_0x4a8961[_0x339b('0xa9')](getBooleanList(_0x5dfab5,_0x2a3c0b,_0x2312c4,_0x279c66[_0x339b('0x9e')],_0x5cd7f8[_0x339b('0x9e')],_0x3e5dfa));}}});return Promise[_0x339b('0xa6')](_0x4a8961);})[_0x339b('0x24')](function(_0x5a2da2){_0x1c4e54=_0x5a2da2[0x0];var _0x1d59df=[];var _0x1a2caa=[];_0x3f34b7[_0x339b('0xa4')](function(_0x51a6ab){if(_0x51a6ab[_0x339b('0xa5')]){var _0x9fa35=_0x51a6ab['@odata.type'][_0x339b('0x94')](_0x51a6ab[_0x339b('0xa5')][_0x339b('0x95')]('.')+0x1);if(_0x9fa35===_0x339b('0xaa')||_0x9fa35==='DoubleAttributeMetadata'||_0x9fa35===_0x339b('0xab')||_0x9fa35===_0x339b('0xac')||_0x9fa35===_0x339b('0xad')||_0x9fa35===_0x339b('0xae')||_0x9fa35===_0x339b('0xaf')||_0x9fa35===_0x339b('0xb0')||_0x9fa35==='StateAttributeMetadata'||_0x9fa35==='DecimalAttributeMetadata'){_0x1d59df[_0x339b('0xa9')](getInputList(_0x5dfab5,_0x2a3c0b,_0x9fa35,_0x1a2caa,_0x279c66[_0x339b('0x9e')],_0x51a6ab[_0x339b('0x9e')],_0x3e5dfa));}}});return Promise[_0x339b('0xa6')](_0x1d59df);})[_0x339b('0x24')](function(_0x26518a){_0x1b048a=_0x26518a[0x0];var _0x367b00=_0x513a0b[_0x339b('0x8e')](_0x1c4e54)[_0x339b('0x8e')](_0x1b048a);var _0x19b43a={'count':_0x367b00[_0x339b('0x36')],'rows':_0x367b00};return _0x19b43a;})['then'](respondWithResult(_0x6d245,null))['catch'](function(_0x67e090){var _0x1d0097=_0x500e51[_0x339b('0x30')][_0x339b('0xb1')]?0x1f4:_0x67e090[_0x339b('0xb2')]||0x1f4;logger[_0x339b('0x26')](_0x67e090[_0x339b('0x27')]);delete _0x67e090['name'];if(_0x1d0097===0x191){_0x1d0097=0x190;}_0x6d245['status'](_0x1d0097)['send'](_0x500e51[_0x339b('0x30')][_0x339b('0xb1')]?{'message':_0x339b('0xb3'),'statusCode':_0x67e090[_0x339b('0xb2')]}:_0x67e090);});};function getSelectList(_0x2a5223,_0x28e385,_0x2175e4,_0x3cc4ea,_0x2baa76,_0x127305){var _0x4716d2={'method':_0x339b('0x9b'),'uri':_0x2a5223+_0x339b('0x9f')+_0x3cc4ea+')/Attributes('+_0x2baa76+_0x339b('0xb4')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':'Bearer\x20'+_0x127305,'If-None-Match':null,'OData-Version':_0x339b('0x9d')},'json':!![]};return rp(_0x4716d2)[_0x339b('0x24')](function(_0x21515c){var _0x14bbb8=[];var _0x5ab747=_0x21515c['OptionSet']['Options'];_0x5ab747[_0x339b('0xa4')](function(_0x1bc460){_0x14bbb8['push']({'name':_0x1bc460['Label'][_0x339b('0xb5')][_0x339b('0xb6')],'value':String(_0x1bc460[_0x339b('0xb7')])});});var _0x56d8fc={'id':_0x28e385+'_'+_0x21515c[_0x339b('0xa3')],'name':_0x21515c[_0x339b('0xb8')][_0x339b('0xb5')][_0x339b('0xb6')],'custom':![],'options':_0x14bbb8};_0x2175e4[_0x339b('0xa9')](_0x56d8fc);return _0x2175e4;});}function getBooleanList(_0x35096d,_0x2946ab,_0x4affe0,_0x40c2ad,_0x222ab1,_0x5f01f6){var _0x337345={'method':_0x339b('0x9b'),'uri':_0x35096d+_0x339b('0x9f')+_0x40c2ad+_0x339b('0xb9')+_0x222ab1+_0x339b('0xba'),'headers':{'Authorization':'Bearer\x20'+_0x5f01f6,'If-None-Match':null,'OData-Version':_0x339b('0x9d')},'json':!![]};return rp(_0x337345)[_0x339b('0x24')](function(_0x1779af){var _0x23e983=[];_0x23e983[_0x339b('0xa9')]({'name':_0x1779af[_0x339b('0xbb')][_0x339b('0xbc')][_0x339b('0xb6')]['UserLocalizedLabel'][_0x339b('0xb6')],'value':_0x339b('0xbd')},{'name':_0x1779af['OptionSet'][_0x339b('0xbe')][_0x339b('0xb6')][_0x339b('0xb5')][_0x339b('0xb6')],'value':_0x339b('0xbf')});var _0x295aee={'id':_0x2946ab+'_'+_0x1779af[_0x339b('0xa3')],'name':_0x1779af['DisplayName'][_0x339b('0xb5')][_0x339b('0xb6')],'custom':![],'options':_0x23e983};_0x4affe0[_0x339b('0xa9')](_0x295aee);return _0x4affe0;});}function getInputList(_0x1d53d6,_0x5cfa5a,_0x55628c,_0x29a8d4,_0x3942b5,_0x2c8753,_0xe3e685){var _0x2b0f48={'method':_0x339b('0x9b'),'uri':_0x1d53d6+'EntityDefinitions('+_0x3942b5+_0x339b('0xb9')+_0x2c8753+_0x339b('0xc0')+_0x55628c+_0x339b('0xc1'),'headers':{'Authorization':_0x339b('0xc2')+_0xe3e685,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2b0f48)[_0x339b('0x24')](function(_0x58d5bc){var _0x38a23f={'id':_0x5cfa5a+'_'+_0x58d5bc[_0x339b('0xa3')],'name':_0x58d5bc[_0x339b('0xb8')][_0x339b('0xb5')]?_0x58d5bc['DisplayName'][_0x339b('0xb5')][_0x339b('0xb6')]:_0x58d5bc[_0x339b('0xa3')],'custom':![],'options':[]};_0x29a8d4['push'](_0x38a23f);return _0x29a8d4;});} \ No newline at end of file +var _0x269f=['StringAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','test','statusCode','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName','EntityDefinitions(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false','?$select=DisplayName,LogicalName','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','reject','update','then','error','stack','name','index','map','Dynamics365Account','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','destroy','getConfigurations','findOne','Dynamics365Configuration','pick','AccountId','getSubjects','channel','Dynamics365Field','Descriptions','getFields','ticketType','PhoneCall','title','description','customerid','ownerid','caseorigincode','subject','phonenumber','directioncode','phonecall_activity_parties','accountidname','accountidyominame','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyname','createdbyyominame','createdon','createdonbehalfbyyominame','customeridname','customeridyominame','entitlementidname','entityimage_timestamp','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','ticketnumber','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','versionnumber','password','remoteUri','tenantId','clientSecret','slice','lastIndexOf','format','%s/api/data/v9.0/','POST','/oauth2/token','clientId','username','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','LogicalName','forEach','@odata.type','substring','PicklistAttributeMetadata','push','isNil','BooleanAttributeMetadata','all'];(function(_0x39b7f5,_0x30021e){var _0x572eee=function(_0x5dc28c){while(--_0x5dc28c){_0x39b7f5['push'](_0x39b7f5['shift']());}};_0x572eee(++_0x30021e);}(_0x269f,0xee));var _0xf269=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x269f[_0x413feb];return _0x40ee88;};'use strict';var emlformat=require(_0xf269('0x0'));var rimraf=require(_0xf269('0x1'));var zipdir=require(_0xf269('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf269('0x3'));var moment=require('moment');var BPromise=require(_0xf269('0x4'));var Mustache=require(_0xf269('0x5'));var util=require(_0xf269('0x6'));var path=require(_0xf269('0x7'));var sox=require(_0xf269('0x8'));var csv=require('to-csv');var ejs=require(_0xf269('0x9'));var fs=require('fs');var fs_extra=require(_0xf269('0xa'));var _=require(_0xf269('0xb'));var squel=require(_0xf269('0xc'));var crypto=require(_0xf269('0xd'));var jsforce=require(_0xf269('0xe'));var deskjs=require(_0xf269('0xf'));var toCsv=require('to-csv');var querystring=require(_0xf269('0x10'));var Papa=require(_0xf269('0x11'));var Redis=require(_0xf269('0x12'));var authService=require(_0xf269('0x13'));var qs=require(_0xf269('0x14'));var as=require(_0xf269('0x15'));var hardwareService=require(_0xf269('0x16'));var logger=require(_0xf269('0x17'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xf269('0x18'));function respondWithStatusCode(_0x36504a,_0x396a75){_0x396a75=_0x396a75||0xcc;return function(_0x4d130e){if(_0x4d130e){return _0x36504a[_0xf269('0x19')](_0x396a75);}return _0x36504a[_0xf269('0x1a')](_0x396a75)[_0xf269('0x1b')]();};}function respondWithResult(_0x34912d,_0x3e6198){_0x3e6198=_0x3e6198||0xc8;return function(_0x1316bd){if(_0x1316bd){return _0x34912d[_0xf269('0x1a')](_0x3e6198)[_0xf269('0x1c')](_0x1316bd);}};}function respondWithFilteredResult(_0xfc8d78,_0x2a240a){return function(_0x31201c){if(_0x31201c){var _0xa00717=typeof _0x2a240a[_0xf269('0x1d')]===_0xf269('0x1e')&&typeof _0x2a240a[_0xf269('0x1f')]===_0xf269('0x1e');var _0x2198f2=_0x31201c[_0xf269('0x20')];var _0x5f5ba0=_0xa00717?0x0:_0x2a240a[_0xf269('0x1d')];var _0x3348a7=_0xa00717?_0x31201c['count']:_0x2a240a['offset']+_0x2a240a[_0xf269('0x1f')];var _0x575352;if(_0x3348a7>=_0x2198f2){_0x3348a7=_0x2198f2;_0x575352=0xc8;}else{_0x575352=0xce;}_0xfc8d78[_0xf269('0x1a')](_0x575352);return _0xfc8d78['set']('Content-Range',_0x5f5ba0+'-'+_0x3348a7+'/'+_0x2198f2)['json'](_0x31201c);}return null;};}function patchUpdates(_0x1d1847){return function(_0x26b46a){try{jsonpatch['apply'](_0x26b46a,_0x1d1847,!![]);}catch(_0x2cb234){return BPromise[_0xf269('0x21')](_0x2cb234);}return _0x26b46a['save']();};}function saveUpdates(_0x9c9c7a,_0x328973){return function(_0x1d7374){if(_0x1d7374){return _0x1d7374[_0xf269('0x22')](_0x9c9c7a)[_0xf269('0x23')](function(_0x30d9b0){return _0x30d9b0;});}return null;};}function removeEntity(_0x4d9776,_0x9148c5){return function(_0x43b5f2){if(_0x43b5f2){return _0x43b5f2['destroy']()[_0xf269('0x23')](function(){_0x4d9776[_0xf269('0x1a')](0xcc)[_0xf269('0x1b')]();});}};}function handleEntityNotFound(_0x3ac6fc,_0x21e13f){return function(_0x4f639f){if(!_0x4f639f){_0x3ac6fc['sendStatus'](0x194);}return _0x4f639f;};}function handleError(_0x9f558d,_0x4087ef){_0x4087ef=_0x4087ef||0x1f4;return function(_0x2b724a){logger[_0xf269('0x24')](_0x2b724a[_0xf269('0x25')]);if(_0x2b724a[_0xf269('0x26')]){delete _0x2b724a[_0xf269('0x26')];}_0x9f558d['status'](_0x4087ef)['send'](_0x2b724a);};}exports[_0xf269('0x27')]=function(_0x3e9ab9,_0x261ccf){var _0x43d6b8={},_0x2ad8c3={},_0x3441df={'count':0x0,'rows':[]};var _0x3784c1=_[_0xf269('0x28')](db[_0xf269('0x29')][_0xf269('0x2a')],function(_0x22ba16){return{'name':_0x22ba16[_0xf269('0x2b')],'type':_0x22ba16['type']['key']};});_0x2ad8c3[_0xf269('0x2c')]=_['map'](_0x3784c1,_0xf269('0x26'));_0x2ad8c3[_0xf269('0x2d')]=_[_0xf269('0x2e')](_0x3e9ab9[_0xf269('0x2d')]);_0x2ad8c3['filters']=_[_0xf269('0x2f')](_0x2ad8c3[_0xf269('0x2c')],_0x2ad8c3[_0xf269('0x2d')]);_0x43d6b8[_0xf269('0x30')]=_[_0xf269('0x2f')](_0x2ad8c3[_0xf269('0x2c')],qs[_0xf269('0x31')](_0x3e9ab9[_0xf269('0x2d')][_0xf269('0x31')]));_0x43d6b8[_0xf269('0x30')]=_0x43d6b8['attributes'][_0xf269('0x32')]?_0x43d6b8[_0xf269('0x30')]:_0x2ad8c3['model'];if(!_0x3e9ab9['query'][_0xf269('0x33')](_0xf269('0x34'))){_0x43d6b8['limit']=qs[_0xf269('0x1f')](_0x3e9ab9[_0xf269('0x2d')]['limit']);_0x43d6b8[_0xf269('0x1d')]=qs[_0xf269('0x1d')](_0x3e9ab9[_0xf269('0x2d')]['offset']);}_0x43d6b8[_0xf269('0x35')]=qs[_0xf269('0x36')](_0x3e9ab9[_0xf269('0x2d')][_0xf269('0x36')]);_0x43d6b8[_0xf269('0x37')]=qs[_0xf269('0x38')](_['pick'](_0x3e9ab9[_0xf269('0x2d')],_0x2ad8c3[_0xf269('0x38')]),_0x3784c1);if(_0x3e9ab9[_0xf269('0x2d')][_0xf269('0x39')]){_0x43d6b8[_0xf269('0x37')]=_['merge'](_0x43d6b8[_0xf269('0x37')],{'$or':_[_0xf269('0x28')](_0x3784c1,function(_0x295348){if(_0x295348[_0xf269('0x3a')]!==_0xf269('0x3b')){var _0x3035f5={};_0x3035f5[_0x295348['name']]={'$like':'%'+_0x3e9ab9[_0xf269('0x2d')][_0xf269('0x39')]+'%'};return _0x3035f5;}})});}_0x43d6b8=_['merge']({},_0x43d6b8,_0x3e9ab9[_0xf269('0x3c')]);var _0x3c260a={'where':_0x43d6b8['where']};return db[_0xf269('0x29')][_0xf269('0x20')](_0x3c260a)[_0xf269('0x23')](function(_0x24154b){_0x3441df[_0xf269('0x20')]=_0x24154b;if(_0x3e9ab9[_0xf269('0x2d')][_0xf269('0x3d')]){_0x43d6b8[_0xf269('0x3e')]=[{'all':!![]}];}return db['Dynamics365Account'][_0xf269('0x3f')](_0x43d6b8);})[_0xf269('0x23')](function(_0xd752b6){_0x3441df[_0xf269('0x40')]=_0xd752b6;return _0x3441df;})[_0xf269('0x23')](respondWithFilteredResult(_0x261ccf,_0x43d6b8))[_0xf269('0x41')](handleError(_0x261ccf,null));};exports[_0xf269('0x42')]=function(_0x4b9d3d,_0x3610e2){var _0x34dd14={'raw':![],'where':{'id':_0x4b9d3d[_0xf269('0x43')]['id']}},_0x53e0a8={};_0x53e0a8[_0xf269('0x2c')]=_[_0xf269('0x2e')](db['Dynamics365Account'][_0xf269('0x2a')]);_0x53e0a8[_0xf269('0x2d')]=_[_0xf269('0x2e')](_0x4b9d3d[_0xf269('0x2d')]);_0x53e0a8[_0xf269('0x38')]=_[_0xf269('0x2f')](_0x53e0a8[_0xf269('0x2c')],_0x53e0a8[_0xf269('0x2d')]);_0x34dd14[_0xf269('0x30')]=_[_0xf269('0x2f')](_0x53e0a8[_0xf269('0x2c')],qs['fields'](_0x4b9d3d['query'][_0xf269('0x31')]));_0x34dd14[_0xf269('0x30')]=_0x34dd14[_0xf269('0x30')]['length']?_0x34dd14[_0xf269('0x30')]:_0x53e0a8[_0xf269('0x2c')];if(_0x4b9d3d[_0xf269('0x2d')][_0xf269('0x3d')]){_0x34dd14[_0xf269('0x3e')]=[{'all':!![]}];}_0x34dd14=_[_0xf269('0x44')]({},_0x34dd14,_0x4b9d3d[_0xf269('0x3c')]);return db[_0xf269('0x29')][_0xf269('0x45')](_0x34dd14)[_0xf269('0x23')](handleEntityNotFound(_0x3610e2,null))[_0xf269('0x23')](respondWithResult(_0x3610e2,null))[_0xf269('0x41')](handleError(_0x3610e2,null));};exports['create']=function(_0x5a4a59,_0x2b1769){return db[_0xf269('0x29')][_0xf269('0x46')](_0x5a4a59[_0xf269('0x47')],{})['then'](respondWithResult(_0x2b1769,0xc9))['catch'](handleError(_0x2b1769,null));};exports['update']=function(_0x1f1a65,_0x5629ab){if(_0x1f1a65[_0xf269('0x47')]['id']){delete _0x1f1a65[_0xf269('0x47')]['id'];}return db[_0xf269('0x29')][_0xf269('0x45')]({'where':{'id':_0x1f1a65[_0xf269('0x43')]['id']}})[_0xf269('0x23')](handleEntityNotFound(_0x5629ab,null))[_0xf269('0x23')](saveUpdates(_0x1f1a65['body'],null))[_0xf269('0x23')](respondWithResult(_0x5629ab,null))[_0xf269('0x41')](handleError(_0x5629ab,null));};exports[_0xf269('0x48')]=function(_0x9bb640,_0x164cdc){return db[_0xf269('0x29')][_0xf269('0x45')]({'where':{'id':_0x9bb640[_0xf269('0x43')]['id']}})[_0xf269('0x23')](handleEntityNotFound(_0x164cdc,null))[_0xf269('0x23')](removeEntity(_0x164cdc,null))[_0xf269('0x41')](handleError(_0x164cdc,null));};exports[_0xf269('0x49')]=function(_0x4abc3a,_0x39cb9c,_0x3391a1){var _0x57cd77={};var _0x2f9ea3={};var _0x2f499b;var _0x5ad666;return db['Dynamics365Account'][_0xf269('0x4a')]({'where':{'id':_0x4abc3a['params']['id']}})[_0xf269('0x23')](handleEntityNotFound(_0x39cb9c,null))['then'](function(_0x226160){if(_0x226160){_0x2f499b=_0x226160;_0x2f9ea3['model']=_[_0xf269('0x2e')](db[_0xf269('0x4b')][_0xf269('0x2a')]);_0x2f9ea3[_0xf269('0x2d')]=_[_0xf269('0x2e')](_0x4abc3a[_0xf269('0x2d')]);_0x2f9ea3[_0xf269('0x38')]=_[_0xf269('0x2f')](_0x2f9ea3[_0xf269('0x2c')],_0x2f9ea3[_0xf269('0x2d')]);_0x57cd77[_0xf269('0x30')]=_[_0xf269('0x2f')](_0x2f9ea3[_0xf269('0x2c')],qs[_0xf269('0x31')](_0x4abc3a[_0xf269('0x2d')][_0xf269('0x31')]));_0x57cd77[_0xf269('0x30')]=_0x57cd77['attributes']['length']?_0x57cd77[_0xf269('0x30')]:_0x2f9ea3[_0xf269('0x2c')];_0x57cd77[_0xf269('0x35')]=qs[_0xf269('0x36')](_0x4abc3a[_0xf269('0x2d')][_0xf269('0x36')]);_0x57cd77['where']=qs['filters'](_[_0xf269('0x4c')](_0x4abc3a[_0xf269('0x2d')],_0x2f9ea3[_0xf269('0x38')]));if(_0x4abc3a[_0xf269('0x2d')]['filter']){_0x57cd77[_0xf269('0x37')]=_[_0xf269('0x44')](_0x57cd77['where'],{'$or':_[_0xf269('0x28')](_0x57cd77[_0xf269('0x30')],function(_0x2ede9e){var _0x52cb15={};_0x52cb15[_0x2ede9e]={'$like':'%'+_0x4abc3a[_0xf269('0x2d')][_0xf269('0x39')]+'%'};return _0x52cb15;})});}_0x57cd77=_['merge']({},_0x57cd77,_0x4abc3a[_0xf269('0x3c')]);return _0x2f499b[_0xf269('0x49')](_0x57cd77);}})[_0xf269('0x23')](function(_0x4a8dc3){if(_0x4a8dc3){_0x5ad666=_0x4a8dc3[_0xf269('0x32')];if(!_0x4abc3a[_0xf269('0x2d')][_0xf269('0x33')]('nolimit')){_0x57cd77[_0xf269('0x1f')]=qs[_0xf269('0x1f')](_0x4abc3a[_0xf269('0x2d')]['limit']);_0x57cd77[_0xf269('0x1d')]=qs[_0xf269('0x1d')](_0x4abc3a[_0xf269('0x2d')]['offset']);}return _0x2f499b[_0xf269('0x49')](_0x57cd77);}})[_0xf269('0x23')](function(_0x42b54f){if(_0x42b54f){return _0x42b54f?{'count':_0x5ad666,'rows':_0x42b54f}:null;}})[_0xf269('0x23')](respondWithResult(_0x39cb9c,null))['catch'](handleError(_0x39cb9c,null));};exports['addConfiguration']=function(_0x3ce151,_0x4f8f59,_0x285257){if(_0x3ce151[_0xf269('0x47')]['id']){delete _0x3ce151[_0xf269('0x47')]['id'];}return db[_0xf269('0x29')]['findOne']({'where':{'id':_0x3ce151[_0xf269('0x43')]['id']}})[_0xf269('0x23')](handleEntityNotFound(_0x4f8f59,null))[_0xf269('0x23')](function(_0x45349e){if(_0x45349e){_0x3ce151[_0xf269('0x47')][_0xf269('0x4d')]=_0x45349e['id'];_0x3ce151[_0xf269('0x47')]['Subjects']=integrations[_0xf269('0x4e')](_0x3ce151[_0xf269('0x47')][_0xf269('0x4f')],_0x3ce151[_0xf269('0x47')][_0xf269('0x3a')]);_0x3ce151[_0xf269('0x47')]['Descriptions']=integrations['getDescriptions'](_0x3ce151[_0xf269('0x47')][_0xf269('0x4f')],_0x3ce151[_0xf269('0x47')]['type']);return db[_0xf269('0x4b')][_0xf269('0x46')](_0x3ce151[_0xf269('0x47')],{'include':[{'model':db['Dynamics365Field'],'as':'Subjects'},{'model':db[_0xf269('0x50')],'as':_0xf269('0x51')}]});}return null;})['then'](respondWithResult(_0x4f8f59,null))[_0xf269('0x41')](handleError(_0x4f8f59,null));};exports[_0xf269('0x52')]=function(_0x3bc567,_0x3748a2,_0x5a900d){var _0x4b52cf=_0x3bc567[_0xf269('0x2d')][_0xf269('0x53')];var _0x184fb5=_0x4b52cf==='incident'?'Incident':_0xf269('0x54');var _0x2510cd='';var _0x40b2cf='';var _0x17a82c='';var _0x275f42='';var _0x171b6f='';var _0x54ba97='';var _0x4724f5='';var _0x22ee6e='';var _0x3f36e2=[_0xf269('0x55'),_0xf269('0x56'),_0xf269('0x57'),_0xf269('0x58'),_0xf269('0x59'),_0xf269('0x5a'),_0xf269('0x5b'),'regardingobjectid',_0xf269('0x5c'),_0xf269('0x5d')];var _0x4b1b6f=[_0xf269('0x5e'),_0xf269('0x5f'),'actualserviceunits','billedserviceunits',_0xf269('0x60'),_0xf269('0x61'),_0xf269('0x62'),_0xf269('0x63'),_0xf269('0x64'),'createdbyexternalpartyyominame',_0xf269('0x65'),_0xf269('0x66'),_0xf269('0x67'),'createdonbehalfbyname',_0xf269('0x68'),_0xf269('0x69'),'customeridtype',_0xf269('0x6a'),'emailaddress',_0xf269('0x6b'),_0xf269('0x6c'),'entityimage_url',_0xf269('0x6d'),_0xf269('0x6e'),_0xf269('0x6f'),_0xf269('0x70'),_0xf269('0x71'),_0xf269('0x72'),_0xf269('0x73'),_0xf269('0x74'),'masteridname',_0xf269('0x75'),_0xf269('0x76'),'modifiedbyname',_0xf269('0x77'),_0xf269('0x78'),_0xf269('0x79'),'modifiedonbehalfbyyominame',_0xf269('0x7a'),_0xf269('0x7b'),_0xf269('0x7c'),_0xf269('0x7d'),'overriddencreatedon',_0xf269('0x7e'),_0xf269('0x7f'),_0xf269('0x80'),_0xf269('0x81'),_0xf269('0x82'),_0xf269('0x83'),_0xf269('0x84'),_0xf269('0x85'),_0xf269('0x86'),_0xf269('0x87'),_0xf269('0x88'),'responseby',_0xf269('0x89'),_0xf269('0x8a'),_0xf269('0x8b'),_0xf269('0x8c'),_0xf269('0x8d'),_0xf269('0x8e'),_0xf269('0x8f'),_0xf269('0x90'),'subjectidname',_0xf269('0x91'),_0xf269('0x92'),'transactioncurrencyidname',_0xf269('0x93'),_0xf269('0x94'),_0xf269('0x95')];var _0x1ab605=_0x3f36e2['concat'](_0x4b1b6f);return db[_0xf269('0x29')][_0xf269('0x4a')]({'where':{'id':_0x3bc567[_0xf269('0x43')]['id']},'attributes':['id','username',_0xf269('0x96'),_0xf269('0x97'),_0xf269('0x98'),'clientId',_0xf269('0x99')]})[_0xf269('0x23')](handleEntityNotFound(_0x3748a2,null))[_0xf269('0x23')](function(_0xcb37ae){if(_0xcb37ae){_0x22ee6e=_0xcb37ae[_0xf269('0x97')];var _0x5aad55=_0x22ee6e[_0xf269('0x9a')](-0x1);if(_0x5aad55==='/'){_0x22ee6e=_0x22ee6e['substring'](0x0,_0x22ee6e[_0xf269('0x9b')](_0x5aad55));}_0x4724f5=util[_0xf269('0x9c')](_0xf269('0x9d'),_0x22ee6e);var _0x1306b4={'method':_0xf269('0x9e'),'uri':'https://login.microsoftonline.com/'+_0xcb37ae[_0xf269('0x98')]+_0xf269('0x9f'),'form':{'client_id':_0xcb37ae[_0xf269('0xa0')],'resource':_0x22ee6e,'username':_0xcb37ae[_0xf269('0xa1')],'password':_0xcb37ae[_0xf269('0x96')],'grant_type':_0xf269('0x96'),'client_secret':_0xcb37ae[_0xf269('0x99')]},'json':!![]};return rp(_0x1306b4);}})[_0xf269('0x23')](function(_0x280051){_0x54ba97=_0x280051[_0xf269('0xa2')];var _0x4073d1={'method':_0xf269('0xa3'),'uri':encodeURI(_0x4724f5+_0xf269('0xa4')+_0x184fb5+'\x27'),'headers':{'Authorization':_0xf269('0xa5')+_0x54ba97,'If-None-Match':null,'OData-Version':_0xf269('0xa6')},'json':!![]};return rp(_0x4073d1);})[_0xf269('0x23')](function(_0x51f77c){var _0x243cc8=_0x51f77c[_0xf269('0xa7')][0x0];var _0x3cd16b=_0x243cc8[_0xf269('0xa8')];var _0x136ee7={'method':'GET','uri':_0x4724f5+'EntityDefinitions('+_0x3cd16b+_0xf269('0xa9'),'headers':{'Authorization':_0xf269('0xa5')+_0x54ba97,'If-None-Match':null,'OData-Version':_0xf269('0xa6')},'json':!![]};return rp(_0x136ee7);})[_0xf269('0x23')](function(_0x5adfee){_0x2510cd=_0x5adfee;_0x40b2cf=_0x2510cd[_0xf269('0xaa')];_0x40b2cf=_[_0xf269('0xab')](_0x40b2cf,function(_0x3753f9){return!_0x1ab605[_0xf269('0xac')](_0x3753f9[_0xf269('0xad')]);});var _0x38aec2=[];var _0x512051=[];_0x40b2cf[_0xf269('0xae')](function(_0x36ba3f){if(_0x36ba3f['@odata.type']){var _0x3c5847=_0x36ba3f[_0xf269('0xaf')][_0xf269('0xb0')](_0x36ba3f[_0xf269('0xaf')][_0xf269('0x9b')]('.')+0x1);if(_0x3c5847===_0xf269('0xb1')){_0x38aec2[_0xf269('0xb2')](getSelectList(_0x4724f5,_0x4b52cf,_0x512051,_0x2510cd[_0xf269('0xa8')],_0x36ba3f[_0xf269('0xa8')],_0x54ba97));}}});return Promise['all'](_0x38aec2);})[_0xf269('0x23')](function(_0x47dc36){_0x17a82c=_0x47dc36[0x0];var _0x1fcc12=[];var _0x37fc9f=[];_0x40b2cf['forEach'](function(_0x1fb7ed){if(!_[_0xf269('0xb3')](_0x1fb7ed[_0xf269('0xaf')])){var _0x51cf97=_0x1fb7ed['@odata.type']['substring'](_0x1fb7ed[_0xf269('0xaf')][_0xf269('0x9b')]('.')+0x1);if(_0x51cf97===_0xf269('0xb4')){_0x1fcc12[_0xf269('0xb2')](getBooleanList(_0x4724f5,_0x4b52cf,_0x37fc9f,_0x2510cd[_0xf269('0xa8')],_0x1fb7ed['MetadataId'],_0x54ba97));}}});return Promise[_0xf269('0xb5')](_0x1fcc12);})[_0xf269('0x23')](function(_0x3ab068){_0x275f42=_0x3ab068[0x0];var _0x1a5d6f=[];var _0x2fe426=[];_0x40b2cf['forEach'](function(_0x576b15){if(_0x576b15['@odata.type']){var _0x582b1c=_0x576b15[_0xf269('0xaf')][_0xf269('0xb0')](_0x576b15[_0xf269('0xaf')][_0xf269('0x9b')]('.')+0x1);if(_0x582b1c===_0xf269('0xb6')||_0x582b1c==='DoubleAttributeMetadata'||_0x582b1c===_0xf269('0xb7')||_0x582b1c===_0xf269('0xb8')||_0x582b1c===_0xf269('0xb9')||_0x582b1c===_0xf269('0xba')||_0x582b1c==='StatusAttributeMetadata'||_0x582b1c===_0xf269('0xbb')||_0x582b1c===_0xf269('0xbc')||_0x582b1c===_0xf269('0xbd')){_0x1a5d6f['push'](getInputList(_0x4724f5,_0x4b52cf,_0x582b1c,_0x2fe426,_0x2510cd[_0xf269('0xa8')],_0x576b15['MetadataId'],_0x54ba97));}}});return Promise[_0xf269('0xb5')](_0x1a5d6f);})['then'](function(_0x703835){_0x171b6f=_0x703835[0x0];var _0x5d50e9=_0x17a82c[_0xf269('0xbe')](_0x275f42)[_0xf269('0xbe')](_0x171b6f);var _0x4df5db={'count':_0x5d50e9[_0xf269('0x32')],'rows':_0x5d50e9};return _0x4df5db;})[_0xf269('0x23')](respondWithResult(_0x3748a2,null))['catch'](function(_0xa846e6){var _0x4a911d=_0x3bc567['query'][_0xf269('0xbf')]?0x1f4:_0xa846e6[_0xf269('0xc0')]||0x1f4;logger[_0xf269('0x24')](_0xa846e6[_0xf269('0x25')]);delete _0xa846e6[_0xf269('0x26')];if(_0x4a911d===0x191){_0x4a911d=0x190;}_0x3748a2[_0xf269('0x1a')](_0x4a911d)['send'](_0x3bc567[_0xf269('0x2d')][_0xf269('0xbf')]?{'message':_0xf269('0xc1'),'statusCode':_0xa846e6[_0xf269('0xc0')]}:_0xa846e6);});};function getSelectList(_0x5eda0f,_0x33f55d,_0x5e7461,_0x4fe09c,_0xe5b49b,_0x3db10a){var _0x5b7265={'method':'GET','uri':_0x5eda0f+'EntityDefinitions('+_0x4fe09c+_0xf269('0xc2')+_0xe5b49b+_0xf269('0xc3')+_0xf269('0xc4'),'headers':{'Authorization':'Bearer\x20'+_0x3db10a,'If-None-Match':null,'OData-Version':_0xf269('0xa6')},'json':!![]};return rp(_0x5b7265)[_0xf269('0x23')](function(_0x1afad7){var _0x5957a6=[];var _0x49fed7=_0x1afad7[_0xf269('0xc5')][_0xf269('0xc6')];_0x49fed7['forEach'](function(_0x1e24ed){_0x5957a6[_0xf269('0xb2')]({'name':_0x1e24ed[_0xf269('0xc7')][_0xf269('0xc8')][_0xf269('0xc7')],'value':String(_0x1e24ed[_0xf269('0xc9')])});});var _0x131d6c={'id':_0x33f55d+'_'+_0x1afad7[_0xf269('0xad')],'name':_0x1afad7[_0xf269('0xca')][_0xf269('0xc8')][_0xf269('0xc7')],'custom':![],'options':_0x5957a6};_0x5e7461[_0xf269('0xb2')](_0x131d6c);return _0x5e7461;});}function getBooleanList(_0x286699,_0xb52a7c,_0x379c8c,_0x322876,_0x135562,_0x511a00){var _0x498b28={'method':_0xf269('0xa3'),'uri':_0x286699+_0xf269('0xcb')+_0x322876+_0xf269('0xc2')+_0x135562+_0xf269('0xcc'),'headers':{'Authorization':_0xf269('0xa5')+_0x511a00,'If-None-Match':null,'OData-Version':_0xf269('0xa6')},'json':!![]};return rp(_0x498b28)['then'](function(_0x1b8142){var _0xcb033d=[];_0xcb033d[_0xf269('0xb2')]({'name':_0x1b8142[_0xf269('0xc5')][_0xf269('0xcd')]['Label']['UserLocalizedLabel']['Label'],'value':_0xf269('0xce')},{'name':_0x1b8142[_0xf269('0xc5')][_0xf269('0xcf')]['Label'][_0xf269('0xc8')][_0xf269('0xc7')],'value':_0xf269('0xd0')});var _0x36bb1a={'id':_0xb52a7c+'_'+_0x1b8142[_0xf269('0xad')],'name':_0x1b8142[_0xf269('0xca')][_0xf269('0xc8')]['Label'],'custom':![],'options':_0xcb033d};_0x379c8c['push'](_0x36bb1a);return _0x379c8c;});}function getInputList(_0x3431bd,_0x2e6348,_0x459f75,_0x4b5f1f,_0xcaf26b,_0x172ea4,_0x12e844){var _0x1c5be8={'method':_0xf269('0xa3'),'uri':_0x3431bd+_0xf269('0xcb')+_0xcaf26b+_0xf269('0xc2')+_0x172ea4+')/Microsoft.Dynamics.CRM.'+_0x459f75+_0xf269('0xd1'),'headers':{'Authorization':_0xf269('0xa5')+_0x12e844,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1c5be8)[_0xf269('0x23')](function(_0x3e1572){var _0x13b4c6={'id':_0x2e6348+'_'+_0x3e1572[_0xf269('0xad')],'name':_0x3e1572[_0xf269('0xca')][_0xf269('0xc8')]?_0x3e1572['DisplayName'][_0xf269('0xc8')]['Label']:_0x3e1572['LogicalName'],'custom':![],'options':[]};_0x4b5f1f[_0xf269('0xb2')](_0x13b4c6);return _0x4b5f1f;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 03a4140..33c81bf 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','Dynamics365Account','int_dynamics365_accounts','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x7fd156,_0x1b08b5){var _0x33cbc5=function(_0x156a92){while(--_0x156a92){_0x7fd156['push'](_0x7fd156['shift']());}};_0x33cbc5(++_0x1b08b5);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./intDynamics365Account.attributes');var integrations=require('../../components/integrations/configuration');module[_0x0d8b('0x7')]=function(_0x227c63,_0x39f43a){return _0x227c63['define'](_0x0d8b('0x8'),attributes,{'tableName':_0x0d8b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','util'];(function(_0x46cbf3,_0x7bd780){var _0x1a90e0=function(_0x4d50d0){while(--_0x4d50d0){_0x46cbf3['push'](_0x46cbf3['shift']());}};_0x1a90e0(++_0x7bd780);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));var integrations=require(_0x0baf('0x9'));module[_0x0baf('0xa')]=function(_0x335e24,_0x1a10b1){return _0x335e24[_0x0baf('0xb')](_0x0baf('0xc'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 76aebdf..95564c1 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 _0x035c=['../../config/utils','rpc','jayson/promise','client','http','then','info','debug','request\x20sent','error','code','Dynamics365Account,\x20%s,\x20%s','message','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowDynamics365Account','find','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x035c,0xc6));var _0xc035=function(_0x5b5241,_0x2024bd){_0x5b5241=_0x5b5241-0x0;var _0x53af20=_0x035c[_0x5b5241];return _0x53af20;};'use strict';var _=require(_0xc035('0x0'));var util=require(_0xc035('0x1'));var moment=require(_0xc035('0x2'));var BPromise=require(_0xc035('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc035('0x4'));var db=require(_0xc035('0x5'))['db'];var utils=require(_0xc035('0x6'));var logger=require('../../config/logger')(_0xc035('0x7'));var config=require('../../config/environment');var jayson=require(_0xc035('0x8'));var client=jayson[_0xc035('0x9')][_0xc035('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x18d3e9,_0x2834af,_0x20e6b0){return new BPromise(function(_0x5636bb,_0x13aa20){return client['request'](_0x18d3e9,_0x20e6b0)[_0xc035('0xb')](function(_0x1a8b55){logger[_0xc035('0xc')]('Dynamics365Account,\x20%s,\x20%s',_0x2834af,'request\x20sent');logger[_0xc035('0xd')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x2834af,_0xc035('0xe'),JSON['stringify'](_0x1a8b55));if(_0x1a8b55['error']){if(_0x1a8b55[_0xc035('0xf')][_0xc035('0x10')]===0x1f4){logger['error'](_0xc035('0x11'),_0x2834af,_0x1a8b55[_0xc035('0xf')][_0xc035('0x12')]);return _0x13aa20(_0x1a8b55[_0xc035('0xf')][_0xc035('0x12')]);}logger[_0xc035('0xf')]('Dynamics365Account,\x20%s,\x20%s',_0x2834af,_0x1a8b55['error']['message']);return _0x5636bb(_0x1a8b55[_0xc035('0xf')]['message']);}else{logger[_0xc035('0xc')]('Dynamics365Account,\x20%s,\x20%s',_0x2834af,'request\x20sent');_0x5636bb(_0x1a8b55['result']['message']);}})[_0xc035('0x13')](function(_0x54b8c7){logger[_0xc035('0xf')](_0xc035('0x11'),_0x2834af,_0x54b8c7);_0x13aa20(_0x54b8c7);});});}exports[_0xc035('0x14')]=function(_0x5c20d3){var _0x14fbe9=this;return new Promise(function(_0x5862f3,_0x5583e2){return db[_0xc035('0x15')][_0xc035('0x16')]({'raw':_0x5c20d3[_0xc035('0x17')]?_0x5c20d3[_0xc035('0x17')][_0xc035('0x18')]===undefined?!![]:![]:!![],'where':_0x5c20d3['options']?_0x5c20d3['options'][_0xc035('0x19')]||null:null,'attributes':_0x5c20d3[_0xc035('0x17')]?_0x5c20d3[_0xc035('0x17')][_0xc035('0x1a')]||null:null,'limit':_0x5c20d3[_0xc035('0x17')]?_0x5c20d3['options'][_0xc035('0x1b')]||null:null,'include':_0x5c20d3['options']?_0x5c20d3[_0xc035('0x17')][_0xc035('0x1c')]?_[_0xc035('0x1d')](_0x5c20d3[_0xc035('0x17')][_0xc035('0x1c')],function(_0x2686c1){return{'model':db[_0x2686c1[_0xc035('0x1e')]],'as':_0x2686c1['as'],'attributes':_0x2686c1[_0xc035('0x1a')],'include':_0x2686c1[_0xc035('0x1c')]?_['map'](_0x2686c1[_0xc035('0x1c')],function(_0xc9173f){return{'model':db[_0xc9173f[_0xc035('0x1e')]],'as':_0xc9173f['as'],'attributes':_0xc9173f[_0xc035('0x1a')],'include':_0xc9173f['include']?_['map'](_0xc9173f[_0xc035('0x1c')],function(_0x2504c1){return{'model':db[_0x2504c1[_0xc035('0x1e')]],'as':_0x2504c1['as'],'attributes':_0x2504c1[_0xc035('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xc035('0xb')](function(_0x12cb22){logger[_0xc035('0xc')](_0xc035('0x14'),_0x5c20d3);logger[_0xc035('0xd')]('GetDynamics365Account',_0x5c20d3,JSON[_0xc035('0x1f')](_0x12cb22));_0x5862f3(_0x12cb22);})[_0xc035('0x13')](function(_0x571e27){logger['error']('GetDynamics365Account',_0x571e27[_0xc035('0x12')],_0x5c20d3);_0x5583e2(_0x14fbe9[_0xc035('0xf')](0x1f4,_0x571e27[_0xc035('0x12')]));});});};exports[_0xc035('0x20')]=function(_0x3123af){var _0x231cf0=this;return new Promise(function(_0x5e3839,_0x137ce2){return db['Dynamics365Account'][_0xc035('0x21')]({'raw':_0x3123af[_0xc035('0x17')]?_0x3123af[_0xc035('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3123af[_0xc035('0x17')]?_0x3123af[_0xc035('0x17')][_0xc035('0x19')]||null:null,'attributes':_0x3123af[_0xc035('0x17')]?_0x3123af[_0xc035('0x17')][_0xc035('0x1a')]||null:null,'include':_0x3123af['options']?_0x3123af[_0xc035('0x17')][_0xc035('0x1c')]?_[_0xc035('0x1d')](_0x3123af['options'][_0xc035('0x1c')],function(_0x2988ca){return{'model':db[_0x2988ca[_0xc035('0x1e')]],'as':_0x2988ca['as'],'attributes':_0x2988ca[_0xc035('0x1a')],'include':_0x2988ca[_0xc035('0x1c')]?_[_0xc035('0x1d')](_0x2988ca[_0xc035('0x1c')],function(_0xe49702){return{'model':db[_0xe49702[_0xc035('0x1e')]],'as':_0xe49702['as'],'attributes':_0xe49702['attributes'],'include':_0xe49702[_0xc035('0x1c')]?_[_0xc035('0x1d')](_0xe49702[_0xc035('0x1c')],function(_0x6530af){return{'model':db[_0x6530af['model']],'as':_0x6530af['as'],'attributes':_0x6530af[_0xc035('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xc035('0xb')](function(_0x41003a){logger[_0xc035('0xc')](_0xc035('0x20'),_0x3123af);logger[_0xc035('0xd')](_0xc035('0x20'),_0x3123af,JSON[_0xc035('0x1f')](_0x41003a));_0x5e3839(_0x41003a);})[_0xc035('0x13')](function(_0x17f82f){logger[_0xc035('0xf')](_0xc035('0x20'),_0x17f82f[_0xc035('0x12')],_0x3123af);_0x137ce2(_0x231cf0[_0xc035('0xf')](0x1f4,_0x17f82f[_0xc035('0x12')]));});});}; \ No newline at end of file +var _0xad10=['find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Dynamics365Account,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','GetDynamics365Account','options','where','attributes','limit','map','include','model','then','ShowDynamics365Account','Dynamics365Account'];(function(_0x339f13,_0x469a7a){var _0x3cd04c=function(_0x5a3fff){while(--_0x5a3fff){_0x339f13['push'](_0x339f13['shift']());}};_0x3cd04c(++_0x469a7a);}(_0xad10,0x92));var _0x0ad1=function(_0x2c77f8,_0x3dbd4c){_0x2c77f8=_0x2c77f8-0x0;var _0x7b56af=_0xad10[_0x2c77f8];return _0x7b56af;};'use strict';var _=require(_0x0ad1('0x0'));var util=require(_0x0ad1('0x1'));var moment=require(_0x0ad1('0x2'));var BPromise=require(_0x0ad1('0x3'));var rs=require(_0x0ad1('0x4'));var fs=require('fs');var Redis=require(_0x0ad1('0x5'));var db=require(_0x0ad1('0x6'))['db'];var utils=require(_0x0ad1('0x7'));var logger=require(_0x0ad1('0x8'))('rpc');var config=require(_0x0ad1('0x9'));var jayson=require(_0x0ad1('0xa'));var client=jayson[_0x0ad1('0xb')][_0x0ad1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x22275f,_0x39f4bb,_0x8bc98){return new BPromise(function(_0x5bb056,_0x3e73da){return client[_0x0ad1('0xd')](_0x22275f,_0x8bc98)['then'](function(_0xaf20e6){logger[_0x0ad1('0xe')](_0x0ad1('0xf'),_0x39f4bb,'request\x20sent');logger[_0x0ad1('0x10')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x39f4bb,_0x0ad1('0x11'),JSON[_0x0ad1('0x12')](_0xaf20e6));if(_0xaf20e6[_0x0ad1('0x13')]){if(_0xaf20e6[_0x0ad1('0x13')][_0x0ad1('0x14')]===0x1f4){logger[_0x0ad1('0x13')]('Dynamics365Account,\x20%s,\x20%s',_0x39f4bb,_0xaf20e6[_0x0ad1('0x13')][_0x0ad1('0x15')]);return _0x3e73da(_0xaf20e6['error']['message']);}logger[_0x0ad1('0x13')](_0x0ad1('0xf'),_0x39f4bb,_0xaf20e6['error']['message']);return _0x5bb056(_0xaf20e6[_0x0ad1('0x13')][_0x0ad1('0x15')]);}else{logger[_0x0ad1('0xe')](_0x0ad1('0xf'),_0x39f4bb,_0x0ad1('0x11'));_0x5bb056(_0xaf20e6['result']['message']);}})[_0x0ad1('0x16')](function(_0x398033){logger[_0x0ad1('0x13')](_0x0ad1('0xf'),_0x39f4bb,_0x398033);_0x3e73da(_0x398033);});});}exports[_0x0ad1('0x17')]=function(_0x7dec0){var _0x117c44=this;return new Promise(function(_0x416dd6,_0x280eae){return db['Dynamics365Account']['findAll']({'raw':_0x7dec0[_0x0ad1('0x18')]?_0x7dec0['options']['raw']===undefined?!![]:![]:!![],'where':_0x7dec0['options']?_0x7dec0[_0x0ad1('0x18')][_0x0ad1('0x19')]||null:null,'attributes':_0x7dec0[_0x0ad1('0x18')]?_0x7dec0['options'][_0x0ad1('0x1a')]||null:null,'limit':_0x7dec0[_0x0ad1('0x18')]?_0x7dec0[_0x0ad1('0x18')][_0x0ad1('0x1b')]||null:null,'include':_0x7dec0['options']?_0x7dec0['options']['include']?_[_0x0ad1('0x1c')](_0x7dec0[_0x0ad1('0x18')][_0x0ad1('0x1d')],function(_0x27b387){return{'model':db[_0x27b387[_0x0ad1('0x1e')]],'as':_0x27b387['as'],'attributes':_0x27b387[_0x0ad1('0x1a')],'include':_0x27b387[_0x0ad1('0x1d')]?_[_0x0ad1('0x1c')](_0x27b387[_0x0ad1('0x1d')],function(_0x3de887){return{'model':db[_0x3de887['model']],'as':_0x3de887['as'],'attributes':_0x3de887[_0x0ad1('0x1a')],'include':_0x3de887[_0x0ad1('0x1d')]?_[_0x0ad1('0x1c')](_0x3de887[_0x0ad1('0x1d')],function(_0x4c051c){return{'model':db[_0x4c051c[_0x0ad1('0x1e')]],'as':_0x4c051c['as'],'attributes':_0x4c051c['attributes']};}):[]};}):[]};}):[]:[]})[_0x0ad1('0x1f')](function(_0x109a2e){logger[_0x0ad1('0xe')]('GetDynamics365Account',_0x7dec0);logger['debug']('GetDynamics365Account',_0x7dec0,JSON[_0x0ad1('0x12')](_0x109a2e));_0x416dd6(_0x109a2e);})[_0x0ad1('0x16')](function(_0x3d98f8){logger[_0x0ad1('0x13')]('GetDynamics365Account',_0x3d98f8[_0x0ad1('0x15')],_0x7dec0);_0x280eae(_0x117c44['error'](0x1f4,_0x3d98f8[_0x0ad1('0x15')]));});});};exports[_0x0ad1('0x20')]=function(_0x550715){var _0x18b623=this;return new Promise(function(_0x35c6ae,_0x40f4b7){return db[_0x0ad1('0x21')][_0x0ad1('0x22')]({'raw':_0x550715[_0x0ad1('0x18')]?_0x550715['options'][_0x0ad1('0x23')]===undefined?!![]:![]:!![],'where':_0x550715[_0x0ad1('0x18')]?_0x550715[_0x0ad1('0x18')][_0x0ad1('0x19')]||null:null,'attributes':_0x550715[_0x0ad1('0x18')]?_0x550715[_0x0ad1('0x18')][_0x0ad1('0x1a')]||null:null,'include':_0x550715[_0x0ad1('0x18')]?_0x550715[_0x0ad1('0x18')][_0x0ad1('0x1d')]?_[_0x0ad1('0x1c')](_0x550715[_0x0ad1('0x18')][_0x0ad1('0x1d')],function(_0xe5f747){return{'model':db[_0xe5f747[_0x0ad1('0x1e')]],'as':_0xe5f747['as'],'attributes':_0xe5f747['attributes'],'include':_0xe5f747[_0x0ad1('0x1d')]?_[_0x0ad1('0x1c')](_0xe5f747['include'],function(_0x55217d){return{'model':db[_0x55217d[_0x0ad1('0x1e')]],'as':_0x55217d['as'],'attributes':_0x55217d[_0x0ad1('0x1a')],'include':_0x55217d[_0x0ad1('0x1d')]?_[_0x0ad1('0x1c')](_0x55217d[_0x0ad1('0x1d')],function(_0xb67190){return{'model':db[_0xb67190[_0x0ad1('0x1e')]],'as':_0xb67190['as'],'attributes':_0xb67190[_0x0ad1('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0ad1('0x1f')](function(_0x479bbf){logger[_0x0ad1('0xe')]('ShowDynamics365Account',_0x550715);logger[_0x0ad1('0x10')](_0x0ad1('0x20'),_0x550715,JSON[_0x0ad1('0x12')](_0x479bbf));_0x35c6ae(_0x479bbf);})[_0x0ad1('0x16')](function(_0x343ff2){logger[_0x0ad1('0x13')](_0x0ad1('0x20'),_0x343ff2[_0x0ad1('0x15')],_0x550715);_0x40f4b7(_0x18b623['error'](0x1f4,_0x343ff2[_0x0ad1('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 3337afa..9035719 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 _0xc7bd=['multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Configuration.controller','isAuthenticated','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','update','delete','exports'];(function(_0x45dfde,_0x531808){var _0x54e9f7=function(_0x4af96f){while(--_0x4af96f){_0x45dfde['push'](_0x45dfde['shift']());}};_0x54e9f7(++_0x531808);}(_0xc7bd,0x170));var _0xdc7b=function(_0x38ab99,_0x2047f5){_0x38ab99=_0x38ab99-0x0;var _0x3d2800=_0xc7bd[_0x38ab99];return _0x3d2800;};'use strict';var multer=require(_0xdc7b('0x0'));var util=require(_0xdc7b('0x1'));var path=require(_0xdc7b('0x2'));var timeout=require(_0xdc7b('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xdc7b('0x4'));var auth=require(_0xdc7b('0x5'));var interaction=require(_0xdc7b('0x6'));var config=require('../../config/environment');var controller=require(_0xdc7b('0x7'));router['get']('/',auth[_0xdc7b('0x8')](),controller['index']);router[_0xdc7b('0x9')](_0xdc7b('0xa'),auth['isAuthenticated'](),controller[_0xdc7b('0xb')]);router['get'](_0xdc7b('0xc'),auth[_0xdc7b('0x8')](),controller[_0xdc7b('0xd')]);router['get'](_0xdc7b('0xe'),auth['isAuthenticated'](),controller[_0xdc7b('0xf')]);router['get'](_0xdc7b('0x10'),auth[_0xdc7b('0x8')](),controller[_0xdc7b('0x11')]);router[_0xdc7b('0x12')]('/',auth[_0xdc7b('0x8')](),controller['create']);router[_0xdc7b('0x13')](_0xdc7b('0xa'),auth[_0xdc7b('0x8')](),controller[_0xdc7b('0x14')]);router[_0xdc7b('0x15')](_0xdc7b('0xa'),auth[_0xdc7b('0x8')](),controller['destroy']);module[_0xdc7b('0x16')]=router; \ No newline at end of file +var _0x9ea8=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','update','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','/:id/fields','getFields'];(function(_0x46cbef,_0x2bc8e5){var _0x49e99d=function(_0x474bb5){while(--_0x474bb5){_0x46cbef['push'](_0x46cbef['shift']());}};_0x49e99d(++_0x2bc8e5);}(_0x9ea8,0x147));var _0x89ea=function(_0x5b80d5,_0x288493){_0x5b80d5=_0x5b80d5-0x0;var _0x4935eb=_0x9ea8[_0x5b80d5];return _0x4935eb;};'use strict';var multer=require('multer');var util=require(_0x89ea('0x0'));var path=require(_0x89ea('0x1'));var timeout=require(_0x89ea('0x2'));var express=require(_0x89ea('0x3'));var router=express[_0x89ea('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x89ea('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x89ea('0x6'));var controller=require('./intDynamics365Configuration.controller');router['get']('/',auth[_0x89ea('0x7')](),controller[_0x89ea('0x8')]);router[_0x89ea('0x9')](_0x89ea('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x89ea('0x9')](_0x89ea('0xb'),auth[_0x89ea('0x7')](),controller[_0x89ea('0xc')]);router[_0x89ea('0x9')](_0x89ea('0xd'),auth[_0x89ea('0x7')](),controller[_0x89ea('0xe')]);router[_0x89ea('0x9')](_0x89ea('0xf'),auth[_0x89ea('0x7')](),controller[_0x89ea('0x10')]);router[_0x89ea('0x11')]('/',auth[_0x89ea('0x7')](),controller[_0x89ea('0x12')]);router['put'](_0x89ea('0xa'),auth[_0x89ea('0x7')](),controller[_0x89ea('0x13')]);router['delete'](_0x89ea('0xa'),auth[_0x89ea('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 4a9b153..aebede0 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 _0xedca=['ENUM','incident','phonecall','sequelize','STRING'];(function(_0x3dd1f3,_0x1a1197){var _0x59fbe7=function(_0x5cb017){while(--_0x5cb017){_0x3dd1f3['push'](_0x3dd1f3['shift']());}};_0x59fbe7(++_0x1a1197);}(_0xedca,0x12a));var _0xaedc=function(_0x499614,_0x3ebbbe){_0x499614=_0x499614-0x0;var _0x259292=_0xedca[_0x499614];return _0x259292;};'use strict';var Sequelize=require(_0xaedc('0x0'));module['exports']={'name':{'type':Sequelize[_0xaedc('0x1')]},'description':{'type':Sequelize[_0xaedc('0x1')]},'ticketType':{'type':Sequelize[_0xaedc('0x2')](_0xaedc('0x3'),_0xaedc('0x4')),'defaultValue':_0xaedc('0x3')}}; \ No newline at end of file +var _0x2b9e=['incident','phonecall','sequelize','exports','STRING'];(function(_0x447044,_0xd9784a){var _0x527bdb=function(_0x20c90d){while(--_0x20c90d){_0x447044['push'](_0x447044['shift']());}};_0x527bdb(++_0xd9784a);}(_0x2b9e,0x1f1));var _0xe2b9=function(_0x5f4db9,_0x3c8ac0){_0x5f4db9=_0x5f4db9-0x0;var _0x49c19a=_0x2b9e[_0x5f4db9];return _0x49c19a;};'use strict';var Sequelize=require(_0xe2b9('0x0'));module[_0xe2b9('0x1')]={'name':{'type':Sequelize[_0xe2b9('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0xe2b9('0x3'),_0xe2b9('0x4')),'defaultValue':_0xe2b9('0x3')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 7428e8d..630849d 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 _0x7069=['VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','params','getFields','findOne','Dynamics365Field','order','pick','getSubjects','getDescriptions','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','Dynamics365Configuration','fieldName','type','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filters','filter','where','merge'];(function(_0x4fa438,_0x1f15a7){var _0x4e3958=function(_0x28f510){while(--_0x28f510){_0x4fa438['push'](_0x4fa438['shift']());}};_0x4e3958(++_0x1f15a7);}(_0x7069,0x110));var _0x9706=function(_0x237ce0,_0x44949a){_0x237ce0=_0x237ce0-0x0;var _0x309d14=_0x7069[_0x237ce0];return _0x309d14;};'use strict';var emlformat=require(_0x9706('0x0'));var rimraf=require(_0x9706('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9706('0x2'));var moment=require(_0x9706('0x3'));var BPromise=require(_0x9706('0x4'));var Mustache=require(_0x9706('0x5'));var util=require(_0x9706('0x6'));var path=require('path');var sox=require(_0x9706('0x7'));var csv=require('to-csv');var ejs=require(_0x9706('0x8'));var fs=require('fs');var fs_extra=require(_0x9706('0x9'));var _=require(_0x9706('0xa'));var squel=require(_0x9706('0xb'));var crypto=require(_0x9706('0xc'));var jsforce=require(_0x9706('0xd'));var deskjs=require(_0x9706('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9706('0xf'));var Papa=require(_0x9706('0x10'));var Redis=require('ioredis');var authService=require(_0x9706('0x11'));var qs=require(_0x9706('0x12'));var as=require(_0x9706('0x13'));var hardwareService=require(_0x9706('0x14'));var logger=require(_0x9706('0x15'))(_0x9706('0x16'));var utils=require(_0x9706('0x17'));var config=require(_0x9706('0x18'));var licenseUtil=require(_0x9706('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x36a027,_0x385b37){_0x385b37=_0x385b37||0xcc;return function(_0x2f864b){if(_0x2f864b){return _0x36a027[_0x9706('0x1a')](_0x385b37);}return _0x36a027[_0x9706('0x1b')](_0x385b37)[_0x9706('0x1c')]();};}function respondWithResult(_0x21ddec,_0xa956a0){_0xa956a0=_0xa956a0||0xc8;return function(_0xe8c28d){if(_0xe8c28d){return _0x21ddec['status'](_0xa956a0)['json'](_0xe8c28d);}};}function respondWithFilteredResult(_0x52924c,_0x51fd5c){return function(_0x49d24d){if(_0x49d24d){var _0xaa7ee5=typeof _0x51fd5c['offset']===_0x9706('0x1d')&&typeof _0x51fd5c[_0x9706('0x1e')]===_0x9706('0x1d');var _0x5dbb05=_0x49d24d[_0x9706('0x1f')];var _0x22b778=_0xaa7ee5?0x0:_0x51fd5c[_0x9706('0x20')];var _0x53ae40=_0xaa7ee5?_0x49d24d[_0x9706('0x1f')]:_0x51fd5c[_0x9706('0x20')]+_0x51fd5c[_0x9706('0x1e')];var _0x16af88;if(_0x53ae40>=_0x5dbb05){_0x53ae40=_0x5dbb05;_0x16af88=0xc8;}else{_0x16af88=0xce;}_0x52924c['status'](_0x16af88);return _0x52924c[_0x9706('0x21')](_0x9706('0x22'),_0x22b778+'-'+_0x53ae40+'/'+_0x5dbb05)['json'](_0x49d24d);}return null;};}function patchUpdates(_0x2bcc9e){return function(_0x10a844){try{jsonpatch[_0x9706('0x23')](_0x10a844,_0x2bcc9e,!![]);}catch(_0x18b263){return BPromise[_0x9706('0x24')](_0x18b263);}return _0x10a844[_0x9706('0x25')]();};}function saveUpdates(_0x56e8f,_0x682854){return function(_0x240bc5){if(_0x240bc5){return _0x240bc5[_0x9706('0x26')](_0x56e8f)['then'](function(_0x15918d){return _0x15918d;});}return null;};}function removeEntity(_0x27fe59,_0x586bfd){return function(_0x52af84){if(_0x52af84){return _0x52af84[_0x9706('0x27')]()[_0x9706('0x28')](function(){_0x27fe59[_0x9706('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x392603,_0x161d3a){return function(_0x324747){if(!_0x324747){_0x392603[_0x9706('0x1a')](0x194);}return _0x324747;};}function handleError(_0x4d31a1,_0x48201e){_0x48201e=_0x48201e||0x1f4;return function(_0x384dfb){logger[_0x9706('0x29')](_0x384dfb[_0x9706('0x2a')]);if(_0x384dfb[_0x9706('0x2b')]){delete _0x384dfb[_0x9706('0x2b')];}_0x4d31a1[_0x9706('0x1b')](_0x48201e)[_0x9706('0x2c')](_0x384dfb);};}exports[_0x9706('0x2d')]=function(_0x1b9380,_0x4c9b5d){var _0x2b8be2={},_0x11e7bc={},_0x991a3a={'count':0x0,'rows':[]};var _0xd56135=_['map'](db[_0x9706('0x2e')]['rawAttributes'],function(_0xb4ac8d){return{'name':_0xb4ac8d[_0x9706('0x2f')],'type':_0xb4ac8d[_0x9706('0x30')]['key']};});_0x11e7bc[_0x9706('0x31')]=_[_0x9706('0x32')](_0xd56135,_0x9706('0x2b'));_0x11e7bc[_0x9706('0x33')]=_[_0x9706('0x34')](_0x1b9380['query']);_0x11e7bc['filters']=_['intersection'](_0x11e7bc[_0x9706('0x31')],_0x11e7bc[_0x9706('0x33')]);_0x2b8be2['attributes']=_[_0x9706('0x35')](_0x11e7bc[_0x9706('0x31')],qs[_0x9706('0x36')](_0x1b9380[_0x9706('0x33')][_0x9706('0x36')]));_0x2b8be2[_0x9706('0x37')]=_0x2b8be2[_0x9706('0x37')][_0x9706('0x38')]?_0x2b8be2[_0x9706('0x37')]:_0x11e7bc[_0x9706('0x31')];if(!_0x1b9380[_0x9706('0x33')][_0x9706('0x39')](_0x9706('0x3a'))){_0x2b8be2[_0x9706('0x1e')]=qs[_0x9706('0x1e')](_0x1b9380[_0x9706('0x33')][_0x9706('0x1e')]);_0x2b8be2[_0x9706('0x20')]=qs[_0x9706('0x20')](_0x1b9380[_0x9706('0x33')][_0x9706('0x20')]);}_0x2b8be2['order']=qs['sort'](_0x1b9380[_0x9706('0x33')][_0x9706('0x3b')]);_0x2b8be2['where']=qs[_0x9706('0x3c')](_['pick'](_0x1b9380[_0x9706('0x33')],_0x11e7bc[_0x9706('0x3c')]),_0xd56135);if(_0x1b9380[_0x9706('0x33')][_0x9706('0x3d')]){_0x2b8be2[_0x9706('0x3e')]=_[_0x9706('0x3f')](_0x2b8be2[_0x9706('0x3e')],{'$or':_[_0x9706('0x32')](_0xd56135,function(_0x503a07){if(_0x503a07['type']!==_0x9706('0x40')){var _0x308dab={};_0x308dab[_0x503a07['name']]={'$like':'%'+_0x1b9380[_0x9706('0x33')][_0x9706('0x3d')]+'%'};return _0x308dab;}})});}_0x2b8be2=_[_0x9706('0x3f')]({},_0x2b8be2,_0x1b9380[_0x9706('0x41')]);var _0x499527={'where':_0x2b8be2['where']};return db[_0x9706('0x2e')][_0x9706('0x1f')](_0x499527)['then'](function(_0x468320){_0x991a3a[_0x9706('0x1f')]=_0x468320;if(_0x1b9380[_0x9706('0x33')][_0x9706('0x42')]){_0x2b8be2[_0x9706('0x43')]=[{'all':!![]}];}return db[_0x9706('0x2e')][_0x9706('0x44')](_0x2b8be2);})[_0x9706('0x28')](function(_0x42fb1d){_0x991a3a[_0x9706('0x45')]=_0x42fb1d;return _0x991a3a;})[_0x9706('0x28')](respondWithFilteredResult(_0x4c9b5d,_0x2b8be2))[_0x9706('0x46')](handleError(_0x4c9b5d,null));};exports[_0x9706('0x47')]=function(_0x2f8acd,_0x5114fa){var _0x105b00={'raw':![],'where':{'id':_0x2f8acd['params']['id']}},_0x4ee98e={};_0x4ee98e[_0x9706('0x31')]=_['keys'](db[_0x9706('0x2e')][_0x9706('0x48')]);_0x4ee98e[_0x9706('0x33')]=_[_0x9706('0x34')](_0x2f8acd[_0x9706('0x33')]);_0x4ee98e[_0x9706('0x3c')]=_[_0x9706('0x35')](_0x4ee98e['model'],_0x4ee98e[_0x9706('0x33')]);_0x105b00[_0x9706('0x37')]=_[_0x9706('0x35')](_0x4ee98e[_0x9706('0x31')],qs[_0x9706('0x36')](_0x2f8acd[_0x9706('0x33')]['fields']));_0x105b00[_0x9706('0x37')]=_0x105b00[_0x9706('0x37')]['length']?_0x105b00[_0x9706('0x37')]:_0x4ee98e[_0x9706('0x31')];if(_0x2f8acd[_0x9706('0x33')][_0x9706('0x42')]){_0x105b00['include']=[{'all':!![]}];}_0x105b00=_[_0x9706('0x3f')]({},_0x105b00,_0x2f8acd['options']);return db[_0x9706('0x2e')][_0x9706('0x49')](_0x105b00)['then'](handleEntityNotFound(_0x5114fa,null))[_0x9706('0x28')](respondWithResult(_0x5114fa,null))[_0x9706('0x46')](handleError(_0x5114fa,null));};exports['create']=function(_0x4fa007,_0x41d33b){return db[_0x9706('0x2e')][_0x9706('0x4a')](_0x4fa007[_0x9706('0x4b')],{})['then'](respondWithResult(_0x41d33b,0xc9))[_0x9706('0x46')](handleError(_0x41d33b,null));};exports[_0x9706('0x26')]=function(_0x347d0e,_0x2a9feb){if(_0x347d0e[_0x9706('0x4b')]['id']){delete _0x347d0e[_0x9706('0x4b')]['id'];}return db['Dynamics365Configuration']['find']({'where':{'id':_0x347d0e[_0x9706('0x4c')]['id']}})[_0x9706('0x28')](handleEntityNotFound(_0x2a9feb,null))['then'](saveUpdates(_0x347d0e['body'],null))[_0x9706('0x28')](respondWithResult(_0x2a9feb,null))[_0x9706('0x46')](handleError(_0x2a9feb,null));};exports[_0x9706('0x27')]=function(_0x1e7591,_0x41e4c8){return db['Dynamics365Configuration'][_0x9706('0x49')]({'where':{'id':_0x1e7591[_0x9706('0x4c')]['id']}})[_0x9706('0x28')](handleEntityNotFound(_0x41e4c8,null))[_0x9706('0x28')](removeEntity(_0x41e4c8,null))['catch'](handleError(_0x41e4c8,null));};exports[_0x9706('0x4d')]=function(_0x471632,_0x15eb28,_0x347fe5){var _0x3cd535={};var _0x2ed833={};var _0x4f6dc2;var _0x381903;return db['Dynamics365Configuration'][_0x9706('0x4e')]({'where':{'id':_0x471632[_0x9706('0x4c')]['id']}})['then'](handleEntityNotFound(_0x15eb28,null))[_0x9706('0x28')](function(_0x2bc837){if(_0x2bc837){_0x4f6dc2=_0x2bc837;_0x2ed833[_0x9706('0x31')]=_[_0x9706('0x34')](db[_0x9706('0x4f')][_0x9706('0x48')]);_0x2ed833[_0x9706('0x33')]=_['keys'](_0x471632['query']);_0x2ed833[_0x9706('0x3c')]=_['intersection'](_0x2ed833[_0x9706('0x31')],_0x2ed833[_0x9706('0x33')]);_0x3cd535[_0x9706('0x37')]=_[_0x9706('0x35')](_0x2ed833[_0x9706('0x31')],qs['fields'](_0x471632['query']['fields']));_0x3cd535['attributes']=_0x3cd535[_0x9706('0x37')]['length']?_0x3cd535[_0x9706('0x37')]:_0x2ed833['model'];_0x3cd535[_0x9706('0x50')]=qs[_0x9706('0x3b')](_0x471632['query'][_0x9706('0x3b')]);_0x3cd535[_0x9706('0x3e')]=qs['filters'](_[_0x9706('0x51')](_0x471632[_0x9706('0x33')],_0x2ed833[_0x9706('0x3c')]));if(_0x471632[_0x9706('0x33')][_0x9706('0x3d')]){_0x3cd535[_0x9706('0x3e')]=_[_0x9706('0x3f')](_0x3cd535[_0x9706('0x3e')],{'$or':_[_0x9706('0x32')](_0x3cd535[_0x9706('0x37')],function(_0x2cc4ba){var _0x3e11ac={};_0x3e11ac[_0x2cc4ba]={'$like':'%'+_0x471632[_0x9706('0x33')]['filter']+'%'};return _0x3e11ac;})});}_0x3cd535=_['merge']({},_0x3cd535,_0x471632[_0x9706('0x41')]);return _0x4f6dc2[_0x9706('0x4d')](_0x3cd535);}})[_0x9706('0x28')](function(_0xf14edb){if(_0xf14edb){_0x381903=_0xf14edb['length'];if(!_0x471632['query'][_0x9706('0x39')](_0x9706('0x3a'))){_0x3cd535[_0x9706('0x1e')]=qs[_0x9706('0x1e')](_0x471632[_0x9706('0x33')][_0x9706('0x1e')]);_0x3cd535[_0x9706('0x20')]=qs[_0x9706('0x20')](_0x471632[_0x9706('0x33')][_0x9706('0x20')]);}return _0x4f6dc2[_0x9706('0x4d')](_0x3cd535);}})['then'](function(_0x23890b){if(_0x23890b){return _0x23890b?{'count':_0x381903,'rows':_0x23890b}:null;}})[_0x9706('0x28')](respondWithResult(_0x15eb28,null))[_0x9706('0x46')](handleError(_0x15eb28,null));};exports[_0x9706('0x52')]=function(_0x53adfc,_0x2c71af,_0x333b51){var _0x57f7a6={};var _0xc2ce30={};var _0x50136c;var _0x32fa81;return db[_0x9706('0x2e')]['findOne']({'where':{'id':_0x53adfc[_0x9706('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2c71af,null))[_0x9706('0x28')](function(_0x267a2a){if(_0x267a2a){_0x50136c=_0x267a2a;_0xc2ce30[_0x9706('0x31')]=_[_0x9706('0x34')](db[_0x9706('0x4f')][_0x9706('0x48')]);_0xc2ce30[_0x9706('0x33')]=_[_0x9706('0x34')](_0x53adfc['query']);_0xc2ce30[_0x9706('0x3c')]=_[_0x9706('0x35')](_0xc2ce30['model'],_0xc2ce30['query']);_0x57f7a6[_0x9706('0x37')]=_[_0x9706('0x35')](_0xc2ce30[_0x9706('0x31')],qs[_0x9706('0x36')](_0x53adfc[_0x9706('0x33')][_0x9706('0x36')]));_0x57f7a6[_0x9706('0x37')]=_0x57f7a6[_0x9706('0x37')][_0x9706('0x38')]?_0x57f7a6[_0x9706('0x37')]:_0xc2ce30[_0x9706('0x31')];_0x57f7a6[_0x9706('0x50')]=qs[_0x9706('0x3b')](_0x53adfc[_0x9706('0x33')][_0x9706('0x3b')]);_0x57f7a6[_0x9706('0x3e')]=qs[_0x9706('0x3c')](_[_0x9706('0x51')](_0x53adfc[_0x9706('0x33')],_0xc2ce30['filters']));if(_0x53adfc[_0x9706('0x33')][_0x9706('0x3d')]){_0x57f7a6[_0x9706('0x3e')]=_['merge'](_0x57f7a6['where'],{'$or':_[_0x9706('0x32')](_0x57f7a6[_0x9706('0x37')],function(_0x3683b7){var _0x2a9709={};_0x2a9709[_0x3683b7]={'$like':'%'+_0x53adfc[_0x9706('0x33')][_0x9706('0x3d')]+'%'};return _0x2a9709;})});}_0x57f7a6=_[_0x9706('0x3f')]({},_0x57f7a6,_0x53adfc[_0x9706('0x41')]);return _0x50136c['getSubjects'](_0x57f7a6);}})[_0x9706('0x28')](function(_0x309395){if(_0x309395){_0x32fa81=_0x309395[_0x9706('0x38')];if(!_0x53adfc['query'][_0x9706('0x39')]('nolimit')){_0x57f7a6[_0x9706('0x1e')]=qs[_0x9706('0x1e')](_0x53adfc['query'][_0x9706('0x1e')]);_0x57f7a6['offset']=qs[_0x9706('0x20')](_0x53adfc['query']['offset']);}return _0x50136c[_0x9706('0x52')](_0x57f7a6);}})[_0x9706('0x28')](function(_0x2e217a){if(_0x2e217a){return _0x2e217a?{'count':_0x32fa81,'rows':_0x2e217a}:null;}})['then'](respondWithResult(_0x2c71af,null))['catch'](handleError(_0x2c71af,null));};exports[_0x9706('0x53')]=function(_0x1ab136,_0x347071,_0x50d3c7){var _0x2f223e={};var _0x317cc2={};var _0x418f26;var _0x50b556;return db[_0x9706('0x2e')][_0x9706('0x4e')]({'where':{'id':_0x1ab136['params']['id']}})['then'](handleEntityNotFound(_0x347071,null))['then'](function(_0x153eef){if(_0x153eef){_0x418f26=_0x153eef;_0x317cc2['model']=_[_0x9706('0x34')](db['Dynamics365Field'][_0x9706('0x48')]);_0x317cc2['query']=_[_0x9706('0x34')](_0x1ab136['query']);_0x317cc2[_0x9706('0x3c')]=_[_0x9706('0x35')](_0x317cc2[_0x9706('0x31')],_0x317cc2[_0x9706('0x33')]);_0x2f223e[_0x9706('0x37')]=_[_0x9706('0x35')](_0x317cc2[_0x9706('0x31')],qs['fields'](_0x1ab136[_0x9706('0x33')][_0x9706('0x36')]));_0x2f223e[_0x9706('0x37')]=_0x2f223e[_0x9706('0x37')][_0x9706('0x38')]?_0x2f223e[_0x9706('0x37')]:_0x317cc2[_0x9706('0x31')];_0x2f223e[_0x9706('0x50')]=qs[_0x9706('0x3b')](_0x1ab136['query'][_0x9706('0x3b')]);_0x2f223e[_0x9706('0x3e')]=qs[_0x9706('0x3c')](_[_0x9706('0x51')](_0x1ab136[_0x9706('0x33')],_0x317cc2[_0x9706('0x3c')]));if(_0x1ab136[_0x9706('0x33')]['filter']){_0x2f223e[_0x9706('0x3e')]=_['merge'](_0x2f223e[_0x9706('0x3e')],{'$or':_[_0x9706('0x32')](_0x2f223e[_0x9706('0x37')],function(_0x517af2){var _0x36c3b5={};_0x36c3b5[_0x517af2]={'$like':'%'+_0x1ab136[_0x9706('0x33')][_0x9706('0x3d')]+'%'};return _0x36c3b5;})});}_0x2f223e=_[_0x9706('0x3f')]({},_0x2f223e,_0x1ab136[_0x9706('0x41')]);return _0x418f26[_0x9706('0x53')](_0x2f223e);}})[_0x9706('0x28')](function(_0x1f31ca){if(_0x1f31ca){_0x50b556=_0x1f31ca[_0x9706('0x38')];if(!_0x1ab136[_0x9706('0x33')][_0x9706('0x39')]('nolimit')){_0x2f223e[_0x9706('0x1e')]=qs[_0x9706('0x1e')](_0x1ab136[_0x9706('0x33')]['limit']);_0x2f223e[_0x9706('0x20')]=qs[_0x9706('0x20')](_0x1ab136[_0x9706('0x33')][_0x9706('0x20')]);}return _0x418f26[_0x9706('0x53')](_0x2f223e);}})['then'](function(_0x218db2){if(_0x218db2){return _0x218db2?{'count':_0x50b556,'rows':_0x218db2}:null;}})['then'](respondWithResult(_0x347071,null))['catch'](handleError(_0x347071,null));}; \ No newline at end of file +var _0x8a4c=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','error','name','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','create','update','body','find','getFields','findOne','Dynamics365Field','nolimit','getSubjects','getDescriptions','eml-format','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x3fc767,_0x2c4eda){var _0x5c3fb4=function(_0xbc00eb){while(--_0xbc00eb){_0x3fc767['push'](_0x3fc767['shift']());}};_0x5c3fb4(++_0x2c4eda);}(_0x8a4c,0x89));var _0xc8a4=function(_0x264f48,_0x2c82d8){_0x264f48=_0x264f48-0x0;var _0xb99167=_0x8a4c[_0x264f48];return _0xb99167;};'use strict';var emlformat=require(_0xc8a4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc8a4('0x1'));var Mustache=require(_0xc8a4('0x2'));var util=require(_0xc8a4('0x3'));var path=require('path');var sox=require(_0xc8a4('0x4'));var csv=require(_0xc8a4('0x5'));var ejs=require(_0xc8a4('0x6'));var fs=require('fs');var fs_extra=require(_0xc8a4('0x7'));var _=require(_0xc8a4('0x8'));var squel=require(_0xc8a4('0x9'));var crypto=require('crypto');var jsforce=require(_0xc8a4('0xa'));var deskjs=require(_0xc8a4('0xb'));var toCsv=require(_0xc8a4('0x5'));var querystring=require(_0xc8a4('0xc'));var Papa=require(_0xc8a4('0xd'));var Redis=require('ioredis');var authService=require(_0xc8a4('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xc8a4('0xf'));var hardwareService=require(_0xc8a4('0x10'));var logger=require(_0xc8a4('0x11'))(_0xc8a4('0x12'));var utils=require(_0xc8a4('0x13'));var config=require(_0xc8a4('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xc8a4('0x15'))['db'];function respondWithStatusCode(_0x1779cc,_0x145fcf){_0x145fcf=_0x145fcf||0xcc;return function(_0x5b9439){if(_0x5b9439){return _0x1779cc[_0xc8a4('0x16')](_0x145fcf);}return _0x1779cc[_0xc8a4('0x17')](_0x145fcf)[_0xc8a4('0x18')]();};}function respondWithResult(_0x4ad2e8,_0x4bdf12){_0x4bdf12=_0x4bdf12||0xc8;return function(_0x52d42b){if(_0x52d42b){return _0x4ad2e8[_0xc8a4('0x17')](_0x4bdf12)[_0xc8a4('0x19')](_0x52d42b);}};}function respondWithFilteredResult(_0x185fb0,_0x2e4320){return function(_0x20ead8){if(_0x20ead8){var _0x84ece9=typeof _0x2e4320[_0xc8a4('0x1a')]===_0xc8a4('0x1b')&&typeof _0x2e4320[_0xc8a4('0x1c')]===_0xc8a4('0x1b');var _0x283b1f=_0x20ead8[_0xc8a4('0x1d')];var _0x46dc25=_0x84ece9?0x0:_0x2e4320['offset'];var _0x795fb8=_0x84ece9?_0x20ead8[_0xc8a4('0x1d')]:_0x2e4320['offset']+_0x2e4320[_0xc8a4('0x1c')];var _0x2b10b2;if(_0x795fb8>=_0x283b1f){_0x795fb8=_0x283b1f;_0x2b10b2=0xc8;}else{_0x2b10b2=0xce;}_0x185fb0[_0xc8a4('0x17')](_0x2b10b2);return _0x185fb0[_0xc8a4('0x1e')](_0xc8a4('0x1f'),_0x46dc25+'-'+_0x795fb8+'/'+_0x283b1f)[_0xc8a4('0x19')](_0x20ead8);}return null;};}function patchUpdates(_0x602cc3){return function(_0x182ef5){try{jsonpatch[_0xc8a4('0x20')](_0x182ef5,_0x602cc3,!![]);}catch(_0x5bc2e8){return BPromise[_0xc8a4('0x21')](_0x5bc2e8);}return _0x182ef5['save']();};}function saveUpdates(_0x402ccb,_0x5d1b6e){return function(_0x1cde21){if(_0x1cde21){return _0x1cde21['update'](_0x402ccb)[_0xc8a4('0x22')](function(_0x5aeef7){return _0x5aeef7;});}return null;};}function removeEntity(_0x5f463f,_0x45fded){return function(_0x552395){if(_0x552395){return _0x552395[_0xc8a4('0x23')]()[_0xc8a4('0x22')](function(){_0x5f463f['status'](0xcc)[_0xc8a4('0x18')]();});}};}function handleEntityNotFound(_0x5044ca,_0x3c3c1d){return function(_0x4c5b98){if(!_0x4c5b98){_0x5044ca[_0xc8a4('0x16')](0x194);}return _0x4c5b98;};}function handleError(_0x2d2c60,_0x43e2c5){_0x43e2c5=_0x43e2c5||0x1f4;return function(_0x1180ba){logger[_0xc8a4('0x24')](_0x1180ba['stack']);if(_0x1180ba[_0xc8a4('0x25')]){delete _0x1180ba['name'];}_0x2d2c60[_0xc8a4('0x17')](_0x43e2c5)['send'](_0x1180ba);};}exports[_0xc8a4('0x26')]=function(_0x15e012,_0x47fdca){var _0x48ac11={},_0x2fc0fd={},_0x314db1={'count':0x0,'rows':[]};var _0x20bf9b=_[_0xc8a4('0x27')](db[_0xc8a4('0x28')][_0xc8a4('0x29')],function(_0x4cf294){return{'name':_0x4cf294[_0xc8a4('0x2a')],'type':_0x4cf294[_0xc8a4('0x2b')]['key']};});_0x2fc0fd[_0xc8a4('0x2c')]=_[_0xc8a4('0x27')](_0x20bf9b,'name');_0x2fc0fd[_0xc8a4('0x2d')]=_[_0xc8a4('0x2e')](_0x15e012[_0xc8a4('0x2d')]);_0x2fc0fd[_0xc8a4('0x2f')]=_[_0xc8a4('0x30')](_0x2fc0fd[_0xc8a4('0x2c')],_0x2fc0fd[_0xc8a4('0x2d')]);_0x48ac11[_0xc8a4('0x31')]=_[_0xc8a4('0x30')](_0x2fc0fd[_0xc8a4('0x2c')],qs[_0xc8a4('0x32')](_0x15e012['query'][_0xc8a4('0x32')]));_0x48ac11[_0xc8a4('0x31')]=_0x48ac11['attributes'][_0xc8a4('0x33')]?_0x48ac11[_0xc8a4('0x31')]:_0x2fc0fd['model'];if(!_0x15e012[_0xc8a4('0x2d')][_0xc8a4('0x34')]('nolimit')){_0x48ac11[_0xc8a4('0x1c')]=qs[_0xc8a4('0x1c')](_0x15e012[_0xc8a4('0x2d')][_0xc8a4('0x1c')]);_0x48ac11[_0xc8a4('0x1a')]=qs[_0xc8a4('0x1a')](_0x15e012['query'][_0xc8a4('0x1a')]);}_0x48ac11[_0xc8a4('0x35')]=qs[_0xc8a4('0x36')](_0x15e012[_0xc8a4('0x2d')][_0xc8a4('0x36')]);_0x48ac11['where']=qs[_0xc8a4('0x2f')](_[_0xc8a4('0x37')](_0x15e012[_0xc8a4('0x2d')],_0x2fc0fd[_0xc8a4('0x2f')]),_0x20bf9b);if(_0x15e012[_0xc8a4('0x2d')][_0xc8a4('0x38')]){_0x48ac11[_0xc8a4('0x39')]=_[_0xc8a4('0x3a')](_0x48ac11[_0xc8a4('0x39')],{'$or':_[_0xc8a4('0x27')](_0x20bf9b,function(_0x20ab2c){if(_0x20ab2c['type']!==_0xc8a4('0x3b')){var _0x3405df={};_0x3405df[_0x20ab2c[_0xc8a4('0x25')]]={'$like':'%'+_0x15e012['query']['filter']+'%'};return _0x3405df;}})});}_0x48ac11=_['merge']({},_0x48ac11,_0x15e012['options']);var _0x550ced={'where':_0x48ac11[_0xc8a4('0x39')]};return db[_0xc8a4('0x28')][_0xc8a4('0x1d')](_0x550ced)['then'](function(_0x5100f3){_0x314db1[_0xc8a4('0x1d')]=_0x5100f3;if(_0x15e012[_0xc8a4('0x2d')][_0xc8a4('0x3c')]){_0x48ac11[_0xc8a4('0x3d')]=[{'all':!![]}];}return db[_0xc8a4('0x28')][_0xc8a4('0x3e')](_0x48ac11);})[_0xc8a4('0x22')](function(_0x3f58ed){_0x314db1[_0xc8a4('0x3f')]=_0x3f58ed;return _0x314db1;})[_0xc8a4('0x22')](respondWithFilteredResult(_0x47fdca,_0x48ac11))[_0xc8a4('0x40')](handleError(_0x47fdca,null));};exports[_0xc8a4('0x41')]=function(_0x2c1769,_0x248bd5){var _0xe76c63={'raw':![],'where':{'id':_0x2c1769[_0xc8a4('0x42')]['id']}},_0x5749cd={};_0x5749cd[_0xc8a4('0x2c')]=_[_0xc8a4('0x2e')](db[_0xc8a4('0x28')][_0xc8a4('0x29')]);_0x5749cd['query']=_[_0xc8a4('0x2e')](_0x2c1769[_0xc8a4('0x2d')]);_0x5749cd['filters']=_[_0xc8a4('0x30')](_0x5749cd['model'],_0x5749cd[_0xc8a4('0x2d')]);_0xe76c63[_0xc8a4('0x31')]=_[_0xc8a4('0x30')](_0x5749cd[_0xc8a4('0x2c')],qs['fields'](_0x2c1769['query'][_0xc8a4('0x32')]));_0xe76c63['attributes']=_0xe76c63[_0xc8a4('0x31')]['length']?_0xe76c63['attributes']:_0x5749cd['model'];if(_0x2c1769[_0xc8a4('0x2d')][_0xc8a4('0x3c')]){_0xe76c63['include']=[{'all':!![]}];}_0xe76c63=_[_0xc8a4('0x3a')]({},_0xe76c63,_0x2c1769[_0xc8a4('0x43')]);return db[_0xc8a4('0x28')]['find'](_0xe76c63)['then'](handleEntityNotFound(_0x248bd5,null))['then'](respondWithResult(_0x248bd5,null))[_0xc8a4('0x40')](handleError(_0x248bd5,null));};exports[_0xc8a4('0x44')]=function(_0x32a89e,_0x3de88d){return db[_0xc8a4('0x28')][_0xc8a4('0x44')](_0x32a89e['body'],{})[_0xc8a4('0x22')](respondWithResult(_0x3de88d,0xc9))[_0xc8a4('0x40')](handleError(_0x3de88d,null));};exports[_0xc8a4('0x45')]=function(_0x4e5e28,_0x22af3a){if(_0x4e5e28[_0xc8a4('0x46')]['id']){delete _0x4e5e28[_0xc8a4('0x46')]['id'];}return db[_0xc8a4('0x28')][_0xc8a4('0x47')]({'where':{'id':_0x4e5e28[_0xc8a4('0x42')]['id']}})[_0xc8a4('0x22')](handleEntityNotFound(_0x22af3a,null))[_0xc8a4('0x22')](saveUpdates(_0x4e5e28[_0xc8a4('0x46')],null))[_0xc8a4('0x22')](respondWithResult(_0x22af3a,null))[_0xc8a4('0x40')](handleError(_0x22af3a,null));};exports[_0xc8a4('0x23')]=function(_0x1a1ea4,_0x74a076){return db[_0xc8a4('0x28')][_0xc8a4('0x47')]({'where':{'id':_0x1a1ea4[_0xc8a4('0x42')]['id']}})[_0xc8a4('0x22')](handleEntityNotFound(_0x74a076,null))[_0xc8a4('0x22')](removeEntity(_0x74a076,null))['catch'](handleError(_0x74a076,null));};exports[_0xc8a4('0x48')]=function(_0x1ed35b,_0x37133f,_0x526a4f){var _0x15e97d={};var _0xd06f15={};var _0x4e490c;var _0x4d7515;return db[_0xc8a4('0x28')][_0xc8a4('0x49')]({'where':{'id':_0x1ed35b['params']['id']}})['then'](handleEntityNotFound(_0x37133f,null))[_0xc8a4('0x22')](function(_0x5b2c88){if(_0x5b2c88){_0x4e490c=_0x5b2c88;_0xd06f15[_0xc8a4('0x2c')]=_[_0xc8a4('0x2e')](db[_0xc8a4('0x4a')]['rawAttributes']);_0xd06f15[_0xc8a4('0x2d')]=_['keys'](_0x1ed35b[_0xc8a4('0x2d')]);_0xd06f15[_0xc8a4('0x2f')]=_[_0xc8a4('0x30')](_0xd06f15[_0xc8a4('0x2c')],_0xd06f15[_0xc8a4('0x2d')]);_0x15e97d[_0xc8a4('0x31')]=_[_0xc8a4('0x30')](_0xd06f15['model'],qs['fields'](_0x1ed35b[_0xc8a4('0x2d')][_0xc8a4('0x32')]));_0x15e97d[_0xc8a4('0x31')]=_0x15e97d['attributes']['length']?_0x15e97d[_0xc8a4('0x31')]:_0xd06f15[_0xc8a4('0x2c')];_0x15e97d['order']=qs[_0xc8a4('0x36')](_0x1ed35b[_0xc8a4('0x2d')][_0xc8a4('0x36')]);_0x15e97d['where']=qs[_0xc8a4('0x2f')](_[_0xc8a4('0x37')](_0x1ed35b[_0xc8a4('0x2d')],_0xd06f15[_0xc8a4('0x2f')]));if(_0x1ed35b['query']['filter']){_0x15e97d[_0xc8a4('0x39')]=_['merge'](_0x15e97d[_0xc8a4('0x39')],{'$or':_[_0xc8a4('0x27')](_0x15e97d[_0xc8a4('0x31')],function(_0x48f189){var _0x576435={};_0x576435[_0x48f189]={'$like':'%'+_0x1ed35b[_0xc8a4('0x2d')][_0xc8a4('0x38')]+'%'};return _0x576435;})});}_0x15e97d=_['merge']({},_0x15e97d,_0x1ed35b[_0xc8a4('0x43')]);return _0x4e490c['getFields'](_0x15e97d);}})['then'](function(_0x1c2fe1){if(_0x1c2fe1){_0x4d7515=_0x1c2fe1[_0xc8a4('0x33')];if(!_0x1ed35b['query']['hasOwnProperty'](_0xc8a4('0x4b'))){_0x15e97d['limit']=qs['limit'](_0x1ed35b[_0xc8a4('0x2d')][_0xc8a4('0x1c')]);_0x15e97d['offset']=qs['offset'](_0x1ed35b[_0xc8a4('0x2d')][_0xc8a4('0x1a')]);}return _0x4e490c[_0xc8a4('0x48')](_0x15e97d);}})[_0xc8a4('0x22')](function(_0x78e311){if(_0x78e311){return _0x78e311?{'count':_0x4d7515,'rows':_0x78e311}:null;}})[_0xc8a4('0x22')](respondWithResult(_0x37133f,null))[_0xc8a4('0x40')](handleError(_0x37133f,null));};exports[_0xc8a4('0x4c')]=function(_0x43ba72,_0x1e1b03,_0x532936){var _0x235706={};var _0x22ccc1={};var _0x2a1ade;var _0x5815fc;return db[_0xc8a4('0x28')][_0xc8a4('0x49')]({'where':{'id':_0x43ba72[_0xc8a4('0x42')]['id']}})['then'](handleEntityNotFound(_0x1e1b03,null))[_0xc8a4('0x22')](function(_0x4e1978){if(_0x4e1978){_0x2a1ade=_0x4e1978;_0x22ccc1['model']=_[_0xc8a4('0x2e')](db[_0xc8a4('0x4a')]['rawAttributes']);_0x22ccc1[_0xc8a4('0x2d')]=_[_0xc8a4('0x2e')](_0x43ba72['query']);_0x22ccc1[_0xc8a4('0x2f')]=_[_0xc8a4('0x30')](_0x22ccc1[_0xc8a4('0x2c')],_0x22ccc1[_0xc8a4('0x2d')]);_0x235706[_0xc8a4('0x31')]=_[_0xc8a4('0x30')](_0x22ccc1[_0xc8a4('0x2c')],qs[_0xc8a4('0x32')](_0x43ba72['query']['fields']));_0x235706[_0xc8a4('0x31')]=_0x235706[_0xc8a4('0x31')]['length']?_0x235706[_0xc8a4('0x31')]:_0x22ccc1['model'];_0x235706[_0xc8a4('0x35')]=qs[_0xc8a4('0x36')](_0x43ba72[_0xc8a4('0x2d')][_0xc8a4('0x36')]);_0x235706[_0xc8a4('0x39')]=qs[_0xc8a4('0x2f')](_[_0xc8a4('0x37')](_0x43ba72[_0xc8a4('0x2d')],_0x22ccc1['filters']));if(_0x43ba72[_0xc8a4('0x2d')][_0xc8a4('0x38')]){_0x235706[_0xc8a4('0x39')]=_['merge'](_0x235706[_0xc8a4('0x39')],{'$or':_[_0xc8a4('0x27')](_0x235706[_0xc8a4('0x31')],function(_0x2dad82){var _0x42f4c6={};_0x42f4c6[_0x2dad82]={'$like':'%'+_0x43ba72[_0xc8a4('0x2d')][_0xc8a4('0x38')]+'%'};return _0x42f4c6;})});}_0x235706=_['merge']({},_0x235706,_0x43ba72['options']);return _0x2a1ade[_0xc8a4('0x4c')](_0x235706);}})['then'](function(_0x160b3c){if(_0x160b3c){_0x5815fc=_0x160b3c[_0xc8a4('0x33')];if(!_0x43ba72[_0xc8a4('0x2d')][_0xc8a4('0x34')]('nolimit')){_0x235706[_0xc8a4('0x1c')]=qs[_0xc8a4('0x1c')](_0x43ba72['query']['limit']);_0x235706[_0xc8a4('0x1a')]=qs['offset'](_0x43ba72[_0xc8a4('0x2d')]['offset']);}return _0x2a1ade[_0xc8a4('0x4c')](_0x235706);}})[_0xc8a4('0x22')](function(_0x311115){if(_0x311115){return _0x311115?{'count':_0x5815fc,'rows':_0x311115}:null;}})['then'](respondWithResult(_0x1e1b03,null))[_0xc8a4('0x40')](handleError(_0x1e1b03,null));};exports[_0xc8a4('0x4d')]=function(_0x21c326,_0x23b255,_0x3009ae){var _0xcfdf71={};var _0x40aafe={};var _0xc658f4;var _0x18820f;return db[_0xc8a4('0x28')][_0xc8a4('0x49')]({'where':{'id':_0x21c326[_0xc8a4('0x42')]['id']}})[_0xc8a4('0x22')](handleEntityNotFound(_0x23b255,null))[_0xc8a4('0x22')](function(_0x5414c3){if(_0x5414c3){_0xc658f4=_0x5414c3;_0x40aafe['model']=_[_0xc8a4('0x2e')](db[_0xc8a4('0x4a')]['rawAttributes']);_0x40aafe[_0xc8a4('0x2d')]=_['keys'](_0x21c326[_0xc8a4('0x2d')]);_0x40aafe[_0xc8a4('0x2f')]=_['intersection'](_0x40aafe[_0xc8a4('0x2c')],_0x40aafe[_0xc8a4('0x2d')]);_0xcfdf71['attributes']=_[_0xc8a4('0x30')](_0x40aafe[_0xc8a4('0x2c')],qs[_0xc8a4('0x32')](_0x21c326[_0xc8a4('0x2d')][_0xc8a4('0x32')]));_0xcfdf71[_0xc8a4('0x31')]=_0xcfdf71[_0xc8a4('0x31')][_0xc8a4('0x33')]?_0xcfdf71['attributes']:_0x40aafe[_0xc8a4('0x2c')];_0xcfdf71[_0xc8a4('0x35')]=qs[_0xc8a4('0x36')](_0x21c326[_0xc8a4('0x2d')][_0xc8a4('0x36')]);_0xcfdf71['where']=qs['filters'](_[_0xc8a4('0x37')](_0x21c326[_0xc8a4('0x2d')],_0x40aafe[_0xc8a4('0x2f')]));if(_0x21c326[_0xc8a4('0x2d')][_0xc8a4('0x38')]){_0xcfdf71[_0xc8a4('0x39')]=_[_0xc8a4('0x3a')](_0xcfdf71[_0xc8a4('0x39')],{'$or':_[_0xc8a4('0x27')](_0xcfdf71[_0xc8a4('0x31')],function(_0x52592f){var _0x495d94={};_0x495d94[_0x52592f]={'$like':'%'+_0x21c326['query']['filter']+'%'};return _0x495d94;})});}_0xcfdf71=_[_0xc8a4('0x3a')]({},_0xcfdf71,_0x21c326[_0xc8a4('0x43')]);return _0xc658f4[_0xc8a4('0x4d')](_0xcfdf71);}})['then'](function(_0x3f7af7){if(_0x3f7af7){_0x18820f=_0x3f7af7[_0xc8a4('0x33')];if(!_0x21c326[_0xc8a4('0x2d')][_0xc8a4('0x34')](_0xc8a4('0x4b'))){_0xcfdf71[_0xc8a4('0x1c')]=qs[_0xc8a4('0x1c')](_0x21c326[_0xc8a4('0x2d')][_0xc8a4('0x1c')]);_0xcfdf71['offset']=qs[_0xc8a4('0x1a')](_0x21c326[_0xc8a4('0x2d')][_0xc8a4('0x1a')]);}return _0xc658f4['getDescriptions'](_0xcfdf71);}})[_0xc8a4('0x22')](function(_0x151085){if(_0x151085){return _0x151085?{'count':_0x18820f,'rows':_0x151085}:null;}})[_0xc8a4('0x22')](respondWithResult(_0x23b255,null))[_0xc8a4('0x40')](handleError(_0x23b255,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 08916b0..35e9115 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 _0x9c44=['request-promise','path','./intDynamics365Configuration.attributes','define','Dynamics365Configuration','int_dynamics365_configurations','../../config/logger','api','moment','bluebird'];(function(_0x519519,_0xcfe8ed){var _0x4d72e8=function(_0xc8aeeb){while(--_0xc8aeeb){_0x519519['push'](_0x519519['shift']());}};_0x4d72e8(++_0xcfe8ed);}(_0x9c44,0x178));var _0x49c4=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x9c44[_0x4b055c];return _0x4b62bb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe5b3=['request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','int_dynamics365_configurations','util','../../config/logger','api','moment','bluebird'];(function(_0x256422,_0x367394){var _0x55dddc=function(_0x1594bc){while(--_0x1594bc){_0x256422['push'](_0x256422['shift']());}};_0x55dddc(++_0x367394);}(_0xe5b3,0x133));var _0x3e5b=function(_0x7c5b9f,_0x3bf190){_0x7c5b9f=_0x7c5b9f-0x0;var _0x1a086d=_0xe5b3[_0x7c5b9f];return _0x1a086d;};'use strict';var _=require('lodash');var util=require(_0x3e5b('0x0'));var logger=require(_0x3e5b('0x1'))(_0x3e5b('0x2'));var moment=require(_0x3e5b('0x3'));var BPromise=require(_0x3e5b('0x4'));var rp=require(_0x3e5b('0x5'));var fs=require('fs');var path=require(_0x3e5b('0x6'));var rimraf=require(_0x3e5b('0x7'));var config=require(_0x3e5b('0x8'));var attributes=require(_0x3e5b('0x9'));module[_0x3e5b('0xa')]=function(_0x54e1fb,_0x174923){return _0x54e1fb[_0x3e5b('0xb')]('Dynamics365Configuration',attributes,{'tableName':_0x3e5b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 259611f..fcf477e 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 _0x5479=['message','Dynamics365Configuration,\x20%s,\x20%s','result','catch','moment','randomstring','../../mysqldb','../../config/utils','rpc','request','then','info','debug','request\x20sent','stringify','error'];(function(_0x5caec8,_0x463cdc){var _0x55835f=function(_0x977615){while(--_0x977615){_0x5caec8['push'](_0x5caec8['shift']());}};_0x55835f(++_0x463cdc);}(_0x5479,0x1b4));var _0x9547=function(_0x2d0228,_0x54bc6c){_0x2d0228=_0x2d0228-0x0;var _0x8a96e=_0x5479[_0x2d0228];return _0x8a96e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9547('0x0'));var BPromise=require('bluebird');var rs=require(_0x9547('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9547('0x2'))['db'];var utils=require(_0x9547('0x3'));var logger=require('../../config/logger')(_0x9547('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2dc095,_0xde2bf3,_0x136088){return new BPromise(function(_0x26811b,_0x3b8e44){return client[_0x9547('0x5')](_0x2dc095,_0x136088)[_0x9547('0x6')](function(_0x235685){logger[_0x9547('0x7')]('Dynamics365Configuration,\x20%s,\x20%s',_0xde2bf3,'request\x20sent');logger[_0x9547('0x8')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0xde2bf3,_0x9547('0x9'),JSON[_0x9547('0xa')](_0x235685));if(_0x235685['error']){if(_0x235685[_0x9547('0xb')]['code']===0x1f4){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0xde2bf3,_0x235685['error'][_0x9547('0xc')]);return _0x3b8e44(_0x235685[_0x9547('0xb')]['message']);}logger[_0x9547('0xb')](_0x9547('0xd'),_0xde2bf3,_0x235685[_0x9547('0xb')][_0x9547('0xc')]);return _0x26811b(_0x235685[_0x9547('0xb')][_0x9547('0xc')]);}else{logger[_0x9547('0x7')](_0x9547('0xd'),_0xde2bf3,'request\x20sent');_0x26811b(_0x235685[_0x9547('0xe')][_0x9547('0xc')]);}})[_0x9547('0xf')](function(_0x1b4848){logger[_0x9547('0xb')](_0x9547('0xd'),_0xde2bf3,_0x1b4848);_0x3b8e44(_0x1b4848);});});} \ No newline at end of file +var _0xdcce=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x4dda52,_0x518b89){var _0x44a777=function(_0x5be2bd){while(--_0x5be2bd){_0x4dda52['push'](_0x4dda52['shift']());}};_0x44a777(++_0x518b89);}(_0xdcce,0x11a));var _0xedcc=function(_0x387363,_0xd5dc2){_0x387363=_0x387363-0x0;var _0x4aeae3=_0xdcce[_0x387363];return _0x4aeae3;};'use strict';var _=require('lodash');var util=require(_0xedcc('0x0'));var moment=require(_0xedcc('0x1'));var BPromise=require(_0xedcc('0x2'));var rs=require(_0xedcc('0x3'));var fs=require('fs');var Redis=require(_0xedcc('0x4'));var db=require(_0xedcc('0x5'))['db'];var utils=require(_0xedcc('0x6'));var logger=require(_0xedcc('0x7'))(_0xedcc('0x8'));var config=require(_0xedcc('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xedcc('0xa')][_0xedcc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4455e5,_0x5cb4f1,_0x19af37){return new BPromise(function(_0x10bb73,_0x4e3f44){return client[_0xedcc('0xc')](_0x4455e5,_0x19af37)[_0xedcc('0xd')](function(_0x5d3b07){logger['info'](_0xedcc('0xe'),_0x5cb4f1,_0xedcc('0xf'));logger[_0xedcc('0x10')](_0xedcc('0x11'),_0x5cb4f1,_0xedcc('0xf'),JSON['stringify'](_0x5d3b07));if(_0x5d3b07[_0xedcc('0x12')]){if(_0x5d3b07['error']['code']===0x1f4){logger[_0xedcc('0x12')](_0xedcc('0xe'),_0x5cb4f1,_0x5d3b07[_0xedcc('0x12')][_0xedcc('0x13')]);return _0x4e3f44(_0x5d3b07[_0xedcc('0x12')][_0xedcc('0x13')]);}logger['error'](_0xedcc('0xe'),_0x5cb4f1,_0x5d3b07[_0xedcc('0x12')][_0xedcc('0x13')]);return _0x10bb73(_0x5d3b07[_0xedcc('0x12')][_0xedcc('0x13')]);}else{logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x5cb4f1,_0xedcc('0xf'));_0x10bb73(_0x5d3b07[_0xedcc('0x14')][_0xedcc('0x13')]);}})[_0xedcc('0x15')](function(_0x156de1){logger[_0xedcc('0x12')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5cb4f1,_0x156de1);_0x4e3f44(_0x156de1);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index a75e620..b1c6328 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 _0x873a=['path','connect-timeout','../../components/auth/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','show','post','create','/:id','destroy','multer','util'];(function(_0x48eff8,_0x175830){var _0x570747=function(_0x3afa8b){while(--_0x3afa8b){_0x48eff8['push'](_0x48eff8['shift']());}};_0x570747(++_0x175830);}(_0x873a,0xa3));var _0xa873=function(_0x10a3db,_0x52dab5){_0x10a3db=_0x10a3db-0x0;var _0x167b43=_0x873a[_0x10a3db];return _0x167b43;};'use strict';var multer=require(_0xa873('0x0'));var util=require(_0xa873('0x1'));var path=require(_0xa873('0x2'));var timeout=require(_0xa873('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa873('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa873('0x5'));var controller=require(_0xa873('0x6'));router[_0xa873('0x7')]('/',auth[_0xa873('0x8')](),controller[_0xa873('0x9')]);router['get']('/:id',auth[_0xa873('0x8')](),controller[_0xa873('0xa')]);router[_0xa873('0xb')]('/',auth[_0xa873('0x8')](),controller[_0xa873('0xc')]);router['put'](_0xa873('0xd'),auth[_0xa873('0x8')](),controller['update']);router['delete'](_0xa873('0xd'),auth[_0xa873('0x8')](),controller[_0xa873('0xe')]);module['exports']=router; \ No newline at end of file +var _0x98c9=['delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','post','create','put','update'];(function(_0x25248b,_0x3c8491){var _0x509939=function(_0x457a27){while(--_0x457a27){_0x25248b['push'](_0x25248b['shift']());}};_0x509939(++_0x3c8491);}(_0x98c9,0x19b));var _0x998c=function(_0x326e79,_0x33dc91){_0x326e79=_0x326e79-0x0;var _0x37eb89=_0x98c9[_0x326e79];return _0x37eb89;};'use strict';var multer=require(_0x998c('0x0'));var util=require(_0x998c('0x1'));var path=require('path');var timeout=require(_0x998c('0x2'));var express=require(_0x998c('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x998c('0x4'));var interaction=require(_0x998c('0x5'));var config=require('../../config/environment');var controller=require('./intDynamics365Field.controller');router[_0x998c('0x6')]('/',auth[_0x998c('0x7')](),controller[_0x998c('0x8')]);router[_0x998c('0x6')]('/:id',auth[_0x998c('0x7')](),controller[_0x998c('0x9')]);router[_0x998c('0xa')]('/',auth['isAuthenticated'](),controller[_0x998c('0xb')]);router[_0x998c('0xc')]('/:id',auth[_0x998c('0x7')](),controller[_0x998c('0xd')]);router[_0x998c('0xe')]('/:id',auth[_0x998c('0x7')](),controller[_0x998c('0xf')]);module[_0x998c('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index fe28a46..be50c7d 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 _0x01d2=['customVariable','keyValue','picklist','string','STRING','variable','BOOLEAN','sequelize','ENUM'];(function(_0x31d5de,_0x49c253){var _0x44f263=function(_0x294391){while(--_0x294391){_0x31d5de['push'](_0x31d5de['shift']());}};_0x44f263(++_0x49c253);}(_0x01d2,0x181));var _0x201d=function(_0x59f940,_0x200a1c){_0x59f940=_0x59f940-0x0;var _0x1179d2=_0x01d2[_0x59f940];return _0x1179d2;};'use strict';var Sequelize=require(_0x201d('0x0'));module['exports']={'type':{'type':Sequelize[_0x201d('0x1')]('string','variable',_0x201d('0x2'),_0x201d('0x3'),_0x201d('0x4')),'defaultValue':_0x201d('0x5')},'content':{'type':Sequelize[_0x201d('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x201d('0x1')]('string',_0x201d('0x7'),_0x201d('0x2'))},'keyContent':{'type':Sequelize[_0x201d('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x201d('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x201d('0x6')]}}; \ No newline at end of file +var _0xf237=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x30de31,_0x3e36fa){var _0x418371=function(_0x25ffd8){while(--_0x25ffd8){_0x30de31['push'](_0x30de31['shift']());}};_0x418371(++_0x3e36fa);}(_0xf237,0x1d6));var _0x7f23=function(_0x5dbbbe,_0x44c170){_0x5dbbbe=_0x5dbbbe-0x0;var _0x2cb72b=_0xf237[_0x5dbbbe];return _0x2cb72b;};'use strict';var Sequelize=require(_0x7f23('0x0'));module[_0x7f23('0x1')]={'type':{'type':Sequelize[_0x7f23('0x2')](_0x7f23('0x3'),_0x7f23('0x4'),_0x7f23('0x5'),_0x7f23('0x6'),_0x7f23('0x7')),'defaultValue':_0x7f23('0x3')},'content':{'type':Sequelize[_0x7f23('0x8')]},'key':{'type':Sequelize[_0x7f23('0x8')]},'keyType':{'type':Sequelize[_0x7f23('0x2')]('string','variable',_0x7f23('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x7f23('0x8')]},'nameField':{'type':Sequelize[_0x7f23('0x8')]},'customField':{'type':Sequelize[_0x7f23('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7f23('0x8')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index acb7b50..4d17709 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 _0xc022=['fieldName','key','model','query','filters','attributes','intersection','fields','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','include','catch','show','keys','rawAttributes','length','includeAll','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','reject','save','update','then','destroy','error','stack','name','send','index','map','Dynamics365Field'];(function(_0x1eded9,_0xfa0c6e){var _0x19c721=function(_0x4f894f){while(--_0x4f894f){_0x1eded9['push'](_0x1eded9['shift']());}};_0x19c721(++_0xfa0c6e);}(_0xc022,0x141));var _0x2c02=function(_0x58965a,_0x2e71db){_0x58965a=_0x58965a-0x0;var _0x254efc=_0xc022[_0x58965a];return _0x254efc;};'use strict';var emlformat=require(_0x2c02('0x0'));var rimraf=require(_0x2c02('0x1'));var zipdir=require(_0x2c02('0x2'));var jsonpatch=require(_0x2c02('0x3'));var rp=require('request-promise');var moment=require(_0x2c02('0x4'));var BPromise=require(_0x2c02('0x5'));var Mustache=require(_0x2c02('0x6'));var util=require('util');var path=require(_0x2c02('0x7'));var sox=require(_0x2c02('0x8'));var csv=require(_0x2c02('0x9'));var ejs=require(_0x2c02('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2c02('0xb'));var squel=require(_0x2c02('0xc'));var crypto=require(_0x2c02('0xd'));var jsforce=require(_0x2c02('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x2c02('0x9'));var querystring=require(_0x2c02('0xf'));var Papa=require('papaparse');var Redis=require(_0x2c02('0x10'));var authService=require(_0x2c02('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2c02('0x12'));var logger=require(_0x2c02('0x13'))(_0x2c02('0x14'));var utils=require(_0x2c02('0x15'));var config=require(_0x2c02('0x16'));var licenseUtil=require(_0x2c02('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5bd290,_0xa234a4){_0xa234a4=_0xa234a4||0xcc;return function(_0x10cef8){if(_0x10cef8){return _0x5bd290[_0x2c02('0x18')](_0xa234a4);}return _0x5bd290[_0x2c02('0x19')](_0xa234a4)[_0x2c02('0x1a')]();};}function respondWithResult(_0x53cf4d,_0x3e9bf6){_0x3e9bf6=_0x3e9bf6||0xc8;return function(_0x3c9bc5){if(_0x3c9bc5){return _0x53cf4d[_0x2c02('0x19')](_0x3e9bf6)[_0x2c02('0x1b')](_0x3c9bc5);}};}function respondWithFilteredResult(_0x526c41,_0x3eb4e4){return function(_0x289032){if(_0x289032){var _0x26c2d1=typeof _0x3eb4e4['offset']===_0x2c02('0x1c')&&typeof _0x3eb4e4[_0x2c02('0x1d')]===_0x2c02('0x1c');var _0x5a3534=_0x289032[_0x2c02('0x1e')];var _0x2c6369=_0x26c2d1?0x0:_0x3eb4e4[_0x2c02('0x1f')];var _0x5c2891=_0x26c2d1?_0x289032[_0x2c02('0x1e')]:_0x3eb4e4[_0x2c02('0x1f')]+_0x3eb4e4['limit'];var _0x1a85ce;if(_0x5c2891>=_0x5a3534){_0x5c2891=_0x5a3534;_0x1a85ce=0xc8;}else{_0x1a85ce=0xce;}_0x526c41['status'](_0x1a85ce);return _0x526c41['set']('Content-Range',_0x2c6369+'-'+_0x5c2891+'/'+_0x5a3534)['json'](_0x289032);}return null;};}function patchUpdates(_0x3f3d7e){return function(_0x45d3e4){try{jsonpatch['apply'](_0x45d3e4,_0x3f3d7e,!![]);}catch(_0x3533d4){return BPromise[_0x2c02('0x20')](_0x3533d4);}return _0x45d3e4[_0x2c02('0x21')]();};}function saveUpdates(_0x2675a5,_0x2accc0){return function(_0x38a8ea){if(_0x38a8ea){return _0x38a8ea[_0x2c02('0x22')](_0x2675a5)[_0x2c02('0x23')](function(_0x5ccdae){return _0x5ccdae;});}return null;};}function removeEntity(_0x5765cd,_0x28d214){return function(_0x3af360){if(_0x3af360){return _0x3af360[_0x2c02('0x24')]()['then'](function(){_0x5765cd[_0x2c02('0x19')](0xcc)[_0x2c02('0x1a')]();});}};}function handleEntityNotFound(_0xff03f4,_0x596d17){return function(_0xa3b1ab){if(!_0xa3b1ab){_0xff03f4[_0x2c02('0x18')](0x194);}return _0xa3b1ab;};}function handleError(_0x1c9086,_0x539af0){_0x539af0=_0x539af0||0x1f4;return function(_0xde6b15){logger[_0x2c02('0x25')](_0xde6b15[_0x2c02('0x26')]);if(_0xde6b15[_0x2c02('0x27')]){delete _0xde6b15[_0x2c02('0x27')];}_0x1c9086[_0x2c02('0x19')](_0x539af0)[_0x2c02('0x28')](_0xde6b15);};}exports[_0x2c02('0x29')]=function(_0xbb009c,_0x4f8bc1){var _0x2e85bb={},_0x167c7d={},_0x48cf99={'count':0x0,'rows':[]};var _0x2c5d69=_[_0x2c02('0x2a')](db[_0x2c02('0x2b')]['rawAttributes'],function(_0x3f1434){return{'name':_0x3f1434[_0x2c02('0x2c')],'type':_0x3f1434['type'][_0x2c02('0x2d')]};});_0x167c7d[_0x2c02('0x2e')]=_['map'](_0x2c5d69,_0x2c02('0x27'));_0x167c7d[_0x2c02('0x2f')]=_['keys'](_0xbb009c[_0x2c02('0x2f')]);_0x167c7d[_0x2c02('0x30')]=_['intersection'](_0x167c7d['model'],_0x167c7d[_0x2c02('0x2f')]);_0x2e85bb[_0x2c02('0x31')]=_[_0x2c02('0x32')](_0x167c7d[_0x2c02('0x2e')],qs[_0x2c02('0x33')](_0xbb009c['query'][_0x2c02('0x33')]));_0x2e85bb[_0x2c02('0x31')]=_0x2e85bb['attributes']['length']?_0x2e85bb[_0x2c02('0x31')]:_0x167c7d[_0x2c02('0x2e')];if(!_0xbb009c['query']['hasOwnProperty'](_0x2c02('0x34'))){_0x2e85bb[_0x2c02('0x1d')]=qs[_0x2c02('0x1d')](_0xbb009c['query'][_0x2c02('0x1d')]);_0x2e85bb[_0x2c02('0x1f')]=qs[_0x2c02('0x1f')](_0xbb009c[_0x2c02('0x2f')]['offset']);}_0x2e85bb[_0x2c02('0x35')]=qs[_0x2c02('0x36')](_0xbb009c[_0x2c02('0x2f')][_0x2c02('0x36')]);_0x2e85bb['where']=qs[_0x2c02('0x30')](_[_0x2c02('0x37')](_0xbb009c[_0x2c02('0x2f')],_0x167c7d[_0x2c02('0x30')]),_0x2c5d69);if(_0xbb009c[_0x2c02('0x2f')][_0x2c02('0x38')]){_0x2e85bb[_0x2c02('0x39')]=_['merge'](_0x2e85bb[_0x2c02('0x39')],{'$or':_['map'](_0x2c5d69,function(_0x292b02){if(_0x292b02[_0x2c02('0x3a')]!==_0x2c02('0x3b')){var _0x51098c={};_0x51098c[_0x292b02['name']]={'$like':'%'+_0xbb009c[_0x2c02('0x2f')]['filter']+'%'};return _0x51098c;}})});}_0x2e85bb=_[_0x2c02('0x3c')]({},_0x2e85bb,_0xbb009c[_0x2c02('0x3d')]);var _0x25a16d={'where':_0x2e85bb[_0x2c02('0x39')]};return db[_0x2c02('0x2b')][_0x2c02('0x1e')](_0x25a16d)[_0x2c02('0x23')](function(_0x56afce){_0x48cf99['count']=_0x56afce;if(_0xbb009c[_0x2c02('0x2f')]['includeAll']){_0x2e85bb[_0x2c02('0x3e')]=[{'all':!![]}];}return db[_0x2c02('0x2b')]['findAll'](_0x2e85bb);})['then'](function(_0xa1cf01){_0x48cf99['rows']=_0xa1cf01;return _0x48cf99;})[_0x2c02('0x23')](respondWithFilteredResult(_0x4f8bc1,_0x2e85bb))[_0x2c02('0x3f')](handleError(_0x4f8bc1,null));};exports[_0x2c02('0x40')]=function(_0x18e364,_0x2eed47){var _0x5dd4df={'raw':!![],'where':{'id':_0x18e364['params']['id']}},_0x435989={};_0x435989[_0x2c02('0x2e')]=_[_0x2c02('0x41')](db['Dynamics365Field'][_0x2c02('0x42')]);_0x435989['query']=_[_0x2c02('0x41')](_0x18e364[_0x2c02('0x2f')]);_0x435989['filters']=_[_0x2c02('0x32')](_0x435989[_0x2c02('0x2e')],_0x435989[_0x2c02('0x2f')]);_0x5dd4df['attributes']=_['intersection'](_0x435989[_0x2c02('0x2e')],qs[_0x2c02('0x33')](_0x18e364['query'][_0x2c02('0x33')]));_0x5dd4df[_0x2c02('0x31')]=_0x5dd4df[_0x2c02('0x31')][_0x2c02('0x43')]?_0x5dd4df[_0x2c02('0x31')]:_0x435989[_0x2c02('0x2e')];if(_0x18e364[_0x2c02('0x2f')][_0x2c02('0x44')]){_0x5dd4df[_0x2c02('0x3e')]=[{'all':!![]}];}_0x5dd4df=_[_0x2c02('0x3c')]({},_0x5dd4df,_0x18e364[_0x2c02('0x3d')]);return db[_0x2c02('0x2b')][_0x2c02('0x45')](_0x5dd4df)['then'](handleEntityNotFound(_0x2eed47,null))[_0x2c02('0x23')](respondWithResult(_0x2eed47,null))['catch'](handleError(_0x2eed47,null));};exports[_0x2c02('0x46')]=function(_0x521e9b,_0x2792b7){return db['Dynamics365Field'][_0x2c02('0x46')](_0x521e9b[_0x2c02('0x47')],{})[_0x2c02('0x23')](respondWithResult(_0x2792b7,0xc9))[_0x2c02('0x3f')](handleError(_0x2792b7,null));};exports[_0x2c02('0x22')]=function(_0x56dd8f,_0x873aaf){if(_0x56dd8f[_0x2c02('0x47')]['id']){delete _0x56dd8f[_0x2c02('0x47')]['id'];}return db[_0x2c02('0x2b')][_0x2c02('0x45')]({'where':{'id':_0x56dd8f[_0x2c02('0x48')]['id']}})[_0x2c02('0x23')](handleEntityNotFound(_0x873aaf,null))[_0x2c02('0x23')](saveUpdates(_0x56dd8f[_0x2c02('0x47')],null))[_0x2c02('0x23')](respondWithResult(_0x873aaf,null))['catch'](handleError(_0x873aaf,null));};exports[_0x2c02('0x24')]=function(_0x4de0e2,_0x276568){return db[_0x2c02('0x2b')][_0x2c02('0x45')]({'where':{'id':_0x4de0e2[_0x2c02('0x48')]['id']}})[_0x2c02('0x23')](handleEntityNotFound(_0x276568,null))[_0x2c02('0x23')](removeEntity(_0x276568,null))[_0x2c02('0x3f')](handleError(_0x276568,null));}; \ No newline at end of file +var _0x3986=['../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x1ad487,_0x3e711d){var _0x39d539=function(_0x408f9c){while(--_0x408f9c){_0x1ad487['push'](_0x1ad487['shift']());}};_0x39d539(++_0x3e711d);}(_0x3986,0x1a2));var _0x6398=function(_0x2940c1,_0x3f8dc1){_0x2940c1=_0x2940c1-0x0;var _0xd59d9c=_0x3986[_0x2940c1];return _0xd59d9c;};'use strict';var emlformat=require(_0x6398('0x0'));var rimraf=require(_0x6398('0x1'));var zipdir=require(_0x6398('0x2'));var jsonpatch=require(_0x6398('0x3'));var rp=require(_0x6398('0x4'));var moment=require('moment');var BPromise=require(_0x6398('0x5'));var Mustache=require('mustache');var util=require(_0x6398('0x6'));var path=require('path');var sox=require(_0x6398('0x7'));var csv=require(_0x6398('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6398('0x9'));var squel=require('squel');var crypto=require(_0x6398('0xa'));var jsforce=require(_0x6398('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x6398('0x8'));var querystring=require(_0x6398('0xc'));var Papa=require(_0x6398('0xd'));var Redis=require('ioredis');var authService=require(_0x6398('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x6398('0xf'));var hardwareService=require(_0x6398('0x10'));var logger=require(_0x6398('0x11'))(_0x6398('0x12'));var utils=require(_0x6398('0x13'));var config=require(_0x6398('0x14'));var licenseUtil=require(_0x6398('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d9988,_0x543fa0){_0x543fa0=_0x543fa0||0xcc;return function(_0x14f2fa){if(_0x14f2fa){return _0x3d9988[_0x6398('0x16')](_0x543fa0);}return _0x3d9988['status'](_0x543fa0)[_0x6398('0x17')]();};}function respondWithResult(_0x1be28c,_0x425fb7){_0x425fb7=_0x425fb7||0xc8;return function(_0x4d9a5e){if(_0x4d9a5e){return _0x1be28c[_0x6398('0x18')](_0x425fb7)[_0x6398('0x19')](_0x4d9a5e);}};}function respondWithFilteredResult(_0x2880d0,_0x400bdd){return function(_0x311da2){if(_0x311da2){var _0x3926a5=typeof _0x400bdd['offset']===_0x6398('0x1a')&&typeof _0x400bdd['limit']===_0x6398('0x1a');var _0x4b0fe1=_0x311da2[_0x6398('0x1b')];var _0x3f00ea=_0x3926a5?0x0:_0x400bdd[_0x6398('0x1c')];var _0x39b9a2=_0x3926a5?_0x311da2[_0x6398('0x1b')]:_0x400bdd['offset']+_0x400bdd[_0x6398('0x1d')];var _0x5d2e10;if(_0x39b9a2>=_0x4b0fe1){_0x39b9a2=_0x4b0fe1;_0x5d2e10=0xc8;}else{_0x5d2e10=0xce;}_0x2880d0[_0x6398('0x18')](_0x5d2e10);return _0x2880d0[_0x6398('0x1e')](_0x6398('0x1f'),_0x3f00ea+'-'+_0x39b9a2+'/'+_0x4b0fe1)['json'](_0x311da2);}return null;};}function patchUpdates(_0x37b41b){return function(_0x15cc83){try{jsonpatch[_0x6398('0x20')](_0x15cc83,_0x37b41b,!![]);}catch(_0x10e5a3){return BPromise[_0x6398('0x21')](_0x10e5a3);}return _0x15cc83[_0x6398('0x22')]();};}function saveUpdates(_0x41ea97,_0x2d2023){return function(_0x189b2e){if(_0x189b2e){return _0x189b2e[_0x6398('0x23')](_0x41ea97)[_0x6398('0x24')](function(_0x1687c4){return _0x1687c4;});}return null;};}function removeEntity(_0x137cdd,_0x1b3cdd){return function(_0x51e1bc){if(_0x51e1bc){return _0x51e1bc[_0x6398('0x25')]()['then'](function(){_0x137cdd['status'](0xcc)[_0x6398('0x17')]();});}};}function handleEntityNotFound(_0x8af719,_0x568d6e){return function(_0x2196cd){if(!_0x2196cd){_0x8af719['sendStatus'](0x194);}return _0x2196cd;};}function handleError(_0x46f3f0,_0x37ff54){_0x37ff54=_0x37ff54||0x1f4;return function(_0xb92de6){logger[_0x6398('0x26')](_0xb92de6[_0x6398('0x27')]);if(_0xb92de6['name']){delete _0xb92de6[_0x6398('0x28')];}_0x46f3f0['status'](_0x37ff54)[_0x6398('0x29')](_0xb92de6);};}exports['index']=function(_0x3e09dc,_0x4eebcb){var _0x2b0895={},_0x4a7042={},_0x48ddf8={'count':0x0,'rows':[]};var _0x357bc7=_[_0x6398('0x2a')](db[_0x6398('0x2b')][_0x6398('0x2c')],function(_0x15c44d){return{'name':_0x15c44d[_0x6398('0x2d')],'type':_0x15c44d[_0x6398('0x2e')][_0x6398('0x2f')]};});_0x4a7042[_0x6398('0x30')]=_[_0x6398('0x2a')](_0x357bc7,_0x6398('0x28'));_0x4a7042[_0x6398('0x31')]=_[_0x6398('0x32')](_0x3e09dc[_0x6398('0x31')]);_0x4a7042[_0x6398('0x33')]=_[_0x6398('0x34')](_0x4a7042[_0x6398('0x30')],_0x4a7042[_0x6398('0x31')]);_0x2b0895[_0x6398('0x35')]=_[_0x6398('0x34')](_0x4a7042['model'],qs[_0x6398('0x36')](_0x3e09dc[_0x6398('0x31')][_0x6398('0x36')]));_0x2b0895[_0x6398('0x35')]=_0x2b0895[_0x6398('0x35')][_0x6398('0x37')]?_0x2b0895[_0x6398('0x35')]:_0x4a7042['model'];if(!_0x3e09dc['query']['hasOwnProperty'](_0x6398('0x38'))){_0x2b0895[_0x6398('0x1d')]=qs[_0x6398('0x1d')](_0x3e09dc[_0x6398('0x31')]['limit']);_0x2b0895[_0x6398('0x1c')]=qs[_0x6398('0x1c')](_0x3e09dc['query'][_0x6398('0x1c')]);}_0x2b0895[_0x6398('0x39')]=qs[_0x6398('0x3a')](_0x3e09dc['query'][_0x6398('0x3a')]);_0x2b0895[_0x6398('0x3b')]=qs[_0x6398('0x33')](_['pick'](_0x3e09dc['query'],_0x4a7042['filters']),_0x357bc7);if(_0x3e09dc[_0x6398('0x31')][_0x6398('0x3c')]){_0x2b0895['where']=_[_0x6398('0x3d')](_0x2b0895[_0x6398('0x3b')],{'$or':_['map'](_0x357bc7,function(_0x5da619){if(_0x5da619['type']!==_0x6398('0x3e')){var _0x301b39={};_0x301b39[_0x5da619['name']]={'$like':'%'+_0x3e09dc[_0x6398('0x31')][_0x6398('0x3c')]+'%'};return _0x301b39;}})});}_0x2b0895=_[_0x6398('0x3d')]({},_0x2b0895,_0x3e09dc[_0x6398('0x3f')]);var _0x3e2964={'where':_0x2b0895[_0x6398('0x3b')]};return db[_0x6398('0x2b')][_0x6398('0x1b')](_0x3e2964)['then'](function(_0x54d889){_0x48ddf8[_0x6398('0x1b')]=_0x54d889;if(_0x3e09dc['query'][_0x6398('0x40')]){_0x2b0895['include']=[{'all':!![]}];}return db[_0x6398('0x2b')][_0x6398('0x41')](_0x2b0895);})[_0x6398('0x24')](function(_0xfcd83b){_0x48ddf8[_0x6398('0x42')]=_0xfcd83b;return _0x48ddf8;})[_0x6398('0x24')](respondWithFilteredResult(_0x4eebcb,_0x2b0895))[_0x6398('0x43')](handleError(_0x4eebcb,null));};exports['show']=function(_0x3b78b8,_0x4c42a0){var _0x2612fb={'raw':!![],'where':{'id':_0x3b78b8[_0x6398('0x44')]['id']}},_0x15b2f1={};_0x15b2f1[_0x6398('0x30')]=_[_0x6398('0x32')](db[_0x6398('0x2b')][_0x6398('0x2c')]);_0x15b2f1[_0x6398('0x31')]=_[_0x6398('0x32')](_0x3b78b8['query']);_0x15b2f1[_0x6398('0x33')]=_[_0x6398('0x34')](_0x15b2f1[_0x6398('0x30')],_0x15b2f1[_0x6398('0x31')]);_0x2612fb['attributes']=_['intersection'](_0x15b2f1[_0x6398('0x30')],qs[_0x6398('0x36')](_0x3b78b8['query'][_0x6398('0x36')]));_0x2612fb[_0x6398('0x35')]=_0x2612fb['attributes'][_0x6398('0x37')]?_0x2612fb['attributes']:_0x15b2f1[_0x6398('0x30')];if(_0x3b78b8[_0x6398('0x31')]['includeAll']){_0x2612fb[_0x6398('0x45')]=[{'all':!![]}];}_0x2612fb=_['merge']({},_0x2612fb,_0x3b78b8[_0x6398('0x3f')]);return db[_0x6398('0x2b')][_0x6398('0x46')](_0x2612fb)[_0x6398('0x24')](handleEntityNotFound(_0x4c42a0,null))['then'](respondWithResult(_0x4c42a0,null))[_0x6398('0x43')](handleError(_0x4c42a0,null));};exports[_0x6398('0x47')]=function(_0x2714b8,_0x3ff510){return db[_0x6398('0x2b')][_0x6398('0x47')](_0x2714b8['body'],{})[_0x6398('0x24')](respondWithResult(_0x3ff510,0xc9))[_0x6398('0x43')](handleError(_0x3ff510,null));};exports['update']=function(_0x420e1c,_0x54772c){if(_0x420e1c[_0x6398('0x48')]['id']){delete _0x420e1c['body']['id'];}return db[_0x6398('0x2b')][_0x6398('0x46')]({'where':{'id':_0x420e1c[_0x6398('0x44')]['id']}})[_0x6398('0x24')](handleEntityNotFound(_0x54772c,null))[_0x6398('0x24')](saveUpdates(_0x420e1c['body'],null))[_0x6398('0x24')](respondWithResult(_0x54772c,null))[_0x6398('0x43')](handleError(_0x54772c,null));};exports['destroy']=function(_0x405501,_0x533fb0){return db[_0x6398('0x2b')]['find']({'where':{'id':_0x405501[_0x6398('0x44')]['id']}})[_0x6398('0x24')](handleEntityNotFound(_0x533fb0,null))['then'](removeEntity(_0x533fb0,null))[_0x6398('0x43')](handleError(_0x533fb0,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 9871385..cf894fb 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 _0x9ab6=['bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','util','../../config/logger','moment'];(function(_0x482770,_0x4f71fe){var _0x566fe2=function(_0x4eb147){while(--_0x4eb147){_0x482770['push'](_0x482770['shift']());}};_0x566fe2(++_0x4f71fe);}(_0x9ab6,0x1c4));var _0x69ab=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0x9ab6[_0x1ccdf7];return _0x52a0ae;};'use strict';var _=require('lodash');var util=require(_0x69ab('0x0'));var logger=require(_0x69ab('0x1'))('api');var moment=require(_0x69ab('0x2'));var BPromise=require(_0x69ab('0x3'));var rp=require(_0x69ab('0x4'));var fs=require('fs');var path=require(_0x69ab('0x5'));var rimraf=require(_0x69ab('0x6'));var config=require(_0x69ab('0x7'));var attributes=require(_0x69ab('0x8'));module[_0x69ab('0x9')]=function(_0x2b9796,_0x4a2e3e){return _0x2b9796[_0x69ab('0xa')](_0x69ab('0xb'),attributes,{'tableName':_0x69ab('0xc'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe117=['./intDynamics365Field.attributes','exports','int_dynamics365_fields','dynamics365_unique_index','lodash','util','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x4d606f,_0x5b3469){var _0x5a8182=function(_0x58fdb5){while(--_0x58fdb5){_0x4d606f['push'](_0x4d606f['shift']());}};_0x5a8182(++_0x5b3469);}(_0xe117,0xbf));var _0x7e11=function(_0x2f596a,_0x45b473){_0x2f596a=_0x2f596a-0x0;var _0x2639e4=_0xe117[_0x2f596a];return _0x2639e4;};'use strict';var _=require(_0x7e11('0x0'));var util=require(_0x7e11('0x1'));var logger=require('../../config/logger')(_0x7e11('0x2'));var moment=require(_0x7e11('0x3'));var BPromise=require(_0x7e11('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7e11('0x5'));var config=require(_0x7e11('0x6'));var attributes=require(_0x7e11('0x7'));module[_0x7e11('0x8')]=function(_0x9372a5,_0x59b118){return _0x9372a5['define']('Dynamics365Field',attributes,{'tableName':_0x7e11('0x9'),'paranoid':![],'indexes':[{'name':_0x7e11('0xa'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index a1364a5..b14b049 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 _0x609f=['result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','Dynamics365Field,\x20%s,\x20%s','message'];(function(_0x110381,_0x151fe7){var _0x1c5e56=function(_0x251e0d){while(--_0x251e0d){_0x110381['push'](_0x110381['shift']());}};_0x1c5e56(++_0x151fe7);}(_0x609f,0x166));var _0xf609=function(_0x5ba2c8,_0x5826ef){_0x5ba2c8=_0x5ba2c8-0x0;var _0x6c177f=_0x609f[_0x5ba2c8];return _0x6c177f;};'use strict';var _=require(_0xf609('0x0'));var util=require(_0xf609('0x1'));var moment=require('moment');var BPromise=require(_0xf609('0x2'));var rs=require(_0xf609('0x3'));var fs=require('fs');var Redis=require(_0xf609('0x4'));var db=require(_0xf609('0x5'))['db'];var utils=require(_0xf609('0x6'));var logger=require(_0xf609('0x7'))(_0xf609('0x8'));var config=require('../../config/environment');var jayson=require(_0xf609('0x9'));var client=jayson[_0xf609('0xa')][_0xf609('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x44f8de,_0x42bae5,_0x1dda51){return new BPromise(function(_0x1c680c,_0x3e9c46){return client['request'](_0x44f8de,_0x1dda51)[_0xf609('0xc')](function(_0x4fc2f5){logger[_0xf609('0xd')]('Dynamics365Field,\x20%s,\x20%s',_0x42bae5,_0xf609('0xe'));logger[_0xf609('0xf')](_0xf609('0x10'),_0x42bae5,_0xf609('0xe'),JSON['stringify'](_0x4fc2f5));if(_0x4fc2f5['error']){if(_0x4fc2f5[_0xf609('0x11')]['code']===0x1f4){logger[_0xf609('0x11')](_0xf609('0x12'),_0x42bae5,_0x4fc2f5[_0xf609('0x11')][_0xf609('0x13')]);return _0x3e9c46(_0x4fc2f5[_0xf609('0x11')][_0xf609('0x13')]);}logger[_0xf609('0x11')](_0xf609('0x12'),_0x42bae5,_0x4fc2f5[_0xf609('0x11')][_0xf609('0x13')]);return _0x1c680c(_0x4fc2f5[_0xf609('0x11')][_0xf609('0x13')]);}else{logger[_0xf609('0xd')](_0xf609('0x12'),_0x42bae5,_0xf609('0xe'));_0x1c680c(_0x4fc2f5[_0xf609('0x14')][_0xf609('0x13')]);}})['catch'](function(_0x394e30){logger[_0xf609('0x11')]('Dynamics365Field,\x20%s,\x20%s',_0x42bae5,_0x394e30);_0x3e9c46(_0x394e30);});});} \ No newline at end of file +var _0xacf3=['request\x20sent','debug','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Dynamics365Field,\x20%s,\x20%s'];(function(_0x5288be,_0xe4607e){var _0x1d1d13=function(_0x7b6979){while(--_0x7b6979){_0x5288be['push'](_0x5288be['shift']());}};_0x1d1d13(++_0xe4607e);}(_0xacf3,0xe3));var _0x3acf=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xacf3[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x3acf('0x0'));var util=require(_0x3acf('0x1'));var moment=require('moment');var BPromise=require(_0x3acf('0x2'));var rs=require(_0x3acf('0x3'));var fs=require('fs');var Redis=require(_0x3acf('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3acf('0x5'));var logger=require(_0x3acf('0x6'))(_0x3acf('0x7'));var config=require(_0x3acf('0x8'));var jayson=require(_0x3acf('0x9'));var client=jayson['client'][_0x3acf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x235fde,_0x382c04,_0x283b4d){return new BPromise(function(_0x1be2d6,_0x4ac94f){return client[_0x3acf('0xb')](_0x235fde,_0x283b4d)[_0x3acf('0xc')](function(_0x3ebe3b){logger[_0x3acf('0xd')](_0x3acf('0xe'),_0x382c04,_0x3acf('0xf'));logger[_0x3acf('0x10')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x382c04,_0x3acf('0xf'),JSON[_0x3acf('0x11')](_0x3ebe3b));if(_0x3ebe3b[_0x3acf('0x12')]){if(_0x3ebe3b[_0x3acf('0x12')][_0x3acf('0x13')]===0x1f4){logger['error'](_0x3acf('0xe'),_0x382c04,_0x3ebe3b[_0x3acf('0x12')][_0x3acf('0x14')]);return _0x4ac94f(_0x3ebe3b[_0x3acf('0x12')][_0x3acf('0x14')]);}logger[_0x3acf('0x12')](_0x3acf('0xe'),_0x382c04,_0x3ebe3b['error'][_0x3acf('0x14')]);return _0x1be2d6(_0x3ebe3b[_0x3acf('0x12')][_0x3acf('0x14')]);}else{logger[_0x3acf('0xd')](_0x3acf('0xe'),_0x382c04,_0x3acf('0xf'));_0x1be2d6(_0x3ebe3b[_0x3acf('0x15')][_0x3acf('0x14')]);}})['catch'](function(_0x35fd05){logger[_0x3acf('0x12')](_0x3acf('0xe'),_0x382c04,_0x35fd05);_0x4ac94f(_0x35fd05);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index a4a5c23..5fb2975 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 _0x7f52=['/:id','show','/:id/configurations','/:id/fields','getFields','create','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x2ca8d2,_0x5adbe3){var _0x1eb316=function(_0x492bbb){while(--_0x492bbb){_0x2ca8d2['push'](_0x2ca8d2['shift']());}};_0x1eb316(++_0x5adbe3);}(_0x7f52,0x68));var _0x27f5=function(_0x3c6402,_0x7d2a68){_0x3c6402=_0x3c6402-0x0;var _0x48ee69=_0x7f52[_0x3c6402];return _0x48ee69;};'use strict';var multer=require(_0x27f5('0x0'));var util=require(_0x27f5('0x1'));var path=require(_0x27f5('0x2'));var timeout=require('connect-timeout');var express=require(_0x27f5('0x3'));var router=express[_0x27f5('0x4')]();var fs_extra=require(_0x27f5('0x5'));var auth=require(_0x27f5('0x6'));var interaction=require(_0x27f5('0x7'));var config=require('../../config/environment');var controller=require('./intFreshdeskAccount.controller');router[_0x27f5('0x8')]('/',auth[_0x27f5('0x9')](),controller['index']);router['get'](_0x27f5('0xa'),auth['isAuthenticated'](),controller[_0x27f5('0xb')]);router[_0x27f5('0x8')](_0x27f5('0xc'),auth[_0x27f5('0x9')](),controller['getConfigurations']);router['get'](_0x27f5('0xd'),auth[_0x27f5('0x9')](),controller[_0x27f5('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x27f5('0xf')]);router['post'](_0x27f5('0xc'),auth['isAuthenticated'](),controller['addConfiguration']);router['put'](_0x27f5('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x27f5('0x10')](_0x27f5('0xa'),auth['isAuthenticated'](),controller[_0x27f5('0x11')]);module[_0x27f5('0x12')]=router; \ No newline at end of file +var _0x9fd9=['put','/:id','delete','destroy','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','show','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration'];(function(_0x562450,_0x59cc7e){var _0x4b6da1=function(_0x8f5f71){while(--_0x8f5f71){_0x562450['push'](_0x562450['shift']());}};_0x4b6da1(++_0x59cc7e);}(_0x9fd9,0x17e));var _0x99fd=function(_0x24d1d5,_0x125999){_0x24d1d5=_0x24d1d5-0x0;var _0x249f15=_0x9fd9[_0x24d1d5];return _0x249f15;};'use strict';var multer=require(_0x99fd('0x0'));var util=require(_0x99fd('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x99fd('0x2'));var router=express[_0x99fd('0x3')]();var fs_extra=require(_0x99fd('0x4'));var auth=require(_0x99fd('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x99fd('0x6'));var controller=require(_0x99fd('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x99fd('0x8')]('/:id',auth[_0x99fd('0x9')](),controller[_0x99fd('0xa')]);router[_0x99fd('0x8')]('/:id/configurations',auth[_0x99fd('0x9')](),controller['getConfigurations']);router[_0x99fd('0x8')](_0x99fd('0xb'),auth[_0x99fd('0x9')](),controller[_0x99fd('0xc')]);router[_0x99fd('0xd')]('/',auth[_0x99fd('0x9')](),controller[_0x99fd('0xe')]);router['post'](_0x99fd('0xf'),auth[_0x99fd('0x9')](),controller[_0x99fd('0x10')]);router[_0x99fd('0x11')](_0x99fd('0x12'),auth[_0x99fd('0x9')](),controller['update']);router[_0x99fd('0x13')](_0x99fd('0x12'),auth['isAuthenticated'](),controller[_0x99fd('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index d8a700e..a2c6437 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 _0xcf2f=['exports','STRING','remoteUri','sequelize'];(function(_0x32df0f,_0x3b8e76){var _0x56d8e6=function(_0xf7408e){while(--_0xf7408e){_0x32df0f['push'](_0x32df0f['shift']());}};_0x56d8e6(++_0x3b8e76);}(_0xcf2f,0xa7));var _0xfcf2=function(_0x464076,_0x4983df){_0x464076=_0x464076-0x0;var _0x15b94d=_0xcf2f[_0x464076];return _0x15b94d;};'use strict';var Sequelize=require(_0xfcf2('0x0'));module[_0xfcf2('0x1')]={'name':{'type':Sequelize[_0xfcf2('0x2')]},'description':{'type':Sequelize[_0xfcf2('0x2')]},'username':{'type':Sequelize[_0xfcf2('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0xfcf2('0x2')]},'remoteUri':{'type':Sequelize[_0xfcf2('0x2')],'unique':_0xfcf2('0x3')},'serverUrl':{'type':Sequelize[_0xfcf2('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x0120=['remoteUri','sequelize','exports','STRING','username'];(function(_0x5ebbef,_0x2a7642){var _0x40db15=function(_0x60e7e5){while(--_0x60e7e5){_0x5ebbef['push'](_0x5ebbef['shift']());}};_0x40db15(++_0x2a7642);}(_0x0120,0x6f));var _0x0012=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x0120[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x0012('0x0'));module[_0x0012('0x1')]={'name':{'type':Sequelize[_0x0012('0x2')]},'description':{'type':Sequelize[_0x0012('0x2')]},'username':{'type':Sequelize[_0x0012('0x2')],'unique':_0x0012('0x3')},'apiKey':{'type':Sequelize[_0x0012('0x2')]},'remoteUri':{'type':Sequelize[_0x0012('0x2')],'unique':_0x0012('0x4')},'serverUrl':{'type':Sequelize[_0x0012('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 30b2bf1..883235a 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 _0xbf6e=['../../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','name','send','index','FreshdeskAccount','rawAttributes','fieldName','type','key','model','map','keys','query','intersection','fields','attributes','length','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','create','body','find','getConfigurations','findOne','FreshdeskConfiguration','hasOwnProperty','nolimit','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','apiKey','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','requester','subject','description','priority','group','source','ticket_type','company','remove','includes','default','custom_text','label','choices','capitalize','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x493b36,_0x4ca0bb){var _0x1f07d0=function(_0xebedfc){while(--_0xebedfc){_0x493b36['push'](_0x493b36['shift']());}};_0x1f07d0(++_0x4ca0bb);}(_0xbf6e,0x149));var _0xebf6=function(_0x434037,_0xdcb5d0){_0x434037=_0x434037-0x0;var _0x5692b9=_0xbf6e[_0x434037];return _0x5692b9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xebf6('0x0'));var jsonpatch=require(_0xebf6('0x1'));var rp=require(_0xebf6('0x2'));var moment=require(_0xebf6('0x3'));var BPromise=require(_0xebf6('0x4'));var Mustache=require(_0xebf6('0x5'));var util=require(_0xebf6('0x6'));var path=require('path');var sox=require(_0xebf6('0x7'));var csv=require(_0xebf6('0x8'));var ejs=require(_0xebf6('0x9'));var fs=require('fs');var fs_extra=require(_0xebf6('0xa'));var _=require(_0xebf6('0xb'));var squel=require(_0xebf6('0xc'));var crypto=require(_0xebf6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xebf6('0xe'));var toCsv=require(_0xebf6('0x8'));var querystring=require(_0xebf6('0xf'));var Papa=require('papaparse');var Redis=require(_0xebf6('0x10'));var authService=require(_0xebf6('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xebf6('0x12'));var hardwareService=require(_0xebf6('0x13'));var logger=require(_0xebf6('0x14'))(_0xebf6('0x15'));var utils=require(_0xebf6('0x16'));var config=require(_0xebf6('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xebf6('0x18'))['db'];var integrations=require(_0xebf6('0x19'));function respondWithStatusCode(_0x4919f1,_0x332ca0){_0x332ca0=_0x332ca0||0xcc;return function(_0x101a6c){if(_0x101a6c){return _0x4919f1[_0xebf6('0x1a')](_0x332ca0);}return _0x4919f1[_0xebf6('0x1b')](_0x332ca0)[_0xebf6('0x1c')]();};}function respondWithResult(_0x4dbf51,_0x4c01f4){_0x4c01f4=_0x4c01f4||0xc8;return function(_0x56b8f8){if(_0x56b8f8){return _0x4dbf51[_0xebf6('0x1b')](_0x4c01f4)[_0xebf6('0x1d')](_0x56b8f8);}};}function respondWithFilteredResult(_0x50d80f,_0x35570e){return function(_0x2c980f){if(_0x2c980f){var _0xb164a1=typeof _0x35570e[_0xebf6('0x1e')]===_0xebf6('0x1f')&&typeof _0x35570e[_0xebf6('0x20')]===_0xebf6('0x1f');var _0x2dc96f=_0x2c980f[_0xebf6('0x21')];var _0x308480=_0xb164a1?0x0:_0x35570e['offset'];var _0x496dea=_0xb164a1?_0x2c980f[_0xebf6('0x21')]:_0x35570e[_0xebf6('0x1e')]+_0x35570e[_0xebf6('0x20')];var _0x410f06;if(_0x496dea>=_0x2dc96f){_0x496dea=_0x2dc96f;_0x410f06=0xc8;}else{_0x410f06=0xce;}_0x50d80f[_0xebf6('0x1b')](_0x410f06);return _0x50d80f[_0xebf6('0x22')](_0xebf6('0x23'),_0x308480+'-'+_0x496dea+'/'+_0x2dc96f)[_0xebf6('0x1d')](_0x2c980f);}return null;};}function patchUpdates(_0x4fb497){return function(_0xbe39dd){try{jsonpatch[_0xebf6('0x24')](_0xbe39dd,_0x4fb497,!![]);}catch(_0x377934){return BPromise[_0xebf6('0x25')](_0x377934);}return _0xbe39dd[_0xebf6('0x26')]();};}function saveUpdates(_0x14c8ac,_0x2f419e){return function(_0xfce30a){if(_0xfce30a){return _0xfce30a[_0xebf6('0x27')](_0x14c8ac)[_0xebf6('0x28')](function(_0x232074){return _0x232074;});}return null;};}function removeEntity(_0x2dd2ed,_0x43c4e2){return function(_0x3b8bc1){if(_0x3b8bc1){return _0x3b8bc1[_0xebf6('0x29')]()[_0xebf6('0x28')](function(){_0x2dd2ed[_0xebf6('0x1b')](0xcc)[_0xebf6('0x1c')]();});}};}function handleEntityNotFound(_0x3b58cb,_0x4dadf7){return function(_0x58fb66){if(!_0x58fb66){_0x3b58cb[_0xebf6('0x1a')](0x194);}return _0x58fb66;};}function handleError(_0x4dc5be,_0x230d84){_0x230d84=_0x230d84||0x1f4;return function(_0x430eb7){logger['error'](_0x430eb7['stack']);if(_0x430eb7[_0xebf6('0x2a')]){delete _0x430eb7[_0xebf6('0x2a')];}_0x4dc5be[_0xebf6('0x1b')](_0x230d84)[_0xebf6('0x2b')](_0x430eb7);};}exports[_0xebf6('0x2c')]=function(_0x2dc0cf,_0x7976d){var _0x7551ce={},_0x4c3495={},_0x37cd67={'count':0x0,'rows':[]};var _0x78cdf0=_['map'](db[_0xebf6('0x2d')][_0xebf6('0x2e')],function(_0x5ea6b2){return{'name':_0x5ea6b2[_0xebf6('0x2f')],'type':_0x5ea6b2[_0xebf6('0x30')][_0xebf6('0x31')]};});_0x4c3495[_0xebf6('0x32')]=_[_0xebf6('0x33')](_0x78cdf0,_0xebf6('0x2a'));_0x4c3495['query']=_[_0xebf6('0x34')](_0x2dc0cf[_0xebf6('0x35')]);_0x4c3495['filters']=_['intersection'](_0x4c3495[_0xebf6('0x32')],_0x4c3495[_0xebf6('0x35')]);_0x7551ce['attributes']=_[_0xebf6('0x36')](_0x4c3495[_0xebf6('0x32')],qs['fields'](_0x2dc0cf[_0xebf6('0x35')][_0xebf6('0x37')]));_0x7551ce[_0xebf6('0x38')]=_0x7551ce['attributes'][_0xebf6('0x39')]?_0x7551ce[_0xebf6('0x38')]:_0x4c3495[_0xebf6('0x32')];if(!_0x2dc0cf[_0xebf6('0x35')]['hasOwnProperty']('nolimit')){_0x7551ce[_0xebf6('0x20')]=qs[_0xebf6('0x20')](_0x2dc0cf['query'][_0xebf6('0x20')]);_0x7551ce[_0xebf6('0x1e')]=qs['offset'](_0x2dc0cf[_0xebf6('0x35')][_0xebf6('0x1e')]);}_0x7551ce[_0xebf6('0x3a')]=qs[_0xebf6('0x3b')](_0x2dc0cf[_0xebf6('0x35')]['sort']);_0x7551ce[_0xebf6('0x3c')]=qs['filters'](_[_0xebf6('0x3d')](_0x2dc0cf['query'],_0x4c3495[_0xebf6('0x3e')]),_0x78cdf0);if(_0x2dc0cf[_0xebf6('0x35')][_0xebf6('0x3f')]){_0x7551ce[_0xebf6('0x3c')]=_[_0xebf6('0x40')](_0x7551ce[_0xebf6('0x3c')],{'$or':_['map'](_0x78cdf0,function(_0x406c29){if(_0x406c29[_0xebf6('0x30')]!==_0xebf6('0x41')){var _0x144b41={};_0x144b41[_0x406c29[_0xebf6('0x2a')]]={'$like':'%'+_0x2dc0cf[_0xebf6('0x35')]['filter']+'%'};return _0x144b41;}})});}_0x7551ce=_[_0xebf6('0x40')]({},_0x7551ce,_0x2dc0cf[_0xebf6('0x42')]);var _0x3f8502={'where':_0x7551ce[_0xebf6('0x3c')]};return db[_0xebf6('0x2d')][_0xebf6('0x21')](_0x3f8502)['then'](function(_0x582730){_0x37cd67['count']=_0x582730;if(_0x2dc0cf[_0xebf6('0x35')][_0xebf6('0x43')]){_0x7551ce[_0xebf6('0x44')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0xebf6('0x45')](_0x7551ce);})[_0xebf6('0x28')](function(_0x36c270){_0x37cd67['rows']=_0x36c270;return _0x37cd67;})[_0xebf6('0x28')](respondWithFilteredResult(_0x7976d,_0x7551ce))[_0xebf6('0x46')](handleError(_0x7976d,null));};exports['show']=function(_0x3813a5,_0x1de50e){var _0x17c4af={'raw':![],'where':{'id':_0x3813a5[_0xebf6('0x47')]['id']}},_0x4c93da={};_0x4c93da['model']=_['keys'](db[_0xebf6('0x2d')][_0xebf6('0x2e')]);_0x4c93da[_0xebf6('0x35')]=_[_0xebf6('0x34')](_0x3813a5['query']);_0x4c93da[_0xebf6('0x3e')]=_['intersection'](_0x4c93da[_0xebf6('0x32')],_0x4c93da[_0xebf6('0x35')]);_0x17c4af[_0xebf6('0x38')]=_[_0xebf6('0x36')](_0x4c93da[_0xebf6('0x32')],qs['fields'](_0x3813a5['query'][_0xebf6('0x37')]));_0x17c4af[_0xebf6('0x38')]=_0x17c4af[_0xebf6('0x38')][_0xebf6('0x39')]?_0x17c4af['attributes']:_0x4c93da[_0xebf6('0x32')];if(_0x3813a5[_0xebf6('0x35')][_0xebf6('0x43')]){_0x17c4af[_0xebf6('0x44')]=[{'all':!![]}];}_0x17c4af=_[_0xebf6('0x40')]({},_0x17c4af,_0x3813a5[_0xebf6('0x42')]);return db[_0xebf6('0x2d')]['find'](_0x17c4af)[_0xebf6('0x28')](handleEntityNotFound(_0x1de50e,null))[_0xebf6('0x28')](respondWithResult(_0x1de50e,null))[_0xebf6('0x46')](handleError(_0x1de50e,null));};exports[_0xebf6('0x48')]=function(_0x166664,_0x1e9998){return db[_0xebf6('0x2d')]['create'](_0x166664[_0xebf6('0x49')],{})['then'](respondWithResult(_0x1e9998,0xc9))[_0xebf6('0x46')](handleError(_0x1e9998,null));};exports[_0xebf6('0x27')]=function(_0x5d84ac,_0xd14e0a){if(_0x5d84ac['body']['id']){delete _0x5d84ac[_0xebf6('0x49')]['id'];}return db[_0xebf6('0x2d')][_0xebf6('0x4a')]({'where':{'id':_0x5d84ac[_0xebf6('0x47')]['id']}})[_0xebf6('0x28')](handleEntityNotFound(_0xd14e0a,null))['then'](saveUpdates(_0x5d84ac[_0xebf6('0x49')],null))[_0xebf6('0x28')](respondWithResult(_0xd14e0a,null))['catch'](handleError(_0xd14e0a,null));};exports[_0xebf6('0x29')]=function(_0x2765f2,_0x1455c4){return db[_0xebf6('0x2d')][_0xebf6('0x4a')]({'where':{'id':_0x2765f2['params']['id']}})[_0xebf6('0x28')](handleEntityNotFound(_0x1455c4,null))[_0xebf6('0x28')](removeEntity(_0x1455c4,null))[_0xebf6('0x46')](handleError(_0x1455c4,null));};exports[_0xebf6('0x4b')]=function(_0x47eee4,_0x3629aa,_0x39b8f0){var _0xe346da={};var _0x303997={};var _0x16abac;var _0x2e7e30;return db[_0xebf6('0x2d')][_0xebf6('0x4c')]({'where':{'id':_0x47eee4[_0xebf6('0x47')]['id']}})['then'](handleEntityNotFound(_0x3629aa,null))[_0xebf6('0x28')](function(_0xe78fe5){if(_0xe78fe5){_0x16abac=_0xe78fe5;_0x303997[_0xebf6('0x32')]=_['keys'](db[_0xebf6('0x4d')]['rawAttributes']);_0x303997['query']=_[_0xebf6('0x34')](_0x47eee4[_0xebf6('0x35')]);_0x303997[_0xebf6('0x3e')]=_[_0xebf6('0x36')](_0x303997[_0xebf6('0x32')],_0x303997['query']);_0xe346da[_0xebf6('0x38')]=_['intersection'](_0x303997['model'],qs['fields'](_0x47eee4[_0xebf6('0x35')][_0xebf6('0x37')]));_0xe346da['attributes']=_0xe346da[_0xebf6('0x38')][_0xebf6('0x39')]?_0xe346da[_0xebf6('0x38')]:_0x303997[_0xebf6('0x32')];_0xe346da[_0xebf6('0x3a')]=qs[_0xebf6('0x3b')](_0x47eee4[_0xebf6('0x35')]['sort']);_0xe346da[_0xebf6('0x3c')]=qs[_0xebf6('0x3e')](_[_0xebf6('0x3d')](_0x47eee4[_0xebf6('0x35')],_0x303997[_0xebf6('0x3e')]));if(_0x47eee4[_0xebf6('0x35')]['filter']){_0xe346da[_0xebf6('0x3c')]=_[_0xebf6('0x40')](_0xe346da[_0xebf6('0x3c')],{'$or':_[_0xebf6('0x33')](_0xe346da[_0xebf6('0x38')],function(_0x317b5c){var _0x5a6898={};_0x5a6898[_0x317b5c]={'$like':'%'+_0x47eee4[_0xebf6('0x35')][_0xebf6('0x3f')]+'%'};return _0x5a6898;})});}_0xe346da=_[_0xebf6('0x40')]({},_0xe346da,_0x47eee4[_0xebf6('0x42')]);return _0x16abac[_0xebf6('0x4b')](_0xe346da);}})['then'](function(_0x377268){if(_0x377268){_0x2e7e30=_0x377268[_0xebf6('0x39')];if(!_0x47eee4[_0xebf6('0x35')][_0xebf6('0x4e')](_0xebf6('0x4f'))){_0xe346da[_0xebf6('0x20')]=qs[_0xebf6('0x20')](_0x47eee4[_0xebf6('0x35')][_0xebf6('0x20')]);_0xe346da[_0xebf6('0x1e')]=qs[_0xebf6('0x1e')](_0x47eee4['query'][_0xebf6('0x1e')]);}return _0x16abac[_0xebf6('0x4b')](_0xe346da);}})[_0xebf6('0x28')](function(_0x2c8db5){if(_0x2c8db5){return _0x2c8db5?{'count':_0x2e7e30,'rows':_0x2c8db5}:null;}})[_0xebf6('0x28')](respondWithResult(_0x3629aa,null))[_0xebf6('0x46')](handleError(_0x3629aa,null));};exports['addConfiguration']=function(_0x10df09,_0x4b4179,_0x33dc96){if(_0x10df09[_0xebf6('0x49')]['id']){delete _0x10df09[_0xebf6('0x49')]['id'];}return db[_0xebf6('0x2d')][_0xebf6('0x4c')]({'where':{'id':_0x10df09[_0xebf6('0x47')]['id']}})[_0xebf6('0x28')](handleEntityNotFound(_0x4b4179,null))['then'](function(_0x4ddbbd){if(_0x4ddbbd){_0x10df09[_0xebf6('0x49')][_0xebf6('0x50')]=_0x4ddbbd['id'];_0x10df09['body'][_0xebf6('0x51')]=integrations[_0xebf6('0x52')](_0x10df09['body'][_0xebf6('0x53')],_0x10df09[_0xebf6('0x49')]['type']);_0x10df09[_0xebf6('0x49')][_0xebf6('0x54')]=integrations[_0xebf6('0x55')](_0x10df09[_0xebf6('0x49')][_0xebf6('0x53')],_0x10df09[_0xebf6('0x49')][_0xebf6('0x30')]);return db['FreshdeskConfiguration'][_0xebf6('0x48')](_0x10df09[_0xebf6('0x49')],{'include':[{'model':db[_0xebf6('0x56')],'as':_0xebf6('0x51')},{'model':db[_0xebf6('0x56')],'as':_0xebf6('0x54')}]});}return null;})[_0xebf6('0x28')](respondWithResult(_0x4b4179,null))[_0xebf6('0x46')](handleError(_0x4b4179,null));};exports[_0xebf6('0x57')]=function(_0x4c152d,_0x4e55ed,_0x5045a1){var _0x1d2c92='';return db[_0xebf6('0x2d')][_0xebf6('0x4c')]({'where':{'id':_0x4c152d[_0xebf6('0x47')]['id']},'attributes':['id','remoteUri',_0xebf6('0x58')]})[_0xebf6('0x28')](handleEntityNotFound(_0x4e55ed,null))[_0xebf6('0x28')](function(_0x1774fd){if(_0x1774fd){_0x1d2c92=_0x1774fd['remoteUri'];var _0x4c0f2e=_0x1d2c92['slice'](-0x1);if(_0x4c0f2e==='/'){_0x1d2c92=_0x1d2c92[_0xebf6('0x59')](0x0,_0x1d2c92[_0xebf6('0x5a')](_0x4c0f2e));}return rp({'method':_0xebf6('0x5b'),'uri':util[_0xebf6('0x5c')](_0xebf6('0x5d'),_0x1d2c92,_0xebf6('0x5e')),'headers':{'Authorization':util[_0xebf6('0x5c')](_0xebf6('0x5f'),new Buffer(util['format'](_0xebf6('0x60'),_0x1774fd[_0xebf6('0x58')]))['toString']('base64'))},'json':!![]});}})[_0xebf6('0x28')](function(_0x568a5e){if(_0x568a5e){var _0x89be0=[_0xebf6('0x61'),_0xebf6('0x62'),'agent',_0xebf6('0x63'),_0xebf6('0x1b'),_0xebf6('0x64'),_0xebf6('0x65'),_0xebf6('0x66'),_0xebf6('0x67'),'group',_0xebf6('0x68')];_[_0xebf6('0x69')](_0x568a5e,function(_0x501f57){return _0x89be0[_0xebf6('0x6a')](_0x501f57[_0xebf6('0x2a')])||!_0x501f57[_0xebf6('0x6b')]&&_0x501f57['type']!==_0xebf6('0x6c')&&_0x501f57[_0xebf6('0x30')]!=='custom_dropdown';});return{'count':_0x568a5e[_0xebf6('0x39')],'rows':_[_0xebf6('0x33')](_0x568a5e,function(_0x41efb9){return{'id':_0x41efb9[_0xebf6('0x2a')],'name':_0x41efb9[_0xebf6('0x6d')],'custom':!_0x41efb9[_0xebf6('0x6b')],'options':_0x41efb9[_0xebf6('0x6e')]?_[_0xebf6('0x33')](_0x41efb9[_0xebf6('0x6e')],function(_0xdff576){return{'name':_[_0xebf6('0x6f')](_0xdff576),'value':_0xdff576};}):[]};})};}})[_0xebf6('0x28')](respondWithResult(_0x4e55ed,null))[_0xebf6('0x46')](function(_0x51e19e){var _0x2ea740=_0x4c152d[_0xebf6('0x35')][_0xebf6('0x70')]?0x1f4:_0x51e19e[_0xebf6('0x71')]||0x1f4;logger[_0xebf6('0x72')](_0xebf6('0x73'),_0xebf6('0x57'),_0x2ea740,JSON[_0xebf6('0x74')](_0x51e19e));delete _0x51e19e[_0xebf6('0x2a')];if(_0x2ea740===0x191){_0x2ea740=0x190;}_0x4e55ed[_0xebf6('0x1b')](_0x2ea740)['send'](_0x4c152d['query'][_0xebf6('0x70')]?{'message':'Wrong\x20credentials','statusCode':_0x51e19e[_0xebf6('0x71')]}:_0x51e19e);});}; \ No newline at end of file +var _0x082b=['choices','capitalize','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','Content-Range','save','update','destroy','then','end','stack','name','send','index','map','FreshdeskAccount','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','where','pick','merge','VIRTUAL','filter','count','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','options','find','create','body','getConfigurations','findOne','FreshdeskConfiguration','sort','hasOwnProperty','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','Subjects','getFields','remoteUri','apiKey','slice','lastIndexOf','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','requester','subject','agent','description','priority','group','source','company','remove','default','custom_text','custom_dropdown','label'];(function(_0x434804,_0x415f68){var _0x573fc8=function(_0x3ce265){while(--_0x3ce265){_0x434804['push'](_0x434804['shift']());}};_0x573fc8(++_0x415f68);}(_0x082b,0x1ec));var _0xb082=function(_0x44c15e,_0x96ed4c){_0x44c15e=_0x44c15e-0x0;var _0x13fc14=_0x082b[_0x44c15e];return _0x13fc14;};'use strict';var emlformat=require(_0xb082('0x0'));var rimraf=require(_0xb082('0x1'));var zipdir=require(_0xb082('0x2'));var jsonpatch=require(_0xb082('0x3'));var rp=require('request-promise');var moment=require(_0xb082('0x4'));var BPromise=require(_0xb082('0x5'));var Mustache=require('mustache');var util=require(_0xb082('0x6'));var path=require(_0xb082('0x7'));var sox=require('sox');var csv=require(_0xb082('0x8'));var ejs=require(_0xb082('0x9'));var fs=require('fs');var fs_extra=require(_0xb082('0xa'));var _=require(_0xb082('0xb'));var squel=require('squel');var crypto=require(_0xb082('0xc'));var jsforce=require(_0xb082('0xd'));var deskjs=require(_0xb082('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb082('0xf'));var Papa=require(_0xb082('0x10'));var Redis=require(_0xb082('0x11'));var authService=require(_0xb082('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xb082('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb082('0x14'))(_0xb082('0x15'));var utils=require(_0xb082('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xb082('0x17'));var db=require(_0xb082('0x18'))['db'];var integrations=require(_0xb082('0x19'));function respondWithStatusCode(_0x4426db,_0x20a748){_0x20a748=_0x20a748||0xcc;return function(_0xe23a4c){if(_0xe23a4c){return _0x4426db[_0xb082('0x1a')](_0x20a748);}return _0x4426db[_0xb082('0x1b')](_0x20a748)['end']();};}function respondWithResult(_0x1853f3,_0xbf588f){_0xbf588f=_0xbf588f||0xc8;return function(_0x41bace){if(_0x41bace){return _0x1853f3[_0xb082('0x1b')](_0xbf588f)[_0xb082('0x1c')](_0x41bace);}};}function respondWithFilteredResult(_0x4dec1b,_0x1738f2){return function(_0x37aa44){if(_0x37aa44){var _0x1afef2=typeof _0x1738f2[_0xb082('0x1d')]===_0xb082('0x1e')&&typeof _0x1738f2[_0xb082('0x1f')]===_0xb082('0x1e');var _0x4a46ad=_0x37aa44['count'];var _0x5c81bd=_0x1afef2?0x0:_0x1738f2[_0xb082('0x1d')];var _0x410965=_0x1afef2?_0x37aa44['count']:_0x1738f2[_0xb082('0x1d')]+_0x1738f2[_0xb082('0x1f')];var _0x383b57;if(_0x410965>=_0x4a46ad){_0x410965=_0x4a46ad;_0x383b57=0xc8;}else{_0x383b57=0xce;}_0x4dec1b[_0xb082('0x1b')](_0x383b57);return _0x4dec1b['set'](_0xb082('0x20'),_0x5c81bd+'-'+_0x410965+'/'+_0x4a46ad)[_0xb082('0x1c')](_0x37aa44);}return null;};}function patchUpdates(_0x74e6cc){return function(_0x3ad816){try{jsonpatch['apply'](_0x3ad816,_0x74e6cc,!![]);}catch(_0x3d7004){return BPromise['reject'](_0x3d7004);}return _0x3ad816[_0xb082('0x21')]();};}function saveUpdates(_0x470420,_0x158caa){return function(_0x3ef4cd){if(_0x3ef4cd){return _0x3ef4cd[_0xb082('0x22')](_0x470420)['then'](function(_0x3becee){return _0x3becee;});}return null;};}function removeEntity(_0x1f7c68,_0x3c8c9f){return function(_0x53f797){if(_0x53f797){return _0x53f797[_0xb082('0x23')]()[_0xb082('0x24')](function(){_0x1f7c68[_0xb082('0x1b')](0xcc)[_0xb082('0x25')]();});}};}function handleEntityNotFound(_0x484c15,_0x5ca741){return function(_0x554a33){if(!_0x554a33){_0x484c15[_0xb082('0x1a')](0x194);}return _0x554a33;};}function handleError(_0x325e4b,_0x28e122){_0x28e122=_0x28e122||0x1f4;return function(_0x5eb860){logger['error'](_0x5eb860[_0xb082('0x26')]);if(_0x5eb860[_0xb082('0x27')]){delete _0x5eb860[_0xb082('0x27')];}_0x325e4b[_0xb082('0x1b')](_0x28e122)[_0xb082('0x28')](_0x5eb860);};}exports[_0xb082('0x29')]=function(_0x48eb43,_0x2b57e7){var _0x504d1c={},_0x569978={},_0x54b633={'count':0x0,'rows':[]};var _0xbfce1=_[_0xb082('0x2a')](db[_0xb082('0x2b')]['rawAttributes'],function(_0x22efe){return{'name':_0x22efe[_0xb082('0x2c')],'type':_0x22efe[_0xb082('0x2d')][_0xb082('0x2e')]};});_0x569978[_0xb082('0x2f')]=_[_0xb082('0x2a')](_0xbfce1,_0xb082('0x27'));_0x569978[_0xb082('0x30')]=_['keys'](_0x48eb43[_0xb082('0x30')]);_0x569978[_0xb082('0x31')]=_[_0xb082('0x32')](_0x569978[_0xb082('0x2f')],_0x569978[_0xb082('0x30')]);_0x504d1c[_0xb082('0x33')]=_[_0xb082('0x32')](_0x569978[_0xb082('0x2f')],qs[_0xb082('0x34')](_0x48eb43[_0xb082('0x30')][_0xb082('0x34')]));_0x504d1c[_0xb082('0x33')]=_0x504d1c[_0xb082('0x33')][_0xb082('0x35')]?_0x504d1c[_0xb082('0x33')]:_0x569978[_0xb082('0x2f')];if(!_0x48eb43['query']['hasOwnProperty'](_0xb082('0x36'))){_0x504d1c[_0xb082('0x1f')]=qs[_0xb082('0x1f')](_0x48eb43[_0xb082('0x30')]['limit']);_0x504d1c['offset']=qs['offset'](_0x48eb43[_0xb082('0x30')][_0xb082('0x1d')]);}_0x504d1c[_0xb082('0x37')]=qs['sort'](_0x48eb43[_0xb082('0x30')]['sort']);_0x504d1c[_0xb082('0x38')]=qs['filters'](_[_0xb082('0x39')](_0x48eb43[_0xb082('0x30')],_0x569978[_0xb082('0x31')]),_0xbfce1);if(_0x48eb43[_0xb082('0x30')]['filter']){_0x504d1c[_0xb082('0x38')]=_[_0xb082('0x3a')](_0x504d1c[_0xb082('0x38')],{'$or':_[_0xb082('0x2a')](_0xbfce1,function(_0x50ebd7){if(_0x50ebd7['type']!==_0xb082('0x3b')){var _0x5927cb={};_0x5927cb[_0x50ebd7[_0xb082('0x27')]]={'$like':'%'+_0x48eb43[_0xb082('0x30')][_0xb082('0x3c')]+'%'};return _0x5927cb;}})});}_0x504d1c=_[_0xb082('0x3a')]({},_0x504d1c,_0x48eb43['options']);var _0x12ac74={'where':_0x504d1c[_0xb082('0x38')]};return db['FreshdeskAccount'][_0xb082('0x3d')](_0x12ac74)[_0xb082('0x24')](function(_0x267c06){_0x54b633['count']=_0x267c06;if(_0x48eb43[_0xb082('0x30')][_0xb082('0x3e')]){_0x504d1c[_0xb082('0x3f')]=[{'all':!![]}];}return db[_0xb082('0x2b')][_0xb082('0x40')](_0x504d1c);})['then'](function(_0x3516cf){_0x54b633[_0xb082('0x41')]=_0x3516cf;return _0x54b633;})[_0xb082('0x24')](respondWithFilteredResult(_0x2b57e7,_0x504d1c))[_0xb082('0x42')](handleError(_0x2b57e7,null));};exports[_0xb082('0x43')]=function(_0x172c7f,_0x23d000){var _0x4038f5={'raw':![],'where':{'id':_0x172c7f[_0xb082('0x44')]['id']}},_0x2044de={};_0x2044de['model']=_[_0xb082('0x45')](db[_0xb082('0x2b')][_0xb082('0x46')]);_0x2044de[_0xb082('0x30')]=_[_0xb082('0x45')](_0x172c7f[_0xb082('0x30')]);_0x2044de[_0xb082('0x31')]=_[_0xb082('0x32')](_0x2044de[_0xb082('0x2f')],_0x2044de[_0xb082('0x30')]);_0x4038f5[_0xb082('0x33')]=_[_0xb082('0x32')](_0x2044de[_0xb082('0x2f')],qs[_0xb082('0x34')](_0x172c7f[_0xb082('0x30')][_0xb082('0x34')]));_0x4038f5[_0xb082('0x33')]=_0x4038f5[_0xb082('0x33')][_0xb082('0x35')]?_0x4038f5[_0xb082('0x33')]:_0x2044de[_0xb082('0x2f')];if(_0x172c7f[_0xb082('0x30')][_0xb082('0x3e')]){_0x4038f5[_0xb082('0x3f')]=[{'all':!![]}];}_0x4038f5=_[_0xb082('0x3a')]({},_0x4038f5,_0x172c7f[_0xb082('0x47')]);return db[_0xb082('0x2b')][_0xb082('0x48')](_0x4038f5)[_0xb082('0x24')](handleEntityNotFound(_0x23d000,null))[_0xb082('0x24')](respondWithResult(_0x23d000,null))['catch'](handleError(_0x23d000,null));};exports[_0xb082('0x49')]=function(_0x4b1b96,_0xcdf8b0){return db['FreshdeskAccount'][_0xb082('0x49')](_0x4b1b96[_0xb082('0x4a')],{})[_0xb082('0x24')](respondWithResult(_0xcdf8b0,0xc9))[_0xb082('0x42')](handleError(_0xcdf8b0,null));};exports[_0xb082('0x22')]=function(_0x20076f,_0x479a13){if(_0x20076f['body']['id']){delete _0x20076f[_0xb082('0x4a')]['id'];}return db[_0xb082('0x2b')][_0xb082('0x48')]({'where':{'id':_0x20076f[_0xb082('0x44')]['id']}})['then'](handleEntityNotFound(_0x479a13,null))[_0xb082('0x24')](saveUpdates(_0x20076f['body'],null))[_0xb082('0x24')](respondWithResult(_0x479a13,null))[_0xb082('0x42')](handleError(_0x479a13,null));};exports['destroy']=function(_0x5a1581,_0x5d93e5){return db[_0xb082('0x2b')]['find']({'where':{'id':_0x5a1581[_0xb082('0x44')]['id']}})[_0xb082('0x24')](handleEntityNotFound(_0x5d93e5,null))[_0xb082('0x24')](removeEntity(_0x5d93e5,null))[_0xb082('0x42')](handleError(_0x5d93e5,null));};exports[_0xb082('0x4b')]=function(_0x1f7895,_0x5dd96d,_0x3ea246){var _0x489385={};var _0x2936b7={};var _0x3c4c3c;var _0x113746;return db[_0xb082('0x2b')][_0xb082('0x4c')]({'where':{'id':_0x1f7895[_0xb082('0x44')]['id']}})[_0xb082('0x24')](handleEntityNotFound(_0x5dd96d,null))['then'](function(_0x3fde0c){if(_0x3fde0c){_0x3c4c3c=_0x3fde0c;_0x2936b7[_0xb082('0x2f')]=_[_0xb082('0x45')](db[_0xb082('0x4d')]['rawAttributes']);_0x2936b7[_0xb082('0x30')]=_[_0xb082('0x45')](_0x1f7895[_0xb082('0x30')]);_0x2936b7[_0xb082('0x31')]=_[_0xb082('0x32')](_0x2936b7[_0xb082('0x2f')],_0x2936b7[_0xb082('0x30')]);_0x489385[_0xb082('0x33')]=_[_0xb082('0x32')](_0x2936b7[_0xb082('0x2f')],qs[_0xb082('0x34')](_0x1f7895[_0xb082('0x30')]['fields']));_0x489385['attributes']=_0x489385[_0xb082('0x33')][_0xb082('0x35')]?_0x489385[_0xb082('0x33')]:_0x2936b7[_0xb082('0x2f')];_0x489385[_0xb082('0x37')]=qs[_0xb082('0x4e')](_0x1f7895[_0xb082('0x30')][_0xb082('0x4e')]);_0x489385[_0xb082('0x38')]=qs[_0xb082('0x31')](_[_0xb082('0x39')](_0x1f7895[_0xb082('0x30')],_0x2936b7[_0xb082('0x31')]));if(_0x1f7895[_0xb082('0x30')][_0xb082('0x3c')]){_0x489385[_0xb082('0x38')]=_[_0xb082('0x3a')](_0x489385['where'],{'$or':_[_0xb082('0x2a')](_0x489385[_0xb082('0x33')],function(_0x38fa68){var _0x59d025={};_0x59d025[_0x38fa68]={'$like':'%'+_0x1f7895[_0xb082('0x30')][_0xb082('0x3c')]+'%'};return _0x59d025;})});}_0x489385=_[_0xb082('0x3a')]({},_0x489385,_0x1f7895[_0xb082('0x47')]);return _0x3c4c3c[_0xb082('0x4b')](_0x489385);}})[_0xb082('0x24')](function(_0x2e54fd){if(_0x2e54fd){_0x113746=_0x2e54fd[_0xb082('0x35')];if(!_0x1f7895[_0xb082('0x30')][_0xb082('0x4f')](_0xb082('0x36'))){_0x489385[_0xb082('0x1f')]=qs['limit'](_0x1f7895[_0xb082('0x30')][_0xb082('0x1f')]);_0x489385['offset']=qs[_0xb082('0x1d')](_0x1f7895[_0xb082('0x30')][_0xb082('0x1d')]);}return _0x3c4c3c['getConfigurations'](_0x489385);}})['then'](function(_0x2399a0){if(_0x2399a0){return _0x2399a0?{'count':_0x113746,'rows':_0x2399a0}:null;}})[_0xb082('0x24')](respondWithResult(_0x5dd96d,null))[_0xb082('0x42')](handleError(_0x5dd96d,null));};exports[_0xb082('0x50')]=function(_0x44047c,_0x1c1c6e,_0x4016d6){if(_0x44047c['body']['id']){delete _0x44047c[_0xb082('0x4a')]['id'];}return db[_0xb082('0x2b')]['findOne']({'where':{'id':_0x44047c[_0xb082('0x44')]['id']}})[_0xb082('0x24')](handleEntityNotFound(_0x1c1c6e,null))[_0xb082('0x24')](function(_0x490010){if(_0x490010){_0x44047c[_0xb082('0x4a')][_0xb082('0x51')]=_0x490010['id'];_0x44047c['body']['Subjects']=integrations[_0xb082('0x52')](_0x44047c['body'][_0xb082('0x53')],_0x44047c[_0xb082('0x4a')][_0xb082('0x2d')]);_0x44047c[_0xb082('0x4a')][_0xb082('0x54')]=integrations[_0xb082('0x55')](_0x44047c['body']['channel'],_0x44047c[_0xb082('0x4a')][_0xb082('0x2d')]);return db[_0xb082('0x4d')][_0xb082('0x49')](_0x44047c[_0xb082('0x4a')],{'include':[{'model':db[_0xb082('0x56')],'as':_0xb082('0x57')},{'model':db[_0xb082('0x56')],'as':'Descriptions'}]});}return null;})[_0xb082('0x24')](respondWithResult(_0x1c1c6e,null))['catch'](handleError(_0x1c1c6e,null));};exports[_0xb082('0x58')]=function(_0x4db9ed,_0x1ccca4,_0x957710){var _0xb411f7='';return db[_0xb082('0x2b')][_0xb082('0x4c')]({'where':{'id':_0x4db9ed[_0xb082('0x44')]['id']},'attributes':['id',_0xb082('0x59'),_0xb082('0x5a')]})[_0xb082('0x24')](handleEntityNotFound(_0x1ccca4,null))['then'](function(_0x203d6a){if(_0x203d6a){_0xb411f7=_0x203d6a[_0xb082('0x59')];var _0x2eff43=_0xb411f7[_0xb082('0x5b')](-0x1);if(_0x2eff43==='/'){_0xb411f7=_0xb411f7['substring'](0x0,_0xb411f7[_0xb082('0x5c')](_0x2eff43));}return rp({'method':'GET','uri':util[_0xb082('0x5d')](_0xb082('0x5e'),_0xb411f7,_0xb082('0x5f')),'headers':{'Authorization':util[_0xb082('0x5d')](_0xb082('0x60'),new Buffer(util['format'](_0xb082('0x61'),_0x203d6a[_0xb082('0x5a')]))[_0xb082('0x62')](_0xb082('0x63')))},'json':!![]});}})['then'](function(_0x48a65c){if(_0x48a65c){var _0x5829d4=[_0xb082('0x64'),_0xb082('0x65'),_0xb082('0x66'),_0xb082('0x67'),_0xb082('0x1b'),_0xb082('0x68'),_0xb082('0x69'),_0xb082('0x6a'),'ticket_type',_0xb082('0x69'),_0xb082('0x6b')];_[_0xb082('0x6c')](_0x48a65c,function(_0x25c7a8){return _0x5829d4['includes'](_0x25c7a8[_0xb082('0x27')])||!_0x25c7a8[_0xb082('0x6d')]&&_0x25c7a8['type']!==_0xb082('0x6e')&&_0x25c7a8[_0xb082('0x2d')]!==_0xb082('0x6f');});return{'count':_0x48a65c['length'],'rows':_[_0xb082('0x2a')](_0x48a65c,function(_0x13f054){return{'id':_0x13f054[_0xb082('0x27')],'name':_0x13f054[_0xb082('0x70')],'custom':!_0x13f054[_0xb082('0x6d')],'options':_0x13f054[_0xb082('0x71')]?_[_0xb082('0x2a')](_0x13f054[_0xb082('0x71')],function(_0x5aaceb){return{'name':_[_0xb082('0x72')](_0x5aaceb),'value':_0x5aaceb};}):[]};})};}})['then'](respondWithResult(_0x1ccca4,null))[_0xb082('0x42')](function(_0x4258a3){var _0x3b1acd=_0x4db9ed['query'][_0xb082('0x73')]?0x1f4:_0x4258a3[_0xb082('0x74')]||0x1f4;logger[_0xb082('0x75')](_0xb082('0x76'),_0xb082('0x58'),_0x3b1acd,JSON[_0xb082('0x77')](_0x4258a3));delete _0x4258a3['name'];if(_0x3b1acd===0x191){_0x3b1acd=0x190;}_0x1ccca4['status'](_0x3b1acd)['send'](_0x4db9ed[_0xb082('0x30')][_0xb082('0x73')]?{'message':_0xb082('0x78'),'statusCode':_0x4258a3[_0xb082('0x74')]}:_0x4258a3);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 3bc0fd8..2a0132d 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 _0x9ce5=['define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x25b4d8,_0x3f00b3){var _0x4aeb9a=function(_0x48cfea){while(--_0x48cfea){_0x25b4d8['push'](_0x25b4d8['shift']());}};_0x4aeb9a(++_0x3f00b3);}(_0x9ce5,0xab));var _0x59ce=function(_0x2abc3d,_0x48edca){_0x2abc3d=_0x2abc3d-0x0;var _0x252745=_0x9ce5[_0x2abc3d];return _0x252745;};'use strict';var _=require(_0x59ce('0x0'));var util=require(_0x59ce('0x1'));var logger=require(_0x59ce('0x2'))(_0x59ce('0x3'));var moment=require(_0x59ce('0x4'));var BPromise=require('bluebird');var rp=require(_0x59ce('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x59ce('0x6'));var config=require(_0x59ce('0x7'));var attributes=require(_0x59ce('0x8'));var integrations=require(_0x59ce('0x9'));module[_0x59ce('0xa')]=function(_0x4fa8d5,_0x1264c0){return _0x4fa8d5[_0x59ce('0xb')](_0x59ce('0xc'),attributes,{'tableName':_0x59ce('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd493=['rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xecb8dc,_0x353bd9){var _0x32fb23=function(_0x570fd7){while(--_0x570fd7){_0xecb8dc['push'](_0xecb8dc['shift']());}};_0x32fb23(++_0x353bd9);}(_0xd493,0x1ca));var _0x3d49=function(_0x16f630,_0x394d26){_0x16f630=_0x16f630-0x0;var _0x1d8e10=_0xd493[_0x16f630];return _0x1d8e10;};'use strict';var _=require(_0x3d49('0x0'));var util=require(_0x3d49('0x1'));var logger=require(_0x3d49('0x2'))(_0x3d49('0x3'));var moment=require(_0x3d49('0x4'));var BPromise=require(_0x3d49('0x5'));var rp=require(_0x3d49('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3d49('0x7'));var config=require(_0x3d49('0x8'));var attributes=require(_0x3d49('0x9'));var integrations=require(_0x3d49('0xa'));module[_0x3d49('0xb')]=function(_0x587a85,_0x34f7cf){return _0x587a85[_0x3d49('0xc')](_0x3d49('0xd'),attributes,{'tableName':_0x3d49('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 22e0a2c..61471c8 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 _0x7852=['result','GetFreshdeskAccount','FreshdeskAccount','findAll','options','where','map','model','include','attributes','stringify','catch','raw','ShowFreshdeskAccount','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x3e8d33,_0x6d239c){var _0x48d81c=function(_0x34ac86){while(--_0x34ac86){_0x3e8d33['push'](_0x3e8d33['shift']());}};_0x48d81c(++_0x6d239c);}(_0x7852,0x137));var _0x2785=function(_0x33f5b1,_0x50490c){_0x33f5b1=_0x33f5b1-0x0;var _0x5bfeed=_0x7852[_0x33f5b1];return _0x5bfeed;};'use strict';var _=require(_0x2785('0x0'));var util=require('util');var moment=require(_0x2785('0x1'));var BPromise=require(_0x2785('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2785('0x3'));var db=require(_0x2785('0x4'))['db'];var utils=require(_0x2785('0x5'));var logger=require('../../config/logger')(_0x2785('0x6'));var config=require(_0x2785('0x7'));var jayson=require(_0x2785('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x9e04f0,_0x5e5db2,_0x483e71){return new BPromise(function(_0x46070e,_0x34b117){return client[_0x2785('0x9')](_0x9e04f0,_0x483e71)[_0x2785('0xa')](function(_0x749ffe){logger[_0x2785('0xb')](_0x2785('0xc'),_0x5e5db2,_0x2785('0xd'));logger[_0x2785('0xe')](_0x2785('0xf'),_0x5e5db2,_0x2785('0xd'),JSON['stringify'](_0x749ffe));if(_0x749ffe[_0x2785('0x10')]){if(_0x749ffe[_0x2785('0x10')][_0x2785('0x11')]===0x1f4){logger[_0x2785('0x10')](_0x2785('0xc'),_0x5e5db2,_0x749ffe[_0x2785('0x10')]['message']);return _0x34b117(_0x749ffe['error'][_0x2785('0x12')]);}logger[_0x2785('0x10')](_0x2785('0xc'),_0x5e5db2,_0x749ffe[_0x2785('0x10')]['message']);return _0x46070e(_0x749ffe[_0x2785('0x10')]['message']);}else{logger['info'](_0x2785('0xc'),_0x5e5db2,'request\x20sent');_0x46070e(_0x749ffe[_0x2785('0x13')][_0x2785('0x12')]);}})['catch'](function(_0x29d60c){logger[_0x2785('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0x5e5db2,_0x29d60c);_0x34b117(_0x29d60c);});});}exports[_0x2785('0x14')]=function(_0x2d1dab){var _0x53d8bf=this;return new Promise(function(_0x53e6f3,_0xa5f4d1){return db[_0x2785('0x15')][_0x2785('0x16')]({'raw':_0x2d1dab[_0x2785('0x17')]?_0x2d1dab['options']['raw']===undefined?!![]:![]:!![],'where':_0x2d1dab[_0x2785('0x17')]?_0x2d1dab[_0x2785('0x17')][_0x2785('0x18')]||null:null,'attributes':_0x2d1dab[_0x2785('0x17')]?_0x2d1dab[_0x2785('0x17')]['attributes']||null:null,'limit':_0x2d1dab[_0x2785('0x17')]?_0x2d1dab[_0x2785('0x17')]['limit']||null:null,'include':_0x2d1dab['options']?_0x2d1dab['options']['include']?_[_0x2785('0x19')](_0x2d1dab[_0x2785('0x17')]['include'],function(_0x2b8784){return{'model':db[_0x2b8784[_0x2785('0x1a')]],'as':_0x2b8784['as'],'attributes':_0x2b8784['attributes'],'include':_0x2b8784[_0x2785('0x1b')]?_['map'](_0x2b8784[_0x2785('0x1b')],function(_0x4ff79c){return{'model':db[_0x4ff79c[_0x2785('0x1a')]],'as':_0x4ff79c['as'],'attributes':_0x4ff79c[_0x2785('0x1c')],'include':_0x4ff79c[_0x2785('0x1b')]?_[_0x2785('0x19')](_0x4ff79c['include'],function(_0x538cee){return{'model':db[_0x538cee[_0x2785('0x1a')]],'as':_0x538cee['as'],'attributes':_0x538cee[_0x2785('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2785('0xa')](function(_0x2ac6ed){logger[_0x2785('0xb')](_0x2785('0x14'),_0x2d1dab);logger[_0x2785('0xe')](_0x2785('0x14'),_0x2d1dab,JSON[_0x2785('0x1d')](_0x2ac6ed));_0x53e6f3(_0x2ac6ed);})[_0x2785('0x1e')](function(_0x6b41af){logger[_0x2785('0x10')]('GetFreshdeskAccount',_0x6b41af[_0x2785('0x12')],_0x2d1dab);_0xa5f4d1(_0x53d8bf[_0x2785('0x10')](0x1f4,_0x6b41af[_0x2785('0x12')]));});});};exports['ShowFreshdeskAccount']=function(_0x34a5f1){var _0x4c6503=this;return new Promise(function(_0x42a4cb,_0x45c606){return db[_0x2785('0x15')]['find']({'raw':_0x34a5f1[_0x2785('0x17')]?_0x34a5f1[_0x2785('0x17')][_0x2785('0x1f')]===undefined?!![]:![]:!![],'where':_0x34a5f1[_0x2785('0x17')]?_0x34a5f1[_0x2785('0x17')][_0x2785('0x18')]||null:null,'attributes':_0x34a5f1[_0x2785('0x17')]?_0x34a5f1['options'][_0x2785('0x1c')]||null:null,'include':_0x34a5f1[_0x2785('0x17')]?_0x34a5f1[_0x2785('0x17')][_0x2785('0x1b')]?_[_0x2785('0x19')](_0x34a5f1[_0x2785('0x17')][_0x2785('0x1b')],function(_0x41c3df){return{'model':db[_0x41c3df['model']],'as':_0x41c3df['as'],'attributes':_0x41c3df['attributes'],'include':_0x41c3df[_0x2785('0x1b')]?_[_0x2785('0x19')](_0x41c3df['include'],function(_0x41f3cf){return{'model':db[_0x41f3cf[_0x2785('0x1a')]],'as':_0x41f3cf['as'],'attributes':_0x41f3cf[_0x2785('0x1c')],'include':_0x41f3cf[_0x2785('0x1b')]?_[_0x2785('0x19')](_0x41f3cf['include'],function(_0x284b6a){return{'model':db[_0x284b6a[_0x2785('0x1a')]],'as':_0x284b6a['as'],'attributes':_0x284b6a[_0x2785('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2785('0xa')](function(_0x2241d6){logger[_0x2785('0xb')](_0x2785('0x20'),_0x34a5f1);logger[_0x2785('0xe')](_0x2785('0x20'),_0x34a5f1,JSON['stringify'](_0x2241d6));_0x42a4cb(_0x2241d6);})[_0x2785('0x1e')](function(_0x388206){logger[_0x2785('0x10')]('ShowFreshdeskAccount',_0x388206[_0x2785('0x12')],_0x34a5f1);_0x45c606(_0x4c6503[_0x2785('0x10')](0x1f4,_0x388206[_0x2785('0x12')]));});});}; \ No newline at end of file +var _0x337e=['../../config/environment','jayson/promise','client','request','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetFreshdeskAccount','FreshdeskAccount','options','raw','attributes','limit','include','map','model','where','ShowFreshdeskAccount','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x40d79b,_0x22a83d){var _0x3ff7a7=function(_0x48e8ae){while(--_0x48e8ae){_0x40d79b['push'](_0x40d79b['shift']());}};_0x3ff7a7(++_0x22a83d);}(_0x337e,0x179));var _0xe337=function(_0x356aaa,_0x44dc26){_0x356aaa=_0x356aaa-0x0;var _0x4ed6fb=_0x337e[_0x356aaa];return _0x4ed6fb;};'use strict';var _=require(_0xe337('0x0'));var util=require('util');var moment=require(_0xe337('0x1'));var BPromise=require(_0xe337('0x2'));var rs=require(_0xe337('0x3'));var fs=require('fs');var Redis=require(_0xe337('0x4'));var db=require(_0xe337('0x5'))['db'];var utils=require(_0xe337('0x6'));var logger=require('../../config/logger')(_0xe337('0x7'));var config=require(_0xe337('0x8'));var jayson=require(_0xe337('0x9'));var client=jayson[_0xe337('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48cdb0,_0xb75af,_0x32ab35){return new BPromise(function(_0x2c9f66,_0x3fbf26){return client[_0xe337('0xb')](_0x48cdb0,_0x32ab35)[_0xe337('0xc')](function(_0x12ddeb){logger['info'](_0xe337('0xd'),_0xb75af,_0xe337('0xe'));logger[_0xe337('0xf')](_0xe337('0x10'),_0xb75af,_0xe337('0xe'),JSON[_0xe337('0x11')](_0x12ddeb));if(_0x12ddeb[_0xe337('0x12')]){if(_0x12ddeb[_0xe337('0x12')][_0xe337('0x13')]===0x1f4){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0xb75af,_0x12ddeb[_0xe337('0x12')]['message']);return _0x3fbf26(_0x12ddeb[_0xe337('0x12')][_0xe337('0x14')]);}logger[_0xe337('0x12')](_0xe337('0xd'),_0xb75af,_0x12ddeb['error'][_0xe337('0x14')]);return _0x2c9f66(_0x12ddeb['error'][_0xe337('0x14')]);}else{logger[_0xe337('0x15')](_0xe337('0xd'),_0xb75af,_0xe337('0xe'));_0x2c9f66(_0x12ddeb[_0xe337('0x16')][_0xe337('0x14')]);}})[_0xe337('0x17')](function(_0x27a6f2){logger['error'](_0xe337('0xd'),_0xb75af,_0x27a6f2);_0x3fbf26(_0x27a6f2);});});}exports[_0xe337('0x18')]=function(_0xc57d2b){var _0x2a230e=this;return new Promise(function(_0x37df16,_0x3c8596){return db[_0xe337('0x19')]['findAll']({'raw':_0xc57d2b[_0xe337('0x1a')]?_0xc57d2b['options'][_0xe337('0x1b')]===undefined?!![]:![]:!![],'where':_0xc57d2b[_0xe337('0x1a')]?_0xc57d2b[_0xe337('0x1a')]['where']||null:null,'attributes':_0xc57d2b[_0xe337('0x1a')]?_0xc57d2b[_0xe337('0x1a')][_0xe337('0x1c')]||null:null,'limit':_0xc57d2b[_0xe337('0x1a')]?_0xc57d2b[_0xe337('0x1a')][_0xe337('0x1d')]||null:null,'include':_0xc57d2b[_0xe337('0x1a')]?_0xc57d2b['options'][_0xe337('0x1e')]?_['map'](_0xc57d2b[_0xe337('0x1a')][_0xe337('0x1e')],function(_0x2a3179){return{'model':db[_0x2a3179['model']],'as':_0x2a3179['as'],'attributes':_0x2a3179[_0xe337('0x1c')],'include':_0x2a3179[_0xe337('0x1e')]?_[_0xe337('0x1f')](_0x2a3179['include'],function(_0x3b9b8f){return{'model':db[_0x3b9b8f[_0xe337('0x20')]],'as':_0x3b9b8f['as'],'attributes':_0x3b9b8f[_0xe337('0x1c')],'include':_0x3b9b8f[_0xe337('0x1e')]?_[_0xe337('0x1f')](_0x3b9b8f[_0xe337('0x1e')],function(_0x5b2bc){return{'model':db[_0x5b2bc[_0xe337('0x20')]],'as':_0x5b2bc['as'],'attributes':_0x5b2bc['attributes']};}):[]};}):[]};}):[]:[]})[_0xe337('0xc')](function(_0x27dade){logger[_0xe337('0x15')]('GetFreshdeskAccount',_0xc57d2b);logger[_0xe337('0xf')](_0xe337('0x18'),_0xc57d2b,JSON[_0xe337('0x11')](_0x27dade));_0x37df16(_0x27dade);})[_0xe337('0x17')](function(_0x5cf11d){logger[_0xe337('0x12')](_0xe337('0x18'),_0x5cf11d[_0xe337('0x14')],_0xc57d2b);_0x3c8596(_0x2a230e[_0xe337('0x12')](0x1f4,_0x5cf11d['message']));});});};exports['ShowFreshdeskAccount']=function(_0x558523){var _0x3a6389=this;return new Promise(function(_0x3f4584,_0x2c7e30){return db['FreshdeskAccount']['find']({'raw':_0x558523[_0xe337('0x1a')]?_0x558523[_0xe337('0x1a')][_0xe337('0x1b')]===undefined?!![]:![]:!![],'where':_0x558523['options']?_0x558523['options'][_0xe337('0x21')]||null:null,'attributes':_0x558523['options']?_0x558523[_0xe337('0x1a')][_0xe337('0x1c')]||null:null,'include':_0x558523[_0xe337('0x1a')]?_0x558523[_0xe337('0x1a')][_0xe337('0x1e')]?_[_0xe337('0x1f')](_0x558523[_0xe337('0x1a')]['include'],function(_0x17d7ff){return{'model':db[_0x17d7ff[_0xe337('0x20')]],'as':_0x17d7ff['as'],'attributes':_0x17d7ff[_0xe337('0x1c')],'include':_0x17d7ff[_0xe337('0x1e')]?_[_0xe337('0x1f')](_0x17d7ff[_0xe337('0x1e')],function(_0x2670a8){return{'model':db[_0x2670a8[_0xe337('0x20')]],'as':_0x2670a8['as'],'attributes':_0x2670a8['attributes'],'include':_0x2670a8[_0xe337('0x1e')]?_['map'](_0x2670a8[_0xe337('0x1e')],function(_0x5669b4){return{'model':db[_0x5669b4[_0xe337('0x20')]],'as':_0x5669b4['as'],'attributes':_0x5669b4[_0xe337('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe337('0xc')](function(_0x119b56){logger[_0xe337('0x15')](_0xe337('0x22'),_0x558523);logger[_0xe337('0xf')]('ShowFreshdeskAccount',_0x558523,JSON[_0xe337('0x11')](_0x119b56));_0x3f4584(_0x119b56);})[_0xe337('0x17')](function(_0x561138){logger['error'](_0xe337('0x22'),_0x561138[_0xe337('0x14')],_0x558523);_0x2c7e30(_0x3a6389[_0xe337('0x12')](0x1f4,_0x561138[_0xe337('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index f47c40d..659cff9 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 _0x801e=['util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags','/:id','update','destroy','exports','multer'];(function(_0x223129,_0x1cc1b6){var _0x2e5051=function(_0x288e87){while(--_0x288e87){_0x223129['push'](_0x223129['shift']());}};_0x2e5051(++_0x1cc1b6);}(_0x801e,0x151));var _0xe801=function(_0x12773a,_0x4ba62a){_0x12773a=_0x12773a-0x0;var _0xf4c2f3=_0x801e[_0x12773a];return _0xf4c2f3;};'use strict';var multer=require(_0xe801('0x0'));var util=require(_0xe801('0x1'));var path=require(_0xe801('0x2'));var timeout=require('connect-timeout');var express=require(_0xe801('0x3'));var router=express[_0xe801('0x4')]();var fs_extra=require(_0xe801('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe801('0x6'));var config=require(_0xe801('0x7'));var controller=require(_0xe801('0x8'));router[_0xe801('0x9')]('/',auth[_0xe801('0xa')](),controller[_0xe801('0xb')]);router[_0xe801('0x9')]('/:id',auth[_0xe801('0xa')](),controller[_0xe801('0xc')]);router[_0xe801('0x9')](_0xe801('0xd'),auth[_0xe801('0xa')](),controller[_0xe801('0xe')]);router[_0xe801('0x9')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xe801('0xf')]);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller[_0xe801('0x10')]);router['get'](_0xe801('0x11'),auth[_0xe801('0xa')](),controller[_0xe801('0x12')]);router[_0xe801('0x13')]('/',auth[_0xe801('0xa')](),controller[_0xe801('0x14')]);router['post'](_0xe801('0x11'),auth[_0xe801('0xa')](),controller[_0xe801('0x15')]);router['put'](_0xe801('0x16'),auth['isAuthenticated'](),controller[_0xe801('0x17')]);router['delete'](_0xe801('0x16'),auth[_0xe801('0xa')](),controller[_0xe801('0x18')]);module[_0xe801('0x19')]=router; \ No newline at end of file +var _0xd238=['/:id/tags','post','create','setTags','put','destroy','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions'];(function(_0xba0394,_0x2c6844){var _0x1789dd=function(_0x437c00){while(--_0x437c00){_0xba0394['push'](_0xba0394['shift']());}};_0x1789dd(++_0x2c6844);}(_0xd238,0x15f));var _0x8d23=function(_0xdf0f66,_0x5f3953){_0xdf0f66=_0xdf0f66-0x0;var _0x55be21=_0xd238[_0xdf0f66];return _0x55be21;};'use strict';var multer=require(_0x8d23('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8d23('0x1'));var express=require(_0x8d23('0x2'));var router=express['Router']();var fs_extra=require(_0x8d23('0x3'));var auth=require(_0x8d23('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x8d23('0x5'));var controller=require(_0x8d23('0x6'));router['get']('/',auth[_0x8d23('0x7')](),controller[_0x8d23('0x8')]);router[_0x8d23('0x9')](_0x8d23('0xa'),auth[_0x8d23('0x7')](),controller[_0x8d23('0xb')]);router[_0x8d23('0x9')](_0x8d23('0xc'),auth['isAuthenticated'](),controller[_0x8d23('0xd')]);router['get'](_0x8d23('0xe'),auth[_0x8d23('0x7')](),controller[_0x8d23('0xf')]);router[_0x8d23('0x9')]('/:id/descriptions',auth[_0x8d23('0x7')](),controller[_0x8d23('0x10')]);router[_0x8d23('0x9')](_0x8d23('0x11'),auth[_0x8d23('0x7')](),controller['getTags']);router[_0x8d23('0x12')]('/',auth[_0x8d23('0x7')](),controller[_0x8d23('0x13')]);router[_0x8d23('0x12')](_0x8d23('0x11'),auth[_0x8d23('0x7')](),controller[_0x8d23('0x14')]);router[_0x8d23('0x15')](_0x8d23('0xa'),auth[_0x8d23('0x7')](),controller['update']);router['delete']('/:id',auth[_0x8d23('0x7')](),controller[_0x8d23('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 3341f0f..e52858c 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 _0xf5b3=['STRING','sequelize','exports'];(function(_0xd70c6b,_0x298494){var _0x511c60=function(_0x1d1aab){while(--_0x1d1aab){_0xd70c6b['push'](_0xd70c6b['shift']());}};_0x511c60(++_0x298494);}(_0xf5b3,0x181));var _0x3f5b=function(_0x2b7ffe,_0x3129be){_0x2b7ffe=_0x2b7ffe-0x0;var _0x1a009a=_0xf5b3[_0x2b7ffe];return _0x1a009a;};'use strict';var Sequelize=require(_0x3f5b('0x0'));module[_0x3f5b('0x1')]={'name':{'type':Sequelize[_0x3f5b('0x2')]},'description':{'type':Sequelize[_0x3f5b('0x2')]}}; \ No newline at end of file +var _0x4fff=['STRING','exports'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x4fff,0xa5));var _0xf4ff=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x4fff[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require('sequelize');module[_0xf4ff('0x0')]={'name':{'type':Sequelize[_0xf4ff('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index ccfee0e..73c164f 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 _0x5b9b=['name','send','index','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','catch','show','params','keys','options','find','create','body','getFields','findOne','FreshdeskField','getSubjects','getDescriptions','getTags','Tag','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','stack'];(function(_0x169a8a,_0x3526b1){var _0x2e8502=function(_0x4c37f3){while(--_0x4c37f3){_0x169a8a['push'](_0x169a8a['shift']());}};_0x2e8502(++_0x3526b1);}(_0x5b9b,0x1ce));var _0xb5b9=function(_0x151782,_0x3c12f3){_0x151782=_0x151782-0x0;var _0x12c3b1=_0x5b9b[_0x151782];return _0x12c3b1;};'use strict';var emlformat=require(_0xb5b9('0x0'));var rimraf=require(_0xb5b9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb5b9('0x2'));var rp=require(_0xb5b9('0x3'));var moment=require(_0xb5b9('0x4'));var BPromise=require(_0xb5b9('0x5'));var Mustache=require(_0xb5b9('0x6'));var util=require(_0xb5b9('0x7'));var path=require(_0xb5b9('0x8'));var sox=require(_0xb5b9('0x9'));var csv=require(_0xb5b9('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb5b9('0xb'));var _=require(_0xb5b9('0xc'));var squel=require(_0xb5b9('0xd'));var crypto=require(_0xb5b9('0xe'));var jsforce=require(_0xb5b9('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb5b9('0x10'));var Redis=require('ioredis');var authService=require(_0xb5b9('0x11'));var qs=require(_0xb5b9('0x12'));var as=require(_0xb5b9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb5b9('0x14'))(_0xb5b9('0x15'));var utils=require(_0xb5b9('0x16'));var config=require(_0xb5b9('0x17'));var licenseUtil=require(_0xb5b9('0x18'));var db=require(_0xb5b9('0x19'))['db'];function respondWithStatusCode(_0x597d29,_0x19cd0a){_0x19cd0a=_0x19cd0a||0xcc;return function(_0x496c91){if(_0x496c91){return _0x597d29[_0xb5b9('0x1a')](_0x19cd0a);}return _0x597d29[_0xb5b9('0x1b')](_0x19cd0a)[_0xb5b9('0x1c')]();};}function respondWithResult(_0x317ac0,_0x3d35ee){_0x3d35ee=_0x3d35ee||0xc8;return function(_0x364f45){if(_0x364f45){return _0x317ac0[_0xb5b9('0x1b')](_0x3d35ee)[_0xb5b9('0x1d')](_0x364f45);}};}function respondWithFilteredResult(_0x59561f,_0x77135e){return function(_0x175056){if(_0x175056){var _0x1b174c=typeof _0x77135e[_0xb5b9('0x1e')]===_0xb5b9('0x1f')&&typeof _0x77135e[_0xb5b9('0x20')]===_0xb5b9('0x1f');var _0x46d1cc=_0x175056[_0xb5b9('0x21')];var _0x28f052=_0x1b174c?0x0:_0x77135e['offset'];var _0x890986=_0x1b174c?_0x175056[_0xb5b9('0x21')]:_0x77135e[_0xb5b9('0x1e')]+_0x77135e[_0xb5b9('0x20')];var _0x208f98;if(_0x890986>=_0x46d1cc){_0x890986=_0x46d1cc;_0x208f98=0xc8;}else{_0x208f98=0xce;}_0x59561f[_0xb5b9('0x1b')](_0x208f98);return _0x59561f[_0xb5b9('0x22')](_0xb5b9('0x23'),_0x28f052+'-'+_0x890986+'/'+_0x46d1cc)['json'](_0x175056);}return null;};}function patchUpdates(_0x5a8f50){return function(_0x45ab24){try{jsonpatch['apply'](_0x45ab24,_0x5a8f50,!![]);}catch(_0x37b35e){return BPromise[_0xb5b9('0x24')](_0x37b35e);}return _0x45ab24[_0xb5b9('0x25')]();};}function saveUpdates(_0x1f5078,_0x5d2b6b){return function(_0xf90743){if(_0xf90743){return _0xf90743[_0xb5b9('0x26')](_0x1f5078)['then'](function(_0x186161){return _0x186161;});}return null;};}function removeEntity(_0x376c4a,_0x34bc33){return function(_0x354a0d){if(_0x354a0d){return _0x354a0d[_0xb5b9('0x27')]()[_0xb5b9('0x28')](function(){_0x376c4a[_0xb5b9('0x1b')](0xcc)[_0xb5b9('0x1c')]();});}};}function handleEntityNotFound(_0xd49f42,_0x3a9570){return function(_0x85e3da){if(!_0x85e3da){_0xd49f42[_0xb5b9('0x1a')](0x194);}return _0x85e3da;};}function handleError(_0x394d1d,_0x52bbfe){_0x52bbfe=_0x52bbfe||0x1f4;return function(_0x390181){logger['error'](_0x390181[_0xb5b9('0x29')]);if(_0x390181[_0xb5b9('0x2a')]){delete _0x390181['name'];}_0x394d1d['status'](_0x52bbfe)[_0xb5b9('0x2b')](_0x390181);};}exports[_0xb5b9('0x2c')]=function(_0xfc5b4e,_0x174390){var _0x1ac418={},_0x4a4104={},_0x272d5b={'count':0x0,'rows':[]};var _0x519eac=_['map'](db[_0xb5b9('0x2d')][_0xb5b9('0x2e')],function(_0x42acb9){return{'name':_0x42acb9[_0xb5b9('0x2f')],'type':_0x42acb9[_0xb5b9('0x30')][_0xb5b9('0x31')]};});_0x4a4104[_0xb5b9('0x32')]=_[_0xb5b9('0x33')](_0x519eac,_0xb5b9('0x2a'));_0x4a4104[_0xb5b9('0x34')]=_['keys'](_0xfc5b4e[_0xb5b9('0x34')]);_0x4a4104[_0xb5b9('0x35')]=_[_0xb5b9('0x36')](_0x4a4104[_0xb5b9('0x32')],_0x4a4104['query']);_0x1ac418[_0xb5b9('0x37')]=_['intersection'](_0x4a4104['model'],qs['fields'](_0xfc5b4e['query'][_0xb5b9('0x38')]));_0x1ac418[_0xb5b9('0x37')]=_0x1ac418[_0xb5b9('0x37')][_0xb5b9('0x39')]?_0x1ac418['attributes']:_0x4a4104[_0xb5b9('0x32')];if(!_0xfc5b4e['query'][_0xb5b9('0x3a')](_0xb5b9('0x3b'))){_0x1ac418[_0xb5b9('0x20')]=qs[_0xb5b9('0x20')](_0xfc5b4e[_0xb5b9('0x34')][_0xb5b9('0x20')]);_0x1ac418['offset']=qs[_0xb5b9('0x1e')](_0xfc5b4e['query'][_0xb5b9('0x1e')]);}_0x1ac418[_0xb5b9('0x3c')]=qs[_0xb5b9('0x3d')](_0xfc5b4e[_0xb5b9('0x34')][_0xb5b9('0x3d')]);_0x1ac418[_0xb5b9('0x3e')]=qs[_0xb5b9('0x35')](_[_0xb5b9('0x3f')](_0xfc5b4e['query'],_0x4a4104['filters']),_0x519eac);if(_0xfc5b4e[_0xb5b9('0x34')][_0xb5b9('0x40')]){_0x1ac418[_0xb5b9('0x3e')]=_[_0xb5b9('0x41')](_0x1ac418[_0xb5b9('0x3e')],{'$or':_[_0xb5b9('0x33')](_0x519eac,function(_0x46042c){if(_0x46042c[_0xb5b9('0x30')]!==_0xb5b9('0x42')){var _0x36cef1={};_0x36cef1[_0x46042c['name']]={'$like':'%'+_0xfc5b4e[_0xb5b9('0x34')][_0xb5b9('0x40')]+'%'};return _0x36cef1;}})});}_0x1ac418=_[_0xb5b9('0x41')]({},_0x1ac418,_0xfc5b4e['options']);var _0x35e79d={'where':_0x1ac418[_0xb5b9('0x3e')]};return db[_0xb5b9('0x2d')]['count'](_0x35e79d)[_0xb5b9('0x28')](function(_0x4ef8fb){_0x272d5b['count']=_0x4ef8fb;if(_0xfc5b4e[_0xb5b9('0x34')]['includeAll']){_0x1ac418[_0xb5b9('0x43')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0xb5b9('0x44')](_0x1ac418);})[_0xb5b9('0x28')](function(_0x221e1e){_0x272d5b['rows']=_0x221e1e;return _0x272d5b;})[_0xb5b9('0x28')](respondWithFilteredResult(_0x174390,_0x1ac418))[_0xb5b9('0x45')](handleError(_0x174390,null));};exports[_0xb5b9('0x46')]=function(_0x406187,_0x3d2603){var _0x20ab48={'raw':![],'where':{'id':_0x406187[_0xb5b9('0x47')]['id']}},_0x187ee4={};_0x187ee4['model']=_['keys'](db[_0xb5b9('0x2d')][_0xb5b9('0x2e')]);_0x187ee4[_0xb5b9('0x34')]=_[_0xb5b9('0x48')](_0x406187['query']);_0x187ee4[_0xb5b9('0x35')]=_['intersection'](_0x187ee4[_0xb5b9('0x32')],_0x187ee4[_0xb5b9('0x34')]);_0x20ab48[_0xb5b9('0x37')]=_['intersection'](_0x187ee4[_0xb5b9('0x32')],qs[_0xb5b9('0x38')](_0x406187[_0xb5b9('0x34')][_0xb5b9('0x38')]));_0x20ab48[_0xb5b9('0x37')]=_0x20ab48['attributes'][_0xb5b9('0x39')]?_0x20ab48[_0xb5b9('0x37')]:_0x187ee4[_0xb5b9('0x32')];if(_0x406187[_0xb5b9('0x34')]['includeAll']){_0x20ab48['include']=[{'all':!![]}];}_0x20ab48=_['merge']({},_0x20ab48,_0x406187[_0xb5b9('0x49')]);return db[_0xb5b9('0x2d')][_0xb5b9('0x4a')](_0x20ab48)[_0xb5b9('0x28')](handleEntityNotFound(_0x3d2603,null))[_0xb5b9('0x28')](respondWithResult(_0x3d2603,null))[_0xb5b9('0x45')](handleError(_0x3d2603,null));};exports[_0xb5b9('0x4b')]=function(_0x166145,_0x3a2026){return db[_0xb5b9('0x2d')][_0xb5b9('0x4b')](_0x166145[_0xb5b9('0x4c')],{})[_0xb5b9('0x28')](respondWithResult(_0x3a2026,0xc9))[_0xb5b9('0x45')](handleError(_0x3a2026,null));};exports['update']=function(_0x3d349a,_0x19a984){if(_0x3d349a[_0xb5b9('0x4c')]['id']){delete _0x3d349a['body']['id'];}return db[_0xb5b9('0x2d')][_0xb5b9('0x4a')]({'where':{'id':_0x3d349a[_0xb5b9('0x47')]['id']}})['then'](handleEntityNotFound(_0x19a984,null))['then'](saveUpdates(_0x3d349a['body'],null))[_0xb5b9('0x28')](respondWithResult(_0x19a984,null))[_0xb5b9('0x45')](handleError(_0x19a984,null));};exports[_0xb5b9('0x27')]=function(_0x49bed8,_0x36032d){return db[_0xb5b9('0x2d')][_0xb5b9('0x4a')]({'where':{'id':_0x49bed8[_0xb5b9('0x47')]['id']}})['then'](handleEntityNotFound(_0x36032d,null))[_0xb5b9('0x28')](removeEntity(_0x36032d,null))['catch'](handleError(_0x36032d,null));};exports[_0xb5b9('0x4d')]=function(_0x5a6283,_0x4738a7,_0x2cea2c){var _0x1a1701={};var _0x316dd5={};var _0x31f3cc;var _0x18761a;return db[_0xb5b9('0x2d')][_0xb5b9('0x4e')]({'where':{'id':_0x5a6283[_0xb5b9('0x47')]['id']}})[_0xb5b9('0x28')](handleEntityNotFound(_0x4738a7,null))[_0xb5b9('0x28')](function(_0x2c6c24){if(_0x2c6c24){_0x31f3cc=_0x2c6c24;_0x316dd5[_0xb5b9('0x32')]=_[_0xb5b9('0x48')](db[_0xb5b9('0x4f')]['rawAttributes']);_0x316dd5[_0xb5b9('0x34')]=_[_0xb5b9('0x48')](_0x5a6283[_0xb5b9('0x34')]);_0x316dd5[_0xb5b9('0x35')]=_[_0xb5b9('0x36')](_0x316dd5[_0xb5b9('0x32')],_0x316dd5[_0xb5b9('0x34')]);_0x1a1701[_0xb5b9('0x37')]=_['intersection'](_0x316dd5[_0xb5b9('0x32')],qs['fields'](_0x5a6283[_0xb5b9('0x34')]['fields']));_0x1a1701[_0xb5b9('0x37')]=_0x1a1701['attributes'][_0xb5b9('0x39')]?_0x1a1701[_0xb5b9('0x37')]:_0x316dd5[_0xb5b9('0x32')];_0x1a1701['order']=qs[_0xb5b9('0x3d')](_0x5a6283[_0xb5b9('0x34')][_0xb5b9('0x3d')]);_0x1a1701[_0xb5b9('0x3e')]=qs[_0xb5b9('0x35')](_[_0xb5b9('0x3f')](_0x5a6283[_0xb5b9('0x34')],_0x316dd5[_0xb5b9('0x35')]));if(_0x5a6283[_0xb5b9('0x34')][_0xb5b9('0x40')]){_0x1a1701[_0xb5b9('0x3e')]=_[_0xb5b9('0x41')](_0x1a1701[_0xb5b9('0x3e')],{'$or':_[_0xb5b9('0x33')](_0x1a1701['attributes'],function(_0x3bf982){var _0x3319f2={};_0x3319f2[_0x3bf982]={'$like':'%'+_0x5a6283[_0xb5b9('0x34')][_0xb5b9('0x40')]+'%'};return _0x3319f2;})});}_0x1a1701=_['merge']({},_0x1a1701,_0x5a6283[_0xb5b9('0x49')]);return _0x31f3cc['getFields'](_0x1a1701);}})[_0xb5b9('0x28')](function(_0x16075a){if(_0x16075a){_0x18761a=_0x16075a[_0xb5b9('0x39')];if(!_0x5a6283['query'][_0xb5b9('0x3a')]('nolimit')){_0x1a1701['limit']=qs['limit'](_0x5a6283[_0xb5b9('0x34')][_0xb5b9('0x20')]);_0x1a1701[_0xb5b9('0x1e')]=qs['offset'](_0x5a6283[_0xb5b9('0x34')]['offset']);}return _0x31f3cc['getFields'](_0x1a1701);}})[_0xb5b9('0x28')](function(_0x54d24a){if(_0x54d24a){return _0x54d24a?{'count':_0x18761a,'rows':_0x54d24a}:null;}})['then'](respondWithResult(_0x4738a7,null))[_0xb5b9('0x45')](handleError(_0x4738a7,null));};exports[_0xb5b9('0x50')]=function(_0x54ac15,_0x21e611,_0x57aca4){var _0x4d35e9={};var _0x2ec0c3={};var _0x2c130c;var _0x26c528;return db[_0xb5b9('0x2d')]['findOne']({'where':{'id':_0x54ac15[_0xb5b9('0x47')]['id']}})['then'](handleEntityNotFound(_0x21e611,null))[_0xb5b9('0x28')](function(_0xe5f4ee){if(_0xe5f4ee){_0x2c130c=_0xe5f4ee;_0x2ec0c3[_0xb5b9('0x32')]=_[_0xb5b9('0x48')](db[_0xb5b9('0x4f')]['rawAttributes']);_0x2ec0c3[_0xb5b9('0x34')]=_[_0xb5b9('0x48')](_0x54ac15[_0xb5b9('0x34')]);_0x2ec0c3['filters']=_[_0xb5b9('0x36')](_0x2ec0c3['model'],_0x2ec0c3[_0xb5b9('0x34')]);_0x4d35e9['attributes']=_['intersection'](_0x2ec0c3[_0xb5b9('0x32')],qs[_0xb5b9('0x38')](_0x54ac15[_0xb5b9('0x34')]['fields']));_0x4d35e9['attributes']=_0x4d35e9['attributes'][_0xb5b9('0x39')]?_0x4d35e9[_0xb5b9('0x37')]:_0x2ec0c3[_0xb5b9('0x32')];_0x4d35e9[_0xb5b9('0x3c')]=qs['sort'](_0x54ac15[_0xb5b9('0x34')][_0xb5b9('0x3d')]);_0x4d35e9[_0xb5b9('0x3e')]=qs['filters'](_[_0xb5b9('0x3f')](_0x54ac15[_0xb5b9('0x34')],_0x2ec0c3[_0xb5b9('0x35')]));if(_0x54ac15[_0xb5b9('0x34')]['filter']){_0x4d35e9[_0xb5b9('0x3e')]=_[_0xb5b9('0x41')](_0x4d35e9[_0xb5b9('0x3e')],{'$or':_[_0xb5b9('0x33')](_0x4d35e9['attributes'],function(_0x42a3f3){var _0x5ebb0b={};_0x5ebb0b[_0x42a3f3]={'$like':'%'+_0x54ac15['query'][_0xb5b9('0x40')]+'%'};return _0x5ebb0b;})});}_0x4d35e9=_['merge']({},_0x4d35e9,_0x54ac15[_0xb5b9('0x49')]);return _0x2c130c[_0xb5b9('0x50')](_0x4d35e9);}})[_0xb5b9('0x28')](function(_0x44e6a8){if(_0x44e6a8){_0x26c528=_0x44e6a8[_0xb5b9('0x39')];if(!_0x54ac15[_0xb5b9('0x34')][_0xb5b9('0x3a')](_0xb5b9('0x3b'))){_0x4d35e9[_0xb5b9('0x20')]=qs['limit'](_0x54ac15['query'][_0xb5b9('0x20')]);_0x4d35e9['offset']=qs[_0xb5b9('0x1e')](_0x54ac15['query'][_0xb5b9('0x1e')]);}return _0x2c130c[_0xb5b9('0x50')](_0x4d35e9);}})[_0xb5b9('0x28')](function(_0x352b82){if(_0x352b82){return _0x352b82?{'count':_0x26c528,'rows':_0x352b82}:null;}})['then'](respondWithResult(_0x21e611,null))[_0xb5b9('0x45')](handleError(_0x21e611,null));};exports[_0xb5b9('0x51')]=function(_0x2d1db6,_0x4f9586,_0x5f32d8){var _0x299558={};var _0x521f58={};var _0xe83029;var _0x53aae2;return db[_0xb5b9('0x2d')][_0xb5b9('0x4e')]({'where':{'id':_0x2d1db6[_0xb5b9('0x47')]['id']}})[_0xb5b9('0x28')](handleEntityNotFound(_0x4f9586,null))['then'](function(_0x3f618c){if(_0x3f618c){_0xe83029=_0x3f618c;_0x521f58[_0xb5b9('0x32')]=_['keys'](db['FreshdeskField'][_0xb5b9('0x2e')]);_0x521f58[_0xb5b9('0x34')]=_[_0xb5b9('0x48')](_0x2d1db6['query']);_0x521f58[_0xb5b9('0x35')]=_[_0xb5b9('0x36')](_0x521f58[_0xb5b9('0x32')],_0x521f58[_0xb5b9('0x34')]);_0x299558[_0xb5b9('0x37')]=_['intersection'](_0x521f58[_0xb5b9('0x32')],qs[_0xb5b9('0x38')](_0x2d1db6[_0xb5b9('0x34')][_0xb5b9('0x38')]));_0x299558['attributes']=_0x299558[_0xb5b9('0x37')]['length']?_0x299558['attributes']:_0x521f58[_0xb5b9('0x32')];_0x299558[_0xb5b9('0x3c')]=qs[_0xb5b9('0x3d')](_0x2d1db6[_0xb5b9('0x34')]['sort']);_0x299558['where']=qs[_0xb5b9('0x35')](_[_0xb5b9('0x3f')](_0x2d1db6['query'],_0x521f58[_0xb5b9('0x35')]));if(_0x2d1db6[_0xb5b9('0x34')][_0xb5b9('0x40')]){_0x299558['where']=_['merge'](_0x299558[_0xb5b9('0x3e')],{'$or':_[_0xb5b9('0x33')](_0x299558['attributes'],function(_0xdf4fdb){var _0x14de3d={};_0x14de3d[_0xdf4fdb]={'$like':'%'+_0x2d1db6[_0xb5b9('0x34')]['filter']+'%'};return _0x14de3d;})});}_0x299558=_[_0xb5b9('0x41')]({},_0x299558,_0x2d1db6[_0xb5b9('0x49')]);return _0xe83029[_0xb5b9('0x51')](_0x299558);}})[_0xb5b9('0x28')](function(_0xbc8e6f){if(_0xbc8e6f){_0x53aae2=_0xbc8e6f[_0xb5b9('0x39')];if(!_0x2d1db6[_0xb5b9('0x34')]['hasOwnProperty'](_0xb5b9('0x3b'))){_0x299558['limit']=qs[_0xb5b9('0x20')](_0x2d1db6[_0xb5b9('0x34')][_0xb5b9('0x20')]);_0x299558['offset']=qs['offset'](_0x2d1db6['query'][_0xb5b9('0x1e')]);}return _0xe83029[_0xb5b9('0x51')](_0x299558);}})[_0xb5b9('0x28')](function(_0x63d3f0){if(_0x63d3f0){return _0x63d3f0?{'count':_0x53aae2,'rows':_0x63d3f0}:null;}})[_0xb5b9('0x28')](respondWithResult(_0x4f9586,null))[_0xb5b9('0x45')](handleError(_0x4f9586,null));};exports[_0xb5b9('0x52')]=function(_0x282b03,_0x39cc36,_0x326af6){var _0x56ed72={};var _0x2b09b5={};var _0x5e69d4;var _0x34bb65;return db[_0xb5b9('0x2d')][_0xb5b9('0x4e')]({'where':{'id':_0x282b03['params']['id']}})[_0xb5b9('0x28')](handleEntityNotFound(_0x39cc36,null))[_0xb5b9('0x28')](function(_0x2b3112){if(_0x2b3112){_0x5e69d4=_0x2b3112;_0x2b09b5[_0xb5b9('0x32')]=_[_0xb5b9('0x48')](db[_0xb5b9('0x53')]['rawAttributes']);_0x2b09b5[_0xb5b9('0x34')]=_[_0xb5b9('0x48')](_0x282b03[_0xb5b9('0x34')]);_0x2b09b5[_0xb5b9('0x35')]=_[_0xb5b9('0x36')](_0x2b09b5['model'],_0x2b09b5[_0xb5b9('0x34')]);_0x56ed72[_0xb5b9('0x37')]=_[_0xb5b9('0x36')](_0x2b09b5[_0xb5b9('0x32')],qs[_0xb5b9('0x38')](_0x282b03['query']['fields']));_0x56ed72[_0xb5b9('0x37')]=_0x56ed72['attributes'][_0xb5b9('0x39')]?_0x56ed72[_0xb5b9('0x37')]:_0x2b09b5[_0xb5b9('0x32')];_0x56ed72[_0xb5b9('0x3c')]=qs['sort'](_0x282b03['query'][_0xb5b9('0x3d')]);_0x56ed72[_0xb5b9('0x3e')]=qs['filters'](_[_0xb5b9('0x3f')](_0x282b03[_0xb5b9('0x34')],_0x2b09b5[_0xb5b9('0x35')]));if(_0x282b03[_0xb5b9('0x34')]['filter']){_0x56ed72[_0xb5b9('0x3e')]=_[_0xb5b9('0x41')](_0x56ed72[_0xb5b9('0x3e')],{'$or':_[_0xb5b9('0x33')](_0x56ed72[_0xb5b9('0x37')],function(_0x3f1e2f){var _0x3fc359={};_0x3fc359[_0x3f1e2f]={'$like':'%'+_0x282b03[_0xb5b9('0x34')][_0xb5b9('0x40')]+'%'};return _0x3fc359;})});}_0x56ed72=_[_0xb5b9('0x41')]({},_0x56ed72,_0x282b03[_0xb5b9('0x49')]);return _0x5e69d4[_0xb5b9('0x52')](_0x56ed72);}})[_0xb5b9('0x28')](function(_0x3a528b){if(_0x3a528b){_0x34bb65=_0x3a528b['length'];if(!_0x282b03[_0xb5b9('0x34')]['hasOwnProperty'](_0xb5b9('0x3b'))){_0x56ed72['limit']=qs[_0xb5b9('0x20')](_0x282b03['query']['limit']);_0x56ed72[_0xb5b9('0x1e')]=qs[_0xb5b9('0x1e')](_0x282b03[_0xb5b9('0x34')][_0xb5b9('0x1e')]);}return _0x5e69d4[_0xb5b9('0x52')](_0x56ed72);}})[_0xb5b9('0x28')](function(_0x12df3b){if(_0x12df3b){return _0x12df3b?{'count':_0x34bb65,'rows':_0x12df3b}:null;}})[_0xb5b9('0x28')](respondWithResult(_0x39cc36,null))[_0xb5b9('0x45')](handleError(_0x39cc36,null));};exports['setTags']=function(_0x16db42,_0x20400b,_0x467d13){if(_0x16db42[_0xb5b9('0x4c')]['id']){delete _0x16db42['body']['id'];}return db[_0xb5b9('0x2d')][_0xb5b9('0x4e')]({'where':{'id':_0x16db42[_0xb5b9('0x47')]['id']}})[_0xb5b9('0x28')](handleEntityNotFound(_0x20400b,null))[_0xb5b9('0x28')](function(_0xf488f0){if(_0xf488f0){return _0xf488f0['setTags'](_0x16db42[_0xb5b9('0x4c')]['ids']||[]);}return null;})[_0xb5b9('0x28')](respondWithResult(_0x20400b,null))[_0xb5b9('0x45')](handleError(_0x20400b,null));}; \ No newline at end of file +var _0x72b3=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','FreshdeskConfiguration','rawAttributes','fieldName','type','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','options','find','create','body','params','getFields','findOne','FreshdeskField','getSubjects','getDescriptions','Tag','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x3f763e,_0x701e4e){var _0xbaeae3=function(_0x3bc827){while(--_0x3bc827){_0x3f763e['push'](_0x3f763e['shift']());}};_0xbaeae3(++_0x701e4e);}(_0x72b3,0x99));var _0x372b=function(_0x228ac9,_0x42f065){_0x228ac9=_0x228ac9-0x0;var _0x69fe02=_0x72b3[_0x228ac9];return _0x69fe02;};'use strict';var emlformat=require(_0x372b('0x0'));var rimraf=require(_0x372b('0x1'));var zipdir=require(_0x372b('0x2'));var jsonpatch=require(_0x372b('0x3'));var rp=require('request-promise');var moment=require(_0x372b('0x4'));var BPromise=require(_0x372b('0x5'));var Mustache=require('mustache');var util=require(_0x372b('0x6'));var path=require(_0x372b('0x7'));var sox=require(_0x372b('0x8'));var csv=require(_0x372b('0x9'));var ejs=require(_0x372b('0xa'));var fs=require('fs');var fs_extra=require(_0x372b('0xb'));var _=require(_0x372b('0xc'));var squel=require(_0x372b('0xd'));var crypto=require('crypto');var jsforce=require(_0x372b('0xe'));var deskjs=require(_0x372b('0xf'));var toCsv=require(_0x372b('0x9'));var querystring=require(_0x372b('0x10'));var Papa=require('papaparse');var Redis=require(_0x372b('0x11'));var authService=require(_0x372b('0x12'));var qs=require(_0x372b('0x13'));var as=require(_0x372b('0x14'));var hardwareService=require(_0x372b('0x15'));var logger=require(_0x372b('0x16'))(_0x372b('0x17'));var utils=require(_0x372b('0x18'));var config=require(_0x372b('0x19'));var licenseUtil=require(_0x372b('0x1a'));var db=require(_0x372b('0x1b'))['db'];function respondWithStatusCode(_0x383d2e,_0xbf533f){_0xbf533f=_0xbf533f||0xcc;return function(_0x3b5c49){if(_0x3b5c49){return _0x383d2e[_0x372b('0x1c')](_0xbf533f);}return _0x383d2e[_0x372b('0x1d')](_0xbf533f)[_0x372b('0x1e')]();};}function respondWithResult(_0x25d7a4,_0x52aded){_0x52aded=_0x52aded||0xc8;return function(_0x5cbcde){if(_0x5cbcde){return _0x25d7a4[_0x372b('0x1d')](_0x52aded)[_0x372b('0x1f')](_0x5cbcde);}};}function respondWithFilteredResult(_0x79ffac,_0x55cd8a){return function(_0x4b0def){if(_0x4b0def){var _0xf17ca9=typeof _0x55cd8a[_0x372b('0x20')]===_0x372b('0x21')&&typeof _0x55cd8a[_0x372b('0x22')]===_0x372b('0x21');var _0xb226c=_0x4b0def[_0x372b('0x23')];var _0x56e78=_0xf17ca9?0x0:_0x55cd8a[_0x372b('0x20')];var _0x257ad0=_0xf17ca9?_0x4b0def[_0x372b('0x23')]:_0x55cd8a[_0x372b('0x20')]+_0x55cd8a[_0x372b('0x22')];var _0x3693b1;if(_0x257ad0>=_0xb226c){_0x257ad0=_0xb226c;_0x3693b1=0xc8;}else{_0x3693b1=0xce;}_0x79ffac[_0x372b('0x1d')](_0x3693b1);return _0x79ffac[_0x372b('0x24')](_0x372b('0x25'),_0x56e78+'-'+_0x257ad0+'/'+_0xb226c)[_0x372b('0x1f')](_0x4b0def);}return null;};}function patchUpdates(_0x34660b){return function(_0x55874f){try{jsonpatch['apply'](_0x55874f,_0x34660b,!![]);}catch(_0x779125){return BPromise[_0x372b('0x26')](_0x779125);}return _0x55874f[_0x372b('0x27')]();};}function saveUpdates(_0x18df50,_0x39d5fe){return function(_0x11434f){if(_0x11434f){return _0x11434f[_0x372b('0x28')](_0x18df50)[_0x372b('0x29')](function(_0x484941){return _0x484941;});}return null;};}function removeEntity(_0x521ed2,_0x3f0c6a){return function(_0x5dac83){if(_0x5dac83){return _0x5dac83[_0x372b('0x2a')]()[_0x372b('0x29')](function(){_0x521ed2[_0x372b('0x1d')](0xcc)[_0x372b('0x1e')]();});}};}function handleEntityNotFound(_0x228956,_0x493c5b){return function(_0xf75127){if(!_0xf75127){_0x228956['sendStatus'](0x194);}return _0xf75127;};}function handleError(_0x5edb31,_0x3c0d05){_0x3c0d05=_0x3c0d05||0x1f4;return function(_0x39f68d){logger[_0x372b('0x2b')](_0x39f68d[_0x372b('0x2c')]);if(_0x39f68d[_0x372b('0x2d')]){delete _0x39f68d[_0x372b('0x2d')];}_0x5edb31[_0x372b('0x1d')](_0x3c0d05)[_0x372b('0x2e')](_0x39f68d);};}exports['index']=function(_0x4e750a,_0x13fd3b){var _0x3c652f={},_0x245857={},_0x3e5396={'count':0x0,'rows':[]};var _0x599e30=_[_0x372b('0x2f')](db[_0x372b('0x30')][_0x372b('0x31')],function(_0x48647b){return{'name':_0x48647b[_0x372b('0x32')],'type':_0x48647b[_0x372b('0x33')]['key']};});_0x245857[_0x372b('0x34')]=_[_0x372b('0x2f')](_0x599e30,_0x372b('0x2d'));_0x245857['query']=_[_0x372b('0x35')](_0x4e750a['query']);_0x245857[_0x372b('0x36')]=_[_0x372b('0x37')](_0x245857[_0x372b('0x34')],_0x245857[_0x372b('0x38')]);_0x3c652f[_0x372b('0x39')]=_[_0x372b('0x37')](_0x245857[_0x372b('0x34')],qs['fields'](_0x4e750a['query'][_0x372b('0x3a')]));_0x3c652f['attributes']=_0x3c652f['attributes'][_0x372b('0x3b')]?_0x3c652f[_0x372b('0x39')]:_0x245857[_0x372b('0x34')];if(!_0x4e750a[_0x372b('0x38')][_0x372b('0x3c')](_0x372b('0x3d'))){_0x3c652f[_0x372b('0x22')]=qs[_0x372b('0x22')](_0x4e750a[_0x372b('0x38')][_0x372b('0x22')]);_0x3c652f[_0x372b('0x20')]=qs[_0x372b('0x20')](_0x4e750a['query'][_0x372b('0x20')]);}_0x3c652f[_0x372b('0x3e')]=qs[_0x372b('0x3f')](_0x4e750a[_0x372b('0x38')][_0x372b('0x3f')]);_0x3c652f[_0x372b('0x40')]=qs[_0x372b('0x36')](_[_0x372b('0x41')](_0x4e750a[_0x372b('0x38')],_0x245857['filters']),_0x599e30);if(_0x4e750a[_0x372b('0x38')][_0x372b('0x42')]){_0x3c652f[_0x372b('0x40')]=_[_0x372b('0x43')](_0x3c652f[_0x372b('0x40')],{'$or':_[_0x372b('0x2f')](_0x599e30,function(_0x50be8e){if(_0x50be8e[_0x372b('0x33')]!==_0x372b('0x44')){var _0x33e9d7={};_0x33e9d7[_0x50be8e[_0x372b('0x2d')]]={'$like':'%'+_0x4e750a['query'][_0x372b('0x42')]+'%'};return _0x33e9d7;}})});}_0x3c652f=_['merge']({},_0x3c652f,_0x4e750a['options']);var _0x64423d={'where':_0x3c652f[_0x372b('0x40')]};return db[_0x372b('0x30')]['count'](_0x64423d)[_0x372b('0x29')](function(_0x1912c3){_0x3e5396[_0x372b('0x23')]=_0x1912c3;if(_0x4e750a['query'][_0x372b('0x45')]){_0x3c652f[_0x372b('0x46')]=[{'all':!![]}];}return db[_0x372b('0x30')]['findAll'](_0x3c652f);})[_0x372b('0x29')](function(_0x560c50){_0x3e5396[_0x372b('0x47')]=_0x560c50;return _0x3e5396;})['then'](respondWithFilteredResult(_0x13fd3b,_0x3c652f))[_0x372b('0x48')](handleError(_0x13fd3b,null));};exports[_0x372b('0x49')]=function(_0xce9b83,_0x224108){var _0x434200={'raw':![],'where':{'id':_0xce9b83['params']['id']}},_0x45d357={};_0x45d357['model']=_[_0x372b('0x35')](db[_0x372b('0x30')][_0x372b('0x31')]);_0x45d357['query']=_[_0x372b('0x35')](_0xce9b83[_0x372b('0x38')]);_0x45d357['filters']=_[_0x372b('0x37')](_0x45d357[_0x372b('0x34')],_0x45d357[_0x372b('0x38')]);_0x434200['attributes']=_[_0x372b('0x37')](_0x45d357[_0x372b('0x34')],qs['fields'](_0xce9b83[_0x372b('0x38')]['fields']));_0x434200['attributes']=_0x434200[_0x372b('0x39')][_0x372b('0x3b')]?_0x434200[_0x372b('0x39')]:_0x45d357[_0x372b('0x34')];if(_0xce9b83['query'][_0x372b('0x45')]){_0x434200[_0x372b('0x46')]=[{'all':!![]}];}_0x434200=_[_0x372b('0x43')]({},_0x434200,_0xce9b83[_0x372b('0x4a')]);return db[_0x372b('0x30')][_0x372b('0x4b')](_0x434200)['then'](handleEntityNotFound(_0x224108,null))['then'](respondWithResult(_0x224108,null))['catch'](handleError(_0x224108,null));};exports[_0x372b('0x4c')]=function(_0x554e4d,_0x3ddfdb){return db[_0x372b('0x30')][_0x372b('0x4c')](_0x554e4d[_0x372b('0x4d')],{})[_0x372b('0x29')](respondWithResult(_0x3ddfdb,0xc9))['catch'](handleError(_0x3ddfdb,null));};exports[_0x372b('0x28')]=function(_0xae8605,_0x25a08f){if(_0xae8605[_0x372b('0x4d')]['id']){delete _0xae8605[_0x372b('0x4d')]['id'];}return db[_0x372b('0x30')][_0x372b('0x4b')]({'where':{'id':_0xae8605[_0x372b('0x4e')]['id']}})[_0x372b('0x29')](handleEntityNotFound(_0x25a08f,null))['then'](saveUpdates(_0xae8605[_0x372b('0x4d')],null))[_0x372b('0x29')](respondWithResult(_0x25a08f,null))[_0x372b('0x48')](handleError(_0x25a08f,null));};exports[_0x372b('0x2a')]=function(_0x3d1bc1,_0x3a388b){return db[_0x372b('0x30')][_0x372b('0x4b')]({'where':{'id':_0x3d1bc1[_0x372b('0x4e')]['id']}})[_0x372b('0x29')](handleEntityNotFound(_0x3a388b,null))[_0x372b('0x29')](removeEntity(_0x3a388b,null))[_0x372b('0x48')](handleError(_0x3a388b,null));};exports[_0x372b('0x4f')]=function(_0x53bc8d,_0x1753bb,_0x2ad625){var _0x9a4171={};var _0x2fbe7e={};var _0x657d14;var _0x2c7841;return db['FreshdeskConfiguration'][_0x372b('0x50')]({'where':{'id':_0x53bc8d[_0x372b('0x4e')]['id']}})[_0x372b('0x29')](handleEntityNotFound(_0x1753bb,null))[_0x372b('0x29')](function(_0x334682){if(_0x334682){_0x657d14=_0x334682;_0x2fbe7e[_0x372b('0x34')]=_['keys'](db['FreshdeskField']['rawAttributes']);_0x2fbe7e[_0x372b('0x38')]=_[_0x372b('0x35')](_0x53bc8d[_0x372b('0x38')]);_0x2fbe7e[_0x372b('0x36')]=_[_0x372b('0x37')](_0x2fbe7e[_0x372b('0x34')],_0x2fbe7e[_0x372b('0x38')]);_0x9a4171['attributes']=_[_0x372b('0x37')](_0x2fbe7e['model'],qs[_0x372b('0x3a')](_0x53bc8d[_0x372b('0x38')]['fields']));_0x9a4171[_0x372b('0x39')]=_0x9a4171[_0x372b('0x39')][_0x372b('0x3b')]?_0x9a4171[_0x372b('0x39')]:_0x2fbe7e[_0x372b('0x34')];_0x9a4171[_0x372b('0x3e')]=qs[_0x372b('0x3f')](_0x53bc8d[_0x372b('0x38')][_0x372b('0x3f')]);_0x9a4171[_0x372b('0x40')]=qs[_0x372b('0x36')](_['pick'](_0x53bc8d[_0x372b('0x38')],_0x2fbe7e['filters']));if(_0x53bc8d[_0x372b('0x38')][_0x372b('0x42')]){_0x9a4171['where']=_[_0x372b('0x43')](_0x9a4171[_0x372b('0x40')],{'$or':_['map'](_0x9a4171[_0x372b('0x39')],function(_0x29ddab){var _0x23637c={};_0x23637c[_0x29ddab]={'$like':'%'+_0x53bc8d[_0x372b('0x38')]['filter']+'%'};return _0x23637c;})});}_0x9a4171=_['merge']({},_0x9a4171,_0x53bc8d[_0x372b('0x4a')]);return _0x657d14[_0x372b('0x4f')](_0x9a4171);}})[_0x372b('0x29')](function(_0x4f20a8){if(_0x4f20a8){_0x2c7841=_0x4f20a8[_0x372b('0x3b')];if(!_0x53bc8d[_0x372b('0x38')][_0x372b('0x3c')]('nolimit')){_0x9a4171[_0x372b('0x22')]=qs[_0x372b('0x22')](_0x53bc8d['query'][_0x372b('0x22')]);_0x9a4171[_0x372b('0x20')]=qs['offset'](_0x53bc8d[_0x372b('0x38')][_0x372b('0x20')]);}return _0x657d14[_0x372b('0x4f')](_0x9a4171);}})[_0x372b('0x29')](function(_0xc57c36){if(_0xc57c36){return _0xc57c36?{'count':_0x2c7841,'rows':_0xc57c36}:null;}})[_0x372b('0x29')](respondWithResult(_0x1753bb,null))[_0x372b('0x48')](handleError(_0x1753bb,null));};exports['getSubjects']=function(_0x4b4ebc,_0x164d21,_0x3ea159){var _0xb1e824={};var _0x1e0e61={};var _0x3b2612;var _0x4b0fd5;return db['FreshdeskConfiguration'][_0x372b('0x50')]({'where':{'id':_0x4b4ebc['params']['id']}})['then'](handleEntityNotFound(_0x164d21,null))['then'](function(_0xb33b26){if(_0xb33b26){_0x3b2612=_0xb33b26;_0x1e0e61['model']=_['keys'](db[_0x372b('0x51')][_0x372b('0x31')]);_0x1e0e61[_0x372b('0x38')]=_['keys'](_0x4b4ebc[_0x372b('0x38')]);_0x1e0e61[_0x372b('0x36')]=_[_0x372b('0x37')](_0x1e0e61['model'],_0x1e0e61[_0x372b('0x38')]);_0xb1e824[_0x372b('0x39')]=_[_0x372b('0x37')](_0x1e0e61['model'],qs['fields'](_0x4b4ebc[_0x372b('0x38')]['fields']));_0xb1e824['attributes']=_0xb1e824[_0x372b('0x39')][_0x372b('0x3b')]?_0xb1e824[_0x372b('0x39')]:_0x1e0e61['model'];_0xb1e824['order']=qs['sort'](_0x4b4ebc[_0x372b('0x38')][_0x372b('0x3f')]);_0xb1e824['where']=qs[_0x372b('0x36')](_[_0x372b('0x41')](_0x4b4ebc['query'],_0x1e0e61[_0x372b('0x36')]));if(_0x4b4ebc[_0x372b('0x38')][_0x372b('0x42')]){_0xb1e824[_0x372b('0x40')]=_[_0x372b('0x43')](_0xb1e824[_0x372b('0x40')],{'$or':_['map'](_0xb1e824[_0x372b('0x39')],function(_0x5d2e6b){var _0x2184d0={};_0x2184d0[_0x5d2e6b]={'$like':'%'+_0x4b4ebc[_0x372b('0x38')]['filter']+'%'};return _0x2184d0;})});}_0xb1e824=_[_0x372b('0x43')]({},_0xb1e824,_0x4b4ebc[_0x372b('0x4a')]);return _0x3b2612[_0x372b('0x52')](_0xb1e824);}})[_0x372b('0x29')](function(_0x3a0bee){if(_0x3a0bee){_0x4b0fd5=_0x3a0bee[_0x372b('0x3b')];if(!_0x4b4ebc[_0x372b('0x38')][_0x372b('0x3c')](_0x372b('0x3d'))){_0xb1e824[_0x372b('0x22')]=qs['limit'](_0x4b4ebc[_0x372b('0x38')][_0x372b('0x22')]);_0xb1e824[_0x372b('0x20')]=qs['offset'](_0x4b4ebc[_0x372b('0x38')][_0x372b('0x20')]);}return _0x3b2612[_0x372b('0x52')](_0xb1e824);}})[_0x372b('0x29')](function(_0x2833e7){if(_0x2833e7){return _0x2833e7?{'count':_0x4b0fd5,'rows':_0x2833e7}:null;}})['then'](respondWithResult(_0x164d21,null))[_0x372b('0x48')](handleError(_0x164d21,null));};exports[_0x372b('0x53')]=function(_0x53b656,_0x2fe47d,_0x44cedf){var _0x2187a4={};var _0x83a3e8={};var _0x643479;var _0xd80e28;return db[_0x372b('0x30')][_0x372b('0x50')]({'where':{'id':_0x53b656[_0x372b('0x4e')]['id']}})[_0x372b('0x29')](handleEntityNotFound(_0x2fe47d,null))[_0x372b('0x29')](function(_0x3144e4){if(_0x3144e4){_0x643479=_0x3144e4;_0x83a3e8[_0x372b('0x34')]=_['keys'](db[_0x372b('0x51')][_0x372b('0x31')]);_0x83a3e8[_0x372b('0x38')]=_[_0x372b('0x35')](_0x53b656[_0x372b('0x38')]);_0x83a3e8[_0x372b('0x36')]=_['intersection'](_0x83a3e8['model'],_0x83a3e8[_0x372b('0x38')]);_0x2187a4['attributes']=_[_0x372b('0x37')](_0x83a3e8[_0x372b('0x34')],qs['fields'](_0x53b656[_0x372b('0x38')]['fields']));_0x2187a4[_0x372b('0x39')]=_0x2187a4[_0x372b('0x39')][_0x372b('0x3b')]?_0x2187a4[_0x372b('0x39')]:_0x83a3e8['model'];_0x2187a4['order']=qs['sort'](_0x53b656[_0x372b('0x38')][_0x372b('0x3f')]);_0x2187a4[_0x372b('0x40')]=qs[_0x372b('0x36')](_['pick'](_0x53b656[_0x372b('0x38')],_0x83a3e8[_0x372b('0x36')]));if(_0x53b656[_0x372b('0x38')][_0x372b('0x42')]){_0x2187a4[_0x372b('0x40')]=_[_0x372b('0x43')](_0x2187a4[_0x372b('0x40')],{'$or':_[_0x372b('0x2f')](_0x2187a4[_0x372b('0x39')],function(_0x35a180){var _0x307b54={};_0x307b54[_0x35a180]={'$like':'%'+_0x53b656[_0x372b('0x38')][_0x372b('0x42')]+'%'};return _0x307b54;})});}_0x2187a4=_[_0x372b('0x43')]({},_0x2187a4,_0x53b656[_0x372b('0x4a')]);return _0x643479[_0x372b('0x53')](_0x2187a4);}})['then'](function(_0x235f9f){if(_0x235f9f){_0xd80e28=_0x235f9f['length'];if(!_0x53b656['query']['hasOwnProperty'](_0x372b('0x3d'))){_0x2187a4[_0x372b('0x22')]=qs[_0x372b('0x22')](_0x53b656[_0x372b('0x38')][_0x372b('0x22')]);_0x2187a4[_0x372b('0x20')]=qs[_0x372b('0x20')](_0x53b656[_0x372b('0x38')][_0x372b('0x20')]);}return _0x643479[_0x372b('0x53')](_0x2187a4);}})[_0x372b('0x29')](function(_0xf717a6){if(_0xf717a6){return _0xf717a6?{'count':_0xd80e28,'rows':_0xf717a6}:null;}})[_0x372b('0x29')](respondWithResult(_0x2fe47d,null))['catch'](handleError(_0x2fe47d,null));};exports['getTags']=function(_0x5f50c1,_0x24ab50,_0x2a19d3){var _0x1dd6ab={};var _0x3f6016={};var _0x5c6725;var _0x7c00ca;return db[_0x372b('0x30')][_0x372b('0x50')]({'where':{'id':_0x5f50c1[_0x372b('0x4e')]['id']}})['then'](handleEntityNotFound(_0x24ab50,null))[_0x372b('0x29')](function(_0x25a6fc){if(_0x25a6fc){_0x5c6725=_0x25a6fc;_0x3f6016[_0x372b('0x34')]=_['keys'](db[_0x372b('0x54')][_0x372b('0x31')]);_0x3f6016[_0x372b('0x38')]=_[_0x372b('0x35')](_0x5f50c1[_0x372b('0x38')]);_0x3f6016[_0x372b('0x36')]=_[_0x372b('0x37')](_0x3f6016[_0x372b('0x34')],_0x3f6016['query']);_0x1dd6ab[_0x372b('0x39')]=_[_0x372b('0x37')](_0x3f6016['model'],qs['fields'](_0x5f50c1[_0x372b('0x38')][_0x372b('0x3a')]));_0x1dd6ab[_0x372b('0x39')]=_0x1dd6ab[_0x372b('0x39')][_0x372b('0x3b')]?_0x1dd6ab[_0x372b('0x39')]:_0x3f6016['model'];_0x1dd6ab['order']=qs[_0x372b('0x3f')](_0x5f50c1[_0x372b('0x38')]['sort']);_0x1dd6ab['where']=qs['filters'](_[_0x372b('0x41')](_0x5f50c1[_0x372b('0x38')],_0x3f6016[_0x372b('0x36')]));if(_0x5f50c1[_0x372b('0x38')][_0x372b('0x42')]){_0x1dd6ab[_0x372b('0x40')]=_[_0x372b('0x43')](_0x1dd6ab[_0x372b('0x40')],{'$or':_[_0x372b('0x2f')](_0x1dd6ab['attributes'],function(_0x20fb7d){var _0x1c7021={};_0x1c7021[_0x20fb7d]={'$like':'%'+_0x5f50c1[_0x372b('0x38')]['filter']+'%'};return _0x1c7021;})});}_0x1dd6ab=_[_0x372b('0x43')]({},_0x1dd6ab,_0x5f50c1[_0x372b('0x4a')]);return _0x5c6725[_0x372b('0x55')](_0x1dd6ab);}})['then'](function(_0x32f7bc){if(_0x32f7bc){_0x7c00ca=_0x32f7bc[_0x372b('0x3b')];if(!_0x5f50c1[_0x372b('0x38')][_0x372b('0x3c')](_0x372b('0x3d'))){_0x1dd6ab[_0x372b('0x22')]=qs[_0x372b('0x22')](_0x5f50c1[_0x372b('0x38')][_0x372b('0x22')]);_0x1dd6ab['offset']=qs['offset'](_0x5f50c1[_0x372b('0x38')][_0x372b('0x20')]);}return _0x5c6725[_0x372b('0x55')](_0x1dd6ab);}})[_0x372b('0x29')](function(_0x1583ef){if(_0x1583ef){return _0x1583ef?{'count':_0x7c00ca,'rows':_0x1583ef}:null;}})[_0x372b('0x29')](respondWithResult(_0x24ab50,null))[_0x372b('0x48')](handleError(_0x24ab50,null));};exports[_0x372b('0x56')]=function(_0x47f97a,_0x1fb554,_0x32e902){if(_0x47f97a['body']['id']){delete _0x47f97a[_0x372b('0x4d')]['id'];}return db[_0x372b('0x30')][_0x372b('0x50')]({'where':{'id':_0x47f97a[_0x372b('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1fb554,null))['then'](function(_0x328135){if(_0x328135){return _0x328135[_0x372b('0x56')](_0x47f97a[_0x372b('0x4d')][_0x372b('0x57')]||[]);}return null;})['then'](respondWithResult(_0x1fb554,null))['catch'](handleError(_0x1fb554,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 259af9a..2f679f2 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 _0x25c6=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshdeskConfiguration.attributes','exports','FreshdeskConfiguration','int_freshdesk_configurations'];(function(_0x6f77b6,_0x5d55ff){var _0x342fde=function(_0x2b070d){while(--_0x2b070d){_0x6f77b6['push'](_0x6f77b6['shift']());}};_0x342fde(++_0x5d55ff);}(_0x25c6,0x16c));var _0x625c=function(_0x20ea26,_0x5512f8){_0x20ea26=_0x20ea26-0x0;var _0xcbc4d7=_0x25c6[_0x20ea26];return _0xcbc4d7;};'use strict';var _=require(_0x625c('0x0'));var util=require(_0x625c('0x1'));var logger=require(_0x625c('0x2'))(_0x625c('0x3'));var moment=require(_0x625c('0x4'));var BPromise=require(_0x625c('0x5'));var rp=require(_0x625c('0x6'));var fs=require('fs');var path=require(_0x625c('0x7'));var rimraf=require('rimraf');var config=require(_0x625c('0x8'));var attributes=require(_0x625c('0x9'));module[_0x625c('0xa')]=function(_0xf09fce,_0x3d3c99){return _0xf09fce['define'](_0x625c('0xb'),attributes,{'tableName':_0x625c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdcc5=['api','moment','bluebird','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash'];(function(_0x364850,_0x1f653a){var _0x5c4749=function(_0x5a16d0){while(--_0x5a16d0){_0x364850['push'](_0x364850['shift']());}};_0x5c4749(++_0x1f653a);}(_0xdcc5,0x1ee));var _0x5dcc=function(_0x5c0fbd,_0x469440){_0x5c0fbd=_0x5c0fbd-0x0;var _0x3d9619=_0xdcc5[_0x5c0fbd];return _0x3d9619;};'use strict';var _=require(_0x5dcc('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5dcc('0x1'));var moment=require(_0x5dcc('0x2'));var BPromise=require(_0x5dcc('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5dcc('0x4'));var rimraf=require(_0x5dcc('0x5'));var config=require(_0x5dcc('0x6'));var attributes=require(_0x5dcc('0x7'));module['exports']=function(_0x5b08d7,_0x17208b){return _0x5b08d7[_0x5dcc('0x8')](_0x5dcc('0x9'),attributes,{'tableName':_0x5dcc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 473989d..796a6d7 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 _0x5818=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x5818,0xec));var _0x8581=function(_0x3915a1,_0x1b29b2){_0x3915a1=_0x3915a1-0x0;var _0x8e0b28=_0x5818[_0x3915a1];return _0x8e0b28;};'use strict';var _=require(_0x8581('0x0'));var util=require(_0x8581('0x1'));var moment=require(_0x8581('0x2'));var BPromise=require(_0x8581('0x3'));var rs=require(_0x8581('0x4'));var fs=require('fs');var Redis=require(_0x8581('0x5'));var db=require(_0x8581('0x6'))['db'];var utils=require(_0x8581('0x7'));var logger=require(_0x8581('0x8'))('rpc');var config=require(_0x8581('0x9'));var jayson=require(_0x8581('0xa'));var client=jayson[_0x8581('0xb')][_0x8581('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x571117,_0x223c91,_0x390d50){return new BPromise(function(_0xa39676,_0xb1a715){return client[_0x8581('0xd')](_0x571117,_0x390d50)[_0x8581('0xe')](function(_0x5bebf8){logger['info'](_0x8581('0xf'),_0x223c91,'request\x20sent');logger[_0x8581('0x10')](_0x8581('0x11'),_0x223c91,_0x8581('0x12'),JSON[_0x8581('0x13')](_0x5bebf8));if(_0x5bebf8[_0x8581('0x14')]){if(_0x5bebf8['error'][_0x8581('0x15')]===0x1f4){logger[_0x8581('0x14')](_0x8581('0xf'),_0x223c91,_0x5bebf8[_0x8581('0x14')][_0x8581('0x16')]);return _0xb1a715(_0x5bebf8[_0x8581('0x14')]['message']);}logger['error'](_0x8581('0xf'),_0x223c91,_0x5bebf8[_0x8581('0x14')][_0x8581('0x16')]);return _0xa39676(_0x5bebf8['error']['message']);}else{logger[_0x8581('0x17')](_0x8581('0xf'),_0x223c91,_0x8581('0x12'));_0xa39676(_0x5bebf8[_0x8581('0x18')]['message']);}})[_0x8581('0x19')](function(_0xdc237f){logger[_0x8581('0x14')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x223c91,_0xdc237f);_0xb1a715(_0xdc237f);});});} \ No newline at end of file +var _0x6d7a=['util','moment','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','lodash'];(function(_0x3d2255,_0x450a7c){var _0x42540d=function(_0x3e1ccf){while(--_0x3e1ccf){_0x3d2255['push'](_0x3d2255['shift']());}};_0x42540d(++_0x450a7c);}(_0x6d7a,0x168));var _0xa6d7=function(_0xbff4b9,_0xf8cf41){_0xbff4b9=_0xbff4b9-0x0;var _0x40e841=_0x6d7a[_0xbff4b9];return _0x40e841;};'use strict';var _=require(_0xa6d7('0x0'));var util=require(_0xa6d7('0x1'));var moment=require(_0xa6d7('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa6d7('0x3'));var db=require(_0xa6d7('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa6d7('0x5'));var config=require('../../config/environment');var jayson=require(_0xa6d7('0x6'));var client=jayson[_0xa6d7('0x7')][_0xa6d7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1122d1,_0x1e5766,_0x3ceee1){return new BPromise(function(_0xb78bd4,_0x1b88e4){return client[_0xa6d7('0x9')](_0x1122d1,_0x3ceee1)[_0xa6d7('0xa')](function(_0x375022){logger[_0xa6d7('0xb')](_0xa6d7('0xc'),_0x1e5766,_0xa6d7('0xd'));logger[_0xa6d7('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x1e5766,_0xa6d7('0xd'),JSON[_0xa6d7('0xf')](_0x375022));if(_0x375022[_0xa6d7('0x10')]){if(_0x375022['error'][_0xa6d7('0x11')]===0x1f4){logger[_0xa6d7('0x10')](_0xa6d7('0xc'),_0x1e5766,_0x375022[_0xa6d7('0x10')][_0xa6d7('0x12')]);return _0x1b88e4(_0x375022['error'][_0xa6d7('0x12')]);}logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x1e5766,_0x375022[_0xa6d7('0x10')][_0xa6d7('0x12')]);return _0xb78bd4(_0x375022[_0xa6d7('0x10')]['message']);}else{logger[_0xa6d7('0xb')](_0xa6d7('0xc'),_0x1e5766,_0xa6d7('0xd'));_0xb78bd4(_0x375022['result'][_0xa6d7('0x12')]);}})['catch'](function(_0x59f145){logger[_0xa6d7('0x10')](_0xa6d7('0xc'),_0x1e5766,_0x59f145);_0x1b88e4(_0x59f145);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 4cdc9eb..97719bc 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 _0x6ea3=['update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./intFreshdeskField.controller','isAuthenticated','index','/:id','show','post','create'];(function(_0x5e3158,_0x184743){var _0x51112a=function(_0x730979){while(--_0x730979){_0x5e3158['push'](_0x5e3158['shift']());}};_0x51112a(++_0x184743);}(_0x6ea3,0x16c));var _0x36ea=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x6ea3[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0x36ea('0x0'));var util=require(_0x36ea('0x1'));var path=require(_0x36ea('0x2'));var timeout=require(_0x36ea('0x3'));var express=require('express');var router=express[_0x36ea('0x4')]();var fs_extra=require(_0x36ea('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x36ea('0x6'));var config=require('../../config/environment');var controller=require(_0x36ea('0x7'));router['get']('/',auth[_0x36ea('0x8')](),controller[_0x36ea('0x9')]);router['get'](_0x36ea('0xa'),auth[_0x36ea('0x8')](),controller[_0x36ea('0xb')]);router[_0x36ea('0xc')]('/',auth['isAuthenticated'](),controller[_0x36ea('0xd')]);router['put'](_0x36ea('0xa'),auth[_0x36ea('0x8')](),controller[_0x36ea('0xe')]);router[_0x36ea('0xf')](_0x36ea('0xa'),auth['isAuthenticated'](),controller[_0x36ea('0x10')]);module[_0x36ea('0x11')]=router; \ No newline at end of file +var _0x66f1=['../../components/auth/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','multer','express','Router','fs-extra'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x66f1,0xd4));var _0x166f=function(_0x2a5740,_0x559005){_0x2a5740=_0x2a5740-0x0;var _0x411239=_0x66f1[_0x2a5740];return _0x411239;};'use strict';var multer=require(_0x166f('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x166f('0x1'));var router=express[_0x166f('0x2')]();var fs_extra=require(_0x166f('0x3'));var auth=require(_0x166f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x166f('0x5'));var controller=require(_0x166f('0x6'));router[_0x166f('0x7')]('/',auth[_0x166f('0x8')](),controller[_0x166f('0x9')]);router['get'](_0x166f('0xa'),auth[_0x166f('0x8')](),controller[_0x166f('0xb')]);router[_0x166f('0xc')]('/',auth['isAuthenticated'](),controller[_0x166f('0xd')]);router[_0x166f('0xe')](_0x166f('0xa'),auth['isAuthenticated'](),controller[_0x166f('0xf')]);router[_0x166f('0x10')](_0x166f('0xa'),auth['isAuthenticated'](),controller[_0x166f('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 8903eb4..be4c4fa 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 _0x24ab=['STRING','sequelize','exports','string','variable','customVariable','picklist'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x24ab,0x71));var _0xb24a=function(_0x42045f,_0x2306b1){_0x42045f=_0x42045f-0x0;var _0x2dac2b=_0x24ab[_0x42045f];return _0x2dac2b;};'use strict';var Sequelize=require(_0xb24a('0x0'));module[_0xb24a('0x1')]={'type':{'type':Sequelize['ENUM'](_0xb24a('0x2'),_0xb24a('0x3'),_0xb24a('0x4'),'keyValue',_0xb24a('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xb24a('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xb24a('0x2'),_0xb24a('0x3'),_0xb24a('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xb24a('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb24a('0x6')]}}; \ No newline at end of file +var _0xa055=['customVariable','BOOLEAN','sequelize','exports','ENUM','string','variable','keyValue','picklist','STRING'];(function(_0x5e1ca7,_0xfbbac8){var _0x3a50cb=function(_0x1c726a){while(--_0x1c726a){_0x5e1ca7['push'](_0x5e1ca7['shift']());}};_0x3a50cb(++_0xfbbac8);}(_0xa055,0x11a));var _0x5a05=function(_0x436849,_0x430b00){_0x436849=_0x436849-0x0;var _0x5c5f73=_0xa055[_0x436849];return _0x5c5f73;};'use strict';var Sequelize=require(_0x5a05('0x0'));module[_0x5a05('0x1')]={'type':{'type':Sequelize[_0x5a05('0x2')](_0x5a05('0x3'),_0x5a05('0x4'),'customVariable',_0x5a05('0x5'),_0x5a05('0x6')),'defaultValue':_0x5a05('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x5a05('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x5a05('0x3'),_0x5a05('0x4'),_0x5a05('0x8'))},'keyContent':{'type':Sequelize[_0x5a05('0x7')]},'idField':{'type':Sequelize[_0x5a05('0x7')]},'nameField':{'type':Sequelize[_0x5a05('0x7')]},'customField':{'type':Sequelize[_0x5a05('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5a05('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 4dddfd5..67d5d14 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 _0x1bca=['index','map','fieldName','key','model','keys','filters','intersection','fields','attributes','query','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','create','FreshdeskField','body','find','rimraf','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','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','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','then','error','stack','send'];(function(_0x50a62f,_0x2bdd7f){var _0x3d410b=function(_0x43ab9c){while(--_0x43ab9c){_0x50a62f['push'](_0x50a62f['shift']());}};_0x3d410b(++_0x2bdd7f);}(_0x1bca,0xb6));var _0xa1bc=function(_0x5a1c47,_0x4a2bc0){_0x5a1c47=_0x5a1c47-0x0;var _0x36f6ab=_0x1bca[_0x5a1c47];return _0x36f6ab;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa1bc('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa1bc('0x1'));var moment=require('moment');var BPromise=require(_0xa1bc('0x2'));var Mustache=require(_0xa1bc('0x3'));var util=require(_0xa1bc('0x4'));var path=require('path');var sox=require(_0xa1bc('0x5'));var csv=require(_0xa1bc('0x6'));var ejs=require(_0xa1bc('0x7'));var fs=require('fs');var fs_extra=require(_0xa1bc('0x8'));var _=require('lodash');var squel=require(_0xa1bc('0x9'));var crypto=require(_0xa1bc('0xa'));var jsforce=require(_0xa1bc('0xb'));var deskjs=require(_0xa1bc('0xc'));var toCsv=require(_0xa1bc('0x6'));var querystring=require(_0xa1bc('0xd'));var Papa=require(_0xa1bc('0xe'));var Redis=require('ioredis');var authService=require(_0xa1bc('0xf'));var qs=require(_0xa1bc('0x10'));var as=require(_0xa1bc('0x11'));var hardwareService=require(_0xa1bc('0x12'));var logger=require(_0xa1bc('0x13'))(_0xa1bc('0x14'));var utils=require(_0xa1bc('0x15'));var config=require(_0xa1bc('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f65bc,_0x37913b){_0x37913b=_0x37913b||0xcc;return function(_0x2b38cf){if(_0x2b38cf){return _0x1f65bc[_0xa1bc('0x17')](_0x37913b);}return _0x1f65bc[_0xa1bc('0x18')](_0x37913b)[_0xa1bc('0x19')]();};}function respondWithResult(_0x165acf,_0x2c5f01){_0x2c5f01=_0x2c5f01||0xc8;return function(_0xe0d028){if(_0xe0d028){return _0x165acf[_0xa1bc('0x18')](_0x2c5f01)[_0xa1bc('0x1a')](_0xe0d028);}};}function respondWithFilteredResult(_0x5a22e0,_0x565bc2){return function(_0xdb513d){if(_0xdb513d){var _0xf8c08e=typeof _0x565bc2[_0xa1bc('0x1b')]===_0xa1bc('0x1c')&&typeof _0x565bc2[_0xa1bc('0x1d')]===_0xa1bc('0x1c');var _0x36b899=_0xdb513d[_0xa1bc('0x1e')];var _0x4765be=_0xf8c08e?0x0:_0x565bc2['offset'];var _0x510046=_0xf8c08e?_0xdb513d[_0xa1bc('0x1e')]:_0x565bc2[_0xa1bc('0x1b')]+_0x565bc2[_0xa1bc('0x1d')];var _0x2b0410;if(_0x510046>=_0x36b899){_0x510046=_0x36b899;_0x2b0410=0xc8;}else{_0x2b0410=0xce;}_0x5a22e0['status'](_0x2b0410);return _0x5a22e0['set'](_0xa1bc('0x1f'),_0x4765be+'-'+_0x510046+'/'+_0x36b899)[_0xa1bc('0x1a')](_0xdb513d);}return null;};}function patchUpdates(_0x322703){return function(_0x95a766){try{jsonpatch[_0xa1bc('0x20')](_0x95a766,_0x322703,!![]);}catch(_0x3e8cd7){return BPromise['reject'](_0x3e8cd7);}return _0x95a766[_0xa1bc('0x21')]();};}function saveUpdates(_0xc81195,_0x1e4f4e){return function(_0x4fdf7d){if(_0x4fdf7d){return _0x4fdf7d[_0xa1bc('0x22')](_0xc81195)['then'](function(_0x10636d){return _0x10636d;});}return null;};}function removeEntity(_0x44f952,_0x23d67d){return function(_0x2a77a2){if(_0x2a77a2){return _0x2a77a2[_0xa1bc('0x23')]()[_0xa1bc('0x24')](function(){_0x44f952['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3cc2e0,_0x3a87f4){return function(_0x5eff38){if(!_0x5eff38){_0x3cc2e0[_0xa1bc('0x17')](0x194);}return _0x5eff38;};}function handleError(_0x31d31c,_0x14e37b){_0x14e37b=_0x14e37b||0x1f4;return function(_0x2a0348){logger[_0xa1bc('0x25')](_0x2a0348[_0xa1bc('0x26')]);if(_0x2a0348['name']){delete _0x2a0348['name'];}_0x31d31c[_0xa1bc('0x18')](_0x14e37b)[_0xa1bc('0x27')](_0x2a0348);};}exports[_0xa1bc('0x28')]=function(_0x1270f5,_0x16a9d7){var _0x4ae5d0={},_0x228fc8={},_0x512608={'count':0x0,'rows':[]};var _0x332201=_[_0xa1bc('0x29')](db['FreshdeskField']['rawAttributes'],function(_0x4a120c){return{'name':_0x4a120c[_0xa1bc('0x2a')],'type':_0x4a120c['type'][_0xa1bc('0x2b')]};});_0x228fc8[_0xa1bc('0x2c')]=_[_0xa1bc('0x29')](_0x332201,'name');_0x228fc8['query']=_[_0xa1bc('0x2d')](_0x1270f5['query']);_0x228fc8[_0xa1bc('0x2e')]=_[_0xa1bc('0x2f')](_0x228fc8[_0xa1bc('0x2c')],_0x228fc8['query']);_0x4ae5d0['attributes']=_['intersection'](_0x228fc8[_0xa1bc('0x2c')],qs[_0xa1bc('0x30')](_0x1270f5['query'][_0xa1bc('0x30')]));_0x4ae5d0[_0xa1bc('0x31')]=_0x4ae5d0[_0xa1bc('0x31')]['length']?_0x4ae5d0[_0xa1bc('0x31')]:_0x228fc8[_0xa1bc('0x2c')];if(!_0x1270f5[_0xa1bc('0x32')]['hasOwnProperty'](_0xa1bc('0x33'))){_0x4ae5d0[_0xa1bc('0x1d')]=qs[_0xa1bc('0x1d')](_0x1270f5[_0xa1bc('0x32')][_0xa1bc('0x1d')]);_0x4ae5d0[_0xa1bc('0x1b')]=qs[_0xa1bc('0x1b')](_0x1270f5[_0xa1bc('0x32')]['offset']);}_0x4ae5d0[_0xa1bc('0x34')]=qs[_0xa1bc('0x35')](_0x1270f5[_0xa1bc('0x32')][_0xa1bc('0x35')]);_0x4ae5d0['where']=qs[_0xa1bc('0x2e')](_[_0xa1bc('0x36')](_0x1270f5['query'],_0x228fc8[_0xa1bc('0x2e')]),_0x332201);if(_0x1270f5[_0xa1bc('0x32')][_0xa1bc('0x37')]){_0x4ae5d0[_0xa1bc('0x38')]=_[_0xa1bc('0x39')](_0x4ae5d0['where'],{'$or':_[_0xa1bc('0x29')](_0x332201,function(_0x14c645){if(_0x14c645[_0xa1bc('0x3a')]!==_0xa1bc('0x3b')){var _0x3abf84={};_0x3abf84[_0x14c645['name']]={'$like':'%'+_0x1270f5[_0xa1bc('0x32')][_0xa1bc('0x37')]+'%'};return _0x3abf84;}})});}_0x4ae5d0=_[_0xa1bc('0x39')]({},_0x4ae5d0,_0x1270f5[_0xa1bc('0x3c')]);var _0xf9b275={'where':_0x4ae5d0['where']};return db['FreshdeskField']['count'](_0xf9b275)[_0xa1bc('0x24')](function(_0x57160e){_0x512608[_0xa1bc('0x1e')]=_0x57160e;if(_0x1270f5[_0xa1bc('0x32')][_0xa1bc('0x3d')]){_0x4ae5d0[_0xa1bc('0x3e')]=[{'all':!![]}];}return db['FreshdeskField'][_0xa1bc('0x3f')](_0x4ae5d0);})['then'](function(_0x482d37){_0x512608[_0xa1bc('0x40')]=_0x482d37;return _0x512608;})['then'](respondWithFilteredResult(_0x16a9d7,_0x4ae5d0))[_0xa1bc('0x41')](handleError(_0x16a9d7,null));};exports[_0xa1bc('0x42')]=function(_0x5d6c5c,_0x1d8e3c){var _0x5cd49d={'raw':!![],'where':{'id':_0x5d6c5c[_0xa1bc('0x43')]['id']}},_0x1544c8={};_0x1544c8[_0xa1bc('0x2c')]=_[_0xa1bc('0x2d')](db['FreshdeskField'][_0xa1bc('0x44')]);_0x1544c8[_0xa1bc('0x32')]=_['keys'](_0x5d6c5c[_0xa1bc('0x32')]);_0x1544c8[_0xa1bc('0x2e')]=_[_0xa1bc('0x2f')](_0x1544c8[_0xa1bc('0x2c')],_0x1544c8[_0xa1bc('0x32')]);_0x5cd49d[_0xa1bc('0x31')]=_[_0xa1bc('0x2f')](_0x1544c8[_0xa1bc('0x2c')],qs[_0xa1bc('0x30')](_0x5d6c5c[_0xa1bc('0x32')][_0xa1bc('0x30')]));_0x5cd49d[_0xa1bc('0x31')]=_0x5cd49d[_0xa1bc('0x31')][_0xa1bc('0x45')]?_0x5cd49d['attributes']:_0x1544c8[_0xa1bc('0x2c')];if(_0x5d6c5c['query'][_0xa1bc('0x3d')]){_0x5cd49d[_0xa1bc('0x3e')]=[{'all':!![]}];}_0x5cd49d=_[_0xa1bc('0x39')]({},_0x5cd49d,_0x5d6c5c[_0xa1bc('0x3c')]);return db['FreshdeskField']['find'](_0x5cd49d)['then'](handleEntityNotFound(_0x1d8e3c,null))['then'](respondWithResult(_0x1d8e3c,null))['catch'](handleError(_0x1d8e3c,null));};exports[_0xa1bc('0x46')]=function(_0x5cc542,_0x2dfad5){return db[_0xa1bc('0x47')][_0xa1bc('0x46')](_0x5cc542[_0xa1bc('0x48')],{})['then'](respondWithResult(_0x2dfad5,0xc9))[_0xa1bc('0x41')](handleError(_0x2dfad5,null));};exports[_0xa1bc('0x22')]=function(_0x3fa784,_0x3eb3d7){if(_0x3fa784[_0xa1bc('0x48')]['id']){delete _0x3fa784['body']['id'];}return db[_0xa1bc('0x47')][_0xa1bc('0x49')]({'where':{'id':_0x3fa784[_0xa1bc('0x43')]['id']}})[_0xa1bc('0x24')](handleEntityNotFound(_0x3eb3d7,null))['then'](saveUpdates(_0x3fa784['body'],null))['then'](respondWithResult(_0x3eb3d7,null))[_0xa1bc('0x41')](handleError(_0x3eb3d7,null));};exports[_0xa1bc('0x23')]=function(_0x5b3b1,_0x274684){return db[_0xa1bc('0x47')]['find']({'where':{'id':_0x5b3b1['params']['id']}})[_0xa1bc('0x24')](handleEntityNotFound(_0x274684,null))[_0xa1bc('0x24')](removeEntity(_0x274684,null))[_0xa1bc('0x41')](handleError(_0x274684,null));}; \ No newline at end of file +var _0x2547=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','FreshdeskField','includeAll','include','rows','catch','params','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','type','key','model','query','keys'];(function(_0x4d934b,_0x52f8e9){var _0xc0338b=function(_0x1a356c){while(--_0x1a356c){_0x4d934b['push'](_0x4d934b['shift']());}};_0xc0338b(++_0x52f8e9);}(_0x2547,0x1cd));var _0x7254=function(_0x24f7a4,_0x1da0d6){_0x24f7a4=_0x24f7a4-0x0;var _0x14428=_0x2547[_0x24f7a4];return _0x14428;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7254('0x0'));var zipdir=require(_0x7254('0x1'));var jsonpatch=require(_0x7254('0x2'));var rp=require(_0x7254('0x3'));var moment=require(_0x7254('0x4'));var BPromise=require(_0x7254('0x5'));var Mustache=require(_0x7254('0x6'));var util=require(_0x7254('0x7'));var path=require('path');var sox=require(_0x7254('0x8'));var csv=require(_0x7254('0x9'));var ejs=require(_0x7254('0xa'));var fs=require('fs');var fs_extra=require(_0x7254('0xb'));var _=require('lodash');var squel=require(_0x7254('0xc'));var crypto=require(_0x7254('0xd'));var jsforce=require(_0x7254('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7254('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7254('0xf'));var qs=require(_0x7254('0x10'));var as=require(_0x7254('0x11'));var hardwareService=require(_0x7254('0x12'));var logger=require(_0x7254('0x13'))(_0x7254('0x14'));var utils=require('../../config/utils');var config=require(_0x7254('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x7254('0x16'))['db'];function respondWithStatusCode(_0x53fc4f,_0x16c08e){_0x16c08e=_0x16c08e||0xcc;return function(_0x2bfff8){if(_0x2bfff8){return _0x53fc4f[_0x7254('0x17')](_0x16c08e);}return _0x53fc4f[_0x7254('0x18')](_0x16c08e)[_0x7254('0x19')]();};}function respondWithResult(_0x395a8a,_0x124192){_0x124192=_0x124192||0xc8;return function(_0x21cecc){if(_0x21cecc){return _0x395a8a[_0x7254('0x18')](_0x124192)[_0x7254('0x1a')](_0x21cecc);}};}function respondWithFilteredResult(_0x38a99c,_0x1ee5cb){return function(_0x163c8c){if(_0x163c8c){var _0x535065=typeof _0x1ee5cb[_0x7254('0x1b')]===_0x7254('0x1c')&&typeof _0x1ee5cb[_0x7254('0x1d')]===_0x7254('0x1c');var _0x3b5f06=_0x163c8c[_0x7254('0x1e')];var _0x2737e0=_0x535065?0x0:_0x1ee5cb['offset'];var _0x1f48f6=_0x535065?_0x163c8c[_0x7254('0x1e')]:_0x1ee5cb[_0x7254('0x1b')]+_0x1ee5cb[_0x7254('0x1d')];var _0x2a1ddc;if(_0x1f48f6>=_0x3b5f06){_0x1f48f6=_0x3b5f06;_0x2a1ddc=0xc8;}else{_0x2a1ddc=0xce;}_0x38a99c[_0x7254('0x18')](_0x2a1ddc);return _0x38a99c[_0x7254('0x1f')](_0x7254('0x20'),_0x2737e0+'-'+_0x1f48f6+'/'+_0x3b5f06)[_0x7254('0x1a')](_0x163c8c);}return null;};}function patchUpdates(_0x3b6cb6){return function(_0x2594b8){try{jsonpatch[_0x7254('0x21')](_0x2594b8,_0x3b6cb6,!![]);}catch(_0xc617b6){return BPromise[_0x7254('0x22')](_0xc617b6);}return _0x2594b8[_0x7254('0x23')]();};}function saveUpdates(_0x95ceaa,_0x2bb2fe){return function(_0x46c0a2){if(_0x46c0a2){return _0x46c0a2[_0x7254('0x24')](_0x95ceaa)[_0x7254('0x25')](function(_0x1be69b){return _0x1be69b;});}return null;};}function removeEntity(_0x50c34b,_0x493bfd){return function(_0x136ea3){if(_0x136ea3){return _0x136ea3[_0x7254('0x26')]()[_0x7254('0x25')](function(){_0x50c34b[_0x7254('0x18')](0xcc)[_0x7254('0x19')]();});}};}function handleEntityNotFound(_0x36b5d5,_0x133aee){return function(_0x5d6df5){if(!_0x5d6df5){_0x36b5d5[_0x7254('0x17')](0x194);}return _0x5d6df5;};}function handleError(_0x21a579,_0x2b4f46){_0x2b4f46=_0x2b4f46||0x1f4;return function(_0x494cdb){logger[_0x7254('0x27')](_0x494cdb['stack']);if(_0x494cdb[_0x7254('0x28')]){delete _0x494cdb[_0x7254('0x28')];}_0x21a579['status'](_0x2b4f46)[_0x7254('0x29')](_0x494cdb);};}exports[_0x7254('0x2a')]=function(_0x4f684c,_0x14cbea){var _0x6c4927={},_0x37cb5c={},_0xb9198b={'count':0x0,'rows':[]};var _0x43bf02=_[_0x7254('0x2b')](db['FreshdeskField'][_0x7254('0x2c')],function(_0x2dba3f){return{'name':_0x2dba3f['fieldName'],'type':_0x2dba3f[_0x7254('0x2d')][_0x7254('0x2e')]};});_0x37cb5c[_0x7254('0x2f')]=_['map'](_0x43bf02,_0x7254('0x28'));_0x37cb5c[_0x7254('0x30')]=_[_0x7254('0x31')](_0x4f684c[_0x7254('0x30')]);_0x37cb5c[_0x7254('0x32')]=_[_0x7254('0x33')](_0x37cb5c[_0x7254('0x2f')],_0x37cb5c['query']);_0x6c4927[_0x7254('0x34')]=_['intersection'](_0x37cb5c['model'],qs[_0x7254('0x35')](_0x4f684c[_0x7254('0x30')][_0x7254('0x35')]));_0x6c4927[_0x7254('0x34')]=_0x6c4927[_0x7254('0x34')][_0x7254('0x36')]?_0x6c4927[_0x7254('0x34')]:_0x37cb5c[_0x7254('0x2f')];if(!_0x4f684c[_0x7254('0x30')][_0x7254('0x37')](_0x7254('0x38'))){_0x6c4927[_0x7254('0x1d')]=qs[_0x7254('0x1d')](_0x4f684c[_0x7254('0x30')]['limit']);_0x6c4927[_0x7254('0x1b')]=qs[_0x7254('0x1b')](_0x4f684c[_0x7254('0x30')][_0x7254('0x1b')]);}_0x6c4927[_0x7254('0x39')]=qs['sort'](_0x4f684c[_0x7254('0x30')]['sort']);_0x6c4927[_0x7254('0x3a')]=qs[_0x7254('0x32')](_[_0x7254('0x3b')](_0x4f684c[_0x7254('0x30')],_0x37cb5c[_0x7254('0x32')]),_0x43bf02);if(_0x4f684c['query'][_0x7254('0x3c')]){_0x6c4927['where']=_[_0x7254('0x3d')](_0x6c4927[_0x7254('0x3a')],{'$or':_['map'](_0x43bf02,function(_0x1485a0){if(_0x1485a0[_0x7254('0x2d')]!==_0x7254('0x3e')){var _0x9273ee={};_0x9273ee[_0x1485a0[_0x7254('0x28')]]={'$like':'%'+_0x4f684c[_0x7254('0x30')]['filter']+'%'};return _0x9273ee;}})});}_0x6c4927=_[_0x7254('0x3d')]({},_0x6c4927,_0x4f684c[_0x7254('0x3f')]);var _0x105b8c={'where':_0x6c4927['where']};return db[_0x7254('0x40')][_0x7254('0x1e')](_0x105b8c)[_0x7254('0x25')](function(_0x4824d5){_0xb9198b[_0x7254('0x1e')]=_0x4824d5;if(_0x4f684c[_0x7254('0x30')][_0x7254('0x41')]){_0x6c4927[_0x7254('0x42')]=[{'all':!![]}];}return db[_0x7254('0x40')]['findAll'](_0x6c4927);})['then'](function(_0x25004f){_0xb9198b[_0x7254('0x43')]=_0x25004f;return _0xb9198b;})[_0x7254('0x25')](respondWithFilteredResult(_0x14cbea,_0x6c4927))[_0x7254('0x44')](handleError(_0x14cbea,null));};exports['show']=function(_0x53a7a7,_0x29821a){var _0x565cd8={'raw':!![],'where':{'id':_0x53a7a7[_0x7254('0x45')]['id']}},_0x2ae22e={};_0x2ae22e[_0x7254('0x2f')]=_[_0x7254('0x31')](db['FreshdeskField']['rawAttributes']);_0x2ae22e[_0x7254('0x30')]=_[_0x7254('0x31')](_0x53a7a7[_0x7254('0x30')]);_0x2ae22e[_0x7254('0x32')]=_[_0x7254('0x33')](_0x2ae22e['model'],_0x2ae22e['query']);_0x565cd8[_0x7254('0x34')]=_[_0x7254('0x33')](_0x2ae22e[_0x7254('0x2f')],qs['fields'](_0x53a7a7[_0x7254('0x30')][_0x7254('0x35')]));_0x565cd8['attributes']=_0x565cd8[_0x7254('0x34')][_0x7254('0x36')]?_0x565cd8[_0x7254('0x34')]:_0x2ae22e[_0x7254('0x2f')];if(_0x53a7a7['query'][_0x7254('0x41')]){_0x565cd8[_0x7254('0x42')]=[{'all':!![]}];}_0x565cd8=_['merge']({},_0x565cd8,_0x53a7a7[_0x7254('0x3f')]);return db[_0x7254('0x40')][_0x7254('0x46')](_0x565cd8)['then'](handleEntityNotFound(_0x29821a,null))[_0x7254('0x25')](respondWithResult(_0x29821a,null))[_0x7254('0x44')](handleError(_0x29821a,null));};exports['create']=function(_0x5f101e,_0x10b32f){return db['FreshdeskField'][_0x7254('0x47')](_0x5f101e[_0x7254('0x48')],{})['then'](respondWithResult(_0x10b32f,0xc9))['catch'](handleError(_0x10b32f,null));};exports[_0x7254('0x24')]=function(_0xc40bc5,_0x38bcd5){if(_0xc40bc5[_0x7254('0x48')]['id']){delete _0xc40bc5[_0x7254('0x48')]['id'];}return db[_0x7254('0x40')]['find']({'where':{'id':_0xc40bc5[_0x7254('0x45')]['id']}})['then'](handleEntityNotFound(_0x38bcd5,null))[_0x7254('0x25')](saveUpdates(_0xc40bc5[_0x7254('0x48')],null))[_0x7254('0x25')](respondWithResult(_0x38bcd5,null))['catch'](handleError(_0x38bcd5,null));};exports[_0x7254('0x26')]=function(_0x1c1a0e,_0x252758){return db['FreshdeskField'][_0x7254('0x46')]({'where':{'id':_0x1c1a0e[_0x7254('0x45')]['id']}})[_0x7254('0x25')](handleEntityNotFound(_0x252758,null))[_0x7254('0x25')](removeEntity(_0x252758,null))[_0x7254('0x44')](handleError(_0x252758,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index bbb4e37..11c94a0 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 _0x6010=['../../config/environment','./intFreshdeskField.attributes','exports','FreshdeskField','int_freshdesk_fields','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x81e39d,_0x4c3934){var _0x548fbb=function(_0x1adda5){while(--_0x1adda5){_0x81e39d['push'](_0x81e39d['shift']());}};_0x548fbb(++_0x4c3934);}(_0x6010,0xca));var _0x0601=function(_0x33f3c4,_0x49efc4){_0x33f3c4=_0x33f3c4-0x0;var _0x1bb045=_0x6010[_0x33f3c4];return _0x1bb045;};'use strict';var _=require(_0x0601('0x0'));var util=require('util');var logger=require(_0x0601('0x1'))(_0x0601('0x2'));var moment=require(_0x0601('0x3'));var BPromise=require(_0x0601('0x4'));var rp=require(_0x0601('0x5'));var fs=require('fs');var path=require(_0x0601('0x6'));var rimraf=require(_0x0601('0x7'));var config=require(_0x0601('0x8'));var attributes=require(_0x0601('0x9'));module[_0x0601('0xa')]=function(_0xfab370,_0x53550e){return _0xfab370['define'](_0x0601('0xb'),attributes,{'tableName':_0x0601('0xc'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0x0601('0xd'),_0x0601('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6343=['rimraf','./intFreshdeskField.attributes','exports','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','util','../../config/logger','api','request-promise','path'];(function(_0x44e350,_0x33d74f){var _0x52ccdb=function(_0x5d6138){while(--_0x5d6138){_0x44e350['push'](_0x44e350['shift']());}};_0x52ccdb(++_0x33d74f);}(_0x6343,0x1e9));var _0x3634=function(_0x5185c3,_0x36df34){_0x5185c3=_0x5185c3-0x0;var _0xe38fa5=_0x6343[_0x5185c3];return _0xe38fa5;};'use strict';var _=require('lodash');var util=require(_0x3634('0x0'));var logger=require(_0x3634('0x1'))(_0x3634('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3634('0x3'));var fs=require('fs');var path=require(_0x3634('0x4'));var rimraf=require(_0x3634('0x5'));var config=require('../../config/environment');var attributes=require(_0x3634('0x6'));module[_0x3634('0x7')]=function(_0x5db25c,_0x4c5f9a){return _0x5db25c['define'](_0x3634('0x8'),attributes,{'tableName':_0x3634('0x9'),'paranoid':![],'indexes':[{'name':_0x3634('0xa'),'fields':[_0x3634('0xb'),_0x3634('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 4f68ef9..651c2e7 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 _0x9bd7=['jayson/promise','http','request','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x5860d9,_0x4741a2){var _0x2cf514=function(_0x422427){while(--_0x422427){_0x5860d9['push'](_0x5860d9['shift']());}};_0x2cf514(++_0x4741a2);}(_0x9bd7,0x1f1));var _0x79bd=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9bd7[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x79bd('0x0'));var util=require('util');var moment=require(_0x79bd('0x1'));var BPromise=require(_0x79bd('0x2'));var rs=require(_0x79bd('0x3'));var fs=require('fs');var Redis=require(_0x79bd('0x4'));var db=require(_0x79bd('0x5'))['db'];var utils=require(_0x79bd('0x6'));var logger=require(_0x79bd('0x7'))(_0x79bd('0x8'));var config=require('../../config/environment');var jayson=require(_0x79bd('0x9'));var client=jayson['client'][_0x79bd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x320649,_0x538a56,_0x4c8387){return new BPromise(function(_0x265ea0,_0x9d1b74){return client[_0x79bd('0xb')](_0x320649,_0x4c8387)['then'](function(_0x22071a){logger[_0x79bd('0xc')](_0x79bd('0xd'),_0x538a56,_0x79bd('0xe'));logger[_0x79bd('0xf')](_0x79bd('0x10'),_0x538a56,_0x79bd('0xe'),JSON['stringify'](_0x22071a));if(_0x22071a[_0x79bd('0x11')]){if(_0x22071a['error'][_0x79bd('0x12')]===0x1f4){logger[_0x79bd('0x11')](_0x79bd('0xd'),_0x538a56,_0x22071a[_0x79bd('0x11')]['message']);return _0x9d1b74(_0x22071a[_0x79bd('0x11')][_0x79bd('0x13')]);}logger[_0x79bd('0x11')](_0x79bd('0xd'),_0x538a56,_0x22071a['error'][_0x79bd('0x13')]);return _0x265ea0(_0x22071a[_0x79bd('0x11')]['message']);}else{logger[_0x79bd('0xc')]('FreshdeskField,\x20%s,\x20%s',_0x538a56,_0x79bd('0xe'));_0x265ea0(_0x22071a[_0x79bd('0x14')]['message']);}})[_0x79bd('0x15')](function(_0x1cf6b1){logger['error'](_0x79bd('0xd'),_0x538a56,_0x1cf6b1);_0x9d1b74(_0x1cf6b1);});});} \ No newline at end of file +var _0xfb1a=['../../config/environment','jayson/promise','client','http','then','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfb1a,0xcf));var _0xafb1=function(_0x5e16d7,_0x4095cd){_0x5e16d7=_0x5e16d7-0x0;var _0x3de160=_0xfb1a[_0x5e16d7];return _0x3de160;};'use strict';var _=require(_0xafb1('0x0'));var util=require(_0xafb1('0x1'));var moment=require(_0xafb1('0x2'));var BPromise=require(_0xafb1('0x3'));var rs=require(_0xafb1('0x4'));var fs=require('fs');var Redis=require(_0xafb1('0x5'));var db=require(_0xafb1('0x6'))['db'];var utils=require(_0xafb1('0x7'));var logger=require(_0xafb1('0x8'))('rpc');var config=require(_0xafb1('0x9'));var jayson=require(_0xafb1('0xa'));var client=jayson[_0xafb1('0xb')][_0xafb1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5e6064,_0x45a137,_0xc7d925){return new BPromise(function(_0x1e0a6b,_0x3b90c9){return client['request'](_0x5e6064,_0xc7d925)[_0xafb1('0xd')](function(_0x1b4af6){logger['info'](_0xafb1('0xe'),_0x45a137,_0xafb1('0xf'));logger[_0xafb1('0x10')](_0xafb1('0x11'),_0x45a137,_0xafb1('0xf'),JSON[_0xafb1('0x12')](_0x1b4af6));if(_0x1b4af6[_0xafb1('0x13')]){if(_0x1b4af6[_0xafb1('0x13')][_0xafb1('0x14')]===0x1f4){logger[_0xafb1('0x13')](_0xafb1('0xe'),_0x45a137,_0x1b4af6[_0xafb1('0x13')][_0xafb1('0x15')]);return _0x3b90c9(_0x1b4af6[_0xafb1('0x13')]['message']);}logger[_0xafb1('0x13')](_0xafb1('0xe'),_0x45a137,_0x1b4af6[_0xafb1('0x13')][_0xafb1('0x15')]);return _0x1e0a6b(_0x1b4af6[_0xafb1('0x13')][_0xafb1('0x15')]);}else{logger[_0xafb1('0x16')](_0xafb1('0xe'),_0x45a137,'request\x20sent');_0x1e0a6b(_0x1b4af6['result'][_0xafb1('0x15')]);}})[_0xafb1('0x17')](function(_0x40e7b3){logger[_0xafb1('0x13')](_0xafb1('0xe'),_0x45a137,_0x40e7b3);_0x3b90c9(_0x40e7b3);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index dfdbd1c..46b9069 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 _0xcf66=['util','path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','post','create','put','update','delete','destroy','multer'];(function(_0x19fec8,_0xa8762e){var _0x1435e0=function(_0x4d4210){while(--_0x4d4210){_0x19fec8['push'](_0x19fec8['shift']());}};_0x1435e0(++_0xa8762e);}(_0xcf66,0x71));var _0x6cf6=function(_0x4de9ef,_0x14eb5b){_0x4de9ef=_0x4de9ef-0x0;var _0x4e2e58=_0xcf66[_0x4de9ef];return _0x4e2e58;};'use strict';var multer=require(_0x6cf6('0x0'));var util=require(_0x6cf6('0x1'));var path=require(_0x6cf6('0x2'));var timeout=require('connect-timeout');var express=require(_0x6cf6('0x3'));var router=express[_0x6cf6('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6cf6('0x5'));var config=require(_0x6cf6('0x6'));var controller=require('./intFreshsalesAccount.controller');router[_0x6cf6('0x7')]('/',auth[_0x6cf6('0x8')](),controller[_0x6cf6('0x9')]);router['get'](_0x6cf6('0xa'),auth[_0x6cf6('0x8')](),controller[_0x6cf6('0xb')]);router[_0x6cf6('0x7')](_0x6cf6('0xc'),auth[_0x6cf6('0x8')](),controller['getConfigurations']);router['get']('/:id/fields',auth[_0x6cf6('0x8')](),controller['getFields']);router[_0x6cf6('0xd')]('/',auth[_0x6cf6('0x8')](),controller[_0x6cf6('0xe')]);router[_0x6cf6('0xd')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router[_0x6cf6('0xf')](_0x6cf6('0xa'),auth[_0x6cf6('0x8')](),controller[_0x6cf6('0x10')]);router[_0x6cf6('0x11')](_0x6cf6('0xa'),auth['isAuthenticated'](),controller[_0x6cf6('0x12')]);module['exports']=router; \ No newline at end of file +var _0xbc9d=['express','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','show','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','/:id','destroy','multer','util','path','connect-timeout'];(function(_0x3b32b4,_0x129cfd){var _0xd575ea=function(_0x91290d){while(--_0x91290d){_0x3b32b4['push'](_0x3b32b4['shift']());}};_0xd575ea(++_0x129cfd);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x1d070d,_0x44b1dc){_0x1d070d=_0x1d070d-0x0;var _0x150d9f=_0xbc9d[_0x1d070d];return _0x150d9f;};'use strict';var multer=require(_0xdbc9('0x0'));var util=require(_0xdbc9('0x1'));var path=require(_0xdbc9('0x2'));var timeout=require(_0xdbc9('0x3'));var express=require(_0xdbc9('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xdbc9('0x5'));var config=require(_0xdbc9('0x6'));var controller=require(_0xdbc9('0x7'));router[_0xdbc9('0x8')]('/',auth[_0xdbc9('0x9')](),controller[_0xdbc9('0xa')]);router[_0xdbc9('0x8')]('/:id',auth[_0xdbc9('0x9')](),controller[_0xdbc9('0xb')]);router[_0xdbc9('0x8')]('/:id/configurations',auth[_0xdbc9('0x9')](),controller['getConfigurations']);router['get'](_0xdbc9('0xc'),auth[_0xdbc9('0x9')](),controller[_0xdbc9('0xd')]);router[_0xdbc9('0xe')]('/',auth['isAuthenticated'](),controller[_0xdbc9('0xf')]);router[_0xdbc9('0xe')](_0xdbc9('0x10'),auth[_0xdbc9('0x9')](),controller[_0xdbc9('0x11')]);router[_0xdbc9('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xdbc9('0x13')]);router[_0xdbc9('0x14')](_0xdbc9('0x15'),auth[_0xdbc9('0x9')](),controller[_0xdbc9('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 3510350..251921a 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 _0x32f4=['sequelize','exports','STRING','username','remoteUri'];(function(_0x4e7d4a,_0x35cdc8){var _0x235800=function(_0x59ff40){while(--_0x59ff40){_0x4e7d4a['push'](_0x4e7d4a['shift']());}};_0x235800(++_0x35cdc8);}(_0x32f4,0x154));var _0x432f=function(_0x26a596,_0xff207e){_0x26a596=_0x26a596-0x0;var _0x5ba058=_0x32f4[_0x26a596];return _0x5ba058;};'use strict';var Sequelize=require(_0x432f('0x0'));module[_0x432f('0x1')]={'name':{'type':Sequelize[_0x432f('0x2')]},'description':{'type':Sequelize[_0x432f('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x432f('0x3')},'apiKey':{'type':Sequelize[_0x432f('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x432f('0x4')},'serverUrl':{'type':Sequelize[_0x432f('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x6d38=['exports','STRING','remoteUri'];(function(_0x406696,_0x39f9b1){var _0x10e35c=function(_0x108de3){while(--_0x108de3){_0x406696['push'](_0x406696['shift']());}};_0x10e35c(++_0x39f9b1);}(_0x6d38,0x1ef));var _0x86d3=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x6d38[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');module[_0x86d3('0x0')]={'name':{'type':Sequelize[_0x86d3('0x1')]},'description':{'type':Sequelize[_0x86d3('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'apiKey':{'type':Sequelize[_0x86d3('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x86d3('0x2')},'serverUrl':{'type':Sequelize[_0x86d3('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index ca17b54..7e958aa 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 _0x0a5d=['util','path','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','type','VIRTUAL','merge','options','includeAll','findAll','catch','params','include','find','create','body','getConfigurations','findOne','pick','AccountId','Subjects','Descriptions','getDescriptions','channel','FreshsalesConfiguration','FreshsalesField','getFields','lastIndexOf','GET','format','Token\x20token=','apiKey','users','email','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','bluebird'];(function(_0x4ed17b,_0x2b1745){var _0x24b248=function(_0x136ab1){while(--_0x136ab1){_0x4ed17b['push'](_0x4ed17b['shift']());}};_0x24b248(++_0x2b1745);}(_0x0a5d,0x1c7));var _0xd0a5=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0x0a5d[_0x2261ce];return _0x524640;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd0a5('0x0'));var zipdir=require(_0xd0a5('0x1'));var jsonpatch=require(_0xd0a5('0x2'));var rp=require(_0xd0a5('0x3'));var moment=require('moment');var BPromise=require(_0xd0a5('0x4'));var Mustache=require('mustache');var util=require(_0xd0a5('0x5'));var path=require(_0xd0a5('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd0a5('0x7'));var squel=require(_0xd0a5('0x8'));var crypto=require(_0xd0a5('0x9'));var jsforce=require(_0xd0a5('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xd0a5('0xb'));var querystring=require(_0xd0a5('0xc'));var Papa=require(_0xd0a5('0xd'));var Redis=require(_0xd0a5('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd0a5('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd0a5('0x10'));var logger=require(_0xd0a5('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xd0a5('0x12'));var licenseUtil=require(_0xd0a5('0x13'));var db=require(_0xd0a5('0x14'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x32dbf6,_0xe9289a){_0xe9289a=_0xe9289a||0xcc;return function(_0x4c4553){if(_0x4c4553){return _0x32dbf6['sendStatus'](_0xe9289a);}return _0x32dbf6['status'](_0xe9289a)[_0xd0a5('0x15')]();};}function respondWithResult(_0x4c13b0,_0x5c182b){_0x5c182b=_0x5c182b||0xc8;return function(_0x567150){if(_0x567150){return _0x4c13b0[_0xd0a5('0x16')](_0x5c182b)[_0xd0a5('0x17')](_0x567150);}};}function respondWithFilteredResult(_0x150572,_0x547a86){return function(_0x4967b3){if(_0x4967b3){var _0x30f568=typeof _0x547a86[_0xd0a5('0x18')]==='undefined'&&typeof _0x547a86['limit']===_0xd0a5('0x19');var _0x3ac0f2=_0x4967b3[_0xd0a5('0x1a')];var _0x25fea3=_0x30f568?0x0:_0x547a86['offset'];var _0x47712f=_0x30f568?_0x4967b3[_0xd0a5('0x1a')]:_0x547a86[_0xd0a5('0x18')]+_0x547a86['limit'];var _0x2aa4a3;if(_0x47712f>=_0x3ac0f2){_0x47712f=_0x3ac0f2;_0x2aa4a3=0xc8;}else{_0x2aa4a3=0xce;}_0x150572[_0xd0a5('0x16')](_0x2aa4a3);return _0x150572[_0xd0a5('0x1b')](_0xd0a5('0x1c'),_0x25fea3+'-'+_0x47712f+'/'+_0x3ac0f2)[_0xd0a5('0x17')](_0x4967b3);}return null;};}function patchUpdates(_0x46724c){return function(_0x1d69fe){try{jsonpatch['apply'](_0x1d69fe,_0x46724c,!![]);}catch(_0x4d6a14){return BPromise[_0xd0a5('0x1d')](_0x4d6a14);}return _0x1d69fe['save']();};}function saveUpdates(_0x1603cd,_0x1031e7){return function(_0x44aa1a){if(_0x44aa1a){return _0x44aa1a[_0xd0a5('0x1e')](_0x1603cd)[_0xd0a5('0x1f')](function(_0x3d8590){return _0x3d8590;});}return null;};}function removeEntity(_0x5df0da,_0x747c6e){return function(_0x3d3161){if(_0x3d3161){return _0x3d3161[_0xd0a5('0x20')]()['then'](function(){_0x5df0da['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x504932,_0x1dbcca){return function(_0x5280c1){if(!_0x5280c1){_0x504932['sendStatus'](0x194);}return _0x5280c1;};}function handleError(_0x2df87a,_0x114392){_0x114392=_0x114392||0x1f4;return function(_0x263abb){logger[_0xd0a5('0x21')](_0x263abb[_0xd0a5('0x22')]);if(_0x263abb[_0xd0a5('0x23')]){delete _0x263abb[_0xd0a5('0x23')];}_0x2df87a[_0xd0a5('0x16')](_0x114392)[_0xd0a5('0x24')](_0x263abb);};}exports[_0xd0a5('0x25')]=function(_0x1a2675,_0x3611a4){var _0x345e95={},_0x494654={},_0x13bd16={'count':0x0,'rows':[]};var _0x3ace7d=_[_0xd0a5('0x26')](db[_0xd0a5('0x27')][_0xd0a5('0x28')],function(_0x2f90a3){return{'name':_0x2f90a3[_0xd0a5('0x29')],'type':_0x2f90a3['type'][_0xd0a5('0x2a')]};});_0x494654[_0xd0a5('0x2b')]=_[_0xd0a5('0x26')](_0x3ace7d,_0xd0a5('0x23'));_0x494654['query']=_[_0xd0a5('0x2c')](_0x1a2675[_0xd0a5('0x2d')]);_0x494654['filters']=_[_0xd0a5('0x2e')](_0x494654[_0xd0a5('0x2b')],_0x494654[_0xd0a5('0x2d')]);_0x345e95[_0xd0a5('0x2f')]=_['intersection'](_0x494654[_0xd0a5('0x2b')],qs[_0xd0a5('0x30')](_0x1a2675[_0xd0a5('0x2d')][_0xd0a5('0x30')]));_0x345e95[_0xd0a5('0x2f')]=_0x345e95[_0xd0a5('0x2f')][_0xd0a5('0x31')]?_0x345e95[_0xd0a5('0x2f')]:_0x494654[_0xd0a5('0x2b')];if(!_0x1a2675[_0xd0a5('0x2d')][_0xd0a5('0x32')](_0xd0a5('0x33'))){_0x345e95[_0xd0a5('0x34')]=qs[_0xd0a5('0x34')](_0x1a2675[_0xd0a5('0x2d')][_0xd0a5('0x34')]);_0x345e95[_0xd0a5('0x18')]=qs['offset'](_0x1a2675[_0xd0a5('0x2d')]['offset']);}_0x345e95[_0xd0a5('0x35')]=qs[_0xd0a5('0x36')](_0x1a2675[_0xd0a5('0x2d')][_0xd0a5('0x36')]);_0x345e95[_0xd0a5('0x37')]=qs[_0xd0a5('0x38')](_['pick'](_0x1a2675[_0xd0a5('0x2d')],_0x494654[_0xd0a5('0x38')]),_0x3ace7d);if(_0x1a2675['query'][_0xd0a5('0x39')]){_0x345e95[_0xd0a5('0x37')]=_['merge'](_0x345e95[_0xd0a5('0x37')],{'$or':_[_0xd0a5('0x26')](_0x3ace7d,function(_0x35d7a4){if(_0x35d7a4[_0xd0a5('0x3a')]!==_0xd0a5('0x3b')){var _0x182389={};_0x182389[_0x35d7a4['name']]={'$like':'%'+_0x1a2675[_0xd0a5('0x2d')]['filter']+'%'};return _0x182389;}})});}_0x345e95=_[_0xd0a5('0x3c')]({},_0x345e95,_0x1a2675[_0xd0a5('0x3d')]);var _0x430ed9={'where':_0x345e95[_0xd0a5('0x37')]};return db[_0xd0a5('0x27')][_0xd0a5('0x1a')](_0x430ed9)[_0xd0a5('0x1f')](function(_0x35daed){_0x13bd16[_0xd0a5('0x1a')]=_0x35daed;if(_0x1a2675[_0xd0a5('0x2d')][_0xd0a5('0x3e')]){_0x345e95['include']=[{'all':!![]}];}return db['FreshsalesAccount'][_0xd0a5('0x3f')](_0x345e95);})[_0xd0a5('0x1f')](function(_0x3bcb94){_0x13bd16['rows']=_0x3bcb94;return _0x13bd16;})[_0xd0a5('0x1f')](respondWithFilteredResult(_0x3611a4,_0x345e95))[_0xd0a5('0x40')](handleError(_0x3611a4,null));};exports['show']=function(_0xfc34ec,_0x4b569b){var _0x2990e2={'raw':![],'where':{'id':_0xfc34ec[_0xd0a5('0x41')]['id']}},_0x46e2d6={};_0x46e2d6[_0xd0a5('0x2b')]=_[_0xd0a5('0x2c')](db['FreshsalesAccount'][_0xd0a5('0x28')]);_0x46e2d6[_0xd0a5('0x2d')]=_[_0xd0a5('0x2c')](_0xfc34ec['query']);_0x46e2d6['filters']=_[_0xd0a5('0x2e')](_0x46e2d6[_0xd0a5('0x2b')],_0x46e2d6[_0xd0a5('0x2d')]);_0x2990e2[_0xd0a5('0x2f')]=_[_0xd0a5('0x2e')](_0x46e2d6[_0xd0a5('0x2b')],qs[_0xd0a5('0x30')](_0xfc34ec[_0xd0a5('0x2d')][_0xd0a5('0x30')]));_0x2990e2[_0xd0a5('0x2f')]=_0x2990e2[_0xd0a5('0x2f')][_0xd0a5('0x31')]?_0x2990e2['attributes']:_0x46e2d6[_0xd0a5('0x2b')];if(_0xfc34ec[_0xd0a5('0x2d')][_0xd0a5('0x3e')]){_0x2990e2[_0xd0a5('0x42')]=[{'all':!![]}];}_0x2990e2=_[_0xd0a5('0x3c')]({},_0x2990e2,_0xfc34ec['options']);return db[_0xd0a5('0x27')][_0xd0a5('0x43')](_0x2990e2)[_0xd0a5('0x1f')](handleEntityNotFound(_0x4b569b,null))[_0xd0a5('0x1f')](respondWithResult(_0x4b569b,null))[_0xd0a5('0x40')](handleError(_0x4b569b,null));};exports[_0xd0a5('0x44')]=function(_0x2a5a31,_0x361857){return db[_0xd0a5('0x27')][_0xd0a5('0x44')](_0x2a5a31['body'],{})['then'](respondWithResult(_0x361857,0xc9))[_0xd0a5('0x40')](handleError(_0x361857,null));};exports[_0xd0a5('0x1e')]=function(_0x244318,_0x535d7d){if(_0x244318['body']['id']){delete _0x244318[_0xd0a5('0x45')]['id'];}return db[_0xd0a5('0x27')]['find']({'where':{'id':_0x244318[_0xd0a5('0x41')]['id']}})[_0xd0a5('0x1f')](handleEntityNotFound(_0x535d7d,null))[_0xd0a5('0x1f')](saveUpdates(_0x244318[_0xd0a5('0x45')],null))[_0xd0a5('0x1f')](respondWithResult(_0x535d7d,null))[_0xd0a5('0x40')](handleError(_0x535d7d,null));};exports[_0xd0a5('0x20')]=function(_0x4ad10b,_0x1fc8b1){return db[_0xd0a5('0x27')][_0xd0a5('0x43')]({'where':{'id':_0x4ad10b[_0xd0a5('0x41')]['id']}})[_0xd0a5('0x1f')](handleEntityNotFound(_0x1fc8b1,null))['then'](removeEntity(_0x1fc8b1,null))['catch'](handleError(_0x1fc8b1,null));};exports[_0xd0a5('0x46')]=function(_0x568544,_0x5f5e83,_0x2407df){var _0x25444c={};var _0x591908={};var _0x3f2f1c;var _0x4240f4;return db[_0xd0a5('0x27')][_0xd0a5('0x47')]({'where':{'id':_0x568544[_0xd0a5('0x41')]['id']}})[_0xd0a5('0x1f')](handleEntityNotFound(_0x5f5e83,null))[_0xd0a5('0x1f')](function(_0x275c78){if(_0x275c78){_0x3f2f1c=_0x275c78;_0x591908[_0xd0a5('0x2b')]=_['keys'](db['FreshsalesConfiguration']['rawAttributes']);_0x591908[_0xd0a5('0x2d')]=_[_0xd0a5('0x2c')](_0x568544[_0xd0a5('0x2d')]);_0x591908[_0xd0a5('0x38')]=_[_0xd0a5('0x2e')](_0x591908[_0xd0a5('0x2b')],_0x591908[_0xd0a5('0x2d')]);_0x25444c['attributes']=_[_0xd0a5('0x2e')](_0x591908[_0xd0a5('0x2b')],qs[_0xd0a5('0x30')](_0x568544['query'][_0xd0a5('0x30')]));_0x25444c[_0xd0a5('0x2f')]=_0x25444c['attributes'][_0xd0a5('0x31')]?_0x25444c['attributes']:_0x591908[_0xd0a5('0x2b')];_0x25444c[_0xd0a5('0x35')]=qs['sort'](_0x568544['query'][_0xd0a5('0x36')]);_0x25444c['where']=qs[_0xd0a5('0x38')](_[_0xd0a5('0x48')](_0x568544[_0xd0a5('0x2d')],_0x591908[_0xd0a5('0x38')]));if(_0x568544['query']['filter']){_0x25444c[_0xd0a5('0x37')]=_[_0xd0a5('0x3c')](_0x25444c[_0xd0a5('0x37')],{'$or':_[_0xd0a5('0x26')](_0x25444c[_0xd0a5('0x2f')],function(_0x19603c){var _0x609f51={};_0x609f51[_0x19603c]={'$like':'%'+_0x568544[_0xd0a5('0x2d')]['filter']+'%'};return _0x609f51;})});}_0x25444c=_['merge']({},_0x25444c,_0x568544[_0xd0a5('0x3d')]);return _0x3f2f1c[_0xd0a5('0x46')](_0x25444c);}})[_0xd0a5('0x1f')](function(_0x4bc58d){if(_0x4bc58d){_0x4240f4=_0x4bc58d[_0xd0a5('0x31')];if(!_0x568544[_0xd0a5('0x2d')][_0xd0a5('0x32')]('nolimit')){_0x25444c['limit']=qs[_0xd0a5('0x34')](_0x568544[_0xd0a5('0x2d')][_0xd0a5('0x34')]);_0x25444c['offset']=qs[_0xd0a5('0x18')](_0x568544[_0xd0a5('0x2d')]['offset']);}return _0x3f2f1c['getConfigurations'](_0x25444c);}})[_0xd0a5('0x1f')](function(_0x2809b1){if(_0x2809b1){return _0x2809b1?{'count':_0x4240f4,'rows':_0x2809b1}:null;}})[_0xd0a5('0x1f')](respondWithResult(_0x5f5e83,null))[_0xd0a5('0x40')](handleError(_0x5f5e83,null));};exports['addConfiguration']=function(_0x5dcabe,_0x331b05,_0x5e30a6){if(_0x5dcabe['body']['id']){delete _0x5dcabe[_0xd0a5('0x45')]['id'];}return db[_0xd0a5('0x27')][_0xd0a5('0x47')]({'where':{'id':_0x5dcabe[_0xd0a5('0x41')]['id']}})['then'](handleEntityNotFound(_0x331b05,null))[_0xd0a5('0x1f')](function(_0x57f905){if(_0x57f905){_0x5dcabe[_0xd0a5('0x45')][_0xd0a5('0x49')]=_0x57f905['id'];_0x5dcabe['body'][_0xd0a5('0x4a')]=integrations['getSubjects'](_0x5dcabe[_0xd0a5('0x45')]['channel'],_0x5dcabe[_0xd0a5('0x45')]['type']);_0x5dcabe['body'][_0xd0a5('0x4b')]=integrations[_0xd0a5('0x4c')](_0x5dcabe[_0xd0a5('0x45')][_0xd0a5('0x4d')],_0x5dcabe[_0xd0a5('0x45')][_0xd0a5('0x3a')]);return db[_0xd0a5('0x4e')]['create'](_0x5dcabe['body'],{'include':[{'model':db[_0xd0a5('0x4f')],'as':_0xd0a5('0x4a')},{'model':db[_0xd0a5('0x4f')],'as':'Descriptions'}]});}return null;})[_0xd0a5('0x1f')](respondWithResult(_0x331b05,null))[_0xd0a5('0x40')](handleError(_0x331b05,null));};exports[_0xd0a5('0x50')]=function(_0x20d777,_0x44c146,_0x2280a5){var _0x329d69='';var _0x33450f='';return db[_0xd0a5('0x27')]['findOne']({'where':{'id':_0x20d777[_0xd0a5('0x41')]['id']},'attributes':['id','username','remoteUri','apiKey']})['then'](handleEntityNotFound(_0x44c146,null))['then'](function(_0x393617){if(_0x393617){_0x33450f=_0x393617['username'];_0x329d69=_0x393617['remoteUri'];var _0x45d755=_0x393617['remoteUri']['slice'](-0x1);if(_0x45d755==='/'){_0x329d69=_0x329d69['substring'](0x0,_0x329d69[_0xd0a5('0x51')](_0x45d755));}return rp({'method':_0xd0a5('0x52'),'uri':util[_0xd0a5('0x53')]('%s%s',_0x329d69,'/api/selector/owners'),'headers':{'Authorization':_0xd0a5('0x54')+_0x393617[_0xd0a5('0x55')]},'json':!![]});}})['then'](function(_0x79a525){if(_0x79a525){var _0x5ed930=_0x79a525[_0xd0a5('0x56')];var _0x2fbee3=![];var _0x47fa6c=null;for(_0x47fa6c=0x0;_0x47fa6c<_0x5ed930[_0xd0a5('0x31')];_0x47fa6c++){if(_0x5ed930[_0x47fa6c][_0xd0a5('0x57')]===_0x33450f){_0x2fbee3=!![];}}if(_0x2fbee3){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})['then'](respondWithResult(_0x44c146,null))[_0xd0a5('0x40')](function(_0xba7b9f){var _0x119166=_0x20d777[_0xd0a5('0x2d')][_0xd0a5('0x58')]?0x1f4:_0xba7b9f['statusCode']||0x1f4;logger[_0xd0a5('0x21')](_0xd0a5('0x59'),_0xd0a5('0x50'),_0x119166,JSON[_0xd0a5('0x5a')](_0xba7b9f));delete _0xba7b9f[_0xd0a5('0x23')];if(_0x119166===0x191){_0x119166=0x190;}_0x44c146[_0xd0a5('0x16')](_0x119166)[_0xd0a5('0x24')](_0x20d777[_0xd0a5('0x2d')][_0xd0a5('0x58')]?{'message':_0xd0a5('0x5b'),'statusCode':_0xba7b9f['statusCode']}:_0xba7b9f);});}; \ No newline at end of file +var _0x69ef=['length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','find','create','body','catch','params','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration','AccountId','Subjects','channel','Descriptions','FreshsalesField','getFields','username','remoteUri','apiKey','slice','lastIndexOf','format','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x3d3fd7,_0x20a0c1){var _0x22b873=function(_0xf85fda){while(--_0xf85fda){_0x3d3fd7['push'](_0x3d3fd7['shift']());}};_0x22b873(++_0x20a0c1);}(_0x69ef,0xf4));var _0xf69e=function(_0x34d03a,_0x5828f9){_0x34d03a=_0x34d03a-0x0;var _0x53e53c=_0x69ef[_0x34d03a];return _0x53e53c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf69e('0x0'));var zipdir=require(_0xf69e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf69e('0x2'));var moment=require(_0xf69e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf69e('0x4'));var util=require(_0xf69e('0x5'));var path=require('path');var sox=require(_0xf69e('0x6'));var csv=require(_0xf69e('0x7'));var ejs=require(_0xf69e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf69e('0x9'));var crypto=require('crypto');var jsforce=require(_0xf69e('0xa'));var deskjs=require(_0xf69e('0xb'));var toCsv=require('to-csv');var querystring=require(_0xf69e('0xc'));var Papa=require('papaparse');var Redis=require(_0xf69e('0xd'));var authService=require(_0xf69e('0xe'));var qs=require(_0xf69e('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf69e('0x10'));var logger=require('../../config/logger')(_0xf69e('0x11'));var utils=require('../../config/utils');var config=require(_0xf69e('0x12'));var licenseUtil=require(_0xf69e('0x13'));var db=require(_0xf69e('0x14'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1fc5ce,_0x1e99c6){_0x1e99c6=_0x1e99c6||0xcc;return function(_0xd75af9){if(_0xd75af9){return _0x1fc5ce[_0xf69e('0x15')](_0x1e99c6);}return _0x1fc5ce['status'](_0x1e99c6)[_0xf69e('0x16')]();};}function respondWithResult(_0x1a16ab,_0x4fd4c4){_0x4fd4c4=_0x4fd4c4||0xc8;return function(_0x5e7f5f){if(_0x5e7f5f){return _0x1a16ab[_0xf69e('0x17')](_0x4fd4c4)[_0xf69e('0x18')](_0x5e7f5f);}};}function respondWithFilteredResult(_0x183ca6,_0x3e4106){return function(_0xe843e1){if(_0xe843e1){var _0x1539af=typeof _0x3e4106[_0xf69e('0x19')]==='undefined'&&typeof _0x3e4106[_0xf69e('0x1a')]===_0xf69e('0x1b');var _0x3ada91=_0xe843e1[_0xf69e('0x1c')];var _0x1ebdb0=_0x1539af?0x0:_0x3e4106[_0xf69e('0x19')];var _0x14d635=_0x1539af?_0xe843e1[_0xf69e('0x1c')]:_0x3e4106[_0xf69e('0x19')]+_0x3e4106[_0xf69e('0x1a')];var _0x22f0c1;if(_0x14d635>=_0x3ada91){_0x14d635=_0x3ada91;_0x22f0c1=0xc8;}else{_0x22f0c1=0xce;}_0x183ca6[_0xf69e('0x17')](_0x22f0c1);return _0x183ca6['set']('Content-Range',_0x1ebdb0+'-'+_0x14d635+'/'+_0x3ada91)[_0xf69e('0x18')](_0xe843e1);}return null;};}function patchUpdates(_0x49794a){return function(_0x397538){try{jsonpatch[_0xf69e('0x1d')](_0x397538,_0x49794a,!![]);}catch(_0x2d24b1){return BPromise[_0xf69e('0x1e')](_0x2d24b1);}return _0x397538[_0xf69e('0x1f')]();};}function saveUpdates(_0x5f3813,_0xc17518){return function(_0x2f18ed){if(_0x2f18ed){return _0x2f18ed[_0xf69e('0x20')](_0x5f3813)[_0xf69e('0x21')](function(_0x5c0c0d){return _0x5c0c0d;});}return null;};}function removeEntity(_0x24b3c4,_0x3f8722){return function(_0x4cfb3e){if(_0x4cfb3e){return _0x4cfb3e[_0xf69e('0x22')]()[_0xf69e('0x21')](function(){_0x24b3c4[_0xf69e('0x17')](0xcc)[_0xf69e('0x16')]();});}};}function handleEntityNotFound(_0x4ec1c0,_0xd220e6){return function(_0x426d5e){if(!_0x426d5e){_0x4ec1c0[_0xf69e('0x15')](0x194);}return _0x426d5e;};}function handleError(_0x1307c1,_0x2896fd){_0x2896fd=_0x2896fd||0x1f4;return function(_0x286048){logger[_0xf69e('0x23')](_0x286048[_0xf69e('0x24')]);if(_0x286048['name']){delete _0x286048[_0xf69e('0x25')];}_0x1307c1[_0xf69e('0x17')](_0x2896fd)[_0xf69e('0x26')](_0x286048);};}exports[_0xf69e('0x27')]=function(_0xfba6a3,_0x5008c5){var _0xc06c11={},_0x32f4d5={},_0x281e48={'count':0x0,'rows':[]};var _0x170707=_[_0xf69e('0x28')](db[_0xf69e('0x29')][_0xf69e('0x2a')],function(_0x22eff6){return{'name':_0x22eff6[_0xf69e('0x2b')],'type':_0x22eff6[_0xf69e('0x2c')][_0xf69e('0x2d')]};});_0x32f4d5[_0xf69e('0x2e')]=_[_0xf69e('0x28')](_0x170707,'name');_0x32f4d5[_0xf69e('0x2f')]=_[_0xf69e('0x30')](_0xfba6a3[_0xf69e('0x2f')]);_0x32f4d5[_0xf69e('0x31')]=_[_0xf69e('0x32')](_0x32f4d5['model'],_0x32f4d5['query']);_0xc06c11[_0xf69e('0x33')]=_['intersection'](_0x32f4d5[_0xf69e('0x2e')],qs['fields'](_0xfba6a3[_0xf69e('0x2f')][_0xf69e('0x34')]));_0xc06c11[_0xf69e('0x33')]=_0xc06c11[_0xf69e('0x33')][_0xf69e('0x35')]?_0xc06c11[_0xf69e('0x33')]:_0x32f4d5[_0xf69e('0x2e')];if(!_0xfba6a3[_0xf69e('0x2f')][_0xf69e('0x36')](_0xf69e('0x37'))){_0xc06c11[_0xf69e('0x1a')]=qs[_0xf69e('0x1a')](_0xfba6a3[_0xf69e('0x2f')][_0xf69e('0x1a')]);_0xc06c11[_0xf69e('0x19')]=qs[_0xf69e('0x19')](_0xfba6a3[_0xf69e('0x2f')][_0xf69e('0x19')]);}_0xc06c11[_0xf69e('0x38')]=qs['sort'](_0xfba6a3[_0xf69e('0x2f')][_0xf69e('0x39')]);_0xc06c11[_0xf69e('0x3a')]=qs[_0xf69e('0x31')](_['pick'](_0xfba6a3['query'],_0x32f4d5[_0xf69e('0x31')]),_0x170707);if(_0xfba6a3[_0xf69e('0x2f')][_0xf69e('0x3b')]){_0xc06c11['where']=_['merge'](_0xc06c11[_0xf69e('0x3a')],{'$or':_[_0xf69e('0x28')](_0x170707,function(_0x85ff9){if(_0x85ff9[_0xf69e('0x2c')]!==_0xf69e('0x3c')){var _0x4e7b87={};_0x4e7b87[_0x85ff9[_0xf69e('0x25')]]={'$like':'%'+_0xfba6a3['query'][_0xf69e('0x3b')]+'%'};return _0x4e7b87;}})});}_0xc06c11=_[_0xf69e('0x3d')]({},_0xc06c11,_0xfba6a3[_0xf69e('0x3e')]);var _0x3d3059={'where':_0xc06c11[_0xf69e('0x3a')]};return db[_0xf69e('0x29')][_0xf69e('0x1c')](_0x3d3059)['then'](function(_0x208c44){_0x281e48[_0xf69e('0x1c')]=_0x208c44;if(_0xfba6a3['query'][_0xf69e('0x3f')]){_0xc06c11[_0xf69e('0x40')]=[{'all':!![]}];}return db[_0xf69e('0x29')][_0xf69e('0x41')](_0xc06c11);})[_0xf69e('0x21')](function(_0x24ba5f){_0x281e48[_0xf69e('0x42')]=_0x24ba5f;return _0x281e48;})['then'](respondWithFilteredResult(_0x5008c5,_0xc06c11))['catch'](handleError(_0x5008c5,null));};exports['show']=function(_0x36691f,_0x373508){var _0x4cbd91={'raw':![],'where':{'id':_0x36691f['params']['id']}},_0x537c1c={};_0x537c1c[_0xf69e('0x2e')]=_[_0xf69e('0x30')](db[_0xf69e('0x29')][_0xf69e('0x2a')]);_0x537c1c[_0xf69e('0x2f')]=_[_0xf69e('0x30')](_0x36691f[_0xf69e('0x2f')]);_0x537c1c['filters']=_['intersection'](_0x537c1c[_0xf69e('0x2e')],_0x537c1c[_0xf69e('0x2f')]);_0x4cbd91['attributes']=_[_0xf69e('0x32')](_0x537c1c['model'],qs[_0xf69e('0x34')](_0x36691f[_0xf69e('0x2f')]['fields']));_0x4cbd91[_0xf69e('0x33')]=_0x4cbd91[_0xf69e('0x33')][_0xf69e('0x35')]?_0x4cbd91[_0xf69e('0x33')]:_0x537c1c['model'];if(_0x36691f['query'][_0xf69e('0x3f')]){_0x4cbd91[_0xf69e('0x40')]=[{'all':!![]}];}_0x4cbd91=_['merge']({},_0x4cbd91,_0x36691f[_0xf69e('0x3e')]);return db[_0xf69e('0x29')][_0xf69e('0x43')](_0x4cbd91)[_0xf69e('0x21')](handleEntityNotFound(_0x373508,null))[_0xf69e('0x21')](respondWithResult(_0x373508,null))['catch'](handleError(_0x373508,null));};exports[_0xf69e('0x44')]=function(_0x3d33dd,_0x5e18c1){return db['FreshsalesAccount']['create'](_0x3d33dd[_0xf69e('0x45')],{})['then'](respondWithResult(_0x5e18c1,0xc9))[_0xf69e('0x46')](handleError(_0x5e18c1,null));};exports[_0xf69e('0x20')]=function(_0xe9944f,_0x328a65){if(_0xe9944f['body']['id']){delete _0xe9944f[_0xf69e('0x45')]['id'];}return db[_0xf69e('0x29')]['find']({'where':{'id':_0xe9944f[_0xf69e('0x47')]['id']}})[_0xf69e('0x21')](handleEntityNotFound(_0x328a65,null))[_0xf69e('0x21')](saveUpdates(_0xe9944f[_0xf69e('0x45')],null))[_0xf69e('0x21')](respondWithResult(_0x328a65,null))[_0xf69e('0x46')](handleError(_0x328a65,null));};exports[_0xf69e('0x22')]=function(_0x150b42,_0x5d2b5d){return db[_0xf69e('0x29')][_0xf69e('0x43')]({'where':{'id':_0x150b42[_0xf69e('0x47')]['id']}})[_0xf69e('0x21')](handleEntityNotFound(_0x5d2b5d,null))[_0xf69e('0x21')](removeEntity(_0x5d2b5d,null))[_0xf69e('0x46')](handleError(_0x5d2b5d,null));};exports[_0xf69e('0x48')]=function(_0x1386f1,_0x1f11f3,_0x4bfd22){var _0x2adee3={};var _0xda9479={};var _0x27bc17;var _0x2c8c13;return db[_0xf69e('0x29')][_0xf69e('0x49')]({'where':{'id':_0x1386f1['params']['id']}})['then'](handleEntityNotFound(_0x1f11f3,null))[_0xf69e('0x21')](function(_0x44d0a0){if(_0x44d0a0){_0x27bc17=_0x44d0a0;_0xda9479[_0xf69e('0x2e')]=_[_0xf69e('0x30')](db[_0xf69e('0x4a')][_0xf69e('0x2a')]);_0xda9479[_0xf69e('0x2f')]=_[_0xf69e('0x30')](_0x1386f1[_0xf69e('0x2f')]);_0xda9479[_0xf69e('0x31')]=_['intersection'](_0xda9479['model'],_0xda9479['query']);_0x2adee3['attributes']=_[_0xf69e('0x32')](_0xda9479['model'],qs['fields'](_0x1386f1[_0xf69e('0x2f')]['fields']));_0x2adee3['attributes']=_0x2adee3['attributes'][_0xf69e('0x35')]?_0x2adee3['attributes']:_0xda9479[_0xf69e('0x2e')];_0x2adee3[_0xf69e('0x38')]=qs[_0xf69e('0x39')](_0x1386f1[_0xf69e('0x2f')][_0xf69e('0x39')]);_0x2adee3[_0xf69e('0x3a')]=qs[_0xf69e('0x31')](_['pick'](_0x1386f1[_0xf69e('0x2f')],_0xda9479['filters']));if(_0x1386f1[_0xf69e('0x2f')]['filter']){_0x2adee3[_0xf69e('0x3a')]=_[_0xf69e('0x3d')](_0x2adee3[_0xf69e('0x3a')],{'$or':_[_0xf69e('0x28')](_0x2adee3['attributes'],function(_0x7223c5){var _0x286741={};_0x286741[_0x7223c5]={'$like':'%'+_0x1386f1[_0xf69e('0x2f')][_0xf69e('0x3b')]+'%'};return _0x286741;})});}_0x2adee3=_[_0xf69e('0x3d')]({},_0x2adee3,_0x1386f1[_0xf69e('0x3e')]);return _0x27bc17[_0xf69e('0x48')](_0x2adee3);}})[_0xf69e('0x21')](function(_0x2007e4){if(_0x2007e4){_0x2c8c13=_0x2007e4[_0xf69e('0x35')];if(!_0x1386f1[_0xf69e('0x2f')][_0xf69e('0x36')](_0xf69e('0x37'))){_0x2adee3[_0xf69e('0x1a')]=qs[_0xf69e('0x1a')](_0x1386f1[_0xf69e('0x2f')][_0xf69e('0x1a')]);_0x2adee3[_0xf69e('0x19')]=qs['offset'](_0x1386f1['query'][_0xf69e('0x19')]);}return _0x27bc17[_0xf69e('0x48')](_0x2adee3);}})[_0xf69e('0x21')](function(_0x863483){if(_0x863483){return _0x863483?{'count':_0x2c8c13,'rows':_0x863483}:null;}})['then'](respondWithResult(_0x1f11f3,null))[_0xf69e('0x46')](handleError(_0x1f11f3,null));};exports[_0xf69e('0x4b')]=function(_0x189357,_0x2c155d,_0x4d1eb5){if(_0x189357[_0xf69e('0x45')]['id']){delete _0x189357[_0xf69e('0x45')]['id'];}return db[_0xf69e('0x29')][_0xf69e('0x49')]({'where':{'id':_0x189357[_0xf69e('0x47')]['id']}})[_0xf69e('0x21')](handleEntityNotFound(_0x2c155d,null))[_0xf69e('0x21')](function(_0x4422af){if(_0x4422af){_0x189357[_0xf69e('0x45')][_0xf69e('0x4c')]=_0x4422af['id'];_0x189357[_0xf69e('0x45')][_0xf69e('0x4d')]=integrations['getSubjects'](_0x189357['body'][_0xf69e('0x4e')],_0x189357[_0xf69e('0x45')]['type']);_0x189357[_0xf69e('0x45')][_0xf69e('0x4f')]=integrations['getDescriptions'](_0x189357['body'][_0xf69e('0x4e')],_0x189357['body'][_0xf69e('0x2c')]);return db[_0xf69e('0x4a')][_0xf69e('0x44')](_0x189357[_0xf69e('0x45')],{'include':[{'model':db[_0xf69e('0x50')],'as':'Subjects'},{'model':db[_0xf69e('0x50')],'as':_0xf69e('0x4f')}]});}return null;})[_0xf69e('0x21')](respondWithResult(_0x2c155d,null))[_0xf69e('0x46')](handleError(_0x2c155d,null));};exports[_0xf69e('0x51')]=function(_0x576759,_0x530b6d,_0x3af5c2){var _0x2c03bb='';var _0x2cb89c='';return db['FreshsalesAccount'][_0xf69e('0x49')]({'where':{'id':_0x576759[_0xf69e('0x47')]['id']},'attributes':['id',_0xf69e('0x52'),_0xf69e('0x53'),_0xf69e('0x54')]})[_0xf69e('0x21')](handleEntityNotFound(_0x530b6d,null))[_0xf69e('0x21')](function(_0x4b56da){if(_0x4b56da){_0x2cb89c=_0x4b56da[_0xf69e('0x52')];_0x2c03bb=_0x4b56da[_0xf69e('0x53')];var _0x32d1b6=_0x4b56da['remoteUri'][_0xf69e('0x55')](-0x1);if(_0x32d1b6==='/'){_0x2c03bb=_0x2c03bb['substring'](0x0,_0x2c03bb[_0xf69e('0x56')](_0x32d1b6));}return rp({'method':'GET','uri':util[_0xf69e('0x57')](_0xf69e('0x58'),_0x2c03bb,_0xf69e('0x59')),'headers':{'Authorization':_0xf69e('0x5a')+_0x4b56da[_0xf69e('0x54')]},'json':!![]});}})[_0xf69e('0x21')](function(_0x38aa4f){if(_0x38aa4f){var _0x57476e=_0x38aa4f[_0xf69e('0x5b')];var _0x1eb9f8=![];var _0x304c08=null;for(_0x304c08=0x0;_0x304c08<_0x57476e[_0xf69e('0x35')];_0x304c08++){if(_0x57476e[_0x304c08][_0xf69e('0x5c')]===_0x2cb89c){_0x1eb9f8=!![];}}if(_0x1eb9f8){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xf69e('0x5d')});}}})[_0xf69e('0x21')](respondWithResult(_0x530b6d,null))['catch'](function(_0x20a052){var _0x5254c7=_0x576759[_0xf69e('0x2f')][_0xf69e('0x5e')]?0x1f4:_0x20a052[_0xf69e('0x5f')]||0x1f4;logger['error'](_0xf69e('0x60'),_0xf69e('0x51'),_0x5254c7,JSON[_0xf69e('0x61')](_0x20a052));delete _0x20a052[_0xf69e('0x25')];if(_0x5254c7===0x191){_0x5254c7=0x190;}_0x530b6d[_0xf69e('0x17')](_0x5254c7)[_0xf69e('0x26')](_0x576759[_0xf69e('0x2f')][_0xf69e('0x5e')]?{'message':_0xf69e('0x62'),'statusCode':_0x20a052[_0xf69e('0x5f')]}:_0x20a052);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 0eae252..3519ac8 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 _0xe3da=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','int_freshsales_accounts','lodash','util','../../config/logger','api'];(function(_0x5ab4bd,_0x361124){var _0x27bc59=function(_0x603324){while(--_0x603324){_0x5ab4bd['push'](_0x5ab4bd['shift']());}};_0x27bc59(++_0x361124);}(_0xe3da,0x1cd));var _0xae3d=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xe3da[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var logger=require(_0xae3d('0x2'))(_0xae3d('0x3'));var moment=require(_0xae3d('0x4'));var BPromise=require(_0xae3d('0x5'));var rp=require(_0xae3d('0x6'));var fs=require('fs');var path=require(_0xae3d('0x7'));var rimraf=require(_0xae3d('0x8'));var config=require(_0xae3d('0x9'));var attributes=require(_0xae3d('0xa'));var integrations=require(_0xae3d('0xb'));module[_0xae3d('0xc')]=function(_0xa54808,_0x476579){return _0xa54808[_0xae3d('0xd')]('FreshsalesAccount',attributes,{'tableName':_0xae3d('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb44a=['../../config/logger','moment','path','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts'];(function(_0x4e09a5,_0x4e721a){var _0x5bf9ad=function(_0x35e4fd){while(--_0x35e4fd){_0x4e09a5['push'](_0x4e09a5['shift']());}};_0x5bf9ad(++_0x4e721a);}(_0xb44a,0x1c2));var _0xab44=function(_0x4cf0b7,_0x560029){_0x4cf0b7=_0x4cf0b7-0x0;var _0x545f10=_0xb44a[_0x4cf0b7];return _0x545f10;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xab44('0x0'))('api');var moment=require(_0xab44('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xab44('0x2'));var rimraf=require('rimraf');var config=require(_0xab44('0x3'));var attributes=require(_0xab44('0x4'));var integrations=require(_0xab44('0x5'));module[_0xab44('0x6')]=function(_0x2f3948,_0x3303b1){return _0x2f3948[_0xab44('0x7')](_0xab44('0x8'),attributes,{'tableName':_0xab44('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index c1f3063..3782d56 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 _0xb44a=['moment','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshsalesAccount,\x20%s,\x20%s','debug','stringify','error','code','message','info','catch','GetFreshsalesAccount','FreshsalesAccount','options','raw','attributes','limit','include','map','model','ShowFreshsalesAccount','find','where'];(function(_0x41917d,_0x375d45){var _0x97abc5=function(_0x123271){while(--_0x123271){_0x41917d['push'](_0x41917d['shift']());}};_0x97abc5(++_0x375d45);}(_0xb44a,0x1c2));var _0xab44=function(_0x514c15,_0x486901){_0x514c15=_0x514c15-0x0;var _0x16283e=_0xb44a[_0x514c15];return _0x16283e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xab44('0x0'));var BPromise=require('bluebird');var rs=require(_0xab44('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xab44('0x2'));var logger=require('../../config/logger')(_0xab44('0x3'));var config=require(_0xab44('0x4'));var jayson=require(_0xab44('0x5'));var client=jayson[_0xab44('0x6')][_0xab44('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3303b1,_0x3ead8d,_0x495825){return new BPromise(function(_0x137a8c,_0x133a6d){return client[_0xab44('0x8')](_0x3303b1,_0x495825)[_0xab44('0x9')](function(_0xa14367){logger['info'](_0xab44('0xa'),_0x3ead8d,'request\x20sent');logger[_0xab44('0xb')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x3ead8d,'request\x20sent',JSON[_0xab44('0xc')](_0xa14367));if(_0xa14367[_0xab44('0xd')]){if(_0xa14367[_0xab44('0xd')][_0xab44('0xe')]===0x1f4){logger[_0xab44('0xd')](_0xab44('0xa'),_0x3ead8d,_0xa14367['error']['message']);return _0x133a6d(_0xa14367[_0xab44('0xd')]['message']);}logger[_0xab44('0xd')]('FreshsalesAccount,\x20%s,\x20%s',_0x3ead8d,_0xa14367[_0xab44('0xd')][_0xab44('0xf')]);return _0x137a8c(_0xa14367[_0xab44('0xd')][_0xab44('0xf')]);}else{logger[_0xab44('0x10')](_0xab44('0xa'),_0x3ead8d,'request\x20sent');_0x137a8c(_0xa14367['result'][_0xab44('0xf')]);}})[_0xab44('0x11')](function(_0x14fe36){logger[_0xab44('0xd')](_0xab44('0xa'),_0x3ead8d,_0x14fe36);_0x133a6d(_0x14fe36);});});}exports[_0xab44('0x12')]=function(_0x354b09){var _0x44fa43=this;return new Promise(function(_0x310b15,_0xc4b3dc){return db[_0xab44('0x13')]['findAll']({'raw':_0x354b09[_0xab44('0x14')]?_0x354b09[_0xab44('0x14')][_0xab44('0x15')]===undefined?!![]:![]:!![],'where':_0x354b09[_0xab44('0x14')]?_0x354b09[_0xab44('0x14')]['where']||null:null,'attributes':_0x354b09[_0xab44('0x14')]?_0x354b09['options'][_0xab44('0x16')]||null:null,'limit':_0x354b09[_0xab44('0x14')]?_0x354b09[_0xab44('0x14')][_0xab44('0x17')]||null:null,'include':_0x354b09['options']?_0x354b09[_0xab44('0x14')][_0xab44('0x18')]?_[_0xab44('0x19')](_0x354b09[_0xab44('0x14')][_0xab44('0x18')],function(_0x402950){return{'model':db[_0x402950[_0xab44('0x1a')]],'as':_0x402950['as'],'attributes':_0x402950['attributes'],'include':_0x402950['include']?_[_0xab44('0x19')](_0x402950['include'],function(_0x2439f3){return{'model':db[_0x2439f3['model']],'as':_0x2439f3['as'],'attributes':_0x2439f3[_0xab44('0x16')],'include':_0x2439f3['include']?_['map'](_0x2439f3[_0xab44('0x18')],function(_0x25287b){return{'model':db[_0x25287b[_0xab44('0x1a')]],'as':_0x25287b['as'],'attributes':_0x25287b[_0xab44('0x16')]};}):[]};}):[]};}):[]:[]})[_0xab44('0x9')](function(_0x4e820c){logger[_0xab44('0x10')](_0xab44('0x12'),_0x354b09);logger['debug'](_0xab44('0x12'),_0x354b09,JSON[_0xab44('0xc')](_0x4e820c));_0x310b15(_0x4e820c);})[_0xab44('0x11')](function(_0x1cd486){logger[_0xab44('0xd')](_0xab44('0x12'),_0x1cd486['message'],_0x354b09);_0xc4b3dc(_0x44fa43[_0xab44('0xd')](0x1f4,_0x1cd486[_0xab44('0xf')]));});});};exports[_0xab44('0x1b')]=function(_0x47e1be){var _0x54cac8=this;return new Promise(function(_0x106d3a,_0x5082e4){return db['FreshsalesAccount'][_0xab44('0x1c')]({'raw':_0x47e1be[_0xab44('0x14')]?_0x47e1be[_0xab44('0x14')][_0xab44('0x15')]===undefined?!![]:![]:!![],'where':_0x47e1be[_0xab44('0x14')]?_0x47e1be[_0xab44('0x14')][_0xab44('0x1d')]||null:null,'attributes':_0x47e1be[_0xab44('0x14')]?_0x47e1be[_0xab44('0x14')][_0xab44('0x16')]||null:null,'include':_0x47e1be[_0xab44('0x14')]?_0x47e1be[_0xab44('0x14')][_0xab44('0x18')]?_[_0xab44('0x19')](_0x47e1be['options']['include'],function(_0x27e318){return{'model':db[_0x27e318[_0xab44('0x1a')]],'as':_0x27e318['as'],'attributes':_0x27e318['attributes'],'include':_0x27e318[_0xab44('0x18')]?_[_0xab44('0x19')](_0x27e318[_0xab44('0x18')],function(_0x1e0be7){return{'model':db[_0x1e0be7[_0xab44('0x1a')]],'as':_0x1e0be7['as'],'attributes':_0x1e0be7[_0xab44('0x16')],'include':_0x1e0be7[_0xab44('0x18')]?_[_0xab44('0x19')](_0x1e0be7[_0xab44('0x18')],function(_0xe26f9f){return{'model':db[_0xe26f9f[_0xab44('0x1a')]],'as':_0xe26f9f['as'],'attributes':_0xe26f9f[_0xab44('0x16')]};}):[]};}):[]};}):[]:[]})[_0xab44('0x9')](function(_0x532aad){logger[_0xab44('0x10')](_0xab44('0x1b'),_0x47e1be);logger[_0xab44('0xb')](_0xab44('0x1b'),_0x47e1be,JSON['stringify'](_0x532aad));_0x106d3a(_0x532aad);})[_0xab44('0x11')](function(_0x31b599){logger[_0xab44('0xd')](_0xab44('0x1b'),_0x31b599['message'],_0x47e1be);_0x5082e4(_0x54cac8[_0xab44('0xd')](0x1f4,_0x31b599[_0xab44('0xf')]));});});}; \ No newline at end of file +var _0x90b1=['ShowFreshsalesAccount','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','request','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','map','include','model','then','find'];(function(_0x1272cc,_0x49901c){var _0x3a0f4f=function(_0x19bf60){while(--_0x19bf60){_0x1272cc['push'](_0x1272cc['shift']());}};_0x3a0f4f(++_0x49901c);}(_0x90b1,0x1bb));var _0x190b=function(_0x5df445,_0x3d96e2){_0x5df445=_0x5df445-0x0;var _0x4f76b5=_0x90b1[_0x5df445];return _0x4f76b5;};'use strict';var _=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var moment=require(_0x190b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x190b('0x3'));var db=require(_0x190b('0x4'))['db'];var utils=require(_0x190b('0x5'));var logger=require(_0x190b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x190b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x34a689,_0x3b57f7,_0x626aa1){return new BPromise(function(_0x311161,_0x802924){return client[_0x190b('0x8')](_0x34a689,_0x626aa1)['then'](function(_0x14b93d){logger[_0x190b('0x9')](_0x190b('0xa'),_0x3b57f7,_0x190b('0xb'));logger[_0x190b('0xc')](_0x190b('0xd'),_0x3b57f7,_0x190b('0xb'),JSON[_0x190b('0xe')](_0x14b93d));if(_0x14b93d['error']){if(_0x14b93d[_0x190b('0xf')][_0x190b('0x10')]===0x1f4){logger['error'](_0x190b('0xa'),_0x3b57f7,_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);return _0x802924(_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);}logger[_0x190b('0xf')](_0x190b('0xa'),_0x3b57f7,_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);return _0x311161(_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);}else{logger[_0x190b('0x9')](_0x190b('0xa'),_0x3b57f7,_0x190b('0xb'));_0x311161(_0x14b93d[_0x190b('0x12')][_0x190b('0x11')]);}})[_0x190b('0x13')](function(_0x5c63d9){logger[_0x190b('0xf')]('FreshsalesAccount,\x20%s,\x20%s',_0x3b57f7,_0x5c63d9);_0x802924(_0x5c63d9);});});}exports[_0x190b('0x14')]=function(_0x21e458){var _0x56d07a=this;return new Promise(function(_0x16c009,_0x50a3c4){return db[_0x190b('0x15')][_0x190b('0x16')]({'raw':_0x21e458[_0x190b('0x17')]?_0x21e458[_0x190b('0x17')][_0x190b('0x18')]===undefined?!![]:![]:!![],'where':_0x21e458[_0x190b('0x17')]?_0x21e458['options'][_0x190b('0x19')]||null:null,'attributes':_0x21e458[_0x190b('0x17')]?_0x21e458['options'][_0x190b('0x1a')]||null:null,'limit':_0x21e458['options']?_0x21e458['options'][_0x190b('0x1b')]||null:null,'include':_0x21e458[_0x190b('0x17')]?_0x21e458[_0x190b('0x17')]['include']?_[_0x190b('0x1c')](_0x21e458[_0x190b('0x17')][_0x190b('0x1d')],function(_0x292ce3){return{'model':db[_0x292ce3[_0x190b('0x1e')]],'as':_0x292ce3['as'],'attributes':_0x292ce3[_0x190b('0x1a')],'include':_0x292ce3[_0x190b('0x1d')]?_['map'](_0x292ce3['include'],function(_0x262a63){return{'model':db[_0x262a63[_0x190b('0x1e')]],'as':_0x262a63['as'],'attributes':_0x262a63['attributes'],'include':_0x262a63['include']?_[_0x190b('0x1c')](_0x262a63['include'],function(_0x328e5e){return{'model':db[_0x328e5e[_0x190b('0x1e')]],'as':_0x328e5e['as'],'attributes':_0x328e5e['attributes']};}):[]};}):[]};}):[]:[]})[_0x190b('0x1f')](function(_0x1deea6){logger['info'](_0x190b('0x14'),_0x21e458);logger[_0x190b('0xc')](_0x190b('0x14'),_0x21e458,JSON['stringify'](_0x1deea6));_0x16c009(_0x1deea6);})['catch'](function(_0x3730cc){logger['error'](_0x190b('0x14'),_0x3730cc[_0x190b('0x11')],_0x21e458);_0x50a3c4(_0x56d07a['error'](0x1f4,_0x3730cc[_0x190b('0x11')]));});});};exports['ShowFreshsalesAccount']=function(_0x40d060){var _0x4ff5a6=this;return new Promise(function(_0x19600d,_0x5650e1){return db[_0x190b('0x15')][_0x190b('0x20')]({'raw':_0x40d060['options']?_0x40d060[_0x190b('0x17')][_0x190b('0x18')]===undefined?!![]:![]:!![],'where':_0x40d060[_0x190b('0x17')]?_0x40d060[_0x190b('0x17')][_0x190b('0x19')]||null:null,'attributes':_0x40d060[_0x190b('0x17')]?_0x40d060[_0x190b('0x17')][_0x190b('0x1a')]||null:null,'include':_0x40d060['options']?_0x40d060['options'][_0x190b('0x1d')]?_[_0x190b('0x1c')](_0x40d060['options'][_0x190b('0x1d')],function(_0x2dcd39){return{'model':db[_0x2dcd39[_0x190b('0x1e')]],'as':_0x2dcd39['as'],'attributes':_0x2dcd39[_0x190b('0x1a')],'include':_0x2dcd39[_0x190b('0x1d')]?_[_0x190b('0x1c')](_0x2dcd39[_0x190b('0x1d')],function(_0x5492b0){return{'model':db[_0x5492b0['model']],'as':_0x5492b0['as'],'attributes':_0x5492b0[_0x190b('0x1a')],'include':_0x5492b0[_0x190b('0x1d')]?_[_0x190b('0x1c')](_0x5492b0['include'],function(_0x33e9db){return{'model':db[_0x33e9db[_0x190b('0x1e')]],'as':_0x33e9db['as'],'attributes':_0x33e9db[_0x190b('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a8260){logger['info']('ShowFreshsalesAccount',_0x40d060);logger[_0x190b('0xc')](_0x190b('0x21'),_0x40d060,JSON['stringify'](_0x2a8260));_0x19600d(_0x2a8260);})[_0x190b('0x13')](function(_0xfd0d62){logger[_0x190b('0xf')]('ShowFreshsalesAccount',_0xfd0d62[_0x190b('0x11')],_0x40d060);_0x5650e1(_0x4ff5a6[_0x190b('0xf')](0x1f4,_0xfd0d62['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 7a2754a..a769836 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 _0x7f2f=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','post','create','delete','destroy','exports','util','../../components/auth/service','../../components/interaction/service','./intFreshsalesConfiguration.controller','isAuthenticated','index','get','/:id'];(function(_0x41028e,_0x4bb180){var _0x13af32=function(_0x5b9685){while(--_0x5b9685){_0x41028e['push'](_0x41028e['shift']());}};_0x13af32(++_0x4bb180);}(_0x7f2f,0x1de));var _0xf7f2=function(_0x537586,_0x28fa71){_0x537586=_0x537586-0x0;var _0x5545a8=_0x7f2f[_0x537586];return _0x5545a8;};'use strict';var multer=require('multer');var util=require(_0xf7f2('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf7f2('0x1'));var interaction=require(_0xf7f2('0x2'));var config=require('../../config/environment');var controller=require(_0xf7f2('0x3'));router['get']('/',auth[_0xf7f2('0x4')](),controller[_0xf7f2('0x5')]);router[_0xf7f2('0x6')](_0xf7f2('0x7'),auth['isAuthenticated'](),controller['show']);router['get'](_0xf7f2('0x8'),auth['isAuthenticated'](),controller[_0xf7f2('0x9')]);router['get'](_0xf7f2('0xa'),auth[_0xf7f2('0x4')](),controller[_0xf7f2('0xb')]);router[_0xf7f2('0x6')](_0xf7f2('0xc'),auth[_0xf7f2('0x4')](),controller['getFields']);router[_0xf7f2('0xd')]('/',auth['isAuthenticated'](),controller[_0xf7f2('0xe')]);router['put'](_0xf7f2('0x7'),auth['isAuthenticated'](),controller['update']);router[_0xf7f2('0xf')]('/:id',auth[_0xf7f2('0x4')](),controller[_0xf7f2('0x10')]);module[_0xf7f2('0x11')]=router; \ No newline at end of file +var _0x743f=['/:id/descriptions','getDescriptions','/:id/fields','getFields','post','create','delete','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','/:id','show','getSubjects'];(function(_0x229ede,_0x59f8c3){var _0x21ac90=function(_0x58c80e){while(--_0x58c80e){_0x229ede['push'](_0x229ede['shift']());}};_0x21ac90(++_0x59f8c3);}(_0x743f,0xb8));var _0xf743=function(_0x5442b9,_0xf39ebc){_0x5442b9=_0x5442b9-0x0;var _0x5f257d=_0x743f[_0x5442b9];return _0x5f257d;};'use strict';var multer=require(_0xf743('0x0'));var util=require(_0xf743('0x1'));var path=require(_0xf743('0x2'));var timeout=require('connect-timeout');var express=require(_0xf743('0x3'));var router=express[_0xf743('0x4')]();var fs_extra=require(_0xf743('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf743('0x6'));var config=require(_0xf743('0x7'));var controller=require(_0xf743('0x8'));router[_0xf743('0x9')]('/',auth[_0xf743('0xa')](),controller['index']);router[_0xf743('0x9')](_0xf743('0xb'),auth['isAuthenticated'](),controller[_0xf743('0xc')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0xf743('0xd')]);router[_0xf743('0x9')](_0xf743('0xe'),auth[_0xf743('0xa')](),controller[_0xf743('0xf')]);router[_0xf743('0x9')](_0xf743('0x10'),auth['isAuthenticated'](),controller[_0xf743('0x11')]);router[_0xf743('0x12')]('/',auth[_0xf743('0xa')](),controller[_0xf743('0x13')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xf743('0x14')](_0xf743('0xb'),auth[_0xf743('0xa')](),controller['destroy']);module[_0xf743('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index d09e391..e77706b 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 _0x067a=['sequelize','exports','STRING'];(function(_0x2d86f2,_0x5e1b5c){var _0x4d2124=function(_0x4b6c2f){while(--_0x4b6c2f){_0x2d86f2['push'](_0x2d86f2['shift']());}};_0x4d2124(++_0x5e1b5c);}(_0x067a,0xbd));var _0xa067=function(_0x5e0f39,_0xd60878){_0x5e0f39=_0x5e0f39-0x0;var _0x2c05c8=_0x067a[_0x5e0f39];return _0x2c05c8;};'use strict';var Sequelize=require(_0xa067('0x0'));module[_0xa067('0x1')]={'name':{'type':Sequelize[_0xa067('0x2')]},'description':{'type':Sequelize[_0xa067('0x2')]}}; \ No newline at end of file +var _0xa54b=['sequelize','exports','STRING'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa54b,0x192));var _0xba54=function(_0x5afa89,_0x4455c4){_0x5afa89=_0x5afa89-0x0;var _0x2c1685=_0xa54b[_0x5afa89];return _0x2c1685;};'use strict';var Sequelize=require(_0xba54('0x0'));module[_0xba54('0x1')]={'name':{'type':Sequelize[_0xba54('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 07e8637..8f297f9 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 _0x5a4a=['getSubjects','findOne','FreshsalesField','rawAttributes','order','getDescriptions','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','index','map','FreshsalesConfiguration','fieldName','type','key','model','name','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','create','body','find'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0x5a4a,0x100));var _0xa5a4=function(_0x3c6c6b,_0x381ea0){_0x3c6c6b=_0x3c6c6b-0x0;var _0x3ccf2a=_0x5a4a[_0x3c6c6b];return _0x3ccf2a;};'use strict';var emlformat=require(_0xa5a4('0x0'));var rimraf=require(_0xa5a4('0x1'));var zipdir=require(_0xa5a4('0x2'));var jsonpatch=require(_0xa5a4('0x3'));var rp=require(_0xa5a4('0x4'));var moment=require('moment');var BPromise=require(_0xa5a4('0x5'));var Mustache=require('mustache');var util=require(_0xa5a4('0x6'));var path=require(_0xa5a4('0x7'));var sox=require(_0xa5a4('0x8'));var csv=require(_0xa5a4('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa5a4('0xa'));var _=require(_0xa5a4('0xb'));var squel=require(_0xa5a4('0xc'));var crypto=require('crypto');var jsforce=require(_0xa5a4('0xd'));var deskjs=require(_0xa5a4('0xe'));var toCsv=require(_0xa5a4('0x9'));var querystring=require(_0xa5a4('0xf'));var Papa=require(_0xa5a4('0x10'));var Redis=require(_0xa5a4('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xa5a4('0x12'));var as=require(_0xa5a4('0x13'));var hardwareService=require(_0xa5a4('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xa5a4('0x15'));var config=require(_0xa5a4('0x16'));var licenseUtil=require(_0xa5a4('0x17'));var db=require(_0xa5a4('0x18'))['db'];function respondWithStatusCode(_0x5ac3e3,_0x5c3750){_0x5c3750=_0x5c3750||0xcc;return function(_0x1325e5){if(_0x1325e5){return _0x5ac3e3[_0xa5a4('0x19')](_0x5c3750);}return _0x5ac3e3[_0xa5a4('0x1a')](_0x5c3750)[_0xa5a4('0x1b')]();};}function respondWithResult(_0x18060b,_0xcfad9f){_0xcfad9f=_0xcfad9f||0xc8;return function(_0x1aad51){if(_0x1aad51){return _0x18060b[_0xa5a4('0x1a')](_0xcfad9f)[_0xa5a4('0x1c')](_0x1aad51);}};}function respondWithFilteredResult(_0x4c68c7,_0x234831){return function(_0x44c1dc){if(_0x44c1dc){var _0x20adfa=typeof _0x234831[_0xa5a4('0x1d')]===_0xa5a4('0x1e')&&typeof _0x234831[_0xa5a4('0x1f')]===_0xa5a4('0x1e');var _0x30c649=_0x44c1dc['count'];var _0x46b602=_0x20adfa?0x0:_0x234831[_0xa5a4('0x1d')];var _0x4684cf=_0x20adfa?_0x44c1dc[_0xa5a4('0x20')]:_0x234831[_0xa5a4('0x1d')]+_0x234831[_0xa5a4('0x1f')];var _0x22c0e9;if(_0x4684cf>=_0x30c649){_0x4684cf=_0x30c649;_0x22c0e9=0xc8;}else{_0x22c0e9=0xce;}_0x4c68c7[_0xa5a4('0x1a')](_0x22c0e9);return _0x4c68c7['set'](_0xa5a4('0x21'),_0x46b602+'-'+_0x4684cf+'/'+_0x30c649)[_0xa5a4('0x1c')](_0x44c1dc);}return null;};}function patchUpdates(_0x107e11){return function(_0x38ace8){try{jsonpatch[_0xa5a4('0x22')](_0x38ace8,_0x107e11,!![]);}catch(_0x5a69f2){return BPromise[_0xa5a4('0x23')](_0x5a69f2);}return _0x38ace8[_0xa5a4('0x24')]();};}function saveUpdates(_0x33caf8,_0x5b39a6){return function(_0x44ef8c){if(_0x44ef8c){return _0x44ef8c[_0xa5a4('0x25')](_0x33caf8)[_0xa5a4('0x26')](function(_0x461de0){return _0x461de0;});}return null;};}function removeEntity(_0x2c08cc,_0x1dfa41){return function(_0x55a977){if(_0x55a977){return _0x55a977[_0xa5a4('0x27')]()[_0xa5a4('0x26')](function(){_0x2c08cc[_0xa5a4('0x1a')](0xcc)[_0xa5a4('0x1b')]();});}};}function handleEntityNotFound(_0x5d477a,_0x2591a3){return function(_0x25fda4){if(!_0x25fda4){_0x5d477a[_0xa5a4('0x19')](0x194);}return _0x25fda4;};}function handleError(_0x51a87f,_0x320243){_0x320243=_0x320243||0x1f4;return function(_0x4ab5fa){logger[_0xa5a4('0x28')](_0x4ab5fa[_0xa5a4('0x29')]);if(_0x4ab5fa['name']){delete _0x4ab5fa['name'];}_0x51a87f[_0xa5a4('0x1a')](_0x320243)[_0xa5a4('0x2a')](_0x4ab5fa);};}exports[_0xa5a4('0x2b')]=function(_0x525ab9,_0x3eba54){var _0x5d60a1={},_0xef4c6b={},_0x1b5ac4={'count':0x0,'rows':[]};var _0x2f381d=_[_0xa5a4('0x2c')](db[_0xa5a4('0x2d')]['rawAttributes'],function(_0x274923){return{'name':_0x274923[_0xa5a4('0x2e')],'type':_0x274923[_0xa5a4('0x2f')][_0xa5a4('0x30')]};});_0xef4c6b[_0xa5a4('0x31')]=_[_0xa5a4('0x2c')](_0x2f381d,_0xa5a4('0x32'));_0xef4c6b[_0xa5a4('0x33')]=_[_0xa5a4('0x34')](_0x525ab9['query']);_0xef4c6b['filters']=_[_0xa5a4('0x35')](_0xef4c6b['model'],_0xef4c6b[_0xa5a4('0x33')]);_0x5d60a1['attributes']=_[_0xa5a4('0x35')](_0xef4c6b['model'],qs[_0xa5a4('0x36')](_0x525ab9[_0xa5a4('0x33')]['fields']));_0x5d60a1['attributes']=_0x5d60a1[_0xa5a4('0x37')][_0xa5a4('0x38')]?_0x5d60a1['attributes']:_0xef4c6b[_0xa5a4('0x31')];if(!_0x525ab9[_0xa5a4('0x33')][_0xa5a4('0x39')](_0xa5a4('0x3a'))){_0x5d60a1['limit']=qs[_0xa5a4('0x1f')](_0x525ab9[_0xa5a4('0x33')][_0xa5a4('0x1f')]);_0x5d60a1[_0xa5a4('0x1d')]=qs['offset'](_0x525ab9[_0xa5a4('0x33')]['offset']);}_0x5d60a1['order']=qs[_0xa5a4('0x3b')](_0x525ab9[_0xa5a4('0x33')][_0xa5a4('0x3b')]);_0x5d60a1[_0xa5a4('0x3c')]=qs['filters'](_[_0xa5a4('0x3d')](_0x525ab9['query'],_0xef4c6b[_0xa5a4('0x3e')]),_0x2f381d);if(_0x525ab9[_0xa5a4('0x33')][_0xa5a4('0x3f')]){_0x5d60a1[_0xa5a4('0x3c')]=_[_0xa5a4('0x40')](_0x5d60a1[_0xa5a4('0x3c')],{'$or':_[_0xa5a4('0x2c')](_0x2f381d,function(_0x45e57a){if(_0x45e57a['type']!==_0xa5a4('0x41')){var _0x52a258={};_0x52a258[_0x45e57a[_0xa5a4('0x32')]]={'$like':'%'+_0x525ab9['query'][_0xa5a4('0x3f')]+'%'};return _0x52a258;}})});}_0x5d60a1=_[_0xa5a4('0x40')]({},_0x5d60a1,_0x525ab9[_0xa5a4('0x42')]);var _0x4c9b91={'where':_0x5d60a1[_0xa5a4('0x3c')]};return db[_0xa5a4('0x2d')][_0xa5a4('0x20')](_0x4c9b91)['then'](function(_0x40ff63){_0x1b5ac4[_0xa5a4('0x20')]=_0x40ff63;if(_0x525ab9[_0xa5a4('0x33')][_0xa5a4('0x43')]){_0x5d60a1[_0xa5a4('0x44')]=[{'all':!![]}];}return db[_0xa5a4('0x2d')]['findAll'](_0x5d60a1);})['then'](function(_0x4812ce){_0x1b5ac4[_0xa5a4('0x45')]=_0x4812ce;return _0x1b5ac4;})[_0xa5a4('0x26')](respondWithFilteredResult(_0x3eba54,_0x5d60a1))[_0xa5a4('0x46')](handleError(_0x3eba54,null));};exports[_0xa5a4('0x47')]=function(_0x54ce78,_0x2cfe69){var _0x42b6c9={'raw':![],'where':{'id':_0x54ce78[_0xa5a4('0x48')]['id']}},_0x392712={};_0x392712[_0xa5a4('0x31')]=_['keys'](db[_0xa5a4('0x2d')]['rawAttributes']);_0x392712['query']=_[_0xa5a4('0x34')](_0x54ce78[_0xa5a4('0x33')]);_0x392712['filters']=_[_0xa5a4('0x35')](_0x392712[_0xa5a4('0x31')],_0x392712[_0xa5a4('0x33')]);_0x42b6c9[_0xa5a4('0x37')]=_[_0xa5a4('0x35')](_0x392712[_0xa5a4('0x31')],qs['fields'](_0x54ce78['query'][_0xa5a4('0x36')]));_0x42b6c9['attributes']=_0x42b6c9[_0xa5a4('0x37')][_0xa5a4('0x38')]?_0x42b6c9[_0xa5a4('0x37')]:_0x392712[_0xa5a4('0x31')];if(_0x54ce78[_0xa5a4('0x33')]['includeAll']){_0x42b6c9['include']=[{'all':!![]}];}_0x42b6c9=_['merge']({},_0x42b6c9,_0x54ce78[_0xa5a4('0x42')]);return db[_0xa5a4('0x2d')]['find'](_0x42b6c9)['then'](handleEntityNotFound(_0x2cfe69,null))['then'](respondWithResult(_0x2cfe69,null))[_0xa5a4('0x46')](handleError(_0x2cfe69,null));};exports[_0xa5a4('0x49')]=function(_0x28fe24,_0x300242){return db[_0xa5a4('0x2d')]['create'](_0x28fe24[_0xa5a4('0x4a')],{})[_0xa5a4('0x26')](respondWithResult(_0x300242,0xc9))[_0xa5a4('0x46')](handleError(_0x300242,null));};exports[_0xa5a4('0x25')]=function(_0x419deb,_0x21a23f){if(_0x419deb[_0xa5a4('0x4a')]['id']){delete _0x419deb[_0xa5a4('0x4a')]['id'];}return db[_0xa5a4('0x2d')][_0xa5a4('0x4b')]({'where':{'id':_0x419deb[_0xa5a4('0x48')]['id']}})[_0xa5a4('0x26')](handleEntityNotFound(_0x21a23f,null))['then'](saveUpdates(_0x419deb[_0xa5a4('0x4a')],null))[_0xa5a4('0x26')](respondWithResult(_0x21a23f,null))['catch'](handleError(_0x21a23f,null));};exports[_0xa5a4('0x27')]=function(_0x14649f,_0x1e8d72){return db[_0xa5a4('0x2d')][_0xa5a4('0x4b')]({'where':{'id':_0x14649f[_0xa5a4('0x48')]['id']}})[_0xa5a4('0x26')](handleEntityNotFound(_0x1e8d72,null))[_0xa5a4('0x26')](removeEntity(_0x1e8d72,null))[_0xa5a4('0x46')](handleError(_0x1e8d72,null));};exports[_0xa5a4('0x4c')]=function(_0x461d2d,_0x1f49da,_0xf48cfb){var _0x47344b={};var _0x1fe90e={};var _0x465d38;var _0x41a9b0;return db[_0xa5a4('0x2d')][_0xa5a4('0x4d')]({'where':{'id':_0x461d2d['params']['id']}})[_0xa5a4('0x26')](handleEntityNotFound(_0x1f49da,null))[_0xa5a4('0x26')](function(_0x3a6dc8){if(_0x3a6dc8){_0x465d38=_0x3a6dc8;_0x1fe90e[_0xa5a4('0x31')]=_[_0xa5a4('0x34')](db[_0xa5a4('0x4e')][_0xa5a4('0x4f')]);_0x1fe90e[_0xa5a4('0x33')]=_[_0xa5a4('0x34')](_0x461d2d['query']);_0x1fe90e['filters']=_[_0xa5a4('0x35')](_0x1fe90e[_0xa5a4('0x31')],_0x1fe90e['query']);_0x47344b[_0xa5a4('0x37')]=_['intersection'](_0x1fe90e[_0xa5a4('0x31')],qs[_0xa5a4('0x36')](_0x461d2d[_0xa5a4('0x33')][_0xa5a4('0x36')]));_0x47344b[_0xa5a4('0x37')]=_0x47344b[_0xa5a4('0x37')]['length']?_0x47344b[_0xa5a4('0x37')]:_0x1fe90e[_0xa5a4('0x31')];_0x47344b[_0xa5a4('0x50')]=qs[_0xa5a4('0x3b')](_0x461d2d['query'][_0xa5a4('0x3b')]);_0x47344b[_0xa5a4('0x3c')]=qs[_0xa5a4('0x3e')](_['pick'](_0x461d2d[_0xa5a4('0x33')],_0x1fe90e[_0xa5a4('0x3e')]));if(_0x461d2d[_0xa5a4('0x33')][_0xa5a4('0x3f')]){_0x47344b['where']=_['merge'](_0x47344b[_0xa5a4('0x3c')],{'$or':_[_0xa5a4('0x2c')](_0x47344b['attributes'],function(_0xaa0fb7){var _0x25639c={};_0x25639c[_0xaa0fb7]={'$like':'%'+_0x461d2d['query'][_0xa5a4('0x3f')]+'%'};return _0x25639c;})});}_0x47344b=_['merge']({},_0x47344b,_0x461d2d[_0xa5a4('0x42')]);return _0x465d38[_0xa5a4('0x4c')](_0x47344b);}})['then'](function(_0x31dccb){if(_0x31dccb){_0x41a9b0=_0x31dccb[_0xa5a4('0x38')];if(!_0x461d2d['query']['hasOwnProperty']('nolimit')){_0x47344b[_0xa5a4('0x1f')]=qs[_0xa5a4('0x1f')](_0x461d2d[_0xa5a4('0x33')][_0xa5a4('0x1f')]);_0x47344b[_0xa5a4('0x1d')]=qs[_0xa5a4('0x1d')](_0x461d2d[_0xa5a4('0x33')][_0xa5a4('0x1d')]);}return _0x465d38['getSubjects'](_0x47344b);}})[_0xa5a4('0x26')](function(_0x3e4878){if(_0x3e4878){return _0x3e4878?{'count':_0x41a9b0,'rows':_0x3e4878}:null;}})['then'](respondWithResult(_0x1f49da,null))[_0xa5a4('0x46')](handleError(_0x1f49da,null));};exports[_0xa5a4('0x51')]=function(_0x391b14,_0x3ac5b9,_0x16d3de){var _0x116f15={};var _0x1683ce={};var _0x5e514b;var _0x2c982d;return db[_0xa5a4('0x2d')][_0xa5a4('0x4d')]({'where':{'id':_0x391b14['params']['id']}})[_0xa5a4('0x26')](handleEntityNotFound(_0x3ac5b9,null))['then'](function(_0x24cce8){if(_0x24cce8){_0x5e514b=_0x24cce8;_0x1683ce[_0xa5a4('0x31')]=_['keys'](db[_0xa5a4('0x4e')][_0xa5a4('0x4f')]);_0x1683ce[_0xa5a4('0x33')]=_[_0xa5a4('0x34')](_0x391b14[_0xa5a4('0x33')]);_0x1683ce['filters']=_[_0xa5a4('0x35')](_0x1683ce[_0xa5a4('0x31')],_0x1683ce[_0xa5a4('0x33')]);_0x116f15[_0xa5a4('0x37')]=_['intersection'](_0x1683ce[_0xa5a4('0x31')],qs[_0xa5a4('0x36')](_0x391b14[_0xa5a4('0x33')][_0xa5a4('0x36')]));_0x116f15['attributes']=_0x116f15[_0xa5a4('0x37')][_0xa5a4('0x38')]?_0x116f15[_0xa5a4('0x37')]:_0x1683ce[_0xa5a4('0x31')];_0x116f15[_0xa5a4('0x50')]=qs[_0xa5a4('0x3b')](_0x391b14[_0xa5a4('0x33')][_0xa5a4('0x3b')]);_0x116f15[_0xa5a4('0x3c')]=qs[_0xa5a4('0x3e')](_[_0xa5a4('0x3d')](_0x391b14[_0xa5a4('0x33')],_0x1683ce[_0xa5a4('0x3e')]));if(_0x391b14[_0xa5a4('0x33')][_0xa5a4('0x3f')]){_0x116f15[_0xa5a4('0x3c')]=_[_0xa5a4('0x40')](_0x116f15[_0xa5a4('0x3c')],{'$or':_[_0xa5a4('0x2c')](_0x116f15[_0xa5a4('0x37')],function(_0x488de1){var _0x1b298b={};_0x1b298b[_0x488de1]={'$like':'%'+_0x391b14[_0xa5a4('0x33')][_0xa5a4('0x3f')]+'%'};return _0x1b298b;})});}_0x116f15=_[_0xa5a4('0x40')]({},_0x116f15,_0x391b14[_0xa5a4('0x42')]);return _0x5e514b[_0xa5a4('0x51')](_0x116f15);}})[_0xa5a4('0x26')](function(_0x1a021f){if(_0x1a021f){_0x2c982d=_0x1a021f['length'];if(!_0x391b14['query'][_0xa5a4('0x39')](_0xa5a4('0x3a'))){_0x116f15[_0xa5a4('0x1f')]=qs[_0xa5a4('0x1f')](_0x391b14[_0xa5a4('0x33')][_0xa5a4('0x1f')]);_0x116f15[_0xa5a4('0x1d')]=qs[_0xa5a4('0x1d')](_0x391b14[_0xa5a4('0x33')][_0xa5a4('0x1d')]);}return _0x5e514b[_0xa5a4('0x51')](_0x116f15);}})[_0xa5a4('0x26')](function(_0x5bdb82){if(_0x5bdb82){return _0x5bdb82?{'count':_0x2c982d,'rows':_0x5bdb82}:null;}})[_0xa5a4('0x26')](respondWithResult(_0x3ac5b9,null))[_0xa5a4('0x46')](handleError(_0x3ac5b9,null));};exports['getFields']=function(_0x2d667d,_0xe9143,_0x1d5359){var _0x353af9={};var _0xeb2b2a={};var _0x3b1e08;var _0x53933b;return db[_0xa5a4('0x2d')]['findOne']({'where':{'id':_0x2d667d[_0xa5a4('0x48')]['id']}})['then'](handleEntityNotFound(_0xe9143,null))[_0xa5a4('0x26')](function(_0x4f7687){if(_0x4f7687){_0x3b1e08=_0x4f7687;_0xeb2b2a[_0xa5a4('0x31')]=_[_0xa5a4('0x34')](db['FreshsalesField']['rawAttributes']);_0xeb2b2a['query']=_[_0xa5a4('0x34')](_0x2d667d[_0xa5a4('0x33')]);_0xeb2b2a[_0xa5a4('0x3e')]=_[_0xa5a4('0x35')](_0xeb2b2a['model'],_0xeb2b2a[_0xa5a4('0x33')]);_0x353af9['attributes']=_['intersection'](_0xeb2b2a[_0xa5a4('0x31')],qs[_0xa5a4('0x36')](_0x2d667d[_0xa5a4('0x33')][_0xa5a4('0x36')]));_0x353af9[_0xa5a4('0x37')]=_0x353af9[_0xa5a4('0x37')][_0xa5a4('0x38')]?_0x353af9['attributes']:_0xeb2b2a['model'];_0x353af9[_0xa5a4('0x50')]=qs['sort'](_0x2d667d['query'][_0xa5a4('0x3b')]);_0x353af9['where']=qs[_0xa5a4('0x3e')](_[_0xa5a4('0x3d')](_0x2d667d[_0xa5a4('0x33')],_0xeb2b2a['filters']));if(_0x2d667d[_0xa5a4('0x33')][_0xa5a4('0x3f')]){_0x353af9['where']=_[_0xa5a4('0x40')](_0x353af9[_0xa5a4('0x3c')],{'$or':_['map'](_0x353af9[_0xa5a4('0x37')],function(_0x3563db){var _0x28adaf={};_0x28adaf[_0x3563db]={'$like':'%'+_0x2d667d[_0xa5a4('0x33')][_0xa5a4('0x3f')]+'%'};return _0x28adaf;})});}_0x353af9=_[_0xa5a4('0x40')]({},_0x353af9,_0x2d667d[_0xa5a4('0x42')]);return _0x3b1e08[_0xa5a4('0x52')](_0x353af9);}})['then'](function(_0x31d15b){if(_0x31d15b){_0x53933b=_0x31d15b['length'];if(!_0x2d667d[_0xa5a4('0x33')][_0xa5a4('0x39')](_0xa5a4('0x3a'))){_0x353af9[_0xa5a4('0x1f')]=qs[_0xa5a4('0x1f')](_0x2d667d[_0xa5a4('0x33')][_0xa5a4('0x1f')]);_0x353af9[_0xa5a4('0x1d')]=qs['offset'](_0x2d667d[_0xa5a4('0x33')][_0xa5a4('0x1d')]);}return _0x3b1e08[_0xa5a4('0x52')](_0x353af9);}})[_0xa5a4('0x26')](function(_0x441adb){if(_0x441adb){return _0x441adb?{'count':_0x53933b,'rows':_0x441adb}:null;}})[_0xa5a4('0x26')](respondWithResult(_0xe9143,null))[_0xa5a4('0x46')](handleError(_0xe9143,null));}; \ No newline at end of file +var _0xc77c=['intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','type','VIRTUAL','filter','merge','options','FreshsalesConfiguration','includeAll','include','findAll','catch','params','rawAttributes','find','create','body','destroy','getSubjects','FreshsalesField','nolimit','getDescriptions','findOne','pick','getFields','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','error','stack','name','map','model','keys','query'];(function(_0x18f70b,_0x4beec0){var _0x4e1641=function(_0x5d8431){while(--_0x5d8431){_0x18f70b['push'](_0x18f70b['shift']());}};_0x4e1641(++_0x4beec0);}(_0xc77c,0x197));var _0xcc77=function(_0x16f1e9,_0x38ab11){_0x16f1e9=_0x16f1e9-0x0;var _0x30880c=_0xc77c[_0x16f1e9];return _0x30880c;};'use strict';var emlformat=require(_0xcc77('0x0'));var rimraf=require(_0xcc77('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcc77('0x2'));var rp=require(_0xcc77('0x3'));var moment=require('moment');var BPromise=require(_0xcc77('0x4'));var Mustache=require(_0xcc77('0x5'));var util=require(_0xcc77('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xcc77('0x7'));var ejs=require(_0xcc77('0x8'));var fs=require('fs');var fs_extra=require(_0xcc77('0x9'));var _=require(_0xcc77('0xa'));var squel=require(_0xcc77('0xb'));var crypto=require('crypto');var jsforce=require(_0xcc77('0xc'));var deskjs=require(_0xcc77('0xd'));var toCsv=require(_0xcc77('0x7'));var querystring=require(_0xcc77('0xe'));var Papa=require(_0xcc77('0xf'));var Redis=require(_0xcc77('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcc77('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xcc77('0x12'));var utils=require('../../config/utils');var config=require(_0xcc77('0x13'));var licenseUtil=require(_0xcc77('0x14'));var db=require(_0xcc77('0x15'))['db'];function respondWithStatusCode(_0x57c9fd,_0x90d372){_0x90d372=_0x90d372||0xcc;return function(_0x370bba){if(_0x370bba){return _0x57c9fd[_0xcc77('0x16')](_0x90d372);}return _0x57c9fd[_0xcc77('0x17')](_0x90d372)[_0xcc77('0x18')]();};}function respondWithResult(_0x434477,_0x4a0ab2){_0x4a0ab2=_0x4a0ab2||0xc8;return function(_0x37ca85){if(_0x37ca85){return _0x434477['status'](_0x4a0ab2)[_0xcc77('0x19')](_0x37ca85);}};}function respondWithFilteredResult(_0x3f8d0b,_0x4abdec){return function(_0x32deae){if(_0x32deae){var _0x4dfdf6=typeof _0x4abdec[_0xcc77('0x1a')]===_0xcc77('0x1b')&&typeof _0x4abdec[_0xcc77('0x1c')]===_0xcc77('0x1b');var _0x52a35d=_0x32deae['count'];var _0x3d4ee7=_0x4dfdf6?0x0:_0x4abdec[_0xcc77('0x1a')];var _0x343107=_0x4dfdf6?_0x32deae[_0xcc77('0x1d')]:_0x4abdec[_0xcc77('0x1a')]+_0x4abdec['limit'];var _0x3e5a7a;if(_0x343107>=_0x52a35d){_0x343107=_0x52a35d;_0x3e5a7a=0xc8;}else{_0x3e5a7a=0xce;}_0x3f8d0b[_0xcc77('0x17')](_0x3e5a7a);return _0x3f8d0b[_0xcc77('0x1e')]('Content-Range',_0x3d4ee7+'-'+_0x343107+'/'+_0x52a35d)[_0xcc77('0x19')](_0x32deae);}return null;};}function patchUpdates(_0x48e03b){return function(_0x222966){try{jsonpatch[_0xcc77('0x1f')](_0x222966,_0x48e03b,!![]);}catch(_0x1be7c2){return BPromise[_0xcc77('0x20')](_0x1be7c2);}return _0x222966[_0xcc77('0x21')]();};}function saveUpdates(_0x1705a8,_0x2c6501){return function(_0x26bd85){if(_0x26bd85){return _0x26bd85[_0xcc77('0x22')](_0x1705a8)['then'](function(_0x5ae1c0){return _0x5ae1c0;});}return null;};}function removeEntity(_0x138766,_0x2d00aa){return function(_0x24b184){if(_0x24b184){return _0x24b184['destroy']()[_0xcc77('0x23')](function(){_0x138766[_0xcc77('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32ee27,_0xd2c683){return function(_0x3342ab){if(!_0x3342ab){_0x32ee27[_0xcc77('0x16')](0x194);}return _0x3342ab;};}function handleError(_0x57fe22,_0x36835a){_0x36835a=_0x36835a||0x1f4;return function(_0x51db42){logger[_0xcc77('0x24')](_0x51db42[_0xcc77('0x25')]);if(_0x51db42[_0xcc77('0x26')]){delete _0x51db42[_0xcc77('0x26')];}_0x57fe22[_0xcc77('0x17')](_0x36835a)['send'](_0x51db42);};}exports['index']=function(_0x55b462,_0x28944c){var _0x4a46a0={},_0x5320d9={},_0x1da245={'count':0x0,'rows':[]};var _0x19c57f=_[_0xcc77('0x27')](db['FreshsalesConfiguration']['rawAttributes'],function(_0x27a7ad){return{'name':_0x27a7ad['fieldName'],'type':_0x27a7ad['type']['key']};});_0x5320d9[_0xcc77('0x28')]=_[_0xcc77('0x27')](_0x19c57f,_0xcc77('0x26'));_0x5320d9['query']=_[_0xcc77('0x29')](_0x55b462[_0xcc77('0x2a')]);_0x5320d9['filters']=_[_0xcc77('0x2b')](_0x5320d9[_0xcc77('0x28')],_0x5320d9[_0xcc77('0x2a')]);_0x4a46a0[_0xcc77('0x2c')]=_['intersection'](_0x5320d9[_0xcc77('0x28')],qs[_0xcc77('0x2d')](_0x55b462['query'][_0xcc77('0x2d')]));_0x4a46a0[_0xcc77('0x2c')]=_0x4a46a0['attributes'][_0xcc77('0x2e')]?_0x4a46a0[_0xcc77('0x2c')]:_0x5320d9[_0xcc77('0x28')];if(!_0x55b462[_0xcc77('0x2a')][_0xcc77('0x2f')]('nolimit')){_0x4a46a0[_0xcc77('0x1c')]=qs['limit'](_0x55b462['query'][_0xcc77('0x1c')]);_0x4a46a0['offset']=qs[_0xcc77('0x1a')](_0x55b462[_0xcc77('0x2a')][_0xcc77('0x1a')]);}_0x4a46a0[_0xcc77('0x30')]=qs[_0xcc77('0x31')](_0x55b462[_0xcc77('0x2a')][_0xcc77('0x31')]);_0x4a46a0[_0xcc77('0x32')]=qs[_0xcc77('0x33')](_['pick'](_0x55b462[_0xcc77('0x2a')],_0x5320d9[_0xcc77('0x33')]),_0x19c57f);if(_0x55b462[_0xcc77('0x2a')]['filter']){_0x4a46a0['where']=_['merge'](_0x4a46a0[_0xcc77('0x32')],{'$or':_[_0xcc77('0x27')](_0x19c57f,function(_0x5e422a){if(_0x5e422a[_0xcc77('0x34')]!==_0xcc77('0x35')){var _0x5791b0={};_0x5791b0[_0x5e422a[_0xcc77('0x26')]]={'$like':'%'+_0x55b462[_0xcc77('0x2a')][_0xcc77('0x36')]+'%'};return _0x5791b0;}})});}_0x4a46a0=_[_0xcc77('0x37')]({},_0x4a46a0,_0x55b462[_0xcc77('0x38')]);var _0x322d81={'where':_0x4a46a0['where']};return db[_0xcc77('0x39')][_0xcc77('0x1d')](_0x322d81)[_0xcc77('0x23')](function(_0x18ae88){_0x1da245[_0xcc77('0x1d')]=_0x18ae88;if(_0x55b462['query'][_0xcc77('0x3a')]){_0x4a46a0[_0xcc77('0x3b')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0xcc77('0x3c')](_0x4a46a0);})[_0xcc77('0x23')](function(_0x602746){_0x1da245['rows']=_0x602746;return _0x1da245;})[_0xcc77('0x23')](respondWithFilteredResult(_0x28944c,_0x4a46a0))[_0xcc77('0x3d')](handleError(_0x28944c,null));};exports['show']=function(_0x5a8d8e,_0x3188c2){var _0x4ddf60={'raw':![],'where':{'id':_0x5a8d8e[_0xcc77('0x3e')]['id']}},_0x3d4072={};_0x3d4072[_0xcc77('0x28')]=_[_0xcc77('0x29')](db[_0xcc77('0x39')][_0xcc77('0x3f')]);_0x3d4072[_0xcc77('0x2a')]=_[_0xcc77('0x29')](_0x5a8d8e['query']);_0x3d4072[_0xcc77('0x33')]=_[_0xcc77('0x2b')](_0x3d4072['model'],_0x3d4072[_0xcc77('0x2a')]);_0x4ddf60[_0xcc77('0x2c')]=_[_0xcc77('0x2b')](_0x3d4072[_0xcc77('0x28')],qs[_0xcc77('0x2d')](_0x5a8d8e[_0xcc77('0x2a')][_0xcc77('0x2d')]));_0x4ddf60[_0xcc77('0x2c')]=_0x4ddf60[_0xcc77('0x2c')][_0xcc77('0x2e')]?_0x4ddf60[_0xcc77('0x2c')]:_0x3d4072[_0xcc77('0x28')];if(_0x5a8d8e[_0xcc77('0x2a')][_0xcc77('0x3a')]){_0x4ddf60[_0xcc77('0x3b')]=[{'all':!![]}];}_0x4ddf60=_[_0xcc77('0x37')]({},_0x4ddf60,_0x5a8d8e[_0xcc77('0x38')]);return db['FreshsalesConfiguration'][_0xcc77('0x40')](_0x4ddf60)[_0xcc77('0x23')](handleEntityNotFound(_0x3188c2,null))[_0xcc77('0x23')](respondWithResult(_0x3188c2,null))[_0xcc77('0x3d')](handleError(_0x3188c2,null));};exports[_0xcc77('0x41')]=function(_0x3de98e,_0x16943f){return db[_0xcc77('0x39')][_0xcc77('0x41')](_0x3de98e[_0xcc77('0x42')],{})[_0xcc77('0x23')](respondWithResult(_0x16943f,0xc9))[_0xcc77('0x3d')](handleError(_0x16943f,null));};exports[_0xcc77('0x22')]=function(_0xc76d66,_0x8e068){if(_0xc76d66[_0xcc77('0x42')]['id']){delete _0xc76d66[_0xcc77('0x42')]['id'];}return db[_0xcc77('0x39')][_0xcc77('0x40')]({'where':{'id':_0xc76d66[_0xcc77('0x3e')]['id']}})['then'](handleEntityNotFound(_0x8e068,null))[_0xcc77('0x23')](saveUpdates(_0xc76d66['body'],null))[_0xcc77('0x23')](respondWithResult(_0x8e068,null))['catch'](handleError(_0x8e068,null));};exports[_0xcc77('0x43')]=function(_0x4134b8,_0x90635c){return db['FreshsalesConfiguration'][_0xcc77('0x40')]({'where':{'id':_0x4134b8[_0xcc77('0x3e')]['id']}})[_0xcc77('0x23')](handleEntityNotFound(_0x90635c,null))[_0xcc77('0x23')](removeEntity(_0x90635c,null))[_0xcc77('0x3d')](handleError(_0x90635c,null));};exports[_0xcc77('0x44')]=function(_0x3396d8,_0x24d98d,_0x1b80be){var _0x2410c1={};var _0x4ba033={};var _0x50ddb1;var _0x332d51;return db[_0xcc77('0x39')]['findOne']({'where':{'id':_0x3396d8[_0xcc77('0x3e')]['id']}})[_0xcc77('0x23')](handleEntityNotFound(_0x24d98d,null))['then'](function(_0x121016){if(_0x121016){_0x50ddb1=_0x121016;_0x4ba033[_0xcc77('0x28')]=_[_0xcc77('0x29')](db[_0xcc77('0x45')][_0xcc77('0x3f')]);_0x4ba033[_0xcc77('0x2a')]=_[_0xcc77('0x29')](_0x3396d8[_0xcc77('0x2a')]);_0x4ba033[_0xcc77('0x33')]=_[_0xcc77('0x2b')](_0x4ba033['model'],_0x4ba033['query']);_0x2410c1[_0xcc77('0x2c')]=_[_0xcc77('0x2b')](_0x4ba033[_0xcc77('0x28')],qs[_0xcc77('0x2d')](_0x3396d8[_0xcc77('0x2a')]['fields']));_0x2410c1[_0xcc77('0x2c')]=_0x2410c1['attributes'][_0xcc77('0x2e')]?_0x2410c1[_0xcc77('0x2c')]:_0x4ba033[_0xcc77('0x28')];_0x2410c1[_0xcc77('0x30')]=qs[_0xcc77('0x31')](_0x3396d8[_0xcc77('0x2a')][_0xcc77('0x31')]);_0x2410c1[_0xcc77('0x32')]=qs[_0xcc77('0x33')](_['pick'](_0x3396d8['query'],_0x4ba033[_0xcc77('0x33')]));if(_0x3396d8['query'][_0xcc77('0x36')]){_0x2410c1[_0xcc77('0x32')]=_[_0xcc77('0x37')](_0x2410c1[_0xcc77('0x32')],{'$or':_['map'](_0x2410c1['attributes'],function(_0x6c433f){var _0x1ecb83={};_0x1ecb83[_0x6c433f]={'$like':'%'+_0x3396d8[_0xcc77('0x2a')]['filter']+'%'};return _0x1ecb83;})});}_0x2410c1=_[_0xcc77('0x37')]({},_0x2410c1,_0x3396d8[_0xcc77('0x38')]);return _0x50ddb1[_0xcc77('0x44')](_0x2410c1);}})['then'](function(_0x512cc5){if(_0x512cc5){_0x332d51=_0x512cc5['length'];if(!_0x3396d8[_0xcc77('0x2a')][_0xcc77('0x2f')](_0xcc77('0x46'))){_0x2410c1[_0xcc77('0x1c')]=qs[_0xcc77('0x1c')](_0x3396d8['query'][_0xcc77('0x1c')]);_0x2410c1[_0xcc77('0x1a')]=qs[_0xcc77('0x1a')](_0x3396d8[_0xcc77('0x2a')][_0xcc77('0x1a')]);}return _0x50ddb1[_0xcc77('0x44')](_0x2410c1);}})[_0xcc77('0x23')](function(_0x2618f9){if(_0x2618f9){return _0x2618f9?{'count':_0x332d51,'rows':_0x2618f9}:null;}})[_0xcc77('0x23')](respondWithResult(_0x24d98d,null))[_0xcc77('0x3d')](handleError(_0x24d98d,null));};exports[_0xcc77('0x47')]=function(_0x2cead0,_0x5d2982,_0xe4c9e7){var _0x204521={};var _0x560749={};var _0x4fc1a9;var _0x59016e;return db[_0xcc77('0x39')][_0xcc77('0x48')]({'where':{'id':_0x2cead0['params']['id']}})[_0xcc77('0x23')](handleEntityNotFound(_0x5d2982,null))[_0xcc77('0x23')](function(_0x383a59){if(_0x383a59){_0x4fc1a9=_0x383a59;_0x560749['model']=_[_0xcc77('0x29')](db[_0xcc77('0x45')][_0xcc77('0x3f')]);_0x560749[_0xcc77('0x2a')]=_[_0xcc77('0x29')](_0x2cead0[_0xcc77('0x2a')]);_0x560749['filters']=_['intersection'](_0x560749[_0xcc77('0x28')],_0x560749[_0xcc77('0x2a')]);_0x204521['attributes']=_[_0xcc77('0x2b')](_0x560749[_0xcc77('0x28')],qs['fields'](_0x2cead0['query'][_0xcc77('0x2d')]));_0x204521['attributes']=_0x204521[_0xcc77('0x2c')][_0xcc77('0x2e')]?_0x204521[_0xcc77('0x2c')]:_0x560749['model'];_0x204521[_0xcc77('0x30')]=qs[_0xcc77('0x31')](_0x2cead0[_0xcc77('0x2a')][_0xcc77('0x31')]);_0x204521[_0xcc77('0x32')]=qs[_0xcc77('0x33')](_[_0xcc77('0x49')](_0x2cead0[_0xcc77('0x2a')],_0x560749[_0xcc77('0x33')]));if(_0x2cead0[_0xcc77('0x2a')][_0xcc77('0x36')]){_0x204521['where']=_[_0xcc77('0x37')](_0x204521[_0xcc77('0x32')],{'$or':_[_0xcc77('0x27')](_0x204521[_0xcc77('0x2c')],function(_0x540ddf){var _0x2becfa={};_0x2becfa[_0x540ddf]={'$like':'%'+_0x2cead0['query'][_0xcc77('0x36')]+'%'};return _0x2becfa;})});}_0x204521=_['merge']({},_0x204521,_0x2cead0[_0xcc77('0x38')]);return _0x4fc1a9['getDescriptions'](_0x204521);}})[_0xcc77('0x23')](function(_0x34d8bb){if(_0x34d8bb){_0x59016e=_0x34d8bb['length'];if(!_0x2cead0[_0xcc77('0x2a')][_0xcc77('0x2f')](_0xcc77('0x46'))){_0x204521[_0xcc77('0x1c')]=qs[_0xcc77('0x1c')](_0x2cead0[_0xcc77('0x2a')]['limit']);_0x204521['offset']=qs[_0xcc77('0x1a')](_0x2cead0[_0xcc77('0x2a')][_0xcc77('0x1a')]);}return _0x4fc1a9['getDescriptions'](_0x204521);}})[_0xcc77('0x23')](function(_0x18d26b){if(_0x18d26b){return _0x18d26b?{'count':_0x59016e,'rows':_0x18d26b}:null;}})['then'](respondWithResult(_0x5d2982,null))[_0xcc77('0x3d')](handleError(_0x5d2982,null));};exports[_0xcc77('0x4a')]=function(_0x41c664,_0x3504ee,_0x4c5127){var _0x590eeb={};var _0x4d2b41={};var _0x1825b6;var _0x12eeff;return db[_0xcc77('0x39')][_0xcc77('0x48')]({'where':{'id':_0x41c664[_0xcc77('0x3e')]['id']}})[_0xcc77('0x23')](handleEntityNotFound(_0x3504ee,null))['then'](function(_0x3a6a0f){if(_0x3a6a0f){_0x1825b6=_0x3a6a0f;_0x4d2b41['model']=_[_0xcc77('0x29')](db['FreshsalesField'][_0xcc77('0x3f')]);_0x4d2b41[_0xcc77('0x2a')]=_['keys'](_0x41c664[_0xcc77('0x2a')]);_0x4d2b41[_0xcc77('0x33')]=_[_0xcc77('0x2b')](_0x4d2b41['model'],_0x4d2b41[_0xcc77('0x2a')]);_0x590eeb['attributes']=_['intersection'](_0x4d2b41[_0xcc77('0x28')],qs['fields'](_0x41c664['query'][_0xcc77('0x2d')]));_0x590eeb['attributes']=_0x590eeb[_0xcc77('0x2c')][_0xcc77('0x2e')]?_0x590eeb[_0xcc77('0x2c')]:_0x4d2b41[_0xcc77('0x28')];_0x590eeb[_0xcc77('0x30')]=qs[_0xcc77('0x31')](_0x41c664['query'][_0xcc77('0x31')]);_0x590eeb[_0xcc77('0x32')]=qs[_0xcc77('0x33')](_[_0xcc77('0x49')](_0x41c664[_0xcc77('0x2a')],_0x4d2b41[_0xcc77('0x33')]));if(_0x41c664[_0xcc77('0x2a')][_0xcc77('0x36')]){_0x590eeb[_0xcc77('0x32')]=_[_0xcc77('0x37')](_0x590eeb[_0xcc77('0x32')],{'$or':_[_0xcc77('0x27')](_0x590eeb['attributes'],function(_0x4df753){var _0x573805={};_0x573805[_0x4df753]={'$like':'%'+_0x41c664[_0xcc77('0x2a')][_0xcc77('0x36')]+'%'};return _0x573805;})});}_0x590eeb=_[_0xcc77('0x37')]({},_0x590eeb,_0x41c664[_0xcc77('0x38')]);return _0x1825b6[_0xcc77('0x4a')](_0x590eeb);}})[_0xcc77('0x23')](function(_0x464372){if(_0x464372){_0x12eeff=_0x464372[_0xcc77('0x2e')];if(!_0x41c664[_0xcc77('0x2a')]['hasOwnProperty']('nolimit')){_0x590eeb[_0xcc77('0x1c')]=qs[_0xcc77('0x1c')](_0x41c664['query']['limit']);_0x590eeb[_0xcc77('0x1a')]=qs[_0xcc77('0x1a')](_0x41c664[_0xcc77('0x2a')][_0xcc77('0x1a')]);}return _0x1825b6[_0xcc77('0x4a')](_0x590eeb);}})['then'](function(_0x4b42bc){if(_0x4b42bc){return _0x4b42bc?{'count':_0x12eeff,'rows':_0x4b42bc}:null;}})[_0xcc77('0x23')](respondWithResult(_0x3504ee,null))[_0xcc77('0x3d')](handleError(_0x3504ee,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 7144a34..ab458af 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 _0xb9de=['api','moment','bluebird','path','rimraf','./intFreshsalesConfiguration.attributes','exports','define','int_freshsales_configurations','lodash','util','../../config/logger'];(function(_0x275126,_0xc5ea93){var _0x5ca40f=function(_0x4c005c){while(--_0x4c005c){_0x275126['push'](_0x275126['shift']());}};_0x5ca40f(++_0xc5ea93);}(_0xb9de,0x11d));var _0xeb9d=function(_0x2aee64,_0x1a2e89){_0x2aee64=_0x2aee64-0x0;var _0x383ce6=_0xb9de[_0x2aee64];return _0x383ce6;};'use strict';var _=require(_0xeb9d('0x0'));var util=require(_0xeb9d('0x1'));var logger=require(_0xeb9d('0x2'))(_0xeb9d('0x3'));var moment=require(_0xeb9d('0x4'));var BPromise=require(_0xeb9d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xeb9d('0x6'));var rimraf=require(_0xeb9d('0x7'));var config=require('../../config/environment');var attributes=require(_0xeb9d('0x8'));module[_0xeb9d('0x9')]=function(_0x35a9b9,_0x8e0b3f){return _0x35a9b9[_0xeb9d('0xa')]('FreshsalesConfiguration',attributes,{'tableName':_0xeb9d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbe75=['../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports','define','FreshsalesConfiguration','util'];(function(_0x51758a,_0x37c2a5){var _0x193e61=function(_0x33ce01){while(--_0x33ce01){_0x51758a['push'](_0x51758a['shift']());}};_0x193e61(++_0x37c2a5);}(_0xbe75,0x8b));var _0x5be7=function(_0x37130a,_0x4df3a0){_0x37130a=_0x37130a-0x0;var _0x466769=_0xbe75[_0x37130a];return _0x466769;};'use strict';var _=require('lodash');var util=require(_0x5be7('0x0'));var logger=require(_0x5be7('0x1'))(_0x5be7('0x2'));var moment=require(_0x5be7('0x3'));var BPromise=require('bluebird');var rp=require(_0x5be7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5be7('0x5'));var config=require(_0x5be7('0x6'));var attributes=require('./intFreshsalesConfiguration.attributes');module[_0x5be7('0x7')]=function(_0x436ad6,_0x2b58a9){return _0x436ad6[_0x5be7('0x8')](_0x5be7('0x9'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 08584c6..76c901a 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 _0xdf66=['error','code','message','info','result','catch','lodash','util','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','FreshsalesConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify'];(function(_0x2874a5,_0x32b680){var _0x1e427a=function(_0x550897){while(--_0x550897){_0x2874a5['push'](_0x2874a5['shift']());}};_0x1e427a(++_0x32b680);}(_0xdf66,0x156));var _0x6df6=function(_0x3e6a06,_0x5ddcd6){_0x3e6a06=_0x3e6a06-0x0;var _0xcdc571=_0xdf66[_0x3e6a06];return _0xcdc571;};'use strict';var _=require(_0x6df6('0x0'));var util=require(_0x6df6('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6df6('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6df6('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6df6('0x4'))(_0x6df6('0x5'));var config=require(_0x6df6('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x6df6('0x7')][_0x6df6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1687c3,_0x66dbd1,_0x28c4e1){return new BPromise(function(_0x27a66e,_0x535f26){return client[_0x6df6('0x9')](_0x1687c3,_0x28c4e1)[_0x6df6('0xa')](function(_0x1f5237){logger['info'](_0x6df6('0xb'),_0x66dbd1,'request\x20sent');logger[_0x6df6('0xc')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x66dbd1,_0x6df6('0xd'),JSON[_0x6df6('0xe')](_0x1f5237));if(_0x1f5237[_0x6df6('0xf')]){if(_0x1f5237[_0x6df6('0xf')][_0x6df6('0x10')]===0x1f4){logger[_0x6df6('0xf')](_0x6df6('0xb'),_0x66dbd1,_0x1f5237[_0x6df6('0xf')][_0x6df6('0x11')]);return _0x535f26(_0x1f5237[_0x6df6('0xf')][_0x6df6('0x11')]);}logger[_0x6df6('0xf')](_0x6df6('0xb'),_0x66dbd1,_0x1f5237['error'][_0x6df6('0x11')]);return _0x27a66e(_0x1f5237[_0x6df6('0xf')][_0x6df6('0x11')]);}else{logger[_0x6df6('0x12')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x66dbd1,'request\x20sent');_0x27a66e(_0x1f5237[_0x6df6('0x13')][_0x6df6('0x11')]);}})[_0x6df6('0x14')](function(_0x65b255){logger[_0x6df6('0xf')](_0x6df6('0xb'),_0x66dbd1,_0x65b255);_0x535f26(_0x65b255);});});} \ No newline at end of file +var _0x2952=['../../config/utils','../../config/environment','jayson/promise','http','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','bluebird','../../mysqldb'];(function(_0x44ab4b,_0x59e2c0){var _0x46abde=function(_0x46cff1){while(--_0x46cff1){_0x44ab4b['push'](_0x44ab4b['shift']());}};_0x46abde(++_0x59e2c0);}(_0x2952,0x7a));var _0x2295=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x2952[_0x411017];return _0x2adeea;};'use strict';var _=require('lodash');var util=require(_0x2295('0x0'));var moment=require(_0x2295('0x1'));var BPromise=require(_0x2295('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2295('0x3'))['db'];var utils=require(_0x2295('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x2295('0x5'));var jayson=require(_0x2295('0x6'));var client=jayson['client'][_0x2295('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x23328b,_0x543b35,_0x1b4e0e){return new BPromise(function(_0x4b912b,_0x4b4306){return client['request'](_0x23328b,_0x1b4e0e)[_0x2295('0x8')](function(_0x13474a){logger[_0x2295('0x9')](_0x2295('0xa'),_0x543b35,_0x2295('0xb'));logger[_0x2295('0xc')](_0x2295('0xd'),_0x543b35,_0x2295('0xb'),JSON[_0x2295('0xe')](_0x13474a));if(_0x13474a[_0x2295('0xf')]){if(_0x13474a[_0x2295('0xf')]['code']===0x1f4){logger[_0x2295('0xf')](_0x2295('0xa'),_0x543b35,_0x13474a[_0x2295('0xf')][_0x2295('0x10')]);return _0x4b4306(_0x13474a[_0x2295('0xf')][_0x2295('0x10')]);}logger[_0x2295('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x543b35,_0x13474a['error']['message']);return _0x4b912b(_0x13474a[_0x2295('0xf')][_0x2295('0x10')]);}else{logger[_0x2295('0x9')](_0x2295('0xa'),_0x543b35,_0x2295('0xb'));_0x4b912b(_0x13474a['result']['message']);}})[_0x2295('0x11')](function(_0x3e3713){logger[_0x2295('0xf')](_0x2295('0xa'),_0x543b35,_0x3e3713);_0x4b4306(_0x3e3713);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 3d32b0c..31450b6 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 _0x18a9=['create','put','update','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','post'];(function(_0x1281e6,_0x27cbc2){var _0xdd1ca6=function(_0x3c3fd6){while(--_0x3c3fd6){_0x1281e6['push'](_0x1281e6['shift']());}};_0xdd1ca6(++_0x27cbc2);}(_0x18a9,0x15b));var _0x918a=function(_0x58613f,_0x24c9ae){_0x58613f=_0x58613f-0x0;var _0x2a0ac6=_0x18a9[_0x58613f];return _0x2a0ac6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x918a('0x0'));var timeout=require(_0x918a('0x1'));var express=require(_0x918a('0x2'));var router=express[_0x918a('0x3')]();var fs_extra=require(_0x918a('0x4'));var auth=require(_0x918a('0x5'));var interaction=require(_0x918a('0x6'));var config=require(_0x918a('0x7'));var controller=require(_0x918a('0x8'));router[_0x918a('0x9')]('/',auth[_0x918a('0xa')](),controller[_0x918a('0xb')]);router['get'](_0x918a('0xc'),auth[_0x918a('0xa')](),controller['show']);router[_0x918a('0xd')]('/',auth[_0x918a('0xa')](),controller[_0x918a('0xe')]);router[_0x918a('0xf')](_0x918a('0xc'),auth[_0x918a('0xa')](),controller[_0x918a('0x10')]);router['delete'](_0x918a('0xc'),auth[_0x918a('0xa')](),controller[_0x918a('0x11')]);module[_0x918a('0x12')]=router; \ No newline at end of file +var _0xfc65=['fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','post','create','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfc65,0x1b4));var _0x5fc6=function(_0x3974a9,_0x9b3ce1){_0x3974a9=_0x3974a9-0x0;var _0x3f8ced=_0xfc65[_0x3974a9];return _0x3f8ced;};'use strict';var multer=require(_0x5fc6('0x0'));var util=require(_0x5fc6('0x1'));var path=require(_0x5fc6('0x2'));var timeout=require(_0x5fc6('0x3'));var express=require(_0x5fc6('0x4'));var router=express[_0x5fc6('0x5')]();var fs_extra=require(_0x5fc6('0x6'));var auth=require(_0x5fc6('0x7'));var interaction=require(_0x5fc6('0x8'));var config=require('../../config/environment');var controller=require('./intFreshsalesField.controller');router[_0x5fc6('0x9')]('/',auth[_0x5fc6('0xa')](),controller[_0x5fc6('0xb')]);router[_0x5fc6('0x9')](_0x5fc6('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x5fc6('0xd')]('/',auth[_0x5fc6('0xa')](),controller[_0x5fc6('0xe')]);router['put'](_0x5fc6('0xc'),auth[_0x5fc6('0xa')](),controller['update']);router[_0x5fc6('0xf')](_0x5fc6('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x5fc6('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 5c701c1..7068591 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 _0xe3fc=['keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x38a9cb,_0xfd8b2b){var _0xfa7687=function(_0x8b1b6){while(--_0x8b1b6){_0x38a9cb['push'](_0x38a9cb['shift']());}};_0xfa7687(++_0xfd8b2b);}(_0xe3fc,0xc2));var _0xce3f=function(_0x46401e,_0x2a345b){_0x46401e=_0x46401e-0x0;var _0x447cba=_0xe3fc[_0x46401e];return _0x447cba;};'use strict';var Sequelize=require(_0xce3f('0x0'));module[_0xce3f('0x1')]={'type':{'type':Sequelize[_0xce3f('0x2')](_0xce3f('0x3'),_0xce3f('0x4'),_0xce3f('0x5'),_0xce3f('0x6'),_0xce3f('0x7')),'defaultValue':_0xce3f('0x3')},'content':{'type':Sequelize[_0xce3f('0x8')]},'key':{'type':Sequelize[_0xce3f('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0xce3f('0x3'),_0xce3f('0x4'),_0xce3f('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xce3f('0x8')]},'nameField':{'type':Sequelize[_0xce3f('0x8')]},'customField':{'type':Sequelize[_0xce3f('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xce3f('0x8')]}}; \ No newline at end of file +var _0x48d0=['STRING','BOOLEAN','sequelize','string','keyValue','picklist','variable'];(function(_0x449ba9,_0x5c875a){var _0xa55886=function(_0x16e2ca){while(--_0x16e2ca){_0x449ba9['push'](_0x449ba9['shift']());}};_0xa55886(++_0x5c875a);}(_0x48d0,0xf0));var _0x048d=function(_0x38f2bc,_0x83a4b6){_0x38f2bc=_0x38f2bc-0x0;var _0x2894d4=_0x48d0[_0x38f2bc];return _0x2894d4;};'use strict';var Sequelize=require(_0x048d('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x048d('0x1'),'variable','customVariable',_0x048d('0x2'),_0x048d('0x3')),'defaultValue':_0x048d('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x048d('0x1'),_0x048d('0x4'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x048d('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x048d('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x048d('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index d12a6f5..4ad65b8 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 _0x1789=['findAll','catch','show','params','includeAll','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','limit','count','offset','status','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','merge','VIRTUAL','options'];(function(_0x2eac4f,_0x5173f9){var _0x58f73b=function(_0x529f28){while(--_0x529f28){_0x2eac4f['push'](_0x2eac4f['shift']());}};_0x58f73b(++_0x5173f9);}(_0x1789,0x94));var _0x9178=function(_0x5a164c,_0x44d73a){_0x5a164c=_0x5a164c-0x0;var _0x17a713=_0x1789[_0x5a164c];return _0x17a713;};'use strict';var emlformat=require(_0x9178('0x0'));var rimraf=require(_0x9178('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9178('0x2'));var rp=require(_0x9178('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9178('0x4'));var path=require(_0x9178('0x5'));var sox=require(_0x9178('0x6'));var csv=require('to-csv');var ejs=require(_0x9178('0x7'));var fs=require('fs');var fs_extra=require(_0x9178('0x8'));var _=require(_0x9178('0x9'));var squel=require(_0x9178('0xa'));var crypto=require(_0x9178('0xb'));var jsforce=require(_0x9178('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9178('0xd'));var querystring=require(_0x9178('0xe'));var Papa=require(_0x9178('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9178('0x10'));var hardwareService=require(_0x9178('0x11'));var logger=require(_0x9178('0x12'))('api');var utils=require(_0x9178('0x13'));var config=require(_0x9178('0x14'));var licenseUtil=require(_0x9178('0x15'));var db=require(_0x9178('0x16'))['db'];function respondWithStatusCode(_0x2e3d84,_0x3d4476){_0x3d4476=_0x3d4476||0xcc;return function(_0x5350a2){if(_0x5350a2){return _0x2e3d84[_0x9178('0x17')](_0x3d4476);}return _0x2e3d84['status'](_0x3d4476)[_0x9178('0x18')]();};}function respondWithResult(_0x1489fe,_0x10ee95){_0x10ee95=_0x10ee95||0xc8;return function(_0x358a3a){if(_0x358a3a){return _0x1489fe['status'](_0x10ee95)[_0x9178('0x19')](_0x358a3a);}};}function respondWithFilteredResult(_0x4949a9,_0x370df5){return function(_0x1c294f){if(_0x1c294f){var _0x223c40=typeof _0x370df5['offset']===_0x9178('0x1a')&&typeof _0x370df5[_0x9178('0x1b')]===_0x9178('0x1a');var _0x5f2423=_0x1c294f[_0x9178('0x1c')];var _0x455c93=_0x223c40?0x0:_0x370df5['offset'];var _0x4659e5=_0x223c40?_0x1c294f['count']:_0x370df5[_0x9178('0x1d')]+_0x370df5[_0x9178('0x1b')];var _0x489d67;if(_0x4659e5>=_0x5f2423){_0x4659e5=_0x5f2423;_0x489d67=0xc8;}else{_0x489d67=0xce;}_0x4949a9[_0x9178('0x1e')](_0x489d67);return _0x4949a9[_0x9178('0x1f')](_0x9178('0x20'),_0x455c93+'-'+_0x4659e5+'/'+_0x5f2423)[_0x9178('0x19')](_0x1c294f);}return null;};}function patchUpdates(_0x3d1d0d){return function(_0x1e936e){try{jsonpatch[_0x9178('0x21')](_0x1e936e,_0x3d1d0d,!![]);}catch(_0xb2fbe7){return BPromise[_0x9178('0x22')](_0xb2fbe7);}return _0x1e936e[_0x9178('0x23')]();};}function saveUpdates(_0x534ff0,_0xea02d8){return function(_0x19226f){if(_0x19226f){return _0x19226f[_0x9178('0x24')](_0x534ff0)[_0x9178('0x25')](function(_0x2a4c81){return _0x2a4c81;});}return null;};}function removeEntity(_0x2f7baf,_0x3832a4){return function(_0x364d50){if(_0x364d50){return _0x364d50['destroy']()[_0x9178('0x25')](function(){_0x2f7baf[_0x9178('0x1e')](0xcc)[_0x9178('0x18')]();});}};}function handleEntityNotFound(_0x162483,_0x5765ea){return function(_0x429f04){if(!_0x429f04){_0x162483[_0x9178('0x17')](0x194);}return _0x429f04;};}function handleError(_0x5f0cb6,_0x404533){_0x404533=_0x404533||0x1f4;return function(_0x3d946a){logger['error'](_0x3d946a[_0x9178('0x26')]);if(_0x3d946a[_0x9178('0x27')]){delete _0x3d946a['name'];}_0x5f0cb6[_0x9178('0x1e')](_0x404533)[_0x9178('0x28')](_0x3d946a);};}exports[_0x9178('0x29')]=function(_0x54ea92,_0xaf2aff){var _0x57be7a={},_0x15b14a={},_0x4fca16={'count':0x0,'rows':[]};var _0x5432f4=_[_0x9178('0x2a')](db[_0x9178('0x2b')][_0x9178('0x2c')],function(_0x41c716){return{'name':_0x41c716[_0x9178('0x2d')],'type':_0x41c716[_0x9178('0x2e')]['key']};});_0x15b14a['model']=_[_0x9178('0x2a')](_0x5432f4,_0x9178('0x27'));_0x15b14a[_0x9178('0x2f')]=_[_0x9178('0x30')](_0x54ea92['query']);_0x15b14a[_0x9178('0x31')]=_[_0x9178('0x32')](_0x15b14a[_0x9178('0x33')],_0x15b14a[_0x9178('0x2f')]);_0x57be7a[_0x9178('0x34')]=_[_0x9178('0x32')](_0x15b14a[_0x9178('0x33')],qs[_0x9178('0x35')](_0x54ea92[_0x9178('0x2f')][_0x9178('0x35')]));_0x57be7a[_0x9178('0x34')]=_0x57be7a[_0x9178('0x34')][_0x9178('0x36')]?_0x57be7a[_0x9178('0x34')]:_0x15b14a[_0x9178('0x33')];if(!_0x54ea92[_0x9178('0x2f')]['hasOwnProperty'](_0x9178('0x37'))){_0x57be7a['limit']=qs[_0x9178('0x1b')](_0x54ea92[_0x9178('0x2f')][_0x9178('0x1b')]);_0x57be7a[_0x9178('0x1d')]=qs[_0x9178('0x1d')](_0x54ea92[_0x9178('0x2f')]['offset']);}_0x57be7a['order']=qs[_0x9178('0x38')](_0x54ea92[_0x9178('0x2f')][_0x9178('0x38')]);_0x57be7a[_0x9178('0x39')]=qs[_0x9178('0x31')](_[_0x9178('0x3a')](_0x54ea92[_0x9178('0x2f')],_0x15b14a[_0x9178('0x31')]),_0x5432f4);if(_0x54ea92['query']['filter']){_0x57be7a[_0x9178('0x39')]=_[_0x9178('0x3b')](_0x57be7a[_0x9178('0x39')],{'$or':_[_0x9178('0x2a')](_0x5432f4,function(_0x1b2bef){if(_0x1b2bef[_0x9178('0x2e')]!==_0x9178('0x3c')){var _0x1cc2d5={};_0x1cc2d5[_0x1b2bef[_0x9178('0x27')]]={'$like':'%'+_0x54ea92['query']['filter']+'%'};return _0x1cc2d5;}})});}_0x57be7a=_['merge']({},_0x57be7a,_0x54ea92[_0x9178('0x3d')]);var _0x4c4a27={'where':_0x57be7a[_0x9178('0x39')]};return db[_0x9178('0x2b')][_0x9178('0x1c')](_0x4c4a27)['then'](function(_0x474527){_0x4fca16[_0x9178('0x1c')]=_0x474527;if(_0x54ea92[_0x9178('0x2f')]['includeAll']){_0x57be7a['include']=[{'all':!![]}];}return db['FreshsalesField'][_0x9178('0x3e')](_0x57be7a);})['then'](function(_0x500af8){_0x4fca16['rows']=_0x500af8;return _0x4fca16;})[_0x9178('0x25')](respondWithFilteredResult(_0xaf2aff,_0x57be7a))[_0x9178('0x3f')](handleError(_0xaf2aff,null));};exports[_0x9178('0x40')]=function(_0x435697,_0x51c0df){var _0x594179={'raw':!![],'where':{'id':_0x435697[_0x9178('0x41')]['id']}},_0x40725e={};_0x40725e[_0x9178('0x33')]=_[_0x9178('0x30')](db[_0x9178('0x2b')]['rawAttributes']);_0x40725e[_0x9178('0x2f')]=_[_0x9178('0x30')](_0x435697[_0x9178('0x2f')]);_0x40725e[_0x9178('0x31')]=_[_0x9178('0x32')](_0x40725e[_0x9178('0x33')],_0x40725e[_0x9178('0x2f')]);_0x594179['attributes']=_[_0x9178('0x32')](_0x40725e[_0x9178('0x33')],qs['fields'](_0x435697[_0x9178('0x2f')][_0x9178('0x35')]));_0x594179[_0x9178('0x34')]=_0x594179[_0x9178('0x34')][_0x9178('0x36')]?_0x594179[_0x9178('0x34')]:_0x40725e[_0x9178('0x33')];if(_0x435697[_0x9178('0x2f')][_0x9178('0x42')]){_0x594179['include']=[{'all':!![]}];}_0x594179=_['merge']({},_0x594179,_0x435697[_0x9178('0x3d')]);return db[_0x9178('0x2b')][_0x9178('0x43')](_0x594179)[_0x9178('0x25')](handleEntityNotFound(_0x51c0df,null))['then'](respondWithResult(_0x51c0df,null))['catch'](handleError(_0x51c0df,null));};exports[_0x9178('0x44')]=function(_0x53467f,_0x46f9d9){return db[_0x9178('0x2b')][_0x9178('0x44')](_0x53467f[_0x9178('0x45')],{})[_0x9178('0x25')](respondWithResult(_0x46f9d9,0xc9))[_0x9178('0x3f')](handleError(_0x46f9d9,null));};exports[_0x9178('0x24')]=function(_0x36c3de,_0x591f59){if(_0x36c3de[_0x9178('0x45')]['id']){delete _0x36c3de[_0x9178('0x45')]['id'];}return db[_0x9178('0x2b')][_0x9178('0x43')]({'where':{'id':_0x36c3de[_0x9178('0x41')]['id']}})[_0x9178('0x25')](handleEntityNotFound(_0x591f59,null))[_0x9178('0x25')](saveUpdates(_0x36c3de[_0x9178('0x45')],null))['then'](respondWithResult(_0x591f59,null))[_0x9178('0x3f')](handleError(_0x591f59,null));};exports['destroy']=function(_0x5bf104,_0x98e356){return db[_0x9178('0x2b')]['find']({'where':{'id':_0x5bf104[_0x9178('0x41')]['id']}})['then'](handleEntityNotFound(_0x98e356,null))[_0x9178('0x25')](removeEntity(_0x98e356,null))[_0x9178('0x3f')](handleError(_0x98e356,null));}; \ No newline at end of file +var _0x6af7=['includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','name','send','index','map','FreshsalesField','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options'];(function(_0x1c67b3,_0x3fb1ca){var _0x54ecd2=function(_0x4fd560){while(--_0x4fd560){_0x1c67b3['push'](_0x1c67b3['shift']());}};_0x54ecd2(++_0x3fb1ca);}(_0x6af7,0xa5));var _0x76af=function(_0x251139,_0x3db092){_0x251139=_0x251139-0x0;var _0x2fe1f1=_0x6af7[_0x251139];return _0x2fe1f1;};'use strict';var emlformat=require(_0x76af('0x0'));var rimraf=require(_0x76af('0x1'));var zipdir=require(_0x76af('0x2'));var jsonpatch=require(_0x76af('0x3'));var rp=require(_0x76af('0x4'));var moment=require('moment');var BPromise=require(_0x76af('0x5'));var Mustache=require(_0x76af('0x6'));var util=require(_0x76af('0x7'));var path=require(_0x76af('0x8'));var sox=require(_0x76af('0x9'));var csv=require(_0x76af('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x76af('0xb'));var _=require(_0x76af('0xc'));var squel=require(_0x76af('0xd'));var crypto=require(_0x76af('0xe'));var jsforce=require(_0x76af('0xf'));var deskjs=require(_0x76af('0x10'));var toCsv=require(_0x76af('0xa'));var querystring=require(_0x76af('0x11'));var Papa=require(_0x76af('0x12'));var Redis=require(_0x76af('0x13'));var authService=require(_0x76af('0x14'));var qs=require(_0x76af('0x15'));var as=require(_0x76af('0x16'));var hardwareService=require(_0x76af('0x17'));var logger=require(_0x76af('0x18'))('api');var utils=require('../../config/utils');var config=require(_0x76af('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x539adc,_0x4c06ef){_0x4c06ef=_0x4c06ef||0xcc;return function(_0x49472f){if(_0x49472f){return _0x539adc[_0x76af('0x1a')](_0x4c06ef);}return _0x539adc[_0x76af('0x1b')](_0x4c06ef)[_0x76af('0x1c')]();};}function respondWithResult(_0xe195c5,_0xc1c6bc){_0xc1c6bc=_0xc1c6bc||0xc8;return function(_0x9e50ed){if(_0x9e50ed){return _0xe195c5[_0x76af('0x1b')](_0xc1c6bc)[_0x76af('0x1d')](_0x9e50ed);}};}function respondWithFilteredResult(_0x217d42,_0x242459){return function(_0x11ed2f){if(_0x11ed2f){var _0x2e01dc=typeof _0x242459[_0x76af('0x1e')]===_0x76af('0x1f')&&typeof _0x242459['limit']===_0x76af('0x1f');var _0x19bbb9=_0x11ed2f[_0x76af('0x20')];var _0x53f588=_0x2e01dc?0x0:_0x242459['offset'];var _0xefc1c3=_0x2e01dc?_0x11ed2f['count']:_0x242459[_0x76af('0x1e')]+_0x242459[_0x76af('0x21')];var _0x20368b;if(_0xefc1c3>=_0x19bbb9){_0xefc1c3=_0x19bbb9;_0x20368b=0xc8;}else{_0x20368b=0xce;}_0x217d42['status'](_0x20368b);return _0x217d42[_0x76af('0x22')](_0x76af('0x23'),_0x53f588+'-'+_0xefc1c3+'/'+_0x19bbb9)[_0x76af('0x1d')](_0x11ed2f);}return null;};}function patchUpdates(_0x1c122d){return function(_0x7dbcdf){try{jsonpatch[_0x76af('0x24')](_0x7dbcdf,_0x1c122d,!![]);}catch(_0x3d1f7e){return BPromise[_0x76af('0x25')](_0x3d1f7e);}return _0x7dbcdf[_0x76af('0x26')]();};}function saveUpdates(_0x20d8d9,_0x3581c3){return function(_0x25230a){if(_0x25230a){return _0x25230a['update'](_0x20d8d9)[_0x76af('0x27')](function(_0x19b170){return _0x19b170;});}return null;};}function removeEntity(_0x3226ba,_0x3f8a3c){return function(_0x1f91cd){if(_0x1f91cd){return _0x1f91cd[_0x76af('0x28')]()[_0x76af('0x27')](function(){_0x3226ba[_0x76af('0x1b')](0xcc)[_0x76af('0x1c')]();});}};}function handleEntityNotFound(_0xf86675,_0x4c2b43){return function(_0x4d1239){if(!_0x4d1239){_0xf86675['sendStatus'](0x194);}return _0x4d1239;};}function handleError(_0x19f6e9,_0x22fad9){_0x22fad9=_0x22fad9||0x1f4;return function(_0x3de196){logger['error'](_0x3de196['stack']);if(_0x3de196['name']){delete _0x3de196[_0x76af('0x29')];}_0x19f6e9[_0x76af('0x1b')](_0x22fad9)[_0x76af('0x2a')](_0x3de196);};}exports[_0x76af('0x2b')]=function(_0x18ca88,_0x33bb4d){var _0x3646d3={},_0x45d1f5={},_0x40ce94={'count':0x0,'rows':[]};var _0x1fec86=_[_0x76af('0x2c')](db[_0x76af('0x2d')]['rawAttributes'],function(_0x2c66fa){return{'name':_0x2c66fa['fieldName'],'type':_0x2c66fa[_0x76af('0x2e')]['key']};});_0x45d1f5[_0x76af('0x2f')]=_[_0x76af('0x2c')](_0x1fec86,_0x76af('0x29'));_0x45d1f5[_0x76af('0x30')]=_[_0x76af('0x31')](_0x18ca88[_0x76af('0x30')]);_0x45d1f5[_0x76af('0x32')]=_[_0x76af('0x33')](_0x45d1f5['model'],_0x45d1f5[_0x76af('0x30')]);_0x3646d3[_0x76af('0x34')]=_[_0x76af('0x33')](_0x45d1f5['model'],qs[_0x76af('0x35')](_0x18ca88[_0x76af('0x30')][_0x76af('0x35')]));_0x3646d3['attributes']=_0x3646d3[_0x76af('0x34')]['length']?_0x3646d3[_0x76af('0x34')]:_0x45d1f5['model'];if(!_0x18ca88[_0x76af('0x30')][_0x76af('0x36')]('nolimit')){_0x3646d3[_0x76af('0x21')]=qs[_0x76af('0x21')](_0x18ca88[_0x76af('0x30')]['limit']);_0x3646d3[_0x76af('0x1e')]=qs[_0x76af('0x1e')](_0x18ca88[_0x76af('0x30')][_0x76af('0x1e')]);}_0x3646d3[_0x76af('0x37')]=qs[_0x76af('0x38')](_0x18ca88[_0x76af('0x30')][_0x76af('0x38')]);_0x3646d3['where']=qs['filters'](_[_0x76af('0x39')](_0x18ca88['query'],_0x45d1f5[_0x76af('0x32')]),_0x1fec86);if(_0x18ca88[_0x76af('0x30')][_0x76af('0x3a')]){_0x3646d3[_0x76af('0x3b')]=_[_0x76af('0x3c')](_0x3646d3[_0x76af('0x3b')],{'$or':_[_0x76af('0x2c')](_0x1fec86,function(_0x361bd8){if(_0x361bd8['type']!==_0x76af('0x3d')){var _0x40b744={};_0x40b744[_0x361bd8[_0x76af('0x29')]]={'$like':'%'+_0x18ca88[_0x76af('0x30')][_0x76af('0x3a')]+'%'};return _0x40b744;}})});}_0x3646d3=_['merge']({},_0x3646d3,_0x18ca88[_0x76af('0x3e')]);var _0x7812f0={'where':_0x3646d3['where']};return db[_0x76af('0x2d')][_0x76af('0x20')](_0x7812f0)[_0x76af('0x27')](function(_0x2fb7ee){_0x40ce94[_0x76af('0x20')]=_0x2fb7ee;if(_0x18ca88[_0x76af('0x30')][_0x76af('0x3f')]){_0x3646d3[_0x76af('0x40')]=[{'all':!![]}];}return db['FreshsalesField'][_0x76af('0x41')](_0x3646d3);})[_0x76af('0x27')](function(_0x12e3dd){_0x40ce94[_0x76af('0x42')]=_0x12e3dd;return _0x40ce94;})[_0x76af('0x27')](respondWithFilteredResult(_0x33bb4d,_0x3646d3))[_0x76af('0x43')](handleError(_0x33bb4d,null));};exports[_0x76af('0x44')]=function(_0x14ccca,_0xbe7f2b){var _0x38a116={'raw':!![],'where':{'id':_0x14ccca[_0x76af('0x45')]['id']}},_0x48d7a9={};_0x48d7a9[_0x76af('0x2f')]=_[_0x76af('0x31')](db[_0x76af('0x2d')][_0x76af('0x46')]);_0x48d7a9[_0x76af('0x30')]=_['keys'](_0x14ccca[_0x76af('0x30')]);_0x48d7a9[_0x76af('0x32')]=_[_0x76af('0x33')](_0x48d7a9[_0x76af('0x2f')],_0x48d7a9[_0x76af('0x30')]);_0x38a116[_0x76af('0x34')]=_['intersection'](_0x48d7a9[_0x76af('0x2f')],qs['fields'](_0x14ccca[_0x76af('0x30')][_0x76af('0x35')]));_0x38a116['attributes']=_0x38a116[_0x76af('0x34')][_0x76af('0x47')]?_0x38a116['attributes']:_0x48d7a9['model'];if(_0x14ccca[_0x76af('0x30')][_0x76af('0x3f')]){_0x38a116[_0x76af('0x40')]=[{'all':!![]}];}_0x38a116=_[_0x76af('0x3c')]({},_0x38a116,_0x14ccca[_0x76af('0x3e')]);return db[_0x76af('0x2d')][_0x76af('0x48')](_0x38a116)[_0x76af('0x27')](handleEntityNotFound(_0xbe7f2b,null))[_0x76af('0x27')](respondWithResult(_0xbe7f2b,null))['catch'](handleError(_0xbe7f2b,null));};exports[_0x76af('0x49')]=function(_0x105d62,_0x5a14f3){return db[_0x76af('0x2d')][_0x76af('0x49')](_0x105d62[_0x76af('0x4a')],{})[_0x76af('0x27')](respondWithResult(_0x5a14f3,0xc9))[_0x76af('0x43')](handleError(_0x5a14f3,null));};exports[_0x76af('0x4b')]=function(_0x2f2f9f,_0x1289a0){if(_0x2f2f9f[_0x76af('0x4a')]['id']){delete _0x2f2f9f['body']['id'];}return db['FreshsalesField'][_0x76af('0x48')]({'where':{'id':_0x2f2f9f[_0x76af('0x45')]['id']}})[_0x76af('0x27')](handleEntityNotFound(_0x1289a0,null))[_0x76af('0x27')](saveUpdates(_0x2f2f9f['body'],null))[_0x76af('0x27')](respondWithResult(_0x1289a0,null))['catch'](handleError(_0x1289a0,null));};exports[_0x76af('0x28')]=function(_0x1e8108,_0x7d5814){return db[_0x76af('0x2d')][_0x76af('0x48')]({'where':{'id':_0x1e8108[_0x76af('0x45')]['id']}})[_0x76af('0x27')](handleEntityNotFound(_0x7d5814,null))[_0x76af('0x27')](removeEntity(_0x7d5814,null))['catch'](handleError(_0x7d5814,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index ffb6a0d..812d9f4 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 _0xaf60=['../../config/logger','bluebird','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','int_freshsales_fields','freshsales_unique_index','FieldId','lodash','util'];(function(_0x454165,_0x1f3e74){var _0x56db53=function(_0x23388c){while(--_0x23388c){_0x454165['push'](_0x454165['shift']());}};_0x56db53(++_0x1f3e74);}(_0xaf60,0x82));var _0x0af6=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xaf60[_0x12d033];return _0x3b4e80;};'use strict';var _=require(_0x0af6('0x0'));var util=require(_0x0af6('0x1'));var logger=require(_0x0af6('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0af6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0af6('0x4'));var config=require(_0x0af6('0x5'));var attributes=require(_0x0af6('0x6'));module[_0x0af6('0x7')]=function(_0x463023,_0x333ce1){return _0x463023[_0x0af6('0x8')]('FreshsalesField',attributes,{'tableName':_0x0af6('0x9'),'paranoid':![],'indexes':[{'name':_0x0af6('0xa'),'fields':['idField',_0x0af6('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5b6e=['request-promise','path','./intFreshsalesField.attributes','exports','FreshsalesField','int_freshsales_fields','freshsales_unique_index','FieldId','lodash','util','api','bluebird'];(function(_0x557fd2,_0x2c0a7a){var _0x1b54a2=function(_0x2e439b){while(--_0x2e439b){_0x557fd2['push'](_0x557fd2['shift']());}};_0x1b54a2(++_0x2c0a7a);}(_0x5b6e,0x14c));var _0xe5b6=function(_0xd0455d,_0x4b5333){_0xd0455d=_0xd0455d-0x0;var _0x4eeb63=_0x5b6e[_0xd0455d];return _0x4eeb63;};'use strict';var _=require(_0xe5b6('0x0'));var util=require(_0xe5b6('0x1'));var logger=require('../../config/logger')(_0xe5b6('0x2'));var moment=require('moment');var BPromise=require(_0xe5b6('0x3'));var rp=require(_0xe5b6('0x4'));var fs=require('fs');var path=require(_0xe5b6('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe5b6('0x6'));module[_0xe5b6('0x7')]=function(_0x2dea90,_0x2dea7d){return _0x2dea90['define'](_0xe5b6('0x8'),attributes,{'tableName':_0xe5b6('0x9'),'paranoid':![],'indexes':[{'name':_0xe5b6('0xa'),'fields':['idField',_0xe5b6('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 3abb913..3703d5b 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 _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0xddc8e4,_0x523936){var _0x57acb4=function(_0x8685c1){while(--_0x8685c1){_0xddc8e4['push'](_0xddc8e4['shift']());}};_0x57acb4(++_0x523936);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xc4aa[_0x4d613c];return _0x301fe3;};'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')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file +var _0x5fc3=['../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','stringify','error','code','message','FreshsalesField,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x1f08df,_0x40f60a){var _0x4b3015=function(_0x33e881){while(--_0x33e881){_0x1f08df['push'](_0x1f08df['shift']());}};_0x4b3015(++_0x40f60a);}(_0x5fc3,0xa8));var _0x35fc=function(_0x37c07d,_0xdbdb5f){_0x37c07d=_0x37c07d-0x0;var _0x10dadc=_0x5fc3[_0x37c07d];return _0x10dadc;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('FreshsalesField,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('FreshsalesField,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 597e554..0d2a3f4 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(_0x1ced61,_0x2d315b){var _0x460cff=function(_0x3ae9b5){while(--_0x3ae9b5){_0x1ced61['push'](_0x1ced61['shift']());}};_0x460cff(++_0x2d315b);}(_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 +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x252802,_0x1782b7){var _0xed07a7=function(_0x2bfc82){while(--_0x2bfc82){_0x252802['push'](_0x252802['shift']());}};_0xed07a7(++_0x1782b7);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 6094162..b41cb67 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 _0xa848=['exports','STRING','username','ENUM','integrationTab','newTab','sequelize'];(function(_0x1ddf36,_0x2563b){var _0x330f85=function(_0xbeddd1){while(--_0xbeddd1){_0x1ddf36['push'](_0x1ddf36['shift']());}};_0x330f85(++_0x2563b);}(_0xa848,0x99));var _0x8a84=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa848[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x8a84('0x0'));module[_0x8a84('0x1')]={'name':{'type':Sequelize[_0x8a84('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x8a84('0x2')],'unique':_0x8a84('0x3')},'remoteUri':{'type':Sequelize[_0x8a84('0x2')]},'password':{'type':Sequelize[_0x8a84('0x2')]},'clientId':{'type':Sequelize[_0x8a84('0x2')]},'clientSecret':{'type':Sequelize[_0x8a84('0x2')]},'securityToken':{'type':Sequelize[_0x8a84('0x2')]},'serverUrl':{'type':Sequelize[_0x8a84('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x8a84('0x4')](_0x8a84('0x5'),_0x8a84('0x6')),'defaultValue':_0x8a84('0x5')}}; \ No newline at end of file +var _0x58cc=['ENUM','integrationTab','sequelize','exports','STRING','username'];(function(_0x4dfd72,_0x576541){var _0x3dc386=function(_0x1c40ba){while(--_0x1c40ba){_0x4dfd72['push'](_0x4dfd72['shift']());}};_0x3dc386(++_0x576541);}(_0x58cc,0x7a));var _0xc58c=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0x58cc[_0x43d11d];return _0x38cd08;};'use strict';var Sequelize=require(_0xc58c('0x0'));module[_0xc58c('0x1')]={'name':{'type':Sequelize[_0xc58c('0x2')]},'description':{'type':Sequelize[_0xc58c('0x2')]},'username':{'type':Sequelize[_0xc58c('0x2')],'unique':_0xc58c('0x3')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xc58c('0x2')]},'clientId':{'type':Sequelize[_0xc58c('0x2')]},'clientSecret':{'type':Sequelize[_0xc58c('0x2')]},'securityToken':{'type':Sequelize[_0xc58c('0x2')]},'serverUrl':{'type':Sequelize[_0xc58c('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xc58c('0x4')]('integrationTab','newTab'),'defaultValue':_0xc58c('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 426dc26..45e5452 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 _0x1f93=['fs-extra','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','end','status','json','limit','offset','set','apply','reject','update','then','destroy','stack','name','send','index','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes','length','nolimit','order','sort','where','filter','map','VIRTUAL','merge','options','SalesforceAccount','count','include','findAll','catch','show','params','intersection','includeAll','create','body','find','SalesforceConfiguration','pick','hasOwnProperty','getConfigurations','addConfiguration','findOne','Subjects','getSubjects','channel','Descriptions','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring','lastIndexOf','login','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','picklist','boolean','email','textarea','phone','includes','label','value','True','true','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','test','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x1c6ef2,_0x8d926a){var _0x404b8c=function(_0x4fdf1e){while(--_0x4fdf1e){_0x1c6ef2['push'](_0x1c6ef2['shift']());}};_0x404b8c(++_0x8d926a);}(_0x1f93,0x158));var _0x31f9=function(_0x57170e,_0x1725f5){_0x57170e=_0x57170e-0x0;var _0x19cbb4=_0x1f93[_0x57170e];return _0x19cbb4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x31f9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x31f9('0x1'));var rp=require(_0x31f9('0x2'));var moment=require('moment');var BPromise=require(_0x31f9('0x3'));var Mustache=require(_0x31f9('0x4'));var util=require(_0x31f9('0x5'));var path=require(_0x31f9('0x6'));var sox=require(_0x31f9('0x7'));var csv=require(_0x31f9('0x8'));var ejs=require(_0x31f9('0x9'));var fs=require('fs');var fs_extra=require(_0x31f9('0xa'));var _=require('lodash');var squel=require(_0x31f9('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x31f9('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x31f9('0xd'));var Redis=require(_0x31f9('0xe'));var authService=require(_0x31f9('0xf'));var qs=require(_0x31f9('0x10'));var as=require(_0x31f9('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x31f9('0x12'));var utils=require(_0x31f9('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x31f9('0x14'));var db=require('../../mysqldb')['db'];var integrations=require(_0x31f9('0x15'));function respondWithStatusCode(_0xb84fe5,_0x19e0ea){_0x19e0ea=_0x19e0ea||0xcc;return function(_0x48f317){if(_0x48f317){return _0xb84fe5[_0x31f9('0x16')](_0x19e0ea);}return _0xb84fe5['status'](_0x19e0ea)[_0x31f9('0x17')]();};}function respondWithResult(_0x430843,_0x436662){_0x436662=_0x436662||0xc8;return function(_0x19fb40){if(_0x19fb40){return _0x430843[_0x31f9('0x18')](_0x436662)[_0x31f9('0x19')](_0x19fb40);}};}function respondWithFilteredResult(_0x979aa0,_0x18af39){return function(_0x4a5697){if(_0x4a5697){var _0x3904d7=typeof _0x18af39['offset']==='undefined'&&typeof _0x18af39[_0x31f9('0x1a')]==='undefined';var _0x1d42a9=_0x4a5697['count'];var _0x2b8ae9=_0x3904d7?0x0:_0x18af39['offset'];var _0x1882c5=_0x3904d7?_0x4a5697['count']:_0x18af39[_0x31f9('0x1b')]+_0x18af39['limit'];var _0x23620e;if(_0x1882c5>=_0x1d42a9){_0x1882c5=_0x1d42a9;_0x23620e=0xc8;}else{_0x23620e=0xce;}_0x979aa0[_0x31f9('0x18')](_0x23620e);return _0x979aa0[_0x31f9('0x1c')]('Content-Range',_0x2b8ae9+'-'+_0x1882c5+'/'+_0x1d42a9)[_0x31f9('0x19')](_0x4a5697);}return null;};}function patchUpdates(_0xa3ae07){return function(_0x58334a){try{jsonpatch[_0x31f9('0x1d')](_0x58334a,_0xa3ae07,!![]);}catch(_0x20e076){return BPromise[_0x31f9('0x1e')](_0x20e076);}return _0x58334a['save']();};}function saveUpdates(_0x5d5e5c,_0x5cc2f1){return function(_0x2122a4){if(_0x2122a4){return _0x2122a4[_0x31f9('0x1f')](_0x5d5e5c)[_0x31f9('0x20')](function(_0x44bf0e){return _0x44bf0e;});}return null;};}function removeEntity(_0x4319d3,_0x5d0e06){return function(_0x36bd5d){if(_0x36bd5d){return _0x36bd5d[_0x31f9('0x21')]()['then'](function(){_0x4319d3[_0x31f9('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x899bca,_0x3357ad){return function(_0x35b299){if(!_0x35b299){_0x899bca[_0x31f9('0x16')](0x194);}return _0x35b299;};}function handleError(_0x503b62,_0x49f373){_0x49f373=_0x49f373||0x1f4;return function(_0x8b268c){logger['error'](_0x8b268c[_0x31f9('0x22')]);if(_0x8b268c[_0x31f9('0x23')]){delete _0x8b268c['name'];}_0x503b62['status'](_0x49f373)[_0x31f9('0x24')](_0x8b268c);};}exports[_0x31f9('0x25')]=function(_0x57e84b,_0x2ed3d7){var _0x497153={},_0x329c5d={},_0x2d8f04={'count':0x0,'rows':[]};var _0x1d8bc7=_['map'](db['SalesforceAccount'][_0x31f9('0x26')],function(_0x5a3781){return{'name':_0x5a3781[_0x31f9('0x27')],'type':_0x5a3781[_0x31f9('0x28')][_0x31f9('0x29')]};});_0x329c5d[_0x31f9('0x2a')]=_['map'](_0x1d8bc7,_0x31f9('0x23'));_0x329c5d[_0x31f9('0x2b')]=_[_0x31f9('0x2c')](_0x57e84b[_0x31f9('0x2b')]);_0x329c5d[_0x31f9('0x2d')]=_['intersection'](_0x329c5d[_0x31f9('0x2a')],_0x329c5d['query']);_0x497153['attributes']=_['intersection'](_0x329c5d['model'],qs[_0x31f9('0x2e')](_0x57e84b[_0x31f9('0x2b')][_0x31f9('0x2e')]));_0x497153[_0x31f9('0x2f')]=_0x497153['attributes'][_0x31f9('0x30')]?_0x497153[_0x31f9('0x2f')]:_0x329c5d[_0x31f9('0x2a')];if(!_0x57e84b[_0x31f9('0x2b')]['hasOwnProperty'](_0x31f9('0x31'))){_0x497153[_0x31f9('0x1a')]=qs[_0x31f9('0x1a')](_0x57e84b[_0x31f9('0x2b')]['limit']);_0x497153['offset']=qs[_0x31f9('0x1b')](_0x57e84b[_0x31f9('0x2b')]['offset']);}_0x497153[_0x31f9('0x32')]=qs['sort'](_0x57e84b['query'][_0x31f9('0x33')]);_0x497153[_0x31f9('0x34')]=qs[_0x31f9('0x2d')](_['pick'](_0x57e84b[_0x31f9('0x2b')],_0x329c5d[_0x31f9('0x2d')]),_0x1d8bc7);if(_0x57e84b['query'][_0x31f9('0x35')]){_0x497153[_0x31f9('0x34')]=_['merge'](_0x497153[_0x31f9('0x34')],{'$or':_[_0x31f9('0x36')](_0x1d8bc7,function(_0x1f74e3){if(_0x1f74e3[_0x31f9('0x28')]!==_0x31f9('0x37')){var _0x46407a={};_0x46407a[_0x1f74e3[_0x31f9('0x23')]]={'$like':'%'+_0x57e84b[_0x31f9('0x2b')][_0x31f9('0x35')]+'%'};return _0x46407a;}})});}_0x497153=_[_0x31f9('0x38')]({},_0x497153,_0x57e84b[_0x31f9('0x39')]);var _0x1730c5={'where':_0x497153[_0x31f9('0x34')]};return db[_0x31f9('0x3a')]['count'](_0x1730c5)[_0x31f9('0x20')](function(_0x3c395f){_0x2d8f04[_0x31f9('0x3b')]=_0x3c395f;if(_0x57e84b[_0x31f9('0x2b')]['includeAll']){_0x497153[_0x31f9('0x3c')]=[{'all':!![]}];}return db[_0x31f9('0x3a')][_0x31f9('0x3d')](_0x497153);})['then'](function(_0x180ab7){_0x2d8f04['rows']=_0x180ab7;return _0x2d8f04;})[_0x31f9('0x20')](respondWithFilteredResult(_0x2ed3d7,_0x497153))[_0x31f9('0x3e')](handleError(_0x2ed3d7,null));};exports[_0x31f9('0x3f')]=function(_0x4718eb,_0x2afa2a){var _0x1b0947={'raw':![],'where':{'id':_0x4718eb[_0x31f9('0x40')]['id']}},_0x116697={};_0x116697[_0x31f9('0x2a')]=_[_0x31f9('0x2c')](db[_0x31f9('0x3a')][_0x31f9('0x26')]);_0x116697[_0x31f9('0x2b')]=_[_0x31f9('0x2c')](_0x4718eb[_0x31f9('0x2b')]);_0x116697['filters']=_[_0x31f9('0x41')](_0x116697[_0x31f9('0x2a')],_0x116697[_0x31f9('0x2b')]);_0x1b0947[_0x31f9('0x2f')]=_['intersection'](_0x116697[_0x31f9('0x2a')],qs['fields'](_0x4718eb[_0x31f9('0x2b')][_0x31f9('0x2e')]));_0x1b0947[_0x31f9('0x2f')]=_0x1b0947[_0x31f9('0x2f')]['length']?_0x1b0947[_0x31f9('0x2f')]:_0x116697[_0x31f9('0x2a')];if(_0x4718eb['query'][_0x31f9('0x42')]){_0x1b0947[_0x31f9('0x3c')]=[{'all':!![]}];}_0x1b0947=_[_0x31f9('0x38')]({},_0x1b0947,_0x4718eb[_0x31f9('0x39')]);return db[_0x31f9('0x3a')]['find'](_0x1b0947)[_0x31f9('0x20')](handleEntityNotFound(_0x2afa2a,null))['then'](respondWithResult(_0x2afa2a,null))[_0x31f9('0x3e')](handleError(_0x2afa2a,null));};exports['create']=function(_0x5cb458,_0x822939){return db['SalesforceAccount'][_0x31f9('0x43')](_0x5cb458[_0x31f9('0x44')],{})[_0x31f9('0x20')](respondWithResult(_0x822939,0xc9))['catch'](handleError(_0x822939,null));};exports['update']=function(_0x26e179,_0x4b499e){if(_0x26e179[_0x31f9('0x44')]['id']){delete _0x26e179['body']['id'];}return db[_0x31f9('0x3a')]['find']({'where':{'id':_0x26e179[_0x31f9('0x40')]['id']}})[_0x31f9('0x20')](handleEntityNotFound(_0x4b499e,null))[_0x31f9('0x20')](saveUpdates(_0x26e179[_0x31f9('0x44')],null))['then'](respondWithResult(_0x4b499e,null))[_0x31f9('0x3e')](handleError(_0x4b499e,null));};exports[_0x31f9('0x21')]=function(_0x24da61,_0x32e330){return db[_0x31f9('0x3a')][_0x31f9('0x45')]({'where':{'id':_0x24da61[_0x31f9('0x40')]['id']}})[_0x31f9('0x20')](handleEntityNotFound(_0x32e330,null))[_0x31f9('0x20')](removeEntity(_0x32e330,null))[_0x31f9('0x3e')](handleError(_0x32e330,null));};exports['getConfigurations']=function(_0x5de7e5,_0x4a35b4,_0x5ea001){var _0x460534={};var _0x40f056={};var _0x34d446;var _0xff8c52;return db[_0x31f9('0x3a')]['findOne']({'where':{'id':_0x5de7e5[_0x31f9('0x40')]['id']}})[_0x31f9('0x20')](handleEntityNotFound(_0x4a35b4,null))[_0x31f9('0x20')](function(_0x44822c){if(_0x44822c){_0x34d446=_0x44822c;_0x40f056[_0x31f9('0x2a')]=_[_0x31f9('0x2c')](db[_0x31f9('0x46')][_0x31f9('0x26')]);_0x40f056[_0x31f9('0x2b')]=_[_0x31f9('0x2c')](_0x5de7e5[_0x31f9('0x2b')]);_0x40f056[_0x31f9('0x2d')]=_[_0x31f9('0x41')](_0x40f056[_0x31f9('0x2a')],_0x40f056[_0x31f9('0x2b')]);_0x460534['attributes']=_[_0x31f9('0x41')](_0x40f056[_0x31f9('0x2a')],qs[_0x31f9('0x2e')](_0x5de7e5['query'][_0x31f9('0x2e')]));_0x460534['attributes']=_0x460534['attributes'][_0x31f9('0x30')]?_0x460534['attributes']:_0x40f056[_0x31f9('0x2a')];_0x460534[_0x31f9('0x32')]=qs['sort'](_0x5de7e5['query'][_0x31f9('0x33')]);_0x460534['where']=qs[_0x31f9('0x2d')](_[_0x31f9('0x47')](_0x5de7e5[_0x31f9('0x2b')],_0x40f056[_0x31f9('0x2d')]));if(_0x5de7e5[_0x31f9('0x2b')][_0x31f9('0x35')]){_0x460534[_0x31f9('0x34')]=_['merge'](_0x460534[_0x31f9('0x34')],{'$or':_[_0x31f9('0x36')](_0x460534[_0x31f9('0x2f')],function(_0x3d38f2){var _0x5eed9d={};_0x5eed9d[_0x3d38f2]={'$like':'%'+_0x5de7e5[_0x31f9('0x2b')][_0x31f9('0x35')]+'%'};return _0x5eed9d;})});}_0x460534=_[_0x31f9('0x38')]({},_0x460534,_0x5de7e5[_0x31f9('0x39')]);return _0x34d446['getConfigurations'](_0x460534);}})[_0x31f9('0x20')](function(_0x102150){if(_0x102150){_0xff8c52=_0x102150['length'];if(!_0x5de7e5['query'][_0x31f9('0x48')]('nolimit')){_0x460534[_0x31f9('0x1a')]=qs[_0x31f9('0x1a')](_0x5de7e5['query'][_0x31f9('0x1a')]);_0x460534[_0x31f9('0x1b')]=qs['offset'](_0x5de7e5[_0x31f9('0x2b')][_0x31f9('0x1b')]);}return _0x34d446[_0x31f9('0x49')](_0x460534);}})[_0x31f9('0x20')](function(_0x5ae4bf){if(_0x5ae4bf){return _0x5ae4bf?{'count':_0xff8c52,'rows':_0x5ae4bf}:null;}})[_0x31f9('0x20')](respondWithResult(_0x4a35b4,null))[_0x31f9('0x3e')](handleError(_0x4a35b4,null));};exports[_0x31f9('0x4a')]=function(_0xda7b58,_0x375839,_0x26221c){if(_0xda7b58[_0x31f9('0x44')]['id']){delete _0xda7b58[_0x31f9('0x44')]['id'];}return db[_0x31f9('0x3a')][_0x31f9('0x4b')]({'where':{'id':_0xda7b58[_0x31f9('0x40')]['id']}})[_0x31f9('0x20')](handleEntityNotFound(_0x375839,null))[_0x31f9('0x20')](function(_0x299766){if(_0x299766){_0xda7b58[_0x31f9('0x44')]['AccountId']=_0x299766['id'];_0xda7b58[_0x31f9('0x44')][_0x31f9('0x4c')]=integrations[_0x31f9('0x4d')](_0xda7b58[_0x31f9('0x44')][_0x31f9('0x4e')],_0xda7b58[_0x31f9('0x44')][_0x31f9('0x28')]);_0xda7b58[_0x31f9('0x44')][_0x31f9('0x4f')]=integrations['getDescriptions'](_0xda7b58[_0x31f9('0x44')][_0x31f9('0x4e')],_0xda7b58['body'][_0x31f9('0x28')]);return db['SalesforceConfiguration'][_0x31f9('0x43')](_0xda7b58[_0x31f9('0x44')],{'include':[{'model':db['SalesforceField'],'as':_0x31f9('0x4c')},{'model':db[_0x31f9('0x50')],'as':_0x31f9('0x4f')}]});}return null;})[_0x31f9('0x20')](respondWithResult(_0x375839,null))[_0x31f9('0x3e')](handleError(_0x375839,null));};exports[_0x31f9('0x51')]=function(_0x2cacf2,_0x96ef58,_0x30f473){var _0x58352f;var _0x4c9285='';var _0x2d3220=_0x31f9('0x52');return db[_0x31f9('0x3a')]['findOne']({'where':{'id':_0x2cacf2[_0x31f9('0x40')]['id']},'attributes':['id',_0x31f9('0x53'),_0x31f9('0x54'),_0x31f9('0x55'),_0x31f9('0x56'),_0x31f9('0x57'),_0x31f9('0x58')]})[_0x31f9('0x20')](handleEntityNotFound(_0x96ef58,null))[_0x31f9('0x20')](function(_0x3bdcca){if(_0x3bdcca){_0x4c9285=_0x3bdcca[_0x31f9('0x53')];var _0x5c35ac=_0x4c9285[_0x31f9('0x59')](-0x1);if(_0x5c35ac==='/'){_0x4c9285=_0x4c9285[_0x31f9('0x5a')](0x0,_0x4c9285[_0x31f9('0x5b')](_0x5c35ac));}_0x58352f=new jsforce['Connection']({'oauth2':{'loginUrl':_0x4c9285,'clientId':_0x3bdcca[_0x31f9('0x54')],'clientSecret':_0x3bdcca[_0x31f9('0x55')]}});return _0x58352f[_0x31f9('0x5c')](_0x3bdcca[_0x31f9('0x56')],_0x3bdcca[_0x31f9('0x57')]['concat'](_0x3bdcca[_0x31f9('0x58')]));}})[_0x31f9('0x20')](function(_0x27cd7){if(_0x27cd7){if(!_['isNil'](_0x2cacf2[_0x31f9('0x2b')][_0x31f9('0x5d')])){_0x2d3220=_0x2cacf2[_0x31f9('0x2b')]['ticketType'];}return _0x58352f[_0x31f9('0x5e')](_0x2d3220)[_0x31f9('0x5f')]();}})['then'](function(_0x2236be){var _0x15862f=[_0x31f9('0x60'),_0x31f9('0x61'),_0x31f9('0x62'),_0x31f9('0x63'),_0x31f9('0x64'),_0x31f9('0x65')];var _0x403985=[_0x31f9('0x66'),'int',_0x31f9('0x67'),_0x31f9('0x68'),_0x31f9('0x69'),_0x31f9('0x6a'),_0x31f9('0x6b')];if(_0x2236be){_['remove'](_0x2236be['fields'],function(_0x58f37f){return _0x15862f[_0x31f9('0x6c')](_0x58f37f[_0x31f9('0x23')])||!_0x403985['includes'](_0x58f37f['type']);});return{'count':_0x2236be[_0x31f9('0x2e')][_0x31f9('0x30')],'rows':_[_0x31f9('0x36')](_0x2236be[_0x31f9('0x2e')],function(_0xfd860c){return{'id':_0xfd860c['name'],'name':_0xfd860c[_0x31f9('0x6d')],'custom':_0xfd860c['custom'],'options':_0xfd860c['picklistValues'][_0x31f9('0x30')]>0x0?_[_0x31f9('0x36')](_0xfd860c['picklistValues'],function(_0x14f78d){return{'name':_0x14f78d[_0x31f9('0x6d')],'value':_0x14f78d[_0x31f9('0x6e')]};}):_0xfd860c[_0x31f9('0x28')]==_0x31f9('0x68')?[{'name':_0x31f9('0x6f'),'value':_0x31f9('0x70')},{'name':'False','value':'false'}]:[]};})};}})[_0x31f9('0x20')](respondWithResult(_0x96ef58,null))[_0x31f9('0x3e')](function(_0x5956fa){var _0x2fcf4e=_0x2cacf2[_0x31f9('0x2b')]['test']?0x1f4:_0x5956fa[_0x31f9('0x71')]||0x1f4;logger[_0x31f9('0x72')](_0x31f9('0x73'),_0x31f9('0x51'),_0x2fcf4e,JSON[_0x31f9('0x74')](_0x5956fa));delete _0x5956fa[_0x31f9('0x23')];if(_0x2fcf4e===0x191){_0x2fcf4e=0x190;}_0x96ef58[_0x31f9('0x18')](_0x2fcf4e)[_0x31f9('0x24')](_0x2cacf2[_0x31f9('0x2b')][_0x31f9('0x75')]?{'message':'Wrong\x20credentials','statusCode':_0x5956fa[_0x31f9('0x71')]}:_0x5956fa);});}; \ No newline at end of file +var _0xb743=['sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','VIRTUAL','filter','merge','where','count','includeAll','include','SalesforceAccount','findAll','catch','show','find','create','body','params','order','sort','pick','getConfigurations','findOne','AccountId','getSubjects','channel','Descriptions','getDescriptions','SalesforceConfiguration','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','username','password','securityToken','Connection','login','concat','isNil','ticketType','describe','OwnerId','ActivityDate','IsReminderSet','Subject','Description','int','picklist','boolean','email','textarea','phone','includes','label','picklistValues','value','True','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x1ebeea,_0x2f54f4){var _0x576465=function(_0x47fc77){while(--_0x47fc77){_0x1ebeea['push'](_0x1ebeea['shift']());}};_0x576465(++_0x2f54f4);}(_0xb743,0x72));var _0x3b74=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xb743[_0x4a53d];return _0x27410e;};'use strict';var emlformat=require(_0x3b74('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3b74('0x1'));var jsonpatch=require(_0x3b74('0x2'));var rp=require('request-promise');var moment=require(_0x3b74('0x3'));var BPromise=require(_0x3b74('0x4'));var Mustache=require(_0x3b74('0x5'));var util=require('util');var path=require('path');var sox=require(_0x3b74('0x6'));var csv=require(_0x3b74('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3b74('0x8'));var _=require('lodash');var squel=require(_0x3b74('0x9'));var crypto=require('crypto');var jsforce=require(_0x3b74('0xa'));var deskjs=require(_0x3b74('0xb'));var toCsv=require(_0x3b74('0x7'));var querystring=require(_0x3b74('0xc'));var Papa=require(_0x3b74('0xd'));var Redis=require(_0x3b74('0xe'));var authService=require(_0x3b74('0xf'));var qs=require(_0x3b74('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3b74('0x11'));var logger=require(_0x3b74('0x12'))(_0x3b74('0x13'));var utils=require(_0x3b74('0x14'));var config=require(_0x3b74('0x15'));var licenseUtil=require(_0x3b74('0x16'));var db=require(_0x3b74('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x16c3c4,_0x5c335d){_0x5c335d=_0x5c335d||0xcc;return function(_0x3c5529){if(_0x3c5529){return _0x16c3c4[_0x3b74('0x18')](_0x5c335d);}return _0x16c3c4[_0x3b74('0x19')](_0x5c335d)['end']();};}function respondWithResult(_0x5b5e81,_0x14cc9d){_0x14cc9d=_0x14cc9d||0xc8;return function(_0x74b1c9){if(_0x74b1c9){return _0x5b5e81[_0x3b74('0x19')](_0x14cc9d)[_0x3b74('0x1a')](_0x74b1c9);}};}function respondWithFilteredResult(_0x4a476f,_0x359089){return function(_0x4b3ca2){if(_0x4b3ca2){var _0xfd2ab5=typeof _0x359089['offset']===_0x3b74('0x1b')&&typeof _0x359089[_0x3b74('0x1c')]===_0x3b74('0x1b');var _0x4b8e72=_0x4b3ca2['count'];var _0x70ee39=_0xfd2ab5?0x0:_0x359089[_0x3b74('0x1d')];var _0x5b2378=_0xfd2ab5?_0x4b3ca2['count']:_0x359089[_0x3b74('0x1d')]+_0x359089[_0x3b74('0x1c')];var _0x5273ab;if(_0x5b2378>=_0x4b8e72){_0x5b2378=_0x4b8e72;_0x5273ab=0xc8;}else{_0x5273ab=0xce;}_0x4a476f['status'](_0x5273ab);return _0x4a476f[_0x3b74('0x1e')](_0x3b74('0x1f'),_0x70ee39+'-'+_0x5b2378+'/'+_0x4b8e72)[_0x3b74('0x1a')](_0x4b3ca2);}return null;};}function patchUpdates(_0x6e99f8){return function(_0xf207f7){try{jsonpatch[_0x3b74('0x20')](_0xf207f7,_0x6e99f8,!![]);}catch(_0x4f9f8e){return BPromise[_0x3b74('0x21')](_0x4f9f8e);}return _0xf207f7[_0x3b74('0x22')]();};}function saveUpdates(_0xf091c6,_0x194567){return function(_0xc5c0e1){if(_0xc5c0e1){return _0xc5c0e1[_0x3b74('0x23')](_0xf091c6)['then'](function(_0x315453){return _0x315453;});}return null;};}function removeEntity(_0x260932,_0x5df3f3){return function(_0x28295f){if(_0x28295f){return _0x28295f[_0x3b74('0x24')]()[_0x3b74('0x25')](function(){_0x260932['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x238f27,_0x3a6a8c){return function(_0xa0e22){if(!_0xa0e22){_0x238f27[_0x3b74('0x18')](0x194);}return _0xa0e22;};}function handleError(_0x69d71b,_0x327fac){_0x327fac=_0x327fac||0x1f4;return function(_0x3ab3f2){logger[_0x3b74('0x26')](_0x3ab3f2[_0x3b74('0x27')]);if(_0x3ab3f2[_0x3b74('0x28')]){delete _0x3ab3f2[_0x3b74('0x28')];}_0x69d71b[_0x3b74('0x19')](_0x327fac)[_0x3b74('0x29')](_0x3ab3f2);};}exports[_0x3b74('0x2a')]=function(_0x1d0277,_0x158021){var _0x1c7289={},_0x12b9bb={},_0x4aeb4c={'count':0x0,'rows':[]};var _0x1c5056=_[_0x3b74('0x2b')](db['SalesforceAccount'][_0x3b74('0x2c')],function(_0x8271f8){return{'name':_0x8271f8[_0x3b74('0x2d')],'type':_0x8271f8[_0x3b74('0x2e')][_0x3b74('0x2f')]};});_0x12b9bb['model']=_[_0x3b74('0x2b')](_0x1c5056,'name');_0x12b9bb[_0x3b74('0x30')]=_[_0x3b74('0x31')](_0x1d0277['query']);_0x12b9bb[_0x3b74('0x32')]=_[_0x3b74('0x33')](_0x12b9bb[_0x3b74('0x34')],_0x12b9bb['query']);_0x1c7289[_0x3b74('0x35')]=_[_0x3b74('0x33')](_0x12b9bb[_0x3b74('0x34')],qs['fields'](_0x1d0277[_0x3b74('0x30')][_0x3b74('0x36')]));_0x1c7289[_0x3b74('0x35')]=_0x1c7289[_0x3b74('0x35')][_0x3b74('0x37')]?_0x1c7289[_0x3b74('0x35')]:_0x12b9bb['model'];if(!_0x1d0277['query']['hasOwnProperty'](_0x3b74('0x38'))){_0x1c7289['limit']=qs[_0x3b74('0x1c')](_0x1d0277[_0x3b74('0x30')][_0x3b74('0x1c')]);_0x1c7289['offset']=qs[_0x3b74('0x1d')](_0x1d0277['query']['offset']);}_0x1c7289['order']=qs['sort'](_0x1d0277[_0x3b74('0x30')]['sort']);_0x1c7289['where']=qs[_0x3b74('0x32')](_['pick'](_0x1d0277[_0x3b74('0x30')],_0x12b9bb[_0x3b74('0x32')]),_0x1c5056);if(_0x1d0277['query']['filter']){_0x1c7289['where']=_['merge'](_0x1c7289['where'],{'$or':_[_0x3b74('0x2b')](_0x1c5056,function(_0x9bd783){if(_0x9bd783[_0x3b74('0x2e')]!==_0x3b74('0x39')){var _0x1d57c3={};_0x1d57c3[_0x9bd783[_0x3b74('0x28')]]={'$like':'%'+_0x1d0277[_0x3b74('0x30')][_0x3b74('0x3a')]+'%'};return _0x1d57c3;}})});}_0x1c7289=_[_0x3b74('0x3b')]({},_0x1c7289,_0x1d0277['options']);var _0x108c59={'where':_0x1c7289[_0x3b74('0x3c')]};return db['SalesforceAccount'][_0x3b74('0x3d')](_0x108c59)['then'](function(_0x155f00){_0x4aeb4c[_0x3b74('0x3d')]=_0x155f00;if(_0x1d0277[_0x3b74('0x30')][_0x3b74('0x3e')]){_0x1c7289[_0x3b74('0x3f')]=[{'all':!![]}];}return db[_0x3b74('0x40')][_0x3b74('0x41')](_0x1c7289);})[_0x3b74('0x25')](function(_0x69b0cc){_0x4aeb4c['rows']=_0x69b0cc;return _0x4aeb4c;})[_0x3b74('0x25')](respondWithFilteredResult(_0x158021,_0x1c7289))[_0x3b74('0x42')](handleError(_0x158021,null));};exports[_0x3b74('0x43')]=function(_0x217b2a,_0x1bb7ae){var _0x5d7aa7={'raw':![],'where':{'id':_0x217b2a['params']['id']}},_0x5e4b5d={};_0x5e4b5d['model']=_[_0x3b74('0x31')](db[_0x3b74('0x40')][_0x3b74('0x2c')]);_0x5e4b5d[_0x3b74('0x30')]=_['keys'](_0x217b2a[_0x3b74('0x30')]);_0x5e4b5d['filters']=_[_0x3b74('0x33')](_0x5e4b5d[_0x3b74('0x34')],_0x5e4b5d[_0x3b74('0x30')]);_0x5d7aa7['attributes']=_[_0x3b74('0x33')](_0x5e4b5d[_0x3b74('0x34')],qs[_0x3b74('0x36')](_0x217b2a['query'][_0x3b74('0x36')]));_0x5d7aa7[_0x3b74('0x35')]=_0x5d7aa7[_0x3b74('0x35')][_0x3b74('0x37')]?_0x5d7aa7[_0x3b74('0x35')]:_0x5e4b5d[_0x3b74('0x34')];if(_0x217b2a[_0x3b74('0x30')][_0x3b74('0x3e')]){_0x5d7aa7[_0x3b74('0x3f')]=[{'all':!![]}];}_0x5d7aa7=_['merge']({},_0x5d7aa7,_0x217b2a['options']);return db[_0x3b74('0x40')][_0x3b74('0x44')](_0x5d7aa7)['then'](handleEntityNotFound(_0x1bb7ae,null))[_0x3b74('0x25')](respondWithResult(_0x1bb7ae,null))['catch'](handleError(_0x1bb7ae,null));};exports[_0x3b74('0x45')]=function(_0x2dd33f,_0x376582){return db[_0x3b74('0x40')][_0x3b74('0x45')](_0x2dd33f[_0x3b74('0x46')],{})[_0x3b74('0x25')](respondWithResult(_0x376582,0xc9))[_0x3b74('0x42')](handleError(_0x376582,null));};exports[_0x3b74('0x23')]=function(_0x44a5dc,_0x276cd4){if(_0x44a5dc[_0x3b74('0x46')]['id']){delete _0x44a5dc[_0x3b74('0x46')]['id'];}return db[_0x3b74('0x40')][_0x3b74('0x44')]({'where':{'id':_0x44a5dc['params']['id']}})[_0x3b74('0x25')](handleEntityNotFound(_0x276cd4,null))[_0x3b74('0x25')](saveUpdates(_0x44a5dc[_0x3b74('0x46')],null))['then'](respondWithResult(_0x276cd4,null))[_0x3b74('0x42')](handleError(_0x276cd4,null));};exports[_0x3b74('0x24')]=function(_0x36f002,_0x3077ff){return db[_0x3b74('0x40')][_0x3b74('0x44')]({'where':{'id':_0x36f002[_0x3b74('0x47')]['id']}})[_0x3b74('0x25')](handleEntityNotFound(_0x3077ff,null))[_0x3b74('0x25')](removeEntity(_0x3077ff,null))[_0x3b74('0x42')](handleError(_0x3077ff,null));};exports['getConfigurations']=function(_0x265061,_0x33ba76,_0x44e313){var _0x255f24={};var _0x417307={};var _0x4e565a;var _0x36cfce;return db[_0x3b74('0x40')]['findOne']({'where':{'id':_0x265061['params']['id']}})[_0x3b74('0x25')](handleEntityNotFound(_0x33ba76,null))[_0x3b74('0x25')](function(_0x24ab6f){if(_0x24ab6f){_0x4e565a=_0x24ab6f;_0x417307[_0x3b74('0x34')]=_[_0x3b74('0x31')](db['SalesforceConfiguration']['rawAttributes']);_0x417307[_0x3b74('0x30')]=_[_0x3b74('0x31')](_0x265061[_0x3b74('0x30')]);_0x417307['filters']=_[_0x3b74('0x33')](_0x417307[_0x3b74('0x34')],_0x417307['query']);_0x255f24['attributes']=_[_0x3b74('0x33')](_0x417307[_0x3b74('0x34')],qs[_0x3b74('0x36')](_0x265061[_0x3b74('0x30')][_0x3b74('0x36')]));_0x255f24[_0x3b74('0x35')]=_0x255f24[_0x3b74('0x35')][_0x3b74('0x37')]?_0x255f24['attributes']:_0x417307[_0x3b74('0x34')];_0x255f24[_0x3b74('0x48')]=qs[_0x3b74('0x49')](_0x265061['query'][_0x3b74('0x49')]);_0x255f24['where']=qs[_0x3b74('0x32')](_[_0x3b74('0x4a')](_0x265061[_0x3b74('0x30')],_0x417307[_0x3b74('0x32')]));if(_0x265061[_0x3b74('0x30')][_0x3b74('0x3a')]){_0x255f24[_0x3b74('0x3c')]=_['merge'](_0x255f24[_0x3b74('0x3c')],{'$or':_[_0x3b74('0x2b')](_0x255f24[_0x3b74('0x35')],function(_0x1d679c){var _0x5460ce={};_0x5460ce[_0x1d679c]={'$like':'%'+_0x265061['query'][_0x3b74('0x3a')]+'%'};return _0x5460ce;})});}_0x255f24=_[_0x3b74('0x3b')]({},_0x255f24,_0x265061['options']);return _0x4e565a[_0x3b74('0x4b')](_0x255f24);}})['then'](function(_0x3b89fd){if(_0x3b89fd){_0x36cfce=_0x3b89fd['length'];if(!_0x265061[_0x3b74('0x30')]['hasOwnProperty'](_0x3b74('0x38'))){_0x255f24[_0x3b74('0x1c')]=qs[_0x3b74('0x1c')](_0x265061['query'][_0x3b74('0x1c')]);_0x255f24[_0x3b74('0x1d')]=qs[_0x3b74('0x1d')](_0x265061[_0x3b74('0x30')][_0x3b74('0x1d')]);}return _0x4e565a[_0x3b74('0x4b')](_0x255f24);}})[_0x3b74('0x25')](function(_0x15fce3){if(_0x15fce3){return _0x15fce3?{'count':_0x36cfce,'rows':_0x15fce3}:null;}})['then'](respondWithResult(_0x33ba76,null))[_0x3b74('0x42')](handleError(_0x33ba76,null));};exports['addConfiguration']=function(_0x380d0c,_0x2d35ee,_0x1be5de){if(_0x380d0c[_0x3b74('0x46')]['id']){delete _0x380d0c[_0x3b74('0x46')]['id'];}return db[_0x3b74('0x40')][_0x3b74('0x4c')]({'where':{'id':_0x380d0c[_0x3b74('0x47')]['id']}})[_0x3b74('0x25')](handleEntityNotFound(_0x2d35ee,null))['then'](function(_0x2c673b){if(_0x2c673b){_0x380d0c['body'][_0x3b74('0x4d')]=_0x2c673b['id'];_0x380d0c[_0x3b74('0x46')]['Subjects']=integrations[_0x3b74('0x4e')](_0x380d0c['body'][_0x3b74('0x4f')],_0x380d0c[_0x3b74('0x46')][_0x3b74('0x2e')]);_0x380d0c[_0x3b74('0x46')][_0x3b74('0x50')]=integrations[_0x3b74('0x51')](_0x380d0c[_0x3b74('0x46')][_0x3b74('0x4f')],_0x380d0c['body'][_0x3b74('0x2e')]);return db[_0x3b74('0x52')]['create'](_0x380d0c[_0x3b74('0x46')],{'include':[{'model':db[_0x3b74('0x53')],'as':'Subjects'},{'model':db[_0x3b74('0x53')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x2d35ee,null))[_0x3b74('0x42')](handleError(_0x2d35ee,null));};exports[_0x3b74('0x54')]=function(_0x24b1f3,_0x178952,_0x5920c3){var _0x3fefb0;var _0x90955b='';var _0x3f0bc2=_0x3b74('0x55');return db[_0x3b74('0x40')][_0x3b74('0x4c')]({'where':{'id':_0x24b1f3['params']['id']},'attributes':['id',_0x3b74('0x56'),_0x3b74('0x57'),_0x3b74('0x58'),_0x3b74('0x59'),_0x3b74('0x5a'),_0x3b74('0x5b')]})[_0x3b74('0x25')](handleEntityNotFound(_0x178952,null))[_0x3b74('0x25')](function(_0x2b8262){if(_0x2b8262){_0x90955b=_0x2b8262[_0x3b74('0x56')];var _0xeafa40=_0x90955b['slice'](-0x1);if(_0xeafa40==='/'){_0x90955b=_0x90955b['substring'](0x0,_0x90955b['lastIndexOf'](_0xeafa40));}_0x3fefb0=new jsforce[(_0x3b74('0x5c'))]({'oauth2':{'loginUrl':_0x90955b,'clientId':_0x2b8262['clientId'],'clientSecret':_0x2b8262[_0x3b74('0x58')]}});return _0x3fefb0[_0x3b74('0x5d')](_0x2b8262[_0x3b74('0x59')],_0x2b8262[_0x3b74('0x5a')][_0x3b74('0x5e')](_0x2b8262[_0x3b74('0x5b')]));}})[_0x3b74('0x25')](function(_0x643907){if(_0x643907){if(!_[_0x3b74('0x5f')](_0x24b1f3[_0x3b74('0x30')][_0x3b74('0x60')])){_0x3f0bc2=_0x24b1f3[_0x3b74('0x30')][_0x3b74('0x60')];}return _0x3fefb0['sobject'](_0x3f0bc2)[_0x3b74('0x61')]();}})[_0x3b74('0x25')](function(_0x4ec7df){var _0x108936=[_0x3b74('0x62'),_0x3b74('0x63'),_0x3b74('0x64'),'IsRecurrence',_0x3b74('0x65'),_0x3b74('0x66')];var _0x3b7cd9=['string',_0x3b74('0x67'),_0x3b74('0x68'),_0x3b74('0x69'),_0x3b74('0x6a'),_0x3b74('0x6b'),_0x3b74('0x6c')];if(_0x4ec7df){_['remove'](_0x4ec7df[_0x3b74('0x36')],function(_0xc20257){return _0x108936[_0x3b74('0x6d')](_0xc20257[_0x3b74('0x28')])||!_0x3b7cd9['includes'](_0xc20257[_0x3b74('0x2e')]);});return{'count':_0x4ec7df[_0x3b74('0x36')]['length'],'rows':_[_0x3b74('0x2b')](_0x4ec7df[_0x3b74('0x36')],function(_0x236aea){return{'id':_0x236aea['name'],'name':_0x236aea[_0x3b74('0x6e')],'custom':_0x236aea['custom'],'options':_0x236aea['picklistValues'][_0x3b74('0x37')]>0x0?_['map'](_0x236aea[_0x3b74('0x6f')],function(_0x370d49){return{'name':_0x370d49[_0x3b74('0x6e')],'value':_0x370d49[_0x3b74('0x70')]};}):_0x236aea[_0x3b74('0x2e')]==_0x3b74('0x69')?[{'name':_0x3b74('0x71'),'value':'true'},{'name':_0x3b74('0x72'),'value':_0x3b74('0x73')}]:[]};})};}})[_0x3b74('0x25')](respondWithResult(_0x178952,null))[_0x3b74('0x42')](function(_0xa26ea7){var _0x5d2b2d=_0x24b1f3['query'][_0x3b74('0x74')]?0x1f4:_0xa26ea7[_0x3b74('0x75')]||0x1f4;logger['error'](_0x3b74('0x76'),'getFields',_0x5d2b2d,JSON[_0x3b74('0x77')](_0xa26ea7));delete _0xa26ea7[_0x3b74('0x28')];if(_0x5d2b2d===0x191){_0x5d2b2d=0x190;}_0x178952[_0x3b74('0x19')](_0x5d2b2d)['send'](_0x24b1f3[_0x3b74('0x30')][_0x3b74('0x74')]?{'message':'Wrong\x20credentials','statusCode':_0xa26ea7[_0x3b74('0x75')]}:_0xa26ea7);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 086db2e..4eff1f5 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 _0xb88f=['path','rimraf','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x4a468e,_0x4ca999){var _0x128c98=function(_0x4ba5af){while(--_0x4ba5af){_0x4a468e['push'](_0x4a468e['shift']());}};_0x128c98(++_0x4ca999);}(_0xb88f,0x18d));var _0xfb88=function(_0x147497,_0x43e433){_0x147497=_0x147497-0x0;var _0x35f45=_0xb88f[_0x147497];return _0x35f45;};'use strict';var _=require(_0xfb88('0x0'));var util=require(_0xfb88('0x1'));var logger=require(_0xfb88('0x2'))('api');var moment=require(_0xfb88('0x3'));var BPromise=require(_0xfb88('0x4'));var rp=require(_0xfb88('0x5'));var fs=require('fs');var path=require(_0xfb88('0x6'));var rimraf=require(_0xfb88('0x7'));var config=require('../../config/environment');var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0xfb88('0x8'));module[_0xfb88('0x9')]=function(_0x5eb782,_0x28d7ea){return _0x5eb782[_0xfb88('0xa')](_0xfb88('0xb'),attributes,{'tableName':_0xfb88('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd810=['exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util','api','moment','path','../../config/environment','../../components/integrations/configuration'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xd810,0x1dd));var _0x0d81=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0xd810[_0x1abb09];return _0xea1c07;};'use strict';var _=require(_0x0d81('0x0'));var util=require(_0x0d81('0x1'));var logger=require('../../config/logger')(_0x0d81('0x2'));var moment=require(_0x0d81('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0d81('0x4'));var rimraf=require('rimraf');var config=require(_0x0d81('0x5'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0x0d81('0x6'));module[_0x0d81('0x7')]=function(_0xa8b39f,_0x53697e){return _0xa8b39f[_0x0d81('0x8')](_0x0d81('0x9'),attributes,{'tableName':_0x0d81('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 1127d86..9c37e5e 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 _0xf8a8=['catch','ShowSalesforceAccount','find','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info','debug','request\x20sent','stringify','error','code','message','SalesforceAccount,\x20%s,\x20%s','GetSalesforceAccount','findAll','options','where','attributes','include','map','model'];(function(_0x100c7f,_0x17a338){var _0x1e552a=function(_0x33b0da){while(--_0x33b0da){_0x100c7f['push'](_0x100c7f['shift']());}};_0x1e552a(++_0x17a338);}(_0xf8a8,0x184));var _0x8f8a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf8a8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8f8a('0x0'));var util=require(_0x8f8a('0x1'));var moment=require(_0x8f8a('0x2'));var BPromise=require('bluebird');var rs=require(_0x8f8a('0x3'));var fs=require('fs');var Redis=require(_0x8f8a('0x4'));var db=require(_0x8f8a('0x5'))['db'];var utils=require(_0x8f8a('0x6'));var logger=require(_0x8f8a('0x7'))(_0x8f8a('0x8'));var config=require('../../config/environment');var jayson=require(_0x8f8a('0x9'));var client=jayson[_0x8f8a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1888ef,_0x31a052,_0x3c9d1c){return new BPromise(function(_0x303e3c,_0x84116d){return client['request'](_0x1888ef,_0x3c9d1c)[_0x8f8a('0xb')](function(_0x1256b1){logger[_0x8f8a('0xc')]('SalesforceAccount,\x20%s,\x20%s',_0x31a052,'request\x20sent');logger[_0x8f8a('0xd')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x31a052,_0x8f8a('0xe'),JSON[_0x8f8a('0xf')](_0x1256b1));if(_0x1256b1[_0x8f8a('0x10')]){if(_0x1256b1[_0x8f8a('0x10')][_0x8f8a('0x11')]===0x1f4){logger[_0x8f8a('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x31a052,_0x1256b1[_0x8f8a('0x10')][_0x8f8a('0x12')]);return _0x84116d(_0x1256b1[_0x8f8a('0x10')]['message']);}logger[_0x8f8a('0x10')](_0x8f8a('0x13'),_0x31a052,_0x1256b1[_0x8f8a('0x10')][_0x8f8a('0x12')]);return _0x303e3c(_0x1256b1[_0x8f8a('0x10')][_0x8f8a('0x12')]);}else{logger[_0x8f8a('0xc')](_0x8f8a('0x13'),_0x31a052,_0x8f8a('0xe'));_0x303e3c(_0x1256b1['result'][_0x8f8a('0x12')]);}})['catch'](function(_0x324a3a){logger[_0x8f8a('0x10')](_0x8f8a('0x13'),_0x31a052,_0x324a3a);_0x84116d(_0x324a3a);});});}exports[_0x8f8a('0x14')]=function(_0x514199){var _0x4942f0=this;return new Promise(function(_0x376cd6,_0x3b9763){return db['SalesforceAccount'][_0x8f8a('0x15')]({'raw':_0x514199['options']?_0x514199[_0x8f8a('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x514199[_0x8f8a('0x16')]?_0x514199[_0x8f8a('0x16')][_0x8f8a('0x17')]||null:null,'attributes':_0x514199['options']?_0x514199['options'][_0x8f8a('0x18')]||null:null,'limit':_0x514199['options']?_0x514199[_0x8f8a('0x16')]['limit']||null:null,'include':_0x514199[_0x8f8a('0x16')]?_0x514199[_0x8f8a('0x16')][_0x8f8a('0x19')]?_[_0x8f8a('0x1a')](_0x514199[_0x8f8a('0x16')][_0x8f8a('0x19')],function(_0x2f75f7){return{'model':db[_0x2f75f7[_0x8f8a('0x1b')]],'as':_0x2f75f7['as'],'attributes':_0x2f75f7[_0x8f8a('0x18')],'include':_0x2f75f7['include']?_[_0x8f8a('0x1a')](_0x2f75f7[_0x8f8a('0x19')],function(_0x1e833a){return{'model':db[_0x1e833a['model']],'as':_0x1e833a['as'],'attributes':_0x1e833a[_0x8f8a('0x18')],'include':_0x1e833a[_0x8f8a('0x19')]?_['map'](_0x1e833a[_0x8f8a('0x19')],function(_0x24edd4){return{'model':db[_0x24edd4[_0x8f8a('0x1b')]],'as':_0x24edd4['as'],'attributes':_0x24edd4[_0x8f8a('0x18')]};}):[]};}):[]};}):[]:[]})[_0x8f8a('0xb')](function(_0x2964e0){logger['info'](_0x8f8a('0x14'),_0x514199);logger['debug'](_0x8f8a('0x14'),_0x514199,JSON[_0x8f8a('0xf')](_0x2964e0));_0x376cd6(_0x2964e0);})[_0x8f8a('0x1c')](function(_0xcd8b31){logger[_0x8f8a('0x10')](_0x8f8a('0x14'),_0xcd8b31[_0x8f8a('0x12')],_0x514199);_0x3b9763(_0x4942f0[_0x8f8a('0x10')](0x1f4,_0xcd8b31[_0x8f8a('0x12')]));});});};exports[_0x8f8a('0x1d')]=function(_0x373d0d){var _0x3d52d3=this;return new Promise(function(_0x4f86c9,_0x356537){return db['SalesforceAccount'][_0x8f8a('0x1e')]({'raw':_0x373d0d[_0x8f8a('0x16')]?_0x373d0d[_0x8f8a('0x16')][_0x8f8a('0x1f')]===undefined?!![]:![]:!![],'where':_0x373d0d['options']?_0x373d0d[_0x8f8a('0x16')][_0x8f8a('0x17')]||null:null,'attributes':_0x373d0d[_0x8f8a('0x16')]?_0x373d0d['options'][_0x8f8a('0x18')]||null:null,'include':_0x373d0d[_0x8f8a('0x16')]?_0x373d0d[_0x8f8a('0x16')][_0x8f8a('0x19')]?_[_0x8f8a('0x1a')](_0x373d0d[_0x8f8a('0x16')][_0x8f8a('0x19')],function(_0x33f023){return{'model':db[_0x33f023[_0x8f8a('0x1b')]],'as':_0x33f023['as'],'attributes':_0x33f023[_0x8f8a('0x18')],'include':_0x33f023[_0x8f8a('0x19')]?_[_0x8f8a('0x1a')](_0x33f023[_0x8f8a('0x19')],function(_0x26fd0d){return{'model':db[_0x26fd0d['model']],'as':_0x26fd0d['as'],'attributes':_0x26fd0d[_0x8f8a('0x18')],'include':_0x26fd0d[_0x8f8a('0x19')]?_['map'](_0x26fd0d[_0x8f8a('0x19')],function(_0x5221a4){return{'model':db[_0x5221a4[_0x8f8a('0x1b')]],'as':_0x5221a4['as'],'attributes':_0x5221a4[_0x8f8a('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x29bacf){logger[_0x8f8a('0xc')]('ShowSalesforceAccount',_0x373d0d);logger[_0x8f8a('0xd')](_0x8f8a('0x1d'),_0x373d0d,JSON[_0x8f8a('0xf')](_0x29bacf));_0x4f86c9(_0x29bacf);})[_0x8f8a('0x1c')](function(_0x3be940){logger[_0x8f8a('0x10')](_0x8f8a('0x1d'),_0x3be940[_0x8f8a('0x12')],_0x373d0d);_0x356537(_0x3d52d3[_0x8f8a('0x10')](0x1f4,_0x3be940[_0x8f8a('0x12')]));});});}; \ No newline at end of file +var _0xab3b=['include','map','model','then','ShowSalesforceAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetSalesforceAccount','SalesforceAccount','options','where','attributes','limit'];(function(_0x2f32d8,_0x36b29b){var _0x47edc4=function(_0xf1373a){while(--_0xf1373a){_0x2f32d8['push'](_0x2f32d8['shift']());}};_0x47edc4(++_0x36b29b);}(_0xab3b,0x6c));var _0xbab3=function(_0x198115,_0xe6a246){_0x198115=_0x198115-0x0;var _0xb66f56=_0xab3b[_0x198115];return _0xb66f56;};'use strict';var _=require(_0xbab3('0x0'));var util=require(_0xbab3('0x1'));var moment=require(_0xbab3('0x2'));var BPromise=require(_0xbab3('0x3'));var rs=require(_0xbab3('0x4'));var fs=require('fs');var Redis=require(_0xbab3('0x5'));var db=require(_0xbab3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xbab3('0x7'))(_0xbab3('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbab3('0x9')][_0xbab3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x378772,_0x2f7c54,_0xcee65e){return new BPromise(function(_0x2ffa77,_0x32fc78){return client[_0xbab3('0xb')](_0x378772,_0xcee65e)['then'](function(_0x2cc8ab){logger['info'](_0xbab3('0xc'),_0x2f7c54,_0xbab3('0xd'));logger[_0xbab3('0xe')](_0xbab3('0xf'),_0x2f7c54,_0xbab3('0xd'),JSON[_0xbab3('0x10')](_0x2cc8ab));if(_0x2cc8ab[_0xbab3('0x11')]){if(_0x2cc8ab[_0xbab3('0x11')][_0xbab3('0x12')]===0x1f4){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x2f7c54,_0x2cc8ab[_0xbab3('0x11')][_0xbab3('0x13')]);return _0x32fc78(_0x2cc8ab[_0xbab3('0x11')][_0xbab3('0x13')]);}logger[_0xbab3('0x11')](_0xbab3('0xc'),_0x2f7c54,_0x2cc8ab[_0xbab3('0x11')][_0xbab3('0x13')]);return _0x2ffa77(_0x2cc8ab[_0xbab3('0x11')]['message']);}else{logger[_0xbab3('0x14')](_0xbab3('0xc'),_0x2f7c54,_0xbab3('0xd'));_0x2ffa77(_0x2cc8ab['result'][_0xbab3('0x13')]);}})[_0xbab3('0x15')](function(_0x3ddb7e){logger[_0xbab3('0x11')](_0xbab3('0xc'),_0x2f7c54,_0x3ddb7e);_0x32fc78(_0x3ddb7e);});});}exports[_0xbab3('0x16')]=function(_0x5d79a8){var _0x2b4ee3=this;return new Promise(function(_0x1eaecd,_0x1fb54d){return db[_0xbab3('0x17')]['findAll']({'raw':_0x5d79a8['options']?_0x5d79a8[_0xbab3('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5d79a8[_0xbab3('0x18')]?_0x5d79a8[_0xbab3('0x18')][_0xbab3('0x19')]||null:null,'attributes':_0x5d79a8[_0xbab3('0x18')]?_0x5d79a8['options'][_0xbab3('0x1a')]||null:null,'limit':_0x5d79a8['options']?_0x5d79a8['options'][_0xbab3('0x1b')]||null:null,'include':_0x5d79a8[_0xbab3('0x18')]?_0x5d79a8[_0xbab3('0x18')][_0xbab3('0x1c')]?_[_0xbab3('0x1d')](_0x5d79a8[_0xbab3('0x18')][_0xbab3('0x1c')],function(_0x47539b){return{'model':db[_0x47539b['model']],'as':_0x47539b['as'],'attributes':_0x47539b[_0xbab3('0x1a')],'include':_0x47539b[_0xbab3('0x1c')]?_[_0xbab3('0x1d')](_0x47539b[_0xbab3('0x1c')],function(_0x10b564){return{'model':db[_0x10b564[_0xbab3('0x1e')]],'as':_0x10b564['as'],'attributes':_0x10b564[_0xbab3('0x1a')],'include':_0x10b564[_0xbab3('0x1c')]?_['map'](_0x10b564[_0xbab3('0x1c')],function(_0x1cac53){return{'model':db[_0x1cac53[_0xbab3('0x1e')]],'as':_0x1cac53['as'],'attributes':_0x1cac53[_0xbab3('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xbab3('0x1f')](function(_0x126788){logger['info']('GetSalesforceAccount',_0x5d79a8);logger[_0xbab3('0xe')](_0xbab3('0x16'),_0x5d79a8,JSON['stringify'](_0x126788));_0x1eaecd(_0x126788);})['catch'](function(_0x4ffed0){logger[_0xbab3('0x11')]('GetSalesforceAccount',_0x4ffed0[_0xbab3('0x13')],_0x5d79a8);_0x1fb54d(_0x2b4ee3[_0xbab3('0x11')](0x1f4,_0x4ffed0[_0xbab3('0x13')]));});});};exports[_0xbab3('0x20')]=function(_0x52f84d){var _0x169e6b=this;return new Promise(function(_0x280a17,_0x12e5d0){return db[_0xbab3('0x17')][_0xbab3('0x21')]({'raw':_0x52f84d['options']?_0x52f84d[_0xbab3('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x52f84d[_0xbab3('0x18')]?_0x52f84d[_0xbab3('0x18')][_0xbab3('0x19')]||null:null,'attributes':_0x52f84d[_0xbab3('0x18')]?_0x52f84d[_0xbab3('0x18')]['attributes']||null:null,'include':_0x52f84d[_0xbab3('0x18')]?_0x52f84d[_0xbab3('0x18')]['include']?_[_0xbab3('0x1d')](_0x52f84d[_0xbab3('0x18')]['include'],function(_0x5fdfb6){return{'model':db[_0x5fdfb6[_0xbab3('0x1e')]],'as':_0x5fdfb6['as'],'attributes':_0x5fdfb6[_0xbab3('0x1a')],'include':_0x5fdfb6[_0xbab3('0x1c')]?_[_0xbab3('0x1d')](_0x5fdfb6[_0xbab3('0x1c')],function(_0xa72986){return{'model':db[_0xa72986[_0xbab3('0x1e')]],'as':_0xa72986['as'],'attributes':_0xa72986[_0xbab3('0x1a')],'include':_0xa72986[_0xbab3('0x1c')]?_[_0xbab3('0x1d')](_0xa72986[_0xbab3('0x1c')],function(_0x33be54){return{'model':db[_0x33be54[_0xbab3('0x1e')]],'as':_0x33be54['as'],'attributes':_0x33be54[_0xbab3('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xbab3('0x1f')](function(_0x5139d6){logger[_0xbab3('0x14')]('ShowSalesforceAccount',_0x52f84d);logger[_0xbab3('0xe')](_0xbab3('0x20'),_0x52f84d,JSON['stringify'](_0x5139d6));_0x280a17(_0x5139d6);})['catch'](function(_0x4bbc09){logger[_0xbab3('0x11')]('ShowSalesforceAccount',_0x4bbc09[_0xbab3('0x13')],_0x52f84d);_0x12e5d0(_0x169e6b[_0xbab3('0x11')](0x1f4,_0x4bbc09[_0xbab3('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 2ec560c..c966924 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 _0x7a54=['getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','index','/:id','isAuthenticated','/:id/subjects'];(function(_0x3fe137,_0x20f7d5){var _0x1707e5=function(_0x281091){while(--_0x281091){_0x3fe137['push'](_0x3fe137['shift']());}};_0x1707e5(++_0x20f7d5);}(_0x7a54,0x106));var _0x47a5=function(_0x21a59b,_0x3e242e){_0x21a59b=_0x21a59b-0x0;var _0x441bbf=_0x7a54[_0x21a59b];return _0x441bbf;};'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('0x9')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/descriptions',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x12')](_0x47a5('0xb'),auth['isAuthenticated'](),controller[_0x47a5('0x13')]);router[_0x47a5('0x14')](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x15')]);module[_0x47a5('0x16')]=router; \ No newline at end of file +var _0x5f66=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x2ca7db,_0x152bd5){var _0xc249d=function(_0x17a93d){while(--_0x17a93d){_0x2ca7db['push'](_0x2ca7db['shift']());}};_0xc249d(++_0x152bd5);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x5f66[_0x4c12ec];return _0x3ae42c;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['getFields']);router['get'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0x7')]('/:id/descriptions',auth[_0x65f6('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0x65f6('0x8')](),controller['create']);router[_0x65f6('0xe')]('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0xf')]);router[_0x65f6('0x10')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x11')]);module[_0x65f6('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 7ebd01e..768f8f6 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 _0x9825=['contact','lead','account_contact_lead','account','nothing','exports','STRING','ENUM','Task','contact_lead'];(function(_0x4a95d0,_0x45cffa){var _0x229e18=function(_0x37328d){while(--_0x37328d){_0x4a95d0['push'](_0x4a95d0['shift']());}};_0x229e18(++_0x45cffa);}(_0x9825,0x19f));var _0x5982=function(_0x2841d2,_0x3ccf7f){_0x2841d2=_0x2841d2-0x0;var _0x343942=_0x9825[_0x2841d2];return _0x343942;};'use strict';var Sequelize=require('sequelize');module[_0x5982('0x0')]={'name':{'type':Sequelize[_0x5982('0x1')]},'description':{'type':Sequelize[_0x5982('0x1')]},'ticketType':{'type':Sequelize[_0x5982('0x2')](_0x5982('0x3'),'Case'),'defaultValue':_0x5982('0x3')},'moduleSearch':{'type':Sequelize['ENUM'](_0x5982('0x4'),_0x5982('0x5'),_0x5982('0x6'),_0x5982('0x7'),_0x5982('0x8')),'defaultValue':_0x5982('0x4')},'moduleCreate':{'type':Sequelize[_0x5982('0x2')](_0x5982('0x9'),_0x5982('0x5'),_0x5982('0x6'),'account'),'defaultValue':'lead'},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0x5982('0x1')]},'additionalSearchLead':{'type':Sequelize[_0x5982('0x1')]}}; \ No newline at end of file +var _0xfe4a=['lead','account_contact_lead','account','sequelize','exports','STRING','ENUM','Task','Case','contact_lead','contact'];(function(_0x3e71cc,_0x15b3de){var _0x3b7519=function(_0x2294a1){while(--_0x2294a1){_0x3e71cc['push'](_0x3e71cc['shift']());}};_0x3b7519(++_0x15b3de);}(_0xfe4a,0x10b));var _0xafe4=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0xfe4a[_0x3ab9ee];return _0x82ee88;};'use strict';var Sequelize=require(_0xafe4('0x0'));module[_0xafe4('0x1')]={'name':{'type':Sequelize[_0xafe4('0x2')]},'description':{'type':Sequelize[_0xafe4('0x2')]},'ticketType':{'type':Sequelize[_0xafe4('0x3')](_0xafe4('0x4'),_0xafe4('0x5')),'defaultValue':_0xafe4('0x4')},'moduleSearch':{'type':Sequelize['ENUM'](_0xafe4('0x6'),_0xafe4('0x7'),_0xafe4('0x8'),_0xafe4('0x9'),'account'),'defaultValue':_0xafe4('0x6')},'moduleCreate':{'type':Sequelize[_0xafe4('0x3')]('nothing',_0xafe4('0x7'),_0xafe4('0x8'),_0xafe4('0xa')),'defaultValue':'lead'},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0xafe4('0x2')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index cde91c2..7cfc903 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 _0xf452=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','error','name','send','index','SalesforceConfiguration','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','rawAttributes','find','create','body','update','destroy','findOne','SalesforceField','getFields','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x3b7a06,_0x41f79e){var _0x363e31=function(_0x51e3f5){while(--_0x51e3f5){_0x3b7a06['push'](_0x3b7a06['shift']());}};_0x363e31(++_0x41f79e);}(_0xf452,0x13b));var _0x2f45=function(_0x1f8043,_0x4499c3){_0x1f8043=_0x1f8043-0x0;var _0x2b648e=_0xf452[_0x1f8043];return _0x2b648e;};'use strict';var emlformat=require(_0x2f45('0x0'));var rimraf=require(_0x2f45('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2f45('0x2'));var rp=require(_0x2f45('0x3'));var moment=require(_0x2f45('0x4'));var BPromise=require(_0x2f45('0x5'));var Mustache=require(_0x2f45('0x6'));var util=require(_0x2f45('0x7'));var path=require(_0x2f45('0x8'));var sox=require(_0x2f45('0x9'));var csv=require(_0x2f45('0xa'));var ejs=require(_0x2f45('0xb'));var fs=require('fs');var fs_extra=require(_0x2f45('0xc'));var _=require(_0x2f45('0xd'));var squel=require(_0x2f45('0xe'));var crypto=require(_0x2f45('0xf'));var jsforce=require(_0x2f45('0x10'));var deskjs=require(_0x2f45('0x11'));var toCsv=require(_0x2f45('0xa'));var querystring=require(_0x2f45('0x12'));var Papa=require(_0x2f45('0x13'));var Redis=require(_0x2f45('0x14'));var authService=require(_0x2f45('0x15'));var qs=require(_0x2f45('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2f45('0x17'))(_0x2f45('0x18'));var utils=require(_0x2f45('0x19'));var config=require(_0x2f45('0x1a'));var licenseUtil=require(_0x2f45('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14b367,_0x55d108){_0x55d108=_0x55d108||0xcc;return function(_0x33534){if(_0x33534){return _0x14b367[_0x2f45('0x1c')](_0x55d108);}return _0x14b367['status'](_0x55d108)[_0x2f45('0x1d')]();};}function respondWithResult(_0x2b43e7,_0x25c318){_0x25c318=_0x25c318||0xc8;return function(_0x49e130){if(_0x49e130){return _0x2b43e7[_0x2f45('0x1e')](_0x25c318)['json'](_0x49e130);}};}function respondWithFilteredResult(_0x70b84b,_0x469fbe){return function(_0x5bd134){if(_0x5bd134){var _0x2ac0bf=typeof _0x469fbe[_0x2f45('0x1f')]===_0x2f45('0x20')&&typeof _0x469fbe['limit']==='undefined';var _0x58b92e=_0x5bd134[_0x2f45('0x21')];var _0xe4db0=_0x2ac0bf?0x0:_0x469fbe[_0x2f45('0x1f')];var _0x103542=_0x2ac0bf?_0x5bd134['count']:_0x469fbe[_0x2f45('0x1f')]+_0x469fbe[_0x2f45('0x22')];var _0x2cf411;if(_0x103542>=_0x58b92e){_0x103542=_0x58b92e;_0x2cf411=0xc8;}else{_0x2cf411=0xce;}_0x70b84b[_0x2f45('0x1e')](_0x2cf411);return _0x70b84b[_0x2f45('0x23')](_0x2f45('0x24'),_0xe4db0+'-'+_0x103542+'/'+_0x58b92e)['json'](_0x5bd134);}return null;};}function patchUpdates(_0x54683c){return function(_0x46d98c){try{jsonpatch[_0x2f45('0x25')](_0x46d98c,_0x54683c,!![]);}catch(_0x3d64b4){return BPromise[_0x2f45('0x26')](_0x3d64b4);}return _0x46d98c[_0x2f45('0x27')]();};}function saveUpdates(_0x303dbf,_0x322978){return function(_0x393ecc){if(_0x393ecc){return _0x393ecc['update'](_0x303dbf)[_0x2f45('0x28')](function(_0x190636){return _0x190636;});}return null;};}function removeEntity(_0x4cfd00,_0x7ff562){return function(_0x3018fe){if(_0x3018fe){return _0x3018fe['destroy']()[_0x2f45('0x28')](function(){_0x4cfd00[_0x2f45('0x1e')](0xcc)[_0x2f45('0x1d')]();});}};}function handleEntityNotFound(_0x3d8f12,_0x1c1c3e){return function(_0x4fc861){if(!_0x4fc861){_0x3d8f12['sendStatus'](0x194);}return _0x4fc861;};}function handleError(_0x3b533d,_0x4abcee){_0x4abcee=_0x4abcee||0x1f4;return function(_0x4a5df2){logger[_0x2f45('0x29')](_0x4a5df2['stack']);if(_0x4a5df2[_0x2f45('0x2a')]){delete _0x4a5df2[_0x2f45('0x2a')];}_0x3b533d[_0x2f45('0x1e')](_0x4abcee)[_0x2f45('0x2b')](_0x4a5df2);};}exports[_0x2f45('0x2c')]=function(_0x2b10cf,_0x2f3ecc){var _0x38eb3b={},_0x531bc7={},_0x79d238={'count':0x0,'rows':[]};var _0x1453a5=_['map'](db[_0x2f45('0x2d')]['rawAttributes'],function(_0x21351c){return{'name':_0x21351c[_0x2f45('0x2e')],'type':_0x21351c[_0x2f45('0x2f')]['key']};});_0x531bc7['model']=_[_0x2f45('0x30')](_0x1453a5,'name');_0x531bc7[_0x2f45('0x31')]=_[_0x2f45('0x32')](_0x2b10cf['query']);_0x531bc7[_0x2f45('0x33')]=_[_0x2f45('0x34')](_0x531bc7[_0x2f45('0x35')],_0x531bc7[_0x2f45('0x31')]);_0x38eb3b[_0x2f45('0x36')]=_['intersection'](_0x531bc7[_0x2f45('0x35')],qs[_0x2f45('0x37')](_0x2b10cf[_0x2f45('0x31')]['fields']));_0x38eb3b[_0x2f45('0x36')]=_0x38eb3b[_0x2f45('0x36')][_0x2f45('0x38')]?_0x38eb3b[_0x2f45('0x36')]:_0x531bc7[_0x2f45('0x35')];if(!_0x2b10cf[_0x2f45('0x31')][_0x2f45('0x39')](_0x2f45('0x3a'))){_0x38eb3b[_0x2f45('0x22')]=qs['limit'](_0x2b10cf['query'][_0x2f45('0x22')]);_0x38eb3b[_0x2f45('0x1f')]=qs[_0x2f45('0x1f')](_0x2b10cf[_0x2f45('0x31')][_0x2f45('0x1f')]);}_0x38eb3b[_0x2f45('0x3b')]=qs['sort'](_0x2b10cf[_0x2f45('0x31')][_0x2f45('0x3c')]);_0x38eb3b[_0x2f45('0x3d')]=qs['filters'](_[_0x2f45('0x3e')](_0x2b10cf[_0x2f45('0x31')],_0x531bc7[_0x2f45('0x33')]),_0x1453a5);if(_0x2b10cf['query'][_0x2f45('0x3f')]){_0x38eb3b[_0x2f45('0x3d')]=_[_0x2f45('0x40')](_0x38eb3b[_0x2f45('0x3d')],{'$or':_[_0x2f45('0x30')](_0x1453a5,function(_0x482984){if(_0x482984[_0x2f45('0x2f')]!==_0x2f45('0x41')){var _0xb086bb={};_0xb086bb[_0x482984[_0x2f45('0x2a')]]={'$like':'%'+_0x2b10cf[_0x2f45('0x31')]['filter']+'%'};return _0xb086bb;}})});}_0x38eb3b=_[_0x2f45('0x40')]({},_0x38eb3b,_0x2b10cf[_0x2f45('0x42')]);var _0x38910c={'where':_0x38eb3b[_0x2f45('0x3d')]};return db[_0x2f45('0x2d')][_0x2f45('0x21')](_0x38910c)['then'](function(_0x4cc893){_0x79d238['count']=_0x4cc893;if(_0x2b10cf[_0x2f45('0x31')][_0x2f45('0x43')]){_0x38eb3b[_0x2f45('0x44')]=[{'all':!![]}];}return db[_0x2f45('0x2d')][_0x2f45('0x45')](_0x38eb3b);})[_0x2f45('0x28')](function(_0xefde40){_0x79d238['rows']=_0xefde40;return _0x79d238;})['then'](respondWithFilteredResult(_0x2f3ecc,_0x38eb3b))[_0x2f45('0x46')](handleError(_0x2f3ecc,null));};exports['show']=function(_0x5cec7a,_0x250b0e){var _0x59011f={'raw':![],'where':{'id':_0x5cec7a[_0x2f45('0x47')]['id']}},_0x12ef76={};_0x12ef76['model']=_[_0x2f45('0x32')](db[_0x2f45('0x2d')][_0x2f45('0x48')]);_0x12ef76[_0x2f45('0x31')]=_[_0x2f45('0x32')](_0x5cec7a['query']);_0x12ef76[_0x2f45('0x33')]=_['intersection'](_0x12ef76[_0x2f45('0x35')],_0x12ef76[_0x2f45('0x31')]);_0x59011f[_0x2f45('0x36')]=_[_0x2f45('0x34')](_0x12ef76['model'],qs[_0x2f45('0x37')](_0x5cec7a[_0x2f45('0x31')][_0x2f45('0x37')]));_0x59011f['attributes']=_0x59011f[_0x2f45('0x36')][_0x2f45('0x38')]?_0x59011f[_0x2f45('0x36')]:_0x12ef76[_0x2f45('0x35')];if(_0x5cec7a['query']['includeAll']){_0x59011f[_0x2f45('0x44')]=[{'all':!![]}];}_0x59011f=_['merge']({},_0x59011f,_0x5cec7a[_0x2f45('0x42')]);return db['SalesforceConfiguration'][_0x2f45('0x49')](_0x59011f)['then'](handleEntityNotFound(_0x250b0e,null))[_0x2f45('0x28')](respondWithResult(_0x250b0e,null))[_0x2f45('0x46')](handleError(_0x250b0e,null));};exports[_0x2f45('0x4a')]=function(_0x2b2c31,_0x4c2e51){return db[_0x2f45('0x2d')]['create'](_0x2b2c31[_0x2f45('0x4b')],{})[_0x2f45('0x28')](respondWithResult(_0x4c2e51,0xc9))[_0x2f45('0x46')](handleError(_0x4c2e51,null));};exports[_0x2f45('0x4c')]=function(_0x93e709,_0x34eca8){if(_0x93e709['body']['id']){delete _0x93e709[_0x2f45('0x4b')]['id'];}return db[_0x2f45('0x2d')][_0x2f45('0x49')]({'where':{'id':_0x93e709['params']['id']}})[_0x2f45('0x28')](handleEntityNotFound(_0x34eca8,null))[_0x2f45('0x28')](saveUpdates(_0x93e709[_0x2f45('0x4b')],null))[_0x2f45('0x28')](respondWithResult(_0x34eca8,null))[_0x2f45('0x46')](handleError(_0x34eca8,null));};exports[_0x2f45('0x4d')]=function(_0xba9873,_0xb81b98){return db[_0x2f45('0x2d')][_0x2f45('0x49')]({'where':{'id':_0xba9873[_0x2f45('0x47')]['id']}})[_0x2f45('0x28')](handleEntityNotFound(_0xb81b98,null))[_0x2f45('0x28')](removeEntity(_0xb81b98,null))[_0x2f45('0x46')](handleError(_0xb81b98,null));};exports['getFields']=function(_0x6e7160,_0x4ea7b2,_0x411bf7){var _0x1783b4={};var _0x2d15f3={};var _0x3c0f61;var _0x375ced;return db[_0x2f45('0x2d')][_0x2f45('0x4e')]({'where':{'id':_0x6e7160[_0x2f45('0x47')]['id']}})[_0x2f45('0x28')](handleEntityNotFound(_0x4ea7b2,null))['then'](function(_0x39ff86){if(_0x39ff86){_0x3c0f61=_0x39ff86;_0x2d15f3[_0x2f45('0x35')]=_[_0x2f45('0x32')](db[_0x2f45('0x4f')][_0x2f45('0x48')]);_0x2d15f3[_0x2f45('0x31')]=_['keys'](_0x6e7160[_0x2f45('0x31')]);_0x2d15f3[_0x2f45('0x33')]=_[_0x2f45('0x34')](_0x2d15f3[_0x2f45('0x35')],_0x2d15f3[_0x2f45('0x31')]);_0x1783b4[_0x2f45('0x36')]=_[_0x2f45('0x34')](_0x2d15f3[_0x2f45('0x35')],qs[_0x2f45('0x37')](_0x6e7160['query']['fields']));_0x1783b4[_0x2f45('0x36')]=_0x1783b4[_0x2f45('0x36')][_0x2f45('0x38')]?_0x1783b4[_0x2f45('0x36')]:_0x2d15f3[_0x2f45('0x35')];_0x1783b4[_0x2f45('0x3b')]=qs['sort'](_0x6e7160[_0x2f45('0x31')]['sort']);_0x1783b4['where']=qs['filters'](_['pick'](_0x6e7160[_0x2f45('0x31')],_0x2d15f3['filters']));if(_0x6e7160[_0x2f45('0x31')]['filter']){_0x1783b4[_0x2f45('0x3d')]=_['merge'](_0x1783b4['where'],{'$or':_['map'](_0x1783b4['attributes'],function(_0x121952){var _0x26283e={};_0x26283e[_0x121952]={'$like':'%'+_0x6e7160['query'][_0x2f45('0x3f')]+'%'};return _0x26283e;})});}_0x1783b4=_['merge']({},_0x1783b4,_0x6e7160[_0x2f45('0x42')]);return _0x3c0f61[_0x2f45('0x50')](_0x1783b4);}})['then'](function(_0x215afc){if(_0x215afc){_0x375ced=_0x215afc[_0x2f45('0x38')];if(!_0x6e7160['query'][_0x2f45('0x39')](_0x2f45('0x3a'))){_0x1783b4[_0x2f45('0x22')]=qs[_0x2f45('0x22')](_0x6e7160['query'][_0x2f45('0x22')]);_0x1783b4[_0x2f45('0x1f')]=qs[_0x2f45('0x1f')](_0x6e7160[_0x2f45('0x31')][_0x2f45('0x1f')]);}return _0x3c0f61['getFields'](_0x1783b4);}})[_0x2f45('0x28')](function(_0x5d9da5){if(_0x5d9da5){return _0x5d9da5?{'count':_0x375ced,'rows':_0x5d9da5}:null;}})[_0x2f45('0x28')](respondWithResult(_0x4ea7b2,null))[_0x2f45('0x46')](handleError(_0x4ea7b2,null));};exports[_0x2f45('0x51')]=function(_0x37a342,_0x14fba4,_0x5bea6d){var _0x368402={};var _0x32a584={};var _0x32b7a3;var _0x5dbca4;return db[_0x2f45('0x2d')]['findOne']({'where':{'id':_0x37a342[_0x2f45('0x47')]['id']}})[_0x2f45('0x28')](handleEntityNotFound(_0x14fba4,null))[_0x2f45('0x28')](function(_0x2973c6){if(_0x2973c6){_0x32b7a3=_0x2973c6;_0x32a584[_0x2f45('0x35')]=_[_0x2f45('0x32')](db['SalesforceField'][_0x2f45('0x48')]);_0x32a584['query']=_['keys'](_0x37a342[_0x2f45('0x31')]);_0x32a584[_0x2f45('0x33')]=_[_0x2f45('0x34')](_0x32a584[_0x2f45('0x35')],_0x32a584[_0x2f45('0x31')]);_0x368402[_0x2f45('0x36')]=_[_0x2f45('0x34')](_0x32a584[_0x2f45('0x35')],qs[_0x2f45('0x37')](_0x37a342[_0x2f45('0x31')]['fields']));_0x368402[_0x2f45('0x36')]=_0x368402[_0x2f45('0x36')][_0x2f45('0x38')]?_0x368402[_0x2f45('0x36')]:_0x32a584['model'];_0x368402[_0x2f45('0x3b')]=qs[_0x2f45('0x3c')](_0x37a342[_0x2f45('0x31')][_0x2f45('0x3c')]);_0x368402[_0x2f45('0x3d')]=qs[_0x2f45('0x33')](_[_0x2f45('0x3e')](_0x37a342[_0x2f45('0x31')],_0x32a584[_0x2f45('0x33')]));if(_0x37a342['query'][_0x2f45('0x3f')]){_0x368402['where']=_[_0x2f45('0x40')](_0x368402[_0x2f45('0x3d')],{'$or':_[_0x2f45('0x30')](_0x368402[_0x2f45('0x36')],function(_0x3e81be){var _0x11fcb5={};_0x11fcb5[_0x3e81be]={'$like':'%'+_0x37a342[_0x2f45('0x31')][_0x2f45('0x3f')]+'%'};return _0x11fcb5;})});}_0x368402=_[_0x2f45('0x40')]({},_0x368402,_0x37a342[_0x2f45('0x42')]);return _0x32b7a3[_0x2f45('0x51')](_0x368402);}})[_0x2f45('0x28')](function(_0x9d51ee){if(_0x9d51ee){_0x5dbca4=_0x9d51ee[_0x2f45('0x38')];if(!_0x37a342[_0x2f45('0x31')]['hasOwnProperty'](_0x2f45('0x3a'))){_0x368402[_0x2f45('0x22')]=qs[_0x2f45('0x22')](_0x37a342[_0x2f45('0x31')][_0x2f45('0x22')]);_0x368402['offset']=qs['offset'](_0x37a342[_0x2f45('0x31')][_0x2f45('0x1f')]);}return _0x32b7a3[_0x2f45('0x51')](_0x368402);}})[_0x2f45('0x28')](function(_0x740dcc){if(_0x740dcc){return _0x740dcc?{'count':_0x5dbca4,'rows':_0x740dcc}:null;}})[_0x2f45('0x28')](respondWithResult(_0x14fba4,null))['catch'](handleError(_0x14fba4,null));};exports[_0x2f45('0x52')]=function(_0x623eed,_0x1f9d1b,_0x376fd7){var _0x533b94={};var _0x4768f5={};var _0x33454f;var _0x528373;return db[_0x2f45('0x2d')][_0x2f45('0x4e')]({'where':{'id':_0x623eed[_0x2f45('0x47')]['id']}})[_0x2f45('0x28')](handleEntityNotFound(_0x1f9d1b,null))[_0x2f45('0x28')](function(_0x366f5a){if(_0x366f5a){_0x33454f=_0x366f5a;_0x4768f5[_0x2f45('0x35')]=_['keys'](db[_0x2f45('0x4f')]['rawAttributes']);_0x4768f5[_0x2f45('0x31')]=_[_0x2f45('0x32')](_0x623eed['query']);_0x4768f5['filters']=_[_0x2f45('0x34')](_0x4768f5['model'],_0x4768f5[_0x2f45('0x31')]);_0x533b94[_0x2f45('0x36')]=_[_0x2f45('0x34')](_0x4768f5[_0x2f45('0x35')],qs[_0x2f45('0x37')](_0x623eed[_0x2f45('0x31')][_0x2f45('0x37')]));_0x533b94['attributes']=_0x533b94['attributes'][_0x2f45('0x38')]?_0x533b94[_0x2f45('0x36')]:_0x4768f5[_0x2f45('0x35')];_0x533b94[_0x2f45('0x3b')]=qs[_0x2f45('0x3c')](_0x623eed[_0x2f45('0x31')][_0x2f45('0x3c')]);_0x533b94[_0x2f45('0x3d')]=qs['filters'](_[_0x2f45('0x3e')](_0x623eed[_0x2f45('0x31')],_0x4768f5[_0x2f45('0x33')]));if(_0x623eed['query'][_0x2f45('0x3f')]){_0x533b94[_0x2f45('0x3d')]=_[_0x2f45('0x40')](_0x533b94['where'],{'$or':_[_0x2f45('0x30')](_0x533b94['attributes'],function(_0x33273d){var _0x47e400={};_0x47e400[_0x33273d]={'$like':'%'+_0x623eed[_0x2f45('0x31')]['filter']+'%'};return _0x47e400;})});}_0x533b94=_[_0x2f45('0x40')]({},_0x533b94,_0x623eed[_0x2f45('0x42')]);return _0x33454f[_0x2f45('0x52')](_0x533b94);}})['then'](function(_0x15f431){if(_0x15f431){_0x528373=_0x15f431['length'];if(!_0x623eed['query'][_0x2f45('0x39')](_0x2f45('0x3a'))){_0x533b94[_0x2f45('0x22')]=qs[_0x2f45('0x22')](_0x623eed['query']['limit']);_0x533b94[_0x2f45('0x1f')]=qs[_0x2f45('0x1f')](_0x623eed[_0x2f45('0x31')][_0x2f45('0x1f')]);}return _0x33454f[_0x2f45('0x52')](_0x533b94);}})[_0x2f45('0x28')](function(_0x47af7){if(_0x47af7){return _0x47af7?{'count':_0x528373,'rows':_0x47af7}:null;}})['then'](respondWithResult(_0x1f9d1b,null))['catch'](handleError(_0x1f9d1b,null));}; \ No newline at end of file +var _0xa600=['attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','SalesforceConfiguration','includeAll','findAll','rows','catch','show','params','include','find','create','body','getFields','SalesforceField','nolimit','findOne','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0xbb7885,_0x30c84f){var _0xfdd112=function(_0x2feb7d){while(--_0x2feb7d){_0xbb7885['push'](_0xbb7885['shift']());}};_0xfdd112(++_0x30c84f);}(_0xa600,0x1c7));var _0x0a60=function(_0x37cc52,_0x459a9b){_0x37cc52=_0x37cc52-0x0;var _0x2b4a90=_0xa600[_0x37cc52];return _0x2b4a90;};'use strict';var emlformat=require(_0x0a60('0x0'));var rimraf=require(_0x0a60('0x1'));var zipdir=require(_0x0a60('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0a60('0x3'));var moment=require(_0x0a60('0x4'));var BPromise=require(_0x0a60('0x5'));var Mustache=require(_0x0a60('0x6'));var util=require('util');var path=require(_0x0a60('0x7'));var sox=require(_0x0a60('0x8'));var csv=require('to-csv');var ejs=require(_0x0a60('0x9'));var fs=require('fs');var fs_extra=require(_0x0a60('0xa'));var _=require(_0x0a60('0xb'));var squel=require(_0x0a60('0xc'));var crypto=require(_0x0a60('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0a60('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0a60('0xf'));var Papa=require(_0x0a60('0x10'));var Redis=require(_0x0a60('0x11'));var authService=require(_0x0a60('0x12'));var qs=require(_0x0a60('0x13'));var as=require(_0x0a60('0x14'));var hardwareService=require(_0x0a60('0x15'));var logger=require(_0x0a60('0x16'))(_0x0a60('0x17'));var utils=require(_0x0a60('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x0a60('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3f1836,_0x45d76b){_0x45d76b=_0x45d76b||0xcc;return function(_0x34637e){if(_0x34637e){return _0x3f1836['sendStatus'](_0x45d76b);}return _0x3f1836['status'](_0x45d76b)['end']();};}function respondWithResult(_0x3f3c02,_0x1cfabe){_0x1cfabe=_0x1cfabe||0xc8;return function(_0x42024f){if(_0x42024f){return _0x3f3c02[_0x0a60('0x1a')](_0x1cfabe)[_0x0a60('0x1b')](_0x42024f);}};}function respondWithFilteredResult(_0xb9d969,_0x44d45a){return function(_0x5b9eef){if(_0x5b9eef){var _0x45e396=typeof _0x44d45a[_0x0a60('0x1c')]===_0x0a60('0x1d')&&typeof _0x44d45a[_0x0a60('0x1e')]==='undefined';var _0x4b2012=_0x5b9eef[_0x0a60('0x1f')];var _0x19ae6f=_0x45e396?0x0:_0x44d45a[_0x0a60('0x1c')];var _0x57df7f=_0x45e396?_0x5b9eef['count']:_0x44d45a[_0x0a60('0x1c')]+_0x44d45a['limit'];var _0x50e589;if(_0x57df7f>=_0x4b2012){_0x57df7f=_0x4b2012;_0x50e589=0xc8;}else{_0x50e589=0xce;}_0xb9d969[_0x0a60('0x1a')](_0x50e589);return _0xb9d969[_0x0a60('0x20')](_0x0a60('0x21'),_0x19ae6f+'-'+_0x57df7f+'/'+_0x4b2012)[_0x0a60('0x1b')](_0x5b9eef);}return null;};}function patchUpdates(_0x1c1ee5){return function(_0x532599){try{jsonpatch[_0x0a60('0x22')](_0x532599,_0x1c1ee5,!![]);}catch(_0x1d2070){return BPromise[_0x0a60('0x23')](_0x1d2070);}return _0x532599[_0x0a60('0x24')]();};}function saveUpdates(_0x2832c3,_0x1f86d0){return function(_0x112bbc){if(_0x112bbc){return _0x112bbc[_0x0a60('0x25')](_0x2832c3)[_0x0a60('0x26')](function(_0x137861){return _0x137861;});}return null;};}function removeEntity(_0x4cb09b,_0x17350a){return function(_0x305720){if(_0x305720){return _0x305720[_0x0a60('0x27')]()[_0x0a60('0x26')](function(){_0x4cb09b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4433aa,_0x1ad71d){return function(_0xc4cea8){if(!_0xc4cea8){_0x4433aa[_0x0a60('0x28')](0x194);}return _0xc4cea8;};}function handleError(_0x571855,_0x247e96){_0x247e96=_0x247e96||0x1f4;return function(_0xffda8){logger[_0x0a60('0x29')](_0xffda8[_0x0a60('0x2a')]);if(_0xffda8['name']){delete _0xffda8[_0x0a60('0x2b')];}_0x571855['status'](_0x247e96)[_0x0a60('0x2c')](_0xffda8);};}exports[_0x0a60('0x2d')]=function(_0x30d6d0,_0x578992){var _0x5895ef={},_0x436d34={},_0x56f38c={'count':0x0,'rows':[]};var _0x1a1b4d=_[_0x0a60('0x2e')](db['SalesforceConfiguration'][_0x0a60('0x2f')],function(_0x5c91ea){return{'name':_0x5c91ea[_0x0a60('0x30')],'type':_0x5c91ea[_0x0a60('0x31')][_0x0a60('0x32')]};});_0x436d34[_0x0a60('0x33')]=_[_0x0a60('0x2e')](_0x1a1b4d,_0x0a60('0x2b'));_0x436d34[_0x0a60('0x34')]=_[_0x0a60('0x35')](_0x30d6d0['query']);_0x436d34[_0x0a60('0x36')]=_['intersection'](_0x436d34['model'],_0x436d34[_0x0a60('0x34')]);_0x5895ef[_0x0a60('0x37')]=_[_0x0a60('0x38')](_0x436d34[_0x0a60('0x33')],qs[_0x0a60('0x39')](_0x30d6d0[_0x0a60('0x34')][_0x0a60('0x39')]));_0x5895ef['attributes']=_0x5895ef[_0x0a60('0x37')][_0x0a60('0x3a')]?_0x5895ef[_0x0a60('0x37')]:_0x436d34['model'];if(!_0x30d6d0['query'][_0x0a60('0x3b')]('nolimit')){_0x5895ef[_0x0a60('0x1e')]=qs[_0x0a60('0x1e')](_0x30d6d0[_0x0a60('0x34')][_0x0a60('0x1e')]);_0x5895ef['offset']=qs[_0x0a60('0x1c')](_0x30d6d0[_0x0a60('0x34')][_0x0a60('0x1c')]);}_0x5895ef[_0x0a60('0x3c')]=qs[_0x0a60('0x3d')](_0x30d6d0['query'][_0x0a60('0x3d')]);_0x5895ef[_0x0a60('0x3e')]=qs['filters'](_[_0x0a60('0x3f')](_0x30d6d0[_0x0a60('0x34')],_0x436d34[_0x0a60('0x36')]),_0x1a1b4d);if(_0x30d6d0['query'][_0x0a60('0x40')]){_0x5895ef[_0x0a60('0x3e')]=_[_0x0a60('0x41')](_0x5895ef[_0x0a60('0x3e')],{'$or':_[_0x0a60('0x2e')](_0x1a1b4d,function(_0x439bfb){if(_0x439bfb[_0x0a60('0x31')]!==_0x0a60('0x42')){var _0xb3a564={};_0xb3a564[_0x439bfb[_0x0a60('0x2b')]]={'$like':'%'+_0x30d6d0[_0x0a60('0x34')]['filter']+'%'};return _0xb3a564;}})});}_0x5895ef=_[_0x0a60('0x41')]({},_0x5895ef,_0x30d6d0[_0x0a60('0x43')]);var _0x43303b={'where':_0x5895ef[_0x0a60('0x3e')]};return db[_0x0a60('0x44')]['count'](_0x43303b)[_0x0a60('0x26')](function(_0xdafb58){_0x56f38c[_0x0a60('0x1f')]=_0xdafb58;if(_0x30d6d0[_0x0a60('0x34')][_0x0a60('0x45')]){_0x5895ef['include']=[{'all':!![]}];}return db[_0x0a60('0x44')][_0x0a60('0x46')](_0x5895ef);})[_0x0a60('0x26')](function(_0x2c28e7){_0x56f38c[_0x0a60('0x47')]=_0x2c28e7;return _0x56f38c;})[_0x0a60('0x26')](respondWithFilteredResult(_0x578992,_0x5895ef))[_0x0a60('0x48')](handleError(_0x578992,null));};exports[_0x0a60('0x49')]=function(_0x2e632f,_0x4c366d){var _0x486992={'raw':![],'where':{'id':_0x2e632f[_0x0a60('0x4a')]['id']}},_0x5e1324={};_0x5e1324[_0x0a60('0x33')]=_['keys'](db[_0x0a60('0x44')]['rawAttributes']);_0x5e1324[_0x0a60('0x34')]=_[_0x0a60('0x35')](_0x2e632f[_0x0a60('0x34')]);_0x5e1324[_0x0a60('0x36')]=_[_0x0a60('0x38')](_0x5e1324[_0x0a60('0x33')],_0x5e1324[_0x0a60('0x34')]);_0x486992[_0x0a60('0x37')]=_[_0x0a60('0x38')](_0x5e1324[_0x0a60('0x33')],qs[_0x0a60('0x39')](_0x2e632f[_0x0a60('0x34')][_0x0a60('0x39')]));_0x486992[_0x0a60('0x37')]=_0x486992[_0x0a60('0x37')]['length']?_0x486992[_0x0a60('0x37')]:_0x5e1324[_0x0a60('0x33')];if(_0x2e632f[_0x0a60('0x34')]['includeAll']){_0x486992[_0x0a60('0x4b')]=[{'all':!![]}];}_0x486992=_[_0x0a60('0x41')]({},_0x486992,_0x2e632f[_0x0a60('0x43')]);return db[_0x0a60('0x44')][_0x0a60('0x4c')](_0x486992)[_0x0a60('0x26')](handleEntityNotFound(_0x4c366d,null))['then'](respondWithResult(_0x4c366d,null))['catch'](handleError(_0x4c366d,null));};exports['create']=function(_0x3d4e74,_0x58f7c4){return db['SalesforceConfiguration'][_0x0a60('0x4d')](_0x3d4e74[_0x0a60('0x4e')],{})[_0x0a60('0x26')](respondWithResult(_0x58f7c4,0xc9))['catch'](handleError(_0x58f7c4,null));};exports['update']=function(_0x52aab7,_0x489302){if(_0x52aab7[_0x0a60('0x4e')]['id']){delete _0x52aab7[_0x0a60('0x4e')]['id'];}return db[_0x0a60('0x44')]['find']({'where':{'id':_0x52aab7['params']['id']}})[_0x0a60('0x26')](handleEntityNotFound(_0x489302,null))[_0x0a60('0x26')](saveUpdates(_0x52aab7[_0x0a60('0x4e')],null))[_0x0a60('0x26')](respondWithResult(_0x489302,null))[_0x0a60('0x48')](handleError(_0x489302,null));};exports[_0x0a60('0x27')]=function(_0x187c36,_0x4783a7){return db['SalesforceConfiguration']['find']({'where':{'id':_0x187c36[_0x0a60('0x4a')]['id']}})[_0x0a60('0x26')](handleEntityNotFound(_0x4783a7,null))['then'](removeEntity(_0x4783a7,null))['catch'](handleError(_0x4783a7,null));};exports[_0x0a60('0x4f')]=function(_0xa571db,_0x483aba,_0x2c2838){var _0x4bfe2a={};var _0x31d653={};var _0x4705e4;var _0x44a61f;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0xa571db[_0x0a60('0x4a')]['id']}})[_0x0a60('0x26')](handleEntityNotFound(_0x483aba,null))[_0x0a60('0x26')](function(_0x3fe2ac){if(_0x3fe2ac){_0x4705e4=_0x3fe2ac;_0x31d653['model']=_[_0x0a60('0x35')](db[_0x0a60('0x50')][_0x0a60('0x2f')]);_0x31d653[_0x0a60('0x34')]=_['keys'](_0xa571db['query']);_0x31d653[_0x0a60('0x36')]=_[_0x0a60('0x38')](_0x31d653[_0x0a60('0x33')],_0x31d653[_0x0a60('0x34')]);_0x4bfe2a['attributes']=_['intersection'](_0x31d653[_0x0a60('0x33')],qs[_0x0a60('0x39')](_0xa571db[_0x0a60('0x34')][_0x0a60('0x39')]));_0x4bfe2a[_0x0a60('0x37')]=_0x4bfe2a[_0x0a60('0x37')][_0x0a60('0x3a')]?_0x4bfe2a[_0x0a60('0x37')]:_0x31d653['model'];_0x4bfe2a[_0x0a60('0x3c')]=qs['sort'](_0xa571db[_0x0a60('0x34')]['sort']);_0x4bfe2a['where']=qs[_0x0a60('0x36')](_[_0x0a60('0x3f')](_0xa571db[_0x0a60('0x34')],_0x31d653[_0x0a60('0x36')]));if(_0xa571db[_0x0a60('0x34')][_0x0a60('0x40')]){_0x4bfe2a['where']=_[_0x0a60('0x41')](_0x4bfe2a[_0x0a60('0x3e')],{'$or':_['map'](_0x4bfe2a['attributes'],function(_0x3139ea){var _0x4bb0fe={};_0x4bb0fe[_0x3139ea]={'$like':'%'+_0xa571db[_0x0a60('0x34')][_0x0a60('0x40')]+'%'};return _0x4bb0fe;})});}_0x4bfe2a=_[_0x0a60('0x41')]({},_0x4bfe2a,_0xa571db[_0x0a60('0x43')]);return _0x4705e4[_0x0a60('0x4f')](_0x4bfe2a);}})[_0x0a60('0x26')](function(_0x129063){if(_0x129063){_0x44a61f=_0x129063[_0x0a60('0x3a')];if(!_0xa571db[_0x0a60('0x34')][_0x0a60('0x3b')](_0x0a60('0x51'))){_0x4bfe2a['limit']=qs[_0x0a60('0x1e')](_0xa571db[_0x0a60('0x34')][_0x0a60('0x1e')]);_0x4bfe2a[_0x0a60('0x1c')]=qs[_0x0a60('0x1c')](_0xa571db[_0x0a60('0x34')][_0x0a60('0x1c')]);}return _0x4705e4[_0x0a60('0x4f')](_0x4bfe2a);}})[_0x0a60('0x26')](function(_0x5a933c){if(_0x5a933c){return _0x5a933c?{'count':_0x44a61f,'rows':_0x5a933c}:null;}})['then'](respondWithResult(_0x483aba,null))[_0x0a60('0x48')](handleError(_0x483aba,null));};exports['getSubjects']=function(_0x2aacfb,_0x465eb5,_0x513037){var _0x2d07c2={};var _0x1aa1dc={};var _0x4c1dd2;var _0x3c787d;return db[_0x0a60('0x44')][_0x0a60('0x52')]({'where':{'id':_0x2aacfb['params']['id']}})[_0x0a60('0x26')](handleEntityNotFound(_0x465eb5,null))[_0x0a60('0x26')](function(_0x55284f){if(_0x55284f){_0x4c1dd2=_0x55284f;_0x1aa1dc[_0x0a60('0x33')]=_[_0x0a60('0x35')](db[_0x0a60('0x50')][_0x0a60('0x2f')]);_0x1aa1dc['query']=_['keys'](_0x2aacfb[_0x0a60('0x34')]);_0x1aa1dc[_0x0a60('0x36')]=_['intersection'](_0x1aa1dc[_0x0a60('0x33')],_0x1aa1dc[_0x0a60('0x34')]);_0x2d07c2['attributes']=_[_0x0a60('0x38')](_0x1aa1dc['model'],qs['fields'](_0x2aacfb[_0x0a60('0x34')][_0x0a60('0x39')]));_0x2d07c2[_0x0a60('0x37')]=_0x2d07c2['attributes'][_0x0a60('0x3a')]?_0x2d07c2[_0x0a60('0x37')]:_0x1aa1dc[_0x0a60('0x33')];_0x2d07c2[_0x0a60('0x3c')]=qs[_0x0a60('0x3d')](_0x2aacfb[_0x0a60('0x34')][_0x0a60('0x3d')]);_0x2d07c2[_0x0a60('0x3e')]=qs['filters'](_['pick'](_0x2aacfb[_0x0a60('0x34')],_0x1aa1dc[_0x0a60('0x36')]));if(_0x2aacfb[_0x0a60('0x34')][_0x0a60('0x40')]){_0x2d07c2[_0x0a60('0x3e')]=_[_0x0a60('0x41')](_0x2d07c2[_0x0a60('0x3e')],{'$or':_[_0x0a60('0x2e')](_0x2d07c2[_0x0a60('0x37')],function(_0x2b060f){var _0x24cf59={};_0x24cf59[_0x2b060f]={'$like':'%'+_0x2aacfb[_0x0a60('0x34')]['filter']+'%'};return _0x24cf59;})});}_0x2d07c2=_[_0x0a60('0x41')]({},_0x2d07c2,_0x2aacfb[_0x0a60('0x43')]);return _0x4c1dd2[_0x0a60('0x53')](_0x2d07c2);}})[_0x0a60('0x26')](function(_0x34c038){if(_0x34c038){_0x3c787d=_0x34c038[_0x0a60('0x3a')];if(!_0x2aacfb[_0x0a60('0x34')][_0x0a60('0x3b')](_0x0a60('0x51'))){_0x2d07c2[_0x0a60('0x1e')]=qs['limit'](_0x2aacfb[_0x0a60('0x34')][_0x0a60('0x1e')]);_0x2d07c2[_0x0a60('0x1c')]=qs[_0x0a60('0x1c')](_0x2aacfb[_0x0a60('0x34')][_0x0a60('0x1c')]);}return _0x4c1dd2[_0x0a60('0x53')](_0x2d07c2);}})[_0x0a60('0x26')](function(_0x5e749f){if(_0x5e749f){return _0x5e749f?{'count':_0x3c787d,'rows':_0x5e749f}:null;}})[_0x0a60('0x26')](respondWithResult(_0x465eb5,null))[_0x0a60('0x48')](handleError(_0x465eb5,null));};exports[_0x0a60('0x54')]=function(_0x2e4140,_0x55d2ac,_0x30c752){var _0x3100b3={};var _0x56068b={};var _0x3c47cb;var _0x5809b6;return db[_0x0a60('0x44')]['findOne']({'where':{'id':_0x2e4140[_0x0a60('0x4a')]['id']}})[_0x0a60('0x26')](handleEntityNotFound(_0x55d2ac,null))[_0x0a60('0x26')](function(_0x8687b7){if(_0x8687b7){_0x3c47cb=_0x8687b7;_0x56068b[_0x0a60('0x33')]=_[_0x0a60('0x35')](db[_0x0a60('0x50')][_0x0a60('0x2f')]);_0x56068b[_0x0a60('0x34')]=_[_0x0a60('0x35')](_0x2e4140[_0x0a60('0x34')]);_0x56068b['filters']=_[_0x0a60('0x38')](_0x56068b[_0x0a60('0x33')],_0x56068b[_0x0a60('0x34')]);_0x3100b3['attributes']=_[_0x0a60('0x38')](_0x56068b[_0x0a60('0x33')],qs['fields'](_0x2e4140['query'][_0x0a60('0x39')]));_0x3100b3[_0x0a60('0x37')]=_0x3100b3[_0x0a60('0x37')]['length']?_0x3100b3[_0x0a60('0x37')]:_0x56068b[_0x0a60('0x33')];_0x3100b3[_0x0a60('0x3c')]=qs['sort'](_0x2e4140[_0x0a60('0x34')][_0x0a60('0x3d')]);_0x3100b3[_0x0a60('0x3e')]=qs[_0x0a60('0x36')](_[_0x0a60('0x3f')](_0x2e4140[_0x0a60('0x34')],_0x56068b[_0x0a60('0x36')]));if(_0x2e4140[_0x0a60('0x34')][_0x0a60('0x40')]){_0x3100b3[_0x0a60('0x3e')]=_[_0x0a60('0x41')](_0x3100b3['where'],{'$or':_[_0x0a60('0x2e')](_0x3100b3['attributes'],function(_0x2f3820){var _0x51c0ea={};_0x51c0ea[_0x2f3820]={'$like':'%'+_0x2e4140[_0x0a60('0x34')][_0x0a60('0x40')]+'%'};return _0x51c0ea;})});}_0x3100b3=_[_0x0a60('0x41')]({},_0x3100b3,_0x2e4140[_0x0a60('0x43')]);return _0x3c47cb[_0x0a60('0x54')](_0x3100b3);}})[_0x0a60('0x26')](function(_0x5b2cc4){if(_0x5b2cc4){_0x5809b6=_0x5b2cc4['length'];if(!_0x2e4140[_0x0a60('0x34')][_0x0a60('0x3b')](_0x0a60('0x51'))){_0x3100b3[_0x0a60('0x1e')]=qs[_0x0a60('0x1e')](_0x2e4140['query'][_0x0a60('0x1e')]);_0x3100b3[_0x0a60('0x1c')]=qs[_0x0a60('0x1c')](_0x2e4140[_0x0a60('0x34')]['offset']);}return _0x3c47cb[_0x0a60('0x54')](_0x3100b3);}})['then'](function(_0x1fe6a6){if(_0x1fe6a6){return _0x1fe6a6?{'count':_0x5809b6,'rows':_0x1fe6a6}:null;}})['then'](respondWithResult(_0x55d2ac,null))[_0x0a60('0x48')](handleError(_0x55d2ac,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index ff0f3d7..4574857 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 _0x79e5=['bluebird','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','SalesforceConfiguration','int_salesforce_configurations','lodash','../../config/logger','api','moment'];(function(_0x32f587,_0x3d7773){var _0x7964c5=function(_0x53a203){while(--_0x53a203){_0x32f587['push'](_0x32f587['shift']());}};_0x7964c5(++_0x3d7773);}(_0x79e5,0x170));var _0x579e=function(_0x256e74,_0x102a42){_0x256e74=_0x256e74-0x0;var _0x5244da=_0x79e5[_0x256e74];return _0x5244da;};'use strict';var _=require(_0x579e('0x0'));var util=require('util');var logger=require(_0x579e('0x1'))(_0x579e('0x2'));var moment=require(_0x579e('0x3'));var BPromise=require(_0x579e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x579e('0x5'));var rimraf=require(_0x579e('0x6'));var config=require(_0x579e('0x7'));var attributes=require(_0x579e('0x8'));module[_0x579e('0x9')]=function(_0x47d6f6,_0x324f11){return _0x47d6f6['define'](_0x579e('0xa'),attributes,{'tableName':_0x579e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x004c=['../../config/environment','exports','define','SalesforceConfiguration','int_salesforce_configurations','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x5d4600,_0x2c572f){var _0x5e71ef=function(_0x4f046f){while(--_0x4f046f){_0x5d4600['push'](_0x5d4600['shift']());}};_0x5e71ef(++_0x2c572f);}(_0x004c,0x1de));var _0xc004=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0x004c[_0x35885a];return _0xe86249;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc004('0x0'))(_0xc004('0x1'));var moment=require(_0xc004('0x2'));var BPromise=require(_0xc004('0x3'));var rp=require(_0xc004('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc004('0x5'));var config=require(_0xc004('0x6'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0xc004('0x7')]=function(_0x27a9d6,_0x2b72c1){return _0x27a9d6[_0xc004('0x8')](_0xc004('0x9'),attributes,{'tableName':_0xc004('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 9c90d0a..15382e3 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 _0x1c11=['result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','SalesforceConfiguration,\x20%s,\x20%s'];(function(_0x4e8450,_0x16ca85){var _0x2bd7ae=function(_0x10dc91){while(--_0x10dc91){_0x4e8450['push'](_0x4e8450['shift']());}};_0x2bd7ae(++_0x16ca85);}(_0x1c11,0x161));var _0x11c1=function(_0x2b1095,_0x12239d){_0x2b1095=_0x2b1095-0x0;var _0x509cf3=_0x1c11[_0x2b1095];return _0x509cf3;};'use strict';var _=require(_0x11c1('0x0'));var util=require(_0x11c1('0x1'));var moment=require('moment');var BPromise=require(_0x11c1('0x2'));var rs=require(_0x11c1('0x3'));var fs=require('fs');var Redis=require(_0x11c1('0x4'));var db=require(_0x11c1('0x5'))['db'];var utils=require(_0x11c1('0x6'));var logger=require('../../config/logger')(_0x11c1('0x7'));var config=require('../../config/environment');var jayson=require(_0x11c1('0x8'));var client=jayson[_0x11c1('0x9')][_0x11c1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e5d43,_0x6483dd,_0xe7eab9){return new BPromise(function(_0xe00f60,_0x545298){return client[_0x11c1('0xb')](_0x3e5d43,_0xe7eab9)[_0x11c1('0xc')](function(_0x3e2873){logger[_0x11c1('0xd')]('SalesforceConfiguration,\x20%s,\x20%s',_0x6483dd,_0x11c1('0xe'));logger[_0x11c1('0xf')](_0x11c1('0x10'),_0x6483dd,_0x11c1('0xe'),JSON['stringify'](_0x3e2873));if(_0x3e2873[_0x11c1('0x11')]){if(_0x3e2873[_0x11c1('0x11')][_0x11c1('0x12')]===0x1f4){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x6483dd,_0x3e2873[_0x11c1('0x11')][_0x11c1('0x13')]);return _0x545298(_0x3e2873[_0x11c1('0x11')][_0x11c1('0x13')]);}logger['error'](_0x11c1('0x14'),_0x6483dd,_0x3e2873['error']['message']);return _0xe00f60(_0x3e2873[_0x11c1('0x11')][_0x11c1('0x13')]);}else{logger['info'](_0x11c1('0x14'),_0x6483dd,_0x11c1('0xe'));_0xe00f60(_0x3e2873[_0x11c1('0x15')][_0x11c1('0x13')]);}})['catch'](function(_0x56184a){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x6483dd,_0x56184a);_0x545298(_0x56184a);});});} \ No newline at end of file +var _0x0d9f=['client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x0d9f,0xf4));var _0xf0d9=function(_0x1b1e76,_0x31695b){_0x1b1e76=_0x1b1e76-0x0;var _0x3d743a=_0x0d9f[_0x1b1e76];return _0x3d743a;};'use strict';var _=require(_0xf0d9('0x0'));var util=require(_0xf0d9('0x1'));var moment=require(_0xf0d9('0x2'));var BPromise=require('bluebird');var rs=require(_0xf0d9('0x3'));var fs=require('fs');var Redis=require(_0xf0d9('0x4'));var db=require(_0xf0d9('0x5'))['db'];var utils=require(_0xf0d9('0x6'));var logger=require(_0xf0d9('0x7'))('rpc');var config=require(_0xf0d9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf0d9('0x9')][_0xf0d9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x18a691,_0x13ef44,_0x2bbc7c){return new BPromise(function(_0x4be50d,_0x4f85a3){return client[_0xf0d9('0xb')](_0x18a691,_0x2bbc7c)[_0xf0d9('0xc')](function(_0x330ac1){logger[_0xf0d9('0xd')](_0xf0d9('0xe'),_0x13ef44,_0xf0d9('0xf'));logger['debug'](_0xf0d9('0x10'),_0x13ef44,_0xf0d9('0xf'),JSON[_0xf0d9('0x11')](_0x330ac1));if(_0x330ac1[_0xf0d9('0x12')]){if(_0x330ac1[_0xf0d9('0x12')][_0xf0d9('0x13')]===0x1f4){logger['error'](_0xf0d9('0xe'),_0x13ef44,_0x330ac1[_0xf0d9('0x12')]['message']);return _0x4f85a3(_0x330ac1['error']['message']);}logger[_0xf0d9('0x12')](_0xf0d9('0xe'),_0x13ef44,_0x330ac1[_0xf0d9('0x12')][_0xf0d9('0x14')]);return _0x4be50d(_0x330ac1[_0xf0d9('0x12')]['message']);}else{logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x13ef44,'request\x20sent');_0x4be50d(_0x330ac1[_0xf0d9('0x15')]['message']);}})[_0xf0d9('0x16')](function(_0x5e2281){logger[_0xf0d9('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x13ef44,_0x5e2281);_0x4f85a3(_0x5e2281);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 3696ef2..884a048 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 _0xa807=['update','delete','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','/:id','show','create','put'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0xa807,0xf2));var _0x7a80=function(_0x1639fc,_0x134be0){_0x1639fc=_0x1639fc-0x0;var _0x2f6172=_0xa807[_0x1639fc];return _0x2f6172;};'use strict';var multer=require('multer');var util=require(_0x7a80('0x0'));var path=require('path');var timeout=require(_0x7a80('0x1'));var express=require(_0x7a80('0x2'));var router=express[_0x7a80('0x3')]();var fs_extra=require(_0x7a80('0x4'));var auth=require(_0x7a80('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7a80('0x6'));var controller=require(_0x7a80('0x7'));router[_0x7a80('0x8')]('/',auth[_0x7a80('0x9')](),controller['index']);router[_0x7a80('0x8')](_0x7a80('0xa'),auth[_0x7a80('0x9')](),controller[_0x7a80('0xb')]);router['post']('/',auth[_0x7a80('0x9')](),controller[_0x7a80('0xc')]);router[_0x7a80('0xd')](_0x7a80('0xa'),auth[_0x7a80('0x9')](),controller[_0x7a80('0xe')]);router[_0x7a80('0xf')](_0x7a80('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x91d6=['get','/:id','create','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','isAuthenticated','index'];(function(_0x345690,_0xd8f66a){var _0x200bb5=function(_0x11236c){while(--_0x11236c){_0x345690['push'](_0x345690['shift']());}};_0x200bb5(++_0xd8f66a);}(_0x91d6,0x15e));var _0x691d=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x91d6[_0xc4001c];return _0x49f7bc;};'use strict';var multer=require(_0x691d('0x0'));var util=require(_0x691d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x691d('0x2'));var router=express[_0x691d('0x3')]();var fs_extra=require(_0x691d('0x4'));var auth=require(_0x691d('0x5'));var interaction=require(_0x691d('0x6'));var config=require(_0x691d('0x7'));var controller=require(_0x691d('0x8'));router['get']('/',auth[_0x691d('0x9')](),controller[_0x691d('0xa')]);router[_0x691d('0xb')](_0x691d('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x691d('0x9')](),controller[_0x691d('0xd')]);router[_0x691d('0xe')](_0x691d('0xc'),auth[_0x691d('0x9')](),controller[_0x691d('0xf')]);router[_0x691d('0x10')](_0x691d('0xc'),auth['isAuthenticated'](),controller[_0x691d('0x11')]);module[_0x691d('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 2e3c56c..7201ce8 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 _0x8791=['ENUM','sequelize','exports','variable','customVariable','keyValue','string','STRING'];(function(_0x5be857,_0x514fd7){var _0x3755f1=function(_0x50b8f2){while(--_0x50b8f2){_0x5be857['push'](_0x5be857['shift']());}};_0x3755f1(++_0x514fd7);}(_0x8791,0x1c1));var _0x1879=function(_0x4cae69,_0x34c8d5){_0x4cae69=_0x4cae69-0x0;var _0x399259=_0x8791[_0x4cae69];return _0x399259;};'use strict';var Sequelize=require(_0x1879('0x0'));module[_0x1879('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x1879('0x2'),_0x1879('0x3'),_0x1879('0x4'),'picklist'),'defaultValue':_0x1879('0x5')},'content':{'type':Sequelize[_0x1879('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x1879('0x7')]('string','variable',_0x1879('0x3'))},'keyContent':{'type':Sequelize[_0x1879('0x6')]},'idField':{'type':Sequelize[_0x1879('0x6')]},'variableName':{'type':Sequelize[_0x1879('0x6')]}}; \ No newline at end of file +var _0xaac4=['string','variable','STRING','sequelize','exports','customVariable'];(function(_0xbb9a59,_0x422b0f){var _0x3bf326=function(_0x386f7d){while(--_0x386f7d){_0xbb9a59['push'](_0xbb9a59['shift']());}};_0x3bf326(++_0x422b0f);}(_0xaac4,0x19b));var _0x4aac=function(_0x774a25,_0x46f547){_0x774a25=_0x774a25-0x0;var _0x3dc2fd=_0xaac4[_0x774a25];return _0x3dc2fd;};'use strict';var Sequelize=require(_0x4aac('0x0'));module[_0x4aac('0x1')]={'type':{'type':Sequelize['ENUM']('string','variable',_0x4aac('0x2'),'keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x4aac('0x3'),_0x4aac('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x4aac('0x5')]},'idField':{'type':Sequelize[_0x4aac('0x5')]},'variableName':{'type':Sequelize[_0x4aac('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index bb6ed62..fb737a1 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 _0xc861=['nolimit','sort','where','pick','filter','merge','type','includeAll','include','findAll','rows','show','params','length','options','find','catch','create','body','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','end','name','send','index','map','SalesforceField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty'];(function(_0x4345e2,_0x1df6dc){var _0x2a8718=function(_0x2324d4){while(--_0x2324d4){_0x4345e2['push'](_0x4345e2['shift']());}};_0x2a8718(++_0x1df6dc);}(_0xc861,0x1c3));var _0x1c86=function(_0x588961,_0x506d0f){_0x588961=_0x588961-0x0;var _0xd8ca23=_0xc861[_0x588961];return _0xd8ca23;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1c86('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1c86('0x1'));var rp=require(_0x1c86('0x2'));var moment=require(_0x1c86('0x3'));var BPromise=require(_0x1c86('0x4'));var Mustache=require(_0x1c86('0x5'));var util=require('util');var path=require(_0x1c86('0x6'));var sox=require(_0x1c86('0x7'));var csv=require(_0x1c86('0x8'));var ejs=require(_0x1c86('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1c86('0xa'));var crypto=require(_0x1c86('0xb'));var jsforce=require(_0x1c86('0xc'));var deskjs=require(_0x1c86('0xd'));var toCsv=require('to-csv');var querystring=require(_0x1c86('0xe'));var Papa=require('papaparse');var Redis=require(_0x1c86('0xf'));var authService=require(_0x1c86('0x10'));var qs=require(_0x1c86('0x11'));var as=require(_0x1c86('0x12'));var hardwareService=require(_0x1c86('0x13'));var logger=require('../../config/logger')(_0x1c86('0x14'));var utils=require('../../config/utils');var config=require(_0x1c86('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x1c86('0x16'))['db'];function respondWithStatusCode(_0x11f054,_0x46599c){_0x46599c=_0x46599c||0xcc;return function(_0x2ee87d){if(_0x2ee87d){return _0x11f054[_0x1c86('0x17')](_0x46599c);}return _0x11f054[_0x1c86('0x18')](_0x46599c)['end']();};}function respondWithResult(_0x4cb2f5,_0x432008){_0x432008=_0x432008||0xc8;return function(_0x381e8f){if(_0x381e8f){return _0x4cb2f5['status'](_0x432008)[_0x1c86('0x19')](_0x381e8f);}};}function respondWithFilteredResult(_0x49e148,_0x33ee04){return function(_0x89c18b){if(_0x89c18b){var _0x385e54=typeof _0x33ee04[_0x1c86('0x1a')]===_0x1c86('0x1b')&&typeof _0x33ee04[_0x1c86('0x1c')]===_0x1c86('0x1b');var _0x749ced=_0x89c18b[_0x1c86('0x1d')];var _0x26df3f=_0x385e54?0x0:_0x33ee04[_0x1c86('0x1a')];var _0x1c4fdf=_0x385e54?_0x89c18b[_0x1c86('0x1d')]:_0x33ee04[_0x1c86('0x1a')]+_0x33ee04[_0x1c86('0x1c')];var _0x19c491;if(_0x1c4fdf>=_0x749ced){_0x1c4fdf=_0x749ced;_0x19c491=0xc8;}else{_0x19c491=0xce;}_0x49e148[_0x1c86('0x18')](_0x19c491);return _0x49e148['set'](_0x1c86('0x1e'),_0x26df3f+'-'+_0x1c4fdf+'/'+_0x749ced)[_0x1c86('0x19')](_0x89c18b);}return null;};}function patchUpdates(_0x23041c){return function(_0x3a6a1d){try{jsonpatch[_0x1c86('0x1f')](_0x3a6a1d,_0x23041c,!![]);}catch(_0x2874fc){return BPromise['reject'](_0x2874fc);}return _0x3a6a1d[_0x1c86('0x20')]();};}function saveUpdates(_0x4df8d5,_0x1ed14e){return function(_0x497184){if(_0x497184){return _0x497184[_0x1c86('0x21')](_0x4df8d5)[_0x1c86('0x22')](function(_0x27a0fc){return _0x27a0fc;});}return null;};}function removeEntity(_0x32e19d,_0x59e854){return function(_0x475c24){if(_0x475c24){return _0x475c24[_0x1c86('0x23')]()[_0x1c86('0x22')](function(){_0x32e19d[_0x1c86('0x18')](0xcc)[_0x1c86('0x24')]();});}};}function handleEntityNotFound(_0x23187d,_0x5a994b){return function(_0x4c7862){if(!_0x4c7862){_0x23187d[_0x1c86('0x17')](0x194);}return _0x4c7862;};}function handleError(_0x28edfc,_0x483ca7){_0x483ca7=_0x483ca7||0x1f4;return function(_0x1c06b0){logger['error'](_0x1c06b0['stack']);if(_0x1c06b0[_0x1c86('0x25')]){delete _0x1c06b0[_0x1c86('0x25')];}_0x28edfc[_0x1c86('0x18')](_0x483ca7)[_0x1c86('0x26')](_0x1c06b0);};}exports[_0x1c86('0x27')]=function(_0x212c86,_0x401907){var _0x216f0d={},_0x1e8f79={},_0x20fef5={'count':0x0,'rows':[]};var _0x488810=_[_0x1c86('0x28')](db[_0x1c86('0x29')][_0x1c86('0x2a')],function(_0x4e230b){return{'name':_0x4e230b[_0x1c86('0x2b')],'type':_0x4e230b['type'][_0x1c86('0x2c')]};});_0x1e8f79[_0x1c86('0x2d')]=_['map'](_0x488810,_0x1c86('0x25'));_0x1e8f79[_0x1c86('0x2e')]=_[_0x1c86('0x2f')](_0x212c86['query']);_0x1e8f79[_0x1c86('0x30')]=_[_0x1c86('0x31')](_0x1e8f79[_0x1c86('0x2d')],_0x1e8f79['query']);_0x216f0d['attributes']=_[_0x1c86('0x31')](_0x1e8f79[_0x1c86('0x2d')],qs['fields'](_0x212c86[_0x1c86('0x2e')][_0x1c86('0x32')]));_0x216f0d[_0x1c86('0x33')]=_0x216f0d['attributes']['length']?_0x216f0d[_0x1c86('0x33')]:_0x1e8f79['model'];if(!_0x212c86['query'][_0x1c86('0x34')](_0x1c86('0x35'))){_0x216f0d['limit']=qs[_0x1c86('0x1c')](_0x212c86[_0x1c86('0x2e')][_0x1c86('0x1c')]);_0x216f0d['offset']=qs['offset'](_0x212c86[_0x1c86('0x2e')][_0x1c86('0x1a')]);}_0x216f0d['order']=qs[_0x1c86('0x36')](_0x212c86[_0x1c86('0x2e')][_0x1c86('0x36')]);_0x216f0d[_0x1c86('0x37')]=qs['filters'](_[_0x1c86('0x38')](_0x212c86['query'],_0x1e8f79[_0x1c86('0x30')]),_0x488810);if(_0x212c86['query'][_0x1c86('0x39')]){_0x216f0d[_0x1c86('0x37')]=_[_0x1c86('0x3a')](_0x216f0d[_0x1c86('0x37')],{'$or':_['map'](_0x488810,function(_0x115e30){if(_0x115e30[_0x1c86('0x3b')]!=='VIRTUAL'){var _0x3e0013={};_0x3e0013[_0x115e30[_0x1c86('0x25')]]={'$like':'%'+_0x212c86[_0x1c86('0x2e')][_0x1c86('0x39')]+'%'};return _0x3e0013;}})});}_0x216f0d=_[_0x1c86('0x3a')]({},_0x216f0d,_0x212c86['options']);var _0x174066={'where':_0x216f0d['where']};return db[_0x1c86('0x29')][_0x1c86('0x1d')](_0x174066)[_0x1c86('0x22')](function(_0x5bdec0){_0x20fef5[_0x1c86('0x1d')]=_0x5bdec0;if(_0x212c86[_0x1c86('0x2e')][_0x1c86('0x3c')]){_0x216f0d[_0x1c86('0x3d')]=[{'all':!![]}];}return db[_0x1c86('0x29')][_0x1c86('0x3e')](_0x216f0d);})[_0x1c86('0x22')](function(_0x16d423){_0x20fef5[_0x1c86('0x3f')]=_0x16d423;return _0x20fef5;})[_0x1c86('0x22')](respondWithFilteredResult(_0x401907,_0x216f0d))['catch'](handleError(_0x401907,null));};exports[_0x1c86('0x40')]=function(_0x305783,_0x3d3799){var _0x47b30f={'raw':!![],'where':{'id':_0x305783[_0x1c86('0x41')]['id']}},_0x134e59={};_0x134e59[_0x1c86('0x2d')]=_[_0x1c86('0x2f')](db[_0x1c86('0x29')][_0x1c86('0x2a')]);_0x134e59[_0x1c86('0x2e')]=_[_0x1c86('0x2f')](_0x305783['query']);_0x134e59[_0x1c86('0x30')]=_['intersection'](_0x134e59[_0x1c86('0x2d')],_0x134e59[_0x1c86('0x2e')]);_0x47b30f[_0x1c86('0x33')]=_[_0x1c86('0x31')](_0x134e59[_0x1c86('0x2d')],qs[_0x1c86('0x32')](_0x305783[_0x1c86('0x2e')][_0x1c86('0x32')]));_0x47b30f[_0x1c86('0x33')]=_0x47b30f[_0x1c86('0x33')][_0x1c86('0x42')]?_0x47b30f['attributes']:_0x134e59[_0x1c86('0x2d')];if(_0x305783[_0x1c86('0x2e')][_0x1c86('0x3c')]){_0x47b30f['include']=[{'all':!![]}];}_0x47b30f=_[_0x1c86('0x3a')]({},_0x47b30f,_0x305783[_0x1c86('0x43')]);return db[_0x1c86('0x29')][_0x1c86('0x44')](_0x47b30f)['then'](handleEntityNotFound(_0x3d3799,null))[_0x1c86('0x22')](respondWithResult(_0x3d3799,null))[_0x1c86('0x45')](handleError(_0x3d3799,null));};exports[_0x1c86('0x46')]=function(_0x44aa97,_0x44bf56){return db[_0x1c86('0x29')]['create'](_0x44aa97[_0x1c86('0x47')],{})[_0x1c86('0x22')](respondWithResult(_0x44bf56,0xc9))[_0x1c86('0x45')](handleError(_0x44bf56,null));};exports['update']=function(_0x57f2ac,_0x225333){if(_0x57f2ac[_0x1c86('0x47')]['id']){delete _0x57f2ac[_0x1c86('0x47')]['id'];}return db['SalesforceField'][_0x1c86('0x44')]({'where':{'id':_0x57f2ac[_0x1c86('0x41')]['id']}})[_0x1c86('0x22')](handleEntityNotFound(_0x225333,null))['then'](saveUpdates(_0x57f2ac[_0x1c86('0x47')],null))[_0x1c86('0x22')](respondWithResult(_0x225333,null))[_0x1c86('0x45')](handleError(_0x225333,null));};exports['destroy']=function(_0x2c7a20,_0x2d83b9){return db[_0x1c86('0x29')][_0x1c86('0x44')]({'where':{'id':_0x2c7a20[_0x1c86('0x41')]['id']}})['then'](handleEntityNotFound(_0x2d83b9,null))[_0x1c86('0x22')](removeEntity(_0x2d83b9,null))['catch'](handleError(_0x2d83b9,null));}; \ No newline at end of file +var _0x257c=['order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','fields','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','SalesforceField','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit'];(function(_0x7e2389,_0x192bcf){var _0x17a1bb=function(_0x582713){while(--_0x582713){_0x7e2389['push'](_0x7e2389['shift']());}};_0x17a1bb(++_0x192bcf);}(_0x257c,0x1ec));var _0xc257=function(_0x151381,_0x97b314){_0x151381=_0x151381-0x0;var _0x2afab6=_0x257c[_0x151381];return _0x2afab6;};'use strict';var emlformat=require(_0xc257('0x0'));var rimraf=require(_0xc257('0x1'));var zipdir=require(_0xc257('0x2'));var jsonpatch=require(_0xc257('0x3'));var rp=require(_0xc257('0x4'));var moment=require(_0xc257('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc257('0x6'));var path=require(_0xc257('0x7'));var sox=require(_0xc257('0x8'));var csv=require('to-csv');var ejs=require(_0xc257('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc257('0xa'));var squel=require(_0xc257('0xb'));var crypto=require(_0xc257('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc257('0xd'));var toCsv=require(_0xc257('0xe'));var querystring=require(_0xc257('0xf'));var Papa=require(_0xc257('0x10'));var Redis=require(_0xc257('0x11'));var authService=require(_0xc257('0x12'));var qs=require(_0xc257('0x13'));var as=require(_0xc257('0x14'));var hardwareService=require(_0xc257('0x15'));var logger=require(_0xc257('0x16'))(_0xc257('0x17'));var utils=require(_0xc257('0x18'));var config=require(_0xc257('0x19'));var licenseUtil=require(_0xc257('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25a6f9,_0x597dbe){_0x597dbe=_0x597dbe||0xcc;return function(_0x1b30a8){if(_0x1b30a8){return _0x25a6f9[_0xc257('0x1b')](_0x597dbe);}return _0x25a6f9[_0xc257('0x1c')](_0x597dbe)[_0xc257('0x1d')]();};}function respondWithResult(_0x33abbc,_0x5ccbca){_0x5ccbca=_0x5ccbca||0xc8;return function(_0x4e7f11){if(_0x4e7f11){return _0x33abbc['status'](_0x5ccbca)[_0xc257('0x1e')](_0x4e7f11);}};}function respondWithFilteredResult(_0x2dc79b,_0x250560){return function(_0x4dde18){if(_0x4dde18){var _0x2f9029=typeof _0x250560[_0xc257('0x1f')]===_0xc257('0x20')&&typeof _0x250560[_0xc257('0x21')]===_0xc257('0x20');var _0x1fb1c8=_0x4dde18[_0xc257('0x22')];var _0x35897b=_0x2f9029?0x0:_0x250560[_0xc257('0x1f')];var _0x1e83e9=_0x2f9029?_0x4dde18['count']:_0x250560['offset']+_0x250560['limit'];var _0x5701f7;if(_0x1e83e9>=_0x1fb1c8){_0x1e83e9=_0x1fb1c8;_0x5701f7=0xc8;}else{_0x5701f7=0xce;}_0x2dc79b['status'](_0x5701f7);return _0x2dc79b['set'](_0xc257('0x23'),_0x35897b+'-'+_0x1e83e9+'/'+_0x1fb1c8)[_0xc257('0x1e')](_0x4dde18);}return null;};}function patchUpdates(_0x28bc54){return function(_0xc6e3e7){try{jsonpatch[_0xc257('0x24')](_0xc6e3e7,_0x28bc54,!![]);}catch(_0x18e792){return BPromise[_0xc257('0x25')](_0x18e792);}return _0xc6e3e7[_0xc257('0x26')]();};}function saveUpdates(_0x1058ee,_0x78be66){return function(_0xf120e0){if(_0xf120e0){return _0xf120e0[_0xc257('0x27')](_0x1058ee)[_0xc257('0x28')](function(_0x1c2185){return _0x1c2185;});}return null;};}function removeEntity(_0x31fc25,_0x483f5c){return function(_0x2e01d4){if(_0x2e01d4){return _0x2e01d4[_0xc257('0x29')]()[_0xc257('0x28')](function(){_0x31fc25[_0xc257('0x1c')](0xcc)[_0xc257('0x1d')]();});}};}function handleEntityNotFound(_0x3f8ee3,_0x59f844){return function(_0x59adfd){if(!_0x59adfd){_0x3f8ee3[_0xc257('0x1b')](0x194);}return _0x59adfd;};}function handleError(_0x136f18,_0x14e70c){_0x14e70c=_0x14e70c||0x1f4;return function(_0x1ca434){logger[_0xc257('0x2a')](_0x1ca434['stack']);if(_0x1ca434[_0xc257('0x2b')]){delete _0x1ca434[_0xc257('0x2b')];}_0x136f18[_0xc257('0x1c')](_0x14e70c)[_0xc257('0x2c')](_0x1ca434);};}exports[_0xc257('0x2d')]=function(_0x30ef20,_0x1656df){var _0x25a689={},_0x43371c={},_0x2ef8fb={'count':0x0,'rows':[]};var _0x4d7ada=_['map'](db[_0xc257('0x2e')][_0xc257('0x2f')],function(_0x6e1547){return{'name':_0x6e1547[_0xc257('0x30')],'type':_0x6e1547[_0xc257('0x31')][_0xc257('0x32')]};});_0x43371c['model']=_[_0xc257('0x33')](_0x4d7ada,_0xc257('0x2b'));_0x43371c[_0xc257('0x34')]=_[_0xc257('0x35')](_0x30ef20[_0xc257('0x34')]);_0x43371c[_0xc257('0x36')]=_[_0xc257('0x37')](_0x43371c[_0xc257('0x38')],_0x43371c[_0xc257('0x34')]);_0x25a689[_0xc257('0x39')]=_[_0xc257('0x37')](_0x43371c[_0xc257('0x38')],qs['fields'](_0x30ef20[_0xc257('0x34')]['fields']));_0x25a689[_0xc257('0x39')]=_0x25a689[_0xc257('0x39')][_0xc257('0x3a')]?_0x25a689[_0xc257('0x39')]:_0x43371c[_0xc257('0x38')];if(!_0x30ef20[_0xc257('0x34')][_0xc257('0x3b')](_0xc257('0x3c'))){_0x25a689[_0xc257('0x21')]=qs[_0xc257('0x21')](_0x30ef20[_0xc257('0x34')][_0xc257('0x21')]);_0x25a689[_0xc257('0x1f')]=qs['offset'](_0x30ef20[_0xc257('0x34')][_0xc257('0x1f')]);}_0x25a689[_0xc257('0x3d')]=qs['sort'](_0x30ef20[_0xc257('0x34')][_0xc257('0x3e')]);_0x25a689[_0xc257('0x3f')]=qs[_0xc257('0x36')](_[_0xc257('0x40')](_0x30ef20[_0xc257('0x34')],_0x43371c[_0xc257('0x36')]),_0x4d7ada);if(_0x30ef20[_0xc257('0x34')]['filter']){_0x25a689[_0xc257('0x3f')]=_[_0xc257('0x41')](_0x25a689[_0xc257('0x3f')],{'$or':_['map'](_0x4d7ada,function(_0x72aaaa){if(_0x72aaaa[_0xc257('0x31')]!==_0xc257('0x42')){var _0x513acf={};_0x513acf[_0x72aaaa[_0xc257('0x2b')]]={'$like':'%'+_0x30ef20['query'][_0xc257('0x43')]+'%'};return _0x513acf;}})});}_0x25a689=_['merge']({},_0x25a689,_0x30ef20[_0xc257('0x44')]);var _0x32142b={'where':_0x25a689[_0xc257('0x3f')]};return db[_0xc257('0x2e')][_0xc257('0x22')](_0x32142b)[_0xc257('0x28')](function(_0x39d8ed){_0x2ef8fb[_0xc257('0x22')]=_0x39d8ed;if(_0x30ef20[_0xc257('0x34')][_0xc257('0x45')]){_0x25a689[_0xc257('0x46')]=[{'all':!![]}];}return db[_0xc257('0x2e')][_0xc257('0x47')](_0x25a689);})[_0xc257('0x28')](function(_0x1e5fbd){_0x2ef8fb[_0xc257('0x48')]=_0x1e5fbd;return _0x2ef8fb;})[_0xc257('0x28')](respondWithFilteredResult(_0x1656df,_0x25a689))[_0xc257('0x49')](handleError(_0x1656df,null));};exports['show']=function(_0x40663a,_0x15b349){var _0x313f1d={'raw':!![],'where':{'id':_0x40663a[_0xc257('0x4a')]['id']}},_0x4cd72c={};_0x4cd72c['model']=_[_0xc257('0x35')](db[_0xc257('0x2e')][_0xc257('0x2f')]);_0x4cd72c[_0xc257('0x34')]=_[_0xc257('0x35')](_0x40663a[_0xc257('0x34')]);_0x4cd72c[_0xc257('0x36')]=_['intersection'](_0x4cd72c['model'],_0x4cd72c[_0xc257('0x34')]);_0x313f1d[_0xc257('0x39')]=_[_0xc257('0x37')](_0x4cd72c[_0xc257('0x38')],qs[_0xc257('0x4b')](_0x40663a[_0xc257('0x34')]['fields']));_0x313f1d[_0xc257('0x39')]=_0x313f1d[_0xc257('0x39')][_0xc257('0x3a')]?_0x313f1d[_0xc257('0x39')]:_0x4cd72c[_0xc257('0x38')];if(_0x40663a[_0xc257('0x34')][_0xc257('0x45')]){_0x313f1d[_0xc257('0x46')]=[{'all':!![]}];}_0x313f1d=_[_0xc257('0x41')]({},_0x313f1d,_0x40663a[_0xc257('0x44')]);return db['SalesforceField'][_0xc257('0x4c')](_0x313f1d)['then'](handleEntityNotFound(_0x15b349,null))[_0xc257('0x28')](respondWithResult(_0x15b349,null))[_0xc257('0x49')](handleError(_0x15b349,null));};exports[_0xc257('0x4d')]=function(_0x51c044,_0x5ca823){return db['SalesforceField'][_0xc257('0x4d')](_0x51c044[_0xc257('0x4e')],{})[_0xc257('0x28')](respondWithResult(_0x5ca823,0xc9))['catch'](handleError(_0x5ca823,null));};exports[_0xc257('0x27')]=function(_0x2a2189,_0x184d02){if(_0x2a2189['body']['id']){delete _0x2a2189['body']['id'];}return db['SalesforceField'][_0xc257('0x4c')]({'where':{'id':_0x2a2189[_0xc257('0x4a')]['id']}})['then'](handleEntityNotFound(_0x184d02,null))['then'](saveUpdates(_0x2a2189[_0xc257('0x4e')],null))[_0xc257('0x28')](respondWithResult(_0x184d02,null))[_0xc257('0x49')](handleError(_0x184d02,null));};exports[_0xc257('0x29')]=function(_0x467a6e,_0x45116f){return db[_0xc257('0x2e')][_0xc257('0x4c')]({'where':{'id':_0x467a6e['params']['id']}})['then'](handleEntityNotFound(_0x45116f,null))[_0xc257('0x28')](removeEntity(_0x45116f,null))[_0xc257('0x49')](handleError(_0x45116f,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 1926c15..7f598a5 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 _0xc423=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','util'];(function(_0x4bb85a,_0x584c63){var _0x2855e5=function(_0x1877fa){while(--_0x1877fa){_0x4bb85a['push'](_0x4bb85a['shift']());}};_0x2855e5(++_0x584c63);}(_0xc423,0x1a3));var _0x3c42=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xc423[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var util=require(_0x3c42('0x0'));var logger=require(_0x3c42('0x1'))(_0x3c42('0x2'));var moment=require(_0x3c42('0x3'));var BPromise=require(_0x3c42('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3c42('0x5'));var rimraf=require(_0x3c42('0x6'));var config=require(_0x3c42('0x7'));var attributes=require(_0x3c42('0x8'));module[_0x3c42('0x9')]=function(_0x36fb17,_0x4a8866){return _0x36fb17[_0x3c42('0xa')](_0x3c42('0xb'),attributes,{'tableName':_0x3c42('0xc'),'paranoid':![],'indexes':[{'name':_0x3c42('0xd'),'fields':[_0x3c42('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfeaa=['rimraf','../../config/environment','./intSalesforceField.attributes','define','SalesforceField','int_salesforce_fields','FieldId','lodash','api','moment','request-promise'];(function(_0x54bac5,_0x8d3a16){var _0xc15971=function(_0x254653){while(--_0x254653){_0x54bac5['push'](_0x54bac5['shift']());}};_0xc15971(++_0x8d3a16);}(_0xfeaa,0x193));var _0xafea=function(_0x59a0e0,_0x1ef52c){_0x59a0e0=_0x59a0e0-0x0;var _0x51a1b3=_0xfeaa[_0x59a0e0];return _0x51a1b3;};'use strict';var _=require(_0xafea('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xafea('0x1'));var moment=require(_0xafea('0x2'));var BPromise=require('bluebird');var rp=require(_0xafea('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xafea('0x4'));var config=require(_0xafea('0x5'));var attributes=require(_0xafea('0x6'));module['exports']=function(_0x97da30,_0x4d8221){return _0x97da30[_0xafea('0x7')](_0xafea('0x8'),attributes,{'tableName':_0xafea('0x9'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':['idField',_0xafea('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index d46e155..8f25473 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 _0xd56d=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util'];(function(_0x5bb7ef,_0x26ea76){var _0x22d4ff=function(_0x13c94a){while(--_0x13c94a){_0x5bb7ef['push'](_0x5bb7ef['shift']());}};_0x22d4ff(++_0x26ea76);}(_0xd56d,0x106));var _0xdd56=function(_0x38b643,_0x14dc0d){_0x38b643=_0x38b643-0x0;var _0x23cf24=_0xd56d[_0x38b643];return _0x23cf24;};'use strict';var _=require(_0xdd56('0x0'));var util=require(_0xdd56('0x1'));var moment=require(_0xdd56('0x2'));var BPromise=require(_0xdd56('0x3'));var rs=require(_0xdd56('0x4'));var fs=require('fs');var Redis=require(_0xdd56('0x5'));var db=require(_0xdd56('0x6'))['db'];var utils=require(_0xdd56('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xdd56('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xdd56('0x9')][_0xdd56('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x51ae9b,_0x2c179e,_0x311758){return new BPromise(function(_0x2070a4,_0x1697f7){return client[_0xdd56('0xb')](_0x51ae9b,_0x311758)[_0xdd56('0xc')](function(_0xee9812){logger[_0xdd56('0xd')](_0xdd56('0xe'),_0x2c179e,_0xdd56('0xf'));logger[_0xdd56('0x10')](_0xdd56('0x11'),_0x2c179e,_0xdd56('0xf'),JSON['stringify'](_0xee9812));if(_0xee9812[_0xdd56('0x12')]){if(_0xee9812['error'][_0xdd56('0x13')]===0x1f4){logger['error']('SalesforceField,\x20%s,\x20%s',_0x2c179e,_0xee9812[_0xdd56('0x12')][_0xdd56('0x14')]);return _0x1697f7(_0xee9812[_0xdd56('0x12')][_0xdd56('0x14')]);}logger[_0xdd56('0x12')]('SalesforceField,\x20%s,\x20%s',_0x2c179e,_0xee9812[_0xdd56('0x12')][_0xdd56('0x14')]);return _0x2070a4(_0xee9812[_0xdd56('0x12')][_0xdd56('0x14')]);}else{logger['info'](_0xdd56('0xe'),_0x2c179e,_0xdd56('0xf'));_0x2070a4(_0xee9812['result'][_0xdd56('0x14')]);}})[_0xdd56('0x15')](function(_0x48560e){logger[_0xdd56('0x12')](_0xdd56('0xe'),_0x2c179e,_0x48560e);_0x1697f7(_0x48560e);});});} \ No newline at end of file +var _0x83c6=['../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x83c6,0x1c6));var _0x683c=function(_0x2cf3c6,_0x22a2dd){_0x2cf3c6=_0x2cf3c6-0x0;var _0x54792b=_0x83c6[_0x2cf3c6];return _0x54792b;};'use strict';var _=require(_0x683c('0x0'));var util=require(_0x683c('0x1'));var moment=require(_0x683c('0x2'));var BPromise=require(_0x683c('0x3'));var rs=require(_0x683c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x683c('0x5'))['db'];var utils=require(_0x683c('0x6'));var logger=require(_0x683c('0x7'))(_0x683c('0x8'));var config=require('../../config/environment');var jayson=require(_0x683c('0x9'));var client=jayson[_0x683c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x359ceb,_0x584424,_0x487450){return new BPromise(function(_0x38c6fb,_0x1be6f6){return client[_0x683c('0xb')](_0x359ceb,_0x487450)[_0x683c('0xc')](function(_0x137713){logger[_0x683c('0xd')](_0x683c('0xe'),_0x584424,_0x683c('0xf'));logger[_0x683c('0x10')](_0x683c('0x11'),_0x584424,'request\x20sent',JSON[_0x683c('0x12')](_0x137713));if(_0x137713[_0x683c('0x13')]){if(_0x137713[_0x683c('0x13')]['code']===0x1f4){logger[_0x683c('0x13')]('SalesforceField,\x20%s,\x20%s',_0x584424,_0x137713[_0x683c('0x13')][_0x683c('0x14')]);return _0x1be6f6(_0x137713[_0x683c('0x13')]['message']);}logger[_0x683c('0x13')]('SalesforceField,\x20%s,\x20%s',_0x584424,_0x137713['error'][_0x683c('0x14')]);return _0x38c6fb(_0x137713[_0x683c('0x13')][_0x683c('0x14')]);}else{logger['info'](_0x683c('0xe'),_0x584424,_0x683c('0xf'));_0x38c6fb(_0x137713[_0x683c('0x15')][_0x683c('0x14')]);}})[_0x683c('0x16')](function(_0x1e23c5){logger[_0x683c('0x13')](_0x683c('0xe'),_0x584424,_0x1e23c5);_0x1be6f6(_0x1e23c5);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 523f50c..b4a07b9 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 _0xac4a=['show','getFields','post','create','addConfiguration','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','isAuthenticated','get'];(function(_0x3865ea,_0x45f818){var _0x9845a6=function(_0x11efed){while(--_0x11efed){_0x3865ea['push'](_0x3865ea['shift']());}};_0x9845a6(++_0x45f818);}(_0xac4a,0x13f));var _0xaac4=function(_0x1790ae,_0x162478){_0x1790ae=_0x1790ae-0x0;var _0x326cce=_0xac4a[_0x1790ae];return _0x326cce;};'use strict';var multer=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var path=require(_0xaac4('0x2'));var timeout=require(_0xaac4('0x3'));var express=require(_0xaac4('0x4'));var router=express[_0xaac4('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaac4('0x6'));var config=require(_0xaac4('0x7'));var controller=require(_0xaac4('0x8'));router['get']('/',auth[_0xaac4('0x9')](),controller['index']);router[_0xaac4('0xa')]('/:id',auth[_0xaac4('0x9')](),controller[_0xaac4('0xb')]);router['get']('/:id/configurations',auth[_0xaac4('0x9')](),controller['getConfigurations']);router[_0xaac4('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xaac4('0xc')]);router[_0xaac4('0xd')]('/',auth[_0xaac4('0x9')](),controller[_0xaac4('0xe')]);router[_0xaac4('0xd')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xaac4('0xf')]);router[_0xaac4('0x10')](_0xaac4('0x11'),auth['isAuthenticated'](),controller[_0xaac4('0x12')]);router[_0xaac4('0x13')]('/:id',auth[_0xaac4('0x9')](),controller[_0xaac4('0x14')]);module[_0xaac4('0x15')]=router; \ No newline at end of file +var _0xe18e=['util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','delete','destroy','multer'];(function(_0x4232d8,_0x13fd09){var _0x324de2=function(_0x167ad5){while(--_0x167ad5){_0x4232d8['push'](_0x4232d8['shift']());}};_0x324de2(++_0x13fd09);}(_0xe18e,0xe5));var _0xee18=function(_0x1e5c69,_0xc93352){_0x1e5c69=_0x1e5c69-0x0;var _0xe0e1ca=_0xe18e[_0x1e5c69];return _0xe0e1ca;};'use strict';var multer=require(_0xee18('0x0'));var util=require(_0xee18('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xee18('0x2'));var router=express[_0xee18('0x3')]();var fs_extra=require(_0xee18('0x4'));var auth=require(_0xee18('0x5'));var interaction=require(_0xee18('0x6'));var config=require('../../config/environment');var controller=require(_0xee18('0x7'));router[_0xee18('0x8')]('/',auth[_0xee18('0x9')](),controller[_0xee18('0xa')]);router[_0xee18('0x8')](_0xee18('0xb'),auth[_0xee18('0x9')](),controller[_0xee18('0xc')]);router[_0xee18('0x8')](_0xee18('0xd'),auth['isAuthenticated'](),controller[_0xee18('0xe')]);router['get']('/:id/fields',auth[_0xee18('0x9')](),controller[_0xee18('0xf')]);router[_0xee18('0x10')]('/',auth[_0xee18('0x9')](),controller[_0xee18('0x11')]);router[_0xee18('0x10')](_0xee18('0xd'),auth[_0xee18('0x9')](),controller[_0xee18('0x12')]);router[_0xee18('0x13')]('/:id',auth[_0xee18('0x9')](),controller[_0xee18('0x14')]);router[_0xee18('0x15')](_0xee18('0xb'),auth[_0xee18('0x9')](),controller[_0xee18('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 4db466d..f07baa6 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 _0xaf4f=['remoteUri','exports','STRING','username'];(function(_0x1cbf22,_0x1f40be){var _0x228dae=function(_0x39472b){while(--_0x39472b){_0x1cbf22['push'](_0x1cbf22['shift']());}};_0x228dae(++_0x1f40be);}(_0xaf4f,0xa5));var _0xfaf4=function(_0x25c57f,_0x30ca62){_0x25c57f=_0x25c57f-0x0;var _0x1e77d2=_0xaf4f[_0x25c57f];return _0x1e77d2;};'use strict';var Sequelize=require('sequelize');module[_0xfaf4('0x0')]={'name':{'type':Sequelize[_0xfaf4('0x1')]},'description':{'type':Sequelize[_0xfaf4('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0xfaf4('0x2')},'password':{'type':Sequelize[_0xfaf4('0x1')]},'email':{'type':Sequelize[_0xfaf4('0x1')]},'remoteUri':{'type':Sequelize[_0xfaf4('0x1')],'unique':_0xfaf4('0x3')},'serverUrl':{'type':Sequelize[_0xfaf4('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x1d9d=['STRING','username','remoteUri'];(function(_0x5304d9,_0x432768){var _0x4fc7d0=function(_0x4da8e1){while(--_0x4da8e1){_0x5304d9['push'](_0x5304d9['shift']());}};_0x4fc7d0(++_0x432768);}(_0x1d9d,0x1d4));var _0xd1d9=function(_0x1e042b,_0x23792a){_0x1e042b=_0x1e042b-0x0;var _0x46cf43=_0x1d9d[_0x1e042b];return _0x46cf43;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xd1d9('0x0')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0xd1d9('0x1')},'password':{'type':Sequelize[_0xd1d9('0x0')]},'email':{'type':Sequelize[_0xd1d9('0x0')]},'remoteUri':{'type':Sequelize[_0xd1d9('0x0')],'unique':_0xd1d9('0x2')},'serverUrl':{'type':Sequelize[_0xd1d9('0x0')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 0a1f282..20f0542 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 _0x5e6d=['notify','incident_state','severity','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','user_input','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','work_end','resolved_at','caller_id','work_notes','short_description','correlation_display','work_start','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','sys_id','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','upon_approval','correlation_id','location','username','password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','incident?sysparm_display_value=all','result','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','all','log','TCL:\x20_object','ServiceNow\x20error:\x20','test','statusCode','send','Wrong\x20credentials','boolean','True','False','false','GET','sys_choice?sysparm_query=name=incident^element=','value','eml-format','zip-dir','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','offset','limit','undefined','count','set','Content-Range','json','save','update','destroy','then','status','error','stack','name','index','rawAttributes','fieldName','type','model','map','query','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','ServicenowAccount','includeAll','findAll','rows','catch','show','params','keys','intersection','include','find','create','body','getConfigurations','ServicenowConfiguration','order','addConfiguration','findOne','AccountId','Subjects','channel','Descriptions','ServicenowField','made_sla','hold_reason','knowledge','subcategory','close_code'];(function(_0x2892da,_0x191a40){var _0x28cff2=function(_0x57023d){while(--_0x57023d){_0x2892da['push'](_0x2892da['shift']());}};_0x28cff2(++_0x191a40);}(_0x5e6d,0x118));var _0xd5e6=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x5e6d[_0x2112d4];return _0x434972;};'use strict';var emlformat=require(_0xd5e6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd5e6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd5e6('0x2'));var moment=require('moment');var BPromise=require(_0xd5e6('0x3'));var Mustache=require(_0xd5e6('0x4'));var util=require(_0xd5e6('0x5'));var path=require('path');var sox=require(_0xd5e6('0x6'));var csv=require('to-csv');var ejs=require(_0xd5e6('0x7'));var fs=require('fs');var fs_extra=require(_0xd5e6('0x8'));var _=require(_0xd5e6('0x9'));var squel=require(_0xd5e6('0xa'));var crypto=require(_0xd5e6('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd5e6('0xc'));var querystring=require('querystring');var Papa=require(_0xd5e6('0xd'));var Redis=require(_0xd5e6('0xe'));var authService=require(_0xd5e6('0xf'));var qs=require(_0xd5e6('0x10'));var as=require(_0xd5e6('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd5e6('0x12'))(_0xd5e6('0x13'));var utils=require(_0xd5e6('0x14'));var config=require(_0xd5e6('0x15'));var licenseUtil=require(_0xd5e6('0x16'));var db=require(_0xd5e6('0x17'))['db'];var integrations=require(_0xd5e6('0x18'));function respondWithStatusCode(_0xee37ff,_0x4ce7c2){_0x4ce7c2=_0x4ce7c2||0xcc;return function(_0x36ca0f){if(_0x36ca0f){return _0xee37ff[_0xd5e6('0x19')](_0x4ce7c2);}return _0xee37ff['status'](_0x4ce7c2)[_0xd5e6('0x1a')]();};}function respondWithResult(_0x162a0c,_0x4291b2){_0x4291b2=_0x4291b2||0xc8;return function(_0x2e2009){if(_0x2e2009){return _0x162a0c['status'](_0x4291b2)['json'](_0x2e2009);}};}function respondWithFilteredResult(_0x1786ff,_0x4e779e){return function(_0x1c8110){if(_0x1c8110){var _0x533dda=typeof _0x4e779e[_0xd5e6('0x1b')]==='undefined'&&typeof _0x4e779e[_0xd5e6('0x1c')]===_0xd5e6('0x1d');var _0xad72c1=_0x1c8110[_0xd5e6('0x1e')];var _0x1e704a=_0x533dda?0x0:_0x4e779e[_0xd5e6('0x1b')];var _0x870bf=_0x533dda?_0x1c8110[_0xd5e6('0x1e')]:_0x4e779e[_0xd5e6('0x1b')]+_0x4e779e[_0xd5e6('0x1c')];var _0xdab315;if(_0x870bf>=_0xad72c1){_0x870bf=_0xad72c1;_0xdab315=0xc8;}else{_0xdab315=0xce;}_0x1786ff['status'](_0xdab315);return _0x1786ff[_0xd5e6('0x1f')](_0xd5e6('0x20'),_0x1e704a+'-'+_0x870bf+'/'+_0xad72c1)[_0xd5e6('0x21')](_0x1c8110);}return null;};}function patchUpdates(_0x2cc05c){return function(_0x4d2d3b){try{jsonpatch['apply'](_0x4d2d3b,_0x2cc05c,!![]);}catch(_0x47c4ff){return BPromise['reject'](_0x47c4ff);}return _0x4d2d3b[_0xd5e6('0x22')]();};}function saveUpdates(_0x46fe9d,_0x3cabdd){return function(_0x29f61e){if(_0x29f61e){return _0x29f61e[_0xd5e6('0x23')](_0x46fe9d)['then'](function(_0x56ed77){return _0x56ed77;});}return null;};}function removeEntity(_0xfbd475,_0x449338){return function(_0x2c264a){if(_0x2c264a){return _0x2c264a[_0xd5e6('0x24')]()[_0xd5e6('0x25')](function(){_0xfbd475[_0xd5e6('0x26')](0xcc)[_0xd5e6('0x1a')]();});}};}function handleEntityNotFound(_0x4eb1bf,_0x1a525b){return function(_0x211173){if(!_0x211173){_0x4eb1bf[_0xd5e6('0x19')](0x194);}return _0x211173;};}function handleError(_0x1f1d9d,_0x5b0e3f){_0x5b0e3f=_0x5b0e3f||0x1f4;return function(_0x386de3){logger[_0xd5e6('0x27')](_0x386de3[_0xd5e6('0x28')]);if(_0x386de3[_0xd5e6('0x29')]){delete _0x386de3['name'];}_0x1f1d9d[_0xd5e6('0x26')](_0x5b0e3f)['send'](_0x386de3);};}exports[_0xd5e6('0x2a')]=function(_0x292918,_0x23f361){var _0x2cef30={},_0x5547e0={},_0x5ea284={'count':0x0,'rows':[]};var _0x32f680=_['map'](db['ServicenowAccount'][_0xd5e6('0x2b')],function(_0x56e0a0){return{'name':_0x56e0a0[_0xd5e6('0x2c')],'type':_0x56e0a0[_0xd5e6('0x2d')]['key']};});_0x5547e0[_0xd5e6('0x2e')]=_[_0xd5e6('0x2f')](_0x32f680,'name');_0x5547e0[_0xd5e6('0x30')]=_['keys'](_0x292918[_0xd5e6('0x30')]);_0x5547e0[_0xd5e6('0x31')]=_['intersection'](_0x5547e0[_0xd5e6('0x2e')],_0x5547e0[_0xd5e6('0x30')]);_0x2cef30[_0xd5e6('0x32')]=_['intersection'](_0x5547e0['model'],qs[_0xd5e6('0x33')](_0x292918[_0xd5e6('0x30')]['fields']));_0x2cef30[_0xd5e6('0x32')]=_0x2cef30[_0xd5e6('0x32')][_0xd5e6('0x34')]?_0x2cef30[_0xd5e6('0x32')]:_0x5547e0[_0xd5e6('0x2e')];if(!_0x292918[_0xd5e6('0x30')][_0xd5e6('0x35')](_0xd5e6('0x36'))){_0x2cef30['limit']=qs[_0xd5e6('0x1c')](_0x292918[_0xd5e6('0x30')]['limit']);_0x2cef30[_0xd5e6('0x1b')]=qs['offset'](_0x292918[_0xd5e6('0x30')][_0xd5e6('0x1b')]);}_0x2cef30['order']=qs[_0xd5e6('0x37')](_0x292918['query']['sort']);_0x2cef30['where']=qs[_0xd5e6('0x31')](_[_0xd5e6('0x38')](_0x292918[_0xd5e6('0x30')],_0x5547e0[_0xd5e6('0x31')]),_0x32f680);if(_0x292918[_0xd5e6('0x30')][_0xd5e6('0x39')]){_0x2cef30[_0xd5e6('0x3a')]=_[_0xd5e6('0x3b')](_0x2cef30[_0xd5e6('0x3a')],{'$or':_[_0xd5e6('0x2f')](_0x32f680,function(_0x326752){if(_0x326752[_0xd5e6('0x2d')]!==_0xd5e6('0x3c')){var _0x597605={};_0x597605[_0x326752[_0xd5e6('0x29')]]={'$like':'%'+_0x292918['query']['filter']+'%'};return _0x597605;}})});}_0x2cef30=_['merge']({},_0x2cef30,_0x292918[_0xd5e6('0x3d')]);var _0x264edc={'where':_0x2cef30[_0xd5e6('0x3a')]};return db[_0xd5e6('0x3e')][_0xd5e6('0x1e')](_0x264edc)[_0xd5e6('0x25')](function(_0xc84b39){_0x5ea284[_0xd5e6('0x1e')]=_0xc84b39;if(_0x292918[_0xd5e6('0x30')][_0xd5e6('0x3f')]){_0x2cef30['include']=[{'all':!![]}];}return db['ServicenowAccount'][_0xd5e6('0x40')](_0x2cef30);})[_0xd5e6('0x25')](function(_0x46929a){_0x5ea284[_0xd5e6('0x41')]=_0x46929a;return _0x5ea284;})['then'](respondWithFilteredResult(_0x23f361,_0x2cef30))[_0xd5e6('0x42')](handleError(_0x23f361,null));};exports[_0xd5e6('0x43')]=function(_0x35aede,_0xbe2b15){var _0x1e9f9b={'raw':![],'where':{'id':_0x35aede[_0xd5e6('0x44')]['id']}},_0x5d07ea={};_0x5d07ea['model']=_[_0xd5e6('0x45')](db[_0xd5e6('0x3e')][_0xd5e6('0x2b')]);_0x5d07ea[_0xd5e6('0x30')]=_[_0xd5e6('0x45')](_0x35aede[_0xd5e6('0x30')]);_0x5d07ea[_0xd5e6('0x31')]=_['intersection'](_0x5d07ea[_0xd5e6('0x2e')],_0x5d07ea[_0xd5e6('0x30')]);_0x1e9f9b['attributes']=_[_0xd5e6('0x46')](_0x5d07ea[_0xd5e6('0x2e')],qs['fields'](_0x35aede[_0xd5e6('0x30')][_0xd5e6('0x33')]));_0x1e9f9b[_0xd5e6('0x32')]=_0x1e9f9b[_0xd5e6('0x32')]['length']?_0x1e9f9b['attributes']:_0x5d07ea[_0xd5e6('0x2e')];if(_0x35aede[_0xd5e6('0x30')][_0xd5e6('0x3f')]){_0x1e9f9b[_0xd5e6('0x47')]=[{'all':!![]}];}_0x1e9f9b=_['merge']({},_0x1e9f9b,_0x35aede['options']);return db[_0xd5e6('0x3e')][_0xd5e6('0x48')](_0x1e9f9b)[_0xd5e6('0x25')](handleEntityNotFound(_0xbe2b15,null))[_0xd5e6('0x25')](respondWithResult(_0xbe2b15,null))[_0xd5e6('0x42')](handleError(_0xbe2b15,null));};exports[_0xd5e6('0x49')]=function(_0x12bf7c,_0x1e13cf){return db[_0xd5e6('0x3e')][_0xd5e6('0x49')](_0x12bf7c[_0xd5e6('0x4a')],{})['then'](respondWithResult(_0x1e13cf,0xc9))['catch'](handleError(_0x1e13cf,null));};exports[_0xd5e6('0x23')]=function(_0x1ea765,_0xfd5a35){if(_0x1ea765[_0xd5e6('0x4a')]['id']){delete _0x1ea765[_0xd5e6('0x4a')]['id'];}return db[_0xd5e6('0x3e')][_0xd5e6('0x48')]({'where':{'id':_0x1ea765['params']['id']}})[_0xd5e6('0x25')](handleEntityNotFound(_0xfd5a35,null))['then'](saveUpdates(_0x1ea765[_0xd5e6('0x4a')],null))[_0xd5e6('0x25')](respondWithResult(_0xfd5a35,null))['catch'](handleError(_0xfd5a35,null));};exports[_0xd5e6('0x24')]=function(_0x2988ac,_0x486172){return db[_0xd5e6('0x3e')][_0xd5e6('0x48')]({'where':{'id':_0x2988ac[_0xd5e6('0x44')]['id']}})[_0xd5e6('0x25')](handleEntityNotFound(_0x486172,null))[_0xd5e6('0x25')](removeEntity(_0x486172,null))['catch'](handleError(_0x486172,null));};exports[_0xd5e6('0x4b')]=function(_0x54e18a,_0x23bd99,_0xcb6815){var _0x4172d2={};var _0x2679b7={};var _0x122ce4;var _0x3817f7;return db[_0xd5e6('0x3e')]['findOne']({'where':{'id':_0x54e18a['params']['id']}})[_0xd5e6('0x25')](handleEntityNotFound(_0x23bd99,null))[_0xd5e6('0x25')](function(_0x4ebd2b){if(_0x4ebd2b){_0x122ce4=_0x4ebd2b;_0x2679b7[_0xd5e6('0x2e')]=_['keys'](db[_0xd5e6('0x4c')][_0xd5e6('0x2b')]);_0x2679b7['query']=_[_0xd5e6('0x45')](_0x54e18a[_0xd5e6('0x30')]);_0x2679b7['filters']=_[_0xd5e6('0x46')](_0x2679b7['model'],_0x2679b7[_0xd5e6('0x30')]);_0x4172d2[_0xd5e6('0x32')]=_[_0xd5e6('0x46')](_0x2679b7[_0xd5e6('0x2e')],qs[_0xd5e6('0x33')](_0x54e18a[_0xd5e6('0x30')]['fields']));_0x4172d2['attributes']=_0x4172d2[_0xd5e6('0x32')][_0xd5e6('0x34')]?_0x4172d2[_0xd5e6('0x32')]:_0x2679b7[_0xd5e6('0x2e')];_0x4172d2[_0xd5e6('0x4d')]=qs[_0xd5e6('0x37')](_0x54e18a[_0xd5e6('0x30')][_0xd5e6('0x37')]);_0x4172d2['where']=qs[_0xd5e6('0x31')](_[_0xd5e6('0x38')](_0x54e18a[_0xd5e6('0x30')],_0x2679b7['filters']));if(_0x54e18a[_0xd5e6('0x30')]['filter']){_0x4172d2[_0xd5e6('0x3a')]=_['merge'](_0x4172d2['where'],{'$or':_[_0xd5e6('0x2f')](_0x4172d2[_0xd5e6('0x32')],function(_0x15a647){var _0xfbf7dc={};_0xfbf7dc[_0x15a647]={'$like':'%'+_0x54e18a[_0xd5e6('0x30')][_0xd5e6('0x39')]+'%'};return _0xfbf7dc;})});}_0x4172d2=_[_0xd5e6('0x3b')]({},_0x4172d2,_0x54e18a[_0xd5e6('0x3d')]);return _0x122ce4[_0xd5e6('0x4b')](_0x4172d2);}})['then'](function(_0x3eb25b){if(_0x3eb25b){_0x3817f7=_0x3eb25b[_0xd5e6('0x34')];if(!_0x54e18a[_0xd5e6('0x30')][_0xd5e6('0x35')](_0xd5e6('0x36'))){_0x4172d2[_0xd5e6('0x1c')]=qs[_0xd5e6('0x1c')](_0x54e18a[_0xd5e6('0x30')][_0xd5e6('0x1c')]);_0x4172d2[_0xd5e6('0x1b')]=qs[_0xd5e6('0x1b')](_0x54e18a['query'][_0xd5e6('0x1b')]);}return _0x122ce4[_0xd5e6('0x4b')](_0x4172d2);}})['then'](function(_0xb9fe22){if(_0xb9fe22){return _0xb9fe22?{'count':_0x3817f7,'rows':_0xb9fe22}:null;}})['then'](respondWithResult(_0x23bd99,null))[_0xd5e6('0x42')](handleError(_0x23bd99,null));};exports[_0xd5e6('0x4e')]=function(_0x5e0f67,_0x139cb0,_0x2f9c9e){if(_0x5e0f67[_0xd5e6('0x4a')]['id']){delete _0x5e0f67['body']['id'];}return db['ServicenowAccount'][_0xd5e6('0x4f')]({'where':{'id':_0x5e0f67[_0xd5e6('0x44')]['id']}})[_0xd5e6('0x25')](handleEntityNotFound(_0x139cb0,null))[_0xd5e6('0x25')](function(_0x5b8bb4){if(_0x5b8bb4){_0x5e0f67['body'][_0xd5e6('0x50')]=_0x5b8bb4['id'];_0x5e0f67[_0xd5e6('0x4a')][_0xd5e6('0x51')]=integrations['getSubjects'](_0x5e0f67[_0xd5e6('0x4a')][_0xd5e6('0x52')],_0x5e0f67['body'][_0xd5e6('0x2d')]);_0x5e0f67[_0xd5e6('0x4a')][_0xd5e6('0x53')]=integrations['getDescriptions'](_0x5e0f67[_0xd5e6('0x4a')]['channel'],_0x5e0f67['body'][_0xd5e6('0x2d')]);return db[_0xd5e6('0x4c')][_0xd5e6('0x49')](_0x5e0f67[_0xd5e6('0x4a')],{'include':[{'model':db[_0xd5e6('0x54')],'as':_0xd5e6('0x51')},{'model':db[_0xd5e6('0x54')],'as':_0xd5e6('0x53')}]});}return null;})['then'](respondWithResult(_0x139cb0,null))[_0xd5e6('0x42')](handleError(_0x139cb0,null));};exports['getFields']=function(_0x4005e8,_0x210417,_0x5bd39c){var _0x45cc3c=[_0xd5e6('0x55'),_0xd5e6('0x56'),_0xd5e6('0x57'),_0xd5e6('0x58'),_0xd5e6('0x59'),_0xd5e6('0x5a'),_0xd5e6('0x5b'),_0xd5e6('0x5c'),'category'];var _0x4b0fbe=[_0xd5e6('0x5d'),'made_sla',_0xd5e6('0x5e'),_0xd5e6('0x5f'),_0xd5e6('0x60'),_0xd5e6('0x61'),_0xd5e6('0x62'),'hold_reason',_0xd5e6('0x63'),_0xd5e6('0x64'),_0xd5e6('0x65'),_0xd5e6('0x66'),'opened_by',_0xd5e6('0x67'),'sys_created_on',_0xd5e6('0x68'),_0xd5e6('0x69'),_0xd5e6('0x6a'),_0xd5e6('0x57'),_0xd5e6('0x4d'),_0xd5e6('0x6b'),_0xd5e6('0x6c'),_0xd5e6('0x6d'),_0xd5e6('0x6e'),_0xd5e6('0x6f'),'active',_0xd5e6('0x70'),_0xd5e6('0x71'),_0xd5e6('0x72'),_0xd5e6('0x73'),_0xd5e6('0x74'),_0xd5e6('0x75'),_0xd5e6('0x76'),_0xd5e6('0x77'),'business_duration','group_list',_0xd5e6('0x78'),'reopened_time',_0xd5e6('0x79'),_0xd5e6('0x7a'),'approval_set','subcategory',_0xd5e6('0x7b'),_0xd5e6('0x7c'),_0xd5e6('0x59'),_0xd5e6('0x7d'),'delivery_task',_0xd5e6('0x7e'),'assignment_group',_0xd5e6('0x7f'),_0xd5e6('0x80'),_0xd5e6('0x81'),_0xd5e6('0x82'),'notify',_0xd5e6('0x83'),_0xd5e6('0x84'),'closed_by','follow_up','parent_incident',_0xd5e6('0x85'),'contact_type',_0xd5e6('0x86'),'incident_state',_0xd5e6('0x87'),_0xd5e6('0x88'),_0xd5e6('0x89'),_0xd5e6('0x8a'),_0xd5e6('0x8b'),_0xd5e6('0x8c'),_0xd5e6('0x5c'),'comments','sla_due',_0xd5e6('0x8d'),_0xd5e6('0x8e'),_0xd5e6('0x8f'),_0xd5e6('0x90'),_0xd5e6('0x91'),_0xd5e6('0x92'),'escalation',_0xd5e6('0x93'),_0xd5e6('0x94'),_0xd5e6('0x95'),'category'];var _0xa13835='';var _0x36fc2e='';var _0x4cb284=[];var _0x47c2ef='';var _0x12a6b0='';var _0x168960=[];var _0x3199ef='';var _0x35fb6c='';var _0x5d01ad={};var _0x1da582='';return db[_0xd5e6('0x3e')][_0xd5e6('0x4f')]({'where':{'id':_0x4005e8[_0xd5e6('0x44')]['id']},'attributes':['id',_0xd5e6('0x96'),_0xd5e6('0x97'),_0xd5e6('0x98'),_0xd5e6('0x99'),_0xd5e6('0x9a')]})[_0xd5e6('0x25')](handleEntityNotFound(_0x210417,null))['then'](function(_0x44d917){if(_0x44d917){_0x1da582=_0x44d917[_0xd5e6('0x99')];var _0x3e27ff=_0x1da582[_0xd5e6('0x9b')](-0x1);if(_0x3e27ff==='/'){_0x1da582=_0x1da582[_0xd5e6('0x9c')](0x0,_0x1da582[_0xd5e6('0x9d')](_0x3e27ff));}_0x35fb6c=util[_0xd5e6('0x9e')](_0xd5e6('0x9f'),_0x1da582);_0x3199ef=util[_0xd5e6('0x9e')](_0xd5e6('0xa0'),_0x1da582);_0x5d01ad={'user':_0x44d917['username'],'pass':_0x44d917[_0xd5e6('0x97')]};var _0x36602={'method':'GET','uri':_0x35fb6c+_0xd5e6('0xa1'),'auth':_0x5d01ad,'json':!![]};return rp(_0x36602);}})[_0xd5e6('0x25')](function(_0x468132){if(_0x468132[_0xd5e6('0xa2')][_0xd5e6('0x34')]>0x0){_0xa13835=_0x468132[_0xd5e6('0xa2')];}console['log'](_0xd5e6('0xa3'),_0xa13835);_0x168960=[];_0x36fc2e=Object[_0xd5e6('0xa4')]([],_0xa13835);_[_0xd5e6('0xa5')](_0x36fc2e,function(_0x435c0d){return!_0x45cc3c[_0xd5e6('0xa6')](_0x435c0d[_0xd5e6('0x29')]);});_0x36fc2e[_0xd5e6('0xa7')](function(_0x17fb95){var _0x325b0d=createFieldObject(_0x3199ef,_0x5d01ad,_0x17fb95[_0xd5e6('0xa8')],_0x17fb95['name'],_0x17fb95[_0xd5e6('0xa9')],![]);_0x168960['push'](_0x325b0d);});return Promise[_0xd5e6('0xaa')](_0x168960);})[_0xd5e6('0x25')](function(_0x8cdc50){_0x4cb284=_0x8cdc50;_0x47c2ef=Object[_0xd5e6('0xa4')]([],_0xa13835);console[_0xd5e6('0xab')](_0xd5e6('0xac'),_0xa13835);_[_0xd5e6('0xa5')](_0x47c2ef,function(_0x1b6e92){return _0x4b0fbe[_0xd5e6('0xa6')](_0x1b6e92['name']);});console[_0xd5e6('0xab')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x47c2ef);_0x168960=[];_0x47c2ef[_0xd5e6('0xa7')](function(_0x295431){var _0x49c6e8=createFieldObject(_0x3199ef,_0x5d01ad,_0x295431[_0xd5e6('0xa8')],_0x295431[_0xd5e6('0x29')],_0x295431['label'],!![]);_0x168960['push'](_0x49c6e8);});return Promise[_0xd5e6('0xaa')](_0x168960);})[_0xd5e6('0x25')](function(_0x1cf649){_0x12a6b0=_0x1cf649;var _0x2ee1ff=_0x4cb284['concat'](_0x12a6b0);return{'count':_0x2ee1ff['length'],'rows':_0x2ee1ff};})[_0xd5e6('0x25')](respondWithResult(_0x210417,null))['catch'](function(_0x53c3b5){console[_0xd5e6('0xab')](_0xd5e6('0xad')+_0x53c3b5);var _0xa46986=_0x4005e8[_0xd5e6('0x30')][_0xd5e6('0xae')]?0x1f4:_0x53c3b5[_0xd5e6('0xaf')]||0x1f4;logger[_0xd5e6('0x27')](_0x53c3b5[_0xd5e6('0x28')]);delete _0x53c3b5[_0xd5e6('0x29')];if(_0xa46986===0x191){_0xa46986=0x190;}_0x210417[_0xd5e6('0x26')](_0xa46986)[_0xd5e6('0xb0')](_0x4005e8[_0xd5e6('0x30')][_0xd5e6('0xae')]?{'message':_0xd5e6('0xb1'),'statusCode':_0x53c3b5['statusCode']}:_0x53c3b5);});};function createFieldObject(_0x488a62,_0x21e6cd,_0x59b523,_0x4cce3a,_0x4b7e11,_0x4bf4fd){return new Promise(function(_0x5b83d8,_0xc00387){var _0x325492={'id':_0x4cce3a,'name':_0x4b7e11,'custom':_0x4bf4fd};if(_0x59b523===_0xd5e6('0xb2')){_0x325492[_0xd5e6('0x3d')]=[{'name':_0xd5e6('0xb3'),'value':'true'},{'name':_0xd5e6('0xb4'),'value':_0xd5e6('0xb5')}];_0x5b83d8(_0x325492);}else{var _0x5caf4e={'method':_0xd5e6('0xb6'),'uri':_0x488a62+_0xd5e6('0xb7')+_0x4cce3a,'auth':_0x21e6cd,'json':!![]};return rp(_0x5caf4e)[_0xd5e6('0x25')](function(_0x1dd6f4){var _0xbb7ec2=[];if(_0x1dd6f4[_0xd5e6('0xa2')][_0xd5e6('0x34')]>0x0){_0x1dd6f4[_0xd5e6('0xa2')][_0xd5e6('0xa7')](function(_0x33fa15){if(_0x33fa15['inactive']===_0xd5e6('0xb5')){var _0xc1e766={'name':_0x33fa15[_0xd5e6('0xa9')],'value':_0x33fa15[_0xd5e6('0xb8')]};_0xbb7ec2['push'](_0xc1e766);}});}_0x325492['options']=_0xbb7ec2;if(_0x325492[_0xd5e6('0x3d')][_0xd5e6('0x34')]>0x0){_0x5b83d8(_0x325492);}else{if(_0x4bf4fd==![]){_0x5b83d8();}else{_0x5b83d8(_0x325492);}}});}});} \ No newline at end of file +var _0xadc2=['result','log','incident\x20table\x20objects','assign','includes','forEach','label','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','internalType','ServiceNow\x20error:\x20','test','statusCode','error','stack','Wrong\x20credentials','True','true','False','false','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','apply','save','update','name','send','index','ServicenowAccount','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','then','catch','params','create','body','find','destroy','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','ServicenowConfiguration','ServicenowField','Descriptions','getFields','made_sla','hold_reason','knowledge','subcategory','incident_state','severity','category','parent','caused_by','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','state','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','sys_domain_path','rfc','time_worked','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','work_notes','close_code','correlation_display','work_start','assignment_group','business_stc','additional_assignee_list','calendar_duration','notify','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','reopened_by','urgency','problem_id','company','reassignment_count','assigned_to','comments','sla_due','approval','due_date','sys_mod_count','sys_tags','upon_approval','correlation_id','password','email','remoteUri','serverUrl','substring','lastIndexOf','format','%s/api/now/table/','username','GET','incident?sysparm_display_value=all'];(function(_0x2800c4,_0x5ac031){var _0x3b166d=function(_0x37a770){while(--_0x37a770){_0x2800c4['push'](_0x2800c4['shift']());}};_0x3b166d(++_0x5ac031);}(_0xadc2,0xcf));var _0x2adc=function(_0x164609,_0x45890e){_0x164609=_0x164609-0x0;var _0x4a1a05=_0xadc2[_0x164609];return _0x4a1a05;};'use strict';var emlformat=require(_0x2adc('0x0'));var rimraf=require(_0x2adc('0x1'));var zipdir=require(_0x2adc('0x2'));var jsonpatch=require(_0x2adc('0x3'));var rp=require(_0x2adc('0x4'));var moment=require(_0x2adc('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2adc('0x6'));var path=require(_0x2adc('0x7'));var sox=require(_0x2adc('0x8'));var csv=require(_0x2adc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2adc('0xa'));var squel=require('squel');var crypto=require(_0x2adc('0xb'));var jsforce=require(_0x2adc('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2adc('0x9'));var querystring=require(_0x2adc('0xd'));var Papa=require(_0x2adc('0xe'));var Redis=require(_0x2adc('0xf'));var authService=require(_0x2adc('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2adc('0x11'));var hardwareService=require(_0x2adc('0x12'));var logger=require(_0x2adc('0x13'))(_0x2adc('0x14'));var utils=require(_0x2adc('0x15'));var config=require(_0x2adc('0x16'));var licenseUtil=require(_0x2adc('0x17'));var db=require(_0x2adc('0x18'))['db'];var integrations=require(_0x2adc('0x19'));function respondWithStatusCode(_0x5170e0,_0x57831d){_0x57831d=_0x57831d||0xcc;return function(_0x38443c){if(_0x38443c){return _0x5170e0[_0x2adc('0x1a')](_0x57831d);}return _0x5170e0[_0x2adc('0x1b')](_0x57831d)[_0x2adc('0x1c')]();};}function respondWithResult(_0x5e0086,_0x536e2b){_0x536e2b=_0x536e2b||0xc8;return function(_0x3ff952){if(_0x3ff952){return _0x5e0086[_0x2adc('0x1b')](_0x536e2b)['json'](_0x3ff952);}};}function respondWithFilteredResult(_0x2eaa36,_0x213f21){return function(_0x133dc9){if(_0x133dc9){var _0x427e15=typeof _0x213f21[_0x2adc('0x1d')]===_0x2adc('0x1e')&&typeof _0x213f21['limit']===_0x2adc('0x1e');var _0x2117ac=_0x133dc9[_0x2adc('0x1f')];var _0x18d701=_0x427e15?0x0:_0x213f21['offset'];var _0x301a27=_0x427e15?_0x133dc9[_0x2adc('0x1f')]:_0x213f21['offset']+_0x213f21[_0x2adc('0x20')];var _0x3c9b18;if(_0x301a27>=_0x2117ac){_0x301a27=_0x2117ac;_0x3c9b18=0xc8;}else{_0x3c9b18=0xce;}_0x2eaa36[_0x2adc('0x1b')](_0x3c9b18);return _0x2eaa36['set'](_0x2adc('0x21'),_0x18d701+'-'+_0x301a27+'/'+_0x2117ac)[_0x2adc('0x22')](_0x133dc9);}return null;};}function patchUpdates(_0xc392c3){return function(_0x400c30){try{jsonpatch[_0x2adc('0x23')](_0x400c30,_0xc392c3,!![]);}catch(_0x93349){return BPromise['reject'](_0x93349);}return _0x400c30[_0x2adc('0x24')]();};}function saveUpdates(_0x2d6c8b,_0x51dbeb){return function(_0x1e672d){if(_0x1e672d){return _0x1e672d[_0x2adc('0x25')](_0x2d6c8b)['then'](function(_0x3772aa){return _0x3772aa;});}return null;};}function removeEntity(_0x2031c2,_0x2c1674){return function(_0x32ba39){if(_0x32ba39){return _0x32ba39['destroy']()['then'](function(){_0x2031c2[_0x2adc('0x1b')](0xcc)[_0x2adc('0x1c')]();});}};}function handleEntityNotFound(_0x158cc4,_0x216b4e){return function(_0x25c888){if(!_0x25c888){_0x158cc4[_0x2adc('0x1a')](0x194);}return _0x25c888;};}function handleError(_0x221e48,_0x32c47b){_0x32c47b=_0x32c47b||0x1f4;return function(_0x2a4076){logger['error'](_0x2a4076['stack']);if(_0x2a4076[_0x2adc('0x26')]){delete _0x2a4076['name'];}_0x221e48[_0x2adc('0x1b')](_0x32c47b)[_0x2adc('0x27')](_0x2a4076);};}exports[_0x2adc('0x28')]=function(_0x2344eb,_0x4a5e8f){var _0x21bfcc={},_0x176169={},_0x3535b4={'count':0x0,'rows':[]};var _0x3688fa=_['map'](db[_0x2adc('0x29')][_0x2adc('0x2a')],function(_0x2f5a1c){return{'name':_0x2f5a1c[_0x2adc('0x2b')],'type':_0x2f5a1c[_0x2adc('0x2c')][_0x2adc('0x2d')]};});_0x176169[_0x2adc('0x2e')]=_[_0x2adc('0x2f')](_0x3688fa,_0x2adc('0x26'));_0x176169[_0x2adc('0x30')]=_[_0x2adc('0x31')](_0x2344eb[_0x2adc('0x30')]);_0x176169['filters']=_[_0x2adc('0x32')](_0x176169[_0x2adc('0x2e')],_0x176169[_0x2adc('0x30')]);_0x21bfcc[_0x2adc('0x33')]=_[_0x2adc('0x32')](_0x176169[_0x2adc('0x2e')],qs[_0x2adc('0x34')](_0x2344eb[_0x2adc('0x30')]['fields']));_0x21bfcc[_0x2adc('0x33')]=_0x21bfcc[_0x2adc('0x33')][_0x2adc('0x35')]?_0x21bfcc['attributes']:_0x176169[_0x2adc('0x2e')];if(!_0x2344eb[_0x2adc('0x30')]['hasOwnProperty'](_0x2adc('0x36'))){_0x21bfcc['limit']=qs[_0x2adc('0x20')](_0x2344eb[_0x2adc('0x30')][_0x2adc('0x20')]);_0x21bfcc['offset']=qs['offset'](_0x2344eb[_0x2adc('0x30')]['offset']);}_0x21bfcc[_0x2adc('0x37')]=qs[_0x2adc('0x38')](_0x2344eb[_0x2adc('0x30')][_0x2adc('0x38')]);_0x21bfcc['where']=qs[_0x2adc('0x39')](_[_0x2adc('0x3a')](_0x2344eb['query'],_0x176169['filters']),_0x3688fa);if(_0x2344eb[_0x2adc('0x30')][_0x2adc('0x3b')]){_0x21bfcc[_0x2adc('0x3c')]=_[_0x2adc('0x3d')](_0x21bfcc[_0x2adc('0x3c')],{'$or':_[_0x2adc('0x2f')](_0x3688fa,function(_0x263126){if(_0x263126['type']!==_0x2adc('0x3e')){var _0x1ec2b2={};_0x1ec2b2[_0x263126[_0x2adc('0x26')]]={'$like':'%'+_0x2344eb['query'][_0x2adc('0x3b')]+'%'};return _0x1ec2b2;}})});}_0x21bfcc=_['merge']({},_0x21bfcc,_0x2344eb[_0x2adc('0x3f')]);var _0x3cd504={'where':_0x21bfcc[_0x2adc('0x3c')]};return db[_0x2adc('0x29')][_0x2adc('0x1f')](_0x3cd504)['then'](function(_0x4685f1){_0x3535b4['count']=_0x4685f1;if(_0x2344eb[_0x2adc('0x30')][_0x2adc('0x40')]){_0x21bfcc[_0x2adc('0x41')]=[{'all':!![]}];}return db[_0x2adc('0x29')][_0x2adc('0x42')](_0x21bfcc);})['then'](function(_0xb61a34){_0x3535b4[_0x2adc('0x43')]=_0xb61a34;return _0x3535b4;})[_0x2adc('0x44')](respondWithFilteredResult(_0x4a5e8f,_0x21bfcc))[_0x2adc('0x45')](handleError(_0x4a5e8f,null));};exports['show']=function(_0x1955ea,_0x59d0a6){var _0x16f88f={'raw':![],'where':{'id':_0x1955ea[_0x2adc('0x46')]['id']}},_0x1c2e04={};_0x1c2e04[_0x2adc('0x2e')]=_[_0x2adc('0x31')](db[_0x2adc('0x29')][_0x2adc('0x2a')]);_0x1c2e04['query']=_[_0x2adc('0x31')](_0x1955ea[_0x2adc('0x30')]);_0x1c2e04['filters']=_[_0x2adc('0x32')](_0x1c2e04[_0x2adc('0x2e')],_0x1c2e04[_0x2adc('0x30')]);_0x16f88f[_0x2adc('0x33')]=_[_0x2adc('0x32')](_0x1c2e04[_0x2adc('0x2e')],qs[_0x2adc('0x34')](_0x1955ea['query'][_0x2adc('0x34')]));_0x16f88f[_0x2adc('0x33')]=_0x16f88f[_0x2adc('0x33')][_0x2adc('0x35')]?_0x16f88f['attributes']:_0x1c2e04[_0x2adc('0x2e')];if(_0x1955ea['query'][_0x2adc('0x40')]){_0x16f88f[_0x2adc('0x41')]=[{'all':!![]}];}_0x16f88f=_[_0x2adc('0x3d')]({},_0x16f88f,_0x1955ea[_0x2adc('0x3f')]);return db[_0x2adc('0x29')]['find'](_0x16f88f)['then'](handleEntityNotFound(_0x59d0a6,null))[_0x2adc('0x44')](respondWithResult(_0x59d0a6,null))['catch'](handleError(_0x59d0a6,null));};exports['create']=function(_0x4765be,_0x576d0a){return db[_0x2adc('0x29')][_0x2adc('0x47')](_0x4765be['body'],{})[_0x2adc('0x44')](respondWithResult(_0x576d0a,0xc9))[_0x2adc('0x45')](handleError(_0x576d0a,null));};exports['update']=function(_0x7814f1,_0x2def97){if(_0x7814f1[_0x2adc('0x48')]['id']){delete _0x7814f1[_0x2adc('0x48')]['id'];}return db['ServicenowAccount'][_0x2adc('0x49')]({'where':{'id':_0x7814f1['params']['id']}})['then'](handleEntityNotFound(_0x2def97,null))[_0x2adc('0x44')](saveUpdates(_0x7814f1[_0x2adc('0x48')],null))[_0x2adc('0x44')](respondWithResult(_0x2def97,null))[_0x2adc('0x45')](handleError(_0x2def97,null));};exports[_0x2adc('0x4a')]=function(_0x4307c8,_0x2483cd){return db['ServicenowAccount'][_0x2adc('0x49')]({'where':{'id':_0x4307c8['params']['id']}})[_0x2adc('0x44')](handleEntityNotFound(_0x2483cd,null))[_0x2adc('0x44')](removeEntity(_0x2483cd,null))[_0x2adc('0x45')](handleError(_0x2483cd,null));};exports[_0x2adc('0x4b')]=function(_0x492a44,_0x4f9daf,_0x49f07f){var _0x5e16ad={};var _0x5d91a3={};var _0xcc9c7d;var _0xd248c5;return db[_0x2adc('0x29')][_0x2adc('0x4c')]({'where':{'id':_0x492a44[_0x2adc('0x46')]['id']}})['then'](handleEntityNotFound(_0x4f9daf,null))[_0x2adc('0x44')](function(_0x5c7015){if(_0x5c7015){_0xcc9c7d=_0x5c7015;_0x5d91a3[_0x2adc('0x2e')]=_[_0x2adc('0x31')](db['ServicenowConfiguration'][_0x2adc('0x2a')]);_0x5d91a3[_0x2adc('0x30')]=_[_0x2adc('0x31')](_0x492a44['query']);_0x5d91a3[_0x2adc('0x39')]=_['intersection'](_0x5d91a3[_0x2adc('0x2e')],_0x5d91a3['query']);_0x5e16ad[_0x2adc('0x33')]=_['intersection'](_0x5d91a3['model'],qs[_0x2adc('0x34')](_0x492a44[_0x2adc('0x30')][_0x2adc('0x34')]));_0x5e16ad[_0x2adc('0x33')]=_0x5e16ad[_0x2adc('0x33')]['length']?_0x5e16ad[_0x2adc('0x33')]:_0x5d91a3['model'];_0x5e16ad[_0x2adc('0x37')]=qs[_0x2adc('0x38')](_0x492a44[_0x2adc('0x30')][_0x2adc('0x38')]);_0x5e16ad[_0x2adc('0x3c')]=qs[_0x2adc('0x39')](_[_0x2adc('0x3a')](_0x492a44[_0x2adc('0x30')],_0x5d91a3[_0x2adc('0x39')]));if(_0x492a44[_0x2adc('0x30')]['filter']){_0x5e16ad['where']=_[_0x2adc('0x3d')](_0x5e16ad[_0x2adc('0x3c')],{'$or':_[_0x2adc('0x2f')](_0x5e16ad[_0x2adc('0x33')],function(_0x38171f){var _0x351a3b={};_0x351a3b[_0x38171f]={'$like':'%'+_0x492a44[_0x2adc('0x30')][_0x2adc('0x3b')]+'%'};return _0x351a3b;})});}_0x5e16ad=_['merge']({},_0x5e16ad,_0x492a44[_0x2adc('0x3f')]);return _0xcc9c7d[_0x2adc('0x4b')](_0x5e16ad);}})[_0x2adc('0x44')](function(_0xce6c){if(_0xce6c){_0xd248c5=_0xce6c[_0x2adc('0x35')];if(!_0x492a44[_0x2adc('0x30')]['hasOwnProperty']('nolimit')){_0x5e16ad[_0x2adc('0x20')]=qs[_0x2adc('0x20')](_0x492a44['query']['limit']);_0x5e16ad[_0x2adc('0x1d')]=qs['offset'](_0x492a44['query'][_0x2adc('0x1d')]);}return _0xcc9c7d[_0x2adc('0x4b')](_0x5e16ad);}})[_0x2adc('0x44')](function(_0x38b235){if(_0x38b235){return _0x38b235?{'count':_0xd248c5,'rows':_0x38b235}:null;}})['then'](respondWithResult(_0x4f9daf,null))[_0x2adc('0x45')](handleError(_0x4f9daf,null));};exports[_0x2adc('0x4d')]=function(_0x2c80d3,_0xe2ac39,_0x1d7ab4){if(_0x2c80d3[_0x2adc('0x48')]['id']){delete _0x2c80d3[_0x2adc('0x48')]['id'];}return db['ServicenowAccount'][_0x2adc('0x4c')]({'where':{'id':_0x2c80d3[_0x2adc('0x46')]['id']}})[_0x2adc('0x44')](handleEntityNotFound(_0xe2ac39,null))['then'](function(_0x2bbe1a){if(_0x2bbe1a){_0x2c80d3[_0x2adc('0x48')][_0x2adc('0x4e')]=_0x2bbe1a['id'];_0x2c80d3[_0x2adc('0x48')][_0x2adc('0x4f')]=integrations[_0x2adc('0x50')](_0x2c80d3['body'][_0x2adc('0x51')],_0x2c80d3[_0x2adc('0x48')][_0x2adc('0x2c')]);_0x2c80d3[_0x2adc('0x48')]['Descriptions']=integrations[_0x2adc('0x52')](_0x2c80d3[_0x2adc('0x48')]['channel'],_0x2c80d3[_0x2adc('0x48')]['type']);return db[_0x2adc('0x53')]['create'](_0x2c80d3['body'],{'include':[{'model':db['ServicenowField'],'as':_0x2adc('0x4f')},{'model':db[_0x2adc('0x54')],'as':_0x2adc('0x55')}]});}return null;})['then'](respondWithResult(_0xe2ac39,null))[_0x2adc('0x45')](handleError(_0xe2ac39,null));};exports[_0x2adc('0x56')]=function(_0x2b71cc,_0x2eb3fd,_0x2bb703){var _0x2bccc1=[_0x2adc('0x57'),_0x2adc('0x58'),_0x2adc('0x59'),_0x2adc('0x5a'),'close_code','notify',_0x2adc('0x5b'),_0x2adc('0x5c'),_0x2adc('0x5d')];var _0x3de849=[_0x2adc('0x5e'),_0x2adc('0x57'),_0x2adc('0x5f'),'watch_list','upon_reject','sys_updated_on',_0x2adc('0x60'),_0x2adc('0x58'),_0x2adc('0x61'),_0x2adc('0x62'),_0x2adc('0x63'),_0x2adc('0x64'),_0x2adc('0x65'),_0x2adc('0x66'),_0x2adc('0x67'),'sys_domain',_0x2adc('0x68'),'sys_created_by',_0x2adc('0x59'),_0x2adc('0x37'),_0x2adc('0x69'),_0x2adc('0x6a'),_0x2adc('0x6b'),_0x2adc('0x6c'),_0x2adc('0x6d'),_0x2adc('0x6e'),'work_notes_list','business_service','priority',_0x2adc('0x6f'),_0x2adc('0x70'),_0x2adc('0x71'),'expected_start',_0x2adc('0x72'),_0x2adc('0x73'),_0x2adc('0x74'),_0x2adc('0x75'),_0x2adc('0x76'),_0x2adc('0x77'),_0x2adc('0x78'),'approval_set','subcategory',_0x2adc('0x79'),'short_description',_0x2adc('0x7a'),_0x2adc('0x7b'),'delivery_task',_0x2adc('0x7c'),_0x2adc('0x7d'),_0x2adc('0x7e'),_0x2adc('0x7f'),'description',_0x2adc('0x80'),_0x2adc('0x81'),_0x2adc('0x82'),_0x2adc('0x83'),_0x2adc('0x84'),_0x2adc('0x85'),_0x2adc('0x86'),_0x2adc('0x87'),'contact_type',_0x2adc('0x88'),_0x2adc('0x5b'),_0x2adc('0x89'),_0x2adc('0x8a'),_0x2adc('0x8b'),_0x2adc('0x8c'),'activity_due',_0x2adc('0x8d'),_0x2adc('0x5c'),_0x2adc('0x8e'),_0x2adc('0x8f'),_0x2adc('0x90'),'comments_and_work_notes',_0x2adc('0x91'),_0x2adc('0x92'),'reopen_count',_0x2adc('0x93'),'escalation',_0x2adc('0x94'),_0x2adc('0x95'),'location',_0x2adc('0x5d')];var _0x2d3445='';var _0x297618='';var _0x4e2810=[];var _0x1c9c18='';var _0x410171='';var _0x2adced=[];var _0x603011='';var _0x4fe5aa='';var _0x38b513={};var _0x28cc96='';return db[_0x2adc('0x29')][_0x2adc('0x4c')]({'where':{'id':_0x2b71cc[_0x2adc('0x46')]['id']},'attributes':['id','username',_0x2adc('0x96'),_0x2adc('0x97'),_0x2adc('0x98'),_0x2adc('0x99')]})[_0x2adc('0x44')](handleEntityNotFound(_0x2eb3fd,null))[_0x2adc('0x44')](function(_0x196589){if(_0x196589){_0x28cc96=_0x196589[_0x2adc('0x98')];var _0x3f77e5=_0x28cc96['slice'](-0x1);if(_0x3f77e5==='/'){_0x28cc96=_0x28cc96[_0x2adc('0x9a')](0x0,_0x28cc96[_0x2adc('0x9b')](_0x3f77e5));}_0x4fe5aa=util['format']('%s/api/now/doc/table/schema/',_0x28cc96);_0x603011=util[_0x2adc('0x9c')](_0x2adc('0x9d'),_0x28cc96);_0x38b513={'user':_0x196589[_0x2adc('0x9e')],'pass':_0x196589[_0x2adc('0x96')]};var _0xc8bcff={'method':_0x2adc('0x9f'),'uri':_0x4fe5aa+_0x2adc('0xa0'),'auth':_0x38b513,'json':!![]};return rp(_0xc8bcff);}})[_0x2adc('0x44')](function(_0x16dae4){if(_0x16dae4[_0x2adc('0xa1')][_0x2adc('0x35')]>0x0){_0x2d3445=_0x16dae4[_0x2adc('0xa1')];}console[_0x2adc('0xa2')](_0x2adc('0xa3'),_0x2d3445);_0x2adced=[];_0x297618=Object[_0x2adc('0xa4')]([],_0x2d3445);_['remove'](_0x297618,function(_0x3300fe){return!_0x2bccc1[_0x2adc('0xa5')](_0x3300fe['name']);});_0x297618[_0x2adc('0xa6')](function(_0x2c4fdb){var _0x1231b3=createFieldObject(_0x603011,_0x38b513,_0x2c4fdb['internalType'],_0x2c4fdb[_0x2adc('0x26')],_0x2c4fdb[_0x2adc('0xa7')],![]);_0x2adced[_0x2adc('0xa8')](_0x1231b3);});return Promise[_0x2adc('0xa9')](_0x2adced);})['then'](function(_0xb2c508){_0x4e2810=_0xb2c508;_0x1c9c18=Object[_0x2adc('0xa4')]([],_0x2d3445);console[_0x2adc('0xa2')](_0x2adc('0xaa'),_0x2d3445);_['remove'](_0x1c9c18,function(_0x16cdb3){return _0x3de849[_0x2adc('0xa5')](_0x16cdb3['name']);});console['log'](_0x2adc('0xab'),_0x1c9c18);_0x2adced=[];_0x1c9c18[_0x2adc('0xa6')](function(_0xdf8de8){var _0x52d301=createFieldObject(_0x603011,_0x38b513,_0xdf8de8[_0x2adc('0xac')],_0xdf8de8['name'],_0xdf8de8[_0x2adc('0xa7')],!![]);_0x2adced[_0x2adc('0xa8')](_0x52d301);});return Promise[_0x2adc('0xa9')](_0x2adced);})[_0x2adc('0x44')](function(_0x309a18){_0x410171=_0x309a18;var _0x95e872=_0x4e2810['concat'](_0x410171);return{'count':_0x95e872[_0x2adc('0x35')],'rows':_0x95e872};})[_0x2adc('0x44')](respondWithResult(_0x2eb3fd,null))[_0x2adc('0x45')](function(_0x3d2cd8){console[_0x2adc('0xa2')](_0x2adc('0xad')+_0x3d2cd8);var _0x304fa8=_0x2b71cc['query'][_0x2adc('0xae')]?0x1f4:_0x3d2cd8[_0x2adc('0xaf')]||0x1f4;logger[_0x2adc('0xb0')](_0x3d2cd8[_0x2adc('0xb1')]);delete _0x3d2cd8[_0x2adc('0x26')];if(_0x304fa8===0x191){_0x304fa8=0x190;}_0x2eb3fd[_0x2adc('0x1b')](_0x304fa8)[_0x2adc('0x27')](_0x2b71cc['query'][_0x2adc('0xae')]?{'message':_0x2adc('0xb2'),'statusCode':_0x3d2cd8[_0x2adc('0xaf')]}:_0x3d2cd8);});};function createFieldObject(_0x3d165a,_0x5495ea,_0x163ab7,_0x306916,_0x368a0a,_0x487ce5){return new Promise(function(_0x5e74c6,_0x51ed31){var _0x17db70={'id':_0x306916,'name':_0x368a0a,'custom':_0x487ce5};if(_0x163ab7==='boolean'){_0x17db70['options']=[{'name':_0x2adc('0xb3'),'value':_0x2adc('0xb4')},{'name':_0x2adc('0xb5'),'value':_0x2adc('0xb6')}];_0x5e74c6(_0x17db70);}else{var _0x41c73a={'method':'GET','uri':_0x3d165a+'sys_choice?sysparm_query=name=incident^element='+_0x306916,'auth':_0x5495ea,'json':!![]};return rp(_0x41c73a)[_0x2adc('0x44')](function(_0x6ca33){var _0x477a18=[];if(_0x6ca33[_0x2adc('0xa1')]['length']>0x0){_0x6ca33['result'][_0x2adc('0xa6')](function(_0x482e4e){if(_0x482e4e['inactive']===_0x2adc('0xb6')){var _0x28f392={'name':_0x482e4e[_0x2adc('0xa7')],'value':_0x482e4e[_0x2adc('0xb7')]};_0x477a18['push'](_0x28f392);}});}_0x17db70[_0x2adc('0x3f')]=_0x477a18;if(_0x17db70[_0x2adc('0x3f')][_0x2adc('0x35')]>0x0){_0x5e74c6(_0x17db70);}else{if(_0x487ce5==![]){_0x5e74c6();}else{_0x5e74c6(_0x17db70);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index c057748..2709bba 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 _0x7fbe=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','int_servicenow_accounts','../../config/logger','api'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x340d17,_0x3d6339){_0x340d17=_0x340d17-0x0;var _0x4a18d1=_0x7fbe[_0x340d17];return _0x4a18d1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));var integrations=require(_0xe7fb('0x9'));module[_0xe7fb('0xa')]=function(_0x12d1b0,_0x24cd67){return _0x12d1b0[_0xe7fb('0xb')]('ServicenowAccount',attributes,{'tableName':_0xe7fb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x187d=['exports','define','ServicenowAccount','int_servicenow_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intServicenowAccount.attributes'];(function(_0x456a84,_0x46bc0b){var _0x1117d6=function(_0x20f9d1){while(--_0x20f9d1){_0x456a84['push'](_0x456a84['shift']());}};_0x1117d6(++_0x46bc0b);}(_0x187d,0x93));var _0xd187=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0x187d[_0x1cfa0d];return _0xe33279;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var logger=require(_0xd187('0x1'))(_0xd187('0x2'));var moment=require(_0xd187('0x3'));var BPromise=require(_0xd187('0x4'));var rp=require(_0xd187('0x5'));var fs=require('fs');var path=require(_0xd187('0x6'));var rimraf=require('rimraf');var config=require(_0xd187('0x7'));var attributes=require(_0xd187('0x8'));var integrations=require('../../components/integrations/configuration');module[_0xd187('0x9')]=function(_0x58ee7,_0x444a60){return _0x58ee7[_0xd187('0xa')](_0xd187('0xb'),attributes,{'tableName':_0xd187('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index e4109c4..10cded7 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 _0xd860=['request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ServicenowAccount','findAll','options','where','attributes','limit','include','model','map','GetServicenowAccount','catch','ShowServicenowAccount','find','raw','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xd860,0x181));var _0x0d86=function(_0x5ea305,_0xa8b62e){_0x5ea305=_0x5ea305-0x0;var _0x520d16=_0xd860[_0x5ea305];return _0x520d16;};'use strict';var _=require(_0x0d86('0x0'));var util=require(_0x0d86('0x1'));var moment=require('moment');var BPromise=require(_0x0d86('0x2'));var rs=require(_0x0d86('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0d86('0x4'))['db'];var utils=require(_0x0d86('0x5'));var logger=require(_0x0d86('0x6'))(_0x0d86('0x7'));var config=require('../../config/environment');var jayson=require(_0x0d86('0x8'));var client=jayson[_0x0d86('0x9')][_0x0d86('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc00b11,_0x529d8f,_0x45c560){return new BPromise(function(_0x33b988,_0x5f19ac){return client[_0x0d86('0xb')](_0xc00b11,_0x45c560)[_0x0d86('0xc')](function(_0x42b229){logger[_0x0d86('0xd')](_0x0d86('0xe'),_0x529d8f,_0x0d86('0xf'));logger['debug'](_0x0d86('0x10'),_0x529d8f,_0x0d86('0xf'),JSON[_0x0d86('0x11')](_0x42b229));if(_0x42b229[_0x0d86('0x12')]){if(_0x42b229['error'][_0x0d86('0x13')]===0x1f4){logger['error'](_0x0d86('0xe'),_0x529d8f,_0x42b229[_0x0d86('0x12')][_0x0d86('0x14')]);return _0x5f19ac(_0x42b229[_0x0d86('0x12')][_0x0d86('0x14')]);}logger[_0x0d86('0x12')](_0x0d86('0xe'),_0x529d8f,_0x42b229[_0x0d86('0x12')][_0x0d86('0x14')]);return _0x33b988(_0x42b229[_0x0d86('0x12')][_0x0d86('0x14')]);}else{logger[_0x0d86('0xd')](_0x0d86('0xe'),_0x529d8f,_0x0d86('0xf'));_0x33b988(_0x42b229[_0x0d86('0x15')][_0x0d86('0x14')]);}})['catch'](function(_0x42baa7){logger[_0x0d86('0x12')](_0x0d86('0xe'),_0x529d8f,_0x42baa7);_0x5f19ac(_0x42baa7);});});}exports['GetServicenowAccount']=function(_0x836e6f){var _0x272309=this;return new Promise(function(_0x433b76,_0x4c4904){return db[_0x0d86('0x16')][_0x0d86('0x17')]({'raw':_0x836e6f[_0x0d86('0x18')]?_0x836e6f[_0x0d86('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x836e6f[_0x0d86('0x18')]?_0x836e6f[_0x0d86('0x18')][_0x0d86('0x19')]||null:null,'attributes':_0x836e6f[_0x0d86('0x18')]?_0x836e6f['options'][_0x0d86('0x1a')]||null:null,'limit':_0x836e6f['options']?_0x836e6f[_0x0d86('0x18')][_0x0d86('0x1b')]||null:null,'include':_0x836e6f[_0x0d86('0x18')]?_0x836e6f['options'][_0x0d86('0x1c')]?_['map'](_0x836e6f[_0x0d86('0x18')][_0x0d86('0x1c')],function(_0x1cdc2c){return{'model':db[_0x1cdc2c[_0x0d86('0x1d')]],'as':_0x1cdc2c['as'],'attributes':_0x1cdc2c[_0x0d86('0x1a')],'include':_0x1cdc2c[_0x0d86('0x1c')]?_[_0x0d86('0x1e')](_0x1cdc2c[_0x0d86('0x1c')],function(_0x20c369){return{'model':db[_0x20c369[_0x0d86('0x1d')]],'as':_0x20c369['as'],'attributes':_0x20c369[_0x0d86('0x1a')],'include':_0x20c369[_0x0d86('0x1c')]?_[_0x0d86('0x1e')](_0x20c369['include'],function(_0x4c3ef6){return{'model':db[_0x4c3ef6[_0x0d86('0x1d')]],'as':_0x4c3ef6['as'],'attributes':_0x4c3ef6['attributes']};}):[]};}):[]};}):[]:[]})[_0x0d86('0xc')](function(_0x2519dd){logger[_0x0d86('0xd')](_0x0d86('0x1f'),_0x836e6f);logger['debug']('GetServicenowAccount',_0x836e6f,JSON[_0x0d86('0x11')](_0x2519dd));_0x433b76(_0x2519dd);})[_0x0d86('0x20')](function(_0x2715cd){logger[_0x0d86('0x12')](_0x0d86('0x1f'),_0x2715cd[_0x0d86('0x14')],_0x836e6f);_0x4c4904(_0x272309[_0x0d86('0x12')](0x1f4,_0x2715cd['message']));});});};exports[_0x0d86('0x21')]=function(_0x5b36aa){var _0x4f469b=this;return new Promise(function(_0xae4202,_0x4c719e){return db['ServicenowAccount'][_0x0d86('0x22')]({'raw':_0x5b36aa[_0x0d86('0x18')]?_0x5b36aa[_0x0d86('0x18')][_0x0d86('0x23')]===undefined?!![]:![]:!![],'where':_0x5b36aa[_0x0d86('0x18')]?_0x5b36aa[_0x0d86('0x18')][_0x0d86('0x19')]||null:null,'attributes':_0x5b36aa[_0x0d86('0x18')]?_0x5b36aa[_0x0d86('0x18')][_0x0d86('0x1a')]||null:null,'include':_0x5b36aa[_0x0d86('0x18')]?_0x5b36aa['options']['include']?_['map'](_0x5b36aa[_0x0d86('0x18')][_0x0d86('0x1c')],function(_0x58484f){return{'model':db[_0x58484f[_0x0d86('0x1d')]],'as':_0x58484f['as'],'attributes':_0x58484f[_0x0d86('0x1a')],'include':_0x58484f[_0x0d86('0x1c')]?_[_0x0d86('0x1e')](_0x58484f[_0x0d86('0x1c')],function(_0x4bbc9a){return{'model':db[_0x4bbc9a[_0x0d86('0x1d')]],'as':_0x4bbc9a['as'],'attributes':_0x4bbc9a[_0x0d86('0x1a')],'include':_0x4bbc9a[_0x0d86('0x1c')]?_[_0x0d86('0x1e')](_0x4bbc9a['include'],function(_0x394fb7){return{'model':db[_0x394fb7[_0x0d86('0x1d')]],'as':_0x394fb7['as'],'attributes':_0x394fb7[_0x0d86('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x39bd89){logger['info'](_0x0d86('0x21'),_0x5b36aa);logger['debug'](_0x0d86('0x21'),_0x5b36aa,JSON[_0x0d86('0x11')](_0x39bd89));_0xae4202(_0x39bd89);})['catch'](function(_0x37cc1e){logger[_0x0d86('0x12')](_0x0d86('0x21'),_0x37cc1e[_0x0d86('0x14')],_0x5b36aa);_0x4c719e(_0x4f469b[_0x0d86('0x12')](0x1f4,_0x37cc1e[_0x0d86('0x14')]));});});}; \ No newline at end of file +var _0x8cc2=['catch','GetServicenowAccount','ServicenowAccount','options','raw','attributes','include','map','ShowServicenowAccount','find','model','stringify','lodash','ioredis','../../config/utils','rpc','jayson/promise','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x8cc2,0x178));var _0x28cc=function(_0xcd004c,_0x27dd43){_0xcd004c=_0xcd004c-0x0;var _0x227714=_0x8cc2[_0xcd004c];return _0x227714;};'use strict';var _=require(_0x28cc('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x28cc('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x28cc('0x2'));var logger=require('../../config/logger')(_0x28cc('0x3'));var config=require('../../config/environment');var jayson=require(_0x28cc('0x4'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3578d4,_0x9bfd0f,_0x336161){return new BPromise(function(_0x3a87b9,_0x29e5c5){return client[_0x28cc('0x5')](_0x3578d4,_0x336161)[_0x28cc('0x6')](function(_0x1ae315){logger[_0x28cc('0x7')](_0x28cc('0x8'),_0x9bfd0f,_0x28cc('0x9'));logger[_0x28cc('0xa')](_0x28cc('0xb'),_0x9bfd0f,_0x28cc('0x9'),JSON['stringify'](_0x1ae315));if(_0x1ae315[_0x28cc('0xc')]){if(_0x1ae315[_0x28cc('0xc')][_0x28cc('0xd')]===0x1f4){logger[_0x28cc('0xc')]('ServicenowAccount,\x20%s,\x20%s',_0x9bfd0f,_0x1ae315['error'][_0x28cc('0xe')]);return _0x29e5c5(_0x1ae315[_0x28cc('0xc')][_0x28cc('0xe')]);}logger[_0x28cc('0xc')]('ServicenowAccount,\x20%s,\x20%s',_0x9bfd0f,_0x1ae315['error'][_0x28cc('0xe')]);return _0x3a87b9(_0x1ae315[_0x28cc('0xc')][_0x28cc('0xe')]);}else{logger[_0x28cc('0x7')](_0x28cc('0x8'),_0x9bfd0f,_0x28cc('0x9'));_0x3a87b9(_0x1ae315[_0x28cc('0xf')]['message']);}})[_0x28cc('0x10')](function(_0x3c668e){logger['error'](_0x28cc('0x8'),_0x9bfd0f,_0x3c668e);_0x29e5c5(_0x3c668e);});});}exports[_0x28cc('0x11')]=function(_0x482dc4){var _0x5dd996=this;return new Promise(function(_0x4abdf7,_0x1d20d5){return db[_0x28cc('0x12')]['findAll']({'raw':_0x482dc4[_0x28cc('0x13')]?_0x482dc4[_0x28cc('0x13')][_0x28cc('0x14')]===undefined?!![]:![]:!![],'where':_0x482dc4[_0x28cc('0x13')]?_0x482dc4[_0x28cc('0x13')]['where']||null:null,'attributes':_0x482dc4[_0x28cc('0x13')]?_0x482dc4[_0x28cc('0x13')][_0x28cc('0x15')]||null:null,'limit':_0x482dc4[_0x28cc('0x13')]?_0x482dc4['options']['limit']||null:null,'include':_0x482dc4[_0x28cc('0x13')]?_0x482dc4[_0x28cc('0x13')][_0x28cc('0x16')]?_[_0x28cc('0x17')](_0x482dc4[_0x28cc('0x13')][_0x28cc('0x16')],function(_0x104644){return{'model':db[_0x104644['model']],'as':_0x104644['as'],'attributes':_0x104644['attributes'],'include':_0x104644[_0x28cc('0x16')]?_['map'](_0x104644['include'],function(_0x4d3123){return{'model':db[_0x4d3123['model']],'as':_0x4d3123['as'],'attributes':_0x4d3123[_0x28cc('0x15')],'include':_0x4d3123[_0x28cc('0x16')]?_[_0x28cc('0x17')](_0x4d3123[_0x28cc('0x16')],function(_0x3eec41){return{'model':db[_0x3eec41['model']],'as':_0x3eec41['as'],'attributes':_0x3eec41[_0x28cc('0x15')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c8434){logger[_0x28cc('0x7')]('GetServicenowAccount',_0x482dc4);logger[_0x28cc('0xa')](_0x28cc('0x11'),_0x482dc4,JSON['stringify'](_0x3c8434));_0x4abdf7(_0x3c8434);})[_0x28cc('0x10')](function(_0x385feb){logger[_0x28cc('0xc')](_0x28cc('0x11'),_0x385feb[_0x28cc('0xe')],_0x482dc4);_0x1d20d5(_0x5dd996[_0x28cc('0xc')](0x1f4,_0x385feb[_0x28cc('0xe')]));});});};exports[_0x28cc('0x18')]=function(_0x301c6e){var _0x50ac0f=this;return new Promise(function(_0x216bae,_0x5ee9ee){return db[_0x28cc('0x12')][_0x28cc('0x19')]({'raw':_0x301c6e[_0x28cc('0x13')]?_0x301c6e[_0x28cc('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x301c6e['options']?_0x301c6e[_0x28cc('0x13')]['where']||null:null,'attributes':_0x301c6e[_0x28cc('0x13')]?_0x301c6e[_0x28cc('0x13')][_0x28cc('0x15')]||null:null,'include':_0x301c6e[_0x28cc('0x13')]?_0x301c6e[_0x28cc('0x13')][_0x28cc('0x16')]?_['map'](_0x301c6e['options'][_0x28cc('0x16')],function(_0x4f5436){return{'model':db[_0x4f5436['model']],'as':_0x4f5436['as'],'attributes':_0x4f5436[_0x28cc('0x15')],'include':_0x4f5436[_0x28cc('0x16')]?_[_0x28cc('0x17')](_0x4f5436[_0x28cc('0x16')],function(_0x33d926){return{'model':db[_0x33d926['model']],'as':_0x33d926['as'],'attributes':_0x33d926['attributes'],'include':_0x33d926['include']?_['map'](_0x33d926[_0x28cc('0x16')],function(_0x3cbb2d){return{'model':db[_0x3cbb2d[_0x28cc('0x1a')]],'as':_0x3cbb2d['as'],'attributes':_0x3cbb2d[_0x28cc('0x15')]};}):[]};}):[]};}):[]:[]})[_0x28cc('0x6')](function(_0x51d89b){logger['info'](_0x28cc('0x18'),_0x301c6e);logger[_0x28cc('0xa')](_0x28cc('0x18'),_0x301c6e,JSON[_0x28cc('0x1b')](_0x51d89b));_0x216bae(_0x51d89b);})[_0x28cc('0x10')](function(_0x39798c){logger[_0x28cc('0xc')](_0x28cc('0x18'),_0x39798c['message'],_0x301c6e);_0x5ee9ee(_0x50ac0f['error'](0x1f4,_0x39798c[_0x28cc('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 55db505..1693977 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 _0xf4d2=['../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra'];(function(_0x5f3b89,_0x4491f8){var _0x49eca2=function(_0x124d7d){while(--_0x124d7d){_0x5f3b89['push'](_0x5f3b89['shift']());}};_0x49eca2(++_0x4491f8);}(_0xf4d2,0x9c));var _0x2f4d=function(_0x3f64f2,_0x391ec7){_0x3f64f2=_0x3f64f2-0x0;var _0x4f273b=_0xf4d2[_0x3f64f2];return _0x4f273b;};'use strict';var multer=require(_0x2f4d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2f4d('0x1'));var express=require(_0x2f4d('0x2'));var router=express[_0x2f4d('0x3')]();var fs_extra=require(_0x2f4d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2f4d('0x5'));var config=require(_0x2f4d('0x6'));var controller=require(_0x2f4d('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x2f4d('0x8')](_0x2f4d('0x9'),auth[_0x2f4d('0xa')](),controller[_0x2f4d('0xb')]);router['get'](_0x2f4d('0xc'),auth[_0x2f4d('0xa')](),controller[_0x2f4d('0xd')]);router[_0x2f4d('0x8')](_0x2f4d('0xe'),auth[_0x2f4d('0xa')](),controller[_0x2f4d('0xf')]);router[_0x2f4d('0x8')]('/:id/descriptions',auth[_0x2f4d('0xa')](),controller[_0x2f4d('0x10')]);router[_0x2f4d('0x11')]('/',auth[_0x2f4d('0xa')](),controller[_0x2f4d('0x12')]);router['put'](_0x2f4d('0x9'),auth[_0x2f4d('0xa')](),controller[_0x2f4d('0x13')]);router[_0x2f4d('0x14')]('/:id',auth[_0x2f4d('0xa')](),controller[_0x2f4d('0x15')]);module[_0x2f4d('0x16')]=router; \ No newline at end of file +var _0x5475=['exports','multer','util','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','/:id/fields','getSubjects','/:id/descriptions','post','create','delete'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0x5475,0x111));var _0x5547=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x5475[_0x255d5b];return _0x3e141a;};'use strict';var multer=require(_0x5547('0x0'));var util=require(_0x5547('0x1'));var path=require('path');var timeout=require(_0x5547('0x2'));var express=require(_0x5547('0x3'));var router=express['Router']();var fs_extra=require(_0x5547('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5547('0x5'));var controller=require('./intServicenowConfiguration.controller');router[_0x5547('0x6')]('/',auth[_0x5547('0x7')](),controller[_0x5547('0x8')]);router[_0x5547('0x6')](_0x5547('0x9'),auth[_0x5547('0x7')](),controller['show']);router[_0x5547('0x6')](_0x5547('0xa'),auth['isAuthenticated'](),controller['getFields']);router['get']('/:id/subjects',auth[_0x5547('0x7')](),controller[_0x5547('0xb')]);router['get'](_0x5547('0xc'),auth[_0x5547('0x7')](),controller['getDescriptions']);router[_0x5547('0xd')]('/',auth[_0x5547('0x7')](),controller[_0x5547('0xe')]);router['put'](_0x5547('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x5547('0xf')]('/:id',auth[_0x5547('0x7')](),controller['destroy']);module[_0x5547('0x10')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 86e0e27..767cafe 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 _0x2351=['exports','STRING','sequelize'];(function(_0x269651,_0x10b5c4){var _0x46d73a=function(_0x2b1701){while(--_0x2b1701){_0x269651['push'](_0x269651['shift']());}};_0x46d73a(++_0x10b5c4);}(_0x2351,0x10d));var _0x1235=function(_0x5ed986,_0x234d54){_0x5ed986=_0x5ed986-0x0;var _0x19e8d0=_0x2351[_0x5ed986];return _0x19e8d0;};'use strict';var Sequelize=require(_0x1235('0x0'));module[_0x1235('0x1')]={'name':{'type':Sequelize[_0x1235('0x2')]},'description':{'type':Sequelize[_0x1235('0x2')]}}; \ No newline at end of file +var _0x1735=['exports','STRING','sequelize'];(function(_0x5656e9,_0x4e029d){var _0x30fe5a=function(_0x365c83){while(--_0x365c83){_0x5656e9['push'](_0x5656e9['shift']());}};_0x30fe5a(++_0x4e029d);}(_0x1735,0x18b));var _0x5173=function(_0x46c5d7,_0x13ec1f){_0x46c5d7=_0x46c5d7-0x0;var _0x512f9b=_0x1735[_0x46c5d7];return _0x512f9b;};'use strict';var Sequelize=require(_0x5173('0x0'));module[_0x5173('0x1')]={'name':{'type':Sequelize[_0x5173('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 162f7e3..ec1de96 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 _0x42a2=['VIRTUAL','include','findAll','rows','show','params','includeAll','options','find','create','body','catch','findOne','getFields','hasOwnProperty','getSubjects','ServicenowField','getDescriptions','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','filter','where','merge'];(function(_0x5a895a,_0x3e7d2b){var _0x313a99=function(_0x2f6017){while(--_0x2f6017){_0x5a895a['push'](_0x5a895a['shift']());}};_0x313a99(++_0x3e7d2b);}(_0x42a2,0xff));var _0x242a=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0x42a2[_0x4792c8];return _0x35edb1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x242a('0x0'));var zipdir=require(_0x242a('0x1'));var jsonpatch=require(_0x242a('0x2'));var rp=require('request-promise');var moment=require(_0x242a('0x3'));var BPromise=require(_0x242a('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x242a('0x5'));var sox=require('sox');var csv=require(_0x242a('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(_0x242a('0x7'));var jsforce=require(_0x242a('0x8'));var deskjs=require(_0x242a('0x9'));var toCsv=require(_0x242a('0x6'));var querystring=require(_0x242a('0xa'));var Papa=require('papaparse');var Redis=require(_0x242a('0xb'));var authService=require(_0x242a('0xc'));var qs=require(_0x242a('0xd'));var as=require(_0x242a('0xe'));var hardwareService=require(_0x242a('0xf'));var logger=require(_0x242a('0x10'))('api');var utils=require(_0x242a('0x11'));var config=require(_0x242a('0x12'));var licenseUtil=require(_0x242a('0x13'));var db=require(_0x242a('0x14'))['db'];function respondWithStatusCode(_0x237596,_0x13ae09){_0x13ae09=_0x13ae09||0xcc;return function(_0x35a084){if(_0x35a084){return _0x237596['sendStatus'](_0x13ae09);}return _0x237596[_0x242a('0x15')](_0x13ae09)[_0x242a('0x16')]();};}function respondWithResult(_0x592197,_0x19b09c){_0x19b09c=_0x19b09c||0xc8;return function(_0x1ac2e3){if(_0x1ac2e3){return _0x592197['status'](_0x19b09c)[_0x242a('0x17')](_0x1ac2e3);}};}function respondWithFilteredResult(_0x4af9ec,_0x585838){return function(_0xb85959){if(_0xb85959){var _0x529750=typeof _0x585838[_0x242a('0x18')]==='undefined'&&typeof _0x585838[_0x242a('0x19')]==='undefined';var _0x40847a=_0xb85959[_0x242a('0x1a')];var _0x5174a6=_0x529750?0x0:_0x585838[_0x242a('0x18')];var _0x63c750=_0x529750?_0xb85959[_0x242a('0x1a')]:_0x585838[_0x242a('0x18')]+_0x585838[_0x242a('0x19')];var _0x1b5428;if(_0x63c750>=_0x40847a){_0x63c750=_0x40847a;_0x1b5428=0xc8;}else{_0x1b5428=0xce;}_0x4af9ec[_0x242a('0x15')](_0x1b5428);return _0x4af9ec[_0x242a('0x1b')](_0x242a('0x1c'),_0x5174a6+'-'+_0x63c750+'/'+_0x40847a)[_0x242a('0x17')](_0xb85959);}return null;};}function patchUpdates(_0x5ccffc){return function(_0x426211){try{jsonpatch[_0x242a('0x1d')](_0x426211,_0x5ccffc,!![]);}catch(_0x4d9a64){return BPromise[_0x242a('0x1e')](_0x4d9a64);}return _0x426211[_0x242a('0x1f')]();};}function saveUpdates(_0x47f5f1,_0x48294f){return function(_0x1f9421){if(_0x1f9421){return _0x1f9421[_0x242a('0x20')](_0x47f5f1)[_0x242a('0x21')](function(_0x27e23e){return _0x27e23e;});}return null;};}function removeEntity(_0x3ef21a,_0x2ba9dc){return function(_0x2378d7){if(_0x2378d7){return _0x2378d7[_0x242a('0x22')]()[_0x242a('0x21')](function(){_0x3ef21a[_0x242a('0x15')](0xcc)[_0x242a('0x16')]();});}};}function handleEntityNotFound(_0x5f0975,_0x3d9045){return function(_0x4290e3){if(!_0x4290e3){_0x5f0975['sendStatus'](0x194);}return _0x4290e3;};}function handleError(_0x487d97,_0x88fb2c){_0x88fb2c=_0x88fb2c||0x1f4;return function(_0x1e2e60){logger[_0x242a('0x23')](_0x1e2e60[_0x242a('0x24')]);if(_0x1e2e60[_0x242a('0x25')]){delete _0x1e2e60[_0x242a('0x25')];}_0x487d97['status'](_0x88fb2c)[_0x242a('0x26')](_0x1e2e60);};}exports[_0x242a('0x27')]=function(_0x97e316,_0x5b1deb){var _0x4f6b7a={},_0x2df5ac={},_0x20e7f5={'count':0x0,'rows':[]};var _0x50fe25=_['map'](db[_0x242a('0x28')][_0x242a('0x29')],function(_0x334fb9){return{'name':_0x334fb9[_0x242a('0x2a')],'type':_0x334fb9[_0x242a('0x2b')][_0x242a('0x2c')]};});_0x2df5ac[_0x242a('0x2d')]=_[_0x242a('0x2e')](_0x50fe25,'name');_0x2df5ac[_0x242a('0x2f')]=_[_0x242a('0x30')](_0x97e316['query']);_0x2df5ac['filters']=_[_0x242a('0x31')](_0x2df5ac[_0x242a('0x2d')],_0x2df5ac[_0x242a('0x2f')]);_0x4f6b7a[_0x242a('0x32')]=_[_0x242a('0x31')](_0x2df5ac['model'],qs[_0x242a('0x33')](_0x97e316[_0x242a('0x2f')]['fields']));_0x4f6b7a[_0x242a('0x32')]=_0x4f6b7a[_0x242a('0x32')][_0x242a('0x34')]?_0x4f6b7a[_0x242a('0x32')]:_0x2df5ac[_0x242a('0x2d')];if(!_0x97e316[_0x242a('0x2f')]['hasOwnProperty'](_0x242a('0x35'))){_0x4f6b7a[_0x242a('0x19')]=qs[_0x242a('0x19')](_0x97e316['query'][_0x242a('0x19')]);_0x4f6b7a[_0x242a('0x18')]=qs[_0x242a('0x18')](_0x97e316[_0x242a('0x2f')]['offset']);}_0x4f6b7a[_0x242a('0x36')]=qs[_0x242a('0x37')](_0x97e316[_0x242a('0x2f')]['sort']);_0x4f6b7a['where']=qs[_0x242a('0x38')](_[_0x242a('0x39')](_0x97e316[_0x242a('0x2f')],_0x2df5ac[_0x242a('0x38')]),_0x50fe25);if(_0x97e316[_0x242a('0x2f')][_0x242a('0x3a')]){_0x4f6b7a[_0x242a('0x3b')]=_[_0x242a('0x3c')](_0x4f6b7a[_0x242a('0x3b')],{'$or':_[_0x242a('0x2e')](_0x50fe25,function(_0x382334){if(_0x382334[_0x242a('0x2b')]!==_0x242a('0x3d')){var _0x49b337={};_0x49b337[_0x382334['name']]={'$like':'%'+_0x97e316[_0x242a('0x2f')][_0x242a('0x3a')]+'%'};return _0x49b337;}})});}_0x4f6b7a=_[_0x242a('0x3c')]({},_0x4f6b7a,_0x97e316['options']);var _0x464548={'where':_0x4f6b7a[_0x242a('0x3b')]};return db[_0x242a('0x28')][_0x242a('0x1a')](_0x464548)[_0x242a('0x21')](function(_0x54f033){_0x20e7f5['count']=_0x54f033;if(_0x97e316[_0x242a('0x2f')]['includeAll']){_0x4f6b7a[_0x242a('0x3e')]=[{'all':!![]}];}return db[_0x242a('0x28')][_0x242a('0x3f')](_0x4f6b7a);})[_0x242a('0x21')](function(_0x13df83){_0x20e7f5[_0x242a('0x40')]=_0x13df83;return _0x20e7f5;})[_0x242a('0x21')](respondWithFilteredResult(_0x5b1deb,_0x4f6b7a))['catch'](handleError(_0x5b1deb,null));};exports[_0x242a('0x41')]=function(_0x1b640c,_0x2cc537){var _0x2c81a7={'raw':![],'where':{'id':_0x1b640c[_0x242a('0x42')]['id']}},_0x3c1ec2={};_0x3c1ec2[_0x242a('0x2d')]=_[_0x242a('0x30')](db['ServicenowConfiguration'][_0x242a('0x29')]);_0x3c1ec2[_0x242a('0x2f')]=_['keys'](_0x1b640c['query']);_0x3c1ec2[_0x242a('0x38')]=_[_0x242a('0x31')](_0x3c1ec2[_0x242a('0x2d')],_0x3c1ec2[_0x242a('0x2f')]);_0x2c81a7['attributes']=_[_0x242a('0x31')](_0x3c1ec2[_0x242a('0x2d')],qs['fields'](_0x1b640c[_0x242a('0x2f')][_0x242a('0x33')]));_0x2c81a7[_0x242a('0x32')]=_0x2c81a7['attributes'][_0x242a('0x34')]?_0x2c81a7[_0x242a('0x32')]:_0x3c1ec2[_0x242a('0x2d')];if(_0x1b640c[_0x242a('0x2f')][_0x242a('0x43')]){_0x2c81a7[_0x242a('0x3e')]=[{'all':!![]}];}_0x2c81a7=_['merge']({},_0x2c81a7,_0x1b640c[_0x242a('0x44')]);return db[_0x242a('0x28')][_0x242a('0x45')](_0x2c81a7)[_0x242a('0x21')](handleEntityNotFound(_0x2cc537,null))[_0x242a('0x21')](respondWithResult(_0x2cc537,null))['catch'](handleError(_0x2cc537,null));};exports[_0x242a('0x46')]=function(_0x2bbfee,_0x133ccd){return db[_0x242a('0x28')][_0x242a('0x46')](_0x2bbfee[_0x242a('0x47')],{})[_0x242a('0x21')](respondWithResult(_0x133ccd,0xc9))[_0x242a('0x48')](handleError(_0x133ccd,null));};exports[_0x242a('0x20')]=function(_0x526fa0,_0x5047bd){if(_0x526fa0[_0x242a('0x47')]['id']){delete _0x526fa0[_0x242a('0x47')]['id'];}return db[_0x242a('0x28')][_0x242a('0x45')]({'where':{'id':_0x526fa0['params']['id']}})[_0x242a('0x21')](handleEntityNotFound(_0x5047bd,null))['then'](saveUpdates(_0x526fa0['body'],null))['then'](respondWithResult(_0x5047bd,null))[_0x242a('0x48')](handleError(_0x5047bd,null));};exports[_0x242a('0x22')]=function(_0x43301b,_0x387612){return db[_0x242a('0x28')][_0x242a('0x45')]({'where':{'id':_0x43301b[_0x242a('0x42')]['id']}})['then'](handleEntityNotFound(_0x387612,null))[_0x242a('0x21')](removeEntity(_0x387612,null))[_0x242a('0x48')](handleError(_0x387612,null));};exports['getFields']=function(_0x1bec8b,_0x5d7370,_0x2a946d){var _0x310d56={};var _0x118ba2={};var _0x1050c8;var _0x17761e;return db['ServicenowConfiguration'][_0x242a('0x49')]({'where':{'id':_0x1bec8b[_0x242a('0x42')]['id']}})[_0x242a('0x21')](handleEntityNotFound(_0x5d7370,null))[_0x242a('0x21')](function(_0x162617){if(_0x162617){_0x1050c8=_0x162617;_0x118ba2[_0x242a('0x2d')]=_[_0x242a('0x30')](db['ServicenowField'][_0x242a('0x29')]);_0x118ba2['query']=_[_0x242a('0x30')](_0x1bec8b[_0x242a('0x2f')]);_0x118ba2['filters']=_[_0x242a('0x31')](_0x118ba2['model'],_0x118ba2[_0x242a('0x2f')]);_0x310d56[_0x242a('0x32')]=_[_0x242a('0x31')](_0x118ba2[_0x242a('0x2d')],qs['fields'](_0x1bec8b[_0x242a('0x2f')]['fields']));_0x310d56['attributes']=_0x310d56[_0x242a('0x32')][_0x242a('0x34')]?_0x310d56[_0x242a('0x32')]:_0x118ba2['model'];_0x310d56[_0x242a('0x36')]=qs[_0x242a('0x37')](_0x1bec8b[_0x242a('0x2f')]['sort']);_0x310d56['where']=qs[_0x242a('0x38')](_[_0x242a('0x39')](_0x1bec8b['query'],_0x118ba2[_0x242a('0x38')]));if(_0x1bec8b['query'][_0x242a('0x3a')]){_0x310d56['where']=_[_0x242a('0x3c')](_0x310d56[_0x242a('0x3b')],{'$or':_['map'](_0x310d56['attributes'],function(_0x5a702c){var _0x38643c={};_0x38643c[_0x5a702c]={'$like':'%'+_0x1bec8b[_0x242a('0x2f')]['filter']+'%'};return _0x38643c;})});}_0x310d56=_[_0x242a('0x3c')]({},_0x310d56,_0x1bec8b[_0x242a('0x44')]);return _0x1050c8[_0x242a('0x4a')](_0x310d56);}})[_0x242a('0x21')](function(_0xdff76b){if(_0xdff76b){_0x17761e=_0xdff76b[_0x242a('0x34')];if(!_0x1bec8b['query'][_0x242a('0x4b')](_0x242a('0x35'))){_0x310d56[_0x242a('0x19')]=qs[_0x242a('0x19')](_0x1bec8b[_0x242a('0x2f')][_0x242a('0x19')]);_0x310d56[_0x242a('0x18')]=qs[_0x242a('0x18')](_0x1bec8b[_0x242a('0x2f')][_0x242a('0x18')]);}return _0x1050c8[_0x242a('0x4a')](_0x310d56);}})[_0x242a('0x21')](function(_0x4f845a){if(_0x4f845a){return _0x4f845a?{'count':_0x17761e,'rows':_0x4f845a}:null;}})[_0x242a('0x21')](respondWithResult(_0x5d7370,null))[_0x242a('0x48')](handleError(_0x5d7370,null));};exports[_0x242a('0x4c')]=function(_0x4208cf,_0x1725dc,_0x59775b){var _0x15bc17={};var _0x205afc={};var _0x58510d;var _0x41f793;return db['ServicenowConfiguration'][_0x242a('0x49')]({'where':{'id':_0x4208cf[_0x242a('0x42')]['id']}})[_0x242a('0x21')](handleEntityNotFound(_0x1725dc,null))[_0x242a('0x21')](function(_0x5f352e){if(_0x5f352e){_0x58510d=_0x5f352e;_0x205afc[_0x242a('0x2d')]=_[_0x242a('0x30')](db[_0x242a('0x4d')][_0x242a('0x29')]);_0x205afc[_0x242a('0x2f')]=_[_0x242a('0x30')](_0x4208cf[_0x242a('0x2f')]);_0x205afc[_0x242a('0x38')]=_['intersection'](_0x205afc[_0x242a('0x2d')],_0x205afc['query']);_0x15bc17['attributes']=_['intersection'](_0x205afc[_0x242a('0x2d')],qs[_0x242a('0x33')](_0x4208cf[_0x242a('0x2f')][_0x242a('0x33')]));_0x15bc17[_0x242a('0x32')]=_0x15bc17['attributes']['length']?_0x15bc17[_0x242a('0x32')]:_0x205afc['model'];_0x15bc17[_0x242a('0x36')]=qs[_0x242a('0x37')](_0x4208cf[_0x242a('0x2f')][_0x242a('0x37')]);_0x15bc17[_0x242a('0x3b')]=qs['filters'](_['pick'](_0x4208cf[_0x242a('0x2f')],_0x205afc[_0x242a('0x38')]));if(_0x4208cf['query'][_0x242a('0x3a')]){_0x15bc17[_0x242a('0x3b')]=_['merge'](_0x15bc17[_0x242a('0x3b')],{'$or':_[_0x242a('0x2e')](_0x15bc17[_0x242a('0x32')],function(_0x1dfb04){var _0x10ea6f={};_0x10ea6f[_0x1dfb04]={'$like':'%'+_0x4208cf[_0x242a('0x2f')]['filter']+'%'};return _0x10ea6f;})});}_0x15bc17=_[_0x242a('0x3c')]({},_0x15bc17,_0x4208cf[_0x242a('0x44')]);return _0x58510d[_0x242a('0x4c')](_0x15bc17);}})[_0x242a('0x21')](function(_0x22be0a){if(_0x22be0a){_0x41f793=_0x22be0a[_0x242a('0x34')];if(!_0x4208cf['query'][_0x242a('0x4b')](_0x242a('0x35'))){_0x15bc17[_0x242a('0x19')]=qs[_0x242a('0x19')](_0x4208cf[_0x242a('0x2f')][_0x242a('0x19')]);_0x15bc17[_0x242a('0x18')]=qs[_0x242a('0x18')](_0x4208cf[_0x242a('0x2f')][_0x242a('0x18')]);}return _0x58510d[_0x242a('0x4c')](_0x15bc17);}})[_0x242a('0x21')](function(_0x338574){if(_0x338574){return _0x338574?{'count':_0x41f793,'rows':_0x338574}:null;}})['then'](respondWithResult(_0x1725dc,null))[_0x242a('0x48')](handleError(_0x1725dc,null));};exports['getDescriptions']=function(_0x4c3849,_0x1d7d00,_0x1b999e){var _0x56c268={};var _0x333145={};var _0x2ce15;var _0x30f9cc;return db['ServicenowConfiguration'][_0x242a('0x49')]({'where':{'id':_0x4c3849[_0x242a('0x42')]['id']}})[_0x242a('0x21')](handleEntityNotFound(_0x1d7d00,null))[_0x242a('0x21')](function(_0x31268c){if(_0x31268c){_0x2ce15=_0x31268c;_0x333145[_0x242a('0x2d')]=_[_0x242a('0x30')](db['ServicenowField']['rawAttributes']);_0x333145[_0x242a('0x2f')]=_[_0x242a('0x30')](_0x4c3849[_0x242a('0x2f')]);_0x333145[_0x242a('0x38')]=_[_0x242a('0x31')](_0x333145[_0x242a('0x2d')],_0x333145[_0x242a('0x2f')]);_0x56c268['attributes']=_[_0x242a('0x31')](_0x333145[_0x242a('0x2d')],qs[_0x242a('0x33')](_0x4c3849[_0x242a('0x2f')][_0x242a('0x33')]));_0x56c268['attributes']=_0x56c268[_0x242a('0x32')][_0x242a('0x34')]?_0x56c268[_0x242a('0x32')]:_0x333145['model'];_0x56c268[_0x242a('0x36')]=qs[_0x242a('0x37')](_0x4c3849[_0x242a('0x2f')][_0x242a('0x37')]);_0x56c268[_0x242a('0x3b')]=qs[_0x242a('0x38')](_['pick'](_0x4c3849['query'],_0x333145['filters']));if(_0x4c3849['query']['filter']){_0x56c268[_0x242a('0x3b')]=_[_0x242a('0x3c')](_0x56c268['where'],{'$or':_['map'](_0x56c268[_0x242a('0x32')],function(_0x437e60){var _0x6f542={};_0x6f542[_0x437e60]={'$like':'%'+_0x4c3849[_0x242a('0x2f')]['filter']+'%'};return _0x6f542;})});}_0x56c268=_[_0x242a('0x3c')]({},_0x56c268,_0x4c3849[_0x242a('0x44')]);return _0x2ce15[_0x242a('0x4e')](_0x56c268);}})['then'](function(_0x2893af){if(_0x2893af){_0x30f9cc=_0x2893af[_0x242a('0x34')];if(!_0x4c3849[_0x242a('0x2f')][_0x242a('0x4b')](_0x242a('0x35'))){_0x56c268[_0x242a('0x19')]=qs[_0x242a('0x19')](_0x4c3849[_0x242a('0x2f')][_0x242a('0x19')]);_0x56c268[_0x242a('0x18')]=qs[_0x242a('0x18')](_0x4c3849['query'][_0x242a('0x18')]);}return _0x2ce15['getDescriptions'](_0x56c268);}})[_0x242a('0x21')](function(_0x3af64d){if(_0x3af64d){return _0x3af64d?{'count':_0x30f9cc,'rows':_0x3af64d}:null;}})[_0x242a('0x21')](respondWithResult(_0x1d7d00,null))[_0x242a('0x48')](handleError(_0x1d7d00,null));}; \ No newline at end of file +var _0x34b6=['order','sort','pick','filter','where','merge','VIRTUAL','options','ServicenowConfiguration','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','getFields','findOne','ServicenowField','getSubjects','nolimit','getDescriptions','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x49c246,_0x215b1b){var _0x1ffff9=function(_0x32c3aa){while(--_0x32c3aa){_0x49c246['push'](_0x49c246['shift']());}};_0x1ffff9(++_0x215b1b);}(_0x34b6,0x15e));var _0x634b=function(_0x20580a,_0xc57976){_0x20580a=_0x20580a-0x0;var _0x2732ec=_0x34b6[_0x20580a];return _0x2732ec;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x634b('0x0'));var rp=require('request-promise');var moment=require(_0x634b('0x1'));var BPromise=require(_0x634b('0x2'));var Mustache=require('mustache');var util=require(_0x634b('0x3'));var path=require('path');var sox=require(_0x634b('0x4'));var csv=require(_0x634b('0x5'));var ejs=require(_0x634b('0x6'));var fs=require('fs');var fs_extra=require(_0x634b('0x7'));var _=require(_0x634b('0x8'));var squel=require(_0x634b('0x9'));var crypto=require(_0x634b('0xa'));var jsforce=require(_0x634b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x634b('0x5'));var querystring=require('querystring');var Papa=require(_0x634b('0xc'));var Redis=require(_0x634b('0xd'));var authService=require(_0x634b('0xe'));var qs=require(_0x634b('0xf'));var as=require(_0x634b('0x10'));var hardwareService=require(_0x634b('0x11'));var logger=require(_0x634b('0x12'))(_0x634b('0x13'));var utils=require('../../config/utils');var config=require(_0x634b('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x634b('0x15'))['db'];function respondWithStatusCode(_0x579c44,_0x462044){_0x462044=_0x462044||0xcc;return function(_0x51dc78){if(_0x51dc78){return _0x579c44[_0x634b('0x16')](_0x462044);}return _0x579c44['status'](_0x462044)[_0x634b('0x17')]();};}function respondWithResult(_0x37a042,_0x583017){_0x583017=_0x583017||0xc8;return function(_0x8f9413){if(_0x8f9413){return _0x37a042[_0x634b('0x18')](_0x583017)[_0x634b('0x19')](_0x8f9413);}};}function respondWithFilteredResult(_0x293125,_0xcb825e){return function(_0x235119){if(_0x235119){var _0x46831d=typeof _0xcb825e[_0x634b('0x1a')]===_0x634b('0x1b')&&typeof _0xcb825e[_0x634b('0x1c')]===_0x634b('0x1b');var _0xcce721=_0x235119[_0x634b('0x1d')];var _0x46b78c=_0x46831d?0x0:_0xcb825e[_0x634b('0x1a')];var _0x7c1c2=_0x46831d?_0x235119[_0x634b('0x1d')]:_0xcb825e['offset']+_0xcb825e[_0x634b('0x1c')];var _0x2b9461;if(_0x7c1c2>=_0xcce721){_0x7c1c2=_0xcce721;_0x2b9461=0xc8;}else{_0x2b9461=0xce;}_0x293125[_0x634b('0x18')](_0x2b9461);return _0x293125[_0x634b('0x1e')](_0x634b('0x1f'),_0x46b78c+'-'+_0x7c1c2+'/'+_0xcce721)['json'](_0x235119);}return null;};}function patchUpdates(_0x3a4332){return function(_0x2fec41){try{jsonpatch[_0x634b('0x20')](_0x2fec41,_0x3a4332,!![]);}catch(_0x40159a){return BPromise[_0x634b('0x21')](_0x40159a);}return _0x2fec41[_0x634b('0x22')]();};}function saveUpdates(_0x2588e4,_0x25c50b){return function(_0x14e7cf){if(_0x14e7cf){return _0x14e7cf[_0x634b('0x23')](_0x2588e4)['then'](function(_0x1af428){return _0x1af428;});}return null;};}function removeEntity(_0x508373,_0x4d2a55){return function(_0x45afc6){if(_0x45afc6){return _0x45afc6[_0x634b('0x24')]()[_0x634b('0x25')](function(){_0x508373[_0x634b('0x18')](0xcc)[_0x634b('0x17')]();});}};}function handleEntityNotFound(_0x5bec7d,_0x30e042){return function(_0x55adb2){if(!_0x55adb2){_0x5bec7d[_0x634b('0x16')](0x194);}return _0x55adb2;};}function handleError(_0x1351ef,_0x33a754){_0x33a754=_0x33a754||0x1f4;return function(_0x54622d){logger['error'](_0x54622d[_0x634b('0x26')]);if(_0x54622d[_0x634b('0x27')]){delete _0x54622d[_0x634b('0x27')];}_0x1351ef['status'](_0x33a754)[_0x634b('0x28')](_0x54622d);};}exports[_0x634b('0x29')]=function(_0x494071,_0x44ddf5){var _0x968f46={},_0x1ed14a={},_0x972dcd={'count':0x0,'rows':[]};var _0x5db25d=_['map'](db['ServicenowConfiguration']['rawAttributes'],function(_0x28ecf6){return{'name':_0x28ecf6[_0x634b('0x2a')],'type':_0x28ecf6[_0x634b('0x2b')][_0x634b('0x2c')]};});_0x1ed14a[_0x634b('0x2d')]=_[_0x634b('0x2e')](_0x5db25d,_0x634b('0x27'));_0x1ed14a[_0x634b('0x2f')]=_[_0x634b('0x30')](_0x494071[_0x634b('0x2f')]);_0x1ed14a[_0x634b('0x31')]=_[_0x634b('0x32')](_0x1ed14a['model'],_0x1ed14a[_0x634b('0x2f')]);_0x968f46[_0x634b('0x33')]=_['intersection'](_0x1ed14a[_0x634b('0x2d')],qs['fields'](_0x494071[_0x634b('0x2f')][_0x634b('0x34')]));_0x968f46['attributes']=_0x968f46[_0x634b('0x33')][_0x634b('0x35')]?_0x968f46['attributes']:_0x1ed14a['model'];if(!_0x494071[_0x634b('0x2f')][_0x634b('0x36')]('nolimit')){_0x968f46[_0x634b('0x1c')]=qs[_0x634b('0x1c')](_0x494071[_0x634b('0x2f')][_0x634b('0x1c')]);_0x968f46[_0x634b('0x1a')]=qs[_0x634b('0x1a')](_0x494071[_0x634b('0x2f')][_0x634b('0x1a')]);}_0x968f46[_0x634b('0x37')]=qs[_0x634b('0x38')](_0x494071[_0x634b('0x2f')][_0x634b('0x38')]);_0x968f46['where']=qs['filters'](_[_0x634b('0x39')](_0x494071['query'],_0x1ed14a[_0x634b('0x31')]),_0x5db25d);if(_0x494071[_0x634b('0x2f')][_0x634b('0x3a')]){_0x968f46[_0x634b('0x3b')]=_[_0x634b('0x3c')](_0x968f46[_0x634b('0x3b')],{'$or':_['map'](_0x5db25d,function(_0x51907e){if(_0x51907e[_0x634b('0x2b')]!==_0x634b('0x3d')){var _0x425d67={};_0x425d67[_0x51907e['name']]={'$like':'%'+_0x494071['query'][_0x634b('0x3a')]+'%'};return _0x425d67;}})});}_0x968f46=_[_0x634b('0x3c')]({},_0x968f46,_0x494071[_0x634b('0x3e')]);var _0x229c1a={'where':_0x968f46[_0x634b('0x3b')]};return db[_0x634b('0x3f')][_0x634b('0x1d')](_0x229c1a)['then'](function(_0x211607){_0x972dcd[_0x634b('0x1d')]=_0x211607;if(_0x494071[_0x634b('0x2f')][_0x634b('0x40')]){_0x968f46[_0x634b('0x41')]=[{'all':!![]}];}return db[_0x634b('0x3f')][_0x634b('0x42')](_0x968f46);})[_0x634b('0x25')](function(_0xafd5ed){_0x972dcd[_0x634b('0x43')]=_0xafd5ed;return _0x972dcd;})[_0x634b('0x25')](respondWithFilteredResult(_0x44ddf5,_0x968f46))[_0x634b('0x44')](handleError(_0x44ddf5,null));};exports[_0x634b('0x45')]=function(_0x5c78a1,_0x5748cd){var _0x46c183={'raw':![],'where':{'id':_0x5c78a1[_0x634b('0x46')]['id']}},_0x2834c7={};_0x2834c7[_0x634b('0x2d')]=_[_0x634b('0x30')](db['ServicenowConfiguration'][_0x634b('0x47')]);_0x2834c7[_0x634b('0x2f')]=_[_0x634b('0x30')](_0x5c78a1[_0x634b('0x2f')]);_0x2834c7[_0x634b('0x31')]=_[_0x634b('0x32')](_0x2834c7['model'],_0x2834c7[_0x634b('0x2f')]);_0x46c183[_0x634b('0x33')]=_[_0x634b('0x32')](_0x2834c7[_0x634b('0x2d')],qs[_0x634b('0x34')](_0x5c78a1['query'][_0x634b('0x34')]));_0x46c183[_0x634b('0x33')]=_0x46c183[_0x634b('0x33')][_0x634b('0x35')]?_0x46c183[_0x634b('0x33')]:_0x2834c7[_0x634b('0x2d')];if(_0x5c78a1[_0x634b('0x2f')][_0x634b('0x40')]){_0x46c183[_0x634b('0x41')]=[{'all':!![]}];}_0x46c183=_['merge']({},_0x46c183,_0x5c78a1[_0x634b('0x3e')]);return db[_0x634b('0x3f')][_0x634b('0x48')](_0x46c183)[_0x634b('0x25')](handleEntityNotFound(_0x5748cd,null))[_0x634b('0x25')](respondWithResult(_0x5748cd,null))['catch'](handleError(_0x5748cd,null));};exports[_0x634b('0x49')]=function(_0x3fd25f,_0x327985){return db[_0x634b('0x3f')]['create'](_0x3fd25f[_0x634b('0x4a')],{})[_0x634b('0x25')](respondWithResult(_0x327985,0xc9))['catch'](handleError(_0x327985,null));};exports[_0x634b('0x23')]=function(_0x289e19,_0x2ba3c3){if(_0x289e19['body']['id']){delete _0x289e19[_0x634b('0x4a')]['id'];}return db[_0x634b('0x3f')][_0x634b('0x48')]({'where':{'id':_0x289e19[_0x634b('0x46')]['id']}})['then'](handleEntityNotFound(_0x2ba3c3,null))['then'](saveUpdates(_0x289e19[_0x634b('0x4a')],null))[_0x634b('0x25')](respondWithResult(_0x2ba3c3,null))['catch'](handleError(_0x2ba3c3,null));};exports['destroy']=function(_0x2f5e5a,_0x425854){return db[_0x634b('0x3f')]['find']({'where':{'id':_0x2f5e5a[_0x634b('0x46')]['id']}})[_0x634b('0x25')](handleEntityNotFound(_0x425854,null))['then'](removeEntity(_0x425854,null))[_0x634b('0x44')](handleError(_0x425854,null));};exports[_0x634b('0x4b')]=function(_0x263538,_0x509ad5,_0x4a65ee){var _0x305e51={};var _0x57f05c={};var _0x1e1f04;var _0x134072;return db['ServicenowConfiguration'][_0x634b('0x4c')]({'where':{'id':_0x263538[_0x634b('0x46')]['id']}})[_0x634b('0x25')](handleEntityNotFound(_0x509ad5,null))[_0x634b('0x25')](function(_0x12d254){if(_0x12d254){_0x1e1f04=_0x12d254;_0x57f05c[_0x634b('0x2d')]=_['keys'](db[_0x634b('0x4d')]['rawAttributes']);_0x57f05c[_0x634b('0x2f')]=_[_0x634b('0x30')](_0x263538[_0x634b('0x2f')]);_0x57f05c[_0x634b('0x31')]=_['intersection'](_0x57f05c[_0x634b('0x2d')],_0x57f05c[_0x634b('0x2f')]);_0x305e51[_0x634b('0x33')]=_[_0x634b('0x32')](_0x57f05c[_0x634b('0x2d')],qs['fields'](_0x263538[_0x634b('0x2f')][_0x634b('0x34')]));_0x305e51[_0x634b('0x33')]=_0x305e51[_0x634b('0x33')][_0x634b('0x35')]?_0x305e51[_0x634b('0x33')]:_0x57f05c['model'];_0x305e51[_0x634b('0x37')]=qs['sort'](_0x263538[_0x634b('0x2f')][_0x634b('0x38')]);_0x305e51[_0x634b('0x3b')]=qs[_0x634b('0x31')](_[_0x634b('0x39')](_0x263538[_0x634b('0x2f')],_0x57f05c[_0x634b('0x31')]));if(_0x263538[_0x634b('0x2f')]['filter']){_0x305e51[_0x634b('0x3b')]=_[_0x634b('0x3c')](_0x305e51[_0x634b('0x3b')],{'$or':_[_0x634b('0x2e')](_0x305e51[_0x634b('0x33')],function(_0x22d20a){var _0x8cce08={};_0x8cce08[_0x22d20a]={'$like':'%'+_0x263538[_0x634b('0x2f')][_0x634b('0x3a')]+'%'};return _0x8cce08;})});}_0x305e51=_[_0x634b('0x3c')]({},_0x305e51,_0x263538[_0x634b('0x3e')]);return _0x1e1f04[_0x634b('0x4b')](_0x305e51);}})[_0x634b('0x25')](function(_0x2d7765){if(_0x2d7765){_0x134072=_0x2d7765[_0x634b('0x35')];if(!_0x263538['query']['hasOwnProperty']('nolimit')){_0x305e51[_0x634b('0x1c')]=qs[_0x634b('0x1c')](_0x263538[_0x634b('0x2f')][_0x634b('0x1c')]);_0x305e51[_0x634b('0x1a')]=qs['offset'](_0x263538['query'][_0x634b('0x1a')]);}return _0x1e1f04[_0x634b('0x4b')](_0x305e51);}})['then'](function(_0x46ab86){if(_0x46ab86){return _0x46ab86?{'count':_0x134072,'rows':_0x46ab86}:null;}})[_0x634b('0x25')](respondWithResult(_0x509ad5,null))['catch'](handleError(_0x509ad5,null));};exports[_0x634b('0x4e')]=function(_0x13195a,_0x3c19ae,_0x4db474){var _0x5dff41={};var _0x200ef4={};var _0x12600a;var _0x5a2302;return db[_0x634b('0x3f')]['findOne']({'where':{'id':_0x13195a['params']['id']}})[_0x634b('0x25')](handleEntityNotFound(_0x3c19ae,null))[_0x634b('0x25')](function(_0x4f83cd){if(_0x4f83cd){_0x12600a=_0x4f83cd;_0x200ef4[_0x634b('0x2d')]=_[_0x634b('0x30')](db['ServicenowField'][_0x634b('0x47')]);_0x200ef4[_0x634b('0x2f')]=_['keys'](_0x13195a[_0x634b('0x2f')]);_0x200ef4[_0x634b('0x31')]=_[_0x634b('0x32')](_0x200ef4['model'],_0x200ef4[_0x634b('0x2f')]);_0x5dff41[_0x634b('0x33')]=_['intersection'](_0x200ef4['model'],qs[_0x634b('0x34')](_0x13195a[_0x634b('0x2f')]['fields']));_0x5dff41[_0x634b('0x33')]=_0x5dff41[_0x634b('0x33')]['length']?_0x5dff41['attributes']:_0x200ef4[_0x634b('0x2d')];_0x5dff41[_0x634b('0x37')]=qs['sort'](_0x13195a[_0x634b('0x2f')][_0x634b('0x38')]);_0x5dff41[_0x634b('0x3b')]=qs['filters'](_[_0x634b('0x39')](_0x13195a['query'],_0x200ef4[_0x634b('0x31')]));if(_0x13195a[_0x634b('0x2f')]['filter']){_0x5dff41[_0x634b('0x3b')]=_[_0x634b('0x3c')](_0x5dff41[_0x634b('0x3b')],{'$or':_[_0x634b('0x2e')](_0x5dff41[_0x634b('0x33')],function(_0xc6b3e2){var _0xa7174e={};_0xa7174e[_0xc6b3e2]={'$like':'%'+_0x13195a['query'][_0x634b('0x3a')]+'%'};return _0xa7174e;})});}_0x5dff41=_[_0x634b('0x3c')]({},_0x5dff41,_0x13195a[_0x634b('0x3e')]);return _0x12600a['getSubjects'](_0x5dff41);}})[_0x634b('0x25')](function(_0x1e985b){if(_0x1e985b){_0x5a2302=_0x1e985b[_0x634b('0x35')];if(!_0x13195a[_0x634b('0x2f')][_0x634b('0x36')](_0x634b('0x4f'))){_0x5dff41[_0x634b('0x1c')]=qs[_0x634b('0x1c')](_0x13195a[_0x634b('0x2f')]['limit']);_0x5dff41[_0x634b('0x1a')]=qs[_0x634b('0x1a')](_0x13195a['query']['offset']);}return _0x12600a[_0x634b('0x4e')](_0x5dff41);}})['then'](function(_0x4721fb){if(_0x4721fb){return _0x4721fb?{'count':_0x5a2302,'rows':_0x4721fb}:null;}})[_0x634b('0x25')](respondWithResult(_0x3c19ae,null))[_0x634b('0x44')](handleError(_0x3c19ae,null));};exports[_0x634b('0x50')]=function(_0x531ac5,_0x188b75,_0x3ca515){var _0x552b0c={};var _0x44a8de={};var _0x47fb3c;var _0xae94d7;return db[_0x634b('0x3f')]['findOne']({'where':{'id':_0x531ac5['params']['id']}})[_0x634b('0x25')](handleEntityNotFound(_0x188b75,null))[_0x634b('0x25')](function(_0x4cbf18){if(_0x4cbf18){_0x47fb3c=_0x4cbf18;_0x44a8de[_0x634b('0x2d')]=_[_0x634b('0x30')](db[_0x634b('0x4d')]['rawAttributes']);_0x44a8de[_0x634b('0x2f')]=_[_0x634b('0x30')](_0x531ac5[_0x634b('0x2f')]);_0x44a8de[_0x634b('0x31')]=_[_0x634b('0x32')](_0x44a8de[_0x634b('0x2d')],_0x44a8de[_0x634b('0x2f')]);_0x552b0c[_0x634b('0x33')]=_[_0x634b('0x32')](_0x44a8de[_0x634b('0x2d')],qs['fields'](_0x531ac5[_0x634b('0x2f')][_0x634b('0x34')]));_0x552b0c[_0x634b('0x33')]=_0x552b0c[_0x634b('0x33')]['length']?_0x552b0c[_0x634b('0x33')]:_0x44a8de[_0x634b('0x2d')];_0x552b0c[_0x634b('0x37')]=qs['sort'](_0x531ac5['query']['sort']);_0x552b0c['where']=qs[_0x634b('0x31')](_[_0x634b('0x39')](_0x531ac5['query'],_0x44a8de[_0x634b('0x31')]));if(_0x531ac5['query'][_0x634b('0x3a')]){_0x552b0c[_0x634b('0x3b')]=_[_0x634b('0x3c')](_0x552b0c[_0x634b('0x3b')],{'$or':_['map'](_0x552b0c[_0x634b('0x33')],function(_0x91aa7a){var _0x522c4e={};_0x522c4e[_0x91aa7a]={'$like':'%'+_0x531ac5['query']['filter']+'%'};return _0x522c4e;})});}_0x552b0c=_['merge']({},_0x552b0c,_0x531ac5[_0x634b('0x3e')]);return _0x47fb3c[_0x634b('0x50')](_0x552b0c);}})[_0x634b('0x25')](function(_0x3b5a27){if(_0x3b5a27){_0xae94d7=_0x3b5a27['length'];if(!_0x531ac5[_0x634b('0x2f')]['hasOwnProperty'](_0x634b('0x4f'))){_0x552b0c[_0x634b('0x1c')]=qs[_0x634b('0x1c')](_0x531ac5[_0x634b('0x2f')][_0x634b('0x1c')]);_0x552b0c[_0x634b('0x1a')]=qs[_0x634b('0x1a')](_0x531ac5[_0x634b('0x2f')][_0x634b('0x1a')]);}return _0x47fb3c[_0x634b('0x50')](_0x552b0c);}})[_0x634b('0x25')](function(_0x5b87e5){if(_0x5b87e5){return _0x5b87e5?{'count':_0xae94d7,'rows':_0x5b87e5}:null;}})[_0x634b('0x25')](respondWithResult(_0x188b75,null))[_0x634b('0x44')](handleError(_0x188b75,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 05b18ba..1e436dc 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 _0x9c1d=['./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','moment','bluebird','path','rimraf'];(function(_0xafb045,_0x1521a2){var _0xa69b43=function(_0x5a43d4){while(--_0x5a43d4){_0xafb045['push'](_0xafb045['shift']());}};_0xa69b43(++_0x1521a2);}(_0x9c1d,0x1a9));var _0xd9c1=function(_0x3386d4,_0x3a00ae){_0x3386d4=_0x3386d4-0x0;var _0xec710f=_0x9c1d[_0x3386d4];return _0xec710f;};'use strict';var _=require(_0xd9c1('0x0'));var util=require(_0xd9c1('0x1'));var logger=require(_0xd9c1('0x2'))('api');var moment=require(_0xd9c1('0x3'));var BPromise=require(_0xd9c1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd9c1('0x5'));var rimraf=require(_0xd9c1('0x6'));var config=require('../../config/environment');var attributes=require(_0xd9c1('0x7'));module[_0xd9c1('0x8')]=function(_0x206639,_0x29840f){return _0x206639[_0xd9c1('0x9')](_0xd9c1('0xa'),attributes,{'tableName':_0xd9c1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1aab=['ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','define'];(function(_0x503574,_0x69fb63){var _0x4049d5=function(_0x272689){while(--_0x272689){_0x503574['push'](_0x503574['shift']());}};_0x4049d5(++_0x69fb63);}(_0x1aab,0x122));var _0xb1aa=function(_0x21331a,_0x57fc48){_0x21331a=_0x21331a-0x0;var _0x325c55=_0x1aab[_0x21331a];return _0x325c55;};'use strict';var _=require(_0xb1aa('0x0'));var util=require(_0xb1aa('0x1'));var logger=require(_0xb1aa('0x2'))('api');var moment=require(_0xb1aa('0x3'));var BPromise=require('bluebird');var rp=require(_0xb1aa('0x4'));var fs=require('fs');var path=require(_0xb1aa('0x5'));var rimraf=require(_0xb1aa('0x6'));var config=require(_0xb1aa('0x7'));var attributes=require(_0xb1aa('0x8'));module['exports']=function(_0x5eb27f,_0x34e0f4){return _0x5eb27f[_0xb1aa('0x9')](_0xb1aa('0xa'),attributes,{'tableName':_0xb1aa('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index f10a4e8..1c8f1cd 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 _0xf2e0=['catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','ServicenowConfiguration,\x20%s,\x20%s','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result'];(function(_0x2376c0,_0x2fb88b){var _0x482878=function(_0x19621a){while(--_0x19621a){_0x2376c0['push'](_0x2376c0['shift']());}};_0x482878(++_0x2fb88b);}(_0xf2e0,0xc7));var _0x0f2e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xf2e0[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x0f2e('0x0'));var util=require(_0x0f2e('0x1'));var moment=require('moment');var BPromise=require(_0x0f2e('0x2'));var rs=require(_0x0f2e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0f2e('0x4'))['db'];var utils=require(_0x0f2e('0x5'));var logger=require(_0x0f2e('0x6'))('rpc');var config=require(_0x0f2e('0x7'));var jayson=require(_0x0f2e('0x8'));var client=jayson[_0x0f2e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x51a040,_0x140693,_0x53de0f){return new BPromise(function(_0x1e28ed,_0x382f0a){return client[_0x0f2e('0xa')](_0x51a040,_0x53de0f)['then'](function(_0x3c050a){logger[_0x0f2e('0xb')](_0x0f2e('0xc'),_0x140693,'request\x20sent');logger[_0x0f2e('0xd')](_0x0f2e('0xe'),_0x140693,'request\x20sent',JSON[_0x0f2e('0xf')](_0x3c050a));if(_0x3c050a[_0x0f2e('0x10')]){if(_0x3c050a[_0x0f2e('0x10')][_0x0f2e('0x11')]===0x1f4){logger[_0x0f2e('0x10')]('ServicenowConfiguration,\x20%s,\x20%s',_0x140693,_0x3c050a['error'][_0x0f2e('0x12')]);return _0x382f0a(_0x3c050a[_0x0f2e('0x10')][_0x0f2e('0x12')]);}logger[_0x0f2e('0x10')](_0x0f2e('0xc'),_0x140693,_0x3c050a[_0x0f2e('0x10')][_0x0f2e('0x12')]);return _0x1e28ed(_0x3c050a[_0x0f2e('0x10')][_0x0f2e('0x12')]);}else{logger[_0x0f2e('0xb')](_0x0f2e('0xc'),_0x140693,_0x0f2e('0x13'));_0x1e28ed(_0x3c050a[_0x0f2e('0x14')][_0x0f2e('0x12')]);}})[_0x0f2e('0x15')](function(_0x3ffc9e){logger[_0x0f2e('0x10')](_0x0f2e('0xc'),_0x140693,_0x3ffc9e);_0x382f0a(_0x3ffc9e);});});} \ No newline at end of file +var _0x11d1=['then','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x4a81b7,_0x157887){var _0xc4742d=function(_0xff6fbe){while(--_0xff6fbe){_0x4a81b7['push'](_0x4a81b7['shift']());}};_0xc4742d(++_0x157887);}(_0x11d1,0x184));var _0x111d=function(_0x374478,_0x50bbe8){_0x374478=_0x374478-0x0;var _0xa700b=_0x11d1[_0x374478];return _0xa700b;};'use strict';var _=require(_0x111d('0x0'));var util=require('util');var moment=require(_0x111d('0x1'));var BPromise=require(_0x111d('0x2'));var rs=require(_0x111d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x111d('0x4'))['db'];var utils=require(_0x111d('0x5'));var logger=require(_0x111d('0x6'))('rpc');var config=require(_0x111d('0x7'));var jayson=require(_0x111d('0x8'));var client=jayson[_0x111d('0x9')][_0x111d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x12b249,_0x497138,_0x4af8b4){return new BPromise(function(_0x1ba64c,_0xdf4197){return client['request'](_0x12b249,_0x4af8b4)[_0x111d('0xb')](function(_0xe864cf){logger['info'](_0x111d('0xc'),_0x497138,_0x111d('0xd'));logger[_0x111d('0xe')](_0x111d('0xf'),_0x497138,_0x111d('0xd'),JSON[_0x111d('0x10')](_0xe864cf));if(_0xe864cf[_0x111d('0x11')]){if(_0xe864cf[_0x111d('0x11')]['code']===0x1f4){logger[_0x111d('0x11')](_0x111d('0xc'),_0x497138,_0xe864cf[_0x111d('0x11')]['message']);return _0xdf4197(_0xe864cf['error'][_0x111d('0x12')]);}logger[_0x111d('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0x497138,_0xe864cf['error'][_0x111d('0x12')]);return _0x1ba64c(_0xe864cf[_0x111d('0x11')]['message']);}else{logger['info'](_0x111d('0xc'),_0x497138,'request\x20sent');_0x1ba64c(_0xe864cf[_0x111d('0x13')]['message']);}})[_0x111d('0x14')](function(_0x38b393){logger[_0x111d('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0x497138,_0x38b393);_0xdf4197(_0x38b393);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 9ea852f..5946a48 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 _0x52b3=['get','isAuthenticated','index','show','post','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller'];(function(_0x2ff3f1,_0x40b890){var _0x377c51=function(_0x28b5b3){while(--_0x28b5b3){_0x2ff3f1['push'](_0x2ff3f1['shift']());}};_0x377c51(++_0x40b890);}(_0x52b3,0x19a));var _0x352b=function(_0x2e9fa9,_0x36bd56){_0x2e9fa9=_0x2e9fa9-0x0;var _0x4b1f68=_0x52b3[_0x2e9fa9];return _0x4b1f68;};'use strict';var multer=require(_0x352b('0x0'));var util=require('util');var path=require(_0x352b('0x1'));var timeout=require(_0x352b('0x2'));var express=require(_0x352b('0x3'));var router=express[_0x352b('0x4')]();var fs_extra=require(_0x352b('0x5'));var auth=require(_0x352b('0x6'));var interaction=require(_0x352b('0x7'));var config=require(_0x352b('0x8'));var controller=require(_0x352b('0x9'));router[_0x352b('0xa')]('/',auth[_0x352b('0xb')](),controller[_0x352b('0xc')]);router[_0x352b('0xa')]('/:id',auth[_0x352b('0xb')](),controller[_0x352b('0xd')]);router[_0x352b('0xe')]('/',auth[_0x352b('0xb')](),controller['create']);router[_0x352b('0xf')](_0x352b('0x10'),auth[_0x352b('0xb')](),controller[_0x352b('0x11')]);router[_0x352b('0x12')](_0x352b('0x10'),auth[_0x352b('0xb')](),controller[_0x352b('0x13')]);module[_0x352b('0x14')]=router; \ No newline at end of file +var _0xfd23=['./intServicenowField.controller','get','isAuthenticated','index','show','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x24eab7,_0x29f395){var _0x4bdf65=function(_0x1ee652){while(--_0x1ee652){_0x24eab7['push'](_0x24eab7['shift']());}};_0x4bdf65(++_0x29f395);}(_0xfd23,0x1b0));var _0x3fd2=function(_0x164af1,_0x3cf772){_0x164af1=_0x164af1-0x0;var _0x5d81a2=_0xfd23[_0x164af1];return _0x5d81a2;};'use strict';var multer=require(_0x3fd2('0x0'));var util=require(_0x3fd2('0x1'));var path=require(_0x3fd2('0x2'));var timeout=require(_0x3fd2('0x3'));var express=require(_0x3fd2('0x4'));var router=express[_0x3fd2('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3fd2('0x6'));var config=require(_0x3fd2('0x7'));var controller=require(_0x3fd2('0x8'));router[_0x3fd2('0x9')]('/',auth[_0x3fd2('0xa')](),controller[_0x3fd2('0xb')]);router['get']('/:id',auth[_0x3fd2('0xa')](),controller[_0x3fd2('0xc')]);router['post']('/',auth[_0x3fd2('0xa')](),controller[_0x3fd2('0xd')]);router[_0x3fd2('0xe')](_0x3fd2('0xf'),auth[_0x3fd2('0xa')](),controller[_0x3fd2('0x10')]);router[_0x3fd2('0x11')](_0x3fd2('0xf'),auth[_0x3fd2('0xa')](),controller[_0x3fd2('0x12')]);module[_0x3fd2('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 5ef254a..08b7a64 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 _0x8499=['STRING','ENUM','customVariable','BOOLEAN','string','variable','picklist'];(function(_0x2dc92b,_0x45d7df){var _0x6904e4=function(_0x43e3d){while(--_0x43e3d){_0x2dc92b['push'](_0x2dc92b['shift']());}};_0x6904e4(++_0x45d7df);}(_0x8499,0x177));var _0x9849=function(_0x4c4c7c,_0x55a90b){_0x4c4c7c=_0x4c4c7c-0x0;var _0x161963=_0x8499[_0x4c4c7c];return _0x161963;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM'](_0x9849('0x0'),_0x9849('0x1'),'customVariable','keyValue',_0x9849('0x2')),'defaultValue':_0x9849('0x0')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x9849('0x3')]},'keyType':{'type':Sequelize[_0x9849('0x4')](_0x9849('0x0'),_0x9849('0x1'),_0x9849('0x5'))},'keyContent':{'type':Sequelize[_0x9849('0x3')]},'idField':{'type':Sequelize[_0x9849('0x3')]},'nameField':{'type':Sequelize[_0x9849('0x3')]},'customField':{'type':Sequelize[_0x9849('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd4a0=['STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','picklist'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0xd4a0,0x1a9));var _0x0d4a=function(_0x368e96,_0x3bc021){_0x368e96=_0x368e96-0x0;var _0x257e97=_0xd4a0[_0x368e96];return _0x257e97;};'use strict';var Sequelize=require(_0x0d4a('0x0'));module[_0x0d4a('0x1')]={'type':{'type':Sequelize[_0x0d4a('0x2')](_0x0d4a('0x3'),_0x0d4a('0x4'),_0x0d4a('0x5'),'keyValue',_0x0d4a('0x6')),'defaultValue':_0x0d4a('0x3')},'content':{'type':Sequelize[_0x0d4a('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x0d4a('0x2')](_0x0d4a('0x3'),_0x0d4a('0x4'),_0x0d4a('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x0d4a('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x0d4a('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0d4a('0x7')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index b167252..87d3d41 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 _0x10a7=['Content-Range','reject','update','then','error','stack','name','send','index','map','ServicenowField','rawAttributes','type','keys','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','rows','params','includeAll','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0xc7cb0c,_0x150a36){var _0x3e3e87=function(_0xf7fec8){while(--_0xf7fec8){_0xc7cb0c['push'](_0xc7cb0c['shift']());}};_0x3e3e87(++_0x150a36);}(_0x10a7,0x102));var _0x710a=function(_0x43626b,_0x23c0e6){_0x43626b=_0x43626b-0x0;var _0x5a641b=_0x10a7[_0x43626b];return _0x5a641b;};'use strict';var emlformat=require(_0x710a('0x0'));var rimraf=require(_0x710a('0x1'));var zipdir=require(_0x710a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x710a('0x3'));var util=require(_0x710a('0x4'));var path=require(_0x710a('0x5'));var sox=require(_0x710a('0x6'));var csv=require(_0x710a('0x7'));var ejs=require(_0x710a('0x8'));var fs=require('fs');var fs_extra=require(_0x710a('0x9'));var _=require('lodash');var squel=require(_0x710a('0xa'));var crypto=require(_0x710a('0xb'));var jsforce=require(_0x710a('0xc'));var deskjs=require(_0x710a('0xd'));var toCsv=require('to-csv');var querystring=require(_0x710a('0xe'));var Papa=require('papaparse');var Redis=require(_0x710a('0xf'));var authService=require(_0x710a('0x10'));var qs=require(_0x710a('0x11'));var as=require(_0x710a('0x12'));var hardwareService=require(_0x710a('0x13'));var logger=require(_0x710a('0x14'))(_0x710a('0x15'));var utils=require(_0x710a('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x710a('0x17'));var db=require(_0x710a('0x18'))['db'];function respondWithStatusCode(_0x39e02f,_0x268fb3){_0x268fb3=_0x268fb3||0xcc;return function(_0x7f6281){if(_0x7f6281){return _0x39e02f[_0x710a('0x19')](_0x268fb3);}return _0x39e02f[_0x710a('0x1a')](_0x268fb3)[_0x710a('0x1b')]();};}function respondWithResult(_0x1024a2,_0x35fd84){_0x35fd84=_0x35fd84||0xc8;return function(_0x293fb1){if(_0x293fb1){return _0x1024a2[_0x710a('0x1a')](_0x35fd84)[_0x710a('0x1c')](_0x293fb1);}};}function respondWithFilteredResult(_0x5564e0,_0x3df678){return function(_0x476838){if(_0x476838){var _0x59cd13=typeof _0x3df678[_0x710a('0x1d')]===_0x710a('0x1e')&&typeof _0x3df678[_0x710a('0x1f')]===_0x710a('0x1e');var _0x3623d7=_0x476838[_0x710a('0x20')];var _0x5ae128=_0x59cd13?0x0:_0x3df678[_0x710a('0x1d')];var _0x3597d7=_0x59cd13?_0x476838[_0x710a('0x20')]:_0x3df678['offset']+_0x3df678[_0x710a('0x1f')];var _0x1a435a;if(_0x3597d7>=_0x3623d7){_0x3597d7=_0x3623d7;_0x1a435a=0xc8;}else{_0x1a435a=0xce;}_0x5564e0[_0x710a('0x1a')](_0x1a435a);return _0x5564e0[_0x710a('0x21')](_0x710a('0x22'),_0x5ae128+'-'+_0x3597d7+'/'+_0x3623d7)[_0x710a('0x1c')](_0x476838);}return null;};}function patchUpdates(_0x2af84a){return function(_0xdb53da){try{jsonpatch['apply'](_0xdb53da,_0x2af84a,!![]);}catch(_0x588838){return BPromise[_0x710a('0x23')](_0x588838);}return _0xdb53da['save']();};}function saveUpdates(_0x49cce2,_0x2885ef){return function(_0x583a2e){if(_0x583a2e){return _0x583a2e[_0x710a('0x24')](_0x49cce2)[_0x710a('0x25')](function(_0xe549a2){return _0xe549a2;});}return null;};}function removeEntity(_0x3083ba,_0x289dc9){return function(_0x321b7b){if(_0x321b7b){return _0x321b7b['destroy']()[_0x710a('0x25')](function(){_0x3083ba[_0x710a('0x1a')](0xcc)[_0x710a('0x1b')]();});}};}function handleEntityNotFound(_0x492c4b,_0x158c6d){return function(_0x43ec11){if(!_0x43ec11){_0x492c4b['sendStatus'](0x194);}return _0x43ec11;};}function handleError(_0x21ff66,_0x4d76fc){_0x4d76fc=_0x4d76fc||0x1f4;return function(_0x949faa){logger[_0x710a('0x26')](_0x949faa[_0x710a('0x27')]);if(_0x949faa['name']){delete _0x949faa[_0x710a('0x28')];}_0x21ff66[_0x710a('0x1a')](_0x4d76fc)[_0x710a('0x29')](_0x949faa);};}exports[_0x710a('0x2a')]=function(_0x4eb556,_0x5e075d){var _0x2cfd1b={},_0x3bbeb0={},_0x2ce701={'count':0x0,'rows':[]};var _0x47aae3=_[_0x710a('0x2b')](db[_0x710a('0x2c')][_0x710a('0x2d')],function(_0x3b818a){return{'name':_0x3b818a['fieldName'],'type':_0x3b818a[_0x710a('0x2e')]['key']};});_0x3bbeb0['model']=_[_0x710a('0x2b')](_0x47aae3,_0x710a('0x28'));_0x3bbeb0['query']=_[_0x710a('0x2f')](_0x4eb556[_0x710a('0x30')]);_0x3bbeb0['filters']=_[_0x710a('0x31')](_0x3bbeb0[_0x710a('0x32')],_0x3bbeb0['query']);_0x2cfd1b[_0x710a('0x33')]=_['intersection'](_0x3bbeb0[_0x710a('0x32')],qs[_0x710a('0x34')](_0x4eb556[_0x710a('0x30')][_0x710a('0x34')]));_0x2cfd1b[_0x710a('0x33')]=_0x2cfd1b[_0x710a('0x33')]['length']?_0x2cfd1b['attributes']:_0x3bbeb0['model'];if(!_0x4eb556[_0x710a('0x30')][_0x710a('0x35')](_0x710a('0x36'))){_0x2cfd1b[_0x710a('0x1f')]=qs[_0x710a('0x1f')](_0x4eb556[_0x710a('0x30')]['limit']);_0x2cfd1b[_0x710a('0x1d')]=qs[_0x710a('0x1d')](_0x4eb556[_0x710a('0x30')]['offset']);}_0x2cfd1b[_0x710a('0x37')]=qs[_0x710a('0x38')](_0x4eb556[_0x710a('0x30')][_0x710a('0x38')]);_0x2cfd1b[_0x710a('0x39')]=qs[_0x710a('0x3a')](_[_0x710a('0x3b')](_0x4eb556[_0x710a('0x30')],_0x3bbeb0['filters']),_0x47aae3);if(_0x4eb556['query'][_0x710a('0x3c')]){_0x2cfd1b['where']=_[_0x710a('0x3d')](_0x2cfd1b[_0x710a('0x39')],{'$or':_[_0x710a('0x2b')](_0x47aae3,function(_0x42641c){if(_0x42641c[_0x710a('0x2e')]!==_0x710a('0x3e')){var _0x250082={};_0x250082[_0x42641c[_0x710a('0x28')]]={'$like':'%'+_0x4eb556[_0x710a('0x30')]['filter']+'%'};return _0x250082;}})});}_0x2cfd1b=_[_0x710a('0x3d')]({},_0x2cfd1b,_0x4eb556[_0x710a('0x3f')]);var _0x32f2c1={'where':_0x2cfd1b[_0x710a('0x39')]};return db['ServicenowField']['count'](_0x32f2c1)['then'](function(_0x1ea267){_0x2ce701[_0x710a('0x20')]=_0x1ea267;if(_0x4eb556[_0x710a('0x30')]['includeAll']){_0x2cfd1b[_0x710a('0x40')]=[{'all':!![]}];}return db[_0x710a('0x2c')]['findAll'](_0x2cfd1b);})['then'](function(_0x41e9f7){_0x2ce701[_0x710a('0x41')]=_0x41e9f7;return _0x2ce701;})[_0x710a('0x25')](respondWithFilteredResult(_0x5e075d,_0x2cfd1b))['catch'](handleError(_0x5e075d,null));};exports['show']=function(_0x478fc0,_0x48b380){var _0x1a07bf={'raw':!![],'where':{'id':_0x478fc0[_0x710a('0x42')]['id']}},_0x3deece={};_0x3deece[_0x710a('0x32')]=_['keys'](db[_0x710a('0x2c')][_0x710a('0x2d')]);_0x3deece['query']=_[_0x710a('0x2f')](_0x478fc0[_0x710a('0x30')]);_0x3deece[_0x710a('0x3a')]=_[_0x710a('0x31')](_0x3deece['model'],_0x3deece['query']);_0x1a07bf['attributes']=_[_0x710a('0x31')](_0x3deece[_0x710a('0x32')],qs[_0x710a('0x34')](_0x478fc0[_0x710a('0x30')][_0x710a('0x34')]));_0x1a07bf[_0x710a('0x33')]=_0x1a07bf['attributes']['length']?_0x1a07bf[_0x710a('0x33')]:_0x3deece['model'];if(_0x478fc0[_0x710a('0x30')][_0x710a('0x43')]){_0x1a07bf[_0x710a('0x40')]=[{'all':!![]}];}_0x1a07bf=_[_0x710a('0x3d')]({},_0x1a07bf,_0x478fc0[_0x710a('0x3f')]);return db['ServicenowField'][_0x710a('0x44')](_0x1a07bf)[_0x710a('0x25')](handleEntityNotFound(_0x48b380,null))[_0x710a('0x25')](respondWithResult(_0x48b380,null))[_0x710a('0x45')](handleError(_0x48b380,null));};exports[_0x710a('0x46')]=function(_0x4978bc,_0x5887ae){return db[_0x710a('0x2c')][_0x710a('0x46')](_0x4978bc[_0x710a('0x47')],{})[_0x710a('0x25')](respondWithResult(_0x5887ae,0xc9))['catch'](handleError(_0x5887ae,null));};exports['update']=function(_0x388c44,_0x28be2e){if(_0x388c44[_0x710a('0x47')]['id']){delete _0x388c44[_0x710a('0x47')]['id'];}return db['ServicenowField'][_0x710a('0x44')]({'where':{'id':_0x388c44[_0x710a('0x42')]['id']}})[_0x710a('0x25')](handleEntityNotFound(_0x28be2e,null))['then'](saveUpdates(_0x388c44[_0x710a('0x47')],null))[_0x710a('0x25')](respondWithResult(_0x28be2e,null))['catch'](handleError(_0x28be2e,null));};exports[_0x710a('0x48')]=function(_0x4599ae,_0x362509){return db[_0x710a('0x2c')][_0x710a('0x44')]({'where':{'id':_0x4599ae['params']['id']}})[_0x710a('0x25')](handleEntityNotFound(_0x362509,null))[_0x710a('0x25')](removeEntity(_0x362509,null))[_0x710a('0x45')](handleError(_0x362509,null));}; \ No newline at end of file +var _0xa36d=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','Content-Range','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ServicenowField','includeAll','include','findAll','rows','show','params','find','create','body','catch','rimraf','zip-dir','request-promise','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x24b045,_0x5910f3){var _0x27f2b4=function(_0x4332e3){while(--_0x4332e3){_0x24b045['push'](_0x24b045['shift']());}};_0x27f2b4(++_0x5910f3);}(_0xa36d,0x10e));var _0xda36=function(_0x21317c,_0x435b0f){_0x21317c=_0x21317c-0x0;var _0x19c315=_0xa36d[_0x21317c];return _0x19c315;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xda36('0x0'));var zipdir=require(_0xda36('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xda36('0x2'));var moment=require('moment');var BPromise=require(_0xda36('0x3'));var Mustache=require('mustache');var util=require(_0xda36('0x4'));var path=require(_0xda36('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xda36('0x6'));var fs=require('fs');var fs_extra=require(_0xda36('0x7'));var _=require(_0xda36('0x8'));var squel=require(_0xda36('0x9'));var crypto=require(_0xda36('0xa'));var jsforce=require(_0xda36('0xb'));var deskjs=require(_0xda36('0xc'));var toCsv=require(_0xda36('0xd'));var querystring=require(_0xda36('0xe'));var Papa=require(_0xda36('0xf'));var Redis=require(_0xda36('0x10'));var authService=require(_0xda36('0x11'));var qs=require(_0xda36('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xda36('0x13'));var logger=require(_0xda36('0x14'))('api');var utils=require(_0xda36('0x15'));var config=require(_0xda36('0x16'));var licenseUtil=require(_0xda36('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59d5ae,_0x520e8c){_0x520e8c=_0x520e8c||0xcc;return function(_0x2936d4){if(_0x2936d4){return _0x59d5ae[_0xda36('0x18')](_0x520e8c);}return _0x59d5ae[_0xda36('0x19')](_0x520e8c)[_0xda36('0x1a')]();};}function respondWithResult(_0x4d6e1b,_0x11c58c){_0x11c58c=_0x11c58c||0xc8;return function(_0x45a7f5){if(_0x45a7f5){return _0x4d6e1b['status'](_0x11c58c)['json'](_0x45a7f5);}};}function respondWithFilteredResult(_0x376742,_0x3576fb){return function(_0x4e4e51){if(_0x4e4e51){var _0x104c31=typeof _0x3576fb[_0xda36('0x1b')]===_0xda36('0x1c')&&typeof _0x3576fb['limit']===_0xda36('0x1c');var _0x2d75a9=_0x4e4e51[_0xda36('0x1d')];var _0x1ed860=_0x104c31?0x0:_0x3576fb[_0xda36('0x1b')];var _0x18efa1=_0x104c31?_0x4e4e51[_0xda36('0x1d')]:_0x3576fb[_0xda36('0x1b')]+_0x3576fb[_0xda36('0x1e')];var _0x5099c2;if(_0x18efa1>=_0x2d75a9){_0x18efa1=_0x2d75a9;_0x5099c2=0xc8;}else{_0x5099c2=0xce;}_0x376742[_0xda36('0x19')](_0x5099c2);return _0x376742['set'](_0xda36('0x1f'),_0x1ed860+'-'+_0x18efa1+'/'+_0x2d75a9)['json'](_0x4e4e51);}return null;};}function patchUpdates(_0x522c1e){return function(_0x5c2784){try{jsonpatch['apply'](_0x5c2784,_0x522c1e,!![]);}catch(_0x50071b){return BPromise['reject'](_0x50071b);}return _0x5c2784[_0xda36('0x20')]();};}function saveUpdates(_0xd6351a,_0x472a1b){return function(_0x2cf667){if(_0x2cf667){return _0x2cf667[_0xda36('0x21')](_0xd6351a)['then'](function(_0x3613a2){return _0x3613a2;});}return null;};}function removeEntity(_0x2cc87f,_0x2f3139){return function(_0x28af04){if(_0x28af04){return _0x28af04[_0xda36('0x22')]()[_0xda36('0x23')](function(){_0x2cc87f['status'](0xcc)[_0xda36('0x1a')]();});}};}function handleEntityNotFound(_0x48bede,_0x1e30c0){return function(_0x450824){if(!_0x450824){_0x48bede[_0xda36('0x18')](0x194);}return _0x450824;};}function handleError(_0x45ea8c,_0x2e064c){_0x2e064c=_0x2e064c||0x1f4;return function(_0x3bbd91){logger[_0xda36('0x24')](_0x3bbd91[_0xda36('0x25')]);if(_0x3bbd91[_0xda36('0x26')]){delete _0x3bbd91['name'];}_0x45ea8c[_0xda36('0x19')](_0x2e064c)[_0xda36('0x27')](_0x3bbd91);};}exports[_0xda36('0x28')]=function(_0x578c6c,_0x2a663d){var _0x48a407={},_0x28c742={},_0x5386ef={'count':0x0,'rows':[]};var _0x5df456=_[_0xda36('0x29')](db['ServicenowField'][_0xda36('0x2a')],function(_0x4014a3){return{'name':_0x4014a3['fieldName'],'type':_0x4014a3[_0xda36('0x2b')]['key']};});_0x28c742[_0xda36('0x2c')]=_[_0xda36('0x29')](_0x5df456,_0xda36('0x26'));_0x28c742[_0xda36('0x2d')]=_[_0xda36('0x2e')](_0x578c6c[_0xda36('0x2d')]);_0x28c742[_0xda36('0x2f')]=_[_0xda36('0x30')](_0x28c742[_0xda36('0x2c')],_0x28c742[_0xda36('0x2d')]);_0x48a407[_0xda36('0x31')]=_[_0xda36('0x30')](_0x28c742[_0xda36('0x2c')],qs[_0xda36('0x32')](_0x578c6c['query'][_0xda36('0x32')]));_0x48a407['attributes']=_0x48a407['attributes'][_0xda36('0x33')]?_0x48a407[_0xda36('0x31')]:_0x28c742[_0xda36('0x2c')];if(!_0x578c6c['query']['hasOwnProperty'](_0xda36('0x34'))){_0x48a407['limit']=qs[_0xda36('0x1e')](_0x578c6c[_0xda36('0x2d')]['limit']);_0x48a407[_0xda36('0x1b')]=qs['offset'](_0x578c6c[_0xda36('0x2d')][_0xda36('0x1b')]);}_0x48a407[_0xda36('0x35')]=qs[_0xda36('0x36')](_0x578c6c['query'][_0xda36('0x36')]);_0x48a407[_0xda36('0x37')]=qs[_0xda36('0x2f')](_[_0xda36('0x38')](_0x578c6c[_0xda36('0x2d')],_0x28c742[_0xda36('0x2f')]),_0x5df456);if(_0x578c6c[_0xda36('0x2d')][_0xda36('0x39')]){_0x48a407[_0xda36('0x37')]=_[_0xda36('0x3a')](_0x48a407[_0xda36('0x37')],{'$or':_[_0xda36('0x29')](_0x5df456,function(_0xde8cb){if(_0xde8cb[_0xda36('0x2b')]!==_0xda36('0x3b')){var _0x14045f={};_0x14045f[_0xde8cb[_0xda36('0x26')]]={'$like':'%'+_0x578c6c[_0xda36('0x2d')][_0xda36('0x39')]+'%'};return _0x14045f;}})});}_0x48a407=_[_0xda36('0x3a')]({},_0x48a407,_0x578c6c[_0xda36('0x3c')]);var _0x5e2106={'where':_0x48a407['where']};return db[_0xda36('0x3d')][_0xda36('0x1d')](_0x5e2106)[_0xda36('0x23')](function(_0x4db0e4){_0x5386ef[_0xda36('0x1d')]=_0x4db0e4;if(_0x578c6c[_0xda36('0x2d')][_0xda36('0x3e')]){_0x48a407[_0xda36('0x3f')]=[{'all':!![]}];}return db[_0xda36('0x3d')][_0xda36('0x40')](_0x48a407);})[_0xda36('0x23')](function(_0x5a6db0){_0x5386ef[_0xda36('0x41')]=_0x5a6db0;return _0x5386ef;})[_0xda36('0x23')](respondWithFilteredResult(_0x2a663d,_0x48a407))['catch'](handleError(_0x2a663d,null));};exports[_0xda36('0x42')]=function(_0x444bb5,_0x1990ae){var _0x314e25={'raw':!![],'where':{'id':_0x444bb5[_0xda36('0x43')]['id']}},_0x52a953={};_0x52a953[_0xda36('0x2c')]=_[_0xda36('0x2e')](db[_0xda36('0x3d')]['rawAttributes']);_0x52a953[_0xda36('0x2d')]=_[_0xda36('0x2e')](_0x444bb5['query']);_0x52a953[_0xda36('0x2f')]=_['intersection'](_0x52a953[_0xda36('0x2c')],_0x52a953[_0xda36('0x2d')]);_0x314e25[_0xda36('0x31')]=_[_0xda36('0x30')](_0x52a953[_0xda36('0x2c')],qs[_0xda36('0x32')](_0x444bb5[_0xda36('0x2d')][_0xda36('0x32')]));_0x314e25[_0xda36('0x31')]=_0x314e25[_0xda36('0x31')][_0xda36('0x33')]?_0x314e25[_0xda36('0x31')]:_0x52a953[_0xda36('0x2c')];if(_0x444bb5[_0xda36('0x2d')][_0xda36('0x3e')]){_0x314e25['include']=[{'all':!![]}];}_0x314e25=_[_0xda36('0x3a')]({},_0x314e25,_0x444bb5[_0xda36('0x3c')]);return db[_0xda36('0x3d')][_0xda36('0x44')](_0x314e25)[_0xda36('0x23')](handleEntityNotFound(_0x1990ae,null))[_0xda36('0x23')](respondWithResult(_0x1990ae,null))['catch'](handleError(_0x1990ae,null));};exports[_0xda36('0x45')]=function(_0x45fac1,_0x315846){return db[_0xda36('0x3d')]['create'](_0x45fac1[_0xda36('0x46')],{})[_0xda36('0x23')](respondWithResult(_0x315846,0xc9))[_0xda36('0x47')](handleError(_0x315846,null));};exports[_0xda36('0x21')]=function(_0x5dfbe0,_0x3259e2){if(_0x5dfbe0[_0xda36('0x46')]['id']){delete _0x5dfbe0['body']['id'];}return db['ServicenowField'][_0xda36('0x44')]({'where':{'id':_0x5dfbe0[_0xda36('0x43')]['id']}})[_0xda36('0x23')](handleEntityNotFound(_0x3259e2,null))['then'](saveUpdates(_0x5dfbe0[_0xda36('0x46')],null))[_0xda36('0x23')](respondWithResult(_0x3259e2,null))['catch'](handleError(_0x3259e2,null));};exports[_0xda36('0x22')]=function(_0x4f4aef,_0xb4fac8){return db['ServicenowField'][_0xda36('0x44')]({'where':{'id':_0x4f4aef[_0xda36('0x43')]['id']}})[_0xda36('0x23')](handleEntityNotFound(_0xb4fac8,null))[_0xda36('0x23')](removeEntity(_0xb4fac8,null))[_0xda36('0x47')](handleError(_0xb4fac8,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 9fe5c60..5d30567 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 _0x88c6=['define','ServicenowField','servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger','api','request-promise','path','rimraf','./intServicenowField.attributes','exports'];(function(_0x508f99,_0x1d758b){var _0x429f93=function(_0xcd896){while(--_0xcd896){_0x508f99['push'](_0x508f99['shift']());}};_0x429f93(++_0x1d758b);}(_0x88c6,0x163));var _0x688c=function(_0x519869,_0x5e9535){_0x519869=_0x519869-0x0;var _0x26f819=_0x88c6[_0x519869];return _0x26f819;};'use strict';var _=require(_0x688c('0x0'));var util=require(_0x688c('0x1'));var logger=require(_0x688c('0x2'))(_0x688c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x688c('0x4'));var fs=require('fs');var path=require(_0x688c('0x5'));var rimraf=require(_0x688c('0x6'));var config=require('../../config/environment');var attributes=require(_0x688c('0x7'));module[_0x688c('0x8')]=function(_0x415551,_0x14e6d6){return _0x415551[_0x688c('0x9')](_0x688c('0xa'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x688c('0xb'),'fields':[_0x688c('0xc'),_0x688c('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2bd9=['../../config/environment','./intServicenowField.attributes','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x247994,_0x502fa8){var _0x33f211=function(_0x231a0e){while(--_0x231a0e){_0x247994['push'](_0x247994['shift']());}};_0x33f211(++_0x502fa8);}(_0x2bd9,0x1e8));var _0x92bd=function(_0x5a1d30,_0x245dae){_0x5a1d30=_0x5a1d30-0x0;var _0x1b1e46=_0x2bd9[_0x5a1d30];return _0x1b1e46;};'use strict';var _=require(_0x92bd('0x0'));var util=require(_0x92bd('0x1'));var logger=require(_0x92bd('0x2'))(_0x92bd('0x3'));var moment=require(_0x92bd('0x4'));var BPromise=require(_0x92bd('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x92bd('0x6'));var rimraf=require('rimraf');var config=require(_0x92bd('0x7'));var attributes=require(_0x92bd('0x8'));module['exports']=function(_0x3f7a6c,_0x3bb6f0){return _0x3f7a6c[_0x92bd('0x9')](_0x92bd('0xa'),attributes,{'tableName':_0x92bd('0xb'),'paranoid':![],'indexes':[{'name':_0x92bd('0xc'),'fields':[_0x92bd('0xd'),_0x92bd('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 3feaebb..0883b15 100644 --- a/server/api/intServicenowField/intServicenowField.rpc.js +++ b/server/api/intServicenowField/intServicenowField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ServicenowField,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x3a753a,_0xe655a4){var _0x5599cb=function(_0x2fb507){while(--_0x2fb507){_0x3a753a['push'](_0x3a753a['shift']());}};_0x5599cb(++_0xe655a4);}(_0xb43b,0x1b2));var _0xbb43=function(_0x4f5287,_0x311540){_0x4f5287=_0x4f5287-0x0;var _0x30740c=_0xb43b[_0x4f5287];return _0x30740c;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var moment=require('moment');var BPromise=require(_0xbb43('0x2'));var rs=require(_0xbb43('0x3'));var fs=require('fs');var Redis=require(_0xbb43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb43('0x5'));var logger=require(_0xbb43('0x6'))(_0xbb43('0x7'));var config=require(_0xbb43('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x553520,_0x80fe61,_0x1ccd49){return new BPromise(function(_0x2a2f11,_0x29ae1a){return client[_0xbb43('0xa')](_0x553520,_0x1ccd49)['then'](function(_0x208c2b){logger[_0xbb43('0xb')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0xbb43('0xc'));logger[_0xbb43('0xd')](_0xbb43('0xe'),_0x80fe61,_0xbb43('0xc'),JSON[_0xbb43('0xf')](_0x208c2b));if(_0x208c2b[_0xbb43('0x10')]){if(_0x208c2b['error'][_0xbb43('0x11')]===0x1f4){logger[_0xbb43('0x10')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0x208c2b[_0xbb43('0x10')][_0xbb43('0x12')]);return _0x2a2f11(_0x208c2b['error']['message']);}else{logger['info'](_0xbb43('0x13'),_0x80fe61,_0xbb43('0xc'));_0x2a2f11(_0x208c2b['result']['message']);}})[_0xbb43('0x14')](function(_0x563ce1){logger['error'](_0xbb43('0x13'),_0x80fe61,_0x563ce1);_0x29ae1a(_0x563ce1);});});} \ No newline at end of file +var _0xf4eb=['ServicenowField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x35e507,_0x171e16){var _0x51b71b=function(_0x20a51e){while(--_0x20a51e){_0x35e507['push'](_0x35e507['shift']());}};_0x51b71b(++_0x171e16);}(_0xf4eb,0xec));var _0xbf4e=function(_0x4bacf0,_0x2b9b70){_0x4bacf0=_0x4bacf0-0x0;var _0x59d2a7=_0xf4eb[_0x4bacf0];return _0x59d2a7;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('ServicenowField,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('ServicenowField,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index c1465e1..9048646 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x3baa1b,_0xddad49){var _0x486d0b=function(_0x3efebb){while(--_0x3efebb){_0x3baa1b['push'](_0x3baa1b['shift']());}};_0x486d0b(++_0xddad49);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x3564d4,_0x36cd14){var _0x2cb500=function(_0x5e5d50){while(--_0x5e5d50){_0x3564d4['push'](_0x3564d4['shift']());}};_0x2cb500(++_0x36cd14);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 68d2785..63e6e46 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(_0x1eebd2,_0x26acbf){var _0x1009eb=function(_0x38ee67){while(--_0x38ee67){_0x1eebd2['push'](_0x1eebd2['shift']());}};_0x1009eb(++_0x26acbf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'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(_0x4a709b,_0x30474b){var _0x3b4cc=function(_0x5f38e2){while(--_0x5f38e2){_0x4a709b['push'](_0x4a709b['shift']());}};_0x3b4cc(++_0x30474b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index fcecb05..890d354 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 _0x1d5b=['fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','destroy','getConfigurations','findOne','SugarcrmConfiguration','pick','addConfiguration','AccountId','getSubjects','Descriptions','channel','SugarcrmField','Subjects','getFields','assigned_user_id','created_by','description','duration_hours','parent_id','parent_type','direction','username','password','remoteUri','substring','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','values','module_fields','includes','label','endsWith','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','SugarcrmAccount'];(function(_0x7685e8,_0x2cef77){var _0x5138ca=function(_0x128e3d){while(--_0x128e3d){_0x7685e8['push'](_0x7685e8['shift']());}};_0x5138ca(++_0x2cef77);}(_0x1d5b,0x13c));var _0xb1d5=function(_0x163f51,_0x1ed7e0){_0x163f51=_0x163f51-0x0;var _0x52509d=_0x1d5b[_0x163f51];return _0x52509d;};'use strict';var emlformat=require(_0xb1d5('0x0'));var rimraf=require(_0xb1d5('0x1'));var zipdir=require(_0xb1d5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb1d5('0x3'));var moment=require('moment');var BPromise=require(_0xb1d5('0x4'));var Mustache=require(_0xb1d5('0x5'));var util=require(_0xb1d5('0x6'));var path=require(_0xb1d5('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb1d5('0x8'));var fs=require('fs');var fs_extra=require(_0xb1d5('0x9'));var _=require(_0xb1d5('0xa'));var squel=require(_0xb1d5('0xb'));var crypto=require(_0xb1d5('0xc'));var jsforce=require(_0xb1d5('0xd'));var deskjs=require(_0xb1d5('0xe'));var toCsv=require(_0xb1d5('0xf'));var querystring=require('querystring');var Papa=require(_0xb1d5('0x10'));var Redis=require(_0xb1d5('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb1d5('0x12'));var hardwareService=require(_0xb1d5('0x13'));var logger=require(_0xb1d5('0x14'))('api');var utils=require(_0xb1d5('0x15'));var config=require(_0xb1d5('0x16'));var licenseUtil=require(_0xb1d5('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0xb1d5('0x18'));function respondWithStatusCode(_0x9d4e4,_0x2fd99c){_0x2fd99c=_0x2fd99c||0xcc;return function(_0xc0fa0a){if(_0xc0fa0a){return _0x9d4e4['sendStatus'](_0x2fd99c);}return _0x9d4e4[_0xb1d5('0x19')](_0x2fd99c)[_0xb1d5('0x1a')]();};}function respondWithResult(_0x2c16e2,_0x53e1b3){_0x53e1b3=_0x53e1b3||0xc8;return function(_0x2925fd){if(_0x2925fd){return _0x2c16e2[_0xb1d5('0x19')](_0x53e1b3)[_0xb1d5('0x1b')](_0x2925fd);}};}function respondWithFilteredResult(_0x3fc6a0,_0x5f6066){return function(_0x16a6d0){if(_0x16a6d0){var _0x4fd2f0=typeof _0x5f6066[_0xb1d5('0x1c')]==='undefined'&&typeof _0x5f6066[_0xb1d5('0x1d')]===_0xb1d5('0x1e');var _0x4ab163=_0x16a6d0[_0xb1d5('0x1f')];var _0x1fd51f=_0x4fd2f0?0x0:_0x5f6066[_0xb1d5('0x1c')];var _0x5853e9=_0x4fd2f0?_0x16a6d0[_0xb1d5('0x1f')]:_0x5f6066[_0xb1d5('0x1c')]+_0x5f6066['limit'];var _0x3ce6a9;if(_0x5853e9>=_0x4ab163){_0x5853e9=_0x4ab163;_0x3ce6a9=0xc8;}else{_0x3ce6a9=0xce;}_0x3fc6a0[_0xb1d5('0x19')](_0x3ce6a9);return _0x3fc6a0[_0xb1d5('0x20')](_0xb1d5('0x21'),_0x1fd51f+'-'+_0x5853e9+'/'+_0x4ab163)[_0xb1d5('0x1b')](_0x16a6d0);}return null;};}function patchUpdates(_0x4dde74){return function(_0x4189f0){try{jsonpatch[_0xb1d5('0x22')](_0x4189f0,_0x4dde74,!![]);}catch(_0x390902){return BPromise[_0xb1d5('0x23')](_0x390902);}return _0x4189f0[_0xb1d5('0x24')]();};}function saveUpdates(_0x50e15f,_0xd979d){return function(_0x5ad088){if(_0x5ad088){return _0x5ad088[_0xb1d5('0x25')](_0x50e15f)['then'](function(_0x18e259){return _0x18e259;});}return null;};}function removeEntity(_0x3dde08,_0x4178f0){return function(_0x524487){if(_0x524487){return _0x524487['destroy']()[_0xb1d5('0x26')](function(){_0x3dde08[_0xb1d5('0x19')](0xcc)[_0xb1d5('0x1a')]();});}};}function handleEntityNotFound(_0xef6d33,_0x58a814){return function(_0x2f6428){if(!_0x2f6428){_0xef6d33[_0xb1d5('0x27')](0x194);}return _0x2f6428;};}function handleError(_0x238798,_0x3e6a66){_0x3e6a66=_0x3e6a66||0x1f4;return function(_0x7ba5f9){logger[_0xb1d5('0x28')](_0x7ba5f9[_0xb1d5('0x29')]);if(_0x7ba5f9[_0xb1d5('0x2a')]){delete _0x7ba5f9['name'];}_0x238798[_0xb1d5('0x19')](_0x3e6a66)[_0xb1d5('0x2b')](_0x7ba5f9);};}exports[_0xb1d5('0x2c')]=function(_0x3ab5d6,_0x4e36bf){var _0x38d16b={},_0x18f6fd={},_0x2dd330={'count':0x0,'rows':[]};var _0x8ecfac=_[_0xb1d5('0x2d')](db[_0xb1d5('0x2e')]['rawAttributes'],function(_0x252888){return{'name':_0x252888[_0xb1d5('0x2f')],'type':_0x252888[_0xb1d5('0x30')][_0xb1d5('0x31')]};});_0x18f6fd[_0xb1d5('0x32')]=_['map'](_0x8ecfac,'name');_0x18f6fd[_0xb1d5('0x33')]=_[_0xb1d5('0x34')](_0x3ab5d6[_0xb1d5('0x33')]);_0x18f6fd[_0xb1d5('0x35')]=_[_0xb1d5('0x36')](_0x18f6fd[_0xb1d5('0x32')],_0x18f6fd[_0xb1d5('0x33')]);_0x38d16b[_0xb1d5('0x37')]=_['intersection'](_0x18f6fd[_0xb1d5('0x32')],qs[_0xb1d5('0x38')](_0x3ab5d6[_0xb1d5('0x33')]['fields']));_0x38d16b['attributes']=_0x38d16b[_0xb1d5('0x37')][_0xb1d5('0x39')]?_0x38d16b[_0xb1d5('0x37')]:_0x18f6fd[_0xb1d5('0x32')];if(!_0x3ab5d6[_0xb1d5('0x33')][_0xb1d5('0x3a')](_0xb1d5('0x3b'))){_0x38d16b[_0xb1d5('0x1d')]=qs[_0xb1d5('0x1d')](_0x3ab5d6[_0xb1d5('0x33')][_0xb1d5('0x1d')]);_0x38d16b[_0xb1d5('0x1c')]=qs['offset'](_0x3ab5d6['query'][_0xb1d5('0x1c')]);}_0x38d16b[_0xb1d5('0x3c')]=qs[_0xb1d5('0x3d')](_0x3ab5d6[_0xb1d5('0x33')][_0xb1d5('0x3d')]);_0x38d16b[_0xb1d5('0x3e')]=qs[_0xb1d5('0x35')](_['pick'](_0x3ab5d6[_0xb1d5('0x33')],_0x18f6fd[_0xb1d5('0x35')]),_0x8ecfac);if(_0x3ab5d6['query'][_0xb1d5('0x3f')]){_0x38d16b[_0xb1d5('0x3e')]=_[_0xb1d5('0x40')](_0x38d16b['where'],{'$or':_[_0xb1d5('0x2d')](_0x8ecfac,function(_0x5587e8){if(_0x5587e8[_0xb1d5('0x30')]!==_0xb1d5('0x41')){var _0x3f664e={};_0x3f664e[_0x5587e8[_0xb1d5('0x2a')]]={'$like':'%'+_0x3ab5d6[_0xb1d5('0x33')]['filter']+'%'};return _0x3f664e;}})});}_0x38d16b=_[_0xb1d5('0x40')]({},_0x38d16b,_0x3ab5d6[_0xb1d5('0x42')]);var _0x5b8db0={'where':_0x38d16b[_0xb1d5('0x3e')]};return db[_0xb1d5('0x2e')][_0xb1d5('0x1f')](_0x5b8db0)[_0xb1d5('0x26')](function(_0x495eba){_0x2dd330[_0xb1d5('0x1f')]=_0x495eba;if(_0x3ab5d6[_0xb1d5('0x33')][_0xb1d5('0x43')]){_0x38d16b[_0xb1d5('0x44')]=[{'all':!![]}];}return db[_0xb1d5('0x2e')][_0xb1d5('0x45')](_0x38d16b);})['then'](function(_0x5f3e35){_0x2dd330[_0xb1d5('0x46')]=_0x5f3e35;return _0x2dd330;})['then'](respondWithFilteredResult(_0x4e36bf,_0x38d16b))[_0xb1d5('0x47')](handleError(_0x4e36bf,null));};exports[_0xb1d5('0x48')]=function(_0x4d0330,_0x272814){var _0x97f4c7={'raw':![],'where':{'id':_0x4d0330[_0xb1d5('0x49')]['id']}},_0x34523c={};_0x34523c['model']=_['keys'](db[_0xb1d5('0x2e')][_0xb1d5('0x4a')]);_0x34523c[_0xb1d5('0x33')]=_[_0xb1d5('0x34')](_0x4d0330[_0xb1d5('0x33')]);_0x34523c[_0xb1d5('0x35')]=_[_0xb1d5('0x36')](_0x34523c[_0xb1d5('0x32')],_0x34523c[_0xb1d5('0x33')]);_0x97f4c7[_0xb1d5('0x37')]=_['intersection'](_0x34523c[_0xb1d5('0x32')],qs[_0xb1d5('0x38')](_0x4d0330[_0xb1d5('0x33')][_0xb1d5('0x38')]));_0x97f4c7[_0xb1d5('0x37')]=_0x97f4c7[_0xb1d5('0x37')][_0xb1d5('0x39')]?_0x97f4c7[_0xb1d5('0x37')]:_0x34523c[_0xb1d5('0x32')];if(_0x4d0330['query'][_0xb1d5('0x43')]){_0x97f4c7['include']=[{'all':!![]}];}_0x97f4c7=_[_0xb1d5('0x40')]({},_0x97f4c7,_0x4d0330[_0xb1d5('0x42')]);return db[_0xb1d5('0x2e')][_0xb1d5('0x4b')](_0x97f4c7)[_0xb1d5('0x26')](handleEntityNotFound(_0x272814,null))[_0xb1d5('0x26')](respondWithResult(_0x272814,null))[_0xb1d5('0x47')](handleError(_0x272814,null));};exports[_0xb1d5('0x4c')]=function(_0x493c7b,_0x109156){return db['SugarcrmAccount']['create'](_0x493c7b['body'],{})['then'](respondWithResult(_0x109156,0xc9))[_0xb1d5('0x47')](handleError(_0x109156,null));};exports[_0xb1d5('0x25')]=function(_0x1f0852,_0xf84cf0){if(_0x1f0852[_0xb1d5('0x4d')]['id']){delete _0x1f0852[_0xb1d5('0x4d')]['id'];}return db['SugarcrmAccount'][_0xb1d5('0x4b')]({'where':{'id':_0x1f0852[_0xb1d5('0x49')]['id']}})[_0xb1d5('0x26')](handleEntityNotFound(_0xf84cf0,null))[_0xb1d5('0x26')](saveUpdates(_0x1f0852[_0xb1d5('0x4d')],null))[_0xb1d5('0x26')](respondWithResult(_0xf84cf0,null))[_0xb1d5('0x47')](handleError(_0xf84cf0,null));};exports[_0xb1d5('0x4e')]=function(_0x553b13,_0x8ca5d2){return db[_0xb1d5('0x2e')]['find']({'where':{'id':_0x553b13['params']['id']}})[_0xb1d5('0x26')](handleEntityNotFound(_0x8ca5d2,null))[_0xb1d5('0x26')](removeEntity(_0x8ca5d2,null))[_0xb1d5('0x47')](handleError(_0x8ca5d2,null));};exports[_0xb1d5('0x4f')]=function(_0x23b621,_0xcc68f6,_0x20f4d1){var _0x23c2f3={};var _0x5ce00d={};var _0x222ec9;var _0x384dec;return db[_0xb1d5('0x2e')][_0xb1d5('0x50')]({'where':{'id':_0x23b621[_0xb1d5('0x49')]['id']}})[_0xb1d5('0x26')](handleEntityNotFound(_0xcc68f6,null))[_0xb1d5('0x26')](function(_0x186da3){if(_0x186da3){_0x222ec9=_0x186da3;_0x5ce00d[_0xb1d5('0x32')]=_[_0xb1d5('0x34')](db[_0xb1d5('0x51')][_0xb1d5('0x4a')]);_0x5ce00d[_0xb1d5('0x33')]=_[_0xb1d5('0x34')](_0x23b621['query']);_0x5ce00d[_0xb1d5('0x35')]=_[_0xb1d5('0x36')](_0x5ce00d['model'],_0x5ce00d['query']);_0x23c2f3[_0xb1d5('0x37')]=_['intersection'](_0x5ce00d[_0xb1d5('0x32')],qs[_0xb1d5('0x38')](_0x23b621[_0xb1d5('0x33')][_0xb1d5('0x38')]));_0x23c2f3['attributes']=_0x23c2f3[_0xb1d5('0x37')][_0xb1d5('0x39')]?_0x23c2f3[_0xb1d5('0x37')]:_0x5ce00d[_0xb1d5('0x32')];_0x23c2f3[_0xb1d5('0x3c')]=qs['sort'](_0x23b621['query'][_0xb1d5('0x3d')]);_0x23c2f3[_0xb1d5('0x3e')]=qs[_0xb1d5('0x35')](_[_0xb1d5('0x52')](_0x23b621[_0xb1d5('0x33')],_0x5ce00d[_0xb1d5('0x35')]));if(_0x23b621[_0xb1d5('0x33')]['filter']){_0x23c2f3[_0xb1d5('0x3e')]=_[_0xb1d5('0x40')](_0x23c2f3[_0xb1d5('0x3e')],{'$or':_[_0xb1d5('0x2d')](_0x23c2f3[_0xb1d5('0x37')],function(_0x5a8e5b){var _0x42abe3={};_0x42abe3[_0x5a8e5b]={'$like':'%'+_0x23b621['query'][_0xb1d5('0x3f')]+'%'};return _0x42abe3;})});}_0x23c2f3=_[_0xb1d5('0x40')]({},_0x23c2f3,_0x23b621[_0xb1d5('0x42')]);return _0x222ec9[_0xb1d5('0x4f')](_0x23c2f3);}})['then'](function(_0x458141){if(_0x458141){_0x384dec=_0x458141[_0xb1d5('0x39')];if(!_0x23b621[_0xb1d5('0x33')][_0xb1d5('0x3a')](_0xb1d5('0x3b'))){_0x23c2f3[_0xb1d5('0x1d')]=qs['limit'](_0x23b621[_0xb1d5('0x33')][_0xb1d5('0x1d')]);_0x23c2f3[_0xb1d5('0x1c')]=qs['offset'](_0x23b621[_0xb1d5('0x33')]['offset']);}return _0x222ec9[_0xb1d5('0x4f')](_0x23c2f3);}})['then'](function(_0x38b5d5){if(_0x38b5d5){return _0x38b5d5?{'count':_0x384dec,'rows':_0x38b5d5}:null;}})[_0xb1d5('0x26')](respondWithResult(_0xcc68f6,null))[_0xb1d5('0x47')](handleError(_0xcc68f6,null));};exports[_0xb1d5('0x53')]=function(_0x2624a8,_0x3a65b8,_0x5509f6){if(_0x2624a8[_0xb1d5('0x4d')]['id']){delete _0x2624a8[_0xb1d5('0x4d')]['id'];}return db[_0xb1d5('0x2e')]['findOne']({'where':{'id':_0x2624a8[_0xb1d5('0x49')]['id']}})['then'](handleEntityNotFound(_0x3a65b8,null))[_0xb1d5('0x26')](function(_0xa123ba){if(_0xa123ba){_0x2624a8['body'][_0xb1d5('0x54')]=_0xa123ba['id'];_0x2624a8[_0xb1d5('0x4d')]['Subjects']=integrations[_0xb1d5('0x55')](_0x2624a8[_0xb1d5('0x4d')]['channel'],_0x2624a8['body']['type']);_0x2624a8[_0xb1d5('0x4d')][_0xb1d5('0x56')]=integrations['getDescriptions'](_0x2624a8[_0xb1d5('0x4d')][_0xb1d5('0x57')],_0x2624a8[_0xb1d5('0x4d')][_0xb1d5('0x30')]);return db[_0xb1d5('0x51')][_0xb1d5('0x4c')](_0x2624a8[_0xb1d5('0x4d')],{'include':[{'model':db[_0xb1d5('0x58')],'as':_0xb1d5('0x59')},{'model':db[_0xb1d5('0x58')],'as':_0xb1d5('0x56')}]});}return null;})[_0xb1d5('0x26')](respondWithResult(_0x3a65b8,null))[_0xb1d5('0x47')](handleError(_0x3a65b8,null));};exports[_0xb1d5('0x5a')]=function(_0x2705fc,_0x355f61,_0x26760f){var _0x44c822='';var _0x25ac5b=['id',_0xb1d5('0x2a'),_0xb1d5('0x5b'),_0xb1d5('0x5c'),_0xb1d5('0x5d'),'date_start',_0xb1d5('0x5e'),'duration_minutes',_0xb1d5('0x5f'),_0xb1d5('0x60'),'parent_name',_0xb1d5('0x61')];return db[_0xb1d5('0x2e')][_0xb1d5('0x50')]({'where':{'id':_0x2705fc[_0xb1d5('0x49')]['id']},'attributes':['id',_0xb1d5('0x62'),_0xb1d5('0x63'),_0xb1d5('0x64')]})[_0xb1d5('0x26')](handleEntityNotFound(_0x355f61,null))[_0xb1d5('0x26')](function(_0x9c3d9f){if(_0x9c3d9f){_0x44c822=_0x9c3d9f[_0xb1d5('0x64')];var _0x13c7a3=_0x44c822['slice'](-0x1);if(_0x13c7a3==='/'){_0x44c822=_0x44c822[_0xb1d5('0x65')](0x0,_0x44c822['lastIndexOf'](_0x13c7a3));}return rp({'method':_0xb1d5('0x66'),'uri':util[_0xb1d5('0x67')](_0xb1d5('0x68'),_0x44c822,_0xb1d5('0x69')),'json':!![],'form':{'method':_0xb1d5('0x6a'),'input_type':_0xb1d5('0x6b'),'response_type':_0xb1d5('0x6b'),'rest_data':JSON[_0xb1d5('0x6c')]({'user_auth':{'user_name':_0x9c3d9f[_0xb1d5('0x62')],'password':_0x9c3d9f[_0xb1d5('0x63')],'encryption':_0xb1d5('0x6d')},'application':_0xb1d5('0x6e')})}});}})[_0xb1d5('0x26')](function(_0x23f635){if(_0x23f635&&_0x23f635[_0xb1d5('0x2a')]!==_0xb1d5('0x6f')&&_0x23f635[_0xb1d5('0x2a')]!=='Password\x20Expired'){return rp({'method':'POST','uri':util[_0xb1d5('0x67')](_0xb1d5('0x68'),_0x44c822,_0xb1d5('0x69')),'json':!![],'form':{'method':'get_module_fields','input_type':_0xb1d5('0x6b'),'response_type':_0xb1d5('0x6b'),'rest_data':JSON[_0xb1d5('0x6c')]({'session':_0x23f635['id'],'module_name':'Calls'})}})[_0xb1d5('0x26')](function(_0x268112){if(_0x268112){var _0x44aa23=_[_0xb1d5('0x70')](_0x268112[_0xb1d5('0x71')]);_['remove'](_0x44aa23,function(_0x2e14ae){return _0x25ac5b[_0xb1d5('0x72')](_0x2e14ae[_0xb1d5('0x2a')]);});return{'count':_0x44aa23[_0xb1d5('0x39')],'rows':_[_0xb1d5('0x2d')](_0x44aa23,function(_0x45d9e0){return{'id':_0x45d9e0['name'],'name':_0x45d9e0[_0xb1d5('0x73')],'custom':_[_0xb1d5('0x74')](_0x45d9e0[_0xb1d5('0x2a')],'_c')?!![]:![],'options':_0x45d9e0[_0xb1d5('0x42')]?_[_0xb1d5('0x2d')](_['values'](_0x45d9e0[_0xb1d5('0x42')]),function(_0x478efb){return{'name':_0x478efb[_0xb1d5('0x75')],'value':_0x478efb[_0xb1d5('0x2a')]};}):[]};})};}})[_0xb1d5('0x26')](respondWithResult(_0x355f61,null))[_0xb1d5('0x47')](function(_0x1f088e){var _0x42a754=_0x2705fc[_0xb1d5('0x33')]['test']?0x1f4:_0x1f088e[_0xb1d5('0x76')]||0x1f4;logger[_0xb1d5('0x28')](_0xb1d5('0x77'),_0xb1d5('0x5a'),_0x42a754,JSON[_0xb1d5('0x6c')](_0x1f088e));delete _0x1f088e[_0xb1d5('0x2a')];if(_0x42a754===0x191){_0x42a754=0x190;}_0x355f61['status'](_0x42a754)[_0xb1d5('0x2b')](_0x2705fc['query']['test']?{'message':_0xb1d5('0x78'),'statusCode':_0x1f088e['statusCode']}:_0x1f088e);});}else{var _0x23074a=0x1f4;_0x355f61[_0xb1d5('0x19')](_0x23074a)['send']({'message':_0xb1d5('0x78'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xe7f0=['module_fields','remove','includes','label','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','pick','filter','merge','VIRTUAL','options','where','SugarcrmAccount','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','findOne','SugarcrmConfiguration','getConfigurations','hasOwnProperty','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','Subjects','getFields','assigned_user_id','created_by','description','duration_hours','duration_minutes','parent_type','parent_name','direction','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','login','JSON','xCALLY\x20Motion\x20Integration','Invalid\x20Login','/service/v4_1/rest.php','get_module_fields','Calls','values'];(function(_0x8afdd0,_0x548ad1){var _0x3de7ac=function(_0x2dc2c4){while(--_0x2dc2c4){_0x8afdd0['push'](_0x8afdd0['shift']());}};_0x3de7ac(++_0x548ad1);}(_0xe7f0,0x183));var _0x0e7f=function(_0x1875c8,_0x4e5f7a){_0x1875c8=_0x1875c8-0x0;var _0x28ed91=_0xe7f0[_0x1875c8];return _0x28ed91;};'use strict';var emlformat=require(_0x0e7f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0e7f('0x1'));var rp=require(_0x0e7f('0x2'));var moment=require(_0x0e7f('0x3'));var BPromise=require(_0x0e7f('0x4'));var Mustache=require(_0x0e7f('0x5'));var util=require(_0x0e7f('0x6'));var path=require(_0x0e7f('0x7'));var sox=require(_0x0e7f('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0e7f('0x9'));var _=require(_0x0e7f('0xa'));var squel=require(_0x0e7f('0xb'));var crypto=require('crypto');var jsforce=require(_0x0e7f('0xc'));var deskjs=require(_0x0e7f('0xd'));var toCsv=require(_0x0e7f('0xe'));var querystring=require('querystring');var Papa=require(_0x0e7f('0xf'));var Redis=require(_0x0e7f('0x10'));var authService=require(_0x0e7f('0x11'));var qs=require(_0x0e7f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0e7f('0x13'))(_0x0e7f('0x14'));var utils=require(_0x0e7f('0x15'));var config=require(_0x0e7f('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x0e7f('0x17'));function respondWithStatusCode(_0x4b2974,_0x56ae9c){_0x56ae9c=_0x56ae9c||0xcc;return function(_0x208716){if(_0x208716){return _0x4b2974[_0x0e7f('0x18')](_0x56ae9c);}return _0x4b2974[_0x0e7f('0x19')](_0x56ae9c)[_0x0e7f('0x1a')]();};}function respondWithResult(_0x10cdc3,_0x5bc27a){_0x5bc27a=_0x5bc27a||0xc8;return function(_0x3a1f28){if(_0x3a1f28){return _0x10cdc3[_0x0e7f('0x19')](_0x5bc27a)[_0x0e7f('0x1b')](_0x3a1f28);}};}function respondWithFilteredResult(_0x2d7a6f,_0x15d488){return function(_0x21b63d){if(_0x21b63d){var _0x53ca45=typeof _0x15d488[_0x0e7f('0x1c')]===_0x0e7f('0x1d')&&typeof _0x15d488[_0x0e7f('0x1e')]===_0x0e7f('0x1d');var _0x869990=_0x21b63d[_0x0e7f('0x1f')];var _0x3f96a4=_0x53ca45?0x0:_0x15d488[_0x0e7f('0x1c')];var _0x5e8605=_0x53ca45?_0x21b63d['count']:_0x15d488[_0x0e7f('0x1c')]+_0x15d488[_0x0e7f('0x1e')];var _0x36099b;if(_0x5e8605>=_0x869990){_0x5e8605=_0x869990;_0x36099b=0xc8;}else{_0x36099b=0xce;}_0x2d7a6f[_0x0e7f('0x19')](_0x36099b);return _0x2d7a6f[_0x0e7f('0x20')](_0x0e7f('0x21'),_0x3f96a4+'-'+_0x5e8605+'/'+_0x869990)[_0x0e7f('0x1b')](_0x21b63d);}return null;};}function patchUpdates(_0x2b280e){return function(_0x154a69){try{jsonpatch[_0x0e7f('0x22')](_0x154a69,_0x2b280e,!![]);}catch(_0x31adb0){return BPromise[_0x0e7f('0x23')](_0x31adb0);}return _0x154a69[_0x0e7f('0x24')]();};}function saveUpdates(_0x1fae4d,_0x41a8cc){return function(_0x319d62){if(_0x319d62){return _0x319d62[_0x0e7f('0x25')](_0x1fae4d)[_0x0e7f('0x26')](function(_0x5dbbed){return _0x5dbbed;});}return null;};}function removeEntity(_0x36c90b,_0x45f854){return function(_0x43a053){if(_0x43a053){return _0x43a053[_0x0e7f('0x27')]()[_0x0e7f('0x26')](function(){_0x36c90b[_0x0e7f('0x19')](0xcc)[_0x0e7f('0x1a')]();});}};}function handleEntityNotFound(_0x48e34e,_0x25d04f){return function(_0x37afd7){if(!_0x37afd7){_0x48e34e[_0x0e7f('0x18')](0x194);}return _0x37afd7;};}function handleError(_0x39c245,_0x20f11c){_0x20f11c=_0x20f11c||0x1f4;return function(_0xd94690){logger[_0x0e7f('0x28')](_0xd94690[_0x0e7f('0x29')]);if(_0xd94690['name']){delete _0xd94690[_0x0e7f('0x2a')];}_0x39c245['status'](_0x20f11c)['send'](_0xd94690);};}exports[_0x0e7f('0x2b')]=function(_0x3b19cd,_0x229602){var _0x5c5826={},_0x430dca={},_0x9044df={'count':0x0,'rows':[]};var _0xe41794=_[_0x0e7f('0x2c')](db['SugarcrmAccount'][_0x0e7f('0x2d')],function(_0x5b7570){return{'name':_0x5b7570[_0x0e7f('0x2e')],'type':_0x5b7570[_0x0e7f('0x2f')][_0x0e7f('0x30')]};});_0x430dca[_0x0e7f('0x31')]=_['map'](_0xe41794,'name');_0x430dca[_0x0e7f('0x32')]=_[_0x0e7f('0x33')](_0x3b19cd['query']);_0x430dca[_0x0e7f('0x34')]=_[_0x0e7f('0x35')](_0x430dca['model'],_0x430dca[_0x0e7f('0x32')]);_0x5c5826['attributes']=_[_0x0e7f('0x35')](_0x430dca['model'],qs[_0x0e7f('0x36')](_0x3b19cd[_0x0e7f('0x32')][_0x0e7f('0x36')]));_0x5c5826['attributes']=_0x5c5826['attributes']['length']?_0x5c5826[_0x0e7f('0x37')]:_0x430dca['model'];if(!_0x3b19cd['query']['hasOwnProperty'](_0x0e7f('0x38'))){_0x5c5826[_0x0e7f('0x1e')]=qs[_0x0e7f('0x1e')](_0x3b19cd[_0x0e7f('0x32')][_0x0e7f('0x1e')]);_0x5c5826[_0x0e7f('0x1c')]=qs['offset'](_0x3b19cd[_0x0e7f('0x32')][_0x0e7f('0x1c')]);}_0x5c5826[_0x0e7f('0x39')]=qs[_0x0e7f('0x3a')](_0x3b19cd[_0x0e7f('0x32')][_0x0e7f('0x3a')]);_0x5c5826['where']=qs[_0x0e7f('0x34')](_[_0x0e7f('0x3b')](_0x3b19cd[_0x0e7f('0x32')],_0x430dca['filters']),_0xe41794);if(_0x3b19cd[_0x0e7f('0x32')][_0x0e7f('0x3c')]){_0x5c5826['where']=_[_0x0e7f('0x3d')](_0x5c5826['where'],{'$or':_[_0x0e7f('0x2c')](_0xe41794,function(_0x2c7c22){if(_0x2c7c22[_0x0e7f('0x2f')]!==_0x0e7f('0x3e')){var _0x398a12={};_0x398a12[_0x2c7c22['name']]={'$like':'%'+_0x3b19cd[_0x0e7f('0x32')][_0x0e7f('0x3c')]+'%'};return _0x398a12;}})});}_0x5c5826=_[_0x0e7f('0x3d')]({},_0x5c5826,_0x3b19cd[_0x0e7f('0x3f')]);var _0x5c9acc={'where':_0x5c5826[_0x0e7f('0x40')]};return db[_0x0e7f('0x41')]['count'](_0x5c9acc)[_0x0e7f('0x26')](function(_0x10eb7e){_0x9044df[_0x0e7f('0x1f')]=_0x10eb7e;if(_0x3b19cd['query'][_0x0e7f('0x42')]){_0x5c5826[_0x0e7f('0x43')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0x0e7f('0x44')](_0x5c5826);})['then'](function(_0x8e202a){_0x9044df[_0x0e7f('0x45')]=_0x8e202a;return _0x9044df;})['then'](respondWithFilteredResult(_0x229602,_0x5c5826))['catch'](handleError(_0x229602,null));};exports[_0x0e7f('0x46')]=function(_0x4e11bf,_0x1a0764){var _0x4e609a={'raw':![],'where':{'id':_0x4e11bf[_0x0e7f('0x47')]['id']}},_0x4a45d3={};_0x4a45d3[_0x0e7f('0x31')]=_[_0x0e7f('0x33')](db['SugarcrmAccount'][_0x0e7f('0x2d')]);_0x4a45d3['query']=_[_0x0e7f('0x33')](_0x4e11bf['query']);_0x4a45d3['filters']=_[_0x0e7f('0x35')](_0x4a45d3[_0x0e7f('0x31')],_0x4a45d3['query']);_0x4e609a[_0x0e7f('0x37')]=_['intersection'](_0x4a45d3[_0x0e7f('0x31')],qs['fields'](_0x4e11bf[_0x0e7f('0x32')][_0x0e7f('0x36')]));_0x4e609a['attributes']=_0x4e609a[_0x0e7f('0x37')][_0x0e7f('0x48')]?_0x4e609a[_0x0e7f('0x37')]:_0x4a45d3[_0x0e7f('0x31')];if(_0x4e11bf[_0x0e7f('0x32')][_0x0e7f('0x42')]){_0x4e609a[_0x0e7f('0x43')]=[{'all':!![]}];}_0x4e609a=_['merge']({},_0x4e609a,_0x4e11bf[_0x0e7f('0x3f')]);return db[_0x0e7f('0x41')][_0x0e7f('0x49')](_0x4e609a)[_0x0e7f('0x26')](handleEntityNotFound(_0x1a0764,null))[_0x0e7f('0x26')](respondWithResult(_0x1a0764,null))[_0x0e7f('0x4a')](handleError(_0x1a0764,null));};exports[_0x0e7f('0x4b')]=function(_0x4e1708,_0x445b4e){return db[_0x0e7f('0x41')][_0x0e7f('0x4b')](_0x4e1708[_0x0e7f('0x4c')],{})[_0x0e7f('0x26')](respondWithResult(_0x445b4e,0xc9))['catch'](handleError(_0x445b4e,null));};exports[_0x0e7f('0x25')]=function(_0x2ffbf0,_0x123f1a){if(_0x2ffbf0[_0x0e7f('0x4c')]['id']){delete _0x2ffbf0[_0x0e7f('0x4c')]['id'];}return db[_0x0e7f('0x41')][_0x0e7f('0x49')]({'where':{'id':_0x2ffbf0['params']['id']}})[_0x0e7f('0x26')](handleEntityNotFound(_0x123f1a,null))['then'](saveUpdates(_0x2ffbf0[_0x0e7f('0x4c')],null))['then'](respondWithResult(_0x123f1a,null))[_0x0e7f('0x4a')](handleError(_0x123f1a,null));};exports[_0x0e7f('0x27')]=function(_0x12246a,_0x384ee9){return db['SugarcrmAccount'][_0x0e7f('0x49')]({'where':{'id':_0x12246a['params']['id']}})[_0x0e7f('0x26')](handleEntityNotFound(_0x384ee9,null))[_0x0e7f('0x26')](removeEntity(_0x384ee9,null))[_0x0e7f('0x4a')](handleError(_0x384ee9,null));};exports['getConfigurations']=function(_0x367506,_0x30b5fe,_0xaa04dd){var _0x203a6d={};var _0x15247b={};var _0x29b978;var _0x2d7f45;return db[_0x0e7f('0x41')][_0x0e7f('0x4d')]({'where':{'id':_0x367506[_0x0e7f('0x47')]['id']}})['then'](handleEntityNotFound(_0x30b5fe,null))[_0x0e7f('0x26')](function(_0x164c44){if(_0x164c44){_0x29b978=_0x164c44;_0x15247b[_0x0e7f('0x31')]=_[_0x0e7f('0x33')](db[_0x0e7f('0x4e')][_0x0e7f('0x2d')]);_0x15247b[_0x0e7f('0x32')]=_[_0x0e7f('0x33')](_0x367506[_0x0e7f('0x32')]);_0x15247b[_0x0e7f('0x34')]=_[_0x0e7f('0x35')](_0x15247b[_0x0e7f('0x31')],_0x15247b[_0x0e7f('0x32')]);_0x203a6d['attributes']=_[_0x0e7f('0x35')](_0x15247b[_0x0e7f('0x31')],qs[_0x0e7f('0x36')](_0x367506['query'][_0x0e7f('0x36')]));_0x203a6d[_0x0e7f('0x37')]=_0x203a6d[_0x0e7f('0x37')][_0x0e7f('0x48')]?_0x203a6d[_0x0e7f('0x37')]:_0x15247b[_0x0e7f('0x31')];_0x203a6d[_0x0e7f('0x39')]=qs['sort'](_0x367506[_0x0e7f('0x32')][_0x0e7f('0x3a')]);_0x203a6d[_0x0e7f('0x40')]=qs[_0x0e7f('0x34')](_[_0x0e7f('0x3b')](_0x367506[_0x0e7f('0x32')],_0x15247b[_0x0e7f('0x34')]));if(_0x367506['query'][_0x0e7f('0x3c')]){_0x203a6d['where']=_[_0x0e7f('0x3d')](_0x203a6d[_0x0e7f('0x40')],{'$or':_[_0x0e7f('0x2c')](_0x203a6d['attributes'],function(_0x5903c5){var _0x32bb52={};_0x32bb52[_0x5903c5]={'$like':'%'+_0x367506['query'][_0x0e7f('0x3c')]+'%'};return _0x32bb52;})});}_0x203a6d=_[_0x0e7f('0x3d')]({},_0x203a6d,_0x367506[_0x0e7f('0x3f')]);return _0x29b978[_0x0e7f('0x4f')](_0x203a6d);}})[_0x0e7f('0x26')](function(_0x1057d4){if(_0x1057d4){_0x2d7f45=_0x1057d4[_0x0e7f('0x48')];if(!_0x367506[_0x0e7f('0x32')][_0x0e7f('0x50')]('nolimit')){_0x203a6d['limit']=qs[_0x0e7f('0x1e')](_0x367506[_0x0e7f('0x32')][_0x0e7f('0x1e')]);_0x203a6d[_0x0e7f('0x1c')]=qs['offset'](_0x367506[_0x0e7f('0x32')][_0x0e7f('0x1c')]);}return _0x29b978['getConfigurations'](_0x203a6d);}})[_0x0e7f('0x26')](function(_0xe95436){if(_0xe95436){return _0xe95436?{'count':_0x2d7f45,'rows':_0xe95436}:null;}})[_0x0e7f('0x26')](respondWithResult(_0x30b5fe,null))[_0x0e7f('0x4a')](handleError(_0x30b5fe,null));};exports[_0x0e7f('0x51')]=function(_0x43b76c,_0xe9ee65,_0x2270d9){if(_0x43b76c[_0x0e7f('0x4c')]['id']){delete _0x43b76c['body']['id'];}return db['SugarcrmAccount'][_0x0e7f('0x4d')]({'where':{'id':_0x43b76c['params']['id']}})[_0x0e7f('0x26')](handleEntityNotFound(_0xe9ee65,null))[_0x0e7f('0x26')](function(_0x4dcfa4){if(_0x4dcfa4){_0x43b76c[_0x0e7f('0x4c')]['AccountId']=_0x4dcfa4['id'];_0x43b76c['body']['Subjects']=integrations[_0x0e7f('0x52')](_0x43b76c[_0x0e7f('0x4c')][_0x0e7f('0x53')],_0x43b76c['body'][_0x0e7f('0x2f')]);_0x43b76c[_0x0e7f('0x4c')][_0x0e7f('0x54')]=integrations[_0x0e7f('0x55')](_0x43b76c[_0x0e7f('0x4c')][_0x0e7f('0x53')],_0x43b76c[_0x0e7f('0x4c')]['type']);return db['SugarcrmConfiguration'][_0x0e7f('0x4b')](_0x43b76c[_0x0e7f('0x4c')],{'include':[{'model':db[_0x0e7f('0x56')],'as':_0x0e7f('0x57')},{'model':db[_0x0e7f('0x56')],'as':_0x0e7f('0x54')}]});}return null;})[_0x0e7f('0x26')](respondWithResult(_0xe9ee65,null))[_0x0e7f('0x4a')](handleError(_0xe9ee65,null));};exports[_0x0e7f('0x58')]=function(_0x5d351b,_0x26a4b0,_0x45f2a4){var _0x4c6f17='';var _0x3509ee=['id',_0x0e7f('0x2a'),_0x0e7f('0x59'),_0x0e7f('0x5a'),_0x0e7f('0x5b'),'date_start',_0x0e7f('0x5c'),_0x0e7f('0x5d'),'parent_id',_0x0e7f('0x5e'),_0x0e7f('0x5f'),_0x0e7f('0x60')];return db['SugarcrmAccount'][_0x0e7f('0x4d')]({'where':{'id':_0x5d351b[_0x0e7f('0x47')]['id']},'attributes':['id','username',_0x0e7f('0x61'),_0x0e7f('0x62')]})[_0x0e7f('0x26')](handleEntityNotFound(_0x26a4b0,null))['then'](function(_0x3fc516){if(_0x3fc516){_0x4c6f17=_0x3fc516[_0x0e7f('0x62')];var _0x18982b=_0x4c6f17[_0x0e7f('0x63')](-0x1);if(_0x18982b==='/'){_0x4c6f17=_0x4c6f17[_0x0e7f('0x64')](0x0,_0x4c6f17[_0x0e7f('0x65')](_0x18982b));}return rp({'method':_0x0e7f('0x66'),'uri':util[_0x0e7f('0x67')](_0x0e7f('0x68'),_0x4c6f17,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x0e7f('0x69'),'input_type':_0x0e7f('0x6a'),'response_type':_0x0e7f('0x6a'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x3fc516['username'],'password':_0x3fc516[_0x0e7f('0x61')],'encryption':'PLAIN'},'application':_0x0e7f('0x6b')})}});}})[_0x0e7f('0x26')](function(_0x144086){if(_0x144086&&_0x144086[_0x0e7f('0x2a')]!==_0x0e7f('0x6c')&&_0x144086[_0x0e7f('0x2a')]!=='Password\x20Expired'){return rp({'method':'POST','uri':util['format']('%s%s',_0x4c6f17,_0x0e7f('0x6d')),'json':!![],'form':{'method':_0x0e7f('0x6e'),'input_type':_0x0e7f('0x6a'),'response_type':_0x0e7f('0x6a'),'rest_data':JSON['stringify']({'session':_0x144086['id'],'module_name':_0x0e7f('0x6f')})}})[_0x0e7f('0x26')](function(_0x4a25c5){if(_0x4a25c5){var _0x11a772=_[_0x0e7f('0x70')](_0x4a25c5[_0x0e7f('0x71')]);_[_0x0e7f('0x72')](_0x11a772,function(_0x49775d){return _0x3509ee[_0x0e7f('0x73')](_0x49775d[_0x0e7f('0x2a')]);});return{'count':_0x11a772['length'],'rows':_[_0x0e7f('0x2c')](_0x11a772,function(_0x598aab){return{'id':_0x598aab[_0x0e7f('0x2a')],'name':_0x598aab[_0x0e7f('0x74')],'custom':_[_0x0e7f('0x75')](_0x598aab[_0x0e7f('0x2a')],'_c')?!![]:![],'options':_0x598aab[_0x0e7f('0x3f')]?_[_0x0e7f('0x2c')](_[_0x0e7f('0x70')](_0x598aab[_0x0e7f('0x3f')]),function(_0x3da9d0){return{'name':_0x3da9d0[_0x0e7f('0x76')],'value':_0x3da9d0[_0x0e7f('0x2a')]};}):[]};})};}})['then'](respondWithResult(_0x26a4b0,null))[_0x0e7f('0x4a')](function(_0x263039){var _0x3f108e=_0x5d351b[_0x0e7f('0x32')][_0x0e7f('0x77')]?0x1f4:_0x263039[_0x0e7f('0x78')]||0x1f4;logger[_0x0e7f('0x28')](_0x0e7f('0x79'),_0x0e7f('0x58'),_0x3f108e,JSON[_0x0e7f('0x7a')](_0x263039));delete _0x263039['name'];if(_0x3f108e===0x191){_0x3f108e=0x190;}_0x26a4b0['status'](_0x3f108e)[_0x0e7f('0x7b')](_0x5d351b[_0x0e7f('0x32')][_0x0e7f('0x77')]?{'message':_0x0e7f('0x7c'),'statusCode':_0x263039[_0x0e7f('0x78')]}:_0x263039);});}else{var _0x2075b6=0x1f4;_0x26a4b0[_0x0e7f('0x19')](_0x2075b6)[_0x0e7f('0x7b')]({'message':_0x0e7f('0x7c'),'statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index 8f41480..0924461 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 _0xbd4e=['moment','path','../../config/environment','./intSugarcrmAccount.attributes','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','api'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xbd4e,0x1cb));var _0xebd4=function(_0x31593f,_0x4297f5){_0x31593f=_0x31593f-0x0;var _0x337201=_0xbd4e[_0x31593f];return _0x337201;};'use strict';var _=require(_0xebd4('0x0'));var util=require(_0xebd4('0x1'));var logger=require('../../config/logger')(_0xebd4('0x2'));var moment=require(_0xebd4('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xebd4('0x4'));var rimraf=require('rimraf');var config=require(_0xebd4('0x5'));var attributes=require(_0xebd4('0x6'));var integrations=require('../../components/integrations/configuration');module[_0xebd4('0x7')]=function(_0x2c2cf9,_0x584ba3){return _0x2c2cf9[_0xebd4('0x8')](_0xebd4('0x9'),attributes,{'tableName':_0xebd4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1ef7=['path','rimraf','../../config/environment','../../components/integrations/configuration','int_sugarcrm_accounts','util'];(function(_0x1e3d9c,_0x5ebbda){var _0x19248d=function(_0x2408ee){while(--_0x2408ee){_0x1e3d9c['push'](_0x1e3d9c['shift']());}};_0x19248d(++_0x5ebbda);}(_0x1ef7,0x173));var _0x71ef=function(_0x25efdf,_0x521462){_0x25efdf=_0x25efdf-0x0;var _0x22c495=_0x1ef7[_0x25efdf];return _0x22c495;};'use strict';var _=require('lodash');var util=require(_0x71ef('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x71ef('0x1'));var rimraf=require(_0x71ef('0x2'));var config=require(_0x71ef('0x3'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0x71ef('0x4'));module['exports']=function(_0xc5ae43,_0x17aa97){return _0xc5ae43['define']('SugarcrmAccount',attributes,{'tableName':_0x71ef('0x5'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 314e9df..47ade9e 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 _0x258a=['include','model','attributes','debug','where','ShowSugarcrmAccount','stringify','lodash','util','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','error','code','SugarcrmAccount,\x20%s,\x20%s','message','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','limit','map'];(function(_0x1f61bf,_0x227534){var _0x598290=function(_0x4e65a3){while(--_0x4e65a3){_0x1f61bf['push'](_0x1f61bf['shift']());}};_0x598290(++_0x227534);}(_0x258a,0x83));var _0xa258=function(_0x1cea20,_0x2efc8b){_0x1cea20=_0x1cea20-0x0;var _0x518ca2=_0x258a[_0x1cea20];return _0x518ca2;};'use strict';var _=require(_0xa258('0x0'));var util=require(_0xa258('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa258('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa258('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa258('0x4'))(_0xa258('0x5'));var config=require(_0xa258('0x6'));var jayson=require(_0xa258('0x7'));var client=jayson['client'][_0xa258('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x44e6f2,_0x48d1de,_0x3b282f){return new BPromise(function(_0x1f0ef7,_0x7f8461){return client['request'](_0x44e6f2,_0x3b282f)[_0xa258('0x9')](function(_0x518023){logger[_0xa258('0xa')]('SugarcrmAccount,\x20%s,\x20%s',_0x48d1de,_0xa258('0xb'));logger['debug']('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x48d1de,_0xa258('0xb'),JSON['stringify'](_0x518023));if(_0x518023['error']){if(_0x518023[_0xa258('0xc')][_0xa258('0xd')]===0x1f4){logger[_0xa258('0xc')](_0xa258('0xe'),_0x48d1de,_0x518023[_0xa258('0xc')][_0xa258('0xf')]);return _0x7f8461(_0x518023[_0xa258('0xc')][_0xa258('0xf')]);}logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x48d1de,_0x518023['error'][_0xa258('0xf')]);return _0x1f0ef7(_0x518023[_0xa258('0xc')][_0xa258('0xf')]);}else{logger[_0xa258('0xa')](_0xa258('0xe'),_0x48d1de,_0xa258('0xb'));_0x1f0ef7(_0x518023['result'][_0xa258('0xf')]);}})[_0xa258('0x10')](function(_0x333831){logger['error'](_0xa258('0xe'),_0x48d1de,_0x333831);_0x7f8461(_0x333831);});});}exports[_0xa258('0x11')]=function(_0x1f3e06){var _0x334a23=this;return new Promise(function(_0x134b4e,_0x2f069f){return db[_0xa258('0x12')][_0xa258('0x13')]({'raw':_0x1f3e06[_0xa258('0x14')]?_0x1f3e06[_0xa258('0x14')][_0xa258('0x15')]===undefined?!![]:![]:!![],'where':_0x1f3e06['options']?_0x1f3e06['options']['where']||null:null,'attributes':_0x1f3e06[_0xa258('0x14')]?_0x1f3e06[_0xa258('0x14')]['attributes']||null:null,'limit':_0x1f3e06['options']?_0x1f3e06[_0xa258('0x14')][_0xa258('0x16')]||null:null,'include':_0x1f3e06[_0xa258('0x14')]?_0x1f3e06[_0xa258('0x14')]['include']?_[_0xa258('0x17')](_0x1f3e06[_0xa258('0x14')][_0xa258('0x18')],function(_0x871b74){return{'model':db[_0x871b74[_0xa258('0x19')]],'as':_0x871b74['as'],'attributes':_0x871b74[_0xa258('0x1a')],'include':_0x871b74[_0xa258('0x18')]?_[_0xa258('0x17')](_0x871b74['include'],function(_0x2c6a36){return{'model':db[_0x2c6a36['model']],'as':_0x2c6a36['as'],'attributes':_0x2c6a36['attributes'],'include':_0x2c6a36[_0xa258('0x18')]?_[_0xa258('0x17')](_0x2c6a36[_0xa258('0x18')],function(_0x515e06){return{'model':db[_0x515e06[_0xa258('0x19')]],'as':_0x515e06['as'],'attributes':_0x515e06[_0xa258('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa258('0x9')](function(_0x4dc3f6){logger[_0xa258('0xa')](_0xa258('0x11'),_0x1f3e06);logger[_0xa258('0x1b')](_0xa258('0x11'),_0x1f3e06,JSON['stringify'](_0x4dc3f6));_0x134b4e(_0x4dc3f6);})[_0xa258('0x10')](function(_0x13b3c1){logger['error'](_0xa258('0x11'),_0x13b3c1['message'],_0x1f3e06);_0x2f069f(_0x334a23[_0xa258('0xc')](0x1f4,_0x13b3c1[_0xa258('0xf')]));});});};exports['ShowSugarcrmAccount']=function(_0x551a90){var _0x15ae0d=this;return new Promise(function(_0x5dc440,_0x18e051){return db[_0xa258('0x12')]['find']({'raw':_0x551a90[_0xa258('0x14')]?_0x551a90[_0xa258('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x551a90[_0xa258('0x14')]?_0x551a90[_0xa258('0x14')][_0xa258('0x1c')]||null:null,'attributes':_0x551a90[_0xa258('0x14')]?_0x551a90[_0xa258('0x14')][_0xa258('0x1a')]||null:null,'include':_0x551a90[_0xa258('0x14')]?_0x551a90[_0xa258('0x14')][_0xa258('0x18')]?_['map'](_0x551a90['options'][_0xa258('0x18')],function(_0x348a81){return{'model':db[_0x348a81['model']],'as':_0x348a81['as'],'attributes':_0x348a81[_0xa258('0x1a')],'include':_0x348a81[_0xa258('0x18')]?_[_0xa258('0x17')](_0x348a81[_0xa258('0x18')],function(_0x2d823f){return{'model':db[_0x2d823f[_0xa258('0x19')]],'as':_0x2d823f['as'],'attributes':_0x2d823f[_0xa258('0x1a')],'include':_0x2d823f['include']?_[_0xa258('0x17')](_0x2d823f[_0xa258('0x18')],function(_0x113ead){return{'model':db[_0x113ead['model']],'as':_0x113ead['as'],'attributes':_0x113ead[_0xa258('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa258('0x9')](function(_0x33c573){logger[_0xa258('0xa')](_0xa258('0x1d'),_0x551a90);logger[_0xa258('0x1b')](_0xa258('0x1d'),_0x551a90,JSON[_0xa258('0x1e')](_0x33c573));_0x5dc440(_0x33c573);})[_0xa258('0x10')](function(_0x20d708){logger[_0xa258('0xc')](_0xa258('0x1d'),_0x20d708[_0xa258('0xf')],_0x551a90);_0x18e051(_0x15ae0d[_0xa258('0xc')](0x1f4,_0x20d708[_0xa258('0xf')]));});});}; \ No newline at end of file +var _0xef86=['error','code','message','result','catch','GetSugarcrmAccount','findAll','options','raw','where','attributes','map','include','model','ShowSugarcrmAccount','SugarcrmAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x5b9688,_0x4c9393){var _0x1945ab=function(_0x333c99){while(--_0x333c99){_0x5b9688['push'](_0x5b9688['shift']());}};_0x1945ab(++_0x4c9393);}(_0xef86,0x165));var _0x6ef8=function(_0x307012,_0x37a31d){_0x307012=_0x307012-0x0;var _0x2b74cc=_0xef86[_0x307012];return _0x2b74cc;};'use strict';var _=require(_0x6ef8('0x0'));var util=require(_0x6ef8('0x1'));var moment=require(_0x6ef8('0x2'));var BPromise=require(_0x6ef8('0x3'));var rs=require(_0x6ef8('0x4'));var fs=require('fs');var Redis=require(_0x6ef8('0x5'));var db=require(_0x6ef8('0x6'))['db'];var utils=require(_0x6ef8('0x7'));var logger=require('../../config/logger')(_0x6ef8('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6ef8('0x9')][_0x6ef8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x308877,_0x35cc99,_0xe4a741){return new BPromise(function(_0x4c42af,_0x4b93b2){return client['request'](_0x308877,_0xe4a741)[_0x6ef8('0xb')](function(_0x47b0f6){logger[_0x6ef8('0xc')](_0x6ef8('0xd'),_0x35cc99,_0x6ef8('0xe'));logger[_0x6ef8('0xf')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x35cc99,_0x6ef8('0xe'),JSON[_0x6ef8('0x10')](_0x47b0f6));if(_0x47b0f6[_0x6ef8('0x11')]){if(_0x47b0f6[_0x6ef8('0x11')][_0x6ef8('0x12')]===0x1f4){logger[_0x6ef8('0x11')]('SugarcrmAccount,\x20%s,\x20%s',_0x35cc99,_0x47b0f6[_0x6ef8('0x11')][_0x6ef8('0x13')]);return _0x4b93b2(_0x47b0f6[_0x6ef8('0x11')][_0x6ef8('0x13')]);}logger[_0x6ef8('0x11')](_0x6ef8('0xd'),_0x35cc99,_0x47b0f6[_0x6ef8('0x11')][_0x6ef8('0x13')]);return _0x4c42af(_0x47b0f6[_0x6ef8('0x11')][_0x6ef8('0x13')]);}else{logger[_0x6ef8('0xc')](_0x6ef8('0xd'),_0x35cc99,_0x6ef8('0xe'));_0x4c42af(_0x47b0f6[_0x6ef8('0x14')][_0x6ef8('0x13')]);}})[_0x6ef8('0x15')](function(_0xb886d5){logger['error'](_0x6ef8('0xd'),_0x35cc99,_0xb886d5);_0x4b93b2(_0xb886d5);});});}exports[_0x6ef8('0x16')]=function(_0x9a8544){var _0x5cb80f=this;return new Promise(function(_0x1e5c86,_0x1f15ce){return db['SugarcrmAccount'][_0x6ef8('0x17')]({'raw':_0x9a8544[_0x6ef8('0x18')]?_0x9a8544['options'][_0x6ef8('0x19')]===undefined?!![]:![]:!![],'where':_0x9a8544[_0x6ef8('0x18')]?_0x9a8544[_0x6ef8('0x18')][_0x6ef8('0x1a')]||null:null,'attributes':_0x9a8544[_0x6ef8('0x18')]?_0x9a8544[_0x6ef8('0x18')][_0x6ef8('0x1b')]||null:null,'limit':_0x9a8544[_0x6ef8('0x18')]?_0x9a8544[_0x6ef8('0x18')]['limit']||null:null,'include':_0x9a8544[_0x6ef8('0x18')]?_0x9a8544[_0x6ef8('0x18')]['include']?_[_0x6ef8('0x1c')](_0x9a8544['options'][_0x6ef8('0x1d')],function(_0x5854a2){return{'model':db[_0x5854a2[_0x6ef8('0x1e')]],'as':_0x5854a2['as'],'attributes':_0x5854a2[_0x6ef8('0x1b')],'include':_0x5854a2[_0x6ef8('0x1d')]?_[_0x6ef8('0x1c')](_0x5854a2[_0x6ef8('0x1d')],function(_0xe00b47){return{'model':db[_0xe00b47[_0x6ef8('0x1e')]],'as':_0xe00b47['as'],'attributes':_0xe00b47[_0x6ef8('0x1b')],'include':_0xe00b47[_0x6ef8('0x1d')]?_['map'](_0xe00b47[_0x6ef8('0x1d')],function(_0x1e3ee1){return{'model':db[_0x1e3ee1[_0x6ef8('0x1e')]],'as':_0x1e3ee1['as'],'attributes':_0x1e3ee1['attributes']};}):[]};}):[]};}):[]:[]})[_0x6ef8('0xb')](function(_0x9fd82c){logger[_0x6ef8('0xc')]('GetSugarcrmAccount',_0x9a8544);logger[_0x6ef8('0xf')](_0x6ef8('0x16'),_0x9a8544,JSON[_0x6ef8('0x10')](_0x9fd82c));_0x1e5c86(_0x9fd82c);})[_0x6ef8('0x15')](function(_0x4aac0b){logger[_0x6ef8('0x11')](_0x6ef8('0x16'),_0x4aac0b[_0x6ef8('0x13')],_0x9a8544);_0x1f15ce(_0x5cb80f[_0x6ef8('0x11')](0x1f4,_0x4aac0b[_0x6ef8('0x13')]));});});};exports[_0x6ef8('0x1f')]=function(_0x824268){var _0x4a7f17=this;return new Promise(function(_0x4eb295,_0x24271f){return db[_0x6ef8('0x20')][_0x6ef8('0x21')]({'raw':_0x824268['options']?_0x824268[_0x6ef8('0x18')][_0x6ef8('0x19')]===undefined?!![]:![]:!![],'where':_0x824268[_0x6ef8('0x18')]?_0x824268[_0x6ef8('0x18')][_0x6ef8('0x1a')]||null:null,'attributes':_0x824268[_0x6ef8('0x18')]?_0x824268[_0x6ef8('0x18')][_0x6ef8('0x1b')]||null:null,'include':_0x824268[_0x6ef8('0x18')]?_0x824268[_0x6ef8('0x18')][_0x6ef8('0x1d')]?_['map'](_0x824268[_0x6ef8('0x18')]['include'],function(_0x4f9244){return{'model':db[_0x4f9244[_0x6ef8('0x1e')]],'as':_0x4f9244['as'],'attributes':_0x4f9244[_0x6ef8('0x1b')],'include':_0x4f9244[_0x6ef8('0x1d')]?_[_0x6ef8('0x1c')](_0x4f9244[_0x6ef8('0x1d')],function(_0x3a8d3b){return{'model':db[_0x3a8d3b['model']],'as':_0x3a8d3b['as'],'attributes':_0x3a8d3b[_0x6ef8('0x1b')],'include':_0x3a8d3b[_0x6ef8('0x1d')]?_[_0x6ef8('0x1c')](_0x3a8d3b[_0x6ef8('0x1d')],function(_0xeac924){return{'model':db[_0xeac924[_0x6ef8('0x1e')]],'as':_0xeac924['as'],'attributes':_0xeac924[_0x6ef8('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6ef8('0xb')](function(_0x35579b){logger[_0x6ef8('0xc')](_0x6ef8('0x1f'),_0x824268);logger['debug']('ShowSugarcrmAccount',_0x824268,JSON[_0x6ef8('0x10')](_0x35579b));_0x4eb295(_0x35579b);})[_0x6ef8('0x15')](function(_0x5d78f0){logger[_0x6ef8('0x11')]('ShowSugarcrmAccount',_0x5d78f0[_0x6ef8('0x13')],_0x824268);_0x24271f(_0x4a7f17['error'](0x1f4,_0x5d78f0[_0x6ef8('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 7df4f81..7b3b760 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 _0x615e=['show','/:id/fields','getFields','getSubjects','/:id/descriptions','create','/:id','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index'];(function(_0x130f63,_0x11bc11){var _0x500bbc=function(_0x512736){while(--_0x512736){_0x130f63['push'](_0x130f63['shift']());}};_0x500bbc(++_0x11bc11);}(_0x615e,0x15f));var _0xe615=function(_0x44fe72,_0x4ba452){_0x44fe72=_0x44fe72-0x0;var _0x5f6fca=_0x615e[_0x44fe72];return _0x5f6fca;};'use strict';var multer=require(_0xe615('0x0'));var util=require(_0xe615('0x1'));var path=require(_0xe615('0x2'));var timeout=require('connect-timeout');var express=require(_0xe615('0x3'));var router=express[_0xe615('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe615('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe615('0x6'));var controller=require('./intSugarcrmConfiguration.controller');router[_0xe615('0x7')]('/',auth[_0xe615('0x8')](),controller[_0xe615('0x9')]);router[_0xe615('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xe615('0xa')]);router[_0xe615('0x7')](_0xe615('0xb'),auth[_0xe615('0x8')](),controller[_0xe615('0xc')]);router[_0xe615('0x7')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xe615('0xd')]);router[_0xe615('0x7')](_0xe615('0xe'),auth[_0xe615('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0xe615('0x8')](),controller[_0xe615('0xf')]);router['put'](_0xe615('0x10'),auth[_0xe615('0x8')](),controller['update']);router[_0xe615('0x11')]('/:id',auth[_0xe615('0x8')](),controller[_0xe615('0x12')]);module['exports']=router; \ No newline at end of file +var _0x8027=['/:id/descriptions','getDescriptions','post','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','/:id/fields','getFields','/:id/subjects'];(function(_0x267c52,_0x3c0df3){var _0x46c47b=function(_0x3c3740){while(--_0x3c3740){_0x267c52['push'](_0x267c52['shift']());}};_0x46c47b(++_0x3c0df3);}(_0x8027,0x91));var _0x7802=function(_0xcb8fde,_0x24399c){_0xcb8fde=_0xcb8fde-0x0;var _0x16dd77=_0x8027[_0xcb8fde];return _0x16dd77;};'use strict';var multer=require(_0x7802('0x0'));var util=require(_0x7802('0x1'));var path=require(_0x7802('0x2'));var timeout=require(_0x7802('0x3'));var express=require('express');var router=express[_0x7802('0x4')]();var fs_extra=require(_0x7802('0x5'));var auth=require(_0x7802('0x6'));var interaction=require(_0x7802('0x7'));var config=require(_0x7802('0x8'));var controller=require('./intSugarcrmConfiguration.controller');router[_0x7802('0x9')]('/',auth['isAuthenticated'](),controller[_0x7802('0xa')]);router[_0x7802('0x9')](_0x7802('0xb'),auth[_0x7802('0xc')](),controller['show']);router[_0x7802('0x9')](_0x7802('0xd'),auth['isAuthenticated'](),controller[_0x7802('0xe')]);router[_0x7802('0x9')](_0x7802('0xf'),auth[_0x7802('0xc')](),controller['getSubjects']);router[_0x7802('0x9')](_0x7802('0x10'),auth[_0x7802('0xc')](),controller[_0x7802('0x11')]);router[_0x7802('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7802('0x13')](_0x7802('0xb'),auth[_0x7802('0xc')](),controller['update']);router[_0x7802('0x14')]('/:id',auth[_0x7802('0xc')](),controller[_0x7802('0x15')]);module[_0x7802('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 5522583..19fa478 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 _0xa6bf=['sequelize','exports','STRING'];(function(_0x4a03a7,_0x35fde9){var _0x118824=function(_0x18bff6){while(--_0x18bff6){_0x4a03a7['push'](_0x4a03a7['shift']());}};_0x118824(++_0x35fde9);}(_0xa6bf,0xb7));var _0xfa6b=function(_0x138420,_0x13c244){_0x138420=_0x138420-0x0;var _0x3ef300=_0xa6bf[_0x138420];return _0x3ef300;};'use strict';var Sequelize=require(_0xfa6b('0x0'));module[_0xfa6b('0x1')]={'name':{'type':Sequelize[_0xfa6b('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc1ca=['STRING','exports'];(function(_0x505919,_0x15ad93){var _0x672df9=function(_0x2ab2e5){while(--_0x2ab2e5){_0x505919['push'](_0x505919['shift']());}};_0x672df9(++_0x15ad93);}(_0xc1ca,0x12f));var _0xac1c=function(_0x42cb3d,_0x2a6b89){_0x42cb3d=_0x42cb3d-0x0;var _0x480c2b=_0xc1ca[_0x42cb3d];return _0x480c2b;};'use strict';var Sequelize=require('sequelize');module[_0xac1c('0x0')]={'name':{'type':Sequelize[_0xac1c('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 5003bfa..8386040 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 _0x0d95=['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','error','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','create','body','find','params','destroy','getFields','SugarcrmField','getSubjects','findOne','getDescriptions','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'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x0d95,0xed));var _0x50d9=function(_0x15577f,_0x45366c){_0x15577f=_0x15577f-0x0;var _0x39b107=_0x0d95[_0x15577f];return _0x39b107;};'use strict';var emlformat=require(_0x50d9('0x0'));var rimraf=require(_0x50d9('0x1'));var zipdir=require(_0x50d9('0x2'));var jsonpatch=require(_0x50d9('0x3'));var rp=require(_0x50d9('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x50d9('0x5'));var util=require('util');var path=require(_0x50d9('0x6'));var sox=require(_0x50d9('0x7'));var csv=require(_0x50d9('0x8'));var ejs=require(_0x50d9('0x9'));var fs=require('fs');var fs_extra=require(_0x50d9('0xa'));var _=require(_0x50d9('0xb'));var squel=require(_0x50d9('0xc'));var crypto=require(_0x50d9('0xd'));var jsforce=require(_0x50d9('0xe'));var deskjs=require(_0x50d9('0xf'));var toCsv=require(_0x50d9('0x8'));var querystring=require(_0x50d9('0x10'));var Papa=require(_0x50d9('0x11'));var Redis=require(_0x50d9('0x12'));var authService=require(_0x50d9('0x13'));var qs=require(_0x50d9('0x14'));var as=require(_0x50d9('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x50d9('0x16'))(_0x50d9('0x17'));var utils=require(_0x50d9('0x18'));var config=require(_0x50d9('0x19'));var licenseUtil=require(_0x50d9('0x1a'));var db=require(_0x50d9('0x1b'))['db'];function respondWithStatusCode(_0xc8d9f1,_0x40bf87){_0x40bf87=_0x40bf87||0xcc;return function(_0x54ab9c){if(_0x54ab9c){return _0xc8d9f1[_0x50d9('0x1c')](_0x40bf87);}return _0xc8d9f1[_0x50d9('0x1d')](_0x40bf87)[_0x50d9('0x1e')]();};}function respondWithResult(_0x291f5a,_0x1111df){_0x1111df=_0x1111df||0xc8;return function(_0xcdd198){if(_0xcdd198){return _0x291f5a['status'](_0x1111df)[_0x50d9('0x1f')](_0xcdd198);}};}function respondWithFilteredResult(_0x1369fc,_0x25a97e){return function(_0x38578e){if(_0x38578e){var _0x11742b=typeof _0x25a97e[_0x50d9('0x20')]===_0x50d9('0x21')&&typeof _0x25a97e[_0x50d9('0x22')]===_0x50d9('0x21');var _0x2b77c5=_0x38578e[_0x50d9('0x23')];var _0x577832=_0x11742b?0x0:_0x25a97e[_0x50d9('0x20')];var _0x563b17=_0x11742b?_0x38578e['count']:_0x25a97e[_0x50d9('0x20')]+_0x25a97e[_0x50d9('0x22')];var _0x5bc67f;if(_0x563b17>=_0x2b77c5){_0x563b17=_0x2b77c5;_0x5bc67f=0xc8;}else{_0x5bc67f=0xce;}_0x1369fc[_0x50d9('0x1d')](_0x5bc67f);return _0x1369fc[_0x50d9('0x24')](_0x50d9('0x25'),_0x577832+'-'+_0x563b17+'/'+_0x2b77c5)[_0x50d9('0x1f')](_0x38578e);}return null;};}function patchUpdates(_0x493866){return function(_0x232be2){try{jsonpatch[_0x50d9('0x26')](_0x232be2,_0x493866,!![]);}catch(_0x3b92ab){return BPromise[_0x50d9('0x27')](_0x3b92ab);}return _0x232be2[_0x50d9('0x28')]();};}function saveUpdates(_0x3e13c8,_0x192dce){return function(_0x3eeb23){if(_0x3eeb23){return _0x3eeb23[_0x50d9('0x29')](_0x3e13c8)['then'](function(_0x145fbf){return _0x145fbf;});}return null;};}function removeEntity(_0x39b974,_0x5dda36){return function(_0x1a88d9){if(_0x1a88d9){return _0x1a88d9['destroy']()[_0x50d9('0x2a')](function(){_0x39b974['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x54097d,_0x4b71b3){return function(_0x30c9d3){if(!_0x30c9d3){_0x54097d[_0x50d9('0x1c')](0x194);}return _0x30c9d3;};}function handleError(_0x384310,_0x2f7429){_0x2f7429=_0x2f7429||0x1f4;return function(_0x27c8da){logger[_0x50d9('0x2b')](_0x27c8da[_0x50d9('0x2c')]);if(_0x27c8da[_0x50d9('0x2d')]){delete _0x27c8da['name'];}_0x384310[_0x50d9('0x1d')](_0x2f7429)[_0x50d9('0x2e')](_0x27c8da);};}exports[_0x50d9('0x2f')]=function(_0x131811,_0x3272b0){var _0x570d21={},_0x5b5b40={},_0x25b8b4={'count':0x0,'rows':[]};var _0x1da16a=_[_0x50d9('0x30')](db[_0x50d9('0x31')][_0x50d9('0x32')],function(_0x38f3dd){return{'name':_0x38f3dd['fieldName'],'type':_0x38f3dd[_0x50d9('0x33')]['key']};});_0x5b5b40['model']=_['map'](_0x1da16a,_0x50d9('0x2d'));_0x5b5b40[_0x50d9('0x34')]=_[_0x50d9('0x35')](_0x131811[_0x50d9('0x34')]);_0x5b5b40['filters']=_[_0x50d9('0x36')](_0x5b5b40[_0x50d9('0x37')],_0x5b5b40[_0x50d9('0x34')]);_0x570d21[_0x50d9('0x38')]=_['intersection'](_0x5b5b40[_0x50d9('0x37')],qs['fields'](_0x131811['query'][_0x50d9('0x39')]));_0x570d21[_0x50d9('0x38')]=_0x570d21['attributes'][_0x50d9('0x3a')]?_0x570d21[_0x50d9('0x38')]:_0x5b5b40[_0x50d9('0x37')];if(!_0x131811['query'][_0x50d9('0x3b')](_0x50d9('0x3c'))){_0x570d21[_0x50d9('0x22')]=qs[_0x50d9('0x22')](_0x131811[_0x50d9('0x34')]['limit']);_0x570d21[_0x50d9('0x20')]=qs[_0x50d9('0x20')](_0x131811[_0x50d9('0x34')][_0x50d9('0x20')]);}_0x570d21[_0x50d9('0x3d')]=qs['sort'](_0x131811[_0x50d9('0x34')][_0x50d9('0x3e')]);_0x570d21[_0x50d9('0x3f')]=qs[_0x50d9('0x40')](_[_0x50d9('0x41')](_0x131811[_0x50d9('0x34')],_0x5b5b40['filters']),_0x1da16a);if(_0x131811[_0x50d9('0x34')]['filter']){_0x570d21['where']=_[_0x50d9('0x42')](_0x570d21['where'],{'$or':_[_0x50d9('0x30')](_0x1da16a,function(_0x1cf534){if(_0x1cf534[_0x50d9('0x33')]!==_0x50d9('0x43')){var _0x5dc9f6={};_0x5dc9f6[_0x1cf534[_0x50d9('0x2d')]]={'$like':'%'+_0x131811[_0x50d9('0x34')][_0x50d9('0x44')]+'%'};return _0x5dc9f6;}})});}_0x570d21=_['merge']({},_0x570d21,_0x131811[_0x50d9('0x45')]);var _0x5bcd8f={'where':_0x570d21[_0x50d9('0x3f')]};return db['SugarcrmConfiguration'][_0x50d9('0x23')](_0x5bcd8f)[_0x50d9('0x2a')](function(_0x4c8dd4){_0x25b8b4[_0x50d9('0x23')]=_0x4c8dd4;if(_0x131811['query'][_0x50d9('0x46')]){_0x570d21[_0x50d9('0x47')]=[{'all':!![]}];}return db[_0x50d9('0x31')]['findAll'](_0x570d21);})[_0x50d9('0x2a')](function(_0x3fef67){_0x25b8b4[_0x50d9('0x48')]=_0x3fef67;return _0x25b8b4;})[_0x50d9('0x2a')](respondWithFilteredResult(_0x3272b0,_0x570d21))[_0x50d9('0x49')](handleError(_0x3272b0,null));};exports[_0x50d9('0x4a')]=function(_0x3e5338,_0x272ec1){var _0x2450ae={'raw':![],'where':{'id':_0x3e5338['params']['id']}},_0xd75a17={};_0xd75a17[_0x50d9('0x37')]=_[_0x50d9('0x35')](db[_0x50d9('0x31')][_0x50d9('0x32')]);_0xd75a17[_0x50d9('0x34')]=_[_0x50d9('0x35')](_0x3e5338[_0x50d9('0x34')]);_0xd75a17[_0x50d9('0x40')]=_[_0x50d9('0x36')](_0xd75a17[_0x50d9('0x37')],_0xd75a17[_0x50d9('0x34')]);_0x2450ae[_0x50d9('0x38')]=_[_0x50d9('0x36')](_0xd75a17[_0x50d9('0x37')],qs[_0x50d9('0x39')](_0x3e5338[_0x50d9('0x34')][_0x50d9('0x39')]));_0x2450ae[_0x50d9('0x38')]=_0x2450ae[_0x50d9('0x38')][_0x50d9('0x3a')]?_0x2450ae[_0x50d9('0x38')]:_0xd75a17[_0x50d9('0x37')];if(_0x3e5338['query'][_0x50d9('0x46')]){_0x2450ae[_0x50d9('0x47')]=[{'all':!![]}];}_0x2450ae=_['merge']({},_0x2450ae,_0x3e5338[_0x50d9('0x45')]);return db[_0x50d9('0x31')]['find'](_0x2450ae)['then'](handleEntityNotFound(_0x272ec1,null))[_0x50d9('0x2a')](respondWithResult(_0x272ec1,null))[_0x50d9('0x49')](handleError(_0x272ec1,null));};exports[_0x50d9('0x4b')]=function(_0x1b7891,_0x530e0c){return db['SugarcrmConfiguration']['create'](_0x1b7891[_0x50d9('0x4c')],{})['then'](respondWithResult(_0x530e0c,0xc9))[_0x50d9('0x49')](handleError(_0x530e0c,null));};exports[_0x50d9('0x29')]=function(_0x30da52,_0xd5b279){if(_0x30da52[_0x50d9('0x4c')]['id']){delete _0x30da52[_0x50d9('0x4c')]['id'];}return db[_0x50d9('0x31')][_0x50d9('0x4d')]({'where':{'id':_0x30da52[_0x50d9('0x4e')]['id']}})[_0x50d9('0x2a')](handleEntityNotFound(_0xd5b279,null))['then'](saveUpdates(_0x30da52['body'],null))[_0x50d9('0x2a')](respondWithResult(_0xd5b279,null))['catch'](handleError(_0xd5b279,null));};exports[_0x50d9('0x4f')]=function(_0x125397,_0x40eea2){return db['SugarcrmConfiguration'][_0x50d9('0x4d')]({'where':{'id':_0x125397[_0x50d9('0x4e')]['id']}})[_0x50d9('0x2a')](handleEntityNotFound(_0x40eea2,null))[_0x50d9('0x2a')](removeEntity(_0x40eea2,null))[_0x50d9('0x49')](handleError(_0x40eea2,null));};exports[_0x50d9('0x50')]=function(_0x1ecf63,_0x13a6f3,_0x512fc6){var _0x23c15e={};var _0x4aede9={};var _0x47706f;var _0x533c7d;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x1ecf63[_0x50d9('0x4e')]['id']}})[_0x50d9('0x2a')](handleEntityNotFound(_0x13a6f3,null))['then'](function(_0x12e487){if(_0x12e487){_0x47706f=_0x12e487;_0x4aede9[_0x50d9('0x37')]=_[_0x50d9('0x35')](db[_0x50d9('0x51')][_0x50d9('0x32')]);_0x4aede9[_0x50d9('0x34')]=_[_0x50d9('0x35')](_0x1ecf63['query']);_0x4aede9[_0x50d9('0x40')]=_[_0x50d9('0x36')](_0x4aede9[_0x50d9('0x37')],_0x4aede9[_0x50d9('0x34')]);_0x23c15e[_0x50d9('0x38')]=_['intersection'](_0x4aede9[_0x50d9('0x37')],qs[_0x50d9('0x39')](_0x1ecf63[_0x50d9('0x34')]['fields']));_0x23c15e['attributes']=_0x23c15e[_0x50d9('0x38')][_0x50d9('0x3a')]?_0x23c15e[_0x50d9('0x38')]:_0x4aede9[_0x50d9('0x37')];_0x23c15e[_0x50d9('0x3d')]=qs[_0x50d9('0x3e')](_0x1ecf63[_0x50d9('0x34')][_0x50d9('0x3e')]);_0x23c15e[_0x50d9('0x3f')]=qs['filters'](_[_0x50d9('0x41')](_0x1ecf63[_0x50d9('0x34')],_0x4aede9[_0x50d9('0x40')]));if(_0x1ecf63[_0x50d9('0x34')][_0x50d9('0x44')]){_0x23c15e[_0x50d9('0x3f')]=_['merge'](_0x23c15e['where'],{'$or':_['map'](_0x23c15e[_0x50d9('0x38')],function(_0x2e8ad3){var _0x109d6c={};_0x109d6c[_0x2e8ad3]={'$like':'%'+_0x1ecf63[_0x50d9('0x34')]['filter']+'%'};return _0x109d6c;})});}_0x23c15e=_[_0x50d9('0x42')]({},_0x23c15e,_0x1ecf63[_0x50d9('0x45')]);return _0x47706f[_0x50d9('0x50')](_0x23c15e);}})[_0x50d9('0x2a')](function(_0x1fc9e8){if(_0x1fc9e8){_0x533c7d=_0x1fc9e8[_0x50d9('0x3a')];if(!_0x1ecf63[_0x50d9('0x34')][_0x50d9('0x3b')](_0x50d9('0x3c'))){_0x23c15e[_0x50d9('0x22')]=qs[_0x50d9('0x22')](_0x1ecf63[_0x50d9('0x34')][_0x50d9('0x22')]);_0x23c15e[_0x50d9('0x20')]=qs['offset'](_0x1ecf63['query']['offset']);}return _0x47706f['getFields'](_0x23c15e);}})[_0x50d9('0x2a')](function(_0x19711b){if(_0x19711b){return _0x19711b?{'count':_0x533c7d,'rows':_0x19711b}:null;}})['then'](respondWithResult(_0x13a6f3,null))[_0x50d9('0x49')](handleError(_0x13a6f3,null));};exports[_0x50d9('0x52')]=function(_0x4e250c,_0xafc873,_0x461639){var _0x190839={};var _0x21b472={};var _0x1d208d;var _0x1271af;return db[_0x50d9('0x31')][_0x50d9('0x53')]({'where':{'id':_0x4e250c[_0x50d9('0x4e')]['id']}})[_0x50d9('0x2a')](handleEntityNotFound(_0xafc873,null))[_0x50d9('0x2a')](function(_0x5dab3a){if(_0x5dab3a){_0x1d208d=_0x5dab3a;_0x21b472[_0x50d9('0x37')]=_[_0x50d9('0x35')](db['SugarcrmField'][_0x50d9('0x32')]);_0x21b472['query']=_[_0x50d9('0x35')](_0x4e250c[_0x50d9('0x34')]);_0x21b472[_0x50d9('0x40')]=_['intersection'](_0x21b472[_0x50d9('0x37')],_0x21b472[_0x50d9('0x34')]);_0x190839[_0x50d9('0x38')]=_[_0x50d9('0x36')](_0x21b472[_0x50d9('0x37')],qs['fields'](_0x4e250c['query']['fields']));_0x190839[_0x50d9('0x38')]=_0x190839['attributes'][_0x50d9('0x3a')]?_0x190839['attributes']:_0x21b472[_0x50d9('0x37')];_0x190839[_0x50d9('0x3d')]=qs[_0x50d9('0x3e')](_0x4e250c[_0x50d9('0x34')][_0x50d9('0x3e')]);_0x190839[_0x50d9('0x3f')]=qs[_0x50d9('0x40')](_[_0x50d9('0x41')](_0x4e250c[_0x50d9('0x34')],_0x21b472['filters']));if(_0x4e250c[_0x50d9('0x34')][_0x50d9('0x44')]){_0x190839[_0x50d9('0x3f')]=_[_0x50d9('0x42')](_0x190839[_0x50d9('0x3f')],{'$or':_['map'](_0x190839[_0x50d9('0x38')],function(_0x5c4b6d){var _0x33bda2={};_0x33bda2[_0x5c4b6d]={'$like':'%'+_0x4e250c[_0x50d9('0x34')]['filter']+'%'};return _0x33bda2;})});}_0x190839=_[_0x50d9('0x42')]({},_0x190839,_0x4e250c[_0x50d9('0x45')]);return _0x1d208d[_0x50d9('0x52')](_0x190839);}})[_0x50d9('0x2a')](function(_0x3882e1){if(_0x3882e1){_0x1271af=_0x3882e1[_0x50d9('0x3a')];if(!_0x4e250c[_0x50d9('0x34')][_0x50d9('0x3b')](_0x50d9('0x3c'))){_0x190839['limit']=qs[_0x50d9('0x22')](_0x4e250c[_0x50d9('0x34')]['limit']);_0x190839[_0x50d9('0x20')]=qs[_0x50d9('0x20')](_0x4e250c[_0x50d9('0x34')][_0x50d9('0x20')]);}return _0x1d208d[_0x50d9('0x52')](_0x190839);}})[_0x50d9('0x2a')](function(_0x38b1e5){if(_0x38b1e5){return _0x38b1e5?{'count':_0x1271af,'rows':_0x38b1e5}:null;}})[_0x50d9('0x2a')](respondWithResult(_0xafc873,null))[_0x50d9('0x49')](handleError(_0xafc873,null));};exports[_0x50d9('0x54')]=function(_0x2d2ef8,_0x30a600,_0x519f91){var _0x2c3e67={};var _0x4a4e94={};var _0x41bc2a;var _0x2e9492;return db[_0x50d9('0x31')][_0x50d9('0x53')]({'where':{'id':_0x2d2ef8[_0x50d9('0x4e')]['id']}})[_0x50d9('0x2a')](handleEntityNotFound(_0x30a600,null))[_0x50d9('0x2a')](function(_0x212892){if(_0x212892){_0x41bc2a=_0x212892;_0x4a4e94[_0x50d9('0x37')]=_[_0x50d9('0x35')](db[_0x50d9('0x51')][_0x50d9('0x32')]);_0x4a4e94['query']=_[_0x50d9('0x35')](_0x2d2ef8[_0x50d9('0x34')]);_0x4a4e94['filters']=_[_0x50d9('0x36')](_0x4a4e94[_0x50d9('0x37')],_0x4a4e94[_0x50d9('0x34')]);_0x2c3e67[_0x50d9('0x38')]=_[_0x50d9('0x36')](_0x4a4e94[_0x50d9('0x37')],qs[_0x50d9('0x39')](_0x2d2ef8[_0x50d9('0x34')]['fields']));_0x2c3e67['attributes']=_0x2c3e67[_0x50d9('0x38')][_0x50d9('0x3a')]?_0x2c3e67[_0x50d9('0x38')]:_0x4a4e94[_0x50d9('0x37')];_0x2c3e67[_0x50d9('0x3d')]=qs[_0x50d9('0x3e')](_0x2d2ef8['query'][_0x50d9('0x3e')]);_0x2c3e67[_0x50d9('0x3f')]=qs[_0x50d9('0x40')](_[_0x50d9('0x41')](_0x2d2ef8[_0x50d9('0x34')],_0x4a4e94[_0x50d9('0x40')]));if(_0x2d2ef8['query'][_0x50d9('0x44')]){_0x2c3e67['where']=_[_0x50d9('0x42')](_0x2c3e67[_0x50d9('0x3f')],{'$or':_[_0x50d9('0x30')](_0x2c3e67['attributes'],function(_0x23c3c6){var _0x1f22cc={};_0x1f22cc[_0x23c3c6]={'$like':'%'+_0x2d2ef8['query']['filter']+'%'};return _0x1f22cc;})});}_0x2c3e67=_[_0x50d9('0x42')]({},_0x2c3e67,_0x2d2ef8['options']);return _0x41bc2a[_0x50d9('0x54')](_0x2c3e67);}})[_0x50d9('0x2a')](function(_0x451150){if(_0x451150){_0x2e9492=_0x451150[_0x50d9('0x3a')];if(!_0x2d2ef8[_0x50d9('0x34')][_0x50d9('0x3b')](_0x50d9('0x3c'))){_0x2c3e67[_0x50d9('0x22')]=qs['limit'](_0x2d2ef8[_0x50d9('0x34')][_0x50d9('0x22')]);_0x2c3e67[_0x50d9('0x20')]=qs[_0x50d9('0x20')](_0x2d2ef8[_0x50d9('0x34')][_0x50d9('0x20')]);}return _0x41bc2a[_0x50d9('0x54')](_0x2c3e67);}})[_0x50d9('0x2a')](function(_0x273f4d){if(_0x273f4d){return _0x273f4d?{'count':_0x2e9492,'rows':_0x273f4d}:null;}})[_0x50d9('0x2a')](respondWithResult(_0x30a600,null))[_0x50d9('0x49')](handleError(_0x30a600,null));}; \ No newline at end of file +var _0xf717=['show','params','includeAll','find','create','body','getFields','findOne','order','SugarcrmField','getSubjects','getDescriptions','hasOwnProperty','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','count','offset','limit','set','Content-Range','apply','update','then','destroy','name','map','SugarcrmConfiguration','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','include','rows','catch'];(function(_0x540e95,_0x291a4d){var _0x3fc67e=function(_0x2a426e){while(--_0x2a426e){_0x540e95['push'](_0x540e95['shift']());}};_0x3fc67e(++_0x291a4d);}(_0xf717,0x139));var _0x7f71=function(_0x574c48,_0x332df7){_0x574c48=_0x574c48-0x0;var _0x5ed59d=_0xf717[_0x574c48];return _0x5ed59d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7f71('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7f71('0x1'));var moment=require('moment');var BPromise=require(_0x7f71('0x2'));var Mustache=require(_0x7f71('0x3'));var util=require(_0x7f71('0x4'));var path=require(_0x7f71('0x5'));var sox=require(_0x7f71('0x6'));var csv=require(_0x7f71('0x7'));var ejs=require(_0x7f71('0x8'));var fs=require('fs');var fs_extra=require(_0x7f71('0x9'));var _=require(_0x7f71('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7f71('0xb'));var deskjs=require(_0x7f71('0xc'));var toCsv=require(_0x7f71('0x7'));var querystring=require(_0x7f71('0xd'));var Papa=require(_0x7f71('0xe'));var Redis=require(_0x7f71('0xf'));var authService=require(_0x7f71('0x10'));var qs=require(_0x7f71('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7f71('0x12'));var logger=require(_0x7f71('0x13'))(_0x7f71('0x14'));var utils=require(_0x7f71('0x15'));var config=require(_0x7f71('0x16'));var licenseUtil=require(_0x7f71('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x199714,_0x43a1ad){_0x43a1ad=_0x43a1ad||0xcc;return function(_0x371e1f){if(_0x371e1f){return _0x199714[_0x7f71('0x18')](_0x43a1ad);}return _0x199714['status'](_0x43a1ad)[_0x7f71('0x19')]();};}function respondWithResult(_0x2b5c1b,_0x508bf5){_0x508bf5=_0x508bf5||0xc8;return function(_0x21c53d){if(_0x21c53d){return _0x2b5c1b[_0x7f71('0x1a')](_0x508bf5)[_0x7f71('0x1b')](_0x21c53d);}};}function respondWithFilteredResult(_0x418808,_0x35a925){return function(_0x5267ac){if(_0x5267ac){var _0x3dde18=typeof _0x35a925['offset']===_0x7f71('0x1c')&&typeof _0x35a925['limit']===_0x7f71('0x1c');var _0x3479f9=_0x5267ac['count'];var _0x123b4e=_0x3dde18?0x0:_0x35a925['offset'];var _0x2f53f8=_0x3dde18?_0x5267ac[_0x7f71('0x1d')]:_0x35a925[_0x7f71('0x1e')]+_0x35a925[_0x7f71('0x1f')];var _0x59e824;if(_0x2f53f8>=_0x3479f9){_0x2f53f8=_0x3479f9;_0x59e824=0xc8;}else{_0x59e824=0xce;}_0x418808[_0x7f71('0x1a')](_0x59e824);return _0x418808[_0x7f71('0x20')](_0x7f71('0x21'),_0x123b4e+'-'+_0x2f53f8+'/'+_0x3479f9)[_0x7f71('0x1b')](_0x5267ac);}return null;};}function patchUpdates(_0x740441){return function(_0x1739d3){try{jsonpatch[_0x7f71('0x22')](_0x1739d3,_0x740441,!![]);}catch(_0x5185a2){return BPromise['reject'](_0x5185a2);}return _0x1739d3['save']();};}function saveUpdates(_0x13f05c,_0x1ee13d){return function(_0x4eb509){if(_0x4eb509){return _0x4eb509[_0x7f71('0x23')](_0x13f05c)[_0x7f71('0x24')](function(_0x6a8179){return _0x6a8179;});}return null;};}function removeEntity(_0x223569,_0x4cba55){return function(_0x158159){if(_0x158159){return _0x158159[_0x7f71('0x25')]()[_0x7f71('0x24')](function(){_0x223569[_0x7f71('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x313e3c,_0x82338b){return function(_0x22b637){if(!_0x22b637){_0x313e3c['sendStatus'](0x194);}return _0x22b637;};}function handleError(_0x5a4d09,_0x225116){_0x225116=_0x225116||0x1f4;return function(_0xa524d0){logger['error'](_0xa524d0['stack']);if(_0xa524d0[_0x7f71('0x26')]){delete _0xa524d0[_0x7f71('0x26')];}_0x5a4d09[_0x7f71('0x1a')](_0x225116)['send'](_0xa524d0);};}exports['index']=function(_0x129e5b,_0x3342c9){var _0x2618de={},_0x1a1302={},_0x1806f3={'count':0x0,'rows':[]};var _0x5ced35=_[_0x7f71('0x27')](db[_0x7f71('0x28')][_0x7f71('0x29')],function(_0xe3f0d6){return{'name':_0xe3f0d6['fieldName'],'type':_0xe3f0d6[_0x7f71('0x2a')]['key']};});_0x1a1302[_0x7f71('0x2b')]=_[_0x7f71('0x27')](_0x5ced35,_0x7f71('0x26'));_0x1a1302[_0x7f71('0x2c')]=_[_0x7f71('0x2d')](_0x129e5b[_0x7f71('0x2c')]);_0x1a1302[_0x7f71('0x2e')]=_[_0x7f71('0x2f')](_0x1a1302[_0x7f71('0x2b')],_0x1a1302[_0x7f71('0x2c')]);_0x2618de[_0x7f71('0x30')]=_[_0x7f71('0x2f')](_0x1a1302['model'],qs[_0x7f71('0x31')](_0x129e5b[_0x7f71('0x2c')]['fields']));_0x2618de[_0x7f71('0x30')]=_0x2618de[_0x7f71('0x30')][_0x7f71('0x32')]?_0x2618de[_0x7f71('0x30')]:_0x1a1302[_0x7f71('0x2b')];if(!_0x129e5b[_0x7f71('0x2c')]['hasOwnProperty'](_0x7f71('0x33'))){_0x2618de[_0x7f71('0x1f')]=qs[_0x7f71('0x1f')](_0x129e5b[_0x7f71('0x2c')][_0x7f71('0x1f')]);_0x2618de['offset']=qs[_0x7f71('0x1e')](_0x129e5b[_0x7f71('0x2c')][_0x7f71('0x1e')]);}_0x2618de['order']=qs[_0x7f71('0x34')](_0x129e5b[_0x7f71('0x2c')][_0x7f71('0x34')]);_0x2618de[_0x7f71('0x35')]=qs[_0x7f71('0x2e')](_[_0x7f71('0x36')](_0x129e5b[_0x7f71('0x2c')],_0x1a1302[_0x7f71('0x2e')]),_0x5ced35);if(_0x129e5b[_0x7f71('0x2c')]['filter']){_0x2618de[_0x7f71('0x35')]=_[_0x7f71('0x37')](_0x2618de[_0x7f71('0x35')],{'$or':_[_0x7f71('0x27')](_0x5ced35,function(_0x4da925){if(_0x4da925[_0x7f71('0x2a')]!==_0x7f71('0x38')){var _0x521b54={};_0x521b54[_0x4da925[_0x7f71('0x26')]]={'$like':'%'+_0x129e5b[_0x7f71('0x2c')][_0x7f71('0x39')]+'%'};return _0x521b54;}})});}_0x2618de=_['merge']({},_0x2618de,_0x129e5b[_0x7f71('0x3a')]);var _0x2ead66={'where':_0x2618de[_0x7f71('0x35')]};return db[_0x7f71('0x28')][_0x7f71('0x1d')](_0x2ead66)[_0x7f71('0x24')](function(_0xb43bc0){_0x1806f3[_0x7f71('0x1d')]=_0xb43bc0;if(_0x129e5b[_0x7f71('0x2c')]['includeAll']){_0x2618de[_0x7f71('0x3b')]=[{'all':!![]}];}return db[_0x7f71('0x28')]['findAll'](_0x2618de);})['then'](function(_0x577807){_0x1806f3[_0x7f71('0x3c')]=_0x577807;return _0x1806f3;})['then'](respondWithFilteredResult(_0x3342c9,_0x2618de))[_0x7f71('0x3d')](handleError(_0x3342c9,null));};exports[_0x7f71('0x3e')]=function(_0x330967,_0x8e737b){var _0x249bf3={'raw':![],'where':{'id':_0x330967[_0x7f71('0x3f')]['id']}},_0x37a114={};_0x37a114[_0x7f71('0x2b')]=_[_0x7f71('0x2d')](db[_0x7f71('0x28')]['rawAttributes']);_0x37a114[_0x7f71('0x2c')]=_[_0x7f71('0x2d')](_0x330967[_0x7f71('0x2c')]);_0x37a114[_0x7f71('0x2e')]=_[_0x7f71('0x2f')](_0x37a114[_0x7f71('0x2b')],_0x37a114[_0x7f71('0x2c')]);_0x249bf3[_0x7f71('0x30')]=_[_0x7f71('0x2f')](_0x37a114['model'],qs[_0x7f71('0x31')](_0x330967['query'][_0x7f71('0x31')]));_0x249bf3['attributes']=_0x249bf3['attributes'][_0x7f71('0x32')]?_0x249bf3[_0x7f71('0x30')]:_0x37a114[_0x7f71('0x2b')];if(_0x330967[_0x7f71('0x2c')][_0x7f71('0x40')]){_0x249bf3[_0x7f71('0x3b')]=[{'all':!![]}];}_0x249bf3=_[_0x7f71('0x37')]({},_0x249bf3,_0x330967[_0x7f71('0x3a')]);return db['SugarcrmConfiguration'][_0x7f71('0x41')](_0x249bf3)[_0x7f71('0x24')](handleEntityNotFound(_0x8e737b,null))[_0x7f71('0x24')](respondWithResult(_0x8e737b,null))['catch'](handleError(_0x8e737b,null));};exports['create']=function(_0x44300e,_0x5d5612){return db[_0x7f71('0x28')][_0x7f71('0x42')](_0x44300e[_0x7f71('0x43')],{})['then'](respondWithResult(_0x5d5612,0xc9))[_0x7f71('0x3d')](handleError(_0x5d5612,null));};exports[_0x7f71('0x23')]=function(_0x255f99,_0x1e54d4){if(_0x255f99['body']['id']){delete _0x255f99[_0x7f71('0x43')]['id'];}return db[_0x7f71('0x28')][_0x7f71('0x41')]({'where':{'id':_0x255f99[_0x7f71('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1e54d4,null))[_0x7f71('0x24')](saveUpdates(_0x255f99['body'],null))[_0x7f71('0x24')](respondWithResult(_0x1e54d4,null))[_0x7f71('0x3d')](handleError(_0x1e54d4,null));};exports[_0x7f71('0x25')]=function(_0x32cd29,_0x21bbd8){return db[_0x7f71('0x28')][_0x7f71('0x41')]({'where':{'id':_0x32cd29[_0x7f71('0x3f')]['id']}})[_0x7f71('0x24')](handleEntityNotFound(_0x21bbd8,null))[_0x7f71('0x24')](removeEntity(_0x21bbd8,null))[_0x7f71('0x3d')](handleError(_0x21bbd8,null));};exports[_0x7f71('0x44')]=function(_0xc74d2,_0x34beea,_0x148ab4){var _0x413e22={};var _0x138d67={};var _0x49ccd0;var _0x2f7543;return db['SugarcrmConfiguration'][_0x7f71('0x45')]({'where':{'id':_0xc74d2[_0x7f71('0x3f')]['id']}})[_0x7f71('0x24')](handleEntityNotFound(_0x34beea,null))[_0x7f71('0x24')](function(_0x13dc42){if(_0x13dc42){_0x49ccd0=_0x13dc42;_0x138d67['model']=_[_0x7f71('0x2d')](db['SugarcrmField'][_0x7f71('0x29')]);_0x138d67[_0x7f71('0x2c')]=_['keys'](_0xc74d2[_0x7f71('0x2c')]);_0x138d67['filters']=_[_0x7f71('0x2f')](_0x138d67['model'],_0x138d67[_0x7f71('0x2c')]);_0x413e22['attributes']=_[_0x7f71('0x2f')](_0x138d67['model'],qs['fields'](_0xc74d2['query'][_0x7f71('0x31')]));_0x413e22[_0x7f71('0x30')]=_0x413e22[_0x7f71('0x30')][_0x7f71('0x32')]?_0x413e22[_0x7f71('0x30')]:_0x138d67[_0x7f71('0x2b')];_0x413e22[_0x7f71('0x46')]=qs['sort'](_0xc74d2[_0x7f71('0x2c')][_0x7f71('0x34')]);_0x413e22['where']=qs['filters'](_[_0x7f71('0x36')](_0xc74d2[_0x7f71('0x2c')],_0x138d67['filters']));if(_0xc74d2[_0x7f71('0x2c')]['filter']){_0x413e22[_0x7f71('0x35')]=_['merge'](_0x413e22[_0x7f71('0x35')],{'$or':_[_0x7f71('0x27')](_0x413e22[_0x7f71('0x30')],function(_0x300471){var _0x18dc30={};_0x18dc30[_0x300471]={'$like':'%'+_0xc74d2[_0x7f71('0x2c')][_0x7f71('0x39')]+'%'};return _0x18dc30;})});}_0x413e22=_[_0x7f71('0x37')]({},_0x413e22,_0xc74d2[_0x7f71('0x3a')]);return _0x49ccd0['getFields'](_0x413e22);}})[_0x7f71('0x24')](function(_0x5b5f75){if(_0x5b5f75){_0x2f7543=_0x5b5f75[_0x7f71('0x32')];if(!_0xc74d2[_0x7f71('0x2c')]['hasOwnProperty'](_0x7f71('0x33'))){_0x413e22[_0x7f71('0x1f')]=qs[_0x7f71('0x1f')](_0xc74d2[_0x7f71('0x2c')]['limit']);_0x413e22[_0x7f71('0x1e')]=qs[_0x7f71('0x1e')](_0xc74d2[_0x7f71('0x2c')][_0x7f71('0x1e')]);}return _0x49ccd0[_0x7f71('0x44')](_0x413e22);}})['then'](function(_0xa59012){if(_0xa59012){return _0xa59012?{'count':_0x2f7543,'rows':_0xa59012}:null;}})[_0x7f71('0x24')](respondWithResult(_0x34beea,null))[_0x7f71('0x3d')](handleError(_0x34beea,null));};exports['getSubjects']=function(_0x226cfd,_0x27874b,_0x162f73){var _0x3615b1={};var _0x2060f1={};var _0x25ceff;var _0x5a074f;return db[_0x7f71('0x28')][_0x7f71('0x45')]({'where':{'id':_0x226cfd[_0x7f71('0x3f')]['id']}})[_0x7f71('0x24')](handleEntityNotFound(_0x27874b,null))[_0x7f71('0x24')](function(_0x5e8a14){if(_0x5e8a14){_0x25ceff=_0x5e8a14;_0x2060f1[_0x7f71('0x2b')]=_[_0x7f71('0x2d')](db[_0x7f71('0x47')][_0x7f71('0x29')]);_0x2060f1[_0x7f71('0x2c')]=_[_0x7f71('0x2d')](_0x226cfd['query']);_0x2060f1[_0x7f71('0x2e')]=_[_0x7f71('0x2f')](_0x2060f1[_0x7f71('0x2b')],_0x2060f1[_0x7f71('0x2c')]);_0x3615b1[_0x7f71('0x30')]=_[_0x7f71('0x2f')](_0x2060f1[_0x7f71('0x2b')],qs[_0x7f71('0x31')](_0x226cfd[_0x7f71('0x2c')][_0x7f71('0x31')]));_0x3615b1[_0x7f71('0x30')]=_0x3615b1[_0x7f71('0x30')][_0x7f71('0x32')]?_0x3615b1[_0x7f71('0x30')]:_0x2060f1[_0x7f71('0x2b')];_0x3615b1[_0x7f71('0x46')]=qs[_0x7f71('0x34')](_0x226cfd[_0x7f71('0x2c')][_0x7f71('0x34')]);_0x3615b1['where']=qs[_0x7f71('0x2e')](_[_0x7f71('0x36')](_0x226cfd[_0x7f71('0x2c')],_0x2060f1['filters']));if(_0x226cfd[_0x7f71('0x2c')][_0x7f71('0x39')]){_0x3615b1['where']=_[_0x7f71('0x37')](_0x3615b1[_0x7f71('0x35')],{'$or':_[_0x7f71('0x27')](_0x3615b1['attributes'],function(_0x486ecb){var _0x357b48={};_0x357b48[_0x486ecb]={'$like':'%'+_0x226cfd[_0x7f71('0x2c')]['filter']+'%'};return _0x357b48;})});}_0x3615b1=_[_0x7f71('0x37')]({},_0x3615b1,_0x226cfd[_0x7f71('0x3a')]);return _0x25ceff['getSubjects'](_0x3615b1);}})[_0x7f71('0x24')](function(_0x26bfe0){if(_0x26bfe0){_0x5a074f=_0x26bfe0[_0x7f71('0x32')];if(!_0x226cfd[_0x7f71('0x2c')]['hasOwnProperty'](_0x7f71('0x33'))){_0x3615b1['limit']=qs[_0x7f71('0x1f')](_0x226cfd['query']['limit']);_0x3615b1[_0x7f71('0x1e')]=qs[_0x7f71('0x1e')](_0x226cfd['query']['offset']);}return _0x25ceff[_0x7f71('0x48')](_0x3615b1);}})['then'](function(_0x2c88f6){if(_0x2c88f6){return _0x2c88f6?{'count':_0x5a074f,'rows':_0x2c88f6}:null;}})['then'](respondWithResult(_0x27874b,null))[_0x7f71('0x3d')](handleError(_0x27874b,null));};exports[_0x7f71('0x49')]=function(_0x1d0708,_0x2cfc6a,_0x170239){var _0x3e0d80={};var _0x31a459={};var _0x52fa7f;var _0x2d824a;return db[_0x7f71('0x28')][_0x7f71('0x45')]({'where':{'id':_0x1d0708[_0x7f71('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2cfc6a,null))[_0x7f71('0x24')](function(_0x9a842){if(_0x9a842){_0x52fa7f=_0x9a842;_0x31a459[_0x7f71('0x2b')]=_[_0x7f71('0x2d')](db[_0x7f71('0x47')][_0x7f71('0x29')]);_0x31a459[_0x7f71('0x2c')]=_[_0x7f71('0x2d')](_0x1d0708[_0x7f71('0x2c')]);_0x31a459[_0x7f71('0x2e')]=_[_0x7f71('0x2f')](_0x31a459[_0x7f71('0x2b')],_0x31a459[_0x7f71('0x2c')]);_0x3e0d80[_0x7f71('0x30')]=_[_0x7f71('0x2f')](_0x31a459[_0x7f71('0x2b')],qs[_0x7f71('0x31')](_0x1d0708[_0x7f71('0x2c')][_0x7f71('0x31')]));_0x3e0d80[_0x7f71('0x30')]=_0x3e0d80[_0x7f71('0x30')][_0x7f71('0x32')]?_0x3e0d80[_0x7f71('0x30')]:_0x31a459[_0x7f71('0x2b')];_0x3e0d80['order']=qs['sort'](_0x1d0708[_0x7f71('0x2c')][_0x7f71('0x34')]);_0x3e0d80[_0x7f71('0x35')]=qs[_0x7f71('0x2e')](_[_0x7f71('0x36')](_0x1d0708[_0x7f71('0x2c')],_0x31a459[_0x7f71('0x2e')]));if(_0x1d0708[_0x7f71('0x2c')][_0x7f71('0x39')]){_0x3e0d80[_0x7f71('0x35')]=_[_0x7f71('0x37')](_0x3e0d80[_0x7f71('0x35')],{'$or':_[_0x7f71('0x27')](_0x3e0d80[_0x7f71('0x30')],function(_0xc1c12){var _0x10f5d1={};_0x10f5d1[_0xc1c12]={'$like':'%'+_0x1d0708[_0x7f71('0x2c')][_0x7f71('0x39')]+'%'};return _0x10f5d1;})});}_0x3e0d80=_[_0x7f71('0x37')]({},_0x3e0d80,_0x1d0708['options']);return _0x52fa7f['getDescriptions'](_0x3e0d80);}})[_0x7f71('0x24')](function(_0x464b4e){if(_0x464b4e){_0x2d824a=_0x464b4e[_0x7f71('0x32')];if(!_0x1d0708[_0x7f71('0x2c')][_0x7f71('0x4a')](_0x7f71('0x33'))){_0x3e0d80[_0x7f71('0x1f')]=qs[_0x7f71('0x1f')](_0x1d0708[_0x7f71('0x2c')][_0x7f71('0x1f')]);_0x3e0d80[_0x7f71('0x1e')]=qs[_0x7f71('0x1e')](_0x1d0708[_0x7f71('0x2c')]['offset']);}return _0x52fa7f[_0x7f71('0x49')](_0x3e0d80);}})[_0x7f71('0x24')](function(_0x3e5962){if(_0x3e5962){return _0x3e5962?{'count':_0x2d824a,'rows':_0x3e5962}:null;}})['then'](respondWithResult(_0x2cfc6a,null))[_0x7f71('0x3d')](handleError(_0x2cfc6a,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 3ac100b..18c8751 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 _0x7611=['bluebird','path','rimraf','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','../../config/logger','api','moment'];(function(_0x35dc39,_0x261cd4){var _0x1c6545=function(_0x17e6cb){while(--_0x17e6cb){_0x35dc39['push'](_0x35dc39['shift']());}};_0x1c6545(++_0x261cd4);}(_0x7611,0xc2));var _0x1761=function(_0x4acf41,_0x2bfecd){_0x4acf41=_0x4acf41-0x0;var _0x15edf6=_0x7611[_0x4acf41];return _0x15edf6;};'use strict';var _=require(_0x1761('0x0'));var util=require('util');var logger=require(_0x1761('0x1'))(_0x1761('0x2'));var moment=require(_0x1761('0x3'));var BPromise=require(_0x1761('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1761('0x5'));var rimraf=require(_0x1761('0x6'));var config=require('../../config/environment');var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x1761('0x7')]=function(_0x4fc1ac,_0x63a4a1){return _0x4fc1ac[_0x1761('0x8')](_0x1761('0x9'),attributes,{'tableName':_0x1761('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9d28=['SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define'];(function(_0x2766b4,_0xb9c42c){var _0x3c72ba=function(_0x3c4117){while(--_0x3c4117){_0x2766b4['push'](_0x2766b4['shift']());}};_0x3c72ba(++_0xb9c42c);}(_0x9d28,0x89));var _0x89d2=function(_0x3c414c,_0x399dbb){_0x3c414c=_0x3c414c-0x0;var _0x4f3062=_0x9d28[_0x3c414c];return _0x4f3062;};'use strict';var _=require(_0x89d2('0x0'));var util=require(_0x89d2('0x1'));var logger=require(_0x89d2('0x2'))(_0x89d2('0x3'));var moment=require(_0x89d2('0x4'));var BPromise=require(_0x89d2('0x5'));var rp=require(_0x89d2('0x6'));var fs=require('fs');var path=require(_0x89d2('0x7'));var rimraf=require(_0x89d2('0x8'));var config=require(_0x89d2('0x9'));var attributes=require(_0x89d2('0xa'));module[_0x89d2('0xb')]=function(_0x1358dd,_0x4d9d4f){return _0x1358dd[_0x89d2('0xc')](_0x89d2('0xd'),attributes,{'tableName':_0x89d2('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 44dd462..3a48e7d 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 _0x66ad=['debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x1bac48,_0x533ff4){var _0x3f0ea3=function(_0x4e543f){while(--_0x4e543f){_0x1bac48['push'](_0x1bac48['shift']());}};_0x3f0ea3(++_0x533ff4);}(_0x66ad,0x166));var _0xd66a=function(_0x2356e6,_0x130b1f){_0x2356e6=_0x2356e6-0x0;var _0x31094e=_0x66ad[_0x2356e6];return _0x31094e;};'use strict';var _=require(_0xd66a('0x0'));var util=require(_0xd66a('0x1'));var moment=require('moment');var BPromise=require(_0xd66a('0x2'));var rs=require(_0xd66a('0x3'));var fs=require('fs');var Redis=require(_0xd66a('0x4'));var db=require(_0xd66a('0x5'))['db'];var utils=require(_0xd66a('0x6'));var logger=require(_0xd66a('0x7'))(_0xd66a('0x8'));var config=require(_0xd66a('0x9'));var jayson=require(_0xd66a('0xa'));var client=jayson[_0xd66a('0xb')][_0xd66a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3e1d22,_0x736b09,_0xd0bc8b){return new BPromise(function(_0xa68376,_0x2b99f7){return client['request'](_0x3e1d22,_0xd0bc8b)[_0xd66a('0xd')](function(_0x2f6e64){logger['info'](_0xd66a('0xe'),_0x736b09,_0xd66a('0xf'));logger[_0xd66a('0x10')](_0xd66a('0x11'),_0x736b09,_0xd66a('0xf'),JSON['stringify'](_0x2f6e64));if(_0x2f6e64[_0xd66a('0x12')]){if(_0x2f6e64[_0xd66a('0x12')][_0xd66a('0x13')]===0x1f4){logger[_0xd66a('0x12')](_0xd66a('0xe'),_0x736b09,_0x2f6e64['error']['message']);return _0x2b99f7(_0x2f6e64[_0xd66a('0x12')][_0xd66a('0x14')]);}logger[_0xd66a('0x12')](_0xd66a('0xe'),_0x736b09,_0x2f6e64[_0xd66a('0x12')][_0xd66a('0x14')]);return _0xa68376(_0x2f6e64[_0xd66a('0x12')][_0xd66a('0x14')]);}else{logger['info'](_0xd66a('0xe'),_0x736b09,'request\x20sent');_0xa68376(_0x2f6e64[_0xd66a('0x15')]['message']);}})['catch'](function(_0x47ee5c){logger[_0xd66a('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x736b09,_0x47ee5c);_0x2b99f7(_0x47ee5c);});});} \ No newline at end of file +var _0x1bf3=['catch','util','moment','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x1d5426,_0xc7bc4e){var _0x54fed9=function(_0x423eec){while(--_0x423eec){_0x1d5426['push'](_0x1d5426['shift']());}};_0x54fed9(++_0xc7bc4e);}(_0x1bf3,0x7f));var _0x31bf=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x1bf3[_0x59ee6f];return _0x4c0979;};'use strict';var _=require('lodash');var util=require(_0x31bf('0x0'));var moment=require(_0x31bf('0x1'));var BPromise=require('bluebird');var rs=require(_0x31bf('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x31bf('0x3'))(_0x31bf('0x4'));var config=require(_0x31bf('0x5'));var jayson=require(_0x31bf('0x6'));var client=jayson[_0x31bf('0x7')][_0x31bf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x62ea56,_0x5a2341,_0x2b34c9){return new BPromise(function(_0x59b448,_0x2d688c){return client[_0x31bf('0x9')](_0x62ea56,_0x2b34c9)['then'](function(_0x2c05b3){logger[_0x31bf('0xa')](_0x31bf('0xb'),_0x5a2341,_0x31bf('0xc'));logger[_0x31bf('0xd')](_0x31bf('0xe'),_0x5a2341,_0x31bf('0xc'),JSON[_0x31bf('0xf')](_0x2c05b3));if(_0x2c05b3[_0x31bf('0x10')]){if(_0x2c05b3[_0x31bf('0x10')][_0x31bf('0x11')]===0x1f4){logger[_0x31bf('0x10')](_0x31bf('0xb'),_0x5a2341,_0x2c05b3['error'][_0x31bf('0x12')]);return _0x2d688c(_0x2c05b3[_0x31bf('0x10')]['message']);}logger[_0x31bf('0x10')](_0x31bf('0xb'),_0x5a2341,_0x2c05b3[_0x31bf('0x10')][_0x31bf('0x12')]);return _0x59b448(_0x2c05b3[_0x31bf('0x10')][_0x31bf('0x12')]);}else{logger[_0x31bf('0xa')](_0x31bf('0xb'),_0x5a2341,_0x31bf('0xc'));_0x59b448(_0x2c05b3[_0x31bf('0x13')][_0x31bf('0x12')]);}})[_0x31bf('0x14')](function(_0x121fb8){logger['error'](_0x31bf('0xb'),_0x5a2341,_0x121fb8);_0x2d688c(_0x121fb8);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 2d9d3f1..79dcd04 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 _0x900c=['delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','./intSugarcrmField.controller','get','/:id','isAuthenticated','post','create','put','update'];(function(_0x512c83,_0x42a67a){var _0x1f7f25=function(_0x1e656c){while(--_0x1e656c){_0x512c83['push'](_0x512c83['shift']());}};_0x1f7f25(++_0x42a67a);}(_0x900c,0x1bd));var _0xc900=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x900c[_0x122ef9];return _0x42fba0;};'use strict';var multer=require('multer');var util=require(_0xc900('0x0'));var path=require(_0xc900('0x1'));var timeout=require(_0xc900('0x2'));var express=require(_0xc900('0x3'));var router=express[_0xc900('0x4')]();var fs_extra=require(_0xc900('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc900('0x6'));router[_0xc900('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc900('0x7')](_0xc900('0x8'),auth[_0xc900('0x9')](),controller['show']);router[_0xc900('0xa')]('/',auth['isAuthenticated'](),controller[_0xc900('0xb')]);router[_0xc900('0xc')](_0xc900('0x8'),auth['isAuthenticated'](),controller[_0xc900('0xd')]);router[_0xc900('0xe')](_0xc900('0x8'),auth[_0xc900('0x9')](),controller[_0xc900('0xf')]);module[_0xc900('0x10')]=router; \ No newline at end of file +var _0x1d7a=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','isAuthenticated','index','get','/:id','show','create','put','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x44f974,_0x4db616){var _0x805dbd=function(_0x1a56b7){while(--_0x1a56b7){_0x44f974['push'](_0x44f974['shift']());}};_0x805dbd(++_0x4db616);}(_0x1d7a,0x176));var _0xa1d7=function(_0x191c44,_0x20a896){_0x191c44=_0x191c44-0x0;var _0x1086cd=_0x1d7a[_0x191c44];return _0x1086cd;};'use strict';var multer=require(_0xa1d7('0x0'));var util=require(_0xa1d7('0x1'));var path=require(_0xa1d7('0x2'));var timeout=require(_0xa1d7('0x3'));var express=require(_0xa1d7('0x4'));var router=express[_0xa1d7('0x5')]();var fs_extra=require(_0xa1d7('0x6'));var auth=require(_0xa1d7('0x7'));var interaction=require(_0xa1d7('0x8'));var config=require(_0xa1d7('0x9'));var controller=require(_0xa1d7('0xa'));router['get']('/',auth[_0xa1d7('0xb')](),controller[_0xa1d7('0xc')]);router[_0xa1d7('0xd')](_0xa1d7('0xe'),auth[_0xa1d7('0xb')](),controller[_0xa1d7('0xf')]);router['post']('/',auth[_0xa1d7('0xb')](),controller[_0xa1d7('0x10')]);router[_0xa1d7('0x11')](_0xa1d7('0xe'),auth['isAuthenticated'](),controller[_0xa1d7('0x12')]);router[_0xa1d7('0x13')]('/:id',auth[_0xa1d7('0xb')](),controller['destroy']);module[_0xa1d7('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index d8363ad..956f0c5 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 _0x8c4b=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x8c4b,0x184));var _0xb8c4=function(_0x5989af,_0x325855){_0x5989af=_0x5989af-0x0;var _0x1dc945=_0x8c4b[_0x5989af];return _0x1dc945;};'use strict';var Sequelize=require(_0xb8c4('0x0'));module[_0xb8c4('0x1')]={'type':{'type':Sequelize[_0xb8c4('0x2')](_0xb8c4('0x3'),_0xb8c4('0x4'),_0xb8c4('0x5'),_0xb8c4('0x6'),_0xb8c4('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0xb8c4('0x8')]},'key':{'type':Sequelize[_0xb8c4('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0xb8c4('0x3'),_0xb8c4('0x4'),_0xb8c4('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xb8c4('0x8')]},'nameField':{'type':Sequelize[_0xb8c4('0x8')]},'customField':{'type':Sequelize[_0xb8c4('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb8c4('0x8')]}}; \ No newline at end of file +var _0xb144=['variable','customVariable','picklist','string','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x477fa5,_0x33837d){var _0x30e4a4=function(_0x151b4a){while(--_0x151b4a){_0x477fa5['push'](_0x477fa5['shift']());}};_0x30e4a4(++_0x33837d);}(_0xb144,0x16e));var _0x4b14=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xb144[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x4b14('0x0'));module[_0x4b14('0x1')]={'type':{'type':Sequelize[_0x4b14('0x2')]('string',_0x4b14('0x3'),_0x4b14('0x4'),'keyValue',_0x4b14('0x5')),'defaultValue':_0x4b14('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x4b14('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x4b14('0x6'),'variable',_0x4b14('0x4'))},'keyContent':{'type':Sequelize[_0x4b14('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x4b14('0x7')]},'customField':{'type':Sequelize[_0x4b14('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4b14('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 213d478..e3754a7 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 _0x7e23=['../../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','then','destroy','error','name','send','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','includeAll','include','findAll','rows','catch','options','body','find','params','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'];(function(_0x5c7525,_0x39490f){var _0x2e2ec8=function(_0x20d59a){while(--_0x20d59a){_0x5c7525['push'](_0x5c7525['shift']());}};_0x2e2ec8(++_0x39490f);}(_0x7e23,0x1f2));var _0x37e2=function(_0x20d5d8,_0x4ce3e8){_0x20d5d8=_0x20d5d8-0x0;var _0x2169fb=_0x7e23[_0x20d5d8];return _0x2169fb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x37e2('0x0'));var zipdir=require(_0x37e2('0x1'));var jsonpatch=require(_0x37e2('0x2'));var rp=require(_0x37e2('0x3'));var moment=require(_0x37e2('0x4'));var BPromise=require(_0x37e2('0x5'));var Mustache=require(_0x37e2('0x6'));var util=require(_0x37e2('0x7'));var path=require(_0x37e2('0x8'));var sox=require('sox');var csv=require(_0x37e2('0x9'));var ejs=require(_0x37e2('0xa'));var fs=require('fs');var fs_extra=require(_0x37e2('0xb'));var _=require(_0x37e2('0xc'));var squel=require(_0x37e2('0xd'));var crypto=require(_0x37e2('0xe'));var jsforce=require(_0x37e2('0xf'));var deskjs=require(_0x37e2('0x10'));var toCsv=require('to-csv');var querystring=require(_0x37e2('0x11'));var Papa=require(_0x37e2('0x12'));var Redis=require(_0x37e2('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x37e2('0x14'));var as=require(_0x37e2('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x37e2('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x37e2('0x17'));var licenseUtil=require(_0x37e2('0x18'));var db=require(_0x37e2('0x19'))['db'];function respondWithStatusCode(_0x43284d,_0x49c582){_0x49c582=_0x49c582||0xcc;return function(_0x31df07){if(_0x31df07){return _0x43284d[_0x37e2('0x1a')](_0x49c582);}return _0x43284d[_0x37e2('0x1b')](_0x49c582)[_0x37e2('0x1c')]();};}function respondWithResult(_0x36124d,_0x1d5350){_0x1d5350=_0x1d5350||0xc8;return function(_0x35e88f){if(_0x35e88f){return _0x36124d[_0x37e2('0x1b')](_0x1d5350)[_0x37e2('0x1d')](_0x35e88f);}};}function respondWithFilteredResult(_0x5e9002,_0x2c36d7){return function(_0x394b4c){if(_0x394b4c){var _0x21250b=typeof _0x2c36d7['offset']===_0x37e2('0x1e')&&typeof _0x2c36d7['limit']===_0x37e2('0x1e');var _0x5ed640=_0x394b4c[_0x37e2('0x1f')];var _0xfcec7=_0x21250b?0x0:_0x2c36d7[_0x37e2('0x20')];var _0x3573aa=_0x21250b?_0x394b4c[_0x37e2('0x1f')]:_0x2c36d7['offset']+_0x2c36d7[_0x37e2('0x21')];var _0x35bc80;if(_0x3573aa>=_0x5ed640){_0x3573aa=_0x5ed640;_0x35bc80=0xc8;}else{_0x35bc80=0xce;}_0x5e9002[_0x37e2('0x1b')](_0x35bc80);return _0x5e9002['set'](_0x37e2('0x22'),_0xfcec7+'-'+_0x3573aa+'/'+_0x5ed640)[_0x37e2('0x1d')](_0x394b4c);}return null;};}function patchUpdates(_0x2fa814){return function(_0x42d421){try{jsonpatch[_0x37e2('0x23')](_0x42d421,_0x2fa814,!![]);}catch(_0x4b5ad3){return BPromise[_0x37e2('0x24')](_0x4b5ad3);}return _0x42d421[_0x37e2('0x25')]();};}function saveUpdates(_0x5c3b92,_0x1396c3){return function(_0x21883a){if(_0x21883a){return _0x21883a[_0x37e2('0x26')](_0x5c3b92)[_0x37e2('0x27')](function(_0x342ffa){return _0x342ffa;});}return null;};}function removeEntity(_0x1ca457,_0x4fbc5d){return function(_0x55488a){if(_0x55488a){return _0x55488a[_0x37e2('0x28')]()['then'](function(){_0x1ca457[_0x37e2('0x1b')](0xcc)[_0x37e2('0x1c')]();});}};}function handleEntityNotFound(_0xd59f54,_0x26bf62){return function(_0x2e8f93){if(!_0x2e8f93){_0xd59f54['sendStatus'](0x194);}return _0x2e8f93;};}function handleError(_0x2b8da2,_0x4afe63){_0x4afe63=_0x4afe63||0x1f4;return function(_0x4497d8){logger[_0x37e2('0x29')](_0x4497d8['stack']);if(_0x4497d8[_0x37e2('0x2a')]){delete _0x4497d8[_0x37e2('0x2a')];}_0x2b8da2[_0x37e2('0x1b')](_0x4afe63)[_0x37e2('0x2b')](_0x4497d8);};}exports['index']=function(_0x59a00e,_0x582711){var _0x56c4a5={},_0x2c5c77={},_0x436ab3={'count':0x0,'rows':[]};var _0x5e1e6f=_[_0x37e2('0x2c')](db[_0x37e2('0x2d')][_0x37e2('0x2e')],function(_0x2258dc){return{'name':_0x2258dc[_0x37e2('0x2f')],'type':_0x2258dc[_0x37e2('0x30')][_0x37e2('0x31')]};});_0x2c5c77[_0x37e2('0x32')]=_['map'](_0x5e1e6f,'name');_0x2c5c77[_0x37e2('0x33')]=_[_0x37e2('0x34')](_0x59a00e[_0x37e2('0x33')]);_0x2c5c77[_0x37e2('0x35')]=_[_0x37e2('0x36')](_0x2c5c77[_0x37e2('0x32')],_0x2c5c77[_0x37e2('0x33')]);_0x56c4a5[_0x37e2('0x37')]=_[_0x37e2('0x36')](_0x2c5c77[_0x37e2('0x32')],qs[_0x37e2('0x38')](_0x59a00e[_0x37e2('0x33')]['fields']));_0x56c4a5[_0x37e2('0x37')]=_0x56c4a5[_0x37e2('0x37')][_0x37e2('0x39')]?_0x56c4a5[_0x37e2('0x37')]:_0x2c5c77['model'];if(!_0x59a00e[_0x37e2('0x33')][_0x37e2('0x3a')](_0x37e2('0x3b'))){_0x56c4a5['limit']=qs['limit'](_0x59a00e['query'][_0x37e2('0x21')]);_0x56c4a5[_0x37e2('0x20')]=qs[_0x37e2('0x20')](_0x59a00e[_0x37e2('0x33')]['offset']);}_0x56c4a5['order']=qs[_0x37e2('0x3c')](_0x59a00e[_0x37e2('0x33')][_0x37e2('0x3c')]);_0x56c4a5[_0x37e2('0x3d')]=qs['filters'](_[_0x37e2('0x3e')](_0x59a00e[_0x37e2('0x33')],_0x2c5c77[_0x37e2('0x35')]),_0x5e1e6f);if(_0x59a00e[_0x37e2('0x33')]['filter']){_0x56c4a5['where']=_[_0x37e2('0x3f')](_0x56c4a5['where'],{'$or':_['map'](_0x5e1e6f,function(_0x253caa){if(_0x253caa['type']!=='VIRTUAL'){var _0x3fd799={};_0x3fd799[_0x253caa[_0x37e2('0x2a')]]={'$like':'%'+_0x59a00e[_0x37e2('0x33')][_0x37e2('0x40')]+'%'};return _0x3fd799;}})});}_0x56c4a5=_[_0x37e2('0x3f')]({},_0x56c4a5,_0x59a00e['options']);var _0x3a9baa={'where':_0x56c4a5[_0x37e2('0x3d')]};return db[_0x37e2('0x2d')][_0x37e2('0x1f')](_0x3a9baa)[_0x37e2('0x27')](function(_0x1f29b7){_0x436ab3['count']=_0x1f29b7;if(_0x59a00e[_0x37e2('0x33')][_0x37e2('0x41')]){_0x56c4a5[_0x37e2('0x42')]=[{'all':!![]}];}return db[_0x37e2('0x2d')][_0x37e2('0x43')](_0x56c4a5);})['then'](function(_0x4c0d63){_0x436ab3[_0x37e2('0x44')]=_0x4c0d63;return _0x436ab3;})[_0x37e2('0x27')](respondWithFilteredResult(_0x582711,_0x56c4a5))[_0x37e2('0x45')](handleError(_0x582711,null));};exports['show']=function(_0x1b3795,_0x5db0ee){var _0x3b8c57={'raw':!![],'where':{'id':_0x1b3795['params']['id']}},_0xa42ad2={};_0xa42ad2[_0x37e2('0x32')]=_['keys'](db[_0x37e2('0x2d')][_0x37e2('0x2e')]);_0xa42ad2[_0x37e2('0x33')]=_[_0x37e2('0x34')](_0x1b3795[_0x37e2('0x33')]);_0xa42ad2[_0x37e2('0x35')]=_[_0x37e2('0x36')](_0xa42ad2[_0x37e2('0x32')],_0xa42ad2[_0x37e2('0x33')]);_0x3b8c57[_0x37e2('0x37')]=_[_0x37e2('0x36')](_0xa42ad2[_0x37e2('0x32')],qs['fields'](_0x1b3795[_0x37e2('0x33')][_0x37e2('0x38')]));_0x3b8c57[_0x37e2('0x37')]=_0x3b8c57[_0x37e2('0x37')][_0x37e2('0x39')]?_0x3b8c57[_0x37e2('0x37')]:_0xa42ad2[_0x37e2('0x32')];if(_0x1b3795[_0x37e2('0x33')][_0x37e2('0x41')]){_0x3b8c57[_0x37e2('0x42')]=[{'all':!![]}];}_0x3b8c57=_[_0x37e2('0x3f')]({},_0x3b8c57,_0x1b3795[_0x37e2('0x46')]);return db[_0x37e2('0x2d')]['find'](_0x3b8c57)[_0x37e2('0x27')](handleEntityNotFound(_0x5db0ee,null))[_0x37e2('0x27')](respondWithResult(_0x5db0ee,null))['catch'](handleError(_0x5db0ee,null));};exports['create']=function(_0x15c3c4,_0x10371f){return db[_0x37e2('0x2d')]['create'](_0x15c3c4['body'],{})[_0x37e2('0x27')](respondWithResult(_0x10371f,0xc9))[_0x37e2('0x45')](handleError(_0x10371f,null));};exports['update']=function(_0x519c38,_0x316212){if(_0x519c38['body']['id']){delete _0x519c38[_0x37e2('0x47')]['id'];}return db['SugarcrmField']['find']({'where':{'id':_0x519c38['params']['id']}})[_0x37e2('0x27')](handleEntityNotFound(_0x316212,null))[_0x37e2('0x27')](saveUpdates(_0x519c38['body'],null))[_0x37e2('0x27')](respondWithResult(_0x316212,null))[_0x37e2('0x45')](handleError(_0x316212,null));};exports[_0x37e2('0x28')]=function(_0x347d7b,_0x523842){return db['SugarcrmField'][_0x37e2('0x48')]({'where':{'id':_0x347d7b[_0x37e2('0x49')]['id']}})[_0x37e2('0x27')](handleEntityNotFound(_0x523842,null))['then'](removeEntity(_0x523842,null))[_0x37e2('0x45')](handleError(_0x523842,null));}; \ No newline at end of file +var _0x6a6e=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','rows','catch','show','rawAttributes','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','SugarcrmField','fieldName','type','key','model','query','filters','intersection','fields','attributes'];(function(_0x861e02,_0x33f772){var _0x48fc24=function(_0x21b4d3){while(--_0x21b4d3){_0x861e02['push'](_0x861e02['shift']());}};_0x48fc24(++_0x33f772);}(_0x6a6e,0xa7));var _0xe6a6=function(_0x3c7e74,_0x431a67){_0x3c7e74=_0x3c7e74-0x0;var _0x5e7924=_0x6a6e[_0x3c7e74];return _0x5e7924;};'use strict';var emlformat=require(_0xe6a6('0x0'));var rimraf=require(_0xe6a6('0x1'));var zipdir=require(_0xe6a6('0x2'));var jsonpatch=require(_0xe6a6('0x3'));var rp=require(_0xe6a6('0x4'));var moment=require(_0xe6a6('0x5'));var BPromise=require(_0xe6a6('0x6'));var Mustache=require('mustache');var util=require(_0xe6a6('0x7'));var path=require(_0xe6a6('0x8'));var sox=require('sox');var csv=require(_0xe6a6('0x9'));var ejs=require(_0xe6a6('0xa'));var fs=require('fs');var fs_extra=require(_0xe6a6('0xb'));var _=require(_0xe6a6('0xc'));var squel=require(_0xe6a6('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe6a6('0xe'));var toCsv=require(_0xe6a6('0x9'));var querystring=require(_0xe6a6('0xf'));var Papa=require('papaparse');var Redis=require(_0xe6a6('0x10'));var authService=require(_0xe6a6('0x11'));var qs=require(_0xe6a6('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe6a6('0x13'));var logger=require(_0xe6a6('0x14'))('api');var utils=require(_0xe6a6('0x15'));var config=require(_0xe6a6('0x16'));var licenseUtil=require(_0xe6a6('0x17'));var db=require(_0xe6a6('0x18'))['db'];function respondWithStatusCode(_0x58a7bf,_0x3e2058){_0x3e2058=_0x3e2058||0xcc;return function(_0x5dd0cc){if(_0x5dd0cc){return _0x58a7bf['sendStatus'](_0x3e2058);}return _0x58a7bf[_0xe6a6('0x19')](_0x3e2058)[_0xe6a6('0x1a')]();};}function respondWithResult(_0xf17f41,_0x518d74){_0x518d74=_0x518d74||0xc8;return function(_0x2e1122){if(_0x2e1122){return _0xf17f41[_0xe6a6('0x19')](_0x518d74)[_0xe6a6('0x1b')](_0x2e1122);}};}function respondWithFilteredResult(_0x3f0df8,_0x514dd8){return function(_0x3254af){if(_0x3254af){var _0x11c28b=typeof _0x514dd8[_0xe6a6('0x1c')]==='undefined'&&typeof _0x514dd8[_0xe6a6('0x1d')]===_0xe6a6('0x1e');var _0x305ab7=_0x3254af[_0xe6a6('0x1f')];var _0x1a4967=_0x11c28b?0x0:_0x514dd8[_0xe6a6('0x1c')];var _0x4d3d09=_0x11c28b?_0x3254af[_0xe6a6('0x1f')]:_0x514dd8[_0xe6a6('0x1c')]+_0x514dd8[_0xe6a6('0x1d')];var _0xc3ede;if(_0x4d3d09>=_0x305ab7){_0x4d3d09=_0x305ab7;_0xc3ede=0xc8;}else{_0xc3ede=0xce;}_0x3f0df8[_0xe6a6('0x19')](_0xc3ede);return _0x3f0df8[_0xe6a6('0x20')]('Content-Range',_0x1a4967+'-'+_0x4d3d09+'/'+_0x305ab7)['json'](_0x3254af);}return null;};}function patchUpdates(_0x2d3c9a){return function(_0x1175b8){try{jsonpatch[_0xe6a6('0x21')](_0x1175b8,_0x2d3c9a,!![]);}catch(_0x4f3aae){return BPromise[_0xe6a6('0x22')](_0x4f3aae);}return _0x1175b8['save']();};}function saveUpdates(_0x238a2e,_0x51fa49){return function(_0x4fd149){if(_0x4fd149){return _0x4fd149[_0xe6a6('0x23')](_0x238a2e)[_0xe6a6('0x24')](function(_0x370df3){return _0x370df3;});}return null;};}function removeEntity(_0xc02bcc,_0x408c56){return function(_0x510ab3){if(_0x510ab3){return _0x510ab3[_0xe6a6('0x25')]()[_0xe6a6('0x24')](function(){_0xc02bcc[_0xe6a6('0x19')](0xcc)[_0xe6a6('0x1a')]();});}};}function handleEntityNotFound(_0x1e58df,_0x4e853a){return function(_0x380ad8){if(!_0x380ad8){_0x1e58df[_0xe6a6('0x26')](0x194);}return _0x380ad8;};}function handleError(_0x384ad8,_0x3fc533){_0x3fc533=_0x3fc533||0x1f4;return function(_0x1a14bc){logger[_0xe6a6('0x27')](_0x1a14bc[_0xe6a6('0x28')]);if(_0x1a14bc[_0xe6a6('0x29')]){delete _0x1a14bc['name'];}_0x384ad8[_0xe6a6('0x19')](_0x3fc533)[_0xe6a6('0x2a')](_0x1a14bc);};}exports[_0xe6a6('0x2b')]=function(_0x56422a,_0x2c5e7c){var _0x53c87e={},_0x51faf1={},_0x4bb445={'count':0x0,'rows':[]};var _0x368e98=_[_0xe6a6('0x2c')](db[_0xe6a6('0x2d')]['rawAttributes'],function(_0x11e535){return{'name':_0x11e535[_0xe6a6('0x2e')],'type':_0x11e535[_0xe6a6('0x2f')][_0xe6a6('0x30')]};});_0x51faf1[_0xe6a6('0x31')]=_['map'](_0x368e98,_0xe6a6('0x29'));_0x51faf1[_0xe6a6('0x32')]=_['keys'](_0x56422a['query']);_0x51faf1[_0xe6a6('0x33')]=_[_0xe6a6('0x34')](_0x51faf1['model'],_0x51faf1['query']);_0x53c87e['attributes']=_[_0xe6a6('0x34')](_0x51faf1[_0xe6a6('0x31')],qs[_0xe6a6('0x35')](_0x56422a['query'][_0xe6a6('0x35')]));_0x53c87e[_0xe6a6('0x36')]=_0x53c87e[_0xe6a6('0x36')][_0xe6a6('0x37')]?_0x53c87e['attributes']:_0x51faf1[_0xe6a6('0x31')];if(!_0x56422a[_0xe6a6('0x32')][_0xe6a6('0x38')](_0xe6a6('0x39'))){_0x53c87e[_0xe6a6('0x1d')]=qs[_0xe6a6('0x1d')](_0x56422a[_0xe6a6('0x32')]['limit']);_0x53c87e[_0xe6a6('0x1c')]=qs[_0xe6a6('0x1c')](_0x56422a[_0xe6a6('0x32')][_0xe6a6('0x1c')]);}_0x53c87e[_0xe6a6('0x3a')]=qs[_0xe6a6('0x3b')](_0x56422a[_0xe6a6('0x32')][_0xe6a6('0x3b')]);_0x53c87e[_0xe6a6('0x3c')]=qs[_0xe6a6('0x33')](_[_0xe6a6('0x3d')](_0x56422a['query'],_0x51faf1[_0xe6a6('0x33')]),_0x368e98);if(_0x56422a[_0xe6a6('0x32')][_0xe6a6('0x3e')]){_0x53c87e['where']=_[_0xe6a6('0x3f')](_0x53c87e[_0xe6a6('0x3c')],{'$or':_[_0xe6a6('0x2c')](_0x368e98,function(_0x1319a0){if(_0x1319a0[_0xe6a6('0x2f')]!=='VIRTUAL'){var _0xe3ed9c={};_0xe3ed9c[_0x1319a0[_0xe6a6('0x29')]]={'$like':'%'+_0x56422a[_0xe6a6('0x32')][_0xe6a6('0x3e')]+'%'};return _0xe3ed9c;}})});}_0x53c87e=_[_0xe6a6('0x3f')]({},_0x53c87e,_0x56422a[_0xe6a6('0x40')]);var _0x15499a={'where':_0x53c87e[_0xe6a6('0x3c')]};return db[_0xe6a6('0x2d')][_0xe6a6('0x1f')](_0x15499a)[_0xe6a6('0x24')](function(_0x5614d0){_0x4bb445[_0xe6a6('0x1f')]=_0x5614d0;if(_0x56422a[_0xe6a6('0x32')]['includeAll']){_0x53c87e[_0xe6a6('0x41')]=[{'all':!![]}];}return db['SugarcrmField']['findAll'](_0x53c87e);})[_0xe6a6('0x24')](function(_0x192124){_0x4bb445[_0xe6a6('0x42')]=_0x192124;return _0x4bb445;})[_0xe6a6('0x24')](respondWithFilteredResult(_0x2c5e7c,_0x53c87e))[_0xe6a6('0x43')](handleError(_0x2c5e7c,null));};exports[_0xe6a6('0x44')]=function(_0x3ea9c2,_0x53e107){var _0xe50718={'raw':!![],'where':{'id':_0x3ea9c2['params']['id']}},_0xfec8ad={};_0xfec8ad[_0xe6a6('0x31')]=_['keys'](db['SugarcrmField'][_0xe6a6('0x45')]);_0xfec8ad[_0xe6a6('0x32')]=_['keys'](_0x3ea9c2['query']);_0xfec8ad[_0xe6a6('0x33')]=_[_0xe6a6('0x34')](_0xfec8ad['model'],_0xfec8ad[_0xe6a6('0x32')]);_0xe50718[_0xe6a6('0x36')]=_[_0xe6a6('0x34')](_0xfec8ad[_0xe6a6('0x31')],qs[_0xe6a6('0x35')](_0x3ea9c2[_0xe6a6('0x32')][_0xe6a6('0x35')]));_0xe50718[_0xe6a6('0x36')]=_0xe50718['attributes'][_0xe6a6('0x37')]?_0xe50718[_0xe6a6('0x36')]:_0xfec8ad[_0xe6a6('0x31')];if(_0x3ea9c2[_0xe6a6('0x32')][_0xe6a6('0x46')]){_0xe50718['include']=[{'all':!![]}];}_0xe50718=_[_0xe6a6('0x3f')]({},_0xe50718,_0x3ea9c2[_0xe6a6('0x40')]);return db[_0xe6a6('0x2d')][_0xe6a6('0x47')](_0xe50718)[_0xe6a6('0x24')](handleEntityNotFound(_0x53e107,null))[_0xe6a6('0x24')](respondWithResult(_0x53e107,null))[_0xe6a6('0x43')](handleError(_0x53e107,null));};exports[_0xe6a6('0x48')]=function(_0x336272,_0x5e7acc){return db['SugarcrmField'][_0xe6a6('0x48')](_0x336272[_0xe6a6('0x49')],{})[_0xe6a6('0x24')](respondWithResult(_0x5e7acc,0xc9))['catch'](handleError(_0x5e7acc,null));};exports[_0xe6a6('0x23')]=function(_0x170b25,_0x287bac){if(_0x170b25[_0xe6a6('0x49')]['id']){delete _0x170b25[_0xe6a6('0x49')]['id'];}return db['SugarcrmField'][_0xe6a6('0x47')]({'where':{'id':_0x170b25['params']['id']}})[_0xe6a6('0x24')](handleEntityNotFound(_0x287bac,null))[_0xe6a6('0x24')](saveUpdates(_0x170b25[_0xe6a6('0x49')],null))['then'](respondWithResult(_0x287bac,null))[_0xe6a6('0x43')](handleError(_0x287bac,null));};exports[_0xe6a6('0x25')]=function(_0x5540cd,_0xbc5efd){return db[_0xe6a6('0x2d')][_0xe6a6('0x47')]({'where':{'id':_0x5540cd['params']['id']}})[_0xe6a6('0x24')](handleEntityNotFound(_0xbc5efd,null))['then'](removeEntity(_0xbc5efd,null))[_0xe6a6('0x43')](handleError(_0xbc5efd,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 5d0e59f..44f7917 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 _0x19c6=['../../config/logger','moment','request-promise','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','util'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x19c6,0x1da));var _0x619c=function(_0x2ce7,_0x42de64){_0x2ce7=_0x2ce7-0x0;var _0x3465bf=_0x19c6[_0x2ce7];return _0x3465bf;};'use strict';var _=require(_0x619c('0x0'));var util=require(_0x619c('0x1'));var logger=require(_0x619c('0x2'))('api');var moment=require(_0x619c('0x3'));var BPromise=require('bluebird');var rp=require(_0x619c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x619c('0x5'));var attributes=require(_0x619c('0x6'));module[_0x619c('0x7')]=function(_0xe9ad21,_0x5a6921){return _0xe9ad21[_0x619c('0x8')](_0x619c('0x9'),attributes,{'tableName':_0x619c('0xa'),'paranoid':![],'indexes':[{'name':_0x619c('0xb'),'fields':[_0x619c('0xc'),_0x619c('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xff97=['rimraf','../../config/environment','exports','define','sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x2c3aa9,_0x2bf7b1){var _0xcce2da=function(_0x27e771){while(--_0x27e771){_0x2c3aa9['push'](_0x2c3aa9['shift']());}};_0xcce2da(++_0x2bf7b1);}(_0xff97,0x132));var _0x7ff9=function(_0x248dbf,_0x1f7786){_0x248dbf=_0x248dbf-0x0;var _0x317602=_0xff97[_0x248dbf];return _0x317602;};'use strict';var _=require(_0x7ff9('0x0'));var util=require(_0x7ff9('0x1'));var logger=require(_0x7ff9('0x2'))('api');var moment=require(_0x7ff9('0x3'));var BPromise=require('bluebird');var rp=require(_0x7ff9('0x4'));var fs=require('fs');var path=require(_0x7ff9('0x5'));var rimraf=require(_0x7ff9('0x6'));var config=require(_0x7ff9('0x7'));var attributes=require('./intSugarcrmField.attributes');module[_0x7ff9('0x8')]=function(_0x222af5,_0x36f350){return _0x222af5[_0x7ff9('0x9')]('SugarcrmField',attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x7ff9('0xa'),'fields':[_0x7ff9('0xb'),_0x7ff9('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 3d81c98..00b3ba9 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 _0x3658=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0x3658,0x1f4));var _0x8365=function(_0x314321,_0x2c1af8){_0x314321=_0x314321-0x0;var _0x2409b5=_0x3658[_0x314321];return _0x2409b5;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x8365('0x0'));var rs=require(_0x8365('0x1'));var fs=require('fs');var Redis=require(_0x8365('0x2'));var db=require(_0x8365('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x8365('0x4'))('rpc');var config=require(_0x8365('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x8365('0x6')][_0x8365('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x182c74,_0x2f0921,_0x37768f){return new BPromise(function(_0x50741a,_0x4d5db3){return client[_0x8365('0x8')](_0x182c74,_0x37768f)[_0x8365('0x9')](function(_0x325db7){logger[_0x8365('0xa')](_0x8365('0xb'),_0x2f0921,'request\x20sent');logger[_0x8365('0xc')](_0x8365('0xd'),_0x2f0921,_0x8365('0xe'),JSON[_0x8365('0xf')](_0x325db7));if(_0x325db7['error']){if(_0x325db7[_0x8365('0x10')][_0x8365('0x11')]===0x1f4){logger[_0x8365('0x10')](_0x8365('0xb'),_0x2f0921,_0x325db7[_0x8365('0x10')][_0x8365('0x12')]);return _0x4d5db3(_0x325db7[_0x8365('0x10')][_0x8365('0x12')]);}logger[_0x8365('0x10')](_0x8365('0xb'),_0x2f0921,_0x325db7[_0x8365('0x10')][_0x8365('0x12')]);return _0x50741a(_0x325db7[_0x8365('0x10')][_0x8365('0x12')]);}else{logger[_0x8365('0xa')](_0x8365('0xb'),_0x2f0921,'request\x20sent');_0x50741a(_0x325db7[_0x8365('0x13')][_0x8365('0x12')]);}})['catch'](function(_0x3d9e77){logger['error'](_0x8365('0xb'),_0x2f0921,_0x3d9e77);_0x4d5db3(_0x3d9e77);});});} \ No newline at end of file +var _0x2eec=['request','info','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','SugarcrmField,\x20%s,\x20%s','message','error','catch','moment','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x850b85,_0x5d5a47){var _0x592390=function(_0x2bdc33){while(--_0x2bdc33){_0x850b85['push'](_0x850b85['shift']());}};_0x592390(++_0x5d5a47);}(_0x2eec,0x91));var _0xc2ee=function(_0xd4f135,_0x5cad9a){_0xd4f135=_0xd4f135-0x0;var _0x55f089=_0x2eec[_0xd4f135];return _0x55f089;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc2ee('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc2ee('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0xc2ee('0x2'));var logger=require(_0xc2ee('0x3'))(_0xc2ee('0x4'));var config=require('../../config/environment');var jayson=require(_0xc2ee('0x5'));var client=jayson[_0xc2ee('0x6')][_0xc2ee('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3b9b7b,_0x545637,_0x504d09){return new BPromise(function(_0x2f2767,_0x19f83c){return client[_0xc2ee('0x8')](_0x3b9b7b,_0x504d09)['then'](function(_0x54edaf){logger[_0xc2ee('0x9')]('SugarcrmField,\x20%s,\x20%s',_0x545637,_0xc2ee('0xa'));logger[_0xc2ee('0xb')](_0xc2ee('0xc'),_0x545637,_0xc2ee('0xa'),JSON['stringify'](_0x54edaf));if(_0x54edaf['error']){if(_0x54edaf['error']['code']===0x1f4){logger['error'](_0xc2ee('0xd'),_0x545637,_0x54edaf['error'][_0xc2ee('0xe')]);return _0x19f83c(_0x54edaf[_0xc2ee('0xf')][_0xc2ee('0xe')]);}logger[_0xc2ee('0xf')](_0xc2ee('0xd'),_0x545637,_0x54edaf['error'][_0xc2ee('0xe')]);return _0x2f2767(_0x54edaf[_0xc2ee('0xf')]['message']);}else{logger[_0xc2ee('0x9')](_0xc2ee('0xd'),_0x545637,'request\x20sent');_0x2f2767(_0x54edaf['result'][_0xc2ee('0xe')]);}})[_0xc2ee('0x10')](function(_0x46d084){logger[_0xc2ee('0xf')](_0xc2ee('0xd'),_0x545637,_0x46d084);_0x19f83c(_0x46d084);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 95881b3..77275d9 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 _0xd2ea=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','delete','multer'];(function(_0x5b503b,_0xe75bbe){var _0x43b949=function(_0x3d83a7){while(--_0x3d83a7){_0x5b503b['push'](_0x5b503b['shift']());}};_0x43b949(++_0xe75bbe);}(_0xd2ea,0x15f));var _0xad2e=function(_0x4afdcc,_0x3a7186){_0x4afdcc=_0x4afdcc-0x0;var _0x591c5c=_0xd2ea[_0x4afdcc];return _0x591c5c;};'use strict';var multer=require(_0xad2e('0x0'));var util=require(_0xad2e('0x1'));var path=require(_0xad2e('0x2'));var timeout=require(_0xad2e('0x3'));var express=require(_0xad2e('0x4'));var router=express['Router']();var fs_extra=require(_0xad2e('0x5'));var auth=require(_0xad2e('0x6'));var interaction=require(_0xad2e('0x7'));var config=require(_0xad2e('0x8'));var controller=require(_0xad2e('0x9'));router[_0xad2e('0xa')]('/',auth[_0xad2e('0xb')](),controller['index']);router[_0xad2e('0xa')](_0xad2e('0xc'),auth[_0xad2e('0xb')](),controller['show']);router[_0xad2e('0xa')](_0xad2e('0xd'),auth['isAuthenticated'](),controller[_0xad2e('0xe')]);router['get'](_0xad2e('0xf'),auth[_0xad2e('0xb')](),controller[_0xad2e('0x10')]);router[_0xad2e('0x11')]('/',auth['isAuthenticated'](),controller[_0xad2e('0x12')]);router['post'](_0xad2e('0xd'),auth[_0xad2e('0xb')](),controller[_0xad2e('0x13')]);router[_0xad2e('0x14')]('/:id',auth[_0xad2e('0xb')](),controller['update']);router[_0xad2e('0x15')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6fb8=['getFields','post','create','addConfiguration','put','update','delete','exports','multer','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations'];(function(_0x2cdee6,_0xda8a29){var _0x537e75=function(_0x239aff){while(--_0x239aff){_0x2cdee6['push'](_0x2cdee6['shift']());}};_0x537e75(++_0xda8a29);}(_0x6fb8,0x104));var _0x86fb=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x6fb8[_0x263a74];return _0x2aa86c;};'use strict';var multer=require(_0x86fb('0x0'));var util=require('util');var path=require(_0x86fb('0x1'));var timeout=require(_0x86fb('0x2'));var express=require('express');var router=express[_0x86fb('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x86fb('0x4'));var config=require(_0x86fb('0x5'));var controller=require(_0x86fb('0x6'));router[_0x86fb('0x7')]('/',auth[_0x86fb('0x8')](),controller[_0x86fb('0x9')]);router[_0x86fb('0x7')](_0x86fb('0xa'),auth[_0x86fb('0x8')](),controller[_0x86fb('0xb')]);router[_0x86fb('0x7')](_0x86fb('0xc'),auth[_0x86fb('0x8')](),controller['getConfigurations']);router[_0x86fb('0x7')]('/:id/fields',auth[_0x86fb('0x8')](),controller[_0x86fb('0xd')]);router[_0x86fb('0xe')]('/',auth['isAuthenticated'](),controller[_0x86fb('0xf')]);router['post'](_0x86fb('0xc'),auth[_0x86fb('0x8')](),controller[_0x86fb('0x10')]);router[_0x86fb('0x11')](_0x86fb('0xa'),auth[_0x86fb('0x8')](),controller[_0x86fb('0x12')]);router[_0x86fb('0x13')](_0x86fb('0xa'),auth[_0x86fb('0x8')](),controller['destroy']);module[_0x86fb('0x14')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index ceb2aca..57068d8 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 _0x5c2b=['HelpDesk','STRING'];(function(_0x42dd02,_0x36de11){var _0x17e04b=function(_0x433af5){while(--_0x433af5){_0x42dd02['push'](_0x42dd02['shift']());}};_0x17e04b(++_0x36de11);}(_0x5c2b,0x113));var _0xb5c2=function(_0x47a774,_0x17718e){_0x47a774=_0x47a774-0x0;var _0x5317cb=_0x5c2b[_0x47a774];return _0x5317cb;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb5c2('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0xb5c2('0x0')]},'username':{'type':Sequelize[_0xb5c2('0x0')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xb5c2('0x0')],'allowNull':![],'defaultValue':_0xb5c2('0x1')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xb5c2('0x0')],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x0773=['HelpDesk','sequelize','exports','STRING'];(function(_0x57b56f,_0x5cc57c){var _0x1484a8=function(_0x4e2ecb){while(--_0x4e2ecb){_0x57b56f['push'](_0x57b56f['shift']());}};_0x1484a8(++_0x5cc57c);}(_0x0773,0x79));var _0x3077=function(_0x1e9634,_0xc0847d){_0x1e9634=_0x1e9634-0x0;var _0x276212=_0x0773[_0x1e9634];return _0x276212;};'use strict';var Sequelize=require(_0x3077('0x0'));module[_0x3077('0x1')]={'name':{'type':Sequelize[_0x3077('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x3077('0x2')]},'username':{'type':Sequelize[_0x3077('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x3077('0x2')],'allowNull':![],'defaultValue':_0x3077('0x3')},'remoteUri':{'type':Sequelize[_0x3077('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x3077('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x3077('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 792e338..c3be44c 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 _0x90b3=['../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index','VtigerAccount','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filter','merge','map','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','getConfigurations','VtigerConfiguration','sort','pick','addConfiguration','findOne','AccountId','Subjects','channel','type','Descriptions','getDescriptions','VtigerField','getFields','description','moduleName','remoteUri','serverUrl','accessKey','username','substring','lastIndexOf','format','%s/webservice.php','getchallenge','success','POST','login','token','GET','describe','sessionName','reference','owner','result','includes','remove','editable','false','label','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x5b405a,_0x28fbaa){var _0x1ca4c7=function(_0x16bd4f){while(--_0x16bd4f){_0x5b405a['push'](_0x5b405a['shift']());}};_0x1ca4c7(++_0x28fbaa);}(_0x90b3,0x6f));var _0x390b=function(_0x389fb1,_0x431673){_0x389fb1=_0x389fb1-0x0;var _0x3d3520=_0x90b3[_0x389fb1];return _0x3d3520;};'use strict';var emlformat=require(_0x390b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x390b('0x1'));var rp=require(_0x390b('0x2'));var moment=require(_0x390b('0x3'));var BPromise=require(_0x390b('0x4'));var Mustache=require(_0x390b('0x5'));var util=require(_0x390b('0x6'));var path=require(_0x390b('0x7'));var sox=require(_0x390b('0x8'));var csv=require('to-csv');var ejs=require(_0x390b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x390b('0xa'));var squel=require(_0x390b('0xb'));var crypto=require(_0x390b('0xc'));var jsforce=require(_0x390b('0xd'));var deskjs=require(_0x390b('0xe'));var toCsv=require(_0x390b('0xf'));var querystring=require(_0x390b('0x10'));var Papa=require(_0x390b('0x11'));var Redis=require(_0x390b('0x12'));var authService=require(_0x390b('0x13'));var qs=require(_0x390b('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x390b('0x15'));var logger=require('../../config/logger')(_0x390b('0x16'));var utils=require(_0x390b('0x17'));var config=require(_0x390b('0x18'));var licenseUtil=require(_0x390b('0x19'));var db=require(_0x390b('0x1a'))['db'];var integrations=require(_0x390b('0x1b'));function respondWithStatusCode(_0x50b317,_0x4f0b7b){_0x4f0b7b=_0x4f0b7b||0xcc;return function(_0xe833b3){if(_0xe833b3){return _0x50b317[_0x390b('0x1c')](_0x4f0b7b);}return _0x50b317['status'](_0x4f0b7b)[_0x390b('0x1d')]();};}function respondWithResult(_0x31a592,_0xd47a51){_0xd47a51=_0xd47a51||0xc8;return function(_0x12e67d){if(_0x12e67d){return _0x31a592[_0x390b('0x1e')](_0xd47a51)['json'](_0x12e67d);}};}function respondWithFilteredResult(_0x115aa9,_0x1c358f){return function(_0x370268){if(_0x370268){var _0x55bad5=typeof _0x1c358f[_0x390b('0x1f')]===_0x390b('0x20')&&typeof _0x1c358f[_0x390b('0x21')]===_0x390b('0x20');var _0x2d7275=_0x370268['count'];var _0x1359dc=_0x55bad5?0x0:_0x1c358f[_0x390b('0x1f')];var _0x26802f=_0x55bad5?_0x370268[_0x390b('0x22')]:_0x1c358f[_0x390b('0x1f')]+_0x1c358f[_0x390b('0x21')];var _0x1606b6;if(_0x26802f>=_0x2d7275){_0x26802f=_0x2d7275;_0x1606b6=0xc8;}else{_0x1606b6=0xce;}_0x115aa9['status'](_0x1606b6);return _0x115aa9[_0x390b('0x23')](_0x390b('0x24'),_0x1359dc+'-'+_0x26802f+'/'+_0x2d7275)[_0x390b('0x25')](_0x370268);}return null;};}function patchUpdates(_0x398ad5){return function(_0x1af3df){try{jsonpatch[_0x390b('0x26')](_0x1af3df,_0x398ad5,!![]);}catch(_0x52a532){return BPromise[_0x390b('0x27')](_0x52a532);}return _0x1af3df[_0x390b('0x28')]();};}function saveUpdates(_0x3edf2d,_0x395d67){return function(_0x2133ec){if(_0x2133ec){return _0x2133ec[_0x390b('0x29')](_0x3edf2d)[_0x390b('0x2a')](function(_0x2eba01){return _0x2eba01;});}return null;};}function removeEntity(_0x5dc731,_0x2cb190){return function(_0x2606e3){if(_0x2606e3){return _0x2606e3[_0x390b('0x2b')]()[_0x390b('0x2a')](function(){_0x5dc731['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x53129f,_0xf1bf34){return function(_0x4cc5ad){if(!_0x4cc5ad){_0x53129f[_0x390b('0x1c')](0x194);}return _0x4cc5ad;};}function handleError(_0x1e0b93,_0x3e042d){_0x3e042d=_0x3e042d||0x1f4;return function(_0x776590){logger[_0x390b('0x2c')](_0x776590['stack']);if(_0x776590['name']){delete _0x776590[_0x390b('0x2d')];}_0x1e0b93['status'](_0x3e042d)[_0x390b('0x2e')](_0x776590);};}exports[_0x390b('0x2f')]=function(_0xf7a92d,_0x2f02d5){var _0x2dc951={},_0x527466={},_0x112d58={'count':0x0,'rows':[]};var _0x2abba6=_['map'](db[_0x390b('0x30')][_0x390b('0x31')],function(_0x11db75){return{'name':_0x11db75[_0x390b('0x32')],'type':_0x11db75['type'][_0x390b('0x33')]};});_0x527466[_0x390b('0x34')]=_['map'](_0x2abba6,'name');_0x527466[_0x390b('0x35')]=_['keys'](_0xf7a92d[_0x390b('0x35')]);_0x527466[_0x390b('0x36')]=_[_0x390b('0x37')](_0x527466[_0x390b('0x34')],_0x527466[_0x390b('0x35')]);_0x2dc951[_0x390b('0x38')]=_[_0x390b('0x37')](_0x527466[_0x390b('0x34')],qs[_0x390b('0x39')](_0xf7a92d[_0x390b('0x35')]['fields']));_0x2dc951[_0x390b('0x38')]=_0x2dc951[_0x390b('0x38')][_0x390b('0x3a')]?_0x2dc951[_0x390b('0x38')]:_0x527466[_0x390b('0x34')];if(!_0xf7a92d[_0x390b('0x35')][_0x390b('0x3b')](_0x390b('0x3c'))){_0x2dc951[_0x390b('0x21')]=qs['limit'](_0xf7a92d[_0x390b('0x35')][_0x390b('0x21')]);_0x2dc951[_0x390b('0x1f')]=qs[_0x390b('0x1f')](_0xf7a92d[_0x390b('0x35')][_0x390b('0x1f')]);}_0x2dc951[_0x390b('0x3d')]=qs['sort'](_0xf7a92d[_0x390b('0x35')]['sort']);_0x2dc951[_0x390b('0x3e')]=qs['filters'](_['pick'](_0xf7a92d[_0x390b('0x35')],_0x527466['filters']),_0x2abba6);if(_0xf7a92d[_0x390b('0x35')][_0x390b('0x3f')]){_0x2dc951[_0x390b('0x3e')]=_[_0x390b('0x40')](_0x2dc951[_0x390b('0x3e')],{'$or':_[_0x390b('0x41')](_0x2abba6,function(_0x3b4ab0){if(_0x3b4ab0['type']!==_0x390b('0x42')){var _0x3f01af={};_0x3f01af[_0x3b4ab0[_0x390b('0x2d')]]={'$like':'%'+_0xf7a92d[_0x390b('0x35')][_0x390b('0x3f')]+'%'};return _0x3f01af;}})});}_0x2dc951=_[_0x390b('0x40')]({},_0x2dc951,_0xf7a92d['options']);var _0x4e6a42={'where':_0x2dc951[_0x390b('0x3e')]};return db[_0x390b('0x30')][_0x390b('0x22')](_0x4e6a42)['then'](function(_0x16fc90){_0x112d58['count']=_0x16fc90;if(_0xf7a92d[_0x390b('0x35')][_0x390b('0x43')]){_0x2dc951[_0x390b('0x44')]=[{'all':!![]}];}return db[_0x390b('0x30')][_0x390b('0x45')](_0x2dc951);})['then'](function(_0x498841){_0x112d58[_0x390b('0x46')]=_0x498841;return _0x112d58;})[_0x390b('0x2a')](respondWithFilteredResult(_0x2f02d5,_0x2dc951))[_0x390b('0x47')](handleError(_0x2f02d5,null));};exports[_0x390b('0x48')]=function(_0x19c6e1,_0x3962bf){var _0x26666d={'raw':![],'where':{'id':_0x19c6e1[_0x390b('0x49')]['id']}},_0xd100b1={};_0xd100b1[_0x390b('0x34')]=_[_0x390b('0x4a')](db['VtigerAccount'][_0x390b('0x31')]);_0xd100b1[_0x390b('0x35')]=_['keys'](_0x19c6e1[_0x390b('0x35')]);_0xd100b1[_0x390b('0x36')]=_[_0x390b('0x37')](_0xd100b1[_0x390b('0x34')],_0xd100b1[_0x390b('0x35')]);_0x26666d[_0x390b('0x38')]=_['intersection'](_0xd100b1[_0x390b('0x34')],qs[_0x390b('0x39')](_0x19c6e1['query'][_0x390b('0x39')]));_0x26666d['attributes']=_0x26666d['attributes'][_0x390b('0x3a')]?_0x26666d[_0x390b('0x38')]:_0xd100b1[_0x390b('0x34')];if(_0x19c6e1['query'][_0x390b('0x43')]){_0x26666d[_0x390b('0x44')]=[{'all':!![]}];}_0x26666d=_['merge']({},_0x26666d,_0x19c6e1[_0x390b('0x4b')]);return db[_0x390b('0x30')][_0x390b('0x4c')](_0x26666d)[_0x390b('0x2a')](handleEntityNotFound(_0x3962bf,null))['then'](respondWithResult(_0x3962bf,null))[_0x390b('0x47')](handleError(_0x3962bf,null));};exports[_0x390b('0x4d')]=function(_0xb9665f,_0x3e595b){return db['VtigerAccount'][_0x390b('0x4d')](_0xb9665f[_0x390b('0x4e')],{})[_0x390b('0x2a')](respondWithResult(_0x3e595b,0xc9))[_0x390b('0x47')](handleError(_0x3e595b,null));};exports[_0x390b('0x29')]=function(_0x4d0d8d,_0x1414d6){if(_0x4d0d8d[_0x390b('0x4e')]['id']){delete _0x4d0d8d[_0x390b('0x4e')]['id'];}return db[_0x390b('0x30')]['find']({'where':{'id':_0x4d0d8d['params']['id']}})['then'](handleEntityNotFound(_0x1414d6,null))[_0x390b('0x2a')](saveUpdates(_0x4d0d8d[_0x390b('0x4e')],null))['then'](respondWithResult(_0x1414d6,null))[_0x390b('0x47')](handleError(_0x1414d6,null));};exports[_0x390b('0x2b')]=function(_0x3e0edd,_0x2e17d8){return db[_0x390b('0x30')][_0x390b('0x4c')]({'where':{'id':_0x3e0edd[_0x390b('0x49')]['id']}})[_0x390b('0x2a')](handleEntityNotFound(_0x2e17d8,null))[_0x390b('0x2a')](removeEntity(_0x2e17d8,null))[_0x390b('0x47')](handleError(_0x2e17d8,null));};exports[_0x390b('0x4f')]=function(_0x4717a6,_0x58adc8,_0x358926){var _0x48c3e7={};var _0x138377={};var _0x32d94e;var _0x469db6;return db['VtigerAccount']['findOne']({'where':{'id':_0x4717a6[_0x390b('0x49')]['id']}})[_0x390b('0x2a')](handleEntityNotFound(_0x58adc8,null))[_0x390b('0x2a')](function(_0x2b5b4f){if(_0x2b5b4f){_0x32d94e=_0x2b5b4f;_0x138377['model']=_[_0x390b('0x4a')](db[_0x390b('0x50')][_0x390b('0x31')]);_0x138377['query']=_[_0x390b('0x4a')](_0x4717a6['query']);_0x138377[_0x390b('0x36')]=_[_0x390b('0x37')](_0x138377['model'],_0x138377[_0x390b('0x35')]);_0x48c3e7[_0x390b('0x38')]=_[_0x390b('0x37')](_0x138377[_0x390b('0x34')],qs['fields'](_0x4717a6[_0x390b('0x35')][_0x390b('0x39')]));_0x48c3e7['attributes']=_0x48c3e7[_0x390b('0x38')]['length']?_0x48c3e7['attributes']:_0x138377[_0x390b('0x34')];_0x48c3e7[_0x390b('0x3d')]=qs[_0x390b('0x51')](_0x4717a6[_0x390b('0x35')][_0x390b('0x51')]);_0x48c3e7[_0x390b('0x3e')]=qs[_0x390b('0x36')](_[_0x390b('0x52')](_0x4717a6[_0x390b('0x35')],_0x138377['filters']));if(_0x4717a6['query'][_0x390b('0x3f')]){_0x48c3e7[_0x390b('0x3e')]=_[_0x390b('0x40')](_0x48c3e7['where'],{'$or':_[_0x390b('0x41')](_0x48c3e7[_0x390b('0x38')],function(_0x10841a){var _0x345f2a={};_0x345f2a[_0x10841a]={'$like':'%'+_0x4717a6[_0x390b('0x35')]['filter']+'%'};return _0x345f2a;})});}_0x48c3e7=_[_0x390b('0x40')]({},_0x48c3e7,_0x4717a6[_0x390b('0x4b')]);return _0x32d94e[_0x390b('0x4f')](_0x48c3e7);}})[_0x390b('0x2a')](function(_0x572ee2){if(_0x572ee2){_0x469db6=_0x572ee2[_0x390b('0x3a')];if(!_0x4717a6[_0x390b('0x35')][_0x390b('0x3b')](_0x390b('0x3c'))){_0x48c3e7[_0x390b('0x21')]=qs[_0x390b('0x21')](_0x4717a6[_0x390b('0x35')][_0x390b('0x21')]);_0x48c3e7[_0x390b('0x1f')]=qs[_0x390b('0x1f')](_0x4717a6[_0x390b('0x35')][_0x390b('0x1f')]);}return _0x32d94e['getConfigurations'](_0x48c3e7);}})[_0x390b('0x2a')](function(_0x583f2f){if(_0x583f2f){return _0x583f2f?{'count':_0x469db6,'rows':_0x583f2f}:null;}})[_0x390b('0x2a')](respondWithResult(_0x58adc8,null))['catch'](handleError(_0x58adc8,null));};exports[_0x390b('0x53')]=function(_0x2d7c30,_0xae7691,_0x809609){if(_0x2d7c30[_0x390b('0x4e')]['id']){delete _0x2d7c30[_0x390b('0x4e')]['id'];}return db[_0x390b('0x30')][_0x390b('0x54')]({'where':{'id':_0x2d7c30[_0x390b('0x49')]['id']}})[_0x390b('0x2a')](handleEntityNotFound(_0xae7691,null))['then'](function(_0x112531){if(_0x112531){_0x2d7c30[_0x390b('0x4e')][_0x390b('0x55')]=_0x112531['id'];_0x2d7c30[_0x390b('0x4e')][_0x390b('0x56')]=integrations['getSubjects'](_0x2d7c30[_0x390b('0x4e')][_0x390b('0x57')],_0x2d7c30[_0x390b('0x4e')][_0x390b('0x58')]);_0x2d7c30[_0x390b('0x4e')][_0x390b('0x59')]=integrations[_0x390b('0x5a')](_0x2d7c30[_0x390b('0x4e')]['channel'],_0x2d7c30[_0x390b('0x4e')][_0x390b('0x58')]);return db[_0x390b('0x50')][_0x390b('0x4d')](_0x2d7c30[_0x390b('0x4e')],{'include':[{'model':db[_0x390b('0x5b')],'as':_0x390b('0x56')},{'model':db[_0x390b('0x5b')],'as':_0x390b('0x59')}]});}return null;})[_0x390b('0x2a')](respondWithResult(_0xae7691,null))[_0x390b('0x47')](handleError(_0xae7691,null));};var md5=require('md5');exports[_0x390b('0x5c')]=function(_0x48a7da,_0x508b65,_0x14f83e){var _0x3a0775=null;var _0x41934e=null;var _0x20e238=null;var _0x387b26=null;var _0x4de54b='';return db[_0x390b('0x30')][_0x390b('0x54')]({'where':{'id':_0x48a7da[_0x390b('0x49')]['id']},'attributes':['id','name','username',_0x390b('0x5d'),_0x390b('0x5e'),_0x390b('0x5f'),_0x390b('0x60'),_0x390b('0x61')]})[_0x390b('0x2a')](handleEntityNotFound(_0x508b65,null))['then'](function(_0x3f08a0){if(_0x3f08a0){_0x3a0775=_0x3f08a0[_0x390b('0x62')];_0x41934e=_0x3f08a0[_0x390b('0x61')];_0x20e238=_0x3f08a0[_0x390b('0x5e')];_0x4de54b=_0x3f08a0[_0x390b('0x5f')];var _0x207254=_0x4de54b['slice'](-0x1);if(_0x207254==='/'){_0x4de54b=_0x4de54b[_0x390b('0x63')](0x0,_0x4de54b[_0x390b('0x64')](_0x207254));}_0x387b26=util[_0x390b('0x65')](_0x390b('0x66'),_0x4de54b);var _0x430744={'method':'GET','uri':_0x387b26,'qs':{'operation':_0x390b('0x67'),'username':_0x3f08a0[_0x390b('0x62')]},'json':!![]};return rp(_0x430744);}})['then'](function(_0x5e881b){if(_0x5e881b[_0x390b('0x68')]){var _0x3c58e0={'method':_0x390b('0x69'),'uri':_0x387b26,'form':{'operation':_0x390b('0x6a'),'username':_0x3a0775,'accessKey':md5(_0x5e881b['result'][_0x390b('0x6b')]+_0x41934e)},'json':!![]};return rp(_0x3c58e0);}})[_0x390b('0x2a')](function(_0x481b31){if(_0x481b31[_0x390b('0x68')]){var _0x4cf7b6={'method':_0x390b('0x6c'),'uri':_0x387b26,'qs':{'operation':_0x390b('0x6d'),'username':_0x3a0775,'sessionName':_0x481b31['result'][_0x390b('0x6e')],'elementType':_0x20e238},'json':!![]};return rp(_0x4cf7b6);}})[_0x390b('0x2a')](function(_0x388272){if(_0x388272[_0x390b('0x68')]){var _0xca5ba3=['autogenerated',_0x390b('0x6f'),_0x390b('0x70')];_['remove'](_0x388272[_0x390b('0x71')]['fields'],function(_0x418b84){return _0xca5ba3[_0x390b('0x72')](_0x418b84[_0x390b('0x58')][_0x390b('0x2d')]);});_[_0x390b('0x73')](_0x388272['result']['fields'],function(_0x20e460){return _0x20e460[_0x390b('0x74')]===_0x390b('0x75');});return{'count':_0x388272['result'][_0x390b('0x39')][_0x390b('0x3a')],'rows':_[_0x390b('0x41')](_0x388272[_0x390b('0x71')][_0x390b('0x39')],function(_0x3675c5){return{'id':_0x3675c5[_0x390b('0x2d')],'name':_0x3675c5[_0x390b('0x76')],'custom':_[_0x390b('0x77')](_0x3675c5[_0x390b('0x2d')],_0x390b('0x78'))?!![]:![],'options':_0x3675c5[_0x390b('0x58')][_0x390b('0x2d')]===_0x390b('0x79')&&_0x3675c5[_0x390b('0x58')][_0x390b('0x7a')][_0x390b('0x3a')]>0x0?_[_0x390b('0x41')](_0x3675c5[_0x390b('0x58')][_0x390b('0x7a')],function(_0xff200a){return{'name':_0xff200a['label'],'value':_0xff200a[_0x390b('0x7b')]};}):[]};})};}})[_0x390b('0x2a')](respondWithResult(_0x508b65,null))[_0x390b('0x47')](function(_0x4a3e5b){console[_0x390b('0x7c')](_0x390b('0x7d')+_0x4a3e5b);var _0x12d0ea=_0x48a7da[_0x390b('0x35')]['test']?0x1f4:_0x4a3e5b[_0x390b('0x7e')]||0x1f4;logger[_0x390b('0x2c')](_0x390b('0x7f'),'getFields',_0x12d0ea,JSON[_0x390b('0x80')](_0x4a3e5b));delete _0x4a3e5b['name'];if(_0x12d0ea===0x191){_0x12d0ea=0x190;}_0x508b65[_0x390b('0x1e')](_0x12d0ea)[_0x390b('0x2e')](_0x48a7da[_0x390b('0x35')][_0x390b('0x81')]?{'message':_0x390b('0x82'),'statusCode':_0x4a3e5b[_0x390b('0x7e')]}:_0x4a3e5b);});}; \ No newline at end of file +var _0x0883=['value','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','Content-Range','save','update','then','end','name','send','index','map','VtigerAccount','rawAttributes','fieldName','type','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','filters','create','body','find','VtigerConfiguration','getConfigurations','addConfiguration','findOne','Subjects','channel','getDescriptions','Descriptions','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','substring','lastIndexOf','format','%s/webservice.php','getchallenge','POST','login','result','token','GET','describe','sessionName','success','autogenerated','reference','owner','includes','editable','false','label','startsWith','picklistValues'];(function(_0x4a8915,_0x12b7fb){var _0x1e2e44=function(_0x5c9bea){while(--_0x5c9bea){_0x4a8915['push'](_0x4a8915['shift']());}};_0x1e2e44(++_0x12b7fb);}(_0x0883,0x15e));var _0x3088=function(_0x32b30c,_0x2d5ec8){_0x32b30c=_0x32b30c-0x0;var _0xcfc212=_0x0883[_0x32b30c];return _0xcfc212;};'use strict';var emlformat=require(_0x3088('0x0'));var rimraf=require(_0x3088('0x1'));var zipdir=require(_0x3088('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3088('0x3'));var moment=require('moment');var BPromise=require(_0x3088('0x4'));var Mustache=require(_0x3088('0x5'));var util=require('util');var path=require(_0x3088('0x6'));var sox=require(_0x3088('0x7'));var csv=require(_0x3088('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3088('0x9'));var _=require('lodash');var squel=require(_0x3088('0xa'));var crypto=require(_0x3088('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3088('0xc'));var Redis=require('ioredis');var authService=require(_0x3088('0xd'));var qs=require(_0x3088('0xe'));var as=require(_0x3088('0xf'));var hardwareService=require(_0x3088('0x10'));var logger=require('../../config/logger')(_0x3088('0x11'));var utils=require(_0x3088('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x3088('0x13'));var db=require(_0x3088('0x14'))['db'];var integrations=require(_0x3088('0x15'));function respondWithStatusCode(_0x526b9e,_0x152364){_0x152364=_0x152364||0xcc;return function(_0x327d36){if(_0x327d36){return _0x526b9e[_0x3088('0x16')](_0x152364);}return _0x526b9e[_0x3088('0x17')](_0x152364)['end']();};}function respondWithResult(_0x478b67,_0x59d4c3){_0x59d4c3=_0x59d4c3||0xc8;return function(_0x4e1a6c){if(_0x4e1a6c){return _0x478b67[_0x3088('0x17')](_0x59d4c3)[_0x3088('0x18')](_0x4e1a6c);}};}function respondWithFilteredResult(_0x34597b,_0x4c00ae){return function(_0x256fac){if(_0x256fac){var _0x410113=typeof _0x4c00ae[_0x3088('0x19')]===_0x3088('0x1a')&&typeof _0x4c00ae[_0x3088('0x1b')]===_0x3088('0x1a');var _0x13ec7e=_0x256fac[_0x3088('0x1c')];var _0x5df10f=_0x410113?0x0:_0x4c00ae[_0x3088('0x19')];var _0x5b5938=_0x410113?_0x256fac[_0x3088('0x1c')]:_0x4c00ae['offset']+_0x4c00ae[_0x3088('0x1b')];var _0xe3947c;if(_0x5b5938>=_0x13ec7e){_0x5b5938=_0x13ec7e;_0xe3947c=0xc8;}else{_0xe3947c=0xce;}_0x34597b['status'](_0xe3947c);return _0x34597b['set'](_0x3088('0x1d'),_0x5df10f+'-'+_0x5b5938+'/'+_0x13ec7e)[_0x3088('0x18')](_0x256fac);}return null;};}function patchUpdates(_0x5e15dc){return function(_0x5d8574){try{jsonpatch['apply'](_0x5d8574,_0x5e15dc,!![]);}catch(_0x52db0a){return BPromise['reject'](_0x52db0a);}return _0x5d8574[_0x3088('0x1e')]();};}function saveUpdates(_0x1af531,_0xf8b6ae){return function(_0x180d14){if(_0x180d14){return _0x180d14[_0x3088('0x1f')](_0x1af531)[_0x3088('0x20')](function(_0x2b5347){return _0x2b5347;});}return null;};}function removeEntity(_0x632c06,_0x3bf914){return function(_0x253726){if(_0x253726){return _0x253726['destroy']()[_0x3088('0x20')](function(){_0x632c06[_0x3088('0x17')](0xcc)[_0x3088('0x21')]();});}};}function handleEntityNotFound(_0x4151dd,_0x2f81ff){return function(_0x1e30bc){if(!_0x1e30bc){_0x4151dd[_0x3088('0x16')](0x194);}return _0x1e30bc;};}function handleError(_0x7170a5,_0x118b22){_0x118b22=_0x118b22||0x1f4;return function(_0xe3cb01){logger['error'](_0xe3cb01['stack']);if(_0xe3cb01[_0x3088('0x22')]){delete _0xe3cb01[_0x3088('0x22')];}_0x7170a5[_0x3088('0x17')](_0x118b22)[_0x3088('0x23')](_0xe3cb01);};}exports[_0x3088('0x24')]=function(_0x486541,_0x7bf3d){var _0x304657={},_0x6194f7={},_0x4f653e={'count':0x0,'rows':[]};var _0x221333=_[_0x3088('0x25')](db[_0x3088('0x26')][_0x3088('0x27')],function(_0x13fce1){return{'name':_0x13fce1[_0x3088('0x28')],'type':_0x13fce1[_0x3088('0x29')]['key']};});_0x6194f7[_0x3088('0x2a')]=_[_0x3088('0x25')](_0x221333,_0x3088('0x22'));_0x6194f7['query']=_[_0x3088('0x2b')](_0x486541[_0x3088('0x2c')]);_0x6194f7['filters']=_[_0x3088('0x2d')](_0x6194f7['model'],_0x6194f7[_0x3088('0x2c')]);_0x304657[_0x3088('0x2e')]=_[_0x3088('0x2d')](_0x6194f7[_0x3088('0x2a')],qs[_0x3088('0x2f')](_0x486541[_0x3088('0x2c')][_0x3088('0x2f')]));_0x304657[_0x3088('0x2e')]=_0x304657[_0x3088('0x2e')][_0x3088('0x30')]?_0x304657[_0x3088('0x2e')]:_0x6194f7[_0x3088('0x2a')];if(!_0x486541[_0x3088('0x2c')][_0x3088('0x31')](_0x3088('0x32'))){_0x304657[_0x3088('0x1b')]=qs['limit'](_0x486541[_0x3088('0x2c')][_0x3088('0x1b')]);_0x304657[_0x3088('0x19')]=qs['offset'](_0x486541[_0x3088('0x2c')][_0x3088('0x19')]);}_0x304657[_0x3088('0x33')]=qs[_0x3088('0x34')](_0x486541[_0x3088('0x2c')]['sort']);_0x304657[_0x3088('0x35')]=qs['filters'](_[_0x3088('0x36')](_0x486541[_0x3088('0x2c')],_0x6194f7['filters']),_0x221333);if(_0x486541[_0x3088('0x2c')][_0x3088('0x37')]){_0x304657['where']=_[_0x3088('0x38')](_0x304657[_0x3088('0x35')],{'$or':_[_0x3088('0x25')](_0x221333,function(_0x29c829){if(_0x29c829[_0x3088('0x29')]!=='VIRTUAL'){var _0x33c3c8={};_0x33c3c8[_0x29c829[_0x3088('0x22')]]={'$like':'%'+_0x486541[_0x3088('0x2c')][_0x3088('0x37')]+'%'};return _0x33c3c8;}})});}_0x304657=_['merge']({},_0x304657,_0x486541[_0x3088('0x39')]);var _0x1cf906={'where':_0x304657['where']};return db[_0x3088('0x26')][_0x3088('0x1c')](_0x1cf906)[_0x3088('0x20')](function(_0x3fb5f8){_0x4f653e[_0x3088('0x1c')]=_0x3fb5f8;if(_0x486541[_0x3088('0x2c')][_0x3088('0x3a')]){_0x304657[_0x3088('0x3b')]=[{'all':!![]}];}return db['VtigerAccount'][_0x3088('0x3c')](_0x304657);})[_0x3088('0x20')](function(_0x531855){_0x4f653e[_0x3088('0x3d')]=_0x531855;return _0x4f653e;})[_0x3088('0x20')](respondWithFilteredResult(_0x7bf3d,_0x304657))[_0x3088('0x3e')](handleError(_0x7bf3d,null));};exports['show']=function(_0x136b65,_0x35557a){var _0x227ff4={'raw':![],'where':{'id':_0x136b65[_0x3088('0x3f')]['id']}},_0x532669={};_0x532669[_0x3088('0x2a')]=_[_0x3088('0x2b')](db[_0x3088('0x26')][_0x3088('0x27')]);_0x532669[_0x3088('0x2c')]=_[_0x3088('0x2b')](_0x136b65[_0x3088('0x2c')]);_0x532669[_0x3088('0x40')]=_[_0x3088('0x2d')](_0x532669[_0x3088('0x2a')],_0x532669[_0x3088('0x2c')]);_0x227ff4[_0x3088('0x2e')]=_[_0x3088('0x2d')](_0x532669[_0x3088('0x2a')],qs[_0x3088('0x2f')](_0x136b65[_0x3088('0x2c')]['fields']));_0x227ff4[_0x3088('0x2e')]=_0x227ff4[_0x3088('0x2e')][_0x3088('0x30')]?_0x227ff4['attributes']:_0x532669[_0x3088('0x2a')];if(_0x136b65[_0x3088('0x2c')]['includeAll']){_0x227ff4['include']=[{'all':!![]}];}_0x227ff4=_['merge']({},_0x227ff4,_0x136b65[_0x3088('0x39')]);return db[_0x3088('0x26')]['find'](_0x227ff4)[_0x3088('0x20')](handleEntityNotFound(_0x35557a,null))[_0x3088('0x20')](respondWithResult(_0x35557a,null))[_0x3088('0x3e')](handleError(_0x35557a,null));};exports[_0x3088('0x41')]=function(_0x522236,_0x33beec){return db[_0x3088('0x26')][_0x3088('0x41')](_0x522236[_0x3088('0x42')],{})[_0x3088('0x20')](respondWithResult(_0x33beec,0xc9))[_0x3088('0x3e')](handleError(_0x33beec,null));};exports[_0x3088('0x1f')]=function(_0x215e13,_0x20edc0){if(_0x215e13['body']['id']){delete _0x215e13[_0x3088('0x42')]['id'];}return db[_0x3088('0x26')][_0x3088('0x43')]({'where':{'id':_0x215e13[_0x3088('0x3f')]['id']}})[_0x3088('0x20')](handleEntityNotFound(_0x20edc0,null))['then'](saveUpdates(_0x215e13['body'],null))['then'](respondWithResult(_0x20edc0,null))[_0x3088('0x3e')](handleError(_0x20edc0,null));};exports['destroy']=function(_0x50719c,_0xb36613){return db[_0x3088('0x26')]['find']({'where':{'id':_0x50719c[_0x3088('0x3f')]['id']}})[_0x3088('0x20')](handleEntityNotFound(_0xb36613,null))['then'](removeEntity(_0xb36613,null))[_0x3088('0x3e')](handleError(_0xb36613,null));};exports['getConfigurations']=function(_0x44817f,_0x130d40,_0x3a09f5){var _0x1ecb53={};var _0x3324c7={};var _0x11eb80;var _0x48e34d;return db['VtigerAccount']['findOne']({'where':{'id':_0x44817f['params']['id']}})[_0x3088('0x20')](handleEntityNotFound(_0x130d40,null))['then'](function(_0x579f4e){if(_0x579f4e){_0x11eb80=_0x579f4e;_0x3324c7[_0x3088('0x2a')]=_[_0x3088('0x2b')](db[_0x3088('0x44')]['rawAttributes']);_0x3324c7['query']=_[_0x3088('0x2b')](_0x44817f[_0x3088('0x2c')]);_0x3324c7[_0x3088('0x40')]=_['intersection'](_0x3324c7[_0x3088('0x2a')],_0x3324c7[_0x3088('0x2c')]);_0x1ecb53[_0x3088('0x2e')]=_[_0x3088('0x2d')](_0x3324c7[_0x3088('0x2a')],qs[_0x3088('0x2f')](_0x44817f[_0x3088('0x2c')][_0x3088('0x2f')]));_0x1ecb53[_0x3088('0x2e')]=_0x1ecb53[_0x3088('0x2e')][_0x3088('0x30')]?_0x1ecb53[_0x3088('0x2e')]:_0x3324c7[_0x3088('0x2a')];_0x1ecb53[_0x3088('0x33')]=qs['sort'](_0x44817f[_0x3088('0x2c')][_0x3088('0x34')]);_0x1ecb53[_0x3088('0x35')]=qs['filters'](_[_0x3088('0x36')](_0x44817f[_0x3088('0x2c')],_0x3324c7[_0x3088('0x40')]));if(_0x44817f[_0x3088('0x2c')][_0x3088('0x37')]){_0x1ecb53[_0x3088('0x35')]=_[_0x3088('0x38')](_0x1ecb53['where'],{'$or':_[_0x3088('0x25')](_0x1ecb53[_0x3088('0x2e')],function(_0x116686){var _0x453f26={};_0x453f26[_0x116686]={'$like':'%'+_0x44817f[_0x3088('0x2c')][_0x3088('0x37')]+'%'};return _0x453f26;})});}_0x1ecb53=_[_0x3088('0x38')]({},_0x1ecb53,_0x44817f[_0x3088('0x39')]);return _0x11eb80[_0x3088('0x45')](_0x1ecb53);}})['then'](function(_0x29d1fa){if(_0x29d1fa){_0x48e34d=_0x29d1fa['length'];if(!_0x44817f['query'][_0x3088('0x31')]('nolimit')){_0x1ecb53[_0x3088('0x1b')]=qs[_0x3088('0x1b')](_0x44817f[_0x3088('0x2c')][_0x3088('0x1b')]);_0x1ecb53['offset']=qs[_0x3088('0x19')](_0x44817f[_0x3088('0x2c')][_0x3088('0x19')]);}return _0x11eb80[_0x3088('0x45')](_0x1ecb53);}})[_0x3088('0x20')](function(_0x40c179){if(_0x40c179){return _0x40c179?{'count':_0x48e34d,'rows':_0x40c179}:null;}})[_0x3088('0x20')](respondWithResult(_0x130d40,null))[_0x3088('0x3e')](handleError(_0x130d40,null));};exports[_0x3088('0x46')]=function(_0xc0e32c,_0x245327,_0x3ab047){if(_0xc0e32c[_0x3088('0x42')]['id']){delete _0xc0e32c[_0x3088('0x42')]['id'];}return db[_0x3088('0x26')][_0x3088('0x47')]({'where':{'id':_0xc0e32c['params']['id']}})[_0x3088('0x20')](handleEntityNotFound(_0x245327,null))[_0x3088('0x20')](function(_0x515f20){if(_0x515f20){_0xc0e32c[_0x3088('0x42')]['AccountId']=_0x515f20['id'];_0xc0e32c[_0x3088('0x42')][_0x3088('0x48')]=integrations['getSubjects'](_0xc0e32c[_0x3088('0x42')][_0x3088('0x49')],_0xc0e32c[_0x3088('0x42')]['type']);_0xc0e32c['body']['Descriptions']=integrations[_0x3088('0x4a')](_0xc0e32c['body']['channel'],_0xc0e32c[_0x3088('0x42')][_0x3088('0x29')]);return db[_0x3088('0x44')][_0x3088('0x41')](_0xc0e32c[_0x3088('0x42')],{'include':[{'model':db['VtigerField'],'as':'Subjects'},{'model':db['VtigerField'],'as':_0x3088('0x4b')}]});}return null;})[_0x3088('0x20')](respondWithResult(_0x245327,null))[_0x3088('0x3e')](handleError(_0x245327,null));};var md5=require('md5');exports[_0x3088('0x4c')]=function(_0x3f0790,_0x1cfc49,_0x1467a2){var _0x299ac9=null;var _0x29b934=null;var _0x1010e8=null;var _0x4e2b98=null;var _0x1ba6d7='';return db[_0x3088('0x26')]['findOne']({'where':{'id':_0x3f0790[_0x3088('0x3f')]['id']},'attributes':['id',_0x3088('0x22'),_0x3088('0x4d'),_0x3088('0x4e'),_0x3088('0x4f'),_0x3088('0x50'),_0x3088('0x51'),_0x3088('0x52')]})['then'](handleEntityNotFound(_0x1cfc49,null))[_0x3088('0x20')](function(_0x5e1292){if(_0x5e1292){_0x299ac9=_0x5e1292[_0x3088('0x4d')];_0x29b934=_0x5e1292[_0x3088('0x52')];_0x1010e8=_0x5e1292[_0x3088('0x4f')];_0x1ba6d7=_0x5e1292['remoteUri'];var _0x1102b5=_0x1ba6d7[_0x3088('0x53')](-0x1);if(_0x1102b5==='/'){_0x1ba6d7=_0x1ba6d7[_0x3088('0x54')](0x0,_0x1ba6d7[_0x3088('0x55')](_0x1102b5));}_0x4e2b98=util[_0x3088('0x56')](_0x3088('0x57'),_0x1ba6d7);var _0x5b1963={'method':'GET','uri':_0x4e2b98,'qs':{'operation':_0x3088('0x58'),'username':_0x5e1292[_0x3088('0x4d')]},'json':!![]};return rp(_0x5b1963);}})[_0x3088('0x20')](function(_0x378600){if(_0x378600['success']){var _0x5debb6={'method':_0x3088('0x59'),'uri':_0x4e2b98,'form':{'operation':_0x3088('0x5a'),'username':_0x299ac9,'accessKey':md5(_0x378600[_0x3088('0x5b')][_0x3088('0x5c')]+_0x29b934)},'json':!![]};return rp(_0x5debb6);}})[_0x3088('0x20')](function(_0x48cc38){if(_0x48cc38['success']){var _0x3ce176={'method':_0x3088('0x5d'),'uri':_0x4e2b98,'qs':{'operation':_0x3088('0x5e'),'username':_0x299ac9,'sessionName':_0x48cc38[_0x3088('0x5b')][_0x3088('0x5f')],'elementType':_0x1010e8},'json':!![]};return rp(_0x3ce176);}})[_0x3088('0x20')](function(_0x4b0280){if(_0x4b0280[_0x3088('0x60')]){var _0x34f3cd=[_0x3088('0x61'),_0x3088('0x62'),_0x3088('0x63')];_['remove'](_0x4b0280[_0x3088('0x5b')]['fields'],function(_0x18f189){return _0x34f3cd[_0x3088('0x64')](_0x18f189[_0x3088('0x29')][_0x3088('0x22')]);});_['remove'](_0x4b0280[_0x3088('0x5b')][_0x3088('0x2f')],function(_0x341c16){return _0x341c16[_0x3088('0x65')]===_0x3088('0x66');});return{'count':_0x4b0280[_0x3088('0x5b')][_0x3088('0x2f')][_0x3088('0x30')],'rows':_[_0x3088('0x25')](_0x4b0280[_0x3088('0x5b')]['fields'],function(_0x1a7d65){return{'id':_0x1a7d65['name'],'name':_0x1a7d65[_0x3088('0x67')],'custom':_[_0x3088('0x68')](_0x1a7d65[_0x3088('0x22')],'cf_')?!![]:![],'options':_0x1a7d65['type'][_0x3088('0x22')]==='picklist'&&_0x1a7d65[_0x3088('0x29')]['picklistValues']['length']>0x0?_[_0x3088('0x25')](_0x1a7d65['type'][_0x3088('0x69')],function(_0x45c069){return{'name':_0x45c069[_0x3088('0x67')],'value':_0x45c069[_0x3088('0x6a')]};}):[]};})};}})['then'](respondWithResult(_0x1cfc49,null))[_0x3088('0x3e')](function(_0x438078){console[_0x3088('0x6b')](_0x3088('0x6c')+_0x438078);var _0x5abce6=_0x3f0790[_0x3088('0x2c')][_0x3088('0x6d')]?0x1f4:_0x438078[_0x3088('0x6e')]||0x1f4;logger['error'](_0x3088('0x6f'),'getFields',_0x5abce6,JSON[_0x3088('0x70')](_0x438078));delete _0x438078[_0x3088('0x22')];if(_0x5abce6===0x191){_0x5abce6=0x190;}_0x1cfc49['status'](_0x5abce6)[_0x3088('0x23')](_0x3f0790['query'][_0x3088('0x6d')]?{'message':_0x3088('0x71'),'statusCode':_0x438078[_0x3088('0x6e')]}:_0x438078);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 81fa20a..469effd 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 _0x1147=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','define','int_vtiger_accounts','lodash','../../config/logger'];(function(_0x23c9f1,_0x237edb){var _0x324eb3=function(_0x1a0780){while(--_0x1a0780){_0x23c9f1['push'](_0x23c9f1['shift']());}};_0x324eb3(++_0x237edb);}(_0x1147,0xf5));var _0x7114=function(_0x2deb78,_0x6d86c6){_0x2deb78=_0x2deb78-0x0;var _0x54571f=_0x1147[_0x2deb78];return _0x54571f;};'use strict';var _=require(_0x7114('0x0'));var util=require('util');var logger=require(_0x7114('0x1'))(_0x7114('0x2'));var moment=require(_0x7114('0x3'));var BPromise=require(_0x7114('0x4'));var rp=require(_0x7114('0x5'));var fs=require('fs');var path=require(_0x7114('0x6'));var rimraf=require(_0x7114('0x7'));var config=require(_0x7114('0x8'));var attributes=require(_0x7114('0x9'));var integrations=require(_0x7114('0xa'));module['exports']=function(_0x16739f,_0x4bcd47){return _0x16739f[_0x7114('0xb')]('VtigerAccount',attributes,{'tableName':_0x7114('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc847=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','int_vtiger_accounts','util'];(function(_0x4b728,_0x5c4706){var _0xb6c42f=function(_0x4ad25a){while(--_0x4ad25a){_0x4b728['push'](_0x4b728['shift']());}};_0xb6c42f(++_0x5c4706);}(_0xc847,0x15b));var _0x7c84=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc847[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x7c84('0x0'));var logger=require(_0x7c84('0x1'))('api');var moment=require(_0x7c84('0x2'));var BPromise=require(_0x7c84('0x3'));var rp=require(_0x7c84('0x4'));var fs=require('fs');var path=require(_0x7c84('0x5'));var rimraf=require(_0x7c84('0x6'));var config=require(_0x7c84('0x7'));var attributes=require(_0x7c84('0x8'));var integrations=require(_0x7c84('0x9'));module[_0x7c84('0xa')]=function(_0x2ad3bd,_0x215ebe){return _0x2ad3bd['define']('VtigerAccount',attributes,{'tableName':_0x7c84('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index b4e2052..c8e371a 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 _0x7af2=['ShowVtigerAccount','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','error','message','VtigerAccount,\x20%s,\x20%s','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','where','attributes','limit','include','map','model','debug','stringify','find','raw'];(function(_0x413e00,_0x57e652){var _0x18a5de=function(_0x5d4486){while(--_0x5d4486){_0x413e00['push'](_0x413e00['shift']());}};_0x18a5de(++_0x57e652);}(_0x7af2,0x119));var _0x27af=function(_0x9f57ca,_0xede913){_0x9f57ca=_0x9f57ca-0x0;var _0x171560=_0x7af2[_0x9f57ca];return _0x171560;};'use strict';var _=require('lodash');var util=require(_0x27af('0x0'));var moment=require(_0x27af('0x1'));var BPromise=require(_0x27af('0x2'));var rs=require(_0x27af('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x27af('0x4'))['db'];var utils=require(_0x27af('0x5'));var logger=require(_0x27af('0x6'))(_0x27af('0x7'));var config=require(_0x27af('0x8'));var jayson=require(_0x27af('0x9'));var client=jayson[_0x27af('0xa')][_0x27af('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2193c6,_0x572219,_0x1e2509){return new BPromise(function(_0x366868,_0x389e97){return client['request'](_0x2193c6,_0x1e2509)[_0x27af('0xc')](function(_0xfa1882){logger[_0x27af('0xd')]('VtigerAccount,\x20%s,\x20%s',_0x572219,_0x27af('0xe'));logger['debug']('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x572219,_0x27af('0xe'),JSON['stringify'](_0xfa1882));if(_0xfa1882['error']){if(_0xfa1882[_0x27af('0xf')]['code']===0x1f4){logger[_0x27af('0xf')]('VtigerAccount,\x20%s,\x20%s',_0x572219,_0xfa1882[_0x27af('0xf')][_0x27af('0x10')]);return _0x389e97(_0xfa1882[_0x27af('0xf')][_0x27af('0x10')]);}logger[_0x27af('0xf')](_0x27af('0x11'),_0x572219,_0xfa1882[_0x27af('0xf')][_0x27af('0x10')]);return _0x366868(_0xfa1882[_0x27af('0xf')][_0x27af('0x10')]);}else{logger[_0x27af('0xd')](_0x27af('0x11'),_0x572219,_0x27af('0xe'));_0x366868(_0xfa1882[_0x27af('0x12')][_0x27af('0x10')]);}})[_0x27af('0x13')](function(_0x13f8ed){logger[_0x27af('0xf')]('VtigerAccount,\x20%s,\x20%s',_0x572219,_0x13f8ed);_0x389e97(_0x13f8ed);});});}exports[_0x27af('0x14')]=function(_0x31d702){var _0x5997ae=this;return new Promise(function(_0x4e6e2f,_0x20a6d7){return db[_0x27af('0x15')][_0x27af('0x16')]({'raw':_0x31d702[_0x27af('0x17')]?_0x31d702[_0x27af('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x31d702[_0x27af('0x17')]?_0x31d702[_0x27af('0x17')][_0x27af('0x18')]||null:null,'attributes':_0x31d702['options']?_0x31d702[_0x27af('0x17')][_0x27af('0x19')]||null:null,'limit':_0x31d702[_0x27af('0x17')]?_0x31d702['options'][_0x27af('0x1a')]||null:null,'include':_0x31d702[_0x27af('0x17')]?_0x31d702[_0x27af('0x17')][_0x27af('0x1b')]?_[_0x27af('0x1c')](_0x31d702[_0x27af('0x17')][_0x27af('0x1b')],function(_0x35b36d){return{'model':db[_0x35b36d[_0x27af('0x1d')]],'as':_0x35b36d['as'],'attributes':_0x35b36d['attributes'],'include':_0x35b36d['include']?_['map'](_0x35b36d[_0x27af('0x1b')],function(_0x4feaf1){return{'model':db[_0x4feaf1[_0x27af('0x1d')]],'as':_0x4feaf1['as'],'attributes':_0x4feaf1[_0x27af('0x19')],'include':_0x4feaf1['include']?_[_0x27af('0x1c')](_0x4feaf1[_0x27af('0x1b')],function(_0x463e36){return{'model':db[_0x463e36[_0x27af('0x1d')]],'as':_0x463e36['as'],'attributes':_0x463e36[_0x27af('0x19')]};}):[]};}):[]};}):[]:[]})[_0x27af('0xc')](function(_0x775d4e){logger['info'](_0x27af('0x14'),_0x31d702);logger[_0x27af('0x1e')](_0x27af('0x14'),_0x31d702,JSON[_0x27af('0x1f')](_0x775d4e));_0x4e6e2f(_0x775d4e);})[_0x27af('0x13')](function(_0xa08dd9){logger[_0x27af('0xf')](_0x27af('0x14'),_0xa08dd9[_0x27af('0x10')],_0x31d702);_0x20a6d7(_0x5997ae[_0x27af('0xf')](0x1f4,_0xa08dd9[_0x27af('0x10')]));});});};exports['ShowVtigerAccount']=function(_0x15e867){var _0x14b2e7=this;return new Promise(function(_0x3800a1,_0x575887){return db[_0x27af('0x15')][_0x27af('0x20')]({'raw':_0x15e867['options']?_0x15e867['options'][_0x27af('0x21')]===undefined?!![]:![]:!![],'where':_0x15e867[_0x27af('0x17')]?_0x15e867['options'][_0x27af('0x18')]||null:null,'attributes':_0x15e867[_0x27af('0x17')]?_0x15e867[_0x27af('0x17')][_0x27af('0x19')]||null:null,'include':_0x15e867[_0x27af('0x17')]?_0x15e867[_0x27af('0x17')][_0x27af('0x1b')]?_[_0x27af('0x1c')](_0x15e867[_0x27af('0x17')][_0x27af('0x1b')],function(_0x13c97d){return{'model':db[_0x13c97d['model']],'as':_0x13c97d['as'],'attributes':_0x13c97d['attributes'],'include':_0x13c97d[_0x27af('0x1b')]?_[_0x27af('0x1c')](_0x13c97d['include'],function(_0x2dd799){return{'model':db[_0x2dd799[_0x27af('0x1d')]],'as':_0x2dd799['as'],'attributes':_0x2dd799['attributes'],'include':_0x2dd799[_0x27af('0x1b')]?_[_0x27af('0x1c')](_0x2dd799[_0x27af('0x1b')],function(_0x329d06){return{'model':db[_0x329d06[_0x27af('0x1d')]],'as':_0x329d06['as'],'attributes':_0x329d06['attributes']};}):[]};}):[]};}):[]:[]})[_0x27af('0xc')](function(_0x468cea){logger['info']('ShowVtigerAccount',_0x15e867);logger[_0x27af('0x1e')](_0x27af('0x22'),_0x15e867,JSON[_0x27af('0x1f')](_0x468cea));_0x3800a1(_0x468cea);})[_0x27af('0x13')](function(_0x467891){logger[_0x27af('0xf')]('ShowVtigerAccount',_0x467891[_0x27af('0x10')],_0x15e867);_0x575887(_0x14b2e7['error'](0x1f4,_0x467891[_0x27af('0x10')]));});});}; \ No newline at end of file +var _0xb574=['where','attributes','include','map','model','ShowVtigerAccount','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw'];(function(_0x5413f5,_0x3154c7){var _0x639288=function(_0x4b85e9){while(--_0x4b85e9){_0x5413f5['push'](_0x5413f5['shift']());}};_0x639288(++_0x3154c7);}(_0xb574,0x106));var _0x4b57=function(_0x4778ae,_0x28c4cf){_0x4778ae=_0x4778ae-0x0;var _0x13078a=_0xb574[_0x4778ae];return _0x13078a;};'use strict';var _=require(_0x4b57('0x0'));var util=require(_0x4b57('0x1'));var moment=require('moment');var BPromise=require(_0x4b57('0x2'));var rs=require(_0x4b57('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4b57('0x4'))['db'];var utils=require(_0x4b57('0x5'));var logger=require(_0x4b57('0x6'))(_0x4b57('0x7'));var config=require(_0x4b57('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4b57('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a4a0f,_0x585d86,_0x4b2d65){return new BPromise(function(_0x548ee8,_0x291e54){return client[_0x4b57('0xa')](_0x4a4a0f,_0x4b2d65)[_0x4b57('0xb')](function(_0x3b112d){logger[_0x4b57('0xc')](_0x4b57('0xd'),_0x585d86,_0x4b57('0xe'));logger[_0x4b57('0xf')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x585d86,_0x4b57('0xe'),JSON[_0x4b57('0x10')](_0x3b112d));if(_0x3b112d[_0x4b57('0x11')]){if(_0x3b112d['error']['code']===0x1f4){logger[_0x4b57('0x11')](_0x4b57('0xd'),_0x585d86,_0x3b112d[_0x4b57('0x11')][_0x4b57('0x12')]);return _0x291e54(_0x3b112d[_0x4b57('0x11')][_0x4b57('0x12')]);}logger[_0x4b57('0x11')](_0x4b57('0xd'),_0x585d86,_0x3b112d[_0x4b57('0x11')]['message']);return _0x548ee8(_0x3b112d['error'][_0x4b57('0x12')]);}else{logger[_0x4b57('0xc')](_0x4b57('0xd'),_0x585d86,'request\x20sent');_0x548ee8(_0x3b112d[_0x4b57('0x13')]['message']);}})[_0x4b57('0x14')](function(_0x42aff4){logger[_0x4b57('0x11')](_0x4b57('0xd'),_0x585d86,_0x42aff4);_0x291e54(_0x42aff4);});});}exports[_0x4b57('0x15')]=function(_0xfb71cc){var _0x4ede42=this;return new Promise(function(_0x1b35ff,_0x1a0b72){return db[_0x4b57('0x16')][_0x4b57('0x17')]({'raw':_0xfb71cc['options']?_0xfb71cc[_0x4b57('0x18')][_0x4b57('0x19')]===undefined?!![]:![]:!![],'where':_0xfb71cc[_0x4b57('0x18')]?_0xfb71cc[_0x4b57('0x18')][_0x4b57('0x1a')]||null:null,'attributes':_0xfb71cc[_0x4b57('0x18')]?_0xfb71cc['options'][_0x4b57('0x1b')]||null:null,'limit':_0xfb71cc[_0x4b57('0x18')]?_0xfb71cc[_0x4b57('0x18')]['limit']||null:null,'include':_0xfb71cc[_0x4b57('0x18')]?_0xfb71cc[_0x4b57('0x18')][_0x4b57('0x1c')]?_[_0x4b57('0x1d')](_0xfb71cc['options'][_0x4b57('0x1c')],function(_0x368c5f){return{'model':db[_0x368c5f['model']],'as':_0x368c5f['as'],'attributes':_0x368c5f[_0x4b57('0x1b')],'include':_0x368c5f[_0x4b57('0x1c')]?_[_0x4b57('0x1d')](_0x368c5f[_0x4b57('0x1c')],function(_0x540eff){return{'model':db[_0x540eff[_0x4b57('0x1e')]],'as':_0x540eff['as'],'attributes':_0x540eff['attributes'],'include':_0x540eff[_0x4b57('0x1c')]?_['map'](_0x540eff[_0x4b57('0x1c')],function(_0x2dc9d8){return{'model':db[_0x2dc9d8[_0x4b57('0x1e')]],'as':_0x2dc9d8['as'],'attributes':_0x2dc9d8[_0x4b57('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4b57('0xb')](function(_0x392e37){logger['info']('GetVtigerAccount',_0xfb71cc);logger[_0x4b57('0xf')]('GetVtigerAccount',_0xfb71cc,JSON[_0x4b57('0x10')](_0x392e37));_0x1b35ff(_0x392e37);})[_0x4b57('0x14')](function(_0x874cf7){logger[_0x4b57('0x11')](_0x4b57('0x15'),_0x874cf7[_0x4b57('0x12')],_0xfb71cc);_0x1a0b72(_0x4ede42['error'](0x1f4,_0x874cf7[_0x4b57('0x12')]));});});};exports[_0x4b57('0x1f')]=function(_0x68be27){var _0x3cd331=this;return new Promise(function(_0x4ccf89,_0xa91ba){return db[_0x4b57('0x16')]['find']({'raw':_0x68be27[_0x4b57('0x18')]?_0x68be27[_0x4b57('0x18')][_0x4b57('0x19')]===undefined?!![]:![]:!![],'where':_0x68be27[_0x4b57('0x18')]?_0x68be27['options']['where']||null:null,'attributes':_0x68be27['options']?_0x68be27[_0x4b57('0x18')][_0x4b57('0x1b')]||null:null,'include':_0x68be27[_0x4b57('0x18')]?_0x68be27[_0x4b57('0x18')][_0x4b57('0x1c')]?_['map'](_0x68be27[_0x4b57('0x18')][_0x4b57('0x1c')],function(_0x1fd3f7){return{'model':db[_0x1fd3f7['model']],'as':_0x1fd3f7['as'],'attributes':_0x1fd3f7[_0x4b57('0x1b')],'include':_0x1fd3f7[_0x4b57('0x1c')]?_[_0x4b57('0x1d')](_0x1fd3f7['include'],function(_0x28a0ee){return{'model':db[_0x28a0ee[_0x4b57('0x1e')]],'as':_0x28a0ee['as'],'attributes':_0x28a0ee['attributes'],'include':_0x28a0ee[_0x4b57('0x1c')]?_[_0x4b57('0x1d')](_0x28a0ee[_0x4b57('0x1c')],function(_0x91f32e){return{'model':db[_0x91f32e[_0x4b57('0x1e')]],'as':_0x91f32e['as'],'attributes':_0x91f32e[_0x4b57('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f9f76){logger[_0x4b57('0xc')](_0x4b57('0x1f'),_0x68be27);logger[_0x4b57('0xf')](_0x4b57('0x1f'),_0x68be27,JSON[_0x4b57('0x10')](_0x1f9f76));_0x4ccf89(_0x1f9f76);})[_0x4b57('0x14')](function(_0x4c5b82){logger['error'](_0x4b57('0x1f'),_0x4c5b82[_0x4b57('0x12')],_0x68be27);_0xa91ba(_0x3cd331[_0x4b57('0x11')](0x1f4,_0x4c5b82['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index a21b5da..599a54a 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 _0xb6d8=['/:id/subjects','getSubjects','post','create','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','/:id','show'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb6d8,0x12e));var _0x8b6d=function(_0xd0bd8d,_0x456b6c){_0xd0bd8d=_0xd0bd8d-0x0;var _0xa29ff9=_0xb6d8[_0xd0bd8d];return _0xa29ff9;};'use strict';var multer=require(_0x8b6d('0x0'));var util=require('util');var path=require(_0x8b6d('0x1'));var timeout=require(_0x8b6d('0x2'));var express=require('express');var router=express[_0x8b6d('0x3')]();var fs_extra=require(_0x8b6d('0x4'));var auth=require(_0x8b6d('0x5'));var interaction=require(_0x8b6d('0x6'));var config=require(_0x8b6d('0x7'));var controller=require(_0x8b6d('0x8'));router[_0x8b6d('0x9')]('/',auth[_0x8b6d('0xa')](),controller['index']);router['get'](_0x8b6d('0xb'),auth[_0x8b6d('0xa')](),controller[_0x8b6d('0xc')]);router[_0x8b6d('0x9')]('/:id/fields',auth[_0x8b6d('0xa')](),controller['getFields']);router[_0x8b6d('0x9')](_0x8b6d('0xd'),auth['isAuthenticated'](),controller[_0x8b6d('0xe')]);router['get']('/:id/descriptions',auth[_0x8b6d('0xa')](),controller['getDescriptions']);router[_0x8b6d('0xf')]('/',auth[_0x8b6d('0xa')](),controller[_0x8b6d('0x10')]);router['put']('/:id',auth[_0x8b6d('0xa')](),controller[_0x8b6d('0x11')]);router[_0x8b6d('0x12')](_0x8b6d('0xb'),auth[_0x8b6d('0xa')](),controller[_0x8b6d('0x13')]);module[_0x8b6d('0x14')]=router; \ No newline at end of file +var _0xb772=['put','update','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','/:id','show','isAuthenticated','/:id/subjects','/:id/descriptions','create'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0xb772,0xfb));var _0x2b77=function(_0x1485ec,_0x4f5d8c){_0x1485ec=_0x1485ec-0x0;var _0x423000=_0xb772[_0x1485ec];return _0x423000;};'use strict';var multer=require(_0x2b77('0x0'));var util=require('util');var path=require(_0x2b77('0x1'));var timeout=require(_0x2b77('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2b77('0x3'));var auth=require(_0x2b77('0x4'));var interaction=require(_0x2b77('0x5'));var config=require(_0x2b77('0x6'));var controller=require(_0x2b77('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x2b77('0x8')](_0x2b77('0x9'),auth['isAuthenticated'](),controller[_0x2b77('0xa')]);router[_0x2b77('0x8')]('/:id/fields',auth[_0x2b77('0xb')](),controller['getFields']);router[_0x2b77('0x8')](_0x2b77('0xc'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x2b77('0x8')](_0x2b77('0xd'),auth[_0x2b77('0xb')](),controller['getDescriptions']);router['post']('/',auth[_0x2b77('0xb')](),controller[_0x2b77('0xe')]);router[_0x2b77('0xf')](_0x2b77('0x9'),auth['isAuthenticated'](),controller[_0x2b77('0x10')]);router['delete'](_0x2b77('0x9'),auth['isAuthenticated'](),controller[_0x2b77('0x11')]);module[_0x2b77('0x12')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 4044130..db89e41 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 _0x1744=['STRING','exports'];(function(_0x256058,_0x91c7c5){var _0x415921=function(_0x34b1){while(--_0x34b1){_0x256058['push'](_0x256058['shift']());}};_0x415921(++_0x91c7c5);}(_0x1744,0x83));var _0x4174=function(_0x13b5e3,_0x5525b1){_0x13b5e3=_0x13b5e3-0x0;var _0x134c86=_0x1744[_0x13b5e3];return _0x134c86;};'use strict';var Sequelize=require('sequelize');module[_0x4174('0x0')]={'name':{'type':Sequelize[_0x4174('0x1')]},'description':{'type':Sequelize[_0x4174('0x1')]}}; \ No newline at end of file +var _0x308d=['sequelize','exports','STRING'];(function(_0x5c2502,_0x2c66a){var _0x3c2bf1=function(_0x5be190){while(--_0x5be190){_0x5c2502['push'](_0x5c2502['shift']());}};_0x3c2bf1(++_0x2c66a);}(_0x308d,0x84));var _0xd308=function(_0x111794,_0x3e9bdc){_0x111794=_0x111794-0x0;var _0x55114b=_0x308d[_0x111794];return _0x55114b;};'use strict';var Sequelize=require(_0xd308('0x0'));module[_0xd308('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd308('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index a5f196d..915c5e7 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 _0x1da6=['index','map','VtigerConfiguration','rawAttributes','type','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','length','include','create','body','find','getFields','VtigerField','getSubjects','findOne','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','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send'];(function(_0x4c1d76,_0x4c0c07){var _0xaffa0f=function(_0x4d8417){while(--_0x4d8417){_0x4c1d76['push'](_0x4c1d76['shift']());}};_0xaffa0f(++_0x4c0c07);}(_0x1da6,0x7c));var _0x61da=function(_0x357a01,_0x1e57d0){_0x357a01=_0x357a01-0x0;var _0x252c1f=_0x1da6[_0x357a01];return _0x252c1f;};'use strict';var emlformat=require(_0x61da('0x0'));var rimraf=require(_0x61da('0x1'));var zipdir=require(_0x61da('0x2'));var jsonpatch=require(_0x61da('0x3'));var rp=require(_0x61da('0x4'));var moment=require(_0x61da('0x5'));var BPromise=require(_0x61da('0x6'));var Mustache=require(_0x61da('0x7'));var util=require(_0x61da('0x8'));var path=require(_0x61da('0x9'));var sox=require(_0x61da('0xa'));var csv=require(_0x61da('0xb'));var ejs=require(_0x61da('0xc'));var fs=require('fs');var fs_extra=require(_0x61da('0xd'));var _=require(_0x61da('0xe'));var squel=require(_0x61da('0xf'));var crypto=require(_0x61da('0x10'));var jsforce=require(_0x61da('0x11'));var deskjs=require(_0x61da('0x12'));var toCsv=require(_0x61da('0xb'));var querystring=require('querystring');var Papa=require(_0x61da('0x13'));var Redis=require(_0x61da('0x14'));var authService=require(_0x61da('0x15'));var qs=require(_0x61da('0x16'));var as=require(_0x61da('0x17'));var hardwareService=require(_0x61da('0x18'));var logger=require(_0x61da('0x19'))(_0x61da('0x1a'));var utils=require(_0x61da('0x1b'));var config=require(_0x61da('0x1c'));var licenseUtil=require(_0x61da('0x1d'));var db=require(_0x61da('0x1e'))['db'];function respondWithStatusCode(_0x1eb368,_0x1036e4){_0x1036e4=_0x1036e4||0xcc;return function(_0x43ec70){if(_0x43ec70){return _0x1eb368['sendStatus'](_0x1036e4);}return _0x1eb368[_0x61da('0x1f')](_0x1036e4)[_0x61da('0x20')]();};}function respondWithResult(_0x191033,_0x472abc){_0x472abc=_0x472abc||0xc8;return function(_0x55eef1){if(_0x55eef1){return _0x191033[_0x61da('0x1f')](_0x472abc)['json'](_0x55eef1);}};}function respondWithFilteredResult(_0x21a5fc,_0x6d24b7){return function(_0x4a0aea){if(_0x4a0aea){var _0x53f3a4=typeof _0x6d24b7[_0x61da('0x21')]===_0x61da('0x22')&&typeof _0x6d24b7[_0x61da('0x23')]===_0x61da('0x22');var _0x2ac3aa=_0x4a0aea[_0x61da('0x24')];var _0x505b1c=_0x53f3a4?0x0:_0x6d24b7[_0x61da('0x21')];var _0x34a678=_0x53f3a4?_0x4a0aea[_0x61da('0x24')]:_0x6d24b7[_0x61da('0x21')]+_0x6d24b7['limit'];var _0x1a0e6e;if(_0x34a678>=_0x2ac3aa){_0x34a678=_0x2ac3aa;_0x1a0e6e=0xc8;}else{_0x1a0e6e=0xce;}_0x21a5fc[_0x61da('0x1f')](_0x1a0e6e);return _0x21a5fc[_0x61da('0x25')](_0x61da('0x26'),_0x505b1c+'-'+_0x34a678+'/'+_0x2ac3aa)['json'](_0x4a0aea);}return null;};}function patchUpdates(_0x22b8bc){return function(_0x5c0363){try{jsonpatch[_0x61da('0x27')](_0x5c0363,_0x22b8bc,!![]);}catch(_0x172066){return BPromise[_0x61da('0x28')](_0x172066);}return _0x5c0363[_0x61da('0x29')]();};}function saveUpdates(_0x1868af,_0x129bb0){return function(_0x30c6f8){if(_0x30c6f8){return _0x30c6f8[_0x61da('0x2a')](_0x1868af)[_0x61da('0x2b')](function(_0x325e28){return _0x325e28;});}return null;};}function removeEntity(_0x56f5d2,_0x2c9e83){return function(_0x35550a){if(_0x35550a){return _0x35550a[_0x61da('0x2c')]()[_0x61da('0x2b')](function(){_0x56f5d2[_0x61da('0x1f')](0xcc)[_0x61da('0x20')]();});}};}function handleEntityNotFound(_0x4860d4,_0x2c5d97){return function(_0xe37079){if(!_0xe37079){_0x4860d4[_0x61da('0x2d')](0x194);}return _0xe37079;};}function handleError(_0x100ba1,_0x351241){_0x351241=_0x351241||0x1f4;return function(_0x262e32){logger[_0x61da('0x2e')](_0x262e32[_0x61da('0x2f')]);if(_0x262e32['name']){delete _0x262e32[_0x61da('0x30')];}_0x100ba1[_0x61da('0x1f')](_0x351241)[_0x61da('0x31')](_0x262e32);};}exports[_0x61da('0x32')]=function(_0x52f486,_0x275aa6){var _0x591efe={},_0x2c9a1d={},_0x2cc862={'count':0x0,'rows':[]};var _0x3a31a2=_[_0x61da('0x33')](db[_0x61da('0x34')][_0x61da('0x35')],function(_0xb97400){return{'name':_0xb97400['fieldName'],'type':_0xb97400[_0x61da('0x36')]['key']};});_0x2c9a1d['model']=_[_0x61da('0x33')](_0x3a31a2,_0x61da('0x30'));_0x2c9a1d[_0x61da('0x37')]=_[_0x61da('0x38')](_0x52f486[_0x61da('0x37')]);_0x2c9a1d['filters']=_[_0x61da('0x39')](_0x2c9a1d[_0x61da('0x3a')],_0x2c9a1d[_0x61da('0x37')]);_0x591efe[_0x61da('0x3b')]=_['intersection'](_0x2c9a1d[_0x61da('0x3a')],qs[_0x61da('0x3c')](_0x52f486['query'][_0x61da('0x3c')]));_0x591efe['attributes']=_0x591efe['attributes']['length']?_0x591efe['attributes']:_0x2c9a1d['model'];if(!_0x52f486[_0x61da('0x37')][_0x61da('0x3d')](_0x61da('0x3e'))){_0x591efe[_0x61da('0x23')]=qs[_0x61da('0x23')](_0x52f486['query'][_0x61da('0x23')]);_0x591efe[_0x61da('0x21')]=qs[_0x61da('0x21')](_0x52f486['query'][_0x61da('0x21')]);}_0x591efe[_0x61da('0x3f')]=qs[_0x61da('0x40')](_0x52f486['query'][_0x61da('0x40')]);_0x591efe[_0x61da('0x41')]=qs[_0x61da('0x42')](_[_0x61da('0x43')](_0x52f486[_0x61da('0x37')],_0x2c9a1d['filters']),_0x3a31a2);if(_0x52f486[_0x61da('0x37')][_0x61da('0x44')]){_0x591efe[_0x61da('0x41')]=_[_0x61da('0x45')](_0x591efe[_0x61da('0x41')],{'$or':_['map'](_0x3a31a2,function(_0x4e6512){if(_0x4e6512['type']!==_0x61da('0x46')){var _0x278732={};_0x278732[_0x4e6512[_0x61da('0x30')]]={'$like':'%'+_0x52f486[_0x61da('0x37')][_0x61da('0x44')]+'%'};return _0x278732;}})});}_0x591efe=_[_0x61da('0x45')]({},_0x591efe,_0x52f486[_0x61da('0x47')]);var _0x522aeb={'where':_0x591efe[_0x61da('0x41')]};return db[_0x61da('0x34')]['count'](_0x522aeb)[_0x61da('0x2b')](function(_0x1a430f){_0x2cc862[_0x61da('0x24')]=_0x1a430f;if(_0x52f486['query'][_0x61da('0x48')]){_0x591efe['include']=[{'all':!![]}];}return db[_0x61da('0x34')][_0x61da('0x49')](_0x591efe);})[_0x61da('0x2b')](function(_0x40d4a2){_0x2cc862['rows']=_0x40d4a2;return _0x2cc862;})[_0x61da('0x2b')](respondWithFilteredResult(_0x275aa6,_0x591efe))[_0x61da('0x4a')](handleError(_0x275aa6,null));};exports[_0x61da('0x4b')]=function(_0x47e1a5,_0x18e2da){var _0x36d744={'raw':![],'where':{'id':_0x47e1a5[_0x61da('0x4c')]['id']}},_0x1dd879={};_0x1dd879[_0x61da('0x3a')]=_[_0x61da('0x38')](db['VtigerConfiguration'][_0x61da('0x35')]);_0x1dd879[_0x61da('0x37')]=_[_0x61da('0x38')](_0x47e1a5[_0x61da('0x37')]);_0x1dd879[_0x61da('0x42')]=_[_0x61da('0x39')](_0x1dd879[_0x61da('0x3a')],_0x1dd879[_0x61da('0x37')]);_0x36d744['attributes']=_['intersection'](_0x1dd879[_0x61da('0x3a')],qs[_0x61da('0x3c')](_0x47e1a5[_0x61da('0x37')][_0x61da('0x3c')]));_0x36d744[_0x61da('0x3b')]=_0x36d744['attributes'][_0x61da('0x4d')]?_0x36d744[_0x61da('0x3b')]:_0x1dd879[_0x61da('0x3a')];if(_0x47e1a5[_0x61da('0x37')][_0x61da('0x48')]){_0x36d744[_0x61da('0x4e')]=[{'all':!![]}];}_0x36d744=_[_0x61da('0x45')]({},_0x36d744,_0x47e1a5[_0x61da('0x47')]);return db[_0x61da('0x34')]['find'](_0x36d744)[_0x61da('0x2b')](handleEntityNotFound(_0x18e2da,null))[_0x61da('0x2b')](respondWithResult(_0x18e2da,null))[_0x61da('0x4a')](handleError(_0x18e2da,null));};exports[_0x61da('0x4f')]=function(_0x5bf90a,_0x1b5ebf){return db[_0x61da('0x34')][_0x61da('0x4f')](_0x5bf90a[_0x61da('0x50')],{})[_0x61da('0x2b')](respondWithResult(_0x1b5ebf,0xc9))['catch'](handleError(_0x1b5ebf,null));};exports[_0x61da('0x2a')]=function(_0x5b3dee,_0x584ddd){if(_0x5b3dee[_0x61da('0x50')]['id']){delete _0x5b3dee[_0x61da('0x50')]['id'];}return db['VtigerConfiguration'][_0x61da('0x51')]({'where':{'id':_0x5b3dee[_0x61da('0x4c')]['id']}})[_0x61da('0x2b')](handleEntityNotFound(_0x584ddd,null))['then'](saveUpdates(_0x5b3dee[_0x61da('0x50')],null))[_0x61da('0x2b')](respondWithResult(_0x584ddd,null))[_0x61da('0x4a')](handleError(_0x584ddd,null));};exports[_0x61da('0x2c')]=function(_0x4dd6fb,_0x19ec8a){return db['VtigerConfiguration'][_0x61da('0x51')]({'where':{'id':_0x4dd6fb['params']['id']}})[_0x61da('0x2b')](handleEntityNotFound(_0x19ec8a,null))[_0x61da('0x2b')](removeEntity(_0x19ec8a,null))[_0x61da('0x4a')](handleError(_0x19ec8a,null));};exports[_0x61da('0x52')]=function(_0x47b335,_0xc5c8a6,_0x31d838){var _0xd2c919={};var _0x450807={};var _0x5f9ec9;var _0x3b52bd;return db[_0x61da('0x34')]['findOne']({'where':{'id':_0x47b335['params']['id']}})['then'](handleEntityNotFound(_0xc5c8a6,null))[_0x61da('0x2b')](function(_0x23954f){if(_0x23954f){_0x5f9ec9=_0x23954f;_0x450807[_0x61da('0x3a')]=_['keys'](db[_0x61da('0x53')][_0x61da('0x35')]);_0x450807[_0x61da('0x37')]=_[_0x61da('0x38')](_0x47b335[_0x61da('0x37')]);_0x450807[_0x61da('0x42')]=_[_0x61da('0x39')](_0x450807['model'],_0x450807['query']);_0xd2c919[_0x61da('0x3b')]=_[_0x61da('0x39')](_0x450807[_0x61da('0x3a')],qs[_0x61da('0x3c')](_0x47b335[_0x61da('0x37')][_0x61da('0x3c')]));_0xd2c919[_0x61da('0x3b')]=_0xd2c919[_0x61da('0x3b')][_0x61da('0x4d')]?_0xd2c919[_0x61da('0x3b')]:_0x450807[_0x61da('0x3a')];_0xd2c919['order']=qs[_0x61da('0x40')](_0x47b335[_0x61da('0x37')]['sort']);_0xd2c919[_0x61da('0x41')]=qs[_0x61da('0x42')](_[_0x61da('0x43')](_0x47b335['query'],_0x450807[_0x61da('0x42')]));if(_0x47b335[_0x61da('0x37')]['filter']){_0xd2c919[_0x61da('0x41')]=_[_0x61da('0x45')](_0xd2c919[_0x61da('0x41')],{'$or':_[_0x61da('0x33')](_0xd2c919[_0x61da('0x3b')],function(_0x10a013){var _0x124988={};_0x124988[_0x10a013]={'$like':'%'+_0x47b335[_0x61da('0x37')][_0x61da('0x44')]+'%'};return _0x124988;})});}_0xd2c919=_['merge']({},_0xd2c919,_0x47b335['options']);return _0x5f9ec9[_0x61da('0x52')](_0xd2c919);}})['then'](function(_0x18df91){if(_0x18df91){_0x3b52bd=_0x18df91[_0x61da('0x4d')];if(!_0x47b335[_0x61da('0x37')]['hasOwnProperty']('nolimit')){_0xd2c919[_0x61da('0x23')]=qs[_0x61da('0x23')](_0x47b335['query'][_0x61da('0x23')]);_0xd2c919[_0x61da('0x21')]=qs[_0x61da('0x21')](_0x47b335[_0x61da('0x37')][_0x61da('0x21')]);}return _0x5f9ec9[_0x61da('0x52')](_0xd2c919);}})[_0x61da('0x2b')](function(_0x11370f){if(_0x11370f){return _0x11370f?{'count':_0x3b52bd,'rows':_0x11370f}:null;}})[_0x61da('0x2b')](respondWithResult(_0xc5c8a6,null))[_0x61da('0x4a')](handleError(_0xc5c8a6,null));};exports[_0x61da('0x54')]=function(_0x55511a,_0x3e8d1b,_0x4b03eb){var _0x182865={};var _0xcfa33={};var _0x3e4973;var _0x367f7b;return db[_0x61da('0x34')][_0x61da('0x55')]({'where':{'id':_0x55511a[_0x61da('0x4c')]['id']}})[_0x61da('0x2b')](handleEntityNotFound(_0x3e8d1b,null))[_0x61da('0x2b')](function(_0x3a80b9){if(_0x3a80b9){_0x3e4973=_0x3a80b9;_0xcfa33[_0x61da('0x3a')]=_[_0x61da('0x38')](db[_0x61da('0x53')]['rawAttributes']);_0xcfa33['query']=_[_0x61da('0x38')](_0x55511a[_0x61da('0x37')]);_0xcfa33[_0x61da('0x42')]=_[_0x61da('0x39')](_0xcfa33[_0x61da('0x3a')],_0xcfa33[_0x61da('0x37')]);_0x182865['attributes']=_['intersection'](_0xcfa33[_0x61da('0x3a')],qs[_0x61da('0x3c')](_0x55511a[_0x61da('0x37')][_0x61da('0x3c')]));_0x182865['attributes']=_0x182865[_0x61da('0x3b')]['length']?_0x182865[_0x61da('0x3b')]:_0xcfa33['model'];_0x182865['order']=qs[_0x61da('0x40')](_0x55511a['query'][_0x61da('0x40')]);_0x182865['where']=qs[_0x61da('0x42')](_['pick'](_0x55511a['query'],_0xcfa33['filters']));if(_0x55511a[_0x61da('0x37')][_0x61da('0x44')]){_0x182865['where']=_[_0x61da('0x45')](_0x182865[_0x61da('0x41')],{'$or':_[_0x61da('0x33')](_0x182865[_0x61da('0x3b')],function(_0x5ef8a3){var _0x464869={};_0x464869[_0x5ef8a3]={'$like':'%'+_0x55511a[_0x61da('0x37')][_0x61da('0x44')]+'%'};return _0x464869;})});}_0x182865=_['merge']({},_0x182865,_0x55511a[_0x61da('0x47')]);return _0x3e4973[_0x61da('0x54')](_0x182865);}})['then'](function(_0xd3f5a9){if(_0xd3f5a9){_0x367f7b=_0xd3f5a9[_0x61da('0x4d')];if(!_0x55511a['query'][_0x61da('0x3d')](_0x61da('0x3e'))){_0x182865['limit']=qs[_0x61da('0x23')](_0x55511a[_0x61da('0x37')][_0x61da('0x23')]);_0x182865[_0x61da('0x21')]=qs['offset'](_0x55511a[_0x61da('0x37')][_0x61da('0x21')]);}return _0x3e4973['getSubjects'](_0x182865);}})[_0x61da('0x2b')](function(_0x28aa6a){if(_0x28aa6a){return _0x28aa6a?{'count':_0x367f7b,'rows':_0x28aa6a}:null;}})[_0x61da('0x2b')](respondWithResult(_0x3e8d1b,null))['catch'](handleError(_0x3e8d1b,null));};exports[_0x61da('0x56')]=function(_0x51bd22,_0x2c1195,_0x411e01){var _0x33df20={};var _0x5c73ff={};var _0x39c25d;var _0x2f057e;return db[_0x61da('0x34')][_0x61da('0x55')]({'where':{'id':_0x51bd22[_0x61da('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2c1195,null))[_0x61da('0x2b')](function(_0x49e77c){if(_0x49e77c){_0x39c25d=_0x49e77c;_0x5c73ff['model']=_[_0x61da('0x38')](db[_0x61da('0x53')][_0x61da('0x35')]);_0x5c73ff['query']=_['keys'](_0x51bd22[_0x61da('0x37')]);_0x5c73ff[_0x61da('0x42')]=_[_0x61da('0x39')](_0x5c73ff['model'],_0x5c73ff[_0x61da('0x37')]);_0x33df20[_0x61da('0x3b')]=_[_0x61da('0x39')](_0x5c73ff['model'],qs[_0x61da('0x3c')](_0x51bd22[_0x61da('0x37')][_0x61da('0x3c')]));_0x33df20[_0x61da('0x3b')]=_0x33df20[_0x61da('0x3b')]['length']?_0x33df20['attributes']:_0x5c73ff[_0x61da('0x3a')];_0x33df20[_0x61da('0x3f')]=qs[_0x61da('0x40')](_0x51bd22[_0x61da('0x37')][_0x61da('0x40')]);_0x33df20[_0x61da('0x41')]=qs[_0x61da('0x42')](_[_0x61da('0x43')](_0x51bd22[_0x61da('0x37')],_0x5c73ff[_0x61da('0x42')]));if(_0x51bd22[_0x61da('0x37')][_0x61da('0x44')]){_0x33df20[_0x61da('0x41')]=_[_0x61da('0x45')](_0x33df20[_0x61da('0x41')],{'$or':_[_0x61da('0x33')](_0x33df20[_0x61da('0x3b')],function(_0x3adbb4){var _0xc85dea={};_0xc85dea[_0x3adbb4]={'$like':'%'+_0x51bd22['query'][_0x61da('0x44')]+'%'};return _0xc85dea;})});}_0x33df20=_[_0x61da('0x45')]({},_0x33df20,_0x51bd22['options']);return _0x39c25d[_0x61da('0x56')](_0x33df20);}})[_0x61da('0x2b')](function(_0x47a517){if(_0x47a517){_0x2f057e=_0x47a517[_0x61da('0x4d')];if(!_0x51bd22[_0x61da('0x37')][_0x61da('0x3d')](_0x61da('0x3e'))){_0x33df20[_0x61da('0x23')]=qs['limit'](_0x51bd22['query']['limit']);_0x33df20[_0x61da('0x21')]=qs[_0x61da('0x21')](_0x51bd22['query'][_0x61da('0x21')]);}return _0x39c25d['getDescriptions'](_0x33df20);}})[_0x61da('0x2b')](function(_0x4dbb2a){if(_0x4dbb2a){return _0x4dbb2a?{'count':_0x2f057e,'rows':_0x4dbb2a}:null;}})[_0x61da('0x2b')](respondWithResult(_0x2c1195,null))['catch'](handleError(_0x2c1195,null));}; \ No newline at end of file +var _0x59a0=['path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','save','then','name','index','map','VtigerConfiguration','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','update','pick','getFields','findOne','VtigerField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x59a0,0x184));var _0x059a=function(_0x2d2073,_0x2401d5){_0x2d2073=_0x2d2073-0x0;var _0x272aaa=_0x59a0[_0x2d2073];return _0x272aaa;};'use strict';var emlformat=require(_0x059a('0x0'));var rimraf=require(_0x059a('0x1'));var zipdir=require(_0x059a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x059a('0x3'));var moment=require(_0x059a('0x4'));var BPromise=require(_0x059a('0x5'));var Mustache=require(_0x059a('0x6'));var util=require('util');var path=require(_0x059a('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x059a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x059a('0x9'));var squel=require(_0x059a('0xa'));var crypto=require(_0x059a('0xb'));var jsforce=require(_0x059a('0xc'));var deskjs=require(_0x059a('0xd'));var toCsv=require(_0x059a('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x059a('0xf'));var authService=require(_0x059a('0x10'));var qs=require(_0x059a('0x11'));var as=require(_0x059a('0x12'));var hardwareService=require(_0x059a('0x13'));var logger=require(_0x059a('0x14'))(_0x059a('0x15'));var utils=require(_0x059a('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x059a('0x17'));var db=require(_0x059a('0x18'))['db'];function respondWithStatusCode(_0x321146,_0x541108){_0x541108=_0x541108||0xcc;return function(_0x5bd78f){if(_0x5bd78f){return _0x321146[_0x059a('0x19')](_0x541108);}return _0x321146['status'](_0x541108)[_0x059a('0x1a')]();};}function respondWithResult(_0x3c5dcb,_0x52a634){_0x52a634=_0x52a634||0xc8;return function(_0xa9f4f){if(_0xa9f4f){return _0x3c5dcb[_0x059a('0x1b')](_0x52a634)[_0x059a('0x1c')](_0xa9f4f);}};}function respondWithFilteredResult(_0x33e526,_0x2f02f2){return function(_0x50fdb4){if(_0x50fdb4){var _0x2047e6=typeof _0x2f02f2[_0x059a('0x1d')]===_0x059a('0x1e')&&typeof _0x2f02f2[_0x059a('0x1f')]==='undefined';var _0x425ace=_0x50fdb4[_0x059a('0x20')];var _0x72c52d=_0x2047e6?0x0:_0x2f02f2[_0x059a('0x1d')];var _0x4e581b=_0x2047e6?_0x50fdb4[_0x059a('0x20')]:_0x2f02f2[_0x059a('0x1d')]+_0x2f02f2[_0x059a('0x1f')];var _0x76e0d9;if(_0x4e581b>=_0x425ace){_0x4e581b=_0x425ace;_0x76e0d9=0xc8;}else{_0x76e0d9=0xce;}_0x33e526['status'](_0x76e0d9);return _0x33e526['set'](_0x059a('0x21'),_0x72c52d+'-'+_0x4e581b+'/'+_0x425ace)[_0x059a('0x1c')](_0x50fdb4);}return null;};}function patchUpdates(_0x2cd746){return function(_0x38ab20){try{jsonpatch[_0x059a('0x22')](_0x38ab20,_0x2cd746,!![]);}catch(_0x4ee7e8){return BPromise['reject'](_0x4ee7e8);}return _0x38ab20[_0x059a('0x23')]();};}function saveUpdates(_0x384844,_0x13f449){return function(_0x84bb3b){if(_0x84bb3b){return _0x84bb3b['update'](_0x384844)[_0x059a('0x24')](function(_0x3c775b){return _0x3c775b;});}return null;};}function removeEntity(_0x356b9d,_0x244259){return function(_0x5ea859){if(_0x5ea859){return _0x5ea859['destroy']()[_0x059a('0x24')](function(){_0x356b9d['status'](0xcc)[_0x059a('0x1a')]();});}};}function handleEntityNotFound(_0xefebe4,_0x642a99){return function(_0x5e85f1){if(!_0x5e85f1){_0xefebe4[_0x059a('0x19')](0x194);}return _0x5e85f1;};}function handleError(_0x827a62,_0x75e88){_0x75e88=_0x75e88||0x1f4;return function(_0x4b6db9){logger['error'](_0x4b6db9['stack']);if(_0x4b6db9['name']){delete _0x4b6db9[_0x059a('0x25')];}_0x827a62[_0x059a('0x1b')](_0x75e88)['send'](_0x4b6db9);};}exports[_0x059a('0x26')]=function(_0x3b9200,_0xc0dbcc){var _0x50e593={},_0xb57d0a={},_0x4d64e5={'count':0x0,'rows':[]};var _0x50863b=_[_0x059a('0x27')](db[_0x059a('0x28')][_0x059a('0x29')],function(_0x35dfd9){return{'name':_0x35dfd9[_0x059a('0x2a')],'type':_0x35dfd9['type'][_0x059a('0x2b')]};});_0xb57d0a['model']=_[_0x059a('0x27')](_0x50863b,_0x059a('0x25'));_0xb57d0a[_0x059a('0x2c')]=_['keys'](_0x3b9200['query']);_0xb57d0a[_0x059a('0x2d')]=_[_0x059a('0x2e')](_0xb57d0a[_0x059a('0x2f')],_0xb57d0a[_0x059a('0x2c')]);_0x50e593[_0x059a('0x30')]=_['intersection'](_0xb57d0a[_0x059a('0x2f')],qs[_0x059a('0x31')](_0x3b9200[_0x059a('0x2c')][_0x059a('0x31')]));_0x50e593[_0x059a('0x30')]=_0x50e593[_0x059a('0x30')][_0x059a('0x32')]?_0x50e593['attributes']:_0xb57d0a['model'];if(!_0x3b9200[_0x059a('0x2c')][_0x059a('0x33')](_0x059a('0x34'))){_0x50e593[_0x059a('0x1f')]=qs[_0x059a('0x1f')](_0x3b9200[_0x059a('0x2c')][_0x059a('0x1f')]);_0x50e593[_0x059a('0x1d')]=qs[_0x059a('0x1d')](_0x3b9200['query'][_0x059a('0x1d')]);}_0x50e593[_0x059a('0x35')]=qs[_0x059a('0x36')](_0x3b9200[_0x059a('0x2c')][_0x059a('0x36')]);_0x50e593[_0x059a('0x37')]=qs['filters'](_['pick'](_0x3b9200['query'],_0xb57d0a[_0x059a('0x2d')]),_0x50863b);if(_0x3b9200[_0x059a('0x2c')][_0x059a('0x38')]){_0x50e593[_0x059a('0x37')]=_[_0x059a('0x39')](_0x50e593['where'],{'$or':_[_0x059a('0x27')](_0x50863b,function(_0x621c39){if(_0x621c39[_0x059a('0x3a')]!==_0x059a('0x3b')){var _0x342717={};_0x342717[_0x621c39[_0x059a('0x25')]]={'$like':'%'+_0x3b9200[_0x059a('0x2c')][_0x059a('0x38')]+'%'};return _0x342717;}})});}_0x50e593=_[_0x059a('0x39')]({},_0x50e593,_0x3b9200[_0x059a('0x3c')]);var _0x5ea328={'where':_0x50e593[_0x059a('0x37')]};return db[_0x059a('0x28')]['count'](_0x5ea328)[_0x059a('0x24')](function(_0xbd137f){_0x4d64e5[_0x059a('0x20')]=_0xbd137f;if(_0x3b9200[_0x059a('0x2c')][_0x059a('0x3d')]){_0x50e593[_0x059a('0x3e')]=[{'all':!![]}];}return db[_0x059a('0x28')][_0x059a('0x3f')](_0x50e593);})['then'](function(_0x2d4b9f){_0x4d64e5[_0x059a('0x40')]=_0x2d4b9f;return _0x4d64e5;})[_0x059a('0x24')](respondWithFilteredResult(_0xc0dbcc,_0x50e593))['catch'](handleError(_0xc0dbcc,null));};exports[_0x059a('0x41')]=function(_0x20fc07,_0x17e1f7){var _0x297804={'raw':![],'where':{'id':_0x20fc07[_0x059a('0x42')]['id']}},_0x592dd6={};_0x592dd6[_0x059a('0x2f')]=_[_0x059a('0x43')](db[_0x059a('0x28')]['rawAttributes']);_0x592dd6[_0x059a('0x2c')]=_['keys'](_0x20fc07[_0x059a('0x2c')]);_0x592dd6[_0x059a('0x2d')]=_[_0x059a('0x2e')](_0x592dd6['model'],_0x592dd6[_0x059a('0x2c')]);_0x297804['attributes']=_[_0x059a('0x2e')](_0x592dd6['model'],qs[_0x059a('0x31')](_0x20fc07[_0x059a('0x2c')]['fields']));_0x297804[_0x059a('0x30')]=_0x297804[_0x059a('0x30')][_0x059a('0x32')]?_0x297804[_0x059a('0x30')]:_0x592dd6['model'];if(_0x20fc07[_0x059a('0x2c')]['includeAll']){_0x297804['include']=[{'all':!![]}];}_0x297804=_[_0x059a('0x39')]({},_0x297804,_0x20fc07[_0x059a('0x3c')]);return db['VtigerConfiguration'][_0x059a('0x44')](_0x297804)[_0x059a('0x24')](handleEntityNotFound(_0x17e1f7,null))['then'](respondWithResult(_0x17e1f7,null))[_0x059a('0x45')](handleError(_0x17e1f7,null));};exports[_0x059a('0x46')]=function(_0x3054c7,_0x132d67){return db[_0x059a('0x28')]['create'](_0x3054c7[_0x059a('0x47')],{})[_0x059a('0x24')](respondWithResult(_0x132d67,0xc9))['catch'](handleError(_0x132d67,null));};exports[_0x059a('0x48')]=function(_0x4ab629,_0x2aaa32){if(_0x4ab629[_0x059a('0x47')]['id']){delete _0x4ab629[_0x059a('0x47')]['id'];}return db['VtigerConfiguration'][_0x059a('0x44')]({'where':{'id':_0x4ab629[_0x059a('0x42')]['id']}})[_0x059a('0x24')](handleEntityNotFound(_0x2aaa32,null))[_0x059a('0x24')](saveUpdates(_0x4ab629[_0x059a('0x47')],null))[_0x059a('0x24')](respondWithResult(_0x2aaa32,null))['catch'](handleError(_0x2aaa32,null));};exports['destroy']=function(_0xc32aff,_0x2ca113){return db[_0x059a('0x28')][_0x059a('0x44')]({'where':{'id':_0xc32aff[_0x059a('0x42')]['id']}})[_0x059a('0x24')](handleEntityNotFound(_0x2ca113,null))[_0x059a('0x24')](removeEntity(_0x2ca113,null))['catch'](handleError(_0x2ca113,null));};exports['getFields']=function(_0x1909ca,_0x8c094e,_0x128727){var _0x4c2e64={};var _0xdcc0d8={};var _0x2c7586;var _0x4699d4;return db[_0x059a('0x28')]['findOne']({'where':{'id':_0x1909ca['params']['id']}})[_0x059a('0x24')](handleEntityNotFound(_0x8c094e,null))['then'](function(_0x5adf8e){if(_0x5adf8e){_0x2c7586=_0x5adf8e;_0xdcc0d8['model']=_[_0x059a('0x43')](db['VtigerField'][_0x059a('0x29')]);_0xdcc0d8['query']=_[_0x059a('0x43')](_0x1909ca[_0x059a('0x2c')]);_0xdcc0d8['filters']=_[_0x059a('0x2e')](_0xdcc0d8[_0x059a('0x2f')],_0xdcc0d8['query']);_0x4c2e64[_0x059a('0x30')]=_[_0x059a('0x2e')](_0xdcc0d8[_0x059a('0x2f')],qs[_0x059a('0x31')](_0x1909ca[_0x059a('0x2c')][_0x059a('0x31')]));_0x4c2e64['attributes']=_0x4c2e64[_0x059a('0x30')][_0x059a('0x32')]?_0x4c2e64['attributes']:_0xdcc0d8['model'];_0x4c2e64[_0x059a('0x35')]=qs['sort'](_0x1909ca[_0x059a('0x2c')]['sort']);_0x4c2e64['where']=qs['filters'](_[_0x059a('0x49')](_0x1909ca[_0x059a('0x2c')],_0xdcc0d8[_0x059a('0x2d')]));if(_0x1909ca['query'][_0x059a('0x38')]){_0x4c2e64[_0x059a('0x37')]=_[_0x059a('0x39')](_0x4c2e64['where'],{'$or':_[_0x059a('0x27')](_0x4c2e64[_0x059a('0x30')],function(_0x4cdc05){var _0x1c5806={};_0x1c5806[_0x4cdc05]={'$like':'%'+_0x1909ca['query'][_0x059a('0x38')]+'%'};return _0x1c5806;})});}_0x4c2e64=_[_0x059a('0x39')]({},_0x4c2e64,_0x1909ca[_0x059a('0x3c')]);return _0x2c7586[_0x059a('0x4a')](_0x4c2e64);}})[_0x059a('0x24')](function(_0x24eed4){if(_0x24eed4){_0x4699d4=_0x24eed4[_0x059a('0x32')];if(!_0x1909ca[_0x059a('0x2c')][_0x059a('0x33')](_0x059a('0x34'))){_0x4c2e64[_0x059a('0x1f')]=qs['limit'](_0x1909ca['query']['limit']);_0x4c2e64[_0x059a('0x1d')]=qs[_0x059a('0x1d')](_0x1909ca['query']['offset']);}return _0x2c7586['getFields'](_0x4c2e64);}})['then'](function(_0x12d87e){if(_0x12d87e){return _0x12d87e?{'count':_0x4699d4,'rows':_0x12d87e}:null;}})[_0x059a('0x24')](respondWithResult(_0x8c094e,null))[_0x059a('0x45')](handleError(_0x8c094e,null));};exports['getSubjects']=function(_0x2d5815,_0x165cb9,_0x49a704){var _0x28c7c6={};var _0x1edd78={};var _0x519a7f;var _0x2c6f29;return db[_0x059a('0x28')][_0x059a('0x4b')]({'where':{'id':_0x2d5815['params']['id']}})['then'](handleEntityNotFound(_0x165cb9,null))[_0x059a('0x24')](function(_0x5449d9){if(_0x5449d9){_0x519a7f=_0x5449d9;_0x1edd78['model']=_[_0x059a('0x43')](db[_0x059a('0x4c')][_0x059a('0x29')]);_0x1edd78['query']=_[_0x059a('0x43')](_0x2d5815[_0x059a('0x2c')]);_0x1edd78[_0x059a('0x2d')]=_[_0x059a('0x2e')](_0x1edd78[_0x059a('0x2f')],_0x1edd78[_0x059a('0x2c')]);_0x28c7c6['attributes']=_[_0x059a('0x2e')](_0x1edd78[_0x059a('0x2f')],qs['fields'](_0x2d5815[_0x059a('0x2c')]['fields']));_0x28c7c6['attributes']=_0x28c7c6['attributes'][_0x059a('0x32')]?_0x28c7c6[_0x059a('0x30')]:_0x1edd78['model'];_0x28c7c6[_0x059a('0x35')]=qs[_0x059a('0x36')](_0x2d5815[_0x059a('0x2c')]['sort']);_0x28c7c6['where']=qs[_0x059a('0x2d')](_[_0x059a('0x49')](_0x2d5815[_0x059a('0x2c')],_0x1edd78['filters']));if(_0x2d5815[_0x059a('0x2c')]['filter']){_0x28c7c6[_0x059a('0x37')]=_[_0x059a('0x39')](_0x28c7c6[_0x059a('0x37')],{'$or':_['map'](_0x28c7c6['attributes'],function(_0x230adc){var _0x136ebe={};_0x136ebe[_0x230adc]={'$like':'%'+_0x2d5815[_0x059a('0x2c')][_0x059a('0x38')]+'%'};return _0x136ebe;})});}_0x28c7c6=_[_0x059a('0x39')]({},_0x28c7c6,_0x2d5815['options']);return _0x519a7f[_0x059a('0x4d')](_0x28c7c6);}})[_0x059a('0x24')](function(_0x399889){if(_0x399889){_0x2c6f29=_0x399889[_0x059a('0x32')];if(!_0x2d5815[_0x059a('0x2c')][_0x059a('0x33')]('nolimit')){_0x28c7c6[_0x059a('0x1f')]=qs[_0x059a('0x1f')](_0x2d5815[_0x059a('0x2c')][_0x059a('0x1f')]);_0x28c7c6[_0x059a('0x1d')]=qs['offset'](_0x2d5815['query'][_0x059a('0x1d')]);}return _0x519a7f[_0x059a('0x4d')](_0x28c7c6);}})['then'](function(_0x46f2b5){if(_0x46f2b5){return _0x46f2b5?{'count':_0x2c6f29,'rows':_0x46f2b5}:null;}})[_0x059a('0x24')](respondWithResult(_0x165cb9,null))[_0x059a('0x45')](handleError(_0x165cb9,null));};exports[_0x059a('0x4e')]=function(_0x70c8c,_0x1bf7c0,_0xb0d145){var _0x2c4539={};var _0x22c909={};var _0x2125aa;var _0x218be8;return db['VtigerConfiguration'][_0x059a('0x4b')]({'where':{'id':_0x70c8c['params']['id']}})[_0x059a('0x24')](handleEntityNotFound(_0x1bf7c0,null))[_0x059a('0x24')](function(_0x4d68c9){if(_0x4d68c9){_0x2125aa=_0x4d68c9;_0x22c909[_0x059a('0x2f')]=_['keys'](db['VtigerField'][_0x059a('0x29')]);_0x22c909[_0x059a('0x2c')]=_['keys'](_0x70c8c[_0x059a('0x2c')]);_0x22c909[_0x059a('0x2d')]=_[_0x059a('0x2e')](_0x22c909[_0x059a('0x2f')],_0x22c909[_0x059a('0x2c')]);_0x2c4539['attributes']=_[_0x059a('0x2e')](_0x22c909['model'],qs[_0x059a('0x31')](_0x70c8c[_0x059a('0x2c')][_0x059a('0x31')]));_0x2c4539[_0x059a('0x30')]=_0x2c4539[_0x059a('0x30')]['length']?_0x2c4539[_0x059a('0x30')]:_0x22c909[_0x059a('0x2f')];_0x2c4539[_0x059a('0x35')]=qs[_0x059a('0x36')](_0x70c8c['query'][_0x059a('0x36')]);_0x2c4539['where']=qs['filters'](_[_0x059a('0x49')](_0x70c8c[_0x059a('0x2c')],_0x22c909[_0x059a('0x2d')]));if(_0x70c8c['query'][_0x059a('0x38')]){_0x2c4539['where']=_[_0x059a('0x39')](_0x2c4539[_0x059a('0x37')],{'$or':_[_0x059a('0x27')](_0x2c4539[_0x059a('0x30')],function(_0x744f59){var _0xd0e9c2={};_0xd0e9c2[_0x744f59]={'$like':'%'+_0x70c8c[_0x059a('0x2c')][_0x059a('0x38')]+'%'};return _0xd0e9c2;})});}_0x2c4539=_['merge']({},_0x2c4539,_0x70c8c[_0x059a('0x3c')]);return _0x2125aa[_0x059a('0x4e')](_0x2c4539);}})[_0x059a('0x24')](function(_0x337811){if(_0x337811){_0x218be8=_0x337811[_0x059a('0x32')];if(!_0x70c8c[_0x059a('0x2c')][_0x059a('0x33')]('nolimit')){_0x2c4539['limit']=qs[_0x059a('0x1f')](_0x70c8c[_0x059a('0x2c')]['limit']);_0x2c4539[_0x059a('0x1d')]=qs[_0x059a('0x1d')](_0x70c8c[_0x059a('0x2c')][_0x059a('0x1d')]);}return _0x2125aa['getDescriptions'](_0x2c4539);}})[_0x059a('0x24')](function(_0x9b8b6){if(_0x9b8b6){return _0x9b8b6?{'count':_0x218be8,'rows':_0x9b8b6}:null;}})['then'](respondWithResult(_0x1bf7c0,null))[_0x059a('0x45')](handleError(_0x1bf7c0,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 993573b..a2f465a 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 _0x8adf=['moment','../../config/environment','./intVtigerConfiguration.attributes','exports','define','int_vtiger_configurations','lodash','../../config/logger'];(function(_0x51e070,_0x5b042a){var _0x2514c9=function(_0x22b421){while(--_0x22b421){_0x51e070['push'](_0x51e070['shift']());}};_0x2514c9(++_0x5b042a);}(_0x8adf,0x12e));var _0xf8ad=function(_0x2ee83d,_0x219ca9){_0x2ee83d=_0x2ee83d-0x0;var _0x5747c8=_0x8adf[_0x2ee83d];return _0x5747c8;};'use strict';var _=require(_0xf8ad('0x0'));var util=require('util');var logger=require(_0xf8ad('0x1'))('api');var moment=require(_0xf8ad('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf8ad('0x3'));var attributes=require(_0xf8ad('0x4'));module[_0xf8ad('0x5')]=function(_0x4e8d6d,_0x2469d4){return _0x4e8d6d[_0xf8ad('0x6')]('VtigerConfiguration',attributes,{'tableName':_0xf8ad('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70e4=['util','../../config/logger','api','path','../../config/environment','./intVtigerConfiguration.attributes','exports','VtigerConfiguration','lodash'];(function(_0x3944d4,_0x422a31){var _0x3f74fb=function(_0x2f4028){while(--_0x2f4028){_0x3944d4['push'](_0x3944d4['shift']());}};_0x3f74fb(++_0x422a31);}(_0x70e4,0x19d));var _0x470e=function(_0x5ddaac,_0x2697a8){_0x5ddaac=_0x5ddaac-0x0;var _0x2a9c58=_0x70e4[_0x5ddaac];return _0x2a9c58;};'use strict';var _=require(_0x470e('0x0'));var util=require(_0x470e('0x1'));var logger=require(_0x470e('0x2'))(_0x470e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x470e('0x4'));var rimraf=require('rimraf');var config=require(_0x470e('0x5'));var attributes=require(_0x470e('0x6'));module[_0x470e('0x7')]=function(_0x3f783b,_0x8c30a8){return _0x3f783b['define'](_0x470e('0x8'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 11cabdb..17dcbc0 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 _0xca3b=['error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x572637,_0x216d95){var _0xb6748=function(_0x3eeb8c){while(--_0x3eeb8c){_0x572637['push'](_0x572637['shift']());}};_0xb6748(++_0x216d95);}(_0xca3b,0x1e5));var _0xbca3=function(_0x1588b3,_0x2b6d6c){_0x1588b3=_0x1588b3-0x0;var _0x3e357d=_0xca3b[_0x1588b3];return _0x3e357d;};'use strict';var _=require(_0xbca3('0x0'));var util=require('util');var moment=require(_0xbca3('0x1'));var BPromise=require(_0xbca3('0x2'));var rs=require(_0xbca3('0x3'));var fs=require('fs');var Redis=require(_0xbca3('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbca3('0x5'))('rpc');var config=require(_0xbca3('0x6'));var jayson=require(_0xbca3('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x376047,_0x2f997f,_0x928439){return new BPromise(function(_0x4ab5ca,_0x2d2cc5){return client[_0xbca3('0x8')](_0x376047,_0x928439)[_0xbca3('0x9')](function(_0x305c15){logger[_0xbca3('0xa')](_0xbca3('0xb'),_0x2f997f,_0xbca3('0xc'));logger[_0xbca3('0xd')](_0xbca3('0xe'),_0x2f997f,'request\x20sent',JSON['stringify'](_0x305c15));if(_0x305c15[_0xbca3('0xf')]){if(_0x305c15[_0xbca3('0xf')][_0xbca3('0x10')]===0x1f4){logger['error'](_0xbca3('0xb'),_0x2f997f,_0x305c15[_0xbca3('0xf')]['message']);return _0x2d2cc5(_0x305c15[_0xbca3('0xf')][_0xbca3('0x11')]);}logger['error'](_0xbca3('0xb'),_0x2f997f,_0x305c15[_0xbca3('0xf')][_0xbca3('0x11')]);return _0x4ab5ca(_0x305c15['error'][_0xbca3('0x11')]);}else{logger['info'](_0xbca3('0xb'),_0x2f997f,_0xbca3('0xc'));_0x4ab5ca(_0x305c15[_0xbca3('0x12')][_0xbca3('0x11')]);}})[_0xbca3('0x13')](function(_0x2d753d){logger[_0xbca3('0xf')](_0xbca3('0xb'),_0x2f997f,_0x2d753d);_0x2d2cc5(_0x2d753d);});});} \ No newline at end of file +var _0x6b87=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x2dbd93,_0x4026b6){var _0x10a297=function(_0x5ae9d5){while(--_0x5ae9d5){_0x2dbd93['push'](_0x2dbd93['shift']());}};_0x10a297(++_0x4026b6);}(_0x6b87,0x14a));var _0x76b8=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6b87[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x76b8('0x0'));var util=require(_0x76b8('0x1'));var moment=require('moment');var BPromise=require(_0x76b8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x76b8('0x3'));var db=require(_0x76b8('0x4'))['db'];var utils=require(_0x76b8('0x5'));var logger=require(_0x76b8('0x6'))(_0x76b8('0x7'));var config=require(_0x76b8('0x8'));var jayson=require(_0x76b8('0x9'));var client=jayson[_0x76b8('0xa')][_0x76b8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x34c31c,_0xeef62e,_0x4e76d7){return new BPromise(function(_0x114481,_0x4d7134){return client[_0x76b8('0xc')](_0x34c31c,_0x4e76d7)[_0x76b8('0xd')](function(_0x2fb6fb){logger[_0x76b8('0xe')](_0x76b8('0xf'),_0xeef62e,_0x76b8('0x10'));logger[_0x76b8('0x11')](_0x76b8('0x12'),_0xeef62e,_0x76b8('0x10'),JSON[_0x76b8('0x13')](_0x2fb6fb));if(_0x2fb6fb[_0x76b8('0x14')]){if(_0x2fb6fb['error'][_0x76b8('0x15')]===0x1f4){logger[_0x76b8('0x14')](_0x76b8('0xf'),_0xeef62e,_0x2fb6fb[_0x76b8('0x14')][_0x76b8('0x16')]);return _0x4d7134(_0x2fb6fb[_0x76b8('0x14')][_0x76b8('0x16')]);}logger[_0x76b8('0x14')]('VtigerConfiguration,\x20%s,\x20%s',_0xeef62e,_0x2fb6fb[_0x76b8('0x14')]['message']);return _0x114481(_0x2fb6fb[_0x76b8('0x14')][_0x76b8('0x16')]);}else{logger[_0x76b8('0xe')](_0x76b8('0xf'),_0xeef62e,_0x76b8('0x10'));_0x114481(_0x2fb6fb[_0x76b8('0x17')][_0x76b8('0x16')]);}})['catch'](function(_0x44e403){logger[_0x76b8('0x14')]('VtigerConfiguration,\x20%s,\x20%s',_0xeef62e,_0x44e403);_0x4d7134(_0x44e403);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 062bebd..32a1586 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 _0xc4b6=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intVtigerField.controller','isAuthenticated','get','/:id','create','put','delete','multer'];(function(_0xd70fb3,_0x32d5d8){var _0x47b000=function(_0x27723c){while(--_0x27723c){_0xd70fb3['push'](_0xd70fb3['shift']());}};_0x47b000(++_0x32d5d8);}(_0xc4b6,0x1ee));var _0x6c4b=function(_0x1b5c91,_0x446e57){_0x1b5c91=_0x1b5c91-0x0;var _0x203645=_0xc4b6[_0x1b5c91];return _0x203645;};'use strict';var multer=require(_0x6c4b('0x0'));var util=require(_0x6c4b('0x1'));var path=require(_0x6c4b('0x2'));var timeout=require(_0x6c4b('0x3'));var express=require('express');var router=express[_0x6c4b('0x4')]();var fs_extra=require(_0x6c4b('0x5'));var auth=require(_0x6c4b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6c4b('0x7'));var controller=require(_0x6c4b('0x8'));router['get']('/',auth[_0x6c4b('0x9')](),controller['index']);router[_0x6c4b('0xa')](_0x6c4b('0xb'),auth[_0x6c4b('0x9')](),controller['show']);router['post']('/',auth[_0x6c4b('0x9')](),controller[_0x6c4b('0xc')]);router[_0x6c4b('0xd')](_0x6c4b('0xb'),auth[_0x6c4b('0x9')](),controller['update']);router[_0x6c4b('0xe')]('/:id',auth[_0x6c4b('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x64f5=['update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/:id','post','create','put'];(function(_0x2a332d,_0x3d5865){var _0x5d24c4=function(_0x255e6c){while(--_0x255e6c){_0x2a332d['push'](_0x2a332d['shift']());}};_0x5d24c4(++_0x3d5865);}(_0x64f5,0x17e));var _0x564f=function(_0x2c2f3a,_0x5de935){_0x2c2f3a=_0x2c2f3a-0x0;var _0x42f4c8=_0x64f5[_0x2c2f3a];return _0x42f4c8;};'use strict';var multer=require(_0x564f('0x0'));var util=require(_0x564f('0x1'));var path=require(_0x564f('0x2'));var timeout=require(_0x564f('0x3'));var express=require('express');var router=express[_0x564f('0x4')]();var fs_extra=require(_0x564f('0x5'));var auth=require(_0x564f('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intVtigerField.controller');router[_0x564f('0x7')]('/',auth[_0x564f('0x8')](),controller[_0x564f('0x9')]);router[_0x564f('0x7')](_0x564f('0xa'),auth[_0x564f('0x8')](),controller['show']);router[_0x564f('0xb')]('/',auth[_0x564f('0x8')](),controller[_0x564f('0xc')]);router[_0x564f('0xd')](_0x564f('0xa'),auth[_0x564f('0x8')](),controller[_0x564f('0xe')]);router[_0x564f('0xf')](_0x564f('0xa'),auth[_0x564f('0x8')](),controller[_0x564f('0x10')]);module[_0x564f('0x11')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 1908eac..e2f98e8 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 _0x7f6b=['string','variable','picklist','customVariable','STRING','sequelize','exports','ENUM'];(function(_0x4c7ce2,_0x1fceca){var _0x243bf1=function(_0x478513){while(--_0x478513){_0x4c7ce2['push'](_0x4c7ce2['shift']());}};_0x243bf1(++_0x1fceca);}(_0x7f6b,0x17d));var _0xb7f6=function(_0x1a2580,_0x3d6d2c){_0x1a2580=_0x1a2580-0x0;var _0x58c4f9=_0x7f6b[_0x1a2580];return _0x58c4f9;};'use strict';var Sequelize=require(_0xb7f6('0x0'));module[_0xb7f6('0x1')]={'type':{'type':Sequelize[_0xb7f6('0x2')](_0xb7f6('0x3'),_0xb7f6('0x4'),'customVariable','keyValue',_0xb7f6('0x5')),'defaultValue':_0xb7f6('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xb7f6('0x2')](_0xb7f6('0x3'),_0xb7f6('0x4'),_0xb7f6('0x6'))},'keyContent':{'type':Sequelize[_0xb7f6('0x7')]},'idField':{'type':Sequelize[_0xb7f6('0x7')]},'nameField':{'type':Sequelize[_0xb7f6('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb7f6('0x7')]}}; \ No newline at end of file +var _0x7657=['ENUM','string','customVariable','keyValue','picklist','STRING','variable','BOOLEAN','sequelize','exports'];(function(_0x2fe4e9,_0x2f18c4){var _0x2ccbf7=function(_0xba7035){while(--_0xba7035){_0x2fe4e9['push'](_0x2fe4e9['shift']());}};_0x2ccbf7(++_0x2f18c4);}(_0x7657,0x10c));var _0x7765=function(_0x1c6227,_0x576ad5){_0x1c6227=_0x1c6227-0x0;var _0x4762a7=_0x7657[_0x1c6227];return _0x4762a7;};'use strict';var Sequelize=require(_0x7765('0x0'));module[_0x7765('0x1')]={'type':{'type':Sequelize[_0x7765('0x2')](_0x7765('0x3'),'variable',_0x7765('0x4'),_0x7765('0x5'),_0x7765('0x6')),'defaultValue':_0x7765('0x3')},'content':{'type':Sequelize[_0x7765('0x7')]},'key':{'type':Sequelize[_0x7765('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x7765('0x3'),_0x7765('0x8'),_0x7765('0x4'))},'keyContent':{'type':Sequelize[_0x7765('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x7765('0x7')]},'customField':{'type':Sequelize[_0x7765('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 42e7307..1d40f45 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 _0xa3c0=['error','stack','name','send','index','map','VtigerField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','merge','type','filter','options','include','findAll','rows','catch','find','create','body','update','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','Content-Range','reject','then','sendStatus'];(function(_0x2ac3cf,_0x465bb6){var _0x27dcca=function(_0x33f954){while(--_0x33f954){_0x2ac3cf['push'](_0x2ac3cf['shift']());}};_0x27dcca(++_0x465bb6);}(_0xa3c0,0xb4));var _0x0a3c=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa3c0[_0x3635ce];return _0x97ecd0;};'use strict';var emlformat=require(_0x0a3c('0x0'));var rimraf=require(_0x0a3c('0x1'));var zipdir=require(_0x0a3c('0x2'));var jsonpatch=require(_0x0a3c('0x3'));var rp=require(_0x0a3c('0x4'));var moment=require('moment');var BPromise=require(_0x0a3c('0x5'));var Mustache=require(_0x0a3c('0x6'));var util=require('util');var path=require(_0x0a3c('0x7'));var sox=require(_0x0a3c('0x8'));var csv=require(_0x0a3c('0x9'));var ejs=require(_0x0a3c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0a3c('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a3c('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0a3c('0xd'));var Papa=require(_0x0a3c('0xe'));var Redis=require(_0x0a3c('0xf'));var authService=require(_0x0a3c('0x10'));var qs=require(_0x0a3c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0a3c('0x12'));var logger=require(_0x0a3c('0x13'))(_0x0a3c('0x14'));var utils=require(_0x0a3c('0x15'));var config=require(_0x0a3c('0x16'));var licenseUtil=require(_0x0a3c('0x17'));var db=require(_0x0a3c('0x18'))['db'];function respondWithStatusCode(_0x525860,_0x40df5d){_0x40df5d=_0x40df5d||0xcc;return function(_0xf8089c){if(_0xf8089c){return _0x525860['sendStatus'](_0x40df5d);}return _0x525860['status'](_0x40df5d)[_0x0a3c('0x19')]();};}function respondWithResult(_0x5950b0,_0x552a62){_0x552a62=_0x552a62||0xc8;return function(_0x59e20b){if(_0x59e20b){return _0x5950b0[_0x0a3c('0x1a')](_0x552a62)[_0x0a3c('0x1b')](_0x59e20b);}};}function respondWithFilteredResult(_0x15f1a6,_0x118913){return function(_0x5b5820){if(_0x5b5820){var _0x2299b4=typeof _0x118913[_0x0a3c('0x1c')]===_0x0a3c('0x1d')&&typeof _0x118913[_0x0a3c('0x1e')]==='undefined';var _0x3d4b8f=_0x5b5820[_0x0a3c('0x1f')];var _0x2fc565=_0x2299b4?0x0:_0x118913['offset'];var _0x50fc48=_0x2299b4?_0x5b5820['count']:_0x118913['offset']+_0x118913['limit'];var _0x16e3f6;if(_0x50fc48>=_0x3d4b8f){_0x50fc48=_0x3d4b8f;_0x16e3f6=0xc8;}else{_0x16e3f6=0xce;}_0x15f1a6['status'](_0x16e3f6);return _0x15f1a6['set'](_0x0a3c('0x20'),_0x2fc565+'-'+_0x50fc48+'/'+_0x3d4b8f)[_0x0a3c('0x1b')](_0x5b5820);}return null;};}function patchUpdates(_0x480775){return function(_0x10d207){try{jsonpatch['apply'](_0x10d207,_0x480775,!![]);}catch(_0x5a597b){return BPromise[_0x0a3c('0x21')](_0x5a597b);}return _0x10d207['save']();};}function saveUpdates(_0x31104d,_0x5d1f2d){return function(_0x5d802c){if(_0x5d802c){return _0x5d802c['update'](_0x31104d)[_0x0a3c('0x22')](function(_0x37d9c6){return _0x37d9c6;});}return null;};}function removeEntity(_0x31c392,_0xf76e87){return function(_0xf91bb5){if(_0xf91bb5){return _0xf91bb5['destroy']()[_0x0a3c('0x22')](function(){_0x31c392['status'](0xcc)[_0x0a3c('0x19')]();});}};}function handleEntityNotFound(_0x1b9a0d,_0x4bf312){return function(_0x1dc7f4){if(!_0x1dc7f4){_0x1b9a0d[_0x0a3c('0x23')](0x194);}return _0x1dc7f4;};}function handleError(_0x156f13,_0x28ae1a){_0x28ae1a=_0x28ae1a||0x1f4;return function(_0x8ca074){logger[_0x0a3c('0x24')](_0x8ca074[_0x0a3c('0x25')]);if(_0x8ca074['name']){delete _0x8ca074[_0x0a3c('0x26')];}_0x156f13['status'](_0x28ae1a)[_0x0a3c('0x27')](_0x8ca074);};}exports[_0x0a3c('0x28')]=function(_0x237f3d,_0x4d9e48){var _0x567954={},_0x69b1ae={},_0x586800={'count':0x0,'rows':[]};var _0x5597ea=_[_0x0a3c('0x29')](db[_0x0a3c('0x2a')][_0x0a3c('0x2b')],function(_0x32cc8d){return{'name':_0x32cc8d[_0x0a3c('0x2c')],'type':_0x32cc8d['type'][_0x0a3c('0x2d')]};});_0x69b1ae[_0x0a3c('0x2e')]=_['map'](_0x5597ea,_0x0a3c('0x26'));_0x69b1ae[_0x0a3c('0x2f')]=_[_0x0a3c('0x30')](_0x237f3d[_0x0a3c('0x2f')]);_0x69b1ae[_0x0a3c('0x31')]=_[_0x0a3c('0x32')](_0x69b1ae['model'],_0x69b1ae[_0x0a3c('0x2f')]);_0x567954[_0x0a3c('0x33')]=_['intersection'](_0x69b1ae[_0x0a3c('0x2e')],qs[_0x0a3c('0x34')](_0x237f3d[_0x0a3c('0x2f')]['fields']));_0x567954[_0x0a3c('0x33')]=_0x567954[_0x0a3c('0x33')]['length']?_0x567954[_0x0a3c('0x33')]:_0x69b1ae[_0x0a3c('0x2e')];if(!_0x237f3d[_0x0a3c('0x2f')]['hasOwnProperty'](_0x0a3c('0x35'))){_0x567954[_0x0a3c('0x1e')]=qs[_0x0a3c('0x1e')](_0x237f3d['query'][_0x0a3c('0x1e')]);_0x567954[_0x0a3c('0x1c')]=qs['offset'](_0x237f3d[_0x0a3c('0x2f')][_0x0a3c('0x1c')]);}_0x567954[_0x0a3c('0x36')]=qs[_0x0a3c('0x37')](_0x237f3d[_0x0a3c('0x2f')][_0x0a3c('0x37')]);_0x567954[_0x0a3c('0x38')]=qs['filters'](_[_0x0a3c('0x39')](_0x237f3d[_0x0a3c('0x2f')],_0x69b1ae['filters']),_0x5597ea);if(_0x237f3d['query']['filter']){_0x567954[_0x0a3c('0x38')]=_[_0x0a3c('0x3a')](_0x567954['where'],{'$or':_[_0x0a3c('0x29')](_0x5597ea,function(_0x1b7bc0){if(_0x1b7bc0[_0x0a3c('0x3b')]!=='VIRTUAL'){var _0x32f218={};_0x32f218[_0x1b7bc0['name']]={'$like':'%'+_0x237f3d[_0x0a3c('0x2f')][_0x0a3c('0x3c')]+'%'};return _0x32f218;}})});}_0x567954=_[_0x0a3c('0x3a')]({},_0x567954,_0x237f3d[_0x0a3c('0x3d')]);var _0x195e06={'where':_0x567954[_0x0a3c('0x38')]};return db[_0x0a3c('0x2a')]['count'](_0x195e06)[_0x0a3c('0x22')](function(_0x1eec4b){_0x586800[_0x0a3c('0x1f')]=_0x1eec4b;if(_0x237f3d[_0x0a3c('0x2f')]['includeAll']){_0x567954[_0x0a3c('0x3e')]=[{'all':!![]}];}return db[_0x0a3c('0x2a')][_0x0a3c('0x3f')](_0x567954);})[_0x0a3c('0x22')](function(_0x5eb5f8){_0x586800[_0x0a3c('0x40')]=_0x5eb5f8;return _0x586800;})[_0x0a3c('0x22')](respondWithFilteredResult(_0x4d9e48,_0x567954))[_0x0a3c('0x41')](handleError(_0x4d9e48,null));};exports['show']=function(_0x606322,_0x2310bf){var _0x5be4cf={'raw':!![],'where':{'id':_0x606322['params']['id']}},_0x54a0ea={};_0x54a0ea['model']=_[_0x0a3c('0x30')](db['VtigerField'][_0x0a3c('0x2b')]);_0x54a0ea[_0x0a3c('0x2f')]=_[_0x0a3c('0x30')](_0x606322[_0x0a3c('0x2f')]);_0x54a0ea[_0x0a3c('0x31')]=_[_0x0a3c('0x32')](_0x54a0ea[_0x0a3c('0x2e')],_0x54a0ea['query']);_0x5be4cf[_0x0a3c('0x33')]=_[_0x0a3c('0x32')](_0x54a0ea[_0x0a3c('0x2e')],qs['fields'](_0x606322[_0x0a3c('0x2f')][_0x0a3c('0x34')]));_0x5be4cf[_0x0a3c('0x33')]=_0x5be4cf[_0x0a3c('0x33')]['length']?_0x5be4cf[_0x0a3c('0x33')]:_0x54a0ea[_0x0a3c('0x2e')];if(_0x606322[_0x0a3c('0x2f')]['includeAll']){_0x5be4cf['include']=[{'all':!![]}];}_0x5be4cf=_[_0x0a3c('0x3a')]({},_0x5be4cf,_0x606322['options']);return db[_0x0a3c('0x2a')][_0x0a3c('0x42')](_0x5be4cf)[_0x0a3c('0x22')](handleEntityNotFound(_0x2310bf,null))[_0x0a3c('0x22')](respondWithResult(_0x2310bf,null))[_0x0a3c('0x41')](handleError(_0x2310bf,null));};exports[_0x0a3c('0x43')]=function(_0x5f17cf,_0x193c71){return db[_0x0a3c('0x2a')][_0x0a3c('0x43')](_0x5f17cf[_0x0a3c('0x44')],{})[_0x0a3c('0x22')](respondWithResult(_0x193c71,0xc9))[_0x0a3c('0x41')](handleError(_0x193c71,null));};exports[_0x0a3c('0x45')]=function(_0x2f25de,_0x3a6f64){if(_0x2f25de[_0x0a3c('0x44')]['id']){delete _0x2f25de[_0x0a3c('0x44')]['id'];}return db[_0x0a3c('0x2a')][_0x0a3c('0x42')]({'where':{'id':_0x2f25de[_0x0a3c('0x46')]['id']}})[_0x0a3c('0x22')](handleEntityNotFound(_0x3a6f64,null))[_0x0a3c('0x22')](saveUpdates(_0x2f25de[_0x0a3c('0x44')],null))['then'](respondWithResult(_0x3a6f64,null))[_0x0a3c('0x41')](handleError(_0x3a6f64,null));};exports[_0x0a3c('0x47')]=function(_0x39ae55,_0x4e5023){return db[_0x0a3c('0x2a')][_0x0a3c('0x42')]({'where':{'id':_0x39ae55['params']['id']}})[_0x0a3c('0x22')](handleEntityNotFound(_0x4e5023,null))[_0x0a3c('0x22')](removeEntity(_0x4e5023,null))['catch'](handleError(_0x4e5023,null));}; \ No newline at end of file +var _0x8f88=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','VtigerField','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','map','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','rimraf','fast-json-patch','request-promise','moment','bluebird','to-csv','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x567fff,_0xd8acd8){var _0x465a37=function(_0x9d7bf7){while(--_0x9d7bf7){_0x567fff['push'](_0x567fff['shift']());}};_0x465a37(++_0xd8acd8);}(_0x8f88,0x19f));var _0x88f8=function(_0x506e4e,_0x1e893b){_0x506e4e=_0x506e4e-0x0;var _0x23719c=_0x8f88[_0x506e4e];return _0x23719c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x88f8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x88f8('0x1'));var rp=require(_0x88f8('0x2'));var moment=require(_0x88f8('0x3'));var BPromise=require(_0x88f8('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x88f8('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x88f8('0x6'));var jsforce=require(_0x88f8('0x7'));var deskjs=require(_0x88f8('0x8'));var toCsv=require(_0x88f8('0x5'));var querystring=require(_0x88f8('0x9'));var Papa=require(_0x88f8('0xa'));var Redis=require(_0x88f8('0xb'));var authService=require(_0x88f8('0xc'));var qs=require(_0x88f8('0xd'));var as=require(_0x88f8('0xe'));var hardwareService=require(_0x88f8('0xf'));var logger=require(_0x88f8('0x10'))('api');var utils=require(_0x88f8('0x11'));var config=require(_0x88f8('0x12'));var licenseUtil=require(_0x88f8('0x13'));var db=require(_0x88f8('0x14'))['db'];function respondWithStatusCode(_0x1fce8c,_0x497d7b){_0x497d7b=_0x497d7b||0xcc;return function(_0x1de610){if(_0x1de610){return _0x1fce8c[_0x88f8('0x15')](_0x497d7b);}return _0x1fce8c[_0x88f8('0x16')](_0x497d7b)[_0x88f8('0x17')]();};}function respondWithResult(_0x2d065f,_0x577ebf){_0x577ebf=_0x577ebf||0xc8;return function(_0x245ced){if(_0x245ced){return _0x2d065f[_0x88f8('0x16')](_0x577ebf)[_0x88f8('0x18')](_0x245ced);}};}function respondWithFilteredResult(_0xe1e132,_0x5d4ab5){return function(_0x32a27c){if(_0x32a27c){var _0x2cc700=typeof _0x5d4ab5[_0x88f8('0x19')]==='undefined'&&typeof _0x5d4ab5[_0x88f8('0x1a')]===_0x88f8('0x1b');var _0x5da3ac=_0x32a27c[_0x88f8('0x1c')];var _0x5e4d1b=_0x2cc700?0x0:_0x5d4ab5[_0x88f8('0x19')];var _0x58dc89=_0x2cc700?_0x32a27c[_0x88f8('0x1c')]:_0x5d4ab5[_0x88f8('0x19')]+_0x5d4ab5['limit'];var _0x1167ae;if(_0x58dc89>=_0x5da3ac){_0x58dc89=_0x5da3ac;_0x1167ae=0xc8;}else{_0x1167ae=0xce;}_0xe1e132[_0x88f8('0x16')](_0x1167ae);return _0xe1e132['set'](_0x88f8('0x1d'),_0x5e4d1b+'-'+_0x58dc89+'/'+_0x5da3ac)[_0x88f8('0x18')](_0x32a27c);}return null;};}function patchUpdates(_0x3a6722){return function(_0xf2070){try{jsonpatch[_0x88f8('0x1e')](_0xf2070,_0x3a6722,!![]);}catch(_0x5436c4){return BPromise['reject'](_0x5436c4);}return _0xf2070[_0x88f8('0x1f')]();};}function saveUpdates(_0x389414,_0x319bf7){return function(_0x5dab14){if(_0x5dab14){return _0x5dab14[_0x88f8('0x20')](_0x389414)[_0x88f8('0x21')](function(_0x2ab045){return _0x2ab045;});}return null;};}function removeEntity(_0x1efeeb,_0xe31c2a){return function(_0x3a6e64){if(_0x3a6e64){return _0x3a6e64[_0x88f8('0x22')]()['then'](function(){_0x1efeeb[_0x88f8('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc4bff9,_0x11bdca){return function(_0x126f8d){if(!_0x126f8d){_0xc4bff9[_0x88f8('0x15')](0x194);}return _0x126f8d;};}function handleError(_0x4262f3,_0x2275c0){_0x2275c0=_0x2275c0||0x1f4;return function(_0x1d15cc){logger[_0x88f8('0x23')](_0x1d15cc[_0x88f8('0x24')]);if(_0x1d15cc[_0x88f8('0x25')]){delete _0x1d15cc[_0x88f8('0x25')];}_0x4262f3['status'](_0x2275c0)[_0x88f8('0x26')](_0x1d15cc);};}exports[_0x88f8('0x27')]=function(_0x1388b3,_0x2e77b0){var _0xcef673={},_0x44eb20={},_0x4ec89a={'count':0x0,'rows':[]};var _0x1c99cf=_['map'](db[_0x88f8('0x28')]['rawAttributes'],function(_0x3298d2){return{'name':_0x3298d2['fieldName'],'type':_0x3298d2[_0x88f8('0x29')][_0x88f8('0x2a')]};});_0x44eb20['model']=_['map'](_0x1c99cf,_0x88f8('0x25'));_0x44eb20[_0x88f8('0x2b')]=_[_0x88f8('0x2c')](_0x1388b3[_0x88f8('0x2b')]);_0x44eb20['filters']=_[_0x88f8('0x2d')](_0x44eb20[_0x88f8('0x2e')],_0x44eb20[_0x88f8('0x2b')]);_0xcef673[_0x88f8('0x2f')]=_[_0x88f8('0x2d')](_0x44eb20[_0x88f8('0x2e')],qs[_0x88f8('0x30')](_0x1388b3[_0x88f8('0x2b')][_0x88f8('0x30')]));_0xcef673['attributes']=_0xcef673[_0x88f8('0x2f')][_0x88f8('0x31')]?_0xcef673[_0x88f8('0x2f')]:_0x44eb20[_0x88f8('0x2e')];if(!_0x1388b3[_0x88f8('0x2b')][_0x88f8('0x32')](_0x88f8('0x33'))){_0xcef673[_0x88f8('0x1a')]=qs['limit'](_0x1388b3['query'][_0x88f8('0x1a')]);_0xcef673[_0x88f8('0x19')]=qs[_0x88f8('0x19')](_0x1388b3[_0x88f8('0x2b')][_0x88f8('0x19')]);}_0xcef673['order']=qs[_0x88f8('0x34')](_0x1388b3[_0x88f8('0x2b')][_0x88f8('0x34')]);_0xcef673['where']=qs[_0x88f8('0x35')](_[_0x88f8('0x36')](_0x1388b3[_0x88f8('0x2b')],_0x44eb20[_0x88f8('0x35')]),_0x1c99cf);if(_0x1388b3[_0x88f8('0x2b')][_0x88f8('0x37')]){_0xcef673[_0x88f8('0x38')]=_['merge'](_0xcef673[_0x88f8('0x38')],{'$or':_[_0x88f8('0x39')](_0x1c99cf,function(_0x54c941){if(_0x54c941[_0x88f8('0x29')]!==_0x88f8('0x3a')){var _0x3e9a13={};_0x3e9a13[_0x54c941[_0x88f8('0x25')]]={'$like':'%'+_0x1388b3[_0x88f8('0x2b')][_0x88f8('0x37')]+'%'};return _0x3e9a13;}})});}_0xcef673=_['merge']({},_0xcef673,_0x1388b3[_0x88f8('0x3b')]);var _0x496adf={'where':_0xcef673[_0x88f8('0x38')]};return db[_0x88f8('0x28')][_0x88f8('0x1c')](_0x496adf)['then'](function(_0x1b6e75){_0x4ec89a[_0x88f8('0x1c')]=_0x1b6e75;if(_0x1388b3[_0x88f8('0x2b')][_0x88f8('0x3c')]){_0xcef673['include']=[{'all':!![]}];}return db[_0x88f8('0x28')][_0x88f8('0x3d')](_0xcef673);})[_0x88f8('0x21')](function(_0x1cc4d6){_0x4ec89a[_0x88f8('0x3e')]=_0x1cc4d6;return _0x4ec89a;})[_0x88f8('0x21')](respondWithFilteredResult(_0x2e77b0,_0xcef673))[_0x88f8('0x3f')](handleError(_0x2e77b0,null));};exports[_0x88f8('0x40')]=function(_0x9d9bba,_0x48ba5e){var _0xd277ba={'raw':!![],'where':{'id':_0x9d9bba[_0x88f8('0x41')]['id']}},_0x5530ca={};_0x5530ca[_0x88f8('0x2e')]=_['keys'](db['VtigerField'][_0x88f8('0x42')]);_0x5530ca['query']=_[_0x88f8('0x2c')](_0x9d9bba[_0x88f8('0x2b')]);_0x5530ca[_0x88f8('0x35')]=_[_0x88f8('0x2d')](_0x5530ca[_0x88f8('0x2e')],_0x5530ca[_0x88f8('0x2b')]);_0xd277ba[_0x88f8('0x2f')]=_[_0x88f8('0x2d')](_0x5530ca[_0x88f8('0x2e')],qs[_0x88f8('0x30')](_0x9d9bba[_0x88f8('0x2b')][_0x88f8('0x30')]));_0xd277ba[_0x88f8('0x2f')]=_0xd277ba[_0x88f8('0x2f')][_0x88f8('0x31')]?_0xd277ba[_0x88f8('0x2f')]:_0x5530ca[_0x88f8('0x2e')];if(_0x9d9bba[_0x88f8('0x2b')]['includeAll']){_0xd277ba[_0x88f8('0x43')]=[{'all':!![]}];}_0xd277ba=_['merge']({},_0xd277ba,_0x9d9bba[_0x88f8('0x3b')]);return db[_0x88f8('0x28')][_0x88f8('0x44')](_0xd277ba)['then'](handleEntityNotFound(_0x48ba5e,null))[_0x88f8('0x21')](respondWithResult(_0x48ba5e,null))[_0x88f8('0x3f')](handleError(_0x48ba5e,null));};exports[_0x88f8('0x45')]=function(_0x3aef4e,_0x5bde78){return db[_0x88f8('0x28')][_0x88f8('0x45')](_0x3aef4e[_0x88f8('0x46')],{})[_0x88f8('0x21')](respondWithResult(_0x5bde78,0xc9))[_0x88f8('0x3f')](handleError(_0x5bde78,null));};exports[_0x88f8('0x20')]=function(_0x739e5,_0x42360f){if(_0x739e5[_0x88f8('0x46')]['id']){delete _0x739e5[_0x88f8('0x46')]['id'];}return db[_0x88f8('0x28')][_0x88f8('0x44')]({'where':{'id':_0x739e5[_0x88f8('0x41')]['id']}})[_0x88f8('0x21')](handleEntityNotFound(_0x42360f,null))[_0x88f8('0x21')](saveUpdates(_0x739e5[_0x88f8('0x46')],null))[_0x88f8('0x21')](respondWithResult(_0x42360f,null))[_0x88f8('0x3f')](handleError(_0x42360f,null));};exports['destroy']=function(_0x2c7b93,_0x2eb2ee){return db[_0x88f8('0x28')][_0x88f8('0x44')]({'where':{'id':_0x2c7b93['params']['id']}})[_0x88f8('0x21')](handleEntityNotFound(_0x2eb2ee,null))['then'](removeEntity(_0x2eb2ee,null))['catch'](handleError(_0x2eb2ee,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index d64adeb..b4c1e74 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 _0x16be=['../../config/environment','exports','define','int_vtiger_fields','vtiger_unique_index','lodash','../../config/logger','api','moment','path','rimraf'];(function(_0x5d7227,_0x12aebe){var _0x15ac55=function(_0x58d13e){while(--_0x58d13e){_0x5d7227['push'](_0x5d7227['shift']());}};_0x15ac55(++_0x12aebe);}(_0x16be,0x14f));var _0xe16b=function(_0x199af2,_0x37c08d){_0x199af2=_0x199af2-0x0;var _0x3478ac=_0x16be[_0x199af2];return _0x3478ac;};'use strict';var _=require(_0xe16b('0x0'));var util=require('util');var logger=require(_0xe16b('0x1'))(_0xe16b('0x2'));var moment=require(_0xe16b('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe16b('0x4'));var rimraf=require(_0xe16b('0x5'));var config=require(_0xe16b('0x6'));var attributes=require('./intVtigerField.attributes');module[_0xe16b('0x7')]=function(_0x4722d8,_0x4d0646){return _0x4722d8[_0xe16b('0x8')]('VtigerField',attributes,{'tableName':_0xe16b('0x9'),'paranoid':![],'indexes':[{'name':_0xe16b('0xa'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6790=['define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path','./intVtigerField.attributes','exports'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x6790,0x105));var _0x0679=function(_0x3a0f24,_0x55ddb7){_0x3a0f24=_0x3a0f24-0x0;var _0x3b6dd2=_0x6790[_0x3a0f24];return _0x3b6dd2;};'use strict';var _=require(_0x0679('0x0'));var util=require(_0x0679('0x1'));var logger=require(_0x0679('0x2'))(_0x0679('0x3'));var moment=require(_0x0679('0x4'));var BPromise=require(_0x0679('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0679('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0679('0x7'));module[_0x0679('0x8')]=function(_0x5723c3,_0x41a409){return _0x5723c3[_0x0679('0x9')](_0x0679('0xa'),attributes,{'tableName':_0x0679('0xb'),'paranoid':![],'indexes':[{'name':_0x0679('0xc'),'fields':[_0x0679('0xd'),_0x0679('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index f9f788c..18038be 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 _0x13d4=['VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info'];(function(_0x1be1e8,_0x45ba82){var _0x3d044e=function(_0x5d6ed6){while(--_0x5d6ed6){_0x1be1e8['push'](_0x1be1e8['shift']());}};_0x3d044e(++_0x45ba82);}(_0x13d4,0x15d));var _0x413d=function(_0x50c8e8,_0x467279){_0x50c8e8=_0x50c8e8-0x0;var _0x970724=_0x13d4[_0x50c8e8];return _0x970724;};'use strict';var _=require('lodash');var util=require(_0x413d('0x0'));var moment=require(_0x413d('0x1'));var BPromise=require(_0x413d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x413d('0x3'));var logger=require(_0x413d('0x4'))(_0x413d('0x5'));var config=require(_0x413d('0x6'));var jayson=require(_0x413d('0x7'));var client=jayson['client'][_0x413d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x56ed2e,_0x25af8b,_0x5ee773){return new BPromise(function(_0x2e2457,_0x1b2dc4){return client[_0x413d('0x9')](_0x56ed2e,_0x5ee773)['then'](function(_0x4d31b8){logger[_0x413d('0xa')](_0x413d('0xb'),_0x25af8b,_0x413d('0xc'));logger[_0x413d('0xd')](_0x413d('0xe'),_0x25af8b,_0x413d('0xc'),JSON[_0x413d('0xf')](_0x4d31b8));if(_0x4d31b8[_0x413d('0x10')]){if(_0x4d31b8['error'][_0x413d('0x11')]===0x1f4){logger[_0x413d('0x10')](_0x413d('0xb'),_0x25af8b,_0x4d31b8[_0x413d('0x10')][_0x413d('0x12')]);return _0x1b2dc4(_0x4d31b8[_0x413d('0x10')][_0x413d('0x12')]);}logger['error'](_0x413d('0xb'),_0x25af8b,_0x4d31b8[_0x413d('0x10')][_0x413d('0x12')]);return _0x2e2457(_0x4d31b8[_0x413d('0x10')][_0x413d('0x12')]);}else{logger['info'](_0x413d('0xb'),_0x25af8b,_0x413d('0xc'));_0x2e2457(_0x4d31b8[_0x413d('0x13')][_0x413d('0x12')]);}})['catch'](function(_0x3a3ad7){logger[_0x413d('0x10')](_0x413d('0xb'),_0x25af8b,_0x3a3ad7);_0x1b2dc4(_0x3a3ad7);});});} \ No newline at end of file +var _0x5c38=['http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x21255b,_0x18a038){var _0x401d85=function(_0x5179a1){while(--_0x5179a1){_0x21255b['push'](_0x21255b['shift']());}};_0x401d85(++_0x18a038);}(_0x5c38,0x1f0));var _0x85c3=function(_0x2bf66e,_0xfb08f0){_0x2bf66e=_0x2bf66e-0x0;var _0x10179b=_0x5c38[_0x2bf66e];return _0x10179b;};'use strict';var _=require(_0x85c3('0x0'));var util=require(_0x85c3('0x1'));var moment=require(_0x85c3('0x2'));var BPromise=require(_0x85c3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x85c3('0x4'));var db=require(_0x85c3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x85c3('0x6'))('rpc');var config=require(_0x85c3('0x7'));var jayson=require(_0x85c3('0x8'));var client=jayson[_0x85c3('0x9')][_0x85c3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1153bd,_0x4db231,_0x403e7f){return new BPromise(function(_0x358fb6,_0x154611){return client[_0x85c3('0xb')](_0x1153bd,_0x403e7f)[_0x85c3('0xc')](function(_0x50e0f4){logger[_0x85c3('0xd')](_0x85c3('0xe'),_0x4db231,_0x85c3('0xf'));logger[_0x85c3('0x10')](_0x85c3('0x11'),_0x4db231,_0x85c3('0xf'),JSON[_0x85c3('0x12')](_0x50e0f4));if(_0x50e0f4['error']){if(_0x50e0f4[_0x85c3('0x13')]['code']===0x1f4){logger['error'](_0x85c3('0xe'),_0x4db231,_0x50e0f4[_0x85c3('0x13')][_0x85c3('0x14')]);return _0x154611(_0x50e0f4['error']['message']);}logger[_0x85c3('0x13')](_0x85c3('0xe'),_0x4db231,_0x50e0f4[_0x85c3('0x13')]['message']);return _0x358fb6(_0x50e0f4[_0x85c3('0x13')][_0x85c3('0x14')]);}else{logger[_0x85c3('0xd')](_0x85c3('0xe'),_0x4db231,'request\x20sent');_0x358fb6(_0x50e0f4[_0x85c3('0x15')][_0x85c3('0x14')]);}})[_0x85c3('0x16')](function(_0x1571de){logger[_0x85c3('0x13')]('VtigerField,\x20%s,\x20%s',_0x4db231,_0x1571de);_0x154611(_0x1571de);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index ff9d755..53899cd 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 _0xd965=['post','create','/:id/configurations','put','delete','destroy','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','getConfigurations','getFields'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0xd965,0x15b));var _0x5d96=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd965[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x5d96('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5d96('0x1'));var router=express[_0x5d96('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x5d96('0x3'));var interaction=require(_0x5d96('0x4'));var config=require(_0x5d96('0x5'));var controller=require('./intZendeskAccount.controller');router[_0x5d96('0x6')]('/',auth[_0x5d96('0x7')](),controller[_0x5d96('0x8')]);router[_0x5d96('0x6')](_0x5d96('0x9'),auth[_0x5d96('0x7')](),controller[_0x5d96('0xa')]);router[_0x5d96('0x6')]('/:id/configurations',auth[_0x5d96('0x7')](),controller[_0x5d96('0xb')]);router[_0x5d96('0x6')]('/:id/fields',auth[_0x5d96('0x7')](),controller[_0x5d96('0xc')]);router[_0x5d96('0xd')]('/',auth[_0x5d96('0x7')](),controller[_0x5d96('0xe')]);router[_0x5d96('0xd')](_0x5d96('0xf'),auth[_0x5d96('0x7')](),controller['addConfiguration']);router[_0x5d96('0x10')](_0x5d96('0x9'),auth[_0x5d96('0x7')](),controller['update']);router[_0x5d96('0x11')](_0x5d96('0x9'),auth[_0x5d96('0x7')](),controller[_0x5d96('0x12')]);module[_0x5d96('0x13')]=router; \ No newline at end of file +var _0xaf11=['get','index','/:id','isAuthenticated','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskAccount.controller'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0xaf11,0x12f));var _0x1af1=function(_0x4b4190,_0x493353){_0x4b4190=_0x4b4190-0x0;var _0x6df6de=_0xaf11[_0x4b4190];return _0x6df6de;};'use strict';var multer=require(_0x1af1('0x0'));var util=require(_0x1af1('0x1'));var path=require(_0x1af1('0x2'));var timeout=require(_0x1af1('0x3'));var express=require('express');var router=express[_0x1af1('0x4')]();var fs_extra=require(_0x1af1('0x5'));var auth=require(_0x1af1('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1af1('0x7'));var controller=require(_0x1af1('0x8'));router[_0x1af1('0x9')]('/',auth['isAuthenticated'](),controller[_0x1af1('0xa')]);router['get'](_0x1af1('0xb'),auth[_0x1af1('0xc')](),controller['show']);router[_0x1af1('0x9')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x1af1('0xd')]);router[_0x1af1('0x9')](_0x1af1('0xe'),auth[_0x1af1('0xc')](),controller[_0x1af1('0xf')]);router[_0x1af1('0x10')]('/',auth['isAuthenticated'](),controller[_0x1af1('0x11')]);router[_0x1af1('0x10')](_0x1af1('0x12'),auth[_0x1af1('0xc')](),controller[_0x1af1('0x13')]);router[_0x1af1('0x14')](_0x1af1('0xb'),auth['isAuthenticated'](),controller[_0x1af1('0x15')]);router[_0x1af1('0x16')](_0x1af1('0xb'),auth[_0x1af1('0xc')](),controller['destroy']);module[_0x1af1('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 5481d4f..8adfa1c 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 _0x7ee1=['integrationTab','sequelize','STRING','username','remoteUri','ENUM','password'];(function(_0x5316e6,_0x239d65){var _0x588fef=function(_0x3a7c6c){while(--_0x3a7c6c){_0x5316e6['push'](_0x5316e6['shift']());}};_0x588fef(++_0x239d65);}(_0x7ee1,0x8d));var _0x17ee=function(_0x401642,_0x4180aa){_0x401642=_0x401642-0x0;var _0x5b7096=_0x7ee1[_0x401642];return _0x5b7096;};'use strict';var Sequelize=require(_0x17ee('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x17ee('0x1')],'unique':_0x17ee('0x2')},'password':{'type':Sequelize[_0x17ee('0x1')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x17ee('0x1')],'unique':_0x17ee('0x3')},'authType':{'type':Sequelize[_0x17ee('0x4')](_0x17ee('0x5'),'token'),'defaultValue':_0x17ee('0x5')},'serverUrl':{'type':Sequelize[_0x17ee('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x17ee('0x6'),'newTab'),'defaultValue':_0x17ee('0x6')}}; \ No newline at end of file +var _0x598a=['token','newTab','integrationTab','sequelize','exports','STRING','ENUM','password'];(function(_0x18f152,_0x41585a){var _0xa10b34=function(_0x1e9798){while(--_0x1e9798){_0x18f152['push'](_0x18f152['shift']());}};_0xa10b34(++_0x41585a);}(_0x598a,0xfb));var _0xa598=function(_0x1b738c,_0x5a54fb){_0x1b738c=_0x1b738c-0x0;var _0x188a82=_0x598a[_0x1b738c];return _0x188a82;};'use strict';var Sequelize=require(_0xa598('0x0'));module[_0xa598('0x1')]={'name':{'type':Sequelize[_0xa598('0x2')]},'description':{'type':Sequelize[_0xa598('0x2')]},'username':{'type':Sequelize[_0xa598('0x2')],'unique':'username'},'password':{'type':Sequelize[_0xa598('0x2')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'authType':{'type':Sequelize[_0xa598('0x3')](_0xa598('0x4'),_0xa598('0x5')),'defaultValue':_0xa598('0x4')},'serverUrl':{'type':Sequelize[_0xa598('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab',_0xa598('0x6')),'defaultValue':_0xa598('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index c067158..11272d6 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 _0x58a4=['model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','ZendeskAccount','include','findAll','rows','catch','params','rawAttributes','includeAll','find','create','body','getConfigurations','findOne','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskConfiguration','ZendeskField','getFields','password','token','remoteUri','slice','substring','lastIndexOf','format','authType','headers','Basic\x20%s','%s:%s','username','toString','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','assignee','ticket_fields','includes','position','title','system_field_options','custom_field_options','test','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','end','sendStatus','stack','name','send','map','type'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x58a4,0xbf));var _0x458a=function(_0x1c7586,_0x1d46bd){_0x1c7586=_0x1c7586-0x0;var _0x3bd9a1=_0x58a4[_0x1c7586];return _0x3bd9a1;};'use strict';var emlformat=require(_0x458a('0x0'));var rimraf=require(_0x458a('0x1'));var zipdir=require(_0x458a('0x2'));var jsonpatch=require(_0x458a('0x3'));var rp=require(_0x458a('0x4'));var moment=require(_0x458a('0x5'));var BPromise=require(_0x458a('0x6'));var Mustache=require(_0x458a('0x7'));var util=require(_0x458a('0x8'));var path=require(_0x458a('0x9'));var sox=require(_0x458a('0xa'));var csv=require(_0x458a('0xb'));var ejs=require(_0x458a('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x458a('0xd'));var crypto=require(_0x458a('0xe'));var jsforce=require(_0x458a('0xf'));var deskjs=require(_0x458a('0x10'));var toCsv=require(_0x458a('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x458a('0x11'));var authService=require(_0x458a('0x12'));var qs=require(_0x458a('0x13'));var as=require(_0x458a('0x14'));var hardwareService=require(_0x458a('0x15'));var logger=require('../../config/logger')(_0x458a('0x16'));var utils=require(_0x458a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x458a('0x18'));var db=require(_0x458a('0x19'))['db'];var integrations=require(_0x458a('0x1a'));function respondWithStatusCode(_0x2a4934,_0x2e788b){_0x2e788b=_0x2e788b||0xcc;return function(_0x5bd09e){if(_0x5bd09e){return _0x2a4934['sendStatus'](_0x2e788b);}return _0x2a4934[_0x458a('0x1b')](_0x2e788b)['end']();};}function respondWithResult(_0x2c7528,_0x44f683){_0x44f683=_0x44f683||0xc8;return function(_0x10133b){if(_0x10133b){return _0x2c7528[_0x458a('0x1b')](_0x44f683)[_0x458a('0x1c')](_0x10133b);}};}function respondWithFilteredResult(_0x29acee,_0x507b0f){return function(_0x4b26be){if(_0x4b26be){var _0x5c7993=typeof _0x507b0f[_0x458a('0x1d')]===_0x458a('0x1e')&&typeof _0x507b0f[_0x458a('0x1f')]==='undefined';var _0x310569=_0x4b26be[_0x458a('0x20')];var _0x18504d=_0x5c7993?0x0:_0x507b0f[_0x458a('0x1d')];var _0xa91473=_0x5c7993?_0x4b26be['count']:_0x507b0f['offset']+_0x507b0f[_0x458a('0x1f')];var _0x4d07a7;if(_0xa91473>=_0x310569){_0xa91473=_0x310569;_0x4d07a7=0xc8;}else{_0x4d07a7=0xce;}_0x29acee[_0x458a('0x1b')](_0x4d07a7);return _0x29acee[_0x458a('0x21')]('Content-Range',_0x18504d+'-'+_0xa91473+'/'+_0x310569)[_0x458a('0x1c')](_0x4b26be);}return null;};}function patchUpdates(_0x55a588){return function(_0x200213){try{jsonpatch[_0x458a('0x22')](_0x200213,_0x55a588,!![]);}catch(_0x59f44c){return BPromise[_0x458a('0x23')](_0x59f44c);}return _0x200213[_0x458a('0x24')]();};}function saveUpdates(_0x5a2bcb,_0xa6b8ff){return function(_0x5ad95a){if(_0x5ad95a){return _0x5ad95a[_0x458a('0x25')](_0x5a2bcb)['then'](function(_0x4080fc){return _0x4080fc;});}return null;};}function removeEntity(_0x5dfc6c,_0x36b08e){return function(_0x911eaf){if(_0x911eaf){return _0x911eaf[_0x458a('0x26')]()[_0x458a('0x27')](function(){_0x5dfc6c[_0x458a('0x1b')](0xcc)[_0x458a('0x28')]();});}};}function handleEntityNotFound(_0x340375,_0x3012c7){return function(_0x1f2d0){if(!_0x1f2d0){_0x340375[_0x458a('0x29')](0x194);}return _0x1f2d0;};}function handleError(_0x52efed,_0x327fcb){_0x327fcb=_0x327fcb||0x1f4;return function(_0x21ec38){logger['error'](_0x21ec38[_0x458a('0x2a')]);if(_0x21ec38[_0x458a('0x2b')]){delete _0x21ec38['name'];}_0x52efed['status'](_0x327fcb)[_0x458a('0x2c')](_0x21ec38);};}exports['index']=function(_0x33c5d8,_0x29f9b5){var _0x223f73={},_0x4a49e4={},_0xa6fdf={'count':0x0,'rows':[]};var _0x2531f7=_[_0x458a('0x2d')](db['ZendeskAccount']['rawAttributes'],function(_0x18c890){return{'name':_0x18c890['fieldName'],'type':_0x18c890[_0x458a('0x2e')]['key']};});_0x4a49e4[_0x458a('0x2f')]=_[_0x458a('0x2d')](_0x2531f7,'name');_0x4a49e4[_0x458a('0x30')]=_[_0x458a('0x31')](_0x33c5d8[_0x458a('0x30')]);_0x4a49e4['filters']=_[_0x458a('0x32')](_0x4a49e4[_0x458a('0x2f')],_0x4a49e4[_0x458a('0x30')]);_0x223f73[_0x458a('0x33')]=_[_0x458a('0x32')](_0x4a49e4['model'],qs[_0x458a('0x34')](_0x33c5d8[_0x458a('0x30')][_0x458a('0x34')]));_0x223f73[_0x458a('0x33')]=_0x223f73[_0x458a('0x33')][_0x458a('0x35')]?_0x223f73['attributes']:_0x4a49e4[_0x458a('0x2f')];if(!_0x33c5d8[_0x458a('0x30')][_0x458a('0x36')](_0x458a('0x37'))){_0x223f73[_0x458a('0x1f')]=qs[_0x458a('0x1f')](_0x33c5d8[_0x458a('0x30')][_0x458a('0x1f')]);_0x223f73[_0x458a('0x1d')]=qs['offset'](_0x33c5d8[_0x458a('0x30')][_0x458a('0x1d')]);}_0x223f73[_0x458a('0x38')]=qs[_0x458a('0x39')](_0x33c5d8[_0x458a('0x30')][_0x458a('0x39')]);_0x223f73[_0x458a('0x3a')]=qs[_0x458a('0x3b')](_[_0x458a('0x3c')](_0x33c5d8[_0x458a('0x30')],_0x4a49e4[_0x458a('0x3b')]),_0x2531f7);if(_0x33c5d8[_0x458a('0x30')][_0x458a('0x3d')]){_0x223f73[_0x458a('0x3a')]=_[_0x458a('0x3e')](_0x223f73['where'],{'$or':_[_0x458a('0x2d')](_0x2531f7,function(_0x397a41){if(_0x397a41[_0x458a('0x2e')]!==_0x458a('0x3f')){var _0x3c5840={};_0x3c5840[_0x397a41[_0x458a('0x2b')]]={'$like':'%'+_0x33c5d8[_0x458a('0x30')][_0x458a('0x3d')]+'%'};return _0x3c5840;}})});}_0x223f73=_[_0x458a('0x3e')]({},_0x223f73,_0x33c5d8[_0x458a('0x40')]);var _0x20cf10={'where':_0x223f73['where']};return db[_0x458a('0x41')][_0x458a('0x20')](_0x20cf10)['then'](function(_0x430bda){_0xa6fdf[_0x458a('0x20')]=_0x430bda;if(_0x33c5d8[_0x458a('0x30')]['includeAll']){_0x223f73[_0x458a('0x42')]=[{'all':!![]}];}return db[_0x458a('0x41')][_0x458a('0x43')](_0x223f73);})[_0x458a('0x27')](function(_0xbcd632){_0xa6fdf[_0x458a('0x44')]=_0xbcd632;return _0xa6fdf;})[_0x458a('0x27')](respondWithFilteredResult(_0x29f9b5,_0x223f73))[_0x458a('0x45')](handleError(_0x29f9b5,null));};exports['show']=function(_0x296385,_0x145e3c){var _0x2b9030={'raw':![],'where':{'id':_0x296385[_0x458a('0x46')]['id']}},_0x5180ae={};_0x5180ae[_0x458a('0x2f')]=_['keys'](db[_0x458a('0x41')][_0x458a('0x47')]);_0x5180ae[_0x458a('0x30')]=_[_0x458a('0x31')](_0x296385[_0x458a('0x30')]);_0x5180ae['filters']=_['intersection'](_0x5180ae[_0x458a('0x2f')],_0x5180ae[_0x458a('0x30')]);_0x2b9030[_0x458a('0x33')]=_[_0x458a('0x32')](_0x5180ae['model'],qs[_0x458a('0x34')](_0x296385[_0x458a('0x30')]['fields']));_0x2b9030[_0x458a('0x33')]=_0x2b9030['attributes'][_0x458a('0x35')]?_0x2b9030[_0x458a('0x33')]:_0x5180ae[_0x458a('0x2f')];if(_0x296385['query'][_0x458a('0x48')]){_0x2b9030[_0x458a('0x42')]=[{'all':!![]}];}_0x2b9030=_[_0x458a('0x3e')]({},_0x2b9030,_0x296385['options']);return db['ZendeskAccount'][_0x458a('0x49')](_0x2b9030)[_0x458a('0x27')](handleEntityNotFound(_0x145e3c,null))[_0x458a('0x27')](respondWithResult(_0x145e3c,null))['catch'](handleError(_0x145e3c,null));};exports['create']=function(_0x3a7005,_0xf362b5){return db[_0x458a('0x41')][_0x458a('0x4a')](_0x3a7005[_0x458a('0x4b')],{})[_0x458a('0x27')](respondWithResult(_0xf362b5,0xc9))[_0x458a('0x45')](handleError(_0xf362b5,null));};exports[_0x458a('0x25')]=function(_0xb22232,_0x213f86){if(_0xb22232[_0x458a('0x4b')]['id']){delete _0xb22232[_0x458a('0x4b')]['id'];}return db[_0x458a('0x41')][_0x458a('0x49')]({'where':{'id':_0xb22232[_0x458a('0x46')]['id']}})[_0x458a('0x27')](handleEntityNotFound(_0x213f86,null))['then'](saveUpdates(_0xb22232[_0x458a('0x4b')],null))[_0x458a('0x27')](respondWithResult(_0x213f86,null))[_0x458a('0x45')](handleError(_0x213f86,null));};exports[_0x458a('0x26')]=function(_0x44670a,_0x5630cf){return db['ZendeskAccount']['find']({'where':{'id':_0x44670a[_0x458a('0x46')]['id']}})['then'](handleEntityNotFound(_0x5630cf,null))[_0x458a('0x27')](removeEntity(_0x5630cf,null))[_0x458a('0x45')](handleError(_0x5630cf,null));};exports[_0x458a('0x4c')]=function(_0x649553,_0xfa6e65,_0x5f0151){var _0x48f68e={};var _0x3d7616={};var _0x2d8b77;var _0x2587a1;return db[_0x458a('0x41')][_0x458a('0x4d')]({'where':{'id':_0x649553['params']['id']}})[_0x458a('0x27')](handleEntityNotFound(_0xfa6e65,null))['then'](function(_0xa51e28){if(_0xa51e28){_0x2d8b77=_0xa51e28;_0x3d7616['model']=_[_0x458a('0x31')](db['ZendeskConfiguration']['rawAttributes']);_0x3d7616['query']=_[_0x458a('0x31')](_0x649553[_0x458a('0x30')]);_0x3d7616['filters']=_[_0x458a('0x32')](_0x3d7616[_0x458a('0x2f')],_0x3d7616[_0x458a('0x30')]);_0x48f68e['attributes']=_[_0x458a('0x32')](_0x3d7616[_0x458a('0x2f')],qs[_0x458a('0x34')](_0x649553[_0x458a('0x30')][_0x458a('0x34')]));_0x48f68e[_0x458a('0x33')]=_0x48f68e['attributes'][_0x458a('0x35')]?_0x48f68e[_0x458a('0x33')]:_0x3d7616[_0x458a('0x2f')];_0x48f68e[_0x458a('0x38')]=qs[_0x458a('0x39')](_0x649553[_0x458a('0x30')][_0x458a('0x39')]);_0x48f68e[_0x458a('0x3a')]=qs['filters'](_[_0x458a('0x3c')](_0x649553['query'],_0x3d7616[_0x458a('0x3b')]));if(_0x649553[_0x458a('0x30')][_0x458a('0x3d')]){_0x48f68e[_0x458a('0x3a')]=_['merge'](_0x48f68e['where'],{'$or':_[_0x458a('0x2d')](_0x48f68e[_0x458a('0x33')],function(_0x2b9aac){var _0x156a22={};_0x156a22[_0x2b9aac]={'$like':'%'+_0x649553[_0x458a('0x30')][_0x458a('0x3d')]+'%'};return _0x156a22;})});}_0x48f68e=_['merge']({},_0x48f68e,_0x649553[_0x458a('0x40')]);return _0x2d8b77[_0x458a('0x4c')](_0x48f68e);}})['then'](function(_0x18d83a){if(_0x18d83a){_0x2587a1=_0x18d83a['length'];if(!_0x649553[_0x458a('0x30')][_0x458a('0x36')](_0x458a('0x37'))){_0x48f68e[_0x458a('0x1f')]=qs[_0x458a('0x1f')](_0x649553[_0x458a('0x30')][_0x458a('0x1f')]);_0x48f68e[_0x458a('0x1d')]=qs['offset'](_0x649553[_0x458a('0x30')][_0x458a('0x1d')]);}return _0x2d8b77['getConfigurations'](_0x48f68e);}})[_0x458a('0x27')](function(_0x3da617){if(_0x3da617){return _0x3da617?{'count':_0x2587a1,'rows':_0x3da617}:null;}})['then'](respondWithResult(_0xfa6e65,null))[_0x458a('0x45')](handleError(_0xfa6e65,null));};exports[_0x458a('0x4e')]=function(_0x47cbcf,_0x17b611,_0x180df0){if(_0x47cbcf['body']['id']){delete _0x47cbcf[_0x458a('0x4b')]['id'];}return db[_0x458a('0x41')][_0x458a('0x4d')]({'where':{'id':_0x47cbcf[_0x458a('0x46')]['id']}})[_0x458a('0x27')](handleEntityNotFound(_0x17b611,null))[_0x458a('0x27')](function(_0x4199a7){if(_0x4199a7){_0x47cbcf[_0x458a('0x4b')]['AccountId']=_0x4199a7['id'];_0x47cbcf[_0x458a('0x4b')][_0x458a('0x4f')]=integrations[_0x458a('0x50')](_0x47cbcf[_0x458a('0x4b')][_0x458a('0x51')],_0x47cbcf[_0x458a('0x4b')][_0x458a('0x2e')]);_0x47cbcf[_0x458a('0x4b')][_0x458a('0x52')]=integrations[_0x458a('0x53')](_0x47cbcf['body'][_0x458a('0x51')],_0x47cbcf['body'][_0x458a('0x2e')]);return db[_0x458a('0x54')][_0x458a('0x4a')](_0x47cbcf[_0x458a('0x4b')],{'include':[{'model':db[_0x458a('0x55')],'as':_0x458a('0x4f')},{'model':db[_0x458a('0x55')],'as':_0x458a('0x52')}]});}return null;})[_0x458a('0x27')](respondWithResult(_0x17b611,null))[_0x458a('0x45')](handleError(_0x17b611,null));};exports[_0x458a('0x56')]=function(_0x448cbc,_0x11bbba,_0x435884){var _0x3948aa='';return db[_0x458a('0x41')]['findOne']({'where':{'id':_0x448cbc[_0x458a('0x46')]['id']},'attributes':['id','username',_0x458a('0x57'),_0x458a('0x58'),'authType',_0x458a('0x59')]})[_0x458a('0x27')](handleEntityNotFound(_0x11bbba,null))[_0x458a('0x27')](function(_0x494710){if(_0x494710){_0x3948aa=_0x494710[_0x458a('0x59')];var _0xed002=_0x3948aa[_0x458a('0x5a')](-0x1);if(_0xed002==='/'){_0x3948aa=_0x3948aa[_0x458a('0x5b')](0x0,_0x3948aa[_0x458a('0x5c')](_0xed002));}var _0x42f213={'method':'GET','uri':util[_0x458a('0x5d')]('%s/%s',_0x3948aa,'ticket_fields'),'json':!![]};switch(_0x494710[_0x458a('0x5e')]){case _0x458a('0x57'):_0x42f213[_0x458a('0x5f')]={'Authorization':util[_0x458a('0x5d')](_0x458a('0x60'),new Buffer(util[_0x458a('0x5d')](_0x458a('0x61'),_0x494710[_0x458a('0x62')],_0x494710[_0x458a('0x57')]))[_0x458a('0x63')](_0x458a('0x64')))};break;case _0x458a('0x58'):_0x42f213[_0x458a('0x5f')]={'Authorization':util[_0x458a('0x5d')]('Basic\x20%s',new Buffer(util['format']('%s/token:%s',_0x494710[_0x458a('0x62')],_0x494710['token']))[_0x458a('0x63')](_0x458a('0x64')))};break;default:throw new db[(_0x458a('0x65'))][(_0x458a('0x66'))](_0x458a('0x67'));}return rp(_0x42f213);}})[_0x458a('0x27')](function(_0x46df7c){if(_0x46df7c){var _0x49f3ee=[_0x458a('0x68'),_0x458a('0x69'),'group',_0x458a('0x6a')];_['remove'](_0x46df7c[_0x458a('0x6b')],function(_0x58d29d){return _0x49f3ee[_0x458a('0x6c')](_0x58d29d[_0x458a('0x2e')]);});return{'count':_0x46df7c[_0x458a('0x6b')][_0x458a('0x35')],'rows':_['map'](_0x46df7c[_0x458a('0x6b')],function(_0x14b95e){return{'id':_0x14b95e['id'],'name':_0x14b95e[_0x458a('0x6d')]>0x7?_0x14b95e[_0x458a('0x6e')]:_0x14b95e[_0x458a('0x2e')],'custom':_0x14b95e[_0x458a('0x6d')]>0x7?!![]:![],'options':_0x14b95e[_0x458a('0x6f')]?_0x14b95e[_0x458a('0x6f')]:_0x14b95e['custom_field_options']?_0x14b95e[_0x458a('0x70')]:[]};})};}})[_0x458a('0x27')](respondWithResult(_0x11bbba,null))[_0x458a('0x45')](function(_0x4212af){var _0x591dbb=_0x448cbc[_0x458a('0x30')][_0x458a('0x71')]?0x1f4:_0x4212af['statusCode']||0x1f4;logger[_0x458a('0x72')](_0x458a('0x73'),_0x458a('0x56'),_0x591dbb,JSON[_0x458a('0x74')](_0x4212af));delete _0x4212af[_0x458a('0x2b')];if(_0x591dbb===0x191){_0x591dbb=0x190;}_0x11bbba['status'](_0x591dbb)[_0x458a('0x2c')](_0x448cbc[_0x458a('0x30')][_0x458a('0x71')]?{'message':_0x458a('0x75'),'statusCode':_0x4212af[_0x458a('0x76')]}:_0x4212af);});}; \ No newline at end of file +var _0xe511=['getConfigurations','addConfiguration','findOne','Subjects','getSubjects','channel','Descriptions','ZendeskConfiguration','create','getFields','username','password','authType','remoteUri','substring','format','ticket_fields','headers','Basic\x20%s','%s:%s','toString','token','%s/token:%s','base64','ValidationError','Unknown\x20authentication\x20type','subject','description','assignee','remove','includes','position','system_field_options','custom_field_options','send','test','statusCode','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','update','then','stack','index','fieldName','type','key','model','map','name','query','keys','filters','attributes','intersection','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','ZendeskAccount','includeAll','include','findAll','catch','show','params','rawAttributes','fields','options','body','find','nolimit'];(function(_0xde041,_0xce2c39){var _0x4b0b98=function(_0x53532d){while(--_0x53532d){_0xde041['push'](_0xde041['shift']());}};_0x4b0b98(++_0xce2c39);}(_0xe511,0x16f));var _0x1e51=function(_0x53bec3,_0x550a58){_0x53bec3=_0x53bec3-0x0;var _0x159317=_0xe511[_0x53bec3];return _0x159317;};'use strict';var emlformat=require(_0x1e51('0x0'));var rimraf=require(_0x1e51('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1e51('0x2'));var rp=require('request-promise');var moment=require(_0x1e51('0x3'));var BPromise=require(_0x1e51('0x4'));var Mustache=require('mustache');var util=require(_0x1e51('0x5'));var path=require(_0x1e51('0x6'));var sox=require(_0x1e51('0x7'));var csv=require(_0x1e51('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1e51('0x9'));var _=require(_0x1e51('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1e51('0xb'));var deskjs=require(_0x1e51('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1e51('0xd'));var Redis=require(_0x1e51('0xe'));var authService=require(_0x1e51('0xf'));var qs=require(_0x1e51('0x10'));var as=require(_0x1e51('0x11'));var hardwareService=require(_0x1e51('0x12'));var logger=require('../../config/logger')(_0x1e51('0x13'));var utils=require(_0x1e51('0x14'));var config=require(_0x1e51('0x15'));var licenseUtil=require(_0x1e51('0x16'));var db=require(_0x1e51('0x17'))['db'];var integrations=require(_0x1e51('0x18'));function respondWithStatusCode(_0x5544eb,_0x408a77){_0x408a77=_0x408a77||0xcc;return function(_0x102f01){if(_0x102f01){return _0x5544eb[_0x1e51('0x19')](_0x408a77);}return _0x5544eb[_0x1e51('0x1a')](_0x408a77)[_0x1e51('0x1b')]();};}function respondWithResult(_0x32945d,_0x441c70){_0x441c70=_0x441c70||0xc8;return function(_0x467e77){if(_0x467e77){return _0x32945d[_0x1e51('0x1a')](_0x441c70)[_0x1e51('0x1c')](_0x467e77);}};}function respondWithFilteredResult(_0x5a5c07,_0x3b01b7){return function(_0x24db4f){if(_0x24db4f){var _0x4526b4=typeof _0x3b01b7['offset']===_0x1e51('0x1d')&&typeof _0x3b01b7['limit']==='undefined';var _0x1f6f4e=_0x24db4f[_0x1e51('0x1e')];var _0x40ae4c=_0x4526b4?0x0:_0x3b01b7[_0x1e51('0x1f')];var _0x4d1aae=_0x4526b4?_0x24db4f[_0x1e51('0x1e')]:_0x3b01b7['offset']+_0x3b01b7[_0x1e51('0x20')];var _0x4a9272;if(_0x4d1aae>=_0x1f6f4e){_0x4d1aae=_0x1f6f4e;_0x4a9272=0xc8;}else{_0x4a9272=0xce;}_0x5a5c07[_0x1e51('0x1a')](_0x4a9272);return _0x5a5c07[_0x1e51('0x21')](_0x1e51('0x22'),_0x40ae4c+'-'+_0x4d1aae+'/'+_0x1f6f4e)[_0x1e51('0x1c')](_0x24db4f);}return null;};}function patchUpdates(_0x506f40){return function(_0x5223c3){try{jsonpatch['apply'](_0x5223c3,_0x506f40,!![]);}catch(_0x548c32){return BPromise[_0x1e51('0x23')](_0x548c32);}return _0x5223c3['save']();};}function saveUpdates(_0x3f7340,_0x28aacb){return function(_0x415154){if(_0x415154){return _0x415154[_0x1e51('0x24')](_0x3f7340)[_0x1e51('0x25')](function(_0xf9298){return _0xf9298;});}return null;};}function removeEntity(_0x270adf,_0x461d3d){return function(_0x4bcdd3){if(_0x4bcdd3){return _0x4bcdd3['destroy']()[_0x1e51('0x25')](function(){_0x270adf[_0x1e51('0x1a')](0xcc)[_0x1e51('0x1b')]();});}};}function handleEntityNotFound(_0x1386db,_0x505d79){return function(_0x54d031){if(!_0x54d031){_0x1386db['sendStatus'](0x194);}return _0x54d031;};}function handleError(_0x1eb83f,_0x2a1561){_0x2a1561=_0x2a1561||0x1f4;return function(_0x433c2d){logger['error'](_0x433c2d[_0x1e51('0x26')]);if(_0x433c2d['name']){delete _0x433c2d['name'];}_0x1eb83f[_0x1e51('0x1a')](_0x2a1561)['send'](_0x433c2d);};}exports[_0x1e51('0x27')]=function(_0x1eb79f,_0x56722f){var _0x3e6ef2={},_0x10ee23={},_0x71c7af={'count':0x0,'rows':[]};var _0x6862d1=_['map'](db['ZendeskAccount']['rawAttributes'],function(_0x20eb9b){return{'name':_0x20eb9b[_0x1e51('0x28')],'type':_0x20eb9b[_0x1e51('0x29')][_0x1e51('0x2a')]};});_0x10ee23[_0x1e51('0x2b')]=_[_0x1e51('0x2c')](_0x6862d1,_0x1e51('0x2d'));_0x10ee23[_0x1e51('0x2e')]=_[_0x1e51('0x2f')](_0x1eb79f[_0x1e51('0x2e')]);_0x10ee23[_0x1e51('0x30')]=_['intersection'](_0x10ee23[_0x1e51('0x2b')],_0x10ee23[_0x1e51('0x2e')]);_0x3e6ef2[_0x1e51('0x31')]=_[_0x1e51('0x32')](_0x10ee23[_0x1e51('0x2b')],qs['fields'](_0x1eb79f[_0x1e51('0x2e')]['fields']));_0x3e6ef2[_0x1e51('0x31')]=_0x3e6ef2[_0x1e51('0x31')][_0x1e51('0x33')]?_0x3e6ef2['attributes']:_0x10ee23[_0x1e51('0x2b')];if(!_0x1eb79f['query'][_0x1e51('0x34')]('nolimit')){_0x3e6ef2['limit']=qs[_0x1e51('0x20')](_0x1eb79f[_0x1e51('0x2e')][_0x1e51('0x20')]);_0x3e6ef2['offset']=qs[_0x1e51('0x1f')](_0x1eb79f['query'][_0x1e51('0x1f')]);}_0x3e6ef2[_0x1e51('0x35')]=qs['sort'](_0x1eb79f[_0x1e51('0x2e')][_0x1e51('0x36')]);_0x3e6ef2[_0x1e51('0x37')]=qs[_0x1e51('0x30')](_[_0x1e51('0x38')](_0x1eb79f[_0x1e51('0x2e')],_0x10ee23['filters']),_0x6862d1);if(_0x1eb79f['query'][_0x1e51('0x39')]){_0x3e6ef2['where']=_[_0x1e51('0x3a')](_0x3e6ef2[_0x1e51('0x37')],{'$or':_[_0x1e51('0x2c')](_0x6862d1,function(_0xcfa1d8){if(_0xcfa1d8[_0x1e51('0x29')]!==_0x1e51('0x3b')){var _0x845a62={};_0x845a62[_0xcfa1d8[_0x1e51('0x2d')]]={'$like':'%'+_0x1eb79f[_0x1e51('0x2e')][_0x1e51('0x39')]+'%'};return _0x845a62;}})});}_0x3e6ef2=_[_0x1e51('0x3a')]({},_0x3e6ef2,_0x1eb79f['options']);var _0x29a689={'where':_0x3e6ef2['where']};return db[_0x1e51('0x3c')][_0x1e51('0x1e')](_0x29a689)[_0x1e51('0x25')](function(_0x471386){_0x71c7af[_0x1e51('0x1e')]=_0x471386;if(_0x1eb79f[_0x1e51('0x2e')][_0x1e51('0x3d')]){_0x3e6ef2[_0x1e51('0x3e')]=[{'all':!![]}];}return db[_0x1e51('0x3c')][_0x1e51('0x3f')](_0x3e6ef2);})[_0x1e51('0x25')](function(_0x5b4b3f){_0x71c7af['rows']=_0x5b4b3f;return _0x71c7af;})[_0x1e51('0x25')](respondWithFilteredResult(_0x56722f,_0x3e6ef2))[_0x1e51('0x40')](handleError(_0x56722f,null));};exports[_0x1e51('0x41')]=function(_0x4650e4,_0x1ef3d3){var _0x1a9e0d={'raw':![],'where':{'id':_0x4650e4[_0x1e51('0x42')]['id']}},_0x25592c={};_0x25592c['model']=_[_0x1e51('0x2f')](db[_0x1e51('0x3c')][_0x1e51('0x43')]);_0x25592c[_0x1e51('0x2e')]=_[_0x1e51('0x2f')](_0x4650e4[_0x1e51('0x2e')]);_0x25592c[_0x1e51('0x30')]=_['intersection'](_0x25592c[_0x1e51('0x2b')],_0x25592c[_0x1e51('0x2e')]);_0x1a9e0d['attributes']=_[_0x1e51('0x32')](_0x25592c[_0x1e51('0x2b')],qs[_0x1e51('0x44')](_0x4650e4['query'][_0x1e51('0x44')]));_0x1a9e0d[_0x1e51('0x31')]=_0x1a9e0d[_0x1e51('0x31')][_0x1e51('0x33')]?_0x1a9e0d[_0x1e51('0x31')]:_0x25592c[_0x1e51('0x2b')];if(_0x4650e4[_0x1e51('0x2e')][_0x1e51('0x3d')]){_0x1a9e0d[_0x1e51('0x3e')]=[{'all':!![]}];}_0x1a9e0d=_['merge']({},_0x1a9e0d,_0x4650e4[_0x1e51('0x45')]);return db[_0x1e51('0x3c')]['find'](_0x1a9e0d)[_0x1e51('0x25')](handleEntityNotFound(_0x1ef3d3,null))[_0x1e51('0x25')](respondWithResult(_0x1ef3d3,null))[_0x1e51('0x40')](handleError(_0x1ef3d3,null));};exports['create']=function(_0x44468a,_0x4634de){return db[_0x1e51('0x3c')]['create'](_0x44468a[_0x1e51('0x46')],{})['then'](respondWithResult(_0x4634de,0xc9))['catch'](handleError(_0x4634de,null));};exports['update']=function(_0x169e6c,_0x2e79ca){if(_0x169e6c['body']['id']){delete _0x169e6c['body']['id'];}return db[_0x1e51('0x3c')][_0x1e51('0x47')]({'where':{'id':_0x169e6c[_0x1e51('0x42')]['id']}})[_0x1e51('0x25')](handleEntityNotFound(_0x2e79ca,null))[_0x1e51('0x25')](saveUpdates(_0x169e6c[_0x1e51('0x46')],null))['then'](respondWithResult(_0x2e79ca,null))[_0x1e51('0x40')](handleError(_0x2e79ca,null));};exports['destroy']=function(_0xf6bd35,_0x43589a){return db['ZendeskAccount']['find']({'where':{'id':_0xf6bd35['params']['id']}})[_0x1e51('0x25')](handleEntityNotFound(_0x43589a,null))[_0x1e51('0x25')](removeEntity(_0x43589a,null))[_0x1e51('0x40')](handleError(_0x43589a,null));};exports['getConfigurations']=function(_0x2fdee1,_0x1fe669,_0x4226da){var _0x2100d4={};var _0x1ccb55={};var _0x12584c;var _0x32fe1f;return db[_0x1e51('0x3c')]['findOne']({'where':{'id':_0x2fdee1[_0x1e51('0x42')]['id']}})[_0x1e51('0x25')](handleEntityNotFound(_0x1fe669,null))[_0x1e51('0x25')](function(_0x213edb){if(_0x213edb){_0x12584c=_0x213edb;_0x1ccb55[_0x1e51('0x2b')]=_[_0x1e51('0x2f')](db['ZendeskConfiguration'][_0x1e51('0x43')]);_0x1ccb55['query']=_['keys'](_0x2fdee1['query']);_0x1ccb55[_0x1e51('0x30')]=_[_0x1e51('0x32')](_0x1ccb55[_0x1e51('0x2b')],_0x1ccb55['query']);_0x2100d4[_0x1e51('0x31')]=_[_0x1e51('0x32')](_0x1ccb55[_0x1e51('0x2b')],qs['fields'](_0x2fdee1[_0x1e51('0x2e')][_0x1e51('0x44')]));_0x2100d4[_0x1e51('0x31')]=_0x2100d4['attributes'][_0x1e51('0x33')]?_0x2100d4[_0x1e51('0x31')]:_0x1ccb55[_0x1e51('0x2b')];_0x2100d4[_0x1e51('0x35')]=qs[_0x1e51('0x36')](_0x2fdee1[_0x1e51('0x2e')][_0x1e51('0x36')]);_0x2100d4[_0x1e51('0x37')]=qs['filters'](_[_0x1e51('0x38')](_0x2fdee1[_0x1e51('0x2e')],_0x1ccb55['filters']));if(_0x2fdee1['query']['filter']){_0x2100d4[_0x1e51('0x37')]=_[_0x1e51('0x3a')](_0x2100d4[_0x1e51('0x37')],{'$or':_[_0x1e51('0x2c')](_0x2100d4[_0x1e51('0x31')],function(_0x3c322c){var _0x45b649={};_0x45b649[_0x3c322c]={'$like':'%'+_0x2fdee1[_0x1e51('0x2e')][_0x1e51('0x39')]+'%'};return _0x45b649;})});}_0x2100d4=_['merge']({},_0x2100d4,_0x2fdee1['options']);return _0x12584c['getConfigurations'](_0x2100d4);}})[_0x1e51('0x25')](function(_0x4048a4){if(_0x4048a4){_0x32fe1f=_0x4048a4['length'];if(!_0x2fdee1['query'][_0x1e51('0x34')](_0x1e51('0x48'))){_0x2100d4['limit']=qs[_0x1e51('0x20')](_0x2fdee1[_0x1e51('0x2e')][_0x1e51('0x20')]);_0x2100d4[_0x1e51('0x1f')]=qs[_0x1e51('0x1f')](_0x2fdee1[_0x1e51('0x2e')][_0x1e51('0x1f')]);}return _0x12584c[_0x1e51('0x49')](_0x2100d4);}})[_0x1e51('0x25')](function(_0x32863f){if(_0x32863f){return _0x32863f?{'count':_0x32fe1f,'rows':_0x32863f}:null;}})['then'](respondWithResult(_0x1fe669,null))[_0x1e51('0x40')](handleError(_0x1fe669,null));};exports[_0x1e51('0x4a')]=function(_0x3657a2,_0x402bbd,_0xc720e2){if(_0x3657a2[_0x1e51('0x46')]['id']){delete _0x3657a2['body']['id'];}return db['ZendeskAccount'][_0x1e51('0x4b')]({'where':{'id':_0x3657a2[_0x1e51('0x42')]['id']}})[_0x1e51('0x25')](handleEntityNotFound(_0x402bbd,null))[_0x1e51('0x25')](function(_0x52a439){if(_0x52a439){_0x3657a2['body']['AccountId']=_0x52a439['id'];_0x3657a2[_0x1e51('0x46')][_0x1e51('0x4c')]=integrations[_0x1e51('0x4d')](_0x3657a2[_0x1e51('0x46')][_0x1e51('0x4e')],_0x3657a2['body'][_0x1e51('0x29')]);_0x3657a2[_0x1e51('0x46')][_0x1e51('0x4f')]=integrations['getDescriptions'](_0x3657a2[_0x1e51('0x46')][_0x1e51('0x4e')],_0x3657a2[_0x1e51('0x46')]['type']);return db[_0x1e51('0x50')][_0x1e51('0x51')](_0x3657a2['body'],{'include':[{'model':db['ZendeskField'],'as':_0x1e51('0x4c')},{'model':db['ZendeskField'],'as':_0x1e51('0x4f')}]});}return null;})['then'](respondWithResult(_0x402bbd,null))[_0x1e51('0x40')](handleError(_0x402bbd,null));};exports[_0x1e51('0x52')]=function(_0x35f12e,_0x457e4a,_0x5142ed){var _0x37f3e6='';return db['ZendeskAccount']['findOne']({'where':{'id':_0x35f12e[_0x1e51('0x42')]['id']},'attributes':['id',_0x1e51('0x53'),_0x1e51('0x54'),'token',_0x1e51('0x55'),_0x1e51('0x56')]})[_0x1e51('0x25')](handleEntityNotFound(_0x457e4a,null))[_0x1e51('0x25')](function(_0x5b76ae){if(_0x5b76ae){_0x37f3e6=_0x5b76ae[_0x1e51('0x56')];var _0x5ef17b=_0x37f3e6['slice'](-0x1);if(_0x5ef17b==='/'){_0x37f3e6=_0x37f3e6[_0x1e51('0x57')](0x0,_0x37f3e6['lastIndexOf'](_0x5ef17b));}var _0x35ece9={'method':'GET','uri':util[_0x1e51('0x58')]('%s/%s',_0x37f3e6,_0x1e51('0x59')),'json':!![]};switch(_0x5b76ae[_0x1e51('0x55')]){case'password':_0x35ece9[_0x1e51('0x5a')]={'Authorization':util['format'](_0x1e51('0x5b'),new Buffer(util[_0x1e51('0x58')](_0x1e51('0x5c'),_0x5b76ae[_0x1e51('0x53')],_0x5b76ae[_0x1e51('0x54')]))[_0x1e51('0x5d')]('base64'))};break;case _0x1e51('0x5e'):_0x35ece9['headers']={'Authorization':util['format'](_0x1e51('0x5b'),new Buffer(util[_0x1e51('0x58')](_0x1e51('0x5f'),_0x5b76ae[_0x1e51('0x53')],_0x5b76ae[_0x1e51('0x5e')]))[_0x1e51('0x5d')](_0x1e51('0x60')))};break;default:throw new db['Sequelize'][(_0x1e51('0x61'))](_0x1e51('0x62'));}return rp(_0x35ece9);}})[_0x1e51('0x25')](function(_0x4c6920){if(_0x4c6920){var _0x4da887=[_0x1e51('0x63'),_0x1e51('0x64'),'group',_0x1e51('0x65')];_[_0x1e51('0x66')](_0x4c6920['ticket_fields'],function(_0x5eb939){return _0x4da887[_0x1e51('0x67')](_0x5eb939[_0x1e51('0x29')]);});return{'count':_0x4c6920[_0x1e51('0x59')][_0x1e51('0x33')],'rows':_[_0x1e51('0x2c')](_0x4c6920[_0x1e51('0x59')],function(_0x3718d9){return{'id':_0x3718d9['id'],'name':_0x3718d9['position']>0x7?_0x3718d9['title']:_0x3718d9[_0x1e51('0x29')],'custom':_0x3718d9[_0x1e51('0x68')]>0x7?!![]:![],'options':_0x3718d9['system_field_options']?_0x3718d9[_0x1e51('0x69')]:_0x3718d9[_0x1e51('0x6a')]?_0x3718d9['custom_field_options']:[]};})};}})[_0x1e51('0x25')](respondWithResult(_0x457e4a,null))['catch'](function(_0x34b98f){var _0x561812=_0x35f12e['query']['test']?0x1f4:_0x34b98f['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x1e51('0x52'),_0x561812,JSON['stringify'](_0x34b98f));delete _0x34b98f[_0x1e51('0x2d')];if(_0x561812===0x191){_0x561812=0x190;}_0x457e4a['status'](_0x561812)[_0x1e51('0x6b')](_0x35f12e[_0x1e51('0x2e')][_0x1e51('0x6c')]?{'message':'Wrong\x20credentials','statusCode':_0x34b98f[_0x1e51('0x6d')]}:_0x34b98f);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 2512c37..b3c2600 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 _0xf24e=['ZendeskAccount','int_zendesk_accounts','api','bluebird','request-promise','rimraf','../../config/environment','../../components/integrations/configuration','exports','define'];(function(_0x19a49f,_0x444d74){var _0x5351ae=function(_0x58b1ed){while(--_0x58b1ed){_0x19a49f['push'](_0x19a49f['shift']());}};_0x5351ae(++_0x444d74);}(_0xf24e,0x110));var _0xef24=function(_0x41b0a8,_0x1b05cc){_0x41b0a8=_0x41b0a8-0x0;var _0x3a83d4=_0xf24e[_0x41b0a8];return _0x3a83d4;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xef24('0x0'));var moment=require('moment');var BPromise=require(_0xef24('0x1'));var rp=require(_0xef24('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xef24('0x3'));var config=require(_0xef24('0x4'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0xef24('0x5'));module[_0xef24('0x6')]=function(_0x76a616,_0xf3f047){return _0x76a616[_0xef24('0x7')](_0xef24('0x8'),attributes,{'tableName':_0xef24('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe71a=['bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','ZendeskAccount','int_zendesk_accounts','lodash','../../config/logger','api'];(function(_0x8d693f,_0x652a29){var _0xc7c885=function(_0x228e43){while(--_0x228e43){_0x8d693f['push'](_0x8d693f['shift']());}};_0xc7c885(++_0x652a29);}(_0xe71a,0xcd));var _0xae71=function(_0x5d976d,_0x3dbc8e){_0x5d976d=_0x5d976d-0x0;var _0x4f80fa=_0xe71a[_0x5d976d];return _0x4f80fa;};'use strict';var _=require(_0xae71('0x0'));var util=require('util');var logger=require(_0xae71('0x1'))(_0xae71('0x2'));var moment=require('moment');var BPromise=require(_0xae71('0x3'));var rp=require(_0xae71('0x4'));var fs=require('fs');var path=require(_0xae71('0x5'));var rimraf=require(_0xae71('0x6'));var config=require(_0xae71('0x7'));var attributes=require(_0xae71('0x8'));var integrations=require(_0xae71('0x9'));module[_0xae71('0xa')]=function(_0x174272,_0x1610b3){return _0x174272['define'](_0xae71('0xb'),attributes,{'tableName':_0xae71('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index dae541b..81a2113 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 _0x19fc=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ZendeskAccount,\x20%s,\x20%s','message','result','catch','GetZendeskAccount','ZendeskAccount','options','raw','where','limit','include','model','map','attributes','then','ShowZendeskAccount','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0xe1b5f6,_0x210c09){var _0x44636e=function(_0x3a3212){while(--_0x3a3212){_0xe1b5f6['push'](_0xe1b5f6['shift']());}};_0x44636e(++_0x210c09);}(_0x19fc,0x150));var _0xc19f=function(_0x2276f4,_0x4b0ee5){_0x2276f4=_0x2276f4-0x0;var _0x17186c=_0x19fc[_0x2276f4];return _0x17186c;};'use strict';var _=require(_0xc19f('0x0'));var util=require('util');var moment=require(_0xc19f('0x1'));var BPromise=require(_0xc19f('0x2'));var rs=require(_0xc19f('0x3'));var fs=require('fs');var Redis=require(_0xc19f('0x4'));var db=require(_0xc19f('0x5'))['db'];var utils=require(_0xc19f('0x6'));var logger=require(_0xc19f('0x7'))(_0xc19f('0x8'));var config=require(_0xc19f('0x9'));var jayson=require(_0xc19f('0xa'));var client=jayson[_0xc19f('0xb')][_0xc19f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x430a1a,_0x3fe869,_0xffc165){return new BPromise(function(_0x4542f9,_0x361f0){return client[_0xc19f('0xd')](_0x430a1a,_0xffc165)['then'](function(_0x2da042){logger[_0xc19f('0xe')]('ZendeskAccount,\x20%s,\x20%s',_0x3fe869,'request\x20sent');logger[_0xc19f('0xf')](_0xc19f('0x10'),_0x3fe869,_0xc19f('0x11'),JSON[_0xc19f('0x12')](_0x2da042));if(_0x2da042[_0xc19f('0x13')]){if(_0x2da042['error'][_0xc19f('0x14')]===0x1f4){logger['error'](_0xc19f('0x15'),_0x3fe869,_0x2da042['error']['message']);return _0x361f0(_0x2da042[_0xc19f('0x13')][_0xc19f('0x16')]);}logger[_0xc19f('0x13')](_0xc19f('0x15'),_0x3fe869,_0x2da042[_0xc19f('0x13')][_0xc19f('0x16')]);return _0x4542f9(_0x2da042[_0xc19f('0x13')][_0xc19f('0x16')]);}else{logger[_0xc19f('0xe')](_0xc19f('0x15'),_0x3fe869,_0xc19f('0x11'));_0x4542f9(_0x2da042[_0xc19f('0x17')][_0xc19f('0x16')]);}})[_0xc19f('0x18')](function(_0x3cce4c){logger[_0xc19f('0x13')](_0xc19f('0x15'),_0x3fe869,_0x3cce4c);_0x361f0(_0x3cce4c);});});}exports[_0xc19f('0x19')]=function(_0x1e2f43){var _0x31b47d=this;return new Promise(function(_0x3b1be,_0xe50074){return db[_0xc19f('0x1a')]['findAll']({'raw':_0x1e2f43[_0xc19f('0x1b')]?_0x1e2f43[_0xc19f('0x1b')][_0xc19f('0x1c')]===undefined?!![]:![]:!![],'where':_0x1e2f43[_0xc19f('0x1b')]?_0x1e2f43[_0xc19f('0x1b')][_0xc19f('0x1d')]||null:null,'attributes':_0x1e2f43[_0xc19f('0x1b')]?_0x1e2f43[_0xc19f('0x1b')]['attributes']||null:null,'limit':_0x1e2f43['options']?_0x1e2f43[_0xc19f('0x1b')][_0xc19f('0x1e')]||null:null,'include':_0x1e2f43[_0xc19f('0x1b')]?_0x1e2f43[_0xc19f('0x1b')]['include']?_['map'](_0x1e2f43[_0xc19f('0x1b')][_0xc19f('0x1f')],function(_0x4c8d63){return{'model':db[_0x4c8d63[_0xc19f('0x20')]],'as':_0x4c8d63['as'],'attributes':_0x4c8d63['attributes'],'include':_0x4c8d63[_0xc19f('0x1f')]?_[_0xc19f('0x21')](_0x4c8d63[_0xc19f('0x1f')],function(_0xa98b4f){return{'model':db[_0xa98b4f[_0xc19f('0x20')]],'as':_0xa98b4f['as'],'attributes':_0xa98b4f[_0xc19f('0x22')],'include':_0xa98b4f[_0xc19f('0x1f')]?_[_0xc19f('0x21')](_0xa98b4f[_0xc19f('0x1f')],function(_0x2cc73a){return{'model':db[_0x2cc73a['model']],'as':_0x2cc73a['as'],'attributes':_0x2cc73a[_0xc19f('0x22')]};}):[]};}):[]};}):[]:[]})[_0xc19f('0x23')](function(_0x254436){logger[_0xc19f('0xe')]('GetZendeskAccount',_0x1e2f43);logger['debug'](_0xc19f('0x19'),_0x1e2f43,JSON[_0xc19f('0x12')](_0x254436));_0x3b1be(_0x254436);})[_0xc19f('0x18')](function(_0x32699c){logger['error'](_0xc19f('0x19'),_0x32699c[_0xc19f('0x16')],_0x1e2f43);_0xe50074(_0x31b47d['error'](0x1f4,_0x32699c[_0xc19f('0x16')]));});});};exports[_0xc19f('0x24')]=function(_0x4dcd5b){var _0x38f22e=this;return new Promise(function(_0x25ae6c,_0x5e09c8){return db['ZendeskAccount'][_0xc19f('0x25')]({'raw':_0x4dcd5b['options']?_0x4dcd5b[_0xc19f('0x1b')][_0xc19f('0x1c')]===undefined?!![]:![]:!![],'where':_0x4dcd5b['options']?_0x4dcd5b[_0xc19f('0x1b')][_0xc19f('0x1d')]||null:null,'attributes':_0x4dcd5b['options']?_0x4dcd5b[_0xc19f('0x1b')][_0xc19f('0x22')]||null:null,'include':_0x4dcd5b['options']?_0x4dcd5b[_0xc19f('0x1b')][_0xc19f('0x1f')]?_[_0xc19f('0x21')](_0x4dcd5b[_0xc19f('0x1b')]['include'],function(_0x3f5a1b){return{'model':db[_0x3f5a1b['model']],'as':_0x3f5a1b['as'],'attributes':_0x3f5a1b[_0xc19f('0x22')],'include':_0x3f5a1b[_0xc19f('0x1f')]?_[_0xc19f('0x21')](_0x3f5a1b[_0xc19f('0x1f')],function(_0xd09c85){return{'model':db[_0xd09c85[_0xc19f('0x20')]],'as':_0xd09c85['as'],'attributes':_0xd09c85[_0xc19f('0x22')],'include':_0xd09c85['include']?_['map'](_0xd09c85[_0xc19f('0x1f')],function(_0x1ee9e5){return{'model':db[_0x1ee9e5[_0xc19f('0x20')]],'as':_0x1ee9e5['as'],'attributes':_0x1ee9e5['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x304465){logger[_0xc19f('0xe')](_0xc19f('0x24'),_0x4dcd5b);logger[_0xc19f('0xf')]('ShowZendeskAccount',_0x4dcd5b,JSON[_0xc19f('0x12')](_0x304465));_0x25ae6c(_0x304465);})[_0xc19f('0x18')](function(_0x15a400){logger[_0xc19f('0x13')](_0xc19f('0x24'),_0x15a400[_0xc19f('0x16')],_0x4dcd5b);_0x5e09c8(_0x38f22e['error'](0x1f4,_0x15a400[_0xc19f('0x16')]));});});}; \ No newline at end of file +var _0x6eed=['ZendeskAccount,\x20%s,\x20%s','message','result','GetZendeskAccount','ZendeskAccount','options','raw','attributes','limit','map','include','model','then','ShowZendeskAccount','find','where','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x4996ad,_0x452c82){var _0x39c3d3=function(_0x3d9cce){while(--_0x3d9cce){_0x4996ad['push'](_0x4996ad['shift']());}};_0x39c3d3(++_0x452c82);}(_0x6eed,0xff));var _0xd6ee=function(_0x2e8e7b,_0x5e4613){_0x2e8e7b=_0x2e8e7b-0x0;var _0x15fdab=_0x6eed[_0x2e8e7b];return _0x15fdab;};'use strict';var _=require(_0xd6ee('0x0'));var util=require(_0xd6ee('0x1'));var moment=require(_0xd6ee('0x2'));var BPromise=require(_0xd6ee('0x3'));var rs=require(_0xd6ee('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd6ee('0x5'))['db'];var utils=require(_0xd6ee('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xd6ee('0x7'));var jayson=require(_0xd6ee('0x8'));var client=jayson[_0xd6ee('0x9')][_0xd6ee('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10c1d7,_0x48a812,_0x514dc3){return new BPromise(function(_0x2e6369,_0x5134ea){return client['request'](_0x10c1d7,_0x514dc3)['then'](function(_0x2c4f23){logger[_0xd6ee('0xb')]('ZendeskAccount,\x20%s,\x20%s',_0x48a812,_0xd6ee('0xc'));logger[_0xd6ee('0xd')](_0xd6ee('0xe'),_0x48a812,_0xd6ee('0xc'),JSON['stringify'](_0x2c4f23));if(_0x2c4f23[_0xd6ee('0xf')]){if(_0x2c4f23[_0xd6ee('0xf')][_0xd6ee('0x10')]===0x1f4){logger[_0xd6ee('0xf')](_0xd6ee('0x11'),_0x48a812,_0x2c4f23[_0xd6ee('0xf')]['message']);return _0x5134ea(_0x2c4f23[_0xd6ee('0xf')][_0xd6ee('0x12')]);}logger['error'](_0xd6ee('0x11'),_0x48a812,_0x2c4f23[_0xd6ee('0xf')][_0xd6ee('0x12')]);return _0x2e6369(_0x2c4f23[_0xd6ee('0xf')][_0xd6ee('0x12')]);}else{logger[_0xd6ee('0xb')]('ZendeskAccount,\x20%s,\x20%s',_0x48a812,_0xd6ee('0xc'));_0x2e6369(_0x2c4f23[_0xd6ee('0x13')][_0xd6ee('0x12')]);}})['catch'](function(_0x3196c0){logger['error'](_0xd6ee('0x11'),_0x48a812,_0x3196c0);_0x5134ea(_0x3196c0);});});}exports[_0xd6ee('0x14')]=function(_0x81d533){var _0x572d04=this;return new Promise(function(_0x8a2718,_0x51ad1c){return db[_0xd6ee('0x15')]['findAll']({'raw':_0x81d533[_0xd6ee('0x16')]?_0x81d533[_0xd6ee('0x16')][_0xd6ee('0x17')]===undefined?!![]:![]:!![],'where':_0x81d533[_0xd6ee('0x16')]?_0x81d533[_0xd6ee('0x16')]['where']||null:null,'attributes':_0x81d533[_0xd6ee('0x16')]?_0x81d533['options'][_0xd6ee('0x18')]||null:null,'limit':_0x81d533[_0xd6ee('0x16')]?_0x81d533[_0xd6ee('0x16')][_0xd6ee('0x19')]||null:null,'include':_0x81d533[_0xd6ee('0x16')]?_0x81d533['options']['include']?_[_0xd6ee('0x1a')](_0x81d533['options'][_0xd6ee('0x1b')],function(_0x519373){return{'model':db[_0x519373[_0xd6ee('0x1c')]],'as':_0x519373['as'],'attributes':_0x519373[_0xd6ee('0x18')],'include':_0x519373[_0xd6ee('0x1b')]?_[_0xd6ee('0x1a')](_0x519373[_0xd6ee('0x1b')],function(_0x5476f2){return{'model':db[_0x5476f2['model']],'as':_0x5476f2['as'],'attributes':_0x5476f2[_0xd6ee('0x18')],'include':_0x5476f2[_0xd6ee('0x1b')]?_['map'](_0x5476f2[_0xd6ee('0x1b')],function(_0xa1e700){return{'model':db[_0xa1e700[_0xd6ee('0x1c')]],'as':_0xa1e700['as'],'attributes':_0xa1e700[_0xd6ee('0x18')]};}):[]};}):[]};}):[]:[]})[_0xd6ee('0x1d')](function(_0x1769a2){logger[_0xd6ee('0xb')]('GetZendeskAccount',_0x81d533);logger[_0xd6ee('0xd')](_0xd6ee('0x14'),_0x81d533,JSON['stringify'](_0x1769a2));_0x8a2718(_0x1769a2);})['catch'](function(_0x1578b3){logger[_0xd6ee('0xf')](_0xd6ee('0x14'),_0x1578b3[_0xd6ee('0x12')],_0x81d533);_0x51ad1c(_0x572d04[_0xd6ee('0xf')](0x1f4,_0x1578b3['message']));});});};exports[_0xd6ee('0x1e')]=function(_0x2f981e){var _0x21ce09=this;return new Promise(function(_0x4a9bdb,_0x3a3ce6){return db[_0xd6ee('0x15')][_0xd6ee('0x1f')]({'raw':_0x2f981e['options']?_0x2f981e[_0xd6ee('0x16')][_0xd6ee('0x17')]===undefined?!![]:![]:!![],'where':_0x2f981e[_0xd6ee('0x16')]?_0x2f981e[_0xd6ee('0x16')][_0xd6ee('0x20')]||null:null,'attributes':_0x2f981e[_0xd6ee('0x16')]?_0x2f981e['options'][_0xd6ee('0x18')]||null:null,'include':_0x2f981e[_0xd6ee('0x16')]?_0x2f981e[_0xd6ee('0x16')][_0xd6ee('0x1b')]?_['map'](_0x2f981e[_0xd6ee('0x16')][_0xd6ee('0x1b')],function(_0x2916a3){return{'model':db[_0x2916a3['model']],'as':_0x2916a3['as'],'attributes':_0x2916a3['attributes'],'include':_0x2916a3[_0xd6ee('0x1b')]?_[_0xd6ee('0x1a')](_0x2916a3[_0xd6ee('0x1b')],function(_0x139a15){return{'model':db[_0x139a15[_0xd6ee('0x1c')]],'as':_0x139a15['as'],'attributes':_0x139a15[_0xd6ee('0x18')],'include':_0x139a15[_0xd6ee('0x1b')]?_[_0xd6ee('0x1a')](_0x139a15[_0xd6ee('0x1b')],function(_0x1e9f94){return{'model':db[_0x1e9f94[_0xd6ee('0x1c')]],'as':_0x1e9f94['as'],'attributes':_0x1e9f94[_0xd6ee('0x18')]};}):[]};}):[]};}):[]:[]})[_0xd6ee('0x1d')](function(_0x15b752){logger[_0xd6ee('0xb')]('ShowZendeskAccount',_0x2f981e);logger[_0xd6ee('0xd')](_0xd6ee('0x1e'),_0x2f981e,JSON[_0xd6ee('0x21')](_0x15b752));_0x4a9bdb(_0x15b752);})['catch'](function(_0x564adc){logger['error']('ShowZendeskAccount',_0x564adc[_0xd6ee('0x12')],_0x2f981e);_0x3a3ce6(_0x21ce09[_0xd6ee('0xf')](0x1f4,_0x564adc[_0xd6ee('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index c13c02e..fdd585e 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 _0x0abf=['connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','/:id','update','delete','destroy','exports','multer','path'];(function(_0x461886,_0x4fc171){var _0x295e0a=function(_0x451524){while(--_0x451524){_0x461886['push'](_0x461886['shift']());}};_0x295e0a(++_0x4fc171);}(_0x0abf,0xe8));var _0xf0ab=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x0abf[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0xf0ab('0x0'));var util=require('util');var path=require(_0xf0ab('0x1'));var timeout=require(_0xf0ab('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf0ab('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xf0ab('0x4'));var config=require(_0xf0ab('0x5'));var controller=require(_0xf0ab('0x6'));router[_0xf0ab('0x7')]('/',auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x9')]);router[_0xf0ab('0x7')]('/:id',auth[_0xf0ab('0x8')](),controller[_0xf0ab('0xa')]);router[_0xf0ab('0x7')](_0xf0ab('0xb'),auth['isAuthenticated'](),controller[_0xf0ab('0xc')]);router[_0xf0ab('0x7')](_0xf0ab('0xd'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xf0ab('0x7')]('/:id/descriptions',auth[_0xf0ab('0x8')](),controller[_0xf0ab('0xe')]);router[_0xf0ab('0x7')](_0xf0ab('0xf'),auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x10')]);router[_0xf0ab('0x11')]('/',auth['isAuthenticated'](),controller[_0xf0ab('0x12')]);router[_0xf0ab('0x11')](_0xf0ab('0xf'),auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x13')]);router[_0xf0ab('0x14')](_0xf0ab('0x15'),auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x16')]);router[_0xf0ab('0x17')](_0xf0ab('0x15'),auth[_0xf0ab('0x8')](),controller[_0xf0ab('0x18')]);module[_0xf0ab('0x19')]=router; \ No newline at end of file +var _0xac4a=['../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','isAuthenticated','get','show','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','setTags','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x2be3b1,_0x58685a){var _0x54dc5b=function(_0x56e6f2){while(--_0x56e6f2){_0x2be3b1['push'](_0x2be3b1['shift']());}};_0x54dc5b(++_0x58685a);}(_0xac4a,0x13f));var _0xaac4=function(_0x47a526,_0x2f1a33){_0x47a526=_0x47a526-0x0;var _0x550c20=_0xac4a[_0x47a526];return _0x550c20;};'use strict';var multer=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var path=require(_0xaac4('0x2'));var timeout=require(_0xaac4('0x3'));var express=require(_0xaac4('0x4'));var router=express[_0xaac4('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaac4('0x6'));var config=require(_0xaac4('0x7'));var controller=require(_0xaac4('0x8'));router['get']('/',auth[_0xaac4('0x9')](),controller['index']);router[_0xaac4('0xa')]('/:id',auth[_0xaac4('0x9')](),controller[_0xaac4('0xb')]);router['get']('/:id/fields',auth[_0xaac4('0x9')](),controller['getFields']);router[_0xaac4('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xaac4('0xc')]);router[_0xaac4('0xa')](_0xaac4('0xd'),auth[_0xaac4('0x9')](),controller[_0xaac4('0xe')]);router['get']('/:id/tags',auth[_0xaac4('0x9')](),controller[_0xaac4('0xf')]);router[_0xaac4('0x10')]('/',auth['isAuthenticated'](),controller[_0xaac4('0x11')]);router[_0xaac4('0x10')]('/:id/tags',auth[_0xaac4('0x9')](),controller[_0xaac4('0x12')]);router[_0xaac4('0x13')](_0xaac4('0x14'),auth[_0xaac4('0x9')](),controller[_0xaac4('0x15')]);router[_0xaac4('0x16')](_0xaac4('0x14'),auth[_0xaac4('0x9')](),controller[_0xaac4('0x17')]);module[_0xaac4('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index c89ca53..737e14a 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 _0x581f=['exports','STRING','sequelize'];(function(_0x1e69fe,_0x39144d){var _0x56a480=function(_0x2068ab){while(--_0x2068ab){_0x1e69fe['push'](_0x1e69fe['shift']());}};_0x56a480(++_0x39144d);}(_0x581f,0x152));var _0xf581=function(_0x2055e5,_0x560bf1){_0x2055e5=_0x2055e5-0x0;var _0x3d509c=_0x581f[_0x2055e5];return _0x3d509c;};'use strict';var Sequelize=require(_0xf581('0x0'));module[_0xf581('0x1')]={'name':{'type':Sequelize[_0xf581('0x2')]},'description':{'type':Sequelize[_0xf581('0x2')]}}; \ No newline at end of file +var _0xe8ff=['exports','STRING','sequelize'];(function(_0x3a3b99,_0x5bc51e){var _0x15dc23=function(_0x5b88ec){while(--_0x5b88ec){_0x3a3b99['push'](_0x3a3b99['shift']());}};_0x15dc23(++_0x5bc51e);}(_0xe8ff,0x10d));var _0xfe8f=function(_0x35344a,_0x1790b6){_0x35344a=_0x35344a-0x0;var _0x285085=_0xe8ff[_0x35344a];return _0x285085;};'use strict';var Sequelize=require(_0xfe8f('0x0'));module[_0xfe8f('0x1')]={'name':{'type':Sequelize[_0xfe8f('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index d879a43..6a3aad9 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 _0x4cad=['where','filters','pick','filter','merge','includeAll','include','findAll','rows','catch','options','create','body','find','destroy','params','getFields','findOne','ZendeskField','length','order','hasOwnProperty','getSubjects','getDescriptions','getTags','setTags','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','set','apply','reject','save','update','then','error','name','index','map','ZendeskConfiguration','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','nolimit','sort'];(function(_0x4e7ec1,_0x45fe15){var _0x2f489b=function(_0x11a122){while(--_0x11a122){_0x4e7ec1['push'](_0x4e7ec1['shift']());}};_0x2f489b(++_0x45fe15);}(_0x4cad,0x68));var _0xd4ca=function(_0x14d552,_0xf61847){_0x14d552=_0x14d552-0x0;var _0x2a084b=_0x4cad[_0x14d552];return _0x2a084b;};'use strict';var emlformat=require(_0xd4ca('0x0'));var rimraf=require(_0xd4ca('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd4ca('0x2'));var rp=require(_0xd4ca('0x3'));var moment=require(_0xd4ca('0x4'));var BPromise=require(_0xd4ca('0x5'));var Mustache=require(_0xd4ca('0x6'));var util=require(_0xd4ca('0x7'));var path=require('path');var sox=require(_0xd4ca('0x8'));var csv=require(_0xd4ca('0x9'));var ejs=require(_0xd4ca('0xa'));var fs=require('fs');var fs_extra=require(_0xd4ca('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd4ca('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd4ca('0x9'));var querystring=require(_0xd4ca('0xd'));var Papa=require(_0xd4ca('0xe'));var Redis=require(_0xd4ca('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd4ca('0x10'));var hardwareService=require(_0xd4ca('0x11'));var logger=require(_0xd4ca('0x12'))(_0xd4ca('0x13'));var utils=require('../../config/utils');var config=require(_0xd4ca('0x14'));var licenseUtil=require(_0xd4ca('0x15'));var db=require(_0xd4ca('0x16'))['db'];function respondWithStatusCode(_0x1f28ce,_0x80770){_0x80770=_0x80770||0xcc;return function(_0x2b15fc){if(_0x2b15fc){return _0x1f28ce['sendStatus'](_0x80770);}return _0x1f28ce[_0xd4ca('0x17')](_0x80770)[_0xd4ca('0x18')]();};}function respondWithResult(_0x37b36f,_0x29015b){_0x29015b=_0x29015b||0xc8;return function(_0x4dc7cc){if(_0x4dc7cc){return _0x37b36f['status'](_0x29015b)[_0xd4ca('0x19')](_0x4dc7cc);}};}function respondWithFilteredResult(_0x23df5f,_0x2cf449){return function(_0x3da83d){if(_0x3da83d){var _0x40b923=typeof _0x2cf449['offset']===_0xd4ca('0x1a')&&typeof _0x2cf449['limit']==='undefined';var _0x4e80d6=_0x3da83d[_0xd4ca('0x1b')];var _0x17ff3f=_0x40b923?0x0:_0x2cf449['offset'];var _0x5eb971=_0x40b923?_0x3da83d[_0xd4ca('0x1b')]:_0x2cf449[_0xd4ca('0x1c')]+_0x2cf449[_0xd4ca('0x1d')];var _0x5443ad;if(_0x5eb971>=_0x4e80d6){_0x5eb971=_0x4e80d6;_0x5443ad=0xc8;}else{_0x5443ad=0xce;}_0x23df5f['status'](_0x5443ad);return _0x23df5f[_0xd4ca('0x1e')]('Content-Range',_0x17ff3f+'-'+_0x5eb971+'/'+_0x4e80d6)['json'](_0x3da83d);}return null;};}function patchUpdates(_0x3b5bab){return function(_0x3bf819){try{jsonpatch[_0xd4ca('0x1f')](_0x3bf819,_0x3b5bab,!![]);}catch(_0x160ec1){return BPromise[_0xd4ca('0x20')](_0x160ec1);}return _0x3bf819[_0xd4ca('0x21')]();};}function saveUpdates(_0x4005be,_0x11cbfd){return function(_0x4ec364){if(_0x4ec364){return _0x4ec364[_0xd4ca('0x22')](_0x4005be)[_0xd4ca('0x23')](function(_0x2b8d38){return _0x2b8d38;});}return null;};}function removeEntity(_0x20daaf,_0x4908ae){return function(_0xb014ed){if(_0xb014ed){return _0xb014ed['destroy']()[_0xd4ca('0x23')](function(){_0x20daaf['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x38550e,_0x3d38da){return function(_0x5c97f8){if(!_0x5c97f8){_0x38550e['sendStatus'](0x194);}return _0x5c97f8;};}function handleError(_0x25b2ff,_0x428108){_0x428108=_0x428108||0x1f4;return function(_0x124416){logger[_0xd4ca('0x24')](_0x124416['stack']);if(_0x124416[_0xd4ca('0x25')]){delete _0x124416[_0xd4ca('0x25')];}_0x25b2ff['status'](_0x428108)['send'](_0x124416);};}exports[_0xd4ca('0x26')]=function(_0x5557b1,_0x2e4934){var _0x5a4c10={},_0x50e5ec={},_0x518114={'count':0x0,'rows':[]};var _0x4e34e1=_[_0xd4ca('0x27')](db[_0xd4ca('0x28')][_0xd4ca('0x29')],function(_0x334ff1){return{'name':_0x334ff1[_0xd4ca('0x2a')],'type':_0x334ff1['type'][_0xd4ca('0x2b')]};});_0x50e5ec['model']=_[_0xd4ca('0x27')](_0x4e34e1,'name');_0x50e5ec[_0xd4ca('0x2c')]=_[_0xd4ca('0x2d')](_0x5557b1[_0xd4ca('0x2c')]);_0x50e5ec['filters']=_[_0xd4ca('0x2e')](_0x50e5ec[_0xd4ca('0x2f')],_0x50e5ec[_0xd4ca('0x2c')]);_0x5a4c10[_0xd4ca('0x30')]=_[_0xd4ca('0x2e')](_0x50e5ec[_0xd4ca('0x2f')],qs[_0xd4ca('0x31')](_0x5557b1[_0xd4ca('0x2c')]['fields']));_0x5a4c10[_0xd4ca('0x30')]=_0x5a4c10[_0xd4ca('0x30')]['length']?_0x5a4c10[_0xd4ca('0x30')]:_0x50e5ec[_0xd4ca('0x2f')];if(!_0x5557b1[_0xd4ca('0x2c')]['hasOwnProperty'](_0xd4ca('0x32'))){_0x5a4c10[_0xd4ca('0x1d')]=qs[_0xd4ca('0x1d')](_0x5557b1['query'][_0xd4ca('0x1d')]);_0x5a4c10[_0xd4ca('0x1c')]=qs[_0xd4ca('0x1c')](_0x5557b1[_0xd4ca('0x2c')][_0xd4ca('0x1c')]);}_0x5a4c10['order']=qs[_0xd4ca('0x33')](_0x5557b1[_0xd4ca('0x2c')][_0xd4ca('0x33')]);_0x5a4c10[_0xd4ca('0x34')]=qs[_0xd4ca('0x35')](_[_0xd4ca('0x36')](_0x5557b1['query'],_0x50e5ec[_0xd4ca('0x35')]),_0x4e34e1);if(_0x5557b1[_0xd4ca('0x2c')][_0xd4ca('0x37')]){_0x5a4c10[_0xd4ca('0x34')]=_[_0xd4ca('0x38')](_0x5a4c10[_0xd4ca('0x34')],{'$or':_[_0xd4ca('0x27')](_0x4e34e1,function(_0x88cb2){if(_0x88cb2['type']!=='VIRTUAL'){var _0xfffa73={};_0xfffa73[_0x88cb2[_0xd4ca('0x25')]]={'$like':'%'+_0x5557b1['query'][_0xd4ca('0x37')]+'%'};return _0xfffa73;}})});}_0x5a4c10=_[_0xd4ca('0x38')]({},_0x5a4c10,_0x5557b1['options']);var _0x275c8e={'where':_0x5a4c10[_0xd4ca('0x34')]};return db[_0xd4ca('0x28')][_0xd4ca('0x1b')](_0x275c8e)[_0xd4ca('0x23')](function(_0x4ab64c){_0x518114[_0xd4ca('0x1b')]=_0x4ab64c;if(_0x5557b1[_0xd4ca('0x2c')][_0xd4ca('0x39')]){_0x5a4c10[_0xd4ca('0x3a')]=[{'all':!![]}];}return db[_0xd4ca('0x28')][_0xd4ca('0x3b')](_0x5a4c10);})[_0xd4ca('0x23')](function(_0xa28987){_0x518114[_0xd4ca('0x3c')]=_0xa28987;return _0x518114;})[_0xd4ca('0x23')](respondWithFilteredResult(_0x2e4934,_0x5a4c10))[_0xd4ca('0x3d')](handleError(_0x2e4934,null));};exports['show']=function(_0x469ded,_0x1c3cea){var _0x55577f={'raw':![],'where':{'id':_0x469ded['params']['id']}},_0x38dd77={};_0x38dd77[_0xd4ca('0x2f')]=_[_0xd4ca('0x2d')](db[_0xd4ca('0x28')][_0xd4ca('0x29')]);_0x38dd77[_0xd4ca('0x2c')]=_[_0xd4ca('0x2d')](_0x469ded['query']);_0x38dd77[_0xd4ca('0x35')]=_[_0xd4ca('0x2e')](_0x38dd77[_0xd4ca('0x2f')],_0x38dd77['query']);_0x55577f[_0xd4ca('0x30')]=_[_0xd4ca('0x2e')](_0x38dd77[_0xd4ca('0x2f')],qs[_0xd4ca('0x31')](_0x469ded[_0xd4ca('0x2c')][_0xd4ca('0x31')]));_0x55577f['attributes']=_0x55577f[_0xd4ca('0x30')]['length']?_0x55577f['attributes']:_0x38dd77['model'];if(_0x469ded[_0xd4ca('0x2c')][_0xd4ca('0x39')]){_0x55577f[_0xd4ca('0x3a')]=[{'all':!![]}];}_0x55577f=_['merge']({},_0x55577f,_0x469ded[_0xd4ca('0x3e')]);return db[_0xd4ca('0x28')]['find'](_0x55577f)[_0xd4ca('0x23')](handleEntityNotFound(_0x1c3cea,null))[_0xd4ca('0x23')](respondWithResult(_0x1c3cea,null))[_0xd4ca('0x3d')](handleError(_0x1c3cea,null));};exports[_0xd4ca('0x3f')]=function(_0x23d26f,_0x5b2ff6){return db['ZendeskConfiguration'][_0xd4ca('0x3f')](_0x23d26f[_0xd4ca('0x40')],{})[_0xd4ca('0x23')](respondWithResult(_0x5b2ff6,0xc9))[_0xd4ca('0x3d')](handleError(_0x5b2ff6,null));};exports[_0xd4ca('0x22')]=function(_0x460388,_0x25576b){if(_0x460388[_0xd4ca('0x40')]['id']){delete _0x460388[_0xd4ca('0x40')]['id'];}return db[_0xd4ca('0x28')][_0xd4ca('0x41')]({'where':{'id':_0x460388['params']['id']}})['then'](handleEntityNotFound(_0x25576b,null))[_0xd4ca('0x23')](saveUpdates(_0x460388['body'],null))[_0xd4ca('0x23')](respondWithResult(_0x25576b,null))[_0xd4ca('0x3d')](handleError(_0x25576b,null));};exports[_0xd4ca('0x42')]=function(_0x232a48,_0xdb5fef){return db[_0xd4ca('0x28')]['find']({'where':{'id':_0x232a48[_0xd4ca('0x43')]['id']}})[_0xd4ca('0x23')](handleEntityNotFound(_0xdb5fef,null))[_0xd4ca('0x23')](removeEntity(_0xdb5fef,null))[_0xd4ca('0x3d')](handleError(_0xdb5fef,null));};exports[_0xd4ca('0x44')]=function(_0x40411d,_0x22954e,_0x3a6fd3){var _0x542608={};var _0x1e377e={};var _0x4f300e;var _0x2f444d;return db['ZendeskConfiguration'][_0xd4ca('0x45')]({'where':{'id':_0x40411d[_0xd4ca('0x43')]['id']}})[_0xd4ca('0x23')](handleEntityNotFound(_0x22954e,null))[_0xd4ca('0x23')](function(_0x460cae){if(_0x460cae){_0x4f300e=_0x460cae;_0x1e377e[_0xd4ca('0x2f')]=_[_0xd4ca('0x2d')](db[_0xd4ca('0x46')][_0xd4ca('0x29')]);_0x1e377e[_0xd4ca('0x2c')]=_[_0xd4ca('0x2d')](_0x40411d[_0xd4ca('0x2c')]);_0x1e377e[_0xd4ca('0x35')]=_[_0xd4ca('0x2e')](_0x1e377e[_0xd4ca('0x2f')],_0x1e377e[_0xd4ca('0x2c')]);_0x542608[_0xd4ca('0x30')]=_[_0xd4ca('0x2e')](_0x1e377e[_0xd4ca('0x2f')],qs[_0xd4ca('0x31')](_0x40411d[_0xd4ca('0x2c')]['fields']));_0x542608[_0xd4ca('0x30')]=_0x542608[_0xd4ca('0x30')][_0xd4ca('0x47')]?_0x542608['attributes']:_0x1e377e[_0xd4ca('0x2f')];_0x542608[_0xd4ca('0x48')]=qs['sort'](_0x40411d[_0xd4ca('0x2c')]['sort']);_0x542608[_0xd4ca('0x34')]=qs[_0xd4ca('0x35')](_[_0xd4ca('0x36')](_0x40411d[_0xd4ca('0x2c')],_0x1e377e[_0xd4ca('0x35')]));if(_0x40411d['query'][_0xd4ca('0x37')]){_0x542608[_0xd4ca('0x34')]=_[_0xd4ca('0x38')](_0x542608[_0xd4ca('0x34')],{'$or':_[_0xd4ca('0x27')](_0x542608['attributes'],function(_0x1af8ea){var _0x287f35={};_0x287f35[_0x1af8ea]={'$like':'%'+_0x40411d[_0xd4ca('0x2c')]['filter']+'%'};return _0x287f35;})});}_0x542608=_[_0xd4ca('0x38')]({},_0x542608,_0x40411d['options']);return _0x4f300e[_0xd4ca('0x44')](_0x542608);}})[_0xd4ca('0x23')](function(_0x273c7f){if(_0x273c7f){_0x2f444d=_0x273c7f[_0xd4ca('0x47')];if(!_0x40411d[_0xd4ca('0x2c')][_0xd4ca('0x49')](_0xd4ca('0x32'))){_0x542608[_0xd4ca('0x1d')]=qs['limit'](_0x40411d[_0xd4ca('0x2c')][_0xd4ca('0x1d')]);_0x542608[_0xd4ca('0x1c')]=qs[_0xd4ca('0x1c')](_0x40411d['query'][_0xd4ca('0x1c')]);}return _0x4f300e[_0xd4ca('0x44')](_0x542608);}})['then'](function(_0xa8a934){if(_0xa8a934){return _0xa8a934?{'count':_0x2f444d,'rows':_0xa8a934}:null;}})['then'](respondWithResult(_0x22954e,null))[_0xd4ca('0x3d')](handleError(_0x22954e,null));};exports[_0xd4ca('0x4a')]=function(_0x46014c,_0x1c0c52,_0x547496){var _0x24472f={};var _0x4f5a9e={};var _0x4ccf27;var _0x47ffe6;return db[_0xd4ca('0x28')][_0xd4ca('0x45')]({'where':{'id':_0x46014c[_0xd4ca('0x43')]['id']}})['then'](handleEntityNotFound(_0x1c0c52,null))[_0xd4ca('0x23')](function(_0xac7e6c){if(_0xac7e6c){_0x4ccf27=_0xac7e6c;_0x4f5a9e[_0xd4ca('0x2f')]=_[_0xd4ca('0x2d')](db[_0xd4ca('0x46')][_0xd4ca('0x29')]);_0x4f5a9e[_0xd4ca('0x2c')]=_[_0xd4ca('0x2d')](_0x46014c[_0xd4ca('0x2c')]);_0x4f5a9e[_0xd4ca('0x35')]=_[_0xd4ca('0x2e')](_0x4f5a9e['model'],_0x4f5a9e[_0xd4ca('0x2c')]);_0x24472f[_0xd4ca('0x30')]=_[_0xd4ca('0x2e')](_0x4f5a9e[_0xd4ca('0x2f')],qs['fields'](_0x46014c[_0xd4ca('0x2c')][_0xd4ca('0x31')]));_0x24472f[_0xd4ca('0x30')]=_0x24472f[_0xd4ca('0x30')][_0xd4ca('0x47')]?_0x24472f[_0xd4ca('0x30')]:_0x4f5a9e[_0xd4ca('0x2f')];_0x24472f[_0xd4ca('0x48')]=qs[_0xd4ca('0x33')](_0x46014c[_0xd4ca('0x2c')]['sort']);_0x24472f[_0xd4ca('0x34')]=qs[_0xd4ca('0x35')](_[_0xd4ca('0x36')](_0x46014c['query'],_0x4f5a9e[_0xd4ca('0x35')]));if(_0x46014c[_0xd4ca('0x2c')][_0xd4ca('0x37')]){_0x24472f[_0xd4ca('0x34')]=_[_0xd4ca('0x38')](_0x24472f['where'],{'$or':_[_0xd4ca('0x27')](_0x24472f[_0xd4ca('0x30')],function(_0x5436ba){var _0xec4e4e={};_0xec4e4e[_0x5436ba]={'$like':'%'+_0x46014c[_0xd4ca('0x2c')][_0xd4ca('0x37')]+'%'};return _0xec4e4e;})});}_0x24472f=_[_0xd4ca('0x38')]({},_0x24472f,_0x46014c['options']);return _0x4ccf27[_0xd4ca('0x4a')](_0x24472f);}})[_0xd4ca('0x23')](function(_0x32929c){if(_0x32929c){_0x47ffe6=_0x32929c[_0xd4ca('0x47')];if(!_0x46014c['query'][_0xd4ca('0x49')](_0xd4ca('0x32'))){_0x24472f['limit']=qs[_0xd4ca('0x1d')](_0x46014c[_0xd4ca('0x2c')]['limit']);_0x24472f[_0xd4ca('0x1c')]=qs[_0xd4ca('0x1c')](_0x46014c[_0xd4ca('0x2c')]['offset']);}return _0x4ccf27[_0xd4ca('0x4a')](_0x24472f);}})[_0xd4ca('0x23')](function(_0x26498d){if(_0x26498d){return _0x26498d?{'count':_0x47ffe6,'rows':_0x26498d}:null;}})[_0xd4ca('0x23')](respondWithResult(_0x1c0c52,null))['catch'](handleError(_0x1c0c52,null));};exports['getDescriptions']=function(_0x1b2f9c,_0x12f923,_0x2883a2){var _0x1f32e3={};var _0x3ed313={};var _0x2977a8;var _0x5384af;return db[_0xd4ca('0x28')][_0xd4ca('0x45')]({'where':{'id':_0x1b2f9c[_0xd4ca('0x43')]['id']}})[_0xd4ca('0x23')](handleEntityNotFound(_0x12f923,null))[_0xd4ca('0x23')](function(_0x5da553){if(_0x5da553){_0x2977a8=_0x5da553;_0x3ed313[_0xd4ca('0x2f')]=_[_0xd4ca('0x2d')](db['ZendeskField'][_0xd4ca('0x29')]);_0x3ed313[_0xd4ca('0x2c')]=_[_0xd4ca('0x2d')](_0x1b2f9c[_0xd4ca('0x2c')]);_0x3ed313[_0xd4ca('0x35')]=_[_0xd4ca('0x2e')](_0x3ed313[_0xd4ca('0x2f')],_0x3ed313[_0xd4ca('0x2c')]);_0x1f32e3[_0xd4ca('0x30')]=_[_0xd4ca('0x2e')](_0x3ed313[_0xd4ca('0x2f')],qs[_0xd4ca('0x31')](_0x1b2f9c['query'][_0xd4ca('0x31')]));_0x1f32e3['attributes']=_0x1f32e3[_0xd4ca('0x30')]['length']?_0x1f32e3[_0xd4ca('0x30')]:_0x3ed313[_0xd4ca('0x2f')];_0x1f32e3['order']=qs[_0xd4ca('0x33')](_0x1b2f9c[_0xd4ca('0x2c')][_0xd4ca('0x33')]);_0x1f32e3[_0xd4ca('0x34')]=qs[_0xd4ca('0x35')](_[_0xd4ca('0x36')](_0x1b2f9c[_0xd4ca('0x2c')],_0x3ed313['filters']));if(_0x1b2f9c[_0xd4ca('0x2c')][_0xd4ca('0x37')]){_0x1f32e3[_0xd4ca('0x34')]=_[_0xd4ca('0x38')](_0x1f32e3[_0xd4ca('0x34')],{'$or':_[_0xd4ca('0x27')](_0x1f32e3[_0xd4ca('0x30')],function(_0x375e7d){var _0xcdb492={};_0xcdb492[_0x375e7d]={'$like':'%'+_0x1b2f9c['query']['filter']+'%'};return _0xcdb492;})});}_0x1f32e3=_[_0xd4ca('0x38')]({},_0x1f32e3,_0x1b2f9c[_0xd4ca('0x3e')]);return _0x2977a8[_0xd4ca('0x4b')](_0x1f32e3);}})['then'](function(_0x935462){if(_0x935462){_0x5384af=_0x935462[_0xd4ca('0x47')];if(!_0x1b2f9c['query']['hasOwnProperty'](_0xd4ca('0x32'))){_0x1f32e3[_0xd4ca('0x1d')]=qs[_0xd4ca('0x1d')](_0x1b2f9c[_0xd4ca('0x2c')][_0xd4ca('0x1d')]);_0x1f32e3[_0xd4ca('0x1c')]=qs['offset'](_0x1b2f9c[_0xd4ca('0x2c')][_0xd4ca('0x1c')]);}return _0x2977a8[_0xd4ca('0x4b')](_0x1f32e3);}})[_0xd4ca('0x23')](function(_0x413c01){if(_0x413c01){return _0x413c01?{'count':_0x5384af,'rows':_0x413c01}:null;}})['then'](respondWithResult(_0x12f923,null))[_0xd4ca('0x3d')](handleError(_0x12f923,null));};exports[_0xd4ca('0x4c')]=function(_0x1fdb1e,_0x1a4f9c,_0x49d50a){var _0xc1a28f={};var _0x7b4f6f={};var _0x39a110;var _0x24443e;return db[_0xd4ca('0x28')][_0xd4ca('0x45')]({'where':{'id':_0x1fdb1e[_0xd4ca('0x43')]['id']}})[_0xd4ca('0x23')](handleEntityNotFound(_0x1a4f9c,null))[_0xd4ca('0x23')](function(_0x5508d1){if(_0x5508d1){_0x39a110=_0x5508d1;_0x7b4f6f[_0xd4ca('0x2f')]=_[_0xd4ca('0x2d')](db['Tag'][_0xd4ca('0x29')]);_0x7b4f6f[_0xd4ca('0x2c')]=_[_0xd4ca('0x2d')](_0x1fdb1e[_0xd4ca('0x2c')]);_0x7b4f6f[_0xd4ca('0x35')]=_[_0xd4ca('0x2e')](_0x7b4f6f['model'],_0x7b4f6f[_0xd4ca('0x2c')]);_0xc1a28f[_0xd4ca('0x30')]=_[_0xd4ca('0x2e')](_0x7b4f6f['model'],qs[_0xd4ca('0x31')](_0x1fdb1e['query'][_0xd4ca('0x31')]));_0xc1a28f['attributes']=_0xc1a28f[_0xd4ca('0x30')]['length']?_0xc1a28f[_0xd4ca('0x30')]:_0x7b4f6f[_0xd4ca('0x2f')];_0xc1a28f[_0xd4ca('0x48')]=qs[_0xd4ca('0x33')](_0x1fdb1e[_0xd4ca('0x2c')][_0xd4ca('0x33')]);_0xc1a28f['where']=qs[_0xd4ca('0x35')](_[_0xd4ca('0x36')](_0x1fdb1e[_0xd4ca('0x2c')],_0x7b4f6f[_0xd4ca('0x35')]));if(_0x1fdb1e['query'][_0xd4ca('0x37')]){_0xc1a28f[_0xd4ca('0x34')]=_[_0xd4ca('0x38')](_0xc1a28f[_0xd4ca('0x34')],{'$or':_[_0xd4ca('0x27')](_0xc1a28f[_0xd4ca('0x30')],function(_0x21418c){var _0x304cd4={};_0x304cd4[_0x21418c]={'$like':'%'+_0x1fdb1e[_0xd4ca('0x2c')]['filter']+'%'};return _0x304cd4;})});}_0xc1a28f=_['merge']({},_0xc1a28f,_0x1fdb1e[_0xd4ca('0x3e')]);return _0x39a110[_0xd4ca('0x4c')](_0xc1a28f);}})['then'](function(_0x23c763){if(_0x23c763){_0x24443e=_0x23c763[_0xd4ca('0x47')];if(!_0x1fdb1e[_0xd4ca('0x2c')][_0xd4ca('0x49')](_0xd4ca('0x32'))){_0xc1a28f['limit']=qs[_0xd4ca('0x1d')](_0x1fdb1e['query'][_0xd4ca('0x1d')]);_0xc1a28f[_0xd4ca('0x1c')]=qs['offset'](_0x1fdb1e[_0xd4ca('0x2c')]['offset']);}return _0x39a110[_0xd4ca('0x4c')](_0xc1a28f);}})['then'](function(_0xd1d6cb){if(_0xd1d6cb){return _0xd1d6cb?{'count':_0x24443e,'rows':_0xd1d6cb}:null;}})[_0xd4ca('0x23')](respondWithResult(_0x1a4f9c,null))[_0xd4ca('0x3d')](handleError(_0x1a4f9c,null));};exports['setTags']=function(_0x3ccb3a,_0x3b8480,_0x3f43d3){if(_0x3ccb3a[_0xd4ca('0x40')]['id']){delete _0x3ccb3a[_0xd4ca('0x40')]['id'];}return db['ZendeskConfiguration'][_0xd4ca('0x45')]({'where':{'id':_0x3ccb3a[_0xd4ca('0x43')]['id']}})[_0xd4ca('0x23')](handleEntityNotFound(_0x3b8480,null))['then'](function(_0x3a1160){if(_0x3a1160){return _0x3a1160[_0xd4ca('0x4d')](_0x3ccb3a[_0xd4ca('0x40')]['ids']||[]);}return null;})['then'](respondWithResult(_0x3b8480,null))[_0xd4ca('0x3d')](handleError(_0x3b8480,null));}; \ No newline at end of file +var _0xdd70=['squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','send','index','map','ZendeskConfiguration','rawAttributes','type','key','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','filters','merge','VIRTUAL','name','filter','options','where','include','findAll','catch','params','includeAll','find','create','body','update','getFields','findOne','ZendeskField','pick','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x1d79a1,_0x1c4bac){var _0x5e5ed1=function(_0xd39dd8){while(--_0xd39dd8){_0x1d79a1['push'](_0x1d79a1['shift']());}};_0x5e5ed1(++_0x1c4bac);}(_0xdd70,0x9e));var _0x0dd7=function(_0x527583,_0x2192a6){_0x527583=_0x527583-0x0;var _0x21c304=_0xdd70[_0x527583];return _0x21c304;};'use strict';var emlformat=require(_0x0dd7('0x0'));var rimraf=require(_0x0dd7('0x1'));var zipdir=require(_0x0dd7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0dd7('0x3'));var Mustache=require(_0x0dd7('0x4'));var util=require(_0x0dd7('0x5'));var path=require(_0x0dd7('0x6'));var sox=require(_0x0dd7('0x7'));var csv=require(_0x0dd7('0x8'));var ejs=require(_0x0dd7('0x9'));var fs=require('fs');var fs_extra=require(_0x0dd7('0xa'));var _=require(_0x0dd7('0xb'));var squel=require(_0x0dd7('0xc'));var crypto=require(_0x0dd7('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0dd7('0xe'));var toCsv=require(_0x0dd7('0x8'));var querystring=require(_0x0dd7('0xf'));var Papa=require(_0x0dd7('0x10'));var Redis=require(_0x0dd7('0x11'));var authService=require(_0x0dd7('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0dd7('0x13'));var hardwareService=require(_0x0dd7('0x14'));var logger=require('../../config/logger')(_0x0dd7('0x15'));var utils=require(_0x0dd7('0x16'));var config=require(_0x0dd7('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0dd7('0x18'))['db'];function respondWithStatusCode(_0x5ef6d1,_0x6942ec){_0x6942ec=_0x6942ec||0xcc;return function(_0x9e7635){if(_0x9e7635){return _0x5ef6d1['sendStatus'](_0x6942ec);}return _0x5ef6d1['status'](_0x6942ec)[_0x0dd7('0x19')]();};}function respondWithResult(_0x440419,_0x3c9ee9){_0x3c9ee9=_0x3c9ee9||0xc8;return function(_0x186a42){if(_0x186a42){return _0x440419[_0x0dd7('0x1a')](_0x3c9ee9)[_0x0dd7('0x1b')](_0x186a42);}};}function respondWithFilteredResult(_0x3e2a4e,_0x1819e7){return function(_0x370d04){if(_0x370d04){var _0x3bbeb2=typeof _0x1819e7[_0x0dd7('0x1c')]==='undefined'&&typeof _0x1819e7['limit']===_0x0dd7('0x1d');var _0x4272e5=_0x370d04[_0x0dd7('0x1e')];var _0x5d8ac5=_0x3bbeb2?0x0:_0x1819e7['offset'];var _0x48568a=_0x3bbeb2?_0x370d04[_0x0dd7('0x1e')]:_0x1819e7[_0x0dd7('0x1c')]+_0x1819e7[_0x0dd7('0x1f')];var _0x57f572;if(_0x48568a>=_0x4272e5){_0x48568a=_0x4272e5;_0x57f572=0xc8;}else{_0x57f572=0xce;}_0x3e2a4e['status'](_0x57f572);return _0x3e2a4e[_0x0dd7('0x20')](_0x0dd7('0x21'),_0x5d8ac5+'-'+_0x48568a+'/'+_0x4272e5)[_0x0dd7('0x1b')](_0x370d04);}return null;};}function patchUpdates(_0x358938){return function(_0x50f7ba){try{jsonpatch[_0x0dd7('0x22')](_0x50f7ba,_0x358938,!![]);}catch(_0x464706){return BPromise[_0x0dd7('0x23')](_0x464706);}return _0x50f7ba[_0x0dd7('0x24')]();};}function saveUpdates(_0x1ed70c,_0x23cbdf){return function(_0x1fa871){if(_0x1fa871){return _0x1fa871['update'](_0x1ed70c)[_0x0dd7('0x25')](function(_0x724612){return _0x724612;});}return null;};}function removeEntity(_0x4228e6,_0x4117a6){return function(_0x26977e){if(_0x26977e){return _0x26977e[_0x0dd7('0x26')]()[_0x0dd7('0x25')](function(){_0x4228e6[_0x0dd7('0x1a')](0xcc)[_0x0dd7('0x19')]();});}};}function handleEntityNotFound(_0xb58e6a,_0x36131f){return function(_0x26f341){if(!_0x26f341){_0xb58e6a[_0x0dd7('0x27')](0x194);}return _0x26f341;};}function handleError(_0x3f1276,_0x24a638){_0x24a638=_0x24a638||0x1f4;return function(_0x4caa02){logger[_0x0dd7('0x28')](_0x4caa02[_0x0dd7('0x29')]);if(_0x4caa02['name']){delete _0x4caa02['name'];}_0x3f1276[_0x0dd7('0x1a')](_0x24a638)[_0x0dd7('0x2a')](_0x4caa02);};}exports[_0x0dd7('0x2b')]=function(_0x1dafc0,_0x229570){var _0x327216={},_0x298132={},_0x3d3e8a={'count':0x0,'rows':[]};var _0x4ba47f=_[_0x0dd7('0x2c')](db[_0x0dd7('0x2d')][_0x0dd7('0x2e')],function(_0x3908fe){return{'name':_0x3908fe['fieldName'],'type':_0x3908fe[_0x0dd7('0x2f')][_0x0dd7('0x30')]};});_0x298132['model']=_['map'](_0x4ba47f,'name');_0x298132[_0x0dd7('0x31')]=_[_0x0dd7('0x32')](_0x1dafc0['query']);_0x298132['filters']=_[_0x0dd7('0x33')](_0x298132['model'],_0x298132[_0x0dd7('0x31')]);_0x327216[_0x0dd7('0x34')]=_['intersection'](_0x298132[_0x0dd7('0x35')],qs['fields'](_0x1dafc0['query'][_0x0dd7('0x36')]));_0x327216['attributes']=_0x327216[_0x0dd7('0x34')][_0x0dd7('0x37')]?_0x327216['attributes']:_0x298132['model'];if(!_0x1dafc0['query'][_0x0dd7('0x38')](_0x0dd7('0x39'))){_0x327216['limit']=qs[_0x0dd7('0x1f')](_0x1dafc0[_0x0dd7('0x31')]['limit']);_0x327216[_0x0dd7('0x1c')]=qs['offset'](_0x1dafc0['query'][_0x0dd7('0x1c')]);}_0x327216[_0x0dd7('0x3a')]=qs[_0x0dd7('0x3b')](_0x1dafc0[_0x0dd7('0x31')][_0x0dd7('0x3b')]);_0x327216['where']=qs[_0x0dd7('0x3c')](_['pick'](_0x1dafc0[_0x0dd7('0x31')],_0x298132[_0x0dd7('0x3c')]),_0x4ba47f);if(_0x1dafc0[_0x0dd7('0x31')]['filter']){_0x327216['where']=_[_0x0dd7('0x3d')](_0x327216['where'],{'$or':_[_0x0dd7('0x2c')](_0x4ba47f,function(_0x2b5dcc){if(_0x2b5dcc[_0x0dd7('0x2f')]!==_0x0dd7('0x3e')){var _0x5a9b6c={};_0x5a9b6c[_0x2b5dcc[_0x0dd7('0x3f')]]={'$like':'%'+_0x1dafc0[_0x0dd7('0x31')][_0x0dd7('0x40')]+'%'};return _0x5a9b6c;}})});}_0x327216=_[_0x0dd7('0x3d')]({},_0x327216,_0x1dafc0[_0x0dd7('0x41')]);var _0x5008b9={'where':_0x327216[_0x0dd7('0x42')]};return db[_0x0dd7('0x2d')]['count'](_0x5008b9)[_0x0dd7('0x25')](function(_0x26c2fc){_0x3d3e8a[_0x0dd7('0x1e')]=_0x26c2fc;if(_0x1dafc0[_0x0dd7('0x31')]['includeAll']){_0x327216[_0x0dd7('0x43')]=[{'all':!![]}];}return db[_0x0dd7('0x2d')][_0x0dd7('0x44')](_0x327216);})[_0x0dd7('0x25')](function(_0xd31208){_0x3d3e8a['rows']=_0xd31208;return _0x3d3e8a;})[_0x0dd7('0x25')](respondWithFilteredResult(_0x229570,_0x327216))[_0x0dd7('0x45')](handleError(_0x229570,null));};exports['show']=function(_0x54ead4,_0x202dac){var _0x5a424e={'raw':![],'where':{'id':_0x54ead4[_0x0dd7('0x46')]['id']}},_0x3c8370={};_0x3c8370[_0x0dd7('0x35')]=_[_0x0dd7('0x32')](db[_0x0dd7('0x2d')]['rawAttributes']);_0x3c8370[_0x0dd7('0x31')]=_[_0x0dd7('0x32')](_0x54ead4[_0x0dd7('0x31')]);_0x3c8370[_0x0dd7('0x3c')]=_[_0x0dd7('0x33')](_0x3c8370[_0x0dd7('0x35')],_0x3c8370[_0x0dd7('0x31')]);_0x5a424e['attributes']=_['intersection'](_0x3c8370[_0x0dd7('0x35')],qs[_0x0dd7('0x36')](_0x54ead4['query'][_0x0dd7('0x36')]));_0x5a424e['attributes']=_0x5a424e[_0x0dd7('0x34')][_0x0dd7('0x37')]?_0x5a424e['attributes']:_0x3c8370[_0x0dd7('0x35')];if(_0x54ead4[_0x0dd7('0x31')][_0x0dd7('0x47')]){_0x5a424e[_0x0dd7('0x43')]=[{'all':!![]}];}_0x5a424e=_[_0x0dd7('0x3d')]({},_0x5a424e,_0x54ead4['options']);return db['ZendeskConfiguration'][_0x0dd7('0x48')](_0x5a424e)[_0x0dd7('0x25')](handleEntityNotFound(_0x202dac,null))[_0x0dd7('0x25')](respondWithResult(_0x202dac,null))[_0x0dd7('0x45')](handleError(_0x202dac,null));};exports[_0x0dd7('0x49')]=function(_0xbfb96d,_0x38cb38){return db['ZendeskConfiguration']['create'](_0xbfb96d[_0x0dd7('0x4a')],{})['then'](respondWithResult(_0x38cb38,0xc9))[_0x0dd7('0x45')](handleError(_0x38cb38,null));};exports[_0x0dd7('0x4b')]=function(_0x2151a0,_0xc4e0ed){if(_0x2151a0[_0x0dd7('0x4a')]['id']){delete _0x2151a0[_0x0dd7('0x4a')]['id'];}return db[_0x0dd7('0x2d')]['find']({'where':{'id':_0x2151a0[_0x0dd7('0x46')]['id']}})['then'](handleEntityNotFound(_0xc4e0ed,null))[_0x0dd7('0x25')](saveUpdates(_0x2151a0[_0x0dd7('0x4a')],null))[_0x0dd7('0x25')](respondWithResult(_0xc4e0ed,null))[_0x0dd7('0x45')](handleError(_0xc4e0ed,null));};exports[_0x0dd7('0x26')]=function(_0x268ff4,_0x29adf8){return db[_0x0dd7('0x2d')]['find']({'where':{'id':_0x268ff4[_0x0dd7('0x46')]['id']}})['then'](handleEntityNotFound(_0x29adf8,null))['then'](removeEntity(_0x29adf8,null))['catch'](handleError(_0x29adf8,null));};exports[_0x0dd7('0x4c')]=function(_0x2940bd,_0x59b2df,_0x1660a2){var _0x40a7ae={};var _0x649b17={};var _0x3f7d48;var _0x2d6b89;return db[_0x0dd7('0x2d')][_0x0dd7('0x4d')]({'where':{'id':_0x2940bd[_0x0dd7('0x46')]['id']}})[_0x0dd7('0x25')](handleEntityNotFound(_0x59b2df,null))[_0x0dd7('0x25')](function(_0x157e33){if(_0x157e33){_0x3f7d48=_0x157e33;_0x649b17[_0x0dd7('0x35')]=_[_0x0dd7('0x32')](db[_0x0dd7('0x4e')]['rawAttributes']);_0x649b17[_0x0dd7('0x31')]=_['keys'](_0x2940bd['query']);_0x649b17[_0x0dd7('0x3c')]=_[_0x0dd7('0x33')](_0x649b17[_0x0dd7('0x35')],_0x649b17[_0x0dd7('0x31')]);_0x40a7ae['attributes']=_[_0x0dd7('0x33')](_0x649b17[_0x0dd7('0x35')],qs[_0x0dd7('0x36')](_0x2940bd['query'][_0x0dd7('0x36')]));_0x40a7ae[_0x0dd7('0x34')]=_0x40a7ae[_0x0dd7('0x34')][_0x0dd7('0x37')]?_0x40a7ae['attributes']:_0x649b17[_0x0dd7('0x35')];_0x40a7ae[_0x0dd7('0x3a')]=qs[_0x0dd7('0x3b')](_0x2940bd[_0x0dd7('0x31')][_0x0dd7('0x3b')]);_0x40a7ae[_0x0dd7('0x42')]=qs[_0x0dd7('0x3c')](_[_0x0dd7('0x4f')](_0x2940bd[_0x0dd7('0x31')],_0x649b17['filters']));if(_0x2940bd[_0x0dd7('0x31')]['filter']){_0x40a7ae[_0x0dd7('0x42')]=_[_0x0dd7('0x3d')](_0x40a7ae[_0x0dd7('0x42')],{'$or':_[_0x0dd7('0x2c')](_0x40a7ae[_0x0dd7('0x34')],function(_0x48ba8a){var _0x5d0c7c={};_0x5d0c7c[_0x48ba8a]={'$like':'%'+_0x2940bd[_0x0dd7('0x31')][_0x0dd7('0x40')]+'%'};return _0x5d0c7c;})});}_0x40a7ae=_[_0x0dd7('0x3d')]({},_0x40a7ae,_0x2940bd[_0x0dd7('0x41')]);return _0x3f7d48['getFields'](_0x40a7ae);}})['then'](function(_0x43e02c){if(_0x43e02c){_0x2d6b89=_0x43e02c[_0x0dd7('0x37')];if(!_0x2940bd[_0x0dd7('0x31')][_0x0dd7('0x38')]('nolimit')){_0x40a7ae[_0x0dd7('0x1f')]=qs[_0x0dd7('0x1f')](_0x2940bd['query'][_0x0dd7('0x1f')]);_0x40a7ae[_0x0dd7('0x1c')]=qs['offset'](_0x2940bd['query'][_0x0dd7('0x1c')]);}return _0x3f7d48['getFields'](_0x40a7ae);}})[_0x0dd7('0x25')](function(_0x3627c0){if(_0x3627c0){return _0x3627c0?{'count':_0x2d6b89,'rows':_0x3627c0}:null;}})[_0x0dd7('0x25')](respondWithResult(_0x59b2df,null))[_0x0dd7('0x45')](handleError(_0x59b2df,null));};exports[_0x0dd7('0x50')]=function(_0x123dff,_0x257db8,_0xb42fc6){var _0x2e1f8a={};var _0x541403={};var _0x144f5e;var _0x5709ad;return db['ZendeskConfiguration'][_0x0dd7('0x4d')]({'where':{'id':_0x123dff[_0x0dd7('0x46')]['id']}})[_0x0dd7('0x25')](handleEntityNotFound(_0x257db8,null))['then'](function(_0x5e9b96){if(_0x5e9b96){_0x144f5e=_0x5e9b96;_0x541403[_0x0dd7('0x35')]=_['keys'](db[_0x0dd7('0x4e')][_0x0dd7('0x2e')]);_0x541403[_0x0dd7('0x31')]=_[_0x0dd7('0x32')](_0x123dff[_0x0dd7('0x31')]);_0x541403['filters']=_[_0x0dd7('0x33')](_0x541403['model'],_0x541403['query']);_0x2e1f8a['attributes']=_[_0x0dd7('0x33')](_0x541403[_0x0dd7('0x35')],qs[_0x0dd7('0x36')](_0x123dff[_0x0dd7('0x31')][_0x0dd7('0x36')]));_0x2e1f8a[_0x0dd7('0x34')]=_0x2e1f8a[_0x0dd7('0x34')][_0x0dd7('0x37')]?_0x2e1f8a['attributes']:_0x541403[_0x0dd7('0x35')];_0x2e1f8a[_0x0dd7('0x3a')]=qs['sort'](_0x123dff['query'][_0x0dd7('0x3b')]);_0x2e1f8a[_0x0dd7('0x42')]=qs['filters'](_[_0x0dd7('0x4f')](_0x123dff[_0x0dd7('0x31')],_0x541403['filters']));if(_0x123dff[_0x0dd7('0x31')][_0x0dd7('0x40')]){_0x2e1f8a[_0x0dd7('0x42')]=_[_0x0dd7('0x3d')](_0x2e1f8a['where'],{'$or':_['map'](_0x2e1f8a[_0x0dd7('0x34')],function(_0xa1361d){var _0x2d8e3b={};_0x2d8e3b[_0xa1361d]={'$like':'%'+_0x123dff[_0x0dd7('0x31')][_0x0dd7('0x40')]+'%'};return _0x2d8e3b;})});}_0x2e1f8a=_[_0x0dd7('0x3d')]({},_0x2e1f8a,_0x123dff[_0x0dd7('0x41')]);return _0x144f5e[_0x0dd7('0x50')](_0x2e1f8a);}})['then'](function(_0x10dab4){if(_0x10dab4){_0x5709ad=_0x10dab4[_0x0dd7('0x37')];if(!_0x123dff[_0x0dd7('0x31')][_0x0dd7('0x38')](_0x0dd7('0x39'))){_0x2e1f8a['limit']=qs[_0x0dd7('0x1f')](_0x123dff[_0x0dd7('0x31')]['limit']);_0x2e1f8a[_0x0dd7('0x1c')]=qs[_0x0dd7('0x1c')](_0x123dff['query'][_0x0dd7('0x1c')]);}return _0x144f5e[_0x0dd7('0x50')](_0x2e1f8a);}})[_0x0dd7('0x25')](function(_0x2d0c0d){if(_0x2d0c0d){return _0x2d0c0d?{'count':_0x5709ad,'rows':_0x2d0c0d}:null;}})[_0x0dd7('0x25')](respondWithResult(_0x257db8,null))[_0x0dd7('0x45')](handleError(_0x257db8,null));};exports[_0x0dd7('0x51')]=function(_0x44037f,_0x47dcdc,_0x3eb1ad){var _0x1e8163={};var _0x4ed4e9={};var _0x76ea7f;var _0x2746c8;return db[_0x0dd7('0x2d')][_0x0dd7('0x4d')]({'where':{'id':_0x44037f[_0x0dd7('0x46')]['id']}})[_0x0dd7('0x25')](handleEntityNotFound(_0x47dcdc,null))['then'](function(_0x5d0aa0){if(_0x5d0aa0){_0x76ea7f=_0x5d0aa0;_0x4ed4e9[_0x0dd7('0x35')]=_[_0x0dd7('0x32')](db[_0x0dd7('0x4e')][_0x0dd7('0x2e')]);_0x4ed4e9[_0x0dd7('0x31')]=_[_0x0dd7('0x32')](_0x44037f[_0x0dd7('0x31')]);_0x4ed4e9['filters']=_[_0x0dd7('0x33')](_0x4ed4e9[_0x0dd7('0x35')],_0x4ed4e9['query']);_0x1e8163[_0x0dd7('0x34')]=_[_0x0dd7('0x33')](_0x4ed4e9[_0x0dd7('0x35')],qs[_0x0dd7('0x36')](_0x44037f['query'][_0x0dd7('0x36')]));_0x1e8163[_0x0dd7('0x34')]=_0x1e8163[_0x0dd7('0x34')]['length']?_0x1e8163[_0x0dd7('0x34')]:_0x4ed4e9['model'];_0x1e8163['order']=qs[_0x0dd7('0x3b')](_0x44037f['query']['sort']);_0x1e8163[_0x0dd7('0x42')]=qs[_0x0dd7('0x3c')](_[_0x0dd7('0x4f')](_0x44037f[_0x0dd7('0x31')],_0x4ed4e9[_0x0dd7('0x3c')]));if(_0x44037f['query'][_0x0dd7('0x40')]){_0x1e8163[_0x0dd7('0x42')]=_[_0x0dd7('0x3d')](_0x1e8163[_0x0dd7('0x42')],{'$or':_['map'](_0x1e8163['attributes'],function(_0x3b21e4){var _0x33104f={};_0x33104f[_0x3b21e4]={'$like':'%'+_0x44037f[_0x0dd7('0x31')][_0x0dd7('0x40')]+'%'};return _0x33104f;})});}_0x1e8163=_[_0x0dd7('0x3d')]({},_0x1e8163,_0x44037f['options']);return _0x76ea7f[_0x0dd7('0x51')](_0x1e8163);}})[_0x0dd7('0x25')](function(_0x1f0b86){if(_0x1f0b86){_0x2746c8=_0x1f0b86['length'];if(!_0x44037f['query'][_0x0dd7('0x38')]('nolimit')){_0x1e8163['limit']=qs[_0x0dd7('0x1f')](_0x44037f['query'][_0x0dd7('0x1f')]);_0x1e8163[_0x0dd7('0x1c')]=qs['offset'](_0x44037f['query']['offset']);}return _0x76ea7f[_0x0dd7('0x51')](_0x1e8163);}})[_0x0dd7('0x25')](function(_0x3f2438){if(_0x3f2438){return _0x3f2438?{'count':_0x2746c8,'rows':_0x3f2438}:null;}})[_0x0dd7('0x25')](respondWithResult(_0x47dcdc,null))[_0x0dd7('0x45')](handleError(_0x47dcdc,null));};exports[_0x0dd7('0x52')]=function(_0x209b7c,_0x1762af,_0xe22f1c){var _0x256948={};var _0x596c72={};var _0x402254;var _0x7b0840;return db['ZendeskConfiguration'][_0x0dd7('0x4d')]({'where':{'id':_0x209b7c[_0x0dd7('0x46')]['id']}})[_0x0dd7('0x25')](handleEntityNotFound(_0x1762af,null))[_0x0dd7('0x25')](function(_0x4ba8c3){if(_0x4ba8c3){_0x402254=_0x4ba8c3;_0x596c72['model']=_[_0x0dd7('0x32')](db['Tag']['rawAttributes']);_0x596c72['query']=_[_0x0dd7('0x32')](_0x209b7c[_0x0dd7('0x31')]);_0x596c72[_0x0dd7('0x3c')]=_['intersection'](_0x596c72[_0x0dd7('0x35')],_0x596c72[_0x0dd7('0x31')]);_0x256948['attributes']=_[_0x0dd7('0x33')](_0x596c72[_0x0dd7('0x35')],qs[_0x0dd7('0x36')](_0x209b7c[_0x0dd7('0x31')][_0x0dd7('0x36')]));_0x256948['attributes']=_0x256948[_0x0dd7('0x34')][_0x0dd7('0x37')]?_0x256948['attributes']:_0x596c72['model'];_0x256948[_0x0dd7('0x3a')]=qs[_0x0dd7('0x3b')](_0x209b7c['query'][_0x0dd7('0x3b')]);_0x256948['where']=qs[_0x0dd7('0x3c')](_[_0x0dd7('0x4f')](_0x209b7c[_0x0dd7('0x31')],_0x596c72[_0x0dd7('0x3c')]));if(_0x209b7c[_0x0dd7('0x31')][_0x0dd7('0x40')]){_0x256948[_0x0dd7('0x42')]=_[_0x0dd7('0x3d')](_0x256948[_0x0dd7('0x42')],{'$or':_[_0x0dd7('0x2c')](_0x256948['attributes'],function(_0x3b8d68){var _0x17734f={};_0x17734f[_0x3b8d68]={'$like':'%'+_0x209b7c['query'][_0x0dd7('0x40')]+'%'};return _0x17734f;})});}_0x256948=_['merge']({},_0x256948,_0x209b7c[_0x0dd7('0x41')]);return _0x402254[_0x0dd7('0x52')](_0x256948);}})[_0x0dd7('0x25')](function(_0x28e603){if(_0x28e603){_0x7b0840=_0x28e603['length'];if(!_0x209b7c[_0x0dd7('0x31')][_0x0dd7('0x38')]('nolimit')){_0x256948[_0x0dd7('0x1f')]=qs['limit'](_0x209b7c[_0x0dd7('0x31')]['limit']);_0x256948[_0x0dd7('0x1c')]=qs['offset'](_0x209b7c[_0x0dd7('0x31')][_0x0dd7('0x1c')]);}return _0x402254[_0x0dd7('0x52')](_0x256948);}})[_0x0dd7('0x25')](function(_0x38ae8e){if(_0x38ae8e){return _0x38ae8e?{'count':_0x7b0840,'rows':_0x38ae8e}:null;}})[_0x0dd7('0x25')](respondWithResult(_0x1762af,null))[_0x0dd7('0x45')](handleError(_0x1762af,null));};exports[_0x0dd7('0x53')]=function(_0x51853c,_0x82f668,_0x33a026){if(_0x51853c[_0x0dd7('0x4a')]['id']){delete _0x51853c[_0x0dd7('0x4a')]['id'];}return db[_0x0dd7('0x2d')][_0x0dd7('0x4d')]({'where':{'id':_0x51853c['params']['id']}})['then'](handleEntityNotFound(_0x82f668,null))['then'](function(_0x4bf985){if(_0x4bf985){return _0x4bf985['setTags'](_0x51853c[_0x0dd7('0x4a')][_0x0dd7('0x54')]||[]);}return null;})[_0x0dd7('0x25')](respondWithResult(_0x82f668,null))[_0x0dd7('0x45')](handleError(_0x82f668,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 951936c..ca01f14 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 _0xb62e=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','define','int_zendesk_configurations','lodash','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb62e,0x1de));var _0xeb62=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xb62e[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xeb62('0x0'));var util=require(_0xeb62('0x1'));var logger=require(_0xeb62('0x2'))(_0xeb62('0x3'));var moment=require('moment');var BPromise=require(_0xeb62('0x4'));var rp=require(_0xeb62('0x5'));var fs=require('fs');var path=require(_0xeb62('0x6'));var rimraf=require(_0xeb62('0x7'));var config=require(_0xeb62('0x8'));var attributes=require(_0xeb62('0x9'));module['exports']=function(_0x3ec879,_0x455e1a){return _0x3ec879[_0xeb62('0xa')]('ZendeskConfiguration',attributes,{'tableName':_0xeb62('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbbbc=['request-promise','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x4a29a9,_0x58cd04){_0x4a29a9=_0x4a29a9-0x0;var _0x386570=_0xbbbc[_0x4a29a9];return _0x386570;};'use strict';var _=require(_0xcbbb('0x0'));var util=require(_0xcbbb('0x1'));var logger=require(_0xcbbb('0x2'))(_0xcbbb('0x3'));var moment=require(_0xcbbb('0x4'));var BPromise=require(_0xcbbb('0x5'));var rp=require(_0xcbbb('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcbbb('0x7'));var config=require(_0xcbbb('0x8'));var attributes=require(_0xcbbb('0x9'));module[_0xcbbb('0xa')]=function(_0x43ff05,_0x4978a9){return _0x43ff05[_0xcbbb('0xb')](_0xcbbb('0xc'),attributes,{'tableName':_0xcbbb('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index e39173b..766fc1a 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 _0xdedc=['../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2cec49,_0xf3707e){var _0x2c6cd9=function(_0x5b2e00){while(--_0x5b2e00){_0x2cec49['push'](_0x2cec49['shift']());}};_0x2c6cd9(++_0xf3707e);}(_0xdedc,0xcc));var _0xcded=function(_0x480391,_0x13c3ad){_0x480391=_0x480391-0x0;var _0x18a535=_0xdedc[_0x480391];return _0x18a535;};'use strict';var _=require('lodash');var util=require(_0xcded('0x0'));var moment=require('moment');var BPromise=require(_0xcded('0x1'));var rs=require(_0xcded('0x2'));var fs=require('fs');var Redis=require(_0xcded('0x3'));var db=require(_0xcded('0x4'))['db'];var utils=require(_0xcded('0x5'));var logger=require(_0xcded('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xcded('0x7'));var client=jayson[_0xcded('0x8')][_0xcded('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x263953,_0x97bc11,_0xce63ef){return new BPromise(function(_0xd4772d,_0x2747d8){return client[_0xcded('0xa')](_0x263953,_0xce63ef)[_0xcded('0xb')](function(_0x3e1082){logger[_0xcded('0xc')](_0xcded('0xd'),_0x97bc11,_0xcded('0xe'));logger['debug'](_0xcded('0xf'),_0x97bc11,_0xcded('0xe'),JSON['stringify'](_0x3e1082));if(_0x3e1082[_0xcded('0x10')]){if(_0x3e1082[_0xcded('0x10')][_0xcded('0x11')]===0x1f4){logger['error'](_0xcded('0xd'),_0x97bc11,_0x3e1082[_0xcded('0x10')]['message']);return _0x2747d8(_0x3e1082['error']['message']);}logger['error'](_0xcded('0xd'),_0x97bc11,_0x3e1082['error'][_0xcded('0x12')]);return _0xd4772d(_0x3e1082[_0xcded('0x10')][_0xcded('0x12')]);}else{logger[_0xcded('0xc')](_0xcded('0xd'),_0x97bc11,_0xcded('0xe'));_0xd4772d(_0x3e1082['result'][_0xcded('0x12')]);}})['catch'](function(_0xd5425f){logger[_0xcded('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x97bc11,_0xd5425f);_0x2747d8(_0xd5425f);});});} \ No newline at end of file +var _0x6abd=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x6abd,0xa8));var _0xd6ab=function(_0x19754a,_0x3050aa){_0x19754a=_0x19754a-0x0;var _0x4f8f3f=_0x6abd[_0x19754a];return _0x4f8f3f;};'use strict';var _=require(_0xd6ab('0x0'));var util=require(_0xd6ab('0x1'));var moment=require(_0xd6ab('0x2'));var BPromise=require(_0xd6ab('0x3'));var rs=require(_0xd6ab('0x4'));var fs=require('fs');var Redis=require(_0xd6ab('0x5'));var db=require(_0xd6ab('0x6'))['db'];var utils=require(_0xd6ab('0x7'));var logger=require(_0xd6ab('0x8'))(_0xd6ab('0x9'));var config=require(_0xd6ab('0xa'));var jayson=require(_0xd6ab('0xb'));var client=jayson[_0xd6ab('0xc')][_0xd6ab('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x182c1d,_0x245175,_0x27b9c4){return new BPromise(function(_0x231d19,_0x16fa40){return client[_0xd6ab('0xe')](_0x182c1d,_0x27b9c4)['then'](function(_0x2d5b85){logger['info'](_0xd6ab('0xf'),_0x245175,_0xd6ab('0x10'));logger[_0xd6ab('0x11')](_0xd6ab('0x12'),_0x245175,'request\x20sent',JSON[_0xd6ab('0x13')](_0x2d5b85));if(_0x2d5b85['error']){if(_0x2d5b85[_0xd6ab('0x14')][_0xd6ab('0x15')]===0x1f4){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x245175,_0x2d5b85['error'][_0xd6ab('0x16')]);return _0x16fa40(_0x2d5b85[_0xd6ab('0x14')]['message']);}logger[_0xd6ab('0x14')](_0xd6ab('0xf'),_0x245175,_0x2d5b85[_0xd6ab('0x14')][_0xd6ab('0x16')]);return _0x231d19(_0x2d5b85[_0xd6ab('0x14')][_0xd6ab('0x16')]);}else{logger['info'](_0xd6ab('0xf'),_0x245175,_0xd6ab('0x10'));_0x231d19(_0x2d5b85['result'][_0xd6ab('0x16')]);}})[_0xd6ab('0x17')](function(_0x252185){logger[_0xd6ab('0x14')]('ZendeskConfiguration,\x20%s,\x20%s',_0x245175,_0x252185);_0x16fa40(_0x252185);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 0033fd5..d40374f 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 _0x881a=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','create','/:id','exports','multer','Router'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x881a,0xda));var _0xa881=function(_0x31c81b,_0x4a2b1c){_0x31c81b=_0x31c81b-0x0;var _0x52ab34=_0x881a[_0x31c81b];return _0x52ab34;};'use strict';var multer=require(_0xa881('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa881('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa881('0x2'));var config=require(_0xa881('0x3'));var controller=require('./intZendeskField.controller');router[_0xa881('0x4')]('/',auth[_0xa881('0x5')](),controller[_0xa881('0x6')]);router[_0xa881('0x4')]('/:id',auth[_0xa881('0x5')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xa881('0x7')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0xa881('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0xa881('0x9')]=router; \ No newline at end of file +var _0x98ab=['show','post','create','put','update','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id'];(function(_0x754eeb,_0x5296e6){var _0x4c272e=function(_0x27e1f3){while(--_0x27e1f3){_0x754eeb['push'](_0x754eeb['shift']());}};_0x4c272e(++_0x5296e6);}(_0x98ab,0x10a));var _0xb98a=function(_0xe73d1,_0x4b596b){_0xe73d1=_0xe73d1-0x0;var _0x4aadbd=_0x98ab[_0xe73d1];return _0x4aadbd;};'use strict';var multer=require(_0xb98a('0x0'));var util=require(_0xb98a('0x1'));var path=require(_0xb98a('0x2'));var timeout=require(_0xb98a('0x3'));var express=require(_0xb98a('0x4'));var router=express['Router']();var fs_extra=require(_0xb98a('0x5'));var auth=require(_0xb98a('0x6'));var interaction=require(_0xb98a('0x7'));var config=require(_0xb98a('0x8'));var controller=require(_0xb98a('0x9'));router[_0xb98a('0xa')]('/',auth[_0xb98a('0xb')](),controller[_0xb98a('0xc')]);router['get'](_0xb98a('0xd'),auth['isAuthenticated'](),controller[_0xb98a('0xe')]);router[_0xb98a('0xf')]('/',auth[_0xb98a('0xb')](),controller[_0xb98a('0x10')]);router[_0xb98a('0x11')](_0xb98a('0xd'),auth['isAuthenticated'](),controller[_0xb98a('0x12')]);router['delete']('/:id',auth[_0xb98a('0xb')](),controller['destroy']);module[_0xb98a('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 09cab7f..d7259f0 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 _0x4fe5=['customVariable','sequelize','exports','ENUM','string','variable','keyValue','picklist','STRING'];(function(_0x362671,_0x2ffc9f){var _0x47e58d=function(_0x50b04f){while(--_0x50b04f){_0x362671['push'](_0x362671['shift']());}};_0x47e58d(++_0x2ffc9f);}(_0x4fe5,0xd0));var _0x54fe=function(_0x4d08d3,_0x2f6e02){_0x4d08d3=_0x4d08d3-0x0;var _0x186977=_0x4fe5[_0x4d08d3];return _0x186977;};'use strict';var Sequelize=require(_0x54fe('0x0'));module[_0x54fe('0x1')]={'type':{'type':Sequelize[_0x54fe('0x2')](_0x54fe('0x3'),_0x54fe('0x4'),'customVariable',_0x54fe('0x5'),_0x54fe('0x6')),'defaultValue':_0x54fe('0x3')},'content':{'type':Sequelize[_0x54fe('0x7')]},'key':{'type':Sequelize[_0x54fe('0x7')]},'keyType':{'type':Sequelize[_0x54fe('0x2')](_0x54fe('0x3'),'variable',_0x54fe('0x8'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x54fe('0x7')]},'nameField':{'type':Sequelize[_0x54fe('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2895=['ENUM','string','customVariable','keyValue','picklist','STRING','variable','BOOLEAN','sequelize','exports'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x2895,0x80));var _0x5289=function(_0x42ded4,_0x4a5684){_0x42ded4=_0x42ded4-0x0;var _0x255d48=_0x2895[_0x42ded4];return _0x255d48;};'use strict';var Sequelize=require(_0x5289('0x0'));module[_0x5289('0x1')]={'type':{'type':Sequelize[_0x5289('0x2')](_0x5289('0x3'),'variable',_0x5289('0x4'),_0x5289('0x5'),_0x5289('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x5289('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x5289('0x2')](_0x5289('0x3'),_0x5289('0x8'),_0x5289('0x4'))},'keyContent':{'type':Sequelize[_0x5289('0x7')]},'idField':{'type':Sequelize[_0x5289('0x7')]},'nameField':{'type':Sequelize[_0x5289('0x7')]},'customField':{'type':Sequelize[_0x5289('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5289('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 62803a1..ef02c91 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 _0x5beb=['../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ZendeskField','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util'];(function(_0x47147e,_0x40a905){var _0x19673f=function(_0x2a7476){while(--_0x2a7476){_0x47147e['push'](_0x47147e['shift']());}};_0x19673f(++_0x40a905);}(_0x5beb,0x15c));var _0xb5be=function(_0x20b9b8,_0x3e33a5){_0x20b9b8=_0x20b9b8-0x0;var _0x2d7e82=_0x5beb[_0x20b9b8];return _0x2d7e82;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb5be('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb5be('0x1'));var rp=require(_0xb5be('0x2'));var moment=require(_0xb5be('0x3'));var BPromise=require(_0xb5be('0x4'));var Mustache=require('mustache');var util=require(_0xb5be('0x5'));var path=require(_0xb5be('0x6'));var sox=require('sox');var csv=require(_0xb5be('0x7'));var ejs=require(_0xb5be('0x8'));var fs=require('fs');var fs_extra=require(_0xb5be('0x9'));var _=require(_0xb5be('0xa'));var squel=require(_0xb5be('0xb'));var crypto=require(_0xb5be('0xc'));var jsforce=require(_0xb5be('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb5be('0x7'));var querystring=require(_0xb5be('0xe'));var Papa=require('papaparse');var Redis=require(_0xb5be('0xf'));var authService=require(_0xb5be('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb5be('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb5be('0x12'))(_0xb5be('0x13'));var utils=require(_0xb5be('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xb5be('0x15'));var db=require(_0xb5be('0x16'))['db'];function respondWithStatusCode(_0x4dfc1a,_0x204096){_0x204096=_0x204096||0xcc;return function(_0x296da5){if(_0x296da5){return _0x4dfc1a[_0xb5be('0x17')](_0x204096);}return _0x4dfc1a[_0xb5be('0x18')](_0x204096)[_0xb5be('0x19')]();};}function respondWithResult(_0x1f6134,_0x1e9fa9){_0x1e9fa9=_0x1e9fa9||0xc8;return function(_0x1c2246){if(_0x1c2246){return _0x1f6134['status'](_0x1e9fa9)[_0xb5be('0x1a')](_0x1c2246);}};}function respondWithFilteredResult(_0x1dcc59,_0x3e990f){return function(_0x5bbd44){if(_0x5bbd44){var _0x512828=typeof _0x3e990f[_0xb5be('0x1b')]===_0xb5be('0x1c')&&typeof _0x3e990f[_0xb5be('0x1d')]==='undefined';var _0x2e9146=_0x5bbd44[_0xb5be('0x1e')];var _0xff25c4=_0x512828?0x0:_0x3e990f[_0xb5be('0x1b')];var _0x57f6ff=_0x512828?_0x5bbd44[_0xb5be('0x1e')]:_0x3e990f['offset']+_0x3e990f[_0xb5be('0x1d')];var _0xa6071d;if(_0x57f6ff>=_0x2e9146){_0x57f6ff=_0x2e9146;_0xa6071d=0xc8;}else{_0xa6071d=0xce;}_0x1dcc59[_0xb5be('0x18')](_0xa6071d);return _0x1dcc59['set'](_0xb5be('0x1f'),_0xff25c4+'-'+_0x57f6ff+'/'+_0x2e9146)['json'](_0x5bbd44);}return null;};}function patchUpdates(_0x1a783f){return function(_0x1f8ed5){try{jsonpatch[_0xb5be('0x20')](_0x1f8ed5,_0x1a783f,!![]);}catch(_0x57281e){return BPromise[_0xb5be('0x21')](_0x57281e);}return _0x1f8ed5[_0xb5be('0x22')]();};}function saveUpdates(_0x41786f,_0x3560a2){return function(_0x4c40fb){if(_0x4c40fb){return _0x4c40fb[_0xb5be('0x23')](_0x41786f)[_0xb5be('0x24')](function(_0x2ce9f4){return _0x2ce9f4;});}return null;};}function removeEntity(_0x3a9c29,_0x29ff4e){return function(_0x2c87fd){if(_0x2c87fd){return _0x2c87fd[_0xb5be('0x25')]()[_0xb5be('0x24')](function(){_0x3a9c29[_0xb5be('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1126f7,_0x19d361){return function(_0x17c1d5){if(!_0x17c1d5){_0x1126f7[_0xb5be('0x17')](0x194);}return _0x17c1d5;};}function handleError(_0x2dd62e,_0x4fdf2){_0x4fdf2=_0x4fdf2||0x1f4;return function(_0x946d96){logger[_0xb5be('0x26')](_0x946d96[_0xb5be('0x27')]);if(_0x946d96['name']){delete _0x946d96[_0xb5be('0x28')];}_0x2dd62e['status'](_0x4fdf2)[_0xb5be('0x29')](_0x946d96);};}exports[_0xb5be('0x2a')]=function(_0x56293a,_0xfad8ce){var _0x58233e={},_0x3762cf={},_0x4f79ed={'count':0x0,'rows':[]};var _0xfc99cd=_[_0xb5be('0x2b')](db[_0xb5be('0x2c')][_0xb5be('0x2d')],function(_0x97037c){return{'name':_0x97037c['fieldName'],'type':_0x97037c['type'][_0xb5be('0x2e')]};});_0x3762cf[_0xb5be('0x2f')]=_['map'](_0xfc99cd,_0xb5be('0x28'));_0x3762cf[_0xb5be('0x30')]=_['keys'](_0x56293a[_0xb5be('0x30')]);_0x3762cf[_0xb5be('0x31')]=_[_0xb5be('0x32')](_0x3762cf[_0xb5be('0x2f')],_0x3762cf[_0xb5be('0x30')]);_0x58233e[_0xb5be('0x33')]=_[_0xb5be('0x32')](_0x3762cf[_0xb5be('0x2f')],qs[_0xb5be('0x34')](_0x56293a[_0xb5be('0x30')][_0xb5be('0x34')]));_0x58233e[_0xb5be('0x33')]=_0x58233e[_0xb5be('0x33')][_0xb5be('0x35')]?_0x58233e[_0xb5be('0x33')]:_0x3762cf[_0xb5be('0x2f')];if(!_0x56293a[_0xb5be('0x30')][_0xb5be('0x36')](_0xb5be('0x37'))){_0x58233e[_0xb5be('0x1d')]=qs[_0xb5be('0x1d')](_0x56293a['query'][_0xb5be('0x1d')]);_0x58233e[_0xb5be('0x1b')]=qs[_0xb5be('0x1b')](_0x56293a[_0xb5be('0x30')][_0xb5be('0x1b')]);}_0x58233e[_0xb5be('0x38')]=qs[_0xb5be('0x39')](_0x56293a['query']['sort']);_0x58233e['where']=qs[_0xb5be('0x31')](_['pick'](_0x56293a[_0xb5be('0x30')],_0x3762cf[_0xb5be('0x31')]),_0xfc99cd);if(_0x56293a[_0xb5be('0x30')]['filter']){_0x58233e[_0xb5be('0x3a')]=_[_0xb5be('0x3b')](_0x58233e['where'],{'$or':_['map'](_0xfc99cd,function(_0x36a53d){if(_0x36a53d[_0xb5be('0x3c')]!==_0xb5be('0x3d')){var _0x3e41a7={};_0x3e41a7[_0x36a53d[_0xb5be('0x28')]]={'$like':'%'+_0x56293a[_0xb5be('0x30')][_0xb5be('0x3e')]+'%'};return _0x3e41a7;}})});}_0x58233e=_[_0xb5be('0x3b')]({},_0x58233e,_0x56293a[_0xb5be('0x3f')]);var _0x48612d={'where':_0x58233e[_0xb5be('0x3a')]};return db[_0xb5be('0x2c')]['count'](_0x48612d)[_0xb5be('0x24')](function(_0xf6b505){_0x4f79ed[_0xb5be('0x1e')]=_0xf6b505;if(_0x56293a[_0xb5be('0x30')][_0xb5be('0x40')]){_0x58233e[_0xb5be('0x41')]=[{'all':!![]}];}return db[_0xb5be('0x2c')][_0xb5be('0x42')](_0x58233e);})[_0xb5be('0x24')](function(_0x25aded){_0x4f79ed['rows']=_0x25aded;return _0x4f79ed;})[_0xb5be('0x24')](respondWithFilteredResult(_0xfad8ce,_0x58233e))[_0xb5be('0x43')](handleError(_0xfad8ce,null));};exports[_0xb5be('0x44')]=function(_0x530cd2,_0x2e5ad1){var _0x312632={'raw':!![],'where':{'id':_0x530cd2[_0xb5be('0x45')]['id']}},_0x242037={};_0x242037[_0xb5be('0x2f')]=_[_0xb5be('0x46')](db[_0xb5be('0x2c')]['rawAttributes']);_0x242037[_0xb5be('0x30')]=_[_0xb5be('0x46')](_0x530cd2[_0xb5be('0x30')]);_0x242037['filters']=_['intersection'](_0x242037[_0xb5be('0x2f')],_0x242037[_0xb5be('0x30')]);_0x312632[_0xb5be('0x33')]=_[_0xb5be('0x32')](_0x242037[_0xb5be('0x2f')],qs['fields'](_0x530cd2[_0xb5be('0x30')][_0xb5be('0x34')]));_0x312632['attributes']=_0x312632[_0xb5be('0x33')][_0xb5be('0x35')]?_0x312632[_0xb5be('0x33')]:_0x242037[_0xb5be('0x2f')];if(_0x530cd2[_0xb5be('0x30')][_0xb5be('0x40')]){_0x312632[_0xb5be('0x41')]=[{'all':!![]}];}_0x312632=_[_0xb5be('0x3b')]({},_0x312632,_0x530cd2[_0xb5be('0x3f')]);return db[_0xb5be('0x2c')][_0xb5be('0x47')](_0x312632)[_0xb5be('0x24')](handleEntityNotFound(_0x2e5ad1,null))[_0xb5be('0x24')](respondWithResult(_0x2e5ad1,null))[_0xb5be('0x43')](handleError(_0x2e5ad1,null));};exports['create']=function(_0x43fc99,_0x5cf04c){return db[_0xb5be('0x2c')][_0xb5be('0x48')](_0x43fc99[_0xb5be('0x49')],{})[_0xb5be('0x24')](respondWithResult(_0x5cf04c,0xc9))[_0xb5be('0x43')](handleError(_0x5cf04c,null));};exports[_0xb5be('0x23')]=function(_0xd91fcf,_0x40da4c){if(_0xd91fcf['body']['id']){delete _0xd91fcf[_0xb5be('0x49')]['id'];}return db[_0xb5be('0x2c')][_0xb5be('0x47')]({'where':{'id':_0xd91fcf[_0xb5be('0x45')]['id']}})[_0xb5be('0x24')](handleEntityNotFound(_0x40da4c,null))[_0xb5be('0x24')](saveUpdates(_0xd91fcf['body'],null))[_0xb5be('0x24')](respondWithResult(_0x40da4c,null))['catch'](handleError(_0x40da4c,null));};exports[_0xb5be('0x25')]=function(_0x564bec,_0x287a2f){return db[_0xb5be('0x2c')]['find']({'where':{'id':_0x564bec['params']['id']}})['then'](handleEntityNotFound(_0x287a2f,null))[_0xb5be('0x24')](removeEntity(_0x287a2f,null))[_0xb5be('0x43')](handleError(_0x287a2f,null));}; \ No newline at end of file +var _0xd6d5=['error','stack','name','send','index','map','ZendeskField','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','catch','params','include','find','create','body','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','end','sendStatus'];(function(_0x413354,_0x583cae){var _0x31f617=function(_0x10ea2c){while(--_0x10ea2c){_0x413354['push'](_0x413354['shift']());}};_0x31f617(++_0x583cae);}(_0xd6d5,0x1de));var _0x5d6d=function(_0x28c939,_0x110e29){_0x28c939=_0x28c939-0x0;var _0x527fe9=_0xd6d5[_0x28c939];return _0x527fe9;};'use strict';var emlformat=require(_0x5d6d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5d6d('0x1'));var rp=require(_0x5d6d('0x2'));var moment=require('moment');var BPromise=require(_0x5d6d('0x3'));var Mustache=require(_0x5d6d('0x4'));var util=require(_0x5d6d('0x5'));var path=require(_0x5d6d('0x6'));var sox=require(_0x5d6d('0x7'));var csv=require(_0x5d6d('0x8'));var ejs=require(_0x5d6d('0x9'));var fs=require('fs');var fs_extra=require(_0x5d6d('0xa'));var _=require(_0x5d6d('0xb'));var squel=require(_0x5d6d('0xc'));var crypto=require(_0x5d6d('0xd'));var jsforce=require(_0x5d6d('0xe'));var deskjs=require(_0x5d6d('0xf'));var toCsv=require(_0x5d6d('0x8'));var querystring=require(_0x5d6d('0x10'));var Papa=require(_0x5d6d('0x11'));var Redis=require(_0x5d6d('0x12'));var authService=require(_0x5d6d('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x5d6d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x5d6d('0x15'));var config=require(_0x5d6d('0x16'));var licenseUtil=require(_0x5d6d('0x17'));var db=require(_0x5d6d('0x18'))['db'];function respondWithStatusCode(_0xd55c9b,_0xaff3d0){_0xaff3d0=_0xaff3d0||0xcc;return function(_0x5d2e6c){if(_0x5d2e6c){return _0xd55c9b['sendStatus'](_0xaff3d0);}return _0xd55c9b[_0x5d6d('0x19')](_0xaff3d0)['end']();};}function respondWithResult(_0x55441e,_0x127d8f){_0x127d8f=_0x127d8f||0xc8;return function(_0x1ceebd){if(_0x1ceebd){return _0x55441e[_0x5d6d('0x19')](_0x127d8f)[_0x5d6d('0x1a')](_0x1ceebd);}};}function respondWithFilteredResult(_0x5382df,_0x9b6f54){return function(_0x5c0d5b){if(_0x5c0d5b){var _0x53de41=typeof _0x9b6f54[_0x5d6d('0x1b')]===_0x5d6d('0x1c')&&typeof _0x9b6f54[_0x5d6d('0x1d')]===_0x5d6d('0x1c');var _0x498823=_0x5c0d5b[_0x5d6d('0x1e')];var _0x42122c=_0x53de41?0x0:_0x9b6f54[_0x5d6d('0x1b')];var _0x432412=_0x53de41?_0x5c0d5b[_0x5d6d('0x1e')]:_0x9b6f54[_0x5d6d('0x1b')]+_0x9b6f54['limit'];var _0x350ed3;if(_0x432412>=_0x498823){_0x432412=_0x498823;_0x350ed3=0xc8;}else{_0x350ed3=0xce;}_0x5382df[_0x5d6d('0x19')](_0x350ed3);return _0x5382df[_0x5d6d('0x1f')](_0x5d6d('0x20'),_0x42122c+'-'+_0x432412+'/'+_0x498823)[_0x5d6d('0x1a')](_0x5c0d5b);}return null;};}function patchUpdates(_0x4a7310){return function(_0x2d3a35){try{jsonpatch[_0x5d6d('0x21')](_0x2d3a35,_0x4a7310,!![]);}catch(_0x1aa87f){return BPromise['reject'](_0x1aa87f);}return _0x2d3a35[_0x5d6d('0x22')]();};}function saveUpdates(_0x4c93cb,_0x22cd07){return function(_0x269dfc){if(_0x269dfc){return _0x269dfc[_0x5d6d('0x23')](_0x4c93cb)[_0x5d6d('0x24')](function(_0x3b61ff){return _0x3b61ff;});}return null;};}function removeEntity(_0x1164f5,_0x31b123){return function(_0x532b3e){if(_0x532b3e){return _0x532b3e[_0x5d6d('0x25')]()[_0x5d6d('0x24')](function(){_0x1164f5['status'](0xcc)[_0x5d6d('0x26')]();});}};}function handleEntityNotFound(_0x3b891d,_0x4fb809){return function(_0x29128b){if(!_0x29128b){_0x3b891d[_0x5d6d('0x27')](0x194);}return _0x29128b;};}function handleError(_0x3c1ddf,_0x7cc66c){_0x7cc66c=_0x7cc66c||0x1f4;return function(_0x5cce30){logger[_0x5d6d('0x28')](_0x5cce30[_0x5d6d('0x29')]);if(_0x5cce30[_0x5d6d('0x2a')]){delete _0x5cce30[_0x5d6d('0x2a')];}_0x3c1ddf[_0x5d6d('0x19')](_0x7cc66c)[_0x5d6d('0x2b')](_0x5cce30);};}exports[_0x5d6d('0x2c')]=function(_0x5c7255,_0x305297){var _0x24625d={},_0x3098ac={},_0x50f6a8={'count':0x0,'rows':[]};var _0x5b9f5f=_[_0x5d6d('0x2d')](db[_0x5d6d('0x2e')][_0x5d6d('0x2f')],function(_0x711e18){return{'name':_0x711e18['fieldName'],'type':_0x711e18[_0x5d6d('0x30')][_0x5d6d('0x31')]};});_0x3098ac[_0x5d6d('0x32')]=_[_0x5d6d('0x2d')](_0x5b9f5f,_0x5d6d('0x2a'));_0x3098ac[_0x5d6d('0x33')]=_[_0x5d6d('0x34')](_0x5c7255[_0x5d6d('0x33')]);_0x3098ac[_0x5d6d('0x35')]=_['intersection'](_0x3098ac[_0x5d6d('0x32')],_0x3098ac[_0x5d6d('0x33')]);_0x24625d[_0x5d6d('0x36')]=_[_0x5d6d('0x37')](_0x3098ac[_0x5d6d('0x32')],qs[_0x5d6d('0x38')](_0x5c7255[_0x5d6d('0x33')]['fields']));_0x24625d['attributes']=_0x24625d[_0x5d6d('0x36')][_0x5d6d('0x39')]?_0x24625d['attributes']:_0x3098ac[_0x5d6d('0x32')];if(!_0x5c7255['query'][_0x5d6d('0x3a')](_0x5d6d('0x3b'))){_0x24625d[_0x5d6d('0x1d')]=qs['limit'](_0x5c7255[_0x5d6d('0x33')][_0x5d6d('0x1d')]);_0x24625d[_0x5d6d('0x1b')]=qs[_0x5d6d('0x1b')](_0x5c7255[_0x5d6d('0x33')][_0x5d6d('0x1b')]);}_0x24625d[_0x5d6d('0x3c')]=qs[_0x5d6d('0x3d')](_0x5c7255[_0x5d6d('0x33')]['sort']);_0x24625d['where']=qs[_0x5d6d('0x35')](_[_0x5d6d('0x3e')](_0x5c7255[_0x5d6d('0x33')],_0x3098ac[_0x5d6d('0x35')]),_0x5b9f5f);if(_0x5c7255['query'][_0x5d6d('0x3f')]){_0x24625d['where']=_['merge'](_0x24625d[_0x5d6d('0x40')],{'$or':_[_0x5d6d('0x2d')](_0x5b9f5f,function(_0x503ce4){if(_0x503ce4[_0x5d6d('0x30')]!=='VIRTUAL'){var _0x5f4836={};_0x5f4836[_0x503ce4[_0x5d6d('0x2a')]]={'$like':'%'+_0x5c7255[_0x5d6d('0x33')][_0x5d6d('0x3f')]+'%'};return _0x5f4836;}})});}_0x24625d=_[_0x5d6d('0x41')]({},_0x24625d,_0x5c7255[_0x5d6d('0x42')]);var _0x2764d3={'where':_0x24625d[_0x5d6d('0x40')]};return db[_0x5d6d('0x2e')][_0x5d6d('0x1e')](_0x2764d3)[_0x5d6d('0x24')](function(_0x3152d0){_0x50f6a8[_0x5d6d('0x1e')]=_0x3152d0;if(_0x5c7255[_0x5d6d('0x33')][_0x5d6d('0x43')]){_0x24625d['include']=[{'all':!![]}];}return db[_0x5d6d('0x2e')]['findAll'](_0x24625d);})['then'](function(_0x2fd04f){_0x50f6a8['rows']=_0x2fd04f;return _0x50f6a8;})[_0x5d6d('0x24')](respondWithFilteredResult(_0x305297,_0x24625d))[_0x5d6d('0x44')](handleError(_0x305297,null));};exports['show']=function(_0x4472b7,_0xdb66b4){var _0x597f4f={'raw':!![],'where':{'id':_0x4472b7[_0x5d6d('0x45')]['id']}},_0x5ae8ca={};_0x5ae8ca[_0x5d6d('0x32')]=_[_0x5d6d('0x34')](db[_0x5d6d('0x2e')]['rawAttributes']);_0x5ae8ca[_0x5d6d('0x33')]=_[_0x5d6d('0x34')](_0x4472b7[_0x5d6d('0x33')]);_0x5ae8ca[_0x5d6d('0x35')]=_[_0x5d6d('0x37')](_0x5ae8ca[_0x5d6d('0x32')],_0x5ae8ca[_0x5d6d('0x33')]);_0x597f4f[_0x5d6d('0x36')]=_[_0x5d6d('0x37')](_0x5ae8ca[_0x5d6d('0x32')],qs[_0x5d6d('0x38')](_0x4472b7[_0x5d6d('0x33')][_0x5d6d('0x38')]));_0x597f4f[_0x5d6d('0x36')]=_0x597f4f[_0x5d6d('0x36')][_0x5d6d('0x39')]?_0x597f4f['attributes']:_0x5ae8ca[_0x5d6d('0x32')];if(_0x4472b7[_0x5d6d('0x33')][_0x5d6d('0x43')]){_0x597f4f[_0x5d6d('0x46')]=[{'all':!![]}];}_0x597f4f=_[_0x5d6d('0x41')]({},_0x597f4f,_0x4472b7['options']);return db[_0x5d6d('0x2e')][_0x5d6d('0x47')](_0x597f4f)['then'](handleEntityNotFound(_0xdb66b4,null))[_0x5d6d('0x24')](respondWithResult(_0xdb66b4,null))[_0x5d6d('0x44')](handleError(_0xdb66b4,null));};exports[_0x5d6d('0x48')]=function(_0x3b4dd8,_0x51e8d6){return db[_0x5d6d('0x2e')]['create'](_0x3b4dd8['body'],{})['then'](respondWithResult(_0x51e8d6,0xc9))[_0x5d6d('0x44')](handleError(_0x51e8d6,null));};exports[_0x5d6d('0x23')]=function(_0x1e1618,_0x4b83b9){if(_0x1e1618[_0x5d6d('0x49')]['id']){delete _0x1e1618[_0x5d6d('0x49')]['id'];}return db[_0x5d6d('0x2e')][_0x5d6d('0x47')]({'where':{'id':_0x1e1618[_0x5d6d('0x45')]['id']}})['then'](handleEntityNotFound(_0x4b83b9,null))['then'](saveUpdates(_0x1e1618['body'],null))[_0x5d6d('0x24')](respondWithResult(_0x4b83b9,null))[_0x5d6d('0x44')](handleError(_0x4b83b9,null));};exports[_0x5d6d('0x25')]=function(_0x4d57b1,_0x3bb5e4){return db['ZendeskField'][_0x5d6d('0x47')]({'where':{'id':_0x4d57b1[_0x5d6d('0x45')]['id']}})[_0x5d6d('0x24')](handleEntityNotFound(_0x3bb5e4,null))[_0x5d6d('0x24')](removeEntity(_0x3bb5e4,null))[_0x5d6d('0x44')](handleError(_0x3bb5e4,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index fca5083..6e11185 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 _0xbe24=['api','request-promise','path','../../config/environment','exports','define','zendesk_unique_index','idField','FieldId','lodash'];(function(_0x51e3d2,_0x3dd946){var _0x3fd3fb=function(_0x234892){while(--_0x234892){_0x51e3d2['push'](_0x51e3d2['shift']());}};_0x3fd3fb(++_0x3dd946);}(_0xbe24,0x149));var _0x4be2=function(_0x3d3eb8,_0x310f02){_0x3d3eb8=_0x3d3eb8-0x0;var _0x56e295=_0xbe24[_0x3d3eb8];return _0x56e295;};'use strict';var _=require(_0x4be2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4be2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4be2('0x2'));var fs=require('fs');var path=require(_0x4be2('0x3'));var rimraf=require('rimraf');var config=require(_0x4be2('0x4'));var attributes=require('./intZendeskField.attributes');module[_0x4be2('0x5')]=function(_0xff97ce,_0x276dfa){return _0xff97ce[_0x4be2('0x6')]('ZendeskField',attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x4be2('0x7'),'fields':[_0x4be2('0x8'),_0x4be2('0x9')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5f6d=['path','../../config/environment','exports','ZendeskField','int_zendesk_fields','zendesk_unique_index','FieldId','lodash','util','moment','bluebird'];(function(_0x50641c,_0x22186b){var _0x3b48a0=function(_0x43df62){while(--_0x43df62){_0x50641c['push'](_0x50641c['shift']());}};_0x3b48a0(++_0x22186b);}(_0x5f6d,0xa1));var _0xd5f6=function(_0x14594a,_0x399bde){_0x14594a=_0x14594a-0x0;var _0x238ea0=_0x5f6d[_0x14594a];return _0x238ea0;};'use strict';var _=require(_0xd5f6('0x0'));var util=require(_0xd5f6('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd5f6('0x2'));var BPromise=require(_0xd5f6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd5f6('0x4'));var rimraf=require('rimraf');var config=require(_0xd5f6('0x5'));var attributes=require('./intZendeskField.attributes');module[_0xd5f6('0x6')]=function(_0xe7ccdf,_0xad62b8){return _0xe7ccdf['define'](_0xd5f6('0x7'),attributes,{'tableName':_0xd5f6('0x8'),'paranoid':![],'indexes':[{'name':_0xd5f6('0x9'),'fields':['idField',_0xd5f6('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 134ed4d..5c353b4 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 _0xd9fc=['error','message','catch','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s'];(function(_0x21b480,_0x4b48e2){var _0x59c153=function(_0x2671f2){while(--_0x2671f2){_0x21b480['push'](_0x21b480['shift']());}};_0x59c153(++_0x4b48e2);}(_0xd9fc,0x120));var _0xcd9f=function(_0x22592a,_0x24e882){_0x22592a=_0x22592a-0x0;var _0x3f3b20=_0xd9fc[_0x22592a];return _0x3f3b20;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcd9f('0x0'));var fs=require('fs');var Redis=require(_0xcd9f('0x1'));var db=require(_0xcd9f('0x2'))['db'];var utils=require(_0xcd9f('0x3'));var logger=require(_0xcd9f('0x4'))(_0xcd9f('0x5'));var config=require(_0xcd9f('0x6'));var jayson=require(_0xcd9f('0x7'));var client=jayson[_0xcd9f('0x8')][_0xcd9f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x387b57,_0x577e66,_0x1e4435){return new BPromise(function(_0x2e534c,_0x2aa5a4){return client[_0xcd9f('0xa')](_0x387b57,_0x1e4435)[_0xcd9f('0xb')](function(_0x4d957c){logger[_0xcd9f('0xc')](_0xcd9f('0xd'),_0x577e66,_0xcd9f('0xe'));logger['debug'](_0xcd9f('0xf'),_0x577e66,_0xcd9f('0xe'),JSON['stringify'](_0x4d957c));if(_0x4d957c[_0xcd9f('0x10')]){if(_0x4d957c['error']['code']===0x1f4){logger[_0xcd9f('0x10')](_0xcd9f('0xd'),_0x577e66,_0x4d957c['error'][_0xcd9f('0x11')]);return _0x2aa5a4(_0x4d957c[_0xcd9f('0x10')][_0xcd9f('0x11')]);}logger[_0xcd9f('0x10')](_0xcd9f('0xd'),_0x577e66,_0x4d957c[_0xcd9f('0x10')][_0xcd9f('0x11')]);return _0x2e534c(_0x4d957c[_0xcd9f('0x10')]['message']);}else{logger[_0xcd9f('0xc')]('ZendeskField,\x20%s,\x20%s',_0x577e66,_0xcd9f('0xe'));_0x2e534c(_0x4d957c['result'][_0xcd9f('0x11')]);}})[_0xcd9f('0x12')](function(_0x4e5a13){logger[_0xcd9f('0x10')](_0xcd9f('0xd'),_0x577e66,_0x4e5a13);_0x2aa5a4(_0x4e5a13);});});} \ No newline at end of file +var _0xe39e=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ZendeskField,\x20%s,\x20%s','request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0xe34bbc,_0xd894af){var _0x2f3f01=function(_0xed759f){while(--_0xed759f){_0xe34bbc['push'](_0xe34bbc['shift']());}};_0x2f3f01(++_0xd894af);}(_0xe39e,0x1a4));var _0xee39=function(_0xe5e3fb,_0x2fa636){_0xe5e3fb=_0xe5e3fb-0x0;var _0xdc5834=_0xe39e[_0xe5e3fb];return _0xdc5834;};'use strict';var _=require(_0xee39('0x0'));var util=require(_0xee39('0x1'));var moment=require(_0xee39('0x2'));var BPromise=require(_0xee39('0x3'));var rs=require(_0xee39('0x4'));var fs=require('fs');var Redis=require(_0xee39('0x5'));var db=require(_0xee39('0x6'))['db'];var utils=require(_0xee39('0x7'));var logger=require(_0xee39('0x8'))(_0xee39('0x9'));var config=require(_0xee39('0xa'));var jayson=require(_0xee39('0xb'));var client=jayson[_0xee39('0xc')][_0xee39('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x26308e,_0x4f4245,_0x31eeb9){return new BPromise(function(_0x50eb65,_0x56a7ae){return client[_0xee39('0xe')](_0x26308e,_0x31eeb9)['then'](function(_0x311cc8){logger[_0xee39('0xf')](_0xee39('0x10'),_0x4f4245,_0xee39('0x11'));logger['debug'](_0xee39('0x12'),_0x4f4245,_0xee39('0x11'),JSON[_0xee39('0x13')](_0x311cc8));if(_0x311cc8[_0xee39('0x14')]){if(_0x311cc8[_0xee39('0x14')][_0xee39('0x15')]===0x1f4){logger['error']('ZendeskField,\x20%s,\x20%s',_0x4f4245,_0x311cc8['error'][_0xee39('0x16')]);return _0x56a7ae(_0x311cc8['error']['message']);}logger[_0xee39('0x14')](_0xee39('0x10'),_0x4f4245,_0x311cc8[_0xee39('0x14')][_0xee39('0x16')]);return _0x50eb65(_0x311cc8[_0xee39('0x14')]['message']);}else{logger['info']('ZendeskField,\x20%s,\x20%s',_0x4f4245,_0xee39('0x11'));_0x50eb65(_0x311cc8[_0xee39('0x17')][_0xee39('0x16')]);}})[_0xee39('0x18')](function(_0x51db0b){logger[_0xee39('0x14')](_0xee39('0x10'),_0x4f4245,_0x51db0b);_0x56a7ae(_0x51db0b);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 197dc09..f04d916 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 _0xcee6=['isAuthenticated','index','/:id','show','get','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','update','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','./intZohoAccount.controller'];(function(_0x1b1c74,_0x2495d5){var _0x4f5d27=function(_0x28c2f4){while(--_0x28c2f4){_0x1b1c74['push'](_0x1b1c74['shift']());}};_0x4f5d27(++_0x2495d5);}(_0xcee6,0xa1));var _0x6cee=function(_0x5af97c,_0x24a49f){_0x5af97c=_0x5af97c-0x0;var _0x3472ae=_0xcee6[_0x5af97c];return _0x3472ae;};'use strict';var multer=require(_0x6cee('0x0'));var util=require(_0x6cee('0x1'));var path=require('path');var timeout=require(_0x6cee('0x2'));var express=require(_0x6cee('0x3'));var router=express[_0x6cee('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6cee('0x5'));var config=require('../../config/environment');var controller=require(_0x6cee('0x6'));router['get']('/',auth[_0x6cee('0x7')](),controller[_0x6cee('0x8')]);router['get'](_0x6cee('0x9'),auth[_0x6cee('0x7')](),controller[_0x6cee('0xa')]);router[_0x6cee('0xb')](_0x6cee('0xc'),auth[_0x6cee('0x7')](),controller[_0x6cee('0xd')]);router[_0x6cee('0xb')](_0x6cee('0xe'),auth['isAuthenticated'](),controller[_0x6cee('0xf')]);router[_0x6cee('0x10')]('/',auth[_0x6cee('0x7')](),controller[_0x6cee('0x11')]);router['post'](_0x6cee('0xc'),auth['isAuthenticated'](),controller['addConfiguration']);router['put'](_0x6cee('0x9'),auth[_0x6cee('0x7')](),controller[_0x6cee('0x12')]);router['delete']('/:id',auth[_0x6cee('0x7')](),controller[_0x6cee('0x13')]);module[_0x6cee('0x14')]=router; \ No newline at end of file +var _0x082b=['show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','index','/:id','isAuthenticated'];(function(_0x787e75,_0x1e6bc7){var _0x5ab1d8=function(_0x52b598){while(--_0x52b598){_0x787e75['push'](_0x787e75['shift']());}};_0x5ab1d8(++_0x1e6bc7);}(_0x082b,0xc2));var _0xb082=function(_0x295c11,_0x54b9e0){_0x295c11=_0x295c11-0x0;var _0xe56efc=_0x082b[_0x295c11];return _0xe56efc;};'use strict';var multer=require(_0xb082('0x0'));var util=require(_0xb082('0x1'));var path=require('path');var timeout=require(_0xb082('0x2'));var express=require(_0xb082('0x3'));var router=express[_0xb082('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb082('0x5'));var interaction=require(_0xb082('0x6'));var config=require(_0xb082('0x7'));var controller=require(_0xb082('0x8'));router[_0xb082('0x9')]('/',auth['isAuthenticated'](),controller[_0xb082('0xa')]);router[_0xb082('0x9')](_0xb082('0xb'),auth[_0xb082('0xc')](),controller[_0xb082('0xd')]);router['get'](_0xb082('0xe'),auth[_0xb082('0xc')](),controller['getConfigurations']);router['get'](_0xb082('0xf'),auth[_0xb082('0xc')](),controller[_0xb082('0x10')]);router[_0xb082('0x11')]('/',auth[_0xb082('0xc')](),controller[_0xb082('0x12')]);router['post']('/:id/configurations',auth[_0xb082('0xc')](),controller[_0xb082('0x13')]);router['put'](_0xb082('0xb'),auth[_0xb082('0xc')](),controller[_0xb082('0x14')]);router[_0xb082('0x15')](_0xb082('0xb'),auth[_0xb082('0xc')](),controller[_0xb082('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 026aa7b..bc749ac 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 _0xedd9=['exports','STRING'];(function(_0x4af904,_0x8fa48c){var _0x138a74=function(_0x1eb75d){while(--_0x1eb75d){_0x4af904['push'](_0x4af904['shift']());}};_0x138a74(++_0x8fa48c);}(_0xedd9,0xfc));var _0x9edd=function(_0x24295c,_0x26a25c){_0x24295c=_0x24295c-0x0;var _0x347d18=_0xedd9[_0x24295c];return _0x347d18;};'use strict';var Sequelize=require('sequelize');module[_0x9edd('0x0')]={'name':{'type':Sequelize[_0x9edd('0x1')]},'description':{'type':Sequelize[_0x9edd('0x1')]},'host':{'type':Sequelize[_0x9edd('0x1')]},'zone':{'type':Sequelize[_0x9edd('0x1')]},'clientId':{'type':Sequelize[_0x9edd('0x1')]},'clientSecret':{'type':Sequelize[_0x9edd('0x1')]},'serverUrl':{'type':Sequelize[_0x9edd('0x1')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x9edd('0x1')]}}; \ No newline at end of file +var _0xd64b=['STRING','sequelize'];(function(_0x4a9399,_0x56271c){var _0x3c18e4=function(_0x2d6d06){while(--_0x2d6d06){_0x4a9399['push'](_0x4a9399['shift']());}};_0x3c18e4(++_0x56271c);}(_0xd64b,0xc1));var _0xbd64=function(_0x56b04e,_0x471ebc){_0x56b04e=_0x56b04e-0x0;var _0x4149b9=_0xd64b[_0x56b04e];return _0x4149b9;};'use strict';var Sequelize=require(_0xbd64('0x0'));module['exports']={'name':{'type':Sequelize[_0xbd64('0x1')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xbd64('0x1')]},'zone':{'type':Sequelize[_0xbd64('0x1')]},'clientId':{'type':Sequelize[_0xbd64('0x1')]},'clientSecret':{'type':Sequelize[_0xbd64('0x1')]},'serverUrl':{'type':Sequelize[_0xbd64('0x1')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index b4d9fbf..5c6fc97 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 _0x3d96=['Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','remove','includes','api_name','system_mandatory','push','display_label','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','rawAttributes','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','ZohoAccount','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','update','getConfigurations','ZohoConfiguration','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','ZohoField','Descriptions','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','code','zoho.eu','com','slice','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response'];(function(_0xfaa4a7,_0x526387){var _0xa086f2=function(_0x4ad89b){while(--_0x4ad89b){_0xfaa4a7['push'](_0xfaa4a7['shift']());}};_0xa086f2(++_0x526387);}(_0x3d96,0x1a6));var _0x63d9=function(_0x356f1d,_0x121c5a){_0x356f1d=_0x356f1d-0x0;var _0x4293c6=_0x3d96[_0x356f1d];return _0x4293c6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x63d9('0x0'));var zipdir=require(_0x63d9('0x1'));var jsonpatch=require(_0x63d9('0x2'));var rp=require(_0x63d9('0x3'));var moment=require('moment');var BPromise=require(_0x63d9('0x4'));var Mustache=require('mustache');var util=require(_0x63d9('0x5'));var path=require('path');var sox=require(_0x63d9('0x6'));var csv=require(_0x63d9('0x7'));var ejs=require(_0x63d9('0x8'));var fs=require('fs');var fs_extra=require(_0x63d9('0x9'));var _=require(_0x63d9('0xa'));var squel=require(_0x63d9('0xb'));var crypto=require(_0x63d9('0xc'));var jsforce=require(_0x63d9('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x63d9('0x7'));var querystring=require(_0x63d9('0xe'));var Papa=require(_0x63d9('0xf'));var Redis=require(_0x63d9('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x63d9('0x11'));var as=require(_0x63d9('0x12'));var hardwareService=require(_0x63d9('0x13'));var logger=require(_0x63d9('0x14'))('api');var utils=require(_0x63d9('0x15'));var config=require(_0x63d9('0x16'));var licenseUtil=require(_0x63d9('0x17'));var db=require(_0x63d9('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x45da5a,_0x4e481a){_0x4e481a=_0x4e481a||0xcc;return function(_0x599387){if(_0x599387){return _0x45da5a[_0x63d9('0x19')](_0x4e481a);}return _0x45da5a[_0x63d9('0x1a')](_0x4e481a)[_0x63d9('0x1b')]();};}function respondWithResult(_0x25679f,_0x3a8914){_0x3a8914=_0x3a8914||0xc8;return function(_0x400071){if(_0x400071){return _0x25679f[_0x63d9('0x1a')](_0x3a8914)[_0x63d9('0x1c')](_0x400071);}};}function respondWithFilteredResult(_0x3068f7,_0x4814c2){return function(_0x13acd9){if(_0x13acd9){var _0x38635b=typeof _0x4814c2[_0x63d9('0x1d')]===_0x63d9('0x1e')&&typeof _0x4814c2['limit']===_0x63d9('0x1e');var _0xc8990c=_0x13acd9[_0x63d9('0x1f')];var _0x240a2c=_0x38635b?0x0:_0x4814c2[_0x63d9('0x1d')];var _0x1b11b7=_0x38635b?_0x13acd9[_0x63d9('0x1f')]:_0x4814c2[_0x63d9('0x1d')]+_0x4814c2[_0x63d9('0x20')];var _0x934fb8;if(_0x1b11b7>=_0xc8990c){_0x1b11b7=_0xc8990c;_0x934fb8=0xc8;}else{_0x934fb8=0xce;}_0x3068f7['status'](_0x934fb8);return _0x3068f7[_0x63d9('0x21')](_0x63d9('0x22'),_0x240a2c+'-'+_0x1b11b7+'/'+_0xc8990c)[_0x63d9('0x1c')](_0x13acd9);}return null;};}function patchUpdates(_0xe18559){return function(_0x264b26){try{jsonpatch[_0x63d9('0x23')](_0x264b26,_0xe18559,!![]);}catch(_0x3aebe3){return BPromise[_0x63d9('0x24')](_0x3aebe3);}return _0x264b26[_0x63d9('0x25')]();};}function saveUpdates(_0x44a6dd,_0x8945fc){return function(_0x2d16ae){if(_0x2d16ae){return _0x2d16ae['update'](_0x44a6dd)[_0x63d9('0x26')](function(_0x5d6d5d){return _0x5d6d5d;});}return null;};}function removeEntity(_0x1ae58f,_0x5ed237){return function(_0x4431dd){if(_0x4431dd){return _0x4431dd[_0x63d9('0x27')]()['then'](function(){_0x1ae58f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ae737,_0x37006b){return function(_0x3a1c8e){if(!_0x3a1c8e){_0x5ae737[_0x63d9('0x19')](0x194);}return _0x3a1c8e;};}function handleError(_0x5f1774,_0x4a2873){_0x4a2873=_0x4a2873||0x1f4;return function(_0x10a162){logger[_0x63d9('0x28')](_0x10a162[_0x63d9('0x29')]);if(_0x10a162['name']){delete _0x10a162[_0x63d9('0x2a')];}_0x5f1774['status'](_0x4a2873)[_0x63d9('0x2b')](_0x10a162);};}exports[_0x63d9('0x2c')]=function(_0x29195f,_0xd0904f){var _0x5bf8c={},_0xcfb339={},_0x3a4a09={'count':0x0,'rows':[]};var _0x4a6484=_['map'](db['ZohoAccount'][_0x63d9('0x2d')],function(_0x11c8d0){return{'name':_0x11c8d0['fieldName'],'type':_0x11c8d0['type'][_0x63d9('0x2e')]};});_0xcfb339[_0x63d9('0x2f')]=_[_0x63d9('0x30')](_0x4a6484,_0x63d9('0x2a'));_0xcfb339[_0x63d9('0x31')]=_['keys'](_0x29195f['query']);_0xcfb339['filters']=_[_0x63d9('0x32')](_0xcfb339['model'],_0xcfb339[_0x63d9('0x31')]);_0x5bf8c[_0x63d9('0x33')]=_[_0x63d9('0x32')](_0xcfb339[_0x63d9('0x2f')],qs[_0x63d9('0x34')](_0x29195f[_0x63d9('0x31')][_0x63d9('0x34')]));_0x5bf8c[_0x63d9('0x33')]=_0x5bf8c[_0x63d9('0x33')][_0x63d9('0x35')]?_0x5bf8c[_0x63d9('0x33')]:_0xcfb339[_0x63d9('0x2f')];if(!_0x29195f['query'][_0x63d9('0x36')](_0x63d9('0x37'))){_0x5bf8c['limit']=qs[_0x63d9('0x20')](_0x29195f[_0x63d9('0x31')][_0x63d9('0x20')]);_0x5bf8c[_0x63d9('0x1d')]=qs[_0x63d9('0x1d')](_0x29195f[_0x63d9('0x31')][_0x63d9('0x1d')]);}_0x5bf8c[_0x63d9('0x38')]=qs['sort'](_0x29195f['query'][_0x63d9('0x39')]);_0x5bf8c[_0x63d9('0x3a')]=qs['filters'](_[_0x63d9('0x3b')](_0x29195f[_0x63d9('0x31')],_0xcfb339[_0x63d9('0x3c')]),_0x4a6484);if(_0x29195f[_0x63d9('0x31')][_0x63d9('0x3d')]){_0x5bf8c[_0x63d9('0x3a')]=_[_0x63d9('0x3e')](_0x5bf8c['where'],{'$or':_['map'](_0x4a6484,function(_0x570035){if(_0x570035[_0x63d9('0x3f')]!==_0x63d9('0x40')){var _0x36dd95={};_0x36dd95[_0x570035[_0x63d9('0x2a')]]={'$like':'%'+_0x29195f[_0x63d9('0x31')][_0x63d9('0x3d')]+'%'};return _0x36dd95;}})});}_0x5bf8c=_[_0x63d9('0x3e')]({},_0x5bf8c,_0x29195f[_0x63d9('0x41')]);var _0x2982e6={'where':_0x5bf8c[_0x63d9('0x3a')]};return db[_0x63d9('0x42')][_0x63d9('0x1f')](_0x2982e6)[_0x63d9('0x26')](function(_0x26e04d){_0x3a4a09[_0x63d9('0x1f')]=_0x26e04d;if(_0x29195f['query'][_0x63d9('0x43')]){_0x5bf8c[_0x63d9('0x44')]=[{'all':!![]}];}return db[_0x63d9('0x42')][_0x63d9('0x45')](_0x5bf8c);})['then'](function(_0x4c6055){_0x3a4a09[_0x63d9('0x46')]=_0x4c6055;return _0x3a4a09;})[_0x63d9('0x26')](respondWithFilteredResult(_0xd0904f,_0x5bf8c))[_0x63d9('0x47')](handleError(_0xd0904f,null));};exports[_0x63d9('0x48')]=function(_0x430345,_0x95de3a){var _0x2c8eab={'raw':![],'where':{'id':_0x430345[_0x63d9('0x49')]['id']}},_0x12e752={};_0x12e752[_0x63d9('0x2f')]=_[_0x63d9('0x4a')](db['ZohoAccount']['rawAttributes']);_0x12e752[_0x63d9('0x31')]=_[_0x63d9('0x4a')](_0x430345[_0x63d9('0x31')]);_0x12e752['filters']=_['intersection'](_0x12e752[_0x63d9('0x2f')],_0x12e752[_0x63d9('0x31')]);_0x2c8eab[_0x63d9('0x33')]=_[_0x63d9('0x32')](_0x12e752[_0x63d9('0x2f')],qs[_0x63d9('0x34')](_0x430345[_0x63d9('0x31')]['fields']));_0x2c8eab[_0x63d9('0x33')]=_0x2c8eab[_0x63d9('0x33')][_0x63d9('0x35')]?_0x2c8eab[_0x63d9('0x33')]:_0x12e752[_0x63d9('0x2f')];if(_0x430345[_0x63d9('0x31')]['includeAll']){_0x2c8eab[_0x63d9('0x44')]=[{'all':!![]}];}_0x2c8eab=_[_0x63d9('0x3e')]({},_0x2c8eab,_0x430345[_0x63d9('0x41')]);return db[_0x63d9('0x42')][_0x63d9('0x4b')](_0x2c8eab)['then'](handleEntityNotFound(_0x95de3a,null))['then'](respondWithResult(_0x95de3a,null))['catch'](handleError(_0x95de3a,null));};exports[_0x63d9('0x4c')]=function(_0x2e5960,_0x5dcccd){return db[_0x63d9('0x42')][_0x63d9('0x4c')](_0x2e5960[_0x63d9('0x4d')],{})[_0x63d9('0x26')](respondWithResult(_0x5dcccd,0xc9))['catch'](handleError(_0x5dcccd,null));};exports[_0x63d9('0x4e')]=function(_0x40df31,_0x15c4fa){if(_0x40df31[_0x63d9('0x4d')]['id']){delete _0x40df31[_0x63d9('0x4d')]['id'];}return db[_0x63d9('0x42')]['find']({'where':{'id':_0x40df31[_0x63d9('0x49')]['id']}})[_0x63d9('0x26')](handleEntityNotFound(_0x15c4fa,null))[_0x63d9('0x26')](saveUpdates(_0x40df31['body'],null))['then'](respondWithResult(_0x15c4fa,null))['catch'](handleError(_0x15c4fa,null));};exports[_0x63d9('0x27')]=function(_0x4a0737,_0x172fa8){return db[_0x63d9('0x42')][_0x63d9('0x4b')]({'where':{'id':_0x4a0737['params']['id']}})[_0x63d9('0x26')](handleEntityNotFound(_0x172fa8,null))[_0x63d9('0x26')](removeEntity(_0x172fa8,null))[_0x63d9('0x47')](handleError(_0x172fa8,null));};exports[_0x63d9('0x4f')]=function(_0x7b5e03,_0x225597,_0x14bc91){var _0x5d8242={};var _0x32ad50={};var _0x5d4b91;var _0x5148c2;return db['ZohoAccount']['findOne']({'where':{'id':_0x7b5e03[_0x63d9('0x49')]['id']}})[_0x63d9('0x26')](handleEntityNotFound(_0x225597,null))[_0x63d9('0x26')](function(_0x126cd6){if(_0x126cd6){_0x5d4b91=_0x126cd6;_0x32ad50[_0x63d9('0x2f')]=_[_0x63d9('0x4a')](db[_0x63d9('0x50')][_0x63d9('0x2d')]);_0x32ad50[_0x63d9('0x31')]=_[_0x63d9('0x4a')](_0x7b5e03[_0x63d9('0x31')]);_0x32ad50[_0x63d9('0x3c')]=_['intersection'](_0x32ad50[_0x63d9('0x2f')],_0x32ad50['query']);_0x5d8242[_0x63d9('0x33')]=_[_0x63d9('0x32')](_0x32ad50[_0x63d9('0x2f')],qs[_0x63d9('0x34')](_0x7b5e03['query']['fields']));_0x5d8242[_0x63d9('0x33')]=_0x5d8242[_0x63d9('0x33')][_0x63d9('0x35')]?_0x5d8242['attributes']:_0x32ad50[_0x63d9('0x2f')];_0x5d8242[_0x63d9('0x38')]=qs[_0x63d9('0x39')](_0x7b5e03[_0x63d9('0x31')]['sort']);_0x5d8242[_0x63d9('0x3a')]=qs['filters'](_[_0x63d9('0x3b')](_0x7b5e03['query'],_0x32ad50[_0x63d9('0x3c')]));if(_0x7b5e03[_0x63d9('0x31')]['filter']){_0x5d8242['where']=_[_0x63d9('0x3e')](_0x5d8242['where'],{'$or':_['map'](_0x5d8242[_0x63d9('0x33')],function(_0x21f693){var _0x4c2ebe={};_0x4c2ebe[_0x21f693]={'$like':'%'+_0x7b5e03[_0x63d9('0x31')][_0x63d9('0x3d')]+'%'};return _0x4c2ebe;})});}_0x5d8242=_[_0x63d9('0x3e')]({},_0x5d8242,_0x7b5e03[_0x63d9('0x41')]);return _0x5d4b91['getConfigurations'](_0x5d8242);}})['then'](function(_0x1471c3){if(_0x1471c3){_0x5148c2=_0x1471c3['length'];if(!_0x7b5e03[_0x63d9('0x31')][_0x63d9('0x36')](_0x63d9('0x37'))){_0x5d8242[_0x63d9('0x20')]=qs['limit'](_0x7b5e03['query'][_0x63d9('0x20')]);_0x5d8242[_0x63d9('0x1d')]=qs[_0x63d9('0x1d')](_0x7b5e03['query']['offset']);}return _0x5d4b91['getConfigurations'](_0x5d8242);}})['then'](function(_0x2af4c8){if(_0x2af4c8){return _0x2af4c8?{'count':_0x5148c2,'rows':_0x2af4c8}:null;}})[_0x63d9('0x26')](respondWithResult(_0x225597,null))[_0x63d9('0x47')](handleError(_0x225597,null));};exports['addConfiguration']=function(_0x16227e,_0x5bb96e,_0x122d3a){if(_0x16227e[_0x63d9('0x4d')]['id']){delete _0x16227e[_0x63d9('0x4d')]['id'];}return db[_0x63d9('0x42')][_0x63d9('0x51')]({'where':{'id':_0x16227e[_0x63d9('0x49')]['id']}})['then'](handleEntityNotFound(_0x5bb96e,null))[_0x63d9('0x26')](function(_0xa7dbce){if(_0xa7dbce){_0x16227e[_0x63d9('0x4d')][_0x63d9('0x52')]=_0xa7dbce['id'];_0x16227e[_0x63d9('0x4d')][_0x63d9('0x53')]=integrations[_0x63d9('0x54')](_0x16227e['body'][_0x63d9('0x55')],_0x16227e[_0x63d9('0x4d')][_0x63d9('0x3f')]);_0x16227e[_0x63d9('0x4d')]['Descriptions']=integrations[_0x63d9('0x56')](_0x16227e[_0x63d9('0x4d')][_0x63d9('0x55')],_0x16227e[_0x63d9('0x4d')][_0x63d9('0x3f')]);return db[_0x63d9('0x50')][_0x63d9('0x4c')](_0x16227e[_0x63d9('0x4d')],{'include':[{'model':db[_0x63d9('0x57')],'as':_0x63d9('0x53')},{'model':db[_0x63d9('0x57')],'as':_0x63d9('0x58')}]});}return null;})['then'](respondWithResult(_0x5bb96e,null))['catch'](handleError(_0x5bb96e,null));};function getAccessToken(_0x3274de){return new Promise(function(_0x33268d,_0x4b7d0f){var _0x3b2fdd;switch(_0x3274de[_0x63d9('0x59')]){case'US':_0x3b2fdd=_0x63d9('0x5a');break;case'AU':_0x3b2fdd=_0x63d9('0x5b');break;case'EU':_0x3b2fdd=_0x63d9('0x5c');break;case'IN':_0x3b2fdd=_0x63d9('0x5d');break;case'CN':_0x3b2fdd='https://accounts.zoho.com.cn';break;default:_0x3b2fdd=_0x63d9('0x5c');break;}var _0x50c8bd={'method':'POST','uri':_0x3b2fdd+_0x63d9('0x5e'),'qs':{'refresh_token':_0x3274de[_0x63d9('0x5f')],'client_id':_0x3274de[_0x63d9('0x60')],'client_secret':_0x3274de[_0x63d9('0x61')],'grant_type':_0x63d9('0x62')},'json':!![]};return rp(_0x50c8bd)['then'](function(_0x52cd35){if(_0x52cd35['access_token']){_0x33268d(_0x52cd35[_0x63d9('0x63')]);}else{_0x4b7d0f(_0x63d9('0x64'));}})[_0x63d9('0x47')](function(_0x5ca4d3){_0x4b7d0f(_0x5ca4d3);});});}exports[_0x63d9('0x65')]=function(_0xfaddec,_0x137ecc,_0x57ae04){var _0x436ada,_0x6b96c1,_0xaa95e4,_0x2ac888,_0x2b52d4;return db[_0x63d9('0x42')][_0x63d9('0x51')]({'where':{'id':_0xfaddec[_0x63d9('0x49')]['id']},'attributes':['id',_0x63d9('0x66'),'zone',_0x63d9('0x60'),_0x63d9('0x61'),_0x63d9('0x67'),_0x63d9('0x68'),_0x63d9('0x5f')]})[_0x63d9('0x26')](handleEntityNotFound(_0x137ecc,null))[_0x63d9('0x26')](function(_0x41c412){_0x2b52d4=_0x41c412;_0x436ada=_0x2b52d4[_0x63d9('0x66')];_0x6b96c1=_0x436ada===_0x63d9('0x69')?'eu':_0x63d9('0x6a');_0xaa95e4=_0x2b52d4['serverUrl'];var _0x5a7d57=_0xaa95e4[_0x63d9('0x6b')](-0x1);if(_0x5a7d57==='/'||_0x5a7d57==='\x5c'||_0x5a7d57===':'){_0xaa95e4=_0xaa95e4['substring'](0x0,_0xaa95e4['lastIndexOf'](_0x5a7d57));}if(!_0x2b52d4['refreshToken']){throw new Error(_0x63d9('0x6c'));}return getAccessToken(_0x2b52d4);})[_0x63d9('0x26')](function(_0x1fb4b6){if(_0x1fb4b6){return rp({'method':_0x63d9('0x6d'),'uri':util[_0x63d9('0x6e')](_0x63d9('0x6f'),_0x6b96c1),'qs':{'module':_0x63d9('0x70')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x1fb4b6},'json':!![]});}})['then'](function(_0x40060f){if(_0x40060f){if(_0x40060f[_0x63d9('0x71')]&&_0x40060f[_0x63d9('0x71')][_0x63d9('0x28')]){throw new Error(_0x40060f[_0x63d9('0x71')][_0x63d9('0x28')]['message']);}var _0x550b10=[];var _0x172985=[];var _0x527bdd=[_0x63d9('0x72'),_0x63d9('0x73'),_0x63d9('0x74'),_0x63d9('0x75'),_0x63d9('0x76'),_0x63d9('0x77'),_0x63d9('0x78'),'Call_Type'];_0x172985=_[_0x63d9('0x79')](_0x40060f['fields'],function(_0x3ce81f){return _0x527bdd[_0x63d9('0x7a')](_0x3ce81f[_0x63d9('0x7b')]);});for(var _0x3c055c=0x0;_0x3c055c<_0x172985[_0x63d9('0x35')];_0x3c055c++){if(_0x172985[_0x3c055c][_0x63d9('0x7c')]===![]){_0x550b10[_0x63d9('0x7d')]({'id':_0x172985[_0x3c055c]['id'],'name':_0x172985[_0x3c055c][_0x63d9('0x7e')],'custom':_0x172985[_0x3c055c]['custom_field'],'options':_0x172985[_0x3c055c][_0x63d9('0x7f')]===_0x63d9('0x80')&&_0x172985[_0x3c055c][_0x63d9('0x81')][_0x63d9('0x35')]>-0x1?_[_0x63d9('0x30')](_0x172985[_0x3c055c]['pick_list_values'],function(_0x54fa41){return{'name':_0x54fa41,'value':_0x54fa41};}):[]});}}return{'count':_0x550b10[_0x63d9('0x35')],'rows':_0x550b10};}else{return{'count':0x0,'rows':[]};}})[_0x63d9('0x26')](respondWithResult(_0x137ecc,null))[_0x63d9('0x47')](function(_0xb477ac){var _0x180a57=_0xfaddec[_0x63d9('0x31')][_0x63d9('0x82')]?0x1f4:_0xb477ac[_0x63d9('0x83')]||0x1f4;logger[_0x63d9('0x28')](_0x63d9('0x84'),'getFields',_0x180a57,JSON['stringify'](_0xb477ac));delete _0xb477ac[_0x63d9('0x2a')];if(_0x180a57===0x191){_0x180a57=0x190;}_0x137ecc[_0x63d9('0x1a')](_0x180a57)['send'](_0xfaddec[_0x63d9('0x31')][_0x63d9('0x82')]?{'message':_0x63d9('0x85'),'statusCode':_0xb477ac[_0x63d9('0x83')]}:_0xb477ac);});}; \ No newline at end of file +var _0xd033=['../../config/utils','../../config/environment','../../components/integrations/configuration','status','offset','undefined','count','limit','set','Content-Range','update','then','end','sendStatus','stack','name','send','map','ZohoAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','find','create','body','destroy','getConfigurations','params','ZohoConfiguration','hasOwnProperty','addConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','channel','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','serverUrl','code','com','slice','substring','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','error','response','Owner','Subject','Description','Call_Duration','Call_Result','Call_Type','api_name','system_mandatory','push','custom_field','picklist','pick_list_values','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','test','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x4e4e83,_0x2f29a7){var _0x4cbeb6=function(_0x6e3854){while(--_0x6e3854){_0x4e4e83['push'](_0x4e4e83['shift']());}};_0x4cbeb6(++_0x2f29a7);}(_0xd033,0xe7));var _0x3d03=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0xd033[_0x101e7b];return _0x4995c0;};'use strict';var emlformat=require(_0x3d03('0x0'));var rimraf=require(_0x3d03('0x1'));var zipdir=require(_0x3d03('0x2'));var jsonpatch=require(_0x3d03('0x3'));var rp=require(_0x3d03('0x4'));var moment=require(_0x3d03('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3d03('0x6'));var util=require(_0x3d03('0x7'));var path=require(_0x3d03('0x8'));var sox=require(_0x3d03('0x9'));var csv=require(_0x3d03('0xa'));var ejs=require(_0x3d03('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3d03('0xc'));var squel=require(_0x3d03('0xd'));var crypto=require(_0x3d03('0xe'));var jsforce=require(_0x3d03('0xf'));var deskjs=require(_0x3d03('0x10'));var toCsv=require(_0x3d03('0xa'));var querystring=require('querystring');var Papa=require(_0x3d03('0x11'));var Redis=require(_0x3d03('0x12'));var authService=require(_0x3d03('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x3d03('0x14'));var hardwareService=require(_0x3d03('0x15'));var logger=require('../../config/logger')(_0x3d03('0x16'));var utils=require(_0x3d03('0x17'));var config=require(_0x3d03('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x3d03('0x19'));function respondWithStatusCode(_0x359788,_0x22594a){_0x22594a=_0x22594a||0xcc;return function(_0x43c52c){if(_0x43c52c){return _0x359788['sendStatus'](_0x22594a);}return _0x359788['status'](_0x22594a)['end']();};}function respondWithResult(_0x503315,_0x9519a1){_0x9519a1=_0x9519a1||0xc8;return function(_0x43b5bb){if(_0x43b5bb){return _0x503315[_0x3d03('0x1a')](_0x9519a1)['json'](_0x43b5bb);}};}function respondWithFilteredResult(_0x57c8b3,_0x498491){return function(_0x516eaf){if(_0x516eaf){var _0x3ac3be=typeof _0x498491[_0x3d03('0x1b')]===_0x3d03('0x1c')&&typeof _0x498491['limit']===_0x3d03('0x1c');var _0x37363b=_0x516eaf[_0x3d03('0x1d')];var _0x73d567=_0x3ac3be?0x0:_0x498491[_0x3d03('0x1b')];var _0x1818a2=_0x3ac3be?_0x516eaf[_0x3d03('0x1d')]:_0x498491['offset']+_0x498491[_0x3d03('0x1e')];var _0x543fb1;if(_0x1818a2>=_0x37363b){_0x1818a2=_0x37363b;_0x543fb1=0xc8;}else{_0x543fb1=0xce;}_0x57c8b3[_0x3d03('0x1a')](_0x543fb1);return _0x57c8b3[_0x3d03('0x1f')](_0x3d03('0x20'),_0x73d567+'-'+_0x1818a2+'/'+_0x37363b)['json'](_0x516eaf);}return null;};}function patchUpdates(_0x2d89cf){return function(_0x376bc5){try{jsonpatch['apply'](_0x376bc5,_0x2d89cf,!![]);}catch(_0x4c31b0){return BPromise['reject'](_0x4c31b0);}return _0x376bc5['save']();};}function saveUpdates(_0x407484,_0x34db19){return function(_0x534b8a){if(_0x534b8a){return _0x534b8a[_0x3d03('0x21')](_0x407484)[_0x3d03('0x22')](function(_0x42121c){return _0x42121c;});}return null;};}function removeEntity(_0x20391b,_0x2c3345){return function(_0x5693b4){if(_0x5693b4){return _0x5693b4['destroy']()[_0x3d03('0x22')](function(){_0x20391b['status'](0xcc)[_0x3d03('0x23')]();});}};}function handleEntityNotFound(_0xed9c7e,_0x35629f){return function(_0x5e948c){if(!_0x5e948c){_0xed9c7e[_0x3d03('0x24')](0x194);}return _0x5e948c;};}function handleError(_0x2227d4,_0x141a1a){_0x141a1a=_0x141a1a||0x1f4;return function(_0x27cbf6){logger['error'](_0x27cbf6[_0x3d03('0x25')]);if(_0x27cbf6[_0x3d03('0x26')]){delete _0x27cbf6['name'];}_0x2227d4[_0x3d03('0x1a')](_0x141a1a)[_0x3d03('0x27')](_0x27cbf6);};}exports['index']=function(_0x50262c,_0xd82c4b){var _0x27742b={},_0x400568={},_0x1a1e5b={'count':0x0,'rows':[]};var _0xe6b051=_[_0x3d03('0x28')](db[_0x3d03('0x29')][_0x3d03('0x2a')],function(_0x216b83){return{'name':_0x216b83[_0x3d03('0x2b')],'type':_0x216b83[_0x3d03('0x2c')][_0x3d03('0x2d')]};});_0x400568[_0x3d03('0x2e')]=_[_0x3d03('0x28')](_0xe6b051,_0x3d03('0x26'));_0x400568['query']=_[_0x3d03('0x2f')](_0x50262c[_0x3d03('0x30')]);_0x400568[_0x3d03('0x31')]=_[_0x3d03('0x32')](_0x400568[_0x3d03('0x2e')],_0x400568['query']);_0x27742b['attributes']=_['intersection'](_0x400568[_0x3d03('0x2e')],qs[_0x3d03('0x33')](_0x50262c[_0x3d03('0x30')]['fields']));_0x27742b[_0x3d03('0x34')]=_0x27742b['attributes'][_0x3d03('0x35')]?_0x27742b[_0x3d03('0x34')]:_0x400568[_0x3d03('0x2e')];if(!_0x50262c['query']['hasOwnProperty'](_0x3d03('0x36'))){_0x27742b[_0x3d03('0x1e')]=qs[_0x3d03('0x1e')](_0x50262c['query'][_0x3d03('0x1e')]);_0x27742b[_0x3d03('0x1b')]=qs['offset'](_0x50262c[_0x3d03('0x30')]['offset']);}_0x27742b[_0x3d03('0x37')]=qs[_0x3d03('0x38')](_0x50262c[_0x3d03('0x30')]['sort']);_0x27742b[_0x3d03('0x39')]=qs[_0x3d03('0x31')](_[_0x3d03('0x3a')](_0x50262c[_0x3d03('0x30')],_0x400568[_0x3d03('0x31')]),_0xe6b051);if(_0x50262c[_0x3d03('0x30')][_0x3d03('0x3b')]){_0x27742b[_0x3d03('0x39')]=_[_0x3d03('0x3c')](_0x27742b[_0x3d03('0x39')],{'$or':_[_0x3d03('0x28')](_0xe6b051,function(_0xd4373b){if(_0xd4373b['type']!==_0x3d03('0x3d')){var _0x5de1bc={};_0x5de1bc[_0xd4373b[_0x3d03('0x26')]]={'$like':'%'+_0x50262c[_0x3d03('0x30')]['filter']+'%'};return _0x5de1bc;}})});}_0x27742b=_['merge']({},_0x27742b,_0x50262c[_0x3d03('0x3e')]);var _0x3224f9={'where':_0x27742b[_0x3d03('0x39')]};return db[_0x3d03('0x29')][_0x3d03('0x1d')](_0x3224f9)[_0x3d03('0x22')](function(_0xa9143b){_0x1a1e5b[_0x3d03('0x1d')]=_0xa9143b;if(_0x50262c[_0x3d03('0x30')][_0x3d03('0x3f')]){_0x27742b[_0x3d03('0x40')]=[{'all':!![]}];}return db[_0x3d03('0x29')][_0x3d03('0x41')](_0x27742b);})[_0x3d03('0x22')](function(_0x233175){_0x1a1e5b[_0x3d03('0x42')]=_0x233175;return _0x1a1e5b;})[_0x3d03('0x22')](respondWithFilteredResult(_0xd82c4b,_0x27742b))[_0x3d03('0x43')](handleError(_0xd82c4b,null));};exports['show']=function(_0x565038,_0xf0efc3){var _0x3f25d6={'raw':![],'where':{'id':_0x565038['params']['id']}},_0x5af7b1={};_0x5af7b1[_0x3d03('0x2e')]=_[_0x3d03('0x2f')](db[_0x3d03('0x29')]['rawAttributes']);_0x5af7b1[_0x3d03('0x30')]=_[_0x3d03('0x2f')](_0x565038[_0x3d03('0x30')]);_0x5af7b1['filters']=_[_0x3d03('0x32')](_0x5af7b1['model'],_0x5af7b1[_0x3d03('0x30')]);_0x3f25d6[_0x3d03('0x34')]=_[_0x3d03('0x32')](_0x5af7b1[_0x3d03('0x2e')],qs[_0x3d03('0x33')](_0x565038['query'][_0x3d03('0x33')]));_0x3f25d6[_0x3d03('0x34')]=_0x3f25d6[_0x3d03('0x34')][_0x3d03('0x35')]?_0x3f25d6[_0x3d03('0x34')]:_0x5af7b1[_0x3d03('0x2e')];if(_0x565038[_0x3d03('0x30')][_0x3d03('0x3f')]){_0x3f25d6[_0x3d03('0x40')]=[{'all':!![]}];}_0x3f25d6=_[_0x3d03('0x3c')]({},_0x3f25d6,_0x565038[_0x3d03('0x3e')]);return db[_0x3d03('0x29')][_0x3d03('0x44')](_0x3f25d6)[_0x3d03('0x22')](handleEntityNotFound(_0xf0efc3,null))[_0x3d03('0x22')](respondWithResult(_0xf0efc3,null))[_0x3d03('0x43')](handleError(_0xf0efc3,null));};exports[_0x3d03('0x45')]=function(_0x8e120c,_0x14bfd6){return db[_0x3d03('0x29')][_0x3d03('0x45')](_0x8e120c[_0x3d03('0x46')],{})[_0x3d03('0x22')](respondWithResult(_0x14bfd6,0xc9))[_0x3d03('0x43')](handleError(_0x14bfd6,null));};exports[_0x3d03('0x21')]=function(_0x3602c3,_0x2be35b){if(_0x3602c3[_0x3d03('0x46')]['id']){delete _0x3602c3[_0x3d03('0x46')]['id'];}return db[_0x3d03('0x29')][_0x3d03('0x44')]({'where':{'id':_0x3602c3['params']['id']}})[_0x3d03('0x22')](handleEntityNotFound(_0x2be35b,null))['then'](saveUpdates(_0x3602c3[_0x3d03('0x46')],null))[_0x3d03('0x22')](respondWithResult(_0x2be35b,null))['catch'](handleError(_0x2be35b,null));};exports[_0x3d03('0x47')]=function(_0x179ddc,_0x1c4a6f){return db[_0x3d03('0x29')][_0x3d03('0x44')]({'where':{'id':_0x179ddc['params']['id']}})[_0x3d03('0x22')](handleEntityNotFound(_0x1c4a6f,null))[_0x3d03('0x22')](removeEntity(_0x1c4a6f,null))['catch'](handleError(_0x1c4a6f,null));};exports[_0x3d03('0x48')]=function(_0xea1a9e,_0x289fc4,_0x4206f7){var _0x3af626={};var _0x20374c={};var _0x5a30e2;var _0x18c597;return db[_0x3d03('0x29')]['findOne']({'where':{'id':_0xea1a9e[_0x3d03('0x49')]['id']}})[_0x3d03('0x22')](handleEntityNotFound(_0x289fc4,null))[_0x3d03('0x22')](function(_0x53aa8c){if(_0x53aa8c){_0x5a30e2=_0x53aa8c;_0x20374c[_0x3d03('0x2e')]=_[_0x3d03('0x2f')](db[_0x3d03('0x4a')][_0x3d03('0x2a')]);_0x20374c['query']=_[_0x3d03('0x2f')](_0xea1a9e['query']);_0x20374c[_0x3d03('0x31')]=_[_0x3d03('0x32')](_0x20374c[_0x3d03('0x2e')],_0x20374c[_0x3d03('0x30')]);_0x3af626[_0x3d03('0x34')]=_['intersection'](_0x20374c[_0x3d03('0x2e')],qs[_0x3d03('0x33')](_0xea1a9e[_0x3d03('0x30')]['fields']));_0x3af626['attributes']=_0x3af626['attributes'][_0x3d03('0x35')]?_0x3af626[_0x3d03('0x34')]:_0x20374c['model'];_0x3af626[_0x3d03('0x37')]=qs[_0x3d03('0x38')](_0xea1a9e[_0x3d03('0x30')][_0x3d03('0x38')]);_0x3af626[_0x3d03('0x39')]=qs[_0x3d03('0x31')](_[_0x3d03('0x3a')](_0xea1a9e[_0x3d03('0x30')],_0x20374c[_0x3d03('0x31')]));if(_0xea1a9e[_0x3d03('0x30')][_0x3d03('0x3b')]){_0x3af626['where']=_[_0x3d03('0x3c')](_0x3af626[_0x3d03('0x39')],{'$or':_[_0x3d03('0x28')](_0x3af626['attributes'],function(_0x438cb0){var _0x44c200={};_0x44c200[_0x438cb0]={'$like':'%'+_0xea1a9e[_0x3d03('0x30')][_0x3d03('0x3b')]+'%'};return _0x44c200;})});}_0x3af626=_[_0x3d03('0x3c')]({},_0x3af626,_0xea1a9e[_0x3d03('0x3e')]);return _0x5a30e2[_0x3d03('0x48')](_0x3af626);}})[_0x3d03('0x22')](function(_0x1a61db){if(_0x1a61db){_0x18c597=_0x1a61db[_0x3d03('0x35')];if(!_0xea1a9e['query'][_0x3d03('0x4b')]('nolimit')){_0x3af626[_0x3d03('0x1e')]=qs[_0x3d03('0x1e')](_0xea1a9e[_0x3d03('0x30')][_0x3d03('0x1e')]);_0x3af626[_0x3d03('0x1b')]=qs[_0x3d03('0x1b')](_0xea1a9e[_0x3d03('0x30')][_0x3d03('0x1b')]);}return _0x5a30e2['getConfigurations'](_0x3af626);}})[_0x3d03('0x22')](function(_0x49fe6b){if(_0x49fe6b){return _0x49fe6b?{'count':_0x18c597,'rows':_0x49fe6b}:null;}})['then'](respondWithResult(_0x289fc4,null))['catch'](handleError(_0x289fc4,null));};exports[_0x3d03('0x4c')]=function(_0x48f2e6,_0x586410,_0x2ef53a){if(_0x48f2e6[_0x3d03('0x46')]['id']){delete _0x48f2e6[_0x3d03('0x46')]['id'];}return db[_0x3d03('0x29')][_0x3d03('0x4d')]({'where':{'id':_0x48f2e6[_0x3d03('0x49')]['id']}})[_0x3d03('0x22')](handleEntityNotFound(_0x586410,null))[_0x3d03('0x22')](function(_0x13491c){if(_0x13491c){_0x48f2e6['body'][_0x3d03('0x4e')]=_0x13491c['id'];_0x48f2e6['body'][_0x3d03('0x4f')]=integrations[_0x3d03('0x50')](_0x48f2e6[_0x3d03('0x46')]['channel'],_0x48f2e6[_0x3d03('0x46')][_0x3d03('0x2c')]);_0x48f2e6[_0x3d03('0x46')][_0x3d03('0x51')]=integrations['getDescriptions'](_0x48f2e6[_0x3d03('0x46')][_0x3d03('0x52')],_0x48f2e6[_0x3d03('0x46')][_0x3d03('0x2c')]);return db[_0x3d03('0x4a')]['create'](_0x48f2e6['body'],{'include':[{'model':db[_0x3d03('0x53')],'as':_0x3d03('0x4f')},{'model':db[_0x3d03('0x53')],'as':_0x3d03('0x51')}]});}return null;})[_0x3d03('0x22')](respondWithResult(_0x586410,null))[_0x3d03('0x43')](handleError(_0x586410,null));};function getAccessToken(_0x38799a){return new Promise(function(_0x12bc94,_0x4811ee){var _0x469b62;switch(_0x38799a[_0x3d03('0x54')]){case'US':_0x469b62=_0x3d03('0x55');break;case'AU':_0x469b62=_0x3d03('0x56');break;case'EU':_0x469b62=_0x3d03('0x57');break;case'IN':_0x469b62='https://accounts.zoho.in';break;case'CN':_0x469b62=_0x3d03('0x58');break;default:_0x469b62=_0x3d03('0x57');break;}var _0x563212={'method':_0x3d03('0x59'),'uri':_0x469b62+_0x3d03('0x5a'),'qs':{'refresh_token':_0x38799a[_0x3d03('0x5b')],'client_id':_0x38799a[_0x3d03('0x5c')],'client_secret':_0x38799a[_0x3d03('0x5d')],'grant_type':_0x3d03('0x5e')},'json':!![]};return rp(_0x563212)[_0x3d03('0x22')](function(_0x12b78a){if(_0x12b78a['access_token']){_0x12bc94(_0x12b78a[_0x3d03('0x5f')]);}else{_0x4811ee(_0x3d03('0x60'));}})['catch'](function(_0xb9c66){_0x4811ee(_0xb9c66);});});}exports['getFields']=function(_0x1e3b83,_0x1cf934,_0x35225a){var _0xd8c05,_0x186197,_0x319f10,_0x18f72c,_0x16521b;return db[_0x3d03('0x29')][_0x3d03('0x4d')]({'where':{'id':_0x1e3b83[_0x3d03('0x49')]['id']},'attributes':['id','host',_0x3d03('0x54'),_0x3d03('0x5c'),_0x3d03('0x5d'),_0x3d03('0x61'),_0x3d03('0x62'),_0x3d03('0x5b')]})[_0x3d03('0x22')](handleEntityNotFound(_0x1cf934,null))[_0x3d03('0x22')](function(_0x30cfa7){_0x16521b=_0x30cfa7;_0xd8c05=_0x16521b['host'];_0x186197=_0xd8c05==='zoho.eu'?'eu':_0x3d03('0x63');_0x319f10=_0x16521b['serverUrl'];var _0x8fd869=_0x319f10[_0x3d03('0x64')](-0x1);if(_0x8fd869==='/'||_0x8fd869==='\x5c'||_0x8fd869===':'){_0x319f10=_0x319f10[_0x3d03('0x65')](0x0,_0x319f10['lastIndexOf'](_0x8fd869));}if(!_0x16521b['refreshToken']){throw new Error(_0x3d03('0x66'));}return getAccessToken(_0x16521b);})[_0x3d03('0x22')](function(_0x12d400){if(_0x12d400){return rp({'method':_0x3d03('0x67'),'uri':util[_0x3d03('0x68')](_0x3d03('0x69'),_0x186197),'qs':{'module':_0x3d03('0x6a')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x12d400},'json':!![]});}})[_0x3d03('0x22')](function(_0x200493){if(_0x200493){if(_0x200493['response']&&_0x200493['response'][_0x3d03('0x6b')]){throw new Error(_0x200493[_0x3d03('0x6c')][_0x3d03('0x6b')]['message']);}var _0x422c80=[];var _0x1b50c8=[];var _0x1abbd4=[_0x3d03('0x6d'),_0x3d03('0x6e'),_0x3d03('0x6f'),'WhoId',_0x3d03('0x70'),_0x3d03('0x71'),'Call_Start_Time',_0x3d03('0x72')];_0x1b50c8=_['remove'](_0x200493[_0x3d03('0x33')],function(_0x2b084a){return _0x1abbd4['includes'](_0x2b084a[_0x3d03('0x73')]);});for(var _0x39f8e0=0x0;_0x39f8e0<_0x1b50c8[_0x3d03('0x35')];_0x39f8e0++){if(_0x1b50c8[_0x39f8e0][_0x3d03('0x74')]===![]){_0x422c80[_0x3d03('0x75')]({'id':_0x1b50c8[_0x39f8e0]['id'],'name':_0x1b50c8[_0x39f8e0]['display_label'],'custom':_0x1b50c8[_0x39f8e0][_0x3d03('0x76')],'options':_0x1b50c8[_0x39f8e0]['data_type']===_0x3d03('0x77')&&_0x1b50c8[_0x39f8e0][_0x3d03('0x78')][_0x3d03('0x35')]>-0x1?_[_0x3d03('0x28')](_0x1b50c8[_0x39f8e0]['pick_list_values'],function(_0x3f4952){return{'name':_0x3f4952,'value':_0x3f4952};}):[]});}}return{'count':_0x422c80[_0x3d03('0x35')],'rows':_0x422c80};}else{return{'count':0x0,'rows':[]};}})[_0x3d03('0x22')](respondWithResult(_0x1cf934,null))[_0x3d03('0x43')](function(_0x5ca5a7){var _0x99eedf=_0x1e3b83['query']['test']?0x1f4:_0x5ca5a7['statusCode']||0x1f4;logger['error'](_0x3d03('0x79'),_0x3d03('0x7a'),_0x99eedf,JSON[_0x3d03('0x7b')](_0x5ca5a7));delete _0x5ca5a7[_0x3d03('0x26')];if(_0x99eedf===0x191){_0x99eedf=0x190;}_0x1cf934[_0x3d03('0x1a')](_0x99eedf)['send'](_0x1e3b83['query'][_0x3d03('0x7c')]?{'message':_0x3d03('0x7d'),'statusCode':_0x5ca5a7[_0x3d03('0x7e')]}:_0x5ca5a7);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 4f29920..e3efe26 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 _0x2668=['POST','/oauth/v2/token','parse','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','catch','inspect','host','authorization_code','application/x-www-form-urlencoded','then','refresh_token','error','lodash','../../config/logger','api','moment','request-promise','../../config/environment','../../components/integrations/configuration','exports','define','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu'];(function(_0x363c19,_0x3b28d9){var _0x311919=function(_0x361186){while(--_0x361186){_0x363c19['push'](_0x363c19['shift']());}};_0x311919(++_0x3b28d9);}(_0x2668,0x151));var _0x8266=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x2668[_0x465028];return _0xb783d4;};'use strict';var _=require(_0x8266('0x0'));var util=require('util');var logger=require(_0x8266('0x1'))(_0x8266('0x2'));var moment=require(_0x8266('0x3'));var BPromise=require('bluebird');var rp=require(_0x8266('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8266('0x5'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0x8266('0x6'));module[_0x8266('0x7')]=function(_0x5016b0,_0x20dda5){return _0x5016b0[_0x8266('0x8')]('ZohoAccount',attributes,{'tableName':_0x8266('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x329cd9,_0x340a2a,_0x28a431){if(_0x329cd9[_0x8266('0xa')](_0x8266('0xb'))||_0x329cd9[_0x8266('0xa')](_0x8266('0xc'))||_0x329cd9[_0x8266('0xa')](_0x8266('0xd'))||_0x329cd9[_0x8266('0xa')](_0x8266('0xe'))||_0x329cd9[_0x8266('0xa')](_0x8266('0xf'))||_0x329cd9[_0x8266('0xa')]('host')){var _0x372941,_0x4d1017;_0x372941=_0x329cd9[_0x8266('0xc')];var _0x106f75=_0x372941['slice'](-0x1);if(_0x106f75==='/'||_0x106f75==='\x5c'||_0x106f75===':'){_0x372941=_0x372941[_0x8266('0x10')](0x0,_0x372941[_0x8266('0x11')](_0x106f75));}switch(_0x329cd9[_0x8266('0xb')]){case'US':_0x4d1017=_0x8266('0x12');break;case'AU':_0x4d1017=_0x8266('0x13');break;case'IN':_0x4d1017=_0x8266('0x14');break;case'CN':_0x4d1017=_0x8266('0x15');break;default:_0x4d1017=_0x8266('0x16');break;}var _0x1989d7={'method':_0x8266('0x17'),'uri':_0x4d1017+_0x8266('0x18'),'form':{'grant_type':'authorization_code','client_id':_0x329cd9['clientId'],'client_secret':_0x329cd9[_0x8266('0xe')],'redirect_uri':_0x329cd9[_0x8266('0xc')],'code':_0x329cd9['code']},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x1989d7)['then'](function(_0xd9b667){var _0x89d07f=JSON[_0x8266('0x19')](_0xd9b667);if(_0x89d07f['refresh_token']){_0x329cd9[_0x8266('0x1a')]=_0x89d07f['refresh_token'];logger[_0x8266('0x1b')](util[_0x8266('0x1c')](_0x8266('0x1d'),_0x329cd9[_0x8266('0x1e')],_0x329cd9['id']));}else{logger['error'](util['format'](_0x8266('0x1f'),_0x329cd9['name'],_0x329cd9['id']),util['inspect'](_0x89d07f,{'showHidden':![],'depth':null}));}return _0x28a431(null,_0x340a2a);})[_0x8266('0x20')](function(_0xb5ea3b){logger['error'](util[_0x8266('0x1c')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x329cd9[_0x8266('0x1e')],_0x329cd9['id']),util[_0x8266('0x21')](parsedResult,{'showHidden':![],'depth':null}));return _0x28a431(_0xb5ea3b);});}else{return _0x28a431(null,_0x340a2a);}},'beforeUpdate':function(_0x5b5b88,_0x27b81d,_0x215a71){if(_0x5b5b88['changed'](_0x8266('0xb'))||_0x5b5b88[_0x8266('0xa')](_0x8266('0xc'))||_0x5b5b88[_0x8266('0xa')](_0x8266('0xd'))||_0x5b5b88['changed'](_0x8266('0xe'))||_0x5b5b88[_0x8266('0xa')](_0x8266('0xf'))||_0x5b5b88[_0x8266('0xa')](_0x8266('0x22'))){var _0x1ad4e8,_0x256566;_0x1ad4e8=_0x5b5b88[_0x8266('0xc')];var _0x2c3c79=_0x1ad4e8['slice'](-0x1);if(_0x2c3c79==='/'||_0x2c3c79==='\x5c'||_0x2c3c79===':'){_0x1ad4e8=_0x1ad4e8[_0x8266('0x10')](0x0,_0x1ad4e8[_0x8266('0x11')](_0x2c3c79));}switch(_0x5b5b88[_0x8266('0xb')]){case'US':_0x256566='https://accounts.zoho.com';break;case'AU':_0x256566=_0x8266('0x13');break;case'IN':_0x256566=_0x8266('0x14');break;case'CN':_0x256566=_0x8266('0x15');break;default:_0x256566=_0x8266('0x16');break;}var _0xe72f21={'method':_0x8266('0x17'),'uri':_0x256566+_0x8266('0x18'),'form':{'grant_type':_0x8266('0x23'),'client_id':_0x5b5b88[_0x8266('0xd')],'client_secret':_0x5b5b88['clientSecret'],'redirect_uri':_0x5b5b88[_0x8266('0xc')],'code':_0x5b5b88[_0x8266('0xf')]},'headers':{'Content-Type':_0x8266('0x24')}};return rp(_0xe72f21)[_0x8266('0x25')](function(_0x40a44e){var _0x27a95c=JSON[_0x8266('0x19')](_0x40a44e);if(_0x27a95c[_0x8266('0x26')]){_0x5b5b88['refreshToken']=_0x27a95c['refresh_token'];logger[_0x8266('0x1b')](util[_0x8266('0x1c')](_0x8266('0x1d'),_0x5b5b88[_0x8266('0x1e')],_0x5b5b88['id']));}else{logger[_0x8266('0x27')](util['format'](_0x8266('0x1f'),_0x5b5b88[_0x8266('0x1e')],_0x5b5b88['id']),util['inspect'](_0x27a95c,{'showHidden':![],'depth':null}));}return _0x215a71(null,_0x27b81d);})[_0x8266('0x20')](function(_0x2e0379){logger[_0x8266('0x27')](util[_0x8266('0x1c')](_0x8266('0x1f'),_0x5b5b88[_0x8266('0x1e')],_0x5b5b88['id']),util[_0x8266('0x21')](parsedResult,{'showHidden':![],'depth':null}));return _0x215a71(_0x2e0379);});}else{return _0x215a71(null,_0x27b81d);}}}});}; \ No newline at end of file +var _0x22ad=['https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','authorization_code','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','host','slice','substring','lastIndexOf'];(function(_0x4da78e,_0x13cb84){var _0x4463b1=function(_0x41aaf1){while(--_0x41aaf1){_0x4da78e['push'](_0x4da78e['shift']());}};_0x4463b1(++_0x13cb84);}(_0x22ad,0xc0));var _0xd22a=function(_0x411d10,_0x2906f5){_0x411d10=_0x411d10-0x0;var _0x1b20c5=_0x22ad[_0x411d10];return _0x1b20c5;};'use strict';var _=require(_0xd22a('0x0'));var util=require(_0xd22a('0x1'));var logger=require('../../config/logger')(_0xd22a('0x2'));var moment=require(_0xd22a('0x3'));var BPromise=require(_0xd22a('0x4'));var rp=require(_0xd22a('0x5'));var fs=require('fs');var path=require(_0xd22a('0x6'));var rimraf=require(_0xd22a('0x7'));var config=require(_0xd22a('0x8'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0xd22a('0x9'));module['exports']=function(_0x12bae1,_0x45a457){return _0x12bae1[_0xd22a('0xa')](_0xd22a('0xb'),attributes,{'tableName':_0xd22a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x33138e,_0x1ac53c,_0x44a16c){if(_0x33138e[_0xd22a('0xd')](_0xd22a('0xe'))||_0x33138e[_0xd22a('0xd')](_0xd22a('0xf'))||_0x33138e[_0xd22a('0xd')](_0xd22a('0x10'))||_0x33138e[_0xd22a('0xd')](_0xd22a('0x11'))||_0x33138e['changed'](_0xd22a('0x12'))||_0x33138e[_0xd22a('0xd')](_0xd22a('0x13'))){var _0x1257b4,_0x5a6f6d;_0x1257b4=_0x33138e['serverUrl'];var _0x257565=_0x1257b4[_0xd22a('0x14')](-0x1);if(_0x257565==='/'||_0x257565==='\x5c'||_0x257565===':'){_0x1257b4=_0x1257b4[_0xd22a('0x15')](0x0,_0x1257b4[_0xd22a('0x16')](_0x257565));}switch(_0x33138e['zone']){case'US':_0x5a6f6d=_0xd22a('0x17');break;case'AU':_0x5a6f6d=_0xd22a('0x18');break;case'IN':_0x5a6f6d=_0xd22a('0x19');break;case'CN':_0x5a6f6d=_0xd22a('0x1a');break;default:_0x5a6f6d=_0xd22a('0x1b');break;}var _0x4c7b09={'method':_0xd22a('0x1c'),'uri':_0x5a6f6d+_0xd22a('0x1d'),'form':{'grant_type':'authorization_code','client_id':_0x33138e[_0xd22a('0x10')],'client_secret':_0x33138e['clientSecret'],'redirect_uri':_0x33138e[_0xd22a('0xf')],'code':_0x33138e[_0xd22a('0x12')]},'headers':{'Content-Type':_0xd22a('0x1e')}};return rp(_0x4c7b09)[_0xd22a('0x1f')](function(_0x579d4b){var _0x32d415=JSON[_0xd22a('0x20')](_0x579d4b);if(_0x32d415[_0xd22a('0x21')]){_0x33138e[_0xd22a('0x22')]=_0x32d415[_0xd22a('0x21')];logger[_0xd22a('0x23')](util[_0xd22a('0x24')](_0xd22a('0x25'),_0x33138e[_0xd22a('0x26')],_0x33138e['id']));}else{logger[_0xd22a('0x27')](util[_0xd22a('0x24')](_0xd22a('0x28'),_0x33138e['name'],_0x33138e['id']),util[_0xd22a('0x29')](_0x32d415,{'showHidden':![],'depth':null}));}return _0x44a16c(null,_0x1ac53c);})['catch'](function(_0x30d8e2){logger['error'](util['format'](_0xd22a('0x28'),_0x33138e['name'],_0x33138e['id']),util[_0xd22a('0x29')](parsedResult,{'showHidden':![],'depth':null}));return _0x44a16c(_0x30d8e2);});}else{return _0x44a16c(null,_0x1ac53c);}},'beforeUpdate':function(_0x4e55d0,_0x5637e3,_0x4628b8){if(_0x4e55d0[_0xd22a('0xd')]('zone')||_0x4e55d0[_0xd22a('0xd')](_0xd22a('0xf'))||_0x4e55d0['changed'](_0xd22a('0x10'))||_0x4e55d0[_0xd22a('0xd')]('clientSecret')||_0x4e55d0['changed'](_0xd22a('0x12'))||_0x4e55d0[_0xd22a('0xd')]('host')){var _0x5b2720,_0x4a08f1;_0x5b2720=_0x4e55d0['serverUrl'];var _0x387352=_0x5b2720[_0xd22a('0x14')](-0x1);if(_0x387352==='/'||_0x387352==='\x5c'||_0x387352===':'){_0x5b2720=_0x5b2720['substring'](0x0,_0x5b2720['lastIndexOf'](_0x387352));}switch(_0x4e55d0[_0xd22a('0xe')]){case'US':_0x4a08f1=_0xd22a('0x17');break;case'AU':_0x4a08f1=_0xd22a('0x18');break;case'IN':_0x4a08f1=_0xd22a('0x19');break;case'CN':_0x4a08f1='https://accounts.zoho.com.cn';break;default:_0x4a08f1=_0xd22a('0x1b');break;}var _0x5ab0c4={'method':_0xd22a('0x1c'),'uri':_0x4a08f1+_0xd22a('0x1d'),'form':{'grant_type':_0xd22a('0x2a'),'client_id':_0x4e55d0[_0xd22a('0x10')],'client_secret':_0x4e55d0[_0xd22a('0x11')],'redirect_uri':_0x4e55d0[_0xd22a('0xf')],'code':_0x4e55d0['code']},'headers':{'Content-Type':_0xd22a('0x1e')}};return rp(_0x5ab0c4)[_0xd22a('0x1f')](function(_0xd21547){var _0x16eea7=JSON[_0xd22a('0x20')](_0xd21547);if(_0x16eea7[_0xd22a('0x21')]){_0x4e55d0[_0xd22a('0x22')]=_0x16eea7[_0xd22a('0x21')];logger['info'](util[_0xd22a('0x24')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4e55d0[_0xd22a('0x26')],_0x4e55d0['id']));}else{logger[_0xd22a('0x27')](util[_0xd22a('0x24')](_0xd22a('0x28'),_0x4e55d0[_0xd22a('0x26')],_0x4e55d0['id']),util[_0xd22a('0x29')](_0x16eea7,{'showHidden':![],'depth':null}));}return _0x4628b8(null,_0x5637e3);})['catch'](function(_0x2d550c){logger[_0xd22a('0x27')](util[_0xd22a('0x24')](_0xd22a('0x28'),_0x4e55d0['name'],_0x4e55d0['id']),util[_0xd22a('0x29')](parsedResult,{'showHidden':![],'depth':null}));return _0x4628b8(_0x2d550c);});}else{return _0x4628b8(null,_0x5637e3);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 0938ce9..21ac018 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 _0x6b47=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','attributes','limit','include','map','model','ShowZohoAccount','find','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x7a6e0,_0x35f1d3){var _0x2ef4a7=function(_0x43cc67){while(--_0x43cc67){_0x7a6e0['push'](_0x7a6e0['shift']());}};_0x2ef4a7(++_0x35f1d3);}(_0x6b47,0xe9));var _0x76b4=function(_0x354df6,_0x4fb714){_0x354df6=_0x354df6-0x0;var _0x3b8676=_0x6b47[_0x354df6];return _0x3b8676;};'use strict';var _=require('lodash');var util=require(_0x76b4('0x0'));var moment=require('moment');var BPromise=require(_0x76b4('0x1'));var rs=require(_0x76b4('0x2'));var fs=require('fs');var Redis=require(_0x76b4('0x3'));var db=require(_0x76b4('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x76b4('0x5'))(_0x76b4('0x6'));var config=require(_0x76b4('0x7'));var jayson=require(_0x76b4('0x8'));var client=jayson[_0x76b4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x461190,_0x2a0690,_0x6b3a2e){return new BPromise(function(_0x14e933,_0x220044){return client[_0x76b4('0xa')](_0x461190,_0x6b3a2e)[_0x76b4('0xb')](function(_0x127be2){logger[_0x76b4('0xc')](_0x76b4('0xd'),_0x2a0690,_0x76b4('0xe'));logger[_0x76b4('0xf')](_0x76b4('0x10'),_0x2a0690,'request\x20sent',JSON[_0x76b4('0x11')](_0x127be2));if(_0x127be2[_0x76b4('0x12')]){if(_0x127be2['error'][_0x76b4('0x13')]===0x1f4){logger[_0x76b4('0x12')](_0x76b4('0xd'),_0x2a0690,_0x127be2['error']['message']);return _0x220044(_0x127be2[_0x76b4('0x12')][_0x76b4('0x14')]);}logger[_0x76b4('0x12')](_0x76b4('0xd'),_0x2a0690,_0x127be2[_0x76b4('0x12')][_0x76b4('0x14')]);return _0x14e933(_0x127be2[_0x76b4('0x12')][_0x76b4('0x14')]);}else{logger[_0x76b4('0xc')](_0x76b4('0xd'),_0x2a0690,'request\x20sent');_0x14e933(_0x127be2['result'][_0x76b4('0x14')]);}})[_0x76b4('0x15')](function(_0x5f39fc){logger['error'](_0x76b4('0xd'),_0x2a0690,_0x5f39fc);_0x220044(_0x5f39fc);});});}exports[_0x76b4('0x16')]=function(_0x2bf42a){var _0x203d8e=this;return new Promise(function(_0x19feeb,_0x4b170e){return db[_0x76b4('0x17')][_0x76b4('0x18')]({'raw':_0x2bf42a[_0x76b4('0x19')]?_0x2bf42a[_0x76b4('0x19')][_0x76b4('0x1a')]===undefined?!![]:![]:!![],'where':_0x2bf42a['options']?_0x2bf42a[_0x76b4('0x19')]['where']||null:null,'attributes':_0x2bf42a['options']?_0x2bf42a[_0x76b4('0x19')][_0x76b4('0x1b')]||null:null,'limit':_0x2bf42a[_0x76b4('0x19')]?_0x2bf42a['options'][_0x76b4('0x1c')]||null:null,'include':_0x2bf42a['options']?_0x2bf42a[_0x76b4('0x19')][_0x76b4('0x1d')]?_[_0x76b4('0x1e')](_0x2bf42a[_0x76b4('0x19')][_0x76b4('0x1d')],function(_0x40e25a){return{'model':db[_0x40e25a[_0x76b4('0x1f')]],'as':_0x40e25a['as'],'attributes':_0x40e25a[_0x76b4('0x1b')],'include':_0x40e25a['include']?_[_0x76b4('0x1e')](_0x40e25a['include'],function(_0x458b60){return{'model':db[_0x458b60['model']],'as':_0x458b60['as'],'attributes':_0x458b60[_0x76b4('0x1b')],'include':_0x458b60['include']?_[_0x76b4('0x1e')](_0x458b60[_0x76b4('0x1d')],function(_0x552843){return{'model':db[_0x552843[_0x76b4('0x1f')]],'as':_0x552843['as'],'attributes':_0x552843[_0x76b4('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x76b4('0xb')](function(_0x56b805){logger[_0x76b4('0xc')](_0x76b4('0x16'),_0x2bf42a);logger[_0x76b4('0xf')]('GetZohoAccount',_0x2bf42a,JSON[_0x76b4('0x11')](_0x56b805));_0x19feeb(_0x56b805);})['catch'](function(_0x2a39e2){logger[_0x76b4('0x12')](_0x76b4('0x16'),_0x2a39e2[_0x76b4('0x14')],_0x2bf42a);_0x4b170e(_0x203d8e[_0x76b4('0x12')](0x1f4,_0x2a39e2[_0x76b4('0x14')]));});});};exports[_0x76b4('0x20')]=function(_0x1330b5){var _0xc7e753=this;return new Promise(function(_0x455b4a,_0x4e6b42){return db[_0x76b4('0x17')][_0x76b4('0x21')]({'raw':_0x1330b5[_0x76b4('0x19')]?_0x1330b5['options'][_0x76b4('0x1a')]===undefined?!![]:![]:!![],'where':_0x1330b5['options']?_0x1330b5[_0x76b4('0x19')]['where']||null:null,'attributes':_0x1330b5[_0x76b4('0x19')]?_0x1330b5[_0x76b4('0x19')]['attributes']||null:null,'include':_0x1330b5[_0x76b4('0x19')]?_0x1330b5['options']['include']?_[_0x76b4('0x1e')](_0x1330b5[_0x76b4('0x19')]['include'],function(_0x53ece7){return{'model':db[_0x53ece7[_0x76b4('0x1f')]],'as':_0x53ece7['as'],'attributes':_0x53ece7[_0x76b4('0x1b')],'include':_0x53ece7[_0x76b4('0x1d')]?_[_0x76b4('0x1e')](_0x53ece7[_0x76b4('0x1d')],function(_0x5c67c4){return{'model':db[_0x5c67c4['model']],'as':_0x5c67c4['as'],'attributes':_0x5c67c4[_0x76b4('0x1b')],'include':_0x5c67c4[_0x76b4('0x1d')]?_['map'](_0x5c67c4[_0x76b4('0x1d')],function(_0x52d9cd){return{'model':db[_0x52d9cd[_0x76b4('0x1f')]],'as':_0x52d9cd['as'],'attributes':_0x52d9cd[_0x76b4('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x76b4('0xb')](function(_0x268b2e){logger['info'](_0x76b4('0x20'),_0x1330b5);logger[_0x76b4('0xf')](_0x76b4('0x20'),_0x1330b5,JSON[_0x76b4('0x11')](_0x268b2e));_0x455b4a(_0x268b2e);})[_0x76b4('0x15')](function(_0x2682e7){logger[_0x76b4('0x12')](_0x76b4('0x20'),_0x2682e7['message'],_0x1330b5);_0x4e6b42(_0xc7e753[_0x76b4('0x12')](0x1f4,_0x2682e7[_0x76b4('0x14')]));});});}; \ No newline at end of file +var _0x9962=['client','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','ZohoAccount','findAll','options','raw','where','limit','map','include','model','attributes','GetZohoAccount','ShowZohoAccount','find','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x4063a4,_0x19d730){var _0x17908d=function(_0x3ce714){while(--_0x3ce714){_0x4063a4['push'](_0x4063a4['shift']());}};_0x17908d(++_0x19d730);}(_0x9962,0xb8));var _0x2996=function(_0x2a424d,_0x12f5aa){_0x2a424d=_0x2a424d-0x0;var _0x7891e9=_0x9962[_0x2a424d];return _0x7891e9;};'use strict';var _=require(_0x2996('0x0'));var util=require('util');var moment=require(_0x2996('0x1'));var BPromise=require(_0x2996('0x2'));var rs=require(_0x2996('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2996('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2996('0x5'))(_0x2996('0x6'));var config=require('../../config/environment');var jayson=require(_0x2996('0x7'));var client=jayson[_0x2996('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xca00e4,_0x9a6998,_0x2f385d){return new BPromise(function(_0x871918,_0x295aad){return client['request'](_0xca00e4,_0x2f385d)[_0x2996('0x9')](function(_0x5a24dd){logger[_0x2996('0xa')](_0x2996('0xb'),_0x9a6998,_0x2996('0xc'));logger[_0x2996('0xd')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x9a6998,_0x2996('0xc'),JSON[_0x2996('0xe')](_0x5a24dd));if(_0x5a24dd[_0x2996('0xf')]){if(_0x5a24dd[_0x2996('0xf')]['code']===0x1f4){logger[_0x2996('0xf')](_0x2996('0xb'),_0x9a6998,_0x5a24dd[_0x2996('0xf')][_0x2996('0x10')]);return _0x295aad(_0x5a24dd['error'][_0x2996('0x10')]);}logger['error'](_0x2996('0xb'),_0x9a6998,_0x5a24dd[_0x2996('0xf')]['message']);return _0x871918(_0x5a24dd[_0x2996('0xf')][_0x2996('0x10')]);}else{logger[_0x2996('0xa')](_0x2996('0xb'),_0x9a6998,_0x2996('0xc'));_0x871918(_0x5a24dd[_0x2996('0x11')][_0x2996('0x10')]);}})['catch'](function(_0x4e5d53){logger[_0x2996('0xf')](_0x2996('0xb'),_0x9a6998,_0x4e5d53);_0x295aad(_0x4e5d53);});});}exports['GetZohoAccount']=function(_0x4c29bd){var _0x31c5ca=this;return new Promise(function(_0x149c68,_0x49a938){return db[_0x2996('0x12')][_0x2996('0x13')]({'raw':_0x4c29bd[_0x2996('0x14')]?_0x4c29bd[_0x2996('0x14')][_0x2996('0x15')]===undefined?!![]:![]:!![],'where':_0x4c29bd[_0x2996('0x14')]?_0x4c29bd[_0x2996('0x14')][_0x2996('0x16')]||null:null,'attributes':_0x4c29bd[_0x2996('0x14')]?_0x4c29bd[_0x2996('0x14')]['attributes']||null:null,'limit':_0x4c29bd[_0x2996('0x14')]?_0x4c29bd[_0x2996('0x14')][_0x2996('0x17')]||null:null,'include':_0x4c29bd[_0x2996('0x14')]?_0x4c29bd[_0x2996('0x14')]['include']?_[_0x2996('0x18')](_0x4c29bd[_0x2996('0x14')][_0x2996('0x19')],function(_0x4de34d){return{'model':db[_0x4de34d[_0x2996('0x1a')]],'as':_0x4de34d['as'],'attributes':_0x4de34d[_0x2996('0x1b')],'include':_0x4de34d[_0x2996('0x19')]?_['map'](_0x4de34d[_0x2996('0x19')],function(_0x88f1c5){return{'model':db[_0x88f1c5[_0x2996('0x1a')]],'as':_0x88f1c5['as'],'attributes':_0x88f1c5['attributes'],'include':_0x88f1c5[_0x2996('0x19')]?_[_0x2996('0x18')](_0x88f1c5['include'],function(_0x229fad){return{'model':db[_0x229fad[_0x2996('0x1a')]],'as':_0x229fad['as'],'attributes':_0x229fad[_0x2996('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x2996('0x9')](function(_0x52b693){logger[_0x2996('0xa')](_0x2996('0x1c'),_0x4c29bd);logger['debug']('GetZohoAccount',_0x4c29bd,JSON[_0x2996('0xe')](_0x52b693));_0x149c68(_0x52b693);})['catch'](function(_0x3adddd){logger[_0x2996('0xf')](_0x2996('0x1c'),_0x3adddd[_0x2996('0x10')],_0x4c29bd);_0x49a938(_0x31c5ca['error'](0x1f4,_0x3adddd['message']));});});};exports[_0x2996('0x1d')]=function(_0xbfcf64){var _0x3b6503=this;return new Promise(function(_0x165d39,_0x27ed0d){return db[_0x2996('0x12')][_0x2996('0x1e')]({'raw':_0xbfcf64[_0x2996('0x14')]?_0xbfcf64['options'][_0x2996('0x15')]===undefined?!![]:![]:!![],'where':_0xbfcf64[_0x2996('0x14')]?_0xbfcf64['options'][_0x2996('0x16')]||null:null,'attributes':_0xbfcf64['options']?_0xbfcf64[_0x2996('0x14')][_0x2996('0x1b')]||null:null,'include':_0xbfcf64[_0x2996('0x14')]?_0xbfcf64['options']['include']?_[_0x2996('0x18')](_0xbfcf64['options'][_0x2996('0x19')],function(_0x200aff){return{'model':db[_0x200aff['model']],'as':_0x200aff['as'],'attributes':_0x200aff[_0x2996('0x1b')],'include':_0x200aff[_0x2996('0x19')]?_[_0x2996('0x18')](_0x200aff[_0x2996('0x19')],function(_0x33c6a1){return{'model':db[_0x33c6a1[_0x2996('0x1a')]],'as':_0x33c6a1['as'],'attributes':_0x33c6a1['attributes'],'include':_0x33c6a1['include']?_[_0x2996('0x18')](_0x33c6a1[_0x2996('0x19')],function(_0x2b1c3b){return{'model':db[_0x2b1c3b[_0x2996('0x1a')]],'as':_0x2b1c3b['as'],'attributes':_0x2b1c3b[_0x2996('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x2996('0x9')](function(_0x50d873){logger[_0x2996('0xa')](_0x2996('0x1d'),_0xbfcf64);logger['debug']('ShowZohoAccount',_0xbfcf64,JSON[_0x2996('0xe')](_0x50d873));_0x165d39(_0x50d873);})[_0x2996('0x1f')](function(_0x506f83){logger[_0x2996('0xf')](_0x2996('0x1d'),_0x506f83[_0x2996('0x10')],_0xbfcf64);_0x27ed0d(_0x3b6503[_0x2996('0xf')](0x1f4,_0x506f83[_0x2996('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 1cb24fa..1b09eb4 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 _0xf97e=['Router','fs-extra','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','multer','util','path','express'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xf97e,0xb0));var _0xef97=function(_0x1e40e9,_0x16cc7a){_0x1e40e9=_0x1e40e9-0x0;var _0x3d3cbc=_0xf97e[_0x1e40e9];return _0x3d3cbc;};'use strict';var multer=require(_0xef97('0x0'));var util=require(_0xef97('0x1'));var path=require(_0xef97('0x2'));var timeout=require('connect-timeout');var express=require(_0xef97('0x3'));var router=express[_0xef97('0x4')]();var fs_extra=require(_0xef97('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xef97('0x6'));var config=require(_0xef97('0x7'));var controller=require('./intZohoConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xef97('0x8')]);router[_0xef97('0x9')](_0xef97('0xa'),auth[_0xef97('0xb')](),controller['show']);router[_0xef97('0x9')]('/:id/fields',auth[_0xef97('0xb')](),controller['getFields']);router[_0xef97('0x9')](_0xef97('0xc'),auth[_0xef97('0xb')](),controller[_0xef97('0xd')]);router[_0xef97('0x9')](_0xef97('0xe'),auth[_0xef97('0xb')](),controller[_0xef97('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xef97('0x10')]);router[_0xef97('0x11')]('/:id',auth[_0xef97('0xb')](),controller['update']);router['delete'](_0xef97('0xa'),auth[_0xef97('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x544d=['getDescriptions','post','put','update','delete','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x167da1,_0x5e0ba2){var _0x438896=function(_0x59e9d2){while(--_0x59e9d2){_0x167da1['push'](_0x167da1['shift']());}};_0x438896(++_0x5e0ba2);}(_0x544d,0x156));var _0xd544=function(_0x3c098d,_0x5b72c6){_0x3c098d=_0x3c098d-0x0;var _0x4681a2=_0x544d[_0x3c098d];return _0x4681a2;};'use strict';var multer=require(_0xd544('0x0'));var util=require('util');var path=require(_0xd544('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd544('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xd544('0x3'));var interaction=require(_0xd544('0x4'));var config=require(_0xd544('0x5'));var controller=require(_0xd544('0x6'));router[_0xd544('0x7')]('/',auth[_0xd544('0x8')](),controller['index']);router[_0xd544('0x7')](_0xd544('0x9'),auth[_0xd544('0x8')](),controller['show']);router['get'](_0xd544('0xa'),auth['isAuthenticated'](),controller[_0xd544('0xb')]);router[_0xd544('0x7')](_0xd544('0xc'),auth[_0xd544('0x8')](),controller[_0xd544('0xd')]);router['get'](_0xd544('0xe'),auth[_0xd544('0x8')](),controller[_0xd544('0xf')]);router[_0xd544('0x10')]('/',auth[_0xd544('0x8')](),controller['create']);router[_0xd544('0x11')](_0xd544('0x9'),auth['isAuthenticated'](),controller[_0xd544('0x12')]);router[_0xd544('0x13')](_0xd544('0x9'),auth[_0xd544('0x8')](),controller['destroy']);module[_0xd544('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 62c1c5d..146e6a7 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 _0x57c9=['lead','contact','contact_lead','sequelize','STRING'];(function(_0x39ea70,_0x34eeb4){var _0x79ae34=function(_0x5a1a3b){while(--_0x5a1a3b){_0x39ea70['push'](_0x39ea70['shift']());}};_0x79ae34(++_0x34eeb4);}(_0x57c9,0xee));var _0x957c=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x57c9[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0x957c('0x0'));module['exports']={'name':{'type':Sequelize[_0x957c('0x1')]},'moduleCreate':{'type':Sequelize['ENUM'](_0x957c('0x2'),_0x957c('0x3'),'nothing'),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize['ENUM'](_0x957c('0x4'),_0x957c('0x3'),_0x957c('0x2')),'defaultValue':_0x957c('0x4')},'description':{'type':Sequelize[_0x957c('0x1')]}}; \ No newline at end of file +var _0x8417=['sequelize','exports','STRING','ENUM','lead','contact','nothing','contact_lead'];(function(_0x4c9380,_0x2fefc0){var _0x49a523=function(_0x165e85){while(--_0x165e85){_0x4c9380['push'](_0x4c9380['shift']());}};_0x49a523(++_0x2fefc0);}(_0x8417,0x1d8));var _0x7841=function(_0x1044da,_0xc0e279){_0x1044da=_0x1044da-0x0;var _0x131681=_0x8417[_0x1044da];return _0x131681;};'use strict';var Sequelize=require(_0x7841('0x0'));module[_0x7841('0x1')]={'name':{'type':Sequelize[_0x7841('0x2')]},'moduleCreate':{'type':Sequelize[_0x7841('0x3')](_0x7841('0x4'),_0x7841('0x5'),_0x7841('0x6')),'defaultValue':_0x7841('0x4')},'moduleSearch':{'type':Sequelize[_0x7841('0x3')]('contact_lead',_0x7841('0x5'),_0x7841('0x4')),'defaultValue':_0x7841('0x7')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 600248e..374225c 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 _0x3d88=['findOne','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','update','then','error','stack','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','length','find','create','body','params','getFields','ZohoField','pick'];(function(_0x2e1a7e,_0x3fdc3b){var _0x212930=function(_0x2e469a){while(--_0x2e469a){_0x2e1a7e['push'](_0x2e1a7e['shift']());}};_0x212930(++_0x3fdc3b);}(_0x3d88,0x193));var _0x83d8=function(_0x194bd6,_0x65f32b){_0x194bd6=_0x194bd6-0x0;var _0x37eb8f=_0x3d88[_0x194bd6];return _0x37eb8f;};'use strict';var emlformat=require(_0x83d8('0x0'));var rimraf=require(_0x83d8('0x1'));var zipdir=require(_0x83d8('0x2'));var jsonpatch=require(_0x83d8('0x3'));var rp=require('request-promise');var moment=require(_0x83d8('0x4'));var BPromise=require(_0x83d8('0x5'));var Mustache=require(_0x83d8('0x6'));var util=require(_0x83d8('0x7'));var path=require(_0x83d8('0x8'));var sox=require(_0x83d8('0x9'));var csv=require('to-csv');var ejs=require(_0x83d8('0xa'));var fs=require('fs');var fs_extra=require(_0x83d8('0xb'));var _=require('lodash');var squel=require(_0x83d8('0xc'));var crypto=require(_0x83d8('0xd'));var jsforce=require(_0x83d8('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x83d8('0xf'));var querystring=require(_0x83d8('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x83d8('0x11'));var qs=require(_0x83d8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x83d8('0x13'))(_0x83d8('0x14'));var utils=require(_0x83d8('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x83d8('0x16'));var db=require(_0x83d8('0x17'))['db'];function respondWithStatusCode(_0x59ca19,_0x4b1bb8){_0x4b1bb8=_0x4b1bb8||0xcc;return function(_0xcf1c83){if(_0xcf1c83){return _0x59ca19[_0x83d8('0x18')](_0x4b1bb8);}return _0x59ca19[_0x83d8('0x19')](_0x4b1bb8)[_0x83d8('0x1a')]();};}function respondWithResult(_0x5ee687,_0x5e9702){_0x5e9702=_0x5e9702||0xc8;return function(_0x42831c){if(_0x42831c){return _0x5ee687[_0x83d8('0x19')](_0x5e9702)[_0x83d8('0x1b')](_0x42831c);}};}function respondWithFilteredResult(_0x1bbb43,_0x25d290){return function(_0x5c1759){if(_0x5c1759){var _0x198e65=typeof _0x25d290[_0x83d8('0x1c')]==='undefined'&&typeof _0x25d290[_0x83d8('0x1d')]===_0x83d8('0x1e');var _0x2307aa=_0x5c1759[_0x83d8('0x1f')];var _0x5a0e09=_0x198e65?0x0:_0x25d290[_0x83d8('0x1c')];var _0x78f824=_0x198e65?_0x5c1759[_0x83d8('0x1f')]:_0x25d290[_0x83d8('0x1c')]+_0x25d290[_0x83d8('0x1d')];var _0x33cc52;if(_0x78f824>=_0x2307aa){_0x78f824=_0x2307aa;_0x33cc52=0xc8;}else{_0x33cc52=0xce;}_0x1bbb43[_0x83d8('0x19')](_0x33cc52);return _0x1bbb43[_0x83d8('0x20')](_0x83d8('0x21'),_0x5a0e09+'-'+_0x78f824+'/'+_0x2307aa)[_0x83d8('0x1b')](_0x5c1759);}return null;};}function patchUpdates(_0x2dc18e){return function(_0x279148){try{jsonpatch[_0x83d8('0x22')](_0x279148,_0x2dc18e,!![]);}catch(_0x40ae24){return BPromise['reject'](_0x40ae24);}return _0x279148['save']();};}function saveUpdates(_0x3398de,_0x43d0ea){return function(_0x1b2089){if(_0x1b2089){return _0x1b2089[_0x83d8('0x23')](_0x3398de)['then'](function(_0x152bc1){return _0x152bc1;});}return null;};}function removeEntity(_0x54a1b8,_0x47b446){return function(_0x2baaab){if(_0x2baaab){return _0x2baaab['destroy']()[_0x83d8('0x24')](function(){_0x54a1b8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4bc8bd,_0x1ff9af){return function(_0x23eaff){if(!_0x23eaff){_0x4bc8bd[_0x83d8('0x18')](0x194);}return _0x23eaff;};}function handleError(_0x4c8467,_0x8a1026){_0x8a1026=_0x8a1026||0x1f4;return function(_0xcaab46){logger[_0x83d8('0x25')](_0xcaab46[_0x83d8('0x26')]);if(_0xcaab46[_0x83d8('0x27')]){delete _0xcaab46[_0x83d8('0x27')];}_0x4c8467['status'](_0x8a1026)[_0x83d8('0x28')](_0xcaab46);};}exports[_0x83d8('0x29')]=function(_0x59f60a,_0x43d1b0){var _0x41db68={},_0x50545d={},_0x29c055={'count':0x0,'rows':[]};var _0x14bf2a=_[_0x83d8('0x2a')](db[_0x83d8('0x2b')][_0x83d8('0x2c')],function(_0x674360){return{'name':_0x674360[_0x83d8('0x2d')],'type':_0x674360[_0x83d8('0x2e')][_0x83d8('0x2f')]};});_0x50545d[_0x83d8('0x30')]=_[_0x83d8('0x2a')](_0x14bf2a,'name');_0x50545d[_0x83d8('0x31')]=_[_0x83d8('0x32')](_0x59f60a[_0x83d8('0x31')]);_0x50545d[_0x83d8('0x33')]=_[_0x83d8('0x34')](_0x50545d[_0x83d8('0x30')],_0x50545d['query']);_0x41db68['attributes']=_[_0x83d8('0x34')](_0x50545d[_0x83d8('0x30')],qs['fields'](_0x59f60a[_0x83d8('0x31')][_0x83d8('0x35')]));_0x41db68[_0x83d8('0x36')]=_0x41db68[_0x83d8('0x36')]['length']?_0x41db68[_0x83d8('0x36')]:_0x50545d['model'];if(!_0x59f60a['query'][_0x83d8('0x37')](_0x83d8('0x38'))){_0x41db68[_0x83d8('0x1d')]=qs[_0x83d8('0x1d')](_0x59f60a[_0x83d8('0x31')][_0x83d8('0x1d')]);_0x41db68[_0x83d8('0x1c')]=qs[_0x83d8('0x1c')](_0x59f60a[_0x83d8('0x31')][_0x83d8('0x1c')]);}_0x41db68[_0x83d8('0x39')]=qs[_0x83d8('0x3a')](_0x59f60a['query']['sort']);_0x41db68['where']=qs[_0x83d8('0x33')](_['pick'](_0x59f60a[_0x83d8('0x31')],_0x50545d[_0x83d8('0x33')]),_0x14bf2a);if(_0x59f60a['query'][_0x83d8('0x3b')]){_0x41db68[_0x83d8('0x3c')]=_[_0x83d8('0x3d')](_0x41db68[_0x83d8('0x3c')],{'$or':_[_0x83d8('0x2a')](_0x14bf2a,function(_0x264c05){if(_0x264c05['type']!==_0x83d8('0x3e')){var _0xe48d56={};_0xe48d56[_0x264c05['name']]={'$like':'%'+_0x59f60a[_0x83d8('0x31')]['filter']+'%'};return _0xe48d56;}})});}_0x41db68=_[_0x83d8('0x3d')]({},_0x41db68,_0x59f60a[_0x83d8('0x3f')]);var _0x16717e={'where':_0x41db68[_0x83d8('0x3c')]};return db['ZohoConfiguration'][_0x83d8('0x1f')](_0x16717e)[_0x83d8('0x24')](function(_0x3b6cac){_0x29c055[_0x83d8('0x1f')]=_0x3b6cac;if(_0x59f60a['query'][_0x83d8('0x40')]){_0x41db68[_0x83d8('0x41')]=[{'all':!![]}];}return db[_0x83d8('0x2b')][_0x83d8('0x42')](_0x41db68);})['then'](function(_0xa4584e){_0x29c055[_0x83d8('0x43')]=_0xa4584e;return _0x29c055;})[_0x83d8('0x24')](respondWithFilteredResult(_0x43d1b0,_0x41db68))[_0x83d8('0x44')](handleError(_0x43d1b0,null));};exports['show']=function(_0x2af8fa,_0x3f0345){var _0x41b993={'raw':![],'where':{'id':_0x2af8fa['params']['id']}},_0x4d6b73={};_0x4d6b73[_0x83d8('0x30')]=_[_0x83d8('0x32')](db['ZohoConfiguration'][_0x83d8('0x2c')]);_0x4d6b73[_0x83d8('0x31')]=_['keys'](_0x2af8fa['query']);_0x4d6b73[_0x83d8('0x33')]=_[_0x83d8('0x34')](_0x4d6b73[_0x83d8('0x30')],_0x4d6b73[_0x83d8('0x31')]);_0x41b993['attributes']=_['intersection'](_0x4d6b73[_0x83d8('0x30')],qs[_0x83d8('0x35')](_0x2af8fa['query'][_0x83d8('0x35')]));_0x41b993[_0x83d8('0x36')]=_0x41b993[_0x83d8('0x36')][_0x83d8('0x45')]?_0x41b993['attributes']:_0x4d6b73[_0x83d8('0x30')];if(_0x2af8fa[_0x83d8('0x31')]['includeAll']){_0x41b993[_0x83d8('0x41')]=[{'all':!![]}];}_0x41b993=_[_0x83d8('0x3d')]({},_0x41b993,_0x2af8fa[_0x83d8('0x3f')]);return db[_0x83d8('0x2b')][_0x83d8('0x46')](_0x41b993)[_0x83d8('0x24')](handleEntityNotFound(_0x3f0345,null))[_0x83d8('0x24')](respondWithResult(_0x3f0345,null))['catch'](handleError(_0x3f0345,null));};exports[_0x83d8('0x47')]=function(_0x43b9e2,_0x9b69e6){return db[_0x83d8('0x2b')][_0x83d8('0x47')](_0x43b9e2[_0x83d8('0x48')],{})['then'](respondWithResult(_0x9b69e6,0xc9))[_0x83d8('0x44')](handleError(_0x9b69e6,null));};exports[_0x83d8('0x23')]=function(_0x333e5f,_0x328488){if(_0x333e5f[_0x83d8('0x48')]['id']){delete _0x333e5f['body']['id'];}return db[_0x83d8('0x2b')][_0x83d8('0x46')]({'where':{'id':_0x333e5f[_0x83d8('0x49')]['id']}})[_0x83d8('0x24')](handleEntityNotFound(_0x328488,null))[_0x83d8('0x24')](saveUpdates(_0x333e5f[_0x83d8('0x48')],null))[_0x83d8('0x24')](respondWithResult(_0x328488,null))[_0x83d8('0x44')](handleError(_0x328488,null));};exports['destroy']=function(_0x266501,_0x751825){return db[_0x83d8('0x2b')]['find']({'where':{'id':_0x266501[_0x83d8('0x49')]['id']}})[_0x83d8('0x24')](handleEntityNotFound(_0x751825,null))[_0x83d8('0x24')](removeEntity(_0x751825,null))[_0x83d8('0x44')](handleError(_0x751825,null));};exports[_0x83d8('0x4a')]=function(_0x5b7165,_0x216caf,_0x34f626){var _0x19f7c0={};var _0x1c20d2={};var _0x5079bb;var _0x7e8854;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x5b7165['params']['id']}})[_0x83d8('0x24')](handleEntityNotFound(_0x216caf,null))['then'](function(_0x1af476){if(_0x1af476){_0x5079bb=_0x1af476;_0x1c20d2[_0x83d8('0x30')]=_[_0x83d8('0x32')](db[_0x83d8('0x4b')][_0x83d8('0x2c')]);_0x1c20d2[_0x83d8('0x31')]=_[_0x83d8('0x32')](_0x5b7165['query']);_0x1c20d2['filters']=_['intersection'](_0x1c20d2['model'],_0x1c20d2['query']);_0x19f7c0['attributes']=_[_0x83d8('0x34')](_0x1c20d2[_0x83d8('0x30')],qs['fields'](_0x5b7165['query'][_0x83d8('0x35')]));_0x19f7c0[_0x83d8('0x36')]=_0x19f7c0['attributes'][_0x83d8('0x45')]?_0x19f7c0[_0x83d8('0x36')]:_0x1c20d2[_0x83d8('0x30')];_0x19f7c0[_0x83d8('0x39')]=qs[_0x83d8('0x3a')](_0x5b7165[_0x83d8('0x31')]['sort']);_0x19f7c0[_0x83d8('0x3c')]=qs[_0x83d8('0x33')](_[_0x83d8('0x4c')](_0x5b7165[_0x83d8('0x31')],_0x1c20d2[_0x83d8('0x33')]));if(_0x5b7165[_0x83d8('0x31')]['filter']){_0x19f7c0[_0x83d8('0x3c')]=_[_0x83d8('0x3d')](_0x19f7c0[_0x83d8('0x3c')],{'$or':_[_0x83d8('0x2a')](_0x19f7c0[_0x83d8('0x36')],function(_0x19fab7){var _0x1928f0={};_0x1928f0[_0x19fab7]={'$like':'%'+_0x5b7165[_0x83d8('0x31')][_0x83d8('0x3b')]+'%'};return _0x1928f0;})});}_0x19f7c0=_['merge']({},_0x19f7c0,_0x5b7165['options']);return _0x5079bb[_0x83d8('0x4a')](_0x19f7c0);}})['then'](function(_0x584f42){if(_0x584f42){_0x7e8854=_0x584f42[_0x83d8('0x45')];if(!_0x5b7165[_0x83d8('0x31')][_0x83d8('0x37')](_0x83d8('0x38'))){_0x19f7c0[_0x83d8('0x1d')]=qs[_0x83d8('0x1d')](_0x5b7165[_0x83d8('0x31')][_0x83d8('0x1d')]);_0x19f7c0['offset']=qs[_0x83d8('0x1c')](_0x5b7165[_0x83d8('0x31')][_0x83d8('0x1c')]);}return _0x5079bb['getFields'](_0x19f7c0);}})[_0x83d8('0x24')](function(_0x370419){if(_0x370419){return _0x370419?{'count':_0x7e8854,'rows':_0x370419}:null;}})[_0x83d8('0x24')](respondWithResult(_0x216caf,null))[_0x83d8('0x44')](handleError(_0x216caf,null));};exports['getSubjects']=function(_0x1f5e0e,_0x151ef3,_0x488d6b){var _0x1aa91a={};var _0x5e7dd9={};var _0x5c4fcc;var _0x3844fd;return db[_0x83d8('0x2b')][_0x83d8('0x4d')]({'where':{'id':_0x1f5e0e['params']['id']}})[_0x83d8('0x24')](handleEntityNotFound(_0x151ef3,null))['then'](function(_0x5b482b){if(_0x5b482b){_0x5c4fcc=_0x5b482b;_0x5e7dd9[_0x83d8('0x30')]=_['keys'](db[_0x83d8('0x4b')][_0x83d8('0x2c')]);_0x5e7dd9['query']=_['keys'](_0x1f5e0e['query']);_0x5e7dd9[_0x83d8('0x33')]=_[_0x83d8('0x34')](_0x5e7dd9[_0x83d8('0x30')],_0x5e7dd9[_0x83d8('0x31')]);_0x1aa91a[_0x83d8('0x36')]=_[_0x83d8('0x34')](_0x5e7dd9[_0x83d8('0x30')],qs['fields'](_0x1f5e0e[_0x83d8('0x31')]['fields']));_0x1aa91a[_0x83d8('0x36')]=_0x1aa91a[_0x83d8('0x36')][_0x83d8('0x45')]?_0x1aa91a['attributes']:_0x5e7dd9[_0x83d8('0x30')];_0x1aa91a[_0x83d8('0x39')]=qs['sort'](_0x1f5e0e[_0x83d8('0x31')]['sort']);_0x1aa91a['where']=qs['filters'](_[_0x83d8('0x4c')](_0x1f5e0e['query'],_0x5e7dd9['filters']));if(_0x1f5e0e[_0x83d8('0x31')]['filter']){_0x1aa91a[_0x83d8('0x3c')]=_[_0x83d8('0x3d')](_0x1aa91a[_0x83d8('0x3c')],{'$or':_[_0x83d8('0x2a')](_0x1aa91a[_0x83d8('0x36')],function(_0x303ef7){var _0x4496e4={};_0x4496e4[_0x303ef7]={'$like':'%'+_0x1f5e0e[_0x83d8('0x31')][_0x83d8('0x3b')]+'%'};return _0x4496e4;})});}_0x1aa91a=_[_0x83d8('0x3d')]({},_0x1aa91a,_0x1f5e0e[_0x83d8('0x3f')]);return _0x5c4fcc['getSubjects'](_0x1aa91a);}})[_0x83d8('0x24')](function(_0x28844b){if(_0x28844b){_0x3844fd=_0x28844b[_0x83d8('0x45')];if(!_0x1f5e0e['query']['hasOwnProperty'](_0x83d8('0x38'))){_0x1aa91a[_0x83d8('0x1d')]=qs[_0x83d8('0x1d')](_0x1f5e0e[_0x83d8('0x31')][_0x83d8('0x1d')]);_0x1aa91a[_0x83d8('0x1c')]=qs[_0x83d8('0x1c')](_0x1f5e0e[_0x83d8('0x31')][_0x83d8('0x1c')]);}return _0x5c4fcc[_0x83d8('0x4e')](_0x1aa91a);}})[_0x83d8('0x24')](function(_0x47435a){if(_0x47435a){return _0x47435a?{'count':_0x3844fd,'rows':_0x47435a}:null;}})[_0x83d8('0x24')](respondWithResult(_0x151ef3,null))[_0x83d8('0x44')](handleError(_0x151ef3,null));};exports[_0x83d8('0x4f')]=function(_0x35246a,_0x2ec332,_0x174db7){var _0x180bf1={};var _0x2e80bb={};var _0x2558fa;var _0xb3113b;return db['ZohoConfiguration'][_0x83d8('0x4d')]({'where':{'id':_0x35246a[_0x83d8('0x49')]['id']}})[_0x83d8('0x24')](handleEntityNotFound(_0x2ec332,null))[_0x83d8('0x24')](function(_0x1f6392){if(_0x1f6392){_0x2558fa=_0x1f6392;_0x2e80bb[_0x83d8('0x30')]=_[_0x83d8('0x32')](db[_0x83d8('0x4b')]['rawAttributes']);_0x2e80bb[_0x83d8('0x31')]=_[_0x83d8('0x32')](_0x35246a[_0x83d8('0x31')]);_0x2e80bb[_0x83d8('0x33')]=_[_0x83d8('0x34')](_0x2e80bb['model'],_0x2e80bb[_0x83d8('0x31')]);_0x180bf1[_0x83d8('0x36')]=_[_0x83d8('0x34')](_0x2e80bb['model'],qs[_0x83d8('0x35')](_0x35246a['query']['fields']));_0x180bf1[_0x83d8('0x36')]=_0x180bf1[_0x83d8('0x36')][_0x83d8('0x45')]?_0x180bf1[_0x83d8('0x36')]:_0x2e80bb[_0x83d8('0x30')];_0x180bf1[_0x83d8('0x39')]=qs['sort'](_0x35246a[_0x83d8('0x31')][_0x83d8('0x3a')]);_0x180bf1[_0x83d8('0x3c')]=qs[_0x83d8('0x33')](_['pick'](_0x35246a[_0x83d8('0x31')],_0x2e80bb['filters']));if(_0x35246a[_0x83d8('0x31')][_0x83d8('0x3b')]){_0x180bf1[_0x83d8('0x3c')]=_[_0x83d8('0x3d')](_0x180bf1[_0x83d8('0x3c')],{'$or':_['map'](_0x180bf1[_0x83d8('0x36')],function(_0x5bc5f7){var _0x2b324c={};_0x2b324c[_0x5bc5f7]={'$like':'%'+_0x35246a[_0x83d8('0x31')][_0x83d8('0x3b')]+'%'};return _0x2b324c;})});}_0x180bf1=_[_0x83d8('0x3d')]({},_0x180bf1,_0x35246a[_0x83d8('0x3f')]);return _0x2558fa[_0x83d8('0x4f')](_0x180bf1);}})['then'](function(_0x403509){if(_0x403509){_0xb3113b=_0x403509['length'];if(!_0x35246a[_0x83d8('0x31')][_0x83d8('0x37')](_0x83d8('0x38'))){_0x180bf1[_0x83d8('0x1d')]=qs[_0x83d8('0x1d')](_0x35246a[_0x83d8('0x31')][_0x83d8('0x1d')]);_0x180bf1['offset']=qs[_0x83d8('0x1c')](_0x35246a[_0x83d8('0x31')]['offset']);}return _0x2558fa[_0x83d8('0x4f')](_0x180bf1);}})[_0x83d8('0x24')](function(_0x24812b){if(_0x24812b){return _0x24812b?{'count':_0xb3113b,'rows':_0x24812b}:null;}})['then'](respondWithResult(_0x2ec332,null))[_0x83d8('0x44')](handleError(_0x2ec332,null));}; \ No newline at end of file +var _0xcc58=['rows','catch','params','keys','merge','create','body','find','getFields','ZohoField','order','getSubjects','getDescriptions','findOne','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','sendStatus','error','stack','name','send','index','map','ZohoConfiguration','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','then','includeAll','include','findAll'];(function(_0x3f2c4d,_0x55c45d){var _0x124d2f=function(_0x32eb98){while(--_0x32eb98){_0x3f2c4d['push'](_0x3f2c4d['shift']());}};_0x124d2f(++_0x55c45d);}(_0xcc58,0x199));var _0x8cc5=function(_0x5d54c7,_0x11500e){_0x5d54c7=_0x5d54c7-0x0;var _0x30863d=_0xcc58[_0x5d54c7];return _0x30863d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8cc5('0x0'));var zipdir=require(_0x8cc5('0x1'));var jsonpatch=require(_0x8cc5('0x2'));var rp=require(_0x8cc5('0x3'));var moment=require('moment');var BPromise=require(_0x8cc5('0x4'));var Mustache=require('mustache');var util=require(_0x8cc5('0x5'));var path=require(_0x8cc5('0x6'));var sox=require(_0x8cc5('0x7'));var csv=require(_0x8cc5('0x8'));var ejs=require(_0x8cc5('0x9'));var fs=require('fs');var fs_extra=require(_0x8cc5('0xa'));var _=require('lodash');var squel=require(_0x8cc5('0xb'));var crypto=require(_0x8cc5('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8cc5('0x8'));var querystring=require('querystring');var Papa=require(_0x8cc5('0xd'));var Redis=require('ioredis');var authService=require(_0x8cc5('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8cc5('0xf'));var logger=require(_0x8cc5('0x10'))(_0x8cc5('0x11'));var utils=require(_0x8cc5('0x12'));var config=require(_0x8cc5('0x13'));var licenseUtil=require(_0x8cc5('0x14'));var db=require(_0x8cc5('0x15'))['db'];function respondWithStatusCode(_0x256d4d,_0x65422a){_0x65422a=_0x65422a||0xcc;return function(_0x403c9d){if(_0x403c9d){return _0x256d4d['sendStatus'](_0x65422a);}return _0x256d4d[_0x8cc5('0x16')](_0x65422a)[_0x8cc5('0x17')]();};}function respondWithResult(_0x5deb9a,_0x109826){_0x109826=_0x109826||0xc8;return function(_0x437868){if(_0x437868){return _0x5deb9a[_0x8cc5('0x16')](_0x109826)[_0x8cc5('0x18')](_0x437868);}};}function respondWithFilteredResult(_0x30b684,_0x21a6a4){return function(_0xce4cf8){if(_0xce4cf8){var _0x4fdb6c=typeof _0x21a6a4[_0x8cc5('0x19')]===_0x8cc5('0x1a')&&typeof _0x21a6a4[_0x8cc5('0x1b')]===_0x8cc5('0x1a');var _0x26f5b1=_0xce4cf8['count'];var _0x26949b=_0x4fdb6c?0x0:_0x21a6a4[_0x8cc5('0x19')];var _0x349b66=_0x4fdb6c?_0xce4cf8[_0x8cc5('0x1c')]:_0x21a6a4[_0x8cc5('0x19')]+_0x21a6a4[_0x8cc5('0x1b')];var _0x3bd315;if(_0x349b66>=_0x26f5b1){_0x349b66=_0x26f5b1;_0x3bd315=0xc8;}else{_0x3bd315=0xce;}_0x30b684[_0x8cc5('0x16')](_0x3bd315);return _0x30b684[_0x8cc5('0x1d')](_0x8cc5('0x1e'),_0x26949b+'-'+_0x349b66+'/'+_0x26f5b1)[_0x8cc5('0x18')](_0xce4cf8);}return null;};}function patchUpdates(_0x33d717){return function(_0x598349){try{jsonpatch[_0x8cc5('0x1f')](_0x598349,_0x33d717,!![]);}catch(_0xebc134){return BPromise[_0x8cc5('0x20')](_0xebc134);}return _0x598349['save']();};}function saveUpdates(_0x5e94e3,_0x223fb4){return function(_0x10b65c){if(_0x10b65c){return _0x10b65c[_0x8cc5('0x21')](_0x5e94e3)['then'](function(_0x2fa629){return _0x2fa629;});}return null;};}function removeEntity(_0x367fde,_0x6101ff){return function(_0x57fda0){if(_0x57fda0){return _0x57fda0[_0x8cc5('0x22')]()['then'](function(){_0x367fde[_0x8cc5('0x16')](0xcc)[_0x8cc5('0x17')]();});}};}function handleEntityNotFound(_0x1c028d,_0x1badf6){return function(_0x263b85){if(!_0x263b85){_0x1c028d[_0x8cc5('0x23')](0x194);}return _0x263b85;};}function handleError(_0x6160ed,_0x55b3b8){_0x55b3b8=_0x55b3b8||0x1f4;return function(_0x16b8a9){logger[_0x8cc5('0x24')](_0x16b8a9[_0x8cc5('0x25')]);if(_0x16b8a9[_0x8cc5('0x26')]){delete _0x16b8a9[_0x8cc5('0x26')];}_0x6160ed[_0x8cc5('0x16')](_0x55b3b8)[_0x8cc5('0x27')](_0x16b8a9);};}exports[_0x8cc5('0x28')]=function(_0x1e2132,_0x1e5858){var _0x2c3148={},_0x35b26f={},_0x26984f={'count':0x0,'rows':[]};var _0x305aef=_[_0x8cc5('0x29')](db[_0x8cc5('0x2a')][_0x8cc5('0x2b')],function(_0x1d5b89){return{'name':_0x1d5b89['fieldName'],'type':_0x1d5b89[_0x8cc5('0x2c')][_0x8cc5('0x2d')]};});_0x35b26f[_0x8cc5('0x2e')]=_[_0x8cc5('0x29')](_0x305aef,_0x8cc5('0x26'));_0x35b26f[_0x8cc5('0x2f')]=_['keys'](_0x1e2132[_0x8cc5('0x2f')]);_0x35b26f[_0x8cc5('0x30')]=_[_0x8cc5('0x31')](_0x35b26f[_0x8cc5('0x2e')],_0x35b26f[_0x8cc5('0x2f')]);_0x2c3148[_0x8cc5('0x32')]=_[_0x8cc5('0x31')](_0x35b26f[_0x8cc5('0x2e')],qs[_0x8cc5('0x33')](_0x1e2132[_0x8cc5('0x2f')][_0x8cc5('0x33')]));_0x2c3148['attributes']=_0x2c3148[_0x8cc5('0x32')][_0x8cc5('0x34')]?_0x2c3148[_0x8cc5('0x32')]:_0x35b26f[_0x8cc5('0x2e')];if(!_0x1e2132['query'][_0x8cc5('0x35')](_0x8cc5('0x36'))){_0x2c3148[_0x8cc5('0x1b')]=qs['limit'](_0x1e2132[_0x8cc5('0x2f')][_0x8cc5('0x1b')]);_0x2c3148[_0x8cc5('0x19')]=qs[_0x8cc5('0x19')](_0x1e2132['query'][_0x8cc5('0x19')]);}_0x2c3148['order']=qs[_0x8cc5('0x37')](_0x1e2132[_0x8cc5('0x2f')]['sort']);_0x2c3148[_0x8cc5('0x38')]=qs[_0x8cc5('0x30')](_[_0x8cc5('0x39')](_0x1e2132['query'],_0x35b26f[_0x8cc5('0x30')]),_0x305aef);if(_0x1e2132[_0x8cc5('0x2f')][_0x8cc5('0x3a')]){_0x2c3148[_0x8cc5('0x38')]=_['merge'](_0x2c3148[_0x8cc5('0x38')],{'$or':_['map'](_0x305aef,function(_0x4365d8){if(_0x4365d8[_0x8cc5('0x2c')]!==_0x8cc5('0x3b')){var _0x2a7003={};_0x2a7003[_0x4365d8[_0x8cc5('0x26')]]={'$like':'%'+_0x1e2132['query'][_0x8cc5('0x3a')]+'%'};return _0x2a7003;}})});}_0x2c3148=_['merge']({},_0x2c3148,_0x1e2132[_0x8cc5('0x3c')]);var _0x4e90bc={'where':_0x2c3148[_0x8cc5('0x38')]};return db[_0x8cc5('0x2a')][_0x8cc5('0x1c')](_0x4e90bc)[_0x8cc5('0x3d')](function(_0x333a48){_0x26984f['count']=_0x333a48;if(_0x1e2132[_0x8cc5('0x2f')][_0x8cc5('0x3e')]){_0x2c3148[_0x8cc5('0x3f')]=[{'all':!![]}];}return db[_0x8cc5('0x2a')][_0x8cc5('0x40')](_0x2c3148);})['then'](function(_0x1ca090){_0x26984f[_0x8cc5('0x41')]=_0x1ca090;return _0x26984f;})['then'](respondWithFilteredResult(_0x1e5858,_0x2c3148))[_0x8cc5('0x42')](handleError(_0x1e5858,null));};exports['show']=function(_0x22bf37,_0x39e519){var _0x6ca4e4={'raw':![],'where':{'id':_0x22bf37[_0x8cc5('0x43')]['id']}},_0x14700c={};_0x14700c[_0x8cc5('0x2e')]=_[_0x8cc5('0x44')](db[_0x8cc5('0x2a')][_0x8cc5('0x2b')]);_0x14700c[_0x8cc5('0x2f')]=_[_0x8cc5('0x44')](_0x22bf37[_0x8cc5('0x2f')]);_0x14700c[_0x8cc5('0x30')]=_[_0x8cc5('0x31')](_0x14700c[_0x8cc5('0x2e')],_0x14700c[_0x8cc5('0x2f')]);_0x6ca4e4[_0x8cc5('0x32')]=_[_0x8cc5('0x31')](_0x14700c[_0x8cc5('0x2e')],qs['fields'](_0x22bf37['query'][_0x8cc5('0x33')]));_0x6ca4e4[_0x8cc5('0x32')]=_0x6ca4e4[_0x8cc5('0x32')][_0x8cc5('0x34')]?_0x6ca4e4['attributes']:_0x14700c['model'];if(_0x22bf37['query']['includeAll']){_0x6ca4e4[_0x8cc5('0x3f')]=[{'all':!![]}];}_0x6ca4e4=_[_0x8cc5('0x45')]({},_0x6ca4e4,_0x22bf37[_0x8cc5('0x3c')]);return db[_0x8cc5('0x2a')]['find'](_0x6ca4e4)[_0x8cc5('0x3d')](handleEntityNotFound(_0x39e519,null))[_0x8cc5('0x3d')](respondWithResult(_0x39e519,null))[_0x8cc5('0x42')](handleError(_0x39e519,null));};exports[_0x8cc5('0x46')]=function(_0xc5161,_0x54d438){return db['ZohoConfiguration'][_0x8cc5('0x46')](_0xc5161['body'],{})[_0x8cc5('0x3d')](respondWithResult(_0x54d438,0xc9))['catch'](handleError(_0x54d438,null));};exports['update']=function(_0x43eddc,_0x5e597b){if(_0x43eddc[_0x8cc5('0x47')]['id']){delete _0x43eddc[_0x8cc5('0x47')]['id'];}return db['ZohoConfiguration'][_0x8cc5('0x48')]({'where':{'id':_0x43eddc[_0x8cc5('0x43')]['id']}})[_0x8cc5('0x3d')](handleEntityNotFound(_0x5e597b,null))['then'](saveUpdates(_0x43eddc[_0x8cc5('0x47')],null))[_0x8cc5('0x3d')](respondWithResult(_0x5e597b,null))[_0x8cc5('0x42')](handleError(_0x5e597b,null));};exports[_0x8cc5('0x22')]=function(_0xe7f6a3,_0x1db8e9){return db['ZohoConfiguration']['find']({'where':{'id':_0xe7f6a3[_0x8cc5('0x43')]['id']}})[_0x8cc5('0x3d')](handleEntityNotFound(_0x1db8e9,null))[_0x8cc5('0x3d')](removeEntity(_0x1db8e9,null))[_0x8cc5('0x42')](handleError(_0x1db8e9,null));};exports[_0x8cc5('0x49')]=function(_0x746ba6,_0x1c585e,_0x278502){var _0x3dce1d={};var _0x1094c1={};var _0x3ed9b9;var _0x292126;return db[_0x8cc5('0x2a')]['findOne']({'where':{'id':_0x746ba6[_0x8cc5('0x43')]['id']}})['then'](handleEntityNotFound(_0x1c585e,null))[_0x8cc5('0x3d')](function(_0x512d6a){if(_0x512d6a){_0x3ed9b9=_0x512d6a;_0x1094c1['model']=_['keys'](db[_0x8cc5('0x4a')][_0x8cc5('0x2b')]);_0x1094c1[_0x8cc5('0x2f')]=_[_0x8cc5('0x44')](_0x746ba6[_0x8cc5('0x2f')]);_0x1094c1[_0x8cc5('0x30')]=_[_0x8cc5('0x31')](_0x1094c1[_0x8cc5('0x2e')],_0x1094c1[_0x8cc5('0x2f')]);_0x3dce1d['attributes']=_[_0x8cc5('0x31')](_0x1094c1['model'],qs['fields'](_0x746ba6[_0x8cc5('0x2f')][_0x8cc5('0x33')]));_0x3dce1d[_0x8cc5('0x32')]=_0x3dce1d[_0x8cc5('0x32')][_0x8cc5('0x34')]?_0x3dce1d[_0x8cc5('0x32')]:_0x1094c1[_0x8cc5('0x2e')];_0x3dce1d[_0x8cc5('0x4b')]=qs[_0x8cc5('0x37')](_0x746ba6[_0x8cc5('0x2f')]['sort']);_0x3dce1d[_0x8cc5('0x38')]=qs['filters'](_[_0x8cc5('0x39')](_0x746ba6[_0x8cc5('0x2f')],_0x1094c1['filters']));if(_0x746ba6[_0x8cc5('0x2f')]['filter']){_0x3dce1d[_0x8cc5('0x38')]=_['merge'](_0x3dce1d[_0x8cc5('0x38')],{'$or':_[_0x8cc5('0x29')](_0x3dce1d[_0x8cc5('0x32')],function(_0x48a894){var _0x43b061={};_0x43b061[_0x48a894]={'$like':'%'+_0x746ba6['query']['filter']+'%'};return _0x43b061;})});}_0x3dce1d=_['merge']({},_0x3dce1d,_0x746ba6[_0x8cc5('0x3c')]);return _0x3ed9b9[_0x8cc5('0x49')](_0x3dce1d);}})[_0x8cc5('0x3d')](function(_0x41f214){if(_0x41f214){_0x292126=_0x41f214['length'];if(!_0x746ba6[_0x8cc5('0x2f')][_0x8cc5('0x35')](_0x8cc5('0x36'))){_0x3dce1d[_0x8cc5('0x1b')]=qs['limit'](_0x746ba6[_0x8cc5('0x2f')]['limit']);_0x3dce1d[_0x8cc5('0x19')]=qs[_0x8cc5('0x19')](_0x746ba6[_0x8cc5('0x2f')][_0x8cc5('0x19')]);}return _0x3ed9b9[_0x8cc5('0x49')](_0x3dce1d);}})[_0x8cc5('0x3d')](function(_0x79be98){if(_0x79be98){return _0x79be98?{'count':_0x292126,'rows':_0x79be98}:null;}})[_0x8cc5('0x3d')](respondWithResult(_0x1c585e,null))[_0x8cc5('0x42')](handleError(_0x1c585e,null));};exports['getSubjects']=function(_0x18958e,_0x18877a,_0x275dfd){var _0x1cbdc0={};var _0x52642f={};var _0x99fe69;var _0x560799;return db[_0x8cc5('0x2a')]['findOne']({'where':{'id':_0x18958e[_0x8cc5('0x43')]['id']}})[_0x8cc5('0x3d')](handleEntityNotFound(_0x18877a,null))[_0x8cc5('0x3d')](function(_0x57c9c9){if(_0x57c9c9){_0x99fe69=_0x57c9c9;_0x52642f[_0x8cc5('0x2e')]=_['keys'](db[_0x8cc5('0x4a')]['rawAttributes']);_0x52642f[_0x8cc5('0x2f')]=_['keys'](_0x18958e['query']);_0x52642f['filters']=_[_0x8cc5('0x31')](_0x52642f['model'],_0x52642f[_0x8cc5('0x2f')]);_0x1cbdc0[_0x8cc5('0x32')]=_[_0x8cc5('0x31')](_0x52642f[_0x8cc5('0x2e')],qs['fields'](_0x18958e['query'][_0x8cc5('0x33')]));_0x1cbdc0[_0x8cc5('0x32')]=_0x1cbdc0[_0x8cc5('0x32')][_0x8cc5('0x34')]?_0x1cbdc0['attributes']:_0x52642f[_0x8cc5('0x2e')];_0x1cbdc0['order']=qs['sort'](_0x18958e[_0x8cc5('0x2f')][_0x8cc5('0x37')]);_0x1cbdc0[_0x8cc5('0x38')]=qs['filters'](_[_0x8cc5('0x39')](_0x18958e[_0x8cc5('0x2f')],_0x52642f[_0x8cc5('0x30')]));if(_0x18958e[_0x8cc5('0x2f')][_0x8cc5('0x3a')]){_0x1cbdc0['where']=_[_0x8cc5('0x45')](_0x1cbdc0[_0x8cc5('0x38')],{'$or':_[_0x8cc5('0x29')](_0x1cbdc0[_0x8cc5('0x32')],function(_0x5407c6){var _0x587d2e={};_0x587d2e[_0x5407c6]={'$like':'%'+_0x18958e[_0x8cc5('0x2f')][_0x8cc5('0x3a')]+'%'};return _0x587d2e;})});}_0x1cbdc0=_['merge']({},_0x1cbdc0,_0x18958e['options']);return _0x99fe69['getSubjects'](_0x1cbdc0);}})[_0x8cc5('0x3d')](function(_0x3ea89a){if(_0x3ea89a){_0x560799=_0x3ea89a['length'];if(!_0x18958e['query']['hasOwnProperty'](_0x8cc5('0x36'))){_0x1cbdc0[_0x8cc5('0x1b')]=qs[_0x8cc5('0x1b')](_0x18958e['query']['limit']);_0x1cbdc0[_0x8cc5('0x19')]=qs[_0x8cc5('0x19')](_0x18958e['query'][_0x8cc5('0x19')]);}return _0x99fe69[_0x8cc5('0x4c')](_0x1cbdc0);}})[_0x8cc5('0x3d')](function(_0x3a2b2e){if(_0x3a2b2e){return _0x3a2b2e?{'count':_0x560799,'rows':_0x3a2b2e}:null;}})[_0x8cc5('0x3d')](respondWithResult(_0x18877a,null))[_0x8cc5('0x42')](handleError(_0x18877a,null));};exports[_0x8cc5('0x4d')]=function(_0x21e1bf,_0x1186f0,_0x556df3){var _0x477722={};var _0x2d9072={};var _0xe8ba9e;var _0x4ea328;return db[_0x8cc5('0x2a')][_0x8cc5('0x4e')]({'where':{'id':_0x21e1bf['params']['id']}})['then'](handleEntityNotFound(_0x1186f0,null))[_0x8cc5('0x3d')](function(_0x4132ab){if(_0x4132ab){_0xe8ba9e=_0x4132ab;_0x2d9072['model']=_[_0x8cc5('0x44')](db[_0x8cc5('0x4a')]['rawAttributes']);_0x2d9072[_0x8cc5('0x2f')]=_[_0x8cc5('0x44')](_0x21e1bf['query']);_0x2d9072[_0x8cc5('0x30')]=_[_0x8cc5('0x31')](_0x2d9072['model'],_0x2d9072['query']);_0x477722[_0x8cc5('0x32')]=_[_0x8cc5('0x31')](_0x2d9072[_0x8cc5('0x2e')],qs[_0x8cc5('0x33')](_0x21e1bf[_0x8cc5('0x2f')][_0x8cc5('0x33')]));_0x477722[_0x8cc5('0x32')]=_0x477722[_0x8cc5('0x32')][_0x8cc5('0x34')]?_0x477722[_0x8cc5('0x32')]:_0x2d9072[_0x8cc5('0x2e')];_0x477722[_0x8cc5('0x4b')]=qs[_0x8cc5('0x37')](_0x21e1bf['query'][_0x8cc5('0x37')]);_0x477722[_0x8cc5('0x38')]=qs[_0x8cc5('0x30')](_[_0x8cc5('0x39')](_0x21e1bf['query'],_0x2d9072[_0x8cc5('0x30')]));if(_0x21e1bf[_0x8cc5('0x2f')]['filter']){_0x477722[_0x8cc5('0x38')]=_['merge'](_0x477722[_0x8cc5('0x38')],{'$or':_[_0x8cc5('0x29')](_0x477722[_0x8cc5('0x32')],function(_0x1a3ef2){var _0x4d978c={};_0x4d978c[_0x1a3ef2]={'$like':'%'+_0x21e1bf[_0x8cc5('0x2f')][_0x8cc5('0x3a')]+'%'};return _0x4d978c;})});}_0x477722=_[_0x8cc5('0x45')]({},_0x477722,_0x21e1bf[_0x8cc5('0x3c')]);return _0xe8ba9e[_0x8cc5('0x4d')](_0x477722);}})[_0x8cc5('0x3d')](function(_0x73e275){if(_0x73e275){_0x4ea328=_0x73e275[_0x8cc5('0x34')];if(!_0x21e1bf[_0x8cc5('0x2f')]['hasOwnProperty'](_0x8cc5('0x36'))){_0x477722[_0x8cc5('0x1b')]=qs[_0x8cc5('0x1b')](_0x21e1bf[_0x8cc5('0x2f')]['limit']);_0x477722[_0x8cc5('0x19')]=qs[_0x8cc5('0x19')](_0x21e1bf[_0x8cc5('0x2f')][_0x8cc5('0x19')]);}return _0xe8ba9e[_0x8cc5('0x4d')](_0x477722);}})[_0x8cc5('0x3d')](function(_0x3246b9){if(_0x3246b9){return _0x3246b9?{'count':_0x4ea328,'rows':_0x3246b9}:null;}})[_0x8cc5('0x3d')](respondWithResult(_0x1186f0,null))[_0x8cc5('0x42')](handleError(_0x1186f0,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 01ebcef..57d25b3 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 _0x3f35=['ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment','define'];(function(_0x59fe6b,_0xb640aa){var _0x195834=function(_0x14c238){while(--_0x14c238){_0x59fe6b['push'](_0x59fe6b['shift']());}};_0x195834(++_0xb640aa);}(_0x3f35,0xe8));var _0x53f3=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0x3f35[_0x42f009];return _0x22a1e0;};'use strict';var _=require(_0x53f3('0x0'));var util=require(_0x53f3('0x1'));var logger=require(_0x53f3('0x2'))(_0x53f3('0x3'));var moment=require('moment');var BPromise=require(_0x53f3('0x4'));var rp=require(_0x53f3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x53f3('0x6'));var attributes=require('./intZohoConfiguration.attributes');module['exports']=function(_0x459808,_0x5acd09){return _0x459808[_0x53f3('0x7')](_0x53f3('0x8'),attributes,{'tableName':_0x53f3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe1d0=['exports','ZohoConfiguration','int_zoho_configurations','util','../../config/logger','api','bluebird','../../config/environment','./intZohoConfiguration.attributes'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe1d0,0x186));var _0x0e1d=function(_0x3864e7,_0xd65515){_0x3864e7=_0x3864e7-0x0;var _0x563b9d=_0xe1d0[_0x3864e7];return _0x563b9d;};'use strict';var _=require('lodash');var util=require(_0x0e1d('0x0'));var logger=require(_0x0e1d('0x1'))(_0x0e1d('0x2'));var moment=require('moment');var BPromise=require(_0x0e1d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0e1d('0x4'));var attributes=require(_0x0e1d('0x5'));module[_0x0e1d('0x6')]=function(_0x111165,_0x13cd69){return _0x111165['define'](_0x0e1d('0x7'),attributes,{'tableName':_0x0e1d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index 2fce046..02da4c1 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 _0x93f3=['../../config/logger','rpc','../../config/environment','client','http','request','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x324d02,_0x6d9c0b){var _0x3d4f59=function(_0x279f6b){while(--_0x279f6b){_0x324d02['push'](_0x324d02['shift']());}};_0x3d4f59(++_0x6d9c0b);}(_0x93f3,0x1db));var _0x393f=function(_0x43ac23,_0x9eafdd){_0x43ac23=_0x43ac23-0x0;var _0x1b9f96=_0x93f3[_0x43ac23];return _0x1b9f96;};'use strict';var _=require(_0x393f('0x0'));var util=require(_0x393f('0x1'));var moment=require(_0x393f('0x2'));var BPromise=require(_0x393f('0x3'));var rs=require(_0x393f('0x4'));var fs=require('fs');var Redis=require(_0x393f('0x5'));var db=require(_0x393f('0x6'))['db'];var utils=require(_0x393f('0x7'));var logger=require(_0x393f('0x8'))(_0x393f('0x9'));var config=require(_0x393f('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x393f('0xb')][_0x393f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xc99113,_0x10d292,_0x561181){return new BPromise(function(_0x152b4e,_0x145084){return client[_0x393f('0xd')](_0xc99113,_0x561181)['then'](function(_0x1bf507){logger['info'](_0x393f('0xe'),_0x10d292,_0x393f('0xf'));logger['debug'](_0x393f('0x10'),_0x10d292,'request\x20sent',JSON[_0x393f('0x11')](_0x1bf507));if(_0x1bf507[_0x393f('0x12')]){if(_0x1bf507[_0x393f('0x12')][_0x393f('0x13')]===0x1f4){logger[_0x393f('0x12')](_0x393f('0xe'),_0x10d292,_0x1bf507['error'][_0x393f('0x14')]);return _0x145084(_0x1bf507[_0x393f('0x12')][_0x393f('0x14')]);}logger[_0x393f('0x12')](_0x393f('0xe'),_0x10d292,_0x1bf507['error'][_0x393f('0x14')]);return _0x152b4e(_0x1bf507['error'][_0x393f('0x14')]);}else{logger['info'](_0x393f('0xe'),_0x10d292,_0x393f('0xf'));_0x152b4e(_0x1bf507[_0x393f('0x15')]['message']);}})[_0x393f('0x16')](function(_0x3a8ac4){logger[_0x393f('0x12')]('ZohoConfiguration,\x20%s,\x20%s',_0x10d292,_0x3a8ac4);_0x145084(_0x3a8ac4);});});} \ No newline at end of file +var _0x090a=['stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x434566,_0x4b8b8e){var _0x537999=function(_0x5ece22){while(--_0x5ece22){_0x434566['push'](_0x434566['shift']());}};_0x537999(++_0x4b8b8e);}(_0x090a,0x1bb));var _0xa090=function(_0x508b05,_0x4698aa){_0x508b05=_0x508b05-0x0;var _0x43fab6=_0x090a[_0x508b05];return _0x43fab6;};'use strict';var _=require(_0xa090('0x0'));var util=require(_0xa090('0x1'));var moment=require(_0xa090('0x2'));var BPromise=require('bluebird');var rs=require(_0xa090('0x3'));var fs=require('fs');var Redis=require(_0xa090('0x4'));var db=require(_0xa090('0x5'))['db'];var utils=require(_0xa090('0x6'));var logger=require(_0xa090('0x7'))(_0xa090('0x8'));var config=require(_0xa090('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa090('0xa')][_0xa090('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2565c9,_0x1a7fd7,_0x41c22a){return new BPromise(function(_0x450ff2,_0x4ea5bc){return client['request'](_0x2565c9,_0x41c22a)[_0xa090('0xc')](function(_0x1c9ee4){logger[_0xa090('0xd')](_0xa090('0xe'),_0x1a7fd7,_0xa090('0xf'));logger[_0xa090('0x10')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x1a7fd7,_0xa090('0xf'),JSON[_0xa090('0x11')](_0x1c9ee4));if(_0x1c9ee4['error']){if(_0x1c9ee4[_0xa090('0x12')][_0xa090('0x13')]===0x1f4){logger[_0xa090('0x12')]('ZohoConfiguration,\x20%s,\x20%s',_0x1a7fd7,_0x1c9ee4[_0xa090('0x12')][_0xa090('0x14')]);return _0x4ea5bc(_0x1c9ee4[_0xa090('0x12')][_0xa090('0x14')]);}logger[_0xa090('0x12')](_0xa090('0xe'),_0x1a7fd7,_0x1c9ee4[_0xa090('0x12')][_0xa090('0x14')]);return _0x450ff2(_0x1c9ee4[_0xa090('0x12')][_0xa090('0x14')]);}else{logger[_0xa090('0xd')](_0xa090('0xe'),_0x1a7fd7,'request\x20sent');_0x450ff2(_0x1c9ee4[_0xa090('0x15')]['message']);}})[_0xa090('0x16')](function(_0x379a82){logger[_0xa090('0x12')](_0xa090('0xe'),_0x1a7fd7,_0x379a82);_0x4ea5bc(_0x379a82);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index a4ab972..c9543cd 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 _0x5c2c=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoField.controller','get','isAuthenticated','index','/:id','post','put','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x2b5dcc,_0x3e6f6a){var _0x5368d1=function(_0x141348){while(--_0x141348){_0x2b5dcc['push'](_0x2b5dcc['shift']());}};_0x5368d1(++_0x3e6f6a);}(_0x5c2c,0x1b2));var _0xc5c2=function(_0x12aaee,_0x5bf50c){_0x12aaee=_0x12aaee-0x0;var _0x37c350=_0x5c2c[_0x12aaee];return _0x37c350;};'use strict';var multer=require('multer');var util=require(_0xc5c2('0x0'));var path=require(_0xc5c2('0x1'));var timeout=require(_0xc5c2('0x2'));var express=require(_0xc5c2('0x3'));var router=express[_0xc5c2('0x4')]();var fs_extra=require(_0xc5c2('0x5'));var auth=require(_0xc5c2('0x6'));var interaction=require(_0xc5c2('0x7'));var config=require('../../config/environment');var controller=require(_0xc5c2('0x8'));router[_0xc5c2('0x9')]('/',auth[_0xc5c2('0xa')](),controller[_0xc5c2('0xb')]);router['get'](_0xc5c2('0xc'),auth[_0xc5c2('0xa')](),controller['show']);router[_0xc5c2('0xd')]('/',auth[_0xc5c2('0xa')](),controller['create']);router[_0xc5c2('0xe')](_0xc5c2('0xc'),auth[_0xc5c2('0xa')](),controller[_0xc5c2('0xf')]);router[_0xc5c2('0x10')]('/:id',auth[_0xc5c2('0xa')](),controller[_0xc5c2('0x11')]);module[_0xc5c2('0x12')]=router; \ No newline at end of file +var _0xd419=['path','connect-timeout','express','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','/:id','show','post','create','update','destroy','exports','multer','util'];(function(_0xe0bbdd,_0x5cba7f){var _0x48775d=function(_0x423606){while(--_0x423606){_0xe0bbdd['push'](_0xe0bbdd['shift']());}};_0x48775d(++_0x5cba7f);}(_0xd419,0x10e));var _0x9d41=function(_0x44c8bc,_0x4b8f9c){_0x44c8bc=_0x44c8bc-0x0;var _0x17e4d9=_0xd419[_0x44c8bc];return _0x17e4d9;};'use strict';var multer=require(_0x9d41('0x0'));var util=require(_0x9d41('0x1'));var path=require(_0x9d41('0x2'));var timeout=require(_0x9d41('0x3'));var express=require(_0x9d41('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9d41('0x5'));var config=require(_0x9d41('0x6'));var controller=require(_0x9d41('0x7'));router[_0x9d41('0x8')]('/',auth[_0x9d41('0x9')](),controller['index']);router[_0x9d41('0x8')](_0x9d41('0xa'),auth[_0x9d41('0x9')](),controller[_0x9d41('0xb')]);router[_0x9d41('0xc')]('/',auth['isAuthenticated'](),controller[_0x9d41('0xd')]);router['put'](_0x9d41('0xa'),auth['isAuthenticated'](),controller[_0x9d41('0xe')]);router['delete'](_0x9d41('0xa'),auth[_0x9d41('0x9')](),controller[_0x9d41('0xf')]);module[_0x9d41('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index ea5c94c..cf2efaa 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 _0x4899=['STRING','BOOLEAN','exports','ENUM','string','variable','customVariable','keyValue','picklist'];(function(_0x531d3e,_0x25dd52){var _0x3aeef6=function(_0xec5963){while(--_0xec5963){_0x531d3e['push'](_0x531d3e['shift']());}};_0x3aeef6(++_0x25dd52);}(_0x4899,0xad));var _0x9489=function(_0x1aa3ee,_0x394ee6){_0x1aa3ee=_0x1aa3ee-0x0;var _0x154ceb=_0x4899[_0x1aa3ee];return _0x154ceb;};'use strict';var Sequelize=require('sequelize');module[_0x9489('0x0')]={'type':{'type':Sequelize[_0x9489('0x1')](_0x9489('0x2'),_0x9489('0x3'),_0x9489('0x4'),_0x9489('0x5'),_0x9489('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x9489('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x9489('0x2'),_0x9489('0x3'),_0x9489('0x4'))},'keyContent':{'type':Sequelize[_0x9489('0x7')]},'idField':{'type':Sequelize[_0x9489('0x7')]},'nameField':{'type':Sequelize[_0x9489('0x7')]},'customField':{'type':Sequelize[_0x9489('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9489('0x7')]}}; \ No newline at end of file +var _0xea64=['customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','ENUM','string','variable'];(function(_0x127d28,_0x308891){var _0x1b1383=function(_0xae56ae){while(--_0xae56ae){_0x127d28['push'](_0x127d28['shift']());}};_0x1b1383(++_0x308891);}(_0xea64,0x101));var _0x4ea6=function(_0x1cc519,_0x295249){_0x1cc519=_0x1cc519-0x0;var _0x5cf583=_0xea64[_0x1cc519];return _0x5cf583;};'use strict';var Sequelize=require(_0x4ea6('0x0'));module['exports']={'type':{'type':Sequelize[_0x4ea6('0x1')](_0x4ea6('0x2'),_0x4ea6('0x3'),_0x4ea6('0x4'),_0x4ea6('0x5'),_0x4ea6('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x4ea6('0x7')]},'keyType':{'type':Sequelize[_0x4ea6('0x1')](_0x4ea6('0x2'),_0x4ea6('0x3'),_0x4ea6('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x4ea6('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x4ea6('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4ea6('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index d7bebbe..8aad71f 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 _0x5b64=['to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','reject','save','update','destroy','error','stack','name','map','ZohoField','fieldName','type','key','query','keys','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','then','includeAll','rows','catch','params','rawAttributes','include','create','body','find','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path'];(function(_0x8edf9e,_0x198d71){var _0x56caf1=function(_0x2e654d){while(--_0x2e654d){_0x8edf9e['push'](_0x8edf9e['shift']());}};_0x56caf1(++_0x198d71);}(_0x5b64,0x16f));var _0x45b6=function(_0x5e8c63,_0x2d639d){_0x5e8c63=_0x5e8c63-0x0;var _0x4d9bbf=_0x5b64[_0x5e8c63];return _0x4d9bbf;};'use strict';var emlformat=require(_0x45b6('0x0'));var rimraf=require(_0x45b6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x45b6('0x2'));var rp=require('request-promise');var moment=require(_0x45b6('0x3'));var BPromise=require(_0x45b6('0x4'));var Mustache=require(_0x45b6('0x5'));var util=require(_0x45b6('0x6'));var path=require(_0x45b6('0x7'));var sox=require('sox');var csv=require(_0x45b6('0x8'));var ejs=require(_0x45b6('0x9'));var fs=require('fs');var fs_extra=require(_0x45b6('0xa'));var _=require(_0x45b6('0xb'));var squel=require(_0x45b6('0xc'));var crypto=require('crypto');var jsforce=require(_0x45b6('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x45b6('0x8'));var querystring=require(_0x45b6('0xe'));var Papa=require(_0x45b6('0xf'));var Redis=require(_0x45b6('0x10'));var authService=require(_0x45b6('0x11'));var qs=require(_0x45b6('0x12'));var as=require(_0x45b6('0x13'));var hardwareService=require(_0x45b6('0x14'));var logger=require(_0x45b6('0x15'))(_0x45b6('0x16'));var utils=require(_0x45b6('0x17'));var config=require(_0x45b6('0x18'));var licenseUtil=require(_0x45b6('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x34daf,_0x554d69){_0x554d69=_0x554d69||0xcc;return function(_0x40db1a){if(_0x40db1a){return _0x34daf[_0x45b6('0x1a')](_0x554d69);}return _0x34daf[_0x45b6('0x1b')](_0x554d69)[_0x45b6('0x1c')]();};}function respondWithResult(_0x4fa519,_0x455541){_0x455541=_0x455541||0xc8;return function(_0x5e7c21){if(_0x5e7c21){return _0x4fa519[_0x45b6('0x1b')](_0x455541)[_0x45b6('0x1d')](_0x5e7c21);}};}function respondWithFilteredResult(_0xdfe2ea,_0xafecec){return function(_0x3f861f){if(_0x3f861f){var _0x4c203a=typeof _0xafecec['offset']===_0x45b6('0x1e')&&typeof _0xafecec['limit']===_0x45b6('0x1e');var _0x2546f1=_0x3f861f[_0x45b6('0x1f')];var _0x365882=_0x4c203a?0x0:_0xafecec[_0x45b6('0x20')];var _0x2d7f6b=_0x4c203a?_0x3f861f[_0x45b6('0x1f')]:_0xafecec[_0x45b6('0x20')]+_0xafecec[_0x45b6('0x21')];var _0x535544;if(_0x2d7f6b>=_0x2546f1){_0x2d7f6b=_0x2546f1;_0x535544=0xc8;}else{_0x535544=0xce;}_0xdfe2ea[_0x45b6('0x1b')](_0x535544);return _0xdfe2ea['set'](_0x45b6('0x22'),_0x365882+'-'+_0x2d7f6b+'/'+_0x2546f1)[_0x45b6('0x1d')](_0x3f861f);}return null;};}function patchUpdates(_0x3e750a){return function(_0x9979ca){try{jsonpatch['apply'](_0x9979ca,_0x3e750a,!![]);}catch(_0x8ff49c){return BPromise[_0x45b6('0x23')](_0x8ff49c);}return _0x9979ca[_0x45b6('0x24')]();};}function saveUpdates(_0x4785b0,_0x2c110f){return function(_0x4560fa){if(_0x4560fa){return _0x4560fa[_0x45b6('0x25')](_0x4785b0)['then'](function(_0x1b3f36){return _0x1b3f36;});}return null;};}function removeEntity(_0x19d06b,_0x549d7f){return function(_0x2de97a){if(_0x2de97a){return _0x2de97a[_0x45b6('0x26')]()['then'](function(){_0x19d06b['status'](0xcc)[_0x45b6('0x1c')]();});}};}function handleEntityNotFound(_0x57c3ae,_0x48220f){return function(_0x3341e6){if(!_0x3341e6){_0x57c3ae[_0x45b6('0x1a')](0x194);}return _0x3341e6;};}function handleError(_0x2a12aa,_0x232074){_0x232074=_0x232074||0x1f4;return function(_0x4cc9ed){logger[_0x45b6('0x27')](_0x4cc9ed[_0x45b6('0x28')]);if(_0x4cc9ed[_0x45b6('0x29')]){delete _0x4cc9ed[_0x45b6('0x29')];}_0x2a12aa[_0x45b6('0x1b')](_0x232074)['send'](_0x4cc9ed);};}exports['index']=function(_0x37ef07,_0x35388b){var _0x1704c4={},_0x3cbb24={},_0x131a39={'count':0x0,'rows':[]};var _0x169e02=_[_0x45b6('0x2a')](db[_0x45b6('0x2b')]['rawAttributes'],function(_0x2eae6b){return{'name':_0x2eae6b[_0x45b6('0x2c')],'type':_0x2eae6b[_0x45b6('0x2d')][_0x45b6('0x2e')]};});_0x3cbb24['model']=_[_0x45b6('0x2a')](_0x169e02,_0x45b6('0x29'));_0x3cbb24[_0x45b6('0x2f')]=_[_0x45b6('0x30')](_0x37ef07[_0x45b6('0x2f')]);_0x3cbb24['filters']=_['intersection'](_0x3cbb24[_0x45b6('0x31')],_0x3cbb24['query']);_0x1704c4['attributes']=_[_0x45b6('0x32')](_0x3cbb24[_0x45b6('0x31')],qs[_0x45b6('0x33')](_0x37ef07[_0x45b6('0x2f')][_0x45b6('0x33')]));_0x1704c4['attributes']=_0x1704c4[_0x45b6('0x34')][_0x45b6('0x35')]?_0x1704c4[_0x45b6('0x34')]:_0x3cbb24[_0x45b6('0x31')];if(!_0x37ef07[_0x45b6('0x2f')][_0x45b6('0x36')](_0x45b6('0x37'))){_0x1704c4[_0x45b6('0x21')]=qs['limit'](_0x37ef07[_0x45b6('0x2f')][_0x45b6('0x21')]);_0x1704c4[_0x45b6('0x20')]=qs[_0x45b6('0x20')](_0x37ef07[_0x45b6('0x2f')]['offset']);}_0x1704c4[_0x45b6('0x38')]=qs[_0x45b6('0x39')](_0x37ef07[_0x45b6('0x2f')][_0x45b6('0x39')]);_0x1704c4[_0x45b6('0x3a')]=qs['filters'](_[_0x45b6('0x3b')](_0x37ef07[_0x45b6('0x2f')],_0x3cbb24[_0x45b6('0x3c')]),_0x169e02);if(_0x37ef07[_0x45b6('0x2f')][_0x45b6('0x3d')]){_0x1704c4[_0x45b6('0x3a')]=_[_0x45b6('0x3e')](_0x1704c4[_0x45b6('0x3a')],{'$or':_[_0x45b6('0x2a')](_0x169e02,function(_0x53cafc){if(_0x53cafc[_0x45b6('0x2d')]!==_0x45b6('0x3f')){var _0x5172d8={};_0x5172d8[_0x53cafc[_0x45b6('0x29')]]={'$like':'%'+_0x37ef07[_0x45b6('0x2f')][_0x45b6('0x3d')]+'%'};return _0x5172d8;}})});}_0x1704c4=_[_0x45b6('0x3e')]({},_0x1704c4,_0x37ef07[_0x45b6('0x40')]);var _0x455b63={'where':_0x1704c4[_0x45b6('0x3a')]};return db['ZohoField'][_0x45b6('0x1f')](_0x455b63)[_0x45b6('0x41')](function(_0x448957){_0x131a39['count']=_0x448957;if(_0x37ef07[_0x45b6('0x2f')][_0x45b6('0x42')]){_0x1704c4['include']=[{'all':!![]}];}return db[_0x45b6('0x2b')]['findAll'](_0x1704c4);})['then'](function(_0x4ac855){_0x131a39[_0x45b6('0x43')]=_0x4ac855;return _0x131a39;})['then'](respondWithFilteredResult(_0x35388b,_0x1704c4))[_0x45b6('0x44')](handleError(_0x35388b,null));};exports['show']=function(_0x3f405c,_0x2c1b3a){var _0x573d1f={'raw':!![],'where':{'id':_0x3f405c[_0x45b6('0x45')]['id']}},_0x1fb0ef={};_0x1fb0ef[_0x45b6('0x31')]=_[_0x45b6('0x30')](db[_0x45b6('0x2b')][_0x45b6('0x46')]);_0x1fb0ef[_0x45b6('0x2f')]=_['keys'](_0x3f405c[_0x45b6('0x2f')]);_0x1fb0ef['filters']=_[_0x45b6('0x32')](_0x1fb0ef[_0x45b6('0x31')],_0x1fb0ef[_0x45b6('0x2f')]);_0x573d1f['attributes']=_[_0x45b6('0x32')](_0x1fb0ef[_0x45b6('0x31')],qs['fields'](_0x3f405c[_0x45b6('0x2f')]['fields']));_0x573d1f[_0x45b6('0x34')]=_0x573d1f[_0x45b6('0x34')]['length']?_0x573d1f[_0x45b6('0x34')]:_0x1fb0ef['model'];if(_0x3f405c[_0x45b6('0x2f')][_0x45b6('0x42')]){_0x573d1f[_0x45b6('0x47')]=[{'all':!![]}];}_0x573d1f=_[_0x45b6('0x3e')]({},_0x573d1f,_0x3f405c['options']);return db['ZohoField']['find'](_0x573d1f)['then'](handleEntityNotFound(_0x2c1b3a,null))[_0x45b6('0x41')](respondWithResult(_0x2c1b3a,null))[_0x45b6('0x44')](handleError(_0x2c1b3a,null));};exports[_0x45b6('0x48')]=function(_0x56ae98,_0x777c5){return db[_0x45b6('0x2b')]['create'](_0x56ae98[_0x45b6('0x49')],{})['then'](respondWithResult(_0x777c5,0xc9))['catch'](handleError(_0x777c5,null));};exports[_0x45b6('0x25')]=function(_0x3f7fed,_0x2306e7){if(_0x3f7fed['body']['id']){delete _0x3f7fed['body']['id'];}return db[_0x45b6('0x2b')][_0x45b6('0x4a')]({'where':{'id':_0x3f7fed['params']['id']}})['then'](handleEntityNotFound(_0x2306e7,null))[_0x45b6('0x41')](saveUpdates(_0x3f7fed[_0x45b6('0x49')],null))['then'](respondWithResult(_0x2306e7,null))[_0x45b6('0x44')](handleError(_0x2306e7,null));};exports[_0x45b6('0x26')]=function(_0x35dfb1,_0x246042){return db['ZohoField'][_0x45b6('0x4a')]({'where':{'id':_0x35dfb1[_0x45b6('0x45')]['id']}})[_0x45b6('0x41')](handleEntityNotFound(_0x246042,null))['then'](removeEntity(_0x246042,null))[_0x45b6('0x44')](handleError(_0x246042,null));}; \ No newline at end of file +var _0x3325=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','set','json','apply','reject','save','then','destroy','error','stack','name','index','map','ZohoField','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','params','fields','options','create','body','find','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x24ea1f,_0x42a5ec){var _0x4f0da6=function(_0x1043cd){while(--_0x1043cd){_0x24ea1f['push'](_0x24ea1f['shift']());}};_0x4f0da6(++_0x42a5ec);}(_0x3325,0x155));var _0x5332=function(_0x596565,_0x1258ad){_0x596565=_0x596565-0x0;var _0x474b1b=_0x3325[_0x596565];return _0x474b1b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5332('0x0'));var jsonpatch=require(_0x5332('0x1'));var rp=require(_0x5332('0x2'));var moment=require(_0x5332('0x3'));var BPromise=require(_0x5332('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x5332('0x5'));var csv=require(_0x5332('0x6'));var ejs=require(_0x5332('0x7'));var fs=require('fs');var fs_extra=require(_0x5332('0x8'));var _=require('lodash');var squel=require(_0x5332('0x9'));var crypto=require(_0x5332('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x5332('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5332('0xc'));var Papa=require(_0x5332('0xd'));var Redis=require(_0x5332('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x5332('0xf'));var as=require(_0x5332('0x10'));var hardwareService=require(_0x5332('0x11'));var logger=require('../../config/logger')(_0x5332('0x12'));var utils=require('../../config/utils');var config=require(_0x5332('0x13'));var licenseUtil=require(_0x5332('0x14'));var db=require(_0x5332('0x15'))['db'];function respondWithStatusCode(_0x596b23,_0x37a8f0){_0x37a8f0=_0x37a8f0||0xcc;return function(_0xba181f){if(_0xba181f){return _0x596b23[_0x5332('0x16')](_0x37a8f0);}return _0x596b23[_0x5332('0x17')](_0x37a8f0)[_0x5332('0x18')]();};}function respondWithResult(_0x4802ae,_0xbfa5b3){_0xbfa5b3=_0xbfa5b3||0xc8;return function(_0x282001){if(_0x282001){return _0x4802ae[_0x5332('0x17')](_0xbfa5b3)['json'](_0x282001);}};}function respondWithFilteredResult(_0x49107b,_0x249a10){return function(_0x42ccf2){if(_0x42ccf2){var _0x46844d=typeof _0x249a10[_0x5332('0x19')]===_0x5332('0x1a')&&typeof _0x249a10[_0x5332('0x1b')]===_0x5332('0x1a');var _0x520b21=_0x42ccf2['count'];var _0x29ad0e=_0x46844d?0x0:_0x249a10['offset'];var _0x4801da=_0x46844d?_0x42ccf2['count']:_0x249a10[_0x5332('0x19')]+_0x249a10[_0x5332('0x1b')];var _0x5dbd8f;if(_0x4801da>=_0x520b21){_0x4801da=_0x520b21;_0x5dbd8f=0xc8;}else{_0x5dbd8f=0xce;}_0x49107b[_0x5332('0x17')](_0x5dbd8f);return _0x49107b[_0x5332('0x1c')]('Content-Range',_0x29ad0e+'-'+_0x4801da+'/'+_0x520b21)[_0x5332('0x1d')](_0x42ccf2);}return null;};}function patchUpdates(_0x829cbb){return function(_0x30ee02){try{jsonpatch[_0x5332('0x1e')](_0x30ee02,_0x829cbb,!![]);}catch(_0x4766b2){return BPromise[_0x5332('0x1f')](_0x4766b2);}return _0x30ee02[_0x5332('0x20')]();};}function saveUpdates(_0x2fb500,_0x3587f7){return function(_0x885ba3){if(_0x885ba3){return _0x885ba3['update'](_0x2fb500)[_0x5332('0x21')](function(_0x50ae74){return _0x50ae74;});}return null;};}function removeEntity(_0x323114,_0x217fc7){return function(_0x3141f3){if(_0x3141f3){return _0x3141f3[_0x5332('0x22')]()[_0x5332('0x21')](function(){_0x323114[_0x5332('0x17')](0xcc)[_0x5332('0x18')]();});}};}function handleEntityNotFound(_0x340733,_0x3f73f6){return function(_0x512074){if(!_0x512074){_0x340733[_0x5332('0x16')](0x194);}return _0x512074;};}function handleError(_0x1e1293,_0x14d2f2){_0x14d2f2=_0x14d2f2||0x1f4;return function(_0x4584b2){logger[_0x5332('0x23')](_0x4584b2[_0x5332('0x24')]);if(_0x4584b2[_0x5332('0x25')]){delete _0x4584b2[_0x5332('0x25')];}_0x1e1293['status'](_0x14d2f2)['send'](_0x4584b2);};}exports[_0x5332('0x26')]=function(_0x4228e2,_0x1dfa81){var _0x1a032f={},_0x1198da={},_0x1ce4ab={'count':0x0,'rows':[]};var _0x5fdce7=_[_0x5332('0x27')](db[_0x5332('0x28')][_0x5332('0x29')],function(_0x33b709){return{'name':_0x33b709[_0x5332('0x2a')],'type':_0x33b709['type'][_0x5332('0x2b')]};});_0x1198da[_0x5332('0x2c')]=_[_0x5332('0x27')](_0x5fdce7,_0x5332('0x25'));_0x1198da['query']=_[_0x5332('0x2d')](_0x4228e2[_0x5332('0x2e')]);_0x1198da[_0x5332('0x2f')]=_[_0x5332('0x30')](_0x1198da[_0x5332('0x2c')],_0x1198da['query']);_0x1a032f[_0x5332('0x31')]=_[_0x5332('0x30')](_0x1198da[_0x5332('0x2c')],qs['fields'](_0x4228e2[_0x5332('0x2e')]['fields']));_0x1a032f[_0x5332('0x31')]=_0x1a032f[_0x5332('0x31')][_0x5332('0x32')]?_0x1a032f[_0x5332('0x31')]:_0x1198da[_0x5332('0x2c')];if(!_0x4228e2[_0x5332('0x2e')][_0x5332('0x33')](_0x5332('0x34'))){_0x1a032f[_0x5332('0x1b')]=qs[_0x5332('0x1b')](_0x4228e2[_0x5332('0x2e')][_0x5332('0x1b')]);_0x1a032f[_0x5332('0x19')]=qs[_0x5332('0x19')](_0x4228e2[_0x5332('0x2e')][_0x5332('0x19')]);}_0x1a032f['order']=qs['sort'](_0x4228e2[_0x5332('0x2e')][_0x5332('0x35')]);_0x1a032f[_0x5332('0x36')]=qs[_0x5332('0x2f')](_[_0x5332('0x37')](_0x4228e2[_0x5332('0x2e')],_0x1198da[_0x5332('0x2f')]),_0x5fdce7);if(_0x4228e2[_0x5332('0x2e')][_0x5332('0x38')]){_0x1a032f[_0x5332('0x36')]=_[_0x5332('0x39')](_0x1a032f[_0x5332('0x36')],{'$or':_[_0x5332('0x27')](_0x5fdce7,function(_0x5da868){if(_0x5da868['type']!==_0x5332('0x3a')){var _0x25d440={};_0x25d440[_0x5da868[_0x5332('0x25')]]={'$like':'%'+_0x4228e2[_0x5332('0x2e')][_0x5332('0x38')]+'%'};return _0x25d440;}})});}_0x1a032f=_[_0x5332('0x39')]({},_0x1a032f,_0x4228e2['options']);var _0x45efb8={'where':_0x1a032f['where']};return db[_0x5332('0x28')][_0x5332('0x3b')](_0x45efb8)[_0x5332('0x21')](function(_0x58b216){_0x1ce4ab['count']=_0x58b216;if(_0x4228e2[_0x5332('0x2e')][_0x5332('0x3c')]){_0x1a032f[_0x5332('0x3d')]=[{'all':!![]}];}return db[_0x5332('0x28')][_0x5332('0x3e')](_0x1a032f);})[_0x5332('0x21')](function(_0xcbb54c){_0x1ce4ab[_0x5332('0x3f')]=_0xcbb54c;return _0x1ce4ab;})[_0x5332('0x21')](respondWithFilteredResult(_0x1dfa81,_0x1a032f))[_0x5332('0x40')](handleError(_0x1dfa81,null));};exports[_0x5332('0x41')]=function(_0x13f68a,_0x2f7c46){var _0x390491={'raw':!![],'where':{'id':_0x13f68a[_0x5332('0x42')]['id']}},_0x6a9e74={};_0x6a9e74[_0x5332('0x2c')]=_[_0x5332('0x2d')](db[_0x5332('0x28')][_0x5332('0x29')]);_0x6a9e74[_0x5332('0x2e')]=_[_0x5332('0x2d')](_0x13f68a[_0x5332('0x2e')]);_0x6a9e74['filters']=_[_0x5332('0x30')](_0x6a9e74[_0x5332('0x2c')],_0x6a9e74['query']);_0x390491[_0x5332('0x31')]=_[_0x5332('0x30')](_0x6a9e74[_0x5332('0x2c')],qs[_0x5332('0x43')](_0x13f68a[_0x5332('0x2e')][_0x5332('0x43')]));_0x390491['attributes']=_0x390491[_0x5332('0x31')][_0x5332('0x32')]?_0x390491['attributes']:_0x6a9e74[_0x5332('0x2c')];if(_0x13f68a['query'][_0x5332('0x3c')]){_0x390491[_0x5332('0x3d')]=[{'all':!![]}];}_0x390491=_[_0x5332('0x39')]({},_0x390491,_0x13f68a[_0x5332('0x44')]);return db['ZohoField']['find'](_0x390491)[_0x5332('0x21')](handleEntityNotFound(_0x2f7c46,null))[_0x5332('0x21')](respondWithResult(_0x2f7c46,null))['catch'](handleError(_0x2f7c46,null));};exports[_0x5332('0x45')]=function(_0x508040,_0x390ca8){return db['ZohoField'][_0x5332('0x45')](_0x508040[_0x5332('0x46')],{})[_0x5332('0x21')](respondWithResult(_0x390ca8,0xc9))[_0x5332('0x40')](handleError(_0x390ca8,null));};exports['update']=function(_0x1bfcc0,_0x478833){if(_0x1bfcc0[_0x5332('0x46')]['id']){delete _0x1bfcc0['body']['id'];}return db[_0x5332('0x28')][_0x5332('0x47')]({'where':{'id':_0x1bfcc0[_0x5332('0x42')]['id']}})['then'](handleEntityNotFound(_0x478833,null))['then'](saveUpdates(_0x1bfcc0[_0x5332('0x46')],null))[_0x5332('0x21')](respondWithResult(_0x478833,null))[_0x5332('0x40')](handleError(_0x478833,null));};exports[_0x5332('0x22')]=function(_0x524dad,_0x5ab6e5){return db[_0x5332('0x28')][_0x5332('0x47')]({'where':{'id':_0x524dad[_0x5332('0x42')]['id']}})['then'](handleEntityNotFound(_0x5ab6e5,null))['then'](removeEntity(_0x5ab6e5,null))[_0x5332('0x40')](handleError(_0x5ab6e5,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 4337617..f843419 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 _0x6d38=['util','../../config/logger','api','request-promise','rimraf','../../config/environment','./intZohoField.attributes','define','ZohoField','idField','FieldId'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x6d38,0x1ef));var _0x86d3=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x6d38[_0x297fd3];return _0x2af381;};'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':'int_zoho_fields','paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x86d3('0x9'),_0x86d3('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb091=['./intZohoField.attributes','define','int_zoho_fields','zoho_unique_index','idField','FieldId','util','../../config/logger','api','moment','request-promise','../../config/environment'];(function(_0x4052c0,_0x4271ab){var _0x296f04=function(_0x5373fc){while(--_0x5373fc){_0x4052c0['push'](_0x4052c0['shift']());}};_0x296f04(++_0x4271ab);}(_0xb091,0x16e));var _0x1b09=function(_0x556556,_0x142e91){_0x556556=_0x556556-0x0;var _0x2f83fb=_0xb091[_0x556556];return _0x2f83fb;};'use strict';var _=require('lodash');var util=require(_0x1b09('0x0'));var logger=require(_0x1b09('0x1'))(_0x1b09('0x2'));var moment=require(_0x1b09('0x3'));var BPromise=require('bluebird');var rp=require(_0x1b09('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1b09('0x5'));var attributes=require(_0x1b09('0x6'));module['exports']=function(_0xda8caa,_0x5fa348){return _0xda8caa[_0x1b09('0x7')]('ZohoField',attributes,{'tableName':_0x1b09('0x8'),'paranoid':![],'indexes':[{'name':_0x1b09('0x9'),'fields':[_0x1b09('0xa'),_0x1b09('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index b08bf1f..f0f0446 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 _0xf933=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s','debug','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch'];(function(_0xecdf7,_0x505f28){var _0x2f98b2=function(_0xb68286){while(--_0xb68286){_0xecdf7['push'](_0xecdf7['shift']());}};_0x2f98b2(++_0x505f28);}(_0xf933,0x120));var _0x3f93=function(_0x2a390b,_0xf49f9b){_0x2a390b=_0x2a390b-0x0;var _0x5df10a=_0xf933[_0x2a390b];return _0x5df10a;};'use strict';var _=require(_0x3f93('0x0'));var util=require('util');var moment=require(_0x3f93('0x1'));var BPromise=require(_0x3f93('0x2'));var rs=require(_0x3f93('0x3'));var fs=require('fs');var Redis=require(_0x3f93('0x4'));var db=require(_0x3f93('0x5'))['db'];var utils=require(_0x3f93('0x6'));var logger=require('../../config/logger')(_0x3f93('0x7'));var config=require(_0x3f93('0x8'));var jayson=require(_0x3f93('0x9'));var client=jayson[_0x3f93('0xa')][_0x3f93('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xe1632e,_0x277af1,_0x422d4e){return new BPromise(function(_0x2d9739,_0x1395ca){return client[_0x3f93('0xc')](_0xe1632e,_0x422d4e)[_0x3f93('0xd')](function(_0x548e12){logger[_0x3f93('0xe')](_0x3f93('0xf'),_0x277af1,'request\x20sent');logger[_0x3f93('0x10')](_0x3f93('0x11'),_0x277af1,_0x3f93('0x12'),JSON[_0x3f93('0x13')](_0x548e12));if(_0x548e12[_0x3f93('0x14')]){if(_0x548e12[_0x3f93('0x14')][_0x3f93('0x15')]===0x1f4){logger[_0x3f93('0x14')](_0x3f93('0xf'),_0x277af1,_0x548e12[_0x3f93('0x14')][_0x3f93('0x16')]);return _0x1395ca(_0x548e12[_0x3f93('0x14')][_0x3f93('0x16')]);}logger['error']('ZohoField,\x20%s,\x20%s',_0x277af1,_0x548e12[_0x3f93('0x14')]['message']);return _0x2d9739(_0x548e12[_0x3f93('0x14')][_0x3f93('0x16')]);}else{logger[_0x3f93('0xe')](_0x3f93('0xf'),_0x277af1,_0x3f93('0x12'));_0x2d9739(_0x548e12['result'][_0x3f93('0x16')]);}})[_0x3f93('0x17')](function(_0x48c834){logger[_0x3f93('0x14')](_0x3f93('0xf'),_0x277af1,_0x48c834);_0x1395ca(_0x48c834);});});} \ No newline at end of file +var _0x955c=['result','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','ZohoField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x955c,0x86));var _0xc955=function(_0xeee4b8,_0xe4e535){_0xeee4b8=_0xeee4b8-0x0;var _0x47609d=_0x955c[_0xeee4b8];return _0x47609d;};'use strict';var _=require('lodash');var util=require(_0xc955('0x0'));var moment=require('moment');var BPromise=require(_0xc955('0x1'));var rs=require(_0xc955('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc955('0x3'))['db'];var utils=require(_0xc955('0x4'));var logger=require(_0xc955('0x5'))('rpc');var config=require(_0xc955('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc955('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x109078,_0x25f593,_0x23e9fe){return new BPromise(function(_0x491c69,_0x4bf6f3){return client[_0xc955('0x8')](_0x109078,_0x23e9fe)[_0xc955('0x9')](function(_0x598341){logger[_0xc955('0xa')](_0xc955('0xb'),_0x25f593,'request\x20sent');logger[_0xc955('0xc')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x25f593,_0xc955('0xd'),JSON[_0xc955('0xe')](_0x598341));if(_0x598341[_0xc955('0xf')]){if(_0x598341[_0xc955('0xf')][_0xc955('0x10')]===0x1f4){logger[_0xc955('0xf')](_0xc955('0xb'),_0x25f593,_0x598341['error'][_0xc955('0x11')]);return _0x4bf6f3(_0x598341[_0xc955('0xf')][_0xc955('0x11')]);}logger['error'](_0xc955('0xb'),_0x25f593,_0x598341['error'][_0xc955('0x11')]);return _0x491c69(_0x598341['error'][_0xc955('0x11')]);}else{logger[_0xc955('0xa')]('ZohoField,\x20%s,\x20%s',_0x25f593,'request\x20sent');_0x491c69(_0x598341[_0xc955('0x12')][_0xc955('0x11')]);}})['catch'](function(_0x12b918){logger[_0xc955('0xf')](_0xc955('0xb'),_0x25f593,_0x12b918);_0x4bf6f3(_0x12b918);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index e67b999..8c71bba 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x59ed12,_0xf96ab6){var _0x3b6f60=function(_0x32b409){while(--_0x32b409){_0x59ed12['push'](_0x59ed12['shift']());}};_0x3b6f60(++_0xf96ab6);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x5dfa29,_0x7efcaf){var _0x43d944=function(_0x243932){while(--_0x243932){_0x5dfa29['push'](_0x5dfa29['shift']());}};_0x43d944(++_0x7efcaf);}(_0xe706,0xa3));var _0x6e70=function(_0x33501f,_0x2cae5){_0x33501f=_0x33501f-0x0;var _0x3e3713=_0xe706[_0x33501f];return _0x3e3713;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 30b66ee..4832a70 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 _0xd557=['INTEGER','BOOLEAN','state','sequelize','STRING','app.js'];(function(_0x3a89f3,_0x3f093c){var _0x490b20=function(_0xf97798){while(--_0xf97798){_0x3a89f3['push'](_0x3a89f3['shift']());}};_0x490b20(++_0x3f093c);}(_0xd557,0x13b));var _0x7d55=function(_0x22831e,_0x135401){_0x22831e=_0x22831e-0x0;var _0x497c13=_0xd557[_0x22831e];return _0x497c13;};'use strict';var Sequelize=require(_0x7d55('0x0'));module['exports']={'name':{'type':Sequelize[_0x7d55('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0x7d55('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x7d55('0x1')],'defaultValue':_0x7d55('0x2')},'filename':{'type':Sequelize[_0x7d55('0x1')]},'path':{'type':Sequelize[_0x7d55('0x1')]},'type':{'type':Sequelize[_0x7d55('0x1')]},'size':{'type':Sequelize[_0x7d55('0x3')]},'active':{'type':Sequelize[_0x7d55('0x4')],'defaultValue':![]},'author':{'type':Sequelize[_0x7d55('0x1')]},'logo':{'type':Sequelize[_0x7d55('0x1')]},'state':{'type':Sequelize['STRING'],'unique':_0x7d55('0x5')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x7d55('0x1')]},'link':{'type':Sequelize[_0x7d55('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0xfc47=['INTEGER','BOOLEAN','state','sequelize','STRING','unique_name_and_version','app.js'];(function(_0x4bb3a3,_0x1fdc7f){var _0x31e780=function(_0x3d6a0d){while(--_0x3d6a0d){_0x4bb3a3['push'](_0x4bb3a3['shift']());}};_0x31e780(++_0x1fdc7f);}(_0xfc47,0x192));var _0x7fc4=function(_0x4cfc1d,_0x2c0927){_0x4cfc1d=_0x4cfc1d-0x0;var _0x1c01a0=_0xfc47[_0x4cfc1d];return _0x1c01a0;};'use strict';var Sequelize=require(_0x7fc4('0x0'));module['exports']={'name':{'type':Sequelize[_0x7fc4('0x1')],'allowNull':![],'unique':_0x7fc4('0x2')},'version':{'type':Sequelize[_0x7fc4('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x7fc4('0x1')],'defaultValue':_0x7fc4('0x3')},'filename':{'type':Sequelize[_0x7fc4('0x1')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x7fc4('0x1')]},'size':{'type':Sequelize[_0x7fc4('0x4')]},'active':{'type':Sequelize[_0x7fc4('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x7fc4('0x1')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x7fc4('0x1')],'unique':_0x7fc4('0x6')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x7fc4('0x1')]},'remoteUri':{'type':Sequelize[_0x7fc4('0x1')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index b4537b1..2bc3b08 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 _0x4c60=['api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','then','destroy','end','error','stack','name','index','map','Integration','rawAttributes','key','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','includeAll','find','create','update','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x4c60,0xc1));var _0x04c6=function(_0x584c93,_0x5b5547){_0x584c93=_0x584c93-0x0;var _0x5b74dd=_0x4c60[_0x584c93];return _0x5b74dd;};'use strict';var emlformat=require(_0x04c6('0x0'));var rimraf=require(_0x04c6('0x1'));var zipdir=require(_0x04c6('0x2'));var jsonpatch=require(_0x04c6('0x3'));var rp=require('request-promise');var moment=require(_0x04c6('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x04c6('0x5'));var csv=require(_0x04c6('0x6'));var ejs=require(_0x04c6('0x7'));var fs=require('fs');var fs_extra=require(_0x04c6('0x8'));var _=require(_0x04c6('0x9'));var squel=require(_0x04c6('0xa'));var crypto=require(_0x04c6('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x04c6('0xc'));var toCsv=require(_0x04c6('0x6'));var querystring=require(_0x04c6('0xd'));var Papa=require(_0x04c6('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x04c6('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x04c6('0x10'))(_0x04c6('0x11'));var utils=require('../../config/utils');var config=require(_0x04c6('0x12'));var licenseUtil=require(_0x04c6('0x13'));var db=require(_0x04c6('0x14'))['db'];function respondWithStatusCode(_0x4e5e6,_0x52cdcf){_0x52cdcf=_0x52cdcf||0xcc;return function(_0x257a0a){if(_0x257a0a){return _0x4e5e6[_0x04c6('0x15')](_0x52cdcf);}return _0x4e5e6[_0x04c6('0x16')](_0x52cdcf)['end']();};}function respondWithResult(_0x12d1c5,_0x15cbe0){_0x15cbe0=_0x15cbe0||0xc8;return function(_0x28632e){if(_0x28632e){return _0x12d1c5[_0x04c6('0x16')](_0x15cbe0)[_0x04c6('0x17')](_0x28632e);}};}function respondWithFilteredResult(_0x19a26f,_0x1cd963){return function(_0x3d46a9){if(_0x3d46a9){var _0x5a5a66=typeof _0x1cd963[_0x04c6('0x18')]===_0x04c6('0x19')&&typeof _0x1cd963[_0x04c6('0x1a')]===_0x04c6('0x19');var _0x43596a=_0x3d46a9[_0x04c6('0x1b')];var _0x21674a=_0x5a5a66?0x0:_0x1cd963[_0x04c6('0x18')];var _0x47f400=_0x5a5a66?_0x3d46a9[_0x04c6('0x1b')]:_0x1cd963[_0x04c6('0x18')]+_0x1cd963[_0x04c6('0x1a')];var _0x558b43;if(_0x47f400>=_0x43596a){_0x47f400=_0x43596a;_0x558b43=0xc8;}else{_0x558b43=0xce;}_0x19a26f['status'](_0x558b43);return _0x19a26f['set'](_0x04c6('0x1c'),_0x21674a+'-'+_0x47f400+'/'+_0x43596a)[_0x04c6('0x17')](_0x3d46a9);}return null;};}function patchUpdates(_0x50dd61){return function(_0x5a5e9e){try{jsonpatch[_0x04c6('0x1d')](_0x5a5e9e,_0x50dd61,!![]);}catch(_0x2eed94){return BPromise[_0x04c6('0x1e')](_0x2eed94);}return _0x5a5e9e['save']();};}function saveUpdates(_0x33a0f7,_0x13f2dc){return function(_0x9d41f8){if(_0x9d41f8){return _0x9d41f8['update'](_0x33a0f7)[_0x04c6('0x1f')](function(_0x41e29f){return _0x41e29f;});}return null;};}function removeEntity(_0x562491,_0x54a8b0){return function(_0x4c8d72){if(_0x4c8d72){return _0x4c8d72[_0x04c6('0x20')]()[_0x04c6('0x1f')](function(){_0x562491[_0x04c6('0x16')](0xcc)[_0x04c6('0x21')]();});}};}function handleEntityNotFound(_0x3e1328,_0x52e5f5){return function(_0x562952){if(!_0x562952){_0x3e1328[_0x04c6('0x15')](0x194);}return _0x562952;};}function handleError(_0x2ab1d2,_0x9acfa){_0x9acfa=_0x9acfa||0x1f4;return function(_0x3233d7){logger[_0x04c6('0x22')](_0x3233d7[_0x04c6('0x23')]);if(_0x3233d7['name']){delete _0x3233d7[_0x04c6('0x24')];}_0x2ab1d2[_0x04c6('0x16')](_0x9acfa)['send'](_0x3233d7);};}exports[_0x04c6('0x25')]=function(_0x1cd16a,_0x5f1331){var _0x5c9003={},_0x115d84={},_0x3a6d92={'count':0x0,'rows':[]};var _0x2a191f=_[_0x04c6('0x26')](db[_0x04c6('0x27')][_0x04c6('0x28')],function(_0x49c4ed){return{'name':_0x49c4ed['fieldName'],'type':_0x49c4ed['type'][_0x04c6('0x29')]};});_0x115d84['model']=_[_0x04c6('0x26')](_0x2a191f,_0x04c6('0x24'));_0x115d84['query']=_[_0x04c6('0x2a')](_0x1cd16a[_0x04c6('0x2b')]);_0x115d84[_0x04c6('0x2c')]=_[_0x04c6('0x2d')](_0x115d84['model'],_0x115d84[_0x04c6('0x2b')]);_0x5c9003[_0x04c6('0x2e')]=_[_0x04c6('0x2d')](_0x115d84[_0x04c6('0x2f')],qs[_0x04c6('0x30')](_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x30')]));_0x5c9003[_0x04c6('0x2e')]=_0x5c9003[_0x04c6('0x2e')][_0x04c6('0x31')]?_0x5c9003[_0x04c6('0x2e')]:_0x115d84[_0x04c6('0x2f')];if(!_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x32')](_0x04c6('0x33'))){_0x5c9003['limit']=qs[_0x04c6('0x1a')](_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x1a')]);_0x5c9003[_0x04c6('0x18')]=qs['offset'](_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x18')]);}_0x5c9003['order']=qs['sort'](_0x1cd16a['query'][_0x04c6('0x34')]);_0x5c9003[_0x04c6('0x35')]=qs['filters'](_[_0x04c6('0x36')](_0x1cd16a['query'],_0x115d84[_0x04c6('0x2c')]),_0x2a191f);if(_0x1cd16a[_0x04c6('0x2b')][_0x04c6('0x37')]){_0x5c9003[_0x04c6('0x35')]=_['merge'](_0x5c9003['where'],{'$or':_[_0x04c6('0x26')](_0x2a191f,function(_0x3a9a3b){if(_0x3a9a3b['type']!==_0x04c6('0x38')){var _0x5ce4b0={};_0x5ce4b0[_0x3a9a3b['name']]={'$like':'%'+_0x1cd16a[_0x04c6('0x2b')]['filter']+'%'};return _0x5ce4b0;}})});}_0x5c9003=_[_0x04c6('0x39')]({},_0x5c9003,_0x1cd16a[_0x04c6('0x3a')]);var _0x59ca18={'where':_0x5c9003[_0x04c6('0x35')]};return db['Integration'][_0x04c6('0x1b')](_0x59ca18)[_0x04c6('0x1f')](function(_0x2d83eb){_0x3a6d92[_0x04c6('0x1b')]=_0x2d83eb;if(_0x1cd16a[_0x04c6('0x2b')]['includeAll']){_0x5c9003[_0x04c6('0x3b')]=[{'all':!![]}];}return db['Integration'][_0x04c6('0x3c')](_0x5c9003);})['then'](function(_0x1f7ead){_0x3a6d92[_0x04c6('0x3d')]=_0x1f7ead;return _0x3a6d92;})[_0x04c6('0x1f')](respondWithFilteredResult(_0x5f1331,_0x5c9003))[_0x04c6('0x3e')](handleError(_0x5f1331,null));};exports[_0x04c6('0x3f')]=function(_0x2cdf34,_0x40477f){var _0x4a3c45={'raw':![],'where':{'id':_0x2cdf34['params']['id']}},_0xdfdc34={};_0xdfdc34[_0x04c6('0x2f')]=_['keys'](db['Integration'][_0x04c6('0x28')]);_0xdfdc34['query']=_[_0x04c6('0x2a')](_0x2cdf34[_0x04c6('0x2b')]);_0xdfdc34[_0x04c6('0x2c')]=_['intersection'](_0xdfdc34[_0x04c6('0x2f')],_0xdfdc34[_0x04c6('0x2b')]);_0x4a3c45[_0x04c6('0x2e')]=_[_0x04c6('0x2d')](_0xdfdc34[_0x04c6('0x2f')],qs[_0x04c6('0x30')](_0x2cdf34[_0x04c6('0x2b')]['fields']));_0x4a3c45['attributes']=_0x4a3c45[_0x04c6('0x2e')][_0x04c6('0x31')]?_0x4a3c45[_0x04c6('0x2e')]:_0xdfdc34['model'];if(_0x2cdf34[_0x04c6('0x2b')][_0x04c6('0x40')]){_0x4a3c45[_0x04c6('0x3b')]=[{'all':!![]}];}_0x4a3c45=_['merge']({},_0x4a3c45,_0x2cdf34['options']);return db['Integration'][_0x04c6('0x41')](_0x4a3c45)[_0x04c6('0x1f')](handleEntityNotFound(_0x40477f,null))['then'](respondWithResult(_0x40477f,null))[_0x04c6('0x3e')](handleError(_0x40477f,null));};exports[_0x04c6('0x42')]=function(_0x2bd045,_0x4ef366){return db[_0x04c6('0x27')][_0x04c6('0x42')](_0x2bd045['body'],{})[_0x04c6('0x1f')](respondWithResult(_0x4ef366,0xc9))[_0x04c6('0x3e')](handleError(_0x4ef366,null));};exports[_0x04c6('0x43')]=function(_0xee2822,_0x4cfde2){if(_0xee2822[_0x04c6('0x44')]['id']){delete _0xee2822[_0x04c6('0x44')]['id'];}return db[_0x04c6('0x27')][_0x04c6('0x41')]({'where':{'id':_0xee2822['params']['id']}})[_0x04c6('0x1f')](handleEntityNotFound(_0x4cfde2,null))[_0x04c6('0x1f')](saveUpdates(_0xee2822[_0x04c6('0x44')],null))[_0x04c6('0x1f')](respondWithResult(_0x4cfde2,null))['catch'](handleError(_0x4cfde2,null));};exports[_0x04c6('0x20')]=function(_0x42273e,_0x15ec61){return db['Integration'][_0x04c6('0x41')]({'where':{'id':_0x42273e[_0x04c6('0x45')]['id']}})[_0x04c6('0x1f')](handleEntityNotFound(_0x15ec61,null))[_0x04c6('0x1f')](removeEntity(_0x15ec61,null))[_0x04c6('0x3e')](handleError(_0x15ec61,null));}; \ No newline at end of file +var _0x9536=['includeAll','include','findAll','rows','catch','params','rawAttributes','intersection','length','options','find','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','error','stack','name','index','map','Integration','fieldName','model','query','keys','filters','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9536,0x179));var _0x6953=function(_0x3ec122,_0x55150a){_0x3ec122=_0x3ec122-0x0;var _0x4ecf41=_0x9536[_0x3ec122];return _0x4ecf41;};'use strict';var emlformat=require(_0x6953('0x0'));var rimraf=require(_0x6953('0x1'));var zipdir=require(_0x6953('0x2'));var jsonpatch=require(_0x6953('0x3'));var rp=require('request-promise');var moment=require(_0x6953('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6953('0x5'));var util=require(_0x6953('0x6'));var path=require(_0x6953('0x7'));var sox=require(_0x6953('0x8'));var csv=require(_0x6953('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6953('0xa'));var _=require(_0x6953('0xb'));var squel=require(_0x6953('0xc'));var crypto=require(_0x6953('0xd'));var jsforce=require(_0x6953('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6953('0x9'));var querystring=require(_0x6953('0xf'));var Papa=require(_0x6953('0x10'));var Redis=require('ioredis');var authService=require(_0x6953('0x11'));var qs=require(_0x6953('0x12'));var as=require(_0x6953('0x13'));var hardwareService=require(_0x6953('0x14'));var logger=require(_0x6953('0x15'))(_0x6953('0x16'));var utils=require(_0x6953('0x17'));var config=require(_0x6953('0x18'));var licenseUtil=require(_0x6953('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x358388,_0x513dd0){_0x513dd0=_0x513dd0||0xcc;return function(_0x8de91e){if(_0x8de91e){return _0x358388[_0x6953('0x1a')](_0x513dd0);}return _0x358388[_0x6953('0x1b')](_0x513dd0)[_0x6953('0x1c')]();};}function respondWithResult(_0x1b5221,_0x244713){_0x244713=_0x244713||0xc8;return function(_0x175fa9){if(_0x175fa9){return _0x1b5221[_0x6953('0x1b')](_0x244713)[_0x6953('0x1d')](_0x175fa9);}};}function respondWithFilteredResult(_0x31d182,_0xae5515){return function(_0x548473){if(_0x548473){var _0x5f49db=typeof _0xae5515[_0x6953('0x1e')]===_0x6953('0x1f')&&typeof _0xae5515[_0x6953('0x20')]===_0x6953('0x1f');var _0x510d46=_0x548473[_0x6953('0x21')];var _0x2da771=_0x5f49db?0x0:_0xae5515['offset'];var _0x10858a=_0x5f49db?_0x548473[_0x6953('0x21')]:_0xae5515[_0x6953('0x1e')]+_0xae5515[_0x6953('0x20')];var _0xc714d3;if(_0x10858a>=_0x510d46){_0x10858a=_0x510d46;_0xc714d3=0xc8;}else{_0xc714d3=0xce;}_0x31d182['status'](_0xc714d3);return _0x31d182[_0x6953('0x22')](_0x6953('0x23'),_0x2da771+'-'+_0x10858a+'/'+_0x510d46)[_0x6953('0x1d')](_0x548473);}return null;};}function patchUpdates(_0x2ba433){return function(_0x41f021){try{jsonpatch['apply'](_0x41f021,_0x2ba433,!![]);}catch(_0xf96d07){return BPromise[_0x6953('0x24')](_0xf96d07);}return _0x41f021['save']();};}function saveUpdates(_0x317979,_0x40c9d1){return function(_0xb92529){if(_0xb92529){return _0xb92529[_0x6953('0x25')](_0x317979)['then'](function(_0x37f339){return _0x37f339;});}return null;};}function removeEntity(_0x231cb2,_0x2a7f6a){return function(_0x508ea7){if(_0x508ea7){return _0x508ea7['destroy']()['then'](function(){_0x231cb2[_0x6953('0x1b')](0xcc)[_0x6953('0x1c')]();});}};}function handleEntityNotFound(_0x550be4,_0x1a32f4){return function(_0x587df0){if(!_0x587df0){_0x550be4[_0x6953('0x1a')](0x194);}return _0x587df0;};}function handleError(_0x2bf39b,_0xcdbce8){_0xcdbce8=_0xcdbce8||0x1f4;return function(_0x2cc01e){logger[_0x6953('0x26')](_0x2cc01e[_0x6953('0x27')]);if(_0x2cc01e['name']){delete _0x2cc01e[_0x6953('0x28')];}_0x2bf39b[_0x6953('0x1b')](_0xcdbce8)['send'](_0x2cc01e);};}exports[_0x6953('0x29')]=function(_0x4af39d,_0x173b3c){var _0x3b1175={},_0x426c7c={},_0x4b0325={'count':0x0,'rows':[]};var _0x131992=_[_0x6953('0x2a')](db[_0x6953('0x2b')]['rawAttributes'],function(_0x4c49fc){return{'name':_0x4c49fc[_0x6953('0x2c')],'type':_0x4c49fc['type']['key']};});_0x426c7c[_0x6953('0x2d')]=_[_0x6953('0x2a')](_0x131992,_0x6953('0x28'));_0x426c7c[_0x6953('0x2e')]=_[_0x6953('0x2f')](_0x4af39d['query']);_0x426c7c[_0x6953('0x30')]=_['intersection'](_0x426c7c[_0x6953('0x2d')],_0x426c7c[_0x6953('0x2e')]);_0x3b1175['attributes']=_['intersection'](_0x426c7c[_0x6953('0x2d')],qs[_0x6953('0x31')](_0x4af39d[_0x6953('0x2e')]['fields']));_0x3b1175[_0x6953('0x32')]=_0x3b1175['attributes']['length']?_0x3b1175['attributes']:_0x426c7c['model'];if(!_0x4af39d[_0x6953('0x2e')][_0x6953('0x33')](_0x6953('0x34'))){_0x3b1175[_0x6953('0x20')]=qs[_0x6953('0x20')](_0x4af39d[_0x6953('0x2e')]['limit']);_0x3b1175[_0x6953('0x1e')]=qs['offset'](_0x4af39d[_0x6953('0x2e')]['offset']);}_0x3b1175[_0x6953('0x35')]=qs[_0x6953('0x36')](_0x4af39d[_0x6953('0x2e')][_0x6953('0x36')]);_0x3b1175['where']=qs[_0x6953('0x30')](_[_0x6953('0x37')](_0x4af39d[_0x6953('0x2e')],_0x426c7c[_0x6953('0x30')]),_0x131992);if(_0x4af39d[_0x6953('0x2e')][_0x6953('0x38')]){_0x3b1175[_0x6953('0x39')]=_[_0x6953('0x3a')](_0x3b1175[_0x6953('0x39')],{'$or':_[_0x6953('0x2a')](_0x131992,function(_0x2d9d81){if(_0x2d9d81['type']!==_0x6953('0x3b')){var _0x3c03ab={};_0x3c03ab[_0x2d9d81[_0x6953('0x28')]]={'$like':'%'+_0x4af39d['query']['filter']+'%'};return _0x3c03ab;}})});}_0x3b1175=_[_0x6953('0x3a')]({},_0x3b1175,_0x4af39d['options']);var _0x5abaf2={'where':_0x3b1175[_0x6953('0x39')]};return db[_0x6953('0x2b')]['count'](_0x5abaf2)[_0x6953('0x3c')](function(_0x263728){_0x4b0325[_0x6953('0x21')]=_0x263728;if(_0x4af39d[_0x6953('0x2e')][_0x6953('0x3d')]){_0x3b1175[_0x6953('0x3e')]=[{'all':!![]}];}return db['Integration'][_0x6953('0x3f')](_0x3b1175);})[_0x6953('0x3c')](function(_0x30a27a){_0x4b0325[_0x6953('0x40')]=_0x30a27a;return _0x4b0325;})[_0x6953('0x3c')](respondWithFilteredResult(_0x173b3c,_0x3b1175))[_0x6953('0x41')](handleError(_0x173b3c,null));};exports['show']=function(_0x5a40de,_0xeef91a){var _0x54d7c2={'raw':![],'where':{'id':_0x5a40de[_0x6953('0x42')]['id']}},_0x588ff8={};_0x588ff8[_0x6953('0x2d')]=_[_0x6953('0x2f')](db[_0x6953('0x2b')][_0x6953('0x43')]);_0x588ff8['query']=_['keys'](_0x5a40de[_0x6953('0x2e')]);_0x588ff8[_0x6953('0x30')]=_['intersection'](_0x588ff8[_0x6953('0x2d')],_0x588ff8['query']);_0x54d7c2[_0x6953('0x32')]=_[_0x6953('0x44')](_0x588ff8[_0x6953('0x2d')],qs[_0x6953('0x31')](_0x5a40de['query'][_0x6953('0x31')]));_0x54d7c2[_0x6953('0x32')]=_0x54d7c2['attributes'][_0x6953('0x45')]?_0x54d7c2[_0x6953('0x32')]:_0x588ff8[_0x6953('0x2d')];if(_0x5a40de[_0x6953('0x2e')][_0x6953('0x3d')]){_0x54d7c2[_0x6953('0x3e')]=[{'all':!![]}];}_0x54d7c2=_[_0x6953('0x3a')]({},_0x54d7c2,_0x5a40de[_0x6953('0x46')]);return db[_0x6953('0x2b')][_0x6953('0x47')](_0x54d7c2)[_0x6953('0x3c')](handleEntityNotFound(_0xeef91a,null))['then'](respondWithResult(_0xeef91a,null))[_0x6953('0x41')](handleError(_0xeef91a,null));};exports['create']=function(_0x15c142,_0x1d5979){return db[_0x6953('0x2b')]['create'](_0x15c142[_0x6953('0x48')],{})[_0x6953('0x3c')](respondWithResult(_0x1d5979,0xc9))['catch'](handleError(_0x1d5979,null));};exports['update']=function(_0xbf5b61,_0x265b44){if(_0xbf5b61[_0x6953('0x48')]['id']){delete _0xbf5b61[_0x6953('0x48')]['id'];}return db[_0x6953('0x2b')][_0x6953('0x47')]({'where':{'id':_0xbf5b61[_0x6953('0x42')]['id']}})[_0x6953('0x3c')](handleEntityNotFound(_0x265b44,null))[_0x6953('0x3c')](saveUpdates(_0xbf5b61[_0x6953('0x48')],null))[_0x6953('0x3c')](respondWithResult(_0x265b44,null))['catch'](handleError(_0x265b44,null));};exports['destroy']=function(_0x14a7bf,_0x38e3e8){return db[_0x6953('0x2b')][_0x6953('0x47')]({'where':{'id':_0x14a7bf[_0x6953('0x42')]['id']}})[_0x6953('0x3c')](handleEntityNotFound(_0x38e3e8,null))[_0x6953('0x3c')](removeEntity(_0x38e3e8,null))[_0x6953('0x41')](handleError(_0x38e3e8,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index f095aed..c3fe9af 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 _0xe7d3=['integrations','util','../../config/logger','api','moment','request-promise','rimraf','./integration.attributes'];(function(_0x4ddde5,_0x2c1b81){var _0x38616a=function(_0x11fddf){while(--_0x11fddf){_0x4ddde5['push'](_0x4ddde5['shift']());}};_0x38616a(++_0x2c1b81);}(_0xe7d3,0x191));var _0x3e7d=function(_0x546d77,_0x43cbd5){_0x546d77=_0x546d77-0x0;var _0x430a3c=_0xe7d3[_0x546d77];return _0x430a3c;};'use strict';var _=require('lodash');var util=require(_0x3e7d('0x0'));var logger=require(_0x3e7d('0x1'))(_0x3e7d('0x2'));var moment=require(_0x3e7d('0x3'));var BPromise=require('bluebird');var rp=require(_0x3e7d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3e7d('0x5'));var config=require('../../config/environment');var attributes=require(_0x3e7d('0x6'));module['exports']=function(_0x1d250c,_0x4c367b){return _0x1d250c['define']('Integration',attributes,{'tableName':_0x3e7d('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x78de=['integrations','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','Integration'];(function(_0x30b0fe,_0x542156){var _0x412d11=function(_0x39cf5d){while(--_0x39cf5d){_0x30b0fe['push'](_0x30b0fe['shift']());}};_0x412d11(++_0x542156);}(_0x78de,0x175));var _0xe78d=function(_0x2730ad,_0x4d247d){_0x2730ad=_0x2730ad-0x0;var _0x1d4363=_0x78de[_0x2730ad];return _0x1d4363;};'use strict';var _=require(_0xe78d('0x0'));var util=require(_0xe78d('0x1'));var logger=require(_0xe78d('0x2'))('api');var moment=require(_0xe78d('0x3'));var BPromise=require(_0xe78d('0x4'));var rp=require(_0xe78d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe78d('0x6'));var config=require(_0xe78d('0x7'));var attributes=require('./integration.attributes');module[_0xe78d('0x8')]=function(_0x340386,_0x59ab93){return _0x340386[_0xe78d('0x9')](_0xe78d('0xa'),attributes,{'tableName':_0xe78d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index f1d9efc..15afc14 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 _0x2542=['info','Integration,\x20%s,\x20%s','debug','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x2f8b77,_0x3b7310){var _0x161492=function(_0x100280){while(--_0x100280){_0x2f8b77['push'](_0x2f8b77['shift']());}};_0x161492(++_0x3b7310);}(_0x2542,0x169));var _0x2254=function(_0x39f2bf,_0x3357ae){_0x39f2bf=_0x39f2bf-0x0;var _0x18f124=_0x2542[_0x39f2bf];return _0x18f124;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var moment=require(_0x2254('0x2'));var BPromise=require(_0x2254('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2254('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2254('0x5'));var logger=require(_0x2254('0x6'))(_0x2254('0x7'));var config=require(_0x2254('0x8'));var jayson=require(_0x2254('0x9'));var client=jayson['client'][_0x2254('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe8ca50,_0x2ee7ee,_0x3c45ec){return new BPromise(function(_0x1637ad,_0x477b47){return client[_0x2254('0xb')](_0xe8ca50,_0x3c45ec)[_0x2254('0xc')](function(_0xb395da){logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,'request\x20sent');logger[_0x2254('0xf')](_0x2254('0x10'),_0x2ee7ee,_0x2254('0x11'),JSON[_0x2254('0x12')](_0xb395da));if(_0xb395da['error']){if(_0xb395da['error'][_0x2254('0x13')]===0x1f4){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);return _0x477b47(_0xb395da[_0x2254('0x14')]['message']);}logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da['error'][_0x2254('0x15')]);return _0x1637ad(_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);}else{logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,_0x2254('0x11'));_0x1637ad(_0xb395da['result'][_0x2254('0x15')]);}})['catch'](function(_0x327d6d){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0x327d6d);_0x477b47(_0x327d6d);});});} \ No newline at end of file +var _0x6d38=['request','then','Integration,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x1d50c1,_0x1e8b29){var _0x129602=function(_0x35c00d){while(--_0x35c00d){_0x1d50c1['push'](_0x1d50c1['shift']());}};_0x129602(++_0x1e8b29);}(_0x6d38,0x1ef));var _0x86d3=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x6d38[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require('lodash');var util=require(_0x86d3('0x0'));var moment=require(_0x86d3('0x1'));var BPromise=require(_0x86d3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x86d3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x86d3('0x4'))(_0x86d3('0x5'));var config=require(_0x86d3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x86d3('0x7')][_0x86d3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33d4aa,_0x2eaa15,_0x47e654){return new BPromise(function(_0x552b07,_0x2aea31){return client[_0x86d3('0x9')](_0x33d4aa,_0x47e654)[_0x86d3('0xa')](function(_0x499640){logger['info'](_0x86d3('0xb'),_0x2eaa15,_0x86d3('0xc'));logger['debug']('Integration,\x20%s,\x20%s,\x20%s',_0x2eaa15,_0x86d3('0xc'),JSON[_0x86d3('0xd')](_0x499640));if(_0x499640['error']){if(_0x499640[_0x86d3('0xe')]['code']===0x1f4){logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);return _0x2aea31(_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);}logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x499640['error'][_0x86d3('0xf')]);return _0x552b07(_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);}else{logger[_0x86d3('0x10')](_0x86d3('0xb'),_0x2eaa15,_0x86d3('0xc'));_0x552b07(_0x499640[_0x86d3('0x11')][_0x86d3('0xf')]);}})['catch'](function(_0x2d5ba9){logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x2d5ba9);_0x2aea31(_0x2d5ba9);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 6de504e..6ee8ab0 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 _0x4975=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x448890,_0x336ef0){var _0x56fd4d=function(_0x45297c){while(--_0x45297c){_0x448890['push'](_0x448890['shift']());}};_0x56fd4d(++_0x336ef0);}(_0x4975,0x86));var _0x5497=function(_0x2a1428,_0x108222){_0x2a1428=_0x2a1428-0x0;var _0x524e01=_0x4975[_0x2a1428];return _0x524e01;};'use strict';var multer=require(_0x5497('0x0'));var util=require('util');var path=require(_0x5497('0x1'));var timeout=require(_0x5497('0x2'));var express=require(_0x5497('0x3'));var router=express[_0x5497('0x4')]();var fs_extra=require(_0x5497('0x5'));var auth=require(_0x5497('0x6'));var interaction=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var controller=require(_0x5497('0x9'));router[_0x5497('0xa')]('/',auth['isAuthenticated'](),controller[_0x5497('0xb')]);router['get'](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0xe')]);router['get'](_0x5497('0xf'),auth['isAuthenticated'](),controller[_0x5497('0x10')]);router[_0x5497('0x11')]('/',auth[_0x5497('0xd')](),controller[_0x5497('0x12')]);router[_0x5497('0x13')](_0x5497('0xf'),auth[_0x5497('0xd')](),controller[_0x5497('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x5497('0x15')]);module[_0x5497('0x16')]=router; \ No newline at end of file +var _0xdb28=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','create','put','update'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xdb28,0x106));var _0x8db2=function(_0x2ea956,_0x4b9151){_0x2ea956=_0x2ea956-0x0;var _0x1c2eb6=_0xdb28[_0x2ea956];return _0x1c2eb6;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./integrationReport.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['post']('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0xf')]);router[_0x8db2('0x10')]('/:id',auth[_0x8db2('0xa')](),controller[_0x8db2('0x11')]);router['delete'](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x12')]);module[_0x8db2('0x13')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index d8cde92..c4e08ed 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 _0x3833=['DATE','INTEGER','BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED','FAILED','exports','STRING'];(function(_0x303986,_0x5c751c){var _0x4c4431=function(_0x161de3){while(--_0x161de3){_0x303986['push'](_0x303986['shift']());}};_0x4c4431(++_0x5c751c);}(_0x3833,0x127));var _0x3383=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0x3833[_0x38ced4];return _0x547c07;};'use strict';var Sequelize=require('sequelize');module[_0x3383('0x0')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x3383('0x1')]},'exitStatus':{'type':Sequelize[_0x3383('0x1')]},'ticketId':{'type':Sequelize[_0x3383('0x1')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x3383('0x1')]},'calleridnum':{'type':Sequelize[_0x3383('0x1')]},'calleridname':{'type':Sequelize[_0x3383('0x1')]},'queue':{'type':Sequelize[_0x3383('0x1')]},'interface':{'type':Sequelize[_0x3383('0x1')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x3383('0x2')]},'agentconnectAt':{'type':Sequelize[_0x3383('0x2')]},'holdtime':{'type':Sequelize[_0x3383('0x3')]},'agentcomplete':{'type':Sequelize[_0x3383('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x3383('0x3')]},'agentacw':{'type':Sequelize[_0x3383('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x3383('0x1')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x3383('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x3383('0x2')]},'lastevent':{'type':Sequelize[_0x3383('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x3383('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x3383('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x3383('0x1')]},'destchannel':{'type':Sequelize[_0x3383('0x1')]},'destchannelstate':{'type':Sequelize[_0x3383('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x3383('0x1')]},'destcalleridnum':{'type':Sequelize[_0x3383('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x3383('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x3383('0x1')]},'destlanguage':{'type':Sequelize[_0x3383('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x3383('0x1')]},'destpriority':{'type':Sequelize[_0x3383('0x1')]},'destuniqueid':{'type':Sequelize[_0x3383('0x1')]},'messageId':{'type':Sequelize[_0x3383('0x1')]},'inReplyTo':{'type':Sequelize[_0x3383('0x1')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0x3383('0x1')]},'to':{'type':Sequelize[_0x3383('0x1')]},'cc':{'type':Sequelize[_0x3383('0x1')]},'attachment':{'type':Sequelize[_0x3383('0x5')]},'html':{'type':Sequelize[_0x3383('0x5')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0x3383('0x6')](_0x3383('0x7'),_0x3383('0x8'),_0x3383('0x9'),_0x3383('0xa'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x3383('0x1')]},'projectId':{'type':Sequelize[_0x3383('0x3')]}}; \ No newline at end of file +var _0xd5f8=['ENUM','SENT','SENDING','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT'];(function(_0xfcebbb,_0x1949e5){var _0x487d29=function(_0x504b4d){while(--_0x504b4d){_0xfcebbb['push'](_0xfcebbb['shift']());}};_0x487d29(++_0x1949e5);}(_0xd5f8,0x1e9));var _0x8d5f=function(_0x43e34c,_0x3d93e5){_0x43e34c=_0x43e34c-0x0;var _0x35e8bb=_0xd5f8[_0x43e34c];return _0x35e8bb;};'use strict';var Sequelize=require('sequelize');module[_0x8d5f('0x0')]={'integration':{'type':Sequelize[_0x8d5f('0x1')]},'eventChannel':{'type':Sequelize[_0x8d5f('0x1')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0x8d5f('0x2')]},'contacts':{'type':Sequelize[_0x8d5f('0x1')]},'uniqueid':{'type':Sequelize[_0x8d5f('0x1')]},'calleridnum':{'type':Sequelize[_0x8d5f('0x1')]},'calleridname':{'type':Sequelize[_0x8d5f('0x1')]},'queue':{'type':Sequelize[_0x8d5f('0x1')]},'interface':{'type':Sequelize[_0x8d5f('0x1')]},'membername':{'type':Sequelize[_0x8d5f('0x1')]},'agentcalledAt':{'type':Sequelize[_0x8d5f('0x3')]},'agentconnectAt':{'type':Sequelize[_0x8d5f('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x8d5f('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x8d5f('0x2')]},'agentacw':{'type':Sequelize[_0x8d5f('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x8d5f('0x2')]},'reason':{'type':Sequelize[_0x8d5f('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x8d5f('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x8d5f('0x3')]},'agentdump':{'type':Sequelize[_0x8d5f('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x8d5f('0x1')]},'channel':{'type':Sequelize[_0x8d5f('0x1')]},'channelstate':{'type':Sequelize[_0x8d5f('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x8d5f('0x1')]},'connectedlinename':{'type':Sequelize[_0x8d5f('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x8d5f('0x1')]},'context':{'type':Sequelize[_0x8d5f('0x1')]},'exten':{'type':Sequelize[_0x8d5f('0x1')]},'priority':{'type':Sequelize[_0x8d5f('0x1')]},'destchannel':{'type':Sequelize[_0x8d5f('0x1')]},'destchannelstate':{'type':Sequelize[_0x8d5f('0x2')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x8d5f('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x8d5f('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x8d5f('0x1')]},'destcontext':{'type':Sequelize[_0x8d5f('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x8d5f('0x1')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x8d5f('0x1')]},'subject':{'type':Sequelize[_0x8d5f('0x1')]},'from':{'type':Sequelize[_0x8d5f('0x1')]},'to':{'type':Sequelize[_0x8d5f('0x1')]},'cc':{'type':Sequelize[_0x8d5f('0x1')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x8d5f('0x5')]},'text':{'type':Sequelize[_0x8d5f('0x5')]},'status':{'type':Sequelize[_0x8d5f('0x6')](_0x8d5f('0x7'),_0x8d5f('0x8'),'RECEIVED','FAILED')},'url':{'type':Sequelize[_0x8d5f('0x1')]},'app':{'type':Sequelize[_0x8d5f('0x1')]},'appdata':{'type':Sequelize[_0x8d5f('0x1')]},'projectId':{'type':Sequelize[_0x8d5f('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 0dede0e..d6c6eed 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 _0x1e82=['count','set','Content-Range','reject','save','update','then','end','stack','name','send','index','map','IntegrationReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','catch','show','params','length','create','body','find','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','limit'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x1e82,0x147));var _0x21e8=function(_0x31c1b2,_0x2e5355){_0x31c1b2=_0x31c1b2-0x0;var _0x801008=_0x1e82[_0x31c1b2];return _0x801008;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x21e8('0x0'));var zipdir=require(_0x21e8('0x1'));var jsonpatch=require(_0x21e8('0x2'));var rp=require(_0x21e8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x21e8('0x4'));var util=require('util');var path=require('path');var sox=require(_0x21e8('0x5'));var csv=require(_0x21e8('0x6'));var ejs=require(_0x21e8('0x7'));var fs=require('fs');var fs_extra=require(_0x21e8('0x8'));var _=require(_0x21e8('0x9'));var squel=require('squel');var crypto=require(_0x21e8('0xa'));var jsforce=require(_0x21e8('0xb'));var deskjs=require(_0x21e8('0xc'));var toCsv=require(_0x21e8('0x6'));var querystring=require(_0x21e8('0xd'));var Papa=require(_0x21e8('0xe'));var Redis=require(_0x21e8('0xf'));var authService=require(_0x21e8('0x10'));var qs=require(_0x21e8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x21e8('0x12'))(_0x21e8('0x13'));var utils=require(_0x21e8('0x14'));var config=require(_0x21e8('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x21e8('0x16'))['db'];function respondWithStatusCode(_0x4f63af,_0x1e7441){_0x1e7441=_0x1e7441||0xcc;return function(_0x5f25f7){if(_0x5f25f7){return _0x4f63af['sendStatus'](_0x1e7441);}return _0x4f63af[_0x21e8('0x17')](_0x1e7441)['end']();};}function respondWithResult(_0x2a1d59,_0x5772f3){_0x5772f3=_0x5772f3||0xc8;return function(_0x51ccf2){if(_0x51ccf2){return _0x2a1d59[_0x21e8('0x17')](_0x5772f3)[_0x21e8('0x18')](_0x51ccf2);}};}function respondWithFilteredResult(_0x163158,_0xbf4ad0){return function(_0x52d483){if(_0x52d483){var _0x5e7886=typeof _0xbf4ad0[_0x21e8('0x19')]===_0x21e8('0x1a')&&typeof _0xbf4ad0[_0x21e8('0x1b')]===_0x21e8('0x1a');var _0x542bc4=_0x52d483[_0x21e8('0x1c')];var _0x4481d2=_0x5e7886?0x0:_0xbf4ad0[_0x21e8('0x19')];var _0x3b4bda=_0x5e7886?_0x52d483[_0x21e8('0x1c')]:_0xbf4ad0[_0x21e8('0x19')]+_0xbf4ad0[_0x21e8('0x1b')];var _0x4028ce;if(_0x3b4bda>=_0x542bc4){_0x3b4bda=_0x542bc4;_0x4028ce=0xc8;}else{_0x4028ce=0xce;}_0x163158[_0x21e8('0x17')](_0x4028ce);return _0x163158[_0x21e8('0x1d')](_0x21e8('0x1e'),_0x4481d2+'-'+_0x3b4bda+'/'+_0x542bc4)['json'](_0x52d483);}return null;};}function patchUpdates(_0x42a112){return function(_0x2900ab){try{jsonpatch['apply'](_0x2900ab,_0x42a112,!![]);}catch(_0x47115b){return BPromise[_0x21e8('0x1f')](_0x47115b);}return _0x2900ab[_0x21e8('0x20')]();};}function saveUpdates(_0x261155,_0x1143ce){return function(_0x149173){if(_0x149173){return _0x149173[_0x21e8('0x21')](_0x261155)[_0x21e8('0x22')](function(_0x28b377){return _0x28b377;});}return null;};}function removeEntity(_0x234ddb,_0x3b6197){return function(_0x559329){if(_0x559329){return _0x559329['destroy']()[_0x21e8('0x22')](function(){_0x234ddb['status'](0xcc)[_0x21e8('0x23')]();});}};}function handleEntityNotFound(_0x1cd1a7,_0x5d92e1){return function(_0x4cb2b7){if(!_0x4cb2b7){_0x1cd1a7['sendStatus'](0x194);}return _0x4cb2b7;};}function handleError(_0x739c3d,_0x5d1e61){_0x5d1e61=_0x5d1e61||0x1f4;return function(_0x40f13e){logger['error'](_0x40f13e[_0x21e8('0x24')]);if(_0x40f13e['name']){delete _0x40f13e[_0x21e8('0x25')];}_0x739c3d[_0x21e8('0x17')](_0x5d1e61)[_0x21e8('0x26')](_0x40f13e);};}exports[_0x21e8('0x27')]=function(_0x343172,_0x11bdfc){var _0x5885f5={},_0x510b38={},_0x5d579a={'count':0x0,'rows':[]};var _0x482a5c=_[_0x21e8('0x28')](db[_0x21e8('0x29')][_0x21e8('0x2a')],function(_0x5003df){return{'name':_0x5003df['fieldName'],'type':_0x5003df[_0x21e8('0x2b')][_0x21e8('0x2c')]};});_0x510b38[_0x21e8('0x2d')]=_[_0x21e8('0x28')](_0x482a5c,_0x21e8('0x25'));_0x510b38[_0x21e8('0x2e')]=_[_0x21e8('0x2f')](_0x343172['query']);_0x510b38[_0x21e8('0x30')]=_[_0x21e8('0x31')](_0x510b38['model'],_0x510b38[_0x21e8('0x2e')]);_0x5885f5[_0x21e8('0x32')]=_[_0x21e8('0x31')](_0x510b38[_0x21e8('0x2d')],qs['fields'](_0x343172['query'][_0x21e8('0x33')]));_0x5885f5['attributes']=_0x5885f5[_0x21e8('0x32')]['length']?_0x5885f5[_0x21e8('0x32')]:_0x510b38['model'];if(!_0x343172[_0x21e8('0x2e')][_0x21e8('0x34')](_0x21e8('0x35'))){_0x5885f5[_0x21e8('0x1b')]=qs['limit'](_0x343172[_0x21e8('0x2e')][_0x21e8('0x1b')]);_0x5885f5['offset']=qs[_0x21e8('0x19')](_0x343172['query']['offset']);}_0x5885f5['order']=qs['sort'](_0x343172[_0x21e8('0x2e')]['sort']);_0x5885f5[_0x21e8('0x36')]=qs[_0x21e8('0x30')](_[_0x21e8('0x37')](_0x343172['query'],_0x510b38['filters']),_0x482a5c);if(_0x343172[_0x21e8('0x2e')][_0x21e8('0x38')]){_0x5885f5[_0x21e8('0x36')]=_['merge'](_0x5885f5['where'],{'$or':_[_0x21e8('0x28')](_0x482a5c,function(_0x1ef9ea){if(_0x1ef9ea[_0x21e8('0x2b')]!==_0x21e8('0x39')){var _0x26795b={};_0x26795b[_0x1ef9ea[_0x21e8('0x25')]]={'$like':'%'+_0x343172[_0x21e8('0x2e')][_0x21e8('0x38')]+'%'};return _0x26795b;}})});}_0x5885f5=_[_0x21e8('0x3a')]({},_0x5885f5,_0x343172['options']);var _0x33f867={'where':_0x5885f5[_0x21e8('0x36')]};return db[_0x21e8('0x29')][_0x21e8('0x1c')](_0x33f867)[_0x21e8('0x22')](function(_0x2c744f){_0x5d579a[_0x21e8('0x1c')]=_0x2c744f;if(_0x343172[_0x21e8('0x2e')][_0x21e8('0x3b')]){_0x5885f5[_0x21e8('0x3c')]=[{'all':!![]}];}return db['IntegrationReport'][_0x21e8('0x3d')](_0x5885f5);})[_0x21e8('0x22')](function(_0x10864a){_0x5d579a['rows']=_0x10864a;return _0x5d579a;})[_0x21e8('0x22')](respondWithFilteredResult(_0x11bdfc,_0x5885f5))[_0x21e8('0x3e')](handleError(_0x11bdfc,null));};exports[_0x21e8('0x3f')]=function(_0x537fda,_0x5eceee){var _0x19a932={'raw':![],'where':{'id':_0x537fda[_0x21e8('0x40')]['id']}},_0x5477e3={};_0x5477e3[_0x21e8('0x2d')]=_[_0x21e8('0x2f')](db[_0x21e8('0x29')]['rawAttributes']);_0x5477e3['query']=_[_0x21e8('0x2f')](_0x537fda[_0x21e8('0x2e')]);_0x5477e3[_0x21e8('0x30')]=_[_0x21e8('0x31')](_0x5477e3[_0x21e8('0x2d')],_0x5477e3[_0x21e8('0x2e')]);_0x19a932[_0x21e8('0x32')]=_['intersection'](_0x5477e3[_0x21e8('0x2d')],qs[_0x21e8('0x33')](_0x537fda[_0x21e8('0x2e')][_0x21e8('0x33')]));_0x19a932[_0x21e8('0x32')]=_0x19a932['attributes'][_0x21e8('0x41')]?_0x19a932[_0x21e8('0x32')]:_0x5477e3[_0x21e8('0x2d')];if(_0x537fda[_0x21e8('0x2e')][_0x21e8('0x3b')]){_0x19a932[_0x21e8('0x3c')]=[{'all':!![]}];}_0x19a932=_[_0x21e8('0x3a')]({},_0x19a932,_0x537fda['options']);return db[_0x21e8('0x29')]['find'](_0x19a932)[_0x21e8('0x22')](handleEntityNotFound(_0x5eceee,null))[_0x21e8('0x22')](respondWithResult(_0x5eceee,null))[_0x21e8('0x3e')](handleError(_0x5eceee,null));};exports[_0x21e8('0x42')]=function(_0x5263e8,_0x430e51){return db[_0x21e8('0x29')][_0x21e8('0x42')](_0x5263e8[_0x21e8('0x43')],{})[_0x21e8('0x22')](respondWithResult(_0x430e51,0xc9))['catch'](handleError(_0x430e51,null));};exports['update']=function(_0x4df165,_0xf037d4){if(_0x4df165[_0x21e8('0x43')]['id']){delete _0x4df165['body']['id'];}return db[_0x21e8('0x29')][_0x21e8('0x44')]({'where':{'id':_0x4df165[_0x21e8('0x40')]['id']}})[_0x21e8('0x22')](handleEntityNotFound(_0xf037d4,null))[_0x21e8('0x22')](saveUpdates(_0x4df165[_0x21e8('0x43')],null))[_0x21e8('0x22')](respondWithResult(_0xf037d4,null))['catch'](handleError(_0xf037d4,null));};exports[_0x21e8('0x45')]=function(_0x3985e6,_0x176a27){return db[_0x21e8('0x29')][_0x21e8('0x44')]({'where':{'id':_0x3985e6[_0x21e8('0x40')]['id']}})[_0x21e8('0x22')](handleEntityNotFound(_0x176a27,null))['then'](removeEntity(_0x176a27,null))['catch'](handleError(_0x176a27,null));};exports[_0x21e8('0x46')]=function(_0x22a1ba,_0x5188a4){return db['IntegrationReport']['describe']()[_0x21e8('0x22')](respondWithResult(_0x5188a4,null))[_0x21e8('0x3e')](handleError(_0x5188a4,null));}; \ No newline at end of file +var _0x7670=['zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','name','send','map','IntegrationReport','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','model','fields','hasOwnProperty','order','sort','where','filters','merge','VIRTUAL','options','includeAll','include','catch','show','find','create','body','params','describe','eml-format'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x7670,0x8f));var _0x0767=function(_0x552c03,_0x247fab){_0x552c03=_0x552c03-0x0;var _0x25e104=_0x7670[_0x552c03];return _0x25e104;};'use strict';var emlformat=require(_0x0767('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0767('0x1'));var jsonpatch=require(_0x0767('0x2'));var rp=require(_0x0767('0x3'));var moment=require(_0x0767('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0767('0x5'));var path=require('path');var sox=require(_0x0767('0x6'));var csv=require(_0x0767('0x7'));var ejs=require(_0x0767('0x8'));var fs=require('fs');var fs_extra=require(_0x0767('0x9'));var _=require(_0x0767('0xa'));var squel=require(_0x0767('0xb'));var crypto=require(_0x0767('0xc'));var jsforce=require(_0x0767('0xd'));var deskjs=require(_0x0767('0xe'));var toCsv=require(_0x0767('0x7'));var querystring=require(_0x0767('0xf'));var Papa=require(_0x0767('0x10'));var Redis=require(_0x0767('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x0767('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0767('0x13'));var logger=require('../../config/logger')(_0x0767('0x14'));var utils=require(_0x0767('0x15'));var config=require(_0x0767('0x16'));var licenseUtil=require(_0x0767('0x17'));var db=require(_0x0767('0x18'))['db'];function respondWithStatusCode(_0x440a2d,_0x4dbf91){_0x4dbf91=_0x4dbf91||0xcc;return function(_0x3feaf3){if(_0x3feaf3){return _0x440a2d[_0x0767('0x19')](_0x4dbf91);}return _0x440a2d[_0x0767('0x1a')](_0x4dbf91)[_0x0767('0x1b')]();};}function respondWithResult(_0x242132,_0x553a52){_0x553a52=_0x553a52||0xc8;return function(_0x544938){if(_0x544938){return _0x242132[_0x0767('0x1a')](_0x553a52)[_0x0767('0x1c')](_0x544938);}};}function respondWithFilteredResult(_0x4cd33f,_0x27850b){return function(_0x2e9615){if(_0x2e9615){var _0x3fcf8e=typeof _0x27850b[_0x0767('0x1d')]===_0x0767('0x1e')&&typeof _0x27850b['limit']===_0x0767('0x1e');var _0xb81ec3=_0x2e9615[_0x0767('0x1f')];var _0x462043=_0x3fcf8e?0x0:_0x27850b[_0x0767('0x1d')];var _0x13e943=_0x3fcf8e?_0x2e9615[_0x0767('0x1f')]:_0x27850b[_0x0767('0x1d')]+_0x27850b[_0x0767('0x20')];var _0x1c7b78;if(_0x13e943>=_0xb81ec3){_0x13e943=_0xb81ec3;_0x1c7b78=0xc8;}else{_0x1c7b78=0xce;}_0x4cd33f[_0x0767('0x1a')](_0x1c7b78);return _0x4cd33f[_0x0767('0x21')](_0x0767('0x22'),_0x462043+'-'+_0x13e943+'/'+_0xb81ec3)[_0x0767('0x1c')](_0x2e9615);}return null;};}function patchUpdates(_0x3b593f){return function(_0x49a2b7){try{jsonpatch[_0x0767('0x23')](_0x49a2b7,_0x3b593f,!![]);}catch(_0x3f037a){return BPromise[_0x0767('0x24')](_0x3f037a);}return _0x49a2b7[_0x0767('0x25')]();};}function saveUpdates(_0x71d2d5,_0xb4ca93){return function(_0x3a0990){if(_0x3a0990){return _0x3a0990[_0x0767('0x26')](_0x71d2d5)[_0x0767('0x27')](function(_0x287601){return _0x287601;});}return null;};}function removeEntity(_0x58fd4d,_0x20ef40){return function(_0x2f0faf){if(_0x2f0faf){return _0x2f0faf[_0x0767('0x28')]()[_0x0767('0x27')](function(){_0x58fd4d[_0x0767('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59c7fc,_0x58e38e){return function(_0x2a59a8){if(!_0x2a59a8){_0x59c7fc[_0x0767('0x19')](0x194);}return _0x2a59a8;};}function handleError(_0x5ddf36,_0x487cdc){_0x487cdc=_0x487cdc||0x1f4;return function(_0x38ae13){logger['error'](_0x38ae13['stack']);if(_0x38ae13[_0x0767('0x29')]){delete _0x38ae13[_0x0767('0x29')];}_0x5ddf36['status'](_0x487cdc)[_0x0767('0x2a')](_0x38ae13);};}exports['index']=function(_0x4cc5c8,_0x9a439e){var _0x1a3be3={},_0x16a469={},_0x2d191b={'count':0x0,'rows':[]};var _0x5d8c35=_[_0x0767('0x2b')](db[_0x0767('0x2c')][_0x0767('0x2d')],function(_0x2ec38c){return{'name':_0x2ec38c[_0x0767('0x2e')],'type':_0x2ec38c[_0x0767('0x2f')][_0x0767('0x30')]};});_0x16a469['model']=_[_0x0767('0x2b')](_0x5d8c35,_0x0767('0x29'));_0x16a469[_0x0767('0x31')]=_[_0x0767('0x32')](_0x4cc5c8[_0x0767('0x31')]);_0x16a469['filters']=_[_0x0767('0x33')](_0x16a469['model'],_0x16a469[_0x0767('0x31')]);_0x1a3be3[_0x0767('0x34')]=_[_0x0767('0x33')](_0x16a469[_0x0767('0x35')],qs[_0x0767('0x36')](_0x4cc5c8[_0x0767('0x31')][_0x0767('0x36')]));_0x1a3be3[_0x0767('0x34')]=_0x1a3be3['attributes']['length']?_0x1a3be3[_0x0767('0x34')]:_0x16a469[_0x0767('0x35')];if(!_0x4cc5c8['query'][_0x0767('0x37')]('nolimit')){_0x1a3be3['limit']=qs[_0x0767('0x20')](_0x4cc5c8[_0x0767('0x31')][_0x0767('0x20')]);_0x1a3be3['offset']=qs[_0x0767('0x1d')](_0x4cc5c8['query']['offset']);}_0x1a3be3[_0x0767('0x38')]=qs[_0x0767('0x39')](_0x4cc5c8[_0x0767('0x31')][_0x0767('0x39')]);_0x1a3be3[_0x0767('0x3a')]=qs[_0x0767('0x3b')](_['pick'](_0x4cc5c8['query'],_0x16a469[_0x0767('0x3b')]),_0x5d8c35);if(_0x4cc5c8[_0x0767('0x31')]['filter']){_0x1a3be3[_0x0767('0x3a')]=_[_0x0767('0x3c')](_0x1a3be3[_0x0767('0x3a')],{'$or':_[_0x0767('0x2b')](_0x5d8c35,function(_0x28b5fa){if(_0x28b5fa['type']!==_0x0767('0x3d')){var _0x2e9063={};_0x2e9063[_0x28b5fa['name']]={'$like':'%'+_0x4cc5c8[_0x0767('0x31')]['filter']+'%'};return _0x2e9063;}})});}_0x1a3be3=_[_0x0767('0x3c')]({},_0x1a3be3,_0x4cc5c8[_0x0767('0x3e')]);var _0x492195={'where':_0x1a3be3[_0x0767('0x3a')]};return db[_0x0767('0x2c')]['count'](_0x492195)[_0x0767('0x27')](function(_0x4a5606){_0x2d191b[_0x0767('0x1f')]=_0x4a5606;if(_0x4cc5c8[_0x0767('0x31')][_0x0767('0x3f')]){_0x1a3be3[_0x0767('0x40')]=[{'all':!![]}];}return db[_0x0767('0x2c')]['findAll'](_0x1a3be3);})[_0x0767('0x27')](function(_0xb9ba97){_0x2d191b['rows']=_0xb9ba97;return _0x2d191b;})[_0x0767('0x27')](respondWithFilteredResult(_0x9a439e,_0x1a3be3))[_0x0767('0x41')](handleError(_0x9a439e,null));};exports[_0x0767('0x42')]=function(_0x4497ff,_0x1254f0){var _0x25a053={'raw':![],'where':{'id':_0x4497ff['params']['id']}},_0x1b2505={};_0x1b2505[_0x0767('0x35')]=_[_0x0767('0x32')](db['IntegrationReport'][_0x0767('0x2d')]);_0x1b2505[_0x0767('0x31')]=_[_0x0767('0x32')](_0x4497ff[_0x0767('0x31')]);_0x1b2505[_0x0767('0x3b')]=_[_0x0767('0x33')](_0x1b2505[_0x0767('0x35')],_0x1b2505['query']);_0x25a053[_0x0767('0x34')]=_['intersection'](_0x1b2505[_0x0767('0x35')],qs['fields'](_0x4497ff[_0x0767('0x31')][_0x0767('0x36')]));_0x25a053[_0x0767('0x34')]=_0x25a053[_0x0767('0x34')]['length']?_0x25a053[_0x0767('0x34')]:_0x1b2505['model'];if(_0x4497ff[_0x0767('0x31')][_0x0767('0x3f')]){_0x25a053[_0x0767('0x40')]=[{'all':!![]}];}_0x25a053=_['merge']({},_0x25a053,_0x4497ff[_0x0767('0x3e')]);return db[_0x0767('0x2c')][_0x0767('0x43')](_0x25a053)[_0x0767('0x27')](handleEntityNotFound(_0x1254f0,null))[_0x0767('0x27')](respondWithResult(_0x1254f0,null))[_0x0767('0x41')](handleError(_0x1254f0,null));};exports[_0x0767('0x44')]=function(_0xe36419,_0x49eab2){return db[_0x0767('0x2c')][_0x0767('0x44')](_0xe36419[_0x0767('0x45')],{})[_0x0767('0x27')](respondWithResult(_0x49eab2,0xc9))[_0x0767('0x41')](handleError(_0x49eab2,null));};exports[_0x0767('0x26')]=function(_0x7d4d51,_0x5e8855){if(_0x7d4d51[_0x0767('0x45')]['id']){delete _0x7d4d51[_0x0767('0x45')]['id'];}return db[_0x0767('0x2c')]['find']({'where':{'id':_0x7d4d51[_0x0767('0x46')]['id']}})['then'](handleEntityNotFound(_0x5e8855,null))[_0x0767('0x27')](saveUpdates(_0x7d4d51['body'],null))[_0x0767('0x27')](respondWithResult(_0x5e8855,null))[_0x0767('0x41')](handleError(_0x5e8855,null));};exports[_0x0767('0x28')]=function(_0x4418cb,_0x30e2d5){return db[_0x0767('0x2c')][_0x0767('0x43')]({'where':{'id':_0x4418cb[_0x0767('0x46')]['id']}})[_0x0767('0x27')](handleEntityNotFound(_0x30e2d5,null))['then'](removeEntity(_0x30e2d5,null))[_0x0767('0x41')](handleError(_0x30e2d5,null));};exports[_0x0767('0x47')]=function(_0x1a45b0,_0x460ba7){return db['IntegrationReport'][_0x0767('0x47')]()['then'](respondWithResult(_0x460ba7,null))[_0x0767('0x41')](handleError(_0x460ba7,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 75116dd..00cb45d 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 _0xd640=['../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./integrationReport.attributes','exports','define','lodash'];(function(_0x21cda3,_0x17b90a){var _0x558dc3=function(_0x3dc416){while(--_0x3dc416){_0x21cda3['push'](_0x21cda3['shift']());}};_0x558dc3(++_0x17b90a);}(_0xd640,0x1f3));var _0x0d64=function(_0x1cad3f,_0x1d1fa7){_0x1cad3f=_0x1cad3f-0x0;var _0x386e05=_0xd640[_0x1cad3f];return _0x386e05;};'use strict';var _=require(_0x0d64('0x0'));var util=require('util');var logger=require(_0x0d64('0x1'))('api');var moment=require(_0x0d64('0x2'));var BPromise=require(_0x0d64('0x3'));var rp=require(_0x0d64('0x4'));var fs=require('fs');var path=require(_0x0d64('0x5'));var rimraf=require('rimraf');var config=require(_0x0d64('0x6'));var attributes=require(_0x0d64('0x7'));module[_0x0d64('0x8')]=function(_0x2ab56e,_0x551900){return _0x2ab56e[_0x0d64('0x9')]('IntegrationReport',attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd676=['report_integration','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','IntegrationReport'];(function(_0x21d584,_0x5b82c2){var _0x55ac42=function(_0x52f581){while(--_0x52f581){_0x21d584['push'](_0x21d584['shift']());}};_0x55ac42(++_0x5b82c2);}(_0xd676,0x1e1));var _0x6d67=function(_0x2b7dcf,_0x4f9a4f){_0x2b7dcf=_0x2b7dcf-0x0;var _0x448baf=_0xd676[_0x2b7dcf];return _0x448baf;};'use strict';var _=require(_0x6d67('0x0'));var util=require('util');var logger=require(_0x6d67('0x1'))('api');var moment=require(_0x6d67('0x2'));var BPromise=require(_0x6d67('0x3'));var rp=require(_0x6d67('0x4'));var fs=require('fs');var path=require(_0x6d67('0x5'));var rimraf=require(_0x6d67('0x6'));var config=require(_0x6d67('0x7'));var attributes=require('./integrationReport.attributes');module[_0x6d67('0x8')]=function(_0x5c5c2f,_0x3811f7){return _0x5c5c2f[_0x6d67('0x9')](_0x6d67('0xa'),attributes,{'tableName':_0x6d67('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index cbcee44..f7db326 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 _0x4137=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','IntegrationReport,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x4137,0xf8));var _0x7413=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x4137[_0x27af45];return _0x18df21;};'use strict';var _=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var moment=require(_0x7413('0x2'));var BPromise=require(_0x7413('0x3'));var rs=require(_0x7413('0x4'));var fs=require('fs');var Redis=require(_0x7413('0x5'));var db=require(_0x7413('0x6'))['db'];var utils=require(_0x7413('0x7'));var logger=require(_0x7413('0x8'))(_0x7413('0x9'));var config=require(_0x7413('0xa'));var jayson=require(_0x7413('0xb'));var client=jayson['client'][_0x7413('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x188d89,_0x5b39ac,_0x15af0d){return new BPromise(function(_0x5f4cd0,_0x3236ec){return client[_0x7413('0xd')](_0x188d89,_0x15af0d)['then'](function(_0x422bf5){logger[_0x7413('0xe')]('IntegrationReport,\x20%s,\x20%s',_0x5b39ac,_0x7413('0xf'));logger[_0x7413('0x10')](_0x7413('0x11'),_0x5b39ac,_0x7413('0xf'),JSON[_0x7413('0x12')](_0x422bf5));if(_0x422bf5['error']){if(_0x422bf5[_0x7413('0x13')][_0x7413('0x14')]===0x1f4){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);return _0x3236ec(_0x422bf5['error']['message']);}logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')]['message']);return _0x5f4cd0(_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);}else{logger['info'](_0x7413('0x15'),_0x5b39ac,'request\x20sent');_0x5f4cd0(_0x422bf5['result'][_0x7413('0x16')]);}})['catch'](function(_0x195c72){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x195c72);_0x3236ec(_0x195c72);});});} \ No newline at end of file +var _0xda19=['error','message','info','result','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3ce85e,_0x2b8488){var _0x4e4f12=function(_0xe252f8){while(--_0xe252f8){_0x3ce85e['push'](_0x3ce85e['shift']());}};_0x4e4f12(++_0x2b8488);}(_0xda19,0xd5));var _0x9da1=function(_0x25929f,_0x1e7561){_0x25929f=_0x25929f-0x0;var _0x2d1664=_0xda19[_0x25929f];return _0x2d1664;};'use strict';var _=require('lodash');var util=require(_0x9da1('0x0'));var moment=require(_0x9da1('0x1'));var BPromise=require('bluebird');var rs=require(_0x9da1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9da1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9da1('0x4'))(_0x9da1('0x5'));var config=require(_0x9da1('0x6'));var jayson=require(_0x9da1('0x7'));var client=jayson[_0x9da1('0x8')][_0x9da1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x23e4f7,_0x2c3cdd,_0x1c24e6){return new BPromise(function(_0x5e2d18,_0x47df89){return client['request'](_0x23e4f7,_0x1c24e6)['then'](function(_0x417312){logger['info'](_0x9da1('0xa'),_0x2c3cdd,_0x9da1('0xb'));logger[_0x9da1('0xc')](_0x9da1('0xd'),_0x2c3cdd,_0x9da1('0xb'),JSON[_0x9da1('0xe')](_0x417312));if(_0x417312[_0x9da1('0xf')]){if(_0x417312['error']['code']===0x1f4){logger[_0x9da1('0xf')]('IntegrationReport,\x20%s,\x20%s',_0x2c3cdd,_0x417312[_0x9da1('0xf')][_0x9da1('0x10')]);return _0x47df89(_0x417312[_0x9da1('0xf')][_0x9da1('0x10')]);}logger['error'](_0x9da1('0xa'),_0x2c3cdd,_0x417312['error']['message']);return _0x5e2d18(_0x417312[_0x9da1('0xf')]['message']);}else{logger[_0x9da1('0x11')](_0x9da1('0xa'),_0x2c3cdd,_0x9da1('0xb'));_0x5e2d18(_0x417312[_0x9da1('0x12')][_0x9da1('0x10')]);}})['catch'](function(_0x16f75a){logger[_0x9da1('0xf')](_0x9da1('0xa'),_0x2c3cdd,_0x16f75a);_0x47df89(_0x16f75a);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 1aa2017..b8f2ffe 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 _0x1a61=['delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','./interval.controller','get','index','/:id','isAuthenticated','show','/:id/sub_intervals','getIntervals','post','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update'];(function(_0x33bc64,_0x4d1e92){var _0x3fdd34=function(_0x4b40a4){while(--_0x4b40a4){_0x33bc64['push'](_0x33bc64['shift']());}};_0x3fdd34(++_0x4d1e92);}(_0x1a61,0x1e6));var _0x11a6=function(_0x5049f6,_0x555c8c){_0x5049f6=_0x5049f6-0x0;var _0x3d1ce7=_0x1a61[_0x5049f6];return _0x3d1ce7;};'use strict';var multer=require(_0x11a6('0x0'));var util=require('util');var path=require(_0x11a6('0x1'));var timeout=require('connect-timeout');var express=require(_0x11a6('0x2'));var router=express[_0x11a6('0x3')]();var fs_extra=require(_0x11a6('0x4'));var auth=require(_0x11a6('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x11a6('0x6'));router[_0x11a6('0x7')]('/',auth['isAuthenticated'](),controller[_0x11a6('0x8')]);router[_0x11a6('0x7')](_0x11a6('0x9'),auth[_0x11a6('0xa')](),controller[_0x11a6('0xb')]);router[_0x11a6('0x7')](_0x11a6('0xc'),auth[_0x11a6('0xa')](),controller[_0x11a6('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x11a6('0xe')](_0x11a6('0xc'),auth['isAuthenticated'](),controller[_0x11a6('0xf')]);router[_0x11a6('0xe')](_0x11a6('0x10'),auth[_0x11a6('0xa')](),controller[_0x11a6('0x11')]);router[_0x11a6('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x11a6('0x13')]);router[_0x11a6('0x14')]('/:id',auth[_0x11a6('0xa')](),controller[_0x11a6('0x15')]);module['exports']=router; \ No newline at end of file +var _0x0be3=['./interval.controller','index','get','isAuthenticated','show','getIntervals','post','/:id/sub_intervals/create_many','addIntervals','put','/:id','update','delete','exports','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x11ecea,_0xac684e){var _0x3c033b=function(_0x5926a1){while(--_0x5926a1){_0x11ecea['push'](_0x11ecea['shift']());}};_0x3c033b(++_0xac684e);}(_0x0be3,0x9a));var _0x30be=function(_0x3005d5,_0xf588c7){_0x3005d5=_0x3005d5-0x0;var _0x547c7e=_0x0be3[_0x3005d5];return _0x547c7e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x30be('0x0'));var timeout=require(_0x30be('0x1'));var express=require(_0x30be('0x2'));var router=express['Router']();var fs_extra=require(_0x30be('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x30be('0x4'));var config=require(_0x30be('0x5'));var controller=require(_0x30be('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x30be('0x7')]);router[_0x30be('0x8')]('/:id',auth[_0x30be('0x9')](),controller[_0x30be('0xa')]);router[_0x30be('0x8')]('/:id/sub_intervals',auth[_0x30be('0x9')](),controller[_0x30be('0xb')]);router[_0x30be('0xc')]('/',auth[_0x30be('0x9')](),controller['create']);router['post']('/:id/sub_intervals',auth[_0x30be('0x9')](),controller['addInterval']);router[_0x30be('0xc')](_0x30be('0xd'),auth[_0x30be('0x9')](),controller[_0x30be('0xe')]);router[_0x30be('0xf')](_0x30be('0x10'),auth[_0x30be('0x9')](),controller[_0x30be('0x11')]);router[_0x30be('0x12')]('/:id',auth[_0x30be('0x9')](),controller['destroy']);module[_0x30be('0x13')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index d661a44..77467b3 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 _0x1726=['sequelize','exports','STRING'];(function(_0x4b7b69,_0x3ab075){var _0x173b4c=function(_0x234d5f){while(--_0x234d5f){_0x4b7b69['push'](_0x4b7b69['shift']());}};_0x173b4c(++_0x3ab075);}(_0x1726,0x147));var _0x6172=function(_0x11f226,_0x491e30){_0x11f226=_0x11f226-0x0;var _0x30be77=_0x1726[_0x11f226];return _0x30be77;};'use strict';var Sequelize=require(_0x6172('0x0'));module[_0x6172('0x1')]={'name':{'type':Sequelize[_0x6172('0x2')]},'description':{'type':Sequelize[_0x6172('0x2')]},'interval':{'type':Sequelize[_0x6172('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xf29e=['STRING'];(function(_0x2606bd,_0x31d50f){var _0x676e0=function(_0x204b97){while(--_0x204b97){_0x2606bd['push'](_0x2606bd['shift']());}};_0x676e0(++_0x31d50f);}(_0xf29e,0x1b9));var _0xef29=function(_0x2b7e95,_0x17629b){_0x2b7e95=_0x2b7e95-0x0;var _0x2a719d=_0xf29e[_0x2b7e95];return _0x2a719d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xef29('0x0')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 6baca95..b1eb1bc 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 _0xa836=['Intervals','UserProfileResource','error','stack','name','send','index','map','Interval','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','catch','findOne','getIntervals','hasOwnProperty','addIntervals','sequelize','transaction','IntervalId','bulkCreate','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','then','destroy','get'];(function(_0x401bd3,_0x28e4b4){var _0x3eea93=function(_0x2950ef){while(--_0x2950ef){_0x401bd3['push'](_0x401bd3['shift']());}};_0x3eea93(++_0x28e4b4);}(_0xa836,0x13c));var _0x6a83=function(_0x14e77f,_0x1fc854){_0x14e77f=_0x14e77f-0x0;var _0x455172=_0xa836[_0x14e77f];return _0x455172;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6a83('0x0'));var zipdir=require(_0x6a83('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6a83('0x2'));var moment=require(_0x6a83('0x3'));var BPromise=require(_0x6a83('0x4'));var Mustache=require('mustache');var util=require(_0x6a83('0x5'));var path=require('path');var sox=require(_0x6a83('0x6'));var csv=require(_0x6a83('0x7'));var ejs=require(_0x6a83('0x8'));var fs=require('fs');var fs_extra=require(_0x6a83('0x9'));var _=require('lodash');var squel=require(_0x6a83('0xa'));var crypto=require(_0x6a83('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6a83('0x7'));var querystring=require('querystring');var Papa=require(_0x6a83('0xc'));var Redis=require(_0x6a83('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x6a83('0xe'));var as=require(_0x6a83('0xf'));var hardwareService=require(_0x6a83('0x10'));var logger=require(_0x6a83('0x11'))(_0x6a83('0x12'));var utils=require(_0x6a83('0x13'));var config=require(_0x6a83('0x14'));var licenseUtil=require(_0x6a83('0x15'));var db=require('../../mysqldb')['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x3a708f,_0x57a746){_0x57a746=_0x57a746||0xcc;return function(_0x41b87f){if(_0x41b87f){return _0x3a708f[_0x6a83('0x16')](_0x57a746);}return _0x3a708f[_0x6a83('0x17')](_0x57a746)[_0x6a83('0x18')]();};}function respondWithResult(_0x320d08,_0x33e735){_0x33e735=_0x33e735||0xc8;return function(_0x56dddb){if(_0x56dddb){return _0x320d08['status'](_0x33e735)[_0x6a83('0x19')](_0x56dddb);}};}function respondWithFilteredResult(_0x11633e,_0x498b25){return function(_0x13d675){if(_0x13d675){var _0x5d0d14=typeof _0x498b25[_0x6a83('0x1a')]==='undefined'&&typeof _0x498b25[_0x6a83('0x1b')]===_0x6a83('0x1c');var _0x345b21=_0x13d675[_0x6a83('0x1d')];var _0x459bff=_0x5d0d14?0x0:_0x498b25[_0x6a83('0x1a')];var _0x1daf60=_0x5d0d14?_0x13d675[_0x6a83('0x1d')]:_0x498b25['offset']+_0x498b25[_0x6a83('0x1b')];var _0x5d9906;if(_0x1daf60>=_0x345b21){_0x1daf60=_0x345b21;_0x5d9906=0xc8;}else{_0x5d9906=0xce;}_0x11633e['status'](_0x5d9906);return _0x11633e[_0x6a83('0x1e')](_0x6a83('0x1f'),_0x459bff+'-'+_0x1daf60+'/'+_0x345b21)[_0x6a83('0x19')](_0x13d675);}return null;};}function patchUpdates(_0x30bf53){return function(_0x26c98f){try{jsonpatch['apply'](_0x26c98f,_0x30bf53,!![]);}catch(_0x340df7){return BPromise[_0x6a83('0x20')](_0x340df7);}return _0x26c98f['save']();};}function saveUpdates(_0x3c9770,_0x426856){return function(_0x4a2483){if(_0x4a2483){return _0x4a2483['update'](_0x3c9770)[_0x6a83('0x21')](function(_0x1c7259){return _0x1c7259;});}return null;};}function removeEntity(_0x7485ef,_0x3bfa99){return function(_0x2573b6){if(_0x2573b6){return _0x2573b6[_0x6a83('0x22')]()[_0x6a83('0x21')](function(){var _0x3deafe=_0x2573b6[_0x6a83('0x23')]({'plain':!![]});var _0x4821b2=_0x6a83('0x24');return db[_0x6a83('0x25')][_0x6a83('0x22')]({'where':{'type':_0x4821b2,'resourceId':_0x3deafe['id']}})[_0x6a83('0x21')](function(){return _0x2573b6;});})[_0x6a83('0x21')](function(){_0x7485ef[_0x6a83('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3204ce,_0x5204d2){return function(_0x504452){if(!_0x504452){_0x3204ce[_0x6a83('0x16')](0x194);}return _0x504452;};}function handleError(_0x3480f5,_0x3c5215){_0x3c5215=_0x3c5215||0x1f4;return function(_0x386552){logger[_0x6a83('0x26')](_0x386552[_0x6a83('0x27')]);if(_0x386552[_0x6a83('0x28')]){delete _0x386552['name'];}_0x3480f5[_0x6a83('0x17')](_0x3c5215)[_0x6a83('0x29')](_0x386552);};}exports[_0x6a83('0x2a')]=function(_0x137d7d,_0x3a6bd8){var _0x48381f={},_0x46cedc={},_0x17c86c={'count':0x0,'rows':[]};var _0x1bc432=_[_0x6a83('0x2b')](db[_0x6a83('0x2c')][_0x6a83('0x2d')],function(_0x477524){return{'name':_0x477524[_0x6a83('0x2e')],'type':_0x477524[_0x6a83('0x2f')][_0x6a83('0x30')]};});_0x46cedc[_0x6a83('0x31')]=_[_0x6a83('0x2b')](_0x1bc432,_0x6a83('0x28'));_0x46cedc[_0x6a83('0x32')]=_[_0x6a83('0x33')](_0x137d7d[_0x6a83('0x32')]);_0x46cedc[_0x6a83('0x34')]=_[_0x6a83('0x35')](_0x46cedc['model'],_0x46cedc[_0x6a83('0x32')]);_0x48381f[_0x6a83('0x36')]=_[_0x6a83('0x35')](_0x46cedc['model'],qs[_0x6a83('0x37')](_0x137d7d[_0x6a83('0x32')][_0x6a83('0x37')]));_0x48381f[_0x6a83('0x36')]=_0x48381f['attributes'][_0x6a83('0x38')]?_0x48381f[_0x6a83('0x36')]:_0x46cedc[_0x6a83('0x31')];if(!_0x137d7d[_0x6a83('0x32')]['hasOwnProperty'](_0x6a83('0x39'))){_0x48381f['limit']=qs[_0x6a83('0x1b')](_0x137d7d[_0x6a83('0x32')]['limit']);_0x48381f[_0x6a83('0x1a')]=qs[_0x6a83('0x1a')](_0x137d7d[_0x6a83('0x32')][_0x6a83('0x1a')]);}_0x48381f[_0x6a83('0x3a')]=qs[_0x6a83('0x3b')](_0x137d7d[_0x6a83('0x32')][_0x6a83('0x3b')]);_0x48381f[_0x6a83('0x3c')]=qs[_0x6a83('0x34')](_[_0x6a83('0x3d')](_0x137d7d[_0x6a83('0x32')],_0x46cedc[_0x6a83('0x34')]),_0x1bc432);if(_0x137d7d['query'][_0x6a83('0x3e')]){_0x48381f[_0x6a83('0x3c')]=_[_0x6a83('0x3f')](_0x48381f[_0x6a83('0x3c')],{'$or':_['map'](_0x1bc432,function(_0x470308){if(_0x470308['type']!=='VIRTUAL'){var _0x2c16d5={};_0x2c16d5[_0x470308[_0x6a83('0x28')]]={'$like':'%'+_0x137d7d[_0x6a83('0x32')][_0x6a83('0x3e')]+'%'};return _0x2c16d5;}})});}_0x48381f=_[_0x6a83('0x3f')]({},_0x48381f,_0x137d7d['options']);var _0x4aef23={'where':_0x48381f['where']};return db['Interval'][_0x6a83('0x1d')](_0x4aef23)[_0x6a83('0x21')](function(_0x4a4b99){_0x17c86c[_0x6a83('0x1d')]=_0x4a4b99;if(_0x137d7d[_0x6a83('0x32')][_0x6a83('0x40')]){_0x48381f[_0x6a83('0x41')]=[{'all':!![]}];}return db['Interval'][_0x6a83('0x42')](_0x48381f);})[_0x6a83('0x21')](function(_0x330ddb){_0x17c86c[_0x6a83('0x43')]=_0x330ddb;return _0x17c86c;})['then'](respondWithFilteredResult(_0x3a6bd8,_0x48381f))['catch'](handleError(_0x3a6bd8,null));};exports[_0x6a83('0x44')]=function(_0x261287,_0x2a70e6){var _0x284011={'raw':!![],'where':{'id':_0x261287[_0x6a83('0x45')]['id']}},_0xfd313e={};_0xfd313e[_0x6a83('0x31')]=_[_0x6a83('0x33')](db[_0x6a83('0x2c')]['rawAttributes']);_0xfd313e[_0x6a83('0x32')]=_[_0x6a83('0x33')](_0x261287[_0x6a83('0x32')]);_0xfd313e[_0x6a83('0x34')]=_[_0x6a83('0x35')](_0xfd313e[_0x6a83('0x31')],_0xfd313e['query']);_0x284011[_0x6a83('0x36')]=_[_0x6a83('0x35')](_0xfd313e[_0x6a83('0x31')],qs[_0x6a83('0x37')](_0x261287[_0x6a83('0x32')][_0x6a83('0x37')]));_0x284011['attributes']=_0x284011['attributes'][_0x6a83('0x38')]?_0x284011['attributes']:_0xfd313e[_0x6a83('0x31')];if(_0x261287[_0x6a83('0x32')]['includeAll']){_0x284011[_0x6a83('0x41')]=[{'all':!![]}];}_0x284011=_[_0x6a83('0x3f')]({},_0x284011,_0x261287[_0x6a83('0x46')]);return db[_0x6a83('0x2c')][_0x6a83('0x47')](_0x284011)[_0x6a83('0x21')](handleEntityNotFound(_0x2a70e6,null))[_0x6a83('0x21')](respondWithResult(_0x2a70e6,null))['catch'](handleError(_0x2a70e6,null));};exports[_0x6a83('0x48')]=function(_0x2f0b01,_0x53a248){return db['Interval']['create'](_0x2f0b01[_0x6a83('0x49')],{})[_0x6a83('0x21')](function(_0x1959cb){var _0x339746=_0x2f0b01[_0x6a83('0x4a')][_0x6a83('0x23')]({'plain':!![]});if(!_0x339746)throw new Error(_0x6a83('0x4b'));if(_0x339746[_0x6a83('0x4c')]==='user'){var _0x2c4c42=_0x1959cb['get']({'plain':!![]});var _0x14116c=_0x6a83('0x24');return db[_0x6a83('0x4d')][_0x6a83('0x47')]({'where':{'name':_0x14116c,'userProfileId':_0x339746['userProfileId']},'raw':!![]})[_0x6a83('0x21')](function(_0x5a9fa7){if(_0x5a9fa7&&_0x5a9fa7[_0x6a83('0x4e')]===0x0){return db[_0x6a83('0x25')][_0x6a83('0x48')]({'name':_0x2c4c42[_0x6a83('0x28')],'resourceId':_0x2c4c42['id'],'type':_0x5a9fa7[_0x6a83('0x28')],'sectionId':_0x5a9fa7['id']},{})[_0x6a83('0x21')](function(){return _0x1959cb;});}else{return _0x1959cb;}})[_0x6a83('0x4f')](function(_0x52679f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x52679f);throw _0x52679f;});}return _0x1959cb;})[_0x6a83('0x21')](respondWithResult(_0x53a248,0xc9))[_0x6a83('0x4f')](handleError(_0x53a248,null));};exports['update']=function(_0x23f82d,_0x8b48eb){if(_0x23f82d['body']['id']){delete _0x23f82d[_0x6a83('0x49')]['id'];}return db[_0x6a83('0x2c')][_0x6a83('0x47')]({'where':{'id':_0x23f82d[_0x6a83('0x45')]['id']}})['then'](handleEntityNotFound(_0x8b48eb,null))[_0x6a83('0x21')](saveUpdates(_0x23f82d[_0x6a83('0x49')],null))['then'](respondWithResult(_0x8b48eb,null))['catch'](handleError(_0x8b48eb,null));};exports[_0x6a83('0x22')]=function(_0x73a75a,_0xcf5a89){return db['Interval'][_0x6a83('0x47')]({'where':{'id':_0x73a75a[_0x6a83('0x45')]['id']}})['then'](handleEntityNotFound(_0xcf5a89,null))[_0x6a83('0x21')](removeEntity(_0xcf5a89,null))[_0x6a83('0x4f')](handleError(_0xcf5a89,null));};exports['addInterval']=function(_0x43573b,_0x2e778a,_0x254e7f){if(_0x43573b[_0x6a83('0x49')]['id']){delete _0x43573b[_0x6a83('0x49')]['id'];}return db[_0x6a83('0x2c')][_0x6a83('0x47')]({'where':{'id':_0x43573b[_0x6a83('0x45')]['id']}})[_0x6a83('0x21')](handleEntityNotFound(_0x2e778a,null))['then'](function(_0x300d83){if(_0x300d83){_0x43573b[_0x6a83('0x49')]['IntervalId']=_0x300d83['id'];return db[_0x6a83('0x2c')]['create'](_0x43573b[_0x6a83('0x49')]);}})[_0x6a83('0x21')](respondWithResult(_0x2e778a,null))[_0x6a83('0x4f')](handleError(_0x2e778a,null));};exports['getIntervals']=function(_0x5dfd02,_0x4dd62b,_0x3dd5e3){var _0xede964={};var _0x957a6a={};var _0x12aa21;var _0x92c24f;return db[_0x6a83('0x2c')][_0x6a83('0x50')]({'where':{'id':_0x5dfd02[_0x6a83('0x45')]['id']}})[_0x6a83('0x21')](handleEntityNotFound(_0x4dd62b,null))[_0x6a83('0x21')](function(_0x5abc98){if(_0x5abc98){_0x12aa21=_0x5abc98;_0x957a6a['model']=_['keys'](db[_0x6a83('0x2c')][_0x6a83('0x2d')]);_0x957a6a[_0x6a83('0x32')]=_[_0x6a83('0x33')](_0x5dfd02[_0x6a83('0x32')]);_0x957a6a[_0x6a83('0x34')]=_[_0x6a83('0x35')](_0x957a6a['model'],_0x957a6a[_0x6a83('0x32')]);_0xede964[_0x6a83('0x36')]=_[_0x6a83('0x35')](_0x957a6a[_0x6a83('0x31')],qs[_0x6a83('0x37')](_0x5dfd02['query'][_0x6a83('0x37')]));_0xede964[_0x6a83('0x36')]=_0xede964[_0x6a83('0x36')][_0x6a83('0x38')]?_0xede964[_0x6a83('0x36')]:_0x957a6a[_0x6a83('0x31')];_0xede964[_0x6a83('0x3a')]=qs[_0x6a83('0x3b')](_0x5dfd02['query'][_0x6a83('0x3b')]);_0xede964[_0x6a83('0x3c')]=qs[_0x6a83('0x34')](_[_0x6a83('0x3d')](_0x5dfd02[_0x6a83('0x32')],_0x957a6a[_0x6a83('0x34')]));if(_0x5dfd02['query'][_0x6a83('0x3e')]){_0xede964[_0x6a83('0x3c')]=_['merge'](_0xede964[_0x6a83('0x3c')],{'$or':_[_0x6a83('0x2b')](_0xede964[_0x6a83('0x36')],function(_0x5dd626){var _0x2b9b97={};_0x2b9b97[_0x5dd626]={'$like':'%'+_0x5dfd02[_0x6a83('0x32')]['filter']+'%'};return _0x2b9b97;})});}_0xede964=_[_0x6a83('0x3f')]({},_0xede964,_0x5dfd02[_0x6a83('0x46')]);return _0x12aa21[_0x6a83('0x51')](_0xede964);}})[_0x6a83('0x21')](function(_0x35c242){if(_0x35c242){_0x92c24f=_0x35c242[_0x6a83('0x38')];if(!_0x5dfd02['query'][_0x6a83('0x52')](_0x6a83('0x39'))){_0xede964[_0x6a83('0x1b')]=qs[_0x6a83('0x1b')](_0x5dfd02[_0x6a83('0x32')][_0x6a83('0x1b')]);_0xede964['offset']=qs['offset'](_0x5dfd02[_0x6a83('0x32')][_0x6a83('0x1a')]);}return _0x12aa21[_0x6a83('0x51')](_0xede964);}})[_0x6a83('0x21')](function(_0x339fda){if(_0x339fda){return _0x339fda?{'count':_0x92c24f,'rows':_0x339fda}:null;}})[_0x6a83('0x21')](respondWithResult(_0x4dd62b,null))['catch'](handleError(_0x4dd62b,null));};exports[_0x6a83('0x53')]=function(_0x5b121d,_0x4d00ba,_0x51d12c){return db[_0x6a83('0x2c')][_0x6a83('0x50')]({'where':{'id':_0x5b121d['params']['id']}})['then'](handleEntityNotFound(_0x4d00ba,null))[_0x6a83('0x21')](function(_0x447eca){if(_0x447eca){return db[_0x6a83('0x54')][_0x6a83('0x55')](function(_0x42c60b){return db[_0x6a83('0x2c')]['destroy']({'where':{'IntervalId':_0x5b121d[_0x6a83('0x45')]['id']},'transaction':_0x42c60b})['then'](function(_0x587470){var _0x9ee872=_[_0x6a83('0x2b')](_0x5b121d[_0x6a83('0x49')],function(_0x22dcd7){delete _0x22dcd7['id'];_0x22dcd7[_0x6a83('0x56')]=_0x5b121d[_0x6a83('0x45')]['id'];return _0x22dcd7;});return db[_0x6a83('0x2c')][_0x6a83('0x57')](_0x9ee872,{'transaction':_0x42c60b});});})[_0x6a83('0x21')](function(){return db[_0x6a83('0x2c')][_0x6a83('0x42')]({'where':{'IntervalId':_0x5b121d[_0x6a83('0x45')]['id']}});});}})['then'](respondWithResult(_0x4d00ba,null))[_0x6a83('0x4f')](handleError(_0x4d00ba,null));}; \ No newline at end of file +var _0x898d=['Content-Range','apply','reject','save','update','then','destroy','get','sendStatus','error','stack','name','send','map','Interval','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addInterval','IntervalId','options','getIntervals','addIntervals','sequelize','transaction','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../components/extensions/rewrite','end','status','json','offset','undefined','count','limit','set'];(function(_0x39a97f,_0x2516d6){var _0x349479=function(_0x58423a){while(--_0x58423a){_0x39a97f['push'](_0x39a97f['shift']());}};_0x349479(++_0x2516d6);}(_0x898d,0x1b1));var _0xd898=function(_0x1d2bc8,_0x2860bc){_0x1d2bc8=_0x1d2bc8-0x0;var _0x1857e1=_0x898d[_0x1d2bc8];return _0x1857e1;};'use strict';var emlformat=require(_0xd898('0x0'));var rimraf=require(_0xd898('0x1'));var zipdir=require(_0xd898('0x2'));var jsonpatch=require(_0xd898('0x3'));var rp=require(_0xd898('0x4'));var moment=require(_0xd898('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd898('0x6'));var util=require('util');var path=require(_0xd898('0x7'));var sox=require(_0xd898('0x8'));var csv=require('to-csv');var ejs=require(_0xd898('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd898('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd898('0xb'));var toCsv=require(_0xd898('0xc'));var querystring=require(_0xd898('0xd'));var Papa=require(_0xd898('0xe'));var Redis=require(_0xd898('0xf'));var authService=require(_0xd898('0x10'));var qs=require(_0xd898('0x11'));var as=require(_0xd898('0x12'));var hardwareService=require(_0xd898('0x13'));var logger=require(_0xd898('0x14'))(_0xd898('0x15'));var utils=require('../../config/utils');var config=require(_0xd898('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var extensions=require(_0xd898('0x17'));function respondWithStatusCode(_0x40fffe,_0x1c793c){_0x1c793c=_0x1c793c||0xcc;return function(_0xa7e515){if(_0xa7e515){return _0x40fffe['sendStatus'](_0x1c793c);}return _0x40fffe['status'](_0x1c793c)[_0xd898('0x18')]();};}function respondWithResult(_0x47cbad,_0x22c1a1){_0x22c1a1=_0x22c1a1||0xc8;return function(_0x2997e1){if(_0x2997e1){return _0x47cbad[_0xd898('0x19')](_0x22c1a1)[_0xd898('0x1a')](_0x2997e1);}};}function respondWithFilteredResult(_0x2149c8,_0x5ba721){return function(_0x2fc299){if(_0x2fc299){var _0x5ba1f6=typeof _0x5ba721[_0xd898('0x1b')]===_0xd898('0x1c')&&typeof _0x5ba721['limit']==='undefined';var _0x5e1a08=_0x2fc299[_0xd898('0x1d')];var _0x10d843=_0x5ba1f6?0x0:_0x5ba721[_0xd898('0x1b')];var _0x2c5a4f=_0x5ba1f6?_0x2fc299['count']:_0x5ba721[_0xd898('0x1b')]+_0x5ba721[_0xd898('0x1e')];var _0x144c09;if(_0x2c5a4f>=_0x5e1a08){_0x2c5a4f=_0x5e1a08;_0x144c09=0xc8;}else{_0x144c09=0xce;}_0x2149c8['status'](_0x144c09);return _0x2149c8[_0xd898('0x1f')](_0xd898('0x20'),_0x10d843+'-'+_0x2c5a4f+'/'+_0x5e1a08)[_0xd898('0x1a')](_0x2fc299);}return null;};}function patchUpdates(_0x497ec2){return function(_0x318bd5){try{jsonpatch[_0xd898('0x21')](_0x318bd5,_0x497ec2,!![]);}catch(_0x3036e7){return BPromise[_0xd898('0x22')](_0x3036e7);}return _0x318bd5[_0xd898('0x23')]();};}function saveUpdates(_0x2fae3b,_0x420e20){return function(_0x28b1a0){if(_0x28b1a0){return _0x28b1a0[_0xd898('0x24')](_0x2fae3b)[_0xd898('0x25')](function(_0x55036a){return _0x55036a;});}return null;};}function removeEntity(_0x19009f,_0x2cc819){return function(_0x304561){if(_0x304561){return _0x304561[_0xd898('0x26')]()[_0xd898('0x25')](function(){var _0x3f7f75=_0x304561[_0xd898('0x27')]({'plain':!![]});var _0x4904f='Intervals';return db['UserProfileResource'][_0xd898('0x26')]({'where':{'type':_0x4904f,'resourceId':_0x3f7f75['id']}})[_0xd898('0x25')](function(){return _0x304561;});})['then'](function(){_0x19009f[_0xd898('0x19')](0xcc)[_0xd898('0x18')]();});}};}function handleEntityNotFound(_0x32f098,_0x33538e){return function(_0x359a5f){if(!_0x359a5f){_0x32f098[_0xd898('0x28')](0x194);}return _0x359a5f;};}function handleError(_0x4e378b,_0x550ede){_0x550ede=_0x550ede||0x1f4;return function(_0xc6fbeb){logger[_0xd898('0x29')](_0xc6fbeb[_0xd898('0x2a')]);if(_0xc6fbeb[_0xd898('0x2b')]){delete _0xc6fbeb['name'];}_0x4e378b[_0xd898('0x19')](_0x550ede)[_0xd898('0x2c')](_0xc6fbeb);};}exports['index']=function(_0x542c80,_0xa23033){var _0x26658c={},_0x73dfad={},_0x63b3a={'count':0x0,'rows':[]};var _0xa75be2=_[_0xd898('0x2d')](db[_0xd898('0x2e')][_0xd898('0x2f')],function(_0x189ca2){return{'name':_0x189ca2['fieldName'],'type':_0x189ca2['type'][_0xd898('0x30')]};});_0x73dfad['model']=_[_0xd898('0x2d')](_0xa75be2,_0xd898('0x2b'));_0x73dfad[_0xd898('0x31')]=_[_0xd898('0x32')](_0x542c80[_0xd898('0x31')]);_0x73dfad[_0xd898('0x33')]=_[_0xd898('0x34')](_0x73dfad[_0xd898('0x35')],_0x73dfad['query']);_0x26658c[_0xd898('0x36')]=_[_0xd898('0x34')](_0x73dfad[_0xd898('0x35')],qs[_0xd898('0x37')](_0x542c80[_0xd898('0x31')][_0xd898('0x37')]));_0x26658c[_0xd898('0x36')]=_0x26658c[_0xd898('0x36')][_0xd898('0x38')]?_0x26658c['attributes']:_0x73dfad['model'];if(!_0x542c80[_0xd898('0x31')][_0xd898('0x39')](_0xd898('0x3a'))){_0x26658c[_0xd898('0x1e')]=qs[_0xd898('0x1e')](_0x542c80[_0xd898('0x31')]['limit']);_0x26658c['offset']=qs[_0xd898('0x1b')](_0x542c80[_0xd898('0x31')][_0xd898('0x1b')]);}_0x26658c[_0xd898('0x3b')]=qs[_0xd898('0x3c')](_0x542c80[_0xd898('0x31')]['sort']);_0x26658c['where']=qs['filters'](_[_0xd898('0x3d')](_0x542c80[_0xd898('0x31')],_0x73dfad[_0xd898('0x33')]),_0xa75be2);if(_0x542c80[_0xd898('0x31')][_0xd898('0x3e')]){_0x26658c['where']=_[_0xd898('0x3f')](_0x26658c[_0xd898('0x40')],{'$or':_['map'](_0xa75be2,function(_0x4bd516){if(_0x4bd516[_0xd898('0x41')]!==_0xd898('0x42')){var _0x40d752={};_0x40d752[_0x4bd516[_0xd898('0x2b')]]={'$like':'%'+_0x542c80[_0xd898('0x31')][_0xd898('0x3e')]+'%'};return _0x40d752;}})});}_0x26658c=_[_0xd898('0x3f')]({},_0x26658c,_0x542c80['options']);var _0x1b184a={'where':_0x26658c[_0xd898('0x40')]};return db[_0xd898('0x2e')][_0xd898('0x1d')](_0x1b184a)[_0xd898('0x25')](function(_0x1bb180){_0x63b3a['count']=_0x1bb180;if(_0x542c80[_0xd898('0x31')][_0xd898('0x43')]){_0x26658c[_0xd898('0x44')]=[{'all':!![]}];}return db['Interval'][_0xd898('0x45')](_0x26658c);})['then'](function(_0x5abe68){_0x63b3a[_0xd898('0x46')]=_0x5abe68;return _0x63b3a;})[_0xd898('0x25')](respondWithFilteredResult(_0xa23033,_0x26658c))[_0xd898('0x47')](handleError(_0xa23033,null));};exports[_0xd898('0x48')]=function(_0x21280d,_0x3314a9){var _0x535ab9={'raw':!![],'where':{'id':_0x21280d[_0xd898('0x49')]['id']}},_0x41a2fb={};_0x41a2fb[_0xd898('0x35')]=_[_0xd898('0x32')](db[_0xd898('0x2e')]['rawAttributes']);_0x41a2fb[_0xd898('0x31')]=_[_0xd898('0x32')](_0x21280d['query']);_0x41a2fb[_0xd898('0x33')]=_[_0xd898('0x34')](_0x41a2fb[_0xd898('0x35')],_0x41a2fb[_0xd898('0x31')]);_0x535ab9[_0xd898('0x36')]=_['intersection'](_0x41a2fb['model'],qs['fields'](_0x21280d[_0xd898('0x31')][_0xd898('0x37')]));_0x535ab9[_0xd898('0x36')]=_0x535ab9['attributes']['length']?_0x535ab9['attributes']:_0x41a2fb[_0xd898('0x35')];if(_0x21280d[_0xd898('0x31')]['includeAll']){_0x535ab9[_0xd898('0x44')]=[{'all':!![]}];}_0x535ab9=_[_0xd898('0x3f')]({},_0x535ab9,_0x21280d['options']);return db[_0xd898('0x2e')][_0xd898('0x4a')](_0x535ab9)[_0xd898('0x25')](handleEntityNotFound(_0x3314a9,null))['then'](respondWithResult(_0x3314a9,null))[_0xd898('0x47')](handleError(_0x3314a9,null));};exports[_0xd898('0x4b')]=function(_0x3df694,_0x1128bd){return db[_0xd898('0x2e')][_0xd898('0x4b')](_0x3df694['body'],{})['then'](function(_0x5be5f5){var _0x2549fe=_0x3df694[_0xd898('0x4c')][_0xd898('0x27')]({'plain':!![]});if(!_0x2549fe)throw new Error(_0xd898('0x4d'));if(_0x2549fe[_0xd898('0x4e')]===_0xd898('0x4c')){var _0x2ef51c=_0x5be5f5[_0xd898('0x27')]({'plain':!![]});var _0x4e5de9='Intervals';return db[_0xd898('0x4f')]['find']({'where':{'name':_0x4e5de9,'userProfileId':_0x2549fe[_0xd898('0x50')]},'raw':!![]})[_0xd898('0x25')](function(_0x3da31a){if(_0x3da31a&&_0x3da31a[_0xd898('0x51')]===0x0){return db[_0xd898('0x52')][_0xd898('0x4b')]({'name':_0x2ef51c[_0xd898('0x2b')],'resourceId':_0x2ef51c['id'],'type':_0x3da31a[_0xd898('0x2b')],'sectionId':_0x3da31a['id']},{})[_0xd898('0x25')](function(){return _0x5be5f5;});}else{return _0x5be5f5;}})['catch'](function(_0x10cb4e){logger[_0xd898('0x29')](_0xd898('0x53'),_0x10cb4e);throw _0x10cb4e;});}return _0x5be5f5;})[_0xd898('0x25')](respondWithResult(_0x1128bd,0xc9))[_0xd898('0x47')](handleError(_0x1128bd,null));};exports['update']=function(_0x189a26,_0x2aa353){if(_0x189a26[_0xd898('0x54')]['id']){delete _0x189a26['body']['id'];}return db[_0xd898('0x2e')][_0xd898('0x4a')]({'where':{'id':_0x189a26['params']['id']}})[_0xd898('0x25')](handleEntityNotFound(_0x2aa353,null))[_0xd898('0x25')](saveUpdates(_0x189a26['body'],null))['then'](respondWithResult(_0x2aa353,null))['catch'](handleError(_0x2aa353,null));};exports[_0xd898('0x26')]=function(_0x14bbac,_0x26068c){return db[_0xd898('0x2e')]['find']({'where':{'id':_0x14bbac[_0xd898('0x49')]['id']}})[_0xd898('0x25')](handleEntityNotFound(_0x26068c,null))['then'](removeEntity(_0x26068c,null))[_0xd898('0x47')](handleError(_0x26068c,null));};exports[_0xd898('0x55')]=function(_0x5c19bb,_0x4942a5,_0x5b35dc){if(_0x5c19bb[_0xd898('0x54')]['id']){delete _0x5c19bb['body']['id'];}return db[_0xd898('0x2e')][_0xd898('0x4a')]({'where':{'id':_0x5c19bb[_0xd898('0x49')]['id']}})[_0xd898('0x25')](handleEntityNotFound(_0x4942a5,null))[_0xd898('0x25')](function(_0x4b05e3){if(_0x4b05e3){_0x5c19bb[_0xd898('0x54')][_0xd898('0x56')]=_0x4b05e3['id'];return db[_0xd898('0x2e')][_0xd898('0x4b')](_0x5c19bb[_0xd898('0x54')]);}})[_0xd898('0x25')](respondWithResult(_0x4942a5,null))[_0xd898('0x47')](handleError(_0x4942a5,null));};exports['getIntervals']=function(_0xcba941,_0x5dd559,_0x572f08){var _0x6ff9b3={};var _0x1133ba={};var _0x4942ae;var _0x10b646;return db[_0xd898('0x2e')]['findOne']({'where':{'id':_0xcba941[_0xd898('0x49')]['id']}})[_0xd898('0x25')](handleEntityNotFound(_0x5dd559,null))['then'](function(_0x22f7c3){if(_0x22f7c3){_0x4942ae=_0x22f7c3;_0x1133ba[_0xd898('0x35')]=_['keys'](db[_0xd898('0x2e')][_0xd898('0x2f')]);_0x1133ba['query']=_[_0xd898('0x32')](_0xcba941['query']);_0x1133ba['filters']=_[_0xd898('0x34')](_0x1133ba['model'],_0x1133ba[_0xd898('0x31')]);_0x6ff9b3[_0xd898('0x36')]=_[_0xd898('0x34')](_0x1133ba[_0xd898('0x35')],qs['fields'](_0xcba941['query'][_0xd898('0x37')]));_0x6ff9b3[_0xd898('0x36')]=_0x6ff9b3['attributes'][_0xd898('0x38')]?_0x6ff9b3[_0xd898('0x36')]:_0x1133ba['model'];_0x6ff9b3[_0xd898('0x3b')]=qs[_0xd898('0x3c')](_0xcba941[_0xd898('0x31')][_0xd898('0x3c')]);_0x6ff9b3[_0xd898('0x40')]=qs[_0xd898('0x33')](_[_0xd898('0x3d')](_0xcba941[_0xd898('0x31')],_0x1133ba[_0xd898('0x33')]));if(_0xcba941[_0xd898('0x31')]['filter']){_0x6ff9b3['where']=_[_0xd898('0x3f')](_0x6ff9b3[_0xd898('0x40')],{'$or':_['map'](_0x6ff9b3[_0xd898('0x36')],function(_0x2587ec){var _0x517e87={};_0x517e87[_0x2587ec]={'$like':'%'+_0xcba941['query'][_0xd898('0x3e')]+'%'};return _0x517e87;})});}_0x6ff9b3=_[_0xd898('0x3f')]({},_0x6ff9b3,_0xcba941[_0xd898('0x57')]);return _0x4942ae['getIntervals'](_0x6ff9b3);}})[_0xd898('0x25')](function(_0x4c66fb){if(_0x4c66fb){_0x10b646=_0x4c66fb[_0xd898('0x38')];if(!_0xcba941[_0xd898('0x31')]['hasOwnProperty']('nolimit')){_0x6ff9b3[_0xd898('0x1e')]=qs[_0xd898('0x1e')](_0xcba941[_0xd898('0x31')]['limit']);_0x6ff9b3[_0xd898('0x1b')]=qs[_0xd898('0x1b')](_0xcba941[_0xd898('0x31')]['offset']);}return _0x4942ae[_0xd898('0x58')](_0x6ff9b3);}})['then'](function(_0x215cf2){if(_0x215cf2){return _0x215cf2?{'count':_0x10b646,'rows':_0x215cf2}:null;}})[_0xd898('0x25')](respondWithResult(_0x5dd559,null))[_0xd898('0x47')](handleError(_0x5dd559,null));};exports[_0xd898('0x59')]=function(_0x92e773,_0x4bc60b,_0x29374f){return db[_0xd898('0x2e')]['findOne']({'where':{'id':_0x92e773[_0xd898('0x49')]['id']}})[_0xd898('0x25')](handleEntityNotFound(_0x4bc60b,null))['then'](function(_0x295de0){if(_0x295de0){return db[_0xd898('0x5a')][_0xd898('0x5b')](function(_0xe59bca){return db[_0xd898('0x2e')][_0xd898('0x26')]({'where':{'IntervalId':_0x92e773[_0xd898('0x49')]['id']},'transaction':_0xe59bca})[_0xd898('0x25')](function(_0x3b5af6){var _0x821f9c=_[_0xd898('0x2d')](_0x92e773[_0xd898('0x54')],function(_0x1a02b4){delete _0x1a02b4['id'];_0x1a02b4['IntervalId']=_0x92e773[_0xd898('0x49')]['id'];return _0x1a02b4;});return db['Interval'][_0xd898('0x5c')](_0x821f9c,{'transaction':_0xe59bca});});})[_0xd898('0x25')](function(){return db[_0xd898('0x2e')]['findAll']({'where':{'IntervalId':_0x92e773[_0xd898('0x49')]['id']}});});}})[_0xd898('0x25')](respondWithResult(_0x4bc60b,null))['catch'](handleError(_0x4bc60b,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 8b2aac3..c161250 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 _0x13c5=['tools_intervals','rewrite','lodash','path','./interval.attributes','../../components/extensions/rewrite','exports','Interval'];(function(_0x2f11dd,_0x4028ba){var _0x2f4bb1=function(_0x170afe){while(--_0x170afe){_0x2f11dd['push'](_0x2f11dd['shift']());}};_0x2f4bb1(++_0x4028ba);}(_0x13c5,0x7a));var _0x513c=function(_0x4ec563,_0x133d60){_0x4ec563=_0x4ec563-0x0;var _0x240007=_0x13c5[_0x4ec563];return _0x240007;};'use strict';var _=require(_0x513c('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x513c('0x1'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x513c('0x2'));var extensions=require(_0x513c('0x3'));module[_0x513c('0x4')]=function(_0x2ad2db,_0x51309d){return _0x2ad2db['define'](_0x513c('0x5'),attributes,{'tableName':_0x513c('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x42da79,_0x414e01){extensions[_0x513c('0x7')](_0x2ad2db,_0x42da79);},'afterBulkCreate':function(_0x3126f2,_0x222c25,_0x18471d){_0x18471d();extensions['rewrite'](_0x2ad2db,_0x3126f2[0x0]);},'afterUpdate':function(_0xd70448,_0x224eb2){extensions['rewrite'](_0x2ad2db,_0xd70448);},'afterDestroy':function(_0x5a091e,_0x798eed){extensions[_0x513c('0x7')](_0x2ad2db,_0x5a091e);}}});}; \ No newline at end of file +var _0xebb1=['../../config/logger','moment','bluebird','request-promise','path','./interval.attributes','exports','define','Interval','rewrite','lodash','util'];(function(_0x3eadcb,_0x58fac6){var _0x367dc0=function(_0x30bf37){while(--_0x30bf37){_0x3eadcb['push'](_0x3eadcb['shift']());}};_0x367dc0(++_0x58fac6);}(_0xebb1,0xa6));var _0x1ebb=function(_0x15fce6,_0x542138){_0x15fce6=_0x15fce6-0x0;var _0x1ccfe6=_0xebb1[_0x15fce6];return _0x1ccfe6;};'use strict';var _=require(_0x1ebb('0x0'));var util=require(_0x1ebb('0x1'));var logger=require(_0x1ebb('0x2'))('api');var moment=require(_0x1ebb('0x3'));var BPromise=require(_0x1ebb('0x4'));var rp=require(_0x1ebb('0x5'));var fs=require('fs');var path=require(_0x1ebb('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1ebb('0x7'));var extensions=require('../../components/extensions/rewrite');module[_0x1ebb('0x8')]=function(_0xa56c9,_0x479085){return _0xa56c9[_0x1ebb('0x9')](_0x1ebb('0xa'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1751ec,_0x147fcf){extensions['rewrite'](_0xa56c9,_0x1751ec);},'afterBulkCreate':function(_0x51c879,_0x2dcec3,_0x1f8522){_0x1f8522();extensions[_0x1ebb('0xb')](_0xa56c9,_0x51c879[0x0]);},'afterUpdate':function(_0x49501c,_0x2e15cb){extensions[_0x1ebb('0xb')](_0xa56c9,_0x49501c);},'afterDestroy':function(_0x14dbc2,_0x2cdd15){extensions['rewrite'](_0xa56c9,_0x14dbc2);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index b765cf0..880f2b3 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(_0x11f0e3,_0x5170bc){var _0x2892e8=function(_0x3292b2){while(--_0x3292b2){_0x11f0e3['push'](_0x11f0e3['shift']());}};_0x2892e8(++_0x5170bc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var 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(_0x4a96ca,_0x13754e){var _0x2aed48=function(_0x361330){while(--_0x361330){_0x4a96ca['push'](_0x4a96ca['shift']());}};_0x2aed48(++_0x13754e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index ae7bf67..e2d340e 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['exports','express','../../components/auth/service','post','isAuthenticated','send'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x0b0e,0x187));var _0xe0b0=function(_0x334d1e,_0x28a488){_0x334d1e=_0x334d1e-0x0;var _0x3b33ba=_0x0b0e[_0x334d1e];return _0x3b33ba;};'use strict';var express=require(_0xe0b0('0x0'));var router=express['Router']();var auth=require(_0xe0b0('0x1'));var controller=require('./jira.controller');router[_0xe0b0('0x2')]('/',auth[_0xe0b0('0x3')](),controller[_0xe0b0('0x4')]);module[_0xe0b0('0x5')]=router; \ No newline at end of file +var _0x0b0e=['exports','express','../../components/auth/service','post','isAuthenticated','send'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x0b0e,0x187));var _0xe0b0=function(_0xcfcbaa,_0x369d95){_0xcfcbaa=_0xcfcbaa-0x0;var _0x157ed0=_0x0b0e[_0xcfcbaa];return _0x157ed0;};'use strict';var express=require(_0xe0b0('0x0'));var router=express['Router']();var auth=require(_0xe0b0('0x1'));var controller=require('./jira.controller');router[_0xe0b0('0x2')]('/',auth[_0xe0b0('0x3')](),controller[_0xe0b0('0x4')]);module[_0xe0b0('0x5')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 1bfad6a..5304e2c 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 _0xa5e4=['openIssue','body','headers','x-forwarded-for','connection','remoteAddress','socket','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','\x20from\x20','description','issuetype','Bug','fields','email','customfield_11501','oldToken','customfield_11502','customfield_11503','name','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','stringify','setEncoding','utf8','data','status','statusCode','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','end'];(function(_0x5a7c74,_0x5ac3cb){var _0x3b5f9e=function(_0x31ca57){while(--_0x31ca57){_0x5a7c74['push'](_0x5a7c74['shift']());}};_0x3b5f9e(++_0x5ac3cb);}(_0xa5e4,0x1b5));var _0x4a5e=function(_0x4e8a0d,_0x309bf4){_0x4e8a0d=_0x4e8a0d-0x0;var _0x5df7b9=_0xa5e4[_0x4e8a0d];return _0x5df7b9;};'use strict';var BPromise=require('bluebird');var https=require('https');var logger=require(_0x4a5e('0x0'))(_0x4a5e('0x1'));var USERNAME=_0x4a5e('0x2');var PASSWORD=_0x4a5e('0x3');function openIssue(_0x730265,_0x1c7550){var _0xb874bf={'fields':{'project':{'key':_0x730265[_0x4a5e('0x4')]||_0x4a5e('0x5')},'summary':(_0x730265['summary']||'Report')+_0x4a5e('0x6')+_0x730265['ip'],'description':_0x730265[_0x4a5e('0x7')]||JSON['stringify'](_0x730265),'issuetype':{'name':_0x730265[_0x4a5e('0x8')]||_0x4a5e('0x9')}}};_0xb874bf[_0x4a5e('0xa')]['customfield_11500']=_0x730265[_0x4a5e('0xb')];_0xb874bf[_0x4a5e('0xa')][_0x4a5e('0xc')]=_0x730265[_0x4a5e('0xd')];_0xb874bf['fields'][_0x4a5e('0xe')]=_0x730265['newToken'];_0xb874bf[_0x4a5e('0xa')][_0x4a5e('0xf')]=_0x730265[_0x4a5e('0x10')];_0xb874bf[_0x4a5e('0xa')]['customfield_11504']=_0x730265[_0x4a5e('0x11')];_0xb874bf['fields'][_0x4a5e('0x12')]=_0x730265['ip'];var _0x4a6740={'host':_0x4a5e('0x13'),'port':0x1bb,'path':_0x4a5e('0x14'),'method':_0x4a5e('0x15'),'timeout':0x4e20,'headers':{'Content-Type':_0x4a5e('0x16'),'Authorization':_0x4a5e('0x17')+new Buffer(USERNAME+':'+PASSWORD)[_0x4a5e('0x18')](_0x4a5e('0x19'))}};var _0x18a3bc=JSON[_0x4a5e('0x1a')](_0xb874bf);var _0x5a1d1b=https['request'](_0x4a6740,function(_0x494e64){_0x494e64[_0x4a5e('0x1b')](_0x4a5e('0x1c'));var _0xa384ee='';_0x494e64['on'](_0x4a5e('0x1d'),function(_0x23da6f){_0xa384ee+=_0x23da6f;});_0x494e64['on']('end',function(){if(_0x1c7550){return _0x1c7550[_0x4a5e('0x1e')](_0x494e64[_0x4a5e('0x1f')])[_0x4a5e('0x20')](JSON['parse'](_0xa384ee));}});});_0x5a1d1b['on']('error',function(_0x136ba6){if(_0x1c7550){return _0x1c7550['status'](0x1f4)[_0x4a5e('0x20')]({'errors':[{'message':_0x4a5e('0x21'),'type':'api.jira'}]});}});_0x5a1d1b[_0x4a5e('0x22')](_0x18a3bc);_0x5a1d1b[_0x4a5e('0x23')]();}exports[_0x4a5e('0x24')]=openIssue;exports['send']=function(_0x15ee9a,_0x58ddd3){_0x15ee9a[_0x4a5e('0x25')]['ip']=_0x15ee9a[_0x4a5e('0x26')][_0x4a5e('0x27')]||_0x15ee9a[_0x4a5e('0x28')][_0x4a5e('0x29')]||_0x15ee9a[_0x4a5e('0x2a')][_0x4a5e('0x29')]||_0x15ee9a['connection'][_0x4a5e('0x2a')][_0x4a5e('0x29')];return openIssue(_0x15ee9a[_0x4a5e('0x25')],_0x58ddd3);}; \ No newline at end of file +var _0x9239=['api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','stringify','issuetype','Bug','fields','customfield_11500','customfield_11501','oldToken','customfield_11502','newToken','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','request','setEncoding','utf8','data','end','status','statusCode','parse','error','json','api.jira','write','body','headers','connection','socket','remoteAddress','bluebird','https','../../config/logger'];(function(_0x214c7f,_0x1d9263){var _0x1b6871=function(_0x30d4c8){while(--_0x30d4c8){_0x214c7f['push'](_0x214c7f['shift']());}};_0x1b6871(++_0x1d9263);}(_0x9239,0xe8));var _0x9923=function(_0x18e091,_0x3d8d0f){_0x18e091=_0x18e091-0x0;var _0x5c7c4e=_0x9239[_0x18e091];return _0x5c7c4e;};'use strict';var BPromise=require(_0x9923('0x0'));var https=require(_0x9923('0x1'));var logger=require(_0x9923('0x2'))(_0x9923('0x3'));var USERNAME=_0x9923('0x4');var PASSWORD=_0x9923('0x5');function openIssue(_0x58c3bb,_0x176381){var _0x4d09a8={'fields':{'project':{'key':_0x58c3bb[_0x9923('0x6')]||_0x9923('0x7')},'summary':(_0x58c3bb[_0x9923('0x8')]||_0x9923('0x9'))+_0x9923('0xa')+_0x58c3bb['ip'],'description':_0x58c3bb['description']||JSON[_0x9923('0xb')](_0x58c3bb),'issuetype':{'name':_0x58c3bb[_0x9923('0xc')]||_0x9923('0xd')}}};_0x4d09a8[_0x9923('0xe')][_0x9923('0xf')]=_0x58c3bb['email'];_0x4d09a8[_0x9923('0xe')][_0x9923('0x10')]=_0x58c3bb[_0x9923('0x11')];_0x4d09a8['fields'][_0x9923('0x12')]=_0x58c3bb[_0x9923('0x13')];_0x4d09a8[_0x9923('0xe')]['customfield_11503']=_0x58c3bb['name'];_0x4d09a8['fields'][_0x9923('0x14')]=_0x58c3bb[_0x9923('0x15')];_0x4d09a8[_0x9923('0xe')][_0x9923('0x16')]=_0x58c3bb['ip'];var _0x2494ee={'host':_0x9923('0x17'),'port':0x1bb,'path':_0x9923('0x18'),'method':_0x9923('0x19'),'timeout':0x4e20,'headers':{'Content-Type':_0x9923('0x1a'),'Authorization':_0x9923('0x1b')+new Buffer(USERNAME+':'+PASSWORD)[_0x9923('0x1c')](_0x9923('0x1d'))}};var _0x8cd985=JSON['stringify'](_0x4d09a8);var _0x30d853=https[_0x9923('0x1e')](_0x2494ee,function(_0x465c17){_0x465c17[_0x9923('0x1f')](_0x9923('0x20'));var _0x260f22='';_0x465c17['on'](_0x9923('0x21'),function(_0x350e9d){_0x260f22+=_0x350e9d;});_0x465c17['on'](_0x9923('0x22'),function(){if(_0x176381){return _0x176381[_0x9923('0x23')](_0x465c17[_0x9923('0x24')])['json'](JSON[_0x9923('0x25')](_0x260f22));}});});_0x30d853['on'](_0x9923('0x26'),function(_0x1f3b63){if(_0x176381){return _0x176381[_0x9923('0x23')](0x1f4)[_0x9923('0x27')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x9923('0x28')}]});}});_0x30d853[_0x9923('0x29')](_0x8cd985);_0x30d853[_0x9923('0x22')]();}exports['openIssue']=openIssue;exports['send']=function(_0xdaa22f,_0x5a2e5d){_0xdaa22f[_0x9923('0x2a')]['ip']=_0xdaa22f[_0x9923('0x2b')]['x-forwarded-for']||_0xdaa22f[_0x9923('0x2c')]['remoteAddress']||_0xdaa22f[_0x9923('0x2d')][_0x9923('0x2e')]||_0xdaa22f[_0x9923('0x2c')][_0x9923('0x2d')][_0x9923('0x2e')];return openIssue(_0xdaa22f[_0x9923('0x2a')],_0x5a2e5d);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 5d4e124..25c13ec 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 _0xda55=['../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','isAuthenticated','get','/describe','describe','/:id','show','create','put','update','delete','destroy','multer','util','express','Router','fs-extra'];(function(_0x42ebba,_0x4cbf87){var _0x3fd2af=function(_0x26d999){while(--_0x26d999){_0x42ebba['push'](_0x42ebba['shift']());}};_0x3fd2af(++_0x4cbf87);}(_0xda55,0x6d));var _0x5da5=function(_0x50889c,_0x202861){_0x50889c=_0x50889c-0x0;var _0x1b6024=_0xda55[_0x50889c];return _0x1b6024;};'use strict';var multer=require(_0x5da5('0x0'));var util=require(_0x5da5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5da5('0x2'));var router=express[_0x5da5('0x3')]();var fs_extra=require(_0x5da5('0x4'));var auth=require(_0x5da5('0x5'));var interaction=require(_0x5da5('0x6'));var config=require('../../config/environment');var controller=require(_0x5da5('0x7'));router['get']('/',auth[_0x5da5('0x8')](),controller['index']);router[_0x5da5('0x9')](_0x5da5('0xa'),auth[_0x5da5('0x8')](),controller[_0x5da5('0xb')]);router[_0x5da5('0x9')](_0x5da5('0xc'),auth[_0x5da5('0x8')](),controller[_0x5da5('0xd')]);router['post']('/',auth[_0x5da5('0x8')](),controller[_0x5da5('0xe')]);router[_0x5da5('0xf')](_0x5da5('0xc'),auth[_0x5da5('0x8')](),controller[_0x5da5('0x10')]);router[_0x5da5('0x11')]('/:id',auth[_0x5da5('0x8')](),controller[_0x5da5('0x12')]);module['exports']=router; \ No newline at end of file +var _0x1be1=['fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','describe','/:id','post','put','update','destroy','path','connect-timeout','Router'];(function(_0x2de187,_0x2f0452){var _0x2c0159=function(_0x12dc33){while(--_0x12dc33){_0x2de187['push'](_0x2de187['shift']());}};_0x2c0159(++_0x2f0452);}(_0x1be1,0x192));var _0x11be=function(_0x40c4b4,_0xfa87ac){_0x40c4b4=_0x40c4b4-0x0;var _0x3cca6a=_0x1be1[_0x40c4b4];return _0x3cca6a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x11be('0x0'));var timeout=require(_0x11be('0x1'));var express=require('express');var router=express[_0x11be('0x2')]();var fs_extra=require(_0x11be('0x3'));var auth=require(_0x11be('0x4'));var interaction=require(_0x11be('0x5'));var config=require('../../config/environment');var controller=require(_0x11be('0x6'));router[_0x11be('0x7')]('/',auth[_0x11be('0x8')](),controller['index']);router[_0x11be('0x7')]('/describe',auth[_0x11be('0x8')](),controller[_0x11be('0x9')]);router[_0x11be('0x7')](_0x11be('0xa'),auth[_0x11be('0x8')](),controller['show']);router[_0x11be('0xb')]('/',auth[_0x11be('0x8')](),controller['create']);router[_0x11be('0xc')](_0x11be('0xa'),auth[_0x11be('0x8')](),controller[_0x11be('0xd')]);router['delete'](_0x11be('0xa'),auth[_0x11be('0x8')](),controller[_0x11be('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 0ac0b7f..dac4749 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(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x7a54,0x106));var _0x47a5=function(_0xc0a17e,_0xbea784){_0xc0a17e=_0xc0a17e-0x0;var _0x1d9536=_0x7a54[_0xc0a17e];return _0x1d9536;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x7a54,0x106));var _0x47a5=function(_0x543a68,_0x159549){_0x543a68=_0x543a68-0x0;var _0x427870=_0x7a54[_0x543a68];return _0x427870;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index c9a5171..657ad39 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 _0x7c1a=['reject','then','destroy','stack','name','send','index','map','JscriptyAnswerReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x42aeea,_0x44e379){var _0x11510b=function(_0x26a0fb){while(--_0x26a0fb){_0x42aeea['push'](_0x42aeea['shift']());}};_0x11510b(++_0x44e379);}(_0x7c1a,0x159));var _0xa7c1=function(_0x4d7d29,_0x241940){_0x4d7d29=_0x4d7d29-0x0;var _0x1cc078=_0x7c1a[_0x4d7d29];return _0x1cc078;};'use strict';var emlformat=require(_0xa7c1('0x0'));var rimraf=require(_0xa7c1('0x1'));var zipdir=require(_0xa7c1('0x2'));var jsonpatch=require(_0xa7c1('0x3'));var rp=require(_0xa7c1('0x4'));var moment=require(_0xa7c1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa7c1('0x6'));var util=require(_0xa7c1('0x7'));var path=require('path');var sox=require(_0xa7c1('0x8'));var csv=require('to-csv');var ejs=require(_0xa7c1('0x9'));var fs=require('fs');var fs_extra=require(_0xa7c1('0xa'));var _=require(_0xa7c1('0xb'));var squel=require(_0xa7c1('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa7c1('0xd'));var toCsv=require(_0xa7c1('0xe'));var querystring=require(_0xa7c1('0xf'));var Papa=require('papaparse');var Redis=require(_0xa7c1('0x10'));var authService=require(_0xa7c1('0x11'));var qs=require(_0xa7c1('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa7c1('0x13'));var logger=require(_0xa7c1('0x14'))('api');var utils=require(_0xa7c1('0x15'));var config=require(_0xa7c1('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xa7c1('0x17'))['db'];function respondWithStatusCode(_0x1d7d67,_0x26d63a){_0x26d63a=_0x26d63a||0xcc;return function(_0x3f5f02){if(_0x3f5f02){return _0x1d7d67[_0xa7c1('0x18')](_0x26d63a);}return _0x1d7d67[_0xa7c1('0x19')](_0x26d63a)[_0xa7c1('0x1a')]();};}function respondWithResult(_0xb74ba2,_0x3fc9e6){_0x3fc9e6=_0x3fc9e6||0xc8;return function(_0x21ce41){if(_0x21ce41){return _0xb74ba2[_0xa7c1('0x19')](_0x3fc9e6)[_0xa7c1('0x1b')](_0x21ce41);}};}function respondWithFilteredResult(_0xe28779,_0x5a0c8e){return function(_0xba02b){if(_0xba02b){var _0x3a6f47=typeof _0x5a0c8e[_0xa7c1('0x1c')]===_0xa7c1('0x1d')&&typeof _0x5a0c8e[_0xa7c1('0x1e')]==='undefined';var _0x3b77af=_0xba02b['count'];var _0x440251=_0x3a6f47?0x0:_0x5a0c8e[_0xa7c1('0x1c')];var _0x5dc8e3=_0x3a6f47?_0xba02b[_0xa7c1('0x1f')]:_0x5a0c8e[_0xa7c1('0x1c')]+_0x5a0c8e[_0xa7c1('0x1e')];var _0x5d3841;if(_0x5dc8e3>=_0x3b77af){_0x5dc8e3=_0x3b77af;_0x5d3841=0xc8;}else{_0x5d3841=0xce;}_0xe28779[_0xa7c1('0x19')](_0x5d3841);return _0xe28779[_0xa7c1('0x20')](_0xa7c1('0x21'),_0x440251+'-'+_0x5dc8e3+'/'+_0x3b77af)[_0xa7c1('0x1b')](_0xba02b);}return null;};}function patchUpdates(_0x3b131e){return function(_0x31c16a){try{jsonpatch[_0xa7c1('0x22')](_0x31c16a,_0x3b131e,!![]);}catch(_0xdfcbd9){return BPromise[_0xa7c1('0x23')](_0xdfcbd9);}return _0x31c16a['save']();};}function saveUpdates(_0x42ad46,_0x1c9b7c){return function(_0x1ebcdd){if(_0x1ebcdd){return _0x1ebcdd['update'](_0x42ad46)[_0xa7c1('0x24')](function(_0x7dbe77){return _0x7dbe77;});}return null;};}function removeEntity(_0x43d61f,_0x2dc42b){return function(_0x30cb15){if(_0x30cb15){return _0x30cb15[_0xa7c1('0x25')]()[_0xa7c1('0x24')](function(){_0x43d61f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x48280a,_0x1ea97e){return function(_0x40c478){if(!_0x40c478){_0x48280a[_0xa7c1('0x18')](0x194);}return _0x40c478;};}function handleError(_0x153b1a,_0x94884d){_0x94884d=_0x94884d||0x1f4;return function(_0x5d62cb){logger['error'](_0x5d62cb[_0xa7c1('0x26')]);if(_0x5d62cb[_0xa7c1('0x27')]){delete _0x5d62cb[_0xa7c1('0x27')];}_0x153b1a['status'](_0x94884d)[_0xa7c1('0x28')](_0x5d62cb);};}exports[_0xa7c1('0x29')]=function(_0x2fe45b,_0xa8a937){var _0x635792={},_0x1cc05c={},_0x302b2f={'count':0x0,'rows':[]};var _0x796ed1=_[_0xa7c1('0x2a')](db[_0xa7c1('0x2b')]['rawAttributes'],function(_0x6b764d){return{'name':_0x6b764d[_0xa7c1('0x2c')],'type':_0x6b764d[_0xa7c1('0x2d')][_0xa7c1('0x2e')]};});_0x1cc05c[_0xa7c1('0x2f')]=_[_0xa7c1('0x2a')](_0x796ed1,_0xa7c1('0x27'));_0x1cc05c[_0xa7c1('0x30')]=_[_0xa7c1('0x31')](_0x2fe45b['query']);_0x1cc05c[_0xa7c1('0x32')]=_[_0xa7c1('0x33')](_0x1cc05c[_0xa7c1('0x2f')],_0x1cc05c[_0xa7c1('0x30')]);_0x635792['attributes']=_['intersection'](_0x1cc05c[_0xa7c1('0x2f')],qs[_0xa7c1('0x34')](_0x2fe45b[_0xa7c1('0x30')]['fields']));_0x635792['attributes']=_0x635792[_0xa7c1('0x35')][_0xa7c1('0x36')]?_0x635792['attributes']:_0x1cc05c[_0xa7c1('0x2f')];if(!_0x2fe45b['query'][_0xa7c1('0x37')]('nolimit')){_0x635792[_0xa7c1('0x1e')]=qs[_0xa7c1('0x1e')](_0x2fe45b['query']['limit']);_0x635792[_0xa7c1('0x1c')]=qs[_0xa7c1('0x1c')](_0x2fe45b[_0xa7c1('0x30')][_0xa7c1('0x1c')]);}_0x635792[_0xa7c1('0x38')]=qs[_0xa7c1('0x39')](_0x2fe45b[_0xa7c1('0x30')]['sort']);_0x635792[_0xa7c1('0x3a')]=qs[_0xa7c1('0x32')](_[_0xa7c1('0x3b')](_0x2fe45b[_0xa7c1('0x30')],_0x1cc05c[_0xa7c1('0x32')]),_0x796ed1);if(_0x2fe45b[_0xa7c1('0x30')]['filter']){_0x635792[_0xa7c1('0x3a')]=_[_0xa7c1('0x3c')](_0x635792[_0xa7c1('0x3a')],{'$or':_[_0xa7c1('0x2a')](_0x796ed1,function(_0x2039f0){if(_0x2039f0[_0xa7c1('0x2d')]!==_0xa7c1('0x3d')){var _0xff58c3={};_0xff58c3[_0x2039f0['name']]={'$like':'%'+_0x2fe45b[_0xa7c1('0x30')][_0xa7c1('0x3e')]+'%'};return _0xff58c3;}})});}_0x635792=_[_0xa7c1('0x3c')]({},_0x635792,_0x2fe45b[_0xa7c1('0x3f')]);var _0x2bfcd0={'where':_0x635792[_0xa7c1('0x3a')]};return db[_0xa7c1('0x2b')][_0xa7c1('0x1f')](_0x2bfcd0)[_0xa7c1('0x24')](function(_0x364dcd){_0x302b2f[_0xa7c1('0x1f')]=_0x364dcd;if(_0x2fe45b[_0xa7c1('0x30')][_0xa7c1('0x40')]){_0x635792[_0xa7c1('0x41')]=[{'all':!![]}];}return db[_0xa7c1('0x2b')][_0xa7c1('0x42')](_0x635792);})[_0xa7c1('0x24')](function(_0x4c0ef7){_0x302b2f[_0xa7c1('0x43')]=_0x4c0ef7;return _0x302b2f;})[_0xa7c1('0x24')](respondWithFilteredResult(_0xa8a937,_0x635792))['catch'](handleError(_0xa8a937,null));};exports[_0xa7c1('0x44')]=function(_0x2368b2,_0x46d759){var _0x8b76c2={'raw':!![],'where':{'id':_0x2368b2[_0xa7c1('0x45')]['id']}},_0x4a43c1={};_0x4a43c1['model']=_['keys'](db[_0xa7c1('0x2b')][_0xa7c1('0x46')]);_0x4a43c1[_0xa7c1('0x30')]=_[_0xa7c1('0x31')](_0x2368b2[_0xa7c1('0x30')]);_0x4a43c1['filters']=_[_0xa7c1('0x33')](_0x4a43c1[_0xa7c1('0x2f')],_0x4a43c1[_0xa7c1('0x30')]);_0x8b76c2['attributes']=_['intersection'](_0x4a43c1[_0xa7c1('0x2f')],qs[_0xa7c1('0x34')](_0x2368b2['query'][_0xa7c1('0x34')]));_0x8b76c2[_0xa7c1('0x35')]=_0x8b76c2[_0xa7c1('0x35')][_0xa7c1('0x36')]?_0x8b76c2[_0xa7c1('0x35')]:_0x4a43c1['model'];if(_0x2368b2[_0xa7c1('0x30')][_0xa7c1('0x40')]){_0x8b76c2[_0xa7c1('0x41')]=[{'all':!![]}];}_0x8b76c2=_[_0xa7c1('0x3c')]({},_0x8b76c2,_0x2368b2[_0xa7c1('0x3f')]);return db['JscriptyAnswerReport'][_0xa7c1('0x47')](_0x8b76c2)[_0xa7c1('0x24')](handleEntityNotFound(_0x46d759,null))[_0xa7c1('0x24')](respondWithResult(_0x46d759,null))[_0xa7c1('0x48')](handleError(_0x46d759,null));};exports[_0xa7c1('0x49')]=function(_0x2672c3,_0x5180af){return db[_0xa7c1('0x2b')][_0xa7c1('0x49')](_0x2672c3[_0xa7c1('0x4a')],{})[_0xa7c1('0x24')](respondWithResult(_0x5180af,0xc9))['catch'](handleError(_0x5180af,null));};exports['update']=function(_0x33e535,_0x4b8da7){if(_0x33e535[_0xa7c1('0x4a')]['id']){delete _0x33e535[_0xa7c1('0x4a')]['id'];}return db[_0xa7c1('0x2b')]['find']({'where':{'id':_0x33e535[_0xa7c1('0x45')]['id']}})[_0xa7c1('0x24')](handleEntityNotFound(_0x4b8da7,null))['then'](saveUpdates(_0x33e535['body'],null))[_0xa7c1('0x24')](respondWithResult(_0x4b8da7,null))[_0xa7c1('0x48')](handleError(_0x4b8da7,null));};exports[_0xa7c1('0x25')]=function(_0x4b58bb,_0x12d60c){return db[_0xa7c1('0x2b')][_0xa7c1('0x47')]({'where':{'id':_0x4b58bb[_0xa7c1('0x45')]['id']}})[_0xa7c1('0x24')](handleEntityNotFound(_0x12d60c,null))['then'](removeEntity(_0x12d60c,null))['catch'](handleError(_0x12d60c,null));};exports[_0xa7c1('0x4b')]=function(_0x3838d8,_0x518200){return db['JscriptyAnswerReport'][_0xa7c1('0x4b')]()[_0xa7c1('0x24')](respondWithResult(_0x518200,null))['catch'](handleError(_0x518200,null));}; \ No newline at end of file +var _0x2d2c=['name','index','map','JscriptyAnswerReport','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','findAll','rows','catch','keys','find','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','then','destroy','error','stack'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x2d2c,0x1d7));var _0xc2d2=function(_0x4b4d43,_0x1590f7){_0x4b4d43=_0x4b4d43-0x0;var _0x5706ba=_0x2d2c[_0x4b4d43];return _0x5706ba;};'use strict';var emlformat=require(_0xc2d2('0x0'));var rimraf=require(_0xc2d2('0x1'));var zipdir=require(_0xc2d2('0x2'));var jsonpatch=require(_0xc2d2('0x3'));var rp=require(_0xc2d2('0x4'));var moment=require(_0xc2d2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc2d2('0x6'));var util=require('util');var path=require(_0xc2d2('0x7'));var sox=require(_0xc2d2('0x8'));var csv=require(_0xc2d2('0x9'));var ejs=require(_0xc2d2('0xa'));var fs=require('fs');var fs_extra=require(_0xc2d2('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc2d2('0xc'));var jsforce=require(_0xc2d2('0xd'));var deskjs=require(_0xc2d2('0xe'));var toCsv=require(_0xc2d2('0x9'));var querystring=require(_0xc2d2('0xf'));var Papa=require(_0xc2d2('0x10'));var Redis=require(_0xc2d2('0x11'));var authService=require(_0xc2d2('0x12'));var qs=require(_0xc2d2('0x13'));var as=require(_0xc2d2('0x14'));var hardwareService=require(_0xc2d2('0x15'));var logger=require(_0xc2d2('0x16'))('api');var utils=require(_0xc2d2('0x17'));var config=require(_0xc2d2('0x18'));var licenseUtil=require(_0xc2d2('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x273269,_0x738877){_0x738877=_0x738877||0xcc;return function(_0x4c2b12){if(_0x4c2b12){return _0x273269[_0xc2d2('0x1a')](_0x738877);}return _0x273269[_0xc2d2('0x1b')](_0x738877)['end']();};}function respondWithResult(_0xa6f836,_0x4de52a){_0x4de52a=_0x4de52a||0xc8;return function(_0x5a1d24){if(_0x5a1d24){return _0xa6f836[_0xc2d2('0x1b')](_0x4de52a)[_0xc2d2('0x1c')](_0x5a1d24);}};}function respondWithFilteredResult(_0xf6bc66,_0x4006f3){return function(_0x2c42a6){if(_0x2c42a6){var _0x37552b=typeof _0x4006f3[_0xc2d2('0x1d')]===_0xc2d2('0x1e')&&typeof _0x4006f3[_0xc2d2('0x1f')]===_0xc2d2('0x1e');var _0x403d51=_0x2c42a6['count'];var _0x2d4ec4=_0x37552b?0x0:_0x4006f3[_0xc2d2('0x1d')];var _0x34f750=_0x37552b?_0x2c42a6[_0xc2d2('0x20')]:_0x4006f3['offset']+_0x4006f3[_0xc2d2('0x1f')];var _0x18cef7;if(_0x34f750>=_0x403d51){_0x34f750=_0x403d51;_0x18cef7=0xc8;}else{_0x18cef7=0xce;}_0xf6bc66['status'](_0x18cef7);return _0xf6bc66[_0xc2d2('0x21')](_0xc2d2('0x22'),_0x2d4ec4+'-'+_0x34f750+'/'+_0x403d51)[_0xc2d2('0x1c')](_0x2c42a6);}return null;};}function patchUpdates(_0xb14bc3){return function(_0x603323){try{jsonpatch['apply'](_0x603323,_0xb14bc3,!![]);}catch(_0x100d5b){return BPromise[_0xc2d2('0x23')](_0x100d5b);}return _0x603323['save']();};}function saveUpdates(_0x2cac91,_0x4e3cb5){return function(_0x5ecf78){if(_0x5ecf78){return _0x5ecf78['update'](_0x2cac91)[_0xc2d2('0x24')](function(_0x1bdcb5){return _0x1bdcb5;});}return null;};}function removeEntity(_0x7ffb28,_0x4b3449){return function(_0x2dbc46){if(_0x2dbc46){return _0x2dbc46[_0xc2d2('0x25')]()[_0xc2d2('0x24')](function(){_0x7ffb28[_0xc2d2('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25b201,_0x25e6af){return function(_0xf2ba15){if(!_0xf2ba15){_0x25b201[_0xc2d2('0x1a')](0x194);}return _0xf2ba15;};}function handleError(_0x1a11d2,_0x1c14e5){_0x1c14e5=_0x1c14e5||0x1f4;return function(_0x49e955){logger[_0xc2d2('0x26')](_0x49e955[_0xc2d2('0x27')]);if(_0x49e955[_0xc2d2('0x28')]){delete _0x49e955[_0xc2d2('0x28')];}_0x1a11d2['status'](_0x1c14e5)['send'](_0x49e955);};}exports[_0xc2d2('0x29')]=function(_0x7b75f4,_0x1f3b66){var _0x21ca37={},_0x402337={},_0x460379={'count':0x0,'rows':[]};var _0x4d4af2=_[_0xc2d2('0x2a')](db[_0xc2d2('0x2b')]['rawAttributes'],function(_0x29cae5){return{'name':_0x29cae5[_0xc2d2('0x2c')],'type':_0x29cae5[_0xc2d2('0x2d')][_0xc2d2('0x2e')]};});_0x402337[_0xc2d2('0x2f')]=_['map'](_0x4d4af2,'name');_0x402337[_0xc2d2('0x30')]=_['keys'](_0x7b75f4[_0xc2d2('0x30')]);_0x402337[_0xc2d2('0x31')]=_[_0xc2d2('0x32')](_0x402337[_0xc2d2('0x2f')],_0x402337[_0xc2d2('0x30')]);_0x21ca37['attributes']=_[_0xc2d2('0x32')](_0x402337[_0xc2d2('0x2f')],qs[_0xc2d2('0x33')](_0x7b75f4[_0xc2d2('0x30')][_0xc2d2('0x33')]));_0x21ca37[_0xc2d2('0x34')]=_0x21ca37['attributes'][_0xc2d2('0x35')]?_0x21ca37[_0xc2d2('0x34')]:_0x402337['model'];if(!_0x7b75f4[_0xc2d2('0x30')]['hasOwnProperty'](_0xc2d2('0x36'))){_0x21ca37[_0xc2d2('0x1f')]=qs[_0xc2d2('0x1f')](_0x7b75f4[_0xc2d2('0x30')][_0xc2d2('0x1f')]);_0x21ca37[_0xc2d2('0x1d')]=qs[_0xc2d2('0x1d')](_0x7b75f4[_0xc2d2('0x30')]['offset']);}_0x21ca37[_0xc2d2('0x37')]=qs[_0xc2d2('0x38')](_0x7b75f4[_0xc2d2('0x30')][_0xc2d2('0x38')]);_0x21ca37['where']=qs[_0xc2d2('0x31')](_[_0xc2d2('0x39')](_0x7b75f4[_0xc2d2('0x30')],_0x402337[_0xc2d2('0x31')]),_0x4d4af2);if(_0x7b75f4['query'][_0xc2d2('0x3a')]){_0x21ca37['where']=_[_0xc2d2('0x3b')](_0x21ca37[_0xc2d2('0x3c')],{'$or':_['map'](_0x4d4af2,function(_0xdbdce0){if(_0xdbdce0[_0xc2d2('0x2d')]!==_0xc2d2('0x3d')){var _0x29d04b={};_0x29d04b[_0xdbdce0[_0xc2d2('0x28')]]={'$like':'%'+_0x7b75f4[_0xc2d2('0x30')][_0xc2d2('0x3a')]+'%'};return _0x29d04b;}})});}_0x21ca37=_[_0xc2d2('0x3b')]({},_0x21ca37,_0x7b75f4[_0xc2d2('0x3e')]);var _0x49d900={'where':_0x21ca37['where']};return db[_0xc2d2('0x2b')][_0xc2d2('0x20')](_0x49d900)['then'](function(_0xfd3ad4){_0x460379[_0xc2d2('0x20')]=_0xfd3ad4;if(_0x7b75f4[_0xc2d2('0x30')]['includeAll']){_0x21ca37['include']=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xc2d2('0x3f')](_0x21ca37);})[_0xc2d2('0x24')](function(_0x4031d0){_0x460379[_0xc2d2('0x40')]=_0x4031d0;return _0x460379;})['then'](respondWithFilteredResult(_0x1f3b66,_0x21ca37))[_0xc2d2('0x41')](handleError(_0x1f3b66,null));};exports['show']=function(_0x582edb,_0x24544e){var _0x2a987a={'raw':!![],'where':{'id':_0x582edb['params']['id']}},_0x386a39={};_0x386a39[_0xc2d2('0x2f')]=_[_0xc2d2('0x42')](db[_0xc2d2('0x2b')]['rawAttributes']);_0x386a39[_0xc2d2('0x30')]=_['keys'](_0x582edb[_0xc2d2('0x30')]);_0x386a39[_0xc2d2('0x31')]=_[_0xc2d2('0x32')](_0x386a39[_0xc2d2('0x2f')],_0x386a39[_0xc2d2('0x30')]);_0x2a987a[_0xc2d2('0x34')]=_['intersection'](_0x386a39[_0xc2d2('0x2f')],qs['fields'](_0x582edb[_0xc2d2('0x30')][_0xc2d2('0x33')]));_0x2a987a[_0xc2d2('0x34')]=_0x2a987a[_0xc2d2('0x34')][_0xc2d2('0x35')]?_0x2a987a['attributes']:_0x386a39[_0xc2d2('0x2f')];if(_0x582edb[_0xc2d2('0x30')]['includeAll']){_0x2a987a['include']=[{'all':!![]}];}_0x2a987a=_['merge']({},_0x2a987a,_0x582edb['options']);return db[_0xc2d2('0x2b')][_0xc2d2('0x43')](_0x2a987a)[_0xc2d2('0x24')](handleEntityNotFound(_0x24544e,null))[_0xc2d2('0x24')](respondWithResult(_0x24544e,null))[_0xc2d2('0x41')](handleError(_0x24544e,null));};exports[_0xc2d2('0x44')]=function(_0x1146cb,_0x3b795a){return db[_0xc2d2('0x2b')][_0xc2d2('0x44')](_0x1146cb[_0xc2d2('0x45')],{})[_0xc2d2('0x24')](respondWithResult(_0x3b795a,0xc9))['catch'](handleError(_0x3b795a,null));};exports[_0xc2d2('0x46')]=function(_0x4181dc,_0x572764){if(_0x4181dc[_0xc2d2('0x45')]['id']){delete _0x4181dc['body']['id'];}return db[_0xc2d2('0x2b')][_0xc2d2('0x43')]({'where':{'id':_0x4181dc[_0xc2d2('0x47')]['id']}})[_0xc2d2('0x24')](handleEntityNotFound(_0x572764,null))['then'](saveUpdates(_0x4181dc[_0xc2d2('0x45')],null))[_0xc2d2('0x24')](respondWithResult(_0x572764,null))[_0xc2d2('0x41')](handleError(_0x572764,null));};exports[_0xc2d2('0x25')]=function(_0x3b61ef,_0x4765f9){return db[_0xc2d2('0x2b')][_0xc2d2('0x43')]({'where':{'id':_0x3b61ef[_0xc2d2('0x47')]['id']}})['then'](handleEntityNotFound(_0x4765f9,null))['then'](removeEntity(_0x4765f9,null))[_0xc2d2('0x41')](handleError(_0x4765f9,null));};exports[_0xc2d2('0x48')]=function(_0x472299,_0x1827c3){return db[_0xc2d2('0x2b')]['describe']()[_0xc2d2('0x24')](respondWithResult(_0x1827c3,null))[_0xc2d2('0x41')](handleError(_0x1827c3,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index dceaad3..48b2558 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 _0x5d2a=['JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x5d2a,0x154));var _0xa5d2=function(_0x2b9732,_0x5b15d1){_0x2b9732=_0x2b9732-0x0;var _0x31c116=_0x5d2a[_0x2b9732];return _0x31c116;};'use strict';var _=require(_0xa5d2('0x0'));var util=require(_0xa5d2('0x1'));var logger=require(_0xa5d2('0x2'))(_0xa5d2('0x3'));var moment=require(_0xa5d2('0x4'));var BPromise=require('bluebird');var rp=require(_0xa5d2('0x5'));var fs=require('fs');var path=require(_0xa5d2('0x6'));var rimraf=require(_0xa5d2('0x7'));var config=require(_0xa5d2('0x8'));var attributes=require(_0xa5d2('0x9'));module[_0xa5d2('0xa')]=function(_0x217fc6,_0x567766){return _0x217fc6['define'](_0xa5d2('0xb'),attributes,{'tableName':_0xa5d2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdf96=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','define','util'];(function(_0x57f9d8,_0x405a9e){var _0x1d7e50=function(_0x38fb29){while(--_0x38fb29){_0x57f9d8['push'](_0x57f9d8['shift']());}};_0x1d7e50(++_0x405a9e);}(_0xdf96,0x86));var _0x6df9=function(_0x339751,_0x131747){_0x339751=_0x339751-0x0;var _0x19ac1c=_0xdf96[_0x339751];return _0x19ac1c;};'use strict';var _=require('lodash');var util=require(_0x6df9('0x0'));var logger=require(_0x6df9('0x1'))(_0x6df9('0x2'));var moment=require(_0x6df9('0x3'));var BPromise=require('bluebird');var rp=require(_0x6df9('0x4'));var fs=require('fs');var path=require(_0x6df9('0x5'));var rimraf=require(_0x6df9('0x6'));var config=require(_0x6df9('0x7'));var attributes=require('./jscriptyAnswerReport.attributes');module['exports']=function(_0x15e0a4,_0x1aeaa3){return _0x15e0a4[_0x6df9('0x8')]('JscriptyAnswerReport',attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index fdc8620..6b2dce1 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 _0x31c7=['debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','JscriptyAnswerReport,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','request','then','info'];(function(_0x7185f7,_0x37065){var _0x182e45=function(_0x519e0d){while(--_0x519e0d){_0x7185f7['push'](_0x7185f7['shift']());}};_0x182e45(++_0x37065);}(_0x31c7,0x1ac));var _0x731c=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x31c7[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0x731c('0x0'));var util=require(_0x731c('0x1'));var moment=require(_0x731c('0x2'));var BPromise=require(_0x731c('0x3'));var rs=require(_0x731c('0x4'));var fs=require('fs');var Redis=require(_0x731c('0x5'));var db=require(_0x731c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x731c('0x7'))(_0x731c('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x731c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x20761b,_0x528291,_0x190a0a){return new BPromise(function(_0x25394c,_0x5f81b5){return client[_0x731c('0xa')](_0x20761b,_0x190a0a)[_0x731c('0xb')](function(_0x38b75a){logger[_0x731c('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x528291,'request\x20sent');logger[_0x731c('0xd')](_0x731c('0xe'),_0x528291,_0x731c('0xf'),JSON[_0x731c('0x10')](_0x38b75a));if(_0x38b75a[_0x731c('0x11')]){if(_0x38b75a[_0x731c('0x11')]['code']===0x1f4){logger[_0x731c('0x11')](_0x731c('0x12'),_0x528291,_0x38b75a[_0x731c('0x11')][_0x731c('0x13')]);return _0x5f81b5(_0x38b75a['error'][_0x731c('0x13')]);}logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x528291,_0x38b75a[_0x731c('0x11')][_0x731c('0x13')]);return _0x25394c(_0x38b75a[_0x731c('0x11')]['message']);}else{logger[_0x731c('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x528291,'request\x20sent');_0x25394c(_0x38b75a[_0x731c('0x14')][_0x731c('0x13')]);}})['catch'](function(_0x15a697){logger[_0x731c('0x11')](_0x731c('0x12'),_0x528291,_0x15a697);_0x5f81b5(_0x15a697);});});} \ No newline at end of file +var _0x2196=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','randomstring','ioredis','../../mysqldb'];(function(_0x41c99a,_0x12414d){var _0x303bf9=function(_0x219646){while(--_0x219646){_0x41c99a['push'](_0x41c99a['shift']());}};_0x303bf9(++_0x12414d);}(_0x2196,0x64));var _0x6219=function(_0xe6daf,_0x4c6437){_0xe6daf=_0xe6daf-0x0;var _0x533bd3=_0x2196[_0xe6daf];return _0x533bd3;};'use strict';var _=require(_0x6219('0x0'));var util=require(_0x6219('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6219('0x2'));var fs=require('fs');var Redis=require(_0x6219('0x3'));var db=require(_0x6219('0x4'))['db'];var utils=require(_0x6219('0x5'));var logger=require(_0x6219('0x6'))(_0x6219('0x7'));var config=require(_0x6219('0x8'));var jayson=require(_0x6219('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1fcc38,_0x503be3,_0x3ba39e){return new BPromise(function(_0x137fcf,_0x372694){return client[_0x6219('0xa')](_0x1fcc38,_0x3ba39e)[_0x6219('0xb')](function(_0x24914b){logger[_0x6219('0xc')](_0x6219('0xd'),_0x503be3,_0x6219('0xe'));logger[_0x6219('0xf')](_0x6219('0x10'),_0x503be3,_0x6219('0xe'),JSON['stringify'](_0x24914b));if(_0x24914b['error']){if(_0x24914b[_0x6219('0x11')][_0x6219('0x12')]===0x1f4){logger[_0x6219('0x11')](_0x6219('0xd'),_0x503be3,_0x24914b[_0x6219('0x11')]['message']);return _0x372694(_0x24914b[_0x6219('0x11')]['message']);}logger['error'](_0x6219('0xd'),_0x503be3,_0x24914b[_0x6219('0x11')][_0x6219('0x13')]);return _0x137fcf(_0x24914b['error']['message']);}else{logger[_0x6219('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x503be3,_0x6219('0xe'));_0x137fcf(_0x24914b[_0x6219('0x14')][_0x6219('0x13')]);}})['catch'](function(_0x4c949d){logger[_0x6219('0x11')](_0x6219('0xd'),_0x503be3,_0x4c949d);_0x372694(_0x4c949d);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index b9a4d9b..d969552 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 _0x1dce=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','getSessions','/:id/answers','/:id/summary','getSummary','post','create','/:id/clone','clone','put','/:id','update','delete','exports','multer'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x1dce,0x18f));var _0xe1dc=function(_0x3327dd,_0x4dbdbc){_0x3327dd=_0x3327dd-0x0;var _0x58f2a8=_0x1dce[_0x3327dd];return _0x58f2a8;};'use strict';var multer=require(_0xe1dc('0x0'));var util=require(_0xe1dc('0x1'));var path=require(_0xe1dc('0x2'));var timeout=require(_0xe1dc('0x3'));var express=require('express');var router=express[_0xe1dc('0x4')]();var fs_extra=require(_0xe1dc('0x5'));var auth=require(_0xe1dc('0x6'));var interaction=require(_0xe1dc('0x7'));var config=require(_0xe1dc('0x8'));var controller=require('./jscriptyProject.controller');router[_0xe1dc('0x9')]('/',auth[_0xe1dc('0xa')](),controller[_0xe1dc('0xb')]);router[_0xe1dc('0x9')]('/:id',auth[_0xe1dc('0xa')](),controller['show']);router[_0xe1dc('0x9')]('/:id/sessions',auth[_0xe1dc('0xa')](),controller[_0xe1dc('0xc')]);router[_0xe1dc('0x9')](_0xe1dc('0xd'),auth[_0xe1dc('0xa')](),controller['getAnswers']);router[_0xe1dc('0x9')](_0xe1dc('0xe'),auth['isAuthenticated'](),timeout('30s'),controller[_0xe1dc('0xf')]);router[_0xe1dc('0x10')]('/',auth['isAuthenticated'](),controller[_0xe1dc('0x11')]);router[_0xe1dc('0x10')](_0xe1dc('0x12'),auth['isAuthenticated'](),controller[_0xe1dc('0x13')]);router[_0xe1dc('0x14')](_0xe1dc('0x15'),auth[_0xe1dc('0xa')](),controller[_0xe1dc('0x16')]);router[_0xe1dc('0x17')](_0xe1dc('0x15'),auth[_0xe1dc('0xa')](),controller['destroy']);module[_0xe1dc('0x18')]=router; \ No newline at end of file +var _0xaf40=['get','isAuthenticated','index','/:id','show','/:id/sessions','getSessions','getAnswers','/:id/summary','30s','post','create','/:id/clone','clone','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','./jscriptyProject.controller'];(function(_0x4ec3ab,_0x50a5de){var _0x229613=function(_0x5c2daa){while(--_0x5c2daa){_0x4ec3ab['push'](_0x4ec3ab['shift']());}};_0x229613(++_0x50a5de);}(_0xaf40,0x1e6));var _0x0af4=function(_0x453693,_0x152259){_0x453693=_0x453693-0x0;var _0x2af9d8=_0xaf40[_0x453693];return _0x2af9d8;};'use strict';var multer=require(_0x0af4('0x0'));var util=require(_0x0af4('0x1'));var path=require(_0x0af4('0x2'));var timeout=require(_0x0af4('0x3'));var express=require(_0x0af4('0x4'));var router=express[_0x0af4('0x5')]();var fs_extra=require(_0x0af4('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0af4('0x7'));router[_0x0af4('0x8')]('/',auth[_0x0af4('0x9')](),controller[_0x0af4('0xa')]);router[_0x0af4('0x8')](_0x0af4('0xb'),auth[_0x0af4('0x9')](),controller[_0x0af4('0xc')]);router['get'](_0x0af4('0xd'),auth[_0x0af4('0x9')](),controller[_0x0af4('0xe')]);router[_0x0af4('0x8')]('/:id/answers',auth[_0x0af4('0x9')](),controller[_0x0af4('0xf')]);router[_0x0af4('0x8')](_0x0af4('0x10'),auth[_0x0af4('0x9')](),timeout(_0x0af4('0x11')),controller['getSummary']);router[_0x0af4('0x12')]('/',auth['isAuthenticated'](),controller[_0x0af4('0x13')]);router[_0x0af4('0x12')](_0x0af4('0x14'),auth['isAuthenticated'](),controller[_0x0af4('0x15')]);router[_0x0af4('0x16')](_0x0af4('0xb'),auth[_0x0af4('0x9')](),controller['update']);router[_0x0af4('0x17')](_0x0af4('0xb'),auth[_0x0af4('0x9')](),controller[_0x0af4('0x18')]);module[_0x0af4('0x19')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index f2d560b..5955d5d 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 _0x1cdb=['sequelize','lodash','util','STRING','TEXT','setDataValue','stringify','isString','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','name','BOOLEAN'];(function(_0x2fb19b,_0x19acbd){var _0x3f6666=function(_0x47bde0){while(--_0x47bde0){_0x2fb19b['push'](_0x2fb19b['shift']());}};_0x3f6666(++_0x19acbd);}(_0x1cdb,0xa8));var _0xb1cd=function(_0xacb1d,_0x3d8cec){_0xacb1d=_0xacb1d-0x0;var _0x288425=_0x1cdb[_0xacb1d];return _0x288425;};'use strict';var Sequelize=require(_0xb1cd('0x0'));var _=require(_0xb1cd('0x1'));var util=require(_0xb1cd('0x2'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize[_0xb1cd('0x3')]},'formData':{'type':Sequelize[_0xb1cd('0x4')]('long'),'set':function(_0x440717){if(_['isObjectLike'](_0x440717)){this[_0xb1cd('0x5')]('formData',JSON[_0xb1cd('0x6')](_0x440717));}else if(_[_0xb1cd('0x7')](_0x440717)){this[_0xb1cd('0x5')](_0xb1cd('0x8'),_0x440717);}else{this['setDataValue'](_0xb1cd('0x8'),util[_0xb1cd('0x9')](_0xb1cd('0xa'),this[_0xb1cd('0xb')](_0xb1cd('0xc'))||'',this[_0xb1cd('0xb')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xb1cd('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xb1cd('0xd')],'defaultValue':![]}}; \ No newline at end of file +var _0x88ca=['{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','STRING','name','TEXT','isObjectLike','setDataValue','formData','stringify'];(function(_0x1722f9,_0x33444c){var _0x396946=function(_0x5297d2){while(--_0x5297d2){_0x1722f9['push'](_0x1722f9['shift']());}};_0x396946(++_0x33444c);}(_0x88ca,0x13c));var _0xa88c=function(_0x3e91a9,_0x53c466){_0x3e91a9=_0x3e91a9-0x0;var _0x25c9ad=_0x88ca[_0x3e91a9];return _0x25c9ad;};'use strict';var Sequelize=require(_0xa88c('0x0'));var _=require(_0xa88c('0x1'));var util=require('util');module['exports']={'name':{'type':Sequelize[_0xa88c('0x2')],'unique':_0xa88c('0x3')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xa88c('0x4')]('long'),'set':function(_0x58d159){if(_[_0xa88c('0x5')](_0x58d159)){this[_0xa88c('0x6')](_0xa88c('0x7'),JSON[_0xa88c('0x8')](_0x58d159));}else if(_['isString'](_0x58d159)){this[_0xa88c('0x6')]('formData',_0x58d159);}else{this[_0xa88c('0x6')]('formData',util['format'](_0xa88c('0x9'),this['getDataValue'](_0xa88c('0x3'))||'',this[_0xa88c('0xa')](_0xa88c('0xb'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xa88c('0xc')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index eb7c069..cdaeec4 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 _0xa8d8=['setHeader','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','crypto','jsforce','papaparse','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','apply','reject','update','then','destroy','Projects','UserProfileResource','end','error','name','index','map','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','JscriptyProject','includeAll','include','rows','catch','show','params','keys','length','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','clone','omit','updatedAt','createdAt','findOne','JscriptySessionReport','hasOwnProperty','nolimit','order','ProjectId','findAll','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync'];(function(_0x525d78,_0x14175d){var _0x4c203d=function(_0x45d4f4){while(--_0x45d4f4){_0x525d78['push'](_0x525d78['shift']());}};_0x4c203d(++_0x14175d);}(_0xa8d8,0x79));var _0x8a8d=function(_0x56c4bc,_0x1cfb34){_0x56c4bc=_0x56c4bc-0x0;var _0xa0ae69=_0xa8d8[_0x56c4bc];return _0xa0ae69;};'use strict';var emlformat=require(_0x8a8d('0x0'));var rimraf=require(_0x8a8d('0x1'));var zipdir=require(_0x8a8d('0x2'));var jsonpatch=require(_0x8a8d('0x3'));var rp=require(_0x8a8d('0x4'));var moment=require(_0x8a8d('0x5'));var BPromise=require(_0x8a8d('0x6'));var Mustache=require('mustache');var util=require(_0x8a8d('0x7'));var path=require('path');var sox=require(_0x8a8d('0x8'));var csv=require(_0x8a8d('0x9'));var ejs=require(_0x8a8d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8a8d('0xb'));var squel=require('squel');var crypto=require(_0x8a8d('0xc'));var jsforce=require(_0x8a8d('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8a8d('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8a8d('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x8a8d('0x10'));var licenseUtil=require(_0x8a8d('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5f02bd,_0x59ec0f){_0x59ec0f=_0x59ec0f||0xcc;return function(_0x22774e){if(_0x22774e){return _0x5f02bd[_0x8a8d('0x12')](_0x59ec0f);}return _0x5f02bd['status'](_0x59ec0f)['end']();};}function respondWithResult(_0x466990,_0x33a710){_0x33a710=_0x33a710||0xc8;return function(_0x5ec00f){if(_0x5ec00f){return _0x466990[_0x8a8d('0x13')](_0x33a710)[_0x8a8d('0x14')](_0x5ec00f);}};}function respondWithFilteredResult(_0x341602,_0x2fc39b){return function(_0x2e9477){if(_0x2e9477){var _0xbfc2af=typeof _0x2fc39b[_0x8a8d('0x15')]===_0x8a8d('0x16')&&typeof _0x2fc39b[_0x8a8d('0x17')]==='undefined';var _0x399287=_0x2e9477[_0x8a8d('0x18')];var _0x356c8a=_0xbfc2af?0x0:_0x2fc39b[_0x8a8d('0x15')];var _0x39a732=_0xbfc2af?_0x2e9477[_0x8a8d('0x18')]:_0x2fc39b[_0x8a8d('0x15')]+_0x2fc39b[_0x8a8d('0x17')];var _0x476007;if(_0x39a732>=_0x399287){_0x39a732=_0x399287;_0x476007=0xc8;}else{_0x476007=0xce;}_0x341602[_0x8a8d('0x13')](_0x476007);return _0x341602['set']('Content-Range',_0x356c8a+'-'+_0x39a732+'/'+_0x399287)[_0x8a8d('0x14')](_0x2e9477);}return null;};}function patchUpdates(_0x54cdce){return function(_0x4570ef){try{jsonpatch[_0x8a8d('0x19')](_0x4570ef,_0x54cdce,!![]);}catch(_0x5ecbaa){return BPromise[_0x8a8d('0x1a')](_0x5ecbaa);}return _0x4570ef['save']();};}function saveUpdates(_0xe02481,_0x4bf3d2){return function(_0x626487){if(_0x626487){return _0x626487[_0x8a8d('0x1b')](_0xe02481)[_0x8a8d('0x1c')](function(_0xa8d0be){return _0xa8d0be;});}return null;};}function removeEntity(_0x2a1932,_0x1c720f){return function(_0x5baa34){if(_0x5baa34){return _0x5baa34[_0x8a8d('0x1d')]()[_0x8a8d('0x1c')](function(){var _0x303d3a=_0x5baa34['get']({'plain':!![]});var _0x10f8f6=_0x8a8d('0x1e');return db[_0x8a8d('0x1f')][_0x8a8d('0x1d')]({'where':{'type':_0x10f8f6,'resourceId':_0x303d3a['id']}})[_0x8a8d('0x1c')](function(){return _0x5baa34;});})[_0x8a8d('0x1c')](function(){_0x2a1932[_0x8a8d('0x13')](0xcc)[_0x8a8d('0x20')]();});}};}function handleEntityNotFound(_0x431d3d,_0x7fdfad){return function(_0x120fd5){if(!_0x120fd5){_0x431d3d[_0x8a8d('0x12')](0x194);}return _0x120fd5;};}function handleError(_0x38bd9e,_0x23bbcd){_0x23bbcd=_0x23bbcd||0x1f4;return function(_0x265680){logger[_0x8a8d('0x21')](_0x265680['stack']);if(_0x265680[_0x8a8d('0x22')]){delete _0x265680[_0x8a8d('0x22')];}_0x38bd9e[_0x8a8d('0x13')](_0x23bbcd)['send'](_0x265680);};}exports[_0x8a8d('0x23')]=function(_0x56332a,_0x238bba){var _0x38e8af={},_0x21a076={},_0x14bf04={'count':0x0,'rows':[]};var _0x2ed5a7=_[_0x8a8d('0x24')](db['JscriptyProject'][_0x8a8d('0x25')],function(_0x31f7fe){return{'name':_0x31f7fe[_0x8a8d('0x26')],'type':_0x31f7fe['type'][_0x8a8d('0x27')]};});_0x21a076[_0x8a8d('0x28')]=_[_0x8a8d('0x24')](_0x2ed5a7,'name');_0x21a076[_0x8a8d('0x29')]=_['keys'](_0x56332a[_0x8a8d('0x29')]);_0x21a076['filters']=_[_0x8a8d('0x2a')](_0x21a076[_0x8a8d('0x28')],_0x21a076[_0x8a8d('0x29')]);_0x38e8af[_0x8a8d('0x2b')]=_[_0x8a8d('0x2a')](_0x21a076[_0x8a8d('0x28')],qs[_0x8a8d('0x2c')](_0x56332a[_0x8a8d('0x29')]['fields']));_0x38e8af[_0x8a8d('0x2b')]=_0x38e8af[_0x8a8d('0x2b')]['length']?_0x38e8af[_0x8a8d('0x2b')]:_0x21a076['model'];if(!_0x56332a[_0x8a8d('0x29')]['hasOwnProperty']('nolimit')){_0x38e8af[_0x8a8d('0x17')]=qs[_0x8a8d('0x17')](_0x56332a[_0x8a8d('0x29')][_0x8a8d('0x17')]);_0x38e8af[_0x8a8d('0x15')]=qs[_0x8a8d('0x15')](_0x56332a[_0x8a8d('0x29')][_0x8a8d('0x15')]);}_0x38e8af['order']=qs['sort'](_0x56332a['query'][_0x8a8d('0x2d')]);_0x38e8af[_0x8a8d('0x2e')]=qs[_0x8a8d('0x2f')](_[_0x8a8d('0x30')](_0x56332a[_0x8a8d('0x29')],_0x21a076[_0x8a8d('0x2f')]),_0x2ed5a7);if(_0x56332a[_0x8a8d('0x29')][_0x8a8d('0x31')]){_0x38e8af[_0x8a8d('0x2e')]=_[_0x8a8d('0x32')](_0x38e8af[_0x8a8d('0x2e')],{'$or':_['map'](_0x2ed5a7,function(_0x2f5359){if(_0x2f5359[_0x8a8d('0x33')]!==_0x8a8d('0x34')){var _0x530610={};_0x530610[_0x2f5359[_0x8a8d('0x22')]]={'$like':'%'+_0x56332a[_0x8a8d('0x29')][_0x8a8d('0x31')]+'%'};return _0x530610;}})});}_0x38e8af=_[_0x8a8d('0x32')]({},_0x38e8af,_0x56332a[_0x8a8d('0x35')]);var _0x1eb738={'where':_0x38e8af[_0x8a8d('0x2e')]};return db[_0x8a8d('0x36')][_0x8a8d('0x18')](_0x1eb738)[_0x8a8d('0x1c')](function(_0x2d0110){_0x14bf04[_0x8a8d('0x18')]=_0x2d0110;if(_0x56332a[_0x8a8d('0x29')][_0x8a8d('0x37')]){_0x38e8af[_0x8a8d('0x38')]=[{'all':!![]}];}return db['JscriptyProject']['findAll'](_0x38e8af);})[_0x8a8d('0x1c')](function(_0x3eaa16){_0x14bf04[_0x8a8d('0x39')]=_0x3eaa16;return _0x14bf04;})['then'](respondWithFilteredResult(_0x238bba,_0x38e8af))[_0x8a8d('0x3a')](handleError(_0x238bba,null));};exports[_0x8a8d('0x3b')]=function(_0x40684f,_0x31eeeb){var _0x1eec01={'raw':![],'where':{'id':_0x40684f[_0x8a8d('0x3c')]['id']}},_0x229f01={};_0x229f01[_0x8a8d('0x28')]=_[_0x8a8d('0x3d')](db[_0x8a8d('0x36')][_0x8a8d('0x25')]);_0x229f01[_0x8a8d('0x29')]=_['keys'](_0x40684f[_0x8a8d('0x29')]);_0x229f01[_0x8a8d('0x2f')]=_['intersection'](_0x229f01[_0x8a8d('0x28')],_0x229f01[_0x8a8d('0x29')]);_0x1eec01['attributes']=_[_0x8a8d('0x2a')](_0x229f01[_0x8a8d('0x28')],qs[_0x8a8d('0x2c')](_0x40684f['query'][_0x8a8d('0x2c')]));_0x1eec01['attributes']=_0x1eec01[_0x8a8d('0x2b')][_0x8a8d('0x3e')]?_0x1eec01[_0x8a8d('0x2b')]:_0x229f01['model'];if(_0x40684f[_0x8a8d('0x29')][_0x8a8d('0x37')]){_0x1eec01[_0x8a8d('0x38')]=[{'all':!![]}];}_0x1eec01=_[_0x8a8d('0x32')]({},_0x1eec01,_0x40684f[_0x8a8d('0x35')]);return db[_0x8a8d('0x36')]['find'](_0x1eec01)[_0x8a8d('0x1c')](handleEntityNotFound(_0x31eeeb,null))[_0x8a8d('0x1c')](respondWithResult(_0x31eeeb,null))[_0x8a8d('0x3a')](handleError(_0x31eeeb,null));};exports[_0x8a8d('0x3f')]=function(_0x5a434a,_0x9a4818){return db[_0x8a8d('0x36')][_0x8a8d('0x3f')](_0x5a434a[_0x8a8d('0x40')],{})[_0x8a8d('0x1c')](function(_0x5229e1){var _0x4194b7=_0x5a434a[_0x8a8d('0x41')][_0x8a8d('0x42')]({'plain':!![]});if(!_0x4194b7)throw new Error(_0x8a8d('0x43'));if(_0x4194b7[_0x8a8d('0x44')]===_0x8a8d('0x41')){var _0x363810=_0x5229e1[_0x8a8d('0x42')]({'plain':!![]});var _0x3cd6b0=_0x8a8d('0x1e');return db[_0x8a8d('0x45')][_0x8a8d('0x46')]({'where':{'name':_0x3cd6b0,'userProfileId':_0x4194b7[_0x8a8d('0x47')]},'raw':!![]})[_0x8a8d('0x1c')](function(_0x26e68f){if(_0x26e68f&&_0x26e68f[_0x8a8d('0x48')]===0x0){return db[_0x8a8d('0x1f')][_0x8a8d('0x3f')]({'name':_0x363810[_0x8a8d('0x22')],'resourceId':_0x363810['id'],'type':_0x26e68f['name'],'sectionId':_0x26e68f['id']},{})[_0x8a8d('0x1c')](function(){return _0x5229e1;});}else{return _0x5229e1;}})['catch'](function(_0x22578b){logger['error'](_0x8a8d('0x49'),_0x22578b);throw _0x22578b;});}return _0x5229e1;})[_0x8a8d('0x1c')](respondWithResult(_0x9a4818,0xc9))[_0x8a8d('0x3a')](handleError(_0x9a4818,null));};exports[_0x8a8d('0x4a')]=function(_0x4ed945,_0xd7b765){var _0x499d97={'where':{'id':_0x4ed945[_0x8a8d('0x3c')]['id']}},_0x1a4500={};_0x1a4500[_0x8a8d('0x28')]=_['keys'](db[_0x8a8d('0x36')][_0x8a8d('0x25')]);_0x499d97['attributes']=_[_0x8a8d('0x2a')](_0x1a4500[_0x8a8d('0x28')],qs['fields'](_0x4ed945['query'][_0x8a8d('0x2c')]));_0x499d97[_0x8a8d('0x2b')]=_0x499d97['attributes']['length']?_0x499d97['attributes']:_0x1a4500[_0x8a8d('0x28')];if(_0x4ed945[_0x8a8d('0x29')][_0x8a8d('0x37')]){_0x499d97[_0x8a8d('0x38')]=[{'all':!![]}];}_0x499d97=_[_0x8a8d('0x32')]({},_0x499d97,_0x4ed945['options']);return db[_0x8a8d('0x36')][_0x8a8d('0x46')](_0x499d97)[_0x8a8d('0x1c')](handleEntityNotFound(_0xd7b765,null))[_0x8a8d('0x1c')](function(_0x59c138){if(_0x59c138){var _0x8f258=_0x59c138[_0x8a8d('0x42')]({'plain':!![]});_0x8f258=qs[_0x8a8d('0x4b')](_0x8f258,['id','createdAt',_0x8a8d('0x4c')]);_0x4ed945[_0x8a8d('0x40')]=_[_0x8a8d('0x4b')](_0x4ed945[_0x8a8d('0x40')],['id',_0x8a8d('0x4d'),_0x8a8d('0x4c')]);return db[_0x8a8d('0x36')]['create'](_[_0x8a8d('0x32')](_0x8f258,_0x4ed945['body']),{'include':_0x4ed945[_0x8a8d('0x29')]['includeAll']?[{'all':!![]}]:undefined})[_0x8a8d('0x1c')](function(_0x5b24dc){var _0x11df07=_0x4ed945[_0x8a8d('0x41')]['get']({'plain':!![]});if(!_0x11df07)throw new Error(_0x8a8d('0x43'));if(_0x11df07[_0x8a8d('0x44')]==='user'){var _0x33d40c=_0x5b24dc[_0x8a8d('0x42')]({'plain':!![]});var _0xf1c57=_0x8a8d('0x1e');return db[_0x8a8d('0x45')]['find']({'where':{'name':_0xf1c57,'userProfileId':_0x11df07[_0x8a8d('0x47')]},'raw':!![]})['then'](function(_0x5890aa){if(_0x5890aa&&_0x5890aa[_0x8a8d('0x48')]===0x0){return db[_0x8a8d('0x1f')]['create']({'name':_0x33d40c[_0x8a8d('0x22')],'resourceId':_0x33d40c['id'],'type':_0x5890aa[_0x8a8d('0x22')],'sectionId':_0x5890aa['id']},{})[_0x8a8d('0x1c')](function(){return _0x5b24dc;});}else{return _0x5b24dc;}})[_0x8a8d('0x3a')](function(_0x32b8b6){logger[_0x8a8d('0x21')](_0x8a8d('0x49'),_0x32b8b6);throw _0x32b8b6;});}return _0x5b24dc;});}})[_0x8a8d('0x1c')](respondWithResult(_0xd7b765,0xc9))['catch'](handleError(_0xd7b765,null));};exports['update']=function(_0x37da48,_0x12749c){if(_0x37da48[_0x8a8d('0x40')]['id']){delete _0x37da48['body']['id'];}return db[_0x8a8d('0x36')][_0x8a8d('0x46')]({'where':{'id':_0x37da48['params']['id']}})[_0x8a8d('0x1c')](handleEntityNotFound(_0x12749c,null))[_0x8a8d('0x1c')](saveUpdates(_0x37da48[_0x8a8d('0x40')],null))['then'](respondWithResult(_0x12749c,null))[_0x8a8d('0x3a')](handleError(_0x12749c,null));};exports[_0x8a8d('0x1d')]=function(_0x4ed23b,_0x4a7c56){return db[_0x8a8d('0x36')][_0x8a8d('0x46')]({'where':{'id':_0x4ed23b[_0x8a8d('0x3c')]['id']}})[_0x8a8d('0x1c')](handleEntityNotFound(_0x4a7c56,null))['then'](removeEntity(_0x4a7c56,null))[_0x8a8d('0x3a')](handleError(_0x4a7c56,null));};exports['getSessions']=function(_0x4e79f9,_0x48329f,_0x47bde0){var _0x4c8f87={'raw':!![],'where':{}};var _0x5cf8ff={};var _0x434a43={'count':0x0,'rows':[]};return db[_0x8a8d('0x36')][_0x8a8d('0x4e')]({'where':{'id':_0x4e79f9['params']['id']}})[_0x8a8d('0x1c')](handleEntityNotFound(_0x48329f,null))[_0x8a8d('0x1c')](function(_0x401eba){if(_0x401eba){_0x5cf8ff['model']=_[_0x8a8d('0x3d')](db[_0x8a8d('0x4f')]['rawAttributes']);_0x5cf8ff[_0x8a8d('0x29')]=_['keys'](_0x4e79f9[_0x8a8d('0x29')]);_0x5cf8ff[_0x8a8d('0x2f')]=_[_0x8a8d('0x2a')](_0x5cf8ff[_0x8a8d('0x28')],_0x5cf8ff[_0x8a8d('0x29')]);_0x4c8f87[_0x8a8d('0x2b')]=_[_0x8a8d('0x2a')](_0x5cf8ff[_0x8a8d('0x28')],qs[_0x8a8d('0x2c')](_0x4e79f9['query']['fields']));_0x4c8f87[_0x8a8d('0x2b')]=_0x4c8f87[_0x8a8d('0x2b')][_0x8a8d('0x3e')]?_0x4c8f87[_0x8a8d('0x2b')]:_0x5cf8ff[_0x8a8d('0x28')];if(!_0x4e79f9[_0x8a8d('0x29')][_0x8a8d('0x50')](_0x8a8d('0x51'))){_0x4c8f87[_0x8a8d('0x17')]=qs['limit'](_0x4e79f9[_0x8a8d('0x29')][_0x8a8d('0x17')]);_0x4c8f87[_0x8a8d('0x15')]=qs[_0x8a8d('0x15')](_0x4e79f9[_0x8a8d('0x29')][_0x8a8d('0x15')]);}_0x4c8f87[_0x8a8d('0x52')]=qs[_0x8a8d('0x2d')](_0x4e79f9[_0x8a8d('0x29')][_0x8a8d('0x2d')]);_0x4c8f87[_0x8a8d('0x2e')]=qs[_0x8a8d('0x2f')](_[_0x8a8d('0x30')](_0x4e79f9[_0x8a8d('0x29')],_0x5cf8ff['filters']));_0x4c8f87[_0x8a8d('0x2e')][_0x8a8d('0x53')]=_0x401eba['id'];if(_0x4e79f9[_0x8a8d('0x29')][_0x8a8d('0x31')]){_0x4c8f87[_0x8a8d('0x2e')]=_[_0x8a8d('0x32')](_0x4c8f87[_0x8a8d('0x2e')],{'$or':_[_0x8a8d('0x24')](_0x4c8f87[_0x8a8d('0x2b')],function(_0x44f522){var _0x27924b={};_0x27924b[_0x44f522]={'$like':'%'+_0x4e79f9['query'][_0x8a8d('0x31')]+'%'};return _0x27924b;})});}_0x4c8f87=_[_0x8a8d('0x32')]({},_0x4c8f87,_0x4e79f9[_0x8a8d('0x35')]);return db['JscriptySessionReport']['count']({'where':_0x4c8f87[_0x8a8d('0x2e')]})[_0x8a8d('0x1c')](function(_0x1f8fe8){_0x434a43['count']=_0x1f8fe8;if(_0x4e79f9[_0x8a8d('0x29')][_0x8a8d('0x37')]){_0x4c8f87[_0x8a8d('0x38')]=[{'all':!![]}];}return db[_0x8a8d('0x4f')][_0x8a8d('0x54')](_0x4c8f87);})['then'](function(_0x3bd8ab){_0x434a43[_0x8a8d('0x39')]=_0x3bd8ab;return _0x434a43;});}})[_0x8a8d('0x1c')](respondWithFilteredResult(_0x48329f,_0x4c8f87))[_0x8a8d('0x3a')](handleError(_0x48329f,null));};exports[_0x8a8d('0x55')]=function(_0x42fe74,_0x36af56,_0x5a5f27){var _0x5bcfe1={'raw':!![],'where':{}};var _0x6ac8e3={};var _0x5c8474={'count':0x0,'rows':[]};return db[_0x8a8d('0x36')][_0x8a8d('0x4e')]({'where':{'id':_0x42fe74[_0x8a8d('0x3c')]['id']}})[_0x8a8d('0x1c')](handleEntityNotFound(_0x36af56,null))[_0x8a8d('0x1c')](function(_0x38b8c8){if(_0x38b8c8){_0x6ac8e3[_0x8a8d('0x28')]=_['keys'](db[_0x8a8d('0x56')][_0x8a8d('0x25')]);_0x6ac8e3[_0x8a8d('0x29')]=_[_0x8a8d('0x3d')](_0x42fe74['query']);_0x6ac8e3[_0x8a8d('0x2f')]=_[_0x8a8d('0x2a')](_0x6ac8e3[_0x8a8d('0x28')],_0x6ac8e3[_0x8a8d('0x29')]);_0x5bcfe1[_0x8a8d('0x2b')]=_[_0x8a8d('0x2a')](_0x6ac8e3[_0x8a8d('0x28')],qs[_0x8a8d('0x2c')](_0x42fe74[_0x8a8d('0x29')][_0x8a8d('0x2c')]));_0x5bcfe1[_0x8a8d('0x2b')]=_0x5bcfe1[_0x8a8d('0x2b')][_0x8a8d('0x3e')]?_0x5bcfe1[_0x8a8d('0x2b')]:_0x6ac8e3['model'];if(!_0x42fe74[_0x8a8d('0x29')][_0x8a8d('0x50')](_0x8a8d('0x51'))){_0x5bcfe1[_0x8a8d('0x17')]=qs[_0x8a8d('0x17')](_0x42fe74[_0x8a8d('0x29')][_0x8a8d('0x17')]);_0x5bcfe1[_0x8a8d('0x15')]=qs[_0x8a8d('0x15')](_0x42fe74[_0x8a8d('0x29')][_0x8a8d('0x15')]);}_0x5bcfe1['order']=qs['sort'](_0x42fe74[_0x8a8d('0x29')][_0x8a8d('0x2d')]);_0x5bcfe1[_0x8a8d('0x2e')]=qs[_0x8a8d('0x2f')](_[_0x8a8d('0x30')](_0x42fe74[_0x8a8d('0x29')],_0x6ac8e3[_0x8a8d('0x2f')]));_0x5bcfe1['where']['ProjectId']=_0x38b8c8['id'];if(_0x42fe74[_0x8a8d('0x29')]['filter']){_0x5bcfe1[_0x8a8d('0x2e')]=_[_0x8a8d('0x32')](_0x5bcfe1[_0x8a8d('0x2e')],{'$or':_[_0x8a8d('0x24')](_0x5bcfe1[_0x8a8d('0x2b')],function(_0x3d18ff){var _0x4b5f17={};_0x4b5f17[_0x3d18ff]={'$like':'%'+_0x42fe74['query'][_0x8a8d('0x31')]+'%'};return _0x4b5f17;})});}_0x5bcfe1=_['merge']({},_0x5bcfe1,_0x42fe74[_0x8a8d('0x35')]);return db['JscriptyAnswerReport'][_0x8a8d('0x18')]({'where':_0x5bcfe1[_0x8a8d('0x2e')]})[_0x8a8d('0x1c')](function(_0x2635b6){_0x5c8474[_0x8a8d('0x18')]=_0x2635b6;if(_0x42fe74[_0x8a8d('0x29')][_0x8a8d('0x37')]){_0x5bcfe1['include']=[{'all':!![]}];}return db[_0x8a8d('0x56')][_0x8a8d('0x54')](_0x5bcfe1);})[_0x8a8d('0x1c')](function(_0x3033b2){_0x5c8474['rows']=_0x3033b2;return _0x5c8474;});}})[_0x8a8d('0x1c')](respondWithFilteredResult(_0x36af56,_0x5bcfe1))[_0x8a8d('0x3a')](handleError(_0x36af56,null));};function char(_0x268148){return _0x8a8d('0x57')===typeof _0x268148?String[_0x8a8d('0x58')][_0x8a8d('0x19')](null,arguments):_0x268148;}function needsEncapsulation(_0x3a432d){return!!_0x3a432d&&(_0x3a432d[_0x8a8d('0x59')]()[_0x8a8d('0x5a')](char(0xd))>=0x0||_0x3a432d['toString']()[_0x8a8d('0x5a')](char(0xa))>=0x0||_0x3a432d[_0x8a8d('0x59')]()[_0x8a8d('0x5a')](char(0x2c))>=0x0||_0x3a432d['toString']()[_0x8a8d('0x5a')](char(0x22))>=0x0);}function encapsulate(_0x22a0f2){var _0x2e1444=char(0x22),_0x306ffa='\x5c'+char(0x22),_0x249819=_0x22a0f2[_0x8a8d('0x59')]()[_0x8a8d('0x5b')](new RegExp(_0x2e1444,'g'),_0x306ffa);return _0x2e1444+_0x249819+_0x2e1444;}exports[_0x8a8d('0x5c')]=function(_0x4d7244,_0x2af864,_0x2a48cc){var _0x3d45a8,_0x192020;var _0x1af4c4={'where':{'ProjectId':_0x4d7244[_0x8a8d('0x3c')]['id']}};if(_0x4d7244[_0x8a8d('0x29')]['startTime']){_0x1af4c4[_0x8a8d('0x2e')][_0x8a8d('0x5d')]=JSON[_0x8a8d('0x5e')](_0x4d7244['query']['startTime']);}return db['JscriptySessionReport']['findAll'](_0x1af4c4)[_0x8a8d('0x1c')](handleEntityNotFound(_0x2af864,null))[_0x8a8d('0x1c')](function(_0x3c5e08){if(_0x3c5e08){_0x3d45a8=_0x3c5e08;return db[_0x8a8d('0x5f')][_0x8a8d('0x54')]({'where':{'SessionId':{'$in':_[_0x8a8d('0x24')](_0x3d45a8,'id')},'ProjectId':_0x4d7244['params']['id']},'order':_0x8a8d('0x60')});}})[_0x8a8d('0x1c')](handleEntityNotFound(_0x2af864,null))[_0x8a8d('0x1c')](function(_0x3f8baa){if(_0x3f8baa){_0x192020=_0x3f8baa;var _0x8d1d60={};for(var _0x108d62=0x0,_0x4e84f4=_0x192020[_0x8a8d('0x3e')];_0x108d62<_0x4e84f4;_0x108d62++){if(!_0x8d1d60[_0x8a8d('0x50')](_0x192020[_0x108d62]['questionId'])){_0x8d1d60[_0x192020[_0x108d62][_0x8a8d('0x61')]]=needsEncapsulation(_0x192020[_0x108d62]['question'])?encapsulate(_0x192020[_0x108d62][_0x8a8d('0x62')]):_0x192020[_0x108d62][_0x8a8d('0x62')];}}var _0x294794=[],_0x51557b={};for(var _0x5bbdd4=0x0,_0x24390c=_0x3d45a8[_0x8a8d('0x3e')];_0x5bbdd4<_0x24390c;_0x5bbdd4++){_0x51557b={'ProjectId':_0x4d7244[_0x8a8d('0x3c')]['id'],'SessionId':_0x3d45a8[_0x5bbdd4]['id'],'StartTime':moment(_0x3d45a8[_0x5bbdd4]['starttime'])[_0x8a8d('0x63')](_0x8a8d('0x64'))};for(var _0x36e7a3=0x0,_0x2001c7=_0x192020[_0x8a8d('0x3e')];_0x36e7a3<_0x2001c7;_0x36e7a3++){if(_0x192020[_0x36e7a3][_0x8a8d('0x65')]==_0x3d45a8[_0x5bbdd4]['id']&&_0x8d1d60[_0x8a8d('0x50')](_0x192020[_0x36e7a3][_0x8a8d('0x61')])){_0x51557b[_0x8d1d60[_0x192020[_0x36e7a3]['questionId']]]=_0x192020[_0x36e7a3][_0x8a8d('0x66')];}}for(var _0x52eb31 in _0x8d1d60){if(!_0x51557b[_0x8a8d('0x50')](_0x8d1d60[_0x52eb31])){_0x51557b[_0x8d1d60[_0x52eb31]]=null;}}_0x294794[_0x8a8d('0x67')](_0x51557b);}return _0x294794;}})[_0x8a8d('0x1c')](function(_0x396c18){if(!_[_0x8a8d('0x68')](_0x396c18)){var _0x49778b=toCsv(_0x396c18);var _0x45d316=Date[_0x8a8d('0x69')]();fs[_0x8a8d('0x6a')](util[_0x8a8d('0x63')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x4d7244[_0x8a8d('0x3c')]['id'],_0x45d316),_0x49778b);_0x2af864[_0x8a8d('0x6b')](_0x8a8d('0x6c'),'attachment;\x20filename='+util[_0x8a8d('0x63')](_0x8a8d('0x6d'),_0x4d7244[_0x8a8d('0x3c')]['id'],_0x45d316));_0x2af864[_0x8a8d('0x6b')](_0x8a8d('0x6e'),_0x8a8d('0x6f'));return _0x2af864[_0x8a8d('0x70')](util['format'](_0x8a8d('0x71'),_0x4d7244[_0x8a8d('0x3c')]['id'],_0x45d316));}else{return _0x2af864[_0x8a8d('0x12')](0xcc);}})[_0x8a8d('0x3a')](handleError(_0x2af864,null));}; \ No newline at end of file +var _0xf4c9=['query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','JscriptyProject','includeAll','include','rows','catch','show','keys','find','create','body','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','Projects','findOne','ProjectId','JscriptySessionReport','JscriptyAnswerReport','findAll','number','fromCharCode','apply','toString','indexOf','replace','getSummary','startTime','JscriptyQuestionReport','-createdAt','questionId','question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','json','offset','undefined','limit','count','reject','update','destroy','then','get','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','model'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf4c9,0x1aa));var _0x9f4c=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0xf4c9[_0x525c7b];return _0x27b33e;};'use strict';var emlformat=require(_0x9f4c('0x0'));var rimraf=require(_0x9f4c('0x1'));var zipdir=require(_0x9f4c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9f4c('0x3'));var moment=require('moment');var BPromise=require(_0x9f4c('0x4'));var Mustache=require(_0x9f4c('0x5'));var util=require(_0x9f4c('0x6'));var path=require('path');var sox=require(_0x9f4c('0x7'));var csv=require('to-csv');var ejs=require(_0x9f4c('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x9f4c('0x9'));var jsforce=require(_0x9f4c('0xa'));var deskjs=require(_0x9f4c('0xb'));var toCsv=require(_0x9f4c('0xc'));var querystring=require(_0x9f4c('0xd'));var Papa=require(_0x9f4c('0xe'));var Redis=require('ioredis');var authService=require(_0x9f4c('0xf'));var qs=require(_0x9f4c('0x10'));var as=require(_0x9f4c('0x11'));var hardwareService=require(_0x9f4c('0x12'));var logger=require(_0x9f4c('0x13'))(_0x9f4c('0x14'));var utils=require(_0x9f4c('0x15'));var config=require(_0x9f4c('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d71a9,_0x124492){_0x124492=_0x124492||0xcc;return function(_0x53159a){if(_0x53159a){return _0x4d71a9['sendStatus'](_0x124492);}return _0x4d71a9[_0x9f4c('0x17')](_0x124492)['end']();};}function respondWithResult(_0x5a9cb0,_0xf217d4){_0xf217d4=_0xf217d4||0xc8;return function(_0x4ce352){if(_0x4ce352){return _0x5a9cb0['status'](_0xf217d4)[_0x9f4c('0x18')](_0x4ce352);}};}function respondWithFilteredResult(_0x516787,_0x25f8ed){return function(_0x336fc2){if(_0x336fc2){var _0x46abfe=typeof _0x25f8ed[_0x9f4c('0x19')]===_0x9f4c('0x1a')&&typeof _0x25f8ed[_0x9f4c('0x1b')]==='undefined';var _0x2be1ba=_0x336fc2[_0x9f4c('0x1c')];var _0x143335=_0x46abfe?0x0:_0x25f8ed[_0x9f4c('0x19')];var _0x3f862c=_0x46abfe?_0x336fc2['count']:_0x25f8ed[_0x9f4c('0x19')]+_0x25f8ed[_0x9f4c('0x1b')];var _0x8efbfe;if(_0x3f862c>=_0x2be1ba){_0x3f862c=_0x2be1ba;_0x8efbfe=0xc8;}else{_0x8efbfe=0xce;}_0x516787['status'](_0x8efbfe);return _0x516787['set']('Content-Range',_0x143335+'-'+_0x3f862c+'/'+_0x2be1ba)['json'](_0x336fc2);}return null;};}function patchUpdates(_0x2040a5){return function(_0x47accd){try{jsonpatch['apply'](_0x47accd,_0x2040a5,!![]);}catch(_0x603a8d){return BPromise[_0x9f4c('0x1d')](_0x603a8d);}return _0x47accd['save']();};}function saveUpdates(_0x341693,_0x1d0df9){return function(_0x57b636){if(_0x57b636){return _0x57b636[_0x9f4c('0x1e')](_0x341693)['then'](function(_0x5e6632){return _0x5e6632;});}return null;};}function removeEntity(_0x36e15f,_0x49d6d6){return function(_0xa4a8e9){if(_0xa4a8e9){return _0xa4a8e9[_0x9f4c('0x1f')]()[_0x9f4c('0x20')](function(){var _0x4698b3=_0xa4a8e9[_0x9f4c('0x21')]({'plain':!![]});var _0x10c9a9='Projects';return db[_0x9f4c('0x22')][_0x9f4c('0x1f')]({'where':{'type':_0x10c9a9,'resourceId':_0x4698b3['id']}})[_0x9f4c('0x20')](function(){return _0xa4a8e9;});})[_0x9f4c('0x20')](function(){_0x36e15f[_0x9f4c('0x17')](0xcc)[_0x9f4c('0x23')]();});}};}function handleEntityNotFound(_0x945f00,_0xadd84c){return function(_0x3bcc3f){if(!_0x3bcc3f){_0x945f00[_0x9f4c('0x24')](0x194);}return _0x3bcc3f;};}function handleError(_0x4712c7,_0x4f0d37){_0x4f0d37=_0x4f0d37||0x1f4;return function(_0x168ed8){logger[_0x9f4c('0x25')](_0x168ed8[_0x9f4c('0x26')]);if(_0x168ed8[_0x9f4c('0x27')]){delete _0x168ed8[_0x9f4c('0x27')];}_0x4712c7[_0x9f4c('0x17')](_0x4f0d37)[_0x9f4c('0x28')](_0x168ed8);};}exports[_0x9f4c('0x29')]=function(_0x20d2f4,_0x2158ac){var _0x4e9b77={},_0x4b6d91={},_0x52ef31={'count':0x0,'rows':[]};var _0x101c13=_[_0x9f4c('0x2a')](db['JscriptyProject'][_0x9f4c('0x2b')],function(_0x8cd2b3){return{'name':_0x8cd2b3[_0x9f4c('0x2c')],'type':_0x8cd2b3['type']['key']};});_0x4b6d91[_0x9f4c('0x2d')]=_[_0x9f4c('0x2a')](_0x101c13,'name');_0x4b6d91[_0x9f4c('0x2e')]=_['keys'](_0x20d2f4['query']);_0x4b6d91[_0x9f4c('0x2f')]=_[_0x9f4c('0x30')](_0x4b6d91[_0x9f4c('0x2d')],_0x4b6d91[_0x9f4c('0x2e')]);_0x4e9b77[_0x9f4c('0x31')]=_[_0x9f4c('0x30')](_0x4b6d91['model'],qs[_0x9f4c('0x32')](_0x20d2f4[_0x9f4c('0x2e')][_0x9f4c('0x32')]));_0x4e9b77[_0x9f4c('0x31')]=_0x4e9b77[_0x9f4c('0x31')][_0x9f4c('0x33')]?_0x4e9b77[_0x9f4c('0x31')]:_0x4b6d91[_0x9f4c('0x2d')];if(!_0x20d2f4[_0x9f4c('0x2e')][_0x9f4c('0x34')](_0x9f4c('0x35'))){_0x4e9b77[_0x9f4c('0x1b')]=qs[_0x9f4c('0x1b')](_0x20d2f4['query'][_0x9f4c('0x1b')]);_0x4e9b77['offset']=qs[_0x9f4c('0x19')](_0x20d2f4[_0x9f4c('0x2e')][_0x9f4c('0x19')]);}_0x4e9b77[_0x9f4c('0x36')]=qs[_0x9f4c('0x37')](_0x20d2f4[_0x9f4c('0x2e')][_0x9f4c('0x37')]);_0x4e9b77[_0x9f4c('0x38')]=qs[_0x9f4c('0x2f')](_[_0x9f4c('0x39')](_0x20d2f4[_0x9f4c('0x2e')],_0x4b6d91[_0x9f4c('0x2f')]),_0x101c13);if(_0x20d2f4['query'][_0x9f4c('0x3a')]){_0x4e9b77[_0x9f4c('0x38')]=_[_0x9f4c('0x3b')](_0x4e9b77['where'],{'$or':_[_0x9f4c('0x2a')](_0x101c13,function(_0x380c08){if(_0x380c08[_0x9f4c('0x3c')]!=='VIRTUAL'){var _0xb58e5a={};_0xb58e5a[_0x380c08[_0x9f4c('0x27')]]={'$like':'%'+_0x20d2f4[_0x9f4c('0x2e')][_0x9f4c('0x3a')]+'%'};return _0xb58e5a;}})});}_0x4e9b77=_[_0x9f4c('0x3b')]({},_0x4e9b77,_0x20d2f4[_0x9f4c('0x3d')]);var _0x44b920={'where':_0x4e9b77[_0x9f4c('0x38')]};return db[_0x9f4c('0x3e')][_0x9f4c('0x1c')](_0x44b920)['then'](function(_0x167363){_0x52ef31[_0x9f4c('0x1c')]=_0x167363;if(_0x20d2f4['query'][_0x9f4c('0x3f')]){_0x4e9b77[_0x9f4c('0x40')]=[{'all':!![]}];}return db[_0x9f4c('0x3e')]['findAll'](_0x4e9b77);})[_0x9f4c('0x20')](function(_0x4da3ed){_0x52ef31[_0x9f4c('0x41')]=_0x4da3ed;return _0x52ef31;})['then'](respondWithFilteredResult(_0x2158ac,_0x4e9b77))[_0x9f4c('0x42')](handleError(_0x2158ac,null));};exports[_0x9f4c('0x43')]=function(_0x10437e,_0x437558){var _0x3ee559={'raw':![],'where':{'id':_0x10437e['params']['id']}},_0x51553d={};_0x51553d[_0x9f4c('0x2d')]=_[_0x9f4c('0x44')](db[_0x9f4c('0x3e')]['rawAttributes']);_0x51553d[_0x9f4c('0x2e')]=_['keys'](_0x10437e['query']);_0x51553d[_0x9f4c('0x2f')]=_['intersection'](_0x51553d[_0x9f4c('0x2d')],_0x51553d[_0x9f4c('0x2e')]);_0x3ee559[_0x9f4c('0x31')]=_['intersection'](_0x51553d[_0x9f4c('0x2d')],qs['fields'](_0x10437e[_0x9f4c('0x2e')][_0x9f4c('0x32')]));_0x3ee559[_0x9f4c('0x31')]=_0x3ee559[_0x9f4c('0x31')]['length']?_0x3ee559[_0x9f4c('0x31')]:_0x51553d['model'];if(_0x10437e[_0x9f4c('0x2e')]['includeAll']){_0x3ee559[_0x9f4c('0x40')]=[{'all':!![]}];}_0x3ee559=_[_0x9f4c('0x3b')]({},_0x3ee559,_0x10437e['options']);return db[_0x9f4c('0x3e')][_0x9f4c('0x45')](_0x3ee559)['then'](handleEntityNotFound(_0x437558,null))[_0x9f4c('0x20')](respondWithResult(_0x437558,null))['catch'](handleError(_0x437558,null));};exports[_0x9f4c('0x46')]=function(_0x384f47,_0x5b8fca){return db['JscriptyProject']['create'](_0x384f47[_0x9f4c('0x47')],{})[_0x9f4c('0x20')](function(_0x5e93ae){var _0x2c7f9a=_0x384f47[_0x9f4c('0x48')][_0x9f4c('0x21')]({'plain':!![]});if(!_0x2c7f9a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2c7f9a[_0x9f4c('0x49')]==='user'){var _0x1830e7=_0x5e93ae[_0x9f4c('0x21')]({'plain':!![]});var _0x50edbd='Projects';return db[_0x9f4c('0x4a')][_0x9f4c('0x45')]({'where':{'name':_0x50edbd,'userProfileId':_0x2c7f9a['userProfileId']},'raw':!![]})[_0x9f4c('0x20')](function(_0x885938){if(_0x885938&&_0x885938[_0x9f4c('0x4b')]===0x0){return db['UserProfileResource']['create']({'name':_0x1830e7[_0x9f4c('0x27')],'resourceId':_0x1830e7['id'],'type':_0x885938[_0x9f4c('0x27')],'sectionId':_0x885938['id']},{})[_0x9f4c('0x20')](function(){return _0x5e93ae;});}else{return _0x5e93ae;}})[_0x9f4c('0x42')](function(_0x558102){logger[_0x9f4c('0x25')](_0x9f4c('0x4c'),_0x558102);throw _0x558102;});}return _0x5e93ae;})[_0x9f4c('0x20')](respondWithResult(_0x5b8fca,0xc9))[_0x9f4c('0x42')](handleError(_0x5b8fca,null));};exports[_0x9f4c('0x4d')]=function(_0x200190,_0x2fbaaa){var _0x1e88b0={'where':{'id':_0x200190[_0x9f4c('0x4e')]['id']}},_0x20ea33={};_0x20ea33[_0x9f4c('0x2d')]=_['keys'](db[_0x9f4c('0x3e')][_0x9f4c('0x2b')]);_0x1e88b0[_0x9f4c('0x31')]=_[_0x9f4c('0x30')](_0x20ea33[_0x9f4c('0x2d')],qs['fields'](_0x200190['query'][_0x9f4c('0x32')]));_0x1e88b0['attributes']=_0x1e88b0[_0x9f4c('0x31')]['length']?_0x1e88b0[_0x9f4c('0x31')]:_0x20ea33[_0x9f4c('0x2d')];if(_0x200190[_0x9f4c('0x2e')][_0x9f4c('0x3f')]){_0x1e88b0[_0x9f4c('0x40')]=[{'all':!![]}];}_0x1e88b0=_[_0x9f4c('0x3b')]({},_0x1e88b0,_0x200190['options']);return db[_0x9f4c('0x3e')][_0x9f4c('0x45')](_0x1e88b0)[_0x9f4c('0x20')](handleEntityNotFound(_0x2fbaaa,null))[_0x9f4c('0x20')](function(_0x440576){if(_0x440576){var _0x584744=_0x440576[_0x9f4c('0x21')]({'plain':!![]});_0x584744=qs[_0x9f4c('0x4f')](_0x584744,['id',_0x9f4c('0x50'),_0x9f4c('0x51')]);_0x200190[_0x9f4c('0x47')]=_[_0x9f4c('0x4f')](_0x200190[_0x9f4c('0x47')],['id',_0x9f4c('0x50'),_0x9f4c('0x51')]);return db['JscriptyProject'][_0x9f4c('0x46')](_[_0x9f4c('0x3b')](_0x584744,_0x200190[_0x9f4c('0x47')]),{'include':_0x200190[_0x9f4c('0x2e')][_0x9f4c('0x3f')]?[{'all':!![]}]:undefined})[_0x9f4c('0x20')](function(_0x5ae1ef){var _0x36d619=_0x200190[_0x9f4c('0x48')][_0x9f4c('0x21')]({'plain':!![]});if(!_0x36d619)throw new Error(_0x9f4c('0x52'));if(_0x36d619[_0x9f4c('0x49')]===_0x9f4c('0x48')){var _0x4a488f=_0x5ae1ef['get']({'plain':!![]});var _0x484151=_0x9f4c('0x53');return db[_0x9f4c('0x4a')][_0x9f4c('0x45')]({'where':{'name':_0x484151,'userProfileId':_0x36d619['userProfileId']},'raw':!![]})[_0x9f4c('0x20')](function(_0x108bee){if(_0x108bee&&_0x108bee[_0x9f4c('0x4b')]===0x0){return db[_0x9f4c('0x22')][_0x9f4c('0x46')]({'name':_0x4a488f[_0x9f4c('0x27')],'resourceId':_0x4a488f['id'],'type':_0x108bee[_0x9f4c('0x27')],'sectionId':_0x108bee['id']},{})[_0x9f4c('0x20')](function(){return _0x5ae1ef;});}else{return _0x5ae1ef;}})[_0x9f4c('0x42')](function(_0x10ba77){logger['error'](_0x9f4c('0x4c'),_0x10ba77);throw _0x10ba77;});}return _0x5ae1ef;});}})[_0x9f4c('0x20')](respondWithResult(_0x2fbaaa,0xc9))[_0x9f4c('0x42')](handleError(_0x2fbaaa,null));};exports[_0x9f4c('0x1e')]=function(_0x528cc5,_0x5294a2){if(_0x528cc5['body']['id']){delete _0x528cc5[_0x9f4c('0x47')]['id'];}return db[_0x9f4c('0x3e')]['find']({'where':{'id':_0x528cc5[_0x9f4c('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5294a2,null))['then'](saveUpdates(_0x528cc5[_0x9f4c('0x47')],null))['then'](respondWithResult(_0x5294a2,null))[_0x9f4c('0x42')](handleError(_0x5294a2,null));};exports[_0x9f4c('0x1f')]=function(_0x4e3904,_0x13c7a7){return db['JscriptyProject']['find']({'where':{'id':_0x4e3904[_0x9f4c('0x4e')]['id']}})[_0x9f4c('0x20')](handleEntityNotFound(_0x13c7a7,null))[_0x9f4c('0x20')](removeEntity(_0x13c7a7,null))[_0x9f4c('0x42')](handleError(_0x13c7a7,null));};exports['getSessions']=function(_0x33967a,_0x5514a1,_0x5505f3){var _0x161e0d={'raw':!![],'where':{}};var _0x558648={};var _0x108845={'count':0x0,'rows':[]};return db[_0x9f4c('0x3e')][_0x9f4c('0x54')]({'where':{'id':_0x33967a[_0x9f4c('0x4e')]['id']}})[_0x9f4c('0x20')](handleEntityNotFound(_0x5514a1,null))['then'](function(_0x5c0366){if(_0x5c0366){_0x558648['model']=_[_0x9f4c('0x44')](db['JscriptySessionReport'][_0x9f4c('0x2b')]);_0x558648[_0x9f4c('0x2e')]=_[_0x9f4c('0x44')](_0x33967a['query']);_0x558648[_0x9f4c('0x2f')]=_[_0x9f4c('0x30')](_0x558648[_0x9f4c('0x2d')],_0x558648[_0x9f4c('0x2e')]);_0x161e0d['attributes']=_[_0x9f4c('0x30')](_0x558648[_0x9f4c('0x2d')],qs[_0x9f4c('0x32')](_0x33967a[_0x9f4c('0x2e')]['fields']));_0x161e0d['attributes']=_0x161e0d['attributes']['length']?_0x161e0d['attributes']:_0x558648[_0x9f4c('0x2d')];if(!_0x33967a['query'][_0x9f4c('0x34')](_0x9f4c('0x35'))){_0x161e0d['limit']=qs['limit'](_0x33967a[_0x9f4c('0x2e')][_0x9f4c('0x1b')]);_0x161e0d[_0x9f4c('0x19')]=qs[_0x9f4c('0x19')](_0x33967a['query'][_0x9f4c('0x19')]);}_0x161e0d['order']=qs['sort'](_0x33967a['query'][_0x9f4c('0x37')]);_0x161e0d[_0x9f4c('0x38')]=qs['filters'](_[_0x9f4c('0x39')](_0x33967a[_0x9f4c('0x2e')],_0x558648[_0x9f4c('0x2f')]));_0x161e0d[_0x9f4c('0x38')][_0x9f4c('0x55')]=_0x5c0366['id'];if(_0x33967a[_0x9f4c('0x2e')][_0x9f4c('0x3a')]){_0x161e0d[_0x9f4c('0x38')]=_[_0x9f4c('0x3b')](_0x161e0d[_0x9f4c('0x38')],{'$or':_[_0x9f4c('0x2a')](_0x161e0d[_0x9f4c('0x31')],function(_0x289028){var _0x4804af={};_0x4804af[_0x289028]={'$like':'%'+_0x33967a[_0x9f4c('0x2e')][_0x9f4c('0x3a')]+'%'};return _0x4804af;})});}_0x161e0d=_[_0x9f4c('0x3b')]({},_0x161e0d,_0x33967a[_0x9f4c('0x3d')]);return db[_0x9f4c('0x56')]['count']({'where':_0x161e0d[_0x9f4c('0x38')]})['then'](function(_0x416d88){_0x108845[_0x9f4c('0x1c')]=_0x416d88;if(_0x33967a['query'][_0x9f4c('0x3f')]){_0x161e0d['include']=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x161e0d);})['then'](function(_0x11112c){_0x108845[_0x9f4c('0x41')]=_0x11112c;return _0x108845;});}})[_0x9f4c('0x20')](respondWithFilteredResult(_0x5514a1,_0x161e0d))[_0x9f4c('0x42')](handleError(_0x5514a1,null));};exports['getAnswers']=function(_0x2138f1,_0x36cbc6,_0x12bf39){var _0x55a4ac={'raw':!![],'where':{}};var _0x2aa997={};var _0x1ffbd6={'count':0x0,'rows':[]};return db[_0x9f4c('0x3e')]['findOne']({'where':{'id':_0x2138f1[_0x9f4c('0x4e')]['id']}})['then'](handleEntityNotFound(_0x36cbc6,null))['then'](function(_0x12603f){if(_0x12603f){_0x2aa997[_0x9f4c('0x2d')]=_[_0x9f4c('0x44')](db['JscriptyAnswerReport'][_0x9f4c('0x2b')]);_0x2aa997[_0x9f4c('0x2e')]=_[_0x9f4c('0x44')](_0x2138f1['query']);_0x2aa997[_0x9f4c('0x2f')]=_[_0x9f4c('0x30')](_0x2aa997[_0x9f4c('0x2d')],_0x2aa997['query']);_0x55a4ac['attributes']=_[_0x9f4c('0x30')](_0x2aa997[_0x9f4c('0x2d')],qs[_0x9f4c('0x32')](_0x2138f1['query'][_0x9f4c('0x32')]));_0x55a4ac[_0x9f4c('0x31')]=_0x55a4ac['attributes'][_0x9f4c('0x33')]?_0x55a4ac[_0x9f4c('0x31')]:_0x2aa997[_0x9f4c('0x2d')];if(!_0x2138f1[_0x9f4c('0x2e')]['hasOwnProperty'](_0x9f4c('0x35'))){_0x55a4ac[_0x9f4c('0x1b')]=qs[_0x9f4c('0x1b')](_0x2138f1[_0x9f4c('0x2e')]['limit']);_0x55a4ac[_0x9f4c('0x19')]=qs['offset'](_0x2138f1[_0x9f4c('0x2e')][_0x9f4c('0x19')]);}_0x55a4ac[_0x9f4c('0x36')]=qs[_0x9f4c('0x37')](_0x2138f1[_0x9f4c('0x2e')][_0x9f4c('0x37')]);_0x55a4ac[_0x9f4c('0x38')]=qs[_0x9f4c('0x2f')](_[_0x9f4c('0x39')](_0x2138f1[_0x9f4c('0x2e')],_0x2aa997['filters']));_0x55a4ac[_0x9f4c('0x38')]['ProjectId']=_0x12603f['id'];if(_0x2138f1[_0x9f4c('0x2e')][_0x9f4c('0x3a')]){_0x55a4ac[_0x9f4c('0x38')]=_[_0x9f4c('0x3b')](_0x55a4ac[_0x9f4c('0x38')],{'$or':_[_0x9f4c('0x2a')](_0x55a4ac[_0x9f4c('0x31')],function(_0x5db3be){var _0x19b09b={};_0x19b09b[_0x5db3be]={'$like':'%'+_0x2138f1[_0x9f4c('0x2e')]['filter']+'%'};return _0x19b09b;})});}_0x55a4ac=_[_0x9f4c('0x3b')]({},_0x55a4ac,_0x2138f1[_0x9f4c('0x3d')]);return db[_0x9f4c('0x57')][_0x9f4c('0x1c')]({'where':_0x55a4ac[_0x9f4c('0x38')]})[_0x9f4c('0x20')](function(_0x44cc1f){_0x1ffbd6[_0x9f4c('0x1c')]=_0x44cc1f;if(_0x2138f1[_0x9f4c('0x2e')]['includeAll']){_0x55a4ac[_0x9f4c('0x40')]=[{'all':!![]}];}return db[_0x9f4c('0x57')][_0x9f4c('0x58')](_0x55a4ac);})[_0x9f4c('0x20')](function(_0x371e82){_0x1ffbd6[_0x9f4c('0x41')]=_0x371e82;return _0x1ffbd6;});}})[_0x9f4c('0x20')](respondWithFilteredResult(_0x36cbc6,_0x55a4ac))['catch'](handleError(_0x36cbc6,null));};function char(_0x49c366){return _0x9f4c('0x59')===typeof _0x49c366?String[_0x9f4c('0x5a')][_0x9f4c('0x5b')](null,arguments):_0x49c366;}function needsEncapsulation(_0x127215){return!!_0x127215&&(_0x127215[_0x9f4c('0x5c')]()['indexOf'](char(0xd))>=0x0||_0x127215[_0x9f4c('0x5c')]()[_0x9f4c('0x5d')](char(0xa))>=0x0||_0x127215[_0x9f4c('0x5c')]()[_0x9f4c('0x5d')](char(0x2c))>=0x0||_0x127215[_0x9f4c('0x5c')]()[_0x9f4c('0x5d')](char(0x22))>=0x0);}function encapsulate(_0x224eb5){var _0x498cc8=char(0x22),_0x214e48='\x5c'+char(0x22),_0x1de423=_0x224eb5['toString']()[_0x9f4c('0x5e')](new RegExp(_0x498cc8,'g'),_0x214e48);return _0x498cc8+_0x1de423+_0x498cc8;}exports[_0x9f4c('0x5f')]=function(_0x22ef54,_0x1912c9,_0x1b49cd){var _0xcb283d,_0x3fbb63;var _0x472946={'where':{'ProjectId':_0x22ef54['params']['id']}};if(_0x22ef54[_0x9f4c('0x2e')]['startTime']){_0x472946[_0x9f4c('0x38')]['starttime']=JSON['parse'](_0x22ef54[_0x9f4c('0x2e')][_0x9f4c('0x60')]);}return db[_0x9f4c('0x56')][_0x9f4c('0x58')](_0x472946)[_0x9f4c('0x20')](handleEntityNotFound(_0x1912c9,null))[_0x9f4c('0x20')](function(_0x632ae){if(_0x632ae){_0xcb283d=_0x632ae;return db[_0x9f4c('0x61')][_0x9f4c('0x58')]({'where':{'SessionId':{'$in':_[_0x9f4c('0x2a')](_0xcb283d,'id')},'ProjectId':_0x22ef54[_0x9f4c('0x4e')]['id']},'order':_0x9f4c('0x62')});}})[_0x9f4c('0x20')](handleEntityNotFound(_0x1912c9,null))[_0x9f4c('0x20')](function(_0x285722){if(_0x285722){_0x3fbb63=_0x285722;var _0x2c8f1c={};for(var _0x333edd=0x0,_0x406d47=_0x3fbb63[_0x9f4c('0x33')];_0x333edd<_0x406d47;_0x333edd++){if(!_0x2c8f1c[_0x9f4c('0x34')](_0x3fbb63[_0x333edd][_0x9f4c('0x63')])){_0x2c8f1c[_0x3fbb63[_0x333edd][_0x9f4c('0x63')]]=needsEncapsulation(_0x3fbb63[_0x333edd][_0x9f4c('0x64')])?encapsulate(_0x3fbb63[_0x333edd][_0x9f4c('0x64')]):_0x3fbb63[_0x333edd][_0x9f4c('0x64')];}}var _0x104d21=[],_0x29e563={};for(var _0x5568a3=0x0,_0x7c5300=_0xcb283d[_0x9f4c('0x33')];_0x5568a3<_0x7c5300;_0x5568a3++){_0x29e563={'ProjectId':_0x22ef54[_0x9f4c('0x4e')]['id'],'SessionId':_0xcb283d[_0x5568a3]['id'],'StartTime':moment(_0xcb283d[_0x5568a3][_0x9f4c('0x65')])[_0x9f4c('0x66')](_0x9f4c('0x67'))};for(var _0x594f15=0x0,_0x302a65=_0x3fbb63['length'];_0x594f15<_0x302a65;_0x594f15++){if(_0x3fbb63[_0x594f15][_0x9f4c('0x68')]==_0xcb283d[_0x5568a3]['id']&&_0x2c8f1c[_0x9f4c('0x34')](_0x3fbb63[_0x594f15][_0x9f4c('0x63')])){_0x29e563[_0x2c8f1c[_0x3fbb63[_0x594f15][_0x9f4c('0x63')]]]=_0x3fbb63[_0x594f15][_0x9f4c('0x69')];}}for(var _0x1bef4c in _0x2c8f1c){if(!_0x29e563[_0x9f4c('0x34')](_0x2c8f1c[_0x1bef4c])){_0x29e563[_0x2c8f1c[_0x1bef4c]]=null;}}_0x104d21[_0x9f4c('0x6a')](_0x29e563);}return _0x104d21;}})[_0x9f4c('0x20')](function(_0x3b5658){if(!_[_0x9f4c('0x6b')](_0x3b5658)){var _0x1cb837=toCsv(_0x3b5658);var _0x5f4596=Date[_0x9f4c('0x6c')]();fs[_0x9f4c('0x6d')](util[_0x9f4c('0x66')](_0x9f4c('0x6e'),_0x22ef54[_0x9f4c('0x4e')]['id'],_0x5f4596),_0x1cb837);_0x1912c9[_0x9f4c('0x6f')](_0x9f4c('0x70'),_0x9f4c('0x71')+util['format'](_0x9f4c('0x72'),_0x22ef54[_0x9f4c('0x4e')]['id'],_0x5f4596));_0x1912c9[_0x9f4c('0x6f')](_0x9f4c('0x73'),_0x9f4c('0x74'));return _0x1912c9[_0x9f4c('0x75')](util[_0x9f4c('0x66')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x22ef54['params']['id'],_0x5f4596));}else{return _0x1912c9[_0x9f4c('0x24')](0xcc);}})['catch'](handleError(_0x1912c9,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 75f9cfb..f5420aa 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 _0x4f99=['define','jscripty_projects','lodash','util','api','moment','bluebird','path','rimraf','./jscriptyProject.attributes','exports'];(function(_0x3cfb0d,_0x4df584){var _0x3486b4=function(_0x1b0939){while(--_0x1b0939){_0x3cfb0d['push'](_0x3cfb0d['shift']());}};_0x3486b4(++_0x4df584);}(_0x4f99,0x157));var _0x94f9=function(_0x16abc5,_0x2607a4){_0x16abc5=_0x16abc5-0x0;var _0x1d0963=_0x4f99[_0x16abc5];return _0x1d0963;};'use strict';var _=require(_0x94f9('0x0'));var util=require(_0x94f9('0x1'));var logger=require('../../config/logger')(_0x94f9('0x2'));var moment=require(_0x94f9('0x3'));var BPromise=require(_0x94f9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x94f9('0x5'));var rimraf=require(_0x94f9('0x6'));var config=require('../../config/environment');var attributes=require(_0x94f9('0x7'));module[_0x94f9('0x8')]=function(_0x36d91c,_0x253a79){return _0x36d91c[_0x94f9('0x9')]('JscriptyProject',attributes,{'tableName':_0x94f9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4abf=['rimraf','exports','define','jscripty_projects','lodash','util','api','path'];(function(_0x35b69d,_0x3f08b){var _0x4ccc26=function(_0x2d2403){while(--_0x2d2403){_0x35b69d['push'](_0x35b69d['shift']());}};_0x4ccc26(++_0x3f08b);}(_0x4abf,0xac));var _0xf4ab=function(_0x255a85,_0x43ea4c){_0x255a85=_0x255a85-0x0;var _0x5ee089=_0x4abf[_0x255a85];return _0x5ee089;};'use strict';var _=require(_0xf4ab('0x0'));var util=require(_0xf4ab('0x1'));var logger=require('../../config/logger')(_0xf4ab('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf4ab('0x3'));var rimraf=require(_0xf4ab('0x4'));var config=require('../../config/environment');var attributes=require('./jscriptyProject.attributes');module[_0xf4ab('0x5')]=function(_0x4160fb,_0x2e6efe){return _0x4160fb[_0xf4ab('0x6')]('JscriptyProject',attributes,{'tableName':_0xf4ab('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 72de1c7..e2ebd92 100644 --- a/server/api/jscriptyProject/jscriptyProject.rpc.js +++ b/server/api/jscriptyProject/jscriptyProject.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['code','JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x4b959b,_0x204312){var _0x41f5ce=function(_0x565d8e){while(--_0x565d8e){_0x4b959b['push'](_0x4b959b['shift']());}};_0x41f5ce(++_0x204312);}(_0x70e0,0x17b));var _0x070e=function(_0x19da6e,_0x17cac9){_0x19da6e=_0x19da6e-0x0;var _0x2697cf=_0x70e0[_0x19da6e];return _0x2697cf;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file +var _0xaa88=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','error','JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x38fcbb,_0xd2b478){var _0x4bbb75=function(_0x3575d5){while(--_0x3575d5){_0x38fcbb['push'](_0x38fcbb['shift']());}};_0x4bbb75(++_0xd2b478);}(_0xaa88,0x137));var _0x8aa8=function(_0x349148,_0x31eabb){_0x349148=_0x349148-0x0;var _0x2f2b0f=_0xaa88[_0x349148];return _0x2f2b0f;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var moment=require(_0x8aa8('0x2'));var BPromise=require(_0x8aa8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8aa8('0x4'));var db=require(_0x8aa8('0x5'))['db'];var utils=require(_0x8aa8('0x6'));var logger=require(_0x8aa8('0x7'))(_0x8aa8('0x8'));var config=require(_0x8aa8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8aa8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5264ff,_0x449d2d,_0x1ed84d){return new BPromise(function(_0x27c08d,_0x40826f){return client['request'](_0x5264ff,_0x1ed84d)[_0x8aa8('0xb')](function(_0x2d974c){logger[_0x8aa8('0xc')]('JscriptyProject,\x20%s,\x20%s',_0x449d2d,_0x8aa8('0xd'));logger[_0x8aa8('0xe')](_0x8aa8('0xf'),_0x449d2d,_0x8aa8('0xd'),JSON['stringify'](_0x2d974c));if(_0x2d974c[_0x8aa8('0x10')]){if(_0x2d974c[_0x8aa8('0x10')]['code']===0x1f4){logger[_0x8aa8('0x10')](_0x8aa8('0x11'),_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x40826f(_0x2d974c[_0x8aa8('0x10')][_0x8aa8('0x12')]);}logger[_0x8aa8('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x27c08d(_0x2d974c['error'][_0x8aa8('0x12')]);}else{logger[_0x8aa8('0xc')](_0x8aa8('0x11'),_0x449d2d,_0x8aa8('0xd'));_0x27c08d(_0x2d974c[_0x8aa8('0x13')][_0x8aa8('0x12')]);}})[_0x8aa8('0x14')](function(_0xd59fb8){logger[_0x8aa8('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x449d2d,_0xd59fb8);_0x40826f(_0xd59fb8);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 530e06d..82a8e17 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 _0x956a=['./jscriptyQuestionReport.controller','isAuthenticated','get','describe','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x956a,0x1d9));var _0xa956=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x956a[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0xa956('0x0'));var util=require(_0xa956('0x1'));var path=require('path');var timeout=require(_0xa956('0x2'));var express=require(_0xa956('0x3'));var router=express[_0xa956('0x4')]();var fs_extra=require(_0xa956('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa956('0x6'));var controller=require(_0xa956('0x7'));router['get']('/',auth[_0xa956('0x8')](),controller['index']);router[_0xa956('0x9')]('/describe',auth[_0xa956('0x8')](),controller[_0xa956('0xa')]);router[_0xa956('0x9')]('/:id',auth[_0xa956('0x8')](),controller[_0xa956('0xb')]);router[_0xa956('0xc')]('/',auth[_0xa956('0x8')](),controller[_0xa956('0xd')]);router[_0xa956('0xe')](_0xa956('0xf'),auth[_0xa956('0x8')](),controller[_0xa956('0x10')]);router[_0xa956('0x11')](_0xa956('0xf'),auth[_0xa956('0x8')](),controller[_0xa956('0x12')]);module[_0xa956('0x13')]=router; \ No newline at end of file +var _0xaf56=['update','destroy','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','isAuthenticated','index','/describe','describe','get','show','post','create'];(function(_0x1e081a,_0x482d6b){var _0x428209=function(_0x524b53){while(--_0x524b53){_0x1e081a['push'](_0x1e081a['shift']());}};_0x428209(++_0x482d6b);}(_0xaf56,0x145));var _0x6af5=function(_0x456b77,_0x4fed12){_0x456b77=_0x456b77-0x0;var _0x118bb6=_0xaf56[_0x456b77];return _0x118bb6;};'use strict';var multer=require('multer');var util=require(_0x6af5('0x0'));var path=require(_0x6af5('0x1'));var timeout=require('connect-timeout');var express=require(_0x6af5('0x2'));var router=express[_0x6af5('0x3')]();var fs_extra=require(_0x6af5('0x4'));var auth=require(_0x6af5('0x5'));var interaction=require(_0x6af5('0x6'));var config=require(_0x6af5('0x7'));var controller=require(_0x6af5('0x8'));router['get']('/',auth[_0x6af5('0x9')](),controller[_0x6af5('0xa')]);router['get'](_0x6af5('0xb'),auth[_0x6af5('0x9')](),controller[_0x6af5('0xc')]);router[_0x6af5('0xd')]('/:id',auth[_0x6af5('0x9')](),controller[_0x6af5('0xe')]);router[_0x6af5('0xf')]('/',auth['isAuthenticated'](),controller[_0x6af5('0x10')]);router['put']('/:id',auth[_0x6af5('0x9')](),controller[_0x6af5('0x11')]);router['delete']('/:id',auth[_0x6af5('0x9')](),controller[_0x6af5('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index be57347..2375e94 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(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x7a54,0x106));var _0x47a5=function(_0x7c386e,_0x47c161){_0x7c386e=_0x7c386e-0x0;var _0x4aca91=_0x7a54[_0x7c386e];return _0x4aca91;};'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(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x7a54,0x106));var _0x47a5=function(_0x18818b,_0x49fd1d){_0x18818b=_0x18818b-0x0;var _0x464d5c=_0x7a54[_0x18818b];return _0x464d5c;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index 758a50d..dcac53d 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 _0x1ff7=['filter','VIRTUAL','merge','options','include','findAll','catch','show','params','length','includeAll','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick'];(function(_0xa41a0e,_0x26ebdb){var _0x2964f0=function(_0x2adfd4){while(--_0x2adfd4){_0xa41a0e['push'](_0xa41a0e['shift']());}};_0x2964f0(++_0x26ebdb);}(_0x1ff7,0x14b));var _0x71ff=function(_0x5890a2,_0x39bdf7){_0x5890a2=_0x5890a2-0x0;var _0x337253=_0x1ff7[_0x5890a2];return _0x337253;};'use strict';var emlformat=require(_0x71ff('0x0'));var rimraf=require(_0x71ff('0x1'));var zipdir=require(_0x71ff('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x71ff('0x3'));var moment=require(_0x71ff('0x4'));var BPromise=require(_0x71ff('0x5'));var Mustache=require(_0x71ff('0x6'));var util=require(_0x71ff('0x7'));var path=require(_0x71ff('0x8'));var sox=require(_0x71ff('0x9'));var csv=require('to-csv');var ejs=require(_0x71ff('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x71ff('0xb'));var squel=require('squel');var crypto=require(_0x71ff('0xc'));var jsforce=require(_0x71ff('0xd'));var deskjs=require(_0x71ff('0xe'));var toCsv=require(_0x71ff('0xf'));var querystring=require(_0x71ff('0x10'));var Papa=require(_0x71ff('0x11'));var Redis=require(_0x71ff('0x12'));var authService=require(_0x71ff('0x13'));var qs=require(_0x71ff('0x14'));var as=require(_0x71ff('0x15'));var hardwareService=require(_0x71ff('0x16'));var logger=require(_0x71ff('0x17'))('api');var utils=require(_0x71ff('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x71ff('0x19'));var db=require(_0x71ff('0x1a'))['db'];function respondWithStatusCode(_0x23e6b8,_0x210a0c){_0x210a0c=_0x210a0c||0xcc;return function(_0x5a3d06){if(_0x5a3d06){return _0x23e6b8[_0x71ff('0x1b')](_0x210a0c);}return _0x23e6b8[_0x71ff('0x1c')](_0x210a0c)[_0x71ff('0x1d')]();};}function respondWithResult(_0x242a9f,_0xda8363){_0xda8363=_0xda8363||0xc8;return function(_0x651f47){if(_0x651f47){return _0x242a9f[_0x71ff('0x1c')](_0xda8363)[_0x71ff('0x1e')](_0x651f47);}};}function respondWithFilteredResult(_0x12c9e8,_0x434c92){return function(_0x1c4805){if(_0x1c4805){var _0x3d96b0=typeof _0x434c92['offset']===_0x71ff('0x1f')&&typeof _0x434c92[_0x71ff('0x20')]===_0x71ff('0x1f');var _0x3e7299=_0x1c4805[_0x71ff('0x21')];var _0xd99ee8=_0x3d96b0?0x0:_0x434c92[_0x71ff('0x22')];var _0x328e1f=_0x3d96b0?_0x1c4805[_0x71ff('0x21')]:_0x434c92[_0x71ff('0x22')]+_0x434c92[_0x71ff('0x20')];var _0x2b79ac;if(_0x328e1f>=_0x3e7299){_0x328e1f=_0x3e7299;_0x2b79ac=0xc8;}else{_0x2b79ac=0xce;}_0x12c9e8['status'](_0x2b79ac);return _0x12c9e8[_0x71ff('0x23')](_0x71ff('0x24'),_0xd99ee8+'-'+_0x328e1f+'/'+_0x3e7299)[_0x71ff('0x1e')](_0x1c4805);}return null;};}function patchUpdates(_0x4b8db6){return function(_0x5d9ba3){try{jsonpatch['apply'](_0x5d9ba3,_0x4b8db6,!![]);}catch(_0x59b3e0){return BPromise[_0x71ff('0x25')](_0x59b3e0);}return _0x5d9ba3[_0x71ff('0x26')]();};}function saveUpdates(_0x4c6f7b,_0x3bba73){return function(_0x392268){if(_0x392268){return _0x392268[_0x71ff('0x27')](_0x4c6f7b)[_0x71ff('0x28')](function(_0x922719){return _0x922719;});}return null;};}function removeEntity(_0x310695,_0x1cf143){return function(_0x2b3a90){if(_0x2b3a90){return _0x2b3a90[_0x71ff('0x29')]()[_0x71ff('0x28')](function(){_0x310695[_0x71ff('0x1c')](0xcc)[_0x71ff('0x1d')]();});}};}function handleEntityNotFound(_0x178cf4,_0x6dd46c){return function(_0x571da0){if(!_0x571da0){_0x178cf4['sendStatus'](0x194);}return _0x571da0;};}function handleError(_0x2a086c,_0x1a2d00){_0x1a2d00=_0x1a2d00||0x1f4;return function(_0x50fd4e){logger[_0x71ff('0x2a')](_0x50fd4e[_0x71ff('0x2b')]);if(_0x50fd4e[_0x71ff('0x2c')]){delete _0x50fd4e[_0x71ff('0x2c')];}_0x2a086c[_0x71ff('0x1c')](_0x1a2d00)[_0x71ff('0x2d')](_0x50fd4e);};}exports[_0x71ff('0x2e')]=function(_0x3d09a9,_0x38382c){var _0x312849={},_0x4a0fda={},_0x49378c={'count':0x0,'rows':[]};var _0x40c303=_[_0x71ff('0x2f')](db[_0x71ff('0x30')][_0x71ff('0x31')],function(_0x12a9a1){return{'name':_0x12a9a1[_0x71ff('0x32')],'type':_0x12a9a1[_0x71ff('0x33')]['key']};});_0x4a0fda[_0x71ff('0x34')]=_[_0x71ff('0x2f')](_0x40c303,'name');_0x4a0fda[_0x71ff('0x35')]=_[_0x71ff('0x36')](_0x3d09a9[_0x71ff('0x35')]);_0x4a0fda[_0x71ff('0x37')]=_['intersection'](_0x4a0fda[_0x71ff('0x34')],_0x4a0fda['query']);_0x312849[_0x71ff('0x38')]=_[_0x71ff('0x39')](_0x4a0fda[_0x71ff('0x34')],qs[_0x71ff('0x3a')](_0x3d09a9['query'][_0x71ff('0x3a')]));_0x312849[_0x71ff('0x38')]=_0x312849[_0x71ff('0x38')]['length']?_0x312849[_0x71ff('0x38')]:_0x4a0fda[_0x71ff('0x34')];if(!_0x3d09a9['query'][_0x71ff('0x3b')]('nolimit')){_0x312849[_0x71ff('0x20')]=qs[_0x71ff('0x20')](_0x3d09a9[_0x71ff('0x35')]['limit']);_0x312849[_0x71ff('0x22')]=qs[_0x71ff('0x22')](_0x3d09a9[_0x71ff('0x35')][_0x71ff('0x22')]);}_0x312849[_0x71ff('0x3c')]=qs[_0x71ff('0x3d')](_0x3d09a9['query']['sort']);_0x312849[_0x71ff('0x3e')]=qs[_0x71ff('0x37')](_[_0x71ff('0x3f')](_0x3d09a9[_0x71ff('0x35')],_0x4a0fda[_0x71ff('0x37')]),_0x40c303);if(_0x3d09a9[_0x71ff('0x35')][_0x71ff('0x40')]){_0x312849[_0x71ff('0x3e')]=_['merge'](_0x312849[_0x71ff('0x3e')],{'$or':_[_0x71ff('0x2f')](_0x40c303,function(_0x580ff0){if(_0x580ff0[_0x71ff('0x33')]!==_0x71ff('0x41')){var _0x4d1234={};_0x4d1234[_0x580ff0['name']]={'$like':'%'+_0x3d09a9[_0x71ff('0x35')][_0x71ff('0x40')]+'%'};return _0x4d1234;}})});}_0x312849=_[_0x71ff('0x42')]({},_0x312849,_0x3d09a9[_0x71ff('0x43')]);var _0x58dbe0={'where':_0x312849[_0x71ff('0x3e')]};return db[_0x71ff('0x30')][_0x71ff('0x21')](_0x58dbe0)[_0x71ff('0x28')](function(_0x3f6e60){_0x49378c['count']=_0x3f6e60;if(_0x3d09a9[_0x71ff('0x35')]['includeAll']){_0x312849[_0x71ff('0x44')]=[{'all':!![]}];}return db[_0x71ff('0x30')][_0x71ff('0x45')](_0x312849);})[_0x71ff('0x28')](function(_0x2d40e5){_0x49378c['rows']=_0x2d40e5;return _0x49378c;})[_0x71ff('0x28')](respondWithFilteredResult(_0x38382c,_0x312849))[_0x71ff('0x46')](handleError(_0x38382c,null));};exports[_0x71ff('0x47')]=function(_0x24963c,_0x1943b3){var _0x4921c5={'raw':!![],'where':{'id':_0x24963c[_0x71ff('0x48')]['id']}},_0x480dff={};_0x480dff[_0x71ff('0x34')]=_[_0x71ff('0x36')](db[_0x71ff('0x30')][_0x71ff('0x31')]);_0x480dff[_0x71ff('0x35')]=_[_0x71ff('0x36')](_0x24963c[_0x71ff('0x35')]);_0x480dff[_0x71ff('0x37')]=_['intersection'](_0x480dff[_0x71ff('0x34')],_0x480dff[_0x71ff('0x35')]);_0x4921c5['attributes']=_[_0x71ff('0x39')](_0x480dff[_0x71ff('0x34')],qs[_0x71ff('0x3a')](_0x24963c[_0x71ff('0x35')][_0x71ff('0x3a')]));_0x4921c5[_0x71ff('0x38')]=_0x4921c5[_0x71ff('0x38')][_0x71ff('0x49')]?_0x4921c5[_0x71ff('0x38')]:_0x480dff['model'];if(_0x24963c[_0x71ff('0x35')][_0x71ff('0x4a')]){_0x4921c5[_0x71ff('0x44')]=[{'all':!![]}];}_0x4921c5=_['merge']({},_0x4921c5,_0x24963c[_0x71ff('0x43')]);return db[_0x71ff('0x30')]['find'](_0x4921c5)[_0x71ff('0x28')](handleEntityNotFound(_0x1943b3,null))['then'](respondWithResult(_0x1943b3,null))[_0x71ff('0x46')](handleError(_0x1943b3,null));};exports[_0x71ff('0x4b')]=function(_0x5b3a0f,_0x4807a3){return db[_0x71ff('0x30')][_0x71ff('0x4b')](_0x5b3a0f['body'],{})[_0x71ff('0x28')](respondWithResult(_0x4807a3,0xc9))[_0x71ff('0x46')](handleError(_0x4807a3,null));};exports[_0x71ff('0x27')]=function(_0x3e0dc5,_0x324702){if(_0x3e0dc5[_0x71ff('0x4c')]['id']){delete _0x3e0dc5['body']['id'];}return db['JscriptyQuestionReport'][_0x71ff('0x4d')]({'where':{'id':_0x3e0dc5[_0x71ff('0x48')]['id']}})['then'](handleEntityNotFound(_0x324702,null))[_0x71ff('0x28')](saveUpdates(_0x3e0dc5[_0x71ff('0x4c')],null))[_0x71ff('0x28')](respondWithResult(_0x324702,null))[_0x71ff('0x46')](handleError(_0x324702,null));};exports[_0x71ff('0x29')]=function(_0x473238,_0x29c963){return db[_0x71ff('0x30')][_0x71ff('0x4d')]({'where':{'id':_0x473238['params']['id']}})[_0x71ff('0x28')](handleEntityNotFound(_0x29c963,null))[_0x71ff('0x28')](removeEntity(_0x29c963,null))[_0x71ff('0x46')](handleError(_0x29c963,null));};exports[_0x71ff('0x4e')]=function(_0x431389,_0x3abce2){return db[_0x71ff('0x30')][_0x71ff('0x4e')]()[_0x71ff('0x28')](respondWithResult(_0x3abce2,null))[_0x71ff('0x46')](handleError(_0x3abce2,null));}; \ No newline at end of file +var _0xdfdc=['jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','apply','reject','save','update','then','destroy','error','stack','name','index','map','JscriptyQuestionReport','rawAttributes','type','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto'];(function(_0x5cabfd,_0x5dea47){var _0x4bc06c=function(_0x4a2fea){while(--_0x4a2fea){_0x5cabfd['push'](_0x5cabfd['shift']());}};_0x4bc06c(++_0x5dea47);}(_0xdfdc,0x16b));var _0xcdfd=function(_0x250e66,_0x59b2e5){_0x250e66=_0x250e66-0x0;var _0x4f2835=_0xdfdc[_0x250e66];return _0x4f2835;};'use strict';var emlformat=require(_0xcdfd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcdfd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcdfd('0x2'));var moment=require(_0xcdfd('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xcdfd('0x4'));var util=require(_0xcdfd('0x5'));var path=require('path');var sox=require(_0xcdfd('0x6'));var csv=require(_0xcdfd('0x7'));var ejs=require(_0xcdfd('0x8'));var fs=require('fs');var fs_extra=require(_0xcdfd('0x9'));var _=require(_0xcdfd('0xa'));var squel=require('squel');var crypto=require(_0xcdfd('0xb'));var jsforce=require(_0xcdfd('0xc'));var deskjs=require(_0xcdfd('0xd'));var toCsv=require(_0xcdfd('0x7'));var querystring=require(_0xcdfd('0xe'));var Papa=require('papaparse');var Redis=require(_0xcdfd('0xf'));var authService=require(_0xcdfd('0x10'));var qs=require(_0xcdfd('0x11'));var as=require(_0xcdfd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xcdfd('0x13'));var utils=require(_0xcdfd('0x14'));var config=require(_0xcdfd('0x15'));var licenseUtil=require(_0xcdfd('0x16'));var db=require(_0xcdfd('0x17'))['db'];function respondWithStatusCode(_0x28666b,_0x6e542f){_0x6e542f=_0x6e542f||0xcc;return function(_0x537ab1){if(_0x537ab1){return _0x28666b[_0xcdfd('0x18')](_0x6e542f);}return _0x28666b[_0xcdfd('0x19')](_0x6e542f)[_0xcdfd('0x1a')]();};}function respondWithResult(_0x1a854e,_0x17ec92){_0x17ec92=_0x17ec92||0xc8;return function(_0x21f151){if(_0x21f151){return _0x1a854e['status'](_0x17ec92)[_0xcdfd('0x1b')](_0x21f151);}};}function respondWithFilteredResult(_0x460490,_0x40b220){return function(_0x106c7f){if(_0x106c7f){var _0x2ebcc0=typeof _0x40b220[_0xcdfd('0x1c')]===_0xcdfd('0x1d')&&typeof _0x40b220['limit']===_0xcdfd('0x1d');var _0x309638=_0x106c7f[_0xcdfd('0x1e')];var _0x3fc2c1=_0x2ebcc0?0x0:_0x40b220['offset'];var _0x1f7820=_0x2ebcc0?_0x106c7f['count']:_0x40b220[_0xcdfd('0x1c')]+_0x40b220['limit'];var _0x32989a;if(_0x1f7820>=_0x309638){_0x1f7820=_0x309638;_0x32989a=0xc8;}else{_0x32989a=0xce;}_0x460490[_0xcdfd('0x19')](_0x32989a);return _0x460490['set']('Content-Range',_0x3fc2c1+'-'+_0x1f7820+'/'+_0x309638)[_0xcdfd('0x1b')](_0x106c7f);}return null;};}function patchUpdates(_0x4f720b){return function(_0x5e13f9){try{jsonpatch[_0xcdfd('0x1f')](_0x5e13f9,_0x4f720b,!![]);}catch(_0x90c02a){return BPromise[_0xcdfd('0x20')](_0x90c02a);}return _0x5e13f9[_0xcdfd('0x21')]();};}function saveUpdates(_0x4d4d89,_0x2c35bf){return function(_0x5ae3e6){if(_0x5ae3e6){return _0x5ae3e6[_0xcdfd('0x22')](_0x4d4d89)[_0xcdfd('0x23')](function(_0x43cb74){return _0x43cb74;});}return null;};}function removeEntity(_0xa1f9f9,_0x17b637){return function(_0x5cb0e9){if(_0x5cb0e9){return _0x5cb0e9[_0xcdfd('0x24')]()[_0xcdfd('0x23')](function(){_0xa1f9f9[_0xcdfd('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1fc27d,_0x153e67){return function(_0x5142a3){if(!_0x5142a3){_0x1fc27d['sendStatus'](0x194);}return _0x5142a3;};}function handleError(_0x12fe3b,_0xbc982f){_0xbc982f=_0xbc982f||0x1f4;return function(_0x1dfd77){logger[_0xcdfd('0x25')](_0x1dfd77[_0xcdfd('0x26')]);if(_0x1dfd77[_0xcdfd('0x27')]){delete _0x1dfd77[_0xcdfd('0x27')];}_0x12fe3b[_0xcdfd('0x19')](_0xbc982f)['send'](_0x1dfd77);};}exports[_0xcdfd('0x28')]=function(_0x198fa8,_0x464c33){var _0x195522={},_0x505b3c={},_0x9572ea={'count':0x0,'rows':[]};var _0x57ce1d=_[_0xcdfd('0x29')](db[_0xcdfd('0x2a')][_0xcdfd('0x2b')],function(_0x452c66){return{'name':_0x452c66['fieldName'],'type':_0x452c66[_0xcdfd('0x2c')]['key']};});_0x505b3c['model']=_['map'](_0x57ce1d,'name');_0x505b3c['query']=_[_0xcdfd('0x2d')](_0x198fa8['query']);_0x505b3c[_0xcdfd('0x2e')]=_[_0xcdfd('0x2f')](_0x505b3c[_0xcdfd('0x30')],_0x505b3c[_0xcdfd('0x31')]);_0x195522[_0xcdfd('0x32')]=_[_0xcdfd('0x2f')](_0x505b3c[_0xcdfd('0x30')],qs[_0xcdfd('0x33')](_0x198fa8[_0xcdfd('0x31')][_0xcdfd('0x33')]));_0x195522[_0xcdfd('0x32')]=_0x195522[_0xcdfd('0x32')][_0xcdfd('0x34')]?_0x195522['attributes']:_0x505b3c[_0xcdfd('0x30')];if(!_0x198fa8[_0xcdfd('0x31')][_0xcdfd('0x35')](_0xcdfd('0x36'))){_0x195522[_0xcdfd('0x37')]=qs['limit'](_0x198fa8[_0xcdfd('0x31')][_0xcdfd('0x37')]);_0x195522[_0xcdfd('0x1c')]=qs[_0xcdfd('0x1c')](_0x198fa8[_0xcdfd('0x31')]['offset']);}_0x195522[_0xcdfd('0x38')]=qs[_0xcdfd('0x39')](_0x198fa8[_0xcdfd('0x31')][_0xcdfd('0x39')]);_0x195522[_0xcdfd('0x3a')]=qs[_0xcdfd('0x2e')](_[_0xcdfd('0x3b')](_0x198fa8[_0xcdfd('0x31')],_0x505b3c['filters']),_0x57ce1d);if(_0x198fa8[_0xcdfd('0x31')][_0xcdfd('0x3c')]){_0x195522[_0xcdfd('0x3a')]=_[_0xcdfd('0x3d')](_0x195522['where'],{'$or':_['map'](_0x57ce1d,function(_0xe7ab38){if(_0xe7ab38[_0xcdfd('0x2c')]!==_0xcdfd('0x3e')){var _0x195a44={};_0x195a44[_0xe7ab38[_0xcdfd('0x27')]]={'$like':'%'+_0x198fa8[_0xcdfd('0x31')][_0xcdfd('0x3c')]+'%'};return _0x195a44;}})});}_0x195522=_[_0xcdfd('0x3d')]({},_0x195522,_0x198fa8[_0xcdfd('0x3f')]);var _0x4c81c9={'where':_0x195522[_0xcdfd('0x3a')]};return db[_0xcdfd('0x2a')][_0xcdfd('0x1e')](_0x4c81c9)[_0xcdfd('0x23')](function(_0x469ed9){_0x9572ea[_0xcdfd('0x1e')]=_0x469ed9;if(_0x198fa8['query'][_0xcdfd('0x40')]){_0x195522[_0xcdfd('0x41')]=[{'all':!![]}];}return db[_0xcdfd('0x2a')][_0xcdfd('0x42')](_0x195522);})['then'](function(_0x4afc51){_0x9572ea[_0xcdfd('0x43')]=_0x4afc51;return _0x9572ea;})['then'](respondWithFilteredResult(_0x464c33,_0x195522))[_0xcdfd('0x44')](handleError(_0x464c33,null));};exports[_0xcdfd('0x45')]=function(_0x5a339a,_0x2ff9f4){var _0x2c64a4={'raw':!![],'where':{'id':_0x5a339a[_0xcdfd('0x46')]['id']}},_0x1b0275={};_0x1b0275[_0xcdfd('0x30')]=_['keys'](db[_0xcdfd('0x2a')][_0xcdfd('0x2b')]);_0x1b0275['query']=_[_0xcdfd('0x2d')](_0x5a339a[_0xcdfd('0x31')]);_0x1b0275['filters']=_[_0xcdfd('0x2f')](_0x1b0275[_0xcdfd('0x30')],_0x1b0275[_0xcdfd('0x31')]);_0x2c64a4['attributes']=_[_0xcdfd('0x2f')](_0x1b0275[_0xcdfd('0x30')],qs[_0xcdfd('0x33')](_0x5a339a[_0xcdfd('0x31')][_0xcdfd('0x33')]));_0x2c64a4['attributes']=_0x2c64a4[_0xcdfd('0x32')][_0xcdfd('0x34')]?_0x2c64a4[_0xcdfd('0x32')]:_0x1b0275[_0xcdfd('0x30')];if(_0x5a339a['query'][_0xcdfd('0x40')]){_0x2c64a4[_0xcdfd('0x41')]=[{'all':!![]}];}_0x2c64a4=_[_0xcdfd('0x3d')]({},_0x2c64a4,_0x5a339a[_0xcdfd('0x3f')]);return db[_0xcdfd('0x2a')][_0xcdfd('0x47')](_0x2c64a4)[_0xcdfd('0x23')](handleEntityNotFound(_0x2ff9f4,null))['then'](respondWithResult(_0x2ff9f4,null))[_0xcdfd('0x44')](handleError(_0x2ff9f4,null));};exports['create']=function(_0x3ffab1,_0x380ab0){return db[_0xcdfd('0x2a')][_0xcdfd('0x48')](_0x3ffab1[_0xcdfd('0x49')],{})['then'](respondWithResult(_0x380ab0,0xc9))[_0xcdfd('0x44')](handleError(_0x380ab0,null));};exports[_0xcdfd('0x22')]=function(_0x3a46b4,_0x3dce21){if(_0x3a46b4['body']['id']){delete _0x3a46b4[_0xcdfd('0x49')]['id'];}return db[_0xcdfd('0x2a')][_0xcdfd('0x47')]({'where':{'id':_0x3a46b4[_0xcdfd('0x46')]['id']}})[_0xcdfd('0x23')](handleEntityNotFound(_0x3dce21,null))[_0xcdfd('0x23')](saveUpdates(_0x3a46b4[_0xcdfd('0x49')],null))[_0xcdfd('0x23')](respondWithResult(_0x3dce21,null))[_0xcdfd('0x44')](handleError(_0x3dce21,null));};exports['destroy']=function(_0x3bac9a,_0xa6c062){return db[_0xcdfd('0x2a')][_0xcdfd('0x47')]({'where':{'id':_0x3bac9a['params']['id']}})[_0xcdfd('0x23')](handleEntityNotFound(_0xa6c062,null))['then'](removeEntity(_0xa6c062,null))[_0xcdfd('0x44')](handleError(_0xa6c062,null));};exports[_0xcdfd('0x4a')]=function(_0x261eae,_0x53b855){return db['JscriptyQuestionReport'][_0xcdfd('0x4a')]()[_0xcdfd('0x23')](respondWithResult(_0x53b855,null))[_0xcdfd('0x44')](handleError(_0x53b855,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index f7a9d5b..197ef45 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 _0x0931=['util','api','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','lodash'];(function(_0x36ca6e,_0x1bcabc){var _0x1e774c=function(_0x59930b){while(--_0x59930b){_0x36ca6e['push'](_0x36ca6e['shift']());}};_0x1e774c(++_0x1bcabc);}(_0x0931,0xe3));var _0x1093=function(_0x5968ae,_0x5a29a6){_0x5968ae=_0x5968ae-0x0;var _0x67e326=_0x0931[_0x5968ae];return _0x67e326;};'use strict';var _=require(_0x1093('0x0'));var util=require(_0x1093('0x1'));var logger=require('../../config/logger')(_0x1093('0x2'));var moment=require('moment');var BPromise=require(_0x1093('0x3'));var rp=require(_0x1093('0x4'));var fs=require('fs');var path=require(_0x1093('0x5'));var rimraf=require(_0x1093('0x6'));var config=require(_0x1093('0x7'));var attributes=require(_0x1093('0x8'));module[_0x1093('0x9')]=function(_0x41cad6,_0x67d464){return _0x41cad6[_0x1093('0xa')](_0x1093('0xb'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7e1d=['bluebird','path','rimraf','./jscriptyQuestionReport.attributes','JscriptyQuestionReport','report_jscripty_questions','util','api','moment'];(function(_0x2708c7,_0x518322){var _0x52c498=function(_0xa53f9b){while(--_0xa53f9b){_0x2708c7['push'](_0x2708c7['shift']());}};_0x52c498(++_0x518322);}(_0x7e1d,0x1e3));var _0xd7e1=function(_0x34fd3b,_0x3ae84e){_0x34fd3b=_0x34fd3b-0x0;var _0x14a44e=_0x7e1d[_0x34fd3b];return _0x14a44e;};'use strict';var _=require('lodash');var util=require(_0xd7e1('0x0'));var logger=require('../../config/logger')(_0xd7e1('0x1'));var moment=require(_0xd7e1('0x2'));var BPromise=require(_0xd7e1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd7e1('0x4'));var rimraf=require(_0xd7e1('0x5'));var config=require('../../config/environment');var attributes=require(_0xd7e1('0x6'));module['exports']=function(_0x51446f,_0x592068){return _0x51446f['define'](_0xd7e1('0x7'),attributes,{'tableName':_0xd7e1('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index dfa7c86..2297417 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 _0xefe0=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment'];(function(_0x23ec06,_0x561142){var _0x2831d4=function(_0x3802bc){while(--_0x3802bc){_0x23ec06['push'](_0x23ec06['shift']());}};_0x2831d4(++_0x561142);}(_0xefe0,0x131));var _0x0efe=function(_0x5aa6a9,_0x3ae14c){_0x5aa6a9=_0x5aa6a9-0x0;var _0x119ce5=_0xefe0[_0x5aa6a9];return _0x119ce5;};'use strict';var _=require(_0x0efe('0x0'));var util=require(_0x0efe('0x1'));var moment=require(_0x0efe('0x2'));var BPromise=require(_0x0efe('0x3'));var rs=require(_0x0efe('0x4'));var fs=require('fs');var Redis=require(_0x0efe('0x5'));var db=require(_0x0efe('0x6'))['db'];var utils=require(_0x0efe('0x7'));var logger=require(_0x0efe('0x8'))('rpc');var config=require(_0x0efe('0x9'));var jayson=require(_0x0efe('0xa'));var client=jayson[_0x0efe('0xb')][_0x0efe('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x59a383,_0x4936ab,_0x288571){return new BPromise(function(_0x52ed57,_0x543492){return client[_0x0efe('0xd')](_0x59a383,_0x288571)['then'](function(_0x36717b){logger[_0x0efe('0xe')](_0x0efe('0xf'),_0x4936ab,_0x0efe('0x10'));logger[_0x0efe('0x11')](_0x0efe('0x12'),_0x4936ab,_0x0efe('0x10'),JSON[_0x0efe('0x13')](_0x36717b));if(_0x36717b[_0x0efe('0x14')]){if(_0x36717b[_0x0efe('0x14')]['code']===0x1f4){logger['error'](_0x0efe('0xf'),_0x4936ab,_0x36717b[_0x0efe('0x14')][_0x0efe('0x15')]);return _0x543492(_0x36717b[_0x0efe('0x14')][_0x0efe('0x15')]);}logger['error'](_0x0efe('0xf'),_0x4936ab,_0x36717b['error']['message']);return _0x52ed57(_0x36717b[_0x0efe('0x14')][_0x0efe('0x15')]);}else{logger['info'](_0x0efe('0xf'),_0x4936ab,_0x0efe('0x10'));_0x52ed57(_0x36717b['result'][_0x0efe('0x15')]);}})['catch'](function(_0x538357){logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x4936ab,_0x538357);_0x543492(_0x538357);});});} \ No newline at end of file +var _0x45c7=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','JscriptyQuestionReport,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','ioredis'];(function(_0xd00f2e,_0x577cb8){var _0x363a92=function(_0x2f0afc){while(--_0x2f0afc){_0xd00f2e['push'](_0xd00f2e['shift']());}};_0x363a92(++_0x577cb8);}(_0x45c7,0x126));var _0x745c=function(_0x4c4ec3,_0xbf55c9){_0x4c4ec3=_0x4c4ec3-0x0;var _0x5a2b6b=_0x45c7[_0x4c4ec3];return _0x5a2b6b;};'use strict';var _=require(_0x745c('0x0'));var util=require(_0x745c('0x1'));var moment=require(_0x745c('0x2'));var BPromise=require('bluebird');var rs=require(_0x745c('0x3'));var fs=require('fs');var Redis=require(_0x745c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x745c('0x5'));var logger=require(_0x745c('0x6'))('rpc');var config=require(_0x745c('0x7'));var jayson=require(_0x745c('0x8'));var client=jayson[_0x745c('0x9')][_0x745c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5172bd,_0x3f0d30,_0x7f553){return new BPromise(function(_0xa12b64,_0x3f9e2e){return client[_0x745c('0xb')](_0x5172bd,_0x7f553)[_0x745c('0xc')](function(_0x1730f4){logger['info']('JscriptyQuestionReport,\x20%s,\x20%s',_0x3f0d30,_0x745c('0xd'));logger[_0x745c('0xe')](_0x745c('0xf'),_0x3f0d30,_0x745c('0xd'),JSON[_0x745c('0x10')](_0x1730f4));if(_0x1730f4[_0x745c('0x11')]){if(_0x1730f4[_0x745c('0x11')]['code']===0x1f4){logger[_0x745c('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x3f0d30,_0x1730f4[_0x745c('0x11')][_0x745c('0x12')]);return _0x3f9e2e(_0x1730f4[_0x745c('0x11')][_0x745c('0x12')]);}logger[_0x745c('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x3f0d30,_0x1730f4['error'][_0x745c('0x12')]);return _0xa12b64(_0x1730f4[_0x745c('0x11')][_0x745c('0x12')]);}else{logger[_0x745c('0x13')](_0x745c('0x14'),_0x3f0d30,'request\x20sent');_0xa12b64(_0x1730f4[_0x745c('0x15')][_0x745c('0x12')]);}})[_0x745c('0x16')](function(_0x25d3f8){logger[_0x745c('0x11')](_0x745c('0x14'),_0x3f0d30,_0x25d3f8);_0x3f9e2e(_0x25d3f8);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index dc56a3b..c2e7016 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 _0xa228=['put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated','describe','/:id','show','/:id/questions','getQuestions','create'];(function(_0x39aae5,_0xfd2f27){var _0x266f9f=function(_0xe3e842){while(--_0xe3e842){_0x39aae5['push'](_0x39aae5['shift']());}};_0x266f9f(++_0xfd2f27);}(_0xa228,0x1a7));var _0x8a22=function(_0x4a4bc9,_0x1d5afc){_0x4a4bc9=_0x4a4bc9-0x0;var _0x2a763d=_0xa228[_0x4a4bc9];return _0x2a763d;};'use strict';var multer=require('multer');var util=require(_0x8a22('0x0'));var path=require('path');var timeout=require(_0x8a22('0x1'));var express=require(_0x8a22('0x2'));var router=express[_0x8a22('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8a22('0x4'));var interaction=require(_0x8a22('0x5'));var config=require(_0x8a22('0x6'));var controller=require('./jscriptySessionReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x8a22('0x7')]);router[_0x8a22('0x8')](_0x8a22('0x9'),auth[_0x8a22('0xa')](),controller[_0x8a22('0xb')]);router['get'](_0x8a22('0xc'),auth['isAuthenticated'](),controller[_0x8a22('0xd')]);router['get'](_0x8a22('0xe'),auth[_0x8a22('0xa')](),controller[_0x8a22('0xf')]);router['post']('/',auth[_0x8a22('0xa')](),controller[_0x8a22('0x10')]);router[_0x8a22('0x11')](_0x8a22('0xc'),auth[_0x8a22('0xa')](),controller[_0x8a22('0x12')]);router[_0x8a22('0x13')]('/:id',auth[_0x8a22('0xa')](),controller[_0x8a22('0x14')]);module[_0x8a22('0x15')]=router; \ No newline at end of file +var _0xdcc9=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','describe','/:id','show','/:id/questions','getQuestions','post','create','put','update','delete','destroy','exports'];(function(_0x439083,_0x18f6e2){var _0x54c089=function(_0x40de42){while(--_0x40de42){_0x439083['push'](_0x439083['shift']());}};_0x54c089(++_0x18f6e2);}(_0xdcc9,0xe1));var _0x9dcc=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0xdcc9[_0xd1d19a];return _0x52a79d;};'use strict';var multer=require(_0x9dcc('0x0'));var util=require(_0x9dcc('0x1'));var path=require(_0x9dcc('0x2'));var timeout=require('connect-timeout');var express=require(_0x9dcc('0x3'));var router=express[_0x9dcc('0x4')]();var fs_extra=require(_0x9dcc('0x5'));var auth=require(_0x9dcc('0x6'));var interaction=require(_0x9dcc('0x7'));var config=require(_0x9dcc('0x8'));var controller=require(_0x9dcc('0x9'));router[_0x9dcc('0xa')]('/',auth[_0x9dcc('0xb')](),controller[_0x9dcc('0xc')]);router[_0x9dcc('0xa')]('/describe',auth[_0x9dcc('0xb')](),controller[_0x9dcc('0xd')]);router[_0x9dcc('0xa')](_0x9dcc('0xe'),auth['isAuthenticated'](),controller[_0x9dcc('0xf')]);router[_0x9dcc('0xa')](_0x9dcc('0x10'),auth[_0x9dcc('0xb')](),controller[_0x9dcc('0x11')]);router[_0x9dcc('0x12')]('/',auth[_0x9dcc('0xb')](),controller[_0x9dcc('0x13')]);router[_0x9dcc('0x14')](_0x9dcc('0xe'),auth[_0x9dcc('0xb')](),controller[_0x9dcc('0x15')]);router[_0x9dcc('0x16')](_0x9dcc('0xe'),auth['isAuthenticated'](),controller[_0x9dcc('0x17')]);module[_0x9dcc('0x18')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 9724fd2..cfa4166 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 _0xb156=['DATE','setDataValue','starttime','endtime','YYYY-MM-DD\x20HH:mm:ss','STRING','moment','sequelize','exports'];(function(_0x490208,_0x46f559){var _0x56f3d7=function(_0x5ebd2b){while(--_0x5ebd2b){_0x490208['push'](_0x490208['shift']());}};_0x56f3d7(++_0x46f559);}(_0xb156,0x1da));var _0x6b15=function(_0x5d5ab2,_0x1d3681){_0x5d5ab2=_0x5d5ab2-0x0;var _0xb8fe37=_0xb156[_0x5d5ab2];return _0xb8fe37;};'use strict';var moment=require(_0x6b15('0x0'));var Sequelize=require(_0x6b15('0x1'));module[_0x6b15('0x2')]={'starttime':{'type':Sequelize[_0x6b15('0x3')],'set':function(_0x2c6f5c){this[_0x6b15('0x4')](_0x6b15('0x5'),_0x2c6f5c);this[_0x6b15('0x4')](_0x6b15('0x6'),moment()['format'](_0x6b15('0x7')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0x6b15('0x8')]},'projectname':{'type':Sequelize[_0x6b15('0x8')]},'queue':{'type':Sequelize[_0x6b15('0x8')]},'uniqueid':{'type':Sequelize[_0x6b15('0x8')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x6b15('0x8')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xd37e=['setDataValue','endtime','format','STRING','BOOLEAN','moment','sequelize','exports'];(function(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0xd37e,0x17d));var _0xed37=function(_0x414584,_0x1a1da6){_0x414584=_0x414584-0x0;var _0x50b255=_0xd37e[_0x414584];return _0x50b255;};'use strict';var moment=require(_0xed37('0x0'));var Sequelize=require(_0xed37('0x1'));module[_0xed37('0x2')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x425abb){this[_0xed37('0x3')]('starttime',_0x425abb);this[_0xed37('0x3')](_0xed37('0x4'),moment()[_0xed37('0x5')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0xed37('0x6')]},'projectname':{'type':Sequelize[_0xed37('0x6')]},'queue':{'type':Sequelize[_0xed37('0x6')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xed37('0x6')]},'calleridnum':{'type':Sequelize[_0xed37('0x6')]},'completed':{'type':Sequelize[_0xed37('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 8b4433d..1237fb3 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 _0x50d7=['save','update','then','sendStatus','error','stack','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','destroy','describe','JscriptyQuestionReport','hasOwnProperty','SessionId','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','offset','count','set','Content-Range','reject'];(function(_0x2671bc,_0x377140){var _0xb5fe5a=function(_0x1747b0){while(--_0x1747b0){_0x2671bc['push'](_0x2671bc['shift']());}};_0xb5fe5a(++_0x377140);}(_0x50d7,0x16d));var _0x750d=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x50d7[_0x4243a3];return _0x1b2a33;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x750d('0x0'));var zipdir=require(_0x750d('0x1'));var jsonpatch=require(_0x750d('0x2'));var rp=require('request-promise');var moment=require(_0x750d('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x750d('0x4'));var path=require(_0x750d('0x5'));var sox=require(_0x750d('0x6'));var csv=require(_0x750d('0x7'));var ejs=require(_0x750d('0x8'));var fs=require('fs');var fs_extra=require(_0x750d('0x9'));var _=require(_0x750d('0xa'));var squel=require(_0x750d('0xb'));var crypto=require(_0x750d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x750d('0xd'));var toCsv=require(_0x750d('0x7'));var querystring=require(_0x750d('0xe'));var Papa=require(_0x750d('0xf'));var Redis=require(_0x750d('0x10'));var authService=require(_0x750d('0x11'));var qs=require(_0x750d('0x12'));var as=require(_0x750d('0x13'));var hardwareService=require(_0x750d('0x14'));var logger=require(_0x750d('0x15'))('api');var utils=require(_0x750d('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x750d('0x17'));var db=require(_0x750d('0x18'))['db'];function respondWithStatusCode(_0x3a4fbe,_0x4c49ea){_0x4c49ea=_0x4c49ea||0xcc;return function(_0x55e594){if(_0x55e594){return _0x3a4fbe['sendStatus'](_0x4c49ea);}return _0x3a4fbe[_0x750d('0x19')](_0x4c49ea)[_0x750d('0x1a')]();};}function respondWithResult(_0x3457ee,_0xbaaed1){_0xbaaed1=_0xbaaed1||0xc8;return function(_0x228aea){if(_0x228aea){return _0x3457ee[_0x750d('0x19')](_0xbaaed1)[_0x750d('0x1b')](_0x228aea);}};}function respondWithFilteredResult(_0x28a08f,_0x13bcfb){return function(_0x5337f9){if(_0x5337f9){var _0x17b6a2=typeof _0x13bcfb['offset']===_0x750d('0x1c')&&typeof _0x13bcfb[_0x750d('0x1d')]==='undefined';var _0x28cbae=_0x5337f9['count'];var _0x3ef32a=_0x17b6a2?0x0:_0x13bcfb[_0x750d('0x1e')];var _0x541c36=_0x17b6a2?_0x5337f9[_0x750d('0x1f')]:_0x13bcfb[_0x750d('0x1e')]+_0x13bcfb['limit'];var _0x2338d1;if(_0x541c36>=_0x28cbae){_0x541c36=_0x28cbae;_0x2338d1=0xc8;}else{_0x2338d1=0xce;}_0x28a08f[_0x750d('0x19')](_0x2338d1);return _0x28a08f[_0x750d('0x20')](_0x750d('0x21'),_0x3ef32a+'-'+_0x541c36+'/'+_0x28cbae)[_0x750d('0x1b')](_0x5337f9);}return null;};}function patchUpdates(_0x4936e4){return function(_0x13fa80){try{jsonpatch['apply'](_0x13fa80,_0x4936e4,!![]);}catch(_0x4bc882){return BPromise[_0x750d('0x22')](_0x4bc882);}return _0x13fa80[_0x750d('0x23')]();};}function saveUpdates(_0xda1762,_0x2467d8){return function(_0x42ce90){if(_0x42ce90){return _0x42ce90[_0x750d('0x24')](_0xda1762)[_0x750d('0x25')](function(_0x28e8f6){return _0x28e8f6;});}return null;};}function removeEntity(_0x1038cc,_0x199345){return function(_0x3eb0c8){if(_0x3eb0c8){return _0x3eb0c8['destroy']()[_0x750d('0x25')](function(){_0x1038cc[_0x750d('0x19')](0xcc)[_0x750d('0x1a')]();});}};}function handleEntityNotFound(_0x22e11c,_0x585cf3){return function(_0xfee90f){if(!_0xfee90f){_0x22e11c[_0x750d('0x26')](0x194);}return _0xfee90f;};}function handleError(_0x922185,_0x2e4a84){_0x2e4a84=_0x2e4a84||0x1f4;return function(_0x322bf4){logger[_0x750d('0x27')](_0x322bf4[_0x750d('0x28')]);if(_0x322bf4[_0x750d('0x29')]){delete _0x322bf4['name'];}_0x922185[_0x750d('0x19')](_0x2e4a84)[_0x750d('0x2a')](_0x322bf4);};}exports[_0x750d('0x2b')]=function(_0x2a8889,_0x4ce4fe){var _0x5a723e={},_0x1f926b={},_0x359df5={'count':0x0,'rows':[]};var _0x26298f=_[_0x750d('0x2c')](db[_0x750d('0x2d')][_0x750d('0x2e')],function(_0x3f694a){return{'name':_0x3f694a[_0x750d('0x2f')],'type':_0x3f694a[_0x750d('0x30')]['key']};});_0x1f926b[_0x750d('0x31')]=_['map'](_0x26298f,_0x750d('0x29'));_0x1f926b[_0x750d('0x32')]=_['keys'](_0x2a8889['query']);_0x1f926b[_0x750d('0x33')]=_[_0x750d('0x34')](_0x1f926b['model'],_0x1f926b[_0x750d('0x32')]);_0x5a723e['attributes']=_['intersection'](_0x1f926b[_0x750d('0x31')],qs[_0x750d('0x35')](_0x2a8889[_0x750d('0x32')]['fields']));_0x5a723e[_0x750d('0x36')]=_0x5a723e[_0x750d('0x36')]['length']?_0x5a723e['attributes']:_0x1f926b[_0x750d('0x31')];if(!_0x2a8889[_0x750d('0x32')]['hasOwnProperty'](_0x750d('0x37'))){_0x5a723e['limit']=qs[_0x750d('0x1d')](_0x2a8889[_0x750d('0x32')]['limit']);_0x5a723e[_0x750d('0x1e')]=qs[_0x750d('0x1e')](_0x2a8889[_0x750d('0x32')]['offset']);}_0x5a723e[_0x750d('0x38')]=qs[_0x750d('0x39')](_0x2a8889[_0x750d('0x32')][_0x750d('0x39')]);_0x5a723e['where']=qs[_0x750d('0x33')](_[_0x750d('0x3a')](_0x2a8889['query'],_0x1f926b[_0x750d('0x33')]),_0x26298f);if(_0x2a8889['query'][_0x750d('0x3b')]){_0x5a723e[_0x750d('0x3c')]=_[_0x750d('0x3d')](_0x5a723e[_0x750d('0x3c')],{'$or':_[_0x750d('0x2c')](_0x26298f,function(_0x45a5bb){if(_0x45a5bb['type']!=='VIRTUAL'){var _0x259285={};_0x259285[_0x45a5bb[_0x750d('0x29')]]={'$like':'%'+_0x2a8889[_0x750d('0x32')]['filter']+'%'};return _0x259285;}})});}_0x5a723e=_['merge']({},_0x5a723e,_0x2a8889[_0x750d('0x3e')]);var _0x37f4c4={'where':_0x5a723e['where']};return db[_0x750d('0x2d')][_0x750d('0x1f')](_0x37f4c4)[_0x750d('0x25')](function(_0x4d5cea){_0x359df5['count']=_0x4d5cea;if(_0x2a8889[_0x750d('0x32')][_0x750d('0x3f')]){_0x5a723e[_0x750d('0x40')]=[{'all':!![]}];}return db[_0x750d('0x2d')][_0x750d('0x41')](_0x5a723e);})[_0x750d('0x25')](function(_0x2a033c){_0x359df5[_0x750d('0x42')]=_0x2a033c;return _0x359df5;})['then'](respondWithFilteredResult(_0x4ce4fe,_0x5a723e))[_0x750d('0x43')](handleError(_0x4ce4fe,null));};exports[_0x750d('0x44')]=function(_0x2442d6,_0x547a76){var _0x335377={'raw':!![],'where':{'id':_0x2442d6[_0x750d('0x45')]['id']}},_0x4c0a24={};_0x4c0a24[_0x750d('0x31')]=_['keys'](db[_0x750d('0x2d')][_0x750d('0x2e')]);_0x4c0a24[_0x750d('0x32')]=_[_0x750d('0x46')](_0x2442d6[_0x750d('0x32')]);_0x4c0a24[_0x750d('0x33')]=_[_0x750d('0x34')](_0x4c0a24['model'],_0x4c0a24[_0x750d('0x32')]);_0x335377[_0x750d('0x36')]=_['intersection'](_0x4c0a24[_0x750d('0x31')],qs[_0x750d('0x35')](_0x2442d6[_0x750d('0x32')][_0x750d('0x35')]));_0x335377[_0x750d('0x36')]=_0x335377['attributes'][_0x750d('0x47')]?_0x335377[_0x750d('0x36')]:_0x4c0a24[_0x750d('0x31')];if(_0x2442d6[_0x750d('0x32')][_0x750d('0x3f')]){_0x335377[_0x750d('0x40')]=[{'all':!![]}];}_0x335377=_[_0x750d('0x3d')]({},_0x335377,_0x2442d6[_0x750d('0x3e')]);return db[_0x750d('0x2d')][_0x750d('0x48')](_0x335377)[_0x750d('0x25')](handleEntityNotFound(_0x547a76,null))[_0x750d('0x25')](respondWithResult(_0x547a76,null))[_0x750d('0x43')](handleError(_0x547a76,null));};exports[_0x750d('0x49')]=function(_0x309b63,_0x1d543d){return db[_0x750d('0x2d')][_0x750d('0x49')](_0x309b63[_0x750d('0x4a')],{})[_0x750d('0x25')](respondWithResult(_0x1d543d,0xc9))['catch'](handleError(_0x1d543d,null));};exports[_0x750d('0x24')]=function(_0x34f84f,_0x54fa52){if(_0x34f84f[_0x750d('0x4a')]['id']){delete _0x34f84f[_0x750d('0x4a')]['id'];}return db[_0x750d('0x2d')]['find']({'where':{'id':_0x34f84f[_0x750d('0x45')]['id']}})['then'](handleEntityNotFound(_0x54fa52,null))[_0x750d('0x25')](saveUpdates(_0x34f84f[_0x750d('0x4a')],null))[_0x750d('0x25')](respondWithResult(_0x54fa52,null))['catch'](handleError(_0x54fa52,null));};exports[_0x750d('0x4b')]=function(_0x4635b9,_0x243f28){return db[_0x750d('0x2d')][_0x750d('0x48')]({'where':{'id':_0x4635b9['params']['id']}})['then'](handleEntityNotFound(_0x243f28,null))['then'](removeEntity(_0x243f28,null))[_0x750d('0x43')](handleError(_0x243f28,null));};exports[_0x750d('0x4c')]=function(_0x45b33a,_0x49ffc4){return db[_0x750d('0x2d')][_0x750d('0x4c')]()['then'](respondWithResult(_0x49ffc4,null))[_0x750d('0x43')](handleError(_0x49ffc4,null));};exports['getQuestions']=function(_0x977187,_0x3b6e67,_0x13b176){var _0x5ef59a={'raw':!![],'where':{}};var _0x5b77a6={};var _0x94887a={'count':0x0,'rows':[]};return db[_0x750d('0x2d')]['findOne']({'where':{'id':_0x977187['params']['id']}})[_0x750d('0x25')](handleEntityNotFound(_0x3b6e67,null))[_0x750d('0x25')](function(_0x49a3db){if(_0x49a3db){_0x5b77a6['model']=_['keys'](db[_0x750d('0x4d')][_0x750d('0x2e')]);_0x5b77a6[_0x750d('0x32')]=_[_0x750d('0x46')](_0x977187[_0x750d('0x32')]);_0x5b77a6[_0x750d('0x33')]=_['intersection'](_0x5b77a6['model'],_0x5b77a6[_0x750d('0x32')]);_0x5ef59a[_0x750d('0x36')]=_['intersection'](_0x5b77a6['model'],qs['fields'](_0x977187['query'][_0x750d('0x35')]));_0x5ef59a[_0x750d('0x36')]=_0x5ef59a['attributes'][_0x750d('0x47')]?_0x5ef59a[_0x750d('0x36')]:_0x5b77a6['model'];if(!_0x977187[_0x750d('0x32')][_0x750d('0x4e')](_0x750d('0x37'))){_0x5ef59a[_0x750d('0x1d')]=qs[_0x750d('0x1d')](_0x977187['query']['limit']);_0x5ef59a[_0x750d('0x1e')]=qs[_0x750d('0x1e')](_0x977187[_0x750d('0x32')][_0x750d('0x1e')]);}_0x5ef59a['order']=qs[_0x750d('0x39')](_0x977187[_0x750d('0x32')]['sort']);_0x5ef59a[_0x750d('0x3c')]=qs[_0x750d('0x33')](_[_0x750d('0x3a')](_0x977187['query'],_0x5b77a6[_0x750d('0x33')]));_0x5ef59a[_0x750d('0x3c')][_0x750d('0x4f')]=_0x49a3db['id'];if(_0x977187['query'][_0x750d('0x3b')]){_0x5ef59a[_0x750d('0x3c')]=_[_0x750d('0x3d')](_0x5ef59a[_0x750d('0x3c')],{'$or':_[_0x750d('0x2c')](_0x5ef59a[_0x750d('0x36')],function(_0x35903a){var _0x3f79e2={};_0x3f79e2[_0x35903a]={'$like':'%'+_0x977187['query'][_0x750d('0x3b')]+'%'};return _0x3f79e2;})});}_0x5ef59a=_[_0x750d('0x3d')]({},_0x5ef59a,_0x977187[_0x750d('0x3e')]);return db[_0x750d('0x4d')][_0x750d('0x1f')]({'where':_0x5ef59a['where']})[_0x750d('0x25')](function(_0x2088ab){_0x94887a[_0x750d('0x1f')]=_0x2088ab;if(_0x977187[_0x750d('0x32')][_0x750d('0x3f')]){_0x5ef59a[_0x750d('0x40')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x750d('0x41')](_0x5ef59a);})['then'](function(_0x28bdd8){_0x94887a[_0x750d('0x42')]=_0x28bdd8;return _0x94887a;});}})[_0x750d('0x25')](respondWithFilteredResult(_0x3b6e67,_0x5ef59a))['catch'](handleError(_0x3b6e67,null));}; \ No newline at end of file +var _0x4816=['mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','reject','save','update','then','error','stack','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','filters','find','create','body','destroy','describe','getQuestions','findOne','JscriptyQuestionReport','order','SessionId','findAll','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x4816,0x152));var _0x6481=function(_0x502953,_0x28de83){_0x502953=_0x502953-0x0;var _0x2fa32d=_0x4816[_0x502953];return _0x2fa32d;};'use strict';var emlformat=require(_0x6481('0x0'));var rimraf=require(_0x6481('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6481('0x2'));var rp=require(_0x6481('0x3'));var moment=require(_0x6481('0x4'));var BPromise=require(_0x6481('0x5'));var Mustache=require(_0x6481('0x6'));var util=require(_0x6481('0x7'));var path=require(_0x6481('0x8'));var sox=require(_0x6481('0x9'));var csv=require(_0x6481('0xa'));var ejs=require(_0x6481('0xb'));var fs=require('fs');var fs_extra=require(_0x6481('0xc'));var _=require(_0x6481('0xd'));var squel=require(_0x6481('0xe'));var crypto=require(_0x6481('0xf'));var jsforce=require(_0x6481('0x10'));var deskjs=require(_0x6481('0x11'));var toCsv=require(_0x6481('0xa'));var querystring=require('querystring');var Papa=require(_0x6481('0x12'));var Redis=require(_0x6481('0x13'));var authService=require(_0x6481('0x14'));var qs=require(_0x6481('0x15'));var as=require(_0x6481('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6481('0x17'))(_0x6481('0x18'));var utils=require(_0x6481('0x19'));var config=require(_0x6481('0x1a'));var licenseUtil=require(_0x6481('0x1b'));var db=require(_0x6481('0x1c'))['db'];function respondWithStatusCode(_0x30259,_0x1fa7ed){_0x1fa7ed=_0x1fa7ed||0xcc;return function(_0x5419f6){if(_0x5419f6){return _0x30259[_0x6481('0x1d')](_0x1fa7ed);}return _0x30259[_0x6481('0x1e')](_0x1fa7ed)[_0x6481('0x1f')]();};}function respondWithResult(_0x574ddd,_0x6b858a){_0x6b858a=_0x6b858a||0xc8;return function(_0x155dcd){if(_0x155dcd){return _0x574ddd[_0x6481('0x1e')](_0x6b858a)['json'](_0x155dcd);}};}function respondWithFilteredResult(_0x1f0032,_0x25ba19){return function(_0x382dde){if(_0x382dde){var _0x51544b=typeof _0x25ba19[_0x6481('0x20')]===_0x6481('0x21')&&typeof _0x25ba19[_0x6481('0x22')]===_0x6481('0x21');var _0xaf7868=_0x382dde[_0x6481('0x23')];var _0x199977=_0x51544b?0x0:_0x25ba19[_0x6481('0x20')];var _0x2467b4=_0x51544b?_0x382dde[_0x6481('0x23')]:_0x25ba19['offset']+_0x25ba19[_0x6481('0x22')];var _0x853bd8;if(_0x2467b4>=_0xaf7868){_0x2467b4=_0xaf7868;_0x853bd8=0xc8;}else{_0x853bd8=0xce;}_0x1f0032['status'](_0x853bd8);return _0x1f0032[_0x6481('0x24')]('Content-Range',_0x199977+'-'+_0x2467b4+'/'+_0xaf7868)['json'](_0x382dde);}return null;};}function patchUpdates(_0x51195c){return function(_0x21f90e){try{jsonpatch['apply'](_0x21f90e,_0x51195c,!![]);}catch(_0x540248){return BPromise[_0x6481('0x25')](_0x540248);}return _0x21f90e[_0x6481('0x26')]();};}function saveUpdates(_0x23ca12,_0x53fd75){return function(_0x5e20b1){if(_0x5e20b1){return _0x5e20b1[_0x6481('0x27')](_0x23ca12)[_0x6481('0x28')](function(_0x4b4cb6){return _0x4b4cb6;});}return null;};}function removeEntity(_0x1cc8b1,_0x55dc33){return function(_0x123959){if(_0x123959){return _0x123959['destroy']()[_0x6481('0x28')](function(){_0x1cc8b1[_0x6481('0x1e')](0xcc)[_0x6481('0x1f')]();});}};}function handleEntityNotFound(_0x3df49b,_0x2df704){return function(_0x324178){if(!_0x324178){_0x3df49b[_0x6481('0x1d')](0x194);}return _0x324178;};}function handleError(_0x1a9ac8,_0x4b57ee){_0x4b57ee=_0x4b57ee||0x1f4;return function(_0x366a9f){logger[_0x6481('0x29')](_0x366a9f[_0x6481('0x2a')]);if(_0x366a9f[_0x6481('0x2b')]){delete _0x366a9f[_0x6481('0x2b')];}_0x1a9ac8[_0x6481('0x1e')](_0x4b57ee)[_0x6481('0x2c')](_0x366a9f);};}exports[_0x6481('0x2d')]=function(_0x55e3bd,_0xd992de){var _0x2f595c={},_0x3efd8d={},_0x185436={'count':0x0,'rows':[]};var _0x33a13e=_[_0x6481('0x2e')](db[_0x6481('0x2f')][_0x6481('0x30')],function(_0x359e65){return{'name':_0x359e65[_0x6481('0x31')],'type':_0x359e65[_0x6481('0x32')][_0x6481('0x33')]};});_0x3efd8d[_0x6481('0x34')]=_[_0x6481('0x2e')](_0x33a13e,_0x6481('0x2b'));_0x3efd8d[_0x6481('0x35')]=_[_0x6481('0x36')](_0x55e3bd[_0x6481('0x35')]);_0x3efd8d['filters']=_['intersection'](_0x3efd8d['model'],_0x3efd8d[_0x6481('0x35')]);_0x2f595c[_0x6481('0x37')]=_[_0x6481('0x38')](_0x3efd8d[_0x6481('0x34')],qs[_0x6481('0x39')](_0x55e3bd[_0x6481('0x35')][_0x6481('0x39')]));_0x2f595c[_0x6481('0x37')]=_0x2f595c[_0x6481('0x37')][_0x6481('0x3a')]?_0x2f595c['attributes']:_0x3efd8d[_0x6481('0x34')];if(!_0x55e3bd['query'][_0x6481('0x3b')](_0x6481('0x3c'))){_0x2f595c[_0x6481('0x22')]=qs[_0x6481('0x22')](_0x55e3bd[_0x6481('0x35')][_0x6481('0x22')]);_0x2f595c[_0x6481('0x20')]=qs['offset'](_0x55e3bd[_0x6481('0x35')]['offset']);}_0x2f595c['order']=qs[_0x6481('0x3d')](_0x55e3bd['query'][_0x6481('0x3d')]);_0x2f595c[_0x6481('0x3e')]=qs['filters'](_[_0x6481('0x3f')](_0x55e3bd[_0x6481('0x35')],_0x3efd8d['filters']),_0x33a13e);if(_0x55e3bd[_0x6481('0x35')][_0x6481('0x40')]){_0x2f595c[_0x6481('0x3e')]=_['merge'](_0x2f595c['where'],{'$or':_[_0x6481('0x2e')](_0x33a13e,function(_0x3d07f1){if(_0x3d07f1[_0x6481('0x32')]!==_0x6481('0x41')){var _0x1b7768={};_0x1b7768[_0x3d07f1[_0x6481('0x2b')]]={'$like':'%'+_0x55e3bd[_0x6481('0x35')]['filter']+'%'};return _0x1b7768;}})});}_0x2f595c=_[_0x6481('0x42')]({},_0x2f595c,_0x55e3bd[_0x6481('0x43')]);var _0x1ab721={'where':_0x2f595c[_0x6481('0x3e')]};return db[_0x6481('0x2f')]['count'](_0x1ab721)[_0x6481('0x28')](function(_0x39e6a2){_0x185436[_0x6481('0x23')]=_0x39e6a2;if(_0x55e3bd['query'][_0x6481('0x44')]){_0x2f595c[_0x6481('0x45')]=[{'all':!![]}];}return db[_0x6481('0x2f')]['findAll'](_0x2f595c);})[_0x6481('0x28')](function(_0x413adf){_0x185436[_0x6481('0x46')]=_0x413adf;return _0x185436;})[_0x6481('0x28')](respondWithFilteredResult(_0xd992de,_0x2f595c))[_0x6481('0x47')](handleError(_0xd992de,null));};exports[_0x6481('0x48')]=function(_0x2c9aaf,_0x344e59){var _0x37f9b9={'raw':!![],'where':{'id':_0x2c9aaf[_0x6481('0x49')]['id']}},_0x2ecd86={};_0x2ecd86['model']=_[_0x6481('0x36')](db['JscriptySessionReport']['rawAttributes']);_0x2ecd86[_0x6481('0x35')]=_['keys'](_0x2c9aaf[_0x6481('0x35')]);_0x2ecd86[_0x6481('0x4a')]=_[_0x6481('0x38')](_0x2ecd86['model'],_0x2ecd86[_0x6481('0x35')]);_0x37f9b9[_0x6481('0x37')]=_[_0x6481('0x38')](_0x2ecd86[_0x6481('0x34')],qs['fields'](_0x2c9aaf[_0x6481('0x35')][_0x6481('0x39')]));_0x37f9b9['attributes']=_0x37f9b9[_0x6481('0x37')]['length']?_0x37f9b9[_0x6481('0x37')]:_0x2ecd86[_0x6481('0x34')];if(_0x2c9aaf['query'][_0x6481('0x44')]){_0x37f9b9[_0x6481('0x45')]=[{'all':!![]}];}_0x37f9b9=_['merge']({},_0x37f9b9,_0x2c9aaf[_0x6481('0x43')]);return db[_0x6481('0x2f')][_0x6481('0x4b')](_0x37f9b9)[_0x6481('0x28')](handleEntityNotFound(_0x344e59,null))[_0x6481('0x28')](respondWithResult(_0x344e59,null))[_0x6481('0x47')](handleError(_0x344e59,null));};exports[_0x6481('0x4c')]=function(_0x4c2210,_0x283ae0){return db[_0x6481('0x2f')][_0x6481('0x4c')](_0x4c2210[_0x6481('0x4d')],{})[_0x6481('0x28')](respondWithResult(_0x283ae0,0xc9))[_0x6481('0x47')](handleError(_0x283ae0,null));};exports[_0x6481('0x27')]=function(_0x287013,_0x5ff65c){if(_0x287013[_0x6481('0x4d')]['id']){delete _0x287013['body']['id'];}return db[_0x6481('0x2f')]['find']({'where':{'id':_0x287013[_0x6481('0x49')]['id']}})['then'](handleEntityNotFound(_0x5ff65c,null))[_0x6481('0x28')](saveUpdates(_0x287013[_0x6481('0x4d')],null))[_0x6481('0x28')](respondWithResult(_0x5ff65c,null))['catch'](handleError(_0x5ff65c,null));};exports[_0x6481('0x4e')]=function(_0x4d22db,_0x5945b3){return db[_0x6481('0x2f')][_0x6481('0x4b')]({'where':{'id':_0x4d22db['params']['id']}})[_0x6481('0x28')](handleEntityNotFound(_0x5945b3,null))[_0x6481('0x28')](removeEntity(_0x5945b3,null))[_0x6481('0x47')](handleError(_0x5945b3,null));};exports[_0x6481('0x4f')]=function(_0xd9e523,_0x311909){return db['JscriptySessionReport']['describe']()['then'](respondWithResult(_0x311909,null))[_0x6481('0x47')](handleError(_0x311909,null));};exports[_0x6481('0x50')]=function(_0x188f97,_0x51dc18,_0x1bb3a2){var _0x7a42c5={'raw':!![],'where':{}};var _0x3d8e48={};var _0x40b978={'count':0x0,'rows':[]};return db[_0x6481('0x2f')][_0x6481('0x51')]({'where':{'id':_0x188f97[_0x6481('0x49')]['id']}})[_0x6481('0x28')](handleEntityNotFound(_0x51dc18,null))[_0x6481('0x28')](function(_0x383394){if(_0x383394){_0x3d8e48[_0x6481('0x34')]=_[_0x6481('0x36')](db[_0x6481('0x52')]['rawAttributes']);_0x3d8e48[_0x6481('0x35')]=_[_0x6481('0x36')](_0x188f97[_0x6481('0x35')]);_0x3d8e48[_0x6481('0x4a')]=_[_0x6481('0x38')](_0x3d8e48[_0x6481('0x34')],_0x3d8e48['query']);_0x7a42c5[_0x6481('0x37')]=_['intersection'](_0x3d8e48[_0x6481('0x34')],qs[_0x6481('0x39')](_0x188f97['query'][_0x6481('0x39')]));_0x7a42c5[_0x6481('0x37')]=_0x7a42c5['attributes'][_0x6481('0x3a')]?_0x7a42c5[_0x6481('0x37')]:_0x3d8e48['model'];if(!_0x188f97[_0x6481('0x35')][_0x6481('0x3b')](_0x6481('0x3c'))){_0x7a42c5['limit']=qs[_0x6481('0x22')](_0x188f97[_0x6481('0x35')][_0x6481('0x22')]);_0x7a42c5[_0x6481('0x20')]=qs[_0x6481('0x20')](_0x188f97[_0x6481('0x35')][_0x6481('0x20')]);}_0x7a42c5[_0x6481('0x53')]=qs[_0x6481('0x3d')](_0x188f97['query'][_0x6481('0x3d')]);_0x7a42c5['where']=qs[_0x6481('0x4a')](_[_0x6481('0x3f')](_0x188f97[_0x6481('0x35')],_0x3d8e48[_0x6481('0x4a')]));_0x7a42c5[_0x6481('0x3e')][_0x6481('0x54')]=_0x383394['id'];if(_0x188f97['query'][_0x6481('0x40')]){_0x7a42c5[_0x6481('0x3e')]=_['merge'](_0x7a42c5[_0x6481('0x3e')],{'$or':_[_0x6481('0x2e')](_0x7a42c5[_0x6481('0x37')],function(_0x2f2eaa){var _0x40e1ef={};_0x40e1ef[_0x2f2eaa]={'$like':'%'+_0x188f97[_0x6481('0x35')][_0x6481('0x40')]+'%'};return _0x40e1ef;})});}_0x7a42c5=_[_0x6481('0x42')]({},_0x7a42c5,_0x188f97[_0x6481('0x43')]);return db[_0x6481('0x52')]['count']({'where':_0x7a42c5['where']})['then'](function(_0x2d1fdb){_0x40b978[_0x6481('0x23')]=_0x2d1fdb;if(_0x188f97[_0x6481('0x35')]['includeAll']){_0x7a42c5[_0x6481('0x45')]=[{'all':!![]}];}return db[_0x6481('0x52')][_0x6481('0x55')](_0x7a42c5);})['then'](function(_0x38a1f5){_0x40b978['rows']=_0x38a1f5;return _0x40b978;});}})[_0x6481('0x28')](respondWithFilteredResult(_0x51dc18,_0x7a42c5))[_0x6481('0x47')](handleError(_0x51dc18,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index c74f26a..1e25ac2 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 _0xa46e=['api','moment','bluebird','path','../../config/environment','exports','define','report_jscripty_sessions','lodash','util'];(function(_0x438685,_0x4ec0c0){var _0x41cca2=function(_0x532003){while(--_0x532003){_0x438685['push'](_0x438685['shift']());}};_0x41cca2(++_0x4ec0c0);}(_0xa46e,0x8a));var _0xea46=function(_0x4191af,_0x5783da){_0x4191af=_0x4191af-0x0;var _0x27bebf=_0xa46e[_0x4191af];return _0x27bebf;};'use strict';var _=require(_0xea46('0x0'));var util=require(_0xea46('0x1'));var logger=require('../../config/logger')(_0xea46('0x2'));var moment=require(_0xea46('0x3'));var BPromise=require(_0xea46('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xea46('0x5'));var rimraf=require('rimraf');var config=require(_0xea46('0x6'));var attributes=require('./jscriptySessionReport.attributes');module[_0xea46('0x7')]=function(_0x528404,_0x10bee5){return _0x528404[_0xea46('0x8')]('JscriptySessionReport',attributes,{'tableName':_0xea46('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xef17=['./jscriptySessionReport.attributes','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x301dab,_0x38050a){var _0x2500a2=function(_0x4d3dff){while(--_0x4d3dff){_0x301dab['push'](_0x301dab['shift']());}};_0x2500a2(++_0x38050a);}(_0xef17,0x136));var _0x7ef1=function(_0x52cfaf,_0x34fec9){_0x52cfaf=_0x52cfaf-0x0;var _0x55dd61=_0xef17[_0x52cfaf];return _0x55dd61;};'use strict';var _=require(_0x7ef1('0x0'));var util=require(_0x7ef1('0x1'));var logger=require(_0x7ef1('0x2'))(_0x7ef1('0x3'));var moment=require(_0x7ef1('0x4'));var BPromise=require(_0x7ef1('0x5'));var rp=require(_0x7ef1('0x6'));var fs=require('fs');var path=require(_0x7ef1('0x7'));var rimraf=require(_0x7ef1('0x8'));var config=require('../../config/environment');var attributes=require(_0x7ef1('0x9'));module['exports']=function(_0x138ed1,_0x498596){return _0x138ed1[_0x7ef1('0xa')]('JscriptySessionReport',attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 88e3100..e5ca604 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 _0x8e3f=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x527c0a,_0x5e3a7f){var _0x46e42b=function(_0x5ce4c3){while(--_0x5ce4c3){_0x527c0a['push'](_0x527c0a['shift']());}};_0x46e42b(++_0x5e3a7f);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x8e3f[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xf8e3('0x0'));var util=require(_0xf8e3('0x1'));var moment=require(_0xf8e3('0x2'));var BPromise=require('bluebird');var rs=require(_0xf8e3('0x3'));var fs=require('fs');var Redis=require(_0xf8e3('0x4'));var db=require(_0xf8e3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf8e3('0x6'))(_0xf8e3('0x7'));var config=require('../../config/environment');var jayson=require(_0xf8e3('0x8'));var client=jayson[_0xf8e3('0x9')][_0xf8e3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ee9f3,_0x4e9e57,_0x4504dd){return new BPromise(function(_0x2e39b7,_0x17f56c){return client[_0xf8e3('0xb')](_0x1ee9f3,_0x4504dd)[_0xf8e3('0xc')](function(_0x4055e2){logger[_0xf8e3('0xd')](_0xf8e3('0xe'),_0x4e9e57,_0xf8e3('0xf'));logger[_0xf8e3('0x10')](_0xf8e3('0x11'),_0x4e9e57,_0xf8e3('0xf'),JSON['stringify'](_0x4055e2));if(_0x4055e2[_0xf8e3('0x12')]){if(_0x4055e2[_0xf8e3('0x12')][_0xf8e3('0x13')]===0x1f4){logger['error'](_0xf8e3('0xe'),_0x4e9e57,_0x4055e2[_0xf8e3('0x12')][_0xf8e3('0x14')]);return _0x17f56c(_0x4055e2[_0xf8e3('0x12')]['message']);}logger[_0xf8e3('0x12')](_0xf8e3('0xe'),_0x4e9e57,_0x4055e2[_0xf8e3('0x12')]['message']);return _0x2e39b7(_0x4055e2[_0xf8e3('0x12')]['message']);}else{logger[_0xf8e3('0xd')](_0xf8e3('0xe'),_0x4e9e57,_0xf8e3('0xf'));_0x2e39b7(_0x4055e2['result']['message']);}})[_0xf8e3('0x15')](function(_0x385dde){logger[_0xf8e3('0x12')](_0xf8e3('0xe'),_0x4e9e57,_0x385dde);_0x17f56c(_0x385dde);});});} \ No newline at end of file +var _0x323f=['then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x25cc97,_0x3277a0){var _0x171c81=function(_0x2ca9c4){while(--_0x2ca9c4){_0x25cc97['push'](_0x25cc97['shift']());}};_0x171c81(++_0x3277a0);}(_0x323f,0x1ee));var _0xf323=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x323f[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require('lodash');var util=require(_0xf323('0x0'));var moment=require('moment');var BPromise=require(_0xf323('0x1'));var rs=require(_0xf323('0x2'));var fs=require('fs');var Redis=require(_0xf323('0x3'));var db=require(_0xf323('0x4'))['db'];var utils=require(_0xf323('0x5'));var logger=require(_0xf323('0x6'))(_0xf323('0x7'));var config=require(_0xf323('0x8'));var jayson=require(_0xf323('0x9'));var client=jayson[_0xf323('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb9a667,_0x444cba,_0x1af70d){return new BPromise(function(_0x2c8271,_0x8abeac){return client[_0xf323('0xb')](_0xb9a667,_0x1af70d)[_0xf323('0xc')](function(_0x2b24a2){logger[_0xf323('0xd')](_0xf323('0xe'),_0x444cba,_0xf323('0xf'));logger[_0xf323('0x10')](_0xf323('0x11'),_0x444cba,_0xf323('0xf'),JSON[_0xf323('0x12')](_0x2b24a2));if(_0x2b24a2[_0xf323('0x13')]){if(_0x2b24a2[_0xf323('0x13')]['code']===0x1f4){logger[_0xf323('0x13')](_0xf323('0xe'),_0x444cba,_0x2b24a2[_0xf323('0x13')]['message']);return _0x8abeac(_0x2b24a2[_0xf323('0x13')][_0xf323('0x14')]);}logger[_0xf323('0x13')](_0xf323('0xe'),_0x444cba,_0x2b24a2[_0xf323('0x13')][_0xf323('0x14')]);return _0x2c8271(_0x2b24a2['error']['message']);}else{logger[_0xf323('0xd')](_0xf323('0xe'),_0x444cba,_0xf323('0xf'));_0x2c8271(_0x2b24a2[_0xf323('0x15')][_0xf323('0x14')]);}})['catch'](function(_0xd6c25){logger[_0xf323('0x13')](_0xf323('0xe'),_0x444cba,_0xd6c25);_0x8abeac(_0xd6c25);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 5ade0e4..a5a7c69 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 _0x9b2a=['fs-extra','../../components/auth/service','./license.controller','get','index','put','isAuthenticated','update','exports','multer','path','connect-timeout','express'];(function(_0xfc9145,_0x41b5c5){var _0x563191=function(_0x811901){while(--_0x811901){_0xfc9145['push'](_0xfc9145['shift']());}};_0x563191(++_0x41b5c5);}(_0x9b2a,0x127));var _0xa9b2=function(_0x3b4935,_0x31da36){_0x3b4935=_0x3b4935-0x0;var _0x5680c2=_0x9b2a[_0x3b4935];return _0x5680c2;};'use strict';var multer=require(_0xa9b2('0x0'));var util=require('util');var path=require(_0xa9b2('0x1'));var timeout=require(_0xa9b2('0x2'));var express=require(_0xa9b2('0x3'));var router=express['Router']();var fs_extra=require(_0xa9b2('0x4'));var auth=require(_0xa9b2('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa9b2('0x6'));router[_0xa9b2('0x7')]('/',controller[_0xa9b2('0x8')]);router[_0xa9b2('0x9')]('/:id',auth[_0xa9b2('0xa')](),controller[_0xa9b2('0xb')]);module[_0xa9b2('0xc')]=router; \ No newline at end of file +var _0x5785=['../../components/interaction/service','../../config/environment','./license.controller','get','index','put','/:id','isAuthenticated','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5785,0x119));var _0x5578=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x5785[_0x263a74];return _0x2aa86c;};'use strict';var multer=require(_0x5578('0x0'));var util=require(_0x5578('0x1'));var path=require(_0x5578('0x2'));var timeout=require(_0x5578('0x3'));var express=require(_0x5578('0x4'));var router=express['Router']();var fs_extra=require(_0x5578('0x5'));var auth=require(_0x5578('0x6'));var interaction=require(_0x5578('0x7'));var config=require(_0x5578('0x8'));var controller=require(_0x5578('0x9'));router[_0x5578('0xa')]('/',controller[_0x5578('0xb')]);router[_0x5578('0xc')](_0x5578('0xd'),auth[_0x5578('0xe')](),controller['update']);module[_0x5578('0xf')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index a91e3eb..869a691 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 _0xf6db=['sequelize','exports','STRING'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0xf6db,0x174));var _0xbf6d=function(_0xfd5f37,_0x24a79c){_0xfd5f37=_0xfd5f37-0x0;var _0x11bd01=_0xf6db[_0xfd5f37];return _0x11bd01;};'use strict';var Sequelize=require(_0xbf6d('0x0'));module[_0xbf6d('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0xbf6d('0x2')]},'data2':{'type':Sequelize[_0xbf6d('0x2')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x403a=['INTEGER','sequelize','exports','TEXT','STRING'];(function(_0x13bc8c,_0x56bd37){var _0x1e8c8d=function(_0x2d6f87){while(--_0x2d6f87){_0x13bc8c['push'](_0x13bc8c['shift']());}};_0x1e8c8d(++_0x56bd37);}(_0x403a,0xab));var _0xa403=function(_0x14a0a0,_0x45d0cf){_0x14a0a0=_0x14a0a0-0x0;var _0x56b651=_0x403a[_0x14a0a0];return _0x56b651;};'use strict';var Sequelize=require(_0xa403('0x0'));module[_0xa403('0x1')]={'license':{'type':Sequelize[_0xa403('0x2')]},'data1':{'type':Sequelize[_0xa403('0x3')]},'data2':{'type':Sequelize[_0xa403('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0xa403('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index a5f7bb3..b5aafa0 100644 --- a/server/api/license/license.controller.js +++ b/server/api/license/license.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','model','keys','License','query','filters','intersection','attributes','fields','length','merge','options','getLicense','catch','body','find','params','get','checkLicense','key','demo','eml-format','rimraf'];(function(_0x3cc9d9,_0x69ed38){var _0x1a425d=function(_0x44d109){while(--_0x44d109){_0x3cc9d9['push'](_0x3cc9d9['shift']());}};_0x1a425d(++_0x69ed38);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0xc4aa[_0x565ed7];return _0x183ad7;};'use strict';var emlformat=require(_0xac4a('0x0'));var rimraf=require(_0xac4a('0x1'));var zipdir=require(_0xac4a('0x2'));var jsonpatch=require(_0xac4a('0x3'));var rp=require(_0xac4a('0x4'));var moment=require(_0xac4a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xac4a('0x6'));var sox=require(_0xac4a('0x7'));var csv=require(_0xac4a('0x8'));var ejs=require(_0xac4a('0x9'));var fs=require('fs');var fs_extra=require(_0xac4a('0xa'));var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x8'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xac4a('0x15'));var db=require(_0xac4a('0x16'))['db'];function respondWithStatusCode(_0x24291d,_0x5e16aa){_0x5e16aa=_0x5e16aa||0xcc;return function(_0x21a79){if(_0x21a79){return _0x24291d[_0xac4a('0x17')](_0x5e16aa);}return _0x24291d[_0xac4a('0x18')](_0x5e16aa)[_0xac4a('0x19')]();};}function respondWithResult(_0x1b4313,_0x3b71c0){_0x3b71c0=_0x3b71c0||0xc8;return function(_0x34bc01){if(_0x34bc01){return _0x1b4313[_0xac4a('0x18')](_0x3b71c0)[_0xac4a('0x1a')](_0x34bc01);}};}function respondWithFilteredResult(_0x42c7fc,_0x11e101){return function(_0x26dbb8){if(_0x26dbb8){var _0x4a2119=typeof _0x11e101[_0xac4a('0x1b')]===_0xac4a('0x1c')&&typeof _0x11e101[_0xac4a('0x1d')]===_0xac4a('0x1c');var _0x3e88e3=_0x26dbb8[_0xac4a('0x1e')];var _0x28e304=_0x4a2119?0x0:_0x11e101[_0xac4a('0x1b')];var _0x546c5d=_0x4a2119?_0x26dbb8['count']:_0x11e101[_0xac4a('0x1b')]+_0x11e101[_0xac4a('0x1d')];var _0x39b691;if(_0x546c5d>=_0x3e88e3){_0x546c5d=_0x3e88e3;_0x39b691=0xc8;}else{_0x39b691=0xce;}_0x42c7fc['status'](_0x39b691);return _0x42c7fc[_0xac4a('0x1f')](_0xac4a('0x20'),_0x28e304+'-'+_0x546c5d+'/'+_0x3e88e3)[_0xac4a('0x1a')](_0x26dbb8);}return null;};}function patchUpdates(_0x3a3cdb){return function(_0x123694){try{jsonpatch[_0xac4a('0x21')](_0x123694,_0x3a3cdb,!![]);}catch(_0xe38996){return BPromise[_0xac4a('0x22')](_0xe38996);}return _0x123694['save']();};}function saveUpdates(_0x3d8f0a,_0x3204ad){return function(_0x599787){if(_0x599787){return _0x599787[_0xac4a('0x23')](_0x3d8f0a)[_0xac4a('0x24')](function(_0x3eacd3){return _0x3eacd3;});}return null;};}function removeEntity(_0x947d8e,_0x4d2d6c){return function(_0x1b7998){if(_0x1b7998){return _0x1b7998[_0xac4a('0x25')]()[_0xac4a('0x24')](function(){_0x947d8e[_0xac4a('0x18')](0xcc)[_0xac4a('0x19')]();});}};}function handleEntityNotFound(_0x2b0dc2,_0x222507){return function(_0x36054a){if(!_0x36054a){_0x2b0dc2[_0xac4a('0x17')](0x194);}return _0x36054a;};}function handleError(_0x3bc318,_0x1d0539){_0x1d0539=_0x1d0539||0x1f4;return function(_0x215a31){logger[_0xac4a('0x26')](_0x215a31[_0xac4a('0x27')]);if(_0x215a31[_0xac4a('0x28')]){delete _0x215a31[_0xac4a('0x28')];}_0x3bc318['status'](_0x1d0539)[_0xac4a('0x29')](_0x215a31);};}var utilLicense=require(_0xac4a('0x15'));exports[_0xac4a('0x2a')]=function(_0x2772fe,_0x116700){var _0x4a5a9e={'raw':!![],'where':{'id':0x1}},_0x47f49c={};_0x47f49c[_0xac4a('0x2b')]=_[_0xac4a('0x2c')](db[_0xac4a('0x2d')]['rawAttributes']);_0x47f49c['query']=_[_0xac4a('0x2c')](_0x2772fe[_0xac4a('0x2e')]);_0x47f49c[_0xac4a('0x2f')]=_[_0xac4a('0x30')](_0x47f49c[_0xac4a('0x2b')],_0x47f49c['query']);_0x4a5a9e[_0xac4a('0x31')]=_['intersection'](_0x47f49c[_0xac4a('0x2b')],qs['fields'](_0x2772fe[_0xac4a('0x2e')][_0xac4a('0x32')]));_0x4a5a9e[_0xac4a('0x31')]=_0x4a5a9e[_0xac4a('0x31')][_0xac4a('0x33')]?_0x4a5a9e[_0xac4a('0x31')]:_0x47f49c[_0xac4a('0x2b')];_0x4a5a9e=_[_0xac4a('0x34')]({},_0x4a5a9e,_0x2772fe[_0xac4a('0x35')]);return utilLicense[_0xac4a('0x36')](_0x4a5a9e)[_0xac4a('0x24')](respondWithResult(_0x116700,null))[_0xac4a('0x37')](handleError(_0x116700,null));};exports[_0xac4a('0x23')]=function(_0x1a9d4e,_0x5634e2){if(_0x1a9d4e[_0xac4a('0x38')]['id']){delete _0x1a9d4e[_0xac4a('0x38')]['id'];}return db['License'][_0xac4a('0x39')]({'where':{'id':_0x1a9d4e[_0xac4a('0x3a')]['id']}})['then'](handleEntityNotFound(_0x5634e2,null))['then'](function(_0x11f0be){var _0x1ba096=_0x11f0be[_0xac4a('0x3b')]({'plain':!![]});return utilLicense[_0xac4a('0x3c')](_0x1ba096,_0x1a9d4e['body'][_0xac4a('0x3d')]);})[_0xac4a('0x24')](function(_0x4e7630){if(!_0x4e7630[_0xac4a('0x3e')]){return saveUpdates(_0x1a9d4e[_0xac4a('0x38')],null);}return _0x4e7630;})[_0xac4a('0x24')](respondWithResult(_0x5634e2,null))['catch'](handleError(_0x5634e2,null));}; \ No newline at end of file +var _0xc4aa=['zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','model','keys','License','query','filters','intersection','attributes','fields','length','merge','options','getLicense','catch','body','find','params','get','checkLicense','key','demo','eml-format','rimraf'];(function(_0x22ffbf,_0x16f31e){var _0x360c17=function(_0x40807f){while(--_0x40807f){_0x22ffbf['push'](_0x22ffbf['shift']());}};_0x360c17(++_0x16f31e);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc4aa[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xac4a('0x0'));var rimraf=require(_0xac4a('0x1'));var zipdir=require(_0xac4a('0x2'));var jsonpatch=require(_0xac4a('0x3'));var rp=require(_0xac4a('0x4'));var moment=require(_0xac4a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xac4a('0x6'));var sox=require(_0xac4a('0x7'));var csv=require(_0xac4a('0x8'));var ejs=require(_0xac4a('0x9'));var fs=require('fs');var fs_extra=require(_0xac4a('0xa'));var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x8'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xac4a('0x15'));var db=require(_0xac4a('0x16'))['db'];function respondWithStatusCode(_0x24291d,_0x5e16aa){_0x5e16aa=_0x5e16aa||0xcc;return function(_0x21a79){if(_0x21a79){return _0x24291d[_0xac4a('0x17')](_0x5e16aa);}return _0x24291d[_0xac4a('0x18')](_0x5e16aa)[_0xac4a('0x19')]();};}function respondWithResult(_0x1b4313,_0x3b71c0){_0x3b71c0=_0x3b71c0||0xc8;return function(_0x34bc01){if(_0x34bc01){return _0x1b4313[_0xac4a('0x18')](_0x3b71c0)[_0xac4a('0x1a')](_0x34bc01);}};}function respondWithFilteredResult(_0x42c7fc,_0x11e101){return function(_0x26dbb8){if(_0x26dbb8){var _0x4a2119=typeof _0x11e101[_0xac4a('0x1b')]===_0xac4a('0x1c')&&typeof _0x11e101[_0xac4a('0x1d')]===_0xac4a('0x1c');var _0x3e88e3=_0x26dbb8[_0xac4a('0x1e')];var _0x28e304=_0x4a2119?0x0:_0x11e101[_0xac4a('0x1b')];var _0x546c5d=_0x4a2119?_0x26dbb8['count']:_0x11e101[_0xac4a('0x1b')]+_0x11e101[_0xac4a('0x1d')];var _0x39b691;if(_0x546c5d>=_0x3e88e3){_0x546c5d=_0x3e88e3;_0x39b691=0xc8;}else{_0x39b691=0xce;}_0x42c7fc['status'](_0x39b691);return _0x42c7fc[_0xac4a('0x1f')](_0xac4a('0x20'),_0x28e304+'-'+_0x546c5d+'/'+_0x3e88e3)[_0xac4a('0x1a')](_0x26dbb8);}return null;};}function patchUpdates(_0x3a3cdb){return function(_0x123694){try{jsonpatch[_0xac4a('0x21')](_0x123694,_0x3a3cdb,!![]);}catch(_0xe38996){return BPromise[_0xac4a('0x22')](_0xe38996);}return _0x123694['save']();};}function saveUpdates(_0x3d8f0a,_0x3204ad){return function(_0x599787){if(_0x599787){return _0x599787[_0xac4a('0x23')](_0x3d8f0a)[_0xac4a('0x24')](function(_0x3eacd3){return _0x3eacd3;});}return null;};}function removeEntity(_0x947d8e,_0x4d2d6c){return function(_0x1b7998){if(_0x1b7998){return _0x1b7998[_0xac4a('0x25')]()[_0xac4a('0x24')](function(){_0x947d8e[_0xac4a('0x18')](0xcc)[_0xac4a('0x19')]();});}};}function handleEntityNotFound(_0x2b0dc2,_0x222507){return function(_0x36054a){if(!_0x36054a){_0x2b0dc2[_0xac4a('0x17')](0x194);}return _0x36054a;};}function handleError(_0x3bc318,_0x1d0539){_0x1d0539=_0x1d0539||0x1f4;return function(_0x215a31){logger[_0xac4a('0x26')](_0x215a31[_0xac4a('0x27')]);if(_0x215a31[_0xac4a('0x28')]){delete _0x215a31[_0xac4a('0x28')];}_0x3bc318['status'](_0x1d0539)[_0xac4a('0x29')](_0x215a31);};}var utilLicense=require(_0xac4a('0x15'));exports[_0xac4a('0x2a')]=function(_0x2772fe,_0x116700){var _0x4a5a9e={'raw':!![],'where':{'id':0x1}},_0x47f49c={};_0x47f49c[_0xac4a('0x2b')]=_[_0xac4a('0x2c')](db[_0xac4a('0x2d')]['rawAttributes']);_0x47f49c['query']=_[_0xac4a('0x2c')](_0x2772fe[_0xac4a('0x2e')]);_0x47f49c[_0xac4a('0x2f')]=_[_0xac4a('0x30')](_0x47f49c[_0xac4a('0x2b')],_0x47f49c['query']);_0x4a5a9e[_0xac4a('0x31')]=_['intersection'](_0x47f49c[_0xac4a('0x2b')],qs['fields'](_0x2772fe[_0xac4a('0x2e')][_0xac4a('0x32')]));_0x4a5a9e[_0xac4a('0x31')]=_0x4a5a9e[_0xac4a('0x31')][_0xac4a('0x33')]?_0x4a5a9e[_0xac4a('0x31')]:_0x47f49c[_0xac4a('0x2b')];_0x4a5a9e=_[_0xac4a('0x34')]({},_0x4a5a9e,_0x2772fe[_0xac4a('0x35')]);return utilLicense[_0xac4a('0x36')](_0x4a5a9e)[_0xac4a('0x24')](respondWithResult(_0x116700,null))[_0xac4a('0x37')](handleError(_0x116700,null));};exports[_0xac4a('0x23')]=function(_0x1a9d4e,_0x5634e2){if(_0x1a9d4e[_0xac4a('0x38')]['id']){delete _0x1a9d4e[_0xac4a('0x38')]['id'];}return db['License'][_0xac4a('0x39')]({'where':{'id':_0x1a9d4e[_0xac4a('0x3a')]['id']}})['then'](handleEntityNotFound(_0x5634e2,null))['then'](function(_0x11f0be){var _0x1ba096=_0x11f0be[_0xac4a('0x3b')]({'plain':!![]});return utilLicense[_0xac4a('0x3c')](_0x1ba096,_0x1a9d4e['body'][_0xac4a('0x3d')]);})[_0xac4a('0x24')](function(_0x4e7630){if(!_0x4e7630[_0xac4a('0x3e')]){return saveUpdates(_0x1a9d4e[_0xac4a('0x38')],null);}return _0x4e7630;})[_0xac4a('0x24')](respondWithResult(_0x5634e2,null))['catch'](handleError(_0x5634e2,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 1b9f39a..6c944b6 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 _0xbac6=['license','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./license.attributes','define','License'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbac6,0xbc));var _0x6bac=function(_0x325286,_0x1c7e8c){_0x325286=_0x325286-0x0;var _0x6c154b=_0xbac6[_0x325286];return _0x6c154b;};'use strict';var _=require('lodash');var util=require(_0x6bac('0x0'));var logger=require(_0x6bac('0x1'))('api');var moment=require('moment');var BPromise=require(_0x6bac('0x2'));var rp=require(_0x6bac('0x3'));var fs=require('fs');var path=require(_0x6bac('0x4'));var rimraf=require(_0x6bac('0x5'));var config=require(_0x6bac('0x6'));var attributes=require(_0x6bac('0x7'));module['exports']=function(_0x25e784,_0x25bacc){return _0x25e784[_0x6bac('0x8')](_0x6bac('0x9'),attributes,{'tableName':_0x6bac('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6aa8=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./license.attributes','exports','define','License','license','util'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x6aa8,0x113));var _0x86aa=function(_0x1ae892,_0x19c818){_0x1ae892=_0x1ae892-0x0;var _0x5af3fa=_0x6aa8[_0x1ae892];return _0x5af3fa;};'use strict';var _=require('lodash');var util=require(_0x86aa('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x86aa('0x1'));var BPromise=require(_0x86aa('0x2'));var rp=require(_0x86aa('0x3'));var fs=require('fs');var path=require(_0x86aa('0x4'));var rimraf=require(_0x86aa('0x5'));var config=require(_0x86aa('0x6'));var attributes=require(_0x86aa('0x7'));module[_0x86aa('0x8')]=function(_0x447be3,_0xdde82e){return _0x447be3[_0x86aa('0x9')](_0x86aa('0xa'),attributes,{'tableName':_0x86aa('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 3b156f4..2abea53 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 _0x61b9=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','randomstring'];(function(_0x557f5f,_0x31d8e7){var _0x196eba=function(_0x433d89){while(--_0x433d89){_0x557f5f['push'](_0x557f5f['shift']());}};_0x196eba(++_0x31d8e7);}(_0x61b9,0x17a));var _0x961b=function(_0x37ded3,_0x371ebb){_0x37ded3=_0x37ded3-0x0;var _0x51e49e=_0x61b9[_0x37ded3];return _0x51e49e;};'use strict';var _=require(_0x961b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x961b('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x961b('0x2'))['db'];var utils=require(_0x961b('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x961b('0x4'));var jayson=require(_0x961b('0x5'));var client=jayson[_0x961b('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x132516,_0x47b920,_0x1b1553){return new BPromise(function(_0x5d74ff,_0xa7f0e4){return client[_0x961b('0x7')](_0x132516,_0x1b1553)[_0x961b('0x8')](function(_0x10b00c){logger[_0x961b('0x9')](_0x961b('0xa'),_0x47b920,_0x961b('0xb'));logger[_0x961b('0xc')](_0x961b('0xd'),_0x47b920,_0x961b('0xb'),JSON[_0x961b('0xe')](_0x10b00c));if(_0x10b00c[_0x961b('0xf')]){if(_0x10b00c[_0x961b('0xf')][_0x961b('0x10')]===0x1f4){logger[_0x961b('0xf')](_0x961b('0xa'),_0x47b920,_0x10b00c[_0x961b('0xf')][_0x961b('0x11')]);return _0xa7f0e4(_0x10b00c[_0x961b('0xf')][_0x961b('0x11')]);}logger['error'](_0x961b('0xa'),_0x47b920,_0x10b00c['error'][_0x961b('0x11')]);return _0x5d74ff(_0x10b00c[_0x961b('0xf')][_0x961b('0x11')]);}else{logger[_0x961b('0x9')](_0x961b('0xa'),_0x47b920,'request\x20sent');_0x5d74ff(_0x10b00c[_0x961b('0x12')][_0x961b('0x11')]);}})[_0x961b('0x13')](function(_0x17b96b){logger['error'](_0x961b('0xa'),_0x47b920,_0x17b96b);_0xa7f0e4(_0x17b96b);});});} \ No newline at end of file +var _0x972d=['result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x5f25b3,_0x542537){var _0x46c4cc=function(_0x5c9001){while(--_0x5c9001){_0x5f25b3['push'](_0x5f25b3['shift']());}};_0x46c4cc(++_0x542537);}(_0x972d,0x14b));var _0xd972=function(_0x3c0ad6,_0x26ebc2){_0x3c0ad6=_0x3c0ad6-0x0;var _0x3f1e08=_0x972d[_0x3c0ad6];return _0x3f1e08;};'use strict';var _=require('lodash');var util=require(_0xd972('0x0'));var moment=require(_0xd972('0x1'));var BPromise=require(_0xd972('0x2'));var rs=require(_0xd972('0x3'));var fs=require('fs');var Redis=require(_0xd972('0x4'));var db=require(_0xd972('0x5'))['db'];var utils=require(_0xd972('0x6'));var logger=require('../../config/logger')(_0xd972('0x7'));var config=require(_0xd972('0x8'));var jayson=require(_0xd972('0x9'));var client=jayson[_0xd972('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x55af8e,_0x1e210f,_0x40c53a){return new BPromise(function(_0x20b843,_0x3bf69d){return client[_0xd972('0xb')](_0x55af8e,_0x40c53a)[_0xd972('0xc')](function(_0x4ba3cf){logger[_0xd972('0xd')](_0xd972('0xe'),_0x1e210f,_0xd972('0xf'));logger[_0xd972('0x10')](_0xd972('0x11'),_0x1e210f,'request\x20sent',JSON['stringify'](_0x4ba3cf));if(_0x4ba3cf[_0xd972('0x12')]){if(_0x4ba3cf[_0xd972('0x12')][_0xd972('0x13')]===0x1f4){logger['error'](_0xd972('0xe'),_0x1e210f,_0x4ba3cf[_0xd972('0x12')][_0xd972('0x14')]);return _0x3bf69d(_0x4ba3cf[_0xd972('0x12')][_0xd972('0x14')]);}logger['error']('License,\x20%s,\x20%s',_0x1e210f,_0x4ba3cf[_0xd972('0x12')][_0xd972('0x14')]);return _0x20b843(_0x4ba3cf[_0xd972('0x12')][_0xd972('0x14')]);}else{logger['info']('License,\x20%s,\x20%s',_0x1e210f,'request\x20sent');_0x20b843(_0x4ba3cf[_0xd972('0x15')][_0xd972('0x14')]);}})['catch'](function(_0x58fb8b){logger[_0xd972('0x12')]('License,\x20%s,\x20%s',_0x1e210f,_0x58fb8b);_0x3bf69d(_0x58fb8b);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 5a3ebd7..5233e6f 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 _0xde11=['show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','verifySmtp','/:id/users','post','addAnswer','create','addImap','addSmtp','addInteraction','addApplications','/:id/send','send','/:id','update','delete','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','describe'];(function(_0x5b1c10,_0x1cd9d0){var _0x415e9c=function(_0x1cc6e4){while(--_0x1cc6e4){_0x5b1c10['push'](_0x5b1c10['shift']());}};_0x415e9c(++_0x1cd9d0);}(_0xde11,0x109));var _0x1de1=function(_0x44e3ee,_0x29f72b){_0x44e3ee=_0x44e3ee-0x0;var _0x45f95a=_0xde11[_0x44e3ee];return _0x45f95a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1de1('0x0'));var timeout=require(_0x1de1('0x1'));var express=require(_0x1de1('0x2'));var router=express[_0x1de1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1de1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1de1('0x5'));var controller=require(_0x1de1('0x6'));router[_0x1de1('0x7')]('/',auth[_0x1de1('0x8')](),controller[_0x1de1('0x9')]);router[_0x1de1('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x1de1('0xa')]);router[_0x1de1('0x7')]('/:id',auth[_0x1de1('0x8')](),controller[_0x1de1('0xb')]);router[_0x1de1('0x7')](_0x1de1('0xc'),auth[_0x1de1('0x8')](),controller[_0x1de1('0xd')]);router['get'](_0x1de1('0xe'),auth[_0x1de1('0x8')](),controller[_0x1de1('0xf')]);router['get'](_0x1de1('0x10'),auth[_0x1de1('0x8')](),controller[_0x1de1('0x11')]);router[_0x1de1('0x7')](_0x1de1('0x12'),auth[_0x1de1('0x8')](),controller[_0x1de1('0x13')]);router['get'](_0x1de1('0x14'),auth[_0x1de1('0x8')](),controller[_0x1de1('0x15')]);router['get'](_0x1de1('0x16'),auth['isAuthenticated'](),controller[_0x1de1('0x17')]);router[_0x1de1('0x7')](_0x1de1('0x18'),auth[_0x1de1('0x8')](),controller[_0x1de1('0x19')]);router[_0x1de1('0x7')]('/:id/verify',auth[_0x1de1('0x8')](),controller[_0x1de1('0x1a')]);router['get'](_0x1de1('0x1b'),auth[_0x1de1('0x8')](),controller['getAgents']);router[_0x1de1('0x1c')]('/:id/dispositions',auth[_0x1de1('0x8')](),controller['addDisposition']);router[_0x1de1('0x1c')](_0x1de1('0xe'),auth[_0x1de1('0x8')](),controller[_0x1de1('0x1d')]);router[_0x1de1('0x1c')]('/',auth[_0x1de1('0x8')](),controller[_0x1de1('0x1e')]);router[_0x1de1('0x1c')](_0x1de1('0x10'),auth[_0x1de1('0x8')](),controller[_0x1de1('0x1f')]);router[_0x1de1('0x1c')](_0x1de1('0x12'),auth[_0x1de1('0x8')](),controller[_0x1de1('0x20')]);router[_0x1de1('0x1c')](_0x1de1('0x14'),auth[_0x1de1('0x8')](),controller[_0x1de1('0x21')]);router['post'](_0x1de1('0x16'),auth['isAuthenticated'](),controller[_0x1de1('0x22')]);router['post'](_0x1de1('0x23'),auth['isAuthenticated'](),controller[_0x1de1('0x24')]);router[_0x1de1('0x1c')](_0x1de1('0x1b'),auth[_0x1de1('0x8')](),controller['addAgents']);router['put'](_0x1de1('0x25'),auth[_0x1de1('0x8')](),controller[_0x1de1('0x26')]);router[_0x1de1('0x27')](_0x1de1('0xc'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x1de1('0x27')](_0x1de1('0xe'),auth[_0x1de1('0x8')](),controller[_0x1de1('0x28')]);router[_0x1de1('0x27')](_0x1de1('0x10'),auth[_0x1de1('0x8')](),controller[_0x1de1('0x29')]);router[_0x1de1('0x27')](_0x1de1('0x12'),auth[_0x1de1('0x8')](),controller[_0x1de1('0x2a')]);router[_0x1de1('0x27')](_0x1de1('0x25'),auth[_0x1de1('0x8')](),controller[_0x1de1('0x2b')]);router[_0x1de1('0x27')](_0x1de1('0x1b'),auth[_0x1de1('0x8')](),controller[_0x1de1('0x2c')]);module[_0x1de1('0x2d')]=router; \ No newline at end of file +var _0x3a7c=['addInteraction','/:id/applications','send','addAgents','put','update','removeDispositions','delete','removeImap','removeSmtp','destroy','removeAgents','exports','express','fs-extra','../../components/interaction/service','../../config/environment','./mailAccount.controller','index','get','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/in_servers','getImap','/:id/out_servers','/:id/interactions','getApplications','/:id/messages','getMessages','/:id/verify','/:id/users','getAgents','addDisposition','post','create','addImap','addSmtp'];(function(_0x9641f8,_0x5c2372){var _0x3881b4=function(_0x45b7d9){while(--_0x45b7d9){_0x9641f8['push'](_0x9641f8['shift']());}};_0x3881b4(++_0x5c2372);}(_0x3a7c,0x1bb));var _0xc3a7=function(_0x3a0b7f,_0x550d3b){_0x3a0b7f=_0x3a0b7f-0x0;var _0x551562=_0x3a7c[_0x3a0b7f];return _0x551562;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc3a7('0x0'));var router=express['Router']();var fs_extra=require(_0xc3a7('0x1'));var auth=require('../../components/auth/service');var interaction=require(_0xc3a7('0x2'));var config=require(_0xc3a7('0x3'));var controller=require(_0xc3a7('0x4'));router['get']('/',auth['isAuthenticated'](),controller[_0xc3a7('0x5')]);router[_0xc3a7('0x6')](_0xc3a7('0x7'),auth[_0xc3a7('0x8')](),controller[_0xc3a7('0x9')]);router[_0xc3a7('0x6')](_0xc3a7('0xa'),auth[_0xc3a7('0x8')](),controller[_0xc3a7('0xb')]);router[_0xc3a7('0x6')](_0xc3a7('0xc'),auth[_0xc3a7('0x8')](),controller[_0xc3a7('0xd')]);router[_0xc3a7('0x6')](_0xc3a7('0xe'),auth[_0xc3a7('0x8')](),controller['getAnswers']);router[_0xc3a7('0x6')](_0xc3a7('0xf'),auth['isAuthenticated'](),controller[_0xc3a7('0x10')]);router[_0xc3a7('0x6')](_0xc3a7('0x11'),auth[_0xc3a7('0x8')](),controller['getSmtp']);router[_0xc3a7('0x6')](_0xc3a7('0x12'),auth[_0xc3a7('0x8')](),controller['getInteractions']);router[_0xc3a7('0x6')]('/:id/applications',auth[_0xc3a7('0x8')](),controller[_0xc3a7('0x13')]);router[_0xc3a7('0x6')](_0xc3a7('0x14'),auth[_0xc3a7('0x8')](),controller[_0xc3a7('0x15')]);router[_0xc3a7('0x6')](_0xc3a7('0x16'),auth[_0xc3a7('0x8')](),controller['verifySmtp']);router[_0xc3a7('0x6')](_0xc3a7('0x17'),auth['isAuthenticated'](),controller[_0xc3a7('0x18')]);router['post'](_0xc3a7('0xc'),auth[_0xc3a7('0x8')](),controller[_0xc3a7('0x19')]);router[_0xc3a7('0x1a')]('/:id/canned_answers',auth['isAuthenticated'](),controller['addAnswer']);router['post']('/',auth['isAuthenticated'](),controller[_0xc3a7('0x1b')]);router[_0xc3a7('0x1a')]('/:id/in_servers',auth[_0xc3a7('0x8')](),controller[_0xc3a7('0x1c')]);router[_0xc3a7('0x1a')](_0xc3a7('0x11'),auth['isAuthenticated'](),controller[_0xc3a7('0x1d')]);router[_0xc3a7('0x1a')]('/:id/interactions',auth[_0xc3a7('0x8')](),controller[_0xc3a7('0x1e')]);router[_0xc3a7('0x1a')](_0xc3a7('0x1f'),auth['isAuthenticated'](),controller['addApplications']);router['post']('/:id/send',auth['isAuthenticated'](),controller[_0xc3a7('0x20')]);router['post'](_0xc3a7('0x17'),auth[_0xc3a7('0x8')](),controller[_0xc3a7('0x21')]);router[_0xc3a7('0x22')](_0xc3a7('0xa'),auth[_0xc3a7('0x8')](),controller[_0xc3a7('0x23')]);router['delete'](_0xc3a7('0xc'),auth[_0xc3a7('0x8')](),controller[_0xc3a7('0x24')]);router[_0xc3a7('0x25')]('/:id/canned_answers',auth[_0xc3a7('0x8')](),controller['removeAnswers']);router[_0xc3a7('0x25')]('/:id/in_servers',auth[_0xc3a7('0x8')](),controller[_0xc3a7('0x26')]);router[_0xc3a7('0x25')]('/:id/out_servers',auth['isAuthenticated'](),controller[_0xc3a7('0x27')]);router['delete'](_0xc3a7('0xa'),auth[_0xc3a7('0x8')](),controller[_0xc3a7('0x28')]);router[_0xc3a7('0x25')](_0xc3a7('0x17'),auth[_0xc3a7('0x8')](),controller[_0xc3a7('0x29')]);module[_0xc3a7('0x2a')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 15c4bd8..7c35213 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 _0x815b=['STRING','BOOLEAN','Arial,Helvetica,sans-serif','UNSIGNED','TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports'];(function(_0x39b04b,_0x2d78f5){var _0x1d9232=function(_0xede8c5){while(--_0xede8c5){_0x39b04b['push'](_0x39b04b['shift']());}};_0x1d9232(++_0x2d78f5);}(_0x815b,0xb4));var _0xb815=function(_0x32d5cb,_0x39ae5c){_0x32d5cb=_0x32d5cb-0x0;var _0x534007=_0x815b[_0x32d5cb];return _0x534007;};'use strict';var Sequelize=require(_0xb815('0x0'));module[_0xb815('0x1')]={'description':{'type':Sequelize[_0xb815('0x2')]},'name':{'type':Sequelize[_0xb815('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0xb815('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xb815('0x3')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0xb815('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xb815('0x2')],'allowNull':![],'defaultValue':_0xb815('0x4')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0xb815('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xb815('0x6')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0xb815('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xb815('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb815('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb815('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb815('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb815('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0xb815('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xb815('0x3')],'defaultValue':![],'comment':_0xb815('0x9'),'set':function(_0x50f5f0){if(!_0x50f5f0)this[_0xb815('0xa')](_0xb815('0xb'),null);this[_0xb815('0xa')](_0xb815('0xc'),_0x50f5f0);}}}; \ No newline at end of file +var _0x4006=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','BOOLEAN','INTEGER','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0x4006,0x1c7));var _0x6400=function(_0x446848,_0x4c7cc8){_0x446848=_0x446848-0x0;var _0x19337d=_0x4006[_0x446848];return _0x19337d;};'use strict';var Sequelize=require('sequelize');module[_0x6400('0x0')]={'description':{'type':Sequelize[_0x6400('0x1')]},'name':{'type':Sequelize[_0x6400('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x6400('0x2')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x6400('0x1')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0x6400('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x6400('0x3')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x6400('0x4')],'defaultValue':function(){return _0x6400('0x5');}},'notificationSound':{'type':Sequelize[_0x6400('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6400('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6400('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6400('0x3')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6400('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6400('0x3')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6400('0x3')],'allowNull':!![],'defaultValue':null,'comment':_0x6400('0x6')},'mandatoryDisposition':{'type':Sequelize[_0x6400('0x2')],'defaultValue':![],'comment':_0x6400('0x7'),'set':function(_0x237e22){if(!_0x237e22)this[_0x6400('0x8')](_0x6400('0x9'),null);this['setDataValue'](_0x6400('0xa'),_0x237e22);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 6390741..504adf6 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 _0x9339=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','omit','getInteractions','MailInteraction','CmContact','Contact','User','Owner','internal','color','tag','addApplications','sequelize','transaction','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','send','List','Contacts','updatedAt','DESC','from','attachments','join','root','server/files/attachments','auth','secure','sendMail','ListId','List\x20not\x20found','messageId','attach','out','Interaction','verifySmtp','Sequelize','ValidationError','addAgents','spread','removeAgents','emit','userMailAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','html-to-text','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','./mailAccount.socket','register','jayson/promise','client','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','MailAccounts','UserProfileResource','destroy','stack','name','index','Imap','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','show','params','Smtp','rawAttributes','length','body','MailServerIn','describe','find','MailAccountId','Disposition','create','getDispositions','findOne','sort','removeDispositions','CannedAnswer','getAnswers','removeAnswers','ids','email','isNil','active','description','cservice','cauthentication','user','password','pass','cpassword','authentication','host','port','service','cuser','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','userProfileId'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x9339,0x1c4));var _0x9933=function(_0x2ab0fb,_0xf21f9e){_0x2ab0fb=_0x2ab0fb-0x0;var _0x578c50=_0x9339[_0x2ab0fb];return _0x578c50;};'use strict';var emlformat=require(_0x9933('0x0'));var rimraf=require(_0x9933('0x1'));var zipdir=require(_0x9933('0x2'));var jsonpatch=require(_0x9933('0x3'));var rp=require(_0x9933('0x4'));var moment=require(_0x9933('0x5'));var BPromise=require(_0x9933('0x6'));var Mustache=require(_0x9933('0x7'));var util=require(_0x9933('0x8'));var path=require(_0x9933('0x9'));var sox=require(_0x9933('0xa'));var csv=require('to-csv');var ejs=require(_0x9933('0xb'));var fs=require('fs');var fs_extra=require(_0x9933('0xc'));var _=require(_0x9933('0xd'));var squel=require(_0x9933('0xe'));var crypto=require('crypto');var jsforce=require(_0x9933('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9933('0x10'));var Papa=require(_0x9933('0x11'));var htmlToText=require(_0x9933('0x12'));var juice=require('juice');var Redis=require(_0x9933('0x13'));var authService=require(_0x9933('0x14'));var qs=require(_0x9933('0x15'));var as=require(_0x9933('0x16'));var hardwareService=require(_0x9933('0x17'));var logger=require(_0x9933('0x18'))(_0x9933('0x19'));var utils=require(_0x9933('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x9933('0x1b'));var db=require(_0x9933('0x1c'))['db'];config[_0x9933('0x1d')]=_[_0x9933('0x1e')](config[_0x9933('0x1d')],{'host':_0x9933('0x1f'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9933('0x1d')]));require(_0x9933('0x20'))[_0x9933('0x21')](socket);var jayson=require(_0x9933('0x22'));var client=jayson[_0x9933('0x23')]['http']({'port':0x232b});function respondWithRpcPromise(_0x10a216,_0x2ef8fa,_0x37df99,_0x2fa100){return new BPromise(function(_0x27f572,_0x20c5f9){var _0x5bf635=_0x2fa100||client;return _0x5bf635[_0x9933('0x24')](_0x10a216,_0x37df99)[_0x9933('0x25')](function(_0x5a8a42){logger[_0x9933('0x26')](_0x9933('0x27'),_0x2ef8fa,_0x9933('0x28'));logger[_0x9933('0x29')](_0x9933('0x2a'),_0x2ef8fa,_0x9933('0x28'),JSON['stringify'](_0x5a8a42));if(_0x5a8a42[_0x9933('0x2b')]){if(_0x5a8a42[_0x9933('0x2b')][_0x9933('0x2c')]===0x1f4){logger[_0x9933('0x2b')]('MailAccount,\x20%s,\x20%s',_0x2ef8fa,_0x5a8a42[_0x9933('0x2b')]['message']);return _0x20c5f9(_0x5a8a42['error'][_0x9933('0x2d')]);}logger[_0x9933('0x2b')](_0x9933('0x27'),_0x2ef8fa,_0x5a8a42[_0x9933('0x2b')][_0x9933('0x2d')]);return _0x27f572(_0x5a8a42['error'][_0x9933('0x2d')]);}else{logger[_0x9933('0x26')](_0x9933('0x27'),_0x2ef8fa,_0x9933('0x28'));_0x27f572(_0x5a8a42[_0x9933('0x2e')]['message']);}})[_0x9933('0x2f')](function(_0x29ceab){logger[_0x9933('0x2b')]('MailAccount,\x20%s,\x20%s',_0x2ef8fa,_0x29ceab);_0x20c5f9(_0x29ceab);});});}function respondWithStatusCode(_0x5e5f4f,_0xedb8db){_0xedb8db=_0xedb8db||0xcc;return function(_0x399074){if(_0x399074){return _0x5e5f4f[_0x9933('0x30')](_0xedb8db);}return _0x5e5f4f[_0x9933('0x31')](_0xedb8db)[_0x9933('0x32')]();};}function respondWithResult(_0x1a70f2,_0x209d02){_0x209d02=_0x209d02||0xc8;return function(_0x8f0c7b){if(_0x8f0c7b){return _0x1a70f2[_0x9933('0x31')](_0x209d02)['json'](_0x8f0c7b);}};}function respondWithFilteredResult(_0x5bdf8e,_0x341863){return function(_0x35624b){if(_0x35624b){var _0x24ca8f=typeof _0x341863[_0x9933('0x33')]===_0x9933('0x34')&&typeof _0x341863[_0x9933('0x35')]==='undefined';var _0x366bfc=_0x35624b[_0x9933('0x36')];var _0x3a283e=_0x24ca8f?0x0:_0x341863['offset'];var _0x366293=_0x24ca8f?_0x35624b[_0x9933('0x36')]:_0x341863['offset']+_0x341863[_0x9933('0x35')];var _0x2bce2e;if(_0x366293>=_0x366bfc){_0x366293=_0x366bfc;_0x2bce2e=0xc8;}else{_0x2bce2e=0xce;}_0x5bdf8e[_0x9933('0x31')](_0x2bce2e);return _0x5bdf8e[_0x9933('0x37')](_0x9933('0x38'),_0x3a283e+'-'+_0x366293+'/'+_0x366bfc)[_0x9933('0x39')](_0x35624b);}return null;};}function patchUpdates(_0x2d3f56){return function(_0x15eac6){try{jsonpatch[_0x9933('0x3a')](_0x15eac6,_0x2d3f56,!![]);}catch(_0x4773e2){return BPromise[_0x9933('0x3b')](_0x4773e2);}return _0x15eac6[_0x9933('0x3c')]();};}function saveUpdates(_0xfa97b3,_0x29209e){return function(_0x4d3821){if(_0x4d3821){return _0x4d3821[_0x9933('0x3d')](_0xfa97b3)['then'](function(_0x31c65a){return _0x31c65a;});}return null;};}function removeEntity(_0xbcb03a,_0x6afce3){return function(_0x263dfd){if(_0x263dfd){return _0x263dfd['destroy']()[_0x9933('0x25')](function(){var _0x2a1a4f=_0x263dfd['get']({'plain':!![]});var _0x3e3c04=_0x9933('0x3e');return db[_0x9933('0x3f')][_0x9933('0x40')]({'where':{'type':_0x3e3c04,'resourceId':_0x2a1a4f['id']}})[_0x9933('0x25')](function(){return _0x263dfd;});})[_0x9933('0x25')](function(){_0xbcb03a[_0x9933('0x31')](0xcc)[_0x9933('0x32')]();});}};}function handleEntityNotFound(_0x75a9be,_0x22f3b1){return function(_0x113fe2){if(!_0x113fe2){_0x75a9be['sendStatus'](0x194);}return _0x113fe2;};}function handleError(_0xba5e08,_0x1dce2c){_0x1dce2c=_0x1dce2c||0x1f4;return function(_0x4f2224){logger[_0x9933('0x2b')](_0x4f2224[_0x9933('0x41')]);if(_0x4f2224['name']){delete _0x4f2224[_0x9933('0x42')];}_0xba5e08[_0x9933('0x31')](_0x1dce2c)['send'](_0x4f2224);};}exports[_0x9933('0x43')]=function(_0x253eaa,_0xa05949){var _0x19a18a={'include':[{'model':db['MailServerIn'],'as':_0x9933('0x44')},{'model':db[_0x9933('0x45')],'as':'Smtp'},{'model':db[_0x9933('0x46')],'as':_0x9933('0x47')}]},_0x14e7fd={},_0x41d1ec={'count':0x0,'rows':[]};var _0x27a51b=_[_0x9933('0x48')](db[_0x9933('0x49')]['rawAttributes'],function(_0x2e9b9b){return{'name':_0x2e9b9b['fieldName'],'type':_0x2e9b9b['type'][_0x9933('0x4a')]};});_0x14e7fd[_0x9933('0x4b')]=_['map'](_0x27a51b,_0x9933('0x42'));_0x14e7fd[_0x9933('0x4c')]=_[_0x9933('0x4d')](_0x253eaa['query']);_0x14e7fd[_0x9933('0x4e')]=_[_0x9933('0x4f')](_0x14e7fd[_0x9933('0x4b')],_0x14e7fd['query']);_0x19a18a[_0x9933('0x50')]=_[_0x9933('0x4f')](_0x14e7fd[_0x9933('0x4b')],qs[_0x9933('0x51')](_0x253eaa[_0x9933('0x4c')][_0x9933('0x51')]));_0x19a18a['attributes']=_0x19a18a[_0x9933('0x50')]['length']?_0x19a18a[_0x9933('0x50')]:_0x14e7fd[_0x9933('0x4b')];if(!_0x253eaa['query'][_0x9933('0x52')](_0x9933('0x53'))){_0x19a18a[_0x9933('0x35')]=qs[_0x9933('0x35')](_0x253eaa['query'][_0x9933('0x35')]);_0x19a18a[_0x9933('0x33')]=qs[_0x9933('0x33')](_0x253eaa[_0x9933('0x4c')][_0x9933('0x33')]);}_0x19a18a[_0x9933('0x54')]=qs['sort'](_0x253eaa[_0x9933('0x4c')]['sort']);_0x19a18a[_0x9933('0x55')]=qs['filters'](_[_0x9933('0x56')](_0x253eaa[_0x9933('0x4c')],_0x14e7fd[_0x9933('0x4e')]),_0x27a51b);if(_0x253eaa[_0x9933('0x4c')][_0x9933('0x57')]){_0x19a18a[_0x9933('0x55')]=_[_0x9933('0x58')](_0x19a18a[_0x9933('0x55')],{'$or':_[_0x9933('0x48')](_0x27a51b,function(_0x18ff6d){if(_0x18ff6d[_0x9933('0x59')]!=='VIRTUAL'){var _0x53f8de={};_0x53f8de[_0x18ff6d[_0x9933('0x42')]]={'$like':'%'+_0x253eaa[_0x9933('0x4c')][_0x9933('0x57')]+'%'};return _0x53f8de;}})});}_0x19a18a=_[_0x9933('0x58')]({},_0x19a18a,_0x253eaa[_0x9933('0x5a')]);var _0x310cad={'where':_0x19a18a[_0x9933('0x55')]};return db[_0x9933('0x49')][_0x9933('0x36')](_0x310cad)[_0x9933('0x25')](function(_0x5ab19b){_0x41d1ec[_0x9933('0x36')]=_0x5ab19b;if(_0x253eaa['query'][_0x9933('0x5b')]){_0x19a18a[_0x9933('0x5c')]=[{'all':!![]}];}return db[_0x9933('0x49')][_0x9933('0x5d')](_0x19a18a);})[_0x9933('0x25')](function(_0xef939b){_0x41d1ec[_0x9933('0x5e')]=_0xef939b;return _0x41d1ec;})[_0x9933('0x25')](respondWithFilteredResult(_0xa05949,_0x19a18a))[_0x9933('0x2f')](handleError(_0xa05949,null));};exports[_0x9933('0x5f')]=function(_0x57d614,_0x30d0e1){var _0x12d3bd={'raw':![],'where':{'id':_0x57d614[_0x9933('0x60')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x9933('0x44')},{'model':db[_0x9933('0x45')],'as':_0x9933('0x61')},{'model':db[_0x9933('0x46')],'as':_0x9933('0x47')}]},_0x2ac2fb={};_0x2ac2fb[_0x9933('0x4b')]=_['keys'](db[_0x9933('0x49')][_0x9933('0x62')]);_0x2ac2fb[_0x9933('0x4c')]=_[_0x9933('0x4d')](_0x57d614[_0x9933('0x4c')]);_0x2ac2fb[_0x9933('0x4e')]=_['intersection'](_0x2ac2fb[_0x9933('0x4b')],_0x2ac2fb[_0x9933('0x4c')]);_0x12d3bd[_0x9933('0x50')]=_[_0x9933('0x4f')](_0x2ac2fb['model'],qs[_0x9933('0x51')](_0x57d614[_0x9933('0x4c')]['fields']));_0x12d3bd['attributes']=_0x12d3bd['attributes'][_0x9933('0x63')]?_0x12d3bd[_0x9933('0x50')]:_0x2ac2fb[_0x9933('0x4b')];if(_0x57d614['query'][_0x9933('0x5b')]){_0x12d3bd['include']=[{'all':!![]}];}_0x12d3bd=_[_0x9933('0x58')]({},_0x12d3bd,_0x57d614['options']);return db[_0x9933('0x49')]['find'](_0x12d3bd)[_0x9933('0x25')](handleEntityNotFound(_0x30d0e1,null))[_0x9933('0x25')](respondWithResult(_0x30d0e1,null))[_0x9933('0x2f')](handleError(_0x30d0e1,null));};exports[_0x9933('0x3d')]=function(_0x1a6295,_0xb31e40){if(_0x1a6295[_0x9933('0x64')]['id']){delete _0x1a6295[_0x9933('0x64')]['id'];}return db[_0x9933('0x49')]['find']({'where':{'id':_0x1a6295[_0x9933('0x60')]['id']},'include':[{'model':db[_0x9933('0x65')],'as':'Imap'},{'model':db[_0x9933('0x45')],'as':_0x9933('0x61')},{'model':db[_0x9933('0x46')],'as':_0x9933('0x47')}]})[_0x9933('0x25')](handleEntityNotFound(_0xb31e40,null))[_0x9933('0x25')](saveUpdates(_0x1a6295[_0x9933('0x64')],null))[_0x9933('0x25')](function(_0x542ec2){if(_0x542ec2&&_0x1a6295['body'][_0x9933('0x44')]){return db['MailServerIn'][_0x9933('0x3d')](_0x1a6295[_0x9933('0x64')]['Imap'],{'where':{'MailAccountId':_0x542ec2['id']}})['then'](function(){return _0x542ec2;});}return _0x542ec2;})[_0x9933('0x25')](function(_0x25eae8){if(_0x25eae8&&_0x1a6295[_0x9933('0x64')][_0x9933('0x61')]){return db[_0x9933('0x45')][_0x9933('0x3d')](_0x1a6295[_0x9933('0x64')]['Smtp'],{'where':{'MailAccountId':_0x25eae8['id']}})[_0x9933('0x25')](function(){return _0x25eae8;});}return _0x25eae8;})['then'](respondWithResult(_0xb31e40,null))[_0x9933('0x2f')](handleError(_0xb31e40,null));};exports[_0x9933('0x66')]=function(_0x2b740b,_0x5ba41a){return db[_0x9933('0x49')][_0x9933('0x66')]()[_0x9933('0x25')](respondWithResult(_0x5ba41a,null))[_0x9933('0x2f')](handleError(_0x5ba41a,null));};exports['addDisposition']=function(_0x1c4dcb,_0x372403,_0x3f07eb){if(_0x1c4dcb['body']['id']){delete _0x1c4dcb[_0x9933('0x64')]['id'];}return db[_0x9933('0x49')][_0x9933('0x67')]({'where':{'id':_0x1c4dcb['params']['id']}})[_0x9933('0x25')](handleEntityNotFound(_0x372403,null))['then'](function(_0x86e57f){if(_0x86e57f){_0x1c4dcb[_0x9933('0x64')][_0x9933('0x68')]=_0x86e57f['id'];return db[_0x9933('0x69')][_0x9933('0x6a')](_0x1c4dcb['body']);}})[_0x9933('0x25')](respondWithResult(_0x372403,null))[_0x9933('0x2f')](handleError(_0x372403,null));};exports[_0x9933('0x6b')]=function(_0x1598aa,_0x1fb115,_0x1d7564){var _0xc5f031={'raw':![],'where':{}};var _0xdb7f09={};var _0x244456={'count':0x0,'rows':[]};return db[_0x9933('0x49')][_0x9933('0x6c')]({'where':{'id':_0x1598aa[_0x9933('0x60')]['id']}})['then'](handleEntityNotFound(_0x1fb115,null))[_0x9933('0x25')](function(_0x51b514){if(_0x51b514){_0xdb7f09[_0x9933('0x4b')]=_[_0x9933('0x4d')](db['Disposition'][_0x9933('0x62')]);_0xdb7f09['query']=_['keys'](_0x1598aa[_0x9933('0x4c')]);_0xdb7f09[_0x9933('0x4e')]=_[_0x9933('0x4f')](_0xdb7f09['model'],_0xdb7f09[_0x9933('0x4c')]);_0xc5f031[_0x9933('0x50')]=_[_0x9933('0x4f')](_0xdb7f09[_0x9933('0x4b')],qs[_0x9933('0x51')](_0x1598aa[_0x9933('0x4c')][_0x9933('0x51')]));_0xc5f031['attributes']=_0xc5f031[_0x9933('0x50')][_0x9933('0x63')]?_0xc5f031['attributes']:_0xdb7f09[_0x9933('0x4b')];if(!_0x1598aa[_0x9933('0x4c')]['hasOwnProperty'](_0x9933('0x53'))){_0xc5f031[_0x9933('0x35')]=qs[_0x9933('0x35')](_0x1598aa['query'][_0x9933('0x35')]);_0xc5f031['offset']=qs[_0x9933('0x33')](_0x1598aa[_0x9933('0x4c')]['offset']);}_0xc5f031[_0x9933('0x54')]=qs[_0x9933('0x6d')](_0x1598aa[_0x9933('0x4c')][_0x9933('0x6d')]);_0xc5f031[_0x9933('0x55')]=qs[_0x9933('0x4e')](_[_0x9933('0x56')](_0x1598aa[_0x9933('0x4c')],_0xdb7f09[_0x9933('0x4e')]));_0xc5f031['where'][_0x9933('0x68')]=_0x51b514['id'];if(_0x1598aa[_0x9933('0x4c')][_0x9933('0x57')]){_0xc5f031[_0x9933('0x55')]=_['merge'](_0xc5f031[_0x9933('0x55')],{'$or':_['map'](_0xc5f031[_0x9933('0x50')],function(_0x5deb53){var _0xd4e6b={};_0xd4e6b[_0x5deb53]={'$like':'%'+_0x1598aa['query'][_0x9933('0x57')]+'%'};return _0xd4e6b;})});}_0xc5f031=_['merge']({},_0xc5f031,_0x1598aa[_0x9933('0x5a')]);return db['Disposition']['count']({'where':_0xc5f031['where']})[_0x9933('0x25')](function(_0x56e88e){_0x244456[_0x9933('0x36')]=_0x56e88e;if(_0x1598aa[_0x9933('0x4c')][_0x9933('0x5b')]){_0xc5f031[_0x9933('0x5c')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0xc5f031);})[_0x9933('0x25')](function(_0x3357e2){_0x244456[_0x9933('0x5e')]=_0x3357e2;return _0x244456;});}})['then'](respondWithFilteredResult(_0x1fb115,_0xc5f031))[_0x9933('0x2f')](handleError(_0x1fb115,null));};exports[_0x9933('0x6e')]=function(_0x127274,_0x250535,_0x3e47dd){return db[_0x9933('0x49')]['find']({'where':{'id':_0x127274[_0x9933('0x60')]['id']}})[_0x9933('0x25')](handleEntityNotFound(_0x250535,null))[_0x9933('0x25')](function(_0x40bf30){if(_0x40bf30){return _0x40bf30[_0x9933('0x6e')](_0x127274[_0x9933('0x4c')]['ids']);}})[_0x9933('0x25')](respondWithStatusCode(_0x250535,null))[_0x9933('0x2f')](handleError(_0x250535,null));};exports['addAnswer']=function(_0x28c491,_0x30b609,_0x563a68){if(_0x28c491[_0x9933('0x64')]['id']){delete _0x28c491[_0x9933('0x64')]['id'];}return db[_0x9933('0x49')][_0x9933('0x67')]({'where':{'id':_0x28c491['params']['id']}})[_0x9933('0x25')](handleEntityNotFound(_0x30b609,null))['then'](function(_0x27f8a6){if(_0x27f8a6){_0x28c491[_0x9933('0x64')][_0x9933('0x68')]=_0x27f8a6['id'];return db[_0x9933('0x6f')]['create'](_0x28c491[_0x9933('0x64')]);}})[_0x9933('0x25')](respondWithResult(_0x30b609,null))[_0x9933('0x2f')](handleError(_0x30b609,null));};exports[_0x9933('0x70')]=function(_0xd8f935,_0x30e79d,_0x145f2c){var _0x28714e={'raw':![],'where':{}};var _0x266298={};var _0x534039={'count':0x0,'rows':[]};return db[_0x9933('0x49')][_0x9933('0x6c')]({'where':{'id':_0xd8f935[_0x9933('0x60')]['id']}})[_0x9933('0x25')](handleEntityNotFound(_0x30e79d,null))[_0x9933('0x25')](function(_0x3d97a8){if(_0x3d97a8){_0x266298['model']=_[_0x9933('0x4d')](db['CannedAnswer']['rawAttributes']);_0x266298['query']=_[_0x9933('0x4d')](_0xd8f935[_0x9933('0x4c')]);_0x266298[_0x9933('0x4e')]=_[_0x9933('0x4f')](_0x266298[_0x9933('0x4b')],_0x266298[_0x9933('0x4c')]);_0x28714e[_0x9933('0x50')]=_['intersection'](_0x266298['model'],qs[_0x9933('0x51')](_0xd8f935['query'][_0x9933('0x51')]));_0x28714e[_0x9933('0x50')]=_0x28714e['attributes'][_0x9933('0x63')]?_0x28714e[_0x9933('0x50')]:_0x266298[_0x9933('0x4b')];if(!_0xd8f935[_0x9933('0x4c')][_0x9933('0x52')](_0x9933('0x53'))){_0x28714e[_0x9933('0x35')]=qs[_0x9933('0x35')](_0xd8f935[_0x9933('0x4c')]['limit']);_0x28714e[_0x9933('0x33')]=qs[_0x9933('0x33')](_0xd8f935[_0x9933('0x4c')][_0x9933('0x33')]);}_0x28714e[_0x9933('0x54')]=qs[_0x9933('0x6d')](_0xd8f935[_0x9933('0x4c')]['sort']);_0x28714e['where']=qs[_0x9933('0x4e')](_['pick'](_0xd8f935[_0x9933('0x4c')],_0x266298[_0x9933('0x4e')]));_0x28714e[_0x9933('0x55')][_0x9933('0x68')]=_0x3d97a8['id'];if(_0xd8f935[_0x9933('0x4c')][_0x9933('0x57')]){_0x28714e['where']=_[_0x9933('0x58')](_0x28714e['where'],{'$or':_[_0x9933('0x48')](_0x28714e['attributes'],function(_0x39ff6f){var _0x478d5d={};_0x478d5d[_0x39ff6f]={'$like':'%'+_0xd8f935['query'][_0x9933('0x57')]+'%'};return _0x478d5d;})});}_0x28714e=_[_0x9933('0x58')]({},_0x28714e,_0xd8f935[_0x9933('0x5a')]);return db[_0x9933('0x6f')]['count']({'where':_0x28714e['where']})[_0x9933('0x25')](function(_0x2b3767){_0x534039[_0x9933('0x36')]=_0x2b3767;if(_0xd8f935[_0x9933('0x4c')][_0x9933('0x5b')]){_0x28714e['include']=[{'all':!![]}];}return db[_0x9933('0x6f')][_0x9933('0x5d')](_0x28714e);})[_0x9933('0x25')](function(_0x1de7a0){_0x534039[_0x9933('0x5e')]=_0x1de7a0;return _0x534039;});}})[_0x9933('0x25')](respondWithFilteredResult(_0x30e79d,_0x28714e))['catch'](handleError(_0x30e79d,null));};exports[_0x9933('0x71')]=function(_0x48bd42,_0x8bdc3c,_0x430170){return db[_0x9933('0x49')][_0x9933('0x67')]({'where':{'id':_0x48bd42[_0x9933('0x60')]['id']}})[_0x9933('0x25')](handleEntityNotFound(_0x8bdc3c,null))[_0x9933('0x25')](function(_0x41a91a){if(_0x41a91a){return _0x41a91a[_0x9933('0x71')](_0x48bd42[_0x9933('0x4c')][_0x9933('0x72')]);}})[_0x9933('0x25')](respondWithStatusCode(_0x8bdc3c,null))[_0x9933('0x2f')](handleError(_0x8bdc3c,null));};exports['create']=function(_0x59dff5,_0x2e8623){var _0x4f2625={'name':_0x59dff5[_0x9933('0x64')][_0x9933('0x42')],'key':_0x59dff5[_0x9933('0x64')][_0x9933('0x4a')],'email':_0x59dff5[_0x9933('0x64')][_0x9933('0x73')],'ListId':_0x59dff5['body']['ListId'],'active':!_[_0x9933('0x74')](_0x59dff5[_0x9933('0x64')][_0x9933('0x75')])?_0x59dff5[_0x9933('0x64')]['active']:!![],'description':_0x59dff5[_0x9933('0x64')][_0x9933('0x76')]||null,'Imap':{},'Smtp':{}};if(_[_0x9933('0x74')](_0x59dff5['body'][_0x9933('0x77')])){if(_0x59dff5[_0x9933('0x64')][_0x9933('0x78')]){_0x4f2625[_0x9933('0x44')][_0x9933('0x79')]=_0x4f2625['Smtp']['user']=_0x59dff5['body']['cuser'];_0x4f2625[_0x9933('0x44')][_0x9933('0x7a')]=_0x4f2625[_0x9933('0x61')][_0x9933('0x7b')]=_0x59dff5[_0x9933('0x64')][_0x9933('0x7c')];}else{_0x4f2625['Imap'][_0x9933('0x7d')]=_0x4f2625[_0x9933('0x61')]['authentication']=![];}_0x4f2625['Imap'][_0x9933('0x7e')]=_0x59dff5[_0x9933('0x64')][_0x9933('0x44')][_0x9933('0x7e')];_0x4f2625[_0x9933('0x44')][_0x9933('0x7f')]=_0x59dff5[_0x9933('0x64')][_0x9933('0x44')][_0x9933('0x7f')];_0x4f2625[_0x9933('0x61')][_0x9933('0x7e')]=_0x59dff5[_0x9933('0x64')][_0x9933('0x61')][_0x9933('0x7e')];_0x4f2625[_0x9933('0x61')][_0x9933('0x7f')]=_0x59dff5[_0x9933('0x64')][_0x9933('0x61')][_0x9933('0x7f')];}else{_0x4f2625[_0x9933('0x44')][_0x9933('0x80')]=_0x4f2625[_0x9933('0x61')][_0x9933('0x80')]=_0x59dff5[_0x9933('0x64')]['cservice'];_0x4f2625[_0x9933('0x44')][_0x9933('0x79')]=_0x4f2625[_0x9933('0x61')]['user']=_0x59dff5['body'][_0x9933('0x81')];_0x4f2625[_0x9933('0x44')]['password']=_0x4f2625[_0x9933('0x61')][_0x9933('0x7b')]=_0x59dff5['body'][_0x9933('0x7c')];}return db[_0x9933('0x49')][_0x9933('0x6a')](_0x4f2625,{'include':[{'model':db['MailServerOut'],'as':_0x9933('0x61')},{'model':db[_0x9933('0x65')],'as':'Imap'}]})[_0x9933('0x25')](function(_0x4c5987){var _0x310616=_0x59dff5['user']['get']({'plain':!![]});if(!_0x310616)throw new Error(_0x9933('0x82'));if(_0x310616['role']===_0x9933('0x79')){var _0x5d7bfa=_0x4c5987[_0x9933('0x83')]({'plain':!![]});return db['UserProfileSection'][_0x9933('0x67')]({'where':{'name':_0x9933('0x3e'),'userProfileId':_0x310616[_0x9933('0x84')]},'raw':!![]})[_0x9933('0x25')](function(_0x3fa191){if(_0x3fa191&&_0x3fa191[_0x9933('0x85')]===0x0){return db[_0x9933('0x3f')][_0x9933('0x6a')]({'name':_0x5d7bfa[_0x9933('0x42')],'resourceId':_0x5d7bfa['id'],'type':_0x3fa191[_0x9933('0x42')],'sectionId':_0x3fa191['id']},{})[_0x9933('0x25')](function(){return _0x4c5987;});}else{return _0x4c5987;}})[_0x9933('0x2f')](function(_0xdbd6a0){logger[_0x9933('0x2b')](_0x9933('0x86'),_0xdbd6a0);throw _0xdbd6a0;});}return _0x4c5987;})['then'](respondWithResult(_0x2e8623,0xc9))[_0x9933('0x2f')](handleError(_0x2e8623,null));};exports[_0x9933('0x87')]=function(_0x501880,_0x51dcf4,_0x2181f1){return db[_0x9933('0x49')][_0x9933('0x6c')]({'where':{'id':_0x501880[_0x9933('0x60')]['id']}})[_0x9933('0x25')](handleEntityNotFound(_0x51dcf4,null))[_0x9933('0x25')](function(_0x142f2b){if(_0x142f2b){return _0x142f2b[_0x9933('0x87')]();}return null;})[_0x9933('0x25')](respondWithResult(_0x51dcf4,null))[_0x9933('0x2f')](handleError(_0x51dcf4,null));};exports[_0x9933('0x88')]=function(_0x5b7889,_0x486fd7,_0x5b8723){if(_0x5b7889[_0x9933('0x64')]['id']){delete _0x5b7889[_0x9933('0x64')]['id'];}return db['MailAccount'][_0x9933('0x67')]({'where':{'id':_0x5b7889[_0x9933('0x60')]['id']}})[_0x9933('0x25')](handleEntityNotFound(_0x486fd7,null))[_0x9933('0x25')](function(_0x2ee4e1){if(_0x2ee4e1){_0x5b7889['body'][_0x9933('0x68')]=_0x2ee4e1['id'];return db[_0x9933('0x65')][_0x9933('0x6a')](_0x5b7889[_0x9933('0x64')]);}})[_0x9933('0x25')](respondWithResult(_0x486fd7,null))[_0x9933('0x2f')](handleError(_0x486fd7,null));};exports[_0x9933('0x89')]=function(_0x3b1f45,_0x20227d,_0x40e4eb){return db[_0x9933('0x49')][_0x9933('0x6c')]({'where':{'id':_0x3b1f45[_0x9933('0x60')]['id']}})['then'](handleEntityNotFound(_0x20227d,null))[_0x9933('0x25')](function(_0x260ba6){if(_0x260ba6){return _0x260ba6['setImap'](null);}return null;})['then'](respondWithStatusCode(_0x20227d,null))['catch'](handleError(_0x20227d,null));};exports[_0x9933('0x8a')]=function(_0x297c59,_0x449489,_0x3fd40a){return db[_0x9933('0x49')][_0x9933('0x6c')]({'where':{'id':_0x297c59[_0x9933('0x60')]['id']}})['then'](handleEntityNotFound(_0x449489,null))['then'](function(_0x107c0e){if(_0x107c0e){return _0x107c0e[_0x9933('0x8a')]();}return null;})[_0x9933('0x25')](respondWithResult(_0x449489,null))[_0x9933('0x2f')](handleError(_0x449489,null));};exports[_0x9933('0x8b')]=function(_0x159764,_0x5738f5,_0x419521){if(_0x159764[_0x9933('0x64')]['id']){delete _0x159764['body']['id'];}return db[_0x9933('0x49')][_0x9933('0x67')]({'where':{'id':_0x159764[_0x9933('0x60')]['id']}})[_0x9933('0x25')](handleEntityNotFound(_0x5738f5,null))[_0x9933('0x25')](function(_0x337fbb){if(_0x337fbb){_0x159764[_0x9933('0x64')][_0x9933('0x68')]=_0x337fbb['id'];return db[_0x9933('0x45')][_0x9933('0x6a')](_0x159764[_0x9933('0x64')]);}})[_0x9933('0x25')](respondWithResult(_0x5738f5,null))[_0x9933('0x2f')](handleError(_0x5738f5,null));};exports[_0x9933('0x8c')]=function(_0x271d52,_0x447eba,_0x3db802){return db[_0x9933('0x49')][_0x9933('0x6c')]({'where':{'id':_0x271d52[_0x9933('0x60')]['id']}})[_0x9933('0x25')](handleEntityNotFound(_0x447eba,null))[_0x9933('0x25')](function(_0x5c21a4){if(_0x5c21a4){return _0x5c21a4[_0x9933('0x8d')](null);}return null;})[_0x9933('0x25')](respondWithStatusCode(_0x447eba,null))[_0x9933('0x2f')](handleError(_0x447eba,null));};exports['addInteraction']=function(_0x483c3a,_0x2afd34,_0x555175){return db['MailInteraction'][_0x9933('0x67')]({'where':{'id':_0x483c3a[_0x9933('0x60')]['id']}})[_0x9933('0x25')](handleEntityNotFound(_0x2afd34,null))[_0x9933('0x25')](function(_0x5bc75f){if(_0x5bc75f){return _0x5bc75f[_0x9933('0x8e')](_0x483c3a['body'][_0x9933('0x72')],_[_0x9933('0x8f')](_0x483c3a['body'],[_0x9933('0x72'),'id'])||{});}})[_0x9933('0x25')](respondWithResult(_0x2afd34,null))[_0x9933('0x2f')](handleError(_0x2afd34,null));};exports[_0x9933('0x90')]=function(_0x2be0e8,_0x4f5d36,_0x549ebd){var _0x5dc072={'raw':![],'where':{}};var _0x4607b0={};var _0x44c628={'count':0x0,'rows':[]};return db['MailAccount'][_0x9933('0x6c')]({'where':{'id':_0x2be0e8[_0x9933('0x60')]['id']}})[_0x9933('0x25')](handleEntityNotFound(_0x4f5d36,null))[_0x9933('0x25')](function(_0x3720ae){if(_0x3720ae){_0x4607b0[_0x9933('0x4b')]=_['keys'](db[_0x9933('0x91')][_0x9933('0x62')]);_0x4607b0[_0x9933('0x4c')]=_[_0x9933('0x4d')](_0x2be0e8[_0x9933('0x4c')]);_0x4607b0[_0x9933('0x4e')]=_[_0x9933('0x4f')](_0x4607b0[_0x9933('0x4b')],_0x4607b0[_0x9933('0x4c')]);_0x5dc072['attributes']=_['intersection'](_0x4607b0['model'],qs[_0x9933('0x51')](_0x2be0e8['query'][_0x9933('0x51')]));_0x5dc072[_0x9933('0x50')]=_0x5dc072[_0x9933('0x50')][_0x9933('0x63')]?_0x5dc072['attributes']:_0x4607b0[_0x9933('0x4b')];if(!_0x2be0e8[_0x9933('0x4c')][_0x9933('0x52')]('nolimit')){_0x5dc072[_0x9933('0x35')]=qs['limit'](_0x2be0e8[_0x9933('0x4c')]['limit']);_0x5dc072[_0x9933('0x33')]=qs[_0x9933('0x33')](_0x2be0e8['query'][_0x9933('0x33')]);}_0x5dc072[_0x9933('0x54')]=qs[_0x9933('0x6d')](_0x2be0e8['query']['sort']);_0x5dc072['where']=qs[_0x9933('0x4e')](_[_0x9933('0x56')](_0x2be0e8[_0x9933('0x4c')],_0x4607b0[_0x9933('0x4e')]));_0x5dc072[_0x9933('0x55')][_0x9933('0x68')]=_0x3720ae['id'];if(_0x2be0e8[_0x9933('0x4c')][_0x9933('0x57')]){_0x5dc072['where']=_[_0x9933('0x58')](_0x5dc072[_0x9933('0x55')],{'$or':_[_0x9933('0x48')](_0x5dc072[_0x9933('0x50')],function(_0x1b9632){var _0x5e19d5={};_0x5e19d5[_0x1b9632]={'$like':'%'+_0x2be0e8[_0x9933('0x4c')][_0x9933('0x57')]+'%'};return _0x5e19d5;})});}_0x5dc072=_[_0x9933('0x58')]({},_0x5dc072,_0x2be0e8['options']);return db[_0x9933('0x91')]['count']({'where':_0x5dc072[_0x9933('0x55')]})['then'](function(_0x27c6e6){_0x44c628['count']=_0x27c6e6;if(_0x2be0e8[_0x9933('0x4c')][_0x9933('0x5b')]){_0x5dc072['include']=[{'model':db[_0x9933('0x92')],'as':_0x9933('0x93'),'required':![]},{'model':db[_0x9933('0x94')],'as':_0x9933('0x95'),'attributes':[_0x9933('0x42'),'fullname',_0x9933('0x96')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x9933('0x42'),_0x9933('0x97')],'where':_0x2be0e8[_0x9933('0x4c')][_0x9933('0x98')]?{'id':_0x2be0e8[_0x9933('0x4c')][_0x9933('0x98')]}:undefined,'required':_0x2be0e8['query'][_0x9933('0x98')]?!![]:![]}];}return db[_0x9933('0x91')][_0x9933('0x5d')](_0x5dc072);})['then'](function(_0x16c835){_0x44c628[_0x9933('0x5e')]=_0x16c835;return _0x44c628;});}})['then'](respondWithFilteredResult(_0x4f5d36,_0x5dc072))[_0x9933('0x2f')](handleError(_0x4f5d36,null));};exports[_0x9933('0x99')]=function(_0x269d4e,_0x2b5304,_0x7fcbae){return db['MailAccount'][_0x9933('0x6c')]({'where':{'id':_0x269d4e[_0x9933('0x60')]['id']}})['then'](handleEntityNotFound(_0x2b5304,null))[_0x9933('0x25')](function(_0x5c5912){if(_0x5c5912){return db[_0x9933('0x9a')][_0x9933('0x9b')](function(_0x1fba15){return db['MailApplication'][_0x9933('0x40')]({'where':{'MailAccountId':_0x269d4e[_0x9933('0x60')]['id']},'transaction':_0x1fba15})['then'](function(_0x4b9689){var _0x2a23f9=_[_0x9933('0x48')](_0x269d4e['body'],function(_0x5af03a){_0x5af03a[_0x9933('0x68')]=_0x269d4e[_0x9933('0x60')]['id'];return _0x5af03a;});return db[_0x9933('0x9c')][_0x9933('0x9d')](_0x2a23f9,{'transaction':_0x1fba15});});})[_0x9933('0x25')](function(){return db[_0x9933('0x9c')][_0x9933('0x9e')]({'where':{'MailAccountId':_0x269d4e[_0x9933('0x60')]['id']},'order':_0x9933('0x9f')});});}})['then'](respondWithResult(_0x2b5304,null))[_0x9933('0x2f')](handleError(_0x2b5304,null));};exports['getApplications']=function(_0x191f70,_0x42d19d,_0x2fec46){var _0x1e0dd9={};var _0x33be62={};var _0x232373;var _0x39eb6b;return db[_0x9933('0x49')]['findOne']({'where':{'id':_0x191f70[_0x9933('0x60')]['id']}})[_0x9933('0x25')](handleEntityNotFound(_0x42d19d,null))[_0x9933('0x25')](function(_0x56570a){if(_0x56570a){_0x232373=_0x56570a;_0x33be62[_0x9933('0x4b')]=_[_0x9933('0x4d')](db[_0x9933('0x9c')]['rawAttributes']);_0x33be62[_0x9933('0x4c')]=_['keys'](_0x191f70[_0x9933('0x4c')]);_0x33be62[_0x9933('0x4e')]=_['intersection'](_0x33be62[_0x9933('0x4b')],_0x33be62['query']);_0x1e0dd9[_0x9933('0x50')]=_[_0x9933('0x4f')](_0x33be62[_0x9933('0x4b')],qs[_0x9933('0x51')](_0x191f70[_0x9933('0x4c')]['fields']));_0x1e0dd9[_0x9933('0x50')]=_0x1e0dd9['attributes'][_0x9933('0x63')]?_0x1e0dd9[_0x9933('0x50')]:_0x33be62[_0x9933('0x4b')];_0x1e0dd9[_0x9933('0x54')]=qs[_0x9933('0x6d')](_0x191f70['query'][_0x9933('0x6d')]);_0x1e0dd9['where']=qs[_0x9933('0x4e')](_['pick'](_0x191f70[_0x9933('0x4c')],_0x33be62['filters']));if(_0x191f70[_0x9933('0x4c')][_0x9933('0x57')]){_0x1e0dd9[_0x9933('0x55')]=_[_0x9933('0x58')](_0x1e0dd9[_0x9933('0x55')],{'$or':_[_0x9933('0x48')](_0x1e0dd9['attributes'],function(_0x28e77f){var _0x41c44f={};_0x41c44f[_0x28e77f]={'$like':'%'+_0x191f70['query'][_0x9933('0x57')]+'%'};return _0x41c44f;})});}_0x1e0dd9=_['merge']({},_0x1e0dd9,_0x191f70[_0x9933('0x5a')]);return _0x232373[_0x9933('0xa0')](_0x1e0dd9);}})['then'](function(_0x5d539a){if(_0x5d539a){_0x39eb6b=_0x5d539a[_0x9933('0x63')];if(!_0x191f70[_0x9933('0x4c')][_0x9933('0x52')](_0x9933('0x53'))){_0x1e0dd9['limit']=qs[_0x9933('0x35')](_0x191f70[_0x9933('0x4c')][_0x9933('0x35')]);_0x1e0dd9[_0x9933('0x33')]=qs[_0x9933('0x33')](_0x191f70[_0x9933('0x4c')]['offset']);}return _0x232373['getApplications'](_0x1e0dd9);}})[_0x9933('0x25')](function(_0x30d5da){if(_0x30d5da){return _0x30d5da?{'count':_0x39eb6b,'rows':_0x30d5da}:null;}})[_0x9933('0x25')](respondWithResult(_0x42d19d,null))['catch'](handleError(_0x42d19d,null));};exports['getMessages']=function(_0x18469c,_0x187d9b,_0x3b35ce){var _0x3dbb3f={'raw':!![],'where':{}};var _0x3094df={};var _0x3a4209={'count':0x0,'rows':[]};return db[_0x9933('0x49')]['findOne']({'where':{'id':_0x18469c[_0x9933('0x60')]['id']}})[_0x9933('0x25')](handleEntityNotFound(_0x187d9b,null))[_0x9933('0x25')](function(_0x1a9e7c){if(_0x1a9e7c){_0x3094df[_0x9933('0x4b')]=_[_0x9933('0x4d')](db[_0x9933('0xa1')][_0x9933('0x62')]);_0x3094df['query']=_['keys'](_0x18469c[_0x9933('0x4c')]);_0x3094df['filters']=_[_0x9933('0x4f')](_0x3094df[_0x9933('0x4b')],_0x3094df['query']);_0x3dbb3f[_0x9933('0x50')]=_['intersection'](_0x3094df[_0x9933('0x4b')],qs[_0x9933('0x51')](_0x18469c['query']['fields']));_0x3dbb3f[_0x9933('0x50')]=_0x3dbb3f[_0x9933('0x50')][_0x9933('0x63')]?_0x3dbb3f['attributes']:_0x3094df[_0x9933('0x4b')];if(!_0x18469c['query'][_0x9933('0x52')](_0x9933('0x53'))){_0x3dbb3f[_0x9933('0x35')]=qs[_0x9933('0x35')](_0x18469c[_0x9933('0x4c')][_0x9933('0x35')]);_0x3dbb3f['offset']=qs['offset'](_0x18469c[_0x9933('0x4c')]['offset']);}_0x3dbb3f[_0x9933('0x54')]=qs[_0x9933('0x6d')](_0x18469c['query'][_0x9933('0x6d')]);_0x3dbb3f['where']=qs[_0x9933('0x4e')](_[_0x9933('0x56')](_0x18469c[_0x9933('0x4c')],_0x3094df[_0x9933('0x4e')]));_0x3dbb3f['where']['MailAccountId']=_0x1a9e7c['id'];if(_0x18469c[_0x9933('0x4c')][_0x9933('0x57')]){_0x3dbb3f[_0x9933('0x55')]=_[_0x9933('0x58')](_0x3dbb3f[_0x9933('0x55')],{'$or':_['map'](_0x3dbb3f['attributes'],function(_0x2f50e2){var _0x2f4989={};_0x2f4989[_0x2f50e2]={'$like':'%'+_0x18469c[_0x9933('0x4c')][_0x9933('0x57')]+'%'};return _0x2f4989;})});}if(_0x18469c['query']['$gte']){var _0x8a1b51=_0x18469c['query'][_0x9933('0xa2')][_0x9933('0xa3')](',');var _0x335df4={};_0x335df4[_0x8a1b51[0x0]]={'$gte':moment(_0x8a1b51[0x1])[_0x9933('0xa4')](_0x9933('0xa5'))};_0x3dbb3f['where']=_['merge'](_0x3dbb3f[_0x9933('0x55')],_0x335df4);}_0x3dbb3f=_[_0x9933('0x58')]({},_0x3dbb3f,_0x18469c['options']);return db['MailMessage']['count']({'where':_0x3dbb3f['where']})[_0x9933('0x25')](function(_0x2a1993){_0x3a4209['count']=_0x2a1993;if(_0x18469c[_0x9933('0x4c')][_0x9933('0x5b')]){_0x3dbb3f[_0x9933('0x5c')]=[{'all':!![]}];}return db[_0x9933('0xa1')][_0x9933('0x5d')](_0x3dbb3f);})[_0x9933('0x25')](function(_0x5ebc30){if(_0x18469c[_0x9933('0x4c')][_0x9933('0xa6')]==='true'){for(var _0x280b46=0x0;_0x280b46<_0x5ebc30['length'];_0x280b46++){_0x5ebc30[_0x280b46][_0x9933('0x64')]=juice(_0x5ebc30[_0x280b46]['body']);}}_0x3a4209[_0x9933('0x5e')]=_0x5ebc30;return _0x3a4209;});}})[_0x9933('0x25')](respondWithFilteredResult(_0x187d9b,_0x3dbb3f))[_0x9933('0x2f')](handleError(_0x187d9b,null));};exports[_0x9933('0xa7')]=function(_0x1210e3,_0x5b82af,_0x27cb03){var _0x5a27f3,_0x2fd0ba={},_0x527f8c;if(_0x1210e3[_0x9933('0x64')]['to']){_0x527f8c=_0x1210e3[_0x9933('0x64')]['to'][_0x9933('0xa3')](',')[0x0];}return db[_0x9933('0x49')][_0x9933('0x67')]({'where':{'id':_0x1210e3[_0x9933('0x60')]['id']},'include':[{'model':db['CmList'],'as':_0x9933('0xa8'),'include':[{'model':db[_0x9933('0x92')],'as':_0x9933('0xa9'),'where':{'email':_0x527f8c},'limit':0x1,'order':[[_0x9933('0xaa'),_0x9933('0xab')]]}]},{'model':db['MailServerOut'],'as':_0x9933('0x61'),'raw':!![]}]})['then'](handleEntityNotFound(_0x5b82af,null))[_0x9933('0x25')](function(_0x1f84ea){if(_0x1f84ea){_0x5a27f3=_0x1f84ea;if(_0x1f84ea[_0x9933('0x61')]){if(_[_0x9933('0x74')](_0x1210e3[_0x9933('0x64')]['from'])){_0x1210e3[_0x9933('0x64')][_0x9933('0xac')]=util[_0x9933('0xa4')]('%s\x20<%s>',_0x1f84ea['name'],_0x1f84ea[_0x9933('0x73')]||_0x1f84ea['Smtp'][_0x9933('0x79')]);}if(_0x1210e3[_0x9933('0x64')]['attachments']&&_0x1210e3['body'][_0x9933('0xad')][_0x9933('0x63')]){for(var _0x1090be=0x0;_0x1090be<_0x1210e3[_0x9933('0x64')]['attachments'][_0x9933('0x63')];_0x1090be+=0x1){_0x1210e3['body'][_0x9933('0xad')][_0x1090be]={'filename':_0x1210e3[_0x9933('0x64')][_0x9933('0xad')][_0x1090be][_0x9933('0x42')],'path':path[_0x9933('0xae')](config[_0x9933('0xaf')],_0x9933('0xb0'),_0x1210e3[_0x9933('0x64')][_0x9933('0xad')][_0x1090be]['basename'])};}}var _0x492722={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x1f84ea[_0x9933('0x61')][_0x9933('0x80')])){if(_0x1f84ea[_0x9933('0x61')][_0x9933('0x7d')]){_0x492722[_0x9933('0xb1')]={'user':_0x1f84ea[_0x9933('0x61')][_0x9933('0x79')],'pass':_0x1f84ea['Smtp'][_0x9933('0x7b')]};}_0x492722[_0x9933('0x7e')]=_0x1f84ea[_0x9933('0x61')][_0x9933('0x7e')];_0x492722[_0x9933('0x7f')]=_0x1f84ea[_0x9933('0x61')][_0x9933('0x7f')];_0x492722[_0x9933('0xb2')]=_0x1f84ea[_0x9933('0x61')][_0x9933('0xb2')];}else{_0x492722[_0x9933('0x80')]=_0x1f84ea[_0x9933('0x61')][_0x9933('0x80')];_0x492722['auth']={'user':_0x1f84ea[_0x9933('0x61')][_0x9933('0x79')],'pass':_0x1f84ea['Smtp'][_0x9933('0x7b')]};}return respondWithRpcPromise('SendMail',_0x9933('0xb3'),{'account':_0x492722,'message':_0x1210e3[_0x9933('0x64')]});}else{throw new Error('List\x20not\x20found');}}})[_0x9933('0x25')](function(_0x4b220c){if(_0x4b220c){_0x2fd0ba=_0x4b220c;if(_0x5a27f3['List']){if(_0x5a27f3[_0x9933('0xa8')]['Contacts']['length']){return _0x5a27f3[_0x9933('0xa8')]['Contacts'][0x0];}else{return db[_0x9933('0x92')][_0x9933('0x6a')](_[_0x9933('0x1e')](_0x1210e3[_0x9933('0x64')],{'firstName':_0x1210e3[_0x9933('0x64')]['to'],'email':_0x1210e3['body']['to'],'phone':_0x1210e3['body']['to'],'ListId':_0x5a27f3[_0x9933('0xb4')]}));}}else{throw new Error(_0x9933('0xb5'));}}})[_0x9933('0x25')](function(_0x45690b){if(_0x45690b){var _0xe633be={'UserId':_0x1210e3[_0x9933('0x79')]['id'],'ContactId':_0x45690b['id'],'MailAccountId':_0x5a27f3['id'],'inReplyTo':_0x2fd0ba[_0x9933('0xb6')],'to':_0x1210e3[_0x9933('0x64')][_0x9933('0xac')],'cc':_0x1210e3[_0x9933('0x64')]['cc'],'subject':_0x1210e3[_0x9933('0x64')]['subject'],'attach':_0x1210e3[_0x9933('0x64')][_0x9933('0xb7')],'firstMsgDirection':_0x9933('0xb8'),'lastMsgAt':moment()[_0x9933('0xa4')](_0x9933('0xa5')),'lastMsgDirection':_0x9933('0xb8'),'Messages':[_[_0x9933('0x58')](_0x1210e3['body'],{'messageId':_0x2fd0ba['messageId'],'sentAt':moment()['format'](_0x9933('0xa5')),'read':!![],'MailAccountId':_0x5a27f3['id'],'UserId':_0x1210e3['user']['id'],'ContactId':_0x45690b['id']})]};if(_0x1210e3['body'][_0x9933('0xb9')]){_0xe633be=_['merge'](_0xe633be,_0x1210e3['body']['Interaction']);}return db[_0x9933('0x91')][_0x9933('0x6a')](_0xe633be,{'include':[{'model':db[_0x9933('0xa1')],'as':'Messages'}]});}})[_0x9933('0x25')](respondWithResult(_0x5b82af,null))['catch'](handleError(_0x5b82af,null));};exports[_0x9933('0xba')]=function(_0x5f173b,_0x23dcb3,_0xfc6dcb){return db[_0x9933('0x49')][_0x9933('0x67')]({'where':{'id':_0x5f173b['params']['id']},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]})[_0x9933('0x25')](handleEntityNotFound(_0x23dcb3,null))['then'](function(_0x2494e0){if(_0x2494e0&&_0x2494e0['Smtp']){var _0x3a0d35={'id':_0x2494e0['id'],'tls':{'rejectUnauthorized':![]}};if(_0x2494e0[_0x9933('0x61')][_0x9933('0x80')]){_0x3a0d35[_0x9933('0x80')]=_0x2494e0[_0x9933('0x61')]['service'];}else{_0x3a0d35[_0x9933('0x7e')]=_0x2494e0[_0x9933('0x61')]['host'];_0x3a0d35[_0x9933('0x7f')]=_0x2494e0[_0x9933('0x61')][_0x9933('0x7f')];_0x3a0d35[_0x9933('0xb2')]=_0x2494e0[_0x9933('0x61')][_0x9933('0xb2')];}if(_0x2494e0[_0x9933('0x61')]['authentication']){_0x3a0d35[_0x9933('0xb1')]={'user':_0x2494e0[_0x9933('0x61')][_0x9933('0x79')],'pass':_0x2494e0[_0x9933('0x61')][_0x9933('0x7b')]};}return respondWithRpcPromise('VerifySmtp','verifySmtp',{'account':_0x3a0d35});}})[_0x9933('0x25')](respondWithResult(_0x23dcb3,null))[_0x9933('0x2f')](handleError(_0x23dcb3,null));};exports[_0x9933('0x40')]=function(_0x356148,_0x35d9e4){return db[_0x9933('0x49')][_0x9933('0x67')]({'where':{'id':_0x356148[_0x9933('0x60')]['id']}})[_0x9933('0x25')](handleEntityNotFound(_0x35d9e4,null))[_0x9933('0x25')](function(_0x58cb2a){if(_0x58cb2a&&_0x58cb2a[_0x9933('0x80')]){throw new db[(_0x9933('0xbb'))][(_0x9933('0xbc'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x58cb2a;})['then'](removeEntity(_0x35d9e4,null))[_0x9933('0x2f')](handleError(_0x35d9e4,null));};exports[_0x9933('0xbd')]=function(_0x2013fd,_0x5bc8f7,_0x113c61){return db['MailAccount'][_0x9933('0x67')]({'where':{'id':_0x2013fd['params']['id']}})[_0x9933('0x25')](handleEntityNotFound(_0x5bc8f7,null))[_0x9933('0x25')](function(_0x4f7c4c){if(_0x4f7c4c){return _0x4f7c4c[_0x9933('0xbd')](_0x2013fd['body']['ids'],_[_0x9933('0x8f')](_0x2013fd[_0x9933('0x64')],['ids','id'])||{})[_0x9933('0xbe')](function(_0x1e31bf){for(var _0x2369ef=0x0;_0x2369ef<_0x2013fd[_0x9933('0x64')]['ids'][_0x9933('0x63')];_0x2369ef+=0x1){socket['emit']('userMailAccount:save',{'UserId':Number(_0x2013fd[_0x9933('0x64')][_0x9933('0x72')][_0x2369ef]),'MailAccountId':Number(_0x2013fd['params']['id'])});}return _0x1e31bf;});}})['then'](respondWithResult(_0x5bc8f7,null))[_0x9933('0x2f')](handleError(_0x5bc8f7,null));};exports[_0x9933('0xbf')]=function(_0x37f3c6,_0x433bf3,_0x2185df){return db[_0x9933('0x49')]['find']({'where':{'id':_0x37f3c6[_0x9933('0x60')]['id']}})[_0x9933('0x25')](handleEntityNotFound(_0x433bf3,null))[_0x9933('0x25')](function(_0x4612fa){if(_0x4612fa){return _0x4612fa[_0x9933('0xbf')](_0x37f3c6[_0x9933('0x4c')][_0x9933('0x72')])[_0x9933('0x25')](function(){if(_['isArray'](_0x37f3c6[_0x9933('0x4c')]['ids'])){for(var _0x496a5e=0x0;_0x496a5e<_0x37f3c6[_0x9933('0x4c')][_0x9933('0x72')][_0x9933('0x63')];_0x496a5e+=0x1){socket[_0x9933('0xc0')](_0x9933('0xc1'),{'UserId':Number(_0x37f3c6[_0x9933('0x4c')]['ids'][_0x496a5e]),'MailAccountId':Number(_0x37f3c6[_0x9933('0x60')]['id'])});}}else{socket[_0x9933('0xc0')](_0x9933('0xc1'),{'UserId':Number(_0x37f3c6['query'][_0x9933('0x72')]),'MailAccountId':Number(_0x37f3c6[_0x9933('0x60')]['id'])});}});}})[_0x9933('0x25')](respondWithStatusCode(_0x433bf3,null))['catch'](handleError(_0x433bf3,null));};exports['getAgents']=function(_0x29064e,_0x386055,_0x418212){var _0x2d4a9d={};var _0x19a6f7={};var _0x1fe2d7;var _0x4b9130;return db['MailAccount']['findOne']({'where':{'id':_0x29064e[_0x9933('0x60')]['id']}})[_0x9933('0x25')](handleEntityNotFound(_0x386055,null))[_0x9933('0x25')](function(_0x420c51){if(_0x420c51){_0x1fe2d7=_0x420c51;_0x19a6f7[_0x9933('0x4b')]=_[_0x9933('0x4d')](db['User'][_0x9933('0x62')]);_0x19a6f7['query']=_[_0x9933('0x4d')](_0x29064e['query']);_0x19a6f7[_0x9933('0x4e')]=_[_0x9933('0x4f')](_0x19a6f7[_0x9933('0x4b')],_0x19a6f7[_0x9933('0x4c')]);_0x2d4a9d[_0x9933('0x50')]=_[_0x9933('0x4f')](_0x19a6f7[_0x9933('0x4b')],qs['fields'](_0x29064e[_0x9933('0x4c')]['fields']));_0x2d4a9d[_0x9933('0x50')]=_0x2d4a9d[_0x9933('0x50')][_0x9933('0x63')]?_0x2d4a9d['attributes']:_0x19a6f7[_0x9933('0x4b')];_0x2d4a9d[_0x9933('0x54')]=qs[_0x9933('0x6d')](_0x29064e[_0x9933('0x4c')]['sort']);_0x2d4a9d[_0x9933('0x55')]=qs[_0x9933('0x4e')](_[_0x9933('0x56')](_0x29064e[_0x9933('0x4c')],_0x19a6f7[_0x9933('0x4e')]));if(_0x29064e[_0x9933('0x4c')][_0x9933('0x57')]){_0x2d4a9d[_0x9933('0x55')]=_[_0x9933('0x58')](_0x2d4a9d[_0x9933('0x55')],{'$or':_['map'](_0x2d4a9d[_0x9933('0x50')],function(_0x14571d){var _0x5270de={};_0x5270de[_0x14571d]={'$like':'%'+_0x29064e['query'][_0x9933('0x57')]+'%'};return _0x5270de;})});}_0x2d4a9d=_[_0x9933('0x58')]({},_0x2d4a9d,_0x29064e[_0x9933('0x5a')]);return _0x1fe2d7[_0x9933('0xc2')](_0x2d4a9d);}})[_0x9933('0x25')](function(_0x5f311f){if(_0x5f311f){_0x4b9130=_0x5f311f[_0x9933('0x63')];if(!_0x29064e['query'][_0x9933('0x52')](_0x9933('0x53'))){_0x2d4a9d[_0x9933('0x35')]=qs['limit'](_0x29064e['query'][_0x9933('0x35')]);_0x2d4a9d[_0x9933('0x33')]=qs[_0x9933('0x33')](_0x29064e[_0x9933('0x4c')][_0x9933('0x33')]);}return _0x1fe2d7['getAgents'](_0x2d4a9d);}})[_0x9933('0x25')](function(_0x4d83d9){if(_0x4d83d9){return _0x4d83d9?{'count':_0x4b9130,'rows':_0x4d83d9}:null;}})[_0x9933('0x25')](respondWithResult(_0x386055,null))[_0x9933('0x2f')](handleError(_0x386055,null));}; \ No newline at end of file +var _0xa450=['papaparse','html-to-text','juice','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','./mailAccount.socket','register','http','then','info','MailAccount,\x20%s,\x20%s','debug','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','destroy','get','MailAccounts','UserProfileResource','stack','name','send','index','MailServerOut','Smtp','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','MailServerIn','Imap','length','find','update','body','params','describe','create','getDispositions','Disposition','order','MailAccountId','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','key','email','isNil','active','description','cauthentication','user','password','authentication','host','port','service','cservice','cuser','pass','cpassword','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','removeSmtp','MailInteraction','addInteraction','omit','getInteractions','CmContact','Contact','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','format','split','Contacts','updatedAt','DESC','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','auth','secure','SendMail','List\x20not\x20found','List','subject','attach','out','YYYY-MM-DD\x20HH:mm:ss','Messages','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','querystring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa450,0x176));var _0x0a45=function(_0x2ad980,_0x22ba69){_0x2ad980=_0x2ad980-0x0;var _0x54f7d1=_0xa450[_0x2ad980];return _0x54f7d1;};'use strict';var emlformat=require(_0x0a45('0x0'));var rimraf=require(_0x0a45('0x1'));var zipdir=require(_0x0a45('0x2'));var jsonpatch=require(_0x0a45('0x3'));var rp=require(_0x0a45('0x4'));var moment=require(_0x0a45('0x5'));var BPromise=require(_0x0a45('0x6'));var Mustache=require(_0x0a45('0x7'));var util=require(_0x0a45('0x8'));var path=require(_0x0a45('0x9'));var sox=require('sox');var csv=require(_0x0a45('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a45('0xb'));var _=require(_0x0a45('0xc'));var squel=require(_0x0a45('0xd'));var crypto=require('crypto');var jsforce=require(_0x0a45('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0a45('0xa'));var querystring=require(_0x0a45('0xf'));var Papa=require(_0x0a45('0x10'));var htmlToText=require(_0x0a45('0x11'));var juice=require(_0x0a45('0x12'));var Redis=require(_0x0a45('0x13'));var authService=require(_0x0a45('0x14'));var qs=require(_0x0a45('0x15'));var as=require(_0x0a45('0x16'));var hardwareService=require(_0x0a45('0x17'));var logger=require(_0x0a45('0x18'))(_0x0a45('0x19'));var utils=require(_0x0a45('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x0a45('0x1b'));var db=require(_0x0a45('0x1c'))['db'];config['redis']=_[_0x0a45('0x1d')](config[_0x0a45('0x1e')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a45('0x1f'))[_0x0a45('0x20')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x0a45('0x21')]({'port':0x232b});function respondWithRpcPromise(_0x4badb4,_0x18231b,_0x37e9bc,_0x28e8ef){return new BPromise(function(_0xab6e1a,_0x573dd5){var _0x47ac71=_0x28e8ef||client;return _0x47ac71['request'](_0x4badb4,_0x37e9bc)[_0x0a45('0x22')](function(_0x3e32a3){logger[_0x0a45('0x23')](_0x0a45('0x24'),_0x18231b,'request\x20sent');logger[_0x0a45('0x25')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x18231b,'request\x20sent',JSON[_0x0a45('0x26')](_0x3e32a3));if(_0x3e32a3[_0x0a45('0x27')]){if(_0x3e32a3[_0x0a45('0x27')][_0x0a45('0x28')]===0x1f4){logger[_0x0a45('0x27')](_0x0a45('0x24'),_0x18231b,_0x3e32a3[_0x0a45('0x27')]['message']);return _0x573dd5(_0x3e32a3['error'][_0x0a45('0x29')]);}logger[_0x0a45('0x27')](_0x0a45('0x24'),_0x18231b,_0x3e32a3[_0x0a45('0x27')][_0x0a45('0x29')]);return _0xab6e1a(_0x3e32a3['error']['message']);}else{logger[_0x0a45('0x23')](_0x0a45('0x24'),_0x18231b,'request\x20sent');_0xab6e1a(_0x3e32a3[_0x0a45('0x2a')][_0x0a45('0x29')]);}})[_0x0a45('0x2b')](function(_0x4b454f){logger[_0x0a45('0x27')](_0x0a45('0x24'),_0x18231b,_0x4b454f);_0x573dd5(_0x4b454f);});});}function respondWithStatusCode(_0x2a1523,_0x1206ac){_0x1206ac=_0x1206ac||0xcc;return function(_0x68d6d2){if(_0x68d6d2){return _0x2a1523[_0x0a45('0x2c')](_0x1206ac);}return _0x2a1523['status'](_0x1206ac)[_0x0a45('0x2d')]();};}function respondWithResult(_0x3d6236,_0x19a393){_0x19a393=_0x19a393||0xc8;return function(_0x50cee5){if(_0x50cee5){return _0x3d6236[_0x0a45('0x2e')](_0x19a393)[_0x0a45('0x2f')](_0x50cee5);}};}function respondWithFilteredResult(_0x10fe2a,_0x47d242){return function(_0x40150a){if(_0x40150a){var _0x221142=typeof _0x47d242[_0x0a45('0x30')]===_0x0a45('0x31')&&typeof _0x47d242['limit']==='undefined';var _0x1c0625=_0x40150a[_0x0a45('0x32')];var _0x425312=_0x221142?0x0:_0x47d242[_0x0a45('0x30')];var _0x186b6c=_0x221142?_0x40150a[_0x0a45('0x32')]:_0x47d242[_0x0a45('0x30')]+_0x47d242[_0x0a45('0x33')];var _0x2e0d30;if(_0x186b6c>=_0x1c0625){_0x186b6c=_0x1c0625;_0x2e0d30=0xc8;}else{_0x2e0d30=0xce;}_0x10fe2a[_0x0a45('0x2e')](_0x2e0d30);return _0x10fe2a[_0x0a45('0x34')](_0x0a45('0x35'),_0x425312+'-'+_0x186b6c+'/'+_0x1c0625)[_0x0a45('0x2f')](_0x40150a);}return null;};}function patchUpdates(_0x4a9f7e){return function(_0x2c50c6){try{jsonpatch[_0x0a45('0x36')](_0x2c50c6,_0x4a9f7e,!![]);}catch(_0x31761a){return BPromise['reject'](_0x31761a);}return _0x2c50c6['save']();};}function saveUpdates(_0x1cb5e3,_0xf8eb95){return function(_0x1b4d9c){if(_0x1b4d9c){return _0x1b4d9c['update'](_0x1cb5e3)[_0x0a45('0x22')](function(_0x4b8ca1){return _0x4b8ca1;});}return null;};}function removeEntity(_0x1331ac,_0x2f68a0){return function(_0x1d2822){if(_0x1d2822){return _0x1d2822[_0x0a45('0x37')]()[_0x0a45('0x22')](function(){var _0x5a0071=_0x1d2822[_0x0a45('0x38')]({'plain':!![]});var _0x350ec0=_0x0a45('0x39');return db[_0x0a45('0x3a')][_0x0a45('0x37')]({'where':{'type':_0x350ec0,'resourceId':_0x5a0071['id']}})['then'](function(){return _0x1d2822;});})[_0x0a45('0x22')](function(){_0x1331ac[_0x0a45('0x2e')](0xcc)[_0x0a45('0x2d')]();});}};}function handleEntityNotFound(_0xdb8534,_0x4d1913){return function(_0x2f3146){if(!_0x2f3146){_0xdb8534[_0x0a45('0x2c')](0x194);}return _0x2f3146;};}function handleError(_0x5ae995,_0x507c10){_0x507c10=_0x507c10||0x1f4;return function(_0x1c7219){logger[_0x0a45('0x27')](_0x1c7219[_0x0a45('0x3b')]);if(_0x1c7219[_0x0a45('0x3c')]){delete _0x1c7219[_0x0a45('0x3c')];}_0x5ae995[_0x0a45('0x2e')](_0x507c10)[_0x0a45('0x3d')](_0x1c7219);};}exports[_0x0a45('0x3e')]=function(_0x537946,_0x2fd471){var _0x3c2b5e={'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0x0a45('0x3f')],'as':_0x0a45('0x40')},{'model':db[_0x0a45('0x41')],'as':_0x0a45('0x42')}]},_0x32bf93={},_0x4b17ac={'count':0x0,'rows':[]};var _0x85b3c6=_[_0x0a45('0x43')](db[_0x0a45('0x44')][_0x0a45('0x45')],function(_0x37d5b0){return{'name':_0x37d5b0['fieldName'],'type':_0x37d5b0[_0x0a45('0x46')]['key']};});_0x32bf93[_0x0a45('0x47')]=_['map'](_0x85b3c6,_0x0a45('0x3c'));_0x32bf93[_0x0a45('0x48')]=_[_0x0a45('0x49')](_0x537946['query']);_0x32bf93[_0x0a45('0x4a')]=_[_0x0a45('0x4b')](_0x32bf93[_0x0a45('0x47')],_0x32bf93[_0x0a45('0x48')]);_0x3c2b5e[_0x0a45('0x4c')]=_['intersection'](_0x32bf93[_0x0a45('0x47')],qs[_0x0a45('0x4d')](_0x537946[_0x0a45('0x48')][_0x0a45('0x4d')]));_0x3c2b5e[_0x0a45('0x4c')]=_0x3c2b5e[_0x0a45('0x4c')]['length']?_0x3c2b5e[_0x0a45('0x4c')]:_0x32bf93[_0x0a45('0x47')];if(!_0x537946[_0x0a45('0x48')][_0x0a45('0x4e')](_0x0a45('0x4f'))){_0x3c2b5e[_0x0a45('0x33')]=qs['limit'](_0x537946[_0x0a45('0x48')][_0x0a45('0x33')]);_0x3c2b5e['offset']=qs[_0x0a45('0x30')](_0x537946[_0x0a45('0x48')][_0x0a45('0x30')]);}_0x3c2b5e['order']=qs[_0x0a45('0x50')](_0x537946['query'][_0x0a45('0x50')]);_0x3c2b5e[_0x0a45('0x51')]=qs[_0x0a45('0x4a')](_[_0x0a45('0x52')](_0x537946['query'],_0x32bf93[_0x0a45('0x4a')]),_0x85b3c6);if(_0x537946[_0x0a45('0x48')][_0x0a45('0x53')]){_0x3c2b5e[_0x0a45('0x51')]=_[_0x0a45('0x54')](_0x3c2b5e[_0x0a45('0x51')],{'$or':_[_0x0a45('0x43')](_0x85b3c6,function(_0x22fd97){if(_0x22fd97[_0x0a45('0x46')]!==_0x0a45('0x55')){var _0x3d1517={};_0x3d1517[_0x22fd97[_0x0a45('0x3c')]]={'$like':'%'+_0x537946[_0x0a45('0x48')][_0x0a45('0x53')]+'%'};return _0x3d1517;}})});}_0x3c2b5e=_[_0x0a45('0x54')]({},_0x3c2b5e,_0x537946[_0x0a45('0x56')]);var _0x1a169d={'where':_0x3c2b5e[_0x0a45('0x51')]};return db['MailAccount']['count'](_0x1a169d)['then'](function(_0x45311c){_0x4b17ac[_0x0a45('0x32')]=_0x45311c;if(_0x537946[_0x0a45('0x48')][_0x0a45('0x57')]){_0x3c2b5e[_0x0a45('0x58')]=[{'all':!![]}];}return db[_0x0a45('0x44')][_0x0a45('0x59')](_0x3c2b5e);})[_0x0a45('0x22')](function(_0x486964){_0x4b17ac['rows']=_0x486964;return _0x4b17ac;})[_0x0a45('0x22')](respondWithFilteredResult(_0x2fd471,_0x3c2b5e))[_0x0a45('0x2b')](handleError(_0x2fd471,null));};exports[_0x0a45('0x5a')]=function(_0x203903,_0x234c13){var _0x4987d8={'raw':![],'where':{'id':_0x203903['params']['id']},'include':[{'model':db[_0x0a45('0x5b')],'as':_0x0a45('0x5c')},{'model':db[_0x0a45('0x3f')],'as':'Smtp'},{'model':db[_0x0a45('0x41')],'as':_0x0a45('0x42')}]},_0x4cebd7={};_0x4cebd7['model']=_['keys'](db['MailAccount'][_0x0a45('0x45')]);_0x4cebd7[_0x0a45('0x48')]=_[_0x0a45('0x49')](_0x203903[_0x0a45('0x48')]);_0x4cebd7[_0x0a45('0x4a')]=_[_0x0a45('0x4b')](_0x4cebd7[_0x0a45('0x47')],_0x4cebd7[_0x0a45('0x48')]);_0x4987d8['attributes']=_[_0x0a45('0x4b')](_0x4cebd7[_0x0a45('0x47')],qs[_0x0a45('0x4d')](_0x203903['query'][_0x0a45('0x4d')]));_0x4987d8['attributes']=_0x4987d8[_0x0a45('0x4c')][_0x0a45('0x5d')]?_0x4987d8[_0x0a45('0x4c')]:_0x4cebd7[_0x0a45('0x47')];if(_0x203903[_0x0a45('0x48')][_0x0a45('0x57')]){_0x4987d8[_0x0a45('0x58')]=[{'all':!![]}];}_0x4987d8=_[_0x0a45('0x54')]({},_0x4987d8,_0x203903['options']);return db[_0x0a45('0x44')][_0x0a45('0x5e')](_0x4987d8)[_0x0a45('0x22')](handleEntityNotFound(_0x234c13,null))[_0x0a45('0x22')](respondWithResult(_0x234c13,null))['catch'](handleError(_0x234c13,null));};exports[_0x0a45('0x5f')]=function(_0x43c09a,_0x15608d){if(_0x43c09a[_0x0a45('0x60')]['id']){delete _0x43c09a[_0x0a45('0x60')]['id'];}return db[_0x0a45('0x44')][_0x0a45('0x5e')]({'where':{'id':_0x43c09a[_0x0a45('0x61')]['id']},'include':[{'model':db[_0x0a45('0x5b')],'as':_0x0a45('0x5c')},{'model':db[_0x0a45('0x3f')],'as':_0x0a45('0x40')},{'model':db[_0x0a45('0x41')],'as':_0x0a45('0x42')}]})[_0x0a45('0x22')](handleEntityNotFound(_0x15608d,null))[_0x0a45('0x22')](saveUpdates(_0x43c09a[_0x0a45('0x60')],null))['then'](function(_0x2bb12f){if(_0x2bb12f&&_0x43c09a['body'][_0x0a45('0x5c')]){return db[_0x0a45('0x5b')][_0x0a45('0x5f')](_0x43c09a[_0x0a45('0x60')][_0x0a45('0x5c')],{'where':{'MailAccountId':_0x2bb12f['id']}})[_0x0a45('0x22')](function(){return _0x2bb12f;});}return _0x2bb12f;})[_0x0a45('0x22')](function(_0x170440){if(_0x170440&&_0x43c09a[_0x0a45('0x60')][_0x0a45('0x40')]){return db['MailServerOut'][_0x0a45('0x5f')](_0x43c09a['body'][_0x0a45('0x40')],{'where':{'MailAccountId':_0x170440['id']}})[_0x0a45('0x22')](function(){return _0x170440;});}return _0x170440;})[_0x0a45('0x22')](respondWithResult(_0x15608d,null))[_0x0a45('0x2b')](handleError(_0x15608d,null));};exports[_0x0a45('0x62')]=function(_0x3c90f9,_0x2f2a85){return db[_0x0a45('0x44')]['describe']()['then'](respondWithResult(_0x2f2a85,null))[_0x0a45('0x2b')](handleError(_0x2f2a85,null));};exports['addDisposition']=function(_0x4d2a2f,_0x235ae9,_0x4bf5b4){if(_0x4d2a2f[_0x0a45('0x60')]['id']){delete _0x4d2a2f[_0x0a45('0x60')]['id'];}return db[_0x0a45('0x44')]['find']({'where':{'id':_0x4d2a2f['params']['id']}})['then'](handleEntityNotFound(_0x235ae9,null))['then'](function(_0xce8b24){if(_0xce8b24){_0x4d2a2f[_0x0a45('0x60')]['MailAccountId']=_0xce8b24['id'];return db['Disposition'][_0x0a45('0x63')](_0x4d2a2f[_0x0a45('0x60')]);}})['then'](respondWithResult(_0x235ae9,null))[_0x0a45('0x2b')](handleError(_0x235ae9,null));};exports[_0x0a45('0x64')]=function(_0x42d853,_0x483f13,_0x3a4a85){var _0x29b1da={'raw':![],'where':{}};var _0x28813f={};var _0x5c287c={'count':0x0,'rows':[]};return db[_0x0a45('0x44')]['findOne']({'where':{'id':_0x42d853[_0x0a45('0x61')]['id']}})[_0x0a45('0x22')](handleEntityNotFound(_0x483f13,null))[_0x0a45('0x22')](function(_0x44f958){if(_0x44f958){_0x28813f[_0x0a45('0x47')]=_[_0x0a45('0x49')](db[_0x0a45('0x65')][_0x0a45('0x45')]);_0x28813f['query']=_[_0x0a45('0x49')](_0x42d853['query']);_0x28813f[_0x0a45('0x4a')]=_[_0x0a45('0x4b')](_0x28813f['model'],_0x28813f[_0x0a45('0x48')]);_0x29b1da[_0x0a45('0x4c')]=_[_0x0a45('0x4b')](_0x28813f[_0x0a45('0x47')],qs[_0x0a45('0x4d')](_0x42d853['query'][_0x0a45('0x4d')]));_0x29b1da[_0x0a45('0x4c')]=_0x29b1da['attributes'][_0x0a45('0x5d')]?_0x29b1da[_0x0a45('0x4c')]:_0x28813f[_0x0a45('0x47')];if(!_0x42d853[_0x0a45('0x48')]['hasOwnProperty']('nolimit')){_0x29b1da[_0x0a45('0x33')]=qs[_0x0a45('0x33')](_0x42d853[_0x0a45('0x48')]['limit']);_0x29b1da['offset']=qs[_0x0a45('0x30')](_0x42d853[_0x0a45('0x48')][_0x0a45('0x30')]);}_0x29b1da[_0x0a45('0x66')]=qs[_0x0a45('0x50')](_0x42d853[_0x0a45('0x48')][_0x0a45('0x50')]);_0x29b1da['where']=qs[_0x0a45('0x4a')](_[_0x0a45('0x52')](_0x42d853[_0x0a45('0x48')],_0x28813f[_0x0a45('0x4a')]));_0x29b1da['where'][_0x0a45('0x67')]=_0x44f958['id'];if(_0x42d853['query']['filter']){_0x29b1da[_0x0a45('0x51')]=_[_0x0a45('0x54')](_0x29b1da[_0x0a45('0x51')],{'$or':_[_0x0a45('0x43')](_0x29b1da[_0x0a45('0x4c')],function(_0x1295f7){var _0x5acc0f={};_0x5acc0f[_0x1295f7]={'$like':'%'+_0x42d853[_0x0a45('0x48')][_0x0a45('0x53')]+'%'};return _0x5acc0f;})});}_0x29b1da=_[_0x0a45('0x54')]({},_0x29b1da,_0x42d853[_0x0a45('0x56')]);return db[_0x0a45('0x65')][_0x0a45('0x32')]({'where':_0x29b1da['where']})[_0x0a45('0x22')](function(_0x458513){_0x5c287c[_0x0a45('0x32')]=_0x458513;if(_0x42d853[_0x0a45('0x48')][_0x0a45('0x57')]){_0x29b1da[_0x0a45('0x58')]=[{'all':!![]}];}return db[_0x0a45('0x65')][_0x0a45('0x59')](_0x29b1da);})['then'](function(_0x4ef7ab){_0x5c287c[_0x0a45('0x68')]=_0x4ef7ab;return _0x5c287c;});}})[_0x0a45('0x22')](respondWithFilteredResult(_0x483f13,_0x29b1da))[_0x0a45('0x2b')](handleError(_0x483f13,null));};exports[_0x0a45('0x69')]=function(_0x52bad6,_0x48707e,_0x48c15f){return db['MailAccount'][_0x0a45('0x5e')]({'where':{'id':_0x52bad6[_0x0a45('0x61')]['id']}})[_0x0a45('0x22')](handleEntityNotFound(_0x48707e,null))['then'](function(_0x20e301){if(_0x20e301){return _0x20e301['removeDispositions'](_0x52bad6[_0x0a45('0x48')][_0x0a45('0x6a')]);}})['then'](respondWithStatusCode(_0x48707e,null))[_0x0a45('0x2b')](handleError(_0x48707e,null));};exports[_0x0a45('0x6b')]=function(_0x490f11,_0x9c9c29,_0x2955f8){if(_0x490f11[_0x0a45('0x60')]['id']){delete _0x490f11[_0x0a45('0x60')]['id'];}return db[_0x0a45('0x44')][_0x0a45('0x5e')]({'where':{'id':_0x490f11[_0x0a45('0x61')]['id']}})['then'](handleEntityNotFound(_0x9c9c29,null))[_0x0a45('0x22')](function(_0x1814c3){if(_0x1814c3){_0x490f11['body'][_0x0a45('0x67')]=_0x1814c3['id'];return db[_0x0a45('0x6c')][_0x0a45('0x63')](_0x490f11[_0x0a45('0x60')]);}})[_0x0a45('0x22')](respondWithResult(_0x9c9c29,null))[_0x0a45('0x2b')](handleError(_0x9c9c29,null));};exports[_0x0a45('0x6d')]=function(_0x2b0d20,_0x4a84a9,_0x40962c){var _0x258774={'raw':![],'where':{}};var _0x24111e={};var _0x10170e={'count':0x0,'rows':[]};return db[_0x0a45('0x44')][_0x0a45('0x6e')]({'where':{'id':_0x2b0d20[_0x0a45('0x61')]['id']}})['then'](handleEntityNotFound(_0x4a84a9,null))[_0x0a45('0x22')](function(_0x7f360a){if(_0x7f360a){_0x24111e[_0x0a45('0x47')]=_[_0x0a45('0x49')](db[_0x0a45('0x6c')]['rawAttributes']);_0x24111e[_0x0a45('0x48')]=_['keys'](_0x2b0d20['query']);_0x24111e[_0x0a45('0x4a')]=_[_0x0a45('0x4b')](_0x24111e[_0x0a45('0x47')],_0x24111e[_0x0a45('0x48')]);_0x258774[_0x0a45('0x4c')]=_[_0x0a45('0x4b')](_0x24111e[_0x0a45('0x47')],qs[_0x0a45('0x4d')](_0x2b0d20['query'][_0x0a45('0x4d')]));_0x258774['attributes']=_0x258774[_0x0a45('0x4c')][_0x0a45('0x5d')]?_0x258774[_0x0a45('0x4c')]:_0x24111e[_0x0a45('0x47')];if(!_0x2b0d20[_0x0a45('0x48')][_0x0a45('0x4e')](_0x0a45('0x4f'))){_0x258774[_0x0a45('0x33')]=qs['limit'](_0x2b0d20[_0x0a45('0x48')][_0x0a45('0x33')]);_0x258774['offset']=qs[_0x0a45('0x30')](_0x2b0d20[_0x0a45('0x48')][_0x0a45('0x30')]);}_0x258774[_0x0a45('0x66')]=qs['sort'](_0x2b0d20['query'][_0x0a45('0x50')]);_0x258774['where']=qs[_0x0a45('0x4a')](_[_0x0a45('0x52')](_0x2b0d20[_0x0a45('0x48')],_0x24111e[_0x0a45('0x4a')]));_0x258774[_0x0a45('0x51')]['MailAccountId']=_0x7f360a['id'];if(_0x2b0d20[_0x0a45('0x48')][_0x0a45('0x53')]){_0x258774[_0x0a45('0x51')]=_[_0x0a45('0x54')](_0x258774[_0x0a45('0x51')],{'$or':_[_0x0a45('0x43')](_0x258774[_0x0a45('0x4c')],function(_0x432966){var _0x34c99c={};_0x34c99c[_0x432966]={'$like':'%'+_0x2b0d20[_0x0a45('0x48')][_0x0a45('0x53')]+'%'};return _0x34c99c;})});}_0x258774=_[_0x0a45('0x54')]({},_0x258774,_0x2b0d20['options']);return db[_0x0a45('0x6c')]['count']({'where':_0x258774[_0x0a45('0x51')]})[_0x0a45('0x22')](function(_0x35da2e){_0x10170e[_0x0a45('0x32')]=_0x35da2e;if(_0x2b0d20['query']['includeAll']){_0x258774[_0x0a45('0x58')]=[{'all':!![]}];}return db[_0x0a45('0x6c')][_0x0a45('0x59')](_0x258774);})[_0x0a45('0x22')](function(_0xa3739){_0x10170e[_0x0a45('0x68')]=_0xa3739;return _0x10170e;});}})[_0x0a45('0x22')](respondWithFilteredResult(_0x4a84a9,_0x258774))[_0x0a45('0x2b')](handleError(_0x4a84a9,null));};exports[_0x0a45('0x6f')]=function(_0x5a0bea,_0x302c26,_0x3afcd5){return db[_0x0a45('0x44')][_0x0a45('0x5e')]({'where':{'id':_0x5a0bea[_0x0a45('0x61')]['id']}})[_0x0a45('0x22')](handleEntityNotFound(_0x302c26,null))[_0x0a45('0x22')](function(_0x552e93){if(_0x552e93){return _0x552e93[_0x0a45('0x6f')](_0x5a0bea[_0x0a45('0x48')][_0x0a45('0x6a')]);}})[_0x0a45('0x22')](respondWithStatusCode(_0x302c26,null))[_0x0a45('0x2b')](handleError(_0x302c26,null));};exports[_0x0a45('0x63')]=function(_0x3ff33c,_0xbc7443){var _0x4e4db0={'name':_0x3ff33c[_0x0a45('0x60')][_0x0a45('0x3c')],'key':_0x3ff33c[_0x0a45('0x60')][_0x0a45('0x70')],'email':_0x3ff33c[_0x0a45('0x60')][_0x0a45('0x71')],'ListId':_0x3ff33c[_0x0a45('0x60')]['ListId'],'active':!_[_0x0a45('0x72')](_0x3ff33c[_0x0a45('0x60')][_0x0a45('0x73')])?_0x3ff33c[_0x0a45('0x60')][_0x0a45('0x73')]:!![],'description':_0x3ff33c[_0x0a45('0x60')][_0x0a45('0x74')]||null,'Imap':{},'Smtp':{}};if(_[_0x0a45('0x72')](_0x3ff33c[_0x0a45('0x60')]['cservice'])){if(_0x3ff33c['body'][_0x0a45('0x75')]){_0x4e4db0['Imap'][_0x0a45('0x76')]=_0x4e4db0[_0x0a45('0x40')][_0x0a45('0x76')]=_0x3ff33c[_0x0a45('0x60')]['cuser'];_0x4e4db0[_0x0a45('0x5c')][_0x0a45('0x77')]=_0x4e4db0['Smtp']['pass']=_0x3ff33c[_0x0a45('0x60')]['cpassword'];}else{_0x4e4db0[_0x0a45('0x5c')][_0x0a45('0x78')]=_0x4e4db0[_0x0a45('0x40')]['authentication']=![];}_0x4e4db0[_0x0a45('0x5c')]['host']=_0x3ff33c[_0x0a45('0x60')]['Imap'][_0x0a45('0x79')];_0x4e4db0[_0x0a45('0x5c')]['port']=_0x3ff33c[_0x0a45('0x60')][_0x0a45('0x5c')][_0x0a45('0x7a')];_0x4e4db0[_0x0a45('0x40')][_0x0a45('0x79')]=_0x3ff33c[_0x0a45('0x60')][_0x0a45('0x40')][_0x0a45('0x79')];_0x4e4db0[_0x0a45('0x40')]['port']=_0x3ff33c[_0x0a45('0x60')]['Smtp'][_0x0a45('0x7a')];}else{_0x4e4db0[_0x0a45('0x5c')][_0x0a45('0x7b')]=_0x4e4db0[_0x0a45('0x40')][_0x0a45('0x7b')]=_0x3ff33c[_0x0a45('0x60')][_0x0a45('0x7c')];_0x4e4db0['Imap'][_0x0a45('0x76')]=_0x4e4db0[_0x0a45('0x40')]['user']=_0x3ff33c['body'][_0x0a45('0x7d')];_0x4e4db0['Imap'][_0x0a45('0x77')]=_0x4e4db0[_0x0a45('0x40')][_0x0a45('0x7e')]=_0x3ff33c[_0x0a45('0x60')][_0x0a45('0x7f')];}return db['MailAccount'][_0x0a45('0x63')](_0x4e4db0,{'include':[{'model':db[_0x0a45('0x3f')],'as':_0x0a45('0x40')},{'model':db[_0x0a45('0x5b')],'as':'Imap'}]})[_0x0a45('0x22')](function(_0x4640af){var _0xd6bd0f=_0x3ff33c[_0x0a45('0x76')][_0x0a45('0x38')]({'plain':!![]});if(!_0xd6bd0f)throw new Error(_0x0a45('0x80'));if(_0xd6bd0f['role']===_0x0a45('0x76')){var _0x2f183c=_0x4640af[_0x0a45('0x38')]({'plain':!![]});return db[_0x0a45('0x81')]['find']({'where':{'name':_0x0a45('0x39'),'userProfileId':_0xd6bd0f['userProfileId']},'raw':!![]})['then'](function(_0x46a651){if(_0x46a651&&_0x46a651[_0x0a45('0x82')]===0x0){return db['UserProfileResource'][_0x0a45('0x63')]({'name':_0x2f183c[_0x0a45('0x3c')],'resourceId':_0x2f183c['id'],'type':_0x46a651[_0x0a45('0x3c')],'sectionId':_0x46a651['id']},{})[_0x0a45('0x22')](function(){return _0x4640af;});}else{return _0x4640af;}})['catch'](function(_0x1dfd22){logger[_0x0a45('0x27')](_0x0a45('0x83'),_0x1dfd22);throw _0x1dfd22;});}return _0x4640af;})['then'](respondWithResult(_0xbc7443,0xc9))[_0x0a45('0x2b')](handleError(_0xbc7443,null));};exports[_0x0a45('0x84')]=function(_0x3bdeb8,_0x14063f,_0x4f1ac6){return db[_0x0a45('0x44')][_0x0a45('0x6e')]({'where':{'id':_0x3bdeb8['params']['id']}})['then'](handleEntityNotFound(_0x14063f,null))['then'](function(_0x291f90){if(_0x291f90){return _0x291f90[_0x0a45('0x84')]();}return null;})[_0x0a45('0x22')](respondWithResult(_0x14063f,null))[_0x0a45('0x2b')](handleError(_0x14063f,null));};exports[_0x0a45('0x85')]=function(_0x5b9376,_0x18069f,_0x3e9eb9){if(_0x5b9376[_0x0a45('0x60')]['id']){delete _0x5b9376['body']['id'];}return db['MailAccount']['find']({'where':{'id':_0x5b9376['params']['id']}})[_0x0a45('0x22')](handleEntityNotFound(_0x18069f,null))[_0x0a45('0x22')](function(_0x84c110){if(_0x84c110){_0x5b9376[_0x0a45('0x60')][_0x0a45('0x67')]=_0x84c110['id'];return db[_0x0a45('0x5b')][_0x0a45('0x63')](_0x5b9376[_0x0a45('0x60')]);}})[_0x0a45('0x22')](respondWithResult(_0x18069f,null))[_0x0a45('0x2b')](handleError(_0x18069f,null));};exports[_0x0a45('0x86')]=function(_0x76d686,_0x1e7778,_0x4303ef){return db[_0x0a45('0x44')][_0x0a45('0x6e')]({'where':{'id':_0x76d686[_0x0a45('0x61')]['id']}})[_0x0a45('0x22')](handleEntityNotFound(_0x1e7778,null))[_0x0a45('0x22')](function(_0x283a42){if(_0x283a42){return _0x283a42[_0x0a45('0x87')](null);}return null;})[_0x0a45('0x22')](respondWithStatusCode(_0x1e7778,null))[_0x0a45('0x2b')](handleError(_0x1e7778,null));};exports[_0x0a45('0x88')]=function(_0x50afa9,_0x5950af,_0x26329a){return db[_0x0a45('0x44')][_0x0a45('0x6e')]({'where':{'id':_0x50afa9[_0x0a45('0x61')]['id']}})[_0x0a45('0x22')](handleEntityNotFound(_0x5950af,null))[_0x0a45('0x22')](function(_0x1e6238){if(_0x1e6238){return _0x1e6238[_0x0a45('0x88')]();}return null;})['then'](respondWithResult(_0x5950af,null))[_0x0a45('0x2b')](handleError(_0x5950af,null));};exports['addSmtp']=function(_0x3456a8,_0x5e9de8,_0x532f8a){if(_0x3456a8[_0x0a45('0x60')]['id']){delete _0x3456a8['body']['id'];}return db[_0x0a45('0x44')][_0x0a45('0x5e')]({'where':{'id':_0x3456a8[_0x0a45('0x61')]['id']}})['then'](handleEntityNotFound(_0x5e9de8,null))[_0x0a45('0x22')](function(_0x4c667e){if(_0x4c667e){_0x3456a8[_0x0a45('0x60')][_0x0a45('0x67')]=_0x4c667e['id'];return db[_0x0a45('0x3f')][_0x0a45('0x63')](_0x3456a8[_0x0a45('0x60')]);}})[_0x0a45('0x22')](respondWithResult(_0x5e9de8,null))[_0x0a45('0x2b')](handleError(_0x5e9de8,null));};exports[_0x0a45('0x89')]=function(_0x49fea0,_0x2afcae,_0xb33147){return db[_0x0a45('0x44')][_0x0a45('0x6e')]({'where':{'id':_0x49fea0[_0x0a45('0x61')]['id']}})[_0x0a45('0x22')](handleEntityNotFound(_0x2afcae,null))[_0x0a45('0x22')](function(_0x5bfaeb){if(_0x5bfaeb){return _0x5bfaeb['setSmtp'](null);}return null;})[_0x0a45('0x22')](respondWithStatusCode(_0x2afcae,null))[_0x0a45('0x2b')](handleError(_0x2afcae,null));};exports['addInteraction']=function(_0x296e22,_0x2a074f,_0x534d6a){return db[_0x0a45('0x8a')][_0x0a45('0x5e')]({'where':{'id':_0x296e22[_0x0a45('0x61')]['id']}})['then'](handleEntityNotFound(_0x2a074f,null))[_0x0a45('0x22')](function(_0x3d2f8e){if(_0x3d2f8e){return _0x3d2f8e[_0x0a45('0x8b')](_0x296e22[_0x0a45('0x60')][_0x0a45('0x6a')],_[_0x0a45('0x8c')](_0x296e22['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x2a074f,null))[_0x0a45('0x2b')](handleError(_0x2a074f,null));};exports[_0x0a45('0x8d')]=function(_0xafb97d,_0x490d4b,_0xd3cc6b){var _0x2ea92b={'raw':![],'where':{}};var _0x50ee20={};var _0x188591={'count':0x0,'rows':[]};return db[_0x0a45('0x44')][_0x0a45('0x6e')]({'where':{'id':_0xafb97d[_0x0a45('0x61')]['id']}})[_0x0a45('0x22')](handleEntityNotFound(_0x490d4b,null))[_0x0a45('0x22')](function(_0x2f1322){if(_0x2f1322){_0x50ee20['model']=_['keys'](db[_0x0a45('0x8a')][_0x0a45('0x45')]);_0x50ee20[_0x0a45('0x48')]=_['keys'](_0xafb97d[_0x0a45('0x48')]);_0x50ee20['filters']=_[_0x0a45('0x4b')](_0x50ee20[_0x0a45('0x47')],_0x50ee20['query']);_0x2ea92b[_0x0a45('0x4c')]=_[_0x0a45('0x4b')](_0x50ee20[_0x0a45('0x47')],qs[_0x0a45('0x4d')](_0xafb97d['query']['fields']));_0x2ea92b[_0x0a45('0x4c')]=_0x2ea92b['attributes'][_0x0a45('0x5d')]?_0x2ea92b[_0x0a45('0x4c')]:_0x50ee20['model'];if(!_0xafb97d[_0x0a45('0x48')][_0x0a45('0x4e')]('nolimit')){_0x2ea92b[_0x0a45('0x33')]=qs[_0x0a45('0x33')](_0xafb97d[_0x0a45('0x48')][_0x0a45('0x33')]);_0x2ea92b[_0x0a45('0x30')]=qs[_0x0a45('0x30')](_0xafb97d[_0x0a45('0x48')][_0x0a45('0x30')]);}_0x2ea92b[_0x0a45('0x66')]=qs[_0x0a45('0x50')](_0xafb97d[_0x0a45('0x48')][_0x0a45('0x50')]);_0x2ea92b[_0x0a45('0x51')]=qs[_0x0a45('0x4a')](_[_0x0a45('0x52')](_0xafb97d['query'],_0x50ee20[_0x0a45('0x4a')]));_0x2ea92b[_0x0a45('0x51')]['MailAccountId']=_0x2f1322['id'];if(_0xafb97d['query'][_0x0a45('0x53')]){_0x2ea92b[_0x0a45('0x51')]=_['merge'](_0x2ea92b[_0x0a45('0x51')],{'$or':_[_0x0a45('0x43')](_0x2ea92b[_0x0a45('0x4c')],function(_0x6fca7d){var _0x3425d5={};_0x3425d5[_0x6fca7d]={'$like':'%'+_0xafb97d['query'][_0x0a45('0x53')]+'%'};return _0x3425d5;})});}_0x2ea92b=_[_0x0a45('0x54')]({},_0x2ea92b,_0xafb97d[_0x0a45('0x56')]);return db[_0x0a45('0x8a')]['count']({'where':_0x2ea92b[_0x0a45('0x51')]})[_0x0a45('0x22')](function(_0x306329){_0x188591[_0x0a45('0x32')]=_0x306329;if(_0xafb97d[_0x0a45('0x48')][_0x0a45('0x57')]){_0x2ea92b['include']=[{'model':db[_0x0a45('0x8e')],'as':_0x0a45('0x8f'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x0a45('0x3c'),_0x0a45('0x90'),_0x0a45('0x91')],'required':![]},{'model':db[_0x0a45('0x92')],'as':_0x0a45('0x93'),'attributes':['id',_0x0a45('0x3c'),_0x0a45('0x94')],'where':_0xafb97d[_0x0a45('0x48')][_0x0a45('0x95')]?{'id':_0xafb97d[_0x0a45('0x48')][_0x0a45('0x95')]}:undefined,'required':_0xafb97d[_0x0a45('0x48')][_0x0a45('0x95')]?!![]:![]}];}return db[_0x0a45('0x8a')]['findAll'](_0x2ea92b);})[_0x0a45('0x22')](function(_0x1f2ce2){_0x188591[_0x0a45('0x68')]=_0x1f2ce2;return _0x188591;});}})[_0x0a45('0x22')](respondWithFilteredResult(_0x490d4b,_0x2ea92b))[_0x0a45('0x2b')](handleError(_0x490d4b,null));};exports[_0x0a45('0x96')]=function(_0x4ab38f,_0x374172,_0x171365){return db['MailAccount'][_0x0a45('0x6e')]({'where':{'id':_0x4ab38f['params']['id']}})[_0x0a45('0x22')](handleEntityNotFound(_0x374172,null))[_0x0a45('0x22')](function(_0xd31283){if(_0xd31283){return db[_0x0a45('0x97')]['transaction'](function(_0x13668e){return db[_0x0a45('0x98')][_0x0a45('0x37')]({'where':{'MailAccountId':_0x4ab38f['params']['id']},'transaction':_0x13668e})[_0x0a45('0x22')](function(_0x3615c2){var _0x5adc38=_[_0x0a45('0x43')](_0x4ab38f[_0x0a45('0x60')],function(_0x3193c3){_0x3193c3[_0x0a45('0x67')]=_0x4ab38f[_0x0a45('0x61')]['id'];return _0x3193c3;});return db[_0x0a45('0x98')][_0x0a45('0x99')](_0x5adc38,{'transaction':_0x13668e});});})[_0x0a45('0x22')](function(){return db[_0x0a45('0x98')][_0x0a45('0x9a')]({'where':{'MailAccountId':_0x4ab38f[_0x0a45('0x61')]['id']},'order':_0x0a45('0x9b')});});}})[_0x0a45('0x22')](respondWithResult(_0x374172,null))[_0x0a45('0x2b')](handleError(_0x374172,null));};exports[_0x0a45('0x9c')]=function(_0x33c023,_0x173d48,_0x411263){var _0x54a007={};var _0x1babbb={};var _0xa36d87;var _0x4df869;return db[_0x0a45('0x44')][_0x0a45('0x6e')]({'where':{'id':_0x33c023[_0x0a45('0x61')]['id']}})[_0x0a45('0x22')](handleEntityNotFound(_0x173d48,null))[_0x0a45('0x22')](function(_0x376dce){if(_0x376dce){_0xa36d87=_0x376dce;_0x1babbb[_0x0a45('0x47')]=_['keys'](db[_0x0a45('0x98')][_0x0a45('0x45')]);_0x1babbb[_0x0a45('0x48')]=_['keys'](_0x33c023[_0x0a45('0x48')]);_0x1babbb[_0x0a45('0x4a')]=_[_0x0a45('0x4b')](_0x1babbb[_0x0a45('0x47')],_0x1babbb[_0x0a45('0x48')]);_0x54a007[_0x0a45('0x4c')]=_[_0x0a45('0x4b')](_0x1babbb[_0x0a45('0x47')],qs[_0x0a45('0x4d')](_0x33c023[_0x0a45('0x48')]['fields']));_0x54a007[_0x0a45('0x4c')]=_0x54a007['attributes'][_0x0a45('0x5d')]?_0x54a007['attributes']:_0x1babbb[_0x0a45('0x47')];_0x54a007[_0x0a45('0x66')]=qs[_0x0a45('0x50')](_0x33c023[_0x0a45('0x48')][_0x0a45('0x50')]);_0x54a007[_0x0a45('0x51')]=qs[_0x0a45('0x4a')](_[_0x0a45('0x52')](_0x33c023['query'],_0x1babbb['filters']));if(_0x33c023['query'][_0x0a45('0x53')]){_0x54a007[_0x0a45('0x51')]=_['merge'](_0x54a007['where'],{'$or':_[_0x0a45('0x43')](_0x54a007[_0x0a45('0x4c')],function(_0x5c2e80){var _0x176333={};_0x176333[_0x5c2e80]={'$like':'%'+_0x33c023[_0x0a45('0x48')][_0x0a45('0x53')]+'%'};return _0x176333;})});}_0x54a007=_[_0x0a45('0x54')]({},_0x54a007,_0x33c023[_0x0a45('0x56')]);return _0xa36d87[_0x0a45('0x9c')](_0x54a007);}})[_0x0a45('0x22')](function(_0x23c9a1){if(_0x23c9a1){_0x4df869=_0x23c9a1[_0x0a45('0x5d')];if(!_0x33c023[_0x0a45('0x48')][_0x0a45('0x4e')](_0x0a45('0x4f'))){_0x54a007[_0x0a45('0x33')]=qs[_0x0a45('0x33')](_0x33c023['query']['limit']);_0x54a007[_0x0a45('0x30')]=qs[_0x0a45('0x30')](_0x33c023['query'][_0x0a45('0x30')]);}return _0xa36d87[_0x0a45('0x9c')](_0x54a007);}})[_0x0a45('0x22')](function(_0x5449f6){if(_0x5449f6){return _0x5449f6?{'count':_0x4df869,'rows':_0x5449f6}:null;}})['then'](respondWithResult(_0x173d48,null))['catch'](handleError(_0x173d48,null));};exports[_0x0a45('0x9d')]=function(_0x364690,_0x4578fb,_0x1818a3){var _0xf0af0f={'raw':!![],'where':{}};var _0x17308e={};var _0x189ce4={'count':0x0,'rows':[]};return db[_0x0a45('0x44')][_0x0a45('0x6e')]({'where':{'id':_0x364690[_0x0a45('0x61')]['id']}})['then'](handleEntityNotFound(_0x4578fb,null))[_0x0a45('0x22')](function(_0x50537e){if(_0x50537e){_0x17308e[_0x0a45('0x47')]=_[_0x0a45('0x49')](db[_0x0a45('0x9e')][_0x0a45('0x45')]);_0x17308e[_0x0a45('0x48')]=_[_0x0a45('0x49')](_0x364690[_0x0a45('0x48')]);_0x17308e['filters']=_[_0x0a45('0x4b')](_0x17308e[_0x0a45('0x47')],_0x17308e[_0x0a45('0x48')]);_0xf0af0f[_0x0a45('0x4c')]=_[_0x0a45('0x4b')](_0x17308e[_0x0a45('0x47')],qs[_0x0a45('0x4d')](_0x364690[_0x0a45('0x48')]['fields']));_0xf0af0f[_0x0a45('0x4c')]=_0xf0af0f[_0x0a45('0x4c')][_0x0a45('0x5d')]?_0xf0af0f[_0x0a45('0x4c')]:_0x17308e[_0x0a45('0x47')];if(!_0x364690[_0x0a45('0x48')]['hasOwnProperty']('nolimit')){_0xf0af0f[_0x0a45('0x33')]=qs['limit'](_0x364690[_0x0a45('0x48')][_0x0a45('0x33')]);_0xf0af0f['offset']=qs[_0x0a45('0x30')](_0x364690[_0x0a45('0x48')][_0x0a45('0x30')]);}_0xf0af0f[_0x0a45('0x66')]=qs['sort'](_0x364690[_0x0a45('0x48')][_0x0a45('0x50')]);_0xf0af0f[_0x0a45('0x51')]=qs[_0x0a45('0x4a')](_[_0x0a45('0x52')](_0x364690[_0x0a45('0x48')],_0x17308e[_0x0a45('0x4a')]));_0xf0af0f[_0x0a45('0x51')][_0x0a45('0x67')]=_0x50537e['id'];if(_0x364690['query'][_0x0a45('0x53')]){_0xf0af0f[_0x0a45('0x51')]=_[_0x0a45('0x54')](_0xf0af0f[_0x0a45('0x51')],{'$or':_[_0x0a45('0x43')](_0xf0af0f['attributes'],function(_0x3d97d7){var _0x33abbc={};_0x33abbc[_0x3d97d7]={'$like':'%'+_0x364690[_0x0a45('0x48')][_0x0a45('0x53')]+'%'};return _0x33abbc;})});}if(_0x364690['query'][_0x0a45('0x9f')]){var _0x15a647=_0x364690[_0x0a45('0x48')][_0x0a45('0x9f')]['split'](',');var _0x1f5c2b={};_0x1f5c2b[_0x15a647[0x0]]={'$gte':moment(_0x15a647[0x1])[_0x0a45('0xa0')]('YYYY-MM-DD\x20HH:mm:ss')};_0xf0af0f[_0x0a45('0x51')]=_['merge'](_0xf0af0f[_0x0a45('0x51')],_0x1f5c2b);}_0xf0af0f=_['merge']({},_0xf0af0f,_0x364690['options']);return db[_0x0a45('0x9e')]['count']({'where':_0xf0af0f['where']})[_0x0a45('0x22')](function(_0x4abb90){_0x189ce4['count']=_0x4abb90;if(_0x364690[_0x0a45('0x48')][_0x0a45('0x57')]){_0xf0af0f[_0x0a45('0x58')]=[{'all':!![]}];}return db[_0x0a45('0x9e')][_0x0a45('0x59')](_0xf0af0f);})[_0x0a45('0x22')](function(_0x22b56e){if(_0x364690['query']['inlineCss']==='true'){for(var _0x50ee8c=0x0;_0x50ee8c<_0x22b56e[_0x0a45('0x5d')];_0x50ee8c++){_0x22b56e[_0x50ee8c][_0x0a45('0x60')]=juice(_0x22b56e[_0x50ee8c][_0x0a45('0x60')]);}}_0x189ce4['rows']=_0x22b56e;return _0x189ce4;});}})[_0x0a45('0x22')](respondWithFilteredResult(_0x4578fb,_0xf0af0f))['catch'](handleError(_0x4578fb,null));};exports[_0x0a45('0x3d')]=function(_0x53176c,_0x192290,_0x223a57){var _0x4a17b7,_0x55a8ae={},_0x1814a0;if(_0x53176c[_0x0a45('0x60')]['to']){_0x1814a0=_0x53176c[_0x0a45('0x60')]['to'][_0x0a45('0xa1')](',')[0x0];}return db[_0x0a45('0x44')][_0x0a45('0x5e')]({'where':{'id':_0x53176c['params']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x0a45('0x8e')],'as':_0x0a45('0xa2'),'where':{'email':_0x1814a0},'limit':0x1,'order':[[_0x0a45('0xa3'),_0x0a45('0xa4')]]}]},{'model':db[_0x0a45('0x3f')],'as':'Smtp','raw':!![]}]})[_0x0a45('0x22')](handleEntityNotFound(_0x192290,null))['then'](function(_0x259c18){if(_0x259c18){_0x4a17b7=_0x259c18;if(_0x259c18[_0x0a45('0x40')]){if(_['isNil'](_0x53176c[_0x0a45('0x60')][_0x0a45('0xa5')])){_0x53176c[_0x0a45('0x60')][_0x0a45('0xa5')]=util[_0x0a45('0xa0')](_0x0a45('0xa6'),_0x259c18[_0x0a45('0x3c')],_0x259c18[_0x0a45('0x71')]||_0x259c18[_0x0a45('0x40')][_0x0a45('0x76')]);}if(_0x53176c[_0x0a45('0x60')][_0x0a45('0xa7')]&&_0x53176c[_0x0a45('0x60')][_0x0a45('0xa7')][_0x0a45('0x5d')]){for(var _0x3ca404=0x0;_0x3ca404<_0x53176c[_0x0a45('0x60')]['attachments']['length'];_0x3ca404+=0x1){_0x53176c[_0x0a45('0x60')][_0x0a45('0xa7')][_0x3ca404]={'filename':_0x53176c[_0x0a45('0x60')][_0x0a45('0xa7')][_0x3ca404][_0x0a45('0x3c')],'path':path[_0x0a45('0xa8')](config[_0x0a45('0xa9')],_0x0a45('0xaa'),_0x53176c[_0x0a45('0x60')][_0x0a45('0xa7')][_0x3ca404][_0x0a45('0xab')])};}}var _0x2cfb74={'tls':{'rejectUnauthorized':![]}};if(_[_0x0a45('0x72')](_0x259c18[_0x0a45('0x40')][_0x0a45('0x7b')])){if(_0x259c18[_0x0a45('0x40')][_0x0a45('0x78')]){_0x2cfb74[_0x0a45('0xac')]={'user':_0x259c18['Smtp'][_0x0a45('0x76')],'pass':_0x259c18['Smtp'][_0x0a45('0x7e')]};}_0x2cfb74['host']=_0x259c18[_0x0a45('0x40')][_0x0a45('0x79')];_0x2cfb74['port']=_0x259c18[_0x0a45('0x40')][_0x0a45('0x7a')];_0x2cfb74[_0x0a45('0xad')]=_0x259c18[_0x0a45('0x40')][_0x0a45('0xad')];}else{_0x2cfb74[_0x0a45('0x7b')]=_0x259c18[_0x0a45('0x40')][_0x0a45('0x7b')];_0x2cfb74[_0x0a45('0xac')]={'user':_0x259c18['Smtp']['user'],'pass':_0x259c18[_0x0a45('0x40')][_0x0a45('0x7e')]};}return respondWithRpcPromise(_0x0a45('0xae'),'sendMail',{'account':_0x2cfb74,'message':_0x53176c[_0x0a45('0x60')]});}else{throw new Error(_0x0a45('0xaf'));}}})[_0x0a45('0x22')](function(_0x8f3958){if(_0x8f3958){_0x55a8ae=_0x8f3958;if(_0x4a17b7[_0x0a45('0xb0')]){if(_0x4a17b7[_0x0a45('0xb0')]['Contacts'][_0x0a45('0x5d')]){return _0x4a17b7[_0x0a45('0xb0')][_0x0a45('0xa2')][0x0];}else{return db['CmContact'][_0x0a45('0x63')](_[_0x0a45('0x1d')](_0x53176c['body'],{'firstName':_0x53176c[_0x0a45('0x60')]['to'],'email':_0x53176c['body']['to'],'phone':_0x53176c['body']['to'],'ListId':_0x4a17b7['ListId']}));}}else{throw new Error(_0x0a45('0xaf'));}}})['then'](function(_0x483c15){if(_0x483c15){var _0x1c8230={'UserId':_0x53176c['user']['id'],'ContactId':_0x483c15['id'],'MailAccountId':_0x4a17b7['id'],'inReplyTo':_0x55a8ae['messageId'],'to':_0x53176c['body'][_0x0a45('0xa5')],'cc':_0x53176c[_0x0a45('0x60')]['cc'],'subject':_0x53176c[_0x0a45('0x60')][_0x0a45('0xb1')],'attach':_0x53176c[_0x0a45('0x60')][_0x0a45('0xb2')],'firstMsgDirection':_0x0a45('0xb3'),'lastMsgAt':moment()[_0x0a45('0xa0')](_0x0a45('0xb4')),'lastMsgDirection':_0x0a45('0xb3'),'Messages':[_[_0x0a45('0x54')](_0x53176c[_0x0a45('0x60')],{'messageId':_0x55a8ae['messageId'],'sentAt':moment()[_0x0a45('0xa0')](_0x0a45('0xb4')),'read':!![],'MailAccountId':_0x4a17b7['id'],'UserId':_0x53176c[_0x0a45('0x76')]['id'],'ContactId':_0x483c15['id']})]};if(_0x53176c[_0x0a45('0x60')]['Interaction']){_0x1c8230=_[_0x0a45('0x54')](_0x1c8230,_0x53176c[_0x0a45('0x60')]['Interaction']);}return db['MailInteraction']['create'](_0x1c8230,{'include':[{'model':db[_0x0a45('0x9e')],'as':_0x0a45('0xb5')}]});}})[_0x0a45('0x22')](respondWithResult(_0x192290,null))['catch'](handleError(_0x192290,null));};exports[_0x0a45('0xb6')]=function(_0x333735,_0x3cadfa,_0x41e993){return db[_0x0a45('0x44')][_0x0a45('0x5e')]({'where':{'id':_0x333735['params']['id']},'include':[{'model':db[_0x0a45('0x3f')],'as':_0x0a45('0x40'),'raw':!![]}]})['then'](handleEntityNotFound(_0x3cadfa,null))[_0x0a45('0x22')](function(_0x5e9b6f){if(_0x5e9b6f&&_0x5e9b6f['Smtp']){var _0x3eac6f={'id':_0x5e9b6f['id'],'tls':{'rejectUnauthorized':![]}};if(_0x5e9b6f['Smtp']['service']){_0x3eac6f['service']=_0x5e9b6f[_0x0a45('0x40')]['service'];}else{_0x3eac6f['host']=_0x5e9b6f['Smtp'][_0x0a45('0x79')];_0x3eac6f[_0x0a45('0x7a')]=_0x5e9b6f[_0x0a45('0x40')]['port'];_0x3eac6f['secure']=_0x5e9b6f[_0x0a45('0x40')][_0x0a45('0xad')];}if(_0x5e9b6f['Smtp'][_0x0a45('0x78')]){_0x3eac6f[_0x0a45('0xac')]={'user':_0x5e9b6f['Smtp'][_0x0a45('0x76')],'pass':_0x5e9b6f[_0x0a45('0x40')]['pass']};}return respondWithRpcPromise('VerifySmtp',_0x0a45('0xb6'),{'account':_0x3eac6f});}})[_0x0a45('0x22')](respondWithResult(_0x3cadfa,null))[_0x0a45('0x2b')](handleError(_0x3cadfa,null));};exports[_0x0a45('0x37')]=function(_0x25a1d8,_0x1d2810){return db['MailAccount']['find']({'where':{'id':_0x25a1d8[_0x0a45('0x61')]['id']}})[_0x0a45('0x22')](handleEntityNotFound(_0x1d2810,null))[_0x0a45('0x22')](function(_0x388810){if(_0x388810&&_0x388810[_0x0a45('0x7b')]){throw new db[(_0x0a45('0xb7'))][(_0x0a45('0xb8'))](_0x0a45('0xb9'));}return _0x388810;})['then'](removeEntity(_0x1d2810,null))[_0x0a45('0x2b')](handleError(_0x1d2810,null));};exports['addAgents']=function(_0x3e0667,_0x352442,_0x3b846){return db[_0x0a45('0x44')][_0x0a45('0x5e')]({'where':{'id':_0x3e0667['params']['id']}})[_0x0a45('0x22')](handleEntityNotFound(_0x352442,null))[_0x0a45('0x22')](function(_0x187a3c){if(_0x187a3c){return _0x187a3c[_0x0a45('0xba')](_0x3e0667['body'][_0x0a45('0x6a')],_[_0x0a45('0x8c')](_0x3e0667[_0x0a45('0x60')],[_0x0a45('0x6a'),'id'])||{})[_0x0a45('0xbb')](function(_0x12f56d){for(var _0x56b923=0x0;_0x56b923<_0x3e0667['body'][_0x0a45('0x6a')][_0x0a45('0x5d')];_0x56b923+=0x1){socket[_0x0a45('0xbc')](_0x0a45('0xbd'),{'UserId':Number(_0x3e0667[_0x0a45('0x60')][_0x0a45('0x6a')][_0x56b923]),'MailAccountId':Number(_0x3e0667['params']['id'])});}return _0x12f56d;});}})['then'](respondWithResult(_0x352442,null))[_0x0a45('0x2b')](handleError(_0x352442,null));};exports['removeAgents']=function(_0x9498a1,_0x2ca4f8,_0x431c25){return db['MailAccount'][_0x0a45('0x5e')]({'where':{'id':_0x9498a1['params']['id']}})[_0x0a45('0x22')](handleEntityNotFound(_0x2ca4f8,null))[_0x0a45('0x22')](function(_0x49aec7){if(_0x49aec7){return _0x49aec7[_0x0a45('0xbe')](_0x9498a1[_0x0a45('0x48')][_0x0a45('0x6a')])[_0x0a45('0x22')](function(){if(_[_0x0a45('0xbf')](_0x9498a1[_0x0a45('0x48')][_0x0a45('0x6a')])){for(var _0x4bddb5=0x0;_0x4bddb5<_0x9498a1['query']['ids'][_0x0a45('0x5d')];_0x4bddb5+=0x1){socket[_0x0a45('0xbc')](_0x0a45('0xc0'),{'UserId':Number(_0x9498a1[_0x0a45('0x48')][_0x0a45('0x6a')][_0x4bddb5]),'MailAccountId':Number(_0x9498a1[_0x0a45('0x61')]['id'])});}}else{socket['emit'](_0x0a45('0xc0'),{'UserId':Number(_0x9498a1[_0x0a45('0x48')][_0x0a45('0x6a')]),'MailAccountId':Number(_0x9498a1[_0x0a45('0x61')]['id'])});}});}})[_0x0a45('0x22')](respondWithStatusCode(_0x2ca4f8,null))[_0x0a45('0x2b')](handleError(_0x2ca4f8,null));};exports[_0x0a45('0xc1')]=function(_0x188e00,_0x39f22f,_0x4e7484){var _0x18a1b4={};var _0x3341f6={};var _0x27bd25;var _0x378bed;return db[_0x0a45('0x44')][_0x0a45('0x6e')]({'where':{'id':_0x188e00['params']['id']}})[_0x0a45('0x22')](handleEntityNotFound(_0x39f22f,null))[_0x0a45('0x22')](function(_0x1d58ce){if(_0x1d58ce){_0x27bd25=_0x1d58ce;_0x3341f6[_0x0a45('0x47')]=_[_0x0a45('0x49')](db[_0x0a45('0xc2')][_0x0a45('0x45')]);_0x3341f6[_0x0a45('0x48')]=_[_0x0a45('0x49')](_0x188e00[_0x0a45('0x48')]);_0x3341f6['filters']=_[_0x0a45('0x4b')](_0x3341f6[_0x0a45('0x47')],_0x3341f6[_0x0a45('0x48')]);_0x18a1b4[_0x0a45('0x4c')]=_['intersection'](_0x3341f6['model'],qs[_0x0a45('0x4d')](_0x188e00[_0x0a45('0x48')][_0x0a45('0x4d')]));_0x18a1b4['attributes']=_0x18a1b4[_0x0a45('0x4c')][_0x0a45('0x5d')]?_0x18a1b4[_0x0a45('0x4c')]:_0x3341f6[_0x0a45('0x47')];_0x18a1b4[_0x0a45('0x66')]=qs[_0x0a45('0x50')](_0x188e00[_0x0a45('0x48')]['sort']);_0x18a1b4[_0x0a45('0x51')]=qs[_0x0a45('0x4a')](_[_0x0a45('0x52')](_0x188e00[_0x0a45('0x48')],_0x3341f6['filters']));if(_0x188e00[_0x0a45('0x48')]['filter']){_0x18a1b4[_0x0a45('0x51')]=_[_0x0a45('0x54')](_0x18a1b4['where'],{'$or':_[_0x0a45('0x43')](_0x18a1b4[_0x0a45('0x4c')],function(_0x478288){var _0x1c0a37={};_0x1c0a37[_0x478288]={'$like':'%'+_0x188e00[_0x0a45('0x48')][_0x0a45('0x53')]+'%'};return _0x1c0a37;})});}_0x18a1b4=_[_0x0a45('0x54')]({},_0x18a1b4,_0x188e00['options']);return _0x27bd25['getAgents'](_0x18a1b4);}})[_0x0a45('0x22')](function(_0x572d95){if(_0x572d95){_0x378bed=_0x572d95[_0x0a45('0x5d')];if(!_0x188e00[_0x0a45('0x48')][_0x0a45('0x4e')](_0x0a45('0x4f'))){_0x18a1b4[_0x0a45('0x33')]=qs[_0x0a45('0x33')](_0x188e00[_0x0a45('0x48')]['limit']);_0x18a1b4['offset']=qs[_0x0a45('0x30')](_0x188e00[_0x0a45('0x48')]['offset']);}return _0x27bd25['getAgents'](_0x18a1b4);}})['then'](function(_0x25e04a){if(_0x25e04a){return _0x25e04a?{'count':_0x378bed,'rows':_0x25e04a}:null;}})[_0x0a45('0x22')](respondWithResult(_0x39f22f,null))[_0x0a45('0x2b')](handleError(_0x39f22f,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 861da66..8fed573 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 _0xe829=['save','update','remove','hasOwnProperty','hook','exports','../../mysqldb','MailAccount','setMaxListeners'];(function(_0x2ee696,_0xe36b23){var _0x34f6a1=function(_0x32359e){while(--_0x32359e){_0x2ee696['push'](_0x2ee696['shift']());}};_0x34f6a1(++_0xe36b23);}(_0xe829,0xde));var _0x9e82=function(_0x43a882,_0x1212b0){_0x43a882=_0x43a882-0x0;var _0x5b3ca5=_0xe829[_0x43a882];return _0x5b3ca5;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0x9e82('0x0'))['db'][_0x9e82('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x9e82('0x2')](0x0);var events={'afterCreate':_0x9e82('0x3'),'afterUpdate':_0x9e82('0x4'),'afterDestroy':_0x9e82('0x5')};function emitEvent(_0x487d2d){return function(_0xc8aec1,_0x19ece0,_0x4bd524){MailAccountEvents['emit'](_0x487d2d+':'+_0xc8aec1['id'],_0xc8aec1);MailAccountEvents['emit'](_0x487d2d,_0xc8aec1);_0x4bd524(null);};}for(var e in events){if(events[_0x9e82('0x6')](e)){var event=events[e];MailAccount[_0x9e82('0x7')](e,emitEvent(event));}}module[_0x9e82('0x8')]=MailAccountEvents; \ No newline at end of file +var _0xbdc2=['events','../../mysqldb','MailAccount','setMaxListeners','remove','emit','hook','exports'];(function(_0x3477ae,_0x15257f){var _0x2f0e2e=function(_0x1855b2){while(--_0x1855b2){_0x3477ae['push'](_0x3477ae['shift']());}};_0x2f0e2e(++_0x15257f);}(_0xbdc2,0x148));var _0x2bdc=function(_0x57f1bc,_0x103651){_0x57f1bc=_0x57f1bc-0x0;var _0x57649d=_0xbdc2[_0x57f1bc];return _0x57649d;};'use strict';var EventEmitter=require(_0x2bdc('0x0'));var MailAccount=require(_0x2bdc('0x1'))['db'][_0x2bdc('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x2bdc('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x2bdc('0x4')};function emitEvent(_0x1d9116){return function(_0x522434,_0x1855bd,_0x378db8){MailAccountEvents['emit'](_0x1d9116+':'+_0x522434['id'],_0x522434);MailAccountEvents[_0x2bdc('0x5')](_0x1d9116,_0x522434);_0x378db8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0x2bdc('0x6')](e,emitEvent(event));}}module[_0x2bdc('0x7')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 305cc0a..3599c61 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 _0x1642=['../../config/environment','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','lodash','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x3a13eb,_0x54565e){var _0x1a383b=function(_0x4ad88c){while(--_0x4ad88c){_0x3a13eb['push'](_0x3a13eb['shift']());}};_0x1a383b(++_0x54565e);}(_0x1642,0x1e6));var _0x2164=function(_0xd69925,_0x530e3f){_0xd69925=_0xd69925-0x0;var _0x1214c9=_0x1642[_0xd69925];return _0x1214c9;};'use strict';var _=require(_0x2164('0x0'));var util=require('util');var logger=require(_0x2164('0x1'))('api');var moment=require(_0x2164('0x2'));var BPromise=require(_0x2164('0x3'));var rp=require(_0x2164('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2164('0x5'));var config=require(_0x2164('0x6'));var attributes=require(_0x2164('0x7'));module[_0x2164('0x8')]=function(_0x35a305,_0x3c9c9a){return _0x35a305[_0x2164('0x9')](_0x2164('0xa'),attributes,{'tableName':_0x2164('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x596e=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailAccount.attributes','exports','MailAccount','mail_accounts','lodash'];(function(_0x2ea857,_0x466b31){var _0x20429a=function(_0x3145a6){while(--_0x3145a6){_0x2ea857['push'](_0x2ea857['shift']());}};_0x20429a(++_0x466b31);}(_0x596e,0x9b));var _0xe596=function(_0x16ab1b,_0x5249f7){_0x16ab1b=_0x16ab1b-0x0;var _0xc8facb=_0x596e[_0x16ab1b];return _0xc8facb;};'use strict';var _=require(_0xe596('0x0'));var util=require('util');var logger=require(_0xe596('0x1'))(_0xe596('0x2'));var moment=require(_0xe596('0x3'));var BPromise=require(_0xe596('0x4'));var rp=require(_0xe596('0x5'));var fs=require('fs');var path=require(_0xe596('0x6'));var rimraf=require(_0xe596('0x7'));var config=require(_0xe596('0x8'));var attributes=require(_0xe596('0x9'));module[_0xe596('0xa')]=function(_0x1f766b,_0x5a952a){return _0x1f766b['define'](_0xe596('0xb'),attributes,{'tableName':_0xe596('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 0ffce9e..7a80570 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 _0x07aa=['List','omit','applications','orderBy','priority','push','length','create','List\x20not\x20found','contact','messageId','generate','subject','attach','YYYY-MM-DD\x20HH:mm:ss','MailMessage','Messages','Contact\x20not\x20found','update','format','interaction','get','created','attachments','originCc','bcc','ChatWebsiteId','originChannel','ChatOfflineMessageId','Attachments','UserId','name','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','then','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','MailAccount,\x20%s,\x20%s','message','info','result','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','limit','include','map','model','catch','ShowMailAccount','find','body','mail','difference','keys','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','CmContact','Contacts','MailApplication','Applications','MailServerOut','Smtp'];(function(_0x589a73,_0xc0b05e){var _0x471bf6=function(_0x2aeb19){while(--_0x2aeb19){_0x589a73['push'](_0x589a73['shift']());}};_0x471bf6(++_0xc0b05e);}(_0x07aa,0x8d));var _0xa07a=function(_0x48e340,_0x4f355e){_0x48e340=_0x48e340-0x0;var _0x192d8b=_0x07aa[_0x48e340];return _0x192d8b;};'use strict';var _=require(_0xa07a('0x0'));var util=require('util');var moment=require(_0xa07a('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa07a('0x2'));var db=require(_0xa07a('0x3'))['db'];var utils=require(_0xa07a('0x4'));var logger=require(_0xa07a('0x5'))('rpc');var config=require(_0xa07a('0x6'));var jayson=require(_0xa07a('0x7'));var client=jayson['client'][_0xa07a('0x8')]({'port':0x232c});config[_0xa07a('0x9')]=_[_0xa07a('0xa')](config[_0xa07a('0x9')],{'host':_0xa07a('0xb'),'port':0x18eb});var socket=require(_0xa07a('0xc'))(new Redis(config[_0xa07a('0x9')]));require(_0xa07a('0xd'))[_0xa07a('0xe')](socket);function respondWithRpcPromise(_0x47d5c2,_0x40c376,_0x2700bd){return new BPromise(function(_0x5167ec,_0x249705){return client['request'](_0x47d5c2,_0x2700bd)[_0xa07a('0xf')](function(_0x57f1af){logger['info']('MailAccount,\x20%s,\x20%s',_0x40c376,_0xa07a('0x10'));logger[_0xa07a('0x11')](_0xa07a('0x12'),_0x40c376,_0xa07a('0x10'),JSON[_0xa07a('0x13')](_0x57f1af));if(_0x57f1af[_0xa07a('0x14')]){if(_0x57f1af['error'][_0xa07a('0x15')]===0x1f4){logger[_0xa07a('0x14')](_0xa07a('0x16'),_0x40c376,_0x57f1af[_0xa07a('0x14')][_0xa07a('0x17')]);return _0x249705(_0x57f1af[_0xa07a('0x14')]['message']);}logger[_0xa07a('0x14')](_0xa07a('0x16'),_0x40c376,_0x57f1af[_0xa07a('0x14')]['message']);return _0x5167ec(_0x57f1af[_0xa07a('0x14')][_0xa07a('0x17')]);}else{logger[_0xa07a('0x18')](_0xa07a('0x16'),_0x40c376,_0xa07a('0x10'));_0x5167ec(_0x57f1af[_0xa07a('0x19')]['message']);}})['catch'](function(_0x4bb21f){logger['error']('MailAccount,\x20%s,\x20%s',_0x40c376,_0x4bb21f);_0x249705(_0x4bb21f);});});}exports[_0xa07a('0x1a')]=function(_0x421c32){var _0xca5cbf=this;return new Promise(function(_0x4168a2,_0x362c01){return db[_0xa07a('0x1b')][_0xa07a('0x1c')]({'raw':_0x421c32[_0xa07a('0x1d')]?_0x421c32[_0xa07a('0x1d')][_0xa07a('0x1e')]===undefined?!![]:![]:!![],'where':_0x421c32['options']?_0x421c32[_0xa07a('0x1d')][_0xa07a('0x1f')]||null:null,'attributes':_0x421c32['options']?_0x421c32[_0xa07a('0x1d')][_0xa07a('0x20')]||null:null,'limit':_0x421c32['options']?_0x421c32[_0xa07a('0x1d')][_0xa07a('0x21')]||null:null,'include':_0x421c32['options']?_0x421c32[_0xa07a('0x1d')][_0xa07a('0x22')]?_[_0xa07a('0x23')](_0x421c32[_0xa07a('0x1d')]['include'],function(_0x465af0){return{'model':db[_0x465af0[_0xa07a('0x24')]],'as':_0x465af0['as'],'attributes':_0x465af0[_0xa07a('0x20')],'include':_0x465af0[_0xa07a('0x22')]?_['map'](_0x465af0['include'],function(_0x49d423){return{'model':db[_0x49d423[_0xa07a('0x24')]],'as':_0x49d423['as'],'attributes':_0x49d423[_0xa07a('0x20')],'include':_0x49d423['include']?_['map'](_0x49d423['include'],function(_0x48ee7f){return{'model':db[_0x48ee7f['model']],'as':_0x48ee7f['as'],'attributes':_0x48ee7f[_0xa07a('0x20')]};}):[]};}):[]};}):[]:[]})[_0xa07a('0xf')](function(_0x3736b8){logger['info'](_0xa07a('0x1a'),_0x421c32);logger[_0xa07a('0x11')](_0xa07a('0x1a'),_0x421c32,JSON[_0xa07a('0x13')](_0x3736b8));_0x4168a2(_0x3736b8);})[_0xa07a('0x25')](function(_0x13947e){logger[_0xa07a('0x14')](_0xa07a('0x1a'),_0x13947e['message'],_0x421c32);_0x362c01(_0xca5cbf[_0xa07a('0x14')](0x1f4,_0x13947e[_0xa07a('0x17')]));});});};exports[_0xa07a('0x26')]=function(_0x21760a){var _0x2e9528=this;return new Promise(function(_0x51882c,_0x159e9e){return db[_0xa07a('0x1b')][_0xa07a('0x27')]({'raw':_0x21760a['options']?_0x21760a[_0xa07a('0x1d')][_0xa07a('0x1e')]===undefined?!![]:![]:!![],'where':_0x21760a[_0xa07a('0x1d')]?_0x21760a[_0xa07a('0x1d')][_0xa07a('0x1f')]||null:null,'attributes':_0x21760a[_0xa07a('0x1d')]?_0x21760a[_0xa07a('0x1d')][_0xa07a('0x20')]||null:null,'include':_0x21760a[_0xa07a('0x1d')]?_0x21760a[_0xa07a('0x1d')]['include']?_[_0xa07a('0x23')](_0x21760a[_0xa07a('0x1d')][_0xa07a('0x22')],function(_0x3756d9){return{'model':db[_0x3756d9[_0xa07a('0x24')]],'as':_0x3756d9['as'],'attributes':_0x3756d9[_0xa07a('0x20')],'include':_0x3756d9[_0xa07a('0x22')]?_[_0xa07a('0x23')](_0x3756d9[_0xa07a('0x22')],function(_0x47cab3){return{'model':db[_0x47cab3[_0xa07a('0x24')]],'as':_0x47cab3['as'],'attributes':_0x47cab3[_0xa07a('0x20')],'include':_0x47cab3[_0xa07a('0x22')]?_[_0xa07a('0x23')](_0x47cab3['include'],function(_0xf56508){return{'model':db[_0xf56508[_0xa07a('0x24')]],'as':_0xf56508['as'],'attributes':_0xf56508[_0xa07a('0x20')]};}):[]};}):[]};}):[]:[]})[_0xa07a('0xf')](function(_0x531ce7){logger[_0xa07a('0x18')]('ShowMailAccount',_0x21760a);logger[_0xa07a('0x11')]('ShowMailAccount',_0x21760a,JSON[_0xa07a('0x13')](_0x531ce7));_0x51882c(_0x531ce7);})[_0xa07a('0x25')](function(_0x496d3f){logger[_0xa07a('0x14')](_0xa07a('0x26'),_0x496d3f[_0xa07a('0x17')],_0x21760a);_0x159e9e(_0x2e9528[_0xa07a('0x14')](0x1f4,_0x496d3f[_0xa07a('0x17')]));});});};exports['NotifyMailAccount']=function(_0x3eab3c){var _0x2e4444=this;return new Promise(function(_0x3daecc,_0x427704){var _0x2c1aca={'body':_0x3eab3c[_0xa07a('0x28')],'channel':_0xa07a('0x29')};var _0x2cf4fa=_[_0xa07a('0x2a')](_[_0xa07a('0x2b')](db['CmContact'][_0xa07a('0x2c')]),[_0xa07a('0x2d'),_0xa07a('0x2e'),_0xa07a('0x2f'),_0xa07a('0x30')]);var _0x238668=![];if(_0x3eab3c['body']['id']){delete _0x3eab3c[_0xa07a('0x28')]['id'];}if(_[_0xa07a('0x31')](_0x3eab3c[_0xa07a('0x28')][_0xa07a('0x32')])){return _0x427704(_0x2e4444[_0xa07a('0x14')](0x1f4,_0xa07a('0x33')));}if(_['isNil'](_0x3eab3c['body'][_0xa07a('0x28')])||_0x3eab3c['body']['body']===''){return _0x427704(_0x2e4444[_0xa07a('0x14')](0x1f4,_0xa07a('0x34')));}if(_[_0xa07a('0x31')](_0x3eab3c[_0xa07a('0x28')]['mapKey'])){return _0x427704(_0x2e4444['error'](0x1f4,_0xa07a('0x35')+_0x2cf4fa));}if(!_[_0xa07a('0x36')](_0x2cf4fa,_0x3eab3c['body'][_0xa07a('0x37')])){return _0x427704(_0x2e4444[_0xa07a('0x14')](0x1f4,_0xa07a('0x38')+_0x2cf4fa));}var _0x18655={};_0x18655[_0x3eab3c['body'][_0xa07a('0x37')]]=_0x3eab3c['body'][_0xa07a('0x32')];return db[_0xa07a('0x1b')]['find']({'where':{'id':_0x3eab3c[_0xa07a('0x39')]['id']},'include':[{'model':db[_0xa07a('0x3a')],'as':'List','include':[{'model':db[_0xa07a('0x3b')],'as':_0xa07a('0x3c'),'where':_0x18655,'limit':0x1,'order':[[_0xa07a('0x2e'),'DESC']]}]},{'model':db[_0xa07a('0x3d')],'as':_0xa07a('0x3e')},{'model':db[_0xa07a('0x3f')],'as':_0xa07a('0x40')}]})['then'](function(_0x16cb51){if(_0x16cb51&&_0x16cb51[_0xa07a('0x41')]){var _0x5559f5=_0x16cb51['get']({'plain':!![]});_0x2c1aca[_0xa07a('0x39')]=_[_0xa07a('0x42')](_0x5559f5,[_0xa07a('0x3e'),_0xa07a('0x41')]);_0x2c1aca[_0xa07a('0x43')]=_0x5559f5[_0xa07a('0x3e')];_0x2c1aca['list']=_0x5559f5[_0xa07a('0x41')];_0x2c1aca[_0xa07a('0x43')]=_[_0xa07a('0x44')](_0x2c1aca[_0xa07a('0x43')],[_0xa07a('0x45')],['asc']);if(_0x2c1aca[_0xa07a('0x39')]&&_0x2c1aca[_0xa07a('0x39')]['autoclose']){_0x2c1aca['applications'][_0xa07a('0x46')]({'id':0x0,'priority':_0x2c1aca[_0xa07a('0x43')][_0xa07a('0x47')]+0x1,'app':'close','appdata':'autoclose','interval':'*,*,*,*'});}if(_0x2c1aca[_0xa07a('0x39')]['Applications']){delete _0x2c1aca[_0xa07a('0x39')][_0xa07a('0x3e')];}if(_0x2c1aca[_0xa07a('0x39')]['List']){delete _0x2c1aca['account']['List'];}if(_0x5559f5[_0xa07a('0x41')]['Contacts'][_0xa07a('0x47')]){return _0x5559f5[_0xa07a('0x41')][_0xa07a('0x3c')][0x0];}var _0x34d381=_[_0xa07a('0xa')](_0x3eab3c['body'],{'firstName':_0x3eab3c[_0xa07a('0x28')][_0xa07a('0x32')],'ListId':_0x5559f5[_0xa07a('0x30')]});_0x34d381[_0x3eab3c[_0xa07a('0x28')][_0xa07a('0x37')]]=_0x3eab3c[_0xa07a('0x28')][_0xa07a('0x32')];return db['CmContact'][_0xa07a('0x48')](_0x34d381);}else{throw new Error(_0xa07a('0x49'));}})[_0xa07a('0xf')](function(_0x1c09a5){_0x2c1aca[_0xa07a('0x4a')]=_0x1c09a5;if(_0x1c09a5){if(!_0x3eab3c[_0xa07a('0x28')][_0xa07a('0x17')]['messageId']){_0x3eab3c[_0xa07a('0x28')][_0xa07a('0x17')][_0xa07a('0x4b')]=rs[_0xa07a('0x4c')]()+'\x20'+_0x3eab3c[_0xa07a('0x28')][_0xa07a('0x17')]['from'];}var _0x3a92c3={'ContactId':_0x1c09a5['id'],'MailAccountId':_0x3eab3c[_0xa07a('0x39')]['id'],'inReplyTo':_0x3eab3c[_0xa07a('0x28')]['message']['messageId'],'to':_0x3eab3c['body']['message'][_0xa07a('0x32')],'cc':_0x3eab3c[_0xa07a('0x28')]['message']['cc'],'subject':_0x3eab3c[_0xa07a('0x28')]['message'][_0xa07a('0x4d')],'attach':_0x3eab3c[_0xa07a('0x28')]['message'][_0xa07a('0x4e')],'lastMsgAt':moment()['format'](_0xa07a('0x4f')),'lastMsgDirection':'in'};return db['MailInteraction'][_0xa07a('0x27')]({'where':{'closed':![],'MailAccountId':_0x3eab3c[_0xa07a('0x39')]['id']},'include':[{'model':db[_0xa07a('0x50')],'as':_0xa07a('0x51'),'attributes':['messageId'],'where':{'messageId':_0x3eab3c[_0xa07a('0x28')][_0xa07a('0x17')]['inReplyTo']}}]})[_0xa07a('0xf')](function(_0xe6bf78){if(_0xe6bf78){return[_0xe6bf78,![]];}return db['MailInteraction'][_0xa07a('0x48')](_0x3a92c3)[_0xa07a('0xf')](function(_0x584c70){return[_0x584c70,!![]];});});}else{throw new Error(_0xa07a('0x52'));}})['spread'](function(_0xb94474,_0x59c8fc){if(_0xb94474){_0x238668=_0x59c8fc;if(!_0x59c8fc){return _0xb94474[_0xa07a('0x53')]({'inReplyTo':_0x3eab3c[_0xa07a('0x28')][_0xa07a('0x17')]['messageId'],'to':_0x3eab3c[_0xa07a('0x28')][_0xa07a('0x17')][_0xa07a('0x32')],'cc':_0x3eab3c[_0xa07a('0x28')][_0xa07a('0x17')]['cc'],'subject':_0x3eab3c['body']['message']['subject'],'attach':_0xb94474['attach']?_0xb94474[_0xa07a('0x4e')]:_0x3eab3c[_0xa07a('0x28')][_0xa07a('0x17')][_0xa07a('0x4e')],'substatus':null,'substatusAt':moment()[_0xa07a('0x54')](_0xa07a('0x4f')),'lastMsgAt':moment()[_0xa07a('0x54')](_0xa07a('0x4f')),'lastMsgDirection':'in'});}else{return _0xb94474;}}})[_0xa07a('0xf')](function(_0x45f7d7){_0x2c1aca[_0xa07a('0x55')]=_0x45f7d7[_0xa07a('0x56')]({'plain':!![]});_0x2c1aca[_0xa07a('0x55')][_0xa07a('0x57')]=_0x238668;return db[_0xa07a('0x50')][_0xa07a('0x48')]({'body':_0x3eab3c[_0xa07a('0x28')][_0xa07a('0x28')],'MailAccountId':_0x3eab3c[_0xa07a('0x39')]['id'],'MailInteractionId':_0x45f7d7['id'],'direction':'in','ContactId':_0x2c1aca[_0xa07a('0x4a')]['id'],'messageId':_0x3eab3c[_0xa07a('0x28')][_0xa07a('0x17')][_0xa07a('0x4b')],'from':_0x3eab3c[_0xa07a('0x28')][_0xa07a('0x17')][_0xa07a('0x32')],'to':_0x3eab3c[_0xa07a('0x28')]['message']['to'],'cc':_0x3eab3c[_0xa07a('0x28')][_0xa07a('0x17')]['cc'],'subject':_0x3eab3c[_0xa07a('0x28')][_0xa07a('0x17')][_0xa07a('0x4d')],'attach':_0x3eab3c[_0xa07a('0x28')]['message'][_0xa07a('0x4e')],'Attachments':_0x3eab3c['body'][_0xa07a('0x17')][_0xa07a('0x58')],'originTo':_0x3eab3c[_0xa07a('0x28')]['message']['originTo'],'originCc':_0x3eab3c['body'][_0xa07a('0x17')][_0xa07a('0x59')],'bcc':_0x3eab3c['body']['message'][_0xa07a('0x5a')],'ChatWebsiteId':_0x3eab3c['body'][_0xa07a('0x17')][_0xa07a('0x5b')]||null,'originChannel':_0x3eab3c[_0xa07a('0x28')][_0xa07a('0x17')][_0xa07a('0x5c')]||'Email','ChatOfflineMessageId':_0x3eab3c[_0xa07a('0x28')][_0xa07a('0x17')][_0xa07a('0x5d')]||null},{'include':[{'model':db['Attachment'],'as':_0xa07a('0x5e')}]});})[_0xa07a('0xf')](function(_0x559fab){_0x2c1aca[_0xa07a('0x17')]=_0x559fab;if(_0x2c1aca[_0xa07a('0x55')][_0xa07a('0x5f')]){return db['User'][_0xa07a('0x27')]({'attributes':['id',_0xa07a('0x60')],'where':{'id':_0x2c1aca[_0xa07a('0x55')]['UserId']}})[_0xa07a('0xf')](function(_0x2f749e){if(_0x2f749e){_0x2c1aca[_0xa07a('0x43')][_0xa07a('0x61')]({'id':0x0,'priority':0x0,'app':_0xa07a('0x62'),'appdata':_0x2f749e[_0xa07a('0x60')]+','+(_0x2c1aca['account'][_0xa07a('0x63')]||0xa),'interval':_0xa07a('0x64')});}return respondWithRpcPromise(_0xa07a('0x65'),_0xa07a('0x66'),_0x2c1aca);});}return respondWithRpcPromise('Start','startRouting',_0x2c1aca);})[_0xa07a('0xf')](function(_0x4bb6e7){_0x3daecc(_0x4bb6e7);})[_0xa07a('0x25')](function(_0x259d64){_0x427704(_0x2e4444[_0xa07a('0x14')](0x1f4,_0x259d64[_0xa07a('0x17')]));});});}; \ No newline at end of file +var _0x348c=['DESC','MailApplication','Applications','MailServerOut','Smtp','then','get','omit','applications','list','orderBy','priority','asc','length','close','autoclose','ListId','create','messageId','generate','subject','attach','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','Contact\x20not\x20found','spread','update','format','interaction','created','contact','attachments','originTo','originCc','bcc','originChannel','Email','Attachment','Attachments','User','name','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','util','bluebird','randomstring','../../config/utils','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','request','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','MailAccount,\x20%s,\x20%s','message','result','GetMailAccount','MailAccount','findAll','options','raw','attributes','include','map','model','where','ShowMailAccount','catch','body','difference','keys','CmContact','rawAttributes','CompanyId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','Contacts'];(function(_0x45f421,_0x2fc75c){var _0x50f2ab=function(_0x245ac7){while(--_0x245ac7){_0x45f421['push'](_0x45f421['shift']());}};_0x50f2ab(++_0x2fc75c);}(_0x348c,0x96));var _0xc348=function(_0x268876,_0x57e4e7){_0x268876=_0x268876-0x0;var _0x177d78=_0x348c[_0x268876];return _0x177d78;};'use strict';var _=require(_0xc348('0x0'));var util=require(_0xc348('0x1'));var moment=require('moment');var BPromise=require(_0xc348('0x2'));var rs=require(_0xc348('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc348('0x4'));var logger=require('../../config/logger')(_0xc348('0x5'));var config=require('../../config/environment');var jayson=require(_0xc348('0x6'));var client=jayson[_0xc348('0x7')]['http']({'port':0x232c});config[_0xc348('0x8')]=_[_0xc348('0x9')](config[_0xc348('0x8')],{'host':_0xc348('0xa'),'port':0x18eb});var socket=require(_0xc348('0xb'))(new Redis(config['redis']));require(_0xc348('0xc'))[_0xc348('0xd')](socket);function respondWithRpcPromise(_0x34f51d,_0x1e1954,_0x3c9a83){return new BPromise(function(_0x2b1795,_0x5c75bb){return client[_0xc348('0xe')](_0x34f51d,_0x3c9a83)['then'](function(_0x5a2b3a){logger[_0xc348('0xf')]('MailAccount,\x20%s,\x20%s',_0x1e1954,_0xc348('0x10'));logger[_0xc348('0x11')](_0xc348('0x12'),_0x1e1954,'request\x20sent',JSON[_0xc348('0x13')](_0x5a2b3a));if(_0x5a2b3a[_0xc348('0x14')]){if(_0x5a2b3a[_0xc348('0x14')][_0xc348('0x15')]===0x1f4){logger[_0xc348('0x14')](_0xc348('0x16'),_0x1e1954,_0x5a2b3a[_0xc348('0x14')][_0xc348('0x17')]);return _0x5c75bb(_0x5a2b3a['error'][_0xc348('0x17')]);}logger[_0xc348('0x14')](_0xc348('0x16'),_0x1e1954,_0x5a2b3a['error'][_0xc348('0x17')]);return _0x2b1795(_0x5a2b3a[_0xc348('0x14')][_0xc348('0x17')]);}else{logger['info'](_0xc348('0x16'),_0x1e1954,_0xc348('0x10'));_0x2b1795(_0x5a2b3a[_0xc348('0x18')]['message']);}})['catch'](function(_0x44844d){logger[_0xc348('0x14')](_0xc348('0x16'),_0x1e1954,_0x44844d);_0x5c75bb(_0x44844d);});});}exports[_0xc348('0x19')]=function(_0x18c913){var _0x278d3d=this;return new Promise(function(_0x51bb32,_0xf782f3){return db[_0xc348('0x1a')][_0xc348('0x1b')]({'raw':_0x18c913[_0xc348('0x1c')]?_0x18c913[_0xc348('0x1c')][_0xc348('0x1d')]===undefined?!![]:![]:!![],'where':_0x18c913[_0xc348('0x1c')]?_0x18c913['options']['where']||null:null,'attributes':_0x18c913[_0xc348('0x1c')]?_0x18c913[_0xc348('0x1c')][_0xc348('0x1e')]||null:null,'limit':_0x18c913[_0xc348('0x1c')]?_0x18c913[_0xc348('0x1c')]['limit']||null:null,'include':_0x18c913['options']?_0x18c913[_0xc348('0x1c')][_0xc348('0x1f')]?_[_0xc348('0x20')](_0x18c913[_0xc348('0x1c')][_0xc348('0x1f')],function(_0x45a573){return{'model':db[_0x45a573[_0xc348('0x21')]],'as':_0x45a573['as'],'attributes':_0x45a573[_0xc348('0x1e')],'include':_0x45a573['include']?_[_0xc348('0x20')](_0x45a573['include'],function(_0x49cad6){return{'model':db[_0x49cad6[_0xc348('0x21')]],'as':_0x49cad6['as'],'attributes':_0x49cad6[_0xc348('0x1e')],'include':_0x49cad6[_0xc348('0x1f')]?_['map'](_0x49cad6[_0xc348('0x1f')],function(_0x48f767){return{'model':db[_0x48f767[_0xc348('0x21')]],'as':_0x48f767['as'],'attributes':_0x48f767['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ddf3f){logger['info']('GetMailAccount',_0x18c913);logger['debug'](_0xc348('0x19'),_0x18c913,JSON[_0xc348('0x13')](_0x1ddf3f));_0x51bb32(_0x1ddf3f);})['catch'](function(_0x2dfca2){logger['error']('GetMailAccount',_0x2dfca2[_0xc348('0x17')],_0x18c913);_0xf782f3(_0x278d3d[_0xc348('0x14')](0x1f4,_0x2dfca2[_0xc348('0x17')]));});});};exports['ShowMailAccount']=function(_0x27f72a){var _0x447f67=this;return new Promise(function(_0x35c6dc,_0xa08e74){return db['MailAccount']['find']({'raw':_0x27f72a[_0xc348('0x1c')]?_0x27f72a[_0xc348('0x1c')][_0xc348('0x1d')]===undefined?!![]:![]:!![],'where':_0x27f72a[_0xc348('0x1c')]?_0x27f72a[_0xc348('0x1c')][_0xc348('0x22')]||null:null,'attributes':_0x27f72a[_0xc348('0x1c')]?_0x27f72a[_0xc348('0x1c')][_0xc348('0x1e')]||null:null,'include':_0x27f72a[_0xc348('0x1c')]?_0x27f72a['options'][_0xc348('0x1f')]?_[_0xc348('0x20')](_0x27f72a[_0xc348('0x1c')][_0xc348('0x1f')],function(_0x222ba1){return{'model':db[_0x222ba1['model']],'as':_0x222ba1['as'],'attributes':_0x222ba1[_0xc348('0x1e')],'include':_0x222ba1['include']?_['map'](_0x222ba1[_0xc348('0x1f')],function(_0x51ce70){return{'model':db[_0x51ce70[_0xc348('0x21')]],'as':_0x51ce70['as'],'attributes':_0x51ce70[_0xc348('0x1e')],'include':_0x51ce70[_0xc348('0x1f')]?_[_0xc348('0x20')](_0x51ce70[_0xc348('0x1f')],function(_0x52a845){return{'model':db[_0x52a845[_0xc348('0x21')]],'as':_0x52a845['as'],'attributes':_0x52a845[_0xc348('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3ceda9){logger[_0xc348('0xf')](_0xc348('0x23'),_0x27f72a);logger[_0xc348('0x11')](_0xc348('0x23'),_0x27f72a,JSON[_0xc348('0x13')](_0x3ceda9));_0x35c6dc(_0x3ceda9);})[_0xc348('0x24')](function(_0x332443){logger[_0xc348('0x14')](_0xc348('0x23'),_0x332443[_0xc348('0x17')],_0x27f72a);_0xa08e74(_0x447f67[_0xc348('0x14')](0x1f4,_0x332443[_0xc348('0x17')]));});});};exports['NotifyMailAccount']=function(_0x2c0fdd){var _0x1d4bcf=this;return new Promise(function(_0x5bd5b5,_0x32838e){var _0x40c7df={'body':_0x2c0fdd[_0xc348('0x25')],'channel':'mail'};var _0x5a7039=_[_0xc348('0x26')](_[_0xc348('0x27')](db[_0xc348('0x28')][_0xc348('0x29')]),['createdAt','updatedAt',_0xc348('0x2a'),'ListId']);var _0x50633d=![];if(_0x2c0fdd['body']['id']){delete _0x2c0fdd[_0xc348('0x25')]['id'];}if(_[_0xc348('0x2b')](_0x2c0fdd['body'][_0xc348('0x2c')])){return _0x32838e(_0x1d4bcf[_0xc348('0x14')](0x1f4,'from\x20is\x20mandatory'));}if(_['isNil'](_0x2c0fdd[_0xc348('0x25')][_0xc348('0x25')])||_0x2c0fdd['body']['body']===''){return _0x32838e(_0x1d4bcf[_0xc348('0x14')](0x1f4,_0xc348('0x2d')));}if(_['isNil'](_0x2c0fdd['body'][_0xc348('0x2e')])){return _0x32838e(_0x1d4bcf[_0xc348('0x14')](0x1f4,_0xc348('0x2f')+_0x5a7039));}if(!_['includes'](_0x5a7039,_0x2c0fdd['body'][_0xc348('0x2e')])){return _0x32838e(_0x1d4bcf[_0xc348('0x14')](0x1f4,_0xc348('0x30')+_0x5a7039));}var _0x1e7852={};_0x1e7852[_0x2c0fdd[_0xc348('0x25')][_0xc348('0x2e')]]=_0x2c0fdd[_0xc348('0x25')]['from'];return db['MailAccount'][_0xc348('0x31')]({'where':{'id':_0x2c0fdd[_0xc348('0x32')]['id']},'include':[{'model':db[_0xc348('0x33')],'as':_0xc348('0x34'),'include':[{'model':db[_0xc348('0x28')],'as':_0xc348('0x35'),'where':_0x1e7852,'limit':0x1,'order':[['updatedAt',_0xc348('0x36')]]}]},{'model':db[_0xc348('0x37')],'as':_0xc348('0x38')},{'model':db[_0xc348('0x39')],'as':_0xc348('0x3a')}]})[_0xc348('0x3b')](function(_0x10cfbd){if(_0x10cfbd&&_0x10cfbd[_0xc348('0x34')]){var _0x1dcb26=_0x10cfbd[_0xc348('0x3c')]({'plain':!![]});_0x40c7df[_0xc348('0x32')]=_[_0xc348('0x3d')](_0x1dcb26,['Applications',_0xc348('0x34')]);_0x40c7df[_0xc348('0x3e')]=_0x1dcb26[_0xc348('0x38')];_0x40c7df[_0xc348('0x3f')]=_0x1dcb26[_0xc348('0x34')];_0x40c7df[_0xc348('0x3e')]=_[_0xc348('0x40')](_0x40c7df['applications'],[_0xc348('0x41')],[_0xc348('0x42')]);if(_0x40c7df[_0xc348('0x32')]&&_0x40c7df[_0xc348('0x32')]['autoclose']){_0x40c7df[_0xc348('0x3e')]['push']({'id':0x0,'priority':_0x40c7df[_0xc348('0x3e')][_0xc348('0x43')]+0x1,'app':_0xc348('0x44'),'appdata':_0xc348('0x45'),'interval':'*,*,*,*'});}if(_0x40c7df[_0xc348('0x32')][_0xc348('0x38')]){delete _0x40c7df[_0xc348('0x32')][_0xc348('0x38')];}if(_0x40c7df[_0xc348('0x32')][_0xc348('0x34')]){delete _0x40c7df[_0xc348('0x32')][_0xc348('0x34')];}if(_0x1dcb26[_0xc348('0x34')][_0xc348('0x35')][_0xc348('0x43')]){return _0x1dcb26[_0xc348('0x34')][_0xc348('0x35')][0x0];}var _0x331c69=_[_0xc348('0x9')](_0x2c0fdd[_0xc348('0x25')],{'firstName':_0x2c0fdd[_0xc348('0x25')]['from'],'ListId':_0x1dcb26[_0xc348('0x46')]});_0x331c69[_0x2c0fdd[_0xc348('0x25')][_0xc348('0x2e')]]=_0x2c0fdd[_0xc348('0x25')][_0xc348('0x2c')];return db[_0xc348('0x28')][_0xc348('0x47')](_0x331c69);}else{throw new Error('List\x20not\x20found');}})[_0xc348('0x3b')](function(_0x3523bd){_0x40c7df['contact']=_0x3523bd;if(_0x3523bd){if(!_0x2c0fdd[_0xc348('0x25')][_0xc348('0x17')][_0xc348('0x48')]){_0x2c0fdd[_0xc348('0x25')][_0xc348('0x17')][_0xc348('0x48')]=rs[_0xc348('0x49')]()+'\x20'+_0x2c0fdd[_0xc348('0x25')][_0xc348('0x17')]['from'];}var _0x5ed2b8={'ContactId':_0x3523bd['id'],'MailAccountId':_0x2c0fdd[_0xc348('0x32')]['id'],'inReplyTo':_0x2c0fdd['body'][_0xc348('0x17')][_0xc348('0x48')],'to':_0x2c0fdd['body'][_0xc348('0x17')]['from'],'cc':_0x2c0fdd[_0xc348('0x25')][_0xc348('0x17')]['cc'],'subject':_0x2c0fdd[_0xc348('0x25')]['message'][_0xc348('0x4a')],'attach':_0x2c0fdd[_0xc348('0x25')][_0xc348('0x17')][_0xc348('0x4b')],'lastMsgAt':moment()['format'](_0xc348('0x4c')),'lastMsgDirection':'in'};return db[_0xc348('0x4d')][_0xc348('0x31')]({'where':{'closed':![],'MailAccountId':_0x2c0fdd[_0xc348('0x32')]['id']},'include':[{'model':db[_0xc348('0x4e')],'as':_0xc348('0x4f'),'attributes':['messageId'],'where':{'messageId':_0x2c0fdd['body'][_0xc348('0x17')]['inReplyTo']}}]})[_0xc348('0x3b')](function(_0x160838){if(_0x160838){return[_0x160838,![]];}return db['MailInteraction']['create'](_0x5ed2b8)[_0xc348('0x3b')](function(_0x238968){return[_0x238968,!![]];});});}else{throw new Error(_0xc348('0x50'));}})[_0xc348('0x51')](function(_0x39b0ce,_0x2451e9){if(_0x39b0ce){_0x50633d=_0x2451e9;if(!_0x2451e9){return _0x39b0ce[_0xc348('0x52')]({'inReplyTo':_0x2c0fdd[_0xc348('0x25')]['message'][_0xc348('0x48')],'to':_0x2c0fdd[_0xc348('0x25')][_0xc348('0x17')][_0xc348('0x2c')],'cc':_0x2c0fdd['body'][_0xc348('0x17')]['cc'],'subject':_0x2c0fdd[_0xc348('0x25')]['message'][_0xc348('0x4a')],'attach':_0x39b0ce['attach']?_0x39b0ce[_0xc348('0x4b')]:_0x2c0fdd[_0xc348('0x25')][_0xc348('0x17')][_0xc348('0x4b')],'substatus':null,'substatusAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0xc348('0x53')](_0xc348('0x4c')),'lastMsgDirection':'in'});}else{return _0x39b0ce;}}})[_0xc348('0x3b')](function(_0x1be0f0){_0x40c7df[_0xc348('0x54')]=_0x1be0f0[_0xc348('0x3c')]({'plain':!![]});_0x40c7df[_0xc348('0x54')][_0xc348('0x55')]=_0x50633d;return db[_0xc348('0x4e')][_0xc348('0x47')]({'body':_0x2c0fdd[_0xc348('0x25')]['body'],'MailAccountId':_0x2c0fdd['account']['id'],'MailInteractionId':_0x1be0f0['id'],'direction':'in','ContactId':_0x40c7df[_0xc348('0x56')]['id'],'messageId':_0x2c0fdd['body']['message'][_0xc348('0x48')],'from':_0x2c0fdd[_0xc348('0x25')]['message']['from'],'to':_0x2c0fdd[_0xc348('0x25')]['message']['to'],'cc':_0x2c0fdd['body']['message']['cc'],'subject':_0x2c0fdd[_0xc348('0x25')][_0xc348('0x17')][_0xc348('0x4a')],'attach':_0x2c0fdd[_0xc348('0x25')]['message'][_0xc348('0x4b')],'Attachments':_0x2c0fdd[_0xc348('0x25')][_0xc348('0x17')][_0xc348('0x57')],'originTo':_0x2c0fdd[_0xc348('0x25')][_0xc348('0x17')][_0xc348('0x58')],'originCc':_0x2c0fdd['body'][_0xc348('0x17')][_0xc348('0x59')],'bcc':_0x2c0fdd['body'][_0xc348('0x17')][_0xc348('0x5a')],'ChatWebsiteId':_0x2c0fdd[_0xc348('0x25')][_0xc348('0x17')]['ChatWebsiteId']||null,'originChannel':_0x2c0fdd[_0xc348('0x25')][_0xc348('0x17')][_0xc348('0x5b')]||_0xc348('0x5c'),'ChatOfflineMessageId':_0x2c0fdd[_0xc348('0x25')][_0xc348('0x17')]['ChatOfflineMessageId']||null},{'include':[{'model':db[_0xc348('0x5d')],'as':_0xc348('0x5e')}]});})[_0xc348('0x3b')](function(_0x4f1a93){_0x40c7df[_0xc348('0x17')]=_0x4f1a93;if(_0x40c7df[_0xc348('0x54')]['UserId']){return db[_0xc348('0x5f')][_0xc348('0x31')]({'attributes':['id',_0xc348('0x60')],'where':{'id':_0x40c7df[_0xc348('0x54')]['UserId']}})['then'](function(_0x481efa){if(_0x481efa){_0x40c7df[_0xc348('0x3e')]['unshift']({'id':0x0,'priority':0x0,'app':_0xc348('0x61'),'appdata':_0x481efa['name']+','+(_0x40c7df['account'][_0xc348('0x62')]||0xa),'interval':_0xc348('0x63')});}return respondWithRpcPromise(_0xc348('0x64'),'startRouting',_0x40c7df);});}return respondWithRpcPromise(_0xc348('0x64'),_0xc348('0x65'),_0x40c7df);})['then'](function(_0x529c69){_0x5bd5b5(_0x529c69);})['catch'](function(_0x4e8a8f){_0x32838e(_0x1d4bcf[_0xc348('0x14')](0x1f4,_0x4e8a8f[_0xc348('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 187a2dc..b1656a9 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 _0xfe56=['register','mailAccount:','./mailAccount.events','save','remove','update','emit','removeListener'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfe56,0x9a));var _0x6fe5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xfe56[_0x20a584];return _0x4b41a8;};'use strict';var MailAccountEvents=require(_0x6fe5('0x0'));var events=[_0x6fe5('0x1'),_0x6fe5('0x2'),_0x6fe5('0x3')];function createListener(_0x40c4f4,_0x3260eb){return function(_0x4aead5){_0x3260eb[_0x6fe5('0x4')](_0x40c4f4,_0x4aead5);};}function removeListener(_0x371188,_0x5eeb4e){return function(){MailAccountEvents[_0x6fe5('0x5')](_0x371188,_0x5eeb4e);};}exports[_0x6fe5('0x6')]=function(_0x970ad6){for(var _0x343808=0x0,_0x7684fd=events['length'];_0x343808<_0x7684fd;_0x343808++){var _0x3d757e=events[_0x343808];var _0x5053fe=createListener(_0x6fe5('0x7')+_0x3d757e,_0x970ad6);MailAccountEvents['on'](_0x3d757e,_0x5053fe);}}; \ No newline at end of file +var _0xcdf0=['./mailAccount.events','save','remove','update','register','length','mailAccount:'];(function(_0x5bf9cc,_0x632d62){var _0xfed799=function(_0x1102de){while(--_0x1102de){_0x5bf9cc['push'](_0x5bf9cc['shift']());}};_0xfed799(++_0x632d62);}(_0xcdf0,0xa8));var _0x0cdf=function(_0x28a0df,_0x249ac1){_0x28a0df=_0x28a0df-0x0;var _0xdf7b06=_0xcdf0[_0x28a0df];return _0xdf7b06;};'use strict';var MailAccountEvents=require(_0x0cdf('0x0'));var events=[_0x0cdf('0x1'),_0x0cdf('0x2'),_0x0cdf('0x3')];function createListener(_0xcf2a96,_0x56f648){return function(_0x107772){_0x56f648['emit'](_0xcf2a96,_0x107772);};}function removeListener(_0x2e6209,_0x5076b0){return function(){MailAccountEvents['removeListener'](_0x2e6209,_0x5076b0);};}exports[_0x0cdf('0x4')]=function(_0x330940){for(var _0x1a58bd=0x0,_0x658ceb=events[_0x0cdf('0x5')];_0x1a58bd<_0x658ceb;_0x1a58bd++){var _0x5415ef=events[_0x1a58bd];var _0x47f3ea=createListener(_0x0cdf('0x6')+_0x5415ef,_0x330940);MailAccountEvents['on'](_0x5415ef,_0x47f3ea);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index d8e4856..e1bafed 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 _0xb4d5=['express','../../config/environment','get','/:id','isAuthenticated','show','put','update','destroy','multer','util','path','connect-timeout'];(function(_0x1c4c1a,_0x5482f4){var _0x1d6acb=function(_0x3ddcd3){while(--_0x3ddcd3){_0x1c4c1a['push'](_0x1c4c1a['shift']());}};_0x1d6acb(++_0x5482f4);}(_0xb4d5,0x19c));var _0x5b4d=function(_0x3fb0e1,_0x422caa){_0x3fb0e1=_0x3fb0e1-0x0;var _0x2b9d5f=_0xb4d5[_0x3fb0e1];return _0x2b9d5f;};'use strict';var multer=require(_0x5b4d('0x0'));var util=require(_0x5b4d('0x1'));var path=require(_0x5b4d('0x2'));var timeout=require(_0x5b4d('0x3'));var express=require(_0x5b4d('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5b4d('0x5'));var controller=require('./mailApplication.controller');router[_0x5b4d('0x6')](_0x5b4d('0x7'),auth[_0x5b4d('0x8')](),controller[_0x5b4d('0x9')]);router[_0x5b4d('0xa')](_0x5b4d('0x7'),auth[_0x5b4d('0x8')](),controller[_0x5b4d('0xb')]);router['delete'](_0x5b4d('0x7'),auth[_0x5b4d('0x8')](),controller[_0x5b4d('0xc')]);module['exports']=router; \ No newline at end of file +var _0xf56a=['util','path','connect-timeout','fs-extra','../../components/interaction/service','./mailApplication.controller','get','/:id','show','put','update','isAuthenticated','multer'];(function(_0x502b33,_0x50ae8d){var _0x5e2653=function(_0x5705ec){while(--_0x5705ec){_0x502b33['push'](_0x502b33['shift']());}};_0x5e2653(++_0x50ae8d);}(_0xf56a,0x178));var _0xaf56=function(_0x210718,_0x247b55){_0x210718=_0x210718-0x0;var _0x541bfc=_0xf56a[_0x210718];return _0x541bfc;};'use strict';var multer=require(_0xaf56('0x0'));var util=require(_0xaf56('0x1'));var path=require(_0xaf56('0x2'));var timeout=require(_0xaf56('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xaf56('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xaf56('0x5'));var config=require('../../config/environment');var controller=require(_0xaf56('0x6'));router[_0xaf56('0x7')](_0xaf56('0x8'),auth['isAuthenticated'](),controller[_0xaf56('0x9')]);router[_0xaf56('0xa')](_0xaf56('0x8'),auth['isAuthenticated'](),controller[_0xaf56('0xb')]);router['delete']('/:id',auth[_0xaf56('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index cb0f3d3..d0924ee 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 _0x3959=['STRING','INTEGER','noop','TEXT'];(function(_0x7a84de,_0x5eb7c6){var _0x7d3c31=function(_0xe4823b){while(--_0xe4823b){_0x7a84de['push'](_0x7a84de['shift']());}};_0x7d3c31(++_0x5eb7c6);}(_0x3959,0x71));var _0x9395=function(_0x20dced,_0x3c283e){_0x20dced=_0x20dced-0x0;var _0x516b54=_0x3959[_0x20dced];return _0x516b54;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x9395('0x0')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9395('0x1')},'appdata':{'type':Sequelize[_0x9395('0x2')]()},'description':{'type':Sequelize[_0x9395('0x3')]},'interval':{'type':Sequelize[_0x9395('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x1215=['*,*,*,*','sequelize','INTEGER','STRING','noop','TEXT'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x1215,0x115));var _0x5121=function(_0x47131b,_0x4750e6){_0x47131b=_0x47131b-0x0;var _0x40ccf1=_0x1215[_0x47131b];return _0x40ccf1;};'use strict';var Sequelize=require(_0x5121('0x0'));module['exports']={'priority':{'type':Sequelize[_0x5121('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x5121('0x2')],'allowNull':![],'defaultValue':_0x5121('0x3')},'appdata':{'type':Sequelize[_0x5121('0x4')]()},'description':{'type':Sequelize[_0x5121('0x2')]},'interval':{'type':Sequelize[_0x5121('0x2')],'defaultValue':_0x5121('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index e7e0650..642dd30 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 _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(_0x10f447,_0x79566a){var _0x3e7c39=function(_0x3c108b){while(--_0x3c108b){_0x10f447['push'](_0x10f447['shift']());}};_0x3e7c39(++_0x79566a);}(_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 +var _0xcb91=['send','show','params','keys','rawAttributes','query','intersection','attributes','fields','length','model','includeAll','include','merge','options','MailApplication','find','catch','body','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','stack','name'];(function(_0x471204,_0x3ab980){var _0x349fd3=function(_0x1f92fd){while(--_0x1f92fd){_0x471204['push'](_0x471204['shift']());}};_0x349fd3(++_0x3ab980);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4cce65,_0x40021e){_0x4cce65=_0x4cce65-0x0;var _0x4d1b45=_0xcb91[_0x4cce65];return _0x4d1b45;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1cb9('0x0'));var jsonpatch=require(_0x1cb9('0x1'));var rp=require(_0x1cb9('0x2'));var moment=require(_0x1cb9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1cb9('0x4'));var util=require(_0x1cb9('0x5'));var path=require('path');var sox=require(_0x1cb9('0x6'));var csv=require(_0x1cb9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1cb9('0x8'));var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0xc'));var authService=require(_0x1cb9('0xd'));var qs=require(_0x1cb9('0xe'));var as=require(_0x1cb9('0xf'));var hardwareService=require(_0x1cb9('0x10'));var logger=require('../../config/logger')(_0x1cb9('0x11'));var utils=require(_0x1cb9('0x12'));var config=require(_0x1cb9('0x13'));var licenseUtil=require(_0x1cb9('0x14'));var db=require(_0x1cb9('0x15'))['db'];function respondWithStatusCode(_0x5445e1,_0x5e3c19){_0x5e3c19=_0x5e3c19||0xcc;return function(_0x59dec3){if(_0x59dec3){return _0x5445e1[_0x1cb9('0x16')](_0x5e3c19);}return _0x5445e1[_0x1cb9('0x17')](_0x5e3c19)[_0x1cb9('0x18')]();};}function respondWithResult(_0x1c714f,_0x56884d){_0x56884d=_0x56884d||0xc8;return function(_0x397727){if(_0x397727){return _0x1c714f[_0x1cb9('0x17')](_0x56884d)[_0x1cb9('0x19')](_0x397727);}};}function respondWithFilteredResult(_0x8dfa55,_0x3e2d11){return function(_0x5806d8){if(_0x5806d8){var _0x5572cb=typeof _0x3e2d11[_0x1cb9('0x1a')]===_0x1cb9('0x1b')&&typeof _0x3e2d11[_0x1cb9('0x1c')]===_0x1cb9('0x1b');var _0x3e21e0=_0x5806d8[_0x1cb9('0x1d')];var _0x23d3a9=_0x5572cb?0x0:_0x3e2d11['offset'];var _0x479d43=_0x5572cb?_0x5806d8[_0x1cb9('0x1d')]:_0x3e2d11[_0x1cb9('0x1a')]+_0x3e2d11[_0x1cb9('0x1c')];var _0x31481a;if(_0x479d43>=_0x3e21e0){_0x479d43=_0x3e21e0;_0x31481a=0xc8;}else{_0x31481a=0xce;}_0x8dfa55[_0x1cb9('0x17')](_0x31481a);return _0x8dfa55[_0x1cb9('0x1e')](_0x1cb9('0x1f'),_0x23d3a9+'-'+_0x479d43+'/'+_0x3e21e0)['json'](_0x5806d8);}return null;};}function patchUpdates(_0x559bcc){return function(_0x1a5a72){try{jsonpatch['apply'](_0x1a5a72,_0x559bcc,!![]);}catch(_0x4750b1){return BPromise[_0x1cb9('0x20')](_0x4750b1);}return _0x1a5a72['save']();};}function saveUpdates(_0x599275,_0x2e3854){return function(_0x325637){if(_0x325637){return _0x325637[_0x1cb9('0x21')](_0x599275)[_0x1cb9('0x22')](function(_0x45b8d3){return _0x45b8d3;});}return null;};}function removeEntity(_0x27db16,_0x59ebea){return function(_0x55b232){if(_0x55b232){return _0x55b232[_0x1cb9('0x23')]()['then'](function(){_0x27db16[_0x1cb9('0x17')](0xcc)[_0x1cb9('0x18')]();});}};}function handleEntityNotFound(_0x69b4c8,_0x44d3c4){return function(_0x43a100){if(!_0x43a100){_0x69b4c8['sendStatus'](0x194);}return _0x43a100;};}function handleError(_0x195f16,_0x9df250){_0x9df250=_0x9df250||0x1f4;return function(_0x4c8d76){logger[_0x1cb9('0x24')](_0x4c8d76[_0x1cb9('0x25')]);if(_0x4c8d76[_0x1cb9('0x26')]){delete _0x4c8d76[_0x1cb9('0x26')];}_0x195f16[_0x1cb9('0x17')](_0x9df250)[_0x1cb9('0x27')](_0x4c8d76);};}exports[_0x1cb9('0x28')]=function(_0xb644b3,_0x41e5c2){var _0x9de64b={'raw':!![],'where':{'id':_0xb644b3[_0x1cb9('0x29')]['id']}},_0x48888d={};_0x48888d['model']=_[_0x1cb9('0x2a')](db['MailApplication'][_0x1cb9('0x2b')]);_0x48888d[_0x1cb9('0x2c')]=_[_0x1cb9('0x2a')](_0xb644b3[_0x1cb9('0x2c')]);_0x48888d['filters']=_[_0x1cb9('0x2d')](_0x48888d['model'],_0x48888d[_0x1cb9('0x2c')]);_0x9de64b[_0x1cb9('0x2e')]=_[_0x1cb9('0x2d')](_0x48888d['model'],qs[_0x1cb9('0x2f')](_0xb644b3['query'][_0x1cb9('0x2f')]));_0x9de64b['attributes']=_0x9de64b[_0x1cb9('0x2e')][_0x1cb9('0x30')]?_0x9de64b[_0x1cb9('0x2e')]:_0x48888d[_0x1cb9('0x31')];if(_0xb644b3['query'][_0x1cb9('0x32')]){_0x9de64b[_0x1cb9('0x33')]=[{'all':!![]}];}_0x9de64b=_[_0x1cb9('0x34')]({},_0x9de64b,_0xb644b3[_0x1cb9('0x35')]);return db[_0x1cb9('0x36')][_0x1cb9('0x37')](_0x9de64b)[_0x1cb9('0x22')](handleEntityNotFound(_0x41e5c2,null))[_0x1cb9('0x22')](respondWithResult(_0x41e5c2,null))[_0x1cb9('0x38')](handleError(_0x41e5c2,null));};exports[_0x1cb9('0x21')]=function(_0x294eec,_0x26b950){if(_0x294eec[_0x1cb9('0x39')]['id']){delete _0x294eec['body']['id'];}return db['MailApplication'][_0x1cb9('0x37')]({'where':{'id':_0x294eec[_0x1cb9('0x29')]['id']}})[_0x1cb9('0x22')](handleEntityNotFound(_0x26b950,null))[_0x1cb9('0x22')](saveUpdates(_0x294eec[_0x1cb9('0x39')],null))[_0x1cb9('0x22')](respondWithResult(_0x26b950,null))[_0x1cb9('0x38')](handleError(_0x26b950,null));};exports[_0x1cb9('0x23')]=function(_0x4d3e39,_0x2aa59b){return db[_0x1cb9('0x36')][_0x1cb9('0x37')]({'where':{'id':_0x4d3e39['params']['id']}})[_0x1cb9('0x22')](handleEntityNotFound(_0x2aa59b,null))['then'](removeEntity(_0x2aa59b,null))[_0x1cb9('0x38')](handleError(_0x2aa59b,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 458fbed..c0d9805 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 _0x6515=['MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','path','rimraf','../../config/environment','./mailApplication.attributes','exports','define'];(function(_0x2d69e1,_0x43f881){var _0x9b5140=function(_0x374b86){while(--_0x374b86){_0x2d69e1['push'](_0x2d69e1['shift']());}};_0x9b5140(++_0x43f881);}(_0x6515,0x12f));var _0x5651=function(_0x589473,_0x32a2e8){_0x589473=_0x589473-0x0;var _0x18cc1d=_0x6515[_0x589473];return _0x18cc1d;};'use strict';var _=require(_0x5651('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5651('0x1'));var moment=require(_0x5651('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5651('0x3'));var rimraf=require(_0x5651('0x4'));var config=require(_0x5651('0x5'));var attributes=require(_0x5651('0x6'));module[_0x5651('0x7')]=function(_0x3931cb,_0x309856){return _0x3931cb[_0x5651('0x8')](_0x5651('0x9'),attributes,{'tableName':_0x5651('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5651('0xb'),'collate':_0x5651('0xc')});}; \ No newline at end of file +var _0x2a7d=['MailApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailApplication.attributes','exports','define'];(function(_0x5570c2,_0x12c406){var _0x1f320c=function(_0x242a06){while(--_0x242a06){_0x5570c2['push'](_0x5570c2['shift']());}};_0x1f320c(++_0x12c406);}(_0x2a7d,0xc6));var _0xd2a7=function(_0x46720b,_0x232685){_0x46720b=_0x46720b-0x0;var _0x2de15c=_0x2a7d[_0x46720b];return _0x2de15c;};'use strict';var _=require(_0xd2a7('0x0'));var util=require(_0xd2a7('0x1'));var logger=require(_0xd2a7('0x2'))(_0xd2a7('0x3'));var moment=require(_0xd2a7('0x4'));var BPromise=require(_0xd2a7('0x5'));var rp=require(_0xd2a7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd2a7('0x7'));var config=require(_0xd2a7('0x8'));var attributes=require(_0xd2a7('0x9'));module[_0xd2a7('0xa')]=function(_0x496877,_0x33f5f2){return _0x496877[_0xd2a7('0xb')](_0xd2a7('0xc'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xd2a7('0xd')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index e33c247..3f94e38 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 _0x76ea=['debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','UpdateMailApplication','MailApplication','options','raw','where','then','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','MailApplication,\x20%s,\x20%s','request\x20sent'];(function(_0x552192,_0x4d9370){var _0x6b7953=function(_0x4bccbf){while(--_0x4bccbf){_0x552192['push'](_0x552192['shift']());}};_0x6b7953(++_0x4d9370);}(_0x76ea,0x1b2));var _0xa76e=function(_0x26e437,_0x2055ef){_0x26e437=_0x26e437-0x0;var _0x2cbed6=_0x76ea[_0x26e437];return _0x2cbed6;};'use strict';var _=require(_0xa76e('0x0'));var util=require(_0xa76e('0x1'));var moment=require(_0xa76e('0x2'));var BPromise=require(_0xa76e('0x3'));var rs=require(_0xa76e('0x4'));var fs=require('fs');var Redis=require(_0xa76e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa76e('0x6'));var logger=require('../../config/logger')(_0xa76e('0x7'));var config=require(_0xa76e('0x8'));var jayson=require(_0xa76e('0x9'));var client=jayson[_0xa76e('0xa')][_0xa76e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3fdd74,_0x116ae9,_0xbdfd42){return new BPromise(function(_0x5f2fd5,_0x36e4fd){return client['request'](_0x3fdd74,_0xbdfd42)['then'](function(_0x1a3014){logger['info'](_0xa76e('0xc'),_0x116ae9,_0xa76e('0xd'));logger[_0xa76e('0xe')](_0xa76e('0xf'),_0x116ae9,_0xa76e('0xd'),JSON[_0xa76e('0x10')](_0x1a3014));if(_0x1a3014['error']){if(_0x1a3014[_0xa76e('0x11')]['code']===0x1f4){logger[_0xa76e('0x11')](_0xa76e('0xc'),_0x116ae9,_0x1a3014[_0xa76e('0x11')][_0xa76e('0x12')]);return _0x36e4fd(_0x1a3014['error'][_0xa76e('0x12')]);}logger['error'](_0xa76e('0xc'),_0x116ae9,_0x1a3014[_0xa76e('0x11')][_0xa76e('0x12')]);return _0x5f2fd5(_0x1a3014[_0xa76e('0x11')][_0xa76e('0x12')]);}else{logger['info'](_0xa76e('0xc'),_0x116ae9,_0xa76e('0xd'));_0x5f2fd5(_0x1a3014[_0xa76e('0x13')][_0xa76e('0x12')]);}})['catch'](function(_0x4ac4de){logger[_0xa76e('0x11')](_0xa76e('0xc'),_0x116ae9,_0x4ac4de);_0x36e4fd(_0x4ac4de);});});}exports[_0xa76e('0x14')]=function(_0x5df091){var _0x12a111=this;return new Promise(function(_0x10261a,_0x276eb6){return db[_0xa76e('0x15')]['update'](_0x5df091['body'],{'raw':_0x5df091[_0xa76e('0x16')]?_0x5df091[_0xa76e('0x16')][_0xa76e('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5df091['options']?_0x5df091[_0xa76e('0x16')][_0xa76e('0x18')]||null:null,'attributes':_0x5df091[_0xa76e('0x16')]?_0x5df091[_0xa76e('0x16')]['attributes']||null:null,'limit':_0x5df091[_0xa76e('0x16')]?_0x5df091[_0xa76e('0x16')]['limit']||null:null})[_0xa76e('0x19')](function(_0x29ecbd){logger[_0xa76e('0x1a')](_0xa76e('0x14'),_0x5df091);logger['debug'](_0xa76e('0x14'),_0x5df091,JSON[_0xa76e('0x10')](_0x29ecbd));_0x10261a(_0x29ecbd);})[_0xa76e('0x1b')](function(_0x12a307){logger[_0xa76e('0x11')](_0xa76e('0x14'),_0x12a307[_0xa76e('0x12')],_0x5df091);_0x276eb6(_0x12a111['error'](0x1f4,_0x12a307[_0xa76e('0x12')]));});});}; \ No newline at end of file +var _0x5d9d=['catch','MailApplication','body','options','raw','where','attributes','UpdateMailApplication','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','then','debug','request\x20sent','stringify','error','code','MailApplication,\x20%s,\x20%s','message','info','result'];(function(_0x1983ec,_0x2aa4a2){var _0x46d9dc=function(_0xb7e303){while(--_0xb7e303){_0x1983ec['push'](_0x1983ec['shift']());}};_0x46d9dc(++_0x2aa4a2);}(_0x5d9d,0xcc));var _0xd5d9=function(_0x3f45fb,_0x5d9ea1){_0x3f45fb=_0x3f45fb-0x0;var _0x113f7a=_0x5d9d[_0x3f45fb];return _0x113f7a;};'use strict';var _=require('lodash');var util=require(_0xd5d9('0x0'));var moment=require(_0xd5d9('0x1'));var BPromise=require(_0xd5d9('0x2'));var rs=require(_0xd5d9('0x3'));var fs=require('fs');var Redis=require(_0xd5d9('0x4'));var db=require(_0xd5d9('0x5'))['db'];var utils=require(_0xd5d9('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xd5d9('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd5d9('0x8')][_0xd5d9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x9db4db,_0x216b07,_0x4918ad){return new BPromise(function(_0x12df13,_0x396244){return client['request'](_0x9db4db,_0x4918ad)[_0xd5d9('0xa')](function(_0x401a9a){logger['info']('MailApplication,\x20%s,\x20%s',_0x216b07,'request\x20sent');logger[_0xd5d9('0xb')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x216b07,_0xd5d9('0xc'),JSON[_0xd5d9('0xd')](_0x401a9a));if(_0x401a9a['error']){if(_0x401a9a[_0xd5d9('0xe')][_0xd5d9('0xf')]===0x1f4){logger[_0xd5d9('0xe')](_0xd5d9('0x10'),_0x216b07,_0x401a9a[_0xd5d9('0xe')][_0xd5d9('0x11')]);return _0x396244(_0x401a9a[_0xd5d9('0xe')]['message']);}logger[_0xd5d9('0xe')](_0xd5d9('0x10'),_0x216b07,_0x401a9a[_0xd5d9('0xe')]['message']);return _0x12df13(_0x401a9a[_0xd5d9('0xe')][_0xd5d9('0x11')]);}else{logger[_0xd5d9('0x12')](_0xd5d9('0x10'),_0x216b07,_0xd5d9('0xc'));_0x12df13(_0x401a9a[_0xd5d9('0x13')][_0xd5d9('0x11')]);}})[_0xd5d9('0x14')](function(_0x2f2733){logger['error'](_0xd5d9('0x10'),_0x216b07,_0x2f2733);_0x396244(_0x2f2733);});});}exports['UpdateMailApplication']=function(_0x456587){var _0x3c81cc=this;return new Promise(function(_0x499e67,_0x18c8c9){return db[_0xd5d9('0x15')]['update'](_0x456587[_0xd5d9('0x16')],{'raw':_0x456587[_0xd5d9('0x17')]?_0x456587['options'][_0xd5d9('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x456587[_0xd5d9('0x17')]?_0x456587[_0xd5d9('0x17')][_0xd5d9('0x19')]||null:null,'attributes':_0x456587[_0xd5d9('0x17')]?_0x456587[_0xd5d9('0x17')][_0xd5d9('0x1a')]||null:null,'limit':_0x456587[_0xd5d9('0x17')]?_0x456587[_0xd5d9('0x17')]['limit']||null:null})[_0xd5d9('0xa')](function(_0x586498){logger[_0xd5d9('0x12')]('UpdateMailApplication',_0x456587);logger[_0xd5d9('0xb')](_0xd5d9('0x1b'),_0x456587,JSON[_0xd5d9('0xd')](_0x586498));_0x499e67(_0x586498);})[_0xd5d9('0x14')](function(_0xb2245f){logger[_0xd5d9('0xe')](_0xd5d9('0x1b'),_0xb2245f[_0xd5d9('0x11')],_0x456587);_0x18c8c9(_0x3c81cc[_0xd5d9('0xe')](0x1f4,_0xb2245f[_0xd5d9('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 0170468..38dff3d 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 _0x96cb=['/:id','show','/:id/messages','getMessages','download','post','addMessage','/:id/tags','tracked','mail','addTags','put','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','removeTags','exports','express','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','index','/describe','isAuthenticated','describe'];(function(_0x4bea66,_0x1b18e5){var _0x54abf7=function(_0x3cdb99){while(--_0x3cdb99){_0x4bea66['push'](_0x4bea66['shift']());}};_0x54abf7(++_0x1b18e5);}(_0x96cb,0x67));var _0xb96c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x96cb[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0xb96c('0x0'));var router=express['Router']();var auth=require(_0xb96c('0x1'));var interaction=require(_0xb96c('0x2'));var controller=require(_0xb96c('0x3'));router[_0xb96c('0x4')]('/',auth['isAuthenticated'](),controller[_0xb96c('0x5')]);router['get'](_0xb96c('0x6'),auth[_0xb96c('0x7')](),controller[_0xb96c('0x8')]);router['get'](_0xb96c('0x9'),auth[_0xb96c('0x7')](),controller[_0xb96c('0xa')]);router[_0xb96c('0x4')](_0xb96c('0xb'),auth[_0xb96c('0x7')](),controller[_0xb96c('0xc')]);router['get']('/:id/download',auth[_0xb96c('0x7')](),controller[_0xb96c('0xd')]);router['post']('/',auth[_0xb96c('0x7')](),controller['create']);router[_0xb96c('0xe')](_0xb96c('0xb'),auth[_0xb96c('0x7')](),controller[_0xb96c('0xf')]);router['post'](_0xb96c('0x10'),auth[_0xb96c('0x7')](),interaction[_0xb96c('0x11')](_0xb96c('0x12'),'mailinteraction:addtags'),controller[_0xb96c('0x13')]);router[_0xb96c('0x14')]('/:id',auth[_0xb96c('0x7')](),interaction['tracked']('mail',_0xb96c('0x15')),controller[_0xb96c('0x16')]);router[_0xb96c('0x17')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0xb96c('0x12'),_0xb96c('0x18')),controller[_0xb96c('0x19')]);router[_0xb96c('0x17')](_0xb96c('0x10'),auth[_0xb96c('0x7')](),controller[_0xb96c('0x1a')]);module[_0xb96c('0x1b')]=router; \ No newline at end of file +var _0x5257=['download','post','addMessage','/:id/tags','mail','mailinteraction:addtags','put','mailinteraction:update','update','delete','tracked','destroy','removeTags','exports','express','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages'];(function(_0x4de877,_0x340170){var _0xb2cfeb=function(_0x488634){while(--_0x488634){_0x4de877['push'](_0x4de877['shift']());}};_0xb2cfeb(++_0x340170);}(_0x5257,0x72));var _0x7525=function(_0x119d5a,_0x19b457){_0x119d5a=_0x119d5a-0x0;var _0x15bff4=_0x5257[_0x119d5a];return _0x15bff4;};'use strict';var express=require(_0x7525('0x0'));var router=express['Router']();var auth=require(_0x7525('0x1'));var interaction=require(_0x7525('0x2'));var controller=require(_0x7525('0x3'));router[_0x7525('0x4')]('/',auth[_0x7525('0x5')](),controller['index']);router['get'](_0x7525('0x6'),auth['isAuthenticated'](),controller[_0x7525('0x7')]);router[_0x7525('0x4')](_0x7525('0x8'),auth[_0x7525('0x5')](),controller[_0x7525('0x9')]);router[_0x7525('0x4')](_0x7525('0xa'),auth[_0x7525('0x5')](),controller['getMessages']);router[_0x7525('0x4')]('/:id/download',auth[_0x7525('0x5')](),controller[_0x7525('0xb')]);router['post']('/',auth[_0x7525('0x5')](),controller['create']);router[_0x7525('0xc')](_0x7525('0xa'),auth[_0x7525('0x5')](),controller[_0x7525('0xd')]);router['post'](_0x7525('0xe'),auth[_0x7525('0x5')](),interaction['tracked'](_0x7525('0xf'),_0x7525('0x10')),controller['addTags']);router[_0x7525('0x11')]('/:id',auth[_0x7525('0x5')](),interaction['tracked'](_0x7525('0xf'),_0x7525('0x12')),controller[_0x7525('0x13')]);router[_0x7525('0x14')]('/:id',auth[_0x7525('0x5')](),interaction[_0x7525('0x15')](_0x7525('0xf'),'mailinteraction:destroy'),controller[_0x7525('0x16')]);router['delete'](_0x7525('0xe'),auth[_0x7525('0x5')](),controller[_0x7525('0x17')]);module[_0x7525('0x18')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index f373a0c..a7e00b6 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 _0x8c77=['BOOLEAN','DATE','STRING','TEXT','ENUM','out','sequelize','iconv'];(function(_0x283127,_0x54d4d5){var _0x43da5d=function(_0x10947f){while(--_0x10947f){_0x283127['push'](_0x283127['shift']());}};_0x43da5d(++_0x54d4d5);}(_0x8c77,0x1d6));var _0x78c7=function(_0x3e9ce0,_0x20d0e1){_0x3e9ce0=_0x3e9ce0-0x0;var _0x51ef60=_0x8c77[_0x3e9ce0];return _0x51ef60;};'use strict';var Sequelize=require(_0x78c7('0x0'));var iconv=require(_0x78c7('0x1'));module['exports']={'closed':{'type':Sequelize[_0x78c7('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x78c7('0x3')]},'disposition':{'type':Sequelize[_0x78c7('0x4')]},'secondDisposition':{'type':Sequelize[_0x78c7('0x4')]},'thirdDisposition':{'type':Sequelize[_0x78c7('0x4')]},'note':{'type':Sequelize[_0x78c7('0x4')]},'inReplyTo':{'type':Sequelize[_0x78c7('0x4')](0x1fe)},'to':{'type':Sequelize[_0x78c7('0x4')]},'cc':{'type':Sequelize[_0x78c7('0x5')]('long')},'subject':{'type':Sequelize[_0x78c7('0x5')]()},'attach':{'type':Sequelize[_0x78c7('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x78c7('0x3')]},'substatus':{'type':Sequelize[_0x78c7('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x78c7('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x78c7('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x78c7('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x78c7('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xc298=['ENUM','out','iconv','BOOLEAN','STRING','TEXT','long','DATE'];(function(_0xdc9149,_0x2a85ab){var _0x4c18be=function(_0x236b45){while(--_0x236b45){_0xdc9149['push'](_0xdc9149['shift']());}};_0x4c18be(++_0x2a85ab);}(_0xc298,0x142));var _0x8c29=function(_0x5b1687,_0x557f6c){_0x5b1687=_0x5b1687-0x0;var _0x5f57cb=_0xc298[_0x5b1687];return _0x5f57cb;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0x8c29('0x0'));module['exports']={'closed':{'type':Sequelize[_0x8c29('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x8c29('0x2')]},'secondDisposition':{'type':Sequelize[_0x8c29('0x2')]},'thirdDisposition':{'type':Sequelize[_0x8c29('0x2')]},'note':{'type':Sequelize[_0x8c29('0x2')]},'inReplyTo':{'type':Sequelize[_0x8c29('0x2')](0x1fe)},'to':{'type':Sequelize[_0x8c29('0x2')]},'cc':{'type':Sequelize[_0x8c29('0x3')](_0x8c29('0x4'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0x8c29('0x1')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x8c29('0x5')]},'substatus':{'type':Sequelize[_0x8c29('0x2')](0x3c)},'substatusAt':{'type':Sequelize[_0x8c29('0x5')]},'firstMsgDirection':{'type':Sequelize[_0x8c29('0x6')]('in',_0x8c29('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8c29('0x5')]},'lastMsgDirection':{'type':Sequelize[_0x8c29('0x6')]('in',_0x8c29('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x8c29('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index ce0bc1e..add40d7 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(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0xb10b,0x12a));var _0xbb10=function(_0x47df54,_0x1aeb61){_0x47df54=_0x47df54-0x0;var _0x261b87=_0xb10b[_0x47df54];return _0x261b87;};'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 _0xa9e0=['o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','Setting','enableEmailPreview','all','rows','show','params','includeAll','include','options','create','body','addMessage','ids','omit','getMessages','nolimit','MailInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','true','addTags','setTags','Tag','mailInteractionTags:save','download','join','root','server','tmp','attachments','Attachment','Attachments','subject','Messages','get','mkdirSync','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','existsSync','readFileSync','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','util','lodash','squel','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','defaults','socket.io-emitter','redis','./mailInteraction.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','send','Users','fullname','Tags','split','forEach','push','TagIds','MailMessage','findOne','out','-id','plainBody','lastMsgText','trimStart','catch','index','MailInteraction','rawAttributes','fieldName','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','sort','filters','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','type','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','keys','some','compact','where','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','group','QueryTypes','SELECT','clone','i.id','order','contactName','DESC','t.id\x20IN\x20?','resolve','MailAccountId','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgDirection','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.MailAccountId','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname'];(function(_0x595dd0,_0x1473e4){var _0x9e3cde=function(_0x4e0471){while(--_0x4e0471){_0x595dd0['push'](_0x595dd0['shift']());}};_0x9e3cde(++_0x1473e4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x0a9e('0x3'));var path=require('path');var fs=require('fs');var _=require(_0x0a9e('0x4'));var squel=require(_0x0a9e('0x5'));var juice=require(_0x0a9e('0x6'));var Redis=require(_0x0a9e('0x7'));var qs=require(_0x0a9e('0x8'));var as=require('../../components/parsers/advancedSearch');var logger=require(_0x0a9e('0x9'))(_0x0a9e('0xa'));var config=require(_0x0a9e('0xb'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x0a9e('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0a9e('0xd'))(new Redis(config[_0x0a9e('0xe')]));require(_0x0a9e('0xf'))[_0x0a9e('0x10')](socket);function respondWithStatusCode(_0xfeb75b,_0xbd1168){_0xbd1168=_0xbd1168||0xcc;return function(_0x4a4c56){if(_0x4a4c56){return _0xfeb75b['sendStatus'](_0xbd1168);}return _0xfeb75b['status'](_0xbd1168)['end']();};}function respondWithResult(_0x273d4d,_0x36471c){_0x36471c=_0x36471c||0xc8;return function(_0xd5b662){if(_0xd5b662){return _0x273d4d[_0x0a9e('0x11')](_0x36471c)[_0x0a9e('0x12')](_0xd5b662);}};}function respondWithFilteredResult(_0x69aeb7,_0x5db4b0){return function(_0x4283ce){if(_0x4283ce){var _0x239b12=typeof _0x5db4b0[_0x0a9e('0x13')]===_0x0a9e('0x14')&&typeof _0x5db4b0[_0x0a9e('0x15')]===_0x0a9e('0x14');var _0x52a03d=_0x4283ce[_0x0a9e('0x16')];var _0x5d0880=_0x239b12?0x0:_0x5db4b0[_0x0a9e('0x13')];var _0x519dfd=_0x239b12?_0x4283ce[_0x0a9e('0x16')]:_0x5db4b0[_0x0a9e('0x13')]+_0x5db4b0['limit'];var _0x225616;if(_0x519dfd>=_0x52a03d){_0x519dfd=_0x52a03d;_0x225616=0xc8;}else{_0x225616=0xce;}_0x69aeb7['status'](_0x225616);return _0x69aeb7[_0x0a9e('0x17')](_0x0a9e('0x18'),_0x5d0880+'-'+_0x519dfd+'/'+_0x52a03d)[_0x0a9e('0x12')](_0x4283ce);}return null;};}function saveUpdates(_0x205fd6){return function(_0x31b1ca){if(_0x31b1ca){return _0x31b1ca[_0x0a9e('0x19')](_0x205fd6)[_0x0a9e('0x1a')](function(_0x20559e){return _0x20559e;});}return null;};}function removeEntity(_0x1314ae){return function(_0x112016){if(_0x112016){return _0x112016[_0x0a9e('0x1b')]()[_0x0a9e('0x1a')](function(){_0x1314ae['status'](0xcc)[_0x0a9e('0x1c')]();});}};}function handleEntityNotFound(_0x155cce){return function(_0x53682f){if(!_0x53682f){_0x155cce[_0x0a9e('0x1d')](0x194);}return _0x53682f;};}function handleError(_0x5a09ef,_0x588269){_0x588269=_0x588269||0x1f4;return function(_0x3a02e1){logger[_0x0a9e('0x1e')](_0x3a02e1[_0x0a9e('0x1f')]);if(_0x3a02e1[_0x0a9e('0x20')]){delete _0x3a02e1['name'];}_0x5a09ef[_0x0a9e('0x11')](_0x588269)[_0x0a9e('0x21')](_0x3a02e1);};}function getInteractionUsers(_0x3b45bc,_0x4d00e6){return new BPromise(function(_0x370d86,_0x42ac8f){try{if(_0x4d00e6[_0x3b45bc['id']]){_0x3b45bc[_0x0a9e('0x22')]=_['map'](_0x4d00e6[_0x3b45bc['id']],function(_0x59181e){return{'id':_0x59181e['id'],'fullname':_0x59181e[_0x0a9e('0x23')]};});}}catch(_0x3a8e58){_0x42ac8f(_0x3a8e58);}_0x370d86(_0x3b45bc);});}function getInteractionTags(_0x40c424,_0x33161b){return new BPromise(function(_0x526cf3,_0x384319){try{if(_0x40c424['TagIds']){_0x40c424[_0x0a9e('0x24')]=[];_0x40c424['TagIds'][_0x0a9e('0x25')](',')[_0x0a9e('0x26')](function(_0x25fba9){_0x40c424[_0x0a9e('0x24')][_0x0a9e('0x27')](_0x33161b[_0x25fba9]);});}delete _0x40c424[_0x0a9e('0x28')];}catch(_0x11c3b6){_0x384319(_0x11c3b6);}_0x526cf3(_0x40c424);});}function getLastMessageText(_0x14de77){return new BPromise(function(_0x5a101a,_0x3652a7){return db[_0x0a9e('0x29')][_0x0a9e('0x2a')]({'where':{'$and':[{'MailInteractionId':_0x14de77['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x0a9e('0x2b')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x0a9e('0x2c'),'raw':!![]})[_0x0a9e('0x1a')](function(_0x1843b2){if(_0x1843b2&&_0x1843b2[_0x0a9e('0x2d')]){_0x14de77[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x1843b2[_0x0a9e('0x2d')]);}_0x5a101a(_0x14de77);})[_0x0a9e('0x30')](function(_0x1dbde2){_0x3652a7(_0x1dbde2);});});}function updateMailInteraction(_0x540530,_0x426950,_0x5d1e0e,_0x2407f9){return new BPromise(function(_0x3ae878,_0x1122db){return getInteractionUsers(_0x540530,_0x5d1e0e)[_0x0a9e('0x1a')](function(_0x25ce3a){return getInteractionTags(_0x25ce3a,_0x426950);})['then'](function(_0x66c1d2){if(_0x2407f9){_0x3ae878(getLastMessageText(_0x66c1d2));}else{_0x3ae878(_0x66c1d2);}})[_0x0a9e('0x30')](function(_0x40cb85){_0x1122db(_0x40cb85);});});}exports[_0x0a9e('0x31')]=function(_0x2b45ea,_0x409319){var _0x332d35={},_0x39e565={},_0x5583a4={'count':0x0,'rows':[]};var _0x44295a=_['map'](db[_0x0a9e('0x32')][_0x0a9e('0x33')],function(_0x2b7e7f){return{'name':_0x2b7e7f[_0x0a9e('0x34')],'type':_0x2b7e7f['type'][_0x0a9e('0x35')]};});_0x39e565[_0x0a9e('0x36')]=_[_0x0a9e('0x37')](_0x44295a,_0x0a9e('0x20'));_0x39e565['query']=_['keys'](_0x2b45ea[_0x0a9e('0x38')]);_0x39e565['filters']=_[_0x0a9e('0x39')](_0x39e565[_0x0a9e('0x36')],_0x39e565[_0x0a9e('0x38')]);_0x332d35[_0x0a9e('0x3a')]=_['intersection'](_0x39e565[_0x0a9e('0x36')],qs[_0x0a9e('0x3b')](_0x2b45ea[_0x0a9e('0x38')]['fields']));_0x332d35[_0x0a9e('0x3a')]=_0x332d35[_0x0a9e('0x3a')][_0x0a9e('0x3c')]?_0x332d35['attributes']:_0x39e565['model'];if(!_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x3d')]('nolimit')){_0x332d35[_0x0a9e('0x15')]=qs[_0x0a9e('0x15')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x15')]);_0x332d35['offset']=qs['offset'](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x13')]);}_0x332d35['order']=qs[_0x0a9e('0x3e')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x3e')]);_0x332d35['where']=qs[_0x0a9e('0x3f')](_[_0x0a9e('0x40')](_0x2b45ea[_0x0a9e('0x38')],_0x39e565[_0x0a9e('0x3f')]),_0x44295a);var _0x13cb1f=[];var _0xeaa5e5=squel[_0x0a9e('0x41')]()[_0x0a9e('0x42')]('id')[_0x0a9e('0x42')](_0x0a9e('0x20'))[_0x0a9e('0x42')](_0x0a9e('0x43'))[_0x0a9e('0x44')](_0x0a9e('0x45'));var _0x37f6cc=squel['select']()['field'](_0x0a9e('0x46'))[_0x0a9e('0x42')](_0x0a9e('0x47'))[_0x0a9e('0x42')](_0x0a9e('0x48'))[_0x0a9e('0x44')](_0x0a9e('0x49'),'ui')[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'u',_0x0a9e('0x4c'));var _0x2c2cb0=squel[_0x0a9e('0x41')]()['from'](_0x0a9e('0x4d'),'i')[_0x0a9e('0x4a')](_0x0a9e('0x4e'),'c',_0x0a9e('0x4f'))[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'o',_0x0a9e('0x50'))[_0x0a9e('0x4a')]('mail_accounts','a',_0x0a9e('0x51'))['left_join'](_0x0a9e('0x52'),'me',_0x0a9e('0x53'))[_0x0a9e('0x4a')]('mail_interaction_has_tags','it',_0x0a9e('0x54'))[_0x0a9e('0x4a')](_0x0a9e('0x45'),'t',_0x0a9e('0x55'));var _0x45c845=squel[_0x0a9e('0x56')]();var _0x45bf7f=[];var _0x5bbcde=squel[_0x0a9e('0x56')]();var _0x1bde3c;if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x57')]){_0x1bde3c=as[_0x0a9e('0x58')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x57')]);var _0x19383e=_0x1bde3c[_0x0a9e('0x59')];for(var _0x58a5c2=0x0;_0x58a5c2<_0x1bde3c[_0x0a9e('0x5a')][_0x0a9e('0x3c')];_0x58a5c2++){var _0x4f7240=_0x1bde3c['conditions'][_0x58a5c2];var _0x5ddf84='i';var _0x1adfee=_[_0x0a9e('0x5b')](_0x44295a,[_0x0a9e('0x20'),_0x4f7240[_0x0a9e('0x42')]]);if(!_0x1adfee){switch(_0x4f7240[_0x0a9e('0x42')]){case _0x0a9e('0x5c'):if(_0x4f7240[_0x0a9e('0x5d')]==0x1){_0x2c2cb0[_0x0a9e('0x5e')]('`'+_0x4f7240['field']+'`\x20=\x200');}else{_0x2c2cb0['having']('`'+_0x4f7240[_0x0a9e('0x42')]+_0x0a9e('0x5f'));}break;case _0x0a9e('0x60'):if(_0x4f7240['operator']===_0x0a9e('0x61')){if(_0x4f7240[_0x0a9e('0x5d')]['split']('\x20')['length']>0x1){_0x45c845[_0x19383e](_0x0a9e('0x62'),qs['getFullTextValue'](_0x4f7240[_0x0a9e('0x5d')]),null);}else{var _0x4c3845='%'+_0x4f7240[_0x0a9e('0x5d')]+'%';_0x45c845[_0x19383e](_0x0a9e('0x63'),_0x4c3845,_0x4c3845,_0x4c3845);}}else{_0x1adfee=_[_0x0a9e('0x5b')](_0x44295a,['name',_0x0a9e('0x64')]);_0x4f7240[_0x0a9e('0x42')]='ContactId';_0x2244d6=as['buildExpression'](_0x5ddf84,_0x1adfee[_0x0a9e('0x65')],_0x4f7240);_0x45c845[_0x19383e](_0x2244d6[_0x0a9e('0x66')],_0x2244d6['value'][_0x0a9e('0x67')],_0x2244d6['value'][_0x0a9e('0x1c')]);}break;case'Tag':var _0xe22ccc=_0x4f7240['value']['split'](',')['map'](function(_0x2da03c){return Number(_0x2da03c);});_0xe22ccc['forEach'](function(_0x2f7092){_0x5bbcde['or'](_0x0a9e('0x68'),'%,'+_0x2f7092+',%');});_0x45bf7f=_[_0x0a9e('0x69')](_0x45bf7f,_0xe22ccc);break;case _0x0a9e('0x6a'):if(_0x4f7240[_0x0a9e('0x6b')]===_0x0a9e('0x61')){_0x45c845[_0x19383e](_0x0a9e('0x6c'),'%'+_0x4f7240[_0x0a9e('0x5d')]+'%',null);}else{_0x1adfee=_['find'](_0x44295a,[_0x0a9e('0x20'),_0x0a9e('0x6d')]);_0x4f7240[_0x0a9e('0x42')]=_0x0a9e('0x6d');_0x2244d6=as[_0x0a9e('0x6e')](_0x5ddf84,_0x1adfee[_0x0a9e('0x65')],_0x4f7240);_0x45c845[_0x19383e](_0x2244d6['text'],_0x2244d6[_0x0a9e('0x5d')][_0x0a9e('0x67')],_0x2244d6['value'][_0x0a9e('0x1c')]);}break;case'plainBody':_0x2244d6=as[_0x0a9e('0x6e')]('me',null,_0x4f7240);_0x45c845[_0x19383e](_0x2244d6['text'],_0x2244d6['value']['start'],_0x2244d6[_0x0a9e('0x5d')]['end']);break;}}else{var _0x2244d6=as[_0x0a9e('0x6e')](_0x5ddf84,_0x1adfee[_0x0a9e('0x65')],_0x4f7240);_0x45c845[_0x19383e](_0x2244d6[_0x0a9e('0x66')],_0x2244d6[_0x0a9e('0x5d')][_0x0a9e('0x67')],_0x2244d6['value'][_0x0a9e('0x1c')]);}}}else{var _0x5854cc=_(_0x2b45ea[_0x0a9e('0x38')])[_0x0a9e('0x6f')]()[_0x0a9e('0x37')](function(_0x5adf8f){return _[_0x0a9e('0x70')](_0x44295a,[_0x0a9e('0x20'),_0x5adf8f])?_0x5adf8f:undefined;})[_0x0a9e('0x71')]()[_0x0a9e('0x5d')]();if(!_['isEmpty'](_0x5854cc)){_0x5854cc[_0x0a9e('0x26')](function(_0xe05a5a){if(_0xe05a5a==='MailAccountId'){_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x73'),[][_0x0a9e('0x74')](_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a]));}else if(_0xe05a5a===_0x0a9e('0x75')){var _0x4d4a35=JSON[_0x0a9e('0x76')](_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a])[_0x0a9e('0x77')];var _0x47bb43=JSON[_0x0a9e('0x76')](_0x2b45ea['query'][_0xe05a5a])['$lte'];_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x78'),_0x4d4a35,_0x47bb43);}else{if(_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a]===_0x0a9e('0x79')){_0x2c2cb0[_0x0a9e('0x72')]('i.'+_0xe05a5a+_0x0a9e('0x7a'));}else{_0x2c2cb0[_0x0a9e('0x72')]('i.'+_0xe05a5a+_0x0a9e('0x7b'),_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a]);}}});}if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x7c')]){if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x7c')]==0x1){_0x2c2cb0[_0x0a9e('0x5e')](_0x0a9e('0x7d'));}else{_0x2c2cb0[_0x0a9e('0x5e')](_0x0a9e('0x7e'));}}if(_0x2b45ea[_0x0a9e('0x38')]['tag']){_0x45bf7f=_[_0x0a9e('0x7f')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x80')])?_0x2b45ea['query'][_0x0a9e('0x80')]:new Array(_0x2b45ea[_0x0a9e('0x38')]['tag']);_0x45bf7f[_0x0a9e('0x26')](function(_0x56e31e){_0x5bbcde['or'](_0x0a9e('0x68'),'%,'+_0x56e31e+',%');});}if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x81')]){var _0x4a43a8=_0x2b45ea['query']['filter'][_0x0a9e('0x82')]('\x5c','\x5c\x5c')[_0x0a9e('0x82')](/'/g,'\x27\x27');if(qs[_0x0a9e('0x83')](_0x4a43a8)){_0x45c845['or'](_0x0a9e('0x84'),_0x4a43a8+'%');}else if(qs[_0x0a9e('0x85')](_0x4a43a8)){_0x45c845['or'](_0x0a9e('0x86'),_0x4a43a8+'%');}else{_0x45c845['or'](_0x0a9e('0x87'),qs[_0x0a9e('0x88')](_0x4a43a8))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0a9e('0x88')](_0x4a43a8));}}}_0x2c2cb0[_0x0a9e('0x72')](_0x45c845);_0x2c2cb0[_0x0a9e('0x89')]('i.id');var _0x2bdc44={'type':db['Sequelize'][_0x0a9e('0x8a')][_0x0a9e('0x8b')],'raw':!![]};var _0x4c46c1=_0x2c2cb0[_0x0a9e('0x8c')]();_0x4c46c1[_0x0a9e('0x42')](_0x0a9e('0x8d'));_0x4c46c1[_0x0a9e('0x42')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0a9e('0x5c'));if(_0x332d35[_0x0a9e('0x8e')]){_0x332d35[_0x0a9e('0x8e')][_0x0a9e('0x26')](function(_0x5b7fc3){var _0x109ccb=_0x5b7fc3[0x0]===_0x0a9e('0x8f')?_0x5b7fc3[0x0]:'i.'+_0x5b7fc3[0x0];_0x2c2cb0[_0x0a9e('0x8e')](_0x109ccb,_0x5b7fc3[0x1]===_0x0a9e('0x90')?![]:!![]);});}if(!_['isEmpty'](_0x45bf7f)){_0x2c2cb0[_0x0a9e('0x5e')](_0x5bbcde);_0x4c46c1[_0x0a9e('0x72')](_0x0a9e('0x91'),_0x45bf7f);}BPromise[_0x0a9e('0x92')]()[_0x0a9e('0x1a')](function(){if(!_0x1bde3c){if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x93')])return;_0x4c46c1[_0x0a9e('0x72')](_0x0a9e('0x94'));_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x94'));return;}if(_0x2b45ea[_0x0a9e('0x95')][_0x0a9e('0x96')]!==_0x0a9e('0x97'))return;return _0x2b45ea['user'][_0x0a9e('0x98')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x1a')](function(_0xc599b3){if(_['isEmpty'](_0xc599b3)){_0x4c46c1[_0x0a9e('0x72')](_0x0a9e('0x99'));_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x99'));}else{_0x4c46c1['where']('i.MailAccountId\x20IN\x20?',_[_0x0a9e('0x37')](_0xc599b3,'id'));_0x2c2cb0[_0x0a9e('0x72')]('i.MailAccountId\x20IN\x20?',_[_0x0a9e('0x37')](_0xc599b3,'id'));}});})['then'](function(){if(_0x2b45ea[_0x0a9e('0x95')][_0x0a9e('0x96')]==='agent'&&!_0x1bde3c&&!_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x93')])return[];return db[_0x0a9e('0x9a')][_0x0a9e('0x38')](_0x4c46c1[_0x0a9e('0x9b')](),_0x2bdc44);})[_0x0a9e('0x1a')](function(_0x444f1f){_0x5583a4['count']=_0x444f1f[_0x0a9e('0x3c')];if(_0x5583a4[_0x0a9e('0x16')]===0x0)return[];return db[_0x0a9e('0x9a')][_0x0a9e('0x38')](_0xeaa5e5['toString'](),_0x2bdc44)[_0x0a9e('0x1a')](function(_0xf0db1){_0x13cb1f=_['keyBy'](_0xf0db1,'id');_0x2bdc44=_[_0x0a9e('0x9c')](_0x2bdc44,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x3b')]){_0x332d35[_0x0a9e('0x3a')][_0x0a9e('0x26')](function(_0x5af453){_0x2c2cb0['field']('i.'+_0x5af453);});}else{_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0x9d'),_0x0a9e('0x5c'));_0x2c2cb0['field'](_0x0a9e('0x9e'),_0x0a9e('0x9f'));_0x2c2cb0['field']('a.mandatoryDisposition',_0x0a9e('0xa0'));_0x2c2cb0['field']('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0x8d'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa1'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa2'));_0x2c2cb0['field'](_0x0a9e('0xa3'));_0x2c2cb0['field'](_0x0a9e('0xa4'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa5'));_0x2c2cb0[_0x0a9e('0x42')]('i.lastMsgAt');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa6'));_0x2c2cb0[_0x0a9e('0x42')]('i.subject');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa7'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa8'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa9'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xaa'));_0x2c2cb0['field'](_0x0a9e('0xab'));_0x2c2cb0[_0x0a9e('0x42')]('i.ContactId');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xac'));_0x2c2cb0[_0x0a9e('0x42')]('i.UserId');_0x2c2cb0[_0x0a9e('0x42')]('c.firstName',_0x0a9e('0xad'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xae'),_0x0a9e('0xaf'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb0'),_0x0a9e('0xb1'));_0x2c2cb0[_0x0a9e('0x42')]('c.phone',_0x0a9e('0xb2'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb3'),_0x0a9e('0xb4'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb5'),_0x0a9e('0xb6'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb7'),_0x0a9e('0xb8'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb9'),_0x0a9e('0xba'));_0x2c2cb0['field'](_0x0a9e('0xbb'),_0x0a9e('0x28'));}if(_0x332d35[_0x0a9e('0x15')])_0x2c2cb0[_0x0a9e('0x15')](_0x332d35[_0x0a9e('0x15')]);if(_0x332d35['offset'])_0x2c2cb0[_0x0a9e('0x13')](_0x332d35[_0x0a9e('0x13')]);return db['sequelize'][_0x0a9e('0x38')](_0x2c2cb0['toString'](),_0x2bdc44);})[_0x0a9e('0x1a')](function(_0x27041d){if(_0x27041d[_0x0a9e('0x3c')]>0x0)_0x37f6cc[_0x0a9e('0x72')]('ui.MailInteractionId\x20IN\x20?',_[_0x0a9e('0x37')](_0x27041d,'id'));return db['sequelize'][_0x0a9e('0x38')](_0x37f6cc[_0x0a9e('0x9b')](),_0x2bdc44)['then'](function(_0x231c6a){var _0x63c9f7=_[_0x0a9e('0xbc')](_0x231c6a,'MailInteractionId');var _0x4c788f=[];return db[_0x0a9e('0xbd')][_0x0a9e('0x2a')]({'attributes':[_0x0a9e('0xbe')],'raw':!![]})[_0x0a9e('0x1a')](function(_0x3f2f40){var _0x2450a8=_0x3f2f40[_0x0a9e('0xbe')];_0x27041d[_0x0a9e('0x26')](function(_0x3f8124){_0x4c788f['push'](updateMailInteraction(_0x3f8124,_0x13cb1f,_0x63c9f7,_0x2450a8));});return BPromise[_0x0a9e('0xbf')](_0x4c788f);});});});})['then'](function(_0x287324){_0x5583a4[_0x0a9e('0xc0')]=_0x287324;return _0x5583a4;})[_0x0a9e('0x1a')](respondWithFilteredResult(_0x409319,_0x332d35))[_0x0a9e('0x30')](handleError(_0x409319,null));};exports[_0x0a9e('0xc1')]=function(_0x4e7273,_0x436313){var _0x4667bf={'raw':![],'where':{'id':_0x4e7273[_0x0a9e('0xc2')]['id']}},_0x2791c5={};_0x2791c5[_0x0a9e('0x36')]=_['keys'](db['MailInteraction'][_0x0a9e('0x33')]);_0x2791c5['query']=_[_0x0a9e('0x6f')](_0x4e7273[_0x0a9e('0x38')]);_0x2791c5[_0x0a9e('0x3f')]=_[_0x0a9e('0x39')](_0x2791c5[_0x0a9e('0x36')],_0x2791c5[_0x0a9e('0x38')]);_0x4667bf['attributes']=_['intersection'](_0x2791c5[_0x0a9e('0x36')],qs['fields'](_0x4e7273[_0x0a9e('0x38')]['fields']));_0x4667bf[_0x0a9e('0x3a')]=_0x4667bf['attributes']['length']?_0x4667bf[_0x0a9e('0x3a')]:_0x2791c5[_0x0a9e('0x36')];if(_0x4e7273['query'][_0x0a9e('0xc3')]){_0x4667bf[_0x0a9e('0xc4')]=[{'all':!![]}];}_0x4667bf=_[_0x0a9e('0x9c')]({},_0x4667bf,_0x4e7273[_0x0a9e('0xc5')]);return db[_0x0a9e('0x32')]['find'](_0x4667bf)['then'](handleEntityNotFound(_0x436313,null))[_0x0a9e('0x1a')](respondWithResult(_0x436313,null))[_0x0a9e('0x30')](handleError(_0x436313,null));};exports[_0x0a9e('0xc6')]=function(_0x24beb6,_0x59303b){return db['MailInteraction'][_0x0a9e('0xc6')](_0x24beb6[_0x0a9e('0xc7')],{})['then'](respondWithResult(_0x59303b,0xc9))[_0x0a9e('0x30')](handleError(_0x59303b,null));};exports[_0x0a9e('0x19')]=function(_0xcacabb,_0x2427d5){if(_0xcacabb[_0x0a9e('0xc7')]['id']){delete _0xcacabb[_0x0a9e('0xc7')]['id'];}return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0xcacabb[_0x0a9e('0xc2')]['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x2427d5,null))['then'](saveUpdates(_0xcacabb[_0x0a9e('0xc7')],null))[_0x0a9e('0x1a')](respondWithResult(_0x2427d5,null))[_0x0a9e('0x30')](handleError(_0x2427d5,null));};exports[_0x0a9e('0x1b')]=function(_0x1d0b02,_0x547e37){return db['MailInteraction'][_0x0a9e('0x5b')]({'where':{'id':_0x1d0b02[_0x0a9e('0xc2')]['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x547e37,null))[_0x0a9e('0x1a')](removeEntity(_0x547e37,null))[_0x0a9e('0x30')](handleError(_0x547e37,null));};exports['describe']=function(_0x1339d0,_0x3c775a){return db[_0x0a9e('0x32')]['describe']()[_0x0a9e('0x1a')](respondWithResult(_0x3c775a,null))['catch'](handleError(_0x3c775a,null));};exports[_0x0a9e('0xc8')]=function(_0x4799d4,_0x25b745){return db[_0x0a9e('0x29')][_0x0a9e('0x5b')]({'where':{'id':_0x4799d4['params']['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x25b745,null))['then'](function(_0x4383da){if(_0x4383da){return _0x4383da[_0x0a9e('0xc8')](_0x4799d4[_0x0a9e('0xc7')][_0x0a9e('0xc9')],_[_0x0a9e('0xca')](_0x4799d4[_0x0a9e('0xc7')],[_0x0a9e('0xc9'),'id'])||{});}})[_0x0a9e('0x1a')](respondWithResult(_0x25b745,null))[_0x0a9e('0x30')](handleError(_0x25b745,null));};exports[_0x0a9e('0xcb')]=function(_0x4262d0,_0xc876d4){var _0x2415fe={'raw':![],'where':{}};var _0x399def={};var _0x98c62c={'count':0x0,'rows':[]};return db[_0x0a9e('0x32')]['findOne']({'where':{'id':_0x4262d0['params']['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0xc876d4,null))['then'](function(_0x1d999b){if(_0x1d999b){_0x399def[_0x0a9e('0x36')]=_['keys'](db[_0x0a9e('0x29')][_0x0a9e('0x33')]);_0x399def[_0x0a9e('0x38')]=_[_0x0a9e('0x6f')](_0x4262d0['query']);_0x399def[_0x0a9e('0x3f')]=_[_0x0a9e('0x39')](_0x399def[_0x0a9e('0x36')],_0x399def[_0x0a9e('0x38')]);_0x2415fe['attributes']=_[_0x0a9e('0x39')](_0x399def[_0x0a9e('0x36')],qs[_0x0a9e('0x3b')](_0x4262d0['query'][_0x0a9e('0x3b')]));_0x2415fe[_0x0a9e('0x3a')]=_0x2415fe[_0x0a9e('0x3a')]['length']?_0x2415fe[_0x0a9e('0x3a')]:_0x399def[_0x0a9e('0x36')];if(!_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x3d')](_0x0a9e('0xcc'))){_0x2415fe['limit']=qs[_0x0a9e('0x15')](_0x4262d0[_0x0a9e('0x38')]['limit']);_0x2415fe[_0x0a9e('0x13')]=qs[_0x0a9e('0x13')](_0x4262d0[_0x0a9e('0x38')]['offset']);}_0x2415fe['order']=qs['sort'](_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x3e')]);_0x2415fe['where']=qs[_0x0a9e('0x3f')](_[_0x0a9e('0x40')](_0x4262d0[_0x0a9e('0x38')],_0x399def['filters']));_0x2415fe[_0x0a9e('0x72')][_0x0a9e('0xcd')]=_0x1d999b['id'];if(_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x81')]){_0x2415fe[_0x0a9e('0x72')]=_[_0x0a9e('0x9c')](_0x2415fe[_0x0a9e('0x72')],{'$or':_[_0x0a9e('0x37')](_0x2415fe[_0x0a9e('0x3a')],function(_0x5a1848){var _0x43c397={};_0x43c397[_0x5a1848]={'$like':'%'+_0x4262d0['query'][_0x0a9e('0x81')]+'%'};return _0x43c397;})});}if(_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x77')]){var _0x3cf222=_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x77')]['split'](',');var _0x1a0314={};_0x1a0314[_0x3cf222[0x0]]={'$gte':moment(_0x3cf222[0x1])[_0x0a9e('0xce')](_0x0a9e('0xcf'))};_0x2415fe[_0x0a9e('0x72')]=_['merge'](_0x2415fe[_0x0a9e('0x72')],_0x1a0314);}_0x2415fe=_[_0x0a9e('0x9c')]({},_0x2415fe,_0x4262d0[_0x0a9e('0xc5')]);return db[_0x0a9e('0x29')][_0x0a9e('0x16')]({'where':_0x2415fe[_0x0a9e('0x72')]})[_0x0a9e('0x1a')](function(_0x25931e){_0x98c62c[_0x0a9e('0x16')]=_0x25931e;if(_0x4262d0[_0x0a9e('0x38')]['includeAll']){_0x2415fe[_0x0a9e('0xc4')]=[{'all':!![]}];}return db[_0x0a9e('0x29')][_0x0a9e('0xd0')](_0x2415fe);})[_0x0a9e('0x1a')](function(_0xea8bd1){if(_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0xd1')]===_0x0a9e('0xd2')){for(var _0x566b90=0x0;_0x566b90<_0xea8bd1[_0x0a9e('0x3c')];_0x566b90++){_0xea8bd1[_0x566b90][_0x0a9e('0xc7')]=juice(_0xea8bd1[_0x566b90][_0x0a9e('0xc7')]);}}_0x98c62c['rows']=_0xea8bd1;return _0x98c62c;});}})[_0x0a9e('0x1a')](respondWithFilteredResult(_0xc876d4,_0x2415fe))[_0x0a9e('0x30')](handleError(_0xc876d4,null));};exports[_0x0a9e('0xd3')]=function(_0x97d5b5,_0x370b5e){return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0x97d5b5[_0x0a9e('0xc2')]['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x370b5e,null))[_0x0a9e('0x1a')](function(_0x5a7dad){if(_0x5a7dad){return _0x5a7dad[_0x0a9e('0xd4')](_0x97d5b5[_0x0a9e('0xc7')][_0x0a9e('0xc9')],_[_0x0a9e('0xca')](_0x97d5b5[_0x0a9e('0xc7')],[_0x0a9e('0xc9'),'id'])||{})['spread'](function(){return db[_0x0a9e('0xd5')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x97d5b5[_0x0a9e('0xc7')][_0x0a9e('0xc9')]}});})[_0x0a9e('0x1a')](function(_0x2a07d0){socket['emit'](_0x0a9e('0xd6'),{'id':Number(_0x97d5b5[_0x0a9e('0xc2')]['id']),'tags':_0x2a07d0||[]});return{'id':Number(_0x97d5b5[_0x0a9e('0xc2')]['id']),'tags':_0x2a07d0||[]};});}})[_0x0a9e('0x1a')](respondWithResult(_0x370b5e,null))[_0x0a9e('0x30')](handleError(_0x370b5e,null));};exports['removeTags']=function(_0x57b1b1,_0x9484c8){return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0x57b1b1['params']['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x9484c8,null))[_0x0a9e('0x1a')](function(_0x422f0a){if(_0x422f0a){return _0x422f0a['removeTags'](_0x57b1b1[_0x0a9e('0x38')][_0x0a9e('0xc9')]);}})[_0x0a9e('0x1a')](respondWithStatusCode(_0x9484c8,null))['catch'](handleError(_0x9484c8,null));};exports[_0x0a9e('0xd7')]=function(_0x336b30,_0x3b7213){var _0x549e03=moment()['unix']()['toString']();var _0x3b04fd=path[_0x0a9e('0xd8')](config[_0x0a9e('0xd9')],_0x0a9e('0xda'),'files',_0x0a9e('0xdb'));var _0x532424=path[_0x0a9e('0xd8')](config[_0x0a9e('0xd9')],_0x0a9e('0xda'),'files',_0x0a9e('0xdc'));var _0x33a26c=path[_0x0a9e('0xd8')](_0x3b04fd,_0x549e03);var _0x580dd6=util[_0x0a9e('0xce')]('transcript-%d-%s.zip',_0x336b30[_0x0a9e('0xc2')]['id'],_0x549e03);var _0x5c57e1=path[_0x0a9e('0xd8')](_0x3b04fd,_0x580dd6);var _0x57b7d4=[];if(_0x336b30[_0x0a9e('0x38')][_0x0a9e('0xdc')]){_0x57b7d4[_0x0a9e('0x27')]({'model':db[_0x0a9e('0xdd')],'as':_0x0a9e('0xde'),'raw':!![]});}var _0x251dd9=[{'model':db[_0x0a9e('0x29')],'as':'Messages','attributes':['id',_0x0a9e('0xc7'),_0x0a9e('0x44'),'to','cc','bcc',_0x0a9e('0xdf'),_0x0a9e('0x75')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x57b7d4}];return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0x336b30[_0x0a9e('0xc2')]['id']},'include':_0x251dd9})['then'](handleEntityNotFound(_0x3b7213,null))[_0x0a9e('0x1a')](function(_0xf49ed4){if(_0xf49ed4&&_0xf49ed4[_0x0a9e('0xe0')]){var _0x3f0d64=_0xf49ed4[_0x0a9e('0xe1')]({'plain':!![]});fs[_0x0a9e('0xe2')](_0x33a26c);return BPromise[_0x0a9e('0xe3')](_0x3f0d64[_0x0a9e('0xe0')],function(_0x22767f,_0x426c3c){var _0x56e148={'from':_0x22767f[_0x0a9e('0x44')],'to':_0x22767f['to'],'subject':_0x22767f['subject'],'html':_0x22767f[_0x0a9e('0xc7')],'headers':{'Date':moment(_0x22767f[_0x0a9e('0x75')])[_0x0a9e('0xce')](_0x0a9e('0xe4'))},'attachments':[]};if(_0x22767f['cc']){_0x56e148[_0x0a9e('0xe5')]['Cc']=_0x22767f['cc'];}if(_0x22767f[_0x0a9e('0xe6')]){_0x56e148['headers'][_0x0a9e('0xe7')]=_0x22767f[_0x0a9e('0xe6')];}return new BPromise(function(_0x2977a7,_0x55a599){if(_0x22767f[_0x0a9e('0xde')]){for(var _0x402544=0x0;_0x402544<_0x22767f[_0x0a9e('0xde')][_0x0a9e('0x3c')];_0x402544++){var _0x31e1e0=_0x22767f[_0x0a9e('0xde')][_0x402544];var _0x1e93f5=path['join'](_0x532424,_0x31e1e0[_0x0a9e('0xe8')]);if(fs[_0x0a9e('0xe9')](_0x1e93f5)){_0x56e148[_0x0a9e('0xdc')][_0x0a9e('0x27')]({'name':_0x31e1e0[_0x0a9e('0x20')],'contentType':_0x31e1e0[_0x0a9e('0x65')],'data':fs[_0x0a9e('0xea')](_0x1e93f5)});}}}emlformat['build'](_0x56e148,function(_0x5c8720,_0x10aa22){if(_0x5c8720)return _0x55a599(_0x5c8720);fs[_0x0a9e('0xeb')](path[_0x0a9e('0xd8')](_0x33a26c,util[_0x0a9e('0xce')](_0x0a9e('0xec'),_0x426c3c)),_0x10aa22);return _0x2977a7(_0x10aa22);});});})[_0x0a9e('0x1a')](function(){return new BPromise(function(_0x609711,_0x584854){zipdir(_0x33a26c,{'saveTo':_0x5c57e1},function(_0x39ea62,_0x1d7fc4){if(_0x39ea62)return _0x584854(_0x39ea62);return _0x609711(_0x1d7fc4);});})[_0x0a9e('0x1a')](function(){return new BPromise(function(_0x2675a5,_0x1b1757){rimraf(_0x33a26c,function(_0x3c6082){if(_0x3c6082)_0x1b1757(_0x3c6082);return _0x2675a5();});});})[_0x0a9e('0x1a')](function(){return _0x3b7213['download'](_0x5c57e1,_0x580dd6,function(_0x311288){if(!_0x311288)fs[_0x0a9e('0xed')](_0x5c57e1);});});});}else{return _0x3b7213[_0x0a9e('0x1d')](0xc8);}})['catch'](handleError(_0x3b7213,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index f17bd29..f552300 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 _0xef1b=['MailInteraction','MailMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','findAll','unreadMessages','emit','catch','hasOwnProperty','events','../../mysqldb'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0xef1b,0xae));var _0xbef1=function(_0x5a06df,_0x20b11e){_0x5a06df=_0x5a06df-0x0;var _0x3739a3=_0xef1b[_0x5a06df];return _0x3739a3;};'use strict';var EventEmitter=require(_0xbef1('0x0'));var MailInteraction=require(_0xbef1('0x1'))['db'][_0xbef1('0x2')];var MailMessage=require('../../mysqldb')['db'][_0xbef1('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xbef1('0x4')](0x0);var events={'afterCreate':_0xbef1('0x5'),'afterUpdate':_0xbef1('0x6'),'afterDestroy':_0xbef1('0x7')};function emitEvent(_0x28c0a8){return function(_0x30e3aa,_0x3695ce,_0x39e00){_0x30e3aa[_0xbef1('0x8')]({'attributes':['id'],'raw':!![]})[_0xbef1('0x9')](function(_0x3f292c){_0x30e3aa[_0xbef1('0xa')]('Users',_0x3f292c['map'](function(_0x1ef54e){return{'id':_0x1ef54e['id']};}));return MailMessage[_0xbef1('0xb')]({'where':{'MailInteractionId':_0x30e3aa['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3c412f){_0x30e3aa['setDataValue'](_0xbef1('0xc'),_0x3c412f['length']);MailInteractionEvents[_0xbef1('0xd')](_0x28c0a8+':'+_0x30e3aa['id'],_0x30e3aa);MailInteractionEvents[_0xbef1('0xd')](_0x28c0a8,_0x30e3aa);_0x39e00(null);})[_0xbef1('0xe')](_0x39e00(null));};}for(var e in events){if(events[_0xbef1('0xf')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0x04a3=['unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','update','then','setDataValue','Users','map','findAll'];(function(_0x1db498,_0x4589c4){var _0x5a171f=function(_0x24dd12){while(--_0x24dd12){_0x1db498['push'](_0x1db498['shift']());}};_0x5a171f(++_0x4589c4);}(_0x04a3,0x16f));var _0x304a=function(_0xdbd382,_0xd6fe19){_0xdbd382=_0xdbd382-0x0;var _0x5b8f82=_0x04a3[_0xdbd382];return _0x5b8f82;};'use strict';var EventEmitter=require(_0x304a('0x0'));var MailInteraction=require(_0x304a('0x1'))['db'][_0x304a('0x2')];var MailMessage=require('../../mysqldb')['db'][_0x304a('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x304a('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x304a('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3558ab){return function(_0x20748c,_0x383cfc,_0x56a2c9){_0x20748c['getUsers']({'attributes':['id'],'raw':!![]})[_0x304a('0x6')](function(_0x5155fb){_0x20748c[_0x304a('0x7')](_0x304a('0x8'),_0x5155fb[_0x304a('0x9')](function(_0x386943){return{'id':_0x386943['id']};}));return MailMessage[_0x304a('0xa')]({'where':{'MailInteractionId':_0x20748c['id'],'direction':'in','read':![]},'raw':!![]});})[_0x304a('0x6')](function(_0x52097a){_0x20748c['setDataValue'](_0x304a('0xb'),_0x52097a[_0x304a('0xc')]);MailInteractionEvents[_0x304a('0xd')](_0x3558ab+':'+_0x20748c['id'],_0x20748c);MailInteractionEvents[_0x304a('0xd')](_0x3558ab,_0x20748c);_0x56a2c9(null);})[_0x304a('0xe')](_0x56a2c9(null));};}for(var e in events){if(events[_0x304a('0xf')](e)){var event=events[e];MailInteraction[_0x304a('0x10')](e,emitEvent(event));}}module[_0x304a('0x11')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 0693f96..36f70e9 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 _0xcac9=['update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','substatus','changed','closed','closedAt','models','get','MailMessage'];(function(_0x20dda3,_0xfcb775){var _0x547b71=function(_0x478410){while(--_0x478410){_0x20dda3['push'](_0x20dda3['shift']());}};_0x547b71(++_0xfcb775);}(_0xcac9,0x198));var _0x9cac=function(_0x5ed54b,_0x3a2827){_0x5ed54b=_0x5ed54b-0x0;var _0x4b58c7=_0xcac9[_0x5ed54b];return _0x4b58c7;};'use strict';var _=require(_0x9cac('0x0'));var util=require(_0x9cac('0x1'));var logger=require(_0x9cac('0x2'))(_0x9cac('0x3'));var moment=require('moment');var BPromise=require(_0x9cac('0x4'));var rp=require(_0x9cac('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9cac('0x6'));var config=require(_0x9cac('0x7'));var attributes=require(_0x9cac('0x8'));module[_0x9cac('0x9')]=function(_0x5eaf12,_0x568168){return _0x5eaf12[_0x9cac('0xa')](_0x9cac('0xb'),attributes,{'tableName':_0x9cac('0xc'),'paranoid':![],'indexes':[{'name':_0x9cac('0xd'),'fields':[_0x9cac('0xe'),'to'],'type':_0x9cac('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x46a1a8,_0x929ac3,_0x544f41){if(_0x46a1a8['substatus']){_0x46a1a8[_0x9cac('0x10')]=moment()[_0x9cac('0x11')](_0x9cac('0x12'));}if(_0x46a1a8['closed']){_0x46a1a8['closedAt']=moment()[_0x9cac('0x11')](_0x9cac('0x12'));}_0x544f41(null,_0x929ac3);},'beforeUpdate':function(_0x522482,_0x232a49,_0x47a588){if(_0x522482['changed'](_0x9cac('0x13'))){_0x522482['substatusAt']=_0x522482['substatus']?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x522482[_0x9cac('0x14')](_0x9cac('0x15'))){_0x522482[_0x9cac('0x16')]=moment()[_0x9cac('0x11')](_0x9cac('0x12'));_0x522482[_0x9cac('0x13')]=null;_0x522482[_0x9cac('0x10')]=null;}_0x47a588(null,_0x522482);},'afterUpdate':function(_0xb5310,_0x3ef505,_0x27c12b){var _0x42bfef=_0x5eaf12[_0x9cac('0x17')];var _0x40e7af=_0xb5310[_0x9cac('0x18')]({'plain':!![]});if(_0x40e7af[_0x9cac('0x15')]){return _0x42bfef[_0x9cac('0x19')][_0x9cac('0x1a')]({'read':!![]},{'where':{'MailInteractionId':_0x40e7af['id']}})[_0x9cac('0x1b')](function(){_0x27c12b();})[_0x9cac('0x1c')](function(_0x2b82ba){_0x27c12b(_0x2b82ba);});}else{_0x27c12b();}}},'charset':_0x9cac('0x1d'),'collate':_0x9cac('0x1e')});}; \ No newline at end of file +var _0x35f7=['../../config/logger','path','rimraf','../../config/environment','./mailInteraction.attributes','define','fti_mail_interactions','subject','FULLTEXT','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','changed','substatus','closedAt','models','get','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','util'];(function(_0x227e00,_0x1d74ed){var _0x359bce=function(_0x4f8e03){while(--_0x4f8e03){_0x227e00['push'](_0x227e00['shift']());}};_0x359bce(++_0x1d74ed);}(_0x35f7,0x18f));var _0x735f=function(_0x5cf599,_0x8e94e9){_0x5cf599=_0x5cf599-0x0;var _0x3d4c38=_0x35f7[_0x5cf599];return _0x3d4c38;};'use strict';var _=require('lodash');var util=require(_0x735f('0x0'));var logger=require(_0x735f('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x735f('0x2'));var rimraf=require(_0x735f('0x3'));var config=require(_0x735f('0x4'));var attributes=require(_0x735f('0x5'));module['exports']=function(_0x46a744,_0x5ad3e5){return _0x46a744[_0x735f('0x6')]('MailInteraction',attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x735f('0x7'),'fields':[_0x735f('0x8'),'to'],'type':_0x735f('0x9')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x32febd,_0x46b87f,_0x12c1f4){if(_0x32febd['substatus']){_0x32febd[_0x735f('0xa')]=moment()[_0x735f('0xb')](_0x735f('0xc'));}if(_0x32febd[_0x735f('0xd')]){_0x32febd['closedAt']=moment()[_0x735f('0xb')](_0x735f('0xc'));}_0x12c1f4(null,_0x46b87f);},'beforeUpdate':function(_0x1d76de,_0x26f8c4,_0x79d8ff){if(_0x1d76de[_0x735f('0xe')]('substatus')){_0x1d76de[_0x735f('0xa')]=_0x1d76de[_0x735f('0xf')]?moment()['format'](_0x735f('0xc')):null;}if(_0x1d76de[_0x735f('0xe')](_0x735f('0xd'))){_0x1d76de[_0x735f('0x10')]=moment()[_0x735f('0xb')](_0x735f('0xc'));_0x1d76de[_0x735f('0xf')]=null;_0x1d76de[_0x735f('0xa')]=null;}_0x79d8ff(null,_0x1d76de);},'afterUpdate':function(_0x1d708b,_0x11bda8,_0x491882){var _0x347ca4=_0x46a744[_0x735f('0x11')];var _0x252b59=_0x1d708b[_0x735f('0x12')]({'plain':!![]});if(_0x252b59[_0x735f('0xd')]){return _0x347ca4[_0x735f('0x13')][_0x735f('0x14')]({'read':!![]},{'where':{'MailInteractionId':_0x252b59['id']}})[_0x735f('0x15')](function(){_0x491882();})[_0x735f('0x16')](function(_0x37d205){_0x491882(_0x37d205);});}else{_0x491882();}}},'charset':_0x735f('0x17'),'collate':_0x735f('0x18')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 28a9f61..5876dbd 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 _0x777d=['http','redis','defaults','socket.io-emitter','./mailInteraction.socket','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','attributes','limit','AddTagsToMailInteraction','find','where','addTags','ids','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x41f429,_0x5e8560){var _0x122a59=function(_0x453a89){while(--_0x453a89){_0x41f429['push'](_0x41f429['shift']());}};_0x122a59(++_0x5e8560);}(_0x777d,0x1e0));var _0xd777=function(_0x3a441a,_0x43eb56){_0x3a441a=_0x3a441a-0x0;var _0x3128a2=_0x777d[_0x3a441a];return _0x3128a2;};'use strict';var _=require(_0xd777('0x0'));var util=require('util');var moment=require(_0xd777('0x1'));var BPromise=require(_0xd777('0x2'));var rs=require(_0xd777('0x3'));var fs=require('fs');var Redis=require(_0xd777('0x4'));var db=require(_0xd777('0x5'))['db'];var utils=require(_0xd777('0x6'));var logger=require(_0xd777('0x7'))(_0xd777('0x8'));var config=require(_0xd777('0x9'));var jayson=require(_0xd777('0xa'));var client=jayson[_0xd777('0xb')][_0xd777('0xc')]({'port':0x232a});config[_0xd777('0xd')]=_[_0xd777('0xe')](config[_0xd777('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xd777('0xf'))(new Redis(config[_0xd777('0xd')]));require(_0xd777('0x10'))['register'](socket);function respondWithRpcPromise(_0x3d66c8,_0x5dde9f,_0x50748d){return new BPromise(function(_0x407d6c,_0x3d3112){return client['request'](_0x3d66c8,_0x50748d)[_0xd777('0x11')](function(_0x1e31da){logger[_0xd777('0x12')](_0xd777('0x13'),_0x5dde9f,_0xd777('0x14'));logger[_0xd777('0x15')](_0xd777('0x16'),_0x5dde9f,_0xd777('0x14'),JSON[_0xd777('0x17')](_0x1e31da));if(_0x1e31da[_0xd777('0x18')]){if(_0x1e31da[_0xd777('0x18')]['code']===0x1f4){logger[_0xd777('0x18')](_0xd777('0x13'),_0x5dde9f,_0x1e31da[_0xd777('0x18')][_0xd777('0x19')]);return _0x3d3112(_0x1e31da[_0xd777('0x18')][_0xd777('0x19')]);}logger[_0xd777('0x18')](_0xd777('0x13'),_0x5dde9f,_0x1e31da[_0xd777('0x18')][_0xd777('0x19')]);return _0x407d6c(_0x1e31da[_0xd777('0x18')]['message']);}else{logger[_0xd777('0x12')]('MailInteraction,\x20%s,\x20%s',_0x5dde9f,'request\x20sent');_0x407d6c(_0x1e31da[_0xd777('0x1a')][_0xd777('0x19')]);}})[_0xd777('0x1b')](function(_0x1fd3ea){logger[_0xd777('0x18')](_0xd777('0x13'),_0x5dde9f,_0x1fd3ea);_0x3d3112(_0x1fd3ea);});});}exports[_0xd777('0x1c')]=function(_0x28812b){var _0x2bfb61=this;return new Promise(function(_0x5d0372,_0x27a4fe){return db[_0xd777('0x1d')][_0xd777('0x1e')](_0x28812b[_0xd777('0x1f')],{'raw':_0x28812b[_0xd777('0x20')]?_0x28812b[_0xd777('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28812b[_0xd777('0x20')]?_0x28812b[_0xd777('0x20')]['where']||null:null,'attributes':_0x28812b[_0xd777('0x20')]?_0x28812b['options'][_0xd777('0x21')]||null:null,'limit':_0x28812b[_0xd777('0x20')]?_0x28812b[_0xd777('0x20')][_0xd777('0x22')]||null:null})[_0xd777('0x11')](function(_0x145be0){logger[_0xd777('0x12')](_0xd777('0x1c'),_0x28812b);logger[_0xd777('0x15')]('UpdateMailInteraction',_0x28812b,JSON[_0xd777('0x17')](_0x145be0));_0x5d0372(_0x145be0);})[_0xd777('0x1b')](function(_0x105621){logger[_0xd777('0x18')](_0xd777('0x1c'),_0x105621['message'],_0x28812b);_0x27a4fe(_0x2bfb61[_0xd777('0x18')](0x1f4,_0x105621[_0xd777('0x19')]));});});};exports[_0xd777('0x23')]=function(_0x113839){return new Promise(function(_0x483b53,_0xa09048){return db['MailInteraction'][_0xd777('0x24')]({'where':_0x113839['options']?_0x113839[_0xd777('0x20')][_0xd777('0x25')]||null:null})[_0xd777('0x11')](function(_0x323e0d){if(_0x323e0d){return _0x323e0d[_0xd777('0x26')](_0x113839[_0xd777('0x1f')]['ids'],_['omit'](_0x113839[_0xd777('0x1f')],[_0xd777('0x27'),'id'])||{});}})['spread'](function(_0xd6fea6){logger[_0xd777('0x12')](_0xd777('0x28'),_0x113839);logger[_0xd777('0x15')]('AddTags',_0x113839,JSON[_0xd777('0x17')](_0xd6fea6));_0x483b53(_0xd6fea6);})['catch'](function(_0x40e7df){logger['error'](_0xd777('0x28'),_0x40e7df[_0xd777('0x19')],_0x113839);_0xa09048(_this[_0xd777('0x18')](0x1f4,_0x40e7df[_0xd777('0x19')]));});});}; \ No newline at end of file +var _0xefe2=['message','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','AddTagsToMailInteraction','find','addTags','ids','omit','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./mailInteraction.socket','register','then','info','MailInteraction,\x20%s,\x20%s','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error'];(function(_0x37c375,_0x4fc5b7){var _0x2452ee=function(_0x52c083){while(--_0x52c083){_0x37c375['push'](_0x37c375['shift']());}};_0x2452ee(++_0x4fc5b7);}(_0xefe2,0x178));var _0x2efe=function(_0x58e319,_0x28e3ae){_0x58e319=_0x58e319-0x0;var _0x577fc2=_0xefe2[_0x58e319];return _0x577fc2;};'use strict';var _=require(_0x2efe('0x0'));var util=require(_0x2efe('0x1'));var moment=require('moment');var BPromise=require(_0x2efe('0x2'));var rs=require(_0x2efe('0x3'));var fs=require('fs');var Redis=require(_0x2efe('0x4'));var db=require(_0x2efe('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2efe('0x6'))(_0x2efe('0x7'));var config=require(_0x2efe('0x8'));var jayson=require(_0x2efe('0x9'));var client=jayson[_0x2efe('0xa')][_0x2efe('0xb')]({'port':0x232a});config[_0x2efe('0xc')]=_['defaults'](config[_0x2efe('0xc')],{'host':_0x2efe('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2efe('0xc')]));require(_0x2efe('0xe'))[_0x2efe('0xf')](socket);function respondWithRpcPromise(_0x4f3648,_0x4f402e,_0x32eca4){return new BPromise(function(_0x121fbb,_0x60f280){return client['request'](_0x4f3648,_0x32eca4)[_0x2efe('0x10')](function(_0x25e1ac){logger[_0x2efe('0x11')](_0x2efe('0x12'),_0x4f402e,'request\x20sent');logger[_0x2efe('0x13')](_0x2efe('0x14'),_0x4f402e,'request\x20sent',JSON[_0x2efe('0x15')](_0x25e1ac));if(_0x25e1ac['error']){if(_0x25e1ac['error'][_0x2efe('0x16')]===0x1f4){logger['error'](_0x2efe('0x12'),_0x4f402e,_0x25e1ac[_0x2efe('0x17')][_0x2efe('0x18')]);return _0x60f280(_0x25e1ac[_0x2efe('0x17')]['message']);}logger[_0x2efe('0x17')]('MailInteraction,\x20%s,\x20%s',_0x4f402e,_0x25e1ac[_0x2efe('0x17')]['message']);return _0x121fbb(_0x25e1ac['error'][_0x2efe('0x18')]);}else{logger[_0x2efe('0x11')](_0x2efe('0x12'),_0x4f402e,'request\x20sent');_0x121fbb(_0x25e1ac['result'][_0x2efe('0x18')]);}})[_0x2efe('0x19')](function(_0x21d12e){logger[_0x2efe('0x17')](_0x2efe('0x12'),_0x4f402e,_0x21d12e);_0x60f280(_0x21d12e);});});}exports[_0x2efe('0x1a')]=function(_0x346cad){var _0x5e11ea=this;return new Promise(function(_0x5fe657,_0x2b316b){return db[_0x2efe('0x1b')][_0x2efe('0x1c')](_0x346cad[_0x2efe('0x1d')],{'raw':_0x346cad[_0x2efe('0x1e')]?_0x346cad[_0x2efe('0x1e')][_0x2efe('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x346cad['options']?_0x346cad[_0x2efe('0x1e')][_0x2efe('0x20')]||null:null,'attributes':_0x346cad['options']?_0x346cad['options'][_0x2efe('0x21')]||null:null,'limit':_0x346cad[_0x2efe('0x1e')]?_0x346cad[_0x2efe('0x1e')]['limit']||null:null})[_0x2efe('0x10')](function(_0x400e64){logger[_0x2efe('0x11')](_0x2efe('0x1a'),_0x346cad);logger['debug'](_0x2efe('0x1a'),_0x346cad,JSON[_0x2efe('0x15')](_0x400e64));_0x5fe657(_0x400e64);})['catch'](function(_0x4a8a39){logger[_0x2efe('0x17')](_0x2efe('0x1a'),_0x4a8a39['message'],_0x346cad);_0x2b316b(_0x5e11ea[_0x2efe('0x17')](0x1f4,_0x4a8a39['message']));});});};exports[_0x2efe('0x22')]=function(_0x2db43d){return new Promise(function(_0x5ed680,_0x13bb84){return db['MailInteraction'][_0x2efe('0x23')]({'where':_0x2db43d['options']?_0x2db43d[_0x2efe('0x1e')][_0x2efe('0x20')]||null:null})[_0x2efe('0x10')](function(_0x3dfd30){if(_0x3dfd30){return _0x3dfd30[_0x2efe('0x24')](_0x2db43d[_0x2efe('0x1d')][_0x2efe('0x25')],_[_0x2efe('0x26')](_0x2db43d['body'],[_0x2efe('0x25'),'id'])||{});}})['spread'](function(_0x54aaa0){logger[_0x2efe('0x11')](_0x2efe('0x27'),_0x2db43d);logger[_0x2efe('0x13')](_0x2efe('0x27'),_0x2db43d,JSON[_0x2efe('0x15')](_0x54aaa0));_0x5ed680(_0x54aaa0);})[_0x2efe('0x19')](function(_0x24107d){logger[_0x2efe('0x17')](_0x2efe('0x27'),_0x24107d[_0x2efe('0x18')],_0x2db43d);_0x13bb84(_this[_0x2efe('0x17')](0x1f4,_0x24107d[_0x2efe('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index f1279c0..aa96362 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 _0x914e=['emit','length','./mailInteraction.events','update'];(function(_0x3b662f,_0x1ed11a){var _0x507d1b=function(_0x567bb7){while(--_0x567bb7){_0x3b662f['push'](_0x3b662f['shift']());}};_0x507d1b(++_0x1ed11a);}(_0x914e,0x146));var _0xe914=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x914e[_0x3dd15e];return _0x231fd0;};'use strict';var MailInteractionEvents=require(_0xe914('0x0'));var events=['save','remove',_0xe914('0x1')];function createListener(_0x367be0,_0x331f84){return function(_0x104b8e){_0x331f84[_0xe914('0x2')](_0x367be0,_0x104b8e);};}function removeListener(_0x20ae04,_0x255bad){return function(){MailInteractionEvents['removeListener'](_0x20ae04,_0x255bad);};}exports['register']=function(_0xe4fa4d){for(var _0x5dc826=0x0,_0x5761ca=events[_0xe914('0x3')];_0x5dc826<_0x5761ca;_0x5dc826++){var _0x138f69=events[_0x5dc826];var _0x78c5a7=createListener('mailInteraction:'+_0x138f69,_0xe4fa4d);MailInteractionEvents['on'](_0x138f69,_0x78c5a7);}}; \ No newline at end of file +var _0xa89d=['save','remove','update','emit','removeListener','register','length','mailInteraction:','./mailInteraction.events'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0xa89d,0x155));var _0xda89=function(_0x2add1d,_0x59d0c4){_0x2add1d=_0x2add1d-0x0;var _0x1cdff0=_0xa89d[_0x2add1d];return _0x1cdff0;};'use strict';var MailInteractionEvents=require(_0xda89('0x0'));var events=[_0xda89('0x1'),_0xda89('0x2'),_0xda89('0x3')];function createListener(_0x51de46,_0x1197ce){return function(_0x5cd748){_0x1197ce[_0xda89('0x4')](_0x51de46,_0x5cd748);};}function removeListener(_0x49215f,_0x399908){return function(){MailInteractionEvents[_0xda89('0x5')](_0x49215f,_0x399908);};}exports[_0xda89('0x6')]=function(_0x11d9c1){for(var _0x3ce3ab=0x0,_0x58056b=events[_0xda89('0x7')];_0x3ce3ab<_0x58056b;_0x3ce3ab++){var _0x5d826b=events[_0x3ce3ab];var _0x38190c=createListener(_0xda89('0x8')+_0x5d826b,_0x11d9c1);MailInteractionEvents['on'](_0x5d826b,_0x38190c);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index f52158a..6ddcada 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 _0x4ce5=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','index','get','/describe','isAuthenticated','/:id','show','/:id/download','download','post','mail','put','accept','/:id/reject','reject','exports','multer','path','connect-timeout'];(function(_0x3a8bfc,_0x186522){var _0x4cd56b=function(_0x35625f){while(--_0x35625f){_0x3a8bfc['push'](_0x3a8bfc['shift']());}};_0x4cd56b(++_0x186522);}(_0x4ce5,0x1b2));var _0x54ce=function(_0x62cd29,_0x36597f){_0x62cd29=_0x62cd29-0x0;var _0x1a9a41=_0x4ce5[_0x62cd29];return _0x1a9a41;};'use strict';var multer=require(_0x54ce('0x0'));var util=require('util');var path=require(_0x54ce('0x1'));var timeout=require(_0x54ce('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x54ce('0x3'));var auth=require(_0x54ce('0x4'));var interaction=require(_0x54ce('0x5'));var config=require(_0x54ce('0x6'));var controller=require(_0x54ce('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x54ce('0x8')]);router[_0x54ce('0x9')](_0x54ce('0xa'),auth[_0x54ce('0xb')](),controller['describe']);router[_0x54ce('0x9')](_0x54ce('0xc'),auth[_0x54ce('0xb')](),controller[_0x54ce('0xd')]);router[_0x54ce('0x9')](_0x54ce('0xe'),auth[_0x54ce('0xb')](),controller[_0x54ce('0xf')]);router[_0x54ce('0x10')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x54ce('0x11'),'mailmessage:create'),controller['create']);router[_0x54ce('0x12')](_0x54ce('0xc'),auth[_0x54ce('0xb')](),controller['update']);router[_0x54ce('0x12')]('/:id/accept',auth['isAuthenticated'](),controller[_0x54ce('0x13')]);router['put'](_0x54ce('0x14'),auth[_0x54ce('0xb')](),controller[_0x54ce('0x15')]);router['delete'](_0x54ce('0xc'),auth[_0x54ce('0xb')](),controller['destroy']);module[_0x54ce('0x16')]=router; \ No newline at end of file +var _0x0abe=['reject','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','isAuthenticated','index','describe','get','/:id','show','/:id/download','download','tracked','mailmessage:create','create','update','put','/:id/accept','accept'];(function(_0x492ac8,_0x1386c4){var _0x4e8a27=function(_0x1febd6){while(--_0x1febd6){_0x492ac8['push'](_0x492ac8['shift']());}};_0x4e8a27(++_0x1386c4);}(_0x0abe,0x188));var _0xe0ab=function(_0x2891d8,_0x2d60ae){_0x2891d8=_0x2891d8-0x0;var _0x5e0e8b=_0x0abe[_0x2891d8];return _0x5e0e8b;};'use strict';var multer=require(_0xe0ab('0x0'));var util=require('util');var path=require(_0xe0ab('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0ab('0x2'));var router=express[_0xe0ab('0x3')]();var fs_extra=require(_0xe0ab('0x4'));var auth=require(_0xe0ab('0x5'));var interaction=require(_0xe0ab('0x6'));var config=require(_0xe0ab('0x7'));var controller=require(_0xe0ab('0x8'));router['get']('/',auth[_0xe0ab('0x9')](),controller[_0xe0ab('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xe0ab('0xb')]);router[_0xe0ab('0xc')](_0xe0ab('0xd'),auth['isAuthenticated'](),controller[_0xe0ab('0xe')]);router[_0xe0ab('0xc')](_0xe0ab('0xf'),auth[_0xe0ab('0x9')](),controller[_0xe0ab('0x10')]);router['post']('/',auth['isAuthenticated'](),interaction[_0xe0ab('0x11')]('mail',_0xe0ab('0x12')),controller[_0xe0ab('0x13')]);router['put'](_0xe0ab('0xd'),auth['isAuthenticated'](),controller[_0xe0ab('0x14')]);router[_0xe0ab('0x15')](_0xe0ab('0x16'),auth[_0xe0ab('0x9')](),controller[_0xe0ab('0x17')]);router['put']('/:id/reject',auth[_0xe0ab('0x9')](),controller[_0xe0ab('0x18')]);router['delete'](_0xe0ab('0xd'),auth[_0xe0ab('0x9')](),controller['destroy']);module[_0xe0ab('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 9807098..218970d 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 _0xa6c5=['INTEGER','DATE','Email','lodash','exports','TEXT','medium','ENUM','out','STRING','long'];(function(_0x5f5426,_0x1f0ba8){var _0x1956f0=function(_0x1dfdd4){while(--_0x1dfdd4){_0x5f5426['push'](_0x5f5426['shift']());}};_0x1956f0(++_0x1f0ba8);}(_0xa6c5,0x18f));var _0x5a6c=function(_0x2fd2cb,_0x437c0){_0x2fd2cb=_0x2fd2cb-0x0;var _0x3fc2b9=_0xa6c5[_0x2fd2cb];return _0x3fc2b9;};'use strict';var Sequelize=require('sequelize');var _=require(_0x5a6c('0x0'));module[_0x5a6c('0x1')]={'body':{'type':Sequelize[_0x5a6c('0x2')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x5a6c('0x3'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x5a6c('0x4')]('in','out'),'defaultValue':_0x5a6c('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x5a6c('0x6')]},'to':{'type':Sequelize[_0x5a6c('0x2')](_0x5a6c('0x7'))},'cc':{'type':Sequelize[_0x5a6c('0x2')](_0x5a6c('0x7'))},'bcc':{'type':Sequelize['TEXT'](_0x5a6c('0x7'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0x5a6c('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0x5a6c('0x9')]},'originTo':{'type':Sequelize[_0x5a6c('0x2')](_0x5a6c('0x7'))},'originCc':{'type':Sequelize[_0x5a6c('0x2')]('long')},'originChannel':{'type':Sequelize['ENUM'](_0x5a6c('0xa'),'Chat'),'defaultValue':_0x5a6c('0xa'),'allowNull':![]}}; \ No newline at end of file +var _0x72a1=['lodash','TEXT','medium','BOOLEAN','out','STRING','long','DATE','ENUM','Email','Chat'];(function(_0x5a79e2,_0x319b1a){var _0x266c45=function(_0x172478){while(--_0x172478){_0x5a79e2['push'](_0x5a79e2['shift']());}};_0x266c45(++_0x319b1a);}(_0x72a1,0x1ce));var _0x172a=function(_0x1846f2,_0x353922){_0x1846f2=_0x1846f2-0x0;var _0x3f2021=_0x72a1[_0x1846f2];return _0x3f2021;};'use strict';var Sequelize=require('sequelize');var _=require(_0x172a('0x0'));module['exports']={'body':{'type':Sequelize[_0x172a('0x1')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0x172a('0x1')](_0x172a('0x2'))},'read':{'type':Sequelize[_0x172a('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x172a('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x172a('0x5')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x172a('0x1')]('long')},'cc':{'type':Sequelize[_0x172a('0x1')](_0x172a('0x6'))},'bcc':{'type':Sequelize[_0x172a('0x1')](_0x172a('0x6'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x172a('0x7')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0x172a('0x3')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x172a('0x7')]},'originTo':{'type':Sequelize[_0x172a('0x1')]('long')},'originCc':{'type':Sequelize[_0x172a('0x1')](_0x172a('0x6'))},'originChannel':{'type':Sequelize[_0x172a('0x8')](_0x172a('0x9'),_0x172a('0xa')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 9900090..572551e 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 _0x9068=['options','MailMessage','include','findAll','show','params','rawAttributes','includeAll','find','body','describe','create','direction','out','split','MailAccount','MailAccountId','CmList','List','CmContact','updatedAt','DESC','MailServerOut','Smtp','isNil','service','host','port','secure','authentication','pass','auth','user','attachments','root','server/files/attachments','basename','Contacts','List\x20not\x20found','SendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','UserId','agent','MailInteraction','MailInteractionId','read1stAt','interaction','get','[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','contact','User','fullname','email','internal','manual','interface','motionChannel','fromString','EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','channel','event','rejectmessage','download','unix','toString','join','files','tmp','server','message-%s.eml','createdAt','Attachment','Attachments','from','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','existsSync','push','build','writeFileSync','unlinkSync','eml-format','moment','bluebird','path','html-to-text','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','jayson/promise','http','client','request','then','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','MailMessage,\x20%s,\x20%s','message','info','catch','status','json','offset','limit','undefined','count','set','Content-Range','update','destroy','end','sendStatus','stack','name','send','map','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x512ad0,_0x205867){var _0x3cf37d=function(_0x34b48c){while(--_0x34b48c){_0x512ad0['push'](_0x512ad0['shift']());}};_0x3cf37d(++_0x205867);}(_0x9068,0x65));var _0x8906=function(_0x560e27,_0x3e94e4){_0x560e27=_0x560e27-0x0;var _0x3e4f4a=_0x9068[_0x560e27];return _0x3e4f4a;};'use strict';var emlformat=require(_0x8906('0x0'));var moment=require(_0x8906('0x1'));var BPromise=require(_0x8906('0x2'));var util=require('util');var path=require(_0x8906('0x3'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var htmlToText=require(_0x8906('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0x8906('0x5'))(_0x8906('0x6'));var interaction_log=require(_0x8906('0x5'))(_0x8906('0x7'));var config=require(_0x8906('0x8'));var db=require(_0x8906('0x9'))['db'];config[_0x8906('0xa')]=_[_0x8906('0xb')](config[_0x8906('0xa')],{'host':_0x8906('0xc'),'port':0x18eb});var socket=require(_0x8906('0xd'))(new Redis(config[_0x8906('0xa')]));require(_0x8906('0xe'))[_0x8906('0xf')](socket);var jayson=require(_0x8906('0x10'));var client=jayson['client'][_0x8906('0x11')]({'port':0x232c});var client9003=jayson['client']['http']({'port':0x232b});var client9002=jayson[_0x8906('0x12')][_0x8906('0x11')]({'port':0x232a});function respondWithRpcPromise(_0x42acac,_0x4439c3,_0xb80942,_0x217bc2){return new BPromise(function(_0x3980b3,_0x38c8eb){var _0x65b8b8=_0x217bc2||client;return _0x65b8b8[_0x8906('0x13')](_0x42acac,_0xb80942)[_0x8906('0x14')](function(_0x37718e){logger['info']('MailMessage,\x20%s,\x20%s',_0x4439c3,_0x8906('0x15'));logger[_0x8906('0x16')](_0x8906('0x17'),_0x4439c3,_0x8906('0x15'),JSON[_0x8906('0x18')](_0x37718e));if(_0x37718e['error']){if(_0x37718e[_0x8906('0x19')]['code']===0x1f4){logger[_0x8906('0x19')](_0x8906('0x1a'),_0x4439c3,_0x37718e[_0x8906('0x19')][_0x8906('0x1b')]);return _0x38c8eb(_0x37718e['error']['message']);}logger[_0x8906('0x19')](_0x8906('0x1a'),_0x4439c3,_0x37718e[_0x8906('0x19')][_0x8906('0x1b')]);return _0x3980b3(_0x37718e[_0x8906('0x19')][_0x8906('0x1b')]);}else{logger[_0x8906('0x1c')](_0x8906('0x1a'),_0x4439c3,_0x8906('0x15'));_0x3980b3(_0x37718e['result'][_0x8906('0x1b')]);}})[_0x8906('0x1d')](function(_0xdaf74f){logger['error'](_0x8906('0x1a'),_0x4439c3,_0xdaf74f);_0x38c8eb(_0xdaf74f);});});}function respondWithResult(_0x1348d5,_0x6ee2ae){_0x6ee2ae=_0x6ee2ae||0xc8;return function(_0x22e924){if(_0x22e924){return _0x1348d5[_0x8906('0x1e')](_0x6ee2ae)[_0x8906('0x1f')](_0x22e924);}};}function respondWithFilteredResult(_0x52fed9,_0x27a19a){return function(_0x5c08e1){if(_0x5c08e1){var _0x1eb508=typeof _0x27a19a[_0x8906('0x20')]==='undefined'&&typeof _0x27a19a[_0x8906('0x21')]===_0x8906('0x22');var _0x3e3b3c=_0x5c08e1[_0x8906('0x23')];var _0x478e1c=_0x1eb508?0x0:_0x27a19a[_0x8906('0x20')];var _0x2df574=_0x1eb508?_0x5c08e1[_0x8906('0x23')]:_0x27a19a['offset']+_0x27a19a['limit'];var _0x3b70b1;if(_0x2df574>=_0x3e3b3c){_0x2df574=_0x3e3b3c;_0x3b70b1=0xc8;}else{_0x3b70b1=0xce;}_0x52fed9[_0x8906('0x1e')](_0x3b70b1);return _0x52fed9[_0x8906('0x24')](_0x8906('0x25'),_0x478e1c+'-'+_0x2df574+'/'+_0x3e3b3c)[_0x8906('0x1f')](_0x5c08e1);}return null;};}function saveUpdates(_0x13279e){return function(_0x258e6b){if(_0x258e6b){return _0x258e6b[_0x8906('0x26')](_0x13279e)[_0x8906('0x14')](function(_0x2dbed9){return _0x2dbed9;});}return null;};}function removeEntity(_0x1158d2){return function(_0x36facc){if(_0x36facc){return _0x36facc[_0x8906('0x27')]()[_0x8906('0x14')](function(){_0x1158d2['status'](0xcc)[_0x8906('0x28')]();});}};}function handleEntityNotFound(_0xe0d3f3){return function(_0x541a4f){if(!_0x541a4f){_0xe0d3f3[_0x8906('0x29')](0x194);}return _0x541a4f;};}function handleError(_0x420bd9,_0x1471ef){_0x1471ef=_0x1471ef||0x1f4;return function(_0x1c692e){logger[_0x8906('0x19')](_0x1c692e[_0x8906('0x2a')]);if(_0x1c692e[_0x8906('0x2b')]){delete _0x1c692e[_0x8906('0x2b')];}_0x420bd9['status'](_0x1471ef)[_0x8906('0x2c')](_0x1c692e);};}exports['index']=function(_0x149f8d,_0x1b3ced){var _0xac6537={},_0x2d9b0b={},_0x15c252={'count':0x0,'rows':[]};var _0x57cbe3=_[_0x8906('0x2d')](db['MailMessage']['rawAttributes'],function(_0x46a0c7){return{'name':_0x46a0c7['fieldName'],'type':_0x46a0c7[_0x8906('0x2e')][_0x8906('0x2f')]};});_0x2d9b0b['model']=_[_0x8906('0x2d')](_0x57cbe3,'name');_0x2d9b0b['query']=_[_0x8906('0x30')](_0x149f8d[_0x8906('0x31')]);_0x2d9b0b[_0x8906('0x32')]=_[_0x8906('0x33')](_0x2d9b0b[_0x8906('0x34')],_0x2d9b0b[_0x8906('0x31')]);_0xac6537[_0x8906('0x35')]=_['intersection'](_0x2d9b0b[_0x8906('0x34')],qs[_0x8906('0x36')](_0x149f8d[_0x8906('0x31')]['fields']));_0xac6537['attributes']=_0xac6537[_0x8906('0x35')][_0x8906('0x37')]?_0xac6537[_0x8906('0x35')]:_0x2d9b0b[_0x8906('0x34')];if(!_0x149f8d[_0x8906('0x31')][_0x8906('0x38')](_0x8906('0x39'))){_0xac6537['limit']=qs[_0x8906('0x21')](_0x149f8d[_0x8906('0x31')]['limit']);_0xac6537[_0x8906('0x20')]=qs[_0x8906('0x20')](_0x149f8d[_0x8906('0x31')][_0x8906('0x20')]);}_0xac6537['order']=qs[_0x8906('0x3a')](_0x149f8d['query'][_0x8906('0x3a')]);_0xac6537[_0x8906('0x3b')]=qs[_0x8906('0x32')](_[_0x8906('0x3c')](_0x149f8d[_0x8906('0x31')],_0x2d9b0b[_0x8906('0x32')]),_0x57cbe3);if(_0x149f8d[_0x8906('0x31')][_0x8906('0x3d')]){_0xac6537[_0x8906('0x3b')]=_[_0x8906('0x3e')](_0xac6537[_0x8906('0x3b')],{'$or':_[_0x8906('0x2d')](_0x57cbe3,function(_0x54b470){if(_0x54b470[_0x8906('0x2e')]!==_0x8906('0x3f')){var _0xc45e18={};_0xc45e18[_0x54b470[_0x8906('0x2b')]]={'$like':'%'+_0x149f8d[_0x8906('0x31')]['filter']+'%'};return _0xc45e18;}})});}_0xac6537=_[_0x8906('0x3e')]({},_0xac6537,_0x149f8d[_0x8906('0x40')]);var _0x567be4={'where':_0xac6537[_0x8906('0x3b')]};return db[_0x8906('0x41')][_0x8906('0x23')](_0x567be4)[_0x8906('0x14')](function(_0x827488){_0x15c252['count']=_0x827488;if(_0x149f8d['query']['includeAll']){_0xac6537[_0x8906('0x42')]=[{'all':!![]}];}return db[_0x8906('0x41')][_0x8906('0x43')](_0xac6537);})[_0x8906('0x14')](function(_0x1eb5a8){_0x15c252['rows']=_0x1eb5a8;return _0x15c252;})[_0x8906('0x14')](respondWithFilteredResult(_0x1b3ced,_0xac6537))[_0x8906('0x1d')](handleError(_0x1b3ced,null));};exports[_0x8906('0x44')]=function(_0x37247f,_0x943e14){var _0x255319={'raw':!![],'where':{'id':_0x37247f[_0x8906('0x45')]['id']}},_0x133014={};_0x133014['model']=_[_0x8906('0x30')](db[_0x8906('0x41')][_0x8906('0x46')]);_0x133014[_0x8906('0x31')]=_[_0x8906('0x30')](_0x37247f['query']);_0x133014[_0x8906('0x32')]=_[_0x8906('0x33')](_0x133014[_0x8906('0x34')],_0x133014[_0x8906('0x31')]);_0x255319[_0x8906('0x35')]=_['intersection'](_0x133014[_0x8906('0x34')],qs[_0x8906('0x36')](_0x37247f['query'][_0x8906('0x36')]));_0x255319[_0x8906('0x35')]=_0x255319['attributes']['length']?_0x255319[_0x8906('0x35')]:_0x133014[_0x8906('0x34')];if(_0x37247f[_0x8906('0x31')][_0x8906('0x47')]){_0x255319[_0x8906('0x42')]=[{'all':!![]}];}_0x255319=_[_0x8906('0x3e')]({},_0x255319,_0x37247f[_0x8906('0x40')]);return db[_0x8906('0x41')][_0x8906('0x48')](_0x255319)[_0x8906('0x14')](handleEntityNotFound(_0x943e14,null))['then'](respondWithResult(_0x943e14,null))['catch'](handleError(_0x943e14,null));};exports[_0x8906('0x26')]=function(_0x18d259,_0xbf082f){if(_0x18d259[_0x8906('0x49')]['id']){delete _0x18d259[_0x8906('0x49')]['id'];}return db[_0x8906('0x41')][_0x8906('0x48')]({'where':{'id':_0x18d259[_0x8906('0x45')]['id']}})[_0x8906('0x14')](handleEntityNotFound(_0xbf082f,null))[_0x8906('0x14')](saveUpdates(_0x18d259[_0x8906('0x49')],null))[_0x8906('0x14')](respondWithResult(_0xbf082f,null))[_0x8906('0x1d')](handleError(_0xbf082f,null));};exports[_0x8906('0x27')]=function(_0x2e7b5c,_0x5035d1){return db[_0x8906('0x41')]['find']({'where':{'id':_0x2e7b5c['params']['id']}})[_0x8906('0x14')](handleEntityNotFound(_0x5035d1,null))['then'](removeEntity(_0x5035d1,null))['catch'](handleError(_0x5035d1,null));};exports['describe']=function(_0x4de8c5,_0x13547a){return db['MailMessage'][_0x8906('0x4a')]()[_0x8906('0x14')](respondWithResult(_0x13547a,null))[_0x8906('0x1d')](handleError(_0x13547a,null));};exports[_0x8906('0x4b')]=function(_0x41f960,_0x4520d8){return db[_0x8906('0x41')]['create'](_0x41f960['body'])[_0x8906('0x14')](function(_0x39f148){if(_0x39f148){if(_0x39f148[_0x8906('0x4c')]===_0x8906('0x4d')&&!_0x39f148['secret']){var _0x31b90b,_0x92b2f6,_0x5cb111;if(_0x41f960[_0x8906('0x49')]['to']){_0x92b2f6=_0x41f960[_0x8906('0x49')]['to'][_0x8906('0x4e')](',')[0x0];}return db[_0x8906('0x4f')]['findOne']({'where':{'id':_0x39f148[_0x8906('0x50')]},'include':[{'model':db[_0x8906('0x51')],'as':_0x8906('0x52'),'include':[{'model':db[_0x8906('0x53')],'as':'Contacts','where':{'email':_0x92b2f6},'limit':0x1,'order':[[_0x8906('0x54'),_0x8906('0x55')]]}]},{'model':db[_0x8906('0x56')],'as':_0x8906('0x57'),'raw':!![]}]})[_0x8906('0x14')](function(_0x4ffec6){_0x31b90b=_0x4ffec6;if(_0x31b90b&&_0x31b90b[_0x8906('0x57')]){var _0x3da73f={'tls':{'rejectUnauthorized':![]}};if(_[_0x8906('0x58')](_0x31b90b[_0x8906('0x57')][_0x8906('0x59')])){_0x3da73f[_0x8906('0x5a')]=_0x31b90b['Smtp']['host'];_0x3da73f[_0x8906('0x5b')]=_0x31b90b['Smtp']['port'];_0x3da73f[_0x8906('0x5c')]=_0x31b90b[_0x8906('0x57')][_0x8906('0x5c')];if(_0x31b90b['Smtp'][_0x8906('0x5d')]){_0x3da73f['auth']={'user':_0x31b90b[_0x8906('0x57')]['user'],'pass':_0x31b90b[_0x8906('0x57')][_0x8906('0x5e')]};}}else{_0x3da73f['service']=_0x31b90b[_0x8906('0x57')][_0x8906('0x59')];_0x3da73f[_0x8906('0x5f')]={'user':_0x31b90b[_0x8906('0x57')][_0x8906('0x60')],'pass':_0x31b90b[_0x8906('0x57')]['pass']};_0x3da73f[_0x8906('0x5c')]=_0x31b90b[_0x8906('0x57')][_0x8906('0x5c')];}if(_0x41f960['body']['attachments']&&_0x41f960[_0x8906('0x49')]['attachments']['length']){for(var _0x1232b5=0x0;_0x1232b5<_0x41f960[_0x8906('0x49')]['attachments'][_0x8906('0x37')];_0x1232b5+=0x1){_0x41f960[_0x8906('0x49')]['attachments'][_0x1232b5]={'filename':_0x41f960[_0x8906('0x49')][_0x8906('0x61')][_0x1232b5][_0x8906('0x2b')],'path':path['join'](config[_0x8906('0x62')],_0x8906('0x63'),_0x41f960['body'][_0x8906('0x61')][_0x1232b5][_0x8906('0x64')])};}}_0x5cb111={'account':_0x3da73f,'message':_0x41f960[_0x8906('0x49')]};return;}})[_0x8906('0x14')](function(){if(_0x31b90b[_0x8906('0x52')]){if(_0x31b90b[_0x8906('0x52')]['Contacts'][_0x8906('0x37')]){return _0x31b90b[_0x8906('0x52')][_0x8906('0x65')][0x0];}else{return db['CmContact'][_0x8906('0x4b')](_[_0x8906('0xb')](_0x41f960[_0x8906('0x49')],{'firstName':_0x41f960[_0x8906('0x49')]['to'],'email':_0x41f960[_0x8906('0x49')]['to'],'phone':_0x41f960[_0x8906('0x49')]['to'],'ListId':_0x31b90b['ListId']}));}}else{throw new Error(_0x8906('0x66'));}})['then'](function(){if(_0x5cb111){return respondWithRpcPromise(_0x8906('0x67'),'sendMail',_0x5cb111,client9003)[_0x8906('0x14')](function(_0x519c4c){return _0x39f148['update']({'read':!![],'messageId':_0x519c4c[_0x8906('0x68')],'sentAt':moment()[_0x8906('0x69')](_0x8906('0x6a'))});})[_0x8906('0x1d')](function(_0x3cd29d){logger[_0x8906('0x19')]('%s',JSON[_0x8906('0x18')](_0x3cd29d));return _0x39f148;});}return _0x39f148;});}return _0x39f148;}})[_0x8906('0x14')](respondWithResult(_0x4520d8,0xc9))[_0x8906('0x1d')](handleError(_0x4520d8,null));};exports[_0x8906('0x6b')]=function(_0x41cdad,_0x4bc051){var _0x2db150={'agent':{},'channel':_0x8906('0x6c')};if(_0x41cdad[_0x8906('0x49')]['id']){delete _0x41cdad[_0x8906('0x49')]['id'];}_0x41cdad[_0x8906('0x49')][_0x8906('0x6d')]=!![];_0x41cdad[_0x8906('0x49')]['readAt']=moment()['format'](_0x8906('0x6a'));_0x41cdad[_0x8906('0x49')][_0x8906('0x6e')]=_0x41cdad[_0x8906('0x49')][_0x8906('0x6e')]||_0x41cdad[_0x8906('0x60')]['id'];_0x2db150[_0x8906('0x6f')]['id']=_0x41cdad[_0x8906('0x49')][_0x8906('0x6e')];return db[_0x8906('0x41')][_0x8906('0x48')]({'where':{'id':_0x41cdad[_0x8906('0x45')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4bc051,null))[_0x8906('0x14')](saveUpdates(_0x41cdad[_0x8906('0x49')],null))[_0x8906('0x14')](function(_0xc991b8){if(_0xc991b8){_0x2db150[_0x8906('0x1b')]=_0xc991b8['get']({'plain':!![]});return db[_0x8906('0x70')][_0x8906('0x48')]({'where':{'id':_0xc991b8[_0x8906('0x71')]}});}return null;})['then'](handleEntityNotFound(_0x4bc051,null))[_0x8906('0x14')](function(_0x58f6b1){if(_0x58f6b1){return _0x58f6b1[_0x8906('0x26')]({'UserId':_0x41cdad[_0x8906('0x49')][_0x8906('0x6e')],'read1stAt':_[_0x8906('0x58')](_0x58f6b1[_0x8906('0x72')])?moment()[_0x8906('0x69')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x283667){if(_0x283667){_0x2db150[_0x8906('0x73')]=_0x283667[_0x8906('0x74')]({'plain':!![]});interaction_log['info'](_0x8906('0x75'),_0x41cdad['user']['id'],_0x41cdad['user']['name'],_0x41cdad[_0x8906('0x60')][_0x8906('0x76')],_0x2db150[_0x8906('0x73')]['id'],_0x41cdad[_0x8906('0x49')]?JSON[_0x8906('0x18')](_0x41cdad['body']):_0x8906('0x77'));return respondWithRpcPromise('AcceptMessage',_0x8906('0x78'),_0x2db150);}return null;})[_0x8906('0x14')](function(_0x487030){var _0x2abd20=_0x8906('0x79')+_0x487030['message'][_0x8906('0x7a')];return db[_0x8906('0x7b')][_0x8906('0x31')](_0x2abd20,{'type':db[_0x8906('0x7c')][_0x8906('0x7d')][_0x8906('0x7e')],'raw':!![]})[_0x8906('0x14')](function(_0x5aa7a8){return _0x5aa7a8;});})[_0x8906('0x14')](function(_0x302918){if(_0x302918){_0x2db150[_0x8906('0x1b')][_0x8906('0x7f')]=_0x302918[0x0];if(!_0x41cdad[_0x8906('0x49')]['UserId'])return;return db[_0x8906('0x80')][_0x8906('0x48')]({'where':{'id':_0x41cdad[_0x8906('0x49')][_0x8906('0x6e')],'role':'agent'},'attributes':['id',_0x8906('0x2b'),_0x8906('0x81'),_0x8906('0x82'),_0x8906('0x83')],'raw':!![]});}return null;})[_0x8906('0x14')](function(_0x3550c9){if(!_0x3550c9)return null;_0x2db150[_0x8906('0x1b')]['agent']=_0x3550c9;return _0x2db150;})['then'](function(_0x5a3260){if(_0x5a3260){if(_0x41cdad[_0x8906('0x49')][_0x8906('0x84')]){_0x2db150[_0x8906('0x1b')][_0x8906('0x85')]=util[_0x8906('0x69')]('SIP/%s',_0x41cdad[_0x8906('0x60')][_0x8906('0x2b')]);_0x2db150[_0x8906('0x1b')]['channel']=_0x2db150['channel'];_0x2db150['message'][_0x8906('0x86')]=_0x2db150['channel'];_0x2db150[_0x8906('0x1b')]['event']='accept';_0x2db150['message']['body']=htmlToText[_0x8906('0x87')](_0x2db150[_0x8906('0x1b')][_0x8906('0x49')]);return respondWithRpcPromise(_0x8906('0x88'),'EventManager',{'event':_0x8906('0x89'),'message':_0x2db150[_0x8906('0x1b')]},client9002)[_0x8906('0x14')](function(){return _0x2db150;});}return _0x2db150;}return null;})['then'](respondWithResult(_0x4bc051,null))[_0x8906('0x1d')](handleError(_0x4bc051,null));};exports[_0x8906('0x8a')]=function(_0x4753d9,_0x2a0b25){var _0x2f4f55={'agent':{},'channel':_0x8906('0x6c')};if(_0x4753d9[_0x8906('0x49')]['id']){delete _0x4753d9['body']['id'];}_0x4753d9[_0x8906('0x49')][_0x8906('0x6e')]=_0x4753d9[_0x8906('0x49')][_0x8906('0x6e')]||_0x4753d9[_0x8906('0x60')]['id'];_0x2f4f55[_0x8906('0x6f')]['id']=_0x4753d9['body']['UserId'];return db[_0x8906('0x41')][_0x8906('0x48')]({'where':{'id':_0x4753d9[_0x8906('0x45')]['id'],'UserId':null}})[_0x8906('0x14')](handleEntityNotFound(_0x2a0b25,null))[_0x8906('0x14')](function(_0x3b13bb){if(_0x3b13bb){_0x2f4f55[_0x8906('0x1b')]=_0x3b13bb[_0x8906('0x74')]({'plain':!![]});return db[_0x8906('0x70')][_0x8906('0x48')]({'where':{'id':_0x3b13bb[_0x8906('0x71')]}});}return null;})[_0x8906('0x14')](handleEntityNotFound(_0x2a0b25,null))['then'](function(_0x236219){if(_0x236219){_0x2f4f55[_0x8906('0x73')]=_0x236219[_0x8906('0x74')]({'plain':!![]});interaction_log[_0x8906('0x1c')](_0x8906('0x8b'),_0x4753d9[_0x8906('0x60')]['id'],_0x4753d9[_0x8906('0x60')][_0x8906('0x2b')],_0x4753d9[_0x8906('0x60')][_0x8906('0x76')],_0x2f4f55[_0x8906('0x73')]['id'],_0x4753d9['body']?JSON[_0x8906('0x18')](_0x4753d9[_0x8906('0x49')]):_0x8906('0x77'));return respondWithRpcPromise(_0x8906('0x8c'),_0x8906('0x8d'),_0x2f4f55);}return null;})['then'](function(_0x4298c9){var _0x44c99e=_0x8906('0x79')+_0x4298c9[_0x8906('0x1b')]['ContactId'];return db['sequelize'][_0x8906('0x31')](_0x44c99e,{'type':db[_0x8906('0x7c')][_0x8906('0x7d')][_0x8906('0x7e')],'raw':!![]})[_0x8906('0x14')](function(_0x450d93){return _0x450d93;});})[_0x8906('0x14')](function(_0x41a03e){if(_0x41a03e){_0x2f4f55[_0x8906('0x1b')][_0x8906('0x7f')]=_0x41a03e[0x0];if(!_0x4753d9['body'][_0x8906('0x6e')])return;return db['User']['find']({'where':{'id':_0x4753d9['body'][_0x8906('0x6e')],'role':'agent'},'attributes':['id','name',_0x8906('0x81'),_0x8906('0x82'),_0x8906('0x83')],'raw':!![]});}return null;})[_0x8906('0x14')](function(_0x589531){if(!_0x589531)return null;_0x2f4f55['message'][_0x8906('0x6f')]=_0x589531;return _0x2f4f55;})[_0x8906('0x14')](function(_0x5d869d){if(_0x5d869d){_0x5d869d[_0x8906('0x1b')][_0x8906('0x85')]=util[_0x8906('0x69')]('SIP/%s',_0x4753d9['user'][_0x8906('0x2b')]);_0x5d869d['message'][_0x8906('0x8e')]=_0x2f4f55[_0x8906('0x8e')];_0x5d869d['message'][_0x8906('0x86')]=_0x2f4f55[_0x8906('0x8e')];_0x5d869d[_0x8906('0x1b')][_0x8906('0x8f')]='reject';_0x5d869d[_0x8906('0x1b')][_0x8906('0x49')]=htmlToText['fromString'](_0x2f4f55[_0x8906('0x1b')][_0x8906('0x49')]);respondWithRpcPromise(_0x8906('0x88'),_0x8906('0x88'),{'event':_0x8906('0x90'),'message':_0x5d869d[_0x8906('0x1b')]},client9002);return _0x2f4f55;}return null;})[_0x8906('0x14')](respondWithResult(_0x2a0b25,null))[_0x8906('0x1d')](handleError(_0x2a0b25,null));};exports[_0x8906('0x91')]=function(_0x49a2ad,_0x4e5b25){var _0x5b44ec=moment()[_0x8906('0x92')]()[_0x8906('0x93')]();var _0x29532a=path[_0x8906('0x94')](config[_0x8906('0x62')],'server',_0x8906('0x95'),_0x8906('0x96'));var _0x461786=path[_0x8906('0x94')](config[_0x8906('0x62')],_0x8906('0x97'),_0x8906('0x95'),_0x8906('0x61'));var _0x20c1fd=util[_0x8906('0x69')](_0x8906('0x98'),_0x5b44ec);return db[_0x8906('0x41')][_0x8906('0x48')]({'where':{'id':_0x49a2ad[_0x8906('0x45')]['id']},'attributes':['id',_0x8906('0x49'),'from','to','cc','bcc','subject',_0x8906('0x99')],'include':_0x49a2ad[_0x8906('0x31')][_0x8906('0x61')]?[{'model':db[_0x8906('0x9a')],'as':_0x8906('0x9b')}]:undefined})[_0x8906('0x14')](handleEntityNotFound(_0x4e5b25,null))['then'](function(_0x2d2756){if(_0x2d2756){var _0x7ecea4=_0x2d2756;var _0x1eba63={'from':_0x7ecea4[_0x8906('0x9c')],'to':_0x7ecea4['to'],'subject':_0x7ecea4['subject'],'html':_0x7ecea4[_0x8906('0x49')],'headers':{'Date':moment(_0x7ecea4['createdAt'])[_0x8906('0x69')](_0x8906('0x9d'))},'attachments':[]};if(_0x2d2756['cc']){_0x1eba63[_0x8906('0x9e')]['Cc']=_0x2d2756['cc'];}if(_0x2d2756[_0x8906('0x9f')]){_0x1eba63[_0x8906('0x9e')]['Bcc']=_0x2d2756[_0x8906('0x9f')];}return new BPromise(function(_0x579bb3,_0x139943){if(_0x2d2756['Attachments']){for(var _0x463590=0x0;_0x463590<_0x2d2756['Attachments'][_0x8906('0x37')];_0x463590++){var _0x37f3cb=_0x2d2756['Attachments'][_0x463590];var _0x57c2da=path[_0x8906('0x94')](_0x461786,_0x37f3cb[_0x8906('0x64')]);if(fs[_0x8906('0xa0')](_0x57c2da)){_0x1eba63[_0x8906('0x61')][_0x8906('0xa1')]({'name':_0x37f3cb[_0x8906('0x2b')],'contentType':_0x37f3cb[_0x8906('0x2e')],'data':fs['readFileSync'](_0x57c2da)});}}}emlformat[_0x8906('0xa2')](_0x1eba63,function(_0x276f22,_0x1287c4){if(_0x276f22)return _0x139943(_0x276f22);fs[_0x8906('0xa3')](path['join'](_0x29532a,_0x20c1fd),_0x1287c4);return _0x579bb3(_0x1287c4);});});}})[_0x8906('0x14')](function(_0x1f3456){if(_0x1f3456){return _0x4e5b25[_0x8906('0x91')](path[_0x8906('0x94')](_0x29532a,_0x20c1fd),_0x20c1fd,function(_0x302d32){if(!_0x302d32)fs[_0x8906('0xa4')](path['join'](_0x29532a,_0x20c1fd));});}})[_0x8906('0x1d')](handleError(_0x4e5b25,null));}; \ No newline at end of file +var _0xa051=['findOne','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','isNil','host','port','secure','authentication','auth','user','pass','service','attachments','join','root','basename','ListId','List\x20not\x20found','SendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','UserId','agent','get','MailInteraction','MailInteractionId','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','sequelize','interface','rejectmessage','download','unix','files','server','from','bcc','subject','createdAt','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','Bcc','existsSync','push','readFileSync','build','writeFileSync','eml-format','moment','util','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','jayson/promise','client','http','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','catch','status','json','offset','limit','count','set','Content-Range','update','destroy','sendStatus','stack','name','index','map','MailMessage','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','rows','params','intersection','options','body','find','describe','create','direction','secret','split','MailAccount'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa051,0xfc));var _0x1a05=function(_0x2514cf,_0x796698){_0x2514cf=_0x2514cf-0x0;var _0x31a26e=_0xa051[_0x2514cf];return _0x31a26e;};'use strict';var emlformat=require(_0x1a05('0x0'));var moment=require(_0x1a05('0x1'));var BPromise=require('bluebird');var util=require(_0x1a05('0x2'));var path=require(_0x1a05('0x3'));var fs=require('fs');var _=require(_0x1a05('0x4'));var Redis=require(_0x1a05('0x5'));var htmlToText=require(_0x1a05('0x6'));var qs=require(_0x1a05('0x7'));var logger=require(_0x1a05('0x8'))(_0x1a05('0x9'));var interaction_log=require('../../config/logger')(_0x1a05('0xa'));var config=require('../../config/environment');var db=require(_0x1a05('0xb'))['db'];config[_0x1a05('0xc')]=_[_0x1a05('0xd')](config[_0x1a05('0xc')],{'host':_0x1a05('0xe'),'port':0x18eb});var socket=require(_0x1a05('0xf'))(new Redis(config[_0x1a05('0xc')]));require(_0x1a05('0x10'))[_0x1a05('0x11')](socket);var jayson=require(_0x1a05('0x12'));var client=jayson[_0x1a05('0x13')]['http']({'port':0x232c});var client9003=jayson['client'][_0x1a05('0x14')]({'port':0x232b});var client9002=jayson[_0x1a05('0x13')][_0x1a05('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x3ce044,_0x51730b,_0x5c698b,_0x3b61ab){return new BPromise(function(_0x1fcb79,_0x457da3){var _0x508f88=_0x3b61ab||client;return _0x508f88['request'](_0x3ce044,_0x5c698b)[_0x1a05('0x15')](function(_0x3ecf8e){logger[_0x1a05('0x16')]('MailMessage,\x20%s,\x20%s',_0x51730b,_0x1a05('0x17'));logger[_0x1a05('0x18')](_0x1a05('0x19'),_0x51730b,_0x1a05('0x17'),JSON[_0x1a05('0x1a')](_0x3ecf8e));if(_0x3ecf8e[_0x1a05('0x1b')]){if(_0x3ecf8e[_0x1a05('0x1b')][_0x1a05('0x1c')]===0x1f4){logger[_0x1a05('0x1b')](_0x1a05('0x1d'),_0x51730b,_0x3ecf8e[_0x1a05('0x1b')][_0x1a05('0x1e')]);return _0x457da3(_0x3ecf8e[_0x1a05('0x1b')][_0x1a05('0x1e')]);}logger[_0x1a05('0x1b')](_0x1a05('0x1d'),_0x51730b,_0x3ecf8e[_0x1a05('0x1b')]['message']);return _0x1fcb79(_0x3ecf8e[_0x1a05('0x1b')][_0x1a05('0x1e')]);}else{logger[_0x1a05('0x16')]('MailMessage,\x20%s,\x20%s',_0x51730b,_0x1a05('0x17'));_0x1fcb79(_0x3ecf8e[_0x1a05('0x1f')][_0x1a05('0x1e')]);}})[_0x1a05('0x20')](function(_0x366a82){logger['error'](_0x1a05('0x1d'),_0x51730b,_0x366a82);_0x457da3(_0x366a82);});});}function respondWithResult(_0x5bd58b,_0x4edd8a){_0x4edd8a=_0x4edd8a||0xc8;return function(_0xfae1ee){if(_0xfae1ee){return _0x5bd58b[_0x1a05('0x21')](_0x4edd8a)[_0x1a05('0x22')](_0xfae1ee);}};}function respondWithFilteredResult(_0x1bdc19,_0x533986){return function(_0x52c4ea){if(_0x52c4ea){var _0x236ff9=typeof _0x533986[_0x1a05('0x23')]==='undefined'&&typeof _0x533986[_0x1a05('0x24')]==='undefined';var _0x2fbdeb=_0x52c4ea[_0x1a05('0x25')];var _0x5eaa63=_0x236ff9?0x0:_0x533986[_0x1a05('0x23')];var _0xdbfe37=_0x236ff9?_0x52c4ea[_0x1a05('0x25')]:_0x533986[_0x1a05('0x23')]+_0x533986[_0x1a05('0x24')];var _0x251e33;if(_0xdbfe37>=_0x2fbdeb){_0xdbfe37=_0x2fbdeb;_0x251e33=0xc8;}else{_0x251e33=0xce;}_0x1bdc19[_0x1a05('0x21')](_0x251e33);return _0x1bdc19[_0x1a05('0x26')](_0x1a05('0x27'),_0x5eaa63+'-'+_0xdbfe37+'/'+_0x2fbdeb)['json'](_0x52c4ea);}return null;};}function saveUpdates(_0xc419e2){return function(_0x571486){if(_0x571486){return _0x571486[_0x1a05('0x28')](_0xc419e2)[_0x1a05('0x15')](function(_0x53df59){return _0x53df59;});}return null;};}function removeEntity(_0x5319fc){return function(_0x29989a){if(_0x29989a){return _0x29989a[_0x1a05('0x29')]()[_0x1a05('0x15')](function(){_0x5319fc[_0x1a05('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3576c1){return function(_0x2f53b3){if(!_0x2f53b3){_0x3576c1[_0x1a05('0x2a')](0x194);}return _0x2f53b3;};}function handleError(_0x17420b,_0x11a79a){_0x11a79a=_0x11a79a||0x1f4;return function(_0x1bfb8f){logger[_0x1a05('0x1b')](_0x1bfb8f[_0x1a05('0x2b')]);if(_0x1bfb8f[_0x1a05('0x2c')]){delete _0x1bfb8f['name'];}_0x17420b[_0x1a05('0x21')](_0x11a79a)['send'](_0x1bfb8f);};}exports[_0x1a05('0x2d')]=function(_0x3d26ed,_0x18537b){var _0x39756a={},_0xd51b23={},_0x246d69={'count':0x0,'rows':[]};var _0x5d920e=_[_0x1a05('0x2e')](db[_0x1a05('0x2f')][_0x1a05('0x30')],function(_0x2af5dd){return{'name':_0x2af5dd[_0x1a05('0x31')],'type':_0x2af5dd[_0x1a05('0x32')][_0x1a05('0x33')]};});_0xd51b23['model']=_[_0x1a05('0x2e')](_0x5d920e,_0x1a05('0x2c'));_0xd51b23[_0x1a05('0x34')]=_[_0x1a05('0x35')](_0x3d26ed[_0x1a05('0x34')]);_0xd51b23[_0x1a05('0x36')]=_['intersection'](_0xd51b23[_0x1a05('0x37')],_0xd51b23['query']);_0x39756a[_0x1a05('0x38')]=_['intersection'](_0xd51b23[_0x1a05('0x37')],qs[_0x1a05('0x39')](_0x3d26ed[_0x1a05('0x34')][_0x1a05('0x39')]));_0x39756a['attributes']=_0x39756a[_0x1a05('0x38')][_0x1a05('0x3a')]?_0x39756a[_0x1a05('0x38')]:_0xd51b23['model'];if(!_0x3d26ed[_0x1a05('0x34')][_0x1a05('0x3b')](_0x1a05('0x3c'))){_0x39756a[_0x1a05('0x24')]=qs[_0x1a05('0x24')](_0x3d26ed[_0x1a05('0x34')][_0x1a05('0x24')]);_0x39756a['offset']=qs['offset'](_0x3d26ed[_0x1a05('0x34')]['offset']);}_0x39756a[_0x1a05('0x3d')]=qs[_0x1a05('0x3e')](_0x3d26ed[_0x1a05('0x34')]['sort']);_0x39756a[_0x1a05('0x3f')]=qs[_0x1a05('0x36')](_[_0x1a05('0x40')](_0x3d26ed[_0x1a05('0x34')],_0xd51b23[_0x1a05('0x36')]),_0x5d920e);if(_0x3d26ed['query'][_0x1a05('0x41')]){_0x39756a['where']=_[_0x1a05('0x42')](_0x39756a[_0x1a05('0x3f')],{'$or':_[_0x1a05('0x2e')](_0x5d920e,function(_0x25a900){if(_0x25a900[_0x1a05('0x32')]!==_0x1a05('0x43')){var _0x523abc={};_0x523abc[_0x25a900[_0x1a05('0x2c')]]={'$like':'%'+_0x3d26ed['query'][_0x1a05('0x41')]+'%'};return _0x523abc;}})});}_0x39756a=_[_0x1a05('0x42')]({},_0x39756a,_0x3d26ed['options']);var _0x3f421e={'where':_0x39756a['where']};return db[_0x1a05('0x2f')][_0x1a05('0x25')](_0x3f421e)['then'](function(_0x5aeb76){_0x246d69['count']=_0x5aeb76;if(_0x3d26ed[_0x1a05('0x34')]['includeAll']){_0x39756a['include']=[{'all':!![]}];}return db[_0x1a05('0x2f')]['findAll'](_0x39756a);})['then'](function(_0x233716){_0x246d69[_0x1a05('0x44')]=_0x233716;return _0x246d69;})['then'](respondWithFilteredResult(_0x18537b,_0x39756a))[_0x1a05('0x20')](handleError(_0x18537b,null));};exports['show']=function(_0x5da229,_0xa04c88){var _0x5f5be2={'raw':!![],'where':{'id':_0x5da229[_0x1a05('0x45')]['id']}},_0xbac046={};_0xbac046['model']=_['keys'](db[_0x1a05('0x2f')]['rawAttributes']);_0xbac046['query']=_['keys'](_0x5da229[_0x1a05('0x34')]);_0xbac046['filters']=_[_0x1a05('0x46')](_0xbac046['model'],_0xbac046['query']);_0x5f5be2[_0x1a05('0x38')]=_[_0x1a05('0x46')](_0xbac046[_0x1a05('0x37')],qs[_0x1a05('0x39')](_0x5da229[_0x1a05('0x34')][_0x1a05('0x39')]));_0x5f5be2['attributes']=_0x5f5be2[_0x1a05('0x38')][_0x1a05('0x3a')]?_0x5f5be2[_0x1a05('0x38')]:_0xbac046[_0x1a05('0x37')];if(_0x5da229[_0x1a05('0x34')]['includeAll']){_0x5f5be2['include']=[{'all':!![]}];}_0x5f5be2=_[_0x1a05('0x42')]({},_0x5f5be2,_0x5da229[_0x1a05('0x47')]);return db[_0x1a05('0x2f')]['find'](_0x5f5be2)[_0x1a05('0x15')](handleEntityNotFound(_0xa04c88,null))[_0x1a05('0x15')](respondWithResult(_0xa04c88,null))['catch'](handleError(_0xa04c88,null));};exports['update']=function(_0xef7278,_0x5f2c32){if(_0xef7278[_0x1a05('0x48')]['id']){delete _0xef7278['body']['id'];}return db[_0x1a05('0x2f')][_0x1a05('0x49')]({'where':{'id':_0xef7278[_0x1a05('0x45')]['id']}})[_0x1a05('0x15')](handleEntityNotFound(_0x5f2c32,null))[_0x1a05('0x15')](saveUpdates(_0xef7278[_0x1a05('0x48')],null))['then'](respondWithResult(_0x5f2c32,null))[_0x1a05('0x20')](handleError(_0x5f2c32,null));};exports['destroy']=function(_0x5cefe0,_0x45c436){return db[_0x1a05('0x2f')][_0x1a05('0x49')]({'where':{'id':_0x5cefe0[_0x1a05('0x45')]['id']}})['then'](handleEntityNotFound(_0x45c436,null))['then'](removeEntity(_0x45c436,null))['catch'](handleError(_0x45c436,null));};exports['describe']=function(_0x45c3f9,_0x4015eb){return db[_0x1a05('0x2f')][_0x1a05('0x4a')]()['then'](respondWithResult(_0x4015eb,null))[_0x1a05('0x20')](handleError(_0x4015eb,null));};exports[_0x1a05('0x4b')]=function(_0x483769,_0x5f3f28){return db[_0x1a05('0x2f')][_0x1a05('0x4b')](_0x483769[_0x1a05('0x48')])[_0x1a05('0x15')](function(_0x559b2d){if(_0x559b2d){if(_0x559b2d[_0x1a05('0x4c')]==='out'&&!_0x559b2d[_0x1a05('0x4d')]){var _0x4b3984,_0x497ddc,_0x3e2ef1;if(_0x483769[_0x1a05('0x48')]['to']){_0x497ddc=_0x483769['body']['to'][_0x1a05('0x4e')](',')[0x0];}return db[_0x1a05('0x4f')][_0x1a05('0x50')]({'where':{'id':_0x559b2d[_0x1a05('0x51')]},'include':[{'model':db[_0x1a05('0x52')],'as':_0x1a05('0x53'),'include':[{'model':db[_0x1a05('0x54')],'as':_0x1a05('0x55'),'where':{'email':_0x497ddc},'limit':0x1,'order':[[_0x1a05('0x56'),_0x1a05('0x57')]]}]},{'model':db[_0x1a05('0x58')],'as':_0x1a05('0x59'),'raw':!![]}]})['then'](function(_0x2c3b56){_0x4b3984=_0x2c3b56;if(_0x4b3984&&_0x4b3984[_0x1a05('0x59')]){var _0x5572fc={'tls':{'rejectUnauthorized':![]}};if(_[_0x1a05('0x5a')](_0x4b3984[_0x1a05('0x59')]['service'])){_0x5572fc[_0x1a05('0x5b')]=_0x4b3984[_0x1a05('0x59')][_0x1a05('0x5b')];_0x5572fc[_0x1a05('0x5c')]=_0x4b3984[_0x1a05('0x59')][_0x1a05('0x5c')];_0x5572fc[_0x1a05('0x5d')]=_0x4b3984[_0x1a05('0x59')][_0x1a05('0x5d')];if(_0x4b3984[_0x1a05('0x59')][_0x1a05('0x5e')]){_0x5572fc[_0x1a05('0x5f')]={'user':_0x4b3984['Smtp'][_0x1a05('0x60')],'pass':_0x4b3984[_0x1a05('0x59')][_0x1a05('0x61')]};}}else{_0x5572fc[_0x1a05('0x62')]=_0x4b3984['Smtp'][_0x1a05('0x62')];_0x5572fc[_0x1a05('0x5f')]={'user':_0x4b3984[_0x1a05('0x59')][_0x1a05('0x60')],'pass':_0x4b3984['Smtp'][_0x1a05('0x61')]};_0x5572fc[_0x1a05('0x5d')]=_0x4b3984[_0x1a05('0x59')][_0x1a05('0x5d')];}if(_0x483769[_0x1a05('0x48')][_0x1a05('0x63')]&&_0x483769['body'][_0x1a05('0x63')][_0x1a05('0x3a')]){for(var _0x2079c4=0x0;_0x2079c4<_0x483769['body']['attachments']['length'];_0x2079c4+=0x1){_0x483769[_0x1a05('0x48')][_0x1a05('0x63')][_0x2079c4]={'filename':_0x483769[_0x1a05('0x48')][_0x1a05('0x63')][_0x2079c4][_0x1a05('0x2c')],'path':path[_0x1a05('0x64')](config[_0x1a05('0x65')],'server/files/attachments',_0x483769[_0x1a05('0x48')][_0x1a05('0x63')][_0x2079c4][_0x1a05('0x66')])};}}_0x3e2ef1={'account':_0x5572fc,'message':_0x483769[_0x1a05('0x48')]};return;}})[_0x1a05('0x15')](function(){if(_0x4b3984[_0x1a05('0x53')]){if(_0x4b3984[_0x1a05('0x53')][_0x1a05('0x55')][_0x1a05('0x3a')]){return _0x4b3984[_0x1a05('0x53')][_0x1a05('0x55')][0x0];}else{return db['CmContact'][_0x1a05('0x4b')](_[_0x1a05('0xd')](_0x483769['body'],{'firstName':_0x483769[_0x1a05('0x48')]['to'],'email':_0x483769[_0x1a05('0x48')]['to'],'phone':_0x483769[_0x1a05('0x48')]['to'],'ListId':_0x4b3984[_0x1a05('0x67')]}));}}else{throw new Error(_0x1a05('0x68'));}})[_0x1a05('0x15')](function(){if(_0x3e2ef1){return respondWithRpcPromise(_0x1a05('0x69'),'sendMail',_0x3e2ef1,client9003)[_0x1a05('0x15')](function(_0x53a4d7){return _0x559b2d[_0x1a05('0x28')]({'read':!![],'messageId':_0x53a4d7[_0x1a05('0x6a')],'sentAt':moment()[_0x1a05('0x6b')](_0x1a05('0x6c'))});})[_0x1a05('0x20')](function(_0x72ee6f){logger[_0x1a05('0x1b')]('%s',JSON[_0x1a05('0x1a')](_0x72ee6f));return _0x559b2d;});}return _0x559b2d;});}return _0x559b2d;}})[_0x1a05('0x15')](respondWithResult(_0x5f3f28,0xc9))[_0x1a05('0x20')](handleError(_0x5f3f28,null));};exports[_0x1a05('0x6d')]=function(_0x31cc40,_0x27d441){var _0x4c3853={'agent':{},'channel':_0x1a05('0x6e')};if(_0x31cc40[_0x1a05('0x48')]['id']){delete _0x31cc40['body']['id'];}_0x31cc40[_0x1a05('0x48')][_0x1a05('0x6f')]=!![];_0x31cc40[_0x1a05('0x48')][_0x1a05('0x70')]=moment()[_0x1a05('0x6b')](_0x1a05('0x6c'));_0x31cc40[_0x1a05('0x48')][_0x1a05('0x71')]=_0x31cc40['body'][_0x1a05('0x71')]||_0x31cc40[_0x1a05('0x60')]['id'];_0x4c3853[_0x1a05('0x72')]['id']=_0x31cc40[_0x1a05('0x48')]['UserId'];return db[_0x1a05('0x2f')]['find']({'where':{'id':_0x31cc40[_0x1a05('0x45')]['id'],'UserId':null}})[_0x1a05('0x15')](handleEntityNotFound(_0x27d441,null))[_0x1a05('0x15')](saveUpdates(_0x31cc40[_0x1a05('0x48')],null))[_0x1a05('0x15')](function(_0xc1b25e){if(_0xc1b25e){_0x4c3853['message']=_0xc1b25e[_0x1a05('0x73')]({'plain':!![]});return db[_0x1a05('0x74')]['find']({'where':{'id':_0xc1b25e[_0x1a05('0x75')]}});}return null;})[_0x1a05('0x15')](handleEntityNotFound(_0x27d441,null))[_0x1a05('0x15')](function(_0x32d027){if(_0x32d027){return _0x32d027[_0x1a05('0x28')]({'UserId':_0x31cc40[_0x1a05('0x48')][_0x1a05('0x71')],'read1stAt':_[_0x1a05('0x5a')](_0x32d027[_0x1a05('0x76')])?moment()[_0x1a05('0x6b')](_0x1a05('0x6c')):undefined});}return null;})[_0x1a05('0x15')](function(_0x7c9a8){if(_0x7c9a8){_0x4c3853[_0x1a05('0x77')]=_0x7c9a8['get']({'plain':!![]});interaction_log[_0x1a05('0x16')](_0x1a05('0x78'),_0x31cc40[_0x1a05('0x60')]['id'],_0x31cc40[_0x1a05('0x60')]['name'],_0x31cc40[_0x1a05('0x60')][_0x1a05('0x79')],_0x4c3853[_0x1a05('0x77')]['id'],_0x31cc40[_0x1a05('0x48')]?JSON['stringify'](_0x31cc40['body']):'null');return respondWithRpcPromise(_0x1a05('0x7a'),_0x1a05('0x7b'),_0x4c3853);}return null;})[_0x1a05('0x15')](function(_0x2295d7){var _0x5e606a=_0x1a05('0x7c')+_0x2295d7[_0x1a05('0x1e')][_0x1a05('0x7d')];return db['sequelize'][_0x1a05('0x34')](_0x5e606a,{'type':db[_0x1a05('0x7e')][_0x1a05('0x7f')][_0x1a05('0x80')],'raw':!![]})[_0x1a05('0x15')](function(_0x141a39){return _0x141a39;});})[_0x1a05('0x15')](function(_0x21dc0a){if(_0x21dc0a){_0x4c3853[_0x1a05('0x1e')][_0x1a05('0x81')]=_0x21dc0a[0x0];if(!_0x31cc40[_0x1a05('0x48')]['UserId'])return;return db[_0x1a05('0x82')][_0x1a05('0x49')]({'where':{'id':_0x31cc40[_0x1a05('0x48')][_0x1a05('0x71')],'role':_0x1a05('0x72')},'attributes':['id',_0x1a05('0x2c'),_0x1a05('0x83'),_0x1a05('0x84'),_0x1a05('0x85')],'raw':!![]});}return null;})[_0x1a05('0x15')](function(_0x319b40){if(!_0x319b40)return null;_0x4c3853[_0x1a05('0x1e')][_0x1a05('0x72')]=_0x319b40;return _0x4c3853;})['then'](function(_0x3c015d){if(_0x3c015d){if(_0x31cc40[_0x1a05('0x48')][_0x1a05('0x86')]){_0x4c3853[_0x1a05('0x1e')]['interface']=util[_0x1a05('0x6b')](_0x1a05('0x87'),_0x31cc40[_0x1a05('0x60')][_0x1a05('0x2c')]);_0x4c3853[_0x1a05('0x1e')]['channel']=_0x4c3853[_0x1a05('0x88')];_0x4c3853[_0x1a05('0x1e')][_0x1a05('0x89')]=_0x4c3853[_0x1a05('0x88')];_0x4c3853[_0x1a05('0x1e')][_0x1a05('0x8a')]=_0x1a05('0x6d');_0x4c3853[_0x1a05('0x1e')][_0x1a05('0x48')]=htmlToText[_0x1a05('0x8b')](_0x4c3853[_0x1a05('0x1e')][_0x1a05('0x48')]);return respondWithRpcPromise('EventManager',_0x1a05('0x8c'),{'event':_0x1a05('0x8d'),'message':_0x4c3853[_0x1a05('0x1e')]},client9002)[_0x1a05('0x15')](function(){return _0x4c3853;});}return _0x4c3853;}return null;})[_0x1a05('0x15')](respondWithResult(_0x27d441,null))['catch'](handleError(_0x27d441,null));};exports[_0x1a05('0x8e')]=function(_0x5e0270,_0x4280eb){var _0x3ec59a={'agent':{},'channel':_0x1a05('0x6e')};if(_0x5e0270['body']['id']){delete _0x5e0270['body']['id'];}_0x5e0270['body']['UserId']=_0x5e0270['body'][_0x1a05('0x71')]||_0x5e0270[_0x1a05('0x60')]['id'];_0x3ec59a['agent']['id']=_0x5e0270[_0x1a05('0x48')][_0x1a05('0x71')];return db[_0x1a05('0x2f')][_0x1a05('0x49')]({'where':{'id':_0x5e0270[_0x1a05('0x45')]['id'],'UserId':null}})[_0x1a05('0x15')](handleEntityNotFound(_0x4280eb,null))['then'](function(_0x4cdbaa){if(_0x4cdbaa){_0x3ec59a[_0x1a05('0x1e')]=_0x4cdbaa[_0x1a05('0x73')]({'plain':!![]});return db[_0x1a05('0x74')][_0x1a05('0x49')]({'where':{'id':_0x4cdbaa[_0x1a05('0x75')]}});}return null;})[_0x1a05('0x15')](handleEntityNotFound(_0x4280eb,null))[_0x1a05('0x15')](function(_0xd68f8e){if(_0xd68f8e){_0x3ec59a['interaction']=_0xd68f8e[_0x1a05('0x73')]({'plain':!![]});interaction_log[_0x1a05('0x16')](_0x1a05('0x8f'),_0x5e0270[_0x1a05('0x60')]['id'],_0x5e0270['user'][_0x1a05('0x2c')],_0x5e0270[_0x1a05('0x60')][_0x1a05('0x79')],_0x3ec59a['interaction']['id'],_0x5e0270[_0x1a05('0x48')]?JSON[_0x1a05('0x1a')](_0x5e0270['body']):_0x1a05('0x90'));return respondWithRpcPromise(_0x1a05('0x91'),_0x1a05('0x92'),_0x3ec59a);}return null;})['then'](function(_0x12c428){var _0x189712='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x12c428[_0x1a05('0x1e')]['ContactId'];return db[_0x1a05('0x93')][_0x1a05('0x34')](_0x189712,{'type':db[_0x1a05('0x7e')][_0x1a05('0x7f')][_0x1a05('0x80')],'raw':!![]})[_0x1a05('0x15')](function(_0x543753){return _0x543753;});})[_0x1a05('0x15')](function(_0x3cef40){if(_0x3cef40){_0x3ec59a['message'][_0x1a05('0x81')]=_0x3cef40[0x0];if(!_0x5e0270['body']['UserId'])return;return db[_0x1a05('0x82')]['find']({'where':{'id':_0x5e0270[_0x1a05('0x48')][_0x1a05('0x71')],'role':_0x1a05('0x72')},'attributes':['id','name',_0x1a05('0x83'),_0x1a05('0x84'),_0x1a05('0x85')],'raw':!![]});}return null;})[_0x1a05('0x15')](function(_0x17f813){if(!_0x17f813)return null;_0x3ec59a['message']['agent']=_0x17f813;return _0x3ec59a;})[_0x1a05('0x15')](function(_0x5c07c8){if(_0x5c07c8){_0x5c07c8[_0x1a05('0x1e')][_0x1a05('0x94')]=util[_0x1a05('0x6b')](_0x1a05('0x87'),_0x5e0270[_0x1a05('0x60')][_0x1a05('0x2c')]);_0x5c07c8[_0x1a05('0x1e')][_0x1a05('0x88')]=_0x3ec59a[_0x1a05('0x88')];_0x5c07c8[_0x1a05('0x1e')][_0x1a05('0x89')]=_0x3ec59a['channel'];_0x5c07c8['message'][_0x1a05('0x8a')]=_0x1a05('0x8e');_0x5c07c8[_0x1a05('0x1e')][_0x1a05('0x48')]=htmlToText[_0x1a05('0x8b')](_0x3ec59a[_0x1a05('0x1e')][_0x1a05('0x48')]);respondWithRpcPromise(_0x1a05('0x8c'),'EventManager',{'event':_0x1a05('0x95'),'message':_0x5c07c8[_0x1a05('0x1e')]},client9002);return _0x3ec59a;}return null;})['then'](respondWithResult(_0x4280eb,null))[_0x1a05('0x20')](handleError(_0x4280eb,null));};exports[_0x1a05('0x96')]=function(_0x30861f,_0x227719){var _0x2d27c6=moment()[_0x1a05('0x97')]()['toString']();var _0x43b628=path[_0x1a05('0x64')](config[_0x1a05('0x65')],'server',_0x1a05('0x98'),'tmp');var _0x47f76d=path[_0x1a05('0x64')](config['root'],_0x1a05('0x99'),_0x1a05('0x98'),_0x1a05('0x63'));var _0x49319c=util[_0x1a05('0x6b')]('message-%s.eml',_0x2d27c6);return db[_0x1a05('0x2f')][_0x1a05('0x49')]({'where':{'id':_0x30861f['params']['id']},'attributes':['id',_0x1a05('0x48'),_0x1a05('0x9a'),'to','cc',_0x1a05('0x9b'),_0x1a05('0x9c'),_0x1a05('0x9d')],'include':_0x30861f['query']['attachments']?[{'model':db['Attachment'],'as':_0x1a05('0x9e')}]:undefined})[_0x1a05('0x15')](handleEntityNotFound(_0x227719,null))[_0x1a05('0x15')](function(_0x41e092){if(_0x41e092){var _0x358521=_0x41e092;var _0x2c50f8={'from':_0x358521[_0x1a05('0x9a')],'to':_0x358521['to'],'subject':_0x358521[_0x1a05('0x9c')],'html':_0x358521[_0x1a05('0x48')],'headers':{'Date':moment(_0x358521[_0x1a05('0x9d')])[_0x1a05('0x6b')](_0x1a05('0x9f'))},'attachments':[]};if(_0x41e092['cc']){_0x2c50f8['headers']['Cc']=_0x41e092['cc'];}if(_0x41e092['bcc']){_0x2c50f8['headers'][_0x1a05('0xa0')]=_0x41e092[_0x1a05('0x9b')];}return new BPromise(function(_0x2f8435,_0x2d70f1){if(_0x41e092[_0x1a05('0x9e')]){for(var _0x299648=0x0;_0x299648<_0x41e092['Attachments']['length'];_0x299648++){var _0x2fc7ab=_0x41e092[_0x1a05('0x9e')][_0x299648];var _0x9d4b59=path[_0x1a05('0x64')](_0x47f76d,_0x2fc7ab[_0x1a05('0x66')]);if(fs[_0x1a05('0xa1')](_0x9d4b59)){_0x2c50f8[_0x1a05('0x63')][_0x1a05('0xa2')]({'name':_0x2fc7ab[_0x1a05('0x2c')],'contentType':_0x2fc7ab[_0x1a05('0x32')],'data':fs[_0x1a05('0xa3')](_0x9d4b59)});}}}emlformat[_0x1a05('0xa4')](_0x2c50f8,function(_0x5b071e,_0x2c9029){if(_0x5b071e)return _0x2d70f1(_0x5b071e);fs[_0x1a05('0xa5')](path[_0x1a05('0x64')](_0x43b628,_0x49319c),_0x2c9029);return _0x2f8435(_0x2c9029);});});}})[_0x1a05('0x15')](function(_0x27b4dc){if(_0x27b4dc){return _0x227719[_0x1a05('0x96')](path['join'](_0x43b628,_0x49319c),_0x49319c,function(_0x3abb87){if(!_0x3abb87)fs['unlinkSync'](path[_0x1a05('0x64')](_0x43b628,_0x49319c));});}})[_0x1a05('0x20')](handleError(_0x227719,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 7172a42..7f726c1 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 _0xb666=['emit','hook','exports','events','../../mysqldb','MailMessage','setMaxListeners','save','update','remove'];(function(_0x40e679,_0x415574){var _0x448d23=function(_0x28b374){while(--_0x28b374){_0x40e679['push'](_0x40e679['shift']());}};_0x448d23(++_0x415574);}(_0xb666,0x1b1));var _0x6b66=function(_0x50408f,_0x92ffac){_0x50408f=_0x50408f-0x0;var _0xb02957=_0xb666[_0x50408f];return _0xb02957;};'use strict';var EventEmitter=require(_0x6b66('0x0'));var MailMessage=require(_0x6b66('0x1'))['db'][_0x6b66('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x6b66('0x3')](0x0);var events={'afterCreate':_0x6b66('0x4'),'afterUpdate':_0x6b66('0x5'),'afterDestroy':_0x6b66('0x6')};function emitEvent(_0x57a13f){return function(_0x3194d4,_0x1b297b,_0x576137){MailMessageEvents[_0x6b66('0x7')](_0x57a13f+':'+_0x3194d4['id'],_0x3194d4);MailMessageEvents[_0x6b66('0x7')](_0x57a13f,_0x3194d4);_0x576137(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x6b66('0x8')](e,emitEvent(event));}}module[_0x6b66('0x9')]=MailMessageEvents; \ No newline at end of file +var _0x0b1b=['save','update','emit','hasOwnProperty','events','../../mysqldb','MailMessage'];(function(_0x12fcbd,_0x884804){var _0x28ec2a=function(_0xa5ff99){while(--_0xa5ff99){_0x12fcbd['push'](_0x12fcbd['shift']());}};_0x28ec2a(++_0x884804);}(_0x0b1b,0x1e7));var _0xb0b1=function(_0xfa634c,_0x414e0e){_0xfa634c=_0xfa634c-0x0;var _0x73e478=_0x0b1b[_0xfa634c];return _0x73e478;};'use strict';var EventEmitter=require(_0xb0b1('0x0'));var MailMessage=require(_0xb0b1('0x1'))['db'][_0xb0b1('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb0b1('0x3'),'afterUpdate':_0xb0b1('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5e5d6c){return function(_0x5f6e57,_0x340a16,_0xd7aab9){MailMessageEvents[_0xb0b1('0x5')](_0x5e5d6c+':'+_0x5f6e57['id'],_0x5f6e57);MailMessageEvents[_0xb0b1('0x5')](_0x5e5d6c,_0x5f6e57);_0xd7aab9(null);};}for(var e in events){if(events[_0xb0b1('0x6')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index bd5e237..b3fd85a 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 _0x043d=['toLowerCase','direction','out','secret','UserId','MailInteraction','findOne','MailInteractionId','then','createdAt','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','exports','messageId','fti_mail_messages','plainBody','subject','body','fromString','models','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x043d,0xd8));var _0xd043=function(_0x108d5f,_0x33f82d){_0x108d5f=_0x108d5f-0x0;var _0x456ea3=_0x043d[_0x108d5f];return _0x456ea3;};'use strict';var _=require(_0xd043('0x0'));var util=require(_0xd043('0x1'));var logger=require(_0xd043('0x2'))('api');var moment=require('moment');var BPromise=require(_0xd043('0x3'));var rp=require('request-promise');var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0xd043('0x4'));var rimraf=require(_0xd043('0x5'));var config=require(_0xd043('0x6'));var attributes=require('./mailMessage.attributes');module[_0xd043('0x7')]=function(_0x90ede9,_0x1e04e3){return _0x90ede9['define']('MailMessage',attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0xd043('0x8')]},{'name':_0xd043('0x9'),'fields':[_0xd043('0xa'),_0xd043('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0xb408a6,_0x1367da,_0x3c2e68){if(_0xb408a6[_0xd043('0xc')]){_0xb408a6[_0xd043('0xa')]=htmlToText[_0xd043('0xd')](_0xb408a6['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x3c2e68(null,_0x1367da);},'afterCreate':function(_0x543267,_0x1e61fa,_0x477e3b){var _0x3d0945=_0x90ede9[_0xd043('0xe')];var _0x5683f9=_0x543267[_0xd043('0xf')]({'plain':!![]});if(_0x5683f9['direction'][_0xd043('0x10')]()==='in'||_0x5683f9[_0xd043('0x11')][_0xd043('0x10')]()===_0xd043('0x12')&&!_0x5683f9[_0xd043('0x13')]&&!_['isNil'](_0x5683f9[_0xd043('0x14')])){_0x3d0945[_0xd043('0x15')][_0xd043('0x16')]({'where':{'id':_0x5683f9[_0xd043('0x17')]}})[_0xd043('0x18')](function(_0x22df2b){if(_0x22df2b){_0x22df2b['update']({'lastMsgAt':_0x5683f9[_0xd043('0x19')],'lastMsgDirection':_0x5683f9[_0xd043('0x11')][_0xd043('0x10')]()});}})['catch'](function(_0x10e5d8){console[_0xd043('0x1a')](_0x10e5d8);});}_0x477e3b();}},'charset':_0xd043('0x1b'),'collate':_0xd043('0x1c')});}; \ No newline at end of file +var _0x9fe1=['utf8mb4_unicode_ci','util','api','moment','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','models','get','toLowerCase','direction','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','createdAt','error','utf8mb4'];(function(_0x8361a,_0x19482e){var _0x3d7b1b=function(_0x5edbc3){while(--_0x5edbc3){_0x8361a['push'](_0x8361a['shift']());}};_0x3d7b1b(++_0x19482e);}(_0x9fe1,0x1d2));var _0x19fe=function(_0x5590fe,_0x287598){_0x5590fe=_0x5590fe-0x0;var _0xce3f28=_0x9fe1[_0x5590fe];return _0xce3f28;};'use strict';var _=require('lodash');var util=require(_0x19fe('0x0'));var logger=require('../../config/logger')(_0x19fe('0x1'));var moment=require(_0x19fe('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var htmlToText=require(_0x19fe('0x3'));var fs=require('fs');var path=require(_0x19fe('0x4'));var rimraf=require(_0x19fe('0x5'));var config=require(_0x19fe('0x6'));var attributes=require(_0x19fe('0x7'));module['exports']=function(_0x12a586,_0x100abf){return _0x12a586['define'](_0x19fe('0x8'),attributes,{'tableName':_0x19fe('0x9'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x19fe('0xa')]},{'name':_0x19fe('0xb'),'fields':[_0x19fe('0xc'),_0x19fe('0xd')],'type':_0x19fe('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x31bc2a,_0x1eb063,_0x4033aa){if(_0x31bc2a[_0x19fe('0xf')]){_0x31bc2a['plainBody']=htmlToText['fromString'](_0x31bc2a[_0x19fe('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x4033aa(null,_0x1eb063);},'afterCreate':function(_0x29f370,_0x237ff6,_0x1bd4a9){var _0x2e042a=_0x12a586[_0x19fe('0x10')];var _0x4e93e6=_0x29f370[_0x19fe('0x11')]({'plain':!![]});if(_0x4e93e6['direction'][_0x19fe('0x12')]()==='in'||_0x4e93e6[_0x19fe('0x13')][_0x19fe('0x12')]()==='out'&&!_0x4e93e6[_0x19fe('0x14')]&&!_[_0x19fe('0x15')](_0x4e93e6[_0x19fe('0x16')])){_0x2e042a[_0x19fe('0x17')][_0x19fe('0x18')]({'where':{'id':_0x4e93e6[_0x19fe('0x19')]}})[_0x19fe('0x1a')](function(_0x1eab99){if(_0x1eab99){_0x1eab99['update']({'lastMsgAt':_0x4e93e6[_0x19fe('0x1b')],'lastMsgDirection':_0x4e93e6[_0x19fe('0x13')][_0x19fe('0x12')]()});}})['catch'](function(_0x21c2d6){console[_0x19fe('0x1c')](_0x21c2d6);});}_0x1bd4a9();}},'charset':_0x19fe('0x1d'),'collate':_0x19fe('0x1e')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 88d1fed..43610f4 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 _0x2032=['register','request','MailMessage,\x20%s,\x20%s','request\x20sent','error','message','info','result','CreateMailMessage','create','options','then','stringify','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x2032,0xd9));var _0x2203=function(_0xe84b75,_0x433ec2){_0xe84b75=_0xe84b75-0x0;var _0x24b39e=_0x2032[_0xe84b75];return _0x24b39e;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var moment=require(_0x2203('0x1'));var BPromise=require(_0x2203('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2203('0x3'));var db=require(_0x2203('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2203('0x5'))(_0x2203('0x6'));var config=require(_0x2203('0x7'));var jayson=require(_0x2203('0x8'));var client=jayson[_0x2203('0x9')][_0x2203('0xa')]({'port':0x232a});config[_0x2203('0xb')]=_[_0x2203('0xc')](config[_0x2203('0xb')],{'host':_0x2203('0xd'),'port':0x18eb});var socket=require(_0x2203('0xe'))(new Redis(config['redis']));require('./mailMessage.socket')[_0x2203('0xf')](socket);function respondWithRpcPromise(_0x549908,_0x27081c,_0x2972f3){return new BPromise(function(_0x6339c4,_0x5b19df){return client[_0x2203('0x10')](_0x549908,_0x2972f3)['then'](function(_0x3f690a){logger['info'](_0x2203('0x11'),_0x27081c,_0x2203('0x12'));logger['debug']('MailMessage,\x20%s,\x20%s,\x20%s',_0x27081c,'request\x20sent',JSON['stringify'](_0x3f690a));if(_0x3f690a['error']){if(_0x3f690a[_0x2203('0x13')]['code']===0x1f4){logger['error'](_0x2203('0x11'),_0x27081c,_0x3f690a[_0x2203('0x13')][_0x2203('0x14')]);return _0x5b19df(_0x3f690a[_0x2203('0x13')][_0x2203('0x14')]);}logger[_0x2203('0x13')](_0x2203('0x11'),_0x27081c,_0x3f690a[_0x2203('0x13')][_0x2203('0x14')]);return _0x6339c4(_0x3f690a[_0x2203('0x13')]['message']);}else{logger[_0x2203('0x15')](_0x2203('0x11'),_0x27081c,'request\x20sent');_0x6339c4(_0x3f690a[_0x2203('0x16')][_0x2203('0x14')]);}})['catch'](function(_0x30c6f7){logger['error'](_0x2203('0x11'),_0x27081c,_0x30c6f7);_0x5b19df(_0x30c6f7);});});}exports[_0x2203('0x17')]=function(_0x3c8c34){var _0x3b4034=this;return new Promise(function(_0x15cb1a,_0x449039){return db['MailMessage'][_0x2203('0x18')](_0x3c8c34['body'],{'raw':_0x3c8c34['options']?_0x3c8c34[_0x2203('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x2203('0x1a')](function(_0x5bfe61){logger['info'](_0x2203('0x17'),_0x3c8c34);logger['debug']('CreateMailMessage',_0x3c8c34,JSON[_0x2203('0x1b')](_0x5bfe61));_0x15cb1a(_0x5bfe61);})[_0x2203('0x1c')](function(_0x21f930){logger[_0x2203('0x13')](_0x2203('0x17'),_0x21f930[_0x2203('0x14')],_0x3c8c34);_0x449039(_0x3b4034[_0x2203('0x13')](0x1f4,_0x21f930[_0x2203('0x14')]));});});}; \ No newline at end of file +var _0x80ed=['create','options','raw','stringify','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','CreateMailMessage','MailMessage'];(function(_0x3dbacb,_0x5eaf09){var _0x5eb0c5=function(_0x4b2919){while(--_0x4b2919){_0x3dbacb['push'](_0x3dbacb['shift']());}};_0x5eb0c5(++_0x5eaf09);}(_0x80ed,0x11c));var _0xd80e=function(_0x27886d,_0x58533a){_0x27886d=_0x27886d-0x0;var _0x509dc2=_0x80ed[_0x27886d];return _0x509dc2;};'use strict';var _=require(_0xd80e('0x0'));var util=require('util');var moment=require(_0xd80e('0x1'));var BPromise=require(_0xd80e('0x2'));var rs=require(_0xd80e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd80e('0x4'))['db'];var utils=require(_0xd80e('0x5'));var logger=require(_0xd80e('0x6'))(_0xd80e('0x7'));var config=require('../../config/environment');var jayson=require(_0xd80e('0x8'));var client=jayson[_0xd80e('0x9')][_0xd80e('0xa')]({'port':0x232a});config['redis']=_[_0xd80e('0xb')](config[_0xd80e('0xc')],{'host':_0xd80e('0xd'),'port':0x18eb});var socket=require(_0xd80e('0xe'))(new Redis(config[_0xd80e('0xc')]));require(_0xd80e('0xf'))[_0xd80e('0x10')](socket);function respondWithRpcPromise(_0x2457f5,_0x68625,_0x7f93b4){return new BPromise(function(_0x4eee08,_0x450b44){return client[_0xd80e('0x11')](_0x2457f5,_0x7f93b4)[_0xd80e('0x12')](function(_0x30c9d0){logger[_0xd80e('0x13')](_0xd80e('0x14'),_0x68625,_0xd80e('0x15'));logger[_0xd80e('0x16')](_0xd80e('0x17'),_0x68625,'request\x20sent',JSON['stringify'](_0x30c9d0));if(_0x30c9d0['error']){if(_0x30c9d0['error'][_0xd80e('0x18')]===0x1f4){logger[_0xd80e('0x19')](_0xd80e('0x14'),_0x68625,_0x30c9d0[_0xd80e('0x19')][_0xd80e('0x1a')]);return _0x450b44(_0x30c9d0['error'][_0xd80e('0x1a')]);}logger[_0xd80e('0x19')](_0xd80e('0x14'),_0x68625,_0x30c9d0[_0xd80e('0x19')][_0xd80e('0x1a')]);return _0x4eee08(_0x30c9d0[_0xd80e('0x19')][_0xd80e('0x1a')]);}else{logger[_0xd80e('0x13')]('MailMessage,\x20%s,\x20%s',_0x68625,_0xd80e('0x15'));_0x4eee08(_0x30c9d0[_0xd80e('0x1b')][_0xd80e('0x1a')]);}})[_0xd80e('0x1c')](function(_0x593af6){logger[_0xd80e('0x19')](_0xd80e('0x14'),_0x68625,_0x593af6);_0x450b44(_0x593af6);});});}exports[_0xd80e('0x1d')]=function(_0x527237){var _0x41417d=this;return new Promise(function(_0x2ef8a1,_0x2765ea){return db[_0xd80e('0x1e')][_0xd80e('0x1f')](_0x527237['body'],{'raw':_0x527237['options']?_0x527237[_0xd80e('0x20')][_0xd80e('0x21')]===undefined?!![]:![]:!![]})[_0xd80e('0x12')](function(_0x2d46e7){logger[_0xd80e('0x13')](_0xd80e('0x1d'),_0x527237);logger[_0xd80e('0x16')]('CreateMailMessage',_0x527237,JSON[_0xd80e('0x22')](_0x2d46e7));_0x2ef8a1(_0x2d46e7);})[_0xd80e('0x1c')](function(_0x170109){logger['error'](_0xd80e('0x1d'),_0x170109[_0xd80e('0x1a')],_0x527237);_0x2765ea(_0x41417d[_0xd80e('0x19')](0x1f4,_0x170109['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 12518e4..dba61c2 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 _0x68a5=['removeListener','register','length','mailMessage:','./mailMessage.events','save','remove','update','emit'];(function(_0xd7b0a4,_0x53c7d3){var _0x184e9e=function(_0x325bbd){while(--_0x325bbd){_0xd7b0a4['push'](_0xd7b0a4['shift']());}};_0x184e9e(++_0x53c7d3);}(_0x68a5,0x67));var _0x568a=function(_0x19cf9b,_0x17b5c8){_0x19cf9b=_0x19cf9b-0x0;var _0x20507c=_0x68a5[_0x19cf9b];return _0x20507c;};'use strict';var MailMessageEvents=require(_0x568a('0x0'));var events=[_0x568a('0x1'),_0x568a('0x2'),_0x568a('0x3')];function createListener(_0x1118e1,_0x507e6b){return function(_0x282423){_0x507e6b[_0x568a('0x4')](_0x1118e1,_0x282423);};}function removeListener(_0x493b71,_0x551c4b){return function(){MailMessageEvents[_0x568a('0x5')](_0x493b71,_0x551c4b);};}exports[_0x568a('0x6')]=function(_0x9d91df){for(var _0x5d6e11=0x0,_0x233ce2=events[_0x568a('0x7')];_0x5d6e11<_0x233ce2;_0x5d6e11++){var _0x319a91=events[_0x5d6e11];var _0x5e65fe=createListener(_0x568a('0x8')+_0x319a91,_0x9d91df);MailMessageEvents['on'](_0x319a91,_0x5e65fe);}}; \ No newline at end of file +var _0x2756=['length','./mailMessage.events','register'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x2756,0x1ea));var _0x6275=function(_0x4c7935,_0x4a53fb){_0x4c7935=_0x4c7935-0x0;var _0x30651d=_0x2756[_0x4c7935];return _0x30651d;};'use strict';var MailMessageEvents=require(_0x6275('0x0'));var events=['save','remove','update'];function createListener(_0x54bfb2,_0x3b3e57){return function(_0x8a2d2a){_0x3b3e57['emit'](_0x54bfb2,_0x8a2d2a);};}function removeListener(_0x5024c0,_0x2f7511){return function(){MailMessageEvents['removeListener'](_0x5024c0,_0x2f7511);};}exports[_0x6275('0x1')]=function(_0x2043e7){for(var _0x3da4cd=0x0,_0x68166f=events[_0x6275('0x2')];_0x3da4cd<_0x68166f;_0x3da4cd++){var _0x25c318=events[_0x3da4cd];var _0x38d151=createListener('mailMessage:'+_0x25c318,_0x2043e7);MailMessageEvents['on'](_0x25c318,_0x38d151);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index ea05867..f4cb101 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 _0xba20=['fs-extra','./mailQueue.controller','index','get','/describe','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','put','delete','removeAgents','exports','multer','express','Router'];(function(_0x5c3a9a,_0x464256){var _0x3b1942=function(_0x3025a6){while(--_0x3025a6){_0x5c3a9a['push'](_0x5c3a9a['shift']());}};_0x3b1942(++_0x464256);}(_0xba20,0x8d));var _0x0ba2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xba20[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x0ba2('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0ba2('0x1'));var router=express[_0x0ba2('0x2')]();var fs_extra=require(_0x0ba2('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0ba2('0x4'));router['get']('/',auth['isAuthenticated'](),controller[_0x0ba2('0x5')]);router[_0x0ba2('0x6')](_0x0ba2('0x7'),auth[_0x0ba2('0x8')](),controller[_0x0ba2('0x9')]);router[_0x0ba2('0x6')](_0x0ba2('0xa'),auth['isAuthenticated'](),controller[_0x0ba2('0xb')]);router[_0x0ba2('0x6')]('/:id/members',auth[_0x0ba2('0x8')](),controller[_0x0ba2('0xc')]);router[_0x0ba2('0x6')](_0x0ba2('0xd'),auth['isAuthenticated'](),controller[_0x0ba2('0xe')]);router['get'](_0x0ba2('0xf'),auth[_0x0ba2('0x8')](),controller[_0x0ba2('0x10')]);router[_0x0ba2('0x11')]('/',auth[_0x0ba2('0x8')](),controller[_0x0ba2('0x12')]);router['post'](_0x0ba2('0xd'),auth[_0x0ba2('0x8')](),controller['addTeams']);router[_0x0ba2('0x11')]('/:id/users',auth[_0x0ba2('0x8')](),controller[_0x0ba2('0x13')]);router[_0x0ba2('0x14')](_0x0ba2('0xa'),auth[_0x0ba2('0x8')](),controller['update']);router[_0x0ba2('0x15')](_0x0ba2('0xa'),auth[_0x0ba2('0x8')](),controller['destroy']);router[_0x0ba2('0x15')](_0x0ba2('0xd'),auth[_0x0ba2('0x8')](),controller['removeTeams']);router[_0x0ba2('0x15')](_0x0ba2('0xf'),auth['isAuthenticated'](),controller[_0x0ba2('0x16')]);module[_0x0ba2('0x17')]=router; \ No newline at end of file +var _0x5219=['addAgents','put','update','delete','removeTeams','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams'];(function(_0x5cb265,_0x59a65b){var _0x594bc6=function(_0x580cae){while(--_0x580cae){_0x5cb265['push'](_0x5cb265['shift']());}};_0x594bc6(++_0x59a65b);}(_0x5219,0x7a));var _0x9521=function(_0x4fff63,_0x3155dc){_0x4fff63=_0x4fff63-0x0;var _0x3e5eb6=_0x5219[_0x4fff63];return _0x3e5eb6;};'use strict';var multer=require(_0x9521('0x0'));var util=require(_0x9521('0x1'));var path=require(_0x9521('0x2'));var timeout=require('connect-timeout');var express=require(_0x9521('0x3'));var router=express[_0x9521('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9521('0x5'));var interaction=require(_0x9521('0x6'));var config=require(_0x9521('0x7'));var controller=require(_0x9521('0x8'));router[_0x9521('0x9')]('/',auth[_0x9521('0xa')](),controller[_0x9521('0xb')]);router[_0x9521('0x9')](_0x9521('0xc'),auth['isAuthenticated'](),controller[_0x9521('0xd')]);router[_0x9521('0x9')](_0x9521('0xe'),auth[_0x9521('0xa')](),controller['show']);router[_0x9521('0x9')](_0x9521('0xf'),auth[_0x9521('0xa')](),controller['getMembers']);router[_0x9521('0x9')](_0x9521('0x10'),auth[_0x9521('0xa')](),controller[_0x9521('0x11')]);router['get'](_0x9521('0x12'),auth[_0x9521('0xa')](),controller[_0x9521('0x13')]);router['post']('/',auth[_0x9521('0xa')](),controller[_0x9521('0x14')]);router[_0x9521('0x15')](_0x9521('0x10'),auth['isAuthenticated'](),controller[_0x9521('0x16')]);router['post'](_0x9521('0x12'),auth[_0x9521('0xa')](),controller[_0x9521('0x17')]);router[_0x9521('0x18')](_0x9521('0xe'),auth[_0x9521('0xa')](),controller[_0x9521('0x19')]);router[_0x9521('0x1a')](_0x9521('0xe'),auth[_0x9521('0xa')](),controller['destroy']);router[_0x9521('0x1a')](_0x9521('0x10'),auth[_0x9521('0xa')](),controller[_0x9521('0x1b')]);router[_0x9521('0x1a')](_0x9521('0x12'),auth[_0x9521('0xa')](),controller['removeAgents']);module[_0x9521('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 61ca56d..dae5d46 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 _0x54db=['name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x38446d,_0x3b8dfc){var _0x3bf107=function(_0x9e20c){while(--_0x9e20c){_0x38446d['push'](_0x38446d['shift']());}};_0x3bf107(++_0x3b8dfc);}(_0x54db,0x153));var _0xb54d=function(_0x186376,_0x5d988a){_0x186376=_0x186376-0x0;var _0x2dbdd9=_0x54db[_0x186376];return _0x2dbdd9;};'use strict';var Sequelize=require(_0xb54d('0x0'));module[_0xb54d('0x1')]={'name':{'type':Sequelize[_0xb54d('0x2')],'unique':_0xb54d('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb54d('0x2')]},'timeout':{'type':Sequelize[_0xb54d('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb54d('0x5')](_0xb54d('0x6'),_0xb54d('0x7'),_0xb54d('0x8'))}}; \ No newline at end of file +var _0xf193=['ENUM','rrmemory','beepall','roundrobin','sequelize','STRING','INTEGER'];(function(_0x1cc6c3,_0x156eee){var _0xd39a27=function(_0x5063dc){while(--_0x5063dc){_0x1cc6c3['push'](_0x1cc6c3['shift']());}};_0xd39a27(++_0x156eee);}(_0xf193,0xe4));var _0x3f19=function(_0x25359b,_0x21a796){_0x25359b=_0x25359b-0x0;var _0x28dc83=_0xf193[_0x25359b];return _0x28dc83;};'use strict';var Sequelize=require(_0x3f19('0x0'));module['exports']={'name':{'type':Sequelize[_0x3f19('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x3f19('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3f19('0x3')](_0x3f19('0x4'),_0x3f19('0x5'),_0x3f19('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 6dbca1f..a3ee521 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 _0xe4fb=['toString','QueryTypes','SELECT','every','includes','all','union','compact','transaction','isEmpty','removeAgents','addAgents','omit','spread','isArray','userMailQueue:remove','getAgents','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','end','json','undefined','limit','count','offset','status','set','Content-Range','apply','update','then','UserProfileResource','destroy','error','name','send','index','map','MailQueue','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','MailQueues','UserProfileSection','userProfileId','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','sort','MailQueueId','UserMailQueue','findAndCountAll','UserId','mailPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','User','online','interface','flatMap','sequelize','each','findOrCreate','emit','userMailQueue:save','removeTeams','ids','Agents','select','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?','push'];(function(_0x40cd9d,_0x3c1c69){var _0xcd396c=function(_0xa4e838){while(--_0xa4e838){_0x40cd9d['push'](_0x40cd9d['shift']());}};_0xcd396c(++_0x3c1c69);}(_0xe4fb,0x9d));var _0xbe4f=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xe4fb[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbe4f('0x0'));var rp=require(_0xbe4f('0x1'));var moment=require(_0xbe4f('0x2'));var BPromise=require(_0xbe4f('0x3'));var Mustache=require(_0xbe4f('0x4'));var util=require(_0xbe4f('0x5'));var path=require('path');var sox=require(_0xbe4f('0x6'));var csv=require('to-csv');var ejs=require(_0xbe4f('0x7'));var fs=require('fs');var fs_extra=require(_0xbe4f('0x8'));var _=require('lodash');var squel=require(_0xbe4f('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xbe4f('0xa'));var toCsv=require(_0xbe4f('0xb'));var querystring=require(_0xbe4f('0xc'));var Papa=require(_0xbe4f('0xd'));var Redis=require(_0xbe4f('0xe'));var authService=require(_0xbe4f('0xf'));var qs=require(_0xbe4f('0x10'));var as=require(_0xbe4f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbe4f('0x12'))(_0xbe4f('0x13'));var utils=require(_0xbe4f('0x14'));var config=require(_0xbe4f('0x15'));var licenseUtil=require(_0xbe4f('0x16'));var db=require('../../mysqldb')['db'];config[_0xbe4f('0x17')]=_['defaults'](config[_0xbe4f('0x17')],{'host':_0xbe4f('0x18'),'port':0x18eb});var socket=require(_0xbe4f('0x19'))(new Redis(config[_0xbe4f('0x17')]));require(_0xbe4f('0x1a'))[_0xbe4f('0x1b')](socket);function respondWithStatusCode(_0x5acd61,_0x38e552){_0x38e552=_0x38e552||0xcc;return function(_0x3563e4){if(_0x3563e4){return _0x5acd61[_0xbe4f('0x1c')](_0x38e552);}return _0x5acd61['status'](_0x38e552)[_0xbe4f('0x1d')]();};}function respondWithResult(_0x5b063b,_0x7f85c){_0x7f85c=_0x7f85c||0xc8;return function(_0x29b08d){if(_0x29b08d){return _0x5b063b['status'](_0x7f85c)[_0xbe4f('0x1e')](_0x29b08d);}};}function respondWithFilteredResult(_0x372d48,_0x48c91e){return function(_0x112f1c){if(_0x112f1c){var _0xd4a070=typeof _0x48c91e['offset']===_0xbe4f('0x1f')&&typeof _0x48c91e[_0xbe4f('0x20')]===_0xbe4f('0x1f');var _0x4bf393=_0x112f1c[_0xbe4f('0x21')];var _0x44e965=_0xd4a070?0x0:_0x48c91e['offset'];var _0x4dd64c=_0xd4a070?_0x112f1c[_0xbe4f('0x21')]:_0x48c91e[_0xbe4f('0x22')]+_0x48c91e[_0xbe4f('0x20')];var _0x40685d;if(_0x4dd64c>=_0x4bf393){_0x4dd64c=_0x4bf393;_0x40685d=0xc8;}else{_0x40685d=0xce;}_0x372d48[_0xbe4f('0x23')](_0x40685d);return _0x372d48[_0xbe4f('0x24')](_0xbe4f('0x25'),_0x44e965+'-'+_0x4dd64c+'/'+_0x4bf393)['json'](_0x112f1c);}return null;};}function patchUpdates(_0x510f04){return function(_0x77d36d){try{jsonpatch[_0xbe4f('0x26')](_0x77d36d,_0x510f04,!![]);}catch(_0x4a620e){return BPromise['reject'](_0x4a620e);}return _0x77d36d['save']();};}function saveUpdates(_0x140df9,_0x54b797){return function(_0x1a66eb){if(_0x1a66eb){return _0x1a66eb[_0xbe4f('0x27')](_0x140df9)[_0xbe4f('0x28')](function(_0x117258){return _0x117258;});}return null;};}function removeEntity(_0x17a3c8,_0x40d02b){return function(_0x4c70c6){if(_0x4c70c6){return _0x4c70c6['destroy']()[_0xbe4f('0x28')](function(){var _0xa1b8e2=_0x4c70c6['get']({'plain':!![]});var _0x5d2863='MailQueues';return db[_0xbe4f('0x29')][_0xbe4f('0x2a')]({'where':{'type':_0x5d2863,'resourceId':_0xa1b8e2['id']}})['then'](function(){return _0x4c70c6;});})[_0xbe4f('0x28')](function(){_0x17a3c8['status'](0xcc)[_0xbe4f('0x1d')]();});}};}function handleEntityNotFound(_0x3cc993,_0x79dc87){return function(_0x2dacf6){if(!_0x2dacf6){_0x3cc993['sendStatus'](0x194);}return _0x2dacf6;};}function handleError(_0x4b7cd8,_0x16e54d){_0x16e54d=_0x16e54d||0x1f4;return function(_0x3de330){logger[_0xbe4f('0x2b')](_0x3de330['stack']);if(_0x3de330[_0xbe4f('0x2c')]){delete _0x3de330[_0xbe4f('0x2c')];}_0x4b7cd8['status'](_0x16e54d)[_0xbe4f('0x2d')](_0x3de330);};}exports[_0xbe4f('0x2e')]=function(_0x3dfb00,_0x3e9bf8){var _0x434911={},_0x319769={},_0x40ddbd={'count':0x0,'rows':[]};var _0x4c6ff8=_[_0xbe4f('0x2f')](db[_0xbe4f('0x30')]['rawAttributes'],function(_0x147a19){return{'name':_0x147a19[_0xbe4f('0x31')],'type':_0x147a19[_0xbe4f('0x32')][_0xbe4f('0x33')]};});_0x319769[_0xbe4f('0x34')]=_[_0xbe4f('0x2f')](_0x4c6ff8,_0xbe4f('0x2c'));_0x319769[_0xbe4f('0x35')]=_['keys'](_0x3dfb00[_0xbe4f('0x35')]);_0x319769[_0xbe4f('0x36')]=_['intersection'](_0x319769[_0xbe4f('0x34')],_0x319769[_0xbe4f('0x35')]);_0x434911['attributes']=_[_0xbe4f('0x37')](_0x319769[_0xbe4f('0x34')],qs[_0xbe4f('0x38')](_0x3dfb00[_0xbe4f('0x35')][_0xbe4f('0x38')]));_0x434911['attributes']=_0x434911[_0xbe4f('0x39')][_0xbe4f('0x3a')]?_0x434911[_0xbe4f('0x39')]:_0x319769[_0xbe4f('0x34')];if(!_0x3dfb00[_0xbe4f('0x35')][_0xbe4f('0x3b')](_0xbe4f('0x3c'))){_0x434911[_0xbe4f('0x20')]=qs[_0xbe4f('0x20')](_0x3dfb00[_0xbe4f('0x35')][_0xbe4f('0x20')]);_0x434911[_0xbe4f('0x22')]=qs['offset'](_0x3dfb00[_0xbe4f('0x35')][_0xbe4f('0x22')]);}_0x434911[_0xbe4f('0x3d')]=qs['sort'](_0x3dfb00[_0xbe4f('0x35')]['sort']);_0x434911[_0xbe4f('0x3e')]=qs[_0xbe4f('0x36')](_[_0xbe4f('0x3f')](_0x3dfb00[_0xbe4f('0x35')],_0x319769[_0xbe4f('0x36')]),_0x4c6ff8);if(_0x3dfb00[_0xbe4f('0x35')][_0xbe4f('0x40')]){_0x434911[_0xbe4f('0x3e')]=_[_0xbe4f('0x41')](_0x434911['where'],{'$or':_[_0xbe4f('0x2f')](_0x4c6ff8,function(_0x1b9346){if(_0x1b9346[_0xbe4f('0x32')]!==_0xbe4f('0x42')){var _0x4679d5={};_0x4679d5[_0x1b9346['name']]={'$like':'%'+_0x3dfb00[_0xbe4f('0x35')][_0xbe4f('0x40')]+'%'};return _0x4679d5;}})});}_0x434911=_[_0xbe4f('0x41')]({},_0x434911,_0x3dfb00[_0xbe4f('0x43')]);var _0x5cb3d6={'where':_0x434911[_0xbe4f('0x3e')]};return db[_0xbe4f('0x30')][_0xbe4f('0x21')](_0x5cb3d6)[_0xbe4f('0x28')](function(_0x510987){_0x40ddbd[_0xbe4f('0x21')]=_0x510987;if(_0x3dfb00[_0xbe4f('0x35')][_0xbe4f('0x44')]){_0x434911[_0xbe4f('0x45')]=[{'all':!![]}];}return db[_0xbe4f('0x30')][_0xbe4f('0x46')](_0x434911);})[_0xbe4f('0x28')](function(_0x3493bd){_0x40ddbd[_0xbe4f('0x47')]=_0x3493bd;return _0x40ddbd;})[_0xbe4f('0x28')](respondWithFilteredResult(_0x3e9bf8,_0x434911))['catch'](handleError(_0x3e9bf8,null));};exports[_0xbe4f('0x48')]=function(_0x256c54,_0x3987f5){var _0x2ee7fd={'raw':!![],'where':{'id':_0x256c54[_0xbe4f('0x49')]['id']}},_0x285dea={};_0x285dea[_0xbe4f('0x34')]=_[_0xbe4f('0x4a')](db[_0xbe4f('0x30')][_0xbe4f('0x4b')]);_0x285dea[_0xbe4f('0x35')]=_[_0xbe4f('0x4a')](_0x256c54['query']);_0x285dea[_0xbe4f('0x36')]=_[_0xbe4f('0x37')](_0x285dea['model'],_0x285dea[_0xbe4f('0x35')]);_0x2ee7fd['attributes']=_[_0xbe4f('0x37')](_0x285dea[_0xbe4f('0x34')],qs[_0xbe4f('0x38')](_0x256c54['query']['fields']));_0x2ee7fd['attributes']=_0x2ee7fd[_0xbe4f('0x39')][_0xbe4f('0x3a')]?_0x2ee7fd[_0xbe4f('0x39')]:_0x285dea[_0xbe4f('0x34')];if(_0x256c54[_0xbe4f('0x35')][_0xbe4f('0x44')]){_0x2ee7fd[_0xbe4f('0x45')]=[{'all':!![]}];}_0x2ee7fd=_[_0xbe4f('0x41')]({},_0x2ee7fd,_0x256c54['options']);return db[_0xbe4f('0x30')][_0xbe4f('0x4c')](_0x2ee7fd)[_0xbe4f('0x28')](handleEntityNotFound(_0x3987f5,null))['then'](respondWithResult(_0x3987f5,null))['catch'](handleError(_0x3987f5,null));};exports[_0xbe4f('0x4d')]=function(_0x599013,_0x18729a){return db[_0xbe4f('0x30')][_0xbe4f('0x4d')](_0x599013[_0xbe4f('0x4e')],{})[_0xbe4f('0x28')](function(_0x615f00){var _0x63d66d=_0x599013[_0xbe4f('0x4f')]['get']({'plain':!![]});if(!_0x63d66d)throw new Error(_0xbe4f('0x50'));if(_0x63d66d['role']===_0xbe4f('0x4f')){var _0x42c352=_0x615f00[_0xbe4f('0x51')]({'plain':!![]});var _0x4847a6=_0xbe4f('0x52');return db[_0xbe4f('0x53')][_0xbe4f('0x4c')]({'where':{'name':_0x4847a6,'userProfileId':_0x63d66d[_0xbe4f('0x54')]},'raw':!![]})[_0xbe4f('0x28')](function(_0x1c8a58){if(_0x1c8a58&&_0x1c8a58['autoAssociation']===0x0){return db['UserProfileResource'][_0xbe4f('0x4d')]({'name':_0x42c352['name'],'resourceId':_0x42c352['id'],'type':_0x1c8a58['name'],'sectionId':_0x1c8a58['id']},{})[_0xbe4f('0x28')](function(){return _0x615f00;});}else{return _0x615f00;}})[_0xbe4f('0x55')](function(_0x50c23f){logger[_0xbe4f('0x2b')](_0xbe4f('0x56'),_0x50c23f);throw _0x50c23f;});}return _0x615f00;})[_0xbe4f('0x28')](respondWithResult(_0x18729a,0xc9))['catch'](handleError(_0x18729a,null));};exports['update']=function(_0x55989c,_0x51b398){if(_0x55989c['body']['id']){delete _0x55989c['body']['id'];}return db[_0xbe4f('0x30')][_0xbe4f('0x4c')]({'where':{'id':_0x55989c['params']['id']}})['then'](handleEntityNotFound(_0x51b398,null))[_0xbe4f('0x28')](saveUpdates(_0x55989c[_0xbe4f('0x4e')],null))[_0xbe4f('0x28')](respondWithResult(_0x51b398,null))[_0xbe4f('0x55')](handleError(_0x51b398,null));};exports[_0xbe4f('0x2a')]=function(_0x4ffb03,_0xa8e04a){return db[_0xbe4f('0x30')][_0xbe4f('0x4c')]({'where':{'id':_0x4ffb03[_0xbe4f('0x49')]['id']}})['then'](handleEntityNotFound(_0xa8e04a,null))['then'](removeEntity(_0xa8e04a,null))['catch'](handleError(_0xa8e04a,null));};exports[_0xbe4f('0x57')]=function(_0x514e38,_0x52f3f0){return db[_0xbe4f('0x30')]['describe']()[_0xbe4f('0x28')](respondWithResult(_0x52f3f0,null))[_0xbe4f('0x55')](handleError(_0x52f3f0,null));};exports['getMembers']=function(_0x253c34,_0x4f29b0,_0x207b95){var _0x542c89={'raw':!![],'where':{}},_0x4cb0fa={},_0x234051;return db[_0xbe4f('0x30')][_0xbe4f('0x58')]({'where':{'id':_0x253c34[_0xbe4f('0x49')]['id']}})[_0xbe4f('0x28')](handleEntityNotFound(_0x4f29b0,null))[_0xbe4f('0x28')](function(_0x364d98){if(_0x364d98){_0x234051=_0x364d98['get']({'plain':!![]});_0x4cb0fa[_0xbe4f('0x34')]=_['keys'](db['UserMailQueue'][_0xbe4f('0x4b')]);_0x4cb0fa['query']=_[_0xbe4f('0x4a')](_0x253c34[_0xbe4f('0x35')]);_0x4cb0fa[_0xbe4f('0x36')]=_['intersection'](_0x4cb0fa[_0xbe4f('0x34')],_0x4cb0fa[_0xbe4f('0x35')]);_0x542c89[_0xbe4f('0x39')]=_[_0xbe4f('0x37')](_0x4cb0fa['model'],qs[_0xbe4f('0x38')](_0x253c34['query'][_0xbe4f('0x38')]));_0x542c89['attributes']=_0x542c89['attributes'][_0xbe4f('0x3a')]?_0x542c89[_0xbe4f('0x39')]:_0x4cb0fa[_0xbe4f('0x34')];if(!_0x253c34[_0xbe4f('0x35')]['hasOwnProperty'](_0xbe4f('0x3c'))){_0x542c89[_0xbe4f('0x20')]=qs[_0xbe4f('0x20')](_0x253c34[_0xbe4f('0x35')]['limit']);_0x542c89[_0xbe4f('0x22')]=qs[_0xbe4f('0x22')](_0x253c34['query'][_0xbe4f('0x22')]);}_0x542c89[_0xbe4f('0x3d')]=qs[_0xbe4f('0x59')](_0x253c34[_0xbe4f('0x35')][_0xbe4f('0x59')]);_0x542c89['where']=qs[_0xbe4f('0x36')](_[_0xbe4f('0x3f')](_0x253c34[_0xbe4f('0x35')],_0x4cb0fa[_0xbe4f('0x36')]));_0x542c89[_0xbe4f('0x3e')][_0xbe4f('0x5a')]=_0x364d98['id'];if(_0x253c34[_0xbe4f('0x35')][_0xbe4f('0x40')]){_0x542c89[_0xbe4f('0x3e')]=_['merge'](_0x542c89[_0xbe4f('0x3e')],{'$or':_[_0xbe4f('0x2f')](_0x542c89['attributes'],function(_0x3522f5){var _0xdb7350={};_0xdb7350[_0x3522f5]={'$like':'%'+_0x253c34[_0xbe4f('0x35')][_0xbe4f('0x40')]+'%'};return _0xdb7350;})});}_0x542c89=_[_0xbe4f('0x41')]({},_0x542c89,_0x253c34[_0xbe4f('0x43')]);return db[_0xbe4f('0x5b')][_0xbe4f('0x46')](_0x542c89);}})[_0xbe4f('0x28')](function(_0x557c9f){if(_0x557c9f){return db['User'][_0xbe4f('0x5c')]({'where':{'id':_[_0xbe4f('0x2f')](_0x557c9f,_0xbe4f('0x5d')),'role':'agent'},'attributes':['id',_0xbe4f('0x2c'),_0xbe4f('0x5e'),_0xbe4f('0x5f'),_0xbe4f('0x60')]});}})['then'](function(_0x3e71e0){if(_0x3e71e0){return{'count':_0x3e71e0[_0xbe4f('0x21')],'rows':_['map'](_0x3e71e0[_0xbe4f('0x47')],function(_0x433c5c){return{'membername':_0x433c5c[_0xbe4f('0x2c')],'UserId':_0x433c5c['id'],'queue_name':_0x234051[_0xbe4f('0x2c')],'MailQueueId':_0x234051['id'],'interface':util['format'](_0xbe4f('0x61'),_0xbe4f('0x62'),_0x433c5c[_0xbe4f('0x2c')]),'penalty':0x0,'paused':_0x433c5c[_0xbe4f('0x5e')],'createdAt':_0x433c5c[_0xbe4f('0x60')],'updatedAt':_0x433c5c[_0xbe4f('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xbe4f('0x28')](respondWithFilteredResult(_0x4f29b0,_0x542c89))[_0xbe4f('0x55')](handleError(_0x4f29b0,null));};exports[_0xbe4f('0x63')]=function(_0x100096,_0x2ccf69,_0x312cf6){var _0x17279d={};var _0x425cc9={};var _0x584d6e;var _0x535336;return db[_0xbe4f('0x30')][_0xbe4f('0x58')]({'where':{'id':_0x100096[_0xbe4f('0x49')]['id']}})['then'](handleEntityNotFound(_0x2ccf69,null))['then'](function(_0x89b5cc){if(_0x89b5cc){_0x584d6e=_0x89b5cc;_0x425cc9['model']=_[_0xbe4f('0x4a')](db[_0xbe4f('0x64')][_0xbe4f('0x4b')]);_0x425cc9['query']=_[_0xbe4f('0x4a')](_0x100096[_0xbe4f('0x35')]);_0x425cc9[_0xbe4f('0x36')]=_['intersection'](_0x425cc9[_0xbe4f('0x34')],_0x425cc9[_0xbe4f('0x35')]);_0x17279d[_0xbe4f('0x39')]=_['intersection'](_0x425cc9[_0xbe4f('0x34')],qs[_0xbe4f('0x38')](_0x100096[_0xbe4f('0x35')][_0xbe4f('0x38')]));_0x17279d[_0xbe4f('0x39')]=_0x17279d[_0xbe4f('0x39')][_0xbe4f('0x3a')]?_0x17279d[_0xbe4f('0x39')]:_0x425cc9[_0xbe4f('0x34')];_0x17279d[_0xbe4f('0x3d')]=qs[_0xbe4f('0x59')](_0x100096[_0xbe4f('0x35')][_0xbe4f('0x59')]);_0x17279d[_0xbe4f('0x3e')]=qs[_0xbe4f('0x36')](_[_0xbe4f('0x3f')](_0x100096[_0xbe4f('0x35')],_0x425cc9[_0xbe4f('0x36')]));if(_0x100096[_0xbe4f('0x35')]['filter']){_0x17279d[_0xbe4f('0x3e')]=_[_0xbe4f('0x41')](_0x17279d['where'],{'$or':_['map'](_0x17279d['attributes'],function(_0x6ec33a){var _0x438f42={};_0x438f42[_0x6ec33a]={'$like':'%'+_0x100096[_0xbe4f('0x35')][_0xbe4f('0x40')]+'%'};return _0x438f42;})});}_0x17279d=_[_0xbe4f('0x41')]({},_0x17279d,_0x100096['options']);return _0x584d6e[_0xbe4f('0x63')](_0x17279d);}})['then'](function(_0x1e3c9b){if(_0x1e3c9b){_0x535336=_0x1e3c9b['length'];if(!_0x100096[_0xbe4f('0x35')][_0xbe4f('0x3b')](_0xbe4f('0x3c'))){_0x17279d[_0xbe4f('0x20')]=qs[_0xbe4f('0x20')](_0x100096[_0xbe4f('0x35')]['limit']);_0x17279d[_0xbe4f('0x22')]=qs[_0xbe4f('0x22')](_0x100096[_0xbe4f('0x35')]['offset']);}return _0x584d6e[_0xbe4f('0x63')](_0x17279d);}})[_0xbe4f('0x28')](function(_0x1af20d){if(_0x1af20d){return _0x1af20d?{'count':_0x535336,'rows':_0x1af20d}:null;}})[_0xbe4f('0x28')](respondWithResult(_0x2ccf69,null))[_0xbe4f('0x55')](handleError(_0x2ccf69,null));};exports['addTeams']=function(_0x32b0c6,_0x567dae,_0x3e320b){var _0x1ccc0e=_0x32b0c6[_0xbe4f('0x4e')]['ids'];return db['Team'][_0xbe4f('0x46')]({'where':{'id':_0x1ccc0e},'attributes':['id'],'include':[{'model':db[_0xbe4f('0x65')],'as':'Agents','attributes':['id',_0xbe4f('0x2c'),_0xbe4f('0x66'),'voicePause',_0xbe4f('0x67')],'raw':!![]}]})[_0xbe4f('0x28')](function(_0x19262f){if(_0x19262f){var _0x1c6b36=_[_0xbe4f('0x68')](_0x19262f,function(_0x5552a5){var _0x1cca9d=_0x5552a5[_0xbe4f('0x51')]({'plain':!![]});return _0x1cca9d['Agents'];});return db[_0xbe4f('0x30')]['find']({'where':{'id':_0x32b0c6[_0xbe4f('0x49')]['id']}})[_0xbe4f('0x28')](function(_0x583491){return db[_0xbe4f('0x69')]['transaction'](function(_0x25889b){return _0x583491['addTeams'](_0x1ccc0e,{'transaction':_0x25889b})['then'](function(){return BPromise[_0xbe4f('0x6a')](_0x1c6b36,function(_0x5e7387){return db[_0xbe4f('0x5b')][_0xbe4f('0x6b')]({'where':{'UserId':_0x5e7387['id'],'MailQueueId':_0x32b0c6['params']['id']},'transaction':_0x25889b});});})['then'](function(){_0x1c6b36['forEach'](function(_0x11c0b6){socket[_0xbe4f('0x6c')](_0xbe4f('0x6d'),{'UserId':_0x11c0b6['id'],'MailQueueId':_0x583491['id']});});});});});}})[_0xbe4f('0x28')](respondWithStatusCode(_0x567dae,null))[_0xbe4f('0x55')](handleError(_0x567dae,null));};exports[_0xbe4f('0x6e')]=function(_0x176c96,_0x16dd76,_0x514a6b){return db['Team']['findAll']({'where':{'id':_0x176c96[_0xbe4f('0x35')][_0xbe4f('0x6f')]},'attributes':['id'],'include':[{'model':db[_0xbe4f('0x65')],'as':_0xbe4f('0x70'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x16dd76,null))[_0xbe4f('0x28')](function(_0x4e7b6e){var _0x3557df=_[_0xbe4f('0x2f')](_0x4e7b6e,'id');var _0x17b249=[];var _0x313e4d=[];var _0x435944=squel[_0xbe4f('0x71')]();_0x435944['field'](_0xbe4f('0x72'))[_0xbe4f('0x73')](_0xbe4f('0x74'),'tq')[_0xbe4f('0x75')](_0xbe4f('0x76'),'ut',_0xbe4f('0x77'))[_0xbe4f('0x3e')](_0xbe4f('0x78'),_0x176c96['params']['id']);for(var _0x55a163=0x0;_0x55a163<_0x4e7b6e[_0xbe4f('0x3a')];_0x55a163+=0x1){let _0x29944e=_0x4e7b6e[_0x55a163];for(var _0x58d1e4=0x0;_0x58d1e4<_0x29944e[_0xbe4f('0x70')][_0xbe4f('0x3a')];_0x58d1e4+=0x1){let _0x150b27=_0x29944e[_0xbe4f('0x70')][_0x58d1e4];var _0x1f51a8=_0x435944['clone']();_0x1f51a8[_0xbe4f('0x3e')](_0xbe4f('0x79'),_0x150b27['id']);_0x313e4d[_0xbe4f('0x7a')](db['sequelize']['query'](_0x1f51a8[_0xbe4f('0x7b')](),{'type':db['sequelize'][_0xbe4f('0x7c')][_0xbe4f('0x7d')]})['then'](function(_0x44566a){if(_0x44566a[_0xbe4f('0x3a')]===0x1){return _0x150b27['id'];}else{var _0x40bafc=_[_0xbe4f('0x7e')](_[_0xbe4f('0x2f')](_0x44566a,'TeamId'),function(_0x186fa9){return _[_0xbe4f('0x7f')](_0x3557df,_0x186fa9);});if(_0x40bafc){return _0x150b27['id'];}}}));}}return BPromise[_0xbe4f('0x80')](_0x313e4d)['then'](function(_0x443606){_0x17b249=_(_0x17b249)[_0xbe4f('0x81')](_0x443606)[_0xbe4f('0x82')]()['value']();return db[_0xbe4f('0x30')][_0xbe4f('0x4c')]({'where':{'id':_0x176c96[_0xbe4f('0x49')]['id']}})[_0xbe4f('0x28')](function(_0x51b8c5){return db[_0xbe4f('0x69')][_0xbe4f('0x83')](function(_0xc01c41){return _0x51b8c5[_0xbe4f('0x6e')](_0x176c96[_0xbe4f('0x35')]['ids'],{'transaction':_0xc01c41})[_0xbe4f('0x28')](function(){if(!_[_0xbe4f('0x84')](_0x17b249)){return _0x51b8c5[_0xbe4f('0x85')](_0x17b249,{'transaction':_0xc01c41});}})[_0xbe4f('0x28')](function(){_0x17b249['forEach'](function(_0x2879ba){socket[_0xbe4f('0x6c')]('userMailQueue:remove',{'UserId':_0x2879ba,'MailQueueId':_0x51b8c5['id']});});});});});});})[_0xbe4f('0x28')](respondWithStatusCode(_0x16dd76,null))[_0xbe4f('0x55')](handleError(_0x16dd76,null));};exports[_0xbe4f('0x86')]=function(_0x1edcee,_0x210989,_0x23b9cc){return db[_0xbe4f('0x30')][_0xbe4f('0x4c')]({'where':{'id':_0x1edcee[_0xbe4f('0x49')]['id']}})[_0xbe4f('0x28')](handleEntityNotFound(_0x210989,null))[_0xbe4f('0x28')](function(_0x1374f7){if(_0x1374f7){return _0x1374f7[_0xbe4f('0x86')](_0x1edcee[_0xbe4f('0x4e')][_0xbe4f('0x6f')],_[_0xbe4f('0x87')](_0x1edcee[_0xbe4f('0x4e')],[_0xbe4f('0x6f'),'id'])||{})[_0xbe4f('0x88')](function(_0x23f220){for(var _0x58da21=0x0;_0x58da21<_0x1edcee[_0xbe4f('0x4e')][_0xbe4f('0x6f')][_0xbe4f('0x3a')];_0x58da21+=0x1){socket[_0xbe4f('0x6c')](_0xbe4f('0x6d'),{'UserId':Number(_0x1edcee[_0xbe4f('0x4e')][_0xbe4f('0x6f')][_0x58da21]),'MailQueueId':Number(_0x1edcee[_0xbe4f('0x49')]['id'])});}return _0x23f220;});}})[_0xbe4f('0x28')](respondWithResult(_0x210989,null))['catch'](handleError(_0x210989,null));};exports[_0xbe4f('0x85')]=function(_0x51d26f,_0x5d2b89,_0x357ab1){return db[_0xbe4f('0x30')]['find']({'where':{'id':_0x51d26f[_0xbe4f('0x49')]['id']}})[_0xbe4f('0x28')](handleEntityNotFound(_0x5d2b89,null))['then'](function(_0x21a7d6){if(_0x21a7d6){return _0x21a7d6['removeAgents'](_0x51d26f[_0xbe4f('0x35')][_0xbe4f('0x6f')])[_0xbe4f('0x28')](function(){if(_[_0xbe4f('0x89')](_0x51d26f['query'][_0xbe4f('0x6f')])){for(var _0x2da1d0=0x0;_0x2da1d0<_0x51d26f[_0xbe4f('0x35')][_0xbe4f('0x6f')][_0xbe4f('0x3a')];_0x2da1d0+=0x1){socket[_0xbe4f('0x6c')](_0xbe4f('0x8a'),{'UserId':Number(_0x51d26f['query'][_0xbe4f('0x6f')][_0x2da1d0]),'MailQueueId':Number(_0x51d26f[_0xbe4f('0x49')]['id'])});}}else{socket[_0xbe4f('0x6c')](_0xbe4f('0x8a'),{'UserId':Number(_0x51d26f[_0xbe4f('0x35')][_0xbe4f('0x6f')]),'MailQueueId':Number(_0x51d26f['params']['id'])});}});}})['then'](respondWithStatusCode(_0x5d2b89,null))[_0xbe4f('0x55')](handleError(_0x5d2b89,null));};exports[_0xbe4f('0x8b')]=function(_0x51d54e,_0x197564,_0x53a059){var _0x226e36={};var _0x4758ab={};var _0x291448;var _0xf122de;return db[_0xbe4f('0x30')][_0xbe4f('0x58')]({'where':{'id':_0x51d54e[_0xbe4f('0x49')]['id']}})[_0xbe4f('0x28')](handleEntityNotFound(_0x197564,null))[_0xbe4f('0x28')](function(_0x48c560){if(_0x48c560){_0x291448=_0x48c560;_0x4758ab[_0xbe4f('0x34')]=_[_0xbe4f('0x4a')](db[_0xbe4f('0x65')][_0xbe4f('0x4b')]);_0x4758ab[_0xbe4f('0x35')]=_[_0xbe4f('0x4a')](_0x51d54e['query']);_0x4758ab[_0xbe4f('0x36')]=_[_0xbe4f('0x37')](_0x4758ab[_0xbe4f('0x34')],_0x4758ab[_0xbe4f('0x35')]);_0x226e36[_0xbe4f('0x39')]=_[_0xbe4f('0x37')](_0x4758ab[_0xbe4f('0x34')],qs[_0xbe4f('0x38')](_0x51d54e[_0xbe4f('0x35')]['fields']));_0x226e36[_0xbe4f('0x39')]=_0x226e36[_0xbe4f('0x39')][_0xbe4f('0x3a')]?_0x226e36[_0xbe4f('0x39')]:_0x4758ab[_0xbe4f('0x34')];_0x226e36[_0xbe4f('0x3d')]=qs['sort'](_0x51d54e[_0xbe4f('0x35')][_0xbe4f('0x59')]);_0x226e36['where']=qs[_0xbe4f('0x36')](_[_0xbe4f('0x3f')](_0x51d54e[_0xbe4f('0x35')],_0x4758ab['filters']));if(_0x51d54e['query'][_0xbe4f('0x40')]){_0x226e36[_0xbe4f('0x3e')]=_[_0xbe4f('0x41')](_0x226e36['where'],{'$or':_[_0xbe4f('0x2f')](_0x226e36[_0xbe4f('0x39')],function(_0x4966e0){var _0x1c12ea={};_0x1c12ea[_0x4966e0]={'$like':'%'+_0x51d54e[_0xbe4f('0x35')][_0xbe4f('0x40')]+'%'};return _0x1c12ea;})});}_0x226e36=_[_0xbe4f('0x41')]({},_0x226e36,_0x51d54e[_0xbe4f('0x43')]);return _0x291448[_0xbe4f('0x8b')](_0x226e36);}})[_0xbe4f('0x28')](function(_0x8fc7bf){if(_0x8fc7bf){_0xf122de=_0x8fc7bf[_0xbe4f('0x3a')];if(!_0x51d54e[_0xbe4f('0x35')][_0xbe4f('0x3b')](_0xbe4f('0x3c'))){_0x226e36[_0xbe4f('0x20')]=qs['limit'](_0x51d54e[_0xbe4f('0x35')]['limit']);_0x226e36[_0xbe4f('0x22')]=qs['offset'](_0x51d54e[_0xbe4f('0x35')][_0xbe4f('0x22')]);}return _0x291448[_0xbe4f('0x8b')](_0x226e36);}})[_0xbe4f('0x28')](function(_0x25afc6){if(_0x25afc6){return _0x25afc6?{'count':_0xf122de,'rows':_0x25afc6}:null;}})[_0xbe4f('0x28')](respondWithResult(_0x197564,null))[_0xbe4f('0x55')](handleError(_0x197564,null));}; \ No newline at end of file +var _0x22d3=['limit','Content-Range','json','apply','reject','save','update','destroy','then','MailQueues','UserProfileResource','error','stack','name','index','map','MailQueue','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','user','get','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','hasOwnProperty','order','UserMailQueue','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','addTeams','Agents','online','interface','flatMap','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','ids','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?','sequelize','SELECT','every','TeamId','includes','all','union','compact','addAgents','spread','removeAgents','isArray','userMailQueue:remove','getAgents','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailQueue.socket','sendStatus','status','end','undefined','count','offset'];(function(_0x38a184,_0x6977d7){var _0x8c1f68=function(_0x9a43fa){while(--_0x9a43fa){_0x38a184['push'](_0x38a184['shift']());}};_0x8c1f68(++_0x6977d7);}(_0x22d3,0xf8));var _0x322d=function(_0x42ca15,_0x193ccb){_0x42ca15=_0x42ca15-0x0;var _0x1c6ded=_0x22d3[_0x42ca15];return _0x1c6ded;};'use strict';var emlformat=require(_0x322d('0x0'));var rimraf=require(_0x322d('0x1'));var zipdir=require(_0x322d('0x2'));var jsonpatch=require(_0x322d('0x3'));var rp=require(_0x322d('0x4'));var moment=require(_0x322d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x322d('0x6'));var util=require(_0x322d('0x7'));var path=require(_0x322d('0x8'));var sox=require(_0x322d('0x9'));var csv=require('to-csv');var ejs=require(_0x322d('0xa'));var fs=require('fs');var fs_extra=require(_0x322d('0xb'));var _=require(_0x322d('0xc'));var squel=require(_0x322d('0xd'));var crypto=require(_0x322d('0xe'));var jsforce=require(_0x322d('0xf'));var deskjs=require(_0x322d('0x10'));var toCsv=require(_0x322d('0x11'));var querystring=require(_0x322d('0x12'));var Papa=require(_0x322d('0x13'));var Redis=require(_0x322d('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x322d('0x15'));var as=require(_0x322d('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x322d('0x17'))(_0x322d('0x18'));var utils=require(_0x322d('0x19'));var config=require(_0x322d('0x1a'));var licenseUtil=require(_0x322d('0x1b'));var db=require(_0x322d('0x1c'))['db'];config['redis']=_[_0x322d('0x1d')](config[_0x322d('0x1e')],{'host':_0x322d('0x1f'),'port':0x18eb});var socket=require(_0x322d('0x20'))(new Redis(config['redis']));require(_0x322d('0x21'))['register'](socket);function respondWithStatusCode(_0xa5a8e4,_0x48bce0){_0x48bce0=_0x48bce0||0xcc;return function(_0x429dd4){if(_0x429dd4){return _0xa5a8e4[_0x322d('0x22')](_0x48bce0);}return _0xa5a8e4[_0x322d('0x23')](_0x48bce0)[_0x322d('0x24')]();};}function respondWithResult(_0x33140d,_0xb1ead4){_0xb1ead4=_0xb1ead4||0xc8;return function(_0x10d6a8){if(_0x10d6a8){return _0x33140d[_0x322d('0x23')](_0xb1ead4)['json'](_0x10d6a8);}};}function respondWithFilteredResult(_0x54725b,_0x357336){return function(_0x30a77a){if(_0x30a77a){var _0x5af47d=typeof _0x357336['offset']===_0x322d('0x25')&&typeof _0x357336['limit']===_0x322d('0x25');var _0x449b99=_0x30a77a[_0x322d('0x26')];var _0x2ace02=_0x5af47d?0x0:_0x357336[_0x322d('0x27')];var _0x367c4e=_0x5af47d?_0x30a77a[_0x322d('0x26')]:_0x357336[_0x322d('0x27')]+_0x357336[_0x322d('0x28')];var _0x2e2572;if(_0x367c4e>=_0x449b99){_0x367c4e=_0x449b99;_0x2e2572=0xc8;}else{_0x2e2572=0xce;}_0x54725b[_0x322d('0x23')](_0x2e2572);return _0x54725b['set'](_0x322d('0x29'),_0x2ace02+'-'+_0x367c4e+'/'+_0x449b99)[_0x322d('0x2a')](_0x30a77a);}return null;};}function patchUpdates(_0x39d5be){return function(_0x2dc114){try{jsonpatch[_0x322d('0x2b')](_0x2dc114,_0x39d5be,!![]);}catch(_0x367a19){return BPromise[_0x322d('0x2c')](_0x367a19);}return _0x2dc114[_0x322d('0x2d')]();};}function saveUpdates(_0x25c058,_0x36e003){return function(_0x270c91){if(_0x270c91){return _0x270c91[_0x322d('0x2e')](_0x25c058)['then'](function(_0x1bb912){return _0x1bb912;});}return null;};}function removeEntity(_0x4012c7,_0x506d7f){return function(_0x4a2947){if(_0x4a2947){return _0x4a2947[_0x322d('0x2f')]()[_0x322d('0x30')](function(){var _0x1ad384=_0x4a2947['get']({'plain':!![]});var _0xb87059=_0x322d('0x31');return db[_0x322d('0x32')][_0x322d('0x2f')]({'where':{'type':_0xb87059,'resourceId':_0x1ad384['id']}})[_0x322d('0x30')](function(){return _0x4a2947;});})[_0x322d('0x30')](function(){_0x4012c7['status'](0xcc)[_0x322d('0x24')]();});}};}function handleEntityNotFound(_0x159138,_0x42cd92){return function(_0x17d2d3){if(!_0x17d2d3){_0x159138[_0x322d('0x22')](0x194);}return _0x17d2d3;};}function handleError(_0x27b5d8,_0x560dee){_0x560dee=_0x560dee||0x1f4;return function(_0x340f64){logger[_0x322d('0x33')](_0x340f64[_0x322d('0x34')]);if(_0x340f64[_0x322d('0x35')]){delete _0x340f64[_0x322d('0x35')];}_0x27b5d8[_0x322d('0x23')](_0x560dee)['send'](_0x340f64);};}exports[_0x322d('0x36')]=function(_0x487a2e,_0x24af74){var _0x5a75a1={},_0x34fc88={},_0x54d2f9={'count':0x0,'rows':[]};var _0x530aa5=_[_0x322d('0x37')](db[_0x322d('0x38')]['rawAttributes'],function(_0x1f3176){return{'name':_0x1f3176['fieldName'],'type':_0x1f3176[_0x322d('0x39')]['key']};});_0x34fc88[_0x322d('0x3a')]=_['map'](_0x530aa5,_0x322d('0x35'));_0x34fc88[_0x322d('0x3b')]=_[_0x322d('0x3c')](_0x487a2e['query']);_0x34fc88[_0x322d('0x3d')]=_[_0x322d('0x3e')](_0x34fc88['model'],_0x34fc88['query']);_0x5a75a1[_0x322d('0x3f')]=_[_0x322d('0x3e')](_0x34fc88['model'],qs['fields'](_0x487a2e['query'][_0x322d('0x40')]));_0x5a75a1[_0x322d('0x3f')]=_0x5a75a1[_0x322d('0x3f')][_0x322d('0x41')]?_0x5a75a1[_0x322d('0x3f')]:_0x34fc88[_0x322d('0x3a')];if(!_0x487a2e[_0x322d('0x3b')]['hasOwnProperty'](_0x322d('0x42'))){_0x5a75a1[_0x322d('0x28')]=qs['limit'](_0x487a2e[_0x322d('0x3b')]['limit']);_0x5a75a1[_0x322d('0x27')]=qs['offset'](_0x487a2e[_0x322d('0x3b')][_0x322d('0x27')]);}_0x5a75a1['order']=qs[_0x322d('0x43')](_0x487a2e['query'][_0x322d('0x43')]);_0x5a75a1[_0x322d('0x44')]=qs[_0x322d('0x3d')](_[_0x322d('0x45')](_0x487a2e[_0x322d('0x3b')],_0x34fc88[_0x322d('0x3d')]),_0x530aa5);if(_0x487a2e[_0x322d('0x3b')][_0x322d('0x46')]){_0x5a75a1['where']=_['merge'](_0x5a75a1[_0x322d('0x44')],{'$or':_[_0x322d('0x37')](_0x530aa5,function(_0x1a6cca){if(_0x1a6cca[_0x322d('0x39')]!==_0x322d('0x47')){var _0x3914ef={};_0x3914ef[_0x1a6cca[_0x322d('0x35')]]={'$like':'%'+_0x487a2e[_0x322d('0x3b')]['filter']+'%'};return _0x3914ef;}})});}_0x5a75a1=_[_0x322d('0x48')]({},_0x5a75a1,_0x487a2e[_0x322d('0x49')]);var _0x58b070={'where':_0x5a75a1['where']};return db['MailQueue'][_0x322d('0x26')](_0x58b070)['then'](function(_0x43655e){_0x54d2f9['count']=_0x43655e;if(_0x487a2e['query'][_0x322d('0x4a')]){_0x5a75a1[_0x322d('0x4b')]=[{'all':!![]}];}return db[_0x322d('0x38')][_0x322d('0x4c')](_0x5a75a1);})[_0x322d('0x30')](function(_0x446158){_0x54d2f9[_0x322d('0x4d')]=_0x446158;return _0x54d2f9;})['then'](respondWithFilteredResult(_0x24af74,_0x5a75a1))[_0x322d('0x4e')](handleError(_0x24af74,null));};exports[_0x322d('0x4f')]=function(_0x4775ed,_0x2a6c35){var _0x1ef916={'raw':!![],'where':{'id':_0x4775ed[_0x322d('0x50')]['id']}},_0x3ff11c={};_0x3ff11c[_0x322d('0x3a')]=_[_0x322d('0x3c')](db[_0x322d('0x38')][_0x322d('0x51')]);_0x3ff11c['query']=_[_0x322d('0x3c')](_0x4775ed['query']);_0x3ff11c[_0x322d('0x3d')]=_[_0x322d('0x3e')](_0x3ff11c['model'],_0x3ff11c[_0x322d('0x3b')]);_0x1ef916['attributes']=_[_0x322d('0x3e')](_0x3ff11c[_0x322d('0x3a')],qs['fields'](_0x4775ed[_0x322d('0x3b')][_0x322d('0x40')]));_0x1ef916['attributes']=_0x1ef916[_0x322d('0x3f')][_0x322d('0x41')]?_0x1ef916[_0x322d('0x3f')]:_0x3ff11c['model'];if(_0x4775ed[_0x322d('0x3b')][_0x322d('0x4a')]){_0x1ef916[_0x322d('0x4b')]=[{'all':!![]}];}_0x1ef916=_[_0x322d('0x48')]({},_0x1ef916,_0x4775ed[_0x322d('0x49')]);return db['MailQueue']['find'](_0x1ef916)[_0x322d('0x30')](handleEntityNotFound(_0x2a6c35,null))[_0x322d('0x30')](respondWithResult(_0x2a6c35,null))['catch'](handleError(_0x2a6c35,null));};exports[_0x322d('0x52')]=function(_0x17e173,_0xb449e7){return db[_0x322d('0x38')][_0x322d('0x52')](_0x17e173[_0x322d('0x53')],{})[_0x322d('0x30')](function(_0x1ee377){var _0x405564=_0x17e173[_0x322d('0x54')][_0x322d('0x55')]({'plain':!![]});if(!_0x405564)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x405564[_0x322d('0x56')]==='user'){var _0x429c83=_0x1ee377[_0x322d('0x55')]({'plain':!![]});var _0xf9b65c=_0x322d('0x31');return db['UserProfileSection'][_0x322d('0x57')]({'where':{'name':_0xf9b65c,'userProfileId':_0x405564[_0x322d('0x58')]},'raw':!![]})[_0x322d('0x30')](function(_0x5682df){if(_0x5682df&&_0x5682df[_0x322d('0x59')]===0x0){return db[_0x322d('0x32')][_0x322d('0x52')]({'name':_0x429c83['name'],'resourceId':_0x429c83['id'],'type':_0x5682df[_0x322d('0x35')],'sectionId':_0x5682df['id']},{})[_0x322d('0x30')](function(){return _0x1ee377;});}else{return _0x1ee377;}})[_0x322d('0x4e')](function(_0x13ea4b){logger[_0x322d('0x33')](_0x322d('0x5a'),_0x13ea4b);throw _0x13ea4b;});}return _0x1ee377;})['then'](respondWithResult(_0xb449e7,0xc9))[_0x322d('0x4e')](handleError(_0xb449e7,null));};exports[_0x322d('0x2e')]=function(_0x8dae85,_0x4f0cfa){if(_0x8dae85[_0x322d('0x53')]['id']){delete _0x8dae85[_0x322d('0x53')]['id'];}return db[_0x322d('0x38')][_0x322d('0x57')]({'where':{'id':_0x8dae85['params']['id']}})[_0x322d('0x30')](handleEntityNotFound(_0x4f0cfa,null))[_0x322d('0x30')](saveUpdates(_0x8dae85['body'],null))[_0x322d('0x30')](respondWithResult(_0x4f0cfa,null))[_0x322d('0x4e')](handleError(_0x4f0cfa,null));};exports[_0x322d('0x2f')]=function(_0x4036ce,_0x4d0f2d){return db[_0x322d('0x38')][_0x322d('0x57')]({'where':{'id':_0x4036ce[_0x322d('0x50')]['id']}})[_0x322d('0x30')](handleEntityNotFound(_0x4d0f2d,null))[_0x322d('0x30')](removeEntity(_0x4d0f2d,null))[_0x322d('0x4e')](handleError(_0x4d0f2d,null));};exports[_0x322d('0x5b')]=function(_0xa8dba9,_0x4f54a9){return db[_0x322d('0x38')][_0x322d('0x5b')]()[_0x322d('0x30')](respondWithResult(_0x4f54a9,null))[_0x322d('0x4e')](handleError(_0x4f54a9,null));};exports[_0x322d('0x5c')]=function(_0x4c5f43,_0x33913b,_0x511041){var _0x1679d6={'raw':!![],'where':{}},_0x19b37f={},_0x4eced9;return db[_0x322d('0x38')]['findOne']({'where':{'id':_0x4c5f43[_0x322d('0x50')]['id']}})[_0x322d('0x30')](handleEntityNotFound(_0x33913b,null))[_0x322d('0x30')](function(_0xcaa86e){if(_0xcaa86e){_0x4eced9=_0xcaa86e['get']({'plain':!![]});_0x19b37f['model']=_['keys'](db['UserMailQueue'][_0x322d('0x51')]);_0x19b37f[_0x322d('0x3b')]=_[_0x322d('0x3c')](_0x4c5f43[_0x322d('0x3b')]);_0x19b37f[_0x322d('0x3d')]=_[_0x322d('0x3e')](_0x19b37f['model'],_0x19b37f['query']);_0x1679d6[_0x322d('0x3f')]=_[_0x322d('0x3e')](_0x19b37f[_0x322d('0x3a')],qs[_0x322d('0x40')](_0x4c5f43[_0x322d('0x3b')][_0x322d('0x40')]));_0x1679d6[_0x322d('0x3f')]=_0x1679d6[_0x322d('0x3f')][_0x322d('0x41')]?_0x1679d6[_0x322d('0x3f')]:_0x19b37f['model'];if(!_0x4c5f43[_0x322d('0x3b')][_0x322d('0x5d')](_0x322d('0x42'))){_0x1679d6[_0x322d('0x28')]=qs['limit'](_0x4c5f43['query']['limit']);_0x1679d6[_0x322d('0x27')]=qs['offset'](_0x4c5f43[_0x322d('0x3b')][_0x322d('0x27')]);}_0x1679d6[_0x322d('0x5e')]=qs['sort'](_0x4c5f43[_0x322d('0x3b')][_0x322d('0x43')]);_0x1679d6['where']=qs[_0x322d('0x3d')](_[_0x322d('0x45')](_0x4c5f43[_0x322d('0x3b')],_0x19b37f['filters']));_0x1679d6[_0x322d('0x44')]['MailQueueId']=_0xcaa86e['id'];if(_0x4c5f43[_0x322d('0x3b')][_0x322d('0x46')]){_0x1679d6['where']=_['merge'](_0x1679d6[_0x322d('0x44')],{'$or':_[_0x322d('0x37')](_0x1679d6[_0x322d('0x3f')],function(_0x2d091b){var _0x421612={};_0x421612[_0x2d091b]={'$like':'%'+_0x4c5f43[_0x322d('0x3b')][_0x322d('0x46')]+'%'};return _0x421612;})});}_0x1679d6=_['merge']({},_0x1679d6,_0x4c5f43['options']);return db[_0x322d('0x5f')][_0x322d('0x4c')](_0x1679d6);}})[_0x322d('0x30')](function(_0x287683){if(_0x287683){return db[_0x322d('0x60')][_0x322d('0x61')]({'where':{'id':_[_0x322d('0x37')](_0x287683,_0x322d('0x62')),'role':_0x322d('0x63')},'attributes':['id',_0x322d('0x35'),_0x322d('0x64'),_0x322d('0x65'),_0x322d('0x66')]});}})[_0x322d('0x30')](function(_0x3cab51){if(_0x3cab51){return{'count':_0x3cab51[_0x322d('0x26')],'rows':_['map'](_0x3cab51[_0x322d('0x4d')],function(_0x4c1dbc){return{'membername':_0x4c1dbc[_0x322d('0x35')],'UserId':_0x4c1dbc['id'],'queue_name':_0x4eced9[_0x322d('0x35')],'MailQueueId':_0x4eced9['id'],'interface':util['format'](_0x322d('0x67'),_0x322d('0x68'),_0x4c1dbc[_0x322d('0x35')]),'penalty':0x0,'paused':_0x4c1dbc[_0x322d('0x64')],'createdAt':_0x4c1dbc[_0x322d('0x66')],'updatedAt':_0x4c1dbc[_0x322d('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x322d('0x30')](respondWithFilteredResult(_0x33913b,_0x1679d6))[_0x322d('0x4e')](handleError(_0x33913b,null));};exports[_0x322d('0x69')]=function(_0x83c7b3,_0x3f5cfd,_0x29a273){var _0x21b983={};var _0x1fd017={};var _0x1afcb2;var _0x54fa17;return db[_0x322d('0x38')]['findOne']({'where':{'id':_0x83c7b3[_0x322d('0x50')]['id']}})['then'](handleEntityNotFound(_0x3f5cfd,null))[_0x322d('0x30')](function(_0x145a09){if(_0x145a09){_0x1afcb2=_0x145a09;_0x1fd017[_0x322d('0x3a')]=_['keys'](db[_0x322d('0x6a')][_0x322d('0x51')]);_0x1fd017[_0x322d('0x3b')]=_[_0x322d('0x3c')](_0x83c7b3[_0x322d('0x3b')]);_0x1fd017[_0x322d('0x3d')]=_[_0x322d('0x3e')](_0x1fd017['model'],_0x1fd017[_0x322d('0x3b')]);_0x21b983[_0x322d('0x3f')]=_[_0x322d('0x3e')](_0x1fd017['model'],qs['fields'](_0x83c7b3[_0x322d('0x3b')][_0x322d('0x40')]));_0x21b983[_0x322d('0x3f')]=_0x21b983['attributes']['length']?_0x21b983[_0x322d('0x3f')]:_0x1fd017[_0x322d('0x3a')];_0x21b983[_0x322d('0x5e')]=qs['sort'](_0x83c7b3[_0x322d('0x3b')][_0x322d('0x43')]);_0x21b983[_0x322d('0x44')]=qs['filters'](_['pick'](_0x83c7b3['query'],_0x1fd017[_0x322d('0x3d')]));if(_0x83c7b3[_0x322d('0x3b')][_0x322d('0x46')]){_0x21b983[_0x322d('0x44')]=_[_0x322d('0x48')](_0x21b983[_0x322d('0x44')],{'$or':_[_0x322d('0x37')](_0x21b983[_0x322d('0x3f')],function(_0x47ce4e){var _0x3e937f={};_0x3e937f[_0x47ce4e]={'$like':'%'+_0x83c7b3['query']['filter']+'%'};return _0x3e937f;})});}_0x21b983=_[_0x322d('0x48')]({},_0x21b983,_0x83c7b3['options']);return _0x1afcb2[_0x322d('0x69')](_0x21b983);}})['then'](function(_0x237f2e){if(_0x237f2e){_0x54fa17=_0x237f2e[_0x322d('0x41')];if(!_0x83c7b3[_0x322d('0x3b')][_0x322d('0x5d')](_0x322d('0x42'))){_0x21b983[_0x322d('0x28')]=qs['limit'](_0x83c7b3[_0x322d('0x3b')][_0x322d('0x28')]);_0x21b983['offset']=qs[_0x322d('0x27')](_0x83c7b3['query']['offset']);}return _0x1afcb2[_0x322d('0x69')](_0x21b983);}})[_0x322d('0x30')](function(_0x3fe7b9){if(_0x3fe7b9){return _0x3fe7b9?{'count':_0x54fa17,'rows':_0x3fe7b9}:null;}})['then'](respondWithResult(_0x3f5cfd,null))[_0x322d('0x4e')](handleError(_0x3f5cfd,null));};exports[_0x322d('0x6b')]=function(_0x141692,_0x488296,_0x2972cc){var _0x2722b4=_0x141692[_0x322d('0x53')]['ids'];return db[_0x322d('0x6a')][_0x322d('0x4c')]({'where':{'id':_0x2722b4},'attributes':['id'],'include':[{'model':db[_0x322d('0x60')],'as':_0x322d('0x6c'),'attributes':['id',_0x322d('0x35'),_0x322d('0x6d'),'voicePause',_0x322d('0x6e')],'raw':!![]}]})[_0x322d('0x30')](function(_0x3f4a0c){if(_0x3f4a0c){var _0x59d7fd=_[_0x322d('0x6f')](_0x3f4a0c,function(_0x1e7d6d){var _0x14a76f=_0x1e7d6d['get']({'plain':!![]});return _0x14a76f[_0x322d('0x6c')];});return db['MailQueue'][_0x322d('0x57')]({'where':{'id':_0x141692[_0x322d('0x50')]['id']}})['then'](function(_0x140194){return db['sequelize'][_0x322d('0x70')](function(_0x227348){return _0x140194[_0x322d('0x6b')](_0x2722b4,{'transaction':_0x227348})[_0x322d('0x30')](function(){return BPromise[_0x322d('0x71')](_0x59d7fd,function(_0x27d117){return db[_0x322d('0x5f')][_0x322d('0x72')]({'where':{'UserId':_0x27d117['id'],'MailQueueId':_0x141692[_0x322d('0x50')]['id']},'transaction':_0x227348});});})[_0x322d('0x30')](function(){_0x59d7fd[_0x322d('0x73')](function(_0x2bbc08){socket[_0x322d('0x74')](_0x322d('0x75'),{'UserId':_0x2bbc08['id'],'MailQueueId':_0x140194['id']});});});});});}})[_0x322d('0x30')](respondWithStatusCode(_0x488296,null))[_0x322d('0x4e')](handleError(_0x488296,null));};exports[_0x322d('0x76')]=function(_0x5a8e05,_0x287340,_0x3a7ca2){return db[_0x322d('0x6a')][_0x322d('0x4c')]({'where':{'id':_0x5a8e05[_0x322d('0x3b')][_0x322d('0x77')]},'attributes':['id'],'include':[{'model':db[_0x322d('0x60')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x322d('0x30')](handleEntityNotFound(_0x287340,null))[_0x322d('0x30')](function(_0x5be512){var _0x38806a=_[_0x322d('0x37')](_0x5be512,'id');var _0x472042=[];var _0x48a952=[];var _0x448e92=squel['select']();_0x448e92[_0x322d('0x78')](_0x322d('0x79'))[_0x322d('0x7a')](_0x322d('0x7b'),'tq')[_0x322d('0x7c')](_0x322d('0x7d'),'ut',_0x322d('0x7e'))[_0x322d('0x44')](_0x322d('0x7f'),_0x5a8e05[_0x322d('0x50')]['id']);for(var _0x5e2bb0=0x0;_0x5e2bb0<_0x5be512[_0x322d('0x41')];_0x5e2bb0+=0x1){let _0x41b9dc=_0x5be512[_0x5e2bb0];for(var _0x1a78a3=0x0;_0x1a78a3<_0x41b9dc[_0x322d('0x6c')]['length'];_0x1a78a3+=0x1){let _0x1834e4=_0x41b9dc[_0x322d('0x6c')][_0x1a78a3];var _0x27ea8f=_0x448e92['clone']();_0x27ea8f['where'](_0x322d('0x80'),_0x1834e4['id']);_0x48a952['push'](db[_0x322d('0x81')][_0x322d('0x3b')](_0x27ea8f['toString'](),{'type':db[_0x322d('0x81')]['QueryTypes'][_0x322d('0x82')]})['then'](function(_0xfd302c){if(_0xfd302c[_0x322d('0x41')]===0x1){return _0x1834e4['id'];}else{var _0x102141=_[_0x322d('0x83')](_[_0x322d('0x37')](_0xfd302c,_0x322d('0x84')),function(_0x3c772c){return _[_0x322d('0x85')](_0x38806a,_0x3c772c);});if(_0x102141){return _0x1834e4['id'];}}}));}}return BPromise[_0x322d('0x86')](_0x48a952)[_0x322d('0x30')](function(_0x593cda){_0x472042=_(_0x472042)[_0x322d('0x87')](_0x593cda)[_0x322d('0x88')]()['value']();return db[_0x322d('0x38')][_0x322d('0x57')]({'where':{'id':_0x5a8e05['params']['id']}})[_0x322d('0x30')](function(_0x14b22e){return db[_0x322d('0x81')][_0x322d('0x70')](function(_0x462aa0){return _0x14b22e[_0x322d('0x76')](_0x5a8e05[_0x322d('0x3b')][_0x322d('0x77')],{'transaction':_0x462aa0})[_0x322d('0x30')](function(){if(!_['isEmpty'](_0x472042)){return _0x14b22e['removeAgents'](_0x472042,{'transaction':_0x462aa0});}})[_0x322d('0x30')](function(){_0x472042[_0x322d('0x73')](function(_0x21b96a){socket[_0x322d('0x74')]('userMailQueue:remove',{'UserId':_0x21b96a,'MailQueueId':_0x14b22e['id']});});});});});});})[_0x322d('0x30')](respondWithStatusCode(_0x287340,null))[_0x322d('0x4e')](handleError(_0x287340,null));};exports[_0x322d('0x89')]=function(_0x53facf,_0x221c74,_0x1cc840){return db[_0x322d('0x38')][_0x322d('0x57')]({'where':{'id':_0x53facf[_0x322d('0x50')]['id']}})[_0x322d('0x30')](handleEntityNotFound(_0x221c74,null))['then'](function(_0x34e005){if(_0x34e005){return _0x34e005[_0x322d('0x89')](_0x53facf[_0x322d('0x53')][_0x322d('0x77')],_['omit'](_0x53facf[_0x322d('0x53')],['ids','id'])||{})[_0x322d('0x8a')](function(_0x5d1496){for(var _0x56378e=0x0;_0x56378e<_0x53facf['body']['ids'][_0x322d('0x41')];_0x56378e+=0x1){socket['emit'](_0x322d('0x75'),{'UserId':Number(_0x53facf[_0x322d('0x53')][_0x322d('0x77')][_0x56378e]),'MailQueueId':Number(_0x53facf[_0x322d('0x50')]['id'])});}return _0x5d1496;});}})[_0x322d('0x30')](respondWithResult(_0x221c74,null))[_0x322d('0x4e')](handleError(_0x221c74,null));};exports[_0x322d('0x8b')]=function(_0xc8a2a5,_0x24d19c,_0x5126db){return db[_0x322d('0x38')][_0x322d('0x57')]({'where':{'id':_0xc8a2a5[_0x322d('0x50')]['id']}})[_0x322d('0x30')](handleEntityNotFound(_0x24d19c,null))['then'](function(_0x4a1e1c){if(_0x4a1e1c){return _0x4a1e1c[_0x322d('0x8b')](_0xc8a2a5['query'][_0x322d('0x77')])[_0x322d('0x30')](function(){if(_[_0x322d('0x8c')](_0xc8a2a5[_0x322d('0x3b')][_0x322d('0x77')])){for(var _0x3261a2=0x0;_0x3261a2<_0xc8a2a5[_0x322d('0x3b')][_0x322d('0x77')][_0x322d('0x41')];_0x3261a2+=0x1){socket[_0x322d('0x74')](_0x322d('0x8d'),{'UserId':Number(_0xc8a2a5[_0x322d('0x3b')][_0x322d('0x77')][_0x3261a2]),'MailQueueId':Number(_0xc8a2a5[_0x322d('0x50')]['id'])});}}else{socket['emit'](_0x322d('0x8d'),{'UserId':Number(_0xc8a2a5[_0x322d('0x3b')]['ids']),'MailQueueId':Number(_0xc8a2a5['params']['id'])});}});}})[_0x322d('0x30')](respondWithStatusCode(_0x24d19c,null))['catch'](handleError(_0x24d19c,null));};exports[_0x322d('0x8e')]=function(_0x47924e,_0x4a2ed7,_0x4f20e5){var _0x58c1ee={};var _0x5297a7={};var _0xbb9cda;var _0x28020e;return db[_0x322d('0x38')][_0x322d('0x8f')]({'where':{'id':_0x47924e[_0x322d('0x50')]['id']}})[_0x322d('0x30')](handleEntityNotFound(_0x4a2ed7,null))[_0x322d('0x30')](function(_0x112efc){if(_0x112efc){_0xbb9cda=_0x112efc;_0x5297a7['model']=_[_0x322d('0x3c')](db[_0x322d('0x60')][_0x322d('0x51')]);_0x5297a7[_0x322d('0x3b')]=_['keys'](_0x47924e[_0x322d('0x3b')]);_0x5297a7[_0x322d('0x3d')]=_[_0x322d('0x3e')](_0x5297a7['model'],_0x5297a7[_0x322d('0x3b')]);_0x58c1ee[_0x322d('0x3f')]=_[_0x322d('0x3e')](_0x5297a7[_0x322d('0x3a')],qs[_0x322d('0x40')](_0x47924e['query']['fields']));_0x58c1ee[_0x322d('0x3f')]=_0x58c1ee[_0x322d('0x3f')][_0x322d('0x41')]?_0x58c1ee[_0x322d('0x3f')]:_0x5297a7[_0x322d('0x3a')];_0x58c1ee['order']=qs['sort'](_0x47924e['query'][_0x322d('0x43')]);_0x58c1ee[_0x322d('0x44')]=qs['filters'](_[_0x322d('0x45')](_0x47924e[_0x322d('0x3b')],_0x5297a7[_0x322d('0x3d')]));if(_0x47924e[_0x322d('0x3b')][_0x322d('0x46')]){_0x58c1ee[_0x322d('0x44')]=_[_0x322d('0x48')](_0x58c1ee['where'],{'$or':_[_0x322d('0x37')](_0x58c1ee[_0x322d('0x3f')],function(_0x1c8ca9){var _0x2dea86={};_0x2dea86[_0x1c8ca9]={'$like':'%'+_0x47924e[_0x322d('0x3b')][_0x322d('0x46')]+'%'};return _0x2dea86;})});}_0x58c1ee=_[_0x322d('0x48')]({},_0x58c1ee,_0x47924e[_0x322d('0x49')]);return _0xbb9cda[_0x322d('0x8e')](_0x58c1ee);}})['then'](function(_0x182ece){if(_0x182ece){_0x28020e=_0x182ece[_0x322d('0x41')];if(!_0x47924e['query'][_0x322d('0x5d')](_0x322d('0x42'))){_0x58c1ee[_0x322d('0x28')]=qs['limit'](_0x47924e[_0x322d('0x3b')][_0x322d('0x28')]);_0x58c1ee[_0x322d('0x27')]=qs[_0x322d('0x27')](_0x47924e[_0x322d('0x3b')][_0x322d('0x27')]);}return _0xbb9cda['getAgents'](_0x58c1ee);}})[_0x322d('0x30')](function(_0x496520){if(_0x496520){return _0x496520?{'count':_0x28020e,'rows':_0x496520}:null;}})[_0x322d('0x30')](respondWithResult(_0x4a2ed7,null))[_0x322d('0x4e')](handleError(_0x4a2ed7,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index de911cb..8ff10e2 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 _0x3065=['hook','exports','../../mysqldb','setMaxListeners','save','remove','emit'];(function(_0x57029f,_0x378a28){var _0x30eb29=function(_0x3ec1bf){while(--_0x3ec1bf){_0x57029f['push'](_0x57029f['shift']());}};_0x30eb29(++_0x378a28);}(_0x3065,0xbf));var _0x5306=function(_0x53e783,_0x1b831a){_0x53e783=_0x53e783-0x0;var _0x1c294a=_0x3065[_0x53e783];return _0x1c294a;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x5306('0x0'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x5306('0x1')](0x0);var events={'afterCreate':_0x5306('0x2'),'afterUpdate':'update','afterDestroy':_0x5306('0x3')};function emitEvent(_0x1536b3){return function(_0x5b0644,_0x5b3904,_0x33e63d){MailQueueEvents[_0x5306('0x4')](_0x1536b3+':'+_0x5b0644['id'],_0x5b0644);MailQueueEvents['emit'](_0x1536b3,_0x5b0644);_0x33e63d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x5306('0x5')](e,emitEvent(event));}}module[_0x5306('0x6')]=MailQueueEvents; \ No newline at end of file +var _0x7076=['setMaxListeners','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x448313,_0x2b5e0f){var _0x3740be=function(_0x130a0d){while(--_0x130a0d){_0x448313['push'](_0x448313['shift']());}};_0x3740be(++_0x2b5e0f);}(_0x7076,0x66));var _0x6707=function(_0x10ffad,_0x1e507f){_0x10ffad=_0x10ffad-0x0;var _0x4f0b71=_0x7076[_0x10ffad];return _0x4f0b71;};'use strict';var EventEmitter=require(_0x6707('0x0'));var MailQueue=require(_0x6707('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x6707('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6707('0x3'),'afterDestroy':'remove'};function emitEvent(_0x40ca0c){return function(_0x17daff,_0x4efe7a,_0x400ac1){MailQueueEvents[_0x6707('0x4')](_0x40ca0c+':'+_0x17daff['id'],_0x17daff);MailQueueEvents['emit'](_0x40ca0c,_0x17daff);_0x400ac1(null);};}for(var e in events){if(events[_0x6707('0x5')](e)){var event=events[e];MailQueue[_0x6707('0x6')](e,emitEvent(event));}}module[_0x6707('0x7')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 93d9f0b..e73da98 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 _0x9c6f=['../../config/environment','./mailQueue.attributes','exports','MailQueue','mail_queues','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x1fc84d,_0x3f469d){var _0x2658fa=function(_0x189ad0){while(--_0x189ad0){_0x1fc84d['push'](_0x1fc84d['shift']());}};_0x2658fa(++_0x3f469d);}(_0x9c6f,0x71));var _0xf9c6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c6f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf9c6('0x0'));var util=require('util');var logger=require(_0xf9c6('0x1'))(_0xf9c6('0x2'));var moment=require('moment');var BPromise=require(_0xf9c6('0x3'));var rp=require(_0xf9c6('0x4'));var fs=require('fs');var path=require(_0xf9c6('0x5'));var rimraf=require(_0xf9c6('0x6'));var config=require(_0xf9c6('0x7'));var attributes=require(_0xf9c6('0x8'));module[_0xf9c6('0x9')]=function(_0x5535ff,_0x5950b5){return _0x5535ff['define'](_0xf9c6('0xa'),attributes,{'tableName':_0xf9c6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7ba3=['exports','MailQueue','mail_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./mailQueue.attributes'];(function(_0x301c34,_0x15701e){var _0x1a8c5a=function(_0x297b4f){while(--_0x297b4f){_0x301c34['push'](_0x301c34['shift']());}};_0x1a8c5a(++_0x15701e);}(_0x7ba3,0x1ca));var _0x37ba=function(_0x29c934,_0x3c30e2){_0x29c934=_0x29c934-0x0;var _0x4302de=_0x7ba3[_0x29c934];return _0x4302de;};'use strict';var _=require(_0x37ba('0x0'));var util=require(_0x37ba('0x1'));var logger=require(_0x37ba('0x2'))(_0x37ba('0x3'));var moment=require(_0x37ba('0x4'));var BPromise=require(_0x37ba('0x5'));var rp=require(_0x37ba('0x6'));var fs=require('fs');var path=require(_0x37ba('0x7'));var rimraf=require('rimraf');var config=require(_0x37ba('0x8'));var attributes=require(_0x37ba('0x9'));module[_0x37ba('0xa')]=function(_0x3a8e35,_0x446c9b){return _0x3a8e35['define'](_0x37ba('0xb'),attributes,{'tableName':_0x37ba('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index a352436..3ad30e4 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 _0xf430=['redis','localhost','socket.io-emitter','./mailQueue.socket','request','then','info','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','MailQueue,\x20%s,\x20%s','message','GetMailQueue','findAll','options','raw','where','limit','include','model','attributes','map','ShowMailQueue','MailQueue','catch','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x590800,_0x4652b9){var _0x3c6c1b=function(_0xb083cb){while(--_0xb083cb){_0x590800['push'](_0x590800['shift']());}};_0x3c6c1b(++_0x4652b9);}(_0xf430,0x1e4));var _0x0f43=function(_0x560448,_0x2c1082){_0x560448=_0x560448-0x0;var _0x550276=_0xf430[_0x560448];return _0x550276;};'use strict';var _=require(_0x0f43('0x0'));var util=require(_0x0f43('0x1'));var moment=require(_0x0f43('0x2'));var BPromise=require('bluebird');var rs=require(_0x0f43('0x3'));var fs=require('fs');var Redis=require(_0x0f43('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0f43('0x5'))(_0x0f43('0x6'));var config=require(_0x0f43('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0f43('0x8')][_0x0f43('0x9')]({'port':0x232a});config[_0x0f43('0xa')]=_['defaults'](config[_0x0f43('0xa')],{'host':_0x0f43('0xb'),'port':0x18eb});var socket=require(_0x0f43('0xc'))(new Redis(config['redis']));require(_0x0f43('0xd'))['register'](socket);function respondWithRpcPromise(_0x446bb9,_0x306095,_0x47e8c8){return new BPromise(function(_0x5deefa,_0x1ac1b0){return client[_0x0f43('0xe')](_0x446bb9,_0x47e8c8)[_0x0f43('0xf')](function(_0x25d601){logger[_0x0f43('0x10')]('MailQueue,\x20%s,\x20%s',_0x306095,_0x0f43('0x11'));logger[_0x0f43('0x12')](_0x0f43('0x13'),_0x306095,_0x0f43('0x11'),JSON[_0x0f43('0x14')](_0x25d601));if(_0x25d601[_0x0f43('0x15')]){if(_0x25d601[_0x0f43('0x15')][_0x0f43('0x16')]===0x1f4){logger[_0x0f43('0x15')](_0x0f43('0x17'),_0x306095,_0x25d601[_0x0f43('0x15')]['message']);return _0x1ac1b0(_0x25d601[_0x0f43('0x15')][_0x0f43('0x18')]);}logger['error'](_0x0f43('0x17'),_0x306095,_0x25d601[_0x0f43('0x15')][_0x0f43('0x18')]);return _0x5deefa(_0x25d601['error'][_0x0f43('0x18')]);}else{logger['info'](_0x0f43('0x17'),_0x306095,'request\x20sent');_0x5deefa(_0x25d601['result'][_0x0f43('0x18')]);}})['catch'](function(_0x1d4738){logger['error'](_0x0f43('0x17'),_0x306095,_0x1d4738);_0x1ac1b0(_0x1d4738);});});}exports[_0x0f43('0x19')]=function(_0x2ace0f){var _0x6634f=this;return new Promise(function(_0x38ff8a,_0x3b9785){return db['MailQueue'][_0x0f43('0x1a')]({'raw':_0x2ace0f[_0x0f43('0x1b')]?_0x2ace0f[_0x0f43('0x1b')][_0x0f43('0x1c')]===undefined?!![]:![]:!![],'where':_0x2ace0f[_0x0f43('0x1b')]?_0x2ace0f[_0x0f43('0x1b')][_0x0f43('0x1d')]||null:null,'attributes':_0x2ace0f[_0x0f43('0x1b')]?_0x2ace0f['options']['attributes']||null:null,'limit':_0x2ace0f[_0x0f43('0x1b')]?_0x2ace0f['options'][_0x0f43('0x1e')]||null:null,'include':_0x2ace0f[_0x0f43('0x1b')]?_0x2ace0f[_0x0f43('0x1b')][_0x0f43('0x1f')]?_['map'](_0x2ace0f[_0x0f43('0x1b')][_0x0f43('0x1f')],function(_0x168992){return{'model':db[_0x168992['model']],'as':_0x168992['as'],'attributes':_0x168992['attributes'],'include':_0x168992['include']?_['map'](_0x168992[_0x0f43('0x1f')],function(_0xa44a52){return{'model':db[_0xa44a52[_0x0f43('0x20')]],'as':_0xa44a52['as'],'attributes':_0xa44a52[_0x0f43('0x21')],'include':_0xa44a52[_0x0f43('0x1f')]?_[_0x0f43('0x22')](_0xa44a52['include'],function(_0x417bd7){return{'model':db[_0x417bd7[_0x0f43('0x20')]],'as':_0x417bd7['as'],'attributes':_0x417bd7[_0x0f43('0x21')]};}):[]};}):[]};}):[]:[]})[_0x0f43('0xf')](function(_0x191444){logger['info'](_0x0f43('0x19'),_0x2ace0f);logger[_0x0f43('0x12')](_0x0f43('0x19'),_0x2ace0f,JSON[_0x0f43('0x14')](_0x191444));_0x38ff8a(_0x191444);})['catch'](function(_0x372994){logger[_0x0f43('0x15')](_0x0f43('0x19'),_0x372994[_0x0f43('0x18')],_0x2ace0f);_0x3b9785(_0x6634f['error'](0x1f4,_0x372994[_0x0f43('0x18')]));});});};exports[_0x0f43('0x23')]=function(_0x5350b9){var _0x1b9386=this;return new Promise(function(_0x4c5af1,_0x74ba5){return db[_0x0f43('0x24')]['find']({'raw':_0x5350b9[_0x0f43('0x1b')]?_0x5350b9['options']['raw']===undefined?!![]:![]:!![],'where':_0x5350b9['options']?_0x5350b9[_0x0f43('0x1b')][_0x0f43('0x1d')]||null:null,'attributes':_0x5350b9['options']?_0x5350b9[_0x0f43('0x1b')][_0x0f43('0x21')]||null:null,'include':_0x5350b9[_0x0f43('0x1b')]?_0x5350b9[_0x0f43('0x1b')]['include']?_[_0x0f43('0x22')](_0x5350b9[_0x0f43('0x1b')][_0x0f43('0x1f')],function(_0x467bee){return{'model':db[_0x467bee['model']],'as':_0x467bee['as'],'attributes':_0x467bee[_0x0f43('0x21')],'include':_0x467bee['include']?_[_0x0f43('0x22')](_0x467bee['include'],function(_0xcbccde){return{'model':db[_0xcbccde[_0x0f43('0x20')]],'as':_0xcbccde['as'],'attributes':_0xcbccde[_0x0f43('0x21')],'include':_0xcbccde[_0x0f43('0x1f')]?_['map'](_0xcbccde[_0x0f43('0x1f')],function(_0x2c8fa5){return{'model':db[_0x2c8fa5[_0x0f43('0x20')]],'as':_0x2c8fa5['as'],'attributes':_0x2c8fa5[_0x0f43('0x21')]};}):[]};}):[]};}):[]:[]})[_0x0f43('0xf')](function(_0x530dd8){logger['info'](_0x0f43('0x23'),_0x5350b9);logger[_0x0f43('0x12')](_0x0f43('0x23'),_0x5350b9,JSON['stringify'](_0x530dd8));_0x4c5af1(_0x530dd8);})[_0x0f43('0x25')](function(_0x258af3){logger['error'](_0x0f43('0x23'),_0x258af3[_0x0f43('0x18')],_0x5350b9);_0x74ba5(_0x1b9386[_0x0f43('0x15')](0x1f4,_0x258af3['message']));});});}; \ No newline at end of file +var _0x222b=['limit','include','model','map','then','debug','GetMailQueue','catch','find','ShowMailQueue','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','info','MailQueue,\x20%s,\x20%s','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','MailQueue','findAll','options','raw','where','attributes'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0x222b,0xee));var _0xb222=function(_0x2e9b5b,_0x3e1332){_0x2e9b5b=_0x2e9b5b-0x0;var _0x734c46=_0x222b[_0x2e9b5b];return _0x734c46;};'use strict';var _=require(_0xb222('0x0'));var util=require('util');var moment=require(_0xb222('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb222('0x2'));var db=require(_0xb222('0x3'))['db'];var utils=require(_0xb222('0x4'));var logger=require(_0xb222('0x5'))('rpc');var config=require(_0xb222('0x6'));var jayson=require(_0xb222('0x7'));var client=jayson[_0xb222('0x8')][_0xb222('0x9')]({'port':0x232a});config[_0xb222('0xa')]=_['defaults'](config[_0xb222('0xa')],{'host':_0xb222('0xb'),'port':0x18eb});var socket=require(_0xb222('0xc'))(new Redis(config[_0xb222('0xa')]));require('./mailQueue.socket')[_0xb222('0xd')](socket);function respondWithRpcPromise(_0x229803,_0x6358f3,_0x131557){return new BPromise(function(_0x5db63b,_0x4a9d99){return client['request'](_0x229803,_0x131557)['then'](function(_0x26a8ed){logger[_0xb222('0xe')](_0xb222('0xf'),_0x6358f3,'request\x20sent');logger['debug'](_0xb222('0x10'),_0x6358f3,_0xb222('0x11'),JSON['stringify'](_0x26a8ed));if(_0x26a8ed[_0xb222('0x12')]){if(_0x26a8ed[_0xb222('0x12')][_0xb222('0x13')]===0x1f4){logger[_0xb222('0x12')](_0xb222('0xf'),_0x6358f3,_0x26a8ed[_0xb222('0x12')][_0xb222('0x14')]);return _0x4a9d99(_0x26a8ed['error']['message']);}logger[_0xb222('0x12')](_0xb222('0xf'),_0x6358f3,_0x26a8ed['error'][_0xb222('0x14')]);return _0x5db63b(_0x26a8ed[_0xb222('0x12')][_0xb222('0x14')]);}else{logger[_0xb222('0xe')](_0xb222('0xf'),_0x6358f3,'request\x20sent');_0x5db63b(_0x26a8ed[_0xb222('0x15')][_0xb222('0x14')]);}})['catch'](function(_0x3e1247){logger[_0xb222('0x12')](_0xb222('0xf'),_0x6358f3,_0x3e1247);_0x4a9d99(_0x3e1247);});});}exports['GetMailQueue']=function(_0x1d0765){var _0x58628d=this;return new Promise(function(_0x495abc,_0x36dd4b){return db[_0xb222('0x16')][_0xb222('0x17')]({'raw':_0x1d0765[_0xb222('0x18')]?_0x1d0765[_0xb222('0x18')][_0xb222('0x19')]===undefined?!![]:![]:!![],'where':_0x1d0765[_0xb222('0x18')]?_0x1d0765['options'][_0xb222('0x1a')]||null:null,'attributes':_0x1d0765['options']?_0x1d0765[_0xb222('0x18')][_0xb222('0x1b')]||null:null,'limit':_0x1d0765[_0xb222('0x18')]?_0x1d0765[_0xb222('0x18')][_0xb222('0x1c')]||null:null,'include':_0x1d0765[_0xb222('0x18')]?_0x1d0765[_0xb222('0x18')][_0xb222('0x1d')]?_['map'](_0x1d0765['options']['include'],function(_0x28ec9b){return{'model':db[_0x28ec9b[_0xb222('0x1e')]],'as':_0x28ec9b['as'],'attributes':_0x28ec9b[_0xb222('0x1b')],'include':_0x28ec9b[_0xb222('0x1d')]?_['map'](_0x28ec9b[_0xb222('0x1d')],function(_0x3f4856){return{'model':db[_0x3f4856[_0xb222('0x1e')]],'as':_0x3f4856['as'],'attributes':_0x3f4856[_0xb222('0x1b')],'include':_0x3f4856[_0xb222('0x1d')]?_[_0xb222('0x1f')](_0x3f4856[_0xb222('0x1d')],function(_0x17cad7){return{'model':db[_0x17cad7[_0xb222('0x1e')]],'as':_0x17cad7['as'],'attributes':_0x17cad7[_0xb222('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb222('0x20')](function(_0x3a3340){logger[_0xb222('0xe')]('GetMailQueue',_0x1d0765);logger[_0xb222('0x21')](_0xb222('0x22'),_0x1d0765,JSON['stringify'](_0x3a3340));_0x495abc(_0x3a3340);})[_0xb222('0x23')](function(_0x422005){logger[_0xb222('0x12')](_0xb222('0x22'),_0x422005[_0xb222('0x14')],_0x1d0765);_0x36dd4b(_0x58628d['error'](0x1f4,_0x422005['message']));});});};exports['ShowMailQueue']=function(_0x1cbdf0){var _0x232b0d=this;return new Promise(function(_0x115aee,_0x11626c){return db[_0xb222('0x16')][_0xb222('0x24')]({'raw':_0x1cbdf0['options']?_0x1cbdf0['options'][_0xb222('0x19')]===undefined?!![]:![]:!![],'where':_0x1cbdf0[_0xb222('0x18')]?_0x1cbdf0[_0xb222('0x18')][_0xb222('0x1a')]||null:null,'attributes':_0x1cbdf0[_0xb222('0x18')]?_0x1cbdf0[_0xb222('0x18')][_0xb222('0x1b')]||null:null,'include':_0x1cbdf0[_0xb222('0x18')]?_0x1cbdf0[_0xb222('0x18')]['include']?_[_0xb222('0x1f')](_0x1cbdf0[_0xb222('0x18')][_0xb222('0x1d')],function(_0x55f0df){return{'model':db[_0x55f0df[_0xb222('0x1e')]],'as':_0x55f0df['as'],'attributes':_0x55f0df['attributes'],'include':_0x55f0df[_0xb222('0x1d')]?_[_0xb222('0x1f')](_0x55f0df[_0xb222('0x1d')],function(_0x1affb4){return{'model':db[_0x1affb4['model']],'as':_0x1affb4['as'],'attributes':_0x1affb4[_0xb222('0x1b')],'include':_0x1affb4[_0xb222('0x1d')]?_[_0xb222('0x1f')](_0x1affb4[_0xb222('0x1d')],function(_0x131f79){return{'model':db[_0x131f79[_0xb222('0x1e')]],'as':_0x131f79['as'],'attributes':_0x131f79[_0xb222('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb222('0x20')](function(_0x15ca4e){logger[_0xb222('0xe')](_0xb222('0x25'),_0x1cbdf0);logger[_0xb222('0x21')](_0xb222('0x25'),_0x1cbdf0,JSON['stringify'](_0x15ca4e));_0x115aee(_0x15ca4e);})['catch'](function(_0x46717d){logger[_0xb222('0x12')](_0xb222('0x25'),_0x46717d[_0xb222('0x14')],_0x1cbdf0);_0x11626c(_0x232b0d[_0xb222('0x12')](0x1f4,_0x46717d[_0xb222('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 369db8b..01719a7 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 _0xbd19=['mailQueue:','./mailQueue.events','save','remove','emit','removeListener','register','length'];(function(_0x20796e,_0x4af5c0){var _0x449490=function(_0x528f86){while(--_0x528f86){_0x20796e['push'](_0x20796e['shift']());}};_0x449490(++_0x4af5c0);}(_0xbd19,0x111));var _0x9bd1=function(_0x4b73a2,_0x40b5fe){_0x4b73a2=_0x4b73a2-0x0;var _0x383c66=_0xbd19[_0x4b73a2];return _0x383c66;};'use strict';var MailQueueEvents=require(_0x9bd1('0x0'));var events=[_0x9bd1('0x1'),_0x9bd1('0x2'),'update'];function createListener(_0x14e106,_0x42c7cb){return function(_0x4c64d6){_0x42c7cb[_0x9bd1('0x3')](_0x14e106,_0x4c64d6);};}function removeListener(_0x1809c7,_0x39486b){return function(){MailQueueEvents[_0x9bd1('0x4')](_0x1809c7,_0x39486b);};}exports[_0x9bd1('0x5')]=function(_0x14ab55){for(var _0x1d272b=0x0,_0xe9aa35=events[_0x9bd1('0x6')];_0x1d272b<_0xe9aa35;_0x1d272b++){var _0x289905=events[_0x1d272b];var _0x1ce45c=createListener(_0x9bd1('0x7')+_0x289905,_0x14ab55);MailQueueEvents['on'](_0x289905,_0x1ce45c);}}; \ No newline at end of file +var _0xbe07=['register','mailQueue:','./mailQueue.events','save','remove','emit','removeListener'];(function(_0x1b6c6d,_0x2983b0){var _0x290d9d=function(_0x5b9779){while(--_0x5b9779){_0x1b6c6d['push'](_0x1b6c6d['shift']());}};_0x290d9d(++_0x2983b0);}(_0xbe07,0xf7));var _0x7be0=function(_0x5d21bb,_0x15337e){_0x5d21bb=_0x5d21bb-0x0;var _0x50f68d=_0xbe07[_0x5d21bb];return _0x50f68d;};'use strict';var MailQueueEvents=require(_0x7be0('0x0'));var events=[_0x7be0('0x1'),_0x7be0('0x2'),'update'];function createListener(_0x26afa2,_0xa0df33){return function(_0x2a2e13){_0xa0df33[_0x7be0('0x3')](_0x26afa2,_0x2a2e13);};}function removeListener(_0x2ea0f0,_0x4ecc50){return function(){MailQueueEvents[_0x7be0('0x4')](_0x2ea0f0,_0x4ecc50);};}exports[_0x7be0('0x5')]=function(_0x5341cf){for(var _0x24b775=0x0,_0x1f206e=events['length'];_0x24b775<_0x1f206e;_0x24b775++){var _0x31a6e6=events[_0x24b775];var _0x3d832c=createListener(_0x7be0('0x6')+_0x31a6e6,_0x5341cf);MailQueueEvents['on'](_0x31a6e6,_0x3d832c);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index cb94008..1bc7412 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 _0xa043=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','index','get','/describe','isAuthenticated','show','post','create','put','update','destroy','exports','util','path'];(function(_0xad11b4,_0x1c6e20){var _0x3567f3=function(_0x21e71e){while(--_0x21e71e){_0xad11b4['push'](_0xad11b4['shift']());}};_0x3567f3(++_0x1c6e20);}(_0xa043,0x1cc));var _0x3a04=function(_0x7f9161,_0x487541){_0x7f9161=_0x7f9161-0x0;var _0x25f8ac=_0xa043[_0x7f9161];return _0x25f8ac;};'use strict';var multer=require('multer');var util=require(_0x3a04('0x0'));var path=require(_0x3a04('0x1'));var timeout=require(_0x3a04('0x2'));var express=require(_0x3a04('0x3'));var router=express[_0x3a04('0x4')]();var fs_extra=require(_0x3a04('0x5'));var auth=require(_0x3a04('0x6'));var interaction=require(_0x3a04('0x7'));var config=require(_0x3a04('0x8'));var controller=require(_0x3a04('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x3a04('0xa')]);router[_0x3a04('0xb')](_0x3a04('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x3a04('0xb')]('/:id',auth[_0x3a04('0xd')](),controller[_0x3a04('0xe')]);router[_0x3a04('0xf')]('/',auth[_0x3a04('0xd')](),controller[_0x3a04('0x10')]);router[_0x3a04('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x3a04('0x12')]);router['delete']('/:id',auth[_0x3a04('0xd')](),controller[_0x3a04('0x13')]);module[_0x3a04('0x14')]=router; \ No newline at end of file +var _0x663e=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','exports','multer'];(function(_0x29a29f,_0x155ce7){var _0x443ea3=function(_0xe0dd24){while(--_0xe0dd24){_0x29a29f['push'](_0x29a29f['shift']());}};_0x443ea3(++_0x155ce7);}(_0x663e,0x77));var _0xe663=function(_0x4db92f,_0x31f14a){_0x4db92f=_0x4db92f-0x0;var _0x2799ee=_0x663e[_0x4db92f];return _0x2799ee;};'use strict';var multer=require(_0xe663('0x0'));var util=require('util');var path=require(_0xe663('0x1'));var timeout=require(_0xe663('0x2'));var express=require(_0xe663('0x3'));var router=express[_0xe663('0x4')]();var fs_extra=require(_0xe663('0x5'));var auth=require(_0xe663('0x6'));var interaction=require(_0xe663('0x7'));var config=require('../../config/environment');var controller=require(_0xe663('0x8'));router[_0xe663('0x9')]('/',auth[_0xe663('0xa')](),controller[_0xe663('0xb')]);router[_0xe663('0x9')]('/describe',auth[_0xe663('0xa')](),controller[_0xe663('0xc')]);router[_0xe663('0x9')](_0xe663('0xd'),auth[_0xe663('0xa')](),controller[_0xe663('0xe')]);router[_0xe663('0xf')]('/',auth[_0xe663('0xa')](),controller[_0xe663('0x10')]);router[_0xe663('0x11')](_0xe663('0xd'),auth[_0xe663('0xa')](),controller[_0xe663('0x12')]);router['delete'](_0xe663('0xd'),auth[_0xe663('0xa')](),controller['destroy']);module[_0xe663('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 8bf956b..cb1263e 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 _0x01e8=['moment','sequelize','exports','STRING','DATE'];(function(_0xa3a4a6,_0x16213f){var _0x4b897b=function(_0xe2dccc){while(--_0xe2dccc){_0xa3a4a6['push'](_0xa3a4a6['shift']());}};_0x4b897b(++_0x16213f);}(_0x01e8,0x6e));var _0x801e=function(_0x44ea17,_0x422059){_0x44ea17=_0x44ea17-0x0;var _0x1d8af1=_0x01e8[_0x44ea17];return _0x1d8af1;};'use strict';var moment=require(_0x801e('0x0'));var Sequelize=require(_0x801e('0x1'));module[_0x801e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x801e('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x801e('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x801e('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x32b6=['sequelize','exports','DATE','moment'];(function(_0x3f3b97,_0x395d93){var _0xb6ab0c=function(_0x330c5a){while(--_0x330c5a){_0x3f3b97['push'](_0x3f3b97['shift']());}};_0xb6ab0c(++_0x395d93);}(_0x32b6,0x18b));var _0x632b=function(_0x1c78cc,_0xc7b470){_0x1c78cc=_0x1c78cc-0x0;var _0x304a5f=_0x32b6[_0x1c78cc];return _0x304a5f;};'use strict';var moment=require(_0x632b('0x0'));var Sequelize=require(_0x632b('0x1'));module[_0x632b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x632b('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x632b('0x3')]},'exitAt':{'type':Sequelize[_0x632b('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 4b023b8..abf5929 100644 --- a/server/api/mailQueueReport/mailQueueReport.controller.js +++ b/server/api/mailQueueReport/mailQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8952=['filter','VIRTUAL','merge','options','findAll','rows','show','params','keys','includeAll','include','catch','create','body','destroy','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','end','stack','name','map','MailQueueReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x8952,0x17e));var _0x2895=function(_0x517621,_0x518347){_0x517621=_0x517621-0x0;var _0x4bca92=_0x8952[_0x517621];return _0x4bca92;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2895('0x0'));var zipdir=require(_0x2895('0x1'));var jsonpatch=require(_0x2895('0x2'));var rp=require(_0x2895('0x3'));var moment=require(_0x2895('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2895('0x5'));var util=require(_0x2895('0x6'));var path=require(_0x2895('0x7'));var sox=require('sox');var csv=require(_0x2895('0x8'));var ejs=require(_0x2895('0x9'));var fs=require('fs');var fs_extra=require(_0x2895('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2895('0xb'));var jsforce=require(_0x2895('0xc'));var deskjs=require(_0x2895('0xd'));var toCsv=require(_0x2895('0x8'));var querystring=require(_0x2895('0xe'));var Papa=require('papaparse');var Redis=require(_0x2895('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2895('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2895('0x11'));var utils=require(_0x2895('0x12'));var config=require(_0x2895('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x2895('0x14'))['db'];function respondWithStatusCode(_0x3924be,_0x4b1342){_0x4b1342=_0x4b1342||0xcc;return function(_0x32574c){if(_0x32574c){return _0x3924be[_0x2895('0x15')](_0x4b1342);}return _0x3924be['status'](_0x4b1342)['end']();};}function respondWithResult(_0x1d1493,_0x2ca2ac){_0x2ca2ac=_0x2ca2ac||0xc8;return function(_0x5777a0){if(_0x5777a0){return _0x1d1493[_0x2895('0x16')](_0x2ca2ac)[_0x2895('0x17')](_0x5777a0);}};}function respondWithFilteredResult(_0x27b50e,_0x1ae013){return function(_0x1d3659){if(_0x1d3659){var _0x2627e6=typeof _0x1ae013[_0x2895('0x18')]===_0x2895('0x19')&&typeof _0x1ae013[_0x2895('0x1a')]===_0x2895('0x19');var _0x10a1bf=_0x1d3659[_0x2895('0x1b')];var _0xbf8b63=_0x2627e6?0x0:_0x1ae013[_0x2895('0x18')];var _0x155124=_0x2627e6?_0x1d3659[_0x2895('0x1b')]:_0x1ae013[_0x2895('0x18')]+_0x1ae013[_0x2895('0x1a')];var _0x5a8eab;if(_0x155124>=_0x10a1bf){_0x155124=_0x10a1bf;_0x5a8eab=0xc8;}else{_0x5a8eab=0xce;}_0x27b50e['status'](_0x5a8eab);return _0x27b50e['set'](_0x2895('0x1c'),_0xbf8b63+'-'+_0x155124+'/'+_0x10a1bf)[_0x2895('0x17')](_0x1d3659);}return null;};}function patchUpdates(_0x3ec4da){return function(_0x593e47){try{jsonpatch[_0x2895('0x1d')](_0x593e47,_0x3ec4da,!![]);}catch(_0x190b79){return BPromise[_0x2895('0x1e')](_0x190b79);}return _0x593e47[_0x2895('0x1f')]();};}function saveUpdates(_0x8b75e0,_0x5dbbfe){return function(_0x30c6c3){if(_0x30c6c3){return _0x30c6c3[_0x2895('0x20')](_0x8b75e0)['then'](function(_0x142e58){return _0x142e58;});}return null;};}function removeEntity(_0x384357,_0x6f8ad4){return function(_0x511286){if(_0x511286){return _0x511286['destroy']()[_0x2895('0x21')](function(){_0x384357[_0x2895('0x16')](0xcc)[_0x2895('0x22')]();});}};}function handleEntityNotFound(_0x4a21cf,_0x3d3320){return function(_0x3690ce){if(!_0x3690ce){_0x4a21cf['sendStatus'](0x194);}return _0x3690ce;};}function handleError(_0x293ad3,_0x127540){_0x127540=_0x127540||0x1f4;return function(_0x2cd4df){logger['error'](_0x2cd4df[_0x2895('0x23')]);if(_0x2cd4df[_0x2895('0x24')]){delete _0x2cd4df['name'];}_0x293ad3[_0x2895('0x16')](_0x127540)['send'](_0x2cd4df);};}exports['index']=function(_0x18a935,_0x4ee2cc){var _0xfa4f85={},_0x381538={},_0x4fdd94={'count':0x0,'rows':[]};var _0x5574bf=_[_0x2895('0x25')](db[_0x2895('0x26')][_0x2895('0x27')],function(_0x14e343){return{'name':_0x14e343[_0x2895('0x28')],'type':_0x14e343[_0x2895('0x29')][_0x2895('0x2a')]};});_0x381538['model']=_[_0x2895('0x25')](_0x5574bf,_0x2895('0x24'));_0x381538[_0x2895('0x2b')]=_['keys'](_0x18a935[_0x2895('0x2b')]);_0x381538[_0x2895('0x2c')]=_[_0x2895('0x2d')](_0x381538[_0x2895('0x2e')],_0x381538['query']);_0xfa4f85[_0x2895('0x2f')]=_[_0x2895('0x2d')](_0x381538[_0x2895('0x2e')],qs[_0x2895('0x30')](_0x18a935[_0x2895('0x2b')]['fields']));_0xfa4f85['attributes']=_0xfa4f85[_0x2895('0x2f')][_0x2895('0x31')]?_0xfa4f85['attributes']:_0x381538[_0x2895('0x2e')];if(!_0x18a935['query'][_0x2895('0x32')](_0x2895('0x33'))){_0xfa4f85['limit']=qs[_0x2895('0x1a')](_0x18a935['query'][_0x2895('0x1a')]);_0xfa4f85['offset']=qs['offset'](_0x18a935[_0x2895('0x2b')][_0x2895('0x18')]);}_0xfa4f85[_0x2895('0x34')]=qs['sort'](_0x18a935[_0x2895('0x2b')][_0x2895('0x35')]);_0xfa4f85[_0x2895('0x36')]=qs[_0x2895('0x2c')](_[_0x2895('0x37')](_0x18a935[_0x2895('0x2b')],_0x381538[_0x2895('0x2c')]),_0x5574bf);if(_0x18a935[_0x2895('0x2b')][_0x2895('0x38')]){_0xfa4f85[_0x2895('0x36')]=_['merge'](_0xfa4f85[_0x2895('0x36')],{'$or':_[_0x2895('0x25')](_0x5574bf,function(_0x47413d){if(_0x47413d[_0x2895('0x29')]!==_0x2895('0x39')){var _0x12d7d8={};_0x12d7d8[_0x47413d[_0x2895('0x24')]]={'$like':'%'+_0x18a935['query']['filter']+'%'};return _0x12d7d8;}})});}_0xfa4f85=_[_0x2895('0x3a')]({},_0xfa4f85,_0x18a935[_0x2895('0x3b')]);var _0x24b9e0={'where':_0xfa4f85[_0x2895('0x36')]};return db[_0x2895('0x26')][_0x2895('0x1b')](_0x24b9e0)['then'](function(_0x5d18ef){_0x4fdd94[_0x2895('0x1b')]=_0x5d18ef;if(_0x18a935[_0x2895('0x2b')]['includeAll']){_0xfa4f85['include']=[{'all':!![]}];}return db[_0x2895('0x26')][_0x2895('0x3c')](_0xfa4f85);})[_0x2895('0x21')](function(_0x28967f){_0x4fdd94[_0x2895('0x3d')]=_0x28967f;return _0x4fdd94;})[_0x2895('0x21')](respondWithFilteredResult(_0x4ee2cc,_0xfa4f85))['catch'](handleError(_0x4ee2cc,null));};exports[_0x2895('0x3e')]=function(_0x2cfb24,_0x18ca24){var _0x1537fd={'raw':!![],'where':{'id':_0x2cfb24[_0x2895('0x3f')]['id']}},_0x4af6d6={};_0x4af6d6[_0x2895('0x2e')]=_[_0x2895('0x40')](db[_0x2895('0x26')]['rawAttributes']);_0x4af6d6['query']=_[_0x2895('0x40')](_0x2cfb24[_0x2895('0x2b')]);_0x4af6d6[_0x2895('0x2c')]=_[_0x2895('0x2d')](_0x4af6d6[_0x2895('0x2e')],_0x4af6d6['query']);_0x1537fd['attributes']=_[_0x2895('0x2d')](_0x4af6d6[_0x2895('0x2e')],qs[_0x2895('0x30')](_0x2cfb24[_0x2895('0x2b')][_0x2895('0x30')]));_0x1537fd[_0x2895('0x2f')]=_0x1537fd[_0x2895('0x2f')]['length']?_0x1537fd[_0x2895('0x2f')]:_0x4af6d6[_0x2895('0x2e')];if(_0x2cfb24[_0x2895('0x2b')][_0x2895('0x41')]){_0x1537fd[_0x2895('0x42')]=[{'all':!![]}];}_0x1537fd=_[_0x2895('0x3a')]({},_0x1537fd,_0x2cfb24[_0x2895('0x3b')]);return db[_0x2895('0x26')]['find'](_0x1537fd)[_0x2895('0x21')](handleEntityNotFound(_0x18ca24,null))[_0x2895('0x21')](respondWithResult(_0x18ca24,null))[_0x2895('0x43')](handleError(_0x18ca24,null));};exports['create']=function(_0xc85aa1,_0x5307a9){return db['MailQueueReport'][_0x2895('0x44')](_0xc85aa1[_0x2895('0x45')],{})[_0x2895('0x21')](respondWithResult(_0x5307a9,0xc9))[_0x2895('0x43')](handleError(_0x5307a9,null));};exports[_0x2895('0x20')]=function(_0x3cc331,_0x11e53a){if(_0x3cc331['body']['id']){delete _0x3cc331[_0x2895('0x45')]['id'];}return db[_0x2895('0x26')]['find']({'where':{'id':_0x3cc331['params']['id']}})['then'](handleEntityNotFound(_0x11e53a,null))[_0x2895('0x21')](saveUpdates(_0x3cc331[_0x2895('0x45')],null))[_0x2895('0x21')](respondWithResult(_0x11e53a,null))[_0x2895('0x43')](handleError(_0x11e53a,null));};exports[_0x2895('0x46')]=function(_0x3c5261,_0xaca46c){return db[_0x2895('0x26')][_0x2895('0x47')]({'where':{'id':_0x3c5261[_0x2895('0x3f')]['id']}})[_0x2895('0x21')](handleEntityNotFound(_0xaca46c,null))[_0x2895('0x21')](removeEntity(_0xaca46c,null))[_0x2895('0x43')](handleError(_0xaca46c,null));};exports[_0x2895('0x48')]=function(_0x356d35,_0x3c1135){return db[_0x2895('0x26')][_0x2895('0x48')]()[_0x2895('0x21')](respondWithResult(_0x3c1135,null))[_0x2895('0x43')](handleError(_0x3c1135,null));}; \ No newline at end of file +var _0x93e9=['end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','error','name','send','map','rawAttributes','fieldName','type','key','query','intersection','model','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','MailQueueReport','includeAll','include','findAll','catch','show','params','keys','fields','length','options','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0x573db6,_0x205cfb){var _0x32cd2f=function(_0x199e0f){while(--_0x199e0f){_0x573db6['push'](_0x573db6['shift']());}};_0x32cd2f(++_0x205cfb);}(_0x93e9,0xcc));var _0x993e=function(_0x1161ed,_0x4d2e0e){_0x1161ed=_0x1161ed-0x0;var _0x2468c7=_0x93e9[_0x1161ed];return _0x2468c7;};'use strict';var emlformat=require(_0x993e('0x0'));var rimraf=require(_0x993e('0x1'));var zipdir=require(_0x993e('0x2'));var jsonpatch=require(_0x993e('0x3'));var rp=require(_0x993e('0x4'));var moment=require(_0x993e('0x5'));var BPromise=require(_0x993e('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x993e('0x7'));var sox=require(_0x993e('0x8'));var csv=require(_0x993e('0x9'));var ejs=require(_0x993e('0xa'));var fs=require('fs');var fs_extra=require(_0x993e('0xb'));var _=require(_0x993e('0xc'));var squel=require(_0x993e('0xd'));var crypto=require(_0x993e('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x993e('0xf'));var toCsv=require(_0x993e('0x9'));var querystring=require(_0x993e('0x10'));var Papa=require(_0x993e('0x11'));var Redis=require(_0x993e('0x12'));var authService=require(_0x993e('0x13'));var qs=require(_0x993e('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x993e('0x15'));var logger=require(_0x993e('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x993e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x993e('0x18'))['db'];function respondWithStatusCode(_0x5d5c0d,_0x4c2707){_0x4c2707=_0x4c2707||0xcc;return function(_0x31ece2){if(_0x31ece2){return _0x5d5c0d[_0x993e('0x19')](_0x4c2707);}return _0x5d5c0d[_0x993e('0x1a')](_0x4c2707)[_0x993e('0x1b')]();};}function respondWithResult(_0x3e082b,_0x397b42){_0x397b42=_0x397b42||0xc8;return function(_0x34ddda){if(_0x34ddda){return _0x3e082b[_0x993e('0x1a')](_0x397b42)[_0x993e('0x1c')](_0x34ddda);}};}function respondWithFilteredResult(_0xa43a4e,_0x1a7726){return function(_0x135771){if(_0x135771){var _0x3df0e7=typeof _0x1a7726[_0x993e('0x1d')]===_0x993e('0x1e')&&typeof _0x1a7726[_0x993e('0x1f')]===_0x993e('0x1e');var _0x526e06=_0x135771[_0x993e('0x20')];var _0x1acd21=_0x3df0e7?0x0:_0x1a7726[_0x993e('0x1d')];var _0x3d6109=_0x3df0e7?_0x135771[_0x993e('0x20')]:_0x1a7726[_0x993e('0x1d')]+_0x1a7726['limit'];var _0x11cd41;if(_0x3d6109>=_0x526e06){_0x3d6109=_0x526e06;_0x11cd41=0xc8;}else{_0x11cd41=0xce;}_0xa43a4e[_0x993e('0x1a')](_0x11cd41);return _0xa43a4e[_0x993e('0x21')](_0x993e('0x22'),_0x1acd21+'-'+_0x3d6109+'/'+_0x526e06)[_0x993e('0x1c')](_0x135771);}return null;};}function patchUpdates(_0x425ab4){return function(_0x29e48d){try{jsonpatch[_0x993e('0x23')](_0x29e48d,_0x425ab4,!![]);}catch(_0x4bbe9c){return BPromise[_0x993e('0x24')](_0x4bbe9c);}return _0x29e48d['save']();};}function saveUpdates(_0x11f6f4,_0x37ff57){return function(_0x32b09e){if(_0x32b09e){return _0x32b09e['update'](_0x11f6f4)[_0x993e('0x25')](function(_0x13db4e){return _0x13db4e;});}return null;};}function removeEntity(_0xfba00f,_0x1c52fd){return function(_0x3b45ef){if(_0x3b45ef){return _0x3b45ef[_0x993e('0x26')]()[_0x993e('0x25')](function(){_0xfba00f[_0x993e('0x1a')](0xcc)[_0x993e('0x1b')]();});}};}function handleEntityNotFound(_0x18f6ac,_0x3fe099){return function(_0x3603fa){if(!_0x3603fa){_0x18f6ac['sendStatus'](0x194);}return _0x3603fa;};}function handleError(_0x2756a7,_0x279bb8){_0x279bb8=_0x279bb8||0x1f4;return function(_0x52b727){logger[_0x993e('0x27')](_0x52b727['stack']);if(_0x52b727[_0x993e('0x28')]){delete _0x52b727[_0x993e('0x28')];}_0x2756a7[_0x993e('0x1a')](_0x279bb8)[_0x993e('0x29')](_0x52b727);};}exports['index']=function(_0x48d457,_0x32e332){var _0x466d63={},_0x4a4f00={},_0x223af0={'count':0x0,'rows':[]};var _0x46670a=_[_0x993e('0x2a')](db['MailQueueReport'][_0x993e('0x2b')],function(_0x9e0309){return{'name':_0x9e0309[_0x993e('0x2c')],'type':_0x9e0309[_0x993e('0x2d')][_0x993e('0x2e')]};});_0x4a4f00['model']=_[_0x993e('0x2a')](_0x46670a,'name');_0x4a4f00[_0x993e('0x2f')]=_['keys'](_0x48d457[_0x993e('0x2f')]);_0x4a4f00['filters']=_[_0x993e('0x30')](_0x4a4f00[_0x993e('0x31')],_0x4a4f00[_0x993e('0x2f')]);_0x466d63[_0x993e('0x32')]=_[_0x993e('0x30')](_0x4a4f00[_0x993e('0x31')],qs['fields'](_0x48d457[_0x993e('0x2f')]['fields']));_0x466d63['attributes']=_0x466d63[_0x993e('0x32')]['length']?_0x466d63[_0x993e('0x32')]:_0x4a4f00[_0x993e('0x31')];if(!_0x48d457[_0x993e('0x2f')][_0x993e('0x33')](_0x993e('0x34'))){_0x466d63[_0x993e('0x1f')]=qs[_0x993e('0x1f')](_0x48d457[_0x993e('0x2f')][_0x993e('0x1f')]);_0x466d63[_0x993e('0x1d')]=qs[_0x993e('0x1d')](_0x48d457[_0x993e('0x2f')][_0x993e('0x1d')]);}_0x466d63[_0x993e('0x35')]=qs[_0x993e('0x36')](_0x48d457['query'][_0x993e('0x36')]);_0x466d63[_0x993e('0x37')]=qs[_0x993e('0x38')](_[_0x993e('0x39')](_0x48d457[_0x993e('0x2f')],_0x4a4f00[_0x993e('0x38')]),_0x46670a);if(_0x48d457[_0x993e('0x2f')][_0x993e('0x3a')]){_0x466d63[_0x993e('0x37')]=_['merge'](_0x466d63[_0x993e('0x37')],{'$or':_['map'](_0x46670a,function(_0xf79f29){if(_0xf79f29[_0x993e('0x2d')]!==_0x993e('0x3b')){var _0x406f14={};_0x406f14[_0xf79f29[_0x993e('0x28')]]={'$like':'%'+_0x48d457[_0x993e('0x2f')][_0x993e('0x3a')]+'%'};return _0x406f14;}})});}_0x466d63=_[_0x993e('0x3c')]({},_0x466d63,_0x48d457['options']);var _0x186d55={'where':_0x466d63['where']};return db[_0x993e('0x3d')]['count'](_0x186d55)[_0x993e('0x25')](function(_0xbd9983){_0x223af0[_0x993e('0x20')]=_0xbd9983;if(_0x48d457[_0x993e('0x2f')][_0x993e('0x3e')]){_0x466d63[_0x993e('0x3f')]=[{'all':!![]}];}return db[_0x993e('0x3d')][_0x993e('0x40')](_0x466d63);})['then'](function(_0xe64c){_0x223af0['rows']=_0xe64c;return _0x223af0;})['then'](respondWithFilteredResult(_0x32e332,_0x466d63))[_0x993e('0x41')](handleError(_0x32e332,null));};exports[_0x993e('0x42')]=function(_0x1f058f,_0x5ed497){var _0x620b26={'raw':!![],'where':{'id':_0x1f058f[_0x993e('0x43')]['id']}},_0x40719d={};_0x40719d['model']=_['keys'](db['MailQueueReport'][_0x993e('0x2b')]);_0x40719d[_0x993e('0x2f')]=_[_0x993e('0x44')](_0x1f058f['query']);_0x40719d[_0x993e('0x38')]=_[_0x993e('0x30')](_0x40719d['model'],_0x40719d[_0x993e('0x2f')]);_0x620b26[_0x993e('0x32')]=_['intersection'](_0x40719d[_0x993e('0x31')],qs[_0x993e('0x45')](_0x1f058f[_0x993e('0x2f')]['fields']));_0x620b26['attributes']=_0x620b26['attributes'][_0x993e('0x46')]?_0x620b26[_0x993e('0x32')]:_0x40719d[_0x993e('0x31')];if(_0x1f058f[_0x993e('0x2f')]['includeAll']){_0x620b26[_0x993e('0x3f')]=[{'all':!![]}];}_0x620b26=_[_0x993e('0x3c')]({},_0x620b26,_0x1f058f[_0x993e('0x47')]);return db[_0x993e('0x3d')][_0x993e('0x48')](_0x620b26)[_0x993e('0x25')](handleEntityNotFound(_0x5ed497,null))['then'](respondWithResult(_0x5ed497,null))['catch'](handleError(_0x5ed497,null));};exports[_0x993e('0x49')]=function(_0x416f9f,_0x4d560d){return db['MailQueueReport'][_0x993e('0x49')](_0x416f9f[_0x993e('0x4a')],{})[_0x993e('0x25')](respondWithResult(_0x4d560d,0xc9))[_0x993e('0x41')](handleError(_0x4d560d,null));};exports[_0x993e('0x4b')]=function(_0x256ce3,_0x5b18e3){if(_0x256ce3[_0x993e('0x4a')]['id']){delete _0x256ce3['body']['id'];}return db[_0x993e('0x3d')][_0x993e('0x48')]({'where':{'id':_0x256ce3[_0x993e('0x43')]['id']}})[_0x993e('0x25')](handleEntityNotFound(_0x5b18e3,null))[_0x993e('0x25')](saveUpdates(_0x256ce3[_0x993e('0x4a')],null))[_0x993e('0x25')](respondWithResult(_0x5b18e3,null))[_0x993e('0x41')](handleError(_0x5b18e3,null));};exports['destroy']=function(_0x23f09c,_0x66ee65){return db[_0x993e('0x3d')]['find']({'where':{'id':_0x23f09c[_0x993e('0x43')]['id']}})['then'](handleEntityNotFound(_0x66ee65,null))[_0x993e('0x25')](removeEntity(_0x66ee65,null))[_0x993e('0x41')](handleError(_0x66ee65,null));};exports['describe']=function(_0xb2508b,_0xef78a1){return db['MailQueueReport'][_0x993e('0x4c')]()[_0x993e('0x25')](respondWithResult(_0xef78a1,null))[_0x993e('0x41')](handleError(_0xef78a1,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index dc16138..47a4afa 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 _0xa4d8=['bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','define','report_mail_queue','uniqueid','moment'];(function(_0xbfb71b,_0x121bc2){var _0x12d390=function(_0x104c81){while(--_0x104c81){_0xbfb71b['push'](_0xbfb71b['shift']());}};_0x12d390(++_0x121bc2);}(_0xa4d8,0x171));var _0x8a4d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa4d8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x8a4d('0x0'));var BPromise=require(_0x8a4d('0x1'));var rp=require(_0x8a4d('0x2'));var fs=require('fs');var path=require(_0x8a4d('0x3'));var rimraf=require(_0x8a4d('0x4'));var config=require(_0x8a4d('0x5'));var attributes=require(_0x8a4d('0x6'));module['exports']=function(_0x1444bd,_0x541d4d){return _0x1444bd[_0x8a4d('0x7')]('MailQueueReport',attributes,{'tableName':_0x8a4d('0x8'),'paranoid':![],'indexes':[{'name':_0x8a4d('0x9'),'fields':[_0x8a4d('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8cbe=['../../config/logger','api','moment','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','MailQueueReport','report_mail_queue','uniqueid','lodash'];(function(_0x2197fa,_0x13590e){var _0xc2da70=function(_0x2a57e3){while(--_0x2a57e3){_0x2197fa['push'](_0x2197fa['shift']());}};_0xc2da70(++_0x13590e);}(_0x8cbe,0x14f));var _0xe8cb=function(_0x40aaee,_0x4bea67){_0x40aaee=_0x40aaee-0x0;var _0x18e0ed=_0x8cbe[_0x40aaee];return _0x18e0ed;};'use strict';var _=require(_0xe8cb('0x0'));var util=require('util');var logger=require(_0xe8cb('0x1'))(_0xe8cb('0x2'));var moment=require(_0xe8cb('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe8cb('0x4'));var rimraf=require(_0xe8cb('0x5'));var config=require(_0xe8cb('0x6'));var attributes=require(_0xe8cb('0x7'));module[_0xe8cb('0x8')]=function(_0x554ff3,_0x4afe46){return _0x554ff3['define'](_0xe8cb('0x9'),attributes,{'tableName':_0xe8cb('0xa'),'paranoid':![],'indexes':[{'name':_0xe8cb('0xb'),'fields':[_0xe8cb('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 76e0e43..b83405b 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 _0xc4aa=['create','body','options','raw','update','where','attributes','limit','UpdateMailQueueReport','stringify','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','CreateMailQueueReport','MailQueueReport'];(function(_0x3f1d5d,_0x3640fe){var _0x35edde=function(_0x278654){while(--_0x278654){_0x3f1d5d['push'](_0x3f1d5d['shift']());}};_0x35edde(++_0x3640fe);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xc4aa[_0x46698a];return _0x356db0;};'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')]('MailQueueReport,\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);});});}exports[_0xac4a('0x15')]=function(_0x28e304){var _0x44ec59=this;return new Promise(function(_0x546c5d,_0x5ac21e){return db[_0xac4a('0x16')][_0xac4a('0x17')](_0x28e304[_0xac4a('0x18')],{'raw':_0x28e304['options']?_0x28e304[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![]})[_0xac4a('0xc')](function(_0x3a3cdb){logger[_0xac4a('0x13')](_0xac4a('0x15'),_0x28e304);logger[_0xac4a('0xf')](_0xac4a('0x15'),_0x28e304,JSON['stringify'](_0x3a3cdb));_0x546c5d(_0x3a3cdb);})[_0xac4a('0x14')](function(_0x3204ad){logger['error'](_0xac4a('0x15'),_0x3204ad[_0xac4a('0x12')],_0x28e304);_0x5ac21e(_0x44ec59[_0xac4a('0x10')](0x1f4,_0x3204ad[_0xac4a('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x1b7998){var _0x2503d8=this;return new Promise(function(_0x15435c,_0x412494){return db[_0xac4a('0x16')][_0xac4a('0x1b')](_0x1b7998[_0xac4a('0x18')],{'raw':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1c')]||null:null,'attributes':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1d')]||null:null,'limit':_0x1b7998['options']?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1e')]||null:null})[_0xac4a('0xc')](function(_0x2772fe){logger[_0xac4a('0x13')]('UpdateMailQueueReport',_0x1b7998);logger['debug'](_0xac4a('0x1f'),_0x1b7998,JSON[_0xac4a('0x20')](_0x2772fe));_0x15435c(_0x2772fe);})[_0xac4a('0x14')](function(_0x546b65){logger['error'](_0xac4a('0x1f'),_0x546b65[_0xac4a('0x12')],_0x1b7998);_0x412494(_0x2503d8[_0xac4a('0x10')](0x1f4,_0x546b65[_0xac4a('0x12')]));});});}; \ No newline at end of file +var _0x2ef3=['options','raw','UpdateMailQueueReport','where','attributes','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailQueueReport,\x20%s,\x20%s','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateMailQueueReport','MailQueueReport','body'];(function(_0x137d80,_0x4ca815){var _0x406c15=function(_0x1f0e13){while(--_0x1f0e13){_0x137d80['push'](_0x137d80['shift']());}};_0x406c15(++_0x4ca815);}(_0x2ef3,0xba));var _0x32ef=function(_0x579c98,_0x1990cf){_0x579c98=_0x579c98-0x0;var _0x59f6c0=_0x2ef3[_0x579c98];return _0x59f6c0;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});}exports[_0x32ef('0x15')]=function(_0x1a9476){var _0x286bfb=this;return new Promise(function(_0x57863c,_0xbe37f6){return db[_0x32ef('0x16')]['create'](_0x1a9476[_0x32ef('0x17')],{'raw':_0x1a9476[_0x32ef('0x18')]?_0x1a9476[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![]})[_0x32ef('0xb')](function(_0x3aec05){logger['info'](_0x32ef('0x15'),_0x1a9476);logger['debug'](_0x32ef('0x15'),_0x1a9476,JSON[_0x32ef('0x10')](_0x3aec05));_0x57863c(_0x3aec05);})['catch'](function(_0x1af371){logger[_0x32ef('0x11')](_0x32ef('0x15'),_0x1af371['message'],_0x1a9476);_0xbe37f6(_0x286bfb['error'](0x1f4,_0x1af371[_0x32ef('0x13')]));});});};exports[_0x32ef('0x1a')]=function(_0x225feb){var _0x478bef=this;return new Promise(function(_0x59585f,_0x19ea6){return db['MailQueueReport']['update'](_0x225feb[_0x32ef('0x17')],{'raw':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1b')]||null:null,'attributes':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1c')]||null:null,'limit':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')]['limit']||null:null})[_0x32ef('0xb')](function(_0x2f5d06){logger['info'](_0x32ef('0x1a'),_0x225feb);logger[_0x32ef('0x1d')](_0x32ef('0x1a'),_0x225feb,JSON[_0x32ef('0x10')](_0x2f5d06));_0x59585f(_0x2f5d06);})['catch'](function(_0x10e38c){logger[_0x32ef('0x11')](_0x32ef('0x1a'),_0x10e38c[_0x32ef('0x13')],_0x225feb);_0x19ea6(_0x478bef[_0x32ef('0x11')](0x1f4,_0x10e38c[_0x32ef('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 96b5b79..63aaac2 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x18cebd,_0x5f138f){var _0x4c702f=function(_0x354a87){while(--_0x354a87){_0x18cebd['push'](_0x18cebd['shift']());}};_0x4c702f(++_0x5f138f);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x5cde43,_0x5b96e2){var _0x73a1d0=function(_0x29ccea){while(--_0x29ccea){_0x5cde43['push'](_0x5cde43['shift']());}};_0x73a1d0(++_0x5b96e2);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index a9fd388..2fbd3d5 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 _0xcffe=['BOOLEAN','INTEGER','sequelize','exports','STRING'];(function(_0x17cdc4,_0x18010a){var _0x3cd3c6=function(_0x5f0853){while(--_0x5f0853){_0x17cdc4['push'](_0x17cdc4['shift']());}};_0x3cd3c6(++_0x18010a);}(_0xcffe,0x1a1));var _0xecff=function(_0x1d6dea,_0x1f8978){_0x1d6dea=_0x1d6dea-0x0;var _0x1b5967=_0xcffe[_0x1d6dea];return _0x1b5967;};'use strict';var Sequelize=require(_0xecff('0x0'));module[_0xecff('0x1')]={'description':{'type':Sequelize[_0xecff('0x2')]},'host':{'type':Sequelize[_0xecff('0x2')]},'authentication':{'type':Sequelize[_0xecff('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xecff('0x2')]},'password':{'type':Sequelize[_0xecff('0x2')]},'port':{'type':Sequelize[_0xecff('0x4')]},'tls':{'type':Sequelize[_0xecff('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xecff('0x2')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xecff('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0xecff('0x2')]}}; \ No newline at end of file +var _0x94df=['INBOX','sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x1b4d12,_0x32469c){var _0x24bced=function(_0x16a5c6){while(--_0x16a5c6){_0x1b4d12['push'](_0x1b4d12['shift']());}};_0x24bced(++_0x32469c);}(_0x94df,0xa3));var _0xf94d=function(_0x270189,_0x814b50){_0x270189=_0x270189-0x0;var _0x121150=_0x94df[_0x270189];return _0x121150;};'use strict';var Sequelize=require(_0xf94d('0x0'));module[_0xf94d('0x1')]={'description':{'type':Sequelize[_0xf94d('0x2')]},'host':{'type':Sequelize[_0xf94d('0x2')]},'authentication':{'type':Sequelize[_0xf94d('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xf94d('0x2')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xf94d('0x4')]},'tls':{'type':Sequelize[_0xf94d('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xf94d('0x2')],'defaultValue':_0xf94d('0x5')},'connTimeout':{'type':Sequelize[_0xf94d('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xf94d('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0xf94d('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index d8e9f2e..dc0bc53 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 _0xa019=['mail_servers_in','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x57896a,_0x12a8fb){var _0x4eba77=function(_0x18d533){while(--_0x18d533){_0x57896a['push'](_0x57896a['shift']());}};_0x4eba77(++_0x12a8fb);}(_0xa019,0x12c));var _0x9a01=function(_0x274662,_0xf97b62){_0x274662=_0x274662-0x0;var _0xca337e=_0xa019[_0x274662];return _0xca337e;};'use strict';var _=require(_0x9a01('0x0'));var util=require(_0x9a01('0x1'));var logger=require(_0x9a01('0x2'))(_0x9a01('0x3'));var moment=require(_0x9a01('0x4'));var BPromise=require(_0x9a01('0x5'));var rp=require(_0x9a01('0x6'));var fs=require('fs');var path=require(_0x9a01('0x7'));var rimraf=require(_0x9a01('0x8'));var config=require(_0x9a01('0x9'));var attributes=require('./mailServerIn.attributes');module[_0x9a01('0xa')]=function(_0x2cfac2,_0x5a57b9){return _0x2cfac2[_0x9a01('0xb')]('MailServerIn',attributes,{'tableName':_0x9a01('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x308d=['./mailServerIn.attributes','exports','define','MailServerIn','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x308d,0x94));var _0xd308=function(_0x2f13f2,_0x1d795f){_0x2f13f2=_0x2f13f2-0x0;var _0x202927=_0x308d[_0x2f13f2];return _0x202927;};'use strict';var _=require(_0xd308('0x0'));var util=require(_0xd308('0x1'));var logger=require('../../config/logger')(_0xd308('0x2'));var moment=require(_0xd308('0x3'));var BPromise=require(_0xd308('0x4'));var rp=require(_0xd308('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd308('0x6'));var config=require(_0xd308('0x7'));var attributes=require(_0xd308('0x8'));module[_0xd308('0x9')]=function(_0x32552f,_0x1ec86e){return _0x32552f[_0xd308('0xa')](_0xd308('0xb'),attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 75fffef..e230266 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 _0x34ab=['info','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','MailServerIn,\x20%s,\x20%s','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','where','attributes','limit','include','model','map','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then'];(function(_0x509693,_0x4fbed1){var _0x458297=function(_0x427244){while(--_0x427244){_0x509693['push'](_0x509693['shift']());}};_0x458297(++_0x4fbed1);}(_0x34ab,0x169));var _0xb34a=function(_0x44946b,_0xf874ec){_0x44946b=_0x44946b-0x0;var _0x249bc4=_0x34ab[_0x44946b];return _0x249bc4;};'use strict';var _=require(_0xb34a('0x0'));var util=require(_0xb34a('0x1'));var moment=require(_0xb34a('0x2'));var BPromise=require(_0xb34a('0x3'));var rs=require(_0xb34a('0x4'));var fs=require('fs');var Redis=require(_0xb34a('0x5'));var db=require(_0xb34a('0x6'))['db'];var utils=require(_0xb34a('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xb34a('0x8'));var jayson=require(_0xb34a('0x9'));var client=jayson[_0xb34a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b8d3e,_0x492c6d,_0x14c0d2){return new BPromise(function(_0xb915fb,_0x3afc6d){return client[_0xb34a('0xb')](_0x2b8d3e,_0x14c0d2)[_0xb34a('0xc')](function(_0x286281){logger[_0xb34a('0xd')]('MailServerIn,\x20%s,\x20%s',_0x492c6d,_0xb34a('0xe'));logger[_0xb34a('0xf')](_0xb34a('0x10'),_0x492c6d,'request\x20sent',JSON[_0xb34a('0x11')](_0x286281));if(_0x286281[_0xb34a('0x12')]){if(_0x286281[_0xb34a('0x12')][_0xb34a('0x13')]===0x1f4){logger[_0xb34a('0x12')](_0xb34a('0x14'),_0x492c6d,_0x286281['error']['message']);return _0x3afc6d(_0x286281['error']['message']);}logger[_0xb34a('0x12')]('MailServerIn,\x20%s,\x20%s',_0x492c6d,_0x286281['error'][_0xb34a('0x15')]);return _0xb915fb(_0x286281[_0xb34a('0x12')][_0xb34a('0x15')]);}else{logger['info'](_0xb34a('0x14'),_0x492c6d,_0xb34a('0xe'));_0xb915fb(_0x286281[_0xb34a('0x16')]['message']);}})[_0xb34a('0x17')](function(_0x4f4abe){logger[_0xb34a('0x12')](_0xb34a('0x14'),_0x492c6d,_0x4f4abe);_0x3afc6d(_0x4f4abe);});});}exports[_0xb34a('0x18')]=function(_0x1ede11){var _0x407255=this;return new Promise(function(_0x45e7da,_0x51ea5f){return db[_0xb34a('0x19')][_0xb34a('0x1a')]({'raw':_0x1ede11[_0xb34a('0x1b')]?_0x1ede11[_0xb34a('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x1ede11[_0xb34a('0x1b')]?_0x1ede11[_0xb34a('0x1b')][_0xb34a('0x1c')]||null:null,'attributes':_0x1ede11[_0xb34a('0x1b')]?_0x1ede11[_0xb34a('0x1b')][_0xb34a('0x1d')]||null:null,'limit':_0x1ede11[_0xb34a('0x1b')]?_0x1ede11[_0xb34a('0x1b')][_0xb34a('0x1e')]||null:null,'include':_0x1ede11['options']?_0x1ede11[_0xb34a('0x1b')][_0xb34a('0x1f')]?_['map'](_0x1ede11[_0xb34a('0x1b')][_0xb34a('0x1f')],function(_0x4dc949){return{'model':db[_0x4dc949[_0xb34a('0x20')]],'as':_0x4dc949['as'],'attributes':_0x4dc949[_0xb34a('0x1d')],'include':_0x4dc949[_0xb34a('0x1f')]?_[_0xb34a('0x21')](_0x4dc949[_0xb34a('0x1f')],function(_0x1b2a2f){return{'model':db[_0x1b2a2f[_0xb34a('0x20')]],'as':_0x1b2a2f['as'],'attributes':_0x1b2a2f[_0xb34a('0x1d')],'include':_0x1b2a2f[_0xb34a('0x1f')]?_[_0xb34a('0x21')](_0x1b2a2f[_0xb34a('0x1f')],function(_0x153ef2){return{'model':db[_0x153ef2[_0xb34a('0x20')]],'as':_0x153ef2['as'],'attributes':_0x153ef2['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x472452){logger[_0xb34a('0xd')](_0xb34a('0x18'),_0x1ede11);logger[_0xb34a('0xf')]('GetMailServerIn',_0x1ede11,JSON['stringify'](_0x472452));_0x45e7da(_0x472452);})['catch'](function(_0x21aafe){logger[_0xb34a('0x12')](_0xb34a('0x18'),_0x21aafe[_0xb34a('0x15')],_0x1ede11);_0x51ea5f(_0x407255[_0xb34a('0x12')](0x1f4,_0x21aafe[_0xb34a('0x15')]));});});}; \ No newline at end of file +var _0xa68c=['stringify','error','code','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','limit','include','map','model','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xa68c,0x187));var _0xca68=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa68c[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0xca68('0x0'));var util=require(_0xca68('0x1'));var moment=require(_0xca68('0x2'));var BPromise=require(_0xca68('0x3'));var rs=require(_0xca68('0x4'));var fs=require('fs');var Redis=require(_0xca68('0x5'));var db=require(_0xca68('0x6'))['db'];var utils=require(_0xca68('0x7'));var logger=require(_0xca68('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xca68('0x9'));var client=jayson['client'][_0xca68('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x346ed0,_0x3af3d8,_0x2e13c0){return new BPromise(function(_0x3a6783,_0x2ec4d3){return client[_0xca68('0xb')](_0x346ed0,_0x2e13c0)[_0xca68('0xc')](function(_0xe88c70){logger[_0xca68('0xd')](_0xca68('0xe'),_0x3af3d8,_0xca68('0xf'));logger[_0xca68('0x10')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x3af3d8,'request\x20sent',JSON[_0xca68('0x11')](_0xe88c70));if(_0xe88c70[_0xca68('0x12')]){if(_0xe88c70[_0xca68('0x12')][_0xca68('0x13')]===0x1f4){logger[_0xca68('0x12')](_0xca68('0xe'),_0x3af3d8,_0xe88c70['error'][_0xca68('0x14')]);return _0x2ec4d3(_0xe88c70[_0xca68('0x12')][_0xca68('0x14')]);}logger['error'](_0xca68('0xe'),_0x3af3d8,_0xe88c70['error'][_0xca68('0x14')]);return _0x3a6783(_0xe88c70[_0xca68('0x12')]['message']);}else{logger['info'](_0xca68('0xe'),_0x3af3d8,_0xca68('0xf'));_0x3a6783(_0xe88c70[_0xca68('0x15')][_0xca68('0x14')]);}})[_0xca68('0x16')](function(_0x207cbb){logger[_0xca68('0x12')](_0xca68('0xe'),_0x3af3d8,_0x207cbb);_0x2ec4d3(_0x207cbb);});});}exports[_0xca68('0x17')]=function(_0x21806e){var _0x9221a5=this;return new Promise(function(_0x1ccbf0,_0x30e34f){return db[_0xca68('0x18')][_0xca68('0x19')]({'raw':_0x21806e[_0xca68('0x1a')]?_0x21806e['options'][_0xca68('0x1b')]===undefined?!![]:![]:!![],'where':_0x21806e['options']?_0x21806e[_0xca68('0x1a')][_0xca68('0x1c')]||null:null,'attributes':_0x21806e[_0xca68('0x1a')]?_0x21806e['options']['attributes']||null:null,'limit':_0x21806e['options']?_0x21806e[_0xca68('0x1a')][_0xca68('0x1d')]||null:null,'include':_0x21806e[_0xca68('0x1a')]?_0x21806e[_0xca68('0x1a')][_0xca68('0x1e')]?_[_0xca68('0x1f')](_0x21806e[_0xca68('0x1a')]['include'],function(_0x1b2f41){return{'model':db[_0x1b2f41[_0xca68('0x20')]],'as':_0x1b2f41['as'],'attributes':_0x1b2f41[_0xca68('0x21')],'include':_0x1b2f41['include']?_['map'](_0x1b2f41[_0xca68('0x1e')],function(_0x4ccd8c){return{'model':db[_0x4ccd8c['model']],'as':_0x4ccd8c['as'],'attributes':_0x4ccd8c[_0xca68('0x21')],'include':_0x4ccd8c['include']?_[_0xca68('0x1f')](_0x4ccd8c[_0xca68('0x1e')],function(_0x2ebfe0){return{'model':db[_0x2ebfe0['model']],'as':_0x2ebfe0['as'],'attributes':_0x2ebfe0[_0xca68('0x21')]};}):[]};}):[]};}):[]:[]})[_0xca68('0xc')](function(_0x2844f9){logger[_0xca68('0xd')](_0xca68('0x17'),_0x21806e);logger[_0xca68('0x10')](_0xca68('0x17'),_0x21806e,JSON[_0xca68('0x11')](_0x2844f9));_0x1ccbf0(_0x2844f9);})['catch'](function(_0x51bd6f){logger[_0xca68('0x12')]('GetMailServerIn',_0x51bd6f[_0xca68('0x14')],_0x21806e);_0x30e34f(_0x9221a5[_0xca68('0x12')](0x1f4,_0x51bd6f[_0xca68('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index adc33fe..21b5823 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x7a54,0x106));var _0x47a5=function(_0x2a37bf,_0x2e7416){_0x2a37bf=_0x2a37bf-0x0;var _0x491183=_0x7a54[_0x2a37bf];return _0x491183;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x3a6efd,_0x2a5102){var _0x487b9a=function(_0x104f89){while(--_0x104f89){_0x3a6efd['push'](_0x3a6efd['shift']());}};_0x487b9a(++_0x2a5102);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 9f06824..23ac202 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 _0x6a8a=['INTEGER','BOOLEAN','exports','STRING'];(function(_0x391c1d,_0x3e825a){var _0x16cea9=function(_0x3b0be2){while(--_0x3b0be2){_0x391c1d['push'](_0x391c1d['shift']());}};_0x16cea9(++_0x3e825a);}(_0x6a8a,0x1e6));var _0xa6a8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6a8a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xa6a8('0x0')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xa6a8('0x1')]},'user':{'type':Sequelize[_0xa6a8('0x1')]},'pass':{'type':Sequelize[_0xa6a8('0x1')]},'port':{'type':Sequelize[_0xa6a8('0x2')]},'secure':{'type':Sequelize[_0xa6a8('0x3')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xa6a8('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xa4fc=['STRING','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x6ffa12,_0x45a92a){var _0x17b047=function(_0x1bf1f6){while(--_0x1bf1f6){_0x6ffa12['push'](_0x6ffa12['shift']());}};_0x17b047(++_0x45a92a);}(_0xa4fc,0x12f));var _0xca4f=function(_0x101779,_0x5b879c){_0x101779=_0x101779-0x0;var _0x277029=_0xa4fc[_0x101779];return _0x277029;};'use strict';var Sequelize=require(_0xca4f('0x0'));module[_0xca4f('0x1')]={'description':{'type':Sequelize[_0xca4f('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0xca4f('0x2')]},'pass':{'type':Sequelize[_0xca4f('0x2')]},'port':{'type':Sequelize[_0xca4f('0x3')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0xca4f('0x2')]},'authentication':{'type':Sequelize[_0xca4f('0x4')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 0c1efc4..a1e2558 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 _0x45c8=['destroy','stack','name','send','index','MailServerOut','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','create','body','find','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then'];(function(_0x3d1d3a,_0x42a74f){var _0x13151d=function(_0x312da7){while(--_0x312da7){_0x3d1d3a['push'](_0x3d1d3a['shift']());}};_0x13151d(++_0x42a74f);}(_0x45c8,0x113));var _0x845c=function(_0x14aa6b,_0x20116b){_0x14aa6b=_0x14aa6b-0x0;var _0x5c62cf=_0x45c8[_0x14aa6b];return _0x5c62cf;};'use strict';var emlformat=require(_0x845c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x845c('0x1'));var rp=require(_0x845c('0x2'));var moment=require('moment');var BPromise=require(_0x845c('0x3'));var Mustache=require(_0x845c('0x4'));var util=require(_0x845c('0x5'));var path=require(_0x845c('0x6'));var sox=require(_0x845c('0x7'));var csv=require(_0x845c('0x8'));var ejs=require(_0x845c('0x9'));var fs=require('fs');var fs_extra=require(_0x845c('0xa'));var _=require(_0x845c('0xb'));var squel=require('squel');var crypto=require(_0x845c('0xc'));var jsforce=require(_0x845c('0xd'));var deskjs=require(_0x845c('0xe'));var toCsv=require(_0x845c('0x8'));var querystring=require(_0x845c('0xf'));var Papa=require(_0x845c('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x845c('0x11'));var as=require(_0x845c('0x12'));var hardwareService=require(_0x845c('0x13'));var logger=require(_0x845c('0x14'))(_0x845c('0x15'));var utils=require(_0x845c('0x16'));var config=require(_0x845c('0x17'));var licenseUtil=require(_0x845c('0x18'));var db=require(_0x845c('0x19'))['db'];function respondWithStatusCode(_0x25b7d3,_0x555c05){_0x555c05=_0x555c05||0xcc;return function(_0x3897b4){if(_0x3897b4){return _0x25b7d3[_0x845c('0x1a')](_0x555c05);}return _0x25b7d3['status'](_0x555c05)[_0x845c('0x1b')]();};}function respondWithResult(_0x18986e,_0x41893f){_0x41893f=_0x41893f||0xc8;return function(_0xfc6be8){if(_0xfc6be8){return _0x18986e[_0x845c('0x1c')](_0x41893f)['json'](_0xfc6be8);}};}function respondWithFilteredResult(_0xe4fa77,_0x3e44f9){return function(_0xb91edf){if(_0xb91edf){var _0x548ffe=typeof _0x3e44f9['offset']===_0x845c('0x1d')&&typeof _0x3e44f9[_0x845c('0x1e')]===_0x845c('0x1d');var _0x58c76a=_0xb91edf[_0x845c('0x1f')];var _0x2a8fad=_0x548ffe?0x0:_0x3e44f9[_0x845c('0x20')];var _0x54c6cf=_0x548ffe?_0xb91edf[_0x845c('0x1f')]:_0x3e44f9[_0x845c('0x20')]+_0x3e44f9['limit'];var _0x13597f;if(_0x54c6cf>=_0x58c76a){_0x54c6cf=_0x58c76a;_0x13597f=0xc8;}else{_0x13597f=0xce;}_0xe4fa77[_0x845c('0x1c')](_0x13597f);return _0xe4fa77[_0x845c('0x21')](_0x845c('0x22'),_0x2a8fad+'-'+_0x54c6cf+'/'+_0x58c76a)[_0x845c('0x23')](_0xb91edf);}return null;};}function patchUpdates(_0x53c861){return function(_0x31d86b){try{jsonpatch[_0x845c('0x24')](_0x31d86b,_0x53c861,!![]);}catch(_0x1273f2){return BPromise[_0x845c('0x25')](_0x1273f2);}return _0x31d86b[_0x845c('0x26')]();};}function saveUpdates(_0x11bf15,_0x27da70){return function(_0x3fbec8){if(_0x3fbec8){return _0x3fbec8[_0x845c('0x27')](_0x11bf15)[_0x845c('0x28')](function(_0x205ad6){return _0x205ad6;});}return null;};}function removeEntity(_0x2dcc42,_0xb27b61){return function(_0x2273f3){if(_0x2273f3){return _0x2273f3[_0x845c('0x29')]()[_0x845c('0x28')](function(){_0x2dcc42[_0x845c('0x1c')](0xcc)[_0x845c('0x1b')]();});}};}function handleEntityNotFound(_0x394a6d,_0x292548){return function(_0x34c384){if(!_0x34c384){_0x394a6d[_0x845c('0x1a')](0x194);}return _0x34c384;};}function handleError(_0x252695,_0x2a6324){_0x2a6324=_0x2a6324||0x1f4;return function(_0x3e341b){logger['error'](_0x3e341b[_0x845c('0x2a')]);if(_0x3e341b[_0x845c('0x2b')]){delete _0x3e341b['name'];}_0x252695[_0x845c('0x1c')](_0x2a6324)[_0x845c('0x2c')](_0x3e341b);};}exports[_0x845c('0x2d')]=function(_0x379f15,_0x5f2603){var _0x41598b={},_0x224ca3={},_0x19b755={'count':0x0,'rows':[]};var _0x31d761=_['map'](db[_0x845c('0x2e')][_0x845c('0x2f')],function(_0x5a701b){return{'name':_0x5a701b[_0x845c('0x30')],'type':_0x5a701b[_0x845c('0x31')][_0x845c('0x32')]};});_0x224ca3[_0x845c('0x33')]=_[_0x845c('0x34')](_0x31d761,'name');_0x224ca3[_0x845c('0x35')]=_[_0x845c('0x36')](_0x379f15[_0x845c('0x35')]);_0x224ca3[_0x845c('0x37')]=_[_0x845c('0x38')](_0x224ca3[_0x845c('0x33')],_0x224ca3[_0x845c('0x35')]);_0x41598b['attributes']=_['intersection'](_0x224ca3[_0x845c('0x33')],qs[_0x845c('0x39')](_0x379f15[_0x845c('0x35')][_0x845c('0x39')]));_0x41598b[_0x845c('0x3a')]=_0x41598b[_0x845c('0x3a')][_0x845c('0x3b')]?_0x41598b[_0x845c('0x3a')]:_0x224ca3['model'];if(!_0x379f15[_0x845c('0x35')][_0x845c('0x3c')](_0x845c('0x3d'))){_0x41598b['limit']=qs[_0x845c('0x1e')](_0x379f15[_0x845c('0x35')][_0x845c('0x1e')]);_0x41598b[_0x845c('0x20')]=qs[_0x845c('0x20')](_0x379f15[_0x845c('0x35')][_0x845c('0x20')]);}_0x41598b[_0x845c('0x3e')]=qs['sort'](_0x379f15[_0x845c('0x35')]['sort']);_0x41598b['where']=qs[_0x845c('0x37')](_[_0x845c('0x3f')](_0x379f15[_0x845c('0x35')],_0x224ca3['filters']),_0x31d761);if(_0x379f15[_0x845c('0x35')][_0x845c('0x40')]){_0x41598b[_0x845c('0x41')]=_[_0x845c('0x42')](_0x41598b[_0x845c('0x41')],{'$or':_[_0x845c('0x34')](_0x31d761,function(_0x1a0af4){if(_0x1a0af4['type']!==_0x845c('0x43')){var _0x118c04={};_0x118c04[_0x1a0af4[_0x845c('0x2b')]]={'$like':'%'+_0x379f15['query']['filter']+'%'};return _0x118c04;}})});}_0x41598b=_[_0x845c('0x42')]({},_0x41598b,_0x379f15['options']);var _0x5e5a4a={'where':_0x41598b['where']};return db['MailServerOut'][_0x845c('0x1f')](_0x5e5a4a)[_0x845c('0x28')](function(_0x5e6621){_0x19b755[_0x845c('0x1f')]=_0x5e6621;if(_0x379f15[_0x845c('0x35')][_0x845c('0x44')]){_0x41598b[_0x845c('0x45')]=[{'all':!![]}];}return db['MailServerOut'][_0x845c('0x46')](_0x41598b);})[_0x845c('0x28')](function(_0x59382c){_0x19b755[_0x845c('0x47')]=_0x59382c;return _0x19b755;})[_0x845c('0x28')](respondWithFilteredResult(_0x5f2603,_0x41598b))[_0x845c('0x48')](handleError(_0x5f2603,null));};exports[_0x845c('0x49')]=function(_0x242a3a,_0x246d47){var _0x9ce42a={'raw':!![],'where':{'id':_0x242a3a[_0x845c('0x4a')]['id']}},_0x4fec17={};_0x4fec17['model']=_[_0x845c('0x36')](db['MailServerOut'][_0x845c('0x2f')]);_0x4fec17[_0x845c('0x35')]=_['keys'](_0x242a3a[_0x845c('0x35')]);_0x4fec17[_0x845c('0x37')]=_[_0x845c('0x38')](_0x4fec17[_0x845c('0x33')],_0x4fec17['query']);_0x9ce42a['attributes']=_[_0x845c('0x38')](_0x4fec17['model'],qs[_0x845c('0x39')](_0x242a3a[_0x845c('0x35')]['fields']));_0x9ce42a[_0x845c('0x3a')]=_0x9ce42a[_0x845c('0x3a')][_0x845c('0x3b')]?_0x9ce42a[_0x845c('0x3a')]:_0x4fec17[_0x845c('0x33')];if(_0x242a3a[_0x845c('0x35')][_0x845c('0x44')]){_0x9ce42a['include']=[{'all':!![]}];}_0x9ce42a=_[_0x845c('0x42')]({},_0x9ce42a,_0x242a3a[_0x845c('0x4b')]);return db['MailServerOut']['find'](_0x9ce42a)[_0x845c('0x28')](handleEntityNotFound(_0x246d47,null))[_0x845c('0x28')](respondWithResult(_0x246d47,null))[_0x845c('0x48')](handleError(_0x246d47,null));};exports[_0x845c('0x4c')]=function(_0x22dfa4,_0x156f12){return db[_0x845c('0x2e')][_0x845c('0x4c')](_0x22dfa4[_0x845c('0x4d')],{})['then'](respondWithResult(_0x156f12,0xc9))[_0x845c('0x48')](handleError(_0x156f12,null));};exports['update']=function(_0x3f3036,_0x3bd155){if(_0x3f3036['body']['id']){delete _0x3f3036[_0x845c('0x4d')]['id'];}return db['MailServerOut'][_0x845c('0x4e')]({'where':{'id':_0x3f3036[_0x845c('0x4a')]['id']}})[_0x845c('0x28')](handleEntityNotFound(_0x3bd155,null))['then'](saveUpdates(_0x3f3036['body'],null))[_0x845c('0x28')](respondWithResult(_0x3bd155,null))[_0x845c('0x48')](handleError(_0x3bd155,null));};exports[_0x845c('0x29')]=function(_0x14e387,_0x3e2b01){return db['MailServerOut'][_0x845c('0x4e')]({'where':{'id':_0x14e387[_0x845c('0x4a')]['id']}})[_0x845c('0x28')](handleEntityNotFound(_0x3e2b01,null))[_0x845c('0x28')](removeEntity(_0x3e2b01,null))['catch'](handleError(_0x3e2b01,null));}; \ No newline at end of file +var _0x6fdf=['count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','MailServerOut','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','length','find','create','body','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined'];(function(_0x5b7250,_0x13aa90){var _0x327181=function(_0x32daa3){while(--_0x32daa3){_0x5b7250['push'](_0x5b7250['shift']());}};_0x327181(++_0x13aa90);}(_0x6fdf,0x1b0));var _0xf6fd=function(_0x37e5ab,_0x2a45b2){_0x37e5ab=_0x37e5ab-0x0;var _0x25f15b=_0x6fdf[_0x37e5ab];return _0x25f15b;};'use strict';var emlformat=require(_0xf6fd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf6fd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf6fd('0x2'));var moment=require(_0xf6fd('0x3'));var BPromise=require(_0xf6fd('0x4'));var Mustache=require('mustache');var util=require(_0xf6fd('0x5'));var path=require(_0xf6fd('0x6'));var sox=require(_0xf6fd('0x7'));var csv=require(_0xf6fd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf6fd('0x9'));var _=require('lodash');var squel=require(_0xf6fd('0xa'));var crypto=require(_0xf6fd('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf6fd('0xc'));var toCsv=require('to-csv');var querystring=require(_0xf6fd('0xd'));var Papa=require('papaparse');var Redis=require(_0xf6fd('0xe'));var authService=require(_0xf6fd('0xf'));var qs=require(_0xf6fd('0x10'));var as=require(_0xf6fd('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf6fd('0x12'))(_0xf6fd('0x13'));var utils=require(_0xf6fd('0x14'));var config=require(_0xf6fd('0x15'));var licenseUtil=require(_0xf6fd('0x16'));var db=require(_0xf6fd('0x17'))['db'];function respondWithStatusCode(_0x285f32,_0x56788a){_0x56788a=_0x56788a||0xcc;return function(_0x96b25b){if(_0x96b25b){return _0x285f32['sendStatus'](_0x56788a);}return _0x285f32[_0xf6fd('0x18')](_0x56788a)[_0xf6fd('0x19')]();};}function respondWithResult(_0x23bc51,_0x238253){_0x238253=_0x238253||0xc8;return function(_0xb24a5d){if(_0xb24a5d){return _0x23bc51[_0xf6fd('0x18')](_0x238253)[_0xf6fd('0x1a')](_0xb24a5d);}};}function respondWithFilteredResult(_0x316ed6,_0x328175){return function(_0x4ac802){if(_0x4ac802){var _0x1b5351=typeof _0x328175[_0xf6fd('0x1b')]==='undefined'&&typeof _0x328175[_0xf6fd('0x1c')]===_0xf6fd('0x1d');var _0x48bd49=_0x4ac802['count'];var _0x279567=_0x1b5351?0x0:_0x328175['offset'];var _0x358d02=_0x1b5351?_0x4ac802[_0xf6fd('0x1e')]:_0x328175['offset']+_0x328175[_0xf6fd('0x1c')];var _0x5dd0e8;if(_0x358d02>=_0x48bd49){_0x358d02=_0x48bd49;_0x5dd0e8=0xc8;}else{_0x5dd0e8=0xce;}_0x316ed6[_0xf6fd('0x18')](_0x5dd0e8);return _0x316ed6[_0xf6fd('0x1f')](_0xf6fd('0x20'),_0x279567+'-'+_0x358d02+'/'+_0x48bd49)['json'](_0x4ac802);}return null;};}function patchUpdates(_0x122e37){return function(_0x1469b5){try{jsonpatch[_0xf6fd('0x21')](_0x1469b5,_0x122e37,!![]);}catch(_0x4e89b4){return BPromise[_0xf6fd('0x22')](_0x4e89b4);}return _0x1469b5[_0xf6fd('0x23')]();};}function saveUpdates(_0x1d96f6,_0xb1726){return function(_0x3d0670){if(_0x3d0670){return _0x3d0670[_0xf6fd('0x24')](_0x1d96f6)[_0xf6fd('0x25')](function(_0x25d494){return _0x25d494;});}return null;};}function removeEntity(_0x30e766,_0xc12018){return function(_0x1df792){if(_0x1df792){return _0x1df792[_0xf6fd('0x26')]()['then'](function(){_0x30e766[_0xf6fd('0x18')](0xcc)[_0xf6fd('0x19')]();});}};}function handleEntityNotFound(_0x5790bf,_0x4bd413){return function(_0x3490ad){if(!_0x3490ad){_0x5790bf[_0xf6fd('0x27')](0x194);}return _0x3490ad;};}function handleError(_0x51b14a,_0x175ba5){_0x175ba5=_0x175ba5||0x1f4;return function(_0x30dfe2){logger[_0xf6fd('0x28')](_0x30dfe2[_0xf6fd('0x29')]);if(_0x30dfe2[_0xf6fd('0x2a')]){delete _0x30dfe2[_0xf6fd('0x2a')];}_0x51b14a[_0xf6fd('0x18')](_0x175ba5)[_0xf6fd('0x2b')](_0x30dfe2);};}exports[_0xf6fd('0x2c')]=function(_0x5c15ca,_0x1802e6){var _0x5b1b78={},_0x1e99cc={},_0x40d216={'count':0x0,'rows':[]};var _0x2b8b7d=_[_0xf6fd('0x2d')](db[_0xf6fd('0x2e')][_0xf6fd('0x2f')],function(_0x222a07){return{'name':_0x222a07[_0xf6fd('0x30')],'type':_0x222a07[_0xf6fd('0x31')][_0xf6fd('0x32')]};});_0x1e99cc['model']=_[_0xf6fd('0x2d')](_0x2b8b7d,_0xf6fd('0x2a'));_0x1e99cc[_0xf6fd('0x33')]=_['keys'](_0x5c15ca['query']);_0x1e99cc['filters']=_[_0xf6fd('0x34')](_0x1e99cc[_0xf6fd('0x35')],_0x1e99cc[_0xf6fd('0x33')]);_0x5b1b78[_0xf6fd('0x36')]=_['intersection'](_0x1e99cc['model'],qs[_0xf6fd('0x37')](_0x5c15ca['query']['fields']));_0x5b1b78[_0xf6fd('0x36')]=_0x5b1b78['attributes']['length']?_0x5b1b78[_0xf6fd('0x36')]:_0x1e99cc[_0xf6fd('0x35')];if(!_0x5c15ca[_0xf6fd('0x33')][_0xf6fd('0x38')](_0xf6fd('0x39'))){_0x5b1b78['limit']=qs[_0xf6fd('0x1c')](_0x5c15ca[_0xf6fd('0x33')][_0xf6fd('0x1c')]);_0x5b1b78[_0xf6fd('0x1b')]=qs[_0xf6fd('0x1b')](_0x5c15ca[_0xf6fd('0x33')][_0xf6fd('0x1b')]);}_0x5b1b78[_0xf6fd('0x3a')]=qs['sort'](_0x5c15ca[_0xf6fd('0x33')]['sort']);_0x5b1b78[_0xf6fd('0x3b')]=qs[_0xf6fd('0x3c')](_[_0xf6fd('0x3d')](_0x5c15ca[_0xf6fd('0x33')],_0x1e99cc[_0xf6fd('0x3c')]),_0x2b8b7d);if(_0x5c15ca[_0xf6fd('0x33')][_0xf6fd('0x3e')]){_0x5b1b78['where']=_[_0xf6fd('0x3f')](_0x5b1b78[_0xf6fd('0x3b')],{'$or':_[_0xf6fd('0x2d')](_0x2b8b7d,function(_0x3ffbe5){if(_0x3ffbe5['type']!==_0xf6fd('0x40')){var _0x9a092e={};_0x9a092e[_0x3ffbe5[_0xf6fd('0x2a')]]={'$like':'%'+_0x5c15ca[_0xf6fd('0x33')][_0xf6fd('0x3e')]+'%'};return _0x9a092e;}})});}_0x5b1b78=_['merge']({},_0x5b1b78,_0x5c15ca[_0xf6fd('0x41')]);var _0x3d84bd={'where':_0x5b1b78[_0xf6fd('0x3b')]};return db['MailServerOut'][_0xf6fd('0x1e')](_0x3d84bd)[_0xf6fd('0x25')](function(_0x4219a2){_0x40d216[_0xf6fd('0x1e')]=_0x4219a2;if(_0x5c15ca[_0xf6fd('0x33')][_0xf6fd('0x42')]){_0x5b1b78[_0xf6fd('0x43')]=[{'all':!![]}];}return db[_0xf6fd('0x2e')]['findAll'](_0x5b1b78);})[_0xf6fd('0x25')](function(_0x6f080){_0x40d216[_0xf6fd('0x44')]=_0x6f080;return _0x40d216;})[_0xf6fd('0x25')](respondWithFilteredResult(_0x1802e6,_0x5b1b78))[_0xf6fd('0x45')](handleError(_0x1802e6,null));};exports[_0xf6fd('0x46')]=function(_0x20492e,_0x552482){var _0x2c356a={'raw':!![],'where':{'id':_0x20492e[_0xf6fd('0x47')]['id']}},_0x2bd751={};_0x2bd751[_0xf6fd('0x35')]=_[_0xf6fd('0x48')](db[_0xf6fd('0x2e')][_0xf6fd('0x2f')]);_0x2bd751[_0xf6fd('0x33')]=_[_0xf6fd('0x48')](_0x20492e['query']);_0x2bd751[_0xf6fd('0x3c')]=_[_0xf6fd('0x34')](_0x2bd751[_0xf6fd('0x35')],_0x2bd751[_0xf6fd('0x33')]);_0x2c356a[_0xf6fd('0x36')]=_[_0xf6fd('0x34')](_0x2bd751[_0xf6fd('0x35')],qs[_0xf6fd('0x37')](_0x20492e['query'][_0xf6fd('0x37')]));_0x2c356a[_0xf6fd('0x36')]=_0x2c356a['attributes'][_0xf6fd('0x49')]?_0x2c356a[_0xf6fd('0x36')]:_0x2bd751[_0xf6fd('0x35')];if(_0x20492e[_0xf6fd('0x33')][_0xf6fd('0x42')]){_0x2c356a[_0xf6fd('0x43')]=[{'all':!![]}];}_0x2c356a=_[_0xf6fd('0x3f')]({},_0x2c356a,_0x20492e[_0xf6fd('0x41')]);return db['MailServerOut'][_0xf6fd('0x4a')](_0x2c356a)[_0xf6fd('0x25')](handleEntityNotFound(_0x552482,null))[_0xf6fd('0x25')](respondWithResult(_0x552482,null))[_0xf6fd('0x45')](handleError(_0x552482,null));};exports[_0xf6fd('0x4b')]=function(_0x3c68a4,_0x49bdad){return db[_0xf6fd('0x2e')][_0xf6fd('0x4b')](_0x3c68a4[_0xf6fd('0x4c')],{})[_0xf6fd('0x25')](respondWithResult(_0x49bdad,0xc9))[_0xf6fd('0x45')](handleError(_0x49bdad,null));};exports[_0xf6fd('0x24')]=function(_0x3116c5,_0x42ca22){if(_0x3116c5[_0xf6fd('0x4c')]['id']){delete _0x3116c5[_0xf6fd('0x4c')]['id'];}return db['MailServerOut'][_0xf6fd('0x4a')]({'where':{'id':_0x3116c5[_0xf6fd('0x47')]['id']}})['then'](handleEntityNotFound(_0x42ca22,null))['then'](saveUpdates(_0x3116c5[_0xf6fd('0x4c')],null))[_0xf6fd('0x25')](respondWithResult(_0x42ca22,null))[_0xf6fd('0x45')](handleError(_0x42ca22,null));};exports['destroy']=function(_0x5ca3fd,_0x22d045){return db[_0xf6fd('0x2e')]['find']({'where':{'id':_0x5ca3fd['params']['id']}})[_0xf6fd('0x25')](handleEntityNotFound(_0x22d045,null))[_0xf6fd('0x25')](removeEntity(_0x22d045,null))[_0xf6fd('0x45')](handleError(_0x22d045,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 5b31b89..465c9f5 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 _0x6b6f=['rimraf','../../config/environment','./mailServerOut.attributes','MailServerOut','mail_servers_out','lodash','util','moment'];(function(_0x23c7dd,_0x29928e){var _0x42430e=function(_0x803938){while(--_0x803938){_0x23c7dd['push'](_0x23c7dd['shift']());}};_0x42430e(++_0x29928e);}(_0x6b6f,0x165));var _0xf6b6=function(_0x3c31a2,_0xd7a9a9){_0x3c31a2=_0x3c31a2-0x0;var _0x26afe9=_0x6b6f[_0x3c31a2];return _0x26afe9;};'use strict';var _=require(_0xf6b6('0x0'));var util=require(_0xf6b6('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf6b6('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf6b6('0x3'));var config=require(_0xf6b6('0x4'));var attributes=require(_0xf6b6('0x5'));module['exports']=function(_0x4705f0,_0x310a8f){return _0x4705f0['define'](_0xf6b6('0x6'),attributes,{'tableName':_0xf6b6('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8d6a=['path','rimraf','../../config/environment','./mailServerOut.attributes','exports','MailServerOut','mail_servers_out','lodash','util','../../config/logger','api','moment'];(function(_0x2f9263,_0x7c1100){var _0x5f1d47=function(_0xde84a2){while(--_0xde84a2){_0x2f9263['push'](_0x2f9263['shift']());}};_0x5f1d47(++_0x7c1100);}(_0x8d6a,0x193));var _0xa8d6=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x8d6a[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0xa8d6('0x0'));var util=require(_0xa8d6('0x1'));var logger=require(_0xa8d6('0x2'))(_0xa8d6('0x3'));var moment=require(_0xa8d6('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa8d6('0x5'));var rimraf=require(_0xa8d6('0x6'));var config=require(_0xa8d6('0x7'));var attributes=require(_0xa8d6('0x8'));module[_0xa8d6('0x9')]=function(_0x286876,_0x39da63){return _0x286876['define'](_0xa8d6('0xa'),attributes,{'tableName':_0xa8d6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index cbbe57a..d08c89e 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x431a10,_0xa5f1f4){var _0x419b8e=function(_0x14e871){while(--_0x14e871){_0x431a10['push'](_0x431a10['shift']());}};_0x419b8e(++_0xa5f1f4);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xc4aa[_0x46698a];return _0x356db0;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file +var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x5da00c,_0x1f1e0f){var _0x379332=function(_0x4ebc04){while(--_0x4ebc04){_0x5da00c['push'](_0x5da00c['shift']());}};_0x379332(++_0x1f1e0f);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xc4aa[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index a10b0da..7a6215d 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 _0x95c4=['../../components/auth/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x295653,_0x56d486){var _0x10bbfc=function(_0x26a084){while(--_0x26a084){_0x295653['push'](_0x295653['shift']());}};_0x10bbfc(++_0x56d486);}(_0x95c4,0x1de));var _0x495c=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x95c4[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x495c('0x0'));var util=require('util');var path=require(_0x495c('0x1'));var timeout=require(_0x495c('0x2'));var express=require(_0x495c('0x3'));var router=express[_0x495c('0x4')]();var fs_extra=require(_0x495c('0x5'));var auth=require(_0x495c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x495c('0x7'));var controller=require(_0x495c('0x8'));router[_0x495c('0x9')]('/',auth[_0x495c('0xa')](),controller[_0x495c('0xb')]);router[_0x495c('0x9')](_0x495c('0xc'),auth['isAuthenticated'](),controller[_0x495c('0xd')]);router['get'](_0x495c('0xe'),auth[_0x495c('0xa')](),controller[_0x495c('0xf')]);router[_0x495c('0x10')]('/',auth['isAuthenticated'](),controller[_0x495c('0x11')]);router[_0x495c('0x12')](_0x495c('0xe'),auth[_0x495c('0xa')](),controller[_0x495c('0x13')]);router[_0x495c('0x14')]('/:id',auth[_0x495c('0xa')](),controller['destroy']);module[_0x495c('0x15')]=router; \ No newline at end of file +var _0x8d97=['/describe','isAuthenticated','/:id','show','post','create','put','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','index'];(function(_0x529d93,_0x18017e){var _0x302538=function(_0x261dd0){while(--_0x261dd0){_0x529d93['push'](_0x529d93['shift']());}};_0x302538(++_0x18017e);}(_0x8d97,0x1ee));var _0x78d9=function(_0x171913,_0x14de92){_0x171913=_0x171913-0x0;var _0x58f132=_0x8d97[_0x171913];return _0x58f132;};'use strict';var multer=require(_0x78d9('0x0'));var util=require(_0x78d9('0x1'));var path=require(_0x78d9('0x2'));var timeout=require('connect-timeout');var express=require(_0x78d9('0x3'));var router=express[_0x78d9('0x4')]();var fs_extra=require(_0x78d9('0x5'));var auth=require(_0x78d9('0x6'));var interaction=require(_0x78d9('0x7'));var config=require(_0x78d9('0x8'));var controller=require(_0x78d9('0x9'));router[_0x78d9('0xa')]('/',auth['isAuthenticated'](),controller[_0x78d9('0xb')]);router[_0x78d9('0xa')](_0x78d9('0xc'),auth[_0x78d9('0xd')](),controller['describe']);router[_0x78d9('0xa')](_0x78d9('0xe'),auth[_0x78d9('0xd')](),controller[_0x78d9('0xf')]);router[_0x78d9('0x10')]('/',auth[_0x78d9('0xd')](),controller[_0x78d9('0x11')]);router[_0x78d9('0x12')](_0x78d9('0xe'),auth[_0x78d9('0xd')](),controller[_0x78d9('0x13')]);router[_0x78d9('0x14')](_0x78d9('0xe'),auth[_0x78d9('0xd')](),controller['destroy']);module[_0x78d9('0x15')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index f1bf44c..9d4a906 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 _0xfc46=['name','sequelize','STRING'];(function(_0x195fb0,_0xec4e63){var _0xd57194=function(_0x5819ed){while(--_0x5819ed){_0x195fb0['push'](_0x195fb0['shift']());}};_0xd57194(++_0xec4e63);}(_0xfc46,0x9a));var _0x6fc4=function(_0x5a4b42,_0x2b9c18){_0x5a4b42=_0x5a4b42-0x0;var _0x5e81d6=_0xfc46[_0x5a4b42];return _0x5e81d6;};'use strict';var Sequelize=require(_0x6fc4('0x0'));module['exports']={'name':{'type':Sequelize[_0x6fc4('0x1')],'unique':_0x6fc4('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6fc4('0x1')]}}; \ No newline at end of file +var _0xef17=['STRING','name','sequelize','exports'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xef17,0x136));var _0x7ef1=function(_0x4f8763,_0x4cb6b2){_0x4f8763=_0x4f8763-0x0;var _0x1cd4ee=_0xef17[_0x4f8763];return _0x1cd4ee;};'use strict';var Sequelize=require(_0x7ef1('0x0'));module[_0x7ef1('0x1')]={'name':{'type':Sequelize[_0x7ef1('0x2')],'unique':_0x7ef1('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7ef1('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 79f3757..787a6fb 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 _0xf6b3=['hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','catch','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','name','send','index','map','MailSubstatus','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length'];(function(_0x51850e,_0x4d4fb5){var _0x5d846e=function(_0x5dabeb){while(--_0x5dabeb){_0x51850e['push'](_0x51850e['shift']());}};_0x5d846e(++_0x4d4fb5);}(_0xf6b3,0xfe));var _0x3f6b=function(_0x480385,_0x4e2ad1){_0x480385=_0x480385-0x0;var _0x3170ae=_0xf6b3[_0x480385];return _0x3170ae;};'use strict';var emlformat=require(_0x3f6b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3f6b('0x1'));var jsonpatch=require(_0x3f6b('0x2'));var rp=require(_0x3f6b('0x3'));var moment=require(_0x3f6b('0x4'));var BPromise=require(_0x3f6b('0x5'));var Mustache=require(_0x3f6b('0x6'));var util=require(_0x3f6b('0x7'));var path=require(_0x3f6b('0x8'));var sox=require(_0x3f6b('0x9'));var csv=require(_0x3f6b('0xa'));var ejs=require(_0x3f6b('0xb'));var fs=require('fs');var fs_extra=require(_0x3f6b('0xc'));var _=require('lodash');var squel=require(_0x3f6b('0xd'));var crypto=require(_0x3f6b('0xe'));var jsforce=require(_0x3f6b('0xf'));var deskjs=require(_0x3f6b('0x10'));var toCsv=require(_0x3f6b('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3f6b('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3f6b('0x12'));var as=require(_0x3f6b('0x13'));var hardwareService=require(_0x3f6b('0x14'));var logger=require(_0x3f6b('0x15'))(_0x3f6b('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3f6b('0x17'));var db=require(_0x3f6b('0x18'))['db'];function respondWithStatusCode(_0x2fe49e,_0x57eff4){_0x57eff4=_0x57eff4||0xcc;return function(_0x4bc2a3){if(_0x4bc2a3){return _0x2fe49e[_0x3f6b('0x19')](_0x57eff4);}return _0x2fe49e[_0x3f6b('0x1a')](_0x57eff4)[_0x3f6b('0x1b')]();};}function respondWithResult(_0x4a256d,_0xb718ca){_0xb718ca=_0xb718ca||0xc8;return function(_0x30c62c){if(_0x30c62c){return _0x4a256d['status'](_0xb718ca)[_0x3f6b('0x1c')](_0x30c62c);}};}function respondWithFilteredResult(_0x4d55c8,_0x3b2478){return function(_0xab5004){if(_0xab5004){var _0x5c1887=typeof _0x3b2478[_0x3f6b('0x1d')]===_0x3f6b('0x1e')&&typeof _0x3b2478[_0x3f6b('0x1f')]==='undefined';var _0x565bb1=_0xab5004['count'];var _0x1559ad=_0x5c1887?0x0:_0x3b2478['offset'];var _0x49399f=_0x5c1887?_0xab5004[_0x3f6b('0x20')]:_0x3b2478[_0x3f6b('0x1d')]+_0x3b2478[_0x3f6b('0x1f')];var _0x5b73ae;if(_0x49399f>=_0x565bb1){_0x49399f=_0x565bb1;_0x5b73ae=0xc8;}else{_0x5b73ae=0xce;}_0x4d55c8[_0x3f6b('0x1a')](_0x5b73ae);return _0x4d55c8[_0x3f6b('0x21')](_0x3f6b('0x22'),_0x1559ad+'-'+_0x49399f+'/'+_0x565bb1)['json'](_0xab5004);}return null;};}function patchUpdates(_0xbdb2c5){return function(_0x24c491){try{jsonpatch[_0x3f6b('0x23')](_0x24c491,_0xbdb2c5,!![]);}catch(_0x2e570b){return BPromise[_0x3f6b('0x24')](_0x2e570b);}return _0x24c491[_0x3f6b('0x25')]();};}function saveUpdates(_0x13bd74,_0x275fe7){return function(_0x227d23){if(_0x227d23){return _0x227d23[_0x3f6b('0x26')](_0x13bd74)['then'](function(_0x429b08){return _0x429b08;});}return null;};}function removeEntity(_0xf27bb3,_0x1f9454){return function(_0x226746){if(_0x226746){return _0x226746[_0x3f6b('0x27')]()[_0x3f6b('0x28')](function(){_0xf27bb3[_0x3f6b('0x1a')](0xcc)[_0x3f6b('0x1b')]();});}};}function handleEntityNotFound(_0x237f93,_0x9ca2fd){return function(_0x33af8b){if(!_0x33af8b){_0x237f93[_0x3f6b('0x19')](0x194);}return _0x33af8b;};}function handleError(_0x53c00f,_0x28f7f9){_0x28f7f9=_0x28f7f9||0x1f4;return function(_0x31d595){logger['error'](_0x31d595['stack']);if(_0x31d595['name']){delete _0x31d595[_0x3f6b('0x29')];}_0x53c00f[_0x3f6b('0x1a')](_0x28f7f9)[_0x3f6b('0x2a')](_0x31d595);};}exports[_0x3f6b('0x2b')]=function(_0x18f199,_0x5bb848){var _0x3faf42={},_0x51ba5b={},_0x479c9c={'count':0x0,'rows':[]};var _0xff001d=_[_0x3f6b('0x2c')](db[_0x3f6b('0x2d')][_0x3f6b('0x2e')],function(_0xb41610){return{'name':_0xb41610[_0x3f6b('0x2f')],'type':_0xb41610[_0x3f6b('0x30')][_0x3f6b('0x31')]};});_0x51ba5b[_0x3f6b('0x32')]=_['map'](_0xff001d,_0x3f6b('0x29'));_0x51ba5b['query']=_[_0x3f6b('0x33')](_0x18f199[_0x3f6b('0x34')]);_0x51ba5b[_0x3f6b('0x35')]=_[_0x3f6b('0x36')](_0x51ba5b[_0x3f6b('0x32')],_0x51ba5b['query']);_0x3faf42[_0x3f6b('0x37')]=_[_0x3f6b('0x36')](_0x51ba5b[_0x3f6b('0x32')],qs[_0x3f6b('0x38')](_0x18f199[_0x3f6b('0x34')]['fields']));_0x3faf42[_0x3f6b('0x37')]=_0x3faf42[_0x3f6b('0x37')][_0x3f6b('0x39')]?_0x3faf42[_0x3f6b('0x37')]:_0x51ba5b[_0x3f6b('0x32')];if(!_0x18f199[_0x3f6b('0x34')][_0x3f6b('0x3a')]('nolimit')){_0x3faf42[_0x3f6b('0x1f')]=qs[_0x3f6b('0x1f')](_0x18f199[_0x3f6b('0x34')][_0x3f6b('0x1f')]);_0x3faf42[_0x3f6b('0x1d')]=qs[_0x3f6b('0x1d')](_0x18f199[_0x3f6b('0x34')][_0x3f6b('0x1d')]);}_0x3faf42[_0x3f6b('0x3b')]=qs['sort'](_0x18f199[_0x3f6b('0x34')][_0x3f6b('0x3c')]);_0x3faf42[_0x3f6b('0x3d')]=qs[_0x3f6b('0x35')](_[_0x3f6b('0x3e')](_0x18f199[_0x3f6b('0x34')],_0x51ba5b[_0x3f6b('0x35')]),_0xff001d);if(_0x18f199[_0x3f6b('0x34')][_0x3f6b('0x3f')]){_0x3faf42[_0x3f6b('0x3d')]=_[_0x3f6b('0x40')](_0x3faf42[_0x3f6b('0x3d')],{'$or':_[_0x3f6b('0x2c')](_0xff001d,function(_0x34585c){if(_0x34585c[_0x3f6b('0x30')]!==_0x3f6b('0x41')){var _0x522584={};_0x522584[_0x34585c[_0x3f6b('0x29')]]={'$like':'%'+_0x18f199[_0x3f6b('0x34')][_0x3f6b('0x3f')]+'%'};return _0x522584;}})});}_0x3faf42=_[_0x3f6b('0x40')]({},_0x3faf42,_0x18f199[_0x3f6b('0x42')]);var _0x43b970={'where':_0x3faf42[_0x3f6b('0x3d')]};return db[_0x3f6b('0x2d')][_0x3f6b('0x20')](_0x43b970)[_0x3f6b('0x28')](function(_0x10c4cc){_0x479c9c[_0x3f6b('0x20')]=_0x10c4cc;if(_0x18f199[_0x3f6b('0x34')][_0x3f6b('0x43')]){_0x3faf42[_0x3f6b('0x44')]=[{'all':!![]}];}return db['MailSubstatus'][_0x3f6b('0x45')](_0x3faf42);})[_0x3f6b('0x28')](function(_0x3bc903){_0x479c9c[_0x3f6b('0x46')]=_0x3bc903;return _0x479c9c;})['then'](respondWithFilteredResult(_0x5bb848,_0x3faf42))['catch'](handleError(_0x5bb848,null));};exports[_0x3f6b('0x47')]=function(_0x50e764,_0x2784b1){var _0x39524f={'raw':!![],'where':{'id':_0x50e764['params']['id']}},_0x2e5b36={};_0x2e5b36['model']=_[_0x3f6b('0x33')](db[_0x3f6b('0x2d')][_0x3f6b('0x2e')]);_0x2e5b36[_0x3f6b('0x34')]=_['keys'](_0x50e764[_0x3f6b('0x34')]);_0x2e5b36[_0x3f6b('0x35')]=_[_0x3f6b('0x36')](_0x2e5b36[_0x3f6b('0x32')],_0x2e5b36['query']);_0x39524f[_0x3f6b('0x37')]=_[_0x3f6b('0x36')](_0x2e5b36[_0x3f6b('0x32')],qs[_0x3f6b('0x38')](_0x50e764[_0x3f6b('0x34')][_0x3f6b('0x38')]));_0x39524f[_0x3f6b('0x37')]=_0x39524f[_0x3f6b('0x37')][_0x3f6b('0x39')]?_0x39524f[_0x3f6b('0x37')]:_0x2e5b36[_0x3f6b('0x32')];if(_0x50e764[_0x3f6b('0x34')][_0x3f6b('0x43')]){_0x39524f[_0x3f6b('0x44')]=[{'all':!![]}];}_0x39524f=_[_0x3f6b('0x40')]({},_0x39524f,_0x50e764[_0x3f6b('0x42')]);return db[_0x3f6b('0x2d')][_0x3f6b('0x48')](_0x39524f)[_0x3f6b('0x28')](handleEntityNotFound(_0x2784b1,null))[_0x3f6b('0x28')](respondWithResult(_0x2784b1,null))[_0x3f6b('0x49')](handleError(_0x2784b1,null));};exports['create']=function(_0x450974,_0x50f6ee){return db['MailSubstatus'][_0x3f6b('0x4a')](_0x450974['body'],{})[_0x3f6b('0x28')](respondWithResult(_0x50f6ee,0xc9))['catch'](handleError(_0x50f6ee,null));};exports[_0x3f6b('0x26')]=function(_0x11c603,_0x54a237){if(_0x11c603[_0x3f6b('0x4b')]['id']){delete _0x11c603[_0x3f6b('0x4b')]['id'];}return db['MailSubstatus'][_0x3f6b('0x48')]({'where':{'id':_0x11c603[_0x3f6b('0x4c')]['id']}})[_0x3f6b('0x28')](handleEntityNotFound(_0x54a237,null))[_0x3f6b('0x28')](saveUpdates(_0x11c603[_0x3f6b('0x4b')],null))['then'](respondWithResult(_0x54a237,null))[_0x3f6b('0x49')](handleError(_0x54a237,null));};exports[_0x3f6b('0x27')]=function(_0x5426ae,_0x52cd95){return db['MailSubstatus']['find']({'where':{'id':_0x5426ae[_0x3f6b('0x4c')]['id']}})['then'](handleEntityNotFound(_0x52cd95,null))[_0x3f6b('0x28')](removeEntity(_0x52cd95,null))[_0x3f6b('0x49')](handleError(_0x52cd95,null));};exports[_0x3f6b('0x4d')]=function(_0x1f4501,_0x4b0236){return db[_0x3f6b('0x2d')]['describe']()[_0x3f6b('0x28')](respondWithResult(_0x4b0236,null))[_0x3f6b('0x49')](handleError(_0x4b0236,null));}; \ No newline at end of file +var _0x2a52=['params','find','catch','create','body','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','limit','undefined','count','offset','status','set','reject','save','update','then','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','sort','where','filters','pick','VIRTUAL','merge','options','includeAll','findAll','rows','show'];(function(_0x49e43d,_0x4a59e0){var _0x45135a=function(_0x384f85){while(--_0x384f85){_0x49e43d['push'](_0x49e43d['shift']());}};_0x45135a(++_0x4a59e0);}(_0x2a52,0x137));var _0x22a5=function(_0x3d0e66,_0x2d7452){_0x3d0e66=_0x3d0e66-0x0;var _0x9c2569=_0x2a52[_0x3d0e66];return _0x9c2569;};'use strict';var emlformat=require(_0x22a5('0x0'));var rimraf=require(_0x22a5('0x1'));var zipdir=require(_0x22a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x22a5('0x3'));var moment=require(_0x22a5('0x4'));var BPromise=require(_0x22a5('0x5'));var Mustache=require(_0x22a5('0x6'));var util=require(_0x22a5('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x22a5('0x8'));var _=require(_0x22a5('0x9'));var squel=require(_0x22a5('0xa'));var crypto=require(_0x22a5('0xb'));var jsforce=require(_0x22a5('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x22a5('0xd'));var querystring=require(_0x22a5('0xe'));var Papa=require(_0x22a5('0xf'));var Redis=require(_0x22a5('0x10'));var authService=require(_0x22a5('0x11'));var qs=require(_0x22a5('0x12'));var as=require(_0x22a5('0x13'));var hardwareService=require(_0x22a5('0x14'));var logger=require(_0x22a5('0x15'))(_0x22a5('0x16'));var utils=require(_0x22a5('0x17'));var config=require(_0x22a5('0x18'));var licenseUtil=require(_0x22a5('0x19'));var db=require(_0x22a5('0x1a'))['db'];function respondWithStatusCode(_0x538182,_0x5106df){_0x5106df=_0x5106df||0xcc;return function(_0x2d7e8c){if(_0x2d7e8c){return _0x538182[_0x22a5('0x1b')](_0x5106df);}return _0x538182['status'](_0x5106df)[_0x22a5('0x1c')]();};}function respondWithResult(_0x3a0942,_0x406b3a){_0x406b3a=_0x406b3a||0xc8;return function(_0x326dbc){if(_0x326dbc){return _0x3a0942['status'](_0x406b3a)[_0x22a5('0x1d')](_0x326dbc);}};}function respondWithFilteredResult(_0xd7a265,_0x59a4fe){return function(_0x295ae9){if(_0x295ae9){var _0xa320a1=typeof _0x59a4fe['offset']==='undefined'&&typeof _0x59a4fe[_0x22a5('0x1e')]===_0x22a5('0x1f');var _0x24fd6c=_0x295ae9[_0x22a5('0x20')];var _0xcd6c71=_0xa320a1?0x0:_0x59a4fe[_0x22a5('0x21')];var _0x5baf23=_0xa320a1?_0x295ae9['count']:_0x59a4fe[_0x22a5('0x21')]+_0x59a4fe[_0x22a5('0x1e')];var _0x2219d2;if(_0x5baf23>=_0x24fd6c){_0x5baf23=_0x24fd6c;_0x2219d2=0xc8;}else{_0x2219d2=0xce;}_0xd7a265[_0x22a5('0x22')](_0x2219d2);return _0xd7a265[_0x22a5('0x23')]('Content-Range',_0xcd6c71+'-'+_0x5baf23+'/'+_0x24fd6c)[_0x22a5('0x1d')](_0x295ae9);}return null;};}function patchUpdates(_0x135d14){return function(_0x4eda65){try{jsonpatch['apply'](_0x4eda65,_0x135d14,!![]);}catch(_0x1a3032){return BPromise[_0x22a5('0x24')](_0x1a3032);}return _0x4eda65[_0x22a5('0x25')]();};}function saveUpdates(_0x1ddcc7,_0x255f83){return function(_0x5dfa3d){if(_0x5dfa3d){return _0x5dfa3d[_0x22a5('0x26')](_0x1ddcc7)[_0x22a5('0x27')](function(_0x4e1e2d){return _0x4e1e2d;});}return null;};}function removeEntity(_0x15d1ae,_0x32d0f6){return function(_0x74e0b0){if(_0x74e0b0){return _0x74e0b0['destroy']()[_0x22a5('0x27')](function(){_0x15d1ae['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x48676e,_0x3e8a5a){return function(_0x370f46){if(!_0x370f46){_0x48676e[_0x22a5('0x1b')](0x194);}return _0x370f46;};}function handleError(_0x56f1d2,_0x29ce28){_0x29ce28=_0x29ce28||0x1f4;return function(_0x43dce9){logger['error'](_0x43dce9[_0x22a5('0x28')]);if(_0x43dce9['name']){delete _0x43dce9[_0x22a5('0x29')];}_0x56f1d2[_0x22a5('0x22')](_0x29ce28)[_0x22a5('0x2a')](_0x43dce9);};}exports[_0x22a5('0x2b')]=function(_0x2ab24d,_0x5c2f35){var _0x32afed={},_0x3e4626={},_0x46fed1={'count':0x0,'rows':[]};var _0x33aa36=_[_0x22a5('0x2c')](db[_0x22a5('0x2d')][_0x22a5('0x2e')],function(_0x3abaaf){return{'name':_0x3abaaf[_0x22a5('0x2f')],'type':_0x3abaaf[_0x22a5('0x30')][_0x22a5('0x31')]};});_0x3e4626['model']=_[_0x22a5('0x2c')](_0x33aa36,_0x22a5('0x29'));_0x3e4626[_0x22a5('0x32')]=_[_0x22a5('0x33')](_0x2ab24d[_0x22a5('0x32')]);_0x3e4626['filters']=_[_0x22a5('0x34')](_0x3e4626[_0x22a5('0x35')],_0x3e4626[_0x22a5('0x32')]);_0x32afed[_0x22a5('0x36')]=_[_0x22a5('0x34')](_0x3e4626['model'],qs[_0x22a5('0x37')](_0x2ab24d[_0x22a5('0x32')][_0x22a5('0x37')]));_0x32afed['attributes']=_0x32afed['attributes'][_0x22a5('0x38')]?_0x32afed['attributes']:_0x3e4626[_0x22a5('0x35')];if(!_0x2ab24d['query']['hasOwnProperty'](_0x22a5('0x39'))){_0x32afed[_0x22a5('0x1e')]=qs[_0x22a5('0x1e')](_0x2ab24d[_0x22a5('0x32')][_0x22a5('0x1e')]);_0x32afed[_0x22a5('0x21')]=qs[_0x22a5('0x21')](_0x2ab24d[_0x22a5('0x32')][_0x22a5('0x21')]);}_0x32afed['order']=qs['sort'](_0x2ab24d[_0x22a5('0x32')][_0x22a5('0x3a')]);_0x32afed[_0x22a5('0x3b')]=qs[_0x22a5('0x3c')](_[_0x22a5('0x3d')](_0x2ab24d[_0x22a5('0x32')],_0x3e4626[_0x22a5('0x3c')]),_0x33aa36);if(_0x2ab24d[_0x22a5('0x32')]['filter']){_0x32afed[_0x22a5('0x3b')]=_['merge'](_0x32afed['where'],{'$or':_[_0x22a5('0x2c')](_0x33aa36,function(_0x554ec6){if(_0x554ec6[_0x22a5('0x30')]!==_0x22a5('0x3e')){var _0x4432ff={};_0x4432ff[_0x554ec6[_0x22a5('0x29')]]={'$like':'%'+_0x2ab24d[_0x22a5('0x32')]['filter']+'%'};return _0x4432ff;}})});}_0x32afed=_[_0x22a5('0x3f')]({},_0x32afed,_0x2ab24d[_0x22a5('0x40')]);var _0x328819={'where':_0x32afed[_0x22a5('0x3b')]};return db[_0x22a5('0x2d')][_0x22a5('0x20')](_0x328819)[_0x22a5('0x27')](function(_0x301f96){_0x46fed1[_0x22a5('0x20')]=_0x301f96;if(_0x2ab24d[_0x22a5('0x32')][_0x22a5('0x41')]){_0x32afed['include']=[{'all':!![]}];}return db['MailSubstatus'][_0x22a5('0x42')](_0x32afed);})[_0x22a5('0x27')](function(_0x2b9118){_0x46fed1[_0x22a5('0x43')]=_0x2b9118;return _0x46fed1;})[_0x22a5('0x27')](respondWithFilteredResult(_0x5c2f35,_0x32afed))['catch'](handleError(_0x5c2f35,null));};exports[_0x22a5('0x44')]=function(_0x387826,_0x2b3445){var _0x3f74b5={'raw':!![],'where':{'id':_0x387826[_0x22a5('0x45')]['id']}},_0x29c43e={};_0x29c43e['model']=_[_0x22a5('0x33')](db[_0x22a5('0x2d')][_0x22a5('0x2e')]);_0x29c43e[_0x22a5('0x32')]=_['keys'](_0x387826[_0x22a5('0x32')]);_0x29c43e[_0x22a5('0x3c')]=_[_0x22a5('0x34')](_0x29c43e[_0x22a5('0x35')],_0x29c43e[_0x22a5('0x32')]);_0x3f74b5[_0x22a5('0x36')]=_[_0x22a5('0x34')](_0x29c43e[_0x22a5('0x35')],qs[_0x22a5('0x37')](_0x387826[_0x22a5('0x32')][_0x22a5('0x37')]));_0x3f74b5[_0x22a5('0x36')]=_0x3f74b5[_0x22a5('0x36')]['length']?_0x3f74b5[_0x22a5('0x36')]:_0x29c43e[_0x22a5('0x35')];if(_0x387826[_0x22a5('0x32')]['includeAll']){_0x3f74b5['include']=[{'all':!![]}];}_0x3f74b5=_[_0x22a5('0x3f')]({},_0x3f74b5,_0x387826[_0x22a5('0x40')]);return db[_0x22a5('0x2d')][_0x22a5('0x46')](_0x3f74b5)[_0x22a5('0x27')](handleEntityNotFound(_0x2b3445,null))[_0x22a5('0x27')](respondWithResult(_0x2b3445,null))[_0x22a5('0x47')](handleError(_0x2b3445,null));};exports[_0x22a5('0x48')]=function(_0x23f9bf,_0x466e28){return db[_0x22a5('0x2d')][_0x22a5('0x48')](_0x23f9bf[_0x22a5('0x49')],{})[_0x22a5('0x27')](respondWithResult(_0x466e28,0xc9))[_0x22a5('0x47')](handleError(_0x466e28,null));};exports['update']=function(_0x3d9463,_0x7e8252){if(_0x3d9463[_0x22a5('0x49')]['id']){delete _0x3d9463[_0x22a5('0x49')]['id'];}return db[_0x22a5('0x2d')][_0x22a5('0x46')]({'where':{'id':_0x3d9463[_0x22a5('0x45')]['id']}})[_0x22a5('0x27')](handleEntityNotFound(_0x7e8252,null))[_0x22a5('0x27')](saveUpdates(_0x3d9463[_0x22a5('0x49')],null))[_0x22a5('0x27')](respondWithResult(_0x7e8252,null))['catch'](handleError(_0x7e8252,null));};exports[_0x22a5('0x4a')]=function(_0x115f0f,_0x2a47bb){return db[_0x22a5('0x2d')][_0x22a5('0x46')]({'where':{'id':_0x115f0f[_0x22a5('0x45')]['id']}})[_0x22a5('0x27')](handleEntityNotFound(_0x2a47bb,null))[_0x22a5('0x27')](removeEntity(_0x2a47bb,null))[_0x22a5('0x47')](handleError(_0x2a47bb,null));};exports['describe']=function(_0x4d0cd8,_0x3b8d4f){return db[_0x22a5('0x2d')][_0x22a5('0x4b')]()[_0x22a5('0x27')](respondWithResult(_0x3b8d4f,null))['catch'](handleError(_0x3b8d4f,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 4e83ff3..d36cebf 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 _0x5b5b=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailSubstatus.attributes','define','MailSubstatus','lodash','util','../../config/logger'];(function(_0x3cfbf7,_0x4317f8){var _0x14cb62=function(_0x394789){while(--_0x394789){_0x3cfbf7['push'](_0x3cfbf7['shift']());}};_0x14cb62(++_0x4317f8);}(_0x5b5b,0x101));var _0xb5b5=function(_0x43b487,_0x21893a){_0x43b487=_0x43b487-0x0;var _0x2f707a=_0x5b5b[_0x43b487];return _0x2f707a;};'use strict';var _=require(_0xb5b5('0x0'));var util=require(_0xb5b5('0x1'));var logger=require(_0xb5b5('0x2'))(_0xb5b5('0x3'));var moment=require(_0xb5b5('0x4'));var BPromise=require(_0xb5b5('0x5'));var rp=require(_0xb5b5('0x6'));var fs=require('fs');var path=require(_0xb5b5('0x7'));var rimraf=require(_0xb5b5('0x8'));var config=require(_0xb5b5('0x9'));var attributes=require(_0xb5b5('0xa'));module['exports']=function(_0x47ad6c,_0x2c7ef4){return _0x47ad6c[_0xb5b5('0xb')](_0xb5b5('0xc'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x858c=['define','MailSubstatus','mail_substatuses','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x269abf,_0x551380){var _0x322dd=function(_0x4d723c){while(--_0x4d723c){_0x269abf['push'](_0x269abf['shift']());}};_0x322dd(++_0x551380);}(_0x858c,0x92));var _0xc858=function(_0x5cf327,_0x2724f3){_0x5cf327=_0x5cf327-0x0;var _0x3bb17b=_0x858c[_0x5cf327];return _0x3bb17b;};'use strict';var _=require(_0xc858('0x0'));var util=require(_0xc858('0x1'));var logger=require(_0xc858('0x2'))(_0xc858('0x3'));var moment=require(_0xc858('0x4'));var BPromise=require(_0xc858('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc858('0x6'));var rimraf=require(_0xc858('0x7'));var config=require(_0xc858('0x8'));var attributes=require('./mailSubstatus.attributes');module[_0xc858('0x9')]=function(_0x566de8,_0x3e317c){return _0x566de8[_0xc858('0xa')](_0xc858('0xb'),attributes,{'tableName':_0xc858('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 1c3013a..7298af4 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 _0xf03e=['message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info','MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x4f2d17,_0x13156c){var _0x277b0d=function(_0x29a497){while(--_0x29a497){_0x4f2d17['push'](_0x4f2d17['shift']());}};_0x277b0d(++_0x13156c);}(_0xf03e,0x114));var _0xef03=function(_0x58babf,_0x1aef24){_0x58babf=_0x58babf-0x0;var _0x4a64ba=_0xf03e[_0x58babf];return _0x4a64ba;};'use strict';var _=require(_0xef03('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xef03('0x1'));var rs=require(_0xef03('0x2'));var fs=require('fs');var Redis=require(_0xef03('0x3'));var db=require(_0xef03('0x4'))['db'];var utils=require(_0xef03('0x5'));var logger=require('../../config/logger')(_0xef03('0x6'));var config=require('../../config/environment');var jayson=require(_0xef03('0x7'));var client=jayson[_0xef03('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x46b4ca,_0x3c8d45,_0xaa144d){return new BPromise(function(_0x998644,_0x40a9ba){return client[_0xef03('0x9')](_0x46b4ca,_0xaa144d)[_0xef03('0xa')](function(_0x16065a){logger[_0xef03('0xb')](_0xef03('0xc'),_0x3c8d45,'request\x20sent');logger[_0xef03('0xd')](_0xef03('0xe'),_0x3c8d45,_0xef03('0xf'),JSON[_0xef03('0x10')](_0x16065a));if(_0x16065a[_0xef03('0x11')]){if(_0x16065a['error']['code']===0x1f4){logger[_0xef03('0x11')](_0xef03('0xc'),_0x3c8d45,_0x16065a[_0xef03('0x11')][_0xef03('0x12')]);return _0x40a9ba(_0x16065a['error'][_0xef03('0x12')]);}logger[_0xef03('0x11')](_0xef03('0xc'),_0x3c8d45,_0x16065a[_0xef03('0x11')][_0xef03('0x12')]);return _0x998644(_0x16065a[_0xef03('0x11')][_0xef03('0x12')]);}else{logger[_0xef03('0xb')](_0xef03('0xc'),_0x3c8d45,_0xef03('0xf'));_0x998644(_0x16065a[_0xef03('0x13')][_0xef03('0x12')]);}})[_0xef03('0x14')](function(_0xa9bb92){logger[_0xef03('0x11')](_0xef03('0xc'),_0x3c8d45,_0xa9bb92);_0x40a9ba(_0xa9bb92);});});} \ No newline at end of file +var _0x7bbe=['jayson/promise','client','http','request','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x153224,_0x227874){var _0x534411=function(_0x348894){while(--_0x348894){_0x153224['push'](_0x153224['shift']());}};_0x534411(++_0x227874);}(_0x7bbe,0x80));var _0xe7bb=function(_0x3c2b2e,_0x3e6e53){_0x3c2b2e=_0x3c2b2e-0x0;var _0x27a338=_0x7bbe[_0x3c2b2e];return _0x27a338;};'use strict';var _=require(_0xe7bb('0x0'));var util=require(_0xe7bb('0x1'));var moment=require(_0xe7bb('0x2'));var BPromise=require(_0xe7bb('0x3'));var rs=require(_0xe7bb('0x4'));var fs=require('fs');var Redis=require(_0xe7bb('0x5'));var db=require(_0xe7bb('0x6'))['db'];var utils=require(_0xe7bb('0x7'));var logger=require('../../config/logger')(_0xe7bb('0x8'));var config=require(_0xe7bb('0x9'));var jayson=require(_0xe7bb('0xa'));var client=jayson[_0xe7bb('0xb')][_0xe7bb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4b3f00,_0x4dbf40,_0x58abfc){return new BPromise(function(_0x56160c,_0x49f970){return client[_0xe7bb('0xd')](_0x4b3f00,_0x58abfc)['then'](function(_0x2995ff){logger[_0xe7bb('0xe')](_0xe7bb('0xf'),_0x4dbf40,_0xe7bb('0x10'));logger[_0xe7bb('0x11')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x4dbf40,_0xe7bb('0x10'),JSON[_0xe7bb('0x12')](_0x2995ff));if(_0x2995ff[_0xe7bb('0x13')]){if(_0x2995ff[_0xe7bb('0x13')]['code']===0x1f4){logger[_0xe7bb('0x13')](_0xe7bb('0xf'),_0x4dbf40,_0x2995ff['error'][_0xe7bb('0x14')]);return _0x49f970(_0x2995ff[_0xe7bb('0x13')]['message']);}logger[_0xe7bb('0x13')](_0xe7bb('0xf'),_0x4dbf40,_0x2995ff[_0xe7bb('0x13')][_0xe7bb('0x14')]);return _0x56160c(_0x2995ff[_0xe7bb('0x13')]['message']);}else{logger['info'](_0xe7bb('0xf'),_0x4dbf40,'request\x20sent');_0x56160c(_0x2995ff[_0xe7bb('0x15')]['message']);}})[_0xe7bb('0x16')](function(_0x1a5563){logger[_0xe7bb('0x13')](_0xe7bb('0xf'),_0x4dbf40,_0x1a5563);_0x49f970(_0x1a5563);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index f368cab..a02d64c 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 _0x2b02=['../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','/:id','create','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2b02,0x1df));var _0x22b0=function(_0x5c0c43,_0x54fa39){_0x5c0c43=_0x5c0c43-0x0;var _0x16f3a4=_0x2b02[_0x5c0c43];return _0x16f3a4;};'use strict';var multer=require(_0x22b0('0x0'));var util=require(_0x22b0('0x1'));var path=require(_0x22b0('0x2'));var timeout=require(_0x22b0('0x3'));var express=require(_0x22b0('0x4'));var router=express[_0x22b0('0x5')]();var fs_extra=require(_0x22b0('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x22b0('0x7'));var config=require(_0x22b0('0x8'));var controller=require(_0x22b0('0x9'));router[_0x22b0('0xa')]('/',auth[_0x22b0('0xb')](),controller[_0x22b0('0xc')]);router[_0x22b0('0xa')](_0x22b0('0xd'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x22b0('0xe'),auth[_0x22b0('0xb')](),controller['show']);router['post']('/',auth[_0x22b0('0xb')](),controller[_0x22b0('0xf')]);router['put'](_0x22b0('0xe'),auth[_0x22b0('0xb')](),controller['update']);router[_0x22b0('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x22b0('0x11')]=router; \ No newline at end of file +var _0xf974=['get','isAuthenticated','index','describe','/:id','show','post','create','put','delete','exports','util','path','express','Router','fs-extra'];(function(_0x4a94b1,_0x4f2518){var _0x20949f=function(_0x1c4aa6){while(--_0x1c4aa6){_0x4a94b1['push'](_0x4a94b1['shift']());}};_0x20949f(++_0x4f2518);}(_0xf974,0x6b));var _0x4f97=function(_0x405452,_0x215116){_0x405452=_0x405452-0x0;var _0x4f06b9=_0xf974[_0x405452];return _0x4f06b9;};'use strict';var multer=require('multer');var util=require(_0x4f97('0x0'));var path=require(_0x4f97('0x1'));var timeout=require('connect-timeout');var express=require(_0x4f97('0x2'));var router=express[_0x4f97('0x3')]();var fs_extra=require(_0x4f97('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./mailTransferReport.controller');router[_0x4f97('0x5')]('/',auth[_0x4f97('0x6')](),controller[_0x4f97('0x7')]);router[_0x4f97('0x5')]('/describe',auth[_0x4f97('0x6')](),controller[_0x4f97('0x8')]);router[_0x4f97('0x5')](_0x4f97('0x9'),auth[_0x4f97('0x6')](),controller[_0x4f97('0xa')]);router[_0x4f97('0xb')]('/',auth[_0x4f97('0x6')](),controller[_0x4f97('0xc')]);router[_0x4f97('0xd')](_0x4f97('0x9'),auth[_0x4f97('0x6')](),controller['update']);router[_0x4f97('0xe')]('/:id',auth[_0x4f97('0x6')](),controller['destroy']);module[_0x4f97('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index dc4b68e..130a24f 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 _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x3662c0,_0xea7647){var _0x4ad28b=function(_0x356256){while(--_0x356256){_0x3662c0['push'](_0x3662c0['shift']());}};_0x4ad28b(++_0xea7647);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x3f5dca,_0x59472b){_0x3f5dca=_0x3f5dca-0x0;var _0x5b833a=_0xf3cd[_0x3f5dca];return _0x5b833a;};'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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x4b5965,_0x3909ca){var _0x3e7789=function(_0x33c2b0){while(--_0x33c2b0){_0x4b5965['push'](_0x4b5965['shift']());}};_0x3e7789(++_0x3909ca);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 34017d0..0c89d3f 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 _0xedae=['includeAll','findAll','rows','show','params','include','options','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','undefined','count','set','save','destroy','then','error','stack','name','send','index','map','MailTransferReport','fieldName','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','merge','where','VIRTUAL'];(function(_0x51742d,_0x468cad){var _0x54ab05=function(_0x36359d){while(--_0x36359d){_0x51742d['push'](_0x51742d['shift']());}};_0x54ab05(++_0x468cad);}(_0xedae,0xe4));var _0xeeda=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xedae[_0x134c2e];return _0x2825db;};'use strict';var emlformat=require(_0xeeda('0x0'));var rimraf=require(_0xeeda('0x1'));var zipdir=require(_0xeeda('0x2'));var jsonpatch=require(_0xeeda('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xeeda('0x4'));var util=require('util');var path=require(_0xeeda('0x5'));var sox=require(_0xeeda('0x6'));var csv=require(_0xeeda('0x7'));var ejs=require(_0xeeda('0x8'));var fs=require('fs');var fs_extra=require(_0xeeda('0x9'));var _=require(_0xeeda('0xa'));var squel=require(_0xeeda('0xb'));var crypto=require(_0xeeda('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xeeda('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xeeda('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xeeda('0xf'));var as=require(_0xeeda('0x10'));var hardwareService=require(_0xeeda('0x11'));var logger=require(_0xeeda('0x12'))(_0xeeda('0x13'));var utils=require(_0xeeda('0x14'));var config=require(_0xeeda('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc91189,_0x4f6ae1){_0x4f6ae1=_0x4f6ae1||0xcc;return function(_0xc4b333){if(_0xc4b333){return _0xc91189[_0xeeda('0x16')](_0x4f6ae1);}return _0xc91189[_0xeeda('0x17')](_0x4f6ae1)[_0xeeda('0x18')]();};}function respondWithResult(_0x4f9568,_0x54a699){_0x54a699=_0x54a699||0xc8;return function(_0x26b0eb){if(_0x26b0eb){return _0x4f9568[_0xeeda('0x17')](_0x54a699)[_0xeeda('0x19')](_0x26b0eb);}};}function respondWithFilteredResult(_0x1e71f9,_0x5c183b){return function(_0x5d36ae){if(_0x5d36ae){var _0x42e063=typeof _0x5c183b[_0xeeda('0x1a')]==='undefined'&&typeof _0x5c183b[_0xeeda('0x1b')]===_0xeeda('0x1c');var _0x2c5e6f=_0x5d36ae['count'];var _0x182f4c=_0x42e063?0x0:_0x5c183b[_0xeeda('0x1a')];var _0x53ad76=_0x42e063?_0x5d36ae[_0xeeda('0x1d')]:_0x5c183b['offset']+_0x5c183b['limit'];var _0x599038;if(_0x53ad76>=_0x2c5e6f){_0x53ad76=_0x2c5e6f;_0x599038=0xc8;}else{_0x599038=0xce;}_0x1e71f9[_0xeeda('0x17')](_0x599038);return _0x1e71f9[_0xeeda('0x1e')]('Content-Range',_0x182f4c+'-'+_0x53ad76+'/'+_0x2c5e6f)[_0xeeda('0x19')](_0x5d36ae);}return null;};}function patchUpdates(_0x36c1c1){return function(_0x21001f){try{jsonpatch['apply'](_0x21001f,_0x36c1c1,!![]);}catch(_0xc9d516){return BPromise['reject'](_0xc9d516);}return _0x21001f[_0xeeda('0x1f')]();};}function saveUpdates(_0x399eb6,_0x53ab18){return function(_0x537394){if(_0x537394){return _0x537394['update'](_0x399eb6)['then'](function(_0x4fcc88){return _0x4fcc88;});}return null;};}function removeEntity(_0x5f5b90,_0x5090ff){return function(_0x1384ef){if(_0x1384ef){return _0x1384ef[_0xeeda('0x20')]()[_0xeeda('0x21')](function(){_0x5f5b90[_0xeeda('0x17')](0xcc)[_0xeeda('0x18')]();});}};}function handleEntityNotFound(_0x613595,_0x5e2d70){return function(_0x33fb00){if(!_0x33fb00){_0x613595[_0xeeda('0x16')](0x194);}return _0x33fb00;};}function handleError(_0x3a68f5,_0x2b7236){_0x2b7236=_0x2b7236||0x1f4;return function(_0x23722a){logger[_0xeeda('0x22')](_0x23722a[_0xeeda('0x23')]);if(_0x23722a[_0xeeda('0x24')]){delete _0x23722a['name'];}_0x3a68f5[_0xeeda('0x17')](_0x2b7236)[_0xeeda('0x25')](_0x23722a);};}exports[_0xeeda('0x26')]=function(_0x507af4,_0x56cb76){var _0x44496b={},_0x126e5f={},_0x19697c={'count':0x0,'rows':[]};var _0x3f152d=_[_0xeeda('0x27')](db[_0xeeda('0x28')]['rawAttributes'],function(_0x2688b4){return{'name':_0x2688b4[_0xeeda('0x29')],'type':_0x2688b4[_0xeeda('0x2a')][_0xeeda('0x2b')]};});_0x126e5f[_0xeeda('0x2c')]=_[_0xeeda('0x27')](_0x3f152d,_0xeeda('0x24'));_0x126e5f['query']=_[_0xeeda('0x2d')](_0x507af4[_0xeeda('0x2e')]);_0x126e5f['filters']=_['intersection'](_0x126e5f['model'],_0x126e5f['query']);_0x44496b[_0xeeda('0x2f')]=_[_0xeeda('0x30')](_0x126e5f['model'],qs[_0xeeda('0x31')](_0x507af4['query'][_0xeeda('0x31')]));_0x44496b[_0xeeda('0x2f')]=_0x44496b[_0xeeda('0x2f')][_0xeeda('0x32')]?_0x44496b[_0xeeda('0x2f')]:_0x126e5f[_0xeeda('0x2c')];if(!_0x507af4[_0xeeda('0x2e')][_0xeeda('0x33')](_0xeeda('0x34'))){_0x44496b['limit']=qs['limit'](_0x507af4['query'][_0xeeda('0x1b')]);_0x44496b[_0xeeda('0x1a')]=qs['offset'](_0x507af4[_0xeeda('0x2e')][_0xeeda('0x1a')]);}_0x44496b['order']=qs[_0xeeda('0x35')](_0x507af4[_0xeeda('0x2e')][_0xeeda('0x35')]);_0x44496b['where']=qs[_0xeeda('0x36')](_[_0xeeda('0x37')](_0x507af4[_0xeeda('0x2e')],_0x126e5f[_0xeeda('0x36')]),_0x3f152d);if(_0x507af4[_0xeeda('0x2e')][_0xeeda('0x38')]){_0x44496b['where']=_[_0xeeda('0x39')](_0x44496b[_0xeeda('0x3a')],{'$or':_[_0xeeda('0x27')](_0x3f152d,function(_0x482dbf){if(_0x482dbf[_0xeeda('0x2a')]!==_0xeeda('0x3b')){var _0x2e531d={};_0x2e531d[_0x482dbf['name']]={'$like':'%'+_0x507af4['query'][_0xeeda('0x38')]+'%'};return _0x2e531d;}})});}_0x44496b=_[_0xeeda('0x39')]({},_0x44496b,_0x507af4['options']);var _0x1128bc={'where':_0x44496b[_0xeeda('0x3a')]};return db['MailTransferReport'][_0xeeda('0x1d')](_0x1128bc)[_0xeeda('0x21')](function(_0x455287){_0x19697c[_0xeeda('0x1d')]=_0x455287;if(_0x507af4[_0xeeda('0x2e')][_0xeeda('0x3c')]){_0x44496b['include']=[{'all':!![]}];}return db[_0xeeda('0x28')][_0xeeda('0x3d')](_0x44496b);})[_0xeeda('0x21')](function(_0x327f7c){_0x19697c[_0xeeda('0x3e')]=_0x327f7c;return _0x19697c;})['then'](respondWithFilteredResult(_0x56cb76,_0x44496b))['catch'](handleError(_0x56cb76,null));};exports[_0xeeda('0x3f')]=function(_0x4878f8,_0xb207d4){var _0x1e1cbe={'raw':!![],'where':{'id':_0x4878f8[_0xeeda('0x40')]['id']}},_0x1de4df={};_0x1de4df[_0xeeda('0x2c')]=_['keys'](db[_0xeeda('0x28')]['rawAttributes']);_0x1de4df['query']=_[_0xeeda('0x2d')](_0x4878f8[_0xeeda('0x2e')]);_0x1de4df[_0xeeda('0x36')]=_[_0xeeda('0x30')](_0x1de4df[_0xeeda('0x2c')],_0x1de4df[_0xeeda('0x2e')]);_0x1e1cbe[_0xeeda('0x2f')]=_[_0xeeda('0x30')](_0x1de4df[_0xeeda('0x2c')],qs[_0xeeda('0x31')](_0x4878f8[_0xeeda('0x2e')][_0xeeda('0x31')]));_0x1e1cbe['attributes']=_0x1e1cbe[_0xeeda('0x2f')][_0xeeda('0x32')]?_0x1e1cbe[_0xeeda('0x2f')]:_0x1de4df[_0xeeda('0x2c')];if(_0x4878f8[_0xeeda('0x2e')][_0xeeda('0x3c')]){_0x1e1cbe[_0xeeda('0x41')]=[{'all':!![]}];}_0x1e1cbe=_['merge']({},_0x1e1cbe,_0x4878f8[_0xeeda('0x42')]);return db['MailTransferReport'][_0xeeda('0x43')](_0x1e1cbe)['then'](handleEntityNotFound(_0xb207d4,null))[_0xeeda('0x21')](respondWithResult(_0xb207d4,null))[_0xeeda('0x44')](handleError(_0xb207d4,null));};exports[_0xeeda('0x45')]=function(_0x41a90a,_0x4a2286){return db[_0xeeda('0x28')][_0xeeda('0x45')](_0x41a90a[_0xeeda('0x46')],{})[_0xeeda('0x21')](respondWithResult(_0x4a2286,0xc9))['catch'](handleError(_0x4a2286,null));};exports['update']=function(_0x554709,_0x4397a2){if(_0x554709[_0xeeda('0x46')]['id']){delete _0x554709[_0xeeda('0x46')]['id'];}return db[_0xeeda('0x28')][_0xeeda('0x43')]({'where':{'id':_0x554709['params']['id']}})[_0xeeda('0x21')](handleEntityNotFound(_0x4397a2,null))[_0xeeda('0x21')](saveUpdates(_0x554709['body'],null))[_0xeeda('0x21')](respondWithResult(_0x4397a2,null))[_0xeeda('0x44')](handleError(_0x4397a2,null));};exports[_0xeeda('0x20')]=function(_0x20428c,_0x5c4fbb){return db[_0xeeda('0x28')][_0xeeda('0x43')]({'where':{'id':_0x20428c[_0xeeda('0x40')]['id']}})[_0xeeda('0x21')](handleEntityNotFound(_0x5c4fbb,null))[_0xeeda('0x21')](removeEntity(_0x5c4fbb,null))[_0xeeda('0x44')](handleError(_0x5c4fbb,null));};exports['describe']=function(_0x3ebc72,_0x4189f2){return db['MailTransferReport'][_0xeeda('0x47')]()[_0xeeda('0x21')](respondWithResult(_0x4189f2,null))[_0xeeda('0x44')](handleError(_0x4189f2,null));}; \ No newline at end of file +var _0x064c=['destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','apply','reject','save','update','then','stack','name','send','index','map','MailTransferReport','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','include','rows','catch','show','params','includeAll','find','body'];(function(_0x2afbc8,_0xa56d64){var _0x33d443=function(_0x47cb52){while(--_0x47cb52){_0x2afbc8['push'](_0x2afbc8['shift']());}};_0x33d443(++_0xa56d64);}(_0x064c,0x95));var _0xc064=function(_0x358806,_0x322b66){_0x358806=_0x358806-0x0;var _0x19fdcb=_0x064c[_0x358806];return _0x19fdcb;};'use strict';var emlformat=require(_0xc064('0x0'));var rimraf=require(_0xc064('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc064('0x2'));var rp=require(_0xc064('0x3'));var moment=require(_0xc064('0x4'));var BPromise=require(_0xc064('0x5'));var Mustache=require(_0xc064('0x6'));var util=require('util');var path=require(_0xc064('0x7'));var sox=require(_0xc064('0x8'));var csv=require(_0xc064('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc064('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc064('0xb'));var jsforce=require(_0xc064('0xc'));var deskjs=require(_0xc064('0xd'));var toCsv=require(_0xc064('0x9'));var querystring=require(_0xc064('0xe'));var Papa=require(_0xc064('0xf'));var Redis=require(_0xc064('0x10'));var authService=require(_0xc064('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc064('0x12'));var hardwareService=require(_0xc064('0x13'));var logger=require(_0xc064('0x14'))(_0xc064('0x15'));var utils=require(_0xc064('0x16'));var config=require(_0xc064('0x17'));var licenseUtil=require(_0xc064('0x18'));var db=require(_0xc064('0x19'))['db'];function respondWithStatusCode(_0x70b5e5,_0x4be61f){_0x4be61f=_0x4be61f||0xcc;return function(_0x1db753){if(_0x1db753){return _0x70b5e5[_0xc064('0x1a')](_0x4be61f);}return _0x70b5e5['status'](_0x4be61f)[_0xc064('0x1b')]();};}function respondWithResult(_0xf28f91,_0x420950){_0x420950=_0x420950||0xc8;return function(_0x1a24b1){if(_0x1a24b1){return _0xf28f91['status'](_0x420950)[_0xc064('0x1c')](_0x1a24b1);}};}function respondWithFilteredResult(_0x4737d1,_0x4de351){return function(_0x4e283f){if(_0x4e283f){var _0x5d295b=typeof _0x4de351[_0xc064('0x1d')]===_0xc064('0x1e')&&typeof _0x4de351[_0xc064('0x1f')]===_0xc064('0x1e');var _0x251ba0=_0x4e283f['count'];var _0x3cfce9=_0x5d295b?0x0:_0x4de351[_0xc064('0x1d')];var _0x44faa8=_0x5d295b?_0x4e283f[_0xc064('0x20')]:_0x4de351[_0xc064('0x1d')]+_0x4de351['limit'];var _0x398051;if(_0x44faa8>=_0x251ba0){_0x44faa8=_0x251ba0;_0x398051=0xc8;}else{_0x398051=0xce;}_0x4737d1[_0xc064('0x21')](_0x398051);return _0x4737d1[_0xc064('0x22')]('Content-Range',_0x3cfce9+'-'+_0x44faa8+'/'+_0x251ba0)['json'](_0x4e283f);}return null;};}function patchUpdates(_0x5d940a){return function(_0x278fdc){try{jsonpatch[_0xc064('0x23')](_0x278fdc,_0x5d940a,!![]);}catch(_0x5be48b){return BPromise[_0xc064('0x24')](_0x5be48b);}return _0x278fdc[_0xc064('0x25')]();};}function saveUpdates(_0x2f2744,_0x280ea2){return function(_0x10b677){if(_0x10b677){return _0x10b677[_0xc064('0x26')](_0x2f2744)[_0xc064('0x27')](function(_0x1dd6b7){return _0x1dd6b7;});}return null;};}function removeEntity(_0x4edd95,_0x1d4d05){return function(_0x5947bc){if(_0x5947bc){return _0x5947bc['destroy']()[_0xc064('0x27')](function(){_0x4edd95[_0xc064('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x504f67,_0x404425){return function(_0xad4d64){if(!_0xad4d64){_0x504f67[_0xc064('0x1a')](0x194);}return _0xad4d64;};}function handleError(_0x15b6ba,_0x4ba3a2){_0x4ba3a2=_0x4ba3a2||0x1f4;return function(_0x17bc3b){logger['error'](_0x17bc3b[_0xc064('0x28')]);if(_0x17bc3b[_0xc064('0x29')]){delete _0x17bc3b['name'];}_0x15b6ba[_0xc064('0x21')](_0x4ba3a2)[_0xc064('0x2a')](_0x17bc3b);};}exports[_0xc064('0x2b')]=function(_0x938d77,_0x96cd71){var _0x41b4d={},_0x51368c={},_0x55a8d5={'count':0x0,'rows':[]};var _0x573be2=_[_0xc064('0x2c')](db[_0xc064('0x2d')][_0xc064('0x2e')],function(_0x2b98b9){return{'name':_0x2b98b9['fieldName'],'type':_0x2b98b9[_0xc064('0x2f')][_0xc064('0x30')]};});_0x51368c['model']=_[_0xc064('0x2c')](_0x573be2,'name');_0x51368c[_0xc064('0x31')]=_[_0xc064('0x32')](_0x938d77['query']);_0x51368c[_0xc064('0x33')]=_[_0xc064('0x34')](_0x51368c[_0xc064('0x35')],_0x51368c[_0xc064('0x31')]);_0x41b4d[_0xc064('0x36')]=_[_0xc064('0x34')](_0x51368c[_0xc064('0x35')],qs['fields'](_0x938d77[_0xc064('0x31')][_0xc064('0x37')]));_0x41b4d[_0xc064('0x36')]=_0x41b4d['attributes'][_0xc064('0x38')]?_0x41b4d[_0xc064('0x36')]:_0x51368c[_0xc064('0x35')];if(!_0x938d77[_0xc064('0x31')]['hasOwnProperty'](_0xc064('0x39'))){_0x41b4d[_0xc064('0x1f')]=qs[_0xc064('0x1f')](_0x938d77[_0xc064('0x31')][_0xc064('0x1f')]);_0x41b4d[_0xc064('0x1d')]=qs[_0xc064('0x1d')](_0x938d77[_0xc064('0x31')][_0xc064('0x1d')]);}_0x41b4d['order']=qs[_0xc064('0x3a')](_0x938d77[_0xc064('0x31')][_0xc064('0x3a')]);_0x41b4d[_0xc064('0x3b')]=qs[_0xc064('0x33')](_[_0xc064('0x3c')](_0x938d77['query'],_0x51368c[_0xc064('0x33')]),_0x573be2);if(_0x938d77[_0xc064('0x31')]['filter']){_0x41b4d['where']=_[_0xc064('0x3d')](_0x41b4d[_0xc064('0x3b')],{'$or':_['map'](_0x573be2,function(_0xe676a9){if(_0xe676a9[_0xc064('0x2f')]!==_0xc064('0x3e')){var _0x5abaaf={};_0x5abaaf[_0xe676a9[_0xc064('0x29')]]={'$like':'%'+_0x938d77[_0xc064('0x31')][_0xc064('0x3f')]+'%'};return _0x5abaaf;}})});}_0x41b4d=_[_0xc064('0x3d')]({},_0x41b4d,_0x938d77[_0xc064('0x40')]);var _0x1917ab={'where':_0x41b4d[_0xc064('0x3b')]};return db[_0xc064('0x2d')][_0xc064('0x20')](_0x1917ab)[_0xc064('0x27')](function(_0xecabce){_0x55a8d5[_0xc064('0x20')]=_0xecabce;if(_0x938d77[_0xc064('0x31')]['includeAll']){_0x41b4d[_0xc064('0x41')]=[{'all':!![]}];}return db['MailTransferReport']['findAll'](_0x41b4d);})[_0xc064('0x27')](function(_0x4600ef){_0x55a8d5[_0xc064('0x42')]=_0x4600ef;return _0x55a8d5;})[_0xc064('0x27')](respondWithFilteredResult(_0x96cd71,_0x41b4d))[_0xc064('0x43')](handleError(_0x96cd71,null));};exports[_0xc064('0x44')]=function(_0x304292,_0x3d028f){var _0xd46a7f={'raw':!![],'where':{'id':_0x304292[_0xc064('0x45')]['id']}},_0x3d8660={};_0x3d8660[_0xc064('0x35')]=_['keys'](db[_0xc064('0x2d')][_0xc064('0x2e')]);_0x3d8660[_0xc064('0x31')]=_[_0xc064('0x32')](_0x304292['query']);_0x3d8660['filters']=_['intersection'](_0x3d8660[_0xc064('0x35')],_0x3d8660['query']);_0xd46a7f[_0xc064('0x36')]=_[_0xc064('0x34')](_0x3d8660[_0xc064('0x35')],qs[_0xc064('0x37')](_0x304292[_0xc064('0x31')][_0xc064('0x37')]));_0xd46a7f[_0xc064('0x36')]=_0xd46a7f['attributes'][_0xc064('0x38')]?_0xd46a7f[_0xc064('0x36')]:_0x3d8660[_0xc064('0x35')];if(_0x304292['query'][_0xc064('0x46')]){_0xd46a7f[_0xc064('0x41')]=[{'all':!![]}];}_0xd46a7f=_[_0xc064('0x3d')]({},_0xd46a7f,_0x304292[_0xc064('0x40')]);return db[_0xc064('0x2d')][_0xc064('0x47')](_0xd46a7f)[_0xc064('0x27')](handleEntityNotFound(_0x3d028f,null))[_0xc064('0x27')](respondWithResult(_0x3d028f,null))[_0xc064('0x43')](handleError(_0x3d028f,null));};exports['create']=function(_0x5a4723,_0x59a8e7){return db[_0xc064('0x2d')]['create'](_0x5a4723[_0xc064('0x48')],{})[_0xc064('0x27')](respondWithResult(_0x59a8e7,0xc9))[_0xc064('0x43')](handleError(_0x59a8e7,null));};exports[_0xc064('0x26')]=function(_0x3d8042,_0x546df6){if(_0x3d8042[_0xc064('0x48')]['id']){delete _0x3d8042[_0xc064('0x48')]['id'];}return db[_0xc064('0x2d')][_0xc064('0x47')]({'where':{'id':_0x3d8042['params']['id']}})['then'](handleEntityNotFound(_0x546df6,null))['then'](saveUpdates(_0x3d8042[_0xc064('0x48')],null))['then'](respondWithResult(_0x546df6,null))[_0xc064('0x43')](handleError(_0x546df6,null));};exports[_0xc064('0x49')]=function(_0x360673,_0xab0193){return db[_0xc064('0x2d')][_0xc064('0x47')]({'where':{'id':_0x360673[_0xc064('0x45')]['id']}})[_0xc064('0x27')](handleEntityNotFound(_0xab0193,null))[_0xc064('0x27')](removeEntity(_0xab0193,null))[_0xc064('0x43')](handleError(_0xab0193,null));};exports['describe']=function(_0x1e7926,_0x456ca2){return db[_0xc064('0x2d')]['describe']()['then'](respondWithResult(_0x456ca2,null))[_0xc064('0x43')](handleError(_0x456ca2,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index dfef582..389fcd7 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 _0x8e94=['path','exports','define','report_mail_transfer','uniqueid','lodash','util','api','bluebird'];(function(_0x1842b6,_0x52544c){var _0x4d034e=function(_0x4f5efb){while(--_0x4f5efb){_0x1842b6['push'](_0x1842b6['shift']());}};_0x4d034e(++_0x52544c);}(_0x8e94,0xf8));var _0x48e9=function(_0x281e5e,_0xf320e2){_0x281e5e=_0x281e5e-0x0;var _0x5a22d2=_0x8e94[_0x281e5e];return _0x5a22d2;};'use strict';var _=require(_0x48e9('0x0'));var util=require(_0x48e9('0x1'));var logger=require('../../config/logger')(_0x48e9('0x2'));var moment=require('moment');var BPromise=require(_0x48e9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x48e9('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailTransferReport.attributes');module[_0x48e9('0x5')]=function(_0x20d724,_0x5d6996){return _0x20d724[_0x48e9('0x6')]('MailTransferReport',attributes,{'tableName':_0x48e9('0x7'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x48e9('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x40c2=['./mailTransferReport.attributes','exports','MailTransferReport','report_mail_transfer','uniqueid','util','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x46ea9a,_0x1f5337){var _0x5a474d=function(_0x1ac61c){while(--_0x1ac61c){_0x46ea9a['push'](_0x46ea9a['shift']());}};_0x5a474d(++_0x1f5337);}(_0x40c2,0x10d));var _0x240c=function(_0x2b1d94,_0x36febb){_0x2b1d94=_0x2b1d94-0x0;var _0x4d2cf7=_0x40c2[_0x2b1d94];return _0x4d2cf7;};'use strict';var _=require('lodash');var util=require(_0x240c('0x0'));var logger=require(_0x240c('0x1'))(_0x240c('0x2'));var moment=require(_0x240c('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x240c('0x4'));var rimraf=require(_0x240c('0x5'));var config=require(_0x240c('0x6'));var attributes=require(_0x240c('0x7'));module[_0x240c('0x8')]=function(_0xf776b7,_0x2d597f){return _0xf776b7['define'](_0x240c('0x9'),attributes,{'tableName':_0x240c('0xa'),'paranoid':![],'indexes':[{'name':_0x240c('0xb'),'fields':[_0x240c('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 5cbe42b..28bebf8 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 _0x569f=['util','moment','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x4aa875,_0x45f71e){var _0x43518c=function(_0xde1ca7){while(--_0xde1ca7){_0x4aa875['push'](_0x4aa875['shift']());}};_0x43518c(++_0x45f71e);}(_0x569f,0x11d));var _0xf569=function(_0x1f93b6,_0xf85aed){_0x1f93b6=_0x1f93b6-0x0;var _0x3cbad6=_0x569f[_0x1f93b6];return _0x3cbad6;};'use strict';var _=require('lodash');var util=require(_0xf569('0x0'));var moment=require(_0xf569('0x1'));var BPromise=require('bluebird');var rs=require(_0xf569('0x2'));var fs=require('fs');var Redis=require(_0xf569('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf569('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xf569('0x5'));var jayson=require(_0xf569('0x6'));var client=jayson[_0xf569('0x7')][_0xf569('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x27b457,_0x5c1d76,_0x41129b){return new BPromise(function(_0x1fb9a8,_0x5b0f8b){return client[_0xf569('0x9')](_0x27b457,_0x41129b)[_0xf569('0xa')](function(_0x10896b){logger[_0xf569('0xb')](_0xf569('0xc'),_0x5c1d76,_0xf569('0xd'));logger[_0xf569('0xe')](_0xf569('0xf'),_0x5c1d76,'request\x20sent',JSON['stringify'](_0x10896b));if(_0x10896b[_0xf569('0x10')]){if(_0x10896b['error'][_0xf569('0x11')]===0x1f4){logger[_0xf569('0x10')](_0xf569('0xc'),_0x5c1d76,_0x10896b[_0xf569('0x10')][_0xf569('0x12')]);return _0x5b0f8b(_0x10896b[_0xf569('0x10')]['message']);}logger['error'](_0xf569('0xc'),_0x5c1d76,_0x10896b[_0xf569('0x10')][_0xf569('0x12')]);return _0x1fb9a8(_0x10896b[_0xf569('0x10')]['message']);}else{logger[_0xf569('0xb')](_0xf569('0xc'),_0x5c1d76,_0xf569('0xd'));_0x1fb9a8(_0x10896b['result'][_0xf569('0x12')]);}})['catch'](function(_0x4a7884){logger[_0xf569('0x10')]('MailTransferReport,\x20%s,\x20%s',_0x5c1d76,_0x4a7884);_0x5b0f8b(_0x4a7884);});});} \ No newline at end of file +var _0x4faf=['request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http'];(function(_0x2cbec0,_0x262fef){var _0x3d4101=function(_0x549a36){while(--_0x549a36){_0x2cbec0['push'](_0x2cbec0['shift']());}};_0x3d4101(++_0x262fef);}(_0x4faf,0xb3));var _0xf4fa=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4faf[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf4fa('0x0'));var BPromise=require(_0xf4fa('0x1'));var rs=require(_0xf4fa('0x2'));var fs=require('fs');var Redis=require(_0xf4fa('0x3'));var db=require(_0xf4fa('0x4'))['db'];var utils=require(_0xf4fa('0x5'));var logger=require('../../config/logger')(_0xf4fa('0x6'));var config=require(_0xf4fa('0x7'));var jayson=require(_0xf4fa('0x8'));var client=jayson['client'][_0xf4fa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1baa75,_0x4c396c,_0x3bc11f){return new BPromise(function(_0x418588,_0x23b703){return client[_0xf4fa('0xa')](_0x1baa75,_0x3bc11f)[_0xf4fa('0xb')](function(_0x5eda6f){logger[_0xf4fa('0xc')](_0xf4fa('0xd'),_0x4c396c,_0xf4fa('0xe'));logger['debug'](_0xf4fa('0xf'),_0x4c396c,_0xf4fa('0xe'),JSON[_0xf4fa('0x10')](_0x5eda6f));if(_0x5eda6f[_0xf4fa('0x11')]){if(_0x5eda6f[_0xf4fa('0x11')][_0xf4fa('0x12')]===0x1f4){logger[_0xf4fa('0x11')](_0xf4fa('0xd'),_0x4c396c,_0x5eda6f[_0xf4fa('0x11')][_0xf4fa('0x13')]);return _0x23b703(_0x5eda6f[_0xf4fa('0x11')][_0xf4fa('0x13')]);}logger[_0xf4fa('0x11')]('MailTransferReport,\x20%s,\x20%s',_0x4c396c,_0x5eda6f['error'][_0xf4fa('0x13')]);return _0x418588(_0x5eda6f[_0xf4fa('0x11')][_0xf4fa('0x13')]);}else{logger['info']('MailTransferReport,\x20%s,\x20%s',_0x4c396c,_0xf4fa('0xe'));_0x418588(_0x5eda6f[_0xf4fa('0x14')]['message']);}})['catch'](function(_0x3e5ad3){logger[_0xf4fa('0x11')](_0xf4fa('0xd'),_0x4c396c,_0x3e5ad3);_0x23b703(_0x3e5ad3);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index ebcccf6..b81225d 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 _0x0da3=['../../config/environment','get','index','isAuthenticated','describe','/:id','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0x0da3,0xd1));var _0x30da=function(_0x513859,_0x4aeb1e){_0x513859=_0x513859-0x0;var _0x5e443e=_0x0da3[_0x513859];return _0x5e443e;};'use strict';var multer=require(_0x30da('0x0'));var util=require(_0x30da('0x1'));var path=require(_0x30da('0x2'));var timeout=require(_0x30da('0x3'));var express=require(_0x30da('0x4'));var router=express[_0x30da('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x30da('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x30da('0x7'));var controller=require('./memberReport.controller');router[_0x30da('0x8')]('/',auth['isAuthenticated'](),controller[_0x30da('0x9')]);router[_0x30da('0x8')]('/describe',auth[_0x30da('0xa')](),controller[_0x30da('0xb')]);router[_0x30da('0x8')](_0x30da('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x30da('0xa')](),controller[_0x30da('0xd')]);router[_0x30da('0xe')](_0x30da('0xc'),auth[_0x30da('0xa')](),controller[_0x30da('0xf')]);router['delete'](_0x30da('0xc'),auth['isAuthenticated'](),controller[_0x30da('0x10')]);module[_0x30da('0x11')]=router; \ No newline at end of file +var _0x1ad4=['./memberReport.controller','get','isAuthenticated','index','/describe','show','post','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x459cb8,_0xa8f310){var _0x703bb3=function(_0x1c460d){while(--_0x1c460d){_0x459cb8['push'](_0x459cb8['shift']());}};_0x703bb3(++_0xa8f310);}(_0x1ad4,0x116));var _0x41ad=function(_0x130705,_0x2d266b){_0x130705=_0x130705-0x0;var _0x1fa991=_0x1ad4[_0x130705];return _0x1fa991;};'use strict';var multer=require(_0x41ad('0x0'));var util=require(_0x41ad('0x1'));var path=require(_0x41ad('0x2'));var timeout=require(_0x41ad('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x41ad('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x41ad('0x5'));var config=require(_0x41ad('0x6'));var controller=require(_0x41ad('0x7'));router[_0x41ad('0x8')]('/',auth[_0x41ad('0x9')](),controller[_0x41ad('0xa')]);router[_0x41ad('0x8')](_0x41ad('0xb'),auth[_0x41ad('0x9')](),controller['describe']);router[_0x41ad('0x8')]('/:id',auth[_0x41ad('0x9')](),controller[_0x41ad('0xc')]);router[_0x41ad('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x41ad('0xe'),auth[_0x41ad('0x9')](),controller[_0x41ad('0xf')]);router[_0x41ad('0x10')](_0x41ad('0xe'),auth[_0x41ad('0x9')](),controller[_0x41ad('0x11')]);module[_0x41ad('0x12')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index e9329fd..8c6d692 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 _0x7a72=['STRING','LOGIN,\x20PAUSE,\x20TALKING','DATE','enterAt','diff','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[dial\x20string]','talk:[queue]','INTEGER','moment','exports'];(function(_0x1f3d41,_0x172341){var _0x577001=function(_0xd03fa){while(--_0xd03fa){_0x1f3d41['push'](_0x1f3d41['shift']());}};_0x577001(++_0x172341);}(_0x7a72,0x1be));var _0x27a7=function(_0x253029,_0x5e26c4){_0x253029=_0x253029-0x0;var _0x463b73=_0x7a72[_0x253029];return _0x463b73;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x27a7('0x0'));module[_0x27a7('0x1')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x27a7('0x2')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x27a7('0x2')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0x27a7('0x3')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x27a7('0x4')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x320fad){var _0x372bb8=moment(_0x320fad);var _0x5d7305=moment(this['getDataValue'](_0x27a7('0x5')));var _0x54e6ee=_0x372bb8[_0x27a7('0x6')](_0x5d7305,_0x27a7('0x7'));this[_0x27a7('0x8')](_0x27a7('0x9'),_0x320fad);this['setDataValue'](_0x27a7('0xa'),_0x54e6ee||null);}},'data1':{'type':Sequelize[_0x27a7('0x2')],'comment':_0x27a7('0xb')},'data2':{'type':Sequelize['STRING'],'comment':_0x27a7('0xc')},'data3':{'type':Sequelize[_0x27a7('0x2')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0x27a7('0x2')],'comment':_0x27a7('0xd')},'data5':{'type':Sequelize['STRING'],'comment':_0x27a7('0xe')},'role':{'type':Sequelize[_0x27a7('0x2')]},'internal':{'type':Sequelize[_0x27a7('0xf')]},'uniqueid':{'type':Sequelize[_0x27a7('0x2')]}}; \ No newline at end of file +var _0xc112=['setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff'];(function(_0x2d4619,_0x343487){var _0x21a085=function(_0x460f27){while(--_0x460f27){_0x2d4619['push'](_0x2d4619['shift']());}};_0x21a085(++_0x343487);}(_0xc112,0xec));var _0x2c11=function(_0x4ab82e,_0x227cea){_0x4ab82e=_0x4ab82e-0x0;var _0xd15e2a=_0xc112[_0x4ab82e];return _0xd15e2a;};'use strict';var Sequelize=require(_0x2c11('0x0'));var moment=require(_0x2c11('0x1'));module[_0x2c11('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x2c11('0x3')]},'interface':{'type':Sequelize[_0x2c11('0x3')]},'type':{'type':Sequelize[_0x2c11('0x3')],'defaultValue':_0x2c11('0x4'),'comment':_0x2c11('0x5')},'duration':{'type':Sequelize[_0x2c11('0x6')]},'enterAt':{'type':Sequelize[_0x2c11('0x7')]},'exitAt':{'type':Sequelize[_0x2c11('0x7')],'set':function(_0x2337d0){var _0x5c4748=moment(_0x2337d0);var _0x5c2399=moment(this[_0x2c11('0x8')](_0x2c11('0x9')));var _0x29dfcf=_0x5c4748[_0x2c11('0xa')](_0x5c2399,'seconds');this[_0x2c11('0xb')](_0x2c11('0xc'),_0x2337d0);this['setDataValue'](_0x2c11('0xd'),_0x29dfcf||null);}},'data1':{'type':Sequelize[_0x2c11('0x3')],'comment':_0x2c11('0xe')},'data2':{'type':Sequelize[_0x2c11('0x3')],'comment':_0x2c11('0xf')},'data3':{'type':Sequelize['STRING'],'comment':_0x2c11('0x10')},'data4':{'type':Sequelize[_0x2c11('0x3')],'comment':_0x2c11('0x11')},'data5':{'type':Sequelize[_0x2c11('0x3')],'comment':_0x2c11('0x12')},'role':{'type':Sequelize[_0x2c11('0x3')]},'internal':{'type':Sequelize[_0x2c11('0x6')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index fffa945..51d6a9a 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','update','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','then','end','error','stack','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','name','query'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0xedd9,0xfc));var _0x9edd=function(_0x12e751,_0x1b844f){_0x12e751=_0x12e751-0x0;var _0x28f273=_0xedd9[_0x12e751];return _0x28f273;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];function respondWithStatusCode(_0xfd544a,_0x287ddd){_0x287ddd=_0x287ddd||0xcc;return function(_0x3a7b84){if(_0x3a7b84){return _0xfd544a[_0x9edd('0x18')](_0x287ddd);}return _0xfd544a[_0x9edd('0x19')](_0x287ddd)['end']();};}function respondWithResult(_0x176bfa,_0x44fc7c){_0x44fc7c=_0x44fc7c||0xc8;return function(_0x891832){if(_0x891832){return _0x176bfa[_0x9edd('0x19')](_0x44fc7c)[_0x9edd('0x1a')](_0x891832);}};}function respondWithFilteredResult(_0x338f3c,_0x1042aa){return function(_0x75a4ab){if(_0x75a4ab){var _0x4ea60f=typeof _0x1042aa[_0x9edd('0x1b')]===_0x9edd('0x1c')&&typeof _0x1042aa[_0x9edd('0x1d')]==='undefined';var _0x1b54c0=_0x75a4ab[_0x9edd('0x1e')];var _0x40ba32=_0x4ea60f?0x0:_0x1042aa['offset'];var _0x43dc70=_0x4ea60f?_0x75a4ab['count']:_0x1042aa[_0x9edd('0x1b')]+_0x1042aa[_0x9edd('0x1d')];var _0x4bdb88;if(_0x43dc70>=_0x1b54c0){_0x43dc70=_0x1b54c0;_0x4bdb88=0xc8;}else{_0x4bdb88=0xce;}_0x338f3c['status'](_0x4bdb88);return _0x338f3c[_0x9edd('0x1f')]('Content-Range',_0x40ba32+'-'+_0x43dc70+'/'+_0x1b54c0)[_0x9edd('0x1a')](_0x75a4ab);}return null;};}function patchUpdates(_0x54a03f){return function(_0x535f37){try{jsonpatch[_0x9edd('0x20')](_0x535f37,_0x54a03f,!![]);}catch(_0x1c46a8){return BPromise['reject'](_0x1c46a8);}return _0x535f37['save']();};}function saveUpdates(_0x341d67,_0x186186){return function(_0x477878){if(_0x477878){return _0x477878['update'](_0x341d67)[_0x9edd('0x21')](function(_0x1dca43){return _0x1dca43;});}return null;};}function removeEntity(_0x44a6c1,_0x2ca65f){return function(_0x339a0d){if(_0x339a0d){return _0x339a0d['destroy']()[_0x9edd('0x21')](function(){_0x44a6c1[_0x9edd('0x19')](0xcc)[_0x9edd('0x22')]();});}};}function handleEntityNotFound(_0x2f9f86,_0x310a4d){return function(_0x4d507f){if(!_0x4d507f){_0x2f9f86['sendStatus'](0x194);}return _0x4d507f;};}function handleError(_0x3276ee,_0xfeca7b){_0xfeca7b=_0xfeca7b||0x1f4;return function(_0x8d67aa){logger[_0x9edd('0x23')](_0x8d67aa[_0x9edd('0x24')]);if(_0x8d67aa['name']){delete _0x8d67aa['name'];}_0x3276ee[_0x9edd('0x19')](_0xfeca7b)[_0x9edd('0x25')](_0x8d67aa);};}exports[_0x9edd('0x26')]=function(_0x52746a,_0x238b22){var _0x28cfae={},_0x2ae8dd={},_0x41af53={'count':0x0,'rows':[]};var _0x5eccfb=_[_0x9edd('0x27')](db[_0x9edd('0x28')][_0x9edd('0x29')],function(_0x12c1bc){return{'name':_0x12c1bc[_0x9edd('0x2a')],'type':_0x12c1bc[_0x9edd('0x2b')][_0x9edd('0x2c')]};});_0x2ae8dd[_0x9edd('0x2d')]=_[_0x9edd('0x27')](_0x5eccfb,_0x9edd('0x2e'));_0x2ae8dd[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x52746a[_0x9edd('0x2f')]);_0x2ae8dd[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],_0x2ae8dd[_0x9edd('0x2f')]);_0x28cfae[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],qs[_0x9edd('0x34')](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x28cfae[_0x9edd('0x33')]=_0x28cfae[_0x9edd('0x33')][_0x9edd('0x35')]?_0x28cfae[_0x9edd('0x33')]:_0x2ae8dd[_0x9edd('0x2d')];if(!_0x52746a[_0x9edd('0x2f')][_0x9edd('0x36')](_0x9edd('0x37'))){_0x28cfae[_0x9edd('0x1d')]=qs[_0x9edd('0x1d')](_0x52746a[_0x9edd('0x2f')]['limit']);_0x28cfae[_0x9edd('0x1b')]=qs['offset'](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x1b')]);}_0x28cfae[_0x9edd('0x38')]=qs[_0x9edd('0x39')](_0x52746a[_0x9edd('0x2f')]['sort']);_0x28cfae[_0x9edd('0x3a')]=qs[_0x9edd('0x31')](_[_0x9edd('0x3b')](_0x52746a[_0x9edd('0x2f')],_0x2ae8dd[_0x9edd('0x31')]),_0x5eccfb);if(_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]){_0x28cfae[_0x9edd('0x3a')]=_[_0x9edd('0x3d')](_0x28cfae[_0x9edd('0x3a')],{'$or':_['map'](_0x5eccfb,function(_0x231604){if(_0x231604['type']!==_0x9edd('0x3e')){var _0x5658d6={};_0x5658d6[_0x231604[_0x9edd('0x2e')]]={'$like':'%'+_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]+'%'};return _0x5658d6;}})});}_0x28cfae=_['merge']({},_0x28cfae,_0x52746a[_0x9edd('0x3f')]);var _0xcbd0ef={'where':_0x28cfae[_0x9edd('0x3a')]};return db['MemberReport'][_0x9edd('0x1e')](_0xcbd0ef)['then'](function(_0x1fc4fb){_0x41af53[_0x9edd('0x1e')]=_0x1fc4fb;if(_0x52746a['query'][_0x9edd('0x40')]){_0x28cfae[_0x9edd('0x41')]=[{'all':!![]}];}return db[_0x9edd('0x28')][_0x9edd('0x42')](_0x28cfae);})['then'](function(_0x449f01){_0x41af53['rows']=_0x449f01;return _0x41af53;})[_0x9edd('0x21')](respondWithFilteredResult(_0x238b22,_0x28cfae))[_0x9edd('0x43')](handleError(_0x238b22,null));};exports['show']=function(_0x318757,_0x49a128){var _0x548299={'raw':!![],'where':{'id':_0x318757[_0x9edd('0x44')]['id']}},_0x369b69={};_0x369b69[_0x9edd('0x2d')]=_[_0x9edd('0x30')](db[_0x9edd('0x28')][_0x9edd('0x29')]);_0x369b69[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x318757[_0x9edd('0x2f')]);_0x369b69[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x369b69[_0x9edd('0x2d')],_0x369b69[_0x9edd('0x2f')]);_0x548299[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x369b69['model'],qs[_0x9edd('0x34')](_0x318757[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x548299[_0x9edd('0x33')]=_0x548299[_0x9edd('0x33')][_0x9edd('0x35')]?_0x548299[_0x9edd('0x33')]:_0x369b69['model'];if(_0x318757['query']['includeAll']){_0x548299[_0x9edd('0x41')]=[{'all':!![]}];}_0x548299=_['merge']({},_0x548299,_0x318757[_0x9edd('0x3f')]);return db[_0x9edd('0x28')][_0x9edd('0x45')](_0x548299)[_0x9edd('0x21')](handleEntityNotFound(_0x49a128,null))[_0x9edd('0x21')](respondWithResult(_0x49a128,null))['catch'](handleError(_0x49a128,null));};exports[_0x9edd('0x46')]=function(_0x35e63c,_0x40e33d){return db['MemberReport'][_0x9edd('0x46')](_0x35e63c[_0x9edd('0x47')],{})[_0x9edd('0x21')](respondWithResult(_0x40e33d,0xc9))[_0x9edd('0x43')](handleError(_0x40e33d,null));};exports[_0x9edd('0x48')]=function(_0x35bdec,_0x4d4f33){if(_0x35bdec[_0x9edd('0x47')]['id']){delete _0x35bdec[_0x9edd('0x47')]['id'];}return db['MemberReport'][_0x9edd('0x45')]({'where':{'id':_0x35bdec[_0x9edd('0x44')]['id']}})['then'](handleEntityNotFound(_0x4d4f33,null))[_0x9edd('0x21')](saveUpdates(_0x35bdec[_0x9edd('0x47')],null))[_0x9edd('0x21')](respondWithResult(_0x4d4f33,null))['catch'](handleError(_0x4d4f33,null));};exports[_0x9edd('0x49')]=function(_0x151157,_0x317a60){return db[_0x9edd('0x28')]['find']({'where':{'id':_0x151157[_0x9edd('0x44')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x317a60,null))[_0x9edd('0x21')](removeEntity(_0x317a60,null))['catch'](handleError(_0x317a60,null));};exports[_0x9edd('0x4a')]=function(_0x21f6ce,_0x57db43){return db[_0x9edd('0x28')]['describe']()[_0x9edd('0x21')](respondWithResult(_0x57db43,null))[_0x9edd('0x43')](handleError(_0x57db43,null));}; \ No newline at end of file +var _0xedd9=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','update','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','then','end','error','stack','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','name','query'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xedd9,0xfc));var _0x9edd=function(_0x930f73,_0xfe73ea){_0x930f73=_0x930f73-0x0;var _0x47762f=_0xedd9[_0x930f73];return _0x47762f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];function respondWithStatusCode(_0xfd544a,_0x287ddd){_0x287ddd=_0x287ddd||0xcc;return function(_0x3a7b84){if(_0x3a7b84){return _0xfd544a[_0x9edd('0x18')](_0x287ddd);}return _0xfd544a[_0x9edd('0x19')](_0x287ddd)['end']();};}function respondWithResult(_0x176bfa,_0x44fc7c){_0x44fc7c=_0x44fc7c||0xc8;return function(_0x891832){if(_0x891832){return _0x176bfa[_0x9edd('0x19')](_0x44fc7c)[_0x9edd('0x1a')](_0x891832);}};}function respondWithFilteredResult(_0x338f3c,_0x1042aa){return function(_0x75a4ab){if(_0x75a4ab){var _0x4ea60f=typeof _0x1042aa[_0x9edd('0x1b')]===_0x9edd('0x1c')&&typeof _0x1042aa[_0x9edd('0x1d')]==='undefined';var _0x1b54c0=_0x75a4ab[_0x9edd('0x1e')];var _0x40ba32=_0x4ea60f?0x0:_0x1042aa['offset'];var _0x43dc70=_0x4ea60f?_0x75a4ab['count']:_0x1042aa[_0x9edd('0x1b')]+_0x1042aa[_0x9edd('0x1d')];var _0x4bdb88;if(_0x43dc70>=_0x1b54c0){_0x43dc70=_0x1b54c0;_0x4bdb88=0xc8;}else{_0x4bdb88=0xce;}_0x338f3c['status'](_0x4bdb88);return _0x338f3c[_0x9edd('0x1f')]('Content-Range',_0x40ba32+'-'+_0x43dc70+'/'+_0x1b54c0)[_0x9edd('0x1a')](_0x75a4ab);}return null;};}function patchUpdates(_0x54a03f){return function(_0x535f37){try{jsonpatch[_0x9edd('0x20')](_0x535f37,_0x54a03f,!![]);}catch(_0x1c46a8){return BPromise['reject'](_0x1c46a8);}return _0x535f37['save']();};}function saveUpdates(_0x341d67,_0x186186){return function(_0x477878){if(_0x477878){return _0x477878['update'](_0x341d67)[_0x9edd('0x21')](function(_0x1dca43){return _0x1dca43;});}return null;};}function removeEntity(_0x44a6c1,_0x2ca65f){return function(_0x339a0d){if(_0x339a0d){return _0x339a0d['destroy']()[_0x9edd('0x21')](function(){_0x44a6c1[_0x9edd('0x19')](0xcc)[_0x9edd('0x22')]();});}};}function handleEntityNotFound(_0x2f9f86,_0x310a4d){return function(_0x4d507f){if(!_0x4d507f){_0x2f9f86['sendStatus'](0x194);}return _0x4d507f;};}function handleError(_0x3276ee,_0xfeca7b){_0xfeca7b=_0xfeca7b||0x1f4;return function(_0x8d67aa){logger[_0x9edd('0x23')](_0x8d67aa[_0x9edd('0x24')]);if(_0x8d67aa['name']){delete _0x8d67aa['name'];}_0x3276ee[_0x9edd('0x19')](_0xfeca7b)[_0x9edd('0x25')](_0x8d67aa);};}exports[_0x9edd('0x26')]=function(_0x52746a,_0x238b22){var _0x28cfae={},_0x2ae8dd={},_0x41af53={'count':0x0,'rows':[]};var _0x5eccfb=_[_0x9edd('0x27')](db[_0x9edd('0x28')][_0x9edd('0x29')],function(_0x12c1bc){return{'name':_0x12c1bc[_0x9edd('0x2a')],'type':_0x12c1bc[_0x9edd('0x2b')][_0x9edd('0x2c')]};});_0x2ae8dd[_0x9edd('0x2d')]=_[_0x9edd('0x27')](_0x5eccfb,_0x9edd('0x2e'));_0x2ae8dd[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x52746a[_0x9edd('0x2f')]);_0x2ae8dd[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],_0x2ae8dd[_0x9edd('0x2f')]);_0x28cfae[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],qs[_0x9edd('0x34')](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x28cfae[_0x9edd('0x33')]=_0x28cfae[_0x9edd('0x33')][_0x9edd('0x35')]?_0x28cfae[_0x9edd('0x33')]:_0x2ae8dd[_0x9edd('0x2d')];if(!_0x52746a[_0x9edd('0x2f')][_0x9edd('0x36')](_0x9edd('0x37'))){_0x28cfae[_0x9edd('0x1d')]=qs[_0x9edd('0x1d')](_0x52746a[_0x9edd('0x2f')]['limit']);_0x28cfae[_0x9edd('0x1b')]=qs['offset'](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x1b')]);}_0x28cfae[_0x9edd('0x38')]=qs[_0x9edd('0x39')](_0x52746a[_0x9edd('0x2f')]['sort']);_0x28cfae[_0x9edd('0x3a')]=qs[_0x9edd('0x31')](_[_0x9edd('0x3b')](_0x52746a[_0x9edd('0x2f')],_0x2ae8dd[_0x9edd('0x31')]),_0x5eccfb);if(_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]){_0x28cfae[_0x9edd('0x3a')]=_[_0x9edd('0x3d')](_0x28cfae[_0x9edd('0x3a')],{'$or':_['map'](_0x5eccfb,function(_0x231604){if(_0x231604['type']!==_0x9edd('0x3e')){var _0x5658d6={};_0x5658d6[_0x231604[_0x9edd('0x2e')]]={'$like':'%'+_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]+'%'};return _0x5658d6;}})});}_0x28cfae=_['merge']({},_0x28cfae,_0x52746a[_0x9edd('0x3f')]);var _0xcbd0ef={'where':_0x28cfae[_0x9edd('0x3a')]};return db['MemberReport'][_0x9edd('0x1e')](_0xcbd0ef)['then'](function(_0x1fc4fb){_0x41af53[_0x9edd('0x1e')]=_0x1fc4fb;if(_0x52746a['query'][_0x9edd('0x40')]){_0x28cfae[_0x9edd('0x41')]=[{'all':!![]}];}return db[_0x9edd('0x28')][_0x9edd('0x42')](_0x28cfae);})['then'](function(_0x449f01){_0x41af53['rows']=_0x449f01;return _0x41af53;})[_0x9edd('0x21')](respondWithFilteredResult(_0x238b22,_0x28cfae))[_0x9edd('0x43')](handleError(_0x238b22,null));};exports['show']=function(_0x318757,_0x49a128){var _0x548299={'raw':!![],'where':{'id':_0x318757[_0x9edd('0x44')]['id']}},_0x369b69={};_0x369b69[_0x9edd('0x2d')]=_[_0x9edd('0x30')](db[_0x9edd('0x28')][_0x9edd('0x29')]);_0x369b69[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x318757[_0x9edd('0x2f')]);_0x369b69[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x369b69[_0x9edd('0x2d')],_0x369b69[_0x9edd('0x2f')]);_0x548299[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x369b69['model'],qs[_0x9edd('0x34')](_0x318757[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x548299[_0x9edd('0x33')]=_0x548299[_0x9edd('0x33')][_0x9edd('0x35')]?_0x548299[_0x9edd('0x33')]:_0x369b69['model'];if(_0x318757['query']['includeAll']){_0x548299[_0x9edd('0x41')]=[{'all':!![]}];}_0x548299=_['merge']({},_0x548299,_0x318757[_0x9edd('0x3f')]);return db[_0x9edd('0x28')][_0x9edd('0x45')](_0x548299)[_0x9edd('0x21')](handleEntityNotFound(_0x49a128,null))[_0x9edd('0x21')](respondWithResult(_0x49a128,null))['catch'](handleError(_0x49a128,null));};exports[_0x9edd('0x46')]=function(_0x35e63c,_0x40e33d){return db['MemberReport'][_0x9edd('0x46')](_0x35e63c[_0x9edd('0x47')],{})[_0x9edd('0x21')](respondWithResult(_0x40e33d,0xc9))[_0x9edd('0x43')](handleError(_0x40e33d,null));};exports[_0x9edd('0x48')]=function(_0x35bdec,_0x4d4f33){if(_0x35bdec[_0x9edd('0x47')]['id']){delete _0x35bdec[_0x9edd('0x47')]['id'];}return db['MemberReport'][_0x9edd('0x45')]({'where':{'id':_0x35bdec[_0x9edd('0x44')]['id']}})['then'](handleEntityNotFound(_0x4d4f33,null))[_0x9edd('0x21')](saveUpdates(_0x35bdec[_0x9edd('0x47')],null))[_0x9edd('0x21')](respondWithResult(_0x4d4f33,null))['catch'](handleError(_0x4d4f33,null));};exports[_0x9edd('0x49')]=function(_0x151157,_0x317a60){return db[_0x9edd('0x28')]['find']({'where':{'id':_0x151157[_0x9edd('0x44')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x317a60,null))[_0x9edd('0x21')](removeEntity(_0x317a60,null))['catch'](handleError(_0x317a60,null));};exports[_0x9edd('0x4a')]=function(_0x21f6ce,_0x57db43){return db[_0x9edd('0x28')]['describe']()[_0x9edd('0x21')](respondWithResult(_0x57db43,null))[_0x9edd('0x43')](handleError(_0x57db43,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index ef4f92e..11f39ae 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 _0x9f83=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','MemberReport','report_member','membername_interface','membername','interface','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9f83,0x1ac));var _0x39f8=function(_0xc9c0b1,_0x4ecb30){_0xc9c0b1=_0xc9c0b1-0x0;var _0x4ff159=_0x9f83[_0xc9c0b1];return _0x4ff159;};'use strict';var _=require(_0x39f8('0x0'));var util=require('util');var logger=require(_0x39f8('0x1'))(_0x39f8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x39f8('0x3'));var fs=require('fs');var path=require(_0x39f8('0x4'));var rimraf=require(_0x39f8('0x5'));var config=require(_0x39f8('0x6'));var attributes=require(_0x39f8('0x7'));module['exports']=function(_0x34072a,_0x1202cf){return _0x34072a['define'](_0x39f8('0x8'),attributes,{'tableName':_0x39f8('0x9'),'paranoid':![],'indexes':[{'name':_0x39f8('0xa'),'fields':[_0x39f8('0xb'),_0x39f8('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x213f=['../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','exports','MemberReport','report_member','membername','util'];(function(_0x173dd9,_0x4ecf44){var _0x5a0d5a=function(_0x4d731a){while(--_0x4d731a){_0x173dd9['push'](_0x173dd9['shift']());}};_0x5a0d5a(++_0x4ecf44);}(_0x213f,0x1c7));var _0xf213=function(_0x53ceb7,_0x298447){_0x53ceb7=_0x53ceb7-0x0;var _0x10b0de=_0x213f[_0x53ceb7];return _0x10b0de;};'use strict';var _=require('lodash');var util=require(_0xf213('0x0'));var logger=require(_0xf213('0x1'))('api');var moment=require(_0xf213('0x2'));var BPromise=require('bluebird');var rp=require(_0xf213('0x3'));var fs=require('fs');var path=require(_0xf213('0x4'));var rimraf=require(_0xf213('0x5'));var config=require(_0xf213('0x6'));var attributes=require(_0xf213('0x7'));module[_0xf213('0x8')]=function(_0x4795b3,_0x513fed){return _0x4795b3['define'](_0xf213('0x9'),attributes,{'tableName':_0xf213('0xa'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0xf213('0xb'),'interface']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 1e38f76..05214ef 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 _0x1a61=['http','request','then','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','MemberReport,\x20%s,\x20%s','message','request\x20sent','result','GetMemberReport','MemberReport','findAll','options','raw','where','attributes','limit','include','model','map','info','catch','CreateMemberReport','create','body','UpdateMemberReport','update','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise'];(function(_0x2e4e80,_0xdd09e3){var _0x4e021f=function(_0x4e7702){while(--_0x4e7702){_0x2e4e80['push'](_0x2e4e80['shift']());}};_0x4e021f(++_0xdd09e3);}(_0x1a61,0x1e6));var _0x11a6=function(_0x1959a3,_0x32df63){_0x1959a3=_0x1959a3-0x0;var _0x19f0b4=_0x1a61[_0x1959a3];return _0x19f0b4;};'use strict';var _=require(_0x11a6('0x0'));var util=require('util');var moment=require(_0x11a6('0x1'));var BPromise=require('bluebird');var rs=require(_0x11a6('0x2'));var fs=require('fs');var Redis=require(_0x11a6('0x3'));var db=require(_0x11a6('0x4'))['db'];var utils=require(_0x11a6('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x11a6('0x6'));var jayson=require(_0x11a6('0x7'));var client=jayson['client'][_0x11a6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1c4b31,_0x124855,_0x333ec2){return new BPromise(function(_0x1c67ce,_0x33b9b4){return client[_0x11a6('0x9')](_0x1c4b31,_0x333ec2)[_0x11a6('0xa')](function(_0x1a7d57){logger['info']('MemberReport,\x20%s,\x20%s',_0x124855,'request\x20sent');logger[_0x11a6('0xb')](_0x11a6('0xc'),_0x124855,'request\x20sent',JSON[_0x11a6('0xd')](_0x1a7d57));if(_0x1a7d57[_0x11a6('0xe')]){if(_0x1a7d57[_0x11a6('0xe')][_0x11a6('0xf')]===0x1f4){logger[_0x11a6('0xe')](_0x11a6('0x10'),_0x124855,_0x1a7d57['error']['message']);return _0x33b9b4(_0x1a7d57[_0x11a6('0xe')][_0x11a6('0x11')]);}logger['error'](_0x11a6('0x10'),_0x124855,_0x1a7d57[_0x11a6('0xe')]['message']);return _0x1c67ce(_0x1a7d57[_0x11a6('0xe')][_0x11a6('0x11')]);}else{logger['info'](_0x11a6('0x10'),_0x124855,_0x11a6('0x12'));_0x1c67ce(_0x1a7d57[_0x11a6('0x13')][_0x11a6('0x11')]);}})['catch'](function(_0x3d6457){logger[_0x11a6('0xe')](_0x11a6('0x10'),_0x124855,_0x3d6457);_0x33b9b4(_0x3d6457);});});}exports[_0x11a6('0x14')]=function(_0x1a9d43){var _0x1e3cdd=this;return new Promise(function(_0x2449bf,_0x2d9721){return db[_0x11a6('0x15')][_0x11a6('0x16')]({'raw':_0x1a9d43[_0x11a6('0x17')]?_0x1a9d43[_0x11a6('0x17')][_0x11a6('0x18')]===undefined?!![]:![]:!![],'where':_0x1a9d43[_0x11a6('0x17')]?_0x1a9d43['options'][_0x11a6('0x19')]||null:null,'attributes':_0x1a9d43[_0x11a6('0x17')]?_0x1a9d43[_0x11a6('0x17')][_0x11a6('0x1a')]||null:null,'limit':_0x1a9d43['options']?_0x1a9d43['options'][_0x11a6('0x1b')]||null:null,'include':_0x1a9d43['options']?_0x1a9d43[_0x11a6('0x17')]['include']?_['map'](_0x1a9d43['options']['include'],function(_0x111a63){return{'model':db[_0x111a63['model']],'as':_0x111a63['as'],'attributes':_0x111a63[_0x11a6('0x1a')],'include':_0x111a63[_0x11a6('0x1c')]?_['map'](_0x111a63['include'],function(_0x2ffd7f){return{'model':db[_0x2ffd7f[_0x11a6('0x1d')]],'as':_0x2ffd7f['as'],'attributes':_0x2ffd7f[_0x11a6('0x1a')],'include':_0x2ffd7f[_0x11a6('0x1c')]?_[_0x11a6('0x1e')](_0x2ffd7f[_0x11a6('0x1c')],function(_0x40e3b4){return{'model':db[_0x40e3b4[_0x11a6('0x1d')]],'as':_0x40e3b4['as'],'attributes':_0x40e3b4[_0x11a6('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x11a6('0xa')](function(_0x1ceb50){logger[_0x11a6('0x1f')](_0x11a6('0x14'),_0x1a9d43);logger[_0x11a6('0xb')](_0x11a6('0x14'),_0x1a9d43,JSON[_0x11a6('0xd')](_0x1ceb50));_0x2449bf(_0x1ceb50);})[_0x11a6('0x20')](function(_0x1b7f4e){logger[_0x11a6('0xe')](_0x11a6('0x14'),_0x1b7f4e[_0x11a6('0x11')],_0x1a9d43);_0x2d9721(_0x1e3cdd[_0x11a6('0xe')](0x1f4,_0x1b7f4e[_0x11a6('0x11')]));});});};exports[_0x11a6('0x21')]=function(_0x3827e3){var _0x56f74d=this;return new Promise(function(_0x3ff058,_0x56f3e9){return db[_0x11a6('0x15')][_0x11a6('0x22')](_0x3827e3[_0x11a6('0x23')],{'raw':_0x3827e3[_0x11a6('0x17')]?_0x3827e3[_0x11a6('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x11a6('0xa')](function(_0x3bc3d2){logger['info']('CreateMemberReport',_0x3827e3);logger['debug'](_0x11a6('0x21'),_0x3827e3,JSON[_0x11a6('0xd')](_0x3bc3d2));_0x3ff058(_0x3bc3d2);})['catch'](function(_0x3c24f3){logger[_0x11a6('0xe')](_0x11a6('0x21'),_0x3c24f3[_0x11a6('0x11')],_0x3827e3);_0x56f3e9(_0x56f74d[_0x11a6('0xe')](0x1f4,_0x3c24f3['message']));});});};exports[_0x11a6('0x24')]=function(_0x226546){var _0x46d825=this;return new Promise(function(_0x2449fb,_0x36c352){return db[_0x11a6('0x15')][_0x11a6('0x25')](_0x226546[_0x11a6('0x23')],{'raw':_0x226546[_0x11a6('0x17')]?_0x226546[_0x11a6('0x17')][_0x11a6('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x226546[_0x11a6('0x17')]?_0x226546[_0x11a6('0x17')]['where']||null:null,'attributes':_0x226546[_0x11a6('0x17')]?_0x226546[_0x11a6('0x17')][_0x11a6('0x1a')]||null:null,'limit':_0x226546[_0x11a6('0x17')]?_0x226546[_0x11a6('0x17')][_0x11a6('0x1b')]||null:null})[_0x11a6('0xa')](function(_0x3a89b8){logger[_0x11a6('0x1f')]('UpdateMemberReport',_0x226546);logger[_0x11a6('0xb')](_0x11a6('0x24'),_0x226546,JSON['stringify'](_0x3a89b8));_0x2449fb(_0x3a89b8);})[_0x11a6('0x20')](function(_0x745617){logger[_0x11a6('0xe')]('UpdateMemberReport',_0x745617[_0x11a6('0x11')],_0x226546);_0x36c352(_0x46d825[_0x11a6('0xe')](0x1f4,_0x745617['message']));});});}; \ No newline at end of file +var _0x9e54=['request','info','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','MemberReport,\x20%s,\x20%s','message','result','catch','GetMemberReport','findAll','options','raw','where','attributes','limit','include','model','map','CreateMemberReport','MemberReport','create','then','update','body','UpdateMemberReport','lodash','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9e54,0x88));var _0x49e5=function(_0x2eefb5,_0x4b29ab){_0x2eefb5=_0x2eefb5-0x0;var _0x451691=_0x9e54[_0x2eefb5];return _0x451691;};'use strict';var _=require(_0x49e5('0x0'));var util=require(_0x49e5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x49e5('0x2'));var db=require(_0x49e5('0x3'))['db'];var utils=require(_0x49e5('0x4'));var logger=require('../../config/logger')(_0x49e5('0x5'));var config=require(_0x49e5('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49e5('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x558b73,_0x21e166,_0x48059c){return new BPromise(function(_0x1a6b60,_0x234dd3){return client[_0x49e5('0x8')](_0x558b73,_0x48059c)['then'](function(_0x51bcbc){logger[_0x49e5('0x9')]('MemberReport,\x20%s,\x20%s',_0x21e166,_0x49e5('0xa'));logger[_0x49e5('0xb')](_0x49e5('0xc'),_0x21e166,_0x49e5('0xa'),JSON[_0x49e5('0xd')](_0x51bcbc));if(_0x51bcbc['error']){if(_0x51bcbc[_0x49e5('0xe')]['code']===0x1f4){logger[_0x49e5('0xe')](_0x49e5('0xf'),_0x21e166,_0x51bcbc[_0x49e5('0xe')][_0x49e5('0x10')]);return _0x234dd3(_0x51bcbc[_0x49e5('0xe')]['message']);}logger['error'](_0x49e5('0xf'),_0x21e166,_0x51bcbc[_0x49e5('0xe')]['message']);return _0x1a6b60(_0x51bcbc['error'][_0x49e5('0x10')]);}else{logger['info'](_0x49e5('0xf'),_0x21e166,'request\x20sent');_0x1a6b60(_0x51bcbc[_0x49e5('0x11')][_0x49e5('0x10')]);}})[_0x49e5('0x12')](function(_0x568cfb){logger[_0x49e5('0xe')](_0x49e5('0xf'),_0x21e166,_0x568cfb);_0x234dd3(_0x568cfb);});});}exports[_0x49e5('0x13')]=function(_0x1e2723){var _0xfc4935=this;return new Promise(function(_0xff869e,_0x3ba258){return db['MemberReport'][_0x49e5('0x14')]({'raw':_0x1e2723[_0x49e5('0x15')]?_0x1e2723['options'][_0x49e5('0x16')]===undefined?!![]:![]:!![],'where':_0x1e2723['options']?_0x1e2723[_0x49e5('0x15')][_0x49e5('0x17')]||null:null,'attributes':_0x1e2723['options']?_0x1e2723[_0x49e5('0x15')][_0x49e5('0x18')]||null:null,'limit':_0x1e2723[_0x49e5('0x15')]?_0x1e2723[_0x49e5('0x15')][_0x49e5('0x19')]||null:null,'include':_0x1e2723[_0x49e5('0x15')]?_0x1e2723['options'][_0x49e5('0x1a')]?_['map'](_0x1e2723[_0x49e5('0x15')][_0x49e5('0x1a')],function(_0x1033ed){return{'model':db[_0x1033ed[_0x49e5('0x1b')]],'as':_0x1033ed['as'],'attributes':_0x1033ed[_0x49e5('0x18')],'include':_0x1033ed[_0x49e5('0x1a')]?_['map'](_0x1033ed['include'],function(_0xd96520){return{'model':db[_0xd96520[_0x49e5('0x1b')]],'as':_0xd96520['as'],'attributes':_0xd96520['attributes'],'include':_0xd96520[_0x49e5('0x1a')]?_[_0x49e5('0x1c')](_0xd96520[_0x49e5('0x1a')],function(_0x16f98f){return{'model':db[_0x16f98f[_0x49e5('0x1b')]],'as':_0x16f98f['as'],'attributes':_0x16f98f[_0x49e5('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xadf789){logger[_0x49e5('0x9')](_0x49e5('0x13'),_0x1e2723);logger['debug'](_0x49e5('0x13'),_0x1e2723,JSON['stringify'](_0xadf789));_0xff869e(_0xadf789);})[_0x49e5('0x12')](function(_0x46a5be){logger['error']('GetMemberReport',_0x46a5be[_0x49e5('0x10')],_0x1e2723);_0x3ba258(_0xfc4935[_0x49e5('0xe')](0x1f4,_0x46a5be['message']));});});};exports[_0x49e5('0x1d')]=function(_0x5c0cb8){var _0x36d49e=this;return new Promise(function(_0x1ce332,_0x9408b6){return db[_0x49e5('0x1e')][_0x49e5('0x1f')](_0x5c0cb8['body'],{'raw':_0x5c0cb8[_0x49e5('0x15')]?_0x5c0cb8[_0x49e5('0x15')][_0x49e5('0x16')]===undefined?!![]:![]:!![]})[_0x49e5('0x20')](function(_0x29c72e){logger['info'](_0x49e5('0x1d'),_0x5c0cb8);logger[_0x49e5('0xb')]('CreateMemberReport',_0x5c0cb8,JSON[_0x49e5('0xd')](_0x29c72e));_0x1ce332(_0x29c72e);})['catch'](function(_0x579451){logger[_0x49e5('0xe')](_0x49e5('0x1d'),_0x579451['message'],_0x5c0cb8);_0x9408b6(_0x36d49e['error'](0x1f4,_0x579451[_0x49e5('0x10')]));});});};exports['UpdateMemberReport']=function(_0x163268){var _0x40b46b=this;return new Promise(function(_0x3dfda0,_0x3eb888){return db[_0x49e5('0x1e')][_0x49e5('0x21')](_0x163268[_0x49e5('0x22')],{'raw':_0x163268[_0x49e5('0x15')]?_0x163268[_0x49e5('0x15')][_0x49e5('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x163268['options']?_0x163268[_0x49e5('0x15')]['where']||null:null,'attributes':_0x163268['options']?_0x163268[_0x49e5('0x15')][_0x49e5('0x18')]||null:null,'limit':_0x163268[_0x49e5('0x15')]?_0x163268[_0x49e5('0x15')][_0x49e5('0x19')]||null:null})[_0x49e5('0x20')](function(_0x3d4810){logger[_0x49e5('0x9')](_0x49e5('0x23'),_0x163268);logger[_0x49e5('0xb')](_0x49e5('0x23'),_0x163268,JSON[_0x49e5('0xd')](_0x3d4810));_0x3dfda0(_0x3d4810);})[_0x49e5('0x12')](function(_0x2e5a10){logger[_0x49e5('0xe')]('UpdateMemberReport',_0x2e5a10[_0x49e5('0x10')],_0x163268);_0x3eb888(_0x40b46b['error'](0x1f4,_0x2e5a10[_0x49e5('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 66e101a..3f82c9e 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 _0x4ba1=['./migration.controller','get','index','exports','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3464f1,_0x28984a){var _0x3da305=function(_0x481c2f){while(--_0x481c2f){_0x3464f1['push'](_0x3464f1['shift']());}};_0x3da305(++_0x28984a);}(_0x4ba1,0x79));var _0x14ba=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x4ba1[_0x160c73];return _0xd9302;};'use strict';var multer=require('multer');var util=require(_0x14ba('0x0'));var path=require('path');var timeout=require(_0x14ba('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x14ba('0x2'));var auth=require(_0x14ba('0x3'));var interaction=require(_0x14ba('0x4'));var config=require('../../config/environment');var controller=require(_0x14ba('0x5'));router[_0x14ba('0x6')]('/',controller[_0x14ba('0x7')]);module[_0x14ba('0x8')]=router; \ No newline at end of file +var _0xc627=['../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x22f74d,_0x48057e){var _0x24c6a6=function(_0x21a0b0){while(--_0x21a0b0){_0x22f74d['push'](_0x22f74d['shift']());}};_0x24c6a6(++_0x48057e);}(_0xc627,0x14a));var _0x7c62=function(_0x283471,_0x26910c){_0x283471=_0x283471-0x0;var _0x5f48f1=_0xc627[_0x283471];return _0x5f48f1;};'use strict';var multer=require('multer');var util=require(_0x7c62('0x0'));var path=require(_0x7c62('0x1'));var timeout=require(_0x7c62('0x2'));var express=require('express');var router=express[_0x7c62('0x3')]();var fs_extra=require(_0x7c62('0x4'));var auth=require(_0x7c62('0x5'));var interaction=require(_0x7c62('0x6'));var config=require(_0x7c62('0x7'));var controller=require(_0x7c62('0x8'));router[_0x7c62('0x9')]('/',controller[_0x7c62('0xa')]);module[_0x7c62('0xb')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 368eb3b..187d69c 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 _0xdc99=['STRING','exports'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xdc99,0x119));var _0x9dc9=function(_0x3a7634,_0x2db384){_0x3a7634=_0x3a7634-0x0;var _0x23bbe9=_0xdc99[_0x3a7634];return _0x23bbe9;};'use strict';var Sequelize=require('sequelize');module[_0x9dc9('0x0')]={'version':{'type':Sequelize[_0x9dc9('0x1')],'unique':'version'}}; \ No newline at end of file +var _0x34ae=['exports','version'];(function(_0xe4964d,_0xc17f64){var _0x4d11db=function(_0xe76bdc){while(--_0xe76bdc){_0xe4964d['push'](_0xe4964d['shift']());}};_0x4d11db(++_0xc17f64);}(_0x34ae,0x1c6));var _0xe34a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x34ae[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xe34a('0x0')]={'version':{'type':Sequelize['STRING'],'unique':_0xe34a('0x1')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 66e56b3..a945752 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 _0xcc88=['limit','count','set','reject','update','destroy','then','stack','name','send','index','Migration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','map','includeAll','findAll','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined'];(function(_0x534c8f,_0x500079){var _0x5a57f5=function(_0x38ec0a){while(--_0x38ec0a){_0x534c8f['push'](_0x534c8f['shift']());}};_0x5a57f5(++_0x500079);}(_0xcc88,0x128));var _0x8cc8=function(_0x38eaa2,_0x5759f5){_0x38eaa2=_0x38eaa2-0x0;var _0x1d42cc=_0xcc88[_0x38eaa2];return _0x1d42cc;};'use strict';var emlformat=require(_0x8cc8('0x0'));var rimraf=require(_0x8cc8('0x1'));var zipdir=require(_0x8cc8('0x2'));var jsonpatch=require(_0x8cc8('0x3'));var rp=require(_0x8cc8('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8cc8('0x5'));var util=require(_0x8cc8('0x6'));var path=require('path');var sox=require(_0x8cc8('0x7'));var csv=require(_0x8cc8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8cc8('0x9'));var _=require(_0x8cc8('0xa'));var squel=require('squel');var crypto=require(_0x8cc8('0xb'));var jsforce=require(_0x8cc8('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8cc8('0x8'));var querystring=require(_0x8cc8('0xd'));var Papa=require(_0x8cc8('0xe'));var Redis=require(_0x8cc8('0xf'));var authService=require(_0x8cc8('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8cc8('0x11'));var hardwareService=require(_0x8cc8('0x12'));var logger=require(_0x8cc8('0x13'))('api');var utils=require(_0x8cc8('0x14'));var config=require(_0x8cc8('0x15'));var licenseUtil=require(_0x8cc8('0x16'));var db=require(_0x8cc8('0x17'))['db'];function respondWithStatusCode(_0x48d3d9,_0x1b7588){_0x1b7588=_0x1b7588||0xcc;return function(_0x5034b5){if(_0x5034b5){return _0x48d3d9[_0x8cc8('0x18')](_0x1b7588);}return _0x48d3d9[_0x8cc8('0x19')](_0x1b7588)['end']();};}function respondWithResult(_0x54cefa,_0x1a9641){_0x1a9641=_0x1a9641||0xc8;return function(_0x5aa392){if(_0x5aa392){return _0x54cefa[_0x8cc8('0x19')](_0x1a9641)[_0x8cc8('0x1a')](_0x5aa392);}};}function respondWithFilteredResult(_0x45ebe7,_0x4897b3){return function(_0x2a8ac4){if(_0x2a8ac4){var _0x4122e7=typeof _0x4897b3[_0x8cc8('0x1b')]===_0x8cc8('0x1c')&&typeof _0x4897b3[_0x8cc8('0x1d')]==='undefined';var _0xaefa00=_0x2a8ac4[_0x8cc8('0x1e')];var _0x352368=_0x4122e7?0x0:_0x4897b3['offset'];var _0x27ad8c=_0x4122e7?_0x2a8ac4[_0x8cc8('0x1e')]:_0x4897b3[_0x8cc8('0x1b')]+_0x4897b3[_0x8cc8('0x1d')];var _0x589056;if(_0x27ad8c>=_0xaefa00){_0x27ad8c=_0xaefa00;_0x589056=0xc8;}else{_0x589056=0xce;}_0x45ebe7['status'](_0x589056);return _0x45ebe7[_0x8cc8('0x1f')]('Content-Range',_0x352368+'-'+_0x27ad8c+'/'+_0xaefa00)['json'](_0x2a8ac4);}return null;};}function patchUpdates(_0x31ffba){return function(_0x2f3aef){try{jsonpatch['apply'](_0x2f3aef,_0x31ffba,!![]);}catch(_0x2573ab){return BPromise[_0x8cc8('0x20')](_0x2573ab);}return _0x2f3aef['save']();};}function saveUpdates(_0x22a6d8,_0x46d042){return function(_0x52dc04){if(_0x52dc04){return _0x52dc04[_0x8cc8('0x21')](_0x22a6d8)['then'](function(_0x4b30e8){return _0x4b30e8;});}return null;};}function removeEntity(_0x282776,_0x406423){return function(_0x5a2778){if(_0x5a2778){return _0x5a2778[_0x8cc8('0x22')]()[_0x8cc8('0x23')](function(){_0x282776[_0x8cc8('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4aecd1,_0x242651){return function(_0x1f6991){if(!_0x1f6991){_0x4aecd1['sendStatus'](0x194);}return _0x1f6991;};}function handleError(_0xd62308,_0x4477b5){_0x4477b5=_0x4477b5||0x1f4;return function(_0x1c3ea2){logger['error'](_0x1c3ea2[_0x8cc8('0x24')]);if(_0x1c3ea2[_0x8cc8('0x25')]){delete _0x1c3ea2[_0x8cc8('0x25')];}_0xd62308[_0x8cc8('0x19')](_0x4477b5)[_0x8cc8('0x26')](_0x1c3ea2);};}exports[_0x8cc8('0x27')]=function(_0xce1111,_0x2932c0){var _0x260a40={},_0x15282e={},_0x51c6cb={'count':0x0,'rows':[]};var _0x53a79c=_['map'](db[_0x8cc8('0x28')][_0x8cc8('0x29')],function(_0x3cca87){return{'name':_0x3cca87[_0x8cc8('0x2a')],'type':_0x3cca87[_0x8cc8('0x2b')][_0x8cc8('0x2c')]};});_0x15282e[_0x8cc8('0x2d')]=_['map'](_0x53a79c,_0x8cc8('0x25'));_0x15282e[_0x8cc8('0x2e')]=_[_0x8cc8('0x2f')](_0xce1111[_0x8cc8('0x2e')]);_0x15282e[_0x8cc8('0x30')]=_[_0x8cc8('0x31')](_0x15282e[_0x8cc8('0x2d')],_0x15282e[_0x8cc8('0x2e')]);_0x260a40[_0x8cc8('0x32')]=_[_0x8cc8('0x31')](_0x15282e[_0x8cc8('0x2d')],qs[_0x8cc8('0x33')](_0xce1111[_0x8cc8('0x2e')]['fields']));_0x260a40[_0x8cc8('0x32')]=_0x260a40[_0x8cc8('0x32')][_0x8cc8('0x34')]?_0x260a40[_0x8cc8('0x32')]:_0x15282e[_0x8cc8('0x2d')];if(!_0xce1111[_0x8cc8('0x2e')][_0x8cc8('0x35')](_0x8cc8('0x36'))){_0x260a40[_0x8cc8('0x1d')]=qs[_0x8cc8('0x1d')](_0xce1111['query']['limit']);_0x260a40[_0x8cc8('0x1b')]=qs[_0x8cc8('0x1b')](_0xce1111[_0x8cc8('0x2e')][_0x8cc8('0x1b')]);}_0x260a40[_0x8cc8('0x37')]=qs[_0x8cc8('0x38')](_0xce1111[_0x8cc8('0x2e')][_0x8cc8('0x38')]);_0x260a40['where']=qs[_0x8cc8('0x30')](_['pick'](_0xce1111['query'],_0x15282e[_0x8cc8('0x30')]),_0x53a79c);if(_0xce1111[_0x8cc8('0x2e')][_0x8cc8('0x39')]){_0x260a40[_0x8cc8('0x3a')]=_[_0x8cc8('0x3b')](_0x260a40[_0x8cc8('0x3a')],{'$or':_[_0x8cc8('0x3c')](_0x53a79c,function(_0x7ef61){if(_0x7ef61[_0x8cc8('0x2b')]!=='VIRTUAL'){var _0x5dc03f={};_0x5dc03f[_0x7ef61[_0x8cc8('0x25')]]={'$like':'%'+_0xce1111[_0x8cc8('0x2e')][_0x8cc8('0x39')]+'%'};return _0x5dc03f;}})});}_0x260a40=_[_0x8cc8('0x3b')]({},_0x260a40,_0xce1111['options']);var _0x44f0aa={'where':_0x260a40[_0x8cc8('0x3a')]};return db[_0x8cc8('0x28')]['count'](_0x44f0aa)[_0x8cc8('0x23')](function(_0xc1ebd4){_0x51c6cb[_0x8cc8('0x1e')]=_0xc1ebd4;if(_0xce1111[_0x8cc8('0x2e')][_0x8cc8('0x3d')]){_0x260a40['include']=[{'all':!![]}];}return db[_0x8cc8('0x28')][_0x8cc8('0x3e')](_0x260a40);})['then'](function(_0x188800){_0x51c6cb[_0x8cc8('0x3f')]=_0x188800;return _0x51c6cb;})[_0x8cc8('0x23')](respondWithFilteredResult(_0x2932c0,_0x260a40))[_0x8cc8('0x40')](handleError(_0x2932c0,null));}; \ No newline at end of file +var _0xf22e=['limit','set','json','apply','save','update','then','name','send','index','map','rawAttributes','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','Migration','count','includeAll','include','findAll','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined'];(function(_0x175a9c,_0x48c950){var _0x31a75f=function(_0xa8d5e1){while(--_0xa8d5e1){_0x175a9c['push'](_0x175a9c['shift']());}};_0x31a75f(++_0x48c950);}(_0xf22e,0x94));var _0xef22=function(_0x407318,_0x42f85e){_0x407318=_0x407318-0x0;var _0x398675=_0xf22e[_0x407318];return _0x398675;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xef22('0x0'));var zipdir=require(_0xef22('0x1'));var jsonpatch=require(_0xef22('0x2'));var rp=require(_0xef22('0x3'));var moment=require(_0xef22('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xef22('0x5'));var sox=require('sox');var csv=require(_0xef22('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xef22('0x7'));var _=require('lodash');var squel=require(_0xef22('0x8'));var crypto=require(_0xef22('0x9'));var jsforce=require(_0xef22('0xa'));var deskjs=require(_0xef22('0xb'));var toCsv=require(_0xef22('0x6'));var querystring=require(_0xef22('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xef22('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xef22('0xe'));var logger=require('../../config/logger')(_0xef22('0xf'));var utils=require('../../config/utils');var config=require(_0xef22('0x10'));var licenseUtil=require(_0xef22('0x11'));var db=require(_0xef22('0x12'))['db'];function respondWithStatusCode(_0x58d4a4,_0x442289){_0x442289=_0x442289||0xcc;return function(_0x12e081){if(_0x12e081){return _0x58d4a4[_0xef22('0x13')](_0x442289);}return _0x58d4a4[_0xef22('0x14')](_0x442289)['end']();};}function respondWithResult(_0xed415c,_0x52a54d){_0x52a54d=_0x52a54d||0xc8;return function(_0x326e9e){if(_0x326e9e){return _0xed415c[_0xef22('0x14')](_0x52a54d)['json'](_0x326e9e);}};}function respondWithFilteredResult(_0x362c1e,_0x15bca9){return function(_0x1d02ec){if(_0x1d02ec){var _0x19fa73=typeof _0x15bca9[_0xef22('0x15')]===_0xef22('0x16')&&typeof _0x15bca9['limit']===_0xef22('0x16');var _0x5049d3=_0x1d02ec['count'];var _0x555087=_0x19fa73?0x0:_0x15bca9[_0xef22('0x15')];var _0x386393=_0x19fa73?_0x1d02ec['count']:_0x15bca9[_0xef22('0x15')]+_0x15bca9[_0xef22('0x17')];var _0x673310;if(_0x386393>=_0x5049d3){_0x386393=_0x5049d3;_0x673310=0xc8;}else{_0x673310=0xce;}_0x362c1e[_0xef22('0x14')](_0x673310);return _0x362c1e[_0xef22('0x18')]('Content-Range',_0x555087+'-'+_0x386393+'/'+_0x5049d3)[_0xef22('0x19')](_0x1d02ec);}return null;};}function patchUpdates(_0x1f090c){return function(_0x19ffec){try{jsonpatch[_0xef22('0x1a')](_0x19ffec,_0x1f090c,!![]);}catch(_0x4da39f){return BPromise['reject'](_0x4da39f);}return _0x19ffec[_0xef22('0x1b')]();};}function saveUpdates(_0x516fd4,_0x1ae17e){return function(_0x421432){if(_0x421432){return _0x421432[_0xef22('0x1c')](_0x516fd4)[_0xef22('0x1d')](function(_0x344d08){return _0x344d08;});}return null;};}function removeEntity(_0x4debaf,_0x5ec2b8){return function(_0x24347e){if(_0x24347e){return _0x24347e['destroy']()['then'](function(){_0x4debaf[_0xef22('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30f9b1,_0x4dd096){return function(_0x19b688){if(!_0x19b688){_0x30f9b1[_0xef22('0x13')](0x194);}return _0x19b688;};}function handleError(_0x1e12be,_0x1d7ecc){_0x1d7ecc=_0x1d7ecc||0x1f4;return function(_0x18c377){logger['error'](_0x18c377['stack']);if(_0x18c377[_0xef22('0x1e')]){delete _0x18c377[_0xef22('0x1e')];}_0x1e12be[_0xef22('0x14')](_0x1d7ecc)[_0xef22('0x1f')](_0x18c377);};}exports[_0xef22('0x20')]=function(_0x3811e2,_0x126218){var _0x504be1={},_0x1de764={},_0x4be2f6={'count':0x0,'rows':[]};var _0x26250b=_[_0xef22('0x21')](db['Migration'][_0xef22('0x22')],function(_0x41b760){return{'name':_0x41b760['fieldName'],'type':_0x41b760[_0xef22('0x23')][_0xef22('0x24')]};});_0x1de764[_0xef22('0x25')]=_[_0xef22('0x21')](_0x26250b,_0xef22('0x1e'));_0x1de764[_0xef22('0x26')]=_[_0xef22('0x27')](_0x3811e2[_0xef22('0x26')]);_0x1de764['filters']=_[_0xef22('0x28')](_0x1de764[_0xef22('0x25')],_0x1de764[_0xef22('0x26')]);_0x504be1[_0xef22('0x29')]=_[_0xef22('0x28')](_0x1de764[_0xef22('0x25')],qs['fields'](_0x3811e2[_0xef22('0x26')]['fields']));_0x504be1[_0xef22('0x29')]=_0x504be1[_0xef22('0x29')][_0xef22('0x2a')]?_0x504be1[_0xef22('0x29')]:_0x1de764[_0xef22('0x25')];if(!_0x3811e2[_0xef22('0x26')][_0xef22('0x2b')](_0xef22('0x2c'))){_0x504be1[_0xef22('0x17')]=qs[_0xef22('0x17')](_0x3811e2['query'][_0xef22('0x17')]);_0x504be1['offset']=qs['offset'](_0x3811e2[_0xef22('0x26')]['offset']);}_0x504be1['order']=qs[_0xef22('0x2d')](_0x3811e2[_0xef22('0x26')][_0xef22('0x2d')]);_0x504be1[_0xef22('0x2e')]=qs[_0xef22('0x2f')](_[_0xef22('0x30')](_0x3811e2[_0xef22('0x26')],_0x1de764['filters']),_0x26250b);if(_0x3811e2[_0xef22('0x26')][_0xef22('0x31')]){_0x504be1[_0xef22('0x2e')]=_[_0xef22('0x32')](_0x504be1[_0xef22('0x2e')],{'$or':_[_0xef22('0x21')](_0x26250b,function(_0x19e052){if(_0x19e052[_0xef22('0x23')]!==_0xef22('0x33')){var _0x4a9214={};_0x4a9214[_0x19e052['name']]={'$like':'%'+_0x3811e2[_0xef22('0x26')][_0xef22('0x31')]+'%'};return _0x4a9214;}})});}_0x504be1=_['merge']({},_0x504be1,_0x3811e2['options']);var _0x2aafd2={'where':_0x504be1[_0xef22('0x2e')]};return db[_0xef22('0x34')]['count'](_0x2aafd2)[_0xef22('0x1d')](function(_0xb10bc1){_0x4be2f6[_0xef22('0x35')]=_0xb10bc1;if(_0x3811e2[_0xef22('0x26')][_0xef22('0x36')]){_0x504be1[_0xef22('0x37')]=[{'all':!![]}];}return db[_0xef22('0x34')][_0xef22('0x38')](_0x504be1);})[_0xef22('0x1d')](function(_0x458deb){_0x4be2f6['rows']=_0x458deb;return _0x4be2f6;})[_0xef22('0x1d')](respondWithFilteredResult(_0x126218,_0x504be1))['catch'](handleError(_0x126218,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 07b8b7f..1cbf1fd 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 _0xae52=['migrations','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./migration.attributes','exports','define'];(function(_0x22ac92,_0x5b15e8){var _0x489cde=function(_0xa927cf){while(--_0xa927cf){_0x22ac92['push'](_0x22ac92['shift']());}};_0x489cde(++_0x5b15e8);}(_0xae52,0x11f));var _0x2ae5=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0xae52[_0x513aa5];return _0x1a1a7c;};'use strict';var _=require('lodash');var util=require(_0x2ae5('0x0'));var logger=require(_0x2ae5('0x1'))(_0x2ae5('0x2'));var moment=require(_0x2ae5('0x3'));var BPromise=require(_0x2ae5('0x4'));var rp=require(_0x2ae5('0x5'));var fs=require('fs');var path=require(_0x2ae5('0x6'));var rimraf=require(_0x2ae5('0x7'));var config=require(_0x2ae5('0x8'));var attributes=require(_0x2ae5('0x9'));module[_0x2ae5('0xa')]=function(_0x39ff98,_0x415d9d){return _0x39ff98[_0x2ae5('0xb')]('Migration',attributes,{'tableName':_0x2ae5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc4dd=['Migration','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./migration.attributes','define'];(function(_0x243a39,_0x4c9b51){var _0x5620a2=function(_0x16a997){while(--_0x16a997){_0x243a39['push'](_0x243a39['shift']());}};_0x5620a2(++_0x4c9b51);}(_0xc4dd,0x177));var _0xdc4d=function(_0x252df7,_0x394629){_0x252df7=_0x252df7-0x0;var _0x2f78d2=_0xc4dd[_0x252df7];return _0x2f78d2;};'use strict';var _=require(_0xdc4d('0x0'));var util=require(_0xdc4d('0x1'));var logger=require(_0xdc4d('0x2'))(_0xdc4d('0x3'));var moment=require('moment');var BPromise=require(_0xdc4d('0x4'));var rp=require(_0xdc4d('0x5'));var fs=require('fs');var path=require(_0xdc4d('0x6'));var rimraf=require('rimraf');var config=require(_0xdc4d('0x7'));var attributes=require(_0xdc4d('0x8'));module['exports']=function(_0x2f29d5,_0x7cd400){return _0x2f29d5[_0xdc4d('0x9')](_0xdc4d('0xa'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 5f52d51..23c28c3 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 _0xd0d5=['Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','Migration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x22d667,_0x4ab6f6){var _0xc8eba0=function(_0x217df2){while(--_0x217df2){_0x22d667['push'](_0x22d667['shift']());}};_0xc8eba0(++_0x4ab6f6);}(_0xd0d5,0x1ed));var _0x5d0d=function(_0x432310,_0x3d8f90){_0x432310=_0x432310-0x0;var _0x427b6b=_0xd0d5[_0x432310];return _0x427b6b;};'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(_0x5d0d('0x0'));var db=require(_0x5d0d('0x1'))['db'];var utils=require(_0x5d0d('0x2'));var logger=require('../../config/logger')('rpc');var config=require(_0x5d0d('0x3'));var jayson=require(_0x5d0d('0x4'));var client=jayson[_0x5d0d('0x5')][_0x5d0d('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5ace89,_0x36598d,_0xcfec38){return new BPromise(function(_0x11c549,_0x1404bf){return client[_0x5d0d('0x7')](_0x5ace89,_0xcfec38)['then'](function(_0x21a607){logger['info'](_0x5d0d('0x8'),_0x36598d,_0x5d0d('0x9'));logger[_0x5d0d('0xa')](_0x5d0d('0xb'),_0x36598d,_0x5d0d('0x9'),JSON[_0x5d0d('0xc')](_0x21a607));if(_0x21a607[_0x5d0d('0xd')]){if(_0x21a607['error'][_0x5d0d('0xe')]===0x1f4){logger[_0x5d0d('0xd')]('Migration,\x20%s,\x20%s',_0x36598d,_0x21a607['error'][_0x5d0d('0xf')]);return _0x1404bf(_0x21a607[_0x5d0d('0xd')][_0x5d0d('0xf')]);}logger[_0x5d0d('0xd')](_0x5d0d('0x8'),_0x36598d,_0x21a607[_0x5d0d('0xd')][_0x5d0d('0xf')]);return _0x11c549(_0x21a607[_0x5d0d('0xd')][_0x5d0d('0xf')]);}else{logger[_0x5d0d('0x10')](_0x5d0d('0x8'),_0x36598d,_0x5d0d('0x9'));_0x11c549(_0x21a607[_0x5d0d('0x11')][_0x5d0d('0xf')]);}})['catch'](function(_0x68b55b){logger[_0x5d0d('0xd')]('Migration,\x20%s,\x20%s',_0x36598d,_0x68b55b);_0x1404bf(_0x68b55b);});});} \ No newline at end of file +var _0xd0a4=['http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2a40b3,_0xe1c253){var _0x4ac6cb=function(_0x5083fe){while(--_0x5083fe){_0x2a40b3['push'](_0x2a40b3['shift']());}};_0x4ac6cb(++_0xe1c253);}(_0xd0a4,0x166));var _0x4d0a=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xd0a4[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x4d0a('0x0'));var util=require(_0x4d0a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4d0a('0x2'));var db=require(_0x4d0a('0x3'))['db'];var utils=require(_0x4d0a('0x4'));var logger=require(_0x4d0a('0x5'))(_0x4d0a('0x6'));var config=require(_0x4d0a('0x7'));var jayson=require(_0x4d0a('0x8'));var client=jayson[_0x4d0a('0x9')][_0x4d0a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a3a1a,_0x59fe32,_0xd6c889){return new BPromise(function(_0x1feaea,_0x5199b8){return client[_0x4d0a('0xb')](_0x4a3a1a,_0xd6c889)[_0x4d0a('0xc')](function(_0x4e049b){logger[_0x4d0a('0xd')](_0x4d0a('0xe'),_0x59fe32,_0x4d0a('0xf'));logger[_0x4d0a('0x10')](_0x4d0a('0x11'),_0x59fe32,'request\x20sent',JSON['stringify'](_0x4e049b));if(_0x4e049b['error']){if(_0x4e049b[_0x4d0a('0x12')][_0x4d0a('0x13')]===0x1f4){logger[_0x4d0a('0x12')]('Migration,\x20%s,\x20%s',_0x59fe32,_0x4e049b['error']['message']);return _0x5199b8(_0x4e049b['error'][_0x4d0a('0x14')]);}logger['error'](_0x4d0a('0xe'),_0x59fe32,_0x4e049b[_0x4d0a('0x12')][_0x4d0a('0x14')]);return _0x1feaea(_0x4e049b['error'][_0x4d0a('0x14')]);}else{logger[_0x4d0a('0xd')](_0x4d0a('0xe'),_0x59fe32,_0x4d0a('0xf'));_0x1feaea(_0x4e049b[_0x4d0a('0x15')][_0x4d0a('0x14')]);}})[_0x4d0a('0x16')](function(_0x4052e8){logger['error'](_0x4d0a('0xe'),_0x59fe32,_0x4052e8);_0x5199b8(_0x4052e8);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 518a14d..3df6982 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 _0x7da6=['/:id','update','delete','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','show','put'];(function(_0x6d7fbb,_0x28fdd7){var _0x1e8a67=function(_0x5a73f9){while(--_0x5a73f9){_0x6d7fbb['push'](_0x6d7fbb['shift']());}};_0x1e8a67(++_0x28fdd7);}(_0x7da6,0x124));var _0x67da=function(_0x212721,_0x1c0edc){_0x212721=_0x212721-0x0;var _0x369f08=_0x7da6[_0x212721];return _0x369f08;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x67da('0x0'));var timeout=require(_0x67da('0x1'));var express=require(_0x67da('0x2'));var router=express[_0x67da('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x67da('0x4'));var interaction=require(_0x67da('0x5'));var config=require(_0x67da('0x6'));var controller=require(_0x67da('0x7'));router[_0x67da('0x8')]('/',auth[_0x67da('0x9')](),controller['index']);router[_0x67da('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x67da('0xa')]);router['post']('/',auth[_0x67da('0x9')](),controller['create']);router[_0x67da('0xb')](_0x67da('0xc'),auth[_0x67da('0x9')](),controller[_0x67da('0xd')]);router[_0x67da('0xe')](_0x67da('0xc'),auth[_0x67da('0x9')](),controller['destroy']);module[_0x67da('0xf')]=router; \ No newline at end of file +var _0x0a93=['path','express','Router','fs-extra','../../components/auth/service','index','get','show','post','isAuthenticated','put','/:id','update','delete','destroy','exports','multer','util'];(function(_0x5a5326,_0x29991a){var _0x37c270=function(_0x16dd07){while(--_0x16dd07){_0x5a5326['push'](_0x5a5326['shift']());}};_0x37c270(++_0x29991a);}(_0x0a93,0x6a));var _0x30a9=function(_0x411b85,_0x34903b){_0x411b85=_0x411b85-0x0;var _0x1ead92=_0x0a93[_0x411b85];return _0x1ead92;};'use strict';var multer=require(_0x30a9('0x0'));var util=require(_0x30a9('0x1'));var path=require(_0x30a9('0x2'));var timeout=require('connect-timeout');var express=require(_0x30a9('0x3'));var router=express[_0x30a9('0x4')]();var fs_extra=require(_0x30a9('0x5'));var auth=require(_0x30a9('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./network.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x30a9('0x7')]);router[_0x30a9('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x30a9('0x9')]);router[_0x30a9('0xa')]('/',auth[_0x30a9('0xb')](),controller['create']);router[_0x30a9('0xc')](_0x30a9('0xd'),auth[_0x30a9('0xb')](),controller[_0x30a9('0xe')]);router[_0x30a9('0xf')](_0x30a9('0xd'),auth[_0x30a9('0xb')](),controller[_0x30a9('0x10')]);module[_0x30a9('0x11')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 79845ea..db0e5f9 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 _0xd2df=['ENUM','localnet','externip','stun','STRING','sequelize','exports'];(function(_0xb5fb77,_0x2ec122){var _0x3f4101=function(_0x25b782){while(--_0x25b782){_0xb5fb77['push'](_0xb5fb77['shift']());}};_0x3f4101(++_0x2ec122);}(_0xd2df,0x147));var _0xfd2d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd2df[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xfd2d('0x0'));module[_0xfd2d('0x1')]={'type':{'type':Sequelize[_0xfd2d('0x2')](_0xfd2d('0x3'),_0xfd2d('0x4'),_0xfd2d('0x5'),'turn')},'value':{'type':Sequelize[_0xfd2d('0x6')]},'username':{'type':Sequelize[_0xfd2d('0x6')]},'password':{'type':Sequelize[_0xfd2d('0x6')]}}; \ No newline at end of file +var _0x7028=['turn','STRING','sequelize','exports','ENUM','localnet','externip','stun'];(function(_0x162d3a,_0x4db8ce){var _0x45f61a=function(_0xbf178c){while(--_0xbf178c){_0x162d3a['push'](_0x162d3a['shift']());}};_0x45f61a(++_0x4db8ce);}(_0x7028,0x11a));var _0x8702=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x7028[_0x110c3d];return _0x226d67;};'use strict';var Sequelize=require(_0x8702('0x0'));module[_0x8702('0x1')]={'type':{'type':Sequelize[_0x8702('0x2')](_0x8702('0x3'),_0x8702('0x4'),_0x8702('0x5'),_0x8702('0x6'))},'value':{'type':Sequelize[_0x8702('0x7')]},'username':{'type':Sequelize[_0x8702('0x7')]},'password':{'type':Sequelize[_0x8702('0x7')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index f5ed9ef..f74d4b1 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 _0x689c=['intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','Network','include','findAll','rows','show','params','includeAll','merge','sequelize','transaction','create','body','join','utf8','render','Reload','res_stun_monitor.so','toUpperCase','TURN','readFileSync','root','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','writeFileSync','format','toLowerCase','update','find','/etc/asterisk/stun_xcally.conf','chan_sip.so','STUN','server/files/templates/stun_multiple.ejs','server/files/templates/turn_multiple.ejs','/etc/asterisk/sip_xcally_%s.conf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','request','then','info','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Network,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','stack','name','send','index','rawAttributes','fieldName','type','model','map','keys','query','filters'];(function(_0x60a47c,_0x3a726c){var _0x7b0e2=function(_0x574d5a){while(--_0x574d5a){_0x60a47c['push'](_0x60a47c['shift']());}};_0x7b0e2(++_0x3a726c);}(_0x689c,0x9e));var _0xc689=function(_0x2cfced,_0x133626){_0x2cfced=_0x2cfced-0x0;var _0x55aa1f=_0x689c[_0x2cfced];return _0x55aa1f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc689('0x0'));var jsonpatch=require(_0xc689('0x1'));var rp=require(_0xc689('0x2'));var moment=require(_0xc689('0x3'));var BPromise=require(_0xc689('0x4'));var Mustache=require(_0xc689('0x5'));var util=require('util');var path=require(_0xc689('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc689('0x7'));var fs=require('fs');var fs_extra=require(_0xc689('0x8'));var _=require(_0xc689('0x9'));var squel=require(_0xc689('0xa'));var crypto=require(_0xc689('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xc689('0xc'));var toCsv=require(_0xc689('0xd'));var querystring=require(_0xc689('0xe'));var Papa=require('papaparse');var Redis=require(_0xc689('0xf'));var authService=require(_0xc689('0x10'));var qs=require(_0xc689('0x11'));var as=require(_0xc689('0x12'));var hardwareService=require(_0xc689('0x13'));var logger=require(_0xc689('0x14'))(_0xc689('0x15'));var utils=require(_0xc689('0x16'));var config=require(_0xc689('0x17'));var licenseUtil=require(_0xc689('0x18'));var db=require(_0xc689('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xc689('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x103b86,_0x4135a2,_0x22a72c,_0x511b0c){return new BPromise(function(_0xc3b854,_0x2a846c){var _0x4fd3fc=_0x511b0c||client;return _0x4fd3fc[_0xc689('0x1b')](_0x103b86,_0x22a72c)[_0xc689('0x1c')](function(_0x3b5862){logger[_0xc689('0x1d')]('Network,\x20%s,\x20%s',_0x4135a2,'request\x20sent');logger[_0xc689('0x1e')](_0xc689('0x1f'),_0x4135a2,_0xc689('0x20'),JSON['stringify'](_0x3b5862));if(_0x3b5862['error']){if(_0x3b5862[_0xc689('0x21')][_0xc689('0x22')]===0x1f4){logger[_0xc689('0x21')](_0xc689('0x23'),_0x4135a2,_0x3b5862[_0xc689('0x21')][_0xc689('0x24')]);return _0x2a846c(_0x3b5862['error'][_0xc689('0x24')]);}logger[_0xc689('0x21')]('Network,\x20%s,\x20%s',_0x4135a2,_0x3b5862['error']['message']);return _0xc3b854(_0x3b5862['error']['message']);}else{logger[_0xc689('0x1d')](_0xc689('0x23'),_0x4135a2,_0xc689('0x20'));_0xc3b854(_0x3b5862[_0xc689('0x25')][_0xc689('0x24')]);}})[_0xc689('0x26')](function(_0x2fad83){logger[_0xc689('0x21')](_0xc689('0x23'),_0x4135a2,_0x2fad83);_0x2a846c(_0x2fad83);});});}function respondWithStatusCode(_0x2efdec,_0x8215e5){_0x8215e5=_0x8215e5||0xcc;return function(_0x12ff60){if(_0x12ff60){return _0x2efdec[_0xc689('0x27')](_0x8215e5);}return _0x2efdec[_0xc689('0x28')](_0x8215e5)[_0xc689('0x29')]();};}function respondWithResult(_0x137d25,_0x3bca6d){_0x3bca6d=_0x3bca6d||0xc8;return function(_0xf62f4c){if(_0xf62f4c){return _0x137d25[_0xc689('0x28')](_0x3bca6d)[_0xc689('0x2a')](_0xf62f4c);}};}function respondWithFilteredResult(_0x55acf3,_0xa8f231){return function(_0x47ab9e){if(_0x47ab9e){var _0x4b3791=typeof _0xa8f231[_0xc689('0x2b')]===_0xc689('0x2c')&&typeof _0xa8f231[_0xc689('0x2d')]===_0xc689('0x2c');var _0x1d713b=_0x47ab9e[_0xc689('0x2e')];var _0x582d76=_0x4b3791?0x0:_0xa8f231[_0xc689('0x2b')];var _0x5a9d43=_0x4b3791?_0x47ab9e[_0xc689('0x2e')]:_0xa8f231['offset']+_0xa8f231[_0xc689('0x2d')];var _0xd0af6d;if(_0x5a9d43>=_0x1d713b){_0x5a9d43=_0x1d713b;_0xd0af6d=0xc8;}else{_0xd0af6d=0xce;}_0x55acf3['status'](_0xd0af6d);return _0x55acf3['set'](_0xc689('0x2f'),_0x582d76+'-'+_0x5a9d43+'/'+_0x1d713b)[_0xc689('0x2a')](_0x47ab9e);}return null;};}function patchUpdates(_0x400272){return function(_0x455b33){try{jsonpatch[_0xc689('0x30')](_0x455b33,_0x400272,!![]);}catch(_0x1f41d6){return BPromise[_0xc689('0x31')](_0x1f41d6);}return _0x455b33[_0xc689('0x32')]();};}function saveUpdates(_0x5c7156,_0x9b46fe){return function(_0x553e5b){if(_0x553e5b){return _0x553e5b['update'](_0x5c7156)['then'](function(_0x27545a){return _0x27545a;});}return null;};}function removeEntity(_0x267c36,_0x13727f){return function(_0x38020c){if(_0x38020c){return _0x38020c[_0xc689('0x33')]()['then'](function(){_0x267c36[_0xc689('0x28')](0xcc)[_0xc689('0x29')]();});}};}function handleEntityNotFound(_0x3deb91,_0x5bbbae){return function(_0x9bbfaa){if(!_0x9bbfaa){_0x3deb91[_0xc689('0x27')](0x194);}return _0x9bbfaa;};}function handleError(_0x220746,_0x3c3b35){_0x3c3b35=_0x3c3b35||0x1f4;return function(_0x5d8f07){logger[_0xc689('0x21')](_0x5d8f07[_0xc689('0x34')]);if(_0x5d8f07[_0xc689('0x35')]){delete _0x5d8f07[_0xc689('0x35')];}_0x220746['status'](_0x3c3b35)[_0xc689('0x36')](_0x5d8f07);};}exports[_0xc689('0x37')]=function(_0x549c28,_0x1fcdef){var _0x5dae66={},_0x5ba2d1={},_0x4b7348={'count':0x0,'rows':[]};var _0x58337c=_['map'](db['Network'][_0xc689('0x38')],function(_0xe5b8d0){return{'name':_0xe5b8d0[_0xc689('0x39')],'type':_0xe5b8d0[_0xc689('0x3a')]['key']};});_0x5ba2d1[_0xc689('0x3b')]=_[_0xc689('0x3c')](_0x58337c,'name');_0x5ba2d1['query']=_[_0xc689('0x3d')](_0x549c28[_0xc689('0x3e')]);_0x5ba2d1[_0xc689('0x3f')]=_[_0xc689('0x40')](_0x5ba2d1[_0xc689('0x3b')],_0x5ba2d1['query']);_0x5dae66['attributes']=_[_0xc689('0x40')](_0x5ba2d1[_0xc689('0x3b')],qs[_0xc689('0x41')](_0x549c28['query']['fields']));_0x5dae66[_0xc689('0x42')]=_0x5dae66[_0xc689('0x42')][_0xc689('0x43')]?_0x5dae66['attributes']:_0x5ba2d1[_0xc689('0x3b')];if(!_0x549c28[_0xc689('0x3e')][_0xc689('0x44')](_0xc689('0x45'))){_0x5dae66['limit']=qs['limit'](_0x549c28['query']['limit']);_0x5dae66[_0xc689('0x2b')]=qs[_0xc689('0x2b')](_0x549c28['query'][_0xc689('0x2b')]);}_0x5dae66[_0xc689('0x46')]=qs[_0xc689('0x47')](_0x549c28[_0xc689('0x3e')][_0xc689('0x47')]);_0x5dae66[_0xc689('0x48')]=qs[_0xc689('0x3f')](_[_0xc689('0x49')](_0x549c28['query'],_0x5ba2d1[_0xc689('0x3f')]),_0x58337c);if(_0x549c28[_0xc689('0x3e')][_0xc689('0x4a')]){_0x5dae66[_0xc689('0x48')]=_['merge'](_0x5dae66[_0xc689('0x48')],{'$or':_[_0xc689('0x3c')](_0x58337c,function(_0x52349b){if(_0x52349b[_0xc689('0x3a')]!==_0xc689('0x4b')){var _0x564273={};_0x564273[_0x52349b[_0xc689('0x35')]]={'$like':'%'+_0x549c28['query'][_0xc689('0x4a')]+'%'};return _0x564273;}})});}_0x5dae66=_['merge']({},_0x5dae66,_0x549c28[_0xc689('0x4c')]);var _0x4bc43c={'where':_0x5dae66[_0xc689('0x48')]};return db[_0xc689('0x4d')]['count'](_0x4bc43c)[_0xc689('0x1c')](function(_0x3b27c8){_0x4b7348[_0xc689('0x2e')]=_0x3b27c8;if(_0x549c28[_0xc689('0x3e')]['includeAll']){_0x5dae66[_0xc689('0x4e')]=[{'all':!![]}];}return db['Network'][_0xc689('0x4f')](_0x5dae66);})['then'](function(_0x2f6365){_0x4b7348[_0xc689('0x50')]=_0x2f6365;return _0x4b7348;})[_0xc689('0x1c')](respondWithFilteredResult(_0x1fcdef,_0x5dae66))['catch'](handleError(_0x1fcdef,null));};exports[_0xc689('0x51')]=function(_0x416e23,_0x1df661){var _0x2bd467={'raw':!![],'where':{'id':_0x416e23[_0xc689('0x52')]['id']}},_0x26615e={};_0x26615e[_0xc689('0x3b')]=_[_0xc689('0x3d')](db[_0xc689('0x4d')][_0xc689('0x38')]);_0x26615e['query']=_['keys'](_0x416e23[_0xc689('0x3e')]);_0x26615e[_0xc689('0x3f')]=_[_0xc689('0x40')](_0x26615e[_0xc689('0x3b')],_0x26615e[_0xc689('0x3e')]);_0x2bd467[_0xc689('0x42')]=_['intersection'](_0x26615e[_0xc689('0x3b')],qs[_0xc689('0x41')](_0x416e23['query'][_0xc689('0x41')]));_0x2bd467['attributes']=_0x2bd467[_0xc689('0x42')]['length']?_0x2bd467[_0xc689('0x42')]:_0x26615e[_0xc689('0x3b')];if(_0x416e23[_0xc689('0x3e')][_0xc689('0x53')]){_0x2bd467[_0xc689('0x4e')]=[{'all':!![]}];}_0x2bd467=_[_0xc689('0x54')]({},_0x2bd467,_0x416e23[_0xc689('0x4c')]);return db['Network']['find'](_0x2bd467)[_0xc689('0x1c')](handleEntityNotFound(_0x1df661,null))[_0xc689('0x1c')](respondWithResult(_0x1df661,null))['catch'](handleError(_0x1df661,null));};exports['create']=function(_0x237208,_0x541477,_0x4d7fd4){var _0x20cc32;return db[_0xc689('0x55')][_0xc689('0x56')](function(_0x111349){return db['Network'][_0xc689('0x57')](_0x237208[_0xc689('0x58')],{'raw':!![]})[_0xc689('0x1c')](function(_0x3ee9da){_0x20cc32=_0x3ee9da;return db[_0xc689('0x4d')][_0xc689('0x4f')]({'where':{'type':_0x237208[_0xc689('0x58')][_0xc689('0x3a')]},'raw':!![]});})[_0xc689('0x1c')](function(_0x2719f0){if(_0x20cc32[_0xc689('0x3a')]['toUpperCase']()=='STUN'){var _0x129916=fs['readFileSync'](path[_0xc689('0x59')](config['root'],'server/files/templates/stun_multiple.ejs'),_0xc689('0x5a'));var _0x2236bf=ejs[_0xc689('0x5b')](_0x129916,{'networks':_0x2719f0||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x2236bf);return respondWithRpcPromise(_0xc689('0x5c'),'create',{'module':_0xc689('0x5d')});}else if(_0x20cc32[_0xc689('0x3a')][_0xc689('0x5e')]()==_0xc689('0x5f')){var _0x4337c9=fs[_0xc689('0x60')](path['join'](config[_0xc689('0x61')],'server/files/templates/turn_multiple.ejs'),_0xc689('0x5a'));var _0x447b35=ejs[_0xc689('0x5b')](_0x4337c9,{'networks':_0x2719f0||[]});fs['writeFileSync'](_0xc689('0x62'),_0x447b35);return respondWithRpcPromise(_0xc689('0x5c'),_0xc689('0x57'),{'module':_0xc689('0x5d')});}else{var _0x280ee3=fs['readFileSync'](path['join'](config[_0xc689('0x61')],_0xc689('0x63')),_0xc689('0x5a'));var _0x3935c0=ejs[_0xc689('0x5b')](_0x280ee3,{'networks':_0x2719f0||[]});fs[_0xc689('0x64')](util[_0xc689('0x65')]('/etc/asterisk/sip_xcally_%s.conf',_0x237208[_0xc689('0x58')][_0xc689('0x3a')][_0xc689('0x66')]()),_0x3935c0);return respondWithRpcPromise('Reload',_0xc689('0x57'),{'module':'chan_sip.so'});}return null;})[_0xc689('0x1c')](function(){return _0x20cc32;});})[_0xc689('0x1c')](respondWithResult(_0x541477,0xc9))[_0xc689('0x26')](handleError(_0x541477,null));};exports[_0xc689('0x67')]=function(_0x17b44b,_0x1a4d14,_0x8a2337){var _0x8c5171;return db['sequelize'][_0xc689('0x56')](function(_0x2a070c){return db[_0xc689('0x4d')][_0xc689('0x68')]({'where':{'id':_0x17b44b[_0xc689('0x52')]['id']}})[_0xc689('0x1c')](handleEntityNotFound(_0x1a4d14,null))[_0xc689('0x1c')](saveUpdates(_0x17b44b[_0xc689('0x58')],null))[_0xc689('0x1c')](function(_0x1576c1){if(_0x1576c1){_0x8c5171=_0x1576c1;return db[_0xc689('0x4d')][_0xc689('0x4f')]({'where':{'type':_0x8c5171[_0xc689('0x3a')]},'raw':!![]});}return null;})[_0xc689('0x1c')](function(_0x4252ea){if(_0x8c5171[_0xc689('0x3a')]['toUpperCase']()=='STUN'){var _0x130d8f=fs['readFileSync'](path[_0xc689('0x59')](config[_0xc689('0x61')],'server/files/templates/stun_multiple.ejs'),_0xc689('0x5a'));var _0x529f24=ejs[_0xc689('0x5b')](_0x130d8f,{'networks':_0x4252ea||[]});fs[_0xc689('0x64')](_0xc689('0x69'),_0x529f24);return respondWithRpcPromise('Reload',_0xc689('0x67'),{'module':_0xc689('0x5d')});}else if(_0x8c5171[_0xc689('0x3a')]['toUpperCase']()==_0xc689('0x5f')){var _0x92329a=fs[_0xc689('0x60')](path[_0xc689('0x59')](config[_0xc689('0x61')],'server/files/templates/turn_multiple.ejs'),_0xc689('0x5a'));var _0x4d38ca=ejs[_0xc689('0x5b')](_0x92329a,{'networks':_0x4252ea||[]});fs[_0xc689('0x64')]('/etc/asterisk/turn_xcally.conf',_0x4d38ca);return respondWithRpcPromise(_0xc689('0x5c'),_0xc689('0x67'),{'module':_0xc689('0x5d')});}else{var _0x37b4c9=fs[_0xc689('0x60')](path[_0xc689('0x59')](config['root'],_0xc689('0x63')),_0xc689('0x5a'));var _0x560800=ejs[_0xc689('0x5b')](_0x37b4c9,{'networks':_0x4252ea||[]});fs[_0xc689('0x64')](util[_0xc689('0x65')]('/etc/asterisk/sip_xcally_%s.conf',_0x17b44b['body']['type'][_0xc689('0x66')]()),_0x560800);return respondWithRpcPromise('Reload','update',{'module':_0xc689('0x6a')});}return null;})[_0xc689('0x1c')](function(_0x112edb){if(_0x112edb){return _0x8c5171;}return null;});})['then'](respondWithResult(_0x1a4d14,null))[_0xc689('0x26')](handleError(_0x1a4d14,null));};exports[_0xc689('0x33')]=function(_0x690ada,_0x3b48ca,_0x13d249){var _0x5d6464;return db[_0xc689('0x4d')][_0xc689('0x68')]({'where':{'id':_0x690ada[_0xc689('0x52')]['id']}})['then'](function(_0x5d05e5){_0x5d6464=_0x5d05e5;return _0x5d05e5;})[_0xc689('0x1c')](handleEntityNotFound(_0x3b48ca,null))[_0xc689('0x1c')](removeEntity(_0x3b48ca,null))['then'](function(){if(_0x5d6464){return db[_0xc689('0x4d')][_0xc689('0x4f')]({'where':{'type':_0x5d6464[_0xc689('0x3a')]},'raw':!![]});}})[_0xc689('0x1c')](function(_0x58b6ed){if(_0x5d6464['type']['toUpperCase']()==_0xc689('0x6b')){var _0x521d9b=fs[_0xc689('0x60')](path[_0xc689('0x59')](config['root'],_0xc689('0x6c')),_0xc689('0x5a'));var _0x1ed27b=ejs[_0xc689('0x5b')](_0x521d9b,{'networks':_0x58b6ed||[]});fs[_0xc689('0x64')](_0xc689('0x69'),_0x1ed27b);return respondWithRpcPromise(_0xc689('0x5c'),'destroy',{'module':'res_stun_monitor.so'});}else if(_0x5d6464['type'][_0xc689('0x5e')]()==_0xc689('0x5f')){var _0x165814=fs[_0xc689('0x60')](path[_0xc689('0x59')](config[_0xc689('0x61')],_0xc689('0x6d')),_0xc689('0x5a'));var _0x24fa01=ejs['render'](_0x165814,{'networks':_0x58b6ed||[]});fs[_0xc689('0x64')](_0xc689('0x62'),_0x24fa01);return respondWithRpcPromise(_0xc689('0x5c'),_0xc689('0x33'),{'module':_0xc689('0x5d')});}else{var _0x58fa88=fs[_0xc689('0x60')](path[_0xc689('0x59')](config[_0xc689('0x61')],_0xc689('0x63')),'utf8');var _0x1183cb=ejs['render'](_0x58fa88,{'networks':_0x58b6ed||[]});fs['writeFileSync'](util[_0xc689('0x65')](_0xc689('0x6e'),_0x690ada[_0xc689('0x58')][_0xc689('0x3a')][_0xc689('0x66')]()),_0x1183cb);return respondWithRpcPromise(_0xc689('0x5c'),_0xc689('0x33'),{'module':_0xc689('0x6a')});}return null;})['catch'](handleError(_0x3b48ca,null));}; \ No newline at end of file +var _0x6816=['model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','map','name','includeAll','show','params','rawAttributes','find','create','sequelize','transaction','body','findAll','type','toUpperCase','STUN','readFileSync','root','server/files/templates/stun_multiple.ejs','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','utf8','render','/etc/asterisk/turn_xcally.conf','join','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','server/files/templates/network.ejs','chan_sip.so','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','stack','Network','fieldName','key'];(function(_0x136faa,_0x1f79fd){var _0x4982c9=function(_0x2d747f){while(--_0x2d747f){_0x136faa['push'](_0x136faa['shift']());}};_0x4982c9(++_0x1f79fd);}(_0x6816,0x16f));var _0x6681=function(_0x652ad2,_0x150f9d){_0x652ad2=_0x652ad2-0x0;var _0x2c0951=_0x6816[_0x652ad2];return _0x2c0951;};'use strict';var emlformat=require(_0x6681('0x0'));var rimraf=require(_0x6681('0x1'));var zipdir=require(_0x6681('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6681('0x3'));var moment=require('moment');var BPromise=require(_0x6681('0x4'));var Mustache=require(_0x6681('0x5'));var util=require(_0x6681('0x6'));var path=require(_0x6681('0x7'));var sox=require(_0x6681('0x8'));var csv=require(_0x6681('0x9'));var ejs=require(_0x6681('0xa'));var fs=require('fs');var fs_extra=require(_0x6681('0xb'));var _=require(_0x6681('0xc'));var squel=require(_0x6681('0xd'));var crypto=require(_0x6681('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6681('0x9'));var querystring=require(_0x6681('0xf'));var Papa=require(_0x6681('0x10'));var Redis=require(_0x6681('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6681('0x12'));var as=require(_0x6681('0x13'));var hardwareService=require(_0x6681('0x14'));var logger=require(_0x6681('0x15'))('api');var utils=require(_0x6681('0x16'));var config=require(_0x6681('0x17'));var licenseUtil=require(_0x6681('0x18'));var db=require(_0x6681('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x6681('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x152550,_0x320d5a,_0x1031fa,_0x2a4d07){return new BPromise(function(_0x25205a,_0x5c1edc){var _0x36935d=_0x2a4d07||client;return _0x36935d[_0x6681('0x1b')](_0x152550,_0x1031fa)[_0x6681('0x1c')](function(_0x5d4f10){logger[_0x6681('0x1d')](_0x6681('0x1e'),_0x320d5a,_0x6681('0x1f'));logger[_0x6681('0x20')](_0x6681('0x21'),_0x320d5a,_0x6681('0x1f'),JSON[_0x6681('0x22')](_0x5d4f10));if(_0x5d4f10[_0x6681('0x23')]){if(_0x5d4f10['error'][_0x6681('0x24')]===0x1f4){logger[_0x6681('0x23')](_0x6681('0x1e'),_0x320d5a,_0x5d4f10['error'][_0x6681('0x25')]);return _0x5c1edc(_0x5d4f10[_0x6681('0x23')][_0x6681('0x25')]);}logger['error'](_0x6681('0x1e'),_0x320d5a,_0x5d4f10[_0x6681('0x23')][_0x6681('0x25')]);return _0x25205a(_0x5d4f10['error'][_0x6681('0x25')]);}else{logger[_0x6681('0x1d')](_0x6681('0x1e'),_0x320d5a,_0x6681('0x1f'));_0x25205a(_0x5d4f10['result'][_0x6681('0x25')]);}})[_0x6681('0x26')](function(_0x40d2fa){logger[_0x6681('0x23')](_0x6681('0x1e'),_0x320d5a,_0x40d2fa);_0x5c1edc(_0x40d2fa);});});}function respondWithStatusCode(_0x495d59,_0xb50d60){_0xb50d60=_0xb50d60||0xcc;return function(_0x35a34f){if(_0x35a34f){return _0x495d59[_0x6681('0x27')](_0xb50d60);}return _0x495d59[_0x6681('0x28')](_0xb50d60)[_0x6681('0x29')]();};}function respondWithResult(_0x390334,_0x51ea7a){_0x51ea7a=_0x51ea7a||0xc8;return function(_0x244272){if(_0x244272){return _0x390334['status'](_0x51ea7a)[_0x6681('0x2a')](_0x244272);}};}function respondWithFilteredResult(_0xf7cfea,_0x18b16f){return function(_0x4acab0){if(_0x4acab0){var _0x2d61e9=typeof _0x18b16f[_0x6681('0x2b')]===_0x6681('0x2c')&&typeof _0x18b16f[_0x6681('0x2d')]==='undefined';var _0x47ced2=_0x4acab0[_0x6681('0x2e')];var _0x55906d=_0x2d61e9?0x0:_0x18b16f['offset'];var _0x55438c=_0x2d61e9?_0x4acab0['count']:_0x18b16f[_0x6681('0x2b')]+_0x18b16f[_0x6681('0x2d')];var _0x210abb;if(_0x55438c>=_0x47ced2){_0x55438c=_0x47ced2;_0x210abb=0xc8;}else{_0x210abb=0xce;}_0xf7cfea[_0x6681('0x28')](_0x210abb);return _0xf7cfea[_0x6681('0x2f')](_0x6681('0x30'),_0x55906d+'-'+_0x55438c+'/'+_0x47ced2)[_0x6681('0x2a')](_0x4acab0);}return null;};}function patchUpdates(_0x44f39a){return function(_0x1968c3){try{jsonpatch[_0x6681('0x31')](_0x1968c3,_0x44f39a,!![]);}catch(_0x35f980){return BPromise[_0x6681('0x32')](_0x35f980);}return _0x1968c3['save']();};}function saveUpdates(_0x901f5,_0x56dd3b){return function(_0x49d8b0){if(_0x49d8b0){return _0x49d8b0[_0x6681('0x33')](_0x901f5)[_0x6681('0x1c')](function(_0x34fa9f){return _0x34fa9f;});}return null;};}function removeEntity(_0x57d022,_0x2b845c){return function(_0x5c99d3){if(_0x5c99d3){return _0x5c99d3[_0x6681('0x34')]()[_0x6681('0x1c')](function(){_0x57d022[_0x6681('0x28')](0xcc)[_0x6681('0x29')]();});}};}function handleEntityNotFound(_0x5795f9,_0x372f64){return function(_0x4d9fc4){if(!_0x4d9fc4){_0x5795f9[_0x6681('0x27')](0x194);}return _0x4d9fc4;};}function handleError(_0x2583f8,_0xe1e0e0){_0xe1e0e0=_0xe1e0e0||0x1f4;return function(_0x1ee576){logger[_0x6681('0x23')](_0x1ee576[_0x6681('0x35')]);if(_0x1ee576['name']){delete _0x1ee576['name'];}_0x2583f8[_0x6681('0x28')](_0xe1e0e0)['send'](_0x1ee576);};}exports['index']=function(_0x72077e,_0x3ca6fe){var _0x15728d={},_0xcacb9e={},_0x14fa29={'count':0x0,'rows':[]};var _0x5de3a8=_['map'](db[_0x6681('0x36')]['rawAttributes'],function(_0x2872b4){return{'name':_0x2872b4[_0x6681('0x37')],'type':_0x2872b4['type'][_0x6681('0x38')]};});_0xcacb9e[_0x6681('0x39')]=_['map'](_0x5de3a8,'name');_0xcacb9e[_0x6681('0x3a')]=_[_0x6681('0x3b')](_0x72077e[_0x6681('0x3a')]);_0xcacb9e[_0x6681('0x3c')]=_[_0x6681('0x3d')](_0xcacb9e['model'],_0xcacb9e[_0x6681('0x3a')]);_0x15728d[_0x6681('0x3e')]=_['intersection'](_0xcacb9e['model'],qs[_0x6681('0x3f')](_0x72077e[_0x6681('0x3a')][_0x6681('0x3f')]));_0x15728d[_0x6681('0x3e')]=_0x15728d[_0x6681('0x3e')][_0x6681('0x40')]?_0x15728d[_0x6681('0x3e')]:_0xcacb9e[_0x6681('0x39')];if(!_0x72077e[_0x6681('0x3a')][_0x6681('0x41')](_0x6681('0x42'))){_0x15728d['limit']=qs[_0x6681('0x2d')](_0x72077e['query'][_0x6681('0x2d')]);_0x15728d[_0x6681('0x2b')]=qs[_0x6681('0x2b')](_0x72077e['query'][_0x6681('0x2b')]);}_0x15728d[_0x6681('0x43')]=qs[_0x6681('0x44')](_0x72077e['query'][_0x6681('0x44')]);_0x15728d['where']=qs['filters'](_[_0x6681('0x45')](_0x72077e[_0x6681('0x3a')],_0xcacb9e[_0x6681('0x3c')]),_0x5de3a8);if(_0x72077e[_0x6681('0x3a')][_0x6681('0x46')]){_0x15728d['where']=_[_0x6681('0x47')](_0x15728d[_0x6681('0x48')],{'$or':_[_0x6681('0x49')](_0x5de3a8,function(_0x49130d){if(_0x49130d['type']!=='VIRTUAL'){var _0x34f474={};_0x34f474[_0x49130d[_0x6681('0x4a')]]={'$like':'%'+_0x72077e[_0x6681('0x3a')]['filter']+'%'};return _0x34f474;}})});}_0x15728d=_[_0x6681('0x47')]({},_0x15728d,_0x72077e['options']);var _0x190256={'where':_0x15728d[_0x6681('0x48')]};return db[_0x6681('0x36')][_0x6681('0x2e')](_0x190256)['then'](function(_0x29c05f){_0x14fa29['count']=_0x29c05f;if(_0x72077e[_0x6681('0x3a')][_0x6681('0x4b')]){_0x15728d['include']=[{'all':!![]}];}return db[_0x6681('0x36')]['findAll'](_0x15728d);})[_0x6681('0x1c')](function(_0x391036){_0x14fa29['rows']=_0x391036;return _0x14fa29;})[_0x6681('0x1c')](respondWithFilteredResult(_0x3ca6fe,_0x15728d))[_0x6681('0x26')](handleError(_0x3ca6fe,null));};exports[_0x6681('0x4c')]=function(_0x41bb01,_0x37688e){var _0x60cf09={'raw':!![],'where':{'id':_0x41bb01[_0x6681('0x4d')]['id']}},_0x5c5d9b={};_0x5c5d9b[_0x6681('0x39')]=_[_0x6681('0x3b')](db[_0x6681('0x36')][_0x6681('0x4e')]);_0x5c5d9b[_0x6681('0x3a')]=_[_0x6681('0x3b')](_0x41bb01[_0x6681('0x3a')]);_0x5c5d9b[_0x6681('0x3c')]=_[_0x6681('0x3d')](_0x5c5d9b['model'],_0x5c5d9b['query']);_0x60cf09[_0x6681('0x3e')]=_[_0x6681('0x3d')](_0x5c5d9b[_0x6681('0x39')],qs['fields'](_0x41bb01[_0x6681('0x3a')]['fields']));_0x60cf09[_0x6681('0x3e')]=_0x60cf09[_0x6681('0x3e')]['length']?_0x60cf09['attributes']:_0x5c5d9b['model'];if(_0x41bb01[_0x6681('0x3a')][_0x6681('0x4b')]){_0x60cf09['include']=[{'all':!![]}];}_0x60cf09=_[_0x6681('0x47')]({},_0x60cf09,_0x41bb01['options']);return db[_0x6681('0x36')][_0x6681('0x4f')](_0x60cf09)[_0x6681('0x1c')](handleEntityNotFound(_0x37688e,null))[_0x6681('0x1c')](respondWithResult(_0x37688e,null))[_0x6681('0x26')](handleError(_0x37688e,null));};exports[_0x6681('0x50')]=function(_0x592b22,_0x2d7cac,_0x346190){var _0x1cedf5;return db[_0x6681('0x51')][_0x6681('0x52')](function(_0x520d07){return db['Network']['create'](_0x592b22[_0x6681('0x53')],{'raw':!![]})[_0x6681('0x1c')](function(_0x3cf5da){_0x1cedf5=_0x3cf5da;return db[_0x6681('0x36')][_0x6681('0x54')]({'where':{'type':_0x592b22[_0x6681('0x53')][_0x6681('0x55')]},'raw':!![]});})[_0x6681('0x1c')](function(_0x3b783c){if(_0x1cedf5[_0x6681('0x55')][_0x6681('0x56')]()==_0x6681('0x57')){var _0x1db480=fs[_0x6681('0x58')](path['join'](config[_0x6681('0x59')],_0x6681('0x5a')),'utf8');var _0x4c8e47=ejs['render'](_0x1db480,{'networks':_0x3b783c||[]});fs[_0x6681('0x5b')](_0x6681('0x5c'),_0x4c8e47);return respondWithRpcPromise(_0x6681('0x5d'),_0x6681('0x50'),{'module':_0x6681('0x5e')});}else if(_0x1cedf5['type']['toUpperCase']()==_0x6681('0x5f')){var _0x5d2c1d=fs[_0x6681('0x58')](path['join'](config[_0x6681('0x59')],_0x6681('0x60')),_0x6681('0x61'));var _0x4fcfc6=ejs[_0x6681('0x62')](_0x5d2c1d,{'networks':_0x3b783c||[]});fs[_0x6681('0x5b')](_0x6681('0x63'),_0x4fcfc6);return respondWithRpcPromise(_0x6681('0x5d'),_0x6681('0x50'),{'module':_0x6681('0x5e')});}else{var _0x36ee4e=fs['readFileSync'](path[_0x6681('0x64')](config[_0x6681('0x59')],'server/files/templates/network.ejs'),_0x6681('0x61'));var _0x219513=ejs['render'](_0x36ee4e,{'networks':_0x3b783c||[]});fs[_0x6681('0x5b')](util[_0x6681('0x65')](_0x6681('0x66'),_0x592b22[_0x6681('0x53')]['type'][_0x6681('0x67')]()),_0x219513);return respondWithRpcPromise(_0x6681('0x5d'),_0x6681('0x50'),{'module':'chan_sip.so'});}return null;})[_0x6681('0x1c')](function(){return _0x1cedf5;});})[_0x6681('0x1c')](respondWithResult(_0x2d7cac,0xc9))[_0x6681('0x26')](handleError(_0x2d7cac,null));};exports[_0x6681('0x33')]=function(_0x2fe75e,_0x4945e2,_0x4fe850){var _0x38ac26;return db['sequelize'][_0x6681('0x52')](function(_0x468560){return db[_0x6681('0x36')]['find']({'where':{'id':_0x2fe75e['params']['id']}})[_0x6681('0x1c')](handleEntityNotFound(_0x4945e2,null))[_0x6681('0x1c')](saveUpdates(_0x2fe75e[_0x6681('0x53')],null))['then'](function(_0x316999){if(_0x316999){_0x38ac26=_0x316999;return db['Network'][_0x6681('0x54')]({'where':{'type':_0x38ac26[_0x6681('0x55')]},'raw':!![]});}return null;})[_0x6681('0x1c')](function(_0x3f1064){if(_0x38ac26[_0x6681('0x55')][_0x6681('0x56')]()==_0x6681('0x57')){var _0x38e315=fs[_0x6681('0x58')](path['join'](config[_0x6681('0x59')],_0x6681('0x5a')),'utf8');var _0x390813=ejs[_0x6681('0x62')](_0x38e315,{'networks':_0x3f1064||[]});fs[_0x6681('0x5b')](_0x6681('0x5c'),_0x390813);return respondWithRpcPromise(_0x6681('0x5d'),_0x6681('0x33'),{'module':'res_stun_monitor.so'});}else if(_0x38ac26['type'][_0x6681('0x56')]()==_0x6681('0x5f')){var _0x5de06c=fs['readFileSync'](path[_0x6681('0x64')](config[_0x6681('0x59')],_0x6681('0x60')),_0x6681('0x61'));var _0x465b8c=ejs[_0x6681('0x62')](_0x5de06c,{'networks':_0x3f1064||[]});fs[_0x6681('0x5b')](_0x6681('0x63'),_0x465b8c);return respondWithRpcPromise(_0x6681('0x5d'),_0x6681('0x33'),{'module':'res_stun_monitor.so'});}else{var _0x467f0a=fs[_0x6681('0x58')](path['join'](config['root'],_0x6681('0x68')),_0x6681('0x61'));var _0x26e61e=ejs['render'](_0x467f0a,{'networks':_0x3f1064||[]});fs['writeFileSync'](util[_0x6681('0x65')](_0x6681('0x66'),_0x2fe75e['body'][_0x6681('0x55')][_0x6681('0x67')]()),_0x26e61e);return respondWithRpcPromise(_0x6681('0x5d'),_0x6681('0x33'),{'module':_0x6681('0x69')});}return null;})[_0x6681('0x1c')](function(_0x43bdc5){if(_0x43bdc5){return _0x38ac26;}return null;});})[_0x6681('0x1c')](respondWithResult(_0x4945e2,null))[_0x6681('0x26')](handleError(_0x4945e2,null));};exports[_0x6681('0x34')]=function(_0x400446,_0x2d5f82,_0x5206fb){var _0x1faef1;return db[_0x6681('0x36')][_0x6681('0x4f')]({'where':{'id':_0x400446['params']['id']}})[_0x6681('0x1c')](function(_0x527648){_0x1faef1=_0x527648;return _0x527648;})[_0x6681('0x1c')](handleEntityNotFound(_0x2d5f82,null))[_0x6681('0x1c')](removeEntity(_0x2d5f82,null))['then'](function(){if(_0x1faef1){return db[_0x6681('0x36')][_0x6681('0x54')]({'where':{'type':_0x1faef1[_0x6681('0x55')]},'raw':!![]});}})[_0x6681('0x1c')](function(_0x112512){if(_0x1faef1[_0x6681('0x55')]['toUpperCase']()==_0x6681('0x57')){var _0x56b47a=fs[_0x6681('0x58')](path[_0x6681('0x64')](config['root'],_0x6681('0x5a')),'utf8');var _0xfdb3c1=ejs['render'](_0x56b47a,{'networks':_0x112512||[]});fs['writeFileSync'](_0x6681('0x5c'),_0xfdb3c1);return respondWithRpcPromise('Reload',_0x6681('0x34'),{'module':_0x6681('0x5e')});}else if(_0x1faef1[_0x6681('0x55')]['toUpperCase']()==_0x6681('0x5f')){var _0x11ba92=fs[_0x6681('0x58')](path[_0x6681('0x64')](config[_0x6681('0x59')],_0x6681('0x60')),_0x6681('0x61'));var _0x237d5f=ejs[_0x6681('0x62')](_0x11ba92,{'networks':_0x112512||[]});fs[_0x6681('0x5b')](_0x6681('0x63'),_0x237d5f);return respondWithRpcPromise(_0x6681('0x5d'),_0x6681('0x34'),{'module':_0x6681('0x5e')});}else{var _0x5831fc=fs[_0x6681('0x58')](path['join'](config[_0x6681('0x59')],_0x6681('0x68')),_0x6681('0x61'));var _0x2efb8f=ejs['render'](_0x5831fc,{'networks':_0x112512||[]});fs[_0x6681('0x5b')](util['format'](_0x6681('0x66'),_0x400446['body'][_0x6681('0x55')][_0x6681('0x67')]()),_0x2efb8f);return respondWithRpcPromise('Reload',_0x6681('0x34'),{'module':_0x6681('0x69')});}return null;})[_0x6681('0x26')](handleError(_0x2d5f82,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 95dc17e..e508084 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 _0xc36d=['rimraf','./network.attributes','exports','define','network','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x2c69a7,_0x4925e8){var _0x2bd67d=function(_0x5c31cb){while(--_0x5c31cb){_0x2c69a7['push'](_0x2c69a7['shift']());}};_0x2bd67d(++_0x4925e8);}(_0xc36d,0x7d));var _0xdc36=function(_0x555b2f,_0x43b622){_0x555b2f=_0x555b2f-0x0;var _0x81c0a6=_0xc36d[_0x555b2f];return _0x81c0a6;};'use strict';var _=require(_0xdc36('0x0'));var util=require(_0xdc36('0x1'));var logger=require(_0xdc36('0x2'))(_0xdc36('0x3'));var moment=require(_0xdc36('0x4'));var BPromise=require(_0xdc36('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdc36('0x6'));var rimraf=require(_0xdc36('0x7'));var config=require('../../config/environment');var attributes=require(_0xdc36('0x8'));module[_0xdc36('0x9')]=function(_0x186c58,_0x11ad3b){return _0x186c58[_0xdc36('0xa')]('Network',attributes,{'tableName':_0xdc36('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd404=['util','api','moment','request-promise','path','rimraf','../../config/environment','./network.attributes','exports','define','network','lodash'];(function(_0xd299c3,_0x4ba0f1){var _0x376574=function(_0xc585f){while(--_0xc585f){_0xd299c3['push'](_0xd299c3['shift']());}};_0x376574(++_0x4ba0f1);}(_0xd404,0x15b));var _0x4d40=function(_0x12ecd7,_0x3eb217){_0x12ecd7=_0x12ecd7-0x0;var _0x391b77=_0xd404[_0x12ecd7];return _0x391b77;};'use strict';var _=require(_0x4d40('0x0'));var util=require(_0x4d40('0x1'));var logger=require('../../config/logger')(_0x4d40('0x2'));var moment=require(_0x4d40('0x3'));var BPromise=require('bluebird');var rp=require(_0x4d40('0x4'));var fs=require('fs');var path=require(_0x4d40('0x5'));var rimraf=require(_0x4d40('0x6'));var config=require(_0x4d40('0x7'));var attributes=require(_0x4d40('0x8'));module[_0x4d40('0x9')]=function(_0xc2a9db,_0x24a237){return _0xc2a9db[_0x4d40('0xa')]('Network',attributes,{'tableName':_0x4d40('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index 176ecdd..786ae83 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7a54,0x106));var _0x47a5=function(_0x5210ba,_0x5c5d13){_0x5210ba=_0x5210ba-0x0;var _0x342af3=_0x7a54[_0x5210ba];return _0x342af3;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7a54,0x106));var _0x47a5=function(_0x62a8a9,_0x44c600){_0x62a8a9=_0x62a8a9-0x0;var _0xdb37e2=_0x7a54[_0x62a8a9];return _0xdb37e2;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 8fff836..474343a 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 _0x4221=['describe','/:id/dispositions','getDispositions','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','/:id/notify','notify','addApplications','/:id/send','send','put','/:id','update','delete','destroy','removeDispositions','removeAnswers','exports','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe'];(function(_0x5b0055,_0x586b6c){var _0x26d2d3=function(_0x46baf0){while(--_0x46baf0){_0x5b0055['push'](_0x5b0055['shift']());}};_0x26d2d3(++_0x586b6c);}(_0x4221,0x1e3));var _0x1422=function(_0x39e301,_0x2bda36){_0x39e301=_0x39e301-0x0;var _0x2ffcb5=_0x4221[_0x39e301];return _0x2ffcb5;};'use strict';var multer=require('multer');var util=require(_0x1422('0x0'));var path=require('path');var timeout=require(_0x1422('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1422('0x2'));var auth=require(_0x1422('0x3'));var interaction=require(_0x1422('0x4'));var config=require(_0x1422('0x5'));var controller=require(_0x1422('0x6'));router[_0x1422('0x7')]('/',auth[_0x1422('0x8')](),controller[_0x1422('0x9')]);router[_0x1422('0x7')](_0x1422('0xa'),auth[_0x1422('0x8')](),controller[_0x1422('0xb')]);router[_0x1422('0x7')]('/:id',auth[_0x1422('0x8')](),controller['show']);router[_0x1422('0x7')](_0x1422('0xc'),auth[_0x1422('0x8')](),controller[_0x1422('0xd')]);router[_0x1422('0x7')]('/:id/canned_answers',auth[_0x1422('0x8')](),controller['getAnswers']);router[_0x1422('0x7')](_0x1422('0xe'),auth[_0x1422('0x8')](),controller[_0x1422('0xf')]);router[_0x1422('0x7')](_0x1422('0x10'),auth['isAuthenticated'](),controller[_0x1422('0x11')]);router[_0x1422('0x7')](_0x1422('0x12'),auth['isAuthenticated'](),controller[_0x1422('0x13')]);router[_0x1422('0x14')]('/',auth[_0x1422('0x8')](),controller[_0x1422('0x15')]);router[_0x1422('0x14')](_0x1422('0xc'),auth['isAuthenticated'](),controller[_0x1422('0x16')]);router[_0x1422('0x14')](_0x1422('0x17'),auth[_0x1422('0x8')](),controller[_0x1422('0x18')]);router['post'](_0x1422('0x19'),controller[_0x1422('0x1a')]);router[_0x1422('0x14')](_0x1422('0xe'),auth['isAuthenticated'](),controller[_0x1422('0x1b')]);router[_0x1422('0x14')](_0x1422('0x12'),auth[_0x1422('0x8')](),controller['addAgents']);router[_0x1422('0x14')](_0x1422('0x1c'),auth[_0x1422('0x8')](),controller[_0x1422('0x1d')]);router[_0x1422('0x1e')](_0x1422('0x1f'),auth[_0x1422('0x8')](),controller[_0x1422('0x20')]);router[_0x1422('0x21')](_0x1422('0x1f'),auth[_0x1422('0x8')](),controller[_0x1422('0x22')]);router[_0x1422('0x21')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x1422('0x23')]);router[_0x1422('0x21')](_0x1422('0x17'),auth[_0x1422('0x8')](),controller[_0x1422('0x24')]);router[_0x1422('0x21')](_0x1422('0x12'),auth[_0x1422('0x8')](),controller['removeAgents']);module[_0x1422('0x25')]=router; \ No newline at end of file +var _0x0595=['/:id/send','send','put','/:id','destroy','delete','removeAnswers','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','isAuthenticated','index','get','/describe','describe','show','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','addAnswer','/:id/notify','notify','addApplications','addAgents'];(function(_0x1ec6f2,_0x29c2ad){var _0xf8e955=function(_0x1aa948){while(--_0x1aa948){_0x1ec6f2['push'](_0x1ec6f2['shift']());}};_0xf8e955(++_0x29c2ad);}(_0x0595,0xda));var _0x5059=function(_0x4be8b3,_0x5e7a9e){_0x4be8b3=_0x4be8b3-0x0;var _0x43f4bd=_0x0595[_0x4be8b3];return _0x43f4bd;};'use strict';var multer=require(_0x5059('0x0'));var util=require(_0x5059('0x1'));var path=require(_0x5059('0x2'));var timeout=require(_0x5059('0x3'));var express=require('express');var router=express[_0x5059('0x4')]();var fs_extra=require(_0x5059('0x5'));var auth=require(_0x5059('0x6'));var interaction=require(_0x5059('0x7'));var config=require(_0x5059('0x8'));var controller=require(_0x5059('0x9'));router['get']('/',auth[_0x5059('0xa')](),controller[_0x5059('0xb')]);router[_0x5059('0xc')](_0x5059('0xd'),auth[_0x5059('0xa')](),controller[_0x5059('0xe')]);router['get']('/:id',auth[_0x5059('0xa')](),controller[_0x5059('0xf')]);router[_0x5059('0xc')]('/:id/dispositions',auth[_0x5059('0xa')](),controller[_0x5059('0x10')]);router[_0x5059('0xc')](_0x5059('0x11'),auth[_0x5059('0xa')](),controller[_0x5059('0x12')]);router[_0x5059('0xc')](_0x5059('0x13'),auth[_0x5059('0xa')](),controller[_0x5059('0x14')]);router['get'](_0x5059('0x15'),auth[_0x5059('0xa')](),controller[_0x5059('0x16')]);router[_0x5059('0xc')](_0x5059('0x17'),auth[_0x5059('0xa')](),controller[_0x5059('0x18')]);router[_0x5059('0x19')]('/',auth['isAuthenticated'](),controller[_0x5059('0x1a')]);router['post'](_0x5059('0x1b'),auth['isAuthenticated'](),controller[_0x5059('0x1c')]);router['post'](_0x5059('0x11'),auth[_0x5059('0xa')](),controller[_0x5059('0x1d')]);router[_0x5059('0x19')](_0x5059('0x1e'),controller[_0x5059('0x1f')]);router[_0x5059('0x19')](_0x5059('0x13'),auth['isAuthenticated'](),controller[_0x5059('0x20')]);router[_0x5059('0x19')](_0x5059('0x17'),auth['isAuthenticated'](),controller[_0x5059('0x21')]);router[_0x5059('0x19')](_0x5059('0x22'),auth[_0x5059('0xa')](),controller[_0x5059('0x23')]);router[_0x5059('0x24')](_0x5059('0x25'),auth[_0x5059('0xa')](),controller['update']);router['delete'](_0x5059('0x25'),auth[_0x5059('0xa')](),controller[_0x5059('0x26')]);router[_0x5059('0x27')](_0x5059('0x1b'),auth[_0x5059('0xa')](),controller['removeDispositions']);router[_0x5059('0x27')]('/:id/canned_answers',auth[_0x5059('0xa')](),controller[_0x5059('0x28')]);router['delete'](_0x5059('0x17'),auth[_0x5059('0xa')](),controller['removeAgents']);module[_0x5059('0x29')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 272cb50..bf82c2e 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 _0x9ba5=['sequelize','randomstring','exports','STRING','name','generate','TEXT','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x42f5a9,_0x372b75){var _0x3e9563=function(_0x166728){while(--_0x166728){_0x42f5a9['push'](_0x42f5a9['shift']());}};_0x3e9563(++_0x372b75);}(_0x9ba5,0xfc));var _0x59ba=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x9ba5[_0x4ff09b];return _0x3f5c2e;};'use strict';var Sequelize=require(_0x59ba('0x0'));var rs=require(_0x59ba('0x1'));module[_0x59ba('0x2')]={'name':{'type':Sequelize[_0x59ba('0x3')],'unique':_0x59ba('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x59ba('0x3')]},'token':{'type':Sequelize[_0x59ba('0x3')],'defaultValue':function(){return rs[_0x59ba('0x5')]();}},'replyUri':{'type':Sequelize[_0x59ba('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x59ba('0x6')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x59ba('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x59ba('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x59ba('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x59ba('0x3')]},'queueTransfer':{'type':Sequelize[_0x59ba('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x59ba('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x59ba('0x8')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x59ba('0x7')],'defaultValue':![],'comment':_0x59ba('0x9'),'set':function(_0x224fa0){if(!_0x224fa0)this['setDataValue'](_0x59ba('0xa'),null);this['setDataValue'](_0x59ba('0xb'),_0x224fa0);}}}; \ No newline at end of file +var _0xfb56=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','sequelize','randomstring','name','STRING','generate'];(function(_0x434db2,_0x113541){var _0x4e9284=function(_0x5d59b4){while(--_0x5d59b4){_0x434db2['push'](_0x434db2['shift']());}};_0x4e9284(++_0x113541);}(_0xfb56,0x1bd));var _0x6fb5=function(_0x2d96f1,_0xa647e4){_0x2d96f1=_0x2d96f1-0x0;var _0x41a5b0=_0xfb56[_0x2d96f1];return _0x41a5b0;};'use strict';var Sequelize=require(_0x6fb5('0x0'));var rs=require(_0x6fb5('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x6fb5('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x6fb5('0x3')]},'token':{'type':Sequelize[_0x6fb5('0x3')],'defaultValue':function(){return rs[_0x6fb5('0x4')]();}},'replyUri':{'type':Sequelize[_0x6fb5('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x6fb5('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x6fb5('0x5');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6fb5('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6fb5('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x6fb5('0x3')]},'queueTransfer':{'type':Sequelize[_0x6fb5('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6fb5('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6fb5('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6fb5('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x6fb5('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x6fb5('0x6')],'defaultValue':![],'comment':_0x6fb5('0x9'),'set':function(_0x10ed6a){if(!_0x10ed6a)this['setDataValue']('mandatoryDispositionPauseId',null);this['setDataValue']('mandatoryDisposition',_0x10ed6a);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 645eacd..50cd0c2 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 _0xa6e7=['rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','end','json','offset','undefined','limit','count','status','set','apply','reject','save','update','destroy','OpenchannelAccounts','UserProfileResource','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','fieldName','key','model','query','keys','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','type','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','rawAttributes','intersection','include','create','body','user','get','role','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','nolimit','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','createdAt','updatedAt','ListId','isNil','from','Sequelize','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','CmContact','Contacts','Applications','List','account','applications','list','orderBy','priority','asc','firstName','lastName','threadId','externalUrl','OpenchannelInteraction','ContactId','spread','contact','messageId','interaction','created','autoclose','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','startRouting','Start','EventManager','transaction','OpenchannelApplication','bulkCreate','findAndCountAll','getApplications','getInteractions','fullname','internal','Tag','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','DESC','out','Messages','dataValues','push'];(function(_0x39d544,_0x35c14f){var _0x5a5ff2=function(_0x2271fb){while(--_0x2271fb){_0x39d544['push'](_0x39d544['shift']());}};_0x5a5ff2(++_0x35c14f);}(_0xa6e7,0xbb));var _0x7a6e=function(_0x446c95,_0x1fbc5c){_0x446c95=_0x446c95-0x0;var _0x163b71=_0xa6e7[_0x446c95];return _0x163b71;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7a6e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7a6e('0x1'));var rp=require(_0x7a6e('0x2'));var moment=require(_0x7a6e('0x3'));var BPromise=require(_0x7a6e('0x4'));var Mustache=require('mustache');var util=require(_0x7a6e('0x5'));var path=require(_0x7a6e('0x6'));var sox=require(_0x7a6e('0x7'));var csv=require(_0x7a6e('0x8'));var ejs=require(_0x7a6e('0x9'));var fs=require('fs');var fs_extra=require(_0x7a6e('0xa'));var _=require(_0x7a6e('0xb'));var squel=require(_0x7a6e('0xc'));var crypto=require(_0x7a6e('0xd'));var jsforce=require(_0x7a6e('0xe'));var deskjs=require(_0x7a6e('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7a6e('0x10'));var Redis=require(_0x7a6e('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7a6e('0x12'));var hardwareService=require(_0x7a6e('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x7a6e('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7a6e('0x15'))['db'];config[_0x7a6e('0x16')]=_[_0x7a6e('0x17')](config['redis'],{'host':_0x7a6e('0x18'),'port':0x18eb});var socket=require(_0x7a6e('0x19'))(new Redis(config[_0x7a6e('0x16')]));require(_0x7a6e('0x1a'))[_0x7a6e('0x1b')](socket);var jayson=require(_0x7a6e('0x1c'));var client=jayson[_0x7a6e('0x1d')][_0x7a6e('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0x7a6e('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x30a654,_0x2ca475,_0x3b3868,_0x471c4e){return new BPromise(function(_0x5e7915,_0x46556c){var _0x42e093=_0x471c4e||client;return _0x42e093[_0x7a6e('0x1f')](_0x30a654,_0x3b3868)[_0x7a6e('0x20')](function(_0x1b4da1){logger[_0x7a6e('0x21')](_0x7a6e('0x22'),_0x2ca475,_0x7a6e('0x23'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x2ca475,_0x7a6e('0x23'),JSON[_0x7a6e('0x24')](_0x1b4da1));if(_0x1b4da1['error']){if(_0x1b4da1['error']['code']===0x1f4){logger[_0x7a6e('0x25')](_0x7a6e('0x22'),_0x2ca475,_0x1b4da1[_0x7a6e('0x25')][_0x7a6e('0x26')]);return _0x46556c(_0x1b4da1[_0x7a6e('0x25')]['message']);}logger[_0x7a6e('0x25')](_0x7a6e('0x22'),_0x2ca475,_0x1b4da1[_0x7a6e('0x25')][_0x7a6e('0x26')]);return _0x5e7915(_0x1b4da1[_0x7a6e('0x25')][_0x7a6e('0x26')]);}else{logger['info'](_0x7a6e('0x22'),_0x2ca475,_0x7a6e('0x23'));_0x5e7915(_0x1b4da1[_0x7a6e('0x27')][_0x7a6e('0x26')]);}})[_0x7a6e('0x28')](function(_0x1df71e){logger['error'](_0x7a6e('0x22'),_0x2ca475,_0x1df71e);_0x46556c(_0x1df71e);});});}function respondWithStatusCode(_0x51231f,_0x3d9256){_0x3d9256=_0x3d9256||0xcc;return function(_0x388c7a){if(_0x388c7a){return _0x51231f['sendStatus'](_0x3d9256);}return _0x51231f['status'](_0x3d9256)[_0x7a6e('0x29')]();};}function respondWithResult(_0x1f9e6a,_0x2ae958){_0x2ae958=_0x2ae958||0xc8;return function(_0x3568f6){if(_0x3568f6){return _0x1f9e6a['status'](_0x2ae958)[_0x7a6e('0x2a')](_0x3568f6);}};}function respondWithFilteredResult(_0x1e5625,_0x5d1874){return function(_0x3a2f9b){if(_0x3a2f9b){var _0x497ebb=typeof _0x5d1874[_0x7a6e('0x2b')]===_0x7a6e('0x2c')&&typeof _0x5d1874[_0x7a6e('0x2d')]===_0x7a6e('0x2c');var _0x117ca0=_0x3a2f9b[_0x7a6e('0x2e')];var _0x479647=_0x497ebb?0x0:_0x5d1874[_0x7a6e('0x2b')];var _0x1346e0=_0x497ebb?_0x3a2f9b[_0x7a6e('0x2e')]:_0x5d1874[_0x7a6e('0x2b')]+_0x5d1874[_0x7a6e('0x2d')];var _0x261051;if(_0x1346e0>=_0x117ca0){_0x1346e0=_0x117ca0;_0x261051=0xc8;}else{_0x261051=0xce;}_0x1e5625[_0x7a6e('0x2f')](_0x261051);return _0x1e5625[_0x7a6e('0x30')]('Content-Range',_0x479647+'-'+_0x1346e0+'/'+_0x117ca0)['json'](_0x3a2f9b);}return null;};}function patchUpdates(_0x16c117){return function(_0x470eb){try{jsonpatch[_0x7a6e('0x31')](_0x470eb,_0x16c117,!![]);}catch(_0x6370f9){return BPromise[_0x7a6e('0x32')](_0x6370f9);}return _0x470eb[_0x7a6e('0x33')]();};}function saveUpdates(_0x57d8bb,_0x33c13e){return function(_0x3f985d){if(_0x3f985d){return _0x3f985d[_0x7a6e('0x34')](_0x57d8bb)['then'](function(_0x424dfc){return _0x424dfc;});}return null;};}function removeEntity(_0x18589a,_0x289554){return function(_0x4aaa0c){if(_0x4aaa0c){return _0x4aaa0c[_0x7a6e('0x35')]()[_0x7a6e('0x20')](function(){var _0x5bcfb4=_0x4aaa0c['get']({'plain':!![]});var _0x3ce216=_0x7a6e('0x36');return db[_0x7a6e('0x37')][_0x7a6e('0x35')]({'where':{'type':_0x3ce216,'resourceId':_0x5bcfb4['id']}})[_0x7a6e('0x20')](function(){return _0x4aaa0c;});})['then'](function(){_0x18589a[_0x7a6e('0x2f')](0xcc)[_0x7a6e('0x29')]();});}};}function handleEntityNotFound(_0x4474bc,_0x34fb7a){return function(_0x5e6df1){if(!_0x5e6df1){_0x4474bc[_0x7a6e('0x38')](0x194);}return _0x5e6df1;};}function handleError(_0x22ee58,_0x469082){_0x469082=_0x469082||0x1f4;return function(_0x1c0bf2){logger[_0x7a6e('0x25')](_0x1c0bf2[_0x7a6e('0x39')]);if(_0x1c0bf2[_0x7a6e('0x3a')]){delete _0x1c0bf2['name'];}_0x22ee58[_0x7a6e('0x2f')](_0x469082)[_0x7a6e('0x3b')](_0x1c0bf2);};}exports[_0x7a6e('0x3c')]=function(_0x3f160f,_0x2bdaf5){var _0x4247a7={'include':[{'model':db[_0x7a6e('0x3d')],'as':_0x7a6e('0x3e')}]},_0x24beb3={},_0x13865a={'count':0x0,'rows':[]};var _0x1c50c9=_[_0x7a6e('0x3f')](db[_0x7a6e('0x40')]['rawAttributes'],function(_0xd93500){return{'name':_0xd93500[_0x7a6e('0x41')],'type':_0xd93500['type'][_0x7a6e('0x42')]};});_0x24beb3[_0x7a6e('0x43')]=_[_0x7a6e('0x3f')](_0x1c50c9,'name');_0x24beb3[_0x7a6e('0x44')]=_[_0x7a6e('0x45')](_0x3f160f['query']);_0x24beb3['filters']=_['intersection'](_0x24beb3[_0x7a6e('0x43')],_0x24beb3[_0x7a6e('0x44')]);_0x4247a7[_0x7a6e('0x46')]=_['intersection'](_0x24beb3[_0x7a6e('0x43')],qs[_0x7a6e('0x47')](_0x3f160f[_0x7a6e('0x44')]['fields']));_0x4247a7[_0x7a6e('0x46')]=_0x4247a7[_0x7a6e('0x46')][_0x7a6e('0x48')]?_0x4247a7[_0x7a6e('0x46')]:_0x24beb3[_0x7a6e('0x43')];if(!_0x3f160f[_0x7a6e('0x44')][_0x7a6e('0x49')]('nolimit')){_0x4247a7[_0x7a6e('0x2d')]=qs[_0x7a6e('0x2d')](_0x3f160f[_0x7a6e('0x44')][_0x7a6e('0x2d')]);_0x4247a7[_0x7a6e('0x2b')]=qs['offset'](_0x3f160f[_0x7a6e('0x44')]['offset']);}_0x4247a7[_0x7a6e('0x4a')]=qs[_0x7a6e('0x4b')](_0x3f160f[_0x7a6e('0x44')]['sort']);_0x4247a7[_0x7a6e('0x4c')]=qs['filters'](_[_0x7a6e('0x4d')](_0x3f160f[_0x7a6e('0x44')],_0x24beb3[_0x7a6e('0x4e')]),_0x1c50c9);if(_0x3f160f['query'][_0x7a6e('0x4f')]){_0x4247a7['where']=_['merge'](_0x4247a7['where'],{'$or':_[_0x7a6e('0x3f')](_0x1c50c9,function(_0x3c7186){if(_0x3c7186[_0x7a6e('0x50')]!==_0x7a6e('0x51')){var _0x3c1722={};_0x3c1722[_0x3c7186['name']]={'$like':'%'+_0x3f160f['query']['filter']+'%'};return _0x3c1722;}})});}_0x4247a7=_[_0x7a6e('0x52')]({},_0x4247a7,_0x3f160f[_0x7a6e('0x53')]);var _0x53cc36={'where':_0x4247a7[_0x7a6e('0x4c')]};return db['OpenchannelAccount'][_0x7a6e('0x2e')](_0x53cc36)[_0x7a6e('0x20')](function(_0x48db31){_0x13865a[_0x7a6e('0x2e')]=_0x48db31;if(_0x3f160f['query'][_0x7a6e('0x54')]){_0x4247a7['include']=[{'all':!![]}];}return db[_0x7a6e('0x40')][_0x7a6e('0x55')](_0x4247a7);})['then'](function(_0x29e817){_0x13865a[_0x7a6e('0x56')]=_0x29e817;return _0x13865a;})[_0x7a6e('0x20')](respondWithFilteredResult(_0x2bdaf5,_0x4247a7))[_0x7a6e('0x28')](handleError(_0x2bdaf5,null));};exports[_0x7a6e('0x57')]=function(_0x5dee89,_0x31e583){var _0x3a3ef3={'raw':![],'where':{'id':_0x5dee89[_0x7a6e('0x58')]['id']},'include':[{'model':db[_0x7a6e('0x3d')],'as':'mandatoryDispositionPause'}]},_0x5d4dee={};_0x5d4dee[_0x7a6e('0x43')]=_[_0x7a6e('0x45')](db[_0x7a6e('0x40')][_0x7a6e('0x59')]);_0x5d4dee[_0x7a6e('0x44')]=_['keys'](_0x5dee89[_0x7a6e('0x44')]);_0x5d4dee[_0x7a6e('0x4e')]=_[_0x7a6e('0x5a')](_0x5d4dee[_0x7a6e('0x43')],_0x5d4dee[_0x7a6e('0x44')]);_0x3a3ef3['attributes']=_[_0x7a6e('0x5a')](_0x5d4dee[_0x7a6e('0x43')],qs[_0x7a6e('0x47')](_0x5dee89['query'][_0x7a6e('0x47')]));_0x3a3ef3[_0x7a6e('0x46')]=_0x3a3ef3['attributes']['length']?_0x3a3ef3[_0x7a6e('0x46')]:_0x5d4dee[_0x7a6e('0x43')];if(_0x5dee89[_0x7a6e('0x44')]['includeAll']){_0x3a3ef3[_0x7a6e('0x5b')]=[{'all':!![]}];}_0x3a3ef3=_[_0x7a6e('0x52')]({},_0x3a3ef3,_0x5dee89[_0x7a6e('0x53')]);return db[_0x7a6e('0x40')]['find'](_0x3a3ef3)['then'](handleEntityNotFound(_0x31e583,null))[_0x7a6e('0x20')](respondWithResult(_0x31e583,null))[_0x7a6e('0x28')](handleError(_0x31e583,null));};exports[_0x7a6e('0x5c')]=function(_0x331590,_0x54ad3b){return db[_0x7a6e('0x40')][_0x7a6e('0x5c')](_0x331590[_0x7a6e('0x5d')],{})[_0x7a6e('0x20')](function(_0x21ad96){var _0x109783=_0x331590[_0x7a6e('0x5e')][_0x7a6e('0x5f')]({'plain':!![]});if(!_0x109783)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x109783[_0x7a6e('0x60')]===_0x7a6e('0x5e')){var _0x9e6c90=_0x21ad96[_0x7a6e('0x5f')]({'plain':!![]});var _0x5d0ca6=_0x7a6e('0x36');return db[_0x7a6e('0x61')][_0x7a6e('0x62')]({'where':{'name':_0x5d0ca6,'userProfileId':_0x109783['userProfileId']},'raw':!![]})[_0x7a6e('0x20')](function(_0x27fc65){if(_0x27fc65&&_0x27fc65['autoAssociation']===0x0){return db[_0x7a6e('0x37')][_0x7a6e('0x5c')]({'name':_0x9e6c90[_0x7a6e('0x3a')],'resourceId':_0x9e6c90['id'],'type':_0x27fc65['name'],'sectionId':_0x27fc65['id']},{})[_0x7a6e('0x20')](function(){return _0x21ad96;});}else{return _0x21ad96;}})['catch'](function(_0x17a6d3){logger['error'](_0x7a6e('0x63'),_0x17a6d3);throw _0x17a6d3;});}return _0x21ad96;})['then'](respondWithResult(_0x54ad3b,0xc9))['catch'](handleError(_0x54ad3b,null));};exports['update']=function(_0x56e10c,_0x4f0edb){if(_0x56e10c[_0x7a6e('0x5d')]['id']){delete _0x56e10c[_0x7a6e('0x5d')]['id'];}return db['OpenchannelAccount'][_0x7a6e('0x62')]({'where':{'id':_0x56e10c[_0x7a6e('0x58')]['id']},'include':[{'model':db[_0x7a6e('0x3d')],'as':_0x7a6e('0x3e')}]})[_0x7a6e('0x20')](handleEntityNotFound(_0x4f0edb,null))[_0x7a6e('0x20')](saveUpdates(_0x56e10c['body'],null))[_0x7a6e('0x20')](respondWithResult(_0x4f0edb,null))[_0x7a6e('0x28')](handleError(_0x4f0edb,null));};exports[_0x7a6e('0x35')]=function(_0x535d6b,_0x1d462d){return db[_0x7a6e('0x40')][_0x7a6e('0x62')]({'where':{'id':_0x535d6b[_0x7a6e('0x58')]['id']}})[_0x7a6e('0x20')](handleEntityNotFound(_0x1d462d,null))[_0x7a6e('0x20')](removeEntity(_0x1d462d,null))[_0x7a6e('0x28')](handleError(_0x1d462d,null));};exports[_0x7a6e('0x64')]=function(_0x1c32aa,_0x5e95ea){return db[_0x7a6e('0x40')]['describe']()[_0x7a6e('0x20')](respondWithResult(_0x5e95ea,null))[_0x7a6e('0x28')](handleError(_0x5e95ea,null));};exports[_0x7a6e('0x65')]=function(_0x5e9001,_0x4d2adb,_0xc87977){if(_0x5e9001[_0x7a6e('0x5d')]['id']){delete _0x5e9001[_0x7a6e('0x5d')]['id'];}return db[_0x7a6e('0x40')][_0x7a6e('0x62')]({'where':{'id':_0x5e9001['params']['id']}})[_0x7a6e('0x20')](handleEntityNotFound(_0x4d2adb,null))[_0x7a6e('0x20')](function(_0x3cc68a){if(_0x3cc68a){_0x5e9001[_0x7a6e('0x5d')][_0x7a6e('0x66')]=_0x3cc68a['id'];return db[_0x7a6e('0x67')]['create'](_0x5e9001['body']);}})['then'](respondWithResult(_0x4d2adb,null))['catch'](handleError(_0x4d2adb,null));};exports[_0x7a6e('0x68')]=function(_0x3deca0,_0xd1c8f8,_0x1943fa){var _0x257d33={'raw':![],'where':{}};var _0x1e4a35={};var _0x5dff4e={'count':0x0,'rows':[]};return db[_0x7a6e('0x40')][_0x7a6e('0x69')]({'where':{'id':_0x3deca0[_0x7a6e('0x58')]['id']}})[_0x7a6e('0x20')](handleEntityNotFound(_0xd1c8f8,null))[_0x7a6e('0x20')](function(_0x317471){if(_0x317471){_0x1e4a35[_0x7a6e('0x43')]=_[_0x7a6e('0x45')](db[_0x7a6e('0x67')]['rawAttributes']);_0x1e4a35[_0x7a6e('0x44')]=_[_0x7a6e('0x45')](_0x3deca0[_0x7a6e('0x44')]);_0x1e4a35[_0x7a6e('0x4e')]=_[_0x7a6e('0x5a')](_0x1e4a35[_0x7a6e('0x43')],_0x1e4a35['query']);_0x257d33['attributes']=_[_0x7a6e('0x5a')](_0x1e4a35[_0x7a6e('0x43')],qs[_0x7a6e('0x47')](_0x3deca0[_0x7a6e('0x44')][_0x7a6e('0x47')]));_0x257d33[_0x7a6e('0x46')]=_0x257d33[_0x7a6e('0x46')][_0x7a6e('0x48')]?_0x257d33['attributes']:_0x1e4a35[_0x7a6e('0x43')];if(!_0x3deca0[_0x7a6e('0x44')]['hasOwnProperty'](_0x7a6e('0x6a'))){_0x257d33[_0x7a6e('0x2d')]=qs[_0x7a6e('0x2d')](_0x3deca0['query']['limit']);_0x257d33['offset']=qs[_0x7a6e('0x2b')](_0x3deca0['query'][_0x7a6e('0x2b')]);}_0x257d33[_0x7a6e('0x4a')]=qs['sort'](_0x3deca0['query'][_0x7a6e('0x4b')]);_0x257d33[_0x7a6e('0x4c')]=qs['filters'](_[_0x7a6e('0x4d')](_0x3deca0[_0x7a6e('0x44')],_0x1e4a35['filters']));_0x257d33['where'][_0x7a6e('0x66')]=_0x317471['id'];if(_0x3deca0[_0x7a6e('0x44')][_0x7a6e('0x4f')]){_0x257d33[_0x7a6e('0x4c')]=_[_0x7a6e('0x52')](_0x257d33[_0x7a6e('0x4c')],{'$or':_['map'](_0x257d33[_0x7a6e('0x46')],function(_0x303850){var _0x5ae5e0={};_0x5ae5e0[_0x303850]={'$like':'%'+_0x3deca0['query'][_0x7a6e('0x4f')]+'%'};return _0x5ae5e0;})});}_0x257d33=_[_0x7a6e('0x52')]({},_0x257d33,_0x3deca0[_0x7a6e('0x53')]);return db[_0x7a6e('0x67')]['count']({'where':_0x257d33[_0x7a6e('0x4c')]})[_0x7a6e('0x20')](function(_0x557e5b){_0x5dff4e[_0x7a6e('0x2e')]=_0x557e5b;if(_0x3deca0[_0x7a6e('0x44')][_0x7a6e('0x54')]){_0x257d33[_0x7a6e('0x5b')]=[{'all':!![]}];}return db[_0x7a6e('0x67')][_0x7a6e('0x55')](_0x257d33);})[_0x7a6e('0x20')](function(_0x4a6c3b){_0x5dff4e[_0x7a6e('0x56')]=_0x4a6c3b;return _0x5dff4e;});}})[_0x7a6e('0x20')](respondWithFilteredResult(_0xd1c8f8,_0x257d33))[_0x7a6e('0x28')](handleError(_0xd1c8f8,null));};exports[_0x7a6e('0x6b')]=function(_0x13e660,_0x2f50a0,_0x19e35f){return db['OpenchannelAccount'][_0x7a6e('0x62')]({'where':{'id':_0x13e660['params']['id']}})[_0x7a6e('0x20')](handleEntityNotFound(_0x2f50a0,null))[_0x7a6e('0x20')](function(_0x1caf01){if(_0x1caf01){return _0x1caf01[_0x7a6e('0x6b')](_0x13e660['query'][_0x7a6e('0x6c')]);}})[_0x7a6e('0x20')](respondWithStatusCode(_0x2f50a0,null))[_0x7a6e('0x28')](handleError(_0x2f50a0,null));};exports['addAnswer']=function(_0x38b47b,_0x2d1ddd,_0x5f225e){if(_0x38b47b[_0x7a6e('0x5d')]['id']){delete _0x38b47b['body']['id'];}return db[_0x7a6e('0x40')][_0x7a6e('0x62')]({'where':{'id':_0x38b47b[_0x7a6e('0x58')]['id']}})[_0x7a6e('0x20')](handleEntityNotFound(_0x2d1ddd,null))[_0x7a6e('0x20')](function(_0x11589b){if(_0x11589b){_0x38b47b[_0x7a6e('0x5d')][_0x7a6e('0x66')]=_0x11589b['id'];return db[_0x7a6e('0x6d')][_0x7a6e('0x5c')](_0x38b47b[_0x7a6e('0x5d')]);}})[_0x7a6e('0x20')](respondWithResult(_0x2d1ddd,null))[_0x7a6e('0x28')](handleError(_0x2d1ddd,null));};exports[_0x7a6e('0x6e')]=function(_0x36b2d5,_0x966538,_0x1eb3df){var _0x12b837={'raw':![],'where':{}};var _0x56bd55={};var _0x14b23a={'count':0x0,'rows':[]};return db[_0x7a6e('0x40')][_0x7a6e('0x69')]({'where':{'id':_0x36b2d5[_0x7a6e('0x58')]['id']}})[_0x7a6e('0x20')](handleEntityNotFound(_0x966538,null))[_0x7a6e('0x20')](function(_0x12dcfb){if(_0x12dcfb){_0x56bd55[_0x7a6e('0x43')]=_[_0x7a6e('0x45')](db[_0x7a6e('0x6d')]['rawAttributes']);_0x56bd55[_0x7a6e('0x44')]=_[_0x7a6e('0x45')](_0x36b2d5[_0x7a6e('0x44')]);_0x56bd55[_0x7a6e('0x4e')]=_[_0x7a6e('0x5a')](_0x56bd55['model'],_0x56bd55[_0x7a6e('0x44')]);_0x12b837[_0x7a6e('0x46')]=_[_0x7a6e('0x5a')](_0x56bd55[_0x7a6e('0x43')],qs['fields'](_0x36b2d5[_0x7a6e('0x44')][_0x7a6e('0x47')]));_0x12b837[_0x7a6e('0x46')]=_0x12b837[_0x7a6e('0x46')][_0x7a6e('0x48')]?_0x12b837['attributes']:_0x56bd55[_0x7a6e('0x43')];if(!_0x36b2d5['query'][_0x7a6e('0x49')](_0x7a6e('0x6a'))){_0x12b837['limit']=qs[_0x7a6e('0x2d')](_0x36b2d5[_0x7a6e('0x44')]['limit']);_0x12b837[_0x7a6e('0x2b')]=qs['offset'](_0x36b2d5[_0x7a6e('0x44')]['offset']);}_0x12b837['order']=qs[_0x7a6e('0x4b')](_0x36b2d5[_0x7a6e('0x44')]['sort']);_0x12b837[_0x7a6e('0x4c')]=qs['filters'](_[_0x7a6e('0x4d')](_0x36b2d5[_0x7a6e('0x44')],_0x56bd55['filters']));_0x12b837[_0x7a6e('0x4c')][_0x7a6e('0x66')]=_0x12dcfb['id'];if(_0x36b2d5[_0x7a6e('0x44')][_0x7a6e('0x4f')]){_0x12b837[_0x7a6e('0x4c')]=_[_0x7a6e('0x52')](_0x12b837[_0x7a6e('0x4c')],{'$or':_[_0x7a6e('0x3f')](_0x12b837[_0x7a6e('0x46')],function(_0x22c8d0){var _0x59ea85={};_0x59ea85[_0x22c8d0]={'$like':'%'+_0x36b2d5[_0x7a6e('0x44')]['filter']+'%'};return _0x59ea85;})});}_0x12b837=_['merge']({},_0x12b837,_0x36b2d5[_0x7a6e('0x53')]);return db[_0x7a6e('0x6d')][_0x7a6e('0x2e')]({'where':_0x12b837['where']})[_0x7a6e('0x20')](function(_0x200ebd){_0x14b23a[_0x7a6e('0x2e')]=_0x200ebd;if(_0x36b2d5[_0x7a6e('0x44')]['includeAll']){_0x12b837['include']=[{'all':!![]}];}return db[_0x7a6e('0x6d')][_0x7a6e('0x55')](_0x12b837);})['then'](function(_0x5e4a87){_0x14b23a[_0x7a6e('0x56')]=_0x5e4a87;return _0x14b23a;});}})['then'](respondWithFilteredResult(_0x966538,_0x12b837))['catch'](handleError(_0x966538,null));};exports['removeAnswers']=function(_0x278632,_0x1de3f1,_0x2f45fe){return db['OpenchannelAccount'][_0x7a6e('0x62')]({'where':{'id':_0x278632[_0x7a6e('0x58')]['id']}})[_0x7a6e('0x20')](handleEntityNotFound(_0x1de3f1,null))[_0x7a6e('0x20')](function(_0x2fe5fc){if(_0x2fe5fc){return _0x2fe5fc[_0x7a6e('0x6f')](_0x278632['query'][_0x7a6e('0x6c')]);}})[_0x7a6e('0x20')](respondWithStatusCode(_0x1de3f1,null))[_0x7a6e('0x28')](handleError(_0x1de3f1,null));};exports[_0x7a6e('0x70')]=function(_0x1bcb59,_0x125c28,_0x33cf88){var _0x399f80={'body':_0x1bcb59[_0x7a6e('0x5d')],'channel':_0x7a6e('0x71')};var _0x10a5db=[];var _0x4ed7d4=[];var _0x348f29={};var _0x5d301f=![];return db['CmContact'][_0x7a6e('0x64')]()[_0x7a6e('0x20')](function(_0x3b107d){if(!_0x3b107d){throw new db['Sequelize']['ValidationError']('no\x20available\x20attributes');}_0x10a5db=_['difference'](_[_0x7a6e('0x45')](_0x3b107d),[_0x7a6e('0x72'),_0x7a6e('0x73')]);_0x4ed7d4=_['difference'](_[_0x7a6e('0x45')](_0x3b107d),[_0x7a6e('0x72'),_0x7a6e('0x73'),'CompanyId',_0x7a6e('0x74')]);if(_0x1bcb59[_0x7a6e('0x5d')]['id']){delete _0x1bcb59[_0x7a6e('0x5d')]['id'];}if(_[_0x7a6e('0x75')](_0x1bcb59[_0x7a6e('0x5d')][_0x7a6e('0x76')])){throw new db[(_0x7a6e('0x77'))][(_0x7a6e('0x78'))](_0x7a6e('0x79'));}if(_[_0x7a6e('0x75')](_0x1bcb59['body']['body'])||_0x1bcb59['body'][_0x7a6e('0x5d')]===''){throw new db[(_0x7a6e('0x77'))]['ValidationError'](_0x7a6e('0x7a'));}if(_[_0x7a6e('0x75')](_0x1bcb59[_0x7a6e('0x5d')][_0x7a6e('0x7b')])){throw new db[(_0x7a6e('0x77'))][(_0x7a6e('0x78'))](_0x7a6e('0x7c')+_0x4ed7d4);}if(!_[_0x7a6e('0x7d')](_0x4ed7d4,_0x1bcb59[_0x7a6e('0x5d')][_0x7a6e('0x7b')])){throw new db[(_0x7a6e('0x77'))][(_0x7a6e('0x78'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4ed7d4);}_0x348f29[_0x1bcb59['body'][_0x7a6e('0x7b')]]=_0x1bcb59[_0x7a6e('0x5d')][_0x7a6e('0x76')];})['then'](function(){return db[_0x7a6e('0x40')]['find']({'where':{'id':_0x1bcb59[_0x7a6e('0x58')]['id']},'include':[{'model':db[_0x7a6e('0x7e')],'as':'List','include':[{'model':db[_0x7a6e('0x7f')],'as':_0x7a6e('0x80'),'where':_0x348f29,'limit':0x1,'order':[[_0x7a6e('0x73'),'DESC']]}]},{'model':db['OpenchannelApplication'],'as':_0x7a6e('0x81')}]});})[_0x7a6e('0x20')](handleEntityNotFound(_0x125c28,null))[_0x7a6e('0x20')](function(_0x26042e){if(_0x26042e&&_0x26042e[_0x7a6e('0x82')]){_0x399f80[_0x7a6e('0x83')]=_0x26042e;_0x399f80[_0x7a6e('0x84')]=_0x26042e['Applications'];_0x399f80[_0x7a6e('0x85')]=_0x26042e['List'];_0x399f80[_0x7a6e('0x84')]=_[_0x7a6e('0x86')](_0x399f80[_0x7a6e('0x84')],[_0x7a6e('0x87')],[_0x7a6e('0x88')]);if(_0x399f80[_0x7a6e('0x83')][_0x7a6e('0x81')]){delete _0x399f80[_0x7a6e('0x83')][_0x7a6e('0x81')];}if(_0x399f80['account']['List']&&_0x399f80[_0x7a6e('0x83')]['List'][_0x7a6e('0x80')][_0x7a6e('0x48')]){return _0x399f80[_0x7a6e('0x83')][_0x7a6e('0x82')][_0x7a6e('0x80')][0x0];}var _0x59904c=_[_0x7a6e('0x17')](_0x1bcb59[_0x7a6e('0x5d')],{'firstName':_0x1bcb59['body'][_0x7a6e('0x76')],'ListId':_0x26042e['ListId']});_0x59904c[_0x1bcb59[_0x7a6e('0x5d')][_0x7a6e('0x7b')]]=_0x1bcb59[_0x7a6e('0x5d')][_0x7a6e('0x76')];return db[_0x7a6e('0x7f')][_0x7a6e('0x5c')](_0x59904c,{'fields':_0x10a5db,'raw':!![]});}})[_0x7a6e('0x20')](handleEntityNotFound(_0x125c28,null))['then'](function(_0x1dadd4){_0x399f80['contact']=_0x1dadd4;if(_0x1dadd4){var _0x3acfbe={'ContactId':_0x1dadd4['id'],'OpenchannelAccountId':_0x1bcb59[_0x7a6e('0x58')]['id'],'from':(_0x1dadd4[_0x7a6e('0x89')]||'')+'\x20'+(_0x1dadd4[_0x7a6e('0x8a')]||'')};var _0x371e8a={'OpenchannelAccountId':_0x1bcb59[_0x7a6e('0x58')]['id'],'closed':![]};if(_0x1bcb59['body'][_0x7a6e('0x8b')]){_0x371e8a[_0x7a6e('0x8b')]=_0x1bcb59['body'][_0x7a6e('0x8b')];return db['OpenchannelInteraction'][_0x7a6e('0x62')]({'where':_0x371e8a})['then'](function(_0xb9762){if(_0xb9762){return[_0xb9762,![]];}_0x3acfbe[_0x7a6e('0x8b')]=_0x1bcb59[_0x7a6e('0x5d')]['threadId'];_0x3acfbe['externalUrl']=_0x1bcb59[_0x7a6e('0x5d')][_0x7a6e('0x8c')];return db[_0x7a6e('0x8d')][_0x7a6e('0x5c')](_0x3acfbe)[_0x7a6e('0x20')](function(_0xa3f76e){return[_0xa3f76e,!![]];});});}else{_0x371e8a['threadId']=null;}_0x371e8a[_0x7a6e('0x8e')]=_0x1dadd4['id'];return db[_0x7a6e('0x8d')][_0x7a6e('0x62')]({'where':_0x371e8a})[_0x7a6e('0x20')](function(_0x2f44e7){if(_0x2f44e7){return[_0x2f44e7,![]];}return db[_0x7a6e('0x8d')][_0x7a6e('0x5c')](_0x3acfbe)[_0x7a6e('0x20')](function(_0x51ad3c){return[_0x51ad3c,!![]];});});}})[_0x7a6e('0x8f')](function(_0x1d2a2e,_0x47ec1e){if(_0x1d2a2e){_0x5d301f=_0x47ec1e;if(!_0x47ec1e){var _0xf85789={'from':(_0x399f80[_0x7a6e('0x90')][_0x7a6e('0x89')]||'')+'\x20'+(_0x399f80['contact'][_0x7a6e('0x8a')]||'')};if(_0x1bcb59[_0x7a6e('0x5d')][_0x7a6e('0x8b')]&&_0x1bcb59[_0x7a6e('0x5d')][_0x7a6e('0x91')]&&_0x1bcb59[_0x7a6e('0x5d')][_0x7a6e('0x8b')]!=_0x1bcb59['body'][_0x7a6e('0x91')]){_0xf85789[_0x7a6e('0x8b')]=_0x1bcb59[_0x7a6e('0x5d')][_0x7a6e('0x91')];}return _0x1d2a2e[_0x7a6e('0x34')](_0xf85789);}else{return _0x1d2a2e;}}})[_0x7a6e('0x20')](function(_0x2b68c6){_0x399f80[_0x7a6e('0x92')]=_0x2b68c6[_0x7a6e('0x5f')]({'plain':!![]});_0x399f80[_0x7a6e('0x92')][_0x7a6e('0x93')]=_0x5d301f;if(_0x399f80[_0x7a6e('0x92')][_0x7a6e('0x93')]){if(_0x399f80[_0x7a6e('0x83')][_0x7a6e('0x94')]){_0x399f80['applications']['push']({'id':0x0,'priority':_0x399f80['applications'][_0x7a6e('0x48')]+0x1,'app':_0x7a6e('0x95'),'appdata':_0x7a6e('0x96'),'interval':_0x7a6e('0x97')});}}return db[_0x7a6e('0x98')][_0x7a6e('0x5c')]({'body':_0x1bcb59['body']['body'],'OpenchannelAccountId':_0x1bcb59[_0x7a6e('0x58')]['id'],'OpenchannelInteractionId':_0x2b68c6['id'],'direction':'in','ContactId':_0x399f80[_0x7a6e('0x90')]['id'],'AttachmentId':_0x1bcb59['body'][_0x7a6e('0x99')]});})[_0x7a6e('0x20')](function(_0x59f62c){_0x399f80[_0x7a6e('0x26')]=_0x59f62c;if(_0x399f80['interaction'][_0x7a6e('0x9a')]){return db[_0x7a6e('0x9b')][_0x7a6e('0x62')]({'attributes':['id',_0x7a6e('0x3a')],'where':{'id':_0x399f80[_0x7a6e('0x92')][_0x7a6e('0x9a')]}})[_0x7a6e('0x20')](function(_0x30c347){if(_0x30c347){_0x399f80['applications'][_0x7a6e('0x9c')]({'id':0x0,'priority':0x0,'app':_0x7a6e('0x9d'),'appdata':_0x30c347[_0x7a6e('0x3a')]+','+(_0x399f80[_0x7a6e('0x83')][_0x7a6e('0x9e')]||0xa),'interval':_0x7a6e('0x97')});_0x399f80[_0x7a6e('0x9f')]=![];}return respondWithRpcPromise('Start',_0x7a6e('0xa0'),_0x399f80);});}return respondWithRpcPromise(_0x7a6e('0xa1'),'startRouting',_0x399f80);})[_0x7a6e('0x20')](function(_0x1ab07d){respondWithRpcPromise('EventManager',_0x7a6e('0xa2'),{'event':_0x7a6e('0x70'),'message':_0x1ab07d},client9002);return _0x1ab07d;})[_0x7a6e('0x20')](respondWithResult(_0x125c28,null))[_0x7a6e('0x28')](handleError(_0x125c28,null));};exports['addApplications']=function(_0x48a147,_0x136e64,_0x122f1c){return db[_0x7a6e('0x40')][_0x7a6e('0x69')]({'where':{'id':_0x48a147[_0x7a6e('0x58')]['id']}})[_0x7a6e('0x20')](handleEntityNotFound(_0x136e64,null))[_0x7a6e('0x20')](function(_0x61d3a2){if(_0x61d3a2){return db['sequelize'][_0x7a6e('0xa3')](function(_0x39911f){return db[_0x7a6e('0xa4')][_0x7a6e('0x35')]({'where':{'OpenchannelAccountId':_0x48a147[_0x7a6e('0x58')]['id']},'transaction':_0x39911f})[_0x7a6e('0x20')](function(_0xdf3c33){var _0x5832e5=_[_0x7a6e('0x3f')](_0x48a147['body'],function(_0x240d5d){_0x240d5d[_0x7a6e('0x66')]=_0x48a147[_0x7a6e('0x58')]['id'];return _0x240d5d;});return db[_0x7a6e('0xa4')][_0x7a6e('0xa5')](_0x5832e5,{'transaction':_0x39911f});});})[_0x7a6e('0x20')](function(){return db[_0x7a6e('0xa4')][_0x7a6e('0xa6')]({'where':{'OpenchannelAccountId':_0x48a147[_0x7a6e('0x58')]['id']},'order':'priority'});});}})['then'](respondWithResult(_0x136e64,null))['catch'](handleError(_0x136e64,null));};exports['getApplications']=function(_0x4ad8c8,_0x2839de,_0x65c40d){var _0x3a310a={};var _0x16b8d1={};var _0x5c1607;var _0x430f06;return db[_0x7a6e('0x40')][_0x7a6e('0x69')]({'where':{'id':_0x4ad8c8[_0x7a6e('0x58')]['id']}})['then'](handleEntityNotFound(_0x2839de,null))[_0x7a6e('0x20')](function(_0x2f7d73){if(_0x2f7d73){_0x5c1607=_0x2f7d73;_0x16b8d1[_0x7a6e('0x43')]=_[_0x7a6e('0x45')](db['OpenchannelApplication']['rawAttributes']);_0x16b8d1['query']=_[_0x7a6e('0x45')](_0x4ad8c8['query']);_0x16b8d1[_0x7a6e('0x4e')]=_['intersection'](_0x16b8d1[_0x7a6e('0x43')],_0x16b8d1[_0x7a6e('0x44')]);_0x3a310a[_0x7a6e('0x46')]=_['intersection'](_0x16b8d1['model'],qs[_0x7a6e('0x47')](_0x4ad8c8['query'][_0x7a6e('0x47')]));_0x3a310a['attributes']=_0x3a310a[_0x7a6e('0x46')][_0x7a6e('0x48')]?_0x3a310a['attributes']:_0x16b8d1['model'];_0x3a310a[_0x7a6e('0x4a')]=qs[_0x7a6e('0x4b')](_0x4ad8c8[_0x7a6e('0x44')][_0x7a6e('0x4b')]);_0x3a310a[_0x7a6e('0x4c')]=qs[_0x7a6e('0x4e')](_[_0x7a6e('0x4d')](_0x4ad8c8[_0x7a6e('0x44')],_0x16b8d1['filters']));if(_0x4ad8c8['query'][_0x7a6e('0x4f')]){_0x3a310a[_0x7a6e('0x4c')]=_['merge'](_0x3a310a[_0x7a6e('0x4c')],{'$or':_[_0x7a6e('0x3f')](_0x3a310a[_0x7a6e('0x46')],function(_0x44aba0){var _0x5c2e71={};_0x5c2e71[_0x44aba0]={'$like':'%'+_0x4ad8c8[_0x7a6e('0x44')][_0x7a6e('0x4f')]+'%'};return _0x5c2e71;})});}_0x3a310a=_[_0x7a6e('0x52')]({},_0x3a310a,_0x4ad8c8[_0x7a6e('0x53')]);return _0x5c1607['getApplications'](_0x3a310a);}})[_0x7a6e('0x20')](function(_0x10fcd9){if(_0x10fcd9){_0x430f06=_0x10fcd9[_0x7a6e('0x48')];if(!_0x4ad8c8[_0x7a6e('0x44')][_0x7a6e('0x49')](_0x7a6e('0x6a'))){_0x3a310a[_0x7a6e('0x2d')]=qs[_0x7a6e('0x2d')](_0x4ad8c8['query'][_0x7a6e('0x2d')]);_0x3a310a[_0x7a6e('0x2b')]=qs[_0x7a6e('0x2b')](_0x4ad8c8[_0x7a6e('0x44')]['offset']);}return _0x5c1607[_0x7a6e('0xa7')](_0x3a310a);}})['then'](function(_0x289ad8){if(_0x289ad8){return _0x289ad8?{'count':_0x430f06,'rows':_0x289ad8}:null;}})['then'](respondWithResult(_0x2839de,null))['catch'](handleError(_0x2839de,null));};exports[_0x7a6e('0xa8')]=function(_0x6bd645,_0xe874d8,_0x33156c){var _0x493240={'raw':![],'where':{}};var _0x5381e1={};var _0x27e5d3={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x6bd645[_0x7a6e('0x58')]['id']}})[_0x7a6e('0x20')](handleEntityNotFound(_0xe874d8,null))[_0x7a6e('0x20')](function(_0x33ab58){if(_0x33ab58){_0x5381e1[_0x7a6e('0x43')]=_[_0x7a6e('0x45')](db[_0x7a6e('0x8d')][_0x7a6e('0x59')]);_0x5381e1[_0x7a6e('0x44')]=_[_0x7a6e('0x45')](_0x6bd645[_0x7a6e('0x44')]);_0x5381e1[_0x7a6e('0x4e')]=_[_0x7a6e('0x5a')](_0x5381e1[_0x7a6e('0x43')],_0x5381e1[_0x7a6e('0x44')]);_0x493240['attributes']=_[_0x7a6e('0x5a')](_0x5381e1[_0x7a6e('0x43')],qs[_0x7a6e('0x47')](_0x6bd645[_0x7a6e('0x44')][_0x7a6e('0x47')]));_0x493240['attributes']=_0x493240[_0x7a6e('0x46')]['length']?_0x493240[_0x7a6e('0x46')]:_0x5381e1[_0x7a6e('0x43')];if(!_0x6bd645[_0x7a6e('0x44')][_0x7a6e('0x49')](_0x7a6e('0x6a'))){_0x493240[_0x7a6e('0x2d')]=qs[_0x7a6e('0x2d')](_0x6bd645[_0x7a6e('0x44')][_0x7a6e('0x2d')]);_0x493240[_0x7a6e('0x2b')]=qs[_0x7a6e('0x2b')](_0x6bd645[_0x7a6e('0x44')]['offset']);}_0x493240[_0x7a6e('0x4a')]=qs[_0x7a6e('0x4b')](_0x6bd645[_0x7a6e('0x44')][_0x7a6e('0x4b')]);_0x493240['where']=qs[_0x7a6e('0x4e')](_['pick'](_0x6bd645[_0x7a6e('0x44')],_0x5381e1[_0x7a6e('0x4e')]));_0x493240['where'][_0x7a6e('0x66')]=_0x33ab58['id'];if(_0x6bd645[_0x7a6e('0x44')]['filter']){_0x493240[_0x7a6e('0x4c')]=_['merge'](_0x493240[_0x7a6e('0x4c')],{'$or':_['map'](_0x493240['attributes'],function(_0xb55402){var _0xa5ff83={};_0xa5ff83[_0xb55402]={'$like':'%'+_0x6bd645[_0x7a6e('0x44')]['filter']+'%'};return _0xa5ff83;})});}_0x493240=_[_0x7a6e('0x52')]({},_0x493240,_0x6bd645[_0x7a6e('0x53')]);return db['OpenchannelInteraction'][_0x7a6e('0x2e')]({'where':_0x493240[_0x7a6e('0x4c')]})[_0x7a6e('0x20')](function(_0xb61e03){_0x27e5d3[_0x7a6e('0x2e')]=_0xb61e03;if(_0x6bd645[_0x7a6e('0x44')]['includeAll']){_0x493240['include']=[{'model':db[_0x7a6e('0x7f')],'as':'Contact','required':![]},{'model':db[_0x7a6e('0x9b')],'as':'Owner','attributes':['name',_0x7a6e('0xa9'),_0x7a6e('0xaa')],'required':![]},{'model':db[_0x7a6e('0xab')],'as':_0x7a6e('0xac'),'attributes':['id',_0x7a6e('0x3a'),_0x7a6e('0xad')],'where':_0x6bd645['query']['tag']?{'id':_0x6bd645[_0x7a6e('0x44')]['tag']}:undefined,'required':_0x6bd645[_0x7a6e('0x44')][_0x7a6e('0xae')]?!![]:![]}];}return db['OpenchannelInteraction'][_0x7a6e('0x55')](_0x493240);})[_0x7a6e('0x20')](function(_0x7320e7){_0x27e5d3['rows']=_0x7320e7;return _0x27e5d3;});}})[_0x7a6e('0x20')](respondWithFilteredResult(_0xe874d8,_0x493240))[_0x7a6e('0x28')](handleError(_0xe874d8,null));};exports['addAgents']=function(_0x5c3003,_0x21ce03,_0x128115){return db[_0x7a6e('0x40')][_0x7a6e('0x62')]({'where':{'id':_0x5c3003[_0x7a6e('0x58')]['id']}})[_0x7a6e('0x20')](handleEntityNotFound(_0x21ce03,null))[_0x7a6e('0x20')](function(_0xd72777){if(_0xd72777){return _0xd72777[_0x7a6e('0xaf')](_0x5c3003[_0x7a6e('0x5d')][_0x7a6e('0x6c')],_[_0x7a6e('0xb0')](_0x5c3003[_0x7a6e('0x5d')],[_0x7a6e('0x6c'),'id'])||{})[_0x7a6e('0x8f')](function(_0x504359){for(var _0x2b820d=0x0;_0x2b820d<_0x5c3003[_0x7a6e('0x5d')][_0x7a6e('0x6c')][_0x7a6e('0x48')];_0x2b820d+=0x1){socket[_0x7a6e('0xb1')](_0x7a6e('0xb2'),{'UserId':Number(_0x5c3003[_0x7a6e('0x5d')][_0x7a6e('0x6c')][_0x2b820d]),'OpenchannelAccountId':Number(_0x5c3003[_0x7a6e('0x58')]['id'])});}return _0x504359;});}})['then'](respondWithResult(_0x21ce03,null))['catch'](handleError(_0x21ce03,null));};exports[_0x7a6e('0xb3')]=function(_0x254d77,_0x4a47e2,_0x2206f9){return db[_0x7a6e('0x40')]['find']({'where':{'id':_0x254d77[_0x7a6e('0x58')]['id']}})[_0x7a6e('0x20')](handleEntityNotFound(_0x4a47e2,null))[_0x7a6e('0x20')](function(_0x562bc5){if(_0x562bc5){return _0x562bc5[_0x7a6e('0xb3')](_0x254d77[_0x7a6e('0x44')][_0x7a6e('0x6c')])[_0x7a6e('0x20')](function(){if(_['isArray'](_0x254d77['query'][_0x7a6e('0x6c')])){for(var _0x34326b=0x0;_0x34326b<_0x254d77[_0x7a6e('0x44')][_0x7a6e('0x6c')][_0x7a6e('0x48')];_0x34326b+=0x1){socket[_0x7a6e('0xb1')](_0x7a6e('0xb4'),{'UserId':Number(_0x254d77[_0x7a6e('0x44')][_0x7a6e('0x6c')][_0x34326b]),'OpenchannelAccountId':Number(_0x254d77['params']['id'])});}}else{socket['emit'](_0x7a6e('0xb4'),{'UserId':Number(_0x254d77[_0x7a6e('0x44')]['ids']),'OpenchannelAccountId':Number(_0x254d77[_0x7a6e('0x58')]['id'])});}});}})['then'](respondWithStatusCode(_0x4a47e2,null))[_0x7a6e('0x28')](handleError(_0x4a47e2,null));};exports[_0x7a6e('0xb5')]=function(_0xa83bd5,_0x1687e5,_0x38886d){var _0x564143={};var _0x1109dd={};var _0x205cd0;var _0x40ca33;return db[_0x7a6e('0x40')][_0x7a6e('0x69')]({'where':{'id':_0xa83bd5[_0x7a6e('0x58')]['id']}})[_0x7a6e('0x20')](handleEntityNotFound(_0x1687e5,null))[_0x7a6e('0x20')](function(_0x36720c){if(_0x36720c){_0x205cd0=_0x36720c;_0x1109dd['model']=_[_0x7a6e('0x45')](db[_0x7a6e('0x9b')][_0x7a6e('0x59')]);_0x1109dd[_0x7a6e('0x44')]=_['keys'](_0xa83bd5[_0x7a6e('0x44')]);_0x1109dd[_0x7a6e('0x4e')]=_[_0x7a6e('0x5a')](_0x1109dd['model'],_0x1109dd[_0x7a6e('0x44')]);_0x564143[_0x7a6e('0x46')]=_['intersection'](_0x1109dd[_0x7a6e('0x43')],qs[_0x7a6e('0x47')](_0xa83bd5['query'][_0x7a6e('0x47')]));_0x564143[_0x7a6e('0x46')]=_0x564143[_0x7a6e('0x46')][_0x7a6e('0x48')]?_0x564143[_0x7a6e('0x46')]:_0x1109dd[_0x7a6e('0x43')];_0x564143[_0x7a6e('0x4a')]=qs[_0x7a6e('0x4b')](_0xa83bd5[_0x7a6e('0x44')][_0x7a6e('0x4b')]);_0x564143[_0x7a6e('0x4c')]=qs['filters'](_[_0x7a6e('0x4d')](_0xa83bd5[_0x7a6e('0x44')],_0x1109dd['filters']));if(_0xa83bd5[_0x7a6e('0x44')][_0x7a6e('0x4f')]){_0x564143[_0x7a6e('0x4c')]=_[_0x7a6e('0x52')](_0x564143[_0x7a6e('0x4c')],{'$or':_[_0x7a6e('0x3f')](_0x564143['attributes'],function(_0x306285){var _0x461cf1={};_0x461cf1[_0x306285]={'$like':'%'+_0xa83bd5[_0x7a6e('0x44')][_0x7a6e('0x4f')]+'%'};return _0x461cf1;})});}_0x564143=_[_0x7a6e('0x52')]({},_0x564143,_0xa83bd5[_0x7a6e('0x53')]);return _0x205cd0[_0x7a6e('0xb5')](_0x564143);}})[_0x7a6e('0x20')](function(_0x445ff6){if(_0x445ff6){_0x40ca33=_0x445ff6['length'];if(!_0xa83bd5[_0x7a6e('0x44')][_0x7a6e('0x49')]('nolimit')){_0x564143[_0x7a6e('0x2d')]=qs[_0x7a6e('0x2d')](_0xa83bd5[_0x7a6e('0x44')]['limit']);_0x564143[_0x7a6e('0x2b')]=qs[_0x7a6e('0x2b')](_0xa83bd5[_0x7a6e('0x44')][_0x7a6e('0x2b')]);}return _0x205cd0[_0x7a6e('0xb5')](_0x564143);}})[_0x7a6e('0x20')](function(_0x25f545){if(_0x25f545){return _0x25f545?{'count':_0x40ca33,'rows':_0x25f545}:null;}})[_0x7a6e('0x20')](respondWithResult(_0x1687e5,null))[_0x7a6e('0x28')](handleError(_0x1687e5,null));};exports[_0x7a6e('0x3b')]=function(_0x5d5f89,_0x3ee78b,_0x380595){var _0x430f93,_0x4692f5,_0x43decd;if(_[_0x7a6e('0x75')](_0x5d5f89[_0x7a6e('0x5d')][_0x7a6e('0x5d')])||_0x5d5f89[_0x7a6e('0x5d')][_0x7a6e('0x5d')]===''){throw new db[(_0x7a6e('0x77'))][(_0x7a6e('0x78'))](_0x7a6e('0x7a'));}if(_[_0x7a6e('0x75')](_0x5d5f89[_0x7a6e('0x5d')]['to'])){}_0x430f93=_0x5d5f89[_0x7a6e('0x5d')]['to'];return db[_0x7a6e('0x40')][_0x7a6e('0x69')]({'where':{'id':_0x5d5f89['params']['id']}})['then'](handleEntityNotFound(_0x3ee78b,null))[_0x7a6e('0x20')](function(_0xbbbfa){if(_0xbbbfa){return db[_0x7a6e('0x40')][_0x7a6e('0x62')]({'where':{'id':_0xbbbfa['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x7a6e('0x7f')],'as':_0x7a6e('0x80'),'where':{[_0xbbbfa[_0x7a6e('0x7b')]]:_0x430f93},'limit':0x1,'order':[[_0x7a6e('0x73'),_0x7a6e('0xb6')]]}]}]})[_0x7a6e('0x20')](handleEntityNotFound(_0x3ee78b,null))['then'](function(_0x4095df){if(_0x4095df&&_0x4095df[_0x7a6e('0x82')]){_0x4692f5=_0x4095df[_0x7a6e('0x5f')]({'plain':!![]});if(_0x4692f5[_0x7a6e('0x82')]&&_0x4692f5[_0x7a6e('0x82')][_0x7a6e('0x80')][_0x7a6e('0x48')]){return _0x4692f5['List'][_0x7a6e('0x80')][0x0];}return db['CmContact'][_0x7a6e('0x5c')](_[_0x7a6e('0x17')](_0x5d5f89[_0x7a6e('0x5d')],{'firstName':_0x430f93,[_0x4095df[_0x7a6e('0x7b')]]:_0x430f93,'phone':_0x430f93,'ListId':_0x4692f5[_0x7a6e('0x74')]}));}})[_0x7a6e('0x20')](handleEntityNotFound(_0x3ee78b,null))['then'](function(_0x472866){if(_0x472866){_0x43decd=_0x472866;return db[_0x7a6e('0x8d')][_0x7a6e('0x62')]({'where':{'ContactId':_0x43decd['id'],'closed':![],'OpenchannelAccountId':_0x4692f5['id']}})[_0x7a6e('0x20')](function(_0x2cd11b){if(_0x2cd11b){return[_0x2cd11b,![]];}return db[_0x7a6e('0x8d')]['create']({'UserId':_0x5d5f89[_0x7a6e('0x5e')]['id'],'ContactId':_0x43decd['id'],'OpenchannelAccountId':_0x4692f5['id'],'lastMsgDirection':_0x7a6e('0xb7'),'Messages':[_['merge'](_0x5d5f89['body'],{'read':![],'body':_0x5d5f89['body'][_0x7a6e('0x5d')],'OpenchannelAccountId':_0x4692f5['id'],'UserId':_0x5d5f89['user']['id'],'ContactId':_0x43decd['id']})]},{'include':[{'model':db[_0x7a6e('0x98')],'as':_0x7a6e('0xb8')}]})[_0x7a6e('0x20')](function(_0xc6cf69){return[_0xc6cf69,!![]];});});}})[_0x7a6e('0x8f')](function(_0x21d625,_0x53811b){if(_0x53811b){return _0x21d625;}return db[_0x7a6e('0x98')][_0x7a6e('0x5c')](_[_0x7a6e('0x52')](_0x5d5f89['body'],{'read':![],'body':_0x5d5f89['body'][_0x7a6e('0x5d')],'OpenchannelAccountId':_0x4692f5['id'],'OpenchannelInteractionId':_0x21d625['id'],'UserId':_0x5d5f89['user']['id'],'ContactId':_0x43decd['id']}))[_0x7a6e('0x20')](function(_0x28f626){_0x21d625['dataValues']['Messages']=[];_0x21d625[_0x7a6e('0xb9')][_0x7a6e('0xb8')][_0x7a6e('0xba')](_0x28f626[_0x7a6e('0xb9')]);return _0x21d625;});});}})[_0x7a6e('0x20')](respondWithResult(_0x3ee78b,null))[_0x7a6e('0x28')](handleError(_0x3ee78b,null));}; \ No newline at end of file +var _0xb336=['catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','OpenchannelAccounts','UserProfileSection','userProfileId','autoAssociation','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','order','removeAnswers','notify','openchannel','CmContact','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','DESC','Applications','account','list','applications','orderBy','asc','Contacts','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','push','close','OpenchannelMessage','AttachmentId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','startRouting','Start','EventManager','addApplications','transaction','OpenchannelApplication','bulkCreate','findAndCountAll','priority','getApplications','getInteractions','Contact','Owner','fullname','Tag','Tags','color','tag','addAgents','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','out','dataValues','Messages','eml-format','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./openchannelAccount.socket','jayson/promise','http','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','status','end','json','undefined','limit','offset','count','set','save','update','destroy','then','get','UserProfileResource','sendStatus','stack','name','send','index','map','OpenchannelAccount','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','include','findAll','rows','show','params','Pause','mandatoryDispositionPause','rawAttributes','fields','includeAll','find'];(function(_0x6cfdf6,_0x248972){var _0x18ffce=function(_0x386315){while(--_0x386315){_0x6cfdf6['push'](_0x6cfdf6['shift']());}};_0x18ffce(++_0x248972);}(_0xb336,0x1d1));var _0x6b33=function(_0x36d767,_0x90d8b8){_0x36d767=_0x36d767-0x0;var _0x91f50c=_0xb336[_0x36d767];return _0x91f50c;};'use strict';var emlformat=require(_0x6b33('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6b33('0x1'));var moment=require(_0x6b33('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x6b33('0x3'));var util=require(_0x6b33('0x4'));var path=require(_0x6b33('0x5'));var sox=require('sox');var csv=require(_0x6b33('0x6'));var ejs=require(_0x6b33('0x7'));var fs=require('fs');var fs_extra=require(_0x6b33('0x8'));var _=require(_0x6b33('0x9'));var squel=require(_0x6b33('0xa'));var crypto=require(_0x6b33('0xb'));var jsforce=require(_0x6b33('0xc'));var deskjs=require(_0x6b33('0xd'));var toCsv=require(_0x6b33('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6b33('0xe'));var authService=require(_0x6b33('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6b33('0x10'));var logger=require('../../config/logger')(_0x6b33('0x11'));var utils=require(_0x6b33('0x12'));var config=require(_0x6b33('0x13'));var licenseUtil=require(_0x6b33('0x14'));var db=require(_0x6b33('0x15'))['db'];config['redis']=_[_0x6b33('0x16')](config[_0x6b33('0x17')],{'host':_0x6b33('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6b33('0x17')]));require(_0x6b33('0x19'))['register'](socket);var jayson=require(_0x6b33('0x1a'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson['client'][_0x6b33('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x2c564a,_0x8ca04f,_0x2f9d66,_0x5b8608){return new BPromise(function(_0x182b09,_0x1c9701){var _0x147284=_0x5b8608||client;return _0x147284[_0x6b33('0x1c')](_0x2c564a,_0x2f9d66)['then'](function(_0x155448){logger[_0x6b33('0x1d')](_0x6b33('0x1e'),_0x8ca04f,_0x6b33('0x1f'));logger[_0x6b33('0x20')](_0x6b33('0x21'),_0x8ca04f,_0x6b33('0x1f'),JSON[_0x6b33('0x22')](_0x155448));if(_0x155448[_0x6b33('0x23')]){if(_0x155448[_0x6b33('0x23')]['code']===0x1f4){logger[_0x6b33('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0x8ca04f,_0x155448['error'][_0x6b33('0x24')]);return _0x1c9701(_0x155448[_0x6b33('0x23')][_0x6b33('0x24')]);}logger[_0x6b33('0x23')](_0x6b33('0x1e'),_0x8ca04f,_0x155448[_0x6b33('0x23')][_0x6b33('0x24')]);return _0x182b09(_0x155448[_0x6b33('0x23')]['message']);}else{logger['info'](_0x6b33('0x1e'),_0x8ca04f,_0x6b33('0x1f'));_0x182b09(_0x155448[_0x6b33('0x25')][_0x6b33('0x24')]);}})['catch'](function(_0x1e404e){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x8ca04f,_0x1e404e);_0x1c9701(_0x1e404e);});});}function respondWithStatusCode(_0x2a943d,_0x3cd4c4){_0x3cd4c4=_0x3cd4c4||0xcc;return function(_0x903f49){if(_0x903f49){return _0x2a943d['sendStatus'](_0x3cd4c4);}return _0x2a943d[_0x6b33('0x26')](_0x3cd4c4)[_0x6b33('0x27')]();};}function respondWithResult(_0x581648,_0x2ecc66){_0x2ecc66=_0x2ecc66||0xc8;return function(_0x556d98){if(_0x556d98){return _0x581648[_0x6b33('0x26')](_0x2ecc66)[_0x6b33('0x28')](_0x556d98);}};}function respondWithFilteredResult(_0x1d5aef,_0x122df6){return function(_0x441dd8){if(_0x441dd8){var _0x464129=typeof _0x122df6['offset']===_0x6b33('0x29')&&typeof _0x122df6[_0x6b33('0x2a')]==='undefined';var _0x3d40ad=_0x441dd8['count'];var _0x156f23=_0x464129?0x0:_0x122df6[_0x6b33('0x2b')];var _0x5096e8=_0x464129?_0x441dd8[_0x6b33('0x2c')]:_0x122df6['offset']+_0x122df6['limit'];var _0x23cd76;if(_0x5096e8>=_0x3d40ad){_0x5096e8=_0x3d40ad;_0x23cd76=0xc8;}else{_0x23cd76=0xce;}_0x1d5aef[_0x6b33('0x26')](_0x23cd76);return _0x1d5aef[_0x6b33('0x2d')]('Content-Range',_0x156f23+'-'+_0x5096e8+'/'+_0x3d40ad)[_0x6b33('0x28')](_0x441dd8);}return null;};}function patchUpdates(_0x579ce6){return function(_0x4295cc){try{jsonpatch['apply'](_0x4295cc,_0x579ce6,!![]);}catch(_0x42c90c){return BPromise['reject'](_0x42c90c);}return _0x4295cc[_0x6b33('0x2e')]();};}function saveUpdates(_0x934f3c,_0x53a634){return function(_0x52f768){if(_0x52f768){return _0x52f768[_0x6b33('0x2f')](_0x934f3c)['then'](function(_0x5a1ec8){return _0x5a1ec8;});}return null;};}function removeEntity(_0x10f55d,_0x18ef6a){return function(_0x198808){if(_0x198808){return _0x198808[_0x6b33('0x30')]()[_0x6b33('0x31')](function(){var _0x9af0be=_0x198808[_0x6b33('0x32')]({'plain':!![]});var _0x17b281='OpenchannelAccounts';return db[_0x6b33('0x33')][_0x6b33('0x30')]({'where':{'type':_0x17b281,'resourceId':_0x9af0be['id']}})['then'](function(){return _0x198808;});})[_0x6b33('0x31')](function(){_0x10f55d[_0x6b33('0x26')](0xcc)[_0x6b33('0x27')]();});}};}function handleEntityNotFound(_0x145b47,_0x1ff3ed){return function(_0x27d1ca){if(!_0x27d1ca){_0x145b47[_0x6b33('0x34')](0x194);}return _0x27d1ca;};}function handleError(_0x35989b,_0x423634){_0x423634=_0x423634||0x1f4;return function(_0x320281){logger[_0x6b33('0x23')](_0x320281[_0x6b33('0x35')]);if(_0x320281[_0x6b33('0x36')]){delete _0x320281[_0x6b33('0x36')];}_0x35989b[_0x6b33('0x26')](_0x423634)[_0x6b33('0x37')](_0x320281);};}exports[_0x6b33('0x38')]=function(_0x192c3f,_0xaef810){var _0x2a2d9f={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x2221b3={},_0x4354f7={'count':0x0,'rows':[]};var _0x479340=_[_0x6b33('0x39')](db[_0x6b33('0x3a')]['rawAttributes'],function(_0x1f6be9){return{'name':_0x1f6be9['fieldName'],'type':_0x1f6be9[_0x6b33('0x3b')][_0x6b33('0x3c')]};});_0x2221b3[_0x6b33('0x3d')]=_[_0x6b33('0x39')](_0x479340,'name');_0x2221b3[_0x6b33('0x3e')]=_[_0x6b33('0x3f')](_0x192c3f[_0x6b33('0x3e')]);_0x2221b3[_0x6b33('0x40')]=_['intersection'](_0x2221b3[_0x6b33('0x3d')],_0x2221b3[_0x6b33('0x3e')]);_0x2a2d9f['attributes']=_[_0x6b33('0x41')](_0x2221b3['model'],qs['fields'](_0x192c3f[_0x6b33('0x3e')]['fields']));_0x2a2d9f['attributes']=_0x2a2d9f[_0x6b33('0x42')][_0x6b33('0x43')]?_0x2a2d9f[_0x6b33('0x42')]:_0x2221b3[_0x6b33('0x3d')];if(!_0x192c3f[_0x6b33('0x3e')][_0x6b33('0x44')](_0x6b33('0x45'))){_0x2a2d9f[_0x6b33('0x2a')]=qs[_0x6b33('0x2a')](_0x192c3f[_0x6b33('0x3e')][_0x6b33('0x2a')]);_0x2a2d9f[_0x6b33('0x2b')]=qs[_0x6b33('0x2b')](_0x192c3f['query'][_0x6b33('0x2b')]);}_0x2a2d9f['order']=qs[_0x6b33('0x46')](_0x192c3f[_0x6b33('0x3e')][_0x6b33('0x46')]);_0x2a2d9f[_0x6b33('0x47')]=qs['filters'](_[_0x6b33('0x48')](_0x192c3f[_0x6b33('0x3e')],_0x2221b3['filters']),_0x479340);if(_0x192c3f[_0x6b33('0x3e')][_0x6b33('0x49')]){_0x2a2d9f[_0x6b33('0x47')]=_[_0x6b33('0x4a')](_0x2a2d9f[_0x6b33('0x47')],{'$or':_[_0x6b33('0x39')](_0x479340,function(_0x4f091b){if(_0x4f091b['type']!=='VIRTUAL'){var _0x60f4be={};_0x60f4be[_0x4f091b[_0x6b33('0x36')]]={'$like':'%'+_0x192c3f[_0x6b33('0x3e')][_0x6b33('0x49')]+'%'};return _0x60f4be;}})});}_0x2a2d9f=_[_0x6b33('0x4a')]({},_0x2a2d9f,_0x192c3f[_0x6b33('0x4b')]);var _0x148f0f={'where':_0x2a2d9f[_0x6b33('0x47')]};return db['OpenchannelAccount'][_0x6b33('0x2c')](_0x148f0f)[_0x6b33('0x31')](function(_0x2f3006){_0x4354f7['count']=_0x2f3006;if(_0x192c3f['query']['includeAll']){_0x2a2d9f[_0x6b33('0x4c')]=[{'all':!![]}];}return db[_0x6b33('0x3a')][_0x6b33('0x4d')](_0x2a2d9f);})[_0x6b33('0x31')](function(_0xa7fb24){_0x4354f7[_0x6b33('0x4e')]=_0xa7fb24;return _0x4354f7;})[_0x6b33('0x31')](respondWithFilteredResult(_0xaef810,_0x2a2d9f))['catch'](handleError(_0xaef810,null));};exports[_0x6b33('0x4f')]=function(_0x2488a3,_0x5d3176){var _0x3c9765={'raw':![],'where':{'id':_0x2488a3[_0x6b33('0x50')]['id']},'include':[{'model':db[_0x6b33('0x51')],'as':_0x6b33('0x52')}]},_0x4a425d={};_0x4a425d['model']=_['keys'](db[_0x6b33('0x3a')][_0x6b33('0x53')]);_0x4a425d['query']=_[_0x6b33('0x3f')](_0x2488a3[_0x6b33('0x3e')]);_0x4a425d[_0x6b33('0x40')]=_[_0x6b33('0x41')](_0x4a425d[_0x6b33('0x3d')],_0x4a425d['query']);_0x3c9765[_0x6b33('0x42')]=_[_0x6b33('0x41')](_0x4a425d[_0x6b33('0x3d')],qs[_0x6b33('0x54')](_0x2488a3[_0x6b33('0x3e')]['fields']));_0x3c9765[_0x6b33('0x42')]=_0x3c9765['attributes'][_0x6b33('0x43')]?_0x3c9765['attributes']:_0x4a425d['model'];if(_0x2488a3[_0x6b33('0x3e')][_0x6b33('0x55')]){_0x3c9765[_0x6b33('0x4c')]=[{'all':!![]}];}_0x3c9765=_['merge']({},_0x3c9765,_0x2488a3[_0x6b33('0x4b')]);return db[_0x6b33('0x3a')][_0x6b33('0x56')](_0x3c9765)['then'](handleEntityNotFound(_0x5d3176,null))[_0x6b33('0x31')](respondWithResult(_0x5d3176,null))[_0x6b33('0x57')](handleError(_0x5d3176,null));};exports[_0x6b33('0x58')]=function(_0x20710b,_0x2a250a){return db[_0x6b33('0x3a')]['create'](_0x20710b[_0x6b33('0x59')],{})['then'](function(_0x2dd5b1){var _0x49356f=_0x20710b['user'][_0x6b33('0x32')]({'plain':!![]});if(!_0x49356f)throw new Error(_0x6b33('0x5a'));if(_0x49356f['role']===_0x6b33('0x5b')){var _0x14fba2=_0x2dd5b1[_0x6b33('0x32')]({'plain':!![]});var _0x3a096e=_0x6b33('0x5c');return db[_0x6b33('0x5d')][_0x6b33('0x56')]({'where':{'name':_0x3a096e,'userProfileId':_0x49356f[_0x6b33('0x5e')]},'raw':!![]})[_0x6b33('0x31')](function(_0x52ead4){if(_0x52ead4&&_0x52ead4[_0x6b33('0x5f')]===0x0){return db[_0x6b33('0x33')][_0x6b33('0x58')]({'name':_0x14fba2[_0x6b33('0x36')],'resourceId':_0x14fba2['id'],'type':_0x52ead4[_0x6b33('0x36')],'sectionId':_0x52ead4['id']},{})[_0x6b33('0x31')](function(){return _0x2dd5b1;});}else{return _0x2dd5b1;}})[_0x6b33('0x57')](function(_0x1e50fd){logger[_0x6b33('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1e50fd);throw _0x1e50fd;});}return _0x2dd5b1;})[_0x6b33('0x31')](respondWithResult(_0x2a250a,0xc9))[_0x6b33('0x57')](handleError(_0x2a250a,null));};exports[_0x6b33('0x2f')]=function(_0x548f28,_0x5e4e82){if(_0x548f28[_0x6b33('0x59')]['id']){delete _0x548f28[_0x6b33('0x59')]['id'];}return db[_0x6b33('0x3a')]['find']({'where':{'id':_0x548f28['params']['id']},'include':[{'model':db[_0x6b33('0x51')],'as':_0x6b33('0x52')}]})['then'](handleEntityNotFound(_0x5e4e82,null))[_0x6b33('0x31')](saveUpdates(_0x548f28['body'],null))[_0x6b33('0x31')](respondWithResult(_0x5e4e82,null))[_0x6b33('0x57')](handleError(_0x5e4e82,null));};exports[_0x6b33('0x30')]=function(_0x3ca5d9,_0xeeed1c){return db[_0x6b33('0x3a')][_0x6b33('0x56')]({'where':{'id':_0x3ca5d9[_0x6b33('0x50')]['id']}})[_0x6b33('0x31')](handleEntityNotFound(_0xeeed1c,null))[_0x6b33('0x31')](removeEntity(_0xeeed1c,null))[_0x6b33('0x57')](handleError(_0xeeed1c,null));};exports[_0x6b33('0x60')]=function(_0x1c20cc,_0x5a3a5b){return db[_0x6b33('0x3a')]['describe']()['then'](respondWithResult(_0x5a3a5b,null))['catch'](handleError(_0x5a3a5b,null));};exports[_0x6b33('0x61')]=function(_0x4ca91d,_0x252c52,_0x20a5fb){if(_0x4ca91d[_0x6b33('0x59')]['id']){delete _0x4ca91d[_0x6b33('0x59')]['id'];}return db[_0x6b33('0x3a')][_0x6b33('0x56')]({'where':{'id':_0x4ca91d['params']['id']}})[_0x6b33('0x31')](handleEntityNotFound(_0x252c52,null))[_0x6b33('0x31')](function(_0x454b75){if(_0x454b75){_0x4ca91d[_0x6b33('0x59')][_0x6b33('0x62')]=_0x454b75['id'];return db[_0x6b33('0x63')][_0x6b33('0x58')](_0x4ca91d[_0x6b33('0x59')]);}})['then'](respondWithResult(_0x252c52,null))[_0x6b33('0x57')](handleError(_0x252c52,null));};exports[_0x6b33('0x64')]=function(_0x57baf3,_0x460742,_0x277235){var _0x2e2eb7={'raw':![],'where':{}};var _0x147b1f={};var _0x1af6b3={'count':0x0,'rows':[]};return db[_0x6b33('0x3a')][_0x6b33('0x65')]({'where':{'id':_0x57baf3['params']['id']}})[_0x6b33('0x31')](handleEntityNotFound(_0x460742,null))[_0x6b33('0x31')](function(_0x25a9c0){if(_0x25a9c0){_0x147b1f[_0x6b33('0x3d')]=_[_0x6b33('0x3f')](db[_0x6b33('0x63')]['rawAttributes']);_0x147b1f[_0x6b33('0x3e')]=_[_0x6b33('0x3f')](_0x57baf3['query']);_0x147b1f[_0x6b33('0x40')]=_[_0x6b33('0x41')](_0x147b1f['model'],_0x147b1f[_0x6b33('0x3e')]);_0x2e2eb7[_0x6b33('0x42')]=_[_0x6b33('0x41')](_0x147b1f[_0x6b33('0x3d')],qs[_0x6b33('0x54')](_0x57baf3[_0x6b33('0x3e')][_0x6b33('0x54')]));_0x2e2eb7['attributes']=_0x2e2eb7[_0x6b33('0x42')][_0x6b33('0x43')]?_0x2e2eb7['attributes']:_0x147b1f[_0x6b33('0x3d')];if(!_0x57baf3[_0x6b33('0x3e')][_0x6b33('0x44')](_0x6b33('0x45'))){_0x2e2eb7[_0x6b33('0x2a')]=qs[_0x6b33('0x2a')](_0x57baf3[_0x6b33('0x3e')][_0x6b33('0x2a')]);_0x2e2eb7[_0x6b33('0x2b')]=qs[_0x6b33('0x2b')](_0x57baf3['query'][_0x6b33('0x2b')]);}_0x2e2eb7['order']=qs[_0x6b33('0x46')](_0x57baf3[_0x6b33('0x3e')][_0x6b33('0x46')]);_0x2e2eb7['where']=qs[_0x6b33('0x40')](_[_0x6b33('0x48')](_0x57baf3[_0x6b33('0x3e')],_0x147b1f[_0x6b33('0x40')]));_0x2e2eb7[_0x6b33('0x47')]['OpenchannelAccountId']=_0x25a9c0['id'];if(_0x57baf3[_0x6b33('0x3e')]['filter']){_0x2e2eb7[_0x6b33('0x47')]=_['merge'](_0x2e2eb7[_0x6b33('0x47')],{'$or':_[_0x6b33('0x39')](_0x2e2eb7[_0x6b33('0x42')],function(_0x414b23){var _0x194387={};_0x194387[_0x414b23]={'$like':'%'+_0x57baf3[_0x6b33('0x3e')][_0x6b33('0x49')]+'%'};return _0x194387;})});}_0x2e2eb7=_[_0x6b33('0x4a')]({},_0x2e2eb7,_0x57baf3['options']);return db[_0x6b33('0x63')][_0x6b33('0x2c')]({'where':_0x2e2eb7[_0x6b33('0x47')]})[_0x6b33('0x31')](function(_0x4b449f){_0x1af6b3['count']=_0x4b449f;if(_0x57baf3['query'][_0x6b33('0x55')]){_0x2e2eb7['include']=[{'all':!![]}];}return db['Disposition'][_0x6b33('0x4d')](_0x2e2eb7);})[_0x6b33('0x31')](function(_0x43b9fd){_0x1af6b3['rows']=_0x43b9fd;return _0x1af6b3;});}})[_0x6b33('0x31')](respondWithFilteredResult(_0x460742,_0x2e2eb7))[_0x6b33('0x57')](handleError(_0x460742,null));};exports[_0x6b33('0x66')]=function(_0xd3ed5d,_0x48967d,_0x1d315a){return db[_0x6b33('0x3a')][_0x6b33('0x56')]({'where':{'id':_0xd3ed5d[_0x6b33('0x50')]['id']}})[_0x6b33('0x31')](handleEntityNotFound(_0x48967d,null))[_0x6b33('0x31')](function(_0x289ed6){if(_0x289ed6){return _0x289ed6[_0x6b33('0x66')](_0xd3ed5d['query'][_0x6b33('0x67')]);}})['then'](respondWithStatusCode(_0x48967d,null))[_0x6b33('0x57')](handleError(_0x48967d,null));};exports[_0x6b33('0x68')]=function(_0x2a86c5,_0x228e74,_0x30c0ae){if(_0x2a86c5[_0x6b33('0x59')]['id']){delete _0x2a86c5[_0x6b33('0x59')]['id'];}return db[_0x6b33('0x3a')][_0x6b33('0x56')]({'where':{'id':_0x2a86c5[_0x6b33('0x50')]['id']}})['then'](handleEntityNotFound(_0x228e74,null))[_0x6b33('0x31')](function(_0x4d6993){if(_0x4d6993){_0x2a86c5[_0x6b33('0x59')][_0x6b33('0x62')]=_0x4d6993['id'];return db['CannedAnswer'][_0x6b33('0x58')](_0x2a86c5[_0x6b33('0x59')]);}})[_0x6b33('0x31')](respondWithResult(_0x228e74,null))[_0x6b33('0x57')](handleError(_0x228e74,null));};exports[_0x6b33('0x69')]=function(_0x143ae8,_0x5ac75d,_0x415498){var _0x3ba231={'raw':![],'where':{}};var _0x52d3d5={};var _0x3ad278={'count':0x0,'rows':[]};return db[_0x6b33('0x3a')][_0x6b33('0x65')]({'where':{'id':_0x143ae8[_0x6b33('0x50')]['id']}})[_0x6b33('0x31')](handleEntityNotFound(_0x5ac75d,null))[_0x6b33('0x31')](function(_0x2ffde9){if(_0x2ffde9){_0x52d3d5['model']=_[_0x6b33('0x3f')](db[_0x6b33('0x6a')]['rawAttributes']);_0x52d3d5[_0x6b33('0x3e')]=_[_0x6b33('0x3f')](_0x143ae8['query']);_0x52d3d5[_0x6b33('0x40')]=_['intersection'](_0x52d3d5[_0x6b33('0x3d')],_0x52d3d5[_0x6b33('0x3e')]);_0x3ba231[_0x6b33('0x42')]=_[_0x6b33('0x41')](_0x52d3d5[_0x6b33('0x3d')],qs[_0x6b33('0x54')](_0x143ae8['query'][_0x6b33('0x54')]));_0x3ba231[_0x6b33('0x42')]=_0x3ba231[_0x6b33('0x42')][_0x6b33('0x43')]?_0x3ba231[_0x6b33('0x42')]:_0x52d3d5[_0x6b33('0x3d')];if(!_0x143ae8[_0x6b33('0x3e')][_0x6b33('0x44')](_0x6b33('0x45'))){_0x3ba231[_0x6b33('0x2a')]=qs[_0x6b33('0x2a')](_0x143ae8['query'][_0x6b33('0x2a')]);_0x3ba231[_0x6b33('0x2b')]=qs[_0x6b33('0x2b')](_0x143ae8['query'][_0x6b33('0x2b')]);}_0x3ba231[_0x6b33('0x6b')]=qs[_0x6b33('0x46')](_0x143ae8[_0x6b33('0x3e')][_0x6b33('0x46')]);_0x3ba231['where']=qs[_0x6b33('0x40')](_[_0x6b33('0x48')](_0x143ae8[_0x6b33('0x3e')],_0x52d3d5[_0x6b33('0x40')]));_0x3ba231[_0x6b33('0x47')][_0x6b33('0x62')]=_0x2ffde9['id'];if(_0x143ae8[_0x6b33('0x3e')]['filter']){_0x3ba231['where']=_[_0x6b33('0x4a')](_0x3ba231[_0x6b33('0x47')],{'$or':_['map'](_0x3ba231[_0x6b33('0x42')],function(_0x75c99c){var _0x1d6bfd={};_0x1d6bfd[_0x75c99c]={'$like':'%'+_0x143ae8[_0x6b33('0x3e')]['filter']+'%'};return _0x1d6bfd;})});}_0x3ba231=_[_0x6b33('0x4a')]({},_0x3ba231,_0x143ae8[_0x6b33('0x4b')]);return db[_0x6b33('0x6a')][_0x6b33('0x2c')]({'where':_0x3ba231[_0x6b33('0x47')]})[_0x6b33('0x31')](function(_0x4f625a){_0x3ad278['count']=_0x4f625a;if(_0x143ae8[_0x6b33('0x3e')]['includeAll']){_0x3ba231[_0x6b33('0x4c')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x3ba231);})[_0x6b33('0x31')](function(_0x16fc92){_0x3ad278[_0x6b33('0x4e')]=_0x16fc92;return _0x3ad278;});}})[_0x6b33('0x31')](respondWithFilteredResult(_0x5ac75d,_0x3ba231))[_0x6b33('0x57')](handleError(_0x5ac75d,null));};exports[_0x6b33('0x6c')]=function(_0xd70186,_0x40aebe,_0x1b4851){return db[_0x6b33('0x3a')]['find']({'where':{'id':_0xd70186[_0x6b33('0x50')]['id']}})[_0x6b33('0x31')](handleEntityNotFound(_0x40aebe,null))[_0x6b33('0x31')](function(_0x72146b){if(_0x72146b){return _0x72146b['removeAnswers'](_0xd70186[_0x6b33('0x3e')]['ids']);}})[_0x6b33('0x31')](respondWithStatusCode(_0x40aebe,null))[_0x6b33('0x57')](handleError(_0x40aebe,null));};exports[_0x6b33('0x6d')]=function(_0x61d6dc,_0x3c1f71,_0x46369c){var _0x36d09a={'body':_0x61d6dc[_0x6b33('0x59')],'channel':_0x6b33('0x6e')};var _0x1234e4=[];var _0x5af386=[];var _0x4034b7={};var _0x53604f=![];return db[_0x6b33('0x6f')][_0x6b33('0x60')]()[_0x6b33('0x31')](function(_0x20cefe){if(!_0x20cefe){throw new db['Sequelize'][(_0x6b33('0x70'))]('no\x20available\x20attributes');}_0x1234e4=_[_0x6b33('0x71')](_[_0x6b33('0x3f')](_0x20cefe),[_0x6b33('0x72'),_0x6b33('0x73')]);_0x5af386=_[_0x6b33('0x71')](_[_0x6b33('0x3f')](_0x20cefe),[_0x6b33('0x72'),_0x6b33('0x73'),_0x6b33('0x74'),_0x6b33('0x75')]);if(_0x61d6dc[_0x6b33('0x59')]['id']){delete _0x61d6dc[_0x6b33('0x59')]['id'];}if(_[_0x6b33('0x76')](_0x61d6dc[_0x6b33('0x59')][_0x6b33('0x77')])){throw new db[(_0x6b33('0x78'))][(_0x6b33('0x70'))](_0x6b33('0x79'));}if(_[_0x6b33('0x76')](_0x61d6dc[_0x6b33('0x59')][_0x6b33('0x59')])||_0x61d6dc[_0x6b33('0x59')][_0x6b33('0x59')]===''){throw new db[(_0x6b33('0x78'))][(_0x6b33('0x70'))](_0x6b33('0x7a'));}if(_[_0x6b33('0x76')](_0x61d6dc[_0x6b33('0x59')][_0x6b33('0x7b')])){throw new db['Sequelize']['ValidationError'](_0x6b33('0x7c')+_0x5af386);}if(!_['includes'](_0x5af386,_0x61d6dc[_0x6b33('0x59')][_0x6b33('0x7b')])){throw new db[(_0x6b33('0x78'))][(_0x6b33('0x70'))](_0x6b33('0x7d')+_0x5af386);}_0x4034b7[_0x61d6dc[_0x6b33('0x59')][_0x6b33('0x7b')]]=_0x61d6dc[_0x6b33('0x59')][_0x6b33('0x77')];})[_0x6b33('0x31')](function(){return db[_0x6b33('0x3a')][_0x6b33('0x56')]({'where':{'id':_0x61d6dc[_0x6b33('0x50')]['id']},'include':[{'model':db[_0x6b33('0x7e')],'as':_0x6b33('0x7f'),'include':[{'model':db[_0x6b33('0x6f')],'as':'Contacts','where':_0x4034b7,'limit':0x1,'order':[[_0x6b33('0x73'),_0x6b33('0x80')]]}]},{'model':db['OpenchannelApplication'],'as':_0x6b33('0x81')}]});})[_0x6b33('0x31')](handleEntityNotFound(_0x3c1f71,null))['then'](function(_0x136f33){if(_0x136f33&&_0x136f33[_0x6b33('0x7f')]){_0x36d09a[_0x6b33('0x82')]=_0x136f33;_0x36d09a['applications']=_0x136f33[_0x6b33('0x81')];_0x36d09a[_0x6b33('0x83')]=_0x136f33[_0x6b33('0x7f')];_0x36d09a[_0x6b33('0x84')]=_[_0x6b33('0x85')](_0x36d09a[_0x6b33('0x84')],['priority'],[_0x6b33('0x86')]);if(_0x36d09a['account']['Applications']){delete _0x36d09a['account'][_0x6b33('0x81')];}if(_0x36d09a[_0x6b33('0x82')]['List']&&_0x36d09a['account'][_0x6b33('0x7f')]['Contacts'][_0x6b33('0x43')]){return _0x36d09a[_0x6b33('0x82')]['List'][_0x6b33('0x87')][0x0];}var _0x183a6e=_[_0x6b33('0x16')](_0x61d6dc[_0x6b33('0x59')],{'firstName':_0x61d6dc['body']['from'],'ListId':_0x136f33[_0x6b33('0x75')]});_0x183a6e[_0x61d6dc[_0x6b33('0x59')]['mapKey']]=_0x61d6dc['body'][_0x6b33('0x77')];return db[_0x6b33('0x6f')][_0x6b33('0x58')](_0x183a6e,{'fields':_0x1234e4,'raw':!![]});}})[_0x6b33('0x31')](handleEntityNotFound(_0x3c1f71,null))['then'](function(_0x43e61a){_0x36d09a[_0x6b33('0x88')]=_0x43e61a;if(_0x43e61a){var _0x21ad1b={'ContactId':_0x43e61a['id'],'OpenchannelAccountId':_0x61d6dc[_0x6b33('0x50')]['id'],'from':(_0x43e61a[_0x6b33('0x89')]||'')+'\x20'+(_0x43e61a[_0x6b33('0x8a')]||'')};var _0x56160c={'OpenchannelAccountId':_0x61d6dc[_0x6b33('0x50')]['id'],'closed':![]};if(_0x61d6dc[_0x6b33('0x59')]['threadId']){_0x56160c[_0x6b33('0x8b')]=_0x61d6dc['body']['threadId'];return db[_0x6b33('0x8c')][_0x6b33('0x56')]({'where':_0x56160c})[_0x6b33('0x31')](function(_0x11d580){if(_0x11d580){return[_0x11d580,![]];}_0x21ad1b[_0x6b33('0x8b')]=_0x61d6dc['body']['threadId'];_0x21ad1b[_0x6b33('0x8d')]=_0x61d6dc['body'][_0x6b33('0x8d')];return db[_0x6b33('0x8c')][_0x6b33('0x58')](_0x21ad1b)[_0x6b33('0x31')](function(_0x11b76f){return[_0x11b76f,!![]];});});}else{_0x56160c[_0x6b33('0x8b')]=null;}_0x56160c[_0x6b33('0x8e')]=_0x43e61a['id'];return db[_0x6b33('0x8c')][_0x6b33('0x56')]({'where':_0x56160c})[_0x6b33('0x31')](function(_0x591e36){if(_0x591e36){return[_0x591e36,![]];}return db['OpenchannelInteraction']['create'](_0x21ad1b)['then'](function(_0x490db5){return[_0x490db5,!![]];});});}})[_0x6b33('0x8f')](function(_0x631558,_0x2b9a13){if(_0x631558){_0x53604f=_0x2b9a13;if(!_0x2b9a13){var _0x28a27f={'from':(_0x36d09a[_0x6b33('0x88')]['firstName']||'')+'\x20'+(_0x36d09a[_0x6b33('0x88')]['lastName']||'')};if(_0x61d6dc[_0x6b33('0x59')][_0x6b33('0x8b')]&&_0x61d6dc['body'][_0x6b33('0x90')]&&_0x61d6dc['body']['threadId']!=_0x61d6dc[_0x6b33('0x59')][_0x6b33('0x90')]){_0x28a27f['threadId']=_0x61d6dc['body'][_0x6b33('0x90')];}return _0x631558[_0x6b33('0x2f')](_0x28a27f);}else{return _0x631558;}}})[_0x6b33('0x31')](function(_0x540c81){_0x36d09a[_0x6b33('0x91')]=_0x540c81[_0x6b33('0x32')]({'plain':!![]});_0x36d09a[_0x6b33('0x91')][_0x6b33('0x92')]=_0x53604f;if(_0x36d09a['interaction']['created']){if(_0x36d09a[_0x6b33('0x82')]['autoclose']){_0x36d09a['applications'][_0x6b33('0x93')]({'id':0x0,'priority':_0x36d09a[_0x6b33('0x84')][_0x6b33('0x43')]+0x1,'app':_0x6b33('0x94'),'appdata':'unmanaged','interval':'*,*,*,*'});}}return db[_0x6b33('0x95')][_0x6b33('0x58')]({'body':_0x61d6dc[_0x6b33('0x59')][_0x6b33('0x59')],'OpenchannelAccountId':_0x61d6dc[_0x6b33('0x50')]['id'],'OpenchannelInteractionId':_0x540c81['id'],'direction':'in','ContactId':_0x36d09a['contact']['id'],'AttachmentId':_0x61d6dc[_0x6b33('0x59')][_0x6b33('0x96')]});})[_0x6b33('0x31')](function(_0x2ae6d3){_0x36d09a[_0x6b33('0x24')]=_0x2ae6d3;if(_0x36d09a['interaction']['UserId']){return db[_0x6b33('0x97')]['find']({'attributes':['id',_0x6b33('0x36')],'where':{'id':_0x36d09a[_0x6b33('0x91')]['UserId']}})[_0x6b33('0x31')](function(_0xe9e156){if(_0xe9e156){_0x36d09a[_0x6b33('0x84')][_0x6b33('0x98')]({'id':0x0,'priority':0x0,'app':_0x6b33('0x99'),'appdata':_0xe9e156[_0x6b33('0x36')]+','+(_0x36d09a[_0x6b33('0x82')][_0x6b33('0x9a')]||0xa),'interval':_0x6b33('0x9b')});_0x36d09a['forcedOwnership']=![];}return respondWithRpcPromise('Start',_0x6b33('0x9c'),_0x36d09a);});}return respondWithRpcPromise(_0x6b33('0x9d'),_0x6b33('0x9c'),_0x36d09a);})[_0x6b33('0x31')](function(_0x226775){respondWithRpcPromise(_0x6b33('0x9e'),_0x6b33('0x9e'),{'event':_0x6b33('0x6d'),'message':_0x226775},client9002);return _0x226775;})[_0x6b33('0x31')](respondWithResult(_0x3c1f71,null))[_0x6b33('0x57')](handleError(_0x3c1f71,null));};exports[_0x6b33('0x9f')]=function(_0x3bf8be,_0x5d784b,_0x1685ea){return db[_0x6b33('0x3a')][_0x6b33('0x65')]({'where':{'id':_0x3bf8be[_0x6b33('0x50')]['id']}})[_0x6b33('0x31')](handleEntityNotFound(_0x5d784b,null))[_0x6b33('0x31')](function(_0x450a58){if(_0x450a58){return db['sequelize'][_0x6b33('0xa0')](function(_0x1313f5){return db['OpenchannelApplication'][_0x6b33('0x30')]({'where':{'OpenchannelAccountId':_0x3bf8be['params']['id']},'transaction':_0x1313f5})['then'](function(_0x150427){var _0x456ba4=_[_0x6b33('0x39')](_0x3bf8be[_0x6b33('0x59')],function(_0xac38f1){_0xac38f1[_0x6b33('0x62')]=_0x3bf8be[_0x6b33('0x50')]['id'];return _0xac38f1;});return db[_0x6b33('0xa1')][_0x6b33('0xa2')](_0x456ba4,{'transaction':_0x1313f5});});})[_0x6b33('0x31')](function(){return db['OpenchannelApplication'][_0x6b33('0xa3')]({'where':{'OpenchannelAccountId':_0x3bf8be['params']['id']},'order':_0x6b33('0xa4')});});}})[_0x6b33('0x31')](respondWithResult(_0x5d784b,null))[_0x6b33('0x57')](handleError(_0x5d784b,null));};exports['getApplications']=function(_0x855d66,_0x86f218,_0x4bc45b){var _0x13c2f8={};var _0x254311={};var _0x362f7c;var _0x16179b;return db[_0x6b33('0x3a')][_0x6b33('0x65')]({'where':{'id':_0x855d66[_0x6b33('0x50')]['id']}})['then'](handleEntityNotFound(_0x86f218,null))['then'](function(_0x7e2dae){if(_0x7e2dae){_0x362f7c=_0x7e2dae;_0x254311['model']=_[_0x6b33('0x3f')](db[_0x6b33('0xa1')][_0x6b33('0x53')]);_0x254311[_0x6b33('0x3e')]=_[_0x6b33('0x3f')](_0x855d66[_0x6b33('0x3e')]);_0x254311[_0x6b33('0x40')]=_[_0x6b33('0x41')](_0x254311[_0x6b33('0x3d')],_0x254311['query']);_0x13c2f8[_0x6b33('0x42')]=_[_0x6b33('0x41')](_0x254311['model'],qs[_0x6b33('0x54')](_0x855d66[_0x6b33('0x3e')][_0x6b33('0x54')]));_0x13c2f8[_0x6b33('0x42')]=_0x13c2f8[_0x6b33('0x42')][_0x6b33('0x43')]?_0x13c2f8[_0x6b33('0x42')]:_0x254311[_0x6b33('0x3d')];_0x13c2f8['order']=qs[_0x6b33('0x46')](_0x855d66[_0x6b33('0x3e')][_0x6b33('0x46')]);_0x13c2f8[_0x6b33('0x47')]=qs[_0x6b33('0x40')](_['pick'](_0x855d66[_0x6b33('0x3e')],_0x254311[_0x6b33('0x40')]));if(_0x855d66['query'][_0x6b33('0x49')]){_0x13c2f8[_0x6b33('0x47')]=_[_0x6b33('0x4a')](_0x13c2f8[_0x6b33('0x47')],{'$or':_[_0x6b33('0x39')](_0x13c2f8[_0x6b33('0x42')],function(_0x44555a){var _0x31fd46={};_0x31fd46[_0x44555a]={'$like':'%'+_0x855d66[_0x6b33('0x3e')][_0x6b33('0x49')]+'%'};return _0x31fd46;})});}_0x13c2f8=_[_0x6b33('0x4a')]({},_0x13c2f8,_0x855d66[_0x6b33('0x4b')]);return _0x362f7c[_0x6b33('0xa5')](_0x13c2f8);}})[_0x6b33('0x31')](function(_0x40bda2){if(_0x40bda2){_0x16179b=_0x40bda2['length'];if(!_0x855d66[_0x6b33('0x3e')][_0x6b33('0x44')](_0x6b33('0x45'))){_0x13c2f8[_0x6b33('0x2a')]=qs[_0x6b33('0x2a')](_0x855d66[_0x6b33('0x3e')][_0x6b33('0x2a')]);_0x13c2f8[_0x6b33('0x2b')]=qs[_0x6b33('0x2b')](_0x855d66[_0x6b33('0x3e')]['offset']);}return _0x362f7c[_0x6b33('0xa5')](_0x13c2f8);}})[_0x6b33('0x31')](function(_0x18a5bc){if(_0x18a5bc){return _0x18a5bc?{'count':_0x16179b,'rows':_0x18a5bc}:null;}})['then'](respondWithResult(_0x86f218,null))['catch'](handleError(_0x86f218,null));};exports[_0x6b33('0xa6')]=function(_0x117068,_0x1ca2c2,_0x395688){var _0x14ac9c={'raw':![],'where':{}};var _0x47b0ab={};var _0x37a538={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x6b33('0x65')]({'where':{'id':_0x117068[_0x6b33('0x50')]['id']}})['then'](handleEntityNotFound(_0x1ca2c2,null))[_0x6b33('0x31')](function(_0x3506a9){if(_0x3506a9){_0x47b0ab[_0x6b33('0x3d')]=_[_0x6b33('0x3f')](db[_0x6b33('0x8c')][_0x6b33('0x53')]);_0x47b0ab['query']=_[_0x6b33('0x3f')](_0x117068[_0x6b33('0x3e')]);_0x47b0ab[_0x6b33('0x40')]=_[_0x6b33('0x41')](_0x47b0ab[_0x6b33('0x3d')],_0x47b0ab[_0x6b33('0x3e')]);_0x14ac9c[_0x6b33('0x42')]=_['intersection'](_0x47b0ab['model'],qs[_0x6b33('0x54')](_0x117068[_0x6b33('0x3e')][_0x6b33('0x54')]));_0x14ac9c[_0x6b33('0x42')]=_0x14ac9c[_0x6b33('0x42')][_0x6b33('0x43')]?_0x14ac9c[_0x6b33('0x42')]:_0x47b0ab['model'];if(!_0x117068['query'][_0x6b33('0x44')]('nolimit')){_0x14ac9c[_0x6b33('0x2a')]=qs[_0x6b33('0x2a')](_0x117068['query'][_0x6b33('0x2a')]);_0x14ac9c[_0x6b33('0x2b')]=qs[_0x6b33('0x2b')](_0x117068['query']['offset']);}_0x14ac9c['order']=qs[_0x6b33('0x46')](_0x117068[_0x6b33('0x3e')][_0x6b33('0x46')]);_0x14ac9c[_0x6b33('0x47')]=qs[_0x6b33('0x40')](_[_0x6b33('0x48')](_0x117068[_0x6b33('0x3e')],_0x47b0ab['filters']));_0x14ac9c[_0x6b33('0x47')]['OpenchannelAccountId']=_0x3506a9['id'];if(_0x117068['query'][_0x6b33('0x49')]){_0x14ac9c[_0x6b33('0x47')]=_[_0x6b33('0x4a')](_0x14ac9c[_0x6b33('0x47')],{'$or':_[_0x6b33('0x39')](_0x14ac9c[_0x6b33('0x42')],function(_0x4c58bd){var _0x3d4949={};_0x3d4949[_0x4c58bd]={'$like':'%'+_0x117068['query'][_0x6b33('0x49')]+'%'};return _0x3d4949;})});}_0x14ac9c=_['merge']({},_0x14ac9c,_0x117068[_0x6b33('0x4b')]);return db[_0x6b33('0x8c')][_0x6b33('0x2c')]({'where':_0x14ac9c[_0x6b33('0x47')]})[_0x6b33('0x31')](function(_0x165494){_0x37a538[_0x6b33('0x2c')]=_0x165494;if(_0x117068['query']['includeAll']){_0x14ac9c['include']=[{'model':db[_0x6b33('0x6f')],'as':_0x6b33('0xa7'),'required':![]},{'model':db[_0x6b33('0x97')],'as':_0x6b33('0xa8'),'attributes':[_0x6b33('0x36'),_0x6b33('0xa9'),'internal'],'required':![]},{'model':db[_0x6b33('0xaa')],'as':_0x6b33('0xab'),'attributes':['id','name',_0x6b33('0xac')],'where':_0x117068['query'][_0x6b33('0xad')]?{'id':_0x117068[_0x6b33('0x3e')][_0x6b33('0xad')]}:undefined,'required':_0x117068[_0x6b33('0x3e')][_0x6b33('0xad')]?!![]:![]}];}return db[_0x6b33('0x8c')][_0x6b33('0x4d')](_0x14ac9c);})['then'](function(_0x53f3fe){_0x37a538[_0x6b33('0x4e')]=_0x53f3fe;return _0x37a538;});}})[_0x6b33('0x31')](respondWithFilteredResult(_0x1ca2c2,_0x14ac9c))[_0x6b33('0x57')](handleError(_0x1ca2c2,null));};exports['addAgents']=function(_0x53b4e9,_0x1694db,_0x594a2b){return db[_0x6b33('0x3a')][_0x6b33('0x56')]({'where':{'id':_0x53b4e9[_0x6b33('0x50')]['id']}})[_0x6b33('0x31')](handleEntityNotFound(_0x1694db,null))[_0x6b33('0x31')](function(_0x55de92){if(_0x55de92){return _0x55de92[_0x6b33('0xae')](_0x53b4e9['body'][_0x6b33('0x67')],_['omit'](_0x53b4e9[_0x6b33('0x59')],[_0x6b33('0x67'),'id'])||{})[_0x6b33('0x8f')](function(_0x1fd72f){for(var _0x44bd1f=0x0;_0x44bd1f<_0x53b4e9['body'][_0x6b33('0x67')][_0x6b33('0x43')];_0x44bd1f+=0x1){socket['emit'](_0x6b33('0xaf'),{'UserId':Number(_0x53b4e9[_0x6b33('0x59')]['ids'][_0x44bd1f]),'OpenchannelAccountId':Number(_0x53b4e9[_0x6b33('0x50')]['id'])});}return _0x1fd72f;});}})[_0x6b33('0x31')](respondWithResult(_0x1694db,null))[_0x6b33('0x57')](handleError(_0x1694db,null));};exports[_0x6b33('0xb0')]=function(_0x2bdad0,_0x348a13,_0x4e0ec1){return db[_0x6b33('0x3a')][_0x6b33('0x56')]({'where':{'id':_0x2bdad0[_0x6b33('0x50')]['id']}})[_0x6b33('0x31')](handleEntityNotFound(_0x348a13,null))[_0x6b33('0x31')](function(_0x4c22c4){if(_0x4c22c4){return _0x4c22c4[_0x6b33('0xb0')](_0x2bdad0[_0x6b33('0x3e')][_0x6b33('0x67')])[_0x6b33('0x31')](function(){if(_[_0x6b33('0xb1')](_0x2bdad0['query'][_0x6b33('0x67')])){for(var _0x4a6cd5=0x0;_0x4a6cd5<_0x2bdad0['query']['ids'][_0x6b33('0x43')];_0x4a6cd5+=0x1){socket[_0x6b33('0xb2')](_0x6b33('0xb3'),{'UserId':Number(_0x2bdad0[_0x6b33('0x3e')]['ids'][_0x4a6cd5]),'OpenchannelAccountId':Number(_0x2bdad0[_0x6b33('0x50')]['id'])});}}else{socket['emit'](_0x6b33('0xb3'),{'UserId':Number(_0x2bdad0['query'][_0x6b33('0x67')]),'OpenchannelAccountId':Number(_0x2bdad0['params']['id'])});}});}})[_0x6b33('0x31')](respondWithStatusCode(_0x348a13,null))[_0x6b33('0x57')](handleError(_0x348a13,null));};exports[_0x6b33('0xb4')]=function(_0x26f70d,_0x59d419,_0x58889a){var _0x22fdaf={};var _0x446452={};var _0x4a9ed7;var _0x5279e6;return db[_0x6b33('0x3a')][_0x6b33('0x65')]({'where':{'id':_0x26f70d['params']['id']}})[_0x6b33('0x31')](handleEntityNotFound(_0x59d419,null))[_0x6b33('0x31')](function(_0x2009a4){if(_0x2009a4){_0x4a9ed7=_0x2009a4;_0x446452[_0x6b33('0x3d')]=_[_0x6b33('0x3f')](db[_0x6b33('0x97')][_0x6b33('0x53')]);_0x446452[_0x6b33('0x3e')]=_[_0x6b33('0x3f')](_0x26f70d[_0x6b33('0x3e')]);_0x446452[_0x6b33('0x40')]=_[_0x6b33('0x41')](_0x446452[_0x6b33('0x3d')],_0x446452[_0x6b33('0x3e')]);_0x22fdaf[_0x6b33('0x42')]=_[_0x6b33('0x41')](_0x446452[_0x6b33('0x3d')],qs[_0x6b33('0x54')](_0x26f70d['query']['fields']));_0x22fdaf[_0x6b33('0x42')]=_0x22fdaf['attributes'][_0x6b33('0x43')]?_0x22fdaf[_0x6b33('0x42')]:_0x446452[_0x6b33('0x3d')];_0x22fdaf[_0x6b33('0x6b')]=qs['sort'](_0x26f70d[_0x6b33('0x3e')]['sort']);_0x22fdaf['where']=qs[_0x6b33('0x40')](_[_0x6b33('0x48')](_0x26f70d[_0x6b33('0x3e')],_0x446452[_0x6b33('0x40')]));if(_0x26f70d[_0x6b33('0x3e')][_0x6b33('0x49')]){_0x22fdaf[_0x6b33('0x47')]=_['merge'](_0x22fdaf['where'],{'$or':_[_0x6b33('0x39')](_0x22fdaf[_0x6b33('0x42')],function(_0x382841){var _0x46cb2b={};_0x46cb2b[_0x382841]={'$like':'%'+_0x26f70d['query'][_0x6b33('0x49')]+'%'};return _0x46cb2b;})});}_0x22fdaf=_[_0x6b33('0x4a')]({},_0x22fdaf,_0x26f70d[_0x6b33('0x4b')]);return _0x4a9ed7[_0x6b33('0xb4')](_0x22fdaf);}})[_0x6b33('0x31')](function(_0x43bae3){if(_0x43bae3){_0x5279e6=_0x43bae3[_0x6b33('0x43')];if(!_0x26f70d[_0x6b33('0x3e')][_0x6b33('0x44')](_0x6b33('0x45'))){_0x22fdaf[_0x6b33('0x2a')]=qs[_0x6b33('0x2a')](_0x26f70d[_0x6b33('0x3e')][_0x6b33('0x2a')]);_0x22fdaf['offset']=qs[_0x6b33('0x2b')](_0x26f70d[_0x6b33('0x3e')]['offset']);}return _0x4a9ed7[_0x6b33('0xb4')](_0x22fdaf);}})[_0x6b33('0x31')](function(_0x4be26b){if(_0x4be26b){return _0x4be26b?{'count':_0x5279e6,'rows':_0x4be26b}:null;}})['then'](respondWithResult(_0x59d419,null))[_0x6b33('0x57')](handleError(_0x59d419,null));};exports[_0x6b33('0x37')]=function(_0x5486c4,_0x46878e,_0x35e493){var _0xb6e8a2,_0x1b4b8d,_0x59573a;if(_[_0x6b33('0x76')](_0x5486c4['body']['body'])||_0x5486c4[_0x6b33('0x59')]['body']===''){throw new db['Sequelize'][(_0x6b33('0x70'))](_0x6b33('0x7a'));}if(_[_0x6b33('0x76')](_0x5486c4[_0x6b33('0x59')]['to'])){}_0xb6e8a2=_0x5486c4['body']['to'];return db['OpenchannelAccount']['findOne']({'where':{'id':_0x5486c4['params']['id']}})[_0x6b33('0x31')](handleEntityNotFound(_0x46878e,null))[_0x6b33('0x31')](function(_0x3881e6){if(_0x3881e6){return db[_0x6b33('0x3a')][_0x6b33('0x56')]({'where':{'id':_0x3881e6['id']},'include':[{'model':db['CmList'],'as':_0x6b33('0x7f'),'include':[{'model':db['CmContact'],'as':_0x6b33('0x87'),'where':{[_0x3881e6['mapKey']]:_0xb6e8a2},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0x6b33('0x31')](handleEntityNotFound(_0x46878e,null))['then'](function(_0x4d688b){if(_0x4d688b&&_0x4d688b[_0x6b33('0x7f')]){_0x1b4b8d=_0x4d688b[_0x6b33('0x32')]({'plain':!![]});if(_0x1b4b8d[_0x6b33('0x7f')]&&_0x1b4b8d[_0x6b33('0x7f')]['Contacts'][_0x6b33('0x43')]){return _0x1b4b8d[_0x6b33('0x7f')][_0x6b33('0x87')][0x0];}return db['CmContact'][_0x6b33('0x58')](_['defaults'](_0x5486c4['body'],{'firstName':_0xb6e8a2,[_0x4d688b[_0x6b33('0x7b')]]:_0xb6e8a2,'phone':_0xb6e8a2,'ListId':_0x1b4b8d[_0x6b33('0x75')]}));}})[_0x6b33('0x31')](handleEntityNotFound(_0x46878e,null))['then'](function(_0x1fed66){if(_0x1fed66){_0x59573a=_0x1fed66;return db[_0x6b33('0x8c')][_0x6b33('0x56')]({'where':{'ContactId':_0x59573a['id'],'closed':![],'OpenchannelAccountId':_0x1b4b8d['id']}})[_0x6b33('0x31')](function(_0x5c5fff){if(_0x5c5fff){return[_0x5c5fff,![]];}return db['OpenchannelInteraction'][_0x6b33('0x58')]({'UserId':_0x5486c4[_0x6b33('0x5b')]['id'],'ContactId':_0x59573a['id'],'OpenchannelAccountId':_0x1b4b8d['id'],'lastMsgDirection':_0x6b33('0xb5'),'Messages':[_[_0x6b33('0x4a')](_0x5486c4[_0x6b33('0x59')],{'read':![],'body':_0x5486c4[_0x6b33('0x59')][_0x6b33('0x59')],'OpenchannelAccountId':_0x1b4b8d['id'],'UserId':_0x5486c4['user']['id'],'ContactId':_0x59573a['id']})]},{'include':[{'model':db[_0x6b33('0x95')],'as':'Messages'}]})[_0x6b33('0x31')](function(_0x2dda69){return[_0x2dda69,!![]];});});}})[_0x6b33('0x8f')](function(_0x222e22,_0x1c872e){if(_0x1c872e){return _0x222e22;}return db[_0x6b33('0x95')][_0x6b33('0x58')](_[_0x6b33('0x4a')](_0x5486c4[_0x6b33('0x59')],{'read':![],'body':_0x5486c4['body'][_0x6b33('0x59')],'OpenchannelAccountId':_0x1b4b8d['id'],'OpenchannelInteractionId':_0x222e22['id'],'UserId':_0x5486c4['user']['id'],'ContactId':_0x59573a['id']}))[_0x6b33('0x31')](function(_0x4f4c33){_0x222e22[_0x6b33('0xb6')][_0x6b33('0xb7')]=[];_0x222e22[_0x6b33('0xb6')][_0x6b33('0xb7')]['push'](_0x4f4c33[_0x6b33('0xb6')]);return _0x222e22;});});}})['then'](respondWithResult(_0x46878e,null))[_0x6b33('0x57')](handleError(_0x46878e,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 185e93b..6d81f24 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 _0x750a=['../../mysqldb','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x77fbf8,_0x31cf3f){var _0x2df250=function(_0x24b65f){while(--_0x24b65f){_0x77fbf8['push'](_0x77fbf8['shift']());}};_0x2df250(++_0x31cf3f);}(_0x750a,0x140));var _0xa750=function(_0x8cf7f3,_0x512510){_0x8cf7f3=_0x8cf7f3-0x0;var _0x2a9c72=_0x750a[_0x8cf7f3];return _0x2a9c72;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0xa750('0x0'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa750('0x1'),'afterUpdate':_0xa750('0x2'),'afterDestroy':_0xa750('0x3')};function emitEvent(_0x19bd5f){return function(_0x457cae,_0x43d704,_0x562911){OpenchannelAccountEvents[_0xa750('0x4')](_0x19bd5f+':'+_0x457cae['id'],_0x457cae);OpenchannelAccountEvents[_0xa750('0x4')](_0x19bd5f,_0x457cae);_0x562911(null);};}for(var e in events){if(events[_0xa750('0x5')](e)){var event=events[e];OpenchannelAccount[_0xa750('0x6')](e,emitEvent(event));}}module[_0xa750('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x70e0=['emit','events','../../mysqldb','OpenchannelAccount','update','remove'];(function(_0x1d3047,_0x15466a){var _0x37b7a2=function(_0x183825){while(--_0x183825){_0x1d3047['push'](_0x1d3047['shift']());}};_0x37b7a2(++_0x15466a);}(_0x70e0,0x17b));var _0x070e=function(_0x539250,_0x49ca3e){_0x539250=_0x539250-0x0;var _0x34e1d0=_0x70e0[_0x539250];return _0x34e1d0;};'use strict';var EventEmitter=require(_0x070e('0x0'));var OpenchannelAccount=require(_0x070e('0x1'))['db'][_0x070e('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x070e('0x3'),'afterDestroy':_0x070e('0x4')};function emitEvent(_0x277d32){return function(_0x2593e5,_0x5c90fc,_0x7bce9b){OpenchannelAccountEvents['emit'](_0x277d32+':'+_0x2593e5['id'],_0x2593e5);OpenchannelAccountEvents[_0x070e('0x5')](_0x277d32,_0x2593e5);_0x7bce9b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 18a9f78..ab41144 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(_0x32227b,_0x4f7bba){var _0x466a58=function(_0x26d6eb){while(--_0x26d6eb){_0x32227b['push'](_0x32227b['shift']());}};_0x466a58(++_0x4f7bba);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0xbcbf80,_0x112fdc){var _0x591bed=function(_0x2dfc70){while(--_0x2dfc70){_0xbcbf80['push'](_0xbcbf80['shift']());}};_0x591bed(++_0x112fdc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.rpc.js b/server/api/openchannelAccount/openchannelAccount.rpc.js index d4e9a7b..84a5ac9 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 _0x6582=['code','message','info','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http','redis','defaults','localhost','./openchannelAccount.socket','register','request','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x27da14,_0x5d875a){var _0x588b64=function(_0x266170){while(--_0x266170){_0x27da14['push'](_0x27da14['shift']());}};_0x588b64(++_0x5d875a);}(_0x6582,0x108));var _0x2658=function(_0x593f03,_0x4af84a){_0x593f03=_0x593f03-0x0;var _0x178299=_0x6582[_0x593f03];return _0x178299;};'use strict';var _=require(_0x2658('0x0'));var util=require(_0x2658('0x1'));var moment=require(_0x2658('0x2'));var BPromise=require(_0x2658('0x3'));var rs=require(_0x2658('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2658('0x5'))['db'];var utils=require(_0x2658('0x6'));var logger=require(_0x2658('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2658('0x8')][_0x2658('0x9')]({'port':0x232a});config[_0x2658('0xa')]=_[_0x2658('0xb')](config[_0x2658('0xa')],{'host':_0x2658('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2658('0xa')]));require(_0x2658('0xd'))[_0x2658('0xe')](socket);function respondWithRpcPromise(_0x99b9db,_0x455ff9,_0x2b2561){return new BPromise(function(_0x3f22a5,_0x1aaaac){return client[_0x2658('0xf')](_0x99b9db,_0x2b2561)['then'](function(_0x20fe6d){logger['info'](_0x2658('0x10'),_0x455ff9,_0x2658('0x11'));logger[_0x2658('0x12')](_0x2658('0x13'),_0x455ff9,_0x2658('0x11'),JSON[_0x2658('0x14')](_0x20fe6d));if(_0x20fe6d[_0x2658('0x15')]){if(_0x20fe6d['error'][_0x2658('0x16')]===0x1f4){logger[_0x2658('0x15')](_0x2658('0x10'),_0x455ff9,_0x20fe6d[_0x2658('0x15')][_0x2658('0x17')]);return _0x1aaaac(_0x20fe6d['error'][_0x2658('0x17')]);}logger[_0x2658('0x15')](_0x2658('0x10'),_0x455ff9,_0x20fe6d['error'][_0x2658('0x17')]);return _0x3f22a5(_0x20fe6d[_0x2658('0x15')][_0x2658('0x17')]);}else{logger[_0x2658('0x18')]('OpenchannelAccount,\x20%s,\x20%s',_0x455ff9,_0x2658('0x11'));_0x3f22a5(_0x20fe6d['result'][_0x2658('0x17')]);}})[_0x2658('0x19')](function(_0x307220){logger[_0x2658('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0x455ff9,_0x307220);_0x1aaaac(_0x307220);});});} \ No newline at end of file +var _0x6c76=['error','code','message','result','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','redis','localhost','socket.io-emitter','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0x6c76,0x184));var _0x66c7=function(_0x2a725d,_0x2466f5){_0x2a725d=_0x2a725d-0x0;var _0x1d7453=_0x6c76[_0x2a725d];return _0x1d7453;};'use strict';var _=require(_0x66c7('0x0'));var util=require(_0x66c7('0x1'));var moment=require(_0x66c7('0x2'));var BPromise=require('bluebird');var rs=require(_0x66c7('0x3'));var fs=require('fs');var Redis=require(_0x66c7('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x66c7('0x5'))(_0x66c7('0x6'));var config=require('../../config/environment');var jayson=require(_0x66c7('0x7'));var client=jayson[_0x66c7('0x8')]['http']({'port':0x232a});config[_0x66c7('0x9')]=_['defaults'](config['redis'],{'host':_0x66c7('0xa'),'port':0x18eb});var socket=require(_0x66c7('0xb'))(new Redis(config[_0x66c7('0x9')]));require('./openchannelAccount.socket')[_0x66c7('0xc')](socket);function respondWithRpcPromise(_0xbc35d9,_0xf44e2,_0x2fff5e){return new BPromise(function(_0x492634,_0x464085){return client[_0x66c7('0xd')](_0xbc35d9,_0x2fff5e)[_0x66c7('0xe')](function(_0x187e00){logger[_0x66c7('0xf')](_0x66c7('0x10'),_0xf44e2,_0x66c7('0x11'));logger['debug'](_0x66c7('0x12'),_0xf44e2,_0x66c7('0x11'),JSON[_0x66c7('0x13')](_0x187e00));if(_0x187e00[_0x66c7('0x14')]){if(_0x187e00[_0x66c7('0x14')][_0x66c7('0x15')]===0x1f4){logger[_0x66c7('0x14')](_0x66c7('0x10'),_0xf44e2,_0x187e00[_0x66c7('0x14')]['message']);return _0x464085(_0x187e00[_0x66c7('0x14')]['message']);}logger[_0x66c7('0x14')](_0x66c7('0x10'),_0xf44e2,_0x187e00[_0x66c7('0x14')][_0x66c7('0x16')]);return _0x492634(_0x187e00[_0x66c7('0x14')]['message']);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0xf44e2,'request\x20sent');_0x492634(_0x187e00[_0x66c7('0x17')][_0x66c7('0x16')]);}})['catch'](function(_0x524e87){logger[_0x66c7('0x14')](_0x66c7('0x10'),_0xf44e2,_0x524e87);_0x464085(_0x524e87);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index a52273b..d452021 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 _0x52b2=['remove','update','emit','removeListener','register','length','openchannelAccount:','./openchannelAccount.events','save'];(function(_0x47a7b8,_0x58c838){var _0x5eb161=function(_0x1c38ba){while(--_0x1c38ba){_0x47a7b8['push'](_0x47a7b8['shift']());}};_0x5eb161(++_0x58c838);}(_0x52b2,0x11e));var _0x252b=function(_0x2774ff,_0x137d8c){_0x2774ff=_0x2774ff-0x0;var _0x5a433d=_0x52b2[_0x2774ff];return _0x5a433d;};'use strict';var OpenchannelAccountEvents=require(_0x252b('0x0'));var events=[_0x252b('0x1'),_0x252b('0x2'),_0x252b('0x3')];function createListener(_0x3937b0,_0x15237d){return function(_0x5ed676){_0x15237d[_0x252b('0x4')](_0x3937b0,_0x5ed676);};}function removeListener(_0x35fe82,_0x3d1a7c){return function(){OpenchannelAccountEvents[_0x252b('0x5')](_0x35fe82,_0x3d1a7c);};}exports[_0x252b('0x6')]=function(_0x571511){for(var _0x1025af=0x0,_0x409365=events[_0x252b('0x7')];_0x1025af<_0x409365;_0x1025af++){var _0x81d77a=events[_0x1025af];var _0x147e21=createListener(_0x252b('0x8')+_0x81d77a,_0x571511);OpenchannelAccountEvents['on'](_0x81d77a,_0x147e21);}}; \ No newline at end of file +var _0xa854=['./openchannelAccount.events','save','remove','update','removeListener','register','openchannelAccount:'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0xa854,0x103));var _0x4a85=function(_0x2df0a,_0x5cbd2e){_0x2df0a=_0x2df0a-0x0;var _0x47c013=_0xa854[_0x2df0a];return _0x47c013;};'use strict';var OpenchannelAccountEvents=require(_0x4a85('0x0'));var events=[_0x4a85('0x1'),_0x4a85('0x2'),_0x4a85('0x3')];function createListener(_0x3f3ec2,_0x491f7c){return function(_0x135ea5){_0x491f7c['emit'](_0x3f3ec2,_0x135ea5);};}function removeListener(_0x388052,_0x5bd2dd){return function(){OpenchannelAccountEvents[_0x4a85('0x4')](_0x388052,_0x5bd2dd);};}exports[_0x4a85('0x5')]=function(_0x494d91){for(var _0x445a95=0x0,_0x142b27=events['length'];_0x445a95<_0x142b27;_0x445a95++){var _0xb1605c=events[_0x445a95];var _0x507c59=createListener(_0x4a85('0x6')+_0xb1605c,_0x494d91);OpenchannelAccountEvents['on'](_0xb1605c,_0x507c59);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 89c3a95..4f3a175 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 _0x970c=['isAuthenticated','index','show','post','create','put','/:id','delete','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get'];(function(_0x2ec96c,_0x3edd46){var _0x75710b=function(_0x4e75eb){while(--_0x4e75eb){_0x2ec96c['push'](_0x2ec96c['shift']());}};_0x75710b(++_0x3edd46);}(_0x970c,0xce));var _0xc970=function(_0x32fff9,_0x156e9f){_0x32fff9=_0x32fff9-0x0;var _0x52f5d3=_0x970c[_0x32fff9];return _0x52f5d3;};'use strict';var multer=require(_0xc970('0x0'));var util=require('util');var path=require(_0xc970('0x1'));var timeout=require(_0xc970('0x2'));var express=require(_0xc970('0x3'));var router=express[_0xc970('0x4')]();var fs_extra=require(_0xc970('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc970('0x6'));var config=require(_0xc970('0x7'));var controller=require(_0xc970('0x8'));router[_0xc970('0x9')]('/',auth[_0xc970('0xa')](),controller[_0xc970('0xb')]);router[_0xc970('0x9')]('/:id',auth[_0xc970('0xa')](),controller[_0xc970('0xc')]);router[_0xc970('0xd')]('/',auth[_0xc970('0xa')](),controller[_0xc970('0xe')]);router[_0xc970('0xf')](_0xc970('0x10'),auth['isAuthenticated'](),controller['update']);router[_0xc970('0x11')](_0xc970('0x10'),auth[_0xc970('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xbc11=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','put','delete','multer','path','Router','../../components/auth/service'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0xbc11,0x15b));var _0x1bc1=function(_0x51480e,_0x46794e){_0x51480e=_0x51480e-0x0;var _0x5596f0=_0xbc11[_0x51480e];return _0x5596f0;};'use strict';var multer=require(_0x1bc1('0x0'));var util=require('util');var path=require(_0x1bc1('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1bc1('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x1bc1('0x3'));var interaction=require(_0x1bc1('0x4'));var config=require(_0x1bc1('0x5'));var controller=require('./openchannelApplication.controller');router[_0x1bc1('0x6')]('/',auth[_0x1bc1('0x7')](),controller[_0x1bc1('0x8')]);router[_0x1bc1('0x6')](_0x1bc1('0x9'),auth[_0x1bc1('0x7')](),controller['show']);router[_0x1bc1('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1bc1('0xb')](_0x1bc1('0x9'),auth[_0x1bc1('0x7')](),controller['update']);router[_0x1bc1('0xc')]('/:id',auth[_0x1bc1('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 04d53c0..6b566c1 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 _0x2577=['STRING','*,*,*,*','exports','noop','TEXT'];(function(_0x570611,_0x362f93){var _0x347afc=function(_0x4621a8){while(--_0x4621a8){_0x570611['push'](_0x570611['shift']());}};_0x347afc(++_0x362f93);}(_0x2577,0x11f));var _0x7257=function(_0x3e29e5,_0x1cd087){_0x3e29e5=_0x3e29e5-0x0;var _0x37f88a=_0x2577[_0x3e29e5];return _0x37f88a;};'use strict';var Sequelize=require('sequelize');module[_0x7257('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7257('0x1')},'appdata':{'type':Sequelize[_0x7257('0x2')]()},'description':{'type':Sequelize[_0x7257('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x7257('0x4')}}; \ No newline at end of file +var _0x6d7f=['exports','INTEGER','STRING','noop','*,*,*,*','sequelize'];(function(_0x446b0b,_0xac072f){var _0x303277=function(_0x5218e2){while(--_0x5218e2){_0x446b0b['push'](_0x446b0b['shift']());}};_0x303277(++_0xac072f);}(_0x6d7f,0xb3));var _0xf6d7=function(_0x32cd19,_0x274085){_0x32cd19=_0x32cd19-0x0;var _0xd696d5=_0x6d7f[_0x32cd19];return _0xd696d5;};'use strict';var Sequelize=require(_0xf6d7('0x0'));module[_0xf6d7('0x1')]={'priority':{'type':Sequelize[_0xf6d7('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xf6d7('0x3')],'allowNull':![],'defaultValue':_0xf6d7('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xf6d7('0x3')],'defaultValue':_0xf6d7('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 0d470e7..8f7bc15 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 _0x004a=['rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','keys','catch','create','body','destroy','find','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','fs-extra','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','reject','save','update','then','stack','name','send','index','OpenchannelApplication'];(function(_0x552fab,_0x2d0c20){var _0x12cc9a=function(_0x34f5fc){while(--_0x34f5fc){_0x552fab['push'](_0x552fab['shift']());}};_0x12cc9a(++_0x2d0c20);}(_0x004a,0x145));var _0xa004=function(_0x2fc55f,_0x1b4a3e){_0x2fc55f=_0x2fc55f-0x0;var _0x19766e=_0x004a[_0x2fc55f];return _0x19766e;};'use strict';var emlformat=require(_0xa004('0x0'));var rimraf=require(_0xa004('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa004('0x2'));var rp=require(_0xa004('0x3'));var moment=require(_0xa004('0x4'));var BPromise=require(_0xa004('0x5'));var Mustache=require('mustache');var util=require(_0xa004('0x6'));var path=require('path');var sox=require(_0xa004('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa004('0x8'));var _=require('lodash');var squel=require(_0xa004('0x9'));var crypto=require(_0xa004('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xa004('0xb'));var toCsv=require(_0xa004('0xc'));var querystring=require('querystring');var Papa=require(_0xa004('0xd'));var Redis=require(_0xa004('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa004('0xf'));var logger=require(_0xa004('0x10'))(_0xa004('0x11'));var utils=require(_0xa004('0x12'));var config=require(_0xa004('0x13'));var licenseUtil=require(_0xa004('0x14'));var db=require(_0xa004('0x15'))['db'];function respondWithStatusCode(_0x5f72b9,_0x52b858){_0x52b858=_0x52b858||0xcc;return function(_0x2f2f3d){if(_0x2f2f3d){return _0x5f72b9[_0xa004('0x16')](_0x52b858);}return _0x5f72b9['status'](_0x52b858)[_0xa004('0x17')]();};}function respondWithResult(_0x5dcdaf,_0x5ad095){_0x5ad095=_0x5ad095||0xc8;return function(_0x3fc532){if(_0x3fc532){return _0x5dcdaf[_0xa004('0x18')](_0x5ad095)[_0xa004('0x19')](_0x3fc532);}};}function respondWithFilteredResult(_0x35ce00,_0x8f3576){return function(_0x319868){if(_0x319868){var _0xc8606e=typeof _0x8f3576[_0xa004('0x1a')]==='undefined'&&typeof _0x8f3576[_0xa004('0x1b')]===_0xa004('0x1c');var _0x46f62b=_0x319868[_0xa004('0x1d')];var _0x49b821=_0xc8606e?0x0:_0x8f3576[_0xa004('0x1a')];var _0x38e74e=_0xc8606e?_0x319868[_0xa004('0x1d')]:_0x8f3576[_0xa004('0x1a')]+_0x8f3576[_0xa004('0x1b')];var _0x9461d7;if(_0x38e74e>=_0x46f62b){_0x38e74e=_0x46f62b;_0x9461d7=0xc8;}else{_0x9461d7=0xce;}_0x35ce00[_0xa004('0x18')](_0x9461d7);return _0x35ce00['set'](_0xa004('0x1e'),_0x49b821+'-'+_0x38e74e+'/'+_0x46f62b)[_0xa004('0x19')](_0x319868);}return null;};}function patchUpdates(_0x1e38d1){return function(_0x2eec5d){try{jsonpatch['apply'](_0x2eec5d,_0x1e38d1,!![]);}catch(_0x5384fa){return BPromise[_0xa004('0x1f')](_0x5384fa);}return _0x2eec5d[_0xa004('0x20')]();};}function saveUpdates(_0x8395a0,_0x4c9623){return function(_0x2584a8){if(_0x2584a8){return _0x2584a8[_0xa004('0x21')](_0x8395a0)[_0xa004('0x22')](function(_0x330936){return _0x330936;});}return null;};}function removeEntity(_0x5d7ebf,_0x226de4){return function(_0x3fde74){if(_0x3fde74){return _0x3fde74['destroy']()['then'](function(){_0x5d7ebf[_0xa004('0x18')](0xcc)[_0xa004('0x17')]();});}};}function handleEntityNotFound(_0x35d78c,_0x46afcb){return function(_0x194a9d){if(!_0x194a9d){_0x35d78c['sendStatus'](0x194);}return _0x194a9d;};}function handleError(_0x4ad950,_0x659080){_0x659080=_0x659080||0x1f4;return function(_0xce5e3b){logger['error'](_0xce5e3b[_0xa004('0x23')]);if(_0xce5e3b[_0xa004('0x24')]){delete _0xce5e3b[_0xa004('0x24')];}_0x4ad950['status'](_0x659080)[_0xa004('0x25')](_0xce5e3b);};}exports[_0xa004('0x26')]=function(_0x22780b,_0x1ba169){var _0x36ac69={},_0x3184f5={},_0x45ba88={'count':0x0,'rows':[]};var _0x337c28=_['map'](db[_0xa004('0x27')][_0xa004('0x28')],function(_0x11b2c2){return{'name':_0x11b2c2[_0xa004('0x29')],'type':_0x11b2c2[_0xa004('0x2a')][_0xa004('0x2b')]};});_0x3184f5[_0xa004('0x2c')]=_[_0xa004('0x2d')](_0x337c28,_0xa004('0x24'));_0x3184f5[_0xa004('0x2e')]=_['keys'](_0x22780b[_0xa004('0x2e')]);_0x3184f5[_0xa004('0x2f')]=_[_0xa004('0x30')](_0x3184f5['model'],_0x3184f5[_0xa004('0x2e')]);_0x36ac69[_0xa004('0x31')]=_[_0xa004('0x30')](_0x3184f5['model'],qs[_0xa004('0x32')](_0x22780b[_0xa004('0x2e')]['fields']));_0x36ac69[_0xa004('0x31')]=_0x36ac69['attributes'][_0xa004('0x33')]?_0x36ac69['attributes']:_0x3184f5['model'];if(!_0x22780b[_0xa004('0x2e')][_0xa004('0x34')](_0xa004('0x35'))){_0x36ac69[_0xa004('0x1b')]=qs[_0xa004('0x1b')](_0x22780b[_0xa004('0x2e')][_0xa004('0x1b')]);_0x36ac69['offset']=qs['offset'](_0x22780b[_0xa004('0x2e')][_0xa004('0x1a')]);}_0x36ac69[_0xa004('0x36')]=qs['sort'](_0x22780b[_0xa004('0x2e')][_0xa004('0x37')]);_0x36ac69['where']=qs[_0xa004('0x2f')](_[_0xa004('0x38')](_0x22780b[_0xa004('0x2e')],_0x3184f5[_0xa004('0x2f')]),_0x337c28);if(_0x22780b[_0xa004('0x2e')]['filter']){_0x36ac69['where']=_['merge'](_0x36ac69[_0xa004('0x39')],{'$or':_[_0xa004('0x2d')](_0x337c28,function(_0x39a801){if(_0x39a801['type']!==_0xa004('0x3a')){var _0x42fc81={};_0x42fc81[_0x39a801['name']]={'$like':'%'+_0x22780b[_0xa004('0x2e')]['filter']+'%'};return _0x42fc81;}})});}_0x36ac69=_[_0xa004('0x3b')]({},_0x36ac69,_0x22780b[_0xa004('0x3c')]);var _0x2b9a47={'where':_0x36ac69[_0xa004('0x39')]};return db[_0xa004('0x27')]['count'](_0x2b9a47)['then'](function(_0x4e8d85){_0x45ba88[_0xa004('0x1d')]=_0x4e8d85;if(_0x22780b[_0xa004('0x2e')][_0xa004('0x3d')]){_0x36ac69[_0xa004('0x3e')]=[{'all':!![]}];}return db[_0xa004('0x27')][_0xa004('0x3f')](_0x36ac69);})[_0xa004('0x22')](function(_0x4741a3){_0x45ba88[_0xa004('0x40')]=_0x4741a3;return _0x45ba88;})[_0xa004('0x22')](respondWithFilteredResult(_0x1ba169,_0x36ac69))['catch'](handleError(_0x1ba169,null));};exports[_0xa004('0x41')]=function(_0x154707,_0x448ed1){var _0x231218={'raw':!![],'where':{'id':_0x154707[_0xa004('0x42')]['id']}},_0x395b5b={};_0x395b5b['model']=_['keys'](db[_0xa004('0x27')][_0xa004('0x28')]);_0x395b5b['query']=_[_0xa004('0x43')](_0x154707['query']);_0x395b5b['filters']=_['intersection'](_0x395b5b['model'],_0x395b5b[_0xa004('0x2e')]);_0x231218[_0xa004('0x31')]=_[_0xa004('0x30')](_0x395b5b[_0xa004('0x2c')],qs[_0xa004('0x32')](_0x154707[_0xa004('0x2e')]['fields']));_0x231218[_0xa004('0x31')]=_0x231218['attributes'][_0xa004('0x33')]?_0x231218['attributes']:_0x395b5b[_0xa004('0x2c')];if(_0x154707[_0xa004('0x2e')][_0xa004('0x3d')]){_0x231218['include']=[{'all':!![]}];}_0x231218=_[_0xa004('0x3b')]({},_0x231218,_0x154707[_0xa004('0x3c')]);return db[_0xa004('0x27')]['find'](_0x231218)[_0xa004('0x22')](handleEntityNotFound(_0x448ed1,null))[_0xa004('0x22')](respondWithResult(_0x448ed1,null))[_0xa004('0x44')](handleError(_0x448ed1,null));};exports[_0xa004('0x45')]=function(_0x5907d5,_0x162d29){return db[_0xa004('0x27')]['create'](_0x5907d5[_0xa004('0x46')],{})['then'](respondWithResult(_0x162d29,0xc9))['catch'](handleError(_0x162d29,null));};exports[_0xa004('0x21')]=function(_0x1be9d3,_0x18df1d){if(_0x1be9d3[_0xa004('0x46')]['id']){delete _0x1be9d3[_0xa004('0x46')]['id'];}return db['OpenchannelApplication']['find']({'where':{'id':_0x1be9d3[_0xa004('0x42')]['id']}})[_0xa004('0x22')](handleEntityNotFound(_0x18df1d,null))['then'](saveUpdates(_0x1be9d3[_0xa004('0x46')],null))[_0xa004('0x22')](respondWithResult(_0x18df1d,null))[_0xa004('0x44')](handleError(_0x18df1d,null));};exports[_0xa004('0x47')]=function(_0x2b3679,_0x90768a){return db[_0xa004('0x27')][_0xa004('0x48')]({'where':{'id':_0x2b3679['params']['id']}})['then'](handleEntityNotFound(_0x90768a,null))[_0xa004('0x22')](removeEntity(_0x90768a,null))[_0xa004('0x44')](handleError(_0x90768a,null));}; \ No newline at end of file +var _0x543f=['api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','catch','show','params','length','create','body','find','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch'];(function(_0x4186a5,_0x1e2024){var _0x5c93bd=function(_0x48b85f){while(--_0x48b85f){_0x4186a5['push'](_0x4186a5['shift']());}};_0x5c93bd(++_0x1e2024);}(_0x543f,0x1b5));var _0xf543=function(_0x5392fa,_0x5be966){_0x5392fa=_0x5392fa-0x0;var _0x1b38f6=_0x543f[_0x5392fa];return _0x1b38f6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf543('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf543('0x1'));var rp=require(_0xf543('0x2'));var moment=require(_0xf543('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf543('0x4'));var util=require(_0xf543('0x5'));var path=require('path');var sox=require(_0xf543('0x6'));var csv=require(_0xf543('0x7'));var ejs=require(_0xf543('0x8'));var fs=require('fs');var fs_extra=require(_0xf543('0x9'));var _=require(_0xf543('0xa'));var squel=require(_0xf543('0xb'));var crypto=require(_0xf543('0xc'));var jsforce=require(_0xf543('0xd'));var deskjs=require(_0xf543('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf543('0xf'));var Papa=require(_0xf543('0x10'));var Redis=require(_0xf543('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf543('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf543('0x13'));var utils=require(_0xf543('0x14'));var config=require(_0xf543('0x15'));var licenseUtil=require(_0xf543('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x403681,_0x4470b1){_0x4470b1=_0x4470b1||0xcc;return function(_0x45b3d4){if(_0x45b3d4){return _0x403681[_0xf543('0x17')](_0x4470b1);}return _0x403681[_0xf543('0x18')](_0x4470b1)[_0xf543('0x19')]();};}function respondWithResult(_0x5ba29a,_0x135124){_0x135124=_0x135124||0xc8;return function(_0x4e547c){if(_0x4e547c){return _0x5ba29a['status'](_0x135124)[_0xf543('0x1a')](_0x4e547c);}};}function respondWithFilteredResult(_0x2ff67e,_0x44cd79){return function(_0x58c89d){if(_0x58c89d){var _0xd7f89e=typeof _0x44cd79[_0xf543('0x1b')]==='undefined'&&typeof _0x44cd79[_0xf543('0x1c')]===_0xf543('0x1d');var _0x5ad118=_0x58c89d['count'];var _0x284aa8=_0xd7f89e?0x0:_0x44cd79[_0xf543('0x1b')];var _0x12b878=_0xd7f89e?_0x58c89d['count']:_0x44cd79[_0xf543('0x1b')]+_0x44cd79['limit'];var _0x4e6104;if(_0x12b878>=_0x5ad118){_0x12b878=_0x5ad118;_0x4e6104=0xc8;}else{_0x4e6104=0xce;}_0x2ff67e[_0xf543('0x18')](_0x4e6104);return _0x2ff67e[_0xf543('0x1e')](_0xf543('0x1f'),_0x284aa8+'-'+_0x12b878+'/'+_0x5ad118)[_0xf543('0x1a')](_0x58c89d);}return null;};}function patchUpdates(_0x247847){return function(_0x588f21){try{jsonpatch[_0xf543('0x20')](_0x588f21,_0x247847,!![]);}catch(_0x338e53){return BPromise[_0xf543('0x21')](_0x338e53);}return _0x588f21[_0xf543('0x22')]();};}function saveUpdates(_0x486637,_0x11e6bb){return function(_0x1586d4){if(_0x1586d4){return _0x1586d4[_0xf543('0x23')](_0x486637)[_0xf543('0x24')](function(_0x46fad9){return _0x46fad9;});}return null;};}function removeEntity(_0x25dfc9,_0x298806){return function(_0x1d72a9){if(_0x1d72a9){return _0x1d72a9[_0xf543('0x25')]()[_0xf543('0x24')](function(){_0x25dfc9[_0xf543('0x18')](0xcc)[_0xf543('0x19')]();});}};}function handleEntityNotFound(_0x1a5f12,_0x25efe3){return function(_0x40e4b0){if(!_0x40e4b0){_0x1a5f12[_0xf543('0x17')](0x194);}return _0x40e4b0;};}function handleError(_0x136250,_0x30949a){_0x30949a=_0x30949a||0x1f4;return function(_0x2f4024){logger[_0xf543('0x26')](_0x2f4024[_0xf543('0x27')]);if(_0x2f4024[_0xf543('0x28')]){delete _0x2f4024[_0xf543('0x28')];}_0x136250[_0xf543('0x18')](_0x30949a)[_0xf543('0x29')](_0x2f4024);};}exports[_0xf543('0x2a')]=function(_0x33af94,_0xcfa7ca){var _0x1ebde9={},_0x403f70={},_0x4efb60={'count':0x0,'rows':[]};var _0x1a01e1=_[_0xf543('0x2b')](db[_0xf543('0x2c')][_0xf543('0x2d')],function(_0x107d93){return{'name':_0x107d93[_0xf543('0x2e')],'type':_0x107d93[_0xf543('0x2f')][_0xf543('0x30')]};});_0x403f70[_0xf543('0x31')]=_[_0xf543('0x2b')](_0x1a01e1,_0xf543('0x28'));_0x403f70['query']=_[_0xf543('0x32')](_0x33af94[_0xf543('0x33')]);_0x403f70[_0xf543('0x34')]=_[_0xf543('0x35')](_0x403f70[_0xf543('0x31')],_0x403f70[_0xf543('0x33')]);_0x1ebde9['attributes']=_[_0xf543('0x35')](_0x403f70[_0xf543('0x31')],qs['fields'](_0x33af94[_0xf543('0x33')][_0xf543('0x36')]));_0x1ebde9[_0xf543('0x37')]=_0x1ebde9[_0xf543('0x37')]['length']?_0x1ebde9[_0xf543('0x37')]:_0x403f70[_0xf543('0x31')];if(!_0x33af94[_0xf543('0x33')][_0xf543('0x38')]('nolimit')){_0x1ebde9[_0xf543('0x1c')]=qs[_0xf543('0x1c')](_0x33af94['query'][_0xf543('0x1c')]);_0x1ebde9[_0xf543('0x1b')]=qs['offset'](_0x33af94[_0xf543('0x33')][_0xf543('0x1b')]);}_0x1ebde9[_0xf543('0x39')]=qs[_0xf543('0x3a')](_0x33af94['query']['sort']);_0x1ebde9[_0xf543('0x3b')]=qs[_0xf543('0x34')](_[_0xf543('0x3c')](_0x33af94[_0xf543('0x33')],_0x403f70[_0xf543('0x34')]),_0x1a01e1);if(_0x33af94[_0xf543('0x33')][_0xf543('0x3d')]){_0x1ebde9[_0xf543('0x3b')]=_['merge'](_0x1ebde9[_0xf543('0x3b')],{'$or':_[_0xf543('0x2b')](_0x1a01e1,function(_0x3807a1){if(_0x3807a1[_0xf543('0x2f')]!==_0xf543('0x3e')){var _0x421a10={};_0x421a10[_0x3807a1[_0xf543('0x28')]]={'$like':'%'+_0x33af94[_0xf543('0x33')][_0xf543('0x3d')]+'%'};return _0x421a10;}})});}_0x1ebde9=_[_0xf543('0x3f')]({},_0x1ebde9,_0x33af94[_0xf543('0x40')]);var _0x1cbc47={'where':_0x1ebde9[_0xf543('0x3b')]};return db['OpenchannelApplication'][_0xf543('0x41')](_0x1cbc47)['then'](function(_0x39ffe8){_0x4efb60['count']=_0x39ffe8;if(_0x33af94[_0xf543('0x33')][_0xf543('0x42')]){_0x1ebde9[_0xf543('0x43')]=[{'all':!![]}];}return db[_0xf543('0x2c')][_0xf543('0x44')](_0x1ebde9);})[_0xf543('0x24')](function(_0x56e7d2){_0x4efb60['rows']=_0x56e7d2;return _0x4efb60;})['then'](respondWithFilteredResult(_0xcfa7ca,_0x1ebde9))[_0xf543('0x45')](handleError(_0xcfa7ca,null));};exports[_0xf543('0x46')]=function(_0x1a0ca5,_0x26d910){var _0x5e440d={'raw':!![],'where':{'id':_0x1a0ca5[_0xf543('0x47')]['id']}},_0x368c9b={};_0x368c9b['model']=_['keys'](db['OpenchannelApplication']['rawAttributes']);_0x368c9b[_0xf543('0x33')]=_[_0xf543('0x32')](_0x1a0ca5[_0xf543('0x33')]);_0x368c9b[_0xf543('0x34')]=_['intersection'](_0x368c9b[_0xf543('0x31')],_0x368c9b['query']);_0x5e440d['attributes']=_['intersection'](_0x368c9b[_0xf543('0x31')],qs[_0xf543('0x36')](_0x1a0ca5[_0xf543('0x33')][_0xf543('0x36')]));_0x5e440d['attributes']=_0x5e440d[_0xf543('0x37')][_0xf543('0x48')]?_0x5e440d['attributes']:_0x368c9b[_0xf543('0x31')];if(_0x1a0ca5[_0xf543('0x33')][_0xf543('0x42')]){_0x5e440d[_0xf543('0x43')]=[{'all':!![]}];}_0x5e440d=_[_0xf543('0x3f')]({},_0x5e440d,_0x1a0ca5[_0xf543('0x40')]);return db[_0xf543('0x2c')]['find'](_0x5e440d)[_0xf543('0x24')](handleEntityNotFound(_0x26d910,null))['then'](respondWithResult(_0x26d910,null))[_0xf543('0x45')](handleError(_0x26d910,null));};exports[_0xf543('0x49')]=function(_0x93b423,_0x300a36){return db[_0xf543('0x2c')][_0xf543('0x49')](_0x93b423['body'],{})['then'](respondWithResult(_0x300a36,0xc9))[_0xf543('0x45')](handleError(_0x300a36,null));};exports[_0xf543('0x23')]=function(_0xb225fd,_0x27870a){if(_0xb225fd[_0xf543('0x4a')]['id']){delete _0xb225fd[_0xf543('0x4a')]['id'];}return db[_0xf543('0x2c')][_0xf543('0x4b')]({'where':{'id':_0xb225fd['params']['id']}})[_0xf543('0x24')](handleEntityNotFound(_0x27870a,null))['then'](saveUpdates(_0xb225fd[_0xf543('0x4a')],null))['then'](respondWithResult(_0x27870a,null))[_0xf543('0x45')](handleError(_0x27870a,null));};exports[_0xf543('0x25')]=function(_0x10fee7,_0x186277){return db[_0xf543('0x2c')][_0xf543('0x4b')]({'where':{'id':_0x10fee7[_0xf543('0x47')]['id']}})[_0xf543('0x24')](handleEntityNotFound(_0x186277,null))[_0xf543('0x24')](removeEntity(_0x186277,null))[_0xf543('0x45')](handleError(_0x186277,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 2630e4a..7e9b2a8 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 _0x3019=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','OpenchannelApplication','openchannel_applications','utf8mb4'];(function(_0x35b2ac,_0x1d9034){var _0x597769=function(_0x184834){while(--_0x184834){_0x35b2ac['push'](_0x35b2ac['shift']());}};_0x597769(++_0x1d9034);}(_0x3019,0x1bb));var _0x9301=function(_0x184768,_0x20060e){_0x184768=_0x184768-0x0;var _0x119623=_0x3019[_0x184768];return _0x119623;};'use strict';var _=require(_0x9301('0x0'));var util=require(_0x9301('0x1'));var logger=require(_0x9301('0x2'))(_0x9301('0x3'));var moment=require(_0x9301('0x4'));var BPromise=require('bluebird');var rp=require(_0x9301('0x5'));var fs=require('fs');var path=require(_0x9301('0x6'));var rimraf=require(_0x9301('0x7'));var config=require(_0x9301('0x8'));var attributes=require('./openchannelApplication.attributes');module['exports']=function(_0x195b59,_0x277256){return _0x195b59['define'](_0x9301('0x9'),attributes,{'tableName':_0x9301('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9301('0xb'),'collate':_0x9301('0xc')});}; \ No newline at end of file +var _0x6158=['rimraf','../../config/environment','./openchannelApplication.attributes','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','path'];(function(_0x5de423,_0x36057e){var _0x418fdb=function(_0x1bfd73){while(--_0x1bfd73){_0x5de423['push'](_0x5de423['shift']());}};_0x418fdb(++_0x36057e);}(_0x6158,0x118));var _0x8615=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6158[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8615('0x0'));var util=require(_0x8615('0x1'));var logger=require(_0x8615('0x2'))(_0x8615('0x3'));var moment=require(_0x8615('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8615('0x5'));var rimraf=require(_0x8615('0x6'));var config=require(_0x8615('0x7'));var attributes=require(_0x8615('0x8'));module['exports']=function(_0x1d4241,_0x579990){return _0x1d4241['define'](_0x8615('0x9'),attributes,{'tableName':_0x8615('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8615('0xb'),'collate':_0x8615('0xc')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index ce96506..cda2ad9 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 _0x1eeb=['options','raw','where','attributes','limit','UpdateOpenchannelApplication','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelApplication,\x20%s,\x20%s','message','info','result','catch','OpenchannelApplication','update','body'];(function(_0x172130,_0x53a5d9){var _0x30a068=function(_0x353bc7){while(--_0x353bc7){_0x172130['push'](_0x172130['shift']());}};_0x30a068(++_0x53a5d9);}(_0x1eeb,0x10e));var _0xb1ee=function(_0x497642,_0x55c481){_0x497642=_0x497642-0x0;var _0x351a14=_0x1eeb[_0x497642];return _0x351a14;};'use strict';var _=require(_0xb1ee('0x0'));var util=require(_0xb1ee('0x1'));var moment=require(_0xb1ee('0x2'));var BPromise=require(_0xb1ee('0x3'));var rs=require(_0xb1ee('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb1ee('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb1ee('0x6'))(_0xb1ee('0x7'));var config=require(_0xb1ee('0x8'));var jayson=require(_0xb1ee('0x9'));var client=jayson[_0xb1ee('0xa')][_0xb1ee('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3a75da,_0x1e710d,_0x4b836d){return new BPromise(function(_0x38fc43,_0x245a14){return client[_0xb1ee('0xc')](_0x3a75da,_0x4b836d)[_0xb1ee('0xd')](function(_0x408d60){logger['info']('OpenchannelApplication,\x20%s,\x20%s',_0x1e710d,_0xb1ee('0xe'));logger[_0xb1ee('0xf')](_0xb1ee('0x10'),_0x1e710d,_0xb1ee('0xe'),JSON[_0xb1ee('0x11')](_0x408d60));if(_0x408d60['error']){if(_0x408d60[_0xb1ee('0x12')]['code']===0x1f4){logger[_0xb1ee('0x12')](_0xb1ee('0x13'),_0x1e710d,_0x408d60['error']['message']);return _0x245a14(_0x408d60[_0xb1ee('0x12')][_0xb1ee('0x14')]);}logger[_0xb1ee('0x12')]('OpenchannelApplication,\x20%s,\x20%s',_0x1e710d,_0x408d60[_0xb1ee('0x12')]['message']);return _0x38fc43(_0x408d60[_0xb1ee('0x12')][_0xb1ee('0x14')]);}else{logger[_0xb1ee('0x15')](_0xb1ee('0x13'),_0x1e710d,_0xb1ee('0xe'));_0x38fc43(_0x408d60[_0xb1ee('0x16')][_0xb1ee('0x14')]);}})[_0xb1ee('0x17')](function(_0x482896){logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x1e710d,_0x482896);_0x245a14(_0x482896);});});}exports['UpdateOpenchannelApplication']=function(_0x4248d9){var _0x2529e1=this;return new Promise(function(_0x309f16,_0x192d4d){return db[_0xb1ee('0x18')][_0xb1ee('0x19')](_0x4248d9[_0xb1ee('0x1a')],{'raw':_0x4248d9[_0xb1ee('0x1b')]?_0x4248d9[_0xb1ee('0x1b')][_0xb1ee('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4248d9[_0xb1ee('0x1b')]?_0x4248d9[_0xb1ee('0x1b')][_0xb1ee('0x1d')]||null:null,'attributes':_0x4248d9[_0xb1ee('0x1b')]?_0x4248d9[_0xb1ee('0x1b')][_0xb1ee('0x1e')]||null:null,'limit':_0x4248d9[_0xb1ee('0x1b')]?_0x4248d9[_0xb1ee('0x1b')][_0xb1ee('0x1f')]||null:null})[_0xb1ee('0xd')](function(_0x2fafab){logger[_0xb1ee('0x15')](_0xb1ee('0x20'),_0x4248d9);logger[_0xb1ee('0xf')](_0xb1ee('0x20'),_0x4248d9,JSON['stringify'](_0x2fafab));_0x309f16(_0x2fafab);})[_0xb1ee('0x17')](function(_0x21cc7e){logger['error'](_0xb1ee('0x20'),_0x21cc7e[_0xb1ee('0x14')],_0x4248d9);_0x192d4d(_0x2529e1['error'](0x1f4,_0x21cc7e[_0xb1ee('0x14')]));});});}; \ No newline at end of file +var _0x2de0=['update','body','options','raw','where','attributes','limit','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateOpenchannelApplication','OpenchannelApplication'];(function(_0x4a9cfb,_0x229e89){var _0x4c00cf=function(_0x29eada){while(--_0x29eada){_0x4a9cfb['push'](_0x4a9cfb['shift']());}};_0x4c00cf(++_0x229e89);}(_0x2de0,0x87));var _0x02de=function(_0x2035ff,_0x4a27a2){_0x2035ff=_0x2035ff-0x0;var _0x21099b=_0x2de0[_0x2035ff];return _0x21099b;};'use strict';var _=require(_0x02de('0x0'));var util=require('util');var moment=require(_0x02de('0x1'));var BPromise=require(_0x02de('0x2'));var rs=require(_0x02de('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x02de('0x4'))['db'];var utils=require(_0x02de('0x5'));var logger=require(_0x02de('0x6'))(_0x02de('0x7'));var config=require(_0x02de('0x8'));var jayson=require(_0x02de('0x9'));var client=jayson[_0x02de('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25d99f,_0x44c947,_0x50082a){return new BPromise(function(_0x400461,_0x4df3af){return client[_0x02de('0xb')](_0x25d99f,_0x50082a)[_0x02de('0xc')](function(_0xc1689f){logger[_0x02de('0xd')](_0x02de('0xe'),_0x44c947,_0x02de('0xf'));logger[_0x02de('0x10')](_0x02de('0x11'),_0x44c947,'request\x20sent',JSON[_0x02de('0x12')](_0xc1689f));if(_0xc1689f[_0x02de('0x13')]){if(_0xc1689f[_0x02de('0x13')][_0x02de('0x14')]===0x1f4){logger['error'](_0x02de('0xe'),_0x44c947,_0xc1689f[_0x02de('0x13')][_0x02de('0x15')]);return _0x4df3af(_0xc1689f[_0x02de('0x13')][_0x02de('0x15')]);}logger[_0x02de('0x13')](_0x02de('0xe'),_0x44c947,_0xc1689f[_0x02de('0x13')][_0x02de('0x15')]);return _0x400461(_0xc1689f['error'][_0x02de('0x15')]);}else{logger[_0x02de('0xd')](_0x02de('0xe'),_0x44c947,_0x02de('0xf'));_0x400461(_0xc1689f[_0x02de('0x16')][_0x02de('0x15')]);}})['catch'](function(_0x314d96){logger[_0x02de('0x13')](_0x02de('0xe'),_0x44c947,_0x314d96);_0x4df3af(_0x314d96);});});}exports[_0x02de('0x17')]=function(_0x445f3){var _0x53e249=this;return new Promise(function(_0x26d168,_0x39e943){return db[_0x02de('0x18')][_0x02de('0x19')](_0x445f3[_0x02de('0x1a')],{'raw':_0x445f3[_0x02de('0x1b')]?_0x445f3[_0x02de('0x1b')][_0x02de('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x445f3['options']?_0x445f3['options'][_0x02de('0x1d')]||null:null,'attributes':_0x445f3[_0x02de('0x1b')]?_0x445f3['options'][_0x02de('0x1e')]||null:null,'limit':_0x445f3[_0x02de('0x1b')]?_0x445f3['options'][_0x02de('0x1f')]||null:null})['then'](function(_0x1e10d6){logger[_0x02de('0xd')](_0x02de('0x17'),_0x445f3);logger[_0x02de('0x10')](_0x02de('0x17'),_0x445f3,JSON[_0x02de('0x12')](_0x1e10d6));_0x26d168(_0x1e10d6);})['catch'](function(_0x4d37f7){logger[_0x02de('0x13')]('UpdateOpenchannelApplication',_0x4d37f7['message'],_0x445f3);_0x39e943(_0x53e249[_0x02de('0x13')](0x1f4,_0x4d37f7['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 19a5c6f..a82a727 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 _0x50d4=['addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','delete','removeTags','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','/:id','/:id/messages','getMessages','/:id/download','download','create','post'];(function(_0x4a96ca,_0x13754e){var _0x2aed48=function(_0x361330){while(--_0x361330){_0x4a96ca['push'](_0x4a96ca['shift']());}};_0x2aed48(++_0x13754e);}(_0x50d4,0x16b));var _0x450d=function(_0x14f5a3,_0x268d64){_0x14f5a3=_0x14f5a3-0x0;var _0xc84d0e=_0x50d4[_0x14f5a3];return _0xc84d0e;};'use strict';var multer=require(_0x450d('0x0'));var util=require('util');var path=require(_0x450d('0x1'));var timeout=require(_0x450d('0x2'));var express=require(_0x450d('0x3'));var router=express[_0x450d('0x4')]();var fs_extra=require(_0x450d('0x5'));var auth=require(_0x450d('0x6'));var interaction=require(_0x450d('0x7'));var config=require(_0x450d('0x8'));var controller=require(_0x450d('0x9'));router[_0x450d('0xa')]('/',auth[_0x450d('0xb')](),controller[_0x450d('0xc')]);router[_0x450d('0xa')](_0x450d('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0x450d('0xa')](_0x450d('0xe'),auth['isAuthenticated'](),controller['show']);router['get'](_0x450d('0xf'),auth[_0x450d('0xb')](),controller[_0x450d('0x10')]);router['get'](_0x450d('0x11'),auth[_0x450d('0xb')](),controller[_0x450d('0x12')]);router['post']('/',auth[_0x450d('0xb')](),controller[_0x450d('0x13')]);router[_0x450d('0x14')](_0x450d('0xf'),auth[_0x450d('0xb')](),controller[_0x450d('0x15')]);router[_0x450d('0x14')](_0x450d('0x16'),auth[_0x450d('0xb')](),interaction[_0x450d('0x17')](_0x450d('0x18'),_0x450d('0x19')),controller[_0x450d('0x1a')]);router[_0x450d('0x1b')](_0x450d('0xe'),auth[_0x450d('0xb')](),interaction['tracked'](_0x450d('0x18'),_0x450d('0x1c')),controller['update']);router[_0x450d('0x1d')]('/:id',auth[_0x450d('0xb')](),interaction[_0x450d('0x17')](_0x450d('0x18'),'openchannelinteraction:destroy'),controller['destroy']);router['delete'](_0x450d('0x16'),auth[_0x450d('0xb')](),controller[_0x450d('0x1e')]);module[_0x450d('0x1f')]=router; \ No newline at end of file +var _0xa64a=['download','post','/:id/messages','addMessage','/:id/tags','tracked','openchannelinteraction:addtags','addTags','put','openchannel','update','delete','openchannelinteraction:destroy','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','index','isAuthenticated','describe','/:id','show','getMessages'];(function(_0x279090,_0x5b05f9){var _0x48a69a=function(_0x55d920){while(--_0x55d920){_0x279090['push'](_0x279090['shift']());}};_0x48a69a(++_0x5b05f9);}(_0xa64a,0x117));var _0xaa64=function(_0x1adf5f,_0x5f5508){_0x1adf5f=_0x1adf5f-0x0;var _0x52aba7=_0xa64a[_0x1adf5f];return _0x52aba7;};'use strict';var multer=require(_0xaa64('0x0'));var util=require(_0xaa64('0x1'));var path=require(_0xaa64('0x2'));var timeout=require(_0xaa64('0x3'));var express=require(_0xaa64('0x4'));var router=express[_0xaa64('0x5')]();var fs_extra=require(_0xaa64('0x6'));var auth=require(_0xaa64('0x7'));var interaction=require(_0xaa64('0x8'));var config=require(_0xaa64('0x9'));var controller=require(_0xaa64('0xa'));router[_0xaa64('0xb')]('/',auth['isAuthenticated'](),controller[_0xaa64('0xc')]);router['get']('/describe',auth[_0xaa64('0xd')](),controller[_0xaa64('0xe')]);router[_0xaa64('0xb')](_0xaa64('0xf'),auth[_0xaa64('0xd')](),controller[_0xaa64('0x10')]);router['get']('/:id/messages',auth[_0xaa64('0xd')](),controller[_0xaa64('0x11')]);router['get']('/:id/download',auth[_0xaa64('0xd')](),controller[_0xaa64('0x12')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xaa64('0x13')](_0xaa64('0x14'),auth[_0xaa64('0xd')](),controller[_0xaa64('0x15')]);router['post'](_0xaa64('0x16'),auth[_0xaa64('0xd')](),interaction[_0xaa64('0x17')]('openchannel',_0xaa64('0x18')),controller[_0xaa64('0x19')]);router[_0xaa64('0x1a')](_0xaa64('0xf'),auth['isAuthenticated'](),interaction['tracked'](_0xaa64('0x1b'),'openchannelinteraction:update'),controller[_0xaa64('0x1c')]);router[_0xaa64('0x1d')](_0xaa64('0xf'),auth['isAuthenticated'](),interaction[_0xaa64('0x17')]('openchannel',_0xaa64('0x1e')),controller[_0xaa64('0x1f')]);router[_0xaa64('0x1d')](_0xaa64('0x16'),auth['isAuthenticated'](),controller['removeTags']);module[_0xaa64('0x20')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index ff1d39a..de3189f 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 _0x6a88=['ENUM','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x3afe18,_0x26922c){var _0x19ed1f=function(_0x1c0660){while(--_0x1c0660){_0x3afe18['push'](_0x3afe18['shift']());}};_0x19ed1f(++_0x26922c);}(_0x6a88,0xa9));var _0x86a8=function(_0x40e60f,_0x5365e1){_0x40e60f=_0x40e60f-0x0;var _0x35511f=_0x6a88[_0x40e60f];return _0x35511f;};'use strict';var Sequelize=require(_0x86a8('0x0'));module[_0x86a8('0x1')]={'closed':{'type':Sequelize[_0x86a8('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x86a8('0x3')]},'disposition':{'type':Sequelize[_0x86a8('0x4')]},'secondDisposition':{'type':Sequelize[_0x86a8('0x4')]},'thirdDisposition':{'type':Sequelize[_0x86a8('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x86a8('0x3')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x86a8('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x86a8('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x86a8('0x4')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xb613=['ENUM','out','BOOLEAN','sequelize','exports','STRING','DATE'];(function(_0x1cc325,_0x537298){var _0x33d644=function(_0x4cd101){while(--_0x4cd101){_0x1cc325['push'](_0x1cc325['shift']());}};_0x33d644(++_0x537298);}(_0xb613,0x9d));var _0x3b61=function(_0x2e6dee,_0x1a61b0){_0x2e6dee=_0x2e6dee-0x0;var _0x47706=_0xb613[_0x2e6dee];return _0x47706;};'use strict';var Sequelize=require(_0x3b61('0x0'));module[_0x3b61('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x3b61('0x2')]},'secondDisposition':{'type':Sequelize[_0x3b61('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x3b61('0x2')]},'read1stAt':{'type':Sequelize[_0x3b61('0x3')]},'threadId':{'type':Sequelize[_0x3b61('0x2')]},'externalUrl':{'type':Sequelize[_0x3b61('0x2')]},'lastMsgAt':{'type':Sequelize[_0x3b61('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x3b61('0x4')]('in',_0x3b61('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0x3b61('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index d92cf08..e5bb9ea 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 _0xd554=['describe','addMessage','ids','omit','getMessages','findOne','OpenchannelMessage','hasOwnProperty','pick','$gte','format','options','findAll','addTags','setTags','spread','color','openchannelInteractionTags:save','removeTags','unix','join','root','files','tmp','server','User','firstName','lastName','attachments','Attachment','secret','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','disposition','threadId','Public','Private','Messages','basename','existsSync','createReadStream','pipe','direction','out','System','renderFile','views','downloadInteraction.ejs','.pdf','log','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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','redis','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','update','then','destroy','error','stack','name','send','Users','map','fullname','Tags','TagIds','split','forEach','push','index','OpenchannelInteraction','fieldName','type','model','query','filters','attributes','intersection','fields','length','nolimit','limit','order','sort','select','field','tools_tags','ui.OpenchannelInteractionId','from','left_join','users','u.id\x20=\x20ui.UserId','openchannel_accounts','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','expr','parseSearch','search','sqlOperator','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','end','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','$substring','keys','some','isEmpty','OpenchannelAccountId','where','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','filter','replace','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?','i.id','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','user','role','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.lastName','c.email','Contact.email','Contact.phone','c.fax','o.fullname','o.internal','Owner.internal','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','rows','catch','show','params','rawAttributes','includeAll','include','create','body'];(function(_0x417a7a,_0x5d1447){var _0x54cb75=function(_0xe2a6b1){while(--_0xe2a6b1){_0x417a7a['push'](_0x417a7a['shift']());}};_0x54cb75(++_0x5d1447);}(_0xd554,0x119));var _0x4d55=function(_0x3045af,_0x30ecfd){_0x3045af=_0x3045af-0x0;var _0x13ea5b=_0xd554[_0x3045af];return _0x13ea5b;};'use strict';var emlformat=require(_0x4d55('0x0'));var rimraf=require(_0x4d55('0x1'));var zipdir=require(_0x4d55('0x2'));var jsonpatch=require(_0x4d55('0x3'));var rp=require(_0x4d55('0x4'));var moment=require(_0x4d55('0x5'));var BPromise=require(_0x4d55('0x6'));var Mustache=require(_0x4d55('0x7'));var util=require('util');var path=require(_0x4d55('0x8'));var sox=require(_0x4d55('0x9'));var csv=require(_0x4d55('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4d55('0xb'));var _=require(_0x4d55('0xc'));var squel=require(_0x4d55('0xd'));var crypto=require('crypto');var jsforce=require(_0x4d55('0xe'));var deskjs=require(_0x4d55('0xf'));var toCsv=require(_0x4d55('0xa'));var querystring=require(_0x4d55('0x10'));var Papa=require(_0x4d55('0x11'));var Redis=require('ioredis');var authService=require(_0x4d55('0x12'));var qs=require(_0x4d55('0x13'));var as=require(_0x4d55('0x14'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0x4d55('0x15'));var logger=require('../../config/logger')(_0x4d55('0x16'));var utils=require(_0x4d55('0x17'));var config=require(_0x4d55('0x18'));var licenseUtil=require(_0x4d55('0x19'));var db=require('../../mysqldb')['db'];config[_0x4d55('0x1a')]=_['defaults'](config[_0x4d55('0x1a')],{'host':_0x4d55('0x1b'),'port':0x18eb});var socket=require(_0x4d55('0x1c'))(new Redis(config[_0x4d55('0x1a')]));require('./openchannelInteraction.socket')[_0x4d55('0x1d')](socket);function respondWithStatusCode(_0x37358e,_0x1f1662){_0x1f1662=_0x1f1662||0xcc;return function(_0x1ac099){if(_0x1ac099){return _0x37358e[_0x4d55('0x1e')](_0x1f1662);}return _0x37358e[_0x4d55('0x1f')](_0x1f1662)['end']();};}function respondWithResult(_0x4e9a1d,_0x297b5f){_0x297b5f=_0x297b5f||0xc8;return function(_0x14e548){if(_0x14e548){return _0x4e9a1d[_0x4d55('0x1f')](_0x297b5f)[_0x4d55('0x20')](_0x14e548);}};}function respondWithFilteredResult(_0x144b62,_0x1fdbec){return function(_0x578755){if(_0x578755){var _0xfe7bf0=typeof _0x1fdbec[_0x4d55('0x21')]===_0x4d55('0x22')&&typeof _0x1fdbec['limit']===_0x4d55('0x22');var _0x224bdd=_0x578755[_0x4d55('0x23')];var _0x1454a2=_0xfe7bf0?0x0:_0x1fdbec['offset'];var _0x2d42b4=_0xfe7bf0?_0x578755['count']:_0x1fdbec['offset']+_0x1fdbec['limit'];var _0x3b444e;if(_0x2d42b4>=_0x224bdd){_0x2d42b4=_0x224bdd;_0x3b444e=0xc8;}else{_0x3b444e=0xce;}_0x144b62[_0x4d55('0x1f')](_0x3b444e);return _0x144b62[_0x4d55('0x24')](_0x4d55('0x25'),_0x1454a2+'-'+_0x2d42b4+'/'+_0x224bdd)['json'](_0x578755);}return null;};}function patchUpdates(_0x35bd80){return function(_0x14ad0e){try{jsonpatch[_0x4d55('0x26')](_0x14ad0e,_0x35bd80,!![]);}catch(_0xb9822a){return BPromise['reject'](_0xb9822a);}return _0x14ad0e['save']();};}function saveUpdates(_0x55c57c,_0x4f1e4e){return function(_0x14e80f){if(_0x14e80f){return _0x14e80f[_0x4d55('0x27')](_0x55c57c)[_0x4d55('0x28')](function(_0x826f50){return _0x826f50;});}return null;};}function removeEntity(_0x25403a,_0x42c3e3){return function(_0xcb3324){if(_0xcb3324){return _0xcb3324[_0x4d55('0x29')]()[_0x4d55('0x28')](function(){_0x25403a[_0x4d55('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e7b56,_0x17a328){return function(_0x178e55){if(!_0x178e55){_0x5e7b56['sendStatus'](0x194);}return _0x178e55;};}function handleError(_0x20a1b4,_0x52bb0c){_0x52bb0c=_0x52bb0c||0x1f4;return function(_0x26e374){logger[_0x4d55('0x2a')](_0x26e374[_0x4d55('0x2b')]);if(_0x26e374[_0x4d55('0x2c')]){delete _0x26e374['name'];}_0x20a1b4['status'](_0x52bb0c)[_0x4d55('0x2d')](_0x26e374);};}function getInteractionUsers(_0x1ea93f,_0x1f6a53){return new BPromise(function(_0x996a00,_0x156c69){try{if(_0x1f6a53[_0x1ea93f['id']]){_0x1ea93f[_0x4d55('0x2e')]=_[_0x4d55('0x2f')](_0x1f6a53[_0x1ea93f['id']],function(_0x1f4d3f){return{'id':_0x1f4d3f['id'],'fullname':_0x1f4d3f[_0x4d55('0x30')]};});}}catch(_0x3a3a87){_0x156c69(_0x3a3a87);}_0x996a00(_0x1ea93f);});}function getInteractionTags(_0x5404c6,_0x1a874e){return new BPromise(function(_0x45a81e,_0x5bd5c2){try{if(_0x5404c6['TagIds']){_0x5404c6[_0x4d55('0x31')]=[];_0x5404c6[_0x4d55('0x32')][_0x4d55('0x33')](',')[_0x4d55('0x34')](function(_0x4b4903){_0x5404c6[_0x4d55('0x31')][_0x4d55('0x35')](_0x1a874e[_0x4b4903]);});}delete _0x5404c6[_0x4d55('0x32')];}catch(_0x28a4a2){_0x5bd5c2(_0x28a4a2);}_0x45a81e(_0x5404c6);});}function updateOpenchannelInteraction(_0x248f00,_0x4e328d,_0x310aa7){return new BPromise(function(_0x215641,_0x2217f8){return getInteractionUsers(_0x248f00,_0x310aa7)['then'](function(_0x2d00ef){return getInteractionTags(_0x2d00ef,_0x4e328d);})[_0x4d55('0x28')](function(_0x2be7b1){_0x215641(_0x2be7b1);})['catch'](function(_0x488437){_0x2217f8(_0x488437);});});}exports[_0x4d55('0x36')]=function(_0x205bb2,_0x14aae8){var _0x4708ee={},_0x5338ee={},_0x175d58={'count':0x0,'rows':[]};var _0x25a201=_['map'](db[_0x4d55('0x37')]['rawAttributes'],function(_0x4e502c){return{'name':_0x4e502c[_0x4d55('0x38')],'type':_0x4e502c[_0x4d55('0x39')]['key']};});_0x5338ee[_0x4d55('0x3a')]=_[_0x4d55('0x2f')](_0x25a201,_0x4d55('0x2c'));_0x5338ee[_0x4d55('0x3b')]=_['keys'](_0x205bb2['query']);_0x5338ee[_0x4d55('0x3c')]=_['intersection'](_0x5338ee[_0x4d55('0x3a')],_0x5338ee[_0x4d55('0x3b')]);_0x4708ee[_0x4d55('0x3d')]=_[_0x4d55('0x3e')](_0x5338ee[_0x4d55('0x3a')],qs['fields'](_0x205bb2['query'][_0x4d55('0x3f')]));_0x4708ee[_0x4d55('0x3d')]=_0x4708ee[_0x4d55('0x3d')][_0x4d55('0x40')]?_0x4708ee[_0x4d55('0x3d')]:_0x5338ee[_0x4d55('0x3a')];if(!_0x205bb2[_0x4d55('0x3b')]['hasOwnProperty'](_0x4d55('0x41'))){_0x4708ee[_0x4d55('0x42')]=qs[_0x4d55('0x42')](_0x205bb2[_0x4d55('0x3b')][_0x4d55('0x42')]);_0x4708ee[_0x4d55('0x21')]=qs[_0x4d55('0x21')](_0x205bb2[_0x4d55('0x3b')][_0x4d55('0x21')]);}_0x4708ee[_0x4d55('0x43')]=qs['sort'](_0x205bb2[_0x4d55('0x3b')][_0x4d55('0x44')]);_0x4708ee['where']=qs[_0x4d55('0x3c')](_['pick'](_0x205bb2['query'],_0x5338ee['filters']),_0x25a201);var _0x1ef254=[];var _0x10202a=squel[_0x4d55('0x45')]()['field']('id')[_0x4d55('0x46')](_0x4d55('0x2c'))['field']('color')['from'](_0x4d55('0x47'));var _0x34088c=squel[_0x4d55('0x45')]()['field']('u.id')[_0x4d55('0x46')]('u.fullname')['field'](_0x4d55('0x48'))[_0x4d55('0x49')]('user_has_openchannel_interactions','ui')[_0x4d55('0x4a')](_0x4d55('0x4b'),'u',_0x4d55('0x4c'));var _0x3b372e=squel['select']()[_0x4d55('0x49')]('openchannel_interactions','i')[_0x4d55('0x4a')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x4d55('0x4a')](_0x4d55('0x4b'),'o','o.id\x20=\x20i.UserId')[_0x4d55('0x4a')](_0x4d55('0x4d'),'a','a.id\x20=\x20i.OpenchannelAccountId')[_0x4d55('0x4a')]('openchannel_messages','me',_0x4d55('0x4e'))['left_join'](_0x4d55('0x4f'),'it',_0x4d55('0x50'))[_0x4d55('0x4a')](_0x4d55('0x47'),'t','t.id\x20=\x20it.TagId');var _0x3e8559=squel[_0x4d55('0x51')]();var _0x3cf7cf=[];var _0x56975c=squel['expr']();var _0x3f0a88;if(_0x205bb2[_0x4d55('0x3b')]['search']){_0x3f0a88=as[_0x4d55('0x52')](_0x205bb2[_0x4d55('0x3b')][_0x4d55('0x53')]);var _0x552491=_0x3f0a88[_0x4d55('0x54')];for(var _0x56190d=0x0;_0x56190d<_0x3f0a88['conditions'][_0x4d55('0x40')];_0x56190d++){var _0x5c5b86=_0x3f0a88['conditions'][_0x56190d];var _0xd83742='i';var _0x366f92=_[_0x4d55('0x55')](_0x25a201,[_0x4d55('0x2c'),_0x5c5b86[_0x4d55('0x46')]]);if(!_0x366f92){switch(_0x5c5b86[_0x4d55('0x46')]){case'unreadMessages':if(_0x5c5b86[_0x4d55('0x56')]==0x1){_0x3b372e[_0x4d55('0x57')]('`'+_0x5c5b86[_0x4d55('0x46')]+_0x4d55('0x58'));}else{_0x3b372e[_0x4d55('0x57')]('`'+_0x5c5b86['field']+_0x4d55('0x59'));}break;case _0x4d55('0x5a'):if(_0x5c5b86[_0x4d55('0x5b')]==='$substring'){if(_0x5c5b86['value'][_0x4d55('0x33')]('\x20')[_0x4d55('0x40')]>0x1){_0x3e8559[_0x552491](_0x4d55('0x5c'),qs[_0x4d55('0x5d')](_0x5c5b86[_0x4d55('0x56')]),null);}else{var _0x5bc54a='%'+_0x5c5b86[_0x4d55('0x56')]+'%';_0x3e8559[_0x552491](_0x4d55('0x5e'),_0x5bc54a,_0x5bc54a,_0x5bc54a);}}else{_0x366f92=_[_0x4d55('0x55')](_0x25a201,[_0x4d55('0x2c'),_0x4d55('0x5f')]);_0x5c5b86[_0x4d55('0x46')]=_0x4d55('0x5f');_0x4e5f59=as[_0x4d55('0x60')](_0xd83742,_0x366f92[_0x4d55('0x39')],_0x5c5b86);_0x3e8559[_0x552491](_0x4e5f59[_0x4d55('0x61')],_0x4e5f59[_0x4d55('0x56')][_0x4d55('0x62')],_0x4e5f59[_0x4d55('0x56')][_0x4d55('0x63')]);}break;case _0x4d55('0x64'):var _0x28d99d=_0x5c5b86[_0x4d55('0x56')]['split'](',')[_0x4d55('0x2f')](function(_0x251455){return Number(_0x251455);});_0x28d99d['forEach'](function(_0x2324ea){_0x56975c['or'](_0x4d55('0x65'),'%,'+_0x2324ea+',%');});_0x3cf7cf=_['union'](_0x3cf7cf,_0x28d99d);break;case'User':if(_0x5c5b86[_0x4d55('0x5b')]===_0x4d55('0x66')){_0x3e8559[_0x552491]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x5c5b86[_0x4d55('0x56')]+'%',null);}else{_0x366f92=_['find'](_0x25a201,[_0x4d55('0x2c'),'UserId']);_0x5c5b86[_0x4d55('0x46')]='UserId';_0x4e5f59=as[_0x4d55('0x60')](_0xd83742,_0x366f92[_0x4d55('0x39')],_0x5c5b86);_0x3e8559[_0x552491](_0x4e5f59[_0x4d55('0x61')],_0x4e5f59[_0x4d55('0x56')][_0x4d55('0x62')],_0x4e5f59[_0x4d55('0x56')][_0x4d55('0x63')]);}break;case'body':_0x4e5f59=as[_0x4d55('0x60')]('me',null,_0x5c5b86);_0x3e8559[_0x552491](_0x4e5f59[_0x4d55('0x61')],_0x4e5f59[_0x4d55('0x56')]['start'],_0x4e5f59[_0x4d55('0x56')]['end']);break;}}else{var _0x4e5f59=as['buildExpression'](_0xd83742,_0x366f92[_0x4d55('0x39')],_0x5c5b86);_0x3e8559[_0x552491](_0x4e5f59[_0x4d55('0x61')],_0x4e5f59[_0x4d55('0x56')][_0x4d55('0x62')],_0x4e5f59[_0x4d55('0x56')]['end']);}}}else{var _0x1e2b54=_(_0x205bb2['query'])[_0x4d55('0x67')]()[_0x4d55('0x2f')](function(_0x4c3b0e){return _[_0x4d55('0x68')](_0x25a201,[_0x4d55('0x2c'),_0x4c3b0e])?_0x4c3b0e:undefined;})['compact']()[_0x4d55('0x56')]();if(!_[_0x4d55('0x69')](_0x1e2b54)){_0x1e2b54['forEach'](function(_0x3d726d){if(_0x3d726d===_0x4d55('0x6a')){_0x3b372e[_0x4d55('0x6b')](_0x4d55('0x6c'),[][_0x4d55('0x6d')](_0x205bb2[_0x4d55('0x3b')][_0x3d726d]));}else if(_0x3d726d===_0x4d55('0x6e')){var _0x451325=JSON[_0x4d55('0x6f')](_0x205bb2[_0x4d55('0x3b')][_0x3d726d])['$gte'];var _0x179df3=JSON[_0x4d55('0x6f')](_0x205bb2[_0x4d55('0x3b')][_0x3d726d])['$lte'];_0x3b372e['where'](_0x4d55('0x70'),_0x451325,_0x179df3);}else{if(_0x205bb2[_0x4d55('0x3b')][_0x3d726d]===_0x4d55('0x71')){_0x3b372e[_0x4d55('0x6b')]('i.'+_0x3d726d+_0x4d55('0x72'));}else{_0x3b372e[_0x4d55('0x6b')]('i.'+_0x3d726d+_0x4d55('0x73'),_0x205bb2['query'][_0x3d726d]);}}});}if(_0x205bb2[_0x4d55('0x3b')][_0x4d55('0x74')]){if(_0x205bb2[_0x4d55('0x3b')][_0x4d55('0x74')]==0x1){_0x3b372e[_0x4d55('0x57')](_0x4d55('0x75'));}else{_0x3b372e['having']('`unreadMessages`\x20>\x200');}}if(_0x205bb2[_0x4d55('0x3b')]['tag']){_0x3cf7cf=_['isArray'](_0x205bb2[_0x4d55('0x3b')]['tag'])?_0x205bb2['query']['tag']:new Array(_0x205bb2[_0x4d55('0x3b')][_0x4d55('0x76')]);_0x3cf7cf['forEach'](function(_0x2f184f){_0x56975c['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2f184f+',%');});}if(_0x205bb2[_0x4d55('0x3b')][_0x4d55('0x77')]){var _0x168d95=_0x205bb2[_0x4d55('0x3b')][_0x4d55('0x77')][_0x4d55('0x78')]('\x5c','\x5c\x5c')[_0x4d55('0x78')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x168d95)){_0x3e8559['or'](_0x4d55('0x79'),_0x168d95+'%');}else{_0x3e8559['or'](_0x4d55('0x7a'),qs['getFullTextValue'](_0x168d95))['or'](_0x4d55('0x7b'),_0x168d95+'%')['or'](_0x4d55('0x7c'),_0x168d95+'%');}}}_0x3b372e[_0x4d55('0x6b')](_0x3e8559);_0x3b372e['group'](_0x4d55('0x7d'));var _0x289c95={'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]};var _0x614bad=_0x3b372e[_0x4d55('0x7e')]();_0x614bad[_0x4d55('0x46')]('i.id');_0x614bad[_0x4d55('0x46')](_0x4d55('0x7f'),_0x4d55('0x80'));if(_0x4708ee[_0x4d55('0x43')]){_0x4708ee[_0x4d55('0x43')]['forEach'](function(_0x23545c){var _0x122f7b=_0x23545c[0x0]===_0x4d55('0x81')?_0x23545c[0x0]:'i.'+_0x23545c[0x0];_0x3b372e['order'](_0x122f7b,_0x23545c[0x1]===_0x4d55('0x82')?![]:!![]);});}if(!_[_0x4d55('0x69')](_0x3cf7cf)){_0x3b372e[_0x4d55('0x57')](_0x56975c);_0x614bad[_0x4d55('0x6b')](_0x4d55('0x83'),_0x3cf7cf);}BPromise['resolve']()[_0x4d55('0x28')](function(){if(!_0x3f0a88){if(_0x205bb2[_0x4d55('0x3b')][_0x4d55('0x6a')])return;_0x614bad[_0x4d55('0x6b')](_0x4d55('0x84'));_0x3b372e[_0x4d55('0x6b')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x205bb2[_0x4d55('0x85')][_0x4d55('0x86')]!==_0x4d55('0x87'))return;return _0x205bb2[_0x4d55('0x85')][_0x4d55('0x88')]({'attributes':['id'],'raw':!![]})[_0x4d55('0x28')](function(_0x5d0c3f){if(_[_0x4d55('0x69')](_0x5d0c3f)){_0x614bad[_0x4d55('0x6b')](_0x4d55('0x89'));_0x3b372e['where']('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x614bad[_0x4d55('0x6b')](_0x4d55('0x6c'),_['map'](_0x5d0c3f,'id'));_0x3b372e[_0x4d55('0x6b')]('i.OpenchannelAccountId\x20IN\x20?',_[_0x4d55('0x2f')](_0x5d0c3f,'id'));}});})[_0x4d55('0x28')](function(){if(_0x205bb2[_0x4d55('0x85')]['role']==='agent'&&!_0x3f0a88&&!_0x205bb2[_0x4d55('0x3b')][_0x4d55('0x6a')])return[];return db[_0x4d55('0x8a')][_0x4d55('0x3b')](_0x614bad[_0x4d55('0x8b')](),_0x289c95);})[_0x4d55('0x28')](function(_0x3c60d8){_0x175d58[_0x4d55('0x23')]=_0x3c60d8[_0x4d55('0x40')];if(_0x175d58['count']===0x0)return[];return db[_0x4d55('0x8a')][_0x4d55('0x3b')](_0x10202a[_0x4d55('0x8b')](),_0x289c95)[_0x4d55('0x28')](function(_0x37cdf2){_0x1ef254=_['keyBy'](_0x37cdf2,'id');_0x289c95=_[_0x4d55('0x8c')](_0x289c95,{'model':db[_0x4d55('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x205bb2['query'][_0x4d55('0x3f')]){_0x4708ee['attributes'][_0x4d55('0x34')](function(_0x15be0d){_0x3b372e[_0x4d55('0x46')]('i.'+_0x15be0d);});}else{_0x3b372e[_0x4d55('0x46')](_0x4d55('0x7f'),_0x4d55('0x80'));_0x3b372e[_0x4d55('0x46')]('a.key',_0x4d55('0x8d'));_0x3b372e[_0x4d55('0x46')](_0x4d55('0x8e'),_0x4d55('0x8f'));_0x3b372e[_0x4d55('0x46')](_0x4d55('0x90'),_0x4d55('0x81'));_0x3b372e[_0x4d55('0x46')](_0x4d55('0x91'));_0x3b372e[_0x4d55('0x46')]('c.firstName','Contact.firstName');_0x3b372e[_0x4d55('0x46')](_0x4d55('0x92'),'Contact.lastName');_0x3b372e[_0x4d55('0x46')](_0x4d55('0x93'),_0x4d55('0x94'));_0x3b372e[_0x4d55('0x46')]('c.phone',_0x4d55('0x95'));_0x3b372e[_0x4d55('0x46')]('c.mobile','Contact.mobile');_0x3b372e[_0x4d55('0x46')](_0x4d55('0x96'),'Contact.fax');_0x3b372e[_0x4d55('0x46')](_0x4d55('0x97'),'Owner.fullname');_0x3b372e['field'](_0x4d55('0x98'),_0x4d55('0x99'));_0x3b372e['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0x4d55('0x32'));}if(_0x4708ee[_0x4d55('0x42')])_0x3b372e[_0x4d55('0x42')](_0x4708ee[_0x4d55('0x42')]);if(_0x4708ee[_0x4d55('0x21')])_0x3b372e[_0x4d55('0x21')](_0x4708ee['offset']);return db[_0x4d55('0x8a')][_0x4d55('0x3b')](_0x3b372e[_0x4d55('0x8b')](),_0x289c95);})[_0x4d55('0x28')](function(_0x55aafd){if(_0x55aafd[_0x4d55('0x40')]>0x0)_0x34088c['where'](_0x4d55('0x9a'),_[_0x4d55('0x2f')](_0x55aafd,'id'));return db['sequelize'][_0x4d55('0x3b')](_0x34088c[_0x4d55('0x8b')](),_0x289c95)[_0x4d55('0x28')](function(_0x42644f){var _0x3f88ab=_[_0x4d55('0x9b')](_0x42644f,_0x4d55('0x9c'));var _0xc95b88=[];_0x55aafd['forEach'](function(_0x27c46a){_0xc95b88[_0x4d55('0x35')](updateOpenchannelInteraction(_0x27c46a,_0x1ef254,_0x3f88ab));});return BPromise[_0x4d55('0x9d')](_0xc95b88);});});})[_0x4d55('0x28')](function(_0x405174){_0x175d58[_0x4d55('0x9e')]=_0x405174;return _0x175d58;})[_0x4d55('0x28')](respondWithFilteredResult(_0x14aae8,_0x4708ee))[_0x4d55('0x9f')](handleError(_0x14aae8,null));};exports[_0x4d55('0xa0')]=function(_0xba3bc0,_0xbe7159){var _0x265ce2={};if(_0xba3bc0[_0x4d55('0x3b')][_0x4d55('0x39')]&&_0xba3bc0[_0x4d55('0x3b')][_0x4d55('0x39')]==='from'){_0x265ce2[_0x4d55('0x49')]=_0xba3bc0[_0x4d55('0xa1')]['id'];}else{_0x265ce2['id']=_0xba3bc0[_0x4d55('0xa1')]['id'];}var _0x32e655={'raw':![],'where':_0x265ce2},_0x474214={};_0x474214[_0x4d55('0x3a')]=_[_0x4d55('0x67')](db[_0x4d55('0x37')][_0x4d55('0xa2')]);_0x474214[_0x4d55('0x3b')]=_['keys'](_0xba3bc0['query']);_0x474214[_0x4d55('0x3c')]=_['intersection'](_0x474214[_0x4d55('0x3a')],_0x474214['query']);_0x32e655[_0x4d55('0x3d')]=_[_0x4d55('0x3e')](_0x474214[_0x4d55('0x3a')],qs[_0x4d55('0x3f')](_0xba3bc0['query'][_0x4d55('0x3f')]));_0x32e655[_0x4d55('0x3d')]=_0x32e655['attributes'][_0x4d55('0x40')]?_0x32e655['attributes']:_0x474214[_0x4d55('0x3a')];if(_0xba3bc0['query'][_0x4d55('0xa3')]){_0x32e655[_0x4d55('0xa4')]=[{'all':!![]}];}_0x32e655=_[_0x4d55('0x8c')]({},_0x32e655,_0xba3bc0['options']);return db[_0x4d55('0x37')][_0x4d55('0x55')](_0x32e655)[_0x4d55('0x28')](handleEntityNotFound(_0xbe7159,null))[_0x4d55('0x28')](respondWithResult(_0xbe7159,null))[_0x4d55('0x9f')](handleError(_0xbe7159,null));};exports[_0x4d55('0xa5')]=function(_0x3b644d,_0x310771){return db[_0x4d55('0x37')]['create'](_0x3b644d[_0x4d55('0xa6')],{})[_0x4d55('0x28')](respondWithResult(_0x310771,0xc9))[_0x4d55('0x9f')](handleError(_0x310771,null));};exports['update']=function(_0xdc9309,_0x22e49b){if(_0xdc9309[_0x4d55('0xa6')]['id']){delete _0xdc9309[_0x4d55('0xa6')]['id'];}return db[_0x4d55('0x37')][_0x4d55('0x55')]({'where':{'id':_0xdc9309[_0x4d55('0xa1')]['id']}})[_0x4d55('0x28')](handleEntityNotFound(_0x22e49b,null))[_0x4d55('0x28')](saveUpdates(_0xdc9309['body'],null))[_0x4d55('0x28')](respondWithResult(_0x22e49b,null))[_0x4d55('0x9f')](handleError(_0x22e49b,null));};exports[_0x4d55('0x29')]=function(_0x4c875b,_0x211292){return db['OpenchannelInteraction'][_0x4d55('0x55')]({'where':{'id':_0x4c875b[_0x4d55('0xa1')]['id']}})[_0x4d55('0x28')](handleEntityNotFound(_0x211292,null))['then'](removeEntity(_0x211292,null))[_0x4d55('0x9f')](handleError(_0x211292,null));};exports[_0x4d55('0xa7')]=function(_0x4b5898,_0xa68c8){return db[_0x4d55('0x37')]['describe']()[_0x4d55('0x28')](respondWithResult(_0xa68c8,null))[_0x4d55('0x9f')](handleError(_0xa68c8,null));};exports[_0x4d55('0xa8')]=function(_0x1aa3eb,_0x11527c,_0x56b9ab){return db['OpenchannelMessage'][_0x4d55('0x55')]({'where':{'id':_0x1aa3eb[_0x4d55('0xa1')]['id']}})[_0x4d55('0x28')](handleEntityNotFound(_0x11527c,null))['then'](function(_0x3978b3){if(_0x3978b3){return _0x3978b3[_0x4d55('0xa8')](_0x1aa3eb[_0x4d55('0xa6')][_0x4d55('0xa9')],_[_0x4d55('0xaa')](_0x1aa3eb[_0x4d55('0xa6')],[_0x4d55('0xa9'),'id'])||{});}})[_0x4d55('0x28')](respondWithResult(_0x11527c,null))[_0x4d55('0x9f')](handleError(_0x11527c,null));};exports[_0x4d55('0xab')]=function(_0x2c72ba,_0xb547e3,_0xa03bb0){var _0x1d7aa3={'raw':![],'where':{}};var _0x355eff={};var _0x583787={'count':0x0,'rows':[]};return db[_0x4d55('0x37')][_0x4d55('0xac')]({'where':{'id':_0x2c72ba[_0x4d55('0xa1')]['id']}})[_0x4d55('0x28')](handleEntityNotFound(_0xb547e3,null))[_0x4d55('0x28')](function(_0x169b01){if(_0x169b01){_0x355eff[_0x4d55('0x3a')]=_[_0x4d55('0x67')](db[_0x4d55('0xad')][_0x4d55('0xa2')]);_0x355eff[_0x4d55('0x3b')]=_[_0x4d55('0x67')](_0x2c72ba[_0x4d55('0x3b')]);_0x355eff[_0x4d55('0x3c')]=_[_0x4d55('0x3e')](_0x355eff[_0x4d55('0x3a')],_0x355eff[_0x4d55('0x3b')]);_0x1d7aa3[_0x4d55('0x3d')]=_['intersection'](_0x355eff[_0x4d55('0x3a')],qs[_0x4d55('0x3f')](_0x2c72ba[_0x4d55('0x3b')][_0x4d55('0x3f')]));_0x1d7aa3[_0x4d55('0x3d')]=_0x1d7aa3['attributes']['length']?_0x1d7aa3[_0x4d55('0x3d')]:_0x355eff[_0x4d55('0x3a')];if(!_0x2c72ba['query'][_0x4d55('0xae')](_0x4d55('0x41'))){_0x1d7aa3['limit']=qs['limit'](_0x2c72ba[_0x4d55('0x3b')]['limit']);_0x1d7aa3[_0x4d55('0x21')]=qs[_0x4d55('0x21')](_0x2c72ba['query'][_0x4d55('0x21')]);}_0x1d7aa3[_0x4d55('0x43')]=qs[_0x4d55('0x44')](_0x2c72ba['query'][_0x4d55('0x44')]);_0x1d7aa3[_0x4d55('0x6b')]=qs[_0x4d55('0x3c')](_[_0x4d55('0xaf')](_0x2c72ba[_0x4d55('0x3b')],_0x355eff['filters']));_0x1d7aa3['where']['OpenchannelInteractionId']=_0x169b01['id'];if(_0x2c72ba['query'][_0x4d55('0x77')]){_0x1d7aa3[_0x4d55('0x6b')]=_[_0x4d55('0x8c')](_0x1d7aa3['where'],{'$or':_[_0x4d55('0x2f')](_0x1d7aa3[_0x4d55('0x3d')],function(_0x4b88cb){var _0x308d4c={};_0x308d4c[_0x4b88cb]={'$like':'%'+_0x2c72ba[_0x4d55('0x3b')][_0x4d55('0x77')]+'%'};return _0x308d4c;})});}if(_0x2c72ba[_0x4d55('0x3b')][_0x4d55('0xb0')]){var _0x37bf7f=_0x2c72ba[_0x4d55('0x3b')][_0x4d55('0xb0')]['split'](',');var _0x1d9299={};_0x1d9299[_0x37bf7f[0x0]]={'$gte':moment(_0x37bf7f[0x1])[_0x4d55('0xb1')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1d7aa3[_0x4d55('0x6b')]=_[_0x4d55('0x8c')](_0x1d7aa3[_0x4d55('0x6b')],_0x1d9299);}_0x1d7aa3=_[_0x4d55('0x8c')]({},_0x1d7aa3,_0x2c72ba[_0x4d55('0xb2')]);return db[_0x4d55('0xad')]['count']({'where':_0x1d7aa3[_0x4d55('0x6b')]})[_0x4d55('0x28')](function(_0x98fbc8){_0x583787[_0x4d55('0x23')]=_0x98fbc8;if(_0x2c72ba[_0x4d55('0x3b')][_0x4d55('0xa3')]){_0x1d7aa3[_0x4d55('0xa4')]=[{'all':!![]}];}return db[_0x4d55('0xad')][_0x4d55('0xb3')](_0x1d7aa3);})['then'](function(_0x4035dc){_0x583787['rows']=_0x4035dc;return _0x583787;});}})[_0x4d55('0x28')](respondWithFilteredResult(_0xb547e3,_0x1d7aa3))[_0x4d55('0x9f')](handleError(_0xb547e3,null));};exports[_0x4d55('0xb4')]=function(_0x4efc9c,_0x57502e,_0x5d85fd){return db['OpenchannelInteraction'][_0x4d55('0x55')]({'where':{'id':_0x4efc9c[_0x4d55('0xa1')]['id']}})[_0x4d55('0x28')](handleEntityNotFound(_0x57502e,null))[_0x4d55('0x28')](function(_0x366854){if(_0x366854){return _0x366854[_0x4d55('0xb5')](_0x4efc9c[_0x4d55('0xa6')][_0x4d55('0xa9')],_[_0x4d55('0xaa')](_0x4efc9c[_0x4d55('0xa6')],[_0x4d55('0xa9'),'id'])||{})[_0x4d55('0xb6')](function(){return db[_0x4d55('0x64')][_0x4d55('0xb3')]({'attributes':['id',_0x4d55('0x2c'),_0x4d55('0xb7')],'where':{'id':_0x4efc9c[_0x4d55('0xa6')][_0x4d55('0xa9')]}});})[_0x4d55('0x28')](function(_0x1d214c){socket['emit'](_0x4d55('0xb8'),{'id':Number(_0x4efc9c[_0x4d55('0xa1')]['id']),'tags':_0x1d214c||[]});return{'id':Number(_0x4efc9c[_0x4d55('0xa1')]['id']),'tags':_0x1d214c||[]};});}})[_0x4d55('0x28')](respondWithResult(_0x57502e,null))[_0x4d55('0x9f')](handleError(_0x57502e,null));};exports[_0x4d55('0xb9')]=function(_0x5a2ad4,_0x4d195e,_0x3c11bc){return db[_0x4d55('0x37')][_0x4d55('0x55')]({'where':{'id':_0x5a2ad4[_0x4d55('0xa1')]['id']}})[_0x4d55('0x28')](handleEntityNotFound(_0x4d195e,null))[_0x4d55('0x28')](function(_0x3da386){if(_0x3da386){return _0x3da386[_0x4d55('0xb9')](_0x5a2ad4[_0x4d55('0x3b')][_0x4d55('0xa9')]);}})[_0x4d55('0x28')](respondWithStatusCode(_0x4d195e,null))[_0x4d55('0x9f')](handleError(_0x4d195e,null));};exports['download']=function(_0x555a76,_0x3a4449){var _0x1914c3=moment()[_0x4d55('0xba')]()['toString']();var _0x16e093=path[_0x4d55('0xbb')](config[_0x4d55('0xbc')],'server',_0x4d55('0xbd'),_0x4d55('0xbe'));var _0xc598b6=path[_0x4d55('0xbb')](config[_0x4d55('0xbc')],_0x4d55('0xbf'),'files','attachments');var _0x285506=path[_0x4d55('0xbb')](_0x16e093,_0x1914c3);var _0xc0e5bb=util['format']('transcript-%d-%s.zip',_0x555a76['params']['id'],_0x1914c3);var _0x1a524a=path[_0x4d55('0xbb')](_0x16e093,_0xc0e5bb);var _0x1ed2f0=[];_0x1ed2f0[_0x4d55('0x35')]({'model':db[_0x4d55('0xc0')],'as':_0x4d55('0xc0'),'attributes':['id',_0x4d55('0x30')],'raw':!![]});_0x1ed2f0['push']({'model':db['CmContact'],'as':'Contact','attributes':['id',_0x4d55('0xc1'),_0x4d55('0xc2')],'raw':!![]});if(_0x555a76[_0x4d55('0x3b')][_0x4d55('0xc3')]){_0x1ed2f0[_0x4d55('0x35')]({'model':db[_0x4d55('0xc4')],'as':_0x4d55('0xc4'),'raw':!![]});}var _0x199138=[{'model':db['OpenchannelMessage'],'as':'Messages','attributes':['id','body',_0x4d55('0x6e'),'direction',_0x4d55('0xc5'),_0x4d55('0x74')],'include':_0x1ed2f0}];_0x199138[_0x4d55('0x35')]({'model':db[_0x4d55('0xc6')],'as':_0x4d55('0xc7'),'attributes':['id',_0x4d55('0x2c')]});_0x199138[_0x4d55('0x35')]({'model':db[_0x4d55('0xc0')],'as':_0x4d55('0xc8'),'attributes':['id','fullname']});return db[_0x4d55('0x37')][_0x4d55('0x55')]({'where':{'id':_0x555a76['params']['id']},'include':_0x199138})['then'](handleEntityNotFound(_0x3a4449,null))[_0x4d55('0x28')](function(_0x54adaf){if(_0x54adaf){var _0xbcdf50=_0x54adaf[_0x4d55('0xc9')]({'plain':!![]});fs[_0x4d55('0xca')](_0x285506);var _0x374775={'channel':_0x4d55('0xcb'),'account':_0xbcdf50[_0x4d55('0xc7')][_0x4d55('0x2c')],'agent':_0xbcdf50[_0x4d55('0xc8')]?_0xbcdf50[_0x4d55('0xc8')][_0x4d55('0x30')]:_0x4d55('0xcc'),'createdAt':moment(_0xbcdf50['createdAt'])['format'](_0x4d55('0xcd'))['toString'](),'closedAt':_0xbcdf50[_0x4d55('0xce')]?moment(_0xbcdf50['closedAt'])[_0x4d55('0xb1')](_0x4d55('0xcd'))[_0x4d55('0x8b')]():'','disposition':_0xbcdf50[_0x4d55('0xcf')],'visibility':_0xbcdf50[_0x4d55('0xd0')]?_0x4d55('0xd1'):_0x4d55('0xd2'),'messages':_(_0xbcdf50[_0x4d55('0xd3')])[_0x4d55('0x77')]({'secret':![]})['map'](function(_0x3eedcc){if(_0x3eedcc[_0x4d55('0xc4')]){var _0x25f0c2=path[_0x4d55('0xbb')](_0xc598b6,_0x3eedcc[_0x4d55('0xc4')][_0x4d55('0xd4')]);if(fs[_0x4d55('0xd5')](_0x25f0c2)){fs[_0x4d55('0xd6')](_0x25f0c2)[_0x4d55('0xd7')](fs['createWriteStream'](path[_0x4d55('0xbb')](_0x285506,_0x3eedcc['Attachment'][_0x4d55('0xd4')])));}}return{'date':moment(_0x3eedcc['createdAt'])[_0x4d55('0xb1')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x3eedcc[_0x4d55('0xd8')]===_0x4d55('0xd9')?_0x3eedcc[_0x4d55('0xc0')]?_0x3eedcc[_0x4d55('0xc0')][_0x4d55('0x30')]:_0x4d55('0xda'):_0x3eedcc['Contact'][_0x4d55('0xc1')]+(_0x3eedcc['Contact']['lastName']?'\x20'+_0x3eedcc['Contact'][_0x4d55('0xc2')]:''),'body':_0x3eedcc[_0x4d55('0xc4')]?_0x3eedcc['Attachment'][_0x4d55('0xd4')]:_0x3eedcc['body'],'direction':_0x3eedcc['direction']===_0x4d55('0xd9')?'A':'C','secret':_0x3eedcc[_0x4d55('0xc5')],'read':_0x3eedcc['read'],'attachment':_0x3eedcc[_0x4d55('0xc4')]};})[_0x4d55('0x56')]()};return ejs[_0x4d55('0xdb')](path[_0x4d55('0xbb')](config['root'],_0x4d55('0xbf'),_0x4d55('0xdc'),_0x4d55('0xdd')),{'interaction':_0x374775})[_0x4d55('0x28')](function(_0x4a4431){var _0x5a8ff7=path['join'](_0x285506,'transcript-'+_0xbcdf50['id']+'-'+_0x1914c3+_0x4d55('0xde'));var _0x27682f={'path':_0x5a8ff7,'channel':_0x4d55('0xcb'),'interactionId':_0xbcdf50['id']};return pdf['createPdfFromHTML'](_0x4a4431,_0x27682f);})['then'](function(){return new BPromise(function(_0xa3e669,_0x1c0574){zipdir(_0x285506,{'saveTo':_0x1a524a},function(_0x445178,_0x23b93e){if(_0x445178)return _0x1c0574(_0x445178);return _0xa3e669(_0x23b93e);});})[_0x4d55('0x28')](function(){return new BPromise(function(_0x235f1c,_0x1a5c86){rimraf(_0x285506,function(_0x489f20){if(_0x489f20)_0x1a5c86(_0x489f20);return _0x235f1c();});});})[_0x4d55('0x28')](function(){return _0x3a4449['download'](_0x1a524a,_0xc0e5bb,function(_0x12bc39){if(_0x12bc39){console[_0x4d55('0xdf')]('err',_0x12bc39);}else{fs['unlinkSync'](_0x1a524a);}});});});}else{return _0x3a4449['sendStatus'](0xc8);}})[_0x4d55('0x9f')](handleError(_0x3a4449,null));}; \ No newline at end of file +var _0x6055=['basename','out','System','firstName','views','downloadInteraction.ejs','transcript-','.pdf','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','update','then','error','stack','name','Users','map','fullname','TagIds','Tags','index','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','users','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','length','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','buildExpression','start','end','Tag','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','some','compact','isEmpty','forEach','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','\x20IS\x20NULL','read','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','i.id','Sequelize','QueryTypes','clone','contactName','DESC','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','role','user','i.OpenchannelAccountId\x20IS\x20NULL','agent','sequelize','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','toString','ui.OpenchannelInteractionId\x20IN\x20?','OpenchannelInteractionId','all','rows','catch','show','params','OpenchannelInteraction','includeAll','options','create','body','describe','addMessage','OpenchannelMessage','ids','omit','hasOwnProperty','$gte','YYYY-MM-DD\x20HH:mm:ss','include','findAll','setTags','spread','openchannelInteractionTags:save','removeTags','download','unix','join','root','files','tmp','server','format','transcript-%d-%s.zip','push','User','CmContact','lastName','Attachment','direction','secret','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','closed','closedAt','disposition','Private','Messages','createWriteStream'];(function(_0x146755,_0x13d103){var _0x160744=function(_0x553ef9){while(--_0x553ef9){_0x146755['push'](_0x146755['shift']());}};_0x160744(++_0x13d103);}(_0x6055,0xf5));var _0x5605=function(_0x376ce,_0x12377c){_0x376ce=_0x376ce-0x0;var _0x3cfeec=_0x6055[_0x376ce];return _0x3cfeec;};'use strict';var emlformat=require(_0x5605('0x0'));var rimraf=require(_0x5605('0x1'));var zipdir=require(_0x5605('0x2'));var jsonpatch=require(_0x5605('0x3'));var rp=require(_0x5605('0x4'));var moment=require(_0x5605('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x5605('0x6'));var sox=require(_0x5605('0x7'));var csv=require('to-csv');var ejs=require(_0x5605('0x8'));var fs=require('fs');var fs_extra=require(_0x5605('0x9'));var _=require(_0x5605('0xa'));var squel=require(_0x5605('0xb'));var crypto=require(_0x5605('0xc'));var jsforce=require(_0x5605('0xd'));var deskjs=require(_0x5605('0xe'));var toCsv=require(_0x5605('0xf'));var querystring=require(_0x5605('0x10'));var Papa=require(_0x5605('0x11'));var Redis=require(_0x5605('0x12'));var authService=require(_0x5605('0x13'));var qs=require(_0x5605('0x14'));var as=require(_0x5605('0x15'));var pdf=require(_0x5605('0x16'));var hardwareService=require(_0x5605('0x17'));var logger=require(_0x5605('0x18'))(_0x5605('0x19'));var utils=require(_0x5605('0x1a'));var config=require(_0x5605('0x1b'));var licenseUtil=require(_0x5605('0x1c'));var db=require(_0x5605('0x1d'))['db'];config[_0x5605('0x1e')]=_[_0x5605('0x1f')](config[_0x5605('0x1e')],{'host':'localhost','port':0x18eb});var socket=require(_0x5605('0x20'))(new Redis(config[_0x5605('0x1e')]));require(_0x5605('0x21'))[_0x5605('0x22')](socket);function respondWithStatusCode(_0x369587,_0x300f25){_0x300f25=_0x300f25||0xcc;return function(_0x4126fc){if(_0x4126fc){return _0x369587[_0x5605('0x23')](_0x300f25);}return _0x369587[_0x5605('0x24')](_0x300f25)['end']();};}function respondWithResult(_0x5a5cd0,_0x18bd82){_0x18bd82=_0x18bd82||0xc8;return function(_0x55df1a){if(_0x55df1a){return _0x5a5cd0[_0x5605('0x24')](_0x18bd82)[_0x5605('0x25')](_0x55df1a);}};}function respondWithFilteredResult(_0x3dcb01,_0x1330ec){return function(_0x281505){if(_0x281505){var _0x2c9c3e=typeof _0x1330ec[_0x5605('0x26')]===_0x5605('0x27')&&typeof _0x1330ec[_0x5605('0x28')]===_0x5605('0x27');var _0x16eee0=_0x281505[_0x5605('0x29')];var _0x34d8b7=_0x2c9c3e?0x0:_0x1330ec['offset'];var _0x40a7da=_0x2c9c3e?_0x281505[_0x5605('0x29')]:_0x1330ec['offset']+_0x1330ec[_0x5605('0x28')];var _0x281454;if(_0x40a7da>=_0x16eee0){_0x40a7da=_0x16eee0;_0x281454=0xc8;}else{_0x281454=0xce;}_0x3dcb01['status'](_0x281454);return _0x3dcb01[_0x5605('0x2a')]('Content-Range',_0x34d8b7+'-'+_0x40a7da+'/'+_0x16eee0)['json'](_0x281505);}return null;};}function patchUpdates(_0x33b685){return function(_0xdfe44a){try{jsonpatch[_0x5605('0x2b')](_0xdfe44a,_0x33b685,!![]);}catch(_0x32ecbb){return BPromise[_0x5605('0x2c')](_0x32ecbb);}return _0xdfe44a['save']();};}function saveUpdates(_0x5e900b,_0x3cff0f){return function(_0x2d0219){if(_0x2d0219){return _0x2d0219[_0x5605('0x2d')](_0x5e900b)['then'](function(_0x1c8231){return _0x1c8231;});}return null;};}function removeEntity(_0x228fe1,_0xc3dd89){return function(_0x11dca7){if(_0x11dca7){return _0x11dca7['destroy']()[_0x5605('0x2e')](function(){_0x228fe1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4cc082,_0x3b0939){return function(_0xf4a752){if(!_0xf4a752){_0x4cc082[_0x5605('0x23')](0x194);}return _0xf4a752;};}function handleError(_0xa267dd,_0x4f67c7){_0x4f67c7=_0x4f67c7||0x1f4;return function(_0x43b3cb){logger[_0x5605('0x2f')](_0x43b3cb[_0x5605('0x30')]);if(_0x43b3cb['name']){delete _0x43b3cb[_0x5605('0x31')];}_0xa267dd[_0x5605('0x24')](_0x4f67c7)['send'](_0x43b3cb);};}function getInteractionUsers(_0x49c6b8,_0x58389d){return new BPromise(function(_0x16e86e,_0x213b16){try{if(_0x58389d[_0x49c6b8['id']]){_0x49c6b8[_0x5605('0x32')]=_[_0x5605('0x33')](_0x58389d[_0x49c6b8['id']],function(_0x12b758){return{'id':_0x12b758['id'],'fullname':_0x12b758[_0x5605('0x34')]};});}}catch(_0x216a31){_0x213b16(_0x216a31);}_0x16e86e(_0x49c6b8);});}function getInteractionTags(_0x622d03,_0x294988){return new BPromise(function(_0x541b2d,_0x11ab7f){try{if(_0x622d03[_0x5605('0x35')]){_0x622d03[_0x5605('0x36')]=[];_0x622d03[_0x5605('0x35')]['split'](',')['forEach'](function(_0x508439){_0x622d03[_0x5605('0x36')]['push'](_0x294988[_0x508439]);});}delete _0x622d03[_0x5605('0x35')];}catch(_0x1d28eb){_0x11ab7f(_0x1d28eb);}_0x541b2d(_0x622d03);});}function updateOpenchannelInteraction(_0x20403d,_0xa9cad2,_0x45ce85){return new BPromise(function(_0x3a0a6a,_0x426c31){return getInteractionUsers(_0x20403d,_0x45ce85)[_0x5605('0x2e')](function(_0x2e8edf){return getInteractionTags(_0x2e8edf,_0xa9cad2);})[_0x5605('0x2e')](function(_0x34b102){_0x3a0a6a(_0x34b102);})['catch'](function(_0x8db8f1){_0x426c31(_0x8db8f1);});});}exports[_0x5605('0x37')]=function(_0x361c9b,_0x10814a){var _0x3ad6cb={},_0x57daa4={},_0x3a8131={'count':0x0,'rows':[]};var _0x34515b=_[_0x5605('0x33')](db['OpenchannelInteraction'][_0x5605('0x38')],function(_0x26e069){return{'name':_0x26e069[_0x5605('0x39')],'type':_0x26e069[_0x5605('0x3a')]['key']};});_0x57daa4[_0x5605('0x3b')]=_[_0x5605('0x33')](_0x34515b,'name');_0x57daa4[_0x5605('0x3c')]=_[_0x5605('0x3d')](_0x361c9b[_0x5605('0x3c')]);_0x57daa4[_0x5605('0x3e')]=_[_0x5605('0x3f')](_0x57daa4[_0x5605('0x3b')],_0x57daa4['query']);_0x3ad6cb[_0x5605('0x40')]=_[_0x5605('0x3f')](_0x57daa4['model'],qs['fields'](_0x361c9b['query'][_0x5605('0x41')]));_0x3ad6cb[_0x5605('0x40')]=_0x3ad6cb[_0x5605('0x40')]['length']?_0x3ad6cb[_0x5605('0x40')]:_0x57daa4['model'];if(!_0x361c9b[_0x5605('0x3c')]['hasOwnProperty'](_0x5605('0x42'))){_0x3ad6cb[_0x5605('0x28')]=qs[_0x5605('0x28')](_0x361c9b[_0x5605('0x3c')][_0x5605('0x28')]);_0x3ad6cb[_0x5605('0x26')]=qs[_0x5605('0x26')](_0x361c9b[_0x5605('0x3c')][_0x5605('0x26')]);}_0x3ad6cb[_0x5605('0x43')]=qs[_0x5605('0x44')](_0x361c9b[_0x5605('0x3c')][_0x5605('0x44')]);_0x3ad6cb[_0x5605('0x45')]=qs[_0x5605('0x3e')](_[_0x5605('0x46')](_0x361c9b['query'],_0x57daa4[_0x5605('0x3e')]),_0x34515b);var _0x51cd3e=[];var _0x4b7740=squel[_0x5605('0x47')]()['field']('id')['field'](_0x5605('0x31'))[_0x5605('0x48')](_0x5605('0x49'))[_0x5605('0x4a')](_0x5605('0x4b'));var _0x9260a0=squel[_0x5605('0x47')]()['field'](_0x5605('0x4c'))['field'](_0x5605('0x4d'))[_0x5605('0x48')](_0x5605('0x4e'))[_0x5605('0x4a')](_0x5605('0x4f'),'ui')[_0x5605('0x50')](_0x5605('0x51'),'u','u.id\x20=\x20ui.UserId');var _0x47776c=squel[_0x5605('0x47')]()['from']('openchannel_interactions','i')[_0x5605('0x50')](_0x5605('0x52'),'c',_0x5605('0x53'))['left_join'](_0x5605('0x51'),'o',_0x5605('0x54'))[_0x5605('0x50')](_0x5605('0x55'),'a',_0x5605('0x56'))[_0x5605('0x50')](_0x5605('0x57'),'me',_0x5605('0x58'))[_0x5605('0x50')](_0x5605('0x59'),'it',_0x5605('0x5a'))['left_join'](_0x5605('0x4b'),'t','t.id\x20=\x20it.TagId');var _0x25e2b5=squel[_0x5605('0x5b')]();var _0x2a50b1=[];var _0x3fd5b1=squel[_0x5605('0x5b')]();var _0x1bb77e;if(_0x361c9b['query'][_0x5605('0x5c')]){_0x1bb77e=as[_0x5605('0x5d')](_0x361c9b[_0x5605('0x3c')][_0x5605('0x5c')]);var _0x4d1bfd=_0x1bb77e[_0x5605('0x5e')];for(var _0x65c74=0x0;_0x65c74<_0x1bb77e['conditions'][_0x5605('0x5f')];_0x65c74++){var _0x33bc2a=_0x1bb77e[_0x5605('0x60')][_0x65c74];var _0x4d4e9b='i';var _0x2ccc7b=_[_0x5605('0x61')](_0x34515b,[_0x5605('0x31'),_0x33bc2a[_0x5605('0x48')]]);if(!_0x2ccc7b){switch(_0x33bc2a[_0x5605('0x48')]){case _0x5605('0x62'):if(_0x33bc2a[_0x5605('0x63')]==0x1){_0x47776c[_0x5605('0x64')]('`'+_0x33bc2a[_0x5605('0x48')]+'`\x20=\x200');}else{_0x47776c[_0x5605('0x64')]('`'+_0x33bc2a[_0x5605('0x48')]+_0x5605('0x65'));}break;case _0x5605('0x66'):if(_0x33bc2a[_0x5605('0x67')]===_0x5605('0x68')){if(_0x33bc2a[_0x5605('0x63')][_0x5605('0x69')]('\x20')[_0x5605('0x5f')]>0x1){_0x25e2b5[_0x4d1bfd](_0x5605('0x6a'),qs['getFullTextValue'](_0x33bc2a[_0x5605('0x63')]),null);}else{var _0x56e250='%'+_0x33bc2a[_0x5605('0x63')]+'%';_0x25e2b5[_0x4d1bfd]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x56e250,_0x56e250,_0x56e250);}}else{_0x2ccc7b=_[_0x5605('0x61')](_0x34515b,[_0x5605('0x31'),'ContactId']);_0x33bc2a[_0x5605('0x48')]='ContactId';_0x236805=as[_0x5605('0x6b')](_0x4d4e9b,_0x2ccc7b[_0x5605('0x3a')],_0x33bc2a);_0x25e2b5[_0x4d1bfd](_0x236805['text'],_0x236805[_0x5605('0x63')][_0x5605('0x6c')],_0x236805[_0x5605('0x63')][_0x5605('0x6d')]);}break;case _0x5605('0x6e'):var _0x1df43b=_0x33bc2a[_0x5605('0x63')]['split'](',')['map'](function(_0xf34db7){return Number(_0xf34db7);});_0x1df43b['forEach'](function(_0xdf2c8a){_0x3fd5b1['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xdf2c8a+',%');});_0x2a50b1=_['union'](_0x2a50b1,_0x1df43b);break;case'User':if(_0x33bc2a[_0x5605('0x67')]==='$substring'){_0x25e2b5[_0x4d1bfd](_0x5605('0x6f'),'%'+_0x33bc2a[_0x5605('0x63')]+'%',null);}else{_0x2ccc7b=_['find'](_0x34515b,[_0x5605('0x31'),_0x5605('0x70')]);_0x33bc2a['field']=_0x5605('0x70');_0x236805=as[_0x5605('0x6b')](_0x4d4e9b,_0x2ccc7b[_0x5605('0x3a')],_0x33bc2a);_0x25e2b5[_0x4d1bfd](_0x236805[_0x5605('0x71')],_0x236805[_0x5605('0x63')][_0x5605('0x6c')],_0x236805[_0x5605('0x63')][_0x5605('0x6d')]);}break;case'body':_0x236805=as['buildExpression']('me',null,_0x33bc2a);_0x25e2b5[_0x4d1bfd](_0x236805[_0x5605('0x71')],_0x236805[_0x5605('0x63')][_0x5605('0x6c')],_0x236805[_0x5605('0x63')][_0x5605('0x6d')]);break;}}else{var _0x236805=as[_0x5605('0x6b')](_0x4d4e9b,_0x2ccc7b[_0x5605('0x3a')],_0x33bc2a);_0x25e2b5[_0x4d1bfd](_0x236805[_0x5605('0x71')],_0x236805['value']['start'],_0x236805[_0x5605('0x63')][_0x5605('0x6d')]);}}}else{var _0x261786=_(_0x361c9b[_0x5605('0x3c')])['keys']()[_0x5605('0x33')](function(_0x175b06){return _[_0x5605('0x72')](_0x34515b,['name',_0x175b06])?_0x175b06:undefined;})[_0x5605('0x73')]()[_0x5605('0x63')]();if(!_[_0x5605('0x74')](_0x261786)){_0x261786[_0x5605('0x75')](function(_0x2b0868){if(_0x2b0868===_0x5605('0x76')){_0x47776c[_0x5605('0x45')](_0x5605('0x77'),[][_0x5605('0x78')](_0x361c9b[_0x5605('0x3c')][_0x2b0868]));}else if(_0x2b0868===_0x5605('0x79')){var _0x5e6667=JSON[_0x5605('0x7a')](_0x361c9b[_0x5605('0x3c')][_0x2b0868])['$gte'];var _0x53373b=JSON[_0x5605('0x7a')](_0x361c9b[_0x5605('0x3c')][_0x2b0868])['$lte'];_0x47776c[_0x5605('0x45')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5e6667,_0x53373b);}else{if(_0x361c9b[_0x5605('0x3c')][_0x2b0868]==='null'){_0x47776c[_0x5605('0x45')]('i.'+_0x2b0868+_0x5605('0x7b'));}else{_0x47776c[_0x5605('0x45')]('i.'+_0x2b0868+'\x20=\x20?',_0x361c9b[_0x5605('0x3c')][_0x2b0868]);}}});}if(_0x361c9b['query'][_0x5605('0x7c')]){if(_0x361c9b['query'][_0x5605('0x7c')]==0x1){_0x47776c['having']('`unreadMessages`\x20=\x200');}else{_0x47776c[_0x5605('0x64')](_0x5605('0x7d'));}}if(_0x361c9b['query']['tag']){_0x2a50b1=_['isArray'](_0x361c9b['query'][_0x5605('0x7e')])?_0x361c9b[_0x5605('0x3c')][_0x5605('0x7e')]:new Array(_0x361c9b['query'][_0x5605('0x7e')]);_0x2a50b1['forEach'](function(_0x309db4){_0x3fd5b1['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x309db4+',%');});}if(_0x361c9b[_0x5605('0x3c')][_0x5605('0x7f')]){var _0x43cbdf=_0x361c9b[_0x5605('0x3c')][_0x5605('0x7f')]['replace']('\x5c','\x5c\x5c')[_0x5605('0x80')](/'/g,'\x27\x27');if(qs[_0x5605('0x81')](_0x43cbdf)){_0x25e2b5['or'](_0x5605('0x82'),_0x43cbdf+'%');}else{_0x25e2b5['or'](_0x5605('0x83'),qs['getFullTextValue'](_0x43cbdf))['or'](_0x5605('0x84'),_0x43cbdf+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x43cbdf+'%');}}}_0x47776c[_0x5605('0x45')](_0x25e2b5);_0x47776c['group'](_0x5605('0x85'));var _0x2ff97b={'type':db[_0x5605('0x86')][_0x5605('0x87')]['SELECT'],'raw':!![]};var _0x5cbbf7=_0x47776c[_0x5605('0x88')]();_0x5cbbf7[_0x5605('0x48')](_0x5605('0x85'));_0x5cbbf7[_0x5605('0x48')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x5605('0x62'));if(_0x3ad6cb['order']){_0x3ad6cb[_0x5605('0x43')][_0x5605('0x75')](function(_0x4847ea){var _0x16bc3c=_0x4847ea[0x0]===_0x5605('0x89')?_0x4847ea[0x0]:'i.'+_0x4847ea[0x0];_0x47776c[_0x5605('0x43')](_0x16bc3c,_0x4847ea[0x1]===_0x5605('0x8a')?![]:!![]);});}if(!_[_0x5605('0x74')](_0x2a50b1)){_0x47776c[_0x5605('0x64')](_0x3fd5b1);_0x5cbbf7[_0x5605('0x45')](_0x5605('0x8b'),_0x2a50b1);}BPromise[_0x5605('0x8c')]()[_0x5605('0x2e')](function(){if(!_0x1bb77e){if(_0x361c9b[_0x5605('0x3c')]['OpenchannelAccountId'])return;_0x5cbbf7[_0x5605('0x45')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x47776c[_0x5605('0x45')](_0x5605('0x8d'));return;}if(_0x361c9b['user'][_0x5605('0x8e')]!=='agent')return;return _0x361c9b[_0x5605('0x8f')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x546096){if(_[_0x5605('0x74')](_0x546096)){_0x5cbbf7[_0x5605('0x45')](_0x5605('0x90'));_0x47776c['where'](_0x5605('0x90'));}else{_0x5cbbf7[_0x5605('0x45')](_0x5605('0x77'),_['map'](_0x546096,'id'));_0x47776c[_0x5605('0x45')](_0x5605('0x77'),_[_0x5605('0x33')](_0x546096,'id'));}});})[_0x5605('0x2e')](function(){if(_0x361c9b[_0x5605('0x8f')][_0x5605('0x8e')]===_0x5605('0x91')&&!_0x1bb77e&&!_0x361c9b[_0x5605('0x3c')][_0x5605('0x76')])return[];return db[_0x5605('0x92')][_0x5605('0x3c')](_0x5cbbf7['toString'](),_0x2ff97b);})[_0x5605('0x2e')](function(_0x2dcbf5){_0x3a8131[_0x5605('0x29')]=_0x2dcbf5['length'];if(_0x3a8131[_0x5605('0x29')]===0x0)return[];return db[_0x5605('0x92')][_0x5605('0x3c')](_0x4b7740['toString'](),_0x2ff97b)[_0x5605('0x2e')](function(_0x3afcb0){_0x51cd3e=_[_0x5605('0x93')](_0x3afcb0,'id');_0x2ff97b=_[_0x5605('0x94')](_0x2ff97b,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x361c9b[_0x5605('0x3c')][_0x5605('0x41')]){_0x3ad6cb['attributes']['forEach'](function(_0x5c11bd){_0x47776c['field']('i.'+_0x5c11bd);});}else{_0x47776c['field'](_0x5605('0x95'),_0x5605('0x62'));_0x47776c[_0x5605('0x48')](_0x5605('0x96'),_0x5605('0x97'));_0x47776c[_0x5605('0x48')](_0x5605('0x98'),_0x5605('0x99'));_0x47776c['field'](_0x5605('0x9a'),_0x5605('0x89'));_0x47776c[_0x5605('0x48')](_0x5605('0x9b'));_0x47776c['field'](_0x5605('0x9c'),'Contact.firstName');_0x47776c[_0x5605('0x48')](_0x5605('0x9d'),'Contact.lastName');_0x47776c[_0x5605('0x48')](_0x5605('0x9e'),_0x5605('0x9f'));_0x47776c[_0x5605('0x48')](_0x5605('0xa0'),'Contact.phone');_0x47776c[_0x5605('0x48')](_0x5605('0xa1'),_0x5605('0xa2'));_0x47776c[_0x5605('0x48')](_0x5605('0xa3'),_0x5605('0xa4'));_0x47776c['field']('o.fullname','Owner.fullname');_0x47776c[_0x5605('0x48')](_0x5605('0xa5'),_0x5605('0xa6'));_0x47776c[_0x5605('0x48')](_0x5605('0xa7'),_0x5605('0x35'));}if(_0x3ad6cb[_0x5605('0x28')])_0x47776c['limit'](_0x3ad6cb['limit']);if(_0x3ad6cb[_0x5605('0x26')])_0x47776c[_0x5605('0x26')](_0x3ad6cb[_0x5605('0x26')]);return db['sequelize']['query'](_0x47776c[_0x5605('0xa8')](),_0x2ff97b);})['then'](function(_0x2b9e24){if(_0x2b9e24[_0x5605('0x5f')]>0x0)_0x9260a0[_0x5605('0x45')](_0x5605('0xa9'),_['map'](_0x2b9e24,'id'));return db[_0x5605('0x92')][_0x5605('0x3c')](_0x9260a0[_0x5605('0xa8')](),_0x2ff97b)['then'](function(_0x1aa788){var _0x29629d=_['groupBy'](_0x1aa788,_0x5605('0xaa'));var _0xf99d5a=[];_0x2b9e24[_0x5605('0x75')](function(_0x4112d8){_0xf99d5a['push'](updateOpenchannelInteraction(_0x4112d8,_0x51cd3e,_0x29629d));});return BPromise[_0x5605('0xab')](_0xf99d5a);});});})[_0x5605('0x2e')](function(_0x155c78){_0x3a8131[_0x5605('0xac')]=_0x155c78;return _0x3a8131;})[_0x5605('0x2e')](respondWithFilteredResult(_0x10814a,_0x3ad6cb))[_0x5605('0xad')](handleError(_0x10814a,null));};exports[_0x5605('0xae')]=function(_0x20d12c,_0x5b0ace){var _0x2fb85c={};if(_0x20d12c[_0x5605('0x3c')]['type']&&_0x20d12c['query'][_0x5605('0x3a')]===_0x5605('0x4a')){_0x2fb85c['from']=_0x20d12c[_0x5605('0xaf')]['id'];}else{_0x2fb85c['id']=_0x20d12c[_0x5605('0xaf')]['id'];}var _0x2353a1={'raw':![],'where':_0x2fb85c},_0x521e17={};_0x521e17[_0x5605('0x3b')]=_[_0x5605('0x3d')](db[_0x5605('0xb0')]['rawAttributes']);_0x521e17[_0x5605('0x3c')]=_[_0x5605('0x3d')](_0x20d12c[_0x5605('0x3c')]);_0x521e17[_0x5605('0x3e')]=_[_0x5605('0x3f')](_0x521e17[_0x5605('0x3b')],_0x521e17['query']);_0x2353a1['attributes']=_[_0x5605('0x3f')](_0x521e17['model'],qs[_0x5605('0x41')](_0x20d12c[_0x5605('0x3c')][_0x5605('0x41')]));_0x2353a1[_0x5605('0x40')]=_0x2353a1[_0x5605('0x40')][_0x5605('0x5f')]?_0x2353a1[_0x5605('0x40')]:_0x521e17[_0x5605('0x3b')];if(_0x20d12c[_0x5605('0x3c')][_0x5605('0xb1')]){_0x2353a1['include']=[{'all':!![]}];}_0x2353a1=_[_0x5605('0x94')]({},_0x2353a1,_0x20d12c[_0x5605('0xb2')]);return db[_0x5605('0xb0')][_0x5605('0x61')](_0x2353a1)[_0x5605('0x2e')](handleEntityNotFound(_0x5b0ace,null))[_0x5605('0x2e')](respondWithResult(_0x5b0ace,null))[_0x5605('0xad')](handleError(_0x5b0ace,null));};exports['create']=function(_0x55f8ec,_0x541de7){return db['OpenchannelInteraction'][_0x5605('0xb3')](_0x55f8ec['body'],{})['then'](respondWithResult(_0x541de7,0xc9))[_0x5605('0xad')](handleError(_0x541de7,null));};exports[_0x5605('0x2d')]=function(_0x2381a8,_0x598e52){if(_0x2381a8['body']['id']){delete _0x2381a8[_0x5605('0xb4')]['id'];}return db[_0x5605('0xb0')][_0x5605('0x61')]({'where':{'id':_0x2381a8[_0x5605('0xaf')]['id']}})[_0x5605('0x2e')](handleEntityNotFound(_0x598e52,null))[_0x5605('0x2e')](saveUpdates(_0x2381a8[_0x5605('0xb4')],null))[_0x5605('0x2e')](respondWithResult(_0x598e52,null))['catch'](handleError(_0x598e52,null));};exports['destroy']=function(_0x34991d,_0x548e71){return db['OpenchannelInteraction'][_0x5605('0x61')]({'where':{'id':_0x34991d[_0x5605('0xaf')]['id']}})[_0x5605('0x2e')](handleEntityNotFound(_0x548e71,null))[_0x5605('0x2e')](removeEntity(_0x548e71,null))['catch'](handleError(_0x548e71,null));};exports['describe']=function(_0x57eb53,_0x1a5f99){return db[_0x5605('0xb0')][_0x5605('0xb5')]()[_0x5605('0x2e')](respondWithResult(_0x1a5f99,null))[_0x5605('0xad')](handleError(_0x1a5f99,null));};exports[_0x5605('0xb6')]=function(_0x2e747e,_0x32dcaf,_0x1ff999){return db[_0x5605('0xb7')][_0x5605('0x61')]({'where':{'id':_0x2e747e['params']['id']}})[_0x5605('0x2e')](handleEntityNotFound(_0x32dcaf,null))[_0x5605('0x2e')](function(_0x246cd9){if(_0x246cd9){return _0x246cd9[_0x5605('0xb6')](_0x2e747e[_0x5605('0xb4')][_0x5605('0xb8')],_[_0x5605('0xb9')](_0x2e747e['body'],[_0x5605('0xb8'),'id'])||{});}})[_0x5605('0x2e')](respondWithResult(_0x32dcaf,null))[_0x5605('0xad')](handleError(_0x32dcaf,null));};exports['getMessages']=function(_0x4bb0d3,_0x11a381,_0x851d73){var _0x9c76a9={'raw':![],'where':{}};var _0x36fbb6={};var _0x498f70={'count':0x0,'rows':[]};return db[_0x5605('0xb0')]['findOne']({'where':{'id':_0x4bb0d3['params']['id']}})[_0x5605('0x2e')](handleEntityNotFound(_0x11a381,null))[_0x5605('0x2e')](function(_0x5c8cab){if(_0x5c8cab){_0x36fbb6[_0x5605('0x3b')]=_[_0x5605('0x3d')](db[_0x5605('0xb7')][_0x5605('0x38')]);_0x36fbb6[_0x5605('0x3c')]=_[_0x5605('0x3d')](_0x4bb0d3[_0x5605('0x3c')]);_0x36fbb6['filters']=_['intersection'](_0x36fbb6['model'],_0x36fbb6[_0x5605('0x3c')]);_0x9c76a9[_0x5605('0x40')]=_[_0x5605('0x3f')](_0x36fbb6[_0x5605('0x3b')],qs[_0x5605('0x41')](_0x4bb0d3[_0x5605('0x3c')][_0x5605('0x41')]));_0x9c76a9[_0x5605('0x40')]=_0x9c76a9[_0x5605('0x40')]['length']?_0x9c76a9[_0x5605('0x40')]:_0x36fbb6[_0x5605('0x3b')];if(!_0x4bb0d3[_0x5605('0x3c')][_0x5605('0xba')]('nolimit')){_0x9c76a9[_0x5605('0x28')]=qs[_0x5605('0x28')](_0x4bb0d3['query']['limit']);_0x9c76a9[_0x5605('0x26')]=qs[_0x5605('0x26')](_0x4bb0d3['query']['offset']);}_0x9c76a9[_0x5605('0x43')]=qs['sort'](_0x4bb0d3[_0x5605('0x3c')][_0x5605('0x44')]);_0x9c76a9[_0x5605('0x45')]=qs[_0x5605('0x3e')](_[_0x5605('0x46')](_0x4bb0d3[_0x5605('0x3c')],_0x36fbb6['filters']));_0x9c76a9['where'][_0x5605('0xaa')]=_0x5c8cab['id'];if(_0x4bb0d3[_0x5605('0x3c')]['filter']){_0x9c76a9[_0x5605('0x45')]=_[_0x5605('0x94')](_0x9c76a9['where'],{'$or':_[_0x5605('0x33')](_0x9c76a9['attributes'],function(_0x4fa7cc){var _0x38447e={};_0x38447e[_0x4fa7cc]={'$like':'%'+_0x4bb0d3[_0x5605('0x3c')]['filter']+'%'};return _0x38447e;})});}if(_0x4bb0d3[_0x5605('0x3c')]['$gte']){var _0x41247a=_0x4bb0d3[_0x5605('0x3c')][_0x5605('0xbb')]['split'](',');var _0x24a281={};_0x24a281[_0x41247a[0x0]]={'$gte':moment(_0x41247a[0x1])['format'](_0x5605('0xbc'))};_0x9c76a9[_0x5605('0x45')]=_['merge'](_0x9c76a9[_0x5605('0x45')],_0x24a281);}_0x9c76a9=_[_0x5605('0x94')]({},_0x9c76a9,_0x4bb0d3['options']);return db[_0x5605('0xb7')][_0x5605('0x29')]({'where':_0x9c76a9['where']})[_0x5605('0x2e')](function(_0x39bcfc){_0x498f70[_0x5605('0x29')]=_0x39bcfc;if(_0x4bb0d3[_0x5605('0x3c')][_0x5605('0xb1')]){_0x9c76a9[_0x5605('0xbd')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x5605('0xbe')](_0x9c76a9);})[_0x5605('0x2e')](function(_0x127e24){_0x498f70['rows']=_0x127e24;return _0x498f70;});}})[_0x5605('0x2e')](respondWithFilteredResult(_0x11a381,_0x9c76a9))[_0x5605('0xad')](handleError(_0x11a381,null));};exports['addTags']=function(_0x2b1563,_0x45990d,_0xf6bc04){return db[_0x5605('0xb0')][_0x5605('0x61')]({'where':{'id':_0x2b1563['params']['id']}})[_0x5605('0x2e')](handleEntityNotFound(_0x45990d,null))[_0x5605('0x2e')](function(_0x56d766){if(_0x56d766){return _0x56d766[_0x5605('0xbf')](_0x2b1563[_0x5605('0xb4')][_0x5605('0xb8')],_[_0x5605('0xb9')](_0x2b1563[_0x5605('0xb4')],['ids','id'])||{})[_0x5605('0xc0')](function(){return db[_0x5605('0x6e')][_0x5605('0xbe')]({'attributes':['id',_0x5605('0x31'),'color'],'where':{'id':_0x2b1563[_0x5605('0xb4')][_0x5605('0xb8')]}});})[_0x5605('0x2e')](function(_0x3941e5){socket['emit'](_0x5605('0xc1'),{'id':Number(_0x2b1563[_0x5605('0xaf')]['id']),'tags':_0x3941e5||[]});return{'id':Number(_0x2b1563[_0x5605('0xaf')]['id']),'tags':_0x3941e5||[]};});}})[_0x5605('0x2e')](respondWithResult(_0x45990d,null))[_0x5605('0xad')](handleError(_0x45990d,null));};exports[_0x5605('0xc2')]=function(_0x27d707,_0x1799ab,_0x20effc){return db[_0x5605('0xb0')][_0x5605('0x61')]({'where':{'id':_0x27d707['params']['id']}})[_0x5605('0x2e')](handleEntityNotFound(_0x1799ab,null))['then'](function(_0x5aeed1){if(_0x5aeed1){return _0x5aeed1[_0x5605('0xc2')](_0x27d707[_0x5605('0x3c')][_0x5605('0xb8')]);}})['then'](respondWithStatusCode(_0x1799ab,null))['catch'](handleError(_0x1799ab,null));};exports[_0x5605('0xc3')]=function(_0x167461,_0x49d7d8){var _0x226a81=moment()[_0x5605('0xc4')]()[_0x5605('0xa8')]();var _0x1f418d=path[_0x5605('0xc5')](config[_0x5605('0xc6')],'server',_0x5605('0xc7'),_0x5605('0xc8'));var _0x22f4a6=path['join'](config[_0x5605('0xc6')],_0x5605('0xc9'),'files','attachments');var _0x5a60f5=path[_0x5605('0xc5')](_0x1f418d,_0x226a81);var _0x370c9d=util[_0x5605('0xca')](_0x5605('0xcb'),_0x167461[_0x5605('0xaf')]['id'],_0x226a81);var _0x5787ab=path['join'](_0x1f418d,_0x370c9d);var _0x35fac4=[];_0x35fac4[_0x5605('0xcc')]({'model':db[_0x5605('0xcd')],'as':_0x5605('0xcd'),'attributes':['id','fullname'],'raw':!![]});_0x35fac4[_0x5605('0xcc')]({'model':db[_0x5605('0xce')],'as':_0x5605('0x66'),'attributes':['id','firstName',_0x5605('0xcf')],'raw':!![]});if(_0x167461[_0x5605('0x3c')]['attachments']){_0x35fac4[_0x5605('0xcc')]({'model':db[_0x5605('0xd0')],'as':_0x5605('0xd0'),'raw':!![]});}var _0x438bdb=[{'model':db['OpenchannelMessage'],'as':'Messages','attributes':['id','body',_0x5605('0x79'),_0x5605('0xd1'),_0x5605('0xd2'),'read'],'include':_0x35fac4}];_0x438bdb['push']({'model':db[_0x5605('0xd3')],'as':_0x5605('0xd4'),'attributes':['id',_0x5605('0x31')]});_0x438bdb['push']({'model':db['User'],'as':_0x5605('0xd5'),'attributes':['id',_0x5605('0x34')]});return db[_0x5605('0xb0')][_0x5605('0x61')]({'where':{'id':_0x167461['params']['id']},'include':_0x438bdb})[_0x5605('0x2e')](handleEntityNotFound(_0x49d7d8,null))[_0x5605('0x2e')](function(_0x284515){if(_0x284515){var _0x4a47b5=_0x284515[_0x5605('0xd6')]({'plain':!![]});fs[_0x5605('0xd7')](_0x5a60f5);var _0x33f58c={'channel':_0x5605('0xd8'),'account':_0x4a47b5['Account']['name'],'agent':_0x4a47b5[_0x5605('0xd5')]?_0x4a47b5[_0x5605('0xd5')][_0x5605('0x34')]:'N.A.','createdAt':moment(_0x4a47b5[_0x5605('0x79')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x5605('0xa8')](),'closedAt':_0x4a47b5[_0x5605('0xd9')]?moment(_0x4a47b5[_0x5605('0xda')])['format'](_0x5605('0xbc'))[_0x5605('0xa8')]():'','disposition':_0x4a47b5[_0x5605('0xdb')],'visibility':_0x4a47b5['threadId']?'Public':_0x5605('0xdc'),'messages':_(_0x4a47b5[_0x5605('0xdd')])['filter']({'secret':![]})[_0x5605('0x33')](function(_0x4c77a6){if(_0x4c77a6[_0x5605('0xd0')]){var _0x4874e0=path[_0x5605('0xc5')](_0x22f4a6,_0x4c77a6[_0x5605('0xd0')]['basename']);if(fs['existsSync'](_0x4874e0)){fs['createReadStream'](_0x4874e0)['pipe'](fs[_0x5605('0xde')](path[_0x5605('0xc5')](_0x5a60f5,_0x4c77a6[_0x5605('0xd0')][_0x5605('0xdf')])));}}return{'date':moment(_0x4c77a6['createdAt'])['format'](_0x5605('0xbc'))['toString'](),'sender':_0x4c77a6[_0x5605('0xd1')]===_0x5605('0xe0')?_0x4c77a6[_0x5605('0xcd')]?_0x4c77a6[_0x5605('0xcd')]['fullname']:_0x5605('0xe1'):_0x4c77a6[_0x5605('0x66')][_0x5605('0xe2')]+(_0x4c77a6['Contact'][_0x5605('0xcf')]?'\x20'+_0x4c77a6[_0x5605('0x66')][_0x5605('0xcf')]:''),'body':_0x4c77a6[_0x5605('0xd0')]?_0x4c77a6[_0x5605('0xd0')][_0x5605('0xdf')]:_0x4c77a6['body'],'direction':_0x4c77a6[_0x5605('0xd1')]===_0x5605('0xe0')?'A':'C','secret':_0x4c77a6[_0x5605('0xd2')],'read':_0x4c77a6[_0x5605('0x7c')],'attachment':_0x4c77a6[_0x5605('0xd0')]};})[_0x5605('0x63')]()};return ejs['renderFile'](path[_0x5605('0xc5')](config['root'],'server',_0x5605('0xe3'),_0x5605('0xe4')),{'interaction':_0x33f58c})[_0x5605('0x2e')](function(_0x5251f5){var _0x5ba696=path[_0x5605('0xc5')](_0x5a60f5,_0x5605('0xe5')+_0x4a47b5['id']+'-'+_0x226a81+_0x5605('0xe6'));var _0x12afee={'path':_0x5ba696,'channel':_0x5605('0xd8'),'interactionId':_0x4a47b5['id']};return pdf['createPdfFromHTML'](_0x5251f5,_0x12afee);})[_0x5605('0x2e')](function(){return new BPromise(function(_0x16ed7c,_0x36c404){zipdir(_0x5a60f5,{'saveTo':_0x5787ab},function(_0x392659,_0xa75060){if(_0x392659)return _0x36c404(_0x392659);return _0x16ed7c(_0xa75060);});})['then'](function(){return new BPromise(function(_0x405803,_0x205714){rimraf(_0x5a60f5,function(_0x20940c){if(_0x20940c)_0x205714(_0x20940c);return _0x405803();});});})[_0x5605('0x2e')](function(){return _0x49d7d8[_0x5605('0xc3')](_0x5787ab,_0x370c9d,function(_0x194f83){if(_0x194f83){console[_0x5605('0xe7')](_0x5605('0xe8'),_0x194f83);}else{fs[_0x5605('0xe9')](_0x5787ab);}});});});}else{return _0x49d7d8[_0x5605('0x23')](0xc8);}})[_0x5605('0xad')](handleError(_0x49d7d8,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 1d8685c..ddee2aa 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 _0x3ee5=['exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','remove','then','Users','map','findAll','setDataValue','length','emit','hasOwnProperty','hook'];(function(_0x180aa7,_0x53b10b){var _0x3e5ec2=function(_0x8ac484){while(--_0x8ac484){_0x180aa7['push'](_0x180aa7['shift']());}};_0x3e5ec2(++_0x53b10b);}(_0x3ee5,0x1d5));var _0x53ee=function(_0x18d4b3,_0x2b60bc){_0x18d4b3=_0x18d4b3-0x0;var _0xf44d6a=_0x3ee5[_0x18d4b3];return _0xf44d6a;};'use strict';var EventEmitter=require(_0x53ee('0x0'));var OpenchannelInteraction=require(_0x53ee('0x1'))['db'][_0x53ee('0x2')];var OpenchannelMessage=require(_0x53ee('0x1'))['db'][_0x53ee('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x53ee('0x4')](0x0);var events={'afterCreate':_0x53ee('0x5'),'afterUpdate':_0x53ee('0x6'),'afterDestroy':_0x53ee('0x7')};function emitEvent(_0x2b4dae){return function(_0x530ffb,_0x3dba1f,_0x49c54e){_0x530ffb['getUsers']({'attributes':['id'],'raw':!![]})[_0x53ee('0x8')](function(_0x53342){_0x530ffb['setDataValue'](_0x53ee('0x9'),_0x53342[_0x53ee('0xa')](function(_0x521351){return{'id':_0x521351['id']};}));return OpenchannelMessage[_0x53ee('0xb')]({'where':{'OpenchannelInteractionId':_0x530ffb['id'],'direction':'in','read':![]},'raw':!![]});})[_0x53ee('0x8')](function(_0x88b95a){_0x530ffb[_0x53ee('0xc')]('unreadMessages',_0x88b95a[_0x53ee('0xd')]);OpenchannelInteractionEvents[_0x53ee('0xe')](_0x2b4dae+':'+_0x530ffb['id'],_0x530ffb);OpenchannelInteractionEvents['emit'](_0x2b4dae,_0x530ffb);_0x49c54e(null);})['catch'](_0x49c54e(null));};}for(var e in events){if(events[_0x53ee('0xf')](e)){var event=events[e];OpenchannelInteraction[_0x53ee('0x10')](e,emitEvent(event));}}module[_0x53ee('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x2d7d=['events','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','Users','findAll','unreadMessages','length','emit','catch'];(function(_0x40fafe,_0x378b8a){var _0x522c15=function(_0x4a566f){while(--_0x4a566f){_0x40fafe['push'](_0x40fafe['shift']());}};_0x522c15(++_0x378b8a);}(_0x2d7d,0xa5));var _0xd2d7=function(_0x5d0fda,_0x1c6026){_0x5d0fda=_0x5d0fda-0x0;var _0x57a922=_0x2d7d[_0x5d0fda];return _0x57a922;};'use strict';var EventEmitter=require(_0xd2d7('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0xd2d7('0x1')];var OpenchannelMessage=require('../../mysqldb')['db'][_0xd2d7('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xd2d7('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd2d7('0x4'),'afterDestroy':_0xd2d7('0x5')};function emitEvent(_0x293c37){return function(_0x503682,_0xf650ce,_0x1dde92){_0x503682[_0xd2d7('0x6')]({'attributes':['id'],'raw':!![]})[_0xd2d7('0x7')](function(_0x496d7b){_0x503682[_0xd2d7('0x8')](_0xd2d7('0x9'),_0x496d7b['map'](function(_0x4655cb){return{'id':_0x4655cb['id']};}));return OpenchannelMessage[_0xd2d7('0xa')]({'where':{'OpenchannelInteractionId':_0x503682['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd2d7('0x7')](function(_0x2d719e){_0x503682[_0xd2d7('0x8')](_0xd2d7('0xb'),_0x2d719e[_0xd2d7('0xc')]);OpenchannelInteractionEvents[_0xd2d7('0xd')](_0x293c37+':'+_0x503682['id'],_0x503682);OpenchannelInteractionEvents[_0xd2d7('0xd')](_0x293c37,_0x503682);_0x1dde92(null);})[_0xd2d7('0xe')](_0x1dde92(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index ba1f70e..19db1ef 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 _0x3187=['request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','OpenchannelInteraction','utf8mb4_unicode_ci','changed','closed','closedAt','format','lodash','util','api','moment','bluebird'];(function(_0x62acd5,_0x4ddb49){var _0x227ab4=function(_0x24fb97){while(--_0x24fb97){_0x62acd5['push'](_0x62acd5['shift']());}};_0x227ab4(++_0x4ddb49);}(_0x3187,0xfa));var _0x7318=function(_0x3cab4b,_0x287d42){_0x3cab4b=_0x3cab4b-0x0;var _0x3d5ab2=_0x3187[_0x3cab4b];return _0x3d5ab2;};'use strict';var _=require(_0x7318('0x0'));var util=require(_0x7318('0x1'));var logger=require('../../config/logger')(_0x7318('0x2'));var moment=require(_0x7318('0x3'));var BPromise=require(_0x7318('0x4'));var rp=require(_0x7318('0x5'));var fs=require('fs');var path=require(_0x7318('0x6'));var rimraf=require(_0x7318('0x7'));var config=require(_0x7318('0x8'));var attributes=require(_0x7318('0x9'));module[_0x7318('0xa')]=function(_0x343ef1,_0x19a7e1){return _0x343ef1['define'](_0x7318('0xb'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x7318('0xc'),'hooks':{'beforeUpdate':function(_0x30ded7,_0x3cc12b,_0x119d1d){if(_0x30ded7[_0x7318('0xd')](_0x7318('0xe'))){_0x30ded7[_0x7318('0xf')]=moment()[_0x7318('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x119d1d(null,_0x30ded7);}}});}; \ No newline at end of file +var _0xd51a=['openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','define','OpenchannelInteraction'];(function(_0x33b34e,_0x5f2983){var _0x205ba2=function(_0x538981){while(--_0x538981){_0x33b34e['push'](_0x33b34e['shift']());}};_0x205ba2(++_0x5f2983);}(_0xd51a,0x1c1));var _0xad51=function(_0x2b7ca6,_0x3232ff){_0x2b7ca6=_0x2b7ca6-0x0;var _0x1bc3b1=_0xd51a[_0x2b7ca6];return _0x1bc3b1;};'use strict';var _=require(_0xad51('0x0'));var util=require(_0xad51('0x1'));var logger=require(_0xad51('0x2'))(_0xad51('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xad51('0x4'));var fs=require('fs');var path=require(_0xad51('0x5'));var rimraf=require(_0xad51('0x6'));var config=require(_0xad51('0x7'));var attributes=require('./openchannelInteraction.attributes');module['exports']=function(_0x3fbb0a,_0x29637e){return _0x3fbb0a[_0xad51('0x8')](_0xad51('0x9'),attributes,{'tableName':_0xad51('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xad51('0xb'),'collate':_0xad51('0xc'),'hooks':{'beforeUpdate':function(_0x2c26a7,_0x1fb109,_0x17b256){if(_0x2c26a7[_0xad51('0xd')](_0xad51('0xe'))){_0x2c26a7[_0xad51('0xf')]=moment()['format'](_0xad51('0x10'));}_0x17b256(null,_0x2c26a7);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 76ec7e8..93e0e72 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 _0x650f=['omit','spread','AddTags','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','OpenchannelInteraction','update','body','options','limit','UpdateOpenchannelInteraction','find','where','ids'];(function(_0x2c9350,_0x4c7283){var _0x788d84=function(_0x140e63){while(--_0x140e63){_0x2c9350['push'](_0x2c9350['shift']());}};_0x788d84(++_0x4c7283);}(_0x650f,0x7c));var _0xf650=function(_0x54b648,_0x5648f0){_0x54b648=_0x54b648-0x0;var _0x4f7c5b=_0x650f[_0x54b648];return _0x4f7c5b;};'use strict';var _=require('lodash');var util=require(_0xf650('0x0'));var moment=require(_0xf650('0x1'));var BPromise=require(_0xf650('0x2'));var rs=require(_0xf650('0x3'));var fs=require('fs');var Redis=require(_0xf650('0x4'));var db=require(_0xf650('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf650('0x6'))(_0xf650('0x7'));var config=require(_0xf650('0x8'));var jayson=require(_0xf650('0x9'));var client=jayson[_0xf650('0xa')][_0xf650('0xb')]({'port':0x232a});config[_0xf650('0xc')]=_['defaults'](config['redis'],{'host':_0xf650('0xd'),'port':0x18eb});var socket=require(_0xf650('0xe'))(new Redis(config[_0xf650('0xc')]));require('./openchannelInteraction.socket')[_0xf650('0xf')](socket);function respondWithRpcPromise(_0x5b4746,_0x2f8452,_0x1c53ce){return new BPromise(function(_0x3f9631,_0xc19d6){return client['request'](_0x5b4746,_0x1c53ce)[_0xf650('0x10')](function(_0x504ed5){logger[_0xf650('0x11')](_0xf650('0x12'),_0x2f8452,_0xf650('0x13'));logger[_0xf650('0x14')](_0xf650('0x15'),_0x2f8452,_0xf650('0x13'),JSON[_0xf650('0x16')](_0x504ed5));if(_0x504ed5[_0xf650('0x17')]){if(_0x504ed5['error'][_0xf650('0x18')]===0x1f4){logger[_0xf650('0x17')](_0xf650('0x12'),_0x2f8452,_0x504ed5['error'][_0xf650('0x19')]);return _0xc19d6(_0x504ed5[_0xf650('0x17')]['message']);}logger['error'](_0xf650('0x12'),_0x2f8452,_0x504ed5[_0xf650('0x17')][_0xf650('0x19')]);return _0x3f9631(_0x504ed5[_0xf650('0x17')][_0xf650('0x19')]);}else{logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x2f8452,_0xf650('0x13'));_0x3f9631(_0x504ed5[_0xf650('0x1a')][_0xf650('0x19')]);}})['catch'](function(_0x31b1f3){logger[_0xf650('0x17')](_0xf650('0x12'),_0x2f8452,_0x31b1f3);_0xc19d6(_0x31b1f3);});});}exports['UpdateOpenchannelInteraction']=function(_0x5eba2a){var _0x45da98=this;return new Promise(function(_0x4794ca,_0x4840c6){return db[_0xf650('0x1b')][_0xf650('0x1c')](_0x5eba2a[_0xf650('0x1d')],{'raw':_0x5eba2a[_0xf650('0x1e')]?_0x5eba2a['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5eba2a[_0xf650('0x1e')]?_0x5eba2a['options']['where']||null:null,'attributes':_0x5eba2a[_0xf650('0x1e')]?_0x5eba2a['options']['attributes']||null:null,'limit':_0x5eba2a['options']?_0x5eba2a['options'][_0xf650('0x1f')]||null:null})[_0xf650('0x10')](function(_0x20ad39){logger['info'](_0xf650('0x20'),_0x5eba2a);logger['debug'](_0xf650('0x20'),_0x5eba2a,JSON[_0xf650('0x16')](_0x20ad39));_0x4794ca(_0x20ad39);})['catch'](function(_0x34760b){logger[_0xf650('0x17')](_0xf650('0x20'),_0x34760b[_0xf650('0x19')],_0x5eba2a);_0x4840c6(_0x45da98[_0xf650('0x17')](0x1f4,_0x34760b[_0xf650('0x19')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x400fdb){return new Promise(function(_0x1e3c37,_0x11d734){return db[_0xf650('0x1b')][_0xf650('0x21')]({'where':_0x400fdb[_0xf650('0x1e')]?_0x400fdb['options'][_0xf650('0x22')]||null:null})[_0xf650('0x10')](function(_0x4933f1){if(_0x4933f1){return _0x4933f1['addTags'](_0x400fdb[_0xf650('0x1d')][_0xf650('0x23')],_[_0xf650('0x24')](_0x400fdb[_0xf650('0x1d')],['ids','id'])||{});}})[_0xf650('0x25')](function(_0x2b5d7a){logger[_0xf650('0x11')](_0xf650('0x26'),_0x400fdb);logger['debug'](_0xf650('0x26'),_0x400fdb,JSON[_0xf650('0x16')](_0x2b5d7a));_0x1e3c37(_0x2b5d7a);})[_0xf650('0x27')](function(_0x4b691a){logger[_0xf650('0x17')](_0xf650('0x26'),_0x4b691a['message'],_0x400fdb);_0x11d734(_this[_0xf650('0x17')](0x1f4,_0x4b691a['message']));});});}; \ No newline at end of file +var _0xfc30=['lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateOpenchannelInteraction','OpenchannelInteraction','update','options','raw','where','attributes','find','then','addTags','body','ids','spread','AddTags'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfc30,0x118));var _0x0fc3=function(_0x39edc2,_0x15dbd7){_0x39edc2=_0x39edc2-0x0;var _0x201c43=_0xfc30[_0x39edc2];return _0x201c43;};'use strict';var _=require(_0x0fc3('0x0'));var util=require('util');var moment=require(_0x0fc3('0x1'));var BPromise=require(_0x0fc3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0fc3('0x3'));var db=require(_0x0fc3('0x4'))['db'];var utils=require(_0x0fc3('0x5'));var logger=require(_0x0fc3('0x6'))(_0x0fc3('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0fc3('0x8')][_0x0fc3('0x9')]({'port':0x232a});config[_0x0fc3('0xa')]=_['defaults'](config[_0x0fc3('0xa')],{'host':_0x0fc3('0xb'),'port':0x18eb});var socket=require(_0x0fc3('0xc'))(new Redis(config[_0x0fc3('0xa')]));require(_0x0fc3('0xd'))[_0x0fc3('0xe')](socket);function respondWithRpcPromise(_0x353eb2,_0x43e8e8,_0x2986d2){return new BPromise(function(_0x1c4ad4,_0x4990bf){return client[_0x0fc3('0xf')](_0x353eb2,_0x2986d2)['then'](function(_0xffcc24){logger[_0x0fc3('0x10')](_0x0fc3('0x11'),_0x43e8e8,_0x0fc3('0x12'));logger[_0x0fc3('0x13')](_0x0fc3('0x14'),_0x43e8e8,_0x0fc3('0x12'),JSON[_0x0fc3('0x15')](_0xffcc24));if(_0xffcc24[_0x0fc3('0x16')]){if(_0xffcc24[_0x0fc3('0x16')][_0x0fc3('0x17')]===0x1f4){logger[_0x0fc3('0x16')](_0x0fc3('0x11'),_0x43e8e8,_0xffcc24[_0x0fc3('0x16')][_0x0fc3('0x18')]);return _0x4990bf(_0xffcc24[_0x0fc3('0x16')][_0x0fc3('0x18')]);}logger[_0x0fc3('0x16')](_0x0fc3('0x11'),_0x43e8e8,_0xffcc24['error'][_0x0fc3('0x18')]);return _0x1c4ad4(_0xffcc24[_0x0fc3('0x16')][_0x0fc3('0x18')]);}else{logger[_0x0fc3('0x10')](_0x0fc3('0x11'),_0x43e8e8,'request\x20sent');_0x1c4ad4(_0xffcc24[_0x0fc3('0x19')][_0x0fc3('0x18')]);}})['catch'](function(_0x22498d){logger[_0x0fc3('0x16')]('OpenchannelInteraction,\x20%s,\x20%s',_0x43e8e8,_0x22498d);_0x4990bf(_0x22498d);});});}exports[_0x0fc3('0x1a')]=function(_0x5bf6ff){var _0x385db5=this;return new Promise(function(_0x1931df,_0x3419fb){return db[_0x0fc3('0x1b')][_0x0fc3('0x1c')](_0x5bf6ff['body'],{'raw':_0x5bf6ff[_0x0fc3('0x1d')]?_0x5bf6ff[_0x0fc3('0x1d')][_0x0fc3('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5bf6ff[_0x0fc3('0x1d')]?_0x5bf6ff[_0x0fc3('0x1d')][_0x0fc3('0x1f')]||null:null,'attributes':_0x5bf6ff['options']?_0x5bf6ff['options'][_0x0fc3('0x20')]||null:null,'limit':_0x5bf6ff[_0x0fc3('0x1d')]?_0x5bf6ff['options']['limit']||null:null})['then'](function(_0x9faed9){logger['info'](_0x0fc3('0x1a'),_0x5bf6ff);logger[_0x0fc3('0x13')](_0x0fc3('0x1a'),_0x5bf6ff,JSON['stringify'](_0x9faed9));_0x1931df(_0x9faed9);})['catch'](function(_0x202eaf){logger[_0x0fc3('0x16')](_0x0fc3('0x1a'),_0x202eaf[_0x0fc3('0x18')],_0x5bf6ff);_0x3419fb(_0x385db5[_0x0fc3('0x16')](0x1f4,_0x202eaf[_0x0fc3('0x18')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x2cea5d){return new Promise(function(_0x171425,_0x526b55){return db[_0x0fc3('0x1b')][_0x0fc3('0x21')]({'where':_0x2cea5d[_0x0fc3('0x1d')]?_0x2cea5d[_0x0fc3('0x1d')][_0x0fc3('0x1f')]||null:null})[_0x0fc3('0x22')](function(_0x223b86){if(_0x223b86){return _0x223b86[_0x0fc3('0x23')](_0x2cea5d[_0x0fc3('0x24')][_0x0fc3('0x25')],_['omit'](_0x2cea5d[_0x0fc3('0x24')],['ids','id'])||{});}})[_0x0fc3('0x26')](function(_0xb90c5a){logger['info'](_0x0fc3('0x27'),_0x2cea5d);logger['debug'](_0x0fc3('0x27'),_0x2cea5d,JSON['stringify'](_0xb90c5a));_0x171425(_0xb90c5a);})['catch'](function(_0x1e951b){logger[_0x0fc3('0x16')](_0x0fc3('0x27'),_0x1e951b[_0x0fc3('0x18')],_0x2cea5d);_0x526b55(_this[_0x0fc3('0x16')](0x1f4,_0x1e951b['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 27e34ab..e1e9699 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 _0xdba1=['save','remove','emit','removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0xdba1,0xe7));var _0x1dba=function(_0x345388,_0x5eb8d4){_0x345388=_0x345388-0x0;var _0x193bf6=_0xdba1[_0x345388];return _0x193bf6;};'use strict';var OpenchannelInteractionEvents=require(_0x1dba('0x0'));var events=[_0x1dba('0x1'),_0x1dba('0x2'),'update'];function createListener(_0x4c468c,_0x2f8a26){return function(_0x55f6bc){_0x2f8a26[_0x1dba('0x3')](_0x4c468c,_0x55f6bc);};}function removeListener(_0x317fd3,_0x7550cd){return function(){OpenchannelInteractionEvents[_0x1dba('0x4')](_0x317fd3,_0x7550cd);};}exports[_0x1dba('0x5')]=function(_0x154c82){for(var _0x3a9a6e=0x0,_0x4a87c4=events[_0x1dba('0x6')];_0x3a9a6e<_0x4a87c4;_0x3a9a6e++){var _0x1acf59=events[_0x3a9a6e];var _0xe24136=createListener(_0x1dba('0x7')+_0x1acf59,_0x154c82);OpenchannelInteractionEvents['on'](_0x1acf59,_0xe24136);}}; \ No newline at end of file +var _0xd15c=['./openchannelInteraction.events','save','remove','update','emit','register','length','openchannelInteraction:'];(function(_0x44a4e9,_0x33ebcb){var _0x3a974b=function(_0x44a1eb){while(--_0x44a1eb){_0x44a4e9['push'](_0x44a4e9['shift']());}};_0x3a974b(++_0x33ebcb);}(_0xd15c,0xf0));var _0xcd15=function(_0x1f62ea,_0x3bc6a0){_0x1f62ea=_0x1f62ea-0x0;var _0x4b11fa=_0xd15c[_0x1f62ea];return _0x4b11fa;};'use strict';var OpenchannelInteractionEvents=require(_0xcd15('0x0'));var events=[_0xcd15('0x1'),_0xcd15('0x2'),_0xcd15('0x3')];function createListener(_0xe0c224,_0x5284ea){return function(_0x343e0f){_0x5284ea[_0xcd15('0x4')](_0xe0c224,_0x343e0f);};}function removeListener(_0x476dd0,_0x4daa4c){return function(){OpenchannelInteractionEvents['removeListener'](_0x476dd0,_0x4daa4c);};}exports[_0xcd15('0x5')]=function(_0x2ef86e){for(var _0x82d529=0x0,_0x179624=events[_0xcd15('0x6')];_0x82d529<_0x179624;_0x82d529++){var _0x1778e5=events[_0x82d529];var _0x294fa4=createListener(_0xcd15('0x7')+_0x1778e5,_0x2ef86e);OpenchannelInteractionEvents['on'](_0x1778e5,_0x294fa4);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 881f348..ffeb37a 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(_0x5093fa,_0x2ce8e9){var _0x250fe3=function(_0x5a5978){while(--_0x5a5978){_0x5093fa['push'](_0x5093fa['shift']());}};_0x250fe3(++_0x2ce8e9);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./openchannelMessage.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),interaction[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x0d8b('0x10')),controller['create']);router[_0x0d8b('0x11')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x11')](_0x0d8b('0x13'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x14')]);router[_0x0d8b('0x11')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x16')]);router[_0x0d8b('0x17')](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x18')]);module['exports']=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util'];(function(_0x2b6e2e,_0x146ac4){var _0x53b86a=function(_0x4520e5){while(--_0x4520e5){_0x2b6e2e['push'](_0x2b6e2e['shift']());}};_0x53b86a(++_0x146ac4);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./openchannelMessage.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),interaction[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x0d8b('0x10')),controller['create']);router[_0x0d8b('0x11')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x11')](_0x0d8b('0x13'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x14')]);router[_0x0d8b('0x11')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x16')]);router[_0x0d8b('0x17')](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index d018bd5..ea24d9f 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 _0x152f=['BOOLEAN','ENUM','out','DATE','sequelize','exports','TEXT','medium'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x152f,0x144));var _0xf152=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0x152f[_0x3899d1];return _0xeb4a7d;};'use strict';var Sequelize=require(_0xf152('0x0'));module[_0xf152('0x1')]={'body':{'type':Sequelize[_0xf152('0x2')](_0xf152('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xf152('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xf152('0x5')]('in',_0xf152('0x6')),'defaultValue':_0xf152('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0xf152('0x7')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xf152('0x2')]}}; \ No newline at end of file +var _0xdca3=['ENUM','out','DATE','STRING','sequelize','TEXT','medium','BOOLEAN'];(function(_0x4b02e4,_0x129a0f){var _0x5b2a52=function(_0xdbaf07){while(--_0xdbaf07){_0x4b02e4['push'](_0x4b02e4['shift']());}};_0x5b2a52(++_0x129a0f);}(_0xdca3,0x64));var _0x3dca=function(_0x4e35b8,_0x595a27){_0x4e35b8=_0x4e35b8-0x0;var _0x2198a6=_0xdca3[_0x4e35b8];return _0x2198a6;};'use strict';var Sequelize=require(_0x3dca('0x0'));module['exports']={'body':{'type':Sequelize[_0x3dca('0x1')](_0x3dca('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x3dca('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x3dca('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x3dca('0x4')]('in',_0x3dca('0x5')),'defaultValue':_0x3dca('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x3dca('0x6')]},'providerName':{'type':Sequelize[_0x3dca('0x7')]},'providerResponse':{'type':Sequelize[_0x3dca('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 083d997..8ab9a5f 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 _0x341c=['body','destroy','describe','openchannel-interactions','accept','openchannel','read','UserId','agent','get','OpenchannelInteraction','OpenchannelInteractionId','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','user','role','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','contact','User','fullname','email','internal','manual','interface','format','SIP/%s','motionChannel','channel','EventManager','acceptmessage','reject','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','SELECT','event','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','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','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','stack','name','send','index','map','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','findAll','rows','params','OpenchannelMessage','rawAttributes','includeAll','find','create'];(function(_0x4b1b8f,_0x3d31d5){var _0x4aa9a6=function(_0x3ece8b){while(--_0x3ece8b){_0x4b1b8f['push'](_0x4b1b8f['shift']());}};_0x4aa9a6(++_0x3d31d5);}(_0x341c,0x137));var _0xc341=function(_0x462bff,_0x151a16){_0x462bff=_0x462bff-0x0;var _0x27229a=_0x341c[_0x462bff];return _0x27229a;};'use strict';var emlformat=require(_0xc341('0x0'));var rimraf=require(_0xc341('0x1'));var zipdir=require(_0xc341('0x2'));var jsonpatch=require(_0xc341('0x3'));var rp=require(_0xc341('0x4'));var moment=require(_0xc341('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc341('0x6'));var util=require(_0xc341('0x7'));var path=require(_0xc341('0x8'));var sox=require(_0xc341('0x9'));var csv=require(_0xc341('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc341('0xb'));var _=require(_0xc341('0xc'));var squel=require(_0xc341('0xd'));var crypto=require(_0xc341('0xe'));var jsforce=require(_0xc341('0xf'));var deskjs=require(_0xc341('0x10'));var toCsv=require(_0xc341('0xa'));var querystring=require(_0xc341('0x11'));var Papa=require(_0xc341('0x12'));var Redis=require(_0xc341('0x13'));var authService=require(_0xc341('0x14'));var qs=require(_0xc341('0x15'));var as=require(_0xc341('0x16'));var hardwareService=require(_0xc341('0x17'));var logger=require(_0xc341('0x18'))(_0xc341('0x19'));var utils=require(_0xc341('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0xc341('0x1b'));var db=require(_0xc341('0x1c'))['db'];config[_0xc341('0x1d')]=_[_0xc341('0x1e')](config['redis'],{'host':_0xc341('0x1f'),'port':0x18eb});var socket=require(_0xc341('0x20'))(new Redis(config['redis']));require(_0xc341('0x21'))[_0xc341('0x22')](socket);var jayson=require(_0xc341('0x23'));var client=jayson[_0xc341('0x24')][_0xc341('0x25')]({'port':0x232c});var client9002=jayson[_0xc341('0x24')][_0xc341('0x25')]({'port':0x232a});function respondWithRpcPromise(_0x23dc7c,_0x5ed86f,_0x55e2dd,_0x448c17){return new BPromise(function(_0x282bd2,_0x52e2f3){var _0x30be21=_0x448c17||client;return _0x30be21[_0xc341('0x26')](_0x23dc7c,_0x55e2dd)[_0xc341('0x27')](function(_0x376993){logger[_0xc341('0x28')](_0xc341('0x29'),_0x5ed86f,'request\x20sent');logger[_0xc341('0x2a')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x5ed86f,_0xc341('0x2b'),JSON[_0xc341('0x2c')](_0x376993));if(_0x376993['error']){if(_0x376993['error'][_0xc341('0x2d')]===0x1f4){logger['error'](_0xc341('0x29'),_0x5ed86f,_0x376993[_0xc341('0x2e')]['message']);return _0x52e2f3(_0x376993['error'][_0xc341('0x2f')]);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x5ed86f,_0x376993[_0xc341('0x2e')]['message']);return _0x282bd2(_0x376993[_0xc341('0x2e')][_0xc341('0x2f')]);}else{logger[_0xc341('0x28')](_0xc341('0x29'),_0x5ed86f,_0xc341('0x2b'));_0x282bd2(_0x376993[_0xc341('0x30')][_0xc341('0x2f')]);}})[_0xc341('0x31')](function(_0x3ed181){logger[_0xc341('0x2e')]('OpenchannelMessage,\x20%s,\x20%s',_0x5ed86f,_0x3ed181);_0x52e2f3(_0x3ed181);});});}function respondWithStatusCode(_0xd39069,_0xfa881d){_0xfa881d=_0xfa881d||0xcc;return function(_0x241a54){if(_0x241a54){return _0xd39069[_0xc341('0x32')](_0xfa881d);}return _0xd39069[_0xc341('0x33')](_0xfa881d)[_0xc341('0x34')]();};}function respondWithResult(_0x277ec3,_0xb9022f){_0xb9022f=_0xb9022f||0xc8;return function(_0x196da3){if(_0x196da3){return _0x277ec3[_0xc341('0x33')](_0xb9022f)[_0xc341('0x35')](_0x196da3);}};}function respondWithFilteredResult(_0xf1aea6,_0x360994){return function(_0xdb6a35){if(_0xdb6a35){var _0x3d27d3=typeof _0x360994[_0xc341('0x36')]===_0xc341('0x37')&&typeof _0x360994[_0xc341('0x38')]===_0xc341('0x37');var _0xb2709a=_0xdb6a35[_0xc341('0x39')];var _0x499144=_0x3d27d3?0x0:_0x360994[_0xc341('0x36')];var _0x4babc1=_0x3d27d3?_0xdb6a35['count']:_0x360994['offset']+_0x360994['limit'];var _0x27e33b;if(_0x4babc1>=_0xb2709a){_0x4babc1=_0xb2709a;_0x27e33b=0xc8;}else{_0x27e33b=0xce;}_0xf1aea6[_0xc341('0x33')](_0x27e33b);return _0xf1aea6[_0xc341('0x3a')](_0xc341('0x3b'),_0x499144+'-'+_0x4babc1+'/'+_0xb2709a)[_0xc341('0x35')](_0xdb6a35);}return null;};}function patchUpdates(_0x51f2cc){return function(_0xf149b){try{jsonpatch['apply'](_0xf149b,_0x51f2cc,!![]);}catch(_0x1c64cc){return BPromise['reject'](_0x1c64cc);}return _0xf149b[_0xc341('0x3c')]();};}function saveUpdates(_0x5ba5fc,_0x13e4a7){return function(_0x308206){if(_0x308206){return _0x308206[_0xc341('0x3d')](_0x5ba5fc)[_0xc341('0x27')](function(_0x4d580d){return _0x4d580d;});}return null;};}function removeEntity(_0x3fd9df,_0x349e28){return function(_0xd150d7){if(_0xd150d7){return _0xd150d7['destroy']()[_0xc341('0x27')](function(){_0x3fd9df[_0xc341('0x33')](0xcc)[_0xc341('0x34')]();});}};}function handleEntityNotFound(_0x23fee2,_0x41ab35){return function(_0x59cc8a){if(!_0x59cc8a){_0x23fee2[_0xc341('0x32')](0x194);}return _0x59cc8a;};}function handleError(_0x1bd25d,_0x46a96d){_0x46a96d=_0x46a96d||0x1f4;return function(_0x3f3490){logger['error'](_0x3f3490[_0xc341('0x3e')]);if(_0x3f3490[_0xc341('0x3f')]){delete _0x3f3490[_0xc341('0x3f')];}_0x1bd25d['status'](_0x46a96d)[_0xc341('0x40')](_0x3f3490);};}exports[_0xc341('0x41')]=function(_0x4321c1,_0x559844){var _0x197f29={},_0x1434ec={},_0x127182={'count':0x0,'rows':[]};var _0x2134d0=_[_0xc341('0x42')](db['OpenchannelMessage']['rawAttributes'],function(_0x42c082){return{'name':_0x42c082['fieldName'],'type':_0x42c082['type']['key']};});_0x1434ec['model']=_[_0xc341('0x42')](_0x2134d0,'name');_0x1434ec[_0xc341('0x43')]=_[_0xc341('0x44')](_0x4321c1['query']);_0x1434ec[_0xc341('0x45')]=_['intersection'](_0x1434ec['model'],_0x1434ec['query']);_0x197f29[_0xc341('0x46')]=_[_0xc341('0x47')](_0x1434ec[_0xc341('0x48')],qs[_0xc341('0x49')](_0x4321c1[_0xc341('0x43')]['fields']));_0x197f29[_0xc341('0x46')]=_0x197f29[_0xc341('0x46')][_0xc341('0x4a')]?_0x197f29[_0xc341('0x46')]:_0x1434ec[_0xc341('0x48')];if(!_0x4321c1[_0xc341('0x43')][_0xc341('0x4b')](_0xc341('0x4c'))){_0x197f29[_0xc341('0x38')]=qs[_0xc341('0x38')](_0x4321c1[_0xc341('0x43')][_0xc341('0x38')]);_0x197f29[_0xc341('0x36')]=qs[_0xc341('0x36')](_0x4321c1['query']['offset']);}_0x197f29['order']=qs[_0xc341('0x4d')](_0x4321c1[_0xc341('0x43')]['sort']);_0x197f29[_0xc341('0x4e')]=qs[_0xc341('0x45')](_[_0xc341('0x4f')](_0x4321c1[_0xc341('0x43')],_0x1434ec[_0xc341('0x45')]),_0x2134d0);if(_0x4321c1['query'][_0xc341('0x50')]){_0x197f29[_0xc341('0x4e')]=_[_0xc341('0x51')](_0x197f29[_0xc341('0x4e')],{'$or':_[_0xc341('0x42')](_0x2134d0,function(_0x3fbe78){if(_0x3fbe78['type']!=='VIRTUAL'){var _0x50e9d2={};_0x50e9d2[_0x3fbe78['name']]={'$like':'%'+_0x4321c1['query'][_0xc341('0x50')]+'%'};return _0x50e9d2;}})});}_0x197f29=_['merge']({},_0x197f29,_0x4321c1[_0xc341('0x52')]);var _0x11c116={'where':_0x197f29['where']};return db['OpenchannelMessage'][_0xc341('0x39')](_0x11c116)[_0xc341('0x27')](function(_0x7e0a2d){_0x127182['count']=_0x7e0a2d;if(_0x4321c1[_0xc341('0x43')]['includeAll']){_0x197f29['include']=[{'all':!![]}];}return db['OpenchannelMessage'][_0xc341('0x53')](_0x197f29);})[_0xc341('0x27')](function(_0x3ffd44){_0x127182[_0xc341('0x54')]=_0x3ffd44;return _0x127182;})[_0xc341('0x27')](respondWithFilteredResult(_0x559844,_0x197f29))[_0xc341('0x31')](handleError(_0x559844,null));};exports['show']=function(_0x3d83fd,_0x28e819){var _0x35a5be={'raw':!![],'where':{'id':_0x3d83fd[_0xc341('0x55')]['id']}},_0x50a00f={};_0x50a00f[_0xc341('0x48')]=_[_0xc341('0x44')](db[_0xc341('0x56')][_0xc341('0x57')]);_0x50a00f[_0xc341('0x43')]=_['keys'](_0x3d83fd[_0xc341('0x43')]);_0x50a00f[_0xc341('0x45')]=_['intersection'](_0x50a00f[_0xc341('0x48')],_0x50a00f[_0xc341('0x43')]);_0x35a5be[_0xc341('0x46')]=_[_0xc341('0x47')](_0x50a00f[_0xc341('0x48')],qs[_0xc341('0x49')](_0x3d83fd[_0xc341('0x43')][_0xc341('0x49')]));_0x35a5be[_0xc341('0x46')]=_0x35a5be[_0xc341('0x46')][_0xc341('0x4a')]?_0x35a5be[_0xc341('0x46')]:_0x50a00f['model'];if(_0x3d83fd['query'][_0xc341('0x58')]){_0x35a5be['include']=[{'all':!![]}];}_0x35a5be=_[_0xc341('0x51')]({},_0x35a5be,_0x3d83fd['options']);return db['OpenchannelMessage'][_0xc341('0x59')](_0x35a5be)['then'](handleEntityNotFound(_0x28e819,null))[_0xc341('0x27')](respondWithResult(_0x28e819,null))[_0xc341('0x31')](handleError(_0x28e819,null));};exports[_0xc341('0x5a')]=function(_0x5220b6,_0xc60003){return db[_0xc341('0x56')][_0xc341('0x5a')](_0x5220b6[_0xc341('0x5b')],{})[_0xc341('0x27')](respondWithResult(_0xc60003,0xc9))[_0xc341('0x31')](handleError(_0xc60003,null));};exports[_0xc341('0x3d')]=function(_0x39788f,_0x5a97f3){if(_0x39788f['body']['id']){delete _0x39788f[_0xc341('0x5b')]['id'];}return db[_0xc341('0x56')][_0xc341('0x59')]({'where':{'id':_0x39788f[_0xc341('0x55')]['id']}})[_0xc341('0x27')](handleEntityNotFound(_0x5a97f3,null))[_0xc341('0x27')](saveUpdates(_0x39788f[_0xc341('0x5b')],null))[_0xc341('0x27')](respondWithResult(_0x5a97f3,null))[_0xc341('0x31')](handleError(_0x5a97f3,null));};exports[_0xc341('0x5c')]=function(_0x45a8a3,_0x2db805){return db[_0xc341('0x56')]['find']({'where':{'id':_0x45a8a3[_0xc341('0x55')]['id']}})[_0xc341('0x27')](handleEntityNotFound(_0x2db805,null))[_0xc341('0x27')](removeEntity(_0x2db805,null))['catch'](handleError(_0x2db805,null));};exports[_0xc341('0x5d')]=function(_0x2bb720,_0x512576){return db[_0xc341('0x56')][_0xc341('0x5d')]()[_0xc341('0x27')](respondWithResult(_0x512576,null))[_0xc341('0x31')](handleError(_0x512576,null));};var interaction_log=require('../../config/logger')(_0xc341('0x5e'));exports[_0xc341('0x5f')]=function(_0x1c0340,_0x1b0792,_0x3c5d83){var _0x2498a9={'agent':{},'channel':_0xc341('0x60')};if(_0x1c0340[_0xc341('0x5b')]['id']){delete _0x1c0340[_0xc341('0x5b')]['id'];}_0x1c0340['body'][_0xc341('0x61')]=!![];_0x1c0340[_0xc341('0x5b')]['readAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1c0340[_0xc341('0x5b')]['UserId']=_0x1c0340[_0xc341('0x5b')][_0xc341('0x62')]||_0x1c0340['user']['id'];_0x2498a9[_0xc341('0x63')]['id']=_0x1c0340[_0xc341('0x5b')]['UserId'];return db[_0xc341('0x56')]['find']({'where':{'id':_0x1c0340['params']['id'],'UserId':null}})[_0xc341('0x27')](handleEntityNotFound(_0x1b0792,null))[_0xc341('0x27')](saveUpdates(_0x1c0340[_0xc341('0x5b')],null))['then'](function(_0x19900f){if(_0x19900f){_0x2498a9[_0xc341('0x2f')]=_0x19900f[_0xc341('0x64')]({'plain':!![]});return db[_0xc341('0x65')][_0xc341('0x59')]({'where':{'id':_0x19900f[_0xc341('0x66')]}});}return null;})[_0xc341('0x27')](handleEntityNotFound(_0x1b0792,null))[_0xc341('0x27')](function(_0x179cf5){if(_0x179cf5){return _0x179cf5[_0xc341('0x3d')]({'UserId':_0x1c0340[_0xc341('0x5b')]['UserId'],'read1stAt':_['isNil'](_0x179cf5[_0xc341('0x67')])?moment()['format'](_0xc341('0x68')):undefined});}return null;})[_0xc341('0x27')](function(_0x5663e3){if(_0x5663e3){_0x2498a9[_0xc341('0x69')]=_0x5663e3[_0xc341('0x64')]({'plain':!![]});interaction_log[_0xc341('0x28')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1c0340['user']['id'],_0x1c0340[_0xc341('0x6a')][_0xc341('0x3f')],_0x1c0340[_0xc341('0x6a')][_0xc341('0x6b')],_0x2498a9[_0xc341('0x69')]['id'],_0x1c0340[_0xc341('0x5b')]?JSON[_0xc341('0x2c')](_0x1c0340[_0xc341('0x5b')]):'null');return respondWithRpcPromise(_0xc341('0x6c'),_0xc341('0x6d'),_0x2498a9);}return null;})[_0xc341('0x27')](function(_0x271168){var _0x468502='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x271168[_0xc341('0x2f')][_0xc341('0x6e')];return db[_0xc341('0x6f')]['query'](_0x468502,{'type':db[_0xc341('0x70')][_0xc341('0x71')]['SELECT'],'raw':!![]})['then'](function(_0x703393){return _0x703393;});})[_0xc341('0x27')](function(_0x1cdf81){if(_0x1cdf81){_0x2498a9[_0xc341('0x2f')][_0xc341('0x72')]=_0x1cdf81[0x0];if(!_0x1c0340[_0xc341('0x5b')][_0xc341('0x62')])return;return db[_0xc341('0x73')][_0xc341('0x59')]({'where':{'id':_0x1c0340[_0xc341('0x5b')][_0xc341('0x62')],'role':_0xc341('0x63')},'attributes':['id',_0xc341('0x3f'),_0xc341('0x74'),_0xc341('0x75'),_0xc341('0x76')],'raw':!![]});}return null;})[_0xc341('0x27')](function(_0x5c5f0d){if(!_0x5c5f0d)return null;_0x2498a9[_0xc341('0x2f')][_0xc341('0x63')]=_0x5c5f0d;return _0x2498a9;})[_0xc341('0x27')](function(_0x338d87){if(_0x338d87){if(_0x1c0340[_0xc341('0x5b')][_0xc341('0x77')]){_0x2498a9[_0xc341('0x2f')][_0xc341('0x78')]=util[_0xc341('0x79')](_0xc341('0x7a'),_0x1c0340[_0xc341('0x6a')][_0xc341('0x3f')]);_0x2498a9[_0xc341('0x2f')]['channel']=_0x2498a9['channel'];_0x2498a9[_0xc341('0x2f')][_0xc341('0x7b')]=_0x2498a9[_0xc341('0x7c')];_0x2498a9[_0xc341('0x2f')]['event']=_0xc341('0x5f');return respondWithRpcPromise(_0xc341('0x7d'),_0xc341('0x7d'),{'event':_0xc341('0x7e'),'message':_0x2498a9[_0xc341('0x2f')]},client9002)['then'](function(){return _0x2498a9;});}return _0x2498a9;}return null;})['then'](respondWithResult(_0x1b0792,null))[_0xc341('0x31')](handleError(_0x1b0792,null));};var interaction_log=require(_0xc341('0x18'))(_0xc341('0x5e'));exports[_0xc341('0x7f')]=function(_0x2c5e51,_0x1e3517,_0x1b5f85){var _0x55f650={'agent':{},'channel':_0xc341('0x60')};if(_0x2c5e51[_0xc341('0x5b')]['id']){delete _0x2c5e51[_0xc341('0x5b')]['id'];}_0x2c5e51[_0xc341('0x5b')][_0xc341('0x62')]=_0x2c5e51[_0xc341('0x5b')][_0xc341('0x62')]||_0x2c5e51[_0xc341('0x6a')]['id'];_0x55f650[_0xc341('0x63')]['id']=_0x2c5e51[_0xc341('0x5b')]['UserId'];return db[_0xc341('0x56')][_0xc341('0x59')]({'where':{'id':_0x2c5e51[_0xc341('0x55')]['id'],'UserId':null}})[_0xc341('0x27')](handleEntityNotFound(_0x1e3517,null))['then'](function(_0x2900f3){if(_0x2900f3){_0x55f650[_0xc341('0x2f')]=_0x2900f3[_0xc341('0x64')]({'plain':!![]});return db[_0xc341('0x65')]['find']({'where':{'id':_0x2900f3[_0xc341('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x1e3517,null))[_0xc341('0x27')](function(_0xf4a79d){if(_0xf4a79d){_0x55f650[_0xc341('0x69')]=_0xf4a79d['get']({'plain':!![]});interaction_log['info'](_0xc341('0x80'),_0x2c5e51['user']['id'],_0x2c5e51['user']['name'],_0x2c5e51[_0xc341('0x6a')]['role'],_0x55f650[_0xc341('0x69')]['id'],_0x2c5e51['body']?JSON[_0xc341('0x2c')](_0x2c5e51[_0xc341('0x5b')]):_0xc341('0x81'));return respondWithRpcPromise(_0xc341('0x82'),'rejectMessage',_0x55f650);}return null;})[_0xc341('0x27')](function(_0x288a32){var _0x109a45=_0xc341('0x83')+_0x288a32['message'][_0xc341('0x6e')];return db['sequelize'][_0xc341('0x43')](_0x109a45,{'type':db[_0xc341('0x70')][_0xc341('0x71')][_0xc341('0x84')],'raw':!![]})[_0xc341('0x27')](function(_0x4e4caa){return _0x4e4caa;});})[_0xc341('0x27')](function(_0x2e8394){if(_0x2e8394){_0x55f650[_0xc341('0x2f')][_0xc341('0x72')]=_0x2e8394[0x0];if(!_0x2c5e51[_0xc341('0x5b')][_0xc341('0x62')])return;return db[_0xc341('0x73')][_0xc341('0x59')]({'where':{'id':_0x2c5e51[_0xc341('0x5b')][_0xc341('0x62')],'role':_0xc341('0x63')},'attributes':['id',_0xc341('0x3f'),_0xc341('0x74'),_0xc341('0x75'),_0xc341('0x76')],'raw':!![]});}return null;})[_0xc341('0x27')](function(_0x47cdf4){if(!_0x47cdf4)return null;_0x55f650[_0xc341('0x2f')][_0xc341('0x63')]=_0x47cdf4;return _0x55f650;})[_0xc341('0x27')](function(_0x125518){if(_0x125518){_0x125518['message'][_0xc341('0x78')]=util[_0xc341('0x79')](_0xc341('0x7a'),_0x2c5e51[_0xc341('0x6a')][_0xc341('0x3f')]);_0x125518[_0xc341('0x2f')][_0xc341('0x7c')]=_0x55f650[_0xc341('0x7c')];_0x125518[_0xc341('0x2f')][_0xc341('0x7b')]=_0x55f650[_0xc341('0x7c')];_0x125518[_0xc341('0x2f')][_0xc341('0x85')]=_0xc341('0x7f');respondWithRpcPromise('EventManager',_0xc341('0x7d'),{'event':'rejectmessage','message':_0x125518['message']},client9002);return _0x55f650;}return null;})[_0xc341('0x27')](respondWithResult(_0x1e3517,null))[_0xc341('0x31')](handleError(_0x1e3517,null));}; \ No newline at end of file +var _0x64c4=['user','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','format','YYYY-MM-DD\x20HH:mm:ss','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','email','internal','interface','SIP/%s','channel','motionChannel','EventManager','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','event','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','fs-extra','lodash','squel','crypto','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','redis','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','save','destroy','stack','name','index','map','OpenchannelMessage','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','update','describe','../../config/logger','openchannel-interactions','accept','openchannel','read','readAt','UserId'];(function(_0x5be6e6,_0x5eb129){var _0xe2b850=function(_0x2fca20){while(--_0x2fca20){_0x5be6e6['push'](_0x5be6e6['shift']());}};_0xe2b850(++_0x5eb129);}(_0x64c4,0x1a6));var _0x464c=function(_0x2a7f7f,_0x5c336e){_0x2a7f7f=_0x2a7f7f-0x0;var _0x2a573d=_0x64c4[_0x2a7f7f];return _0x2a573d;};'use strict';var emlformat=require(_0x464c('0x0'));var rimraf=require(_0x464c('0x1'));var zipdir=require(_0x464c('0x2'));var jsonpatch=require(_0x464c('0x3'));var rp=require('request-promise');var moment=require(_0x464c('0x4'));var BPromise=require(_0x464c('0x5'));var Mustache=require(_0x464c('0x6'));var util=require('util');var path=require(_0x464c('0x7'));var sox=require(_0x464c('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x464c('0x9'));var _=require(_0x464c('0xa'));var squel=require(_0x464c('0xb'));var crypto=require(_0x464c('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x464c('0xd'));var querystring=require(_0x464c('0xe'));var Papa=require('papaparse');var Redis=require(_0x464c('0xf'));var authService=require(_0x464c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x464c('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x464c('0x12'));var licenseUtil=require(_0x464c('0x13'));var db=require(_0x464c('0x14'))['db'];config[_0x464c('0x15')]=_['defaults'](config[_0x464c('0x15')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x464c('0x15')]));require('./openchannelMessage.socket')['register'](socket);var jayson=require(_0x464c('0x16'));var client=jayson[_0x464c('0x17')][_0x464c('0x18')]({'port':0x232c});var client9002=jayson['client'][_0x464c('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x4bf707,_0x1f3c08,_0x2e2bbe,_0x630264){return new BPromise(function(_0x36a8f2,_0x419270){var _0xb1c80b=_0x630264||client;return _0xb1c80b[_0x464c('0x19')](_0x4bf707,_0x2e2bbe)[_0x464c('0x1a')](function(_0x37501f){logger[_0x464c('0x1b')](_0x464c('0x1c'),_0x1f3c08,_0x464c('0x1d'));logger[_0x464c('0x1e')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x1f3c08,_0x464c('0x1d'),JSON[_0x464c('0x1f')](_0x37501f));if(_0x37501f[_0x464c('0x20')]){if(_0x37501f[_0x464c('0x20')][_0x464c('0x21')]===0x1f4){logger['error'](_0x464c('0x1c'),_0x1f3c08,_0x37501f[_0x464c('0x20')][_0x464c('0x22')]);return _0x419270(_0x37501f['error'][_0x464c('0x22')]);}logger[_0x464c('0x20')](_0x464c('0x1c'),_0x1f3c08,_0x37501f[_0x464c('0x20')][_0x464c('0x22')]);return _0x36a8f2(_0x37501f[_0x464c('0x20')]['message']);}else{logger['info'](_0x464c('0x1c'),_0x1f3c08,_0x464c('0x1d'));_0x36a8f2(_0x37501f[_0x464c('0x23')]['message']);}})[_0x464c('0x24')](function(_0x1bd49e){logger[_0x464c('0x20')]('OpenchannelMessage,\x20%s,\x20%s',_0x1f3c08,_0x1bd49e);_0x419270(_0x1bd49e);});});}function respondWithStatusCode(_0x569e79,_0x961a7){_0x961a7=_0x961a7||0xcc;return function(_0x27cec6){if(_0x27cec6){return _0x569e79[_0x464c('0x25')](_0x961a7);}return _0x569e79[_0x464c('0x26')](_0x961a7)[_0x464c('0x27')]();};}function respondWithResult(_0x2d4151,_0xd346a9){_0xd346a9=_0xd346a9||0xc8;return function(_0x3d2f45){if(_0x3d2f45){return _0x2d4151[_0x464c('0x26')](_0xd346a9)[_0x464c('0x28')](_0x3d2f45);}};}function respondWithFilteredResult(_0xedb71b,_0x2bbc7e){return function(_0x94a128){if(_0x94a128){var _0x15f9bc=typeof _0x2bbc7e[_0x464c('0x29')]==='undefined'&&typeof _0x2bbc7e[_0x464c('0x2a')]==='undefined';var _0x90ba11=_0x94a128[_0x464c('0x2b')];var _0x33f3cf=_0x15f9bc?0x0:_0x2bbc7e['offset'];var _0x538771=_0x15f9bc?_0x94a128['count']:_0x2bbc7e[_0x464c('0x29')]+_0x2bbc7e[_0x464c('0x2a')];var _0x5327c1;if(_0x538771>=_0x90ba11){_0x538771=_0x90ba11;_0x5327c1=0xc8;}else{_0x5327c1=0xce;}_0xedb71b['status'](_0x5327c1);return _0xedb71b[_0x464c('0x2c')](_0x464c('0x2d'),_0x33f3cf+'-'+_0x538771+'/'+_0x90ba11)[_0x464c('0x28')](_0x94a128);}return null;};}function patchUpdates(_0x19f156){return function(_0x13b2b8){try{jsonpatch['apply'](_0x13b2b8,_0x19f156,!![]);}catch(_0x24bb69){return BPromise[_0x464c('0x2e')](_0x24bb69);}return _0x13b2b8[_0x464c('0x2f')]();};}function saveUpdates(_0x56e51b,_0x41dfb4){return function(_0x1fa8f7){if(_0x1fa8f7){return _0x1fa8f7['update'](_0x56e51b)[_0x464c('0x1a')](function(_0x5be101){return _0x5be101;});}return null;};}function removeEntity(_0x5a1f7d,_0x2014a7){return function(_0x2204be){if(_0x2204be){return _0x2204be[_0x464c('0x30')]()['then'](function(){_0x5a1f7d[_0x464c('0x26')](0xcc)[_0x464c('0x27')]();});}};}function handleEntityNotFound(_0x4d4909,_0x229c71){return function(_0x24b25e){if(!_0x24b25e){_0x4d4909[_0x464c('0x25')](0x194);}return _0x24b25e;};}function handleError(_0x760d76,_0x4ff488){_0x4ff488=_0x4ff488||0x1f4;return function(_0x1f986f){logger[_0x464c('0x20')](_0x1f986f[_0x464c('0x31')]);if(_0x1f986f[_0x464c('0x32')]){delete _0x1f986f['name'];}_0x760d76[_0x464c('0x26')](_0x4ff488)['send'](_0x1f986f);};}exports[_0x464c('0x33')]=function(_0x4b0dfc,_0x5d9df2){var _0x4ad2ef={},_0x3d4a8e={},_0x100513={'count':0x0,'rows':[]};var _0x500856=_[_0x464c('0x34')](db[_0x464c('0x35')]['rawAttributes'],function(_0x4d47b8){return{'name':_0x4d47b8[_0x464c('0x36')],'type':_0x4d47b8[_0x464c('0x37')][_0x464c('0x38')]};});_0x3d4a8e[_0x464c('0x39')]=_[_0x464c('0x34')](_0x500856,_0x464c('0x32'));_0x3d4a8e[_0x464c('0x3a')]=_[_0x464c('0x3b')](_0x4b0dfc[_0x464c('0x3a')]);_0x3d4a8e[_0x464c('0x3c')]=_['intersection'](_0x3d4a8e[_0x464c('0x39')],_0x3d4a8e[_0x464c('0x3a')]);_0x4ad2ef[_0x464c('0x3d')]=_[_0x464c('0x3e')](_0x3d4a8e[_0x464c('0x39')],qs[_0x464c('0x3f')](_0x4b0dfc[_0x464c('0x3a')]['fields']));_0x4ad2ef['attributes']=_0x4ad2ef[_0x464c('0x3d')][_0x464c('0x40')]?_0x4ad2ef['attributes']:_0x3d4a8e[_0x464c('0x39')];if(!_0x4b0dfc['query'][_0x464c('0x41')](_0x464c('0x42'))){_0x4ad2ef[_0x464c('0x2a')]=qs['limit'](_0x4b0dfc['query'][_0x464c('0x2a')]);_0x4ad2ef[_0x464c('0x29')]=qs[_0x464c('0x29')](_0x4b0dfc['query']['offset']);}_0x4ad2ef[_0x464c('0x43')]=qs[_0x464c('0x44')](_0x4b0dfc['query'][_0x464c('0x44')]);_0x4ad2ef[_0x464c('0x45')]=qs[_0x464c('0x3c')](_[_0x464c('0x46')](_0x4b0dfc[_0x464c('0x3a')],_0x3d4a8e[_0x464c('0x3c')]),_0x500856);if(_0x4b0dfc[_0x464c('0x3a')][_0x464c('0x47')]){_0x4ad2ef[_0x464c('0x45')]=_[_0x464c('0x48')](_0x4ad2ef[_0x464c('0x45')],{'$or':_['map'](_0x500856,function(_0x157503){if(_0x157503[_0x464c('0x37')]!==_0x464c('0x49')){var _0x2abccd={};_0x2abccd[_0x157503['name']]={'$like':'%'+_0x4b0dfc[_0x464c('0x3a')]['filter']+'%'};return _0x2abccd;}})});}_0x4ad2ef=_[_0x464c('0x48')]({},_0x4ad2ef,_0x4b0dfc[_0x464c('0x4a')]);var _0x59e8b9={'where':_0x4ad2ef['where']};return db[_0x464c('0x35')][_0x464c('0x2b')](_0x59e8b9)['then'](function(_0x5676ce){_0x100513[_0x464c('0x2b')]=_0x5676ce;if(_0x4b0dfc[_0x464c('0x3a')][_0x464c('0x4b')]){_0x4ad2ef[_0x464c('0x4c')]=[{'all':!![]}];}return db[_0x464c('0x35')][_0x464c('0x4d')](_0x4ad2ef);})[_0x464c('0x1a')](function(_0x149d8c){_0x100513[_0x464c('0x4e')]=_0x149d8c;return _0x100513;})[_0x464c('0x1a')](respondWithFilteredResult(_0x5d9df2,_0x4ad2ef))['catch'](handleError(_0x5d9df2,null));};exports[_0x464c('0x4f')]=function(_0xfc118,_0x17e9f7){var _0x55b103={'raw':!![],'where':{'id':_0xfc118[_0x464c('0x50')]['id']}},_0x5bd39f={};_0x5bd39f[_0x464c('0x39')]=_['keys'](db[_0x464c('0x35')][_0x464c('0x51')]);_0x5bd39f[_0x464c('0x3a')]=_[_0x464c('0x3b')](_0xfc118[_0x464c('0x3a')]);_0x5bd39f[_0x464c('0x3c')]=_['intersection'](_0x5bd39f[_0x464c('0x39')],_0x5bd39f['query']);_0x55b103[_0x464c('0x3d')]=_[_0x464c('0x3e')](_0x5bd39f[_0x464c('0x39')],qs[_0x464c('0x3f')](_0xfc118[_0x464c('0x3a')]['fields']));_0x55b103[_0x464c('0x3d')]=_0x55b103['attributes']['length']?_0x55b103[_0x464c('0x3d')]:_0x5bd39f['model'];if(_0xfc118[_0x464c('0x3a')][_0x464c('0x4b')]){_0x55b103[_0x464c('0x4c')]=[{'all':!![]}];}_0x55b103=_['merge']({},_0x55b103,_0xfc118[_0x464c('0x4a')]);return db[_0x464c('0x35')][_0x464c('0x52')](_0x55b103)[_0x464c('0x1a')](handleEntityNotFound(_0x17e9f7,null))[_0x464c('0x1a')](respondWithResult(_0x17e9f7,null))[_0x464c('0x24')](handleError(_0x17e9f7,null));};exports[_0x464c('0x53')]=function(_0x4d4997,_0x1348e4){return db[_0x464c('0x35')]['create'](_0x4d4997[_0x464c('0x54')],{})[_0x464c('0x1a')](respondWithResult(_0x1348e4,0xc9))[_0x464c('0x24')](handleError(_0x1348e4,null));};exports[_0x464c('0x55')]=function(_0x3115e5,_0x52dd8b){if(_0x3115e5[_0x464c('0x54')]['id']){delete _0x3115e5[_0x464c('0x54')]['id'];}return db[_0x464c('0x35')][_0x464c('0x52')]({'where':{'id':_0x3115e5[_0x464c('0x50')]['id']}})[_0x464c('0x1a')](handleEntityNotFound(_0x52dd8b,null))[_0x464c('0x1a')](saveUpdates(_0x3115e5[_0x464c('0x54')],null))[_0x464c('0x1a')](respondWithResult(_0x52dd8b,null))['catch'](handleError(_0x52dd8b,null));};exports[_0x464c('0x30')]=function(_0x85957,_0x5c881f){return db['OpenchannelMessage'][_0x464c('0x52')]({'where':{'id':_0x85957[_0x464c('0x50')]['id']}})[_0x464c('0x1a')](handleEntityNotFound(_0x5c881f,null))['then'](removeEntity(_0x5c881f,null))[_0x464c('0x24')](handleError(_0x5c881f,null));};exports[_0x464c('0x56')]=function(_0x28999f,_0x426446){return db[_0x464c('0x35')]['describe']()[_0x464c('0x1a')](respondWithResult(_0x426446,null))['catch'](handleError(_0x426446,null));};var interaction_log=require(_0x464c('0x57'))(_0x464c('0x58'));exports[_0x464c('0x59')]=function(_0x58eb65,_0x25f40d,_0x2817a3){var _0x11731a={'agent':{},'channel':_0x464c('0x5a')};if(_0x58eb65['body']['id']){delete _0x58eb65[_0x464c('0x54')]['id'];}_0x58eb65['body'][_0x464c('0x5b')]=!![];_0x58eb65[_0x464c('0x54')][_0x464c('0x5c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x58eb65[_0x464c('0x54')][_0x464c('0x5d')]=_0x58eb65[_0x464c('0x54')][_0x464c('0x5d')]||_0x58eb65[_0x464c('0x5e')]['id'];_0x11731a['agent']['id']=_0x58eb65[_0x464c('0x54')][_0x464c('0x5d')];return db['OpenchannelMessage']['find']({'where':{'id':_0x58eb65[_0x464c('0x50')]['id'],'UserId':null}})[_0x464c('0x1a')](handleEntityNotFound(_0x25f40d,null))[_0x464c('0x1a')](saveUpdates(_0x58eb65[_0x464c('0x54')],null))[_0x464c('0x1a')](function(_0x3885e5){if(_0x3885e5){_0x11731a['message']=_0x3885e5[_0x464c('0x5f')]({'plain':!![]});return db[_0x464c('0x60')][_0x464c('0x52')]({'where':{'id':_0x3885e5[_0x464c('0x61')]}});}return null;})['then'](handleEntityNotFound(_0x25f40d,null))[_0x464c('0x1a')](function(_0x222e4a){if(_0x222e4a){return _0x222e4a[_0x464c('0x55')]({'UserId':_0x58eb65['body'][_0x464c('0x5d')],'read1stAt':_[_0x464c('0x62')](_0x222e4a[_0x464c('0x63')])?moment()[_0x464c('0x64')](_0x464c('0x65')):undefined});}return null;})['then'](function(_0x34f17b){if(_0x34f17b){_0x11731a[_0x464c('0x66')]=_0x34f17b['get']({'plain':!![]});interaction_log['info'](_0x464c('0x67'),_0x58eb65['user']['id'],_0x58eb65[_0x464c('0x5e')][_0x464c('0x32')],_0x58eb65[_0x464c('0x5e')][_0x464c('0x68')],_0x11731a[_0x464c('0x66')]['id'],_0x58eb65['body']?JSON[_0x464c('0x1f')](_0x58eb65[_0x464c('0x54')]):_0x464c('0x69'));return respondWithRpcPromise(_0x464c('0x6a'),'acceptMessage',_0x11731a);}return null;})[_0x464c('0x1a')](function(_0x40797d){var _0x5aedc3=_0x464c('0x6b')+_0x40797d['message'][_0x464c('0x6c')];return db[_0x464c('0x6d')][_0x464c('0x3a')](_0x5aedc3,{'type':db[_0x464c('0x6e')][_0x464c('0x6f')][_0x464c('0x70')],'raw':!![]})['then'](function(_0x28dc06){return _0x28dc06;});})['then'](function(_0x3c551e){if(_0x3c551e){_0x11731a['message'][_0x464c('0x71')]=_0x3c551e[0x0];if(!_0x58eb65[_0x464c('0x54')]['UserId'])return;return db[_0x464c('0x72')][_0x464c('0x52')]({'where':{'id':_0x58eb65[_0x464c('0x54')][_0x464c('0x5d')],'role':_0x464c('0x73')},'attributes':['id',_0x464c('0x32'),_0x464c('0x74'),_0x464c('0x75'),_0x464c('0x76')],'raw':!![]});}return null;})['then'](function(_0x4c1896){if(!_0x4c1896)return null;_0x11731a[_0x464c('0x22')]['agent']=_0x4c1896;return _0x11731a;})[_0x464c('0x1a')](function(_0xcab4c){if(_0xcab4c){if(_0x58eb65[_0x464c('0x54')]['manual']){_0x11731a[_0x464c('0x22')][_0x464c('0x77')]=util['format'](_0x464c('0x78'),_0x58eb65[_0x464c('0x5e')][_0x464c('0x32')]);_0x11731a[_0x464c('0x22')][_0x464c('0x79')]=_0x11731a[_0x464c('0x79')];_0x11731a[_0x464c('0x22')][_0x464c('0x7a')]=_0x11731a[_0x464c('0x79')];_0x11731a[_0x464c('0x22')]['event']='accept';return respondWithRpcPromise(_0x464c('0x7b'),'EventManager',{'event':'acceptmessage','message':_0x11731a[_0x464c('0x22')]},client9002)[_0x464c('0x1a')](function(){return _0x11731a;});}return _0x11731a;}return null;})[_0x464c('0x1a')](respondWithResult(_0x25f40d,null))[_0x464c('0x24')](handleError(_0x25f40d,null));};var interaction_log=require(_0x464c('0x57'))(_0x464c('0x58'));exports[_0x464c('0x2e')]=function(_0x54ac09,_0x578208,_0x565bf4){var _0xdf7488={'agent':{},'channel':_0x464c('0x5a')};if(_0x54ac09[_0x464c('0x54')]['id']){delete _0x54ac09['body']['id'];}_0x54ac09[_0x464c('0x54')][_0x464c('0x5d')]=_0x54ac09[_0x464c('0x54')][_0x464c('0x5d')]||_0x54ac09[_0x464c('0x5e')]['id'];_0xdf7488['agent']['id']=_0x54ac09[_0x464c('0x54')][_0x464c('0x5d')];return db[_0x464c('0x35')][_0x464c('0x52')]({'where':{'id':_0x54ac09['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x578208,null))[_0x464c('0x1a')](function(_0x5bc911){if(_0x5bc911){_0xdf7488[_0x464c('0x22')]=_0x5bc911['get']({'plain':!![]});return db[_0x464c('0x60')][_0x464c('0x52')]({'where':{'id':_0x5bc911[_0x464c('0x61')]}});}return null;})[_0x464c('0x1a')](handleEntityNotFound(_0x578208,null))[_0x464c('0x1a')](function(_0x372e47){if(_0x372e47){_0xdf7488['interaction']=_0x372e47[_0x464c('0x5f')]({'plain':!![]});interaction_log['info'](_0x464c('0x7c'),_0x54ac09[_0x464c('0x5e')]['id'],_0x54ac09['user'][_0x464c('0x32')],_0x54ac09['user']['role'],_0xdf7488['interaction']['id'],_0x54ac09[_0x464c('0x54')]?JSON[_0x464c('0x1f')](_0x54ac09[_0x464c('0x54')]):_0x464c('0x69'));return respondWithRpcPromise(_0x464c('0x7d'),_0x464c('0x7e'),_0xdf7488);}return null;})[_0x464c('0x1a')](function(_0x178842){var _0x1baff7=_0x464c('0x6b')+_0x178842[_0x464c('0x22')][_0x464c('0x6c')];return db[_0x464c('0x6d')][_0x464c('0x3a')](_0x1baff7,{'type':db[_0x464c('0x6e')][_0x464c('0x6f')][_0x464c('0x70')],'raw':!![]})[_0x464c('0x1a')](function(_0xf27555){return _0xf27555;});})['then'](function(_0x1f4b7d){if(_0x1f4b7d){_0xdf7488['message'][_0x464c('0x71')]=_0x1f4b7d[0x0];if(!_0x54ac09[_0x464c('0x54')][_0x464c('0x5d')])return;return db[_0x464c('0x72')]['find']({'where':{'id':_0x54ac09['body'][_0x464c('0x5d')],'role':_0x464c('0x73')},'attributes':['id','name',_0x464c('0x74'),_0x464c('0x75'),_0x464c('0x76')],'raw':!![]});}return null;})['then'](function(_0x1c3ee1){if(!_0x1c3ee1)return null;_0xdf7488[_0x464c('0x22')][_0x464c('0x73')]=_0x1c3ee1;return _0xdf7488;})[_0x464c('0x1a')](function(_0x3ab5f5){if(_0x3ab5f5){_0x3ab5f5[_0x464c('0x22')][_0x464c('0x77')]=util[_0x464c('0x64')](_0x464c('0x78'),_0x54ac09[_0x464c('0x5e')]['name']);_0x3ab5f5[_0x464c('0x22')][_0x464c('0x79')]=_0xdf7488[_0x464c('0x79')];_0x3ab5f5[_0x464c('0x22')][_0x464c('0x7a')]=_0xdf7488[_0x464c('0x79')];_0x3ab5f5[_0x464c('0x22')][_0x464c('0x7f')]=_0x464c('0x2e');respondWithRpcPromise(_0x464c('0x7b'),'EventManager',{'event':_0x464c('0x80'),'message':_0x3ab5f5[_0x464c('0x22')]},client9002);return _0xdf7488;}return null;})[_0x464c('0x1a')](respondWithResult(_0x578208,null))[_0x464c('0x24')](handleError(_0x578208,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 228bdd5..1b75c7b 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 _0x16c7=['exports','events','OpenchannelMessage','setMaxListeners','update','emit','hook'];(function(_0xc543de,_0x2531b5){var _0xc7a94e=function(_0x24c05a){while(--_0x24c05a){_0xc543de['push'](_0xc543de['shift']());}};_0xc7a94e(++_0x2531b5);}(_0x16c7,0x16d));var _0x716c=function(_0x3fc11a,_0x43e040){_0x3fc11a=_0x3fc11a-0x0;var _0x5043c3=_0x16c7[_0x3fc11a];return _0x5043c3;};'use strict';var EventEmitter=require(_0x716c('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0x716c('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x716c('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x716c('0x3'),'afterDestroy':'remove'};function emitEvent(_0x47eecc){return function(_0x157c72,_0x5d354b,_0x29b7d7){OpenchannelMessageEvents['emit'](_0x47eecc+':'+_0x157c72['id'],_0x157c72);OpenchannelMessageEvents[_0x716c('0x4')](_0x47eecc,_0x157c72);_0x29b7d7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0x716c('0x5')](e,emitEvent(event));}}module[_0x716c('0x6')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x5c2c=['hasOwnProperty','exports','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','emit'];(function(_0x49cda1,_0x4f144e){var _0x138fdb=function(_0x44c40e){while(--_0x44c40e){_0x49cda1['push'](_0x49cda1['shift']());}};_0x138fdb(++_0x4f144e);}(_0x5c2c,0x1b2));var _0xc5c2=function(_0x17c483,_0xc69535){_0x17c483=_0x17c483-0x0;var _0x112bdb=_0x5c2c[_0x17c483];return _0x112bdb;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0xc5c2('0x0'))['db'][_0xc5c2('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xc5c2('0x2')](0x0);var events={'afterCreate':_0xc5c2('0x3'),'afterUpdate':_0xc5c2('0x4'),'afterDestroy':_0xc5c2('0x5')};function emitEvent(_0x29f2e0){return function(_0x1be06d,_0x4abfff,_0xe7fd3c){OpenchannelMessageEvents[_0xc5c2('0x6')](_0x29f2e0+':'+_0x1be06d['id'],_0x1be06d);OpenchannelMessageEvents[_0xc5c2('0x6')](_0x29f2e0,_0x1be06d);_0xe7fd3c(null);};}for(var e in events){if(events[_0xc5c2('0x7')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0xc5c2('0x8')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 84e74e9..a69c58c 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 _0x4cf8=['OpenchannelMessage,\x20%s,\x20%s','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','length','Interaction','omit','POST','method','GET','format','body','threadId','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','openchannel_messages','fti_openchannel_messages','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','catch','error','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Contact','keys','get','replyUri','info'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4cf8,0x1e1));var _0x84cf=function(_0xca1091,_0x539dbf){_0xca1091=_0xca1091-0x0;var _0xd3019c=_0x4cf8[_0xca1091];return _0xd3019c;};'use strict';var _=require(_0x84cf('0x0'));var util=require(_0x84cf('0x1'));var logger=require(_0x84cf('0x2'))(_0x84cf('0x3'));var moment=require(_0x84cf('0x4'));var BPromise=require(_0x84cf('0x5'));var rp=require(_0x84cf('0x6'));var fs=require('fs');var path=require(_0x84cf('0x7'));var rimraf=require(_0x84cf('0x8'));var config=require(_0x84cf('0x9'));var attributes=require(_0x84cf('0xa'));module[_0x84cf('0xb')]=function(_0x50ade2,_0x4af3f1){return _0x50ade2[_0x84cf('0xc')]('OpenchannelMessage',attributes,{'tableName':_0x84cf('0xd'),'paranoid':![],'indexes':[{'name':_0x84cf('0xe'),'fields':['body'],'type':_0x84cf('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x39c6bc,_0x489063,_0xfb5398){var _0x1b223d=_0x50ade2[_0x84cf('0x10')];var _0x369ce6=_0x39c6bc['get']({'plain':!![]});if(_0x369ce6[_0x84cf('0x11')][_0x84cf('0x12')]()==='in'||_0x369ce6['direction']['toLowerCase']()===_0x84cf('0x13')&&!_0x369ce6[_0x84cf('0x14')]&&!_[_0x84cf('0x15')](_0x369ce6[_0x84cf('0x16')])){_0x1b223d[_0x84cf('0x17')][_0x84cf('0x18')]({'where':{'id':_0x369ce6[_0x84cf('0x19')]}})[_0x84cf('0x1a')](function(_0xced48){if(_0xced48){_0xced48[_0x84cf('0x1b')]({'lastMsgAt':_0x369ce6[_0x84cf('0x1c')],'lastMsgDirection':_0x369ce6[_0x84cf('0x11')][_0x84cf('0x12')]()});}})[_0x84cf('0x1d')](function(_0x27261b){console[_0x84cf('0x1e')](_0x27261b);});}if(_0x369ce6[_0x84cf('0x11')]===_0x84cf('0x13')&&!_0x369ce6[_0x84cf('0x14')]){var _0x5b8ac8;_0x1b223d[_0x84cf('0x1f')][_0x84cf('0x20')]()[_0x84cf('0x1a')](function(_0x1abe2d){return _0x1b223d[_0x84cf('0x21')][_0x84cf('0x22')]({'where':{'id':_0x369ce6[_0x84cf('0x23')]},'include':[{'model':_0x1b223d['OpenchannelInteraction'],'as':'Interactions','where':{'id':_0x369ce6[_0x84cf('0x19')]},'limit':0x1,'include':[{'model':_0x1b223d[_0x84cf('0x1f')],'as':_0x84cf('0x24'),'attributes':_[_0x84cf('0x25')](_0x1abe2d)}]}]});})[_0x84cf('0x1a')](function(_0x5dda3f){_0x5b8ac8=_0x5dda3f[_0x84cf('0x26')]({'plain':!![]});if(_0x5b8ac8&&_0x5b8ac8[_0x84cf('0x27')]){logger[_0x84cf('0x28')](_0x84cf('0x29'),_0x84cf('0x2a'),util['format'](_0x84cf('0x2b'),_0x369ce6['id'],_0x5b8ac8[_0x84cf('0x27')]));if(_0x5b8ac8[_0x84cf('0x2c')]&&_0x5b8ac8[_0x84cf('0x2c')][_0x84cf('0x2d')]){_0x369ce6[_0x84cf('0x2e')]=_[_0x84cf('0x2f')](_0x5b8ac8['Interactions'][0x0],_0x84cf('0x24'));_0x369ce6[_0x84cf('0x24')]=_0x5b8ac8[_0x84cf('0x2c')][0x0][_0x84cf('0x24')];}var _0x489063={'method':_0x84cf('0x30'),'uri':encodeURI(_0x5b8ac8[_0x84cf('0x27')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x489063[_0x84cf('0x31')]){case _0x84cf('0x32'):_0x489063['qs']=_0x369ce6;break;case _0x84cf('0x30'):_0x489063['body']=_0x369ce6;break;}return rp(_0x489063)[_0x84cf('0x1a')](function(_0x17bc92){logger[_0x84cf('0x28')](_0x84cf('0x29'),'afterCreate',util[_0x84cf('0x33')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x369ce6['id'],_0x5b8ac8[_0x84cf('0x27')]));if(_0x17bc92[_0x84cf('0x34')][_0x84cf('0x35')]&&_0x17bc92[_0x84cf('0x34')][_0x84cf('0x35')]!=_0x369ce6[_0x84cf('0x2e')][_0x84cf('0x35')]){return _0x1b223d[_0x84cf('0x17')][_0x84cf('0x1b')]({'threadId':_0x17bc92[_0x84cf('0x34')][_0x84cf('0x35')]},{'logging':!![],'where':{'id':_0x369ce6[_0x84cf('0x2e')]['id']}});}else{return;}})[_0x84cf('0x1a')](function(){return _0x39c6bc[_0x84cf('0x1b')]({'read':!![]});})['catch'](function(_0x4852ff){logger[_0x84cf('0x1e')](_0x84cf('0x29'),_0x84cf('0x2a'),util[_0x84cf('0x36')](_0x4852ff,{'showHidden':![],'depth':null}));_0xfb5398();});}else{_0xfb5398();}})[_0x84cf('0x37')](function(){_0xfb5398();});}else{_0xfb5398();}}},'charset':_0x84cf('0x38'),'collate':_0x84cf('0x39')});}; \ No newline at end of file +var _0x34b7=['moment','bluebird','request-promise','path','./openchannelMessage.attributes','exports','define','OpenchannelMessage','fti_openchannel_messages','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','update','createdAt','catch','error','CmContact','describe','then','OpenchannelAccountId','Interactions','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','POST','method','format','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x34b7,0x196));var _0x734b=function(_0x25601e,_0x3bd0f4){_0x25601e=_0x25601e-0x0;var _0x54d208=_0x34b7[_0x25601e];return _0x54d208;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x734b('0x0'))(_0x734b('0x1'));var moment=require(_0x734b('0x2'));var BPromise=require(_0x734b('0x3'));var rp=require(_0x734b('0x4'));var fs=require('fs');var path=require(_0x734b('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x734b('0x6'));module[_0x734b('0x7')]=function(_0x2f3128,_0x34fd70){return _0x2f3128[_0x734b('0x8')](_0x734b('0x9'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0x734b('0xa'),'fields':[_0x734b('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x53f163,_0x5f4b3a,_0x19a88e){var _0x598dee=_0x2f3128[_0x734b('0xc')];var _0x333738=_0x53f163[_0x734b('0xd')]({'plain':!![]});if(_0x333738[_0x734b('0xe')][_0x734b('0xf')]()==='in'||_0x333738[_0x734b('0xe')][_0x734b('0xf')]()===_0x734b('0x10')&&!_0x333738[_0x734b('0x11')]&&!_[_0x734b('0x12')](_0x333738[_0x734b('0x13')])){_0x598dee[_0x734b('0x14')][_0x734b('0x15')]({'where':{'id':_0x333738[_0x734b('0x16')]}})['then'](function(_0x18fc18){if(_0x18fc18){_0x18fc18[_0x734b('0x17')]({'lastMsgAt':_0x333738[_0x734b('0x18')],'lastMsgDirection':_0x333738[_0x734b('0xe')][_0x734b('0xf')]()});}})[_0x734b('0x19')](function(_0x2372bd){console[_0x734b('0x1a')](_0x2372bd);});}if(_0x333738[_0x734b('0xe')]===_0x734b('0x10')&&!_0x333738[_0x734b('0x11')]){var _0x4d2d23;_0x598dee[_0x734b('0x1b')][_0x734b('0x1c')]()[_0x734b('0x1d')](function(_0x5edbe9){return _0x598dee['OpenchannelAccount']['find']({'where':{'id':_0x333738[_0x734b('0x1e')]},'include':[{'model':_0x598dee[_0x734b('0x14')],'as':_0x734b('0x1f'),'where':{'id':_0x333738[_0x734b('0x16')]},'limit':0x1,'include':[{'model':_0x598dee[_0x734b('0x1b')],'as':_0x734b('0x20'),'attributes':_[_0x734b('0x21')](_0x5edbe9)}]}]});})[_0x734b('0x1d')](function(_0x67eed){_0x4d2d23=_0x67eed[_0x734b('0xd')]({'plain':!![]});if(_0x4d2d23&&_0x4d2d23[_0x734b('0x22')]){logger[_0x734b('0x23')](_0x734b('0x24'),_0x734b('0x25'),util['format'](_0x734b('0x26'),_0x333738['id'],_0x4d2d23[_0x734b('0x22')]));if(_0x4d2d23['Interactions']&&_0x4d2d23[_0x734b('0x1f')][_0x734b('0x27')]){_0x333738[_0x734b('0x28')]=_[_0x734b('0x29')](_0x4d2d23[_0x734b('0x1f')][0x0],_0x734b('0x20'));_0x333738[_0x734b('0x20')]=_0x4d2d23[_0x734b('0x1f')][0x0][_0x734b('0x20')];}var _0x5f4b3a={'method':_0x734b('0x2a'),'uri':encodeURI(_0x4d2d23[_0x734b('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x5f4b3a[_0x734b('0x2b')]){case'GET':_0x5f4b3a['qs']=_0x333738;break;case'POST':_0x5f4b3a[_0x734b('0xb')]=_0x333738;break;}return rp(_0x5f4b3a)[_0x734b('0x1d')](function(_0x47a0a9){logger[_0x734b('0x23')](_0x734b('0x24'),_0x734b('0x25'),util[_0x734b('0x2c')](_0x734b('0x2d'),_0x333738['id'],_0x4d2d23[_0x734b('0x22')]));if(_0x47a0a9[_0x734b('0xb')]['threadId']&&_0x47a0a9[_0x734b('0xb')][_0x734b('0x2e')]!=_0x333738[_0x734b('0x28')][_0x734b('0x2e')]){return _0x598dee[_0x734b('0x14')][_0x734b('0x17')]({'threadId':_0x47a0a9[_0x734b('0xb')][_0x734b('0x2e')]},{'logging':!![],'where':{'id':_0x333738[_0x734b('0x28')]['id']}});}else{return;}})[_0x734b('0x1d')](function(){return _0x53f163['update']({'read':!![]});})[_0x734b('0x19')](function(_0x37f1a1){logger['error'](_0x734b('0x24'),_0x734b('0x25'),util[_0x734b('0x2f')](_0x37f1a1,{'showHidden':![],'depth':null}));_0x19a88e();});}else{_0x19a88e();}})[_0x734b('0x30')](function(){_0x19a88e();});}else{_0x19a88e();}}},'charset':_0x734b('0x31'),'collate':_0x734b('0x32')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index c673f2c..d706194 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(_0x58be53,_0x247647){var _0x555a0=function(_0x1f8b2c){while(--_0x1f8b2c){_0x58be53['push'](_0x58be53['shift']());}};_0x555a0(++_0x247647);}(_0x7a54,0x106));var _0x47a5=function(_0x5212e5,_0x15c980){_0x5212e5=_0x5212e5-0x0;var _0x48dbe6=_0x7a54[_0x5212e5];return _0x48dbe6;};'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 _0xadb5=['debug','request\x20sent','stringify','error','code','message','info','result','catch','OpenchannelMessage','body','raw','CreateOpenchannelMessage','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x220be7,_0x1de136){var _0x22cc57=function(_0x314d5f){while(--_0x314d5f){_0x220be7['push'](_0x220be7['shift']());}};_0x22cc57(++_0x1de136);}(_0xadb5,0xad));var _0x5adb=function(_0x159d47,_0x369a91){_0x159d47=_0x159d47-0x0;var _0x1700a4=_0xadb5[_0x159d47];return _0x1700a4;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});config[_0x5adb('0xa')]=_[_0x5adb('0xb')](config[_0x5adb('0xa')],{'host':_0x5adb('0xc'),'port':0x18eb});var socket=require(_0x5adb('0xd'))(new Redis(config[_0x5adb('0xa')]));require(_0x5adb('0xe'))[_0x5adb('0xf')](socket);function respondWithRpcPromise(_0x336bad,_0x129f5a,_0x275428){return new BPromise(function(_0x563d86,_0x4c268d){return client[_0x5adb('0x10')](_0x336bad,_0x275428)[_0x5adb('0x11')](function(_0x82e67e){logger['info'](_0x5adb('0x12'),_0x129f5a,'request\x20sent');logger[_0x5adb('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x129f5a,_0x5adb('0x14'),JSON[_0x5adb('0x15')](_0x82e67e));if(_0x82e67e[_0x5adb('0x16')]){if(_0x82e67e['error'][_0x5adb('0x17')]===0x1f4){logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e['error'][_0x5adb('0x18')]);return _0x4c268d(_0x82e67e['error'][_0x5adb('0x18')]);}logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);return _0x563d86(_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);}else{logger[_0x5adb('0x19')](_0x5adb('0x12'),_0x129f5a,'request\x20sent');_0x563d86(_0x82e67e[_0x5adb('0x1a')]['message']);}})[_0x5adb('0x1b')](function(_0x558f76){logger[_0x5adb('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x129f5a,_0x558f76);_0x4c268d(_0x558f76);});});}exports['CreateOpenchannelMessage']=function(_0x1fbaa5){var _0x1bed20=this;return new Promise(function(_0x438671,_0x1fd4a7){return db[_0x5adb('0x1c')]['create'](_0x1fbaa5[_0x5adb('0x1d')],{'raw':_0x1fbaa5['options']?_0x1fbaa5['options'][_0x5adb('0x1e')]===undefined?!![]:![]:!![]})[_0x5adb('0x11')](function(_0x1a38d3){logger[_0x5adb('0x19')](_0x5adb('0x1f'),_0x1fbaa5);logger[_0x5adb('0x13')](_0x5adb('0x1f'),_0x1fbaa5,JSON['stringify'](_0x1a38d3));_0x438671(_0x1a38d3);})[_0x5adb('0x1b')](function(_0x373cc3){logger[_0x5adb('0x16')](_0x5adb('0x1f'),_0x373cc3[_0x5adb('0x18')],_0x1fbaa5);_0x1fd4a7(_0x1bed20['error'](0x1f4,_0x373cc3[_0x5adb('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index b15bd58..8263dda 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 _0x5565=['register','openchannelMessage:','save','update','emit','removeListener'];(function(_0xc940bf,_0x4a378f){var _0x36e7f2=function(_0x2533c5){while(--_0x2533c5){_0xc940bf['push'](_0xc940bf['shift']());}};_0x36e7f2(++_0x4a378f);}(_0x5565,0x104));var _0x5556=function(_0x30ef0f,_0x5e5783){_0x30ef0f=_0x30ef0f-0x0;var _0x57c111=_0x5565[_0x30ef0f];return _0x57c111;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0x5556('0x0'),'remove',_0x5556('0x1')];function createListener(_0x57dff2,_0x204bdf){return function(_0x133756){_0x204bdf[_0x5556('0x2')](_0x57dff2,_0x133756);};}function removeListener(_0x31cc51,_0x5e4b48){return function(){OpenchannelMessageEvents[_0x5556('0x3')](_0x31cc51,_0x5e4b48);};}exports[_0x5556('0x4')]=function(_0x2cbc6b){for(var _0x5f234e=0x0,_0x9bf65=events['length'];_0x5f234e<_0x9bf65;_0x5f234e++){var _0x5df86d=events[_0x5f234e];var _0x16b2a8=createListener(_0x5556('0x5')+_0x5df86d,_0x2cbc6b);OpenchannelMessageEvents['on'](_0x5df86d,_0x16b2a8);}}; \ No newline at end of file +var _0xedf2=['save','remove','update','openchannelMessage:'];(function(_0x28351c,_0x1bf1d0){var _0x3fd594=function(_0xb785b8){while(--_0xb785b8){_0x28351c['push'](_0x28351c['shift']());}};_0x3fd594(++_0x1bf1d0);}(_0xedf2,0x1ac));var _0x2edf=function(_0x4cc763,_0x54c97b){_0x4cc763=_0x4cc763-0x0;var _0xa8f5d1=_0xedf2[_0x4cc763];return _0xa8f5d1;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0x2edf('0x0'),_0x2edf('0x1'),_0x2edf('0x2')];function createListener(_0x4b454e,_0xce87f7){return function(_0x1ad605){_0xce87f7['emit'](_0x4b454e,_0x1ad605);};}function removeListener(_0x43611a,_0x2c1515){return function(){OpenchannelMessageEvents['removeListener'](_0x43611a,_0x2c1515);};}exports['register']=function(_0x3cfc52){for(var _0x3601aa=0x0,_0x5af8d9=events['length'];_0x3601aa<_0x5af8d9;_0x3601aa++){var _0x2b7b21=events[_0x3601aa];var _0x498c41=createListener(_0x2edf('0x3')+_0x2b7b21,_0x3cfc52);OpenchannelMessageEvents['on'](_0x2b7b21,_0x498c41);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 59a15a5..4fa3a18 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 _0x1e4a=['destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','/describe','/:id','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','update','delete'];(function(_0x1b4587,_0x2add59){var _0x771ed4=function(_0x368d5e){while(--_0x368d5e){_0x1b4587['push'](_0x1b4587['shift']());}};_0x771ed4(++_0x2add59);}(_0x1e4a,0xb2));var _0xa1e4=function(_0x560f5f,_0x3d7ac7){_0x560f5f=_0x560f5f-0x0;var _0x1c3d32=_0x1e4a[_0x560f5f];return _0x1c3d32;};'use strict';var multer=require(_0xa1e4('0x0'));var util=require(_0xa1e4('0x1'));var path=require(_0xa1e4('0x2'));var timeout=require(_0xa1e4('0x3'));var express=require(_0xa1e4('0x4'));var router=express[_0xa1e4('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xa1e4('0x6'));var interaction=require(_0xa1e4('0x7'));var config=require(_0xa1e4('0x8'));var controller=require(_0xa1e4('0x9'));router[_0xa1e4('0xa')]('/',auth[_0xa1e4('0xb')](),controller['index']);router[_0xa1e4('0xa')](_0xa1e4('0xc'),auth[_0xa1e4('0xb')](),controller['describe']);router['get'](_0xa1e4('0xd'),auth[_0xa1e4('0xb')](),controller['show']);router[_0xa1e4('0xa')]('/:id/members',auth['isAuthenticated'](),controller[_0xa1e4('0xe')]);router['get'](_0xa1e4('0xf'),auth[_0xa1e4('0xb')](),controller[_0xa1e4('0x10')]);router[_0xa1e4('0xa')](_0xa1e4('0x11'),auth[_0xa1e4('0xb')](),controller[_0xa1e4('0x12')]);router[_0xa1e4('0x13')]('/',auth[_0xa1e4('0xb')](),controller['create']);router[_0xa1e4('0x13')](_0xa1e4('0xf'),auth['isAuthenticated'](),controller[_0xa1e4('0x14')]);router[_0xa1e4('0x13')](_0xa1e4('0x11'),auth[_0xa1e4('0xb')](),controller[_0xa1e4('0x15')]);router[_0xa1e4('0x16')](_0xa1e4('0xd'),auth['isAuthenticated'](),controller[_0xa1e4('0x17')]);router[_0xa1e4('0x18')](_0xa1e4('0xd'),auth[_0xa1e4('0xb')](),controller[_0xa1e4('0x19')]);router[_0xa1e4('0x18')]('/:id/teams',auth[_0xa1e4('0xb')](),controller[_0xa1e4('0x1a')]);router['delete'](_0xa1e4('0x11'),auth[_0xa1e4('0xb')](),controller[_0xa1e4('0x1b')]);module[_0xa1e4('0x1c')]=router; \ No newline at end of file +var _0x8c00=['show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','put','delete','destroy','removeTeams','removeAgents','multer','util','path','express','../../components/auth/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x2ccd09,_0x1b8918){var _0x3acb10=function(_0x5e9996){while(--_0x5e9996){_0x2ccd09['push'](_0x2ccd09['shift']());}};_0x3acb10(++_0x1b8918);}(_0x8c00,0xef));var _0x08c0=function(_0x1f09fa,_0x3265ca){_0x1f09fa=_0x1f09fa-0x0;var _0x197c8d=_0x8c00[_0x1f09fa];return _0x197c8d;};'use strict';var multer=require(_0x08c0('0x0'));var util=require(_0x08c0('0x1'));var path=require(_0x08c0('0x2'));var timeout=require('connect-timeout');var express=require(_0x08c0('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x08c0('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x08c0('0x5'));var controller=require(_0x08c0('0x6'));router[_0x08c0('0x7')]('/',auth[_0x08c0('0x8')](),controller[_0x08c0('0x9')]);router['get'](_0x08c0('0xa'),auth[_0x08c0('0x8')](),controller[_0x08c0('0xb')]);router['get'](_0x08c0('0xc'),auth[_0x08c0('0x8')](),controller[_0x08c0('0xd')]);router[_0x08c0('0x7')](_0x08c0('0xe'),auth[_0x08c0('0x8')](),controller[_0x08c0('0xf')]);router[_0x08c0('0x7')](_0x08c0('0x10'),auth[_0x08c0('0x8')](),controller[_0x08c0('0x11')]);router[_0x08c0('0x7')](_0x08c0('0x12'),auth[_0x08c0('0x8')](),controller[_0x08c0('0x13')]);router[_0x08c0('0x14')]('/',auth[_0x08c0('0x8')](),controller[_0x08c0('0x15')]);router['post'](_0x08c0('0x10'),auth[_0x08c0('0x8')](),controller['addTeams']);router[_0x08c0('0x14')]('/:id/users',auth[_0x08c0('0x8')](),controller[_0x08c0('0x16')]);router[_0x08c0('0x17')](_0x08c0('0xc'),auth[_0x08c0('0x8')](),controller['update']);router[_0x08c0('0x18')](_0x08c0('0xc'),auth[_0x08c0('0x8')](),controller[_0x08c0('0x19')]);router['delete'](_0x08c0('0x10'),auth[_0x08c0('0x8')](),controller[_0x08c0('0x1a')]);router[_0x08c0('0x18')](_0x08c0('0x12'),auth[_0x08c0('0x8')](),controller[_0x08c0('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 427d682..41aa53f 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 _0x630e=['exports','name','STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x392488,_0x3a1222){var _0x2fa477=function(_0x4884f5){while(--_0x4884f5){_0x392488['push'](_0x392488['shift']());}};_0x2fa477(++_0x3a1222);}(_0x630e,0x90));var _0xe630=function(_0x565cde,_0x54eadc){_0x565cde=_0x565cde-0x0;var _0x4a36b8=_0x630e[_0x565cde];return _0x4a36b8;};'use strict';var Sequelize=require('sequelize');module[_0xe630('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xe630('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe630('0x2')]},'timeout':{'type':Sequelize[_0xe630('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe630('0x4')](_0xe630('0x5'),_0xe630('0x6'),_0xe630('0x7'))}}; \ No newline at end of file +var _0x9416=['roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x4cfca4,_0x3ffe76){var _0xfa949f=function(_0x20e44a){while(--_0x20e44a){_0x4cfca4['push'](_0x4cfca4['shift']());}};_0xfa949f(++_0x3ffe76);}(_0x9416,0xb1));var _0x6941=function(_0x36d347,_0x5e3fa1){_0x36d347=_0x36d347-0x0;var _0x3965cb=_0x9416[_0x36d347];return _0x3965cb;};'use strict';var Sequelize=require(_0x6941('0x0'));module[_0x6941('0x1')]={'name':{'type':Sequelize[_0x6941('0x2')],'unique':_0x6941('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6941('0x2')]},'timeout':{'type':Sequelize[_0x6941('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6941('0x5')](_0x6941('0x6'),'beepall',_0x6941('0x7'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 48d7fa5..6684abf 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 _0x6b04=['rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','../../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','./openchannelQueue.socket','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','UserProfileResource','sendStatus','error','stack','name','send','index','map','OpenchannelQueue','fieldName','type','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','includeAll','include','rows','catch','show','params','length','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','userProfileId','autoAssociation','body','describe','getMembers','UserOpenchannelQueue','pick','OpenchannelQueueId','findAll','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','SIP','getTeams','Team','rawAttributes','addTeams','ids','Agents','online','voicePause','flatMap','each','findOrCreate','forEach','userOpenchannelQueue:save','select','field','tq.TeamId','from','team_has_openchannel_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','removeTeams','isEmpty','removeAgents','emit','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','findOne'];(function(_0xead589,_0x399eff){var _0x4db7ca=function(_0x365767){while(--_0x365767){_0xead589['push'](_0xead589['shift']());}};_0x4db7ca(++_0x399eff);}(_0x6b04,0x1b3));var _0x46b0=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x6b04[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x46b0('0x0'));var zipdir=require(_0x46b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x46b0('0x2'));var moment=require(_0x46b0('0x3'));var BPromise=require(_0x46b0('0x4'));var Mustache=require(_0x46b0('0x5'));var util=require(_0x46b0('0x6'));var path=require(_0x46b0('0x7'));var sox=require(_0x46b0('0x8'));var csv=require(_0x46b0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x46b0('0xa'));var squel=require(_0x46b0('0xb'));var crypto=require(_0x46b0('0xc'));var jsforce=require(_0x46b0('0xd'));var deskjs=require(_0x46b0('0xe'));var toCsv=require(_0x46b0('0x9'));var querystring=require(_0x46b0('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x46b0('0x10'));var as=require(_0x46b0('0x11'));var hardwareService=require(_0x46b0('0x12'));var logger=require(_0x46b0('0x13'))(_0x46b0('0x14'));var utils=require(_0x46b0('0x15'));var config=require(_0x46b0('0x16'));var licenseUtil=require(_0x46b0('0x17'));var db=require(_0x46b0('0x18'))['db'];config[_0x46b0('0x19')]=_['defaults'](config[_0x46b0('0x19')],{'host':_0x46b0('0x1a'),'port':0x18eb});var socket=require(_0x46b0('0x1b'))(new Redis(config[_0x46b0('0x19')]));require(_0x46b0('0x1c'))['register'](socket);function respondWithStatusCode(_0x3dfd0d,_0x18df64){_0x18df64=_0x18df64||0xcc;return function(_0xb68f02){if(_0xb68f02){return _0x3dfd0d['sendStatus'](_0x18df64);}return _0x3dfd0d[_0x46b0('0x1d')](_0x18df64)[_0x46b0('0x1e')]();};}function respondWithResult(_0x3df308,_0x122ae7){_0x122ae7=_0x122ae7||0xc8;return function(_0x5d3615){if(_0x5d3615){return _0x3df308[_0x46b0('0x1d')](_0x122ae7)[_0x46b0('0x1f')](_0x5d3615);}};}function respondWithFilteredResult(_0x217f6f,_0x40fbf9){return function(_0x5d35ec){if(_0x5d35ec){var _0x19a591=typeof _0x40fbf9[_0x46b0('0x20')]===_0x46b0('0x21')&&typeof _0x40fbf9[_0x46b0('0x22')]==='undefined';var _0x4694e5=_0x5d35ec[_0x46b0('0x23')];var _0x3d22c9=_0x19a591?0x0:_0x40fbf9[_0x46b0('0x20')];var _0xf2c2f1=_0x19a591?_0x5d35ec[_0x46b0('0x23')]:_0x40fbf9[_0x46b0('0x20')]+_0x40fbf9[_0x46b0('0x22')];var _0x57f164;if(_0xf2c2f1>=_0x4694e5){_0xf2c2f1=_0x4694e5;_0x57f164=0xc8;}else{_0x57f164=0xce;}_0x217f6f[_0x46b0('0x1d')](_0x57f164);return _0x217f6f[_0x46b0('0x24')]('Content-Range',_0x3d22c9+'-'+_0xf2c2f1+'/'+_0x4694e5)[_0x46b0('0x1f')](_0x5d35ec);}return null;};}function patchUpdates(_0x13e886){return function(_0x30c165){try{jsonpatch[_0x46b0('0x25')](_0x30c165,_0x13e886,!![]);}catch(_0x200a44){return BPromise[_0x46b0('0x26')](_0x200a44);}return _0x30c165['save']();};}function saveUpdates(_0x359706,_0x1b69f9){return function(_0x4ac3f6){if(_0x4ac3f6){return _0x4ac3f6[_0x46b0('0x27')](_0x359706)[_0x46b0('0x28')](function(_0x17ea09){return _0x17ea09;});}return null;};}function removeEntity(_0x527517,_0x1368ab){return function(_0x1ba88f){if(_0x1ba88f){return _0x1ba88f[_0x46b0('0x29')]()[_0x46b0('0x28')](function(){var _0x56c614=_0x1ba88f['get']({'plain':!![]});var _0x4a94a9='OpenchannelQueues';return db[_0x46b0('0x2a')][_0x46b0('0x29')]({'where':{'type':_0x4a94a9,'resourceId':_0x56c614['id']}})['then'](function(){return _0x1ba88f;});})[_0x46b0('0x28')](function(){_0x527517[_0x46b0('0x1d')](0xcc)[_0x46b0('0x1e')]();});}};}function handleEntityNotFound(_0x185573,_0x4c900d){return function(_0x1a7598){if(!_0x1a7598){_0x185573[_0x46b0('0x2b')](0x194);}return _0x1a7598;};}function handleError(_0xdbf08d,_0x3df453){_0x3df453=_0x3df453||0x1f4;return function(_0x4b4d26){logger[_0x46b0('0x2c')](_0x4b4d26[_0x46b0('0x2d')]);if(_0x4b4d26[_0x46b0('0x2e')]){delete _0x4b4d26['name'];}_0xdbf08d[_0x46b0('0x1d')](_0x3df453)[_0x46b0('0x2f')](_0x4b4d26);};}exports[_0x46b0('0x30')]=function(_0x4b9388,_0x52f4d9){var _0x5d8ef4={},_0x3a07fa={},_0x45cdb2={'count':0x0,'rows':[]};var _0x46c9a5=_[_0x46b0('0x31')](db[_0x46b0('0x32')]['rawAttributes'],function(_0x3c2317){return{'name':_0x3c2317[_0x46b0('0x33')],'type':_0x3c2317[_0x46b0('0x34')]['key']};});_0x3a07fa['model']=_[_0x46b0('0x31')](_0x46c9a5,_0x46b0('0x2e'));_0x3a07fa[_0x46b0('0x35')]=_[_0x46b0('0x36')](_0x4b9388['query']);_0x3a07fa[_0x46b0('0x37')]=_[_0x46b0('0x38')](_0x3a07fa[_0x46b0('0x39')],_0x3a07fa['query']);_0x5d8ef4['attributes']=_[_0x46b0('0x38')](_0x3a07fa[_0x46b0('0x39')],qs[_0x46b0('0x3a')](_0x4b9388[_0x46b0('0x35')][_0x46b0('0x3a')]));_0x5d8ef4[_0x46b0('0x3b')]=_0x5d8ef4[_0x46b0('0x3b')]['length']?_0x5d8ef4[_0x46b0('0x3b')]:_0x3a07fa[_0x46b0('0x39')];if(!_0x4b9388[_0x46b0('0x35')][_0x46b0('0x3c')](_0x46b0('0x3d'))){_0x5d8ef4['limit']=qs[_0x46b0('0x22')](_0x4b9388[_0x46b0('0x35')][_0x46b0('0x22')]);_0x5d8ef4[_0x46b0('0x20')]=qs[_0x46b0('0x20')](_0x4b9388[_0x46b0('0x35')][_0x46b0('0x20')]);}_0x5d8ef4[_0x46b0('0x3e')]=qs[_0x46b0('0x3f')](_0x4b9388[_0x46b0('0x35')][_0x46b0('0x3f')]);_0x5d8ef4['where']=qs[_0x46b0('0x37')](_['pick'](_0x4b9388[_0x46b0('0x35')],_0x3a07fa[_0x46b0('0x37')]),_0x46c9a5);if(_0x4b9388[_0x46b0('0x35')]['filter']){_0x5d8ef4[_0x46b0('0x40')]=_[_0x46b0('0x41')](_0x5d8ef4[_0x46b0('0x40')],{'$or':_[_0x46b0('0x31')](_0x46c9a5,function(_0x36ef65){if(_0x36ef65[_0x46b0('0x34')]!=='VIRTUAL'){var _0x57edd0={};_0x57edd0[_0x36ef65[_0x46b0('0x2e')]]={'$like':'%'+_0x4b9388['query'][_0x46b0('0x42')]+'%'};return _0x57edd0;}})});}_0x5d8ef4=_['merge']({},_0x5d8ef4,_0x4b9388[_0x46b0('0x43')]);var _0x505a3e={'where':_0x5d8ef4[_0x46b0('0x40')]};return db[_0x46b0('0x32')][_0x46b0('0x23')](_0x505a3e)[_0x46b0('0x28')](function(_0x5a8956){_0x45cdb2[_0x46b0('0x23')]=_0x5a8956;if(_0x4b9388[_0x46b0('0x35')][_0x46b0('0x44')]){_0x5d8ef4[_0x46b0('0x45')]=[{'all':!![]}];}return db[_0x46b0('0x32')]['findAll'](_0x5d8ef4);})[_0x46b0('0x28')](function(_0x524d24){_0x45cdb2[_0x46b0('0x46')]=_0x524d24;return _0x45cdb2;})[_0x46b0('0x28')](respondWithFilteredResult(_0x52f4d9,_0x5d8ef4))[_0x46b0('0x47')](handleError(_0x52f4d9,null));};exports[_0x46b0('0x48')]=function(_0x473edd,_0x3a4265){var _0x1825d1={'raw':!![],'where':{'id':_0x473edd[_0x46b0('0x49')]['id']}},_0x5db8d5={};_0x5db8d5[_0x46b0('0x39')]=_[_0x46b0('0x36')](db[_0x46b0('0x32')]['rawAttributes']);_0x5db8d5[_0x46b0('0x35')]=_['keys'](_0x473edd[_0x46b0('0x35')]);_0x5db8d5[_0x46b0('0x37')]=_[_0x46b0('0x38')](_0x5db8d5['model'],_0x5db8d5[_0x46b0('0x35')]);_0x1825d1[_0x46b0('0x3b')]=_[_0x46b0('0x38')](_0x5db8d5['model'],qs[_0x46b0('0x3a')](_0x473edd['query'][_0x46b0('0x3a')]));_0x1825d1[_0x46b0('0x3b')]=_0x1825d1['attributes'][_0x46b0('0x4a')]?_0x1825d1['attributes']:_0x5db8d5[_0x46b0('0x39')];if(_0x473edd[_0x46b0('0x35')][_0x46b0('0x44')]){_0x1825d1[_0x46b0('0x45')]=[{'all':!![]}];}_0x1825d1=_[_0x46b0('0x41')]({},_0x1825d1,_0x473edd['options']);return db[_0x46b0('0x32')]['find'](_0x1825d1)[_0x46b0('0x28')](handleEntityNotFound(_0x3a4265,null))['then'](respondWithResult(_0x3a4265,null))[_0x46b0('0x47')](handleError(_0x3a4265,null));};exports['create']=function(_0x4f8777,_0xe8e838){return db[_0x46b0('0x32')][_0x46b0('0x4b')](_0x4f8777['body'],{})[_0x46b0('0x28')](function(_0x3911e0){var _0x4fde84=_0x4f8777['user'][_0x46b0('0x4c')]({'plain':!![]});if(!_0x4fde84)throw new Error(_0x46b0('0x4d'));if(_0x4fde84[_0x46b0('0x4e')]===_0x46b0('0x4f')){var _0x2168b2=_0x3911e0['get']({'plain':!![]});var _0x705dc5='OpenchannelQueues';return db['UserProfileSection'][_0x46b0('0x50')]({'where':{'name':_0x705dc5,'userProfileId':_0x4fde84[_0x46b0('0x51')]},'raw':!![]})[_0x46b0('0x28')](function(_0x580bc6){if(_0x580bc6&&_0x580bc6[_0x46b0('0x52')]===0x0){return db[_0x46b0('0x2a')][_0x46b0('0x4b')]({'name':_0x2168b2[_0x46b0('0x2e')],'resourceId':_0x2168b2['id'],'type':_0x580bc6['name'],'sectionId':_0x580bc6['id']},{})['then'](function(){return _0x3911e0;});}else{return _0x3911e0;}})[_0x46b0('0x47')](function(_0xe41ae2){logger[_0x46b0('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xe41ae2);throw _0xe41ae2;});}return _0x3911e0;})[_0x46b0('0x28')](respondWithResult(_0xe8e838,0xc9))[_0x46b0('0x47')](handleError(_0xe8e838,null));};exports[_0x46b0('0x27')]=function(_0x2d7089,_0x4848a9){if(_0x2d7089[_0x46b0('0x53')]['id']){delete _0x2d7089[_0x46b0('0x53')]['id'];}return db[_0x46b0('0x32')][_0x46b0('0x50')]({'where':{'id':_0x2d7089[_0x46b0('0x49')]['id']}})[_0x46b0('0x28')](handleEntityNotFound(_0x4848a9,null))[_0x46b0('0x28')](saveUpdates(_0x2d7089[_0x46b0('0x53')],null))['then'](respondWithResult(_0x4848a9,null))[_0x46b0('0x47')](handleError(_0x4848a9,null));};exports[_0x46b0('0x29')]=function(_0x562650,_0x5db296){return db[_0x46b0('0x32')]['find']({'where':{'id':_0x562650[_0x46b0('0x49')]['id']}})[_0x46b0('0x28')](handleEntityNotFound(_0x5db296,null))[_0x46b0('0x28')](removeEntity(_0x5db296,null))[_0x46b0('0x47')](handleError(_0x5db296,null));};exports['describe']=function(_0x373644,_0x2bd615){return db['OpenchannelQueue'][_0x46b0('0x54')]()['then'](respondWithResult(_0x2bd615,null))[_0x46b0('0x47')](handleError(_0x2bd615,null));};exports[_0x46b0('0x55')]=function(_0x3648ef,_0x2f4d78,_0x2a46d9){var _0x184ccc={'raw':!![],'where':{}},_0x80e446={},_0x1f2e89;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x3648ef['params']['id']}})['then'](handleEntityNotFound(_0x2f4d78,null))[_0x46b0('0x28')](function(_0x2ef21d){if(_0x2ef21d){_0x1f2e89=_0x2ef21d[_0x46b0('0x4c')]({'plain':!![]});_0x80e446[_0x46b0('0x39')]=_[_0x46b0('0x36')](db[_0x46b0('0x56')]['rawAttributes']);_0x80e446[_0x46b0('0x35')]=_['keys'](_0x3648ef[_0x46b0('0x35')]);_0x80e446[_0x46b0('0x37')]=_[_0x46b0('0x38')](_0x80e446[_0x46b0('0x39')],_0x80e446[_0x46b0('0x35')]);_0x184ccc[_0x46b0('0x3b')]=_[_0x46b0('0x38')](_0x80e446['model'],qs[_0x46b0('0x3a')](_0x3648ef['query'][_0x46b0('0x3a')]));_0x184ccc[_0x46b0('0x3b')]=_0x184ccc[_0x46b0('0x3b')]['length']?_0x184ccc[_0x46b0('0x3b')]:_0x80e446[_0x46b0('0x39')];if(!_0x3648ef[_0x46b0('0x35')]['hasOwnProperty'](_0x46b0('0x3d'))){_0x184ccc[_0x46b0('0x22')]=qs['limit'](_0x3648ef[_0x46b0('0x35')]['limit']);_0x184ccc[_0x46b0('0x20')]=qs[_0x46b0('0x20')](_0x3648ef['query']['offset']);}_0x184ccc[_0x46b0('0x3e')]=qs[_0x46b0('0x3f')](_0x3648ef[_0x46b0('0x35')][_0x46b0('0x3f')]);_0x184ccc[_0x46b0('0x40')]=qs[_0x46b0('0x37')](_[_0x46b0('0x57')](_0x3648ef[_0x46b0('0x35')],_0x80e446[_0x46b0('0x37')]));_0x184ccc['where'][_0x46b0('0x58')]=_0x2ef21d['id'];if(_0x3648ef[_0x46b0('0x35')][_0x46b0('0x42')]){_0x184ccc[_0x46b0('0x40')]=_['merge'](_0x184ccc[_0x46b0('0x40')],{'$or':_[_0x46b0('0x31')](_0x184ccc[_0x46b0('0x3b')],function(_0x34e1ee){var _0x141bef={};_0x141bef[_0x34e1ee]={'$like':'%'+_0x3648ef['query'][_0x46b0('0x42')]+'%'};return _0x141bef;})});}_0x184ccc=_[_0x46b0('0x41')]({},_0x184ccc,_0x3648ef['options']);return db[_0x46b0('0x56')][_0x46b0('0x59')](_0x184ccc);}})[_0x46b0('0x28')](function(_0x48c31c){if(_0x48c31c){return db[_0x46b0('0x5a')][_0x46b0('0x5b')]({'where':{'id':_[_0x46b0('0x31')](_0x48c31c,_0x46b0('0x5c')),'role':_0x46b0('0x5d')},'attributes':['id',_0x46b0('0x2e'),_0x46b0('0x5e'),_0x46b0('0x5f'),_0x46b0('0x60')]});}})[_0x46b0('0x28')](function(_0x3be5f2){if(_0x3be5f2){return{'count':_0x3be5f2[_0x46b0('0x23')],'rows':_['map'](_0x3be5f2[_0x46b0('0x46')],function(_0x3993d2){return{'membername':_0x3993d2[_0x46b0('0x2e')],'UserId':_0x3993d2['id'],'queue_name':_0x1f2e89[_0x46b0('0x2e')],'OpenchannelQueueId':_0x1f2e89['id'],'interface':util[_0x46b0('0x61')]('%s/%s',_0x46b0('0x62'),_0x3993d2['name']),'penalty':0x0,'paused':_0x3993d2[_0x46b0('0x5e')],'createdAt':_0x3993d2[_0x46b0('0x60')],'updatedAt':_0x3993d2['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x46b0('0x28')](respondWithFilteredResult(_0x2f4d78,_0x184ccc))[_0x46b0('0x47')](handleError(_0x2f4d78,null));};exports[_0x46b0('0x63')]=function(_0x2e326a,_0x37a75e,_0x1c697d){var _0x42ea23={};var _0x5c3d54={};var _0x194659;var _0x58b05b;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x2e326a[_0x46b0('0x49')]['id']}})['then'](handleEntityNotFound(_0x37a75e,null))[_0x46b0('0x28')](function(_0x6dea69){if(_0x6dea69){_0x194659=_0x6dea69;_0x5c3d54['model']=_[_0x46b0('0x36')](db[_0x46b0('0x64')][_0x46b0('0x65')]);_0x5c3d54['query']=_['keys'](_0x2e326a[_0x46b0('0x35')]);_0x5c3d54[_0x46b0('0x37')]=_[_0x46b0('0x38')](_0x5c3d54[_0x46b0('0x39')],_0x5c3d54['query']);_0x42ea23[_0x46b0('0x3b')]=_[_0x46b0('0x38')](_0x5c3d54[_0x46b0('0x39')],qs['fields'](_0x2e326a[_0x46b0('0x35')]['fields']));_0x42ea23[_0x46b0('0x3b')]=_0x42ea23[_0x46b0('0x3b')][_0x46b0('0x4a')]?_0x42ea23[_0x46b0('0x3b')]:_0x5c3d54[_0x46b0('0x39')];_0x42ea23[_0x46b0('0x3e')]=qs[_0x46b0('0x3f')](_0x2e326a[_0x46b0('0x35')][_0x46b0('0x3f')]);_0x42ea23[_0x46b0('0x40')]=qs[_0x46b0('0x37')](_['pick'](_0x2e326a[_0x46b0('0x35')],_0x5c3d54[_0x46b0('0x37')]));if(_0x2e326a[_0x46b0('0x35')]['filter']){_0x42ea23[_0x46b0('0x40')]=_[_0x46b0('0x41')](_0x42ea23[_0x46b0('0x40')],{'$or':_[_0x46b0('0x31')](_0x42ea23['attributes'],function(_0x1555be){var _0x517911={};_0x517911[_0x1555be]={'$like':'%'+_0x2e326a[_0x46b0('0x35')][_0x46b0('0x42')]+'%'};return _0x517911;})});}_0x42ea23=_[_0x46b0('0x41')]({},_0x42ea23,_0x2e326a[_0x46b0('0x43')]);return _0x194659[_0x46b0('0x63')](_0x42ea23);}})[_0x46b0('0x28')](function(_0x179161){if(_0x179161){_0x58b05b=_0x179161[_0x46b0('0x4a')];if(!_0x2e326a[_0x46b0('0x35')][_0x46b0('0x3c')](_0x46b0('0x3d'))){_0x42ea23[_0x46b0('0x22')]=qs[_0x46b0('0x22')](_0x2e326a['query'][_0x46b0('0x22')]);_0x42ea23['offset']=qs[_0x46b0('0x20')](_0x2e326a[_0x46b0('0x35')][_0x46b0('0x20')]);}return _0x194659[_0x46b0('0x63')](_0x42ea23);}})[_0x46b0('0x28')](function(_0x313038){if(_0x313038){return _0x313038?{'count':_0x58b05b,'rows':_0x313038}:null;}})[_0x46b0('0x28')](respondWithResult(_0x37a75e,null))[_0x46b0('0x47')](handleError(_0x37a75e,null));};exports[_0x46b0('0x66')]=function(_0x2cd4e8,_0x22bed5,_0x51140e){var _0x1f937e=_0x2cd4e8['body'][_0x46b0('0x67')];return db[_0x46b0('0x64')][_0x46b0('0x59')]({'where':{'id':_0x1f937e},'attributes':['id'],'include':[{'model':db[_0x46b0('0x5a')],'as':_0x46b0('0x68'),'attributes':['id','name',_0x46b0('0x69'),_0x46b0('0x6a'),'interface'],'raw':!![]}]})[_0x46b0('0x28')](function(_0x4afc75){if(_0x4afc75){var _0x3d9e7e=_[_0x46b0('0x6b')](_0x4afc75,function(_0x5a6242){var _0x400bd1=_0x5a6242['get']({'plain':!![]});return _0x400bd1[_0x46b0('0x68')];});return db[_0x46b0('0x32')][_0x46b0('0x50')]({'where':{'id':_0x2cd4e8[_0x46b0('0x49')]['id']}})[_0x46b0('0x28')](function(_0x1e0e50){return db['sequelize']['transaction'](function(_0x107f1c){return _0x1e0e50['addTeams'](_0x1f937e,{'transaction':_0x107f1c})[_0x46b0('0x28')](function(){return BPromise[_0x46b0('0x6c')](_0x3d9e7e,function(_0x24523e){return db[_0x46b0('0x56')][_0x46b0('0x6d')]({'where':{'UserId':_0x24523e['id'],'OpenchannelQueueId':_0x2cd4e8[_0x46b0('0x49')]['id']},'transaction':_0x107f1c});});})[_0x46b0('0x28')](function(){_0x3d9e7e[_0x46b0('0x6e')](function(_0x559890){socket['emit'](_0x46b0('0x6f'),{'UserId':_0x559890['id'],'OpenchannelQueueId':_0x1e0e50['id']});});});});});}})[_0x46b0('0x28')](respondWithStatusCode(_0x22bed5,null))[_0x46b0('0x47')](handleError(_0x22bed5,null));};exports['removeTeams']=function(_0x41b2ab,_0x396dbf,_0x2aac6f){return db[_0x46b0('0x64')][_0x46b0('0x59')]({'where':{'id':_0x41b2ab['query'][_0x46b0('0x67')]},'attributes':['id'],'include':[{'model':db[_0x46b0('0x5a')],'as':_0x46b0('0x68'),'attributes':['id'],'raw':!![]}]})[_0x46b0('0x28')](handleEntityNotFound(_0x396dbf,null))[_0x46b0('0x28')](function(_0x4afd23){var _0x512756=_[_0x46b0('0x31')](_0x4afd23,'id');var _0x90f1aa=[];var _0x54e084=[];var _0x222b17=squel[_0x46b0('0x70')]();_0x222b17[_0x46b0('0x71')](_0x46b0('0x72'))[_0x46b0('0x73')](_0x46b0('0x74'),'tq')['join'](_0x46b0('0x75'),'ut',_0x46b0('0x76'))[_0x46b0('0x40')](_0x46b0('0x77'),_0x41b2ab[_0x46b0('0x49')]['id']);for(var _0x5b99e6=0x0;_0x5b99e6<_0x4afd23[_0x46b0('0x4a')];_0x5b99e6+=0x1){let _0x582edd=_0x4afd23[_0x5b99e6];for(var _0x45fdf8=0x0;_0x45fdf8<_0x582edd[_0x46b0('0x68')][_0x46b0('0x4a')];_0x45fdf8+=0x1){let _0x1f1f28=_0x582edd[_0x46b0('0x68')][_0x45fdf8];var _0xe644d7=_0x222b17[_0x46b0('0x78')]();_0xe644d7[_0x46b0('0x40')](_0x46b0('0x79'),_0x1f1f28['id']);_0x54e084[_0x46b0('0x7a')](db[_0x46b0('0x7b')]['query'](_0xe644d7[_0x46b0('0x7c')](),{'type':db[_0x46b0('0x7b')][_0x46b0('0x7d')][_0x46b0('0x7e')]})[_0x46b0('0x28')](function(_0x3a54f0){if(_0x3a54f0['length']===0x1){return _0x1f1f28['id'];}else{var _0x217c5f=_[_0x46b0('0x7f')](_['map'](_0x3a54f0,_0x46b0('0x80')),function(_0x3518cf){return _[_0x46b0('0x81')](_0x512756,_0x3518cf);});if(_0x217c5f){return _0x1f1f28['id'];}}}));}}return BPromise[_0x46b0('0x82')](_0x54e084)[_0x46b0('0x28')](function(_0x24ece8){_0x90f1aa=_(_0x90f1aa)[_0x46b0('0x83')](_0x24ece8)[_0x46b0('0x84')]()[_0x46b0('0x85')]();return db[_0x46b0('0x32')]['find']({'where':{'id':_0x41b2ab[_0x46b0('0x49')]['id']}})[_0x46b0('0x28')](function(_0x23e8db){return db['sequelize']['transaction'](function(_0x3996f3){return _0x23e8db[_0x46b0('0x86')](_0x41b2ab[_0x46b0('0x35')][_0x46b0('0x67')],{'transaction':_0x3996f3})[_0x46b0('0x28')](function(){if(!_[_0x46b0('0x87')](_0x90f1aa)){return _0x23e8db[_0x46b0('0x88')](_0x90f1aa,{'transaction':_0x3996f3});}})[_0x46b0('0x28')](function(){_0x90f1aa[_0x46b0('0x6e')](function(_0x1f1471){socket[_0x46b0('0x89')](_0x46b0('0x8a'),{'UserId':_0x1f1471,'OpenchannelQueueId':_0x23e8db['id']});});});});});});})[_0x46b0('0x28')](respondWithStatusCode(_0x396dbf,null))['catch'](handleError(_0x396dbf,null));};exports[_0x46b0('0x8b')]=function(_0x55e06c,_0xe6cad7,_0x382dec){return db[_0x46b0('0x32')]['find']({'where':{'id':_0x55e06c[_0x46b0('0x49')]['id']}})[_0x46b0('0x28')](handleEntityNotFound(_0xe6cad7,null))[_0x46b0('0x28')](function(_0x571a84){if(_0x571a84){return _0x571a84[_0x46b0('0x8b')](_0x55e06c[_0x46b0('0x53')][_0x46b0('0x67')],_[_0x46b0('0x8c')](_0x55e06c['body'],['ids','id'])||{})[_0x46b0('0x8d')](function(_0x3378b5){for(var _0x407e23=0x0;_0x407e23<_0x55e06c[_0x46b0('0x53')][_0x46b0('0x67')][_0x46b0('0x4a')];_0x407e23+=0x1){socket['emit'](_0x46b0('0x6f'),{'UserId':Number(_0x55e06c['body'][_0x46b0('0x67')][_0x407e23]),'OpenchannelQueueId':Number(_0x55e06c[_0x46b0('0x49')]['id'])});}return _0x3378b5;});}})[_0x46b0('0x28')](respondWithResult(_0xe6cad7,null))[_0x46b0('0x47')](handleError(_0xe6cad7,null));};exports[_0x46b0('0x88')]=function(_0x386a69,_0x18c482,_0x553477){return db[_0x46b0('0x32')][_0x46b0('0x50')]({'where':{'id':_0x386a69[_0x46b0('0x49')]['id']}})[_0x46b0('0x28')](handleEntityNotFound(_0x18c482,null))['then'](function(_0x2ca1a2){if(_0x2ca1a2){return _0x2ca1a2[_0x46b0('0x88')](_0x386a69['query'][_0x46b0('0x67')])[_0x46b0('0x28')](function(){if(_[_0x46b0('0x8e')](_0x386a69[_0x46b0('0x35')][_0x46b0('0x67')])){for(var _0x947a88=0x0;_0x947a88<_0x386a69['query']['ids']['length'];_0x947a88+=0x1){socket[_0x46b0('0x89')](_0x46b0('0x8a'),{'UserId':Number(_0x386a69[_0x46b0('0x35')][_0x46b0('0x67')][_0x947a88]),'OpenchannelQueueId':Number(_0x386a69[_0x46b0('0x49')]['id'])});}}else{socket[_0x46b0('0x89')](_0x46b0('0x8a'),{'UserId':Number(_0x386a69[_0x46b0('0x35')][_0x46b0('0x67')]),'OpenchannelQueueId':Number(_0x386a69[_0x46b0('0x49')]['id'])});}});}})[_0x46b0('0x28')](respondWithStatusCode(_0x18c482,null))[_0x46b0('0x47')](handleError(_0x18c482,null));};exports[_0x46b0('0x8f')]=function(_0xa74ecd,_0x5f37d3,_0x415591){var _0x123aae={};var _0xd65407={};var _0x39eca6;var _0x34c52e;return db[_0x46b0('0x32')][_0x46b0('0x90')]({'where':{'id':_0xa74ecd[_0x46b0('0x49')]['id']}})[_0x46b0('0x28')](handleEntityNotFound(_0x5f37d3,null))[_0x46b0('0x28')](function(_0x3cd3bc){if(_0x3cd3bc){_0x39eca6=_0x3cd3bc;_0xd65407[_0x46b0('0x39')]=_['keys'](db[_0x46b0('0x5a')][_0x46b0('0x65')]);_0xd65407[_0x46b0('0x35')]=_[_0x46b0('0x36')](_0xa74ecd[_0x46b0('0x35')]);_0xd65407[_0x46b0('0x37')]=_['intersection'](_0xd65407['model'],_0xd65407[_0x46b0('0x35')]);_0x123aae[_0x46b0('0x3b')]=_[_0x46b0('0x38')](_0xd65407['model'],qs['fields'](_0xa74ecd['query'][_0x46b0('0x3a')]));_0x123aae[_0x46b0('0x3b')]=_0x123aae[_0x46b0('0x3b')][_0x46b0('0x4a')]?_0x123aae[_0x46b0('0x3b')]:_0xd65407[_0x46b0('0x39')];_0x123aae['order']=qs[_0x46b0('0x3f')](_0xa74ecd['query'][_0x46b0('0x3f')]);_0x123aae['where']=qs[_0x46b0('0x37')](_[_0x46b0('0x57')](_0xa74ecd[_0x46b0('0x35')],_0xd65407['filters']));if(_0xa74ecd[_0x46b0('0x35')][_0x46b0('0x42')]){_0x123aae[_0x46b0('0x40')]=_[_0x46b0('0x41')](_0x123aae['where'],{'$or':_['map'](_0x123aae[_0x46b0('0x3b')],function(_0x5de3a5){var _0x20928e={};_0x20928e[_0x5de3a5]={'$like':'%'+_0xa74ecd['query']['filter']+'%'};return _0x20928e;})});}_0x123aae=_['merge']({},_0x123aae,_0xa74ecd['options']);return _0x39eca6['getAgents'](_0x123aae);}})[_0x46b0('0x28')](function(_0x3be9ea){if(_0x3be9ea){_0x34c52e=_0x3be9ea[_0x46b0('0x4a')];if(!_0xa74ecd[_0x46b0('0x35')]['hasOwnProperty'](_0x46b0('0x3d'))){_0x123aae[_0x46b0('0x22')]=qs[_0x46b0('0x22')](_0xa74ecd[_0x46b0('0x35')][_0x46b0('0x22')]);_0x123aae[_0x46b0('0x20')]=qs['offset'](_0xa74ecd[_0x46b0('0x35')][_0x46b0('0x20')]);}return _0x39eca6['getAgents'](_0x123aae);}})[_0x46b0('0x28')](function(_0x2b70d4){if(_0x2b70d4){return _0x2b70d4?{'count':_0x34c52e,'rows':_0x2b70d4}:null;}})[_0x46b0('0x28')](respondWithResult(_0x5f37d3,null))[_0x46b0('0x47')](handleError(_0x5f37d3,null));}; \ No newline at end of file +var _0x8c0f=['OpenchannelQueueId','User','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','Team','getTeams','addTeams','ids','online','interface','Agents','sequelize','transaction','each','findOrCreate','emit','userOpenchannelQueue:save','select','tq.TeamId','from','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','push','toString','QueryTypes','every','TeamId','includes','union','compact','value','removeTeams','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','bluebird','mustache','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./openchannelQueue.socket','register','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','get','OpenchannelQueues','UserProfileResource','sendStatus','error','send','index','OpenchannelQueue','rawAttributes','fieldName','type','key','model','map','name','keys','query','intersection','attributes','fields','length','nolimit','limit','order','sort','where','filters','pick','filter','merge','options','include','findAll','rows','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserOpenchannelQueue','hasOwnProperty'];(function(_0x50d0f3,_0x38148a){var _0x352976=function(_0x16c302){while(--_0x16c302){_0x50d0f3['push'](_0x50d0f3['shift']());}};_0x352976(++_0x38148a);}(_0x8c0f,0x1cc));var _0xf8c0=function(_0x1c2d3b,_0x2c3643){_0x1c2d3b=_0x1c2d3b-0x0;var _0x445aa8=_0x8c0f[_0x1c2d3b];return _0x445aa8;};'use strict';var emlformat=require(_0xf8c0('0x0'));var rimraf=require(_0xf8c0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf8c0('0x2'));var Mustache=require(_0xf8c0('0x3'));var util=require('util');var path=require(_0xf8c0('0x4'));var sox=require(_0xf8c0('0x5'));var csv=require(_0xf8c0('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf8c0('0x7'));var _=require('lodash');var squel=require(_0xf8c0('0x8'));var crypto=require('crypto');var jsforce=require(_0xf8c0('0x9'));var deskjs=require(_0xf8c0('0xa'));var toCsv=require(_0xf8c0('0x6'));var querystring=require(_0xf8c0('0xb'));var Papa=require(_0xf8c0('0xc'));var Redis=require(_0xf8c0('0xd'));var authService=require(_0xf8c0('0xe'));var qs=require(_0xf8c0('0xf'));var as=require(_0xf8c0('0x10'));var hardwareService=require(_0xf8c0('0x11'));var logger=require(_0xf8c0('0x12'))('api');var utils=require(_0xf8c0('0x13'));var config=require(_0xf8c0('0x14'));var licenseUtil=require(_0xf8c0('0x15'));var db=require(_0xf8c0('0x16'))['db'];config[_0xf8c0('0x17')]=_[_0xf8c0('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf8c0('0x19'))[_0xf8c0('0x1a')](socket);function respondWithStatusCode(_0x3dc21e,_0x5648c1){_0x5648c1=_0x5648c1||0xcc;return function(_0x405321){if(_0x405321){return _0x3dc21e['sendStatus'](_0x5648c1);}return _0x3dc21e[_0xf8c0('0x1b')](_0x5648c1)[_0xf8c0('0x1c')]();};}function respondWithResult(_0x1ed130,_0xc39478){_0xc39478=_0xc39478||0xc8;return function(_0x370b69){if(_0x370b69){return _0x1ed130[_0xf8c0('0x1b')](_0xc39478)[_0xf8c0('0x1d')](_0x370b69);}};}function respondWithFilteredResult(_0x10f79d,_0x1d5352){return function(_0x5bdb38){if(_0x5bdb38){var _0x21faff=typeof _0x1d5352[_0xf8c0('0x1e')]===_0xf8c0('0x1f')&&typeof _0x1d5352['limit']===_0xf8c0('0x1f');var _0xa53f28=_0x5bdb38[_0xf8c0('0x20')];var _0x560a94=_0x21faff?0x0:_0x1d5352[_0xf8c0('0x1e')];var _0x38f013=_0x21faff?_0x5bdb38[_0xf8c0('0x20')]:_0x1d5352[_0xf8c0('0x1e')]+_0x1d5352['limit'];var _0x2be31e;if(_0x38f013>=_0xa53f28){_0x38f013=_0xa53f28;_0x2be31e=0xc8;}else{_0x2be31e=0xce;}_0x10f79d[_0xf8c0('0x1b')](_0x2be31e);return _0x10f79d[_0xf8c0('0x21')](_0xf8c0('0x22'),_0x560a94+'-'+_0x38f013+'/'+_0xa53f28)[_0xf8c0('0x1d')](_0x5bdb38);}return null;};}function patchUpdates(_0x16649e){return function(_0x45076d){try{jsonpatch[_0xf8c0('0x23')](_0x45076d,_0x16649e,!![]);}catch(_0x5e3445){return BPromise['reject'](_0x5e3445);}return _0x45076d[_0xf8c0('0x24')]();};}function saveUpdates(_0x19aec,_0x1285c1){return function(_0x42a31e){if(_0x42a31e){return _0x42a31e[_0xf8c0('0x25')](_0x19aec)[_0xf8c0('0x26')](function(_0x3f495d){return _0x3f495d;});}return null;};}function removeEntity(_0x4a2d96,_0x4356f2){return function(_0x5d366d){if(_0x5d366d){return _0x5d366d[_0xf8c0('0x27')]()['then'](function(){var _0x3034f2=_0x5d366d[_0xf8c0('0x28')]({'plain':!![]});var _0xd6186c=_0xf8c0('0x29');return db[_0xf8c0('0x2a')][_0xf8c0('0x27')]({'where':{'type':_0xd6186c,'resourceId':_0x3034f2['id']}})[_0xf8c0('0x26')](function(){return _0x5d366d;});})['then'](function(){_0x4a2d96[_0xf8c0('0x1b')](0xcc)[_0xf8c0('0x1c')]();});}};}function handleEntityNotFound(_0x2ae963,_0x195b80){return function(_0xbbd2b4){if(!_0xbbd2b4){_0x2ae963[_0xf8c0('0x2b')](0x194);}return _0xbbd2b4;};}function handleError(_0x111d84,_0x49e09d){_0x49e09d=_0x49e09d||0x1f4;return function(_0x3f3076){logger[_0xf8c0('0x2c')](_0x3f3076['stack']);if(_0x3f3076['name']){delete _0x3f3076['name'];}_0x111d84[_0xf8c0('0x1b')](_0x49e09d)[_0xf8c0('0x2d')](_0x3f3076);};}exports[_0xf8c0('0x2e')]=function(_0xb98a9d,_0x1bc299){var _0x37c162={},_0x3ab5fc={},_0x28cdab={'count':0x0,'rows':[]};var _0x41ef4b=_['map'](db[_0xf8c0('0x2f')][_0xf8c0('0x30')],function(_0x372f33){return{'name':_0x372f33[_0xf8c0('0x31')],'type':_0x372f33[_0xf8c0('0x32')][_0xf8c0('0x33')]};});_0x3ab5fc[_0xf8c0('0x34')]=_[_0xf8c0('0x35')](_0x41ef4b,_0xf8c0('0x36'));_0x3ab5fc['query']=_[_0xf8c0('0x37')](_0xb98a9d[_0xf8c0('0x38')]);_0x3ab5fc['filters']=_[_0xf8c0('0x39')](_0x3ab5fc[_0xf8c0('0x34')],_0x3ab5fc[_0xf8c0('0x38')]);_0x37c162[_0xf8c0('0x3a')]=_[_0xf8c0('0x39')](_0x3ab5fc[_0xf8c0('0x34')],qs[_0xf8c0('0x3b')](_0xb98a9d[_0xf8c0('0x38')]['fields']));_0x37c162['attributes']=_0x37c162[_0xf8c0('0x3a')][_0xf8c0('0x3c')]?_0x37c162[_0xf8c0('0x3a')]:_0x3ab5fc[_0xf8c0('0x34')];if(!_0xb98a9d[_0xf8c0('0x38')]['hasOwnProperty'](_0xf8c0('0x3d'))){_0x37c162['limit']=qs[_0xf8c0('0x3e')](_0xb98a9d[_0xf8c0('0x38')][_0xf8c0('0x3e')]);_0x37c162['offset']=qs['offset'](_0xb98a9d[_0xf8c0('0x38')][_0xf8c0('0x1e')]);}_0x37c162[_0xf8c0('0x3f')]=qs[_0xf8c0('0x40')](_0xb98a9d[_0xf8c0('0x38')][_0xf8c0('0x40')]);_0x37c162[_0xf8c0('0x41')]=qs[_0xf8c0('0x42')](_[_0xf8c0('0x43')](_0xb98a9d[_0xf8c0('0x38')],_0x3ab5fc['filters']),_0x41ef4b);if(_0xb98a9d[_0xf8c0('0x38')][_0xf8c0('0x44')]){_0x37c162[_0xf8c0('0x41')]=_[_0xf8c0('0x45')](_0x37c162[_0xf8c0('0x41')],{'$or':_[_0xf8c0('0x35')](_0x41ef4b,function(_0x3d88f3){if(_0x3d88f3[_0xf8c0('0x32')]!=='VIRTUAL'){var _0x4296ec={};_0x4296ec[_0x3d88f3[_0xf8c0('0x36')]]={'$like':'%'+_0xb98a9d[_0xf8c0('0x38')]['filter']+'%'};return _0x4296ec;}})});}_0x37c162=_[_0xf8c0('0x45')]({},_0x37c162,_0xb98a9d[_0xf8c0('0x46')]);var _0x32fb30={'where':_0x37c162[_0xf8c0('0x41')]};return db[_0xf8c0('0x2f')][_0xf8c0('0x20')](_0x32fb30)[_0xf8c0('0x26')](function(_0x165d17){_0x28cdab[_0xf8c0('0x20')]=_0x165d17;if(_0xb98a9d[_0xf8c0('0x38')]['includeAll']){_0x37c162[_0xf8c0('0x47')]=[{'all':!![]}];}return db['OpenchannelQueue'][_0xf8c0('0x48')](_0x37c162);})['then'](function(_0x2130ef){_0x28cdab[_0xf8c0('0x49')]=_0x2130ef;return _0x28cdab;})[_0xf8c0('0x26')](respondWithFilteredResult(_0x1bc299,_0x37c162))[_0xf8c0('0x4a')](handleError(_0x1bc299,null));};exports['show']=function(_0x1a178f,_0x5f0880){var _0x47a314={'raw':!![],'where':{'id':_0x1a178f[_0xf8c0('0x4b')]['id']}},_0x425c6f={};_0x425c6f[_0xf8c0('0x34')]=_[_0xf8c0('0x37')](db[_0xf8c0('0x2f')][_0xf8c0('0x30')]);_0x425c6f[_0xf8c0('0x38')]=_[_0xf8c0('0x37')](_0x1a178f[_0xf8c0('0x38')]);_0x425c6f[_0xf8c0('0x42')]=_[_0xf8c0('0x39')](_0x425c6f[_0xf8c0('0x34')],_0x425c6f[_0xf8c0('0x38')]);_0x47a314['attributes']=_[_0xf8c0('0x39')](_0x425c6f[_0xf8c0('0x34')],qs['fields'](_0x1a178f[_0xf8c0('0x38')]['fields']));_0x47a314['attributes']=_0x47a314[_0xf8c0('0x3a')]['length']?_0x47a314[_0xf8c0('0x3a')]:_0x425c6f['model'];if(_0x1a178f[_0xf8c0('0x38')]['includeAll']){_0x47a314[_0xf8c0('0x47')]=[{'all':!![]}];}_0x47a314=_[_0xf8c0('0x45')]({},_0x47a314,_0x1a178f[_0xf8c0('0x46')]);return db[_0xf8c0('0x2f')][_0xf8c0('0x4c')](_0x47a314)[_0xf8c0('0x26')](handleEntityNotFound(_0x5f0880,null))[_0xf8c0('0x26')](respondWithResult(_0x5f0880,null))['catch'](handleError(_0x5f0880,null));};exports[_0xf8c0('0x4d')]=function(_0xb43431,_0x597e93){return db['OpenchannelQueue'][_0xf8c0('0x4d')](_0xb43431[_0xf8c0('0x4e')],{})['then'](function(_0x3f1786){var _0x1bb05a=_0xb43431[_0xf8c0('0x4f')][_0xf8c0('0x28')]({'plain':!![]});if(!_0x1bb05a)throw new Error(_0xf8c0('0x50'));if(_0x1bb05a['role']==='user'){var _0x572a63=_0x3f1786[_0xf8c0('0x28')]({'plain':!![]});var _0x3d5dc2='OpenchannelQueues';return db[_0xf8c0('0x51')][_0xf8c0('0x4c')]({'where':{'name':_0x3d5dc2,'userProfileId':_0x1bb05a['userProfileId']},'raw':!![]})[_0xf8c0('0x26')](function(_0x118ddf){if(_0x118ddf&&_0x118ddf[_0xf8c0('0x52')]===0x0){return db[_0xf8c0('0x2a')][_0xf8c0('0x4d')]({'name':_0x572a63[_0xf8c0('0x36')],'resourceId':_0x572a63['id'],'type':_0x118ddf[_0xf8c0('0x36')],'sectionId':_0x118ddf['id']},{})[_0xf8c0('0x26')](function(){return _0x3f1786;});}else{return _0x3f1786;}})[_0xf8c0('0x4a')](function(_0x283206){logger['error'](_0xf8c0('0x53'),_0x283206);throw _0x283206;});}return _0x3f1786;})[_0xf8c0('0x26')](respondWithResult(_0x597e93,0xc9))[_0xf8c0('0x4a')](handleError(_0x597e93,null));};exports[_0xf8c0('0x25')]=function(_0x50d8fb,_0x137a89){if(_0x50d8fb['body']['id']){delete _0x50d8fb[_0xf8c0('0x4e')]['id'];}return db[_0xf8c0('0x2f')][_0xf8c0('0x4c')]({'where':{'id':_0x50d8fb[_0xf8c0('0x4b')]['id']}})['then'](handleEntityNotFound(_0x137a89,null))['then'](saveUpdates(_0x50d8fb[_0xf8c0('0x4e')],null))[_0xf8c0('0x26')](respondWithResult(_0x137a89,null))[_0xf8c0('0x4a')](handleError(_0x137a89,null));};exports[_0xf8c0('0x27')]=function(_0x142bc6,_0x3110b9){return db['OpenchannelQueue'][_0xf8c0('0x4c')]({'where':{'id':_0x142bc6[_0xf8c0('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3110b9,null))[_0xf8c0('0x26')](removeEntity(_0x3110b9,null))[_0xf8c0('0x4a')](handleError(_0x3110b9,null));};exports['describe']=function(_0x341c44,_0x5be731){return db['OpenchannelQueue'][_0xf8c0('0x54')]()[_0xf8c0('0x26')](respondWithResult(_0x5be731,null))[_0xf8c0('0x4a')](handleError(_0x5be731,null));};exports['getMembers']=function(_0x374ba0,_0xe238d1,_0x2a95a3){var _0x31e135={'raw':!![],'where':{}},_0x331f34={},_0x326f8a;return db[_0xf8c0('0x2f')][_0xf8c0('0x55')]({'where':{'id':_0x374ba0[_0xf8c0('0x4b')]['id']}})[_0xf8c0('0x26')](handleEntityNotFound(_0xe238d1,null))['then'](function(_0x3094c1){if(_0x3094c1){_0x326f8a=_0x3094c1[_0xf8c0('0x28')]({'plain':!![]});_0x331f34[_0xf8c0('0x34')]=_[_0xf8c0('0x37')](db[_0xf8c0('0x56')][_0xf8c0('0x30')]);_0x331f34[_0xf8c0('0x38')]=_['keys'](_0x374ba0['query']);_0x331f34[_0xf8c0('0x42')]=_['intersection'](_0x331f34['model'],_0x331f34['query']);_0x31e135[_0xf8c0('0x3a')]=_[_0xf8c0('0x39')](_0x331f34[_0xf8c0('0x34')],qs[_0xf8c0('0x3b')](_0x374ba0['query']['fields']));_0x31e135[_0xf8c0('0x3a')]=_0x31e135[_0xf8c0('0x3a')][_0xf8c0('0x3c')]?_0x31e135[_0xf8c0('0x3a')]:_0x331f34[_0xf8c0('0x34')];if(!_0x374ba0[_0xf8c0('0x38')][_0xf8c0('0x57')](_0xf8c0('0x3d'))){_0x31e135[_0xf8c0('0x3e')]=qs[_0xf8c0('0x3e')](_0x374ba0[_0xf8c0('0x38')]['limit']);_0x31e135[_0xf8c0('0x1e')]=qs[_0xf8c0('0x1e')](_0x374ba0[_0xf8c0('0x38')][_0xf8c0('0x1e')]);}_0x31e135[_0xf8c0('0x3f')]=qs[_0xf8c0('0x40')](_0x374ba0[_0xf8c0('0x38')][_0xf8c0('0x40')]);_0x31e135[_0xf8c0('0x41')]=qs['filters'](_[_0xf8c0('0x43')](_0x374ba0[_0xf8c0('0x38')],_0x331f34[_0xf8c0('0x42')]));_0x31e135[_0xf8c0('0x41')][_0xf8c0('0x58')]=_0x3094c1['id'];if(_0x374ba0[_0xf8c0('0x38')][_0xf8c0('0x44')]){_0x31e135[_0xf8c0('0x41')]=_['merge'](_0x31e135['where'],{'$or':_[_0xf8c0('0x35')](_0x31e135[_0xf8c0('0x3a')],function(_0x3abc35){var _0x4f6a29={};_0x4f6a29[_0x3abc35]={'$like':'%'+_0x374ba0[_0xf8c0('0x38')][_0xf8c0('0x44')]+'%'};return _0x4f6a29;})});}_0x31e135=_[_0xf8c0('0x45')]({},_0x31e135,_0x374ba0[_0xf8c0('0x46')]);return db[_0xf8c0('0x56')][_0xf8c0('0x48')](_0x31e135);}})[_0xf8c0('0x26')](function(_0x2f4ec1){if(_0x2f4ec1){return db[_0xf8c0('0x59')]['findAndCountAll']({'where':{'id':_[_0xf8c0('0x35')](_0x2f4ec1,_0xf8c0('0x5a')),'role':_0xf8c0('0x5b')},'attributes':['id',_0xf8c0('0x36'),_0xf8c0('0x5c'),_0xf8c0('0x5d'),_0xf8c0('0x5e')]});}})[_0xf8c0('0x26')](function(_0x15f280){if(_0x15f280){return{'count':_0x15f280[_0xf8c0('0x20')],'rows':_['map'](_0x15f280[_0xf8c0('0x49')],function(_0x4d538b){return{'membername':_0x4d538b['name'],'UserId':_0x4d538b['id'],'queue_name':_0x326f8a['name'],'OpenchannelQueueId':_0x326f8a['id'],'interface':util[_0xf8c0('0x5f')](_0xf8c0('0x60'),_0xf8c0('0x61'),_0x4d538b['name']),'penalty':0x0,'paused':_0x4d538b['openchannelPause'],'createdAt':_0x4d538b['createdAt'],'updatedAt':_0x4d538b['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xf8c0('0x26')](respondWithFilteredResult(_0xe238d1,_0x31e135))[_0xf8c0('0x4a')](handleError(_0xe238d1,null));};exports['getTeams']=function(_0x50519c,_0xaaed7d,_0x45e655){var _0x2bb7fe={};var _0x42184c={};var _0x3d9c3c;var _0xe2f86e;return db[_0xf8c0('0x2f')]['findOne']({'where':{'id':_0x50519c[_0xf8c0('0x4b')]['id']}})[_0xf8c0('0x26')](handleEntityNotFound(_0xaaed7d,null))[_0xf8c0('0x26')](function(_0x15ebdb){if(_0x15ebdb){_0x3d9c3c=_0x15ebdb;_0x42184c[_0xf8c0('0x34')]=_[_0xf8c0('0x37')](db[_0xf8c0('0x62')]['rawAttributes']);_0x42184c[_0xf8c0('0x38')]=_['keys'](_0x50519c[_0xf8c0('0x38')]);_0x42184c[_0xf8c0('0x42')]=_[_0xf8c0('0x39')](_0x42184c['model'],_0x42184c[_0xf8c0('0x38')]);_0x2bb7fe['attributes']=_[_0xf8c0('0x39')](_0x42184c[_0xf8c0('0x34')],qs[_0xf8c0('0x3b')](_0x50519c[_0xf8c0('0x38')][_0xf8c0('0x3b')]));_0x2bb7fe[_0xf8c0('0x3a')]=_0x2bb7fe[_0xf8c0('0x3a')][_0xf8c0('0x3c')]?_0x2bb7fe[_0xf8c0('0x3a')]:_0x42184c[_0xf8c0('0x34')];_0x2bb7fe[_0xf8c0('0x3f')]=qs[_0xf8c0('0x40')](_0x50519c[_0xf8c0('0x38')][_0xf8c0('0x40')]);_0x2bb7fe[_0xf8c0('0x41')]=qs[_0xf8c0('0x42')](_[_0xf8c0('0x43')](_0x50519c[_0xf8c0('0x38')],_0x42184c[_0xf8c0('0x42')]));if(_0x50519c[_0xf8c0('0x38')][_0xf8c0('0x44')]){_0x2bb7fe[_0xf8c0('0x41')]=_['merge'](_0x2bb7fe['where'],{'$or':_[_0xf8c0('0x35')](_0x2bb7fe[_0xf8c0('0x3a')],function(_0x256bdc){var _0x3de6da={};_0x3de6da[_0x256bdc]={'$like':'%'+_0x50519c[_0xf8c0('0x38')][_0xf8c0('0x44')]+'%'};return _0x3de6da;})});}_0x2bb7fe=_['merge']({},_0x2bb7fe,_0x50519c[_0xf8c0('0x46')]);return _0x3d9c3c[_0xf8c0('0x63')](_0x2bb7fe);}})['then'](function(_0x1391d3){if(_0x1391d3){_0xe2f86e=_0x1391d3['length'];if(!_0x50519c['query'][_0xf8c0('0x57')]('nolimit')){_0x2bb7fe['limit']=qs[_0xf8c0('0x3e')](_0x50519c[_0xf8c0('0x38')][_0xf8c0('0x3e')]);_0x2bb7fe[_0xf8c0('0x1e')]=qs[_0xf8c0('0x1e')](_0x50519c[_0xf8c0('0x38')][_0xf8c0('0x1e')]);}return _0x3d9c3c[_0xf8c0('0x63')](_0x2bb7fe);}})[_0xf8c0('0x26')](function(_0x153137){if(_0x153137){return _0x153137?{'count':_0xe2f86e,'rows':_0x153137}:null;}})['then'](respondWithResult(_0xaaed7d,null))['catch'](handleError(_0xaaed7d,null));};exports[_0xf8c0('0x64')]=function(_0x4385a9,_0x110aa8,_0x5e828d){var _0x2fe560=_0x4385a9[_0xf8c0('0x4e')][_0xf8c0('0x65')];return db['Team']['findAll']({'where':{'id':_0x2fe560},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xf8c0('0x36'),_0xf8c0('0x66'),'voicePause',_0xf8c0('0x67')],'raw':!![]}]})[_0xf8c0('0x26')](function(_0x391079){if(_0x391079){var _0x26b52e=_['flatMap'](_0x391079,function(_0x4e359a){var _0x55630e=_0x4e359a[_0xf8c0('0x28')]({'plain':!![]});return _0x55630e[_0xf8c0('0x68')];});return db[_0xf8c0('0x2f')]['find']({'where':{'id':_0x4385a9['params']['id']}})[_0xf8c0('0x26')](function(_0x3b1a1f){return db[_0xf8c0('0x69')][_0xf8c0('0x6a')](function(_0x19c798){return _0x3b1a1f[_0xf8c0('0x64')](_0x2fe560,{'transaction':_0x19c798})[_0xf8c0('0x26')](function(){return BPromise[_0xf8c0('0x6b')](_0x26b52e,function(_0x26f8a1){return db[_0xf8c0('0x56')][_0xf8c0('0x6c')]({'where':{'UserId':_0x26f8a1['id'],'OpenchannelQueueId':_0x4385a9[_0xf8c0('0x4b')]['id']},'transaction':_0x19c798});});})['then'](function(){_0x26b52e['forEach'](function(_0x389292){socket[_0xf8c0('0x6d')](_0xf8c0('0x6e'),{'UserId':_0x389292['id'],'OpenchannelQueueId':_0x3b1a1f['id']});});});});});}})[_0xf8c0('0x26')](respondWithStatusCode(_0x110aa8,null))['catch'](handleError(_0x110aa8,null));};exports['removeTeams']=function(_0x4c0044,_0x26c7f1,_0xdb9418){return db[_0xf8c0('0x62')]['findAll']({'where':{'id':_0x4c0044[_0xf8c0('0x38')][_0xf8c0('0x65')]},'attributes':['id'],'include':[{'model':db[_0xf8c0('0x59')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xf8c0('0x26')](handleEntityNotFound(_0x26c7f1,null))['then'](function(_0x4c655c){var _0x3ca09a=_[_0xf8c0('0x35')](_0x4c655c,'id');var _0x26f894=[];var _0x2983b0=[];var _0x1497df=squel[_0xf8c0('0x6f')]();_0x1497df['field'](_0xf8c0('0x70'))[_0xf8c0('0x71')](_0xf8c0('0x72'),'tq')[_0xf8c0('0x73')]('user_has_teams','ut',_0xf8c0('0x74'))[_0xf8c0('0x41')](_0xf8c0('0x75'),_0x4c0044['params']['id']);for(var _0x4c64da=0x0;_0x4c64da<_0x4c655c['length'];_0x4c64da+=0x1){let _0x313c83=_0x4c655c[_0x4c64da];for(var _0x160601=0x0;_0x160601<_0x313c83[_0xf8c0('0x68')]['length'];_0x160601+=0x1){let _0x23ff39=_0x313c83[_0xf8c0('0x68')][_0x160601];var _0x585e8c=_0x1497df[_0xf8c0('0x76')]();_0x585e8c['where']('ut.UserId\x20=\x20?',_0x23ff39['id']);_0x2983b0[_0xf8c0('0x77')](db[_0xf8c0('0x69')]['query'](_0x585e8c[_0xf8c0('0x78')](),{'type':db[_0xf8c0('0x69')][_0xf8c0('0x79')]['SELECT']})[_0xf8c0('0x26')](function(_0x5eba46){if(_0x5eba46[_0xf8c0('0x3c')]===0x1){return _0x23ff39['id'];}else{var _0x4a9ed5=_[_0xf8c0('0x7a')](_['map'](_0x5eba46,_0xf8c0('0x7b')),function(_0x55e60f){return _[_0xf8c0('0x7c')](_0x3ca09a,_0x55e60f);});if(_0x4a9ed5){return _0x23ff39['id'];}}}));}}return BPromise['all'](_0x2983b0)[_0xf8c0('0x26')](function(_0xe6d0d4){_0x26f894=_(_0x26f894)[_0xf8c0('0x7d')](_0xe6d0d4)[_0xf8c0('0x7e')]()[_0xf8c0('0x7f')]();return db[_0xf8c0('0x2f')][_0xf8c0('0x4c')]({'where':{'id':_0x4c0044['params']['id']}})[_0xf8c0('0x26')](function(_0x2511a6){return db['sequelize'][_0xf8c0('0x6a')](function(_0x1516e8){return _0x2511a6[_0xf8c0('0x80')](_0x4c0044['query'][_0xf8c0('0x65')],{'transaction':_0x1516e8})[_0xf8c0('0x26')](function(){if(!_[_0xf8c0('0x81')](_0x26f894)){return _0x2511a6[_0xf8c0('0x82')](_0x26f894,{'transaction':_0x1516e8});}})[_0xf8c0('0x26')](function(){_0x26f894['forEach'](function(_0x1206a5){socket[_0xf8c0('0x6d')](_0xf8c0('0x83'),{'UserId':_0x1206a5,'OpenchannelQueueId':_0x2511a6['id']});});});});});});})[_0xf8c0('0x26')](respondWithStatusCode(_0x26c7f1,null))['catch'](handleError(_0x26c7f1,null));};exports[_0xf8c0('0x84')]=function(_0x3c9d07,_0x199891,_0xbd3cef){return db[_0xf8c0('0x2f')][_0xf8c0('0x4c')]({'where':{'id':_0x3c9d07[_0xf8c0('0x4b')]['id']}})[_0xf8c0('0x26')](handleEntityNotFound(_0x199891,null))['then'](function(_0x527a2d){if(_0x527a2d){return _0x527a2d[_0xf8c0('0x84')](_0x3c9d07[_0xf8c0('0x4e')]['ids'],_[_0xf8c0('0x85')](_0x3c9d07[_0xf8c0('0x4e')],[_0xf8c0('0x65'),'id'])||{})[_0xf8c0('0x86')](function(_0x2a8e28){for(var _0x22dcfd=0x0;_0x22dcfd<_0x3c9d07['body'][_0xf8c0('0x65')][_0xf8c0('0x3c')];_0x22dcfd+=0x1){socket[_0xf8c0('0x6d')](_0xf8c0('0x6e'),{'UserId':Number(_0x3c9d07[_0xf8c0('0x4e')][_0xf8c0('0x65')][_0x22dcfd]),'OpenchannelQueueId':Number(_0x3c9d07[_0xf8c0('0x4b')]['id'])});}return _0x2a8e28;});}})[_0xf8c0('0x26')](respondWithResult(_0x199891,null))[_0xf8c0('0x4a')](handleError(_0x199891,null));};exports[_0xf8c0('0x82')]=function(_0x5e63f7,_0xcd1b07,_0x1ffc13){return db['OpenchannelQueue'][_0xf8c0('0x4c')]({'where':{'id':_0x5e63f7[_0xf8c0('0x4b')]['id']}})[_0xf8c0('0x26')](handleEntityNotFound(_0xcd1b07,null))['then'](function(_0xa2fdca){if(_0xa2fdca){return _0xa2fdca[_0xf8c0('0x82')](_0x5e63f7[_0xf8c0('0x38')][_0xf8c0('0x65')])[_0xf8c0('0x26')](function(){if(_[_0xf8c0('0x87')](_0x5e63f7[_0xf8c0('0x38')][_0xf8c0('0x65')])){for(var _0x3df3d7=0x0;_0x3df3d7<_0x5e63f7[_0xf8c0('0x38')][_0xf8c0('0x65')][_0xf8c0('0x3c')];_0x3df3d7+=0x1){socket[_0xf8c0('0x6d')](_0xf8c0('0x83'),{'UserId':Number(_0x5e63f7[_0xf8c0('0x38')]['ids'][_0x3df3d7]),'OpenchannelQueueId':Number(_0x5e63f7[_0xf8c0('0x4b')]['id'])});}}else{socket['emit'](_0xf8c0('0x83'),{'UserId':Number(_0x5e63f7[_0xf8c0('0x38')][_0xf8c0('0x65')]),'OpenchannelQueueId':Number(_0x5e63f7[_0xf8c0('0x4b')]['id'])});}});}})[_0xf8c0('0x26')](respondWithStatusCode(_0xcd1b07,null))['catch'](handleError(_0xcd1b07,null));};exports[_0xf8c0('0x88')]=function(_0x5457ac,_0xa49a91,_0x367ab1){var _0x396533={};var _0x57a5c7={};var _0x3cf54f;var _0x43b817;return db[_0xf8c0('0x2f')][_0xf8c0('0x55')]({'where':{'id':_0x5457ac[_0xf8c0('0x4b')]['id']}})[_0xf8c0('0x26')](handleEntityNotFound(_0xa49a91,null))['then'](function(_0x1055d1){if(_0x1055d1){_0x3cf54f=_0x1055d1;_0x57a5c7[_0xf8c0('0x34')]=_[_0xf8c0('0x37')](db[_0xf8c0('0x59')][_0xf8c0('0x30')]);_0x57a5c7[_0xf8c0('0x38')]=_[_0xf8c0('0x37')](_0x5457ac[_0xf8c0('0x38')]);_0x57a5c7[_0xf8c0('0x42')]=_[_0xf8c0('0x39')](_0x57a5c7[_0xf8c0('0x34')],_0x57a5c7['query']);_0x396533[_0xf8c0('0x3a')]=_['intersection'](_0x57a5c7[_0xf8c0('0x34')],qs[_0xf8c0('0x3b')](_0x5457ac[_0xf8c0('0x38')][_0xf8c0('0x3b')]));_0x396533[_0xf8c0('0x3a')]=_0x396533[_0xf8c0('0x3a')]['length']?_0x396533[_0xf8c0('0x3a')]:_0x57a5c7[_0xf8c0('0x34')];_0x396533[_0xf8c0('0x3f')]=qs[_0xf8c0('0x40')](_0x5457ac[_0xf8c0('0x38')]['sort']);_0x396533[_0xf8c0('0x41')]=qs[_0xf8c0('0x42')](_[_0xf8c0('0x43')](_0x5457ac[_0xf8c0('0x38')],_0x57a5c7['filters']));if(_0x5457ac[_0xf8c0('0x38')][_0xf8c0('0x44')]){_0x396533['where']=_[_0xf8c0('0x45')](_0x396533['where'],{'$or':_[_0xf8c0('0x35')](_0x396533[_0xf8c0('0x3a')],function(_0x46123e){var _0x4e3524={};_0x4e3524[_0x46123e]={'$like':'%'+_0x5457ac[_0xf8c0('0x38')][_0xf8c0('0x44')]+'%'};return _0x4e3524;})});}_0x396533=_['merge']({},_0x396533,_0x5457ac[_0xf8c0('0x46')]);return _0x3cf54f[_0xf8c0('0x88')](_0x396533);}})[_0xf8c0('0x26')](function(_0x2d3c41){if(_0x2d3c41){_0x43b817=_0x2d3c41[_0xf8c0('0x3c')];if(!_0x5457ac[_0xf8c0('0x38')][_0xf8c0('0x57')]('nolimit')){_0x396533['limit']=qs[_0xf8c0('0x3e')](_0x5457ac[_0xf8c0('0x38')][_0xf8c0('0x3e')]);_0x396533[_0xf8c0('0x1e')]=qs[_0xf8c0('0x1e')](_0x5457ac[_0xf8c0('0x38')][_0xf8c0('0x1e')]);}return _0x3cf54f[_0xf8c0('0x88')](_0x396533);}})[_0xf8c0('0x26')](function(_0x26ebf8){if(_0x26ebf8){return _0x26ebf8?{'count':_0x43b817,'rows':_0x26ebf8}:null;}})[_0xf8c0('0x26')](respondWithResult(_0xa49a91,null))[_0xf8c0('0x4a')](handleError(_0xa49a91,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index a6015d6..a1d0be1 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 _0x9749=['../../mysqldb','OpenchannelQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x3208c5,_0x573c0b){var _0x1dd701=function(_0x36734b){while(--_0x36734b){_0x3208c5['push'](_0x3208c5['shift']());}};_0x1dd701(++_0x573c0b);}(_0x9749,0xea));var _0x9974=function(_0x3bc927,_0x485477){_0x3bc927=_0x3bc927-0x0;var _0x315e23=_0x9749[_0x3bc927];return _0x315e23;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0x9974('0x0'))['db'][_0x9974('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x9974('0x2')](0x0);var events={'afterCreate':_0x9974('0x3'),'afterUpdate':_0x9974('0x4'),'afterDestroy':_0x9974('0x5')};function emitEvent(_0x16ec1c){return function(_0x166719,_0x7ce37c,_0xf1f0fa){OpenchannelQueueEvents[_0x9974('0x6')](_0x16ec1c+':'+_0x166719['id'],_0x166719);OpenchannelQueueEvents[_0x9974('0x6')](_0x16ec1c,_0x166719);_0xf1f0fa(null);};}for(var e in events){if(events[_0x9974('0x7')](e)){var event=events[e];OpenchannelQueue[_0x9974('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0x2219=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','OpenchannelQueue'];(function(_0x2e8450,_0x1e44a8){var _0x2edce7=function(_0x525300){while(--_0x525300){_0x2e8450['push'](_0x2e8450['shift']());}};_0x2edce7(++_0x1e44a8);}(_0x2219,0xc4));var _0x9221=function(_0x2fe689,_0x5794e5){_0x2fe689=_0x2fe689-0x0;var _0x35ea44=_0x2219[_0x2fe689];return _0x35ea44;};'use strict';var EventEmitter=require(_0x9221('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0x9221('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x9221('0x2')](0x0);var events={'afterCreate':_0x9221('0x3'),'afterUpdate':'update','afterDestroy':_0x9221('0x4')};function emitEvent(_0x192360){return function(_0x2e5a85,_0x2538e,_0x2c51de){OpenchannelQueueEvents['emit'](_0x192360+':'+_0x2e5a85['id'],_0x2e5a85);OpenchannelQueueEvents[_0x9221('0x5')](_0x192360,_0x2e5a85);_0x2c51de(null);};}for(var e in events){if(events[_0x9221('0x6')](e)){var event=events[e];OpenchannelQueue[_0x9221('0x7')](e,emitEvent(event));}}module[_0x9221('0x8')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 020938f..46cde70 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 _0x4f11=['./openchannelQueue.attributes','define','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x483a68,_0x2acc85){var _0x5d8176=function(_0x1fd36b){while(--_0x1fd36b){_0x483a68['push'](_0x483a68['shift']());}};_0x5d8176(++_0x2acc85);}(_0x4f11,0x1b0));var _0x14f1=function(_0x1c1446,_0x4b23a2){_0x1c1446=_0x1c1446-0x0;var _0xfc632f=_0x4f11[_0x1c1446];return _0xfc632f;};'use strict';var _=require(_0x14f1('0x0'));var util=require(_0x14f1('0x1'));var logger=require(_0x14f1('0x2'))(_0x14f1('0x3'));var moment=require(_0x14f1('0x4'));var BPromise=require(_0x14f1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x14f1('0x6'));var config=require(_0x14f1('0x7'));var attributes=require(_0x14f1('0x8'));module['exports']=function(_0x13e1af,_0x5f4e82){return _0x13e1af[_0x14f1('0x9')]('OpenchannelQueue',attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf1f6=['moment','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','define','openchannel_queues','lodash','util','../../config/logger','api'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0xf1f6,0x164));var _0x6f1f=function(_0x4db0d5,_0x97e02a){_0x4db0d5=_0x4db0d5-0x0;var _0x14064b=_0xf1f6[_0x4db0d5];return _0x14064b;};'use strict';var _=require(_0x6f1f('0x0'));var util=require(_0x6f1f('0x1'));var logger=require(_0x6f1f('0x2'))(_0x6f1f('0x3'));var moment=require(_0x6f1f('0x4'));var BPromise=require('bluebird');var rp=require(_0x6f1f('0x5'));var fs=require('fs');var path=require(_0x6f1f('0x6'));var rimraf=require(_0x6f1f('0x7'));var config=require(_0x6f1f('0x8'));var attributes=require(_0x6f1f('0x9'));module['exports']=function(_0x156d25,_0x4818e4){return _0x156d25[_0x6f1f('0xa')]('OpenchannelQueue',attributes,{'tableName':_0x6f1f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 5985fea..76938ec 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 _0x3050=['result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','attributes','limit','include','map','model','stringify','ShowOpenchannelQueue','find','where','debug','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x4e7291,_0x29e52d){var _0x490f45=function(_0x290ed6){while(--_0x290ed6){_0x4e7291['push'](_0x4e7291['shift']());}};_0x490f45(++_0x29e52d);}(_0x3050,0xce));var _0x0305=function(_0x179695,_0x5772aa){_0x179695=_0x179695-0x0;var _0x44bbab=_0x3050[_0x179695];return _0x44bbab;};'use strict';var _=require('lodash');var util=require(_0x0305('0x0'));var moment=require(_0x0305('0x1'));var BPromise=require('bluebird');var rs=require(_0x0305('0x2'));var fs=require('fs');var Redis=require(_0x0305('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0305('0x4'))(_0x0305('0x5'));var config=require(_0x0305('0x6'));var jayson=require(_0x0305('0x7'));var client=jayson[_0x0305('0x8')]['http']({'port':0x232a});config[_0x0305('0x9')]=_[_0x0305('0xa')](config[_0x0305('0x9')],{'host':_0x0305('0xb'),'port':0x18eb});var socket=require(_0x0305('0xc'))(new Redis(config[_0x0305('0x9')]));require('./openchannelQueue.socket')[_0x0305('0xd')](socket);function respondWithRpcPromise(_0x44205b,_0x3a4618,_0x27cf62){return new BPromise(function(_0x407f0d,_0x1d62aa){return client[_0x0305('0xe')](_0x44205b,_0x27cf62)[_0x0305('0xf')](function(_0x2bf766){logger[_0x0305('0x10')](_0x0305('0x11'),_0x3a4618,_0x0305('0x12'));logger['debug']('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x3a4618,_0x0305('0x12'),JSON['stringify'](_0x2bf766));if(_0x2bf766[_0x0305('0x13')]){if(_0x2bf766['error'][_0x0305('0x14')]===0x1f4){logger[_0x0305('0x13')](_0x0305('0x11'),_0x3a4618,_0x2bf766[_0x0305('0x13')]['message']);return _0x1d62aa(_0x2bf766['error'][_0x0305('0x15')]);}logger[_0x0305('0x13')](_0x0305('0x11'),_0x3a4618,_0x2bf766[_0x0305('0x13')][_0x0305('0x15')]);return _0x407f0d(_0x2bf766[_0x0305('0x13')]['message']);}else{logger[_0x0305('0x10')](_0x0305('0x11'),_0x3a4618,_0x0305('0x12'));_0x407f0d(_0x2bf766[_0x0305('0x16')][_0x0305('0x15')]);}})[_0x0305('0x17')](function(_0x5e8170){logger['error'](_0x0305('0x11'),_0x3a4618,_0x5e8170);_0x1d62aa(_0x5e8170);});});}exports[_0x0305('0x18')]=function(_0xbef22a){var _0xdc11c5=this;return new Promise(function(_0x5d514c,_0x24eca8){return db[_0x0305('0x19')][_0x0305('0x1a')]({'raw':_0xbef22a[_0x0305('0x1b')]?_0xbef22a[_0x0305('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0xbef22a[_0x0305('0x1b')]?_0xbef22a[_0x0305('0x1b')]['where']||null:null,'attributes':_0xbef22a[_0x0305('0x1b')]?_0xbef22a[_0x0305('0x1b')][_0x0305('0x1c')]||null:null,'limit':_0xbef22a[_0x0305('0x1b')]?_0xbef22a[_0x0305('0x1b')][_0x0305('0x1d')]||null:null,'include':_0xbef22a['options']?_0xbef22a[_0x0305('0x1b')][_0x0305('0x1e')]?_[_0x0305('0x1f')](_0xbef22a[_0x0305('0x1b')]['include'],function(_0x158c7e){return{'model':db[_0x158c7e[_0x0305('0x20')]],'as':_0x158c7e['as'],'attributes':_0x158c7e[_0x0305('0x1c')],'include':_0x158c7e[_0x0305('0x1e')]?_['map'](_0x158c7e[_0x0305('0x1e')],function(_0x447e64){return{'model':db[_0x447e64[_0x0305('0x20')]],'as':_0x447e64['as'],'attributes':_0x447e64['attributes'],'include':_0x447e64[_0x0305('0x1e')]?_[_0x0305('0x1f')](_0x447e64[_0x0305('0x1e')],function(_0x145246){return{'model':db[_0x145246[_0x0305('0x20')]],'as':_0x145246['as'],'attributes':_0x145246['attributes']};}):[]};}):[]};}):[]:[]})[_0x0305('0xf')](function(_0x1d3f86){logger[_0x0305('0x10')]('GetOpenchannelQueue',_0xbef22a);logger['debug'](_0x0305('0x18'),_0xbef22a,JSON[_0x0305('0x21')](_0x1d3f86));_0x5d514c(_0x1d3f86);})[_0x0305('0x17')](function(_0x4cd48c){logger[_0x0305('0x13')](_0x0305('0x18'),_0x4cd48c[_0x0305('0x15')],_0xbef22a);_0x24eca8(_0xdc11c5['error'](0x1f4,_0x4cd48c[_0x0305('0x15')]));});});};exports[_0x0305('0x22')]=function(_0x195e91){var _0xdd1b6f=this;return new Promise(function(_0x361c4f,_0x236c39){return db[_0x0305('0x19')][_0x0305('0x23')]({'raw':_0x195e91['options']?_0x195e91[_0x0305('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x195e91[_0x0305('0x1b')]?_0x195e91['options'][_0x0305('0x24')]||null:null,'attributes':_0x195e91[_0x0305('0x1b')]?_0x195e91[_0x0305('0x1b')][_0x0305('0x1c')]||null:null,'include':_0x195e91[_0x0305('0x1b')]?_0x195e91[_0x0305('0x1b')][_0x0305('0x1e')]?_['map'](_0x195e91['options'][_0x0305('0x1e')],function(_0x5a6c1f){return{'model':db[_0x5a6c1f[_0x0305('0x20')]],'as':_0x5a6c1f['as'],'attributes':_0x5a6c1f[_0x0305('0x1c')],'include':_0x5a6c1f[_0x0305('0x1e')]?_['map'](_0x5a6c1f[_0x0305('0x1e')],function(_0x16d8ee){return{'model':db[_0x16d8ee[_0x0305('0x20')]],'as':_0x16d8ee['as'],'attributes':_0x16d8ee[_0x0305('0x1c')],'include':_0x16d8ee['include']?_['map'](_0x16d8ee[_0x0305('0x1e')],function(_0x14be83){return{'model':db[_0x14be83[_0x0305('0x20')]],'as':_0x14be83['as'],'attributes':_0x14be83[_0x0305('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0305('0xf')](function(_0x2ed14f){logger['info'](_0x0305('0x22'),_0x195e91);logger[_0x0305('0x25')]('ShowOpenchannelQueue',_0x195e91,JSON[_0x0305('0x21')](_0x2ed14f));_0x361c4f(_0x2ed14f);})[_0x0305('0x17')](function(_0x2e6ffe){logger[_0x0305('0x13')]('ShowOpenchannelQueue',_0x2e6ffe[_0x0305('0x15')],_0x195e91);_0x236c39(_0xdd1b6f[_0x0305('0x13')](0x1f4,_0x2e6ffe[_0x0305('0x15')]));});});}; \ No newline at end of file +var _0x568a=['../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./openchannelQueue.socket','register','request','then','OpenchannelQueue,\x20%s,\x20%s','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch','OpenchannelQueue','findAll','options','raw','limit','map','include','model','attributes','GetOpenchannelQueue','stringify','ShowOpenchannelQueue','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x406427,_0x413a81){var _0x5244f0=function(_0x2b000f){while(--_0x2b000f){_0x406427['push'](_0x406427['shift']());}};_0x5244f0(++_0x413a81);}(_0x568a,0x1c6));var _0xa568=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x568a[_0x50007c];return _0x5c1ec7;};'use strict';var _=require(_0xa568('0x0'));var util=require(_0xa568('0x1'));var moment=require(_0xa568('0x2'));var BPromise=require(_0xa568('0x3'));var rs=require(_0xa568('0x4'));var fs=require('fs');var Redis=require(_0xa568('0x5'));var db=require(_0xa568('0x6'))['db'];var utils=require(_0xa568('0x7'));var logger=require(_0xa568('0x8'))(_0xa568('0x9'));var config=require(_0xa568('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xa568('0xb')][_0xa568('0xc')]({'port':0x232a});config[_0xa568('0xd')]=_['defaults'](config[_0xa568('0xd')],{'host':_0xa568('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa568('0xd')]));require(_0xa568('0xf'))[_0xa568('0x10')](socket);function respondWithRpcPromise(_0x251514,_0x21843f,_0x2b6705){return new BPromise(function(_0x48c706,_0x4cd73a){return client[_0xa568('0x11')](_0x251514,_0x2b6705)[_0xa568('0x12')](function(_0x476d98){logger['info'](_0xa568('0x13'),_0x21843f,'request\x20sent');logger[_0xa568('0x14')](_0xa568('0x15'),_0x21843f,_0xa568('0x16'),JSON['stringify'](_0x476d98));if(_0x476d98['error']){if(_0x476d98[_0xa568('0x17')][_0xa568('0x18')]===0x1f4){logger[_0xa568('0x17')](_0xa568('0x13'),_0x21843f,_0x476d98[_0xa568('0x17')][_0xa568('0x19')]);return _0x4cd73a(_0x476d98[_0xa568('0x17')][_0xa568('0x19')]);}logger[_0xa568('0x17')](_0xa568('0x13'),_0x21843f,_0x476d98[_0xa568('0x17')][_0xa568('0x19')]);return _0x48c706(_0x476d98[_0xa568('0x17')][_0xa568('0x19')]);}else{logger[_0xa568('0x1a')]('OpenchannelQueue,\x20%s,\x20%s',_0x21843f,_0xa568('0x16'));_0x48c706(_0x476d98['result'][_0xa568('0x19')]);}})[_0xa568('0x1b')](function(_0x36d108){logger['error'](_0xa568('0x13'),_0x21843f,_0x36d108);_0x4cd73a(_0x36d108);});});}exports['GetOpenchannelQueue']=function(_0xe155ea){var _0x32bfa8=this;return new Promise(function(_0x2d82b3,_0x3400c3){return db[_0xa568('0x1c')][_0xa568('0x1d')]({'raw':_0xe155ea[_0xa568('0x1e')]?_0xe155ea[_0xa568('0x1e')][_0xa568('0x1f')]===undefined?!![]:![]:!![],'where':_0xe155ea[_0xa568('0x1e')]?_0xe155ea[_0xa568('0x1e')]['where']||null:null,'attributes':_0xe155ea['options']?_0xe155ea[_0xa568('0x1e')]['attributes']||null:null,'limit':_0xe155ea[_0xa568('0x1e')]?_0xe155ea[_0xa568('0x1e')][_0xa568('0x20')]||null:null,'include':_0xe155ea['options']?_0xe155ea[_0xa568('0x1e')]['include']?_[_0xa568('0x21')](_0xe155ea[_0xa568('0x1e')][_0xa568('0x22')],function(_0x402f5e){return{'model':db[_0x402f5e[_0xa568('0x23')]],'as':_0x402f5e['as'],'attributes':_0x402f5e[_0xa568('0x24')],'include':_0x402f5e[_0xa568('0x22')]?_[_0xa568('0x21')](_0x402f5e[_0xa568('0x22')],function(_0x3fa258){return{'model':db[_0x3fa258['model']],'as':_0x3fa258['as'],'attributes':_0x3fa258[_0xa568('0x24')],'include':_0x3fa258[_0xa568('0x22')]?_[_0xa568('0x21')](_0x3fa258[_0xa568('0x22')],function(_0x59baf5){return{'model':db[_0x59baf5[_0xa568('0x23')]],'as':_0x59baf5['as'],'attributes':_0x59baf5[_0xa568('0x24')]};}):[]};}):[]};}):[]:[]})[_0xa568('0x12')](function(_0x2ab186){logger[_0xa568('0x1a')]('GetOpenchannelQueue',_0xe155ea);logger['debug'](_0xa568('0x25'),_0xe155ea,JSON[_0xa568('0x26')](_0x2ab186));_0x2d82b3(_0x2ab186);})[_0xa568('0x1b')](function(_0x502554){logger['error'](_0xa568('0x25'),_0x502554[_0xa568('0x19')],_0xe155ea);_0x3400c3(_0x32bfa8[_0xa568('0x17')](0x1f4,_0x502554[_0xa568('0x19')]));});});};exports[_0xa568('0x27')]=function(_0x2f6529){var _0x4e7d2c=this;return new Promise(function(_0x49e11b,_0x1a7dcb){return db[_0xa568('0x1c')][_0xa568('0x28')]({'raw':_0x2f6529['options']?_0x2f6529[_0xa568('0x1e')][_0xa568('0x1f')]===undefined?!![]:![]:!![],'where':_0x2f6529[_0xa568('0x1e')]?_0x2f6529[_0xa568('0x1e')][_0xa568('0x29')]||null:null,'attributes':_0x2f6529[_0xa568('0x1e')]?_0x2f6529[_0xa568('0x1e')][_0xa568('0x24')]||null:null,'include':_0x2f6529[_0xa568('0x1e')]?_0x2f6529['options'][_0xa568('0x22')]?_[_0xa568('0x21')](_0x2f6529[_0xa568('0x1e')][_0xa568('0x22')],function(_0x4e6a48){return{'model':db[_0x4e6a48[_0xa568('0x23')]],'as':_0x4e6a48['as'],'attributes':_0x4e6a48[_0xa568('0x24')],'include':_0x4e6a48['include']?_[_0xa568('0x21')](_0x4e6a48[_0xa568('0x22')],function(_0x2eef60){return{'model':db[_0x2eef60[_0xa568('0x23')]],'as':_0x2eef60['as'],'attributes':_0x2eef60['attributes'],'include':_0x2eef60['include']?_[_0xa568('0x21')](_0x2eef60['include'],function(_0x48dca0){return{'model':db[_0x48dca0[_0xa568('0x23')]],'as':_0x48dca0['as'],'attributes':_0x48dca0[_0xa568('0x24')]};}):[]};}):[]};}):[]:[]})[_0xa568('0x12')](function(_0x59318f){logger[_0xa568('0x1a')](_0xa568('0x27'),_0x2f6529);logger['debug'](_0xa568('0x27'),_0x2f6529,JSON[_0xa568('0x26')](_0x59318f));_0x49e11b(_0x59318f);})[_0xa568('0x1b')](function(_0xeafb0c){logger[_0xa568('0x17')](_0xa568('0x27'),_0xeafb0c[_0xa568('0x19')],_0x2f6529);_0x1a7dcb(_0x4e7d2c[_0xa568('0x17')](0x1f4,_0xeafb0c[_0xa568('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 10e86fb..923f2a2 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 _0x0373=['openchannelQueue:','./openchannelQueue.events','save','remove','update','removeListener','register','length'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0373,0xf1));var _0x3037=function(_0x2f4f15,_0x1786f3){_0x2f4f15=_0x2f4f15-0x0;var _0x3f163c=_0x0373[_0x2f4f15];return _0x3f163c;};'use strict';var OpenchannelQueueEvents=require(_0x3037('0x0'));var events=[_0x3037('0x1'),_0x3037('0x2'),_0x3037('0x3')];function createListener(_0xb60b42,_0x5ff971){return function(_0x19c03b){_0x5ff971['emit'](_0xb60b42,_0x19c03b);};}function removeListener(_0x2580d1,_0x5cd697){return function(){OpenchannelQueueEvents[_0x3037('0x4')](_0x2580d1,_0x5cd697);};}exports[_0x3037('0x5')]=function(_0x2b5621){for(var _0x54235b=0x0,_0x41c9be=events[_0x3037('0x6')];_0x54235b<_0x41c9be;_0x54235b++){var _0x4b431a=events[_0x54235b];var _0x4a90e4=createListener(_0x3037('0x7')+_0x4b431a,_0x2b5621);OpenchannelQueueEvents['on'](_0x4b431a,_0x4a90e4);}}; \ No newline at end of file +var _0x48e7=['length','remove','update','emit','removeListener','register'];(function(_0x37164c,_0xed71da){var _0x1da8ae=function(_0x14b5da){while(--_0x14b5da){_0x37164c['push'](_0x37164c['shift']());}};_0x1da8ae(++_0xed71da);}(_0x48e7,0x1db));var _0x748e=function(_0x4b2b6c,_0x2f1ab2){_0x4b2b6c=_0x4b2b6c-0x0;var _0x38ea4b=_0x48e7[_0x4b2b6c];return _0x38ea4b;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=['save',_0x748e('0x0'),_0x748e('0x1')];function createListener(_0xef995a,_0x3fae4e){return function(_0x37ed22){_0x3fae4e[_0x748e('0x2')](_0xef995a,_0x37ed22);};}function removeListener(_0x586485,_0x44e5c7){return function(){OpenchannelQueueEvents[_0x748e('0x3')](_0x586485,_0x44e5c7);};}exports[_0x748e('0x4')]=function(_0x5d51aa){for(var _0x3f21e7=0x0,_0x25228f=events[_0x748e('0x5')];_0x3f21e7<_0x25228f;_0x3f21e7++){var _0x53edb6=events[_0x3f21e7];var _0x313e39=createListener('openchannelQueue:'+_0x53edb6,_0x5d51aa);OpenchannelQueueEvents['on'](_0x53edb6,_0x313e39);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 01b201e..7fbe4c2 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 _0x2e63=['describe','/:id','show','post','create','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe'];(function(_0x17efcf,_0x3ab690){var _0x4af413=function(_0x24d49e){while(--_0x24d49e){_0x17efcf['push'](_0x17efcf['shift']());}};_0x4af413(++_0x3ab690);}(_0x2e63,0xa2));var _0x32e6=function(_0x33a6bd,_0x564362){_0x33a6bd=_0x33a6bd-0x0;var _0x339aff=_0x2e63[_0x33a6bd];return _0x339aff;};'use strict';var multer=require('multer');var util=require(_0x32e6('0x0'));var path=require(_0x32e6('0x1'));var timeout=require(_0x32e6('0x2'));var express=require(_0x32e6('0x3'));var router=express[_0x32e6('0x4')]();var fs_extra=require(_0x32e6('0x5'));var auth=require(_0x32e6('0x6'));var interaction=require(_0x32e6('0x7'));var config=require(_0x32e6('0x8'));var controller=require(_0x32e6('0x9'));router[_0x32e6('0xa')]('/',auth[_0x32e6('0xb')](),controller[_0x32e6('0xc')]);router[_0x32e6('0xa')](_0x32e6('0xd'),auth[_0x32e6('0xb')](),controller[_0x32e6('0xe')]);router['get'](_0x32e6('0xf'),auth[_0x32e6('0xb')](),controller[_0x32e6('0x10')]);router[_0x32e6('0x11')]('/',auth[_0x32e6('0xb')](),controller[_0x32e6('0x12')]);router['put'](_0x32e6('0xf'),auth[_0x32e6('0xb')](),controller['update']);router[_0x32e6('0x13')](_0x32e6('0xf'),auth[_0x32e6('0xb')](),controller[_0x32e6('0x14')]);module[_0x32e6('0x15')]=router; \ No newline at end of file +var _0x66a9=['isAuthenticated','describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','/describe'];(function(_0x291f8b,_0x3b5591){var _0x275171=function(_0xb33d67){while(--_0xb33d67){_0x291f8b['push'](_0x291f8b['shift']());}};_0x275171(++_0x3b5591);}(_0x66a9,0x16f));var _0x966a=function(_0x31688a,_0x588c7d){_0x31688a=_0x31688a-0x0;var _0xc7b088=_0x66a9[_0x31688a];return _0xc7b088;};'use strict';var multer=require(_0x966a('0x0'));var util=require(_0x966a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x966a('0x2'));var router=express[_0x966a('0x3')]();var fs_extra=require(_0x966a('0x4'));var auth=require(_0x966a('0x5'));var interaction=require(_0x966a('0x6'));var config=require(_0x966a('0x7'));var controller=require(_0x966a('0x8'));router[_0x966a('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x966a('0x9')](_0x966a('0xa'),auth[_0x966a('0xb')](),controller[_0x966a('0xc')]);router[_0x966a('0x9')](_0x966a('0xd'),auth['isAuthenticated'](),controller[_0x966a('0xe')]);router[_0x966a('0xf')]('/',auth['isAuthenticated'](),controller[_0x966a('0x10')]);router[_0x966a('0x11')](_0x966a('0xd'),auth[_0x966a('0xb')](),controller['update']);router[_0x966a('0x12')]('/:id',auth[_0x966a('0xb')](),controller[_0x966a('0x13')]);module[_0x966a('0x14')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 83babe6..083c64d 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 _0x607c=['sequelize','exports','STRING','DATE'];(function(_0x51c5b5,_0x579ea9){var _0x4d360e=function(_0x2b0dbc){while(--_0x2b0dbc){_0x51c5b5['push'](_0x51c5b5['shift']());}};_0x4d360e(++_0x579ea9);}(_0x607c,0x1dc));var _0xc607=function(_0x337d67,_0x33e33c){_0x337d67=_0x337d67-0x0;var _0x1f42bd=_0x607c[_0x337d67];return _0x1f42bd;};'use strict';var moment=require('moment');var Sequelize=require(_0xc607('0x0'));module[_0xc607('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xc607('0x2')]},'joinAt':{'type':Sequelize[_0xc607('0x3')]},'leaveAt':{'type':Sequelize[_0xc607('0x3')]},'acceptAt':{'type':Sequelize[_0xc607('0x3')]},'exitAt':{'type':Sequelize[_0xc607('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2900=['sequelize','exports','STRING','DATE','moment'];(function(_0x5dcd17,_0x1614e1){var _0x59a412=function(_0x520e39){while(--_0x520e39){_0x5dcd17['push'](_0x5dcd17['shift']());}};_0x59a412(++_0x1614e1);}(_0x2900,0x108));var _0x0290=function(_0x2cc0b3,_0x120bf1){_0x2cc0b3=_0x2cc0b3-0x0;var _0x1667ef=_0x2900[_0x2cc0b3];return _0x1667ef;};'use strict';var moment=require(_0x0290('0x0'));var Sequelize=require(_0x0290('0x1'));module[_0x0290('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x0290('0x3')]},'joinAt':{'type':Sequelize[_0x0290('0x4')]},'leaveAt':{'type':Sequelize[_0x0290('0x4')]},'acceptAt':{'type':Sequelize[_0x0290('0x4')]},'exitAt':{'type':Sequelize[_0x0290('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index cd4061c..f6e9257 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 _0x4f3b=['to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','error','stack','name','send','index','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','OpenchannelQueueReport','includeAll','include','findAll','rows','catch','params','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path'];(function(_0x59629b,_0x3d305e){var _0x19df9c=function(_0x307fe2){while(--_0x307fe2){_0x59629b['push'](_0x59629b['shift']());}};_0x19df9c(++_0x3d305e);}(_0x4f3b,0xd6));var _0xb4f3=function(_0x3bd52b,_0xbbc735){_0x3bd52b=_0x3bd52b-0x0;var _0x1e5b89=_0x4f3b[_0x3bd52b];return _0x1e5b89;};'use strict';var emlformat=require(_0xb4f3('0x0'));var rimraf=require(_0xb4f3('0x1'));var zipdir=require(_0xb4f3('0x2'));var jsonpatch=require(_0xb4f3('0x3'));var rp=require('request-promise');var moment=require(_0xb4f3('0x4'));var BPromise=require(_0xb4f3('0x5'));var Mustache=require(_0xb4f3('0x6'));var util=require('util');var path=require(_0xb4f3('0x7'));var sox=require('sox');var csv=require(_0xb4f3('0x8'));var ejs=require(_0xb4f3('0x9'));var fs=require('fs');var fs_extra=require(_0xb4f3('0xa'));var _=require(_0xb4f3('0xb'));var squel=require(_0xb4f3('0xc'));var crypto=require('crypto');var jsforce=require(_0xb4f3('0xd'));var deskjs=require(_0xb4f3('0xe'));var toCsv=require(_0xb4f3('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb4f3('0xf'));var authService=require(_0xb4f3('0x10'));var qs=require(_0xb4f3('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb4f3('0x12'))(_0xb4f3('0x13'));var utils=require(_0xb4f3('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xb4f3('0x15'));var db=require(_0xb4f3('0x16'))['db'];function respondWithStatusCode(_0x4a0dc4,_0x31e4e3){_0x31e4e3=_0x31e4e3||0xcc;return function(_0x24c378){if(_0x24c378){return _0x4a0dc4[_0xb4f3('0x17')](_0x31e4e3);}return _0x4a0dc4['status'](_0x31e4e3)[_0xb4f3('0x18')]();};}function respondWithResult(_0x5135ed,_0x5e2009){_0x5e2009=_0x5e2009||0xc8;return function(_0x2290e0){if(_0x2290e0){return _0x5135ed[_0xb4f3('0x19')](_0x5e2009)[_0xb4f3('0x1a')](_0x2290e0);}};}function respondWithFilteredResult(_0x24aa24,_0x4ab44e){return function(_0x1a79de){if(_0x1a79de){var _0x4194a5=typeof _0x4ab44e[_0xb4f3('0x1b')]==='undefined'&&typeof _0x4ab44e['limit']===_0xb4f3('0x1c');var _0x2f3fd=_0x1a79de[_0xb4f3('0x1d')];var _0x21b6a9=_0x4194a5?0x0:_0x4ab44e['offset'];var _0x56f507=_0x4194a5?_0x1a79de[_0xb4f3('0x1d')]:_0x4ab44e[_0xb4f3('0x1b')]+_0x4ab44e[_0xb4f3('0x1e')];var _0x2cc084;if(_0x56f507>=_0x2f3fd){_0x56f507=_0x2f3fd;_0x2cc084=0xc8;}else{_0x2cc084=0xce;}_0x24aa24[_0xb4f3('0x19')](_0x2cc084);return _0x24aa24[_0xb4f3('0x1f')](_0xb4f3('0x20'),_0x21b6a9+'-'+_0x56f507+'/'+_0x2f3fd)[_0xb4f3('0x1a')](_0x1a79de);}return null;};}function patchUpdates(_0x1c60cc){return function(_0x1cd98c){try{jsonpatch['apply'](_0x1cd98c,_0x1c60cc,!![]);}catch(_0x58ef6){return BPromise[_0xb4f3('0x21')](_0x58ef6);}return _0x1cd98c['save']();};}function saveUpdates(_0x5a7464,_0x2aaa2c){return function(_0x191f04){if(_0x191f04){return _0x191f04[_0xb4f3('0x22')](_0x5a7464)[_0xb4f3('0x23')](function(_0x3f1666){return _0x3f1666;});}return null;};}function removeEntity(_0x31ef9e,_0x15d68b){return function(_0x13c7e1){if(_0x13c7e1){return _0x13c7e1['destroy']()[_0xb4f3('0x23')](function(){_0x31ef9e[_0xb4f3('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x79cf7b,_0x129fba){return function(_0x195ef9){if(!_0x195ef9){_0x79cf7b[_0xb4f3('0x17')](0x194);}return _0x195ef9;};}function handleError(_0x3e2bcb,_0x31e174){_0x31e174=_0x31e174||0x1f4;return function(_0x1f018c){logger[_0xb4f3('0x24')](_0x1f018c[_0xb4f3('0x25')]);if(_0x1f018c[_0xb4f3('0x26')]){delete _0x1f018c['name'];}_0x3e2bcb['status'](_0x31e174)[_0xb4f3('0x27')](_0x1f018c);};}exports[_0xb4f3('0x28')]=function(_0x3e1867,_0x25576){var _0x592fed={},_0x31558d={},_0x5254bb={'count':0x0,'rows':[]};var _0x8e1e24=_[_0xb4f3('0x29')](db['OpenchannelQueueReport']['rawAttributes'],function(_0x21841c){return{'name':_0x21841c[_0xb4f3('0x2a')],'type':_0x21841c[_0xb4f3('0x2b')][_0xb4f3('0x2c')]};});_0x31558d[_0xb4f3('0x2d')]=_[_0xb4f3('0x29')](_0x8e1e24,'name');_0x31558d['query']=_[_0xb4f3('0x2e')](_0x3e1867[_0xb4f3('0x2f')]);_0x31558d[_0xb4f3('0x30')]=_[_0xb4f3('0x31')](_0x31558d[_0xb4f3('0x2d')],_0x31558d['query']);_0x592fed[_0xb4f3('0x32')]=_['intersection'](_0x31558d[_0xb4f3('0x2d')],qs[_0xb4f3('0x33')](_0x3e1867[_0xb4f3('0x2f')][_0xb4f3('0x33')]));_0x592fed['attributes']=_0x592fed['attributes'][_0xb4f3('0x34')]?_0x592fed[_0xb4f3('0x32')]:_0x31558d[_0xb4f3('0x2d')];if(!_0x3e1867[_0xb4f3('0x2f')][_0xb4f3('0x35')](_0xb4f3('0x36'))){_0x592fed['limit']=qs[_0xb4f3('0x1e')](_0x3e1867['query'][_0xb4f3('0x1e')]);_0x592fed[_0xb4f3('0x1b')]=qs[_0xb4f3('0x1b')](_0x3e1867[_0xb4f3('0x2f')][_0xb4f3('0x1b')]);}_0x592fed[_0xb4f3('0x37')]=qs[_0xb4f3('0x38')](_0x3e1867[_0xb4f3('0x2f')][_0xb4f3('0x38')]);_0x592fed[_0xb4f3('0x39')]=qs[_0xb4f3('0x30')](_['pick'](_0x3e1867['query'],_0x31558d[_0xb4f3('0x30')]),_0x8e1e24);if(_0x3e1867['query'][_0xb4f3('0x3a')]){_0x592fed[_0xb4f3('0x39')]=_[_0xb4f3('0x3b')](_0x592fed['where'],{'$or':_[_0xb4f3('0x29')](_0x8e1e24,function(_0x37d7b7){if(_0x37d7b7['type']!==_0xb4f3('0x3c')){var _0xc59580={};_0xc59580[_0x37d7b7[_0xb4f3('0x26')]]={'$like':'%'+_0x3e1867[_0xb4f3('0x2f')][_0xb4f3('0x3a')]+'%'};return _0xc59580;}})});}_0x592fed=_[_0xb4f3('0x3b')]({},_0x592fed,_0x3e1867[_0xb4f3('0x3d')]);var _0x2f04c5={'where':_0x592fed[_0xb4f3('0x39')]};return db[_0xb4f3('0x3e')][_0xb4f3('0x1d')](_0x2f04c5)['then'](function(_0x4ae864){_0x5254bb[_0xb4f3('0x1d')]=_0x4ae864;if(_0x3e1867[_0xb4f3('0x2f')][_0xb4f3('0x3f')]){_0x592fed[_0xb4f3('0x40')]=[{'all':!![]}];}return db[_0xb4f3('0x3e')][_0xb4f3('0x41')](_0x592fed);})['then'](function(_0x9aeffe){_0x5254bb[_0xb4f3('0x42')]=_0x9aeffe;return _0x5254bb;})[_0xb4f3('0x23')](respondWithFilteredResult(_0x25576,_0x592fed))[_0xb4f3('0x43')](handleError(_0x25576,null));};exports['show']=function(_0xf02ca9,_0x23859b){var _0xc47b9c={'raw':!![],'where':{'id':_0xf02ca9[_0xb4f3('0x44')]['id']}},_0x5ad67a={};_0x5ad67a['model']=_[_0xb4f3('0x2e')](db['OpenchannelQueueReport']['rawAttributes']);_0x5ad67a[_0xb4f3('0x2f')]=_[_0xb4f3('0x2e')](_0xf02ca9[_0xb4f3('0x2f')]);_0x5ad67a[_0xb4f3('0x30')]=_[_0xb4f3('0x31')](_0x5ad67a['model'],_0x5ad67a[_0xb4f3('0x2f')]);_0xc47b9c[_0xb4f3('0x32')]=_['intersection'](_0x5ad67a[_0xb4f3('0x2d')],qs['fields'](_0xf02ca9[_0xb4f3('0x2f')][_0xb4f3('0x33')]));_0xc47b9c['attributes']=_0xc47b9c[_0xb4f3('0x32')][_0xb4f3('0x34')]?_0xc47b9c[_0xb4f3('0x32')]:_0x5ad67a['model'];if(_0xf02ca9[_0xb4f3('0x2f')][_0xb4f3('0x3f')]){_0xc47b9c[_0xb4f3('0x40')]=[{'all':!![]}];}_0xc47b9c=_['merge']({},_0xc47b9c,_0xf02ca9[_0xb4f3('0x3d')]);return db[_0xb4f3('0x3e')][_0xb4f3('0x45')](_0xc47b9c)[_0xb4f3('0x23')](handleEntityNotFound(_0x23859b,null))['then'](respondWithResult(_0x23859b,null))[_0xb4f3('0x43')](handleError(_0x23859b,null));};exports[_0xb4f3('0x46')]=function(_0x43e294,_0x115ffb){return db[_0xb4f3('0x3e')][_0xb4f3('0x46')](_0x43e294['body'],{})[_0xb4f3('0x23')](respondWithResult(_0x115ffb,0xc9))[_0xb4f3('0x43')](handleError(_0x115ffb,null));};exports[_0xb4f3('0x22')]=function(_0x2f7283,_0x1349c0){if(_0x2f7283[_0xb4f3('0x47')]['id']){delete _0x2f7283['body']['id'];}return db[_0xb4f3('0x3e')]['find']({'where':{'id':_0x2f7283[_0xb4f3('0x44')]['id']}})['then'](handleEntityNotFound(_0x1349c0,null))[_0xb4f3('0x23')](saveUpdates(_0x2f7283[_0xb4f3('0x47')],null))[_0xb4f3('0x23')](respondWithResult(_0x1349c0,null))[_0xb4f3('0x43')](handleError(_0x1349c0,null));};exports[_0xb4f3('0x48')]=function(_0x31c22c,_0x26e3ec){return db['OpenchannelQueueReport'][_0xb4f3('0x45')]({'where':{'id':_0x31c22c['params']['id']}})[_0xb4f3('0x23')](handleEntityNotFound(_0x26e3ec,null))[_0xb4f3('0x23')](removeEntity(_0x26e3ec,null))[_0xb4f3('0x43')](handleError(_0x26e3ec,null));};exports[_0xb4f3('0x49')]=function(_0x4fd1b6,_0x47aade){return db['OpenchannelQueueReport']['describe']()[_0xb4f3('0x23')](respondWithResult(_0x47aade,null))[_0xb4f3('0x43')](handleError(_0x47aade,null));}; \ No newline at end of file +var _0xcc4b=['find','create','body','params','describe','eml-format','rimraf','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','stack','name','index','OpenchannelQueueReport','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys'];(function(_0x47da7d,_0x1cefb6){var _0x2fe361=function(_0x152a45){while(--_0x152a45){_0x47da7d['push'](_0x47da7d['shift']());}};_0x2fe361(++_0x1cefb6);}(_0xcc4b,0x99));var _0xbcc4=function(_0x9b7a64,_0x38d4a8){_0x9b7a64=_0x9b7a64-0x0;var _0x33fd98=_0xcc4b[_0x9b7a64];return _0x33fd98;};'use strict';var emlformat=require(_0xbcc4('0x0'));var rimraf=require(_0xbcc4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbcc4('0x2'));var moment=require(_0xbcc4('0x3'));var BPromise=require(_0xbcc4('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbcc4('0x5'));var sox=require(_0xbcc4('0x6'));var csv=require(_0xbcc4('0x7'));var ejs=require(_0xbcc4('0x8'));var fs=require('fs');var fs_extra=require(_0xbcc4('0x9'));var _=require(_0xbcc4('0xa'));var squel=require(_0xbcc4('0xb'));var crypto=require(_0xbcc4('0xc'));var jsforce=require(_0xbcc4('0xd'));var deskjs=require(_0xbcc4('0xe'));var toCsv=require('to-csv');var querystring=require(_0xbcc4('0xf'));var Papa=require('papaparse');var Redis=require(_0xbcc4('0x10'));var authService=require(_0xbcc4('0x11'));var qs=require(_0xbcc4('0x12'));var as=require(_0xbcc4('0x13'));var hardwareService=require(_0xbcc4('0x14'));var logger=require(_0xbcc4('0x15'))(_0xbcc4('0x16'));var utils=require(_0xbcc4('0x17'));var config=require(_0xbcc4('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2bcd75,_0x58c738){_0x58c738=_0x58c738||0xcc;return function(_0x845960){if(_0x845960){return _0x2bcd75[_0xbcc4('0x19')](_0x58c738);}return _0x2bcd75[_0xbcc4('0x1a')](_0x58c738)[_0xbcc4('0x1b')]();};}function respondWithResult(_0x5d8538,_0x4bfad0){_0x4bfad0=_0x4bfad0||0xc8;return function(_0x2017f1){if(_0x2017f1){return _0x5d8538[_0xbcc4('0x1a')](_0x4bfad0)[_0xbcc4('0x1c')](_0x2017f1);}};}function respondWithFilteredResult(_0x3b44bf,_0x388be5){return function(_0x3f82ae){if(_0x3f82ae){var _0x8aa608=typeof _0x388be5[_0xbcc4('0x1d')]===_0xbcc4('0x1e')&&typeof _0x388be5['limit']===_0xbcc4('0x1e');var _0x1bce91=_0x3f82ae[_0xbcc4('0x1f')];var _0x5e3906=_0x8aa608?0x0:_0x388be5['offset'];var _0x5663a4=_0x8aa608?_0x3f82ae[_0xbcc4('0x1f')]:_0x388be5[_0xbcc4('0x1d')]+_0x388be5[_0xbcc4('0x20')];var _0x50812f;if(_0x5663a4>=_0x1bce91){_0x5663a4=_0x1bce91;_0x50812f=0xc8;}else{_0x50812f=0xce;}_0x3b44bf[_0xbcc4('0x1a')](_0x50812f);return _0x3b44bf['set'](_0xbcc4('0x21'),_0x5e3906+'-'+_0x5663a4+'/'+_0x1bce91)[_0xbcc4('0x1c')](_0x3f82ae);}return null;};}function patchUpdates(_0x5a78fc){return function(_0x4c0489){try{jsonpatch[_0xbcc4('0x22')](_0x4c0489,_0x5a78fc,!![]);}catch(_0x41fe95){return BPromise[_0xbcc4('0x23')](_0x41fe95);}return _0x4c0489[_0xbcc4('0x24')]();};}function saveUpdates(_0x240026,_0x2fca44){return function(_0x3ee842){if(_0x3ee842){return _0x3ee842[_0xbcc4('0x25')](_0x240026)[_0xbcc4('0x26')](function(_0x317a17){return _0x317a17;});}return null;};}function removeEntity(_0x44baed,_0x389b28){return function(_0x123383){if(_0x123383){return _0x123383['destroy']()[_0xbcc4('0x26')](function(){_0x44baed[_0xbcc4('0x1a')](0xcc)[_0xbcc4('0x1b')]();});}};}function handleEntityNotFound(_0x2021b3,_0x7946c){return function(_0x331e36){if(!_0x331e36){_0x2021b3[_0xbcc4('0x19')](0x194);}return _0x331e36;};}function handleError(_0x57ef11,_0x42126e){_0x42126e=_0x42126e||0x1f4;return function(_0x1ce704){logger['error'](_0x1ce704[_0xbcc4('0x27')]);if(_0x1ce704['name']){delete _0x1ce704[_0xbcc4('0x28')];}_0x57ef11[_0xbcc4('0x1a')](_0x42126e)['send'](_0x1ce704);};}exports[_0xbcc4('0x29')]=function(_0x437299,_0x2cb2d6){var _0x2beef0={},_0x49e3f8={},_0x247ffa={'count':0x0,'rows':[]};var _0x1863ea=_['map'](db[_0xbcc4('0x2a')][_0xbcc4('0x2b')],function(_0xefc1eb){return{'name':_0xefc1eb[_0xbcc4('0x2c')],'type':_0xefc1eb['type'][_0xbcc4('0x2d')]};});_0x49e3f8[_0xbcc4('0x2e')]=_['map'](_0x1863ea,_0xbcc4('0x28'));_0x49e3f8[_0xbcc4('0x2f')]=_['keys'](_0x437299[_0xbcc4('0x2f')]);_0x49e3f8[_0xbcc4('0x30')]=_[_0xbcc4('0x31')](_0x49e3f8[_0xbcc4('0x2e')],_0x49e3f8[_0xbcc4('0x2f')]);_0x2beef0[_0xbcc4('0x32')]=_[_0xbcc4('0x31')](_0x49e3f8[_0xbcc4('0x2e')],qs['fields'](_0x437299[_0xbcc4('0x2f')][_0xbcc4('0x33')]));_0x2beef0[_0xbcc4('0x32')]=_0x2beef0['attributes'][_0xbcc4('0x34')]?_0x2beef0[_0xbcc4('0x32')]:_0x49e3f8[_0xbcc4('0x2e')];if(!_0x437299[_0xbcc4('0x2f')][_0xbcc4('0x35')]('nolimit')){_0x2beef0[_0xbcc4('0x20')]=qs[_0xbcc4('0x20')](_0x437299[_0xbcc4('0x2f')][_0xbcc4('0x20')]);_0x2beef0[_0xbcc4('0x1d')]=qs['offset'](_0x437299[_0xbcc4('0x2f')][_0xbcc4('0x1d')]);}_0x2beef0[_0xbcc4('0x36')]=qs[_0xbcc4('0x37')](_0x437299['query'][_0xbcc4('0x37')]);_0x2beef0[_0xbcc4('0x38')]=qs[_0xbcc4('0x30')](_['pick'](_0x437299['query'],_0x49e3f8[_0xbcc4('0x30')]),_0x1863ea);if(_0x437299[_0xbcc4('0x2f')][_0xbcc4('0x39')]){_0x2beef0[_0xbcc4('0x38')]=_[_0xbcc4('0x3a')](_0x2beef0[_0xbcc4('0x38')],{'$or':_['map'](_0x1863ea,function(_0x561a18){if(_0x561a18[_0xbcc4('0x3b')]!==_0xbcc4('0x3c')){var _0x41a460={};_0x41a460[_0x561a18[_0xbcc4('0x28')]]={'$like':'%'+_0x437299[_0xbcc4('0x2f')]['filter']+'%'};return _0x41a460;}})});}_0x2beef0=_[_0xbcc4('0x3a')]({},_0x2beef0,_0x437299[_0xbcc4('0x3d')]);var _0x1caa3f={'where':_0x2beef0[_0xbcc4('0x38')]};return db[_0xbcc4('0x2a')][_0xbcc4('0x1f')](_0x1caa3f)[_0xbcc4('0x26')](function(_0x3a6240){_0x247ffa['count']=_0x3a6240;if(_0x437299['query'][_0xbcc4('0x3e')]){_0x2beef0[_0xbcc4('0x3f')]=[{'all':!![]}];}return db[_0xbcc4('0x2a')][_0xbcc4('0x40')](_0x2beef0);})['then'](function(_0x2e8375){_0x247ffa[_0xbcc4('0x41')]=_0x2e8375;return _0x247ffa;})['then'](respondWithFilteredResult(_0x2cb2d6,_0x2beef0))[_0xbcc4('0x42')](handleError(_0x2cb2d6,null));};exports[_0xbcc4('0x43')]=function(_0x36d321,_0x45e2d5){var _0x3a596e={'raw':!![],'where':{'id':_0x36d321['params']['id']}},_0x2ed0bf={};_0x2ed0bf[_0xbcc4('0x2e')]=_[_0xbcc4('0x44')](db[_0xbcc4('0x2a')][_0xbcc4('0x2b')]);_0x2ed0bf[_0xbcc4('0x2f')]=_[_0xbcc4('0x44')](_0x36d321['query']);_0x2ed0bf[_0xbcc4('0x30')]=_[_0xbcc4('0x31')](_0x2ed0bf[_0xbcc4('0x2e')],_0x2ed0bf[_0xbcc4('0x2f')]);_0x3a596e[_0xbcc4('0x32')]=_[_0xbcc4('0x31')](_0x2ed0bf[_0xbcc4('0x2e')],qs['fields'](_0x36d321[_0xbcc4('0x2f')][_0xbcc4('0x33')]));_0x3a596e['attributes']=_0x3a596e[_0xbcc4('0x32')]['length']?_0x3a596e[_0xbcc4('0x32')]:_0x2ed0bf[_0xbcc4('0x2e')];if(_0x36d321['query']['includeAll']){_0x3a596e[_0xbcc4('0x3f')]=[{'all':!![]}];}_0x3a596e=_['merge']({},_0x3a596e,_0x36d321[_0xbcc4('0x3d')]);return db[_0xbcc4('0x2a')][_0xbcc4('0x45')](_0x3a596e)[_0xbcc4('0x26')](handleEntityNotFound(_0x45e2d5,null))[_0xbcc4('0x26')](respondWithResult(_0x45e2d5,null))[_0xbcc4('0x42')](handleError(_0x45e2d5,null));};exports['create']=function(_0x7334da,_0x2f4805){return db[_0xbcc4('0x2a')][_0xbcc4('0x46')](_0x7334da[_0xbcc4('0x47')],{})[_0xbcc4('0x26')](respondWithResult(_0x2f4805,0xc9))[_0xbcc4('0x42')](handleError(_0x2f4805,null));};exports[_0xbcc4('0x25')]=function(_0xa64ec,_0x3dc17f){if(_0xa64ec['body']['id']){delete _0xa64ec[_0xbcc4('0x47')]['id'];}return db[_0xbcc4('0x2a')]['find']({'where':{'id':_0xa64ec[_0xbcc4('0x48')]['id']}})[_0xbcc4('0x26')](handleEntityNotFound(_0x3dc17f,null))[_0xbcc4('0x26')](saveUpdates(_0xa64ec[_0xbcc4('0x47')],null))[_0xbcc4('0x26')](respondWithResult(_0x3dc17f,null))[_0xbcc4('0x42')](handleError(_0x3dc17f,null));};exports['destroy']=function(_0x534b45,_0x8a7d0b){return db[_0xbcc4('0x2a')][_0xbcc4('0x45')]({'where':{'id':_0x534b45[_0xbcc4('0x48')]['id']}})[_0xbcc4('0x26')](handleEntityNotFound(_0x8a7d0b,null))[_0xbcc4('0x26')](removeEntity(_0x8a7d0b,null))[_0xbcc4('0x42')](handleError(_0x8a7d0b,null));};exports[_0xbcc4('0x49')]=function(_0xbbec7,_0x42a336){return db['OpenchannelQueueReport']['describe']()['then'](respondWithResult(_0x42a336,null))[_0xbcc4('0x42')](handleError(_0x42a336,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index ecf6168..0d78174 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0x5b13ec,_0x363ec6){var _0x2e4608=function(_0xb912e1){while(--_0xb912e1){_0x5b13ec['push'](_0x5b13ec['shift']());}};_0x2e4608(++_0x363ec6);}(_0x1261,0x144));var _0x1126=function(_0x24697b,_0x2eb072){_0x24697b=_0x24697b-0x0;var _0x585b99=_0x1261[_0x24697b];return _0x585b99;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2ef3=['define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./openchannelQueueReport.attributes','exports'];(function(_0x464e74,_0x583c17){var _0x439c03=function(_0x5069b7){while(--_0x5069b7){_0x464e74['push'](_0x464e74['shift']());}};_0x439c03(++_0x583c17);}(_0x2ef3,0xba));var _0x32ef=function(_0x54a9a6,_0x49f5b9){_0x54a9a6=_0x54a9a6-0x0;var _0x306c02=_0x2ef3[_0x54a9a6];return _0x306c02;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var logger=require(_0x32ef('0x2'))(_0x32ef('0x3'));var moment=require(_0x32ef('0x4'));var BPromise=require(_0x32ef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32ef('0x6'));var rimraf=require(_0x32ef('0x7'));var config=require('../../config/environment');var attributes=require(_0x32ef('0x8'));module[_0x32ef('0x9')]=function(_0x4c8104,_0x5dfa09){return _0x4c8104[_0x32ef('0xa')](_0x32ef('0xb'),attributes,{'tableName':_0x32ef('0xc'),'paranoid':![],'indexes':[{'name':_0x32ef('0xd'),'fields':[_0x32ef('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index d297110..043b9e2 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 _0x7462=['raw','info','update','body','where','attributes','lodash','util','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','CreateOpenchannelQueueReport','create','options'];(function(_0xf048f2,_0x20bfc2){var _0x4d58ed=function(_0x12696c){while(--_0x12696c){_0xf048f2['push'](_0xf048f2['shift']());}};_0x4d58ed(++_0x20bfc2);}(_0x7462,0x165));var _0x2746=function(_0x1aba25,_0x1faed1){_0x1aba25=_0x1aba25-0x0;var _0x47d997=_0x7462[_0x1aba25];return _0x47d997;};'use strict';var _=require(_0x2746('0x0'));var util=require(_0x2746('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2746('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2746('0x3'));var logger=require(_0x2746('0x4'))('rpc');var config=require(_0x2746('0x5'));var jayson=require(_0x2746('0x6'));var client=jayson[_0x2746('0x7')][_0x2746('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2a2f42,_0x2940d8,_0x1447bc){return new BPromise(function(_0x40ad2b,_0x283327){return client['request'](_0x2a2f42,_0x1447bc)[_0x2746('0x9')](function(_0x2e4713){logger['info'](_0x2746('0xa'),_0x2940d8,_0x2746('0xb'));logger[_0x2746('0xc')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x2940d8,_0x2746('0xb'),JSON[_0x2746('0xd')](_0x2e4713));if(_0x2e4713[_0x2746('0xe')]){if(_0x2e4713[_0x2746('0xe')][_0x2746('0xf')]===0x1f4){logger[_0x2746('0xe')](_0x2746('0xa'),_0x2940d8,_0x2e4713[_0x2746('0xe')][_0x2746('0x10')]);return _0x283327(_0x2e4713[_0x2746('0xe')][_0x2746('0x10')]);}logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x2940d8,_0x2e4713[_0x2746('0xe')][_0x2746('0x10')]);return _0x40ad2b(_0x2e4713[_0x2746('0xe')][_0x2746('0x10')]);}else{logger['info'](_0x2746('0xa'),_0x2940d8,_0x2746('0xb'));_0x40ad2b(_0x2e4713['result']['message']);}})[_0x2746('0x11')](function(_0x43f06c){logger[_0x2746('0xe')](_0x2746('0xa'),_0x2940d8,_0x43f06c);_0x283327(_0x43f06c);});});}exports[_0x2746('0x12')]=function(_0x232108){var _0x3556b5=this;return new Promise(function(_0x6102f3,_0x25c122){return db['OpenchannelQueueReport'][_0x2746('0x13')](_0x232108['body'],{'raw':_0x232108[_0x2746('0x14')]?_0x232108[_0x2746('0x14')][_0x2746('0x15')]===undefined?!![]:![]:!![]})[_0x2746('0x9')](function(_0xa64e76){logger[_0x2746('0x16')](_0x2746('0x12'),_0x232108);logger[_0x2746('0xc')](_0x2746('0x12'),_0x232108,JSON['stringify'](_0xa64e76));_0x6102f3(_0xa64e76);})['catch'](function(_0x7390b3){logger[_0x2746('0xe')](_0x2746('0x12'),_0x7390b3['message'],_0x232108);_0x25c122(_0x3556b5[_0x2746('0xe')](0x1f4,_0x7390b3[_0x2746('0x10')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x2b4652){var _0x5cf1fb=this;return new Promise(function(_0x4bbe26,_0x5bc3c8){return db['OpenchannelQueueReport'][_0x2746('0x17')](_0x2b4652[_0x2746('0x18')],{'raw':_0x2b4652['options']?_0x2b4652[_0x2746('0x14')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b4652[_0x2746('0x14')]?_0x2b4652[_0x2746('0x14')][_0x2746('0x19')]||null:null,'attributes':_0x2b4652[_0x2746('0x14')]?_0x2b4652[_0x2746('0x14')][_0x2746('0x1a')]||null:null,'limit':_0x2b4652[_0x2746('0x14')]?_0x2b4652[_0x2746('0x14')]['limit']||null:null})[_0x2746('0x9')](function(_0x6c2ef9){logger['info']('UpdateOpenchannelQueueReport',_0x2b4652);logger['debug']('UpdateOpenchannelQueueReport',_0x2b4652,JSON['stringify'](_0x6c2ef9));_0x4bbe26(_0x6c2ef9);})[_0x2746('0x11')](function(_0x1305b8){logger['error']('UpdateOpenchannelQueueReport',_0x1305b8[_0x2746('0x10')],_0x2b4652);_0x5bc3c8(_0x5cf1fb[_0x2746('0xe')](0x1f4,_0x1305b8['message']));});});}; \ No newline at end of file +var _0x536f=['../../config/logger','../../config/environment','client','http','request','then','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','options','debug','catch','update','body','raw','where','attributes','UpdateOpenchannelQueueReport','lodash','ioredis','../../mysqldb','../../config/utils'];(function(_0x1cec9c,_0x43ba99){var _0x4b880b=function(_0x22a967){while(--_0x22a967){_0x1cec9c['push'](_0x1cec9c['shift']());}};_0x4b880b(++_0x43ba99);}(_0x536f,0x70));var _0xf536=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x536f[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xf536('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf536('0x1'));var db=require(_0xf536('0x2'))['db'];var utils=require(_0xf536('0x3'));var logger=require(_0xf536('0x4'))('rpc');var config=require(_0xf536('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xf536('0x6')][_0xf536('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2fc517,_0x486ee3,_0x5952b7){return new BPromise(function(_0x3b5191,_0x422541){return client[_0xf536('0x8')](_0x2fc517,_0x5952b7)[_0xf536('0x9')](function(_0x4f2eaf){logger['info'](_0xf536('0xa'),_0x486ee3,_0xf536('0xb'));logger['debug']('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x486ee3,_0xf536('0xb'),JSON[_0xf536('0xc')](_0x4f2eaf));if(_0x4f2eaf[_0xf536('0xd')]){if(_0x4f2eaf[_0xf536('0xd')][_0xf536('0xe')]===0x1f4){logger['error'](_0xf536('0xa'),_0x486ee3,_0x4f2eaf['error'][_0xf536('0xf')]);return _0x422541(_0x4f2eaf[_0xf536('0xd')][_0xf536('0xf')]);}logger[_0xf536('0xd')](_0xf536('0xa'),_0x486ee3,_0x4f2eaf[_0xf536('0xd')][_0xf536('0xf')]);return _0x3b5191(_0x4f2eaf[_0xf536('0xd')][_0xf536('0xf')]);}else{logger[_0xf536('0x10')](_0xf536('0xa'),_0x486ee3,_0xf536('0xb'));_0x3b5191(_0x4f2eaf['result'][_0xf536('0xf')]);}})['catch'](function(_0x238b9d){logger['error'](_0xf536('0xa'),_0x486ee3,_0x238b9d);_0x422541(_0x238b9d);});});}exports[_0xf536('0x11')]=function(_0xbca324){var _0x19756b=this;return new Promise(function(_0x4532a0,_0x189334){return db[_0xf536('0x12')][_0xf536('0x13')](_0xbca324['body'],{'raw':_0xbca324[_0xf536('0x14')]?_0xbca324[_0xf536('0x14')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x466f95){logger[_0xf536('0x10')](_0xf536('0x11'),_0xbca324);logger[_0xf536('0x15')](_0xf536('0x11'),_0xbca324,JSON[_0xf536('0xc')](_0x466f95));_0x4532a0(_0x466f95);})[_0xf536('0x16')](function(_0xe1d6a8){logger[_0xf536('0xd')](_0xf536('0x11'),_0xe1d6a8['message'],_0xbca324);_0x189334(_0x19756b[_0xf536('0xd')](0x1f4,_0xe1d6a8[_0xf536('0xf')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x1df79c){var _0xddf70e=this;return new Promise(function(_0x2d9dfb,_0x252cae){return db[_0xf536('0x12')][_0xf536('0x17')](_0x1df79c[_0xf536('0x18')],{'raw':_0x1df79c['options']?_0x1df79c[_0xf536('0x14')][_0xf536('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1df79c[_0xf536('0x14')]?_0x1df79c[_0xf536('0x14')][_0xf536('0x1a')]||null:null,'attributes':_0x1df79c['options']?_0x1df79c[_0xf536('0x14')][_0xf536('0x1b')]||null:null,'limit':_0x1df79c[_0xf536('0x14')]?_0x1df79c[_0xf536('0x14')]['limit']||null:null})[_0xf536('0x9')](function(_0x485da0){logger[_0xf536('0x10')](_0xf536('0x1c'),_0x1df79c);logger[_0xf536('0x15')](_0xf536('0x1c'),_0x1df79c,JSON[_0xf536('0xc')](_0x485da0));_0x2d9dfb(_0x485da0);})[_0xf536('0x16')](function(_0x330c47){logger[_0xf536('0xd')](_0xf536('0x1c'),_0x330c47[_0xf536('0xf')],_0x1df79c);_0x252cae(_0xddf70e[_0xf536('0xd')](0x1f4,_0x330c47[_0xf536('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 6b3fa42..0b3fe2f 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 _0x48ec=['update','delete','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','isAuthenticated','index','get','/describe','describe','create','/:id'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x48ec,0x120));var _0xc48e=function(_0x1b3ed9,_0x23c04){_0x1b3ed9=_0x1b3ed9-0x0;var _0x5a8e35=_0x48ec[_0x1b3ed9];return _0x5a8e35;};'use strict';var multer=require('multer');var util=require(_0xc48e('0x0'));var path=require(_0xc48e('0x1'));var timeout=require(_0xc48e('0x2'));var express=require('express');var router=express[_0xc48e('0x3')]();var fs_extra=require(_0xc48e('0x4'));var auth=require(_0xc48e('0x5'));var interaction=require(_0xc48e('0x6'));var config=require(_0xc48e('0x7'));var controller=require(_0xc48e('0x8'));router['get']('/',auth[_0xc48e('0x9')](),controller[_0xc48e('0xa')]);router[_0xc48e('0xb')](_0xc48e('0xc'),auth[_0xc48e('0x9')](),controller[_0xc48e('0xd')]);router[_0xc48e('0xb')]('/:id',auth[_0xc48e('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xc48e('0xe')]);router['put'](_0xc48e('0xf'),auth[_0xc48e('0x9')](),controller[_0xc48e('0x10')]);router[_0xc48e('0x11')](_0xc48e('0xf'),auth[_0xc48e('0x9')](),controller['destroy']);module[_0xc48e('0x12')]=router; \ No newline at end of file +var _0xa803=['isAuthenticated','describe','/:id','show','create','put','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','index','get','/describe'];(function(_0x3d43c7,_0x3a09f2){var _0x32535d=function(_0x121582){while(--_0x121582){_0x3d43c7['push'](_0x3d43c7['shift']());}};_0x32535d(++_0x3a09f2);}(_0xa803,0xc6));var _0x3a80=function(_0x589df7,_0x1e5e94){_0x589df7=_0x589df7-0x0;var _0x3c20f6=_0xa803[_0x589df7];return _0x3c20f6;};'use strict';var multer=require(_0x3a80('0x0'));var util=require(_0x3a80('0x1'));var path=require(_0x3a80('0x2'));var timeout=require(_0x3a80('0x3'));var express=require(_0x3a80('0x4'));var router=express[_0x3a80('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3a80('0x6'));var config=require(_0x3a80('0x7'));var controller=require('./openchannelTransferReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x3a80('0x8')]);router[_0x3a80('0x9')](_0x3a80('0xa'),auth[_0x3a80('0xb')](),controller[_0x3a80('0xc')]);router[_0x3a80('0x9')](_0x3a80('0xd'),auth[_0x3a80('0xb')](),controller[_0x3a80('0xe')]);router['post']('/',auth[_0x3a80('0xb')](),controller[_0x3a80('0xf')]);router[_0x3a80('0x10')](_0x3a80('0xd'),auth[_0x3a80('0xb')](),controller['update']);router[_0x3a80('0x11')](_0x3a80('0xd'),auth[_0x3a80('0xb')](),controller[_0x3a80('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 35009bf..977d82c 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 _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0xeaca8e,_0xfd9c8c){var _0x12806b=function(_0x41bd38){while(--_0x41bd38){_0xeaca8e['push'](_0xeaca8e['shift']());}};_0x12806b(++_0xfd9c8c);}(_0xedd9,0xfc));var _0x9edd=function(_0x4c0fa0,_0xd29144){_0x4c0fa0=_0x4c0fa0-0x0;var _0x17b433=_0xedd9[_0x4c0fa0];return _0x17b433;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file +var _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x124728,_0x463dca){var _0x8eb20f=function(_0x49d9de){while(--_0x49d9de){_0x124728['push'](_0x124728['shift']());}};_0x8eb20f(++_0x463dca);}(_0x34e8,0x12c));var _0x834e=function(_0x100fca,_0x4360d7){_0x100fca=_0x100fca-0x0;var _0x3242b9=_0x34e8[_0x100fca];return _0x3242b9;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 5ef21c6..40568c7 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 _0xa503=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','squel'];(function(_0x56503a,_0x1c4b81){var _0x52e0d4=function(_0x4544d0){while(--_0x4544d0){_0x56503a['push'](_0x56503a['shift']());}};_0x52e0d4(++_0x1c4b81);}(_0xa503,0xd9));var _0x3a50=function(_0x4286e3,_0x1092be){_0x4286e3=_0x4286e3-0x0;var _0x43c92c=_0xa503[_0x4286e3];return _0x43c92c;};'use strict';var emlformat=require(_0x3a50('0x0'));var rimraf=require(_0x3a50('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3a50('0x2'));var rp=require(_0x3a50('0x3'));var moment=require(_0x3a50('0x4'));var BPromise=require(_0x3a50('0x5'));var Mustache=require(_0x3a50('0x6'));var util=require('util');var path=require('path');var sox=require(_0x3a50('0x7'));var csv=require(_0x3a50('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3a50('0x9'));var _=require('lodash');var squel=require(_0x3a50('0xa'));var crypto=require(_0x3a50('0xb'));var jsforce=require(_0x3a50('0xc'));var deskjs=require(_0x3a50('0xd'));var toCsv=require(_0x3a50('0x8'));var querystring=require(_0x3a50('0xe'));var Papa=require(_0x3a50('0xf'));var Redis=require(_0x3a50('0x10'));var authService=require(_0x3a50('0x11'));var qs=require(_0x3a50('0x12'));var as=require(_0x3a50('0x13'));var hardwareService=require(_0x3a50('0x14'));var logger=require(_0x3a50('0x15'))(_0x3a50('0x16'));var utils=require('../../config/utils');var config=require(_0x3a50('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x3a50('0x18'))['db'];function respondWithStatusCode(_0x34a37c,_0xab788e){_0xab788e=_0xab788e||0xcc;return function(_0x168fc7){if(_0x168fc7){return _0x34a37c['sendStatus'](_0xab788e);}return _0x34a37c[_0x3a50('0x19')](_0xab788e)[_0x3a50('0x1a')]();};}function respondWithResult(_0x588bce,_0x323d1c){_0x323d1c=_0x323d1c||0xc8;return function(_0x46ad3e){if(_0x46ad3e){return _0x588bce[_0x3a50('0x19')](_0x323d1c)[_0x3a50('0x1b')](_0x46ad3e);}};}function respondWithFilteredResult(_0x135604,_0xe52fe6){return function(_0x3af3c1){if(_0x3af3c1){var _0xfff0fc=typeof _0xe52fe6['offset']===_0x3a50('0x1c')&&typeof _0xe52fe6[_0x3a50('0x1d')]==='undefined';var _0x41ffd2=_0x3af3c1['count'];var _0x6de5b8=_0xfff0fc?0x0:_0xe52fe6['offset'];var _0x2ec4ab=_0xfff0fc?_0x3af3c1[_0x3a50('0x1e')]:_0xe52fe6['offset']+_0xe52fe6['limit'];var _0x46647a;if(_0x2ec4ab>=_0x41ffd2){_0x2ec4ab=_0x41ffd2;_0x46647a=0xc8;}else{_0x46647a=0xce;}_0x135604['status'](_0x46647a);return _0x135604['set'](_0x3a50('0x1f'),_0x6de5b8+'-'+_0x2ec4ab+'/'+_0x41ffd2)[_0x3a50('0x1b')](_0x3af3c1);}return null;};}function patchUpdates(_0x1bba8e){return function(_0x26b7f4){try{jsonpatch[_0x3a50('0x20')](_0x26b7f4,_0x1bba8e,!![]);}catch(_0x36a592){return BPromise[_0x3a50('0x21')](_0x36a592);}return _0x26b7f4[_0x3a50('0x22')]();};}function saveUpdates(_0x2bb94c,_0x293b06){return function(_0x25e9e0){if(_0x25e9e0){return _0x25e9e0[_0x3a50('0x23')](_0x2bb94c)[_0x3a50('0x24')](function(_0x1d59ba){return _0x1d59ba;});}return null;};}function removeEntity(_0x314305,_0x45c967){return function(_0x2c8bd7){if(_0x2c8bd7){return _0x2c8bd7[_0x3a50('0x25')]()[_0x3a50('0x24')](function(){_0x314305['status'](0xcc)[_0x3a50('0x1a')]();});}};}function handleEntityNotFound(_0x1e46f0,_0x9a0bf){return function(_0x5c75e3){if(!_0x5c75e3){_0x1e46f0[_0x3a50('0x26')](0x194);}return _0x5c75e3;};}function handleError(_0x1b9703,_0x587461){_0x587461=_0x587461||0x1f4;return function(_0x2b432a){logger[_0x3a50('0x27')](_0x2b432a[_0x3a50('0x28')]);if(_0x2b432a[_0x3a50('0x29')]){delete _0x2b432a[_0x3a50('0x29')];}_0x1b9703[_0x3a50('0x19')](_0x587461)[_0x3a50('0x2a')](_0x2b432a);};}exports[_0x3a50('0x2b')]=function(_0x527984,_0x564e21){var _0x4ba672={},_0x29834b={},_0x1ee15d={'count':0x0,'rows':[]};var _0x3b8fdc=_[_0x3a50('0x2c')](db[_0x3a50('0x2d')][_0x3a50('0x2e')],function(_0x1862ed){return{'name':_0x1862ed['fieldName'],'type':_0x1862ed[_0x3a50('0x2f')][_0x3a50('0x30')]};});_0x29834b[_0x3a50('0x31')]=_[_0x3a50('0x2c')](_0x3b8fdc,_0x3a50('0x29'));_0x29834b[_0x3a50('0x32')]=_['keys'](_0x527984[_0x3a50('0x32')]);_0x29834b[_0x3a50('0x33')]=_[_0x3a50('0x34')](_0x29834b[_0x3a50('0x31')],_0x29834b[_0x3a50('0x32')]);_0x4ba672[_0x3a50('0x35')]=_[_0x3a50('0x34')](_0x29834b[_0x3a50('0x31')],qs['fields'](_0x527984[_0x3a50('0x32')][_0x3a50('0x36')]));_0x4ba672[_0x3a50('0x35')]=_0x4ba672[_0x3a50('0x35')][_0x3a50('0x37')]?_0x4ba672[_0x3a50('0x35')]:_0x29834b[_0x3a50('0x31')];if(!_0x527984[_0x3a50('0x32')][_0x3a50('0x38')](_0x3a50('0x39'))){_0x4ba672[_0x3a50('0x1d')]=qs[_0x3a50('0x1d')](_0x527984[_0x3a50('0x32')][_0x3a50('0x1d')]);_0x4ba672[_0x3a50('0x3a')]=qs['offset'](_0x527984[_0x3a50('0x32')][_0x3a50('0x3a')]);}_0x4ba672['order']=qs[_0x3a50('0x3b')](_0x527984[_0x3a50('0x32')][_0x3a50('0x3b')]);_0x4ba672[_0x3a50('0x3c')]=qs[_0x3a50('0x33')](_['pick'](_0x527984[_0x3a50('0x32')],_0x29834b[_0x3a50('0x33')]),_0x3b8fdc);if(_0x527984['query'][_0x3a50('0x3d')]){_0x4ba672[_0x3a50('0x3c')]=_[_0x3a50('0x3e')](_0x4ba672['where'],{'$or':_[_0x3a50('0x2c')](_0x3b8fdc,function(_0x29ae4c){if(_0x29ae4c[_0x3a50('0x2f')]!==_0x3a50('0x3f')){var _0x394159={};_0x394159[_0x29ae4c['name']]={'$like':'%'+_0x527984['query'][_0x3a50('0x3d')]+'%'};return _0x394159;}})});}_0x4ba672=_['merge']({},_0x4ba672,_0x527984[_0x3a50('0x40')]);var _0x3a5a6c={'where':_0x4ba672[_0x3a50('0x3c')]};return db[_0x3a50('0x2d')][_0x3a50('0x1e')](_0x3a5a6c)[_0x3a50('0x24')](function(_0x58477f){_0x1ee15d[_0x3a50('0x1e')]=_0x58477f;if(_0x527984[_0x3a50('0x32')]['includeAll']){_0x4ba672[_0x3a50('0x41')]=[{'all':!![]}];}return db[_0x3a50('0x2d')][_0x3a50('0x42')](_0x4ba672);})[_0x3a50('0x24')](function(_0x3c9530){_0x1ee15d[_0x3a50('0x43')]=_0x3c9530;return _0x1ee15d;})[_0x3a50('0x24')](respondWithFilteredResult(_0x564e21,_0x4ba672))[_0x3a50('0x44')](handleError(_0x564e21,null));};exports[_0x3a50('0x45')]=function(_0x488ede,_0x12182b){var _0x3b8db7={'raw':!![],'where':{'id':_0x488ede[_0x3a50('0x46')]['id']}},_0x5e0e90={};_0x5e0e90[_0x3a50('0x31')]=_[_0x3a50('0x47')](db[_0x3a50('0x2d')]['rawAttributes']);_0x5e0e90[_0x3a50('0x32')]=_[_0x3a50('0x47')](_0x488ede['query']);_0x5e0e90['filters']=_[_0x3a50('0x34')](_0x5e0e90[_0x3a50('0x31')],_0x5e0e90[_0x3a50('0x32')]);_0x3b8db7[_0x3a50('0x35')]=_['intersection'](_0x5e0e90[_0x3a50('0x31')],qs[_0x3a50('0x36')](_0x488ede['query'][_0x3a50('0x36')]));_0x3b8db7[_0x3a50('0x35')]=_0x3b8db7[_0x3a50('0x35')]['length']?_0x3b8db7['attributes']:_0x5e0e90['model'];if(_0x488ede[_0x3a50('0x32')]['includeAll']){_0x3b8db7[_0x3a50('0x41')]=[{'all':!![]}];}_0x3b8db7=_['merge']({},_0x3b8db7,_0x488ede[_0x3a50('0x40')]);return db[_0x3a50('0x2d')][_0x3a50('0x48')](_0x3b8db7)[_0x3a50('0x24')](handleEntityNotFound(_0x12182b,null))[_0x3a50('0x24')](respondWithResult(_0x12182b,null))[_0x3a50('0x44')](handleError(_0x12182b,null));};exports['create']=function(_0x205ee9,_0x272917){return db['OpenchannelTransferReport'][_0x3a50('0x49')](_0x205ee9[_0x3a50('0x4a')],{})[_0x3a50('0x24')](respondWithResult(_0x272917,0xc9))['catch'](handleError(_0x272917,null));};exports['update']=function(_0x182b59,_0x538fbf){if(_0x182b59[_0x3a50('0x4a')]['id']){delete _0x182b59[_0x3a50('0x4a')]['id'];}return db['OpenchannelTransferReport'][_0x3a50('0x48')]({'where':{'id':_0x182b59[_0x3a50('0x46')]['id']}})['then'](handleEntityNotFound(_0x538fbf,null))[_0x3a50('0x24')](saveUpdates(_0x182b59[_0x3a50('0x4a')],null))['then'](respondWithResult(_0x538fbf,null))['catch'](handleError(_0x538fbf,null));};exports[_0x3a50('0x25')]=function(_0x354f3e,_0x41e6b9){return db[_0x3a50('0x2d')][_0x3a50('0x48')]({'where':{'id':_0x354f3e[_0x3a50('0x46')]['id']}})[_0x3a50('0x24')](handleEntityNotFound(_0x41e6b9,null))[_0x3a50('0x24')](removeEntity(_0x41e6b9,null))['catch'](handleError(_0x41e6b9,null));};exports[_0x3a50('0x4b')]=function(_0x2608f2,_0x4fc928){return db[_0x3a50('0x2d')][_0x3a50('0x4b')]()['then'](respondWithResult(_0x4fc928,null))[_0x3a50('0x44')](handleError(_0x4fc928,null));}; \ No newline at end of file +var _0x245c=['index','map','OpenchannelTransferReport','type','key','model','query','filters','attributes','intersection','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','findAll','rows','show','params','rawAttributes','fields','length','include','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined','count','set','Content-Range','json','reject','update','then','destroy','sendStatus','error','stack','name','send'];(function(_0x4cc492,_0x162c85){var _0x1f36b9=function(_0xce4b2){while(--_0xce4b2){_0x4cc492['push'](_0x4cc492['shift']());}};_0x1f36b9(++_0x162c85);}(_0x245c,0x1dc));var _0xc245=function(_0x3795e3,_0x51bbf1){_0x3795e3=_0x3795e3-0x0;var _0x5e7e19=_0x245c[_0x3795e3];return _0x5e7e19;};'use strict';var emlformat=require(_0xc245('0x0'));var rimraf=require(_0xc245('0x1'));var zipdir=require(_0xc245('0x2'));var jsonpatch=require(_0xc245('0x3'));var rp=require(_0xc245('0x4'));var moment=require('moment');var BPromise=require(_0xc245('0x5'));var Mustache=require('mustache');var util=require(_0xc245('0x6'));var path=require(_0xc245('0x7'));var sox=require(_0xc245('0x8'));var csv=require(_0xc245('0x9'));var ejs=require(_0xc245('0xa'));var fs=require('fs');var fs_extra=require(_0xc245('0xb'));var _=require('lodash');var squel=require(_0xc245('0xc'));var crypto=require('crypto');var jsforce=require(_0xc245('0xd'));var deskjs=require(_0xc245('0xe'));var toCsv=require(_0xc245('0x9'));var querystring=require(_0xc245('0xf'));var Papa=require(_0xc245('0x10'));var Redis=require('ioredis');var authService=require(_0xc245('0x11'));var qs=require(_0xc245('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc245('0x13'));var logger=require(_0xc245('0x14'))(_0xc245('0x15'));var utils=require(_0xc245('0x16'));var config=require(_0xc245('0x17'));var licenseUtil=require(_0xc245('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb6fe31,_0x29fbe6){_0x29fbe6=_0x29fbe6||0xcc;return function(_0x1add0b){if(_0x1add0b){return _0xb6fe31['sendStatus'](_0x29fbe6);}return _0xb6fe31[_0xc245('0x19')](_0x29fbe6)[_0xc245('0x1a')]();};}function respondWithResult(_0x520da5,_0x3f7730){_0x3f7730=_0x3f7730||0xc8;return function(_0x11ef08){if(_0x11ef08){return _0x520da5[_0xc245('0x19')](_0x3f7730)['json'](_0x11ef08);}};}function respondWithFilteredResult(_0x8715eb,_0x335778){return function(_0x45fb16){if(_0x45fb16){var _0x22d9b9=typeof _0x335778[_0xc245('0x1b')]===_0xc245('0x1c')&&typeof _0x335778['limit']===_0xc245('0x1c');var _0x322d7e=_0x45fb16['count'];var _0x1b61b4=_0x22d9b9?0x0:_0x335778[_0xc245('0x1b')];var _0xbb3644=_0x22d9b9?_0x45fb16[_0xc245('0x1d')]:_0x335778[_0xc245('0x1b')]+_0x335778['limit'];var _0x43ef52;if(_0xbb3644>=_0x322d7e){_0xbb3644=_0x322d7e;_0x43ef52=0xc8;}else{_0x43ef52=0xce;}_0x8715eb['status'](_0x43ef52);return _0x8715eb[_0xc245('0x1e')](_0xc245('0x1f'),_0x1b61b4+'-'+_0xbb3644+'/'+_0x322d7e)[_0xc245('0x20')](_0x45fb16);}return null;};}function patchUpdates(_0x49a85a){return function(_0x2a73cc){try{jsonpatch['apply'](_0x2a73cc,_0x49a85a,!![]);}catch(_0x397f94){return BPromise[_0xc245('0x21')](_0x397f94);}return _0x2a73cc['save']();};}function saveUpdates(_0x1dea44,_0x3306ea){return function(_0x2214c1){if(_0x2214c1){return _0x2214c1[_0xc245('0x22')](_0x1dea44)[_0xc245('0x23')](function(_0x145f9c){return _0x145f9c;});}return null;};}function removeEntity(_0x191a1e,_0x12919e){return function(_0x530572){if(_0x530572){return _0x530572[_0xc245('0x24')]()[_0xc245('0x23')](function(){_0x191a1e[_0xc245('0x19')](0xcc)[_0xc245('0x1a')]();});}};}function handleEntityNotFound(_0x18dd38,_0x4bb78c){return function(_0x176d20){if(!_0x176d20){_0x18dd38[_0xc245('0x25')](0x194);}return _0x176d20;};}function handleError(_0x9d28f4,_0x4f0656){_0x4f0656=_0x4f0656||0x1f4;return function(_0x10da73){logger[_0xc245('0x26')](_0x10da73[_0xc245('0x27')]);if(_0x10da73[_0xc245('0x28')]){delete _0x10da73[_0xc245('0x28')];}_0x9d28f4[_0xc245('0x19')](_0x4f0656)[_0xc245('0x29')](_0x10da73);};}exports[_0xc245('0x2a')]=function(_0x18d849,_0xeec5a){var _0x6735b3={},_0x4c4b41={},_0x1baa49={'count':0x0,'rows':[]};var _0x5dee44=_[_0xc245('0x2b')](db[_0xc245('0x2c')]['rawAttributes'],function(_0x43c8bc){return{'name':_0x43c8bc['fieldName'],'type':_0x43c8bc[_0xc245('0x2d')][_0xc245('0x2e')]};});_0x4c4b41[_0xc245('0x2f')]=_[_0xc245('0x2b')](_0x5dee44,_0xc245('0x28'));_0x4c4b41[_0xc245('0x30')]=_['keys'](_0x18d849['query']);_0x4c4b41[_0xc245('0x31')]=_['intersection'](_0x4c4b41[_0xc245('0x2f')],_0x4c4b41[_0xc245('0x30')]);_0x6735b3[_0xc245('0x32')]=_[_0xc245('0x33')](_0x4c4b41[_0xc245('0x2f')],qs['fields'](_0x18d849['query']['fields']));_0x6735b3[_0xc245('0x32')]=_0x6735b3[_0xc245('0x32')]['length']?_0x6735b3[_0xc245('0x32')]:_0x4c4b41['model'];if(!_0x18d849[_0xc245('0x30')]['hasOwnProperty'](_0xc245('0x34'))){_0x6735b3['limit']=qs[_0xc245('0x35')](_0x18d849[_0xc245('0x30')][_0xc245('0x35')]);_0x6735b3[_0xc245('0x1b')]=qs[_0xc245('0x1b')](_0x18d849[_0xc245('0x30')][_0xc245('0x1b')]);}_0x6735b3[_0xc245('0x36')]=qs[_0xc245('0x37')](_0x18d849[_0xc245('0x30')][_0xc245('0x37')]);_0x6735b3[_0xc245('0x38')]=qs[_0xc245('0x31')](_[_0xc245('0x39')](_0x18d849[_0xc245('0x30')],_0x4c4b41['filters']),_0x5dee44);if(_0x18d849[_0xc245('0x30')][_0xc245('0x3a')]){_0x6735b3[_0xc245('0x38')]=_['merge'](_0x6735b3[_0xc245('0x38')],{'$or':_[_0xc245('0x2b')](_0x5dee44,function(_0x5018db){if(_0x5018db[_0xc245('0x2d')]!==_0xc245('0x3b')){var _0x3febc5={};_0x3febc5[_0x5018db[_0xc245('0x28')]]={'$like':'%'+_0x18d849[_0xc245('0x30')][_0xc245('0x3a')]+'%'};return _0x3febc5;}})});}_0x6735b3=_['merge']({},_0x6735b3,_0x18d849[_0xc245('0x3c')]);var _0x2c8e8a={'where':_0x6735b3[_0xc245('0x38')]};return db[_0xc245('0x2c')]['count'](_0x2c8e8a)[_0xc245('0x23')](function(_0x3716e4){_0x1baa49['count']=_0x3716e4;if(_0x18d849[_0xc245('0x30')][_0xc245('0x3d')]){_0x6735b3['include']=[{'all':!![]}];}return db[_0xc245('0x2c')][_0xc245('0x3e')](_0x6735b3);})[_0xc245('0x23')](function(_0x882709){_0x1baa49[_0xc245('0x3f')]=_0x882709;return _0x1baa49;})[_0xc245('0x23')](respondWithFilteredResult(_0xeec5a,_0x6735b3))['catch'](handleError(_0xeec5a,null));};exports[_0xc245('0x40')]=function(_0x5e2fcb,_0x349394){var _0x4e0d37={'raw':!![],'where':{'id':_0x5e2fcb[_0xc245('0x41')]['id']}},_0x33c5c2={};_0x33c5c2['model']=_['keys'](db[_0xc245('0x2c')][_0xc245('0x42')]);_0x33c5c2['query']=_['keys'](_0x5e2fcb[_0xc245('0x30')]);_0x33c5c2[_0xc245('0x31')]=_[_0xc245('0x33')](_0x33c5c2[_0xc245('0x2f')],_0x33c5c2[_0xc245('0x30')]);_0x4e0d37['attributes']=_['intersection'](_0x33c5c2[_0xc245('0x2f')],qs[_0xc245('0x43')](_0x5e2fcb[_0xc245('0x30')]['fields']));_0x4e0d37[_0xc245('0x32')]=_0x4e0d37[_0xc245('0x32')][_0xc245('0x44')]?_0x4e0d37[_0xc245('0x32')]:_0x33c5c2[_0xc245('0x2f')];if(_0x5e2fcb[_0xc245('0x30')][_0xc245('0x3d')]){_0x4e0d37[_0xc245('0x45')]=[{'all':!![]}];}_0x4e0d37=_['merge']({},_0x4e0d37,_0x5e2fcb['options']);return db[_0xc245('0x2c')]['find'](_0x4e0d37)[_0xc245('0x23')](handleEntityNotFound(_0x349394,null))[_0xc245('0x23')](respondWithResult(_0x349394,null))[_0xc245('0x46')](handleError(_0x349394,null));};exports[_0xc245('0x47')]=function(_0x343adc,_0x180c44){return db[_0xc245('0x2c')][_0xc245('0x47')](_0x343adc[_0xc245('0x48')],{})[_0xc245('0x23')](respondWithResult(_0x180c44,0xc9))[_0xc245('0x46')](handleError(_0x180c44,null));};exports[_0xc245('0x22')]=function(_0x58549b,_0x1bf0ab){if(_0x58549b[_0xc245('0x48')]['id']){delete _0x58549b[_0xc245('0x48')]['id'];}return db[_0xc245('0x2c')]['find']({'where':{'id':_0x58549b[_0xc245('0x41')]['id']}})[_0xc245('0x23')](handleEntityNotFound(_0x1bf0ab,null))[_0xc245('0x23')](saveUpdates(_0x58549b[_0xc245('0x48')],null))[_0xc245('0x23')](respondWithResult(_0x1bf0ab,null))[_0xc245('0x46')](handleError(_0x1bf0ab,null));};exports[_0xc245('0x24')]=function(_0x4bde36,_0x1688b9){return db[_0xc245('0x2c')]['find']({'where':{'id':_0x4bde36['params']['id']}})[_0xc245('0x23')](handleEntityNotFound(_0x1688b9,null))[_0xc245('0x23')](removeEntity(_0x1688b9,null))['catch'](handleError(_0x1688b9,null));};exports[_0xc245('0x49')]=function(_0x4bfc9f,_0x41b328){return db[_0xc245('0x2c')]['describe']()[_0xc245('0x23')](respondWithResult(_0x41b328,null))[_0xc245('0x46')](handleError(_0x41b328,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index d839989..db12d12 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 _0xc019=['exports','define','OpenchannelTransferReport','report_openchannel_transfer','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes'];(function(_0x33b2b7,_0x6a4894){var _0x488568=function(_0x3d9264){while(--_0x3d9264){_0x33b2b7['push'](_0x33b2b7['shift']());}};_0x488568(++_0x6a4894);}(_0xc019,0x19a));var _0x9c01=function(_0x143e0b,_0x417a76){_0x143e0b=_0x143e0b-0x0;var _0x1209b0=_0xc019[_0x143e0b];return _0x1209b0;};'use strict';var _=require(_0x9c01('0x0'));var util=require(_0x9c01('0x1'));var logger=require('../../config/logger')(_0x9c01('0x2'));var moment=require(_0x9c01('0x3'));var BPromise=require(_0x9c01('0x4'));var rp=require(_0x9c01('0x5'));var fs=require('fs');var path=require(_0x9c01('0x6'));var rimraf=require(_0x9c01('0x7'));var config=require(_0x9c01('0x8'));var attributes=require(_0x9c01('0x9'));module[_0x9c01('0xa')]=function(_0x52b1e2,_0x5e44a1){return _0x52b1e2[_0x9c01('0xb')](_0x9c01('0xc'),attributes,{'tableName':_0x9c01('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc77e=['uniqueid','util','../../config/logger','api','moment','request-promise','rimraf','exports','define','OpenchannelTransferReport'];(function(_0x3d1d35,_0x4b007a){var _0x472b27=function(_0x1ce7ad){while(--_0x1ce7ad){_0x3d1d35['push'](_0x3d1d35['shift']());}};_0x472b27(++_0x4b007a);}(_0xc77e,0x1eb));var _0xec77=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xc77e[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var util=require(_0xec77('0x0'));var logger=require(_0xec77('0x1'))(_0xec77('0x2'));var moment=require(_0xec77('0x3'));var BPromise=require('bluebird');var rp=require(_0xec77('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xec77('0x5'));var config=require('../../config/environment');var attributes=require('./openchannelTransferReport.attributes');module[_0xec77('0x6')]=function(_0x4cb7ba,_0x1e15e5){return _0x4cb7ba[_0xec77('0x7')](_0xec77('0x8'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0xec77('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 3eab53a..4269eec 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 _0xd67b=['OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','util','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s'];(function(_0xb3c4c,_0x5ace6c){var _0x3f2150=function(_0x4c8ada){while(--_0x4c8ada){_0xb3c4c['push'](_0xb3c4c['shift']());}};_0x3f2150(++_0x5ace6c);}(_0xd67b,0x133));var _0xbd67=function(_0x23619d,_0x51a8aa){_0x23619d=_0x23619d-0x0;var _0x1a99ac=_0xd67b[_0x23619d];return _0x1a99ac;};'use strict';var _=require('lodash');var util=require(_0xbd67('0x0'));var moment=require('moment');var BPromise=require(_0xbd67('0x1'));var rs=require(_0xbd67('0x2'));var fs=require('fs');var Redis=require(_0xbd67('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbd67('0x4'));var logger=require('../../config/logger')(_0xbd67('0x5'));var config=require('../../config/environment');var jayson=require(_0xbd67('0x6'));var client=jayson[_0xbd67('0x7')][_0xbd67('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x27b016,_0x1860c9,_0x72f9ac){return new BPromise(function(_0x2d4af6,_0xfad775){return client[_0xbd67('0x9')](_0x27b016,_0x72f9ac)[_0xbd67('0xa')](function(_0x177f41){logger[_0xbd67('0xb')](_0xbd67('0xc'),_0x1860c9,'request\x20sent');logger['debug'](_0xbd67('0xd'),_0x1860c9,'request\x20sent',JSON[_0xbd67('0xe')](_0x177f41));if(_0x177f41[_0xbd67('0xf')]){if(_0x177f41[_0xbd67('0xf')][_0xbd67('0x10')]===0x1f4){logger[_0xbd67('0xf')](_0xbd67('0xc'),_0x1860c9,_0x177f41[_0xbd67('0xf')][_0xbd67('0x11')]);return _0xfad775(_0x177f41[_0xbd67('0xf')][_0xbd67('0x11')]);}logger['error'](_0xbd67('0xc'),_0x1860c9,_0x177f41[_0xbd67('0xf')][_0xbd67('0x11')]);return _0x2d4af6(_0x177f41[_0xbd67('0xf')][_0xbd67('0x11')]);}else{logger[_0xbd67('0xb')](_0xbd67('0xc'),_0x1860c9,_0xbd67('0x12'));_0x2d4af6(_0x177f41[_0xbd67('0x13')][_0xbd67('0x11')]);}})['catch'](function(_0x4ab3a6){logger[_0xbd67('0xf')](_0xbd67('0xc'),_0x1860c9,_0x4ab3a6);_0xfad775(_0x4ab3a6);});});} \ No newline at end of file +var _0x1a8f=['../../mysqldb','jayson/promise','client','http','request','OpenchannelTransferReport,\x20%s,\x20%s','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0xfa38a8,_0x2d41bf){var _0x4c9b1d=function(_0x2ae306){while(--_0x2ae306){_0xfa38a8['push'](_0xfa38a8['shift']());}};_0x4c9b1d(++_0x2d41bf);}(_0x1a8f,0x87));var _0xf1a8=function(_0x50f92b,_0x32fab3){_0x50f92b=_0x50f92b-0x0;var _0x5cedbc=_0x1a8f[_0x50f92b];return _0x5cedbc;};'use strict';var _=require(_0xf1a8('0x0'));var util=require('util');var moment=require(_0xf1a8('0x1'));var BPromise=require(_0xf1a8('0x2'));var rs=require(_0xf1a8('0x3'));var fs=require('fs');var Redis=require(_0xf1a8('0x4'));var db=require(_0xf1a8('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xf1a8('0x6'));var client=jayson[_0xf1a8('0x7')][_0xf1a8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x540101,_0x3f2b04,_0x4bf52d){return new BPromise(function(_0xea1eb2,_0xa74b7f){return client[_0xf1a8('0x9')](_0x540101,_0x4bf52d)['then'](function(_0x3e0a25){logger['info'](_0xf1a8('0xa'),_0x3f2b04,'request\x20sent');logger[_0xf1a8('0xb')](_0xf1a8('0xc'),_0x3f2b04,_0xf1a8('0xd'),JSON[_0xf1a8('0xe')](_0x3e0a25));if(_0x3e0a25['error']){if(_0x3e0a25[_0xf1a8('0xf')]['code']===0x1f4){logger[_0xf1a8('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x3f2b04,_0x3e0a25[_0xf1a8('0xf')][_0xf1a8('0x10')]);return _0xa74b7f(_0x3e0a25[_0xf1a8('0xf')][_0xf1a8('0x10')]);}logger[_0xf1a8('0xf')](_0xf1a8('0xa'),_0x3f2b04,_0x3e0a25[_0xf1a8('0xf')][_0xf1a8('0x10')]);return _0xea1eb2(_0x3e0a25[_0xf1a8('0xf')]['message']);}else{logger[_0xf1a8('0x11')](_0xf1a8('0xa'),_0x3f2b04,_0xf1a8('0xd'));_0xea1eb2(_0x3e0a25[_0xf1a8('0x12')][_0xf1a8('0x10')]);}})[_0xf1a8('0x13')](function(_0x671ef3){logger[_0xf1a8('0xf')](_0xf1a8('0xa'),_0x3f2b04,_0x671ef3);_0xa74b7f(_0x671ef3);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index c1cfe8f..cfdce81 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 _0x1e8a=['/:id','show','create','put','update','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated'];(function(_0x37d894,_0x3d3b65){var _0x8eb181=function(_0x44d39e){while(--_0x44d39e){_0x37d894['push'](_0x37d894['shift']());}};_0x8eb181(++_0x3d3b65);}(_0x1e8a,0x1b0));var _0xa1e8=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x1e8a[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0xa1e8('0x0'));var util=require(_0xa1e8('0x1'));var path=require('path');var timeout=require(_0xa1e8('0x2'));var express=require('express');var router=express[_0xa1e8('0x3')]();var fs_extra=require(_0xa1e8('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa1e8('0x5'));var config=require(_0xa1e8('0x6'));var controller=require(_0xa1e8('0x7'));router[_0xa1e8('0x8')]('/',auth[_0xa1e8('0x9')](),controller['index']);router[_0xa1e8('0x8')](_0xa1e8('0xa'),auth[_0xa1e8('0x9')](),controller[_0xa1e8('0xb')]);router['post']('/',auth[_0xa1e8('0x9')](),controller[_0xa1e8('0xc')]);router[_0xa1e8('0xd')]('/:id',auth[_0xa1e8('0x9')](),controller[_0xa1e8('0xe')]);router['delete']('/:id',auth[_0xa1e8('0x9')](),controller[_0xa1e8('0xf')]);module[_0xa1e8('0x10')]=router; \ No newline at end of file +var _0xd9cc=['multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update','destroy','exports'];(function(_0x422e5b,_0x2e32d4){var _0x1aa264=function(_0xbf2e1f){while(--_0xbf2e1f){_0x422e5b['push'](_0x422e5b['shift']());}};_0x1aa264(++_0x2e32d4);}(_0xd9cc,0x66));var _0xcd9c=function(_0x3b5270,_0x5c48f1){_0x3b5270=_0x3b5270-0x0;var _0x34cd97=_0xd9cc[_0x3b5270];return _0x34cd97;};'use strict';var multer=require(_0xcd9c('0x0'));var util=require(_0xcd9c('0x1'));var path=require('path');var timeout=require(_0xcd9c('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xcd9c('0x3'));var auth=require(_0xcd9c('0x4'));var interaction=require(_0xcd9c('0x5'));var config=require(_0xcd9c('0x6'));var controller=require('./pause.controller');router[_0xcd9c('0x7')]('/',auth[_0xcd9c('0x8')](),controller[_0xcd9c('0x9')]);router[_0xcd9c('0x7')](_0xcd9c('0xa'),auth[_0xcd9c('0x8')](),controller['show']);router[_0xcd9c('0xb')]('/',auth[_0xcd9c('0x8')](),controller[_0xcd9c('0xc')]);router[_0xcd9c('0xd')](_0xcd9c('0xa'),auth[_0xcd9c('0x8')](),controller[_0xcd9c('0xe')]);router['delete'](_0xcd9c('0xa'),auth[_0xcd9c('0x8')](),controller[_0xcd9c('0xf')]);module[_0xcd9c('0x10')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 77d37e8..5dfb70d 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 _0x75c0=['STRING','sequelize'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x75c0,0xf9));var _0x075c=function(_0x20a5df,_0x4e1567){_0x20a5df=_0x20a5df-0x0;var _0x2124e4=_0x75c0[_0x20a5df];return _0x2124e4;};'use strict';var Sequelize=require(_0x075c('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x075c('0x1')]}}; \ No newline at end of file +var _0xb77c=['exports','STRING','sequelize'];(function(_0x403fed,_0x1d78e){var _0x554177=function(_0x4c25c3){while(--_0x4c25c3){_0x403fed['push'](_0x403fed['shift']());}};_0x554177(++_0x1d78e);}(_0xb77c,0x1d9));var _0xcb77=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xb77c[_0x4c12ec];return _0x3ae42c;};'use strict';var Sequelize=require(_0xcb77('0x0'));module[_0xcb77('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xcb77('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index b727dcf..70346e6 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 _0xd7e8=['squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','json','apply','save','update','then','destroy','Pauses','UserProfileResource','error','stack','name','send','index','map','Pause','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','catch','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x58e0dd,_0x4965d0){var _0xfee956=function(_0x44bb0a){while(--_0x44bb0a){_0x58e0dd['push'](_0x58e0dd['shift']());}};_0xfee956(++_0x4965d0);}(_0xd7e8,0x1ec));var _0x8d7e=function(_0x34e907,_0xc4762){_0x34e907=_0x34e907-0x0;var _0x5bc695=_0xd7e8[_0x34e907];return _0x5bc695;};'use strict';var emlformat=require(_0x8d7e('0x0'));var rimraf=require(_0x8d7e('0x1'));var zipdir=require(_0x8d7e('0x2'));var jsonpatch=require(_0x8d7e('0x3'));var rp=require(_0x8d7e('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8d7e('0x5'));var util=require('util');var path=require(_0x8d7e('0x6'));var sox=require(_0x8d7e('0x7'));var csv=require(_0x8d7e('0x8'));var ejs=require(_0x8d7e('0x9'));var fs=require('fs');var fs_extra=require(_0x8d7e('0xa'));var _=require(_0x8d7e('0xb'));var squel=require(_0x8d7e('0xc'));var crypto=require(_0x8d7e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8d7e('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8d7e('0xf'));var Redis=require('ioredis');var authService=require(_0x8d7e('0x10'));var qs=require(_0x8d7e('0x11'));var as=require(_0x8d7e('0x12'));var hardwareService=require(_0x8d7e('0x13'));var logger=require(_0x8d7e('0x14'))(_0x8d7e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8d7e('0x16'));var db=require(_0x8d7e('0x17'))['db'];function respondWithStatusCode(_0x2c9742,_0x19ee1d){_0x19ee1d=_0x19ee1d||0xcc;return function(_0x1e5afd){if(_0x1e5afd){return _0x2c9742[_0x8d7e('0x18')](_0x19ee1d);}return _0x2c9742['status'](_0x19ee1d)[_0x8d7e('0x19')]();};}function respondWithResult(_0x2f9e1f,_0x4da1b2){_0x4da1b2=_0x4da1b2||0xc8;return function(_0x21ae94){if(_0x21ae94){return _0x2f9e1f[_0x8d7e('0x1a')](_0x4da1b2)['json'](_0x21ae94);}};}function respondWithFilteredResult(_0x271479,_0xc0ce89){return function(_0x1f7f19){if(_0x1f7f19){var _0x1f5f7e=typeof _0xc0ce89[_0x8d7e('0x1b')]===_0x8d7e('0x1c')&&typeof _0xc0ce89[_0x8d7e('0x1d')]==='undefined';var _0x140c70=_0x1f7f19[_0x8d7e('0x1e')];var _0x2969d6=_0x1f5f7e?0x0:_0xc0ce89[_0x8d7e('0x1b')];var _0xc96178=_0x1f5f7e?_0x1f7f19[_0x8d7e('0x1e')]:_0xc0ce89[_0x8d7e('0x1b')]+_0xc0ce89[_0x8d7e('0x1d')];var _0x5c53c2;if(_0xc96178>=_0x140c70){_0xc96178=_0x140c70;_0x5c53c2=0xc8;}else{_0x5c53c2=0xce;}_0x271479[_0x8d7e('0x1a')](_0x5c53c2);return _0x271479[_0x8d7e('0x1f')]('Content-Range',_0x2969d6+'-'+_0xc96178+'/'+_0x140c70)[_0x8d7e('0x20')](_0x1f7f19);}return null;};}function patchUpdates(_0x8bc9ba){return function(_0xba3dcc){try{jsonpatch[_0x8d7e('0x21')](_0xba3dcc,_0x8bc9ba,!![]);}catch(_0x493ce8){return BPromise['reject'](_0x493ce8);}return _0xba3dcc[_0x8d7e('0x22')]();};}function saveUpdates(_0x45276d,_0x3ef33f){return function(_0x51392d){if(_0x51392d){return _0x51392d[_0x8d7e('0x23')](_0x45276d)[_0x8d7e('0x24')](function(_0x1f0bbd){return _0x1f0bbd;});}return null;};}function removeEntity(_0x35a804,_0x4bc3a0){return function(_0x1a41a5){if(_0x1a41a5){return _0x1a41a5[_0x8d7e('0x25')]()[_0x8d7e('0x24')](function(){var _0x2c58dd=_0x1a41a5['get']({'plain':!![]});var _0x247397=_0x8d7e('0x26');return db[_0x8d7e('0x27')][_0x8d7e('0x25')]({'where':{'type':_0x247397,'resourceId':_0x2c58dd['id']}})[_0x8d7e('0x24')](function(){return _0x1a41a5;});})[_0x8d7e('0x24')](function(){_0x35a804['status'](0xcc)[_0x8d7e('0x19')]();});}};}function handleEntityNotFound(_0x2546a7,_0x406604){return function(_0x46e90b){if(!_0x46e90b){_0x2546a7[_0x8d7e('0x18')](0x194);}return _0x46e90b;};}function handleError(_0x2f1272,_0x4f7ef5){_0x4f7ef5=_0x4f7ef5||0x1f4;return function(_0x1ff0a7){logger[_0x8d7e('0x28')](_0x1ff0a7[_0x8d7e('0x29')]);if(_0x1ff0a7[_0x8d7e('0x2a')]){delete _0x1ff0a7[_0x8d7e('0x2a')];}_0x2f1272[_0x8d7e('0x1a')](_0x4f7ef5)[_0x8d7e('0x2b')](_0x1ff0a7);};}exports[_0x8d7e('0x2c')]=function(_0x8fa50d,_0x59bf1d){var _0x1bc614={},_0x20da62={},_0x4267da={'count':0x0,'rows':[]};var _0x4d0bc2=_[_0x8d7e('0x2d')](db[_0x8d7e('0x2e')][_0x8d7e('0x2f')],function(_0x1899e5){return{'name':_0x1899e5['fieldName'],'type':_0x1899e5[_0x8d7e('0x30')][_0x8d7e('0x31')]};});_0x20da62['model']=_[_0x8d7e('0x2d')](_0x4d0bc2,'name');_0x20da62[_0x8d7e('0x32')]=_[_0x8d7e('0x33')](_0x8fa50d[_0x8d7e('0x32')]);_0x20da62[_0x8d7e('0x34')]=_[_0x8d7e('0x35')](_0x20da62[_0x8d7e('0x36')],_0x20da62[_0x8d7e('0x32')]);_0x1bc614['attributes']=_[_0x8d7e('0x35')](_0x20da62[_0x8d7e('0x36')],qs['fields'](_0x8fa50d[_0x8d7e('0x32')][_0x8d7e('0x37')]));_0x1bc614[_0x8d7e('0x38')]=_0x1bc614['attributes'][_0x8d7e('0x39')]?_0x1bc614['attributes']:_0x20da62['model'];if(!_0x8fa50d['query']['hasOwnProperty'](_0x8d7e('0x3a'))){_0x1bc614[_0x8d7e('0x1d')]=qs['limit'](_0x8fa50d[_0x8d7e('0x32')]['limit']);_0x1bc614[_0x8d7e('0x1b')]=qs[_0x8d7e('0x1b')](_0x8fa50d[_0x8d7e('0x32')][_0x8d7e('0x1b')]);}_0x1bc614[_0x8d7e('0x3b')]=qs[_0x8d7e('0x3c')](_0x8fa50d[_0x8d7e('0x32')][_0x8d7e('0x3c')]);_0x1bc614['where']=qs[_0x8d7e('0x34')](_[_0x8d7e('0x3d')](_0x8fa50d[_0x8d7e('0x32')],_0x20da62[_0x8d7e('0x34')]),_0x4d0bc2);if(_0x8fa50d[_0x8d7e('0x32')][_0x8d7e('0x3e')]){_0x1bc614[_0x8d7e('0x3f')]=_[_0x8d7e('0x40')](_0x1bc614['where'],{'$or':_[_0x8d7e('0x2d')](_0x4d0bc2,function(_0x5431ef){if(_0x5431ef[_0x8d7e('0x30')]!==_0x8d7e('0x41')){var _0x309c61={};_0x309c61[_0x5431ef['name']]={'$like':'%'+_0x8fa50d[_0x8d7e('0x32')]['filter']+'%'};return _0x309c61;}})});}_0x1bc614=_[_0x8d7e('0x40')]({},_0x1bc614,_0x8fa50d[_0x8d7e('0x42')]);var _0x2fe88d={'where':_0x1bc614[_0x8d7e('0x3f')]};return db[_0x8d7e('0x2e')][_0x8d7e('0x1e')](_0x2fe88d)[_0x8d7e('0x24')](function(_0x496912){_0x4267da[_0x8d7e('0x1e')]=_0x496912;if(_0x8fa50d[_0x8d7e('0x32')][_0x8d7e('0x43')]){_0x1bc614['include']=[{'all':!![]}];}return db[_0x8d7e('0x2e')][_0x8d7e('0x44')](_0x1bc614);})[_0x8d7e('0x24')](function(_0x21ef43){_0x4267da[_0x8d7e('0x45')]=_0x21ef43;return _0x4267da;})[_0x8d7e('0x24')](respondWithFilteredResult(_0x59bf1d,_0x1bc614))['catch'](handleError(_0x59bf1d,null));};exports[_0x8d7e('0x46')]=function(_0x2f51fb,_0x2fd88d){var _0x6fdd1b={'raw':!![],'where':{'id':_0x2f51fb[_0x8d7e('0x47')]['id']}},_0x387903={};_0x387903[_0x8d7e('0x36')]=_[_0x8d7e('0x33')](db[_0x8d7e('0x2e')][_0x8d7e('0x2f')]);_0x387903[_0x8d7e('0x32')]=_[_0x8d7e('0x33')](_0x2f51fb['query']);_0x387903[_0x8d7e('0x34')]=_[_0x8d7e('0x35')](_0x387903['model'],_0x387903[_0x8d7e('0x32')]);_0x6fdd1b[_0x8d7e('0x38')]=_[_0x8d7e('0x35')](_0x387903[_0x8d7e('0x36')],qs[_0x8d7e('0x37')](_0x2f51fb[_0x8d7e('0x32')][_0x8d7e('0x37')]));_0x6fdd1b['attributes']=_0x6fdd1b[_0x8d7e('0x38')]['length']?_0x6fdd1b['attributes']:_0x387903[_0x8d7e('0x36')];if(_0x2f51fb[_0x8d7e('0x32')][_0x8d7e('0x43')]){_0x6fdd1b['include']=[{'all':!![]}];}_0x6fdd1b=_[_0x8d7e('0x40')]({},_0x6fdd1b,_0x2f51fb['options']);return db[_0x8d7e('0x2e')]['find'](_0x6fdd1b)[_0x8d7e('0x24')](handleEntityNotFound(_0x2fd88d,null))[_0x8d7e('0x24')](respondWithResult(_0x2fd88d,null))[_0x8d7e('0x48')](handleError(_0x2fd88d,null));};exports['create']=function(_0xa9c228,_0x2efa8a){return db['Pause'][_0x8d7e('0x49')](_0xa9c228['body'],{})[_0x8d7e('0x24')](function(_0x3b9f48){var _0x709fc8=_0xa9c228['user'][_0x8d7e('0x4a')]({'plain':!![]});if(!_0x709fc8)throw new Error(_0x8d7e('0x4b'));if(_0x709fc8[_0x8d7e('0x4c')]===_0x8d7e('0x4d')){var _0x3d3818=_0x3b9f48['get']({'plain':!![]});var _0xa5236b='Pauses';return db[_0x8d7e('0x4e')][_0x8d7e('0x4f')]({'where':{'name':_0xa5236b,'userProfileId':_0x709fc8[_0x8d7e('0x50')]},'raw':!![]})['then'](function(_0x3c7616){if(_0x3c7616&&_0x3c7616[_0x8d7e('0x51')]===0x0){return db['UserProfileResource'][_0x8d7e('0x49')]({'name':_0x3d3818[_0x8d7e('0x2a')],'resourceId':_0x3d3818['id'],'type':_0x3c7616[_0x8d7e('0x2a')],'sectionId':_0x3c7616['id']},{})[_0x8d7e('0x24')](function(){return _0x3b9f48;});}else{return _0x3b9f48;}})[_0x8d7e('0x48')](function(_0x545283){logger[_0x8d7e('0x28')](_0x8d7e('0x52'),_0x545283);throw _0x545283;});}return _0x3b9f48;})[_0x8d7e('0x24')](respondWithResult(_0x2efa8a,0xc9))[_0x8d7e('0x48')](handleError(_0x2efa8a,null));};exports[_0x8d7e('0x23')]=function(_0x5e948c,_0x250d18){if(_0x5e948c[_0x8d7e('0x53')]['id']){delete _0x5e948c[_0x8d7e('0x53')]['id'];}return db['Pause']['find']({'where':{'id':_0x5e948c[_0x8d7e('0x47')]['id']}})['then'](handleEntityNotFound(_0x250d18,null))[_0x8d7e('0x24')](saveUpdates(_0x5e948c[_0x8d7e('0x53')],null))['then'](respondWithResult(_0x250d18,null))[_0x8d7e('0x48')](handleError(_0x250d18,null));};exports['destroy']=function(_0xcaa216,_0x195b1c){return db[_0x8d7e('0x2e')][_0x8d7e('0x4f')]({'where':{'id':_0xcaa216[_0x8d7e('0x47')]['id']}})[_0x8d7e('0x24')](handleEntityNotFound(_0x195b1c,null))['then'](removeEntity(_0x195b1c,null))[_0x8d7e('0x48')](handleError(_0x195b1c,null));}; \ No newline at end of file +var _0xab9a=['update','params','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','then','destroy','get','UserProfileResource','error','stack','name','index','Pause','rawAttributes','fieldName','type','query','keys','filters','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','includeAll','include','findAll','catch','show','find','create','body','user','role','Pauses','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x374a3,_0x451296){var _0x38f7ad=function(_0x36c903){while(--_0x36c903){_0x374a3['push'](_0x374a3['shift']());}};_0x38f7ad(++_0x451296);}(_0xab9a,0x1ca));var _0xaab9=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xab9a[_0xc6be3a];return _0x56a310;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaab9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xaab9('0x1'));var moment=require('moment');var BPromise=require(_0xaab9('0x2'));var Mustache=require(_0xaab9('0x3'));var util=require(_0xaab9('0x4'));var path=require(_0xaab9('0x5'));var sox=require(_0xaab9('0x6'));var csv=require('to-csv');var ejs=require(_0xaab9('0x7'));var fs=require('fs');var fs_extra=require(_0xaab9('0x8'));var _=require('lodash');var squel=require(_0xaab9('0x9'));var crypto=require('crypto');var jsforce=require(_0xaab9('0xa'));var deskjs=require(_0xaab9('0xb'));var toCsv=require(_0xaab9('0xc'));var querystring=require(_0xaab9('0xd'));var Papa=require(_0xaab9('0xe'));var Redis=require(_0xaab9('0xf'));var authService=require(_0xaab9('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xaab9('0x11'));var hardwareService=require(_0xaab9('0x12'));var logger=require(_0xaab9('0x13'))('api');var utils=require(_0xaab9('0x14'));var config=require(_0xaab9('0x15'));var licenseUtil=require(_0xaab9('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x742844,_0x1105e3){_0x1105e3=_0x1105e3||0xcc;return function(_0x1aac50){if(_0x1aac50){return _0x742844[_0xaab9('0x17')](_0x1105e3);}return _0x742844['status'](_0x1105e3)['end']();};}function respondWithResult(_0x32492c,_0x5aac1a){_0x5aac1a=_0x5aac1a||0xc8;return function(_0x2ace1e){if(_0x2ace1e){return _0x32492c[_0xaab9('0x18')](_0x5aac1a)['json'](_0x2ace1e);}};}function respondWithFilteredResult(_0x26da4d,_0x2b9f20){return function(_0x53ff75){if(_0x53ff75){var _0x229709=typeof _0x2b9f20[_0xaab9('0x19')]===_0xaab9('0x1a')&&typeof _0x2b9f20['limit']===_0xaab9('0x1a');var _0x272e5e=_0x53ff75[_0xaab9('0x1b')];var _0x4470c8=_0x229709?0x0:_0x2b9f20[_0xaab9('0x19')];var _0x300b85=_0x229709?_0x53ff75[_0xaab9('0x1b')]:_0x2b9f20[_0xaab9('0x19')]+_0x2b9f20[_0xaab9('0x1c')];var _0x1b0227;if(_0x300b85>=_0x272e5e){_0x300b85=_0x272e5e;_0x1b0227=0xc8;}else{_0x1b0227=0xce;}_0x26da4d[_0xaab9('0x18')](_0x1b0227);return _0x26da4d[_0xaab9('0x1d')](_0xaab9('0x1e'),_0x4470c8+'-'+_0x300b85+'/'+_0x272e5e)[_0xaab9('0x1f')](_0x53ff75);}return null;};}function patchUpdates(_0x4dcb50){return function(_0x16393c){try{jsonpatch[_0xaab9('0x20')](_0x16393c,_0x4dcb50,!![]);}catch(_0x3570bf){return BPromise[_0xaab9('0x21')](_0x3570bf);}return _0x16393c['save']();};}function saveUpdates(_0x4a254e,_0x223539){return function(_0xd35279){if(_0xd35279){return _0xd35279['update'](_0x4a254e)[_0xaab9('0x22')](function(_0x3b3688){return _0x3b3688;});}return null;};}function removeEntity(_0x43c468,_0x4b4f5b){return function(_0x569a7e){if(_0x569a7e){return _0x569a7e[_0xaab9('0x23')]()[_0xaab9('0x22')](function(){var _0x16e896=_0x569a7e[_0xaab9('0x24')]({'plain':!![]});var _0xb03b93='Pauses';return db[_0xaab9('0x25')][_0xaab9('0x23')]({'where':{'type':_0xb03b93,'resourceId':_0x16e896['id']}})[_0xaab9('0x22')](function(){return _0x569a7e;});})[_0xaab9('0x22')](function(){_0x43c468[_0xaab9('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15091a,_0x23479e){return function(_0x48423f){if(!_0x48423f){_0x15091a[_0xaab9('0x17')](0x194);}return _0x48423f;};}function handleError(_0x2336a6,_0x3a265){_0x3a265=_0x3a265||0x1f4;return function(_0x105184){logger[_0xaab9('0x26')](_0x105184[_0xaab9('0x27')]);if(_0x105184['name']){delete _0x105184[_0xaab9('0x28')];}_0x2336a6['status'](_0x3a265)['send'](_0x105184);};}exports[_0xaab9('0x29')]=function(_0x3889b6,_0x5816cf){var _0x473589={},_0x27cbeb={},_0x1eba37={'count':0x0,'rows':[]};var _0x14f9b6=_['map'](db[_0xaab9('0x2a')][_0xaab9('0x2b')],function(_0x418696){return{'name':_0x418696[_0xaab9('0x2c')],'type':_0x418696[_0xaab9('0x2d')]['key']};});_0x27cbeb['model']=_['map'](_0x14f9b6,_0xaab9('0x28'));_0x27cbeb[_0xaab9('0x2e')]=_[_0xaab9('0x2f')](_0x3889b6[_0xaab9('0x2e')]);_0x27cbeb[_0xaab9('0x30')]=_['intersection'](_0x27cbeb[_0xaab9('0x31')],_0x27cbeb[_0xaab9('0x2e')]);_0x473589[_0xaab9('0x32')]=_['intersection'](_0x27cbeb[_0xaab9('0x31')],qs[_0xaab9('0x33')](_0x3889b6[_0xaab9('0x2e')][_0xaab9('0x33')]));_0x473589['attributes']=_0x473589[_0xaab9('0x32')]['length']?_0x473589[_0xaab9('0x32')]:_0x27cbeb[_0xaab9('0x31')];if(!_0x3889b6['query'][_0xaab9('0x34')](_0xaab9('0x35'))){_0x473589[_0xaab9('0x1c')]=qs['limit'](_0x3889b6[_0xaab9('0x2e')][_0xaab9('0x1c')]);_0x473589[_0xaab9('0x19')]=qs[_0xaab9('0x19')](_0x3889b6[_0xaab9('0x2e')][_0xaab9('0x19')]);}_0x473589[_0xaab9('0x36')]=qs['sort'](_0x3889b6[_0xaab9('0x2e')][_0xaab9('0x37')]);_0x473589[_0xaab9('0x38')]=qs[_0xaab9('0x30')](_[_0xaab9('0x39')](_0x3889b6['query'],_0x27cbeb[_0xaab9('0x30')]),_0x14f9b6);if(_0x3889b6[_0xaab9('0x2e')][_0xaab9('0x3a')]){_0x473589[_0xaab9('0x38')]=_['merge'](_0x473589[_0xaab9('0x38')],{'$or':_[_0xaab9('0x3b')](_0x14f9b6,function(_0x306412){if(_0x306412[_0xaab9('0x2d')]!=='VIRTUAL'){var _0x33ed0d={};_0x33ed0d[_0x306412['name']]={'$like':'%'+_0x3889b6[_0xaab9('0x2e')]['filter']+'%'};return _0x33ed0d;}})});}_0x473589=_['merge']({},_0x473589,_0x3889b6['options']);var _0x5eab7d={'where':_0x473589[_0xaab9('0x38')]};return db[_0xaab9('0x2a')]['count'](_0x5eab7d)['then'](function(_0x3ba16e){_0x1eba37[_0xaab9('0x1b')]=_0x3ba16e;if(_0x3889b6[_0xaab9('0x2e')][_0xaab9('0x3c')]){_0x473589[_0xaab9('0x3d')]=[{'all':!![]}];}return db['Pause'][_0xaab9('0x3e')](_0x473589);})[_0xaab9('0x22')](function(_0x12a4e3){_0x1eba37['rows']=_0x12a4e3;return _0x1eba37;})['then'](respondWithFilteredResult(_0x5816cf,_0x473589))[_0xaab9('0x3f')](handleError(_0x5816cf,null));};exports[_0xaab9('0x40')]=function(_0xbe2d42,_0x2c9108){var _0x5c99a0={'raw':!![],'where':{'id':_0xbe2d42['params']['id']}},_0x4ef488={};_0x4ef488[_0xaab9('0x31')]=_['keys'](db[_0xaab9('0x2a')]['rawAttributes']);_0x4ef488[_0xaab9('0x2e')]=_[_0xaab9('0x2f')](_0xbe2d42[_0xaab9('0x2e')]);_0x4ef488[_0xaab9('0x30')]=_['intersection'](_0x4ef488[_0xaab9('0x31')],_0x4ef488[_0xaab9('0x2e')]);_0x5c99a0[_0xaab9('0x32')]=_['intersection'](_0x4ef488[_0xaab9('0x31')],qs[_0xaab9('0x33')](_0xbe2d42[_0xaab9('0x2e')][_0xaab9('0x33')]));_0x5c99a0['attributes']=_0x5c99a0[_0xaab9('0x32')]['length']?_0x5c99a0[_0xaab9('0x32')]:_0x4ef488[_0xaab9('0x31')];if(_0xbe2d42[_0xaab9('0x2e')][_0xaab9('0x3c')]){_0x5c99a0[_0xaab9('0x3d')]=[{'all':!![]}];}_0x5c99a0=_['merge']({},_0x5c99a0,_0xbe2d42['options']);return db[_0xaab9('0x2a')][_0xaab9('0x41')](_0x5c99a0)[_0xaab9('0x22')](handleEntityNotFound(_0x2c9108,null))[_0xaab9('0x22')](respondWithResult(_0x2c9108,null))[_0xaab9('0x3f')](handleError(_0x2c9108,null));};exports[_0xaab9('0x42')]=function(_0x4c294a,_0x2c7371){return db[_0xaab9('0x2a')]['create'](_0x4c294a[_0xaab9('0x43')],{})['then'](function(_0x1b3fca){var _0x521b9d=_0x4c294a[_0xaab9('0x44')]['get']({'plain':!![]});if(!_0x521b9d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x521b9d[_0xaab9('0x45')]==='user'){var _0x48b523=_0x1b3fca['get']({'plain':!![]});var _0x4384b3=_0xaab9('0x46');return db[_0xaab9('0x47')]['find']({'where':{'name':_0x4384b3,'userProfileId':_0x521b9d[_0xaab9('0x48')]},'raw':!![]})[_0xaab9('0x22')](function(_0x486960){if(_0x486960&&_0x486960['autoAssociation']===0x0){return db[_0xaab9('0x25')][_0xaab9('0x42')]({'name':_0x48b523[_0xaab9('0x28')],'resourceId':_0x48b523['id'],'type':_0x486960[_0xaab9('0x28')],'sectionId':_0x486960['id']},{})['then'](function(){return _0x1b3fca;});}else{return _0x1b3fca;}})[_0xaab9('0x3f')](function(_0x2bd7f7){logger['error'](_0xaab9('0x49'),_0x2bd7f7);throw _0x2bd7f7;});}return _0x1b3fca;})['then'](respondWithResult(_0x2c7371,0xc9))[_0xaab9('0x3f')](handleError(_0x2c7371,null));};exports[_0xaab9('0x4a')]=function(_0x18a073,_0x1284ea){if(_0x18a073['body']['id']){delete _0x18a073[_0xaab9('0x43')]['id'];}return db[_0xaab9('0x2a')]['find']({'where':{'id':_0x18a073[_0xaab9('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1284ea,null))[_0xaab9('0x22')](saveUpdates(_0x18a073['body'],null))[_0xaab9('0x22')](respondWithResult(_0x1284ea,null))[_0xaab9('0x3f')](handleError(_0x1284ea,null));};exports[_0xaab9('0x23')]=function(_0x50fafe,_0x2bd200){return db[_0xaab9('0x2a')][_0xaab9('0x41')]({'where':{'id':_0x50fafe[_0xaab9('0x4b')]['id']}})[_0xaab9('0x22')](handleEntityNotFound(_0x2bd200,null))[_0xaab9('0x22')](removeEntity(_0x2bd200,null))[_0xaab9('0x3f')](handleError(_0x2bd200,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index aa94e7a..ba45d84 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 _0xabce=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','define','tools_pauses','lodash'];(function(_0x5d02df,_0x3b9d00){var _0x2f9a52=function(_0x4f5fb2){while(--_0x4f5fb2){_0x5d02df['push'](_0x5d02df['shift']());}};_0x2f9a52(++_0x3b9d00);}(_0xabce,0x103));var _0xeabc=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xabce[_0x3ff085];return _0x2b68c3;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./pause.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('Pause',attributes,{'tableName':_0xeabc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe14b=['bluebird','path','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','moment'];(function(_0x320cb1,_0x145acc){var _0x2b5b68=function(_0x31d673){while(--_0x31d673){_0x320cb1['push'](_0x320cb1['shift']());}};_0x2b5b68(++_0x145acc);}(_0xe14b,0x93));var _0xbe14=function(_0x38e228,_0x38c6d6){_0x38e228=_0x38e228-0x0;var _0x14de9e=_0xe14b[_0x38e228];return _0x14de9e;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 661df9b..04c12df 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(_0x30207c,_0x10e987){var _0x2b233b=function(_0x52d584){while(--_0x52d584){_0x30207c['push'](_0x30207c['shift']());}};_0x2b233b(++_0x10e987);}(_0x7a54,0x106));var _0x47a5=function(_0x4d9280,_0x311c17){_0x4d9280=_0x4d9280-0x0;var _0x1004b1=_0x7a54[_0x4d9280];return _0x1004b1;};'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 _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x5098ae,_0x58c03e){var _0x160c2f=function(_0x257390){while(--_0x257390){_0x5098ae['push'](_0x5098ae['shift']());}};_0x160c2f(++_0x58c03e);}(_0xb10b,0x12a));var _0xbb10=function(_0x5baf32,_0x103278){_0x5baf32=_0x5baf32-0x0;var _0x539cae=_0xb10b[_0x5baf32];return _0x539cae;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index fcf9552..c9e793a 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 _0xca66=['file','upload','put','/:id','update','delete','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/webhook','webhookGet','show','/:id/download','download','diskStorage','join','root','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','post','single'];(function(_0x215859,_0x52e1d1){var _0x3636f6=function(_0x38218d){while(--_0x38218d){_0x215859['push'](_0x215859['shift']());}};_0x3636f6(++_0x52e1d1);}(_0xca66,0x8b));var _0x6ca6=function(_0x45dab0,_0x56fefe){_0x45dab0=_0x45dab0-0x0;var _0x2dc300=_0xca66[_0x45dab0];return _0x2dc300;};'use strict';var multer=require(_0x6ca6('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6ca6('0x1'));var express=require(_0x6ca6('0x2'));var router=express[_0x6ca6('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6ca6('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6ca6('0x5'));var controller=require('./plugin.controller');router[_0x6ca6('0x6')]('/',auth[_0x6ca6('0x7')](),controller[_0x6ca6('0x8')]);router[_0x6ca6('0x6')](_0x6ca6('0x9'),controller[_0x6ca6('0xa')]);router[_0x6ca6('0x6')]('/:id',auth[_0x6ca6('0x7')](),controller[_0x6ca6('0xb')]);router[_0x6ca6('0x6')](_0x6ca6('0xc'),auth[_0x6ca6('0x7')](),controller[_0x6ca6('0xd')]);var upload=multer({'storage':multer[_0x6ca6('0xe')]({'destination':function(_0x55a626,_0x38678e,_0xe39235){_0xe39235(null,path[_0x6ca6('0xf')](config[_0x6ca6('0x10')],_0x6ca6('0x11')));},'filename':function(_0x41e903,_0x4c05e9,_0x152e63){_0x4c05e9[_0x6ca6('0x12')]=_0x4c05e9['originalname'][_0x6ca6('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x152e63(null,util[_0x6ca6('0x14')](_0x6ca6('0x15'),path[_0x6ca6('0x16')](_0x4c05e9[_0x6ca6('0x12')],path[_0x6ca6('0x17')](_0x4c05e9['originalname'])),Date['now'](),path['extname'](_0x4c05e9[_0x6ca6('0x12')])));}})});router[_0x6ca6('0x18')]('/',upload[_0x6ca6('0x19')](_0x6ca6('0x1a')),controller[_0x6ca6('0x1b')]);router[_0x6ca6('0x18')](_0x6ca6('0x9'),controller['webhookPost']);router[_0x6ca6('0x1c')](_0x6ca6('0x1d'),auth[_0x6ca6('0x7')](),controller[_0x6ca6('0x1e')]);router[_0x6ca6('0x1f')](_0x6ca6('0x1d'),auth[_0x6ca6('0x7')](),controller[_0x6ca6('0x1f')]);module[_0x6ca6('0x20')]=router; \ No newline at end of file +var _0x984b=['Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','/webhook','webhookGet','/:id','show','get','/:id/download','download','diskStorage','join','root','server/files/plugins','originalname','format','%s-%s%s','extname','now','post','file','upload','put','update','delete','exports','connect-timeout','express'];(function(_0x5aee3c,_0x21e0c2){var _0x359474=function(_0x80c424){while(--_0x80c424){_0x5aee3c['push'](_0x5aee3c['shift']());}};_0x359474(++_0x21e0c2);}(_0x984b,0xee));var _0xb984=function(_0x5bb0e9,_0x1aecd3){_0x5bb0e9=_0x5bb0e9-0x0;var _0x48b04e=_0x984b[_0x5bb0e9];return _0x48b04e;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xb984('0x0'));var express=require(_0xb984('0x1'));var router=express[_0xb984('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb984('0x3'));var config=require(_0xb984('0x4'));var controller=require('./plugin.controller');router['get']('/',auth[_0xb984('0x5')](),controller[_0xb984('0x6')]);router['get'](_0xb984('0x7'),controller[_0xb984('0x8')]);router['get'](_0xb984('0x9'),auth['isAuthenticated'](),controller[_0xb984('0xa')]);router[_0xb984('0xb')](_0xb984('0xc'),auth[_0xb984('0x5')](),controller[_0xb984('0xd')]);var upload=multer({'storage':multer[_0xb984('0xe')]({'destination':function(_0x11525c,_0xfca315,_0x16d46f){_0x16d46f(null,path[_0xb984('0xf')](config[_0xb984('0x10')],_0xb984('0x11')));},'filename':function(_0x5b4add,_0x1b922b,_0x4b9c75){_0x1b922b[_0xb984('0x12')]=_0x1b922b[_0xb984('0x12')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4b9c75(null,util[_0xb984('0x13')](_0xb984('0x14'),path['basename'](_0x1b922b[_0xb984('0x12')],path[_0xb984('0x15')](_0x1b922b['originalname'])),Date[_0xb984('0x16')](),path[_0xb984('0x15')](_0x1b922b['originalname'])));}})});router[_0xb984('0x17')]('/',upload['single'](_0xb984('0x18')),controller[_0xb984('0x19')]);router[_0xb984('0x17')](_0xb984('0x7'),controller['webhookPost']);router[_0xb984('0x1a')](_0xb984('0x9'),auth[_0xb984('0x5')](),controller[_0xb984('0x1b')]);router[_0xb984('0x1c')](_0xb984('0x9'),auth['isAuthenticated'](),controller[_0xb984('0x1c')]);module[_0xb984('0x1d')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 91012f3..d03621a 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 _0x68ee=['STRING','ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','agentOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize'];(function(_0x27b735,_0x247815){var _0x3533ba=function(_0x2f27e7){while(--_0x2f27e7){_0x27b735['push'](_0x27b735['shift']());}};_0x3533ba(++_0x247815);}(_0x68ee,0x1ac));var _0xe68e=function(_0x308e67,_0x24c6e8){_0x308e67=_0x308e67-0x0;var _0x407c08=_0x68ee[_0x308e67];return _0x407c08;};'use strict';var Sequelize=require(_0xe68e('0x0'));module['exports']={'name':{'type':Sequelize[_0xe68e('0x1')]},'type':{'type':Sequelize[_0xe68e('0x2')](_0xe68e('0x3'),_0xe68e('0x4'))},'description':{'type':Sequelize[_0xe68e('0x5')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0xe68e('0x1')],'comment':_0xe68e('0x6')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xe68e('0x7')},'sidebar':{'type':Sequelize[_0xe68e('0x2')]('adminOnly',_0xe68e('0x8'),_0xe68e('0x9'),'never'),'defaultValue':'always','comment':_0xe68e('0xa')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0xe68e('0x1')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0xe68e('0x1')]},'scriptPath':{'type':Sequelize[_0xe68e('0x1')]}}; \ No newline at end of file +var _0x11e8=['ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','adminOnly','agentOnly','always','sequelize','STRING'];(function(_0x1190c2,_0x2c078b){var _0x6ec988=function(_0x333cdf){while(--_0x333cdf){_0x1190c2['push'](_0x1190c2['shift']());}};_0x6ec988(++_0x2c078b);}(_0x11e8,0x1b6));var _0x811e=function(_0x1da91c,_0x1758ec){_0x1da91c=_0x1da91c-0x0;var _0x407931=_0x11e8[_0x1da91c];return _0x407931;};'use strict';var Sequelize=require(_0x811e('0x0'));module['exports']={'name':{'type':Sequelize[_0x811e('0x1')]},'type':{'type':Sequelize[_0x811e('0x2')](_0x811e('0x3'),_0x811e('0x4'))},'description':{'type':Sequelize[_0x811e('0x5')]},'version':{'type':Sequelize[_0x811e('0x5')]},'path':{'type':Sequelize['STRING'],'comment':_0x811e('0x6')},'active':{'type':Sequelize[_0x811e('0x7')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize['ENUM'](_0x811e('0x8'),_0x811e('0x9'),_0x811e('0xa'),'never'),'defaultValue':_0x811e('0xa'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x811e('0x1')]},'adminUrl':{'type':Sequelize[_0x811e('0x1')]},'agentUrl':{'type':Sequelize[_0x811e('0x1')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 9824c9a..ea8294d 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 _0x42da=['../../config/utils','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./plugin.socket','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','length','find','download','params','join','root','server/files/plugins','format','basename','createWriteStream','zip','warning','ENOENT','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','**/*','node_modules/**/*','finalize','close','existsSync','Sequelize','Plugin\x20not\x20found','%s.zip','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','info','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','scriptPath','create','role','user','UserProfileSection','Plugins','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','body','delete','dirname','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','statusCode','webhookPost','hostname','eml-format','rimraf','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','archiver','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x4f616e,_0x4b791d){var _0x287a92=function(_0x302745){while(--_0x302745){_0x4f616e['push'](_0x4f616e['shift']());}};_0x287a92(++_0x4b791d);}(_0x42da,0x94));var _0xa42d=function(_0x45cf7f,_0x4bd53a){_0x45cf7f=_0x45cf7f-0x0;var _0x5ab273=_0x42da[_0x45cf7f];return _0x5ab273;};'use strict';var emlformat=require(_0xa42d('0x0'));var rimraf=require(_0xa42d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa42d('0x2'));var BPromise=require(_0xa42d('0x3'));var Mustache=require(_0xa42d('0x4'));var util=require('util');var path=require(_0xa42d('0x5'));var sox=require(_0xa42d('0x6'));var csv=require(_0xa42d('0x7'));var ejs=require(_0xa42d('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa42d('0x9'));var squel=require(_0xa42d('0xa'));var crypto=require('crypto');var jsforce=require(_0xa42d('0xb'));var deskjs=require(_0xa42d('0xc'));var toCsv=require(_0xa42d('0x7'));var querystring=require(_0xa42d('0xd'));var Papa=require('papaparse');var extract=require('extract-zip');var rimraf=require(_0xa42d('0x1'));var archiver=require(_0xa42d('0xe'));var Redis=require(_0xa42d('0xf'));var authService=require(_0xa42d('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xa42d('0x11'));var hardwareService=require(_0xa42d('0x12'));var logger=require(_0xa42d('0x13'))(_0xa42d('0x14'));var utils=require(_0xa42d('0x15'));var config=require(_0xa42d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xa42d('0x17'))['db'];config['redis']=_[_0xa42d('0x18')](config[_0xa42d('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xa42d('0x1a'))(new Redis(config[_0xa42d('0x19')]));require(_0xa42d('0x1b'))['register'](socket);function respondWithStatusCode(_0xeaded4,_0x4fd735){_0x4fd735=_0x4fd735||0xcc;return function(_0x56c6ce){if(_0x56c6ce){return _0xeaded4[_0xa42d('0x1c')](_0x4fd735);}return _0xeaded4[_0xa42d('0x1d')](_0x4fd735)[_0xa42d('0x1e')]();};}function respondWithResult(_0x4fb969,_0x4c1d55){_0x4c1d55=_0x4c1d55||0xc8;return function(_0xda9b47){if(_0xda9b47){return _0x4fb969[_0xa42d('0x1d')](_0x4c1d55)['json'](_0xda9b47);}};}function respondWithFilteredResult(_0x3fce1d,_0x15da85){return function(_0x4d694f){if(_0x4d694f){var _0x58ed63=typeof _0x15da85[_0xa42d('0x1f')]===_0xa42d('0x20')&&typeof _0x15da85[_0xa42d('0x21')]===_0xa42d('0x20');var _0x2cad17=_0x4d694f[_0xa42d('0x22')];var _0x23dd5f=_0x58ed63?0x0:_0x15da85[_0xa42d('0x1f')];var _0x460d9f=_0x58ed63?_0x4d694f[_0xa42d('0x22')]:_0x15da85['offset']+_0x15da85[_0xa42d('0x21')];var _0x3e6e39;if(_0x460d9f>=_0x2cad17){_0x460d9f=_0x2cad17;_0x3e6e39=0xc8;}else{_0x3e6e39=0xce;}_0x3fce1d[_0xa42d('0x1d')](_0x3e6e39);return _0x3fce1d[_0xa42d('0x23')](_0xa42d('0x24'),_0x23dd5f+'-'+_0x460d9f+'/'+_0x2cad17)[_0xa42d('0x25')](_0x4d694f);}return null;};}function patchUpdates(_0xe383d7){return function(_0x331b47){try{jsonpatch[_0xa42d('0x26')](_0x331b47,_0xe383d7,!![]);}catch(_0x309fc6){return BPromise[_0xa42d('0x27')](_0x309fc6);}return _0x331b47[_0xa42d('0x28')]();};}function saveUpdates(_0x3765ee,_0x2408dc){return function(_0x5e9a6c){if(_0x5e9a6c){return _0x5e9a6c[_0xa42d('0x29')](_0x3765ee)[_0xa42d('0x2a')](function(_0x137b8a){return _0x137b8a;});}return null;};}function removeEntity(_0x1f7b2a,_0x329637){return function(_0x28dabe){if(_0x28dabe){return _0x28dabe[_0xa42d('0x2b')]()[_0xa42d('0x2a')](function(){var _0x5c46b9=_0x28dabe[_0xa42d('0x2c')]({'plain':!![]});var _0x325566='Plugins';return db[_0xa42d('0x2d')][_0xa42d('0x2b')]({'where':{'type':_0x325566,'resourceId':_0x5c46b9['id']}})[_0xa42d('0x2a')](function(){return _0x28dabe;});})['then'](function(){_0x1f7b2a['status'](0xcc)[_0xa42d('0x1e')]();});}};}function handleEntityNotFound(_0x5e58a7,_0x5c2110){return function(_0x1f4d5b){if(!_0x1f4d5b){_0x5e58a7['sendStatus'](0x194);}return _0x1f4d5b;};}function handleError(_0x5d7b1a,_0x16d97b){_0x16d97b=_0x16d97b||0x1f4;return function(_0x50ae7f){logger[_0xa42d('0x2e')](_0x50ae7f[_0xa42d('0x2f')]);if(_0x50ae7f[_0xa42d('0x30')]){delete _0x50ae7f['name'];}_0x5d7b1a[_0xa42d('0x1d')](_0x16d97b)[_0xa42d('0x31')](_0x50ae7f);};}exports[_0xa42d('0x32')]=function(_0x2aa55a,_0x10bb70){var _0x30d009={},_0x427892={},_0x48603b={'count':0x0,'rows':[]};var _0x3bcac8=_[_0xa42d('0x33')](db[_0xa42d('0x34')][_0xa42d('0x35')],function(_0x45db82){return{'name':_0x45db82[_0xa42d('0x36')],'type':_0x45db82[_0xa42d('0x37')][_0xa42d('0x38')]};});_0x427892['model']=_[_0xa42d('0x33')](_0x3bcac8,_0xa42d('0x30'));_0x427892[_0xa42d('0x39')]=_[_0xa42d('0x3a')](_0x2aa55a[_0xa42d('0x39')]);_0x427892[_0xa42d('0x3b')]=_[_0xa42d('0x3c')](_0x427892[_0xa42d('0x3d')],_0x427892['query']);_0x30d009[_0xa42d('0x3e')]=_[_0xa42d('0x3c')](_0x427892[_0xa42d('0x3d')],qs[_0xa42d('0x3f')](_0x2aa55a['query']['fields']));_0x30d009[_0xa42d('0x3e')]=_0x30d009[_0xa42d('0x3e')]['length']?_0x30d009[_0xa42d('0x3e')]:_0x427892[_0xa42d('0x3d')];if(!_0x2aa55a['query'][_0xa42d('0x40')](_0xa42d('0x41'))){_0x30d009[_0xa42d('0x21')]=qs['limit'](_0x2aa55a[_0xa42d('0x39')][_0xa42d('0x21')]);_0x30d009[_0xa42d('0x1f')]=qs[_0xa42d('0x1f')](_0x2aa55a[_0xa42d('0x39')][_0xa42d('0x1f')]);}_0x30d009[_0xa42d('0x42')]=qs[_0xa42d('0x43')](_0x2aa55a[_0xa42d('0x39')][_0xa42d('0x43')]);_0x30d009[_0xa42d('0x44')]=qs[_0xa42d('0x3b')](_[_0xa42d('0x45')](_0x2aa55a[_0xa42d('0x39')],_0x427892[_0xa42d('0x3b')]),_0x3bcac8);if(_0x2aa55a[_0xa42d('0x39')][_0xa42d('0x46')]){_0x30d009[_0xa42d('0x44')]=_[_0xa42d('0x47')](_0x30d009[_0xa42d('0x44')],{'$or':_[_0xa42d('0x33')](_0x3bcac8,function(_0x3442e0){if(_0x3442e0['type']!=='VIRTUAL'){var _0x238ba7={};_0x238ba7[_0x3442e0[_0xa42d('0x30')]]={'$like':'%'+_0x2aa55a['query'][_0xa42d('0x46')]+'%'};return _0x238ba7;}})});}_0x30d009=_[_0xa42d('0x47')]({},_0x30d009,_0x2aa55a[_0xa42d('0x48')]);var _0x343027={'where':_0x30d009[_0xa42d('0x44')]};return db[_0xa42d('0x34')]['count'](_0x343027)[_0xa42d('0x2a')](function(_0x4aa20a){_0x48603b[_0xa42d('0x22')]=_0x4aa20a;if(_0x2aa55a[_0xa42d('0x39')][_0xa42d('0x49')]){_0x30d009['include']=[{'all':!![]}];}return db[_0xa42d('0x34')][_0xa42d('0x4a')](_0x30d009);})['then'](function(_0x44c674){_0x48603b[_0xa42d('0x4b')]=_0x44c674;return _0x48603b;})[_0xa42d('0x2a')](respondWithFilteredResult(_0x10bb70,_0x30d009))[_0xa42d('0x4c')](handleError(_0x10bb70,null));};exports[_0xa42d('0x4d')]=function(_0x15041e,_0x512773){var _0x554de4={'raw':!![],'where':{'id':_0x15041e['params']['id']}},_0x343ef9={};_0x343ef9['model']=_[_0xa42d('0x3a')](db[_0xa42d('0x34')][_0xa42d('0x35')]);_0x343ef9[_0xa42d('0x39')]=_[_0xa42d('0x3a')](_0x15041e['query']);_0x343ef9[_0xa42d('0x3b')]=_[_0xa42d('0x3c')](_0x343ef9[_0xa42d('0x3d')],_0x343ef9[_0xa42d('0x39')]);_0x554de4[_0xa42d('0x3e')]=_[_0xa42d('0x3c')](_0x343ef9[_0xa42d('0x3d')],qs['fields'](_0x15041e[_0xa42d('0x39')][_0xa42d('0x3f')]));_0x554de4[_0xa42d('0x3e')]=_0x554de4['attributes'][_0xa42d('0x4e')]?_0x554de4[_0xa42d('0x3e')]:_0x343ef9[_0xa42d('0x3d')];if(_0x15041e[_0xa42d('0x39')][_0xa42d('0x49')]){_0x554de4['include']=[{'all':!![]}];}_0x554de4=_['merge']({},_0x554de4,_0x15041e[_0xa42d('0x48')]);return db[_0xa42d('0x34')][_0xa42d('0x4f')](_0x554de4)[_0xa42d('0x2a')](handleEntityNotFound(_0x512773,null))[_0xa42d('0x2a')](respondWithResult(_0x512773,null))[_0xa42d('0x4c')](handleError(_0x512773,null));};exports[_0xa42d('0x50')]=function(_0xba782f,_0x50b717,_0x495275){return db[_0xa42d('0x34')][_0xa42d('0x4f')]({'where':{'id':_0xba782f[_0xa42d('0x51')]['id']},'attributes':[_0xa42d('0x30'),_0xa42d('0x5')],'raw':!![]})[_0xa42d('0x2a')](handleEntityNotFound(_0x50b717,null))['then'](function(_0x1a1042){if(_0x1a1042){var _0x5e9240=path[_0xa42d('0x52')](config[_0xa42d('0x53')],_0xa42d('0x54'),util[_0xa42d('0x55')]('%s.zip',path[_0xa42d('0x56')](_0x1a1042[_0xa42d('0x5')])));var _0x2cbb67=fs[_0xa42d('0x57')](_0x5e9240);var _0x1bc05e=archiver(_0xa42d('0x58'),{'zlib':{'level':0x9}});_0x1bc05e['on'](_0xa42d('0x59'),function(_0x526e09){if(_0x526e09['code']===_0xa42d('0x5a')){logger['error'](_0x526e09);}else{throw new db['Sequelize'][(_0xa42d('0x5b'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x1bc05e['on'](_0xa42d('0x2e'),function(_0x3487c0){throw new db['Sequelize']['Error'](_0xa42d('0x5c'));});_0x1bc05e['pipe'](_0x2cbb67);_0x1bc05e['glob'](_0xa42d('0x5d'),{'cwd':path['join'](config[_0xa42d('0x53')],_0xa42d('0x54'),path['dirname'](_0x1a1042[_0xa42d('0x5')])),'ignore':[path[_0xa42d('0x52')](path[_0xa42d('0x56')](_0x1a1042['path']),_0xa42d('0x5e')),path[_0xa42d('0x52')](path['basename'](_0x1a1042[_0xa42d('0x5')]),'attachments/**/*')],'nodir':!![]})[_0xa42d('0x5f')]();_0x2cbb67['on'](_0xa42d('0x60'),function(){if(!fs[_0xa42d('0x61')](_0x5e9240)){throw new db[(_0xa42d('0x62'))][(_0xa42d('0x5b'))](_0xa42d('0x63'));}return _0x50b717[_0xa42d('0x50')](_0x5e9240,util['format'](_0xa42d('0x64'),path[_0xa42d('0x56')](_0x1a1042[_0xa42d('0x5')])),function(_0x228c8b){if(_0x228c8b){throw new db['Sequelize'][(_0xa42d('0x5b'))](_0xa42d('0x65'));}fs[_0xa42d('0x66')](_0x5e9240);logger['info'](_0xa42d('0x67'));logger['info'](_0xa42d('0x68'));});});}return null;})['catch'](handleError(_0x50b717,null));};exports[_0xa42d('0x69')]=function(_0x327b1d,_0x2a6beb,_0x1dc8b1){var _0x29f401=path['basename'](_0x327b1d[_0xa42d('0x6a')][_0xa42d('0x6b')],path[_0xa42d('0x6c')](_0x327b1d['file'][_0xa42d('0x6b')]));var _0x18bfb3=path[_0xa42d('0x52')](config[_0xa42d('0x53')],'server/files/plugins',_0x327b1d[_0xa42d('0x6a')][_0xa42d('0x6b')]);var _0x1b5c5=path['join'](config[_0xa42d('0x53')],_0xa42d('0x54'),_0x29f401);logger[_0xa42d('0x6d')](_0xa42d('0x6e'),_0x18bfb3);logger['info'](_0xa42d('0x6f'),_0x1b5c5);try{fs[_0xa42d('0x70')](_0x18bfb3,parseInt(_0xa42d('0x71'),0x8));extract(_0x18bfb3,{'dir':_0x1b5c5},function(_0x1a0094){if(_0x1a0094){logger[_0xa42d('0x2e')](_0x1a0094);handleError(_0x1a0094,!![]);};var _0x5ef5ee=fs['readdirSync'](_0x1b5c5);if(_0x5ef5ee[_0xa42d('0x4e')]>0x1){removeReferences(_0x18bfb3,_0x1b5c5);logger['error'](_0xa42d('0x72'));return _0x1dc8b1(new Error('Invalid\x20plugin\x20structure'));}var _0x42b889=fs[_0xa42d('0x73')](path[_0xa42d('0x52')](_0x1b5c5,_0x5ef5ee[0x0]));if(_0x42b889[_0xa42d('0x74')]()){removeReferences(_0x18bfb3,_0x1b5c5);logger[_0xa42d('0x2e')](_0xa42d('0x72'));return _0x1dc8b1(new Error(_0xa42d('0x72')));}if(_0x42b889[_0xa42d('0x75')]()){var _0x2fb34f=fs['readdirSync'](path[_0xa42d('0x52')](_0x1b5c5,_0x5ef5ee[0x0]));if(_0x2fb34f[_0xa42d('0x4e')]===0x0){removeReferences(_0x18bfb3,_0x1b5c5);logger['error'](_0xa42d('0x72'));return _0x1dc8b1(new Error(_0xa42d('0x72')));}var _0x4125f0=_0x2fb34f['some'](function(_0x19fac7){return _0x19fac7===_0xa42d('0x76');});if(!_0x4125f0){return _0x1dc8b1(new Error('Plugin\x20manifest\x20missing'));}var _0x3fa38a=fs['readFileSync'](path[_0xa42d('0x52')](_0x1b5c5,_0x5ef5ee[0x0],_0xa42d('0x76')));var _0x45a152=JSON[_0xa42d('0x77')](_0x3fa38a);if(_0xa42d('0x20')==typeof _0x45a152[_0xa42d('0x30')]){return _0x1dc8b1(new Error(_0xa42d('0x78')));}if(_0xa42d('0x20')==typeof _0x45a152[_0xa42d('0x37')]){return _0x1dc8b1(new Error(_0xa42d('0x79')));}if(_0xa42d('0x20')==typeof _0x45a152[_0xa42d('0x7a')]){return _0x1dc8b1(new Error(_0xa42d('0x7b')));}if(_0xa42d('0x20')==typeof _0x45a152[_0xa42d('0x7c')]){return _0x1dc8b1(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x45a152[_0xa42d('0x37')]===_0xa42d('0x7d')){if(_0xa42d('0x20')==typeof _0x45a152[_0xa42d('0x7c')][_0xa42d('0x7e')]){return _0x1dc8b1(new Error(_0xa42d('0x7f')));}if(_0xa42d('0x20')==typeof _0x45a152[_0xa42d('0x7c')]['views'][_0xa42d('0x80')]&&_0xa42d('0x20')==typeof _0x45a152[_0xa42d('0x7c')][_0xa42d('0x7e')][_0xa42d('0x81')]){return _0x1dc8b1(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x45a152[_0xa42d('0x37')]===_0xa42d('0x82')){if('undefined'==typeof _0x45a152['parameters'][_0xa42d('0x83')]){return _0x1dc8b1(new Error(_0xa42d('0x84')));}if(_0xa42d('0x20')==typeof _0x45a152[_0xa42d('0x7c')]['scriptPath']){return _0x1dc8b1(new Error(_0xa42d('0x85')));}}else{return _0x1dc8b1(new Error(_0xa42d('0x86')));}var _0x47368d=_0x45a152['name'];var _0x57e6dd=_0x45a152[_0xa42d('0x87')];var _0x2a89d1=_0x45a152[_0xa42d('0x37')];var _0x3a34ab=_0x45a152[_0xa42d('0x88')]?_0x45a152[_0xa42d('0x88')]:_0xa42d('0x89');var _0x4e16a3=_0x45a152[_0xa42d('0x8a')]?_0x45a152[_0xa42d('0x8a')]:'icon-apps';var _0x30ade5='';var _0x349d9e='';var _0xf14f17='';var _0xaa8cf='';var _0x20b3c5=_0x45a152[_0xa42d('0x7a')];if(_0x2a89d1===_0xa42d('0x7d')){if('undefined'!=typeof _0x45a152[_0xa42d('0x7c')]['views']['admin']){var _0x43575d=_0x45a152['parameters'][_0xa42d('0x7e')][_0xa42d('0x80')];if(!/^(f|ht)tps?:\/\//i[_0xa42d('0x8b')](_0x43575d)){_0x30ade5=path[_0xa42d('0x52')](_0xa42d('0x8c'),_0x29f401,_0x5ef5ee[0x0],_0x43575d);}else{_0x30ade5=_0x43575d;}}else{logger['info'](_0xa42d('0x8d'));}if('undefined'!=typeof _0x45a152[_0xa42d('0x7c')][_0xa42d('0x7e')]['agent']){var _0x3de245=_0x45a152[_0xa42d('0x7c')][_0xa42d('0x7e')][_0xa42d('0x81')];if(!/^(f|ht)tps?:\/\//i[_0xa42d('0x8b')](_0x3de245)){_0x349d9e=path[_0xa42d('0x52')]('plugins',_0x29f401,_0x5ef5ee[0x0],_0x3de245);}else{_0x349d9e=_0x3de245;}}else{logger[_0xa42d('0x6d')](_0xa42d('0x8e'));}}else if(_0x2a89d1===_0xa42d('0x82')){_0xf14f17=_0x45a152[_0xa42d('0x7c')][_0xa42d('0x83')];_0xaa8cf=_0x45a152[_0xa42d('0x7c')][_0xa42d('0x8f')];if(_0xa42d('0x20')!=typeof _0x45a152[_0xa42d('0x7c')][_0xa42d('0x7e')]){if(_0xa42d('0x20')!=typeof _0x45a152[_0xa42d('0x7c')][_0xa42d('0x7e')][_0xa42d('0x80')]){var _0x43575d=_0x45a152['parameters'][_0xa42d('0x7e')][_0xa42d('0x80')];if(!/^(f|ht)tps?:\/\//i[_0xa42d('0x8b')](_0x43575d)){_0x30ade5=path[_0xa42d('0x52')](_0xa42d('0x8c'),_0x29f401,_0x5ef5ee[0x0],_0x43575d);}else{_0x30ade5=_0x43575d;}}if('undefined'!=typeof _0x45a152[_0xa42d('0x7c')][_0xa42d('0x7e')][_0xa42d('0x81')]){var _0x3de245=_0x45a152['parameters']['views']['agent'];if(!/^(f|ht)tps?:\/\//i[_0xa42d('0x8b')](_0x3de245)){_0x349d9e=path[_0xa42d('0x52')]('plugins',_0x29f401,_0x5ef5ee[0x0],_0x3de245);}else{_0x349d9e=_0x3de245;}}}}var _0x35d7cc={'name':_0x47368d,'description':_0x57e6dd,'path':path[_0xa42d('0x52')](_0x29f401,_0x5ef5ee[0x0]),'type':_0x2a89d1,'sidebar':_0x3a34ab,'icon':_0x4e16a3,'adminUrl':_0x30ade5,'agentUrl':_0x349d9e,'scriptName':_0xf14f17,'scriptPath':_0xaa8cf,'version':_0x20b3c5};removeReferences(_0x18bfb3,null);return db[_0xa42d('0x34')][_0xa42d('0x90')](_0x35d7cc)[_0xa42d('0x2a')](function(_0xf130d9){var _0x3b4e25={'role':_0x327b1d['body'][_0xa42d('0x91')],'userProfileId':_0x327b1d['body']['userProfileId']};if(!_0x3b4e25)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3b4e25['role']===_0xa42d('0x92')){var _0x2dcb31=_0xf130d9['get']({'plain':!![]});return db[_0xa42d('0x93')][_0xa42d('0x4f')]({'where':{'name':_0xa42d('0x94'),'userProfileId':_0x3b4e25['userProfileId']},'raw':!![]})['then'](function(_0x32e957){if(_0x32e957&&_0x32e957['autoAssociation']===0x0){return db[_0xa42d('0x2d')][_0xa42d('0x90')]({'name':_0x2dcb31[_0xa42d('0x30')],'resourceId':_0x2dcb31['id'],'type':_0x32e957[_0xa42d('0x30')],'sectionId':_0x32e957['id']},{})[_0xa42d('0x2a')](function(){return _0xf130d9;});}else{return _0xf130d9;}})['catch'](function(_0x184c1b){logger['error'](_0xa42d('0x95'),_0x184c1b);throw _0x184c1b;});}return _0xf130d9;})[_0xa42d('0x2a')](respondWithResult(_0x2a6beb,null))['catch'](handleError(_0x2a6beb,null));}});}catch(_0x3af79b){_0x2a6beb[_0xa42d('0x1d')](0x1f4)[_0xa42d('0x31')](_0x3af79b);}};function removeReferences(_0x56bc9c,_0x4ea12b){try{if(_0x56bc9c){fs['unlinkSync'](_0x56bc9c);logger[_0xa42d('0x6d')](_0xa42d('0x96'));}if(_0x4ea12b){rimraf(_0x4ea12b,function(){});logger[_0xa42d('0x6d')](_0xa42d('0x97'));}}catch(_0x198772){logger['error'](_0x198772);}}exports[_0xa42d('0x29')]=function(_0x310fef,_0x39d2ca,_0x1ba689){return db['Plugin']['find']({'where':{'id':_0x310fef[_0xa42d('0x51')]['id']}})['then'](handleEntityNotFound(_0x39d2ca,null))[_0xa42d('0x2a')](saveUpdates(_0x310fef[_0xa42d('0x98')],null))[_0xa42d('0x2a')](respondWithResult(_0x39d2ca,null))[_0xa42d('0x4c')](handleError(_0x39d2ca,null));};exports[_0xa42d('0x99')]=function(_0x3c9d3a,_0x5e2cec,_0x61852e){return db[_0xa42d('0x34')][_0xa42d('0x4f')]({'where':{'id':_0x3c9d3a[_0xa42d('0x51')]['id']}})['then'](function(_0xcae3d5){if(_0xcae3d5){return _0xcae3d5[_0xa42d('0x2b')]();}})['then'](function(_0x264634){rimraf(path[_0xa42d('0x52')](config['root'],_0xa42d('0x54'),path[_0xa42d('0x9a')](_0x264634[_0xa42d('0x5')])),function(){});return _0x264634;})[_0xa42d('0x2a')](handleEntityNotFound(_0x5e2cec,null))[_0xa42d('0x2a')](respondWithStatusCode(_0x5e2cec,null))[_0xa42d('0x4c')](handleError(_0x5e2cec,null));};exports[_0xa42d('0x9b')]=function(_0x28649a,_0x40ec57,_0x1c5af8){return BPromise['resolve']()[_0xa42d('0x2a')](function(){if(!_0x28649a[_0xa42d('0x39')][_0xa42d('0x5')]){throw new Error(_0xa42d('0x9c'));}if(!_0x28649a[_0xa42d('0x39')][_0xa42d('0x9d')]){throw new Error(_0xa42d('0x9e'));}var _0x5485c2=_0x28649a[_0xa42d('0x39')]['hostname']?_0x28649a[_0xa42d('0x39')]['hostname']+':'+_0x28649a[_0xa42d('0x39')][_0xa42d('0x9d')]:_0xa42d('0x9f')+_0x28649a['query'][_0xa42d('0x9d')];var _0x45b159=_0x28649a[_0xa42d('0x39')][_0xa42d('0x25')]?_0x28649a['query'][_0xa42d('0x25')]:!![];var _0x4e6e2e=_0x28649a[_0xa42d('0x39')][_0xa42d('0xa0')]?_0x28649a[_0xa42d('0x39')][_0xa42d('0xa0')]:null;var _0x512411={'method':_0x28649a[_0xa42d('0xa1')],'uri':util[_0xa42d('0x55')](_0xa42d('0xa2'),_0x5485c2,_0x28649a[_0xa42d('0x39')][_0xa42d('0x5')]),'json':_0x45b159,'resolveWithFullResponse':!![],'encoding':_0x4e6e2e,'qs':_0x28649a[_0xa42d('0x39')]};if(_0x28649a['headers']){_0x512411[_0xa42d('0xa3')]=_0x28649a['headers'];if(_0x512411['headers'][_0xa42d('0xa4')]){delete _0x512411[_0xa42d('0xa3')][_0xa42d('0xa4')];}}if(_0x512411[_0xa42d('0xa3')][_0xa42d('0xa5')]){delete _0x512411['headers'][_0xa42d('0xa5')];}return rp(_0x512411);})[_0xa42d('0x2a')](function(_0x46a4bc){if(_0x46a4bc){_0x40ec57[_0xa42d('0x23')](_0x46a4bc[_0xa42d('0xa3')]);logger[_0xa42d('0x6d')](_0x46a4bc['body']);if(_['endsWith'](_0x28649a[_0xa42d('0x39')]['path'],'download')&&_0x46a4bc[_0xa42d('0xa6')]==0x1f4){return _0x40ec57[_0xa42d('0x1c')](_0x46a4bc[_0xa42d('0xa6')]);}else{return _0x40ec57[_0xa42d('0x1d')](_0x46a4bc[_0xa42d('0xa6')])[_0xa42d('0x31')](_0x46a4bc[_0xa42d('0x98')]);}}else{return _0x40ec57[_0xa42d('0x1c')](0xc8);}})['catch'](handleError(_0x40ec57,null));};exports[_0xa42d('0xa7')]=function(_0x4f18f9,_0x4eda71,_0x4b6dc1){return BPromise['resolve']()[_0xa42d('0x2a')](function(){if(!_0x4f18f9[_0xa42d('0x39')]['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x4f18f9[_0xa42d('0x39')][_0xa42d('0x9d')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x1eb7f0=_0x4f18f9[_0xa42d('0x39')][_0xa42d('0xa8')]?_0x4f18f9['query'][_0xa42d('0xa8')]+':'+_0x4f18f9['query'][_0xa42d('0x9d')]:_0xa42d('0x9f')+_0x4f18f9[_0xa42d('0x39')][_0xa42d('0x9d')];var _0x1bc989=_0x4f18f9[_0xa42d('0x39')][_0xa42d('0x25')]?_0x4f18f9[_0xa42d('0x39')]['json']:!![];var _0xc0d529=_0x4f18f9['query'][_0xa42d('0xa0')]?_0x4f18f9[_0xa42d('0x39')]['encoding']:null;var _0xd510f0={'method':_0x4f18f9[_0xa42d('0xa1')],'uri':util['format'](_0xa42d('0xa2'),_0x1eb7f0,_0x4f18f9[_0xa42d('0x39')]['path']),'json':_0x1bc989,'resolveWithFullResponse':!![],'encoding':_0xc0d529,'body':_0x4f18f9[_0xa42d('0x98')]};if(_0x4f18f9[_0xa42d('0xa3')]){_0xd510f0[_0xa42d('0xa3')]=_0x4f18f9[_0xa42d('0xa3')];if(_0xd510f0['headers'][_0xa42d('0xa4')]){delete _0xd510f0[_0xa42d('0xa3')][_0xa42d('0xa4')];}}if(_0xd510f0[_0xa42d('0xa3')]['content-type']){delete _0xd510f0[_0xa42d('0xa3')][_0xa42d('0xa5')];}return rp(_0xd510f0);})[_0xa42d('0x2a')](function(_0x2d5662){if(_0x2d5662){_0x4eda71['set'](_0x2d5662['headers']);logger[_0xa42d('0x6d')](_0x2d5662[_0xa42d('0x98')]);return _0x4eda71['status'](_0x2d5662['statusCode'])[_0xa42d('0x31')](_0x2d5662['body']);}else{return _0x4eda71[_0xa42d('0x1c')](0xc8);}})[_0xa42d('0x4c')](handleError(_0x4eda71,null));}; \ No newline at end of file +var _0xe339=['error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','type','key','model','keys','query','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','rows','catch','show','params','find','download','path','join','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','glob','**/*','root','node_modules/**/*','attachments/**/*','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','info','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','readdirSync','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','html','parameters','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar','always','icon','test','Warning:\x20admin\x20view\x20not\x20specified','plugins','Warning:\x20agent\x20view\x20not\x20specified','create','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','extract-zip','archiver','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','then','get','Plugins','UserProfileResource','destroy'];(function(_0x1915bf,_0x3c427b){var _0x301bb8=function(_0x1dc17f){while(--_0x1dc17f){_0x1915bf['push'](_0x1915bf['shift']());}};_0x301bb8(++_0x3c427b);}(_0xe339,0x132));var _0x9e33=function(_0xa911e,_0x1a9f9a){_0xa911e=_0xa911e-0x0;var _0x28bd6f=_0xe339[_0xa911e];return _0x28bd6f;};'use strict';var emlformat=require(_0x9e33('0x0'));var rimraf=require(_0x9e33('0x1'));var zipdir=require(_0x9e33('0x2'));var jsonpatch=require(_0x9e33('0x3'));var rp=require(_0x9e33('0x4'));var moment=require(_0x9e33('0x5'));var BPromise=require(_0x9e33('0x6'));var Mustache=require('mustache');var util=require(_0x9e33('0x7'));var path=require('path');var sox=require(_0x9e33('0x8'));var csv=require('to-csv');var ejs=require(_0x9e33('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9e33('0xa'));var squel=require(_0x9e33('0xb'));var crypto=require(_0x9e33('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9e33('0xd'));var querystring=require(_0x9e33('0xe'));var Papa=require(_0x9e33('0xf'));var extract=require(_0x9e33('0x10'));var rimraf=require(_0x9e33('0x1'));var archiver=require(_0x9e33('0x11'));var Redis=require(_0x9e33('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x9e33('0x13'));var as=require(_0x9e33('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9e33('0x15'))(_0x9e33('0x16'));var utils=require(_0x9e33('0x17'));var config=require(_0x9e33('0x18'));var licenseUtil=require(_0x9e33('0x19'));var db=require(_0x9e33('0x1a'))['db'];config[_0x9e33('0x1b')]=_[_0x9e33('0x1c')](config['redis'],{'host':_0x9e33('0x1d'),'port':0x18eb});var socket=require(_0x9e33('0x1e'))(new Redis(config[_0x9e33('0x1b')]));require('./plugin.socket')[_0x9e33('0x1f')](socket);function respondWithStatusCode(_0x1da9a3,_0x453eef){_0x453eef=_0x453eef||0xcc;return function(_0x5d3c3f){if(_0x5d3c3f){return _0x1da9a3[_0x9e33('0x20')](_0x453eef);}return _0x1da9a3[_0x9e33('0x21')](_0x453eef)[_0x9e33('0x22')]();};}function respondWithResult(_0x57c533,_0x77672c){_0x77672c=_0x77672c||0xc8;return function(_0x248c8d){if(_0x248c8d){return _0x57c533[_0x9e33('0x21')](_0x77672c)[_0x9e33('0x23')](_0x248c8d);}};}function respondWithFilteredResult(_0x3e7d23,_0x518350){return function(_0xc4d5fc){if(_0xc4d5fc){var _0x4cea0d=typeof _0x518350[_0x9e33('0x24')]===_0x9e33('0x25')&&typeof _0x518350[_0x9e33('0x26')]===_0x9e33('0x25');var _0x347d6d=_0xc4d5fc['count'];var _0x406293=_0x4cea0d?0x0:_0x518350[_0x9e33('0x24')];var _0x2a6a46=_0x4cea0d?_0xc4d5fc[_0x9e33('0x27')]:_0x518350[_0x9e33('0x24')]+_0x518350[_0x9e33('0x26')];var _0x2f6c2e;if(_0x2a6a46>=_0x347d6d){_0x2a6a46=_0x347d6d;_0x2f6c2e=0xc8;}else{_0x2f6c2e=0xce;}_0x3e7d23[_0x9e33('0x21')](_0x2f6c2e);return _0x3e7d23[_0x9e33('0x28')](_0x9e33('0x29'),_0x406293+'-'+_0x2a6a46+'/'+_0x347d6d)[_0x9e33('0x23')](_0xc4d5fc);}return null;};}function patchUpdates(_0x1a760e){return function(_0x50242d){try{jsonpatch['apply'](_0x50242d,_0x1a760e,!![]);}catch(_0x5f115b){return BPromise[_0x9e33('0x2a')](_0x5f115b);}return _0x50242d['save']();};}function saveUpdates(_0x1e5b3,_0xa98ae){return function(_0x5029f7){if(_0x5029f7){return _0x5029f7['update'](_0x1e5b3)[_0x9e33('0x2b')](function(_0x503e41){return _0x503e41;});}return null;};}function removeEntity(_0x522736,_0x4e5cf6){return function(_0x539bfc){if(_0x539bfc){return _0x539bfc['destroy']()[_0x9e33('0x2b')](function(){var _0x44ac29=_0x539bfc[_0x9e33('0x2c')]({'plain':!![]});var _0x4d586d=_0x9e33('0x2d');return db[_0x9e33('0x2e')][_0x9e33('0x2f')]({'where':{'type':_0x4d586d,'resourceId':_0x44ac29['id']}})[_0x9e33('0x2b')](function(){return _0x539bfc;});})[_0x9e33('0x2b')](function(){_0x522736[_0x9e33('0x21')](0xcc)[_0x9e33('0x22')]();});}};}function handleEntityNotFound(_0x3a5886,_0x4f0db6){return function(_0x470d1e){if(!_0x470d1e){_0x3a5886[_0x9e33('0x20')](0x194);}return _0x470d1e;};}function handleError(_0x32eac8,_0x169976){_0x169976=_0x169976||0x1f4;return function(_0x415e1e){logger[_0x9e33('0x30')](_0x415e1e[_0x9e33('0x31')]);if(_0x415e1e['name']){delete _0x415e1e[_0x9e33('0x32')];}_0x32eac8['status'](_0x169976)[_0x9e33('0x33')](_0x415e1e);};}exports[_0x9e33('0x34')]=function(_0x16e730,_0x3b2b31){var _0x121218={},_0x396db2={},_0x4d637a={'count':0x0,'rows':[]};var _0x2dae3b=_[_0x9e33('0x35')](db[_0x9e33('0x36')][_0x9e33('0x37')],function(_0x3ec0b0){return{'name':_0x3ec0b0[_0x9e33('0x38')],'type':_0x3ec0b0[_0x9e33('0x39')][_0x9e33('0x3a')]};});_0x396db2[_0x9e33('0x3b')]=_[_0x9e33('0x35')](_0x2dae3b,_0x9e33('0x32'));_0x396db2['query']=_[_0x9e33('0x3c')](_0x16e730[_0x9e33('0x3d')]);_0x396db2['filters']=_['intersection'](_0x396db2[_0x9e33('0x3b')],_0x396db2['query']);_0x121218[_0x9e33('0x3e')]=_[_0x9e33('0x3f')](_0x396db2[_0x9e33('0x3b')],qs['fields'](_0x16e730[_0x9e33('0x3d')][_0x9e33('0x40')]));_0x121218['attributes']=_0x121218['attributes'][_0x9e33('0x41')]?_0x121218['attributes']:_0x396db2['model'];if(!_0x16e730[_0x9e33('0x3d')]['hasOwnProperty'](_0x9e33('0x42'))){_0x121218[_0x9e33('0x26')]=qs[_0x9e33('0x26')](_0x16e730[_0x9e33('0x3d')][_0x9e33('0x26')]);_0x121218[_0x9e33('0x24')]=qs[_0x9e33('0x24')](_0x16e730['query'][_0x9e33('0x24')]);}_0x121218[_0x9e33('0x43')]=qs[_0x9e33('0x44')](_0x16e730['query'][_0x9e33('0x44')]);_0x121218[_0x9e33('0x45')]=qs[_0x9e33('0x46')](_[_0x9e33('0x47')](_0x16e730['query'],_0x396db2[_0x9e33('0x46')]),_0x2dae3b);if(_0x16e730[_0x9e33('0x3d')][_0x9e33('0x48')]){_0x121218[_0x9e33('0x45')]=_[_0x9e33('0x49')](_0x121218[_0x9e33('0x45')],{'$or':_[_0x9e33('0x35')](_0x2dae3b,function(_0x123ff9){if(_0x123ff9[_0x9e33('0x39')]!=='VIRTUAL'){var _0x25dff8={};_0x25dff8[_0x123ff9['name']]={'$like':'%'+_0x16e730[_0x9e33('0x3d')][_0x9e33('0x48')]+'%'};return _0x25dff8;}})});}_0x121218=_[_0x9e33('0x49')]({},_0x121218,_0x16e730[_0x9e33('0x4a')]);var _0x413c77={'where':_0x121218[_0x9e33('0x45')]};return db[_0x9e33('0x36')][_0x9e33('0x27')](_0x413c77)[_0x9e33('0x2b')](function(_0x547e45){_0x4d637a[_0x9e33('0x27')]=_0x547e45;if(_0x16e730[_0x9e33('0x3d')][_0x9e33('0x4b')]){_0x121218['include']=[{'all':!![]}];}return db[_0x9e33('0x36')]['findAll'](_0x121218);})['then'](function(_0x16f204){_0x4d637a[_0x9e33('0x4c')]=_0x16f204;return _0x4d637a;})[_0x9e33('0x2b')](respondWithFilteredResult(_0x3b2b31,_0x121218))[_0x9e33('0x4d')](handleError(_0x3b2b31,null));};exports[_0x9e33('0x4e')]=function(_0x4c3834,_0x1b5a53){var _0x155c8c={'raw':!![],'where':{'id':_0x4c3834[_0x9e33('0x4f')]['id']}},_0x48de25={};_0x48de25['model']=_[_0x9e33('0x3c')](db[_0x9e33('0x36')][_0x9e33('0x37')]);_0x48de25[_0x9e33('0x3d')]=_[_0x9e33('0x3c')](_0x4c3834[_0x9e33('0x3d')]);_0x48de25[_0x9e33('0x46')]=_[_0x9e33('0x3f')](_0x48de25[_0x9e33('0x3b')],_0x48de25['query']);_0x155c8c[_0x9e33('0x3e')]=_[_0x9e33('0x3f')](_0x48de25[_0x9e33('0x3b')],qs[_0x9e33('0x40')](_0x4c3834['query'][_0x9e33('0x40')]));_0x155c8c[_0x9e33('0x3e')]=_0x155c8c['attributes'][_0x9e33('0x41')]?_0x155c8c[_0x9e33('0x3e')]:_0x48de25[_0x9e33('0x3b')];if(_0x4c3834[_0x9e33('0x3d')][_0x9e33('0x4b')]){_0x155c8c['include']=[{'all':!![]}];}_0x155c8c=_[_0x9e33('0x49')]({},_0x155c8c,_0x4c3834[_0x9e33('0x4a')]);return db[_0x9e33('0x36')][_0x9e33('0x50')](_0x155c8c)[_0x9e33('0x2b')](handleEntityNotFound(_0x1b5a53,null))[_0x9e33('0x2b')](respondWithResult(_0x1b5a53,null))['catch'](handleError(_0x1b5a53,null));};exports[_0x9e33('0x51')]=function(_0x3b58c5,_0x599fdb,_0x3b7eeb){return db['Plugin'][_0x9e33('0x50')]({'where':{'id':_0x3b58c5[_0x9e33('0x4f')]['id']},'attributes':[_0x9e33('0x32'),_0x9e33('0x52')],'raw':!![]})['then'](handleEntityNotFound(_0x599fdb,null))[_0x9e33('0x2b')](function(_0x47d199){if(_0x47d199){var _0x12f56b=path[_0x9e33('0x53')](config['root'],_0x9e33('0x54'),util[_0x9e33('0x55')](_0x9e33('0x56'),path[_0x9e33('0x57')](_0x47d199[_0x9e33('0x52')])));var _0x41e6ff=fs[_0x9e33('0x58')](_0x12f56b);var _0x1b02d9=archiver(_0x9e33('0x59'),{'zlib':{'level':0x9}});_0x1b02d9['on'](_0x9e33('0x5a'),function(_0x2d2dae){if(_0x2d2dae[_0x9e33('0x5b')]===_0x9e33('0x5c')){logger[_0x9e33('0x30')](_0x2d2dae);}else{throw new db[(_0x9e33('0x5d'))]['Error'](_0x9e33('0x5e'));}});_0x1b02d9['on'](_0x9e33('0x30'),function(_0x1b9f73){throw new db[(_0x9e33('0x5d'))][(_0x9e33('0x5f'))](_0x9e33('0x5e'));});_0x1b02d9['pipe'](_0x41e6ff);_0x1b02d9[_0x9e33('0x60')](_0x9e33('0x61'),{'cwd':path[_0x9e33('0x53')](config[_0x9e33('0x62')],'server/files/plugins',path['dirname'](_0x47d199[_0x9e33('0x52')])),'ignore':[path[_0x9e33('0x53')](path['basename'](_0x47d199[_0x9e33('0x52')]),_0x9e33('0x63')),path[_0x9e33('0x53')](path[_0x9e33('0x57')](_0x47d199[_0x9e33('0x52')]),_0x9e33('0x64'))],'nodir':!![]})['finalize']();_0x41e6ff['on'](_0x9e33('0x65'),function(){if(!fs[_0x9e33('0x66')](_0x12f56b)){throw new db[(_0x9e33('0x5d'))][(_0x9e33('0x5f'))](_0x9e33('0x67'));}return _0x599fdb[_0x9e33('0x51')](_0x12f56b,util[_0x9e33('0x55')]('%s.zip',path[_0x9e33('0x57')](_0x47d199[_0x9e33('0x52')])),function(_0x5ef58b){if(_0x5ef58b){throw new db[(_0x9e33('0x5d'))][(_0x9e33('0x5f'))](_0x9e33('0x68'));}fs[_0x9e33('0x69')](_0x12f56b);logger['info'](_0x9e33('0x6a'));logger[_0x9e33('0x6b')](_0x9e33('0x6c'));});});}return null;})[_0x9e33('0x4d')](handleError(_0x599fdb,null));};exports[_0x9e33('0x6d')]=function(_0x115f4a,_0x4a741b,_0x1cb6c0){var _0x16d56a=path[_0x9e33('0x57')](_0x115f4a[_0x9e33('0x6e')][_0x9e33('0x6f')],path[_0x9e33('0x70')](_0x115f4a[_0x9e33('0x6e')]['filename']));var _0x49aab7=path[_0x9e33('0x53')](config[_0x9e33('0x62')],_0x9e33('0x54'),_0x115f4a[_0x9e33('0x6e')]['filename']);var _0x334bf8=path[_0x9e33('0x53')](config[_0x9e33('0x62')],_0x9e33('0x54'),_0x16d56a);logger[_0x9e33('0x6b')](_0x9e33('0x71'),_0x49aab7);logger[_0x9e33('0x6b')](_0x9e33('0x72'),_0x334bf8);try{fs[_0x9e33('0x73')](_0x49aab7,parseInt(_0x9e33('0x74'),0x8));extract(_0x49aab7,{'dir':_0x334bf8},function(_0x1d3726){if(_0x1d3726){logger[_0x9e33('0x30')](_0x1d3726);handleError(_0x1d3726,!![]);};var _0x508da2=fs['readdirSync'](_0x334bf8);if(_0x508da2[_0x9e33('0x41')]>0x1){removeReferences(_0x49aab7,_0x334bf8);logger[_0x9e33('0x30')](_0x9e33('0x75'));return _0x1cb6c0(new Error('Invalid\x20plugin\x20structure'));}var _0x27effb=fs[_0x9e33('0x76')](path[_0x9e33('0x53')](_0x334bf8,_0x508da2[0x0]));if(_0x27effb[_0x9e33('0x77')]()){removeReferences(_0x49aab7,_0x334bf8);logger[_0x9e33('0x30')](_0x9e33('0x75'));return _0x1cb6c0(new Error(_0x9e33('0x75')));}if(_0x27effb[_0x9e33('0x78')]()){var _0x54a8be=fs[_0x9e33('0x79')](path[_0x9e33('0x53')](_0x334bf8,_0x508da2[0x0]));if(_0x54a8be[_0x9e33('0x41')]===0x0){removeReferences(_0x49aab7,_0x334bf8);logger[_0x9e33('0x30')](_0x9e33('0x75'));return _0x1cb6c0(new Error('Invalid\x20plugin\x20structure'));}var _0x295a27=_0x54a8be[_0x9e33('0x7a')](function(_0x43afcc){return _0x43afcc===_0x9e33('0x7b');});if(!_0x295a27){return _0x1cb6c0(new Error(_0x9e33('0x7c')));}var _0xae408f=fs[_0x9e33('0x7d')](path[_0x9e33('0x53')](_0x334bf8,_0x508da2[0x0],_0x9e33('0x7b')));var _0x5c1fe2=JSON[_0x9e33('0x7e')](_0xae408f);if('undefined'==typeof _0x5c1fe2['name']){return _0x1cb6c0(new Error(_0x9e33('0x7f')));}if(_0x9e33('0x25')==typeof _0x5c1fe2['type']){return _0x1cb6c0(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x9e33('0x25')==typeof _0x5c1fe2[_0x9e33('0x80')]){return _0x1cb6c0(new Error(_0x9e33('0x81')));}if(_0x9e33('0x25')==typeof _0x5c1fe2['parameters']){return _0x1cb6c0(new Error(_0x9e33('0x82')));}if(_0x5c1fe2[_0x9e33('0x39')]===_0x9e33('0x83')){if('undefined'==typeof _0x5c1fe2[_0x9e33('0x84')][_0x9e33('0x85')]){return _0x1cb6c0(new Error(_0x9e33('0x86')));}if(_0x9e33('0x25')==typeof _0x5c1fe2[_0x9e33('0x84')][_0x9e33('0x85')][_0x9e33('0x87')]&&'undefined'==typeof _0x5c1fe2[_0x9e33('0x84')][_0x9e33('0x85')][_0x9e33('0x88')]){return _0x1cb6c0(new Error(_0x9e33('0x89')));}}else if(_0x5c1fe2['type']===_0x9e33('0x8a')){if(_0x9e33('0x25')==typeof _0x5c1fe2[_0x9e33('0x84')][_0x9e33('0x8b')]){return _0x1cb6c0(new Error(_0x9e33('0x8c')));}if(_0x9e33('0x25')==typeof _0x5c1fe2[_0x9e33('0x84')][_0x9e33('0x8d')]){return _0x1cb6c0(new Error(_0x9e33('0x8e')));}}else{return _0x1cb6c0(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x1b6bcf=_0x5c1fe2[_0x9e33('0x32')];var _0x263fea=_0x5c1fe2[_0x9e33('0x8f')];var _0x24b454=_0x5c1fe2[_0x9e33('0x39')];var _0x35a80b=_0x5c1fe2[_0x9e33('0x90')]?_0x5c1fe2[_0x9e33('0x90')]:_0x9e33('0x91');var _0x1814f0=_0x5c1fe2[_0x9e33('0x92')]?_0x5c1fe2[_0x9e33('0x92')]:'icon-apps';var _0xa5be4c='';var _0x12e917='';var _0x43d873='';var _0x1aedb7='';var _0x32b022=_0x5c1fe2[_0x9e33('0x80')];if(_0x24b454==='html'){if('undefined'!=typeof _0x5c1fe2[_0x9e33('0x84')]['views']['admin']){var _0x1ad6e8=_0x5c1fe2[_0x9e33('0x84')][_0x9e33('0x85')][_0x9e33('0x87')];if(!/^(f|ht)tps?:\/\//i[_0x9e33('0x93')](_0x1ad6e8)){_0xa5be4c=path['join']('plugins',_0x16d56a,_0x508da2[0x0],_0x1ad6e8);}else{_0xa5be4c=_0x1ad6e8;}}else{logger[_0x9e33('0x6b')](_0x9e33('0x94'));}if(_0x9e33('0x25')!=typeof _0x5c1fe2['parameters'][_0x9e33('0x85')][_0x9e33('0x88')]){var _0x5fa95e=_0x5c1fe2['parameters'][_0x9e33('0x85')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x9e33('0x93')](_0x5fa95e)){_0x12e917=path[_0x9e33('0x53')](_0x9e33('0x95'),_0x16d56a,_0x508da2[0x0],_0x5fa95e);}else{_0x12e917=_0x5fa95e;}}else{logger['info'](_0x9e33('0x96'));}}else if(_0x24b454===_0x9e33('0x8a')){_0x43d873=_0x5c1fe2[_0x9e33('0x84')][_0x9e33('0x8b')];_0x1aedb7=_0x5c1fe2['parameters'][_0x9e33('0x8d')];if('undefined'!=typeof _0x5c1fe2[_0x9e33('0x84')][_0x9e33('0x85')]){if('undefined'!=typeof _0x5c1fe2[_0x9e33('0x84')][_0x9e33('0x85')][_0x9e33('0x87')]){var _0x1ad6e8=_0x5c1fe2[_0x9e33('0x84')][_0x9e33('0x85')][_0x9e33('0x87')];if(!/^(f|ht)tps?:\/\//i[_0x9e33('0x93')](_0x1ad6e8)){_0xa5be4c=path[_0x9e33('0x53')]('plugins',_0x16d56a,_0x508da2[0x0],_0x1ad6e8);}else{_0xa5be4c=_0x1ad6e8;}}if(_0x9e33('0x25')!=typeof _0x5c1fe2['parameters'][_0x9e33('0x85')][_0x9e33('0x88')]){var _0x5fa95e=_0x5c1fe2['parameters']['views'][_0x9e33('0x88')];if(!/^(f|ht)tps?:\/\//i[_0x9e33('0x93')](_0x5fa95e)){_0x12e917=path[_0x9e33('0x53')](_0x9e33('0x95'),_0x16d56a,_0x508da2[0x0],_0x5fa95e);}else{_0x12e917=_0x5fa95e;}}}}var _0x1d3805={'name':_0x1b6bcf,'description':_0x263fea,'path':path[_0x9e33('0x53')](_0x16d56a,_0x508da2[0x0]),'type':_0x24b454,'sidebar':_0x35a80b,'icon':_0x1814f0,'adminUrl':_0xa5be4c,'agentUrl':_0x12e917,'scriptName':_0x43d873,'scriptPath':_0x1aedb7,'version':_0x32b022};removeReferences(_0x49aab7,null);return db['Plugin'][_0x9e33('0x97')](_0x1d3805)[_0x9e33('0x2b')](function(_0x2fffb0){var _0x38a2c7={'role':_0x115f4a[_0x9e33('0x98')]['role'],'userProfileId':_0x115f4a[_0x9e33('0x98')][_0x9e33('0x99')]};if(!_0x38a2c7)throw new Error(_0x9e33('0x9a'));if(_0x38a2c7['role']===_0x9e33('0x9b')){var _0x52d23d=_0x2fffb0['get']({'plain':!![]});return db[_0x9e33('0x9c')][_0x9e33('0x50')]({'where':{'name':_0x9e33('0x2d'),'userProfileId':_0x38a2c7['userProfileId']},'raw':!![]})['then'](function(_0x25c722){if(_0x25c722&&_0x25c722[_0x9e33('0x9d')]===0x0){return db[_0x9e33('0x2e')][_0x9e33('0x97')]({'name':_0x52d23d[_0x9e33('0x32')],'resourceId':_0x52d23d['id'],'type':_0x25c722[_0x9e33('0x32')],'sectionId':_0x25c722['id']},{})[_0x9e33('0x2b')](function(){return _0x2fffb0;});}else{return _0x2fffb0;}})['catch'](function(_0x3ff43e){logger[_0x9e33('0x30')](_0x9e33('0x9e'),_0x3ff43e);throw _0x3ff43e;});}return _0x2fffb0;})[_0x9e33('0x2b')](respondWithResult(_0x4a741b,null))[_0x9e33('0x4d')](handleError(_0x4a741b,null));}});}catch(_0xee5114){_0x4a741b[_0x9e33('0x21')](0x1f4)[_0x9e33('0x33')](_0xee5114);}};function removeReferences(_0x3b8eac,_0x4c02cf){try{if(_0x3b8eac){fs[_0x9e33('0x69')](_0x3b8eac);logger[_0x9e33('0x6b')]('Zip\x20archive\x20removed');}if(_0x4c02cf){rimraf(_0x4c02cf,function(){});logger['info'](_0x9e33('0x9f'));}}catch(_0x58eb21){logger[_0x9e33('0x30')](_0x58eb21);}}exports['update']=function(_0x5ca9e5,_0xe3ba22,_0x5632a2){return db['Plugin'][_0x9e33('0x50')]({'where':{'id':_0x5ca9e5[_0x9e33('0x4f')]['id']}})[_0x9e33('0x2b')](handleEntityNotFound(_0xe3ba22,null))[_0x9e33('0x2b')](saveUpdates(_0x5ca9e5['body'],null))['then'](respondWithResult(_0xe3ba22,null))[_0x9e33('0x4d')](handleError(_0xe3ba22,null));};exports[_0x9e33('0xa0')]=function(_0x24ac56,_0x552203,_0x273018){return db[_0x9e33('0x36')]['find']({'where':{'id':_0x24ac56['params']['id']}})['then'](function(_0x2a4149){if(_0x2a4149){return _0x2a4149[_0x9e33('0x2f')]();}})[_0x9e33('0x2b')](function(_0x504eb9){rimraf(path[_0x9e33('0x53')](config['root'],_0x9e33('0x54'),path['dirname'](_0x504eb9[_0x9e33('0x52')])),function(){});return _0x504eb9;})['then'](handleEntityNotFound(_0x552203,null))[_0x9e33('0x2b')](respondWithStatusCode(_0x552203,null))[_0x9e33('0x4d')](handleError(_0x552203,null));};exports[_0x9e33('0xa1')]=function(_0x13b0ef,_0x47c30f,_0x391ee6){return BPromise[_0x9e33('0xa2')]()[_0x9e33('0x2b')](function(){if(!_0x13b0ef[_0x9e33('0x3d')][_0x9e33('0x52')]){throw new Error(_0x9e33('0xa3'));}if(!_0x13b0ef[_0x9e33('0x3d')][_0x9e33('0xa4')]){throw new Error(_0x9e33('0xa5'));}var _0x403312=_0x13b0ef[_0x9e33('0x3d')][_0x9e33('0xa6')]?_0x13b0ef[_0x9e33('0x3d')][_0x9e33('0xa6')]+':'+_0x13b0ef[_0x9e33('0x3d')][_0x9e33('0xa4')]:_0x9e33('0xa7')+_0x13b0ef[_0x9e33('0x3d')][_0x9e33('0xa4')];var _0x3cfa69=_0x13b0ef[_0x9e33('0x3d')][_0x9e33('0x23')]?_0x13b0ef[_0x9e33('0x3d')][_0x9e33('0x23')]:!![];var _0xfe3d2a=_0x13b0ef['query']['encoding']?_0x13b0ef[_0x9e33('0x3d')][_0x9e33('0xa8')]:null;var _0x4e4a57={'method':_0x13b0ef[_0x9e33('0xa9')],'uri':util[_0x9e33('0x55')](_0x9e33('0xaa'),_0x403312,_0x13b0ef[_0x9e33('0x3d')][_0x9e33('0x52')]),'json':_0x3cfa69,'resolveWithFullResponse':!![],'encoding':_0xfe3d2a,'qs':_0x13b0ef[_0x9e33('0x3d')]};if(_0x13b0ef[_0x9e33('0xab')]){_0x4e4a57[_0x9e33('0xab')]=_0x13b0ef['headers'];if(_0x4e4a57[_0x9e33('0xab')][_0x9e33('0xac')]){delete _0x4e4a57[_0x9e33('0xab')][_0x9e33('0xac')];}}if(_0x4e4a57[_0x9e33('0xab')][_0x9e33('0xad')]){delete _0x4e4a57[_0x9e33('0xab')]['content-type'];}return rp(_0x4e4a57);})[_0x9e33('0x2b')](function(_0x5c4e9c){if(_0x5c4e9c){_0x47c30f[_0x9e33('0x28')](_0x5c4e9c['headers']);logger[_0x9e33('0x6b')](_0x5c4e9c['body']);if(_[_0x9e33('0xae')](_0x13b0ef['query'][_0x9e33('0x52')],_0x9e33('0x51'))&&_0x5c4e9c[_0x9e33('0xaf')]==0x1f4){return _0x47c30f[_0x9e33('0x20')](_0x5c4e9c[_0x9e33('0xaf')]);}else{return _0x47c30f[_0x9e33('0x21')](_0x5c4e9c['statusCode'])[_0x9e33('0x33')](_0x5c4e9c['body']);}}else{return _0x47c30f[_0x9e33('0x20')](0xc8);}})[_0x9e33('0x4d')](handleError(_0x47c30f,null));};exports[_0x9e33('0xb0')]=function(_0x2eb204,_0xc26204,_0xb1c4b){return BPromise['resolve']()[_0x9e33('0x2b')](function(){if(!_0x2eb204[_0x9e33('0x3d')][_0x9e33('0x52')]){throw new Error(_0x9e33('0xa3'));}if(!_0x2eb204['query'][_0x9e33('0xa4')]){throw new Error(_0x9e33('0xa5'));}var _0x3e2fa2=_0x2eb204['query'][_0x9e33('0xa6')]?_0x2eb204[_0x9e33('0x3d')]['hostname']+':'+_0x2eb204[_0x9e33('0x3d')][_0x9e33('0xa4')]:_0x9e33('0xa7')+_0x2eb204[_0x9e33('0x3d')][_0x9e33('0xa4')];var _0x1bf8be=_0x2eb204[_0x9e33('0x3d')][_0x9e33('0x23')]?_0x2eb204[_0x9e33('0x3d')][_0x9e33('0x23')]:!![];var _0x1e7828=_0x2eb204[_0x9e33('0x3d')][_0x9e33('0xa8')]?_0x2eb204[_0x9e33('0x3d')]['encoding']:null;var _0x338c10={'method':_0x2eb204['method'],'uri':util['format'](_0x9e33('0xaa'),_0x3e2fa2,_0x2eb204['query'][_0x9e33('0x52')]),'json':_0x1bf8be,'resolveWithFullResponse':!![],'encoding':_0x1e7828,'body':_0x2eb204[_0x9e33('0x98')]};if(_0x2eb204[_0x9e33('0xab')]){_0x338c10[_0x9e33('0xab')]=_0x2eb204[_0x9e33('0xab')];if(_0x338c10[_0x9e33('0xab')][_0x9e33('0xac')]){delete _0x338c10['headers']['content-length'];}}if(_0x338c10[_0x9e33('0xab')][_0x9e33('0xad')]){delete _0x338c10[_0x9e33('0xab')][_0x9e33('0xad')];}return rp(_0x338c10);})[_0x9e33('0x2b')](function(_0x198606){if(_0x198606){_0xc26204[_0x9e33('0x28')](_0x198606[_0x9e33('0xab')]);logger[_0x9e33('0x6b')](_0x198606['body']);return _0xc26204[_0x9e33('0x21')](_0x198606['statusCode'])[_0x9e33('0x33')](_0x198606[_0x9e33('0x98')]);}else{return _0xc26204['sendStatus'](0xc8);}})[_0x9e33('0x4d')](handleError(_0xc26204,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index a299783..e585e99 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 _0xf9d5=['hook','exports','../../mysqldb','Plugin','save','update','remove','emit'];(function(_0x1f44e4,_0x22d9fd){var _0x591989=function(_0x3aeb88){while(--_0x3aeb88){_0x1f44e4['push'](_0x1f44e4['shift']());}};_0x591989(++_0x22d9fd);}(_0xf9d5,0x122));var _0x5f9d=function(_0x110d38,_0x5a0d97){_0x110d38=_0x110d38-0x0;var _0x75ff3a=_0xf9d5[_0x110d38];return _0x75ff3a;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x5f9d('0x0'))['db'][_0x5f9d('0x1')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5f9d('0x2'),'afterUpdate':_0x5f9d('0x3'),'afterDestroy':_0x5f9d('0x4')};function emitEvent(_0x290ef2){return function(_0x25fa8c,_0xdd68fd,_0x27449e){PluginEvents['emit'](_0x290ef2+':'+_0x25fa8c['id'],_0x25fa8c);PluginEvents[_0x5f9d('0x5')](_0x290ef2,_0x25fa8c);_0x27449e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x5f9d('0x6')](e,emitEvent(event));}}module[_0x5f9d('0x7')]=PluginEvents; \ No newline at end of file +var _0x9c5a=['hook','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x943f7c,_0x68aa15){var _0x590d3e=function(_0x26bc6c){while(--_0x26bc6c){_0x943f7c['push'](_0x943f7c['shift']());}};_0x590d3e(++_0x68aa15);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x15a9b8,_0x5e3dbd){_0x15a9b8=_0x15a9b8-0x0;var _0xae4374=_0x9c5a[_0x15a9b8];return _0xae4374;};'use strict';var EventEmitter=require(_0xa9c5('0x0'));var Plugin=require(_0xa9c5('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0xa9c5('0x2')](0x0);var events={'afterCreate':_0xa9c5('0x3'),'afterUpdate':_0xa9c5('0x4'),'afterDestroy':_0xa9c5('0x5')};function emitEvent(_0x4f5552){return function(_0x2acfaf,_0x3051b1,_0x4e9403){PluginEvents[_0xa9c5('0x6')](_0x4f5552+':'+_0x2acfaf['id'],_0x2acfaf);PluginEvents['emit'](_0x4f5552,_0x2acfaf);_0x4e9403(null);};}for(var e in events){if(events[_0xa9c5('0x7')](e)){var event=events[e];Plugin[_0xa9c5('0x8')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 3acfc86..ac74e66 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 _0xc95c=['Plugin','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./plugin.attributes','exports','define'];(function(_0x5db5b2,_0xc3315){var _0x53ef14=function(_0x5efcc9){while(--_0x5efcc9){_0x5db5b2['push'](_0x5db5b2['shift']());}};_0x53ef14(++_0xc3315);}(_0xc95c,0x18d));var _0xcc95=function(_0x459bd8,_0x439ebd){_0x459bd8=_0x459bd8-0x0;var _0x2f3af3=_0xc95c[_0x459bd8];return _0x2f3af3;};'use strict';var _=require(_0xcc95('0x0'));var util=require(_0xcc95('0x1'));var logger=require(_0xcc95('0x2'))(_0xcc95('0x3'));var moment=require(_0xcc95('0x4'));var BPromise=require('bluebird');var rp=require(_0xcc95('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcc95('0x6'));var config=require(_0xcc95('0x7'));var attributes=require(_0xcc95('0x8'));module[_0xcc95('0x9')]=function(_0x520c88,_0x377634){return _0x520c88[_0xcc95('0xa')](_0xcc95('0xb'),attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x54ad=['exports','define','Plugin','plugins','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./plugin.attributes'];(function(_0x3fe24b,_0xf6d828){var _0x49c03a=function(_0x9b5877){while(--_0x9b5877){_0x3fe24b['push'](_0x3fe24b['shift']());}};_0x49c03a(++_0xf6d828);}(_0x54ad,0x12a));var _0xd54a=function(_0x142496,_0x1d8964){_0x142496=_0x142496-0x0;var _0x412bb8=_0x54ad[_0x142496];return _0x412bb8;};'use strict';var _=require(_0xd54a('0x0'));var util=require(_0xd54a('0x1'));var logger=require(_0xd54a('0x2'))(_0xd54a('0x3'));var moment=require(_0xd54a('0x4'));var BPromise=require(_0xd54a('0x5'));var rp=require(_0xd54a('0x6'));var fs=require('fs');var path=require(_0xd54a('0x7'));var rimraf=require(_0xd54a('0x8'));var config=require('../../config/environment');var attributes=require(_0xd54a('0x9'));module[_0xd54a('0xa')]=function(_0x50d235,_0x575dba){return _0x50d235[_0xd54a('0xb')](_0xd54a('0xc'),attributes,{'tableName':_0xd54a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 9821ec3..54c7af2 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 _0xf23c=['message','result','CreatePlugin','Plugin','body','options','raw','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1e6aa7,_0x3282c6){var _0x5f20c3=function(_0x1dd529){while(--_0x1dd529){_0x1e6aa7['push'](_0x1e6aa7['shift']());}};_0x5f20c3(++_0x3282c6);}(_0xf23c,0x1b8));var _0xcf23=function(_0x3c04ef,_0x9d110c){_0x3c04ef=_0x3c04ef-0x0;var _0x6a3a69=_0xf23c[_0x3c04ef];return _0x6a3a69;};'use strict';var _=require('lodash');var util=require(_0xcf23('0x0'));var moment=require(_0xcf23('0x1'));var BPromise=require(_0xcf23('0x2'));var rs=require(_0xcf23('0x3'));var fs=require('fs');var Redis=require(_0xcf23('0x4'));var db=require(_0xcf23('0x5'))['db'];var utils=require(_0xcf23('0x6'));var logger=require(_0xcf23('0x7'))(_0xcf23('0x8'));var config=require(_0xcf23('0x9'));var jayson=require(_0xcf23('0xa'));var client=jayson[_0xcf23('0xb')][_0xcf23('0xc')]({'port':0x232a});config[_0xcf23('0xd')]=_[_0xcf23('0xe')](config[_0xcf23('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xcf23('0xf'))(new Redis(config['redis']));require(_0xcf23('0x10'))[_0xcf23('0x11')](socket);function respondWithRpcPromise(_0x31bf74,_0x548548,_0x3e6112){return new BPromise(function(_0x1a252a,_0x853dc1){return client[_0xcf23('0x12')](_0x31bf74,_0x3e6112)[_0xcf23('0x13')](function(_0x205c53){logger[_0xcf23('0x14')](_0xcf23('0x15'),_0x548548,_0xcf23('0x16'));logger[_0xcf23('0x17')](_0xcf23('0x18'),_0x548548,_0xcf23('0x16'),JSON[_0xcf23('0x19')](_0x205c53));if(_0x205c53[_0xcf23('0x1a')]){if(_0x205c53[_0xcf23('0x1a')][_0xcf23('0x1b')]===0x1f4){logger['error'](_0xcf23('0x15'),_0x548548,_0x205c53[_0xcf23('0x1a')]['message']);return _0x853dc1(_0x205c53['error'][_0xcf23('0x1c')]);}logger[_0xcf23('0x1a')]('Plugin,\x20%s,\x20%s',_0x548548,_0x205c53['error'][_0xcf23('0x1c')]);return _0x1a252a(_0x205c53[_0xcf23('0x1a')]['message']);}else{logger[_0xcf23('0x14')](_0xcf23('0x15'),_0x548548,'request\x20sent');_0x1a252a(_0x205c53[_0xcf23('0x1d')][_0xcf23('0x1c')]);}})['catch'](function(_0x39098f){logger[_0xcf23('0x1a')]('Plugin,\x20%s,\x20%s',_0x548548,_0x39098f);_0x853dc1(_0x39098f);});});}exports[_0xcf23('0x1e')]=function(_0x4deda8){var _0x400b58=this;return new Promise(function(_0x556b09,_0x4f25d5){return db[_0xcf23('0x1f')]['create'](_0x4deda8[_0xcf23('0x20')],{'raw':_0x4deda8[_0xcf23('0x21')]?_0x4deda8[_0xcf23('0x21')][_0xcf23('0x22')]===undefined?!![]:![]:!![]})['then'](function(_0xc84479){logger[_0xcf23('0x14')]('CreatePlugin',_0x4deda8);logger[_0xcf23('0x17')](_0xcf23('0x1e'),_0x4deda8,JSON[_0xcf23('0x19')](_0xc84479));_0x556b09(_0xc84479);})[_0xcf23('0x23')](function(_0x283191){logger[_0xcf23('0x1a')](_0xcf23('0x1e'),_0x283191['message'],_0x4deda8);_0x4f25d5(_0x400b58[_0xcf23('0x1a')](0x1f4,_0x283191[_0xcf23('0x1c')]));});});}; \ No newline at end of file +var _0x0060=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','./plugin.socket','register','then','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','Plugin','create','body','options','raw','info','CreatePlugin','lodash','util'];(function(_0x9467a,_0x364e12){var _0x47d7a7=function(_0x6d38dd){while(--_0x6d38dd){_0x9467a['push'](_0x9467a['shift']());}};_0x47d7a7(++_0x364e12);}(_0x0060,0x11e));var _0x0006=function(_0x687ce7,_0x39db4f){_0x687ce7=_0x687ce7-0x0;var _0x8bb835=_0x0060[_0x687ce7];return _0x8bb835;};'use strict';var _=require(_0x0006('0x0'));var util=require(_0x0006('0x1'));var moment=require('moment');var BPromise=require(_0x0006('0x2'));var rs=require(_0x0006('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0006('0x4'))['db'];var utils=require(_0x0006('0x5'));var logger=require(_0x0006('0x6'))('rpc');var config=require(_0x0006('0x7'));var jayson=require(_0x0006('0x8'));var client=jayson[_0x0006('0x9')]['http']({'port':0x232a});config[_0x0006('0xa')]=_['defaults'](config[_0x0006('0xa')],{'host':_0x0006('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0006('0xa')]));require(_0x0006('0xc'))[_0x0006('0xd')](socket);function respondWithRpcPromise(_0x3fe2ad,_0x45f02d,_0x5acd68){return new BPromise(function(_0x12b3a9,_0xcd42dc){return client['request'](_0x3fe2ad,_0x5acd68)[_0x0006('0xe')](function(_0x218eff){logger['info'](_0x0006('0xf'),_0x45f02d,_0x0006('0x10'));logger[_0x0006('0x11')](_0x0006('0x12'),_0x45f02d,'request\x20sent',JSON[_0x0006('0x13')](_0x218eff));if(_0x218eff['error']){if(_0x218eff['error'][_0x0006('0x14')]===0x1f4){logger[_0x0006('0x15')](_0x0006('0xf'),_0x45f02d,_0x218eff[_0x0006('0x15')][_0x0006('0x16')]);return _0xcd42dc(_0x218eff[_0x0006('0x15')][_0x0006('0x16')]);}logger[_0x0006('0x15')](_0x0006('0xf'),_0x45f02d,_0x218eff[_0x0006('0x15')][_0x0006('0x16')]);return _0x12b3a9(_0x218eff['error']['message']);}else{logger['info']('Plugin,\x20%s,\x20%s',_0x45f02d,_0x0006('0x10'));_0x12b3a9(_0x218eff[_0x0006('0x17')][_0x0006('0x16')]);}})[_0x0006('0x18')](function(_0x39e987){logger[_0x0006('0x15')](_0x0006('0xf'),_0x45f02d,_0x39e987);_0xcd42dc(_0x39e987);});});}exports['CreatePlugin']=function(_0x318d29){var _0x58536a=this;return new Promise(function(_0x28d42b,_0x4c517c){return db[_0x0006('0x19')][_0x0006('0x1a')](_0x318d29[_0x0006('0x1b')],{'raw':_0x318d29[_0x0006('0x1c')]?_0x318d29['options'][_0x0006('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x527510){logger[_0x0006('0x1e')]('CreatePlugin',_0x318d29);logger['debug']('CreatePlugin',_0x318d29,JSON['stringify'](_0x527510));_0x28d42b(_0x527510);})['catch'](function(_0x35042e){logger[_0x0006('0x15')](_0x0006('0x1f'),_0x35042e[_0x0006('0x16')],_0x318d29);_0x4c517c(_0x58536a[_0x0006('0x15')](0x1f4,_0x35042e[_0x0006('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 0cc4fa6..50e6b09 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 _0x4be4=['update','register','length','plugin:','./plugin.events'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4be4,0xc7));var _0x44be=function(_0xefca7c,_0x2807a8){_0xefca7c=_0xefca7c-0x0;var _0x1baca6=_0x4be4[_0xefca7c];return _0x1baca6;};'use strict';var PluginEvents=require(_0x44be('0x0'));var events=['save','remove',_0x44be('0x1')];function createListener(_0x3f6568,_0x4566ad){return function(_0x5e3283){_0x4566ad['emit'](_0x3f6568,_0x5e3283);};}function removeListener(_0x493598,_0x4e5825){return function(){PluginEvents['removeListener'](_0x493598,_0x4e5825);};}exports[_0x44be('0x2')]=function(_0xb63167){for(var _0x2b2988=0x0,_0x543142=events[_0x44be('0x3')];_0x2b2988<_0x543142;_0x2b2988++){var _0x5b349d=events[_0x2b2988];var _0x571800=createListener(_0x44be('0x4')+_0x5b349d,_0xb63167);PluginEvents['on'](_0x5b349d,_0x571800);}}; \ No newline at end of file +var _0x3d36=['register','length','plugin:','./plugin.events','save','emit'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x3d36,0x1ef));var _0x63d3=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0x3d36[_0x2e4e19];return _0x9ba20b;};'use strict';var PluginEvents=require(_0x63d3('0x0'));var events=[_0x63d3('0x1'),'remove','update'];function createListener(_0xbb19c4,_0x461506){return function(_0x46c028){_0x461506[_0x63d3('0x2')](_0xbb19c4,_0x46c028);};}function removeListener(_0xf0f7ab,_0x2bd828){return function(){PluginEvents['removeListener'](_0xf0f7ab,_0x2bd828);};}exports[_0x63d3('0x3')]=function(_0x208270){for(var _0x2669b5=0x0,_0x3a77d1=events[_0x63d3('0x4')];_0x2669b5<_0x3a77d1;_0x2669b5++){var _0x3123af=events[_0x2669b5];var _0x267140=createListener(_0x63d3('0x5')+_0x3123af,_0x208270);PluginEvents['on'](_0x3123af,_0x267140);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index fc4fe3b..2cc3c42 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(_0x3f0a55,_0x348113){var _0x22bc03=function(_0x46192a){while(--_0x46192a){_0x3f0a55['push'](_0x3f0a55['shift']());}};_0x22bc03(++_0x348113);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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(_0x48a49a,_0x3f74f1){var _0x2ed79b=function(_0x45aa0f){while(--_0x45aa0f){_0x48a49a['push'](_0x48a49a['shift']());}};_0x2ed79b(++_0x3f74f1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index d00164b..751b81b 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 _0xa902=['then','catch','show','params','create','body','script','join','../../files/plugins','cwd','chdir','dirname','start','dump','status','update','stop','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','exec','sendStatus','json','error','stack','name','send','npm\x20install','info','list','reject','express','motion2','length'];(function(_0x598744,_0x161abd){var _0x4c9cef=function(_0x531fec){while(--_0x531fec){_0x598744['push'](_0x598744['shift']());}};_0x4c9cef(++_0x161abd);}(_0xa902,0x8d));var _0x2a90=function(_0x3bc518,_0x58b210){_0x3bc518=_0x3bc518-0x0;var _0x43daf8=_0xa902[_0x3bc518];return _0x43daf8;};'use strict';var _=require(_0x2a90('0x0'));var pm2=require(_0x2a90('0x1'));var logger=require(_0x2a90('0x2'))(_0x2a90('0x3'));var path=require(_0x2a90('0x4'));var exec=require('child_process')[_0x2a90('0x5')];var BPromise=require('bluebird');function handleEntityNotFound(_0x4961c2,_0x169808){return function(_0x2b40c0){if(!_0x2b40c0){_0x4961c2[_0x2a90('0x6')](0x194);;}return _0x2b40c0;};}function respondWithResult(_0x21e1d2,_0x4a32c7){_0x4a32c7=_0x4a32c7||0xc8;return function(_0x25bcfc){if(_0x25bcfc){return _0x21e1d2['status'](_0x4a32c7)[_0x2a90('0x7')](_0x25bcfc);}return null;};}function handleError(_0x570659,_0x5ec2b9){_0x5ec2b9=_0x5ec2b9||0x1f4;return function(_0xc75b6e){logger[_0x2a90('0x8')](_0xc75b6e[_0x2a90('0x9')]);if(_0xc75b6e[_0x2a90('0xa')]){delete _0xc75b6e[_0x2a90('0xa')];}_0x570659['status'](_0x5ec2b9)[_0x2a90('0xb')](_0xc75b6e);};}function execChildProcess(){return new BPromise(function(_0x3dadc2,_0x43c56d){exec(_0x2a90('0xc'),function(_0x541e22,_0x40e6aa,_0x52391c){logger[_0x2a90('0xd')](_0x40e6aa);logger['info'](_0x52391c);if(_0x541e22){logger[_0x2a90('0x8')](_0x541e22);return _0x43c56d(_0x541e22);}return _0x3dadc2(_0x40e6aa);});});}exports['index']=function(_0x407ce5,_0x30e166){return pm2[_0x2a90('0xe')]()['then'](function(_0x56d1b8){if(_0x56d1b8){var _0x57227c=_[_0x2a90('0xf')](_0x56d1b8,function(_0x3a42df){return _0x3a42df['name']===_0x2a90('0x10')||_0x3a42df[_0x2a90('0xa')]===_0x2a90('0x11');});return{'rows':_0x57227c,'count':_0x57227c[_0x2a90('0x12')]};}return null;})[_0x2a90('0x13')](respondWithResult(_0x30e166,null))[_0x2a90('0x14')](handleError(_0x30e166,null));};exports[_0x2a90('0x15')]=function(_0x10cf94,_0x43eea5){return pm2['describe'](_0x10cf94[_0x2a90('0x16')]['id'])[_0x2a90('0x13')](respondWithResult(_0x43eea5,null))[_0x2a90('0x13')](handleEntityNotFound(_0x43eea5,null))['catch'](handleError(_0x43eea5,null));};exports[_0x2a90('0x17')]=function(_0x1f51a6,_0x148d18){if(_0x1f51a6[_0x2a90('0x18')][_0x2a90('0xa')]&&_0x1f51a6[_0x2a90('0x18')][_0x2a90('0x19')]){var _0x114d42=path[_0x2a90('0x1a')](__dirname,_0x2a90('0x1b'),_0x1f51a6[_0x2a90('0x18')][_0x2a90('0x19')]);var _0x4fdd62=process[_0x2a90('0x1c')]();process[_0x2a90('0x1d')](path[_0x2a90('0x1e')](_0x114d42));return execChildProcess()[_0x2a90('0x13')](function(_0x5912fd){process[_0x2a90('0x1d')](_0x4fdd62);return pm2[_0x2a90('0x1f')]({'name':_0x1f51a6['body'][_0x2a90('0xa')],'script':_0x114d42});})[_0x2a90('0x13')](function(_0x10a6dd){pm2[_0x2a90('0x20')]();return _0x10a6dd[0x0];})[_0x2a90('0x13')](respondWithResult(_0x148d18,0xc9))[_0x2a90('0x14')](handleError(_0x148d18,null));}else{return _0x148d18[_0x2a90('0x21')](0x1f4)[_0x2a90('0xb')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x2a90('0x22')]=function(_0x17f978,_0x3934d4){if(_0x17f978[_0x2a90('0x18')]['id']){delete _0x17f978[_0x2a90('0x18')]['id'];}var _0x5208d8={'online':'restart','stopped':_0x2a90('0x23')};if(_0x5208d8['hasOwnProperty'](_0x17f978['body']['status'])){return pm2[_0x5208d8[_0x17f978[_0x2a90('0x18')][_0x2a90('0x21')]]](_0x17f978['params']['id'])['then'](respondWithResult(_0x3934d4,0xc8))[_0x2a90('0x14')](handleError(_0x3934d4,null));}else{return _0x3934d4['status'](0x1f4)[_0x2a90('0xb')]({'message':_0x2a90('0x24')});}};exports[_0x2a90('0x25')]=function(_0x27b6b6,_0xf18d11){if(_0x27b6b6[_0x2a90('0x18')]['id']){delete _0x27b6b6[_0x2a90('0x18')]['id'];}if(_0x27b6b6['params']['id']){return pm2[_0x2a90('0x26')](_0x27b6b6[_0x2a90('0x16')]['id'])[_0x2a90('0x13')](function(_0x5cdeb4){pm2[_0x2a90('0x20')]();return _0x5cdeb4[0x0];})[_0x2a90('0x13')](respondWithResult(_0xf18d11,null))[_0x2a90('0x14')](handleError(_0xf18d11,null));}else{return _0xf18d11[_0x2a90('0x21')](0x1f4)['send']({'message':_0x2a90('0x27')});}}; \ No newline at end of file +var _0xd64b=['dump','send','Missing\x20name\x20and/or\x20path','update','stop','Unknown\x20status','delete','Unknown\x20id','lodash','../../config/logger','path','child_process','exec','bluebird','status','json','name','npm\x20install','info','error','index','list','then','express','motion2','show','describe','params','catch','body','script','join','../../files/plugins','cwd','chdir','dirname','start'];(function(_0x65b308,_0x1cc931){var _0x4c54de=function(_0x970b9){while(--_0x970b9){_0x65b308['push'](_0x65b308['shift']());}};_0x4c54de(++_0x1cc931);}(_0xd64b,0xc1));var _0xbd64=function(_0x498750,_0x2996c6){_0x498750=_0x498750-0x0;var _0x5a0702=_0xd64b[_0x498750];return _0x5a0702;};'use strict';var _=require(_0xbd64('0x0'));var pm2=require('../../config/pm2');var logger=require(_0xbd64('0x1'))('api');var path=require(_0xbd64('0x2'));var exec=require(_0xbd64('0x3'))[_0xbd64('0x4')];var BPromise=require(_0xbd64('0x5'));function handleEntityNotFound(_0x30fe29,_0x5458d8){return function(_0x5446e4){if(!_0x5446e4){_0x30fe29['sendStatus'](0x194);;}return _0x5446e4;};}function respondWithResult(_0x51e87d,_0x58e9e7){_0x58e9e7=_0x58e9e7||0xc8;return function(_0x32995f){if(_0x32995f){return _0x51e87d[_0xbd64('0x6')](_0x58e9e7)[_0xbd64('0x7')](_0x32995f);}return null;};}function handleError(_0x3f1f17,_0x2b8543){_0x2b8543=_0x2b8543||0x1f4;return function(_0x197a84){logger['error'](_0x197a84['stack']);if(_0x197a84[_0xbd64('0x8')]){delete _0x197a84[_0xbd64('0x8')];}_0x3f1f17[_0xbd64('0x6')](_0x2b8543)['send'](_0x197a84);};}function execChildProcess(){return new BPromise(function(_0xc80599,_0x3f908a){exec(_0xbd64('0x9'),function(_0x18bde8,_0x593c79,_0x431b29){logger['info'](_0x593c79);logger[_0xbd64('0xa')](_0x431b29);if(_0x18bde8){logger[_0xbd64('0xb')](_0x18bde8);return _0x3f908a(_0x18bde8);}return _0xc80599(_0x593c79);});});}exports[_0xbd64('0xc')]=function(_0x2183e2,_0x367824){return pm2[_0xbd64('0xd')]()[_0xbd64('0xe')](function(_0x269e2f){if(_0x269e2f){var _0x2b5808=_['reject'](_0x269e2f,function(_0x2d1159){return _0x2d1159[_0xbd64('0x8')]===_0xbd64('0xf')||_0x2d1159[_0xbd64('0x8')]===_0xbd64('0x10');});return{'rows':_0x2b5808,'count':_0x2b5808['length']};}return null;})[_0xbd64('0xe')](respondWithResult(_0x367824,null))['catch'](handleError(_0x367824,null));};exports[_0xbd64('0x11')]=function(_0x1432a6,_0x3aef70){return pm2[_0xbd64('0x12')](_0x1432a6[_0xbd64('0x13')]['id'])[_0xbd64('0xe')](respondWithResult(_0x3aef70,null))[_0xbd64('0xe')](handleEntityNotFound(_0x3aef70,null))[_0xbd64('0x14')](handleError(_0x3aef70,null));};exports['create']=function(_0x305545,_0x1f618b){if(_0x305545['body']['name']&&_0x305545[_0xbd64('0x15')][_0xbd64('0x16')]){var _0x196d21=path[_0xbd64('0x17')](__dirname,_0xbd64('0x18'),_0x305545[_0xbd64('0x15')]['script']);var _0x4d4a16=process[_0xbd64('0x19')]();process[_0xbd64('0x1a')](path[_0xbd64('0x1b')](_0x196d21));return execChildProcess()[_0xbd64('0xe')](function(_0x55e74c){process['chdir'](_0x4d4a16);return pm2[_0xbd64('0x1c')]({'name':_0x305545['body'][_0xbd64('0x8')],'script':_0x196d21});})['then'](function(_0x33452d){pm2[_0xbd64('0x1d')]();return _0x33452d[0x0];})[_0xbd64('0xe')](respondWithResult(_0x1f618b,0xc9))[_0xbd64('0x14')](handleError(_0x1f618b,null));}else{return _0x1f618b['status'](0x1f4)[_0xbd64('0x1e')]({'message':_0xbd64('0x1f')});}};exports[_0xbd64('0x20')]=function(_0x2a44d0,_0x4d1563){if(_0x2a44d0['body']['id']){delete _0x2a44d0[_0xbd64('0x15')]['id'];}var _0x49eac5={'online':'restart','stopped':_0xbd64('0x21')};if(_0x49eac5['hasOwnProperty'](_0x2a44d0[_0xbd64('0x15')]['status'])){return pm2[_0x49eac5[_0x2a44d0[_0xbd64('0x15')]['status']]](_0x2a44d0[_0xbd64('0x13')]['id'])[_0xbd64('0xe')](respondWithResult(_0x4d1563,0xc8))[_0xbd64('0x14')](handleError(_0x4d1563,null));}else{return _0x4d1563[_0xbd64('0x6')](0x1f4)[_0xbd64('0x1e')]({'message':_0xbd64('0x22')});}};exports['destroy']=function(_0x35bdd5,_0xe876c9){if(_0x35bdd5[_0xbd64('0x15')]['id']){delete _0x35bdd5[_0xbd64('0x15')]['id'];}if(_0x35bdd5[_0xbd64('0x13')]['id']){return pm2[_0xbd64('0x23')](_0x35bdd5['params']['id'])['then'](function(_0x1e4593){pm2['dump']();return _0x1e4593[0x0];})[_0xbd64('0xe')](respondWithResult(_0xe876c9,null))[_0xbd64('0x14')](handleError(_0xe876c9,null));}else{return _0xe876c9['status'](0x1f4)['send']({'message':_0xbd64('0x24')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 6ae7434..dcef59c 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 _0x826c=['getQueues','exports','express','Router','../../components/auth/service','./realtime.controller','get','/queues','isAuthenticated'];(function(_0x47c61e,_0x1147d2){var _0x667829=function(_0x3d5da7){while(--_0x3d5da7){_0x47c61e['push'](_0x47c61e['shift']());}};_0x667829(++_0x1147d2);}(_0x826c,0xc8));var _0xc826=function(_0x1e777f,_0x280fe9){_0x1e777f=_0x1e777f-0x0;var _0x5195dd=_0x826c[_0x1e777f];return _0x5195dd;};'use strict';var express=require(_0xc826('0x0'));var router=express[_0xc826('0x1')]();var auth=require(_0xc826('0x2'));var controller=require(_0xc826('0x3'));router[_0xc826('0x4')](_0xc826('0x5'),auth[_0xc826('0x6')](),controller[_0xc826('0x7')]);module[_0xc826('0x8')]=router; \ No newline at end of file +var _0xdc7b=['/queues','isAuthenticated','exports','express','Router','../../components/auth/service','./realtime.controller','get'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0xdc7b,0x153));var _0xbdc7=function(_0x4e299d,_0xf1bbde){_0x4e299d=_0x4e299d-0x0;var _0x2a25df=_0xdc7b[_0x4e299d];return _0x2a25df;};'use strict';var express=require(_0xbdc7('0x0'));var router=express[_0xbdc7('0x1')]();var auth=require(_0xbdc7('0x2'));var controller=require(_0xbdc7('0x3'));router[_0xbdc7('0x4')](_0xbdc7('0x5'),auth[_0xbdc7('0x6')](),controller['getQueues']);module[_0xbdc7('0x7')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 6f1c084..3e80117 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 _0xafb9=['rows','merge','pick','getAgents','online','getMembers','length','User','Queue','Pause','findAll','QueueId','UserId','agent','all','util','lodash','jayson/promise','../../components/parsers/qs','../../config/logger','api','../../mysqldb','client','http','undefined','limit','count','offset','status','set','Content-Range','json','error','stack','name','getQueues','mail','chat','sms','fax','whatsapp','voice','resolve','query','channel','toLowerCase','Invalid\x20channel','map','rawAttributes','type','key','user','userProfileId','outbound','QueueCampaigns','Queues','filter','UserProfile','getResources','findAndCountAll','then','request','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','loggedIn','available','paused','push','pTalking','dialActive','dialMethod','startPredictive','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','get','loggedInDb','originated','agents','find'];(function(_0x2c2c98,_0x18c8c2){var _0x454229=function(_0x52c2fe){while(--_0x52c2fe){_0x2c2c98['push'](_0x2c2c98['shift']());}};_0x454229(++_0x18c8c2);}(_0xafb9,0x68));var _0x9afb=function(_0x171167,_0x255606){_0x171167=_0x171167-0x0;var _0x3f746f=_0xafb9[_0x171167];return _0x3f746f;};'use strict';var util=require(_0x9afb('0x0'));var _=require(_0x9afb('0x1'));var jayson=require(_0x9afb('0x2'));var qs=require(_0x9afb('0x3'));var logger=require(_0x9afb('0x4'))(_0x9afb('0x5'));var db=require(_0x9afb('0x6'))['db'];var client=jayson[_0x9afb('0x7')][_0x9afb('0x8')]({'port':0x232a});var routingClient=jayson['client']['http']({'port':0x232c});function respondWithFilteredResult(_0x91ffa0,_0x56a139){return function(_0x1ccf93){if(_0x1ccf93){var _0x548b24=typeof _0x56a139['offset']===_0x9afb('0x9')&&typeof _0x56a139[_0x9afb('0xa')]===_0x9afb('0x9');var _0x51dc88=_0x1ccf93[_0x9afb('0xb')];var _0x3e0264=_0x548b24?0x0:_0x56a139[_0x9afb('0xc')];var _0x27fa71=_0x548b24?_0x1ccf93[_0x9afb('0xb')]:_0x56a139['offset']+_0x56a139['limit'];var _0x2c0c02;if(_0x27fa71>=_0x51dc88){_0x27fa71=_0x51dc88;_0x2c0c02=0xc8;}else{_0x2c0c02=0xce;}_0x91ffa0[_0x9afb('0xd')](_0x2c0c02);return _0x91ffa0[_0x9afb('0xe')](_0x9afb('0xf'),_0x3e0264+'-'+_0x27fa71+'/'+_0x51dc88)[_0x9afb('0x10')](_0x1ccf93);}return null;};}function handleError(_0xb6cd07,_0x374094){_0x374094=_0x374094||0x1f4;return function(_0x34e849){logger[_0x9afb('0x11')](_0x34e849[_0x9afb('0x12')]);if(_0x34e849['name']){delete _0x34e849[_0x9afb('0x13')];}_0xb6cd07['status'](_0x374094)['send'](_0x34e849);};}exports[_0x9afb('0x14')]=function(_0x3e40c1,_0x3c8d2e){var _0x2d664d=[_0x9afb('0x15'),_0x9afb('0x16'),_0x9afb('0x17'),'openchannel',_0x9afb('0x18'),_0x9afb('0x19'),_0x9afb('0x1a')];var _0x190cb8={'count':0x0,'rows':[]},_0x223aef={},_0x508433;Promise[_0x9afb('0x1b')]()['then'](function(){if(_0x3e40c1[_0x9afb('0x1c')][_0x9afb('0x1d')]){if(!_['includes'](_0x2d664d,_0x3e40c1['query'][_0x9afb('0x1d')][_0x9afb('0x1e')]()))throw new Error(_0x9afb('0x1f'));_0x508433=_0x3e40c1[_0x9afb('0x1c')][_0x9afb('0x1d')]['toLowerCase']();}var _0x105253=_['startCase'](_0x508433)+'Queue';var _0x3fb534=_[_0x9afb('0x20')](db[_0x105253][_0x9afb('0x21')],function(_0x2d3938){return{'name':_0x2d3938['fieldName'],'type':_0x2d3938[_0x9afb('0x22')][_0x9afb('0x23')]};});_0x223aef=qs['getOptions'](_0x3fb534,_0x3e40c1);if(_0x3e40c1['user']['role']===_0x9afb('0x24')){var _0x4fbe61={'params':{'id':_0x3e40c1[_0x9afb('0x24')][_0x9afb('0x25')]},'query':{'section':_0x508433==='voice'&&_0x3e40c1[_0x9afb('0x1c')][_0x9afb('0x22')]===_0x9afb('0x26')?_0x9afb('0x27'):_['startCase'](_0x508433)+_0x9afb('0x28'),'type':_0x3e40c1['query'][_0x9afb('0x22')],'nolimit':!![],'sort':'name','filter':_0x3e40c1['query'][_0x9afb('0x29')]}};return db[_0x9afb('0x2a')][_0x9afb('0x2b')](_0x4fbe61);}return db[_0x105253][_0x9afb('0x2c')](_0x223aef);})[_0x9afb('0x2d')](function(_0x3e3f57){_0x190cb8[_0x9afb('0xb')]=_0x3e3f57['count'];var _0x494ef8=_0x508433===_0x9afb('0x1a')?client:routingClient;return _0x494ef8[_0x9afb('0x2e')](_['startCase'](_0x508433)+_0x9afb('0x28'),_0x3e40c1)[_0x9afb('0x2d')](function(_0x5560bd){if(_0x5560bd[_0x9afb('0x11')])throw new Error(util[_0x9afb('0x2f')](_0x9afb('0x30'),_0x508433));var _0x3dec39=_0x5560bd[_0x9afb('0x31')];var _0x131204=[_0x9afb('0x32'),_0x9afb('0x33'),'waiting','talking',_0x9afb('0x34')];if(_0x508433===_0x9afb('0x1a')&&_0x3e40c1[_0x9afb('0x1c')][_0x9afb('0x22')]===_0x9afb('0x26')){_0x131204[_0x9afb('0x35')](_0x9afb('0x36'),'originated','message',_0x9afb('0x37'),_0x9afb('0x38'),'Trunk',_0x9afb('0x39'),'startProgressive',_0x9afb('0x3a'),_0x9afb('0x3b'),'erlangAbandonmentRate',_0x9afb('0x3c'),'dialPredictiveInterval',_0x9afb('0x3d'),_0x9afb('0x3e'),_0x9afb('0x3f'),_0x9afb('0x40'),_0x9afb('0x41'),_0x9afb('0x42'),_0x9afb('0x43'),_0x9afb('0x44'),'predictiveIntervalAvgTalktime');}var _0x3790fd=_0x3e3f57['rows'][_0x9afb('0x20')](function(_0x6ac20f){var _0x3c5231=_0x6ac20f[_0x9afb('0x45')]({'plain':!![]});_0x3c5231[_0x9afb('0x34')]=0x0;_0x3c5231[_0x9afb('0x46')]=0x0;_0x3c5231[_0x9afb('0x32')]=0x0;_0x3c5231[_0x9afb('0x33')]=0x0;_0x3c5231[_0x9afb('0x34')]=0x0;_0x3c5231['waiting']=0x0;if(_0x508433===_0x9afb('0x1a')){_0x3c5231['talking']=0x0;if(_0x3e40c1[_0x9afb('0x1c')][_0x9afb('0x22')]===_0x9afb('0x26')){_0x3c5231['pTalking']=0x0;_0x3c5231[_0x9afb('0x47')]=0x0;}}_0x3c5231[_0x9afb('0x48')]=[];var _0x318746=_[_0x9afb('0x49')](_0x3dec39[_0x9afb('0x4a')],['id',_0x3c5231['id']]);if(_0x318746)_[_0x9afb('0x4b')](_0x3c5231,_[_0x9afb('0x4c')](_0x318746,_0x131204));if(_0x508433==='voice'){return _0x6ac20f[_0x9afb('0x4d')]({'attributes':['id',_0x9afb('0x13'),_0x9afb('0x4e')],'joinTableAttributes':[],'raw':!![]})[_0x9afb('0x2d')](function(_0x464a8e){return _0x6ac20f[_0x9afb('0x4f')]({'raw':!![]})[_0x9afb('0x2d')](function(_0x15401a){for(var _0x59864a=0x0;_0x59864a<_0x464a8e[_0x9afb('0x50')];_0x59864a++){var _0x5a290b=_['find'](_0x15401a,['UserId',_0x464a8e[_0x59864a]['id']]);var _0xc72355={'id':_0x464a8e[_0x59864a]['id'],'name':_0x464a8e[_0x59864a][_0x9afb('0x13')],'online':Boolean(_0x464a8e[_0x59864a]['online']),'paused':_0x5a290b?Boolean(_0x5a290b[_0x9afb('0x34')]):![]};if(_0xc72355[_0x9afb('0x4e')])_0x3c5231[_0x9afb('0x46')]++;if(_0xc72355[_0x9afb('0x34')])_0x3c5231[_0x9afb('0x34')]++;_0x3c5231[_0x9afb('0x48')][_0x9afb('0x35')](_0xc72355);}return _0x3c5231;});});}else{var _0x350986=_0x9afb('0x51')+_['startCase'](_0x508433)+_0x9afb('0x52');var _0x221c28=_0x508433+_0x9afb('0x53');return db[_0x350986][_0x9afb('0x54')]({'where':{[_['startCase'](_0x508433)+_0x9afb('0x55')]:_0x6ac20f['id']},'raw':!![]})[_0x9afb('0x2d')](function(_0x1608b6){return db['User'][_0x9afb('0x54')]({'attributes':['id',_0x9afb('0x13'),_0x9afb('0x4e'),_0x221c28],'where':{'id':_[_0x9afb('0x20')](_0x1608b6,_0x9afb('0x56')),'role':_0x9afb('0x57')},'raw':!![]});})[_0x9afb('0x2d')](function(_0x570dd4){for(var _0x5a36e4=0x0;_0x5a36e4<_0x570dd4['length'];_0x5a36e4++){var _0x414645={'id':_0x570dd4[_0x5a36e4]['id'],'name':_0x570dd4[_0x5a36e4][_0x9afb('0x13')],'online':Boolean(_0x570dd4[_0x5a36e4]['online']),'paused':Boolean(_0x570dd4[_0x5a36e4][_0x221c28])};if(_0x414645[_0x9afb('0x4e')])_0x3c5231[_0x9afb('0x46')]++;if(_0x414645[_0x9afb('0x34')])_0x3c5231[_0x9afb('0x34')]++;_0x3c5231[_0x9afb('0x48')][_0x9afb('0x35')](_0x414645);}return _0x3c5231;});}});return Promise[_0x9afb('0x58')](_0x3790fd);});})[_0x9afb('0x2d')](function(_0x20abe4){_0x190cb8[_0x9afb('0x4a')]=_0x20abe4;return _0x190cb8;})[_0x9afb('0x2d')](respondWithFilteredResult(_0x3c8d2e,_0x223aef))['catch'](handleError(_0x3c8d2e,null));}; \ No newline at end of file +var _0xafc4=['predictiveIntervalAvgTalktime','get','loggedInDb','agents','find','rows','merge','pick','getAgents','getMembers','length','online','User','Pause','findAll','QueueId','UserId','all','catch','util','jayson/promise','../../config/logger','api','../../mysqldb','client','offset','undefined','count','limit','status','set','json','error','stack','name','send','getQueues','chat','openchannel','fax','whatsapp','voice','resolve','then','query','channel','toLowerCase','Invalid\x20channel','startCase','Queue','map','fieldName','key','user','role','userProfileId','type','outbound','QueueCampaigns','Queues','findAndCountAll','format','result','loggedIn','available','waiting','talking','paused','push','pTalking','originated','message','dialActive','dialMethod','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime'];(function(_0x9008bd,_0x16a66b){var _0x408d9f=function(_0x5a70b9){while(--_0x5a70b9){_0x9008bd['push'](_0x9008bd['shift']());}};_0x408d9f(++_0x16a66b);}(_0xafc4,0x69));var _0x4afc=function(_0x2ddfe4,_0x1130d9){_0x2ddfe4=_0x2ddfe4-0x0;var _0x396385=_0xafc4[_0x2ddfe4];return _0x396385;};'use strict';var util=require(_0x4afc('0x0'));var _=require('lodash');var jayson=require(_0x4afc('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x4afc('0x2'))(_0x4afc('0x3'));var db=require(_0x4afc('0x4'))['db'];var client=jayson[_0x4afc('0x5')]['http']({'port':0x232a});var routingClient=jayson['client']['http']({'port':0x232c});function respondWithFilteredResult(_0x36cb50,_0x471d45){return function(_0x16953b){if(_0x16953b){var _0x1bb281=typeof _0x471d45[_0x4afc('0x6')]===_0x4afc('0x7')&&typeof _0x471d45['limit']===_0x4afc('0x7');var _0x1c740c=_0x16953b[_0x4afc('0x8')];var _0x1e6bf5=_0x1bb281?0x0:_0x471d45[_0x4afc('0x6')];var _0x458fde=_0x1bb281?_0x16953b['count']:_0x471d45['offset']+_0x471d45[_0x4afc('0x9')];var _0x49222e;if(_0x458fde>=_0x1c740c){_0x458fde=_0x1c740c;_0x49222e=0xc8;}else{_0x49222e=0xce;}_0x36cb50[_0x4afc('0xa')](_0x49222e);return _0x36cb50[_0x4afc('0xb')]('Content-Range',_0x1e6bf5+'-'+_0x458fde+'/'+_0x1c740c)[_0x4afc('0xc')](_0x16953b);}return null;};}function handleError(_0x3fb54a,_0x2b191c){_0x2b191c=_0x2b191c||0x1f4;return function(_0x2768bf){logger[_0x4afc('0xd')](_0x2768bf[_0x4afc('0xe')]);if(_0x2768bf[_0x4afc('0xf')]){delete _0x2768bf[_0x4afc('0xf')];}_0x3fb54a['status'](_0x2b191c)[_0x4afc('0x10')](_0x2768bf);};}exports[_0x4afc('0x11')]=function(_0x2c636b,_0x1e2c31){var _0x5f2dc9=['mail',_0x4afc('0x12'),'sms',_0x4afc('0x13'),_0x4afc('0x14'),_0x4afc('0x15'),_0x4afc('0x16')];var _0x3a306f={'count':0x0,'rows':[]},_0x3ebdc8={},_0x22f809;Promise[_0x4afc('0x17')]()[_0x4afc('0x18')](function(){if(_0x2c636b[_0x4afc('0x19')][_0x4afc('0x1a')]){if(!_['includes'](_0x5f2dc9,_0x2c636b[_0x4afc('0x19')][_0x4afc('0x1a')][_0x4afc('0x1b')]()))throw new Error(_0x4afc('0x1c'));_0x22f809=_0x2c636b['query'][_0x4afc('0x1a')][_0x4afc('0x1b')]();}var _0x2de6e9=_[_0x4afc('0x1d')](_0x22f809)+_0x4afc('0x1e');var _0x3add4c=_[_0x4afc('0x1f')](db[_0x2de6e9]['rawAttributes'],function(_0x5403e4){return{'name':_0x5403e4[_0x4afc('0x20')],'type':_0x5403e4['type'][_0x4afc('0x21')]};});_0x3ebdc8=qs['getOptions'](_0x3add4c,_0x2c636b);if(_0x2c636b[_0x4afc('0x22')][_0x4afc('0x23')]===_0x4afc('0x22')){var _0x2876f2={'params':{'id':_0x2c636b[_0x4afc('0x22')][_0x4afc('0x24')]},'query':{'section':_0x22f809===_0x4afc('0x16')&&_0x2c636b[_0x4afc('0x19')][_0x4afc('0x25')]===_0x4afc('0x26')?_0x4afc('0x27'):_[_0x4afc('0x1d')](_0x22f809)+_0x4afc('0x28'),'type':_0x2c636b['query'][_0x4afc('0x25')],'nolimit':!![],'sort':_0x4afc('0xf'),'filter':_0x2c636b[_0x4afc('0x19')]['filter']}};return db['UserProfile']['getResources'](_0x2876f2);}return db[_0x2de6e9][_0x4afc('0x29')](_0x3ebdc8);})[_0x4afc('0x18')](function(_0x5e4747){_0x3a306f[_0x4afc('0x8')]=_0x5e4747[_0x4afc('0x8')];var _0x494fe7=_0x22f809==='voice'?client:routingClient;return _0x494fe7['request'](_[_0x4afc('0x1d')](_0x22f809)+_0x4afc('0x28'),_0x2c636b)[_0x4afc('0x18')](function(_0x46357b){if(_0x46357b[_0x4afc('0xd')])throw new Error(util[_0x4afc('0x2a')]('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x22f809));var _0x290391=_0x46357b[_0x4afc('0x2b')];var _0x1ba6b5=[_0x4afc('0x2c'),_0x4afc('0x2d'),_0x4afc('0x2e'),_0x4afc('0x2f'),_0x4afc('0x30')];if(_0x22f809==='voice'&&_0x2c636b[_0x4afc('0x19')]['type']==='outbound'){_0x1ba6b5[_0x4afc('0x31')](_0x4afc('0x32'),_0x4afc('0x33'),_0x4afc('0x34'),_0x4afc('0x35'),_0x4afc('0x36'),'Trunk',_0x4afc('0x37'),_0x4afc('0x38'),_0x4afc('0x39'),_0x4afc('0x3a'),_0x4afc('0x3b'),_0x4afc('0x3c'),'dialPredictiveInterval',_0x4afc('0x3d'),_0x4afc('0x3e'),_0x4afc('0x3f'),_0x4afc('0x40'),'predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout',_0x4afc('0x41'),_0x4afc('0x42'),_0x4afc('0x43'));}var _0x5edfe1=_0x5e4747['rows'][_0x4afc('0x1f')](function(_0x4a06cf){var _0x5947bb=_0x4a06cf[_0x4afc('0x44')]({'plain':!![]});_0x5947bb[_0x4afc('0x30')]=0x0;_0x5947bb[_0x4afc('0x45')]=0x0;_0x5947bb[_0x4afc('0x2c')]=0x0;_0x5947bb[_0x4afc('0x2d')]=0x0;_0x5947bb[_0x4afc('0x30')]=0x0;_0x5947bb[_0x4afc('0x2e')]=0x0;if(_0x22f809===_0x4afc('0x16')){_0x5947bb[_0x4afc('0x2f')]=0x0;if(_0x2c636b[_0x4afc('0x19')][_0x4afc('0x25')]===_0x4afc('0x26')){_0x5947bb[_0x4afc('0x32')]=0x0;_0x5947bb[_0x4afc('0x33')]=0x0;}}_0x5947bb[_0x4afc('0x46')]=[];var _0x5589be=_[_0x4afc('0x47')](_0x290391[_0x4afc('0x48')],['id',_0x5947bb['id']]);if(_0x5589be)_[_0x4afc('0x49')](_0x5947bb,_[_0x4afc('0x4a')](_0x5589be,_0x1ba6b5));if(_0x22f809===_0x4afc('0x16')){return _0x4a06cf[_0x4afc('0x4b')]({'attributes':['id',_0x4afc('0xf'),'online'],'joinTableAttributes':[],'raw':!![]})['then'](function(_0x5ee5d7){return _0x4a06cf[_0x4afc('0x4c')]({'raw':!![]})[_0x4afc('0x18')](function(_0x5c515a){for(var _0xe62748=0x0;_0xe62748<_0x5ee5d7[_0x4afc('0x4d')];_0xe62748++){var _0x8ba5e6=_[_0x4afc('0x47')](_0x5c515a,['UserId',_0x5ee5d7[_0xe62748]['id']]);var _0x12b5db={'id':_0x5ee5d7[_0xe62748]['id'],'name':_0x5ee5d7[_0xe62748][_0x4afc('0xf')],'online':Boolean(_0x5ee5d7[_0xe62748][_0x4afc('0x4e')]),'paused':_0x8ba5e6?Boolean(_0x8ba5e6[_0x4afc('0x30')]):![]};if(_0x12b5db[_0x4afc('0x4e')])_0x5947bb[_0x4afc('0x45')]++;if(_0x12b5db['paused'])_0x5947bb[_0x4afc('0x30')]++;_0x5947bb['agents'][_0x4afc('0x31')](_0x12b5db);}return _0x5947bb;});});}else{var _0x33117f=_0x4afc('0x4f')+_['startCase'](_0x22f809)+'Queue';var _0x366eac=_0x22f809+_0x4afc('0x50');return db[_0x33117f][_0x4afc('0x51')]({'where':{[_[_0x4afc('0x1d')](_0x22f809)+_0x4afc('0x52')]:_0x4a06cf['id']},'raw':!![]})[_0x4afc('0x18')](function(_0x42ecb6){return db[_0x4afc('0x4f')]['findAll']({'attributes':['id',_0x4afc('0xf'),_0x4afc('0x4e'),_0x366eac],'where':{'id':_['map'](_0x42ecb6,_0x4afc('0x53')),'role':'agent'},'raw':!![]});})[_0x4afc('0x18')](function(_0x24a731){for(var _0x16c6c4=0x0;_0x16c6c4<_0x24a731['length'];_0x16c6c4++){var _0xd0f517={'id':_0x24a731[_0x16c6c4]['id'],'name':_0x24a731[_0x16c6c4][_0x4afc('0xf')],'online':Boolean(_0x24a731[_0x16c6c4][_0x4afc('0x4e')]),'paused':Boolean(_0x24a731[_0x16c6c4][_0x366eac])};if(_0xd0f517[_0x4afc('0x4e')])_0x5947bb[_0x4afc('0x45')]++;if(_0xd0f517[_0x4afc('0x30')])_0x5947bb['paused']++;_0x5947bb['agents']['push'](_0xd0f517);}return _0x5947bb;});}});return Promise[_0x4afc('0x54')](_0x5edfe1);});})[_0x4afc('0x18')](function(_0x42e274){_0x3a306f[_0x4afc('0x48')]=_0x42e274;return _0x3a306f;})[_0x4afc('0x18')](respondWithFilteredResult(_0x1e2c31,_0x3ebdc8))[_0x4afc('0x55')](handleError(_0x1e2c31,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 4c42966..ef81e3f 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x2ee822,_0x4c15ab){var _0x3df987=function(_0x29e89a){while(--_0x29e89a){_0x2ee822['push'](_0x2ee822['shift']());}};_0x3df987(++_0x4c15ab);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x54e375,_0x36e6b4){var _0x582c74=function(_0x75e3a3){while(--_0x75e3a3){_0x54e375['push'](_0x54e375['shift']());}};_0x582c74(++_0x36e6b4);}(_0xe706,0xa3));var _0x6e70=function(_0x171ca9,_0x2bb32d){_0x171ca9=_0x171ca9-0x0;var _0x31668f=_0xe706[_0x171ca9];return _0x31668f;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 482505f..b3ae0eb 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 _0x39e6=['STRING','DATE','sequelize','INTEGER'];(function(_0x498e13,_0x220de6){var _0x5d2ddf=function(_0xfd9d02){while(--_0xfd9d02){_0x498e13['push'](_0x498e13['shift']());}};_0x5d2ddf(++_0x220de6);}(_0x39e6,0x9e));var _0x639e=function(_0xbcc9e2,_0x10e91e){_0xbcc9e2=_0xbcc9e2-0x0;var _0x378805=_0x39e6[_0xbcc9e2];return _0x378805;};'use strict';var Sequelize=require(_0x639e('0x0'));module['exports']={'state':{'type':Sequelize[_0x639e('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x639e('0x2')]},'starttime':{'type':Sequelize[_0x639e('0x3')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x639e('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x639e('0x2')]},'campaigntype':{'type':Sequelize[_0x639e('0x2')]},'membername':{'type':Sequelize[_0x639e('0x2')]}}; \ No newline at end of file +var _0x12e9=['INTEGER','DATE','STRING'];(function(_0x5dff66,_0x3ca5d0){var _0x214295=function(_0x5489d5){while(--_0x5489d5){_0x5dff66['push'](_0x5dff66['shift']());}};_0x214295(++_0x3ca5d0);}(_0x12e9,0x66));var _0x912e=function(_0xee70c2,_0x312884){_0xee70c2=_0xee70c2-0x0;var _0x519299=_0x12e9[_0xee70c2];return _0x519299;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize[_0x912e('0x0')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x912e('0x1')]},'uniqueid':{'type':Sequelize[_0x912e('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x912e('0x1')]},'ringtime':{'type':Sequelize[_0x912e('0x0')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x912e('0x2')]},'membername':{'type':Sequelize[_0x912e('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index c144462..d4e9d77 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 _0xbbbb=['moment','bluebird','request-promise','rimraf','./reportAgentPreview.attributes','define','ReportAgentPreview','lodash','util','../../config/logger','api'];(function(_0x4eb926,_0x1a4b89){var _0x273a87=function(_0x3ba51b){while(--_0x3ba51b){_0x4eb926['push'](_0x4eb926['shift']());}};_0x273a87(++_0x1a4b89);}(_0xbbbb,0x10f));var _0xbbbb=function(_0x57b8e3,_0x5c5f53){_0x57b8e3=_0x57b8e3-0x0;var _0x3ac4c6=_0xbbbb[_0x57b8e3];return _0x3ac4c6;};'use strict';var _=require(_0xbbbb('0x0'));var util=require(_0xbbbb('0x1'));var logger=require(_0xbbbb('0x2'))(_0xbbbb('0x3'));var moment=require(_0xbbbb('0x4'));var BPromise=require(_0xbbbb('0x5'));var rp=require(_0xbbbb('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbbbb('0x7'));var config=require('../../config/environment');var attributes=require(_0xbbbb('0x8'));module['exports']=function(_0x338ba6,_0x1a746d){return _0x338ba6[_0xbbbb('0x9')](_0xbbbb('0xa'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x44fe=['../../config/environment','./reportAgentPreview.attributes','define','ReportAgentPreview','report_agent_preview','lodash','moment','request-promise','path','rimraf'];(function(_0xdfb521,_0x5d7e49){var _0x5c0884=function(_0x53087d){while(--_0x53087d){_0xdfb521['push'](_0xdfb521['shift']());}};_0x5c0884(++_0x5d7e49);}(_0x44fe,0x1a9));var _0xe44f=function(_0x276d1f,_0x2da014){_0x276d1f=_0x276d1f-0x0;var _0x5e5685=_0x44fe[_0x276d1f];return _0x5e5685;};'use strict';var _=require(_0xe44f('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xe44f('0x1'));var BPromise=require('bluebird');var rp=require(_0xe44f('0x2'));var fs=require('fs');var path=require(_0xe44f('0x3'));var rimraf=require(_0xe44f('0x4'));var config=require(_0xe44f('0x5'));var attributes=require(_0xe44f('0x6'));module['exports']=function(_0x10e51f,_0x249525){return _0x10e51f[_0xe44f('0x7')](_0xe44f('0x8'),attributes,{'tableName':_0xe44f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index 939b683..7018b1d 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 _0x13d2=['options','raw','CreateReportAgentPreview','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','ReportAgentPreview,\x20%s,\x20%s','message','result','catch','ReportAgentPreview','create','body'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x13d2,0x15f));var _0x213d=function(_0x165032,_0x3e9eaa){_0x165032=_0x165032-0x0;var _0x23a251=_0x13d2[_0x165032];return _0x23a251;};'use strict';var _=require(_0x213d('0x0'));var util=require(_0x213d('0x1'));var moment=require('moment');var BPromise=require(_0x213d('0x2'));var rs=require(_0x213d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x213d('0x4'))['db'];var utils=require(_0x213d('0x5'));var logger=require(_0x213d('0x6'))('rpc');var config=require(_0x213d('0x7'));var jayson=require(_0x213d('0x8'));var client=jayson['client'][_0x213d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x49d105,_0x21a09c,_0x136920){return new BPromise(function(_0x244976,_0x55a3b6){return client[_0x213d('0xa')](_0x49d105,_0x136920)[_0x213d('0xb')](function(_0x1bc067){logger[_0x213d('0xc')]('ReportAgentPreview,\x20%s,\x20%s',_0x21a09c,_0x213d('0xd'));logger[_0x213d('0xe')](_0x213d('0xf'),_0x21a09c,_0x213d('0xd'),JSON[_0x213d('0x10')](_0x1bc067));if(_0x1bc067[_0x213d('0x11')]){if(_0x1bc067['error'][_0x213d('0x12')]===0x1f4){logger['error'](_0x213d('0x13'),_0x21a09c,_0x1bc067[_0x213d('0x11')][_0x213d('0x14')]);return _0x55a3b6(_0x1bc067[_0x213d('0x11')]['message']);}logger[_0x213d('0x11')](_0x213d('0x13'),_0x21a09c,_0x1bc067[_0x213d('0x11')][_0x213d('0x14')]);return _0x244976(_0x1bc067['error'][_0x213d('0x14')]);}else{logger[_0x213d('0xc')](_0x213d('0x13'),_0x21a09c,_0x213d('0xd'));_0x244976(_0x1bc067[_0x213d('0x15')][_0x213d('0x14')]);}})[_0x213d('0x16')](function(_0x4c09d8){logger[_0x213d('0x11')](_0x213d('0x13'),_0x21a09c,_0x4c09d8);_0x55a3b6(_0x4c09d8);});});}exports['CreateReportAgentPreview']=function(_0x2b7430){var _0x25d4ab=this;return new Promise(function(_0x27772b,_0x2ab87f){return db[_0x213d('0x17')][_0x213d('0x18')](_0x2b7430[_0x213d('0x19')],{'raw':_0x2b7430[_0x213d('0x1a')]?_0x2b7430[_0x213d('0x1a')][_0x213d('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x2a1309){logger[_0x213d('0xc')](_0x213d('0x1c'),_0x2b7430);logger[_0x213d('0xe')](_0x213d('0x1c'),_0x2b7430,JSON[_0x213d('0x10')](_0x2a1309));_0x27772b(_0x2a1309);})[_0x213d('0x16')](function(_0x2d6c41){logger[_0x213d('0x11')](_0x213d('0x1c'),_0x2d6c41[_0x213d('0x14')],_0x2b7430);_0x2ab87f(_0x25d4ab['error'](0x1f4,_0x2d6c41[_0x213d('0x14')]));});});}; \ No newline at end of file +var _0x5533=['request','then','info','ReportAgentPreview,\x20%s,\x20%s','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x489639,_0x18208){var _0x322afa=function(_0x2fbaa1){while(--_0x2fbaa1){_0x489639['push'](_0x489639['shift']());}};_0x322afa(++_0x18208);}(_0x5533,0xf9));var _0x3553=function(_0x2cfa66,_0x394e96){_0x2cfa66=_0x2cfa66-0x0;var _0x49fe74=_0x5533[_0x2cfa66];return _0x49fe74;};'use strict';var _=require(_0x3553('0x0'));var util=require(_0x3553('0x1'));var moment=require(_0x3553('0x2'));var BPromise=require('bluebird');var rs=require(_0x3553('0x3'));var fs=require('fs');var Redis=require(_0x3553('0x4'));var db=require(_0x3553('0x5'))['db'];var utils=require(_0x3553('0x6'));var logger=require(_0x3553('0x7'))(_0x3553('0x8'));var config=require(_0x3553('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3553('0xa')][_0x3553('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x425598,_0x89ee7b,_0x393fce){return new BPromise(function(_0x3cbb8c,_0xc426de){return client[_0x3553('0xc')](_0x425598,_0x393fce)[_0x3553('0xd')](function(_0x3f31aa){logger[_0x3553('0xe')](_0x3553('0xf'),_0x89ee7b,'request\x20sent');logger[_0x3553('0x10')](_0x3553('0x11'),_0x89ee7b,_0x3553('0x12'),JSON['stringify'](_0x3f31aa));if(_0x3f31aa[_0x3553('0x13')]){if(_0x3f31aa[_0x3553('0x13')][_0x3553('0x14')]===0x1f4){logger['error'](_0x3553('0xf'),_0x89ee7b,_0x3f31aa[_0x3553('0x13')][_0x3553('0x15')]);return _0xc426de(_0x3f31aa['error'][_0x3553('0x15')]);}logger['error'](_0x3553('0xf'),_0x89ee7b,_0x3f31aa[_0x3553('0x13')][_0x3553('0x15')]);return _0x3cbb8c(_0x3f31aa[_0x3553('0x13')][_0x3553('0x15')]);}else{logger['info'](_0x3553('0xf'),_0x89ee7b,_0x3553('0x12'));_0x3cbb8c(_0x3f31aa['result'][_0x3553('0x15')]);}})[_0x3553('0x16')](function(_0x5c5778){logger['error'](_0x3553('0xf'),_0x89ee7b,_0x5c5778);_0xc426de(_0x5c5778);});});}exports[_0x3553('0x17')]=function(_0x4d301e){var _0x407f11=this;return new Promise(function(_0x305cdb,_0x16b224){return db[_0x3553('0x18')][_0x3553('0x19')](_0x4d301e[_0x3553('0x1a')],{'raw':_0x4d301e[_0x3553('0x1b')]?_0x4d301e[_0x3553('0x1b')][_0x3553('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x197f18){logger[_0x3553('0xe')](_0x3553('0x17'),_0x4d301e);logger[_0x3553('0x10')]('CreateReportAgentPreview',_0x4d301e,JSON['stringify'](_0x197f18));_0x305cdb(_0x197f18);})[_0x3553('0x16')](function(_0x3ab0d6){logger[_0x3553('0x13')](_0x3553('0x17'),_0x3ab0d6[_0x3553('0x15')],_0x4d301e);_0x16b224(_0x407f11[_0x3553('0x13')](0x1f4,_0x3ab0d6['message']));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index b052ccb..c5564d6 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 _0xc060=['/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','post','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','/agents/:id/notify','agentNotify','multer','path','express','Router','../../components/auth/service','./rpc.controller','get','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','isAuthenticated','voiceChannelStopMixMonitor','voiceQueues','/chat/queues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','whatsappQueues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','/campaigns','campaigns','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions'];(function(_0xb53767,_0x3f98c7){var _0x5b0308=function(_0x3070d3){while(--_0x3070d3){_0xb53767['push'](_0xb53767['shift']());}};_0x5b0308(++_0x3f98c7);}(_0xc060,0xca));var _0x0c06=function(_0x8f3afd,_0x5b9358){_0x8f3afd=_0x8f3afd-0x0;var _0x48e041=_0xc060[_0x8f3afd];return _0x48e041;};'use strict';var multer=require(_0x0c06('0x0'));var util=require('util');var path=require(_0x0c06('0x1'));var express=require(_0x0c06('0x2'));var router=express[_0x0c06('0x3')]();var auth=require(_0x0c06('0x4'));var controller=require(_0x0c06('0x5'));router[_0x0c06('0x6')]('/voice/channels',auth['isAuthenticated'](),controller[_0x0c06('0x7')]);router[_0x0c06('0x6')](_0x0c06('0x8'),auth['isAuthenticated'](),controller[_0x0c06('0x9')]);router['get'](_0x0c06('0xa'),auth[_0x0c06('0xb')](),controller[_0x0c06('0xc')]);router[_0x0c06('0x6')]('/voice/queues',auth[_0x0c06('0xb')](),controller[_0x0c06('0xd')]);router[_0x0c06('0x6')](_0x0c06('0xe'),auth[_0x0c06('0xb')](),controller['chatQueues']);router[_0x0c06('0x6')](_0x0c06('0xf'),auth[_0x0c06('0xb')](),controller[_0x0c06('0x10')]);router[_0x0c06('0x6')](_0x0c06('0x11'),auth[_0x0c06('0xb')](),controller[_0x0c06('0x12')]);router['get'](_0x0c06('0x13'),auth[_0x0c06('0xb')](),controller[_0x0c06('0x14')]);router[_0x0c06('0x6')](_0x0c06('0x15'),auth[_0x0c06('0xb')](),controller[_0x0c06('0x16')]);router['get']('/whatsapp/queues',auth[_0x0c06('0xb')](),controller[_0x0c06('0x17')]);router['get']('/fax/queues',auth['isAuthenticated'](),controller[_0x0c06('0x18')]);router['get'](_0x0c06('0x19'),auth[_0x0c06('0xb')](),controller[_0x0c06('0x1a')]);router[_0x0c06('0x6')](_0x0c06('0x1b'),auth[_0x0c06('0xb')](),controller[_0x0c06('0x1c')]);router[_0x0c06('0x6')](_0x0c06('0x1d'),auth['isAuthenticated'](),controller[_0x0c06('0x1e')]);router['get'](_0x0c06('0x1f'),auth[_0x0c06('0xb')](),controller['voiceQueuesChannelHangup']);router['get'](_0x0c06('0x20'),auth[_0x0c06('0xb')](),controller[_0x0c06('0x21')]);router[_0x0c06('0x6')](_0x0c06('0x22'),auth['isAuthenticated'](),controller[_0x0c06('0x23')]);router[_0x0c06('0x24')](_0x0c06('0x22'),auth[_0x0c06('0xb')](),controller[_0x0c06('0x25')]);router[_0x0c06('0x6')](_0x0c06('0x26'),auth[_0x0c06('0xb')](),controller[_0x0c06('0x27')]);router[_0x0c06('0x6')](_0x0c06('0x28'),auth[_0x0c06('0xb')](),controller[_0x0c06('0x29')]);router[_0x0c06('0x6')](_0x0c06('0x2a'),auth[_0x0c06('0xb')](),controller[_0x0c06('0x2b')]);router[_0x0c06('0x24')](_0x0c06('0x2c'),auth[_0x0c06('0xb')](),controller[_0x0c06('0x2d')]);router[_0x0c06('0x6')](_0x0c06('0x2e'),auth[_0x0c06('0xb')](),controller[_0x0c06('0x2f')]);router[_0x0c06('0x6')](_0x0c06('0x30'),auth[_0x0c06('0xb')](),controller['trunks']);router['get'](_0x0c06('0x31'),auth[_0x0c06('0xb')](),controller[_0x0c06('0x32')]);router[_0x0c06('0x6')]('/fax/accounts',auth[_0x0c06('0xb')](),controller[_0x0c06('0x33')]);router[_0x0c06('0x6')](_0x0c06('0x34'),auth['isAuthenticated'](),controller[_0x0c06('0x35')]);router[_0x0c06('0x6')](_0x0c06('0x36'),auth['isAuthenticated'](),controller[_0x0c06('0x37')]);router['get'](_0x0c06('0x38'),auth[_0x0c06('0xb')](),controller[_0x0c06('0x39')]);router['get'](_0x0c06('0x3a'),auth[_0x0c06('0xb')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0x0c06('0x6')](_0x0c06('0x3b'),auth['isAuthenticated'](),controller[_0x0c06('0x3c')]);router[_0x0c06('0x6')](_0x0c06('0x3d'),auth[_0x0c06('0xb')](),controller[_0x0c06('0x3e')]);router[_0x0c06('0x6')]('/fax/queues/waitinginteractions',auth[_0x0c06('0xb')](),controller['faxQueuesWaitingInteractions']);router[_0x0c06('0x3f')]('/mail/queues/:id/notify',auth['isAuthenticated'](),controller[_0x0c06('0x40')](_0x0c06('0x41')));router[_0x0c06('0x6')](_0x0c06('0x42'),auth[_0x0c06('0xb')](),controller[_0x0c06('0x43')]);router[_0x0c06('0x3f')](_0x0c06('0x44'),auth['isAuthenticated'](),controller['queueNotify'](_0x0c06('0x45')));router[_0x0c06('0x6')](_0x0c06('0x46'),auth['isAuthenticated'](),controller[_0x0c06('0x47')]);router[_0x0c06('0x3f')](_0x0c06('0x48'),auth['isAuthenticated'](),controller['queueNotify'](_0x0c06('0x49')));router[_0x0c06('0x6')](_0x0c06('0x4a'),auth[_0x0c06('0xb')](),controller[_0x0c06('0x4b')]);router[_0x0c06('0x3f')](_0x0c06('0x4c'),auth[_0x0c06('0xb')](),controller['queueNotify'](_0x0c06('0x4d')));router[_0x0c06('0x6')](_0x0c06('0x4e'),auth[_0x0c06('0xb')](),controller['showOpenchannelQueues']);router['post'](_0x0c06('0x4f'),auth[_0x0c06('0xb')](),controller[_0x0c06('0x40')]('sms'));router['post']('/whatsapp/queues/:id/notify',auth[_0x0c06('0xb')](),controller[_0x0c06('0x40')](_0x0c06('0x50')));router[_0x0c06('0x6')](_0x0c06('0x51'),auth['isAuthenticated'](),controller[_0x0c06('0x52')]);router[_0x0c06('0x6')](_0x0c06('0x53'),auth['isAuthenticated'](),controller['showWhatsappQueues']);router['post'](_0x0c06('0x54'),auth[_0x0c06('0xb')](),controller[_0x0c06('0x55')]);module['exports']=router; \ No newline at end of file +var _0x31f9=['/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','voiceQueuesChannelHangup','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','agents','agentCapacity','/telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','queueNotify','mail','/mail/queues/:id','/chat/queues/:id/notify','chat','/fax/queues/:id/notify','fax','showFaxQueues','/openchannel/queues/:id/notify','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','exports','util','../../components/auth/service','get','/voice/channels','voiceChannels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor','voiceChannelStopMixMonitor','/voice/queues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','whatsappQueues','/fax/queues','faxQueues'];(function(_0x4fb62a,_0x3b8a9f){var _0x146a67=function(_0x167c72){while(--_0x167c72){_0x4fb62a['push'](_0x4fb62a['shift']());}};_0x146a67(++_0x3b8a9f);}(_0x31f9,0x87));var _0x931f=function(_0x518393,_0x3041f2){_0x518393=_0x518393-0x0;var _0x4141ff=_0x31f9[_0x518393];return _0x4141ff;};'use strict';var multer=require('multer');var util=require(_0x931f('0x0'));var path=require('path');var express=require('express');var router=express['Router']();var auth=require(_0x931f('0x1'));var controller=require('./rpc.controller');router[_0x931f('0x2')](_0x931f('0x3'),auth['isAuthenticated'](),controller[_0x931f('0x4')]);router[_0x931f('0x2')](_0x931f('0x5'),auth[_0x931f('0x6')](),controller[_0x931f('0x7')]);router['get']('/voice/channels/:uniqueid/stopmixmonitor',auth['isAuthenticated'](),controller[_0x931f('0x8')]);router[_0x931f('0x2')](_0x931f('0x9'),auth[_0x931f('0x6')](),controller['voiceQueues']);router['get'](_0x931f('0xa'),auth[_0x931f('0x6')](),controller[_0x931f('0xb')]);router[_0x931f('0x2')](_0x931f('0xc'),auth['isAuthenticated'](),controller[_0x931f('0xd')]);router[_0x931f('0x2')](_0x931f('0xe'),auth[_0x931f('0x6')](),controller[_0x931f('0xf')]);router['get'](_0x931f('0x10'),auth[_0x931f('0x6')](),controller[_0x931f('0x11')]);router[_0x931f('0x2')](_0x931f('0x12'),auth['isAuthenticated'](),controller[_0x931f('0x13')]);router[_0x931f('0x2')]('/whatsapp/queues',auth[_0x931f('0x6')](),controller[_0x931f('0x14')]);router['get'](_0x931f('0x15'),auth[_0x931f('0x6')](),controller[_0x931f('0x16')]);router[_0x931f('0x2')](_0x931f('0x17'),auth[_0x931f('0x6')](),controller[_0x931f('0x18')]);router[_0x931f('0x2')](_0x931f('0x19'),auth[_0x931f('0x6')](),controller[_0x931f('0x1a')]);router[_0x931f('0x2')](_0x931f('0x1b'),auth[_0x931f('0x6')](),controller[_0x931f('0x1c')]);router[_0x931f('0x2')]('/voice/queues/channels/:uniqueid/hangup',auth[_0x931f('0x6')](),controller[_0x931f('0x1d')]);router[_0x931f('0x2')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x931f('0x6')](),controller['voiceQueuesChannelRedirect']);router['get'](_0x931f('0x1e'),auth[_0x931f('0x6')](),controller[_0x931f('0x1f')]);router[_0x931f('0x20')](_0x931f('0x1e'),auth[_0x931f('0x6')](),controller[_0x931f('0x21')]);router[_0x931f('0x2')](_0x931f('0x22'),auth[_0x931f('0x6')](),controller[_0x931f('0x23')]);router[_0x931f('0x2')](_0x931f('0x24'),auth[_0x931f('0x6')](),controller[_0x931f('0x25')]);router[_0x931f('0x2')]('/agents',auth[_0x931f('0x6')](),controller[_0x931f('0x26')]);router['put']('/agents/:id/capacity',auth['isAuthenticated'](),controller[_0x931f('0x27')]);router['get'](_0x931f('0x28'),auth[_0x931f('0x6')](),controller['telephones']);router[_0x931f('0x2')](_0x931f('0x29'),auth[_0x931f('0x6')](),controller[_0x931f('0x2a')]);router[_0x931f('0x2')](_0x931f('0x2b'),auth[_0x931f('0x6')](),controller[_0x931f('0x2c')]);router['get'](_0x931f('0x2d'),auth[_0x931f('0x6')](),controller[_0x931f('0x2e')]);router[_0x931f('0x2')](_0x931f('0x2f'),auth[_0x931f('0x6')](),controller[_0x931f('0x30')]);router['get'](_0x931f('0x31'),auth[_0x931f('0x6')](),controller[_0x931f('0x32')]);router[_0x931f('0x2')]('/openchannel/queues/waitinginteractions',auth[_0x931f('0x6')](),controller[_0x931f('0x33')]);router['get'](_0x931f('0x34'),auth[_0x931f('0x6')](),controller[_0x931f('0x35')]);router[_0x931f('0x2')]('/sms/queues/waitinginteractions',auth['isAuthenticated'](),controller['smsQueuesWaitingInteractions']);router[_0x931f('0x2')](_0x931f('0x36'),auth[_0x931f('0x6')](),controller[_0x931f('0x37')]);router[_0x931f('0x2')](_0x931f('0x38'),auth[_0x931f('0x6')](),controller[_0x931f('0x39')]);router[_0x931f('0x3a')]('/mail/queues/:id/notify',auth[_0x931f('0x6')](),controller[_0x931f('0x3b')](_0x931f('0x3c')));router[_0x931f('0x2')](_0x931f('0x3d'),auth[_0x931f('0x6')](),controller['showMailQueues']);router[_0x931f('0x3a')](_0x931f('0x3e'),auth[_0x931f('0x6')](),controller[_0x931f('0x3b')](_0x931f('0x3f')));router[_0x931f('0x2')]('/chat/queues/:id',auth[_0x931f('0x6')](),controller['showChatQueues']);router['post'](_0x931f('0x40'),auth[_0x931f('0x6')](),controller[_0x931f('0x3b')](_0x931f('0x41')));router[_0x931f('0x2')]('/fax/queues/:id',auth['isAuthenticated'](),controller[_0x931f('0x42')]);router[_0x931f('0x3a')](_0x931f('0x43'),auth[_0x931f('0x6')](),controller[_0x931f('0x3b')]('openchannel'));router[_0x931f('0x2')](_0x931f('0x44'),auth['isAuthenticated'](),controller[_0x931f('0x45')]);router[_0x931f('0x3a')](_0x931f('0x46'),auth[_0x931f('0x6')](),controller['queueNotify']('sms'));router['post'](_0x931f('0x47'),auth['isAuthenticated'](),controller[_0x931f('0x3b')](_0x931f('0x48')));router[_0x931f('0x2')](_0x931f('0x49'),auth[_0x931f('0x6')](),controller[_0x931f('0x4a')]);router['get'](_0x931f('0x4b'),auth[_0x931f('0x6')](),controller[_0x931f('0x4c')]);router['post']('/agents/:id/notify',auth[_0x931f('0x6')](),controller[_0x931f('0x4d')]);module[_0x931f('0x4e')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index a88a979..3d5f717 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 _0xa41a=['name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','merge','params','catch','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','VoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','VoiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','Agents','agentCapacity','interaction','hasOwnProperty','MemberReport','findAll','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','findOrCreate','user','INTERACTION','interface','SIP/%s','agent','AgentCapacity','capacity','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','showMailQueues','MailQueues','mailAccounts','OpenchannelQueues','showOpenchannelQueues','SmsQueues','showSmsQueues','whatsappQueues','showWhatsappQueues','WhatsappQueues','FaxQueues','showFaxQueues','faxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','value','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Queue','findOne','\x20Queue\x20not\x20found','Interaction','update','MessageId','From','Account','QueueId','TransferReport','create','Start','queue','queueTransferTimeout','agentNotify','Channel\x20field\x20is\x20mandatory','channel','User','Agent\x20not\x20found','Message','messageId','\x20Message\x20not\x20found','agentTransferTimeout','*,*,*,*','bluebird','moment','util','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','result','status','json','sendStatus','stack'];(function(_0x2334e3,_0x3c38ba){var _0x32cd73=function(_0x583faa){while(--_0x583faa){_0x2334e3['push'](_0x2334e3['shift']());}};_0x32cd73(++_0x3c38ba);}(_0xa41a,0x6b));var _0xaa41=function(_0x3de6e4,_0x14937d){_0x3de6e4=_0x3de6e4-0x0;var _0x35e4c2=_0xa41a[_0x3de6e4];return _0x35e4c2;};'use strict';var BPromise=require(_0xaa41('0x0'));var moment=require(_0xaa41('0x1'));var _=require('lodash');var util=require(_0xaa41('0x2'));var db=require(_0xaa41('0x3'))['db'];var logger=require(_0xaa41('0x4'))(_0xaa41('0x5'));var jayson=require(_0xaa41('0x6'));var amiClient=jayson[_0xaa41('0x7')][_0xaa41('0x8')]({'port':0x232a});var mailClient=jayson[_0xaa41('0x7')]['http']({'port':0x232b});var routingClient=jayson[_0xaa41('0x7')][_0xaa41('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x54bc5a,_0x5b1fff,_0x179545){return new BPromise(function(_0x202cce,_0x588ab4){var _0x31df43=_0x179545?_0x179545:amiClient;return _0x31df43[_0xaa41('0x9')](_0x54bc5a,_0x5b1fff)[_0xaa41('0xa')](function(_0x1cc344){if(_0x1cc344[_0xaa41('0xb')]){if(_0x1cc344[_0xaa41('0xb')][_0xaa41('0xc')]===0x1f4){return _0x588ab4(_0x1cc344[_0xaa41('0xb')][_0xaa41('0xd')]);}return _0x202cce(_0x1cc344['error'][_0xaa41('0xd')]);}else{_0x202cce(_0x1cc344[_0xaa41('0xe')]);}})['catch'](function(_0x54827c){_0x588ab4(_0x54827c);});});}function respondWithResult(_0x1d0a54,_0x518b5b){_0x518b5b=_0x518b5b||0xc8;return function(_0x19bd69){if(_0x19bd69){return _0x1d0a54[_0xaa41('0xf')](_0x518b5b)[_0xaa41('0x10')](_0x19bd69);}return _0x1d0a54[_0xaa41('0x11')](0x194);};}function handleError(_0x6f9ade,_0x4eaf81){_0x4eaf81=_0x4eaf81||0x1f4;return function(_0x1e9d7f){logger[_0xaa41('0xb')](_0x1e9d7f[_0xaa41('0x12')]);if(_0x1e9d7f[_0xaa41('0x13')]){delete _0x1e9d7f[_0xaa41('0x13')];}_0x6f9ade[_0xaa41('0xf')](_0x4eaf81)[_0xaa41('0x14')](_0x1e9d7f);};}function findById(_0x550ad5){return function(_0x2d868a){if(!_[_0xaa41('0x15')](_0x550ad5)&&!_[_0xaa41('0x15')](_0x2d868a)&&!_[_0xaa41('0x15')](_0x2d868a[_0xaa41('0x16')])){return _[_0xaa41('0x17')](_0x2d868a[_0xaa41('0x16')],function(_0x46e6d3){return _0x46e6d3['id']==_0x550ad5;});}return null;};}exports[_0xaa41('0x18')]=function(_0x4fe1a4,_0x5cd936){return respondWithRpcPromise(_0xaa41('0x19'),_0x4fe1a4[_0xaa41('0x1a')])[_0xaa41('0xa')](respondWithResult(_0x5cd936,null))['catch'](handleError(_0x5cd936,null));};exports[_0xaa41('0x1b')]=function(_0x1f692b,_0x4e768e){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0xaa41('0x1c')](_0x1f692b['query'],_0x1f692b[_0xaa41('0x1d')]))[_0xaa41('0xa')](respondWithResult(_0x4e768e,null))[_0xaa41('0x1e')](handleError(_0x4e768e,null));};exports[_0xaa41('0x1f')]=function(_0x1d623c,_0x4eb01f){return respondWithRpcPromise(_0xaa41('0x20'),_[_0xaa41('0x1c')](_0x1d623c[_0xaa41('0x1a')],_0x1d623c[_0xaa41('0x1d')]))[_0xaa41('0xa')](respondWithResult(_0x4eb01f,null))[_0xaa41('0x1e')](handleError(_0x4eb01f,null));};exports['voiceQueues']=function(_0x5795f4,_0x16aec5){return respondWithRpcPromise('VoiceQueues',_0x5795f4['query'])[_0xaa41('0xa')](respondWithResult(_0x16aec5,null))['catch'](handleError(_0x16aec5,null));};exports['showVoiceQueues']=function(_0x2d0ac0,_0x9c8c21){return respondWithRpcPromise(_0xaa41('0x21'),_0x2d0ac0[_0xaa41('0x1a')])[_0xaa41('0xa')](findById(_0x2d0ac0[_0xaa41('0x1d')]['id']))['then'](respondWithResult(_0x9c8c21,null))[_0xaa41('0x1e')](handleError(_0x9c8c21,null));};exports[_0xaa41('0x22')]=function(_0x63c18c,_0x9a16e3){return respondWithRpcPromise(_0xaa41('0x23'),_[_0xaa41('0x1c')](_0x63c18c[_0xaa41('0x24')],_0x63c18c[_0xaa41('0x1d')]))['then'](respondWithResult(_0x9a16e3,null))[_0xaa41('0x1e')](handleError(_0x9a16e3,null));};exports['voiceQueuesPreview']=function(_0x5dad80,_0x714537){return respondWithRpcPromise(_0xaa41('0x25'),_['merge'](_0x5dad80[_0xaa41('0x1a')],_0x5dad80[_0xaa41('0x1d')]))['then'](respondWithResult(_0x714537,null))['catch'](handleError(_0x714537,null));};exports['voiceQueuesChannels']=function(_0x1cf3da,_0x2f5cc0){return respondWithRpcPromise(_0xaa41('0x26'),_0x1cf3da[_0xaa41('0x1a')])['then'](respondWithResult(_0x2f5cc0,null))[_0xaa41('0x1e')](handleError(_0x2f5cc0,null));};exports[_0xaa41('0x27')]=function(_0x3e0204,_0x4de770){return respondWithRpcPromise(_0xaa41('0x28'),_[_0xaa41('0x1c')](_0x3e0204[_0xaa41('0x1a')],_0x3e0204['params']))[_0xaa41('0xa')](respondWithResult(_0x4de770,null))[_0xaa41('0x1e')](handleError(_0x4de770,null));};exports['voiceQueuesChannelHangup']=function(_0x23eb50,_0x13b6d4){return respondWithRpcPromise(_0xaa41('0x29'),_['merge'](_0x23eb50[_0xaa41('0x1a')],_0x23eb50['params']))[_0xaa41('0xa')](respondWithResult(_0x13b6d4,null))[_0xaa41('0x1e')](handleError(_0x13b6d4,null));};exports[_0xaa41('0x2a')]=function(_0x49b77a,_0x526377){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0xaa41('0x1c')](_0x49b77a[_0xaa41('0x1a')],_0x49b77a[_0xaa41('0x1d')]))[_0xaa41('0xa')](respondWithResult(_0x526377,null))['catch'](handleError(_0x526377,null));};exports['outbound']=function(_0x267999,_0x5673c){return respondWithRpcPromise(_0xaa41('0x2b'),_0x267999[_0xaa41('0x1a')])[_0xaa41('0xa')](respondWithResult(_0x5673c,null))[_0xaa41('0x1e')](handleError(_0x5673c,null));};exports[_0xaa41('0x2c')]=function(_0x5e9879,_0x3adc28){return respondWithRpcPromise(_0xaa41('0x2d'),_0x5e9879[_0xaa41('0x1a')])[_0xaa41('0xa')](respondWithResult(_0x3adc28,null))['catch'](handleError(_0x3adc28,null));};exports['agents']=function(_0x42b759,_0x275fa3){var _0x5eae08;return respondWithRpcPromise(_0xaa41('0x2e'),_0x42b759['query'])[_0xaa41('0xa')](function(_0x25f2df){_0x5eae08=_0x25f2df;return respondWithRpcPromise(_0xaa41('0x2e'),_0x42b759[_0xaa41('0x1a')],routingClient);})[_0xaa41('0xa')](function(_0x12ba1a){return _[_0xaa41('0x1c')]({},_0x12ba1a,_0x5eae08);})[_0xaa41('0xa')](respondWithResult(_0x275fa3,null))['catch'](handleError(_0x275fa3,null));};exports[_0xaa41('0x2f')]=function(_0x2abf39,_0x35c685){if(_0x2abf39[_0xaa41('0x24')]&&_0x2abf39[_0xaa41('0x24')][_0xaa41('0x30')]&&_0x2abf39['user']&&_0x2abf39['user'][_0xaa41('0x13')]){for(var _0x4f9086 in _0x2abf39[_0xaa41('0x24')][_0xaa41('0x30')]){if(_0x2abf39[_0xaa41('0x24')][_0xaa41('0x30')][_0xaa41('0x31')](_0x4f9086)){db[_0xaa41('0x32')][_0xaa41('0x33')]({'where':{'channel':_0x4f9086,'membername':_0x2abf39['user'][_0xaa41('0x13')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x2abf39['body'][_0xaa41('0x30')][_0x4f9086]&&_0x2abf39['body']['interaction'][_0x4f9086]['length']?{'$notIn':_0x2abf39[_0xaa41('0x24')]['interaction'][_0x4f9086]}:{'$ne':null}}})[_0xaa41('0xa')](function(_0x198716){var _0x4a6882=moment()['format'](_0xaa41('0x34'));for(var _0x1b7b97=0x0,_0x1bb973=_0x198716[_0xaa41('0x35')];_0x1b7b97<_0x1bb973;_0x1b7b97+=0x1){_0x198716[_0x1b7b97][_0xaa41('0x36')]({'exitAt':_0x4a6882});}});for(var _0x337993=0x0;_0x337993<_0x2abf39[_0xaa41('0x24')][_0xaa41('0x30')][_0x4f9086][_0xaa41('0x35')];_0x337993+=0x1){db['MemberReport'][_0xaa41('0x37')]({'where':{'channel':_0x4f9086,'membername':_0x2abf39[_0xaa41('0x38')][_0xaa41('0x13')],'type':_0xaa41('0x39'),'uniqueid':_0x2abf39[_0xaa41('0x24')][_0xaa41('0x30')][_0x4f9086][_0x337993],'exitAt':null},'defaults':{'channel':_0x4f9086,'membername':_0x2abf39['user'][_0xaa41('0x13')],'interface':_[_0xaa41('0x15')](_0x2abf39[_0xaa41('0x38')][_0xaa41('0x3a')])?util['format'](_0xaa41('0x3b'),_0x2abf39['user']['name']):_0x2abf39[_0xaa41('0x38')][_0xaa41('0x3a')],'type':_0xaa41('0x39'),'enterAt':moment()['format'](_0xaa41('0x34')),'role':_0xaa41('0x3c'),'internal':_0x2abf39[_0xaa41('0x38')]['internal'],'uniqueid':_0x2abf39[_0xaa41('0x24')][_0xaa41('0x30')][_0x4f9086][_0x337993]}});}}}}return respondWithRpcPromise(_0xaa41('0x3d'),{'id':_0x2abf39[_0xaa41('0x1d')]['id'],'capacity':_0x2abf39[_0xaa41('0x24')][_0xaa41('0x3e')]},routingClient)[_0xaa41('0xa')](respondWithResult(_0x35c685,null))[_0xaa41('0x1e')](handleError(_0x35c685,null));};exports['telephones']=function(_0x9f0a81,_0x5bef5f){return respondWithRpcPromise('Telephones',_0x9f0a81[_0xaa41('0x1a')])[_0xaa41('0xa')](respondWithResult(_0x5bef5f,null))[_0xaa41('0x1e')](handleError(_0x5bef5f,null));};exports[_0xaa41('0x3f')]=function(_0x14aab0,_0x288db3){return respondWithRpcPromise(_0xaa41('0x40'),_0x14aab0[_0xaa41('0x1a')])['then'](respondWithResult(_0x288db3,null))[_0xaa41('0x1e')](handleError(_0x288db3,null));};exports[_0xaa41('0x41')]=function(_0x1d518f,_0x4f9e92){return respondWithRpcPromise(_0xaa41('0x42'),_0x1d518f[_0xaa41('0x1a')])['then'](respondWithResult(_0x4f9e92,null))[_0xaa41('0x1e')](handleError(_0x4f9e92,null));};exports[_0xaa41('0x43')]=function(_0x283b3b,_0x4e5a2e){return respondWithRpcPromise(_0xaa41('0x44'),_0x283b3b[_0xaa41('0x1a')],routingClient)['then'](respondWithResult(_0x4e5a2e,null))['catch'](handleError(_0x4e5a2e,null));};exports[_0xaa41('0x45')]=function(_0x3cd14f,_0x3a29d2){return respondWithRpcPromise('ChatQueues',_0x3cd14f[_0xaa41('0x1a')],routingClient)[_0xaa41('0xa')](findById(_0x3cd14f[_0xaa41('0x1d')]['id']))[_0xaa41('0xa')](respondWithResult(_0x3a29d2,null))[_0xaa41('0x1e')](handleError(_0x3a29d2,null));};exports['mailQueues']=function(_0x2ae70c,_0x57cb70){return respondWithRpcPromise('MailQueues',_0x2ae70c[_0xaa41('0x1a')],routingClient)['then'](respondWithResult(_0x57cb70,null))[_0xaa41('0x1e')](handleError(_0x57cb70,null));};exports[_0xaa41('0x46')]=function(_0x169ddf,_0x5e83e1){return respondWithRpcPromise(_0xaa41('0x47'),_0x169ddf[_0xaa41('0x1a')],routingClient)[_0xaa41('0xa')](findById(_0x169ddf[_0xaa41('0x1d')]['id']))[_0xaa41('0xa')](respondWithResult(_0x5e83e1,null))[_0xaa41('0x1e')](handleError(_0x5e83e1,null));};exports[_0xaa41('0x48')]=function(_0x337059,_0x3f91f3){return respondWithRpcPromise('MailAccounts',_0x337059[_0xaa41('0x1a')],mailClient)[_0xaa41('0xa')](respondWithResult(_0x3f91f3,null))[_0xaa41('0x1e')](handleError(_0x3f91f3,null));};exports['openchannelQueues']=function(_0x3fe47a,_0x2caf5c){return respondWithRpcPromise(_0xaa41('0x49'),_0x3fe47a[_0xaa41('0x1a')],routingClient)[_0xaa41('0xa')](respondWithResult(_0x2caf5c,null))[_0xaa41('0x1e')](handleError(_0x2caf5c,null));};exports[_0xaa41('0x4a')]=function(_0x5ea056,_0x55a85c){return respondWithRpcPromise('OpenchannelQueues',_0x5ea056['query'],routingClient)['then'](findById(_0x5ea056['params']['id']))[_0xaa41('0xa')](respondWithResult(_0x55a85c,null))['catch'](handleError(_0x55a85c,null));};exports['smsQueues']=function(_0x24c6f3,_0x40a524){return respondWithRpcPromise(_0xaa41('0x4b'),_0x24c6f3[_0xaa41('0x1a')],routingClient)['then'](respondWithResult(_0x40a524,null))[_0xaa41('0x1e')](handleError(_0x40a524,null));};exports[_0xaa41('0x4c')]=function(_0x1ddb6c,_0x46822f){return respondWithRpcPromise(_0xaa41('0x4b'),_0x1ddb6c[_0xaa41('0x1a')],routingClient)[_0xaa41('0xa')](findById(_0x1ddb6c[_0xaa41('0x1d')]['id']))[_0xaa41('0xa')](respondWithResult(_0x46822f,null))['catch'](handleError(_0x46822f,null));};exports[_0xaa41('0x4d')]=function(_0x2d2af8,_0x50170f){return respondWithRpcPromise('WhatsappQueues',_0x2d2af8['query'],routingClient)[_0xaa41('0xa')](respondWithResult(_0x50170f,null))['catch'](handleError(_0x50170f,null));};exports[_0xaa41('0x4e')]=function(_0x5c8028,_0x5423b6){return respondWithRpcPromise(_0xaa41('0x4f'),_0x5c8028['query'],routingClient)[_0xaa41('0xa')](findById(_0x5c8028[_0xaa41('0x1d')]['id']))[_0xaa41('0xa')](respondWithResult(_0x5423b6,null))[_0xaa41('0x1e')](handleError(_0x5423b6,null));};exports['faxQueues']=function(_0x5be61b,_0x339db3){return respondWithRpcPromise(_0xaa41('0x50'),_0x5be61b['query'],routingClient)['then'](respondWithResult(_0x339db3,null))[_0xaa41('0x1e')](handleError(_0x339db3,null));};exports[_0xaa41('0x51')]=function(_0x304694,_0xbeafb5){return respondWithRpcPromise(_0xaa41('0x50'),_0x304694['query'],routingClient)[_0xaa41('0xa')](findById(_0x304694['params']['id']))['then'](respondWithResult(_0xbeafb5,null))['catch'](handleError(_0xbeafb5,null));};exports[_0xaa41('0x52')]=function(_0x19ec63,_0x436362){return respondWithRpcPromise('FaxAccounts',_0x19ec63[_0xaa41('0x1a')])[_0xaa41('0xa')](respondWithResult(_0x436362,null))[_0xaa41('0x1e')](handleError(_0x436362,null));};exports[_0xaa41('0x53')]=function(_0x457515,_0x3ffbf8){return respondWithRpcPromise(_0xaa41('0x54'),_0x457515['query'],routingClient)[_0xaa41('0xa')](respondWithResult(_0x3ffbf8,null))[_0xaa41('0x1e')](handleError(_0x3ffbf8,null));};exports[_0xaa41('0x55')]=function(_0x175ca9,_0x51ff61){return respondWithRpcPromise(_0xaa41('0x56'),_0x175ca9['query'],routingClient)[_0xaa41('0xa')](respondWithResult(_0x51ff61,null))[_0xaa41('0x1e')](handleError(_0x51ff61,null));};exports[_0xaa41('0x57')]=function(_0x143ef0,_0x491cad){return respondWithRpcPromise(_0xaa41('0x58'),_0x143ef0[_0xaa41('0x1a')],routingClient)[_0xaa41('0xa')](respondWithResult(_0x491cad,null))[_0xaa41('0x1e')](handleError(_0x491cad,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x140d78,_0x50197b){return respondWithRpcPromise(_0xaa41('0x58'),_0x140d78[_0xaa41('0x1a')],routingClient)['then'](function(_0x1ac05e){if(_0x140d78[_0xaa41('0x1a')][_0xaa41('0x59')]!==undefined){var _0x582d79=_(_0x1ac05e[_0xaa41('0x16')])[_0xaa41('0x5a')]([_0x140d78[_0xaa41('0x1a')][_0xaa41('0x59')],_0x140d78[_0xaa41('0x1d')]['id']])[_0xaa41('0x5b')](_0xaa41('0x5c'))['uniq']()[_0xaa41('0x5d')]();return _0x1ac05e[_0xaa41('0x16')][_0xaa41('0x5a')](function(_0x530982){return _0x582d79['indexOf'](_0x530982[_0xaa41('0x5c')])>-0x1;});}else{return _0x1ac05e[_0xaa41('0x16')]['filter'](function(_0x1ce957){return _0x1ce957[_0xaa41('0x5c')]===parseInt(_0x140d78['params']['id']);});}})[_0xaa41('0xa')](respondWithResult(_0x50197b,null))[_0xaa41('0x1e')](handleError(_0x50197b,null));};exports[_0xaa41('0x5e')]=function(_0xe8731,_0x46feb2){return respondWithRpcPromise(_0xaa41('0x5f'),_0xe8731[_0xaa41('0x1a')],routingClient)[_0xaa41('0xa')](respondWithResult(_0x46feb2,null))['catch'](handleError(_0x46feb2,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x397526,_0x481db9){return respondWithRpcPromise(_0xaa41('0x60'),_0x397526[_0xaa41('0x1a')],routingClient)[_0xaa41('0xa')](respondWithResult(_0x481db9,null))['catch'](handleError(_0x481db9,null));};exports[_0xaa41('0x61')]=function(_0x404c38,_0x2d7493){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x404c38[_0xaa41('0x1a')],routingClient)[_0xaa41('0xa')](respondWithResult(_0x2d7493,null))['catch'](handleError(_0x2d7493,null));};exports[_0xaa41('0x62')]=function(_0x4de25c){return function(_0x53faf4,_0x3f6a2b){var _0x34d0e4,_0x5eded3;var _0x5a8cb0=_[_0xaa41('0x63')](_0x4de25c);var _0x1726ec=_0x4de25c===_0xaa41('0x64')?_0xaa41('0x65'):'Account';return db[_0x5a8cb0+_0xaa41('0x66')][_0xaa41('0x67')]({'raw':!![],'where':{'id':_0x53faf4[_0xaa41('0x1d')]['id']}})['then'](function(_0x1ad3aa){if(_[_0xaa41('0x15')](_0x1ad3aa)){throw new Error(_0x5a8cb0+_0xaa41('0x68'));}_0x34d0e4=_0x1ad3aa;return db[_0x5a8cb0+'Message'][_0xaa41('0x67')]({'where':{'id':_0x53faf4['body']['messageId']},'include':[{'model':db[_0x5a8cb0+_0xaa41('0x69')],'as':_0xaa41('0x69')},{'model':db[_0x5a8cb0+_0x1726ec],'as':'Account'}]});})[_0xaa41('0xa')](function(_0x9e8ebb){if(_[_0xaa41('0x15')](_0x9e8ebb)){throw new Error(_0x5a8cb0+'\x20Message\x20not\x20found');}_0x5eded3=_0x9e8ebb;return _0x9e8ebb[_0xaa41('0x6a')]({'read':0x0,'readAt':null,'UserId':null});})[_0xaa41('0xa')](function(){var _0x1a2deb={'uniqueid':_0x4de25c+'.'+_0x5eded3['id']+'.'+_0x5eded3[_0xaa41('0x69')]['id'],'FromUserId':_0x53faf4[_0xaa41('0x38')]['id'],'type':'queue'};_0x1a2deb[_0x5a8cb0+_0xaa41('0x6b')]=_0x5eded3['id'];_0x1a2deb[_0x5a8cb0+'InteractionId']=_0x5eded3[_0xaa41('0x69')]['id'];_0x1a2deb[_0xaa41('0x6c')+_0x5a8cb0+_0x1726ec+'Id']=_0x5eded3[_0xaa41('0x6d')]['id'];_0x1a2deb['To'+_0x5a8cb0+_0xaa41('0x6e')]=_0x34d0e4['id'];return db[_0x5a8cb0+_0xaa41('0x6f')][_0xaa41('0x70')](_0x1a2deb);})[_0xaa41('0xa')](function(){return respondWithRpcPromise(_0xaa41('0x71'),{'channel':_0x4de25c,'interaction':_0x5eded3[_0xaa41('0x69')],'message':_0x5eded3,'account':_0x5eded3[_0xaa41('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0xaa41('0x72'),'appdata':_0x34d0e4['name']+','+(_0x5eded3[_0xaa41('0x6d')][_0xaa41('0x73')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xaa41('0xa')](respondWithResult(_0x3f6a2b,null))['catch'](handleError(_0x3f6a2b,null));};};exports[_0xaa41('0x74')]=function(_0xb44b1f,_0x472eb3){var _0x38d759,_0x2dc55e;if(_[_0xaa41('0x15')](_0xb44b1f[_0xaa41('0x24')]['channel'])){throw new Error(_0xaa41('0x75'));}var _0x1d50db=_0xb44b1f[_0xaa41('0x24')][_0xaa41('0x76')];var _0x585ce7=_[_0xaa41('0x63')](_0x1d50db);var _0x5c9beb=_0x1d50db===_0xaa41('0x64')?_0xaa41('0x65'):_0xaa41('0x6d');return db[_0xaa41('0x77')][_0xaa41('0x67')]({'raw':!![],'where':{'id':_0xb44b1f['params']['id'],'role':_0xaa41('0x3c')}})[_0xaa41('0xa')](function(_0x5819ac){if(_[_0xaa41('0x15')](_0x5819ac)){throw new Error(_0xaa41('0x78'));}_0x38d759=_0x5819ac;return db[_0x585ce7+_0xaa41('0x79')][_0xaa41('0x67')]({'where':{'id':_0xb44b1f[_0xaa41('0x24')][_0xaa41('0x7a')]},'include':[{'model':db[_0x585ce7+_0xaa41('0x69')],'as':_0xaa41('0x69')},{'model':db[_0x585ce7+_0x5c9beb],'as':'Account'}]});})[_0xaa41('0xa')](function(_0x39d3cc){if(_[_0xaa41('0x15')](_0x39d3cc)){throw new Error(_0x585ce7+_0xaa41('0x7b'));}_0x2dc55e=_0x39d3cc;return _0x39d3cc[_0xaa41('0x6a')]({'read':0x0,'readAt':null,'UserId':null});})[_0xaa41('0xa')](function(){var _0x5489be={'uniqueid':_0x1d50db+'.'+_0x2dc55e['id']+'.'+_0x2dc55e['Interaction']['id'],'FromUserId':_0xb44b1f['user']['id'],'type':_0xaa41('0x72'),'ToUserId':_0x38d759['id']};_0x5489be[_0x585ce7+_0xaa41('0x6b')]=_0x2dc55e['id'];_0x5489be[_0x585ce7+'InteractionId']=_0x2dc55e[_0xaa41('0x69')]['id'];_0x5489be[_0xaa41('0x6c')+_0x585ce7+_0x5c9beb+'Id']=_0x2dc55e['Account']['id'];return db[_0x585ce7+_0xaa41('0x6f')][_0xaa41('0x70')](_0x5489be);})[_0xaa41('0xa')](function(){return respondWithRpcPromise(_0xaa41('0x71'),{'channel':_0x1d50db,'interaction':_0x2dc55e['Interaction'],'message':_0x2dc55e,'account':_0x2dc55e[_0xaa41('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x38d759[_0xaa41('0x13')]+','+(_0x2dc55e[_0xaa41('0x6d')][_0xaa41('0x7c')]||0x12c),'interval':_0xaa41('0x7d')}]},routingClient);})[_0xaa41('0xa')](respondWithResult(_0x472eb3,null))[_0xaa41('0x1e')](handleError(_0x472eb3,null));}; \ No newline at end of file +var _0xabce=['InteractionId','From','QueueId','TransferReport','create','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Agent\x20not\x20found','update','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','jayson/promise','client','http','request','then','error','code','message','result','catch','json','sendStatus','stack','name','status','send','isNil','rows','find','voiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','OutboundChannels','Agents','agentCapacity','interaction','MemberReport','findAll','user','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','agent','internal','AgentCapacity','telephones','Telephones','trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','showWhatsappQueues','FaxAccounts','MailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','map','value','indexOf','queue_id','filter','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','queue','MessageId'];(function(_0x134c79,_0x2136d3){var _0x2c2142=function(_0x537f61){while(--_0x537f61){_0x134c79['push'](_0x134c79['shift']());}};_0x2c2142(++_0x2136d3);}(_0xabce,0x103));var _0xeabc=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xabce[_0x1ac595];return _0x455fff;};'use strict';var BPromise=require(_0xeabc('0x0'));var moment=require(_0xeabc('0x1'));var _=require(_0xeabc('0x2'));var util=require(_0xeabc('0x3'));var db=require(_0xeabc('0x4'))['db'];var logger=require('../../config/logger')('api');var jayson=require(_0xeabc('0x5'));var amiClient=jayson[_0xeabc('0x6')][_0xeabc('0x7')]({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson[_0xeabc('0x6')]['http']({'port':0x232c});function respondWithRpcPromise(_0x229ba4,_0x52ede8,_0x3bdc29){return new BPromise(function(_0x9417af,_0x8434c5){var _0x5d59d5=_0x3bdc29?_0x3bdc29:amiClient;return _0x5d59d5[_0xeabc('0x8')](_0x229ba4,_0x52ede8)[_0xeabc('0x9')](function(_0x2f73e9){if(_0x2f73e9[_0xeabc('0xa')]){if(_0x2f73e9[_0xeabc('0xa')][_0xeabc('0xb')]===0x1f4){return _0x8434c5(_0x2f73e9[_0xeabc('0xa')][_0xeabc('0xc')]);}return _0x9417af(_0x2f73e9[_0xeabc('0xa')][_0xeabc('0xc')]);}else{_0x9417af(_0x2f73e9[_0xeabc('0xd')]);}})[_0xeabc('0xe')](function(_0x435ea7){_0x8434c5(_0x435ea7);});});}function respondWithResult(_0x3fd0b5,_0x36a92e){_0x36a92e=_0x36a92e||0xc8;return function(_0xcfbf06){if(_0xcfbf06){return _0x3fd0b5['status'](_0x36a92e)[_0xeabc('0xf')](_0xcfbf06);}return _0x3fd0b5[_0xeabc('0x10')](0x194);};}function handleError(_0x3251c6,_0x55f0de){_0x55f0de=_0x55f0de||0x1f4;return function(_0x5f4ee8){logger[_0xeabc('0xa')](_0x5f4ee8[_0xeabc('0x11')]);if(_0x5f4ee8[_0xeabc('0x12')]){delete _0x5f4ee8['name'];}_0x3251c6[_0xeabc('0x13')](_0x55f0de)[_0xeabc('0x14')](_0x5f4ee8);};}function findById(_0x49f2d8){return function(_0x53fe28){if(!_[_0xeabc('0x15')](_0x49f2d8)&&!_['isNil'](_0x53fe28)&&!_[_0xeabc('0x15')](_0x53fe28[_0xeabc('0x16')])){return _[_0xeabc('0x17')](_0x53fe28[_0xeabc('0x16')],function(_0x31dd53){return _0x31dd53['id']==_0x49f2d8;});}return null;};}exports[_0xeabc('0x18')]=function(_0x384be5,_0x5e30ee){return respondWithRpcPromise('VoiceChannels',_0x384be5[_0xeabc('0x19')])['then'](respondWithResult(_0x5e30ee,null))[_0xeabc('0xe')](handleError(_0x5e30ee,null));};exports[_0xeabc('0x1a')]=function(_0x502947,_0x28063a){return respondWithRpcPromise(_0xeabc('0x1b'),_[_0xeabc('0x1c')](_0x502947[_0xeabc('0x19')],_0x502947[_0xeabc('0x1d')]))['then'](respondWithResult(_0x28063a,null))[_0xeabc('0xe')](handleError(_0x28063a,null));};exports[_0xeabc('0x1e')]=function(_0x91ab00,_0x5bdd57){return respondWithRpcPromise(_0xeabc('0x1f'),_[_0xeabc('0x1c')](_0x91ab00[_0xeabc('0x19')],_0x91ab00[_0xeabc('0x1d')]))['then'](respondWithResult(_0x5bdd57,null))[_0xeabc('0xe')](handleError(_0x5bdd57,null));};exports['voiceQueues']=function(_0x27dbaf,_0x4d4e29){return respondWithRpcPromise(_0xeabc('0x20'),_0x27dbaf[_0xeabc('0x19')])[_0xeabc('0x9')](respondWithResult(_0x4d4e29,null))[_0xeabc('0xe')](handleError(_0x4d4e29,null));};exports[_0xeabc('0x21')]=function(_0x137293,_0x131722){return respondWithRpcPromise('VoiceQueues',_0x137293['query'])[_0xeabc('0x9')](findById(_0x137293['params']['id']))[_0xeabc('0x9')](respondWithResult(_0x131722,null))[_0xeabc('0xe')](handleError(_0x131722,null));};exports['updateVoiceQueue']=function(_0x2163e6,_0x38572d){return respondWithRpcPromise(_0xeabc('0x22'),_[_0xeabc('0x1c')](_0x2163e6[_0xeabc('0x23')],_0x2163e6[_0xeabc('0x1d')]))[_0xeabc('0x9')](respondWithResult(_0x38572d,null))[_0xeabc('0xe')](handleError(_0x38572d,null));};exports[_0xeabc('0x24')]=function(_0x5ebb86,_0x5b34dd){return respondWithRpcPromise('VoiceQueuesPreview',_[_0xeabc('0x1c')](_0x5ebb86[_0xeabc('0x19')],_0x5ebb86[_0xeabc('0x1d')]))[_0xeabc('0x9')](respondWithResult(_0x5b34dd,null))[_0xeabc('0xe')](handleError(_0x5b34dd,null));};exports[_0xeabc('0x25')]=function(_0x61c0af,_0x545d7f){return respondWithRpcPromise(_0xeabc('0x26'),_0x61c0af[_0xeabc('0x19')])[_0xeabc('0x9')](respondWithResult(_0x545d7f,null))['catch'](handleError(_0x545d7f,null));};exports[_0xeabc('0x27')]=function(_0x3777c1,_0x4492fd){return respondWithRpcPromise('VoiceQueuesChannel',_[_0xeabc('0x1c')](_0x3777c1[_0xeabc('0x19')],_0x3777c1[_0xeabc('0x1d')]))['then'](respondWithResult(_0x4492fd,null))[_0xeabc('0xe')](handleError(_0x4492fd,null));};exports[_0xeabc('0x28')]=function(_0x5d9acf,_0x50cca2){return respondWithRpcPromise(_0xeabc('0x29'),_[_0xeabc('0x1c')](_0x5d9acf['query'],_0x5d9acf[_0xeabc('0x1d')]))[_0xeabc('0x9')](respondWithResult(_0x50cca2,null))[_0xeabc('0xe')](handleError(_0x50cca2,null));};exports[_0xeabc('0x2a')]=function(_0x34057c,_0x4b7923){return respondWithRpcPromise(_0xeabc('0x2b'),_['merge'](_0x34057c[_0xeabc('0x19')],_0x34057c[_0xeabc('0x1d')]))[_0xeabc('0x9')](respondWithResult(_0x4b7923,null))['catch'](handleError(_0x4b7923,null));};exports['outbound']=function(_0x452580,_0x560d4a){return respondWithRpcPromise(_0xeabc('0x2c'),_0x452580['query'])['then'](respondWithResult(_0x560d4a,null))['catch'](handleError(_0x560d4a,null));};exports['outboundChannels']=function(_0x1e222a,_0x593588){return respondWithRpcPromise(_0xeabc('0x2d'),_0x1e222a[_0xeabc('0x19')])['then'](respondWithResult(_0x593588,null))[_0xeabc('0xe')](handleError(_0x593588,null));};exports['agents']=function(_0x3d48f4,_0x58aafe){var _0xbd7f03;return respondWithRpcPromise(_0xeabc('0x2e'),_0x3d48f4[_0xeabc('0x19')])['then'](function(_0x5a00d0){_0xbd7f03=_0x5a00d0;return respondWithRpcPromise('Agents',_0x3d48f4[_0xeabc('0x19')],routingClient);})[_0xeabc('0x9')](function(_0xafa59b){return _['merge']({},_0xafa59b,_0xbd7f03);})['then'](respondWithResult(_0x58aafe,null))[_0xeabc('0xe')](handleError(_0x58aafe,null));};exports[_0xeabc('0x2f')]=function(_0x5e9cb3,_0xc6af4d){if(_0x5e9cb3['body']&&_0x5e9cb3[_0xeabc('0x23')]['interaction']&&_0x5e9cb3['user']&&_0x5e9cb3['user'][_0xeabc('0x12')]){for(var _0x37c926 in _0x5e9cb3[_0xeabc('0x23')][_0xeabc('0x30')]){if(_0x5e9cb3['body'][_0xeabc('0x30')]['hasOwnProperty'](_0x37c926)){db[_0xeabc('0x31')][_0xeabc('0x32')]({'where':{'channel':_0x37c926,'membername':_0x5e9cb3[_0xeabc('0x33')][_0xeabc('0x12')],'type':_0xeabc('0x34'),'exitAt':null,'uniqueid':_0x5e9cb3['body']['interaction'][_0x37c926]&&_0x5e9cb3[_0xeabc('0x23')]['interaction'][_0x37c926][_0xeabc('0x35')]?{'$notIn':_0x5e9cb3[_0xeabc('0x23')]['interaction'][_0x37c926]}:{'$ne':null}}})[_0xeabc('0x9')](function(_0x2b3c28){var _0x459c98=moment()[_0xeabc('0x36')](_0xeabc('0x37'));for(var _0xcaa5b9=0x0,_0x2003a7=_0x2b3c28['length'];_0xcaa5b9<_0x2003a7;_0xcaa5b9+=0x1){_0x2b3c28[_0xcaa5b9][_0xeabc('0x38')]({'exitAt':_0x459c98});}});for(var _0x2c85f0=0x0;_0x2c85f0<_0x5e9cb3[_0xeabc('0x23')][_0xeabc('0x30')][_0x37c926][_0xeabc('0x35')];_0x2c85f0+=0x1){db[_0xeabc('0x31')][_0xeabc('0x39')]({'where':{'channel':_0x37c926,'membername':_0x5e9cb3[_0xeabc('0x33')][_0xeabc('0x12')],'type':_0xeabc('0x34'),'uniqueid':_0x5e9cb3['body'][_0xeabc('0x30')][_0x37c926][_0x2c85f0],'exitAt':null},'defaults':{'channel':_0x37c926,'membername':_0x5e9cb3[_0xeabc('0x33')][_0xeabc('0x12')],'interface':_[_0xeabc('0x15')](_0x5e9cb3[_0xeabc('0x33')][_0xeabc('0x3a')])?util[_0xeabc('0x36')]('SIP/%s',_0x5e9cb3[_0xeabc('0x33')][_0xeabc('0x12')]):_0x5e9cb3[_0xeabc('0x33')][_0xeabc('0x3a')],'type':_0xeabc('0x34'),'enterAt':moment()['format'](_0xeabc('0x37')),'role':_0xeabc('0x3b'),'internal':_0x5e9cb3[_0xeabc('0x33')][_0xeabc('0x3c')],'uniqueid':_0x5e9cb3['body'][_0xeabc('0x30')][_0x37c926][_0x2c85f0]}});}}}}return respondWithRpcPromise(_0xeabc('0x3d'),{'id':_0x5e9cb3['params']['id'],'capacity':_0x5e9cb3[_0xeabc('0x23')]['capacity']},routingClient)[_0xeabc('0x9')](respondWithResult(_0xc6af4d,null))['catch'](handleError(_0xc6af4d,null));};exports[_0xeabc('0x3e')]=function(_0x2ec94c,_0x38f988){return respondWithRpcPromise(_0xeabc('0x3f'),_0x2ec94c[_0xeabc('0x19')])[_0xeabc('0x9')](respondWithResult(_0x38f988,null))[_0xeabc('0xe')](handleError(_0x38f988,null));};exports[_0xeabc('0x40')]=function(_0x31aedf,_0x6423f3){return respondWithRpcPromise('Trunks',_0x31aedf[_0xeabc('0x19')])[_0xeabc('0x9')](respondWithResult(_0x6423f3,null))[_0xeabc('0xe')](handleError(_0x6423f3,null));};exports[_0xeabc('0x41')]=function(_0x555d6b,_0x1cef45){return respondWithRpcPromise(_0xeabc('0x42'),_0x555d6b[_0xeabc('0x19')])[_0xeabc('0x9')](respondWithResult(_0x1cef45,null))['catch'](handleError(_0x1cef45,null));};exports[_0xeabc('0x43')]=function(_0x1c7679,_0x3a1b84){return respondWithRpcPromise(_0xeabc('0x44'),_0x1c7679[_0xeabc('0x19')],routingClient)[_0xeabc('0x9')](respondWithResult(_0x3a1b84,null))[_0xeabc('0xe')](handleError(_0x3a1b84,null));};exports[_0xeabc('0x45')]=function(_0x17acf8,_0x58ab08){return respondWithRpcPromise(_0xeabc('0x44'),_0x17acf8['query'],routingClient)['then'](findById(_0x17acf8['params']['id']))[_0xeabc('0x9')](respondWithResult(_0x58ab08,null))[_0xeabc('0xe')](handleError(_0x58ab08,null));};exports[_0xeabc('0x46')]=function(_0xb35103,_0xe89728){return respondWithRpcPromise(_0xeabc('0x47'),_0xb35103['query'],routingClient)[_0xeabc('0x9')](respondWithResult(_0xe89728,null))[_0xeabc('0xe')](handleError(_0xe89728,null));};exports[_0xeabc('0x48')]=function(_0x104c1e,_0x2ddc53){return respondWithRpcPromise(_0xeabc('0x47'),_0x104c1e[_0xeabc('0x19')],routingClient)[_0xeabc('0x9')](findById(_0x104c1e['params']['id']))['then'](respondWithResult(_0x2ddc53,null))[_0xeabc('0xe')](handleError(_0x2ddc53,null));};exports[_0xeabc('0x49')]=function(_0x2c0894,_0x4b3794){return respondWithRpcPromise(_0xeabc('0x4a'),_0x2c0894['query'],mailClient)['then'](respondWithResult(_0x4b3794,null))[_0xeabc('0xe')](handleError(_0x4b3794,null));};exports[_0xeabc('0x4b')]=function(_0x13f04f,_0x4f5451){return respondWithRpcPromise(_0xeabc('0x4c'),_0x13f04f[_0xeabc('0x19')],routingClient)['then'](respondWithResult(_0x4f5451,null))[_0xeabc('0xe')](handleError(_0x4f5451,null));};exports[_0xeabc('0x4d')]=function(_0x321a90,_0x7697f7){return respondWithRpcPromise(_0xeabc('0x4c'),_0x321a90[_0xeabc('0x19')],routingClient)['then'](findById(_0x321a90[_0xeabc('0x1d')]['id']))[_0xeabc('0x9')](respondWithResult(_0x7697f7,null))[_0xeabc('0xe')](handleError(_0x7697f7,null));};exports[_0xeabc('0x4e')]=function(_0x1b61a8,_0x19faa4){return respondWithRpcPromise(_0xeabc('0x4f'),_0x1b61a8[_0xeabc('0x19')],routingClient)[_0xeabc('0x9')](respondWithResult(_0x19faa4,null))['catch'](handleError(_0x19faa4,null));};exports[_0xeabc('0x50')]=function(_0x590439,_0x404846){return respondWithRpcPromise(_0xeabc('0x4f'),_0x590439[_0xeabc('0x19')],routingClient)[_0xeabc('0x9')](findById(_0x590439[_0xeabc('0x1d')]['id']))[_0xeabc('0x9')](respondWithResult(_0x404846,null))[_0xeabc('0xe')](handleError(_0x404846,null));};exports[_0xeabc('0x51')]=function(_0x5d4bc2,_0x24d0e5){return respondWithRpcPromise('WhatsappQueues',_0x5d4bc2[_0xeabc('0x19')],routingClient)[_0xeabc('0x9')](respondWithResult(_0x24d0e5,null))[_0xeabc('0xe')](handleError(_0x24d0e5,null));};exports[_0xeabc('0x52')]=function(_0x5b4430,_0x12fd48){return respondWithRpcPromise('WhatsappQueues',_0x5b4430['query'],routingClient)[_0xeabc('0x9')](findById(_0x5b4430[_0xeabc('0x1d')]['id']))[_0xeabc('0x9')](respondWithResult(_0x12fd48,null))[_0xeabc('0xe')](handleError(_0x12fd48,null));};exports['faxQueues']=function(_0x51a0c7,_0x2e712e){return respondWithRpcPromise('FaxQueues',_0x51a0c7['query'],routingClient)[_0xeabc('0x9')](respondWithResult(_0x2e712e,null))['catch'](handleError(_0x2e712e,null));};exports['showFaxQueues']=function(_0xa44f2d,_0x1c84b5){return respondWithRpcPromise('FaxQueues',_0xa44f2d['query'],routingClient)[_0xeabc('0x9')](findById(_0xa44f2d['params']['id']))[_0xeabc('0x9')](respondWithResult(_0x1c84b5,null))[_0xeabc('0xe')](handleError(_0x1c84b5,null));};exports['faxAccounts']=function(_0x5d6477,_0x24365a){return respondWithRpcPromise(_0xeabc('0x53'),_0x5d6477[_0xeabc('0x19')])[_0xeabc('0x9')](respondWithResult(_0x24365a,null))[_0xeabc('0xe')](handleError(_0x24365a,null));};exports['chatQueuesWaitingInteractions']=function(_0x53f578,_0x391cae){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x53f578[_0xeabc('0x19')],routingClient)['then'](respondWithResult(_0x391cae,null))[_0xeabc('0xe')](handleError(_0x391cae,null));};exports['mailQueuesWaitingInteractions']=function(_0x1fdaba,_0x53ac31){return respondWithRpcPromise(_0xeabc('0x54'),_0x1fdaba[_0xeabc('0x19')],routingClient)[_0xeabc('0x9')](respondWithResult(_0x53ac31,null))[_0xeabc('0xe')](handleError(_0x53ac31,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x6ee7cf,_0x4fa682){return respondWithRpcPromise(_0xeabc('0x55'),_0x6ee7cf[_0xeabc('0x19')],routingClient)[_0xeabc('0x9')](respondWithResult(_0x4fa682,null))[_0xeabc('0xe')](handleError(_0x4fa682,null));};exports[_0xeabc('0x56')]=function(_0x5c1ab2,_0x239350){return respondWithRpcPromise(_0xeabc('0x55'),_0x5c1ab2[_0xeabc('0x19')],routingClient)[_0xeabc('0x9')](function(_0x5427c8){if(_0x5c1ab2[_0xeabc('0x19')][_0xeabc('0x57')]!==undefined){var _0xe60b11=_(_0x5427c8[_0xeabc('0x16')])['filter']([_0x5c1ab2[_0xeabc('0x19')][_0xeabc('0x57')],_0x5c1ab2[_0xeabc('0x1d')]['id']])[_0xeabc('0x58')]('queue_id')['uniq']()[_0xeabc('0x59')]();return _0x5427c8['rows']['filter'](function(_0x3271b6){return _0xe60b11[_0xeabc('0x5a')](_0x3271b6[_0xeabc('0x5b')])>-0x1;});}else{return _0x5427c8['rows'][_0xeabc('0x5c')](function(_0x403b18){return _0x403b18['queue_id']===parseInt(_0x5c1ab2[_0xeabc('0x1d')]['id']);});}})[_0xeabc('0x9')](respondWithResult(_0x239350,null))[_0xeabc('0xe')](handleError(_0x239350,null));};exports[_0xeabc('0x5d')]=function(_0x2ece2c,_0x4bf9d8){return respondWithRpcPromise(_0xeabc('0x5e'),_0x2ece2c['query'],routingClient)['then'](respondWithResult(_0x4bf9d8,null))['catch'](handleError(_0x4bf9d8,null));};exports[_0xeabc('0x5f')]=function(_0x1c8a51,_0x1b6e9e){return respondWithRpcPromise(_0xeabc('0x60'),_0x1c8a51[_0xeabc('0x19')],routingClient)['then'](respondWithResult(_0x1b6e9e,null))[_0xeabc('0xe')](handleError(_0x1b6e9e,null));};exports['faxQueuesWaitingInteractions']=function(_0x1795fe,_0x2f95c7){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x1795fe[_0xeabc('0x19')],routingClient)['then'](respondWithResult(_0x2f95c7,null))['catch'](handleError(_0x2f95c7,null));};exports[_0xeabc('0x61')]=function(_0xa5c4ca){return function(_0x439a48,_0x3acb88){var _0x3c6a49,_0x4dfc4b;var _0x399735=_[_0xeabc('0x62')](_0xa5c4ca);var _0x33e5fb=_0xa5c4ca===_0xeabc('0x63')?_0xeabc('0x64'):_0xeabc('0x65');return db[_0x399735+_0xeabc('0x66')][_0xeabc('0x67')]({'raw':!![],'where':{'id':_0x439a48[_0xeabc('0x1d')]['id']}})[_0xeabc('0x9')](function(_0x522c6e){if(_[_0xeabc('0x15')](_0x522c6e)){throw new Error(_0x399735+_0xeabc('0x68'));}_0x3c6a49=_0x522c6e;return db[_0x399735+_0xeabc('0x69')]['findOne']({'where':{'id':_0x439a48['body'][_0xeabc('0x6a')]},'include':[{'model':db[_0x399735+_0xeabc('0x6b')],'as':_0xeabc('0x6b')},{'model':db[_0x399735+_0x33e5fb],'as':_0xeabc('0x65')}]});})[_0xeabc('0x9')](function(_0x5f5a47){if(_[_0xeabc('0x15')](_0x5f5a47)){throw new Error(_0x399735+'\x20Message\x20not\x20found');}_0x4dfc4b=_0x5f5a47;return _0x5f5a47['update']({'read':0x0,'readAt':null,'UserId':null});})[_0xeabc('0x9')](function(){var _0x302e94={'uniqueid':_0xa5c4ca+'.'+_0x4dfc4b['id']+'.'+_0x4dfc4b['Interaction']['id'],'FromUserId':_0x439a48[_0xeabc('0x33')]['id'],'type':_0xeabc('0x6c')};_0x302e94[_0x399735+_0xeabc('0x6d')]=_0x4dfc4b['id'];_0x302e94[_0x399735+_0xeabc('0x6e')]=_0x4dfc4b[_0xeabc('0x6b')]['id'];_0x302e94[_0xeabc('0x6f')+_0x399735+_0x33e5fb+'Id']=_0x4dfc4b[_0xeabc('0x65')]['id'];_0x302e94['To'+_0x399735+_0xeabc('0x70')]=_0x3c6a49['id'];return db[_0x399735+_0xeabc('0x71')][_0xeabc('0x72')](_0x302e94);})[_0xeabc('0x9')](function(){return respondWithRpcPromise('Start',{'channel':_0xa5c4ca,'interaction':_0x4dfc4b[_0xeabc('0x6b')],'message':_0x4dfc4b,'account':_0x4dfc4b['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xeabc('0x6c'),'appdata':_0x3c6a49[_0xeabc('0x12')]+','+(_0x4dfc4b[_0xeabc('0x65')][_0xeabc('0x73')]||0x12c),'interval':_0xeabc('0x74')}]},routingClient);})[_0xeabc('0x9')](respondWithResult(_0x3acb88,null))[_0xeabc('0xe')](handleError(_0x3acb88,null));};};exports[_0xeabc('0x75')]=function(_0xb85c3d,_0x156e20){var _0x42e92b,_0x5d471f;if(_[_0xeabc('0x15')](_0xb85c3d[_0xeabc('0x23')][_0xeabc('0x76')])){throw new Error(_0xeabc('0x77'));}var _0x5b00d6=_0xb85c3d[_0xeabc('0x23')][_0xeabc('0x76')];var _0x580661=_[_0xeabc('0x62')](_0x5b00d6);var _0x22ef88=_0x5b00d6==='chat'?'Website':'Account';return db['User'][_0xeabc('0x67')]({'raw':!![],'where':{'id':_0xb85c3d[_0xeabc('0x1d')]['id'],'role':_0xeabc('0x3b')}})[_0xeabc('0x9')](function(_0x1d8dca){if(_[_0xeabc('0x15')](_0x1d8dca)){throw new Error(_0xeabc('0x78'));}_0x42e92b=_0x1d8dca;return db[_0x580661+_0xeabc('0x69')][_0xeabc('0x67')]({'where':{'id':_0xb85c3d[_0xeabc('0x23')]['messageId']},'include':[{'model':db[_0x580661+_0xeabc('0x6b')],'as':_0xeabc('0x6b')},{'model':db[_0x580661+_0x22ef88],'as':'Account'}]});})[_0xeabc('0x9')](function(_0x32063c){if(_[_0xeabc('0x15')](_0x32063c)){throw new Error(_0x580661+'\x20Message\x20not\x20found');}_0x5d471f=_0x32063c;return _0x32063c[_0xeabc('0x79')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x425e5c={'uniqueid':_0x5b00d6+'.'+_0x5d471f['id']+'.'+_0x5d471f[_0xeabc('0x6b')]['id'],'FromUserId':_0xb85c3d[_0xeabc('0x33')]['id'],'type':_0xeabc('0x6c'),'ToUserId':_0x42e92b['id']};_0x425e5c[_0x580661+_0xeabc('0x6d')]=_0x5d471f['id'];_0x425e5c[_0x580661+'InteractionId']=_0x5d471f['Interaction']['id'];_0x425e5c['From'+_0x580661+_0x22ef88+'Id']=_0x5d471f['Account']['id'];return db[_0x580661+_0xeabc('0x71')][_0xeabc('0x72')](_0x425e5c);})[_0xeabc('0x9')](function(){return respondWithRpcPromise('Start',{'channel':_0x5b00d6,'interaction':_0x5d471f[_0xeabc('0x6b')],'message':_0x5d471f,'account':_0x5d471f[_0xeabc('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':_0xeabc('0x3b'),'appdata':_0x42e92b[_0xeabc('0x12')]+','+(_0x5d471f[_0xeabc('0x65')][_0xeabc('0x7a')]||0x12c),'interval':_0xeabc('0x74')}]},routingClient);})[_0xeabc('0x9')](respondWithResult(_0x156e20,null))[_0xeabc('0xe')](handleError(_0x156e20,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index a87b4ab..40c5e44 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 _0x63c9=['../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','isAuthenticated','index','get','/:id','/:id/run','run','post','create','put','update','destroy','exports','multer','util','path','express','fs-extra'];(function(_0x262641,_0x42d089){var _0x1c960f=function(_0x433322){while(--_0x433322){_0x262641['push'](_0x262641['shift']());}};_0x1c960f(++_0x42d089);}(_0x63c9,0x10c));var _0x963c=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0x63c9[_0x38ced4];return _0x547c07;};'use strict';var multer=require(_0x963c('0x0'));var util=require(_0x963c('0x1'));var path=require(_0x963c('0x2'));var timeout=require('connect-timeout');var express=require(_0x963c('0x3'));var router=express['Router']();var fs_extra=require(_0x963c('0x4'));var auth=require(_0x963c('0x5'));var interaction=require(_0x963c('0x6'));var config=require(_0x963c('0x7'));var controller=require(_0x963c('0x8'));router['get']('/',auth[_0x963c('0x9')](),controller[_0x963c('0xa')]);router[_0x963c('0xb')](_0x963c('0xc'),auth[_0x963c('0x9')](),controller['show']);router[_0x963c('0xb')](_0x963c('0xd'),auth['isAuthenticated'](),controller[_0x963c('0xe')]);router[_0x963c('0xf')]('/',auth[_0x963c('0x9')](),controller[_0x963c('0x10')]);router[_0x963c('0x11')](_0x963c('0xc'),auth[_0x963c('0x9')](),controller[_0x963c('0x12')]);router['delete'](_0x963c('0xc'),auth[_0x963c('0x9')](),controller[_0x963c('0x13')]);module[_0x963c('0x14')]=router; \ No newline at end of file +var _0xa0d5=['/:id','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','show','/:id/run','run','post','create','put','delete'];(function(_0x52e363,_0x48062a){var _0x3fc2b5=function(_0x1b0cf9){while(--_0x1b0cf9){_0x52e363['push'](_0x52e363['shift']());}};_0x3fc2b5(++_0x48062a);}(_0xa0d5,0xea));var _0x5a0d=function(_0x5a433c,_0x423be6){_0x5a433c=_0x5a433c-0x0;var _0x310003=_0xa0d5[_0x5a433c];return _0x310003;};'use strict';var multer=require(_0x5a0d('0x0'));var util=require(_0x5a0d('0x1'));var path=require(_0x5a0d('0x2'));var timeout=require(_0x5a0d('0x3'));var express=require('express');var router=express[_0x5a0d('0x4')]();var fs_extra=require(_0x5a0d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5a0d('0x6'));var config=require(_0x5a0d('0x7'));var controller=require(_0x5a0d('0x8'));router[_0x5a0d('0x9')]('/',auth[_0x5a0d('0xa')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x5a0d('0xb')]);router['get'](_0x5a0d('0xc'),auth[_0x5a0d('0xa')](),controller[_0x5a0d('0xd')]);router[_0x5a0d('0xe')]('/',auth[_0x5a0d('0xa')](),controller[_0x5a0d('0xf')]);router[_0x5a0d('0x10')]('/:id',auth[_0x5a0d('0xa')](),controller['update']);router[_0x5a0d('0x11')](_0x5a0d('0x12'),auth[_0x5a0d('0xa')](),controller[_0x5a0d('0x13')]);module[_0x5a0d('0x14')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 436b418..ef106c8 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 _0x126c=['default','custom','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','years','quarters','weeks','days','hours','ENUM','pdf','xlsx','csv'];(function(_0x5802a9,_0x2a1320){var _0xa6132c=function(_0xe09e0){while(--_0xe09e0){_0x5802a9['push'](_0x5802a9['shift']());}};_0xa6132c(++_0x2a1320);}(_0x126c,0xe7));var _0xc126=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x126c[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xc126('0x0'));module[_0xc126('0x1')]={'name':{'type':Sequelize[_0xc126('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xc126('0x2')]},'active':{'type':Sequelize[_0xc126('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xc126('0x2')],'allowNull':![],'defaultValue':_0xc126('0x4')},'startAt':{'type':Sequelize[_0xc126('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0xc126('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xc126('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0xc126('0x7'),_0xc126('0x8'),'months',_0xc126('0x9'),_0xc126('0xa'),_0xc126('0xb'),'minutes'),'allowNull':![],'defaultValue':_0xc126('0xa')},'output':{'type':Sequelize[_0xc126('0xc')]('csv',_0xc126('0xd'),_0xc126('0xe')),'allowNull':![],'defaultValue':_0xc126('0xf')},'type':{'type':Sequelize[_0xc126('0xc')]('custom',_0xc126('0x10')),'allowNull':![],'defaultValue':_0xc126('0x11')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xc126('0x2')]},'cc':{'type':Sequelize[_0xc126('0x12')]},'bcc':{'type':Sequelize[_0xc126('0x12')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xfbe2=['years','quarters','months','days','csv','pdf','xlsx','custom','default','BOOLEAN','TEXT','sequelize','exports','STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM'];(function(_0x2adaa9,_0x298fc0){var _0x2a3124=function(_0x31e45c){while(--_0x31e45c){_0x2adaa9['push'](_0x2adaa9['shift']());}};_0x2a3124(++_0x298fc0);}(_0xfbe2,0x12b));var _0x2fbe=function(_0x5a0b3b,_0x145ad4){_0x5a0b3b=_0x5a0b3b-0x0;var _0x398c01=_0xfbe2[_0x5a0b3b];return _0x398c01;};'use strict';var Sequelize=require(_0x2fbe('0x0'));module[_0x2fbe('0x1')]={'name':{'type':Sequelize[_0x2fbe('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x2fbe('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x2fbe('0x2')],'allowNull':![],'defaultValue':_0x2fbe('0x3')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0x2fbe('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x2fbe('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x2fbe('0x6')](_0x2fbe('0x7'),_0x2fbe('0x8'),_0x2fbe('0x9'),'weeks',_0x2fbe('0xa'),'hours','minutes'),'allowNull':![],'defaultValue':_0x2fbe('0xa')},'output':{'type':Sequelize[_0x2fbe('0x6')](_0x2fbe('0xb'),_0x2fbe('0xc'),_0x2fbe('0xd')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x2fbe('0x6')](_0x2fbe('0xe'),_0x2fbe('0xf')),'allowNull':![],'defaultValue':_0x2fbe('0xe')},'sendMail':{'type':Sequelize[_0x2fbe('0x10')],'defaultValue':![]},'email':{'type':Sequelize[_0x2fbe('0x2')]},'cc':{'type':Sequelize[_0x2fbe('0x11')]},'bcc':{'type':Sequelize[_0x2fbe('0x11')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index afc06d2..5253aff 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 _0xe2eb=['set','Content-Range','save','update','then','UserProfileResource','destroy','error','stack','name','map','Schedule','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','options','includeAll','include','rows','catch','show','keys','merge','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Scheduler','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','run','../../config/schedule','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xe2eb,0x16f));var _0xbe2e=function(_0x287756,_0x348e7a){_0x287756=_0x287756-0x0;var _0x1ce0d3=_0xe2eb[_0x287756];return _0x1ce0d3;};'use strict';var emlformat=require(_0xbe2e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbe2e('0x1'));var jsonpatch=require(_0xbe2e('0x2'));var rp=require(_0xbe2e('0x3'));var moment=require('moment');var BPromise=require(_0xbe2e('0x4'));var Mustache=require(_0xbe2e('0x5'));var util=require(_0xbe2e('0x6'));var path=require('path');var sox=require(_0xbe2e('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbe2e('0x8'));var squel=require(_0xbe2e('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xbe2e('0xa'));var toCsv=require(_0xbe2e('0xb'));var querystring=require(_0xbe2e('0xc'));var Papa=require(_0xbe2e('0xd'));var Redis=require(_0xbe2e('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xbe2e('0xf'));var hardwareService=require(_0xbe2e('0x10'));var logger=require(_0xbe2e('0x11'))('api');var utils=require(_0xbe2e('0x12'));var config=require(_0xbe2e('0x13'));var licenseUtil=require(_0xbe2e('0x14'));var db=require(_0xbe2e('0x15'))['db'];function respondWithStatusCode(_0x2e2feb,_0x2a2f43){_0x2a2f43=_0x2a2f43||0xcc;return function(_0x30fde9){if(_0x30fde9){return _0x2e2feb[_0xbe2e('0x16')](_0x2a2f43);}return _0x2e2feb['status'](_0x2a2f43)['end']();};}function respondWithResult(_0x139dd9,_0x525b50){_0x525b50=_0x525b50||0xc8;return function(_0x1cc84b){if(_0x1cc84b){return _0x139dd9[_0xbe2e('0x17')](_0x525b50)['json'](_0x1cc84b);}};}function respondWithFilteredResult(_0x5c60dd,_0x35c38d){return function(_0x21f580){if(_0x21f580){var _0x15338e=typeof _0x35c38d[_0xbe2e('0x18')]===_0xbe2e('0x19')&&typeof _0x35c38d[_0xbe2e('0x1a')]===_0xbe2e('0x19');var _0x109d36=_0x21f580['count'];var _0x4a75af=_0x15338e?0x0:_0x35c38d[_0xbe2e('0x18')];var _0x543b53=_0x15338e?_0x21f580[_0xbe2e('0x1b')]:_0x35c38d['offset']+_0x35c38d[_0xbe2e('0x1a')];var _0xf5e897;if(_0x543b53>=_0x109d36){_0x543b53=_0x109d36;_0xf5e897=0xc8;}else{_0xf5e897=0xce;}_0x5c60dd[_0xbe2e('0x17')](_0xf5e897);return _0x5c60dd[_0xbe2e('0x1c')](_0xbe2e('0x1d'),_0x4a75af+'-'+_0x543b53+'/'+_0x109d36)['json'](_0x21f580);}return null;};}function patchUpdates(_0x269ebc){return function(_0x4e9291){try{jsonpatch['apply'](_0x4e9291,_0x269ebc,!![]);}catch(_0x4db959){return BPromise['reject'](_0x4db959);}return _0x4e9291[_0xbe2e('0x1e')]();};}function saveUpdates(_0x3ab651,_0x82033b){return function(_0x2c90d4){if(_0x2c90d4){return _0x2c90d4[_0xbe2e('0x1f')](_0x3ab651)['then'](function(_0x6f43e5){return _0x6f43e5;});}return null;};}function removeEntity(_0x4e908f,_0x136b3d){return function(_0x13583f){if(_0x13583f){return _0x13583f['destroy']()[_0xbe2e('0x20')](function(){var _0x5edb60=_0x13583f['get']({'plain':!![]});var _0x4d934a='Scheduler';return db[_0xbe2e('0x21')][_0xbe2e('0x22')]({'where':{'type':_0x4d934a,'resourceId':_0x5edb60['id']}})['then'](function(){return _0x13583f;});})[_0xbe2e('0x20')](function(){_0x4e908f[_0xbe2e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21fbee,_0x50665c){return function(_0xd3df61){if(!_0xd3df61){_0x21fbee[_0xbe2e('0x16')](0x194);}return _0xd3df61;};}function handleError(_0xaf2137,_0x2763f5){_0x2763f5=_0x2763f5||0x1f4;return function(_0x104e30){logger[_0xbe2e('0x23')](_0x104e30[_0xbe2e('0x24')]);if(_0x104e30[_0xbe2e('0x25')]){delete _0x104e30[_0xbe2e('0x25')];}_0xaf2137[_0xbe2e('0x17')](_0x2763f5)['send'](_0x104e30);};}exports['index']=function(_0x5d6dfa,_0x1605c2){var _0xc98288={},_0x42a29d={},_0x45ed6d={'count':0x0,'rows':[]};var _0x52b681=_[_0xbe2e('0x26')](db[_0xbe2e('0x27')][_0xbe2e('0x28')],function(_0x189c2b){return{'name':_0x189c2b[_0xbe2e('0x29')],'type':_0x189c2b[_0xbe2e('0x2a')][_0xbe2e('0x2b')]};});_0x42a29d[_0xbe2e('0x2c')]=_[_0xbe2e('0x26')](_0x52b681,_0xbe2e('0x25'));_0x42a29d[_0xbe2e('0x2d')]=_['keys'](_0x5d6dfa['query']);_0x42a29d[_0xbe2e('0x2e')]=_[_0xbe2e('0x2f')](_0x42a29d['model'],_0x42a29d['query']);_0xc98288['attributes']=_[_0xbe2e('0x2f')](_0x42a29d[_0xbe2e('0x2c')],qs[_0xbe2e('0x30')](_0x5d6dfa[_0xbe2e('0x2d')][_0xbe2e('0x30')]));_0xc98288[_0xbe2e('0x31')]=_0xc98288[_0xbe2e('0x31')][_0xbe2e('0x32')]?_0xc98288[_0xbe2e('0x31')]:_0x42a29d[_0xbe2e('0x2c')];if(!_0x5d6dfa[_0xbe2e('0x2d')]['hasOwnProperty'](_0xbe2e('0x33'))){_0xc98288[_0xbe2e('0x1a')]=qs[_0xbe2e('0x1a')](_0x5d6dfa[_0xbe2e('0x2d')][_0xbe2e('0x1a')]);_0xc98288['offset']=qs[_0xbe2e('0x18')](_0x5d6dfa['query'][_0xbe2e('0x18')]);}_0xc98288['order']=qs[_0xbe2e('0x34')](_0x5d6dfa[_0xbe2e('0x2d')][_0xbe2e('0x34')]);_0xc98288[_0xbe2e('0x35')]=qs['filters'](_[_0xbe2e('0x36')](_0x5d6dfa[_0xbe2e('0x2d')],_0x42a29d[_0xbe2e('0x2e')]),_0x52b681);if(_0x5d6dfa['query'][_0xbe2e('0x37')]){_0xc98288['where']=_['merge'](_0xc98288['where'],{'$or':_[_0xbe2e('0x26')](_0x52b681,function(_0x3ebcdf){if(_0x3ebcdf[_0xbe2e('0x2a')]!=='VIRTUAL'){var _0x3879a4={};_0x3879a4[_0x3ebcdf['name']]={'$like':'%'+_0x5d6dfa[_0xbe2e('0x2d')][_0xbe2e('0x37')]+'%'};return _0x3879a4;}})});}_0xc98288=_['merge']({},_0xc98288,_0x5d6dfa[_0xbe2e('0x38')]);var _0x1d63f2={'where':_0xc98288['where']};return db[_0xbe2e('0x27')][_0xbe2e('0x1b')](_0x1d63f2)[_0xbe2e('0x20')](function(_0x3023b1){_0x45ed6d['count']=_0x3023b1;if(_0x5d6dfa[_0xbe2e('0x2d')][_0xbe2e('0x39')]){_0xc98288[_0xbe2e('0x3a')]=[{'all':!![]}];}return db[_0xbe2e('0x27')]['findAll'](_0xc98288);})[_0xbe2e('0x20')](function(_0x10f64b){_0x45ed6d[_0xbe2e('0x3b')]=_0x10f64b;return _0x45ed6d;})[_0xbe2e('0x20')](respondWithFilteredResult(_0x1605c2,_0xc98288))[_0xbe2e('0x3c')](handleError(_0x1605c2,null));};exports[_0xbe2e('0x3d')]=function(_0x40b495,_0x49284e){var _0xd3abff={'raw':![],'where':{'id':_0x40b495['params']['id']}},_0x59e53a={};_0x59e53a[_0xbe2e('0x2c')]=_[_0xbe2e('0x3e')](db[_0xbe2e('0x27')]['rawAttributes']);_0x59e53a[_0xbe2e('0x2d')]=_[_0xbe2e('0x3e')](_0x40b495[_0xbe2e('0x2d')]);_0x59e53a[_0xbe2e('0x2e')]=_['intersection'](_0x59e53a['model'],_0x59e53a[_0xbe2e('0x2d')]);_0xd3abff[_0xbe2e('0x31')]=_[_0xbe2e('0x2f')](_0x59e53a['model'],qs[_0xbe2e('0x30')](_0x40b495[_0xbe2e('0x2d')]['fields']));_0xd3abff[_0xbe2e('0x31')]=_0xd3abff[_0xbe2e('0x31')][_0xbe2e('0x32')]?_0xd3abff[_0xbe2e('0x31')]:_0x59e53a['model'];if(_0x40b495[_0xbe2e('0x2d')][_0xbe2e('0x39')]){_0xd3abff[_0xbe2e('0x3a')]=[{'all':!![]}];}_0xd3abff=_[_0xbe2e('0x3f')]({},_0xd3abff,_0x40b495[_0xbe2e('0x38')]);return db[_0xbe2e('0x27')][_0xbe2e('0x40')](_0xd3abff)['then'](handleEntityNotFound(_0x49284e,null))[_0xbe2e('0x20')](respondWithResult(_0x49284e,null))[_0xbe2e('0x3c')](handleError(_0x49284e,null));};exports[_0xbe2e('0x41')]=function(_0x5aac89,_0x4083a4){return db[_0xbe2e('0x27')]['create'](_0x5aac89[_0xbe2e('0x42')],{})['then'](function(_0x282d6a){var _0xe35f2a=_0x5aac89[_0xbe2e('0x43')][_0xbe2e('0x44')]({'plain':!![]});if(!_0xe35f2a)throw new Error(_0xbe2e('0x45'));if(_0xe35f2a[_0xbe2e('0x46')]===_0xbe2e('0x43')){var _0x531a41=_0x282d6a[_0xbe2e('0x44')]({'plain':!![]});var _0x35d40b=_0xbe2e('0x47');return db[_0xbe2e('0x48')][_0xbe2e('0x40')]({'where':{'name':_0x35d40b,'userProfileId':_0xe35f2a[_0xbe2e('0x49')]},'raw':!![]})[_0xbe2e('0x20')](function(_0x4d1f84){if(_0x4d1f84&&_0x4d1f84[_0xbe2e('0x4a')]===0x0){return db[_0xbe2e('0x21')][_0xbe2e('0x41')]({'name':_0x531a41[_0xbe2e('0x25')],'resourceId':_0x531a41['id'],'type':_0x4d1f84[_0xbe2e('0x25')],'sectionId':_0x4d1f84['id']},{})[_0xbe2e('0x20')](function(){return _0x282d6a;});}else{return _0x282d6a;}})[_0xbe2e('0x3c')](function(_0x122d33){logger['error'](_0xbe2e('0x4b'),_0x122d33);throw _0x122d33;});}return _0x282d6a;})[_0xbe2e('0x20')](respondWithResult(_0x4083a4,0xc9))['catch'](handleError(_0x4083a4,null));};exports['update']=function(_0x281c62,_0xcd1ba1){if(_0x281c62['body']['id']){delete _0x281c62['body']['id'];}return db[_0xbe2e('0x27')][_0xbe2e('0x40')]({'where':{'id':_0x281c62[_0xbe2e('0x4c')]['id']}})[_0xbe2e('0x20')](handleEntityNotFound(_0xcd1ba1,null))[_0xbe2e('0x20')](saveUpdates(_0x281c62[_0xbe2e('0x42')],null))[_0xbe2e('0x20')](respondWithResult(_0xcd1ba1,null))[_0xbe2e('0x3c')](handleError(_0xcd1ba1,null));};exports[_0xbe2e('0x22')]=function(_0x475b5e,_0x1187df){return db[_0xbe2e('0x27')][_0xbe2e('0x40')]({'where':{'id':_0x475b5e[_0xbe2e('0x4c')]['id']}})[_0xbe2e('0x20')](handleEntityNotFound(_0x1187df,null))['then'](removeEntity(_0x1187df,null))[_0xbe2e('0x3c')](handleError(_0x1187df,null));};exports[_0xbe2e('0x4d')]=function(_0x307949,_0x4e8aea,_0x4d6b5a){var _0x3812e4=require(_0xbe2e('0x4e'));return db[_0xbe2e('0x27')][_0xbe2e('0x40')]({'where':{'id':_0x307949['params']['id']},'raw':!![]})[_0xbe2e('0x20')](handleEntityNotFound(_0x4e8aea,null))[_0xbe2e('0x20')](function(){_0x3812e4['run'](_0x307949[_0xbe2e('0x4c')]['id']);})[_0xbe2e('0x20')](respondWithStatusCode(_0x4e8aea,null))[_0xbe2e('0x3c')](handleError(_0x4e8aea,null));}; \ No newline at end of file +var _0xb515=['sort','where','pick','merge','options','includeAll','catch','show','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Scheduler','UserProfileSection','name','update','params','../../config/schedule','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','sendStatus','error','stack','send','index','map','Schedule','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order'];(function(_0x2b1134,_0x16b713){var _0x3bd569=function(_0x246b9d){while(--_0x246b9d){_0x2b1134['push'](_0x2b1134['shift']());}};_0x3bd569(++_0x16b713);}(_0xb515,0x111));var _0x5b51=function(_0x368e09,_0x2c1517){_0x368e09=_0x368e09-0x0;var _0x14b7df=_0xb515[_0x368e09];return _0x14b7df;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5b51('0x0'));var jsonpatch=require(_0x5b51('0x1'));var rp=require(_0x5b51('0x2'));var moment=require(_0x5b51('0x3'));var BPromise=require(_0x5b51('0x4'));var Mustache=require(_0x5b51('0x5'));var util=require(_0x5b51('0x6'));var path=require(_0x5b51('0x7'));var sox=require(_0x5b51('0x8'));var csv=require(_0x5b51('0x9'));var ejs=require(_0x5b51('0xa'));var fs=require('fs');var fs_extra=require(_0x5b51('0xb'));var _=require('lodash');var squel=require(_0x5b51('0xc'));var crypto=require('crypto');var jsforce=require(_0x5b51('0xd'));var deskjs=require(_0x5b51('0xe'));var toCsv=require(_0x5b51('0x9'));var querystring=require(_0x5b51('0xf'));var Papa=require(_0x5b51('0x10'));var Redis=require(_0x5b51('0x11'));var authService=require(_0x5b51('0x12'));var qs=require(_0x5b51('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5b51('0x14'));var logger=require(_0x5b51('0x15'))(_0x5b51('0x16'));var utils=require('../../config/utils');var config=require(_0x5b51('0x17'));var licenseUtil=require(_0x5b51('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a7980,_0x1d0de7){_0x1d0de7=_0x1d0de7||0xcc;return function(_0x1b3cf5){if(_0x1b3cf5){return _0x3a7980['sendStatus'](_0x1d0de7);}return _0x3a7980[_0x5b51('0x19')](_0x1d0de7)[_0x5b51('0x1a')]();};}function respondWithResult(_0x2fb355,_0x13d7d7){_0x13d7d7=_0x13d7d7||0xc8;return function(_0x420b8b){if(_0x420b8b){return _0x2fb355['status'](_0x13d7d7)[_0x5b51('0x1b')](_0x420b8b);}};}function respondWithFilteredResult(_0x4f9a55,_0x451e4e){return function(_0x2211bc){if(_0x2211bc){var _0x57661f=typeof _0x451e4e[_0x5b51('0x1c')]===_0x5b51('0x1d')&&typeof _0x451e4e[_0x5b51('0x1e')]===_0x5b51('0x1d');var _0x41ebd6=_0x2211bc[_0x5b51('0x1f')];var _0xafa5c6=_0x57661f?0x0:_0x451e4e[_0x5b51('0x1c')];var _0xd4937e=_0x57661f?_0x2211bc[_0x5b51('0x1f')]:_0x451e4e[_0x5b51('0x1c')]+_0x451e4e['limit'];var _0x306a35;if(_0xd4937e>=_0x41ebd6){_0xd4937e=_0x41ebd6;_0x306a35=0xc8;}else{_0x306a35=0xce;}_0x4f9a55[_0x5b51('0x19')](_0x306a35);return _0x4f9a55[_0x5b51('0x20')](_0x5b51('0x21'),_0xafa5c6+'-'+_0xd4937e+'/'+_0x41ebd6)[_0x5b51('0x1b')](_0x2211bc);}return null;};}function patchUpdates(_0x2fda57){return function(_0x15b71e){try{jsonpatch[_0x5b51('0x22')](_0x15b71e,_0x2fda57,!![]);}catch(_0x53231d){return BPromise[_0x5b51('0x23')](_0x53231d);}return _0x15b71e[_0x5b51('0x24')]();};}function saveUpdates(_0x2f02cf,_0xe7395d){return function(_0x1f4bd2){if(_0x1f4bd2){return _0x1f4bd2['update'](_0x2f02cf)[_0x5b51('0x25')](function(_0x5efb38){return _0x5efb38;});}return null;};}function removeEntity(_0x2c6c0c,_0x23d499){return function(_0x510169){if(_0x510169){return _0x510169[_0x5b51('0x26')]()['then'](function(){var _0xcce0cd=_0x510169[_0x5b51('0x27')]({'plain':!![]});var _0x404bd7='Scheduler';return db[_0x5b51('0x28')][_0x5b51('0x26')]({'where':{'type':_0x404bd7,'resourceId':_0xcce0cd['id']}})[_0x5b51('0x25')](function(){return _0x510169;});})[_0x5b51('0x25')](function(){_0x2c6c0c[_0x5b51('0x19')](0xcc)[_0x5b51('0x1a')]();});}};}function handleEntityNotFound(_0x453fb1,_0x413b34){return function(_0xfd4a7a){if(!_0xfd4a7a){_0x453fb1[_0x5b51('0x29')](0x194);}return _0xfd4a7a;};}function handleError(_0x2793a8,_0x3c556e){_0x3c556e=_0x3c556e||0x1f4;return function(_0x36c8b6){logger[_0x5b51('0x2a')](_0x36c8b6[_0x5b51('0x2b')]);if(_0x36c8b6['name']){delete _0x36c8b6['name'];}_0x2793a8[_0x5b51('0x19')](_0x3c556e)[_0x5b51('0x2c')](_0x36c8b6);};}exports[_0x5b51('0x2d')]=function(_0x52eed3,_0x1b60cc){var _0x3235f3={},_0x963272={},_0x325e11={'count':0x0,'rows':[]};var _0x36be4b=_[_0x5b51('0x2e')](db[_0x5b51('0x2f')][_0x5b51('0x30')],function(_0x1eb3b7){return{'name':_0x1eb3b7[_0x5b51('0x31')],'type':_0x1eb3b7[_0x5b51('0x32')][_0x5b51('0x33')]};});_0x963272[_0x5b51('0x34')]=_[_0x5b51('0x2e')](_0x36be4b,'name');_0x963272['query']=_[_0x5b51('0x35')](_0x52eed3[_0x5b51('0x36')]);_0x963272[_0x5b51('0x37')]=_['intersection'](_0x963272['model'],_0x963272['query']);_0x3235f3['attributes']=_[_0x5b51('0x38')](_0x963272[_0x5b51('0x34')],qs[_0x5b51('0x39')](_0x52eed3[_0x5b51('0x36')]['fields']));_0x3235f3[_0x5b51('0x3a')]=_0x3235f3['attributes'][_0x5b51('0x3b')]?_0x3235f3[_0x5b51('0x3a')]:_0x963272[_0x5b51('0x34')];if(!_0x52eed3[_0x5b51('0x36')][_0x5b51('0x3c')](_0x5b51('0x3d'))){_0x3235f3[_0x5b51('0x1e')]=qs[_0x5b51('0x1e')](_0x52eed3[_0x5b51('0x36')]['limit']);_0x3235f3[_0x5b51('0x1c')]=qs[_0x5b51('0x1c')](_0x52eed3[_0x5b51('0x36')][_0x5b51('0x1c')]);}_0x3235f3[_0x5b51('0x3e')]=qs[_0x5b51('0x3f')](_0x52eed3[_0x5b51('0x36')][_0x5b51('0x3f')]);_0x3235f3[_0x5b51('0x40')]=qs[_0x5b51('0x37')](_[_0x5b51('0x41')](_0x52eed3[_0x5b51('0x36')],_0x963272[_0x5b51('0x37')]),_0x36be4b);if(_0x52eed3[_0x5b51('0x36')]['filter']){_0x3235f3[_0x5b51('0x40')]=_[_0x5b51('0x42')](_0x3235f3['where'],{'$or':_[_0x5b51('0x2e')](_0x36be4b,function(_0x58553f){if(_0x58553f[_0x5b51('0x32')]!=='VIRTUAL'){var _0xb4ba94={};_0xb4ba94[_0x58553f['name']]={'$like':'%'+_0x52eed3[_0x5b51('0x36')]['filter']+'%'};return _0xb4ba94;}})});}_0x3235f3=_['merge']({},_0x3235f3,_0x52eed3[_0x5b51('0x43')]);var _0x26d1d4={'where':_0x3235f3[_0x5b51('0x40')]};return db['Schedule'][_0x5b51('0x1f')](_0x26d1d4)[_0x5b51('0x25')](function(_0x3811a4){_0x325e11['count']=_0x3811a4;if(_0x52eed3[_0x5b51('0x36')][_0x5b51('0x44')]){_0x3235f3['include']=[{'all':!![]}];}return db[_0x5b51('0x2f')]['findAll'](_0x3235f3);})[_0x5b51('0x25')](function(_0x28544a){_0x325e11['rows']=_0x28544a;return _0x325e11;})[_0x5b51('0x25')](respondWithFilteredResult(_0x1b60cc,_0x3235f3))[_0x5b51('0x45')](handleError(_0x1b60cc,null));};exports[_0x5b51('0x46')]=function(_0x9ea03b,_0x57e5d9){var _0x33612a={'raw':![],'where':{'id':_0x9ea03b['params']['id']}},_0x42a8c6={};_0x42a8c6[_0x5b51('0x34')]=_[_0x5b51('0x35')](db['Schedule'][_0x5b51('0x30')]);_0x42a8c6[_0x5b51('0x36')]=_[_0x5b51('0x35')](_0x9ea03b['query']);_0x42a8c6[_0x5b51('0x37')]=_[_0x5b51('0x38')](_0x42a8c6['model'],_0x42a8c6[_0x5b51('0x36')]);_0x33612a[_0x5b51('0x3a')]=_[_0x5b51('0x38')](_0x42a8c6[_0x5b51('0x34')],qs[_0x5b51('0x39')](_0x9ea03b[_0x5b51('0x36')][_0x5b51('0x39')]));_0x33612a[_0x5b51('0x3a')]=_0x33612a[_0x5b51('0x3a')][_0x5b51('0x3b')]?_0x33612a[_0x5b51('0x3a')]:_0x42a8c6[_0x5b51('0x34')];if(_0x9ea03b['query'][_0x5b51('0x44')]){_0x33612a[_0x5b51('0x47')]=[{'all':!![]}];}_0x33612a=_[_0x5b51('0x42')]({},_0x33612a,_0x9ea03b['options']);return db[_0x5b51('0x2f')][_0x5b51('0x48')](_0x33612a)[_0x5b51('0x25')](handleEntityNotFound(_0x57e5d9,null))[_0x5b51('0x25')](respondWithResult(_0x57e5d9,null))[_0x5b51('0x45')](handleError(_0x57e5d9,null));};exports[_0x5b51('0x49')]=function(_0x499071,_0x25c960){return db['Schedule'][_0x5b51('0x49')](_0x499071[_0x5b51('0x4a')],{})[_0x5b51('0x25')](function(_0x49707e){var _0x49457b=_0x499071['user'][_0x5b51('0x27')]({'plain':!![]});if(!_0x49457b)throw new Error(_0x5b51('0x4b'));if(_0x49457b[_0x5b51('0x4c')]===_0x5b51('0x4d')){var _0x453945=_0x49707e[_0x5b51('0x27')]({'plain':!![]});var _0x3b0290=_0x5b51('0x4e');return db[_0x5b51('0x4f')][_0x5b51('0x48')]({'where':{'name':_0x3b0290,'userProfileId':_0x49457b['userProfileId']},'raw':!![]})[_0x5b51('0x25')](function(_0x22f0e4){if(_0x22f0e4&&_0x22f0e4['autoAssociation']===0x0){return db['UserProfileResource'][_0x5b51('0x49')]({'name':_0x453945['name'],'resourceId':_0x453945['id'],'type':_0x22f0e4[_0x5b51('0x50')],'sectionId':_0x22f0e4['id']},{})['then'](function(){return _0x49707e;});}else{return _0x49707e;}})[_0x5b51('0x45')](function(_0x1cc2bb){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1cc2bb);throw _0x1cc2bb;});}return _0x49707e;})[_0x5b51('0x25')](respondWithResult(_0x25c960,0xc9))[_0x5b51('0x45')](handleError(_0x25c960,null));};exports[_0x5b51('0x51')]=function(_0x2bd04d,_0x4c5319){if(_0x2bd04d['body']['id']){delete _0x2bd04d[_0x5b51('0x4a')]['id'];}return db[_0x5b51('0x2f')][_0x5b51('0x48')]({'where':{'id':_0x2bd04d[_0x5b51('0x52')]['id']}})[_0x5b51('0x25')](handleEntityNotFound(_0x4c5319,null))[_0x5b51('0x25')](saveUpdates(_0x2bd04d['body'],null))[_0x5b51('0x25')](respondWithResult(_0x4c5319,null))[_0x5b51('0x45')](handleError(_0x4c5319,null));};exports[_0x5b51('0x26')]=function(_0x3ae769,_0x29effe){return db[_0x5b51('0x2f')][_0x5b51('0x48')]({'where':{'id':_0x3ae769[_0x5b51('0x52')]['id']}})['then'](handleEntityNotFound(_0x29effe,null))[_0x5b51('0x25')](removeEntity(_0x29effe,null))[_0x5b51('0x45')](handleError(_0x29effe,null));};exports['run']=function(_0x403cdc,_0x5bad97,_0x1f46c6){var _0x25d7db=require(_0x5b51('0x53'));return db[_0x5b51('0x2f')]['find']({'where':{'id':_0x403cdc[_0x5b51('0x52')]['id']},'raw':!![]})[_0x5b51('0x25')](handleEntityNotFound(_0x5bad97,null))[_0x5b51('0x25')](function(){_0x25d7db['run'](_0x403cdc[_0x5b51('0x52')]['id']);})[_0x5b51('0x25')](respondWithStatusCode(_0x5bad97,null))[_0x5b51('0x45')](handleError(_0x5bad97,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 72188c0..93aba22 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 _0xf7ca=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./schedule.attributes','exports','Schedule','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf7ca,0x1ac));var _0xaf7c=function(_0x1929e6,_0x4db04d){_0x1929e6=_0x1929e6-0x0;var _0x35c099=_0xf7ca[_0x1929e6];return _0x35c099;};'use strict';var _=require('lodash');var util=require(_0xaf7c('0x0'));var logger=require(_0xaf7c('0x1'))(_0xaf7c('0x2'));var moment=require(_0xaf7c('0x3'));var BPromise=require(_0xaf7c('0x4'));var rp=require(_0xaf7c('0x5'));var fs=require('fs');var path=require(_0xaf7c('0x6'));var rimraf=require(_0xaf7c('0x7'));var config=require('../../config/environment');var attributes=require(_0xaf7c('0x8'));module[_0xaf7c('0x9')]=function(_0x569dd7,_0x39e458){return _0x569dd7['define'](_0xaf7c('0xa'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x66c9=['path','rimraf','../../config/environment','./schedule.attributes','exports','define','tools_schedules','lodash','util','../../config/logger','api','moment'];(function(_0x398481,_0x3de964){var _0x3a4d22=function(_0x359ad4){while(--_0x359ad4){_0x398481['push'](_0x398481['shift']());}};_0x3a4d22(++_0x3de964);}(_0x66c9,0x187));var _0x966c=function(_0x5acf24,_0x325870){_0x5acf24=_0x5acf24-0x0;var _0xd55a8c=_0x66c9[_0x5acf24];return _0xd55a8c;};'use strict';var _=require(_0x966c('0x0'));var util=require(_0x966c('0x1'));var logger=require(_0x966c('0x2'))(_0x966c('0x3'));var moment=require(_0x966c('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x966c('0x5'));var rimraf=require(_0x966c('0x6'));var config=require(_0x966c('0x7'));var attributes=require(_0x966c('0x8'));module[_0x966c('0x9')]=function(_0x79daf2,_0xfe0415){return _0x79daf2[_0x966c('0xa')]('Schedule',attributes,{'tableName':_0x966c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index 7921b8f..b2c0070 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 _0xaabc=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','ioredis'];(function(_0x55345b,_0x277875){var _0x397cf0=function(_0x535451){while(--_0x535451){_0x55345b['push'](_0x55345b['shift']());}};_0x397cf0(++_0x277875);}(_0xaabc,0x1a1));var _0xcaab=function(_0xe7d07d,_0x52e4e3){_0xe7d07d=_0xe7d07d-0x0;var _0x229e46=_0xaabc[_0xe7d07d];return _0x229e46;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xcaab('0x0'));var BPromise=require(_0xcaab('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcaab('0x2'));var db=require(_0xcaab('0x3'))['db'];var utils=require(_0xcaab('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xcaab('0x5'));var jayson=require(_0xcaab('0x6'));var client=jayson['client'][_0xcaab('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xad272b,_0x40cbcd,_0x239c9e){return new BPromise(function(_0x11a056,_0x143e86){return client[_0xcaab('0x8')](_0xad272b,_0x239c9e)['then'](function(_0x168702){logger[_0xcaab('0x9')](_0xcaab('0xa'),_0x40cbcd,_0xcaab('0xb'));logger[_0xcaab('0xc')](_0xcaab('0xd'),_0x40cbcd,_0xcaab('0xb'),JSON[_0xcaab('0xe')](_0x168702));if(_0x168702['error']){if(_0x168702[_0xcaab('0xf')][_0xcaab('0x10')]===0x1f4){logger[_0xcaab('0xf')](_0xcaab('0xa'),_0x40cbcd,_0x168702[_0xcaab('0xf')][_0xcaab('0x11')]);return _0x143e86(_0x168702[_0xcaab('0xf')]['message']);}logger['error'](_0xcaab('0xa'),_0x40cbcd,_0x168702[_0xcaab('0xf')][_0xcaab('0x11')]);return _0x11a056(_0x168702[_0xcaab('0xf')][_0xcaab('0x11')]);}else{logger[_0xcaab('0x9')](_0xcaab('0xa'),_0x40cbcd,'request\x20sent');_0x11a056(_0x168702[_0xcaab('0x12')][_0xcaab('0x11')]);}})[_0xcaab('0x13')](function(_0x36c68a){logger[_0xcaab('0xf')](_0xcaab('0xa'),_0x40cbcd,_0x36c68a);_0x143e86(_0x36c68a);});});} \ No newline at end of file +var _0x963c=['catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','Schedule,\x20%s,\x20%s','result'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x963c,0x97));var _0xc963=function(_0x19906e,_0x1a2808){_0x19906e=_0x19906e-0x0;var _0x3f1aea=_0x963c[_0x19906e];return _0x3f1aea;};'use strict';var _=require('lodash');var util=require(_0xc963('0x0'));var moment=require(_0xc963('0x1'));var BPromise=require(_0xc963('0x2'));var rs=require(_0xc963('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc963('0x4'))['db'];var utils=require(_0xc963('0x5'));var logger=require(_0xc963('0x6'))(_0xc963('0x7'));var config=require(_0xc963('0x8'));var jayson=require(_0xc963('0x9'));var client=jayson[_0xc963('0xa')][_0xc963('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x422f3b,_0x5506c6,_0xb4084f){return new BPromise(function(_0x259e3e,_0x153bba){return client[_0xc963('0xc')](_0x422f3b,_0xb4084f)[_0xc963('0xd')](function(_0x3d7b0a){logger['info']('Schedule,\x20%s,\x20%s',_0x5506c6,_0xc963('0xe'));logger[_0xc963('0xf')](_0xc963('0x10'),_0x5506c6,'request\x20sent',JSON[_0xc963('0x11')](_0x3d7b0a));if(_0x3d7b0a[_0xc963('0x12')]){if(_0x3d7b0a[_0xc963('0x12')][_0xc963('0x13')]===0x1f4){logger[_0xc963('0x12')]('Schedule,\x20%s,\x20%s',_0x5506c6,_0x3d7b0a[_0xc963('0x12')][_0xc963('0x14')]);return _0x153bba(_0x3d7b0a['error']['message']);}logger[_0xc963('0x12')]('Schedule,\x20%s,\x20%s',_0x5506c6,_0x3d7b0a[_0xc963('0x12')][_0xc963('0x14')]);return _0x259e3e(_0x3d7b0a['error'][_0xc963('0x14')]);}else{logger[_0xc963('0x15')](_0xc963('0x16'),_0x5506c6,'request\x20sent');_0x259e3e(_0x3d7b0a[_0xc963('0x17')]['message']);}})[_0xc963('0x18')](function(_0x77e7a){logger['error']('Schedule,\x20%s,\x20%s',_0x5506c6,_0x77e7a);_0x153bba(_0x77e7a);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 0bf3aef..390590b 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 _0x4f01=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','describe','/:id','show','/:id/download','post','put','update','delete','destroy','exports','multer','express','Router'];(function(_0xb833b1,_0x1c3d3f){var _0x1ab87a=function(_0x1c9f6c){while(--_0x1c9f6c){_0xb833b1['push'](_0xb833b1['shift']());}};_0x1ab87a(++_0x1c3d3f);}(_0x4f01,0x1e0));var _0x14f0=function(_0x4bedf5,_0x243cfa){_0x4bedf5=_0x4bedf5-0x0;var _0x49a217=_0x4f01[_0x4bedf5];return _0x49a217;};'use strict';var multer=require(_0x14f0('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x14f0('0x1'));var router=express[_0x14f0('0x2')]();var fs_extra=require(_0x14f0('0x3'));var auth=require(_0x14f0('0x4'));var interaction=require(_0x14f0('0x5'));var config=require(_0x14f0('0x6'));var controller=require(_0x14f0('0x7'));router[_0x14f0('0x8')]('/',auth[_0x14f0('0x9')](),controller[_0x14f0('0xa')]);router['get']('/describe',auth[_0x14f0('0x9')](),controller[_0x14f0('0xb')]);router[_0x14f0('0x8')](_0x14f0('0xc'),auth[_0x14f0('0x9')](),controller[_0x14f0('0xd')]);router[_0x14f0('0x8')](_0x14f0('0xe'),auth[_0x14f0('0x9')](),controller['download']);router[_0x14f0('0xf')]('/',auth[_0x14f0('0x9')](),controller['create']);router[_0x14f0('0x10')](_0x14f0('0xc'),auth[_0x14f0('0x9')](),controller[_0x14f0('0x11')]);router[_0x14f0('0x12')](_0x14f0('0xc'),auth[_0x14f0('0x9')](),controller[_0x14f0('0x13')]);module[_0x14f0('0x14')]=router; \ No newline at end of file +var _0x776a=['/:id','show','/:id/download','download','post','create','destroy','exports','util','connect-timeout','Router','../../components/auth/service','./screenRecording.controller','get','isAuthenticated','index'];(function(_0x4839a2,_0x1f67eb){var _0x465147=function(_0x4eae2e){while(--_0x4eae2e){_0x4839a2['push'](_0x4839a2['shift']());}};_0x465147(++_0x1f67eb);}(_0x776a,0x1b8));var _0xa776=function(_0x5ab921,_0x32dff2){_0x5ab921=_0x5ab921-0x0;var _0x3da787=_0x776a[_0x5ab921];return _0x3da787;};'use strict';var multer=require('multer');var util=require(_0xa776('0x0'));var path=require('path');var timeout=require(_0xa776('0x1'));var express=require('express');var router=express[_0xa776('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xa776('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa776('0x4'));router[_0xa776('0x5')]('/',auth[_0xa776('0x6')](),controller[_0xa776('0x7')]);router['get']('/describe',auth[_0xa776('0x6')](),controller['describe']);router['get'](_0xa776('0x8'),auth[_0xa776('0x6')](),controller[_0xa776('0x9')]);router[_0xa776('0x5')](_0xa776('0xa'),auth['isAuthenticated'](),controller[_0xa776('0xb')]);router[_0xa776('0xc')]('/',auth[_0xa776('0x6')](),controller[_0xa776('0xd')]);router['put'](_0xa776('0x8'),auth[_0xa776('0x6')](),controller['update']);router['delete']('/:id',auth[_0xa776('0x6')](),controller[_0xa776('0xe')]);module[_0xa776('0xf')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 4b920a6..d937b33 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 _0xd1f8=['path','../../config/environment','VIRTUAL','value','getDataValue','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','format','MM-DD-YYYY\x20HH:mm','DATE','toString','createdAt','updatedAt','sequelize','moment'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xd1f8,0x18e));var _0x8d1f=function(_0x4914ad,_0x551a18){_0x4914ad=_0x4914ad-0x0;var _0x3cd61f=_0xd1f8[_0x4914ad];return _0x3cd61f;};'use strict';var Sequelize=require(_0x8d1f('0x0'));var moment=require(_0x8d1f('0x1'));var path=require(_0x8d1f('0x2'));var config=require(_0x8d1f('0x3'));module['exports']={'format':{'type':Sequelize[_0x8d1f('0x4')],'get':function(){return this['getDataValue'](_0x8d1f('0x5'))?path['extname'](this[_0x8d1f('0x6')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0x8d1f('0x7')]},'channel':{'type':Sequelize[_0x8d1f('0x7')]},'value':{'type':Sequelize['STRING'],'set':function(_0x8bd2b8){var _0x140754=_0x8bd2b8[_0x8d1f('0x8')](/\\/g,'/');this[_0x8d1f('0x9')](_0x8d1f('0x5'),_0x140754);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x8d1f('0xa')],'set':function(_0x426673){this['setDataValue'](_0x8d1f('0xb'),moment()[_0x8d1f('0xc')](_0x426673,'ms'));this[_0x8d1f('0x9')](_0x8d1f('0xd'),moment());this[_0x8d1f('0x9')]('duration',_0x426673);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x8d1f('0x6')]('startedAt'))[_0x8d1f('0xe')](_0x8d1f('0xf'))['toString']();}},'closedAt':{'type':Sequelize[_0x8d1f('0x10')],'get':function(){return moment(this[_0x8d1f('0x6')](_0x8d1f('0xd')))['format'](_0x8d1f('0xf'))[_0x8d1f('0x11')]();}},'createdAt':{'type':Sequelize[_0x8d1f('0x10')],'get':function(){return moment(this[_0x8d1f('0x6')](_0x8d1f('0x12')))[_0x8d1f('0xe')](_0x8d1f('0xf'))[_0x8d1f('0x11')]();}},'updatedAt':{'type':Sequelize[_0x8d1f('0x10')],'get':function(){return moment(this[_0x8d1f('0x6')](_0x8d1f('0x13')))[_0x8d1f('0xe')](_0x8d1f('0xf'))[_0x8d1f('0x11')]();}}}; \ No newline at end of file +var _0x288a=['setDataValue','INTEGER','startedAt','subtract','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','closedAt','createdAt','updatedAt','moment','path','../../config/environment','exports','value','getDataValue','STRING'];(function(_0x5f3aa6,_0x12f51a){var _0x2119b3=function(_0x38c561){while(--_0x38c561){_0x5f3aa6['push'](_0x5f3aa6['shift']());}};_0x2119b3(++_0x12f51a);}(_0x288a,0x188));var _0xa288=function(_0x5f124a,_0x34e5d2){_0x5f124a=_0x5f124a-0x0;var _0x3717c1=_0x288a[_0x5f124a];return _0x3717c1;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa288('0x0'));var path=require(_0xa288('0x1'));var config=require(_0xa288('0x2'));module[_0xa288('0x3')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0xa288('0x4'))?path['extname'](this[_0xa288('0x5')](_0xa288('0x4'))):undefined;}},'interactionid':{'type':Sequelize[_0xa288('0x6')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0xa288('0x6')],'set':function(_0xaee90c){var _0x156720=_0xaee90c['replace'](/\\/g,'/');this[_0xa288('0x7')](_0xa288('0x4'),_0x156720);}},'rating':{'type':Sequelize[_0xa288('0x8')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xa288('0x8')],'set':function(_0x1a0c06){this[_0xa288('0x7')](_0xa288('0x9'),moment()[_0xa288('0xa')](_0x1a0c06,'ms'));this['setDataValue']('closedAt',moment());this['setDataValue'](_0xa288('0xb'),_0x1a0c06);}},'startedAt':{'type':Sequelize[_0xa288('0xc')],'get':function(){return moment(this['getDataValue'](_0xa288('0x9')))[_0xa288('0xd')](_0xa288('0xe'))[_0xa288('0xf')]();}},'closedAt':{'type':Sequelize[_0xa288('0xc')],'get':function(){return moment(this[_0xa288('0x5')](_0xa288('0x10')))[_0xa288('0xd')](_0xa288('0xe'))[_0xa288('0xf')]();}},'createdAt':{'type':Sequelize[_0xa288('0xc')],'get':function(){return moment(this[_0xa288('0x5')](_0xa288('0x11')))[_0xa288('0xd')](_0xa288('0xe'))[_0xa288('0xf')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xa288('0x5')](_0xa288('0x12')))[_0xa288('0xd')](_0xa288('0xe'))[_0xa288('0xf')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 65bed22..bbdadf1 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 _0x1cb9=['ValidationError','filename','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','filters','intersection','fields','attributes','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','includeAll','findAll','rows','catch','show','keys','length','include','options','find','create','body','duration','createdAt','value','params','describe','download','../../components/encryptor','uniqueid','join','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','recording','root','Sequelize'];(function(_0x39b316,_0x3def1e){var _0x182ab1=function(_0x3e4f10){while(--_0x3e4f10){_0x39b316['push'](_0x39b316['shift']());}};_0x182ab1(++_0x3def1e);}(_0x1cb9,0x14e));var _0x91cb=function(_0x3f4850,_0x10f299){_0x3f4850=_0x3f4850-0x0;var _0x655cd8=_0x1cb9[_0x3f4850];return _0x655cd8;};'use strict';var emlformat=require(_0x91cb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x91cb('0x1'));var jsonpatch=require(_0x91cb('0x2'));var rp=require(_0x91cb('0x3'));var moment=require(_0x91cb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x91cb('0x5'));var util=require(_0x91cb('0x6'));var path=require('path');var sox=require(_0x91cb('0x7'));var csv=require(_0x91cb('0x8'));var ejs=require(_0x91cb('0x9'));var fs=require('fs');var fs_extra=require(_0x91cb('0xa'));var _=require(_0x91cb('0xb'));var squel=require(_0x91cb('0xc'));var crypto=require('crypto');var jsforce=require(_0x91cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x91cb('0x8'));var querystring=require('querystring');var Papa=require(_0x91cb('0xe'));var Redis=require(_0x91cb('0xf'));var authService=require(_0x91cb('0x10'));var qs=require(_0x91cb('0x11'));var as=require(_0x91cb('0x12'));var hardwareService=require(_0x91cb('0x13'));var logger=require(_0x91cb('0x14'))(_0x91cb('0x15'));var utils=require(_0x91cb('0x16'));var config=require(_0x91cb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x91cb('0x18'))['db'];function respondWithStatusCode(_0x366f09,_0x4ba2f2){_0x4ba2f2=_0x4ba2f2||0xcc;return function(_0x20e6e0){if(_0x20e6e0){return _0x366f09[_0x91cb('0x19')](_0x4ba2f2);}return _0x366f09[_0x91cb('0x1a')](_0x4ba2f2)[_0x91cb('0x1b')]();};}function respondWithResult(_0x4a7d45,_0x4cc6ef){_0x4cc6ef=_0x4cc6ef||0xc8;return function(_0x4aae25){if(_0x4aae25){return _0x4a7d45[_0x91cb('0x1a')](_0x4cc6ef)['json'](_0x4aae25);}};}function respondWithFilteredResult(_0x528f73,_0x576369){return function(_0xc3629e){if(_0xc3629e){var _0x347980=typeof _0x576369['offset']===_0x91cb('0x1c')&&typeof _0x576369[_0x91cb('0x1d')]==='undefined';var _0xc594e3=_0xc3629e[_0x91cb('0x1e')];var _0x1cd34b=_0x347980?0x0:_0x576369[_0x91cb('0x1f')];var _0x5cc1c3=_0x347980?_0xc3629e[_0x91cb('0x1e')]:_0x576369[_0x91cb('0x1f')]+_0x576369['limit'];var _0x123847;if(_0x5cc1c3>=_0xc594e3){_0x5cc1c3=_0xc594e3;_0x123847=0xc8;}else{_0x123847=0xce;}_0x528f73['status'](_0x123847);return _0x528f73['set'](_0x91cb('0x20'),_0x1cd34b+'-'+_0x5cc1c3+'/'+_0xc594e3)[_0x91cb('0x21')](_0xc3629e);}return null;};}function patchUpdates(_0x56e409){return function(_0x51a1d5){try{jsonpatch['apply'](_0x51a1d5,_0x56e409,!![]);}catch(_0x438162){return BPromise[_0x91cb('0x22')](_0x438162);}return _0x51a1d5[_0x91cb('0x23')]();};}function saveUpdates(_0x1dbee2,_0x5c6a15){return function(_0x45c4b3){if(_0x45c4b3){return _0x45c4b3[_0x91cb('0x24')](_0x1dbee2)[_0x91cb('0x25')](function(_0x55fa78){return _0x55fa78;});}return null;};}function removeEntity(_0x26f18f,_0x1a7a54){return function(_0x2447e7){if(_0x2447e7){return _0x2447e7[_0x91cb('0x26')]()[_0x91cb('0x25')](function(){_0x26f18f[_0x91cb('0x1a')](0xcc)[_0x91cb('0x1b')]();});}};}function handleEntityNotFound(_0x423c4f,_0x264e9b){return function(_0x4c8438){if(!_0x4c8438){_0x423c4f['sendStatus'](0x194);}return _0x4c8438;};}function handleError(_0x234eb1,_0x554350){_0x554350=_0x554350||0x1f4;return function(_0x1c67d2){logger[_0x91cb('0x27')](_0x1c67d2[_0x91cb('0x28')]);if(_0x1c67d2['name']){delete _0x1c67d2[_0x91cb('0x29')];}_0x234eb1['status'](_0x554350)[_0x91cb('0x2a')](_0x1c67d2);};}exports[_0x91cb('0x2b')]=function(_0x3b3ee6,_0x2fb473){var _0x468908={},_0x504275={},_0x2f04a3={'count':0x0,'rows':[]};var _0x52670a=_[_0x91cb('0x2c')](db[_0x91cb('0x2d')][_0x91cb('0x2e')],function(_0x4944bd){return{'name':_0x4944bd[_0x91cb('0x2f')],'type':_0x4944bd[_0x91cb('0x30')][_0x91cb('0x31')]};});_0x504275[_0x91cb('0x32')]=_[_0x91cb('0x33')](_[_0x91cb('0x2c')](_0x52670a,_0x91cb('0x29')),[_0x91cb('0x34')]);_0x504275[_0x91cb('0x35')]=_['keys'](_0x3b3ee6[_0x91cb('0x35')]);_0x504275[_0x91cb('0x36')]=_[_0x91cb('0x37')](_0x504275[_0x91cb('0x32')],_0x504275[_0x91cb('0x35')]);_0x468908['attributes']=_[_0x91cb('0x37')](_0x504275[_0x91cb('0x32')],qs[_0x91cb('0x38')](_0x3b3ee6[_0x91cb('0x35')][_0x91cb('0x38')]));_0x468908['attributes']=_0x468908[_0x91cb('0x39')]['length']?_0x468908['attributes']:_0x504275['model'];if(!_0x3b3ee6[_0x91cb('0x35')]['hasOwnProperty'](_0x91cb('0x3a'))){_0x468908['limit']=qs['limit'](_0x3b3ee6[_0x91cb('0x35')][_0x91cb('0x1d')]);_0x468908[_0x91cb('0x1f')]=qs[_0x91cb('0x1f')](_0x3b3ee6[_0x91cb('0x35')]['offset']);}_0x468908[_0x91cb('0x3b')]=qs[_0x91cb('0x3c')](_0x3b3ee6[_0x91cb('0x35')][_0x91cb('0x3c')]);_0x468908['where']=qs['filters'](_[_0x91cb('0x3d')](_0x3b3ee6[_0x91cb('0x35')],_0x504275['filters']),_0x52670a);if(_0x3b3ee6[_0x91cb('0x35')][_0x91cb('0x3e')]){_0x468908['where']=_[_0x91cb('0x3f')](_0x468908[_0x91cb('0x40')],{'$or':_['map'](_0x52670a,function(_0x43d4fe){if(_0x43d4fe['type']!==_0x91cb('0x41')){var _0xabe6a3={};_0xabe6a3[_0x43d4fe[_0x91cb('0x29')]]={'$like':'%'+_0x3b3ee6[_0x91cb('0x35')][_0x91cb('0x3e')]+'%'};return _0xabe6a3;}})});}_0x468908=_[_0x91cb('0x3f')]({},_0x468908,_0x3b3ee6['options']);var _0xa90111={'where':_0x468908[_0x91cb('0x40')]};return db['ScreenRecording'][_0x91cb('0x1e')](_0xa90111)['then'](function(_0x2c6102){_0x2f04a3[_0x91cb('0x1e')]=_0x2c6102;if(_0x3b3ee6[_0x91cb('0x35')][_0x91cb('0x42')]){_0x468908['include']=[{'all':!![]}];}return db[_0x91cb('0x2d')][_0x91cb('0x43')](_0x468908);})[_0x91cb('0x25')](function(_0x37e777){_0x2f04a3[_0x91cb('0x44')]=_0x37e777;return _0x2f04a3;})[_0x91cb('0x25')](respondWithFilteredResult(_0x2fb473,_0x468908))[_0x91cb('0x45')](handleError(_0x2fb473,null));};exports[_0x91cb('0x46')]=function(_0x325dca,_0x3cc4c1){var _0x49bc42={'raw':![],'where':{'id':_0x325dca['params']['id']}},_0x16993f={};_0x16993f[_0x91cb('0x32')]=_['keys'](db[_0x91cb('0x2d')]['rawAttributes']);_0x16993f[_0x91cb('0x35')]=_[_0x91cb('0x47')](_0x325dca[_0x91cb('0x35')]);_0x16993f[_0x91cb('0x36')]=_['intersection'](_0x16993f[_0x91cb('0x32')],_0x16993f[_0x91cb('0x35')]);_0x49bc42['attributes']=_[_0x91cb('0x37')](_0x16993f[_0x91cb('0x32')],qs[_0x91cb('0x38')](_0x325dca[_0x91cb('0x35')][_0x91cb('0x38')]));_0x49bc42[_0x91cb('0x39')]=_0x49bc42[_0x91cb('0x39')][_0x91cb('0x48')]?_0x49bc42[_0x91cb('0x39')]:_0x16993f['model'];if(_0x325dca[_0x91cb('0x35')][_0x91cb('0x42')]){_0x49bc42[_0x91cb('0x49')]=[{'all':!![]}];}_0x49bc42=_[_0x91cb('0x3f')]({},_0x49bc42,_0x325dca[_0x91cb('0x4a')]);return db[_0x91cb('0x2d')][_0x91cb('0x4b')](_0x49bc42)[_0x91cb('0x25')](handleEntityNotFound(_0x3cc4c1,null))['then'](respondWithResult(_0x3cc4c1,null))[_0x91cb('0x45')](handleError(_0x3cc4c1,null));};exports[_0x91cb('0x4c')]=function(_0x2b8b7f,_0x3b8cfd){return db['ScreenRecording'][_0x91cb('0x4c')](_0x2b8b7f[_0x91cb('0x4d')],{})['then'](respondWithResult(_0x3b8cfd,0xc9))[_0x91cb('0x45')](handleError(_0x3b8cfd,null));};exports['update']=function(_0x2c419b,_0x4c0acd){if(_0x2c419b['body']['id']){delete _0x2c419b['body']['id'];}delete _0x2c419b[_0x91cb('0x4d')][_0x91cb('0x4e')];delete _0x2c419b[_0x91cb('0x4d')][_0x91cb('0x4f')];delete _0x2c419b[_0x91cb('0x4d')]['closedAt'];delete _0x2c419b['body'][_0x91cb('0x50')];return db[_0x91cb('0x2d')][_0x91cb('0x4b')]({'where':{'id':_0x2c419b[_0x91cb('0x51')]['id']}})['then'](handleEntityNotFound(_0x4c0acd,null))['then'](saveUpdates(_0x2c419b['body'],null))[_0x91cb('0x25')](respondWithResult(_0x4c0acd,null))['catch'](handleError(_0x4c0acd,null));};exports[_0x91cb('0x52')]=function(_0x4aa670,_0x21463a){return db[_0x91cb('0x2d')][_0x91cb('0x52')]()[_0x91cb('0x25')](respondWithResult(_0x21463a,null))[_0x91cb('0x45')](handleError(_0x21463a,null));};exports[_0x91cb('0x53')]=function(_0x3ec250,_0x30fd4e,_0xff7c3f){var _0x20fc0a=require(_0x91cb('0x54'));var _0x5752ed=![];var _0x1e445a={};if(_0x3ec250[_0x91cb('0x35')]['type']&&_0x3ec250[_0x91cb('0x35')][_0x91cb('0x30')]==='uniqueid'){_0x1e445a[_0x91cb('0x55')]=_0x3ec250[_0x91cb('0x51')]['id'];}else{_0x1e445a['id']=_0x3ec250[_0x91cb('0x51')]['id'];}return db[_0x91cb('0x2d')][_0x91cb('0x4b')]({'where':_0x1e445a,'attributes':['id',_0x91cb('0x50')],'raw':!![]})[_0x91cb('0x25')](handleEntityNotFound(_0x30fd4e,null))[_0x91cb('0x25')](function(_0x3320bd){if(_0x3320bd){var _0x93ef52=path[_0x91cb('0x56')](config['root'],_0x91cb('0x57'),_0x3320bd['value']);var _0x37221e=util['format'](_0x91cb('0x58'),_0x93ef52);if(fs[_0x91cb('0x59')](_0x37221e)){_0x5752ed=!![];return _0x20fc0a[_0x91cb('0x5a')](_0x37221e,_0x93ef52,config['secrets'][_0x91cb('0x5b')])[_0x91cb('0x25')](function(){return _0x3320bd;});}return _0x3320bd;}})['then'](function(_0xef4754){if(_0xef4754){var _0x102025=path[_0x91cb('0x56')](config[_0x91cb('0x5c')],'server/files/screen_recordings',_0xef4754[_0x91cb('0x50')]);if(!fs[_0x91cb('0x59')](_0x102025)){throw new db[(_0x91cb('0x5d'))][(_0x91cb('0x5e'))]('ScreenRecording\x20not\x20found');}if(_0xef4754[_0x91cb('0x5f')]){return _0x30fd4e[_0x91cb('0x53')](_0x102025,_0xef4754['filename']+path['extname'](_0x102025),function(){if(_0x5752ed){fs[_0x91cb('0x60')](_0x102025);}});}else{return _0x30fd4e['download'](_0x102025,function(_0x1180ac){if(_0x5752ed){fs[_0x91cb('0x60')](_0x102025);}});}}})['catch'](function(_0x4f19c8){if(_0x4f19c8[_0x91cb('0x61')]==='ScreenRecording\x20not\x20found'){_0x30fd4e[_0x91cb('0x1a')](0x194)[_0x91cb('0x2a')](_0x91cb('0x62'));}else{return handleError(_0x30fd4e,null);}});};exports['destroy']=function(_0x22fea8,_0x524400){return db[_0x91cb('0x2d')][_0x91cb('0x4b')]({'where':{'id':_0x22fea8[_0x91cb('0x51')]['id']}})[_0x91cb('0x25')](function(_0x483172){if(_[_0x91cb('0x63')](_0x483172)){throw new ReferenceError(_0x91cb('0x64'));}return _0x483172;})[_0x91cb('0x25')](function(_0x443c72){var _0xaf70c5=path[_0x91cb('0x56')](config[_0x91cb('0x5c')],_0x91cb('0x57'),_0x443c72[_0x91cb('0x50')]);logger[_0x91cb('0x65')](_0x91cb('0x66'),_0xaf70c5);if(!_[_0x91cb('0x63')](_0x443c72['value'])&&fs[_0x91cb('0x59')](_0xaf70c5)){logger[_0x91cb('0x65')](_0x91cb('0x67')+_0xaf70c5+_0x91cb('0x68'));fs[_0x91cb('0x69')](_0xaf70c5);}_0xaf70c5=_0xaf70c5+_0x91cb('0x6a');if(!_[_0x91cb('0x63')](_0x443c72['value'])&&fs[_0x91cb('0x59')](_0xaf70c5)){logger['info'](_0x91cb('0x67')+_0xaf70c5+_0x91cb('0x68'));fs[_0x91cb('0x69')](_0xaf70c5);}return _0x443c72;})[_0x91cb('0x25')](function(_0x48fcfe){if(!_0x48fcfe)throw new InternalError();return _0x48fcfe[_0x91cb('0x26')]();})[_0x91cb('0x25')](function(){_0x524400[_0x91cb('0x1a')](0xcc)[_0x91cb('0x1b')]();})[_0x91cb('0x45')](handleError(_0x524400,null));}; \ No newline at end of file +var _0x46ed=['intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','findAll','rows','catch','show','keys','include','options','find','create','body','createdAt','closedAt','describe','download','../../components/encryptor','uniqueid','params','value','join','root','server/files/screen_recordings','%s.cypher','decryptFile','secrets','recording','existsSync','ScreenRecording\x20not\x20found','filename','unlink','message','Not\x20found','destroy','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','end','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','limit','undefined','set','Content-Range','json','apply','reject','update','then','stack','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','format','query','filters'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x46ed,0x168));var _0xd46e=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x46ed[_0x5c2e3e];return _0x53f64a;};'use strict';var emlformat=require(_0xd46e('0x0'));var rimraf=require(_0xd46e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd46e('0x2'));var rp=require(_0xd46e('0x3'));var moment=require(_0xd46e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd46e('0x5'));var util=require(_0xd46e('0x6'));var path=require('path');var sox=require(_0xd46e('0x7'));var csv=require(_0xd46e('0x8'));var ejs=require(_0xd46e('0x9'));var fs=require('fs');var fs_extra=require(_0xd46e('0xa'));var _=require(_0xd46e('0xb'));var squel=require(_0xd46e('0xc'));var crypto=require(_0xd46e('0xd'));var jsforce=require(_0xd46e('0xe'));var deskjs=require(_0xd46e('0xf'));var toCsv=require(_0xd46e('0x8'));var querystring=require(_0xd46e('0x10'));var Papa=require('papaparse');var Redis=require(_0xd46e('0x11'));var authService=require(_0xd46e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd46e('0x13'));var hardwareService=require(_0xd46e('0x14'));var logger=require(_0xd46e('0x15'))(_0xd46e('0x16'));var utils=require(_0xd46e('0x17'));var config=require(_0xd46e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd46e('0x19'))['db'];function respondWithStatusCode(_0x5bc1da,_0x48550b){_0x48550b=_0x48550b||0xcc;return function(_0xf3048c){if(_0xf3048c){return _0x5bc1da[_0xd46e('0x1a')](_0x48550b);}return _0x5bc1da['status'](_0x48550b)['end']();};}function respondWithResult(_0xacd799,_0x4688ae){_0x4688ae=_0x4688ae||0xc8;return function(_0x1e9aae){if(_0x1e9aae){return _0xacd799[_0xd46e('0x1b')](_0x4688ae)['json'](_0x1e9aae);}};}function respondWithFilteredResult(_0x3b6d25,_0x44a620){return function(_0x417402){if(_0x417402){var _0x3d72ce=typeof _0x44a620[_0xd46e('0x1c')]==='undefined'&&typeof _0x44a620[_0xd46e('0x1d')]===_0xd46e('0x1e');var _0x3583a5=_0x417402['count'];var _0x5ddd04=_0x3d72ce?0x0:_0x44a620[_0xd46e('0x1c')];var _0x1bd574=_0x3d72ce?_0x417402['count']:_0x44a620['offset']+_0x44a620[_0xd46e('0x1d')];var _0x2f2571;if(_0x1bd574>=_0x3583a5){_0x1bd574=_0x3583a5;_0x2f2571=0xc8;}else{_0x2f2571=0xce;}_0x3b6d25[_0xd46e('0x1b')](_0x2f2571);return _0x3b6d25[_0xd46e('0x1f')](_0xd46e('0x20'),_0x5ddd04+'-'+_0x1bd574+'/'+_0x3583a5)[_0xd46e('0x21')](_0x417402);}return null;};}function patchUpdates(_0x3b5fa4){return function(_0x327b7e){try{jsonpatch[_0xd46e('0x22')](_0x327b7e,_0x3b5fa4,!![]);}catch(_0x3c7e91){return BPromise[_0xd46e('0x23')](_0x3c7e91);}return _0x327b7e['save']();};}function saveUpdates(_0x259072,_0x1c83fa){return function(_0x79aa51){if(_0x79aa51){return _0x79aa51[_0xd46e('0x24')](_0x259072)[_0xd46e('0x25')](function(_0xc1af7f){return _0xc1af7f;});}return null;};}function removeEntity(_0x33c2e0,_0x8a1be){return function(_0x62dea5){if(_0x62dea5){return _0x62dea5['destroy']()[_0xd46e('0x25')](function(){_0x33c2e0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x371054,_0x2a5271){return function(_0x21135f){if(!_0x21135f){_0x371054[_0xd46e('0x1a')](0x194);}return _0x21135f;};}function handleError(_0x247b9f,_0x180851){_0x180851=_0x180851||0x1f4;return function(_0x1740d1){logger['error'](_0x1740d1[_0xd46e('0x26')]);if(_0x1740d1[_0xd46e('0x27')]){delete _0x1740d1[_0xd46e('0x27')];}_0x247b9f[_0xd46e('0x1b')](_0x180851)[_0xd46e('0x28')](_0x1740d1);};}exports[_0xd46e('0x29')]=function(_0x58aeef,_0x465d54){var _0x3a1ced={},_0x2d1afe={},_0xa716ce={'count':0x0,'rows':[]};var _0x106edc=_[_0xd46e('0x2a')](db[_0xd46e('0x2b')][_0xd46e('0x2c')],function(_0x18f060){return{'name':_0x18f060[_0xd46e('0x2d')],'type':_0x18f060[_0xd46e('0x2e')][_0xd46e('0x2f')]};});_0x2d1afe[_0xd46e('0x30')]=_['differenceBy'](_[_0xd46e('0x2a')](_0x106edc,_0xd46e('0x27')),[_0xd46e('0x31')]);_0x2d1afe[_0xd46e('0x32')]=_['keys'](_0x58aeef[_0xd46e('0x32')]);_0x2d1afe[_0xd46e('0x33')]=_['intersection'](_0x2d1afe[_0xd46e('0x30')],_0x2d1afe[_0xd46e('0x32')]);_0x3a1ced['attributes']=_[_0xd46e('0x34')](_0x2d1afe[_0xd46e('0x30')],qs[_0xd46e('0x35')](_0x58aeef['query']['fields']));_0x3a1ced[_0xd46e('0x36')]=_0x3a1ced[_0xd46e('0x36')][_0xd46e('0x37')]?_0x3a1ced[_0xd46e('0x36')]:_0x2d1afe[_0xd46e('0x30')];if(!_0x58aeef[_0xd46e('0x32')][_0xd46e('0x38')](_0xd46e('0x39'))){_0x3a1ced['limit']=qs[_0xd46e('0x1d')](_0x58aeef[_0xd46e('0x32')][_0xd46e('0x1d')]);_0x3a1ced[_0xd46e('0x1c')]=qs[_0xd46e('0x1c')](_0x58aeef[_0xd46e('0x32')][_0xd46e('0x1c')]);}_0x3a1ced['order']=qs[_0xd46e('0x3a')](_0x58aeef[_0xd46e('0x32')]['sort']);_0x3a1ced[_0xd46e('0x3b')]=qs[_0xd46e('0x33')](_[_0xd46e('0x3c')](_0x58aeef[_0xd46e('0x32')],_0x2d1afe['filters']),_0x106edc);if(_0x58aeef[_0xd46e('0x32')][_0xd46e('0x3d')]){_0x3a1ced[_0xd46e('0x3b')]=_[_0xd46e('0x3e')](_0x3a1ced[_0xd46e('0x3b')],{'$or':_[_0xd46e('0x2a')](_0x106edc,function(_0x220c57){if(_0x220c57[_0xd46e('0x2e')]!=='VIRTUAL'){var _0x232e6f={};_0x232e6f[_0x220c57[_0xd46e('0x27')]]={'$like':'%'+_0x58aeef[_0xd46e('0x32')][_0xd46e('0x3d')]+'%'};return _0x232e6f;}})});}_0x3a1ced=_[_0xd46e('0x3e')]({},_0x3a1ced,_0x58aeef['options']);var _0x964c66={'where':_0x3a1ced['where']};return db['ScreenRecording']['count'](_0x964c66)['then'](function(_0x17c3d9){_0xa716ce['count']=_0x17c3d9;if(_0x58aeef[_0xd46e('0x32')][_0xd46e('0x3f')]){_0x3a1ced['include']=[{'all':!![]}];}return db[_0xd46e('0x2b')][_0xd46e('0x40')](_0x3a1ced);})[_0xd46e('0x25')](function(_0x31ba12){_0xa716ce[_0xd46e('0x41')]=_0x31ba12;return _0xa716ce;})[_0xd46e('0x25')](respondWithFilteredResult(_0x465d54,_0x3a1ced))[_0xd46e('0x42')](handleError(_0x465d54,null));};exports[_0xd46e('0x43')]=function(_0x3a98e4,_0xec367d){var _0x259e2={'raw':![],'where':{'id':_0x3a98e4['params']['id']}},_0x5ea048={};_0x5ea048['model']=_[_0xd46e('0x44')](db['ScreenRecording'][_0xd46e('0x2c')]);_0x5ea048[_0xd46e('0x32')]=_[_0xd46e('0x44')](_0x3a98e4[_0xd46e('0x32')]);_0x5ea048[_0xd46e('0x33')]=_[_0xd46e('0x34')](_0x5ea048[_0xd46e('0x30')],_0x5ea048[_0xd46e('0x32')]);_0x259e2['attributes']=_[_0xd46e('0x34')](_0x5ea048['model'],qs[_0xd46e('0x35')](_0x3a98e4[_0xd46e('0x32')][_0xd46e('0x35')]));_0x259e2[_0xd46e('0x36')]=_0x259e2[_0xd46e('0x36')]['length']?_0x259e2[_0xd46e('0x36')]:_0x5ea048[_0xd46e('0x30')];if(_0x3a98e4[_0xd46e('0x32')][_0xd46e('0x3f')]){_0x259e2[_0xd46e('0x45')]=[{'all':!![]}];}_0x259e2=_['merge']({},_0x259e2,_0x3a98e4[_0xd46e('0x46')]);return db[_0xd46e('0x2b')][_0xd46e('0x47')](_0x259e2)[_0xd46e('0x25')](handleEntityNotFound(_0xec367d,null))[_0xd46e('0x25')](respondWithResult(_0xec367d,null))['catch'](handleError(_0xec367d,null));};exports[_0xd46e('0x48')]=function(_0x3ea9e6,_0x45baf1){return db[_0xd46e('0x2b')][_0xd46e('0x48')](_0x3ea9e6[_0xd46e('0x49')],{})[_0xd46e('0x25')](respondWithResult(_0x45baf1,0xc9))[_0xd46e('0x42')](handleError(_0x45baf1,null));};exports['update']=function(_0xf9dab,_0x71a8dc){if(_0xf9dab[_0xd46e('0x49')]['id']){delete _0xf9dab[_0xd46e('0x49')]['id'];}delete _0xf9dab[_0xd46e('0x49')]['duration'];delete _0xf9dab['body'][_0xd46e('0x4a')];delete _0xf9dab[_0xd46e('0x49')][_0xd46e('0x4b')];delete _0xf9dab['body']['value'];return db[_0xd46e('0x2b')][_0xd46e('0x47')]({'where':{'id':_0xf9dab['params']['id']}})[_0xd46e('0x25')](handleEntityNotFound(_0x71a8dc,null))[_0xd46e('0x25')](saveUpdates(_0xf9dab[_0xd46e('0x49')],null))[_0xd46e('0x25')](respondWithResult(_0x71a8dc,null))[_0xd46e('0x42')](handleError(_0x71a8dc,null));};exports[_0xd46e('0x4c')]=function(_0x80ed51,_0x16ca0e){return db['ScreenRecording'][_0xd46e('0x4c')]()[_0xd46e('0x25')](respondWithResult(_0x16ca0e,null))[_0xd46e('0x42')](handleError(_0x16ca0e,null));};exports[_0xd46e('0x4d')]=function(_0x4ec295,_0x56dd9a,_0xced102){var _0x5a4a44=require(_0xd46e('0x4e'));var _0x2af20b=![];var _0x393cb9={};if(_0x4ec295[_0xd46e('0x32')][_0xd46e('0x2e')]&&_0x4ec295[_0xd46e('0x32')]['type']===_0xd46e('0x4f')){_0x393cb9[_0xd46e('0x4f')]=_0x4ec295[_0xd46e('0x50')]['id'];}else{_0x393cb9['id']=_0x4ec295['params']['id'];}return db[_0xd46e('0x2b')][_0xd46e('0x47')]({'where':_0x393cb9,'attributes':['id',_0xd46e('0x51')],'raw':!![]})[_0xd46e('0x25')](handleEntityNotFound(_0x56dd9a,null))[_0xd46e('0x25')](function(_0x2cc676){if(_0x2cc676){var _0x2760ef=path[_0xd46e('0x52')](config[_0xd46e('0x53')],_0xd46e('0x54'),_0x2cc676[_0xd46e('0x51')]);var _0x411b19=util[_0xd46e('0x31')](_0xd46e('0x55'),_0x2760ef);if(fs['existsSync'](_0x411b19)){_0x2af20b=!![];return _0x5a4a44[_0xd46e('0x56')](_0x411b19,_0x2760ef,config[_0xd46e('0x57')][_0xd46e('0x58')])[_0xd46e('0x25')](function(){return _0x2cc676;});}return _0x2cc676;}})['then'](function(_0x636f15){if(_0x636f15){var _0x36e18a=path[_0xd46e('0x52')](config[_0xd46e('0x53')],'server/files/screen_recordings',_0x636f15[_0xd46e('0x51')]);if(!fs[_0xd46e('0x59')](_0x36e18a)){throw new db['Sequelize']['ValidationError'](_0xd46e('0x5a'));}if(_0x636f15[_0xd46e('0x5b')]){return _0x56dd9a[_0xd46e('0x4d')](_0x36e18a,_0x636f15['filename']+path['extname'](_0x36e18a),function(){if(_0x2af20b){fs[_0xd46e('0x5c')](_0x36e18a);}});}else{return _0x56dd9a[_0xd46e('0x4d')](_0x36e18a,function(_0x1f310d){if(_0x2af20b){fs[_0xd46e('0x5c')](_0x36e18a);}});}}})[_0xd46e('0x42')](function(_0x2f9fcb){if(_0x2f9fcb[_0xd46e('0x5d')]===_0xd46e('0x5a')){_0x56dd9a[_0xd46e('0x1b')](0x194)[_0xd46e('0x28')](_0xd46e('0x5e'));}else{return handleError(_0x56dd9a,null);}});};exports[_0xd46e('0x5f')]=function(_0x272514,_0x329204){return db[_0xd46e('0x2b')][_0xd46e('0x47')]({'where':{'id':_0x272514['params']['id']}})[_0xd46e('0x25')](function(_0x1a3771){if(_[_0xd46e('0x60')](_0x1a3771)){throw new ReferenceError('Entity\x20not\x20found');}return _0x1a3771;})[_0xd46e('0x25')](function(_0x313c7e){var _0x4dec29=path[_0xd46e('0x52')](config[_0xd46e('0x53')],_0xd46e('0x54'),_0x313c7e['value']);logger[_0xd46e('0x61')](_0xd46e('0x62'),_0x4dec29);if(!_[_0xd46e('0x60')](_0x313c7e['value'])&&fs[_0xd46e('0x59')](_0x4dec29)){logger['info'](_0xd46e('0x63')+_0x4dec29+_0xd46e('0x64'));fs[_0xd46e('0x65')](_0x4dec29);}_0x4dec29=_0x4dec29+'.cypher';if(!_[_0xd46e('0x60')](_0x313c7e[_0xd46e('0x51')])&&fs[_0xd46e('0x59')](_0x4dec29)){logger[_0xd46e('0x61')](_0xd46e('0x63')+_0x4dec29+_0xd46e('0x64'));fs[_0xd46e('0x65')](_0x4dec29);}return _0x313c7e;})[_0xd46e('0x25')](function(_0x300ee9){if(!_0x300ee9)throw new InternalError();return _0x300ee9[_0xd46e('0x5f')]();})[_0xd46e('0x25')](function(){_0x329204[_0xd46e('0x1b')](0xcc)[_0xd46e('0x66')]();})[_0xd46e('0x42')](handleError(_0x329204,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 7418a59..94c81fb 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 _0xbfc7=['request-promise','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','interactionid','lodash','util','api','moment','bluebird'];(function(_0x12ea04,_0x52f3d4){var _0x51fc7a=function(_0x33d6f0){while(--_0x33d6f0){_0x12ea04['push'](_0x12ea04['shift']());}};_0x51fc7a(++_0x52f3d4);}(_0xbfc7,0xf2));var _0x7bfc=function(_0x202dc7,_0x33ff2a){_0x202dc7=_0x202dc7-0x0;var _0x22f5f9=_0xbfc7[_0x202dc7];return _0x22f5f9;};'use strict';var _=require(_0x7bfc('0x0'));var util=require(_0x7bfc('0x1'));var logger=require('../../config/logger')(_0x7bfc('0x2'));var moment=require(_0x7bfc('0x3'));var BPromise=require(_0x7bfc('0x4'));var rp=require(_0x7bfc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7bfc('0x6'));var config=require(_0x7bfc('0x7'));var attributes=require(_0x7bfc('0x8'));module[_0x7bfc('0x9')]=function(_0x171367,_0x45f32a){return _0x171367[_0x7bfc('0xa')](_0x7bfc('0xb'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0x7bfc('0xc'),'fields':[_0x7bfc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xca25=['../../config/logger','api','bluebird','path','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid','lodash','util'];(function(_0x574c7d,_0x4d3487){var _0x1c5115=function(_0xc32010){while(--_0xc32010){_0x574c7d['push'](_0x574c7d['shift']());}};_0x1c5115(++_0x4d3487);}(_0xca25,0xca));var _0x5ca2=function(_0x2af053,_0x4f6d28){_0x2af053=_0x2af053-0x0;var _0x4b4001=_0xca25[_0x2af053];return _0x4b4001;};'use strict';var _=require(_0x5ca2('0x0'));var util=require(_0x5ca2('0x1'));var logger=require(_0x5ca2('0x2'))(_0x5ca2('0x3'));var moment=require('moment');var BPromise=require(_0x5ca2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5ca2('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5ca2('0x6'));module[_0x5ca2('0x7')]=function(_0x2ba9ac,_0x1931d2){return _0x2ba9ac[_0x5ca2('0x8')](_0x5ca2('0x9'),attributes,{'tableName':_0x5ca2('0xa'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x5ca2('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 3645aa4..22500f3 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 _0xfa42=['ioredis','../../mysqldb','../../config/utils','jayson/promise','client','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','moment','bluebird','randomstring'];(function(_0x357b1c,_0x445d1a){var _0x3e979d=function(_0x1729d4){while(--_0x1729d4){_0x357b1c['push'](_0x357b1c['shift']());}};_0x3e979d(++_0x445d1a);}(_0xfa42,0x119));var _0x2fa4=function(_0x5be7f3,_0x19ac3a){_0x5be7f3=_0x5be7f3-0x0;var _0x46cff2=_0xfa42[_0x5be7f3];return _0x46cff2;};'use strict';var _=require(_0x2fa4('0x0'));var util=require('util');var moment=require(_0x2fa4('0x1'));var BPromise=require(_0x2fa4('0x2'));var rs=require(_0x2fa4('0x3'));var fs=require('fs');var Redis=require(_0x2fa4('0x4'));var db=require(_0x2fa4('0x5'))['db'];var utils=require(_0x2fa4('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x2fa4('0x7'));var client=jayson[_0x2fa4('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1506ba,_0x232ae1,_0x555a35){return new BPromise(function(_0x4e9fd2,_0x43c3c6){return client['request'](_0x1506ba,_0x555a35)[_0x2fa4('0x9')](function(_0x1e65c1){logger[_0x2fa4('0xa')](_0x2fa4('0xb'),_0x232ae1,_0x2fa4('0xc'));logger[_0x2fa4('0xd')](_0x2fa4('0xe'),_0x232ae1,_0x2fa4('0xc'),JSON['stringify'](_0x1e65c1));if(_0x1e65c1[_0x2fa4('0xf')]){if(_0x1e65c1[_0x2fa4('0xf')][_0x2fa4('0x10')]===0x1f4){logger[_0x2fa4('0xf')](_0x2fa4('0xb'),_0x232ae1,_0x1e65c1[_0x2fa4('0xf')][_0x2fa4('0x11')]);return _0x43c3c6(_0x1e65c1[_0x2fa4('0xf')][_0x2fa4('0x11')]);}logger[_0x2fa4('0xf')](_0x2fa4('0xb'),_0x232ae1,_0x1e65c1[_0x2fa4('0xf')][_0x2fa4('0x11')]);return _0x4e9fd2(_0x1e65c1[_0x2fa4('0xf')][_0x2fa4('0x11')]);}else{logger[_0x2fa4('0xa')](_0x2fa4('0xb'),_0x232ae1,_0x2fa4('0xc'));_0x4e9fd2(_0x1e65c1['result'][_0x2fa4('0x11')]);}})[_0x2fa4('0x12')](function(_0x53dcec){logger[_0x2fa4('0xf')]('ScreenRecording,\x20%s,\x20%s',_0x232ae1,_0x53dcec);_0x43c3c6(_0x53dcec);});});} \ No newline at end of file +var _0x7881=['then','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','ScreenRecording,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request'];(function(_0x281a28,_0x34542c){var _0x54f40c=function(_0x28bde9){while(--_0x28bde9){_0x281a28['push'](_0x281a28['shift']());}};_0x54f40c(++_0x34542c);}(_0x7881,0x136));var _0x1788=function(_0xa95ea6,_0x18d8fe){_0xa95ea6=_0xa95ea6-0x0;var _0x423a08=_0x7881[_0xa95ea6];return _0x423a08;};'use strict';var _=require('lodash');var util=require(_0x1788('0x0'));var moment=require(_0x1788('0x1'));var BPromise=require(_0x1788('0x2'));var rs=require(_0x1788('0x3'));var fs=require('fs');var Redis=require(_0x1788('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1788('0x5'));var logger=require(_0x1788('0x6'))(_0x1788('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1788('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x47252d,_0x2e10be,_0x237f61){return new BPromise(function(_0x452789,_0x53472e){return client[_0x1788('0x9')](_0x47252d,_0x237f61)[_0x1788('0xa')](function(_0x502591){logger['info']('ScreenRecording,\x20%s,\x20%s',_0x2e10be,_0x1788('0xb'));logger[_0x1788('0xc')](_0x1788('0xd'),_0x2e10be,_0x1788('0xb'),JSON[_0x1788('0xe')](_0x502591));if(_0x502591['error']){if(_0x502591[_0x1788('0xf')]['code']===0x1f4){logger[_0x1788('0xf')](_0x1788('0x10'),_0x2e10be,_0x502591[_0x1788('0xf')]['message']);return _0x53472e(_0x502591[_0x1788('0xf')][_0x1788('0x11')]);}logger['error']('ScreenRecording,\x20%s,\x20%s',_0x2e10be,_0x502591['error'][_0x1788('0x11')]);return _0x452789(_0x502591[_0x1788('0xf')][_0x1788('0x11')]);}else{logger['info'](_0x1788('0x10'),_0x2e10be,_0x1788('0xb'));_0x452789(_0x502591[_0x1788('0x12')][_0x1788('0x11')]);}})[_0x1788('0x13')](function(_0x29be56){logger[_0x1788('0xf')](_0x1788('0x10'),_0x2e10be,_0x29be56);_0x53472e(_0x29be56);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index af479fb..524f601 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 _0xfa43=['Router','fs-extra','./setting.controller','get','isAuthenticated','getDate','/:id','show','/:id/logo_login','getLogoLogin','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','/:id/logo','single','addLogo','root','logologin','addLogoLogin','join','file','addPreferred','favicon','addFavicon','put','update','exports','multer','util','connect-timeout','express'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xfa43,0x1e8));var _0x3fa4=function(_0x3df114,_0x4c7fff){_0x3df114=_0x3df114-0x0;var _0x59ba4f=_0xfa43[_0x3df114];return _0x59ba4f;};'use strict';var multer=require(_0x3fa4('0x0'));var util=require(_0x3fa4('0x1'));var path=require('path');var timeout=require(_0x3fa4('0x2'));var express=require(_0x3fa4('0x3'));var router=express[_0x3fa4('0x4')]();var fs_extra=require(_0x3fa4('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3fa4('0x6'));router[_0x3fa4('0x7')]('/',auth[_0x3fa4('0x8')](),controller['index']);router[_0x3fa4('0x7')]('/now',controller[_0x3fa4('0x9')]);router['get'](_0x3fa4('0xa'),controller[_0x3fa4('0xb')]);router[_0x3fa4('0x7')]('/:id/logo',controller['getLogo']);router[_0x3fa4('0x7')](_0x3fa4('0xc'),controller[_0x3fa4('0xd')]);router[_0x3fa4('0x7')]('/:id/gdpr',controller[_0x3fa4('0xe')]);router[_0x3fa4('0x7')](_0x3fa4('0xf'),controller[_0x3fa4('0x10')]);router[_0x3fa4('0x7')](_0x3fa4('0x11'),controller[_0x3fa4('0x12')]);var upload=multer({'storage':multer[_0x3fa4('0x13')]({'destination':function(_0x4f02fa,_0x2e6791,_0x4831cc){_0x4831cc(null,path['join'](config['root'],_0x3fa4('0x14')));},'filename':function(_0x5bfe09,_0x52b2b6,_0x9818cf){_0x9818cf(null,util[_0x3fa4('0x15')](_0x3fa4('0x16'),_0x3fa4('0x17'),path[_0x3fa4('0x18')](_0x52b2b6[_0x3fa4('0x19')])));}})});router[_0x3fa4('0x1a')](_0x3fa4('0x1b'),upload[_0x3fa4('0x1c')]('file'),controller[_0x3fa4('0x1d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1750d4,_0x1c8139,_0x494d21){_0x494d21(null,path['join'](config[_0x3fa4('0x1e')],_0x3fa4('0x14')));},'filename':function(_0x3a3492,_0x444010,_0x5666bc){_0x5666bc(null,util[_0x3fa4('0x15')](_0x3fa4('0x16'),_0x3fa4('0x1f'),path[_0x3fa4('0x18')](_0x444010['originalname'])));}})});router[_0x3fa4('0x1a')](_0x3fa4('0xc'),upload[_0x3fa4('0x1c')]('file'),controller[_0x3fa4('0x20')]);var upload=multer({'storage':multer[_0x3fa4('0x13')]({'destination':function(_0x53c8b4,_0x59970e,_0x3e4b07){_0x3e4b07(null,path[_0x3fa4('0x21')](config[_0x3fa4('0x1e')],_0x3fa4('0x14')));},'filename':function(_0xb0bb28,_0x694e8c,_0x13d408){_0x13d408(null,util[_0x3fa4('0x15')](_0x3fa4('0x16'),'preferred',path['extname'](_0x694e8c[_0x3fa4('0x19')])));}})});router[_0x3fa4('0x1a')](_0x3fa4('0xf'),upload[_0x3fa4('0x1c')](_0x3fa4('0x22')),controller[_0x3fa4('0x23')]);var upload=multer({'storage':multer[_0x3fa4('0x13')]({'destination':function(_0x535460,_0x347f0f,_0x255581){_0x255581(null,path[_0x3fa4('0x21')](config[_0x3fa4('0x1e')],'server/files/images/logos/'));},'filename':function(_0xebce96,_0x4b0d0f,_0x55724b){_0x55724b(null,util[_0x3fa4('0x15')](_0x3fa4('0x16'),_0x3fa4('0x24'),path[_0x3fa4('0x18')](_0x4b0d0f[_0x3fa4('0x19')])));}})});router['post']('/:id/favicon',upload[_0x3fa4('0x1c')]('file'),controller[_0x3fa4('0x25')]);router[_0x3fa4('0x26')](_0x3fa4('0xa'),auth['isAuthenticated'](),controller[_0x3fa4('0x27')]);module[_0x3fa4('0x28')]=router; \ No newline at end of file +var _0xc87a=['isAuthenticated','getDate','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','getPreferred','/:id/favicon','getFavicon','diskStorage','server/files/images/logos/','format','%s%s','logo','extname','originalname','single','file','addLogo','root','post','addLogoLogin','/:id/preferred','addPreferred','join','favicon','addFavicon','/:id','update','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./setting.controller','get'];(function(_0x5f3905,_0x43a651){var _0x2923b1=function(_0x3c72d8){while(--_0x3c72d8){_0x5f3905['push'](_0x5f3905['shift']());}};_0x2923b1(++_0x43a651);}(_0xc87a,0xcd));var _0xac87=function(_0x28bf52,_0x565298){_0x28bf52=_0x28bf52-0x0;var _0x869587=_0xc87a[_0x28bf52];return _0x869587;};'use strict';var multer=require(_0xac87('0x0'));var util=require(_0xac87('0x1'));var path=require(_0xac87('0x2'));var timeout=require(_0xac87('0x3'));var express=require(_0xac87('0x4'));var router=express[_0xac87('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xac87('0x6'));var config=require(_0xac87('0x7'));var controller=require(_0xac87('0x8'));router[_0xac87('0x9')]('/',auth[_0xac87('0xa')](),controller['index']);router['get']('/now',controller[_0xac87('0xb')]);router['get']('/:id',controller[_0xac87('0xc')]);router['get'](_0xac87('0xd'),controller[_0xac87('0xe')]);router[_0xac87('0x9')](_0xac87('0xf'),controller[_0xac87('0x10')]);router[_0xac87('0x9')](_0xac87('0x11'),controller[_0xac87('0x12')]);router['get']('/:id/preferred',controller[_0xac87('0x13')]);router[_0xac87('0x9')](_0xac87('0x14'),controller[_0xac87('0x15')]);var upload=multer({'storage':multer[_0xac87('0x16')]({'destination':function(_0x1565e1,_0x2fada3,_0x5c8320){_0x5c8320(null,path['join'](config['root'],_0xac87('0x17')));},'filename':function(_0x153499,_0x4711ae,_0x3f2c1d){_0x3f2c1d(null,util[_0xac87('0x18')](_0xac87('0x19'),_0xac87('0x1a'),path[_0xac87('0x1b')](_0x4711ae[_0xac87('0x1c')])));}})});router['post']('/:id/logo',upload[_0xac87('0x1d')](_0xac87('0x1e')),controller[_0xac87('0x1f')]);var upload=multer({'storage':multer[_0xac87('0x16')]({'destination':function(_0x5c0cde,_0x389cc5,_0x3afaa9){_0x3afaa9(null,path['join'](config[_0xac87('0x20')],_0xac87('0x17')));},'filename':function(_0x501462,_0x15965b,_0x33998d){_0x33998d(null,util[_0xac87('0x18')](_0xac87('0x19'),'logologin',path[_0xac87('0x1b')](_0x15965b[_0xac87('0x1c')])));}})});router[_0xac87('0x21')](_0xac87('0xf'),upload['single'](_0xac87('0x1e')),controller[_0xac87('0x22')]);var upload=multer({'storage':multer[_0xac87('0x16')]({'destination':function(_0x5d0001,_0x4c7ea5,_0x56aed4){_0x56aed4(null,path['join'](config['root'],'server/files/images/logos/'));},'filename':function(_0x50e740,_0x2bf48c,_0x2e3f27){_0x2e3f27(null,util[_0xac87('0x18')](_0xac87('0x19'),'preferred',path[_0xac87('0x1b')](_0x2bf48c[_0xac87('0x1c')])));}})});router[_0xac87('0x21')](_0xac87('0x23'),upload[_0xac87('0x1d')]('file'),controller[_0xac87('0x24')]);var upload=multer({'storage':multer[_0xac87('0x16')]({'destination':function(_0x5f5d44,_0x33f7f3,_0x412ddc){_0x412ddc(null,path[_0xac87('0x25')](config[_0xac87('0x20')],_0xac87('0x17')));},'filename':function(_0x38ec65,_0x1806a8,_0x527625){_0x527625(null,util['format'](_0xac87('0x19'),_0xac87('0x26'),path[_0xac87('0x1b')](_0x1806a8[_0xac87('0x1c')])));}})});router[_0xac87('0x21')](_0xac87('0x14'),upload['single'](_0xac87('0x1e')),controller[_0xac87('0x27')]);router['put'](_0xac87('0x28'),auth[_0xac87('0xa')](),controller[_0xac87('0x29')]);module[_0xac87('0x2a')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 7919cd7..01918c7 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(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x5f66,0x1a0));var _0x65f6=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x5f66[_0x19e35c];return _0x3e1fe8;};'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 _0x1261=['exports','INTEGER','min_internal','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','alternate','UNSIGNED'];(function(_0x4d4f74,_0x1c6228){var _0x1a234f=function(_0x38bbaf){while(--_0x38bbaf){_0x4d4f74['push'](_0x4d4f74['shift']());}};_0x1a234f(++_0x1c6228);}(_0x1261,0x144));var _0x1126=function(_0x11f598,_0x5a2990){_0x11f598=_0x11f598-0x0;var _0x2a37dc=_0x1261[_0x11f598];return _0x2a37dc;};'use strict';var Sequelize=require('sequelize');module[_0x1126('0x0')]={'min_internal':{'type':Sequelize[_0x1126('0x1')](0xb),'unique':_0x1126('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x1126('0x1')](0xb),'unique':_0x1126('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x1126('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x1126('0x4')],'defaultValue':_0x1126('0x5')},'logo':{'type':Sequelize[_0x1126('0x4')]},'defaultLogo':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x1126('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x1126('0x4')]},'turnaddr':{'type':Sequelize[_0x1126('0x4')]},'turnusername':{'type':Sequelize[_0x1126('0x4')]},'turnpassword':{'type':Sequelize[_0x1126('0x4')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x1126('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x1126('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x1126('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x1126('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x1126('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x1126('0x4')],'defaultValue':_0x1126('0x7')},'chatTimeout':{'type':Sequelize[_0x1126('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x1126('0x4')]},'defaultPreferred':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x1126('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x1126('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x1126('0x4')]},'defaultFavicon':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x1126('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x1126('0x1')]},'transcribeRegion':{'type':Sequelize[_0x1126('0x4')]},'sentiment':{'type':Sequelize[_0x1126('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x1126('0x1')]},'sentimentRegion':{'type':Sequelize[_0x1126('0x4')]},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0x1126('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x1126('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x1126('0x1')](0x2)[_0x1126('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x1126('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x1126('0x1')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x1126('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x1126('0x1')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x1126('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 07b4fea..fd2551e 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 _0xd4b6=['type','key','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','options','includeAll','include','Setting','findAll','rows','catch','show','model','merge','find','update','body','params','file','filename','logo','addLogoLogin','loginLogo','server/files/images/logos','preferred','defaultLoginLogo','defaultFavicon','join','root','toLower','default_logo.svg','default','custom','Sequelize','ValidationError','upperFirst','\x20not\x20found','download','../../config/license/util','getLogoLogin','getLicense','favicon','defaultLogo','defaultPreferred','existsSync','default_loginLogo.svg','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','now','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','fast-json-patch','request-promise','bluebird','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','request','then','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','sendStatus','end','json','undefined','limit','count','offset','status','set','Content-Range','apply','reject','save','destroy','name','send','map','rawAttributes'];(function(_0x4a66d2,_0x330b2b){var _0x4e8906=function(_0x3c823f){while(--_0x3c823f){_0x4a66d2['push'](_0x4a66d2['shift']());}};_0x4e8906(++_0x330b2b);}(_0xd4b6,0x13f));var _0x6d4b=function(_0x527719,_0x594b58){_0x527719=_0x527719-0x0;var _0x31d635=_0xd4b6[_0x527719];return _0x31d635;};'use strict';var emlformat=require(_0x6d4b('0x0'));var rimraf=require(_0x6d4b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6d4b('0x2'));var rp=require(_0x6d4b('0x3'));var moment=require('moment');var BPromise=require(_0x6d4b('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x6d4b('0x5'));var csv=require(_0x6d4b('0x6'));var ejs=require(_0x6d4b('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6d4b('0x8'));var squel=require(_0x6d4b('0x9'));var crypto=require(_0x6d4b('0xa'));var jsforce=require(_0x6d4b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x6d4b('0x6'));var querystring=require(_0x6d4b('0xc'));var Papa=require(_0x6d4b('0xd'));var Redis=require(_0x6d4b('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x6d4b('0xf'));var as=require(_0x6d4b('0x10'));var hardwareService=require(_0x6d4b('0x11'));var logger=require(_0x6d4b('0x12'))(_0x6d4b('0x13'));var utils=require(_0x6d4b('0x14'));var config=require(_0x6d4b('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6d4b('0x16'))['db'];var jayson=require(_0x6d4b('0x17'));var client=jayson[_0x6d4b('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x46b1ea,_0x3d2e81,_0x148531,_0x353c66){return new BPromise(function(_0x296cc2,_0x2bca8b){var _0x2c6f88=_0x353c66||client;return _0x2c6f88[_0x6d4b('0x19')](_0x46b1ea,_0x148531)[_0x6d4b('0x1a')](function(_0x11dabc){logger['info'](_0x6d4b('0x1b'),_0x3d2e81,'request\x20sent');logger[_0x6d4b('0x1c')](_0x6d4b('0x1d'),_0x3d2e81,'request\x20sent',JSON['stringify'](_0x11dabc));if(_0x11dabc[_0x6d4b('0x1e')]){if(_0x11dabc[_0x6d4b('0x1e')][_0x6d4b('0x1f')]===0x1f4){logger[_0x6d4b('0x1e')](_0x6d4b('0x1b'),_0x3d2e81,_0x11dabc[_0x6d4b('0x1e')][_0x6d4b('0x20')]);return _0x2bca8b(_0x11dabc[_0x6d4b('0x1e')][_0x6d4b('0x20')]);}logger[_0x6d4b('0x1e')]('Setting,\x20%s,\x20%s',_0x3d2e81,_0x11dabc['error'][_0x6d4b('0x20')]);return _0x296cc2(_0x11dabc[_0x6d4b('0x1e')][_0x6d4b('0x20')]);}else{logger['info'](_0x6d4b('0x1b'),_0x3d2e81,_0x6d4b('0x21'));_0x296cc2(_0x11dabc[_0x6d4b('0x22')][_0x6d4b('0x20')]);}})['catch'](function(_0x43c861){logger[_0x6d4b('0x1e')](_0x6d4b('0x1b'),_0x3d2e81,_0x43c861);_0x2bca8b(_0x43c861);});});}function respondWithStatusCode(_0x4626a6,_0x3df33c){_0x3df33c=_0x3df33c||0xcc;return function(_0x479bf4){if(_0x479bf4){return _0x4626a6[_0x6d4b('0x23')](_0x3df33c);}return _0x4626a6['status'](_0x3df33c)[_0x6d4b('0x24')]();};}function respondWithResult(_0x36f046,_0x55c1ac){_0x55c1ac=_0x55c1ac||0xc8;return function(_0x3d729f){if(_0x3d729f){return _0x36f046['status'](_0x55c1ac)[_0x6d4b('0x25')](_0x3d729f);}};}function respondWithFilteredResult(_0x277f5,_0x8a8c33){return function(_0x5cdfe1){if(_0x5cdfe1){var _0xd801c1=typeof _0x8a8c33['offset']===_0x6d4b('0x26')&&typeof _0x8a8c33[_0x6d4b('0x27')]===_0x6d4b('0x26');var _0x169fe3=_0x5cdfe1[_0x6d4b('0x28')];var _0xf053ee=_0xd801c1?0x0:_0x8a8c33[_0x6d4b('0x29')];var _0x4d88fc=_0xd801c1?_0x5cdfe1[_0x6d4b('0x28')]:_0x8a8c33['offset']+_0x8a8c33[_0x6d4b('0x27')];var _0x5f29e1;if(_0x4d88fc>=_0x169fe3){_0x4d88fc=_0x169fe3;_0x5f29e1=0xc8;}else{_0x5f29e1=0xce;}_0x277f5[_0x6d4b('0x2a')](_0x5f29e1);return _0x277f5[_0x6d4b('0x2b')](_0x6d4b('0x2c'),_0xf053ee+'-'+_0x4d88fc+'/'+_0x169fe3)[_0x6d4b('0x25')](_0x5cdfe1);}return null;};}function patchUpdates(_0x5f05bc){return function(_0xd3ac49){try{jsonpatch[_0x6d4b('0x2d')](_0xd3ac49,_0x5f05bc,!![]);}catch(_0x39472b){return BPromise[_0x6d4b('0x2e')](_0x39472b);}return _0xd3ac49[_0x6d4b('0x2f')]();};}function saveUpdates(_0x18ffc6,_0xfdadd3){return function(_0x1371b9){if(_0x1371b9){return _0x1371b9['update'](_0x18ffc6)['then'](function(_0x4110d1){return _0x4110d1;});}return null;};}function removeEntity(_0x4b6ffc,_0x3a236d){return function(_0xfa144a){if(_0xfa144a){return _0xfa144a[_0x6d4b('0x30')]()[_0x6d4b('0x1a')](function(){_0x4b6ffc[_0x6d4b('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x563f5e,_0x585a37){return function(_0x17189b){if(!_0x17189b){_0x563f5e['sendStatus'](0x194);}return _0x17189b;};}function handleError(_0x1241ec,_0x1744ad){_0x1744ad=_0x1744ad||0x1f4;return function(_0x551b6e){logger['error'](_0x551b6e['stack']);if(_0x551b6e[_0x6d4b('0x31')]){delete _0x551b6e[_0x6d4b('0x31')];}_0x1241ec['status'](_0x1744ad)[_0x6d4b('0x32')](_0x551b6e);};}exports['index']=function(_0x4202c3,_0x278730){var _0x13de63={},_0x29089d={},_0x58c5fb={'count':0x0,'rows':[]};var _0x1c5696=_[_0x6d4b('0x33')](db['Setting'][_0x6d4b('0x34')],function(_0x55747f){return{'name':_0x55747f['fieldName'],'type':_0x55747f[_0x6d4b('0x35')][_0x6d4b('0x36')]};});_0x29089d['model']=_[_0x6d4b('0x33')](_0x1c5696,_0x6d4b('0x31'));_0x29089d[_0x6d4b('0x37')]=_[_0x6d4b('0x38')](_0x4202c3['query']);_0x29089d[_0x6d4b('0x39')]=_[_0x6d4b('0x3a')](_0x29089d['model'],_0x29089d[_0x6d4b('0x37')]);_0x13de63[_0x6d4b('0x3b')]=_[_0x6d4b('0x3a')](_0x29089d['model'],qs[_0x6d4b('0x3c')](_0x4202c3[_0x6d4b('0x37')][_0x6d4b('0x3c')]));_0x13de63[_0x6d4b('0x3b')]=_0x13de63[_0x6d4b('0x3b')][_0x6d4b('0x3d')]?_0x13de63[_0x6d4b('0x3b')]:_0x29089d['model'];if(!_0x4202c3['query'][_0x6d4b('0x3e')](_0x6d4b('0x3f'))){_0x13de63[_0x6d4b('0x27')]=qs[_0x6d4b('0x27')](_0x4202c3['query'][_0x6d4b('0x27')]);_0x13de63[_0x6d4b('0x29')]=qs[_0x6d4b('0x29')](_0x4202c3['query'][_0x6d4b('0x29')]);}_0x13de63['order']=qs[_0x6d4b('0x40')](_0x4202c3[_0x6d4b('0x37')][_0x6d4b('0x40')]);_0x13de63['where']=qs[_0x6d4b('0x39')](_[_0x6d4b('0x41')](_0x4202c3['query'],_0x29089d[_0x6d4b('0x39')]),_0x1c5696);if(_0x4202c3[_0x6d4b('0x37')][_0x6d4b('0x42')]){_0x13de63[_0x6d4b('0x43')]=_['merge'](_0x13de63[_0x6d4b('0x43')],{'$or':_['map'](_0x1c5696,function(_0x524f5f){if(_0x524f5f['type']!==_0x6d4b('0x44')){var _0xc9838b={};_0xc9838b[_0x524f5f[_0x6d4b('0x31')]]={'$like':'%'+_0x4202c3['query'][_0x6d4b('0x42')]+'%'};return _0xc9838b;}})});}_0x13de63=_['merge']({},_0x13de63,_0x4202c3[_0x6d4b('0x45')]);var _0x3a91fa={'where':_0x13de63[_0x6d4b('0x43')]};return db['Setting'][_0x6d4b('0x28')](_0x3a91fa)[_0x6d4b('0x1a')](function(_0x562c01){_0x58c5fb['count']=_0x562c01;if(_0x4202c3[_0x6d4b('0x37')][_0x6d4b('0x46')]){_0x13de63[_0x6d4b('0x47')]=[{'all':!![]}];}return db[_0x6d4b('0x48')][_0x6d4b('0x49')](_0x13de63);})['then'](function(_0x371d5e){_0x58c5fb[_0x6d4b('0x4a')]=_0x371d5e;return _0x58c5fb;})['then'](respondWithFilteredResult(_0x278730,_0x13de63))[_0x6d4b('0x4b')](handleError(_0x278730,null));};exports[_0x6d4b('0x4c')]=function(_0x2369b2,_0xad4d74){var _0x45382f={'raw':![],'where':{'id':_0x2369b2['params']['id']}},_0x4fa633={};_0x4fa633[_0x6d4b('0x4d')]=_[_0x6d4b('0x38')](db[_0x6d4b('0x48')][_0x6d4b('0x34')]);_0x4fa633[_0x6d4b('0x37')]=_[_0x6d4b('0x38')](_0x2369b2[_0x6d4b('0x37')]);_0x4fa633['filters']=_[_0x6d4b('0x3a')](_0x4fa633[_0x6d4b('0x4d')],_0x4fa633[_0x6d4b('0x37')]);_0x45382f[_0x6d4b('0x3b')]=_['intersection'](_0x4fa633[_0x6d4b('0x4d')],qs[_0x6d4b('0x3c')](_0x2369b2['query']['fields']));_0x45382f[_0x6d4b('0x3b')]=_0x45382f[_0x6d4b('0x3b')][_0x6d4b('0x3d')]?_0x45382f[_0x6d4b('0x3b')]:_0x4fa633[_0x6d4b('0x4d')];if(_0x2369b2[_0x6d4b('0x37')][_0x6d4b('0x46')]){_0x45382f[_0x6d4b('0x47')]=[{'all':!![]}];}_0x45382f=_[_0x6d4b('0x4e')]({},_0x45382f,_0x2369b2['options']);return db['Setting'][_0x6d4b('0x4f')](_0x45382f)[_0x6d4b('0x1a')](handleEntityNotFound(_0xad4d74,null))[_0x6d4b('0x1a')](respondWithResult(_0xad4d74,null))[_0x6d4b('0x4b')](handleError(_0xad4d74,null));};exports[_0x6d4b('0x50')]=function(_0x599cad,_0x42a628){if(_0x599cad[_0x6d4b('0x51')]['id']){delete _0x599cad['body']['id'];}return db[_0x6d4b('0x48')][_0x6d4b('0x4f')]({'where':{'id':_0x599cad[_0x6d4b('0x52')]['id']}})['then'](handleEntityNotFound(_0x42a628,null))[_0x6d4b('0x1a')](saveUpdates(_0x599cad[_0x6d4b('0x51')],null))[_0x6d4b('0x1a')](respondWithResult(_0x42a628,null))[_0x6d4b('0x4b')](handleError(_0x42a628,null));};exports['addLogo']=function(_0x3112f6,_0x373764,_0x5e1ec1){if(_0x3112f6[_0x6d4b('0x53')]&&_0x3112f6[_0x6d4b('0x53')][_0x6d4b('0x54')]){_0x3112f6[_0x6d4b('0x51')][_0x6d4b('0x55')]=_0x3112f6[_0x6d4b('0x53')]['filename'];}return db[_0x6d4b('0x48')]['find']({'where':{'id':_0x3112f6['params']['id']}})[_0x6d4b('0x1a')](handleEntityNotFound(_0x373764,null))[_0x6d4b('0x1a')](saveUpdates(_0x3112f6['body'],null))[_0x6d4b('0x1a')](respondWithResult(_0x373764,null))[_0x6d4b('0x4b')](handleError(_0x373764,null));};exports[_0x6d4b('0x56')]=function(_0x5a8865,_0x884b46,_0x240b63){if(_0x5a8865[_0x6d4b('0x53')]&&_0x5a8865['file'][_0x6d4b('0x54')]){_0x5a8865[_0x6d4b('0x51')][_0x6d4b('0x57')]=_0x5a8865[_0x6d4b('0x53')][_0x6d4b('0x54')];}return db[_0x6d4b('0x48')]['find']({'where':{'id':_0x5a8865[_0x6d4b('0x52')]['id']}})[_0x6d4b('0x1a')](handleEntityNotFound(_0x884b46,null))['then'](saveUpdates(_0x5a8865[_0x6d4b('0x51')],null))['then'](respondWithResult(_0x884b46,null))['catch'](handleError(_0x884b46,null));};var utilLicense=require('../../config/license/util');exports['getLogo']=function(_0x42e4bf,_0x503452,_0x43ef5b){var _0x38f275=_0x6d4b('0x58');var _0x4bb608={'custom':![]};return utilLicense['getLicense']()[_0x6d4b('0x1a')](function(_0x5b103b){if(_0x5b103b){_0x4bb608=_0x5b103b;}return db[_0x6d4b('0x48')][_0x6d4b('0x4f')]({'where':{'id':_0x42e4bf[_0x6d4b('0x52')]['id']},'attributes':[_0x6d4b('0x55'),_0x6d4b('0x57'),_0x6d4b('0x59'),'favicon','defaultLogo',_0x6d4b('0x5a'),'defaultPreferred',_0x6d4b('0x5b')],'raw':!![]});})[_0x6d4b('0x1a')](handleEntityNotFound(_0x503452,null))['then'](function(_0x923d9c){if(_0x923d9c){var _0x450d8f=_0x923d9c[_0x6d4b('0x55')]&&fs['existsSync'](path[_0x6d4b('0x5c')](config[_0x6d4b('0x5d')],_0x38f275,_[_0x6d4b('0x5e')](_0x923d9c[_0x6d4b('0x55')])))?path['join'](config[_0x6d4b('0x5d')],_0x38f275,_[_0x6d4b('0x5e')](_0x923d9c['logo'])):path[_0x6d4b('0x5c')](config[_0x6d4b('0x5d')],_0x38f275,_[_0x6d4b('0x5e')](_0x6d4b('0x5f')));var _0x96c815=_0x6d4b('0x60')+_['upperFirst'](_0x6d4b('0x55'));if(_0x923d9c[_0x96c815]||!_0x4bb608[_0x6d4b('0x61')]){_0x450d8f=path[_0x6d4b('0x5c')](config[_0x6d4b('0x5d')],_0x38f275,_[_0x6d4b('0x5e')]('default_logo.svg'));}if(!fs['existsSync'](_0x450d8f)){throw new db[(_0x6d4b('0x62'))][(_0x6d4b('0x63'))](_[_0x6d4b('0x64')](_0x6d4b('0x55'))+_0x6d4b('0x65'));}return _0x503452[_0x6d4b('0x66')](_0x450d8f);}})[_0x6d4b('0x4b')](handleError(_0x503452,null));};var utilLicense=require(_0x6d4b('0x67'));exports[_0x6d4b('0x68')]=function(_0x3b1abc,_0x11e4e0,_0x32a9b2){var _0x24326f=_0x6d4b('0x58');var _0x217a40={'custom':![]};return utilLicense[_0x6d4b('0x69')]()[_0x6d4b('0x1a')](function(_0x206e07){if(_0x206e07){_0x217a40=_0x206e07;}return db[_0x6d4b('0x48')]['find']({'where':{'id':_0x3b1abc[_0x6d4b('0x52')]['id']},'attributes':['logo',_0x6d4b('0x57'),_0x6d4b('0x59'),_0x6d4b('0x6a'),_0x6d4b('0x6b'),_0x6d4b('0x5a'),_0x6d4b('0x6c'),_0x6d4b('0x5b')],'raw':!![]});})[_0x6d4b('0x1a')](handleEntityNotFound(_0x11e4e0,null))[_0x6d4b('0x1a')](function(_0x226d12){if(_0x226d12){var _0x41c3c7=_0x226d12[_0x6d4b('0x57')]&&fs[_0x6d4b('0x6d')](path[_0x6d4b('0x5c')](config[_0x6d4b('0x5d')],_0x24326f,_['toLower'](_0x226d12[_0x6d4b('0x57')])))?path[_0x6d4b('0x5c')](config[_0x6d4b('0x5d')],_0x24326f,_[_0x6d4b('0x5e')](_0x226d12['loginLogo'])):path[_0x6d4b('0x5c')](config[_0x6d4b('0x5d')],_0x24326f,_[_0x6d4b('0x5e')](_0x6d4b('0x6e')));var _0x1d3418=_0x6d4b('0x60')+_[_0x6d4b('0x64')](_0x6d4b('0x57'));if(_0x226d12[_0x1d3418]||!_0x217a40['custom']){_0x41c3c7=path[_0x6d4b('0x5c')](config[_0x6d4b('0x5d')],_0x24326f,_[_0x6d4b('0x5e')]('default_loginLogo.svg'));}if(!fs[_0x6d4b('0x6d')](_0x41c3c7)){throw new db[(_0x6d4b('0x62'))]['ValidationError'](_['upperFirst'](_0x6d4b('0x57'))+_0x6d4b('0x65'));}return _0x11e4e0['download'](_0x41c3c7);}})['catch'](handleError(_0x11e4e0,null));};exports[_0x6d4b('0x6f')]=function(_0x59c6f6,_0x5a50d8){return db[_0x6d4b('0x48')][_0x6d4b('0x4f')]({'where':{'id':_0x59c6f6['params']['id']},'attributes':[_0x6d4b('0x70')]})[_0x6d4b('0x1a')](respondWithResult(_0x5a50d8,null))['catch'](handleError(_0x5a50d8,null));};exports[_0x6d4b('0x71')]=function(_0x5b294a,_0x46996d,_0x1b79a9){if(_0x5b294a['file']&&_0x5b294a[_0x6d4b('0x53')][_0x6d4b('0x54')]){_0x5b294a['body']['preferred']=_0x5b294a['file'][_0x6d4b('0x54')];}return db['Setting'][_0x6d4b('0x4f')]({'where':{'id':_0x5b294a[_0x6d4b('0x52')]['id']}})['then'](handleEntityNotFound(_0x46996d,null))[_0x6d4b('0x1a')](saveUpdates(_0x5b294a[_0x6d4b('0x51')],null))[_0x6d4b('0x1a')](respondWithResult(_0x46996d,null))['catch'](handleError(_0x46996d,null));};var utilLicense=require(_0x6d4b('0x67'));exports[_0x6d4b('0x72')]=function(_0x138be4,_0xbdd64c,_0x190ebd){var _0x22c774=_0x6d4b('0x58');var _0x8a2e43={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x2ab2b3){if(_0x2ab2b3){_0x8a2e43=_0x2ab2b3;}return db[_0x6d4b('0x48')][_0x6d4b('0x4f')]({'where':{'id':_0x138be4[_0x6d4b('0x52')]['id']},'attributes':[_0x6d4b('0x55'),_0x6d4b('0x57'),'preferred',_0x6d4b('0x6a'),'defaultLogo',_0x6d4b('0x5a'),_0x6d4b('0x6c'),_0x6d4b('0x5b')],'raw':!![]});})[_0x6d4b('0x1a')](handleEntityNotFound(_0xbdd64c,null))[_0x6d4b('0x1a')](function(_0x2694fc){if(_0x2694fc){var _0x37f1f5=_0x2694fc[_0x6d4b('0x59')]&&fs[_0x6d4b('0x6d')](path['join'](config[_0x6d4b('0x5d')],_0x22c774,_[_0x6d4b('0x5e')](_0x2694fc['preferred'])))?path[_0x6d4b('0x5c')](config[_0x6d4b('0x5d')],_0x22c774,_[_0x6d4b('0x5e')](_0x2694fc['preferred'])):path[_0x6d4b('0x5c')](config[_0x6d4b('0x5d')],_0x22c774,_['toLower'](_0x6d4b('0x73')));var _0x2adcd9=_0x6d4b('0x60')+_[_0x6d4b('0x64')](_0x6d4b('0x59'));if(_0x2694fc[_0x2adcd9]||!_0x8a2e43[_0x6d4b('0x61')]||!_0x8a2e43[_0x6d4b('0x59')]){_0x37f1f5=path[_0x6d4b('0x5c')](config[_0x6d4b('0x5d')],_0x22c774,_['toLower'](_0x6d4b('0x73')));}if(!fs[_0x6d4b('0x6d')](_0x37f1f5)){throw new db[(_0x6d4b('0x62'))][(_0x6d4b('0x63'))](_[_0x6d4b('0x64')](_0x6d4b('0x59'))+_0x6d4b('0x65'));}return _0xbdd64c[_0x6d4b('0x66')](_0x37f1f5);}})[_0x6d4b('0x4b')](handleError(_0xbdd64c,null));};exports[_0x6d4b('0x74')]=function(_0x56cfcf,_0x1185e2,_0x539365){if(_0x56cfcf['file']&&_0x56cfcf[_0x6d4b('0x53')]['filename']){_0x56cfcf[_0x6d4b('0x51')]['favicon']=_0x56cfcf['file'][_0x6d4b('0x54')];}return db[_0x6d4b('0x48')]['find']({'where':{'id':_0x56cfcf['params']['id']}})[_0x6d4b('0x1a')](handleEntityNotFound(_0x1185e2,null))[_0x6d4b('0x1a')](saveUpdates(_0x56cfcf[_0x6d4b('0x51')],null))['then'](respondWithResult(_0x1185e2,null))[_0x6d4b('0x4b')](handleError(_0x1185e2,null));};var utilLicense=require(_0x6d4b('0x67'));exports[_0x6d4b('0x75')]=function(_0x2bce0f,_0x5a6b97,_0x5442fc){var _0x56c5eb=_0x6d4b('0x58');var _0x42b67e={'custom':![]};return utilLicense[_0x6d4b('0x69')]()[_0x6d4b('0x1a')](function(_0x2da3b7){if(_0x2da3b7){_0x42b67e=_0x2da3b7;}return db['Setting'][_0x6d4b('0x4f')]({'where':{'id':_0x2bce0f['params']['id']},'attributes':[_0x6d4b('0x55'),_0x6d4b('0x57'),_0x6d4b('0x59'),_0x6d4b('0x6a'),'defaultLogo',_0x6d4b('0x5a'),'defaultPreferred','defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x5a6b97,null))[_0x6d4b('0x1a')](function(_0x2feebf){if(_0x2feebf){var _0x1f5ade=_0x2feebf['favicon']&&fs[_0x6d4b('0x6d')](path[_0x6d4b('0x5c')](config[_0x6d4b('0x5d')],_0x56c5eb,_['toLower'](_0x2feebf[_0x6d4b('0x6a')])))?path[_0x6d4b('0x5c')](config[_0x6d4b('0x5d')],_0x56c5eb,_['toLower'](_0x2feebf[_0x6d4b('0x6a')])):path[_0x6d4b('0x5c')](config[_0x6d4b('0x5d')],_0x56c5eb,_['toLower']('default_favicon.ico'));var _0x5bd6ef=_0x6d4b('0x60')+_[_0x6d4b('0x64')]('favicon');if(_0x2feebf[_0x5bd6ef]||!_0x42b67e[_0x6d4b('0x61')]){_0x1f5ade=path['join'](config[_0x6d4b('0x5d')],_0x56c5eb,_['toLower'](_0x6d4b('0x76')));}if(!fs['existsSync'](_0x1f5ade)){throw new db[(_0x6d4b('0x62'))][(_0x6d4b('0x63'))](_[_0x6d4b('0x64')]('favicon')+_0x6d4b('0x65'));}return _0x5a6b97[_0x6d4b('0x66')](_0x1f5ade);}})[_0x6d4b('0x4b')](handleError(_0x5a6b97,null));};exports[_0x6d4b('0x77')]=function(_0x3f7dff,_0x1ad0b7){var _0x305780={'offset':moment()['utcOffset']()};_0x305780[_0x6d4b('0x78')]=moment()[_0x6d4b('0x79')](_0x305780[_0x6d4b('0x29')])[_0x6d4b('0x7a')](_0x6d4b('0x7b'));return _0x1ad0b7['status'](0xc8)[_0x6d4b('0x32')](_0x305780);}; \ No newline at end of file +var _0x0f16=['server/files/images/logos','loginLogo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','ValidationError','\x20not\x20found','defaultPreferred','default_loginLogo.svg','download','gdpr','addPreferred','getPreferred','getLicense','default_preferred.png','upperFirst','custom','Sequelize','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','info','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','Setting,\x20%s,\x20%s','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','Setting','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filters','filter','merge','include','findAll','catch','show','params','includeAll','find','body','addLogo','file','filename','logo','getLogo'];(function(_0x5777ed,_0x12ec36){var _0xffcfd1=function(_0x1218cc){while(--_0x1218cc){_0x5777ed['push'](_0x5777ed['shift']());}};_0xffcfd1(++_0x12ec36);}(_0x0f16,0x192));var _0x60f1=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x0f16[_0x4b369d];return _0x571a98;};'use strict';var emlformat=require(_0x60f1('0x0'));var rimraf=require(_0x60f1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x60f1('0x2'));var rp=require(_0x60f1('0x3'));var moment=require(_0x60f1('0x4'));var BPromise=require(_0x60f1('0x5'));var Mustache=require(_0x60f1('0x6'));var util=require(_0x60f1('0x7'));var path=require('path');var sox=require(_0x60f1('0x8'));var csv=require(_0x60f1('0x9'));var ejs=require(_0x60f1('0xa'));var fs=require('fs');var fs_extra=require(_0x60f1('0xb'));var _=require(_0x60f1('0xc'));var squel=require(_0x60f1('0xd'));var crypto=require(_0x60f1('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x60f1('0xf'));var toCsv=require(_0x60f1('0x9'));var querystring=require(_0x60f1('0x10'));var Papa=require(_0x60f1('0x11'));var Redis=require(_0x60f1('0x12'));var authService=require(_0x60f1('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x60f1('0x14'));var hardwareService=require(_0x60f1('0x15'));var logger=require(_0x60f1('0x16'))('api');var utils=require(_0x60f1('0x17'));var config=require(_0x60f1('0x18'));var licenseUtil=require(_0x60f1('0x19'));var db=require('../../mysqldb')['db'];var jayson=require(_0x60f1('0x1a'));var client=jayson[_0x60f1('0x1b')][_0x60f1('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x1ddffe,_0x4a48ad,_0x4be0df,_0x16af08){return new BPromise(function(_0x5e7f90,_0x3df4b9){var _0x5bc7c7=_0x16af08||client;return _0x5bc7c7[_0x60f1('0x1d')](_0x1ddffe,_0x4be0df)['then'](function(_0x806026){logger[_0x60f1('0x1e')]('Setting,\x20%s,\x20%s',_0x4a48ad,'request\x20sent');logger['debug'](_0x60f1('0x1f'),_0x4a48ad,_0x60f1('0x20'),JSON[_0x60f1('0x21')](_0x806026));if(_0x806026[_0x60f1('0x22')]){if(_0x806026['error'][_0x60f1('0x23')]===0x1f4){logger[_0x60f1('0x22')]('Setting,\x20%s,\x20%s',_0x4a48ad,_0x806026['error'][_0x60f1('0x24')]);return _0x3df4b9(_0x806026[_0x60f1('0x22')][_0x60f1('0x24')]);}logger[_0x60f1('0x22')](_0x60f1('0x25'),_0x4a48ad,_0x806026[_0x60f1('0x22')][_0x60f1('0x24')]);return _0x5e7f90(_0x806026['error'][_0x60f1('0x24')]);}else{logger[_0x60f1('0x1e')](_0x60f1('0x25'),_0x4a48ad,_0x60f1('0x20'));_0x5e7f90(_0x806026['result'][_0x60f1('0x24')]);}})['catch'](function(_0x5993fc){logger[_0x60f1('0x22')](_0x60f1('0x25'),_0x4a48ad,_0x5993fc);_0x3df4b9(_0x5993fc);});});}function respondWithStatusCode(_0x333d77,_0x1c970a){_0x1c970a=_0x1c970a||0xcc;return function(_0x369f7b){if(_0x369f7b){return _0x333d77['sendStatus'](_0x1c970a);}return _0x333d77[_0x60f1('0x26')](_0x1c970a)[_0x60f1('0x27')]();};}function respondWithResult(_0x3c9942,_0x4a6b5d){_0x4a6b5d=_0x4a6b5d||0xc8;return function(_0x2df145){if(_0x2df145){return _0x3c9942[_0x60f1('0x26')](_0x4a6b5d)[_0x60f1('0x28')](_0x2df145);}};}function respondWithFilteredResult(_0x2eb607,_0x4ae84f){return function(_0x149b90){if(_0x149b90){var _0x4cab74=typeof _0x4ae84f['offset']===_0x60f1('0x29')&&typeof _0x4ae84f[_0x60f1('0x2a')]==='undefined';var _0x2d383f=_0x149b90[_0x60f1('0x2b')];var _0x51c21b=_0x4cab74?0x0:_0x4ae84f[_0x60f1('0x2c')];var _0x34d80a=_0x4cab74?_0x149b90[_0x60f1('0x2b')]:_0x4ae84f[_0x60f1('0x2c')]+_0x4ae84f[_0x60f1('0x2a')];var _0x2964d9;if(_0x34d80a>=_0x2d383f){_0x34d80a=_0x2d383f;_0x2964d9=0xc8;}else{_0x2964d9=0xce;}_0x2eb607['status'](_0x2964d9);return _0x2eb607[_0x60f1('0x2d')](_0x60f1('0x2e'),_0x51c21b+'-'+_0x34d80a+'/'+_0x2d383f)[_0x60f1('0x28')](_0x149b90);}return null;};}function patchUpdates(_0x24fba7){return function(_0x414478){try{jsonpatch['apply'](_0x414478,_0x24fba7,!![]);}catch(_0x436eab){return BPromise[_0x60f1('0x2f')](_0x436eab);}return _0x414478[_0x60f1('0x30')]();};}function saveUpdates(_0x91c993,_0xadf236){return function(_0x2374a2){if(_0x2374a2){return _0x2374a2[_0x60f1('0x31')](_0x91c993)[_0x60f1('0x32')](function(_0x52d8c6){return _0x52d8c6;});}return null;};}function removeEntity(_0x2d7ae7,_0x2d2b45){return function(_0x1e49f8){if(_0x1e49f8){return _0x1e49f8[_0x60f1('0x33')]()[_0x60f1('0x32')](function(){_0x2d7ae7[_0x60f1('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x507a9c,_0x198799){return function(_0xe9c9ea){if(!_0xe9c9ea){_0x507a9c[_0x60f1('0x34')](0x194);}return _0xe9c9ea;};}function handleError(_0xc7e409,_0x5342a7){_0x5342a7=_0x5342a7||0x1f4;return function(_0x1e641d){logger[_0x60f1('0x22')](_0x1e641d[_0x60f1('0x35')]);if(_0x1e641d['name']){delete _0x1e641d[_0x60f1('0x36')];}_0xc7e409[_0x60f1('0x26')](_0x5342a7)[_0x60f1('0x37')](_0x1e641d);};}exports[_0x60f1('0x38')]=function(_0xea7924,_0x58a90b){var _0x44b872={},_0x575b2c={},_0x4c895a={'count':0x0,'rows':[]};var _0x3ac269=_[_0x60f1('0x39')](db[_0x60f1('0x3a')][_0x60f1('0x3b')],function(_0x53acec){return{'name':_0x53acec[_0x60f1('0x3c')],'type':_0x53acec['type'][_0x60f1('0x3d')]};});_0x575b2c['model']=_[_0x60f1('0x39')](_0x3ac269,_0x60f1('0x36'));_0x575b2c[_0x60f1('0x3e')]=_[_0x60f1('0x3f')](_0xea7924[_0x60f1('0x3e')]);_0x575b2c['filters']=_[_0x60f1('0x40')](_0x575b2c[_0x60f1('0x41')],_0x575b2c[_0x60f1('0x3e')]);_0x44b872[_0x60f1('0x42')]=_[_0x60f1('0x40')](_0x575b2c[_0x60f1('0x41')],qs[_0x60f1('0x43')](_0xea7924[_0x60f1('0x3e')][_0x60f1('0x43')]));_0x44b872[_0x60f1('0x42')]=_0x44b872[_0x60f1('0x42')][_0x60f1('0x44')]?_0x44b872[_0x60f1('0x42')]:_0x575b2c[_0x60f1('0x41')];if(!_0xea7924[_0x60f1('0x3e')]['hasOwnProperty'](_0x60f1('0x45'))){_0x44b872[_0x60f1('0x2a')]=qs[_0x60f1('0x2a')](_0xea7924[_0x60f1('0x3e')][_0x60f1('0x2a')]);_0x44b872['offset']=qs[_0x60f1('0x2c')](_0xea7924['query']['offset']);}_0x44b872[_0x60f1('0x46')]=qs[_0x60f1('0x47')](_0xea7924[_0x60f1('0x3e')][_0x60f1('0x47')]);_0x44b872[_0x60f1('0x48')]=qs['filters'](_[_0x60f1('0x49')](_0xea7924['query'],_0x575b2c[_0x60f1('0x4a')]),_0x3ac269);if(_0xea7924[_0x60f1('0x3e')][_0x60f1('0x4b')]){_0x44b872[_0x60f1('0x48')]=_['merge'](_0x44b872[_0x60f1('0x48')],{'$or':_['map'](_0x3ac269,function(_0x5245ea){if(_0x5245ea['type']!=='VIRTUAL'){var _0x23fc4b={};_0x23fc4b[_0x5245ea['name']]={'$like':'%'+_0xea7924['query'][_0x60f1('0x4b')]+'%'};return _0x23fc4b;}})});}_0x44b872=_[_0x60f1('0x4c')]({},_0x44b872,_0xea7924['options']);var _0x18bb68={'where':_0x44b872[_0x60f1('0x48')]};return db['Setting'][_0x60f1('0x2b')](_0x18bb68)[_0x60f1('0x32')](function(_0xeb15f4){_0x4c895a[_0x60f1('0x2b')]=_0xeb15f4;if(_0xea7924['query']['includeAll']){_0x44b872[_0x60f1('0x4d')]=[{'all':!![]}];}return db[_0x60f1('0x3a')][_0x60f1('0x4e')](_0x44b872);})[_0x60f1('0x32')](function(_0x54c42b){_0x4c895a['rows']=_0x54c42b;return _0x4c895a;})[_0x60f1('0x32')](respondWithFilteredResult(_0x58a90b,_0x44b872))[_0x60f1('0x4f')](handleError(_0x58a90b,null));};exports[_0x60f1('0x50')]=function(_0x3b925c,_0xb477ce){var _0x2fe6de={'raw':![],'where':{'id':_0x3b925c[_0x60f1('0x51')]['id']}},_0x560d7a={};_0x560d7a[_0x60f1('0x41')]=_[_0x60f1('0x3f')](db[_0x60f1('0x3a')][_0x60f1('0x3b')]);_0x560d7a[_0x60f1('0x3e')]=_[_0x60f1('0x3f')](_0x3b925c[_0x60f1('0x3e')]);_0x560d7a['filters']=_[_0x60f1('0x40')](_0x560d7a[_0x60f1('0x41')],_0x560d7a[_0x60f1('0x3e')]);_0x2fe6de[_0x60f1('0x42')]=_[_0x60f1('0x40')](_0x560d7a['model'],qs['fields'](_0x3b925c['query'][_0x60f1('0x43')]));_0x2fe6de[_0x60f1('0x42')]=_0x2fe6de[_0x60f1('0x42')][_0x60f1('0x44')]?_0x2fe6de['attributes']:_0x560d7a[_0x60f1('0x41')];if(_0x3b925c[_0x60f1('0x3e')][_0x60f1('0x52')]){_0x2fe6de['include']=[{'all':!![]}];}_0x2fe6de=_['merge']({},_0x2fe6de,_0x3b925c['options']);return db[_0x60f1('0x3a')][_0x60f1('0x53')](_0x2fe6de)[_0x60f1('0x32')](handleEntityNotFound(_0xb477ce,null))[_0x60f1('0x32')](respondWithResult(_0xb477ce,null))[_0x60f1('0x4f')](handleError(_0xb477ce,null));};exports[_0x60f1('0x31')]=function(_0x554b2e,_0x5dcb55){if(_0x554b2e['body']['id']){delete _0x554b2e['body']['id'];}return db[_0x60f1('0x3a')][_0x60f1('0x53')]({'where':{'id':_0x554b2e[_0x60f1('0x51')]['id']}})[_0x60f1('0x32')](handleEntityNotFound(_0x5dcb55,null))[_0x60f1('0x32')](saveUpdates(_0x554b2e[_0x60f1('0x54')],null))[_0x60f1('0x32')](respondWithResult(_0x5dcb55,null))[_0x60f1('0x4f')](handleError(_0x5dcb55,null));};exports[_0x60f1('0x55')]=function(_0x4e6d15,_0x54eb62,_0x1a07fd){if(_0x4e6d15[_0x60f1('0x56')]&&_0x4e6d15['file'][_0x60f1('0x57')]){_0x4e6d15[_0x60f1('0x54')][_0x60f1('0x58')]=_0x4e6d15[_0x60f1('0x56')][_0x60f1('0x57')];}return db['Setting'][_0x60f1('0x53')]({'where':{'id':_0x4e6d15[_0x60f1('0x51')]['id']}})[_0x60f1('0x32')](handleEntityNotFound(_0x54eb62,null))[_0x60f1('0x32')](saveUpdates(_0x4e6d15[_0x60f1('0x54')],null))[_0x60f1('0x32')](respondWithResult(_0x54eb62,null))[_0x60f1('0x4f')](handleError(_0x54eb62,null));};exports['addLogoLogin']=function(_0x400678,_0x56bed2,_0x38c781){if(_0x400678['file']&&_0x400678[_0x60f1('0x56')][_0x60f1('0x57')]){_0x400678[_0x60f1('0x54')]['loginLogo']=_0x400678[_0x60f1('0x56')][_0x60f1('0x57')];}return db[_0x60f1('0x3a')]['find']({'where':{'id':_0x400678[_0x60f1('0x51')]['id']}})['then'](handleEntityNotFound(_0x56bed2,null))['then'](saveUpdates(_0x400678[_0x60f1('0x54')],null))[_0x60f1('0x32')](respondWithResult(_0x56bed2,null))[_0x60f1('0x4f')](handleError(_0x56bed2,null));};var utilLicense=require(_0x60f1('0x19'));exports[_0x60f1('0x59')]=function(_0x4aa2ba,_0x29c584,_0x21567d){var _0x337259=_0x60f1('0x5a');var _0x32c6c0={'custom':![]};return utilLicense['getLicense']()[_0x60f1('0x32')](function(_0x127e53){if(_0x127e53){_0x32c6c0=_0x127e53;}return db[_0x60f1('0x3a')][_0x60f1('0x53')]({'where':{'id':_0x4aa2ba[_0x60f1('0x51')]['id']},'attributes':[_0x60f1('0x58'),_0x60f1('0x5b'),_0x60f1('0x5c'),_0x60f1('0x5d'),_0x60f1('0x5e'),_0x60f1('0x5f'),'defaultPreferred',_0x60f1('0x60')],'raw':!![]});})['then'](handleEntityNotFound(_0x29c584,null))[_0x60f1('0x32')](function(_0x1a83d1){if(_0x1a83d1){var _0x2a2191=_0x1a83d1['logo']&&fs[_0x60f1('0x61')](path[_0x60f1('0x62')](config[_0x60f1('0x63')],_0x337259,_[_0x60f1('0x64')](_0x1a83d1[_0x60f1('0x58')])))?path[_0x60f1('0x62')](config[_0x60f1('0x63')],_0x337259,_['toLower'](_0x1a83d1[_0x60f1('0x58')])):path[_0x60f1('0x62')](config[_0x60f1('0x63')],_0x337259,_[_0x60f1('0x64')](_0x60f1('0x65')));var _0x4dd48d=_0x60f1('0x66')+_['upperFirst'](_0x60f1('0x58'));if(_0x1a83d1[_0x4dd48d]||!_0x32c6c0['custom']){_0x2a2191=path[_0x60f1('0x62')](config[_0x60f1('0x63')],_0x337259,_[_0x60f1('0x64')]('default_logo.svg'));}if(!fs[_0x60f1('0x61')](_0x2a2191)){throw new db['Sequelize'][(_0x60f1('0x67'))](_['upperFirst']('logo')+_0x60f1('0x68'));}return _0x29c584['download'](_0x2a2191);}})['catch'](handleError(_0x29c584,null));};var utilLicense=require(_0x60f1('0x19'));exports['getLogoLogin']=function(_0x31e895,_0x5d84b5,_0x2e324c){var _0xc93ccd='server/files/images/logos';var _0x244ade={'custom':![]};return utilLicense['getLicense']()[_0x60f1('0x32')](function(_0x1a55ee){if(_0x1a55ee){_0x244ade=_0x1a55ee;}return db['Setting'][_0x60f1('0x53')]({'where':{'id':_0x31e895[_0x60f1('0x51')]['id']},'attributes':[_0x60f1('0x58'),_0x60f1('0x5b'),_0x60f1('0x5c'),_0x60f1('0x5d'),_0x60f1('0x5e'),_0x60f1('0x5f'),_0x60f1('0x69'),_0x60f1('0x60')],'raw':!![]});})['then'](handleEntityNotFound(_0x5d84b5,null))[_0x60f1('0x32')](function(_0x14e40b){if(_0x14e40b){var _0x4b049f=_0x14e40b[_0x60f1('0x5b')]&&fs[_0x60f1('0x61')](path['join'](config[_0x60f1('0x63')],_0xc93ccd,_[_0x60f1('0x64')](_0x14e40b['loginLogo'])))?path[_0x60f1('0x62')](config[_0x60f1('0x63')],_0xc93ccd,_[_0x60f1('0x64')](_0x14e40b[_0x60f1('0x5b')])):path['join'](config[_0x60f1('0x63')],_0xc93ccd,_['toLower']('default_loginLogo.svg'));var _0x56cfe3=_0x60f1('0x66')+_['upperFirst']('loginLogo');if(_0x14e40b[_0x56cfe3]||!_0x244ade['custom']){_0x4b049f=path[_0x60f1('0x62')](config[_0x60f1('0x63')],_0xc93ccd,_[_0x60f1('0x64')](_0x60f1('0x6a')));}if(!fs[_0x60f1('0x61')](_0x4b049f)){throw new db['Sequelize'][(_0x60f1('0x67'))](_['upperFirst'](_0x60f1('0x5b'))+_0x60f1('0x68'));}return _0x5d84b5[_0x60f1('0x6b')](_0x4b049f);}})[_0x60f1('0x4f')](handleError(_0x5d84b5,null));};exports[_0x60f1('0x6c')]=function(_0x494695,_0x4c02f4){return db['Setting']['find']({'where':{'id':_0x494695[_0x60f1('0x51')]['id']},'attributes':['securePassword']})['then'](respondWithResult(_0x4c02f4,null))[_0x60f1('0x4f')](handleError(_0x4c02f4,null));};exports[_0x60f1('0x6d')]=function(_0x2b663d,_0x121e71,_0x15dfd4){if(_0x2b663d[_0x60f1('0x56')]&&_0x2b663d[_0x60f1('0x56')]['filename']){_0x2b663d['body']['preferred']=_0x2b663d[_0x60f1('0x56')][_0x60f1('0x57')];}return db[_0x60f1('0x3a')][_0x60f1('0x53')]({'where':{'id':_0x2b663d[_0x60f1('0x51')]['id']}})[_0x60f1('0x32')](handleEntityNotFound(_0x121e71,null))['then'](saveUpdates(_0x2b663d[_0x60f1('0x54')],null))[_0x60f1('0x32')](respondWithResult(_0x121e71,null))['catch'](handleError(_0x121e71,null));};var utilLicense=require(_0x60f1('0x19'));exports[_0x60f1('0x6e')]=function(_0x4f93aa,_0x170fe9,_0x2b9d40){var _0xdf9fe9=_0x60f1('0x5a');var _0x329b40={'custom':![]};return utilLicense[_0x60f1('0x6f')]()['then'](function(_0x52857c){if(_0x52857c){_0x329b40=_0x52857c;}return db[_0x60f1('0x3a')][_0x60f1('0x53')]({'where':{'id':_0x4f93aa[_0x60f1('0x51')]['id']},'attributes':[_0x60f1('0x58'),'loginLogo','preferred','favicon',_0x60f1('0x5e'),_0x60f1('0x5f'),_0x60f1('0x69'),_0x60f1('0x60')],'raw':!![]});})['then'](handleEntityNotFound(_0x170fe9,null))['then'](function(_0x2d1a59){if(_0x2d1a59){var _0xa628c1=_0x2d1a59['preferred']&&fs['existsSync'](path[_0x60f1('0x62')](config[_0x60f1('0x63')],_0xdf9fe9,_[_0x60f1('0x64')](_0x2d1a59[_0x60f1('0x5c')])))?path[_0x60f1('0x62')](config[_0x60f1('0x63')],_0xdf9fe9,_['toLower'](_0x2d1a59[_0x60f1('0x5c')])):path['join'](config[_0x60f1('0x63')],_0xdf9fe9,_['toLower'](_0x60f1('0x70')));var _0x520ffd=_0x60f1('0x66')+_[_0x60f1('0x71')](_0x60f1('0x5c'));if(_0x2d1a59[_0x520ffd]||!_0x329b40[_0x60f1('0x72')]||!_0x329b40['preferred']){_0xa628c1=path[_0x60f1('0x62')](config[_0x60f1('0x63')],_0xdf9fe9,_[_0x60f1('0x64')](_0x60f1('0x70')));}if(!fs[_0x60f1('0x61')](_0xa628c1)){throw new db[(_0x60f1('0x73'))][(_0x60f1('0x67'))](_[_0x60f1('0x71')](_0x60f1('0x5c'))+_0x60f1('0x68'));}return _0x170fe9['download'](_0xa628c1);}})[_0x60f1('0x4f')](handleError(_0x170fe9,null));};exports['addFavicon']=function(_0x26d013,_0x4fb8e3,_0x528561){if(_0x26d013[_0x60f1('0x56')]&&_0x26d013[_0x60f1('0x56')][_0x60f1('0x57')]){_0x26d013['body']['favicon']=_0x26d013['file']['filename'];}return db[_0x60f1('0x3a')][_0x60f1('0x53')]({'where':{'id':_0x26d013[_0x60f1('0x51')]['id']}})[_0x60f1('0x32')](handleEntityNotFound(_0x4fb8e3,null))[_0x60f1('0x32')](saveUpdates(_0x26d013['body'],null))[_0x60f1('0x32')](respondWithResult(_0x4fb8e3,null))[_0x60f1('0x4f')](handleError(_0x4fb8e3,null));};var utilLicense=require('../../config/license/util');exports[_0x60f1('0x74')]=function(_0x533e74,_0x7688b6,_0x3dd7ea){var _0x1e906b=_0x60f1('0x5a');var _0x30321b={'custom':![]};return utilLicense['getLicense']()['then'](function(_0xc2e3ce){if(_0xc2e3ce){_0x30321b=_0xc2e3ce;}return db[_0x60f1('0x3a')]['find']({'where':{'id':_0x533e74[_0x60f1('0x51')]['id']},'attributes':[_0x60f1('0x58'),'loginLogo',_0x60f1('0x5c'),'favicon',_0x60f1('0x5e'),_0x60f1('0x5f'),_0x60f1('0x69'),_0x60f1('0x60')],'raw':!![]});})[_0x60f1('0x32')](handleEntityNotFound(_0x7688b6,null))['then'](function(_0x35ac98){if(_0x35ac98){var _0x421464=_0x35ac98['favicon']&&fs[_0x60f1('0x61')](path[_0x60f1('0x62')](config[_0x60f1('0x63')],_0x1e906b,_['toLower'](_0x35ac98[_0x60f1('0x5d')])))?path[_0x60f1('0x62')](config[_0x60f1('0x63')],_0x1e906b,_['toLower'](_0x35ac98[_0x60f1('0x5d')])):path[_0x60f1('0x62')](config[_0x60f1('0x63')],_0x1e906b,_[_0x60f1('0x64')](_0x60f1('0x75')));var _0x5357d5=_0x60f1('0x66')+_[_0x60f1('0x71')](_0x60f1('0x5d'));if(_0x35ac98[_0x5357d5]||!_0x30321b[_0x60f1('0x72')]){_0x421464=path[_0x60f1('0x62')](config[_0x60f1('0x63')],_0x1e906b,_[_0x60f1('0x64')](_0x60f1('0x75')));}if(!fs['existsSync'](_0x421464)){throw new db[(_0x60f1('0x73'))]['ValidationError'](_[_0x60f1('0x71')](_0x60f1('0x5d'))+_0x60f1('0x68'));}return _0x7688b6[_0x60f1('0x6b')](_0x421464);}})['catch'](handleError(_0x7688b6,null));};exports[_0x60f1('0x76')]=function(_0x4ab40e,_0x36423a){var _0x36e83a={'offset':moment()[_0x60f1('0x77')]()};_0x36e83a[_0x60f1('0x78')]=moment()[_0x60f1('0x77')](_0x36e83a['offset'])[_0x60f1('0x79')](_0x60f1('0x7a'));return _0x36423a[_0x60f1('0x26')](0xc8)[_0x60f1('0x37')](_0x36e83a);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 76dc520..f65fb35 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 _0xe14b=['bluebird','path','./setting.attributes','exports','define','Setting','settings','lodash','util','moment'];(function(_0x2a3e86,_0x2c2fb5){var _0x26ee7a=function(_0x3c201e){while(--_0x3c201e){_0x2a3e86['push'](_0x2a3e86['shift']());}};_0x26ee7a(++_0x2c2fb5);}(_0xe14b,0x93));var _0xbe14=function(_0x210051,_0x58a9eb){_0x210051=_0x210051-0x0;var _0x2f7709=_0xe14b[_0x210051];return _0x2f7709;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x008c=['define','settings','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports'];(function(_0x1ad659,_0x1ab26a){var _0x56d7e2=function(_0x3c3f02){while(--_0x3c3f02){_0x1ad659['push'](_0x1ad659['shift']());}};_0x56d7e2(++_0x1ab26a);}(_0x008c,0x188));var _0xc008=function(_0x211f66,_0x6d409f){_0x211f66=_0x211f66-0x0;var _0x324240=_0x008c[_0x211f66];return _0x324240;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('Setting',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 86d0c77..9bbf660 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 _0x6b70=['stringify','error','message','info','result','catch','Setting','options','where','map','include','model','attributes','ShowSetting','lodash','util','bluebird','randomstring','../../config/logger','rpc','request','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s'];(function(_0x24a3f6,_0x3564e7){var _0x28a55b=function(_0xab8ff){while(--_0xab8ff){_0x24a3f6['push'](_0x24a3f6['shift']());}};_0x28a55b(++_0x3564e7);}(_0x6b70,0x146));var _0x06b7=function(_0x1d7791,_0x2a291f){_0x1d7791=_0x1d7791-0x0;var _0x2293f8=_0x6b70[_0x1d7791];return _0x2293f8;};'use strict';var _=require(_0x06b7('0x0'));var util=require(_0x06b7('0x1'));var moment=require('moment');var BPromise=require(_0x06b7('0x2'));var rs=require(_0x06b7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x06b7('0x4'))(_0x06b7('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5a44b9,_0x30e8c5,_0x4a9d0b){return new BPromise(function(_0x1d92e1,_0xf2c0c2){return client[_0x06b7('0x6')](_0x5a44b9,_0x4a9d0b)[_0x06b7('0x7')](function(_0x3a4bc4){logger['info'](_0x06b7('0x8'),_0x30e8c5,_0x06b7('0x9'));logger[_0x06b7('0xa')](_0x06b7('0xb'),_0x30e8c5,'request\x20sent',JSON[_0x06b7('0xc')](_0x3a4bc4));if(_0x3a4bc4['error']){if(_0x3a4bc4['error']['code']===0x1f4){logger[_0x06b7('0xd')](_0x06b7('0x8'),_0x30e8c5,_0x3a4bc4[_0x06b7('0xd')][_0x06b7('0xe')]);return _0xf2c0c2(_0x3a4bc4['error']['message']);}logger[_0x06b7('0xd')](_0x06b7('0x8'),_0x30e8c5,_0x3a4bc4['error']['message']);return _0x1d92e1(_0x3a4bc4['error']['message']);}else{logger[_0x06b7('0xf')]('Setting,\x20%s,\x20%s',_0x30e8c5,'request\x20sent');_0x1d92e1(_0x3a4bc4[_0x06b7('0x10')][_0x06b7('0xe')]);}})[_0x06b7('0x11')](function(_0x4f3a99){logger[_0x06b7('0xd')]('Setting,\x20%s,\x20%s',_0x30e8c5,_0x4f3a99);_0xf2c0c2(_0x4f3a99);});});}exports['ShowSetting']=function(_0x42c207){var _0x433144=this;return new Promise(function(_0x3edf80,_0x16b662){return db[_0x06b7('0x12')]['find']({'raw':_0x42c207[_0x06b7('0x13')]?_0x42c207['options']['raw']===undefined?!![]:![]:!![],'where':_0x42c207[_0x06b7('0x13')]?_0x42c207[_0x06b7('0x13')][_0x06b7('0x14')]||null:null,'attributes':_0x42c207[_0x06b7('0x13')]?_0x42c207[_0x06b7('0x13')]['attributes']||null:null,'include':_0x42c207['options']?_0x42c207[_0x06b7('0x13')]['include']?_[_0x06b7('0x15')](_0x42c207[_0x06b7('0x13')][_0x06b7('0x16')],function(_0x364f34){return{'model':db[_0x364f34[_0x06b7('0x17')]],'as':_0x364f34['as'],'attributes':_0x364f34[_0x06b7('0x18')],'include':_0x364f34[_0x06b7('0x16')]?_[_0x06b7('0x15')](_0x364f34[_0x06b7('0x16')],function(_0x26ba34){return{'model':db[_0x26ba34[_0x06b7('0x17')]],'as':_0x26ba34['as'],'attributes':_0x26ba34[_0x06b7('0x18')],'include':_0x26ba34['include']?_['map'](_0x26ba34[_0x06b7('0x16')],function(_0x241c70){return{'model':db[_0x241c70[_0x06b7('0x17')]],'as':_0x241c70['as'],'attributes':_0x241c70['attributes']};}):[]};}):[]};}):[]:[]})[_0x06b7('0x7')](function(_0x44be11){logger[_0x06b7('0xf')](_0x06b7('0x19'),_0x42c207);logger[_0x06b7('0xa')](_0x06b7('0x19'),_0x42c207,JSON[_0x06b7('0xc')](_0x44be11));_0x3edf80(_0x44be11);})[_0x06b7('0x11')](function(_0x4337a6){logger['error']('ShowSetting',_0x4337a6[_0x06b7('0xe')],_0x42c207);_0x16b662(_0x433144[_0x06b7('0xd')](0x1f4,_0x4337a6[_0x06b7('0xe')]));});});}; \ No newline at end of file +var _0x57d0=['http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','error','code','message','ShowSetting','Setting','find','options','where','attributes','include','map','model','stringify','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x481ee8,_0x5aa574){var _0x5ad55f=function(_0x81c176){while(--_0x81c176){_0x481ee8['push'](_0x481ee8['shift']());}};_0x5ad55f(++_0x5aa574);}(_0x57d0,0x135));var _0x057d=function(_0x1e48d3,_0x5d8c43){_0x1e48d3=_0x1e48d3-0x0;var _0x2852b1=_0x57d0[_0x1e48d3];return _0x2852b1;};'use strict';var _=require(_0x057d('0x0'));var util=require(_0x057d('0x1'));var moment=require(_0x057d('0x2'));var BPromise=require(_0x057d('0x3'));var rs=require(_0x057d('0x4'));var fs=require('fs');var Redis=require(_0x057d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x057d('0x6'));var logger=require(_0x057d('0x7'))(_0x057d('0x8'));var config=require(_0x057d('0x9'));var jayson=require(_0x057d('0xa'));var client=jayson['client'][_0x057d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45f5f5,_0x37a4e6,_0x3ee1e3){return new BPromise(function(_0x1dae28,_0x410b80){return client[_0x057d('0xc')](_0x45f5f5,_0x3ee1e3)[_0x057d('0xd')](function(_0x3fd359){logger[_0x057d('0xe')](_0x057d('0xf'),_0x37a4e6,_0x057d('0x10'));logger[_0x057d('0x11')]('Setting,\x20%s,\x20%s,\x20%s',_0x37a4e6,_0x057d('0x10'),JSON['stringify'](_0x3fd359));if(_0x3fd359[_0x057d('0x12')]){if(_0x3fd359[_0x057d('0x12')][_0x057d('0x13')]===0x1f4){logger[_0x057d('0x12')](_0x057d('0xf'),_0x37a4e6,_0x3fd359[_0x057d('0x12')]['message']);return _0x410b80(_0x3fd359[_0x057d('0x12')][_0x057d('0x14')]);}logger[_0x057d('0x12')]('Setting,\x20%s,\x20%s',_0x37a4e6,_0x3fd359[_0x057d('0x12')][_0x057d('0x14')]);return _0x1dae28(_0x3fd359[_0x057d('0x12')][_0x057d('0x14')]);}else{logger['info'](_0x057d('0xf'),_0x37a4e6,_0x057d('0x10'));_0x1dae28(_0x3fd359['result'][_0x057d('0x14')]);}})['catch'](function(_0x43584f){logger[_0x057d('0x12')](_0x057d('0xf'),_0x37a4e6,_0x43584f);_0x410b80(_0x43584f);});});}exports[_0x057d('0x15')]=function(_0x11574a){var _0x507717=this;return new Promise(function(_0xd0e565,_0xf05982){return db[_0x057d('0x16')][_0x057d('0x17')]({'raw':_0x11574a['options']?_0x11574a[_0x057d('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x11574a[_0x057d('0x18')]?_0x11574a[_0x057d('0x18')][_0x057d('0x19')]||null:null,'attributes':_0x11574a['options']?_0x11574a['options'][_0x057d('0x1a')]||null:null,'include':_0x11574a[_0x057d('0x18')]?_0x11574a['options'][_0x057d('0x1b')]?_[_0x057d('0x1c')](_0x11574a[_0x057d('0x18')][_0x057d('0x1b')],function(_0x31e970){return{'model':db[_0x31e970[_0x057d('0x1d')]],'as':_0x31e970['as'],'attributes':_0x31e970['attributes'],'include':_0x31e970['include']?_[_0x057d('0x1c')](_0x31e970[_0x057d('0x1b')],function(_0x5e627f){return{'model':db[_0x5e627f['model']],'as':_0x5e627f['as'],'attributes':_0x5e627f[_0x057d('0x1a')],'include':_0x5e627f[_0x057d('0x1b')]?_[_0x057d('0x1c')](_0x5e627f[_0x057d('0x1b')],function(_0x2ddcfc){return{'model':db[_0x2ddcfc[_0x057d('0x1d')]],'as':_0x2ddcfc['as'],'attributes':_0x2ddcfc[_0x057d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x057d('0xd')](function(_0xb67438){logger[_0x057d('0xe')](_0x057d('0x15'),_0x11574a);logger[_0x057d('0x11')]('ShowSetting',_0x11574a,JSON[_0x057d('0x1e')](_0xb67438));_0xd0e565(_0xb67438);})[_0x057d('0x1f')](function(_0x5a631b){logger['error'](_0x057d('0x15'),_0x5a631b['message'],_0x11574a);_0xf05982(_0x507717[_0x057d('0x12')](0x1f4,_0x5a631b[_0x057d('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 744612f..b8fdc0d 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 _0x326f=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','getInteractions','/:id/status','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','update','delete','/:id','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer'];(function(_0x2c5340,_0x5c86e5){var _0x3c505e=function(_0x1089d9){while(--_0x1089d9){_0x2c5340['push'](_0x2c5340['shift']());}};_0x3c505e(++_0x5c86e5);}(_0x326f,0xd1));var _0xf326=function(_0x58ce5e,_0x3862dd){_0x58ce5e=_0x58ce5e-0x0;var _0x2cabd6=_0x326f[_0x58ce5e];return _0x2cabd6;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var fs_extra=require(_0xf326('0x4'));var auth=require(_0xf326('0x5'));var interaction=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var controller=require(_0xf326('0x8'));router[_0xf326('0x9')]('/',auth[_0xf326('0xa')](),controller['index']);router[_0xf326('0x9')](_0xf326('0xb'),auth[_0xf326('0xa')](),controller[_0xf326('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xf326('0xd')]);router[_0xf326('0x9')](_0xf326('0xe'),auth[_0xf326('0xa')](),controller[_0xf326('0xf')]);router['get'](_0xf326('0x10'),auth['isAuthenticated'](),controller[_0xf326('0x11')]);router['get'](_0xf326('0x12'),auth['isAuthenticated'](),controller[_0xf326('0x13')]);router[_0xf326('0x9')]('/:id/interactions',auth[_0xf326('0xa')](),controller[_0xf326('0x14')]);router[_0xf326('0x9')](_0xf326('0x15'),controller['statusGet']);router[_0xf326('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0xf326('0x16')]);router[_0xf326('0x17')]('/',auth[_0xf326('0xa')](),controller[_0xf326('0x18')]);router[_0xf326('0x17')](_0xf326('0xe'),auth[_0xf326('0xa')](),controller[_0xf326('0x19')]);router['post'](_0xf326('0x10'),auth[_0xf326('0xa')](),controller[_0xf326('0x1a')]);router[_0xf326('0x17')](_0xf326('0x1b'),controller[_0xf326('0x1c')]);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0xf326('0x1d')]);router[_0xf326('0x17')]('/:id/send',auth['isAuthenticated'](),controller[_0xf326('0x1e')]);router['post']('/:id/status',controller[_0xf326('0x1f')]);router[_0xf326('0x17')]('/:id/users',auth['isAuthenticated'](),controller[_0xf326('0x20')]);router[_0xf326('0x21')]('/:id',auth[_0xf326('0xa')](),controller[_0xf326('0x22')]);router[_0xf326('0x23')](_0xf326('0x24'),auth[_0xf326('0xa')](),controller[_0xf326('0x25')]);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller[_0xf326('0x26')]);router[_0xf326('0x23')](_0xf326('0x10'),auth[_0xf326('0xa')](),controller[_0xf326('0x27')]);router[_0xf326('0x23')]('/:id/users',auth[_0xf326('0xa')](),controller[_0xf326('0x28')]);module[_0xf326('0x29')]=router; \ No newline at end of file +var _0xc4aa=['statusGet','/:id/users','getAgents','post','addDisposition','addAnswer','notify','addApplications','/:id/send','send','status','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status'];(function(_0x25fe5f,_0x553196){var _0x50a435=function(_0x211634){while(--_0x211634){_0x25fe5f['push'](_0x25fe5f['shift']());}};_0x50a435(++_0x553196);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0xc4aa[_0x255d5b];return _0x3e141a;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0x8')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller['describe']);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router['get'](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xf')]);router['get'](_0xac4a('0x10'),auth['isAuthenticated'](),controller[_0xac4a('0x11')]);router['get'](_0xac4a('0x12'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x13')]);router['get'](_0xac4a('0x14'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x15')]);router[_0xac4a('0x8')](_0xac4a('0x16'),controller[_0xac4a('0x17')]);router[_0xac4a('0x8')](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x19')]);router[_0xac4a('0x1a')]('/',auth[_0xac4a('0x9')](),controller['create']);router[_0xac4a('0x1a')](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x1b')]);router[_0xac4a('0x1a')](_0xac4a('0x10'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x1c')]);router['post']('/:id/notify',controller[_0xac4a('0x1d')]);router[_0xac4a('0x1a')](_0xac4a('0x12'),auth['isAuthenticated'](),controller[_0xac4a('0x1e')]);router[_0xac4a('0x1a')](_0xac4a('0x1f'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x20')]);router[_0xac4a('0x1a')](_0xac4a('0x16'),controller[_0xac4a('0x21')]);router['post'](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller['addAgents']);router[_0xac4a('0x22')](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x23')]);router['delete'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x24')]);router[_0xac4a('0x25')](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x26')]);router[_0xac4a('0x25')](_0xac4a('0x10'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x27')]);router[_0xac4a('0x25')](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x28')]);module[_0xac4a('0x29')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index c79702a..f4d26db 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 _0xf3a9=['mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','name','STRING','twilio','skebby','connectel','clicksend','plivo','bandwidth','csc','infobip','intelepeer','ENUM','BOOLEAN','TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x5c18ef,_0xa2e81d){var _0x33789d=function(_0x5761a9){while(--_0x5761a9){_0x5c18ef['push'](_0x5c18ef['shift']());}};_0x33789d(++_0xa2e81d);}(_0xf3a9,0xd4));var _0x9f3a=function(_0x689a09,_0x10de3c){_0x689a09=_0x689a09-0x0;var _0x29c17d=_0xf3a9[_0x689a09];return _0x29c17d;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x9f3a('0x0'));module[_0x9f3a('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x9f3a('0x2'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x9f3a('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x9f3a('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x9f3a('0x3')]},'type':{'type':Sequelize['ENUM'](_0x9f3a('0x4'),_0x9f3a('0x5'),_0x9f3a('0x6'),_0x9f3a('0x7'),_0x9f3a('0x8'),'clickatell',_0x9f3a('0x9'),_0x9f3a('0xa'),_0x9f3a('0xb'),_0x9f3a('0xc'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x9f3a('0x3')]},'smsMethod':{'type':Sequelize[_0x9f3a('0xd')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x9f3a('0x3')]},'apiKey':{'type':Sequelize[_0x9f3a('0x3')]},'applicationId':{'type':Sequelize[_0x9f3a('0x3')]},'accountId':{'type':Sequelize[_0x9f3a('0x3')]},'senderString':{'type':Sequelize[_0x9f3a('0x3')]},'deliveryReport':{'type':Sequelize[_0x9f3a('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0x9f3a('0x3')]},'notificationTemplate':{'type':Sequelize[_0x9f3a('0xf')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x9f3a('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9f3a('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9f3a('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9f3a('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9f3a('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9f3a('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x9f3a('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x9f3a('0x11')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x9f3a('0x12'),'set':function(_0xc60728){if(!_0xc60728)this['setDataValue'](_0x9f3a('0x13'),null);this['setDataValue'](_0x9f3a('0x14'),_0xc60728);}}}; \ No newline at end of file +var _0x55c4=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','ENUM','twilio','skebby','connectel','bandwidth','csc','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x35f9d8,_0x4e2b64){var _0x15162c=function(_0x5cc2ea){while(--_0x5cc2ea){_0x35f9d8['push'](_0x35f9d8['shift']());}};_0x15162c(++_0x4e2b64);}(_0x55c4,0x180));var _0x455c=function(_0x15b522,_0x16a02b){_0x15b522=_0x15b522-0x0;var _0x22a0d3=_0x55c4[_0x15b522];return _0x22a0d3;};'use strict';var Sequelize=require(_0x455c('0x0'));var rs=require(_0x455c('0x1'));module[_0x455c('0x2')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x455c('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x455c('0x3')]},'type':{'type':Sequelize[_0x455c('0x4')](_0x455c('0x5'),_0x455c('0x6'),_0x455c('0x7'),'clicksend','plivo','clickatell',_0x455c('0x8'),_0x455c('0x9'),_0x455c('0xa'),_0x455c('0xb'))},'accountSid':{'type':Sequelize[_0x455c('0x3')]},'authId':{'type':Sequelize[_0x455c('0x3')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0x455c('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0x455c('0x3')]},'password':{'type':Sequelize[_0x455c('0x3')]},'apiKey':{'type':Sequelize[_0x455c('0x3')]},'applicationId':{'type':Sequelize[_0x455c('0x3')]},'accountId':{'type':Sequelize[_0x455c('0x3')]},'senderString':{'type':Sequelize[_0x455c('0x3')]},'deliveryReport':{'type':Sequelize[_0x455c('0xc')],'defaultValue':![]},'description':{'type':Sequelize[_0x455c('0x3')]},'notificationTemplate':{'type':Sequelize[_0x455c('0xd')],'defaultValue':function(){return _0x455c('0xe');}},'notificationSound':{'type':Sequelize[_0x455c('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x455c('0xc')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x455c('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x455c('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x455c('0xc')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x455c('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x455c('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x455c('0xf')],'comment':_0x455c('0x10')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x455c('0x11'),'set':function(_0xb2916e){if(!_0xb2916e)this['setDataValue'](_0x455c('0x12'),null);this[_0x455c('0x13')](_0x455c('0x14'),_0xb2916e);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 8e9cde8..f77f325 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 _0xc4c0=['sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Pause','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','findAll','ids','CannedAnswer','removeAnswers','notify','sms','SmsApplication','account','applications','orderBy','asc','Applications','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','type','twilio','from','Body','skebby','sender','text','connectel','clicksend','messageId','From','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','omit','contact','SmsInteraction','interaction','created','autoclose','push','close','unmanaged','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','addApplications','sequelize','bulkCreate','findAndCountAll','priority','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','List','Messages','spread','dataValues','received\x20delivery\x20report\x20from','skebby_dispatch_id','requestid','statusInt','message_id','status_code','groupName','DELIVERED','redif','inspect','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','statusGet','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./smsAccount.socket','jayson/promise','then','info','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','SmsAccounts','UserProfileResource','destroy','stack','name','send','mandatoryDispositionPause','SmsAccount','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x42e3ba,_0x10744e){var _0x658f2c=function(_0x2f3ec1){while(--_0x2f3ec1){_0x42e3ba['push'](_0x42e3ba['shift']());}};_0x658f2c(++_0x10744e);}(_0xc4c0,0x98));var _0x0c4c=function(_0x310a1b,_0x4c9129){_0x310a1b=_0x310a1b-0x0;var _0xdea206=_0xc4c0[_0x310a1b];return _0xdea206;};'use strict';var emlformat=require(_0x0c4c('0x0'));var rimraf=require(_0x0c4c('0x1'));var zipdir=require(_0x0c4c('0x2'));var jsonpatch=require(_0x0c4c('0x3'));var rp=require(_0x0c4c('0x4'));var moment=require(_0x0c4c('0x5'));var BPromise=require(_0x0c4c('0x6'));var Mustache=require('mustache');var util=require(_0x0c4c('0x7'));var path=require('path');var sox=require(_0x0c4c('0x8'));var csv=require(_0x0c4c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0c4c('0xa'));var _=require(_0x0c4c('0xb'));var squel=require('squel');var crypto=require(_0x0c4c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0c4c('0xd'));var toCsv=require(_0x0c4c('0x9'));var querystring=require(_0x0c4c('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0c4c('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0c4c('0x10'));var logger=require(_0x0c4c('0x11'))(_0x0c4c('0x12'));var utils=require(_0x0c4c('0x13'));var config=require(_0x0c4c('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x0c4c('0x15'))['db'];config[_0x0c4c('0x16')]=_[_0x0c4c('0x17')](config[_0x0c4c('0x16')],{'host':_0x0c4c('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0c4c('0x16')]));require(_0x0c4c('0x19'))['register'](socket);var jayson=require(_0x0c4c('0x1a'));var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x1d4212,_0x1adc61,_0x39baa6,_0x13248f){return new BPromise(function(_0x23c032,_0x4cfbae){var _0x1a5c8b=_0x13248f||client;return _0x1a5c8b['request'](_0x1d4212,_0x39baa6)[_0x0c4c('0x1b')](function(_0x12041a){logger[_0x0c4c('0x1c')]('SmsAccount,\x20%s,\x20%s',_0x1adc61,_0x0c4c('0x1d'));logger[_0x0c4c('0x1e')](_0x0c4c('0x1f'),_0x1adc61,_0x0c4c('0x1d'),JSON[_0x0c4c('0x20')](_0x12041a));if(_0x12041a[_0x0c4c('0x21')]){if(_0x12041a[_0x0c4c('0x21')][_0x0c4c('0x22')]===0x1f4){logger['error'](_0x0c4c('0x23'),_0x1adc61,_0x12041a['error'][_0x0c4c('0x24')]);return _0x4cfbae(_0x12041a[_0x0c4c('0x21')]['message']);}logger[_0x0c4c('0x21')]('SmsAccount,\x20%s,\x20%s',_0x1adc61,_0x12041a[_0x0c4c('0x21')][_0x0c4c('0x24')]);return _0x23c032(_0x12041a['error']['message']);}else{logger[_0x0c4c('0x1c')](_0x0c4c('0x23'),_0x1adc61,_0x0c4c('0x1d'));_0x23c032(_0x12041a[_0x0c4c('0x25')][_0x0c4c('0x24')]);}})['catch'](function(_0x32a4e2){logger[_0x0c4c('0x21')]('SmsAccount,\x20%s,\x20%s',_0x1adc61,_0x32a4e2);_0x4cfbae(_0x32a4e2);});});}function respondWithStatusCode(_0x1bbb79,_0x569ad5){_0x569ad5=_0x569ad5||0xcc;return function(_0x478cc6){if(_0x478cc6){return _0x1bbb79[_0x0c4c('0x26')](_0x569ad5);}return _0x1bbb79[_0x0c4c('0x27')](_0x569ad5)[_0x0c4c('0x28')]();};}function respondWithResult(_0x347ce1,_0x4e6a18){_0x4e6a18=_0x4e6a18||0xc8;return function(_0x3a37f1){if(_0x3a37f1){return _0x347ce1['status'](_0x4e6a18)[_0x0c4c('0x29')](_0x3a37f1);}};}function respondWithFilteredResult(_0x22bab8,_0x39bcd9){return function(_0x46f8d9){if(_0x46f8d9){var _0x32118e=typeof _0x39bcd9[_0x0c4c('0x2a')]===_0x0c4c('0x2b')&&typeof _0x39bcd9[_0x0c4c('0x2c')]==='undefined';var _0x31d414=_0x46f8d9[_0x0c4c('0x2d')];var _0x344f08=_0x32118e?0x0:_0x39bcd9[_0x0c4c('0x2a')];var _0x1840d7=_0x32118e?_0x46f8d9[_0x0c4c('0x2d')]:_0x39bcd9[_0x0c4c('0x2a')]+_0x39bcd9[_0x0c4c('0x2c')];var _0x213ae7;if(_0x1840d7>=_0x31d414){_0x1840d7=_0x31d414;_0x213ae7=0xc8;}else{_0x213ae7=0xce;}_0x22bab8[_0x0c4c('0x27')](_0x213ae7);return _0x22bab8[_0x0c4c('0x2e')]('Content-Range',_0x344f08+'-'+_0x1840d7+'/'+_0x31d414)[_0x0c4c('0x29')](_0x46f8d9);}return null;};}function patchUpdates(_0x13ff49){return function(_0x414dbc){try{jsonpatch[_0x0c4c('0x2f')](_0x414dbc,_0x13ff49,!![]);}catch(_0x2aa573){return BPromise[_0x0c4c('0x30')](_0x2aa573);}return _0x414dbc['save']();};}function saveUpdates(_0x1b754c,_0x2b3edd){return function(_0x5db6f1){if(_0x5db6f1){return _0x5db6f1[_0x0c4c('0x31')](_0x1b754c)[_0x0c4c('0x1b')](function(_0x54d0dc){return _0x54d0dc;});}return null;};}function removeEntity(_0x297107,_0x54735f){return function(_0x2e9d46){if(_0x2e9d46){return _0x2e9d46['destroy']()['then'](function(){var _0x5859af=_0x2e9d46['get']({'plain':!![]});var _0x1a00d8=_0x0c4c('0x32');return db[_0x0c4c('0x33')][_0x0c4c('0x34')]({'where':{'type':_0x1a00d8,'resourceId':_0x5859af['id']}})[_0x0c4c('0x1b')](function(){return _0x2e9d46;});})[_0x0c4c('0x1b')](function(){_0x297107['status'](0xcc)[_0x0c4c('0x28')]();});}};}function handleEntityNotFound(_0x5a8986,_0x2c2610){return function(_0x5060f5){if(!_0x5060f5){_0x5a8986[_0x0c4c('0x26')](0x194);}return _0x5060f5;};}function handleError(_0x7b5a8a,_0xe9af61){_0xe9af61=_0xe9af61||0x1f4;return function(_0x207317){logger[_0x0c4c('0x21')](_0x207317[_0x0c4c('0x35')]);if(_0x207317[_0x0c4c('0x36')]){delete _0x207317[_0x0c4c('0x36')];}_0x7b5a8a['status'](_0xe9af61)[_0x0c4c('0x37')](_0x207317);};}exports['index']=function(_0x9dcc20,_0x32555c){var _0x45a9ca={'include':[{'model':db['Pause'],'as':_0x0c4c('0x38')}]},_0x16cc3b={},_0xf084e8={'count':0x0,'rows':[]};var _0x22b52c=_['map'](db[_0x0c4c('0x39')][_0x0c4c('0x3a')],function(_0xfccd23){return{'name':_0xfccd23[_0x0c4c('0x3b')],'type':_0xfccd23['type']['key']};});_0x16cc3b[_0x0c4c('0x3c')]=_[_0x0c4c('0x3d')](_0x22b52c,_0x0c4c('0x36'));_0x16cc3b[_0x0c4c('0x3e')]=_[_0x0c4c('0x3f')](_0x9dcc20[_0x0c4c('0x3e')]);_0x16cc3b[_0x0c4c('0x40')]=_[_0x0c4c('0x41')](_0x16cc3b['model'],_0x16cc3b[_0x0c4c('0x3e')]);_0x45a9ca[_0x0c4c('0x42')]=_[_0x0c4c('0x41')](_0x16cc3b[_0x0c4c('0x3c')],qs[_0x0c4c('0x43')](_0x9dcc20[_0x0c4c('0x3e')][_0x0c4c('0x43')]));_0x45a9ca[_0x0c4c('0x42')]=_0x45a9ca['attributes'][_0x0c4c('0x44')]?_0x45a9ca['attributes']:_0x16cc3b[_0x0c4c('0x3c')];if(!_0x9dcc20[_0x0c4c('0x3e')][_0x0c4c('0x45')](_0x0c4c('0x46'))){_0x45a9ca[_0x0c4c('0x2c')]=qs[_0x0c4c('0x2c')](_0x9dcc20[_0x0c4c('0x3e')][_0x0c4c('0x2c')]);_0x45a9ca[_0x0c4c('0x2a')]=qs[_0x0c4c('0x2a')](_0x9dcc20[_0x0c4c('0x3e')][_0x0c4c('0x2a')]);}_0x45a9ca[_0x0c4c('0x47')]=qs[_0x0c4c('0x48')](_0x9dcc20[_0x0c4c('0x3e')][_0x0c4c('0x48')]);_0x45a9ca[_0x0c4c('0x49')]=qs[_0x0c4c('0x40')](_[_0x0c4c('0x4a')](_0x9dcc20[_0x0c4c('0x3e')],_0x16cc3b[_0x0c4c('0x40')]),_0x22b52c);if(_0x9dcc20[_0x0c4c('0x3e')][_0x0c4c('0x4b')]){_0x45a9ca[_0x0c4c('0x49')]=_[_0x0c4c('0x4c')](_0x45a9ca[_0x0c4c('0x49')],{'$or':_[_0x0c4c('0x3d')](_0x22b52c,function(_0x1a0fe3){if(_0x1a0fe3['type']!==_0x0c4c('0x4d')){var _0x1dff4c={};_0x1dff4c[_0x1a0fe3[_0x0c4c('0x36')]]={'$like':'%'+_0x9dcc20[_0x0c4c('0x3e')][_0x0c4c('0x4b')]+'%'};return _0x1dff4c;}})});}_0x45a9ca=_[_0x0c4c('0x4c')]({},_0x45a9ca,_0x9dcc20[_0x0c4c('0x4e')]);var _0xcc54c5={'where':_0x45a9ca[_0x0c4c('0x49')]};return db[_0x0c4c('0x39')][_0x0c4c('0x2d')](_0xcc54c5)[_0x0c4c('0x1b')](function(_0x37bee1){_0xf084e8['count']=_0x37bee1;if(_0x9dcc20['query'][_0x0c4c('0x4f')]){_0x45a9ca[_0x0c4c('0x50')]=[{'all':!![]}];}return db['SmsAccount']['findAll'](_0x45a9ca);})[_0x0c4c('0x1b')](function(_0x5da051){_0xf084e8[_0x0c4c('0x51')]=_0x5da051;return _0xf084e8;})[_0x0c4c('0x1b')](respondWithFilteredResult(_0x32555c,_0x45a9ca))[_0x0c4c('0x52')](handleError(_0x32555c,null));};exports['show']=function(_0x9b485d,_0x1640ee){var _0x827797={'raw':![],'where':{'id':_0x9b485d[_0x0c4c('0x53')]['id']},'include':[{'model':db['Pause'],'as':_0x0c4c('0x38')}]},_0x47fc3a={};_0x47fc3a['model']=_[_0x0c4c('0x3f')](db[_0x0c4c('0x39')][_0x0c4c('0x3a')]);_0x47fc3a[_0x0c4c('0x3e')]=_[_0x0c4c('0x3f')](_0x9b485d[_0x0c4c('0x3e')]);_0x47fc3a[_0x0c4c('0x40')]=_[_0x0c4c('0x41')](_0x47fc3a[_0x0c4c('0x3c')],_0x47fc3a[_0x0c4c('0x3e')]);_0x827797['attributes']=_[_0x0c4c('0x41')](_0x47fc3a[_0x0c4c('0x3c')],qs[_0x0c4c('0x43')](_0x9b485d[_0x0c4c('0x3e')][_0x0c4c('0x43')]));_0x827797[_0x0c4c('0x42')]=_0x827797[_0x0c4c('0x42')][_0x0c4c('0x44')]?_0x827797[_0x0c4c('0x42')]:_0x47fc3a[_0x0c4c('0x3c')];if(_0x9b485d[_0x0c4c('0x3e')][_0x0c4c('0x4f')]){_0x827797[_0x0c4c('0x50')]=[{'all':!![]}];}_0x827797=_[_0x0c4c('0x4c')]({},_0x827797,_0x9b485d[_0x0c4c('0x4e')]);return db[_0x0c4c('0x39')]['find'](_0x827797)[_0x0c4c('0x1b')](handleEntityNotFound(_0x1640ee,null))[_0x0c4c('0x1b')](respondWithResult(_0x1640ee,null))[_0x0c4c('0x52')](handleError(_0x1640ee,null));};exports[_0x0c4c('0x54')]=function(_0x17a07e,_0x1287fa){return db[_0x0c4c('0x39')]['create'](_0x17a07e[_0x0c4c('0x55')],{})[_0x0c4c('0x1b')](function(_0x538291){var _0x5e8963=_0x17a07e[_0x0c4c('0x56')][_0x0c4c('0x57')]({'plain':!![]});if(!_0x5e8963)throw new Error(_0x0c4c('0x58'));if(_0x5e8963[_0x0c4c('0x59')]===_0x0c4c('0x56')){var _0x572fbe=_0x538291[_0x0c4c('0x57')]({'plain':!![]});var _0x4d8b48=_0x0c4c('0x32');return db[_0x0c4c('0x5a')][_0x0c4c('0x5b')]({'where':{'name':_0x4d8b48,'userProfileId':_0x5e8963['userProfileId']},'raw':!![]})[_0x0c4c('0x1b')](function(_0x1d0bac){if(_0x1d0bac&&_0x1d0bac['autoAssociation']===0x0){return db[_0x0c4c('0x33')][_0x0c4c('0x54')]({'name':_0x572fbe[_0x0c4c('0x36')],'resourceId':_0x572fbe['id'],'type':_0x1d0bac[_0x0c4c('0x36')],'sectionId':_0x1d0bac['id']},{})[_0x0c4c('0x1b')](function(){return _0x538291;});}else{return _0x538291;}})[_0x0c4c('0x52')](function(_0x30040e){logger[_0x0c4c('0x21')](_0x0c4c('0x5c'),_0x30040e);throw _0x30040e;});}return _0x538291;})['then'](respondWithResult(_0x1287fa,0xc9))[_0x0c4c('0x52')](handleError(_0x1287fa,null));};exports['update']=function(_0x747d70,_0xeece6d){if(_0x747d70[_0x0c4c('0x55')]['id']){delete _0x747d70[_0x0c4c('0x55')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x747d70['params']['id']},'include':[{'model':db[_0x0c4c('0x5d')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0xeece6d,null))[_0x0c4c('0x1b')](saveUpdates(_0x747d70['body'],null))[_0x0c4c('0x1b')](respondWithResult(_0xeece6d,null))[_0x0c4c('0x52')](handleError(_0xeece6d,null));};exports['destroy']=function(_0x380b04,_0x35d4a9){return db[_0x0c4c('0x39')]['find']({'where':{'id':_0x380b04[_0x0c4c('0x53')]['id']}})[_0x0c4c('0x1b')](handleEntityNotFound(_0x35d4a9,null))[_0x0c4c('0x1b')](removeEntity(_0x35d4a9,null))[_0x0c4c('0x52')](handleError(_0x35d4a9,null));};exports[_0x0c4c('0x5e')]=function(_0x439baa,_0x15494c){return db[_0x0c4c('0x39')][_0x0c4c('0x5e')]()[_0x0c4c('0x1b')](respondWithResult(_0x15494c,null))['catch'](handleError(_0x15494c,null));};exports[_0x0c4c('0x5f')]=function(_0x16e6ac,_0x13428d,_0x2a0668){if(_0x16e6ac[_0x0c4c('0x55')]['id']){delete _0x16e6ac[_0x0c4c('0x55')]['id'];}return db[_0x0c4c('0x39')]['find']({'where':{'id':_0x16e6ac[_0x0c4c('0x53')]['id']}})['then'](handleEntityNotFound(_0x13428d,null))['then'](function(_0x5d756e){if(_0x5d756e){_0x16e6ac['body'][_0x0c4c('0x60')]=_0x5d756e['id'];return db[_0x0c4c('0x61')]['create'](_0x16e6ac['body']);}})[_0x0c4c('0x1b')](respondWithResult(_0x13428d,null))[_0x0c4c('0x52')](handleError(_0x13428d,null));};exports[_0x0c4c('0x62')]=function(_0x2237bf,_0x38f90a,_0x18efde){var _0x416530={'raw':![],'where':{}};var _0x1a7622={};var _0x49e58e={'count':0x0,'rows':[]};return db[_0x0c4c('0x39')][_0x0c4c('0x63')]({'where':{'id':_0x2237bf[_0x0c4c('0x53')]['id']}})[_0x0c4c('0x1b')](handleEntityNotFound(_0x38f90a,null))['then'](function(_0x2768ee){if(_0x2768ee){_0x1a7622[_0x0c4c('0x3c')]=_[_0x0c4c('0x3f')](db[_0x0c4c('0x61')][_0x0c4c('0x3a')]);_0x1a7622[_0x0c4c('0x3e')]=_[_0x0c4c('0x3f')](_0x2237bf['query']);_0x1a7622[_0x0c4c('0x40')]=_[_0x0c4c('0x41')](_0x1a7622[_0x0c4c('0x3c')],_0x1a7622['query']);_0x416530['attributes']=_[_0x0c4c('0x41')](_0x1a7622[_0x0c4c('0x3c')],qs[_0x0c4c('0x43')](_0x2237bf[_0x0c4c('0x3e')][_0x0c4c('0x43')]));_0x416530['attributes']=_0x416530['attributes'][_0x0c4c('0x44')]?_0x416530['attributes']:_0x1a7622[_0x0c4c('0x3c')];if(!_0x2237bf[_0x0c4c('0x3e')]['hasOwnProperty'](_0x0c4c('0x46'))){_0x416530[_0x0c4c('0x2c')]=qs[_0x0c4c('0x2c')](_0x2237bf[_0x0c4c('0x3e')][_0x0c4c('0x2c')]);_0x416530['offset']=qs[_0x0c4c('0x2a')](_0x2237bf['query'][_0x0c4c('0x2a')]);}_0x416530[_0x0c4c('0x47')]=qs[_0x0c4c('0x48')](_0x2237bf[_0x0c4c('0x3e')][_0x0c4c('0x48')]);_0x416530[_0x0c4c('0x49')]=qs[_0x0c4c('0x40')](_[_0x0c4c('0x4a')](_0x2237bf[_0x0c4c('0x3e')],_0x1a7622[_0x0c4c('0x40')]));_0x416530['where'][_0x0c4c('0x60')]=_0x2768ee['id'];if(_0x2237bf[_0x0c4c('0x3e')][_0x0c4c('0x4b')]){_0x416530[_0x0c4c('0x49')]=_[_0x0c4c('0x4c')](_0x416530['where'],{'$or':_[_0x0c4c('0x3d')](_0x416530[_0x0c4c('0x42')],function(_0x5f5173){var _0x4d1298={};_0x4d1298[_0x5f5173]={'$like':'%'+_0x2237bf['query'][_0x0c4c('0x4b')]+'%'};return _0x4d1298;})});}_0x416530=_['merge']({},_0x416530,_0x2237bf[_0x0c4c('0x4e')]);return db[_0x0c4c('0x61')]['count']({'where':_0x416530[_0x0c4c('0x49')]})[_0x0c4c('0x1b')](function(_0x26d183){_0x49e58e['count']=_0x26d183;if(_0x2237bf['query'][_0x0c4c('0x4f')]){_0x416530[_0x0c4c('0x50')]=[{'all':!![]}];}return db['Disposition'][_0x0c4c('0x64')](_0x416530);})[_0x0c4c('0x1b')](function(_0x5819e4){_0x49e58e[_0x0c4c('0x51')]=_0x5819e4;return _0x49e58e;});}})[_0x0c4c('0x1b')](respondWithFilteredResult(_0x38f90a,_0x416530))[_0x0c4c('0x52')](handleError(_0x38f90a,null));};exports['removeDispositions']=function(_0x33abc3,_0x45a3be,_0xfd3079){return db['SmsAccount'][_0x0c4c('0x5b')]({'where':{'id':_0x33abc3[_0x0c4c('0x53')]['id']}})[_0x0c4c('0x1b')](handleEntityNotFound(_0x45a3be,null))['then'](function(_0x26c505){if(_0x26c505){return _0x26c505['removeDispositions'](_0x33abc3[_0x0c4c('0x3e')][_0x0c4c('0x65')]);}})['then'](respondWithStatusCode(_0x45a3be,null))[_0x0c4c('0x52')](handleError(_0x45a3be,null));};exports['addAnswer']=function(_0x5e5c5d,_0x372bb2,_0x5226d0){if(_0x5e5c5d[_0x0c4c('0x55')]['id']){delete _0x5e5c5d[_0x0c4c('0x55')]['id'];}return db['SmsAccount'][_0x0c4c('0x5b')]({'where':{'id':_0x5e5c5d[_0x0c4c('0x53')]['id']}})[_0x0c4c('0x1b')](handleEntityNotFound(_0x372bb2,null))[_0x0c4c('0x1b')](function(_0xf20227){if(_0xf20227){_0x5e5c5d[_0x0c4c('0x55')][_0x0c4c('0x60')]=_0xf20227['id'];return db[_0x0c4c('0x66')][_0x0c4c('0x54')](_0x5e5c5d[_0x0c4c('0x55')]);}})['then'](respondWithResult(_0x372bb2,null))[_0x0c4c('0x52')](handleError(_0x372bb2,null));};exports['getAnswers']=function(_0x401eb5,_0x419cf1,_0x56d5eb){var _0x29665c={'raw':![],'where':{}};var _0x11a6a8={};var _0x57f730={'count':0x0,'rows':[]};return db[_0x0c4c('0x39')][_0x0c4c('0x63')]({'where':{'id':_0x401eb5[_0x0c4c('0x53')]['id']}})['then'](handleEntityNotFound(_0x419cf1,null))[_0x0c4c('0x1b')](function(_0x319ad5){if(_0x319ad5){_0x11a6a8[_0x0c4c('0x3c')]=_[_0x0c4c('0x3f')](db['CannedAnswer'][_0x0c4c('0x3a')]);_0x11a6a8[_0x0c4c('0x3e')]=_[_0x0c4c('0x3f')](_0x401eb5[_0x0c4c('0x3e')]);_0x11a6a8[_0x0c4c('0x40')]=_[_0x0c4c('0x41')](_0x11a6a8[_0x0c4c('0x3c')],_0x11a6a8[_0x0c4c('0x3e')]);_0x29665c[_0x0c4c('0x42')]=_['intersection'](_0x11a6a8[_0x0c4c('0x3c')],qs[_0x0c4c('0x43')](_0x401eb5['query'][_0x0c4c('0x43')]));_0x29665c[_0x0c4c('0x42')]=_0x29665c[_0x0c4c('0x42')][_0x0c4c('0x44')]?_0x29665c[_0x0c4c('0x42')]:_0x11a6a8[_0x0c4c('0x3c')];if(!_0x401eb5[_0x0c4c('0x3e')][_0x0c4c('0x45')]('nolimit')){_0x29665c['limit']=qs[_0x0c4c('0x2c')](_0x401eb5['query'][_0x0c4c('0x2c')]);_0x29665c['offset']=qs[_0x0c4c('0x2a')](_0x401eb5[_0x0c4c('0x3e')][_0x0c4c('0x2a')]);}_0x29665c[_0x0c4c('0x47')]=qs['sort'](_0x401eb5['query']['sort']);_0x29665c['where']=qs[_0x0c4c('0x40')](_[_0x0c4c('0x4a')](_0x401eb5[_0x0c4c('0x3e')],_0x11a6a8['filters']));_0x29665c[_0x0c4c('0x49')]['SmsAccountId']=_0x319ad5['id'];if(_0x401eb5[_0x0c4c('0x3e')][_0x0c4c('0x4b')]){_0x29665c[_0x0c4c('0x49')]=_['merge'](_0x29665c[_0x0c4c('0x49')],{'$or':_['map'](_0x29665c['attributes'],function(_0x414bf0){var _0x5b0a13={};_0x5b0a13[_0x414bf0]={'$like':'%'+_0x401eb5[_0x0c4c('0x3e')][_0x0c4c('0x4b')]+'%'};return _0x5b0a13;})});}_0x29665c=_[_0x0c4c('0x4c')]({},_0x29665c,_0x401eb5[_0x0c4c('0x4e')]);return db[_0x0c4c('0x66')][_0x0c4c('0x2d')]({'where':_0x29665c[_0x0c4c('0x49')]})['then'](function(_0x14212c){_0x57f730[_0x0c4c('0x2d')]=_0x14212c;if(_0x401eb5[_0x0c4c('0x3e')][_0x0c4c('0x4f')]){_0x29665c['include']=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x29665c);})[_0x0c4c('0x1b')](function(_0x3cf341){_0x57f730[_0x0c4c('0x51')]=_0x3cf341;return _0x57f730;});}})[_0x0c4c('0x1b')](respondWithFilteredResult(_0x419cf1,_0x29665c))[_0x0c4c('0x52')](handleError(_0x419cf1,null));};exports[_0x0c4c('0x67')]=function(_0x57e80c,_0x44ec1f,_0xa7ced2){return db[_0x0c4c('0x39')][_0x0c4c('0x5b')]({'where':{'id':_0x57e80c[_0x0c4c('0x53')]['id']}})[_0x0c4c('0x1b')](handleEntityNotFound(_0x44ec1f,null))['then'](function(_0x4d3dc1){if(_0x4d3dc1){return _0x4d3dc1[_0x0c4c('0x67')](_0x57e80c['query'][_0x0c4c('0x65')]);}})['then'](respondWithStatusCode(_0x44ec1f,null))[_0x0c4c('0x52')](handleError(_0x44ec1f,null));};exports[_0x0c4c('0x68')]=function(_0x28152d,_0x1bc6e9,_0x514814){var _0x185e67={'channel':_0x0c4c('0x69')};var _0xcd652f=[];var _0x168623=[];var _0x157bca={};return db['SmsAccount'][_0x0c4c('0x5b')]({'where':{'id':_0x28152d[_0x0c4c('0x53')]['id']},'include':[{'model':db[_0x0c4c('0x6a')],'as':'Applications'}]})[_0x0c4c('0x1b')](handleEntityNotFound(_0x1bc6e9,null))[_0x0c4c('0x1b')](function(_0x4613a1){_0x185e67[_0x0c4c('0x6b')]=_0x4613a1;_0x185e67[_0x0c4c('0x6c')]=_[_0x0c4c('0x6d')](_0x4613a1['Applications'],['priority'],[_0x0c4c('0x6e')]);if(_0x185e67['account']['Applications']){delete _0x185e67[_0x0c4c('0x6b')][_0x0c4c('0x6f')];}return db[_0x0c4c('0x70')][_0x0c4c('0x5e')]();})[_0x0c4c('0x1b')](function(_0x11b4ca){if(!_0x11b4ca){throw new db[(_0x0c4c('0x71'))]['ValidationError'](_0x0c4c('0x72'));}_0xcd652f=_[_0x0c4c('0x73')](_[_0x0c4c('0x3f')](_0x11b4ca),[_0x0c4c('0x74'),_0x0c4c('0x75')]);_0x168623=_['difference'](_['keys'](_0x11b4ca),[_0x0c4c('0x74'),_0x0c4c('0x75'),_0x0c4c('0x76'),_0x0c4c('0x77')]);_0x185e67['body']={'mapKey':_0x0c4c('0x78')};if(_0x185e67[_0x0c4c('0x6b')][_0x0c4c('0x79')]){switch(_0x185e67[_0x0c4c('0x6b')][_0x0c4c('0x79')]){case _0x0c4c('0x7a'):_0x185e67[_0x0c4c('0x55')][_0x0c4c('0x7b')]=_0x28152d[_0x0c4c('0x55')]['From'];_0x185e67[_0x0c4c('0x55')][_0x0c4c('0x55')]=_0x28152d[_0x0c4c('0x55')][_0x0c4c('0x7c')];_0x185e67['body']['messageId']=_0x28152d[_0x0c4c('0x55')]['MessageSid'];break;case _0x0c4c('0x7d'):_0x185e67['body']['from']='+'+_0x28152d[_0x0c4c('0x55')][_0x0c4c('0x7e')];_0x185e67['body'][_0x0c4c('0x55')]=_0x28152d[_0x0c4c('0x55')][_0x0c4c('0x7f')];break;case _0x0c4c('0x80'):_0x185e67[_0x0c4c('0x55')][_0x0c4c('0x7b')]=_0x28152d[_0x0c4c('0x55')][_0x0c4c('0x7b')];_0x185e67['body'][_0x0c4c('0x55')]=_0x28152d[_0x0c4c('0x55')]['message'];break;case _0x0c4c('0x81'):_0x185e67[_0x0c4c('0x55')][_0x0c4c('0x7b')]=_0x28152d['body'][_0x0c4c('0x7b')];_0x185e67[_0x0c4c('0x55')][_0x0c4c('0x55')]=_0x28152d[_0x0c4c('0x55')]['body'];_0x185e67['body'][_0x0c4c('0x82')]=_0x28152d[_0x0c4c('0x55')]['message_id'];break;case'plivo':_0x185e67[_0x0c4c('0x55')][_0x0c4c('0x7b')]=_0x28152d[_0x0c4c('0x55')][_0x0c4c('0x83')];_0x185e67[_0x0c4c('0x55')][_0x0c4c('0x55')]=_0x28152d[_0x0c4c('0x55')][_0x0c4c('0x84')];_0x185e67[_0x0c4c('0x55')][_0x0c4c('0x82')]=_0x28152d['body'][_0x0c4c('0x85')];break;case _0x0c4c('0x86'):_0x185e67[_0x0c4c('0x55')][_0x0c4c('0x7b')]='+'+_0x28152d[_0x0c4c('0x55')]['results'][0x0][_0x0c4c('0x7b')];_0x185e67[_0x0c4c('0x55')][_0x0c4c('0x55')]=_0x28152d[_0x0c4c('0x55')][_0x0c4c('0x87')][0x0][_0x0c4c('0x7f')];_0x185e67[_0x0c4c('0x55')][_0x0c4c('0x82')]=_0x28152d['body'][_0x0c4c('0x87')][0x0][_0x0c4c('0x82')];break;case _0x0c4c('0x88'):_0x185e67[_0x0c4c('0x55')][_0x0c4c('0x7b')]=_0x28152d['body'][_0x0c4c('0x89')];_0x185e67['body'][_0x0c4c('0x55')]=_0x28152d[_0x0c4c('0x55')][_0x0c4c('0x8a')][_0x0c4c('0x24')];break;case _0x0c4c('0x8b'):_0x185e67[_0x0c4c('0x55')][_0x0c4c('0x7b')]=_0x28152d[_0x0c4c('0x55')][_0x0c4c('0x8c')];_0x185e67[_0x0c4c('0x55')][_0x0c4c('0x55')]=_0x28152d[_0x0c4c('0x55')][_0x0c4c('0x7f')];_0x185e67[_0x0c4c('0x55')]['messageId']=_0x28152d[_0x0c4c('0x55')][_0x0c4c('0x8d')];break;case _0x0c4c('0x8e'):_0x185e67[_0x0c4c('0x55')][_0x0c4c('0x82')]=_0x28152d['body'][0x0][_0x0c4c('0x24')]['id'];_0x185e67[_0x0c4c('0x55')][_0x0c4c('0x7b')]=_0x28152d[_0x0c4c('0x55')][0x0][_0x0c4c('0x24')][_0x0c4c('0x7b')];_0x185e67['body'][_0x0c4c('0x55')]=_0x28152d['body'][0x0]['message'][_0x0c4c('0x7f')];break;case _0x0c4c('0x8f'):_0x185e67[_0x0c4c('0x55')][_0x0c4c('0x7b')]=_0x28152d[_0x0c4c('0x55')]['from'];_0x185e67[_0x0c4c('0x55')][_0x0c4c('0x55')]=_0x28152d['body'][_0x0c4c('0x24')];_0x185e67['body'][_0x0c4c('0x82')]=_0x28152d[_0x0c4c('0x55')][_0x0c4c('0x90')];break;}}if(_0x185e67[_0x0c4c('0x55')]['id']){delete _0x185e67[_0x0c4c('0x55')]['id'];}if(_[_0x0c4c('0x91')](_0x185e67[_0x0c4c('0x55')][_0x0c4c('0x7b')])){throw new db[(_0x0c4c('0x71'))][(_0x0c4c('0x92'))](_0x0c4c('0x93'));}if(_[_0x0c4c('0x91')](_0x185e67['body'][_0x0c4c('0x55')])||_0x185e67[_0x0c4c('0x55')][_0x0c4c('0x55')]===''){throw new db[(_0x0c4c('0x71'))][(_0x0c4c('0x92'))](_0x0c4c('0x94'));}if(_[_0x0c4c('0x91')](_0x185e67['body']['mapKey'])){throw new db['Sequelize']['ValidationError'](_0x0c4c('0x95')+_0x168623);}if(!_[_0x0c4c('0x96')](_0x168623,_0x185e67['body'][_0x0c4c('0x97')])){throw new db[(_0x0c4c('0x71'))][(_0x0c4c('0x92'))](_0x0c4c('0x98')+_0x168623);}_0x157bca[_0x185e67[_0x0c4c('0x55')][_0x0c4c('0x97')]]=_0x185e67[_0x0c4c('0x55')][_0x0c4c('0x7b')];return db[_0x0c4c('0x99')][_0x0c4c('0x5b')]({'where':{'id':_0x185e67[_0x0c4c('0x6b')][_0x0c4c('0x77')]},'include':[{'model':db[_0x0c4c('0x70')],'as':_0x0c4c('0x9a'),'where':_0x157bca,'limit':0x1,'order':[[_0x0c4c('0x75'),_0x0c4c('0x9b')]]}]});})[_0x0c4c('0x1b')](handleEntityNotFound(_0x1bc6e9,null))[_0x0c4c('0x1b')](function(_0xaa6b94){if(_0xaa6b94){_0x185e67['list']=_[_0x0c4c('0x9c')](_0xaa6b94,[_0x0c4c('0x9a')]);if(_0xaa6b94[_0x0c4c('0x9a')][_0x0c4c('0x44')]){return _0xaa6b94['Contacts'][0x0];}var _0x59efd5=_['defaults'](_0x185e67[_0x0c4c('0x55')],{'firstName':_0x185e67[_0x0c4c('0x55')][_0x0c4c('0x7b')],'ListId':_0xaa6b94['id']});_0x59efd5[_0x185e67[_0x0c4c('0x55')][_0x0c4c('0x97')]]=_0x185e67[_0x0c4c('0x55')][_0x0c4c('0x7b')];return db[_0x0c4c('0x70')][_0x0c4c('0x54')](_0x59efd5,{'fields':_0xcd652f,'raw':!![]});}})['then'](handleEntityNotFound(_0x1bc6e9,null))[_0x0c4c('0x1b')](function(_0x65eb2a){if(_0x65eb2a){_0x185e67[_0x0c4c('0x9d')]=_0x65eb2a;var _0x2609f0={'ContactId':_0x65eb2a['id'],'phone':_0x185e67[_0x0c4c('0x55')]['from'],'SmsAccountId':_0x28152d[_0x0c4c('0x53')]['id']};var _0x377725={'ContactId':_0x65eb2a['id'],'SmsAccountId':_0x28152d[_0x0c4c('0x53')]['id'],'closed':![]};return db[_0x0c4c('0x9e')][_0x0c4c('0x5b')]({'where':_0x377725})[_0x0c4c('0x1b')](function(_0x57f5b7){if(_0x57f5b7){return[_0x57f5b7,![]];}return db[_0x0c4c('0x9e')]['create'](_0x2609f0)['then'](function(_0x14fe51){return[_0x14fe51,!![]];});});}})['spread'](function(_0x136009,_0x5e52bb){_0x185e67[_0x0c4c('0x9f')]=_0x136009[_0x0c4c('0x57')]({'plain':!![]});_0x185e67[_0x0c4c('0x9f')][_0x0c4c('0xa0')]=![];if(_0x5e52bb){if(_0x185e67[_0x0c4c('0x6b')][_0x0c4c('0xa1')]){_0x185e67['applications'][_0x0c4c('0xa2')]({'id':0x0,'priority':_0x185e67['applications']['length']+0x1,'app':_0x0c4c('0xa3'),'appdata':_0x0c4c('0xa4'),'interval':'*,*,*,*'});}_0x185e67['interaction'][_0x0c4c('0xa0')]=!![];}return db[_0x0c4c('0xa5')][_0x0c4c('0x54')]({'phone':_0x185e67['body'][_0x0c4c('0x7b')],'messageId':_0x185e67[_0x0c4c('0x55')][_0x0c4c('0x82')],'body':_0x185e67[_0x0c4c('0x55')][_0x0c4c('0x55')],'SmsAccountId':_0x28152d['params']['id'],'SmsInteractionId':_0x136009['id'],'direction':'in','ContactId':_0x136009[_0x0c4c('0xa6')],'AttachmentId':_0x185e67[_0x0c4c('0x55')][_0x0c4c('0xa7')]});})[_0x0c4c('0x1b')](function(_0x4afdfb){_0x185e67[_0x0c4c('0x24')]=_0x4afdfb;if(_0x185e67[_0x0c4c('0x9f')][_0x0c4c('0xa8')]){return db[_0x0c4c('0xa9')][_0x0c4c('0x5b')]({'attributes':['id',_0x0c4c('0x36')],'where':{'id':_0x185e67[_0x0c4c('0x9f')]['UserId']}})[_0x0c4c('0x1b')](function(_0x1a4083){if(_0x1a4083){_0x185e67['applications'][_0x0c4c('0xaa')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1a4083['name']+','+(_0x185e67['account']['waitForTheAssignedAgent']||0xa),'interval':_0x0c4c('0xab')});}return respondWithRpcPromise(_0x0c4c('0xac'),_0x0c4c('0xad'),_0x185e67);});}return respondWithRpcPromise(_0x0c4c('0xac'),_0x0c4c('0xad'),_0x185e67);})[_0x0c4c('0x1b')](function(_0x591917){if(_0x591917){var _0x3ff170=0xc8;var _0x4b6d6b=_0x0c4c('0xae');logger[_0x0c4c('0x1c')](_0x0c4c('0x1f'),_0x4b6d6b,_0x3ff170,_0x0c4c('0xaf'));logger['debug'](_0x0c4c('0xb0'),_0x4b6d6b,_0x3ff170,_0x0c4c('0xaf'),JSON[_0x0c4c('0x20')](_0x591917));if(_0x185e67[_0x0c4c('0x6b')][_0x0c4c('0x79')]==='twilio'){return _0x1bc6e9['status'](_0x3ff170)[_0x0c4c('0x2e')](_0x0c4c('0xb1'),_0x0c4c('0xb2'))[_0x0c4c('0x37')](_0x0c4c('0xb3'));}else{return _0x1bc6e9[_0x0c4c('0x27')](_0x3ff170)[_0x0c4c('0x29')](_0x591917);}}})[_0x0c4c('0x52')](handleError(_0x1bc6e9,null));};exports[_0x0c4c('0xb4')]=function(_0x589561,_0x45f1d0,_0x4b34ea){return db[_0x0c4c('0x39')][_0x0c4c('0x63')]({'where':{'id':_0x589561[_0x0c4c('0x53')]['id']}})[_0x0c4c('0x1b')](handleEntityNotFound(_0x45f1d0,null))[_0x0c4c('0x1b')](function(_0xf5c744){if(_0xf5c744){return db[_0x0c4c('0xb5')]['transaction'](function(_0x2c455e){return db[_0x0c4c('0x6a')]['destroy']({'where':{'SmsAccountId':_0x589561[_0x0c4c('0x53')]['id']},'transaction':_0x2c455e})[_0x0c4c('0x1b')](function(_0x57db85){var _0x5bd420=_['map'](_0x589561['body'],function(_0x2443d1){_0x2443d1[_0x0c4c('0x60')]=_0x589561[_0x0c4c('0x53')]['id'];return _0x2443d1;});return db[_0x0c4c('0x6a')][_0x0c4c('0xb6')](_0x5bd420,{'transaction':_0x2c455e});});})[_0x0c4c('0x1b')](function(){return db[_0x0c4c('0x6a')][_0x0c4c('0xb7')]({'where':{'SmsAccountId':_0x589561[_0x0c4c('0x53')]['id']},'order':_0x0c4c('0xb8')});});}})['then'](respondWithResult(_0x45f1d0,null))[_0x0c4c('0x52')](handleError(_0x45f1d0,null));};exports[_0x0c4c('0xb9')]=function(_0x7d3285,_0x573357,_0x216e3e){var _0x8ccf5b={};var _0x2f3526={};var _0x1c019e;var _0x1a98e1;return db[_0x0c4c('0x39')]['findOne']({'where':{'id':_0x7d3285[_0x0c4c('0x53')]['id']}})[_0x0c4c('0x1b')](handleEntityNotFound(_0x573357,null))[_0x0c4c('0x1b')](function(_0x2f1a86){if(_0x2f1a86){_0x1c019e=_0x2f1a86;_0x2f3526['model']=_['keys'](db[_0x0c4c('0x6a')][_0x0c4c('0x3a')]);_0x2f3526[_0x0c4c('0x3e')]=_['keys'](_0x7d3285[_0x0c4c('0x3e')]);_0x2f3526['filters']=_[_0x0c4c('0x41')](_0x2f3526[_0x0c4c('0x3c')],_0x2f3526[_0x0c4c('0x3e')]);_0x8ccf5b[_0x0c4c('0x42')]=_[_0x0c4c('0x41')](_0x2f3526[_0x0c4c('0x3c')],qs[_0x0c4c('0x43')](_0x7d3285['query'][_0x0c4c('0x43')]));_0x8ccf5b[_0x0c4c('0x42')]=_0x8ccf5b[_0x0c4c('0x42')][_0x0c4c('0x44')]?_0x8ccf5b['attributes']:_0x2f3526['model'];_0x8ccf5b[_0x0c4c('0x47')]=qs[_0x0c4c('0x48')](_0x7d3285[_0x0c4c('0x3e')][_0x0c4c('0x48')]);_0x8ccf5b[_0x0c4c('0x49')]=qs[_0x0c4c('0x40')](_[_0x0c4c('0x4a')](_0x7d3285[_0x0c4c('0x3e')],_0x2f3526[_0x0c4c('0x40')]));if(_0x7d3285[_0x0c4c('0x3e')][_0x0c4c('0x4b')]){_0x8ccf5b['where']=_[_0x0c4c('0x4c')](_0x8ccf5b[_0x0c4c('0x49')],{'$or':_[_0x0c4c('0x3d')](_0x8ccf5b[_0x0c4c('0x42')],function(_0x34d85f){var _0x5aca05={};_0x5aca05[_0x34d85f]={'$like':'%'+_0x7d3285[_0x0c4c('0x3e')][_0x0c4c('0x4b')]+'%'};return _0x5aca05;})});}_0x8ccf5b=_[_0x0c4c('0x4c')]({},_0x8ccf5b,_0x7d3285[_0x0c4c('0x4e')]);return _0x1c019e[_0x0c4c('0xb9')](_0x8ccf5b);}})[_0x0c4c('0x1b')](function(_0x224a3f){if(_0x224a3f){_0x1a98e1=_0x224a3f['length'];if(!_0x7d3285[_0x0c4c('0x3e')][_0x0c4c('0x45')]('nolimit')){_0x8ccf5b[_0x0c4c('0x2c')]=qs['limit'](_0x7d3285['query'][_0x0c4c('0x2c')]);_0x8ccf5b[_0x0c4c('0x2a')]=qs[_0x0c4c('0x2a')](_0x7d3285['query'][_0x0c4c('0x2a')]);}return _0x1c019e[_0x0c4c('0xb9')](_0x8ccf5b);}})[_0x0c4c('0x1b')](function(_0x499c31){if(_0x499c31){return _0x499c31?{'count':_0x1a98e1,'rows':_0x499c31}:null;}})[_0x0c4c('0x1b')](respondWithResult(_0x573357,null))['catch'](handleError(_0x573357,null));};exports[_0x0c4c('0xba')]=function(_0x264bf2,_0x355044,_0x20b9a2){var _0x18d72a={'raw':![],'where':{}};var _0x57e319={};var _0x35d6d2={'count':0x0,'rows':[]};return db[_0x0c4c('0x39')]['findOne']({'where':{'id':_0x264bf2[_0x0c4c('0x53')]['id']}})[_0x0c4c('0x1b')](handleEntityNotFound(_0x355044,null))[_0x0c4c('0x1b')](function(_0x1b1268){if(_0x1b1268){_0x57e319[_0x0c4c('0x3c')]=_[_0x0c4c('0x3f')](db[_0x0c4c('0x9e')][_0x0c4c('0x3a')]);_0x57e319[_0x0c4c('0x3e')]=_[_0x0c4c('0x3f')](_0x264bf2[_0x0c4c('0x3e')]);_0x57e319[_0x0c4c('0x40')]=_[_0x0c4c('0x41')](_0x57e319[_0x0c4c('0x3c')],_0x57e319['query']);_0x18d72a[_0x0c4c('0x42')]=_[_0x0c4c('0x41')](_0x57e319[_0x0c4c('0x3c')],qs[_0x0c4c('0x43')](_0x264bf2[_0x0c4c('0x3e')][_0x0c4c('0x43')]));_0x18d72a[_0x0c4c('0x42')]=_0x18d72a[_0x0c4c('0x42')][_0x0c4c('0x44')]?_0x18d72a[_0x0c4c('0x42')]:_0x57e319[_0x0c4c('0x3c')];if(!_0x264bf2[_0x0c4c('0x3e')]['hasOwnProperty']('nolimit')){_0x18d72a[_0x0c4c('0x2c')]=qs[_0x0c4c('0x2c')](_0x264bf2[_0x0c4c('0x3e')][_0x0c4c('0x2c')]);_0x18d72a[_0x0c4c('0x2a')]=qs[_0x0c4c('0x2a')](_0x264bf2[_0x0c4c('0x3e')]['offset']);}_0x18d72a[_0x0c4c('0x47')]=qs[_0x0c4c('0x48')](_0x264bf2[_0x0c4c('0x3e')][_0x0c4c('0x48')]);_0x18d72a[_0x0c4c('0x49')]=qs['filters'](_[_0x0c4c('0x4a')](_0x264bf2[_0x0c4c('0x3e')],_0x57e319['filters']));_0x18d72a[_0x0c4c('0x49')][_0x0c4c('0x60')]=_0x1b1268['id'];if(_0x264bf2[_0x0c4c('0x3e')][_0x0c4c('0x4b')]){_0x18d72a[_0x0c4c('0x49')]=_['merge'](_0x18d72a[_0x0c4c('0x49')],{'$or':_['map'](_0x18d72a['attributes'],function(_0x19318c){var _0x20b384={};_0x20b384[_0x19318c]={'$like':'%'+_0x264bf2['query'][_0x0c4c('0x4b')]+'%'};return _0x20b384;})});}_0x18d72a=_['merge']({},_0x18d72a,_0x264bf2['options']);return db[_0x0c4c('0x9e')]['count']({'where':_0x18d72a['where']})['then'](function(_0x54119f){_0x35d6d2[_0x0c4c('0x2d')]=_0x54119f;if(_0x264bf2[_0x0c4c('0x3e')]['includeAll']){_0x18d72a['include']=[{'model':db[_0x0c4c('0x70')],'as':_0x0c4c('0xbb'),'required':![]},{'model':db[_0x0c4c('0xa9')],'as':_0x0c4c('0xbc'),'attributes':[_0x0c4c('0x36'),_0x0c4c('0xbd'),_0x0c4c('0xbe')],'required':![]},{'model':db[_0x0c4c('0xbf')],'as':_0x0c4c('0xc0'),'attributes':['id',_0x0c4c('0x36'),_0x0c4c('0xc1')],'where':_0x264bf2['query'][_0x0c4c('0xc2')]?{'id':_0x264bf2[_0x0c4c('0x3e')][_0x0c4c('0xc2')]}:undefined,'required':_0x264bf2[_0x0c4c('0x3e')][_0x0c4c('0xc2')]?!![]:![]}];}return db[_0x0c4c('0x9e')][_0x0c4c('0x64')](_0x18d72a);})['then'](function(_0xce8f1c){_0x35d6d2[_0x0c4c('0x51')]=_0xce8f1c;return _0x35d6d2;});}})[_0x0c4c('0x1b')](respondWithFilteredResult(_0x355044,_0x18d72a))[_0x0c4c('0x52')](handleError(_0x355044,null));};exports[_0x0c4c('0x37')]=function(_0x3f21e9,_0x662999,_0x337ec7){var _0x2ff35e,_0x240b5e,_0x4f57bf;if(_[_0x0c4c('0x91')](_0x3f21e9[_0x0c4c('0x55')]['body'])||_0x3f21e9[_0x0c4c('0x55')][_0x0c4c('0x55')]===''){throw new db[(_0x0c4c('0x71'))][(_0x0c4c('0x92'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x0c4c('0x91')](_0x3f21e9['body']['to'])){throw new db[(_0x0c4c('0x71'))]['ValidationError'](_0x0c4c('0xc3'));}_0x2ff35e=_0x3f21e9['body']['to'];return db[_0x0c4c('0x39')][_0x0c4c('0x5b')]({'where':{'id':_0x3f21e9['params']['id']},'include':[{'model':db[_0x0c4c('0x99')],'as':'List','include':[{'model':db[_0x0c4c('0x70')],'as':_0x0c4c('0x9a'),'where':{'mobile':_0x2ff35e},'limit':0x1,'order':[['updatedAt',_0x0c4c('0x9b')]]}]}]})[_0x0c4c('0x1b')](handleEntityNotFound(_0x662999,null))[_0x0c4c('0x1b')](function(_0x4b5eb4){if(_0x4b5eb4&&_0x4b5eb4[_0x0c4c('0xc4')]){_0x240b5e=_0x4b5eb4[_0x0c4c('0x57')]({'plain':!![]});if(_0x240b5e[_0x0c4c('0xc4')]&&_0x240b5e[_0x0c4c('0xc4')]['Contacts'][_0x0c4c('0x44')]){return _0x240b5e[_0x0c4c('0xc4')][_0x0c4c('0x9a')][0x0];}return db[_0x0c4c('0x70')]['create'](_[_0x0c4c('0x17')](_0x3f21e9[_0x0c4c('0x55')],{'firstName':_0x2ff35e,'mobile':_0x2ff35e,'phone':_0x2ff35e,'ListId':_0x240b5e['ListId']}));}})[_0x0c4c('0x1b')](handleEntityNotFound(_0x662999,null))['then'](function(_0xfd370e){if(_0xfd370e){_0x4f57bf=_0xfd370e;return db[_0x0c4c('0x9e')]['find']({'where':{'ContactId':_0x4f57bf['id'],'closed':![],'SmsAccountId':_0x240b5e['id']}})['then'](function(_0x19310c){if(_0x19310c){return[_0x19310c,![]];}return db[_0x0c4c('0x9e')]['create']({'UserId':_0x3f21e9[_0x0c4c('0x56')]['id'],'ContactId':_0x4f57bf['id'],'SmsAccountId':_0x240b5e['id'],'phone':_0x2ff35e,'firstMsgDirection':'out','Messages':[_['merge'](_0x3f21e9['body'],{'read':![],'body':_0x3f21e9[_0x0c4c('0x55')][_0x0c4c('0x55')],'phone':_0x2ff35e,'SmsAccountId':_0x240b5e['id'],'UserId':_0x3f21e9[_0x0c4c('0x56')]['id'],'ContactId':_0x4f57bf['id']})]},{'include':[{'model':db[_0x0c4c('0xa5')],'as':_0x0c4c('0xc5')}]})['then'](function(_0xfd817e){return[_0xfd817e,!![]];});});}})[_0x0c4c('0xc6')](function(_0x453e40,_0x5412f9){if(_0x5412f9){return _0x453e40;}return db[_0x0c4c('0xa5')][_0x0c4c('0x54')](_['merge'](_0x3f21e9[_0x0c4c('0x55')],{'read':![],'body':_0x3f21e9['body'][_0x0c4c('0x55')],'phone':_0x2ff35e,'SmsAccountId':_0x240b5e['id'],'SmsInteractionId':_0x453e40['id'],'UserId':_0x3f21e9['user']['id'],'ContactId':_0x4f57bf['id']}))[_0x0c4c('0x1b')](function(_0x22190e){_0x453e40['dataValues'][_0x0c4c('0xc5')]=[];_0x453e40[_0x0c4c('0xc7')][_0x0c4c('0xc5')][_0x0c4c('0xa2')](_0x22190e[_0x0c4c('0xc7')]);return _0x453e40;});})['then'](respondWithResult(_0x662999,null))[_0x0c4c('0x52')](handleError(_0x662999,null));};exports[_0x0c4c('0x27')]=function(_0x367aa6,_0x3c145e,_0x2ce816){if(_0x367aa6[_0x0c4c('0x55')]['id']){delete _0x367aa6[_0x0c4c('0x55')]['id'];}var _0x200311,_0x61da59,_0x3bc981;return db[_0x0c4c('0x39')][_0x0c4c('0x5b')]({'where':{'id':_0x367aa6[_0x0c4c('0x53')]['id']}})['then'](handleEntityNotFound(_0x3c145e,null))['then'](function(_0x38ef28){if(_0x38ef28){_0x3bc981=_0x38ef28;logger[_0x0c4c('0x1e')](_0x0c4c('0x1f'),_0x0c4c('0x27'),_0x0c4c('0xc8'),_0x38ef28[_0x0c4c('0x79')],util['inspect'](_0x367aa6[_0x0c4c('0x55')],{'showHidden':![],'depth':null}));switch(_0x38ef28[_0x0c4c('0x79')]){case _0x0c4c('0x7d'):if(_0x367aa6[_0x0c4c('0x55')][_0x0c4c('0xc9')]&&_0x367aa6[_0x0c4c('0x55')][_0x0c4c('0x27')]){_0x61da59=_0x367aa6['body']['status'];return db[_0x0c4c('0xa5')][_0x0c4c('0x5b')]({'where':{'messageId':_0x367aa6[_0x0c4c('0x55')][_0x0c4c('0xc9')]}});}break;case _0x0c4c('0x80'):if(_0x367aa6[_0x0c4c('0x55')][_0x0c4c('0xca')]&&_0x367aa6[_0x0c4c('0x55')][_0x0c4c('0xcb')]){_0x61da59=_0x367aa6[_0x0c4c('0x55')]['statusInt'];return db['SmsMessage'][_0x0c4c('0x5b')]({'where':{'messageId':_0x367aa6[_0x0c4c('0x55')][_0x0c4c('0xca')]}});}break;case _0x0c4c('0x81'):if(_0x367aa6[_0x0c4c('0x55')][_0x0c4c('0xcc')]&&_0x367aa6[_0x0c4c('0x55')][_0x0c4c('0xcd')]){_0x61da59=_0x367aa6[_0x0c4c('0x55')][_0x0c4c('0xcd')];return db[_0x0c4c('0xa5')][_0x0c4c('0x5b')]({'where':{'messageId':_0x367aa6['body'][_0x0c4c('0xcc')]}});}break;case _0x0c4c('0x86'):var _0xa6323a=_0x367aa6[_0x0c4c('0x55')][_0x0c4c('0x87')][0x0];if(_0xa6323a['messageId']&&_0xa6323a[_0x0c4c('0x27')][_0x0c4c('0xce')]===_0x0c4c('0xcf')){_0x61da59=_0xa6323a['status'][_0x0c4c('0xce')];return db['SmsMessage'][_0x0c4c('0x5b')]({'where':{'messageId':_0xa6323a[_0x0c4c('0x82')]}});}break;case _0x0c4c('0x8b'):if(_0x367aa6[_0x0c4c('0x55')][_0x0c4c('0x82')]&&_0x367aa6[_0x0c4c('0x55')][_0x0c4c('0x27')]){_0x61da59=_0x367aa6[_0x0c4c('0x55')][_0x0c4c('0x27')];return db[_0x0c4c('0xa5')][_0x0c4c('0x5b')]({'where':{'messageId':_0x367aa6[_0x0c4c('0x55')][_0x0c4c('0x82')]}});}break;case _0x0c4c('0x8e'):if(_0x367aa6[_0x0c4c('0x55')][0x0][_0x0c4c('0x24')]['id']){_0x61da59=_0x367aa6[_0x0c4c('0x55')][0x0][_0x0c4c('0x79')];return db[_0x0c4c('0xa5')][_0x0c4c('0x5b')]({'where':{'messageId':_0x367aa6[_0x0c4c('0x55')][0x0][_0x0c4c('0x24')]['id']}});}break;case _0x0c4c('0x8f'):if(_0x367aa6[_0x0c4c('0x55')]['redif']&&_0x367aa6[_0x0c4c('0x55')][_0x0c4c('0x27')]){_0x61da59=_0x367aa6[_0x0c4c('0x55')][_0x0c4c('0x27')];return db[_0x0c4c('0xa5')]['find']({'where':{'messageId':_0x367aa6['body'][_0x0c4c('0xd0')]}});}break;}}})[_0x0c4c('0x1b')](handleEntityNotFound(_0x3c145e,null))['then'](function(_0x1565ca){if(_0x1565ca){_0x200311=_0x1565ca;switch(_0x3bc981[_0x0c4c('0x79')]){case _0x0c4c('0x7d'):if(_0x61da59===_0x0c4c('0xcf')){return _0x200311['update']({'read':!![]});}else{logger[_0x0c4c('0x21')](_0x0c4c('0x1f'),_0x0c4c('0x27'),_0x0c4c('0x7d'),util[_0x0c4c('0xd1')](_0x367aa6[_0x0c4c('0x55')],{'showHidden':![],'depth':null}));}break;case _0x0c4c('0x80'):if(_0x61da59==='1'){return _0x200311[_0x0c4c('0x31')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x0c4c('0x27'),_0x0c4c('0x7d'),util['inspect'](_0x367aa6[_0x0c4c('0x55')],{'showHidden':![],'depth':null}));}break;case _0x0c4c('0x81'):if(!_0x367aa6[_0x0c4c('0x55')][_0x0c4c('0xd2')]&&_0x61da59>=0xc8&&_0x61da59<=0xce){return _0x200311[_0x0c4c('0x31')]({'read':!![]});}else{logger['error'](_0x0c4c('0x1f'),_0x0c4c('0x27'),_0x0c4c('0x81'),util[_0x0c4c('0xd1')](_0x367aa6[_0x0c4c('0x55')],{'showHidden':![],'depth':null}));}break;case _0x0c4c('0x86'):var _0x221b27=_0x367aa6[_0x0c4c('0x55')][_0x0c4c('0x87')][0x0];if(_0x221b27[_0x0c4c('0x27')][_0x0c4c('0xce')]===_0x0c4c('0xcf')){return _0x200311[_0x0c4c('0x31')]({'read':!![]});}else{logger[_0x0c4c('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x0c4c('0x27'),'infobip',util[_0x0c4c('0xd1')](_0x367aa6[_0x0c4c('0x55')],{'showHidden':![],'depth':null}));}break;case _0x0c4c('0x8b'):if(_0x61da59==_0x0c4c('0xd3')||_0x61da59==_0x0c4c('0xd4')){return _0x200311[_0x0c4c('0x31')]({'read':!![]});}else{logger[_0x0c4c('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x0c4c('0x27'),'clickatell',util[_0x0c4c('0xd1')](_0x367aa6[_0x0c4c('0x55')],{'showHidden':![],'depth':null}));}break;case _0x0c4c('0x8e'):if(_0x61da59=='message-delivered'){return _0x200311[_0x0c4c('0x31')]({'read':!![]});}else{logger[_0x0c4c('0x21')](_0x0c4c('0x1f'),'status',_0x0c4c('0x8e'),util[_0x0c4c('0xd1')](_0x367aa6[_0x0c4c('0x55')],{'showHidden':![],'depth':null}));}break;case _0x0c4c('0x8f'):if(_0x61da59===_0x0c4c('0xd5')||_0x61da59==='ACCEPTD'){return _0x200311[_0x0c4c('0x31')]({'read':!![]});}else{logger['error'](_0x0c4c('0x1f'),_0x0c4c('0x27'),_0x0c4c('0x8f'),util[_0x0c4c('0xd1')](_0x367aa6[_0x0c4c('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x200311;}})[_0x0c4c('0x1b')](respondWithResult(_0x3c145e,null))[_0x0c4c('0x52')](handleError(_0x3c145e,null));};exports[_0x0c4c('0xd6')]=function(_0xf956cd,_0x3d26e3,_0xf62070){var _0x36bef9,_0x1b195d,_0x44db06;return db['SmsAccount']['find']({'where':{'id':_0xf956cd['params']['id']}})[_0x0c4c('0x1b')](handleEntityNotFound(_0x3d26e3,null))[_0x0c4c('0x1b')](function(_0x48c358){if(_0x48c358){_0x44db06=_0x48c358;logger[_0x0c4c('0x1e')](_0x0c4c('0x1f'),_0x0c4c('0x27'),'received\x20delivery\x20report\x20from',_0x48c358[_0x0c4c('0x79')],util['inspect'](_0xf956cd['query'],{'showHidden':![],'depth':null}));switch(_0x48c358[_0x0c4c('0x79')]){case _0x0c4c('0x88'):if(_0xf956cd[_0x0c4c('0x3e')][_0x0c4c('0xd7')]&&_0xf956cd[_0x0c4c('0x3e')][_0x0c4c('0xd8')]){_0x1b195d=_0xf956cd[_0x0c4c('0x3e')]['state'];return db[_0x0c4c('0xa5')][_0x0c4c('0x5b')]({'where':{'messageId':_0xf956cd['query'][_0x0c4c('0xd7')]}});}break;}}})[_0x0c4c('0x1b')](handleEntityNotFound(_0x3d26e3,null))['then'](function(_0x423be5){if(_0x423be5){_0x36bef9=_0x423be5;switch(_0x44db06[_0x0c4c('0x79')]){case _0x0c4c('0x88'):if(_0x1b195d==='2'||_0x1b195d==='6'){return _0x36bef9[_0x0c4c('0x31')]({'read':!![]});}else{logger[_0x0c4c('0x21')](_0x0c4c('0x1f'),_0x0c4c('0x27'),_0x0c4c('0x88'),util['inspect'](_0xf956cd[_0x0c4c('0x3e')],{'showHidden':![],'depth':null}));};break;}return _0x36bef9;}})['then'](respondWithResult(_0x3d26e3,null))[_0x0c4c('0x52')](handleError(_0x3d26e3,null));};exports['addAgents']=function(_0x94e498,_0x1d7a2e,_0x523d7a){return db[_0x0c4c('0x39')][_0x0c4c('0x5b')]({'where':{'id':_0x94e498[_0x0c4c('0x53')]['id']}})['then'](handleEntityNotFound(_0x1d7a2e,null))[_0x0c4c('0x1b')](function(_0x2bf1bf){if(_0x2bf1bf){return _0x2bf1bf[_0x0c4c('0xd9')](_0x94e498[_0x0c4c('0x55')][_0x0c4c('0x65')],_[_0x0c4c('0x9c')](_0x94e498[_0x0c4c('0x55')],[_0x0c4c('0x65'),'id'])||{})['spread'](function(_0x5e2994){for(var _0x53262b=0x0;_0x53262b<_0x94e498[_0x0c4c('0x55')][_0x0c4c('0x65')][_0x0c4c('0x44')];_0x53262b+=0x1){socket[_0x0c4c('0xda')](_0x0c4c('0xdb'),{'UserId':Number(_0x94e498['body'][_0x0c4c('0x65')][_0x53262b]),'SmsAccountId':Number(_0x94e498['params']['id'])});}return _0x5e2994;});}})[_0x0c4c('0x1b')](respondWithResult(_0x1d7a2e,null))[_0x0c4c('0x52')](handleError(_0x1d7a2e,null));};exports[_0x0c4c('0xdc')]=function(_0x5cae80,_0x1e5bfa,_0x5748cf){return db[_0x0c4c('0x39')]['find']({'where':{'id':_0x5cae80[_0x0c4c('0x53')]['id']}})[_0x0c4c('0x1b')](handleEntityNotFound(_0x1e5bfa,null))[_0x0c4c('0x1b')](function(_0x515590){if(_0x515590){return _0x515590[_0x0c4c('0xdc')](_0x5cae80['query'][_0x0c4c('0x65')])['then'](function(){if(_[_0x0c4c('0xdd')](_0x5cae80[_0x0c4c('0x3e')][_0x0c4c('0x65')])){for(var _0x594ef5=0x0;_0x594ef5<_0x5cae80[_0x0c4c('0x3e')][_0x0c4c('0x65')][_0x0c4c('0x44')];_0x594ef5+=0x1){socket['emit']('userSmsAccount:remove',{'UserId':Number(_0x5cae80[_0x0c4c('0x3e')]['ids'][_0x594ef5]),'SmsAccountId':Number(_0x5cae80[_0x0c4c('0x53')]['id'])});}}else{socket[_0x0c4c('0xda')](_0x0c4c('0xde'),{'UserId':Number(_0x5cae80[_0x0c4c('0x3e')]['ids']),'SmsAccountId':Number(_0x5cae80['params']['id'])});}});}})[_0x0c4c('0x1b')](respondWithStatusCode(_0x1e5bfa,null))[_0x0c4c('0x52')](handleError(_0x1e5bfa,null));};exports['getAgents']=function(_0x3c21fd,_0x3ce03f,_0x29bd6d){var _0x7298a8={};var _0x4e8f2a={};var _0x109541;var _0x3eebf1;return db[_0x0c4c('0x39')][_0x0c4c('0x63')]({'where':{'id':_0x3c21fd[_0x0c4c('0x53')]['id']}})[_0x0c4c('0x1b')](handleEntityNotFound(_0x3ce03f,null))['then'](function(_0x193a06){if(_0x193a06){_0x109541=_0x193a06;_0x4e8f2a[_0x0c4c('0x3c')]=_[_0x0c4c('0x3f')](db[_0x0c4c('0xa9')]['rawAttributes']);_0x4e8f2a['query']=_['keys'](_0x3c21fd['query']);_0x4e8f2a[_0x0c4c('0x40')]=_[_0x0c4c('0x41')](_0x4e8f2a['model'],_0x4e8f2a[_0x0c4c('0x3e')]);_0x7298a8[_0x0c4c('0x42')]=_[_0x0c4c('0x41')](_0x4e8f2a[_0x0c4c('0x3c')],qs['fields'](_0x3c21fd[_0x0c4c('0x3e')][_0x0c4c('0x43')]));_0x7298a8['attributes']=_0x7298a8[_0x0c4c('0x42')][_0x0c4c('0x44')]?_0x7298a8[_0x0c4c('0x42')]:_0x4e8f2a[_0x0c4c('0x3c')];_0x7298a8[_0x0c4c('0x47')]=qs[_0x0c4c('0x48')](_0x3c21fd[_0x0c4c('0x3e')][_0x0c4c('0x48')]);_0x7298a8[_0x0c4c('0x49')]=qs[_0x0c4c('0x40')](_[_0x0c4c('0x4a')](_0x3c21fd[_0x0c4c('0x3e')],_0x4e8f2a[_0x0c4c('0x40')]));if(_0x3c21fd[_0x0c4c('0x3e')][_0x0c4c('0x4b')]){_0x7298a8[_0x0c4c('0x49')]=_[_0x0c4c('0x4c')](_0x7298a8[_0x0c4c('0x49')],{'$or':_['map'](_0x7298a8[_0x0c4c('0x42')],function(_0xe45136){var _0x45c3f9={};_0x45c3f9[_0xe45136]={'$like':'%'+_0x3c21fd['query'][_0x0c4c('0x4b')]+'%'};return _0x45c3f9;})});}_0x7298a8=_['merge']({},_0x7298a8,_0x3c21fd[_0x0c4c('0x4e')]);return _0x109541[_0x0c4c('0xdf')](_0x7298a8);}})[_0x0c4c('0x1b')](function(_0x2b645b){if(_0x2b645b){_0x3eebf1=_0x2b645b[_0x0c4c('0x44')];if(!_0x3c21fd[_0x0c4c('0x3e')]['hasOwnProperty'](_0x0c4c('0x46'))){_0x7298a8[_0x0c4c('0x2c')]=qs[_0x0c4c('0x2c')](_0x3c21fd['query'][_0x0c4c('0x2c')]);_0x7298a8['offset']=qs[_0x0c4c('0x2a')](_0x3c21fd[_0x0c4c('0x3e')][_0x0c4c('0x2a')]);}return _0x109541[_0x0c4c('0xdf')](_0x7298a8);}})['then'](function(_0x31164c){if(_0x31164c){return _0x31164c?{'count':_0x3eebf1,'rows':_0x31164c}:null;}})[_0x0c4c('0x1b')](respondWithResult(_0x3ce03f,null))[_0x0c4c('0x52')](handleError(_0x3ce03f,null));}; \ No newline at end of file +var _0x7e3d=['debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','SmsAccount,\x20%s,\x20%s','result','catch','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','get','SmsAccounts','UserProfileResource','destroy','sendStatus','stack','name','index','Pause','SmsAccount','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','params','mandatoryDispositionPause','fields','include','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','order','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','sms','SmsApplication','Applications','applications','orderBy','priority','asc','account','CmContact','describe','Sequelize','difference','createdAt','updatedAt','CompanyId','twilio','from','Body','messageId','MessageSid','sender','text','connectel','clicksend','message_id','plivo','From','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','replyMessageId','intelepeer','ValidationError','from\x20is\x20mandatory','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','DESC','list','omit','contact','SmsInteraction','interaction','created','push','unmanaged','SmsMessage','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','startRouting','receiveMessage','entity\x20found','Content-Type','text/xml','send','\x0a','addApplications','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','tag','to\x20is\x20mandatory','List','out','Messages','dataValues','inspect','skebby','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','redif','error_code','RECEIVED_BY_RECIPIENT','bandwidth','message-delivered','DELIVRD','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','state','message-id','spread','userSmsAccount:save','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','jayson/promise','client','http','info'];(function(_0x481784,_0x5cb506){var _0x92d05e=function(_0x1296c8){while(--_0x1296c8){_0x481784['push'](_0x481784['shift']());}};_0x92d05e(++_0x5cb506);}(_0x7e3d,0xbf));var _0xd7e3=function(_0x53145d,_0x2d1e61){_0x53145d=_0x53145d-0x0;var _0x365739=_0x7e3d[_0x53145d];return _0x365739;};'use strict';var emlformat=require(_0xd7e3('0x0'));var rimraf=require(_0xd7e3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd7e3('0x2'));var rp=require(_0xd7e3('0x3'));var moment=require(_0xd7e3('0x4'));var BPromise=require(_0xd7e3('0x5'));var Mustache=require('mustache');var util=require(_0xd7e3('0x6'));var path=require(_0xd7e3('0x7'));var sox=require(_0xd7e3('0x8'));var csv=require(_0xd7e3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd7e3('0xa'));var squel=require(_0xd7e3('0xb'));var crypto=require(_0xd7e3('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd7e3('0xd'));var toCsv=require(_0xd7e3('0x9'));var querystring=require(_0xd7e3('0xe'));var Papa=require(_0xd7e3('0xf'));var Redis=require('ioredis');var authService=require(_0xd7e3('0x10'));var qs=require(_0xd7e3('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd7e3('0x12'));var utils=require('../../config/utils');var config=require(_0xd7e3('0x13'));var licenseUtil=require(_0xd7e3('0x14'));var db=require(_0xd7e3('0x15'))['db'];config[_0xd7e3('0x16')]=_[_0xd7e3('0x17')](config[_0xd7e3('0x16')],{'host':_0xd7e3('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd7e3('0x16')]));require('./smsAccount.socket')[_0xd7e3('0x19')](socket);var jayson=require(_0xd7e3('0x1a'));var client=jayson[_0xd7e3('0x1b')][_0xd7e3('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x271da1,_0x53fed6,_0x5e48fc,_0x3ffa51){return new BPromise(function(_0x15f114,_0x5a93c3){var _0x1b2d3a=_0x3ffa51||client;return _0x1b2d3a['request'](_0x271da1,_0x5e48fc)['then'](function(_0x585dad){logger[_0xd7e3('0x1d')]('SmsAccount,\x20%s,\x20%s',_0x53fed6,'request\x20sent');logger[_0xd7e3('0x1e')](_0xd7e3('0x1f'),_0x53fed6,_0xd7e3('0x20'),JSON[_0xd7e3('0x21')](_0x585dad));if(_0x585dad[_0xd7e3('0x22')]){if(_0x585dad[_0xd7e3('0x22')]['code']===0x1f4){logger[_0xd7e3('0x22')]('SmsAccount,\x20%s,\x20%s',_0x53fed6,_0x585dad[_0xd7e3('0x22')][_0xd7e3('0x23')]);return _0x5a93c3(_0x585dad[_0xd7e3('0x22')][_0xd7e3('0x23')]);}logger[_0xd7e3('0x22')](_0xd7e3('0x24'),_0x53fed6,_0x585dad[_0xd7e3('0x22')]['message']);return _0x15f114(_0x585dad['error'][_0xd7e3('0x23')]);}else{logger[_0xd7e3('0x1d')](_0xd7e3('0x24'),_0x53fed6,_0xd7e3('0x20'));_0x15f114(_0x585dad[_0xd7e3('0x25')][_0xd7e3('0x23')]);}})[_0xd7e3('0x26')](function(_0x3a3dba){logger[_0xd7e3('0x22')](_0xd7e3('0x24'),_0x53fed6,_0x3a3dba);_0x5a93c3(_0x3a3dba);});});}function respondWithStatusCode(_0x172816,_0x8db0ce){_0x8db0ce=_0x8db0ce||0xcc;return function(_0x18967e){if(_0x18967e){return _0x172816['sendStatus'](_0x8db0ce);}return _0x172816[_0xd7e3('0x27')](_0x8db0ce)[_0xd7e3('0x28')]();};}function respondWithResult(_0x32ec9d,_0x9ec4b6){_0x9ec4b6=_0x9ec4b6||0xc8;return function(_0x27fafb){if(_0x27fafb){return _0x32ec9d['status'](_0x9ec4b6)[_0xd7e3('0x29')](_0x27fafb);}};}function respondWithFilteredResult(_0x1e8941,_0x1b6b30){return function(_0x23472f){if(_0x23472f){var _0x1d2e78=typeof _0x1b6b30[_0xd7e3('0x2a')]===_0xd7e3('0x2b')&&typeof _0x1b6b30['limit']===_0xd7e3('0x2b');var _0x12c8a2=_0x23472f[_0xd7e3('0x2c')];var _0xf554b=_0x1d2e78?0x0:_0x1b6b30[_0xd7e3('0x2a')];var _0x368100=_0x1d2e78?_0x23472f[_0xd7e3('0x2c')]:_0x1b6b30['offset']+_0x1b6b30[_0xd7e3('0x2d')];var _0x41bcf4;if(_0x368100>=_0x12c8a2){_0x368100=_0x12c8a2;_0x41bcf4=0xc8;}else{_0x41bcf4=0xce;}_0x1e8941['status'](_0x41bcf4);return _0x1e8941[_0xd7e3('0x2e')](_0xd7e3('0x2f'),_0xf554b+'-'+_0x368100+'/'+_0x12c8a2)[_0xd7e3('0x29')](_0x23472f);}return null;};}function patchUpdates(_0x3af089){return function(_0x359a12){try{jsonpatch[_0xd7e3('0x30')](_0x359a12,_0x3af089,!![]);}catch(_0x599507){return BPromise[_0xd7e3('0x31')](_0x599507);}return _0x359a12[_0xd7e3('0x32')]();};}function saveUpdates(_0x4398fc,_0x32beea){return function(_0x5ef433){if(_0x5ef433){return _0x5ef433[_0xd7e3('0x33')](_0x4398fc)['then'](function(_0x4e2915){return _0x4e2915;});}return null;};}function removeEntity(_0x34adae,_0x4da968){return function(_0x23872a){if(_0x23872a){return _0x23872a['destroy']()[_0xd7e3('0x34')](function(){var _0x14149e=_0x23872a[_0xd7e3('0x35')]({'plain':!![]});var _0x43f56f=_0xd7e3('0x36');return db[_0xd7e3('0x37')][_0xd7e3('0x38')]({'where':{'type':_0x43f56f,'resourceId':_0x14149e['id']}})[_0xd7e3('0x34')](function(){return _0x23872a;});})[_0xd7e3('0x34')](function(){_0x34adae[_0xd7e3('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e6332,_0x2b7f8a){return function(_0x2e5b71){if(!_0x2e5b71){_0x2e6332[_0xd7e3('0x39')](0x194);}return _0x2e5b71;};}function handleError(_0x59495b,_0x4c0634){_0x4c0634=_0x4c0634||0x1f4;return function(_0x211d9f){logger[_0xd7e3('0x22')](_0x211d9f[_0xd7e3('0x3a')]);if(_0x211d9f[_0xd7e3('0x3b')]){delete _0x211d9f['name'];}_0x59495b[_0xd7e3('0x27')](_0x4c0634)['send'](_0x211d9f);};}exports[_0xd7e3('0x3c')]=function(_0x37731a,_0x42827b){var _0x1c29d6={'include':[{'model':db[_0xd7e3('0x3d')],'as':'mandatoryDispositionPause'}]},_0x36ef46={},_0x425af7={'count':0x0,'rows':[]};var _0x667351=_['map'](db[_0xd7e3('0x3e')][_0xd7e3('0x3f')],function(_0x42ccd5){return{'name':_0x42ccd5['fieldName'],'type':_0x42ccd5[_0xd7e3('0x40')][_0xd7e3('0x41')]};});_0x36ef46[_0xd7e3('0x42')]=_[_0xd7e3('0x43')](_0x667351,_0xd7e3('0x3b'));_0x36ef46[_0xd7e3('0x44')]=_[_0xd7e3('0x45')](_0x37731a[_0xd7e3('0x44')]);_0x36ef46[_0xd7e3('0x46')]=_[_0xd7e3('0x47')](_0x36ef46[_0xd7e3('0x42')],_0x36ef46[_0xd7e3('0x44')]);_0x1c29d6[_0xd7e3('0x48')]=_[_0xd7e3('0x47')](_0x36ef46['model'],qs['fields'](_0x37731a[_0xd7e3('0x44')]['fields']));_0x1c29d6['attributes']=_0x1c29d6[_0xd7e3('0x48')][_0xd7e3('0x49')]?_0x1c29d6[_0xd7e3('0x48')]:_0x36ef46[_0xd7e3('0x42')];if(!_0x37731a[_0xd7e3('0x44')][_0xd7e3('0x4a')](_0xd7e3('0x4b'))){_0x1c29d6['limit']=qs[_0xd7e3('0x2d')](_0x37731a['query']['limit']);_0x1c29d6[_0xd7e3('0x2a')]=qs[_0xd7e3('0x2a')](_0x37731a[_0xd7e3('0x44')][_0xd7e3('0x2a')]);}_0x1c29d6['order']=qs['sort'](_0x37731a[_0xd7e3('0x44')][_0xd7e3('0x4c')]);_0x1c29d6[_0xd7e3('0x4d')]=qs['filters'](_[_0xd7e3('0x4e')](_0x37731a[_0xd7e3('0x44')],_0x36ef46['filters']),_0x667351);if(_0x37731a[_0xd7e3('0x44')][_0xd7e3('0x4f')]){_0x1c29d6[_0xd7e3('0x4d')]=_[_0xd7e3('0x50')](_0x1c29d6[_0xd7e3('0x4d')],{'$or':_[_0xd7e3('0x43')](_0x667351,function(_0x49bd9a){if(_0x49bd9a[_0xd7e3('0x40')]!==_0xd7e3('0x51')){var _0xbe061d={};_0xbe061d[_0x49bd9a[_0xd7e3('0x3b')]]={'$like':'%'+_0x37731a['query'][_0xd7e3('0x4f')]+'%'};return _0xbe061d;}})});}_0x1c29d6=_[_0xd7e3('0x50')]({},_0x1c29d6,_0x37731a[_0xd7e3('0x52')]);var _0x30c959={'where':_0x1c29d6[_0xd7e3('0x4d')]};return db[_0xd7e3('0x3e')][_0xd7e3('0x2c')](_0x30c959)[_0xd7e3('0x34')](function(_0x102cfb){_0x425af7['count']=_0x102cfb;if(_0x37731a[_0xd7e3('0x44')][_0xd7e3('0x53')]){_0x1c29d6['include']=[{'all':!![]}];}return db[_0xd7e3('0x3e')]['findAll'](_0x1c29d6);})[_0xd7e3('0x34')](function(_0x1b2049){_0x425af7[_0xd7e3('0x54')]=_0x1b2049;return _0x425af7;})[_0xd7e3('0x34')](respondWithFilteredResult(_0x42827b,_0x1c29d6))[_0xd7e3('0x26')](handleError(_0x42827b,null));};exports['show']=function(_0x5076c4,_0x197b6a){var _0x125a4d={'raw':![],'where':{'id':_0x5076c4[_0xd7e3('0x55')]['id']},'include':[{'model':db[_0xd7e3('0x3d')],'as':_0xd7e3('0x56')}]},_0x448d1e={};_0x448d1e[_0xd7e3('0x42')]=_[_0xd7e3('0x45')](db[_0xd7e3('0x3e')][_0xd7e3('0x3f')]);_0x448d1e[_0xd7e3('0x44')]=_[_0xd7e3('0x45')](_0x5076c4[_0xd7e3('0x44')]);_0x448d1e[_0xd7e3('0x46')]=_['intersection'](_0x448d1e[_0xd7e3('0x42')],_0x448d1e['query']);_0x125a4d['attributes']=_[_0xd7e3('0x47')](_0x448d1e['model'],qs[_0xd7e3('0x57')](_0x5076c4[_0xd7e3('0x44')][_0xd7e3('0x57')]));_0x125a4d[_0xd7e3('0x48')]=_0x125a4d[_0xd7e3('0x48')][_0xd7e3('0x49')]?_0x125a4d['attributes']:_0x448d1e[_0xd7e3('0x42')];if(_0x5076c4['query'][_0xd7e3('0x53')]){_0x125a4d[_0xd7e3('0x58')]=[{'all':!![]}];}_0x125a4d=_[_0xd7e3('0x50')]({},_0x125a4d,_0x5076c4['options']);return db[_0xd7e3('0x3e')][_0xd7e3('0x59')](_0x125a4d)[_0xd7e3('0x34')](handleEntityNotFound(_0x197b6a,null))[_0xd7e3('0x34')](respondWithResult(_0x197b6a,null))[_0xd7e3('0x26')](handleError(_0x197b6a,null));};exports[_0xd7e3('0x5a')]=function(_0x771f92,_0x548d39){return db[_0xd7e3('0x3e')][_0xd7e3('0x5a')](_0x771f92[_0xd7e3('0x5b')],{})[_0xd7e3('0x34')](function(_0x345653){var _0xec1ff=_0x771f92[_0xd7e3('0x5c')][_0xd7e3('0x35')]({'plain':!![]});if(!_0xec1ff)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xec1ff[_0xd7e3('0x5d')]===_0xd7e3('0x5c')){var _0x1fdecc=_0x345653[_0xd7e3('0x35')]({'plain':!![]});var _0x203eb7='SmsAccounts';return db[_0xd7e3('0x5e')][_0xd7e3('0x59')]({'where':{'name':_0x203eb7,'userProfileId':_0xec1ff[_0xd7e3('0x5f')]},'raw':!![]})[_0xd7e3('0x34')](function(_0x32e993){if(_0x32e993&&_0x32e993[_0xd7e3('0x60')]===0x0){return db[_0xd7e3('0x37')]['create']({'name':_0x1fdecc[_0xd7e3('0x3b')],'resourceId':_0x1fdecc['id'],'type':_0x32e993[_0xd7e3('0x3b')],'sectionId':_0x32e993['id']},{})[_0xd7e3('0x34')](function(){return _0x345653;});}else{return _0x345653;}})[_0xd7e3('0x26')](function(_0xab4f61){logger[_0xd7e3('0x22')](_0xd7e3('0x61'),_0xab4f61);throw _0xab4f61;});}return _0x345653;})[_0xd7e3('0x34')](respondWithResult(_0x548d39,0xc9))[_0xd7e3('0x26')](handleError(_0x548d39,null));};exports[_0xd7e3('0x33')]=function(_0x4fd993,_0x279b0c){if(_0x4fd993['body']['id']){delete _0x4fd993['body']['id'];}return db[_0xd7e3('0x3e')]['find']({'where':{'id':_0x4fd993[_0xd7e3('0x55')]['id']},'include':[{'model':db[_0xd7e3('0x3d')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x279b0c,null))[_0xd7e3('0x34')](saveUpdates(_0x4fd993[_0xd7e3('0x5b')],null))[_0xd7e3('0x34')](respondWithResult(_0x279b0c,null))['catch'](handleError(_0x279b0c,null));};exports[_0xd7e3('0x38')]=function(_0x1d056f,_0x2db667){return db[_0xd7e3('0x3e')][_0xd7e3('0x59')]({'where':{'id':_0x1d056f['params']['id']}})['then'](handleEntityNotFound(_0x2db667,null))[_0xd7e3('0x34')](removeEntity(_0x2db667,null))[_0xd7e3('0x26')](handleError(_0x2db667,null));};exports['describe']=function(_0x17f3df,_0x124ea8){return db[_0xd7e3('0x3e')]['describe']()[_0xd7e3('0x34')](respondWithResult(_0x124ea8,null))[_0xd7e3('0x26')](handleError(_0x124ea8,null));};exports[_0xd7e3('0x62')]=function(_0x5d883b,_0x30ceab,_0x4abc44){if(_0x5d883b['body']['id']){delete _0x5d883b[_0xd7e3('0x5b')]['id'];}return db[_0xd7e3('0x3e')][_0xd7e3('0x59')]({'where':{'id':_0x5d883b[_0xd7e3('0x55')]['id']}})[_0xd7e3('0x34')](handleEntityNotFound(_0x30ceab,null))[_0xd7e3('0x34')](function(_0x20e367){if(_0x20e367){_0x5d883b[_0xd7e3('0x5b')][_0xd7e3('0x63')]=_0x20e367['id'];return db[_0xd7e3('0x64')]['create'](_0x5d883b['body']);}})[_0xd7e3('0x34')](respondWithResult(_0x30ceab,null))[_0xd7e3('0x26')](handleError(_0x30ceab,null));};exports[_0xd7e3('0x65')]=function(_0x46a04e,_0x4fb094,_0xdc42b3){var _0x239250={'raw':![],'where':{}};var _0x269217={};var _0x2fe743={'count':0x0,'rows':[]};return db[_0xd7e3('0x3e')][_0xd7e3('0x66')]({'where':{'id':_0x46a04e[_0xd7e3('0x55')]['id']}})[_0xd7e3('0x34')](handleEntityNotFound(_0x4fb094,null))['then'](function(_0x1ed9cd){if(_0x1ed9cd){_0x269217[_0xd7e3('0x42')]=_[_0xd7e3('0x45')](db['Disposition'][_0xd7e3('0x3f')]);_0x269217['query']=_['keys'](_0x46a04e[_0xd7e3('0x44')]);_0x269217[_0xd7e3('0x46')]=_[_0xd7e3('0x47')](_0x269217[_0xd7e3('0x42')],_0x269217[_0xd7e3('0x44')]);_0x239250[_0xd7e3('0x48')]=_['intersection'](_0x269217[_0xd7e3('0x42')],qs[_0xd7e3('0x57')](_0x46a04e[_0xd7e3('0x44')]['fields']));_0x239250['attributes']=_0x239250[_0xd7e3('0x48')]['length']?_0x239250[_0xd7e3('0x48')]:_0x269217[_0xd7e3('0x42')];if(!_0x46a04e[_0xd7e3('0x44')][_0xd7e3('0x4a')]('nolimit')){_0x239250['limit']=qs['limit'](_0x46a04e[_0xd7e3('0x44')][_0xd7e3('0x2d')]);_0x239250[_0xd7e3('0x2a')]=qs[_0xd7e3('0x2a')](_0x46a04e[_0xd7e3('0x44')][_0xd7e3('0x2a')]);}_0x239250[_0xd7e3('0x67')]=qs[_0xd7e3('0x4c')](_0x46a04e[_0xd7e3('0x44')][_0xd7e3('0x4c')]);_0x239250[_0xd7e3('0x4d')]=qs[_0xd7e3('0x46')](_[_0xd7e3('0x4e')](_0x46a04e[_0xd7e3('0x44')],_0x269217[_0xd7e3('0x46')]));_0x239250[_0xd7e3('0x4d')]['SmsAccountId']=_0x1ed9cd['id'];if(_0x46a04e[_0xd7e3('0x44')][_0xd7e3('0x4f')]){_0x239250[_0xd7e3('0x4d')]=_[_0xd7e3('0x50')](_0x239250[_0xd7e3('0x4d')],{'$or':_[_0xd7e3('0x43')](_0x239250[_0xd7e3('0x48')],function(_0x5b4045){var _0x2bda0b={};_0x2bda0b[_0x5b4045]={'$like':'%'+_0x46a04e[_0xd7e3('0x44')][_0xd7e3('0x4f')]+'%'};return _0x2bda0b;})});}_0x239250=_[_0xd7e3('0x50')]({},_0x239250,_0x46a04e[_0xd7e3('0x52')]);return db[_0xd7e3('0x64')][_0xd7e3('0x2c')]({'where':_0x239250[_0xd7e3('0x4d')]})[_0xd7e3('0x34')](function(_0x53935d){_0x2fe743[_0xd7e3('0x2c')]=_0x53935d;if(_0x46a04e[_0xd7e3('0x44')][_0xd7e3('0x53')]){_0x239250[_0xd7e3('0x58')]=[{'all':!![]}];}return db[_0xd7e3('0x64')][_0xd7e3('0x68')](_0x239250);})[_0xd7e3('0x34')](function(_0x271e81){_0x2fe743[_0xd7e3('0x54')]=_0x271e81;return _0x2fe743;});}})[_0xd7e3('0x34')](respondWithFilteredResult(_0x4fb094,_0x239250))['catch'](handleError(_0x4fb094,null));};exports['removeDispositions']=function(_0xbc44a2,_0x238b3a,_0x56fab2){return db[_0xd7e3('0x3e')][_0xd7e3('0x59')]({'where':{'id':_0xbc44a2[_0xd7e3('0x55')]['id']}})[_0xd7e3('0x34')](handleEntityNotFound(_0x238b3a,null))['then'](function(_0x8e65b9){if(_0x8e65b9){return _0x8e65b9[_0xd7e3('0x69')](_0xbc44a2[_0xd7e3('0x44')][_0xd7e3('0x6a')]);}})['then'](respondWithStatusCode(_0x238b3a,null))['catch'](handleError(_0x238b3a,null));};exports[_0xd7e3('0x6b')]=function(_0x491189,_0x48f195,_0x546f74){if(_0x491189['body']['id']){delete _0x491189[_0xd7e3('0x5b')]['id'];}return db[_0xd7e3('0x3e')]['find']({'where':{'id':_0x491189[_0xd7e3('0x55')]['id']}})[_0xd7e3('0x34')](handleEntityNotFound(_0x48f195,null))[_0xd7e3('0x34')](function(_0x23191d){if(_0x23191d){_0x491189['body']['SmsAccountId']=_0x23191d['id'];return db[_0xd7e3('0x6c')][_0xd7e3('0x5a')](_0x491189[_0xd7e3('0x5b')]);}})[_0xd7e3('0x34')](respondWithResult(_0x48f195,null))[_0xd7e3('0x26')](handleError(_0x48f195,null));};exports[_0xd7e3('0x6d')]=function(_0x5f3fb3,_0xd648d6,_0xe5880){var _0x195898={'raw':![],'where':{}};var _0x3a8095={};var _0x4a1c96={'count':0x0,'rows':[]};return db[_0xd7e3('0x3e')]['findOne']({'where':{'id':_0x5f3fb3[_0xd7e3('0x55')]['id']}})[_0xd7e3('0x34')](handleEntityNotFound(_0xd648d6,null))[_0xd7e3('0x34')](function(_0x1b049f){if(_0x1b049f){_0x3a8095[_0xd7e3('0x42')]=_['keys'](db[_0xd7e3('0x6c')][_0xd7e3('0x3f')]);_0x3a8095['query']=_[_0xd7e3('0x45')](_0x5f3fb3[_0xd7e3('0x44')]);_0x3a8095[_0xd7e3('0x46')]=_[_0xd7e3('0x47')](_0x3a8095['model'],_0x3a8095[_0xd7e3('0x44')]);_0x195898[_0xd7e3('0x48')]=_[_0xd7e3('0x47')](_0x3a8095[_0xd7e3('0x42')],qs[_0xd7e3('0x57')](_0x5f3fb3['query'][_0xd7e3('0x57')]));_0x195898[_0xd7e3('0x48')]=_0x195898[_0xd7e3('0x48')][_0xd7e3('0x49')]?_0x195898['attributes']:_0x3a8095[_0xd7e3('0x42')];if(!_0x5f3fb3[_0xd7e3('0x44')]['hasOwnProperty'](_0xd7e3('0x4b'))){_0x195898[_0xd7e3('0x2d')]=qs[_0xd7e3('0x2d')](_0x5f3fb3[_0xd7e3('0x44')][_0xd7e3('0x2d')]);_0x195898['offset']=qs[_0xd7e3('0x2a')](_0x5f3fb3[_0xd7e3('0x44')][_0xd7e3('0x2a')]);}_0x195898[_0xd7e3('0x67')]=qs[_0xd7e3('0x4c')](_0x5f3fb3['query'][_0xd7e3('0x4c')]);_0x195898[_0xd7e3('0x4d')]=qs['filters'](_[_0xd7e3('0x4e')](_0x5f3fb3[_0xd7e3('0x44')],_0x3a8095[_0xd7e3('0x46')]));_0x195898[_0xd7e3('0x4d')]['SmsAccountId']=_0x1b049f['id'];if(_0x5f3fb3['query']['filter']){_0x195898['where']=_[_0xd7e3('0x50')](_0x195898['where'],{'$or':_['map'](_0x195898['attributes'],function(_0x191b46){var _0x1bc18a={};_0x1bc18a[_0x191b46]={'$like':'%'+_0x5f3fb3[_0xd7e3('0x44')][_0xd7e3('0x4f')]+'%'};return _0x1bc18a;})});}_0x195898=_[_0xd7e3('0x50')]({},_0x195898,_0x5f3fb3[_0xd7e3('0x52')]);return db[_0xd7e3('0x6c')][_0xd7e3('0x2c')]({'where':_0x195898[_0xd7e3('0x4d')]})[_0xd7e3('0x34')](function(_0x5d7761){_0x4a1c96[_0xd7e3('0x2c')]=_0x5d7761;if(_0x5f3fb3[_0xd7e3('0x44')]['includeAll']){_0x195898['include']=[{'all':!![]}];}return db[_0xd7e3('0x6c')][_0xd7e3('0x68')](_0x195898);})[_0xd7e3('0x34')](function(_0x4086fb){_0x4a1c96[_0xd7e3('0x54')]=_0x4086fb;return _0x4a1c96;});}})[_0xd7e3('0x34')](respondWithFilteredResult(_0xd648d6,_0x195898))[_0xd7e3('0x26')](handleError(_0xd648d6,null));};exports[_0xd7e3('0x6e')]=function(_0x14b136,_0x3ff8c6,_0x1a77c9){return db[_0xd7e3('0x3e')]['find']({'where':{'id':_0x14b136[_0xd7e3('0x55')]['id']}})[_0xd7e3('0x34')](handleEntityNotFound(_0x3ff8c6,null))[_0xd7e3('0x34')](function(_0x4bc5c6){if(_0x4bc5c6){return _0x4bc5c6[_0xd7e3('0x6e')](_0x14b136[_0xd7e3('0x44')][_0xd7e3('0x6a')]);}})[_0xd7e3('0x34')](respondWithStatusCode(_0x3ff8c6,null))[_0xd7e3('0x26')](handleError(_0x3ff8c6,null));};exports[_0xd7e3('0x6f')]=function(_0x100076,_0x4213bf,_0x205bd6){var _0x177800={'channel':_0xd7e3('0x70')};var _0xb84b4b=[];var _0x39c2ad=[];var _0x59df84={};return db[_0xd7e3('0x3e')][_0xd7e3('0x59')]({'where':{'id':_0x100076[_0xd7e3('0x55')]['id']},'include':[{'model':db[_0xd7e3('0x71')],'as':_0xd7e3('0x72')}]})[_0xd7e3('0x34')](handleEntityNotFound(_0x4213bf,null))[_0xd7e3('0x34')](function(_0x56a5ed){_0x177800['account']=_0x56a5ed;_0x177800[_0xd7e3('0x73')]=_[_0xd7e3('0x74')](_0x56a5ed[_0xd7e3('0x72')],[_0xd7e3('0x75')],[_0xd7e3('0x76')]);if(_0x177800[_0xd7e3('0x77')]['Applications']){delete _0x177800[_0xd7e3('0x77')]['Applications'];}return db[_0xd7e3('0x78')][_0xd7e3('0x79')]();})[_0xd7e3('0x34')](function(_0x19a4bf){if(!_0x19a4bf){throw new db[(_0xd7e3('0x7a'))]['ValidationError']('no\x20available\x20attributes');}_0xb84b4b=_[_0xd7e3('0x7b')](_[_0xd7e3('0x45')](_0x19a4bf),[_0xd7e3('0x7c'),_0xd7e3('0x7d')]);_0x39c2ad=_[_0xd7e3('0x7b')](_[_0xd7e3('0x45')](_0x19a4bf),[_0xd7e3('0x7c'),_0xd7e3('0x7d'),_0xd7e3('0x7e'),'ListId']);_0x177800[_0xd7e3('0x5b')]={'mapKey':'mobile'};if(_0x177800['account'][_0xd7e3('0x40')]){switch(_0x177800[_0xd7e3('0x77')][_0xd7e3('0x40')]){case _0xd7e3('0x7f'):_0x177800['body'][_0xd7e3('0x80')]=_0x100076[_0xd7e3('0x5b')]['From'];_0x177800['body'][_0xd7e3('0x5b')]=_0x100076[_0xd7e3('0x5b')][_0xd7e3('0x81')];_0x177800['body'][_0xd7e3('0x82')]=_0x100076[_0xd7e3('0x5b')][_0xd7e3('0x83')];break;case'skebby':_0x177800[_0xd7e3('0x5b')]['from']='+'+_0x100076['body'][_0xd7e3('0x84')];_0x177800[_0xd7e3('0x5b')][_0xd7e3('0x5b')]=_0x100076[_0xd7e3('0x5b')][_0xd7e3('0x85')];break;case _0xd7e3('0x86'):_0x177800[_0xd7e3('0x5b')][_0xd7e3('0x80')]=_0x100076[_0xd7e3('0x5b')]['from'];_0x177800[_0xd7e3('0x5b')][_0xd7e3('0x5b')]=_0x100076['body']['message'];break;case _0xd7e3('0x87'):_0x177800[_0xd7e3('0x5b')]['from']=_0x100076[_0xd7e3('0x5b')]['from'];_0x177800[_0xd7e3('0x5b')][_0xd7e3('0x5b')]=_0x100076[_0xd7e3('0x5b')][_0xd7e3('0x5b')];_0x177800['body'][_0xd7e3('0x82')]=_0x100076['body'][_0xd7e3('0x88')];break;case _0xd7e3('0x89'):_0x177800[_0xd7e3('0x5b')][_0xd7e3('0x80')]=_0x100076[_0xd7e3('0x5b')][_0xd7e3('0x8a')];_0x177800[_0xd7e3('0x5b')][_0xd7e3('0x5b')]=_0x100076['body'][_0xd7e3('0x8b')];_0x177800[_0xd7e3('0x5b')]['messageId']=_0x100076['body'][_0xd7e3('0x8c')];break;case _0xd7e3('0x8d'):_0x177800['body']['from']='+'+_0x100076[_0xd7e3('0x5b')]['results'][0x0][_0xd7e3('0x80')];_0x177800[_0xd7e3('0x5b')]['body']=_0x100076[_0xd7e3('0x5b')][_0xd7e3('0x8e')][0x0][_0xd7e3('0x85')];_0x177800[_0xd7e3('0x5b')][_0xd7e3('0x82')]=_0x100076[_0xd7e3('0x5b')]['results'][0x0]['messageId'];break;case _0xd7e3('0x8f'):_0x177800[_0xd7e3('0x5b')]['from']=_0x100076[_0xd7e3('0x5b')][_0xd7e3('0x90')];_0x177800[_0xd7e3('0x5b')][_0xd7e3('0x5b')]=_0x100076[_0xd7e3('0x5b')][_0xd7e3('0x91')][_0xd7e3('0x23')];break;case _0xd7e3('0x92'):_0x177800['body']['from']=_0x100076[_0xd7e3('0x5b')]['fromNumber'];_0x177800[_0xd7e3('0x5b')]['body']=_0x100076[_0xd7e3('0x5b')][_0xd7e3('0x85')];_0x177800['body']['messageId']=_0x100076[_0xd7e3('0x5b')][_0xd7e3('0x93')];break;case'bandwidth':_0x177800[_0xd7e3('0x5b')][_0xd7e3('0x82')]=_0x100076[_0xd7e3('0x5b')][0x0]['message']['id'];_0x177800[_0xd7e3('0x5b')][_0xd7e3('0x80')]=_0x100076[_0xd7e3('0x5b')][0x0]['message']['from'];_0x177800['body'][_0xd7e3('0x5b')]=_0x100076[_0xd7e3('0x5b')][0x0][_0xd7e3('0x23')][_0xd7e3('0x85')];break;case _0xd7e3('0x94'):_0x177800[_0xd7e3('0x5b')]['from']=_0x100076[_0xd7e3('0x5b')]['from'];_0x177800[_0xd7e3('0x5b')]['body']=_0x100076['body'][_0xd7e3('0x23')];_0x177800['body'][_0xd7e3('0x82')]=_0x100076['body']['refid'];break;}}if(_0x177800['body']['id']){delete _0x177800[_0xd7e3('0x5b')]['id'];}if(_['isNil'](_0x177800[_0xd7e3('0x5b')][_0xd7e3('0x80')])){throw new db[(_0xd7e3('0x7a'))][(_0xd7e3('0x95'))](_0xd7e3('0x96'));}if(_[_0xd7e3('0x97')](_0x177800[_0xd7e3('0x5b')][_0xd7e3('0x5b')])||_0x177800[_0xd7e3('0x5b')]['body']===''){throw new db[(_0xd7e3('0x7a'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x177800['body'][_0xd7e3('0x98')])){throw new db[(_0xd7e3('0x7a'))][(_0xd7e3('0x95'))](_0xd7e3('0x99')+_0x39c2ad);}if(!_[_0xd7e3('0x9a')](_0x39c2ad,_0x177800[_0xd7e3('0x5b')]['mapKey'])){throw new db[(_0xd7e3('0x7a'))][(_0xd7e3('0x95'))](_0xd7e3('0x9b')+_0x39c2ad);}_0x59df84[_0x177800['body'][_0xd7e3('0x98')]]=_0x177800['body']['from'];return db[_0xd7e3('0x9c')][_0xd7e3('0x59')]({'where':{'id':_0x177800[_0xd7e3('0x77')][_0xd7e3('0x9d')]},'include':[{'model':db[_0xd7e3('0x78')],'as':_0xd7e3('0x9e'),'where':_0x59df84,'limit':0x1,'order':[['updatedAt',_0xd7e3('0x9f')]]}]});})[_0xd7e3('0x34')](handleEntityNotFound(_0x4213bf,null))['then'](function(_0x33d170){if(_0x33d170){_0x177800[_0xd7e3('0xa0')]=_[_0xd7e3('0xa1')](_0x33d170,[_0xd7e3('0x9e')]);if(_0x33d170[_0xd7e3('0x9e')][_0xd7e3('0x49')]){return _0x33d170['Contacts'][0x0];}var _0x38f8ab=_[_0xd7e3('0x17')](_0x177800[_0xd7e3('0x5b')],{'firstName':_0x177800[_0xd7e3('0x5b')][_0xd7e3('0x80')],'ListId':_0x33d170['id']});_0x38f8ab[_0x177800['body'][_0xd7e3('0x98')]]=_0x177800[_0xd7e3('0x5b')][_0xd7e3('0x80')];return db[_0xd7e3('0x78')][_0xd7e3('0x5a')](_0x38f8ab,{'fields':_0xb84b4b,'raw':!![]});}})[_0xd7e3('0x34')](handleEntityNotFound(_0x4213bf,null))[_0xd7e3('0x34')](function(_0x181b8d){if(_0x181b8d){_0x177800[_0xd7e3('0xa2')]=_0x181b8d;var _0x20f163={'ContactId':_0x181b8d['id'],'phone':_0x177800[_0xd7e3('0x5b')][_0xd7e3('0x80')],'SmsAccountId':_0x100076[_0xd7e3('0x55')]['id']};var _0x14dd42={'ContactId':_0x181b8d['id'],'SmsAccountId':_0x100076[_0xd7e3('0x55')]['id'],'closed':![]};return db[_0xd7e3('0xa3')][_0xd7e3('0x59')]({'where':_0x14dd42})[_0xd7e3('0x34')](function(_0x11b490){if(_0x11b490){return[_0x11b490,![]];}return db[_0xd7e3('0xa3')][_0xd7e3('0x5a')](_0x20f163)[_0xd7e3('0x34')](function(_0x263294){return[_0x263294,!![]];});});}})['spread'](function(_0x486080,_0x4a340c){_0x177800[_0xd7e3('0xa4')]=_0x486080['get']({'plain':!![]});_0x177800[_0xd7e3('0xa4')][_0xd7e3('0xa5')]=![];if(_0x4a340c){if(_0x177800[_0xd7e3('0x77')]['autoclose']){_0x177800[_0xd7e3('0x73')][_0xd7e3('0xa6')]({'id':0x0,'priority':_0x177800[_0xd7e3('0x73')][_0xd7e3('0x49')]+0x1,'app':'close','appdata':_0xd7e3('0xa7'),'interval':'*,*,*,*'});}_0x177800[_0xd7e3('0xa4')][_0xd7e3('0xa5')]=!![];}return db[_0xd7e3('0xa8')][_0xd7e3('0x5a')]({'phone':_0x177800[_0xd7e3('0x5b')]['from'],'messageId':_0x177800[_0xd7e3('0x5b')][_0xd7e3('0x82')],'body':_0x177800[_0xd7e3('0x5b')][_0xd7e3('0x5b')],'SmsAccountId':_0x100076[_0xd7e3('0x55')]['id'],'SmsInteractionId':_0x486080['id'],'direction':'in','ContactId':_0x486080['ContactId'],'AttachmentId':_0x177800[_0xd7e3('0x5b')][_0xd7e3('0xa9')]});})[_0xd7e3('0x34')](function(_0x11e1bf){_0x177800['message']=_0x11e1bf;if(_0x177800['interaction']['UserId']){return db[_0xd7e3('0xaa')][_0xd7e3('0x59')]({'attributes':['id',_0xd7e3('0x3b')],'where':{'id':_0x177800[_0xd7e3('0xa4')][_0xd7e3('0xab')]}})[_0xd7e3('0x34')](function(_0x3fe11e){if(_0x3fe11e){_0x177800[_0xd7e3('0x73')][_0xd7e3('0xac')]({'id':0x0,'priority':0x0,'app':_0xd7e3('0xad'),'appdata':_0x3fe11e[_0xd7e3('0x3b')]+','+(_0x177800[_0xd7e3('0x77')][_0xd7e3('0xae')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0xd7e3('0xaf'),_0x177800);});}return respondWithRpcPromise('Start','startRouting',_0x177800);})['then'](function(_0x399aaa){if(_0x399aaa){var _0x1bc467=0xc8;var _0x537715=_0xd7e3('0xb0');logger[_0xd7e3('0x1d')](_0xd7e3('0x1f'),_0x537715,_0x1bc467,_0xd7e3('0xb1'));logger[_0xd7e3('0x1e')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x537715,_0x1bc467,_0xd7e3('0xb1'),JSON[_0xd7e3('0x21')](_0x399aaa));if(_0x177800['account'][_0xd7e3('0x40')]==='twilio'){return _0x4213bf['status'](_0x1bc467)['set'](_0xd7e3('0xb2'),_0xd7e3('0xb3'))[_0xd7e3('0xb4')](_0xd7e3('0xb5'));}else{return _0x4213bf['status'](_0x1bc467)[_0xd7e3('0x29')](_0x399aaa);}}})[_0xd7e3('0x26')](handleError(_0x4213bf,null));};exports[_0xd7e3('0xb6')]=function(_0x63be0e,_0x498113,_0x8ae3cd){return db[_0xd7e3('0x3e')][_0xd7e3('0x66')]({'where':{'id':_0x63be0e[_0xd7e3('0x55')]['id']}})[_0xd7e3('0x34')](handleEntityNotFound(_0x498113,null))[_0xd7e3('0x34')](function(_0x23cdbb){if(_0x23cdbb){return db['sequelize']['transaction'](function(_0x15168f){return db['SmsApplication'][_0xd7e3('0x38')]({'where':{'SmsAccountId':_0x63be0e[_0xd7e3('0x55')]['id']},'transaction':_0x15168f})[_0xd7e3('0x34')](function(_0xfc9744){var _0x2ada0e=_[_0xd7e3('0x43')](_0x63be0e[_0xd7e3('0x5b')],function(_0x1890c7){_0x1890c7[_0xd7e3('0x63')]=_0x63be0e[_0xd7e3('0x55')]['id'];return _0x1890c7;});return db[_0xd7e3('0x71')][_0xd7e3('0xb7')](_0x2ada0e,{'transaction':_0x15168f});});})[_0xd7e3('0x34')](function(){return db['SmsApplication'][_0xd7e3('0xb8')]({'where':{'SmsAccountId':_0x63be0e['params']['id']},'order':'priority'});});}})[_0xd7e3('0x34')](respondWithResult(_0x498113,null))['catch'](handleError(_0x498113,null));};exports[_0xd7e3('0xb9')]=function(_0x57b65e,_0x5ca958,_0x5a8c88){var _0x16018a={};var _0x328916={};var _0x269b44;var _0x1dee7b;return db[_0xd7e3('0x3e')][_0xd7e3('0x66')]({'where':{'id':_0x57b65e[_0xd7e3('0x55')]['id']}})['then'](handleEntityNotFound(_0x5ca958,null))[_0xd7e3('0x34')](function(_0x1ebe66){if(_0x1ebe66){_0x269b44=_0x1ebe66;_0x328916[_0xd7e3('0x42')]=_[_0xd7e3('0x45')](db[_0xd7e3('0x71')]['rawAttributes']);_0x328916[_0xd7e3('0x44')]=_[_0xd7e3('0x45')](_0x57b65e[_0xd7e3('0x44')]);_0x328916[_0xd7e3('0x46')]=_[_0xd7e3('0x47')](_0x328916['model'],_0x328916[_0xd7e3('0x44')]);_0x16018a[_0xd7e3('0x48')]=_['intersection'](_0x328916[_0xd7e3('0x42')],qs[_0xd7e3('0x57')](_0x57b65e[_0xd7e3('0x44')][_0xd7e3('0x57')]));_0x16018a['attributes']=_0x16018a[_0xd7e3('0x48')][_0xd7e3('0x49')]?_0x16018a[_0xd7e3('0x48')]:_0x328916[_0xd7e3('0x42')];_0x16018a[_0xd7e3('0x67')]=qs['sort'](_0x57b65e[_0xd7e3('0x44')][_0xd7e3('0x4c')]);_0x16018a['where']=qs['filters'](_[_0xd7e3('0x4e')](_0x57b65e[_0xd7e3('0x44')],_0x328916['filters']));if(_0x57b65e['query'][_0xd7e3('0x4f')]){_0x16018a['where']=_[_0xd7e3('0x50')](_0x16018a['where'],{'$or':_[_0xd7e3('0x43')](_0x16018a[_0xd7e3('0x48')],function(_0x14b62a){var _0x2e5461={};_0x2e5461[_0x14b62a]={'$like':'%'+_0x57b65e[_0xd7e3('0x44')][_0xd7e3('0x4f')]+'%'};return _0x2e5461;})});}_0x16018a=_[_0xd7e3('0x50')]({},_0x16018a,_0x57b65e[_0xd7e3('0x52')]);return _0x269b44[_0xd7e3('0xb9')](_0x16018a);}})['then'](function(_0x3d3415){if(_0x3d3415){_0x1dee7b=_0x3d3415[_0xd7e3('0x49')];if(!_0x57b65e[_0xd7e3('0x44')]['hasOwnProperty'](_0xd7e3('0x4b'))){_0x16018a[_0xd7e3('0x2d')]=qs[_0xd7e3('0x2d')](_0x57b65e['query']['limit']);_0x16018a[_0xd7e3('0x2a')]=qs[_0xd7e3('0x2a')](_0x57b65e[_0xd7e3('0x44')][_0xd7e3('0x2a')]);}return _0x269b44['getApplications'](_0x16018a);}})[_0xd7e3('0x34')](function(_0x42a6ac){if(_0x42a6ac){return _0x42a6ac?{'count':_0x1dee7b,'rows':_0x42a6ac}:null;}})[_0xd7e3('0x34')](respondWithResult(_0x5ca958,null))['catch'](handleError(_0x5ca958,null));};exports[_0xd7e3('0xba')]=function(_0x11aa7c,_0x2a5b0e,_0x3d064d){var _0x26e150={'raw':![],'where':{}};var _0x1d752f={};var _0x372ac0={'count':0x0,'rows':[]};return db[_0xd7e3('0x3e')][_0xd7e3('0x66')]({'where':{'id':_0x11aa7c[_0xd7e3('0x55')]['id']}})['then'](handleEntityNotFound(_0x2a5b0e,null))[_0xd7e3('0x34')](function(_0x25ea35){if(_0x25ea35){_0x1d752f[_0xd7e3('0x42')]=_[_0xd7e3('0x45')](db[_0xd7e3('0xa3')][_0xd7e3('0x3f')]);_0x1d752f[_0xd7e3('0x44')]=_[_0xd7e3('0x45')](_0x11aa7c['query']);_0x1d752f[_0xd7e3('0x46')]=_[_0xd7e3('0x47')](_0x1d752f['model'],_0x1d752f['query']);_0x26e150['attributes']=_['intersection'](_0x1d752f[_0xd7e3('0x42')],qs[_0xd7e3('0x57')](_0x11aa7c[_0xd7e3('0x44')][_0xd7e3('0x57')]));_0x26e150[_0xd7e3('0x48')]=_0x26e150['attributes']['length']?_0x26e150[_0xd7e3('0x48')]:_0x1d752f[_0xd7e3('0x42')];if(!_0x11aa7c[_0xd7e3('0x44')]['hasOwnProperty'](_0xd7e3('0x4b'))){_0x26e150[_0xd7e3('0x2d')]=qs['limit'](_0x11aa7c[_0xd7e3('0x44')][_0xd7e3('0x2d')]);_0x26e150[_0xd7e3('0x2a')]=qs['offset'](_0x11aa7c[_0xd7e3('0x44')][_0xd7e3('0x2a')]);}_0x26e150[_0xd7e3('0x67')]=qs['sort'](_0x11aa7c[_0xd7e3('0x44')]['sort']);_0x26e150[_0xd7e3('0x4d')]=qs['filters'](_[_0xd7e3('0x4e')](_0x11aa7c[_0xd7e3('0x44')],_0x1d752f[_0xd7e3('0x46')]));_0x26e150[_0xd7e3('0x4d')][_0xd7e3('0x63')]=_0x25ea35['id'];if(_0x11aa7c['query'][_0xd7e3('0x4f')]){_0x26e150[_0xd7e3('0x4d')]=_[_0xd7e3('0x50')](_0x26e150[_0xd7e3('0x4d')],{'$or':_[_0xd7e3('0x43')](_0x26e150['attributes'],function(_0x4c3ac9){var _0x2ba877={};_0x2ba877[_0x4c3ac9]={'$like':'%'+_0x11aa7c[_0xd7e3('0x44')]['filter']+'%'};return _0x2ba877;})});}_0x26e150=_[_0xd7e3('0x50')]({},_0x26e150,_0x11aa7c[_0xd7e3('0x52')]);return db[_0xd7e3('0xa3')]['count']({'where':_0x26e150[_0xd7e3('0x4d')]})[_0xd7e3('0x34')](function(_0xa5fdbb){_0x372ac0[_0xd7e3('0x2c')]=_0xa5fdbb;if(_0x11aa7c[_0xd7e3('0x44')]['includeAll']){_0x26e150[_0xd7e3('0x58')]=[{'model':db[_0xd7e3('0x78')],'as':_0xd7e3('0xbb'),'required':![]},{'model':db['User'],'as':_0xd7e3('0xbc'),'attributes':[_0xd7e3('0x3b'),'fullname','internal'],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0xd7e3('0x3b'),'color'],'where':_0x11aa7c[_0xd7e3('0x44')][_0xd7e3('0xbd')]?{'id':_0x11aa7c['query'][_0xd7e3('0xbd')]}:undefined,'required':_0x11aa7c[_0xd7e3('0x44')]['tag']?!![]:![]}];}return db[_0xd7e3('0xa3')][_0xd7e3('0x68')](_0x26e150);})[_0xd7e3('0x34')](function(_0x55501c){_0x372ac0[_0xd7e3('0x54')]=_0x55501c;return _0x372ac0;});}})[_0xd7e3('0x34')](respondWithFilteredResult(_0x2a5b0e,_0x26e150))[_0xd7e3('0x26')](handleError(_0x2a5b0e,null));};exports[_0xd7e3('0xb4')]=function(_0x1cbfeb,_0x99553,_0x231676){var _0x356223,_0x580d8f,_0x30f3c5;if(_[_0xd7e3('0x97')](_0x1cbfeb[_0xd7e3('0x5b')][_0xd7e3('0x5b')])||_0x1cbfeb[_0xd7e3('0x5b')]['body']===''){throw new db[(_0xd7e3('0x7a'))][(_0xd7e3('0x95'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x1cbfeb[_0xd7e3('0x5b')]['to'])){throw new db[(_0xd7e3('0x7a'))][(_0xd7e3('0x95'))](_0xd7e3('0xbe'));}_0x356223=_0x1cbfeb[_0xd7e3('0x5b')]['to'];return db['SmsAccount'][_0xd7e3('0x59')]({'where':{'id':_0x1cbfeb[_0xd7e3('0x55')]['id']},'include':[{'model':db[_0xd7e3('0x9c')],'as':'List','include':[{'model':db[_0xd7e3('0x78')],'as':_0xd7e3('0x9e'),'where':{'mobile':_0x356223},'limit':0x1,'order':[['updatedAt',_0xd7e3('0x9f')]]}]}]})[_0xd7e3('0x34')](handleEntityNotFound(_0x99553,null))[_0xd7e3('0x34')](function(_0x412f26){if(_0x412f26&&_0x412f26[_0xd7e3('0xbf')]){_0x580d8f=_0x412f26[_0xd7e3('0x35')]({'plain':!![]});if(_0x580d8f['List']&&_0x580d8f[_0xd7e3('0xbf')][_0xd7e3('0x9e')][_0xd7e3('0x49')]){return _0x580d8f[_0xd7e3('0xbf')][_0xd7e3('0x9e')][0x0];}return db['CmContact'][_0xd7e3('0x5a')](_[_0xd7e3('0x17')](_0x1cbfeb[_0xd7e3('0x5b')],{'firstName':_0x356223,'mobile':_0x356223,'phone':_0x356223,'ListId':_0x580d8f['ListId']}));}})[_0xd7e3('0x34')](handleEntityNotFound(_0x99553,null))['then'](function(_0x369a39){if(_0x369a39){_0x30f3c5=_0x369a39;return db[_0xd7e3('0xa3')][_0xd7e3('0x59')]({'where':{'ContactId':_0x30f3c5['id'],'closed':![],'SmsAccountId':_0x580d8f['id']}})[_0xd7e3('0x34')](function(_0xa34809){if(_0xa34809){return[_0xa34809,![]];}return db['SmsInteraction'][_0xd7e3('0x5a')]({'UserId':_0x1cbfeb[_0xd7e3('0x5c')]['id'],'ContactId':_0x30f3c5['id'],'SmsAccountId':_0x580d8f['id'],'phone':_0x356223,'firstMsgDirection':_0xd7e3('0xc0'),'Messages':[_['merge'](_0x1cbfeb[_0xd7e3('0x5b')],{'read':![],'body':_0x1cbfeb['body']['body'],'phone':_0x356223,'SmsAccountId':_0x580d8f['id'],'UserId':_0x1cbfeb[_0xd7e3('0x5c')]['id'],'ContactId':_0x30f3c5['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0xd7e3('0xc1')}]})[_0xd7e3('0x34')](function(_0x4fa0d9){return[_0x4fa0d9,!![]];});});}})['spread'](function(_0x1720e9,_0x34ca05){if(_0x34ca05){return _0x1720e9;}return db[_0xd7e3('0xa8')][_0xd7e3('0x5a')](_[_0xd7e3('0x50')](_0x1cbfeb[_0xd7e3('0x5b')],{'read':![],'body':_0x1cbfeb[_0xd7e3('0x5b')][_0xd7e3('0x5b')],'phone':_0x356223,'SmsAccountId':_0x580d8f['id'],'SmsInteractionId':_0x1720e9['id'],'UserId':_0x1cbfeb[_0xd7e3('0x5c')]['id'],'ContactId':_0x30f3c5['id']}))[_0xd7e3('0x34')](function(_0x28eedb){_0x1720e9[_0xd7e3('0xc2')][_0xd7e3('0xc1')]=[];_0x1720e9[_0xd7e3('0xc2')]['Messages']['push'](_0x28eedb[_0xd7e3('0xc2')]);return _0x1720e9;});})[_0xd7e3('0x34')](respondWithResult(_0x99553,null))[_0xd7e3('0x26')](handleError(_0x99553,null));};exports['status']=function(_0x5cae7c,_0x50ad72,_0x592341){if(_0x5cae7c[_0xd7e3('0x5b')]['id']){delete _0x5cae7c[_0xd7e3('0x5b')]['id'];}var _0x5bd1ef,_0x4418df,_0x10aa0b;return db[_0xd7e3('0x3e')][_0xd7e3('0x59')]({'where':{'id':_0x5cae7c['params']['id']}})[_0xd7e3('0x34')](handleEntityNotFound(_0x50ad72,null))[_0xd7e3('0x34')](function(_0x31a51d){if(_0x31a51d){_0x10aa0b=_0x31a51d;logger[_0xd7e3('0x1e')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xd7e3('0x27'),'received\x20delivery\x20report\x20from',_0x31a51d['type'],util[_0xd7e3('0xc3')](_0x5cae7c[_0xd7e3('0x5b')],{'showHidden':![],'depth':null}));switch(_0x31a51d[_0xd7e3('0x40')]){case _0xd7e3('0xc4'):if(_0x5cae7c[_0xd7e3('0x5b')][_0xd7e3('0xc5')]&&_0x5cae7c[_0xd7e3('0x5b')][_0xd7e3('0x27')]){_0x4418df=_0x5cae7c[_0xd7e3('0x5b')][_0xd7e3('0x27')];return db[_0xd7e3('0xa8')][_0xd7e3('0x59')]({'where':{'messageId':_0x5cae7c[_0xd7e3('0x5b')]['skebby_dispatch_id']}});}break;case'connectel':if(_0x5cae7c[_0xd7e3('0x5b')][_0xd7e3('0xc6')]&&_0x5cae7c[_0xd7e3('0x5b')][_0xd7e3('0xc7')]){_0x4418df=_0x5cae7c[_0xd7e3('0x5b')][_0xd7e3('0xc7')];return db['SmsMessage'][_0xd7e3('0x59')]({'where':{'messageId':_0x5cae7c[_0xd7e3('0x5b')][_0xd7e3('0xc6')]}});}break;case _0xd7e3('0x87'):if(_0x5cae7c[_0xd7e3('0x5b')][_0xd7e3('0x88')]&&_0x5cae7c[_0xd7e3('0x5b')][_0xd7e3('0xc8')]){_0x4418df=_0x5cae7c[_0xd7e3('0x5b')][_0xd7e3('0xc8')];return db['SmsMessage'][_0xd7e3('0x59')]({'where':{'messageId':_0x5cae7c[_0xd7e3('0x5b')][_0xd7e3('0x88')]}});}break;case _0xd7e3('0x8d'):var _0x5a4306=_0x5cae7c['body'][_0xd7e3('0x8e')][0x0];if(_0x5a4306['messageId']&&_0x5a4306[_0xd7e3('0x27')][_0xd7e3('0xc9')]===_0xd7e3('0xca')){_0x4418df=_0x5a4306[_0xd7e3('0x27')]['groupName'];return db[_0xd7e3('0xa8')][_0xd7e3('0x59')]({'where':{'messageId':_0x5a4306[_0xd7e3('0x82')]}});}break;case _0xd7e3('0x92'):if(_0x5cae7c['body'][_0xd7e3('0x82')]&&_0x5cae7c[_0xd7e3('0x5b')][_0xd7e3('0x27')]){_0x4418df=_0x5cae7c['body'][_0xd7e3('0x27')];return db['SmsMessage']['find']({'where':{'messageId':_0x5cae7c[_0xd7e3('0x5b')][_0xd7e3('0x82')]}});}break;case'bandwidth':if(_0x5cae7c[_0xd7e3('0x5b')][0x0]['message']['id']){_0x4418df=_0x5cae7c['body'][0x0]['type'];return db[_0xd7e3('0xa8')][_0xd7e3('0x59')]({'where':{'messageId':_0x5cae7c[_0xd7e3('0x5b')][0x0][_0xd7e3('0x23')]['id']}});}break;case _0xd7e3('0x94'):if(_0x5cae7c['body'][_0xd7e3('0xcb')]&&_0x5cae7c[_0xd7e3('0x5b')][_0xd7e3('0x27')]){_0x4418df=_0x5cae7c[_0xd7e3('0x5b')][_0xd7e3('0x27')];return db[_0xd7e3('0xa8')][_0xd7e3('0x59')]({'where':{'messageId':_0x5cae7c[_0xd7e3('0x5b')][_0xd7e3('0xcb')]}});}break;}}})['then'](handleEntityNotFound(_0x50ad72,null))['then'](function(_0x24b673){if(_0x24b673){_0x5bd1ef=_0x24b673;switch(_0x10aa0b[_0xd7e3('0x40')]){case'skebby':if(_0x4418df===_0xd7e3('0xca')){return _0x5bd1ef['update']({'read':!![]});}else{logger['error'](_0xd7e3('0x1f'),_0xd7e3('0x27'),_0xd7e3('0xc4'),util[_0xd7e3('0xc3')](_0x5cae7c[_0xd7e3('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xd7e3('0x86'):if(_0x4418df==='1'){return _0x5bd1ef[_0xd7e3('0x33')]({'read':!![]});}else{logger[_0xd7e3('0x22')](_0xd7e3('0x1f'),_0xd7e3('0x27'),_0xd7e3('0xc4'),util[_0xd7e3('0xc3')](_0x5cae7c[_0xd7e3('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xd7e3('0x87'):if(!_0x5cae7c['body'][_0xd7e3('0xcc')]&&_0x4418df>=0xc8&&_0x4418df<=0xce){return _0x5bd1ef['update']({'read':!![]});}else{logger['error'](_0xd7e3('0x1f'),_0xd7e3('0x27'),_0xd7e3('0x87'),util[_0xd7e3('0xc3')](_0x5cae7c[_0xd7e3('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xd7e3('0x8d'):var _0x2ae58b=_0x5cae7c[_0xd7e3('0x5b')]['results'][0x0];if(_0x2ae58b[_0xd7e3('0x27')][_0xd7e3('0xc9')]===_0xd7e3('0xca')){return _0x5bd1ef[_0xd7e3('0x33')]({'read':!![]});}else{logger[_0xd7e3('0x22')](_0xd7e3('0x1f'),_0xd7e3('0x27'),'infobip',util[_0xd7e3('0xc3')](_0x5cae7c[_0xd7e3('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xd7e3('0x92'):if(_0x4418df=='DELIVERED_TO_GATEWAY'||_0x4418df==_0xd7e3('0xcd')){return _0x5bd1ef[_0xd7e3('0x33')]({'read':!![]});}else{logger[_0xd7e3('0x22')](_0xd7e3('0x1f'),_0xd7e3('0x27'),_0xd7e3('0x92'),util[_0xd7e3('0xc3')](_0x5cae7c[_0xd7e3('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xd7e3('0xce'):if(_0x4418df==_0xd7e3('0xcf')){return _0x5bd1ef['update']({'read':!![]});}else{logger[_0xd7e3('0x22')](_0xd7e3('0x1f'),'status',_0xd7e3('0xce'),util[_0xd7e3('0xc3')](_0x5cae7c[_0xd7e3('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xd7e3('0x94'):if(_0x4418df===_0xd7e3('0xd0')||_0x4418df===_0xd7e3('0xd1')){return _0x5bd1ef[_0xd7e3('0x33')]({'read':!![]});}else{logger[_0xd7e3('0x22')](_0xd7e3('0x1f'),_0xd7e3('0x27'),_0xd7e3('0x94'),util[_0xd7e3('0xc3')](_0x5cae7c[_0xd7e3('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x5bd1ef;}})['then'](respondWithResult(_0x50ad72,null))[_0xd7e3('0x26')](handleError(_0x50ad72,null));};exports[_0xd7e3('0xd2')]=function(_0x253122,_0x20900a,_0x299a4c){var _0x58cf95,_0xf56ce1,_0x4b8b84;return db[_0xd7e3('0x3e')][_0xd7e3('0x59')]({'where':{'id':_0x253122[_0xd7e3('0x55')]['id']}})[_0xd7e3('0x34')](handleEntityNotFound(_0x20900a,null))[_0xd7e3('0x34')](function(_0x11a484){if(_0x11a484){_0x4b8b84=_0x11a484;logger[_0xd7e3('0x1e')](_0xd7e3('0x1f'),_0xd7e3('0x27'),_0xd7e3('0xd3'),_0x11a484[_0xd7e3('0x40')],util[_0xd7e3('0xc3')](_0x253122['query'],{'showHidden':![],'depth':null}));switch(_0x11a484[_0xd7e3('0x40')]){case'csc':if(_0x253122[_0xd7e3('0x44')]['message-id']&&_0x253122[_0xd7e3('0x44')]['state']){_0xf56ce1=_0x253122[_0xd7e3('0x44')][_0xd7e3('0xd4')];return db['SmsMessage'][_0xd7e3('0x59')]({'where':{'messageId':_0x253122[_0xd7e3('0x44')][_0xd7e3('0xd5')]}});}break;}}})[_0xd7e3('0x34')](handleEntityNotFound(_0x20900a,null))[_0xd7e3('0x34')](function(_0xb008f6){if(_0xb008f6){_0x58cf95=_0xb008f6;switch(_0x4b8b84[_0xd7e3('0x40')]){case'csc':if(_0xf56ce1==='2'||_0xf56ce1==='6'){return _0x58cf95['update']({'read':!![]});}else{logger[_0xd7e3('0x22')](_0xd7e3('0x1f'),_0xd7e3('0x27'),_0xd7e3('0x8f'),util['inspect'](_0x253122['query'],{'showHidden':![],'depth':null}));};break;}return _0x58cf95;}})['then'](respondWithResult(_0x20900a,null))[_0xd7e3('0x26')](handleError(_0x20900a,null));};exports['addAgents']=function(_0x5ac8ce,_0xe2f306,_0x59264b){return db[_0xd7e3('0x3e')][_0xd7e3('0x59')]({'where':{'id':_0x5ac8ce[_0xd7e3('0x55')]['id']}})[_0xd7e3('0x34')](handleEntityNotFound(_0xe2f306,null))[_0xd7e3('0x34')](function(_0x2ed409){if(_0x2ed409){return _0x2ed409['addAgents'](_0x5ac8ce[_0xd7e3('0x5b')][_0xd7e3('0x6a')],_[_0xd7e3('0xa1')](_0x5ac8ce[_0xd7e3('0x5b')],[_0xd7e3('0x6a'),'id'])||{})[_0xd7e3('0xd6')](function(_0x536d47){for(var _0x539d60=0x0;_0x539d60<_0x5ac8ce[_0xd7e3('0x5b')][_0xd7e3('0x6a')][_0xd7e3('0x49')];_0x539d60+=0x1){socket['emit'](_0xd7e3('0xd7'),{'UserId':Number(_0x5ac8ce[_0xd7e3('0x5b')][_0xd7e3('0x6a')][_0x539d60]),'SmsAccountId':Number(_0x5ac8ce[_0xd7e3('0x55')]['id'])});}return _0x536d47;});}})[_0xd7e3('0x34')](respondWithResult(_0xe2f306,null))['catch'](handleError(_0xe2f306,null));};exports[_0xd7e3('0xd8')]=function(_0x5a4031,_0x325d16,_0x2fdee5){return db[_0xd7e3('0x3e')]['find']({'where':{'id':_0x5a4031['params']['id']}})[_0xd7e3('0x34')](handleEntityNotFound(_0x325d16,null))[_0xd7e3('0x34')](function(_0x33fbe2){if(_0x33fbe2){return _0x33fbe2[_0xd7e3('0xd8')](_0x5a4031[_0xd7e3('0x44')]['ids'])[_0xd7e3('0x34')](function(){if(_[_0xd7e3('0xd9')](_0x5a4031[_0xd7e3('0x44')][_0xd7e3('0x6a')])){for(var _0x24a434=0x0;_0x24a434<_0x5a4031[_0xd7e3('0x44')]['ids'][_0xd7e3('0x49')];_0x24a434+=0x1){socket[_0xd7e3('0xda')](_0xd7e3('0xdb'),{'UserId':Number(_0x5a4031[_0xd7e3('0x44')][_0xd7e3('0x6a')][_0x24a434]),'SmsAccountId':Number(_0x5a4031[_0xd7e3('0x55')]['id'])});}}else{socket['emit'](_0xd7e3('0xdb'),{'UserId':Number(_0x5a4031['query']['ids']),'SmsAccountId':Number(_0x5a4031[_0xd7e3('0x55')]['id'])});}});}})[_0xd7e3('0x34')](respondWithStatusCode(_0x325d16,null))[_0xd7e3('0x26')](handleError(_0x325d16,null));};exports['getAgents']=function(_0x3a0e1e,_0x1f7238,_0x446f5e){var _0x1b937f={};var _0x2a0dc2={};var _0x4bf171;var _0x21bf90;return db[_0xd7e3('0x3e')][_0xd7e3('0x66')]({'where':{'id':_0x3a0e1e[_0xd7e3('0x55')]['id']}})['then'](handleEntityNotFound(_0x1f7238,null))[_0xd7e3('0x34')](function(_0x107cf9){if(_0x107cf9){_0x4bf171=_0x107cf9;_0x2a0dc2['model']=_[_0xd7e3('0x45')](db['User']['rawAttributes']);_0x2a0dc2['query']=_[_0xd7e3('0x45')](_0x3a0e1e['query']);_0x2a0dc2[_0xd7e3('0x46')]=_[_0xd7e3('0x47')](_0x2a0dc2[_0xd7e3('0x42')],_0x2a0dc2[_0xd7e3('0x44')]);_0x1b937f[_0xd7e3('0x48')]=_[_0xd7e3('0x47')](_0x2a0dc2[_0xd7e3('0x42')],qs[_0xd7e3('0x57')](_0x3a0e1e[_0xd7e3('0x44')][_0xd7e3('0x57')]));_0x1b937f['attributes']=_0x1b937f[_0xd7e3('0x48')][_0xd7e3('0x49')]?_0x1b937f[_0xd7e3('0x48')]:_0x2a0dc2[_0xd7e3('0x42')];_0x1b937f[_0xd7e3('0x67')]=qs[_0xd7e3('0x4c')](_0x3a0e1e[_0xd7e3('0x44')][_0xd7e3('0x4c')]);_0x1b937f['where']=qs[_0xd7e3('0x46')](_[_0xd7e3('0x4e')](_0x3a0e1e[_0xd7e3('0x44')],_0x2a0dc2[_0xd7e3('0x46')]));if(_0x3a0e1e['query']['filter']){_0x1b937f[_0xd7e3('0x4d')]=_['merge'](_0x1b937f[_0xd7e3('0x4d')],{'$or':_['map'](_0x1b937f[_0xd7e3('0x48')],function(_0x28521c){var _0x4fd541={};_0x4fd541[_0x28521c]={'$like':'%'+_0x3a0e1e['query']['filter']+'%'};return _0x4fd541;})});}_0x1b937f=_[_0xd7e3('0x50')]({},_0x1b937f,_0x3a0e1e[_0xd7e3('0x52')]);return _0x4bf171[_0xd7e3('0xdc')](_0x1b937f);}})[_0xd7e3('0x34')](function(_0x15a681){if(_0x15a681){_0x21bf90=_0x15a681['length'];if(!_0x3a0e1e[_0xd7e3('0x44')][_0xd7e3('0x4a')]('nolimit')){_0x1b937f['limit']=qs[_0xd7e3('0x2d')](_0x3a0e1e[_0xd7e3('0x44')]['limit']);_0x1b937f[_0xd7e3('0x2a')]=qs['offset'](_0x3a0e1e[_0xd7e3('0x44')]['offset']);}return _0x4bf171[_0xd7e3('0xdc')](_0x1b937f);}})['then'](function(_0x1c3d12){if(_0x1c3d12){return _0x1c3d12?{'count':_0x21bf90,'rows':_0x1c3d12}:null;}})[_0xd7e3('0x34')](respondWithResult(_0x1f7238,null))[_0xd7e3('0x26')](handleError(_0x1f7238,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 97877fd..fa2039a 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 _0x1288=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','SmsAccount','setMaxListeners','save','update'];(function(_0x2d3bed,_0x17a9e9){var _0x2ce190=function(_0x287818){while(--_0x287818){_0x2d3bed['push'](_0x2d3bed['shift']());}};_0x2ce190(++_0x17a9e9);}(_0x1288,0x73));var _0x8128=function(_0x1fd5f5,_0x36b4ec){_0x1fd5f5=_0x1fd5f5-0x0;var _0x3f2e69=_0x1288[_0x1fd5f5];return _0x3f2e69;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0x8128('0x0'))['db'][_0x8128('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x8128('0x2')](0x0);var events={'afterCreate':_0x8128('0x3'),'afterUpdate':_0x8128('0x4'),'afterDestroy':_0x8128('0x5')};function emitEvent(_0x354a5e){return function(_0x2cd26b,_0x558772,_0x4ccc4e){SmsAccountEvents[_0x8128('0x6')](_0x354a5e+':'+_0x2cd26b['id'],_0x2cd26b);SmsAccountEvents[_0x8128('0x6')](_0x354a5e,_0x2cd26b);_0x4ccc4e(null);};}for(var e in events){if(events[_0x8128('0x7')](e)){var event=events[e];SmsAccount[_0x8128('0x8')](e,emitEvent(event));}}module[_0x8128('0x9')]=SmsAccountEvents; \ No newline at end of file +var _0x0e92=['save','update','remove','emit','hook','../../mysqldb','setMaxListeners'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0e92,0x194));var _0x20e9=function(_0x31c736,_0x1dd1ac){_0x31c736=_0x31c736-0x0;var _0x3e2e1b=_0x0e92[_0x31c736];return _0x3e2e1b;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0x20e9('0x0'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x20e9('0x1')](0x0);var events={'afterCreate':_0x20e9('0x2'),'afterUpdate':_0x20e9('0x3'),'afterDestroy':_0x20e9('0x4')};function emitEvent(_0x49a52f){return function(_0x2c201f,_0x43b518,_0x4c9249){SmsAccountEvents['emit'](_0x49a52f+':'+_0x2c201f['id'],_0x2c201f);SmsAccountEvents[_0x20e9('0x5')](_0x49a52f,_0x2c201f);_0x4c9249(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x20e9('0x6')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 26404b1..18fb615 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 _0x280b=['lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./smsAccount.attributes','exports','define','SmsAccount'];(function(_0x359509,_0x5ed98e){var _0x37f077=function(_0x2b952b){while(--_0x2b952b){_0x359509['push'](_0x359509['shift']());}};_0x37f077(++_0x5ed98e);}(_0x280b,0xd8));var _0xb280=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x280b[_0x432682];return _0x463d05;};'use strict';var _=require(_0xb280('0x0'));var util=require(_0xb280('0x1'));var logger=require(_0xb280('0x2'))('api');var moment=require(_0xb280('0x3'));var BPromise=require(_0xb280('0x4'));var rp=require(_0xb280('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb280('0x6'));var config=require(_0xb280('0x7'));var attributes=require(_0xb280('0x8'));module[_0xb280('0x9')]=function(_0x4ed2c1,_0x334cb8){return _0x4ed2c1[_0xb280('0xa')](_0xb280('0xb'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x213d=['../../config/environment','./smsAccount.attributes','sms_accounts','lodash','util','../../config/logger','request-promise','path','rimraf'];(function(_0x5cc484,_0x32965f){var _0x5305ab=function(_0x173c10){while(--_0x173c10){_0x5cc484['push'](_0x5cc484['shift']());}};_0x5305ab(++_0x32965f);}(_0x213d,0x1bc));var _0xd213=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x213d[_0x4709c0];return _0x13348b;};'use strict';var _=require(_0xd213('0x0'));var util=require(_0xd213('0x1'));var logger=require(_0xd213('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd213('0x3'));var fs=require('fs');var path=require(_0xd213('0x4'));var rimraf=require(_0xd213('0x5'));var config=require(_0xd213('0x6'));var attributes=require(_0xd213('0x7'));module['exports']=function(_0x4ddf28,_0x44e619){return _0x4ddf28['define']('SmsAccount',attributes,{'tableName':_0xd213('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 49172b4..b1c36c2 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 _0x9945=['SmsAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsAccount.socket','register','request','then','info'];(function(_0x24f9b7,_0x36d18e){var _0x688f12=function(_0x14426a){while(--_0x14426a){_0x24f9b7['push'](_0x24f9b7['shift']());}};_0x688f12(++_0x36d18e);}(_0x9945,0xd0));var _0x5994=function(_0x12ad22,_0x20c52d){_0x12ad22=_0x12ad22-0x0;var _0x4962eb=_0x9945[_0x12ad22];return _0x4962eb;};'use strict';var _=require(_0x5994('0x0'));var util=require(_0x5994('0x1'));var moment=require(_0x5994('0x2'));var BPromise=require(_0x5994('0x3'));var rs=require(_0x5994('0x4'));var fs=require('fs');var Redis=require(_0x5994('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5994('0x6'));var logger=require(_0x5994('0x7'))('rpc');var config=require(_0x5994('0x8'));var jayson=require(_0x5994('0x9'));var client=jayson[_0x5994('0xa')][_0x5994('0xb')]({'port':0x232a});config[_0x5994('0xc')]=_[_0x5994('0xd')](config[_0x5994('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x5994('0xe'))(new Redis(config[_0x5994('0xc')]));require(_0x5994('0xf'))[_0x5994('0x10')](socket);function respondWithRpcPromise(_0x223484,_0x415194,_0x14038d){return new BPromise(function(_0x3b5b9d,_0x5c03b4){return client[_0x5994('0x11')](_0x223484,_0x14038d)[_0x5994('0x12')](function(_0x467012){logger[_0x5994('0x13')](_0x5994('0x14'),_0x415194,'request\x20sent');logger[_0x5994('0x15')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x415194,_0x5994('0x16'),JSON[_0x5994('0x17')](_0x467012));if(_0x467012[_0x5994('0x18')]){if(_0x467012['error'][_0x5994('0x19')]===0x1f4){logger[_0x5994('0x18')](_0x5994('0x14'),_0x415194,_0x467012[_0x5994('0x18')][_0x5994('0x1a')]);return _0x5c03b4(_0x467012[_0x5994('0x18')][_0x5994('0x1a')]);}logger[_0x5994('0x18')](_0x5994('0x14'),_0x415194,_0x467012['error']['message']);return _0x3b5b9d(_0x467012[_0x5994('0x18')][_0x5994('0x1a')]);}else{logger[_0x5994('0x13')](_0x5994('0x14'),_0x415194,_0x5994('0x16'));_0x3b5b9d(_0x467012['result'][_0x5994('0x1a')]);}})[_0x5994('0x1b')](function(_0x35f7fe){logger['error'](_0x5994('0x14'),_0x415194,_0x35f7fe);_0x5c03b4(_0x35f7fe);});});}exports[_0x5994('0x1c')]=function(_0x3f455b){var _0x24bf53=this;return new Promise(function(_0x14f3be,_0x70eb8c){return db[_0x5994('0x1d')][_0x5994('0x1e')]({'raw':_0x3f455b[_0x5994('0x1f')]?_0x3f455b['options'][_0x5994('0x20')]===undefined?!![]:![]:!![],'where':_0x3f455b[_0x5994('0x1f')]?_0x3f455b[_0x5994('0x1f')][_0x5994('0x21')]||null:null,'attributes':_0x3f455b[_0x5994('0x1f')]?_0x3f455b[_0x5994('0x1f')][_0x5994('0x22')]||null:null,'include':_0x3f455b[_0x5994('0x1f')]?_0x3f455b[_0x5994('0x1f')][_0x5994('0x23')]?_[_0x5994('0x24')](_0x3f455b[_0x5994('0x1f')][_0x5994('0x23')],function(_0x545e65){return{'model':db[_0x545e65[_0x5994('0x25')]],'as':_0x545e65['as'],'attributes':_0x545e65[_0x5994('0x22')],'include':_0x545e65[_0x5994('0x23')]?_['map'](_0x545e65[_0x5994('0x23')],function(_0x4b0cc1){return{'model':db[_0x4b0cc1['model']],'as':_0x4b0cc1['as'],'attributes':_0x4b0cc1[_0x5994('0x22')],'include':_0x4b0cc1[_0x5994('0x23')]?_['map'](_0x4b0cc1['include'],function(_0x39ed9c){return{'model':db[_0x39ed9c[_0x5994('0x25')]],'as':_0x39ed9c['as'],'attributes':_0x39ed9c[_0x5994('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3fb000){logger[_0x5994('0x13')](_0x5994('0x1c'),_0x3f455b);logger[_0x5994('0x15')](_0x5994('0x1c'),_0x3f455b,JSON['stringify'](_0x3fb000));_0x14f3be(_0x3fb000);})[_0x5994('0x1b')](function(_0xc4806c){logger['error'](_0x5994('0x1c'),_0xc4806c[_0x5994('0x1a')],_0x3f455b);_0x70eb8c(_0x24bf53[_0x5994('0x18')](0x1f4,_0xc4806c['message']));});});}; \ No newline at end of file +var _0x6589=['SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowSmsAccount','find','options','raw','where','attributes','include','map','model','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','socket.io-emitter','register','request','then','info'];(function(_0x1560bb,_0x1ee6ac){var _0x31ca87=function(_0x5aee4c){while(--_0x5aee4c){_0x1560bb['push'](_0x1560bb['shift']());}};_0x31ca87(++_0x1ee6ac);}(_0x6589,0xbc));var _0x9658=function(_0x2ba740,_0x62a305){_0x2ba740=_0x2ba740-0x0;var _0x358bda=_0x6589[_0x2ba740];return _0x358bda;};'use strict';var _=require('lodash');var util=require(_0x9658('0x0'));var moment=require('moment');var BPromise=require(_0x9658('0x1'));var rs=require(_0x9658('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9658('0x3'))['db'];var utils=require(_0x9658('0x4'));var logger=require(_0x9658('0x5'))('rpc');var config=require(_0x9658('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9658('0x7')][_0x9658('0x8')]({'port':0x232a});config[_0x9658('0x9')]=_[_0x9658('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9658('0xb'))(new Redis(config[_0x9658('0x9')]));require('./smsAccount.socket')[_0x9658('0xc')](socket);function respondWithRpcPromise(_0x44553b,_0xc62423,_0x317727){return new BPromise(function(_0x52e9d9,_0x1eff9e){return client[_0x9658('0xd')](_0x44553b,_0x317727)[_0x9658('0xe')](function(_0x3eacf3){logger[_0x9658('0xf')](_0x9658('0x10'),_0xc62423,_0x9658('0x11'));logger[_0x9658('0x12')](_0x9658('0x13'),_0xc62423,_0x9658('0x11'),JSON[_0x9658('0x14')](_0x3eacf3));if(_0x3eacf3['error']){if(_0x3eacf3['error']['code']===0x1f4){logger[_0x9658('0x15')](_0x9658('0x10'),_0xc62423,_0x3eacf3[_0x9658('0x15')]['message']);return _0x1eff9e(_0x3eacf3[_0x9658('0x15')]['message']);}logger[_0x9658('0x15')](_0x9658('0x10'),_0xc62423,_0x3eacf3[_0x9658('0x15')][_0x9658('0x16')]);return _0x52e9d9(_0x3eacf3[_0x9658('0x15')]['message']);}else{logger[_0x9658('0xf')](_0x9658('0x10'),_0xc62423,_0x9658('0x11'));_0x52e9d9(_0x3eacf3[_0x9658('0x17')]['message']);}})[_0x9658('0x18')](function(_0x1df080){logger['error']('SmsAccount,\x20%s,\x20%s',_0xc62423,_0x1df080);_0x1eff9e(_0x1df080);});});}exports[_0x9658('0x19')]=function(_0x56561a){var _0x3b88fc=this;return new Promise(function(_0x98ec3a,_0x33afdf){return db['SmsAccount'][_0x9658('0x1a')]({'raw':_0x56561a['options']?_0x56561a[_0x9658('0x1b')][_0x9658('0x1c')]===undefined?!![]:![]:!![],'where':_0x56561a[_0x9658('0x1b')]?_0x56561a['options'][_0x9658('0x1d')]||null:null,'attributes':_0x56561a[_0x9658('0x1b')]?_0x56561a['options'][_0x9658('0x1e')]||null:null,'include':_0x56561a[_0x9658('0x1b')]?_0x56561a[_0x9658('0x1b')][_0x9658('0x1f')]?_[_0x9658('0x20')](_0x56561a[_0x9658('0x1b')][_0x9658('0x1f')],function(_0x44ee16){return{'model':db[_0x44ee16[_0x9658('0x21')]],'as':_0x44ee16['as'],'attributes':_0x44ee16['attributes'],'include':_0x44ee16[_0x9658('0x1f')]?_[_0x9658('0x20')](_0x44ee16[_0x9658('0x1f')],function(_0x5c6e4b){return{'model':db[_0x5c6e4b['model']],'as':_0x5c6e4b['as'],'attributes':_0x5c6e4b[_0x9658('0x1e')],'include':_0x5c6e4b[_0x9658('0x1f')]?_[_0x9658('0x20')](_0x5c6e4b[_0x9658('0x1f')],function(_0xe2353d){return{'model':db[_0xe2353d[_0x9658('0x21')]],'as':_0xe2353d['as'],'attributes':_0xe2353d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x440371){logger['info'](_0x9658('0x19'),_0x56561a);logger[_0x9658('0x12')](_0x9658('0x19'),_0x56561a,JSON[_0x9658('0x14')](_0x440371));_0x98ec3a(_0x440371);})[_0x9658('0x18')](function(_0xa3b613){logger[_0x9658('0x15')]('ShowSmsAccount',_0xa3b613[_0x9658('0x16')],_0x56561a);_0x33afdf(_0x3b88fc[_0x9658('0x15')](0x1f4,_0xa3b613['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index b5af843..082bdea 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 191211c..06ed048 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['post','create','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show'];(function(_0x5ad25f,_0x42ff94){var _0x1b9cf4=function(_0x612238){while(--_0x612238){_0x5ad25f['push'](_0x5ad25f['shift']());}};_0x1b9cf4(++_0x42ff94);}(_0xedd9,0xfc));var _0x9edd=function(_0x3b83ad,_0x51290d){_0x3b83ad=_0x3b83ad-0x0;var _0x20e6fd=_0xedd9[_0x3b83ad];return _0x20e6fd;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0xe')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['put'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0x11')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);module['exports']=router; \ No newline at end of file +var _0x7217=['Router','fs-extra','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x465b4b,_0x3dacbd){var _0xd4a11e=function(_0x3a9b0b){while(--_0x3a9b0b){_0x465b4b['push'](_0x465b4b['shift']());}};_0xd4a11e(++_0x3dacbd);}(_0x7217,0x19e));var _0x7721=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0x7217[_0x1b828b];return _0x98da1a;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0xd')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0xf')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller['update']);router[_0x7721('0x10')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0x11')]);module[_0x7721('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 047cc1f..f54b678 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 _0x0ba4=['INTEGER','noop','TEXT','STRING','*,*,*,*','exports'];(function(_0x41a213,_0x2f4106){var _0x137076=function(_0x146b67){while(--_0x146b67){_0x41a213['push'](_0x41a213['shift']());}};_0x137076(++_0x2f4106);}(_0x0ba4,0x149));var _0x40ba=function(_0x72e945,_0x109cc9){_0x72e945=_0x72e945-0x0;var _0x36f91a=_0x0ba4[_0x72e945];return _0x36f91a;};'use strict';var Sequelize=require('sequelize');module[_0x40ba('0x0')]={'priority':{'type':Sequelize[_0x40ba('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x40ba('0x2')},'appdata':{'type':Sequelize[_0x40ba('0x3')]()},'description':{'type':Sequelize[_0x40ba('0x4')]},'interval':{'type':Sequelize[_0x40ba('0x4')],'defaultValue':_0x40ba('0x5')}}; \ No newline at end of file +var _0xe884=['TEXT','*,*,*,*','exports','INTEGER','STRING'];(function(_0xe9d288,_0x255786){var _0xc3caa4=function(_0x5163e9){while(--_0x5163e9){_0xe9d288['push'](_0xe9d288['shift']());}};_0xc3caa4(++_0x255786);}(_0xe884,0x11f));var _0x4e88=function(_0xecbdd,_0x45874a){_0xecbdd=_0xecbdd-0x0;var _0x37d399=_0xe884[_0xecbdd];return _0x37d399;};'use strict';var Sequelize=require('sequelize');module[_0x4e88('0x0')]={'priority':{'type':Sequelize[_0x4e88('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x4e88('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x4e88('0x3')]()},'description':{'type':Sequelize[_0x4e88('0x2')]},'interval':{'type':Sequelize[_0x4e88('0x2')],'defaultValue':_0x4e88('0x4')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index d8f000d..4bbe90e 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 _0x7d4a=['filters','pick','type','VIRTUAL','filter','merge','options','includeAll','rows','catch','show','params','keys','include','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','offset','count','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','key','model','query','intersection','fields','attributes','length','nolimit','order','sort','where'];(function(_0x59c69d,_0x3e661e){var _0x100bdf=function(_0x1e3acf){while(--_0x1e3acf){_0x59c69d['push'](_0x59c69d['shift']());}};_0x100bdf(++_0x3e661e);}(_0x7d4a,0xec));var _0xa7d4=function(_0x482f6a,_0x19c47d){_0x482f6a=_0x482f6a-0x0;var _0x200cc6=_0x7d4a[_0x482f6a];return _0x200cc6;};'use strict';var emlformat=require(_0xa7d4('0x0'));var rimraf=require(_0xa7d4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa7d4('0x2'));var rp=require(_0xa7d4('0x3'));var moment=require('moment');var BPromise=require(_0xa7d4('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xa7d4('0x5'));var csv=require(_0xa7d4('0x6'));var ejs=require(_0xa7d4('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa7d4('0x8'));var squel=require(_0xa7d4('0x9'));var crypto=require(_0xa7d4('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xa7d4('0xb'));var toCsv=require(_0xa7d4('0x6'));var querystring=require('querystring');var Papa=require(_0xa7d4('0xc'));var Redis=require(_0xa7d4('0xd'));var authService=require(_0xa7d4('0xe'));var qs=require(_0xa7d4('0xf'));var as=require(_0xa7d4('0x10'));var hardwareService=require(_0xa7d4('0x11'));var logger=require(_0xa7d4('0x12'))(_0xa7d4('0x13'));var utils=require(_0xa7d4('0x14'));var config=require(_0xa7d4('0x15'));var licenseUtil=require(_0xa7d4('0x16'));var db=require(_0xa7d4('0x17'))['db'];function respondWithStatusCode(_0x312296,_0x3152cb){_0x3152cb=_0x3152cb||0xcc;return function(_0x42fb53){if(_0x42fb53){return _0x312296[_0xa7d4('0x18')](_0x3152cb);}return _0x312296['status'](_0x3152cb)[_0xa7d4('0x19')]();};}function respondWithResult(_0x4aa503,_0x3b2233){_0x3b2233=_0x3b2233||0xc8;return function(_0x47896d){if(_0x47896d){return _0x4aa503[_0xa7d4('0x1a')](_0x3b2233)[_0xa7d4('0x1b')](_0x47896d);}};}function respondWithFilteredResult(_0x58cf89,_0x355239){return function(_0x228037){if(_0x228037){var _0x44db8e=typeof _0x355239['offset']===_0xa7d4('0x1c')&&typeof _0x355239['limit']===_0xa7d4('0x1c');var _0x40915c=_0x228037['count'];var _0x5d27ce=_0x44db8e?0x0:_0x355239[_0xa7d4('0x1d')];var _0x3674d5=_0x44db8e?_0x228037[_0xa7d4('0x1e')]:_0x355239[_0xa7d4('0x1d')]+_0x355239['limit'];var _0x771323;if(_0x3674d5>=_0x40915c){_0x3674d5=_0x40915c;_0x771323=0xc8;}else{_0x771323=0xce;}_0x58cf89[_0xa7d4('0x1a')](_0x771323);return _0x58cf89['set'](_0xa7d4('0x1f'),_0x5d27ce+'-'+_0x3674d5+'/'+_0x40915c)[_0xa7d4('0x1b')](_0x228037);}return null;};}function patchUpdates(_0x55b2f4){return function(_0x4c6cd7){try{jsonpatch[_0xa7d4('0x20')](_0x4c6cd7,_0x55b2f4,!![]);}catch(_0x399b3a){return BPromise[_0xa7d4('0x21')](_0x399b3a);}return _0x4c6cd7[_0xa7d4('0x22')]();};}function saveUpdates(_0x307848,_0x1461a4){return function(_0x1aeaca){if(_0x1aeaca){return _0x1aeaca[_0xa7d4('0x23')](_0x307848)[_0xa7d4('0x24')](function(_0x4e9f51){return _0x4e9f51;});}return null;};}function removeEntity(_0x358b8f,_0x301ebf){return function(_0x123eb3){if(_0x123eb3){return _0x123eb3['destroy']()[_0xa7d4('0x24')](function(){_0x358b8f['status'](0xcc)[_0xa7d4('0x19')]();});}};}function handleEntityNotFound(_0x54beb7,_0x85a29c){return function(_0x18834d){if(!_0x18834d){_0x54beb7[_0xa7d4('0x18')](0x194);}return _0x18834d;};}function handleError(_0x21f15c,_0xd022ca){_0xd022ca=_0xd022ca||0x1f4;return function(_0x5492ce){logger['error'](_0x5492ce[_0xa7d4('0x25')]);if(_0x5492ce[_0xa7d4('0x26')]){delete _0x5492ce[_0xa7d4('0x26')];}_0x21f15c['status'](_0xd022ca)[_0xa7d4('0x27')](_0x5492ce);};}exports[_0xa7d4('0x28')]=function(_0x2ddcd6,_0x21bd1d){var _0x5cd272={},_0x292e0e={},_0x4151f8={'count':0x0,'rows':[]};var _0x4985bb=_[_0xa7d4('0x29')](db[_0xa7d4('0x2a')][_0xa7d4('0x2b')],function(_0x81ee62){return{'name':_0x81ee62[_0xa7d4('0x2c')],'type':_0x81ee62['type'][_0xa7d4('0x2d')]};});_0x292e0e[_0xa7d4('0x2e')]=_['map'](_0x4985bb,_0xa7d4('0x26'));_0x292e0e[_0xa7d4('0x2f')]=_['keys'](_0x2ddcd6['query']);_0x292e0e['filters']=_[_0xa7d4('0x30')](_0x292e0e['model'],_0x292e0e['query']);_0x5cd272['attributes']=_[_0xa7d4('0x30')](_0x292e0e['model'],qs[_0xa7d4('0x31')](_0x2ddcd6[_0xa7d4('0x2f')][_0xa7d4('0x31')]));_0x5cd272[_0xa7d4('0x32')]=_0x5cd272[_0xa7d4('0x32')][_0xa7d4('0x33')]?_0x5cd272[_0xa7d4('0x32')]:_0x292e0e[_0xa7d4('0x2e')];if(!_0x2ddcd6[_0xa7d4('0x2f')]['hasOwnProperty'](_0xa7d4('0x34'))){_0x5cd272['limit']=qs['limit'](_0x2ddcd6[_0xa7d4('0x2f')]['limit']);_0x5cd272['offset']=qs[_0xa7d4('0x1d')](_0x2ddcd6['query'][_0xa7d4('0x1d')]);}_0x5cd272[_0xa7d4('0x35')]=qs[_0xa7d4('0x36')](_0x2ddcd6[_0xa7d4('0x2f')]['sort']);_0x5cd272[_0xa7d4('0x37')]=qs[_0xa7d4('0x38')](_[_0xa7d4('0x39')](_0x2ddcd6[_0xa7d4('0x2f')],_0x292e0e[_0xa7d4('0x38')]),_0x4985bb);if(_0x2ddcd6[_0xa7d4('0x2f')]['filter']){_0x5cd272['where']=_['merge'](_0x5cd272[_0xa7d4('0x37')],{'$or':_[_0xa7d4('0x29')](_0x4985bb,function(_0x47d576){if(_0x47d576[_0xa7d4('0x3a')]!==_0xa7d4('0x3b')){var _0x13d76a={};_0x13d76a[_0x47d576[_0xa7d4('0x26')]]={'$like':'%'+_0x2ddcd6[_0xa7d4('0x2f')][_0xa7d4('0x3c')]+'%'};return _0x13d76a;}})});}_0x5cd272=_[_0xa7d4('0x3d')]({},_0x5cd272,_0x2ddcd6[_0xa7d4('0x3e')]);var _0x4cbc2d={'where':_0x5cd272[_0xa7d4('0x37')]};return db[_0xa7d4('0x2a')][_0xa7d4('0x1e')](_0x4cbc2d)['then'](function(_0xb23933){_0x4151f8['count']=_0xb23933;if(_0x2ddcd6['query'][_0xa7d4('0x3f')]){_0x5cd272['include']=[{'all':!![]}];}return db[_0xa7d4('0x2a')]['findAll'](_0x5cd272);})[_0xa7d4('0x24')](function(_0xb5c3e2){_0x4151f8[_0xa7d4('0x40')]=_0xb5c3e2;return _0x4151f8;})[_0xa7d4('0x24')](respondWithFilteredResult(_0x21bd1d,_0x5cd272))[_0xa7d4('0x41')](handleError(_0x21bd1d,null));};exports[_0xa7d4('0x42')]=function(_0x5ab768,_0x3cc99b){var _0x92b2d6={'raw':!![],'where':{'id':_0x5ab768[_0xa7d4('0x43')]['id']}},_0x5a8434={};_0x5a8434[_0xa7d4('0x2e')]=_[_0xa7d4('0x44')](db[_0xa7d4('0x2a')][_0xa7d4('0x2b')]);_0x5a8434[_0xa7d4('0x2f')]=_[_0xa7d4('0x44')](_0x5ab768[_0xa7d4('0x2f')]);_0x5a8434[_0xa7d4('0x38')]=_['intersection'](_0x5a8434[_0xa7d4('0x2e')],_0x5a8434[_0xa7d4('0x2f')]);_0x92b2d6[_0xa7d4('0x32')]=_[_0xa7d4('0x30')](_0x5a8434[_0xa7d4('0x2e')],qs['fields'](_0x5ab768[_0xa7d4('0x2f')][_0xa7d4('0x31')]));_0x92b2d6['attributes']=_0x92b2d6[_0xa7d4('0x32')]['length']?_0x92b2d6[_0xa7d4('0x32')]:_0x5a8434[_0xa7d4('0x2e')];if(_0x5ab768[_0xa7d4('0x2f')][_0xa7d4('0x3f')]){_0x92b2d6[_0xa7d4('0x45')]=[{'all':!![]}];}_0x92b2d6=_[_0xa7d4('0x3d')]({},_0x92b2d6,_0x5ab768[_0xa7d4('0x3e')]);return db[_0xa7d4('0x2a')][_0xa7d4('0x46')](_0x92b2d6)[_0xa7d4('0x24')](handleEntityNotFound(_0x3cc99b,null))['then'](respondWithResult(_0x3cc99b,null))[_0xa7d4('0x41')](handleError(_0x3cc99b,null));};exports[_0xa7d4('0x47')]=function(_0x3bc9f7,_0x1632d4){return db['SmsApplication'][_0xa7d4('0x47')](_0x3bc9f7[_0xa7d4('0x48')],{})[_0xa7d4('0x24')](respondWithResult(_0x1632d4,0xc9))['catch'](handleError(_0x1632d4,null));};exports[_0xa7d4('0x23')]=function(_0x3e7594,_0x5b7ccb){if(_0x3e7594['body']['id']){delete _0x3e7594[_0xa7d4('0x48')]['id'];}return db[_0xa7d4('0x2a')]['find']({'where':{'id':_0x3e7594['params']['id']}})['then'](handleEntityNotFound(_0x5b7ccb,null))['then'](saveUpdates(_0x3e7594[_0xa7d4('0x48')],null))[_0xa7d4('0x24')](respondWithResult(_0x5b7ccb,null))[_0xa7d4('0x41')](handleError(_0x5b7ccb,null));};exports['destroy']=function(_0x5464f9,_0x4ae249){return db[_0xa7d4('0x2a')][_0xa7d4('0x46')]({'where':{'id':_0x5464f9[_0xa7d4('0x43')]['id']}})[_0xa7d4('0x24')](handleEntityNotFound(_0x4ae249,null))[_0xa7d4('0x24')](removeEntity(_0x4ae249,null))[_0xa7d4('0x41')](handleError(_0x4ae249,null));}; \ No newline at end of file +var _0xbd58=['json','apply','reject','update','then','destroy','error','name','send','index','SmsApplication','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','length','includeAll','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','Content-Range'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbd58,0x74));var _0x8bd5=function(_0x55e5b9,_0x1be20e){_0x55e5b9=_0x55e5b9-0x0;var _0x58d1e7=_0xbd58[_0x55e5b9];return _0x58d1e7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8bd5('0x0'));var zipdir=require(_0x8bd5('0x1'));var jsonpatch=require(_0x8bd5('0x2'));var rp=require(_0x8bd5('0x3'));var moment=require(_0x8bd5('0x4'));var BPromise=require(_0x8bd5('0x5'));var Mustache=require(_0x8bd5('0x6'));var util=require(_0x8bd5('0x7'));var path=require(_0x8bd5('0x8'));var sox=require('sox');var csv=require(_0x8bd5('0x9'));var ejs=require(_0x8bd5('0xa'));var fs=require('fs');var fs_extra=require(_0x8bd5('0xb'));var _=require(_0x8bd5('0xc'));var squel=require('squel');var crypto=require(_0x8bd5('0xd'));var jsforce=require(_0x8bd5('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8bd5('0x9'));var querystring=require(_0x8bd5('0xf'));var Papa=require(_0x8bd5('0x10'));var Redis=require(_0x8bd5('0x11'));var authService=require(_0x8bd5('0x12'));var qs=require(_0x8bd5('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8bd5('0x14'));var logger=require(_0x8bd5('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x8bd5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8bd5('0x17'))['db'];function respondWithStatusCode(_0x5f43c3,_0x5e7b2b){_0x5e7b2b=_0x5e7b2b||0xcc;return function(_0x2e32cb){if(_0x2e32cb){return _0x5f43c3[_0x8bd5('0x18')](_0x5e7b2b);}return _0x5f43c3[_0x8bd5('0x19')](_0x5e7b2b)[_0x8bd5('0x1a')]();};}function respondWithResult(_0x1be8c6,_0x1036b4){_0x1036b4=_0x1036b4||0xc8;return function(_0x43a4cf){if(_0x43a4cf){return _0x1be8c6[_0x8bd5('0x19')](_0x1036b4)['json'](_0x43a4cf);}};}function respondWithFilteredResult(_0x4c57d1,_0x51ddd6){return function(_0x1b35dd){if(_0x1b35dd){var _0x26e537=typeof _0x51ddd6[_0x8bd5('0x1b')]==='undefined'&&typeof _0x51ddd6[_0x8bd5('0x1c')]===_0x8bd5('0x1d');var _0x2925d8=_0x1b35dd['count'];var _0x152c7f=_0x26e537?0x0:_0x51ddd6[_0x8bd5('0x1b')];var _0x322fb4=_0x26e537?_0x1b35dd[_0x8bd5('0x1e')]:_0x51ddd6[_0x8bd5('0x1b')]+_0x51ddd6['limit'];var _0x5e9081;if(_0x322fb4>=_0x2925d8){_0x322fb4=_0x2925d8;_0x5e9081=0xc8;}else{_0x5e9081=0xce;}_0x4c57d1[_0x8bd5('0x19')](_0x5e9081);return _0x4c57d1['set'](_0x8bd5('0x1f'),_0x152c7f+'-'+_0x322fb4+'/'+_0x2925d8)[_0x8bd5('0x20')](_0x1b35dd);}return null;};}function patchUpdates(_0x3b53e7){return function(_0x2fb176){try{jsonpatch[_0x8bd5('0x21')](_0x2fb176,_0x3b53e7,!![]);}catch(_0x52eb96){return BPromise[_0x8bd5('0x22')](_0x52eb96);}return _0x2fb176['save']();};}function saveUpdates(_0x50736b,_0x2c99c2){return function(_0x2cca44){if(_0x2cca44){return _0x2cca44[_0x8bd5('0x23')](_0x50736b)[_0x8bd5('0x24')](function(_0x188597){return _0x188597;});}return null;};}function removeEntity(_0x3f435b,_0x4f1c56){return function(_0x146792){if(_0x146792){return _0x146792[_0x8bd5('0x25')]()[_0x8bd5('0x24')](function(){_0x3f435b[_0x8bd5('0x19')](0xcc)[_0x8bd5('0x1a')]();});}};}function handleEntityNotFound(_0x5683b5,_0xbed2ec){return function(_0x3920c4){if(!_0x3920c4){_0x5683b5[_0x8bd5('0x18')](0x194);}return _0x3920c4;};}function handleError(_0x3e2dd4,_0x2c9732){_0x2c9732=_0x2c9732||0x1f4;return function(_0x886257){logger[_0x8bd5('0x26')](_0x886257['stack']);if(_0x886257['name']){delete _0x886257[_0x8bd5('0x27')];}_0x3e2dd4[_0x8bd5('0x19')](_0x2c9732)[_0x8bd5('0x28')](_0x886257);};}exports[_0x8bd5('0x29')]=function(_0x4ba9bc,_0x4479c3){var _0x5088fd={},_0x4d79ca={},_0x73431b={'count':0x0,'rows':[]};var _0x30252d=_['map'](db[_0x8bd5('0x2a')][_0x8bd5('0x2b')],function(_0x25bea8){return{'name':_0x25bea8[_0x8bd5('0x2c')],'type':_0x25bea8[_0x8bd5('0x2d')][_0x8bd5('0x2e')]};});_0x4d79ca[_0x8bd5('0x2f')]=_[_0x8bd5('0x30')](_0x30252d,_0x8bd5('0x27'));_0x4d79ca[_0x8bd5('0x31')]=_['keys'](_0x4ba9bc['query']);_0x4d79ca[_0x8bd5('0x32')]=_[_0x8bd5('0x33')](_0x4d79ca['model'],_0x4d79ca[_0x8bd5('0x31')]);_0x5088fd[_0x8bd5('0x34')]=_[_0x8bd5('0x33')](_0x4d79ca[_0x8bd5('0x2f')],qs[_0x8bd5('0x35')](_0x4ba9bc['query'][_0x8bd5('0x35')]));_0x5088fd[_0x8bd5('0x34')]=_0x5088fd['attributes']['length']?_0x5088fd['attributes']:_0x4d79ca[_0x8bd5('0x2f')];if(!_0x4ba9bc[_0x8bd5('0x31')][_0x8bd5('0x36')]('nolimit')){_0x5088fd[_0x8bd5('0x1c')]=qs[_0x8bd5('0x1c')](_0x4ba9bc[_0x8bd5('0x31')][_0x8bd5('0x1c')]);_0x5088fd[_0x8bd5('0x1b')]=qs[_0x8bd5('0x1b')](_0x4ba9bc['query'][_0x8bd5('0x1b')]);}_0x5088fd[_0x8bd5('0x37')]=qs['sort'](_0x4ba9bc[_0x8bd5('0x31')][_0x8bd5('0x38')]);_0x5088fd[_0x8bd5('0x39')]=qs['filters'](_['pick'](_0x4ba9bc['query'],_0x4d79ca[_0x8bd5('0x32')]),_0x30252d);if(_0x4ba9bc['query'][_0x8bd5('0x3a')]){_0x5088fd[_0x8bd5('0x39')]=_[_0x8bd5('0x3b')](_0x5088fd[_0x8bd5('0x39')],{'$or':_[_0x8bd5('0x30')](_0x30252d,function(_0x3d728d){if(_0x3d728d['type']!==_0x8bd5('0x3c')){var _0x4a4745={};_0x4a4745[_0x3d728d['name']]={'$like':'%'+_0x4ba9bc[_0x8bd5('0x31')][_0x8bd5('0x3a')]+'%'};return _0x4a4745;}})});}_0x5088fd=_[_0x8bd5('0x3b')]({},_0x5088fd,_0x4ba9bc[_0x8bd5('0x3d')]);var _0x58407d={'where':_0x5088fd[_0x8bd5('0x39')]};return db[_0x8bd5('0x2a')][_0x8bd5('0x1e')](_0x58407d)[_0x8bd5('0x24')](function(_0x1ac24f){_0x73431b[_0x8bd5('0x1e')]=_0x1ac24f;if(_0x4ba9bc[_0x8bd5('0x31')]['includeAll']){_0x5088fd[_0x8bd5('0x3e')]=[{'all':!![]}];}return db[_0x8bd5('0x2a')][_0x8bd5('0x3f')](_0x5088fd);})['then'](function(_0x4ffe63){_0x73431b[_0x8bd5('0x40')]=_0x4ffe63;return _0x73431b;})[_0x8bd5('0x24')](respondWithFilteredResult(_0x4479c3,_0x5088fd))[_0x8bd5('0x41')](handleError(_0x4479c3,null));};exports[_0x8bd5('0x42')]=function(_0x319b93,_0x3591fa){var _0x41fa94={'raw':!![],'where':{'id':_0x319b93[_0x8bd5('0x43')]['id']}},_0x46a7b2={};_0x46a7b2[_0x8bd5('0x2f')]=_[_0x8bd5('0x44')](db['SmsApplication'][_0x8bd5('0x2b')]);_0x46a7b2[_0x8bd5('0x31')]=_[_0x8bd5('0x44')](_0x319b93[_0x8bd5('0x31')]);_0x46a7b2[_0x8bd5('0x32')]=_['intersection'](_0x46a7b2['model'],_0x46a7b2[_0x8bd5('0x31')]);_0x41fa94[_0x8bd5('0x34')]=_['intersection'](_0x46a7b2[_0x8bd5('0x2f')],qs['fields'](_0x319b93[_0x8bd5('0x31')][_0x8bd5('0x35')]));_0x41fa94[_0x8bd5('0x34')]=_0x41fa94[_0x8bd5('0x34')][_0x8bd5('0x45')]?_0x41fa94[_0x8bd5('0x34')]:_0x46a7b2[_0x8bd5('0x2f')];if(_0x319b93[_0x8bd5('0x31')][_0x8bd5('0x46')]){_0x41fa94[_0x8bd5('0x3e')]=[{'all':!![]}];}_0x41fa94=_['merge']({},_0x41fa94,_0x319b93[_0x8bd5('0x3d')]);return db['SmsApplication'][_0x8bd5('0x47')](_0x41fa94)[_0x8bd5('0x24')](handleEntityNotFound(_0x3591fa,null))[_0x8bd5('0x24')](respondWithResult(_0x3591fa,null))[_0x8bd5('0x41')](handleError(_0x3591fa,null));};exports['create']=function(_0x1c961f,_0x1e8b74){return db[_0x8bd5('0x2a')][_0x8bd5('0x48')](_0x1c961f[_0x8bd5('0x49')],{})[_0x8bd5('0x24')](respondWithResult(_0x1e8b74,0xc9))['catch'](handleError(_0x1e8b74,null));};exports[_0x8bd5('0x23')]=function(_0x48a764,_0x30ea81){if(_0x48a764[_0x8bd5('0x49')]['id']){delete _0x48a764[_0x8bd5('0x49')]['id'];}return db[_0x8bd5('0x2a')][_0x8bd5('0x47')]({'where':{'id':_0x48a764[_0x8bd5('0x43')]['id']}})[_0x8bd5('0x24')](handleEntityNotFound(_0x30ea81,null))['then'](saveUpdates(_0x48a764[_0x8bd5('0x49')],null))[_0x8bd5('0x24')](respondWithResult(_0x30ea81,null))[_0x8bd5('0x41')](handleError(_0x30ea81,null));};exports['destroy']=function(_0x278aa1,_0x12e793){return db[_0x8bd5('0x2a')][_0x8bd5('0x47')]({'where':{'id':_0x278aa1[_0x8bd5('0x43')]['id']}})[_0x8bd5('0x24')](handleEntityNotFound(_0x12e793,null))['then'](removeEntity(_0x12e793,null))[_0x8bd5('0x41')](handleError(_0x12e793,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index b4bfdb6..4117ac9 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 _0x0a05=['SmsApplication','sms_applications','utf8mb4','lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./smsApplication.attributes','exports','define'];(function(_0x4a30f1,_0x2e75a8){var _0x1e0a09=function(_0xfc5f54){while(--_0xfc5f54){_0x4a30f1['push'](_0x4a30f1['shift']());}};_0x1e0a09(++_0x2e75a8);}(_0x0a05,0x1e4));var _0x50a0=function(_0x56a871,_0x18b7fe){_0x56a871=_0x56a871-0x0;var _0x124954=_0x0a05[_0x56a871];return _0x124954;};'use strict';var _=require(_0x50a0('0x0'));var util=require(_0x50a0('0x1'));var logger=require(_0x50a0('0x2'))('api');var moment=require(_0x50a0('0x3'));var BPromise=require(_0x50a0('0x4'));var rp=require(_0x50a0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x50a0('0x6'));var attributes=require(_0x50a0('0x7'));module[_0x50a0('0x8')]=function(_0x120258,_0x5255aa){return _0x120258[_0x50a0('0x9')](_0x50a0('0xa'),attributes,{'tableName':_0x50a0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x50a0('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x35fd=['utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','bluebird','path','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications'];(function(_0x599aa2,_0x4c3fd4){var _0x3fdacd=function(_0x246684){while(--_0x246684){_0x599aa2['push'](_0x599aa2['shift']());}};_0x3fdacd(++_0x4c3fd4);}(_0x35fd,0x1d6));var _0xd35f=function(_0x11162f,_0x48880a){_0x11162f=_0x11162f-0x0;var _0x275e50=_0x35fd[_0x11162f];return _0x275e50;};'use strict';var _=require('lodash');var util=require(_0xd35f('0x0'));var logger=require(_0xd35f('0x1'))('api');var moment=require('moment');var BPromise=require(_0xd35f('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd35f('0x3'));var rimraf=require('rimraf');var config=require(_0xd35f('0x4'));var attributes=require(_0xd35f('0x5'));module[_0xd35f('0x6')]=function(_0x481cb0,_0x220144){return _0x481cb0[_0xd35f('0x7')](_0xd35f('0x8'),attributes,{'tableName':_0xd35f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd35f('0xa'),'collate':_0xd35f('0xb')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 721ec39..54f16b6 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 _0xb7de=['http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x25ebb0,_0x21835c){var _0x85268a=function(_0x3dfe50){while(--_0x3dfe50){_0x25ebb0['push'](_0x25ebb0['shift']());}};_0x85268a(++_0x21835c);}(_0xb7de,0xc7));var _0xeb7d=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xb7de[_0x5b561d];return _0x431060;};'use strict';var _=require(_0xeb7d('0x0'));var util=require(_0xeb7d('0x1'));var moment=require(_0xeb7d('0x2'));var BPromise=require('bluebird');var rs=require(_0xeb7d('0x3'));var fs=require('fs');var Redis=require(_0xeb7d('0x4'));var db=require(_0xeb7d('0x5'))['db'];var utils=require(_0xeb7d('0x6'));var logger=require(_0xeb7d('0x7'))('rpc');var config=require(_0xeb7d('0x8'));var jayson=require(_0xeb7d('0x9'));var client=jayson[_0xeb7d('0xa')][_0xeb7d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xc8bd99,_0x593170,_0x5e7556){return new BPromise(function(_0xb802e1,_0x13d376){return client[_0xeb7d('0xc')](_0xc8bd99,_0x5e7556)[_0xeb7d('0xd')](function(_0x4a880a){logger[_0xeb7d('0xe')](_0xeb7d('0xf'),_0x593170,_0xeb7d('0x10'));logger['debug']('SmsApplication,\x20%s,\x20%s,\x20%s',_0x593170,_0xeb7d('0x10'),JSON['stringify'](_0x4a880a));if(_0x4a880a[_0xeb7d('0x11')]){if(_0x4a880a[_0xeb7d('0x11')][_0xeb7d('0x12')]===0x1f4){logger[_0xeb7d('0x11')](_0xeb7d('0xf'),_0x593170,_0x4a880a[_0xeb7d('0x11')]['message']);return _0x13d376(_0x4a880a[_0xeb7d('0x11')][_0xeb7d('0x13')]);}logger[_0xeb7d('0x11')](_0xeb7d('0xf'),_0x593170,_0x4a880a[_0xeb7d('0x11')]['message']);return _0xb802e1(_0x4a880a[_0xeb7d('0x11')]['message']);}else{logger[_0xeb7d('0xe')](_0xeb7d('0xf'),_0x593170,_0xeb7d('0x10'));_0xb802e1(_0x4a880a['result']['message']);}})[_0xeb7d('0x14')](function(_0xfcbbce){logger['error']('SmsApplication,\x20%s,\x20%s',_0x593170,_0xfcbbce);_0x13d376(_0xfcbbce);});});} \ No newline at end of file +var _0x1e82=['SmsApplication,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','info'];(function(_0x2090a3,_0x355528){var _0x2eed3b=function(_0x492973){while(--_0x492973){_0x2090a3['push'](_0x2090a3['shift']());}};_0x2eed3b(++_0x355528);}(_0x1e82,0x8b));var _0x21e8=function(_0x89f1ae,_0x15cc30){_0x89f1ae=_0x89f1ae-0x0;var _0xc85802=_0x1e82[_0x89f1ae];return _0xc85802;};'use strict';var _=require(_0x21e8('0x0'));var util=require(_0x21e8('0x1'));var moment=require(_0x21e8('0x2'));var BPromise=require(_0x21e8('0x3'));var rs=require(_0x21e8('0x4'));var fs=require('fs');var Redis=require(_0x21e8('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x21e8('0x6'));var logger=require(_0x21e8('0x7'))('rpc');var config=require(_0x21e8('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x21e8('0x9')][_0x21e8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x38c3d0,_0x22cbd4,_0x47b3b3){return new BPromise(function(_0x45e5c1,_0x3754c9){return client[_0x21e8('0xb')](_0x38c3d0,_0x47b3b3)['then'](function(_0x31b6c2){logger[_0x21e8('0xc')](_0x21e8('0xd'),_0x22cbd4,_0x21e8('0xe'));logger['debug']('SmsApplication,\x20%s,\x20%s,\x20%s',_0x22cbd4,_0x21e8('0xe'),JSON['stringify'](_0x31b6c2));if(_0x31b6c2[_0x21e8('0xf')]){if(_0x31b6c2[_0x21e8('0xf')]['code']===0x1f4){logger[_0x21e8('0xf')]('SmsApplication,\x20%s,\x20%s',_0x22cbd4,_0x31b6c2[_0x21e8('0xf')][_0x21e8('0x10')]);return _0x3754c9(_0x31b6c2[_0x21e8('0xf')]['message']);}logger[_0x21e8('0xf')]('SmsApplication,\x20%s,\x20%s',_0x22cbd4,_0x31b6c2[_0x21e8('0xf')][_0x21e8('0x10')]);return _0x45e5c1(_0x31b6c2[_0x21e8('0xf')]['message']);}else{logger['info'](_0x21e8('0xd'),_0x22cbd4,_0x21e8('0xe'));_0x45e5c1(_0x31b6c2[_0x21e8('0x11')][_0x21e8('0x10')]);}})[_0x21e8('0x12')](function(_0x13da4f){logger[_0x21e8('0xf')](_0x21e8('0xd'),_0x22cbd4,_0x13da4f);_0x3754c9(_0x13da4f);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 35b3a4e..02cf3d2 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 _0x087b=['sms','smsinteraction:addtags','addTags','put','update','delete','smsinteraction:destroy','destroy','removeTags','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked'];(function(_0x36e892,_0xf19aa9){var _0x1f93d9=function(_0x346fc5){while(--_0x346fc5){_0x36e892['push'](_0x36e892['shift']());}};_0x1f93d9(++_0xf19aa9);}(_0x087b,0x11a));var _0xb087=function(_0x38537f,_0x252124){_0x38537f=_0x38537f-0x0;var _0x141e23=_0x087b[_0x38537f];return _0x141e23;};'use strict';var multer=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb087('0x2'));var router=express['Router']();var fs_extra=require(_0xb087('0x3'));var auth=require(_0xb087('0x4'));var interaction=require(_0xb087('0x5'));var config=require(_0xb087('0x6'));var controller=require(_0xb087('0x7'));router[_0xb087('0x8')]('/',auth[_0xb087('0x9')](),controller[_0xb087('0xa')]);router[_0xb087('0x8')](_0xb087('0xb'),auth[_0xb087('0x9')](),controller[_0xb087('0xc')]);router[_0xb087('0x8')](_0xb087('0xd'),auth[_0xb087('0x9')](),controller[_0xb087('0xe')]);router[_0xb087('0x8')]('/:id/messages',auth[_0xb087('0x9')](),controller[_0xb087('0xf')]);router[_0xb087('0x8')](_0xb087('0x10'),auth[_0xb087('0x9')](),controller[_0xb087('0x11')]);router[_0xb087('0x12')]('/',auth['isAuthenticated'](),controller[_0xb087('0x13')]);router[_0xb087('0x12')](_0xb087('0x14'),auth['isAuthenticated'](),controller[_0xb087('0x15')]);router[_0xb087('0x12')](_0xb087('0x16'),auth[_0xb087('0x9')](),interaction[_0xb087('0x17')](_0xb087('0x18'),_0xb087('0x19')),controller[_0xb087('0x1a')]);router[_0xb087('0x1b')](_0xb087('0xd'),auth['isAuthenticated'](),interaction[_0xb087('0x17')](_0xb087('0x18'),'smsinteraction:update'),controller[_0xb087('0x1c')]);router[_0xb087('0x1d')](_0xb087('0xd'),auth['isAuthenticated'](),interaction[_0xb087('0x17')](_0xb087('0x18'),_0xb087('0x1e')),controller[_0xb087('0x1f')]);router['delete'](_0xb087('0x16'),auth[_0xb087('0x9')](),controller[_0xb087('0x20')]);module[_0xb087('0x21')]=router; \ No newline at end of file +var _0xb10b=['smsinteraction:addtags','addTags','put','update','delete','smsinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','index','isAuthenticated','describe','/:id','show','/:id/messages','/:id/download','post','create','addMessage','tracked','sms'];(function(_0x517d44,_0x18bf20){var _0x512736=function(_0x19a208){while(--_0x19a208){_0x517d44['push'](_0x517d44['shift']());}};_0x512736(++_0x18bf20);}(_0xb10b,0x12a));var _0xbb10=function(_0x48accc,_0x3142e9){_0x48accc=_0x48accc-0x0;var _0x460cc4=_0xb10b[_0x48accc];return _0x460cc4;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getMessages']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['download']);router[_0xbb10('0x11')]('/',auth['isAuthenticated'](),controller[_0xbb10('0x12')]);router[_0xbb10('0x11')](_0xbb10('0xf'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router[_0xbb10('0x11')]('/:id/tags',auth[_0xbb10('0xb')](),interaction[_0xbb10('0x14')](_0xbb10('0x15'),_0xbb10('0x16')),controller[_0xbb10('0x17')]);router[_0xbb10('0x18')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),interaction[_0xbb10('0x14')](_0xbb10('0x15'),'smsinteraction:update'),controller[_0xbb10('0x19')]);router[_0xbb10('0x1a')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),interaction[_0xbb10('0x14')](_0xbb10('0x15'),_0xbb10('0x1b')),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1a')](_0xbb10('0x1d'),auth['isAuthenticated'](),controller[_0xbb10('0x1e')]);module[_0xbb10('0x1f')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index ab3eed6..1a3ce02 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 _0xe5d5=['exports','DATE','STRING','ENUM','out','BOOLEAN'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xe5d5,0x156));var _0x5e5d=function(_0x2bc5aa,_0x35ea5b){_0x2bc5aa=_0x2bc5aa-0x0;var _0x74ccb5=_0xe5d5[_0x2bc5aa];return _0x74ccb5;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x5e5d('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x5e5d('0x1')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x5e5d('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x5e5d('0x2')]},'phone':{'type':Sequelize[_0x5e5d('0x2')]},'read1stAt':{'type':Sequelize[_0x5e5d('0x1')]},'firstMsgDirection':{'type':Sequelize[_0x5e5d('0x3')]('in',_0x5e5d('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x5e5d('0x1')]},'lastMsgDirection':{'type':Sequelize[_0x5e5d('0x3')]('in',_0x5e5d('0x4')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x5e5d('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0x1b20=['DATE','ENUM','out','BOOLEAN','moment','exports','STRING'];(function(_0x4c2581,_0x1b4589){var _0x148722=function(_0x259d62){while(--_0x259d62){_0x4c2581['push'](_0x4c2581['shift']());}};_0x148722(++_0x1b4589);}(_0x1b20,0x66));var _0x01b2=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x1b20[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x01b2('0x0'));module[_0x01b2('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x01b2('0x2')]},'secondDisposition':{'type':Sequelize[_0x01b2('0x2')]},'thirdDisposition':{'type':Sequelize[_0x01b2('0x2')]},'note':{'type':Sequelize[_0x01b2('0x2')]},'phone':{'type':Sequelize[_0x01b2('0x2')]},'read1stAt':{'type':Sequelize[_0x01b2('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x01b2('0x4')]('in',_0x01b2('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x01b2('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x01b2('0x4')]('in',_0x01b2('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x01b2('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 54f5d9d..be3bd4c 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 _0x15ad=['SmsAccountId','i.SmsAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','isArray','tag','filter','replace','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.SmsAccountId\x20IS\x20NULL','toString','keyBy','merge','fields','a.key','Account.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','all','rows','show','params','includeAll','options','catch','create','body','describe','addMessage','ids','omit','SmsMessage','pick','format','addTags','setTags','findAll','emit','removeTags','download','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Messages','direction','secret','SmsAccount','Owner','fullname','get','mkdirSync','Account','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','out','System','views','downloadInteraction.ejs','transcript-','.pdf','Sms','err','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','end','status','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','error','stack','name','map','TagIds','split','forEach','Tags','push','SmsInteraction','rawAttributes','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','select','field','color','from','tools_tags','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_messages','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','search','parseSearch','conditions','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','some','compact','isEmpty'];(function(_0x479509,_0x1daf8a){var _0x382da8=function(_0x39d77c){while(--_0x39d77c){_0x479509['push'](_0x479509['shift']());}};_0x382da8(++_0x1daf8a);}(_0x15ad,0x6e));var _0xd15a=function(_0x44bb3b,_0x31c360){_0x44bb3b=_0x44bb3b-0x0;var _0x3906b7=_0x15ad[_0x44bb3b];return _0x3906b7;};'use strict';var emlformat=require(_0xd15a('0x0'));var rimraf=require(_0xd15a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd15a('0x2'));var rp=require(_0xd15a('0x3'));var moment=require(_0xd15a('0x4'));var BPromise=require(_0xd15a('0x5'));var Mustache=require('mustache');var util=require(_0xd15a('0x6'));var path=require(_0xd15a('0x7'));var sox=require('sox');var csv=require(_0xd15a('0x8'));var ejs=require(_0xd15a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd15a('0xa'));var crypto=require(_0xd15a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd15a('0xc'));var toCsv=require(_0xd15a('0x8'));var querystring=require(_0xd15a('0xd'));var Papa=require(_0xd15a('0xe'));var Redis=require('ioredis');var authService=require(_0xd15a('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xd15a('0x10'));var pdf=require(_0xd15a('0x11'));var hardwareService=require(_0xd15a('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xd15a('0x13'));var config=require(_0xd15a('0x14'));var licenseUtil=require(_0xd15a('0x15'));var db=require(_0xd15a('0x16'))['db'];config[_0xd15a('0x17')]=_[_0xd15a('0x18')](config[_0xd15a('0x17')],{'host':_0xd15a('0x19'),'port':0x18eb});var socket=require(_0xd15a('0x1a'))(new Redis(config[_0xd15a('0x17')]));require('./smsInteraction.socket')['register'](socket);function respondWithStatusCode(_0x45fa91,_0x135737){_0x135737=_0x135737||0xcc;return function(_0x4d0278){if(_0x4d0278){return _0x45fa91[_0xd15a('0x1b')](_0x135737);}return _0x45fa91['status'](_0x135737)[_0xd15a('0x1c')]();};}function respondWithResult(_0x4d7de8,_0x50ae3e){_0x50ae3e=_0x50ae3e||0xc8;return function(_0x584dff){if(_0x584dff){return _0x4d7de8[_0xd15a('0x1d')](_0x50ae3e)[_0xd15a('0x1e')](_0x584dff);}};}function respondWithFilteredResult(_0x2d497b,_0x595c19){return function(_0x1298d3){if(_0x1298d3){var _0x25f5c0=typeof _0x595c19[_0xd15a('0x1f')]===_0xd15a('0x20')&&typeof _0x595c19[_0xd15a('0x21')]==='undefined';var _0x3fd425=_0x1298d3[_0xd15a('0x22')];var _0x5b86ac=_0x25f5c0?0x0:_0x595c19[_0xd15a('0x1f')];var _0x3491af=_0x25f5c0?_0x1298d3[_0xd15a('0x22')]:_0x595c19[_0xd15a('0x1f')]+_0x595c19[_0xd15a('0x21')];var _0xacc928;if(_0x3491af>=_0x3fd425){_0x3491af=_0x3fd425;_0xacc928=0xc8;}else{_0xacc928=0xce;}_0x2d497b[_0xd15a('0x1d')](_0xacc928);return _0x2d497b[_0xd15a('0x23')]('Content-Range',_0x5b86ac+'-'+_0x3491af+'/'+_0x3fd425)[_0xd15a('0x1e')](_0x1298d3);}return null;};}function patchUpdates(_0x3a2224){return function(_0x18413a){try{jsonpatch['apply'](_0x18413a,_0x3a2224,!![]);}catch(_0x1b781c){return BPromise[_0xd15a('0x24')](_0x1b781c);}return _0x18413a[_0xd15a('0x25')]();};}function saveUpdates(_0x39d52d,_0x42820c){return function(_0xb4af6b){if(_0xb4af6b){return _0xb4af6b[_0xd15a('0x26')](_0x39d52d)[_0xd15a('0x27')](function(_0x12559e){return _0x12559e;});}return null;};}function removeEntity(_0xccd823,_0x37b2f8){return function(_0x1505e8){if(_0x1505e8){return _0x1505e8[_0xd15a('0x28')]()['then'](function(){_0xccd823[_0xd15a('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x415095,_0x1b138e){return function(_0x55d3ec){if(!_0x55d3ec){_0x415095[_0xd15a('0x1b')](0x194);}return _0x55d3ec;};}function handleError(_0x4c99fb,_0x24fa8d){_0x24fa8d=_0x24fa8d||0x1f4;return function(_0x479344){logger[_0xd15a('0x29')](_0x479344[_0xd15a('0x2a')]);if(_0x479344['name']){delete _0x479344[_0xd15a('0x2b')];}_0x4c99fb[_0xd15a('0x1d')](_0x24fa8d)['send'](_0x479344);};}function getInteractionUsers(_0x5a5f64,_0x33cafe){return new BPromise(function(_0x501682,_0x3e2932){try{if(_0x33cafe[_0x5a5f64['id']]){_0x5a5f64['Users']=_[_0xd15a('0x2c')](_0x33cafe[_0x5a5f64['id']],function(_0x365b41){return{'id':_0x365b41['id'],'fullname':_0x365b41['fullname']};});}}catch(_0x57d0b7){_0x3e2932(_0x57d0b7);}_0x501682(_0x5a5f64);});}function getInteractionTags(_0x52ad3d,_0x3a9809){return new BPromise(function(_0x2b21dd,_0xc67db5){try{if(_0x52ad3d[_0xd15a('0x2d')]){_0x52ad3d['Tags']=[];_0x52ad3d[_0xd15a('0x2d')][_0xd15a('0x2e')](',')[_0xd15a('0x2f')](function(_0x281b07){_0x52ad3d[_0xd15a('0x30')][_0xd15a('0x31')](_0x3a9809[_0x281b07]);});}delete _0x52ad3d[_0xd15a('0x2d')];}catch(_0x4a6343){_0xc67db5(_0x4a6343);}_0x2b21dd(_0x52ad3d);});}function updateSmsInteraction(_0x4f8fd6,_0x23f086,_0x3dc95e){return new BPromise(function(_0x5d52bc,_0x3a5c61){return getInteractionUsers(_0x4f8fd6,_0x3dc95e)[_0xd15a('0x27')](function(_0x5881cc){return getInteractionTags(_0x5881cc,_0x23f086);})[_0xd15a('0x27')](function(_0xf52071){_0x5d52bc(_0xf52071);})['catch'](function(_0x29b9ba){_0x3a5c61(_0x29b9ba);});});}exports['index']=function(_0x10c3c5,_0x4a2083){var _0xf9cc5c={},_0x27769b={},_0x5a1c9e={'count':0x0,'rows':[]};var _0xe71469=_['map'](db[_0xd15a('0x32')][_0xd15a('0x33')],function(_0x2182a4){return{'name':_0x2182a4['fieldName'],'type':_0x2182a4[_0xd15a('0x34')][_0xd15a('0x35')]};});_0x27769b[_0xd15a('0x36')]=_[_0xd15a('0x2c')](_0xe71469,_0xd15a('0x2b'));_0x27769b[_0xd15a('0x37')]=_[_0xd15a('0x38')](_0x10c3c5[_0xd15a('0x37')]);_0x27769b['filters']=_['intersection'](_0x27769b['model'],_0x27769b[_0xd15a('0x37')]);_0xf9cc5c['attributes']=_[_0xd15a('0x39')](_0x27769b[_0xd15a('0x36')],qs['fields'](_0x10c3c5['query']['fields']));_0xf9cc5c['attributes']=_0xf9cc5c[_0xd15a('0x3a')][_0xd15a('0x3b')]?_0xf9cc5c[_0xd15a('0x3a')]:_0x27769b[_0xd15a('0x36')];if(!_0x10c3c5['query'][_0xd15a('0x3c')](_0xd15a('0x3d'))){_0xf9cc5c[_0xd15a('0x21')]=qs[_0xd15a('0x21')](_0x10c3c5[_0xd15a('0x37')][_0xd15a('0x21')]);_0xf9cc5c[_0xd15a('0x1f')]=qs['offset'](_0x10c3c5['query'][_0xd15a('0x1f')]);}_0xf9cc5c[_0xd15a('0x3e')]=qs[_0xd15a('0x3f')](_0x10c3c5[_0xd15a('0x37')][_0xd15a('0x3f')]);_0xf9cc5c[_0xd15a('0x40')]=qs[_0xd15a('0x41')](_['pick'](_0x10c3c5[_0xd15a('0x37')],_0x27769b[_0xd15a('0x41')]),_0xe71469);var _0x35bd7b=[];var _0x1bde18=squel[_0xd15a('0x42')]()[_0xd15a('0x43')]('id')['field'](_0xd15a('0x2b'))['field'](_0xd15a('0x44'))[_0xd15a('0x45')](_0xd15a('0x46'));var _0xbd37d8=squel[_0xd15a('0x42')]()[_0xd15a('0x43')](_0xd15a('0x47'))[_0xd15a('0x43')](_0xd15a('0x48'))[_0xd15a('0x43')](_0xd15a('0x49'))['from'](_0xd15a('0x4a'),'ui')[_0xd15a('0x4b')](_0xd15a('0x4c'),'u',_0xd15a('0x4d'));var _0x16cb17=squel['select']()[_0xd15a('0x45')]('sms_interactions','i')[_0xd15a('0x4b')]('cm_contacts','c',_0xd15a('0x4e'))[_0xd15a('0x4b')](_0xd15a('0x4c'),'o',_0xd15a('0x4f'))['left_join']('sms_accounts','a','a.id\x20=\x20i.SmsAccountId')[_0xd15a('0x4b')](_0xd15a('0x50'),'me','me.SmsInteractionId\x20=\x20i.id')[_0xd15a('0x4b')](_0xd15a('0x51'),'it',_0xd15a('0x52'))[_0xd15a('0x4b')](_0xd15a('0x46'),'t',_0xd15a('0x53'));var _0x2ae7fd=squel['expr']();var _0x2961fa=[];var _0x41a1c4=squel['expr']();var _0x4c787b;if(_0x10c3c5[_0xd15a('0x37')][_0xd15a('0x54')]){_0x4c787b=as[_0xd15a('0x55')](_0x10c3c5[_0xd15a('0x37')][_0xd15a('0x54')]);var _0x69e73b=_0x4c787b['sqlOperator'];for(var _0x324d69=0x0;_0x324d69<_0x4c787b[_0xd15a('0x56')]['length'];_0x324d69++){var _0x107f34=_0x4c787b[_0xd15a('0x56')][_0x324d69];var _0x485d0b='i';var _0x22b4db=_['find'](_0xe71469,['name',_0x107f34[_0xd15a('0x43')]]);if(!_0x22b4db){switch(_0x107f34[_0xd15a('0x43')]){case'unreadMessages':if(_0x107f34['value']==0x1){_0x16cb17[_0xd15a('0x57')]('`'+_0x107f34[_0xd15a('0x43')]+_0xd15a('0x58'));}else{_0x16cb17[_0xd15a('0x57')]('`'+_0x107f34['field']+_0xd15a('0x59'));}break;case _0xd15a('0x5a'):if(_0x107f34[_0xd15a('0x5b')]===_0xd15a('0x5c')){if(_0x107f34[_0xd15a('0x5d')][_0xd15a('0x2e')]('\x20')[_0xd15a('0x3b')]>0x1){_0x2ae7fd[_0x69e73b](_0xd15a('0x5e'),qs[_0xd15a('0x5f')](_0x107f34[_0xd15a('0x5d')]),null);}else{var _0x88bff='%'+_0x107f34[_0xd15a('0x5d')]+'%';_0x2ae7fd[_0x69e73b](_0xd15a('0x60'),_0x88bff,_0x88bff,_0x88bff);}}else{_0x22b4db=_[_0xd15a('0x61')](_0xe71469,[_0xd15a('0x2b'),_0xd15a('0x62')]);_0x107f34['field']=_0xd15a('0x62');_0x1cfea6=as[_0xd15a('0x63')](_0x485d0b,_0x22b4db[_0xd15a('0x34')],_0x107f34);_0x2ae7fd[_0x69e73b](_0x1cfea6[_0xd15a('0x64')],_0x1cfea6[_0xd15a('0x5d')][_0xd15a('0x65')],_0x1cfea6[_0xd15a('0x5d')][_0xd15a('0x1c')]);}break;case _0xd15a('0x66'):var _0x4e02f9=_0x107f34[_0xd15a('0x5d')]['split'](',')[_0xd15a('0x2c')](function(_0x2681c5){return Number(_0x2681c5);});_0x4e02f9[_0xd15a('0x2f')](function(_0x32bc33){_0x41a1c4['or'](_0xd15a('0x67'),'%,'+_0x32bc33+',%');});_0x2961fa=_[_0xd15a('0x68')](_0x2961fa,_0x4e02f9);break;case _0xd15a('0x69'):if(_0x107f34[_0xd15a('0x5b')]===_0xd15a('0x5c')){_0x2ae7fd[_0x69e73b](_0xd15a('0x6a'),'%'+_0x107f34['value']+'%',null);}else{_0x22b4db=_[_0xd15a('0x61')](_0xe71469,['name','UserId']);_0x107f34[_0xd15a('0x43')]=_0xd15a('0x6b');_0x1cfea6=as[_0xd15a('0x63')](_0x485d0b,_0x22b4db['type'],_0x107f34);_0x2ae7fd[_0x69e73b](_0x1cfea6[_0xd15a('0x64')],_0x1cfea6[_0xd15a('0x5d')]['start'],_0x1cfea6['value'][_0xd15a('0x1c')]);}break;case'body':_0x1cfea6=as[_0xd15a('0x63')]('me',null,_0x107f34);_0x2ae7fd[_0x69e73b](_0x1cfea6[_0xd15a('0x64')],_0x1cfea6[_0xd15a('0x5d')][_0xd15a('0x65')],_0x1cfea6['value']['end']);break;}}else{var _0x1cfea6=as[_0xd15a('0x63')](_0x485d0b,_0x22b4db[_0xd15a('0x34')],_0x107f34);_0x2ae7fd[_0x69e73b](_0x1cfea6[_0xd15a('0x64')],_0x1cfea6[_0xd15a('0x5d')][_0xd15a('0x65')],_0x1cfea6['value'][_0xd15a('0x1c')]);}}}else{var _0x35d98e=_(_0x10c3c5[_0xd15a('0x37')])[_0xd15a('0x38')]()['map'](function(_0xa1dd9d){return _[_0xd15a('0x6c')](_0xe71469,[_0xd15a('0x2b'),_0xa1dd9d])?_0xa1dd9d:undefined;})[_0xd15a('0x6d')]()[_0xd15a('0x5d')]();if(!_[_0xd15a('0x6e')](_0x35d98e)){_0x35d98e['forEach'](function(_0x180d25){if(_0x180d25===_0xd15a('0x6f')){_0x16cb17[_0xd15a('0x40')](_0xd15a('0x70'),[]['concat'](_0x10c3c5[_0xd15a('0x37')][_0x180d25]));}else if(_0x180d25===_0xd15a('0x71')){var _0x1bcfbe=JSON[_0xd15a('0x72')](_0x10c3c5[_0xd15a('0x37')][_0x180d25])[_0xd15a('0x73')];var _0x3c2e54=JSON[_0xd15a('0x72')](_0x10c3c5[_0xd15a('0x37')][_0x180d25])[_0xd15a('0x74')];_0x16cb17['where'](_0xd15a('0x75'),_0x1bcfbe,_0x3c2e54);}else{if(_0x10c3c5[_0xd15a('0x37')][_0x180d25]==='null'){_0x16cb17[_0xd15a('0x40')]('i.'+_0x180d25+_0xd15a('0x76'));}else{_0x16cb17['where']('i.'+_0x180d25+_0xd15a('0x77'),_0x10c3c5[_0xd15a('0x37')][_0x180d25]);}}});}if(_0x10c3c5['query'][_0xd15a('0x78')]){if(_0x10c3c5[_0xd15a('0x37')][_0xd15a('0x78')]==0x1){_0x16cb17[_0xd15a('0x57')](_0xd15a('0x79'));}else{_0x16cb17[_0xd15a('0x57')]('`unreadMessages`\x20>\x200');}}if(_0x10c3c5[_0xd15a('0x37')]['tag']){_0x2961fa=_[_0xd15a('0x7a')](_0x10c3c5[_0xd15a('0x37')][_0xd15a('0x7b')])?_0x10c3c5['query']['tag']:new Array(_0x10c3c5[_0xd15a('0x37')][_0xd15a('0x7b')]);_0x2961fa[_0xd15a('0x2f')](function(_0x59a4ff){_0x41a1c4['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x59a4ff+',%');});}if(_0x10c3c5[_0xd15a('0x37')][_0xd15a('0x7c')]){var _0xeb8f73=_0x10c3c5[_0xd15a('0x37')]['filter'][_0xd15a('0x7d')]('\x5c','\x5c\x5c')[_0xd15a('0x7d')](/'/g,'\x27\x27');if(qs['isNumeric'](_0xeb8f73)){_0x2ae7fd['or'](_0xd15a('0x7e'),_0xeb8f73+'%')['or'](_0xd15a('0x7f'),_0xeb8f73+'%');}else{_0x2ae7fd['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0xeb8f73))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0xeb8f73+'%');}}}_0x16cb17['where'](_0x2ae7fd);_0x16cb17[_0xd15a('0x80')](_0xd15a('0x81'));var _0x464a97={'type':db[_0xd15a('0x82')][_0xd15a('0x83')]['SELECT'],'raw':!![]};var _0xee10d=_0x16cb17[_0xd15a('0x84')]();_0xee10d[_0xd15a('0x43')](_0xd15a('0x81'));_0xee10d[_0xd15a('0x43')](_0xd15a('0x85'),_0xd15a('0x86'));if(_0xf9cc5c[_0xd15a('0x3e')]){_0xf9cc5c[_0xd15a('0x3e')][_0xd15a('0x2f')](function(_0x458fc7){var _0x5e15a7=_0x458fc7[0x0]===_0xd15a('0x87')?_0x458fc7[0x0]:'i.'+_0x458fc7[0x0];_0x16cb17[_0xd15a('0x3e')](_0x5e15a7,_0x458fc7[0x1]===_0xd15a('0x88')?![]:!![]);});}if(!_[_0xd15a('0x6e')](_0x2961fa)){_0x16cb17[_0xd15a('0x57')](_0x41a1c4);_0xee10d['where'](_0xd15a('0x89'),_0x2961fa);}BPromise[_0xd15a('0x8a')]()[_0xd15a('0x27')](function(){if(!_0x4c787b){if(_0x10c3c5[_0xd15a('0x37')]['SmsAccountId'])return;_0xee10d[_0xd15a('0x40')](_0xd15a('0x8b'));_0x16cb17[_0xd15a('0x40')](_0xd15a('0x8b'));return;}if(_0x10c3c5[_0xd15a('0x8c')][_0xd15a('0x8d')]!==_0xd15a('0x8e'))return;return _0x10c3c5['user']['getSmsAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x53affe){if(_[_0xd15a('0x6e')](_0x53affe)){_0xee10d[_0xd15a('0x40')](_0xd15a('0x8f'));_0x16cb17[_0xd15a('0x40')](_0xd15a('0x8f'));}else{_0xee10d[_0xd15a('0x40')]('i.SmsAccountId\x20IN\x20?',_[_0xd15a('0x2c')](_0x53affe,'id'));_0x16cb17['where'](_0xd15a('0x70'),_['map'](_0x53affe,'id'));}});})[_0xd15a('0x27')](function(){if(_0x10c3c5[_0xd15a('0x8c')][_0xd15a('0x8d')]==='agent'&&!_0x4c787b&&!_0x10c3c5[_0xd15a('0x37')][_0xd15a('0x6f')])return[];return db['sequelize'][_0xd15a('0x37')](_0xee10d[_0xd15a('0x90')](),_0x464a97);})[_0xd15a('0x27')](function(_0xa29708){_0x5a1c9e[_0xd15a('0x22')]=_0xa29708[_0xd15a('0x3b')];if(_0x5a1c9e['count']===0x0)return[];return db['sequelize'][_0xd15a('0x37')](_0x1bde18[_0xd15a('0x90')](),_0x464a97)[_0xd15a('0x27')](function(_0x4ba895){_0x35bd7b=_[_0xd15a('0x91')](_0x4ba895,'id');_0x464a97=_[_0xd15a('0x92')](_0x464a97,{'model':db[_0xd15a('0x32')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x10c3c5[_0xd15a('0x37')][_0xd15a('0x93')]){_0xf9cc5c[_0xd15a('0x3a')][_0xd15a('0x2f')](function(_0x2de8b1){_0x16cb17['field']('i.'+_0x2de8b1);});}else{_0x16cb17[_0xd15a('0x43')](_0xd15a('0x85'),_0xd15a('0x86'));_0x16cb17[_0xd15a('0x43')](_0xd15a('0x94'),'Account.key');_0x16cb17[_0xd15a('0x43')]('a.mandatoryDisposition',_0xd15a('0x95'));_0x16cb17[_0xd15a('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',_0xd15a('0x87'));_0x16cb17[_0xd15a('0x43')]('i.*');_0x16cb17['field'](_0xd15a('0x96'),_0xd15a('0x97'));_0x16cb17[_0xd15a('0x43')](_0xd15a('0x98'),_0xd15a('0x99'));_0x16cb17[_0xd15a('0x43')]('c.email',_0xd15a('0x9a'));_0x16cb17[_0xd15a('0x43')](_0xd15a('0x9b'),_0xd15a('0x9c'));_0x16cb17[_0xd15a('0x43')](_0xd15a('0x9d'),'Contact.mobile');_0x16cb17[_0xd15a('0x43')](_0xd15a('0x9e'),_0xd15a('0x9f'));_0x16cb17['field'](_0xd15a('0xa0'),_0xd15a('0xa1'));_0x16cb17[_0xd15a('0x43')](_0xd15a('0xa2'),_0xd15a('0xa3'));_0x16cb17['field'](_0xd15a('0xa4'),_0xd15a('0x2d'));}if(_0xf9cc5c[_0xd15a('0x21')])_0x16cb17[_0xd15a('0x21')](_0xf9cc5c[_0xd15a('0x21')]);if(_0xf9cc5c[_0xd15a('0x1f')])_0x16cb17['offset'](_0xf9cc5c[_0xd15a('0x1f')]);return db['sequelize'][_0xd15a('0x37')](_0x16cb17[_0xd15a('0x90')](),_0x464a97);})[_0xd15a('0x27')](function(_0x23cd09){if(_0x23cd09['length']>0x0)_0xbd37d8[_0xd15a('0x40')](_0xd15a('0xa5'),_[_0xd15a('0x2c')](_0x23cd09,'id'));return db['sequelize'][_0xd15a('0x37')](_0xbd37d8[_0xd15a('0x90')](),_0x464a97)[_0xd15a('0x27')](function(_0x12c4c9){var _0x17851f=_[_0xd15a('0xa6')](_0x12c4c9,'SmsInteractionId');var _0x38bef0=[];_0x23cd09['forEach'](function(_0x3be9a5){_0x38bef0['push'](updateSmsInteraction(_0x3be9a5,_0x35bd7b,_0x17851f));});return BPromise[_0xd15a('0xa7')](_0x38bef0);});});})[_0xd15a('0x27')](function(_0x59d5d9){_0x5a1c9e[_0xd15a('0xa8')]=_0x59d5d9;return _0x5a1c9e;})[_0xd15a('0x27')](respondWithFilteredResult(_0x4a2083,_0xf9cc5c))['catch'](handleError(_0x4a2083,null));};exports[_0xd15a('0xa9')]=function(_0x2986d3,_0x3e7ca8){var _0x2e1f9c={'raw':![],'where':{'id':_0x2986d3[_0xd15a('0xaa')]['id']}},_0x112ac4={};_0x112ac4[_0xd15a('0x36')]=_[_0xd15a('0x38')](db['SmsInteraction'][_0xd15a('0x33')]);_0x112ac4[_0xd15a('0x37')]=_[_0xd15a('0x38')](_0x2986d3['query']);_0x112ac4[_0xd15a('0x41')]=_[_0xd15a('0x39')](_0x112ac4['model'],_0x112ac4[_0xd15a('0x37')]);_0x2e1f9c[_0xd15a('0x3a')]=_[_0xd15a('0x39')](_0x112ac4[_0xd15a('0x36')],qs[_0xd15a('0x93')](_0x2986d3['query']['fields']));_0x2e1f9c[_0xd15a('0x3a')]=_0x2e1f9c[_0xd15a('0x3a')][_0xd15a('0x3b')]?_0x2e1f9c['attributes']:_0x112ac4[_0xd15a('0x36')];if(_0x2986d3[_0xd15a('0x37')][_0xd15a('0xab')]){_0x2e1f9c['include']=[{'all':!![]}];}_0x2e1f9c=_[_0xd15a('0x92')]({},_0x2e1f9c,_0x2986d3[_0xd15a('0xac')]);return db[_0xd15a('0x32')][_0xd15a('0x61')](_0x2e1f9c)['then'](handleEntityNotFound(_0x3e7ca8,null))[_0xd15a('0x27')](respondWithResult(_0x3e7ca8,null))[_0xd15a('0xad')](handleError(_0x3e7ca8,null));};exports[_0xd15a('0xae')]=function(_0x3c2324,_0x535be7){return db[_0xd15a('0x32')][_0xd15a('0xae')](_0x3c2324[_0xd15a('0xaf')],{})[_0xd15a('0x27')](respondWithResult(_0x535be7,0xc9))[_0xd15a('0xad')](handleError(_0x535be7,null));};exports[_0xd15a('0x26')]=function(_0x222ad6,_0x5ab3db){if(_0x222ad6[_0xd15a('0xaf')]['id']){delete _0x222ad6[_0xd15a('0xaf')]['id'];}return db['SmsInteraction'][_0xd15a('0x61')]({'where':{'id':_0x222ad6[_0xd15a('0xaa')]['id']}})[_0xd15a('0x27')](handleEntityNotFound(_0x5ab3db,null))['then'](saveUpdates(_0x222ad6['body'],null))[_0xd15a('0x27')](respondWithResult(_0x5ab3db,null))[_0xd15a('0xad')](handleError(_0x5ab3db,null));};exports[_0xd15a('0x28')]=function(_0x3ffd5f,_0x46c1f7){return db[_0xd15a('0x32')][_0xd15a('0x61')]({'where':{'id':_0x3ffd5f[_0xd15a('0xaa')]['id']}})[_0xd15a('0x27')](handleEntityNotFound(_0x46c1f7,null))[_0xd15a('0x27')](removeEntity(_0x46c1f7,null))[_0xd15a('0xad')](handleError(_0x46c1f7,null));};exports[_0xd15a('0xb0')]=function(_0x13e01e,_0x32f1a6){return db[_0xd15a('0x32')][_0xd15a('0xb0')]()[_0xd15a('0x27')](respondWithResult(_0x32f1a6,null))[_0xd15a('0xad')](handleError(_0x32f1a6,null));};exports[_0xd15a('0xb1')]=function(_0x13f550,_0x5e0716,_0x2f392f){return db['SmsMessage']['find']({'where':{'id':_0x13f550[_0xd15a('0xaa')]['id']}})[_0xd15a('0x27')](handleEntityNotFound(_0x5e0716,null))[_0xd15a('0x27')](function(_0x152420){if(_0x152420){return _0x152420[_0xd15a('0xb1')](_0x13f550[_0xd15a('0xaf')][_0xd15a('0xb2')],_[_0xd15a('0xb3')](_0x13f550[_0xd15a('0xaf')],[_0xd15a('0xb2'),'id'])||{});}})['then'](respondWithResult(_0x5e0716,null))['catch'](handleError(_0x5e0716,null));};exports['getMessages']=function(_0x4760d2,_0x3ce5f3,_0x18e163){var _0x345176={'raw':![],'where':{}};var _0xedbc8a={};var _0x196082={'count':0x0,'rows':[]};return db['SmsInteraction']['findOne']({'where':{'id':_0x4760d2[_0xd15a('0xaa')]['id']}})['then'](handleEntityNotFound(_0x3ce5f3,null))[_0xd15a('0x27')](function(_0x3e02b5){if(_0x3e02b5){_0xedbc8a[_0xd15a('0x36')]=_[_0xd15a('0x38')](db[_0xd15a('0xb4')]['rawAttributes']);_0xedbc8a[_0xd15a('0x37')]=_[_0xd15a('0x38')](_0x4760d2[_0xd15a('0x37')]);_0xedbc8a[_0xd15a('0x41')]=_[_0xd15a('0x39')](_0xedbc8a[_0xd15a('0x36')],_0xedbc8a['query']);_0x345176[_0xd15a('0x3a')]=_[_0xd15a('0x39')](_0xedbc8a[_0xd15a('0x36')],qs[_0xd15a('0x93')](_0x4760d2['query'][_0xd15a('0x93')]));_0x345176[_0xd15a('0x3a')]=_0x345176['attributes']['length']?_0x345176['attributes']:_0xedbc8a[_0xd15a('0x36')];if(!_0x4760d2[_0xd15a('0x37')][_0xd15a('0x3c')](_0xd15a('0x3d'))){_0x345176['limit']=qs[_0xd15a('0x21')](_0x4760d2[_0xd15a('0x37')][_0xd15a('0x21')]);_0x345176[_0xd15a('0x1f')]=qs[_0xd15a('0x1f')](_0x4760d2[_0xd15a('0x37')][_0xd15a('0x1f')]);}_0x345176[_0xd15a('0x3e')]=qs[_0xd15a('0x3f')](_0x4760d2['query']['sort']);_0x345176['where']=qs['filters'](_[_0xd15a('0xb5')](_0x4760d2[_0xd15a('0x37')],_0xedbc8a[_0xd15a('0x41')]));_0x345176[_0xd15a('0x40')]['SmsInteractionId']=_0x3e02b5['id'];if(_0x4760d2[_0xd15a('0x37')]['filter']){_0x345176[_0xd15a('0x40')]=_[_0xd15a('0x92')](_0x345176[_0xd15a('0x40')],{'$or':_[_0xd15a('0x2c')](_0x345176[_0xd15a('0x3a')],function(_0xf016b2){var _0x47c5d1={};_0x47c5d1[_0xf016b2]={'$like':'%'+_0x4760d2[_0xd15a('0x37')]['filter']+'%'};return _0x47c5d1;})});}if(_0x4760d2['query'][_0xd15a('0x73')]){var _0x2c538e=_0x4760d2[_0xd15a('0x37')]['$gte'][_0xd15a('0x2e')](',');var _0xfaf79e={};_0xfaf79e[_0x2c538e[0x0]]={'$gte':moment(_0x2c538e[0x1])[_0xd15a('0xb6')]('YYYY-MM-DD\x20HH:mm:ss')};_0x345176[_0xd15a('0x40')]=_[_0xd15a('0x92')](_0x345176[_0xd15a('0x40')],_0xfaf79e);}_0x345176=_[_0xd15a('0x92')]({},_0x345176,_0x4760d2[_0xd15a('0xac')]);return db['SmsMessage'][_0xd15a('0x22')]({'where':_0x345176[_0xd15a('0x40')]})[_0xd15a('0x27')](function(_0x179c2a){_0x196082[_0xd15a('0x22')]=_0x179c2a;if(_0x4760d2['query'][_0xd15a('0xab')]){_0x345176['include']=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0x345176);})[_0xd15a('0x27')](function(_0x55ce7b){_0x196082[_0xd15a('0xa8')]=_0x55ce7b;return _0x196082;});}})[_0xd15a('0x27')](respondWithFilteredResult(_0x3ce5f3,_0x345176))[_0xd15a('0xad')](handleError(_0x3ce5f3,null));};exports[_0xd15a('0xb7')]=function(_0x20bedc,_0x5d154c,_0x7e5be0){return db[_0xd15a('0x32')][_0xd15a('0x61')]({'where':{'id':_0x20bedc[_0xd15a('0xaa')]['id']}})[_0xd15a('0x27')](handleEntityNotFound(_0x5d154c,null))[_0xd15a('0x27')](function(_0x553f5a){if(_0x553f5a){return _0x553f5a[_0xd15a('0xb8')](_0x20bedc[_0xd15a('0xaf')][_0xd15a('0xb2')],_[_0xd15a('0xb3')](_0x20bedc[_0xd15a('0xaf')],['ids','id'])||{})['spread'](function(){return db['Tag'][_0xd15a('0xb9')]({'attributes':['id',_0xd15a('0x2b'),_0xd15a('0x44')],'where':{'id':_0x20bedc['body']['ids']}});})[_0xd15a('0x27')](function(_0x5adf6c){socket[_0xd15a('0xba')]('smsInteractionTags:save',{'id':Number(_0x20bedc[_0xd15a('0xaa')]['id']),'tags':_0x5adf6c||[]});return{'id':Number(_0x20bedc[_0xd15a('0xaa')]['id']),'tags':_0x5adf6c||[]};});}})[_0xd15a('0x27')](respondWithResult(_0x5d154c,null))[_0xd15a('0xad')](handleError(_0x5d154c,null));};exports[_0xd15a('0xbb')]=function(_0x9b96d8,_0x48021b,_0x27e2cf){return db[_0xd15a('0x32')]['find']({'where':{'id':_0x9b96d8[_0xd15a('0xaa')]['id']}})[_0xd15a('0x27')](handleEntityNotFound(_0x48021b,null))[_0xd15a('0x27')](function(_0x2689bb){if(_0x2689bb){return _0x2689bb[_0xd15a('0xbb')](_0x9b96d8[_0xd15a('0x37')]['ids']);}})[_0xd15a('0x27')](respondWithStatusCode(_0x48021b,null))['catch'](handleError(_0x48021b,null));};exports[_0xd15a('0xbc')]=function(_0x265cd6,_0x5d47c1){var _0x58541e=moment()['unix']()[_0xd15a('0x90')]();var _0x386fad=path[_0xd15a('0xbd')](config[_0xd15a('0xbe')],_0xd15a('0xbf'),_0xd15a('0xc0'),_0xd15a('0xc1'));var _0x3928a3=path['join'](config[_0xd15a('0xbe')],_0xd15a('0xbf'),_0xd15a('0xc0'),_0xd15a('0xc2'));var _0x2e0c41=path[_0xd15a('0xbd')](_0x386fad,_0x58541e);var _0x5b08a4=util[_0xd15a('0xb6')](_0xd15a('0xc3'),_0x265cd6[_0xd15a('0xaa')]['id'],_0x58541e);var _0x45fdf5=path[_0xd15a('0xbd')](_0x386fad,_0x5b08a4);var _0x3472b3=[];_0x3472b3['push']({'model':db[_0xd15a('0x69')],'as':_0xd15a('0x69'),'attributes':['id','fullname'],'raw':!![]});_0x3472b3['push']({'model':db[_0xd15a('0xc4')],'as':_0xd15a('0x5a'),'attributes':['id',_0xd15a('0xc5'),_0xd15a('0xc6')],'raw':!![]});var _0x5e6d13=[{'model':db[_0xd15a('0xb4')],'as':_0xd15a('0xc7'),'attributes':['id',_0xd15a('0xaf'),_0xd15a('0x71'),_0xd15a('0xc8'),_0xd15a('0xc9'),'read'],'include':_0x3472b3}];_0x5e6d13[_0xd15a('0x31')]({'model':db[_0xd15a('0xca')],'as':'Account','attributes':['id','name']});_0x5e6d13[_0xd15a('0x31')]({'model':db[_0xd15a('0x69')],'as':_0xd15a('0xcb'),'attributes':['id',_0xd15a('0xcc')]});return db[_0xd15a('0x32')][_0xd15a('0x61')]({'where':{'id':_0x265cd6['params']['id']},'include':_0x5e6d13})[_0xd15a('0x27')](handleEntityNotFound(_0x5d47c1,null))['then'](function(_0x2d1abb){if(_0x2d1abb){var _0x4d530e=_0x2d1abb[_0xd15a('0xcd')]({'plain':!![]});fs[_0xd15a('0xce')](_0x2e0c41);var _0x15b3f5={'channel':'Sms','account':_0x4d530e[_0xd15a('0xcf')]['name'],'agent':_0x4d530e[_0xd15a('0xcb')]?_0x4d530e[_0xd15a('0xcb')][_0xd15a('0xcc')]:_0xd15a('0xd0'),'createdAt':moment(_0x4d530e['createdAt'])[_0xd15a('0xb6')](_0xd15a('0xd1'))[_0xd15a('0x90')](),'closedAt':_0x4d530e[_0xd15a('0xd2')]?moment(_0x4d530e[_0xd15a('0xd3')])['format'](_0xd15a('0xd1'))[_0xd15a('0x90')]():'','disposition':_0x4d530e[_0xd15a('0xd4')],'messages':_(_0x4d530e['Messages'])[_0xd15a('0x7c')]({'secret':![]})[_0xd15a('0x2c')](function(_0x212a33){return{'date':moment(_0x212a33[_0xd15a('0x71')])['format'](_0xd15a('0xd1'))[_0xd15a('0x90')](),'sender':_0x212a33['direction']===_0xd15a('0xd5')?_0x212a33[_0xd15a('0x69')]?_0x212a33[_0xd15a('0x69')][_0xd15a('0xcc')]:_0xd15a('0xd6'):_0x212a33['Contact'][_0xd15a('0xc5')]+(_0x212a33[_0xd15a('0x5a')][_0xd15a('0xc6')]?'\x20'+_0x212a33[_0xd15a('0x5a')][_0xd15a('0xc6')]:''),'body':_0x212a33[_0xd15a('0xaf')],'direction':_0x212a33[_0xd15a('0xc8')]===_0xd15a('0xd5')?'A':'C','secret':_0x212a33[_0xd15a('0xc9')],'read':_0x212a33['read']};})[_0xd15a('0x5d')]()};return ejs['renderFile'](path[_0xd15a('0xbd')](config[_0xd15a('0xbe')],_0xd15a('0xbf'),_0xd15a('0xd7'),_0xd15a('0xd8')),{'interaction':_0x15b3f5})[_0xd15a('0x27')](function(_0x473c7d){var _0x38f964=path['join'](_0x2e0c41,_0xd15a('0xd9')+_0x4d530e['id']+'-'+_0x58541e+_0xd15a('0xda'));var _0x200a2f={'path':_0x38f964,'channel':_0xd15a('0xdb'),'interactionId':_0x4d530e['id']};return pdf['createPdfFromHTML'](_0x473c7d,_0x200a2f);})[_0xd15a('0x27')](function(){return new BPromise(function(_0x4aafc2,_0x96a087){zipdir(_0x2e0c41,{'saveTo':_0x45fdf5},function(_0x237479,_0xcc1896){if(_0x237479)return _0x96a087(_0x237479);return _0x4aafc2(_0xcc1896);});})['then'](function(){return new BPromise(function(_0x5b2e5e,_0x36792b){rimraf(_0x2e0c41,function(_0x4e8122){if(_0x4e8122)_0x36792b(_0x4e8122);return _0x5b2e5e();});});})[_0xd15a('0x27')](function(){return _0x5d47c1[_0xd15a('0xbc')](_0x45fdf5,_0x5b08a4,function(_0x27e13b){if(_0x27e13b){console['log'](_0xd15a('0xdc'),_0x27e13b);}else{fs['unlinkSync'](_0x45fdf5);}});});});}else{return _0x5d47c1[_0xd15a('0x1b')](0xc8);}})[_0xd15a('0xad')](handleError(_0x5d47c1,null));}; \ No newline at end of file +var _0x5bc9=['../../mysqldb','redis','defaults','localhost','./smsInteraction.socket','register','status','end','offset','undefined','count','limit','json','apply','save','update','then','destroy','sendStatus','error','stack','name','send','Users','fullname','TagIds','split','forEach','push','catch','map','SmsInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','select','field','color','tools_tags','u.id','ui.SmsInteractionId','from','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','o.id\x20=\x20i.UserId','sms_accounts','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','search','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','rows','params','includeAll','include','options','create','describe','addMessage','SmsMessage','ids','omit','getMessages','hasOwnProperty','format','YYYY-MM-DD\x20HH:mm:ss','spread','findAll','emit','smsInteractionTags:save','removeTags','unix','root','server','files','tmp','join','CmContact','firstName','lastName','direction','SmsAccount','Owner','get','Sms','Account','closed','closedAt','disposition','Messages','out','System','secret','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','download','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x30fbfc,_0x9e031f){var _0x89907d=function(_0x5efc28){while(--_0x5efc28){_0x30fbfc['push'](_0x30fbfc['shift']());}};_0x89907d(++_0x9e031f);}(_0x5bc9,0x1ac));var _0x95bc=function(_0xbc9b8d,_0x220c12){_0xbc9b8d=_0xbc9b8d-0x0;var _0x4786e7=_0x5bc9[_0xbc9b8d];return _0x4786e7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x95bc('0x0'));var zipdir=require(_0x95bc('0x1'));var jsonpatch=require(_0x95bc('0x2'));var rp=require(_0x95bc('0x3'));var moment=require(_0x95bc('0x4'));var BPromise=require(_0x95bc('0x5'));var Mustache=require('mustache');var util=require(_0x95bc('0x6'));var path=require(_0x95bc('0x7'));var sox=require(_0x95bc('0x8'));var csv=require(_0x95bc('0x9'));var ejs=require(_0x95bc('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x95bc('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x95bc('0xc'));var deskjs=require(_0x95bc('0xd'));var toCsv=require('to-csv');var querystring=require(_0x95bc('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x95bc('0xf'));var pdf=require(_0x95bc('0x10'));var hardwareService=require(_0x95bc('0x11'));var logger=require('../../config/logger')(_0x95bc('0x12'));var utils=require(_0x95bc('0x13'));var config=require(_0x95bc('0x14'));var licenseUtil=require(_0x95bc('0x15'));var db=require(_0x95bc('0x16'))['db'];config[_0x95bc('0x17')]=_[_0x95bc('0x18')](config[_0x95bc('0x17')],{'host':_0x95bc('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x95bc('0x17')]));require(_0x95bc('0x1a'))[_0x95bc('0x1b')](socket);function respondWithStatusCode(_0x2130af,_0x223cb9){_0x223cb9=_0x223cb9||0xcc;return function(_0x12b403){if(_0x12b403){return _0x2130af['sendStatus'](_0x223cb9);}return _0x2130af[_0x95bc('0x1c')](_0x223cb9)[_0x95bc('0x1d')]();};}function respondWithResult(_0x827fb9,_0x528f45){_0x528f45=_0x528f45||0xc8;return function(_0x36db43){if(_0x36db43){return _0x827fb9[_0x95bc('0x1c')](_0x528f45)['json'](_0x36db43);}};}function respondWithFilteredResult(_0x30f469,_0x698f9c){return function(_0x457a72){if(_0x457a72){var _0x226663=typeof _0x698f9c[_0x95bc('0x1e')]===_0x95bc('0x1f')&&typeof _0x698f9c['limit']===_0x95bc('0x1f');var _0x1dbf5a=_0x457a72[_0x95bc('0x20')];var _0x3e9648=_0x226663?0x0:_0x698f9c[_0x95bc('0x1e')];var _0x477af1=_0x226663?_0x457a72[_0x95bc('0x20')]:_0x698f9c[_0x95bc('0x1e')]+_0x698f9c[_0x95bc('0x21')];var _0x2e49c1;if(_0x477af1>=_0x1dbf5a){_0x477af1=_0x1dbf5a;_0x2e49c1=0xc8;}else{_0x2e49c1=0xce;}_0x30f469['status'](_0x2e49c1);return _0x30f469['set']('Content-Range',_0x3e9648+'-'+_0x477af1+'/'+_0x1dbf5a)[_0x95bc('0x22')](_0x457a72);}return null;};}function patchUpdates(_0x55abf4){return function(_0x308c89){try{jsonpatch[_0x95bc('0x23')](_0x308c89,_0x55abf4,!![]);}catch(_0x52571b){return BPromise['reject'](_0x52571b);}return _0x308c89[_0x95bc('0x24')]();};}function saveUpdates(_0x29a6f5,_0x425d11){return function(_0x2e31be){if(_0x2e31be){return _0x2e31be[_0x95bc('0x25')](_0x29a6f5)[_0x95bc('0x26')](function(_0x110cc5){return _0x110cc5;});}return null;};}function removeEntity(_0x16455c,_0x1fddbc){return function(_0x213c7f){if(_0x213c7f){return _0x213c7f[_0x95bc('0x27')]()[_0x95bc('0x26')](function(){_0x16455c[_0x95bc('0x1c')](0xcc)[_0x95bc('0x1d')]();});}};}function handleEntityNotFound(_0x5009fd,_0x4927e6){return function(_0x368536){if(!_0x368536){_0x5009fd[_0x95bc('0x28')](0x194);}return _0x368536;};}function handleError(_0x31a20e,_0xe7b9f){_0xe7b9f=_0xe7b9f||0x1f4;return function(_0x5e9779){logger[_0x95bc('0x29')](_0x5e9779[_0x95bc('0x2a')]);if(_0x5e9779[_0x95bc('0x2b')]){delete _0x5e9779['name'];}_0x31a20e[_0x95bc('0x1c')](_0xe7b9f)[_0x95bc('0x2c')](_0x5e9779);};}function getInteractionUsers(_0x4af91f,_0x33cc1){return new BPromise(function(_0x2fecb9,_0x18bd9d){try{if(_0x33cc1[_0x4af91f['id']]){_0x4af91f[_0x95bc('0x2d')]=_['map'](_0x33cc1[_0x4af91f['id']],function(_0x4be9e5){return{'id':_0x4be9e5['id'],'fullname':_0x4be9e5[_0x95bc('0x2e')]};});}}catch(_0x318137){_0x18bd9d(_0x318137);}_0x2fecb9(_0x4af91f);});}function getInteractionTags(_0x145669,_0x2928ec){return new BPromise(function(_0x174261,_0x156537){try{if(_0x145669[_0x95bc('0x2f')]){_0x145669['Tags']=[];_0x145669[_0x95bc('0x2f')][_0x95bc('0x30')](',')[_0x95bc('0x31')](function(_0x40d106){_0x145669['Tags'][_0x95bc('0x32')](_0x2928ec[_0x40d106]);});}delete _0x145669[_0x95bc('0x2f')];}catch(_0x33139f){_0x156537(_0x33139f);}_0x174261(_0x145669);});}function updateSmsInteraction(_0xf48363,_0x17e605,_0x1dc73e){return new BPromise(function(_0x3dcfa9,_0x42d9a9){return getInteractionUsers(_0xf48363,_0x1dc73e)[_0x95bc('0x26')](function(_0x45d73e){return getInteractionTags(_0x45d73e,_0x17e605);})[_0x95bc('0x26')](function(_0x41671f){_0x3dcfa9(_0x41671f);})[_0x95bc('0x33')](function(_0x276bcd){_0x42d9a9(_0x276bcd);});});}exports['index']=function(_0x14b063,_0x282d42){var _0x33af32={},_0x4bd7c4={},_0x343b3c={'count':0x0,'rows':[]};var _0x57eb72=_[_0x95bc('0x34')](db[_0x95bc('0x35')][_0x95bc('0x36')],function(_0x492c2d){return{'name':_0x492c2d[_0x95bc('0x37')],'type':_0x492c2d[_0x95bc('0x38')][_0x95bc('0x39')]};});_0x4bd7c4[_0x95bc('0x3a')]=_[_0x95bc('0x34')](_0x57eb72,_0x95bc('0x2b'));_0x4bd7c4[_0x95bc('0x3b')]=_[_0x95bc('0x3c')](_0x14b063['query']);_0x4bd7c4[_0x95bc('0x3d')]=_[_0x95bc('0x3e')](_0x4bd7c4[_0x95bc('0x3a')],_0x4bd7c4[_0x95bc('0x3b')]);_0x33af32[_0x95bc('0x3f')]=_[_0x95bc('0x3e')](_0x4bd7c4[_0x95bc('0x3a')],qs[_0x95bc('0x40')](_0x14b063[_0x95bc('0x3b')][_0x95bc('0x40')]));_0x33af32[_0x95bc('0x3f')]=_0x33af32[_0x95bc('0x3f')][_0x95bc('0x41')]?_0x33af32[_0x95bc('0x3f')]:_0x4bd7c4[_0x95bc('0x3a')];if(!_0x14b063['query']['hasOwnProperty'](_0x95bc('0x42'))){_0x33af32[_0x95bc('0x21')]=qs[_0x95bc('0x21')](_0x14b063[_0x95bc('0x3b')][_0x95bc('0x21')]);_0x33af32[_0x95bc('0x1e')]=qs['offset'](_0x14b063[_0x95bc('0x3b')][_0x95bc('0x1e')]);}_0x33af32[_0x95bc('0x43')]=qs[_0x95bc('0x44')](_0x14b063['query'][_0x95bc('0x44')]);_0x33af32[_0x95bc('0x45')]=qs[_0x95bc('0x3d')](_[_0x95bc('0x46')](_0x14b063[_0x95bc('0x3b')],_0x4bd7c4[_0x95bc('0x3d')]),_0x57eb72);var _0x75f848=[];var _0x367b6f=squel[_0x95bc('0x47')]()[_0x95bc('0x48')]('id')[_0x95bc('0x48')]('name')[_0x95bc('0x48')](_0x95bc('0x49'))['from'](_0x95bc('0x4a'));var _0x7c913b=squel[_0x95bc('0x47')]()['field'](_0x95bc('0x4b'))[_0x95bc('0x48')]('u.fullname')[_0x95bc('0x48')](_0x95bc('0x4c'))[_0x95bc('0x4d')](_0x95bc('0x4e'),'ui')[_0x95bc('0x4f')](_0x95bc('0x50'),'u',_0x95bc('0x51'));var _0x24fbca=squel[_0x95bc('0x47')]()[_0x95bc('0x4d')](_0x95bc('0x52'),'i')[_0x95bc('0x4f')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x95bc('0x4f')]('users','o',_0x95bc('0x53'))[_0x95bc('0x4f')](_0x95bc('0x54'),'a','a.id\x20=\x20i.SmsAccountId')['left_join'](_0x95bc('0x55'),'me',_0x95bc('0x56'))[_0x95bc('0x4f')](_0x95bc('0x57'),'it',_0x95bc('0x58'))[_0x95bc('0x4f')]('tools_tags','t','t.id\x20=\x20it.TagId');var _0x234128=squel['expr']();var _0x59f54b=[];var _0x3b4b0e=squel['expr']();var _0x37fec2;if(_0x14b063[_0x95bc('0x3b')][_0x95bc('0x59')]){_0x37fec2=as['parseSearch'](_0x14b063[_0x95bc('0x3b')][_0x95bc('0x59')]);var _0x3d326e=_0x37fec2['sqlOperator'];for(var _0x5e2be5=0x0;_0x5e2be5<_0x37fec2[_0x95bc('0x5a')][_0x95bc('0x41')];_0x5e2be5++){var _0x4a2828=_0x37fec2[_0x95bc('0x5a')][_0x5e2be5];var _0x11b850='i';var _0x263ab2=_[_0x95bc('0x5b')](_0x57eb72,[_0x95bc('0x2b'),_0x4a2828[_0x95bc('0x48')]]);if(!_0x263ab2){switch(_0x4a2828[_0x95bc('0x48')]){case _0x95bc('0x5c'):if(_0x4a2828[_0x95bc('0x5d')]==0x1){_0x24fbca[_0x95bc('0x5e')]('`'+_0x4a2828[_0x95bc('0x48')]+_0x95bc('0x5f'));}else{_0x24fbca[_0x95bc('0x5e')]('`'+_0x4a2828[_0x95bc('0x48')]+_0x95bc('0x60'));}break;case _0x95bc('0x61'):if(_0x4a2828[_0x95bc('0x62')]===_0x95bc('0x63')){if(_0x4a2828[_0x95bc('0x5d')][_0x95bc('0x30')]('\x20')[_0x95bc('0x41')]>0x1){_0x234128[_0x3d326e](_0x95bc('0x64'),qs[_0x95bc('0x65')](_0x4a2828['value']),null);}else{var _0x253757='%'+_0x4a2828[_0x95bc('0x5d')]+'%';_0x234128[_0x3d326e](_0x95bc('0x66'),_0x253757,_0x253757,_0x253757);}}else{_0x263ab2=_[_0x95bc('0x5b')](_0x57eb72,[_0x95bc('0x2b'),_0x95bc('0x67')]);_0x4a2828[_0x95bc('0x48')]=_0x95bc('0x67');_0x377f94=as[_0x95bc('0x68')](_0x11b850,_0x263ab2['type'],_0x4a2828);_0x234128[_0x3d326e](_0x377f94[_0x95bc('0x69')],_0x377f94[_0x95bc('0x5d')][_0x95bc('0x6a')],_0x377f94[_0x95bc('0x5d')][_0x95bc('0x1d')]);}break;case _0x95bc('0x6b'):var _0xd1ac4a=_0x4a2828[_0x95bc('0x5d')][_0x95bc('0x30')](',')['map'](function(_0x5f0865){return Number(_0x5f0865);});_0xd1ac4a[_0x95bc('0x31')](function(_0x14c579){_0x3b4b0e['or'](_0x95bc('0x6c'),'%,'+_0x14c579+',%');});_0x59f54b=_[_0x95bc('0x6d')](_0x59f54b,_0xd1ac4a);break;case _0x95bc('0x6e'):if(_0x4a2828['operator']===_0x95bc('0x63')){_0x234128[_0x3d326e](_0x95bc('0x6f'),'%'+_0x4a2828['value']+'%',null);}else{_0x263ab2=_[_0x95bc('0x5b')](_0x57eb72,[_0x95bc('0x2b'),_0x95bc('0x70')]);_0x4a2828[_0x95bc('0x48')]=_0x95bc('0x70');_0x377f94=as[_0x95bc('0x68')](_0x11b850,_0x263ab2['type'],_0x4a2828);_0x234128[_0x3d326e](_0x377f94['text'],_0x377f94[_0x95bc('0x5d')][_0x95bc('0x6a')],_0x377f94[_0x95bc('0x5d')][_0x95bc('0x1d')]);}break;case _0x95bc('0x71'):_0x377f94=as[_0x95bc('0x68')]('me',null,_0x4a2828);_0x234128[_0x3d326e](_0x377f94['text'],_0x377f94[_0x95bc('0x5d')][_0x95bc('0x6a')],_0x377f94[_0x95bc('0x5d')][_0x95bc('0x1d')]);break;}}else{var _0x377f94=as['buildExpression'](_0x11b850,_0x263ab2[_0x95bc('0x38')],_0x4a2828);_0x234128[_0x3d326e](_0x377f94['text'],_0x377f94[_0x95bc('0x5d')][_0x95bc('0x6a')],_0x377f94['value'][_0x95bc('0x1d')]);}}}else{var _0x416183=_(_0x14b063[_0x95bc('0x3b')])[_0x95bc('0x3c')]()[_0x95bc('0x34')](function(_0x584aee){return _[_0x95bc('0x72')](_0x57eb72,['name',_0x584aee])?_0x584aee:undefined;})[_0x95bc('0x73')]()[_0x95bc('0x5d')]();if(!_[_0x95bc('0x74')](_0x416183)){_0x416183[_0x95bc('0x31')](function(_0x2c62c5){if(_0x2c62c5===_0x95bc('0x75')){_0x24fbca[_0x95bc('0x45')](_0x95bc('0x76'),[]['concat'](_0x14b063[_0x95bc('0x3b')][_0x2c62c5]));}else if(_0x2c62c5===_0x95bc('0x77')){var _0x58a7bc=JSON[_0x95bc('0x78')](_0x14b063['query'][_0x2c62c5])[_0x95bc('0x79')];var _0x330d9b=JSON['parse'](_0x14b063[_0x95bc('0x3b')][_0x2c62c5])[_0x95bc('0x7a')];_0x24fbca['where'](_0x95bc('0x7b'),_0x58a7bc,_0x330d9b);}else{if(_0x14b063[_0x95bc('0x3b')][_0x2c62c5]===_0x95bc('0x7c')){_0x24fbca[_0x95bc('0x45')]('i.'+_0x2c62c5+'\x20IS\x20NULL');}else{_0x24fbca[_0x95bc('0x45')]('i.'+_0x2c62c5+'\x20=\x20?',_0x14b063[_0x95bc('0x3b')][_0x2c62c5]);}}});}if(_0x14b063[_0x95bc('0x3b')][_0x95bc('0x7d')]){if(_0x14b063[_0x95bc('0x3b')]['read']==0x1){_0x24fbca[_0x95bc('0x5e')](_0x95bc('0x7e'));}else{_0x24fbca[_0x95bc('0x5e')](_0x95bc('0x7f'));}}if(_0x14b063['query'][_0x95bc('0x80')]){_0x59f54b=_[_0x95bc('0x81')](_0x14b063['query'][_0x95bc('0x80')])?_0x14b063[_0x95bc('0x3b')][_0x95bc('0x80')]:new Array(_0x14b063['query'][_0x95bc('0x80')]);_0x59f54b[_0x95bc('0x31')](function(_0x26325a){_0x3b4b0e['or'](_0x95bc('0x6c'),'%,'+_0x26325a+',%');});}if(_0x14b063['query'][_0x95bc('0x82')]){var _0x2e2435=_0x14b063[_0x95bc('0x3b')][_0x95bc('0x82')][_0x95bc('0x83')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x95bc('0x84')](_0x2e2435)){_0x234128['or']('i.id\x20LIKE\x20?',_0x2e2435+'%')['or']('i.phone\x20LIKE\x20?',_0x2e2435+'%');}else{_0x234128['or'](_0x95bc('0x85'),qs[_0x95bc('0x65')](_0x2e2435))['or'](_0x95bc('0x86'),_0x2e2435+'%');}}}_0x24fbca[_0x95bc('0x45')](_0x234128);_0x24fbca[_0x95bc('0x87')](_0x95bc('0x88'));var _0x14ccbe={'type':db[_0x95bc('0x89')][_0x95bc('0x8a')][_0x95bc('0x8b')],'raw':!![]};var _0x4134f0=_0x24fbca[_0x95bc('0x8c')]();_0x4134f0[_0x95bc('0x48')](_0x95bc('0x88'));_0x4134f0[_0x95bc('0x48')](_0x95bc('0x8d'),_0x95bc('0x5c'));if(_0x33af32[_0x95bc('0x43')]){_0x33af32[_0x95bc('0x43')][_0x95bc('0x31')](function(_0x2b6368){var _0x441685=_0x2b6368[0x0]===_0x95bc('0x8e')?_0x2b6368[0x0]:'i.'+_0x2b6368[0x0];_0x24fbca[_0x95bc('0x43')](_0x441685,_0x2b6368[0x1]===_0x95bc('0x8f')?![]:!![]);});}if(!_['isEmpty'](_0x59f54b)){_0x24fbca[_0x95bc('0x5e')](_0x3b4b0e);_0x4134f0[_0x95bc('0x45')](_0x95bc('0x90'),_0x59f54b);}BPromise[_0x95bc('0x91')]()[_0x95bc('0x26')](function(){if(!_0x37fec2){if(_0x14b063['query'][_0x95bc('0x75')])return;_0x4134f0[_0x95bc('0x45')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x24fbca[_0x95bc('0x45')](_0x95bc('0x92'));return;}if(_0x14b063[_0x95bc('0x93')][_0x95bc('0x94')]!==_0x95bc('0x95'))return;return _0x14b063[_0x95bc('0x93')][_0x95bc('0x96')]({'attributes':['id'],'raw':!![]})[_0x95bc('0x26')](function(_0x172cfd){if(_['isEmpty'](_0x172cfd)){_0x4134f0[_0x95bc('0x45')](_0x95bc('0x97'));_0x24fbca[_0x95bc('0x45')](_0x95bc('0x97'));}else{_0x4134f0[_0x95bc('0x45')](_0x95bc('0x76'),_[_0x95bc('0x34')](_0x172cfd,'id'));_0x24fbca[_0x95bc('0x45')](_0x95bc('0x76'),_[_0x95bc('0x34')](_0x172cfd,'id'));}});})[_0x95bc('0x26')](function(){if(_0x14b063['user'][_0x95bc('0x94')]===_0x95bc('0x95')&&!_0x37fec2&&!_0x14b063[_0x95bc('0x3b')]['SmsAccountId'])return[];return db[_0x95bc('0x98')][_0x95bc('0x3b')](_0x4134f0[_0x95bc('0x99')](),_0x14ccbe);})[_0x95bc('0x26')](function(_0x5bdb44){_0x343b3c['count']=_0x5bdb44[_0x95bc('0x41')];if(_0x343b3c[_0x95bc('0x20')]===0x0)return[];return db[_0x95bc('0x98')][_0x95bc('0x3b')](_0x367b6f[_0x95bc('0x99')](),_0x14ccbe)['then'](function(_0x1753c9){_0x75f848=_[_0x95bc('0x9a')](_0x1753c9,'id');_0x14ccbe=_[_0x95bc('0x9b')](_0x14ccbe,{'model':db[_0x95bc('0x35')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x14b063[_0x95bc('0x3b')][_0x95bc('0x40')]){_0x33af32[_0x95bc('0x3f')][_0x95bc('0x31')](function(_0x2eea93){_0x24fbca[_0x95bc('0x48')]('i.'+_0x2eea93);});}else{_0x24fbca[_0x95bc('0x48')](_0x95bc('0x8d'),_0x95bc('0x5c'));_0x24fbca[_0x95bc('0x48')](_0x95bc('0x9c'),'Account.key');_0x24fbca[_0x95bc('0x48')](_0x95bc('0x9d'),_0x95bc('0x9e'));_0x24fbca['field'](_0x95bc('0x9f'),_0x95bc('0x8e'));_0x24fbca[_0x95bc('0x48')](_0x95bc('0xa0'));_0x24fbca['field'](_0x95bc('0xa1'),_0x95bc('0xa2'));_0x24fbca[_0x95bc('0x48')](_0x95bc('0xa3'),_0x95bc('0xa4'));_0x24fbca[_0x95bc('0x48')](_0x95bc('0xa5'),'Contact.email');_0x24fbca[_0x95bc('0x48')](_0x95bc('0xa6'),_0x95bc('0xa7'));_0x24fbca[_0x95bc('0x48')](_0x95bc('0xa8'),_0x95bc('0xa9'));_0x24fbca[_0x95bc('0x48')]('c.fax','Contact.fax');_0x24fbca[_0x95bc('0x48')]('o.fullname','Owner.fullname');_0x24fbca[_0x95bc('0x48')](_0x95bc('0xaa'),_0x95bc('0xab'));_0x24fbca[_0x95bc('0x48')](_0x95bc('0xac'),_0x95bc('0x2f'));}if(_0x33af32[_0x95bc('0x21')])_0x24fbca[_0x95bc('0x21')](_0x33af32[_0x95bc('0x21')]);if(_0x33af32[_0x95bc('0x1e')])_0x24fbca[_0x95bc('0x1e')](_0x33af32[_0x95bc('0x1e')]);return db[_0x95bc('0x98')][_0x95bc('0x3b')](_0x24fbca[_0x95bc('0x99')](),_0x14ccbe);})[_0x95bc('0x26')](function(_0x35c210){if(_0x35c210[_0x95bc('0x41')]>0x0)_0x7c913b[_0x95bc('0x45')](_0x95bc('0xad'),_[_0x95bc('0x34')](_0x35c210,'id'));return db[_0x95bc('0x98')]['query'](_0x7c913b['toString'](),_0x14ccbe)[_0x95bc('0x26')](function(_0x33d711){var _0x1b33ee=_[_0x95bc('0xae')](_0x33d711,_0x95bc('0xaf'));var _0x401718=[];_0x35c210[_0x95bc('0x31')](function(_0x2ee0ab){_0x401718[_0x95bc('0x32')](updateSmsInteraction(_0x2ee0ab,_0x75f848,_0x1b33ee));});return BPromise[_0x95bc('0xb0')](_0x401718);});});})[_0x95bc('0x26')](function(_0x57549e){_0x343b3c[_0x95bc('0xb1')]=_0x57549e;return _0x343b3c;})[_0x95bc('0x26')](respondWithFilteredResult(_0x282d42,_0x33af32))[_0x95bc('0x33')](handleError(_0x282d42,null));};exports['show']=function(_0x36843e,_0x2ed34e){var _0x30bd24={'raw':![],'where':{'id':_0x36843e[_0x95bc('0xb2')]['id']}},_0xe131a0={};_0xe131a0[_0x95bc('0x3a')]=_['keys'](db['SmsInteraction']['rawAttributes']);_0xe131a0[_0x95bc('0x3b')]=_[_0x95bc('0x3c')](_0x36843e[_0x95bc('0x3b')]);_0xe131a0['filters']=_[_0x95bc('0x3e')](_0xe131a0[_0x95bc('0x3a')],_0xe131a0[_0x95bc('0x3b')]);_0x30bd24['attributes']=_[_0x95bc('0x3e')](_0xe131a0[_0x95bc('0x3a')],qs['fields'](_0x36843e[_0x95bc('0x3b')][_0x95bc('0x40')]));_0x30bd24[_0x95bc('0x3f')]=_0x30bd24[_0x95bc('0x3f')]['length']?_0x30bd24[_0x95bc('0x3f')]:_0xe131a0['model'];if(_0x36843e[_0x95bc('0x3b')][_0x95bc('0xb3')]){_0x30bd24[_0x95bc('0xb4')]=[{'all':!![]}];}_0x30bd24=_['merge']({},_0x30bd24,_0x36843e[_0x95bc('0xb5')]);return db[_0x95bc('0x35')][_0x95bc('0x5b')](_0x30bd24)[_0x95bc('0x26')](handleEntityNotFound(_0x2ed34e,null))[_0x95bc('0x26')](respondWithResult(_0x2ed34e,null))[_0x95bc('0x33')](handleError(_0x2ed34e,null));};exports[_0x95bc('0xb6')]=function(_0x2de13e,_0x2872ab){return db[_0x95bc('0x35')][_0x95bc('0xb6')](_0x2de13e['body'],{})[_0x95bc('0x26')](respondWithResult(_0x2872ab,0xc9))['catch'](handleError(_0x2872ab,null));};exports['update']=function(_0x32364f,_0x7823dc){if(_0x32364f[_0x95bc('0x71')]['id']){delete _0x32364f[_0x95bc('0x71')]['id'];}return db[_0x95bc('0x35')][_0x95bc('0x5b')]({'where':{'id':_0x32364f['params']['id']}})['then'](handleEntityNotFound(_0x7823dc,null))[_0x95bc('0x26')](saveUpdates(_0x32364f[_0x95bc('0x71')],null))['then'](respondWithResult(_0x7823dc,null))[_0x95bc('0x33')](handleError(_0x7823dc,null));};exports[_0x95bc('0x27')]=function(_0x23818e,_0x5b3829){return db[_0x95bc('0x35')][_0x95bc('0x5b')]({'where':{'id':_0x23818e[_0x95bc('0xb2')]['id']}})[_0x95bc('0x26')](handleEntityNotFound(_0x5b3829,null))[_0x95bc('0x26')](removeEntity(_0x5b3829,null))['catch'](handleError(_0x5b3829,null));};exports[_0x95bc('0xb7')]=function(_0x5ef14a,_0x2756bf){return db[_0x95bc('0x35')]['describe']()[_0x95bc('0x26')](respondWithResult(_0x2756bf,null))[_0x95bc('0x33')](handleError(_0x2756bf,null));};exports[_0x95bc('0xb8')]=function(_0x39b17e,_0x29ad60,_0x5ed8c3){return db[_0x95bc('0xb9')][_0x95bc('0x5b')]({'where':{'id':_0x39b17e[_0x95bc('0xb2')]['id']}})[_0x95bc('0x26')](handleEntityNotFound(_0x29ad60,null))[_0x95bc('0x26')](function(_0x15f9a6){if(_0x15f9a6){return _0x15f9a6['addMessage'](_0x39b17e[_0x95bc('0x71')][_0x95bc('0xba')],_[_0x95bc('0xbb')](_0x39b17e[_0x95bc('0x71')],[_0x95bc('0xba'),'id'])||{});}})[_0x95bc('0x26')](respondWithResult(_0x29ad60,null))['catch'](handleError(_0x29ad60,null));};exports[_0x95bc('0xbc')]=function(_0x1ea394,_0x320ca0,_0x430d30){var _0x4ab6c3={'raw':![],'where':{}};var _0x23dcd7={};var _0x51483e={'count':0x0,'rows':[]};return db['SmsInteraction']['findOne']({'where':{'id':_0x1ea394['params']['id']}})[_0x95bc('0x26')](handleEntityNotFound(_0x320ca0,null))[_0x95bc('0x26')](function(_0x53990e){if(_0x53990e){_0x23dcd7['model']=_['keys'](db['SmsMessage']['rawAttributes']);_0x23dcd7[_0x95bc('0x3b')]=_[_0x95bc('0x3c')](_0x1ea394[_0x95bc('0x3b')]);_0x23dcd7[_0x95bc('0x3d')]=_[_0x95bc('0x3e')](_0x23dcd7[_0x95bc('0x3a')],_0x23dcd7[_0x95bc('0x3b')]);_0x4ab6c3['attributes']=_[_0x95bc('0x3e')](_0x23dcd7[_0x95bc('0x3a')],qs[_0x95bc('0x40')](_0x1ea394['query'][_0x95bc('0x40')]));_0x4ab6c3[_0x95bc('0x3f')]=_0x4ab6c3[_0x95bc('0x3f')][_0x95bc('0x41')]?_0x4ab6c3[_0x95bc('0x3f')]:_0x23dcd7[_0x95bc('0x3a')];if(!_0x1ea394['query'][_0x95bc('0xbd')]('nolimit')){_0x4ab6c3['limit']=qs[_0x95bc('0x21')](_0x1ea394[_0x95bc('0x3b')]['limit']);_0x4ab6c3[_0x95bc('0x1e')]=qs[_0x95bc('0x1e')](_0x1ea394[_0x95bc('0x3b')][_0x95bc('0x1e')]);}_0x4ab6c3[_0x95bc('0x43')]=qs[_0x95bc('0x44')](_0x1ea394[_0x95bc('0x3b')]['sort']);_0x4ab6c3[_0x95bc('0x45')]=qs['filters'](_[_0x95bc('0x46')](_0x1ea394[_0x95bc('0x3b')],_0x23dcd7[_0x95bc('0x3d')]));_0x4ab6c3['where'][_0x95bc('0xaf')]=_0x53990e['id'];if(_0x1ea394[_0x95bc('0x3b')][_0x95bc('0x82')]){_0x4ab6c3[_0x95bc('0x45')]=_['merge'](_0x4ab6c3['where'],{'$or':_[_0x95bc('0x34')](_0x4ab6c3[_0x95bc('0x3f')],function(_0x14f809){var _0x16cdf2={};_0x16cdf2[_0x14f809]={'$like':'%'+_0x1ea394['query'][_0x95bc('0x82')]+'%'};return _0x16cdf2;})});}if(_0x1ea394[_0x95bc('0x3b')]['$gte']){var _0x175e99=_0x1ea394[_0x95bc('0x3b')][_0x95bc('0x79')][_0x95bc('0x30')](',');var _0x5d525f={};_0x5d525f[_0x175e99[0x0]]={'$gte':moment(_0x175e99[0x1])[_0x95bc('0xbe')](_0x95bc('0xbf'))};_0x4ab6c3[_0x95bc('0x45')]=_[_0x95bc('0x9b')](_0x4ab6c3[_0x95bc('0x45')],_0x5d525f);}_0x4ab6c3=_[_0x95bc('0x9b')]({},_0x4ab6c3,_0x1ea394['options']);return db[_0x95bc('0xb9')][_0x95bc('0x20')]({'where':_0x4ab6c3[_0x95bc('0x45')]})[_0x95bc('0x26')](function(_0x569226){_0x51483e[_0x95bc('0x20')]=_0x569226;if(_0x1ea394[_0x95bc('0x3b')]['includeAll']){_0x4ab6c3['include']=[{'all':!![]}];}return db[_0x95bc('0xb9')]['findAll'](_0x4ab6c3);})['then'](function(_0x5357f0){_0x51483e['rows']=_0x5357f0;return _0x51483e;});}})[_0x95bc('0x26')](respondWithFilteredResult(_0x320ca0,_0x4ab6c3))[_0x95bc('0x33')](handleError(_0x320ca0,null));};exports['addTags']=function(_0x4a31fe,_0x2daf63,_0x5d101e){return db[_0x95bc('0x35')][_0x95bc('0x5b')]({'where':{'id':_0x4a31fe['params']['id']}})[_0x95bc('0x26')](handleEntityNotFound(_0x2daf63,null))[_0x95bc('0x26')](function(_0x3ce2bd){if(_0x3ce2bd){return _0x3ce2bd['setTags'](_0x4a31fe[_0x95bc('0x71')]['ids'],_[_0x95bc('0xbb')](_0x4a31fe['body'],['ids','id'])||{})[_0x95bc('0xc0')](function(){return db['Tag'][_0x95bc('0xc1')]({'attributes':['id',_0x95bc('0x2b'),'color'],'where':{'id':_0x4a31fe[_0x95bc('0x71')]['ids']}});})[_0x95bc('0x26')](function(_0x302490){socket[_0x95bc('0xc2')](_0x95bc('0xc3'),{'id':Number(_0x4a31fe[_0x95bc('0xb2')]['id']),'tags':_0x302490||[]});return{'id':Number(_0x4a31fe[_0x95bc('0xb2')]['id']),'tags':_0x302490||[]};});}})['then'](respondWithResult(_0x2daf63,null))[_0x95bc('0x33')](handleError(_0x2daf63,null));};exports[_0x95bc('0xc4')]=function(_0x8c0b5c,_0x4f81f1,_0x1dcd4e){return db[_0x95bc('0x35')][_0x95bc('0x5b')]({'where':{'id':_0x8c0b5c['params']['id']}})[_0x95bc('0x26')](handleEntityNotFound(_0x4f81f1,null))['then'](function(_0x28f86a){if(_0x28f86a){return _0x28f86a[_0x95bc('0xc4')](_0x8c0b5c['query'][_0x95bc('0xba')]);}})[_0x95bc('0x26')](respondWithStatusCode(_0x4f81f1,null))[_0x95bc('0x33')](handleError(_0x4f81f1,null));};exports['download']=function(_0x559dc7,_0x2a86ba){var _0x504859=moment()[_0x95bc('0xc5')]()['toString']();var _0x2ef1aa=path['join'](config[_0x95bc('0xc6')],_0x95bc('0xc7'),_0x95bc('0xc8'),_0x95bc('0xc9'));var _0x581070=path[_0x95bc('0xca')](config['root'],'server',_0x95bc('0xc8'),'attachments');var _0x5854b2=path[_0x95bc('0xca')](_0x2ef1aa,_0x504859);var _0x4692b0=util['format']('transcript-%d-%s.zip',_0x559dc7['params']['id'],_0x504859);var _0x14fcfc=path[_0x95bc('0xca')](_0x2ef1aa,_0x4692b0);var _0x18005b=[];_0x18005b[_0x95bc('0x32')]({'model':db[_0x95bc('0x6e')],'as':_0x95bc('0x6e'),'attributes':['id',_0x95bc('0x2e')],'raw':!![]});_0x18005b['push']({'model':db[_0x95bc('0xcb')],'as':_0x95bc('0x61'),'attributes':['id',_0x95bc('0xcc'),_0x95bc('0xcd')],'raw':!![]});var _0x5c0869=[{'model':db[_0x95bc('0xb9')],'as':'Messages','attributes':['id','body',_0x95bc('0x77'),_0x95bc('0xce'),'secret',_0x95bc('0x7d')],'include':_0x18005b}];_0x5c0869['push']({'model':db[_0x95bc('0xcf')],'as':'Account','attributes':['id',_0x95bc('0x2b')]});_0x5c0869[_0x95bc('0x32')]({'model':db['User'],'as':_0x95bc('0xd0'),'attributes':['id',_0x95bc('0x2e')]});return db[_0x95bc('0x35')][_0x95bc('0x5b')]({'where':{'id':_0x559dc7[_0x95bc('0xb2')]['id']},'include':_0x5c0869})[_0x95bc('0x26')](handleEntityNotFound(_0x2a86ba,null))['then'](function(_0x24dd26){if(_0x24dd26){var _0x1d9995=_0x24dd26[_0x95bc('0xd1')]({'plain':!![]});fs['mkdirSync'](_0x5854b2);var _0x1b12aa={'channel':_0x95bc('0xd2'),'account':_0x1d9995[_0x95bc('0xd3')][_0x95bc('0x2b')],'agent':_0x1d9995[_0x95bc('0xd0')]?_0x1d9995[_0x95bc('0xd0')]['fullname']:'N.A.','createdAt':moment(_0x1d9995['createdAt'])[_0x95bc('0xbe')](_0x95bc('0xbf'))[_0x95bc('0x99')](),'closedAt':_0x1d9995[_0x95bc('0xd4')]?moment(_0x1d9995[_0x95bc('0xd5')])['format'](_0x95bc('0xbf'))[_0x95bc('0x99')]():'','disposition':_0x1d9995[_0x95bc('0xd6')],'messages':_(_0x1d9995[_0x95bc('0xd7')])[_0x95bc('0x82')]({'secret':![]})['map'](function(_0x40f44e){return{'date':moment(_0x40f44e[_0x95bc('0x77')])['format'](_0x95bc('0xbf'))[_0x95bc('0x99')](),'sender':_0x40f44e['direction']===_0x95bc('0xd8')?_0x40f44e[_0x95bc('0x6e')]?_0x40f44e['User'][_0x95bc('0x2e')]:_0x95bc('0xd9'):_0x40f44e['Contact'][_0x95bc('0xcc')]+(_0x40f44e['Contact'][_0x95bc('0xcd')]?'\x20'+_0x40f44e['Contact'][_0x95bc('0xcd')]:''),'body':_0x40f44e[_0x95bc('0x71')],'direction':_0x40f44e[_0x95bc('0xce')]===_0x95bc('0xd8')?'A':'C','secret':_0x40f44e[_0x95bc('0xda')],'read':_0x40f44e[_0x95bc('0x7d')]};})[_0x95bc('0x5d')]()};return ejs['renderFile'](path[_0x95bc('0xca')](config[_0x95bc('0xc6')],_0x95bc('0xc7'),_0x95bc('0xdb'),_0x95bc('0xdc')),{'interaction':_0x1b12aa})[_0x95bc('0x26')](function(_0x318975){var _0x3a5790=path[_0x95bc('0xca')](_0x5854b2,_0x95bc('0xdd')+_0x1d9995['id']+'-'+_0x504859+'.pdf');var _0x39996e={'path':_0x3a5790,'channel':_0x95bc('0xd2'),'interactionId':_0x1d9995['id']};return pdf[_0x95bc('0xde')](_0x318975,_0x39996e);})[_0x95bc('0x26')](function(){return new BPromise(function(_0x175908,_0x2d42d3){zipdir(_0x5854b2,{'saveTo':_0x14fcfc},function(_0x172142,_0x5bab65){if(_0x172142)return _0x2d42d3(_0x172142);return _0x175908(_0x5bab65);});})['then'](function(){return new BPromise(function(_0xb1d732,_0x306927){rimraf(_0x5854b2,function(_0x2d5ea9){if(_0x2d5ea9)_0x306927(_0x2d5ea9);return _0xb1d732();});});})[_0x95bc('0x26')](function(){return _0x2a86ba[_0x95bc('0xdf')](_0x14fcfc,_0x4692b0,function(_0xc40499){if(_0xc40499){console['log']('err',_0xc40499);}else{fs[_0x95bc('0xe0')](_0x14fcfc);}});});});}else{return _0x2a86ba[_0x95bc('0x28')](0xc8);}})['catch'](handleError(_0x2a86ba,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 1364193..f61c683 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 _0x2272=['findAll','unreadMessages','length','emit','catch','hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage','save','update','remove','getUsers','then','setDataValue','Users','map'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x2272,0xd8));var _0x2227=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x2272[_0x19e35c];return _0x3e1fe8;};'use strict';var EventEmitter=require(_0x2227('0x0'));var SmsInteraction=require(_0x2227('0x1'))['db'][_0x2227('0x2')];var SmsMessage=require(_0x2227('0x1'))['db'][_0x2227('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2227('0x4'),'afterUpdate':_0x2227('0x5'),'afterDestroy':_0x2227('0x6')};function emitEvent(_0x4c17c2){return function(_0x4ebde3,_0x1e5a8a,_0x3b8661){_0x4ebde3[_0x2227('0x7')]({'attributes':['id'],'raw':!![]})[_0x2227('0x8')](function(_0xaec623){_0x4ebde3[_0x2227('0x9')](_0x2227('0xa'),_0xaec623[_0x2227('0xb')](function(_0x18094d){return{'id':_0x18094d['id']};}));return SmsMessage[_0x2227('0xc')]({'where':{'SmsInteractionId':_0x4ebde3['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x799370){_0x4ebde3['setDataValue'](_0x2227('0xd'),_0x799370[_0x2227('0xe')]);SmsInteractionEvents[_0x2227('0xf')](_0x4c17c2+':'+_0x4ebde3['id'],_0x4ebde3);SmsInteractionEvents[_0x2227('0xf')](_0x4c17c2,_0x4ebde3);_0x3b8661(null);})[_0x2227('0x10')](_0x3b8661(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0x2227('0x11')](e,emitEvent(event));}}module[_0x2227('0x12')]=SmsInteractionEvents; \ No newline at end of file +var _0x4cf8=['unreadMessages','length','emit','catch','exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','findAll'];(function(_0x37bbe3,_0x479ae1){var _0x2306f=function(_0x498111){while(--_0x498111){_0x37bbe3['push'](_0x37bbe3['shift']());}};_0x2306f(++_0x479ae1);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x3662b4,_0x503b4d){_0x3662b4=_0x3662b4-0x0;var _0x50928c=_0x4cf8[_0x3662b4];return _0x50928c;};'use strict';var EventEmitter=require(_0x84cf('0x0'));var SmsInteraction=require(_0x84cf('0x1'))['db'][_0x84cf('0x2')];var SmsMessage=require(_0x84cf('0x1'))['db'][_0x84cf('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x84cf('0x4')](0x0);var events={'afterCreate':_0x84cf('0x5'),'afterUpdate':_0x84cf('0x6'),'afterDestroy':_0x84cf('0x7')};function emitEvent(_0x2d38c0){return function(_0x5844d7,_0x2c613d,_0x50ade2){_0x5844d7['getUsers']({'attributes':['id'],'raw':!![]})[_0x84cf('0x8')](function(_0x56c5cc){_0x5844d7[_0x84cf('0x9')](_0x84cf('0xa'),_0x56c5cc['map'](function(_0x2e0b79){return{'id':_0x2e0b79['id']};}));return SmsMessage[_0x84cf('0xb')]({'where':{'SmsInteractionId':_0x5844d7['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0xfb5398){_0x5844d7[_0x84cf('0x9')](_0x84cf('0xc'),_0xfb5398[_0x84cf('0xd')]);SmsInteractionEvents['emit'](_0x2d38c0+':'+_0x5844d7['id'],_0x5844d7);SmsInteractionEvents[_0x84cf('0xe')](_0x2d38c0,_0x5844d7);_0x50ade2(null);})[_0x84cf('0xf')](_0x50ade2(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x84cf('0x10')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 328e2f6..a95c6a1 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 _0x7969=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','define','SmsInteraction','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger'];(function(_0x4c7a4d,_0xf6fda9){var _0x16a471=function(_0x2a736f){while(--_0x2a736f){_0x4c7a4d['push'](_0x4c7a4d['shift']());}};_0x16a471(++_0xf6fda9);}(_0x7969,0xed));var _0x9796=function(_0x260404,_0x5c119f){_0x260404=_0x260404-0x0;var _0x3ce130=_0x7969[_0x260404];return _0x3ce130;};'use strict';var _=require(_0x9796('0x0'));var util=require(_0x9796('0x1'));var logger=require(_0x9796('0x2'))('api');var moment=require(_0x9796('0x3'));var BPromise=require(_0x9796('0x4'));var rp=require(_0x9796('0x5'));var fs=require('fs');var path=require(_0x9796('0x6'));var rimraf=require(_0x9796('0x7'));var config=require(_0x9796('0x8'));var attributes=require(_0x9796('0x9'));module['exports']=function(_0x5ef97d,_0x11bb84){return _0x5ef97d[_0x9796('0xa')](_0x9796('0xb'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2f6241,_0x1a667f,_0x5a2a87){if(_0x2f6241[_0x9796('0xc')]('closed')){_0x2f6241[_0x9796('0xd')]=moment()['format'](_0x9796('0xe'));}_0x5a2a87(null,_0x2f6241);}}});}; \ No newline at end of file +var _0xd2ee=['path','rimraf','exports','define','SmsInteraction','sms_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x14a5d9,_0x4c2ddf){var _0xff696e=function(_0x1f4b85){while(--_0x1f4b85){_0x14a5d9['push'](_0x14a5d9['shift']());}};_0xff696e(++_0x4c2ddf);}(_0xd2ee,0x1aa));var _0xed2e=function(_0x41f9f0,_0x4691b7){_0x41f9f0=_0x41f9f0-0x0;var _0xaf3571=_0xd2ee[_0x41f9f0];return _0xaf3571;};'use strict';var _=require(_0xed2e('0x0'));var util=require(_0xed2e('0x1'));var logger=require(_0xed2e('0x2'))(_0xed2e('0x3'));var moment=require('moment');var BPromise=require(_0xed2e('0x4'));var rp=require(_0xed2e('0x5'));var fs=require('fs');var path=require(_0xed2e('0x6'));var rimraf=require(_0xed2e('0x7'));var config=require('../../config/environment');var attributes=require('./smsInteraction.attributes');module[_0xed2e('0x8')]=function(_0x356dfa,_0x292a42){return _0x356dfa[_0xed2e('0x9')](_0xed2e('0xa'),attributes,{'tableName':_0xed2e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5e1d5b,_0x14582e,_0x16721a){if(_0x5e1d5b['changed'](_0xed2e('0xc'))){_0x5e1d5b[_0xed2e('0xd')]=moment()[_0xed2e('0xe')](_0xed2e('0xf'));}_0x16721a(null,_0x5e1d5b);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index d91ee09..6cd39a4 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 _0x7f5a=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateSmsInteraction','SmsInteraction','body','options','raw','where','attributes','limit','AddTagsToSmsInteraction','find','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0xce7ec3,_0x50415f){var _0x18877f=function(_0x3e013b){while(--_0x3e013b){_0xce7ec3['push'](_0xce7ec3['shift']());}};_0x18877f(++_0x50415f);}(_0x7f5a,0x11f));var _0xa7f5=function(_0x1fc4e2,_0x493c3b){_0x1fc4e2=_0x1fc4e2-0x0;var _0x2ba184=_0x7f5a[_0x1fc4e2];return _0x2ba184;};'use strict';var _=require(_0xa7f5('0x0'));var util=require(_0xa7f5('0x1'));var moment=require(_0xa7f5('0x2'));var BPromise=require(_0xa7f5('0x3'));var rs=require(_0xa7f5('0x4'));var fs=require('fs');var Redis=require(_0xa7f5('0x5'));var db=require(_0xa7f5('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa7f5('0x7'));var config=require(_0xa7f5('0x8'));var jayson=require(_0xa7f5('0x9'));var client=jayson[_0xa7f5('0xa')][_0xa7f5('0xb')]({'port':0x232a});config[_0xa7f5('0xc')]=_[_0xa7f5('0xd')](config[_0xa7f5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xa7f5('0xe'))(new Redis(config[_0xa7f5('0xc')]));require(_0xa7f5('0xf'))[_0xa7f5('0x10')](socket);function respondWithRpcPromise(_0x5f329e,_0x1d5347,_0x404574){return new BPromise(function(_0x559262,_0x3a10ba){return client[_0xa7f5('0x11')](_0x5f329e,_0x404574)[_0xa7f5('0x12')](function(_0x8d0db1){logger[_0xa7f5('0x13')](_0xa7f5('0x14'),_0x1d5347,_0xa7f5('0x15'));logger[_0xa7f5('0x16')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x1d5347,'request\x20sent',JSON[_0xa7f5('0x17')](_0x8d0db1));if(_0x8d0db1[_0xa7f5('0x18')]){if(_0x8d0db1[_0xa7f5('0x18')][_0xa7f5('0x19')]===0x1f4){logger[_0xa7f5('0x18')](_0xa7f5('0x14'),_0x1d5347,_0x8d0db1[_0xa7f5('0x18')][_0xa7f5('0x1a')]);return _0x3a10ba(_0x8d0db1[_0xa7f5('0x18')][_0xa7f5('0x1a')]);}logger['error'](_0xa7f5('0x14'),_0x1d5347,_0x8d0db1[_0xa7f5('0x18')][_0xa7f5('0x1a')]);return _0x559262(_0x8d0db1[_0xa7f5('0x18')]['message']);}else{logger[_0xa7f5('0x13')]('SmsInteraction,\x20%s,\x20%s',_0x1d5347,_0xa7f5('0x15'));_0x559262(_0x8d0db1[_0xa7f5('0x1b')]['message']);}})[_0xa7f5('0x1c')](function(_0xc8407f){logger['error']('SmsInteraction,\x20%s,\x20%s',_0x1d5347,_0xc8407f);_0x3a10ba(_0xc8407f);});});}exports[_0xa7f5('0x1d')]=function(_0x4442d6){var _0x6e23d7=this;return new Promise(function(_0x3ee9b2,_0x285201){return db[_0xa7f5('0x1e')]['update'](_0x4442d6[_0xa7f5('0x1f')],{'raw':_0x4442d6[_0xa7f5('0x20')]?_0x4442d6['options'][_0xa7f5('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4442d6[_0xa7f5('0x20')]?_0x4442d6[_0xa7f5('0x20')][_0xa7f5('0x22')]||null:null,'attributes':_0x4442d6['options']?_0x4442d6[_0xa7f5('0x20')][_0xa7f5('0x23')]||null:null,'limit':_0x4442d6[_0xa7f5('0x20')]?_0x4442d6['options'][_0xa7f5('0x24')]||null:null})['then'](function(_0xba1cc5){logger[_0xa7f5('0x13')](_0xa7f5('0x1d'),_0x4442d6);logger[_0xa7f5('0x16')](_0xa7f5('0x1d'),_0x4442d6,JSON[_0xa7f5('0x17')](_0xba1cc5));_0x3ee9b2(_0xba1cc5);})[_0xa7f5('0x1c')](function(_0x24bcb6){logger[_0xa7f5('0x18')](_0xa7f5('0x1d'),_0x24bcb6[_0xa7f5('0x1a')],_0x4442d6);_0x285201(_0x6e23d7[_0xa7f5('0x18')](0x1f4,_0x24bcb6[_0xa7f5('0x1a')]));});});};exports[_0xa7f5('0x25')]=function(_0x17755c){return new Promise(function(_0x435a8f,_0x3494e5){return db['SmsInteraction'][_0xa7f5('0x26')]({'where':_0x17755c[_0xa7f5('0x20')]?_0x17755c[_0xa7f5('0x20')][_0xa7f5('0x22')]||null:null})[_0xa7f5('0x12')](function(_0xd1e81f){if(_0xd1e81f){return _0xd1e81f['addTags'](_0x17755c['body'][_0xa7f5('0x27')],_['omit'](_0x17755c['body'],['ids','id'])||{});}})[_0xa7f5('0x28')](function(_0x4ff294){logger[_0xa7f5('0x13')](_0xa7f5('0x29'),_0x17755c);logger['debug'](_0xa7f5('0x29'),_0x17755c,JSON[_0xa7f5('0x17')](_0x4ff294));_0x435a8f(_0x4ff294);})[_0xa7f5('0x1c')](function(_0x3f15e5){logger[_0xa7f5('0x18')](_0xa7f5('0x29'),_0x3f15e5['message'],_0x17755c);_0x3494e5(_this[_0xa7f5('0x18')](0x1f4,_0x3f15e5['message']));});});}; \ No newline at end of file +var _0xccbb=['SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsInteraction,\x20%s,\x20%s','message','catch','UpdateSmsInteraction','SmsInteraction','update','body','raw','options','where','attributes','AddTagsToSmsInteraction','find','addTags','ids','omit','spread','AddTags','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info','request\x20sent'];(function(_0x3897d8,_0x429331){var _0x1d518b=function(_0x223137){while(--_0x223137){_0x3897d8['push'](_0x3897d8['shift']());}};_0x1d518b(++_0x429331);}(_0xccbb,0x1ce));var _0xbccb=function(_0x5f405e,_0x4c76e7){_0x5f405e=_0x5f405e-0x0;var _0x437fde=_0xccbb[_0x5f405e];return _0x437fde;};'use strict';var _=require('lodash');var util=require(_0xbccb('0x0'));var moment=require(_0xbccb('0x1'));var BPromise=require(_0xbccb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbccb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbccb('0x4'));var logger=require('../../config/logger')(_0xbccb('0x5'));var config=require(_0xbccb('0x6'));var jayson=require(_0xbccb('0x7'));var client=jayson['client'][_0xbccb('0x8')]({'port':0x232a});config[_0xbccb('0x9')]=_['defaults'](config[_0xbccb('0x9')],{'host':_0xbccb('0xa'),'port':0x18eb});var socket=require(_0xbccb('0xb'))(new Redis(config[_0xbccb('0x9')]));require(_0xbccb('0xc'))[_0xbccb('0xd')](socket);function respondWithRpcPromise(_0x93538d,_0x244e0f,_0x5d3b60){return new BPromise(function(_0x1709dd,_0x59c41c){return client[_0xbccb('0xe')](_0x93538d,_0x5d3b60)[_0xbccb('0xf')](function(_0x239571){logger[_0xbccb('0x10')]('SmsInteraction,\x20%s,\x20%s',_0x244e0f,_0xbccb('0x11'));logger['debug'](_0xbccb('0x12'),_0x244e0f,_0xbccb('0x11'),JSON[_0xbccb('0x13')](_0x239571));if(_0x239571[_0xbccb('0x14')]){if(_0x239571['error'][_0xbccb('0x15')]===0x1f4){logger[_0xbccb('0x14')](_0xbccb('0x16'),_0x244e0f,_0x239571[_0xbccb('0x14')][_0xbccb('0x17')]);return _0x59c41c(_0x239571['error']['message']);}logger[_0xbccb('0x14')](_0xbccb('0x16'),_0x244e0f,_0x239571[_0xbccb('0x14')][_0xbccb('0x17')]);return _0x1709dd(_0x239571[_0xbccb('0x14')]['message']);}else{logger[_0xbccb('0x10')](_0xbccb('0x16'),_0x244e0f,_0xbccb('0x11'));_0x1709dd(_0x239571['result'][_0xbccb('0x17')]);}})[_0xbccb('0x18')](function(_0x452b8e){logger['error'](_0xbccb('0x16'),_0x244e0f,_0x452b8e);_0x59c41c(_0x452b8e);});});}exports[_0xbccb('0x19')]=function(_0xa8796a){var _0x5c6e86=this;return new Promise(function(_0x18e58c,_0x259855){return db[_0xbccb('0x1a')][_0xbccb('0x1b')](_0xa8796a[_0xbccb('0x1c')],{'raw':_0xa8796a['options']?_0xa8796a['options'][_0xbccb('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa8796a[_0xbccb('0x1e')]?_0xa8796a[_0xbccb('0x1e')][_0xbccb('0x1f')]||null:null,'attributes':_0xa8796a[_0xbccb('0x1e')]?_0xa8796a[_0xbccb('0x1e')][_0xbccb('0x20')]||null:null,'limit':_0xa8796a[_0xbccb('0x1e')]?_0xa8796a[_0xbccb('0x1e')]['limit']||null:null})[_0xbccb('0xf')](function(_0x289869){logger[_0xbccb('0x10')]('UpdateSmsInteraction',_0xa8796a);logger['debug'](_0xbccb('0x19'),_0xa8796a,JSON[_0xbccb('0x13')](_0x289869));_0x18e58c(_0x289869);})[_0xbccb('0x18')](function(_0x368294){logger[_0xbccb('0x14')](_0xbccb('0x19'),_0x368294['message'],_0xa8796a);_0x259855(_0x5c6e86[_0xbccb('0x14')](0x1f4,_0x368294[_0xbccb('0x17')]));});});};exports[_0xbccb('0x21')]=function(_0x41cea3){return new Promise(function(_0x621cd4,_0x2151cc){return db[_0xbccb('0x1a')][_0xbccb('0x22')]({'where':_0x41cea3[_0xbccb('0x1e')]?_0x41cea3['options']['where']||null:null})[_0xbccb('0xf')](function(_0x4c95a1){if(_0x4c95a1){return _0x4c95a1[_0xbccb('0x23')](_0x41cea3[_0xbccb('0x1c')][_0xbccb('0x24')],_[_0xbccb('0x25')](_0x41cea3[_0xbccb('0x1c')],[_0xbccb('0x24'),'id'])||{});}})[_0xbccb('0x26')](function(_0xd7e6fa){logger['info'](_0xbccb('0x27'),_0x41cea3);logger['debug'](_0xbccb('0x27'),_0x41cea3,JSON['stringify'](_0xd7e6fa));_0x621cd4(_0xd7e6fa);})[_0xbccb('0x18')](function(_0x1cae5d){logger['error'](_0xbccb('0x27'),_0x1cae5d[_0xbccb('0x17')],_0x41cea3);_0x2151cc(_this[_0xbccb('0x14')](0x1f4,_0x1cae5d[_0xbccb('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 00da8ce..20662c6 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 _0xfaf3=['length','smsInteraction:','./smsInteraction.events','save','remove','update','emit','removeListener'];(function(_0x5e8d3a,_0x2ac363){var _0x3a0dbb=function(_0x1bb32c){while(--_0x1bb32c){_0x5e8d3a['push'](_0x5e8d3a['shift']());}};_0x3a0dbb(++_0x2ac363);}(_0xfaf3,0x10a));var _0x3faf=function(_0x24f585,_0x183ca6){_0x24f585=_0x24f585-0x0;var _0x50664f=_0xfaf3[_0x24f585];return _0x50664f;};'use strict';var SmsInteractionEvents=require(_0x3faf('0x0'));var events=[_0x3faf('0x1'),_0x3faf('0x2'),_0x3faf('0x3')];function createListener(_0x18bed8,_0x4d44cc){return function(_0xe439d5){_0x4d44cc[_0x3faf('0x4')](_0x18bed8,_0xe439d5);};}function removeListener(_0x3a22ac,_0x4c13fd){return function(){SmsInteractionEvents[_0x3faf('0x5')](_0x3a22ac,_0x4c13fd);};}exports['register']=function(_0xf632d4){for(var _0x1b416c=0x0,_0x225ace=events[_0x3faf('0x6')];_0x1b416c<_0x225ace;_0x1b416c++){var _0x372693=events[_0x1b416c];var _0x4df157=createListener(_0x3faf('0x7')+_0x372693,_0xf632d4);SmsInteractionEvents['on'](_0x372693,_0x4df157);}}; \ No newline at end of file +var _0xae1c=['save','update','emit','removeListener','register','length','smsInteraction:','./smsInteraction.events'];(function(_0x62a880,_0x76ef7){var _0x1fb0a9=function(_0x4dd6fe){while(--_0x4dd6fe){_0x62a880['push'](_0x62a880['shift']());}};_0x1fb0a9(++_0x76ef7);}(_0xae1c,0x19f));var _0xcae1=function(_0x22ef5d,_0x173f4e){_0x22ef5d=_0x22ef5d-0x0;var _0x3f46f6=_0xae1c[_0x22ef5d];return _0x3f46f6;};'use strict';var SmsInteractionEvents=require(_0xcae1('0x0'));var events=[_0xcae1('0x1'),'remove',_0xcae1('0x2')];function createListener(_0x2dc9bf,_0x49df20){return function(_0x279143){_0x49df20[_0xcae1('0x3')](_0x2dc9bf,_0x279143);};}function removeListener(_0x949a85,_0x119a0d){return function(){SmsInteractionEvents[_0xcae1('0x4')](_0x949a85,_0x119a0d);};}exports[_0xcae1('0x5')]=function(_0x165a36){for(var _0xb89e66=0x0,_0x424c0a=events[_0xcae1('0x6')];_0xb89e66<_0x424c0a;_0xb89e66++){var _0x378b90=events[_0xb89e66];var _0x4e05ac=createListener(_0xcae1('0x7')+_0x378b90,_0x165a36);SmsInteractionEvents['on'](_0x378b90,_0x4e05ac);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 0caf46b..5c8ba8b 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 _0x6a95=['util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','/:id','show','post','tracked','sms','smsmessage:create','create','/:id/status','put','update','/:id/accept','accept','/:id/reject','destroy','exports','multer'];(function(_0x3ccd5c,_0x1ee1a7){var _0x1be3e3=function(_0x25059){while(--_0x25059){_0x3ccd5c['push'](_0x3ccd5c['shift']());}};_0x1be3e3(++_0x1ee1a7);}(_0x6a95,0x1db));var _0x56a9=function(_0x28d18d,_0x55896b){_0x28d18d=_0x28d18d-0x0;var _0x470640=_0x6a95[_0x28d18d];return _0x470640;};'use strict';var multer=require(_0x56a9('0x0'));var util=require(_0x56a9('0x1'));var path=require(_0x56a9('0x2'));var timeout=require(_0x56a9('0x3'));var express=require(_0x56a9('0x4'));var router=express[_0x56a9('0x5')]();var fs_extra=require(_0x56a9('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x56a9('0x7'));var controller=require(_0x56a9('0x8'));router[_0x56a9('0x9')]('/',auth[_0x56a9('0xa')](),controller[_0x56a9('0xb')]);router[_0x56a9('0x9')](_0x56a9('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x56a9('0x9')](_0x56a9('0xd'),auth['isAuthenticated'](),controller[_0x56a9('0xe')]);router[_0x56a9('0xf')]('/',auth[_0x56a9('0xa')](),interaction[_0x56a9('0x10')](_0x56a9('0x11'),_0x56a9('0x12')),controller[_0x56a9('0x13')]);router[_0x56a9('0xf')](_0x56a9('0x14'),controller['status']);router[_0x56a9('0x15')]('/:id',auth[_0x56a9('0xa')](),controller[_0x56a9('0x16')]);router[_0x56a9('0x15')](_0x56a9('0x17'),auth[_0x56a9('0xa')](),controller[_0x56a9('0x18')]);router[_0x56a9('0x15')](_0x56a9('0x19'),auth[_0x56a9('0xa')](),controller['reject']);router['delete'](_0x56a9('0xd'),auth[_0x56a9('0xa')](),controller[_0x56a9('0x1a')]);module[_0x56a9('0x1b')]=router; \ No newline at end of file +var _0x5fbb=['accept','/:id/reject','delete','destroy','exports','multer','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','/:id/status','put','update'];(function(_0x4664db,_0x1de672){var _0x5615b4=function(_0x54fb5a){while(--_0x54fb5a){_0x4664db['push'](_0x4664db['shift']());}};_0x5615b4(++_0x1de672);}(_0x5fbb,0x1ba));var _0xb5fb=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x5fbb[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require(_0xb5fb('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb5fb('0x1'));var router=express[_0xb5fb('0x2')]();var fs_extra=require(_0xb5fb('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xb5fb('0x4'));var config=require(_0xb5fb('0x5'));var controller=require(_0xb5fb('0x6'));router[_0xb5fb('0x7')]('/',auth[_0xb5fb('0x8')](),controller[_0xb5fb('0x9')]);router[_0xb5fb('0x7')](_0xb5fb('0xa'),auth[_0xb5fb('0x8')](),controller[_0xb5fb('0xb')]);router[_0xb5fb('0x7')](_0xb5fb('0xc'),auth[_0xb5fb('0x8')](),controller['show']);router[_0xb5fb('0xd')]('/',auth[_0xb5fb('0x8')](),interaction[_0xb5fb('0xe')]('sms','smsmessage:create'),controller['create']);router[_0xb5fb('0xd')](_0xb5fb('0xf'),controller['status']);router[_0xb5fb('0x10')](_0xb5fb('0xc'),auth[_0xb5fb('0x8')](),controller[_0xb5fb('0x11')]);router[_0xb5fb('0x10')]('/:id/accept',auth[_0xb5fb('0x8')](),controller[_0xb5fb('0x12')]);router[_0xb5fb('0x10')](_0xb5fb('0x13'),auth[_0xb5fb('0x8')](),controller['reject']);router[_0xb5fb('0x14')](_0xb5fb('0xc'),auth['isAuthenticated'](),controller[_0xb5fb('0x15')]);module[_0xb5fb('0x16')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index e499d6a..58fdcdb 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 _0x6d2f=['out','DATE','STRING','sequelize','exports','TEXT','medium','ENUM'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x6d2f,0x1eb));var _0xf6d2=function(_0x36f641,_0x1a3063){_0x36f641=_0x36f641-0x0;var _0x39b299=_0x6d2f[_0x36f641];return _0x39b299;};'use strict';var Sequelize=require(_0xf6d2('0x0'));module[_0xf6d2('0x1')]={'body':{'type':Sequelize[_0xf6d2('0x2')](_0xf6d2('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xf6d2('0x4')]('in',_0xf6d2('0x5')),'defaultValue':_0xf6d2('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xf6d2('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xf6d2('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xd981=['STRING','DATE','sequelize','medium','BOOLEAN','ENUM','out'];(function(_0x13b93e,_0x4ea3ed){var _0x3822ae=function(_0x54dc84){while(--_0x54dc84){_0x13b93e['push'](_0x13b93e['shift']());}};_0x3822ae(++_0x4ea3ed);}(_0xd981,0x1ad));var _0x1d98=function(_0x1fdc4f,_0x4b92ab){_0x1fdc4f=_0x1fdc4f-0x0;var _0x5ceaa2=_0xd981[_0x1fdc4f];return _0x5ceaa2;};'use strict';var Sequelize=require(_0x1d98('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x1d98('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x1d98('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1d98('0x3')]('in',_0x1d98('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x1d98('0x5')]},'readAt':{'type':Sequelize[_0x1d98('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x1d98('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index b63c90b..aa8b488 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 _0xab54=['mustache','to-csv','ejs','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','then','debug','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','request\x20sent','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','save','update','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','merge','options','includeAll','include','SmsMessage','show','keys','find','create','body','params','destroy','describe','sms-interactions','accept','sms','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','SmsInteractionId','isNil','read1stAt','interaction','info','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','contact','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','SmsInteraction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','Sequelize','QueryTypes','SELECT','User','SmsAccountId','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','plivo','MessageUUID','Status','plivio','infobip','results','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x1963c8,_0x2e9d24){var _0x1fb065=function(_0x59ec6f){while(--_0x59ec6f){_0x1963c8['push'](_0x1963c8['shift']());}};_0x1fb065(++_0x2e9d24);}(_0xab54,0x115));var _0x4ab5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xab54[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4ab5('0x0'));var zipdir=require(_0x4ab5('0x1'));var jsonpatch=require(_0x4ab5('0x2'));var rp=require(_0x4ab5('0x3'));var moment=require(_0x4ab5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4ab5('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x4ab5('0x6'));var ejs=require(_0x4ab5('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4ab5('0x8'));var squel=require('squel');var crypto=require(_0x4ab5('0x9'));var jsforce=require(_0x4ab5('0xa'));var deskjs=require(_0x4ab5('0xb'));var toCsv=require(_0x4ab5('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4ab5('0xc'));var qs=require(_0x4ab5('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4ab5('0xe'));var logger=require(_0x4ab5('0xf'))('api');var utils=require(_0x4ab5('0x10'));var config=require(_0x4ab5('0x11'));var licenseUtil=require(_0x4ab5('0x12'));var db=require(_0x4ab5('0x13'))['db'];config[_0x4ab5('0x14')]=_[_0x4ab5('0x15')](config[_0x4ab5('0x14')],{'host':_0x4ab5('0x16'),'port':0x18eb});var socket=require(_0x4ab5('0x17'))(new Redis(config[_0x4ab5('0x14')]));require(_0x4ab5('0x18'))[_0x4ab5('0x19')](socket);var jayson=require(_0x4ab5('0x1a'));var client=jayson[_0x4ab5('0x1b')]['http']({'port':0x232c});var client9002=jayson[_0x4ab5('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1c19f7,_0x5d0cbf,_0x5ce262,_0x474dbe){return new BPromise(function(_0x1b1ca5,_0x1cff8a){var _0x2f319d=_0x474dbe||client;return _0x2f319d['request'](_0x1c19f7,_0x5ce262)[_0x4ab5('0x1c')](function(_0x3f46c1){logger['info']('SmsMessage,\x20%s,\x20%s',_0x5d0cbf,'request\x20sent');logger[_0x4ab5('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5d0cbf,'request\x20sent',JSON[_0x4ab5('0x1e')](_0x3f46c1));if(_0x3f46c1[_0x4ab5('0x1f')]){if(_0x3f46c1[_0x4ab5('0x1f')][_0x4ab5('0x20')]===0x1f4){logger[_0x4ab5('0x1f')](_0x4ab5('0x21'),_0x5d0cbf,_0x3f46c1[_0x4ab5('0x1f')]['message']);return _0x1cff8a(_0x3f46c1[_0x4ab5('0x1f')][_0x4ab5('0x22')]);}logger[_0x4ab5('0x1f')](_0x4ab5('0x21'),_0x5d0cbf,_0x3f46c1[_0x4ab5('0x1f')][_0x4ab5('0x22')]);return _0x1b1ca5(_0x3f46c1['error'][_0x4ab5('0x22')]);}else{logger['info'](_0x4ab5('0x21'),_0x5d0cbf,_0x4ab5('0x23'));_0x1b1ca5(_0x3f46c1[_0x4ab5('0x24')][_0x4ab5('0x22')]);}})[_0x4ab5('0x25')](function(_0x231945){logger[_0x4ab5('0x1f')](_0x4ab5('0x21'),_0x5d0cbf,_0x231945);_0x1cff8a(_0x231945);});});}function respondWithStatusCode(_0x8c5203,_0xe2d41f){_0xe2d41f=_0xe2d41f||0xcc;return function(_0x5437d2){if(_0x5437d2){return _0x8c5203[_0x4ab5('0x26')](_0xe2d41f);}return _0x8c5203[_0x4ab5('0x27')](_0xe2d41f)[_0x4ab5('0x28')]();};}function respondWithResult(_0x278938,_0x1c3a2e){_0x1c3a2e=_0x1c3a2e||0xc8;return function(_0x384474){if(_0x384474){return _0x278938[_0x4ab5('0x27')](_0x1c3a2e)[_0x4ab5('0x29')](_0x384474);}};}function respondWithFilteredResult(_0x201aa5,_0xe3869){return function(_0x1c93e2){if(_0x1c93e2){var _0x19a1f8=typeof _0xe3869[_0x4ab5('0x2a')]===_0x4ab5('0x2b')&&typeof _0xe3869['limit']===_0x4ab5('0x2b');var _0xc73eda=_0x1c93e2[_0x4ab5('0x2c')];var _0x513a4f=_0x19a1f8?0x0:_0xe3869['offset'];var _0x3c0b72=_0x19a1f8?_0x1c93e2[_0x4ab5('0x2c')]:_0xe3869[_0x4ab5('0x2a')]+_0xe3869[_0x4ab5('0x2d')];var _0x4d428a;if(_0x3c0b72>=_0xc73eda){_0x3c0b72=_0xc73eda;_0x4d428a=0xc8;}else{_0x4d428a=0xce;}_0x201aa5[_0x4ab5('0x27')](_0x4d428a);return _0x201aa5[_0x4ab5('0x2e')]('Content-Range',_0x513a4f+'-'+_0x3c0b72+'/'+_0xc73eda)[_0x4ab5('0x29')](_0x1c93e2);}return null;};}function patchUpdates(_0x4767cb){return function(_0x2aa611){try{jsonpatch['apply'](_0x2aa611,_0x4767cb,!![]);}catch(_0x205a4e){return BPromise[_0x4ab5('0x2f')](_0x205a4e);}return _0x2aa611[_0x4ab5('0x30')]();};}function saveUpdates(_0x4b3581,_0x3762eb){return function(_0x5c0829){if(_0x5c0829){return _0x5c0829[_0x4ab5('0x31')](_0x4b3581)['then'](function(_0x3fb1a6){return _0x3fb1a6;});}return null;};}function removeEntity(_0x34938d,_0x108c0a){return function(_0x2eb260){if(_0x2eb260){return _0x2eb260['destroy']()[_0x4ab5('0x1c')](function(){_0x34938d[_0x4ab5('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x215a53,_0x387f42){return function(_0x2897f1){if(!_0x2897f1){_0x215a53[_0x4ab5('0x26')](0x194);}return _0x2897f1;};}function handleError(_0xf159e1,_0x12f06a){_0x12f06a=_0x12f06a||0x1f4;return function(_0x4c7308){logger[_0x4ab5('0x1f')](_0x4c7308[_0x4ab5('0x32')]);if(_0x4c7308[_0x4ab5('0x33')]){delete _0x4c7308['name'];}_0xf159e1[_0x4ab5('0x27')](_0x12f06a)[_0x4ab5('0x34')](_0x4c7308);};}exports[_0x4ab5('0x35')]=function(_0x411c9f,_0x488dd7){var _0x2d698b={},_0x38cf20={},_0x40d34a={'count':0x0,'rows':[]};var _0x54d2ab=_[_0x4ab5('0x36')](db['SmsMessage'][_0x4ab5('0x37')],function(_0x376202){return{'name':_0x376202[_0x4ab5('0x38')],'type':_0x376202[_0x4ab5('0x39')][_0x4ab5('0x3a')]};});_0x38cf20[_0x4ab5('0x3b')]=_[_0x4ab5('0x36')](_0x54d2ab,_0x4ab5('0x33'));_0x38cf20[_0x4ab5('0x3c')]=_['keys'](_0x411c9f[_0x4ab5('0x3c')]);_0x38cf20[_0x4ab5('0x3d')]=_['intersection'](_0x38cf20[_0x4ab5('0x3b')],_0x38cf20[_0x4ab5('0x3c')]);_0x2d698b[_0x4ab5('0x3e')]=_[_0x4ab5('0x3f')](_0x38cf20[_0x4ab5('0x3b')],qs[_0x4ab5('0x40')](_0x411c9f[_0x4ab5('0x3c')]['fields']));_0x2d698b[_0x4ab5('0x3e')]=_0x2d698b[_0x4ab5('0x3e')][_0x4ab5('0x41')]?_0x2d698b[_0x4ab5('0x3e')]:_0x38cf20[_0x4ab5('0x3b')];if(!_0x411c9f[_0x4ab5('0x3c')][_0x4ab5('0x42')](_0x4ab5('0x43'))){_0x2d698b['limit']=qs[_0x4ab5('0x2d')](_0x411c9f[_0x4ab5('0x3c')][_0x4ab5('0x2d')]);_0x2d698b[_0x4ab5('0x2a')]=qs[_0x4ab5('0x2a')](_0x411c9f[_0x4ab5('0x3c')][_0x4ab5('0x2a')]);}_0x2d698b[_0x4ab5('0x44')]=qs['sort'](_0x411c9f[_0x4ab5('0x3c')]['sort']);_0x2d698b[_0x4ab5('0x45')]=qs[_0x4ab5('0x3d')](_[_0x4ab5('0x46')](_0x411c9f['query'],_0x38cf20[_0x4ab5('0x3d')]),_0x54d2ab);if(_0x411c9f[_0x4ab5('0x3c')][_0x4ab5('0x47')]){_0x2d698b['where']=_['merge'](_0x2d698b[_0x4ab5('0x45')],{'$or':_[_0x4ab5('0x36')](_0x54d2ab,function(_0x5d7c3c){if(_0x5d7c3c['type']!==_0x4ab5('0x48')){var _0x1b604b={};_0x1b604b[_0x5d7c3c['name']]={'$like':'%'+_0x411c9f['query']['filter']+'%'};return _0x1b604b;}})});}_0x2d698b=_[_0x4ab5('0x49')]({},_0x2d698b,_0x411c9f[_0x4ab5('0x4a')]);var _0x48fe92={'where':_0x2d698b[_0x4ab5('0x45')]};return db['SmsMessage'][_0x4ab5('0x2c')](_0x48fe92)[_0x4ab5('0x1c')](function(_0x2679b6){_0x40d34a[_0x4ab5('0x2c')]=_0x2679b6;if(_0x411c9f[_0x4ab5('0x3c')][_0x4ab5('0x4b')]){_0x2d698b[_0x4ab5('0x4c')]=[{'all':!![]}];}return db[_0x4ab5('0x4d')]['findAll'](_0x2d698b);})[_0x4ab5('0x1c')](function(_0x370a06){_0x40d34a['rows']=_0x370a06;return _0x40d34a;})['then'](respondWithFilteredResult(_0x488dd7,_0x2d698b))[_0x4ab5('0x25')](handleError(_0x488dd7,null));};exports[_0x4ab5('0x4e')]=function(_0x5ad0a6,_0x33b002){var _0x590232={'raw':!![],'where':{'id':_0x5ad0a6['params']['id']}},_0x518464={};_0x518464[_0x4ab5('0x3b')]=_['keys'](db['SmsMessage'][_0x4ab5('0x37')]);_0x518464['query']=_[_0x4ab5('0x4f')](_0x5ad0a6[_0x4ab5('0x3c')]);_0x518464['filters']=_[_0x4ab5('0x3f')](_0x518464[_0x4ab5('0x3b')],_0x518464[_0x4ab5('0x3c')]);_0x590232[_0x4ab5('0x3e')]=_[_0x4ab5('0x3f')](_0x518464[_0x4ab5('0x3b')],qs[_0x4ab5('0x40')](_0x5ad0a6[_0x4ab5('0x3c')][_0x4ab5('0x40')]));_0x590232['attributes']=_0x590232[_0x4ab5('0x3e')][_0x4ab5('0x41')]?_0x590232['attributes']:_0x518464['model'];if(_0x5ad0a6[_0x4ab5('0x3c')][_0x4ab5('0x4b')]){_0x590232[_0x4ab5('0x4c')]=[{'all':!![]}];}_0x590232=_[_0x4ab5('0x49')]({},_0x590232,_0x5ad0a6[_0x4ab5('0x4a')]);return db[_0x4ab5('0x4d')][_0x4ab5('0x50')](_0x590232)[_0x4ab5('0x1c')](handleEntityNotFound(_0x33b002,null))['then'](respondWithResult(_0x33b002,null))[_0x4ab5('0x25')](handleError(_0x33b002,null));};exports[_0x4ab5('0x51')]=function(_0x12c5fe,_0x5f1768){return db[_0x4ab5('0x4d')][_0x4ab5('0x51')](_0x12c5fe['body'],{})[_0x4ab5('0x1c')](respondWithResult(_0x5f1768,0xc9))[_0x4ab5('0x25')](handleError(_0x5f1768,null));};exports[_0x4ab5('0x31')]=function(_0x309fab,_0xb404ea){if(_0x309fab[_0x4ab5('0x52')]['id']){delete _0x309fab[_0x4ab5('0x52')]['id'];}return db[_0x4ab5('0x4d')][_0x4ab5('0x50')]({'where':{'id':_0x309fab[_0x4ab5('0x53')]['id']}})[_0x4ab5('0x1c')](handleEntityNotFound(_0xb404ea,null))[_0x4ab5('0x1c')](saveUpdates(_0x309fab[_0x4ab5('0x52')],null))['then'](respondWithResult(_0xb404ea,null))['catch'](handleError(_0xb404ea,null));};exports[_0x4ab5('0x54')]=function(_0x397fdd,_0x178a42){return db['SmsMessage'][_0x4ab5('0x50')]({'where':{'id':_0x397fdd[_0x4ab5('0x53')]['id']}})[_0x4ab5('0x1c')](handleEntityNotFound(_0x178a42,null))[_0x4ab5('0x1c')](removeEntity(_0x178a42,null))[_0x4ab5('0x25')](handleError(_0x178a42,null));};exports[_0x4ab5('0x55')]=function(_0x3b2544,_0x415b01){return db[_0x4ab5('0x4d')][_0x4ab5('0x55')]()[_0x4ab5('0x1c')](respondWithResult(_0x415b01,null))[_0x4ab5('0x25')](handleError(_0x415b01,null));};var interaction_log=require(_0x4ab5('0xf'))(_0x4ab5('0x56'));exports[_0x4ab5('0x57')]=function(_0x28a0e1,_0x4f234f,_0x2dfa67){var _0x58803f={'agent':{},'channel':_0x4ab5('0x58')};if(_0x28a0e1[_0x4ab5('0x52')]['id']){delete _0x28a0e1[_0x4ab5('0x52')]['id'];}_0x28a0e1[_0x4ab5('0x52')][_0x4ab5('0x59')]=!![];_0x28a0e1['body']['readAt']=moment()[_0x4ab5('0x5a')](_0x4ab5('0x5b'));_0x28a0e1[_0x4ab5('0x52')]['UserId']=_0x28a0e1[_0x4ab5('0x52')][_0x4ab5('0x5c')]||_0x28a0e1['user']['id'];_0x58803f[_0x4ab5('0x5d')]['id']=_0x28a0e1[_0x4ab5('0x52')][_0x4ab5('0x5c')];return db['SmsMessage'][_0x4ab5('0x50')]({'where':{'id':_0x28a0e1[_0x4ab5('0x53')]['id'],'UserId':null}})[_0x4ab5('0x1c')](handleEntityNotFound(_0x4f234f,null))[_0x4ab5('0x1c')](saveUpdates(_0x28a0e1[_0x4ab5('0x52')],null))['then'](function(_0x257f40){if(_0x257f40){_0x58803f[_0x4ab5('0x22')]=_0x257f40[_0x4ab5('0x5e')]({'plain':!![]});return db['SmsInteraction'][_0x4ab5('0x50')]({'where':{'id':_0x257f40[_0x4ab5('0x5f')]}});}return null;})[_0x4ab5('0x1c')](handleEntityNotFound(_0x4f234f,null))[_0x4ab5('0x1c')](function(_0x2c438a){if(_0x2c438a){return _0x2c438a[_0x4ab5('0x31')]({'UserId':_0x28a0e1[_0x4ab5('0x52')]['UserId'],'read1stAt':_[_0x4ab5('0x60')](_0x2c438a[_0x4ab5('0x61')])?moment()[_0x4ab5('0x5a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x91069f){if(_0x91069f){_0x58803f[_0x4ab5('0x62')]=_0x91069f[_0x4ab5('0x5e')]({'plain':!![]});interaction_log[_0x4ab5('0x63')](_0x4ab5('0x64'),_0x28a0e1[_0x4ab5('0x65')]['id'],_0x28a0e1[_0x4ab5('0x65')][_0x4ab5('0x33')],_0x28a0e1[_0x4ab5('0x65')]['role'],_0x58803f[_0x4ab5('0x62')]['id'],_0x28a0e1[_0x4ab5('0x52')]?JSON['stringify'](_0x28a0e1[_0x4ab5('0x52')]):'null');return respondWithRpcPromise(_0x4ab5('0x66'),_0x4ab5('0x67'),_0x58803f);}return null;})[_0x4ab5('0x1c')](function(_0x3589ac){var _0x550f8f=_0x4ab5('0x68')+_0x3589ac[_0x4ab5('0x22')][_0x4ab5('0x69')];return db[_0x4ab5('0x6a')][_0x4ab5('0x3c')](_0x550f8f,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0x4ab5('0x1c')](function(_0xe22333){return _0xe22333;});})[_0x4ab5('0x1c')](function(_0x31f3c3){if(_0x31f3c3){_0x58803f[_0x4ab5('0x22')][_0x4ab5('0x6b')]=_0x31f3c3[0x0];if(!_0x28a0e1[_0x4ab5('0x52')][_0x4ab5('0x5c')])return;return db['User'][_0x4ab5('0x50')]({'where':{'id':_0x28a0e1[_0x4ab5('0x52')][_0x4ab5('0x5c')],'role':_0x4ab5('0x5d')},'attributes':['id',_0x4ab5('0x33'),_0x4ab5('0x6c'),_0x4ab5('0x6d'),_0x4ab5('0x6e')],'raw':!![]});}return null;})[_0x4ab5('0x1c')](function(_0x3aa65b){if(!_0x3aa65b)return null;_0x58803f[_0x4ab5('0x22')][_0x4ab5('0x5d')]=_0x3aa65b;return _0x58803f;})[_0x4ab5('0x1c')](function(_0x1a420b){if(_0x1a420b){if(_0x28a0e1[_0x4ab5('0x52')][_0x4ab5('0x6f')]){_0x58803f[_0x4ab5('0x22')][_0x4ab5('0x70')]=util[_0x4ab5('0x5a')](_0x4ab5('0x71'),_0x28a0e1['user'][_0x4ab5('0x33')]);_0x58803f['message']['channel']=_0x58803f[_0x4ab5('0x72')];_0x58803f[_0x4ab5('0x22')][_0x4ab5('0x73')]=_0x58803f[_0x4ab5('0x72')];_0x58803f[_0x4ab5('0x22')][_0x4ab5('0x74')]=_0x4ab5('0x57');return respondWithRpcPromise(_0x4ab5('0x75'),'EventManager',{'event':_0x4ab5('0x76'),'message':_0x58803f['message']},client9002)['then'](function(){return _0x58803f;});}return _0x58803f;}return null;})[_0x4ab5('0x1c')](respondWithResult(_0x4f234f,null))[_0x4ab5('0x25')](handleError(_0x4f234f,null));};var interaction_log=require(_0x4ab5('0xf'))('sms-interactions');exports[_0x4ab5('0x2f')]=function(_0x46c13c,_0x2d1aad,_0x446e3a){var _0x36103b={'agent':{},'channel':_0x4ab5('0x58')};if(_0x46c13c[_0x4ab5('0x52')]['id']){delete _0x46c13c[_0x4ab5('0x52')]['id'];}_0x46c13c[_0x4ab5('0x52')][_0x4ab5('0x5c')]=_0x46c13c['body'][_0x4ab5('0x5c')]||_0x46c13c['user']['id'];_0x36103b[_0x4ab5('0x5d')]['id']=_0x46c13c[_0x4ab5('0x52')][_0x4ab5('0x5c')];return db[_0x4ab5('0x4d')][_0x4ab5('0x50')]({'where':{'id':_0x46c13c['params']['id'],'UserId':null}})[_0x4ab5('0x1c')](handleEntityNotFound(_0x2d1aad,null))[_0x4ab5('0x1c')](function(_0x3fa471){if(_0x3fa471){_0x36103b['message']=_0x3fa471[_0x4ab5('0x5e')]({'plain':!![]});return db[_0x4ab5('0x77')][_0x4ab5('0x50')]({'where':{'id':_0x3fa471[_0x4ab5('0x5f')]}});}return null;})[_0x4ab5('0x1c')](handleEntityNotFound(_0x2d1aad,null))[_0x4ab5('0x1c')](function(_0x3d20e8){if(_0x3d20e8){_0x36103b[_0x4ab5('0x62')]=_0x3d20e8[_0x4ab5('0x5e')]({'plain':!![]});interaction_log[_0x4ab5('0x63')](_0x4ab5('0x78'),_0x46c13c[_0x4ab5('0x65')]['id'],_0x46c13c[_0x4ab5('0x65')][_0x4ab5('0x33')],_0x46c13c['user'][_0x4ab5('0x79')],_0x36103b[_0x4ab5('0x62')]['id'],_0x46c13c[_0x4ab5('0x52')]?JSON[_0x4ab5('0x1e')](_0x46c13c[_0x4ab5('0x52')]):'null');return respondWithRpcPromise(_0x4ab5('0x7a'),_0x4ab5('0x7b'),_0x36103b);}return null;})[_0x4ab5('0x1c')](function(_0x539fc7){var _0x58ba15=_0x4ab5('0x68')+_0x539fc7['message']['ContactId'];return db[_0x4ab5('0x6a')][_0x4ab5('0x3c')](_0x58ba15,{'type':db[_0x4ab5('0x7c')][_0x4ab5('0x7d')][_0x4ab5('0x7e')],'raw':!![]})[_0x4ab5('0x1c')](function(_0x332844){return _0x332844;});})['then'](function(_0x3bd366){if(_0x3bd366){_0x36103b['message'][_0x4ab5('0x6b')]=_0x3bd366[0x0];if(!_0x46c13c['body'][_0x4ab5('0x5c')])return;return db[_0x4ab5('0x7f')][_0x4ab5('0x50')]({'where':{'id':_0x46c13c[_0x4ab5('0x52')][_0x4ab5('0x5c')],'role':_0x4ab5('0x5d')},'attributes':['id',_0x4ab5('0x33'),'fullname',_0x4ab5('0x6d'),_0x4ab5('0x6e')],'raw':!![]});}return null;})[_0x4ab5('0x1c')](function(_0xaa66f){if(!_0xaa66f)return null;_0x36103b['message']['agent']=_0xaa66f;return _0x36103b;})['then'](function(_0x3414){if(_0x3414){_0x3414[_0x4ab5('0x22')]['interface']=util['format']('SIP/%s',_0x46c13c['user'][_0x4ab5('0x33')]);_0x3414['message'][_0x4ab5('0x72')]=_0x36103b['channel'];_0x3414['message'][_0x4ab5('0x73')]=_0x36103b[_0x4ab5('0x72')];_0x3414[_0x4ab5('0x22')]['event']=_0x4ab5('0x2f');respondWithRpcPromise(_0x4ab5('0x75'),_0x4ab5('0x75'),{'event':'rejectmessage','message':_0x3414[_0x4ab5('0x22')]},client9002);return _0x36103b;}return null;})[_0x4ab5('0x1c')](respondWithResult(_0x2d1aad,null))[_0x4ab5('0x25')](handleError(_0x2d1aad,null));};exports[_0x4ab5('0x27')]=function(_0x259438,_0x3c0864,_0x4878cf){if(_0x259438[_0x4ab5('0x52')]['id']){delete _0x259438[_0x4ab5('0x52')]['id'];}var _0x266dc8;return db[_0x4ab5('0x4d')][_0x4ab5('0x50')]({'where':{'id':_0x259438[_0x4ab5('0x53')]['id']}})[_0x4ab5('0x1c')](handleEntityNotFound(_0x3c0864,null))['then'](function(_0x366214){if(_0x366214){_0x266dc8=_0x366214;return db['SmsAccount'][_0x4ab5('0x50')]({'where':{'id':_0x366214[_0x4ab5('0x80')]}});}})['then'](handleEntityNotFound(_0x3c0864,null))[_0x4ab5('0x1c')](function(_0xe2e313){if(_0xe2e313){logger[_0x4ab5('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4ab5('0x27'),_0x4ab5('0x81'),_0xe2e313[_0x4ab5('0x39')],util['inspect'](_0x259438[_0x4ab5('0x52')],{'showHidden':![],'depth':null}));switch(_0xe2e313['type']){case _0x4ab5('0x82'):if(_0x259438[_0x4ab5('0x52')][_0x4ab5('0x83')]&&_0x259438[_0x4ab5('0x52')]['MessageSid']===_0x266dc8[_0x4ab5('0x84')]){return _0x266dc8[_0x4ab5('0x31')]({'read':!![]});}else{logger[_0x4ab5('0x1f')](_0x4ab5('0x85'),_0x4ab5('0x27'),_0x4ab5('0x82'),util[_0x4ab5('0x86')](_0x259438[_0x4ab5('0x52')],{'showHidden':![],'depth':null}));}break;case _0x4ab5('0x87'):if(_0x259438[_0x4ab5('0x52')][_0x4ab5('0x88')]&&_0x259438[_0x4ab5('0x52')][_0x4ab5('0x88')]===_0x266dc8[_0x4ab5('0x84')]&&_['indexOf'](['sent','delivered'],_0x259438['body'][_0x4ab5('0x89')])>=0x0){return _0x266dc8[_0x4ab5('0x31')]({'read':!![]});}else{logger[_0x4ab5('0x1f')](_0x4ab5('0x85'),'status',_0x4ab5('0x8a'),util[_0x4ab5('0x86')](_0x259438['body'],{'showHidden':![],'depth':null}));}break;case _0x4ab5('0x8b'):var _0xd9899=_0x259438[_0x4ab5('0x52')][_0x4ab5('0x8c')][0x0];if(_0xd9899[_0x4ab5('0x27')]['groupName']==='DELIVERED'){return _0x266dc8[_0x4ab5('0x31')]({'read':!![]});}else{logger['error'](_0x4ab5('0x85'),_0x4ab5('0x27'),'infobip',util[_0x4ab5('0x86')](_0x259438[_0x4ab5('0x52')],{'showHidden':![],'depth':null}));}break;}return _0x266dc8;}})[_0x4ab5('0x1c')](respondWithResult(_0x3c0864,null))[_0x4ab5('0x25')](handleError(_0x3c0864,null));}; \ No newline at end of file +var _0x40ac=['[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','manual','interface','channel','motionChannel','event','acceptmessage','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','email','internal','SIP/%s','EventManager','rejectmessage','SmsAccount','SmsAccountId','inspect','twilio','MessageSid','messageId','MessageUUID','indexOf','delivered','plivio','results','groupName','DELIVERED','SmsAccount,\x20%s,\x20%s,\x20%s','infobip','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','client','http','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','update','then','destroy','end','stack','send','map','SmsMessage','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','findAll','rows','show','params','include','options','find','create','catch','body','sms-interactions','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','SmsInteraction','SmsInteractionId','read1stAt','interaction','get'];(function(_0x1be55c,_0x353c4f){var _0x421594=function(_0x33da56){while(--_0x33da56){_0x1be55c['push'](_0x1be55c['shift']());}};_0x421594(++_0x353c4f);}(_0x40ac,0x1de));var _0xc40a=function(_0x4f8f3b,_0x43281b){_0x4f8f3b=_0x4f8f3b-0x0;var _0x4c250c=_0x40ac[_0x4f8f3b];return _0x4c250c;};'use strict';var emlformat=require(_0xc40a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc40a('0x1'));var jsonpatch=require(_0xc40a('0x2'));var rp=require(_0xc40a('0x3'));var moment=require(_0xc40a('0x4'));var BPromise=require(_0xc40a('0x5'));var Mustache=require(_0xc40a('0x6'));var util=require(_0xc40a('0x7'));var path=require('path');var sox=require(_0xc40a('0x8'));var csv=require(_0xc40a('0x9'));var ejs=require(_0xc40a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc40a('0xb'));var crypto=require(_0xc40a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc40a('0xd'));var toCsv=require(_0xc40a('0x9'));var querystring=require(_0xc40a('0xe'));var Papa=require(_0xc40a('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc40a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc40a('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xc40a('0x12'));var licenseUtil=require(_0xc40a('0x13'));var db=require(_0xc40a('0x14'))['db'];config[_0xc40a('0x15')]=_[_0xc40a('0x16')](config[_0xc40a('0x15')],{'host':_0xc40a('0x17'),'port':0x18eb});var socket=require(_0xc40a('0x18'))(new Redis(config['redis']));require(_0xc40a('0x19'))[_0xc40a('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0xc40a('0x1b')]['http']({'port':0x232c});var client9002=jayson[_0xc40a('0x1b')][_0xc40a('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x1a8654,_0x3eeeb8,_0x15131d,_0x4bc038){return new BPromise(function(_0x3d1502,_0x272fef){var _0x158625=_0x4bc038||client;return _0x158625['request'](_0x1a8654,_0x15131d)['then'](function(_0x24e0d3){logger['info'](_0xc40a('0x1d'),_0x3eeeb8,'request\x20sent');logger[_0xc40a('0x1e')](_0xc40a('0x1f'),_0x3eeeb8,_0xc40a('0x20'),JSON[_0xc40a('0x21')](_0x24e0d3));if(_0x24e0d3['error']){if(_0x24e0d3[_0xc40a('0x22')][_0xc40a('0x23')]===0x1f4){logger['error'](_0xc40a('0x1d'),_0x3eeeb8,_0x24e0d3['error']['message']);return _0x272fef(_0x24e0d3[_0xc40a('0x22')][_0xc40a('0x24')]);}logger[_0xc40a('0x22')](_0xc40a('0x1d'),_0x3eeeb8,_0x24e0d3[_0xc40a('0x22')][_0xc40a('0x24')]);return _0x3d1502(_0x24e0d3[_0xc40a('0x22')]['message']);}else{logger[_0xc40a('0x25')]('SmsMessage,\x20%s,\x20%s',_0x3eeeb8,_0xc40a('0x20'));_0x3d1502(_0x24e0d3['result'][_0xc40a('0x24')]);}})['catch'](function(_0x1f37c5){logger['error'](_0xc40a('0x1d'),_0x3eeeb8,_0x1f37c5);_0x272fef(_0x1f37c5);});});}function respondWithStatusCode(_0x10a8a3,_0x27346e){_0x27346e=_0x27346e||0xcc;return function(_0x5c144e){if(_0x5c144e){return _0x10a8a3[_0xc40a('0x26')](_0x27346e);}return _0x10a8a3[_0xc40a('0x27')](_0x27346e)['end']();};}function respondWithResult(_0xdc19d7,_0x43fa1c){_0x43fa1c=_0x43fa1c||0xc8;return function(_0x518b06){if(_0x518b06){return _0xdc19d7['status'](_0x43fa1c)['json'](_0x518b06);}};}function respondWithFilteredResult(_0x14240f,_0x7fc56d){return function(_0x7769dd){if(_0x7769dd){var _0x2f3c49=typeof _0x7fc56d[_0xc40a('0x28')]===_0xc40a('0x29')&&typeof _0x7fc56d[_0xc40a('0x2a')]===_0xc40a('0x29');var _0x5c1c82=_0x7769dd[_0xc40a('0x2b')];var _0x38271e=_0x2f3c49?0x0:_0x7fc56d[_0xc40a('0x28')];var _0x44ba01=_0x2f3c49?_0x7769dd[_0xc40a('0x2b')]:_0x7fc56d[_0xc40a('0x28')]+_0x7fc56d[_0xc40a('0x2a')];var _0xdd83e9;if(_0x44ba01>=_0x5c1c82){_0x44ba01=_0x5c1c82;_0xdd83e9=0xc8;}else{_0xdd83e9=0xce;}_0x14240f[_0xc40a('0x27')](_0xdd83e9);return _0x14240f[_0xc40a('0x2c')]('Content-Range',_0x38271e+'-'+_0x44ba01+'/'+_0x5c1c82)[_0xc40a('0x2d')](_0x7769dd);}return null;};}function patchUpdates(_0xa69b88){return function(_0x13fa05){try{jsonpatch[_0xc40a('0x2e')](_0x13fa05,_0xa69b88,!![]);}catch(_0x14d948){return BPromise[_0xc40a('0x2f')](_0x14d948);}return _0x13fa05['save']();};}function saveUpdates(_0x54eff6,_0x1e3b7){return function(_0x1976ab){if(_0x1976ab){return _0x1976ab[_0xc40a('0x30')](_0x54eff6)[_0xc40a('0x31')](function(_0x231626){return _0x231626;});}return null;};}function removeEntity(_0x5769da,_0x1a954c){return function(_0x2da8c2){if(_0x2da8c2){return _0x2da8c2[_0xc40a('0x32')]()[_0xc40a('0x31')](function(){_0x5769da[_0xc40a('0x27')](0xcc)[_0xc40a('0x33')]();});}};}function handleEntityNotFound(_0xea99c4,_0x389237){return function(_0x4d2929){if(!_0x4d2929){_0xea99c4[_0xc40a('0x26')](0x194);}return _0x4d2929;};}function handleError(_0x450f57,_0x2bcfc0){_0x2bcfc0=_0x2bcfc0||0x1f4;return function(_0x3c3a7f){logger[_0xc40a('0x22')](_0x3c3a7f[_0xc40a('0x34')]);if(_0x3c3a7f['name']){delete _0x3c3a7f['name'];}_0x450f57[_0xc40a('0x27')](_0x2bcfc0)[_0xc40a('0x35')](_0x3c3a7f);};}exports['index']=function(_0x254030,_0x403349){var _0x339429={},_0x53d373={},_0x2e5a96={'count':0x0,'rows':[]};var _0x1eb68d=_[_0xc40a('0x36')](db[_0xc40a('0x37')][_0xc40a('0x38')],function(_0x5a6408){return{'name':_0x5a6408[_0xc40a('0x39')],'type':_0x5a6408[_0xc40a('0x3a')][_0xc40a('0x3b')]};});_0x53d373[_0xc40a('0x3c')]=_['map'](_0x1eb68d,_0xc40a('0x3d'));_0x53d373[_0xc40a('0x3e')]=_[_0xc40a('0x3f')](_0x254030[_0xc40a('0x3e')]);_0x53d373[_0xc40a('0x40')]=_[_0xc40a('0x41')](_0x53d373[_0xc40a('0x3c')],_0x53d373[_0xc40a('0x3e')]);_0x339429[_0xc40a('0x42')]=_['intersection'](_0x53d373[_0xc40a('0x3c')],qs['fields'](_0x254030[_0xc40a('0x3e')][_0xc40a('0x43')]));_0x339429['attributes']=_0x339429[_0xc40a('0x42')][_0xc40a('0x44')]?_0x339429[_0xc40a('0x42')]:_0x53d373[_0xc40a('0x3c')];if(!_0x254030['query'][_0xc40a('0x45')](_0xc40a('0x46'))){_0x339429[_0xc40a('0x2a')]=qs['limit'](_0x254030['query'][_0xc40a('0x2a')]);_0x339429[_0xc40a('0x28')]=qs[_0xc40a('0x28')](_0x254030[_0xc40a('0x3e')][_0xc40a('0x28')]);}_0x339429['order']=qs[_0xc40a('0x47')](_0x254030[_0xc40a('0x3e')][_0xc40a('0x47')]);_0x339429[_0xc40a('0x48')]=qs['filters'](_[_0xc40a('0x49')](_0x254030[_0xc40a('0x3e')],_0x53d373[_0xc40a('0x40')]),_0x1eb68d);if(_0x254030[_0xc40a('0x3e')][_0xc40a('0x4a')]){_0x339429['where']=_[_0xc40a('0x4b')](_0x339429[_0xc40a('0x48')],{'$or':_['map'](_0x1eb68d,function(_0x2780d9){if(_0x2780d9[_0xc40a('0x3a')]!=='VIRTUAL'){var _0x49eaf1={};_0x49eaf1[_0x2780d9[_0xc40a('0x3d')]]={'$like':'%'+_0x254030[_0xc40a('0x3e')]['filter']+'%'};return _0x49eaf1;}})});}_0x339429=_['merge']({},_0x339429,_0x254030['options']);var _0xdaa293={'where':_0x339429[_0xc40a('0x48')]};return db['SmsMessage'][_0xc40a('0x2b')](_0xdaa293)[_0xc40a('0x31')](function(_0x97085e){_0x2e5a96[_0xc40a('0x2b')]=_0x97085e;if(_0x254030[_0xc40a('0x3e')][_0xc40a('0x4c')]){_0x339429['include']=[{'all':!![]}];}return db[_0xc40a('0x37')][_0xc40a('0x4d')](_0x339429);})[_0xc40a('0x31')](function(_0x21e0e5){_0x2e5a96[_0xc40a('0x4e')]=_0x21e0e5;return _0x2e5a96;})[_0xc40a('0x31')](respondWithFilteredResult(_0x403349,_0x339429))['catch'](handleError(_0x403349,null));};exports[_0xc40a('0x4f')]=function(_0x357116,_0x100cfd){var _0x3fc897={'raw':!![],'where':{'id':_0x357116[_0xc40a('0x50')]['id']}},_0x507b56={};_0x507b56['model']=_['keys'](db[_0xc40a('0x37')]['rawAttributes']);_0x507b56['query']=_['keys'](_0x357116[_0xc40a('0x3e')]);_0x507b56[_0xc40a('0x40')]=_[_0xc40a('0x41')](_0x507b56[_0xc40a('0x3c')],_0x507b56[_0xc40a('0x3e')]);_0x3fc897[_0xc40a('0x42')]=_[_0xc40a('0x41')](_0x507b56['model'],qs[_0xc40a('0x43')](_0x357116[_0xc40a('0x3e')][_0xc40a('0x43')]));_0x3fc897[_0xc40a('0x42')]=_0x3fc897[_0xc40a('0x42')][_0xc40a('0x44')]?_0x3fc897[_0xc40a('0x42')]:_0x507b56[_0xc40a('0x3c')];if(_0x357116[_0xc40a('0x3e')][_0xc40a('0x4c')]){_0x3fc897[_0xc40a('0x51')]=[{'all':!![]}];}_0x3fc897=_['merge']({},_0x3fc897,_0x357116[_0xc40a('0x52')]);return db[_0xc40a('0x37')][_0xc40a('0x53')](_0x3fc897)[_0xc40a('0x31')](handleEntityNotFound(_0x100cfd,null))[_0xc40a('0x31')](respondWithResult(_0x100cfd,null))['catch'](handleError(_0x100cfd,null));};exports[_0xc40a('0x54')]=function(_0x35f5c6,_0xfcc4e1){return db[_0xc40a('0x37')]['create'](_0x35f5c6['body'],{})[_0xc40a('0x31')](respondWithResult(_0xfcc4e1,0xc9))[_0xc40a('0x55')](handleError(_0xfcc4e1,null));};exports[_0xc40a('0x30')]=function(_0x1c0b74,_0x51eb80){if(_0x1c0b74['body']['id']){delete _0x1c0b74[_0xc40a('0x56')]['id'];}return db[_0xc40a('0x37')][_0xc40a('0x53')]({'where':{'id':_0x1c0b74[_0xc40a('0x50')]['id']}})[_0xc40a('0x31')](handleEntityNotFound(_0x51eb80,null))[_0xc40a('0x31')](saveUpdates(_0x1c0b74[_0xc40a('0x56')],null))[_0xc40a('0x31')](respondWithResult(_0x51eb80,null))[_0xc40a('0x55')](handleError(_0x51eb80,null));};exports[_0xc40a('0x32')]=function(_0x1e9cab,_0x483e8f){return db[_0xc40a('0x37')][_0xc40a('0x53')]({'where':{'id':_0x1e9cab[_0xc40a('0x50')]['id']}})[_0xc40a('0x31')](handleEntityNotFound(_0x483e8f,null))['then'](removeEntity(_0x483e8f,null))[_0xc40a('0x55')](handleError(_0x483e8f,null));};exports['describe']=function(_0x23e4d1,_0x264457){return db[_0xc40a('0x37')]['describe']()[_0xc40a('0x31')](respondWithResult(_0x264457,null))['catch'](handleError(_0x264457,null));};var interaction_log=require(_0xc40a('0x11'))(_0xc40a('0x57'));exports[_0xc40a('0x58')]=function(_0x4fd98c,_0x4284e8,_0x401853){var _0x455ad0={'agent':{},'channel':_0xc40a('0x59')};if(_0x4fd98c[_0xc40a('0x56')]['id']){delete _0x4fd98c[_0xc40a('0x56')]['id'];}_0x4fd98c[_0xc40a('0x56')][_0xc40a('0x5a')]=!![];_0x4fd98c['body'][_0xc40a('0x5b')]=moment()[_0xc40a('0x5c')](_0xc40a('0x5d'));_0x4fd98c['body'][_0xc40a('0x5e')]=_0x4fd98c[_0xc40a('0x56')]['UserId']||_0x4fd98c[_0xc40a('0x5f')]['id'];_0x455ad0[_0xc40a('0x60')]['id']=_0x4fd98c[_0xc40a('0x56')][_0xc40a('0x5e')];return db[_0xc40a('0x37')]['find']({'where':{'id':_0x4fd98c[_0xc40a('0x50')]['id'],'UserId':null}})[_0xc40a('0x31')](handleEntityNotFound(_0x4284e8,null))['then'](saveUpdates(_0x4fd98c[_0xc40a('0x56')],null))[_0xc40a('0x31')](function(_0x9bd497){if(_0x9bd497){_0x455ad0[_0xc40a('0x24')]=_0x9bd497['get']({'plain':!![]});return db[_0xc40a('0x61')][_0xc40a('0x53')]({'where':{'id':_0x9bd497[_0xc40a('0x62')]}});}return null;})[_0xc40a('0x31')](handleEntityNotFound(_0x4284e8,null))['then'](function(_0x5391bf){if(_0x5391bf){return _0x5391bf[_0xc40a('0x30')]({'UserId':_0x4fd98c[_0xc40a('0x56')]['UserId'],'read1stAt':_['isNil'](_0x5391bf[_0xc40a('0x63')])?moment()[_0xc40a('0x5c')](_0xc40a('0x5d')):undefined});}return null;})[_0xc40a('0x31')](function(_0xedd96a){if(_0xedd96a){_0x455ad0[_0xc40a('0x64')]=_0xedd96a[_0xc40a('0x65')]({'plain':!![]});interaction_log[_0xc40a('0x25')](_0xc40a('0x66'),_0x4fd98c[_0xc40a('0x5f')]['id'],_0x4fd98c[_0xc40a('0x5f')][_0xc40a('0x3d')],_0x4fd98c[_0xc40a('0x5f')][_0xc40a('0x67')],_0x455ad0['interaction']['id'],_0x4fd98c[_0xc40a('0x56')]?JSON[_0xc40a('0x21')](_0x4fd98c[_0xc40a('0x56')]):_0xc40a('0x68'));return respondWithRpcPromise(_0xc40a('0x69'),_0xc40a('0x6a'),_0x455ad0);}return null;})['then'](function(_0x41d9be){var _0x20c8cd=_0xc40a('0x6b')+_0x41d9be[_0xc40a('0x24')][_0xc40a('0x6c')];return db['sequelize']['query'](_0x20c8cd,{'type':db[_0xc40a('0x6d')][_0xc40a('0x6e')][_0xc40a('0x6f')],'raw':!![]})[_0xc40a('0x31')](function(_0x3b81b2){return _0x3b81b2;});})[_0xc40a('0x31')](function(_0x509201){if(_0x509201){_0x455ad0[_0xc40a('0x24')][_0xc40a('0x70')]=_0x509201[0x0];if(!_0x4fd98c[_0xc40a('0x56')]['UserId'])return;return db[_0xc40a('0x71')]['find']({'where':{'id':_0x4fd98c[_0xc40a('0x56')][_0xc40a('0x5e')],'role':'agent'},'attributes':['id',_0xc40a('0x3d'),_0xc40a('0x72'),'email','internal'],'raw':!![]});}return null;})[_0xc40a('0x31')](function(_0x3ec268){if(!_0x3ec268)return null;_0x455ad0['message'][_0xc40a('0x60')]=_0x3ec268;return _0x455ad0;})[_0xc40a('0x31')](function(_0x91752f){if(_0x91752f){if(_0x4fd98c[_0xc40a('0x56')][_0xc40a('0x73')]){_0x455ad0[_0xc40a('0x24')][_0xc40a('0x74')]=util[_0xc40a('0x5c')]('SIP/%s',_0x4fd98c[_0xc40a('0x5f')][_0xc40a('0x3d')]);_0x455ad0[_0xc40a('0x24')][_0xc40a('0x75')]=_0x455ad0[_0xc40a('0x75')];_0x455ad0[_0xc40a('0x24')][_0xc40a('0x76')]=_0x455ad0[_0xc40a('0x75')];_0x455ad0['message'][_0xc40a('0x77')]='accept';return respondWithRpcPromise('EventManager','EventManager',{'event':_0xc40a('0x78'),'message':_0x455ad0[_0xc40a('0x24')]},client9002)[_0xc40a('0x31')](function(){return _0x455ad0;});}return _0x455ad0;}return null;})['then'](respondWithResult(_0x4284e8,null))['catch'](handleError(_0x4284e8,null));};var interaction_log=require(_0xc40a('0x11'))(_0xc40a('0x57'));exports[_0xc40a('0x2f')]=function(_0xd955a2,_0x818fcb,_0x17d974){var _0x4dd22e={'agent':{},'channel':_0xc40a('0x59')};if(_0xd955a2[_0xc40a('0x56')]['id']){delete _0xd955a2[_0xc40a('0x56')]['id'];}_0xd955a2[_0xc40a('0x56')][_0xc40a('0x5e')]=_0xd955a2[_0xc40a('0x56')][_0xc40a('0x5e')]||_0xd955a2['user']['id'];_0x4dd22e[_0xc40a('0x60')]['id']=_0xd955a2['body'][_0xc40a('0x5e')];return db['SmsMessage'][_0xc40a('0x53')]({'where':{'id':_0xd955a2[_0xc40a('0x50')]['id'],'UserId':null}})[_0xc40a('0x31')](handleEntityNotFound(_0x818fcb,null))[_0xc40a('0x31')](function(_0x5b85d3){if(_0x5b85d3){_0x4dd22e['message']=_0x5b85d3['get']({'plain':!![]});return db[_0xc40a('0x61')]['find']({'where':{'id':_0x5b85d3[_0xc40a('0x62')]}});}return null;})['then'](handleEntityNotFound(_0x818fcb,null))[_0xc40a('0x31')](function(_0x23c91b){if(_0x23c91b){_0x4dd22e[_0xc40a('0x64')]=_0x23c91b[_0xc40a('0x65')]({'plain':!![]});interaction_log[_0xc40a('0x25')](_0xc40a('0x79'),_0xd955a2['user']['id'],_0xd955a2[_0xc40a('0x5f')][_0xc40a('0x3d')],_0xd955a2[_0xc40a('0x5f')][_0xc40a('0x67')],_0x4dd22e['interaction']['id'],_0xd955a2[_0xc40a('0x56')]?JSON[_0xc40a('0x21')](_0xd955a2['body']):_0xc40a('0x68'));return respondWithRpcPromise(_0xc40a('0x7a'),_0xc40a('0x7b'),_0x4dd22e);}return null;})[_0xc40a('0x31')](function(_0x2b2ea5){var _0x2d4636=_0xc40a('0x6b')+_0x2b2ea5['message'][_0xc40a('0x6c')];return db[_0xc40a('0x7c')][_0xc40a('0x3e')](_0x2d4636,{'type':db[_0xc40a('0x6d')][_0xc40a('0x6e')][_0xc40a('0x6f')],'raw':!![]})['then'](function(_0x19e7f1){return _0x19e7f1;});})[_0xc40a('0x31')](function(_0x503065){if(_0x503065){_0x4dd22e['message'][_0xc40a('0x70')]=_0x503065[0x0];if(!_0xd955a2[_0xc40a('0x56')]['UserId'])return;return db[_0xc40a('0x71')][_0xc40a('0x53')]({'where':{'id':_0xd955a2[_0xc40a('0x56')][_0xc40a('0x5e')],'role':_0xc40a('0x60')},'attributes':['id',_0xc40a('0x3d'),_0xc40a('0x72'),_0xc40a('0x7d'),_0xc40a('0x7e')],'raw':!![]});}return null;})[_0xc40a('0x31')](function(_0x217373){if(!_0x217373)return null;_0x4dd22e[_0xc40a('0x24')][_0xc40a('0x60')]=_0x217373;return _0x4dd22e;})['then'](function(_0x5c503b){if(_0x5c503b){_0x5c503b[_0xc40a('0x24')][_0xc40a('0x74')]=util[_0xc40a('0x5c')](_0xc40a('0x7f'),_0xd955a2[_0xc40a('0x5f')][_0xc40a('0x3d')]);_0x5c503b[_0xc40a('0x24')][_0xc40a('0x75')]=_0x4dd22e[_0xc40a('0x75')];_0x5c503b[_0xc40a('0x24')][_0xc40a('0x76')]=_0x4dd22e[_0xc40a('0x75')];_0x5c503b['message'][_0xc40a('0x77')]=_0xc40a('0x2f');respondWithRpcPromise(_0xc40a('0x80'),_0xc40a('0x80'),{'event':_0xc40a('0x81'),'message':_0x5c503b[_0xc40a('0x24')]},client9002);return _0x4dd22e;}return null;})[_0xc40a('0x31')](respondWithResult(_0x818fcb,null))[_0xc40a('0x55')](handleError(_0x818fcb,null));};exports[_0xc40a('0x27')]=function(_0x464b68,_0x8a0759,_0x314ca5){if(_0x464b68[_0xc40a('0x56')]['id']){delete _0x464b68[_0xc40a('0x56')]['id'];}var _0x137df4;return db[_0xc40a('0x37')][_0xc40a('0x53')]({'where':{'id':_0x464b68[_0xc40a('0x50')]['id']}})['then'](handleEntityNotFound(_0x8a0759,null))[_0xc40a('0x31')](function(_0x4cf0b8){if(_0x4cf0b8){_0x137df4=_0x4cf0b8;return db[_0xc40a('0x82')][_0xc40a('0x53')]({'where':{'id':_0x4cf0b8[_0xc40a('0x83')]}});}})[_0xc40a('0x31')](handleEntityNotFound(_0x8a0759,null))[_0xc40a('0x31')](function(_0x1f28e1){if(_0x1f28e1){logger[_0xc40a('0x1e')](_0xc40a('0x1f'),'status','received\x20delivery\x20report\x20from',_0x1f28e1[_0xc40a('0x3a')],util[_0xc40a('0x84')](_0x464b68[_0xc40a('0x56')],{'showHidden':![],'depth':null}));switch(_0x1f28e1[_0xc40a('0x3a')]){case _0xc40a('0x85'):if(_0x464b68['body']['MessageSid']&&_0x464b68['body'][_0xc40a('0x86')]===_0x137df4[_0xc40a('0x87')]){return _0x137df4[_0xc40a('0x30')]({'read':!![]});}else{logger[_0xc40a('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xc40a('0x27'),'twilio',util['inspect'](_0x464b68['body'],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x464b68[_0xc40a('0x56')][_0xc40a('0x88')]&&_0x464b68[_0xc40a('0x56')]['MessageUUID']===_0x137df4[_0xc40a('0x87')]&&_[_0xc40a('0x89')](['sent',_0xc40a('0x8a')],_0x464b68['body']['Status'])>=0x0){return _0x137df4[_0xc40a('0x30')]({'read':!![]});}else{logger[_0xc40a('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xc40a('0x27'),_0xc40a('0x8b'),util['inspect'](_0x464b68['body'],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x4046fa=_0x464b68[_0xc40a('0x56')][_0xc40a('0x8c')][0x0];if(_0x4046fa[_0xc40a('0x27')][_0xc40a('0x8d')]===_0xc40a('0x8e')){return _0x137df4[_0xc40a('0x30')]({'read':!![]});}else{logger[_0xc40a('0x22')](_0xc40a('0x8f'),_0xc40a('0x27'),_0xc40a('0x90'),util[_0xc40a('0x84')](_0x464b68['body'],{'showHidden':![],'depth':null}));}break;}return _0x137df4;}})['then'](respondWithResult(_0x8a0759,null))[_0xc40a('0x55')](handleError(_0x8a0759,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 0bd91f1..bd5050d 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 _0xcf87=['remove','emit','hasOwnProperty','hook','../../mysqldb','SmsMessage','setMaxListeners','save'];(function(_0x4c9d09,_0x5674a9){var _0x1c555f=function(_0x31a4a1){while(--_0x31a4a1){_0x4c9d09['push'](_0x4c9d09['shift']());}};_0x1c555f(++_0x5674a9);}(_0xcf87,0x17c));var _0x7cf8=function(_0x329e87,_0x55a153){_0x329e87=_0x329e87-0x0;var _0x4882dc=_0xcf87[_0x329e87];return _0x4882dc;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0x7cf8('0x0'))['db'][_0x7cf8('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x7cf8('0x2')](0x0);var events={'afterCreate':_0x7cf8('0x3'),'afterUpdate':'update','afterDestroy':_0x7cf8('0x4')};function emitEvent(_0x34e2ed){return function(_0x58f25a,_0x1374c0,_0x4a18e3){SmsMessageEvents['emit'](_0x34e2ed+':'+_0x58f25a['id'],_0x58f25a);SmsMessageEvents[_0x7cf8('0x5')](_0x34e2ed,_0x58f25a);_0x4a18e3(null);};}for(var e in events){if(events[_0x7cf8('0x6')](e)){var event=events[e];SmsMessage[_0x7cf8('0x7')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0x9835=['exports','events','../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x295c11,_0x54b9e0){var _0xe56efc=function(_0x56d07d){while(--_0x56d07d){_0x295c11['push'](_0x295c11['shift']());}};_0xe56efc(++_0x54b9e0);}(_0x9835,0x184));var _0x5983=function(_0x5686a2,_0x318532){_0x5686a2=_0x5686a2-0x0;var _0x536c58=_0x9835[_0x5686a2];return _0x536c58;};'use strict';var EventEmitter=require(_0x5983('0x0'));var SmsMessage=require(_0x5983('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x5983('0x2')](0x0);var events={'afterCreate':_0x5983('0x3'),'afterUpdate':'update','afterDestroy':_0x5983('0x4')};function emitEvent(_0x2af005){return function(_0x7d10af,_0x2dbcdc,_0x41be1c){SmsMessageEvents[_0x5983('0x5')](_0x2af005+':'+_0x7d10af['id'],_0x7d10af);SmsMessageEvents[_0x5983('0x5')](_0x2af005,_0x7d10af);_0x41be1c(null);};}for(var e in events){if(events[_0x5983('0x6')](e)){var event=events[e];SmsMessage[_0x5983('0x7')](e,emitEvent(event));}}module[_0x5983('0x8')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 6228dba..c55a40f 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 _0x544a=['toString','base64','message_uuid','plivo','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','timestamp','keys','sort','length','createHash','md5','hex','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','define','sms_messages','messageId','body','FULLTEXT','models','get','direction','isNil','UserId','then','update','toLowerCase','catch','error','secret','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','sender','login?username=','GET','split','sms','POST','user_key','total_sent','internal_order_id','read','Missing\x20parameters:\x20username,\x20password','connectel','https://smsapi.connectel.se/api/v2/send/','requestid','deliveryReport','Missing\x20parameters:\x20authToken','clicksend','password','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','http_code','data','head','message_id','clickSend','authId','senderString','remote','https://api.plivo.com/v1/Account/%s/Message/'];(function(_0x2b7f12,_0x1bfebf){var _0x95b5eb=function(_0x231f3a){while(--_0x231f3a){_0x2b7f12['push'](_0x2b7f12['shift']());}};_0x95b5eb(++_0x1bfebf);}(_0x544a,0x118));var _0xa544=function(_0x4cada,_0x434351){_0x4cada=_0x4cada-0x0;var _0x56d9ae=_0x544a[_0x4cada];return _0x56d9ae;};'use strict';var _=require(_0xa544('0x0'));var util=require(_0xa544('0x1'));var logger=require(_0xa544('0x2'))('api');var moment=require('moment');var BPromise=require(_0xa544('0x3'));var rp=require(_0xa544('0x4'));var fs=require('fs');var path=require(_0xa544('0x5'));var rimraf=require(_0xa544('0x6'));var config=require('../../config/environment');var attributes=require('./smsMessage.attributes');module['exports']=function(_0x2cb8c5,_0x3690ce){return _0x2cb8c5[_0xa544('0x7')]('SmsMessage',attributes,{'tableName':_0xa544('0x8'),'paranoid':![],'indexes':[{'name':_0xa544('0x9'),'fields':[_0xa544('0x9')]},{'name':'fti_sms_messages','fields':[_0xa544('0xa')],'type':_0xa544('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x35abd7,_0x9e886d,_0x4d2796){var _0x295267=_0x2cb8c5[_0xa544('0xc')];var _0xee3ce7=_0x35abd7[_0xa544('0xd')]({'plain':!![]});if(_0xee3ce7[_0xa544('0xe')]['toLowerCase']()==='in'||_0xee3ce7[_0xa544('0xe')]['toLowerCase']()==='out'&&!_0xee3ce7['secret']&&!_[_0xa544('0xf')](_0xee3ce7[_0xa544('0x10')])){_0x295267['SmsInteraction']['findOne']({'where':{'id':_0xee3ce7['SmsInteractionId']}})[_0xa544('0x11')](function(_0xe13644){if(_0xe13644){_0xe13644[_0xa544('0x12')]({'lastMsgAt':_0xee3ce7['createdAt'],'lastMsgDirection':_0xee3ce7[_0xa544('0xe')][_0xa544('0x13')]()});}})[_0xa544('0x14')](function(_0x25c611){console[_0xa544('0x15')](_0x25c611);});}if(_0xee3ce7[_0xa544('0xe')]==='out'&&!_0xee3ce7[_0xa544('0x16')]){var _0x37c0c0;_0x295267['SmsAccount']['find']({'where':{'id':_0xee3ce7[_0xa544('0x17')]},'raw':!![]})[_0xa544('0x11')](function(_0x3b54e9){_0x37c0c0=_0x3b54e9;if(_0x37c0c0&&_0x37c0c0[_0xa544('0x18')]){switch(_0x37c0c0[_0xa544('0x18')]){case _0xa544('0x19'):var _0x1c9b5d=require(_0xa544('0x19'));if(_0x37c0c0[_0xa544('0x1a')]&&_0x37c0c0[_0xa544('0x1b')]&&_0x37c0c0[_0xa544('0x1c')]){var _0x317d10=new _0x1c9b5d(_0x37c0c0[_0xa544('0x1a')],_0x37c0c0[_0xa544('0x1b')]);_0x317d10[_0xa544('0x1d')]['create']({'body':_0xee3ce7['body'],'to':_0xee3ce7[_0xa544('0x1c')],'from':_0x37c0c0[_0xa544('0x1c')],'statusCallback':_0x37c0c0['remote']+_0xa544('0x1e')+_0xee3ce7['id']+_0xa544('0x1f')+_0x37c0c0[_0xa544('0x20')]})[_0xa544('0x11')](function(_0x3ad30a){if(_0x3ad30a['sid']){return _0x35abd7['update']({'messageId':_0x3ad30a[_0xa544('0x21')]});}})[_0xa544('0x14')](function(_0x220cf9){logger[_0xa544('0x15')](_0xa544('0x22'),_0xa544('0x23'),'twilio',util[_0xa544('0x24')](_0x220cf9,{'showHidden':![],'depth':null}));});}else{logger[_0xa544('0x15')](_0xa544('0x22'),_0xa544('0x23'),_0xa544('0x19'),_0xa544('0x25'));}break;case _0xa544('0x26'):var _0x442a69=_0xa544('0x27');if(_0x37c0c0[_0xa544('0x28')]&&_0x37c0c0['password']){var _0x53c071={'recipient':[_0xee3ce7[_0xa544('0x1c')]],'message':_0xee3ce7[_0xa544('0xa')],'message_type':_0x37c0c0[_0xa544('0x29')]};if(_0x37c0c0[_0xa544('0x29')]&&_0x37c0c0[_0xa544('0x29')]!=='SI'){_0x53c071[_0xa544('0x2a')]=_0x37c0c0['phone'];}var _0x2fc878={'url':_0x442a69+_0xa544('0x2b')+_0x37c0c0['username']+'&password='+_0x37c0c0['password'],'method':_0xa544('0x2c')};rp(_0x2fc878)[_0xa544('0x11')](function(_0x83bfb2){var _0x268067=_0x83bfb2[_0xa544('0x2d')](';');var _0x5dd8c7={'user_key':_0x268067[0x0],'session_key':_0x268067[0x1]};_0x2fc878={'url':_0x442a69+_0xa544('0x2e'),'method':_0xa544('0x2f'),'headers':{'user_key':_0x5dd8c7[_0xa544('0x30')],'Session_key':_0x5dd8c7['session_key']},'json':!![],'body':_0x53c071};return rp(_0x2fc878);})[_0xa544('0x11')](function(_0x4e1333){if(_0x4e1333[_0xa544('0x31')]>=0x1){var _0x155a89={'messageId':_0x4e1333[_0xa544('0x32')]};if(_0x37c0c0[_0xa544('0x29')]!=='GP'||!_0x37c0c0['deliveryReport']){_0x155a89[_0xa544('0x33')]=!![];}return _0x35abd7[_0xa544('0x12')](_0x155a89);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa544('0x23'),_0xa544('0x26'),util[_0xa544('0x24')](_0x4e1333,{'showHidden':![],'depth':null}));}})[_0xa544('0x14')](function(_0x200b5a){return logger[_0xa544('0x15')](_0xa544('0x22'),_0xa544('0x23'),'skebby',util['inspect'](_0x200b5a,{'showHidden':![],'depth':null}));});}else{logger[_0xa544('0x15')](_0xa544('0x22'),_0xa544('0x23'),_0xa544('0x26'),_0xa544('0x34'));}break;case _0xa544('0x35'):if(_0x37c0c0[_0xa544('0x1b')]){var _0x17aa80={'recipient':_0xee3ce7[_0xa544('0x1c')],'message':_0xee3ce7[_0xa544('0xa')],'sender':_0x37c0c0['senderString']||_0x37c0c0[_0xa544('0x1c')],'authorization':_0x37c0c0['authToken']};var _0x9e886d={'method':_0xa544('0x2f'),'uri':_0xa544('0x36'),'body':_0x17aa80,'json':!![]};rp(_0x9e886d)[_0xa544('0x11')](function(_0x120564){var _0x7affa9={'messageId':_0x120564[_0xa544('0x37')]};if(!_0x37c0c0[_0xa544('0x38')]){_0x7affa9['read']=!![];}return _0x35abd7['update'](_0x7affa9);})['catch'](function(_0x42d9b6){logger[_0xa544('0x15')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa544('0x23'),'connectel',util[_0xa544('0x24')](_0x42d9b6,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa544('0x23'),_0xa544('0x35'),_0xa544('0x39'));}break;case _0xa544('0x3a'):if(_0x37c0c0[_0xa544('0x28')]&&_0x37c0c0[_0xa544('0x3b')]){var _0x17aa80={'messages':[{'source':_0xa544('0x3c'),'to':_0xee3ce7[_0xa544('0x1c')],'body':_0xee3ce7[_0xa544('0xa')],'from':_0x37c0c0['senderString']||_0x37c0c0[_0xa544('0x1c')]}]};var _0x3a691c=util[_0xa544('0x3d')](_0xa544('0x3e'),_0x37c0c0[_0xa544('0x28')],_0x37c0c0[_0xa544('0x3b')]);var _0x9e886d={'method':'POST','uri':_0xa544('0x3f'),'body':_0x17aa80,'headers':{'Authorization':util[_0xa544('0x3d')](_0xa544('0x40'),new Buffer(_0x3a691c)['toString']('base64'))},'json':!![]};rp(_0x9e886d)[_0xa544('0x11')](function(_0x4ee475){if(_0x4ee475[_0xa544('0x41')]>=0xc8&&_0x4ee475[_0xa544('0x41')]<=0xce){if(_0x4ee475[_0xa544('0x42')]&&_0x4ee475[_0xa544('0x42')]['queued_count']>0x0){var _0x7dfd0=_[_0xa544('0x43')](_0x4ee475['data'][_0xa544('0x1d')]);var _0x1567f8={'messageId':_0x7dfd0[_0xa544('0x44')]};if(!_0x37c0c0[_0xa544('0x38')]){_0x1567f8[_0xa544('0x33')]=!![];}return _0x35abd7['update'](_0x1567f8);}else{logger[_0xa544('0x15')](_0xa544('0x22'),_0xa544('0x23'),_0xa544('0x45'),util[_0xa544('0x24')](_0x4ee475,{'showHidden':![],'depth':null}));}}else{logger['error'](_0xa544('0x22'),'afterCreate','clickSend',util[_0xa544('0x24')](_0x4ee475,{'showHidden':![],'depth':null}));}})[_0xa544('0x14')](function(_0x356cd1){logger['error'](_0xa544('0x22'),_0xa544('0x23'),_0xa544('0x45'),util[_0xa544('0x24')](_0x356cd1,{'showHidden':![],'depth':null}));});}else{logger[_0xa544('0x15')](_0xa544('0x22'),_0xa544('0x23'),'clickSend',_0xa544('0x34'));}break;case'plivo':if(_0x37c0c0[_0xa544('0x46')]&&_0x37c0c0[_0xa544('0x1b')]){var _0x17aa80={'dst':_0xee3ce7['phone'],'text':_0xee3ce7[_0xa544('0xa')],'src':_0x37c0c0[_0xa544('0x47')]||_0x37c0c0[_0xa544('0x1c')],'url':_0x37c0c0[_0xa544('0x48')]+_0xa544('0x1e')+_0xee3ce7['id']+_0xa544('0x1f')+_0x37c0c0['token']};var _0x3a691c=util[_0xa544('0x3d')]('%s:%s',_0x37c0c0[_0xa544('0x46')],_0x37c0c0[_0xa544('0x1b')]);var _0x9e886d={'method':_0xa544('0x2f'),'uri':util[_0xa544('0x3d')](_0xa544('0x49'),_0x37c0c0[_0xa544('0x46')]),'body':_0x17aa80,'headers':{'Authorization':util[_0xa544('0x3d')](_0xa544('0x40'),new Buffer(_0x3a691c)[_0xa544('0x4a')](_0xa544('0x4b')))},'json':!![]};rp(_0x9e886d)[_0xa544('0x11')](function(_0x3fb72d){var _0x1f5e22={'messageId':_0x3fb72d[_0xa544('0x4c')][0x0]};return _0x35abd7['update'](_0x1f5e22);})['catch'](function(_0x4688ee){logger[_0xa544('0x15')](_0xa544('0x22'),'afterCreate','plivo',util['inspect'](_0x4688ee,{'showHidden':![],'depth':null}));});}else{logger[_0xa544('0x15')](_0xa544('0x22'),'afterCreate',_0xa544('0x4d'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case'infobip':if(_0x37c0c0[_0xa544('0x28')]&&_0x37c0c0['password']){if(_0x37c0c0[_0xa544('0x4e')]){var _0x4d392a={'method':'POST','uri':_0x37c0c0[_0xa544('0x4e')]+_0xa544('0x4f'),'body':{'username':_0x37c0c0['username'],'password':_0x37c0c0[_0xa544('0x3b')]},'json':!![]};return rp(_0x4d392a)[_0xa544('0x11')](function(_0x58bd48){var _0xa7df6f={'method':_0xa544('0x2f'),'uri':_0x37c0c0[_0xa544('0x4e')]+_0xa544('0x50'),'body':{'messages':[{'from':_0x37c0c0[_0xa544('0x1c')],'destinations':[{'to':_0xee3ce7[_0xa544('0x1c')]}],'text':_0xee3ce7['body'],'notifyUrl':_0x37c0c0[_0xa544('0x48')]+'/api/sms/messages/'+_0xee3ce7['id']+_0xa544('0x1f')+_0x37c0c0[_0xa544('0x20')],'notifyContentType':_0xa544('0x51'),'callbackData':_0x37c0c0[_0xa544('0x1c')]+';'+_0xee3ce7[_0xa544('0xa')]}]},'headers':{'Authorization':_0xa544('0x52')+_0x58bd48[_0xa544('0x20')]},'json':!![]};return rp(_0xa7df6f)[_0xa544('0x11')](function(_0x12935a){if(_0x12935a[_0xa544('0x1d')]){var _0x24b448={'messageId':_0x12935a[_0xa544('0x1d')][0x0][_0xa544('0x9')]};if(!_0x37c0c0[_0xa544('0x38')]){_0x24b448['read']=!![];}return _0x35abd7[_0xa544('0x12')](_0x24b448);}else{return logger[_0xa544('0x15')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa544('0x23'),'infobip',util[_0xa544('0x24')](_0x12935a,{'showHidden':![],'depth':null}));}});})[_0xa544('0x14')](function(_0x16e302){return logger['error'](_0xa544('0x22'),'afterCreate',_0xa544('0x53'),util['inspect'](_0x16e302,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xa544('0x22'),_0xa544('0x23'),'infobip',_0xa544('0x54'));}}else{logger[_0xa544('0x15')](_0xa544('0x22'),_0xa544('0x23'),_0xa544('0x53'),_0xa544('0x34'));}break;case _0xa544('0x55'):var _0x128b6=require(_0xa544('0x56'));if(_0x37c0c0[_0xa544('0x57')]){var _0x4d6b63={};_0x4d6b63[_0xa544('0x58')]=_0x37c0c0[_0xa544('0x28')];_0x4d6b63[_0xa544('0x1c')]=_0xee3ce7[_0xa544('0x1c')];_0x4d6b63[_0xa544('0x2a')]=_0x37c0c0[_0xa544('0x1c')];_0x4d6b63[_0xa544('0x59')]=_0xee3ce7[_0xa544('0xa')];_0x4d6b63[_0xa544('0x5a')]=+new Date();var _0x2bf19d='';var _0x5baee9='';var _0x5c8f80=Object[_0xa544('0x5b')](_0x4d6b63);_0x5c8f80[_0xa544('0x5c')]();for(var _0x3cfa95=0x0;_0x3cfa95<_0x5c8f80[_0xa544('0x5d')];_0x3cfa95++){if(_0x2bf19d!=''){_0x2bf19d+='&';}_0x2bf19d+=_0x5c8f80[_0x3cfa95]+'='+encodeURIComponent(_0x4d6b63[_0x5c8f80[_0x3cfa95]]);_0x5baee9+=_0x4d6b63[_0x5c8f80[_0x3cfa95]];}_0x5baee9+=_0x37c0c0[_0xa544('0x57')];_0x5baee9=_0x128b6[_0xa544('0x5e')](_0xa544('0x5f'))[_0xa544('0x12')](_0x5baee9)['digest'](_0xa544('0x60'));if(_0x2bf19d!==''){_0x2bf19d+='&';}_0x2bf19d+='signature='+_0x5baee9;var _0x2fc878={'method':'GET','uri':_0x37c0c0['baseUrl']+'/external/get/send.php?'+_0x2bf19d,'json':!![]};return rp(_0x2fc878)[_0xa544('0x11')](function(_0xaf8e4c){var _0x5f0ed2=Object[_0xa544('0x5b')](_0xaf8e4c);if(_0xaf8e4c[_0x5f0ed2[0x0]][_0xa544('0x15')]&&parseInt(_0xaf8e4c[_0x5f0ed2[0x0]][_0xa544('0x15')])===0x0){var _0x258cad={'messageId':_0xaf8e4c[_0x5f0ed2[0x0]][_0xa544('0x61')]};if(!_0x37c0c0[_0xa544('0x38')]){_0x258cad[_0xa544('0x33')]=!![];}return _0x35abd7[_0xa544('0x12')](_0x258cad);}else{return logger[_0xa544('0x15')](_0xa544('0x22'),_0xa544('0x23'),_0xa544('0x55'),util['inspect'](_0xaf8e4c['error'],{'showHidden':![],'depth':null}));}})[_0xa544('0x14')](function(_0x22a32c){return logger['error'](_0xa544('0x22'),_0xa544('0x23'),_0xa544('0x55'),util[_0xa544('0x24')](_0x22a32c,{'showHidden':![],'depth':null}));});}else{logger[_0xa544('0x15')](_0xa544('0x22'),'afterCreate',_0xa544('0x55'),_0xa544('0x62'));}break;case _0xa544('0x63'):if(_0x37c0c0['apiKey']){var _0x4245e7={'method':_0xa544('0x2f'),'uri':_0xa544('0x64'),'headers':{'Authorization':_0x37c0c0[_0xa544('0x57')]},'body':{'content':_0xee3ce7[_0xa544('0xa')],'to':[_0xee3ce7['phone']],'from':_0x37c0c0[_0xa544('0x1c')],'binary':![],'clientMessageId':_0xa544('0x65'),'charset':_0xa544('0x66')},'json':!![]};rp(_0x4245e7)['then'](function(_0xd17834){if(!_0xd17834[_0xa544('0x15')]){var _0x15a042={'messageId':_0xd17834[_0xa544('0x1d')][0x0]['apiMessageId']};if(!_0x37c0c0[_0xa544('0x38')]){_0x15a042[_0xa544('0x33')]=!![];}return _0x35abd7['update'](_0x15a042);}else{return logger[_0xa544('0x15')](_0xa544('0x22'),'afterCreate',_0xa544('0x63'),util[_0xa544('0x24')](_0xd17834[_0xa544('0x15')],{'showHidden':![],'depth':null}));}})[_0xa544('0x14')](function(_0x3d4042){return logger[_0xa544('0x15')](_0xa544('0x22'),_0xa544('0x23'),'clickatell',util[_0xa544('0x24')](_0x3d4042,{'showHidden':![],'depth':null}));});}else{logger[_0xa544('0x15')](_0xa544('0x22'),'afterCreate',_0xa544('0x63'),_0xa544('0x62'));}break;case _0xa544('0x67'):if(_0x37c0c0[_0xa544('0x28')]&&_0x37c0c0[_0xa544('0x3b')]){var _0x3a691c=util[_0xa544('0x3d')](_0xa544('0x3e'),_0x37c0c0[_0xa544('0x28')],_0x37c0c0[_0xa544('0x3b')]);var _0x9e886d={'method':'POST','uri':_0xa544('0x68')+_0x37c0c0[_0xa544('0x69')]+'/messages','body':{'to':[_0xee3ce7[_0xa544('0x1c')]],'text':_0xee3ce7['body'],'from':_0x37c0c0[_0xa544('0x1c')],'applicationId':_0x37c0c0['applicationId']},'headers':{'Authorization':util[_0xa544('0x3d')](_0xa544('0x40'),new Buffer(_0x3a691c)[_0xa544('0x4a')](_0xa544('0x4b')))},'json':!![]};rp(_0x9e886d)[_0xa544('0x11')](function(_0x373410){if(_0x373410['id']){var _0x2866ba={'messageId':_0x373410['id']};return _0x35abd7['update'](_0x2866ba);}else{logger['error'](_0xa544('0x22'),_0xa544('0x23'),'bandwidth',util['inspect'](_0x373410,{'showHidden':![],'depth':null}));}})[_0xa544('0x14')](function(_0x30df45){logger[_0xa544('0x15')](_0xa544('0x22'),_0xa544('0x23'),_0xa544('0x67'),util['inspect'](_0x30df45,{'showHidden':![],'depth':null}));});}else{logger[_0xa544('0x15')](_0xa544('0x22'),_0xa544('0x23'),_0xa544('0x67'),_0xa544('0x34'));}break;case _0xa544('0x6a'):if(_0x37c0c0[_0xa544('0x57')]){var _0x4d9cbd={};var _0x2fc878={'method':'POST','uri':_0xa544('0x6b'),'headers':{'Authorization':_0xa544('0x6c')+_0x37c0c0['apiKey'],'Content-Type':_0xa544('0x51')},'body':{'from':_0x37c0c0[_0xa544('0x1c')],'to':_0xee3ce7[_0xa544('0x1c')],'text':_0xee3ce7[_0xa544('0xa')]},'json':!![]};return rp(_0x2fc878)[_0xa544('0x11')](function(_0x3f8e71){if(_0x3f8e71[_0xa544('0x6d')]==0xca){_0x4d9cbd[_0xa544('0x6e')]=_0x3f8e71;var _0x328004={'method':'POST','uri':_0xa544('0x6f'),'headers':{'Authorization':_0xa544('0x6c')+_0x37c0c0[_0xa544('0x57')],'Content-Type':_0xa544('0x51')},'body':{'refid':_0x4d9cbd[_0xa544('0x6e')][_0xa544('0x70')]},'json':!![]};return rp(_0x328004)[_0xa544('0x11')](function(_0x5aed4b){_0x4d9cbd[_0xa544('0x71')]=_0x5aed4b;var _0x31aaac={'messageId':_0x4d9cbd[_0xa544('0x6e')]['refid'],'read':!![]};return _0x35abd7['update'](_0x31aaac);});}else{return logger['error'](_0xa544('0x22'),_0xa544('0x23'),_0xa544('0x6a'),util[_0xa544('0x24')](_0x3f8e71,{'showHidden':![],'depth':null}));}})[_0xa544('0x14')](function(_0x587f85){return logger['error'](_0xa544('0x22'),_0xa544('0x23'),'intelepeer',util['inspect'](_0x587f85,{'showHidden':![],'depth':null}));});}else{return logger[_0xa544('0x15')](_0xa544('0x22'),'afterCreate',_0xa544('0x6a'),_0xa544('0x72'));}break;}}})[_0xa544('0x73')](function(){_0x4d2796();});}else{_0x4d2796();}}},'charset':_0xa544('0x74'),'collate':_0xa544('0x75')});}; \ No newline at end of file +var _0xe739=['https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','intelepeer','Token\x20not\x20received','finally','lodash','../../config/logger','api','moment','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','messageId','fti_sms_messages','body','FULLTEXT','direction','toLowerCase','out','secret','isNil','UserId','findOne','SmsInteractionId','then','update','createdAt','catch','SmsAccount','type','twilio','accountSid','authToken','phone','messages','remote','token','sid','afterCreate','error','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','split','sms','POST','session_key','total_sent','internal_order_id','deliveryReport','read','inspect','https://smsapi.connectel.se/api/v2/send/','requestid','connectel','clicksend','senderString','format','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','base64','http_code','data','queued_count','head','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','/api/sms/messages/','/status?token=','%s:%s','https://api.plivo.com/v1/Account/%s/Message/','toString','message_uuid','infobip','baseUrl','/auth/1/session','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','apiKey','login','text','timestamp','keys','sort','length','md5','digest','hex','signature=','GET','/external/get/send.php?','csc','clickatell'];(function(_0x32c707,_0x297d01){var _0x2b03f7=function(_0x39b7fb){while(--_0x39b7fb){_0x32c707['push'](_0x32c707['shift']());}};_0x2b03f7(++_0x297d01);}(_0xe739,0x105));var _0x9e73=function(_0x22a258,_0x42d12c){_0x22a258=_0x22a258-0x0;var _0x5d058a=_0xe739[_0x22a258];return _0x5d058a;};'use strict';var _=require(_0x9e73('0x0'));var util=require('util');var logger=require(_0x9e73('0x1'))(_0x9e73('0x2'));var moment=require(_0x9e73('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9e73('0x4'));var config=require(_0x9e73('0x5'));var attributes=require(_0x9e73('0x6'));module[_0x9e73('0x7')]=function(_0x4cb2ed,_0x3db8fa){return _0x4cb2ed[_0x9e73('0x8')](_0x9e73('0x9'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x9e73('0xa'),'fields':[_0x9e73('0xa')]},{'name':_0x9e73('0xb'),'fields':[_0x9e73('0xc')],'type':_0x9e73('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2edd7b,_0x52393d,_0x33ce2d){var _0x5f06cb=_0x4cb2ed['models'];var _0x145c76=_0x2edd7b['get']({'plain':!![]});if(_0x145c76[_0x9e73('0xe')][_0x9e73('0xf')]()==='in'||_0x145c76[_0x9e73('0xe')]['toLowerCase']()===_0x9e73('0x10')&&!_0x145c76[_0x9e73('0x11')]&&!_[_0x9e73('0x12')](_0x145c76[_0x9e73('0x13')])){_0x5f06cb['SmsInteraction'][_0x9e73('0x14')]({'where':{'id':_0x145c76[_0x9e73('0x15')]}})[_0x9e73('0x16')](function(_0x5be2fa){if(_0x5be2fa){_0x5be2fa[_0x9e73('0x17')]({'lastMsgAt':_0x145c76[_0x9e73('0x18')],'lastMsgDirection':_0x145c76['direction'][_0x9e73('0xf')]()});}})[_0x9e73('0x19')](function(_0x21bd3a){console['error'](_0x21bd3a);});}if(_0x145c76[_0x9e73('0xe')]==='out'&&!_0x145c76[_0x9e73('0x11')]){var _0x58bbaa;_0x5f06cb[_0x9e73('0x1a')]['find']({'where':{'id':_0x145c76['SmsAccountId']},'raw':!![]})[_0x9e73('0x16')](function(_0x3944fc){_0x58bbaa=_0x3944fc;if(_0x58bbaa&&_0x58bbaa[_0x9e73('0x1b')]){switch(_0x58bbaa[_0x9e73('0x1b')]){case _0x9e73('0x1c'):var _0x398a0d=require(_0x9e73('0x1c'));if(_0x58bbaa[_0x9e73('0x1d')]&&_0x58bbaa[_0x9e73('0x1e')]&&_0x58bbaa[_0x9e73('0x1f')]){var _0x4a5cd1=new _0x398a0d(_0x58bbaa[_0x9e73('0x1d')],_0x58bbaa['authToken']);_0x4a5cd1[_0x9e73('0x20')]['create']({'body':_0x145c76[_0x9e73('0xc')],'to':_0x145c76['phone'],'from':_0x58bbaa[_0x9e73('0x1f')],'statusCallback':_0x58bbaa[_0x9e73('0x21')]+'/api/sms/messages/'+_0x145c76['id']+'/status?token='+_0x58bbaa[_0x9e73('0x22')]})[_0x9e73('0x16')](function(_0x256ea1){if(_0x256ea1[_0x9e73('0x23')]){return _0x2edd7b[_0x9e73('0x17')]({'messageId':_0x256ea1['sid']});}})[_0x9e73('0x19')](function(_0x3a845c){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9e73('0x24'),'twilio',util['inspect'](_0x3a845c,{'showHidden':![],'depth':null}));});}else{logger[_0x9e73('0x25')](_0x9e73('0x26'),_0x9e73('0x24'),'twilio',_0x9e73('0x27'));}break;case _0x9e73('0x28'):var _0x4e77bb=_0x9e73('0x29');if(_0x58bbaa[_0x9e73('0x2a')]&&_0x58bbaa[_0x9e73('0x2b')]){var _0x397bd6={'recipient':[_0x145c76[_0x9e73('0x1f')]],'message':_0x145c76['body'],'message_type':_0x58bbaa[_0x9e73('0x2c')]};if(_0x58bbaa['smsMethod']&&_0x58bbaa[_0x9e73('0x2c')]!=='SI'){_0x397bd6[_0x9e73('0x2d')]=_0x58bbaa[_0x9e73('0x1f')];}var _0x1b4b9e={'url':_0x4e77bb+_0x9e73('0x2e')+_0x58bbaa['username']+_0x9e73('0x2f')+_0x58bbaa[_0x9e73('0x2b')],'method':'GET'};rp(_0x1b4b9e)['then'](function(_0x296b93){var _0x38593a=_0x296b93[_0x9e73('0x30')](';');var _0x25d6b9={'user_key':_0x38593a[0x0],'session_key':_0x38593a[0x1]};_0x1b4b9e={'url':_0x4e77bb+_0x9e73('0x31'),'method':_0x9e73('0x32'),'headers':{'user_key':_0x25d6b9['user_key'],'Session_key':_0x25d6b9[_0x9e73('0x33')]},'json':!![],'body':_0x397bd6};return rp(_0x1b4b9e);})[_0x9e73('0x16')](function(_0x1a52ca){if(_0x1a52ca[_0x9e73('0x34')]>=0x1){var _0x3c7936={'messageId':_0x1a52ca[_0x9e73('0x35')]};if(_0x58bbaa[_0x9e73('0x2c')]!=='GP'||!_0x58bbaa[_0x9e73('0x36')]){_0x3c7936[_0x9e73('0x37')]=!![];}return _0x2edd7b[_0x9e73('0x17')](_0x3c7936);}else{return logger['error'](_0x9e73('0x26'),_0x9e73('0x24'),_0x9e73('0x28'),util[_0x9e73('0x38')](_0x1a52ca,{'showHidden':![],'depth':null}));}})['catch'](function(_0x3d2608){return logger[_0x9e73('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x9e73('0x28'),util[_0x9e73('0x38')](_0x3d2608,{'showHidden':![],'depth':null}));});}else{logger[_0x9e73('0x25')](_0x9e73('0x26'),_0x9e73('0x24'),_0x9e73('0x28'),'Missing\x20parameters:\x20username,\x20password');}break;case'connectel':if(_0x58bbaa['authToken']){var _0x2ea753={'recipient':_0x145c76[_0x9e73('0x1f')],'message':_0x145c76[_0x9e73('0xc')],'sender':_0x58bbaa['senderString']||_0x58bbaa['phone'],'authorization':_0x58bbaa['authToken']};var _0x52393d={'method':_0x9e73('0x32'),'uri':_0x9e73('0x39'),'body':_0x2ea753,'json':!![]};rp(_0x52393d)[_0x9e73('0x16')](function(_0x541171){var _0x1992c3={'messageId':_0x541171[_0x9e73('0x3a')]};if(!_0x58bbaa[_0x9e73('0x36')]){_0x1992c3[_0x9e73('0x37')]=!![];}return _0x2edd7b[_0x9e73('0x17')](_0x1992c3);})[_0x9e73('0x19')](function(_0x15444b){logger[_0x9e73('0x25')](_0x9e73('0x26'),_0x9e73('0x24'),'connectel',util['inspect'](_0x15444b,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9e73('0x24'),_0x9e73('0x3b'),'Missing\x20parameters:\x20authToken');}break;case _0x9e73('0x3c'):if(_0x58bbaa[_0x9e73('0x2a')]&&_0x58bbaa['password']){var _0x2ea753={'messages':[{'source':'xCALLY\x20Motion','to':_0x145c76['phone'],'body':_0x145c76['body'],'from':_0x58bbaa[_0x9e73('0x3d')]||_0x58bbaa[_0x9e73('0x1f')]}]};var _0x18f5e4=util[_0x9e73('0x3e')]('%s:%s',_0x58bbaa['username'],_0x58bbaa[_0x9e73('0x2b')]);var _0x52393d={'method':_0x9e73('0x32'),'uri':_0x9e73('0x3f'),'body':_0x2ea753,'headers':{'Authorization':util[_0x9e73('0x3e')](_0x9e73('0x40'),new Buffer(_0x18f5e4)['toString'](_0x9e73('0x41')))},'json':!![]};rp(_0x52393d)[_0x9e73('0x16')](function(_0x5dcca7){if(_0x5dcca7[_0x9e73('0x42')]>=0xc8&&_0x5dcca7[_0x9e73('0x42')]<=0xce){if(_0x5dcca7['data']&&_0x5dcca7[_0x9e73('0x43')][_0x9e73('0x44')]>0x0){var _0x4ea68c=_[_0x9e73('0x45')](_0x5dcca7[_0x9e73('0x43')][_0x9e73('0x20')]);var _0x343391={'messageId':_0x4ea68c[_0x9e73('0x46')]};if(!_0x58bbaa[_0x9e73('0x36')]){_0x343391[_0x9e73('0x37')]=!![];}return _0x2edd7b[_0x9e73('0x17')](_0x343391);}else{logger[_0x9e73('0x25')](_0x9e73('0x26'),_0x9e73('0x24'),_0x9e73('0x47'),util[_0x9e73('0x38')](_0x5dcca7,{'showHidden':![],'depth':null}));}}else{logger[_0x9e73('0x25')](_0x9e73('0x26'),_0x9e73('0x24'),'clickSend',util[_0x9e73('0x38')](_0x5dcca7,{'showHidden':![],'depth':null}));}})['catch'](function(_0x4e8c96){logger[_0x9e73('0x25')](_0x9e73('0x26'),'afterCreate','clickSend',util[_0x9e73('0x38')](_0x4e8c96,{'showHidden':![],'depth':null}));});}else{logger[_0x9e73('0x25')](_0x9e73('0x26'),_0x9e73('0x24'),_0x9e73('0x47'),_0x9e73('0x48'));}break;case _0x9e73('0x49'):if(_0x58bbaa[_0x9e73('0x4a')]&&_0x58bbaa[_0x9e73('0x1e')]){var _0x2ea753={'dst':_0x145c76[_0x9e73('0x1f')],'text':_0x145c76[_0x9e73('0xc')],'src':_0x58bbaa[_0x9e73('0x3d')]||_0x58bbaa[_0x9e73('0x1f')],'url':_0x58bbaa['remote']+_0x9e73('0x4b')+_0x145c76['id']+_0x9e73('0x4c')+_0x58bbaa[_0x9e73('0x22')]};var _0x18f5e4=util[_0x9e73('0x3e')](_0x9e73('0x4d'),_0x58bbaa[_0x9e73('0x4a')],_0x58bbaa[_0x9e73('0x1e')]);var _0x52393d={'method':'POST','uri':util['format'](_0x9e73('0x4e'),_0x58bbaa['authId']),'body':_0x2ea753,'headers':{'Authorization':util[_0x9e73('0x3e')]('Basic\x20%s',new Buffer(_0x18f5e4)[_0x9e73('0x4f')]('base64'))},'json':!![]};rp(_0x52393d)[_0x9e73('0x16')](function(_0x184f79){var _0x23e23d={'messageId':_0x184f79[_0x9e73('0x50')][0x0]};return _0x2edd7b[_0x9e73('0x17')](_0x23e23d);})[_0x9e73('0x19')](function(_0x1269d5){logger['error'](_0x9e73('0x26'),'afterCreate',_0x9e73('0x49'),util[_0x9e73('0x38')](_0x1269d5,{'showHidden':![],'depth':null}));});}else{logger[_0x9e73('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9e73('0x24'),_0x9e73('0x49'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0x9e73('0x51'):if(_0x58bbaa[_0x9e73('0x2a')]&&_0x58bbaa[_0x9e73('0x2b')]){if(_0x58bbaa[_0x9e73('0x52')]){var _0x3b1b14={'method':'POST','uri':_0x58bbaa[_0x9e73('0x52')]+_0x9e73('0x53'),'body':{'username':_0x58bbaa['username'],'password':_0x58bbaa[_0x9e73('0x2b')]},'json':!![]};return rp(_0x3b1b14)[_0x9e73('0x16')](function(_0x188b14){var _0x4f622a={'method':_0x9e73('0x32'),'uri':_0x58bbaa[_0x9e73('0x52')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x58bbaa[_0x9e73('0x1f')],'destinations':[{'to':_0x145c76[_0x9e73('0x1f')]}],'text':_0x145c76[_0x9e73('0xc')],'notifyUrl':_0x58bbaa[_0x9e73('0x21')]+_0x9e73('0x4b')+_0x145c76['id']+_0x9e73('0x4c')+_0x58bbaa[_0x9e73('0x22')],'notifyContentType':_0x9e73('0x54'),'callbackData':_0x58bbaa[_0x9e73('0x1f')]+';'+_0x145c76[_0x9e73('0xc')]}]},'headers':{'Authorization':_0x9e73('0x55')+_0x188b14[_0x9e73('0x22')]},'json':!![]};return rp(_0x4f622a)['then'](function(_0x16d781){if(_0x16d781[_0x9e73('0x20')]){var _0x3474d1={'messageId':_0x16d781['messages'][0x0]['messageId']};if(!_0x58bbaa[_0x9e73('0x36')]){_0x3474d1[_0x9e73('0x37')]=!![];}return _0x2edd7b[_0x9e73('0x17')](_0x3474d1);}else{return logger[_0x9e73('0x25')](_0x9e73('0x26'),_0x9e73('0x24'),_0x9e73('0x51'),util[_0x9e73('0x38')](_0x16d781,{'showHidden':![],'depth':null}));}});})[_0x9e73('0x19')](function(_0x17bf77){return logger[_0x9e73('0x25')](_0x9e73('0x26'),'afterCreate',_0x9e73('0x51'),util[_0x9e73('0x38')](_0x17bf77,{'showHidden':![],'depth':null}));});}else{logger[_0x9e73('0x25')](_0x9e73('0x26'),_0x9e73('0x24'),_0x9e73('0x51'),_0x9e73('0x56'));}}else{logger[_0x9e73('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x9e73('0x51'),'Missing\x20parameters:\x20username,\x20password');}break;case'csc':var _0x286f5e=require('crypto');if(_0x58bbaa[_0x9e73('0x57')]){var _0x40e34e={};_0x40e34e[_0x9e73('0x58')]=_0x58bbaa[_0x9e73('0x2a')];_0x40e34e[_0x9e73('0x1f')]=_0x145c76['phone'];_0x40e34e['sender']=_0x58bbaa[_0x9e73('0x1f')];_0x40e34e[_0x9e73('0x59')]=_0x145c76[_0x9e73('0xc')];_0x40e34e[_0x9e73('0x5a')]=+new Date();var _0xf3fad3='';var _0x2eed31='';var _0x2be436=Object[_0x9e73('0x5b')](_0x40e34e);_0x2be436[_0x9e73('0x5c')]();for(var _0xc0c76f=0x0;_0xc0c76f<_0x2be436[_0x9e73('0x5d')];_0xc0c76f++){if(_0xf3fad3!=''){_0xf3fad3+='&';}_0xf3fad3+=_0x2be436[_0xc0c76f]+'='+encodeURIComponent(_0x40e34e[_0x2be436[_0xc0c76f]]);_0x2eed31+=_0x40e34e[_0x2be436[_0xc0c76f]];}_0x2eed31+=_0x58bbaa[_0x9e73('0x57')];_0x2eed31=_0x286f5e['createHash'](_0x9e73('0x5e'))[_0x9e73('0x17')](_0x2eed31)[_0x9e73('0x5f')](_0x9e73('0x60'));if(_0xf3fad3!==''){_0xf3fad3+='&';}_0xf3fad3+=_0x9e73('0x61')+_0x2eed31;var _0x1b4b9e={'method':_0x9e73('0x62'),'uri':_0x58bbaa[_0x9e73('0x52')]+_0x9e73('0x63')+_0xf3fad3,'json':!![]};return rp(_0x1b4b9e)[_0x9e73('0x16')](function(_0x192625){var _0xdef4ea=Object[_0x9e73('0x5b')](_0x192625);if(_0x192625[_0xdef4ea[0x0]][_0x9e73('0x25')]&&parseInt(_0x192625[_0xdef4ea[0x0]][_0x9e73('0x25')])===0x0){var _0x11d3f1={'messageId':_0x192625[_0xdef4ea[0x0]]['id_sms']};if(!_0x58bbaa[_0x9e73('0x36')]){_0x11d3f1[_0x9e73('0x37')]=!![];}return _0x2edd7b[_0x9e73('0x17')](_0x11d3f1);}else{return logger[_0x9e73('0x25')](_0x9e73('0x26'),'afterCreate',_0x9e73('0x64'),util['inspect'](_0x192625[_0x9e73('0x25')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x5299d0){return logger[_0x9e73('0x25')](_0x9e73('0x26'),'afterCreate',_0x9e73('0x64'),util[_0x9e73('0x38')](_0x5299d0,{'showHidden':![],'depth':null}));});}else{logger[_0x9e73('0x25')](_0x9e73('0x26'),_0x9e73('0x24'),_0x9e73('0x64'),'Missing\x20parameters:\x20apiKey');}break;case _0x9e73('0x65'):if(_0x58bbaa[_0x9e73('0x57')]){var _0x5d0dd7={'method':_0x9e73('0x32'),'uri':_0x9e73('0x66'),'headers':{'Authorization':_0x58bbaa[_0x9e73('0x57')]},'body':{'content':_0x145c76[_0x9e73('0xc')],'to':[_0x145c76['phone']],'from':_0x58bbaa['phone'],'binary':![],'clientMessageId':_0x9e73('0x67'),'charset':_0x9e73('0x68')},'json':!![]};rp(_0x5d0dd7)['then'](function(_0x587c43){if(!_0x587c43[_0x9e73('0x25')]){var _0x310fcb={'messageId':_0x587c43[_0x9e73('0x20')][0x0][_0x9e73('0x69')]};if(!_0x58bbaa[_0x9e73('0x36')]){_0x310fcb[_0x9e73('0x37')]=!![];}return _0x2edd7b[_0x9e73('0x17')](_0x310fcb);}else{return logger[_0x9e73('0x25')](_0x9e73('0x26'),_0x9e73('0x24'),_0x9e73('0x65'),util['inspect'](_0x587c43[_0x9e73('0x25')],{'showHidden':![],'depth':null}));}})[_0x9e73('0x19')](function(_0x446b5a){return logger[_0x9e73('0x25')](_0x9e73('0x26'),'afterCreate','clickatell',util['inspect'](_0x446b5a,{'showHidden':![],'depth':null}));});}else{logger[_0x9e73('0x25')](_0x9e73('0x26'),'afterCreate',_0x9e73('0x65'),'Missing\x20parameters:\x20apiKey');}break;case _0x9e73('0x6a'):if(_0x58bbaa['username']&&_0x58bbaa['password']){var _0x18f5e4=util['format']('%s:%s',_0x58bbaa['username'],_0x58bbaa[_0x9e73('0x2b')]);var _0x52393d={'method':_0x9e73('0x32'),'uri':_0x9e73('0x6b')+_0x58bbaa[_0x9e73('0x6c')]+_0x9e73('0x6d'),'body':{'to':[_0x145c76[_0x9e73('0x1f')]],'text':_0x145c76[_0x9e73('0xc')],'from':_0x58bbaa[_0x9e73('0x1f')],'applicationId':_0x58bbaa[_0x9e73('0x6e')]},'headers':{'Authorization':util[_0x9e73('0x3e')](_0x9e73('0x40'),new Buffer(_0x18f5e4)[_0x9e73('0x4f')]('base64'))},'json':!![]};rp(_0x52393d)[_0x9e73('0x16')](function(_0x4da984){if(_0x4da984['id']){var _0x3e7d62={'messageId':_0x4da984['id']};return _0x2edd7b[_0x9e73('0x17')](_0x3e7d62);}else{logger[_0x9e73('0x25')](_0x9e73('0x26'),_0x9e73('0x24'),_0x9e73('0x6a'),util[_0x9e73('0x38')](_0x4da984,{'showHidden':![],'depth':null}));}})[_0x9e73('0x19')](function(_0x1d306b){logger[_0x9e73('0x25')](_0x9e73('0x26'),_0x9e73('0x24'),_0x9e73('0x6a'),util[_0x9e73('0x38')](_0x1d306b,{'showHidden':![],'depth':null}));});}else{logger[_0x9e73('0x25')](_0x9e73('0x26'),'afterCreate',_0x9e73('0x6a'),_0x9e73('0x48'));}break;case'intelepeer':if(_0x58bbaa[_0x9e73('0x57')]){var _0x441845={};var _0x1b4b9e={'method':'POST','uri':_0x9e73('0x6f'),'headers':{'Authorization':_0x9e73('0x70')+_0x58bbaa[_0x9e73('0x57')],'Content-Type':_0x9e73('0x54')},'body':{'from':_0x58bbaa[_0x9e73('0x1f')],'to':_0x145c76[_0x9e73('0x1f')],'text':_0x145c76['body']},'json':!![]};return rp(_0x1b4b9e)[_0x9e73('0x16')](function(_0x21b34e){if(_0x21b34e[_0x9e73('0x71')]==0xca){_0x441845[_0x9e73('0x72')]=_0x21b34e;var _0x3c8915={'method':_0x9e73('0x32'),'uri':_0x9e73('0x73'),'headers':{'Authorization':_0x9e73('0x70')+_0x58bbaa['apiKey'],'Content-Type':'application/json'},'body':{'refid':_0x441845['message'][_0x9e73('0x74')]},'json':!![]};return rp(_0x3c8915)[_0x9e73('0x16')](function(_0x3043e4){_0x441845[_0x9e73('0x75')]=_0x3043e4;var _0x5d5afc={'messageId':_0x441845['message'][_0x9e73('0x74')],'read':!![]};return _0x2edd7b[_0x9e73('0x17')](_0x5d5afc);});}else{return logger[_0x9e73('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9e73('0x24'),_0x9e73('0x76'),util[_0x9e73('0x38')](_0x21b34e,{'showHidden':![],'depth':null}));}})[_0x9e73('0x19')](function(_0x5afc9d){return logger['error'](_0x9e73('0x26'),_0x9e73('0x24'),'intelepeer',util['inspect'](_0x5afc9d,{'showHidden':![],'depth':null}));});}else{return logger[_0x9e73('0x25')](_0x9e73('0x26'),'afterCreate',_0x9e73('0x76'),_0x9e73('0x77'));}break;}}})[_0x9e73('0x78')](function(){_0x33ce2d();});}else{_0x33ce2d();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 0184958..0040be1 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 _0x6b7c=['./smsMessage.socket','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SmsMessage','create','body','options','raw','CreateSmsMessage','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','socket.io-emitter'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x6b7c,0x180));var _0xc6b7=function(_0x2460d9,_0x15da87){_0x2460d9=_0x2460d9-0x0;var _0x4bc204=_0x6b7c[_0x2460d9];return _0x4bc204;};'use strict';var _=require(_0xc6b7('0x0'));var util=require(_0xc6b7('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc6b7('0x2'));var fs=require('fs');var Redis=require(_0xc6b7('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc6b7('0x4'));var logger=require(_0xc6b7('0x5'))(_0xc6b7('0x6'));var config=require('../../config/environment');var jayson=require(_0xc6b7('0x7'));var client=jayson[_0xc6b7('0x8')]['http']({'port':0x232a});config[_0xc6b7('0x9')]=_[_0xc6b7('0xa')](config[_0xc6b7('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xc6b7('0xb'))(new Redis(config[_0xc6b7('0x9')]));require(_0xc6b7('0xc'))[_0xc6b7('0xd')](socket);function respondWithRpcPromise(_0x2aecf3,_0x1919b9,_0x2dfa47){return new BPromise(function(_0x470fb6,_0x31dd7a){return client[_0xc6b7('0xe')](_0x2aecf3,_0x2dfa47)[_0xc6b7('0xf')](function(_0x41fe72){logger[_0xc6b7('0x10')](_0xc6b7('0x11'),_0x1919b9,_0xc6b7('0x12'));logger[_0xc6b7('0x13')](_0xc6b7('0x14'),_0x1919b9,_0xc6b7('0x12'),JSON[_0xc6b7('0x15')](_0x41fe72));if(_0x41fe72[_0xc6b7('0x16')]){if(_0x41fe72['error'][_0xc6b7('0x17')]===0x1f4){logger[_0xc6b7('0x16')]('SmsMessage,\x20%s,\x20%s',_0x1919b9,_0x41fe72[_0xc6b7('0x16')]['message']);return _0x31dd7a(_0x41fe72['error'][_0xc6b7('0x18')]);}logger[_0xc6b7('0x16')](_0xc6b7('0x11'),_0x1919b9,_0x41fe72[_0xc6b7('0x16')]['message']);return _0x470fb6(_0x41fe72['error']['message']);}else{logger[_0xc6b7('0x10')](_0xc6b7('0x11'),_0x1919b9,_0xc6b7('0x12'));_0x470fb6(_0x41fe72[_0xc6b7('0x19')][_0xc6b7('0x18')]);}})[_0xc6b7('0x1a')](function(_0x50342b){logger[_0xc6b7('0x16')](_0xc6b7('0x11'),_0x1919b9,_0x50342b);_0x31dd7a(_0x50342b);});});}exports['CreateSmsMessage']=function(_0x2c5166){var _0x497d3d=this;return new Promise(function(_0x45d4d4,_0x18a826){return db[_0xc6b7('0x1b')][_0xc6b7('0x1c')](_0x2c5166[_0xc6b7('0x1d')],{'raw':_0x2c5166[_0xc6b7('0x1e')]?_0x2c5166[_0xc6b7('0x1e')][_0xc6b7('0x1f')]===undefined?!![]:![]:!![]})[_0xc6b7('0xf')](function(_0x2e19c5){logger[_0xc6b7('0x10')](_0xc6b7('0x20'),_0x2c5166);logger[_0xc6b7('0x13')](_0xc6b7('0x20'),_0x2c5166,JSON[_0xc6b7('0x15')](_0x2e19c5));_0x45d4d4(_0x2e19c5);})[_0xc6b7('0x1a')](function(_0x50a04f){logger[_0xc6b7('0x16')](_0xc6b7('0x20'),_0x50a04f[_0xc6b7('0x18')],_0x2c5166);_0x18a826(_0x497d3d[_0xc6b7('0x16')](0x1f4,_0x50a04f[_0xc6b7('0x18')]));});});}; \ No newline at end of file +var _0x4fcd=['then','info','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','SmsMessage,\x20%s,\x20%s','message','result','SmsMessage','create','body','options','debug','CreateSmsMessage','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','http','redis','defaults','./smsMessage.socket','register','request'];(function(_0x1a0c51,_0x4c285b){var _0x5e4d19=function(_0x302698){while(--_0x302698){_0x1a0c51['push'](_0x1a0c51['shift']());}};_0x5e4d19(++_0x4c285b);}(_0x4fcd,0xf8));var _0xd4fc=function(_0x483bdc,_0x212aa9){_0x483bdc=_0x483bdc-0x0;var _0x35713f=_0x4fcd[_0x483bdc];return _0x35713f;};'use strict';var _=require(_0xd4fc('0x0'));var util=require('util');var moment=require(_0xd4fc('0x1'));var BPromise=require(_0xd4fc('0x2'));var rs=require(_0xd4fc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd4fc('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd4fc('0x5'))('rpc');var config=require(_0xd4fc('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd4fc('0x7')]({'port':0x232a});config[_0xd4fc('0x8')]=_[_0xd4fc('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd4fc('0x8')]));require(_0xd4fc('0xa'))[_0xd4fc('0xb')](socket);function respondWithRpcPromise(_0x2af013,_0x402f12,_0x18571d){return new BPromise(function(_0x48c747,_0x512605){return client[_0xd4fc('0xc')](_0x2af013,_0x18571d)[_0xd4fc('0xd')](function(_0x254329){logger[_0xd4fc('0xe')]('SmsMessage,\x20%s,\x20%s',_0x402f12,_0xd4fc('0xf'));logger['debug'](_0xd4fc('0x10'),_0x402f12,_0xd4fc('0xf'),JSON[_0xd4fc('0x11')](_0x254329));if(_0x254329[_0xd4fc('0x12')]){if(_0x254329['error']['code']===0x1f4){logger[_0xd4fc('0x12')](_0xd4fc('0x13'),_0x402f12,_0x254329['error']['message']);return _0x512605(_0x254329[_0xd4fc('0x12')][_0xd4fc('0x14')]);}logger['error'](_0xd4fc('0x13'),_0x402f12,_0x254329[_0xd4fc('0x12')]['message']);return _0x48c747(_0x254329[_0xd4fc('0x12')]['message']);}else{logger[_0xd4fc('0xe')]('SmsMessage,\x20%s,\x20%s',_0x402f12,_0xd4fc('0xf'));_0x48c747(_0x254329[_0xd4fc('0x15')][_0xd4fc('0x14')]);}})['catch'](function(_0x5b38c8){logger['error'](_0xd4fc('0x13'),_0x402f12,_0x5b38c8);_0x512605(_0x5b38c8);});});}exports['CreateSmsMessage']=function(_0x558694){var _0x42ecab=this;return new Promise(function(_0x5e1f66,_0x43cef8){return db[_0xd4fc('0x16')][_0xd4fc('0x17')](_0x558694[_0xd4fc('0x18')],{'raw':_0x558694[_0xd4fc('0x19')]?_0x558694[_0xd4fc('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5e5d9f){logger[_0xd4fc('0xe')]('CreateSmsMessage',_0x558694);logger[_0xd4fc('0x1a')](_0xd4fc('0x1b'),_0x558694,JSON[_0xd4fc('0x11')](_0x5e5d9f));_0x5e1f66(_0x5e5d9f);})[_0xd4fc('0x1c')](function(_0x550ae1){logger[_0xd4fc('0x12')](_0xd4fc('0x1b'),_0x550ae1[_0xd4fc('0x14')],_0x558694);_0x43cef8(_0x42ecab['error'](0x1f4,_0x550ae1['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 14591af..7a02441 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 _0x0d12=['emit','removeListener','register','./smsMessage.events','save','remove','update'];(function(_0x1e6e4e,_0x2b1b09){var _0x3d746b=function(_0x4483dd){while(--_0x4483dd){_0x1e6e4e['push'](_0x1e6e4e['shift']());}};_0x3d746b(++_0x2b1b09);}(_0x0d12,0x129));var _0x20d1=function(_0x561adf,_0x99ddb){_0x561adf=_0x561adf-0x0;var _0x1ebe2b=_0x0d12[_0x561adf];return _0x1ebe2b;};'use strict';var SmsMessageEvents=require(_0x20d1('0x0'));var events=[_0x20d1('0x1'),_0x20d1('0x2'),_0x20d1('0x3')];function createListener(_0x29bc6c,_0x9abc64){return function(_0x3911ba){_0x9abc64[_0x20d1('0x4')](_0x29bc6c,_0x3911ba);};}function removeListener(_0x3b66d5,_0x2b9820){return function(){SmsMessageEvents[_0x20d1('0x5')](_0x3b66d5,_0x2b9820);};}exports[_0x20d1('0x6')]=function(_0x420d85){for(var _0x277991=0x0,_0x574db9=events['length'];_0x277991<_0x574db9;_0x277991++){var _0x21fef5=events[_0x277991];var _0x17348f=createListener('smsMessage:'+_0x21fef5,_0x420d85);SmsMessageEvents['on'](_0x21fef5,_0x17348f);}}; \ No newline at end of file +var _0x5e4d=['save','remove','update','emit','register','length','smsMessage:'];(function(_0x25efdf,_0x521462){var _0x22c495=function(_0x184469){while(--_0x184469){_0x25efdf['push'](_0x25efdf['shift']());}};_0x22c495(++_0x521462);}(_0x5e4d,0xe0));var _0xd5e4=function(_0x30d8a5,_0x1d70fa){_0x30d8a5=_0x30d8a5-0x0;var _0x1abe8e=_0x5e4d[_0x30d8a5];return _0x1abe8e;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0xd5e4('0x0'),_0xd5e4('0x1'),_0xd5e4('0x2')];function createListener(_0x1860af,_0x93e5d3){return function(_0x403e42){_0x93e5d3[_0xd5e4('0x3')](_0x1860af,_0x403e42);};}function removeListener(_0x10d7be,_0x1af977){return function(){SmsMessageEvents['removeListener'](_0x10d7be,_0x1af977);};}exports[_0xd5e4('0x4')]=function(_0x5895e2){for(var _0x133eda=0x0,_0x30c696=events[_0xd5e4('0x5')];_0x133eda<_0x30c696;_0x133eda++){var _0x52c2d8=events[_0x133eda];var _0x1ea360=createListener(_0xd5e4('0x6')+_0x52c2d8,_0x5895e2);SmsMessageEvents['on'](_0x52c2d8,_0x1ea360);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 0a869a9..19819fb 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 _0x5916=['../../components/interaction/service','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','update','delete','removeTeams','path','Router','fs-extra'];(function(_0x2bba20,_0x25cdb3){var _0x219ce8=function(_0x74d6eb){while(--_0x74d6eb){_0x2bba20['push'](_0x2bba20['shift']());}};_0x219ce8(++_0x25cdb3);}(_0x5916,0x1bf));var _0x6591=function(_0x48d05b,_0x11e514){_0x48d05b=_0x48d05b-0x0;var _0x173717=_0x5916[_0x48d05b];return _0x173717;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6591('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6591('0x1')]();var fs_extra=require(_0x6591('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x6591('0x3'));var config=require('../../config/environment');var controller=require(_0x6591('0x4'));router[_0x6591('0x5')]('/',auth[_0x6591('0x6')](),controller[_0x6591('0x7')]);router['get'](_0x6591('0x8'),auth[_0x6591('0x6')](),controller[_0x6591('0x9')]);router[_0x6591('0x5')](_0x6591('0xa'),auth[_0x6591('0x6')](),controller[_0x6591('0xb')]);router[_0x6591('0x5')](_0x6591('0xc'),auth[_0x6591('0x6')](),controller[_0x6591('0xd')]);router[_0x6591('0x5')](_0x6591('0xe'),auth[_0x6591('0x6')](),controller[_0x6591('0xf')]);router['get'](_0x6591('0x10'),auth['isAuthenticated'](),controller[_0x6591('0x11')]);router['post']('/',auth[_0x6591('0x6')](),controller['create']);router[_0x6591('0x12')](_0x6591('0xe'),auth[_0x6591('0x6')](),controller[_0x6591('0x13')]);router['post'](_0x6591('0x10'),auth[_0x6591('0x6')](),controller[_0x6591('0x14')]);router[_0x6591('0x15')](_0x6591('0xa'),auth['isAuthenticated'](),controller[_0x6591('0x16')]);router[_0x6591('0x17')](_0x6591('0xa'),auth[_0x6591('0x6')](),controller['destroy']);router[_0x6591('0x17')](_0x6591('0xe'),auth[_0x6591('0x6')](),controller[_0x6591('0x18')]);router[_0x6591('0x17')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xa3c7=['/describe','describe','show','/:id/members','getMembers','/:id/teams','/:id/users','addTeams','addAgents','/:id','delete','removeAgents','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x56a532,_0x30d89f){var _0x3ec29d=function(_0x10a1f){while(--_0x10a1f){_0x56a532['push'](_0x56a532['shift']());}};_0x3ec29d(++_0x30d89f);}(_0xa3c7,0x14f));var _0x7a3c=function(_0x2354f1,_0xabfc06){_0x2354f1=_0x2354f1-0x0;var _0x2274ca=_0xa3c7[_0x2354f1];return _0x2274ca;};'use strict';var multer=require(_0x7a3c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7a3c('0x1'));var express=require(_0x7a3c('0x2'));var router=express[_0x7a3c('0x3')]();var fs_extra=require(_0x7a3c('0x4'));var auth=require(_0x7a3c('0x5'));var interaction=require(_0x7a3c('0x6'));var config=require('../../config/environment');var controller=require('./smsQueue.controller');router[_0x7a3c('0x7')]('/',auth[_0x7a3c('0x8')](),controller[_0x7a3c('0x9')]);router['get'](_0x7a3c('0xa'),auth[_0x7a3c('0x8')](),controller[_0x7a3c('0xb')]);router['get']('/:id',auth[_0x7a3c('0x8')](),controller[_0x7a3c('0xc')]);router[_0x7a3c('0x7')](_0x7a3c('0xd'),auth[_0x7a3c('0x8')](),controller[_0x7a3c('0xe')]);router[_0x7a3c('0x7')](_0x7a3c('0xf'),auth[_0x7a3c('0x8')](),controller['getTeams']);router[_0x7a3c('0x7')](_0x7a3c('0x10'),auth[_0x7a3c('0x8')](),controller['getAgents']);router['post']('/',auth[_0x7a3c('0x8')](),controller['create']);router['post'](_0x7a3c('0xf'),auth[_0x7a3c('0x8')](),controller[_0x7a3c('0x11')]);router['post'](_0x7a3c('0x10'),auth[_0x7a3c('0x8')](),controller[_0x7a3c('0x12')]);router['put'](_0x7a3c('0x13'),auth[_0x7a3c('0x8')](),controller['update']);router[_0x7a3c('0x14')]('/:id',auth[_0x7a3c('0x8')](),controller['destroy']);router[_0x7a3c('0x14')](_0x7a3c('0xf'),auth[_0x7a3c('0x8')](),controller['removeTeams']);router['delete']('/:id/users',auth[_0x7a3c('0x8')](),controller[_0x7a3c('0x15')]);module[_0x7a3c('0x16')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index afb1155..79b1775 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 _0x6935=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','name','STRING','INTEGER'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x6935,0xe5));var _0x5693=function(_0x373317,_0x39d19f){_0x373317=_0x373317-0x0;var _0x103f4b=_0x6935[_0x373317];return _0x103f4b;};'use strict';var Sequelize=require(_0x5693('0x0'));module[_0x5693('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x5693('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5693('0x3')]},'timeout':{'type':Sequelize[_0x5693('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5693('0x5')](_0x5693('0x6'),_0x5693('0x7'),_0x5693('0x8'))}}; \ No newline at end of file +var _0xb530=['exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x44afa4,_0x5be27b){var _0xcad289=function(_0x206272){while(--_0x206272){_0x44afa4['push'](_0x44afa4['shift']());}};_0xcad289(++_0x5be27b);}(_0xb530,0x19d));var _0x0b53=function(_0x11e366,_0x12f876){_0x11e366=_0x11e366-0x0;var _0x1454e3=_0xb530[_0x11e366];return _0x1454e3;};'use strict';var Sequelize=require(_0x0b53('0x0'));module[_0x0b53('0x1')]={'name':{'type':Sequelize[_0x0b53('0x2')],'unique':_0x0b53('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0b53('0x2')]},'timeout':{'type':Sequelize[_0x0b53('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0b53('0x5')](_0x0b53('0x6'),_0x0b53('0x7'),_0x0b53('0x8'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 0c9be1e..5bc2292 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 _0x5c7c=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','create','body','user','role','SmsQueues','find','userProfileId','name','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getMembers','UserSmsQueue','order','SmsQueueId','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','smsPause','Team','getTeams','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','toString','QueryTypes','every','TeamId','includes','all','compact','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','spread','isArray','findOne','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','destroy','then','get','UserProfileResource','sendStatus','stack','index','map','SmsQueue','rawAttributes','fieldName','type','key','model','query','keys'];(function(_0x56f88c,_0x578212){var _0x3254c0=function(_0x4ab28a){while(--_0x4ab28a){_0x56f88c['push'](_0x56f88c['shift']());}};_0x3254c0(++_0x578212);}(_0x5c7c,0x172));var _0xc5c7=function(_0x50641e,_0x3bc2fe){_0x50641e=_0x50641e-0x0;var _0x426fa1=_0x5c7c[_0x50641e];return _0x426fa1;};'use strict';var emlformat=require(_0xc5c7('0x0'));var rimraf=require(_0xc5c7('0x1'));var zipdir=require(_0xc5c7('0x2'));var jsonpatch=require(_0xc5c7('0x3'));var rp=require(_0xc5c7('0x4'));var moment=require(_0xc5c7('0x5'));var BPromise=require(_0xc5c7('0x6'));var Mustache=require('mustache');var util=require(_0xc5c7('0x7'));var path=require(_0xc5c7('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc5c7('0x9'));var fs=require('fs');var fs_extra=require(_0xc5c7('0xa'));var _=require('lodash');var squel=require(_0xc5c7('0xb'));var crypto=require(_0xc5c7('0xc'));var jsforce=require(_0xc5c7('0xd'));var deskjs=require(_0xc5c7('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc5c7('0xf'));var Papa=require(_0xc5c7('0x10'));var Redis=require('ioredis');var authService=require(_0xc5c7('0x11'));var qs=require(_0xc5c7('0x12'));var as=require(_0xc5c7('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xc5c7('0x14'));var config=require(_0xc5c7('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc5c7('0x16'))['db'];config[_0xc5c7('0x17')]=_[_0xc5c7('0x18')](config[_0xc5c7('0x17')],{'host':_0xc5c7('0x19'),'port':0x18eb});var socket=require(_0xc5c7('0x1a'))(new Redis(config[_0xc5c7('0x17')]));require(_0xc5c7('0x1b'))['register'](socket);function respondWithStatusCode(_0xc20bf7,_0x3b179a){_0x3b179a=_0x3b179a||0xcc;return function(_0x5151f2){if(_0x5151f2){return _0xc20bf7['sendStatus'](_0x3b179a);}return _0xc20bf7[_0xc5c7('0x1c')](_0x3b179a)[_0xc5c7('0x1d')]();};}function respondWithResult(_0x13bdd7,_0x9e0539){_0x9e0539=_0x9e0539||0xc8;return function(_0x5bb443){if(_0x5bb443){return _0x13bdd7[_0xc5c7('0x1c')](_0x9e0539)[_0xc5c7('0x1e')](_0x5bb443);}};}function respondWithFilteredResult(_0x35b9e0,_0x346ecf){return function(_0x16e44c){if(_0x16e44c){var _0x4d531e=typeof _0x346ecf['offset']===_0xc5c7('0x1f')&&typeof _0x346ecf[_0xc5c7('0x20')]==='undefined';var _0x55323e=_0x16e44c[_0xc5c7('0x21')];var _0x536e43=_0x4d531e?0x0:_0x346ecf[_0xc5c7('0x22')];var _0xd4bfc5=_0x4d531e?_0x16e44c[_0xc5c7('0x21')]:_0x346ecf['offset']+_0x346ecf[_0xc5c7('0x20')];var _0x246475;if(_0xd4bfc5>=_0x55323e){_0xd4bfc5=_0x55323e;_0x246475=0xc8;}else{_0x246475=0xce;}_0x35b9e0[_0xc5c7('0x1c')](_0x246475);return _0x35b9e0[_0xc5c7('0x23')](_0xc5c7('0x24'),_0x536e43+'-'+_0xd4bfc5+'/'+_0x55323e)[_0xc5c7('0x1e')](_0x16e44c);}return null;};}function patchUpdates(_0x319a88){return function(_0x4ec35e){try{jsonpatch['apply'](_0x4ec35e,_0x319a88,!![]);}catch(_0x2b9c8c){return BPromise[_0xc5c7('0x25')](_0x2b9c8c);}return _0x4ec35e[_0xc5c7('0x26')]();};}function saveUpdates(_0x13b792,_0xdb93a5){return function(_0x1e4a3f){if(_0x1e4a3f){return _0x1e4a3f[_0xc5c7('0x27')](_0x13b792)['then'](function(_0xe38025){return _0xe38025;});}return null;};}function removeEntity(_0x2300b1,_0x464d6){return function(_0x2a554c){if(_0x2a554c){return _0x2a554c[_0xc5c7('0x28')]()[_0xc5c7('0x29')](function(){var _0x579ab5=_0x2a554c[_0xc5c7('0x2a')]({'plain':!![]});var _0x5a0dfa='SmsQueues';return db[_0xc5c7('0x2b')][_0xc5c7('0x28')]({'where':{'type':_0x5a0dfa,'resourceId':_0x579ab5['id']}})[_0xc5c7('0x29')](function(){return _0x2a554c;});})[_0xc5c7('0x29')](function(){_0x2300b1[_0xc5c7('0x1c')](0xcc)[_0xc5c7('0x1d')]();});}};}function handleEntityNotFound(_0x3833a0,_0x24d49b){return function(_0x2b1298){if(!_0x2b1298){_0x3833a0[_0xc5c7('0x2c')](0x194);}return _0x2b1298;};}function handleError(_0xfd6090,_0x1e0a59){_0x1e0a59=_0x1e0a59||0x1f4;return function(_0x5aca5b){logger['error'](_0x5aca5b[_0xc5c7('0x2d')]);if(_0x5aca5b['name']){delete _0x5aca5b['name'];}_0xfd6090['status'](_0x1e0a59)['send'](_0x5aca5b);};}exports[_0xc5c7('0x2e')]=function(_0x173f1e,_0x3beb22){var _0x23607e={},_0x5ddb4f={},_0xa7e082={'count':0x0,'rows':[]};var _0x535ad9=_[_0xc5c7('0x2f')](db[_0xc5c7('0x30')][_0xc5c7('0x31')],function(_0x275ca0){return{'name':_0x275ca0[_0xc5c7('0x32')],'type':_0x275ca0[_0xc5c7('0x33')][_0xc5c7('0x34')]};});_0x5ddb4f[_0xc5c7('0x35')]=_[_0xc5c7('0x2f')](_0x535ad9,'name');_0x5ddb4f[_0xc5c7('0x36')]=_[_0xc5c7('0x37')](_0x173f1e[_0xc5c7('0x36')]);_0x5ddb4f[_0xc5c7('0x38')]=_[_0xc5c7('0x39')](_0x5ddb4f['model'],_0x5ddb4f[_0xc5c7('0x36')]);_0x23607e[_0xc5c7('0x3a')]=_[_0xc5c7('0x39')](_0x5ddb4f[_0xc5c7('0x35')],qs[_0xc5c7('0x3b')](_0x173f1e[_0xc5c7('0x36')][_0xc5c7('0x3b')]));_0x23607e[_0xc5c7('0x3a')]=_0x23607e['attributes'][_0xc5c7('0x3c')]?_0x23607e[_0xc5c7('0x3a')]:_0x5ddb4f[_0xc5c7('0x35')];if(!_0x173f1e[_0xc5c7('0x36')][_0xc5c7('0x3d')](_0xc5c7('0x3e'))){_0x23607e[_0xc5c7('0x20')]=qs[_0xc5c7('0x20')](_0x173f1e[_0xc5c7('0x36')]['limit']);_0x23607e[_0xc5c7('0x22')]=qs[_0xc5c7('0x22')](_0x173f1e[_0xc5c7('0x36')][_0xc5c7('0x22')]);}_0x23607e['order']=qs[_0xc5c7('0x3f')](_0x173f1e[_0xc5c7('0x36')]['sort']);_0x23607e[_0xc5c7('0x40')]=qs['filters'](_[_0xc5c7('0x41')](_0x173f1e[_0xc5c7('0x36')],_0x5ddb4f[_0xc5c7('0x38')]),_0x535ad9);if(_0x173f1e[_0xc5c7('0x36')][_0xc5c7('0x42')]){_0x23607e['where']=_[_0xc5c7('0x43')](_0x23607e[_0xc5c7('0x40')],{'$or':_[_0xc5c7('0x2f')](_0x535ad9,function(_0x4326bf){if(_0x4326bf['type']!==_0xc5c7('0x44')){var _0xf727a8={};_0xf727a8[_0x4326bf['name']]={'$like':'%'+_0x173f1e[_0xc5c7('0x36')][_0xc5c7('0x42')]+'%'};return _0xf727a8;}})});}_0x23607e=_[_0xc5c7('0x43')]({},_0x23607e,_0x173f1e[_0xc5c7('0x45')]);var _0x14636f={'where':_0x23607e[_0xc5c7('0x40')]};return db[_0xc5c7('0x30')][_0xc5c7('0x21')](_0x14636f)[_0xc5c7('0x29')](function(_0x1fd490){_0xa7e082[_0xc5c7('0x21')]=_0x1fd490;if(_0x173f1e[_0xc5c7('0x36')][_0xc5c7('0x46')]){_0x23607e[_0xc5c7('0x47')]=[{'all':!![]}];}return db[_0xc5c7('0x30')][_0xc5c7('0x48')](_0x23607e);})[_0xc5c7('0x29')](function(_0x1a67ea){_0xa7e082['rows']=_0x1a67ea;return _0xa7e082;})[_0xc5c7('0x29')](respondWithFilteredResult(_0x3beb22,_0x23607e))[_0xc5c7('0x49')](handleError(_0x3beb22,null));};exports[_0xc5c7('0x4a')]=function(_0x22a934,_0x5f1f88){var _0x2f946b={'raw':!![],'where':{'id':_0x22a934['params']['id']}},_0x5d037d={};_0x5d037d['model']=_[_0xc5c7('0x37')](db['SmsQueue'][_0xc5c7('0x31')]);_0x5d037d[_0xc5c7('0x36')]=_['keys'](_0x22a934[_0xc5c7('0x36')]);_0x5d037d['filters']=_[_0xc5c7('0x39')](_0x5d037d[_0xc5c7('0x35')],_0x5d037d['query']);_0x2f946b[_0xc5c7('0x3a')]=_[_0xc5c7('0x39')](_0x5d037d[_0xc5c7('0x35')],qs[_0xc5c7('0x3b')](_0x22a934[_0xc5c7('0x36')][_0xc5c7('0x3b')]));_0x2f946b['attributes']=_0x2f946b[_0xc5c7('0x3a')][_0xc5c7('0x3c')]?_0x2f946b[_0xc5c7('0x3a')]:_0x5d037d[_0xc5c7('0x35')];if(_0x22a934['query'][_0xc5c7('0x46')]){_0x2f946b[_0xc5c7('0x47')]=[{'all':!![]}];}_0x2f946b=_['merge']({},_0x2f946b,_0x22a934['options']);return db[_0xc5c7('0x30')]['find'](_0x2f946b)['then'](handleEntityNotFound(_0x5f1f88,null))[_0xc5c7('0x29')](respondWithResult(_0x5f1f88,null))[_0xc5c7('0x49')](handleError(_0x5f1f88,null));};exports[_0xc5c7('0x4b')]=function(_0x2b51a,_0x501e06){return db[_0xc5c7('0x30')][_0xc5c7('0x4b')](_0x2b51a[_0xc5c7('0x4c')],{})['then'](function(_0x56d7d1){var _0x28b7cf=_0x2b51a[_0xc5c7('0x4d')]['get']({'plain':!![]});if(!_0x28b7cf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x28b7cf[_0xc5c7('0x4e')]==='user'){var _0x50ffd1=_0x56d7d1[_0xc5c7('0x2a')]({'plain':!![]});var _0x4f9e7a=_0xc5c7('0x4f');return db['UserProfileSection'][_0xc5c7('0x50')]({'where':{'name':_0x4f9e7a,'userProfileId':_0x28b7cf[_0xc5c7('0x51')]},'raw':!![]})[_0xc5c7('0x29')](function(_0x4a8550){if(_0x4a8550&&_0x4a8550['autoAssociation']===0x0){return db[_0xc5c7('0x2b')][_0xc5c7('0x4b')]({'name':_0x50ffd1[_0xc5c7('0x52')],'resourceId':_0x50ffd1['id'],'type':_0x4a8550['name'],'sectionId':_0x4a8550['id']},{})['then'](function(){return _0x56d7d1;});}else{return _0x56d7d1;}})[_0xc5c7('0x49')](function(_0x4dc738){logger[_0xc5c7('0x53')](_0xc5c7('0x54'),_0x4dc738);throw _0x4dc738;});}return _0x56d7d1;})[_0xc5c7('0x29')](respondWithResult(_0x501e06,0xc9))[_0xc5c7('0x49')](handleError(_0x501e06,null));};exports[_0xc5c7('0x27')]=function(_0x4bc5d7,_0x24c8da){if(_0x4bc5d7[_0xc5c7('0x4c')]['id']){delete _0x4bc5d7['body']['id'];}return db[_0xc5c7('0x30')][_0xc5c7('0x50')]({'where':{'id':_0x4bc5d7[_0xc5c7('0x55')]['id']}})[_0xc5c7('0x29')](handleEntityNotFound(_0x24c8da,null))[_0xc5c7('0x29')](saveUpdates(_0x4bc5d7[_0xc5c7('0x4c')],null))[_0xc5c7('0x29')](respondWithResult(_0x24c8da,null))[_0xc5c7('0x49')](handleError(_0x24c8da,null));};exports['destroy']=function(_0x4fb860,_0x546f59){return db[_0xc5c7('0x30')][_0xc5c7('0x50')]({'where':{'id':_0x4fb860['params']['id']}})[_0xc5c7('0x29')](handleEntityNotFound(_0x546f59,null))['then'](removeEntity(_0x546f59,null))[_0xc5c7('0x49')](handleError(_0x546f59,null));};exports['describe']=function(_0x47e189,_0x13d70c){return db['SmsQueue']['describe']()[_0xc5c7('0x29')](respondWithResult(_0x13d70c,null))[_0xc5c7('0x49')](handleError(_0x13d70c,null));};exports[_0xc5c7('0x56')]=function(_0x472155,_0x260b09,_0x24b220){var _0x349ef6={'raw':!![],'where':{}},_0x2ce715={},_0x441783;return db[_0xc5c7('0x30')]['findOne']({'where':{'id':_0x472155[_0xc5c7('0x55')]['id']}})[_0xc5c7('0x29')](handleEntityNotFound(_0x260b09,null))['then'](function(_0x125009){if(_0x125009){_0x441783=_0x125009[_0xc5c7('0x2a')]({'plain':!![]});_0x2ce715[_0xc5c7('0x35')]=_[_0xc5c7('0x37')](db[_0xc5c7('0x57')][_0xc5c7('0x31')]);_0x2ce715['query']=_[_0xc5c7('0x37')](_0x472155['query']);_0x2ce715[_0xc5c7('0x38')]=_[_0xc5c7('0x39')](_0x2ce715[_0xc5c7('0x35')],_0x2ce715[_0xc5c7('0x36')]);_0x349ef6[_0xc5c7('0x3a')]=_[_0xc5c7('0x39')](_0x2ce715[_0xc5c7('0x35')],qs[_0xc5c7('0x3b')](_0x472155[_0xc5c7('0x36')][_0xc5c7('0x3b')]));_0x349ef6[_0xc5c7('0x3a')]=_0x349ef6[_0xc5c7('0x3a')][_0xc5c7('0x3c')]?_0x349ef6['attributes']:_0x2ce715['model'];if(!_0x472155[_0xc5c7('0x36')]['hasOwnProperty']('nolimit')){_0x349ef6[_0xc5c7('0x20')]=qs[_0xc5c7('0x20')](_0x472155[_0xc5c7('0x36')][_0xc5c7('0x20')]);_0x349ef6[_0xc5c7('0x22')]=qs[_0xc5c7('0x22')](_0x472155[_0xc5c7('0x36')][_0xc5c7('0x22')]);}_0x349ef6[_0xc5c7('0x58')]=qs[_0xc5c7('0x3f')](_0x472155[_0xc5c7('0x36')][_0xc5c7('0x3f')]);_0x349ef6[_0xc5c7('0x40')]=qs[_0xc5c7('0x38')](_['pick'](_0x472155['query'],_0x2ce715['filters']));_0x349ef6['where'][_0xc5c7('0x59')]=_0x125009['id'];if(_0x472155[_0xc5c7('0x36')]['filter']){_0x349ef6['where']=_['merge'](_0x349ef6[_0xc5c7('0x40')],{'$or':_[_0xc5c7('0x2f')](_0x349ef6[_0xc5c7('0x3a')],function(_0x397d3f){var _0x5f2e6f={};_0x5f2e6f[_0x397d3f]={'$like':'%'+_0x472155[_0xc5c7('0x36')][_0xc5c7('0x42')]+'%'};return _0x5f2e6f;})});}_0x349ef6=_[_0xc5c7('0x43')]({},_0x349ef6,_0x472155['options']);return db[_0xc5c7('0x57')][_0xc5c7('0x48')](_0x349ef6);}})['then'](function(_0x1b2a0e){if(_0x1b2a0e){return db[_0xc5c7('0x5a')][_0xc5c7('0x5b')]({'where':{'id':_['map'](_0x1b2a0e,_0xc5c7('0x5c')),'role':_0xc5c7('0x5d')},'attributes':['id','name','smsPause',_0xc5c7('0x5e'),_0xc5c7('0x5f')]});}})['then'](function(_0x31db0a){if(_0x31db0a){return{'count':_0x31db0a[_0xc5c7('0x21')],'rows':_[_0xc5c7('0x2f')](_0x31db0a['rows'],function(_0x43bd7b){return{'membername':_0x43bd7b[_0xc5c7('0x52')],'UserId':_0x43bd7b['id'],'queue_name':_0x441783[_0xc5c7('0x52')],'SmsQueueId':_0x441783['id'],'interface':util[_0xc5c7('0x60')](_0xc5c7('0x61'),_0xc5c7('0x62'),_0x43bd7b[_0xc5c7('0x52')]),'penalty':0x0,'paused':_0x43bd7b[_0xc5c7('0x63')],'createdAt':_0x43bd7b['createdAt'],'updatedAt':_0x43bd7b[_0xc5c7('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc5c7('0x29')](respondWithFilteredResult(_0x260b09,_0x349ef6))[_0xc5c7('0x49')](handleError(_0x260b09,null));};exports['getTeams']=function(_0x1d36ca,_0x36dac6,_0x2b5c64){var _0x5a7037={};var _0x21c8ab={};var _0xd87554;var _0x10b465;return db[_0xc5c7('0x30')]['findOne']({'where':{'id':_0x1d36ca['params']['id']}})[_0xc5c7('0x29')](handleEntityNotFound(_0x36dac6,null))[_0xc5c7('0x29')](function(_0x5c2b8e){if(_0x5c2b8e){_0xd87554=_0x5c2b8e;_0x21c8ab['model']=_['keys'](db[_0xc5c7('0x64')][_0xc5c7('0x31')]);_0x21c8ab['query']=_[_0xc5c7('0x37')](_0x1d36ca[_0xc5c7('0x36')]);_0x21c8ab[_0xc5c7('0x38')]=_[_0xc5c7('0x39')](_0x21c8ab[_0xc5c7('0x35')],_0x21c8ab[_0xc5c7('0x36')]);_0x5a7037[_0xc5c7('0x3a')]=_[_0xc5c7('0x39')](_0x21c8ab[_0xc5c7('0x35')],qs[_0xc5c7('0x3b')](_0x1d36ca[_0xc5c7('0x36')]['fields']));_0x5a7037[_0xc5c7('0x3a')]=_0x5a7037['attributes'][_0xc5c7('0x3c')]?_0x5a7037[_0xc5c7('0x3a')]:_0x21c8ab[_0xc5c7('0x35')];_0x5a7037['order']=qs['sort'](_0x1d36ca['query'][_0xc5c7('0x3f')]);_0x5a7037['where']=qs['filters'](_[_0xc5c7('0x41')](_0x1d36ca[_0xc5c7('0x36')],_0x21c8ab[_0xc5c7('0x38')]));if(_0x1d36ca[_0xc5c7('0x36')][_0xc5c7('0x42')]){_0x5a7037['where']=_[_0xc5c7('0x43')](_0x5a7037[_0xc5c7('0x40')],{'$or':_[_0xc5c7('0x2f')](_0x5a7037[_0xc5c7('0x3a')],function(_0x52d47e){var _0xe943d1={};_0xe943d1[_0x52d47e]={'$like':'%'+_0x1d36ca['query'][_0xc5c7('0x42')]+'%'};return _0xe943d1;})});}_0x5a7037=_['merge']({},_0x5a7037,_0x1d36ca['options']);return _0xd87554[_0xc5c7('0x65')](_0x5a7037);}})['then'](function(_0x25cd36){if(_0x25cd36){_0x10b465=_0x25cd36['length'];if(!_0x1d36ca['query'][_0xc5c7('0x3d')](_0xc5c7('0x3e'))){_0x5a7037['limit']=qs[_0xc5c7('0x20')](_0x1d36ca[_0xc5c7('0x36')][_0xc5c7('0x20')]);_0x5a7037[_0xc5c7('0x22')]=qs[_0xc5c7('0x22')](_0x1d36ca[_0xc5c7('0x36')][_0xc5c7('0x22')]);}return _0xd87554[_0xc5c7('0x65')](_0x5a7037);}})[_0xc5c7('0x29')](function(_0x36ed30){if(_0x36ed30){return _0x36ed30?{'count':_0x10b465,'rows':_0x36ed30}:null;}})[_0xc5c7('0x29')](respondWithResult(_0x36dac6,null))[_0xc5c7('0x49')](handleError(_0x36dac6,null));};exports[_0xc5c7('0x66')]=function(_0x4a6292,_0x51dc3e,_0x57ece1){var _0x1863df=_0x4a6292[_0xc5c7('0x4c')][_0xc5c7('0x67')];return db[_0xc5c7('0x64')][_0xc5c7('0x48')]({'where':{'id':_0x1863df},'attributes':['id'],'include':[{'model':db[_0xc5c7('0x5a')],'as':_0xc5c7('0x68'),'attributes':['id',_0xc5c7('0x52'),_0xc5c7('0x69'),_0xc5c7('0x6a'),_0xc5c7('0x6b')],'raw':!![]}]})[_0xc5c7('0x29')](function(_0x1a5a36){if(_0x1a5a36){var _0x373932=_[_0xc5c7('0x6c')](_0x1a5a36,function(_0x1e7f6d){var _0x484239=_0x1e7f6d[_0xc5c7('0x2a')]({'plain':!![]});return _0x484239[_0xc5c7('0x68')];});return db[_0xc5c7('0x30')][_0xc5c7('0x50')]({'where':{'id':_0x4a6292[_0xc5c7('0x55')]['id']}})[_0xc5c7('0x29')](function(_0x448ac9){return db[_0xc5c7('0x6d')][_0xc5c7('0x6e')](function(_0x1014d3){return _0x448ac9[_0xc5c7('0x66')](_0x1863df,{'transaction':_0x1014d3})['then'](function(){return BPromise[_0xc5c7('0x6f')](_0x373932,function(_0x14c36c){return db[_0xc5c7('0x57')][_0xc5c7('0x70')]({'where':{'UserId':_0x14c36c['id'],'SmsQueueId':_0x4a6292[_0xc5c7('0x55')]['id']},'transaction':_0x1014d3});});})[_0xc5c7('0x29')](function(){_0x373932[_0xc5c7('0x71')](function(_0x1be049){socket[_0xc5c7('0x72')](_0xc5c7('0x73'),{'UserId':_0x1be049['id'],'SmsQueueId':_0x448ac9['id']});});});});});}})[_0xc5c7('0x29')](respondWithStatusCode(_0x51dc3e,null))[_0xc5c7('0x49')](handleError(_0x51dc3e,null));};exports[_0xc5c7('0x74')]=function(_0x45831e,_0x7bf386,_0x24679f){return db['Team'][_0xc5c7('0x48')]({'where':{'id':_0x45831e[_0xc5c7('0x36')][_0xc5c7('0x67')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xc5c7('0x68'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x7bf386,null))['then'](function(_0x373930){var _0x29a9b5=_[_0xc5c7('0x2f')](_0x373930,'id');var _0xd4d479=[];var _0x2ef54e=[];var _0x505d97=squel[_0xc5c7('0x75')]();_0x505d97[_0xc5c7('0x76')](_0xc5c7('0x77'))[_0xc5c7('0x78')](_0xc5c7('0x79'),'tq')['join'](_0xc5c7('0x7a'),'ut',_0xc5c7('0x7b'))[_0xc5c7('0x40')](_0xc5c7('0x7c'),_0x45831e[_0xc5c7('0x55')]['id']);for(var _0x5a263b=0x0;_0x5a263b<_0x373930['length'];_0x5a263b+=0x1){let _0x121435=_0x373930[_0x5a263b];for(var _0x5a6652=0x0;_0x5a6652<_0x121435[_0xc5c7('0x68')][_0xc5c7('0x3c')];_0x5a6652+=0x1){let _0x3e0faa=_0x121435[_0xc5c7('0x68')][_0x5a6652];var _0x101ac5=_0x505d97[_0xc5c7('0x7d')]();_0x101ac5['where']('ut.UserId\x20=\x20?',_0x3e0faa['id']);_0x2ef54e['push'](db[_0xc5c7('0x6d')]['query'](_0x101ac5[_0xc5c7('0x7e')](),{'type':db[_0xc5c7('0x6d')][_0xc5c7('0x7f')]['SELECT']})[_0xc5c7('0x29')](function(_0x437ff3){if(_0x437ff3[_0xc5c7('0x3c')]===0x1){return _0x3e0faa['id'];}else{var _0x5732a7=_[_0xc5c7('0x80')](_[_0xc5c7('0x2f')](_0x437ff3,_0xc5c7('0x81')),function(_0x3209db){return _[_0xc5c7('0x82')](_0x29a9b5,_0x3209db);});if(_0x5732a7){return _0x3e0faa['id'];}}}));}}return BPromise[_0xc5c7('0x83')](_0x2ef54e)['then'](function(_0x3c4736){_0xd4d479=_(_0xd4d479)['union'](_0x3c4736)[_0xc5c7('0x84')]()['value']();return db[_0xc5c7('0x30')][_0xc5c7('0x50')]({'where':{'id':_0x45831e[_0xc5c7('0x55')]['id']}})[_0xc5c7('0x29')](function(_0x34d63a){return db['sequelize']['transaction'](function(_0x5b1364){return _0x34d63a['removeTeams'](_0x45831e[_0xc5c7('0x36')][_0xc5c7('0x67')],{'transaction':_0x5b1364})[_0xc5c7('0x29')](function(){if(!_[_0xc5c7('0x85')](_0xd4d479)){return _0x34d63a[_0xc5c7('0x86')](_0xd4d479,{'transaction':_0x5b1364});}})[_0xc5c7('0x29')](function(){_0xd4d479[_0xc5c7('0x71')](function(_0xd8f0aa){socket[_0xc5c7('0x72')](_0xc5c7('0x87'),{'UserId':_0xd8f0aa,'SmsQueueId':_0x34d63a['id']});});});});});});})[_0xc5c7('0x29')](respondWithStatusCode(_0x7bf386,null))['catch'](handleError(_0x7bf386,null));};exports[_0xc5c7('0x88')]=function(_0x350014,_0x3bf850,_0x1691a4){return db[_0xc5c7('0x30')]['find']({'where':{'id':_0x350014[_0xc5c7('0x55')]['id']}})[_0xc5c7('0x29')](handleEntityNotFound(_0x3bf850,null))[_0xc5c7('0x29')](function(_0x4e1ed3){if(_0x4e1ed3){return _0x4e1ed3[_0xc5c7('0x88')](_0x350014[_0xc5c7('0x4c')][_0xc5c7('0x67')],_[_0xc5c7('0x89')](_0x350014[_0xc5c7('0x4c')],[_0xc5c7('0x67'),'id'])||{})[_0xc5c7('0x8a')](function(_0x3e78fe){for(var _0x4096d1=0x0;_0x4096d1<_0x350014[_0xc5c7('0x4c')][_0xc5c7('0x67')][_0xc5c7('0x3c')];_0x4096d1+=0x1){socket[_0xc5c7('0x72')](_0xc5c7('0x73'),{'UserId':Number(_0x350014['body'][_0xc5c7('0x67')][_0x4096d1]),'SmsQueueId':Number(_0x350014[_0xc5c7('0x55')]['id'])});}return _0x3e78fe;});}})['then'](respondWithResult(_0x3bf850,null))[_0xc5c7('0x49')](handleError(_0x3bf850,null));};exports[_0xc5c7('0x86')]=function(_0x4e6b7e,_0x2a1e1a,_0x1e81b0){return db['SmsQueue'][_0xc5c7('0x50')]({'where':{'id':_0x4e6b7e[_0xc5c7('0x55')]['id']}})[_0xc5c7('0x29')](handleEntityNotFound(_0x2a1e1a,null))['then'](function(_0xfd8dfa){if(_0xfd8dfa){return _0xfd8dfa[_0xc5c7('0x86')](_0x4e6b7e['query'][_0xc5c7('0x67')])[_0xc5c7('0x29')](function(){if(_[_0xc5c7('0x8b')](_0x4e6b7e[_0xc5c7('0x36')][_0xc5c7('0x67')])){for(var _0x3f6069=0x0;_0x3f6069<_0x4e6b7e[_0xc5c7('0x36')][_0xc5c7('0x67')]['length'];_0x3f6069+=0x1){socket['emit'](_0xc5c7('0x87'),{'UserId':Number(_0x4e6b7e[_0xc5c7('0x36')]['ids'][_0x3f6069]),'SmsQueueId':Number(_0x4e6b7e[_0xc5c7('0x55')]['id'])});}}else{socket[_0xc5c7('0x72')](_0xc5c7('0x87'),{'UserId':Number(_0x4e6b7e[_0xc5c7('0x36')][_0xc5c7('0x67')]),'SmsQueueId':Number(_0x4e6b7e[_0xc5c7('0x55')]['id'])});}});}})[_0xc5c7('0x29')](respondWithStatusCode(_0x2a1e1a,null))[_0xc5c7('0x49')](handleError(_0x2a1e1a,null));};exports['getAgents']=function(_0x49708e,_0x1afa61,_0x540f71){var _0xa8acfc={};var _0x4f68cf={};var _0x1f5e65;var _0xdbd98f;return db[_0xc5c7('0x30')][_0xc5c7('0x8c')]({'where':{'id':_0x49708e[_0xc5c7('0x55')]['id']}})[_0xc5c7('0x29')](handleEntityNotFound(_0x1afa61,null))[_0xc5c7('0x29')](function(_0x48c5df){if(_0x48c5df){_0x1f5e65=_0x48c5df;_0x4f68cf[_0xc5c7('0x35')]=_[_0xc5c7('0x37')](db[_0xc5c7('0x5a')][_0xc5c7('0x31')]);_0x4f68cf[_0xc5c7('0x36')]=_[_0xc5c7('0x37')](_0x49708e[_0xc5c7('0x36')]);_0x4f68cf['filters']=_['intersection'](_0x4f68cf[_0xc5c7('0x35')],_0x4f68cf[_0xc5c7('0x36')]);_0xa8acfc[_0xc5c7('0x3a')]=_[_0xc5c7('0x39')](_0x4f68cf['model'],qs[_0xc5c7('0x3b')](_0x49708e[_0xc5c7('0x36')][_0xc5c7('0x3b')]));_0xa8acfc[_0xc5c7('0x3a')]=_0xa8acfc[_0xc5c7('0x3a')][_0xc5c7('0x3c')]?_0xa8acfc[_0xc5c7('0x3a')]:_0x4f68cf[_0xc5c7('0x35')];_0xa8acfc[_0xc5c7('0x58')]=qs[_0xc5c7('0x3f')](_0x49708e[_0xc5c7('0x36')][_0xc5c7('0x3f')]);_0xa8acfc[_0xc5c7('0x40')]=qs[_0xc5c7('0x38')](_[_0xc5c7('0x41')](_0x49708e[_0xc5c7('0x36')],_0x4f68cf[_0xc5c7('0x38')]));if(_0x49708e[_0xc5c7('0x36')][_0xc5c7('0x42')]){_0xa8acfc[_0xc5c7('0x40')]=_[_0xc5c7('0x43')](_0xa8acfc[_0xc5c7('0x40')],{'$or':_[_0xc5c7('0x2f')](_0xa8acfc[_0xc5c7('0x3a')],function(_0x5b93f2){var _0x41dcba={};_0x41dcba[_0x5b93f2]={'$like':'%'+_0x49708e['query'][_0xc5c7('0x42')]+'%'};return _0x41dcba;})});}_0xa8acfc=_['merge']({},_0xa8acfc,_0x49708e[_0xc5c7('0x45')]);return _0x1f5e65[_0xc5c7('0x8d')](_0xa8acfc);}})[_0xc5c7('0x29')](function(_0x344b5b){if(_0x344b5b){_0xdbd98f=_0x344b5b[_0xc5c7('0x3c')];if(!_0x49708e[_0xc5c7('0x36')]['hasOwnProperty']('nolimit')){_0xa8acfc[_0xc5c7('0x20')]=qs[_0xc5c7('0x20')](_0x49708e[_0xc5c7('0x36')][_0xc5c7('0x20')]);_0xa8acfc[_0xc5c7('0x22')]=qs[_0xc5c7('0x22')](_0x49708e['query'][_0xc5c7('0x22')]);}return _0x1f5e65[_0xc5c7('0x8d')](_0xa8acfc);}})[_0xc5c7('0x29')](function(_0x363926){if(_0x363926){return _0x363926?{'count':_0xdbd98f,'rows':_0x363926}:null;}})[_0xc5c7('0x29')](respondWithResult(_0x1afa61,null))['catch'](handleError(_0x1afa61,null));}; \ No newline at end of file +var _0xd503=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','SmsQueues','UserProfileResource','error','stack','name','send','map','SmsQueue','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','show','fields','include','options','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','update','body','params','describe','getMembers','findOne','UserSmsQueue','User','findAndCountAll','UserId','agent','smsPause','SIP','createdAt','updatedAt','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','select','tq.TeamId','from','team_has_sms_queues','join','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','all','union','compact','removeTeams','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','userSmsQueue:save','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox'];(function(_0x1e7f4d,_0x20acaa){var _0x5f0fd9=function(_0x4dbbf4){while(--_0x4dbbf4){_0x1e7f4d['push'](_0x1e7f4d['shift']());}};_0x5f0fd9(++_0x20acaa);}(_0xd503,0x116));var _0x3d50=function(_0x1049a3,_0x43b39a){_0x1049a3=_0x1049a3-0x0;var _0x14cf4f=_0xd503[_0x1049a3];return _0x14cf4f;};'use strict';var emlformat=require(_0x3d50('0x0'));var rimraf=require(_0x3d50('0x1'));var zipdir=require(_0x3d50('0x2'));var jsonpatch=require(_0x3d50('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3d50('0x4'));var Mustache=require(_0x3d50('0x5'));var util=require('util');var path=require(_0x3d50('0x6'));var sox=require(_0x3d50('0x7'));var csv=require(_0x3d50('0x8'));var ejs=require(_0x3d50('0x9'));var fs=require('fs');var fs_extra=require(_0x3d50('0xa'));var _=require(_0x3d50('0xb'));var squel=require(_0x3d50('0xc'));var crypto=require(_0x3d50('0xd'));var jsforce=require(_0x3d50('0xe'));var deskjs=require(_0x3d50('0xf'));var toCsv=require(_0x3d50('0x8'));var querystring=require(_0x3d50('0x10'));var Papa=require('papaparse');var Redis=require(_0x3d50('0x11'));var authService=require(_0x3d50('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3d50('0x13'));var logger=require(_0x3d50('0x14'))(_0x3d50('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3d50('0x16'))['db'];config[_0x3d50('0x17')]=_[_0x3d50('0x18')](config['redis'],{'host':_0x3d50('0x19'),'port':0x18eb});var socket=require(_0x3d50('0x1a'))(new Redis(config[_0x3d50('0x17')]));require(_0x3d50('0x1b'))[_0x3d50('0x1c')](socket);function respondWithStatusCode(_0x447900,_0x407509){_0x407509=_0x407509||0xcc;return function(_0x13e375){if(_0x13e375){return _0x447900[_0x3d50('0x1d')](_0x407509);}return _0x447900[_0x3d50('0x1e')](_0x407509)['end']();};}function respondWithResult(_0x2b1f5c,_0x5a6f73){_0x5a6f73=_0x5a6f73||0xc8;return function(_0x6592d9){if(_0x6592d9){return _0x2b1f5c['status'](_0x5a6f73)[_0x3d50('0x1f')](_0x6592d9);}};}function respondWithFilteredResult(_0xf77a60,_0x50c3e6){return function(_0x21b947){if(_0x21b947){var _0xff7f8c=typeof _0x50c3e6[_0x3d50('0x20')]===_0x3d50('0x21')&&typeof _0x50c3e6[_0x3d50('0x22')]===_0x3d50('0x21');var _0x18e111=_0x21b947[_0x3d50('0x23')];var _0x1e47df=_0xff7f8c?0x0:_0x50c3e6[_0x3d50('0x20')];var _0x1737dd=_0xff7f8c?_0x21b947[_0x3d50('0x23')]:_0x50c3e6[_0x3d50('0x20')]+_0x50c3e6[_0x3d50('0x22')];var _0x855113;if(_0x1737dd>=_0x18e111){_0x1737dd=_0x18e111;_0x855113=0xc8;}else{_0x855113=0xce;}_0xf77a60[_0x3d50('0x1e')](_0x855113);return _0xf77a60[_0x3d50('0x24')](_0x3d50('0x25'),_0x1e47df+'-'+_0x1737dd+'/'+_0x18e111)[_0x3d50('0x1f')](_0x21b947);}return null;};}function patchUpdates(_0x4fc400){return function(_0x4c6c0c){try{jsonpatch[_0x3d50('0x26')](_0x4c6c0c,_0x4fc400,!![]);}catch(_0x294e75){return BPromise[_0x3d50('0x27')](_0x294e75);}return _0x4c6c0c[_0x3d50('0x28')]();};}function saveUpdates(_0x568da7,_0x4fd0dc){return function(_0x2d0d51){if(_0x2d0d51){return _0x2d0d51['update'](_0x568da7)[_0x3d50('0x29')](function(_0xd282e8){return _0xd282e8;});}return null;};}function removeEntity(_0x590d44,_0x32e5f0){return function(_0x53de20){if(_0x53de20){return _0x53de20[_0x3d50('0x2a')]()[_0x3d50('0x29')](function(){var _0x4eb322=_0x53de20['get']({'plain':!![]});var _0x44d59e=_0x3d50('0x2b');return db[_0x3d50('0x2c')][_0x3d50('0x2a')]({'where':{'type':_0x44d59e,'resourceId':_0x4eb322['id']}})[_0x3d50('0x29')](function(){return _0x53de20;});})[_0x3d50('0x29')](function(){_0x590d44['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x43d463,_0x471aa2){return function(_0x361357){if(!_0x361357){_0x43d463[_0x3d50('0x1d')](0x194);}return _0x361357;};}function handleError(_0x1e0bd6,_0x3f60ea){_0x3f60ea=_0x3f60ea||0x1f4;return function(_0x33e7df){logger[_0x3d50('0x2d')](_0x33e7df[_0x3d50('0x2e')]);if(_0x33e7df['name']){delete _0x33e7df[_0x3d50('0x2f')];}_0x1e0bd6[_0x3d50('0x1e')](_0x3f60ea)[_0x3d50('0x30')](_0x33e7df);};}exports['index']=function(_0x4683f2,_0x26cebd){var _0x1b230d={},_0x6922dc={},_0x22dfb0={'count':0x0,'rows':[]};var _0x59ca50=_[_0x3d50('0x31')](db[_0x3d50('0x32')][_0x3d50('0x33')],function(_0x479c6c){return{'name':_0x479c6c['fieldName'],'type':_0x479c6c[_0x3d50('0x34')][_0x3d50('0x35')]};});_0x6922dc[_0x3d50('0x36')]=_['map'](_0x59ca50,_0x3d50('0x2f'));_0x6922dc[_0x3d50('0x37')]=_[_0x3d50('0x38')](_0x4683f2['query']);_0x6922dc[_0x3d50('0x39')]=_[_0x3d50('0x3a')](_0x6922dc[_0x3d50('0x36')],_0x6922dc['query']);_0x1b230d[_0x3d50('0x3b')]=_['intersection'](_0x6922dc[_0x3d50('0x36')],qs['fields'](_0x4683f2['query']['fields']));_0x1b230d[_0x3d50('0x3b')]=_0x1b230d[_0x3d50('0x3b')][_0x3d50('0x3c')]?_0x1b230d[_0x3d50('0x3b')]:_0x6922dc[_0x3d50('0x36')];if(!_0x4683f2[_0x3d50('0x37')][_0x3d50('0x3d')](_0x3d50('0x3e'))){_0x1b230d[_0x3d50('0x22')]=qs[_0x3d50('0x22')](_0x4683f2[_0x3d50('0x37')][_0x3d50('0x22')]);_0x1b230d['offset']=qs[_0x3d50('0x20')](_0x4683f2[_0x3d50('0x37')][_0x3d50('0x20')]);}_0x1b230d[_0x3d50('0x3f')]=qs[_0x3d50('0x40')](_0x4683f2[_0x3d50('0x37')]['sort']);_0x1b230d[_0x3d50('0x41')]=qs['filters'](_[_0x3d50('0x42')](_0x4683f2[_0x3d50('0x37')],_0x6922dc[_0x3d50('0x39')]),_0x59ca50);if(_0x4683f2[_0x3d50('0x37')][_0x3d50('0x43')]){_0x1b230d[_0x3d50('0x41')]=_[_0x3d50('0x44')](_0x1b230d[_0x3d50('0x41')],{'$or':_[_0x3d50('0x31')](_0x59ca50,function(_0x4ab123){if(_0x4ab123['type']!==_0x3d50('0x45')){var _0x2d4808={};_0x2d4808[_0x4ab123[_0x3d50('0x2f')]]={'$like':'%'+_0x4683f2[_0x3d50('0x37')][_0x3d50('0x43')]+'%'};return _0x2d4808;}})});}_0x1b230d=_[_0x3d50('0x44')]({},_0x1b230d,_0x4683f2['options']);var _0x13585e={'where':_0x1b230d['where']};return db[_0x3d50('0x32')]['count'](_0x13585e)[_0x3d50('0x29')](function(_0x41535d){_0x22dfb0[_0x3d50('0x23')]=_0x41535d;if(_0x4683f2[_0x3d50('0x37')][_0x3d50('0x46')]){_0x1b230d['include']=[{'all':!![]}];}return db[_0x3d50('0x32')][_0x3d50('0x47')](_0x1b230d);})['then'](function(_0x32358b){_0x22dfb0[_0x3d50('0x48')]=_0x32358b;return _0x22dfb0;})[_0x3d50('0x29')](respondWithFilteredResult(_0x26cebd,_0x1b230d))['catch'](handleError(_0x26cebd,null));};exports[_0x3d50('0x49')]=function(_0x4377bd,_0x519987){var _0x541859={'raw':!![],'where':{'id':_0x4377bd['params']['id']}},_0x23f349={};_0x23f349[_0x3d50('0x36')]=_[_0x3d50('0x38')](db[_0x3d50('0x32')]['rawAttributes']);_0x23f349[_0x3d50('0x37')]=_['keys'](_0x4377bd['query']);_0x23f349[_0x3d50('0x39')]=_[_0x3d50('0x3a')](_0x23f349[_0x3d50('0x36')],_0x23f349[_0x3d50('0x37')]);_0x541859[_0x3d50('0x3b')]=_['intersection'](_0x23f349['model'],qs[_0x3d50('0x4a')](_0x4377bd[_0x3d50('0x37')][_0x3d50('0x4a')]));_0x541859[_0x3d50('0x3b')]=_0x541859[_0x3d50('0x3b')][_0x3d50('0x3c')]?_0x541859[_0x3d50('0x3b')]:_0x23f349[_0x3d50('0x36')];if(_0x4377bd[_0x3d50('0x37')][_0x3d50('0x46')]){_0x541859[_0x3d50('0x4b')]=[{'all':!![]}];}_0x541859=_['merge']({},_0x541859,_0x4377bd[_0x3d50('0x4c')]);return db[_0x3d50('0x32')]['find'](_0x541859)[_0x3d50('0x29')](handleEntityNotFound(_0x519987,null))[_0x3d50('0x29')](respondWithResult(_0x519987,null))['catch'](handleError(_0x519987,null));};exports['create']=function(_0x47ef7b,_0x143527){return db['SmsQueue']['create'](_0x47ef7b['body'],{})[_0x3d50('0x29')](function(_0x5c38ed){var _0x59ec3d=_0x47ef7b[_0x3d50('0x4d')][_0x3d50('0x4e')]({'plain':!![]});if(!_0x59ec3d)throw new Error(_0x3d50('0x4f'));if(_0x59ec3d['role']==='user'){var _0x12ef7e=_0x5c38ed[_0x3d50('0x4e')]({'plain':!![]});var _0x43ee0a='SmsQueues';return db[_0x3d50('0x50')][_0x3d50('0x51')]({'where':{'name':_0x43ee0a,'userProfileId':_0x59ec3d[_0x3d50('0x52')]},'raw':!![]})[_0x3d50('0x29')](function(_0x36e4b6){if(_0x36e4b6&&_0x36e4b6[_0x3d50('0x53')]===0x0){return db[_0x3d50('0x2c')]['create']({'name':_0x12ef7e['name'],'resourceId':_0x12ef7e['id'],'type':_0x36e4b6[_0x3d50('0x2f')],'sectionId':_0x36e4b6['id']},{})[_0x3d50('0x29')](function(){return _0x5c38ed;});}else{return _0x5c38ed;}})['catch'](function(_0x375907){logger['error'](_0x3d50('0x54'),_0x375907);throw _0x375907;});}return _0x5c38ed;})[_0x3d50('0x29')](respondWithResult(_0x143527,0xc9))[_0x3d50('0x55')](handleError(_0x143527,null));};exports[_0x3d50('0x56')]=function(_0x1e75ec,_0x1e0e00){if(_0x1e75ec['body']['id']){delete _0x1e75ec[_0x3d50('0x57')]['id'];}return db[_0x3d50('0x32')][_0x3d50('0x51')]({'where':{'id':_0x1e75ec[_0x3d50('0x58')]['id']}})['then'](handleEntityNotFound(_0x1e0e00,null))['then'](saveUpdates(_0x1e75ec[_0x3d50('0x57')],null))['then'](respondWithResult(_0x1e0e00,null))[_0x3d50('0x55')](handleError(_0x1e0e00,null));};exports[_0x3d50('0x2a')]=function(_0x3e84eb,_0x103175){return db['SmsQueue']['find']({'where':{'id':_0x3e84eb[_0x3d50('0x58')]['id']}})[_0x3d50('0x29')](handleEntityNotFound(_0x103175,null))[_0x3d50('0x29')](removeEntity(_0x103175,null))[_0x3d50('0x55')](handleError(_0x103175,null));};exports[_0x3d50('0x59')]=function(_0x5e43d0,_0x40b829){return db['SmsQueue']['describe']()['then'](respondWithResult(_0x40b829,null))[_0x3d50('0x55')](handleError(_0x40b829,null));};exports[_0x3d50('0x5a')]=function(_0x31a510,_0x21be85,_0x15ff7e){var _0x116432={'raw':!![],'where':{}},_0x2d52a8={},_0x2ee1bd;return db['SmsQueue'][_0x3d50('0x5b')]({'where':{'id':_0x31a510[_0x3d50('0x58')]['id']}})[_0x3d50('0x29')](handleEntityNotFound(_0x21be85,null))[_0x3d50('0x29')](function(_0x1547d2){if(_0x1547d2){_0x2ee1bd=_0x1547d2[_0x3d50('0x4e')]({'plain':!![]});_0x2d52a8[_0x3d50('0x36')]=_[_0x3d50('0x38')](db[_0x3d50('0x5c')][_0x3d50('0x33')]);_0x2d52a8[_0x3d50('0x37')]=_[_0x3d50('0x38')](_0x31a510[_0x3d50('0x37')]);_0x2d52a8[_0x3d50('0x39')]=_['intersection'](_0x2d52a8['model'],_0x2d52a8[_0x3d50('0x37')]);_0x116432['attributes']=_[_0x3d50('0x3a')](_0x2d52a8['model'],qs['fields'](_0x31a510[_0x3d50('0x37')][_0x3d50('0x4a')]));_0x116432['attributes']=_0x116432[_0x3d50('0x3b')][_0x3d50('0x3c')]?_0x116432[_0x3d50('0x3b')]:_0x2d52a8[_0x3d50('0x36')];if(!_0x31a510['query'][_0x3d50('0x3d')](_0x3d50('0x3e'))){_0x116432[_0x3d50('0x22')]=qs[_0x3d50('0x22')](_0x31a510['query'][_0x3d50('0x22')]);_0x116432[_0x3d50('0x20')]=qs['offset'](_0x31a510[_0x3d50('0x37')][_0x3d50('0x20')]);}_0x116432[_0x3d50('0x3f')]=qs['sort'](_0x31a510[_0x3d50('0x37')][_0x3d50('0x40')]);_0x116432['where']=qs[_0x3d50('0x39')](_[_0x3d50('0x42')](_0x31a510[_0x3d50('0x37')],_0x2d52a8[_0x3d50('0x39')]));_0x116432[_0x3d50('0x41')]['SmsQueueId']=_0x1547d2['id'];if(_0x31a510[_0x3d50('0x37')][_0x3d50('0x43')]){_0x116432['where']=_['merge'](_0x116432[_0x3d50('0x41')],{'$or':_[_0x3d50('0x31')](_0x116432[_0x3d50('0x3b')],function(_0x535600){var _0xed578b={};_0xed578b[_0x535600]={'$like':'%'+_0x31a510[_0x3d50('0x37')]['filter']+'%'};return _0xed578b;})});}_0x116432=_[_0x3d50('0x44')]({},_0x116432,_0x31a510[_0x3d50('0x4c')]);return db['UserSmsQueue']['findAll'](_0x116432);}})[_0x3d50('0x29')](function(_0x2b72d2){if(_0x2b72d2){return db[_0x3d50('0x5d')][_0x3d50('0x5e')]({'where':{'id':_[_0x3d50('0x31')](_0x2b72d2,_0x3d50('0x5f')),'role':_0x3d50('0x60')},'attributes':['id',_0x3d50('0x2f'),_0x3d50('0x61'),'updatedAt','createdAt']});}})[_0x3d50('0x29')](function(_0x1c647e){if(_0x1c647e){return{'count':_0x1c647e[_0x3d50('0x23')],'rows':_[_0x3d50('0x31')](_0x1c647e[_0x3d50('0x48')],function(_0x7f540e){return{'membername':_0x7f540e['name'],'UserId':_0x7f540e['id'],'queue_name':_0x2ee1bd[_0x3d50('0x2f')],'SmsQueueId':_0x2ee1bd['id'],'interface':util['format']('%s/%s',_0x3d50('0x62'),_0x7f540e['name']),'penalty':0x0,'paused':_0x7f540e[_0x3d50('0x61')],'createdAt':_0x7f540e[_0x3d50('0x63')],'updatedAt':_0x7f540e[_0x3d50('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x3d50('0x29')](respondWithFilteredResult(_0x21be85,_0x116432))[_0x3d50('0x55')](handleError(_0x21be85,null));};exports[_0x3d50('0x65')]=function(_0x64bf55,_0x447ba1,_0x5844bd){var _0x20b989={};var _0x3d12bf={};var _0x29fae4;var _0x49ef06;return db[_0x3d50('0x32')][_0x3d50('0x5b')]({'where':{'id':_0x64bf55['params']['id']}})[_0x3d50('0x29')](handleEntityNotFound(_0x447ba1,null))['then'](function(_0x2d785f){if(_0x2d785f){_0x29fae4=_0x2d785f;_0x3d12bf[_0x3d50('0x36')]=_['keys'](db[_0x3d50('0x66')][_0x3d50('0x33')]);_0x3d12bf[_0x3d50('0x37')]=_[_0x3d50('0x38')](_0x64bf55[_0x3d50('0x37')]);_0x3d12bf[_0x3d50('0x39')]=_[_0x3d50('0x3a')](_0x3d12bf[_0x3d50('0x36')],_0x3d12bf['query']);_0x20b989[_0x3d50('0x3b')]=_[_0x3d50('0x3a')](_0x3d12bf[_0x3d50('0x36')],qs[_0x3d50('0x4a')](_0x64bf55[_0x3d50('0x37')][_0x3d50('0x4a')]));_0x20b989['attributes']=_0x20b989['attributes'][_0x3d50('0x3c')]?_0x20b989[_0x3d50('0x3b')]:_0x3d12bf['model'];_0x20b989['order']=qs[_0x3d50('0x40')](_0x64bf55[_0x3d50('0x37')][_0x3d50('0x40')]);_0x20b989[_0x3d50('0x41')]=qs['filters'](_[_0x3d50('0x42')](_0x64bf55[_0x3d50('0x37')],_0x3d12bf[_0x3d50('0x39')]));if(_0x64bf55['query'][_0x3d50('0x43')]){_0x20b989['where']=_[_0x3d50('0x44')](_0x20b989[_0x3d50('0x41')],{'$or':_[_0x3d50('0x31')](_0x20b989[_0x3d50('0x3b')],function(_0x1ec8be){var _0x4df920={};_0x4df920[_0x1ec8be]={'$like':'%'+_0x64bf55[_0x3d50('0x37')]['filter']+'%'};return _0x4df920;})});}_0x20b989=_[_0x3d50('0x44')]({},_0x20b989,_0x64bf55['options']);return _0x29fae4[_0x3d50('0x65')](_0x20b989);}})[_0x3d50('0x29')](function(_0x393361){if(_0x393361){_0x49ef06=_0x393361[_0x3d50('0x3c')];if(!_0x64bf55[_0x3d50('0x37')][_0x3d50('0x3d')]('nolimit')){_0x20b989['limit']=qs[_0x3d50('0x22')](_0x64bf55[_0x3d50('0x37')][_0x3d50('0x22')]);_0x20b989[_0x3d50('0x20')]=qs[_0x3d50('0x20')](_0x64bf55[_0x3d50('0x37')][_0x3d50('0x20')]);}return _0x29fae4[_0x3d50('0x65')](_0x20b989);}})[_0x3d50('0x29')](function(_0x44da27){if(_0x44da27){return _0x44da27?{'count':_0x49ef06,'rows':_0x44da27}:null;}})[_0x3d50('0x29')](respondWithResult(_0x447ba1,null))[_0x3d50('0x55')](handleError(_0x447ba1,null));};exports[_0x3d50('0x67')]=function(_0x3d1379,_0x2e5682,_0xc0d293){var _0x4634bd=_0x3d1379['body'][_0x3d50('0x68')];return db[_0x3d50('0x66')]['findAll']({'where':{'id':_0x4634bd},'attributes':['id'],'include':[{'model':db[_0x3d50('0x5d')],'as':_0x3d50('0x69'),'attributes':['id',_0x3d50('0x2f'),_0x3d50('0x6a'),_0x3d50('0x6b'),_0x3d50('0x6c')],'raw':!![]}]})['then'](function(_0x157a98){if(_0x157a98){var _0x532854=_[_0x3d50('0x6d')](_0x157a98,function(_0x5264b3){var _0x3ccf4a=_0x5264b3[_0x3d50('0x4e')]({'plain':!![]});return _0x3ccf4a[_0x3d50('0x69')];});return db['SmsQueue'][_0x3d50('0x51')]({'where':{'id':_0x3d1379[_0x3d50('0x58')]['id']}})[_0x3d50('0x29')](function(_0x2be24e){return db[_0x3d50('0x6e')][_0x3d50('0x6f')](function(_0x1f310d){return _0x2be24e[_0x3d50('0x67')](_0x4634bd,{'transaction':_0x1f310d})[_0x3d50('0x29')](function(){return BPromise[_0x3d50('0x70')](_0x532854,function(_0x53806b){return db[_0x3d50('0x5c')][_0x3d50('0x71')]({'where':{'UserId':_0x53806b['id'],'SmsQueueId':_0x3d1379[_0x3d50('0x58')]['id']},'transaction':_0x1f310d});});})['then'](function(){_0x532854[_0x3d50('0x72')](function(_0x5ef4dc){socket[_0x3d50('0x73')]('userSmsQueue:save',{'UserId':_0x5ef4dc['id'],'SmsQueueId':_0x2be24e['id']});});});});});}})[_0x3d50('0x29')](respondWithStatusCode(_0x2e5682,null))[_0x3d50('0x55')](handleError(_0x2e5682,null));};exports['removeTeams']=function(_0x256713,_0x412514,_0x51f004){return db[_0x3d50('0x66')][_0x3d50('0x47')]({'where':{'id':_0x256713[_0x3d50('0x37')][_0x3d50('0x68')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x3d50('0x69'),'attributes':['id'],'raw':!![]}]})[_0x3d50('0x29')](handleEntityNotFound(_0x412514,null))[_0x3d50('0x29')](function(_0x36ac38){var _0x58539f=_[_0x3d50('0x31')](_0x36ac38,'id');var _0x48d48c=[];var _0xf0d068=[];var _0x28cf12=squel[_0x3d50('0x74')]();_0x28cf12['field'](_0x3d50('0x75'))[_0x3d50('0x76')](_0x3d50('0x77'),'tq')[_0x3d50('0x78')]('user_has_teams','ut',_0x3d50('0x79'))[_0x3d50('0x41')](_0x3d50('0x7a'),_0x256713[_0x3d50('0x58')]['id']);for(var _0x3f5919=0x0;_0x3f5919<_0x36ac38['length'];_0x3f5919+=0x1){let _0x36f949=_0x36ac38[_0x3f5919];for(var _0x50ae50=0x0;_0x50ae50<_0x36f949[_0x3d50('0x69')][_0x3d50('0x3c')];_0x50ae50+=0x1){let _0x2d23b7=_0x36f949[_0x3d50('0x69')][_0x50ae50];var _0x5e96fe=_0x28cf12[_0x3d50('0x7b')]();_0x5e96fe[_0x3d50('0x41')](_0x3d50('0x7c'),_0x2d23b7['id']);_0xf0d068[_0x3d50('0x7d')](db['sequelize'][_0x3d50('0x37')](_0x5e96fe[_0x3d50('0x7e')](),{'type':db[_0x3d50('0x6e')][_0x3d50('0x7f')][_0x3d50('0x80')]})[_0x3d50('0x29')](function(_0x43fd13){if(_0x43fd13[_0x3d50('0x3c')]===0x1){return _0x2d23b7['id'];}else{var _0x8c5778=_[_0x3d50('0x81')](_[_0x3d50('0x31')](_0x43fd13,'TeamId'),function(_0x2ecef4){return _[_0x3d50('0x82')](_0x58539f,_0x2ecef4);});if(_0x8c5778){return _0x2d23b7['id'];}}}));}}return BPromise[_0x3d50('0x83')](_0xf0d068)[_0x3d50('0x29')](function(_0x5a0545){_0x48d48c=_(_0x48d48c)[_0x3d50('0x84')](_0x5a0545)[_0x3d50('0x85')]()['value']();return db[_0x3d50('0x32')][_0x3d50('0x51')]({'where':{'id':_0x256713[_0x3d50('0x58')]['id']}})[_0x3d50('0x29')](function(_0x6efbdb){return db[_0x3d50('0x6e')][_0x3d50('0x6f')](function(_0x2e48d5){return _0x6efbdb[_0x3d50('0x86')](_0x256713[_0x3d50('0x37')]['ids'],{'transaction':_0x2e48d5})['then'](function(){if(!_[_0x3d50('0x87')](_0x48d48c)){return _0x6efbdb[_0x3d50('0x88')](_0x48d48c,{'transaction':_0x2e48d5});}})[_0x3d50('0x29')](function(){_0x48d48c['forEach'](function(_0x42e073){socket[_0x3d50('0x73')](_0x3d50('0x89'),{'UserId':_0x42e073,'SmsQueueId':_0x6efbdb['id']});});});});});});})[_0x3d50('0x29')](respondWithStatusCode(_0x412514,null))[_0x3d50('0x55')](handleError(_0x412514,null));};exports[_0x3d50('0x8a')]=function(_0x112a38,_0x2c3d2c,_0x3938ad){return db[_0x3d50('0x32')][_0x3d50('0x51')]({'where':{'id':_0x112a38[_0x3d50('0x58')]['id']}})['then'](handleEntityNotFound(_0x2c3d2c,null))[_0x3d50('0x29')](function(_0x3d7e0b){if(_0x3d7e0b){return _0x3d7e0b[_0x3d50('0x8a')](_0x112a38['body']['ids'],_[_0x3d50('0x8b')](_0x112a38['body'],[_0x3d50('0x68'),'id'])||{})['spread'](function(_0x2569fe){for(var _0x2cf899=0x0;_0x2cf899<_0x112a38[_0x3d50('0x57')][_0x3d50('0x68')][_0x3d50('0x3c')];_0x2cf899+=0x1){socket[_0x3d50('0x73')](_0x3d50('0x8c'),{'UserId':Number(_0x112a38[_0x3d50('0x57')][_0x3d50('0x68')][_0x2cf899]),'SmsQueueId':Number(_0x112a38[_0x3d50('0x58')]['id'])});}return _0x2569fe;});}})['then'](respondWithResult(_0x2c3d2c,null))[_0x3d50('0x55')](handleError(_0x2c3d2c,null));};exports[_0x3d50('0x88')]=function(_0x4e6a1b,_0xce25dd,_0x1a74ba){return db[_0x3d50('0x32')][_0x3d50('0x51')]({'where':{'id':_0x4e6a1b[_0x3d50('0x58')]['id']}})[_0x3d50('0x29')](handleEntityNotFound(_0xce25dd,null))[_0x3d50('0x29')](function(_0x254617){if(_0x254617){return _0x254617[_0x3d50('0x88')](_0x4e6a1b[_0x3d50('0x37')][_0x3d50('0x68')])['then'](function(){if(_[_0x3d50('0x8d')](_0x4e6a1b[_0x3d50('0x37')][_0x3d50('0x68')])){for(var _0x56eea0=0x0;_0x56eea0<_0x4e6a1b[_0x3d50('0x37')][_0x3d50('0x68')][_0x3d50('0x3c')];_0x56eea0+=0x1){socket[_0x3d50('0x73')](_0x3d50('0x89'),{'UserId':Number(_0x4e6a1b[_0x3d50('0x37')]['ids'][_0x56eea0]),'SmsQueueId':Number(_0x4e6a1b['params']['id'])});}}else{socket[_0x3d50('0x73')](_0x3d50('0x89'),{'UserId':Number(_0x4e6a1b[_0x3d50('0x37')]['ids']),'SmsQueueId':Number(_0x4e6a1b[_0x3d50('0x58')]['id'])});}});}})[_0x3d50('0x29')](respondWithStatusCode(_0xce25dd,null))[_0x3d50('0x55')](handleError(_0xce25dd,null));};exports[_0x3d50('0x8e')]=function(_0x193b1d,_0x56110d,_0x1cb832){var _0x2fdec0={};var _0x368b8c={};var _0x3076b8;var _0x2e56af;return db[_0x3d50('0x32')][_0x3d50('0x5b')]({'where':{'id':_0x193b1d[_0x3d50('0x58')]['id']}})[_0x3d50('0x29')](handleEntityNotFound(_0x56110d,null))[_0x3d50('0x29')](function(_0x4f5b11){if(_0x4f5b11){_0x3076b8=_0x4f5b11;_0x368b8c[_0x3d50('0x36')]=_['keys'](db[_0x3d50('0x5d')]['rawAttributes']);_0x368b8c[_0x3d50('0x37')]=_['keys'](_0x193b1d[_0x3d50('0x37')]);_0x368b8c['filters']=_[_0x3d50('0x3a')](_0x368b8c['model'],_0x368b8c[_0x3d50('0x37')]);_0x2fdec0[_0x3d50('0x3b')]=_['intersection'](_0x368b8c['model'],qs[_0x3d50('0x4a')](_0x193b1d['query'][_0x3d50('0x4a')]));_0x2fdec0['attributes']=_0x2fdec0[_0x3d50('0x3b')][_0x3d50('0x3c')]?_0x2fdec0[_0x3d50('0x3b')]:_0x368b8c[_0x3d50('0x36')];_0x2fdec0[_0x3d50('0x3f')]=qs[_0x3d50('0x40')](_0x193b1d[_0x3d50('0x37')][_0x3d50('0x40')]);_0x2fdec0[_0x3d50('0x41')]=qs[_0x3d50('0x39')](_[_0x3d50('0x42')](_0x193b1d['query'],_0x368b8c[_0x3d50('0x39')]));if(_0x193b1d[_0x3d50('0x37')]['filter']){_0x2fdec0[_0x3d50('0x41')]=_[_0x3d50('0x44')](_0x2fdec0[_0x3d50('0x41')],{'$or':_['map'](_0x2fdec0[_0x3d50('0x3b')],function(_0x4d0ea6){var _0x52b99e={};_0x52b99e[_0x4d0ea6]={'$like':'%'+_0x193b1d['query'][_0x3d50('0x43')]+'%'};return _0x52b99e;})});}_0x2fdec0=_[_0x3d50('0x44')]({},_0x2fdec0,_0x193b1d[_0x3d50('0x4c')]);return _0x3076b8[_0x3d50('0x8e')](_0x2fdec0);}})[_0x3d50('0x29')](function(_0xa76442){if(_0xa76442){_0x2e56af=_0xa76442[_0x3d50('0x3c')];if(!_0x193b1d[_0x3d50('0x37')][_0x3d50('0x3d')](_0x3d50('0x3e'))){_0x2fdec0['limit']=qs['limit'](_0x193b1d[_0x3d50('0x37')][_0x3d50('0x22')]);_0x2fdec0['offset']=qs[_0x3d50('0x20')](_0x193b1d['query'][_0x3d50('0x20')]);}return _0x3076b8[_0x3d50('0x8e')](_0x2fdec0);}})['then'](function(_0x20bc39){if(_0x20bc39){return _0x20bc39?{'count':_0x2e56af,'rows':_0x20bc39}:null;}})[_0x3d50('0x29')](respondWithResult(_0x56110d,null))[_0x3d50('0x55')](handleError(_0x56110d,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 5e89e8e..345615e 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 _0x91f3=['hook','exports','../../mysqldb','save','update','remove','emit','hasOwnProperty'];(function(_0xa41d87,_0xdaebef){var _0x1a6ad7=function(_0x2de8cd){while(--_0x2de8cd){_0xa41d87['push'](_0xa41d87['shift']());}};_0x1a6ad7(++_0xdaebef);}(_0x91f3,0x1f2));var _0x391f=function(_0xcf0ec2,_0x57b5f3){_0xcf0ec2=_0xcf0ec2-0x0;var _0x22bb73=_0x91f3[_0xcf0ec2];return _0x22bb73;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0x391f('0x0'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x391f('0x1'),'afterUpdate':_0x391f('0x2'),'afterDestroy':_0x391f('0x3')};function emitEvent(_0x4a85ac){return function(_0x2fe69a,_0x57f1ce,_0xeca1ed){SmsQueueEvents[_0x391f('0x4')](_0x4a85ac+':'+_0x2fe69a['id'],_0x2fe69a);SmsQueueEvents[_0x391f('0x4')](_0x4a85ac,_0x2fe69a);_0xeca1ed(null);};}for(var e in events){if(events[_0x391f('0x5')](e)){var event=events[e];SmsQueue[_0x391f('0x6')](e,emitEvent(event));}}module[_0x391f('0x7')]=SmsQueueEvents; \ No newline at end of file +var _0x819b=['hasOwnProperty','hook','exports','../../mysqldb','SmsQueue','save','update','remove'];(function(_0x46d690,_0xe69d3d){var _0x98dd4f=function(_0xafad5d){while(--_0xafad5d){_0x46d690['push'](_0x46d690['shift']());}};_0x98dd4f(++_0xe69d3d);}(_0x819b,0x193));var _0xb819=function(_0x17314d,_0x9082f8){_0x17314d=_0x17314d-0x0;var _0x2d6750=_0x819b[_0x17314d];return _0x2d6750;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0xb819('0x0'))['db'][_0xb819('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb819('0x2'),'afterUpdate':_0xb819('0x3'),'afterDestroy':_0xb819('0x4')};function emitEvent(_0x54cce1){return function(_0x415e21,_0x53dd37,_0x1a7476){SmsQueueEvents['emit'](_0x54cce1+':'+_0x415e21['id'],_0x415e21);SmsQueueEvents['emit'](_0x54cce1,_0x415e21);_0x1a7476(null);};}for(var e in events){if(events[_0xb819('0x5')](e)){var event=events[e];SmsQueue[_0xb819('0x6')](e,emitEvent(event));}}module[_0xb819('0x7')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 8eb9cec..f46643e 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 _0x0d65=['./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash','util','../../config/logger','moment','rimraf','../../config/environment'];(function(_0x193e93,_0x12f171){var _0x7a1bb4=function(_0x4eb2a7){while(--_0x4eb2a7){_0x193e93['push'](_0x193e93['shift']());}};_0x7a1bb4(++_0x12f171);}(_0x0d65,0x102));var _0x50d6=function(_0x5a8f43,_0x4b3645){_0x5a8f43=_0x5a8f43-0x0;var _0x14ac71=_0x0d65[_0x5a8f43];return _0x14ac71;};'use strict';var _=require(_0x50d6('0x0'));var util=require(_0x50d6('0x1'));var logger=require(_0x50d6('0x2'))('api');var moment=require(_0x50d6('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x50d6('0x4'));var config=require(_0x50d6('0x5'));var attributes=require(_0x50d6('0x6'));module[_0x50d6('0x7')]=function(_0x4e6f33,_0x11d610){return _0x4e6f33[_0x50d6('0x8')](_0x50d6('0x9'),attributes,{'tableName':_0x50d6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb21=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash','util','../../config/logger'];(function(_0x10a0fa,_0x4c9f7b){var _0x17788a=function(_0x40f701){while(--_0x40f701){_0x10a0fa['push'](_0x10a0fa['shift']());}};_0x17788a(++_0x4c9f7b);}(_0xcb21,0x1b0));var _0x1cb2=function(_0x312fb6,_0x49b5aa){_0x312fb6=_0x312fb6-0x0;var _0x5536f1=_0xcb21[_0x312fb6];return _0x5536f1;};'use strict';var _=require(_0x1cb2('0x0'));var util=require(_0x1cb2('0x1'));var logger=require(_0x1cb2('0x2'))(_0x1cb2('0x3'));var moment=require(_0x1cb2('0x4'));var BPromise=require(_0x1cb2('0x5'));var rp=require(_0x1cb2('0x6'));var fs=require('fs');var path=require(_0x1cb2('0x7'));var rimraf=require(_0x1cb2('0x8'));var config=require(_0x1cb2('0x9'));var attributes=require(_0x1cb2('0xa'));module[_0x1cb2('0xb')]=function(_0x288361,_0x30aaf4){return _0x288361[_0x1cb2('0xc')](_0x1cb2('0xd'),attributes,{'tableName':_0x1cb2('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index d5818f4..1e4d778 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 _0xe898=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','info','SmsQueue,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','GetSmsQueue','SmsQueue','findAll','options','raw','attributes','limit','include','model','map','ShowSmsQueue','find','where','stringify','lodash','util','moment','bluebird'];(function(_0x417cef,_0x5faf){var _0x49bbbf=function(_0x3fc80e){while(--_0x3fc80e){_0x417cef['push'](_0x417cef['shift']());}};_0x49bbbf(++_0x5faf);}(_0xe898,0xce));var _0x8e89=function(_0x92bc95,_0x2dbcc0){_0x92bc95=_0x92bc95-0x0;var _0x1d671e=_0xe898[_0x92bc95];return _0x1d671e;};'use strict';var _=require(_0x8e89('0x0'));var util=require(_0x8e89('0x1'));var moment=require(_0x8e89('0x2'));var BPromise=require(_0x8e89('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8e89('0x4'));var db=require(_0x8e89('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8e89('0x6'))(_0x8e89('0x7'));var config=require(_0x8e89('0x8'));var jayson=require(_0x8e89('0x9'));var client=jayson[_0x8e89('0xa')][_0x8e89('0xb')]({'port':0x232a});config['redis']=_[_0x8e89('0xc')](config[_0x8e89('0xd')],{'host':_0x8e89('0xe'),'port':0x18eb});var socket=require(_0x8e89('0xf'))(new Redis(config[_0x8e89('0xd')]));require('./smsQueue.socket')[_0x8e89('0x10')](socket);function respondWithRpcPromise(_0x451368,_0x2bdd57,_0xe4c6a5){return new BPromise(function(_0x1e5875,_0x4d98d9){return client[_0x8e89('0x11')](_0x451368,_0xe4c6a5)[_0x8e89('0x12')](function(_0x206af6){logger[_0x8e89('0x13')](_0x8e89('0x14'),_0x2bdd57,'request\x20sent');logger[_0x8e89('0x15')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x2bdd57,_0x8e89('0x16'),JSON['stringify'](_0x206af6));if(_0x206af6[_0x8e89('0x17')]){if(_0x206af6['error'][_0x8e89('0x18')]===0x1f4){logger[_0x8e89('0x17')]('SmsQueue,\x20%s,\x20%s',_0x2bdd57,_0x206af6[_0x8e89('0x17')]['message']);return _0x4d98d9(_0x206af6['error']['message']);}logger['error']('SmsQueue,\x20%s,\x20%s',_0x2bdd57,_0x206af6[_0x8e89('0x17')][_0x8e89('0x19')]);return _0x1e5875(_0x206af6[_0x8e89('0x17')][_0x8e89('0x19')]);}else{logger[_0x8e89('0x13')](_0x8e89('0x14'),_0x2bdd57,_0x8e89('0x16'));_0x1e5875(_0x206af6[_0x8e89('0x1a')]['message']);}})[_0x8e89('0x1b')](function(_0x1966f9){logger[_0x8e89('0x17')](_0x8e89('0x14'),_0x2bdd57,_0x1966f9);_0x4d98d9(_0x1966f9);});});}exports[_0x8e89('0x1c')]=function(_0x37fbfe){var _0x45f06d=this;return new Promise(function(_0xeb6680,_0x1e9ccb){return db[_0x8e89('0x1d')][_0x8e89('0x1e')]({'raw':_0x37fbfe[_0x8e89('0x1f')]?_0x37fbfe[_0x8e89('0x1f')][_0x8e89('0x20')]===undefined?!![]:![]:!![],'where':_0x37fbfe[_0x8e89('0x1f')]?_0x37fbfe[_0x8e89('0x1f')]['where']||null:null,'attributes':_0x37fbfe[_0x8e89('0x1f')]?_0x37fbfe['options'][_0x8e89('0x21')]||null:null,'limit':_0x37fbfe['options']?_0x37fbfe[_0x8e89('0x1f')][_0x8e89('0x22')]||null:null,'include':_0x37fbfe[_0x8e89('0x1f')]?_0x37fbfe['options']['include']?_['map'](_0x37fbfe[_0x8e89('0x1f')][_0x8e89('0x23')],function(_0x443a82){return{'model':db[_0x443a82[_0x8e89('0x24')]],'as':_0x443a82['as'],'attributes':_0x443a82[_0x8e89('0x21')],'include':_0x443a82[_0x8e89('0x23')]?_['map'](_0x443a82['include'],function(_0x19cbfe){return{'model':db[_0x19cbfe[_0x8e89('0x24')]],'as':_0x19cbfe['as'],'attributes':_0x19cbfe[_0x8e89('0x21')],'include':_0x19cbfe[_0x8e89('0x23')]?_[_0x8e89('0x25')](_0x19cbfe[_0x8e89('0x23')],function(_0x102c74){return{'model':db[_0x102c74[_0x8e89('0x24')]],'as':_0x102c74['as'],'attributes':_0x102c74[_0x8e89('0x21')]};}):[]};}):[]};}):[]:[]})[_0x8e89('0x12')](function(_0x1abbeb){logger[_0x8e89('0x13')](_0x8e89('0x1c'),_0x37fbfe);logger[_0x8e89('0x15')](_0x8e89('0x1c'),_0x37fbfe,JSON['stringify'](_0x1abbeb));_0xeb6680(_0x1abbeb);})[_0x8e89('0x1b')](function(_0x62150c){logger['error'](_0x8e89('0x1c'),_0x62150c['message'],_0x37fbfe);_0x1e9ccb(_0x45f06d[_0x8e89('0x17')](0x1f4,_0x62150c[_0x8e89('0x19')]));});});};exports[_0x8e89('0x26')]=function(_0xb5bd2c){var _0x321e59=this;return new Promise(function(_0x2ff08c,_0x464ad3){return db[_0x8e89('0x1d')][_0x8e89('0x27')]({'raw':_0xb5bd2c[_0x8e89('0x1f')]?_0xb5bd2c[_0x8e89('0x1f')][_0x8e89('0x20')]===undefined?!![]:![]:!![],'where':_0xb5bd2c[_0x8e89('0x1f')]?_0xb5bd2c[_0x8e89('0x1f')][_0x8e89('0x28')]||null:null,'attributes':_0xb5bd2c[_0x8e89('0x1f')]?_0xb5bd2c[_0x8e89('0x1f')]['attributes']||null:null,'include':_0xb5bd2c['options']?_0xb5bd2c[_0x8e89('0x1f')][_0x8e89('0x23')]?_[_0x8e89('0x25')](_0xb5bd2c[_0x8e89('0x1f')][_0x8e89('0x23')],function(_0x45ce4d){return{'model':db[_0x45ce4d[_0x8e89('0x24')]],'as':_0x45ce4d['as'],'attributes':_0x45ce4d[_0x8e89('0x21')],'include':_0x45ce4d[_0x8e89('0x23')]?_[_0x8e89('0x25')](_0x45ce4d[_0x8e89('0x23')],function(_0x53915c){return{'model':db[_0x53915c['model']],'as':_0x53915c['as'],'attributes':_0x53915c['attributes'],'include':_0x53915c[_0x8e89('0x23')]?_[_0x8e89('0x25')](_0x53915c[_0x8e89('0x23')],function(_0x3500a2){return{'model':db[_0x3500a2[_0x8e89('0x24')]],'as':_0x3500a2['as'],'attributes':_0x3500a2['attributes']};}):[]};}):[]};}):[]:[]})[_0x8e89('0x12')](function(_0xe9b2d5){logger['info']('ShowSmsQueue',_0xb5bd2c);logger[_0x8e89('0x15')]('ShowSmsQueue',_0xb5bd2c,JSON[_0x8e89('0x29')](_0xe9b2d5));_0x2ff08c(_0xe9b2d5);})[_0x8e89('0x1b')](function(_0x1e1c36){logger[_0x8e89('0x17')](_0x8e89('0x26'),_0x1e1c36[_0x8e89('0x19')],_0xb5bd2c);_0x464ad3(_0x321e59[_0x8e89('0x17')](0x1f4,_0x1e1c36['message']));});});}; \ No newline at end of file +var _0xbce7=['jayson/promise','http','redis','defaults','socket.io-emitter','./smsQueue.socket','request','info','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','SmsQueue,\x20%s,\x20%s','message','result','catch','GetSmsQueue','SmsQueue','findAll','options','raw','limit','include','map','attributes','model','ShowSmsQueue','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x7be9c4,_0x415184){var _0x29bdf1=function(_0x2b92a3){while(--_0x2b92a3){_0x7be9c4['push'](_0x7be9c4['shift']());}};_0x29bdf1(++_0x415184);}(_0xbce7,0x155));var _0x7bce=function(_0x581a78,_0x4bb5c2){_0x581a78=_0x581a78-0x0;var _0x12d5d2=_0xbce7[_0x581a78];return _0x12d5d2;};'use strict';var _=require(_0x7bce('0x0'));var util=require(_0x7bce('0x1'));var moment=require('moment');var BPromise=require(_0x7bce('0x2'));var rs=require(_0x7bce('0x3'));var fs=require('fs');var Redis=require(_0x7bce('0x4'));var db=require(_0x7bce('0x5'))['db'];var utils=require(_0x7bce('0x6'));var logger=require(_0x7bce('0x7'))(_0x7bce('0x8'));var config=require(_0x7bce('0x9'));var jayson=require(_0x7bce('0xa'));var client=jayson['client'][_0x7bce('0xb')]({'port':0x232a});config[_0x7bce('0xc')]=_[_0x7bce('0xd')](config[_0x7bce('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x7bce('0xe'))(new Redis(config[_0x7bce('0xc')]));require(_0x7bce('0xf'))['register'](socket);function respondWithRpcPromise(_0x4cad13,_0x300940,_0x5985f3){return new BPromise(function(_0x21fe22,_0x5c8edb){return client[_0x7bce('0x10')](_0x4cad13,_0x5985f3)['then'](function(_0xdb9ce7){logger[_0x7bce('0x11')]('SmsQueue,\x20%s,\x20%s',_0x300940,_0x7bce('0x12'));logger[_0x7bce('0x13')](_0x7bce('0x14'),_0x300940,_0x7bce('0x12'),JSON[_0x7bce('0x15')](_0xdb9ce7));if(_0xdb9ce7[_0x7bce('0x16')]){if(_0xdb9ce7[_0x7bce('0x16')]['code']===0x1f4){logger[_0x7bce('0x16')](_0x7bce('0x17'),_0x300940,_0xdb9ce7['error']['message']);return _0x5c8edb(_0xdb9ce7[_0x7bce('0x16')][_0x7bce('0x18')]);}logger[_0x7bce('0x16')](_0x7bce('0x17'),_0x300940,_0xdb9ce7['error'][_0x7bce('0x18')]);return _0x21fe22(_0xdb9ce7[_0x7bce('0x16')][_0x7bce('0x18')]);}else{logger['info'](_0x7bce('0x17'),_0x300940,_0x7bce('0x12'));_0x21fe22(_0xdb9ce7[_0x7bce('0x19')][_0x7bce('0x18')]);}})[_0x7bce('0x1a')](function(_0x3ae1d0){logger[_0x7bce('0x16')](_0x7bce('0x17'),_0x300940,_0x3ae1d0);_0x5c8edb(_0x3ae1d0);});});}exports[_0x7bce('0x1b')]=function(_0x313233){var _0x3e59e0=this;return new Promise(function(_0x5cd415,_0x3348ff){return db[_0x7bce('0x1c')][_0x7bce('0x1d')]({'raw':_0x313233[_0x7bce('0x1e')]?_0x313233['options'][_0x7bce('0x1f')]===undefined?!![]:![]:!![],'where':_0x313233[_0x7bce('0x1e')]?_0x313233[_0x7bce('0x1e')]['where']||null:null,'attributes':_0x313233[_0x7bce('0x1e')]?_0x313233[_0x7bce('0x1e')]['attributes']||null:null,'limit':_0x313233[_0x7bce('0x1e')]?_0x313233[_0x7bce('0x1e')][_0x7bce('0x20')]||null:null,'include':_0x313233[_0x7bce('0x1e')]?_0x313233[_0x7bce('0x1e')][_0x7bce('0x21')]?_[_0x7bce('0x22')](_0x313233[_0x7bce('0x1e')][_0x7bce('0x21')],function(_0x4793c5){return{'model':db[_0x4793c5['model']],'as':_0x4793c5['as'],'attributes':_0x4793c5[_0x7bce('0x23')],'include':_0x4793c5[_0x7bce('0x21')]?_[_0x7bce('0x22')](_0x4793c5[_0x7bce('0x21')],function(_0x55be8a){return{'model':db[_0x55be8a[_0x7bce('0x24')]],'as':_0x55be8a['as'],'attributes':_0x55be8a['attributes'],'include':_0x55be8a[_0x7bce('0x21')]?_['map'](_0x55be8a[_0x7bce('0x21')],function(_0x4caa84){return{'model':db[_0x4caa84[_0x7bce('0x24')]],'as':_0x4caa84['as'],'attributes':_0x4caa84[_0x7bce('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3fc8f8){logger['info'](_0x7bce('0x1b'),_0x313233);logger[_0x7bce('0x13')]('GetSmsQueue',_0x313233,JSON[_0x7bce('0x15')](_0x3fc8f8));_0x5cd415(_0x3fc8f8);})[_0x7bce('0x1a')](function(_0x19d1b9){logger[_0x7bce('0x16')](_0x7bce('0x1b'),_0x19d1b9[_0x7bce('0x18')],_0x313233);_0x3348ff(_0x3e59e0[_0x7bce('0x16')](0x1f4,_0x19d1b9[_0x7bce('0x18')]));});});};exports[_0x7bce('0x25')]=function(_0x4115fc){var _0x5aac6d=this;return new Promise(function(_0x17b0b0,_0x564cd3){return db['SmsQueue'][_0x7bce('0x26')]({'raw':_0x4115fc['options']?_0x4115fc['options'][_0x7bce('0x1f')]===undefined?!![]:![]:!![],'where':_0x4115fc['options']?_0x4115fc[_0x7bce('0x1e')]['where']||null:null,'attributes':_0x4115fc['options']?_0x4115fc['options'][_0x7bce('0x23')]||null:null,'include':_0x4115fc[_0x7bce('0x1e')]?_0x4115fc['options'][_0x7bce('0x21')]?_[_0x7bce('0x22')](_0x4115fc['options'][_0x7bce('0x21')],function(_0x37722c){return{'model':db[_0x37722c[_0x7bce('0x24')]],'as':_0x37722c['as'],'attributes':_0x37722c[_0x7bce('0x23')],'include':_0x37722c[_0x7bce('0x21')]?_[_0x7bce('0x22')](_0x37722c[_0x7bce('0x21')],function(_0x3ec707){return{'model':db[_0x3ec707[_0x7bce('0x24')]],'as':_0x3ec707['as'],'attributes':_0x3ec707['attributes'],'include':_0x3ec707[_0x7bce('0x21')]?_[_0x7bce('0x22')](_0x3ec707[_0x7bce('0x21')],function(_0x3a64ea){return{'model':db[_0x3a64ea['model']],'as':_0x3a64ea['as'],'attributes':_0x3a64ea[_0x7bce('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x83792d){logger['info'](_0x7bce('0x25'),_0x4115fc);logger[_0x7bce('0x13')](_0x7bce('0x25'),_0x4115fc,JSON['stringify'](_0x83792d));_0x17b0b0(_0x83792d);})[_0x7bce('0x1a')](function(_0x31a424){logger[_0x7bce('0x16')]('ShowSmsQueue',_0x31a424['message'],_0x4115fc);_0x564cd3(_0x5aac6d[_0x7bce('0x16')](0x1f4,_0x31a424[_0x7bce('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 37f21ac..8014cd6 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 _0x4d8d=['remove','update','emit','register','save'];(function(_0x72895a,_0x433607){var _0x5226d5=function(_0x5b7d21){while(--_0x5b7d21){_0x72895a['push'](_0x72895a['shift']());}};_0x5226d5(++_0x433607);}(_0x4d8d,0x1d0));var _0xd4d8=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4d8d[_0x2dafbe];return _0x58a45a;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0xd4d8('0x0'),_0xd4d8('0x1'),_0xd4d8('0x2')];function createListener(_0x5f3005,_0x46f00e){return function(_0xfbf29e){_0x46f00e[_0xd4d8('0x3')](_0x5f3005,_0xfbf29e);};}function removeListener(_0x24037e,_0x2a6d8a){return function(){SmsQueueEvents['removeListener'](_0x24037e,_0x2a6d8a);};}exports[_0xd4d8('0x4')]=function(_0x406fdf){for(var _0x2936a3=0x0,_0x326734=events['length'];_0x2936a3<_0x326734;_0x2936a3++){var _0x27c3e1=events[_0x2936a3];var _0x57b23d=createListener('smsQueue:'+_0x27c3e1,_0x406fdf);SmsQueueEvents['on'](_0x27c3e1,_0x57b23d);}}; \ No newline at end of file +var _0x76d0=['remove','update','removeListener','register','length','smsQueue:','save'];(function(_0x1af66c,_0x11aab8){var _0x3f9f2a=function(_0x182462){while(--_0x182462){_0x1af66c['push'](_0x1af66c['shift']());}};_0x3f9f2a(++_0x11aab8);}(_0x76d0,0x180));var _0x076d=function(_0x257dd8,_0x3da718){_0x257dd8=_0x257dd8-0x0;var _0x12a027=_0x76d0[_0x257dd8];return _0x12a027;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0x076d('0x0'),_0x076d('0x1'),_0x076d('0x2')];function createListener(_0x515666,_0x2217a6){return function(_0x321e64){_0x2217a6['emit'](_0x515666,_0x321e64);};}function removeListener(_0x5da0e5,_0x2c43a0){return function(){SmsQueueEvents[_0x076d('0x3')](_0x5da0e5,_0x2c43a0);};}exports[_0x076d('0x4')]=function(_0x173a3e){for(var _0x5224b6=0x0,_0x3b0cc9=events[_0x076d('0x5')];_0x5224b6<_0x3b0cc9;_0x5224b6++){var _0x3afb1d=events[_0x5224b6];var _0x47a86c=createListener(_0x076d('0x6')+_0x3afb1d,_0x173a3e);SmsQueueEvents['on'](_0x3afb1d,_0x47a86c);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 17ecb57..4639b80 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 _0x6e0a=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','isAuthenticated','index','get','describe','/:id','update','delete','destroy'];(function(_0x4f7613,_0x41be0f){var _0x1a82ca=function(_0x268430){while(--_0x268430){_0x4f7613['push'](_0x4f7613['shift']());}};_0x1a82ca(++_0x41be0f);}(_0x6e0a,0xa1));var _0xa6e0=function(_0xc08f00,_0x28067f){_0xc08f00=_0xc08f00-0x0;var _0x8649f7=_0x6e0a[_0xc08f00];return _0x8649f7;};'use strict';var multer=require(_0xa6e0('0x0'));var util=require(_0xa6e0('0x1'));var path=require(_0xa6e0('0x2'));var timeout=require(_0xa6e0('0x3'));var express=require(_0xa6e0('0x4'));var router=express[_0xa6e0('0x5')]();var fs_extra=require(_0xa6e0('0x6'));var auth=require(_0xa6e0('0x7'));var interaction=require(_0xa6e0('0x8'));var config=require(_0xa6e0('0x9'));var controller=require(_0xa6e0('0xa'));router['get']('/',auth[_0xa6e0('0xb')](),controller[_0xa6e0('0xc')]);router[_0xa6e0('0xd')]('/describe',auth[_0xa6e0('0xb')](),controller[_0xa6e0('0xe')]);router[_0xa6e0('0xd')](_0xa6e0('0xf'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xa6e0('0xb')](),controller['create']);router['put'](_0xa6e0('0xf'),auth[_0xa6e0('0xb')](),controller[_0xa6e0('0x10')]);router[_0xa6e0('0x11')](_0xa6e0('0xf'),auth[_0xa6e0('0xb')](),controller[_0xa6e0('0x12')]);module[_0xa6e0('0x13')]=router; \ No newline at end of file +var _0x3b1c=['../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service'];(function(_0x487bc6,_0x229b04){var _0x43507d=function(_0x11f0c9){while(--_0x11f0c9){_0x487bc6['push'](_0x487bc6['shift']());}};_0x43507d(++_0x229b04);}(_0x3b1c,0xe9));var _0xc3b1=function(_0xdaa8b2,_0x21cc0f){_0xdaa8b2=_0xdaa8b2-0x0;var _0x442804=_0x3b1c[_0xdaa8b2];return _0x442804;};'use strict';var multer=require(_0xc3b1('0x0'));var util=require(_0xc3b1('0x1'));var path=require(_0xc3b1('0x2'));var timeout=require(_0xc3b1('0x3'));var express=require('express');var router=express[_0xc3b1('0x4')]();var fs_extra=require(_0xc3b1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc3b1('0x6'));var config=require(_0xc3b1('0x7'));var controller=require('./smsQueueReport.controller');router[_0xc3b1('0x8')]('/',auth[_0xc3b1('0x9')](),controller[_0xc3b1('0xa')]);router['get'](_0xc3b1('0xb'),auth[_0xc3b1('0x9')](),controller[_0xc3b1('0xc')]);router[_0xc3b1('0x8')](_0xc3b1('0xd'),auth[_0xc3b1('0x9')](),controller[_0xc3b1('0xe')]);router[_0xc3b1('0xf')]('/',auth[_0xc3b1('0x9')](),controller[_0xc3b1('0x10')]);router[_0xc3b1('0x11')](_0xc3b1('0xd'),auth[_0xc3b1('0x9')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc3b1('0x12')]);module[_0xc3b1('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 8ffdfe6..25af900 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 _0x699c=['exports','STRING','DATE','moment','sequelize'];(function(_0x40a0d1,_0x2c1fcf){var _0x5f585e=function(_0x5cd039){while(--_0x5cd039){_0x40a0d1['push'](_0x40a0d1['shift']());}};_0x5f585e(++_0x2c1fcf);}(_0x699c,0x17f));var _0xc699=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x699c[_0x167cc1];return _0x10bc4b;};'use strict';var moment=require(_0xc699('0x0'));var Sequelize=require(_0xc699('0x1'));module[_0xc699('0x2')]={'uniqueid':{'type':Sequelize[_0xc699('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xc699('0x3')]},'joinAt':{'type':Sequelize[_0xc699('0x4')]},'leaveAt':{'type':Sequelize[_0xc699('0x4')]},'acceptAt':{'type':Sequelize[_0xc699('0x4')]},'exitAt':{'type':Sequelize[_0xc699('0x4')]},'reason':{'type':Sequelize[_0xc699('0x3')]}}; \ No newline at end of file +var _0x7fb0=['exports','STRING','DATE','moment','sequelize'];(function(_0x3bd486,_0x33c752){var _0x537dae=function(_0x5a7dc9){while(--_0x5a7dc9){_0x3bd486['push'](_0x3bd486['shift']());}};_0x537dae(++_0x33c752);}(_0x7fb0,0x99));var _0x07fb=function(_0x2ce542,_0x570ba3){_0x2ce542=_0x2ce542-0x0;var _0x29d7ec=_0x7fb0[_0x2ce542];return _0x29d7ec;};'use strict';var moment=require(_0x07fb('0x0'));var Sequelize=require(_0x07fb('0x1'));module[_0x07fb('0x2')]={'uniqueid':{'type':Sequelize[_0x07fb('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x07fb('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x07fb('0x4')]},'exitAt':{'type':Sequelize[_0x07fb('0x4')]},'reason':{'type':Sequelize[_0x07fb('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index a5b5214..27cc884 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 _0xc2be=['length','create','body','catch','destroy','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','end','error','stack','name','send','index','map','SmsQueueReport','rawAttributes','type','key','model','keys','query','filters','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','intersection'];(function(_0x503bdf,_0x43aff7){var _0x41d9e4=function(_0x555432){while(--_0x555432){_0x503bdf['push'](_0x503bdf['shift']());}};_0x41d9e4(++_0x43aff7);}(_0xc2be,0xa7));var _0xec2b=function(_0x2d4421,_0x15a84f){_0x2d4421=_0x2d4421-0x0;var _0x2d3b01=_0xc2be[_0x2d4421];return _0x2d3b01;};'use strict';var emlformat=require(_0xec2b('0x0'));var rimraf=require(_0xec2b('0x1'));var zipdir=require(_0xec2b('0x2'));var jsonpatch=require(_0xec2b('0x3'));var rp=require(_0xec2b('0x4'));var moment=require(_0xec2b('0x5'));var BPromise=require(_0xec2b('0x6'));var Mustache=require('mustache');var util=require(_0xec2b('0x7'));var path=require(_0xec2b('0x8'));var sox=require(_0xec2b('0x9'));var csv=require(_0xec2b('0xa'));var ejs=require(_0xec2b('0xb'));var fs=require('fs');var fs_extra=require(_0xec2b('0xc'));var _=require(_0xec2b('0xd'));var squel=require(_0xec2b('0xe'));var crypto=require(_0xec2b('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xec2b('0xa'));var querystring=require(_0xec2b('0x10'));var Papa=require(_0xec2b('0x11'));var Redis=require(_0xec2b('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xec2b('0x13'));var as=require(_0xec2b('0x14'));var hardwareService=require(_0xec2b('0x15'));var logger=require(_0xec2b('0x16'))(_0xec2b('0x17'));var utils=require(_0xec2b('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xec2b('0x19'));var db=require(_0xec2b('0x1a'))['db'];function respondWithStatusCode(_0x473aab,_0x3b73e3){_0x3b73e3=_0x3b73e3||0xcc;return function(_0x5804ba){if(_0x5804ba){return _0x473aab[_0xec2b('0x1b')](_0x3b73e3);}return _0x473aab[_0xec2b('0x1c')](_0x3b73e3)['end']();};}function respondWithResult(_0x594243,_0x35e5c2){_0x35e5c2=_0x35e5c2||0xc8;return function(_0x29d030){if(_0x29d030){return _0x594243[_0xec2b('0x1c')](_0x35e5c2)['json'](_0x29d030);}};}function respondWithFilteredResult(_0xea9aa1,_0x3d9ab6){return function(_0x2947a6){if(_0x2947a6){var _0x5d1bc0=typeof _0x3d9ab6[_0xec2b('0x1d')]===_0xec2b('0x1e')&&typeof _0x3d9ab6[_0xec2b('0x1f')]===_0xec2b('0x1e');var _0x529801=_0x2947a6['count'];var _0x3402b9=_0x5d1bc0?0x0:_0x3d9ab6[_0xec2b('0x1d')];var _0xc7fa06=_0x5d1bc0?_0x2947a6[_0xec2b('0x20')]:_0x3d9ab6[_0xec2b('0x1d')]+_0x3d9ab6['limit'];var _0x8a440a;if(_0xc7fa06>=_0x529801){_0xc7fa06=_0x529801;_0x8a440a=0xc8;}else{_0x8a440a=0xce;}_0xea9aa1[_0xec2b('0x1c')](_0x8a440a);return _0xea9aa1[_0xec2b('0x21')](_0xec2b('0x22'),_0x3402b9+'-'+_0xc7fa06+'/'+_0x529801)[_0xec2b('0x23')](_0x2947a6);}return null;};}function patchUpdates(_0x489f82){return function(_0x4e25d7){try{jsonpatch[_0xec2b('0x24')](_0x4e25d7,_0x489f82,!![]);}catch(_0x55f38c){return BPromise[_0xec2b('0x25')](_0x55f38c);}return _0x4e25d7[_0xec2b('0x26')]();};}function saveUpdates(_0xe9449b,_0x143e4c){return function(_0x5eb5aa){if(_0x5eb5aa){return _0x5eb5aa[_0xec2b('0x27')](_0xe9449b)[_0xec2b('0x28')](function(_0x2e8752){return _0x2e8752;});}return null;};}function removeEntity(_0x2eeebb,_0xa02419){return function(_0x159562){if(_0x159562){return _0x159562['destroy']()[_0xec2b('0x28')](function(){_0x2eeebb[_0xec2b('0x1c')](0xcc)[_0xec2b('0x29')]();});}};}function handleEntityNotFound(_0x56bda7,_0xda54b6){return function(_0x2ef3c6){if(!_0x2ef3c6){_0x56bda7['sendStatus'](0x194);}return _0x2ef3c6;};}function handleError(_0x2a84a7,_0x3593d5){_0x3593d5=_0x3593d5||0x1f4;return function(_0x2b3eda){logger[_0xec2b('0x2a')](_0x2b3eda[_0xec2b('0x2b')]);if(_0x2b3eda[_0xec2b('0x2c')]){delete _0x2b3eda[_0xec2b('0x2c')];}_0x2a84a7[_0xec2b('0x1c')](_0x3593d5)[_0xec2b('0x2d')](_0x2b3eda);};}exports[_0xec2b('0x2e')]=function(_0x410ab2,_0x8ce61e){var _0x2670a4={},_0xc9f778={},_0x171471={'count':0x0,'rows':[]};var _0x21ff5a=_[_0xec2b('0x2f')](db[_0xec2b('0x30')][_0xec2b('0x31')],function(_0x32c8d4){return{'name':_0x32c8d4['fieldName'],'type':_0x32c8d4[_0xec2b('0x32')][_0xec2b('0x33')]};});_0xc9f778[_0xec2b('0x34')]=_['map'](_0x21ff5a,_0xec2b('0x2c'));_0xc9f778['query']=_[_0xec2b('0x35')](_0x410ab2[_0xec2b('0x36')]);_0xc9f778[_0xec2b('0x37')]=_['intersection'](_0xc9f778[_0xec2b('0x34')],_0xc9f778['query']);_0x2670a4[_0xec2b('0x38')]=_['intersection'](_0xc9f778[_0xec2b('0x34')],qs[_0xec2b('0x39')](_0x410ab2[_0xec2b('0x36')][_0xec2b('0x39')]));_0x2670a4[_0xec2b('0x38')]=_0x2670a4['attributes']['length']?_0x2670a4['attributes']:_0xc9f778[_0xec2b('0x34')];if(!_0x410ab2[_0xec2b('0x36')][_0xec2b('0x3a')]('nolimit')){_0x2670a4[_0xec2b('0x1f')]=qs['limit'](_0x410ab2[_0xec2b('0x36')][_0xec2b('0x1f')]);_0x2670a4[_0xec2b('0x1d')]=qs[_0xec2b('0x1d')](_0x410ab2[_0xec2b('0x36')]['offset']);}_0x2670a4[_0xec2b('0x3b')]=qs[_0xec2b('0x3c')](_0x410ab2[_0xec2b('0x36')]['sort']);_0x2670a4[_0xec2b('0x3d')]=qs[_0xec2b('0x37')](_[_0xec2b('0x3e')](_0x410ab2[_0xec2b('0x36')],_0xc9f778[_0xec2b('0x37')]),_0x21ff5a);if(_0x410ab2['query']['filter']){_0x2670a4[_0xec2b('0x3d')]=_[_0xec2b('0x3f')](_0x2670a4[_0xec2b('0x3d')],{'$or':_['map'](_0x21ff5a,function(_0x18181f){if(_0x18181f[_0xec2b('0x32')]!==_0xec2b('0x40')){var _0x1d0507={};_0x1d0507[_0x18181f['name']]={'$like':'%'+_0x410ab2[_0xec2b('0x36')][_0xec2b('0x41')]+'%'};return _0x1d0507;}})});}_0x2670a4=_[_0xec2b('0x3f')]({},_0x2670a4,_0x410ab2[_0xec2b('0x42')]);var _0x403c06={'where':_0x2670a4[_0xec2b('0x3d')]};return db[_0xec2b('0x30')][_0xec2b('0x20')](_0x403c06)[_0xec2b('0x28')](function(_0x4e3c06){_0x171471[_0xec2b('0x20')]=_0x4e3c06;if(_0x410ab2[_0xec2b('0x36')][_0xec2b('0x43')]){_0x2670a4[_0xec2b('0x44')]=[{'all':!![]}];}return db['SmsQueueReport'][_0xec2b('0x45')](_0x2670a4);})[_0xec2b('0x28')](function(_0x4b0e71){_0x171471[_0xec2b('0x46')]=_0x4b0e71;return _0x171471;})[_0xec2b('0x28')](respondWithFilteredResult(_0x8ce61e,_0x2670a4))['catch'](handleError(_0x8ce61e,null));};exports['show']=function(_0x5cbf24,_0x6ac055){var _0x1f2954={'raw':!![],'where':{'id':_0x5cbf24[_0xec2b('0x47')]['id']}},_0x289850={};_0x289850[_0xec2b('0x34')]=_['keys'](db[_0xec2b('0x30')][_0xec2b('0x31')]);_0x289850[_0xec2b('0x36')]=_[_0xec2b('0x35')](_0x5cbf24[_0xec2b('0x36')]);_0x289850[_0xec2b('0x37')]=_['intersection'](_0x289850[_0xec2b('0x34')],_0x289850[_0xec2b('0x36')]);_0x1f2954['attributes']=_[_0xec2b('0x48')](_0x289850[_0xec2b('0x34')],qs[_0xec2b('0x39')](_0x5cbf24[_0xec2b('0x36')][_0xec2b('0x39')]));_0x1f2954[_0xec2b('0x38')]=_0x1f2954[_0xec2b('0x38')][_0xec2b('0x49')]?_0x1f2954[_0xec2b('0x38')]:_0x289850[_0xec2b('0x34')];if(_0x5cbf24[_0xec2b('0x36')][_0xec2b('0x43')]){_0x1f2954[_0xec2b('0x44')]=[{'all':!![]}];}_0x1f2954=_[_0xec2b('0x3f')]({},_0x1f2954,_0x5cbf24[_0xec2b('0x42')]);return db['SmsQueueReport']['find'](_0x1f2954)['then'](handleEntityNotFound(_0x6ac055,null))[_0xec2b('0x28')](respondWithResult(_0x6ac055,null))['catch'](handleError(_0x6ac055,null));};exports[_0xec2b('0x4a')]=function(_0x3d820d,_0x230d95){return db['SmsQueueReport']['create'](_0x3d820d[_0xec2b('0x4b')],{})['then'](respondWithResult(_0x230d95,0xc9))[_0xec2b('0x4c')](handleError(_0x230d95,null));};exports['update']=function(_0x5c6f16,_0x321631){if(_0x5c6f16[_0xec2b('0x4b')]['id']){delete _0x5c6f16['body']['id'];}return db[_0xec2b('0x30')]['find']({'where':{'id':_0x5c6f16[_0xec2b('0x47')]['id']}})[_0xec2b('0x28')](handleEntityNotFound(_0x321631,null))[_0xec2b('0x28')](saveUpdates(_0x5c6f16[_0xec2b('0x4b')],null))[_0xec2b('0x28')](respondWithResult(_0x321631,null))[_0xec2b('0x4c')](handleError(_0x321631,null));};exports[_0xec2b('0x4d')]=function(_0x29d1ac,_0x6c074b){return db[_0xec2b('0x30')][_0xec2b('0x4e')]({'where':{'id':_0x29d1ac[_0xec2b('0x47')]['id']}})[_0xec2b('0x28')](handleEntityNotFound(_0x6c074b,null))[_0xec2b('0x28')](removeEntity(_0x6c074b,null))['catch'](handleError(_0x6c074b,null));};exports[_0xec2b('0x4f')]=function(_0x180167,_0x4fe810){return db[_0xec2b('0x30')][_0xec2b('0x4f')]()['then'](respondWithResult(_0x4fe810,null))[_0xec2b('0x4c')](handleError(_0x4fe810,null));}; \ No newline at end of file +var _0x5fdb=['save','update','then','destroy','stack','name','send','index','SmsQueueReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x530455,_0x41da2d){var _0x128a27=function(_0x3152af){while(--_0x3152af){_0x530455['push'](_0x530455['shift']());}};_0x128a27(++_0x41da2d);}(_0x5fdb,0xbe));var _0xb5fd=function(_0x2192cb,_0x4158b2){_0x2192cb=_0x2192cb-0x0;var _0x34de0e=_0x5fdb[_0x2192cb];return _0x34de0e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb5fd('0x0'));var zipdir=require(_0xb5fd('0x1'));var jsonpatch=require(_0xb5fd('0x2'));var rp=require(_0xb5fd('0x3'));var moment=require(_0xb5fd('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb5fd('0x5'));var util=require(_0xb5fd('0x6'));var path=require(_0xb5fd('0x7'));var sox=require(_0xb5fd('0x8'));var csv=require('to-csv');var ejs=require(_0xb5fd('0x9'));var fs=require('fs');var fs_extra=require(_0xb5fd('0xa'));var _=require(_0xb5fd('0xb'));var squel=require(_0xb5fd('0xc'));var crypto=require(_0xb5fd('0xd'));var jsforce=require(_0xb5fd('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb5fd('0xf'));var querystring=require('querystring');var Papa=require(_0xb5fd('0x10'));var Redis=require(_0xb5fd('0x11'));var authService=require(_0xb5fd('0x12'));var qs=require(_0xb5fd('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb5fd('0x14'));var logger=require('../../config/logger')(_0xb5fd('0x15'));var utils=require('../../config/utils');var config=require(_0xb5fd('0x16'));var licenseUtil=require(_0xb5fd('0x17'));var db=require(_0xb5fd('0x18'))['db'];function respondWithStatusCode(_0x207a12,_0x31ffb7){_0x31ffb7=_0x31ffb7||0xcc;return function(_0x423678){if(_0x423678){return _0x207a12[_0xb5fd('0x19')](_0x31ffb7);}return _0x207a12[_0xb5fd('0x1a')](_0x31ffb7)[_0xb5fd('0x1b')]();};}function respondWithResult(_0x33084d,_0x3d1c83){_0x3d1c83=_0x3d1c83||0xc8;return function(_0x156827){if(_0x156827){return _0x33084d[_0xb5fd('0x1a')](_0x3d1c83)[_0xb5fd('0x1c')](_0x156827);}};}function respondWithFilteredResult(_0x19f78c,_0x57d538){return function(_0x1c864b){if(_0x1c864b){var _0x14f82b=typeof _0x57d538[_0xb5fd('0x1d')]===_0xb5fd('0x1e')&&typeof _0x57d538[_0xb5fd('0x1f')]==='undefined';var _0x5dcb79=_0x1c864b[_0xb5fd('0x20')];var _0x24f287=_0x14f82b?0x0:_0x57d538['offset'];var _0x151874=_0x14f82b?_0x1c864b[_0xb5fd('0x20')]:_0x57d538['offset']+_0x57d538['limit'];var _0x25bca8;if(_0x151874>=_0x5dcb79){_0x151874=_0x5dcb79;_0x25bca8=0xc8;}else{_0x25bca8=0xce;}_0x19f78c[_0xb5fd('0x1a')](_0x25bca8);return _0x19f78c[_0xb5fd('0x21')](_0xb5fd('0x22'),_0x24f287+'-'+_0x151874+'/'+_0x5dcb79)[_0xb5fd('0x1c')](_0x1c864b);}return null;};}function patchUpdates(_0x47ce9c){return function(_0x5b2acb){try{jsonpatch['apply'](_0x5b2acb,_0x47ce9c,!![]);}catch(_0x1fb136){return BPromise['reject'](_0x1fb136);}return _0x5b2acb[_0xb5fd('0x23')]();};}function saveUpdates(_0x86f91f,_0x428b5c){return function(_0x79d0ec){if(_0x79d0ec){return _0x79d0ec[_0xb5fd('0x24')](_0x86f91f)[_0xb5fd('0x25')](function(_0x49a428){return _0x49a428;});}return null;};}function removeEntity(_0x5d47ab,_0x312130){return function(_0xec4d13){if(_0xec4d13){return _0xec4d13[_0xb5fd('0x26')]()['then'](function(){_0x5d47ab[_0xb5fd('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45cbe6,_0x535415){return function(_0x5d9a94){if(!_0x5d9a94){_0x45cbe6[_0xb5fd('0x19')](0x194);}return _0x5d9a94;};}function handleError(_0x56bde2,_0x155164){_0x155164=_0x155164||0x1f4;return function(_0x408e10){logger['error'](_0x408e10[_0xb5fd('0x27')]);if(_0x408e10[_0xb5fd('0x28')]){delete _0x408e10[_0xb5fd('0x28')];}_0x56bde2[_0xb5fd('0x1a')](_0x155164)[_0xb5fd('0x29')](_0x408e10);};}exports[_0xb5fd('0x2a')]=function(_0x460110,_0x35193d){var _0xb2fdd7={},_0x1a2e36={},_0x4c473b={'count':0x0,'rows':[]};var _0x2fb9ab=_['map'](db[_0xb5fd('0x2b')][_0xb5fd('0x2c')],function(_0x22b705){return{'name':_0x22b705[_0xb5fd('0x2d')],'type':_0x22b705[_0xb5fd('0x2e')][_0xb5fd('0x2f')]};});_0x1a2e36[_0xb5fd('0x30')]=_['map'](_0x2fb9ab,'name');_0x1a2e36[_0xb5fd('0x31')]=_['keys'](_0x460110[_0xb5fd('0x31')]);_0x1a2e36[_0xb5fd('0x32')]=_[_0xb5fd('0x33')](_0x1a2e36['model'],_0x1a2e36[_0xb5fd('0x31')]);_0xb2fdd7[_0xb5fd('0x34')]=_[_0xb5fd('0x33')](_0x1a2e36[_0xb5fd('0x30')],qs['fields'](_0x460110[_0xb5fd('0x31')][_0xb5fd('0x35')]));_0xb2fdd7[_0xb5fd('0x34')]=_0xb2fdd7['attributes'][_0xb5fd('0x36')]?_0xb2fdd7[_0xb5fd('0x34')]:_0x1a2e36[_0xb5fd('0x30')];if(!_0x460110[_0xb5fd('0x31')][_0xb5fd('0x37')](_0xb5fd('0x38'))){_0xb2fdd7[_0xb5fd('0x1f')]=qs[_0xb5fd('0x1f')](_0x460110[_0xb5fd('0x31')][_0xb5fd('0x1f')]);_0xb2fdd7[_0xb5fd('0x1d')]=qs[_0xb5fd('0x1d')](_0x460110['query']['offset']);}_0xb2fdd7[_0xb5fd('0x39')]=qs[_0xb5fd('0x3a')](_0x460110[_0xb5fd('0x31')][_0xb5fd('0x3a')]);_0xb2fdd7[_0xb5fd('0x3b')]=qs['filters'](_[_0xb5fd('0x3c')](_0x460110[_0xb5fd('0x31')],_0x1a2e36[_0xb5fd('0x32')]),_0x2fb9ab);if(_0x460110[_0xb5fd('0x31')]['filter']){_0xb2fdd7[_0xb5fd('0x3b')]=_[_0xb5fd('0x3d')](_0xb2fdd7['where'],{'$or':_['map'](_0x2fb9ab,function(_0x50654e){if(_0x50654e[_0xb5fd('0x2e')]!==_0xb5fd('0x3e')){var _0x145f3e={};_0x145f3e[_0x50654e[_0xb5fd('0x28')]]={'$like':'%'+_0x460110[_0xb5fd('0x31')]['filter']+'%'};return _0x145f3e;}})});}_0xb2fdd7=_[_0xb5fd('0x3d')]({},_0xb2fdd7,_0x460110[_0xb5fd('0x3f')]);var _0x76ddde={'where':_0xb2fdd7[_0xb5fd('0x3b')]};return db[_0xb5fd('0x2b')]['count'](_0x76ddde)[_0xb5fd('0x25')](function(_0x9db8fc){_0x4c473b[_0xb5fd('0x20')]=_0x9db8fc;if(_0x460110['query'][_0xb5fd('0x40')]){_0xb2fdd7[_0xb5fd('0x41')]=[{'all':!![]}];}return db['SmsQueueReport']['findAll'](_0xb2fdd7);})[_0xb5fd('0x25')](function(_0x2bb88b){_0x4c473b[_0xb5fd('0x42')]=_0x2bb88b;return _0x4c473b;})[_0xb5fd('0x25')](respondWithFilteredResult(_0x35193d,_0xb2fdd7))[_0xb5fd('0x43')](handleError(_0x35193d,null));};exports[_0xb5fd('0x44')]=function(_0x265ceb,_0x549f8b){var _0x2f5579={'raw':!![],'where':{'id':_0x265ceb[_0xb5fd('0x45')]['id']}},_0x35f511={};_0x35f511[_0xb5fd('0x30')]=_['keys'](db[_0xb5fd('0x2b')][_0xb5fd('0x2c')]);_0x35f511[_0xb5fd('0x31')]=_[_0xb5fd('0x46')](_0x265ceb['query']);_0x35f511['filters']=_[_0xb5fd('0x33')](_0x35f511[_0xb5fd('0x30')],_0x35f511[_0xb5fd('0x31')]);_0x2f5579[_0xb5fd('0x34')]=_['intersection'](_0x35f511[_0xb5fd('0x30')],qs['fields'](_0x265ceb[_0xb5fd('0x31')][_0xb5fd('0x35')]));_0x2f5579[_0xb5fd('0x34')]=_0x2f5579[_0xb5fd('0x34')]['length']?_0x2f5579[_0xb5fd('0x34')]:_0x35f511[_0xb5fd('0x30')];if(_0x265ceb[_0xb5fd('0x31')][_0xb5fd('0x40')]){_0x2f5579['include']=[{'all':!![]}];}_0x2f5579=_[_0xb5fd('0x3d')]({},_0x2f5579,_0x265ceb['options']);return db[_0xb5fd('0x2b')][_0xb5fd('0x47')](_0x2f5579)[_0xb5fd('0x25')](handleEntityNotFound(_0x549f8b,null))[_0xb5fd('0x25')](respondWithResult(_0x549f8b,null))[_0xb5fd('0x43')](handleError(_0x549f8b,null));};exports['create']=function(_0x372f4b,_0x3c8826){return db['SmsQueueReport'][_0xb5fd('0x48')](_0x372f4b[_0xb5fd('0x49')],{})[_0xb5fd('0x25')](respondWithResult(_0x3c8826,0xc9))[_0xb5fd('0x43')](handleError(_0x3c8826,null));};exports[_0xb5fd('0x24')]=function(_0x342388,_0x1acae6){if(_0x342388[_0xb5fd('0x49')]['id']){delete _0x342388[_0xb5fd('0x49')]['id'];}return db[_0xb5fd('0x2b')][_0xb5fd('0x47')]({'where':{'id':_0x342388[_0xb5fd('0x45')]['id']}})['then'](handleEntityNotFound(_0x1acae6,null))['then'](saveUpdates(_0x342388['body'],null))[_0xb5fd('0x25')](respondWithResult(_0x1acae6,null))[_0xb5fd('0x43')](handleError(_0x1acae6,null));};exports['destroy']=function(_0x353d68,_0x1206dc){return db[_0xb5fd('0x2b')][_0xb5fd('0x47')]({'where':{'id':_0x353d68[_0xb5fd('0x45')]['id']}})[_0xb5fd('0x25')](handleEntityNotFound(_0x1206dc,null))[_0xb5fd('0x25')](removeEntity(_0x1206dc,null))['catch'](handleError(_0x1206dc,null));};exports[_0xb5fd('0x4a')]=function(_0x49a124,_0x1a9054){return db[_0xb5fd('0x2b')]['describe']()['then'](respondWithResult(_0x1a9054,null))[_0xb5fd('0x43')](handleError(_0x1a9054,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 691b1c2..f34ce12 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 _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x36c6eb,_0x4fb127){var _0x30675b=function(_0x3a788b){while(--_0x3a788b){_0x36c6eb['push'](_0x36c6eb['shift']());}};_0x30675b(++_0x4fb127);}(_0xe706,0xa3));var _0x6e70=function(_0x504575,_0x1ad9e0){_0x504575=_0x504575-0x0;var _0x4484cc=_0xe706[_0x504575];return _0x4484cc;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['define','SmsQueueReport','report_sms_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x4ac8a8,_0x33b861){var _0xba97d2=function(_0x266a9a){while(--_0x266a9a){_0x4ac8a8['push'](_0x4ac8a8['shift']());}};_0xba97d2(++_0x33b861);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index c64013a..e6a99b8 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 _0xcc6d=['raw','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsQueueReport','create','body','options','UpdateSmsQueueReport','SmsQueueReport','update'];(function(_0x4feed0,_0x22d9bf){var _0xbfef50=function(_0x32a4e3){while(--_0x32a4e3){_0x4feed0['push'](_0x4feed0['shift']());}};_0xbfef50(++_0x22d9bf);}(_0xcc6d,0x156));var _0xdcc6=function(_0x21005c,_0x246350){_0x21005c=_0x21005c-0x0;var _0x269021=_0xcc6d[_0x21005c];return _0x269021;};'use strict';var _=require(_0xdcc6('0x0'));var util=require('util');var moment=require(_0xdcc6('0x1'));var BPromise=require('bluebird');var rs=require(_0xdcc6('0x2'));var fs=require('fs');var Redis=require(_0xdcc6('0x3'));var db=require(_0xdcc6('0x4'))['db'];var utils=require(_0xdcc6('0x5'));var logger=require(_0xdcc6('0x6'))('rpc');var config=require(_0xdcc6('0x7'));var jayson=require(_0xdcc6('0x8'));var client=jayson[_0xdcc6('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x281cea,_0x34f1c9,_0x31890f){return new BPromise(function(_0x512686,_0x4d36f9){return client[_0xdcc6('0xa')](_0x281cea,_0x31890f)[_0xdcc6('0xb')](function(_0x1699fd){logger[_0xdcc6('0xc')](_0xdcc6('0xd'),_0x34f1c9,_0xdcc6('0xe'));logger[_0xdcc6('0xf')](_0xdcc6('0x10'),_0x34f1c9,'request\x20sent',JSON[_0xdcc6('0x11')](_0x1699fd));if(_0x1699fd[_0xdcc6('0x12')]){if(_0x1699fd[_0xdcc6('0x12')][_0xdcc6('0x13')]===0x1f4){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x34f1c9,_0x1699fd[_0xdcc6('0x12')]['message']);return _0x4d36f9(_0x1699fd['error'][_0xdcc6('0x14')]);}logger[_0xdcc6('0x12')](_0xdcc6('0xd'),_0x34f1c9,_0x1699fd['error']['message']);return _0x512686(_0x1699fd[_0xdcc6('0x12')]['message']);}else{logger[_0xdcc6('0xc')]('SmsQueueReport,\x20%s,\x20%s',_0x34f1c9,'request\x20sent');_0x512686(_0x1699fd[_0xdcc6('0x15')][_0xdcc6('0x14')]);}})[_0xdcc6('0x16')](function(_0x60bce8){logger[_0xdcc6('0x12')]('SmsQueueReport,\x20%s,\x20%s',_0x34f1c9,_0x60bce8);_0x4d36f9(_0x60bce8);});});}exports[_0xdcc6('0x17')]=function(_0x38cef1){var _0x102dbe=this;return new Promise(function(_0x3b8e61,_0x577f63){return db['SmsQueueReport'][_0xdcc6('0x18')](_0x38cef1[_0xdcc6('0x19')],{'raw':_0x38cef1[_0xdcc6('0x1a')]?_0x38cef1['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5cd815){logger[_0xdcc6('0xc')](_0xdcc6('0x17'),_0x38cef1);logger[_0xdcc6('0xf')](_0xdcc6('0x17'),_0x38cef1,JSON[_0xdcc6('0x11')](_0x5cd815));_0x3b8e61(_0x5cd815);})[_0xdcc6('0x16')](function(_0x3f1d9e){logger['error']('CreateSmsQueueReport',_0x3f1d9e[_0xdcc6('0x14')],_0x38cef1);_0x577f63(_0x102dbe[_0xdcc6('0x12')](0x1f4,_0x3f1d9e[_0xdcc6('0x14')]));});});};exports[_0xdcc6('0x1b')]=function(_0x1af6db){var _0x20ec48=this;return new Promise(function(_0x1606e3,_0x473791){return db[_0xdcc6('0x1c')][_0xdcc6('0x1d')](_0x1af6db[_0xdcc6('0x19')],{'raw':_0x1af6db[_0xdcc6('0x1a')]?_0x1af6db[_0xdcc6('0x1a')][_0xdcc6('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1af6db[_0xdcc6('0x1a')]?_0x1af6db[_0xdcc6('0x1a')]['where']||null:null,'attributes':_0x1af6db[_0xdcc6('0x1a')]?_0x1af6db['options']['attributes']||null:null,'limit':_0x1af6db[_0xdcc6('0x1a')]?_0x1af6db[_0xdcc6('0x1a')]['limit']||null:null})[_0xdcc6('0xb')](function(_0x366c55){logger[_0xdcc6('0xc')](_0xdcc6('0x1b'),_0x1af6db);logger[_0xdcc6('0xf')](_0xdcc6('0x1b'),_0x1af6db,JSON[_0xdcc6('0x11')](_0x366c55));_0x1606e3(_0x366c55);})[_0xdcc6('0x16')](function(_0x5dd155){logger[_0xdcc6('0x12')](_0xdcc6('0x1b'),_0x5dd155['message'],_0x1af6db);_0x473791(_0x20ec48[_0xdcc6('0x12')](0x1f4,_0x5dd155['message']));});});}; \ No newline at end of file +var _0x479a=['UpdateSmsQueueReport','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','update','limit'];(function(_0x4c6f7e,_0xad2dfa){var _0x49ba40=function(_0x33645b){while(--_0x33645b){_0x4c6f7e['push'](_0x4c6f7e['shift']());}};_0x49ba40(++_0xad2dfa);}(_0x479a,0xbb));var _0xa479=function(_0x5d891e,_0x3e78c9){_0x5d891e=_0x5d891e-0x0;var _0x517e39=_0x479a[_0x5d891e];return _0x517e39;};'use strict';var _=require('lodash');var util=require(_0xa479('0x0'));var moment=require(_0xa479('0x1'));var BPromise=require(_0xa479('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa479('0x3'));var db=require(_0xa479('0x4'))['db'];var utils=require(_0xa479('0x5'));var logger=require(_0xa479('0x6'))(_0xa479('0x7'));var config=require('../../config/environment');var jayson=require(_0xa479('0x8'));var client=jayson[_0xa479('0x9')][_0xa479('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x61f3db,_0x333806,_0x359bec){return new BPromise(function(_0x38a9ed,_0x2f3c85){return client[_0xa479('0xb')](_0x61f3db,_0x359bec)[_0xa479('0xc')](function(_0x1525d4){logger[_0xa479('0xd')](_0xa479('0xe'),_0x333806,_0xa479('0xf'));logger[_0xa479('0x10')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x333806,'request\x20sent',JSON[_0xa479('0x11')](_0x1525d4));if(_0x1525d4[_0xa479('0x12')]){if(_0x1525d4[_0xa479('0x12')][_0xa479('0x13')]===0x1f4){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x333806,_0x1525d4[_0xa479('0x12')][_0xa479('0x14')]);return _0x2f3c85(_0x1525d4[_0xa479('0x12')][_0xa479('0x14')]);}logger['error'](_0xa479('0xe'),_0x333806,_0x1525d4[_0xa479('0x12')][_0xa479('0x14')]);return _0x38a9ed(_0x1525d4[_0xa479('0x12')][_0xa479('0x14')]);}else{logger[_0xa479('0xd')](_0xa479('0xe'),_0x333806,_0xa479('0xf'));_0x38a9ed(_0x1525d4[_0xa479('0x15')][_0xa479('0x14')]);}})[_0xa479('0x16')](function(_0x4302a0){logger[_0xa479('0x12')](_0xa479('0xe'),_0x333806,_0x4302a0);_0x2f3c85(_0x4302a0);});});}exports[_0xa479('0x17')]=function(_0x355693){var _0x3bb9f8=this;return new Promise(function(_0x220e72,_0x412895){return db[_0xa479('0x18')][_0xa479('0x19')](_0x355693[_0xa479('0x1a')],{'raw':_0x355693[_0xa479('0x1b')]?_0x355693[_0xa479('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xa479('0xc')](function(_0x394aa7){logger[_0xa479('0xd')](_0xa479('0x17'),_0x355693);logger[_0xa479('0x10')](_0xa479('0x17'),_0x355693,JSON[_0xa479('0x11')](_0x394aa7));_0x220e72(_0x394aa7);})[_0xa479('0x16')](function(_0x263b9c){logger['error']('CreateSmsQueueReport',_0x263b9c['message'],_0x355693);_0x412895(_0x3bb9f8[_0xa479('0x12')](0x1f4,_0x263b9c[_0xa479('0x14')]));});});};exports['UpdateSmsQueueReport']=function(_0x597c92){var _0x451dc0=this;return new Promise(function(_0x30e15c,_0x58a83b){return db[_0xa479('0x18')][_0xa479('0x1c')](_0x597c92[_0xa479('0x1a')],{'raw':_0x597c92['options']?_0x597c92[_0xa479('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x597c92[_0xa479('0x1b')]?_0x597c92['options']['where']||null:null,'attributes':_0x597c92[_0xa479('0x1b')]?_0x597c92['options']['attributes']||null:null,'limit':_0x597c92[_0xa479('0x1b')]?_0x597c92[_0xa479('0x1b')][_0xa479('0x1d')]||null:null})[_0xa479('0xc')](function(_0x11f1cf){logger[_0xa479('0xd')](_0xa479('0x1e'),_0x597c92);logger[_0xa479('0x10')](_0xa479('0x1e'),_0x597c92,JSON[_0xa479('0x11')](_0x11f1cf));_0x30e15c(_0x11f1cf);})['catch'](function(_0x42e671){logger[_0xa479('0x12')](_0xa479('0x1e'),_0x42e671['message'],_0x597c92);_0x58a83b(_0x451dc0[_0xa479('0x12')](0x1f4,_0x42e671[_0xa479('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index ccaa86b..5bbbc96 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 _0x89c3=['/:id','isAuthenticated','show','post','create','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','describe'];(function(_0xa49622,_0x2b9151){var _0x5b448a=function(_0x42e225){while(--_0x42e225){_0xa49622['push'](_0xa49622['shift']());}};_0x5b448a(++_0x2b9151);}(_0x89c3,0xff));var _0x389c=function(_0xc54b89,_0x5353fe){_0xc54b89=_0xc54b89-0x0;var _0x2c46ae=_0x89c3[_0xc54b89];return _0x2c46ae;};'use strict';var multer=require(_0x389c('0x0'));var util=require(_0x389c('0x1'));var path=require(_0x389c('0x2'));var timeout=require(_0x389c('0x3'));var express=require(_0x389c('0x4'));var router=express[_0x389c('0x5')]();var fs_extra=require(_0x389c('0x6'));var auth=require(_0x389c('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x389c('0x8'));var controller=require('./smsTransferReport.controller');router[_0x389c('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x389c('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x389c('0xa')]);router[_0x389c('0x9')](_0x389c('0xb'),auth[_0x389c('0xc')](),controller[_0x389c('0xd')]);router[_0x389c('0xe')]('/',auth[_0x389c('0xc')](),controller[_0x389c('0xf')]);router[_0x389c('0x10')]('/:id',auth[_0x389c('0xc')](),controller[_0x389c('0x11')]);router[_0x389c('0x12')](_0x389c('0xb'),auth[_0x389c('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5ad3=['isAuthenticated','index','describe','create','/:id','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get'];(function(_0x5af494,_0x2e29f0){var _0x4cceb4=function(_0x411f35){while(--_0x411f35){_0x5af494['push'](_0x5af494['shift']());}};_0x4cceb4(++_0x2e29f0);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x317bf0,_0x277c03){_0x317bf0=_0x317bf0-0x0;var _0x225932=_0x5ad3[_0x317bf0];return _0x225932;};'use strict';var multer=require(_0x35ad('0x0'));var util=require(_0x35ad('0x1'));var path=require(_0x35ad('0x2'));var timeout=require(_0x35ad('0x3'));var express=require('express');var router=express[_0x35ad('0x4')]();var fs_extra=require(_0x35ad('0x5'));var auth=require(_0x35ad('0x6'));var interaction=require(_0x35ad('0x7'));var config=require(_0x35ad('0x8'));var controller=require(_0x35ad('0x9'));router[_0x35ad('0xa')]('/',auth[_0x35ad('0xb')](),controller[_0x35ad('0xc')]);router[_0x35ad('0xa')]('/describe',auth[_0x35ad('0xb')](),controller[_0x35ad('0xd')]);router[_0x35ad('0xa')]('/:id',auth[_0x35ad('0xb')](),controller['show']);router['post']('/',auth[_0x35ad('0xb')](),controller[_0x35ad('0xe')]);router['put'](_0x35ad('0xf'),auth[_0x35ad('0xb')](),controller['update']);router['delete'](_0x35ad('0xf'),auth[_0x35ad('0xb')](),controller['destroy']);module[_0x35ad('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index f812567..c2f198e 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 _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x156096,_0x2a277e){var _0x33130a=function(_0x306eda){while(--_0x306eda){_0x156096['push'](_0x156096['shift']());}};_0x33130a(++_0x2a277e);}(_0xaa88,0x137));var _0x8aa8=function(_0x5b64a1,_0x2ec810){_0x5b64a1=_0x5b64a1-0x0;var _0x4b6f55=_0xaa88[_0x5b64a1];return _0x4b6f55;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file +var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x4be2d4,_0x16cc6d){var _0x4004e9=function(_0x19cfe0){while(--_0x19cfe0){_0x4be2d4['push'](_0x4be2d4['shift']());}};_0x4004e9(++_0x16cc6d);}(_0x00bb,0x1d8));var _0xb00b=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x00bb[_0x2b10c6];return _0x3789d2;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index dee944b..47751e2 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 _0xbe22=['destroy','error','stack','name','key','model','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','type','VIRTUAL','filter','options','includeAll','SmsTransferReport','findAll','catch','show','keys','rawAttributes','fields','length','include','find','create','body','params','describe','zip-dir','request-promise','moment','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','apply','reject','save','update','then'];(function(_0xb02563,_0x50de59){var _0x2dfc39=function(_0x84880b){while(--_0x84880b){_0xb02563['push'](_0xb02563['shift']());}};_0x2dfc39(++_0x50de59);}(_0xbe22,0x1c9));var _0x2be2=function(_0x1fb2a2,_0x5e233c){_0x1fb2a2=_0x1fb2a2-0x0;var _0x3e059d=_0xbe22[_0x1fb2a2];return _0x3e059d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2be2('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2be2('0x1'));var moment=require(_0x2be2('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x2be2('0x3'));var sox=require('sox');var csv=require(_0x2be2('0x4'));var ejs=require(_0x2be2('0x5'));var fs=require('fs');var fs_extra=require(_0x2be2('0x6'));var _=require('lodash');var squel=require(_0x2be2('0x7'));var crypto=require(_0x2be2('0x8'));var jsforce=require(_0x2be2('0x9'));var deskjs=require(_0x2be2('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2be2('0xb'));var qs=require(_0x2be2('0xc'));var as=require(_0x2be2('0xd'));var hardwareService=require(_0x2be2('0xe'));var logger=require(_0x2be2('0xf'))(_0x2be2('0x10'));var utils=require('../../config/utils');var config=require(_0x2be2('0x11'));var licenseUtil=require(_0x2be2('0x12'));var db=require(_0x2be2('0x13'))['db'];function respondWithStatusCode(_0x5ca07b,_0x57feee){_0x57feee=_0x57feee||0xcc;return function(_0x448019){if(_0x448019){return _0x5ca07b[_0x2be2('0x14')](_0x57feee);}return _0x5ca07b[_0x2be2('0x15')](_0x57feee)[_0x2be2('0x16')]();};}function respondWithResult(_0x1dda26,_0x36e65b){_0x36e65b=_0x36e65b||0xc8;return function(_0x3a9cb8){if(_0x3a9cb8){return _0x1dda26['status'](_0x36e65b)['json'](_0x3a9cb8);}};}function respondWithFilteredResult(_0x56b583,_0x5a8daa){return function(_0x4242c5){if(_0x4242c5){var _0x1b1d7f=typeof _0x5a8daa[_0x2be2('0x17')]===_0x2be2('0x18')&&typeof _0x5a8daa[_0x2be2('0x19')]===_0x2be2('0x18');var _0x49f49c=_0x4242c5['count'];var _0x4214bc=_0x1b1d7f?0x0:_0x5a8daa[_0x2be2('0x17')];var _0x5e5606=_0x1b1d7f?_0x4242c5[_0x2be2('0x1a')]:_0x5a8daa[_0x2be2('0x17')]+_0x5a8daa[_0x2be2('0x19')];var _0xe05da5;if(_0x5e5606>=_0x49f49c){_0x5e5606=_0x49f49c;_0xe05da5=0xc8;}else{_0xe05da5=0xce;}_0x56b583[_0x2be2('0x15')](_0xe05da5);return _0x56b583[_0x2be2('0x1b')]('Content-Range',_0x4214bc+'-'+_0x5e5606+'/'+_0x49f49c)['json'](_0x4242c5);}return null;};}function patchUpdates(_0xe5595b){return function(_0x1eaf4b){try{jsonpatch[_0x2be2('0x1c')](_0x1eaf4b,_0xe5595b,!![]);}catch(_0x4fae13){return BPromise[_0x2be2('0x1d')](_0x4fae13);}return _0x1eaf4b[_0x2be2('0x1e')]();};}function saveUpdates(_0x4756d6,_0x27a172){return function(_0x538e11){if(_0x538e11){return _0x538e11[_0x2be2('0x1f')](_0x4756d6)[_0x2be2('0x20')](function(_0x19d91a){return _0x19d91a;});}return null;};}function removeEntity(_0x3a9fb6,_0x16f936){return function(_0x23b4f5){if(_0x23b4f5){return _0x23b4f5[_0x2be2('0x21')]()[_0x2be2('0x20')](function(){_0x3a9fb6[_0x2be2('0x15')](0xcc)[_0x2be2('0x16')]();});}};}function handleEntityNotFound(_0x4260f4,_0xdafecb){return function(_0x5a57e3){if(!_0x5a57e3){_0x4260f4[_0x2be2('0x14')](0x194);}return _0x5a57e3;};}function handleError(_0x28cf35,_0x3622ca){_0x3622ca=_0x3622ca||0x1f4;return function(_0x3429e6){logger[_0x2be2('0x22')](_0x3429e6[_0x2be2('0x23')]);if(_0x3429e6['name']){delete _0x3429e6[_0x2be2('0x24')];}_0x28cf35['status'](_0x3622ca)['send'](_0x3429e6);};}exports['index']=function(_0x3d3c98,_0x33af67){var _0x44a704={},_0x22c6e0={},_0x5756ff={'count':0x0,'rows':[]};var _0x41e5a5=_['map'](db['SmsTransferReport']['rawAttributes'],function(_0x5291a8){return{'name':_0x5291a8['fieldName'],'type':_0x5291a8['type'][_0x2be2('0x25')]};});_0x22c6e0[_0x2be2('0x26')]=_['map'](_0x41e5a5,_0x2be2('0x24'));_0x22c6e0[_0x2be2('0x27')]=_['keys'](_0x3d3c98['query']);_0x22c6e0[_0x2be2('0x28')]=_[_0x2be2('0x29')](_0x22c6e0[_0x2be2('0x26')],_0x22c6e0[_0x2be2('0x27')]);_0x44a704[_0x2be2('0x2a')]=_[_0x2be2('0x29')](_0x22c6e0['model'],qs['fields'](_0x3d3c98[_0x2be2('0x27')]['fields']));_0x44a704['attributes']=_0x44a704['attributes']['length']?_0x44a704[_0x2be2('0x2a')]:_0x22c6e0[_0x2be2('0x26')];if(!_0x3d3c98['query'][_0x2be2('0x2b')](_0x2be2('0x2c'))){_0x44a704[_0x2be2('0x19')]=qs[_0x2be2('0x19')](_0x3d3c98['query'][_0x2be2('0x19')]);_0x44a704[_0x2be2('0x17')]=qs[_0x2be2('0x17')](_0x3d3c98[_0x2be2('0x27')]['offset']);}_0x44a704[_0x2be2('0x2d')]=qs[_0x2be2('0x2e')](_0x3d3c98[_0x2be2('0x27')][_0x2be2('0x2e')]);_0x44a704[_0x2be2('0x2f')]=qs[_0x2be2('0x28')](_[_0x2be2('0x30')](_0x3d3c98[_0x2be2('0x27')],_0x22c6e0['filters']),_0x41e5a5);if(_0x3d3c98[_0x2be2('0x27')]['filter']){_0x44a704[_0x2be2('0x2f')]=_[_0x2be2('0x31')](_0x44a704[_0x2be2('0x2f')],{'$or':_[_0x2be2('0x32')](_0x41e5a5,function(_0x33f9b8){if(_0x33f9b8[_0x2be2('0x33')]!==_0x2be2('0x34')){var _0x33b483={};_0x33b483[_0x33f9b8[_0x2be2('0x24')]]={'$like':'%'+_0x3d3c98[_0x2be2('0x27')][_0x2be2('0x35')]+'%'};return _0x33b483;}})});}_0x44a704=_[_0x2be2('0x31')]({},_0x44a704,_0x3d3c98[_0x2be2('0x36')]);var _0x5d9914={'where':_0x44a704[_0x2be2('0x2f')]};return db['SmsTransferReport'][_0x2be2('0x1a')](_0x5d9914)['then'](function(_0x1a111b){_0x5756ff['count']=_0x1a111b;if(_0x3d3c98[_0x2be2('0x27')][_0x2be2('0x37')]){_0x44a704['include']=[{'all':!![]}];}return db[_0x2be2('0x38')][_0x2be2('0x39')](_0x44a704);})[_0x2be2('0x20')](function(_0x1e87a0){_0x5756ff['rows']=_0x1e87a0;return _0x5756ff;})[_0x2be2('0x20')](respondWithFilteredResult(_0x33af67,_0x44a704))[_0x2be2('0x3a')](handleError(_0x33af67,null));};exports[_0x2be2('0x3b')]=function(_0x2360d7,_0x41ce7d){var _0x3afa5a={'raw':!![],'where':{'id':_0x2360d7['params']['id']}},_0x2f61d4={};_0x2f61d4[_0x2be2('0x26')]=_[_0x2be2('0x3c')](db[_0x2be2('0x38')][_0x2be2('0x3d')]);_0x2f61d4['query']=_['keys'](_0x2360d7['query']);_0x2f61d4[_0x2be2('0x28')]=_[_0x2be2('0x29')](_0x2f61d4[_0x2be2('0x26')],_0x2f61d4[_0x2be2('0x27')]);_0x3afa5a['attributes']=_[_0x2be2('0x29')](_0x2f61d4['model'],qs[_0x2be2('0x3e')](_0x2360d7[_0x2be2('0x27')][_0x2be2('0x3e')]));_0x3afa5a[_0x2be2('0x2a')]=_0x3afa5a[_0x2be2('0x2a')][_0x2be2('0x3f')]?_0x3afa5a[_0x2be2('0x2a')]:_0x2f61d4['model'];if(_0x2360d7['query'][_0x2be2('0x37')]){_0x3afa5a[_0x2be2('0x40')]=[{'all':!![]}];}_0x3afa5a=_['merge']({},_0x3afa5a,_0x2360d7['options']);return db[_0x2be2('0x38')][_0x2be2('0x41')](_0x3afa5a)[_0x2be2('0x20')](handleEntityNotFound(_0x41ce7d,null))['then'](respondWithResult(_0x41ce7d,null))['catch'](handleError(_0x41ce7d,null));};exports[_0x2be2('0x42')]=function(_0x497d90,_0x4eb9cf){return db[_0x2be2('0x38')]['create'](_0x497d90[_0x2be2('0x43')],{})['then'](respondWithResult(_0x4eb9cf,0xc9))[_0x2be2('0x3a')](handleError(_0x4eb9cf,null));};exports[_0x2be2('0x1f')]=function(_0x5789d2,_0x528244){if(_0x5789d2['body']['id']){delete _0x5789d2[_0x2be2('0x43')]['id'];}return db[_0x2be2('0x38')]['find']({'where':{'id':_0x5789d2[_0x2be2('0x44')]['id']}})[_0x2be2('0x20')](handleEntityNotFound(_0x528244,null))[_0x2be2('0x20')](saveUpdates(_0x5789d2[_0x2be2('0x43')],null))[_0x2be2('0x20')](respondWithResult(_0x528244,null))[_0x2be2('0x3a')](handleError(_0x528244,null));};exports[_0x2be2('0x21')]=function(_0x2d7e4a,_0x982be){return db[_0x2be2('0x38')][_0x2be2('0x41')]({'where':{'id':_0x2d7e4a[_0x2be2('0x44')]['id']}})[_0x2be2('0x20')](handleEntityNotFound(_0x982be,null))[_0x2be2('0x20')](removeEntity(_0x982be,null))['catch'](handleError(_0x982be,null));};exports[_0x2be2('0x45')]=function(_0x3d3fff,_0x245c3c){return db[_0x2be2('0x38')][_0x2be2('0x45')]()[_0x2be2('0x20')](respondWithResult(_0x245c3c,null))[_0x2be2('0x3a')](handleError(_0x245c3c,null));}; \ No newline at end of file +var _0x5596=['fast-json-patch','request-promise','util','path','sox','to-csv','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','end','stack','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','destroy','describe','rimraf'];(function(_0x494545,_0x18ab5b){var _0x346786=function(_0x211120){while(--_0x211120){_0x494545['push'](_0x494545['shift']());}};_0x346786(++_0x18ab5b);}(_0x5596,0x176));var _0x6559=function(_0x5dfe15,_0x134f26){_0x5dfe15=_0x5dfe15-0x0;var _0x473ccd=_0x5596[_0x5dfe15];return _0x473ccd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6559('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6559('0x1'));var rp=require(_0x6559('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6559('0x3'));var path=require(_0x6559('0x4'));var sox=require(_0x6559('0x5'));var csv=require(_0x6559('0x6'));var ejs=require(_0x6559('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x6559('0x8'));var jsforce=require(_0x6559('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x6559('0x6'));var querystring=require(_0x6559('0xa'));var Papa=require(_0x6559('0xb'));var Redis=require(_0x6559('0xc'));var authService=require(_0x6559('0xd'));var qs=require(_0x6559('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6559('0xf'));var logger=require(_0x6559('0x10'))(_0x6559('0x11'));var utils=require(_0x6559('0x12'));var config=require(_0x6559('0x13'));var licenseUtil=require(_0x6559('0x14'));var db=require(_0x6559('0x15'))['db'];function respondWithStatusCode(_0x2ba74b,_0x13a980){_0x13a980=_0x13a980||0xcc;return function(_0xfa6450){if(_0xfa6450){return _0x2ba74b[_0x6559('0x16')](_0x13a980);}return _0x2ba74b[_0x6559('0x17')](_0x13a980)['end']();};}function respondWithResult(_0x4731b0,_0x458811){_0x458811=_0x458811||0xc8;return function(_0x1d5ec6){if(_0x1d5ec6){return _0x4731b0[_0x6559('0x17')](_0x458811)[_0x6559('0x18')](_0x1d5ec6);}};}function respondWithFilteredResult(_0x28cd03,_0x12fb21){return function(_0x2557f8){if(_0x2557f8){var _0xc12bcb=typeof _0x12fb21[_0x6559('0x19')]===_0x6559('0x1a')&&typeof _0x12fb21[_0x6559('0x1b')]==='undefined';var _0x32a69e=_0x2557f8[_0x6559('0x1c')];var _0x525ae6=_0xc12bcb?0x0:_0x12fb21[_0x6559('0x19')];var _0x9d3135=_0xc12bcb?_0x2557f8[_0x6559('0x1c')]:_0x12fb21[_0x6559('0x19')]+_0x12fb21[_0x6559('0x1b')];var _0x4f7e1e;if(_0x9d3135>=_0x32a69e){_0x9d3135=_0x32a69e;_0x4f7e1e=0xc8;}else{_0x4f7e1e=0xce;}_0x28cd03['status'](_0x4f7e1e);return _0x28cd03[_0x6559('0x1d')](_0x6559('0x1e'),_0x525ae6+'-'+_0x9d3135+'/'+_0x32a69e)[_0x6559('0x18')](_0x2557f8);}return null;};}function patchUpdates(_0x34d316){return function(_0x3b33b0){try{jsonpatch[_0x6559('0x1f')](_0x3b33b0,_0x34d316,!![]);}catch(_0x20bc51){return BPromise[_0x6559('0x20')](_0x20bc51);}return _0x3b33b0[_0x6559('0x21')]();};}function saveUpdates(_0x4d349b,_0x430754){return function(_0x2e93aa){if(_0x2e93aa){return _0x2e93aa['update'](_0x4d349b)[_0x6559('0x22')](function(_0x4528ac){return _0x4528ac;});}return null;};}function removeEntity(_0x19a7f3,_0x5ce731){return function(_0x2296a1){if(_0x2296a1){return _0x2296a1['destroy']()['then'](function(){_0x19a7f3['status'](0xcc)[_0x6559('0x23')]();});}};}function handleEntityNotFound(_0x5eae32,_0x10950d){return function(_0x46debd){if(!_0x46debd){_0x5eae32[_0x6559('0x16')](0x194);}return _0x46debd;};}function handleError(_0x441ef5,_0x3e4a2f){_0x3e4a2f=_0x3e4a2f||0x1f4;return function(_0x4b5178){logger['error'](_0x4b5178[_0x6559('0x24')]);if(_0x4b5178[_0x6559('0x25')]){delete _0x4b5178[_0x6559('0x25')];}_0x441ef5[_0x6559('0x17')](_0x3e4a2f)[_0x6559('0x26')](_0x4b5178);};}exports[_0x6559('0x27')]=function(_0x4c18ce,_0xbf9ed9){var _0xb47420={},_0x23a91f={},_0x583c9d={'count':0x0,'rows':[]};var _0x5b1ffe=_[_0x6559('0x28')](db[_0x6559('0x29')][_0x6559('0x2a')],function(_0x8cc98e){return{'name':_0x8cc98e[_0x6559('0x2b')],'type':_0x8cc98e[_0x6559('0x2c')][_0x6559('0x2d')]};});_0x23a91f[_0x6559('0x2e')]=_[_0x6559('0x28')](_0x5b1ffe,'name');_0x23a91f[_0x6559('0x2f')]=_[_0x6559('0x30')](_0x4c18ce['query']);_0x23a91f[_0x6559('0x31')]=_[_0x6559('0x32')](_0x23a91f[_0x6559('0x2e')],_0x23a91f[_0x6559('0x2f')]);_0xb47420[_0x6559('0x33')]=_[_0x6559('0x32')](_0x23a91f[_0x6559('0x2e')],qs['fields'](_0x4c18ce[_0x6559('0x2f')][_0x6559('0x34')]));_0xb47420[_0x6559('0x33')]=_0xb47420[_0x6559('0x33')][_0x6559('0x35')]?_0xb47420['attributes']:_0x23a91f[_0x6559('0x2e')];if(!_0x4c18ce[_0x6559('0x2f')][_0x6559('0x36')](_0x6559('0x37'))){_0xb47420[_0x6559('0x1b')]=qs[_0x6559('0x1b')](_0x4c18ce[_0x6559('0x2f')][_0x6559('0x1b')]);_0xb47420[_0x6559('0x19')]=qs[_0x6559('0x19')](_0x4c18ce['query'][_0x6559('0x19')]);}_0xb47420['order']=qs[_0x6559('0x38')](_0x4c18ce[_0x6559('0x2f')][_0x6559('0x38')]);_0xb47420[_0x6559('0x39')]=qs['filters'](_[_0x6559('0x3a')](_0x4c18ce[_0x6559('0x2f')],_0x23a91f['filters']),_0x5b1ffe);if(_0x4c18ce['query'][_0x6559('0x3b')]){_0xb47420[_0x6559('0x39')]=_['merge'](_0xb47420[_0x6559('0x39')],{'$or':_[_0x6559('0x28')](_0x5b1ffe,function(_0x291cf2){if(_0x291cf2[_0x6559('0x2c')]!==_0x6559('0x3c')){var _0x33eb61={};_0x33eb61[_0x291cf2[_0x6559('0x25')]]={'$like':'%'+_0x4c18ce[_0x6559('0x2f')][_0x6559('0x3b')]+'%'};return _0x33eb61;}})});}_0xb47420=_[_0x6559('0x3d')]({},_0xb47420,_0x4c18ce['options']);var _0x249fa1={'where':_0xb47420['where']};return db[_0x6559('0x29')]['count'](_0x249fa1)[_0x6559('0x22')](function(_0x44a3e1){_0x583c9d['count']=_0x44a3e1;if(_0x4c18ce[_0x6559('0x2f')]['includeAll']){_0xb47420[_0x6559('0x3e')]=[{'all':!![]}];}return db[_0x6559('0x29')][_0x6559('0x3f')](_0xb47420);})[_0x6559('0x22')](function(_0x7011a){_0x583c9d[_0x6559('0x40')]=_0x7011a;return _0x583c9d;})['then'](respondWithFilteredResult(_0xbf9ed9,_0xb47420))[_0x6559('0x41')](handleError(_0xbf9ed9,null));};exports[_0x6559('0x42')]=function(_0x2aee6f,_0x159441){var _0x5555ac={'raw':!![],'where':{'id':_0x2aee6f[_0x6559('0x43')]['id']}},_0x5a55a3={};_0x5a55a3[_0x6559('0x2e')]=_[_0x6559('0x30')](db[_0x6559('0x29')][_0x6559('0x2a')]);_0x5a55a3['query']=_[_0x6559('0x30')](_0x2aee6f[_0x6559('0x2f')]);_0x5a55a3[_0x6559('0x31')]=_[_0x6559('0x32')](_0x5a55a3[_0x6559('0x2e')],_0x5a55a3[_0x6559('0x2f')]);_0x5555ac['attributes']=_[_0x6559('0x32')](_0x5a55a3[_0x6559('0x2e')],qs['fields'](_0x2aee6f[_0x6559('0x2f')][_0x6559('0x34')]));_0x5555ac['attributes']=_0x5555ac[_0x6559('0x33')][_0x6559('0x35')]?_0x5555ac[_0x6559('0x33')]:_0x5a55a3[_0x6559('0x2e')];if(_0x2aee6f['query'][_0x6559('0x44')]){_0x5555ac[_0x6559('0x3e')]=[{'all':!![]}];}_0x5555ac=_[_0x6559('0x3d')]({},_0x5555ac,_0x2aee6f[_0x6559('0x45')]);return db[_0x6559('0x29')][_0x6559('0x46')](_0x5555ac)[_0x6559('0x22')](handleEntityNotFound(_0x159441,null))['then'](respondWithResult(_0x159441,null))['catch'](handleError(_0x159441,null));};exports[_0x6559('0x47')]=function(_0x5843fd,_0x3bf5cd){return db['SmsTransferReport'][_0x6559('0x47')](_0x5843fd[_0x6559('0x48')],{})[_0x6559('0x22')](respondWithResult(_0x3bf5cd,0xc9))[_0x6559('0x41')](handleError(_0x3bf5cd,null));};exports['update']=function(_0x3af4b5,_0x158e52){if(_0x3af4b5[_0x6559('0x48')]['id']){delete _0x3af4b5[_0x6559('0x48')]['id'];}return db['SmsTransferReport']['find']({'where':{'id':_0x3af4b5[_0x6559('0x43')]['id']}})[_0x6559('0x22')](handleEntityNotFound(_0x158e52,null))['then'](saveUpdates(_0x3af4b5[_0x6559('0x48')],null))[_0x6559('0x22')](respondWithResult(_0x158e52,null))[_0x6559('0x41')](handleError(_0x158e52,null));};exports[_0x6559('0x49')]=function(_0x573329,_0x18fd0a){return db[_0x6559('0x29')][_0x6559('0x46')]({'where':{'id':_0x573329[_0x6559('0x43')]['id']}})['then'](handleEntityNotFound(_0x18fd0a,null))[_0x6559('0x22')](removeEntity(_0x18fd0a,null))['catch'](handleError(_0x18fd0a,null));};exports['describe']=function(_0x115341,_0x1623f9){return db['SmsTransferReport'][_0x6559('0x4a')]()['then'](respondWithResult(_0x1623f9,null))[_0x6559('0x41')](handleError(_0x1623f9,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index a6cb3de..4fd12b9 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 _0x14f6=['moment','bluebird','rimraf','../../config/environment','./smsTransferReport.attributes','define','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0xc51901,_0x2029c0){var _0x98ac46=function(_0x5f3238){while(--_0x5f3238){_0xc51901['push'](_0xc51901['shift']());}};_0x98ac46(++_0x2029c0);}(_0x14f6,0x170));var _0x614f=function(_0x585ff3,_0x5e4ab6){_0x585ff3=_0x585ff3-0x0;var _0x4bf883=_0x14f6[_0x585ff3];return _0x4bf883;};'use strict';var _=require(_0x614f('0x0'));var util=require(_0x614f('0x1'));var logger=require(_0x614f('0x2'))(_0x614f('0x3'));var moment=require(_0x614f('0x4'));var BPromise=require(_0x614f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x614f('0x6'));var config=require(_0x614f('0x7'));var attributes=require(_0x614f('0x8'));module['exports']=function(_0x48bbf6,_0x1e5a4f){return _0x48bbf6[_0x614f('0x9')]('SmsTransferReport',attributes,{'tableName':_0x614f('0xa'),'paranoid':![],'indexes':[{'name':_0x614f('0xb'),'fields':[_0x614f('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7d9f=['api','moment','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','define','report_sms_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x179f71,_0x2291f4){var _0x57c5c3=function(_0x3440ee){while(--_0x3440ee){_0x179f71['push'](_0x179f71['shift']());}};_0x57c5c3(++_0x2291f4);}(_0x7d9f,0x15c));var _0xf7d9=function(_0x36633f,_0x26e83d){_0x36633f=_0x36633f-0x0;var _0x480eb0=_0x7d9f[_0x36633f];return _0x480eb0;};'use strict';var _=require(_0xf7d9('0x0'));var util=require(_0xf7d9('0x1'));var logger=require(_0xf7d9('0x2'))(_0xf7d9('0x3'));var moment=require(_0xf7d9('0x4'));var BPromise=require('bluebird');var rp=require(_0xf7d9('0x5'));var fs=require('fs');var path=require(_0xf7d9('0x6'));var rimraf=require(_0xf7d9('0x7'));var config=require(_0xf7d9('0x8'));var attributes=require(_0xf7d9('0x9'));module['exports']=function(_0x4b50c7,_0x2eb0f1){return _0x4b50c7[_0xf7d9('0xa')]('SmsTransferReport',attributes,{'tableName':_0xf7d9('0xb'),'paranoid':![],'indexes':[{'name':_0xf7d9('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index e248b9b..805eef4 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 _0x9330=['then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x57027e,_0x2bec06){var _0x4e59fc=function(_0x3cfd90){while(--_0x3cfd90){_0x57027e['push'](_0x57027e['shift']());}};_0x4e59fc(++_0x2bec06);}(_0x9330,0x14a));var _0x0933=function(_0x3112ba,_0x5356a8){_0x3112ba=_0x3112ba-0x0;var _0x3e5ab8=_0x9330[_0x3112ba];return _0x3e5ab8;};'use strict';var _=require(_0x0933('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0933('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0933('0x2'))['db'];var utils=require(_0x0933('0x3'));var logger=require(_0x0933('0x4'))(_0x0933('0x5'));var config=require(_0x0933('0x6'));var jayson=require(_0x0933('0x7'));var client=jayson[_0x0933('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2fb304,_0x458577,_0x116554){return new BPromise(function(_0x1bd4b2,_0x13616e){return client[_0x0933('0x9')](_0x2fb304,_0x116554)[_0x0933('0xa')](function(_0x3d79c9){logger[_0x0933('0xb')](_0x0933('0xc'),_0x458577,_0x0933('0xd'));logger[_0x0933('0xe')](_0x0933('0xf'),_0x458577,_0x0933('0xd'),JSON['stringify'](_0x3d79c9));if(_0x3d79c9['error']){if(_0x3d79c9['error']['code']===0x1f4){logger[_0x0933('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x458577,_0x3d79c9['error']['message']);return _0x13616e(_0x3d79c9[_0x0933('0x10')][_0x0933('0x11')]);}logger['error'](_0x0933('0xc'),_0x458577,_0x3d79c9[_0x0933('0x10')]['message']);return _0x1bd4b2(_0x3d79c9['error'][_0x0933('0x11')]);}else{logger[_0x0933('0xb')]('SmsTransferReport,\x20%s,\x20%s',_0x458577,_0x0933('0xd'));_0x1bd4b2(_0x3d79c9[_0x0933('0x12')][_0x0933('0x11')]);}})[_0x0933('0x13')](function(_0x377140){logger[_0x0933('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x458577,_0x377140);_0x13616e(_0x377140);});});} \ No newline at end of file +var _0xe914=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x25b60a,_0x4864e2){var _0x433bca=function(_0x4035a2){while(--_0x4035a2){_0x25b60a['push'](_0x25b60a['shift']());}};_0x433bca(++_0x4864e2);}(_0xe914,0x7f));var _0x4e91=function(_0x48d99d,_0x1e297b){_0x48d99d=_0x48d99d-0x0;var _0x18b0a6=_0xe914[_0x48d99d];return _0x18b0a6;};'use strict';var _=require(_0x4e91('0x0'));var util=require(_0x4e91('0x1'));var moment=require('moment');var BPromise=require(_0x4e91('0x2'));var rs=require(_0x4e91('0x3'));var fs=require('fs');var Redis=require(_0x4e91('0x4'));var db=require(_0x4e91('0x5'))['db'];var utils=require(_0x4e91('0x6'));var logger=require(_0x4e91('0x7'))('rpc');var config=require(_0x4e91('0x8'));var jayson=require(_0x4e91('0x9'));var client=jayson['client'][_0x4e91('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d4bd6,_0x3f09cb,_0x2f2098){return new BPromise(function(_0x532b72,_0x49174e){return client[_0x4e91('0xb')](_0x1d4bd6,_0x2f2098)['then'](function(_0x523dec){logger[_0x4e91('0xc')](_0x4e91('0xd'),_0x3f09cb,_0x4e91('0xe'));logger[_0x4e91('0xf')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x3f09cb,_0x4e91('0xe'),JSON[_0x4e91('0x10')](_0x523dec));if(_0x523dec[_0x4e91('0x11')]){if(_0x523dec['error'][_0x4e91('0x12')]===0x1f4){logger[_0x4e91('0x11')](_0x4e91('0xd'),_0x3f09cb,_0x523dec[_0x4e91('0x11')][_0x4e91('0x13')]);return _0x49174e(_0x523dec[_0x4e91('0x11')][_0x4e91('0x13')]);}logger[_0x4e91('0x11')](_0x4e91('0xd'),_0x3f09cb,_0x523dec['error'][_0x4e91('0x13')]);return _0x532b72(_0x523dec[_0x4e91('0x11')][_0x4e91('0x13')]);}else{logger['info'](_0x4e91('0xd'),_0x3f09cb,_0x4e91('0xe'));_0x532b72(_0x523dec[_0x4e91('0x14')][_0x4e91('0x13')]);}})[_0x4e91('0x15')](function(_0x34f91f){logger[_0x4e91('0x11')](_0x4e91('0xd'),_0x3f09cb,_0x34f91f);_0x49174e(_0x34f91f);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index aa07c4c..d4fa453 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 _0xc66f=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','index','/:id','isAuthenticated','show','/:id/download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','extname','now','post','single','file','create','put','update','delete','exports'];(function(_0x45f6a0,_0x4964f3){var _0x42deec=function(_0x4479ad){while(--_0x4479ad){_0x45f6a0['push'](_0x45f6a0['shift']());}};_0x42deec(++_0x4964f3);}(_0xc66f,0x1dc));var _0xfc66=function(_0x2a5cd3,_0x29f9ae){_0x2a5cd3=_0x2a5cd3-0x0;var _0x5044a1=_0xc66f[_0x2a5cd3];return _0x5044a1;};'use strict';var multer=require(_0xfc66('0x0'));var util=require(_0xfc66('0x1'));var path=require('path');var timeout=require(_0xfc66('0x2'));var express=require(_0xfc66('0x3'));var router=express[_0xfc66('0x4')]();var fs_extra=require(_0xfc66('0x5'));var auth=require(_0xfc66('0x6'));var interaction=require(_0xfc66('0x7'));var config=require(_0xfc66('0x8'));var controller=require(_0xfc66('0x9'));router[_0xfc66('0xa')]('/',auth['isAuthenticated'](),controller[_0xfc66('0xb')]);router[_0xfc66('0xa')](_0xfc66('0xc'),auth[_0xfc66('0xd')](),controller[_0xfc66('0xe')]);router[_0xfc66('0xa')](_0xfc66('0xf'),auth[_0xfc66('0xd')](),controller['download']);var upload=multer({'storage':multer[_0xfc66('0x10')]({'destination':function(_0x79025e,_0xa948bf,_0x5202af){_0x5202af(null,path[_0xfc66('0x11')](config[_0xfc66('0x12')],_0xfc66('0x13')));},'filename':function(_0x53242e,_0x545896,_0x1b4356){_0x545896['originalname']=_0x545896[_0xfc66('0x14')][_0xfc66('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1b4356(null,util[_0xfc66('0x16')](_0xfc66('0x17'),path['basename'](_0x545896[_0xfc66('0x14')],path[_0xfc66('0x18')](_0x545896[_0xfc66('0x14')])),Date[_0xfc66('0x19')](),path[_0xfc66('0x18')](_0x545896[_0xfc66('0x14')])));}})});router[_0xfc66('0x1a')]('/',upload[_0xfc66('0x1b')](_0xfc66('0x1c')),controller[_0xfc66('0x1d')]);router[_0xfc66('0x1e')](_0xfc66('0xc'),auth[_0xfc66('0xd')](),controller[_0xfc66('0x1f')]);router['delete']('/:id',auth[_0xfc66('0xd')](),controller[_0xfc66('0x20')]);module[_0xfc66('0x21')]=router; \ No newline at end of file +var _0x11b2=['fs-extra','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','basename','extname','now','post','single','file','create','update','exports','multer','util','path','connect-timeout','Router'];(function(_0x28779a,_0x2a5033){var _0x1e465c=function(_0x5c6684){while(--_0x5c6684){_0x28779a['push'](_0x28779a['shift']());}};_0x1e465c(++_0x2a5033);}(_0x11b2,0x8c));var _0x211b=function(_0x3b54e3,_0x4ec3d5){_0x3b54e3=_0x3b54e3-0x0;var _0x5d87ed=_0x11b2[_0x3b54e3];return _0x5d87ed;};'use strict';var multer=require(_0x211b('0x0'));var util=require(_0x211b('0x1'));var path=require(_0x211b('0x2'));var timeout=require(_0x211b('0x3'));var express=require('express');var router=express[_0x211b('0x4')]();var fs_extra=require(_0x211b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x211b('0x6'));var config=require(_0x211b('0x7'));var controller=require(_0x211b('0x8'));router[_0x211b('0x9')]('/',auth[_0x211b('0xa')](),controller[_0x211b('0xb')]);router[_0x211b('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x211b('0x9')](_0x211b('0xc'),auth['isAuthenticated'](),controller[_0x211b('0xd')]);var upload=multer({'storage':multer[_0x211b('0xe')]({'destination':function(_0x2ff251,_0x24f62a,_0x30b844){_0x30b844(null,path[_0x211b('0xf')](config[_0x211b('0x10')],_0x211b('0x11')));},'filename':function(_0x1b69a1,_0x2df6ca,_0xe012fd){_0x2df6ca[_0x211b('0x12')]=_0x2df6ca[_0x211b('0x12')][_0x211b('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xe012fd(null,util['format']('%s-%s%s',path[_0x211b('0x14')](_0x2df6ca[_0x211b('0x12')],path[_0x211b('0x15')](_0x2df6ca['originalname'])),Date[_0x211b('0x16')](),path[_0x211b('0x15')](_0x2df6ca['originalname'])));}})});router[_0x211b('0x17')]('/',upload[_0x211b('0x18')](_0x211b('0x19')),controller[_0x211b('0x1a')]);router['put']('/:id',auth[_0x211b('0xa')](),controller[_0x211b('0x1b')]);router['delete']('/:id',auth['isAuthenticated'](),controller['delete']);module[_0x211b('0x1c')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index fb501d4..501d36b 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 _0x529d=['BIGINT','INTEGER','sequelize','exports','STRING','FLOAT'];(function(_0x35a186,_0x38692b){var _0x140d39=function(_0x389aaf){while(--_0x389aaf){_0x35a186['push'](_0x35a186['shift']());}};_0x140d39(++_0x38692b);}(_0x529d,0xe0));var _0xd529=function(_0x491f69,_0x4de888){_0x491f69=_0x491f69-0x0;var _0x33bfcd=_0x529d[_0x491f69];return _0x33bfcd;};'use strict';var Sequelize=require(_0xd529('0x0'));module[_0xd529('0x1')]={'name':{'type':Sequelize[_0xd529('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0xd529('0x2')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0xd529('0x2')]},'original_format':{'type':Sequelize[_0xd529('0x2')]},'original_duration':{'type':Sequelize[_0xd529('0x3')]},'original_sampleCount':{'type':Sequelize[_0xd529('0x4')]},'original_channelCount':{'type':Sequelize[_0xd529('0x5')]},'original_bitRate':{'type':Sequelize[_0xd529('0x4')]},'original_sampleRate':{'type':Sequelize[_0xd529('0x5')]},'converted_format':{'type':Sequelize[_0xd529('0x2')]},'converted_duration':{'type':Sequelize[_0xd529('0x3')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0xd529('0x5')]},'converted_bitRate':{'type':Sequelize[_0xd529('0x4')]},'converted_sampleRate':{'type':Sequelize[_0xd529('0x5')]}}; \ No newline at end of file +var _0xcb64=['sequelize','STRING','BIGINT','INTEGER','FLOAT'];(function(_0x124f62,_0x2ad919){var _0x2c8f85=function(_0x45315){while(--_0x45315){_0x124f62['push'](_0x124f62['shift']());}};_0x2c8f85(++_0x2ad919);}(_0xcb64,0x1db));var _0x4cb6=function(_0x2d66c2,_0x213e24){_0x2d66c2=_0x2d66c2-0x0;var _0x5d514a=_0xcb64[_0x2d66c2];return _0x5d514a;};'use strict';var Sequelize=require(_0x4cb6('0x0'));module['exports']={'name':{'type':Sequelize[_0x4cb6('0x1')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x4cb6('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x4cb6('0x1')]},'original_format':{'type':Sequelize[_0x4cb6('0x1')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0x4cb6('0x2')]},'original_channelCount':{'type':Sequelize[_0x4cb6('0x3')]},'original_bitRate':{'type':Sequelize[_0x4cb6('0x2')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x4cb6('0x1')]},'converted_duration':{'type':Sequelize[_0x4cb6('0x4')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0x4cb6('0x2')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index e37210f..6f4c95d 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 _0x2aea=['model','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','show','params','fields','catch','download','find','save_name','existsSync','join','root','converted_format','Sequelize','ValidationError','Sound\x20not\x20found','server/files/sounds/converted','format','%s.%s','create','basename','originalname','file','extname','substring','wav','filename','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','start','description','delete','server/files/sounds/original','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','Sounds','UserProfileResource','then','error','name','send','map','Sound','rawAttributes','fieldName','key','query','keys'];(function(_0x35d649,_0x37210f){var _0x541bc4=function(_0x4743bb){while(--_0x4743bb){_0x35d649['push'](_0x35d649['shift']());}};_0x541bc4(++_0x37210f);}(_0x2aea,0x1c0));var _0xa2ae=function(_0x3d73ba,_0x356e23){_0x3d73ba=_0x3d73ba-0x0;var _0x47e406=_0x2aea[_0x3d73ba];return _0x47e406;};'use strict';var emlformat=require(_0xa2ae('0x0'));var rimraf=require(_0xa2ae('0x1'));var zipdir=require(_0xa2ae('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa2ae('0x3'));var moment=require('moment');var BPromise=require(_0xa2ae('0x4'));var Mustache=require(_0xa2ae('0x5'));var util=require(_0xa2ae('0x6'));var path=require(_0xa2ae('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa2ae('0x8'));var fs=require('fs');var fs_extra=require(_0xa2ae('0x9'));var _=require(_0xa2ae('0xa'));var squel=require(_0xa2ae('0xb'));var crypto=require(_0xa2ae('0xc'));var jsforce=require(_0xa2ae('0xd'));var deskjs=require(_0xa2ae('0xe'));var toCsv=require(_0xa2ae('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa2ae('0x10'));var as=require(_0xa2ae('0x11'));var hardwareService=require(_0xa2ae('0x12'));var logger=require(_0xa2ae('0x13'))(_0xa2ae('0x14'));var utils=require(_0xa2ae('0x15'));var config=require(_0xa2ae('0x16'));var licenseUtil=require(_0xa2ae('0x17'));var db=require(_0xa2ae('0x18'))['db'];function respondWithStatusCode(_0x134b64,_0x513272){_0x513272=_0x513272||0xcc;return function(_0x4fe5fd){if(_0x4fe5fd){return _0x134b64[_0xa2ae('0x19')](_0x513272);}return _0x134b64[_0xa2ae('0x1a')](_0x513272)[_0xa2ae('0x1b')]();};}function respondWithResult(_0x2bc94c,_0x2f537b){_0x2f537b=_0x2f537b||0xc8;return function(_0x5b37ec){if(_0x5b37ec){return _0x2bc94c['status'](_0x2f537b)[_0xa2ae('0x1c')](_0x5b37ec);}};}function respondWithFilteredResult(_0x2c8836,_0x2e1aa4){return function(_0xe3297f){if(_0xe3297f){var _0x45fc01=typeof _0x2e1aa4[_0xa2ae('0x1d')]===_0xa2ae('0x1e')&&typeof _0x2e1aa4[_0xa2ae('0x1f')]===_0xa2ae('0x1e');var _0x132483=_0xe3297f['count'];var _0x23ac49=_0x45fc01?0x0:_0x2e1aa4['offset'];var _0x1b01cd=_0x45fc01?_0xe3297f[_0xa2ae('0x20')]:_0x2e1aa4[_0xa2ae('0x1d')]+_0x2e1aa4[_0xa2ae('0x1f')];var _0x445aa6;if(_0x1b01cd>=_0x132483){_0x1b01cd=_0x132483;_0x445aa6=0xc8;}else{_0x445aa6=0xce;}_0x2c8836[_0xa2ae('0x1a')](_0x445aa6);return _0x2c8836['set'](_0xa2ae('0x21'),_0x23ac49+'-'+_0x1b01cd+'/'+_0x132483)['json'](_0xe3297f);}return null;};}function patchUpdates(_0x449643){return function(_0xecabb9){try{jsonpatch[_0xa2ae('0x22')](_0xecabb9,_0x449643,!![]);}catch(_0x518544){return BPromise[_0xa2ae('0x23')](_0x518544);}return _0xecabb9[_0xa2ae('0x24')]();};}function saveUpdates(_0x453ff4,_0xf82212){return function(_0x5f2ed2){if(_0x5f2ed2){return _0x5f2ed2[_0xa2ae('0x25')](_0x453ff4)['then'](function(_0x247ffd){return _0x247ffd;});}return null;};}function removeEntity(_0x257cc7,_0x3fd91a){return function(_0x5263b7){if(_0x5263b7){return _0x5263b7[_0xa2ae('0x26')]()['then'](function(){var _0x4e583b=_0x5263b7['get']({'plain':!![]});var _0x56cf5f=_0xa2ae('0x27');return db[_0xa2ae('0x28')][_0xa2ae('0x26')]({'where':{'type':_0x56cf5f,'resourceId':_0x4e583b['id']}})[_0xa2ae('0x29')](function(){return _0x5263b7;});})[_0xa2ae('0x29')](function(){_0x257cc7[_0xa2ae('0x1a')](0xcc)[_0xa2ae('0x1b')]();});}};}function handleEntityNotFound(_0x152150,_0x40349f){return function(_0x3a0651){if(!_0x3a0651){_0x152150[_0xa2ae('0x19')](0x194);}return _0x3a0651;};}function handleError(_0xc70918,_0x402c78){_0x402c78=_0x402c78||0x1f4;return function(_0x25e317){logger[_0xa2ae('0x2a')](_0x25e317['stack']);if(_0x25e317[_0xa2ae('0x2b')]){delete _0x25e317['name'];}_0xc70918[_0xa2ae('0x1a')](_0x402c78)[_0xa2ae('0x2c')](_0x25e317);};}exports['index']=function(_0x3f5efd,_0x50aa4c){var _0x5e8b57={},_0x1209bf={},_0x130d3c={'count':0x0,'rows':[]};var _0x166042=_[_0xa2ae('0x2d')](db[_0xa2ae('0x2e')][_0xa2ae('0x2f')],function(_0x22af7e){return{'name':_0x22af7e[_0xa2ae('0x30')],'type':_0x22af7e['type'][_0xa2ae('0x31')]};});_0x1209bf['model']=_[_0xa2ae('0x2d')](_0x166042,'name');_0x1209bf[_0xa2ae('0x32')]=_[_0xa2ae('0x33')](_0x3f5efd[_0xa2ae('0x32')]);_0x1209bf['filters']=_['intersection'](_0x1209bf[_0xa2ae('0x34')],_0x1209bf['query']);_0x5e8b57[_0xa2ae('0x35')]=_[_0xa2ae('0x36')](_0x1209bf[_0xa2ae('0x34')],qs['fields'](_0x3f5efd[_0xa2ae('0x32')]['fields']));_0x5e8b57[_0xa2ae('0x35')]=_0x5e8b57[_0xa2ae('0x35')][_0xa2ae('0x37')]?_0x5e8b57['attributes']:_0x1209bf[_0xa2ae('0x34')];if(!_0x3f5efd['query'][_0xa2ae('0x38')](_0xa2ae('0x39'))){_0x5e8b57['limit']=qs[_0xa2ae('0x1f')](_0x3f5efd['query'][_0xa2ae('0x1f')]);_0x5e8b57[_0xa2ae('0x1d')]=qs[_0xa2ae('0x1d')](_0x3f5efd[_0xa2ae('0x32')][_0xa2ae('0x1d')]);}_0x5e8b57[_0xa2ae('0x3a')]=qs[_0xa2ae('0x3b')](_0x3f5efd['query'][_0xa2ae('0x3b')]);_0x5e8b57['where']=qs[_0xa2ae('0x3c')](_[_0xa2ae('0x3d')](_0x3f5efd[_0xa2ae('0x32')],_0x1209bf[_0xa2ae('0x3c')]),_0x166042);if(_0x3f5efd[_0xa2ae('0x32')][_0xa2ae('0x3e')]){_0x5e8b57['where']=_[_0xa2ae('0x3f')](_0x5e8b57[_0xa2ae('0x40')],{'$or':_[_0xa2ae('0x2d')](_0x166042,function(_0x3b910d){if(_0x3b910d['type']!==_0xa2ae('0x41')){var _0x5a7d11={};_0x5a7d11[_0x3b910d[_0xa2ae('0x2b')]]={'$like':'%'+_0x3f5efd[_0xa2ae('0x32')][_0xa2ae('0x3e')]+'%'};return _0x5a7d11;}})});}_0x5e8b57=_[_0xa2ae('0x3f')]({},_0x5e8b57,_0x3f5efd[_0xa2ae('0x42')]);var _0x2f1305={'where':_0x5e8b57[_0xa2ae('0x40')]};return db[_0xa2ae('0x2e')][_0xa2ae('0x20')](_0x2f1305)[_0xa2ae('0x29')](function(_0x17d739){_0x130d3c['count']=_0x17d739;if(_0x3f5efd[_0xa2ae('0x32')][_0xa2ae('0x43')]){_0x5e8b57[_0xa2ae('0x44')]=[{'all':!![]}];}return db['Sound'][_0xa2ae('0x45')](_0x5e8b57);})[_0xa2ae('0x29')](function(_0x452d25){_0x130d3c['rows']=_0x452d25;return _0x130d3c;})[_0xa2ae('0x29')](respondWithFilteredResult(_0x50aa4c,_0x5e8b57))['catch'](handleError(_0x50aa4c,null));};exports[_0xa2ae('0x46')]=function(_0x2a1956,_0x45804f){var _0x3d6b3c={'raw':!![],'where':{'id':_0x2a1956[_0xa2ae('0x47')]['id']}},_0x5e0f1f={};_0x5e0f1f['model']=_[_0xa2ae('0x33')](db['Sound']['rawAttributes']);_0x5e0f1f[_0xa2ae('0x32')]=_['keys'](_0x2a1956[_0xa2ae('0x32')]);_0x5e0f1f[_0xa2ae('0x3c')]=_[_0xa2ae('0x36')](_0x5e0f1f[_0xa2ae('0x34')],_0x5e0f1f[_0xa2ae('0x32')]);_0x3d6b3c['attributes']=_['intersection'](_0x5e0f1f[_0xa2ae('0x34')],qs[_0xa2ae('0x48')](_0x2a1956[_0xa2ae('0x32')][_0xa2ae('0x48')]));_0x3d6b3c[_0xa2ae('0x35')]=_0x3d6b3c[_0xa2ae('0x35')][_0xa2ae('0x37')]?_0x3d6b3c[_0xa2ae('0x35')]:_0x5e0f1f[_0xa2ae('0x34')];if(_0x2a1956[_0xa2ae('0x32')]['includeAll']){_0x3d6b3c[_0xa2ae('0x44')]=[{'all':!![]}];}_0x3d6b3c=_[_0xa2ae('0x3f')]({},_0x3d6b3c,_0x2a1956[_0xa2ae('0x42')]);return db[_0xa2ae('0x2e')]['find'](_0x3d6b3c)[_0xa2ae('0x29')](handleEntityNotFound(_0x45804f,null))[_0xa2ae('0x29')](respondWithResult(_0x45804f,null))[_0xa2ae('0x49')](handleError(_0x45804f,null));};exports[_0xa2ae('0x4a')]=function(_0x574e60,_0x3a8b02,_0x53552b){return db['Sound'][_0xa2ae('0x4b')]({'where':{'id':_0x574e60[_0xa2ae('0x47')]['id']},'attributes':['name',_0xa2ae('0x4c'),'converted_format'],'raw':!![]})[_0xa2ae('0x29')](handleEntityNotFound(_0x3a8b02,null))['then'](function(_0x58d5b6){if(_0x58d5b6){if(!fs[_0xa2ae('0x4d')](path[_0xa2ae('0x4e')](config[_0xa2ae('0x4f')],'server/files/sounds/converted',_0x58d5b6[_0xa2ae('0x4c')]+'.'+_0x58d5b6[_0xa2ae('0x50')]))){throw new db[(_0xa2ae('0x51'))][(_0xa2ae('0x52'))](_0xa2ae('0x53'));}return _0x3a8b02[_0xa2ae('0x4a')](path[_0xa2ae('0x4e')](config[_0xa2ae('0x4f')],_0xa2ae('0x54'),util[_0xa2ae('0x55')]('%s.%s',_0x58d5b6[_0xa2ae('0x4c')],_0x58d5b6[_0xa2ae('0x50')])),util[_0xa2ae('0x55')](_0xa2ae('0x56'),_0x58d5b6[_0xa2ae('0x2b')],_0x58d5b6[_0xa2ae('0x50')]));}return null;})[_0xa2ae('0x49')](handleError(_0x3a8b02,null));};exports[_0xa2ae('0x57')]=function(_0x2e3a86,_0x42732b,_0x39360b){var _0x18dec1={'name':path[_0xa2ae('0x58')](_0x2e3a86['file'][_0xa2ae('0x59')],path['extname'](_0x2e3a86[_0xa2ae('0x5a')][_0xa2ae('0x59')])),'save_name':path[_0xa2ae('0x58')](_0x2e3a86['file']['filename'],path[_0xa2ae('0x5b')](_0x2e3a86[_0xa2ae('0x5a')]['filename'])),'original_format':path[_0xa2ae('0x5b')](_0x2e3a86[_0xa2ae('0x5a')][_0xa2ae('0x59')])[_0xa2ae('0x5c')](0x1),'converted_format':_0xa2ae('0x5d')};var _0x34842b=path[_0xa2ae('0x4e')](config[_0xa2ae('0x4f')],'server/files/sounds/original',_0x2e3a86[_0xa2ae('0x5a')][_0xa2ae('0x5e')]);var _0x5a66eb=path[_0xa2ae('0x4e')](config['root'],_0xa2ae('0x54'),util[_0xa2ae('0x55')]('%s.%s',path[_0xa2ae('0x58')](_0x2e3a86['file'][_0xa2ae('0x5e')],path[_0xa2ae('0x5b')](_0x2e3a86[_0xa2ae('0x5a')][_0xa2ae('0x5e')])),_0x18dec1['converted_format']));logger['info']('Sound\x20upload\x20filepath:\x20%s',_0x34842b);logger['info'](_0xa2ae('0x5f'),_0x5a66eb);try{fs[_0xa2ae('0x60')](_0x34842b,parseInt(_0xa2ae('0x61'),0x8));var _0x4717a4=sox[_0xa2ae('0x62')](_0x34842b,_0x5a66eb,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4717a4['on'](_0xa2ae('0x2a'),function(_0x5ba961){fs[_0xa2ae('0x63')](_0x34842b);_0x42732b[_0xa2ae('0x1a')](0x1f4)[_0xa2ae('0x2c')](_0x5ba961);});_0x4717a4['on'](_0xa2ae('0x64'),function(_0x52f3e8){_0x18dec1[_0xa2ae('0x65')]=isNaN(_0x52f3e8[_0xa2ae('0x66')])?null:_0x52f3e8[_0xa2ae('0x66')]*0x3e8;_0x18dec1[_0xa2ae('0x67')]=isNaN(_0x52f3e8[_0xa2ae('0x68')])?null:_0x52f3e8[_0xa2ae('0x68')];_0x18dec1[_0xa2ae('0x69')]=isNaN(_0x52f3e8['channelCount'])?null:_0x52f3e8[_0xa2ae('0x6a')];_0x18dec1['original_bitRate']=isNaN(_0x52f3e8[_0xa2ae('0x6b')])?null:_0x52f3e8['bitRate'];_0x18dec1['original_sampleRate']=isNaN(_0x52f3e8[_0xa2ae('0x6c')])?null:_0x52f3e8[_0xa2ae('0x6c')];});_0x4717a4['on'](_0xa2ae('0x6d'),function(_0x573559){_0x18dec1[_0xa2ae('0x6e')]=isNaN(_0x573559[_0xa2ae('0x66')])?null:_0x573559['duration']*0x3e8;_0x18dec1[_0xa2ae('0x6f')]=isNaN(_0x573559[_0xa2ae('0x68')])?null:_0x573559[_0xa2ae('0x68')];_0x18dec1['converted_channelCount']=isNaN(_0x573559[_0xa2ae('0x6a')])?null:_0x573559[_0xa2ae('0x6a')];_0x18dec1[_0xa2ae('0x70')]=isNaN(_0x573559['bitRate'])?null:_0x573559[_0xa2ae('0x6b')];_0x18dec1[_0xa2ae('0x71')]=isNaN(_0x573559['sampleRate'])?null:_0x573559['sampleRate'];});_0x4717a4['on'](_0xa2ae('0x1b'),function(){fs[_0xa2ae('0x60')](_0x5a66eb,parseInt(_0xa2ae('0x61'),0x8));return db['Sound'][_0xa2ae('0x57')](_0x18dec1)['then'](function(_0x15d2bf){var _0x3a5165={'role':_0x2e3a86[_0xa2ae('0x72')][_0xa2ae('0x73')],'userProfileId':_0x2e3a86[_0xa2ae('0x72')][_0xa2ae('0x74')]};if(!_0x3a5165)throw new Error(_0xa2ae('0x75'));if(_0x3a5165[_0xa2ae('0x73')]===_0xa2ae('0x76')){var _0x4469b7=_0x15d2bf['get']({'plain':!![]});return db[_0xa2ae('0x77')]['find']({'where':{'name':_0xa2ae('0x27'),'userProfileId':_0x3a5165[_0xa2ae('0x74')]},'raw':!![]})['then'](function(_0x49d352){if(_0x49d352&&_0x49d352[_0xa2ae('0x78')]===0x0){return db['UserProfileResource'][_0xa2ae('0x57')]({'name':_0x4469b7['name'],'resourceId':_0x4469b7['id'],'type':_0x49d352[_0xa2ae('0x2b')],'sectionId':_0x49d352['id']},{})[_0xa2ae('0x29')](function(){return _0x15d2bf;});}else{return _0x15d2bf;}})[_0xa2ae('0x49')](function(_0x145664){logger[_0xa2ae('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x145664);throw _0x145664;});}return _0x15d2bf;})[_0xa2ae('0x29')](respondWithResult(_0x42732b,null))[_0xa2ae('0x49')](handleError(_0x42732b,null));});_0x4717a4[_0xa2ae('0x79')]();}catch(_0x55282b){_0x42732b[_0xa2ae('0x1a')](0x1f4)['send'](_0x55282b);}};exports[_0xa2ae('0x25')]=function(_0x49875f,_0xae6fb,_0x3b9c74){return db[_0xa2ae('0x2e')]['find']({'where':{'id':_0x49875f[_0xa2ae('0x47')]['id']}})[_0xa2ae('0x29')](handleEntityNotFound(_0xae6fb,null))['then'](saveUpdates(_[_0xa2ae('0x3d')](_0x49875f['body'],['name',_0xa2ae('0x7a')]),null))['then'](respondWithResult(_0xae6fb,null))[_0xa2ae('0x49')](handleError(_0xae6fb,null));};exports[_0xa2ae('0x7b')]=function(_0x33cfde,_0x5cfa3b,_0x585471){return db[_0xa2ae('0x2e')][_0xa2ae('0x4b')]({'where':{'id':_0x33cfde[_0xa2ae('0x47')]['id']}})['then'](function(_0x1a019d){if(_0x1a019d){return _0x1a019d['destroy']();}})[_0xa2ae('0x29')](function(_0x30dd43){var _0x26aa4c=path['join'](config[_0xa2ae('0x4f')],_0xa2ae('0x7c'),util[_0xa2ae('0x55')](_0xa2ae('0x56'),_0x30dd43[_0xa2ae('0x4c')],_0x30dd43['original_format']));var _0x9aea7b=path[_0xa2ae('0x4e')](config[_0xa2ae('0x4f')],'server/files/sounds/converted',util[_0xa2ae('0x55')](_0xa2ae('0x56'),_0x30dd43[_0xa2ae('0x4c')],_0x30dd43[_0xa2ae('0x50')]));fs[_0xa2ae('0x63')](_0x26aa4c);fs[_0xa2ae('0x63')](_0x9aea7b);return _0x30dd43;})[_0xa2ae('0x29')](function(_0x316284){if(_0x316284){return _0x5cfa3b['status'](0xcc)['end']();}})['then'](handleEntityNotFound(_0x5cfa3b,null))[_0xa2ae('0x49')](handleError(_0x5cfa3b,null));}; \ No newline at end of file +var _0x4e7d=['basename','file','extname','originalname','filename','wav','server/files/sounds/original','Sound\x20upload\x20filepath:\x20%s','info','Sound\x20upload\x20destination:\x20%s','0777','transcode','error','unlinkSync','duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','start','description','delete','original_format','rimraf','fast-json-patch','request-promise','bluebird','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','limit','undefined','count','status','set','apply','save','update','then','destroy','get','Sounds','UserProfileResource','stack','name','send','index','map','Sound','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','download','find','save_name','converted_format','join','root','server/files/sounds/converted','Sequelize','Sound\x20not\x20found','format','%s.%s','create'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4e7d,0x194));var _0xd4e7=function(_0x3d653d,_0x17440a){_0x3d653d=_0x3d653d-0x0;var _0x3c1fb3=_0x4e7d[_0x3d653d];return _0x3c1fb3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd4e7('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd4e7('0x1'));var rp=require(_0xd4e7('0x2'));var moment=require('moment');var BPromise=require(_0xd4e7('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd4e7('0x4'));var sox=require(_0xd4e7('0x5'));var csv=require(_0xd4e7('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd4e7('0x7'));var _=require(_0xd4e7('0x8'));var squel=require(_0xd4e7('0x9'));var crypto=require(_0xd4e7('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd4e7('0x6'));var querystring=require(_0xd4e7('0xb'));var Papa=require(_0xd4e7('0xc'));var Redis=require('ioredis');var authService=require(_0xd4e7('0xd'));var qs=require(_0xd4e7('0xe'));var as=require(_0xd4e7('0xf'));var hardwareService=require(_0xd4e7('0x10'));var logger=require('../../config/logger')(_0xd4e7('0x11'));var utils=require(_0xd4e7('0x12'));var config=require(_0xd4e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xd4e7('0x14'))['db'];function respondWithStatusCode(_0x4725d2,_0x285760){_0x285760=_0x285760||0xcc;return function(_0x20a34e){if(_0x20a34e){return _0x4725d2[_0xd4e7('0x15')](_0x285760);}return _0x4725d2['status'](_0x285760)[_0xd4e7('0x16')]();};}function respondWithResult(_0x471e3e,_0x492aa8){_0x492aa8=_0x492aa8||0xc8;return function(_0x350d74){if(_0x350d74){return _0x471e3e['status'](_0x492aa8)[_0xd4e7('0x17')](_0x350d74);}};}function respondWithFilteredResult(_0x56179c,_0x519877){return function(_0x238c86){if(_0x238c86){var _0x5b5f4f=typeof _0x519877[_0xd4e7('0x18')]==='undefined'&&typeof _0x519877[_0xd4e7('0x19')]===_0xd4e7('0x1a');var _0x1aca48=_0x238c86['count'];var _0x3afc0e=_0x5b5f4f?0x0:_0x519877[_0xd4e7('0x18')];var _0x3159dd=_0x5b5f4f?_0x238c86[_0xd4e7('0x1b')]:_0x519877[_0xd4e7('0x18')]+_0x519877[_0xd4e7('0x19')];var _0x1c5b45;if(_0x3159dd>=_0x1aca48){_0x3159dd=_0x1aca48;_0x1c5b45=0xc8;}else{_0x1c5b45=0xce;}_0x56179c[_0xd4e7('0x1c')](_0x1c5b45);return _0x56179c[_0xd4e7('0x1d')]('Content-Range',_0x3afc0e+'-'+_0x3159dd+'/'+_0x1aca48)[_0xd4e7('0x17')](_0x238c86);}return null;};}function patchUpdates(_0x48413c){return function(_0x5f0bba){try{jsonpatch[_0xd4e7('0x1e')](_0x5f0bba,_0x48413c,!![]);}catch(_0x52245e){return BPromise['reject'](_0x52245e);}return _0x5f0bba[_0xd4e7('0x1f')]();};}function saveUpdates(_0x2a925b,_0x3ab579){return function(_0x33e425){if(_0x33e425){return _0x33e425[_0xd4e7('0x20')](_0x2a925b)[_0xd4e7('0x21')](function(_0x2e8da8){return _0x2e8da8;});}return null;};}function removeEntity(_0x1be563,_0x46f75f){return function(_0x1a3853){if(_0x1a3853){return _0x1a3853[_0xd4e7('0x22')]()[_0xd4e7('0x21')](function(){var _0x642df6=_0x1a3853[_0xd4e7('0x23')]({'plain':!![]});var _0x348084=_0xd4e7('0x24');return db[_0xd4e7('0x25')][_0xd4e7('0x22')]({'where':{'type':_0x348084,'resourceId':_0x642df6['id']}})[_0xd4e7('0x21')](function(){return _0x1a3853;});})[_0xd4e7('0x21')](function(){_0x1be563[_0xd4e7('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x377871,_0x576614){return function(_0xe81a9){if(!_0xe81a9){_0x377871[_0xd4e7('0x15')](0x194);}return _0xe81a9;};}function handleError(_0x382852,_0x19f890){_0x19f890=_0x19f890||0x1f4;return function(_0x16fcd2){logger['error'](_0x16fcd2[_0xd4e7('0x26')]);if(_0x16fcd2[_0xd4e7('0x27')]){delete _0x16fcd2[_0xd4e7('0x27')];}_0x382852[_0xd4e7('0x1c')](_0x19f890)[_0xd4e7('0x28')](_0x16fcd2);};}exports[_0xd4e7('0x29')]=function(_0x5f101b,_0x3c9794){var _0x13a577={},_0x5c0196={},_0x49e690={'count':0x0,'rows':[]};var _0x160c2c=_[_0xd4e7('0x2a')](db[_0xd4e7('0x2b')][_0xd4e7('0x2c')],function(_0x4d73c0){return{'name':_0x4d73c0['fieldName'],'type':_0x4d73c0[_0xd4e7('0x2d')][_0xd4e7('0x2e')]};});_0x5c0196['model']=_[_0xd4e7('0x2a')](_0x160c2c,_0xd4e7('0x27'));_0x5c0196[_0xd4e7('0x2f')]=_[_0xd4e7('0x30')](_0x5f101b[_0xd4e7('0x2f')]);_0x5c0196[_0xd4e7('0x31')]=_[_0xd4e7('0x32')](_0x5c0196[_0xd4e7('0x33')],_0x5c0196[_0xd4e7('0x2f')]);_0x13a577[_0xd4e7('0x34')]=_[_0xd4e7('0x32')](_0x5c0196['model'],qs[_0xd4e7('0x35')](_0x5f101b[_0xd4e7('0x2f')][_0xd4e7('0x35')]));_0x13a577[_0xd4e7('0x34')]=_0x13a577[_0xd4e7('0x34')][_0xd4e7('0x36')]?_0x13a577[_0xd4e7('0x34')]:_0x5c0196[_0xd4e7('0x33')];if(!_0x5f101b[_0xd4e7('0x2f')][_0xd4e7('0x37')](_0xd4e7('0x38'))){_0x13a577[_0xd4e7('0x19')]=qs[_0xd4e7('0x19')](_0x5f101b['query'][_0xd4e7('0x19')]);_0x13a577[_0xd4e7('0x18')]=qs[_0xd4e7('0x18')](_0x5f101b['query'][_0xd4e7('0x18')]);}_0x13a577[_0xd4e7('0x39')]=qs[_0xd4e7('0x3a')](_0x5f101b[_0xd4e7('0x2f')]['sort']);_0x13a577[_0xd4e7('0x3b')]=qs[_0xd4e7('0x31')](_[_0xd4e7('0x3c')](_0x5f101b[_0xd4e7('0x2f')],_0x5c0196[_0xd4e7('0x31')]),_0x160c2c);if(_0x5f101b[_0xd4e7('0x2f')][_0xd4e7('0x3d')]){_0x13a577[_0xd4e7('0x3b')]=_[_0xd4e7('0x3e')](_0x13a577[_0xd4e7('0x3b')],{'$or':_['map'](_0x160c2c,function(_0x235f53){if(_0x235f53['type']!==_0xd4e7('0x3f')){var _0x52100c={};_0x52100c[_0x235f53[_0xd4e7('0x27')]]={'$like':'%'+_0x5f101b[_0xd4e7('0x2f')]['filter']+'%'};return _0x52100c;}})});}_0x13a577=_[_0xd4e7('0x3e')]({},_0x13a577,_0x5f101b[_0xd4e7('0x40')]);var _0x2320eb={'where':_0x13a577[_0xd4e7('0x3b')]};return db[_0xd4e7('0x2b')][_0xd4e7('0x1b')](_0x2320eb)[_0xd4e7('0x21')](function(_0x6b4199){_0x49e690[_0xd4e7('0x1b')]=_0x6b4199;if(_0x5f101b[_0xd4e7('0x2f')]['includeAll']){_0x13a577['include']=[{'all':!![]}];}return db[_0xd4e7('0x2b')][_0xd4e7('0x41')](_0x13a577);})[_0xd4e7('0x21')](function(_0x4cae86){_0x49e690[_0xd4e7('0x42')]=_0x4cae86;return _0x49e690;})[_0xd4e7('0x21')](respondWithFilteredResult(_0x3c9794,_0x13a577))[_0xd4e7('0x43')](handleError(_0x3c9794,null));};exports[_0xd4e7('0x44')]=function(_0x5e0ccd,_0x428d46){var _0x10d23e={'raw':!![],'where':{'id':_0x5e0ccd[_0xd4e7('0x45')]['id']}},_0x113087={};_0x113087['model']=_[_0xd4e7('0x30')](db['Sound'][_0xd4e7('0x2c')]);_0x113087['query']=_[_0xd4e7('0x30')](_0x5e0ccd[_0xd4e7('0x2f')]);_0x113087[_0xd4e7('0x31')]=_['intersection'](_0x113087[_0xd4e7('0x33')],_0x113087[_0xd4e7('0x2f')]);_0x10d23e[_0xd4e7('0x34')]=_[_0xd4e7('0x32')](_0x113087[_0xd4e7('0x33')],qs[_0xd4e7('0x35')](_0x5e0ccd['query'][_0xd4e7('0x35')]));_0x10d23e[_0xd4e7('0x34')]=_0x10d23e[_0xd4e7('0x34')][_0xd4e7('0x36')]?_0x10d23e[_0xd4e7('0x34')]:_0x113087[_0xd4e7('0x33')];if(_0x5e0ccd[_0xd4e7('0x2f')][_0xd4e7('0x46')]){_0x10d23e[_0xd4e7('0x47')]=[{'all':!![]}];}_0x10d23e=_[_0xd4e7('0x3e')]({},_0x10d23e,_0x5e0ccd['options']);return db[_0xd4e7('0x2b')]['find'](_0x10d23e)[_0xd4e7('0x21')](handleEntityNotFound(_0x428d46,null))[_0xd4e7('0x21')](respondWithResult(_0x428d46,null))[_0xd4e7('0x43')](handleError(_0x428d46,null));};exports[_0xd4e7('0x48')]=function(_0x275978,_0x16a44e,_0xb6f750){return db[_0xd4e7('0x2b')][_0xd4e7('0x49')]({'where':{'id':_0x275978[_0xd4e7('0x45')]['id']},'attributes':[_0xd4e7('0x27'),_0xd4e7('0x4a'),_0xd4e7('0x4b')],'raw':!![]})[_0xd4e7('0x21')](handleEntityNotFound(_0x16a44e,null))[_0xd4e7('0x21')](function(_0x4d843c){if(_0x4d843c){if(!fs['existsSync'](path[_0xd4e7('0x4c')](config[_0xd4e7('0x4d')],_0xd4e7('0x4e'),_0x4d843c[_0xd4e7('0x4a')]+'.'+_0x4d843c[_0xd4e7('0x4b')]))){throw new db[(_0xd4e7('0x4f'))]['ValidationError'](_0xd4e7('0x50'));}return _0x16a44e[_0xd4e7('0x48')](path['join'](config['root'],_0xd4e7('0x4e'),util['format']('%s.%s',_0x4d843c[_0xd4e7('0x4a')],_0x4d843c['converted_format'])),util[_0xd4e7('0x51')](_0xd4e7('0x52'),_0x4d843c[_0xd4e7('0x27')],_0x4d843c[_0xd4e7('0x4b')]));}return null;})[_0xd4e7('0x43')](handleError(_0x16a44e,null));};exports[_0xd4e7('0x53')]=function(_0x21709c,_0x32717f,_0x14ab42){var _0x5ca740={'name':path[_0xd4e7('0x54')](_0x21709c[_0xd4e7('0x55')]['originalname'],path[_0xd4e7('0x56')](_0x21709c[_0xd4e7('0x55')][_0xd4e7('0x57')])),'save_name':path['basename'](_0x21709c[_0xd4e7('0x55')][_0xd4e7('0x58')],path[_0xd4e7('0x56')](_0x21709c[_0xd4e7('0x55')]['filename'])),'original_format':path[_0xd4e7('0x56')](_0x21709c[_0xd4e7('0x55')][_0xd4e7('0x57')])['substring'](0x1),'converted_format':_0xd4e7('0x59')};var _0x30f0d7=path['join'](config[_0xd4e7('0x4d')],_0xd4e7('0x5a'),_0x21709c[_0xd4e7('0x55')][_0xd4e7('0x58')]);var _0x427296=path['join'](config[_0xd4e7('0x4d')],_0xd4e7('0x4e'),util[_0xd4e7('0x51')](_0xd4e7('0x52'),path[_0xd4e7('0x54')](_0x21709c[_0xd4e7('0x55')][_0xd4e7('0x58')],path[_0xd4e7('0x56')](_0x21709c[_0xd4e7('0x55')]['filename'])),_0x5ca740[_0xd4e7('0x4b')]));logger['info'](_0xd4e7('0x5b'),_0x30f0d7);logger[_0xd4e7('0x5c')](_0xd4e7('0x5d'),_0x427296);try{fs['chmodSync'](_0x30f0d7,parseInt(_0xd4e7('0x5e'),0x8));var _0x4161ea=sox[_0xd4e7('0x5f')](_0x30f0d7,_0x427296,{'sampleRate':0x1f40,'format':_0xd4e7('0x59'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4161ea['on'](_0xd4e7('0x60'),function(_0x52e723){fs[_0xd4e7('0x61')](_0x30f0d7);_0x32717f['status'](0x1f4)[_0xd4e7('0x28')](_0x52e723);});_0x4161ea['on']('src',function(_0x3de756){_0x5ca740['original_duration']=isNaN(_0x3de756[_0xd4e7('0x62')])?null:_0x3de756[_0xd4e7('0x62')]*0x3e8;_0x5ca740[_0xd4e7('0x63')]=isNaN(_0x3de756['sampleCount'])?null:_0x3de756[_0xd4e7('0x64')];_0x5ca740['original_channelCount']=isNaN(_0x3de756[_0xd4e7('0x65')])?null:_0x3de756[_0xd4e7('0x65')];_0x5ca740[_0xd4e7('0x66')]=isNaN(_0x3de756[_0xd4e7('0x67')])?null:_0x3de756['bitRate'];_0x5ca740[_0xd4e7('0x68')]=isNaN(_0x3de756['sampleRate'])?null:_0x3de756[_0xd4e7('0x69')];});_0x4161ea['on'](_0xd4e7('0x6a'),function(_0x74c017){_0x5ca740[_0xd4e7('0x6b')]=isNaN(_0x74c017[_0xd4e7('0x62')])?null:_0x74c017[_0xd4e7('0x62')]*0x3e8;_0x5ca740[_0xd4e7('0x6c')]=isNaN(_0x74c017[_0xd4e7('0x64')])?null:_0x74c017[_0xd4e7('0x64')];_0x5ca740[_0xd4e7('0x6d')]=isNaN(_0x74c017[_0xd4e7('0x65')])?null:_0x74c017['channelCount'];_0x5ca740[_0xd4e7('0x6e')]=isNaN(_0x74c017['bitRate'])?null:_0x74c017[_0xd4e7('0x67')];_0x5ca740[_0xd4e7('0x6f')]=isNaN(_0x74c017[_0xd4e7('0x69')])?null:_0x74c017[_0xd4e7('0x69')];});_0x4161ea['on'](_0xd4e7('0x16'),function(){fs['chmodSync'](_0x427296,parseInt(_0xd4e7('0x5e'),0x8));return db[_0xd4e7('0x2b')]['create'](_0x5ca740)[_0xd4e7('0x21')](function(_0x503c8b){var _0x38f627={'role':_0x21709c[_0xd4e7('0x70')][_0xd4e7('0x71')],'userProfileId':_0x21709c[_0xd4e7('0x70')][_0xd4e7('0x72')]};if(!_0x38f627)throw new Error(_0xd4e7('0x73'));if(_0x38f627['role']==='user'){var _0x14537e=_0x503c8b[_0xd4e7('0x23')]({'plain':!![]});return db[_0xd4e7('0x74')][_0xd4e7('0x49')]({'where':{'name':_0xd4e7('0x24'),'userProfileId':_0x38f627['userProfileId']},'raw':!![]})['then'](function(_0x1c93cc){if(_0x1c93cc&&_0x1c93cc[_0xd4e7('0x75')]===0x0){return db[_0xd4e7('0x25')][_0xd4e7('0x53')]({'name':_0x14537e[_0xd4e7('0x27')],'resourceId':_0x14537e['id'],'type':_0x1c93cc['name'],'sectionId':_0x1c93cc['id']},{})[_0xd4e7('0x21')](function(){return _0x503c8b;});}else{return _0x503c8b;}})[_0xd4e7('0x43')](function(_0x18eec0){logger[_0xd4e7('0x60')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x18eec0);throw _0x18eec0;});}return _0x503c8b;})[_0xd4e7('0x21')](respondWithResult(_0x32717f,null))[_0xd4e7('0x43')](handleError(_0x32717f,null));});_0x4161ea[_0xd4e7('0x76')]();}catch(_0x24efd4){_0x32717f[_0xd4e7('0x1c')](0x1f4)[_0xd4e7('0x28')](_0x24efd4);}};exports[_0xd4e7('0x20')]=function(_0x44ceb2,_0x34dc5a,_0x2bd093){return db[_0xd4e7('0x2b')][_0xd4e7('0x49')]({'where':{'id':_0x44ceb2['params']['id']}})['then'](handleEntityNotFound(_0x34dc5a,null))['then'](saveUpdates(_[_0xd4e7('0x3c')](_0x44ceb2[_0xd4e7('0x70')],[_0xd4e7('0x27'),_0xd4e7('0x77')]),null))[_0xd4e7('0x21')](respondWithResult(_0x34dc5a,null))['catch'](handleError(_0x34dc5a,null));};exports[_0xd4e7('0x78')]=function(_0x4a1520,_0x27de74,_0x33bf9d){return db[_0xd4e7('0x2b')][_0xd4e7('0x49')]({'where':{'id':_0x4a1520['params']['id']}})[_0xd4e7('0x21')](function(_0x4257c7){if(_0x4257c7){return _0x4257c7[_0xd4e7('0x22')]();}})[_0xd4e7('0x21')](function(_0x56d073){var _0x20fb8=path[_0xd4e7('0x4c')](config[_0xd4e7('0x4d')],_0xd4e7('0x5a'),util[_0xd4e7('0x51')](_0xd4e7('0x52'),_0x56d073['save_name'],_0x56d073[_0xd4e7('0x79')]));var _0x1f92fb=path['join'](config[_0xd4e7('0x4d')],'server/files/sounds/converted',util[_0xd4e7('0x51')](_0xd4e7('0x52'),_0x56d073[_0xd4e7('0x4a')],_0x56d073[_0xd4e7('0x4b')]));fs[_0xd4e7('0x61')](_0x20fb8);fs[_0xd4e7('0x61')](_0x1f92fb);return _0x56d073;})[_0xd4e7('0x21')](function(_0xf761c2){if(_0xf761c2){return _0x27de74[_0xd4e7('0x1c')](0xcc)[_0xd4e7('0x16')]();}})[_0xd4e7('0x21')](handleEntityNotFound(_0x27de74,null))[_0xd4e7('0x43')](handleError(_0x27de74,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 6b260a9..e732276 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 _0x8547=['./sound.attributes','exports','Sound','util','path','rimraf','../../config/environment'];(function(_0xb72c10,_0x26d80a){var _0x51c691=function(_0x3cd2f5){while(--_0x3cd2f5){_0xb72c10['push'](_0xb72c10['shift']());}};_0x51c691(++_0x26d80a);}(_0x8547,0xea));var _0x7854=function(_0x465186,_0x19bdc6){_0x465186=_0x465186-0x0;var _0x64bdd=_0x8547[_0x465186];return _0x64bdd;};'use strict';var _=require('lodash');var util=require(_0x7854('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7854('0x1'));var rimraf=require(_0x7854('0x2'));var config=require(_0x7854('0x3'));var attributes=require(_0x7854('0x4'));module[_0x7854('0x5')]=function(_0x5eae3d,_0x1d35a7){return _0x5eae3d['define'](_0x7854('0x6'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1e50=['../../config/environment','./sound.attributes','define','Sound','tools_sounds','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5d41a6,_0x2be904){var _0x3b7778=function(_0x50255e){while(--_0x50255e){_0x5d41a6['push'](_0x5d41a6['shift']());}};_0x3b7778(++_0x2be904);}(_0x1e50,0x1e6));var _0x01e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1e50[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x01e5('0x0'));var util=require(_0x01e5('0x1'));var logger=require('../../config/logger')(_0x01e5('0x2'));var moment=require(_0x01e5('0x3'));var BPromise=require(_0x01e5('0x4'));var rp=require(_0x01e5('0x5'));var fs=require('fs');var path=require(_0x01e5('0x6'));var rimraf=require(_0x01e5('0x7'));var config=require(_0x01e5('0x8'));var attributes=require(_0x01e5('0x9'));module['exports']=function(_0x414cf6,_0x9039c3){return _0x414cf6[_0x01e5('0xa')](_0x01e5('0xb'),attributes,{'tableName':_0x01e5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 54e4fa1..7cb390c 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 _0x4aab=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','request\x20sent','Sound,\x20%s,\x20%s,\x20%s','stringify','error','Sound,\x20%s,\x20%s','message','catch','ShowSound','find','options','raw','where','include','map','model','attributes','info','debug'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0x4aab,0x1c2));var _0xb4aa=function(_0x144017,_0x20ae3e){_0x144017=_0x144017-0x0;var _0x344537=_0x4aab[_0x144017];return _0x344537;};'use strict';var _=require(_0xb4aa('0x0'));var util=require(_0xb4aa('0x1'));var moment=require('moment');var BPromise=require(_0xb4aa('0x2'));var rs=require(_0xb4aa('0x3'));var fs=require('fs');var Redis=require(_0xb4aa('0x4'));var db=require(_0xb4aa('0x5'))['db'];var utils=require(_0xb4aa('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xb4aa('0x7'));var jayson=require(_0xb4aa('0x8'));var client=jayson[_0xb4aa('0x9')][_0xb4aa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x276d15,_0x4fff11,_0x3ba0eb){return new BPromise(function(_0x490460,_0x135092){return client['request'](_0x276d15,_0x3ba0eb)[_0xb4aa('0xb')](function(_0x13f8c8){logger['info']('Sound,\x20%s,\x20%s',_0x4fff11,_0xb4aa('0xc'));logger['debug'](_0xb4aa('0xd'),_0x4fff11,_0xb4aa('0xc'),JSON[_0xb4aa('0xe')](_0x13f8c8));if(_0x13f8c8['error']){if(_0x13f8c8['error']['code']===0x1f4){logger[_0xb4aa('0xf')](_0xb4aa('0x10'),_0x4fff11,_0x13f8c8[_0xb4aa('0xf')]['message']);return _0x135092(_0x13f8c8['error'][_0xb4aa('0x11')]);}logger[_0xb4aa('0xf')]('Sound,\x20%s,\x20%s',_0x4fff11,_0x13f8c8[_0xb4aa('0xf')]['message']);return _0x490460(_0x13f8c8[_0xb4aa('0xf')][_0xb4aa('0x11')]);}else{logger['info']('Sound,\x20%s,\x20%s',_0x4fff11,_0xb4aa('0xc'));_0x490460(_0x13f8c8['result'][_0xb4aa('0x11')]);}})[_0xb4aa('0x12')](function(_0x2cf081){logger[_0xb4aa('0xf')](_0xb4aa('0x10'),_0x4fff11,_0x2cf081);_0x135092(_0x2cf081);});});}exports[_0xb4aa('0x13')]=function(_0x49a1d6){var _0x5595de=this;return new Promise(function(_0x53b145,_0x4419cc){return db['Sound'][_0xb4aa('0x14')]({'raw':_0x49a1d6[_0xb4aa('0x15')]?_0x49a1d6['options'][_0xb4aa('0x16')]===undefined?!![]:![]:!![],'where':_0x49a1d6['options']?_0x49a1d6[_0xb4aa('0x15')][_0xb4aa('0x17')]||null:null,'attributes':_0x49a1d6[_0xb4aa('0x15')]?_0x49a1d6[_0xb4aa('0x15')]['attributes']||null:null,'include':_0x49a1d6[_0xb4aa('0x15')]?_0x49a1d6[_0xb4aa('0x15')][_0xb4aa('0x18')]?_[_0xb4aa('0x19')](_0x49a1d6['options']['include'],function(_0x134622){return{'model':db[_0x134622[_0xb4aa('0x1a')]],'as':_0x134622['as'],'attributes':_0x134622[_0xb4aa('0x1b')],'include':_0x134622[_0xb4aa('0x18')]?_[_0xb4aa('0x19')](_0x134622[_0xb4aa('0x18')],function(_0x44ae8a){return{'model':db[_0x44ae8a['model']],'as':_0x44ae8a['as'],'attributes':_0x44ae8a[_0xb4aa('0x1b')],'include':_0x44ae8a[_0xb4aa('0x18')]?_['map'](_0x44ae8a[_0xb4aa('0x18')],function(_0x1c2fb1){return{'model':db[_0x1c2fb1[_0xb4aa('0x1a')]],'as':_0x1c2fb1['as'],'attributes':_0x1c2fb1[_0xb4aa('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb4aa('0xb')](function(_0x1c6fbe){logger[_0xb4aa('0x1c')](_0xb4aa('0x13'),_0x49a1d6);logger[_0xb4aa('0x1d')](_0xb4aa('0x13'),_0x49a1d6,JSON[_0xb4aa('0xe')](_0x1c6fbe));_0x53b145(_0x1c6fbe);})['catch'](function(_0x37f772){logger['error'](_0xb4aa('0x13'),_0x37f772[_0xb4aa('0x11')],_0x49a1d6);_0x4419cc(_0x5595de['error'](0x1f4,_0x37f772[_0xb4aa('0x11')]));});});}; \ No newline at end of file +var _0xfb63=['map','model','attributes','include','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowSound','Sound','options','raw','where'];(function(_0xf24102,_0x55775e){var _0x831a7c=function(_0x3a69cc){while(--_0x3a69cc){_0xf24102['push'](_0xf24102['shift']());}};_0x831a7c(++_0x55775e);}(_0xfb63,0xaa));var _0x3fb6=function(_0x49d6a9,_0x29ad9e){_0x49d6a9=_0x49d6a9-0x0;var _0x57356b=_0xfb63[_0x49d6a9];return _0x57356b;};'use strict';var _=require(_0x3fb6('0x0'));var util=require(_0x3fb6('0x1'));var moment=require(_0x3fb6('0x2'));var BPromise=require(_0x3fb6('0x3'));var rs=require(_0x3fb6('0x4'));var fs=require('fs');var Redis=require(_0x3fb6('0x5'));var db=require(_0x3fb6('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3fb6('0x7'))('rpc');var config=require(_0x3fb6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3fb6('0x9')][_0x3fb6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x487006,_0x5adbf4,_0x14cacc){return new BPromise(function(_0x3068d9,_0x24458f){return client[_0x3fb6('0xb')](_0x487006,_0x14cacc)[_0x3fb6('0xc')](function(_0x59fb3b){logger[_0x3fb6('0xd')](_0x3fb6('0xe'),_0x5adbf4,_0x3fb6('0xf'));logger[_0x3fb6('0x10')](_0x3fb6('0x11'),_0x5adbf4,_0x3fb6('0xf'),JSON['stringify'](_0x59fb3b));if(_0x59fb3b[_0x3fb6('0x12')]){if(_0x59fb3b[_0x3fb6('0x12')][_0x3fb6('0x13')]===0x1f4){logger[_0x3fb6('0x12')](_0x3fb6('0xe'),_0x5adbf4,_0x59fb3b[_0x3fb6('0x12')][_0x3fb6('0x14')]);return _0x24458f(_0x59fb3b[_0x3fb6('0x12')]['message']);}logger[_0x3fb6('0x12')](_0x3fb6('0xe'),_0x5adbf4,_0x59fb3b[_0x3fb6('0x12')][_0x3fb6('0x14')]);return _0x3068d9(_0x59fb3b[_0x3fb6('0x12')]['message']);}else{logger[_0x3fb6('0xd')](_0x3fb6('0xe'),_0x5adbf4,_0x3fb6('0xf'));_0x3068d9(_0x59fb3b[_0x3fb6('0x15')][_0x3fb6('0x14')]);}})[_0x3fb6('0x16')](function(_0x36c472){logger[_0x3fb6('0x12')](_0x3fb6('0xe'),_0x5adbf4,_0x36c472);_0x24458f(_0x36c472);});});}exports[_0x3fb6('0x17')]=function(_0x241dd8){var _0x2cf94a=this;return new Promise(function(_0x38ad76,_0x29a264){return db[_0x3fb6('0x18')]['find']({'raw':_0x241dd8[_0x3fb6('0x19')]?_0x241dd8[_0x3fb6('0x19')][_0x3fb6('0x1a')]===undefined?!![]:![]:!![],'where':_0x241dd8[_0x3fb6('0x19')]?_0x241dd8['options'][_0x3fb6('0x1b')]||null:null,'attributes':_0x241dd8[_0x3fb6('0x19')]?_0x241dd8['options']['attributes']||null:null,'include':_0x241dd8[_0x3fb6('0x19')]?_0x241dd8[_0x3fb6('0x19')]['include']?_[_0x3fb6('0x1c')](_0x241dd8['options']['include'],function(_0x3458f2){return{'model':db[_0x3458f2[_0x3fb6('0x1d')]],'as':_0x3458f2['as'],'attributes':_0x3458f2[_0x3fb6('0x1e')],'include':_0x3458f2['include']?_[_0x3fb6('0x1c')](_0x3458f2[_0x3fb6('0x1f')],function(_0x40da1b){return{'model':db[_0x40da1b['model']],'as':_0x40da1b['as'],'attributes':_0x40da1b[_0x3fb6('0x1e')],'include':_0x40da1b[_0x3fb6('0x1f')]?_['map'](_0x40da1b['include'],function(_0x5dc374){return{'model':db[_0x5dc374[_0x3fb6('0x1d')]],'as':_0x5dc374['as'],'attributes':_0x5dc374[_0x3fb6('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x3fb6('0xc')](function(_0x238484){logger[_0x3fb6('0xd')]('ShowSound',_0x241dd8);logger[_0x3fb6('0x10')](_0x3fb6('0x17'),_0x241dd8,JSON[_0x3fb6('0x20')](_0x238484));_0x38ad76(_0x238484);})[_0x3fb6('0x16')](function(_0x1ef996){logger[_0x3fb6('0x12')](_0x3fb6('0x17'),_0x1ef996[_0x3fb6('0x14')],_0x241dd8);_0x29a264(_0x2cf94a[_0x3fb6('0x12')](0x1f4,_0x1ef996['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 1b7fd3e..35d2e24 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 _0x0b0e=['./squareMessage.controller','get','isAuthenticated','index','show','post','create','/:id','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x32179c,_0x32fb68){var _0xad3766=function(_0x597f3f){while(--_0x597f3f){_0x32179c['push'](_0x32179c['shift']());}};_0xad3766(++_0x32fb68);}(_0x0b0e,0x187));var _0xe0b0=function(_0x368587,_0x1b6554){_0x368587=_0x368587-0x0;var _0x42d33c=_0x0b0e[_0x368587];return _0x42d33c;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0xd')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xe')]);router['put'](_0xe0b0('0xf'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x10')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x11')]);module[_0xe0b0('0x12')]=router; \ No newline at end of file +var _0xda2d=['isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../config/environment','./squareMessage.controller','get'];(function(_0x907c3d,_0x1e8850){var _0x16684c=function(_0x1ee01b){while(--_0x1ee01b){_0x907c3d['push'](_0x907c3d['shift']());}};_0x16684c(++_0x1e8850);}(_0xda2d,0x102));var _0xdda2=function(_0x7342b6,_0x241654){_0x7342b6=_0x7342b6-0x0;var _0x17b056=_0xda2d[_0x7342b6];return _0x17b056;};'use strict';var multer=require('multer');var util=require(_0xdda2('0x0'));var path=require(_0xdda2('0x1'));var timeout=require(_0xdda2('0x2'));var express=require(_0xdda2('0x3'));var router=express[_0xdda2('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdda2('0x5'));var controller=require(_0xdda2('0x6'));router[_0xdda2('0x7')]('/',auth[_0xdda2('0x8')](),controller[_0xdda2('0x9')]);router[_0xdda2('0x7')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0xb')]);router[_0xdda2('0xc')]('/',auth['isAuthenticated'](),controller[_0xdda2('0xd')]);router[_0xdda2('0xe')]('/:id',auth[_0xdda2('0x8')](),controller[_0xdda2('0xf')]);router[_0xdda2('0x10')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x11')]);module[_0xdda2('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 92f54aa..203684e 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 _0xa474=['out','exports','STRING','TEXT'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xa474,0xed));var _0x4a47=function(_0x1ec2aa,_0x1245a0){_0x1ec2aa=_0x1ec2aa-0x0;var _0x4cbe9d=_0xa474[_0x1ec2aa];return _0x4cbe9d;};'use strict';var Sequelize=require('sequelize');module[_0x4a47('0x0')]={'uniqueid':{'type':Sequelize[_0x4a47('0x1')]},'body':{'type':Sequelize[_0x4a47('0x2')]('medium'),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0x4a47('0x3')),'defaultValue':_0x4a47('0x3'),'allowNull':![]},'providerName':{'type':Sequelize[_0x4a47('0x1')]},'providerResponse':{'type':Sequelize[_0x4a47('0x2')]}}; \ No newline at end of file +var _0xa660=['exports','STRING','medium','ENUM','out','TEXT','sequelize'];(function(_0x142009,_0x302ec6){var _0x43454b=function(_0x2b4a20){while(--_0x2b4a20){_0x142009['push'](_0x142009['shift']());}};_0x43454b(++_0x302ec6);}(_0xa660,0x1c6));var _0x0a66=function(_0x10d56e,_0x5b499d){_0x10d56e=_0x10d56e-0x0;var _0x1fbdde=_0xa660[_0x10d56e];return _0x1fbdde;};'use strict';var Sequelize=require(_0x0a66('0x0'));module[_0x0a66('0x1')]={'uniqueid':{'type':Sequelize[_0x0a66('0x2')]},'body':{'type':Sequelize['TEXT'](_0x0a66('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x0a66('0x4')]('in',_0x0a66('0x5')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x0a66('0x6')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index a5127b7..65cce7f 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 _0xa347=['sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','send','index','SquareMessage','rawAttributes','fieldName','type','model','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','map','merge','includeAll','include','findAll','rows','show','params','keys','intersection','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0xa347,0x19f));var _0x7a34=function(_0xbebf50,_0x44ec09){_0xbebf50=_0xbebf50-0x0;var _0xce1496=_0xa347[_0xbebf50];return _0xce1496;};'use strict';var emlformat=require(_0x7a34('0x0'));var rimraf=require(_0x7a34('0x1'));var zipdir=require(_0x7a34('0x2'));var jsonpatch=require(_0x7a34('0x3'));var rp=require('request-promise');var moment=require(_0x7a34('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7a34('0x5'));var util=require(_0x7a34('0x6'));var path=require('path');var sox=require(_0x7a34('0x7'));var csv=require(_0x7a34('0x8'));var ejs=require(_0x7a34('0x9'));var fs=require('fs');var fs_extra=require(_0x7a34('0xa'));var _=require(_0x7a34('0xb'));var squel=require(_0x7a34('0xc'));var crypto=require(_0x7a34('0xd'));var jsforce=require(_0x7a34('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7a34('0x8'));var querystring=require(_0x7a34('0xf'));var Papa=require(_0x7a34('0x10'));var Redis=require('ioredis');var authService=require(_0x7a34('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7a34('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7a34('0x13'))(_0x7a34('0x14'));var utils=require(_0x7a34('0x15'));var config=require(_0x7a34('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3cd5bf,_0x150a81){_0x150a81=_0x150a81||0xcc;return function(_0x4ab470){if(_0x4ab470){return _0x3cd5bf[_0x7a34('0x17')](_0x150a81);}return _0x3cd5bf[_0x7a34('0x18')](_0x150a81)[_0x7a34('0x19')]();};}function respondWithResult(_0x5b3bb7,_0x5f0292){_0x5f0292=_0x5f0292||0xc8;return function(_0x32bbf2){if(_0x32bbf2){return _0x5b3bb7['status'](_0x5f0292)[_0x7a34('0x1a')](_0x32bbf2);}};}function respondWithFilteredResult(_0x5333ae,_0x41cc77){return function(_0x322c9b){if(_0x322c9b){var _0x17824b=typeof _0x41cc77[_0x7a34('0x1b')]===_0x7a34('0x1c')&&typeof _0x41cc77[_0x7a34('0x1d')]===_0x7a34('0x1c');var _0x3ab9a0=_0x322c9b['count'];var _0x5e197d=_0x17824b?0x0:_0x41cc77[_0x7a34('0x1b')];var _0x377b21=_0x17824b?_0x322c9b[_0x7a34('0x1e')]:_0x41cc77[_0x7a34('0x1b')]+_0x41cc77[_0x7a34('0x1d')];var _0x956a0c;if(_0x377b21>=_0x3ab9a0){_0x377b21=_0x3ab9a0;_0x956a0c=0xc8;}else{_0x956a0c=0xce;}_0x5333ae['status'](_0x956a0c);return _0x5333ae[_0x7a34('0x1f')](_0x7a34('0x20'),_0x5e197d+'-'+_0x377b21+'/'+_0x3ab9a0)[_0x7a34('0x1a')](_0x322c9b);}return null;};}function patchUpdates(_0x1b4325){return function(_0x59857e){try{jsonpatch[_0x7a34('0x21')](_0x59857e,_0x1b4325,!![]);}catch(_0x467797){return BPromise['reject'](_0x467797);}return _0x59857e[_0x7a34('0x22')]();};}function saveUpdates(_0x50a492,_0x1fea69){return function(_0x154a41){if(_0x154a41){return _0x154a41[_0x7a34('0x23')](_0x50a492)[_0x7a34('0x24')](function(_0x512478){return _0x512478;});}return null;};}function removeEntity(_0x843b46,_0x4417dc){return function(_0x3a0f07){if(_0x3a0f07){return _0x3a0f07[_0x7a34('0x25')]()[_0x7a34('0x24')](function(){_0x843b46[_0x7a34('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x241e59,_0x4816c3){return function(_0x2b6b15){if(!_0x2b6b15){_0x241e59[_0x7a34('0x17')](0x194);}return _0x2b6b15;};}function handleError(_0x22684b,_0x5c2e48){_0x5c2e48=_0x5c2e48||0x1f4;return function(_0x2f219b){logger[_0x7a34('0x26')](_0x2f219b[_0x7a34('0x27')]);if(_0x2f219b['name']){delete _0x2f219b['name'];}_0x22684b['status'](_0x5c2e48)[_0x7a34('0x28')](_0x2f219b);};}exports[_0x7a34('0x29')]=function(_0x2c95d3,_0x2af13a){var _0x513655={},_0x52366={},_0x45a2e1={'count':0x0,'rows':[]};var _0x4d1979=_['map'](db[_0x7a34('0x2a')][_0x7a34('0x2b')],function(_0x11f831){return{'name':_0x11f831[_0x7a34('0x2c')],'type':_0x11f831[_0x7a34('0x2d')]['key']};});_0x52366[_0x7a34('0x2e')]=_['map'](_0x4d1979,'name');_0x52366[_0x7a34('0x2f')]=_['keys'](_0x2c95d3['query']);_0x52366[_0x7a34('0x30')]=_['intersection'](_0x52366[_0x7a34('0x2e')],_0x52366[_0x7a34('0x2f')]);_0x513655['attributes']=_['intersection'](_0x52366[_0x7a34('0x2e')],qs[_0x7a34('0x31')](_0x2c95d3[_0x7a34('0x2f')][_0x7a34('0x31')]));_0x513655[_0x7a34('0x32')]=_0x513655[_0x7a34('0x32')][_0x7a34('0x33')]?_0x513655[_0x7a34('0x32')]:_0x52366[_0x7a34('0x2e')];if(!_0x2c95d3[_0x7a34('0x2f')][_0x7a34('0x34')](_0x7a34('0x35'))){_0x513655[_0x7a34('0x1d')]=qs[_0x7a34('0x1d')](_0x2c95d3[_0x7a34('0x2f')][_0x7a34('0x1d')]);_0x513655[_0x7a34('0x1b')]=qs['offset'](_0x2c95d3[_0x7a34('0x2f')][_0x7a34('0x1b')]);}_0x513655[_0x7a34('0x36')]=qs[_0x7a34('0x37')](_0x2c95d3[_0x7a34('0x2f')][_0x7a34('0x37')]);_0x513655['where']=qs[_0x7a34('0x30')](_[_0x7a34('0x38')](_0x2c95d3['query'],_0x52366[_0x7a34('0x30')]),_0x4d1979);if(_0x2c95d3[_0x7a34('0x2f')][_0x7a34('0x39')]){_0x513655[_0x7a34('0x3a')]=_['merge'](_0x513655[_0x7a34('0x3a')],{'$or':_[_0x7a34('0x3b')](_0x4d1979,function(_0x2398a6){if(_0x2398a6[_0x7a34('0x2d')]!=='VIRTUAL'){var _0xb36f24={};_0xb36f24[_0x2398a6['name']]={'$like':'%'+_0x2c95d3[_0x7a34('0x2f')][_0x7a34('0x39')]+'%'};return _0xb36f24;}})});}_0x513655=_[_0x7a34('0x3c')]({},_0x513655,_0x2c95d3['options']);var _0x45b6fc={'where':_0x513655[_0x7a34('0x3a')]};return db[_0x7a34('0x2a')][_0x7a34('0x1e')](_0x45b6fc)[_0x7a34('0x24')](function(_0x1b098f){_0x45a2e1['count']=_0x1b098f;if(_0x2c95d3[_0x7a34('0x2f')][_0x7a34('0x3d')]){_0x513655[_0x7a34('0x3e')]=[{'all':!![]}];}return db[_0x7a34('0x2a')][_0x7a34('0x3f')](_0x513655);})[_0x7a34('0x24')](function(_0x4b7346){_0x45a2e1[_0x7a34('0x40')]=_0x4b7346;return _0x45a2e1;})[_0x7a34('0x24')](respondWithFilteredResult(_0x2af13a,_0x513655))['catch'](handleError(_0x2af13a,null));};exports[_0x7a34('0x41')]=function(_0x3bfd9f,_0x4c7c16){var _0x293b3a={'raw':!![],'where':{'id':_0x3bfd9f[_0x7a34('0x42')]['id']}},_0x5b5709={};_0x5b5709['model']=_[_0x7a34('0x43')](db[_0x7a34('0x2a')][_0x7a34('0x2b')]);_0x5b5709['query']=_[_0x7a34('0x43')](_0x3bfd9f[_0x7a34('0x2f')]);_0x5b5709['filters']=_[_0x7a34('0x44')](_0x5b5709[_0x7a34('0x2e')],_0x5b5709[_0x7a34('0x2f')]);_0x293b3a[_0x7a34('0x32')]=_['intersection'](_0x5b5709[_0x7a34('0x2e')],qs[_0x7a34('0x31')](_0x3bfd9f[_0x7a34('0x2f')][_0x7a34('0x31')]));_0x293b3a[_0x7a34('0x32')]=_0x293b3a[_0x7a34('0x32')]['length']?_0x293b3a[_0x7a34('0x32')]:_0x5b5709[_0x7a34('0x2e')];if(_0x3bfd9f[_0x7a34('0x2f')][_0x7a34('0x3d')]){_0x293b3a[_0x7a34('0x3e')]=[{'all':!![]}];}_0x293b3a=_['merge']({},_0x293b3a,_0x3bfd9f['options']);return db[_0x7a34('0x2a')]['find'](_0x293b3a)[_0x7a34('0x24')](handleEntityNotFound(_0x4c7c16,null))[_0x7a34('0x24')](respondWithResult(_0x4c7c16,null))[_0x7a34('0x45')](handleError(_0x4c7c16,null));};exports[_0x7a34('0x46')]=function(_0x549844,_0x1b4550){return db[_0x7a34('0x2a')]['create'](_0x549844[_0x7a34('0x47')],{})[_0x7a34('0x24')](respondWithResult(_0x1b4550,0xc9))[_0x7a34('0x45')](handleError(_0x1b4550,null));};exports[_0x7a34('0x23')]=function(_0x3a7159,_0x4d3f35){if(_0x3a7159[_0x7a34('0x47')]['id']){delete _0x3a7159[_0x7a34('0x47')]['id'];}return db[_0x7a34('0x2a')][_0x7a34('0x48')]({'where':{'id':_0x3a7159[_0x7a34('0x42')]['id']}})[_0x7a34('0x24')](handleEntityNotFound(_0x4d3f35,null))['then'](saveUpdates(_0x3a7159[_0x7a34('0x47')],null))[_0x7a34('0x24')](respondWithResult(_0x4d3f35,null))[_0x7a34('0x45')](handleError(_0x4d3f35,null));};exports[_0x7a34('0x25')]=function(_0x83426a,_0x3187d3){return db[_0x7a34('0x2a')][_0x7a34('0x48')]({'where':{'id':_0x83426a[_0x7a34('0x42')]['id']}})[_0x7a34('0x24')](handleEntityNotFound(_0x3187d3,null))[_0x7a34('0x24')](removeEntity(_0x3187d3,null))[_0x7a34('0x45')](handleError(_0x3187d3,null));}; \ No newline at end of file +var _0xa400=['model','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','SquareMessage','findAll','rows','catch','show','params','intersection','find','create','body','eml-format','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','filters'];(function(_0x725b8e,_0xc22b48){var _0x43ac45=function(_0x46bb4a){while(--_0x46bb4a){_0x725b8e['push'](_0x725b8e['shift']());}};_0x43ac45(++_0xc22b48);}(_0xa400,0x1cf));var _0x0a40=function(_0x98fb33,_0x3e1219){_0x98fb33=_0x98fb33-0x0;var _0x3f8a0e=_0xa400[_0x98fb33];return _0x3f8a0e;};'use strict';var emlformat=require(_0x0a40('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a40('0x1'));var moment=require(_0x0a40('0x2'));var BPromise=require(_0x0a40('0x3'));var Mustache=require(_0x0a40('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x0a40('0x5'));var ejs=require(_0x0a40('0x6'));var fs=require('fs');var fs_extra=require(_0x0a40('0x7'));var _=require(_0x0a40('0x8'));var squel=require(_0x0a40('0x9'));var crypto=require(_0x0a40('0xa'));var jsforce=require(_0x0a40('0xb'));var deskjs=require(_0x0a40('0xc'));var toCsv=require(_0x0a40('0x5'));var querystring=require(_0x0a40('0xd'));var Papa=require(_0x0a40('0xe'));var Redis=require('ioredis');var authService=require(_0x0a40('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x0a40('0x10'));var hardwareService=require(_0x0a40('0x11'));var logger=require(_0x0a40('0x12'))(_0x0a40('0x13'));var utils=require(_0x0a40('0x14'));var config=require(_0x0a40('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x0a40('0x16'))['db'];function respondWithStatusCode(_0x9bb5a,_0x20312f){_0x20312f=_0x20312f||0xcc;return function(_0x26386f){if(_0x26386f){return _0x9bb5a[_0x0a40('0x17')](_0x20312f);}return _0x9bb5a[_0x0a40('0x18')](_0x20312f)[_0x0a40('0x19')]();};}function respondWithResult(_0x261342,_0x50fcee){_0x50fcee=_0x50fcee||0xc8;return function(_0x4fb0c1){if(_0x4fb0c1){return _0x261342[_0x0a40('0x18')](_0x50fcee)[_0x0a40('0x1a')](_0x4fb0c1);}};}function respondWithFilteredResult(_0x10de6d,_0x229136){return function(_0x547dd7){if(_0x547dd7){var _0x256289=typeof _0x229136[_0x0a40('0x1b')]===_0x0a40('0x1c')&&typeof _0x229136[_0x0a40('0x1d')]==='undefined';var _0xe9e2e1=_0x547dd7[_0x0a40('0x1e')];var _0x5ada4e=_0x256289?0x0:_0x229136['offset'];var _0x95dbbc=_0x256289?_0x547dd7[_0x0a40('0x1e')]:_0x229136[_0x0a40('0x1b')]+_0x229136[_0x0a40('0x1d')];var _0xc2e5af;if(_0x95dbbc>=_0xe9e2e1){_0x95dbbc=_0xe9e2e1;_0xc2e5af=0xc8;}else{_0xc2e5af=0xce;}_0x10de6d[_0x0a40('0x18')](_0xc2e5af);return _0x10de6d[_0x0a40('0x1f')](_0x0a40('0x20'),_0x5ada4e+'-'+_0x95dbbc+'/'+_0xe9e2e1)[_0x0a40('0x1a')](_0x547dd7);}return null;};}function patchUpdates(_0x2b0927){return function(_0x2e7c1f){try{jsonpatch[_0x0a40('0x21')](_0x2e7c1f,_0x2b0927,!![]);}catch(_0x11704e){return BPromise[_0x0a40('0x22')](_0x11704e);}return _0x2e7c1f['save']();};}function saveUpdates(_0x7ff4a9,_0x10e3cf){return function(_0x487045){if(_0x487045){return _0x487045[_0x0a40('0x23')](_0x7ff4a9)['then'](function(_0x4a5def){return _0x4a5def;});}return null;};}function removeEntity(_0x3f7e8b,_0x278c52){return function(_0x5989cb){if(_0x5989cb){return _0x5989cb[_0x0a40('0x24')]()['then'](function(){_0x3f7e8b['status'](0xcc)[_0x0a40('0x19')]();});}};}function handleEntityNotFound(_0x4004d1,_0x2c4382){return function(_0x4cb959){if(!_0x4cb959){_0x4004d1[_0x0a40('0x17')](0x194);}return _0x4cb959;};}function handleError(_0x3b682e,_0x41c4d8){_0x41c4d8=_0x41c4d8||0x1f4;return function(_0x5dd9ec){logger['error'](_0x5dd9ec[_0x0a40('0x25')]);if(_0x5dd9ec['name']){delete _0x5dd9ec[_0x0a40('0x26')];}_0x3b682e[_0x0a40('0x18')](_0x41c4d8)['send'](_0x5dd9ec);};}exports[_0x0a40('0x27')]=function(_0x4b014c,_0x1c39a1){var _0x549872={},_0x949f00={},_0x3f38b7={'count':0x0,'rows':[]};var _0x3361c8=_[_0x0a40('0x28')](db['SquareMessage'][_0x0a40('0x29')],function(_0x2b2ea0){return{'name':_0x2b2ea0[_0x0a40('0x2a')],'type':_0x2b2ea0[_0x0a40('0x2b')][_0x0a40('0x2c')]};});_0x949f00['model']=_[_0x0a40('0x28')](_0x3361c8,_0x0a40('0x26'));_0x949f00[_0x0a40('0x2d')]=_[_0x0a40('0x2e')](_0x4b014c['query']);_0x949f00[_0x0a40('0x2f')]=_['intersection'](_0x949f00[_0x0a40('0x30')],_0x949f00[_0x0a40('0x2d')]);_0x549872['attributes']=_['intersection'](_0x949f00[_0x0a40('0x30')],qs[_0x0a40('0x31')](_0x4b014c['query'][_0x0a40('0x31')]));_0x549872['attributes']=_0x549872['attributes']['length']?_0x549872[_0x0a40('0x32')]:_0x949f00[_0x0a40('0x30')];if(!_0x4b014c[_0x0a40('0x2d')][_0x0a40('0x33')]('nolimit')){_0x549872[_0x0a40('0x1d')]=qs['limit'](_0x4b014c[_0x0a40('0x2d')][_0x0a40('0x1d')]);_0x549872['offset']=qs[_0x0a40('0x1b')](_0x4b014c[_0x0a40('0x2d')][_0x0a40('0x1b')]);}_0x549872[_0x0a40('0x34')]=qs[_0x0a40('0x35')](_0x4b014c[_0x0a40('0x2d')]['sort']);_0x549872[_0x0a40('0x36')]=qs[_0x0a40('0x2f')](_[_0x0a40('0x37')](_0x4b014c[_0x0a40('0x2d')],_0x949f00[_0x0a40('0x2f')]),_0x3361c8);if(_0x4b014c[_0x0a40('0x2d')][_0x0a40('0x38')]){_0x549872[_0x0a40('0x36')]=_[_0x0a40('0x39')](_0x549872[_0x0a40('0x36')],{'$or':_['map'](_0x3361c8,function(_0x5f45e6){if(_0x5f45e6[_0x0a40('0x2b')]!==_0x0a40('0x3a')){var _0x5671ad={};_0x5671ad[_0x5f45e6[_0x0a40('0x26')]]={'$like':'%'+_0x4b014c['query'][_0x0a40('0x38')]+'%'};return _0x5671ad;}})});}_0x549872=_[_0x0a40('0x39')]({},_0x549872,_0x4b014c[_0x0a40('0x3b')]);var _0x2e1367={'where':_0x549872[_0x0a40('0x36')]};return db['SquareMessage']['count'](_0x2e1367)[_0x0a40('0x3c')](function(_0x4dfda9){_0x3f38b7[_0x0a40('0x1e')]=_0x4dfda9;if(_0x4b014c[_0x0a40('0x2d')][_0x0a40('0x3d')]){_0x549872[_0x0a40('0x3e')]=[{'all':!![]}];}return db[_0x0a40('0x3f')][_0x0a40('0x40')](_0x549872);})[_0x0a40('0x3c')](function(_0x22dbf4){_0x3f38b7[_0x0a40('0x41')]=_0x22dbf4;return _0x3f38b7;})[_0x0a40('0x3c')](respondWithFilteredResult(_0x1c39a1,_0x549872))[_0x0a40('0x42')](handleError(_0x1c39a1,null));};exports[_0x0a40('0x43')]=function(_0x3ac9a1,_0x542cda){var _0x3ae73b={'raw':!![],'where':{'id':_0x3ac9a1[_0x0a40('0x44')]['id']}},_0xbdfadb={};_0xbdfadb[_0x0a40('0x30')]=_[_0x0a40('0x2e')](db['SquareMessage']['rawAttributes']);_0xbdfadb['query']=_['keys'](_0x3ac9a1['query']);_0xbdfadb[_0x0a40('0x2f')]=_[_0x0a40('0x45')](_0xbdfadb[_0x0a40('0x30')],_0xbdfadb['query']);_0x3ae73b[_0x0a40('0x32')]=_[_0x0a40('0x45')](_0xbdfadb[_0x0a40('0x30')],qs[_0x0a40('0x31')](_0x3ac9a1[_0x0a40('0x2d')][_0x0a40('0x31')]));_0x3ae73b[_0x0a40('0x32')]=_0x3ae73b[_0x0a40('0x32')]['length']?_0x3ae73b[_0x0a40('0x32')]:_0xbdfadb['model'];if(_0x3ac9a1[_0x0a40('0x2d')][_0x0a40('0x3d')]){_0x3ae73b[_0x0a40('0x3e')]=[{'all':!![]}];}_0x3ae73b=_[_0x0a40('0x39')]({},_0x3ae73b,_0x3ac9a1['options']);return db[_0x0a40('0x3f')][_0x0a40('0x46')](_0x3ae73b)['then'](handleEntityNotFound(_0x542cda,null))[_0x0a40('0x3c')](respondWithResult(_0x542cda,null))[_0x0a40('0x42')](handleError(_0x542cda,null));};exports[_0x0a40('0x47')]=function(_0x5e3378,_0x4c0116){return db[_0x0a40('0x3f')]['create'](_0x5e3378[_0x0a40('0x48')],{})[_0x0a40('0x3c')](respondWithResult(_0x4c0116,0xc9))[_0x0a40('0x42')](handleError(_0x4c0116,null));};exports[_0x0a40('0x23')]=function(_0x232b17,_0x28a3fe){if(_0x232b17[_0x0a40('0x48')]['id']){delete _0x232b17[_0x0a40('0x48')]['id'];}return db[_0x0a40('0x3f')][_0x0a40('0x46')]({'where':{'id':_0x232b17['params']['id']}})[_0x0a40('0x3c')](handleEntityNotFound(_0x28a3fe,null))['then'](saveUpdates(_0x232b17[_0x0a40('0x48')],null))['then'](respondWithResult(_0x28a3fe,null))[_0x0a40('0x42')](handleError(_0x28a3fe,null));};exports['destroy']=function(_0x4e7e54,_0x399412){return db[_0x0a40('0x3f')][_0x0a40('0x46')]({'where':{'id':_0x4e7e54[_0x0a40('0x44')]['id']}})['then'](handleEntityNotFound(_0x399412,null))[_0x0a40('0x3c')](removeEntity(_0x399412,null))[_0x0a40('0x42')](handleError(_0x399412,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 1df22c6..74dddd4 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 _0xebdc=['../../config/environment','./squareMessage.attributes','exports','SquareMessage','square_messages','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x3ef541,_0x5ea747){var _0x5ce532=function(_0xa2c460){while(--_0xa2c460){_0x3ef541['push'](_0x3ef541['shift']());}};_0x5ce532(++_0x5ea747);}(_0xebdc,0x1f1));var _0xcebd=function(_0x596b18,_0x1b1710){_0x596b18=_0x596b18-0x0;var _0x54e188=_0xebdc[_0x596b18];return _0x54e188;};'use strict';var _=require(_0xcebd('0x0'));var util=require('util');var logger=require(_0xcebd('0x1'))(_0xcebd('0x2'));var moment=require(_0xcebd('0x3'));var BPromise=require(_0xcebd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcebd('0x5'));var rimraf=require(_0xcebd('0x6'));var config=require(_0xcebd('0x7'));var attributes=require(_0xcebd('0x8'));module[_0xcebd('0x9')]=function(_0x1aa4ba,_0x53ad2c){return _0x1aa4ba['define'](_0xcebd('0xa'),attributes,{'tableName':_0xcebd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6e45=['moment','request-promise','path','rimraf','../../config/environment','exports','define','SquareMessage','square_messages','lodash','util','../../config/logger','api'];(function(_0x527b46,_0x45722b){var _0x451e51=function(_0x293d81){while(--_0x293d81){_0x527b46['push'](_0x527b46['shift']());}};_0x451e51(++_0x45722b);}(_0x6e45,0x71));var _0x56e4=function(_0xb76fdd,_0x4cf90b){_0xb76fdd=_0xb76fdd-0x0;var _0x17b046=_0x6e45[_0xb76fdd];return _0x17b046;};'use strict';var _=require(_0x56e4('0x0'));var util=require(_0x56e4('0x1'));var logger=require(_0x56e4('0x2'))(_0x56e4('0x3'));var moment=require(_0x56e4('0x4'));var BPromise=require('bluebird');var rp=require(_0x56e4('0x5'));var fs=require('fs');var path=require(_0x56e4('0x6'));var rimraf=require(_0x56e4('0x7'));var config=require(_0x56e4('0x8'));var attributes=require('./squareMessage.attributes');module[_0x56e4('0x9')]=function(_0x5d5b03,_0x3851d6){return _0x5d5b03[_0x56e4('0xa')](_0x56e4('0xb'),attributes,{'tableName':_0x56e4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 2c0e0e7..953d4df 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 _0x27a1=['info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','create','body','options','raw','CreateSquareMessage','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x134f1d,_0x367cff){var _0x1b097d=function(_0x1775e7){while(--_0x1775e7){_0x134f1d['push'](_0x134f1d['shift']());}};_0x1b097d(++_0x367cff);}(_0x27a1,0x196));var _0x127a=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x27a1[_0x42bdad];return _0x122626;};'use strict';var _=require(_0x127a('0x0'));var util=require(_0x127a('0x1'));var moment=require(_0x127a('0x2'));var BPromise=require(_0x127a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x127a('0x4'));var db=require(_0x127a('0x5'))['db'];var utils=require(_0x127a('0x6'));var logger=require(_0x127a('0x7'))(_0x127a('0x8'));var config=require(_0x127a('0x9'));var jayson=require(_0x127a('0xa'));var client=jayson[_0x127a('0xb')][_0x127a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2378ae,_0x3161a1,_0x11c9ed){return new BPromise(function(_0x4dab2d,_0x1382ee){return client[_0x127a('0xd')](_0x2378ae,_0x11c9ed)['then'](function(_0x341a70){logger[_0x127a('0xe')](_0x127a('0xf'),_0x3161a1,_0x127a('0x10'));logger[_0x127a('0x11')](_0x127a('0x12'),_0x3161a1,_0x127a('0x10'),JSON[_0x127a('0x13')](_0x341a70));if(_0x341a70['error']){if(_0x341a70[_0x127a('0x14')][_0x127a('0x15')]===0x1f4){logger[_0x127a('0x14')](_0x127a('0xf'),_0x3161a1,_0x341a70['error'][_0x127a('0x16')]);return _0x1382ee(_0x341a70[_0x127a('0x14')]['message']);}logger[_0x127a('0x14')](_0x127a('0xf'),_0x3161a1,_0x341a70[_0x127a('0x14')][_0x127a('0x16')]);return _0x4dab2d(_0x341a70[_0x127a('0x14')]['message']);}else{logger[_0x127a('0xe')](_0x127a('0xf'),_0x3161a1,_0x127a('0x10'));_0x4dab2d(_0x341a70[_0x127a('0x17')][_0x127a('0x16')]);}})[_0x127a('0x18')](function(_0x3ea9e0){logger[_0x127a('0x14')]('SquareMessage,\x20%s,\x20%s',_0x3161a1,_0x3ea9e0);_0x1382ee(_0x3ea9e0);});});}exports['CreateSquareMessage']=function(_0xed2601){var _0x4d1242=this;return new Promise(function(_0x1fb8ff,_0x4ed24a){return db['SquareMessage'][_0x127a('0x19')](_0xed2601[_0x127a('0x1a')],{'raw':_0xed2601[_0x127a('0x1b')]?_0xed2601['options'][_0x127a('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x1f0aa0){logger['info'](_0x127a('0x1d'),_0xed2601);logger[_0x127a('0x11')](_0x127a('0x1d'),_0xed2601,JSON['stringify'](_0x1f0aa0));_0x1fb8ff(_0x1f0aa0);})[_0x127a('0x18')](function(_0x4942e3){logger['error']('CreateSquareMessage',_0x4942e3[_0x127a('0x16')],_0xed2601);_0x4ed24a(_0x4d1242[_0x127a('0x14')](0x1f4,_0x4942e3[_0x127a('0x16')]));});});}; \ No newline at end of file +var _0xa4d5=['raw','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SquareMessage,\x20%s,\x20%s','debug','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateSquareMessage','SquareMessage','body','options'];(function(_0x223bdb,_0x5882e6){var _0xef8e68=function(_0x55ab83){while(--_0x55ab83){_0x223bdb['push'](_0x223bdb['shift']());}};_0xef8e68(++_0x5882e6);}(_0xa4d5,0x119));var _0x5a4d=function(_0x2439a9,_0x24e87f){_0x2439a9=_0x2439a9-0x0;var _0x591552=_0xa4d5[_0x2439a9];return _0x591552;};'use strict';var _=require(_0x5a4d('0x0'));var util=require('util');var moment=require(_0x5a4d('0x1'));var BPromise=require(_0x5a4d('0x2'));var rs=require(_0x5a4d('0x3'));var fs=require('fs');var Redis=require(_0x5a4d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5a4d('0x5'));var logger=require(_0x5a4d('0x6'))(_0x5a4d('0x7'));var config=require('../../config/environment');var jayson=require(_0x5a4d('0x8'));var client=jayson[_0x5a4d('0x9')][_0x5a4d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x395960,_0x27b000,_0x11bd0d){return new BPromise(function(_0x2878b5,_0x59a745){return client[_0x5a4d('0xb')](_0x395960,_0x11bd0d)[_0x5a4d('0xc')](function(_0x1562f1){logger[_0x5a4d('0xd')](_0x5a4d('0xe'),_0x27b000,'request\x20sent');logger[_0x5a4d('0xf')](_0x5a4d('0x10'),_0x27b000,_0x5a4d('0x11'),JSON[_0x5a4d('0x12')](_0x1562f1));if(_0x1562f1[_0x5a4d('0x13')]){if(_0x1562f1[_0x5a4d('0x13')][_0x5a4d('0x14')]===0x1f4){logger[_0x5a4d('0x13')](_0x5a4d('0xe'),_0x27b000,_0x1562f1[_0x5a4d('0x13')]['message']);return _0x59a745(_0x1562f1[_0x5a4d('0x13')][_0x5a4d('0x15')]);}logger[_0x5a4d('0x13')](_0x5a4d('0xe'),_0x27b000,_0x1562f1['error'][_0x5a4d('0x15')]);return _0x2878b5(_0x1562f1['error'][_0x5a4d('0x15')]);}else{logger[_0x5a4d('0xd')](_0x5a4d('0xe'),_0x27b000,_0x5a4d('0x11'));_0x2878b5(_0x1562f1['result']['message']);}})[_0x5a4d('0x16')](function(_0x19cb51){logger[_0x5a4d('0x13')]('SquareMessage,\x20%s,\x20%s',_0x27b000,_0x19cb51);_0x59a745(_0x19cb51);});});}exports[_0x5a4d('0x17')]=function(_0x1572c6){var _0x5c1acb=this;return new Promise(function(_0x1fde96,_0x5b3a32){return db[_0x5a4d('0x18')]['create'](_0x1572c6[_0x5a4d('0x19')],{'raw':_0x1572c6[_0x5a4d('0x1a')]?_0x1572c6['options'][_0x5a4d('0x1b')]===undefined?!![]:![]:!![]})[_0x5a4d('0xc')](function(_0x1649c3){logger[_0x5a4d('0xd')](_0x5a4d('0x17'),_0x1572c6);logger[_0x5a4d('0xf')](_0x5a4d('0x17'),_0x1572c6,JSON['stringify'](_0x1649c3));_0x1fde96(_0x1649c3);})[_0x5a4d('0x16')](function(_0x518b29){logger[_0x5a4d('0x13')](_0x5a4d('0x17'),_0x518b29[_0x5a4d('0x15')],_0x1572c6);_0x5b3a32(_0x5c1acb[_0x5a4d('0x13')](0x1f4,_0x518b29[_0x5a4d('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 5f7d673..c89b6b6 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 _0xa209=['./squareOdbc.controller','get','isAuthenticated','/:id','15s','post','create','delete','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service'];(function(_0x32f08e,_0x53860c){var _0x1300e5=function(_0x314c51){while(--_0x314c51){_0x32f08e['push'](_0x32f08e['shift']());}};_0x1300e5(++_0x53860c);}(_0xa209,0xae));var _0x9a20=function(_0x10be55,_0x6310d5){_0x10be55=_0x10be55-0x0;var _0x547a7d=_0xa209[_0x10be55];return _0x547a7d;};'use strict';var multer=require(_0x9a20('0x0'));var util=require(_0x9a20('0x1'));var path=require(_0x9a20('0x2'));var timeout=require(_0x9a20('0x3'));var express=require('express');var router=express[_0x9a20('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9a20('0x5'));var config=require('../../config/environment');var controller=require(_0x9a20('0x6'));router[_0x9a20('0x7')]('/',auth[_0x9a20('0x8')](),controller['index']);router['get'](_0x9a20('0x9'),auth[_0x9a20('0x8')](),controller['show']);router[_0x9a20('0x7')]('/:id/test',auth[_0x9a20('0x8')](),timeout(_0x9a20('0xa')),controller['test']);router[_0x9a20('0xb')]('/',auth['isAuthenticated'](),controller[_0x9a20('0xc')]);router['put'](_0x9a20('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x9a20('0xd')](_0x9a20('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x9a20('0xe')]=router; \ No newline at end of file +var _0xcb0a=['isAuthenticated','index','/:id','show','15s','test','post','put','update','delete','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x37ed06,_0x3b43f0){var _0x30c5a5=function(_0x5a9a81){while(--_0x5a9a81){_0x37ed06['push'](_0x37ed06['shift']());}};_0x30c5a5(++_0x3b43f0);}(_0xcb0a,0x1c3));var _0xacb0=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xcb0a[_0xefd519];return _0x4bb882;};'use strict';var multer=require(_0xacb0('0x0'));var util=require(_0xacb0('0x1'));var path=require(_0xacb0('0x2'));var timeout=require('connect-timeout');var express=require(_0xacb0('0x3'));var router=express['Router']();var fs_extra=require(_0xacb0('0x4'));var auth=require(_0xacb0('0x5'));var interaction=require(_0xacb0('0x6'));var config=require(_0xacb0('0x7'));var controller=require('./squareOdbc.controller');router[_0xacb0('0x8')]('/',auth[_0xacb0('0x9')](),controller[_0xacb0('0xa')]);router[_0xacb0('0x8')](_0xacb0('0xb'),auth[_0xacb0('0x9')](),controller[_0xacb0('0xc')]);router[_0xacb0('0x8')]('/:id/test',auth[_0xacb0('0x9')](),timeout(_0xacb0('0xd')),controller[_0xacb0('0xe')]);router[_0xacb0('0xf')]('/',auth[_0xacb0('0x9')](),controller['create']);router[_0xacb0('0x10')](_0xacb0('0xb'),auth[_0xacb0('0x9')](),controller[_0xacb0('0x11')]);router[_0xacb0('0x12')](_0xacb0('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xacb0('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 9f7b0e0..5af8299 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 _0xc135=['sequelize','exports','STRING','name'];(function(_0x49baf1,_0x3538e5){var _0x557e61=function(_0x177f40){while(--_0x177f40){_0x49baf1['push'](_0x49baf1['shift']());}};_0x557e61(++_0x3538e5);}(_0xc135,0x12c));var _0x5c13=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xc135[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x5c13('0x0'));module[_0x5c13('0x1')]={'name':{'type':Sequelize[_0x5c13('0x2')],'unique':_0x5c13('0x3'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5c13('0x2')]}}; \ No newline at end of file +var _0x5c9a=['name','sequelize','exports','STRING'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x5c9a,0xb1));var _0xa5c9=function(_0x9edfd5,_0x286486){_0x9edfd5=_0x9edfd5-0x0;var _0x330738=_0x5c9a[_0x9edfd5];return _0x330738;};'use strict';var Sequelize=require(_0xa5c9('0x0'));module[_0xa5c9('0x1')]={'name':{'type':Sequelize[_0xa5c9('0x2')],'unique':_0xa5c9('0x3'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa5c9('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 9ca2145..85ea9db 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 _0x48a6=['create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ODBC','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','test','dsn','odbc','closeSync','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','name','send','index','map','SquareOdbc','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','include','rows','catch','includeAll','options','find'];(function(_0x125ff9,_0x10c858){var _0x4ee346=function(_0x1200ac){while(--_0x1200ac){_0x125ff9['push'](_0x125ff9['shift']());}};_0x4ee346(++_0x10c858);}(_0x48a6,0x10b));var _0x648a=function(_0x19c57a,_0x5c9c7c){_0x19c57a=_0x19c57a-0x0;var _0x576a08=_0x48a6[_0x19c57a];return _0x576a08;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x648a('0x0'));var jsonpatch=require(_0x648a('0x1'));var rp=require(_0x648a('0x2'));var moment=require('moment');var BPromise=require(_0x648a('0x3'));var Mustache=require(_0x648a('0x4'));var util=require(_0x648a('0x5'));var path=require(_0x648a('0x6'));var sox=require(_0x648a('0x7'));var csv=require('to-csv');var ejs=require(_0x648a('0x8'));var fs=require('fs');var fs_extra=require(_0x648a('0x9'));var _=require(_0x648a('0xa'));var squel=require(_0x648a('0xb'));var crypto=require(_0x648a('0xc'));var jsforce=require(_0x648a('0xd'));var deskjs=require(_0x648a('0xe'));var toCsv=require(_0x648a('0xf'));var querystring=require(_0x648a('0x10'));var Papa=require(_0x648a('0x11'));var Redis=require(_0x648a('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x648a('0x13'));var logger=require(_0x648a('0x14'))('api');var utils=require(_0x648a('0x15'));var config=require(_0x648a('0x16'));var licenseUtil=require(_0x648a('0x17'));var db=require(_0x648a('0x18'))['db'];function respondWithStatusCode(_0xde430,_0x36da2f){_0x36da2f=_0x36da2f||0xcc;return function(_0x26cf30){if(_0x26cf30){return _0xde430[_0x648a('0x19')](_0x36da2f);}return _0xde430[_0x648a('0x1a')](_0x36da2f)[_0x648a('0x1b')]();};}function respondWithResult(_0x210fab,_0x4aee59){_0x4aee59=_0x4aee59||0xc8;return function(_0x1325df){if(_0x1325df){return _0x210fab[_0x648a('0x1a')](_0x4aee59)[_0x648a('0x1c')](_0x1325df);}};}function respondWithFilteredResult(_0x532784,_0xa783fa){return function(_0x85a326){if(_0x85a326){var _0x1cbff5=typeof _0xa783fa[_0x648a('0x1d')]===_0x648a('0x1e')&&typeof _0xa783fa[_0x648a('0x1f')]===_0x648a('0x1e');var _0x499f69=_0x85a326['count'];var _0x3061be=_0x1cbff5?0x0:_0xa783fa[_0x648a('0x1d')];var _0x103672=_0x1cbff5?_0x85a326[_0x648a('0x20')]:_0xa783fa['offset']+_0xa783fa['limit'];var _0x1ed09f;if(_0x103672>=_0x499f69){_0x103672=_0x499f69;_0x1ed09f=0xc8;}else{_0x1ed09f=0xce;}_0x532784[_0x648a('0x1a')](_0x1ed09f);return _0x532784['set'](_0x648a('0x21'),_0x3061be+'-'+_0x103672+'/'+_0x499f69)[_0x648a('0x1c')](_0x85a326);}return null;};}function patchUpdates(_0x51fcac){return function(_0x2bcd59){try{jsonpatch[_0x648a('0x22')](_0x2bcd59,_0x51fcac,!![]);}catch(_0x42cf3e){return BPromise[_0x648a('0x23')](_0x42cf3e);}return _0x2bcd59[_0x648a('0x24')]();};}function saveUpdates(_0x44d18d,_0x123ef2){return function(_0x2dd861){if(_0x2dd861){return _0x2dd861['update'](_0x44d18d)[_0x648a('0x25')](function(_0x2aa86d){return _0x2aa86d;});}return null;};}function removeEntity(_0x485087,_0x9dd89a){return function(_0x11207a){if(_0x11207a){return _0x11207a[_0x648a('0x26')]()[_0x648a('0x25')](function(){var _0x3f736f=_0x11207a[_0x648a('0x27')]({'plain':!![]});var _0x382f7e='ODBC';return db[_0x648a('0x28')][_0x648a('0x26')]({'where':{'type':_0x382f7e,'resourceId':_0x3f736f['id']}})[_0x648a('0x25')](function(){return _0x11207a;});})[_0x648a('0x25')](function(){_0x485087[_0x648a('0x1a')](0xcc)[_0x648a('0x1b')]();});}};}function handleEntityNotFound(_0x17bce0,_0x9b96f3){return function(_0x39b5e5){if(!_0x39b5e5){_0x17bce0[_0x648a('0x19')](0x194);}return _0x39b5e5;};}function handleError(_0x32e498,_0x14bdd9){_0x14bdd9=_0x14bdd9||0x1f4;return function(_0x150b32){logger['error'](_0x150b32['stack']);if(_0x150b32[_0x648a('0x29')]){delete _0x150b32[_0x648a('0x29')];}_0x32e498[_0x648a('0x1a')](_0x14bdd9)[_0x648a('0x2a')](_0x150b32);};}exports[_0x648a('0x2b')]=function(_0x1223bd,_0x50ba83){var _0x14f2db={},_0x1edc9c={},_0x40f0d8={'count':0x0,'rows':[]};var _0x1de219=_[_0x648a('0x2c')](db[_0x648a('0x2d')]['rawAttributes'],function(_0x4ff2b6){return{'name':_0x4ff2b6[_0x648a('0x2e')],'type':_0x4ff2b6[_0x648a('0x2f')][_0x648a('0x30')]};});_0x1edc9c[_0x648a('0x31')]=_[_0x648a('0x2c')](_0x1de219,_0x648a('0x29'));_0x1edc9c['query']=_[_0x648a('0x32')](_0x1223bd[_0x648a('0x33')]);_0x1edc9c[_0x648a('0x34')]=_[_0x648a('0x35')](_0x1edc9c[_0x648a('0x31')],_0x1edc9c[_0x648a('0x33')]);_0x14f2db[_0x648a('0x36')]=_[_0x648a('0x35')](_0x1edc9c[_0x648a('0x31')],qs[_0x648a('0x37')](_0x1223bd[_0x648a('0x33')]['fields']));_0x14f2db[_0x648a('0x36')]=_0x14f2db[_0x648a('0x36')][_0x648a('0x38')]?_0x14f2db['attributes']:_0x1edc9c[_0x648a('0x31')];if(!_0x1223bd[_0x648a('0x33')]['hasOwnProperty']('nolimit')){_0x14f2db[_0x648a('0x1f')]=qs[_0x648a('0x1f')](_0x1223bd[_0x648a('0x33')][_0x648a('0x1f')]);_0x14f2db[_0x648a('0x1d')]=qs['offset'](_0x1223bd[_0x648a('0x33')][_0x648a('0x1d')]);}_0x14f2db[_0x648a('0x39')]=qs['sort'](_0x1223bd[_0x648a('0x33')][_0x648a('0x3a')]);_0x14f2db[_0x648a('0x3b')]=qs['filters'](_[_0x648a('0x3c')](_0x1223bd[_0x648a('0x33')],_0x1edc9c['filters']),_0x1de219);if(_0x1223bd[_0x648a('0x33')][_0x648a('0x3d')]){_0x14f2db[_0x648a('0x3b')]=_[_0x648a('0x3e')](_0x14f2db['where'],{'$or':_[_0x648a('0x2c')](_0x1de219,function(_0x2ce810){if(_0x2ce810['type']!=='VIRTUAL'){var _0x1aaf7d={};_0x1aaf7d[_0x2ce810[_0x648a('0x29')]]={'$like':'%'+_0x1223bd['query'][_0x648a('0x3d')]+'%'};return _0x1aaf7d;}})});}_0x14f2db=_['merge']({},_0x14f2db,_0x1223bd['options']);var _0x2f6594={'where':_0x14f2db[_0x648a('0x3b')]};return db[_0x648a('0x2d')]['count'](_0x2f6594)[_0x648a('0x25')](function(_0x5dc1e4){_0x40f0d8[_0x648a('0x20')]=_0x5dc1e4;if(_0x1223bd['query']['includeAll']){_0x14f2db[_0x648a('0x3f')]=[{'all':!![]}];}return db['SquareOdbc']['findAll'](_0x14f2db);})[_0x648a('0x25')](function(_0x35fed3){_0x40f0d8[_0x648a('0x40')]=_0x35fed3;return _0x40f0d8;})[_0x648a('0x25')](respondWithFilteredResult(_0x50ba83,_0x14f2db))[_0x648a('0x41')](handleError(_0x50ba83,null));};exports['show']=function(_0xd7e055,_0x2964d1){var _0x247616={'raw':!![],'where':{'id':_0xd7e055['params']['id']}},_0x1bd2a6={};_0x1bd2a6[_0x648a('0x31')]=_[_0x648a('0x32')](db[_0x648a('0x2d')]['rawAttributes']);_0x1bd2a6[_0x648a('0x33')]=_['keys'](_0xd7e055[_0x648a('0x33')]);_0x1bd2a6[_0x648a('0x34')]=_[_0x648a('0x35')](_0x1bd2a6[_0x648a('0x31')],_0x1bd2a6['query']);_0x247616['attributes']=_[_0x648a('0x35')](_0x1bd2a6[_0x648a('0x31')],qs['fields'](_0xd7e055[_0x648a('0x33')][_0x648a('0x37')]));_0x247616[_0x648a('0x36')]=_0x247616[_0x648a('0x36')]['length']?_0x247616[_0x648a('0x36')]:_0x1bd2a6[_0x648a('0x31')];if(_0xd7e055[_0x648a('0x33')][_0x648a('0x42')]){_0x247616[_0x648a('0x3f')]=[{'all':!![]}];}_0x247616=_[_0x648a('0x3e')]({},_0x247616,_0xd7e055[_0x648a('0x43')]);return db['SquareOdbc'][_0x648a('0x44')](_0x247616)[_0x648a('0x25')](handleEntityNotFound(_0x2964d1,null))['then'](respondWithResult(_0x2964d1,null))[_0x648a('0x41')](handleError(_0x2964d1,null));};exports[_0x648a('0x45')]=function(_0x28c16e,_0x2f6e30){return db[_0x648a('0x2d')][_0x648a('0x45')](_0x28c16e[_0x648a('0x46')],{})[_0x648a('0x25')](function(_0x9068fa){var _0x52cd77=_0x28c16e[_0x648a('0x47')]['get']({'plain':!![]});if(!_0x52cd77)throw new Error(_0x648a('0x48'));if(_0x52cd77[_0x648a('0x49')]===_0x648a('0x47')){var _0x254ffa=_0x9068fa[_0x648a('0x27')]({'plain':!![]});var _0xa530fd=_0x648a('0x4a');return db[_0x648a('0x4b')][_0x648a('0x44')]({'where':{'name':_0xa530fd,'userProfileId':_0x52cd77['userProfileId']},'raw':!![]})[_0x648a('0x25')](function(_0x4de8f1){if(_0x4de8f1&&_0x4de8f1[_0x648a('0x4c')]===0x0){return db[_0x648a('0x28')]['create']({'name':_0x254ffa[_0x648a('0x29')],'resourceId':_0x254ffa['id'],'type':_0x4de8f1['name'],'sectionId':_0x4de8f1['id']},{})[_0x648a('0x25')](function(){return _0x9068fa;});}else{return _0x9068fa;}})[_0x648a('0x41')](function(_0x389489){logger['error'](_0x648a('0x4d'),_0x389489);throw _0x389489;});}return _0x9068fa;})[_0x648a('0x25')](respondWithResult(_0x2f6e30,0xc9))[_0x648a('0x41')](handleError(_0x2f6e30,null));};exports[_0x648a('0x4e')]=function(_0x211b85,_0x181688){if(_0x211b85[_0x648a('0x46')]['id']){delete _0x211b85[_0x648a('0x46')]['id'];}return db[_0x648a('0x2d')][_0x648a('0x44')]({'where':{'id':_0x211b85[_0x648a('0x4f')]['id']}})['then'](handleEntityNotFound(_0x181688,null))['then'](saveUpdates(_0x211b85['body'],null))[_0x648a('0x25')](respondWithResult(_0x181688,null))[_0x648a('0x41')](handleError(_0x181688,null));};exports['destroy']=function(_0x463e38,_0x5ed48e){return db['SquareOdbc']['find']({'where':{'id':_0x463e38[_0x648a('0x4f')]['id']}})[_0x648a('0x25')](handleEntityNotFound(_0x5ed48e,null))[_0x648a('0x25')](removeEntity(_0x5ed48e,null))[_0x648a('0x41')](handleError(_0x5ed48e,null));};exports[_0x648a('0x50')]=function(_0x3b43c0,_0x38d1c2,_0x9b1078){var _0x3d65bc;return db['SquareOdbc'][_0x648a('0x44')]({'where':{'id':_0x3b43c0[_0x648a('0x4f')]['id']},'attributes':['id',_0x648a('0x51')]})[_0x648a('0x25')](handleEntityNotFound(_0x38d1c2,null))[_0x648a('0x25')](function(_0x234cb8){if(_0x234cb8){var _0x97b3f9=require(_0x648a('0x52'))();_0x97b3f9['openSync'](_0x234cb8[_0x648a('0x51')]);_0x97b3f9[_0x648a('0x53')]();return _0x234cb8;}})[_0x648a('0x25')](respondWithResult(_0x38d1c2,null))[_0x648a('0x41')](handleError(_0x38d1c2,null));}; \ No newline at end of file +var _0x68d3=['error','stack','name','send','index','SquareOdbc','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','dsn','closeSync','eml-format','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','api','../../mysqldb','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource'];(function(_0x558e53,_0x56ffc4){var _0x1fd3a2=function(_0x5c2d13){while(--_0x5c2d13){_0x558e53['push'](_0x558e53['shift']());}};_0x1fd3a2(++_0x56ffc4);}(_0x68d3,0x7a));var _0x368d=function(_0xfa4242,_0x304cf9){_0xfa4242=_0xfa4242-0x0;var _0x5cc36a=_0x68d3[_0xfa4242];return _0x5cc36a;};'use strict';var emlformat=require(_0x368d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x368d('0x1'));var rp=require(_0x368d('0x2'));var moment=require(_0x368d('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x368d('0x4'));var sox=require(_0x368d('0x5'));var csv=require(_0x368d('0x6'));var ejs=require(_0x368d('0x7'));var fs=require('fs');var fs_extra=require(_0x368d('0x8'));var _=require(_0x368d('0x9'));var squel=require(_0x368d('0xa'));var crypto=require(_0x368d('0xb'));var jsforce=require(_0x368d('0xc'));var deskjs=require(_0x368d('0xd'));var toCsv=require(_0x368d('0x6'));var querystring=require('querystring');var Papa=require(_0x368d('0xe'));var Redis=require('ioredis');var authService=require(_0x368d('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x368d('0x10'));var logger=require('../../config/logger')(_0x368d('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x368d('0x12'))['db'];function respondWithStatusCode(_0x188558,_0x3042fe){_0x3042fe=_0x3042fe||0xcc;return function(_0x433967){if(_0x433967){return _0x188558[_0x368d('0x13')](_0x3042fe);}return _0x188558['status'](_0x3042fe)[_0x368d('0x14')]();};}function respondWithResult(_0x1d2cd2,_0x54b656){_0x54b656=_0x54b656||0xc8;return function(_0xb5c79){if(_0xb5c79){return _0x1d2cd2[_0x368d('0x15')](_0x54b656)['json'](_0xb5c79);}};}function respondWithFilteredResult(_0x2f9ea7,_0x4d51b){return function(_0x5f1f72){if(_0x5f1f72){var _0x12428f=typeof _0x4d51b[_0x368d('0x16')]==='undefined'&&typeof _0x4d51b[_0x368d('0x17')]===_0x368d('0x18');var _0x494f33=_0x5f1f72[_0x368d('0x19')];var _0xf3f4e5=_0x12428f?0x0:_0x4d51b[_0x368d('0x16')];var _0x19cf23=_0x12428f?_0x5f1f72[_0x368d('0x19')]:_0x4d51b[_0x368d('0x16')]+_0x4d51b[_0x368d('0x17')];var _0x3d07bb;if(_0x19cf23>=_0x494f33){_0x19cf23=_0x494f33;_0x3d07bb=0xc8;}else{_0x3d07bb=0xce;}_0x2f9ea7['status'](_0x3d07bb);return _0x2f9ea7[_0x368d('0x1a')](_0x368d('0x1b'),_0xf3f4e5+'-'+_0x19cf23+'/'+_0x494f33)['json'](_0x5f1f72);}return null;};}function patchUpdates(_0x1ced87){return function(_0x24c035){try{jsonpatch[_0x368d('0x1c')](_0x24c035,_0x1ced87,!![]);}catch(_0x236c16){return BPromise[_0x368d('0x1d')](_0x236c16);}return _0x24c035[_0x368d('0x1e')]();};}function saveUpdates(_0xeb661e,_0x20815d){return function(_0x936646){if(_0x936646){return _0x936646[_0x368d('0x1f')](_0xeb661e)[_0x368d('0x20')](function(_0xcbffaa){return _0xcbffaa;});}return null;};}function removeEntity(_0x4c9739,_0x4cdb3f){return function(_0xc61b5e){if(_0xc61b5e){return _0xc61b5e[_0x368d('0x21')]()[_0x368d('0x20')](function(){var _0x10c915=_0xc61b5e[_0x368d('0x22')]({'plain':!![]});var _0x24036d='ODBC';return db[_0x368d('0x23')][_0x368d('0x21')]({'where':{'type':_0x24036d,'resourceId':_0x10c915['id']}})[_0x368d('0x20')](function(){return _0xc61b5e;});})['then'](function(){_0x4c9739[_0x368d('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3bde5c,_0x4b2c52){return function(_0x58a033){if(!_0x58a033){_0x3bde5c[_0x368d('0x13')](0x194);}return _0x58a033;};}function handleError(_0x5ebf78,_0x53e484){_0x53e484=_0x53e484||0x1f4;return function(_0x28f5bc){logger[_0x368d('0x24')](_0x28f5bc[_0x368d('0x25')]);if(_0x28f5bc[_0x368d('0x26')]){delete _0x28f5bc[_0x368d('0x26')];}_0x5ebf78[_0x368d('0x15')](_0x53e484)[_0x368d('0x27')](_0x28f5bc);};}exports[_0x368d('0x28')]=function(_0x478fbf,_0x2ffcac){var _0x50a46c={},_0x1141d1={},_0x18c8a9={'count':0x0,'rows':[]};var _0x59e100=_['map'](db[_0x368d('0x29')][_0x368d('0x2a')],function(_0x12f03b){return{'name':_0x12f03b[_0x368d('0x2b')],'type':_0x12f03b[_0x368d('0x2c')][_0x368d('0x2d')]};});_0x1141d1[_0x368d('0x2e')]=_[_0x368d('0x2f')](_0x59e100,'name');_0x1141d1[_0x368d('0x30')]=_[_0x368d('0x31')](_0x478fbf[_0x368d('0x30')]);_0x1141d1[_0x368d('0x32')]=_[_0x368d('0x33')](_0x1141d1[_0x368d('0x2e')],_0x1141d1[_0x368d('0x30')]);_0x50a46c['attributes']=_['intersection'](_0x1141d1[_0x368d('0x2e')],qs['fields'](_0x478fbf[_0x368d('0x30')][_0x368d('0x34')]));_0x50a46c[_0x368d('0x35')]=_0x50a46c[_0x368d('0x35')][_0x368d('0x36')]?_0x50a46c[_0x368d('0x35')]:_0x1141d1[_0x368d('0x2e')];if(!_0x478fbf['query'][_0x368d('0x37')]('nolimit')){_0x50a46c[_0x368d('0x17')]=qs[_0x368d('0x17')](_0x478fbf[_0x368d('0x30')]['limit']);_0x50a46c['offset']=qs['offset'](_0x478fbf['query'][_0x368d('0x16')]);}_0x50a46c['order']=qs[_0x368d('0x38')](_0x478fbf[_0x368d('0x30')]['sort']);_0x50a46c['where']=qs[_0x368d('0x32')](_['pick'](_0x478fbf[_0x368d('0x30')],_0x1141d1[_0x368d('0x32')]),_0x59e100);if(_0x478fbf[_0x368d('0x30')][_0x368d('0x39')]){_0x50a46c[_0x368d('0x3a')]=_[_0x368d('0x3b')](_0x50a46c[_0x368d('0x3a')],{'$or':_[_0x368d('0x2f')](_0x59e100,function(_0x5562b7){if(_0x5562b7[_0x368d('0x2c')]!==_0x368d('0x3c')){var _0x218882={};_0x218882[_0x5562b7[_0x368d('0x26')]]={'$like':'%'+_0x478fbf[_0x368d('0x30')][_0x368d('0x39')]+'%'};return _0x218882;}})});}_0x50a46c=_[_0x368d('0x3b')]({},_0x50a46c,_0x478fbf[_0x368d('0x3d')]);var _0x3a595d={'where':_0x50a46c[_0x368d('0x3a')]};return db[_0x368d('0x29')][_0x368d('0x19')](_0x3a595d)[_0x368d('0x20')](function(_0x3d7ee0){_0x18c8a9[_0x368d('0x19')]=_0x3d7ee0;if(_0x478fbf['query'][_0x368d('0x3e')]){_0x50a46c[_0x368d('0x3f')]=[{'all':!![]}];}return db[_0x368d('0x29')][_0x368d('0x40')](_0x50a46c);})[_0x368d('0x20')](function(_0x461570){_0x18c8a9[_0x368d('0x41')]=_0x461570;return _0x18c8a9;})[_0x368d('0x20')](respondWithFilteredResult(_0x2ffcac,_0x50a46c))[_0x368d('0x42')](handleError(_0x2ffcac,null));};exports[_0x368d('0x43')]=function(_0x2b954f,_0x53c624){var _0x1ee844={'raw':!![],'where':{'id':_0x2b954f[_0x368d('0x44')]['id']}},_0xd8e4f1={};_0xd8e4f1[_0x368d('0x2e')]=_[_0x368d('0x31')](db[_0x368d('0x29')][_0x368d('0x2a')]);_0xd8e4f1[_0x368d('0x30')]=_['keys'](_0x2b954f['query']);_0xd8e4f1['filters']=_[_0x368d('0x33')](_0xd8e4f1[_0x368d('0x2e')],_0xd8e4f1[_0x368d('0x30')]);_0x1ee844[_0x368d('0x35')]=_[_0x368d('0x33')](_0xd8e4f1[_0x368d('0x2e')],qs[_0x368d('0x34')](_0x2b954f[_0x368d('0x30')]['fields']));_0x1ee844[_0x368d('0x35')]=_0x1ee844['attributes'][_0x368d('0x36')]?_0x1ee844[_0x368d('0x35')]:_0xd8e4f1[_0x368d('0x2e')];if(_0x2b954f[_0x368d('0x30')][_0x368d('0x3e')]){_0x1ee844[_0x368d('0x3f')]=[{'all':!![]}];}_0x1ee844=_['merge']({},_0x1ee844,_0x2b954f[_0x368d('0x3d')]);return db[_0x368d('0x29')][_0x368d('0x45')](_0x1ee844)[_0x368d('0x20')](handleEntityNotFound(_0x53c624,null))['then'](respondWithResult(_0x53c624,null))[_0x368d('0x42')](handleError(_0x53c624,null));};exports[_0x368d('0x46')]=function(_0x30b66f,_0x427ee9){return db['SquareOdbc'][_0x368d('0x46')](_0x30b66f['body'],{})[_0x368d('0x20')](function(_0x1947db){var _0xe92540=_0x30b66f[_0x368d('0x47')][_0x368d('0x22')]({'plain':!![]});if(!_0xe92540)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xe92540[_0x368d('0x48')]===_0x368d('0x47')){var _0x1f6a6a=_0x1947db[_0x368d('0x22')]({'plain':!![]});var _0x441ef9='ODBC';return db[_0x368d('0x49')][_0x368d('0x45')]({'where':{'name':_0x441ef9,'userProfileId':_0xe92540['userProfileId']},'raw':!![]})[_0x368d('0x20')](function(_0x38302a){if(_0x38302a&&_0x38302a[_0x368d('0x4a')]===0x0){return db[_0x368d('0x23')][_0x368d('0x46')]({'name':_0x1f6a6a[_0x368d('0x26')],'resourceId':_0x1f6a6a['id'],'type':_0x38302a[_0x368d('0x26')],'sectionId':_0x38302a['id']},{})['then'](function(){return _0x1947db;});}else{return _0x1947db;}})[_0x368d('0x42')](function(_0x461fc6){logger['error'](_0x368d('0x4b'),_0x461fc6);throw _0x461fc6;});}return _0x1947db;})['then'](respondWithResult(_0x427ee9,0xc9))['catch'](handleError(_0x427ee9,null));};exports[_0x368d('0x1f')]=function(_0x5b438f,_0x3b1d92){if(_0x5b438f[_0x368d('0x4c')]['id']){delete _0x5b438f[_0x368d('0x4c')]['id'];}return db[_0x368d('0x29')]['find']({'where':{'id':_0x5b438f[_0x368d('0x44')]['id']}})['then'](handleEntityNotFound(_0x3b1d92,null))[_0x368d('0x20')](saveUpdates(_0x5b438f[_0x368d('0x4c')],null))[_0x368d('0x20')](respondWithResult(_0x3b1d92,null))['catch'](handleError(_0x3b1d92,null));};exports['destroy']=function(_0xfc0578,_0x41a98f){return db[_0x368d('0x29')]['find']({'where':{'id':_0xfc0578['params']['id']}})[_0x368d('0x20')](handleEntityNotFound(_0x41a98f,null))[_0x368d('0x20')](removeEntity(_0x41a98f,null))[_0x368d('0x42')](handleError(_0x41a98f,null));};exports['test']=function(_0x393c02,_0xf41ce5,_0x4f39a4){var _0x4d24dc;return db[_0x368d('0x29')][_0x368d('0x45')]({'where':{'id':_0x393c02[_0x368d('0x44')]['id']},'attributes':['id','dsn']})[_0x368d('0x20')](handleEntityNotFound(_0xf41ce5,null))[_0x368d('0x20')](function(_0x31a378){if(_0x31a378){var _0x4b3f7c=require('odbc')();_0x4b3f7c['openSync'](_0x31a378[_0x368d('0x4d')]);_0x4b3f7c[_0x368d('0x4e')]();return _0x31a378;}})[_0x368d('0x20')](respondWithResult(_0xf41ce5,null))['catch'](handleError(_0xf41ce5,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 1a819a1..c95857a 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 _0xae6b=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','lodash'];(function(_0x177cc4,_0x338897){var _0x4cdbd6=function(_0x59f654){while(--_0x59f654){_0x177cc4['push'](_0x177cc4['shift']());}};_0x4cdbd6(++_0x338897);}(_0xae6b,0x9b));var _0xbae6=function(_0x147331,_0x3c2a32){_0x147331=_0x147331-0x0;var _0x5524fb=_0xae6b[_0x147331];return _0x5524fb;};'use strict';var _=require(_0xbae6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xbae6('0x1'));var moment=require(_0xbae6('0x2'));var BPromise=require(_0xbae6('0x3'));var rp=require(_0xbae6('0x4'));var fs=require('fs');var path=require(_0xbae6('0x5'));var rimraf=require(_0xbae6('0x6'));var config=require(_0xbae6('0x7'));var attributes=require(_0xbae6('0x8'));module[_0xbae6('0x9')]=function(_0x325860,_0x56f663){return _0x325860[_0xbae6('0xa')](_0xbae6('0xb'),attributes,{'tableName':_0xbae6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0515=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','exports','SquareOdbc','lodash'];(function(_0x4b2cf4,_0x23cb34){var _0x26af21=function(_0x23e8d2){while(--_0x23e8d2){_0x4b2cf4['push'](_0x4b2cf4['shift']());}};_0x26af21(++_0x23cb34);}(_0x0515,0x16b));var _0x5051=function(_0x321d5e,_0x1ae4a9){_0x321d5e=_0x321d5e-0x0;var _0x3458cd=_0x0515[_0x321d5e];return _0x3458cd;};'use strict';var _=require(_0x5051('0x0'));var util=require(_0x5051('0x1'));var logger=require(_0x5051('0x2'))(_0x5051('0x3'));var moment=require(_0x5051('0x4'));var BPromise=require(_0x5051('0x5'));var rp=require(_0x5051('0x6'));var fs=require('fs');var path=require(_0x5051('0x7'));var rimraf=require(_0x5051('0x8'));var config=require(_0x5051('0x9'));var attributes=require(_0x5051('0xa'));module[_0x5051('0xb')]=function(_0x481d53,_0x3beff2){return _0x481d53['define'](_0x5051('0xc'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 598ba0d..c5a3b70 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 _0xa45a=['../../config/environment','jayson/promise','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SquareOdbc','options','attributes','map','model','include','ShowSquareOdbc','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3c9c0b,_0x56a43e){var _0x763f51=function(_0x38056d){while(--_0x38056d){_0x3c9c0b['push'](_0x3c9c0b['shift']());}};_0x763f51(++_0x56a43e);}(_0xa45a,0x1bb));var _0xaa45=function(_0x49b5b4,_0x4ab2d5){_0x49b5b4=_0x49b5b4-0x0;var _0x6ab9b6=_0xa45a[_0x49b5b4];return _0x6ab9b6;};'use strict';var _=require(_0xaa45('0x0'));var util=require(_0xaa45('0x1'));var moment=require(_0xaa45('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaa45('0x3'));var db=require(_0xaa45('0x4'))['db'];var utils=require(_0xaa45('0x5'));var logger=require(_0xaa45('0x6'))('rpc');var config=require(_0xaa45('0x7'));var jayson=require(_0xaa45('0x8'));var client=jayson['client'][_0xaa45('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x204083,_0x3c7f30,_0x5d3581){return new BPromise(function(_0x2576f6,_0x2c6ab8){return client[_0xaa45('0xa')](_0x204083,_0x5d3581)[_0xaa45('0xb')](function(_0x3b6bdd){logger[_0xaa45('0xc')](_0xaa45('0xd'),_0x3c7f30,_0xaa45('0xe'));logger[_0xaa45('0xf')](_0xaa45('0x10'),_0x3c7f30,'request\x20sent',JSON[_0xaa45('0x11')](_0x3b6bdd));if(_0x3b6bdd[_0xaa45('0x12')]){if(_0x3b6bdd[_0xaa45('0x12')][_0xaa45('0x13')]===0x1f4){logger[_0xaa45('0x12')](_0xaa45('0xd'),_0x3c7f30,_0x3b6bdd[_0xaa45('0x12')][_0xaa45('0x14')]);return _0x2c6ab8(_0x3b6bdd['error'][_0xaa45('0x14')]);}logger[_0xaa45('0x12')](_0xaa45('0xd'),_0x3c7f30,_0x3b6bdd[_0xaa45('0x12')]['message']);return _0x2576f6(_0x3b6bdd[_0xaa45('0x12')][_0xaa45('0x14')]);}else{logger[_0xaa45('0xc')](_0xaa45('0xd'),_0x3c7f30,_0xaa45('0xe'));_0x2576f6(_0x3b6bdd[_0xaa45('0x15')][_0xaa45('0x14')]);}})[_0xaa45('0x16')](function(_0x3ba350){logger['error'](_0xaa45('0xd'),_0x3c7f30,_0x3ba350);_0x2c6ab8(_0x3ba350);});});}exports['ShowSquareOdbc']=function(_0x458ae6){var _0x4dccf0=this;return new Promise(function(_0x453ec9,_0x344dc5){return db[_0xaa45('0x17')]['find']({'raw':_0x458ae6[_0xaa45('0x18')]?_0x458ae6['options']['raw']===undefined?!![]:![]:!![],'where':_0x458ae6['options']?_0x458ae6['options']['where']||null:null,'attributes':_0x458ae6[_0xaa45('0x18')]?_0x458ae6[_0xaa45('0x18')][_0xaa45('0x19')]||null:null,'include':_0x458ae6[_0xaa45('0x18')]?_0x458ae6[_0xaa45('0x18')]['include']?_[_0xaa45('0x1a')](_0x458ae6[_0xaa45('0x18')]['include'],function(_0x40201a){return{'model':db[_0x40201a[_0xaa45('0x1b')]],'as':_0x40201a['as'],'attributes':_0x40201a[_0xaa45('0x19')],'include':_0x40201a['include']?_[_0xaa45('0x1a')](_0x40201a[_0xaa45('0x1c')],function(_0x43537b){return{'model':db[_0x43537b['model']],'as':_0x43537b['as'],'attributes':_0x43537b['attributes'],'include':_0x43537b[_0xaa45('0x1c')]?_['map'](_0x43537b[_0xaa45('0x1c')],function(_0x5c4315){return{'model':db[_0x5c4315[_0xaa45('0x1b')]],'as':_0x5c4315['as'],'attributes':_0x5c4315['attributes']};}):[]};}):[]};}):[]:[]})[_0xaa45('0xb')](function(_0x1c7651){logger[_0xaa45('0xc')]('ShowSquareOdbc',_0x458ae6);logger[_0xaa45('0xf')](_0xaa45('0x1d'),_0x458ae6,JSON['stringify'](_0x1c7651));_0x453ec9(_0x1c7651);})[_0xaa45('0x16')](function(_0xe86e3a){logger['error'](_0xaa45('0x1d'),_0xe86e3a['message'],_0x458ae6);_0x344dc5(_0x4dccf0[_0xaa45('0x12')](0x1f4,_0xe86e3a['message']));});});}; \ No newline at end of file +var _0x2534=['raw','where','attributes','include','map','model','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','error','code','SquareOdbc,\x20%s,\x20%s','message','result','ShowSquareOdbc','SquareOdbc','find','options'];(function(_0x569637,_0x169fc0){var _0x3a5b81=function(_0x400153){while(--_0x400153){_0x569637['push'](_0x569637['shift']());}};_0x3a5b81(++_0x169fc0);}(_0x2534,0xb6));var _0x4253=function(_0x2a0703,_0x25bbf0){_0x2a0703=_0x2a0703-0x0;var _0x13efe6=_0x2534[_0x2a0703];return _0x13efe6;};'use strict';var _=require(_0x4253('0x0'));var util=require(_0x4253('0x1'));var moment=require('moment');var BPromise=require(_0x4253('0x2'));var rs=require(_0x4253('0x3'));var fs=require('fs');var Redis=require(_0x4253('0x4'));var db=require(_0x4253('0x5'))['db'];var utils=require(_0x4253('0x6'));var logger=require(_0x4253('0x7'))(_0x4253('0x8'));var config=require(_0x4253('0x9'));var jayson=require(_0x4253('0xa'));var client=jayson[_0x4253('0xb')][_0x4253('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x19ab7e,_0x206ebc,_0x297917){return new BPromise(function(_0x5dad1b,_0x17b804){return client[_0x4253('0xd')](_0x19ab7e,_0x297917)[_0x4253('0xe')](function(_0x53a103){logger[_0x4253('0xf')]('SquareOdbc,\x20%s,\x20%s',_0x206ebc,_0x4253('0x10'));logger[_0x4253('0x11')](_0x4253('0x12'),_0x206ebc,'request\x20sent',JSON['stringify'](_0x53a103));if(_0x53a103[_0x4253('0x13')]){if(_0x53a103[_0x4253('0x13')][_0x4253('0x14')]===0x1f4){logger[_0x4253('0x13')](_0x4253('0x15'),_0x206ebc,_0x53a103[_0x4253('0x13')][_0x4253('0x16')]);return _0x17b804(_0x53a103[_0x4253('0x13')][_0x4253('0x16')]);}logger[_0x4253('0x13')](_0x4253('0x15'),_0x206ebc,_0x53a103[_0x4253('0x13')][_0x4253('0x16')]);return _0x5dad1b(_0x53a103[_0x4253('0x13')][_0x4253('0x16')]);}else{logger[_0x4253('0xf')](_0x4253('0x15'),_0x206ebc,_0x4253('0x10'));_0x5dad1b(_0x53a103[_0x4253('0x17')][_0x4253('0x16')]);}})['catch'](function(_0x212ede){logger[_0x4253('0x13')](_0x4253('0x15'),_0x206ebc,_0x212ede);_0x17b804(_0x212ede);});});}exports[_0x4253('0x18')]=function(_0x47dcb4){var _0x293071=this;return new Promise(function(_0x2b574c,_0xdc2136){return db[_0x4253('0x19')][_0x4253('0x1a')]({'raw':_0x47dcb4[_0x4253('0x1b')]?_0x47dcb4[_0x4253('0x1b')][_0x4253('0x1c')]===undefined?!![]:![]:!![],'where':_0x47dcb4[_0x4253('0x1b')]?_0x47dcb4[_0x4253('0x1b')][_0x4253('0x1d')]||null:null,'attributes':_0x47dcb4['options']?_0x47dcb4['options'][_0x4253('0x1e')]||null:null,'include':_0x47dcb4[_0x4253('0x1b')]?_0x47dcb4[_0x4253('0x1b')][_0x4253('0x1f')]?_['map'](_0x47dcb4[_0x4253('0x1b')][_0x4253('0x1f')],function(_0x427736){return{'model':db[_0x427736['model']],'as':_0x427736['as'],'attributes':_0x427736[_0x4253('0x1e')],'include':_0x427736[_0x4253('0x1f')]?_[_0x4253('0x20')](_0x427736[_0x4253('0x1f')],function(_0x4cf069){return{'model':db[_0x4cf069[_0x4253('0x21')]],'as':_0x4cf069['as'],'attributes':_0x4cf069['attributes'],'include':_0x4cf069[_0x4253('0x1f')]?_['map'](_0x4cf069['include'],function(_0x46d7c3){return{'model':db[_0x46d7c3['model']],'as':_0x46d7c3['as'],'attributes':_0x46d7c3[_0x4253('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4253('0xe')](function(_0x5290c6){logger[_0x4253('0xf')](_0x4253('0x18'),_0x47dcb4);logger[_0x4253('0x11')]('ShowSquareOdbc',_0x47dcb4,JSON['stringify'](_0x5290c6));_0x2b574c(_0x5290c6);})[_0x4253('0x22')](function(_0x450ec0){logger[_0x4253('0x13')](_0x4253('0x18'),_0x450ec0[_0x4253('0x16')],_0x47dcb4);_0xdc2136(_0x293071[_0x4253('0x13')](0x1f4,_0x450ec0[_0x4253('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index ef94b85..f55688a 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 _0x7462=['multer','util','express','../../components/auth/service','../../components/interaction/service','./squareProject.controller','get','isAuthenticated','index','/:id','show','getUsers','create','post','addUsers','put','update','delete','destroy','removeUsers','exports'];(function(_0xd07eee,_0x23f3b1){var _0x402c5b=function(_0x6a1564){while(--_0x6a1564){_0xd07eee['push'](_0xd07eee['shift']());}};_0x402c5b(++_0x23f3b1);}(_0x7462,0x165));var _0x2746=function(_0x30bd66,_0x36a93d){_0x30bd66=_0x30bd66-0x0;var _0x74c9dd=_0x7462[_0x30bd66];return _0x74c9dd;};'use strict';var multer=require(_0x2746('0x0'));var util=require(_0x2746('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2746('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2746('0x3'));var interaction=require(_0x2746('0x4'));var config=require('../../config/environment');var controller=require(_0x2746('0x5'));router[_0x2746('0x6')]('/',auth[_0x2746('0x7')](),controller[_0x2746('0x8')]);router[_0x2746('0x6')](_0x2746('0x9'),auth[_0x2746('0x7')](),controller[_0x2746('0xa')]);router[_0x2746('0x6')]('/:id/users',auth[_0x2746('0x7')](),controller[_0x2746('0xb')]);router['post']('/',auth[_0x2746('0x7')](),controller[_0x2746('0xc')]);router[_0x2746('0xd')]('/:id/users',auth[_0x2746('0x7')](),controller[_0x2746('0xe')]);router[_0x2746('0xf')](_0x2746('0x9'),auth[_0x2746('0x7')](),controller[_0x2746('0x10')]);router[_0x2746('0x11')](_0x2746('0x9'),auth[_0x2746('0x7')](),controller[_0x2746('0x12')]);router[_0x2746('0x11')]('/:id/users',auth['isAuthenticated'](),controller[_0x2746('0x13')]);module[_0x2746('0x14')]=router; \ No newline at end of file +var _0x8109=['../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','show','/:id/users','getUsers','create','post','update','delete','removeUsers','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x8109,0xa9));var _0x9810=function(_0x43feeb,_0x4e36ce){_0x43feeb=_0x43feeb-0x0;var _0x13c9b5=_0x8109[_0x43feeb];return _0x13c9b5;};'use strict';var multer=require(_0x9810('0x0'));var util=require('util');var path=require(_0x9810('0x1'));var timeout=require(_0x9810('0x2'));var express=require('express');var router=express[_0x9810('0x3')]();var fs_extra=require(_0x9810('0x4'));var auth=require(_0x9810('0x5'));var interaction=require(_0x9810('0x6'));var config=require(_0x9810('0x7'));var controller=require(_0x9810('0x8'));router[_0x9810('0x9')]('/',auth[_0x9810('0xa')](),controller[_0x9810('0xb')]);router[_0x9810('0x9')](_0x9810('0xc'),auth['isAuthenticated'](),controller[_0x9810('0xd')]);router[_0x9810('0x9')](_0x9810('0xe'),auth[_0x9810('0xa')](),controller[_0x9810('0xf')]);router['post']('/',auth[_0x9810('0xa')](),controller[_0x9810('0x10')]);router[_0x9810('0x11')]('/:id/users',auth[_0x9810('0xa')](),controller['addUsers']);router['put'](_0x9810('0xc'),auth[_0x9810('0xa')](),controller[_0x9810('0x12')]);router[_0x9810('0x13')](_0x9810('0xc'),auth[_0x9810('0xa')](),controller['destroy']);router[_0x9810('0x13')](_0x9810('0xe'),auth[_0x9810('0xa')](),controller[_0x9810('0x14')]);module[_0x9810('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index bcab1cb..0d2dee4 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 _0x9e9f=['utf8','long','production','toString','DATE','sequelize','exports','STRING','TEXT','BLOB','getDataValue','preproduction'];(function(_0x2db05,_0x413127){var _0x338825=function(_0x4aaa3a){while(--_0x4aaa3a){_0x2db05['push'](_0x2db05['shift']());}};_0x338825(++_0x413127);}(_0x9e9f,0x1cd));var _0xf9e9=function(_0x205e5a,_0x5c19fb){_0x205e5a=_0x205e5a-0x0;var _0x10da58=_0x9e9f[_0x205e5a];return _0x10da58;};'use strict';var Sequelize=require(_0xf9e9('0x0'));module[_0xf9e9('0x1')]={'name':{'type':Sequelize[_0xf9e9('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0xf9e9('0x3')]},'preproduction':{'type':Sequelize[_0xf9e9('0x4')]('long'),'get':function(){if(this[_0xf9e9('0x5')]('preproduction')){return this['getDataValue'](_0xf9e9('0x6'))['toString'](_0xf9e9('0x7'));}}},'production':{'type':Sequelize[_0xf9e9('0x4')](_0xf9e9('0x8')),'get':function(){if(this[_0xf9e9('0x5')](_0xf9e9('0x9'))){return this[_0xf9e9('0x5')](_0xf9e9('0x9'))[_0xf9e9('0xa')](_0xf9e9('0x7'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0xf9e9('0xb')]}}; \ No newline at end of file +var _0xc3f3=['getDataValue','preproduction','toString','utf8','production','DATE','exports','STRING','name','TEXT','BLOB','long'];(function(_0x2b6a24,_0x312141){var _0x4a93dd=function(_0x54f1b9){while(--_0x54f1b9){_0x2b6a24['push'](_0x2b6a24['shift']());}};_0x4a93dd(++_0x312141);}(_0xc3f3,0xd2));var _0x3c3f=function(_0xd0acd0,_0x306b08){_0xd0acd0=_0xd0acd0-0x0;var _0x353a1c=_0xc3f3[_0xd0acd0];return _0x353a1c;};'use strict';var Sequelize=require('sequelize');module[_0x3c3f('0x0')]={'name':{'type':Sequelize[_0x3c3f('0x1')],'unique':_0x3c3f('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x3c3f('0x1')]},'notes':{'type':Sequelize[_0x3c3f('0x3')]},'preproduction':{'type':Sequelize[_0x3c3f('0x4')](_0x3c3f('0x5')),'get':function(){if(this[_0x3c3f('0x6')](_0x3c3f('0x7'))){return this[_0x3c3f('0x6')](_0x3c3f('0x7'))[_0x3c3f('0x8')](_0x3c3f('0x9'));}}},'production':{'type':Sequelize[_0x3c3f('0x4')](_0x3c3f('0x5')),'get':function(){if(this[_0x3c3f('0x6')]('production')){return this[_0x3c3f('0x6')](_0x3c3f('0xa'))['toString'](_0x3c3f('0x9'));}}},'savedAt':{'type':Sequelize[_0x3c3f('0xb')]},'publishedAt':{'type':Sequelize[_0x3c3f('0xb')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 33e1e04..47849be 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 _0x5840=['findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','update','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','User','eml-format','rimraf','fast-json-patch','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','./squareProject.socket','register','sendStatus','end','offset','undefined','count','limit','status','set','apply','reject','destroy','get','SquareProjects','UserProfileResource','then','error','stack','name','send','index','map','SquareProject','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include'];(function(_0x4557dc,_0x3687b2){var _0x1377aa=function(_0x41c62a){while(--_0x41c62a){_0x4557dc['push'](_0x4557dc['shift']());}};_0x1377aa(++_0x3687b2);}(_0x5840,0x1f2));var _0x0584=function(_0x25f20c,_0x2db727){_0x25f20c=_0x25f20c-0x0;var _0x2603eb=_0x5840[_0x25f20c];return _0x2603eb;};'use strict';var emlformat=require(_0x0584('0x0'));var rimraf=require(_0x0584('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0584('0x2'));var rp=require('request-promise');var moment=require(_0x0584('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0584('0x4'));var util=require(_0x0584('0x5'));var path=require('path');var sox=require(_0x0584('0x6'));var csv=require(_0x0584('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0584('0x8'));var squel=require(_0x0584('0x9'));var crypto=require(_0x0584('0xa'));var jsforce=require(_0x0584('0xb'));var deskjs=require(_0x0584('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0584('0xd'));var Papa=require(_0x0584('0xe'));var Redis=require(_0x0584('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x0584('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0584('0x11'));var logger=require(_0x0584('0x12'))(_0x0584('0x13'));var utils=require(_0x0584('0x14'));var config=require(_0x0584('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x0584('0x16')]=_[_0x0584('0x17')](config['redis'],{'host':_0x0584('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0584('0x16')]));require(_0x0584('0x19'))[_0x0584('0x1a')](socket);function respondWithStatusCode(_0x261272,_0x2ca3a9){_0x2ca3a9=_0x2ca3a9||0xcc;return function(_0x1fdb9a){if(_0x1fdb9a){return _0x261272[_0x0584('0x1b')](_0x2ca3a9);}return _0x261272['status'](_0x2ca3a9)[_0x0584('0x1c')]();};}function respondWithResult(_0x5aac9b,_0x353c2c){_0x353c2c=_0x353c2c||0xc8;return function(_0xdee253){if(_0xdee253){return _0x5aac9b['status'](_0x353c2c)['json'](_0xdee253);}};}function respondWithFilteredResult(_0x1ed628,_0x174fcc){return function(_0x58919c){if(_0x58919c){var _0x2b4a00=typeof _0x174fcc[_0x0584('0x1d')]===_0x0584('0x1e')&&typeof _0x174fcc['limit']==='undefined';var _0x41ae3e=_0x58919c[_0x0584('0x1f')];var _0x1d832d=_0x2b4a00?0x0:_0x174fcc['offset'];var _0x22c05a=_0x2b4a00?_0x58919c[_0x0584('0x1f')]:_0x174fcc['offset']+_0x174fcc[_0x0584('0x20')];var _0x26262b;if(_0x22c05a>=_0x41ae3e){_0x22c05a=_0x41ae3e;_0x26262b=0xc8;}else{_0x26262b=0xce;}_0x1ed628[_0x0584('0x21')](_0x26262b);return _0x1ed628[_0x0584('0x22')]('Content-Range',_0x1d832d+'-'+_0x22c05a+'/'+_0x41ae3e)['json'](_0x58919c);}return null;};}function patchUpdates(_0x30be0c){return function(_0x192e99){try{jsonpatch[_0x0584('0x23')](_0x192e99,_0x30be0c,!![]);}catch(_0x5bf5ad){return BPromise[_0x0584('0x24')](_0x5bf5ad);}return _0x192e99['save']();};}function saveUpdates(_0x1d892d,_0x478df2){return function(_0x2ed258){if(_0x2ed258){return _0x2ed258['update'](_0x1d892d)['then'](function(_0x3cdf8a){return _0x3cdf8a;});}return null;};}function removeEntity(_0x104be3,_0x540eec){return function(_0x554216){if(_0x554216){return _0x554216[_0x0584('0x25')]()['then'](function(){var _0x5293e7=_0x554216[_0x0584('0x26')]({'plain':!![]});var _0x2b1f32=_0x0584('0x27');return db[_0x0584('0x28')][_0x0584('0x25')]({'where':{'type':_0x2b1f32,'resourceId':_0x5293e7['id']}})[_0x0584('0x29')](function(){return _0x554216;});})[_0x0584('0x29')](function(){_0x104be3[_0x0584('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3654fd,_0xbaa1de){return function(_0x26ece4){if(!_0x26ece4){_0x3654fd['sendStatus'](0x194);}return _0x26ece4;};}function handleError(_0x52c530,_0x4e44e0){_0x4e44e0=_0x4e44e0||0x1f4;return function(_0x4d3b14){logger[_0x0584('0x2a')](_0x4d3b14[_0x0584('0x2b')]);if(_0x4d3b14[_0x0584('0x2c')]){delete _0x4d3b14[_0x0584('0x2c')];}_0x52c530[_0x0584('0x21')](_0x4e44e0)[_0x0584('0x2d')](_0x4d3b14);};}exports[_0x0584('0x2e')]=function(_0x332169,_0x11a193){var _0x35021c={},_0x427417={},_0x3db91e={'count':0x0,'rows':[]};var _0x3b19a8=_[_0x0584('0x2f')](db[_0x0584('0x30')][_0x0584('0x31')],function(_0x1ddffe){return{'name':_0x1ddffe[_0x0584('0x32')],'type':_0x1ddffe[_0x0584('0x33')]['key']};});_0x427417[_0x0584('0x34')]=_[_0x0584('0x2f')](_0x3b19a8,_0x0584('0x2c'));_0x427417[_0x0584('0x35')]=_[_0x0584('0x36')](_0x332169[_0x0584('0x35')]);_0x427417['filters']=_['intersection'](_0x427417[_0x0584('0x34')],_0x427417[_0x0584('0x35')]);_0x35021c[_0x0584('0x37')]=_[_0x0584('0x38')](_0x427417[_0x0584('0x34')],qs[_0x0584('0x39')](_0x332169[_0x0584('0x35')][_0x0584('0x39')]));_0x35021c['attributes']=_0x35021c[_0x0584('0x37')][_0x0584('0x3a')]?_0x35021c[_0x0584('0x37')]:_0x427417[_0x0584('0x34')];if(!_0x332169[_0x0584('0x35')][_0x0584('0x3b')](_0x0584('0x3c'))){_0x35021c[_0x0584('0x20')]=qs[_0x0584('0x20')](_0x332169[_0x0584('0x35')][_0x0584('0x20')]);_0x35021c[_0x0584('0x1d')]=qs['offset'](_0x332169['query']['offset']);}_0x35021c[_0x0584('0x3d')]=qs['sort'](_0x332169['query'][_0x0584('0x3e')]);_0x35021c[_0x0584('0x3f')]=qs[_0x0584('0x40')](_[_0x0584('0x41')](_0x332169[_0x0584('0x35')],_0x427417['filters']),_0x3b19a8);if(_0x332169[_0x0584('0x35')][_0x0584('0x42')]){_0x35021c[_0x0584('0x3f')]=_['merge'](_0x35021c['where'],{'$or':_[_0x0584('0x2f')](_0x3b19a8,function(_0x4e12db){if(_0x4e12db['type']!==_0x0584('0x43')){var _0x25e930={};_0x25e930[_0x4e12db[_0x0584('0x2c')]]={'$like':'%'+_0x332169[_0x0584('0x35')][_0x0584('0x42')]+'%'};return _0x25e930;}})});}_0x35021c=_[_0x0584('0x44')]({},_0x35021c,_0x332169[_0x0584('0x45')]);var _0x54cccc={'where':_0x35021c[_0x0584('0x3f')]};return db[_0x0584('0x30')][_0x0584('0x1f')](_0x54cccc)['then'](function(_0x4dd6a3){_0x3db91e['count']=_0x4dd6a3;if(_0x332169[_0x0584('0x35')][_0x0584('0x46')]){_0x35021c[_0x0584('0x47')]=[{'all':!![]}];}return db[_0x0584('0x30')][_0x0584('0x48')](_0x35021c);})['then'](function(_0x3c8cd1){_0x3db91e[_0x0584('0x49')]=_0x3c8cd1;return _0x3db91e;})[_0x0584('0x29')](respondWithFilteredResult(_0x11a193,_0x35021c))[_0x0584('0x4a')](handleError(_0x11a193,null));};exports[_0x0584('0x4b')]=function(_0x1d6c8b,_0x3268dd){var _0x49ea03={'raw':![],'where':{'id':_0x1d6c8b[_0x0584('0x4c')]['id']}},_0x351a27={};_0x351a27['model']=_[_0x0584('0x36')](db[_0x0584('0x30')][_0x0584('0x31')]);_0x351a27[_0x0584('0x35')]=_[_0x0584('0x36')](_0x1d6c8b[_0x0584('0x35')]);_0x351a27['filters']=_[_0x0584('0x38')](_0x351a27[_0x0584('0x34')],_0x351a27[_0x0584('0x35')]);_0x49ea03[_0x0584('0x37')]=_[_0x0584('0x38')](_0x351a27['model'],qs[_0x0584('0x39')](_0x1d6c8b[_0x0584('0x35')][_0x0584('0x39')]));_0x49ea03['attributes']=_0x49ea03[_0x0584('0x37')][_0x0584('0x3a')]?_0x49ea03['attributes']:_0x351a27[_0x0584('0x34')];if(_0x1d6c8b[_0x0584('0x35')][_0x0584('0x46')]){_0x49ea03['include']=[{'all':!![]}];}_0x49ea03=_['merge']({},_0x49ea03,_0x1d6c8b['options']);return db[_0x0584('0x30')][_0x0584('0x4d')](_0x49ea03)[_0x0584('0x29')](handleEntityNotFound(_0x3268dd,null))[_0x0584('0x29')](respondWithResult(_0x3268dd,null))[_0x0584('0x4a')](handleError(_0x3268dd,null));};exports[_0x0584('0x4e')]=function(_0x2641f1,_0x268b42){return db[_0x0584('0x30')][_0x0584('0x4e')](_0x2641f1[_0x0584('0x4f')],{})[_0x0584('0x29')](function(_0xd848b3){var _0x32b7e1=_0x2641f1[_0x0584('0x50')][_0x0584('0x26')]({'plain':!![]});if(!_0x32b7e1)throw new Error(_0x0584('0x51'));if(_0x32b7e1[_0x0584('0x52')]===_0x0584('0x50')){var _0x3ec0c2=_0xd848b3[_0x0584('0x26')]({'plain':!![]});var _0x485e28=_0x0584('0x27');return db[_0x0584('0x53')]['find']({'where':{'name':_0x485e28,'userProfileId':_0x32b7e1['userProfileId']},'raw':!![]})[_0x0584('0x29')](function(_0xc2d2e7){if(_0xc2d2e7&&_0xc2d2e7[_0x0584('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x3ec0c2[_0x0584('0x2c')],'resourceId':_0x3ec0c2['id'],'type':_0xc2d2e7[_0x0584('0x2c')],'sectionId':_0xc2d2e7['id']},{})[_0x0584('0x29')](function(){return _0xd848b3;});}else{return _0xd848b3;}})['catch'](function(_0x5ba953){logger[_0x0584('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5ba953);throw _0x5ba953;});}return _0xd848b3;})[_0x0584('0x29')](respondWithResult(_0x268b42,0xc9))[_0x0584('0x4a')](handleError(_0x268b42,null));};exports[_0x0584('0x55')]=function(_0x460826,_0x3a4f71){if(_0x460826[_0x0584('0x4f')]['id']){delete _0x460826[_0x0584('0x4f')]['id'];}return db[_0x0584('0x30')]['find']({'where':{'id':_0x460826[_0x0584('0x4c')]['id']}})[_0x0584('0x29')](handleEntityNotFound(_0x3a4f71,null))[_0x0584('0x29')](saveUpdates(_0x460826['body'],null))[_0x0584('0x29')](respondWithResult(_0x3a4f71,null))[_0x0584('0x4a')](handleError(_0x3a4f71,null));};exports[_0x0584('0x25')]=function(_0x3353dd,_0x1972c){return db[_0x0584('0x30')][_0x0584('0x4d')]({'where':{'id':_0x3353dd[_0x0584('0x4c')]['id']}})[_0x0584('0x29')](handleEntityNotFound(_0x1972c,null))[_0x0584('0x29')](removeEntity(_0x1972c,null))[_0x0584('0x4a')](handleError(_0x1972c,null));};exports['addUsers']=function(_0x299100,_0x1ab78a,_0x26017f){return db['SquareProject'][_0x0584('0x4d')]({'where':{'id':_0x299100[_0x0584('0x4c')]['id']}})[_0x0584('0x29')](handleEntityNotFound(_0x1ab78a,null))['then'](function(_0x23985e){if(_0x23985e){return _0x23985e[_0x0584('0x56')](_0x299100[_0x0584('0x4f')][_0x0584('0x57')],_[_0x0584('0x58')](_0x299100['body'],[_0x0584('0x57'),'id'])||{});}})[_0x0584('0x29')](respondWithResult(_0x1ab78a,null))[_0x0584('0x4a')](handleError(_0x1ab78a,null));};exports[_0x0584('0x59')]=function(_0x1fa08b,_0xfad174,_0x44e7d5){return db['SquareProject'][_0x0584('0x4d')]({'where':{'id':_0x1fa08b[_0x0584('0x4c')]['id']}})[_0x0584('0x29')](handleEntityNotFound(_0xfad174,null))[_0x0584('0x29')](function(_0x48ac1d){if(_0x48ac1d){return _0x48ac1d[_0x0584('0x59')](_0x1fa08b['query']['ids'])['then'](function(){if(_[_0x0584('0x5a')](_0x1fa08b[_0x0584('0x35')][_0x0584('0x57')])){for(var _0x147343=0x0;_0x147343<_0x1fa08b[_0x0584('0x35')][_0x0584('0x57')]['length'];_0x147343+=0x1){socket[_0x0584('0x5b')](_0x0584('0x5c'),{'UserId':Number(_0x1fa08b['query']['ids'][_0x147343]),'SquareProjectId':Number(_0x1fa08b['params']['id'])});}}else{socket[_0x0584('0x5b')](_0x0584('0x5c'),{'UserId':Number(_0x1fa08b[_0x0584('0x35')][_0x0584('0x57')]),'SquareProjectId':Number(_0x1fa08b[_0x0584('0x4c')]['id'])});}});}})['then'](respondWithStatusCode(_0xfad174,null))[_0x0584('0x4a')](handleError(_0xfad174,null));};exports[_0x0584('0x5d')]=function(_0x3d2e38,_0x5cefa3,_0x5b8808){var _0x5861a1={};var _0x1db0eb={};var _0x436c35;var _0x4392;return db[_0x0584('0x30')]['findOne']({'where':{'id':_0x3d2e38['params']['id']}})[_0x0584('0x29')](handleEntityNotFound(_0x5cefa3,null))[_0x0584('0x29')](function(_0x37639c){if(_0x37639c){_0x436c35=_0x37639c;_0x1db0eb[_0x0584('0x34')]=_['keys'](db[_0x0584('0x5e')]['rawAttributes']);_0x1db0eb[_0x0584('0x35')]=_[_0x0584('0x36')](_0x3d2e38[_0x0584('0x35')]);_0x1db0eb[_0x0584('0x40')]=_[_0x0584('0x38')](_0x1db0eb[_0x0584('0x34')],_0x1db0eb[_0x0584('0x35')]);_0x5861a1[_0x0584('0x37')]=_[_0x0584('0x38')](_0x1db0eb[_0x0584('0x34')],qs[_0x0584('0x39')](_0x3d2e38[_0x0584('0x35')][_0x0584('0x39')]));_0x5861a1[_0x0584('0x37')]=_0x5861a1[_0x0584('0x37')]['length']?_0x5861a1[_0x0584('0x37')]:_0x1db0eb[_0x0584('0x34')];_0x5861a1[_0x0584('0x3d')]=qs[_0x0584('0x3e')](_0x3d2e38[_0x0584('0x35')]['sort']);_0x5861a1[_0x0584('0x3f')]=qs['filters'](_['pick'](_0x3d2e38[_0x0584('0x35')],_0x1db0eb[_0x0584('0x40')]));if(_0x3d2e38[_0x0584('0x35')][_0x0584('0x42')]){_0x5861a1[_0x0584('0x3f')]=_[_0x0584('0x44')](_0x5861a1['where'],{'$or':_[_0x0584('0x2f')](_0x5861a1['attributes'],function(_0x1fc9da){var _0x2ffaaa={};_0x2ffaaa[_0x1fc9da]={'$like':'%'+_0x3d2e38[_0x0584('0x35')][_0x0584('0x42')]+'%'};return _0x2ffaaa;})});}_0x5861a1=_[_0x0584('0x44')]({},_0x5861a1,_0x3d2e38['options']);return _0x436c35[_0x0584('0x5d')](_0x5861a1);}})[_0x0584('0x29')](function(_0xde4c77){if(_0xde4c77){_0x4392=_0xde4c77['length'];if(!_0x3d2e38[_0x0584('0x35')][_0x0584('0x3b')](_0x0584('0x3c'))){_0x5861a1['limit']=qs['limit'](_0x3d2e38[_0x0584('0x35')]['limit']);_0x5861a1['offset']=qs[_0x0584('0x1d')](_0x3d2e38[_0x0584('0x35')][_0x0584('0x1d')]);}return _0x436c35[_0x0584('0x5d')](_0x5861a1);}})[_0x0584('0x29')](function(_0x528a48){if(_0x528a48){return _0x528a48?{'count':_0x4392,'rows':_0x528a48}:null;}})['then'](respondWithResult(_0x5cefa3,null))[_0x0584('0x4a')](handleError(_0x5cefa3,null));}; \ No newline at end of file +var _0x54f4=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./squareProject.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','get','SquareProjects','UserProfileResource','error','stack','name','send','index','map','SquareProject','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','type','merge','options','includeAll','rows','catch','show','length','include','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','User','order','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring'];(function(_0x4c3c94,_0xd18ede){var _0xa3a025=function(_0x10187d){while(--_0x10187d){_0x4c3c94['push'](_0x4c3c94['shift']());}};_0xa3a025(++_0xd18ede);}(_0x54f4,0x113));var _0x454f=function(_0x562f83,_0x433be8){_0x562f83=_0x562f83-0x0;var _0x7b9cfe=_0x54f4[_0x562f83];return _0x7b9cfe;};'use strict';var emlformat=require(_0x454f('0x0'));var rimraf=require(_0x454f('0x1'));var zipdir=require(_0x454f('0x2'));var jsonpatch=require(_0x454f('0x3'));var rp=require(_0x454f('0x4'));var moment=require(_0x454f('0x5'));var BPromise=require(_0x454f('0x6'));var Mustache=require(_0x454f('0x7'));var util=require('util');var path=require('path');var sox=require(_0x454f('0x8'));var csv=require(_0x454f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x454f('0xa'));var _=require(_0x454f('0xb'));var squel=require(_0x454f('0xc'));var crypto=require(_0x454f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x454f('0xe'));var toCsv=require(_0x454f('0x9'));var querystring=require(_0x454f('0xf'));var Papa=require(_0x454f('0x10'));var Redis=require(_0x454f('0x11'));var authService=require(_0x454f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x454f('0x13'));var hardwareService=require(_0x454f('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x454f('0x15'));var config=require(_0x454f('0x16'));var licenseUtil=require(_0x454f('0x17'));var db=require(_0x454f('0x18'))['db'];config[_0x454f('0x19')]=_[_0x454f('0x1a')](config['redis'],{'host':_0x454f('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x454f('0x19')]));require(_0x454f('0x1c'))[_0x454f('0x1d')](socket);function respondWithStatusCode(_0x52734d,_0x188d63){_0x188d63=_0x188d63||0xcc;return function(_0x4420c3){if(_0x4420c3){return _0x52734d[_0x454f('0x1e')](_0x188d63);}return _0x52734d['status'](_0x188d63)[_0x454f('0x1f')]();};}function respondWithResult(_0x2053ac,_0x1c7f65){_0x1c7f65=_0x1c7f65||0xc8;return function(_0x484a51){if(_0x484a51){return _0x2053ac[_0x454f('0x20')](_0x1c7f65)[_0x454f('0x21')](_0x484a51);}};}function respondWithFilteredResult(_0x4512e3,_0x18daff){return function(_0x4d30a3){if(_0x4d30a3){var _0xca81fe=typeof _0x18daff[_0x454f('0x22')]===_0x454f('0x23')&&typeof _0x18daff[_0x454f('0x24')]===_0x454f('0x23');var _0x3622a6=_0x4d30a3[_0x454f('0x25')];var _0x2683d1=_0xca81fe?0x0:_0x18daff[_0x454f('0x22')];var _0x3a697c=_0xca81fe?_0x4d30a3['count']:_0x18daff[_0x454f('0x22')]+_0x18daff[_0x454f('0x24')];var _0xca00b4;if(_0x3a697c>=_0x3622a6){_0x3a697c=_0x3622a6;_0xca00b4=0xc8;}else{_0xca00b4=0xce;}_0x4512e3[_0x454f('0x20')](_0xca00b4);return _0x4512e3['set'](_0x454f('0x26'),_0x2683d1+'-'+_0x3a697c+'/'+_0x3622a6)['json'](_0x4d30a3);}return null;};}function patchUpdates(_0x1ad75c){return function(_0x5a08bf){try{jsonpatch['apply'](_0x5a08bf,_0x1ad75c,!![]);}catch(_0x3c8aee){return BPromise['reject'](_0x3c8aee);}return _0x5a08bf[_0x454f('0x27')]();};}function saveUpdates(_0x487f3c,_0x26b3c3){return function(_0x2dec85){if(_0x2dec85){return _0x2dec85[_0x454f('0x28')](_0x487f3c)[_0x454f('0x29')](function(_0x20f72a){return _0x20f72a;});}return null;};}function removeEntity(_0x21b754,_0x126223){return function(_0x147d2d){if(_0x147d2d){return _0x147d2d[_0x454f('0x2a')]()[_0x454f('0x29')](function(){var _0x3936b6=_0x147d2d[_0x454f('0x2b')]({'plain':!![]});var _0x54d481=_0x454f('0x2c');return db[_0x454f('0x2d')]['destroy']({'where':{'type':_0x54d481,'resourceId':_0x3936b6['id']}})[_0x454f('0x29')](function(){return _0x147d2d;});})[_0x454f('0x29')](function(){_0x21b754[_0x454f('0x20')](0xcc)[_0x454f('0x1f')]();});}};}function handleEntityNotFound(_0x250538,_0x46aff2){return function(_0x4037a0){if(!_0x4037a0){_0x250538[_0x454f('0x1e')](0x194);}return _0x4037a0;};}function handleError(_0x5953cf,_0x3d8ed1){_0x3d8ed1=_0x3d8ed1||0x1f4;return function(_0x44ad2c){logger[_0x454f('0x2e')](_0x44ad2c[_0x454f('0x2f')]);if(_0x44ad2c[_0x454f('0x30')]){delete _0x44ad2c[_0x454f('0x30')];}_0x5953cf[_0x454f('0x20')](_0x3d8ed1)[_0x454f('0x31')](_0x44ad2c);};}exports[_0x454f('0x32')]=function(_0x6b49bf,_0x431544){var _0xa8d8ce={},_0x4fc361={},_0x544f10={'count':0x0,'rows':[]};var _0x308f47=_[_0x454f('0x33')](db[_0x454f('0x34')][_0x454f('0x35')],function(_0x62e360){return{'name':_0x62e360['fieldName'],'type':_0x62e360['type'][_0x454f('0x36')]};});_0x4fc361[_0x454f('0x37')]=_['map'](_0x308f47,'name');_0x4fc361[_0x454f('0x38')]=_[_0x454f('0x39')](_0x6b49bf[_0x454f('0x38')]);_0x4fc361[_0x454f('0x3a')]=_[_0x454f('0x3b')](_0x4fc361[_0x454f('0x37')],_0x4fc361[_0x454f('0x38')]);_0xa8d8ce[_0x454f('0x3c')]=_[_0x454f('0x3b')](_0x4fc361[_0x454f('0x37')],qs['fields'](_0x6b49bf[_0x454f('0x38')][_0x454f('0x3d')]));_0xa8d8ce[_0x454f('0x3c')]=_0xa8d8ce[_0x454f('0x3c')]['length']?_0xa8d8ce[_0x454f('0x3c')]:_0x4fc361['model'];if(!_0x6b49bf[_0x454f('0x38')][_0x454f('0x3e')](_0x454f('0x3f'))){_0xa8d8ce['limit']=qs[_0x454f('0x24')](_0x6b49bf[_0x454f('0x38')]['limit']);_0xa8d8ce[_0x454f('0x22')]=qs[_0x454f('0x22')](_0x6b49bf[_0x454f('0x38')][_0x454f('0x22')]);}_0xa8d8ce['order']=qs[_0x454f('0x40')](_0x6b49bf[_0x454f('0x38')][_0x454f('0x40')]);_0xa8d8ce[_0x454f('0x41')]=qs[_0x454f('0x3a')](_[_0x454f('0x42')](_0x6b49bf[_0x454f('0x38')],_0x4fc361[_0x454f('0x3a')]),_0x308f47);if(_0x6b49bf['query'][_0x454f('0x43')]){_0xa8d8ce[_0x454f('0x41')]=_['merge'](_0xa8d8ce['where'],{'$or':_[_0x454f('0x33')](_0x308f47,function(_0x13a67e){if(_0x13a67e[_0x454f('0x44')]!=='VIRTUAL'){var _0x50faeb={};_0x50faeb[_0x13a67e[_0x454f('0x30')]]={'$like':'%'+_0x6b49bf[_0x454f('0x38')][_0x454f('0x43')]+'%'};return _0x50faeb;}})});}_0xa8d8ce=_[_0x454f('0x45')]({},_0xa8d8ce,_0x6b49bf[_0x454f('0x46')]);var _0x8cb191={'where':_0xa8d8ce[_0x454f('0x41')]};return db[_0x454f('0x34')][_0x454f('0x25')](_0x8cb191)[_0x454f('0x29')](function(_0x509c68){_0x544f10[_0x454f('0x25')]=_0x509c68;if(_0x6b49bf[_0x454f('0x38')][_0x454f('0x47')]){_0xa8d8ce['include']=[{'all':!![]}];}return db[_0x454f('0x34')]['findAll'](_0xa8d8ce);})[_0x454f('0x29')](function(_0x3a858c){_0x544f10[_0x454f('0x48')]=_0x3a858c;return _0x544f10;})[_0x454f('0x29')](respondWithFilteredResult(_0x431544,_0xa8d8ce))[_0x454f('0x49')](handleError(_0x431544,null));};exports[_0x454f('0x4a')]=function(_0x1b288e,_0xa1f2b8){var _0x3e9c59={'raw':![],'where':{'id':_0x1b288e['params']['id']}},_0x2e141b={};_0x2e141b['model']=_[_0x454f('0x39')](db[_0x454f('0x34')][_0x454f('0x35')]);_0x2e141b['query']=_[_0x454f('0x39')](_0x1b288e[_0x454f('0x38')]);_0x2e141b[_0x454f('0x3a')]=_[_0x454f('0x3b')](_0x2e141b[_0x454f('0x37')],_0x2e141b[_0x454f('0x38')]);_0x3e9c59[_0x454f('0x3c')]=_[_0x454f('0x3b')](_0x2e141b[_0x454f('0x37')],qs['fields'](_0x1b288e[_0x454f('0x38')][_0x454f('0x3d')]));_0x3e9c59['attributes']=_0x3e9c59[_0x454f('0x3c')][_0x454f('0x4b')]?_0x3e9c59[_0x454f('0x3c')]:_0x2e141b[_0x454f('0x37')];if(_0x1b288e['query'][_0x454f('0x47')]){_0x3e9c59[_0x454f('0x4c')]=[{'all':!![]}];}_0x3e9c59=_[_0x454f('0x45')]({},_0x3e9c59,_0x1b288e[_0x454f('0x46')]);return db[_0x454f('0x34')][_0x454f('0x4d')](_0x3e9c59)[_0x454f('0x29')](handleEntityNotFound(_0xa1f2b8,null))[_0x454f('0x29')](respondWithResult(_0xa1f2b8,null))[_0x454f('0x49')](handleError(_0xa1f2b8,null));};exports[_0x454f('0x4e')]=function(_0x524e4f,_0x31851d){return db[_0x454f('0x34')][_0x454f('0x4e')](_0x524e4f[_0x454f('0x4f')],{})[_0x454f('0x29')](function(_0x1ef6e4){var _0x5e40a0=_0x524e4f['user'][_0x454f('0x2b')]({'plain':!![]});if(!_0x5e40a0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5e40a0[_0x454f('0x50')]===_0x454f('0x51')){var _0x19fae0=_0x1ef6e4[_0x454f('0x2b')]({'plain':!![]});var _0x8492fc=_0x454f('0x2c');return db[_0x454f('0x52')][_0x454f('0x4d')]({'where':{'name':_0x8492fc,'userProfileId':_0x5e40a0[_0x454f('0x53')]},'raw':!![]})[_0x454f('0x29')](function(_0x2ae638){if(_0x2ae638&&_0x2ae638[_0x454f('0x54')]===0x0){return db['UserProfileResource'][_0x454f('0x4e')]({'name':_0x19fae0['name'],'resourceId':_0x19fae0['id'],'type':_0x2ae638[_0x454f('0x30')],'sectionId':_0x2ae638['id']},{})[_0x454f('0x29')](function(){return _0x1ef6e4;});}else{return _0x1ef6e4;}})[_0x454f('0x49')](function(_0xfaacb6){logger['error'](_0x454f('0x55'),_0xfaacb6);throw _0xfaacb6;});}return _0x1ef6e4;})['then'](respondWithResult(_0x31851d,0xc9))[_0x454f('0x49')](handleError(_0x31851d,null));};exports[_0x454f('0x28')]=function(_0x59893a,_0x2d005f){if(_0x59893a[_0x454f('0x4f')]['id']){delete _0x59893a[_0x454f('0x4f')]['id'];}return db[_0x454f('0x34')]['find']({'where':{'id':_0x59893a[_0x454f('0x56')]['id']}})[_0x454f('0x29')](handleEntityNotFound(_0x2d005f,null))[_0x454f('0x29')](saveUpdates(_0x59893a[_0x454f('0x4f')],null))['then'](respondWithResult(_0x2d005f,null))['catch'](handleError(_0x2d005f,null));};exports['destroy']=function(_0x2767f6,_0x209b06){return db['SquareProject'][_0x454f('0x4d')]({'where':{'id':_0x2767f6[_0x454f('0x56')]['id']}})[_0x454f('0x29')](handleEntityNotFound(_0x209b06,null))['then'](removeEntity(_0x209b06,null))[_0x454f('0x49')](handleError(_0x209b06,null));};exports[_0x454f('0x57')]=function(_0x2f929e,_0x98fde0,_0x14f5b7){return db[_0x454f('0x34')][_0x454f('0x4d')]({'where':{'id':_0x2f929e[_0x454f('0x56')]['id']}})[_0x454f('0x29')](handleEntityNotFound(_0x98fde0,null))[_0x454f('0x29')](function(_0x32195f){if(_0x32195f){return _0x32195f[_0x454f('0x57')](_0x2f929e[_0x454f('0x4f')][_0x454f('0x58')],_[_0x454f('0x59')](_0x2f929e[_0x454f('0x4f')],[_0x454f('0x58'),'id'])||{});}})[_0x454f('0x29')](respondWithResult(_0x98fde0,null))[_0x454f('0x49')](handleError(_0x98fde0,null));};exports['removeUsers']=function(_0x1715dc,_0x5240fb,_0x428b53){return db[_0x454f('0x34')][_0x454f('0x4d')]({'where':{'id':_0x1715dc[_0x454f('0x56')]['id']}})[_0x454f('0x29')](handleEntityNotFound(_0x5240fb,null))[_0x454f('0x29')](function(_0x1a0717){if(_0x1a0717){return _0x1a0717[_0x454f('0x5a')](_0x1715dc[_0x454f('0x38')][_0x454f('0x58')])['then'](function(){if(_[_0x454f('0x5b')](_0x1715dc[_0x454f('0x38')][_0x454f('0x58')])){for(var _0x38cbbe=0x0;_0x38cbbe<_0x1715dc[_0x454f('0x38')]['ids'][_0x454f('0x4b')];_0x38cbbe+=0x1){socket[_0x454f('0x5c')](_0x454f('0x5d'),{'UserId':Number(_0x1715dc[_0x454f('0x38')][_0x454f('0x58')][_0x38cbbe]),'SquareProjectId':Number(_0x1715dc[_0x454f('0x56')]['id'])});}}else{socket[_0x454f('0x5c')]('userSquareProject:remove',{'UserId':Number(_0x1715dc[_0x454f('0x38')][_0x454f('0x58')]),'SquareProjectId':Number(_0x1715dc['params']['id'])});}});}})[_0x454f('0x29')](respondWithStatusCode(_0x5240fb,null))[_0x454f('0x49')](handleError(_0x5240fb,null));};exports[_0x454f('0x5e')]=function(_0x9a99de,_0x3855c5,_0x4b7ddb){var _0x20ca87={};var _0x1caf6f={};var _0x21d8e6;var _0x25335d;return db[_0x454f('0x34')]['findOne']({'where':{'id':_0x9a99de[_0x454f('0x56')]['id']}})[_0x454f('0x29')](handleEntityNotFound(_0x3855c5,null))[_0x454f('0x29')](function(_0xd8b49c){if(_0xd8b49c){_0x21d8e6=_0xd8b49c;_0x1caf6f['model']=_[_0x454f('0x39')](db[_0x454f('0x5f')]['rawAttributes']);_0x1caf6f[_0x454f('0x38')]=_[_0x454f('0x39')](_0x9a99de[_0x454f('0x38')]);_0x1caf6f[_0x454f('0x3a')]=_[_0x454f('0x3b')](_0x1caf6f[_0x454f('0x37')],_0x1caf6f[_0x454f('0x38')]);_0x20ca87[_0x454f('0x3c')]=_[_0x454f('0x3b')](_0x1caf6f[_0x454f('0x37')],qs[_0x454f('0x3d')](_0x9a99de['query']['fields']));_0x20ca87['attributes']=_0x20ca87[_0x454f('0x3c')][_0x454f('0x4b')]?_0x20ca87[_0x454f('0x3c')]:_0x1caf6f[_0x454f('0x37')];_0x20ca87[_0x454f('0x60')]=qs['sort'](_0x9a99de[_0x454f('0x38')][_0x454f('0x40')]);_0x20ca87[_0x454f('0x41')]=qs[_0x454f('0x3a')](_[_0x454f('0x42')](_0x9a99de[_0x454f('0x38')],_0x1caf6f[_0x454f('0x3a')]));if(_0x9a99de[_0x454f('0x38')]['filter']){_0x20ca87[_0x454f('0x41')]=_['merge'](_0x20ca87[_0x454f('0x41')],{'$or':_[_0x454f('0x33')](_0x20ca87['attributes'],function(_0x3b4f36){var _0xec3ed7={};_0xec3ed7[_0x3b4f36]={'$like':'%'+_0x9a99de[_0x454f('0x38')][_0x454f('0x43')]+'%'};return _0xec3ed7;})});}_0x20ca87=_[_0x454f('0x45')]({},_0x20ca87,_0x9a99de[_0x454f('0x46')]);return _0x21d8e6[_0x454f('0x5e')](_0x20ca87);}})[_0x454f('0x29')](function(_0x3e9e2f){if(_0x3e9e2f){_0x25335d=_0x3e9e2f[_0x454f('0x4b')];if(!_0x9a99de[_0x454f('0x38')][_0x454f('0x3e')](_0x454f('0x3f'))){_0x20ca87[_0x454f('0x24')]=qs['limit'](_0x9a99de[_0x454f('0x38')][_0x454f('0x24')]);_0x20ca87['offset']=qs[_0x454f('0x22')](_0x9a99de[_0x454f('0x38')][_0x454f('0x22')]);}return _0x21d8e6[_0x454f('0x5e')](_0x20ca87);}})['then'](function(_0x5b4640){if(_0x5b4640){return _0x5b4640?{'count':_0x25335d,'rows':_0x5b4640}:null;}})[_0x454f('0x29')](respondWithResult(_0x3855c5,null))['catch'](handleError(_0x3855c5,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 85b70b5..3a7f722 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 _0x0c18=['update','remove','emit','hasOwnProperty','exports','events','SquareProject','setMaxListeners','save'];(function(_0x4ea971,_0x174234){var _0x86b88d=function(_0x549b7e){while(--_0x549b7e){_0x4ea971['push'](_0x4ea971['shift']());}};_0x86b88d(++_0x174234);}(_0x0c18,0x1be));var _0x80c1=function(_0x65c50e,_0x1aa926){_0x65c50e=_0x65c50e-0x0;var _0x4573e7=_0x0c18[_0x65c50e];return _0x4573e7;};'use strict';var EventEmitter=require(_0x80c1('0x0'));var SquareProject=require('../../mysqldb')['db'][_0x80c1('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x80c1('0x2')](0x0);var events={'afterCreate':_0x80c1('0x3'),'afterUpdate':_0x80c1('0x4'),'afterDestroy':_0x80c1('0x5')};function emitEvent(_0x500ac2){return function(_0x721063,_0x5ea903,_0x199f96){SquareProjectEvents[_0x80c1('0x6')](_0x500ac2+':'+_0x721063['id'],_0x721063);SquareProjectEvents[_0x80c1('0x6')](_0x500ac2,_0x721063);_0x199f96(null);};}for(var e in events){if(events[_0x80c1('0x7')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0x80c1('0x8')]=SquareProjectEvents; \ No newline at end of file +var _0x431d=['setMaxListeners','save','update','emit','hasOwnProperty','hook','events'];(function(_0x1484b1,_0x55c74e){var _0x3c1025=function(_0x432892){while(--_0x432892){_0x1484b1['push'](_0x1484b1['shift']());}};_0x3c1025(++_0x55c74e);}(_0x431d,0x1c6));var _0xd431=function(_0x2ece52,_0x538ee5){_0x2ece52=_0x2ece52-0x0;var _0x585ea8=_0x431d[_0x2ece52];return _0x585ea8;};'use strict';var EventEmitter=require(_0xd431('0x0'));var SquareProject=require('../../mysqldb')['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xd431('0x1')](0x0);var events={'afterCreate':_0xd431('0x2'),'afterUpdate':_0xd431('0x3'),'afterDestroy':'remove'};function emitEvent(_0x468512){return function(_0x399bdc,_0x4687d3,_0x5ed641){SquareProjectEvents[_0xd431('0x4')](_0x468512+':'+_0x399bdc['id'],_0x399bdc);SquareProjectEvents[_0xd431('0x4')](_0x468512,_0x399bdc);_0x5ed641(null);};}for(var e in events){if(events[_0xd431('0x5')](e)){var event=events[e];SquareProject[_0xd431('0x6')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index a5bce88..28ca564 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 _0xf34f=['moment','bluebird','request-promise','path','rimraf','exports','SquareProject','square_projects','preproduction','YYYY-MM-DD\x20HH:mm:ss','changed','production','publishedAt','util','../../config/logger'];(function(_0x144310,_0x3f3931){var _0x3ac520=function(_0x2c1543){while(--_0x2c1543){_0x144310['push'](_0x144310['shift']());}};_0x3ac520(++_0x3f3931);}(_0xf34f,0xc1));var _0xff34=function(_0x374b4f,_0x2774de){_0x374b4f=_0x374b4f-0x0;var _0x3343bc=_0xf34f[_0x374b4f];return _0x3343bc;};'use strict';var _=require('lodash');var util=require(_0xff34('0x0'));var logger=require(_0xff34('0x1'))('api');var moment=require(_0xff34('0x2'));var BPromise=require(_0xff34('0x3'));var rp=require(_0xff34('0x4'));var fs=require('fs');var path=require(_0xff34('0x5'));var rimraf=require(_0xff34('0x6'));var config=require('../../config/environment');var attributes=require('./squareProject.attributes');module[_0xff34('0x7')]=function(_0x26f5e1,_0x14d315){return _0x26f5e1['define'](_0xff34('0x8'),attributes,{'tableName':_0xff34('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4bad0f,_0x5e780b,_0x5237f2){if(_0x4bad0f['changed'](_0xff34('0xa'))){_0x4bad0f['savedAt']=moment()['format'](_0xff34('0xb'));}if(_0x4bad0f[_0xff34('0xc')](_0xff34('0xd'))){_0x4bad0f[_0xff34('0xe')]=moment()['format'](_0xff34('0xb'));}_0x5237f2(null,_0x4bad0f);}}});}; \ No newline at end of file +var _0x33cb=['path','rimraf','../../config/environment','./squareProject.attributes','exports','define','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','util','../../config/logger','api','bluebird'];(function(_0x938c82,_0x43192a){var _0x5c04e5=function(_0x2aa54e){while(--_0x2aa54e){_0x938c82['push'](_0x938c82['shift']());}};_0x5c04e5(++_0x43192a);}(_0x33cb,0x8b));var _0xb33c=function(_0x31c87a,_0xb11b4){_0x31c87a=_0x31c87a-0x0;var _0x42f042=_0x33cb[_0x31c87a];return _0x42f042;};'use strict';var _=require(_0xb33c('0x0'));var util=require(_0xb33c('0x1'));var logger=require(_0xb33c('0x2'))(_0xb33c('0x3'));var moment=require('moment');var BPromise=require(_0xb33c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb33c('0x5'));var rimraf=require(_0xb33c('0x6'));var config=require(_0xb33c('0x7'));var attributes=require(_0xb33c('0x8'));module[_0xb33c('0x9')]=function(_0xcb593f,_0x1367d2){return _0xcb593f[_0xb33c('0xa')]('SquareProject',attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x21a858,_0x5be7b0,_0x32fa7){if(_0x21a858[_0xb33c('0xb')](_0xb33c('0xc'))){_0x21a858[_0xb33c('0xd')]=moment()[_0xb33c('0xe')](_0xb33c('0xf'));}if(_0x21a858['changed'](_0xb33c('0x10'))){_0x21a858[_0xb33c('0x11')]=moment()[_0xb33c('0xe')](_0xb33c('0xf'));}_0x32fa7(null,_0x21a858);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 4bfe9fc..105e0af 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 _0x65ee=['SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','SquareProject','find','options','raw','where','include','map','attributes','model','then','ShowSquareProject','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','SquareProject,\x20%s,\x20%s','request\x20sent'];(function(_0x2f74e4,_0x4385c4){var _0x1498b8=function(_0x25b3b6){while(--_0x25b3b6){_0x2f74e4['push'](_0x2f74e4['shift']());}};_0x1498b8(++_0x4385c4);}(_0x65ee,0xa9));var _0xe65e=function(_0x2e0e38,_0xc8afa1){_0x2e0e38=_0x2e0e38-0x0;var _0x255e17=_0x65ee[_0x2e0e38];return _0x255e17;};'use strict';var _=require(_0xe65e('0x0'));var util=require(_0xe65e('0x1'));var moment=require('moment');var BPromise=require(_0xe65e('0x2'));var rs=require(_0xe65e('0x3'));var fs=require('fs');var Redis=require(_0xe65e('0x4'));var db=require(_0xe65e('0x5'))['db'];var utils=require(_0xe65e('0x6'));var logger=require(_0xe65e('0x7'))(_0xe65e('0x8'));var config=require('../../config/environment');var jayson=require(_0xe65e('0x9'));var client=jayson[_0xe65e('0xa')][_0xe65e('0xb')]({'port':0x232a});config[_0xe65e('0xc')]=_[_0xe65e('0xd')](config['redis'],{'host':_0xe65e('0xe'),'port':0x18eb});var socket=require(_0xe65e('0xf'))(new Redis(config['redis']));require('./squareProject.socket')[_0xe65e('0x10')](socket);function respondWithRpcPromise(_0x511d4e,_0x299993,_0x411b6e){return new BPromise(function(_0x203057,_0x4ac6df){return client[_0xe65e('0x11')](_0x511d4e,_0x411b6e)['then'](function(_0x5321fd){logger[_0xe65e('0x12')](_0xe65e('0x13'),_0x299993,_0xe65e('0x14'));logger['debug'](_0xe65e('0x15'),_0x299993,_0xe65e('0x14'),JSON[_0xe65e('0x16')](_0x5321fd));if(_0x5321fd['error']){if(_0x5321fd[_0xe65e('0x17')]['code']===0x1f4){logger[_0xe65e('0x17')](_0xe65e('0x13'),_0x299993,_0x5321fd[_0xe65e('0x17')]['message']);return _0x4ac6df(_0x5321fd[_0xe65e('0x17')]['message']);}logger[_0xe65e('0x17')](_0xe65e('0x13'),_0x299993,_0x5321fd['error'][_0xe65e('0x18')]);return _0x203057(_0x5321fd[_0xe65e('0x17')][_0xe65e('0x18')]);}else{logger[_0xe65e('0x12')](_0xe65e('0x13'),_0x299993,_0xe65e('0x14'));_0x203057(_0x5321fd[_0xe65e('0x19')][_0xe65e('0x18')]);}})[_0xe65e('0x1a')](function(_0x57802e){logger[_0xe65e('0x17')]('SquareProject,\x20%s,\x20%s',_0x299993,_0x57802e);_0x4ac6df(_0x57802e);});});}exports['ShowSquareProject']=function(_0x2d7047){var _0x188598=this;return new Promise(function(_0x307806,_0x59e460){return db[_0xe65e('0x1b')][_0xe65e('0x1c')]({'raw':_0x2d7047[_0xe65e('0x1d')]?_0x2d7047['options'][_0xe65e('0x1e')]===undefined?!![]:![]:!![],'where':_0x2d7047['options']?_0x2d7047[_0xe65e('0x1d')][_0xe65e('0x1f')]||null:null,'attributes':_0x2d7047[_0xe65e('0x1d')]?_0x2d7047[_0xe65e('0x1d')]['attributes']||null:null,'include':_0x2d7047[_0xe65e('0x1d')]?_0x2d7047['options'][_0xe65e('0x20')]?_[_0xe65e('0x21')](_0x2d7047[_0xe65e('0x1d')]['include'],function(_0x1f1aa9){return{'model':db[_0x1f1aa9['model']],'as':_0x1f1aa9['as'],'attributes':_0x1f1aa9[_0xe65e('0x22')],'include':_0x1f1aa9[_0xe65e('0x20')]?_[_0xe65e('0x21')](_0x1f1aa9[_0xe65e('0x20')],function(_0xad5e65){return{'model':db[_0xad5e65[_0xe65e('0x23')]],'as':_0xad5e65['as'],'attributes':_0xad5e65[_0xe65e('0x22')],'include':_0xad5e65['include']?_[_0xe65e('0x21')](_0xad5e65[_0xe65e('0x20')],function(_0x6703d){return{'model':db[_0x6703d['model']],'as':_0x6703d['as'],'attributes':_0x6703d['attributes']};}):[]};}):[]};}):[]:[]})[_0xe65e('0x24')](function(_0x14707f){logger['info']('ShowSquareProject',_0x2d7047);logger['debug'](_0xe65e('0x25'),_0x2d7047,JSON[_0xe65e('0x16')](_0x14707f));_0x307806(_0x14707f);})[_0xe65e('0x1a')](function(_0x3cc0eb){logger[_0xe65e('0x17')](_0xe65e('0x25'),_0x3cc0eb['message'],_0x2d7047);_0x59e460(_0x188598[_0xe65e('0x17')](0x1f4,_0x3cc0eb[_0xe65e('0x18')]));});});}; \ No newline at end of file +var _0xd6bb=['info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSquareProject','SquareProject','find','options','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','./squareProject.socket','register','request'];(function(_0x1c3e6a,_0x50907c){var _0x22b96b=function(_0xe89f7a){while(--_0xe89f7a){_0x1c3e6a['push'](_0x1c3e6a['shift']());}};_0x22b96b(++_0x50907c);}(_0xd6bb,0x1ab));var _0xbd6b=function(_0x1526e1,_0x5ed5a5){_0x1526e1=_0x1526e1-0x0;var _0x249a1e=_0xd6bb[_0x1526e1];return _0x249a1e;};'use strict';var _=require(_0xbd6b('0x0'));var util=require(_0xbd6b('0x1'));var moment=require(_0xbd6b('0x2'));var BPromise=require(_0xbd6b('0x3'));var rs=require(_0xbd6b('0x4'));var fs=require('fs');var Redis=require(_0xbd6b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xbd6b('0x6'));var logger=require(_0xbd6b('0x7'))('rpc');var config=require(_0xbd6b('0x8'));var jayson=require(_0xbd6b('0x9'));var client=jayson['client'][_0xbd6b('0xa')]({'port':0x232a});config['redis']=_[_0xbd6b('0xb')](config[_0xbd6b('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xbd6b('0xd'))(new Redis(config[_0xbd6b('0xc')]));require(_0xbd6b('0xe'))[_0xbd6b('0xf')](socket);function respondWithRpcPromise(_0x49010d,_0x15e904,_0x4b2c7a){return new BPromise(function(_0x20ebe7,_0x535362){return client[_0xbd6b('0x10')](_0x49010d,_0x4b2c7a)['then'](function(_0x1800a2){logger[_0xbd6b('0x11')](_0xbd6b('0x12'),_0x15e904,_0xbd6b('0x13'));logger[_0xbd6b('0x14')](_0xbd6b('0x15'),_0x15e904,_0xbd6b('0x13'),JSON[_0xbd6b('0x16')](_0x1800a2));if(_0x1800a2[_0xbd6b('0x17')]){if(_0x1800a2[_0xbd6b('0x17')][_0xbd6b('0x18')]===0x1f4){logger[_0xbd6b('0x17')](_0xbd6b('0x12'),_0x15e904,_0x1800a2[_0xbd6b('0x17')]['message']);return _0x535362(_0x1800a2[_0xbd6b('0x17')]['message']);}logger['error'](_0xbd6b('0x12'),_0x15e904,_0x1800a2[_0xbd6b('0x17')][_0xbd6b('0x19')]);return _0x20ebe7(_0x1800a2[_0xbd6b('0x17')][_0xbd6b('0x19')]);}else{logger[_0xbd6b('0x11')](_0xbd6b('0x12'),_0x15e904,'request\x20sent');_0x20ebe7(_0x1800a2[_0xbd6b('0x1a')][_0xbd6b('0x19')]);}})[_0xbd6b('0x1b')](function(_0x10ce7f){logger[_0xbd6b('0x17')](_0xbd6b('0x12'),_0x15e904,_0x10ce7f);_0x535362(_0x10ce7f);});});}exports[_0xbd6b('0x1c')]=function(_0xbb2fae){var _0x4a00f6=this;return new Promise(function(_0x52e985,_0x1cf54e){return db[_0xbd6b('0x1d')][_0xbd6b('0x1e')]({'raw':_0xbb2fae[_0xbd6b('0x1f')]?_0xbb2fae[_0xbd6b('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0xbb2fae[_0xbd6b('0x1f')]?_0xbb2fae[_0xbd6b('0x1f')][_0xbd6b('0x20')]||null:null,'attributes':_0xbb2fae[_0xbd6b('0x1f')]?_0xbb2fae[_0xbd6b('0x1f')][_0xbd6b('0x21')]||null:null,'include':_0xbb2fae[_0xbd6b('0x1f')]?_0xbb2fae[_0xbd6b('0x1f')][_0xbd6b('0x22')]?_[_0xbd6b('0x23')](_0xbb2fae[_0xbd6b('0x1f')][_0xbd6b('0x22')],function(_0x28b05f){return{'model':db[_0x28b05f[_0xbd6b('0x24')]],'as':_0x28b05f['as'],'attributes':_0x28b05f[_0xbd6b('0x21')],'include':_0x28b05f[_0xbd6b('0x22')]?_[_0xbd6b('0x23')](_0x28b05f[_0xbd6b('0x22')],function(_0x3b5dab){return{'model':db[_0x3b5dab[_0xbd6b('0x24')]],'as':_0x3b5dab['as'],'attributes':_0x3b5dab[_0xbd6b('0x21')],'include':_0x3b5dab[_0xbd6b('0x22')]?_['map'](_0x3b5dab[_0xbd6b('0x22')],function(_0x77d4c5){return{'model':db[_0x77d4c5['model']],'as':_0x77d4c5['as'],'attributes':_0x77d4c5[_0xbd6b('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d218b){logger[_0xbd6b('0x11')](_0xbd6b('0x1c'),_0xbb2fae);logger[_0xbd6b('0x14')](_0xbd6b('0x1c'),_0xbb2fae,JSON['stringify'](_0x4d218b));_0x52e985(_0x4d218b);})[_0xbd6b('0x1b')](function(_0x4b2975){logger['error'](_0xbd6b('0x1c'),_0x4b2975[_0xbd6b('0x19')],_0xbb2fae);_0x1cf54e(_0x4a00f6[_0xbd6b('0x17')](0x1f4,_0x4b2975[_0xbd6b('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 9a0f935..194e80b 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 _0x4cf5=['removeListener','length','./squareProject.events','save','emit'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x4cf5,0x13d));var _0x54cf=function(_0x175136,_0x5cefc5){_0x175136=_0x175136-0x0;var _0x5931cc=_0x4cf5[_0x175136];return _0x5931cc;};'use strict';var SquareProjectEvents=require(_0x54cf('0x0'));var events=[_0x54cf('0x1'),'remove','update'];function createListener(_0x1fff02,_0x41ba38){return function(_0x5d5157){_0x41ba38[_0x54cf('0x2')](_0x1fff02,_0x5d5157);};}function removeListener(_0x5e8837,_0x5612d7){return function(){SquareProjectEvents[_0x54cf('0x3')](_0x5e8837,_0x5612d7);};}exports['register']=function(_0x259d4b){for(var _0x1f90d2=0x0,_0x1d9611=events[_0x54cf('0x4')];_0x1f90d2<_0x1d9611;_0x1f90d2++){var _0x53971a=events[_0x1f90d2];var _0x4205c6=createListener('squareProject:'+_0x53971a,_0x259d4b);SquareProjectEvents['on'](_0x53971a,_0x4205c6);}}; \ No newline at end of file +var _0xf683=['update','emit','removeListener','length','squareProject:','./squareProject.events','save','remove'];(function(_0x9deeee,_0x181346){var _0x18b1f6=function(_0x279f40){while(--_0x279f40){_0x9deeee['push'](_0x9deeee['shift']());}};_0x18b1f6(++_0x181346);}(_0xf683,0x13d));var _0x3f68=function(_0x4aeb8a,_0x40187d){_0x4aeb8a=_0x4aeb8a-0x0;var _0xbe493e=_0xf683[_0x4aeb8a];return _0xbe493e;};'use strict';var SquareProjectEvents=require(_0x3f68('0x0'));var events=[_0x3f68('0x1'),_0x3f68('0x2'),_0x3f68('0x3')];function createListener(_0x366d19,_0x15f60b){return function(_0xfbefbe){_0x15f60b[_0x3f68('0x4')](_0x366d19,_0xfbefbe);};}function removeListener(_0x1469e6,_0x961ec7){return function(){SquareProjectEvents[_0x3f68('0x5')](_0x1469e6,_0x961ec7);};}exports['register']=function(_0x48261b){for(var _0x324c51=0x0,_0x7f641e=events[_0x3f68('0x6')];_0x324c51<_0x7f641e;_0x324c51++){var _0x211b01=events[_0x324c51];var _0x32589b=createListener(_0x3f68('0x7')+_0x211b01,_0x48261b);SquareProjectEvents['on'](_0x211b01,_0x32589b);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 4a72be8..6934ea0 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 _0x5fab=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','/:id/download','download','create','put','update','delete','destroy','multer','util','connect-timeout'];(function(_0x41c8ec,_0x15a4ce){var _0x20da71=function(_0x1b0b54){while(--_0x1b0b54){_0x41c8ec['push'](_0x41c8ec['shift']());}};_0x20da71(++_0x15a4ce);}(_0x5fab,0x177));var _0xb5fa=function(_0x4320a7,_0x239a92){_0x4320a7=_0x4320a7-0x0;var _0x3700bf=_0x5fab[_0x4320a7];return _0x3700bf;};'use strict';var multer=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var path=require('path');var timeout=require(_0xb5fa('0x2'));var express=require(_0xb5fa('0x3'));var router=express[_0xb5fa('0x4')]();var fs_extra=require(_0xb5fa('0x5'));var auth=require(_0xb5fa('0x6'));var interaction=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var controller=require(_0xb5fa('0x9'));router[_0xb5fa('0xa')]('/',auth[_0xb5fa('0xb')](),controller['index']);router['get'](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xd')]);router['get'](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb5fa('0x10')]);router[_0xb5fa('0x11')](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x12')]);router[_0xb5fa('0x13')](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x14')]);module['exports']=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(_0xbeee5b,_0x1d641f){var _0x3c38b1=function(_0x2df02c){while(--_0x2df02c){_0xbeee5b['push'](_0xbeee5b['shift']());}};_0x3c38b1(++_0x1d641f);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5756c6,_0x58290a){_0x5756c6=_0x5756c6-0x0;var _0x4b5806=_0x5fc3[_0x5756c6];return _0x4b5806;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0xe')]('/',auth['isAuthenticated'](),controller[_0x35fc('0xf')]);router[_0x35fc('0x10')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0x11')]);router['delete'](_0x35fc('0x12'),auth[_0x35fc('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index a56b3bd..3142f38 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 _0x8ef6=['VIRTUAL','savePath','substring','lastIndexOf','sequelize','exports','STRING'];(function(_0x5dcb2f,_0x402ca3){var _0x2cf625=function(_0x3792e4){while(--_0x3792e4){_0x5dcb2f['push'](_0x5dcb2f['shift']());}};_0x2cf625(++_0x402ca3);}(_0x8ef6,0xf2));var _0x68ef=function(_0x5634f2,_0x50ac1b){_0x5634f2=_0x5634f2-0x0;var _0x5b7b58=_0x8ef6[_0x5634f2];return _0x5b7b58;};'use strict';var Sequelize=require(_0x68ef('0x0'));module[_0x68ef('0x1')]={'uniqueid':{'type':Sequelize[_0x68ef('0x2')]},'callerid':{'type':Sequelize[_0x68ef('0x2')]},'calleridname':{'type':Sequelize[_0x68ef('0x2')]},'context':{'type':Sequelize[_0x68ef('0x2')]},'extension':{'type':Sequelize[_0x68ef('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x68ef('0x2')]},'dnid':{'type':Sequelize[_0x68ef('0x2')]},'projectName':{'type':Sequelize[_0x68ef('0x2')]},'saveName':{'type':Sequelize[_0x68ef('0x2')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x68ef('0x3')],'get':function(){var _0x4740e8='';var _0x2de776=this['getDataValue'](_0x68ef('0x4'));if(_0x2de776){_0x4740e8=_0x2de776[_0x68ef('0x5')](_0x2de776[_0x68ef('0x6')]('.'));}return _0x4740e8;}}}; \ No newline at end of file +var _0xae24=['VIRTUAL','savePath','sequelize','STRING'];(function(_0x436442,_0x97aa37){var _0x55a545=function(_0x4089d7){while(--_0x4089d7){_0x436442['push'](_0x436442['shift']());}};_0x55a545(++_0x97aa37);}(_0xae24,0x182));var _0x4ae2=function(_0xd7b73d,_0x204f8a){_0xd7b73d=_0xd7b73d-0x0;var _0x4154ec=_0xae24[_0xd7b73d];return _0x4154ec;};'use strict';var Sequelize=require(_0x4ae2('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x4ae2('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x4ae2('0x1')]},'context':{'type':Sequelize[_0x4ae2('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x4ae2('0x1')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x4ae2('0x1')]},'saveName':{'type':Sequelize[_0x4ae2('0x1')]},'filename':{'type':Sequelize[_0x4ae2('0x1')]},'savePath':{'type':Sequelize[_0x4ae2('0x1')]},'format':{'type':Sequelize[_0x4ae2('0x2')],'get':function(){var _0x307247='';var _0x4f2e84=this['getDataValue'](_0x4ae2('0x3'));if(_0x4f2e84){_0x307247=_0x4f2e84['substring'](_0x4f2e84['lastIndexOf']('.'));}return _0x307247;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 392d3d5..a7bb2be 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 _0x37de=['../../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','limit','undefined','count','set','Content-Range','update','error','stack','name','send','index','SquareRecording','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','where','merge','map','VIRTUAL','filter','options','includeAll','include','then','show','params','keys','catch','create','body','find','download','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','unlink','message','Not\x20found','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x9f9816,_0x579b0e){var _0x40a913=function(_0x5340c4){while(--_0x5340c4){_0x9f9816['push'](_0x9f9816['shift']());}};_0x40a913(++_0x579b0e);}(_0x37de,0xb2));var _0xe37d=function(_0x10346c,_0x183ce6){_0x10346c=_0x10346c-0x0;var _0x262bd4=_0x37de[_0x10346c];return _0x262bd4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe37d('0x0'));var jsonpatch=require(_0xe37d('0x1'));var rp=require('request-promise');var moment=require(_0xe37d('0x2'));var BPromise=require(_0xe37d('0x3'));var Mustache=require(_0xe37d('0x4'));var util=require('util');var path=require(_0xe37d('0x5'));var sox=require(_0xe37d('0x6'));var csv=require(_0xe37d('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe37d('0x8'));var _=require(_0xe37d('0x9'));var squel=require(_0xe37d('0xa'));var crypto=require(_0xe37d('0xb'));var jsforce=require(_0xe37d('0xc'));var deskjs=require(_0xe37d('0xd'));var toCsv=require('to-csv');var querystring=require(_0xe37d('0xe'));var Papa=require(_0xe37d('0xf'));var Redis=require('ioredis');var authService=require(_0xe37d('0x10'));var qs=require(_0xe37d('0x11'));var as=require(_0xe37d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe37d('0x13'))(_0xe37d('0x14'));var utils=require(_0xe37d('0x15'));var config=require(_0xe37d('0x16'));var licenseUtil=require(_0xe37d('0x17'));var db=require(_0xe37d('0x18'))['db'];function respondWithStatusCode(_0x5608d7,_0x309243){_0x309243=_0x309243||0xcc;return function(_0x6543d9){if(_0x6543d9){return _0x5608d7[_0xe37d('0x19')](_0x309243);}return _0x5608d7[_0xe37d('0x1a')](_0x309243)[_0xe37d('0x1b')]();};}function respondWithResult(_0x56b72b,_0x53414e){_0x53414e=_0x53414e||0xc8;return function(_0x28b5e2){if(_0x28b5e2){return _0x56b72b[_0xe37d('0x1a')](_0x53414e)[_0xe37d('0x1c')](_0x28b5e2);}};}function respondWithFilteredResult(_0x3cb025,_0x267105){return function(_0x3d1a96){if(_0x3d1a96){var _0x4e538e=typeof _0x267105[_0xe37d('0x1d')]==='undefined'&&typeof _0x267105[_0xe37d('0x1e')]===_0xe37d('0x1f');var _0xf8e7bc=_0x3d1a96['count'];var _0x39ce22=_0x4e538e?0x0:_0x267105[_0xe37d('0x1d')];var _0x19f509=_0x4e538e?_0x3d1a96[_0xe37d('0x20')]:_0x267105[_0xe37d('0x1d')]+_0x267105[_0xe37d('0x1e')];var _0x595f4a;if(_0x19f509>=_0xf8e7bc){_0x19f509=_0xf8e7bc;_0x595f4a=0xc8;}else{_0x595f4a=0xce;}_0x3cb025[_0xe37d('0x1a')](_0x595f4a);return _0x3cb025[_0xe37d('0x21')](_0xe37d('0x22'),_0x39ce22+'-'+_0x19f509+'/'+_0xf8e7bc)[_0xe37d('0x1c')](_0x3d1a96);}return null;};}function patchUpdates(_0x210ecb){return function(_0x1064b2){try{jsonpatch['apply'](_0x1064b2,_0x210ecb,!![]);}catch(_0x84a534){return BPromise['reject'](_0x84a534);}return _0x1064b2['save']();};}function saveUpdates(_0x25169d,_0x57d183){return function(_0x3bcd95){if(_0x3bcd95){return _0x3bcd95[_0xe37d('0x23')](_0x25169d)['then'](function(_0x5a2022){return _0x5a2022;});}return null;};}function removeEntity(_0x418c4d,_0x35c174){return function(_0x128d7b){if(_0x128d7b){return _0x128d7b['destroy']()['then'](function(){_0x418c4d[_0xe37d('0x1a')](0xcc)[_0xe37d('0x1b')]();});}};}function handleEntityNotFound(_0x19e78e,_0x19f245){return function(_0x8121a6){if(!_0x8121a6){_0x19e78e[_0xe37d('0x19')](0x194);}return _0x8121a6;};}function handleError(_0x3a6489,_0x2b93d9){_0x2b93d9=_0x2b93d9||0x1f4;return function(_0x33dd86){logger[_0xe37d('0x24')](_0x33dd86[_0xe37d('0x25')]);if(_0x33dd86[_0xe37d('0x26')]){delete _0x33dd86[_0xe37d('0x26')];}_0x3a6489[_0xe37d('0x1a')](_0x2b93d9)[_0xe37d('0x27')](_0x33dd86);};}exports[_0xe37d('0x28')]=function(_0x44be6d,_0x4e817e){var _0x5d548d={},_0x4b7af6={},_0x42dbed={'count':0x0,'rows':[]};var _0x1479f3=_['map'](db[_0xe37d('0x29')][_0xe37d('0x2a')],function(_0x1363b7){return{'name':_0x1363b7['fieldName'],'type':_0x1363b7[_0xe37d('0x2b')][_0xe37d('0x2c')]};});_0x4b7af6[_0xe37d('0x2d')]=_['map'](_0x1479f3,_0xe37d('0x26'));_0x4b7af6[_0xe37d('0x2e')]=_['keys'](_0x44be6d[_0xe37d('0x2e')]);_0x4b7af6[_0xe37d('0x2f')]=_[_0xe37d('0x30')](_0x4b7af6['model'],_0x4b7af6[_0xe37d('0x2e')]);_0x5d548d[_0xe37d('0x31')]=_['intersection'](_0x4b7af6[_0xe37d('0x2d')],qs[_0xe37d('0x32')](_0x44be6d[_0xe37d('0x2e')][_0xe37d('0x32')]));_0x5d548d[_0xe37d('0x31')]=_0x5d548d[_0xe37d('0x31')][_0xe37d('0x33')]?_0x5d548d[_0xe37d('0x31')]:_0x4b7af6['model'];if(!_0x44be6d[_0xe37d('0x2e')][_0xe37d('0x34')]('nolimit')){_0x5d548d[_0xe37d('0x1e')]=qs[_0xe37d('0x1e')](_0x44be6d[_0xe37d('0x2e')][_0xe37d('0x1e')]);_0x5d548d[_0xe37d('0x1d')]=qs[_0xe37d('0x1d')](_0x44be6d[_0xe37d('0x2e')][_0xe37d('0x1d')]);}_0x5d548d[_0xe37d('0x35')]=qs['sort'](_0x44be6d[_0xe37d('0x2e')][_0xe37d('0x36')]);_0x5d548d['where']=qs['filters'](_[_0xe37d('0x37')](_0x44be6d[_0xe37d('0x2e')],_0x4b7af6[_0xe37d('0x2f')]),_0x1479f3);if(_0x44be6d['query']['filter']){_0x5d548d[_0xe37d('0x38')]=_[_0xe37d('0x39')](_0x5d548d[_0xe37d('0x38')],{'$or':_[_0xe37d('0x3a')](_0x1479f3,function(_0x53b958){if(_0x53b958[_0xe37d('0x2b')]!==_0xe37d('0x3b')){var _0xc133b1={};_0xc133b1[_0x53b958[_0xe37d('0x26')]]={'$like':'%'+_0x44be6d['query'][_0xe37d('0x3c')]+'%'};return _0xc133b1;}})});}_0x5d548d=_[_0xe37d('0x39')]({},_0x5d548d,_0x44be6d[_0xe37d('0x3d')]);var _0x481942={'where':_0x5d548d['where']};return db['SquareRecording'][_0xe37d('0x20')](_0x481942)['then'](function(_0x30e517){_0x42dbed[_0xe37d('0x20')]=_0x30e517;if(_0x44be6d[_0xe37d('0x2e')][_0xe37d('0x3e')]){_0x5d548d[_0xe37d('0x3f')]=[{'all':!![]}];}return db[_0xe37d('0x29')]['findAll'](_0x5d548d);})[_0xe37d('0x40')](function(_0x163f1f){_0x42dbed['rows']=_0x163f1f;return _0x42dbed;})[_0xe37d('0x40')](respondWithFilteredResult(_0x4e817e,_0x5d548d))['catch'](handleError(_0x4e817e,null));};exports[_0xe37d('0x41')]=function(_0x344c74,_0x2b29f5){var _0x2176d0={'raw':!![],'where':{'id':_0x344c74[_0xe37d('0x42')]['id']}},_0x28d595={};_0x28d595[_0xe37d('0x2d')]=_[_0xe37d('0x43')](db[_0xe37d('0x29')][_0xe37d('0x2a')]);_0x28d595[_0xe37d('0x2e')]=_[_0xe37d('0x43')](_0x344c74[_0xe37d('0x2e')]);_0x28d595[_0xe37d('0x2f')]=_[_0xe37d('0x30')](_0x28d595[_0xe37d('0x2d')],_0x28d595['query']);_0x2176d0['attributes']=_[_0xe37d('0x30')](_0x28d595[_0xe37d('0x2d')],qs[_0xe37d('0x32')](_0x344c74[_0xe37d('0x2e')][_0xe37d('0x32')]));_0x2176d0[_0xe37d('0x31')]=_0x2176d0['attributes'][_0xe37d('0x33')]?_0x2176d0[_0xe37d('0x31')]:_0x28d595[_0xe37d('0x2d')];if(_0x344c74[_0xe37d('0x2e')][_0xe37d('0x3e')]){_0x2176d0[_0xe37d('0x3f')]=[{'all':!![]}];}_0x2176d0=_['merge']({},_0x2176d0,_0x344c74[_0xe37d('0x3d')]);return db[_0xe37d('0x29')]['find'](_0x2176d0)[_0xe37d('0x40')](handleEntityNotFound(_0x2b29f5,null))[_0xe37d('0x40')](respondWithResult(_0x2b29f5,null))[_0xe37d('0x44')](handleError(_0x2b29f5,null));};exports['create']=function(_0x3dffe6,_0x27af88){return db[_0xe37d('0x29')][_0xe37d('0x45')](_0x3dffe6['body'],{})[_0xe37d('0x40')](respondWithResult(_0x27af88,0xc9))['catch'](handleError(_0x27af88,null));};exports['update']=function(_0x1edc5d,_0x2c3699){if(_0x1edc5d[_0xe37d('0x46')]['id']){delete _0x1edc5d[_0xe37d('0x46')]['id'];}return db[_0xe37d('0x29')][_0xe37d('0x47')]({'where':{'id':_0x1edc5d[_0xe37d('0x42')]['id']}})['then'](handleEntityNotFound(_0x2c3699,null))[_0xe37d('0x40')](saveUpdates(_0x1edc5d[_0xe37d('0x46')],null))[_0xe37d('0x40')](respondWithResult(_0x2c3699,null))[_0xe37d('0x44')](handleError(_0x2c3699,null));};exports[_0xe37d('0x48')]=function(_0x1362bb,_0x17024d,_0x4a180f){var _0x51dfd3=require('../../components/encryptor');var _0x39335f=![];var _0x2d5e7f={};if(_0x1362bb['query'][_0xe37d('0x2b')]&&_0x1362bb[_0xe37d('0x2e')][_0xe37d('0x2b')]===_0xe37d('0x49')){_0x2d5e7f[_0xe37d('0x49')]=_0x1362bb['params']['id'];}else{_0x2d5e7f['id']=_0x1362bb[_0xe37d('0x42')]['id'];}return db[_0xe37d('0x29')][_0xe37d('0x47')]({'where':_0x2d5e7f,'attributes':['id',_0xe37d('0x4a'),_0xe37d('0x4b')],'raw':!![]})[_0xe37d('0x40')](handleEntityNotFound(_0x17024d,null))[_0xe37d('0x40')](function(_0x435693){if(_0x435693){var _0x3bd3ca=_0x435693['savePath'];var _0x11edf1=util[_0xe37d('0x4c')](_0xe37d('0x4d'),_0x3bd3ca);if(fs[_0xe37d('0x4e')](_0x11edf1)){_0x39335f=!![];return _0x51dfd3[_0xe37d('0x4f')](_0x11edf1,_0x3bd3ca,config[_0xe37d('0x50')][_0xe37d('0x51')])[_0xe37d('0x40')](function(){return _0x435693;});}return _0x435693;}})[_0xe37d('0x40')](function(_0x487dde){if(_0x487dde){var _0x3d9592=_0x487dde[_0xe37d('0x4a')];if(!fs[_0xe37d('0x4e')](_0x3d9592)){throw new db[(_0xe37d('0x52'))][(_0xe37d('0x53'))](_0xe37d('0x54'));}if(_0x487dde[_0xe37d('0x4b')]){return _0x17024d['download'](_0x3d9592,_0x487dde['filename']+path['extname'](_0x3d9592),function(){if(_0x39335f){fs[_0xe37d('0x55')](_0x3d9592);}});}else{return _0x17024d[_0xe37d('0x48')](_0x3d9592,function(_0x538878){if(_0x39335f){fs[_0xe37d('0x55')](_0x3d9592);}});}}})[_0xe37d('0x44')](function(_0x2f2bbf){if(_0x2f2bbf[_0xe37d('0x56')]===_0xe37d('0x54')){_0x17024d[_0xe37d('0x1a')](0x194)[_0xe37d('0x27')](_0xe37d('0x57'));}else{return handleError(_0x17024d,null);}});};exports[_0xe37d('0x58')]=function(_0x289afa,_0x32e41e){return db[_0xe37d('0x29')][_0xe37d('0x47')]({'where':{'id':_0x289afa[_0xe37d('0x42')]['id']}})[_0xe37d('0x40')](function(_0x517b13){if(_[_0xe37d('0x59')](_0x517b13)){throw new ReferenceError(_0xe37d('0x5a'));}return _0x517b13;})[_0xe37d('0x40')](function(_0xe9a904){var _0x289c4b=_0xe9a904['savePath'];logger[_0xe37d('0x5b')](_0xe37d('0x5c'),_0x289c4b);if(!_[_0xe37d('0x59')](_0xe9a904[_0xe37d('0x4a')])&&fs[_0xe37d('0x4e')](_0x289c4b)){logger[_0xe37d('0x5b')](_0xe37d('0x5d')+_0x289c4b+_0xe37d('0x5e'));fs[_0xe37d('0x5f')](_0x289c4b);}_0x289c4b=_0x289c4b+_0xe37d('0x60');if(!_['isNil'](_0xe9a904['savePath'])&&fs[_0xe37d('0x4e')](_0x289c4b)){logger['info'](_0xe37d('0x5d')+_0x289c4b+_0xe37d('0x5e'));fs[_0xe37d('0x5f')](_0x289c4b);}return _0xe9a904;})[_0xe37d('0x40')](function(_0x405731){if(!_0x405731)throw new InternalError();return _0x405731[_0xe37d('0x58')]();})[_0xe37d('0x40')](function(){_0x32e41e[_0xe37d('0x1a')](0xcc)['end']();})[_0xe37d('0x44')](handleError(_0x32e41e,null));}; \ No newline at end of file +var _0xad9e=['model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','SquareRecording','then','includeAll','findAll','rows','catch','show','params','keys','include','create','body','find','download','../../components/encryptor','uniqueid','savePath','filename','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','Not\x20found','Entity\x20not\x20found','info','isNil','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','status','error','name','send','map','rawAttributes','type','key','query','filters','intersection'];(function(_0x1d2ebe,_0x107899){var _0x150e1=function(_0xd50b08){while(--_0xd50b08){_0x1d2ebe['push'](_0x1d2ebe['shift']());}};_0x150e1(++_0x107899);}(_0xad9e,0x1ca));var _0xead9=function(_0x36b8ef,_0x4203cc){_0x36b8ef=_0x36b8ef-0x0;var _0x32a4a2=_0xad9e[_0x36b8ef];return _0x32a4a2;};'use strict';var emlformat=require(_0xead9('0x0'));var rimraf=require(_0xead9('0x1'));var zipdir=require(_0xead9('0x2'));var jsonpatch=require(_0xead9('0x3'));var rp=require('request-promise');var moment=require(_0xead9('0x4'));var BPromise=require(_0xead9('0x5'));var Mustache=require('mustache');var util=require(_0xead9('0x6'));var path=require(_0xead9('0x7'));var sox=require(_0xead9('0x8'));var csv=require(_0xead9('0x9'));var ejs=require(_0xead9('0xa'));var fs=require('fs');var fs_extra=require(_0xead9('0xb'));var _=require(_0xead9('0xc'));var squel=require(_0xead9('0xd'));var crypto=require(_0xead9('0xe'));var jsforce=require(_0xead9('0xf'));var deskjs=require(_0xead9('0x10'));var toCsv=require(_0xead9('0x9'));var querystring=require(_0xead9('0x11'));var Papa=require('papaparse');var Redis=require(_0xead9('0x12'));var authService=require(_0xead9('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xead9('0x14'));var hardwareService=require(_0xead9('0x15'));var logger=require(_0xead9('0x16'))(_0xead9('0x17'));var utils=require(_0xead9('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xead9('0x19'));var db=require(_0xead9('0x1a'))['db'];function respondWithStatusCode(_0x33f205,_0x453649){_0x453649=_0x453649||0xcc;return function(_0x171b36){if(_0x171b36){return _0x33f205[_0xead9('0x1b')](_0x453649);}return _0x33f205['status'](_0x453649)[_0xead9('0x1c')]();};}function respondWithResult(_0x953a53,_0x26adaf){_0x26adaf=_0x26adaf||0xc8;return function(_0x1e4223){if(_0x1e4223){return _0x953a53['status'](_0x26adaf)[_0xead9('0x1d')](_0x1e4223);}};}function respondWithFilteredResult(_0x386753,_0x5c85e4){return function(_0xce00a9){if(_0xce00a9){var _0x28eaeb=typeof _0x5c85e4[_0xead9('0x1e')]===_0xead9('0x1f')&&typeof _0x5c85e4[_0xead9('0x20')]==='undefined';var _0x9db142=_0xce00a9[_0xead9('0x21')];var _0x2532bb=_0x28eaeb?0x0:_0x5c85e4[_0xead9('0x1e')];var _0x14bbe2=_0x28eaeb?_0xce00a9[_0xead9('0x21')]:_0x5c85e4[_0xead9('0x1e')]+_0x5c85e4[_0xead9('0x20')];var _0x4eeaea;if(_0x14bbe2>=_0x9db142){_0x14bbe2=_0x9db142;_0x4eeaea=0xc8;}else{_0x4eeaea=0xce;}_0x386753['status'](_0x4eeaea);return _0x386753[_0xead9('0x22')](_0xead9('0x23'),_0x2532bb+'-'+_0x14bbe2+'/'+_0x9db142)[_0xead9('0x1d')](_0xce00a9);}return null;};}function patchUpdates(_0x238525){return function(_0x1ad2dd){try{jsonpatch[_0xead9('0x24')](_0x1ad2dd,_0x238525,!![]);}catch(_0x479256){return BPromise[_0xead9('0x25')](_0x479256);}return _0x1ad2dd[_0xead9('0x26')]();};}function saveUpdates(_0x53b651,_0xad5c84){return function(_0xf1062f){if(_0xf1062f){return _0xf1062f[_0xead9('0x27')](_0x53b651)['then'](function(_0x367041){return _0x367041;});}return null;};}function removeEntity(_0x20e398,_0x30486e){return function(_0x32587c){if(_0x32587c){return _0x32587c[_0xead9('0x28')]()['then'](function(){_0x20e398[_0xead9('0x29')](0xcc)[_0xead9('0x1c')]();});}};}function handleEntityNotFound(_0x43c53a,_0x219b09){return function(_0x5693a5){if(!_0x5693a5){_0x43c53a[_0xead9('0x1b')](0x194);}return _0x5693a5;};}function handleError(_0x269287,_0x4ab8bb){_0x4ab8bb=_0x4ab8bb||0x1f4;return function(_0x2c34de){logger[_0xead9('0x2a')](_0x2c34de['stack']);if(_0x2c34de[_0xead9('0x2b')]){delete _0x2c34de[_0xead9('0x2b')];}_0x269287[_0xead9('0x29')](_0x4ab8bb)[_0xead9('0x2c')](_0x2c34de);};}exports['index']=function(_0x599b22,_0x46c416){var _0x92dcd0={},_0x3c7f18={},_0x1c6ffd={'count':0x0,'rows':[]};var _0x2a3ebb=_[_0xead9('0x2d')](db['SquareRecording'][_0xead9('0x2e')],function(_0x2efd23){return{'name':_0x2efd23['fieldName'],'type':_0x2efd23[_0xead9('0x2f')][_0xead9('0x30')]};});_0x3c7f18['model']=_[_0xead9('0x2d')](_0x2a3ebb,_0xead9('0x2b'));_0x3c7f18['query']=_['keys'](_0x599b22[_0xead9('0x31')]);_0x3c7f18[_0xead9('0x32')]=_[_0xead9('0x33')](_0x3c7f18[_0xead9('0x34')],_0x3c7f18['query']);_0x92dcd0[_0xead9('0x35')]=_[_0xead9('0x33')](_0x3c7f18[_0xead9('0x34')],qs[_0xead9('0x36')](_0x599b22[_0xead9('0x31')][_0xead9('0x36')]));_0x92dcd0[_0xead9('0x35')]=_0x92dcd0[_0xead9('0x35')][_0xead9('0x37')]?_0x92dcd0[_0xead9('0x35')]:_0x3c7f18[_0xead9('0x34')];if(!_0x599b22['query']['hasOwnProperty'](_0xead9('0x38'))){_0x92dcd0['limit']=qs[_0xead9('0x20')](_0x599b22[_0xead9('0x31')][_0xead9('0x20')]);_0x92dcd0[_0xead9('0x1e')]=qs['offset'](_0x599b22[_0xead9('0x31')][_0xead9('0x1e')]);}_0x92dcd0[_0xead9('0x39')]=qs[_0xead9('0x3a')](_0x599b22[_0xead9('0x31')][_0xead9('0x3a')]);_0x92dcd0[_0xead9('0x3b')]=qs['filters'](_[_0xead9('0x3c')](_0x599b22['query'],_0x3c7f18[_0xead9('0x32')]),_0x2a3ebb);if(_0x599b22[_0xead9('0x31')][_0xead9('0x3d')]){_0x92dcd0[_0xead9('0x3b')]=_[_0xead9('0x3e')](_0x92dcd0[_0xead9('0x3b')],{'$or':_[_0xead9('0x2d')](_0x2a3ebb,function(_0x28bed6){if(_0x28bed6[_0xead9('0x2f')]!==_0xead9('0x3f')){var _0x3e46f3={};_0x3e46f3[_0x28bed6[_0xead9('0x2b')]]={'$like':'%'+_0x599b22[_0xead9('0x31')][_0xead9('0x3d')]+'%'};return _0x3e46f3;}})});}_0x92dcd0=_[_0xead9('0x3e')]({},_0x92dcd0,_0x599b22[_0xead9('0x40')]);var _0x187aaa={'where':_0x92dcd0[_0xead9('0x3b')]};return db[_0xead9('0x41')][_0xead9('0x21')](_0x187aaa)[_0xead9('0x42')](function(_0x36456d){_0x1c6ffd[_0xead9('0x21')]=_0x36456d;if(_0x599b22['query'][_0xead9('0x43')]){_0x92dcd0['include']=[{'all':!![]}];}return db[_0xead9('0x41')][_0xead9('0x44')](_0x92dcd0);})[_0xead9('0x42')](function(_0x59c510){_0x1c6ffd[_0xead9('0x45')]=_0x59c510;return _0x1c6ffd;})[_0xead9('0x42')](respondWithFilteredResult(_0x46c416,_0x92dcd0))[_0xead9('0x46')](handleError(_0x46c416,null));};exports[_0xead9('0x47')]=function(_0x29e435,_0x29b8e7){var _0x3b6f9a={'raw':!![],'where':{'id':_0x29e435[_0xead9('0x48')]['id']}},_0x36d385={};_0x36d385[_0xead9('0x34')]=_[_0xead9('0x49')](db[_0xead9('0x41')]['rawAttributes']);_0x36d385[_0xead9('0x31')]=_[_0xead9('0x49')](_0x29e435[_0xead9('0x31')]);_0x36d385[_0xead9('0x32')]=_[_0xead9('0x33')](_0x36d385[_0xead9('0x34')],_0x36d385[_0xead9('0x31')]);_0x3b6f9a['attributes']=_[_0xead9('0x33')](_0x36d385['model'],qs[_0xead9('0x36')](_0x29e435['query']['fields']));_0x3b6f9a[_0xead9('0x35')]=_0x3b6f9a[_0xead9('0x35')][_0xead9('0x37')]?_0x3b6f9a[_0xead9('0x35')]:_0x36d385['model'];if(_0x29e435['query']['includeAll']){_0x3b6f9a[_0xead9('0x4a')]=[{'all':!![]}];}_0x3b6f9a=_[_0xead9('0x3e')]({},_0x3b6f9a,_0x29e435[_0xead9('0x40')]);return db[_0xead9('0x41')]['find'](_0x3b6f9a)[_0xead9('0x42')](handleEntityNotFound(_0x29b8e7,null))[_0xead9('0x42')](respondWithResult(_0x29b8e7,null))['catch'](handleError(_0x29b8e7,null));};exports[_0xead9('0x4b')]=function(_0x22c52a,_0x27a642){return db[_0xead9('0x41')][_0xead9('0x4b')](_0x22c52a[_0xead9('0x4c')],{})['then'](respondWithResult(_0x27a642,0xc9))[_0xead9('0x46')](handleError(_0x27a642,null));};exports['update']=function(_0x50dbd4,_0x25ea68){if(_0x50dbd4['body']['id']){delete _0x50dbd4[_0xead9('0x4c')]['id'];}return db[_0xead9('0x41')][_0xead9('0x4d')]({'where':{'id':_0x50dbd4['params']['id']}})[_0xead9('0x42')](handleEntityNotFound(_0x25ea68,null))[_0xead9('0x42')](saveUpdates(_0x50dbd4[_0xead9('0x4c')],null))['then'](respondWithResult(_0x25ea68,null))[_0xead9('0x46')](handleError(_0x25ea68,null));};exports[_0xead9('0x4e')]=function(_0x4c7c97,_0x358814,_0x4bf0a0){var _0x14b649=require(_0xead9('0x4f'));var _0x2da958=![];var _0x4f1dd8={};if(_0x4c7c97[_0xead9('0x31')]['type']&&_0x4c7c97[_0xead9('0x31')][_0xead9('0x2f')]===_0xead9('0x50')){_0x4f1dd8[_0xead9('0x50')]=_0x4c7c97[_0xead9('0x48')]['id'];}else{_0x4f1dd8['id']=_0x4c7c97[_0xead9('0x48')]['id'];}return db[_0xead9('0x41')][_0xead9('0x4d')]({'where':_0x4f1dd8,'attributes':['id',_0xead9('0x51'),_0xead9('0x52')],'raw':!![]})[_0xead9('0x42')](handleEntityNotFound(_0x358814,null))[_0xead9('0x42')](function(_0x5e3282){if(_0x5e3282){var _0x1e21d2=_0x5e3282[_0xead9('0x51')];var _0x39cdfc=util['format'](_0xead9('0x53'),_0x1e21d2);if(fs[_0xead9('0x54')](_0x39cdfc)){_0x2da958=!![];return _0x14b649[_0xead9('0x55')](_0x39cdfc,_0x1e21d2,config[_0xead9('0x56')][_0xead9('0x57')])['then'](function(){return _0x5e3282;});}return _0x5e3282;}})[_0xead9('0x42')](function(_0x5660e1){if(_0x5660e1){var _0x191a35=_0x5660e1[_0xead9('0x51')];if(!fs['existsSync'](_0x191a35)){throw new db[(_0xead9('0x58'))][(_0xead9('0x59'))](_0xead9('0x5a'));}if(_0x5660e1[_0xead9('0x52')]){return _0x358814['download'](_0x191a35,_0x5660e1['filename']+path[_0xead9('0x5b')](_0x191a35),function(){if(_0x2da958){fs[_0xead9('0x5c')](_0x191a35);}});}else{return _0x358814['download'](_0x191a35,function(_0x259f57){if(_0x2da958){fs[_0xead9('0x5c')](_0x191a35);}});}}})[_0xead9('0x46')](function(_0x3db48c){if(_0x3db48c[_0xead9('0x5d')]===_0xead9('0x5a')){_0x358814['status'](0x194)['send'](_0xead9('0x5e'));}else{return handleError(_0x358814,null);}});};exports[_0xead9('0x28')]=function(_0x15566f,_0x4b0ebe){return db[_0xead9('0x41')][_0xead9('0x4d')]({'where':{'id':_0x15566f[_0xead9('0x48')]['id']}})[_0xead9('0x42')](function(_0x171ae4){if(_['isNil'](_0x171ae4)){throw new ReferenceError(_0xead9('0x5f'));}return _0x171ae4;})[_0xead9('0x42')](function(_0x1051a0){var _0x1cd08a=_0x1051a0[_0xead9('0x51')];logger[_0xead9('0x60')]('cancellazione\x20fisica\x20documento\x20%s',_0x1cd08a);if(!_[_0xead9('0x61')](_0x1051a0['savePath'])&&fs[_0xead9('0x54')](_0x1cd08a)){logger[_0xead9('0x60')](_0xead9('0x62')+_0x1cd08a+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xead9('0x63')](_0x1cd08a);}_0x1cd08a=_0x1cd08a+_0xead9('0x64');if(!_[_0xead9('0x61')](_0x1051a0['savePath'])&&fs[_0xead9('0x54')](_0x1cd08a)){logger[_0xead9('0x60')](_0xead9('0x62')+_0x1cd08a+_0xead9('0x65'));fs[_0xead9('0x63')](_0x1cd08a);}return _0x1051a0;})[_0xead9('0x42')](function(_0x96d3fa){if(!_0x96d3fa)throw new InternalError();return _0x96d3fa[_0xead9('0x28')]();})[_0xead9('0x42')](function(){_0x4b0ebe[_0xead9('0x29')](0xcc)['end']();})['catch'](handleError(_0x4b0ebe,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 2d096de..e6c5bdc 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 _0x9fe7=['path','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','lodash','util','api','bluebird','request-promise'];(function(_0x2bddd0,_0x1486a8){var _0x25aa78=function(_0x16c671){while(--_0x16c671){_0x2bddd0['push'](_0x2bddd0['shift']());}};_0x25aa78(++_0x1486a8);}(_0x9fe7,0x1df));var _0x79fe=function(_0x5d5ec4,_0x164e2b){_0x5d5ec4=_0x5d5ec4-0x0;var _0x404ca1=_0x9fe7[_0x5d5ec4];return _0x404ca1;};'use strict';var _=require(_0x79fe('0x0'));var util=require(_0x79fe('0x1'));var logger=require('../../config/logger')(_0x79fe('0x2'));var moment=require('moment');var BPromise=require(_0x79fe('0x3'));var rp=require(_0x79fe('0x4'));var fs=require('fs');var path=require(_0x79fe('0x5'));var rimraf=require('rimraf');var config=require(_0x79fe('0x6'));var attributes=require(_0x79fe('0x7'));module[_0x79fe('0x8')]=function(_0x4af9f6,_0x3cec9c){return _0x4af9f6[_0x79fe('0x9')](_0x79fe('0xa'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa24d=['request-promise','rimraf','../../config/environment','./squareRecording.attributes','exports','define','square_recordings','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x164114,_0x2e3e76){var _0x4d30d9=function(_0x5092a7){while(--_0x5092a7){_0x164114['push'](_0x164114['shift']());}};_0x4d30d9(++_0x2e3e76);}(_0xa24d,0x1c1));var _0xda24=function(_0x3add10,_0x457d16){_0x3add10=_0x3add10-0x0;var _0x2da348=_0xa24d[_0x3add10];return _0x2da348;};'use strict';var _=require(_0xda24('0x0'));var util=require(_0xda24('0x1'));var logger=require(_0xda24('0x2'))(_0xda24('0x3'));var moment=require(_0xda24('0x4'));var BPromise=require(_0xda24('0x5'));var rp=require(_0xda24('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xda24('0x7'));var config=require(_0xda24('0x8'));var attributes=require(_0xda24('0x9'));module[_0xda24('0xa')]=function(_0x561d74,_0x3557cb){return _0x561d74[_0xda24('0xb')]('SquareRecording',attributes,{'tableName':_0xda24('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index f292e06..7c44e2a 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 _0xa0b8=['options','raw','CreateSquareRecording','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','SquareRecording,\x20%s,\x20%s','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','SquareRecording','create','body'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xa0b8,0x199));var _0x8a0b=function(_0x65c903,_0x41e920){_0x65c903=_0x65c903-0x0;var _0x23e1d7=_0xa0b8[_0x65c903];return _0x23e1d7;};'use strict';var _=require('lodash');var util=require(_0x8a0b('0x0'));var moment=require(_0x8a0b('0x1'));var BPromise=require(_0x8a0b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8a0b('0x3'));var db=require(_0x8a0b('0x4'))['db'];var utils=require(_0x8a0b('0x5'));var logger=require(_0x8a0b('0x6'))(_0x8a0b('0x7'));var config=require(_0x8a0b('0x8'));var jayson=require(_0x8a0b('0x9'));var client=jayson['client'][_0x8a0b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bd17a,_0x16239f,_0x3a255f){return new BPromise(function(_0x384f8b,_0x25c491){return client[_0x8a0b('0xb')](_0x2bd17a,_0x3a255f)['then'](function(_0x3d842f){logger[_0x8a0b('0xc')](_0x8a0b('0xd'),_0x16239f,'request\x20sent');logger[_0x8a0b('0xe')](_0x8a0b('0xf'),_0x16239f,'request\x20sent',JSON[_0x8a0b('0x10')](_0x3d842f));if(_0x3d842f['error']){if(_0x3d842f[_0x8a0b('0x11')][_0x8a0b('0x12')]===0x1f4){logger[_0x8a0b('0x11')](_0x8a0b('0xd'),_0x16239f,_0x3d842f['error'][_0x8a0b('0x13')]);return _0x25c491(_0x3d842f[_0x8a0b('0x11')][_0x8a0b('0x13')]);}logger[_0x8a0b('0x11')](_0x8a0b('0xd'),_0x16239f,_0x3d842f['error'][_0x8a0b('0x13')]);return _0x384f8b(_0x3d842f[_0x8a0b('0x11')][_0x8a0b('0x13')]);}else{logger[_0x8a0b('0xc')](_0x8a0b('0xd'),_0x16239f,_0x8a0b('0x14'));_0x384f8b(_0x3d842f[_0x8a0b('0x15')][_0x8a0b('0x13')]);}})[_0x8a0b('0x16')](function(_0x102548){logger[_0x8a0b('0x11')](_0x8a0b('0xd'),_0x16239f,_0x102548);_0x25c491(_0x102548);});});}exports['CreateSquareRecording']=function(_0x34484b){var _0x595f77=this;return new Promise(function(_0x138fba,_0x4b6cf0){return db[_0x8a0b('0x17')][_0x8a0b('0x18')](_0x34484b[_0x8a0b('0x19')],{'raw':_0x34484b['options']?_0x34484b[_0x8a0b('0x1a')][_0x8a0b('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x452d15){logger[_0x8a0b('0xc')](_0x8a0b('0x1c'),_0x34484b);logger[_0x8a0b('0xe')](_0x8a0b('0x1c'),_0x34484b,JSON[_0x8a0b('0x10')](_0x452d15));_0x138fba(_0x452d15);})[_0x8a0b('0x16')](function(_0x3619d7){logger[_0x8a0b('0x11')](_0x8a0b('0x1c'),_0x3619d7[_0x8a0b('0x13')],_0x34484b);_0x4b6cf0(_0x595f77[_0x8a0b('0x11')](0x1f4,_0x3619d7[_0x8a0b('0x13')]));});});}; \ No newline at end of file +var _0x1d06=['raw','then','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareRecording,\x20%s,\x20%s','message','result','CreateSquareRecording','SquareRecording','create','body','options'];(function(_0x35fc0f,_0x4494b7){var _0x403bce=function(_0x2d34ab){while(--_0x2d34ab){_0x35fc0f['push'](_0x35fc0f['shift']());}};_0x403bce(++_0x4494b7);}(_0x1d06,0x1e3));var _0x61d0=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x1d06[_0x17b6e3];return _0x3906f3;};'use strict';var _=require(_0x61d0('0x0'));var util=require(_0x61d0('0x1'));var moment=require(_0x61d0('0x2'));var BPromise=require(_0x61d0('0x3'));var rs=require(_0x61d0('0x4'));var fs=require('fs');var Redis=require(_0x61d0('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x61d0('0x6'));var logger=require(_0x61d0('0x7'))(_0x61d0('0x8'));var config=require(_0x61d0('0x9'));var jayson=require(_0x61d0('0xa'));var client=jayson[_0x61d0('0xb')][_0x61d0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x454e86,_0x15f46a,_0x52096b){return new BPromise(function(_0x5a681c,_0x1398af){return client[_0x61d0('0xd')](_0x454e86,_0x52096b)['then'](function(_0x968ed5){logger[_0x61d0('0xe')]('SquareRecording,\x20%s,\x20%s',_0x15f46a,_0x61d0('0xf'));logger[_0x61d0('0x10')](_0x61d0('0x11'),_0x15f46a,_0x61d0('0xf'),JSON[_0x61d0('0x12')](_0x968ed5));if(_0x968ed5[_0x61d0('0x13')]){if(_0x968ed5['error'][_0x61d0('0x14')]===0x1f4){logger['error'](_0x61d0('0x15'),_0x15f46a,_0x968ed5[_0x61d0('0x13')][_0x61d0('0x16')]);return _0x1398af(_0x968ed5[_0x61d0('0x13')][_0x61d0('0x16')]);}logger[_0x61d0('0x13')](_0x61d0('0x15'),_0x15f46a,_0x968ed5[_0x61d0('0x13')][_0x61d0('0x16')]);return _0x5a681c(_0x968ed5['error']['message']);}else{logger[_0x61d0('0xe')](_0x61d0('0x15'),_0x15f46a,_0x61d0('0xf'));_0x5a681c(_0x968ed5[_0x61d0('0x17')]['message']);}})['catch'](function(_0x2acd30){logger['error'](_0x61d0('0x15'),_0x15f46a,_0x2acd30);_0x1398af(_0x2acd30);});});}exports[_0x61d0('0x18')]=function(_0x278d5e){var _0x4ca821=this;return new Promise(function(_0x571797,_0x7581a2){return db[_0x61d0('0x19')][_0x61d0('0x1a')](_0x278d5e[_0x61d0('0x1b')],{'raw':_0x278d5e[_0x61d0('0x1c')]?_0x278d5e['options'][_0x61d0('0x1d')]===undefined?!![]:![]:!![]})[_0x61d0('0x1e')](function(_0x34faab){logger['info'](_0x61d0('0x18'),_0x278d5e);logger[_0x61d0('0x10')](_0x61d0('0x18'),_0x278d5e,JSON[_0x61d0('0x12')](_0x34faab));_0x571797(_0x34faab);})[_0x61d0('0x1f')](function(_0xdcc4bd){logger[_0x61d0('0x13')](_0x61d0('0x18'),_0xdcc4bd[_0x61d0('0x16')],_0x278d5e);_0x7581a2(_0x4ca821[_0x61d0('0x13')](0x1f4,_0xdcc4bd[_0x61d0('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 0f80dd7..28fd546 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 _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(_0x2067e3,_0x19bcb2){var _0x180c44=function(_0x53751f){while(--_0x53751f){_0x2067e3['push'](_0x2067e3['shift']());}};_0x180c44(++_0x19bcb2);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./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 +var _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x40d013,_0x3206ea){var _0xd93aa9=function(_0x53aee6){while(--_0x53aee6){_0x40d013['push'](_0x40d013['shift']());}};_0xd93aa9(++_0x3206ea);}(_0xe706,0xa3));var _0x6e70=function(_0xa0ab99,_0x5496c1){_0xa0ab99=_0xa0ab99-0x0;var _0x3bf6b5=_0xe706[_0xa0ab99];return _0x3bf6b5;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index b3da624..8719aa0 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 _0x603e=['sequelize','exports','STRING','DATE','BOOLEAN'];(function(_0x62a58c,_0x56739f){var _0x4d0cac=function(_0x166e82){while(--_0x166e82){_0x62a58c['push'](_0x62a58c['shift']());}};_0x4d0cac(++_0x56739f);}(_0x603e,0x1ea));var _0xe603=function(_0xf25c17,_0x288f2c){_0xf25c17=_0xf25c17-0x0;var _0x429736=_0x603e[_0xf25c17];return _0x429736;};'use strict';var Sequelize=require(_0xe603('0x0'));module[_0xe603('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0xe603('0x2')]},'request':{'type':Sequelize[_0xe603('0x2')]},'channel':{'type':Sequelize[_0xe603('0x2')]},'language':{'type':Sequelize[_0xe603('0x2')]},'type':{'type':Sequelize[_0xe603('0x2')]},'uniqueid':{'type':Sequelize[_0xe603('0x2')]},'version':{'type':Sequelize[_0xe603('0x2')]},'callerid':{'type':Sequelize[_0xe603('0x2')]},'calleridname':{'type':Sequelize[_0xe603('0x2')]},'callingpres':{'type':Sequelize[_0xe603('0x2')]},'callingani2':{'type':Sequelize[_0xe603('0x2')]},'callington':{'type':Sequelize[_0xe603('0x2')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0xe603('0x2')]},'rdnis':{'type':Sequelize[_0xe603('0x2')]},'context':{'type':Sequelize[_0xe603('0x2')]},'extension':{'type':Sequelize[_0xe603('0x2')]},'priority':{'type':Sequelize[_0xe603('0x2')]},'enhanced':{'type':Sequelize[_0xe603('0x2')]},'accountcode':{'type':Sequelize[_0xe603('0x2')]},'threadid':{'type':Sequelize[_0xe603('0x2')]},'project_name':{'type':Sequelize[_0xe603('0x2')]},'joinAt':{'type':Sequelize[_0xe603('0x3')]},'leaveAt':{'type':Sequelize[_0xe603('0x3')]},'bot':{'type':Sequelize[_0xe603('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x7618=['DATE','BOOLEAN','STRING'];(function(_0x5619e7,_0x5ce0a9){var _0x46c043=function(_0x22d8b4){while(--_0x22d8b4){_0x5619e7['push'](_0x5619e7['shift']());}};_0x46c043(++_0x5ce0a9);}(_0x7618,0x119));var _0x8761=function(_0x37ebec,_0x3e8fc1){_0x37ebec=_0x37ebec-0x0;var _0x3964d0=_0x7618[_0x37ebec];return _0x3964d0;};'use strict';var Sequelize=require('sequelize');module['exports']={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x8761('0x0')]},'request':{'type':Sequelize[_0x8761('0x0')]},'channel':{'type':Sequelize[_0x8761('0x0')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x8761('0x0')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x8761('0x0')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x8761('0x0')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x8761('0x0')]},'callington':{'type':Sequelize[_0x8761('0x0')]},'callingtns':{'type':Sequelize[_0x8761('0x0')]},'dnid':{'type':Sequelize[_0x8761('0x0')]},'rdnis':{'type':Sequelize[_0x8761('0x0')]},'context':{'type':Sequelize[_0x8761('0x0')]},'extension':{'type':Sequelize[_0x8761('0x0')]},'priority':{'type':Sequelize[_0x8761('0x0')]},'enhanced':{'type':Sequelize[_0x8761('0x0')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0x8761('0x0')]},'joinAt':{'type':Sequelize[_0x8761('0x1')]},'leaveAt':{'type':Sequelize[_0x8761('0x1')]},'bot':{'type':Sequelize[_0x8761('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 2c9a73e..8fbd555 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 _0xa8f0=['describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','SquareReport','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','create','body','update','find','catch'];(function(_0x57a0c2,_0x5122ca){var _0x25d249=function(_0x53faae){while(--_0x53faae){_0x57a0c2['push'](_0x57a0c2['shift']());}};_0x25d249(++_0x5122ca);}(_0xa8f0,0x1db));var _0x0a8f=function(_0x592e40,_0x2ed011){_0x592e40=_0x592e40-0x0;var _0x5d4288=_0xa8f0[_0x592e40];return _0x5d4288;};'use strict';var emlformat=require(_0x0a8f('0x0'));var rimraf=require(_0x0a8f('0x1'));var zipdir=require(_0x0a8f('0x2'));var jsonpatch=require(_0x0a8f('0x3'));var rp=require(_0x0a8f('0x4'));var moment=require(_0x0a8f('0x5'));var BPromise=require(_0x0a8f('0x6'));var Mustache=require(_0x0a8f('0x7'));var util=require(_0x0a8f('0x8'));var path=require(_0x0a8f('0x9'));var sox=require(_0x0a8f('0xa'));var csv=require('to-csv');var ejs=require(_0x0a8f('0xb'));var fs=require('fs');var fs_extra=require(_0x0a8f('0xc'));var _=require(_0x0a8f('0xd'));var squel=require(_0x0a8f('0xe'));var crypto=require(_0x0a8f('0xf'));var jsforce=require(_0x0a8f('0x10'));var deskjs=require(_0x0a8f('0x11'));var toCsv=require(_0x0a8f('0x12'));var querystring=require(_0x0a8f('0x13'));var Papa=require('papaparse');var Redis=require(_0x0a8f('0x14'));var authService=require(_0x0a8f('0x15'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0a8f('0x16'))(_0x0a8f('0x17'));var utils=require(_0x0a8f('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x0a8f('0x19'));var db=require(_0x0a8f('0x1a'))['db'];function respondWithStatusCode(_0x5ac5d8,_0x2583fb){_0x2583fb=_0x2583fb||0xcc;return function(_0x2bd322){if(_0x2bd322){return _0x5ac5d8[_0x0a8f('0x1b')](_0x2583fb);}return _0x5ac5d8[_0x0a8f('0x1c')](_0x2583fb)[_0x0a8f('0x1d')]();};}function respondWithResult(_0x2fc39e,_0x5a23e7){_0x5a23e7=_0x5a23e7||0xc8;return function(_0x241746){if(_0x241746){return _0x2fc39e[_0x0a8f('0x1c')](_0x5a23e7)[_0x0a8f('0x1e')](_0x241746);}};}function respondWithFilteredResult(_0x781c82,_0x4c2c1f){return function(_0x5e4490){if(_0x5e4490){var _0x118f9a=typeof _0x4c2c1f[_0x0a8f('0x1f')]==='undefined'&&typeof _0x4c2c1f[_0x0a8f('0x20')]===_0x0a8f('0x21');var _0x4a3258=_0x5e4490[_0x0a8f('0x22')];var _0x37e64=_0x118f9a?0x0:_0x4c2c1f['offset'];var _0x50866d=_0x118f9a?_0x5e4490[_0x0a8f('0x22')]:_0x4c2c1f[_0x0a8f('0x1f')]+_0x4c2c1f[_0x0a8f('0x20')];var _0x1aa49b;if(_0x50866d>=_0x4a3258){_0x50866d=_0x4a3258;_0x1aa49b=0xc8;}else{_0x1aa49b=0xce;}_0x781c82[_0x0a8f('0x1c')](_0x1aa49b);return _0x781c82[_0x0a8f('0x23')](_0x0a8f('0x24'),_0x37e64+'-'+_0x50866d+'/'+_0x4a3258)[_0x0a8f('0x1e')](_0x5e4490);}return null;};}function patchUpdates(_0x45e3a5){return function(_0x4e5935){try{jsonpatch[_0x0a8f('0x25')](_0x4e5935,_0x45e3a5,!![]);}catch(_0x3b9623){return BPromise[_0x0a8f('0x26')](_0x3b9623);}return _0x4e5935[_0x0a8f('0x27')]();};}function saveUpdates(_0x14bc73,_0x23c014){return function(_0x1bf575){if(_0x1bf575){return _0x1bf575['update'](_0x14bc73)[_0x0a8f('0x28')](function(_0x328ee1){return _0x328ee1;});}return null;};}function removeEntity(_0x5d2554,_0x5b202f){return function(_0x55319e){if(_0x55319e){return _0x55319e[_0x0a8f('0x29')]()[_0x0a8f('0x28')](function(){_0x5d2554[_0x0a8f('0x1c')](0xcc)[_0x0a8f('0x1d')]();});}};}function handleEntityNotFound(_0x14d8d8,_0x2f1161){return function(_0x51256a){if(!_0x51256a){_0x14d8d8['sendStatus'](0x194);}return _0x51256a;};}function handleError(_0x3afdee,_0x4ae223){_0x4ae223=_0x4ae223||0x1f4;return function(_0x43a669){logger[_0x0a8f('0x2a')](_0x43a669[_0x0a8f('0x2b')]);if(_0x43a669[_0x0a8f('0x2c')]){delete _0x43a669[_0x0a8f('0x2c')];}_0x3afdee['status'](_0x4ae223)[_0x0a8f('0x2d')](_0x43a669);};}exports[_0x0a8f('0x2e')]=function(_0x407dcb,_0x5cfabf){var _0x511c7a={},_0x46f1d7={},_0x3ed73c={'count':0x0,'rows':[]};var _0x32547e=_[_0x0a8f('0x2f')](db[_0x0a8f('0x30')]['rawAttributes'],function(_0x4fde12){return{'name':_0x4fde12[_0x0a8f('0x31')],'type':_0x4fde12['type']['key']};});_0x46f1d7[_0x0a8f('0x32')]=_[_0x0a8f('0x2f')](_0x32547e,'name');_0x46f1d7[_0x0a8f('0x33')]=_[_0x0a8f('0x34')](_0x407dcb['query']);_0x46f1d7[_0x0a8f('0x35')]=_[_0x0a8f('0x36')](_0x46f1d7[_0x0a8f('0x32')],_0x46f1d7[_0x0a8f('0x33')]);_0x511c7a[_0x0a8f('0x37')]=_[_0x0a8f('0x36')](_0x46f1d7['model'],qs['fields'](_0x407dcb[_0x0a8f('0x33')][_0x0a8f('0x38')]));_0x511c7a['attributes']=_0x511c7a[_0x0a8f('0x37')][_0x0a8f('0x39')]?_0x511c7a[_0x0a8f('0x37')]:_0x46f1d7[_0x0a8f('0x32')];if(!_0x407dcb[_0x0a8f('0x33')][_0x0a8f('0x3a')]('nolimit')){_0x511c7a[_0x0a8f('0x20')]=qs[_0x0a8f('0x20')](_0x407dcb[_0x0a8f('0x33')]['limit']);_0x511c7a[_0x0a8f('0x1f')]=qs[_0x0a8f('0x1f')](_0x407dcb['query'][_0x0a8f('0x1f')]);}_0x511c7a['order']=qs['sort'](_0x407dcb[_0x0a8f('0x33')][_0x0a8f('0x3b')]);_0x511c7a[_0x0a8f('0x3c')]=qs['filters'](_['pick'](_0x407dcb[_0x0a8f('0x33')],_0x46f1d7[_0x0a8f('0x35')]),_0x32547e);if(_0x407dcb[_0x0a8f('0x33')][_0x0a8f('0x3d')]){_0x511c7a[_0x0a8f('0x3c')]=_[_0x0a8f('0x3e')](_0x511c7a[_0x0a8f('0x3c')],{'$or':_[_0x0a8f('0x2f')](_0x32547e,function(_0x5515ad){if(_0x5515ad[_0x0a8f('0x3f')]!==_0x0a8f('0x40')){var _0x1546c9={};_0x1546c9[_0x5515ad[_0x0a8f('0x2c')]]={'$like':'%'+_0x407dcb[_0x0a8f('0x33')][_0x0a8f('0x3d')]+'%'};return _0x1546c9;}})});}_0x511c7a=_['merge']({},_0x511c7a,_0x407dcb[_0x0a8f('0x41')]);var _0x463438={'where':_0x511c7a[_0x0a8f('0x3c')]};return db[_0x0a8f('0x30')][_0x0a8f('0x22')](_0x463438)['then'](function(_0x3feea6){_0x3ed73c['count']=_0x3feea6;if(_0x407dcb[_0x0a8f('0x33')][_0x0a8f('0x42')]){_0x511c7a[_0x0a8f('0x43')]=[{'all':!![]}];}return db[_0x0a8f('0x30')][_0x0a8f('0x44')](_0x511c7a);})[_0x0a8f('0x28')](function(_0x536fad){_0x3ed73c[_0x0a8f('0x45')]=_0x536fad;return _0x3ed73c;})['then'](respondWithFilteredResult(_0x5cfabf,_0x511c7a))['catch'](handleError(_0x5cfabf,null));};exports[_0x0a8f('0x46')]=function(_0x3fc0ca,_0x28bab3){var _0xb5368b={'raw':!![],'where':{'id':_0x3fc0ca[_0x0a8f('0x47')]['id']}},_0x435b86={};_0x435b86[_0x0a8f('0x32')]=_[_0x0a8f('0x34')](db[_0x0a8f('0x30')][_0x0a8f('0x48')]);_0x435b86[_0x0a8f('0x33')]=_[_0x0a8f('0x34')](_0x3fc0ca['query']);_0x435b86[_0x0a8f('0x35')]=_[_0x0a8f('0x36')](_0x435b86['model'],_0x435b86[_0x0a8f('0x33')]);_0xb5368b[_0x0a8f('0x37')]=_[_0x0a8f('0x36')](_0x435b86['model'],qs['fields'](_0x3fc0ca[_0x0a8f('0x33')]['fields']));_0xb5368b[_0x0a8f('0x37')]=_0xb5368b[_0x0a8f('0x37')][_0x0a8f('0x39')]?_0xb5368b[_0x0a8f('0x37')]:_0x435b86[_0x0a8f('0x32')];if(_0x3fc0ca['query'][_0x0a8f('0x42')]){_0xb5368b[_0x0a8f('0x43')]=[{'all':!![]}];}_0xb5368b=_[_0x0a8f('0x3e')]({},_0xb5368b,_0x3fc0ca[_0x0a8f('0x41')]);return db[_0x0a8f('0x30')]['find'](_0xb5368b)[_0x0a8f('0x28')](handleEntityNotFound(_0x28bab3,null))[_0x0a8f('0x28')](respondWithResult(_0x28bab3,null))['catch'](handleError(_0x28bab3,null));};exports[_0x0a8f('0x49')]=function(_0x35d975,_0x5aefbb){return db[_0x0a8f('0x30')][_0x0a8f('0x49')](_0x35d975[_0x0a8f('0x4a')],{})[_0x0a8f('0x28')](respondWithResult(_0x5aefbb,0xc9))['catch'](handleError(_0x5aefbb,null));};exports[_0x0a8f('0x4b')]=function(_0x50afcd,_0x20e57a){if(_0x50afcd['body']['id']){delete _0x50afcd[_0x0a8f('0x4a')]['id'];}return db[_0x0a8f('0x30')][_0x0a8f('0x4c')]({'where':{'id':_0x50afcd[_0x0a8f('0x47')]['id']}})[_0x0a8f('0x28')](handleEntityNotFound(_0x20e57a,null))[_0x0a8f('0x28')](saveUpdates(_0x50afcd['body'],null))[_0x0a8f('0x28')](respondWithResult(_0x20e57a,null))[_0x0a8f('0x4d')](handleError(_0x20e57a,null));};exports[_0x0a8f('0x29')]=function(_0x5a1086,_0x580282){return db['SquareReport'][_0x0a8f('0x4c')]({'where':{'id':_0x5a1086['params']['id']}})[_0x0a8f('0x28')](handleEntityNotFound(_0x580282,null))['then'](removeEntity(_0x580282,null))[_0x0a8f('0x4d')](handleError(_0x580282,null));};exports[_0x0a8f('0x4e')]=function(_0x30976c,_0x330ab0){return db[_0x0a8f('0x30')]['describe']()[_0x0a8f('0x28')](respondWithResult(_0x330ab0,null))[_0x0a8f('0x4d')](handleError(_0x330ab0,null));}; \ No newline at end of file +var _0x0ecd=['undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','send','SquareReport','rawAttributes','fieldName','type','key','model','map','name','query','intersection','fields','attributes','sort','where','filters','filter','VIRTUAL','options','rows','catch','show','keys','length','includeAll','include','merge','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x0ecd,0x14f));var _0xd0ec=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0ecd[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xd0ec('0x0'));var rimraf=require(_0xd0ec('0x1'));var zipdir=require(_0xd0ec('0x2'));var jsonpatch=require(_0xd0ec('0x3'));var rp=require(_0xd0ec('0x4'));var moment=require(_0xd0ec('0x5'));var BPromise=require(_0xd0ec('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd0ec('0x7'));var sox=require(_0xd0ec('0x8'));var csv=require('to-csv');var ejs=require(_0xd0ec('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd0ec('0xa'));var crypto=require(_0xd0ec('0xb'));var jsforce=require(_0xd0ec('0xc'));var deskjs=require(_0xd0ec('0xd'));var toCsv=require(_0xd0ec('0xe'));var querystring=require(_0xd0ec('0xf'));var Papa=require(_0xd0ec('0x10'));var Redis=require(_0xd0ec('0x11'));var authService=require(_0xd0ec('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd0ec('0x13'));var hardwareService=require(_0xd0ec('0x14'));var logger=require(_0xd0ec('0x15'))(_0xd0ec('0x16'));var utils=require('../../config/utils');var config=require(_0xd0ec('0x17'));var licenseUtil=require(_0xd0ec('0x18'));var db=require(_0xd0ec('0x19'))['db'];function respondWithStatusCode(_0x5ac7d0,_0x265df1){_0x265df1=_0x265df1||0xcc;return function(_0x857e3c){if(_0x857e3c){return _0x5ac7d0[_0xd0ec('0x1a')](_0x265df1);}return _0x5ac7d0[_0xd0ec('0x1b')](_0x265df1)[_0xd0ec('0x1c')]();};}function respondWithResult(_0x1fae5d,_0x26df94){_0x26df94=_0x26df94||0xc8;return function(_0x1b8590){if(_0x1b8590){return _0x1fae5d[_0xd0ec('0x1b')](_0x26df94)[_0xd0ec('0x1d')](_0x1b8590);}};}function respondWithFilteredResult(_0x46be7d,_0x360c31){return function(_0x2f9d7b){if(_0x2f9d7b){var _0x32e165=typeof _0x360c31['offset']===_0xd0ec('0x1e')&&typeof _0x360c31[_0xd0ec('0x1f')]===_0xd0ec('0x1e');var _0x513336=_0x2f9d7b[_0xd0ec('0x20')];var _0x4f53dd=_0x32e165?0x0:_0x360c31[_0xd0ec('0x21')];var _0x176ce1=_0x32e165?_0x2f9d7b[_0xd0ec('0x20')]:_0x360c31[_0xd0ec('0x21')]+_0x360c31[_0xd0ec('0x1f')];var _0x2c916d;if(_0x176ce1>=_0x513336){_0x176ce1=_0x513336;_0x2c916d=0xc8;}else{_0x2c916d=0xce;}_0x46be7d['status'](_0x2c916d);return _0x46be7d[_0xd0ec('0x22')](_0xd0ec('0x23'),_0x4f53dd+'-'+_0x176ce1+'/'+_0x513336)[_0xd0ec('0x1d')](_0x2f9d7b);}return null;};}function patchUpdates(_0x34bd23){return function(_0x1ae424){try{jsonpatch[_0xd0ec('0x24')](_0x1ae424,_0x34bd23,!![]);}catch(_0x3d9f67){return BPromise[_0xd0ec('0x25')](_0x3d9f67);}return _0x1ae424['save']();};}function saveUpdates(_0x249ac1,_0x50edd0){return function(_0x5a8d2c){if(_0x5a8d2c){return _0x5a8d2c[_0xd0ec('0x26')](_0x249ac1)[_0xd0ec('0x27')](function(_0xe5b3d3){return _0xe5b3d3;});}return null;};}function removeEntity(_0x4286b8,_0x145676){return function(_0x395667){if(_0x395667){return _0x395667[_0xd0ec('0x28')]()[_0xd0ec('0x27')](function(){_0x4286b8[_0xd0ec('0x1b')](0xcc)[_0xd0ec('0x1c')]();});}};}function handleEntityNotFound(_0x1ffb21,_0x5080b8){return function(_0x1b11a4){if(!_0x1b11a4){_0x1ffb21[_0xd0ec('0x1a')](0x194);}return _0x1b11a4;};}function handleError(_0x38e913,_0x567ceb){_0x567ceb=_0x567ceb||0x1f4;return function(_0x106c17){logger['error'](_0x106c17['stack']);if(_0x106c17['name']){delete _0x106c17['name'];}_0x38e913[_0xd0ec('0x1b')](_0x567ceb)[_0xd0ec('0x29')](_0x106c17);};}exports['index']=function(_0x550d1e,_0x16501a){var _0x2127b4={},_0x245d1c={},_0x5d7b0c={'count':0x0,'rows':[]};var _0x59a291=_['map'](db[_0xd0ec('0x2a')][_0xd0ec('0x2b')],function(_0x2c6cf1){return{'name':_0x2c6cf1[_0xd0ec('0x2c')],'type':_0x2c6cf1[_0xd0ec('0x2d')][_0xd0ec('0x2e')]};});_0x245d1c[_0xd0ec('0x2f')]=_[_0xd0ec('0x30')](_0x59a291,_0xd0ec('0x31'));_0x245d1c[_0xd0ec('0x32')]=_['keys'](_0x550d1e[_0xd0ec('0x32')]);_0x245d1c['filters']=_['intersection'](_0x245d1c[_0xd0ec('0x2f')],_0x245d1c[_0xd0ec('0x32')]);_0x2127b4['attributes']=_[_0xd0ec('0x33')](_0x245d1c[_0xd0ec('0x2f')],qs[_0xd0ec('0x34')](_0x550d1e[_0xd0ec('0x32')]['fields']));_0x2127b4['attributes']=_0x2127b4[_0xd0ec('0x35')]['length']?_0x2127b4['attributes']:_0x245d1c[_0xd0ec('0x2f')];if(!_0x550d1e['query']['hasOwnProperty']('nolimit')){_0x2127b4[_0xd0ec('0x1f')]=qs['limit'](_0x550d1e[_0xd0ec('0x32')][_0xd0ec('0x1f')]);_0x2127b4[_0xd0ec('0x21')]=qs['offset'](_0x550d1e[_0xd0ec('0x32')]['offset']);}_0x2127b4['order']=qs['sort'](_0x550d1e[_0xd0ec('0x32')][_0xd0ec('0x36')]);_0x2127b4[_0xd0ec('0x37')]=qs[_0xd0ec('0x38')](_['pick'](_0x550d1e[_0xd0ec('0x32')],_0x245d1c['filters']),_0x59a291);if(_0x550d1e[_0xd0ec('0x32')][_0xd0ec('0x39')]){_0x2127b4['where']=_['merge'](_0x2127b4[_0xd0ec('0x37')],{'$or':_['map'](_0x59a291,function(_0x2ae00c){if(_0x2ae00c[_0xd0ec('0x2d')]!==_0xd0ec('0x3a')){var _0x580585={};_0x580585[_0x2ae00c[_0xd0ec('0x31')]]={'$like':'%'+_0x550d1e[_0xd0ec('0x32')][_0xd0ec('0x39')]+'%'};return _0x580585;}})});}_0x2127b4=_['merge']({},_0x2127b4,_0x550d1e[_0xd0ec('0x3b')]);var _0x332046={'where':_0x2127b4[_0xd0ec('0x37')]};return db[_0xd0ec('0x2a')][_0xd0ec('0x20')](_0x332046)[_0xd0ec('0x27')](function(_0x7d7ca4){_0x5d7b0c['count']=_0x7d7ca4;if(_0x550d1e[_0xd0ec('0x32')]['includeAll']){_0x2127b4['include']=[{'all':!![]}];}return db[_0xd0ec('0x2a')]['findAll'](_0x2127b4);})[_0xd0ec('0x27')](function(_0x15d943){_0x5d7b0c[_0xd0ec('0x3c')]=_0x15d943;return _0x5d7b0c;})[_0xd0ec('0x27')](respondWithFilteredResult(_0x16501a,_0x2127b4))[_0xd0ec('0x3d')](handleError(_0x16501a,null));};exports[_0xd0ec('0x3e')]=function(_0x41c339,_0x422a52){var _0x6521b4={'raw':!![],'where':{'id':_0x41c339['params']['id']}},_0xaf6fde={};_0xaf6fde['model']=_['keys'](db[_0xd0ec('0x2a')][_0xd0ec('0x2b')]);_0xaf6fde[_0xd0ec('0x32')]=_[_0xd0ec('0x3f')](_0x41c339[_0xd0ec('0x32')]);_0xaf6fde[_0xd0ec('0x38')]=_[_0xd0ec('0x33')](_0xaf6fde['model'],_0xaf6fde[_0xd0ec('0x32')]);_0x6521b4[_0xd0ec('0x35')]=_[_0xd0ec('0x33')](_0xaf6fde[_0xd0ec('0x2f')],qs[_0xd0ec('0x34')](_0x41c339[_0xd0ec('0x32')][_0xd0ec('0x34')]));_0x6521b4[_0xd0ec('0x35')]=_0x6521b4[_0xd0ec('0x35')][_0xd0ec('0x40')]?_0x6521b4[_0xd0ec('0x35')]:_0xaf6fde['model'];if(_0x41c339[_0xd0ec('0x32')][_0xd0ec('0x41')]){_0x6521b4[_0xd0ec('0x42')]=[{'all':!![]}];}_0x6521b4=_[_0xd0ec('0x43')]({},_0x6521b4,_0x41c339[_0xd0ec('0x3b')]);return db[_0xd0ec('0x2a')][_0xd0ec('0x44')](_0x6521b4)[_0xd0ec('0x27')](handleEntityNotFound(_0x422a52,null))[_0xd0ec('0x27')](respondWithResult(_0x422a52,null))['catch'](handleError(_0x422a52,null));};exports[_0xd0ec('0x45')]=function(_0x1d1ce0,_0xeb28d0){return db['SquareReport']['create'](_0x1d1ce0[_0xd0ec('0x46')],{})[_0xd0ec('0x27')](respondWithResult(_0xeb28d0,0xc9))['catch'](handleError(_0xeb28d0,null));};exports[_0xd0ec('0x26')]=function(_0x12a95c,_0x51b89a){if(_0x12a95c[_0xd0ec('0x46')]['id']){delete _0x12a95c[_0xd0ec('0x46')]['id'];}return db['SquareReport']['find']({'where':{'id':_0x12a95c[_0xd0ec('0x47')]['id']}})[_0xd0ec('0x27')](handleEntityNotFound(_0x51b89a,null))[_0xd0ec('0x27')](saveUpdates(_0x12a95c[_0xd0ec('0x46')],null))[_0xd0ec('0x27')](respondWithResult(_0x51b89a,null))[_0xd0ec('0x3d')](handleError(_0x51b89a,null));};exports[_0xd0ec('0x28')]=function(_0x360dd8,_0x3ec304){return db[_0xd0ec('0x2a')][_0xd0ec('0x44')]({'where':{'id':_0x360dd8[_0xd0ec('0x47')]['id']}})['then'](handleEntityNotFound(_0x3ec304,null))[_0xd0ec('0x27')](removeEntity(_0x3ec304,null))['catch'](handleError(_0x3ec304,null));};exports[_0xd0ec('0x48')]=function(_0x2c50e1,_0x121778){return db['SquareReport'][_0xd0ec('0x48')]()[_0xd0ec('0x27')](respondWithResult(_0x121778,null))['catch'](handleError(_0x121778,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 47b6da5..a05da43 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 _0xa2f4=['SquareReport','uid_pname','leaveAt','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x21e708,_0x1808ea){var _0x2ead69=function(_0x5a657f){while(--_0x5a657f){_0x21e708['push'](_0x21e708['shift']());}};_0x2ead69(++_0x1808ea);}(_0xa2f4,0xb9));var _0x4a2f=function(_0x62edaf,_0x49d69f){_0x62edaf=_0x62edaf-0x0;var _0x169468=_0xa2f4[_0x62edaf];return _0x169468;};'use strict';var _=require(_0x4a2f('0x0'));var util=require('util');var logger=require(_0x4a2f('0x1'))(_0x4a2f('0x2'));var moment=require(_0x4a2f('0x3'));var BPromise=require(_0x4a2f('0x4'));var rp=require(_0x4a2f('0x5'));var fs=require('fs');var path=require(_0x4a2f('0x6'));var rimraf=require('rimraf');var config=require(_0x4a2f('0x7'));var attributes=require('./squareReport.attributes');module[_0x4a2f('0x8')]=function(_0x1c150f,_0x17ca64){return _0x1c150f[_0x4a2f('0x9')](_0x4a2f('0xa'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x4a2f('0xb'),'fields':['uniqueid','project_name']},{'name':_0x4a2f('0xc'),'fields':[_0x4a2f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbb03=['define','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','../../config/logger','moment','bluebird','path','../../config/environment','./squareReport.attributes'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0xbb03,0x19a));var _0x3bb0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xbb03[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3bb0('0x0'))('api');var moment=require(_0x3bb0('0x1'));var BPromise=require(_0x3bb0('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3bb0('0x3'));var rimraf=require('rimraf');var config=require(_0x3bb0('0x4'));var attributes=require(_0x3bb0('0x5'));module['exports']=function(_0x3d16b7,_0x3f9810){return _0x3d16b7[_0x3bb0('0x6')](_0x3bb0('0x7'),attributes,{'tableName':_0x3bb0('0x8'),'paranoid':![],'indexes':[{'name':_0x3bb0('0x9'),'fields':[_0x3bb0('0xa'),_0x3bb0('0xb')]},{'name':_0x3bb0('0xc'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index d9dbc4f..fa62d74 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 _0x24fe=['message','result','catch','SquareReport','create','options','raw','CreateSquareReport','UpdateSquareReport','update','body','where','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x24fe,0x1a6));var _0xe24f=function(_0x458235,_0xc56ce3){_0x458235=_0x458235-0x0;var _0x323a9b=_0x24fe[_0x458235];return _0x323a9b;};'use strict';var _=require(_0xe24f('0x0'));var util=require('util');var moment=require(_0xe24f('0x1'));var BPromise=require(_0xe24f('0x2'));var rs=require(_0xe24f('0x3'));var fs=require('fs');var Redis=require(_0xe24f('0x4'));var db=require(_0xe24f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe24f('0x6'))(_0xe24f('0x7'));var config=require(_0xe24f('0x8'));var jayson=require(_0xe24f('0x9'));var client=jayson['client'][_0xe24f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x49aca5,_0x2ba11d,_0x2dd845){return new BPromise(function(_0x2b04ed,_0x1e89a1){return client[_0xe24f('0xb')](_0x49aca5,_0x2dd845)[_0xe24f('0xc')](function(_0x6e0646){logger[_0xe24f('0xd')](_0xe24f('0xe'),_0x2ba11d,_0xe24f('0xf'));logger[_0xe24f('0x10')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x2ba11d,_0xe24f('0xf'),JSON[_0xe24f('0x11')](_0x6e0646));if(_0x6e0646[_0xe24f('0x12')]){if(_0x6e0646[_0xe24f('0x12')][_0xe24f('0x13')]===0x1f4){logger[_0xe24f('0x12')](_0xe24f('0xe'),_0x2ba11d,_0x6e0646[_0xe24f('0x12')][_0xe24f('0x14')]);return _0x1e89a1(_0x6e0646[_0xe24f('0x12')][_0xe24f('0x14')]);}logger[_0xe24f('0x12')](_0xe24f('0xe'),_0x2ba11d,_0x6e0646['error']['message']);return _0x2b04ed(_0x6e0646[_0xe24f('0x12')]['message']);}else{logger[_0xe24f('0xd')]('SquareReport,\x20%s,\x20%s',_0x2ba11d,_0xe24f('0xf'));_0x2b04ed(_0x6e0646[_0xe24f('0x15')]['message']);}})[_0xe24f('0x16')](function(_0x4a0d02){logger[_0xe24f('0x12')](_0xe24f('0xe'),_0x2ba11d,_0x4a0d02);_0x1e89a1(_0x4a0d02);});});}exports['CreateSquareReport']=function(_0x5d2cf1){var _0x4cdbb8=this;return new Promise(function(_0x3f27f2,_0xc56c74){return db[_0xe24f('0x17')][_0xe24f('0x18')](_0x5d2cf1['body'],{'raw':_0x5d2cf1['options']?_0x5d2cf1[_0xe24f('0x19')][_0xe24f('0x1a')]===undefined?!![]:![]:!![]})[_0xe24f('0xc')](function(_0x20debd){logger[_0xe24f('0xd')](_0xe24f('0x1b'),_0x5d2cf1);logger[_0xe24f('0x10')](_0xe24f('0x1b'),_0x5d2cf1,JSON[_0xe24f('0x11')](_0x20debd));_0x3f27f2(_0x20debd);})[_0xe24f('0x16')](function(_0x4a0bf7){logger['error']('CreateSquareReport',_0x4a0bf7['message'],_0x5d2cf1);_0xc56c74(_0x4cdbb8[_0xe24f('0x12')](0x1f4,_0x4a0bf7['message']));});});};exports[_0xe24f('0x1c')]=function(_0x408394){var _0x260b53=this;return new Promise(function(_0x2f417f,_0xdeebf9){return db[_0xe24f('0x17')][_0xe24f('0x1d')](_0x408394[_0xe24f('0x1e')],{'raw':_0x408394['options']?_0x408394['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x408394[_0xe24f('0x19')]?_0x408394[_0xe24f('0x19')][_0xe24f('0x1f')]||null:null,'attributes':_0x408394['options']?_0x408394[_0xe24f('0x19')][_0xe24f('0x20')]||null:null,'limit':_0x408394['options']?_0x408394[_0xe24f('0x19')][_0xe24f('0x21')]||null:null})['then'](function(_0x17902e){logger[_0xe24f('0xd')](_0xe24f('0x1c'),_0x408394);logger['debug'](_0xe24f('0x1c'),_0x408394,JSON[_0xe24f('0x11')](_0x17902e));_0x2f417f(_0x17902e);})[_0xe24f('0x16')](function(_0x2af337){logger[_0xe24f('0x12')](_0xe24f('0x1c'),_0x2af337[_0xe24f('0x14')],_0x408394);_0xdeebf9(_0x260b53['error'](0x1f4,_0x2af337[_0xe24f('0x14')]));});});}; \ No newline at end of file +var _0xf183=['result','catch','SquareReport','create','body','options','raw','CreateSquareReport','debug','UpdateSquareReport','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5470d4,_0x51559e){var _0x190bad=function(_0x2d2bf1){while(--_0x2d2bf1){_0x5470d4['push'](_0x5470d4['shift']());}};_0x190bad(++_0x51559e);}(_0xf183,0x136));var _0x3f18=function(_0x744673,_0x3fa230){_0x744673=_0x744673-0x0;var _0x19b1fe=_0xf183[_0x744673];return _0x19b1fe;};'use strict';var _=require(_0x3f18('0x0'));var util=require(_0x3f18('0x1'));var moment=require('moment');var BPromise=require(_0x3f18('0x2'));var rs=require(_0x3f18('0x3'));var fs=require('fs');var Redis=require(_0x3f18('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3f18('0x5'));var logger=require(_0x3f18('0x6'))('rpc');var config=require(_0x3f18('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3f18('0x8')][_0x3f18('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4fa808,_0x3ca4fe,_0x26de8a){return new BPromise(function(_0x1fa3ce,_0x174881){return client[_0x3f18('0xa')](_0x4fa808,_0x26de8a)[_0x3f18('0xb')](function(_0x24e797){logger[_0x3f18('0xc')](_0x3f18('0xd'),_0x3ca4fe,_0x3f18('0xe'));logger['debug'](_0x3f18('0xf'),_0x3ca4fe,_0x3f18('0xe'),JSON[_0x3f18('0x10')](_0x24e797));if(_0x24e797[_0x3f18('0x11')]){if(_0x24e797[_0x3f18('0x11')][_0x3f18('0x12')]===0x1f4){logger[_0x3f18('0x11')](_0x3f18('0xd'),_0x3ca4fe,_0x24e797['error'][_0x3f18('0x13')]);return _0x174881(_0x24e797[_0x3f18('0x11')][_0x3f18('0x13')]);}logger[_0x3f18('0x11')](_0x3f18('0xd'),_0x3ca4fe,_0x24e797[_0x3f18('0x11')][_0x3f18('0x13')]);return _0x1fa3ce(_0x24e797[_0x3f18('0x11')][_0x3f18('0x13')]);}else{logger[_0x3f18('0xc')](_0x3f18('0xd'),_0x3ca4fe,_0x3f18('0xe'));_0x1fa3ce(_0x24e797[_0x3f18('0x14')][_0x3f18('0x13')]);}})[_0x3f18('0x15')](function(_0x3b14d0){logger[_0x3f18('0x11')](_0x3f18('0xd'),_0x3ca4fe,_0x3b14d0);_0x174881(_0x3b14d0);});});}exports['CreateSquareReport']=function(_0x179607){var _0x12c859=this;return new Promise(function(_0x3bba7e,_0x2b1b67){return db[_0x3f18('0x16')][_0x3f18('0x17')](_0x179607[_0x3f18('0x18')],{'raw':_0x179607['options']?_0x179607[_0x3f18('0x19')][_0x3f18('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x5999ab){logger[_0x3f18('0xc')](_0x3f18('0x1b'),_0x179607);logger[_0x3f18('0x1c')](_0x3f18('0x1b'),_0x179607,JSON['stringify'](_0x5999ab));_0x3bba7e(_0x5999ab);})[_0x3f18('0x15')](function(_0xbac0de){logger[_0x3f18('0x11')](_0x3f18('0x1b'),_0xbac0de[_0x3f18('0x13')],_0x179607);_0x2b1b67(_0x12c859[_0x3f18('0x11')](0x1f4,_0xbac0de['message']));});});};exports[_0x3f18('0x1d')]=function(_0x561ba0){var _0x4625da=this;return new Promise(function(_0x207355,_0x41d229){return db['SquareReport']['update'](_0x561ba0[_0x3f18('0x18')],{'raw':_0x561ba0['options']?_0x561ba0[_0x3f18('0x19')][_0x3f18('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x561ba0[_0x3f18('0x19')]?_0x561ba0[_0x3f18('0x19')][_0x3f18('0x1e')]||null:null,'attributes':_0x561ba0['options']?_0x561ba0[_0x3f18('0x19')][_0x3f18('0x1f')]||null:null,'limit':_0x561ba0[_0x3f18('0x19')]?_0x561ba0[_0x3f18('0x19')][_0x3f18('0x20')]||null:null})[_0x3f18('0xb')](function(_0x3ada94){logger[_0x3f18('0xc')]('UpdateSquareReport',_0x561ba0);logger[_0x3f18('0x1c')](_0x3f18('0x1d'),_0x561ba0,JSON[_0x3f18('0x10')](_0x3ada94));_0x207355(_0x3ada94);})[_0x3f18('0x15')](function(_0x16b64a){logger[_0x3f18('0x11')]('UpdateSquareReport',_0x16b64a['message'],_0x561ba0);_0x41d229(_0x4625da[_0x3f18('0x11')](0x1f4,_0x16b64a[_0x3f18('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index e0ad394..7255aa9 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 _0x86f1=['delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','show','post','put','/:id','update'];(function(_0x3cbe1c,_0x4bcabd){var _0x5ee08b=function(_0x5c53e6){while(--_0x5c53e6){_0x3cbe1c['push'](_0x3cbe1c['shift']());}};_0x5ee08b(++_0x4bcabd);}(_0x86f1,0xcb));var _0x186f=function(_0x57ea6a,_0x401b63){_0x57ea6a=_0x57ea6a-0x0;var _0x3edba2=_0x86f1[_0x57ea6a];return _0x3edba2;};'use strict';var multer=require(_0x186f('0x0'));var util=require(_0x186f('0x1'));var path=require(_0x186f('0x2'));var timeout=require(_0x186f('0x3'));var express=require('express');var router=express[_0x186f('0x4')]();var fs_extra=require(_0x186f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x186f('0x6'));var config=require(_0x186f('0x7'));var controller=require('./squareReportDetail.controller');router[_0x186f('0x8')]('/',auth[_0x186f('0x9')](),controller[_0x186f('0xa')]);router[_0x186f('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x186f('0xb')]);router[_0x186f('0x8')]('/:id',auth[_0x186f('0x9')](),controller[_0x186f('0xc')]);router[_0x186f('0xd')]('/',auth[_0x186f('0x9')](),controller['create']);router[_0x186f('0xe')](_0x186f('0xf'),auth['isAuthenticated'](),controller[_0x186f('0x10')]);router[_0x186f('0x11')](_0x186f('0xf'),auth[_0x186f('0x9')](),controller[_0x186f('0x12')]);module[_0x186f('0x13')]=router; \ No newline at end of file +var _0x2253=['/:id','post','create','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./squareReportDetail.controller','get','isAuthenticated','/describe','describe'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x2253,0xe3));var _0x3225=function(_0xeb1d,_0x480d74){_0xeb1d=_0xeb1d-0x0;var _0x58d14a=_0x2253[_0xeb1d];return _0x58d14a;};'use strict';var multer=require(_0x3225('0x0'));var util=require(_0x3225('0x1'));var path=require(_0x3225('0x2'));var timeout=require('connect-timeout');var express=require(_0x3225('0x3'));var router=express[_0x3225('0x4')]();var fs_extra=require(_0x3225('0x5'));var auth=require(_0x3225('0x6'));var interaction=require(_0x3225('0x7'));var config=require('../../config/environment');var controller=require(_0x3225('0x8'));router[_0x3225('0x9')]('/',auth[_0x3225('0xa')](),controller['index']);router[_0x3225('0x9')](_0x3225('0xb'),auth[_0x3225('0xa')](),controller[_0x3225('0xc')]);router[_0x3225('0x9')](_0x3225('0xd'),auth[_0x3225('0xa')](),controller['show']);router[_0x3225('0xe')]('/',auth[_0x3225('0xa')](),controller[_0x3225('0xf')]);router['put'](_0x3225('0xd'),auth[_0x3225('0xa')](),controller[_0x3225('0x10')]);router[_0x3225('0x11')](_0x3225('0xd'),auth[_0x3225('0xa')](),controller[_0x3225('0x12')]);module[_0x3225('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index c9b4287..2be0952 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 _0xfed0=['exports','STRING','sequelize'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xfed0,0xaa));var _0x0fed=function(_0x287ec6,_0x59b106){_0x287ec6=_0x287ec6-0x0;var _0x1d6a7e=_0xfed0[_0x287ec6];return _0x1d6a7e;};'use strict';var Sequelize=require(_0x0fed('0x0'));module[_0x0fed('0x1')]={'uniqueid':{'type':Sequelize[_0x0fed('0x2')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0x0fed('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x0fed('0x2')]},'callerid':{'type':Sequelize[_0x0fed('0x2')]}}; \ No newline at end of file +var _0xb933=['STRING','TEXT','exports'];(function(_0x14e275,_0x29e255){var _0xa8b5a4=function(_0x2d66f2){while(--_0x2d66f2){_0x14e275['push'](_0x14e275['shift']());}};_0xa8b5a4(++_0x29e255);}(_0xb933,0x1d9));var _0x3b93=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xb933[_0x139a3c];return _0x2b375b;};'use strict';var Sequelize=require('sequelize');module[_0x3b93('0x0')]={'uniqueid':{'type':Sequelize[_0x3b93('0x1')]},'node':{'type':Sequelize[_0x3b93('0x1')]},'application':{'type':Sequelize[_0x3b93('0x1')]},'data':{'type':Sequelize[_0x3b93('0x2')]},'project_name':{'type':Sequelize[_0x3b93('0x1')]},'callerid':{'type':Sequelize[_0x3b93('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 8ffdfeb..135b873 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 _0x8d26=['Content-Range','json','reject','update','destroy','then','error','stack','name','send','index','map','SquareDetailsReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset'];(function(_0x4695ba,_0x5a7f2a){var _0x524b7d=function(_0xfc9707){while(--_0xfc9707){_0x4695ba['push'](_0x4695ba['shift']());}};_0x524b7d(++_0x5a7f2a);}(_0x8d26,0x114));var _0x68d2=function(_0x46c8fb,_0x253501){_0x46c8fb=_0x46c8fb-0x0;var _0x48f9eb=_0x8d26[_0x46c8fb];return _0x48f9eb;};'use strict';var emlformat=require(_0x68d2('0x0'));var rimraf=require(_0x68d2('0x1'));var zipdir=require(_0x68d2('0x2'));var jsonpatch=require(_0x68d2('0x3'));var rp=require(_0x68d2('0x4'));var moment=require(_0x68d2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x68d2('0x6'));var util=require(_0x68d2('0x7'));var path=require(_0x68d2('0x8'));var sox=require(_0x68d2('0x9'));var csv=require(_0x68d2('0xa'));var ejs=require(_0x68d2('0xb'));var fs=require('fs');var fs_extra=require(_0x68d2('0xc'));var _=require(_0x68d2('0xd'));var squel=require(_0x68d2('0xe'));var crypto=require(_0x68d2('0xf'));var jsforce=require(_0x68d2('0x10'));var deskjs=require(_0x68d2('0x11'));var toCsv=require(_0x68d2('0xa'));var querystring=require('querystring');var Papa=require(_0x68d2('0x12'));var Redis=require(_0x68d2('0x13'));var authService=require(_0x68d2('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x68d2('0x15'));var hardwareService=require(_0x68d2('0x16'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x68d2('0x17'));var licenseUtil=require(_0x68d2('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x116b73,_0x406cff){_0x406cff=_0x406cff||0xcc;return function(_0x55442c){if(_0x55442c){return _0x116b73[_0x68d2('0x19')](_0x406cff);}return _0x116b73[_0x68d2('0x1a')](_0x406cff)[_0x68d2('0x1b')]();};}function respondWithResult(_0x4e2ce7,_0x468c8c){_0x468c8c=_0x468c8c||0xc8;return function(_0x3bd4e0){if(_0x3bd4e0){return _0x4e2ce7[_0x68d2('0x1a')](_0x468c8c)['json'](_0x3bd4e0);}};}function respondWithFilteredResult(_0x416a41,_0xa5e789){return function(_0x4f5698){if(_0x4f5698){var _0x35ef61=typeof _0xa5e789['offset']===_0x68d2('0x1c')&&typeof _0xa5e789[_0x68d2('0x1d')]===_0x68d2('0x1c');var _0x2dc280=_0x4f5698[_0x68d2('0x1e')];var _0x4b6c10=_0x35ef61?0x0:_0xa5e789[_0x68d2('0x1f')];var _0x566a5b=_0x35ef61?_0x4f5698['count']:_0xa5e789[_0x68d2('0x1f')]+_0xa5e789[_0x68d2('0x1d')];var _0x55ed5f;if(_0x566a5b>=_0x2dc280){_0x566a5b=_0x2dc280;_0x55ed5f=0xc8;}else{_0x55ed5f=0xce;}_0x416a41[_0x68d2('0x1a')](_0x55ed5f);return _0x416a41['set'](_0x68d2('0x20'),_0x4b6c10+'-'+_0x566a5b+'/'+_0x2dc280)[_0x68d2('0x21')](_0x4f5698);}return null;};}function patchUpdates(_0x4635c3){return function(_0x3e76eb){try{jsonpatch['apply'](_0x3e76eb,_0x4635c3,!![]);}catch(_0x39f8a8){return BPromise[_0x68d2('0x22')](_0x39f8a8);}return _0x3e76eb['save']();};}function saveUpdates(_0xb559f9,_0x19c43a){return function(_0x146fad){if(_0x146fad){return _0x146fad[_0x68d2('0x23')](_0xb559f9)['then'](function(_0x326364){return _0x326364;});}return null;};}function removeEntity(_0x12fac1,_0x42725d){return function(_0x432b9b){if(_0x432b9b){return _0x432b9b[_0x68d2('0x24')]()[_0x68d2('0x25')](function(){_0x12fac1[_0x68d2('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1cb058,_0xeb0826){return function(_0x39388){if(!_0x39388){_0x1cb058[_0x68d2('0x19')](0x194);}return _0x39388;};}function handleError(_0x20d9c2,_0xcfa91b){_0xcfa91b=_0xcfa91b||0x1f4;return function(_0x521c63){logger[_0x68d2('0x26')](_0x521c63[_0x68d2('0x27')]);if(_0x521c63[_0x68d2('0x28')]){delete _0x521c63[_0x68d2('0x28')];}_0x20d9c2[_0x68d2('0x1a')](_0xcfa91b)[_0x68d2('0x29')](_0x521c63);};}exports[_0x68d2('0x2a')]=function(_0x39a43a,_0x365371){var _0x35e658={},_0x3bd167={},_0x49ff40={'count':0x0,'rows':[]};var _0x11c911=_[_0x68d2('0x2b')](db[_0x68d2('0x2c')][_0x68d2('0x2d')],function(_0x4e286f){return{'name':_0x4e286f['fieldName'],'type':_0x4e286f[_0x68d2('0x2e')][_0x68d2('0x2f')]};});_0x3bd167[_0x68d2('0x30')]=_[_0x68d2('0x2b')](_0x11c911,_0x68d2('0x28'));_0x3bd167[_0x68d2('0x31')]=_[_0x68d2('0x32')](_0x39a43a[_0x68d2('0x31')]);_0x3bd167[_0x68d2('0x33')]=_[_0x68d2('0x34')](_0x3bd167[_0x68d2('0x30')],_0x3bd167[_0x68d2('0x31')]);_0x35e658[_0x68d2('0x35')]=_[_0x68d2('0x34')](_0x3bd167[_0x68d2('0x30')],qs[_0x68d2('0x36')](_0x39a43a['query'][_0x68d2('0x36')]));_0x35e658[_0x68d2('0x35')]=_0x35e658[_0x68d2('0x35')][_0x68d2('0x37')]?_0x35e658[_0x68d2('0x35')]:_0x3bd167[_0x68d2('0x30')];if(!_0x39a43a[_0x68d2('0x31')][_0x68d2('0x38')](_0x68d2('0x39'))){_0x35e658[_0x68d2('0x1d')]=qs[_0x68d2('0x1d')](_0x39a43a[_0x68d2('0x31')][_0x68d2('0x1d')]);_0x35e658[_0x68d2('0x1f')]=qs['offset'](_0x39a43a[_0x68d2('0x31')]['offset']);}_0x35e658[_0x68d2('0x3a')]=qs[_0x68d2('0x3b')](_0x39a43a[_0x68d2('0x31')][_0x68d2('0x3b')]);_0x35e658[_0x68d2('0x3c')]=qs['filters'](_[_0x68d2('0x3d')](_0x39a43a[_0x68d2('0x31')],_0x3bd167[_0x68d2('0x33')]),_0x11c911);if(_0x39a43a[_0x68d2('0x31')][_0x68d2('0x3e')]){_0x35e658['where']=_['merge'](_0x35e658[_0x68d2('0x3c')],{'$or':_[_0x68d2('0x2b')](_0x11c911,function(_0x3d9aa3){if(_0x3d9aa3['type']!==_0x68d2('0x3f')){var _0x1075ac={};_0x1075ac[_0x3d9aa3[_0x68d2('0x28')]]={'$like':'%'+_0x39a43a[_0x68d2('0x31')][_0x68d2('0x3e')]+'%'};return _0x1075ac;}})});}_0x35e658=_['merge']({},_0x35e658,_0x39a43a[_0x68d2('0x40')]);var _0x1f62be={'where':_0x35e658[_0x68d2('0x3c')]};return db['SquareDetailsReport'][_0x68d2('0x1e')](_0x1f62be)['then'](function(_0x29d17a){_0x49ff40['count']=_0x29d17a;if(_0x39a43a[_0x68d2('0x31')][_0x68d2('0x41')]){_0x35e658[_0x68d2('0x42')]=[{'all':!![]}];}return db['SquareDetailsReport'][_0x68d2('0x43')](_0x35e658);})[_0x68d2('0x25')](function(_0x30a46a){_0x49ff40[_0x68d2('0x44')]=_0x30a46a;return _0x49ff40;})[_0x68d2('0x25')](respondWithFilteredResult(_0x365371,_0x35e658))[_0x68d2('0x45')](handleError(_0x365371,null));};exports[_0x68d2('0x46')]=function(_0x4e7847,_0x517c11){var _0x4e7af3={'raw':!![],'where':{'id':_0x4e7847[_0x68d2('0x47')]['id']}},_0x296136={};_0x296136[_0x68d2('0x30')]=_[_0x68d2('0x32')](db[_0x68d2('0x2c')]['rawAttributes']);_0x296136['query']=_[_0x68d2('0x32')](_0x4e7847[_0x68d2('0x31')]);_0x296136['filters']=_[_0x68d2('0x34')](_0x296136['model'],_0x296136[_0x68d2('0x31')]);_0x4e7af3[_0x68d2('0x35')]=_[_0x68d2('0x34')](_0x296136[_0x68d2('0x30')],qs['fields'](_0x4e7847[_0x68d2('0x31')]['fields']));_0x4e7af3[_0x68d2('0x35')]=_0x4e7af3[_0x68d2('0x35')][_0x68d2('0x37')]?_0x4e7af3[_0x68d2('0x35')]:_0x296136[_0x68d2('0x30')];if(_0x4e7847[_0x68d2('0x31')][_0x68d2('0x41')]){_0x4e7af3['include']=[{'all':!![]}];}_0x4e7af3=_[_0x68d2('0x48')]({},_0x4e7af3,_0x4e7847[_0x68d2('0x40')]);return db[_0x68d2('0x2c')][_0x68d2('0x49')](_0x4e7af3)[_0x68d2('0x25')](handleEntityNotFound(_0x517c11,null))[_0x68d2('0x25')](respondWithResult(_0x517c11,null))['catch'](handleError(_0x517c11,null));};exports[_0x68d2('0x4a')]=function(_0x3d7bfe,_0x525dd0){return db[_0x68d2('0x2c')][_0x68d2('0x4a')](_0x3d7bfe[_0x68d2('0x4b')],{})[_0x68d2('0x25')](respondWithResult(_0x525dd0,0xc9))[_0x68d2('0x45')](handleError(_0x525dd0,null));};exports[_0x68d2('0x23')]=function(_0xbc717,_0x29c127){if(_0xbc717[_0x68d2('0x4b')]['id']){delete _0xbc717[_0x68d2('0x4b')]['id'];}return db[_0x68d2('0x2c')][_0x68d2('0x49')]({'where':{'id':_0xbc717['params']['id']}})[_0x68d2('0x25')](handleEntityNotFound(_0x29c127,null))[_0x68d2('0x25')](saveUpdates(_0xbc717[_0x68d2('0x4b')],null))[_0x68d2('0x25')](respondWithResult(_0x29c127,null))[_0x68d2('0x45')](handleError(_0x29c127,null));};exports[_0x68d2('0x24')]=function(_0x18ad6f,_0xeb1f4b){return db[_0x68d2('0x2c')][_0x68d2('0x49')]({'where':{'id':_0x18ad6f[_0x68d2('0x47')]['id']}})['then'](handleEntityNotFound(_0xeb1f4b,null))[_0x68d2('0x25')](removeEntity(_0xeb1f4b,null))[_0x68d2('0x45')](handleError(_0xeb1f4b,null));};exports[_0x68d2('0x4c')]=function(_0x5ca563,_0x1d7ec8){return db[_0x68d2('0x2c')][_0x68d2('0x4c')]()[_0x68d2('0x25')](respondWithResult(_0x1d7ec8,null))[_0x68d2('0x45')](handleError(_0x1d7ec8,null));}; \ No newline at end of file +var _0xa9e3=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','save','then','destroy','error','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','SquareDetailsReport','body','update','describe','eml-format','rimraf','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0xa9e3,0x16b));var _0x3a9e=function(_0x11281d,_0x2dea05){_0x11281d=_0x11281d-0x0;var _0x5aab06=_0xa9e3[_0x11281d];return _0x5aab06;};'use strict';var emlformat=require(_0x3a9e('0x0'));var rimraf=require(_0x3a9e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3a9e('0x2'));var moment=require(_0x3a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3a9e('0x4'));var util=require('util');var path=require(_0x3a9e('0x5'));var sox=require(_0x3a9e('0x6'));var csv=require(_0x3a9e('0x7'));var ejs=require(_0x3a9e('0x8'));var fs=require('fs');var fs_extra=require(_0x3a9e('0x9'));var _=require(_0x3a9e('0xa'));var squel=require(_0x3a9e('0xb'));var crypto=require(_0x3a9e('0xc'));var jsforce=require(_0x3a9e('0xd'));var deskjs=require(_0x3a9e('0xe'));var toCsv=require(_0x3a9e('0x7'));var querystring=require(_0x3a9e('0xf'));var Papa=require(_0x3a9e('0x10'));var Redis=require(_0x3a9e('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3a9e('0x12'));var hardwareService=require(_0x3a9e('0x13'));var logger=require(_0x3a9e('0x14'))('api');var utils=require(_0x3a9e('0x15'));var config=require(_0x3a9e('0x16'));var licenseUtil=require(_0x3a9e('0x17'));var db=require(_0x3a9e('0x18'))['db'];function respondWithStatusCode(_0x19dddb,_0x45ffea){_0x45ffea=_0x45ffea||0xcc;return function(_0x3844df){if(_0x3844df){return _0x19dddb[_0x3a9e('0x19')](_0x45ffea);}return _0x19dddb[_0x3a9e('0x1a')](_0x45ffea)[_0x3a9e('0x1b')]();};}function respondWithResult(_0x529fdf,_0xfe71cf){_0xfe71cf=_0xfe71cf||0xc8;return function(_0xe622a5){if(_0xe622a5){return _0x529fdf['status'](_0xfe71cf)[_0x3a9e('0x1c')](_0xe622a5);}};}function respondWithFilteredResult(_0x575ea9,_0x4067fb){return function(_0x79f97f){if(_0x79f97f){var _0x1cca9c=typeof _0x4067fb['offset']===_0x3a9e('0x1d')&&typeof _0x4067fb[_0x3a9e('0x1e')]===_0x3a9e('0x1d');var _0x1baed1=_0x79f97f[_0x3a9e('0x1f')];var _0x3f82a6=_0x1cca9c?0x0:_0x4067fb[_0x3a9e('0x20')];var _0x17db1c=_0x1cca9c?_0x79f97f[_0x3a9e('0x1f')]:_0x4067fb[_0x3a9e('0x20')]+_0x4067fb[_0x3a9e('0x1e')];var _0x459141;if(_0x17db1c>=_0x1baed1){_0x17db1c=_0x1baed1;_0x459141=0xc8;}else{_0x459141=0xce;}_0x575ea9[_0x3a9e('0x1a')](_0x459141);return _0x575ea9[_0x3a9e('0x21')]('Content-Range',_0x3f82a6+'-'+_0x17db1c+'/'+_0x1baed1)[_0x3a9e('0x1c')](_0x79f97f);}return null;};}function patchUpdates(_0xb4132a){return function(_0x2434fe){try{jsonpatch[_0x3a9e('0x22')](_0x2434fe,_0xb4132a,!![]);}catch(_0x205d35){return BPromise['reject'](_0x205d35);}return _0x2434fe[_0x3a9e('0x23')]();};}function saveUpdates(_0x40b91a,_0x50b4fe){return function(_0x2e09e1){if(_0x2e09e1){return _0x2e09e1['update'](_0x40b91a)[_0x3a9e('0x24')](function(_0x5350dc){return _0x5350dc;});}return null;};}function removeEntity(_0x2d72cb,_0x35ba50){return function(_0x2432be){if(_0x2432be){return _0x2432be[_0x3a9e('0x25')]()[_0x3a9e('0x24')](function(){_0x2d72cb[_0x3a9e('0x1a')](0xcc)[_0x3a9e('0x1b')]();});}};}function handleEntityNotFound(_0x45e9cc,_0x2bbcbf){return function(_0x5c4854){if(!_0x5c4854){_0x45e9cc[_0x3a9e('0x19')](0x194);}return _0x5c4854;};}function handleError(_0xf0c26e,_0x1a3cdd){_0x1a3cdd=_0x1a3cdd||0x1f4;return function(_0x27b5f3){logger[_0x3a9e('0x26')](_0x27b5f3['stack']);if(_0x27b5f3[_0x3a9e('0x27')]){delete _0x27b5f3[_0x3a9e('0x27')];}_0xf0c26e[_0x3a9e('0x1a')](_0x1a3cdd)[_0x3a9e('0x28')](_0x27b5f3);};}exports['index']=function(_0x48c16c,_0x1e23d2){var _0x1b3c82={},_0x2fb7dc={},_0x2827ca={'count':0x0,'rows':[]};var _0x4f83d5=_[_0x3a9e('0x29')](db['SquareDetailsReport'][_0x3a9e('0x2a')],function(_0x3adc61){return{'name':_0x3adc61[_0x3a9e('0x2b')],'type':_0x3adc61[_0x3a9e('0x2c')][_0x3a9e('0x2d')]};});_0x2fb7dc['model']=_[_0x3a9e('0x29')](_0x4f83d5,_0x3a9e('0x27'));_0x2fb7dc[_0x3a9e('0x2e')]=_[_0x3a9e('0x2f')](_0x48c16c['query']);_0x2fb7dc[_0x3a9e('0x30')]=_[_0x3a9e('0x31')](_0x2fb7dc[_0x3a9e('0x32')],_0x2fb7dc['query']);_0x1b3c82[_0x3a9e('0x33')]=_[_0x3a9e('0x31')](_0x2fb7dc[_0x3a9e('0x32')],qs[_0x3a9e('0x34')](_0x48c16c[_0x3a9e('0x2e')]['fields']));_0x1b3c82[_0x3a9e('0x33')]=_0x1b3c82[_0x3a9e('0x33')][_0x3a9e('0x35')]?_0x1b3c82[_0x3a9e('0x33')]:_0x2fb7dc[_0x3a9e('0x32')];if(!_0x48c16c[_0x3a9e('0x2e')][_0x3a9e('0x36')](_0x3a9e('0x37'))){_0x1b3c82[_0x3a9e('0x1e')]=qs['limit'](_0x48c16c[_0x3a9e('0x2e')][_0x3a9e('0x1e')]);_0x1b3c82['offset']=qs[_0x3a9e('0x20')](_0x48c16c[_0x3a9e('0x2e')][_0x3a9e('0x20')]);}_0x1b3c82[_0x3a9e('0x38')]=qs[_0x3a9e('0x39')](_0x48c16c['query'][_0x3a9e('0x39')]);_0x1b3c82[_0x3a9e('0x3a')]=qs[_0x3a9e('0x30')](_[_0x3a9e('0x3b')](_0x48c16c[_0x3a9e('0x2e')],_0x2fb7dc[_0x3a9e('0x30')]),_0x4f83d5);if(_0x48c16c['query'][_0x3a9e('0x3c')]){_0x1b3c82[_0x3a9e('0x3a')]=_[_0x3a9e('0x3d')](_0x1b3c82['where'],{'$or':_['map'](_0x4f83d5,function(_0x3980a7){if(_0x3980a7[_0x3a9e('0x2c')]!==_0x3a9e('0x3e')){var _0x3761b2={};_0x3761b2[_0x3980a7[_0x3a9e('0x27')]]={'$like':'%'+_0x48c16c[_0x3a9e('0x2e')][_0x3a9e('0x3c')]+'%'};return _0x3761b2;}})});}_0x1b3c82=_[_0x3a9e('0x3d')]({},_0x1b3c82,_0x48c16c[_0x3a9e('0x3f')]);var _0x357461={'where':_0x1b3c82[_0x3a9e('0x3a')]};return db['SquareDetailsReport']['count'](_0x357461)['then'](function(_0x240c1f){_0x2827ca['count']=_0x240c1f;if(_0x48c16c[_0x3a9e('0x2e')][_0x3a9e('0x40')]){_0x1b3c82[_0x3a9e('0x41')]=[{'all':!![]}];}return db['SquareDetailsReport'][_0x3a9e('0x42')](_0x1b3c82);})[_0x3a9e('0x24')](function(_0x587ff6){_0x2827ca[_0x3a9e('0x43')]=_0x587ff6;return _0x2827ca;})[_0x3a9e('0x24')](respondWithFilteredResult(_0x1e23d2,_0x1b3c82))[_0x3a9e('0x44')](handleError(_0x1e23d2,null));};exports[_0x3a9e('0x45')]=function(_0x15e3d6,_0x42218a){var _0x42fd20={'raw':!![],'where':{'id':_0x15e3d6[_0x3a9e('0x46')]['id']}},_0x40d125={};_0x40d125['model']=_['keys'](db['SquareDetailsReport'][_0x3a9e('0x2a')]);_0x40d125[_0x3a9e('0x2e')]=_[_0x3a9e('0x2f')](_0x15e3d6['query']);_0x40d125[_0x3a9e('0x30')]=_[_0x3a9e('0x31')](_0x40d125[_0x3a9e('0x32')],_0x40d125['query']);_0x42fd20[_0x3a9e('0x33')]=_[_0x3a9e('0x31')](_0x40d125['model'],qs['fields'](_0x15e3d6['query'][_0x3a9e('0x34')]));_0x42fd20[_0x3a9e('0x33')]=_0x42fd20['attributes'][_0x3a9e('0x35')]?_0x42fd20[_0x3a9e('0x33')]:_0x40d125[_0x3a9e('0x32')];if(_0x15e3d6[_0x3a9e('0x2e')][_0x3a9e('0x40')]){_0x42fd20[_0x3a9e('0x41')]=[{'all':!![]}];}_0x42fd20=_[_0x3a9e('0x3d')]({},_0x42fd20,_0x15e3d6[_0x3a9e('0x3f')]);return db['SquareDetailsReport'][_0x3a9e('0x47')](_0x42fd20)[_0x3a9e('0x24')](handleEntityNotFound(_0x42218a,null))['then'](respondWithResult(_0x42218a,null))[_0x3a9e('0x44')](handleError(_0x42218a,null));};exports[_0x3a9e('0x48')]=function(_0x5812ea,_0x1b89ea){return db[_0x3a9e('0x49')][_0x3a9e('0x48')](_0x5812ea[_0x3a9e('0x4a')],{})[_0x3a9e('0x24')](respondWithResult(_0x1b89ea,0xc9))['catch'](handleError(_0x1b89ea,null));};exports[_0x3a9e('0x4b')]=function(_0xb16d79,_0x211436){if(_0xb16d79[_0x3a9e('0x4a')]['id']){delete _0xb16d79['body']['id'];}return db[_0x3a9e('0x49')]['find']({'where':{'id':_0xb16d79[_0x3a9e('0x46')]['id']}})['then'](handleEntityNotFound(_0x211436,null))['then'](saveUpdates(_0xb16d79[_0x3a9e('0x4a')],null))[_0x3a9e('0x24')](respondWithResult(_0x211436,null))[_0x3a9e('0x44')](handleError(_0x211436,null));};exports[_0x3a9e('0x25')]=function(_0x27366b,_0x1e3448){return db[_0x3a9e('0x49')]['find']({'where':{'id':_0x27366b['params']['id']}})[_0x3a9e('0x24')](handleEntityNotFound(_0x1e3448,null))['then'](removeEntity(_0x1e3448,null))[_0x3a9e('0x44')](handleError(_0x1e3448,null));};exports[_0x3a9e('0x4c')]=function(_0x33fcaa,_0x2e569a){return db[_0x3a9e('0x49')]['describe']()[_0x3a9e('0x24')](respondWithResult(_0x2e569a,null))[_0x3a9e('0x44')](handleError(_0x2e569a,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index bd00680..2024124 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 _0xafb6=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','api'];(function(_0x4e1aeb,_0xe2beca){var _0x442a96=function(_0x19202e){while(--_0x19202e){_0x4e1aeb['push'](_0x4e1aeb['shift']());}};_0x442a96(++_0xe2beca);}(_0xafb6,0x6c));var _0x6afb=function(_0x412b2a,_0x11fb8a){_0x412b2a=_0x412b2a-0x0;var _0x5872e3=_0xafb6[_0x412b2a];return _0x5872e3;};'use strict';var _=require(_0x6afb('0x0'));var util=require(_0x6afb('0x1'));var logger=require(_0x6afb('0x2'))(_0x6afb('0x3'));var moment=require(_0x6afb('0x4'));var BPromise=require(_0x6afb('0x5'));var rp=require(_0x6afb('0x6'));var fs=require('fs');var path=require(_0x6afb('0x7'));var rimraf=require(_0x6afb('0x8'));var config=require(_0x6afb('0x9'));var attributes=require('./squareReportDetail.attributes');module[_0x6afb('0xa')]=function(_0x4e0571,_0x7fced7){return _0x4e0571[_0x6afb('0xb')](_0x6afb('0xc'),attributes,{'tableName':_0x6afb('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x31b9=['request-promise','path','./squareReportDetail.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x310d10,_0x3fe887){var _0x1fb8af=function(_0x42965b){while(--_0x42965b){_0x310d10['push'](_0x310d10['shift']());}};_0x1fb8af(++_0x3fe887);}(_0x31b9,0x1b2));var _0x931b=function(_0x503949,_0x5098d3){_0x503949=_0x503949-0x0;var _0xad5d6d=_0x31b9[_0x503949];return _0xad5d6d;};'use strict';var _=require(_0x931b('0x0'));var util=require(_0x931b('0x1'));var logger=require(_0x931b('0x2'))(_0x931b('0x3'));var moment=require(_0x931b('0x4'));var BPromise=require(_0x931b('0x5'));var rp=require(_0x931b('0x6'));var fs=require('fs');var path=require(_0x931b('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x931b('0x8'));module[_0x931b('0x9')]=function(_0x4a3cee,_0x48180f){return _0x4a3cee[_0x931b('0xa')]('SquareDetailsReport',attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 022906c..0adda4e 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(_0x461b97,_0x44edbe){var _0x1b8adb=function(_0x85b7d9){while(--_0x85b7d9){_0x461b97['push'](_0x461b97['shift']());}};_0x1b8adb(++_0x44edbe);}(_0xdc91,0x8b));var _0x1dc9=function(_0x284ea6,_0x49dd8a){_0x284ea6=_0x284ea6-0x0;var _0x49dd3c=_0xdc91[_0x284ea6];return _0x49dd3c;};'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 _0x9354=['info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateSquareDetailsReport','create','body','options','then','stringify','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x5d003e,_0x31afda){var _0xff3eba=function(_0x504d3e){while(--_0x504d3e){_0x5d003e['push'](_0x5d003e['shift']());}};_0xff3eba(++_0x31afda);}(_0x9354,0x96));var _0x4935=function(_0x1085db,_0x41e087){_0x1085db=_0x1085db-0x0;var _0x392a60=_0x9354[_0x1085db];return _0x392a60;};'use strict';var _=require('lodash');var util=require(_0x4935('0x0'));var moment=require(_0x4935('0x1'));var BPromise=require('bluebird');var rs=require(_0x4935('0x2'));var fs=require('fs');var Redis=require(_0x4935('0x3'));var db=require(_0x4935('0x4'))['db'];var utils=require(_0x4935('0x5'));var logger=require('../../config/logger')(_0x4935('0x6'));var config=require(_0x4935('0x7'));var jayson=require(_0x4935('0x8'));var client=jayson[_0x4935('0x9')][_0x4935('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e47bd,_0x118d36,_0x2d735e){return new BPromise(function(_0x10793e,_0x4c9902){return client[_0x4935('0xb')](_0x2e47bd,_0x2d735e)['then'](function(_0x2aac9a){logger[_0x4935('0xc')](_0x4935('0xd'),_0x118d36,_0x4935('0xe'));logger[_0x4935('0xf')](_0x4935('0x10'),_0x118d36,'request\x20sent',JSON['stringify'](_0x2aac9a));if(_0x2aac9a[_0x4935('0x11')]){if(_0x2aac9a['error']['code']===0x1f4){logger[_0x4935('0x11')](_0x4935('0xd'),_0x118d36,_0x2aac9a[_0x4935('0x11')][_0x4935('0x12')]);return _0x4c9902(_0x2aac9a[_0x4935('0x11')][_0x4935('0x12')]);}logger[_0x4935('0x11')](_0x4935('0xd'),_0x118d36,_0x2aac9a[_0x4935('0x11')][_0x4935('0x12')]);return _0x10793e(_0x2aac9a[_0x4935('0x11')][_0x4935('0x12')]);}else{logger[_0x4935('0xc')](_0x4935('0xd'),_0x118d36,_0x4935('0xe'));_0x10793e(_0x2aac9a[_0x4935('0x13')]['message']);}})[_0x4935('0x14')](function(_0x46526a){logger[_0x4935('0x11')](_0x4935('0xd'),_0x118d36,_0x46526a);_0x4c9902(_0x46526a);});});}exports[_0x4935('0x15')]=function(_0x429ef3){var _0x4ebc63=this;return new Promise(function(_0xd70eff,_0x145277){return db['SquareDetailsReport'][_0x4935('0x16')](_0x429ef3[_0x4935('0x17')],{'raw':_0x429ef3[_0x4935('0x18')]?_0x429ef3['options']['raw']===undefined?!![]:![]:!![]})[_0x4935('0x19')](function(_0x6b849f){logger[_0x4935('0xc')](_0x4935('0x15'),_0x429ef3);logger[_0x4935('0xf')](_0x4935('0x15'),_0x429ef3,JSON[_0x4935('0x1a')](_0x6b849f));_0xd70eff(_0x6b849f);})[_0x4935('0x14')](function(_0x58b2f3){logger[_0x4935('0x11')](_0x4935('0x15'),_0x58b2f3[_0x4935('0x12')],_0x429ef3);_0x145277(_0x4ebc63[_0x4935('0x11')](0x1f4,_0x58b2f3[_0x4935('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 34203e1..5b33e75 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 _0xa293=['isAuthenticated','/process/:pid/kill','killProcess','exports','express','Router','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa293,0x6d));var _0x3a29=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa293[_0x14add3];return _0x4a174f;};'use strict';var express=require(_0x3a29('0x0'));var router=express[_0x3a29('0x1')]();var auth=require('../../components/auth/service');var controller=require('./system.controller');router[_0x3a29('0x2')]('/',auth[_0x3a29('0x3')](),controller['index']);router[_0x3a29('0x2')](_0x3a29('0x4'),auth[_0x3a29('0x3')](),controller[_0x3a29('0x5')]);module[_0x3a29('0x6')]=router; \ No newline at end of file +var _0x12d0=['/process/:pid/kill','killProcess','exports','express','Router','../../components/auth/service','get','isAuthenticated','index'];(function(_0x284dfe,_0x162b12){var _0x11b410=function(_0x4b68e2){while(--_0x4b68e2){_0x284dfe['push'](_0x284dfe['shift']());}};_0x11b410(++_0x162b12);}(_0x12d0,0x1b3));var _0x012d=function(_0x6eb99,_0x4a5eb3){_0x6eb99=_0x6eb99-0x0;var _0xa5cc8d=_0x12d0[_0x6eb99];return _0xa5cc8d;};'use strict';var express=require(_0x012d('0x0'));var router=express[_0x012d('0x1')]();var auth=require(_0x012d('0x2'));var controller=require('./system.controller');router[_0x012d('0x3')]('/',auth[_0x012d('0x4')](),controller[_0x012d('0x5')]);router['get'](_0x012d('0x6'),auth[_0x012d('0x4')](),controller[_0x012d('0x7')]);module[_0x012d('0x8')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 88ebda3..beeeba5 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 _0x0b7c=['error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','status','send','index','getAllData','then','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','kill','SIGINT','json','Process\x20with\x20pid\x20%s\x20killed\x20correctly','child_process','exec','../../config/logger','api','util','bluebird','lodash'];(function(_0x2c1c3b,_0x23e606){var _0x5dba73=function(_0x46da39){while(--_0x46da39){_0x2c1c3b['push'](_0x2c1c3b['shift']());}};_0x5dba73(++_0x23e606);}(_0x0b7c,0x1ac));var _0xc0b7=function(_0x7ea1fb,_0x2f0b74){_0x7ea1fb=_0x7ea1fb-0x0;var _0x478241=_0x0b7c[_0x7ea1fb];return _0x478241;};'use strict';var info=require('systeminformation');var exec=require(_0xc0b7('0x0'))[_0xc0b7('0x1')];var logger=require(_0xc0b7('0x2'))(_0xc0b7('0x3'));var util=require(_0xc0b7('0x4'));var BPromise=require(_0xc0b7('0x5'));var _=require(_0xc0b7('0x6'));function handleError(_0x391dbd,_0x31d883,_0x5546a0){_0x31d883=_0x31d883||0x1f4;return function(_0x313f0f){logger[_0xc0b7('0x7')](_0xc0b7('0x8'),_0x5546a0,_0x31d883,util['inspect'](_0x313f0f,{'showHidden':![],'depth':null}));delete _0x313f0f[_0xc0b7('0x9')];_0x391dbd[_0xc0b7('0xa')](_0x31d883)[_0xc0b7('0xb')](_0x313f0f);};}exports[_0xc0b7('0xc')]=function(_0xe577c1,_0x5b9b01){return info[_0xc0b7('0xd')]()[_0xc0b7('0xe')](function(_0x36621a){return _0x5b9b01['status'](0xc8)['json'](_0x36621a);})[_0xc0b7('0xf')](function(_0x5ca720){return _0x5b9b01['status'](0x1f4)['json'](_0x5ca720);});};exports[_0xc0b7('0x10')]=function(_0x1da0d2,_0x476c80){var _0x2ec0f4=[_0xc0b7('0x11')];return new BPromise(function(_0x3d16d8,_0xfaabca){return exec(util[_0xc0b7('0x12')](_0xc0b7('0x13'),_0x1da0d2[_0xc0b7('0x14')][_0xc0b7('0x15')]),function(_0x2e8fd7,_0x4f7edd,_0x36e6b2){if(_0x2e8fd7){return _0xfaabca(_0x2e8fd7);}return _0x3d16d8(_0x4f7edd);});})[_0xc0b7('0xe')](function(_0x41940e){var _0x26c5e2=![];var _0x1be37f=_0x41940e[_0xc0b7('0x16')](/\n/);for(var _0x225813=0x0,_0x5644ab=_0x2ec0f4[_0xc0b7('0x17')];_0x225813<_0x5644ab,_0x26c5e2===![];_0x225813+=0x1){if(_0x41940e[_0xc0b7('0x18')](_0x2ec0f4[_0x225813])>=0x0){_0x26c5e2=!![];}}if(!_0x26c5e2){throw new Error(util[_0xc0b7('0x12')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x1da0d2[_0xc0b7('0x14')]['pid']));}process[_0xc0b7('0x19')](_0x1da0d2[_0xc0b7('0x14')]['pid'],_0xc0b7('0x1a'));return _0x476c80[_0xc0b7('0xa')](0xc8)[_0xc0b7('0x1b')]({'message':util[_0xc0b7('0x12')](_0xc0b7('0x1c'),_0x1da0d2[_0xc0b7('0x14')][_0xc0b7('0x15')])});})[_0xc0b7('0xf')](handleError(_0x476c80,null,_0xc0b7('0x10')));}; \ No newline at end of file +var _0x0db1=['catch','killProcess','components/import/cm','format','pid','then','split','params','kill','SIGINT','systeminformation','child_process','exec','api','util','bluebird','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','status','send','json'];(function(_0x15c40c,_0x35944a){var _0x2a1131=function(_0x4dd6b5){while(--_0x4dd6b5){_0x15c40c['push'](_0x15c40c['shift']());}};_0x2a1131(++_0x35944a);}(_0x0db1,0x78));var _0x10db=function(_0x5a2370,_0x19084f){_0x5a2370=_0x5a2370-0x0;var _0x599b6b=_0x0db1[_0x5a2370];return _0x599b6b;};'use strict';var info=require(_0x10db('0x0'));var exec=require(_0x10db('0x1'))[_0x10db('0x2')];var logger=require('../../config/logger')(_0x10db('0x3'));var util=require(_0x10db('0x4'));var BPromise=require(_0x10db('0x5'));var _=require('lodash');function handleError(_0x4639c0,_0x3b6e1b,_0x48cce4){_0x3b6e1b=_0x3b6e1b||0x1f4;return function(_0xff6135){logger[_0x10db('0x6')](_0x10db('0x7'),_0x48cce4,_0x3b6e1b,util[_0x10db('0x8')](_0xff6135,{'showHidden':![],'depth':null}));delete _0xff6135['name'];_0x4639c0[_0x10db('0x9')](_0x3b6e1b)[_0x10db('0xa')](_0xff6135);};}exports['index']=function(_0x5c21cd,_0x5352d1){return info['getAllData']()['then'](function(_0xe4ee2e){return _0x5352d1[_0x10db('0x9')](0xc8)[_0x10db('0xb')](_0xe4ee2e);})[_0x10db('0xc')](function(_0x55bcea){return _0x5352d1[_0x10db('0x9')](0x1f4)[_0x10db('0xb')](_0x55bcea);});};exports[_0x10db('0xd')]=function(_0x4e2eb8,_0x27e44d){var _0x2fb989=[_0x10db('0xe')];return new BPromise(function(_0x3fe769,_0x23a599){return exec(util[_0x10db('0xf')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x4e2eb8['params'][_0x10db('0x10')]),function(_0x3dff56,_0x523841,_0x4a180f){if(_0x3dff56){return _0x23a599(_0x3dff56);}return _0x3fe769(_0x523841);});})[_0x10db('0x11')](function(_0x2f3c13){var _0x345e93=![];var _0x48702b=_0x2f3c13[_0x10db('0x12')](/\n/);for(var _0xbcb130=0x0,_0x425bda=_0x2fb989['length'];_0xbcb130<_0x425bda,_0x345e93===![];_0xbcb130+=0x1){if(_0x2f3c13['indexOf'](_0x2fb989[_0xbcb130])>=0x0){_0x345e93=!![];}}if(!_0x345e93){throw new Error(util[_0x10db('0xf')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x4e2eb8[_0x10db('0x13')][_0x10db('0x10')]));}process[_0x10db('0x14')](_0x4e2eb8[_0x10db('0x13')][_0x10db('0x10')],_0x10db('0x15'));return _0x27e44d[_0x10db('0x9')](0xc8)['json']({'message':util[_0x10db('0xf')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x4e2eb8['params']['pid'])});})['catch'](handleError(_0x27e44d,null,_0x10db('0xd')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 2cf8399..f135a19 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 _0xa245=['update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./tag.controller','index','get','/:id','isAuthenticated','show','post','create','put'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0xa245,0xff));var _0x5a24=function(_0x359263,_0xb0dce6){_0x359263=_0x359263-0x0;var _0x102b13=_0xa245[_0x359263];return _0x102b13;};'use strict';var multer=require(_0x5a24('0x0'));var util=require(_0x5a24('0x1'));var path=require(_0x5a24('0x2'));var timeout=require(_0x5a24('0x3'));var express=require(_0x5a24('0x4'));var router=express[_0x5a24('0x5')]();var fs_extra=require(_0x5a24('0x6'));var auth=require(_0x5a24('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x5a24('0x8'));var controller=require(_0x5a24('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x5a24('0xa')]);router[_0x5a24('0xb')](_0x5a24('0xc'),auth[_0x5a24('0xd')](),controller[_0x5a24('0xe')]);router[_0x5a24('0xf')]('/',auth[_0x5a24('0xd')](),controller[_0x5a24('0x10')]);router[_0x5a24('0x11')](_0x5a24('0xc'),auth[_0x5a24('0xd')](),controller[_0x5a24('0x12')]);router[_0x5a24('0x13')](_0x5a24('0xc'),auth[_0x5a24('0xd')](),controller[_0x5a24('0x14')]);module['exports']=router; \ No newline at end of file +var _0xf767=['Router','./tag.controller','get','/:id','show','post','create','put','isAuthenticated','update','delete','destroy','path','connect-timeout','express'];(function(_0x1f6d3c,_0x38851f){var _0x3cb09b=function(_0x3a7149){while(--_0x3a7149){_0x1f6d3c['push'](_0x1f6d3c['shift']());}};_0x3cb09b(++_0x38851f);}(_0xf767,0x183));var _0x7f76=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xf767[_0x55f8b4];return _0x2475f9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7f76('0x0'));var timeout=require(_0x7f76('0x1'));var express=require(_0x7f76('0x2'));var router=express[_0x7f76('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7f76('0x4'));router[_0x7f76('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7f76('0x5')](_0x7f76('0x6'),auth['isAuthenticated'](),controller[_0x7f76('0x7')]);router[_0x7f76('0x8')]('/',auth['isAuthenticated'](),controller[_0x7f76('0x9')]);router[_0x7f76('0xa')](_0x7f76('0x6'),auth[_0x7f76('0xb')](),controller[_0x7f76('0xc')]);router[_0x7f76('0xd')](_0x7f76('0x6'),auth[_0x7f76('0xb')](),controller[_0x7f76('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 539c4e2..ff024f3 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 _0x2977=['#0091EA','sequelize','STRING','name'];(function(_0x5090b3,_0x2dbc6a){var _0x5c0333=function(_0x34c824){while(--_0x34c824){_0x5090b3['push'](_0x5090b3['shift']());}};_0x5c0333(++_0x2dbc6a);}(_0x2977,0xa5));var _0x7297=function(_0x1b109d,_0xa6a91e){_0x1b109d=_0x1b109d-0x0;var _0x35508d=_0x2977[_0x1b109d];return _0x35508d;};'use strict';var Sequelize=require(_0x7297('0x0'));module['exports']={'name':{'type':Sequelize[_0x7297('0x1')],'unique':_0x7297('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x7297('0x1')],'defaultValue':_0x7297('0x3')},'description':{'type':Sequelize[_0x7297('0x1')]}}; \ No newline at end of file +var _0x3f8c=['name','#0091EA','STRING'];(function(_0x13c9d5,_0x2d2201){var _0x24d328=function(_0x532e33){while(--_0x532e33){_0x13c9d5['push'](_0x13c9d5['shift']());}};_0x24d328(++_0x2d2201);}(_0x3f8c,0x104));var _0xc3f8=function(_0x3fd454,_0x324f7b){_0x3fd454=_0x3fd454-0x0;var _0x1c21f5=_0x3f8c[_0x3fd454];return _0x1c21f5;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc3f8('0x0')],'unique':_0xc3f8('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xc3f8('0x0')],'defaultValue':_0xc3f8('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 5acca8e..a3b5a64 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 _0xe600=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','get','UserProfileResource','stack','name','send','map','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','Tag','includeAll','include','catch','show','keys','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Tags','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','rimraf','fast-json-patch','request-promise'];(function(_0x319ded,_0xa2e12d){var _0x2d2a8b=function(_0x4921c8){while(--_0x4921c8){_0x319ded['push'](_0x319ded['shift']());}};_0x2d2a8b(++_0xa2e12d);}(_0xe600,0x159));var _0x0e60=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe600[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0e60('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0e60('0x1'));var rp=require(_0x0e60('0x2'));var moment=require(_0x0e60('0x3'));var BPromise=require(_0x0e60('0x4'));var Mustache=require(_0x0e60('0x5'));var util=require(_0x0e60('0x6'));var path=require(_0x0e60('0x7'));var sox=require(_0x0e60('0x8'));var csv=require(_0x0e60('0x9'));var ejs=require(_0x0e60('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0e60('0xb'));var squel=require(_0x0e60('0xc'));var crypto=require(_0x0e60('0xd'));var jsforce=require(_0x0e60('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0e60('0x9'));var querystring=require(_0x0e60('0xf'));var Papa=require(_0x0e60('0x10'));var Redis=require(_0x0e60('0x11'));var authService=require(_0x0e60('0x12'));var qs=require(_0x0e60('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0e60('0x14'));var logger=require(_0x0e60('0x15'))(_0x0e60('0x16'));var utils=require(_0x0e60('0x17'));var config=require(_0x0e60('0x18'));var licenseUtil=require(_0x0e60('0x19'));var db=require(_0x0e60('0x1a'))['db'];function respondWithStatusCode(_0x2f5ee4,_0x540411){_0x540411=_0x540411||0xcc;return function(_0x2d848f){if(_0x2d848f){return _0x2f5ee4[_0x0e60('0x1b')](_0x540411);}return _0x2f5ee4[_0x0e60('0x1c')](_0x540411)[_0x0e60('0x1d')]();};}function respondWithResult(_0x45328b,_0x37bf95){_0x37bf95=_0x37bf95||0xc8;return function(_0x5d7f84){if(_0x5d7f84){return _0x45328b[_0x0e60('0x1c')](_0x37bf95)['json'](_0x5d7f84);}};}function respondWithFilteredResult(_0x91cd1,_0x128887){return function(_0x170890){if(_0x170890){var _0x5ab4ba=typeof _0x128887[_0x0e60('0x1e')]===_0x0e60('0x1f')&&typeof _0x128887[_0x0e60('0x20')]===_0x0e60('0x1f');var _0x2e6270=_0x170890['count'];var _0x992490=_0x5ab4ba?0x0:_0x128887[_0x0e60('0x1e')];var _0x599c1d=_0x5ab4ba?_0x170890[_0x0e60('0x21')]:_0x128887[_0x0e60('0x1e')]+_0x128887[_0x0e60('0x20')];var _0x504b31;if(_0x599c1d>=_0x2e6270){_0x599c1d=_0x2e6270;_0x504b31=0xc8;}else{_0x504b31=0xce;}_0x91cd1[_0x0e60('0x1c')](_0x504b31);return _0x91cd1['set'](_0x0e60('0x22'),_0x992490+'-'+_0x599c1d+'/'+_0x2e6270)[_0x0e60('0x23')](_0x170890);}return null;};}function patchUpdates(_0xb9f037){return function(_0xabf953){try{jsonpatch[_0x0e60('0x24')](_0xabf953,_0xb9f037,!![]);}catch(_0x31a63e){return BPromise[_0x0e60('0x25')](_0x31a63e);}return _0xabf953[_0x0e60('0x26')]();};}function saveUpdates(_0x352633,_0x10f875){return function(_0x22c0e0){if(_0x22c0e0){return _0x22c0e0[_0x0e60('0x27')](_0x352633)[_0x0e60('0x28')](function(_0x16985f){return _0x16985f;});}return null;};}function removeEntity(_0x4702f,_0x33f9f3){return function(_0x41642c){if(_0x41642c){return _0x41642c[_0x0e60('0x29')]()[_0x0e60('0x28')](function(){var _0x4ba1a8=_0x41642c[_0x0e60('0x2a')]({'plain':!![]});var _0x41ad9a='Tags';return db[_0x0e60('0x2b')]['destroy']({'where':{'type':_0x41ad9a,'resourceId':_0x4ba1a8['id']}})[_0x0e60('0x28')](function(){return _0x41642c;});})['then'](function(){_0x4702f['status'](0xcc)[_0x0e60('0x1d')]();});}};}function handleEntityNotFound(_0x39dae2,_0x526aaa){return function(_0x4eb9b8){if(!_0x4eb9b8){_0x39dae2[_0x0e60('0x1b')](0x194);}return _0x4eb9b8;};}function handleError(_0x54d7ce,_0x73e732){_0x73e732=_0x73e732||0x1f4;return function(_0x548919){logger['error'](_0x548919[_0x0e60('0x2c')]);if(_0x548919[_0x0e60('0x2d')]){delete _0x548919[_0x0e60('0x2d')];}_0x54d7ce['status'](_0x73e732)[_0x0e60('0x2e')](_0x548919);};}exports['index']=function(_0x2e22eb,_0x1d54c0){var _0x5beb5f={},_0x540c2c={},_0xc4a74c={'count':0x0,'rows':[]};var _0x1de60a=_[_0x0e60('0x2f')](db['Tag'][_0x0e60('0x30')],function(_0x3ea4ac){return{'name':_0x3ea4ac[_0x0e60('0x31')],'type':_0x3ea4ac[_0x0e60('0x32')][_0x0e60('0x33')]};});_0x540c2c['model']=_[_0x0e60('0x2f')](_0x1de60a,'name');_0x540c2c[_0x0e60('0x34')]=_['keys'](_0x2e22eb[_0x0e60('0x34')]);_0x540c2c[_0x0e60('0x35')]=_[_0x0e60('0x36')](_0x540c2c['model'],_0x540c2c[_0x0e60('0x34')]);_0x5beb5f[_0x0e60('0x37')]=_[_0x0e60('0x36')](_0x540c2c[_0x0e60('0x38')],qs[_0x0e60('0x39')](_0x2e22eb[_0x0e60('0x34')][_0x0e60('0x39')]));_0x5beb5f[_0x0e60('0x37')]=_0x5beb5f[_0x0e60('0x37')][_0x0e60('0x3a')]?_0x5beb5f[_0x0e60('0x37')]:_0x540c2c[_0x0e60('0x38')];if(!_0x2e22eb['query'][_0x0e60('0x3b')](_0x0e60('0x3c'))){_0x5beb5f[_0x0e60('0x20')]=qs[_0x0e60('0x20')](_0x2e22eb['query']['limit']);_0x5beb5f[_0x0e60('0x1e')]=qs['offset'](_0x2e22eb[_0x0e60('0x34')]['offset']);}_0x5beb5f[_0x0e60('0x3d')]=qs[_0x0e60('0x3e')](_0x2e22eb[_0x0e60('0x34')][_0x0e60('0x3e')]);_0x5beb5f[_0x0e60('0x3f')]=qs[_0x0e60('0x35')](_[_0x0e60('0x40')](_0x2e22eb[_0x0e60('0x34')],_0x540c2c[_0x0e60('0x35')]),_0x1de60a);if(_0x2e22eb[_0x0e60('0x34')][_0x0e60('0x41')]){_0x5beb5f[_0x0e60('0x3f')]=_['merge'](_0x5beb5f[_0x0e60('0x3f')],{'$or':_['map'](_0x1de60a,function(_0x345a12){if(_0x345a12[_0x0e60('0x32')]!=='VIRTUAL'){var _0x482583={};_0x482583[_0x345a12[_0x0e60('0x2d')]]={'$like':'%'+_0x2e22eb[_0x0e60('0x34')]['filter']+'%'};return _0x482583;}})});}_0x5beb5f=_[_0x0e60('0x42')]({},_0x5beb5f,_0x2e22eb[_0x0e60('0x43')]);var _0x50090c={'where':_0x5beb5f[_0x0e60('0x3f')]};return db[_0x0e60('0x44')][_0x0e60('0x21')](_0x50090c)[_0x0e60('0x28')](function(_0x3ac0f0){_0xc4a74c[_0x0e60('0x21')]=_0x3ac0f0;if(_0x2e22eb[_0x0e60('0x34')][_0x0e60('0x45')]){_0x5beb5f[_0x0e60('0x46')]=[{'all':!![]}];}return db['Tag']['findAll'](_0x5beb5f);})['then'](function(_0x39c7d4){_0xc4a74c['rows']=_0x39c7d4;return _0xc4a74c;})[_0x0e60('0x28')](respondWithFilteredResult(_0x1d54c0,_0x5beb5f))[_0x0e60('0x47')](handleError(_0x1d54c0,null));};exports[_0x0e60('0x48')]=function(_0x4bfebf,_0x2b2354){var _0x2432a8={'raw':!![],'where':{'id':_0x4bfebf['params']['id']}},_0x4ce029={};_0x4ce029[_0x0e60('0x38')]=_[_0x0e60('0x49')](db[_0x0e60('0x44')][_0x0e60('0x30')]);_0x4ce029[_0x0e60('0x34')]=_[_0x0e60('0x49')](_0x4bfebf['query']);_0x4ce029[_0x0e60('0x35')]=_[_0x0e60('0x36')](_0x4ce029[_0x0e60('0x38')],_0x4ce029[_0x0e60('0x34')]);_0x2432a8[_0x0e60('0x37')]=_['intersection'](_0x4ce029['model'],qs['fields'](_0x4bfebf[_0x0e60('0x34')][_0x0e60('0x39')]));_0x2432a8[_0x0e60('0x37')]=_0x2432a8[_0x0e60('0x37')]['length']?_0x2432a8['attributes']:_0x4ce029['model'];if(_0x4bfebf[_0x0e60('0x34')][_0x0e60('0x45')]){_0x2432a8[_0x0e60('0x46')]=[{'all':!![]}];}_0x2432a8=_[_0x0e60('0x42')]({},_0x2432a8,_0x4bfebf[_0x0e60('0x43')]);return db['Tag']['find'](_0x2432a8)[_0x0e60('0x28')](handleEntityNotFound(_0x2b2354,null))[_0x0e60('0x28')](respondWithResult(_0x2b2354,null))[_0x0e60('0x47')](handleError(_0x2b2354,null));};exports[_0x0e60('0x4a')]=function(_0x4ad156,_0x36a999){return db[_0x0e60('0x44')][_0x0e60('0x4a')](_0x4ad156['body'],{})[_0x0e60('0x28')](function(_0xc6cee0){var _0x5e710d=_0x4ad156[_0x0e60('0x4b')]['get']({'plain':!![]});if(!_0x5e710d)throw new Error(_0x0e60('0x4c'));if(_0x5e710d[_0x0e60('0x4d')]===_0x0e60('0x4b')){var _0x2e887c=_0xc6cee0[_0x0e60('0x2a')]({'plain':!![]});var _0x4caeed=_0x0e60('0x4e');return db[_0x0e60('0x4f')][_0x0e60('0x50')]({'where':{'name':_0x4caeed,'userProfileId':_0x5e710d[_0x0e60('0x51')]},'raw':!![]})['then'](function(_0x19d7bc){if(_0x19d7bc&&_0x19d7bc[_0x0e60('0x52')]===0x0){return db[_0x0e60('0x2b')][_0x0e60('0x4a')]({'name':_0x2e887c['name'],'resourceId':_0x2e887c['id'],'type':_0x19d7bc[_0x0e60('0x2d')],'sectionId':_0x19d7bc['id']},{})['then'](function(){return _0xc6cee0;});}else{return _0xc6cee0;}})[_0x0e60('0x47')](function(_0x707dc6){logger[_0x0e60('0x53')](_0x0e60('0x54'),_0x707dc6);throw _0x707dc6;});}return _0xc6cee0;})[_0x0e60('0x28')](respondWithResult(_0x36a999,0xc9))[_0x0e60('0x47')](handleError(_0x36a999,null));};exports[_0x0e60('0x27')]=function(_0x49daf6,_0x124b8e){if(_0x49daf6['body']['id']){delete _0x49daf6[_0x0e60('0x55')]['id'];}return db[_0x0e60('0x44')][_0x0e60('0x50')]({'where':{'id':_0x49daf6[_0x0e60('0x56')]['id']}})['then'](handleEntityNotFound(_0x124b8e,null))['then'](saveUpdates(_0x49daf6[_0x0e60('0x55')],null))['then'](respondWithResult(_0x124b8e,null))[_0x0e60('0x47')](handleError(_0x124b8e,null));};exports[_0x0e60('0x29')]=function(_0x313dd2,_0x24ada9){return db[_0x0e60('0x44')][_0x0e60('0x50')]({'where':{'id':_0x313dd2[_0x0e60('0x56')]['id']}})[_0x0e60('0x28')](handleEntityNotFound(_0x24ada9,null))['then'](removeEntity(_0x24ada9,null))[_0x0e60('0x47')](handleError(_0x24ada9,null));}; \ No newline at end of file +var _0xaf93=['sort','where','filters','filter','merge','map','options','includeAll','include','findAll','rows','catch','show','params','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','apply','reject','then','get','Tags','UserProfileResource','destroy','end','sendStatus','stack','name','index','Tag','rawAttributes','type','key','model','query','intersection','attributes','fields','length','nolimit'];(function(_0x14f857,_0x52bde6){var _0x43d8df=function(_0x2fa821){while(--_0x2fa821){_0x14f857['push'](_0x14f857['shift']());}};_0x43d8df(++_0x52bde6);}(_0xaf93,0x151));var _0x3af9=function(_0x41ffe4,_0x3a04ae){_0x41ffe4=_0x41ffe4-0x0;var _0x1ba9f3=_0xaf93[_0x41ffe4];return _0x1ba9f3;};'use strict';var emlformat=require(_0x3af9('0x0'));var rimraf=require(_0x3af9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3af9('0x2'));var moment=require(_0x3af9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3af9('0x4'));var util=require(_0x3af9('0x5'));var path=require(_0x3af9('0x6'));var sox=require(_0x3af9('0x7'));var csv=require(_0x3af9('0x8'));var ejs=require(_0x3af9('0x9'));var fs=require('fs');var fs_extra=require(_0x3af9('0xa'));var _=require('lodash');var squel=require(_0x3af9('0xb'));var crypto=require('crypto');var jsforce=require(_0x3af9('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3af9('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3af9('0xe'));var qs=require(_0x3af9('0xf'));var as=require(_0x3af9('0x10'));var hardwareService=require(_0x3af9('0x11'));var logger=require('../../config/logger')(_0x3af9('0x12'));var utils=require(_0x3af9('0x13'));var config=require(_0x3af9('0x14'));var licenseUtil=require(_0x3af9('0x15'));var db=require(_0x3af9('0x16'))['db'];function respondWithStatusCode(_0xfa1410,_0x212f63){_0x212f63=_0x212f63||0xcc;return function(_0xa7b81f){if(_0xa7b81f){return _0xfa1410['sendStatus'](_0x212f63);}return _0xfa1410[_0x3af9('0x17')](_0x212f63)['end']();};}function respondWithResult(_0x152254,_0x222b6f){_0x222b6f=_0x222b6f||0xc8;return function(_0x1e4ebb){if(_0x1e4ebb){return _0x152254['status'](_0x222b6f)[_0x3af9('0x18')](_0x1e4ebb);}};}function respondWithFilteredResult(_0x1088fc,_0x37cb8b){return function(_0x4b2845){if(_0x4b2845){var _0x278e80=typeof _0x37cb8b[_0x3af9('0x19')]===_0x3af9('0x1a')&&typeof _0x37cb8b[_0x3af9('0x1b')]==='undefined';var _0x1d3410=_0x4b2845[_0x3af9('0x1c')];var _0x298135=_0x278e80?0x0:_0x37cb8b[_0x3af9('0x19')];var _0x314df2=_0x278e80?_0x4b2845['count']:_0x37cb8b[_0x3af9('0x19')]+_0x37cb8b[_0x3af9('0x1b')];var _0x1f9214;if(_0x314df2>=_0x1d3410){_0x314df2=_0x1d3410;_0x1f9214=0xc8;}else{_0x1f9214=0xce;}_0x1088fc[_0x3af9('0x17')](_0x1f9214);return _0x1088fc[_0x3af9('0x1d')]('Content-Range',_0x298135+'-'+_0x314df2+'/'+_0x1d3410)[_0x3af9('0x18')](_0x4b2845);}return null;};}function patchUpdates(_0x34eb91){return function(_0x449349){try{jsonpatch[_0x3af9('0x1e')](_0x449349,_0x34eb91,!![]);}catch(_0x3c1793){return BPromise[_0x3af9('0x1f')](_0x3c1793);}return _0x449349['save']();};}function saveUpdates(_0x4a88ea,_0x505e25){return function(_0x5e24e3){if(_0x5e24e3){return _0x5e24e3['update'](_0x4a88ea)[_0x3af9('0x20')](function(_0x5c1c8f){return _0x5c1c8f;});}return null;};}function removeEntity(_0x74c872,_0x307f9d){return function(_0x4b5a5c){if(_0x4b5a5c){return _0x4b5a5c['destroy']()['then'](function(){var _0x119e85=_0x4b5a5c[_0x3af9('0x21')]({'plain':!![]});var _0x22965b=_0x3af9('0x22');return db[_0x3af9('0x23')][_0x3af9('0x24')]({'where':{'type':_0x22965b,'resourceId':_0x119e85['id']}})[_0x3af9('0x20')](function(){return _0x4b5a5c;});})[_0x3af9('0x20')](function(){_0x74c872['status'](0xcc)[_0x3af9('0x25')]();});}};}function handleEntityNotFound(_0x574b71,_0x485754){return function(_0x177650){if(!_0x177650){_0x574b71[_0x3af9('0x26')](0x194);}return _0x177650;};}function handleError(_0x19643f,_0xf8840){_0xf8840=_0xf8840||0x1f4;return function(_0x374382){logger['error'](_0x374382[_0x3af9('0x27')]);if(_0x374382[_0x3af9('0x28')]){delete _0x374382[_0x3af9('0x28')];}_0x19643f['status'](_0xf8840)['send'](_0x374382);};}exports[_0x3af9('0x29')]=function(_0x1d022d,_0x8867c6){var _0x540969={},_0x4186d5={},_0x115673={'count':0x0,'rows':[]};var _0x1c923d=_['map'](db[_0x3af9('0x2a')][_0x3af9('0x2b')],function(_0x407572){return{'name':_0x407572['fieldName'],'type':_0x407572[_0x3af9('0x2c')][_0x3af9('0x2d')]};});_0x4186d5[_0x3af9('0x2e')]=_['map'](_0x1c923d,_0x3af9('0x28'));_0x4186d5[_0x3af9('0x2f')]=_['keys'](_0x1d022d[_0x3af9('0x2f')]);_0x4186d5['filters']=_[_0x3af9('0x30')](_0x4186d5['model'],_0x4186d5['query']);_0x540969[_0x3af9('0x31')]=_['intersection'](_0x4186d5[_0x3af9('0x2e')],qs[_0x3af9('0x32')](_0x1d022d[_0x3af9('0x2f')]['fields']));_0x540969['attributes']=_0x540969[_0x3af9('0x31')][_0x3af9('0x33')]?_0x540969['attributes']:_0x4186d5['model'];if(!_0x1d022d[_0x3af9('0x2f')]['hasOwnProperty'](_0x3af9('0x34'))){_0x540969[_0x3af9('0x1b')]=qs['limit'](_0x1d022d['query'][_0x3af9('0x1b')]);_0x540969[_0x3af9('0x19')]=qs[_0x3af9('0x19')](_0x1d022d[_0x3af9('0x2f')][_0x3af9('0x19')]);}_0x540969['order']=qs['sort'](_0x1d022d[_0x3af9('0x2f')][_0x3af9('0x35')]);_0x540969[_0x3af9('0x36')]=qs[_0x3af9('0x37')](_['pick'](_0x1d022d['query'],_0x4186d5[_0x3af9('0x37')]),_0x1c923d);if(_0x1d022d[_0x3af9('0x2f')][_0x3af9('0x38')]){_0x540969['where']=_[_0x3af9('0x39')](_0x540969[_0x3af9('0x36')],{'$or':_[_0x3af9('0x3a')](_0x1c923d,function(_0x576c86){if(_0x576c86[_0x3af9('0x2c')]!=='VIRTUAL'){var _0x1f3ac9={};_0x1f3ac9[_0x576c86[_0x3af9('0x28')]]={'$like':'%'+_0x1d022d[_0x3af9('0x2f')][_0x3af9('0x38')]+'%'};return _0x1f3ac9;}})});}_0x540969=_[_0x3af9('0x39')]({},_0x540969,_0x1d022d[_0x3af9('0x3b')]);var _0x43fd62={'where':_0x540969[_0x3af9('0x36')]};return db[_0x3af9('0x2a')][_0x3af9('0x1c')](_0x43fd62)[_0x3af9('0x20')](function(_0x4d7bd4){_0x115673[_0x3af9('0x1c')]=_0x4d7bd4;if(_0x1d022d[_0x3af9('0x2f')][_0x3af9('0x3c')]){_0x540969[_0x3af9('0x3d')]=[{'all':!![]}];}return db[_0x3af9('0x2a')][_0x3af9('0x3e')](_0x540969);})[_0x3af9('0x20')](function(_0x384a61){_0x115673[_0x3af9('0x3f')]=_0x384a61;return _0x115673;})[_0x3af9('0x20')](respondWithFilteredResult(_0x8867c6,_0x540969))[_0x3af9('0x40')](handleError(_0x8867c6,null));};exports[_0x3af9('0x41')]=function(_0x549274,_0x542580){var _0x461dd6={'raw':!![],'where':{'id':_0x549274[_0x3af9('0x42')]['id']}},_0x1daea4={};_0x1daea4[_0x3af9('0x2e')]=_[_0x3af9('0x43')](db[_0x3af9('0x2a')][_0x3af9('0x2b')]);_0x1daea4[_0x3af9('0x2f')]=_[_0x3af9('0x43')](_0x549274[_0x3af9('0x2f')]);_0x1daea4[_0x3af9('0x37')]=_[_0x3af9('0x30')](_0x1daea4[_0x3af9('0x2e')],_0x1daea4['query']);_0x461dd6[_0x3af9('0x31')]=_[_0x3af9('0x30')](_0x1daea4[_0x3af9('0x2e')],qs[_0x3af9('0x32')](_0x549274['query']['fields']));_0x461dd6[_0x3af9('0x31')]=_0x461dd6['attributes'][_0x3af9('0x33')]?_0x461dd6[_0x3af9('0x31')]:_0x1daea4[_0x3af9('0x2e')];if(_0x549274[_0x3af9('0x2f')]['includeAll']){_0x461dd6[_0x3af9('0x3d')]=[{'all':!![]}];}_0x461dd6=_[_0x3af9('0x39')]({},_0x461dd6,_0x549274[_0x3af9('0x3b')]);return db['Tag']['find'](_0x461dd6)[_0x3af9('0x20')](handleEntityNotFound(_0x542580,null))['then'](respondWithResult(_0x542580,null))['catch'](handleError(_0x542580,null));};exports['create']=function(_0x19bd47,_0x3bc784){return db[_0x3af9('0x2a')][_0x3af9('0x44')](_0x19bd47[_0x3af9('0x45')],{})[_0x3af9('0x20')](function(_0x442681){var _0x48377b=_0x19bd47[_0x3af9('0x46')][_0x3af9('0x21')]({'plain':!![]});if(!_0x48377b)throw new Error(_0x3af9('0x47'));if(_0x48377b[_0x3af9('0x48')]===_0x3af9('0x46')){var _0x1104d4=_0x442681['get']({'plain':!![]});var _0x1b4509=_0x3af9('0x22');return db[_0x3af9('0x49')][_0x3af9('0x4a')]({'where':{'name':_0x1b4509,'userProfileId':_0x48377b['userProfileId']},'raw':!![]})[_0x3af9('0x20')](function(_0x39d954){if(_0x39d954&&_0x39d954[_0x3af9('0x4b')]===0x0){return db[_0x3af9('0x23')]['create']({'name':_0x1104d4[_0x3af9('0x28')],'resourceId':_0x1104d4['id'],'type':_0x39d954[_0x3af9('0x28')],'sectionId':_0x39d954['id']},{})[_0x3af9('0x20')](function(){return _0x442681;});}else{return _0x442681;}})[_0x3af9('0x40')](function(_0x4c75b6){logger['error'](_0x3af9('0x4c'),_0x4c75b6);throw _0x4c75b6;});}return _0x442681;})[_0x3af9('0x20')](respondWithResult(_0x3bc784,0xc9))[_0x3af9('0x40')](handleError(_0x3bc784,null));};exports[_0x3af9('0x4d')]=function(_0x3f087a,_0x268820){if(_0x3f087a[_0x3af9('0x45')]['id']){delete _0x3f087a[_0x3af9('0x45')]['id'];}return db[_0x3af9('0x2a')][_0x3af9('0x4a')]({'where':{'id':_0x3f087a[_0x3af9('0x42')]['id']}})['then'](handleEntityNotFound(_0x268820,null))[_0x3af9('0x20')](saveUpdates(_0x3f087a[_0x3af9('0x45')],null))['then'](respondWithResult(_0x268820,null))['catch'](handleError(_0x268820,null));};exports[_0x3af9('0x24')]=function(_0x4b205f,_0x27f717){return db[_0x3af9('0x2a')]['find']({'where':{'id':_0x4b205f['params']['id']}})[_0x3af9('0x20')](handleEntityNotFound(_0x27f717,null))[_0x3af9('0x20')](removeEntity(_0x27f717,null))[_0x3af9('0x40')](handleError(_0x27f717,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index b5412a6..d8b455a 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 _0x1ad5=['api','moment','request-promise','../../config/environment','./tag.attributes','exports','define','Tag','tools_tags','lodash','util'];(function(_0x2a4c80,_0x3280b9){var _0x3b781d=function(_0x55bc55){while(--_0x55bc55){_0x2a4c80['push'](_0x2a4c80['shift']());}};_0x3b781d(++_0x3280b9);}(_0x1ad5,0x153));var _0x51ad=function(_0x34a8c8,_0x31e259){_0x34a8c8=_0x34a8c8-0x0;var _0x1fe6e5=_0x1ad5[_0x34a8c8];return _0x1fe6e5;};'use strict';var _=require(_0x51ad('0x0'));var util=require(_0x51ad('0x1'));var logger=require('../../config/logger')(_0x51ad('0x2'));var moment=require(_0x51ad('0x3'));var BPromise=require('bluebird');var rp=require(_0x51ad('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x51ad('0x5'));var attributes=require(_0x51ad('0x6'));module[_0x51ad('0x7')]=function(_0x3018bf,_0x2f44bb){return _0x3018bf[_0x51ad('0x8')](_0x51ad('0x9'),attributes,{'tableName':_0x51ad('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x22f6=['rimraf','../../config/environment','./tag.attributes','exports','Tag','tools_tags','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x4dc257,_0x479941){var _0x3dbfbe=function(_0x377994){while(--_0x377994){_0x4dc257['push'](_0x4dc257['shift']());}};_0x3dbfbe(++_0x479941);}(_0x22f6,0x10e));var _0x622f=function(_0x3de5e8,_0x323e91){_0x3de5e8=_0x3de5e8-0x0;var _0x5e7818=_0x22f6[_0x3de5e8];return _0x5e7818;};'use strict';var _=require(_0x622f('0x0'));var util=require('util');var logger=require(_0x622f('0x1'))('api');var moment=require(_0x622f('0x2'));var BPromise=require(_0x622f('0x3'));var rp=require(_0x622f('0x4'));var fs=require('fs');var path=require(_0x622f('0x5'));var rimraf=require(_0x622f('0x6'));var config=require(_0x622f('0x7'));var attributes=require(_0x622f('0x8'));module[_0x622f('0x9')]=function(_0x659c64,_0x342d96){return _0x659c64['define'](_0x622f('0xa'),attributes,{'tableName':_0x622f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index 3252757..dfdba07 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 _0xe5b3=['request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Tag,\x20%s,\x20%s'];(function(_0x1ed99c,_0x52bb43){var _0x19c308=function(_0x57fe15){while(--_0x57fe15){_0x1ed99c['push'](_0x1ed99c['shift']());}};_0x19c308(++_0x52bb43);}(_0xe5b3,0x133));var _0x3e5b=function(_0x5d6d5d,_0xa53edd){_0x5d6d5d=_0x5d6d5d-0x0;var _0x9713d4=_0xe5b3[_0x5d6d5d];return _0x9713d4;};'use strict';var _=require('lodash');var util=require(_0x3e5b('0x0'));var moment=require(_0x3e5b('0x1'));var BPromise=require(_0x3e5b('0x2'));var rs=require(_0x3e5b('0x3'));var fs=require('fs');var Redis=require(_0x3e5b('0x4'));var db=require(_0x3e5b('0x5'))['db'];var utils=require(_0x3e5b('0x6'));var logger=require(_0x3e5b('0x7'))(_0x3e5b('0x8'));var config=require(_0x3e5b('0x9'));var jayson=require(_0x3e5b('0xa'));var client=jayson['client'][_0x3e5b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5dcf55,_0x534e7d,_0x41d46f){return new BPromise(function(_0x3901c2,_0x3c7c2e){return client[_0x3e5b('0xc')](_0x5dcf55,_0x41d46f)['then'](function(_0x4ed6bc){logger[_0x3e5b('0xd')](_0x3e5b('0xe'),_0x534e7d,_0x3e5b('0xf'));logger[_0x3e5b('0x10')](_0x3e5b('0x11'),_0x534e7d,'request\x20sent',JSON[_0x3e5b('0x12')](_0x4ed6bc));if(_0x4ed6bc['error']){if(_0x4ed6bc[_0x3e5b('0x13')][_0x3e5b('0x14')]===0x1f4){logger[_0x3e5b('0x13')](_0x3e5b('0xe'),_0x534e7d,_0x4ed6bc[_0x3e5b('0x13')][_0x3e5b('0x15')]);return _0x3c7c2e(_0x4ed6bc[_0x3e5b('0x13')]['message']);}logger[_0x3e5b('0x13')]('Tag,\x20%s,\x20%s',_0x534e7d,_0x4ed6bc['error']['message']);return _0x3901c2(_0x4ed6bc[_0x3e5b('0x13')][_0x3e5b('0x15')]);}else{logger[_0x3e5b('0xd')]('Tag,\x20%s,\x20%s',_0x534e7d,_0x3e5b('0xf'));_0x3901c2(_0x4ed6bc['result']['message']);}})[_0x3e5b('0x16')](function(_0x11b41b){logger['error'](_0x3e5b('0xe'),_0x534e7d,_0x11b41b);_0x3c7c2e(_0x11b41b);});});} \ No newline at end of file +var _0x0a9a=['Tag,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x139eb2,_0x3d7e18){var _0x2a5657=function(_0x3f0a33){while(--_0x3f0a33){_0x139eb2['push'](_0x139eb2['shift']());}};_0x2a5657(++_0x3d7e18);}(_0x0a9a,0x183));var _0xa0a9=function(_0x4852c3,_0x78a681){_0x4852c3=_0x4852c3-0x0;var _0x4055ca=_0x0a9a[_0x4852c3];return _0x4055ca;};'use strict';var _=require('lodash');var util=require(_0xa0a9('0x0'));var moment=require('moment');var BPromise=require(_0xa0a9('0x1'));var rs=require(_0xa0a9('0x2'));var fs=require('fs');var Redis=require(_0xa0a9('0x3'));var db=require(_0xa0a9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa0a9('0x5'))(_0xa0a9('0x6'));var config=require('../../config/environment');var jayson=require(_0xa0a9('0x7'));var client=jayson[_0xa0a9('0x8')][_0xa0a9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31d689,_0x499a29,_0x2b2eb4){return new BPromise(function(_0x520f42,_0x10aa8a){return client[_0xa0a9('0xa')](_0x31d689,_0x2b2eb4)[_0xa0a9('0xb')](function(_0x2d6ac0){logger['info'](_0xa0a9('0xc'),_0x499a29,_0xa0a9('0xd'));logger['debug']('Tag,\x20%s,\x20%s,\x20%s',_0x499a29,_0xa0a9('0xd'),JSON[_0xa0a9('0xe')](_0x2d6ac0));if(_0x2d6ac0['error']){if(_0x2d6ac0[_0xa0a9('0xf')]['code']===0x1f4){logger[_0xa0a9('0xf')]('Tag,\x20%s,\x20%s',_0x499a29,_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);return _0x10aa8a(_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);}logger[_0xa0a9('0xf')]('Tag,\x20%s,\x20%s',_0x499a29,_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);return _0x520f42(_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);}else{logger[_0xa0a9('0x11')](_0xa0a9('0xc'),_0x499a29,'request\x20sent');_0x520f42(_0x2d6ac0[_0xa0a9('0x12')]['message']);}})['catch'](function(_0x347092){logger[_0xa0a9('0xf')](_0xa0a9('0xc'),_0x499a29,_0x347092);_0x10aa8a(_0x347092);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 6e03869..59cb595 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(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index 063fd46..628a0e2 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['name','exports','STRING'];(function(_0x137e98,_0x3559c5){var _0x1003aa=function(_0x22f21f){while(--_0x22f21f){_0x137e98['push'](_0x137e98['shift']());}};_0x1003aa(++_0x3559c5);}(_0x2032,0xd9));var _0x2203=function(_0xacccf8,_0xd76883){_0xacccf8=_0xacccf8-0x0;var _0x148757=_0x2032[_0xacccf8];return _0x148757;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb7e7=['STRING','sequelize'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0xb7e7,0x121));var _0x7b7e=function(_0x2f1762,_0xab43df){_0x2f1762=_0x2f1762-0x0;var _0x8ab21=_0xb7e7[_0x2f1762];return _0x8ab21;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 37af8b5..8ea4fa4 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 _0x78e1=['update','then','destroy','get','Teams','UserProfileResource','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','hasOwnProperty','order','sort','filters','filter','where','merge','VIRTUAL','options','Team','includeAll','findAll','rows','show','params','fields','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','length','pick','Queues','addQueues','Sequelize','add','ids','remove','addAgents','Voice','Sms','Openchannel','Whatsapp','through','penalty','QueueId','defaults','TeamVoiceQueue','User','findOrCreate','emit','Queue:save','online','voicePause','interface','UserVoiceQueueRt','upsert','format','SIP/%s','all','parse','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','removeAgents','Chat','transaction','getAgents','nolimit','rimraf','zip-dir','fast-json-patch','request-promise','mustache','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save'];(function(_0x393912,_0x5cc16e){var _0x4ae8cd=function(_0x373e01){while(--_0x373e01){_0x393912['push'](_0x393912['shift']());}};_0x4ae8cd(++_0x5cc16e);}(_0x78e1,0xda));var _0x178e=function(_0x355cb9,_0x554e90){_0x355cb9=_0x355cb9-0x0;var _0x4a5c8a=_0x78e1[_0x355cb9];return _0x4a5c8a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x178e('0x0'));var zipdir=require(_0x178e('0x1'));var jsonpatch=require(_0x178e('0x2'));var rp=require(_0x178e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x178e('0x4'));var util=require('util');var path=require('path');var sox=require(_0x178e('0x5'));var csv=require(_0x178e('0x6'));var ejs=require(_0x178e('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x178e('0x8'));var squel=require(_0x178e('0x9'));var crypto=require('crypto');var jsforce=require(_0x178e('0xa'));var deskjs=require(_0x178e('0xb'));var toCsv=require(_0x178e('0x6'));var querystring=require('querystring');var Papa=require(_0x178e('0xc'));var Redis=require('ioredis');var authService=require(_0x178e('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x178e('0xe'));var hardwareService=require(_0x178e('0xf'));var logger=require(_0x178e('0x10'))(_0x178e('0x11'));var utils=require(_0x178e('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x178e('0x13'));var db=require(_0x178e('0x14'))['db'];config['redis']=_['defaults'](config[_0x178e('0x15')],{'host':_0x178e('0x16'),'port':0x18eb});var socket=require(_0x178e('0x17'))(new Redis(config[_0x178e('0x15')]));require('./team.socket')['register'](socket);function respondWithStatusCode(_0x517bcc,_0x39b2e6){_0x39b2e6=_0x39b2e6||0xcc;return function(_0x5609e6){if(_0x5609e6){return _0x517bcc[_0x178e('0x18')](_0x39b2e6);}return _0x517bcc[_0x178e('0x19')](_0x39b2e6)[_0x178e('0x1a')]();};}function respondWithResult(_0x399337,_0x14f164){_0x14f164=_0x14f164||0xc8;return function(_0xa233d0){if(_0xa233d0){return _0x399337['status'](_0x14f164)[_0x178e('0x1b')](_0xa233d0);}};}function respondWithFilteredResult(_0x27f0ab,_0x494a58){return function(_0x3c4bef){if(_0x3c4bef){var _0x16f443=typeof _0x494a58[_0x178e('0x1c')]===_0x178e('0x1d')&&typeof _0x494a58[_0x178e('0x1e')]===_0x178e('0x1d');var _0x1dd7d6=_0x3c4bef[_0x178e('0x1f')];var _0x2603b5=_0x16f443?0x0:_0x494a58[_0x178e('0x1c')];var _0x1d40cf=_0x16f443?_0x3c4bef[_0x178e('0x1f')]:_0x494a58[_0x178e('0x1c')]+_0x494a58['limit'];var _0x5cb57f;if(_0x1d40cf>=_0x1dd7d6){_0x1d40cf=_0x1dd7d6;_0x5cb57f=0xc8;}else{_0x5cb57f=0xce;}_0x27f0ab[_0x178e('0x19')](_0x5cb57f);return _0x27f0ab[_0x178e('0x20')](_0x178e('0x21'),_0x2603b5+'-'+_0x1d40cf+'/'+_0x1dd7d6)[_0x178e('0x1b')](_0x3c4bef);}return null;};}function patchUpdates(_0x5bb699){return function(_0x412324){try{jsonpatch['apply'](_0x412324,_0x5bb699,!![]);}catch(_0x1d5cd1){return BPromise[_0x178e('0x22')](_0x1d5cd1);}return _0x412324[_0x178e('0x23')]();};}function saveUpdates(_0x58bf23,_0x88bc21){return function(_0x56c4c3){if(_0x56c4c3){return _0x56c4c3[_0x178e('0x24')](_0x58bf23)[_0x178e('0x25')](function(_0x289d5e){return _0x289d5e;});}return null;};}function removeEntity(_0x148177,_0x45a387){return function(_0x290c1d){if(_0x290c1d){return _0x290c1d[_0x178e('0x26')]()[_0x178e('0x25')](function(){var _0x2670ab=_0x290c1d[_0x178e('0x27')]({'plain':!![]});var _0x1baa27=_0x178e('0x28');return db[_0x178e('0x29')][_0x178e('0x26')]({'where':{'type':_0x1baa27,'resourceId':_0x2670ab['id']}})[_0x178e('0x25')](function(){return _0x290c1d;});})[_0x178e('0x25')](function(){_0x148177[_0x178e('0x19')](0xcc)[_0x178e('0x1a')]();});}};}function handleEntityNotFound(_0x1305bc,_0x4e2004){return function(_0x3f38ce){if(!_0x3f38ce){_0x1305bc[_0x178e('0x18')](0x194);}return _0x3f38ce;};}function handleError(_0x3f2c06,_0x23d27c){_0x23d27c=_0x23d27c||0x1f4;return function(_0x43ef84){logger['error'](_0x43ef84[_0x178e('0x2a')]);if(_0x43ef84['name']){delete _0x43ef84[_0x178e('0x2b')];}_0x3f2c06[_0x178e('0x19')](_0x23d27c)[_0x178e('0x2c')](_0x43ef84);};}exports['index']=function(_0x2098ae,_0x56d22e){var _0x41f6aa={},_0x4b2c9c={},_0x2797dd={'count':0x0,'rows':[]};var _0x152011=_[_0x178e('0x2d')](db['Team'][_0x178e('0x2e')],function(_0x5575cc){return{'name':_0x5575cc[_0x178e('0x2f')],'type':_0x5575cc[_0x178e('0x30')][_0x178e('0x31')]};});_0x4b2c9c[_0x178e('0x32')]=_[_0x178e('0x2d')](_0x152011,'name');_0x4b2c9c[_0x178e('0x33')]=_[_0x178e('0x34')](_0x2098ae[_0x178e('0x33')]);_0x4b2c9c['filters']=_[_0x178e('0x35')](_0x4b2c9c[_0x178e('0x32')],_0x4b2c9c[_0x178e('0x33')]);_0x41f6aa[_0x178e('0x36')]=_['intersection'](_0x4b2c9c['model'],qs['fields'](_0x2098ae[_0x178e('0x33')]['fields']));_0x41f6aa[_0x178e('0x36')]=_0x41f6aa[_0x178e('0x36')]['length']?_0x41f6aa[_0x178e('0x36')]:_0x4b2c9c['model'];if(!_0x2098ae['query'][_0x178e('0x37')]('nolimit')){_0x41f6aa[_0x178e('0x1e')]=qs[_0x178e('0x1e')](_0x2098ae[_0x178e('0x33')][_0x178e('0x1e')]);_0x41f6aa[_0x178e('0x1c')]=qs[_0x178e('0x1c')](_0x2098ae['query'][_0x178e('0x1c')]);}_0x41f6aa[_0x178e('0x38')]=qs['sort'](_0x2098ae[_0x178e('0x33')][_0x178e('0x39')]);_0x41f6aa['where']=qs['filters'](_['pick'](_0x2098ae[_0x178e('0x33')],_0x4b2c9c[_0x178e('0x3a')]),_0x152011);if(_0x2098ae['query'][_0x178e('0x3b')]){_0x41f6aa[_0x178e('0x3c')]=_[_0x178e('0x3d')](_0x41f6aa[_0x178e('0x3c')],{'$or':_['map'](_0x152011,function(_0x36f6d0){if(_0x36f6d0[_0x178e('0x30')]!==_0x178e('0x3e')){var _0x8119f9={};_0x8119f9[_0x36f6d0[_0x178e('0x2b')]]={'$like':'%'+_0x2098ae[_0x178e('0x33')][_0x178e('0x3b')]+'%'};return _0x8119f9;}})});}_0x41f6aa=_['merge']({},_0x41f6aa,_0x2098ae[_0x178e('0x3f')]);var _0x581fba={'where':_0x41f6aa[_0x178e('0x3c')]};return db[_0x178e('0x40')]['count'](_0x581fba)[_0x178e('0x25')](function(_0x4c8659){_0x2797dd[_0x178e('0x1f')]=_0x4c8659;if(_0x2098ae['query'][_0x178e('0x41')]){_0x41f6aa['include']=[{'all':!![]}];}return db[_0x178e('0x40')][_0x178e('0x42')](_0x41f6aa);})['then'](function(_0x445f39){_0x2797dd[_0x178e('0x43')]=_0x445f39;return _0x2797dd;})[_0x178e('0x25')](respondWithFilteredResult(_0x56d22e,_0x41f6aa))['catch'](handleError(_0x56d22e,null));};exports[_0x178e('0x44')]=function(_0x5022d3,_0x14116a){var _0x7845ac={'raw':![],'where':{'id':_0x5022d3[_0x178e('0x45')]['id']}},_0x3e9704={};_0x3e9704[_0x178e('0x32')]=_['keys'](db['Team'][_0x178e('0x2e')]);_0x3e9704[_0x178e('0x33')]=_[_0x178e('0x34')](_0x5022d3['query']);_0x3e9704[_0x178e('0x3a')]=_['intersection'](_0x3e9704[_0x178e('0x32')],_0x3e9704[_0x178e('0x33')]);_0x7845ac[_0x178e('0x36')]=_[_0x178e('0x35')](_0x3e9704[_0x178e('0x32')],qs[_0x178e('0x46')](_0x5022d3[_0x178e('0x33')][_0x178e('0x46')]));_0x7845ac[_0x178e('0x36')]=_0x7845ac[_0x178e('0x36')]['length']?_0x7845ac[_0x178e('0x36')]:_0x3e9704[_0x178e('0x32')];if(_0x5022d3[_0x178e('0x33')][_0x178e('0x41')]){_0x7845ac[_0x178e('0x47')]=[{'all':!![]}];}_0x7845ac=_[_0x178e('0x3d')]({},_0x7845ac,_0x5022d3[_0x178e('0x3f')]);return db[_0x178e('0x40')][_0x178e('0x48')](_0x7845ac)[_0x178e('0x25')](handleEntityNotFound(_0x14116a,null))[_0x178e('0x25')](respondWithResult(_0x14116a,null))[_0x178e('0x49')](handleError(_0x14116a,null));};exports[_0x178e('0x4a')]=function(_0x3b8496,_0x4b8f4b){return db[_0x178e('0x40')][_0x178e('0x4a')](_0x3b8496[_0x178e('0x4b')],{})[_0x178e('0x25')](function(_0x29876a){var _0x73c04c=_0x3b8496[_0x178e('0x4c')]['get']({'plain':!![]});if(!_0x73c04c)throw new Error(_0x178e('0x4d'));if(_0x73c04c['role']==='user'){var _0x4ab3c6=_0x29876a[_0x178e('0x27')]({'plain':!![]});var _0x5b0562='Teams';return db[_0x178e('0x4e')]['find']({'where':{'name':_0x5b0562,'userProfileId':_0x73c04c[_0x178e('0x4f')]},'raw':!![]})['then'](function(_0x42014b){if(_0x42014b&&_0x42014b['autoAssociation']===0x0){return db[_0x178e('0x29')][_0x178e('0x4a')]({'name':_0x4ab3c6[_0x178e('0x2b')],'resourceId':_0x4ab3c6['id'],'type':_0x42014b['name'],'sectionId':_0x42014b['id']},{})['then'](function(){return _0x29876a;});}else{return _0x29876a;}})[_0x178e('0x49')](function(_0xf1aa18){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xf1aa18);throw _0xf1aa18;});}return _0x29876a;})[_0x178e('0x25')](respondWithResult(_0x4b8f4b,0xc9))[_0x178e('0x49')](handleError(_0x4b8f4b,null));};exports[_0x178e('0x24')]=function(_0x45aa31,_0x2fa802){if(_0x45aa31[_0x178e('0x4b')]['id']){delete _0x45aa31[_0x178e('0x4b')]['id'];}return db[_0x178e('0x40')]['find']({'where':{'id':_0x45aa31[_0x178e('0x45')]['id']}})[_0x178e('0x25')](handleEntityNotFound(_0x2fa802,null))['then'](saveUpdates(_0x45aa31[_0x178e('0x4b')],null))[_0x178e('0x25')](respondWithResult(_0x2fa802,null))[_0x178e('0x49')](handleError(_0x2fa802,null));};exports[_0x178e('0x26')]=function(_0x6d6654,_0x34b213){return db[_0x178e('0x40')][_0x178e('0x48')]({'where':{'id':_0x6d6654['params']['id']}})[_0x178e('0x25')](handleEntityNotFound(_0x34b213,null))[_0x178e('0x25')](removeEntity(_0x34b213,null))[_0x178e('0x49')](handleError(_0x34b213,null));};exports['getQueues']=function(_0x2ce318,_0x2ce66f,_0x579731){return db['Team'][_0x178e('0x50')]({'where':{'id':_0x2ce318[_0x178e('0x45')]['id']}})[_0x178e('0x25')](handleEntityNotFound(_0x2ce66f,null))[_0x178e('0x25')](function(_0x2163cc){if(!_0x2ce318[_0x178e('0x33')][_0x178e('0x51')]||!utils[_0x178e('0x52')](_0x2ce318[_0x178e('0x33')]['channel'])){throw new db['Sequelize'][(_0x178e('0x53'))](_0x178e('0x54'));}var _0x25a0a9={};var _0x2879dc={};_0x2879dc[_0x178e('0x32')]=_[_0x178e('0x34')](db[_[_0x178e('0x55')](_0x2ce318[_0x178e('0x33')][_0x178e('0x51')][_0x178e('0x56')]())+_0x178e('0x57')][_0x178e('0x2e')]);_0x2879dc[_0x178e('0x33')]=_[_0x178e('0x34')](_0x2ce318[_0x178e('0x33')]);_0x2879dc[_0x178e('0x3a')]=_[_0x178e('0x35')](_0x2879dc[_0x178e('0x32')],_0x2879dc[_0x178e('0x33')]);_0x25a0a9[_0x178e('0x36')]=_[_0x178e('0x35')](_0x2879dc[_0x178e('0x32')],qs[_0x178e('0x46')](_0x2ce318[_0x178e('0x33')]['fields']));_0x25a0a9['attributes']=_0x25a0a9['attributes'][_0x178e('0x58')]?_0x25a0a9[_0x178e('0x36')]:_0x2879dc['model'];_0x25a0a9[_0x178e('0x1e')]=qs[_0x178e('0x1e')](_0x2ce318[_0x178e('0x33')]['limit']);_0x25a0a9[_0x178e('0x1c')]=qs[_0x178e('0x1c')](_0x2ce318[_0x178e('0x33')][_0x178e('0x1c')]);_0x25a0a9[_0x178e('0x38')]=qs[_0x178e('0x39')](_0x2ce318[_0x178e('0x33')]['sort']);_0x25a0a9[_0x178e('0x3c')]=qs[_0x178e('0x3a')](_[_0x178e('0x59')](_0x2ce318[_0x178e('0x33')],_0x2879dc['filters']));_0x25a0a9=_[_0x178e('0x3d')]({},_0x25a0a9,_0x2ce318[_0x178e('0x3f')]);return _0x2163cc[_0x178e('0x27')+_[_0x178e('0x55')](_0x2ce318[_0x178e('0x33')][_0x178e('0x51')][_0x178e('0x56')]())+_0x178e('0x5a')](_0x25a0a9);})[_0x178e('0x25')](respondWithResult(_0x2ce66f,null))[_0x178e('0x49')](handleError(_0x2ce66f,null));};exports[_0x178e('0x5b')]=function(_0x295a21,_0x23e3f2,_0x5d5726){return db[_0x178e('0x40')][_0x178e('0x50')]({'where':{'id':_0x295a21[_0x178e('0x45')]['id']}})[_0x178e('0x25')](function(_0x322737){if(_0x322737){if(!_0x295a21['body'][_0x178e('0x51')]||!utils['isValidChannel'](_0x295a21['body'][_0x178e('0x51')])){throw new db[(_0x178e('0x5c'))][(_0x178e('0x53'))](_0x178e('0x54'));}return _0x322737[_0x178e('0x5d')+_[_0x178e('0x55')](_0x295a21[_0x178e('0x4b')][_0x178e('0x51')]['toLowerCase']())+_0x178e('0x5a')](_0x295a21[_0x178e('0x4b')][_0x178e('0x5e')]);}return null;})[_0x178e('0x25')](handleEntityNotFound(_0x23e3f2,null))['then'](respondWithStatusCode(_0x23e3f2,null))['catch'](handleError(_0x23e3f2,null));};exports['removeQueues']=function(_0xc7a83e,_0x2ad7b4,_0x44f0fb){return db['Team']['findOne']({'where':{'id':_0xc7a83e['params']['id']}})['then'](function(_0x5d9f27){if(_0x5d9f27){if(!_0xc7a83e[_0x178e('0x33')][_0x178e('0x51')]||!utils[_0x178e('0x52')](_0xc7a83e[_0x178e('0x33')][_0x178e('0x51')])){throw new db[(_0x178e('0x5c'))][(_0x178e('0x53'))](_0x178e('0x54'));}return _0x5d9f27[_0x178e('0x5f')+_[_0x178e('0x55')](_0xc7a83e[_0x178e('0x33')][_0x178e('0x51')][_0x178e('0x56')]())+_0x178e('0x5a')](_0xc7a83e['query'][_0x178e('0x5e')]);}return null;})['then'](handleEntityNotFound(_0x2ad7b4,null))[_0x178e('0x25')](respondWithStatusCode(_0x2ad7b4,null))[_0x178e('0x49')](handleError(_0x2ad7b4,null));};exports[_0x178e('0x60')]=function(_0x5e1e8f,_0x45461f){return db[_0x178e('0x40')][_0x178e('0x48')]({'where':{'id':_0x5e1e8f['params']['id']}})['then'](handleEntityNotFound(_0x45461f,null))[_0x178e('0x25')](function(_0x2b0108){if(_0x2b0108){var _0x45afb6=[_0x178e('0x61'),'Chat','Mail',_0x178e('0x62'),'Fax',_0x178e('0x63'),_0x178e('0x64')];return db['sequelize']['transaction'](function(_0x29e66b){var _0x43b01b=_[_0x178e('0x2d')](_0x45afb6,function(_0x25d655){var _0x5dfa61={'attributes':['id','name']};if(_0x25d655===_0x178e('0x61')){_0x5dfa61[_0x178e('0x65')]={'attributes':[_0x178e('0x66')]};}return _0x2b0108[_0x178e('0x27')+_0x25d655+'Queues'](_0x5dfa61)[_0x178e('0x25')](function(_0x12c7d4){var _0x4ce7c4=_[_0x178e('0x2d')](_0x12c7d4,function(_0x4ab44e){var _0x4a5d44=_['map'](_0x5e1e8f['body'][_0x178e('0x5e')],function(_0x242a65){var _0x590ea6={'where':{'UserId':_0x242a65,[_0x25d655+_0x178e('0x67')]:_0x4ab44e['id']},'transaction':_0x29e66b};if(_0x25d655==='Voice'){_0x590ea6[_0x178e('0x68')]={'penalty':_0x4ab44e[_0x178e('0x69')][_0x178e('0x66')]};}return db[_0x178e('0x6a')+_0x25d655+_0x178e('0x57')][_0x178e('0x6b')](_0x590ea6)[_0x178e('0x25')](function(){socket[_0x178e('0x6c')]('user'+_0x25d655+_0x178e('0x6d'),{'UserId':_0x242a65,[_0x25d655+'QueueId']:_0x4ab44e['id']});if(_0x25d655!==_0x178e('0x61'))return;return db['User'][_0x178e('0x42')]({'where':{'id':_0x5e1e8f[_0x178e('0x4b')]['ids'],'online':0x1},'attributes':['id',_0x178e('0x2b'),_0x178e('0x6e'),_0x178e('0x6f'),_0x178e('0x70')],'raw':!![]})['then'](function(_0x2a298f){var _0x39e77d=_['map'](_0x2a298f,function(_0x1909cb){return db[_0x178e('0x71')][_0x178e('0x72')]({'membername':_0x1909cb[_0x178e('0x2b')],'UserId':_0x1909cb['id'],'queue_name':_0x4ab44e[_0x178e('0x2b')],'VoiceQueueId':_0x4ab44e['id'],'interface':_['isNil'](_0x1909cb[_0x178e('0x70')])?util[_0x178e('0x73')](_0x178e('0x74'),_0x1909cb[_0x178e('0x2b')]):_0x1909cb[_0x178e('0x70')],'paused':_0x1909cb[_0x178e('0x6f')]||![],'penalty':_0x4ab44e[_0x178e('0x69')]['penalty']},{'transaction':_0x29e66b});});return Promise[_0x178e('0x75')](_0x39e77d);});});});return Promise[_0x178e('0x75')](_0x4a5d44);});return Promise['all'](_0x4ce7c4);})['then'](function(){var _0x5c16d4=JSON[_0x178e('0x76')]('['+_0x5e1e8f[_0x178e('0x4b')][_0x178e('0x5e')]+']');db[_0x178e('0x77')][_0x178e('0x50')]({'where':{'teamId':_0x5e1e8f[_0x178e('0x45')]['id']}})[_0x178e('0x25')](function(_0x1dcead){if(_0x1dcead){for(var _0x570593=0x0;_0x570593<_0x5c16d4[_0x178e('0x58')];_0x570593++){var _0x46b24d=_0x5c16d4[_0x570593];db[_0x178e('0x78')][_0x178e('0x72')]({'UserId':_0x46b24d,'VoicePrefixId':_0x1dcead[_0x178e('0x79')]});}}});});});return Promise[_0x178e('0x75')](_0x43b01b)[_0x178e('0x25')](function(){return _0x2b0108['addAgents'](_0x5e1e8f[_0x178e('0x4b')][_0x178e('0x5e')],{'transaction':_0x29e66b})['spread'](function(_0x31e269){return _0x31e269;});});});}})[_0x178e('0x25')](respondWithResult(_0x45461f,null))[_0x178e('0x49')](handleError(_0x45461f,null));};exports[_0x178e('0x7a')]=function(_0x39d58a,_0x20b96d){return db['Team'][_0x178e('0x48')]({'where':{'id':_0x39d58a[_0x178e('0x45')]['id']}})['then'](handleEntityNotFound(_0x20b96d,null))[_0x178e('0x25')](function(_0x2264b3){if(_0x2264b3){var _0x31706c=[_0x178e('0x61'),_0x178e('0x7b'),'Mail',_0x178e('0x62'),'Fax',_0x178e('0x63'),_0x178e('0x64')];return db['sequelize'][_0x178e('0x7c')](function(_0x51a377){var _0x4f915c=_[_0x178e('0x2d')](_0x31706c,function(_0x3e5f9e){var _0x4302d9={'attributes':['id',_0x178e('0x2b')]};return _0x2264b3[_0x178e('0x27')+_0x3e5f9e+'Queues'](_0x4302d9)[_0x178e('0x25')](function(_0x3d7303){var _0x3d7ead=_['map'](_0x3d7303,function(_0x3e5878){return _0x3e5878[_0x178e('0x7a')](_0x39d58a[_0x178e('0x33')][_0x178e('0x5e')],{'transaction':_0x51a377})['then'](function(){var _0x115e8a=JSON[_0x178e('0x76')]('['+_0x39d58a[_0x178e('0x33')]['ids']+']');var _0x5a4ad5=_[_0x178e('0x2d')](_0x115e8a,function(_0x11deda){socket[_0x178e('0x6c')](_0x178e('0x4c')+_0x3e5f9e+'Queue:remove',{'UserId':Number(_0x11deda),[_0x3e5f9e+_0x178e('0x67')]:_0x3e5878['id']});if(_0x3e5f9e!==_0x178e('0x61'))return;return db[_0x178e('0x71')][_0x178e('0x26')]({'where':{'VoiceQueueId':_0x3e5878['id'],'UserId':_0x11deda},'transaction':_0x51a377});});return Promise[_0x178e('0x75')](_0x5a4ad5);});});return Promise[_0x178e('0x75')](_0x3d7ead);});});return Promise[_0x178e('0x75')](_0x4f915c)['then'](function(){return _0x2264b3[_0x178e('0x7a')](_0x39d58a[_0x178e('0x33')][_0x178e('0x5e')],{'transaction':_0x51a377});})['then'](function(){var _0x5036f4=JSON[_0x178e('0x76')]('['+_0x39d58a['query'][_0x178e('0x5e')]+']');db[_0x178e('0x77')][_0x178e('0x50')]({'where':{'teamId':_0x39d58a[_0x178e('0x45')]['id']}})[_0x178e('0x25')](function(_0x4f24e1){if(_0x4f24e1){for(var _0x42bfc6=0x0;_0x42bfc6<_0x5036f4['length'];_0x42bfc6++){var _0x4f9a0c=_0x5036f4[_0x42bfc6];db[_0x178e('0x78')][_0x178e('0x26')]({'where':{'UserId':_0x4f9a0c,'VoicePrefixId':_0x4f24e1[_0x178e('0x79')]}});}}});});});}})[_0x178e('0x25')](respondWithStatusCode(_0x20b96d,null))[_0x178e('0x49')](handleError(_0x20b96d,null));};exports[_0x178e('0x7d')]=function(_0x5e0e00,_0x2f1ddb,_0x5ba1fc){var _0x9ad38e={};var _0x1a5422={};var _0x27d6de;var _0x2d29e;return db[_0x178e('0x40')][_0x178e('0x50')]({'where':{'id':_0x5e0e00[_0x178e('0x45')]['id']}})[_0x178e('0x25')](handleEntityNotFound(_0x2f1ddb,null))['then'](function(_0x15f1e1){if(_0x15f1e1){_0x27d6de=_0x15f1e1;_0x1a5422[_0x178e('0x32')]=_[_0x178e('0x34')](db['User'][_0x178e('0x2e')]);_0x1a5422[_0x178e('0x33')]=_['keys'](_0x5e0e00[_0x178e('0x33')]);_0x1a5422[_0x178e('0x3a')]=_[_0x178e('0x35')](_0x1a5422['model'],_0x1a5422['query']);_0x9ad38e[_0x178e('0x36')]=_[_0x178e('0x35')](_0x1a5422['model'],qs[_0x178e('0x46')](_0x5e0e00[_0x178e('0x33')]['fields']));_0x9ad38e[_0x178e('0x36')]=_0x9ad38e[_0x178e('0x36')][_0x178e('0x58')]?_0x9ad38e['attributes']:_0x1a5422[_0x178e('0x32')];_0x9ad38e[_0x178e('0x38')]=qs[_0x178e('0x39')](_0x5e0e00['query'][_0x178e('0x39')]);_0x9ad38e[_0x178e('0x3c')]=qs[_0x178e('0x3a')](_[_0x178e('0x59')](_0x5e0e00[_0x178e('0x33')],_0x1a5422[_0x178e('0x3a')]));if(_0x5e0e00['query']['filter']){_0x9ad38e['where']=_[_0x178e('0x3d')](_0x9ad38e[_0x178e('0x3c')],{'$or':_[_0x178e('0x2d')](_0x9ad38e[_0x178e('0x36')],function(_0x26412a){var _0x355752={};_0x355752[_0x26412a]={'$like':'%'+_0x5e0e00[_0x178e('0x33')][_0x178e('0x3b')]+'%'};return _0x355752;})});}_0x9ad38e=_[_0x178e('0x3d')]({},_0x9ad38e,_0x5e0e00[_0x178e('0x3f')]);return _0x27d6de[_0x178e('0x7d')](_0x9ad38e);}})[_0x178e('0x25')](function(_0x3ac64b){if(_0x3ac64b){_0x2d29e=_0x3ac64b[_0x178e('0x58')];if(!_0x5e0e00[_0x178e('0x33')][_0x178e('0x37')](_0x178e('0x7e'))){_0x9ad38e['limit']=qs[_0x178e('0x1e')](_0x5e0e00[_0x178e('0x33')]['limit']);_0x9ad38e[_0x178e('0x1c')]=qs['offset'](_0x5e0e00['query'][_0x178e('0x1c')]);}return _0x27d6de[_0x178e('0x7d')](_0x9ad38e);}})[_0x178e('0x25')](function(_0x5acbcd){if(_0x5acbcd){return _0x5acbcd?{'count':_0x2d29e,'rows':_0x5acbcd}:null;}})[_0x178e('0x25')](respondWithResult(_0x2f1ddb,null))[_0x178e('0x49')](handleError(_0x2f1ddb,null));}; \ No newline at end of file +var _0xccf0=['add','ids','removeQueues','remove','addAgents','Voice','Chat','Sms','Fax','sequelize','transaction','through','QueueId','defaults','User','findOrCreate','emit','Queue:save','voicePause','isNil','interface','format','SIP/%s','TeamVoiceQueue','penalty','all','parse','TeamVoicePrefix','UserVoicePrefix','upsert','VoicePrefixId','spread','removeAgents','Openchannel','Whatsapp','Queue:remove','UserVoiceQueueRt','getAgents','hasOwnProperty','nolimit','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','save','update','then','get','destroy','error','name','send','map','Team','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','order','sort','where','pick','filter','merge','includeAll','include','findAll','catch','show','params','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getQueues','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','Queue','length','toLowerCase','Queues','addQueues','Sequelize'];(function(_0x29face,_0x39ba80){var _0x4567b8=function(_0x3eeb25){while(--_0x3eeb25){_0x29face['push'](_0x29face['shift']());}};_0x4567b8(++_0x39ba80);}(_0xccf0,0xaf));var _0x0ccf=function(_0x807301,_0x3d8e34){_0x807301=_0x807301-0x0;var _0xe68321=_0xccf0[_0x807301];return _0xe68321;};'use strict';var emlformat=require(_0x0ccf('0x0'));var rimraf=require(_0x0ccf('0x1'));var zipdir=require(_0x0ccf('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0ccf('0x3'));var moment=require(_0x0ccf('0x4'));var BPromise=require(_0x0ccf('0x5'));var Mustache=require(_0x0ccf('0x6'));var util=require('util');var path=require('path');var sox=require(_0x0ccf('0x7'));var csv=require('to-csv');var ejs=require(_0x0ccf('0x8'));var fs=require('fs');var fs_extra=require(_0x0ccf('0x9'));var _=require(_0x0ccf('0xa'));var squel=require(_0x0ccf('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0ccf('0xc'));var toCsv=require(_0x0ccf('0xd'));var querystring=require(_0x0ccf('0xe'));var Papa=require(_0x0ccf('0xf'));var Redis=require(_0x0ccf('0x10'));var authService=require(_0x0ccf('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0ccf('0x12'));var hardwareService=require(_0x0ccf('0x13'));var logger=require('../../config/logger')(_0x0ccf('0x14'));var utils=require(_0x0ccf('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0ccf('0x16'))['db'];config[_0x0ccf('0x17')]=_['defaults'](config[_0x0ccf('0x17')],{'host':_0x0ccf('0x18'),'port':0x18eb});var socket=require(_0x0ccf('0x19'))(new Redis(config[_0x0ccf('0x17')]));require(_0x0ccf('0x1a'))[_0x0ccf('0x1b')](socket);function respondWithStatusCode(_0x5a0653,_0x1172a3){_0x1172a3=_0x1172a3||0xcc;return function(_0x2a5843){if(_0x2a5843){return _0x5a0653[_0x0ccf('0x1c')](_0x1172a3);}return _0x5a0653[_0x0ccf('0x1d')](_0x1172a3)[_0x0ccf('0x1e')]();};}function respondWithResult(_0x3ee938,_0xffe81a){_0xffe81a=_0xffe81a||0xc8;return function(_0x146e13){if(_0x146e13){return _0x3ee938['status'](_0xffe81a)[_0x0ccf('0x1f')](_0x146e13);}};}function respondWithFilteredResult(_0x45f35b,_0x37869d){return function(_0x2a1530){if(_0x2a1530){var _0x5f5dc8=typeof _0x37869d['offset']===_0x0ccf('0x20')&&typeof _0x37869d[_0x0ccf('0x21')]==='undefined';var _0x2abcee=_0x2a1530[_0x0ccf('0x22')];var _0xdb559c=_0x5f5dc8?0x0:_0x37869d[_0x0ccf('0x23')];var _0x33cf81=_0x5f5dc8?_0x2a1530[_0x0ccf('0x22')]:_0x37869d[_0x0ccf('0x23')]+_0x37869d[_0x0ccf('0x21')];var _0x260f3f;if(_0x33cf81>=_0x2abcee){_0x33cf81=_0x2abcee;_0x260f3f=0xc8;}else{_0x260f3f=0xce;}_0x45f35b['status'](_0x260f3f);return _0x45f35b[_0x0ccf('0x24')](_0x0ccf('0x25'),_0xdb559c+'-'+_0x33cf81+'/'+_0x2abcee)['json'](_0x2a1530);}return null;};}function patchUpdates(_0x1b929e){return function(_0x2ad807){try{jsonpatch['apply'](_0x2ad807,_0x1b929e,!![]);}catch(_0x42bb7b){return BPromise['reject'](_0x42bb7b);}return _0x2ad807[_0x0ccf('0x26')]();};}function saveUpdates(_0x16168c,_0x454c92){return function(_0x5aacdd){if(_0x5aacdd){return _0x5aacdd[_0x0ccf('0x27')](_0x16168c)['then'](function(_0x5c34b4){return _0x5c34b4;});}return null;};}function removeEntity(_0x2767fe,_0x15611e){return function(_0x5b788d){if(_0x5b788d){return _0x5b788d['destroy']()[_0x0ccf('0x28')](function(){var _0x90cfda=_0x5b788d[_0x0ccf('0x29')]({'plain':!![]});var _0x31d147='Teams';return db['UserProfileResource'][_0x0ccf('0x2a')]({'where':{'type':_0x31d147,'resourceId':_0x90cfda['id']}})[_0x0ccf('0x28')](function(){return _0x5b788d;});})['then'](function(){_0x2767fe[_0x0ccf('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4aadd1,_0x58fc22){return function(_0x21a166){if(!_0x21a166){_0x4aadd1[_0x0ccf('0x1c')](0x194);}return _0x21a166;};}function handleError(_0x265fa5,_0x521cdf){_0x521cdf=_0x521cdf||0x1f4;return function(_0x38e126){logger[_0x0ccf('0x2b')](_0x38e126['stack']);if(_0x38e126[_0x0ccf('0x2c')]){delete _0x38e126[_0x0ccf('0x2c')];}_0x265fa5[_0x0ccf('0x1d')](_0x521cdf)[_0x0ccf('0x2d')](_0x38e126);};}exports['index']=function(_0x4ee5b4,_0xdc2b3b){var _0xb140e2={},_0x381e5b={},_0x1055db={'count':0x0,'rows':[]};var _0x10726f=_[_0x0ccf('0x2e')](db[_0x0ccf('0x2f')][_0x0ccf('0x30')],function(_0x40f5b0){return{'name':_0x40f5b0[_0x0ccf('0x31')],'type':_0x40f5b0[_0x0ccf('0x32')][_0x0ccf('0x33')]};});_0x381e5b[_0x0ccf('0x34')]=_[_0x0ccf('0x2e')](_0x10726f,_0x0ccf('0x2c'));_0x381e5b['query']=_[_0x0ccf('0x35')](_0x4ee5b4[_0x0ccf('0x36')]);_0x381e5b[_0x0ccf('0x37')]=_[_0x0ccf('0x38')](_0x381e5b[_0x0ccf('0x34')],_0x381e5b['query']);_0xb140e2['attributes']=_['intersection'](_0x381e5b['model'],qs['fields'](_0x4ee5b4['query'][_0x0ccf('0x39')]));_0xb140e2[_0x0ccf('0x3a')]=_0xb140e2['attributes']['length']?_0xb140e2['attributes']:_0x381e5b[_0x0ccf('0x34')];if(!_0x4ee5b4[_0x0ccf('0x36')]['hasOwnProperty']('nolimit')){_0xb140e2[_0x0ccf('0x21')]=qs[_0x0ccf('0x21')](_0x4ee5b4[_0x0ccf('0x36')]['limit']);_0xb140e2[_0x0ccf('0x23')]=qs[_0x0ccf('0x23')](_0x4ee5b4[_0x0ccf('0x36')][_0x0ccf('0x23')]);}_0xb140e2[_0x0ccf('0x3b')]=qs[_0x0ccf('0x3c')](_0x4ee5b4[_0x0ccf('0x36')][_0x0ccf('0x3c')]);_0xb140e2[_0x0ccf('0x3d')]=qs[_0x0ccf('0x37')](_[_0x0ccf('0x3e')](_0x4ee5b4[_0x0ccf('0x36')],_0x381e5b[_0x0ccf('0x37')]),_0x10726f);if(_0x4ee5b4['query'][_0x0ccf('0x3f')]){_0xb140e2[_0x0ccf('0x3d')]=_[_0x0ccf('0x40')](_0xb140e2[_0x0ccf('0x3d')],{'$or':_[_0x0ccf('0x2e')](_0x10726f,function(_0x427324){if(_0x427324['type']!=='VIRTUAL'){var _0x585a47={};_0x585a47[_0x427324[_0x0ccf('0x2c')]]={'$like':'%'+_0x4ee5b4[_0x0ccf('0x36')]['filter']+'%'};return _0x585a47;}})});}_0xb140e2=_['merge']({},_0xb140e2,_0x4ee5b4['options']);var _0x2a02ea={'where':_0xb140e2[_0x0ccf('0x3d')]};return db[_0x0ccf('0x2f')][_0x0ccf('0x22')](_0x2a02ea)['then'](function(_0xe88fd7){_0x1055db[_0x0ccf('0x22')]=_0xe88fd7;if(_0x4ee5b4[_0x0ccf('0x36')][_0x0ccf('0x41')]){_0xb140e2[_0x0ccf('0x42')]=[{'all':!![]}];}return db['Team'][_0x0ccf('0x43')](_0xb140e2);})[_0x0ccf('0x28')](function(_0x2eedf2){_0x1055db['rows']=_0x2eedf2;return _0x1055db;})[_0x0ccf('0x28')](respondWithFilteredResult(_0xdc2b3b,_0xb140e2))[_0x0ccf('0x44')](handleError(_0xdc2b3b,null));};exports[_0x0ccf('0x45')]=function(_0x4d7ecc,_0x550c0e){var _0x3da2c4={'raw':![],'where':{'id':_0x4d7ecc[_0x0ccf('0x46')]['id']}},_0x4041ca={};_0x4041ca[_0x0ccf('0x34')]=_[_0x0ccf('0x35')](db[_0x0ccf('0x2f')]['rawAttributes']);_0x4041ca[_0x0ccf('0x36')]=_[_0x0ccf('0x35')](_0x4d7ecc[_0x0ccf('0x36')]);_0x4041ca[_0x0ccf('0x37')]=_[_0x0ccf('0x38')](_0x4041ca[_0x0ccf('0x34')],_0x4041ca['query']);_0x3da2c4[_0x0ccf('0x3a')]=_[_0x0ccf('0x38')](_0x4041ca[_0x0ccf('0x34')],qs[_0x0ccf('0x39')](_0x4d7ecc[_0x0ccf('0x36')][_0x0ccf('0x39')]));_0x3da2c4[_0x0ccf('0x3a')]=_0x3da2c4['attributes']['length']?_0x3da2c4[_0x0ccf('0x3a')]:_0x4041ca[_0x0ccf('0x34')];if(_0x4d7ecc[_0x0ccf('0x36')]['includeAll']){_0x3da2c4[_0x0ccf('0x42')]=[{'all':!![]}];}_0x3da2c4=_[_0x0ccf('0x40')]({},_0x3da2c4,_0x4d7ecc[_0x0ccf('0x47')]);return db[_0x0ccf('0x2f')][_0x0ccf('0x48')](_0x3da2c4)[_0x0ccf('0x28')](handleEntityNotFound(_0x550c0e,null))['then'](respondWithResult(_0x550c0e,null))['catch'](handleError(_0x550c0e,null));};exports[_0x0ccf('0x49')]=function(_0x1b472a,_0x4ca7ca){return db['Team'][_0x0ccf('0x49')](_0x1b472a[_0x0ccf('0x4a')],{})[_0x0ccf('0x28')](function(_0xd41cab){var _0xaf178=_0x1b472a['user'][_0x0ccf('0x29')]({'plain':!![]});if(!_0xaf178)throw new Error(_0x0ccf('0x4b'));if(_0xaf178['role']==='user'){var _0x5c63f1=_0xd41cab[_0x0ccf('0x29')]({'plain':!![]});var _0x5a7025=_0x0ccf('0x4c');return db[_0x0ccf('0x4d')]['find']({'where':{'name':_0x5a7025,'userProfileId':_0xaf178[_0x0ccf('0x4e')]},'raw':!![]})[_0x0ccf('0x28')](function(_0x3b14d7){if(_0x3b14d7&&_0x3b14d7[_0x0ccf('0x4f')]===0x0){return db[_0x0ccf('0x50')][_0x0ccf('0x49')]({'name':_0x5c63f1[_0x0ccf('0x2c')],'resourceId':_0x5c63f1['id'],'type':_0x3b14d7[_0x0ccf('0x2c')],'sectionId':_0x3b14d7['id']},{})[_0x0ccf('0x28')](function(){return _0xd41cab;});}else{return _0xd41cab;}})[_0x0ccf('0x44')](function(_0x30e04e){logger[_0x0ccf('0x2b')](_0x0ccf('0x51'),_0x30e04e);throw _0x30e04e;});}return _0xd41cab;})[_0x0ccf('0x28')](respondWithResult(_0x4ca7ca,0xc9))[_0x0ccf('0x44')](handleError(_0x4ca7ca,null));};exports[_0x0ccf('0x27')]=function(_0x59eb4e,_0x566b39){if(_0x59eb4e[_0x0ccf('0x4a')]['id']){delete _0x59eb4e[_0x0ccf('0x4a')]['id'];}return db[_0x0ccf('0x2f')]['find']({'where':{'id':_0x59eb4e['params']['id']}})['then'](handleEntityNotFound(_0x566b39,null))[_0x0ccf('0x28')](saveUpdates(_0x59eb4e[_0x0ccf('0x4a')],null))[_0x0ccf('0x28')](respondWithResult(_0x566b39,null))[_0x0ccf('0x44')](handleError(_0x566b39,null));};exports[_0x0ccf('0x2a')]=function(_0x502370,_0x25919a){return db[_0x0ccf('0x2f')]['find']({'where':{'id':_0x502370[_0x0ccf('0x46')]['id']}})[_0x0ccf('0x28')](handleEntityNotFound(_0x25919a,null))[_0x0ccf('0x28')](removeEntity(_0x25919a,null))[_0x0ccf('0x44')](handleError(_0x25919a,null));};exports[_0x0ccf('0x52')]=function(_0xef0541,_0x1fb4ed,_0x3ff6a6){return db[_0x0ccf('0x2f')][_0x0ccf('0x53')]({'where':{'id':_0xef0541['params']['id']}})['then'](handleEntityNotFound(_0x1fb4ed,null))[_0x0ccf('0x28')](function(_0x1f1ab9){if(!_0xef0541[_0x0ccf('0x36')][_0x0ccf('0x54')]||!utils[_0x0ccf('0x55')](_0xef0541['query'][_0x0ccf('0x54')])){throw new db['Sequelize'][(_0x0ccf('0x56'))](_0x0ccf('0x57'));}var _0x19bf2f={};var _0x5a264c={};_0x5a264c[_0x0ccf('0x34')]=_[_0x0ccf('0x35')](db[_[_0x0ccf('0x58')](_0xef0541[_0x0ccf('0x36')][_0x0ccf('0x54')]['toLowerCase']())+_0x0ccf('0x59')][_0x0ccf('0x30')]);_0x5a264c[_0x0ccf('0x36')]=_[_0x0ccf('0x35')](_0xef0541[_0x0ccf('0x36')]);_0x5a264c[_0x0ccf('0x37')]=_[_0x0ccf('0x38')](_0x5a264c[_0x0ccf('0x34')],_0x5a264c[_0x0ccf('0x36')]);_0x19bf2f[_0x0ccf('0x3a')]=_[_0x0ccf('0x38')](_0x5a264c['model'],qs[_0x0ccf('0x39')](_0xef0541[_0x0ccf('0x36')]['fields']));_0x19bf2f[_0x0ccf('0x3a')]=_0x19bf2f[_0x0ccf('0x3a')][_0x0ccf('0x5a')]?_0x19bf2f[_0x0ccf('0x3a')]:_0x5a264c[_0x0ccf('0x34')];_0x19bf2f[_0x0ccf('0x21')]=qs[_0x0ccf('0x21')](_0xef0541[_0x0ccf('0x36')]['limit']);_0x19bf2f[_0x0ccf('0x23')]=qs[_0x0ccf('0x23')](_0xef0541['query'][_0x0ccf('0x23')]);_0x19bf2f[_0x0ccf('0x3b')]=qs[_0x0ccf('0x3c')](_0xef0541['query'][_0x0ccf('0x3c')]);_0x19bf2f[_0x0ccf('0x3d')]=qs[_0x0ccf('0x37')](_['pick'](_0xef0541[_0x0ccf('0x36')],_0x5a264c[_0x0ccf('0x37')]));_0x19bf2f=_[_0x0ccf('0x40')]({},_0x19bf2f,_0xef0541['options']);return _0x1f1ab9['get'+_[_0x0ccf('0x58')](_0xef0541[_0x0ccf('0x36')]['channel'][_0x0ccf('0x5b')]())+_0x0ccf('0x5c')](_0x19bf2f);})[_0x0ccf('0x28')](respondWithResult(_0x1fb4ed,null))[_0x0ccf('0x44')](handleError(_0x1fb4ed,null));};exports[_0x0ccf('0x5d')]=function(_0xbf1814,_0x4dd6b8,_0x5df35d){return db[_0x0ccf('0x2f')][_0x0ccf('0x53')]({'where':{'id':_0xbf1814['params']['id']}})['then'](function(_0x53f515){if(_0x53f515){if(!_0xbf1814['body']['channel']||!utils[_0x0ccf('0x55')](_0xbf1814[_0x0ccf('0x4a')]['channel'])){throw new db[(_0x0ccf('0x5e'))][(_0x0ccf('0x56'))](_0x0ccf('0x57'));}return _0x53f515[_0x0ccf('0x5f')+_['capitalize'](_0xbf1814[_0x0ccf('0x4a')][_0x0ccf('0x54')][_0x0ccf('0x5b')]())+_0x0ccf('0x5c')](_0xbf1814[_0x0ccf('0x4a')][_0x0ccf('0x60')]);}return null;})[_0x0ccf('0x28')](handleEntityNotFound(_0x4dd6b8,null))[_0x0ccf('0x28')](respondWithStatusCode(_0x4dd6b8,null))['catch'](handleError(_0x4dd6b8,null));};exports[_0x0ccf('0x61')]=function(_0x28d7cc,_0x4f7eed,_0xdf9b8e){return db['Team'][_0x0ccf('0x53')]({'where':{'id':_0x28d7cc['params']['id']}})[_0x0ccf('0x28')](function(_0x3f9279){if(_0x3f9279){if(!_0x28d7cc[_0x0ccf('0x36')]['channel']||!utils[_0x0ccf('0x55')](_0x28d7cc[_0x0ccf('0x36')][_0x0ccf('0x54')])){throw new db['Sequelize'][(_0x0ccf('0x56'))](_0x0ccf('0x57'));}return _0x3f9279[_0x0ccf('0x62')+_[_0x0ccf('0x58')](_0x28d7cc[_0x0ccf('0x36')]['channel'][_0x0ccf('0x5b')]())+_0x0ccf('0x5c')](_0x28d7cc['query'][_0x0ccf('0x60')]);}return null;})[_0x0ccf('0x28')](handleEntityNotFound(_0x4f7eed,null))[_0x0ccf('0x28')](respondWithStatusCode(_0x4f7eed,null))['catch'](handleError(_0x4f7eed,null));};exports[_0x0ccf('0x63')]=function(_0x13e24b,_0x4acf1a){return db['Team']['find']({'where':{'id':_0x13e24b['params']['id']}})[_0x0ccf('0x28')](handleEntityNotFound(_0x4acf1a,null))[_0x0ccf('0x28')](function(_0x5d061e){if(_0x5d061e){var _0x34bd23=[_0x0ccf('0x64'),_0x0ccf('0x65'),'Mail',_0x0ccf('0x66'),_0x0ccf('0x67'),'Openchannel','Whatsapp'];return db[_0x0ccf('0x68')][_0x0ccf('0x69')](function(_0x15e08c){var _0x6054aa=_[_0x0ccf('0x2e')](_0x34bd23,function(_0x1a6f3f){var _0xe97d8b={'attributes':['id','name']};if(_0x1a6f3f===_0x0ccf('0x64')){_0xe97d8b[_0x0ccf('0x6a')]={'attributes':['penalty']};}return _0x5d061e[_0x0ccf('0x29')+_0x1a6f3f+_0x0ccf('0x5c')](_0xe97d8b)[_0x0ccf('0x28')](function(_0x1f9f49){var _0x566ba7=_[_0x0ccf('0x2e')](_0x1f9f49,function(_0x384b8f){var _0xa80f55=_[_0x0ccf('0x2e')](_0x13e24b[_0x0ccf('0x4a')][_0x0ccf('0x60')],function(_0xa9db47){var _0x3a3b4a={'where':{'UserId':_0xa9db47,[_0x1a6f3f+_0x0ccf('0x6b')]:_0x384b8f['id']},'transaction':_0x15e08c};if(_0x1a6f3f===_0x0ccf('0x64')){_0x3a3b4a[_0x0ccf('0x6c')]={'penalty':_0x384b8f['TeamVoiceQueue']['penalty']};}return db[_0x0ccf('0x6d')+_0x1a6f3f+_0x0ccf('0x59')][_0x0ccf('0x6e')](_0x3a3b4a)[_0x0ccf('0x28')](function(){socket[_0x0ccf('0x6f')]('user'+_0x1a6f3f+_0x0ccf('0x70'),{'UserId':_0xa9db47,[_0x1a6f3f+_0x0ccf('0x6b')]:_0x384b8f['id']});if(_0x1a6f3f!==_0x0ccf('0x64'))return;return db[_0x0ccf('0x6d')]['findAll']({'where':{'id':_0x13e24b[_0x0ccf('0x4a')][_0x0ccf('0x60')],'online':0x1},'attributes':['id',_0x0ccf('0x2c'),'online',_0x0ccf('0x71'),'interface'],'raw':!![]})[_0x0ccf('0x28')](function(_0x3fee85){var _0x13de1b=_[_0x0ccf('0x2e')](_0x3fee85,function(_0x2f6b9e){return db['UserVoiceQueueRt']['upsert']({'membername':_0x2f6b9e[_0x0ccf('0x2c')],'UserId':_0x2f6b9e['id'],'queue_name':_0x384b8f[_0x0ccf('0x2c')],'VoiceQueueId':_0x384b8f['id'],'interface':_[_0x0ccf('0x72')](_0x2f6b9e[_0x0ccf('0x73')])?util[_0x0ccf('0x74')](_0x0ccf('0x75'),_0x2f6b9e[_0x0ccf('0x2c')]):_0x2f6b9e[_0x0ccf('0x73')],'paused':_0x2f6b9e['voicePause']||![],'penalty':_0x384b8f[_0x0ccf('0x76')][_0x0ccf('0x77')]},{'transaction':_0x15e08c});});return Promise['all'](_0x13de1b);});});});return Promise['all'](_0xa80f55);});return Promise[_0x0ccf('0x78')](_0x566ba7);})[_0x0ccf('0x28')](function(){var _0x3ee1aa=JSON[_0x0ccf('0x79')]('['+_0x13e24b['body'][_0x0ccf('0x60')]+']');db[_0x0ccf('0x7a')][_0x0ccf('0x53')]({'where':{'teamId':_0x13e24b[_0x0ccf('0x46')]['id']}})[_0x0ccf('0x28')](function(_0x2f0487){if(_0x2f0487){for(var _0x8d3b8c=0x0;_0x8d3b8c<_0x3ee1aa[_0x0ccf('0x5a')];_0x8d3b8c++){var _0x24b7db=_0x3ee1aa[_0x8d3b8c];db[_0x0ccf('0x7b')][_0x0ccf('0x7c')]({'UserId':_0x24b7db,'VoicePrefixId':_0x2f0487[_0x0ccf('0x7d')]});}}});});});return Promise[_0x0ccf('0x78')](_0x6054aa)['then'](function(){return _0x5d061e[_0x0ccf('0x63')](_0x13e24b[_0x0ccf('0x4a')][_0x0ccf('0x60')],{'transaction':_0x15e08c})[_0x0ccf('0x7e')](function(_0x2ceec5){return _0x2ceec5;});});});}})[_0x0ccf('0x28')](respondWithResult(_0x4acf1a,null))[_0x0ccf('0x44')](handleError(_0x4acf1a,null));};exports[_0x0ccf('0x7f')]=function(_0x5a082b,_0x3a82e0){return db[_0x0ccf('0x2f')][_0x0ccf('0x48')]({'where':{'id':_0x5a082b[_0x0ccf('0x46')]['id']}})['then'](handleEntityNotFound(_0x3a82e0,null))['then'](function(_0x23e2d9){if(_0x23e2d9){var _0x48ce0a=['Voice',_0x0ccf('0x65'),'Mail',_0x0ccf('0x66'),_0x0ccf('0x67'),_0x0ccf('0x80'),_0x0ccf('0x81')];return db[_0x0ccf('0x68')]['transaction'](function(_0x372f22){var _0x1bb4fd=_[_0x0ccf('0x2e')](_0x48ce0a,function(_0x288092){var _0x8e6d30={'attributes':['id',_0x0ccf('0x2c')]};return _0x23e2d9[_0x0ccf('0x29')+_0x288092+_0x0ccf('0x5c')](_0x8e6d30)['then'](function(_0x567fc1){var _0x286724=_['map'](_0x567fc1,function(_0x109b1d){return _0x109b1d['removeAgents'](_0x5a082b[_0x0ccf('0x36')][_0x0ccf('0x60')],{'transaction':_0x372f22})[_0x0ccf('0x28')](function(){var _0x3f4190=JSON[_0x0ccf('0x79')]('['+_0x5a082b[_0x0ccf('0x36')]['ids']+']');var _0xdde415=_['map'](_0x3f4190,function(_0x3f01d5){socket[_0x0ccf('0x6f')]('user'+_0x288092+_0x0ccf('0x82'),{'UserId':Number(_0x3f01d5),[_0x288092+_0x0ccf('0x6b')]:_0x109b1d['id']});if(_0x288092!==_0x0ccf('0x64'))return;return db[_0x0ccf('0x83')]['destroy']({'where':{'VoiceQueueId':_0x109b1d['id'],'UserId':_0x3f01d5},'transaction':_0x372f22});});return Promise[_0x0ccf('0x78')](_0xdde415);});});return Promise[_0x0ccf('0x78')](_0x286724);});});return Promise['all'](_0x1bb4fd)[_0x0ccf('0x28')](function(){return _0x23e2d9['removeAgents'](_0x5a082b['query'][_0x0ccf('0x60')],{'transaction':_0x372f22});})['then'](function(){var _0x58a955=JSON['parse']('['+_0x5a082b['query']['ids']+']');db[_0x0ccf('0x7a')][_0x0ccf('0x53')]({'where':{'teamId':_0x5a082b[_0x0ccf('0x46')]['id']}})['then'](function(_0x587ce4){if(_0x587ce4){for(var _0xd8e4ac=0x0;_0xd8e4ac<_0x58a955[_0x0ccf('0x5a')];_0xd8e4ac++){var _0x9e32ce=_0x58a955[_0xd8e4ac];db[_0x0ccf('0x7b')]['destroy']({'where':{'UserId':_0x9e32ce,'VoicePrefixId':_0x587ce4['VoicePrefixId']}});}}});});});}})[_0x0ccf('0x28')](respondWithStatusCode(_0x3a82e0,null))['catch'](handleError(_0x3a82e0,null));};exports[_0x0ccf('0x84')]=function(_0x525a58,_0x514382,_0x2c79fd){var _0x209f02={};var _0x2241fb={};var _0x2be0a2;var _0xefe79f;return db['Team'][_0x0ccf('0x53')]({'where':{'id':_0x525a58[_0x0ccf('0x46')]['id']}})[_0x0ccf('0x28')](handleEntityNotFound(_0x514382,null))[_0x0ccf('0x28')](function(_0x361cf6){if(_0x361cf6){_0x2be0a2=_0x361cf6;_0x2241fb['model']=_[_0x0ccf('0x35')](db[_0x0ccf('0x6d')][_0x0ccf('0x30')]);_0x2241fb['query']=_[_0x0ccf('0x35')](_0x525a58[_0x0ccf('0x36')]);_0x2241fb['filters']=_['intersection'](_0x2241fb['model'],_0x2241fb[_0x0ccf('0x36')]);_0x209f02['attributes']=_[_0x0ccf('0x38')](_0x2241fb['model'],qs[_0x0ccf('0x39')](_0x525a58[_0x0ccf('0x36')][_0x0ccf('0x39')]));_0x209f02[_0x0ccf('0x3a')]=_0x209f02[_0x0ccf('0x3a')][_0x0ccf('0x5a')]?_0x209f02['attributes']:_0x2241fb[_0x0ccf('0x34')];_0x209f02[_0x0ccf('0x3b')]=qs[_0x0ccf('0x3c')](_0x525a58[_0x0ccf('0x36')]['sort']);_0x209f02[_0x0ccf('0x3d')]=qs['filters'](_[_0x0ccf('0x3e')](_0x525a58[_0x0ccf('0x36')],_0x2241fb[_0x0ccf('0x37')]));if(_0x525a58[_0x0ccf('0x36')][_0x0ccf('0x3f')]){_0x209f02[_0x0ccf('0x3d')]=_[_0x0ccf('0x40')](_0x209f02['where'],{'$or':_['map'](_0x209f02[_0x0ccf('0x3a')],function(_0x9618a0){var _0x2c6000={};_0x2c6000[_0x9618a0]={'$like':'%'+_0x525a58['query']['filter']+'%'};return _0x2c6000;})});}_0x209f02=_['merge']({},_0x209f02,_0x525a58[_0x0ccf('0x47')]);return _0x2be0a2[_0x0ccf('0x84')](_0x209f02);}})[_0x0ccf('0x28')](function(_0x1175d8){if(_0x1175d8){_0xefe79f=_0x1175d8[_0x0ccf('0x5a')];if(!_0x525a58[_0x0ccf('0x36')][_0x0ccf('0x85')](_0x0ccf('0x86'))){_0x209f02[_0x0ccf('0x21')]=qs['limit'](_0x525a58[_0x0ccf('0x36')]['limit']);_0x209f02[_0x0ccf('0x23')]=qs[_0x0ccf('0x23')](_0x525a58['query'][_0x0ccf('0x23')]);}return _0x2be0a2[_0x0ccf('0x84')](_0x209f02);}})[_0x0ccf('0x28')](function(_0x4c5396){if(_0x4c5396){return _0x4c5396?{'count':_0xefe79f,'rows':_0x4c5396}:null;}})['then'](respondWithResult(_0x514382,null))['catch'](handleError(_0x514382,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 2647d7c..83d9ba5 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 _0x72de=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','Team','save','update','remove'];(function(_0x50f03e,_0x77e9be){var _0x7064e2=function(_0xc429e3){while(--_0xc429e3){_0x50f03e['push'](_0x50f03e['shift']());}};_0x7064e2(++_0x77e9be);}(_0x72de,0x180));var _0xe72d=function(_0x49191e,_0x15438a){_0x49191e=_0x49191e-0x0;var _0xa5eeaa=_0x72de[_0x49191e];return _0xa5eeaa;};'use strict';var EventEmitter=require(_0xe72d('0x0'));var Team=require(_0xe72d('0x1'))['db'][_0xe72d('0x2')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe72d('0x3'),'afterUpdate':_0xe72d('0x4'),'afterDestroy':_0xe72d('0x5')};function emitEvent(_0x43516a){return function(_0x1fc35a,_0x4e7799,_0x13a798){TeamEvents[_0xe72d('0x6')](_0x43516a+':'+_0x1fc35a['id'],_0x1fc35a);TeamEvents['emit'](_0x43516a,_0x1fc35a);_0x13a798(null);};}for(var e in events){if(events[_0xe72d('0x7')](e)){var event=events[e];Team[_0xe72d('0x8')](e,emitEvent(event));}}module[_0xe72d('0x9')]=TeamEvents; \ No newline at end of file +var _0xb1d5=['emit','hasOwnProperty','../../mysqldb','Team','setMaxListeners','save','update'];(function(_0x3130b5,_0x23faf7){var _0xa6d8a3=function(_0x175be7){while(--_0x175be7){_0x3130b5['push'](_0x3130b5['shift']());}};_0xa6d8a3(++_0x23faf7);}(_0xb1d5,0x8e));var _0x5b1d=function(_0x1c8de9,_0x5b826b){_0x1c8de9=_0x1c8de9-0x0;var _0x284b59=_0xb1d5[_0x1c8de9];return _0x284b59;};'use strict';var EventEmitter=require('events');var Team=require(_0x5b1d('0x0'))['db'][_0x5b1d('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x5b1d('0x2')](0x0);var events={'afterCreate':_0x5b1d('0x3'),'afterUpdate':_0x5b1d('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3c77c9){return function(_0x4535b6,_0x10e522,_0x3af497){TeamEvents[_0x5b1d('0x5')](_0x3c77c9+':'+_0x4535b6['id'],_0x4535b6);TeamEvents['emit'](_0x3c77c9,_0x4535b6);_0x3af497(null);};}for(var e in events){if(events[_0x5b1d('0x6')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 9090609..da667f0 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 _0xbd8d=['bluebird','request-promise','path','rimraf','../../config/environment','./team.attributes','exports','define','Team','teams','lodash','util','../../config/logger','api','moment'];(function(_0x3ad642,_0x222a32){var _0x61bd25=function(_0x23f8fb){while(--_0x23f8fb){_0x3ad642['push'](_0x3ad642['shift']());}};_0x61bd25(++_0x222a32);}(_0xbd8d,0x190));var _0xdbd8=function(_0x4340c4,_0x3949a5){_0x4340c4=_0x4340c4-0x0;var _0x506bbb=_0xbd8d[_0x4340c4];return _0x506bbb;};'use strict';var _=require(_0xdbd8('0x0'));var util=require(_0xdbd8('0x1'));var logger=require(_0xdbd8('0x2'))(_0xdbd8('0x3'));var moment=require(_0xdbd8('0x4'));var BPromise=require(_0xdbd8('0x5'));var rp=require(_0xdbd8('0x6'));var fs=require('fs');var path=require(_0xdbd8('0x7'));var rimraf=require(_0xdbd8('0x8'));var config=require(_0xdbd8('0x9'));var attributes=require(_0xdbd8('0xa'));module[_0xdbd8('0xb')]=function(_0x4f839b,_0x1a7dba){return _0x4f839b[_0xdbd8('0xc')](_0xdbd8('0xd'),attributes,{'tableName':_0xdbd8('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8483=['../../config/logger','api','moment','request-promise','path','rimraf','exports','define','util'];(function(_0x3e9ce2,_0xf0d6cc){var _0x305a12=function(_0x34230b){while(--_0x34230b){_0x3e9ce2['push'](_0x3e9ce2['shift']());}};_0x305a12(++_0xf0d6cc);}(_0x8483,0x194));var _0x3848=function(_0x282c0b,_0x16c486){_0x282c0b=_0x282c0b-0x0;var _0x448aa5=_0x8483[_0x282c0b];return _0x448aa5;};'use strict';var _=require('lodash');var util=require(_0x3848('0x0'));var logger=require(_0x3848('0x1'))(_0x3848('0x2'));var moment=require(_0x3848('0x3'));var BPromise=require('bluebird');var rp=require(_0x3848('0x4'));var fs=require('fs');var path=require(_0x3848('0x5'));var rimraf=require(_0x3848('0x6'));var config=require('../../config/environment');var attributes=require('./team.attributes');module[_0x3848('0x7')]=function(_0x5cb5f9,_0xe5a873){return _0x5cb5f9[_0x3848('0x8')]('Team',attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 743fa2b..9dbeed0 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 _0x4d50=['redis','defaults','localhost','socket.io-emitter','./team.socket','register','request','then','request\x20sent','debug','stringify','error','code','Team,\x20%s,\x20%s','message','info','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4d50,0x9d));var _0x04d5=function(_0x199300,_0x506f6f){_0x199300=_0x199300-0x0;var _0x30031b=_0x4d50[_0x199300];return _0x30031b;};'use strict';var _=require(_0x04d5('0x0'));var util=require(_0x04d5('0x1'));var moment=require(_0x04d5('0x2'));var BPromise=require('bluebird');var rs=require(_0x04d5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x04d5('0x4'))['db'];var utils=require(_0x04d5('0x5'));var logger=require(_0x04d5('0x6'))(_0x04d5('0x7'));var config=require(_0x04d5('0x8'));var jayson=require(_0x04d5('0x9'));var client=jayson['client'][_0x04d5('0xa')]({'port':0x232a});config[_0x04d5('0xb')]=_[_0x04d5('0xc')](config[_0x04d5('0xb')],{'host':_0x04d5('0xd'),'port':0x18eb});var socket=require(_0x04d5('0xe'))(new Redis(config[_0x04d5('0xb')]));require(_0x04d5('0xf'))[_0x04d5('0x10')](socket);function respondWithRpcPromise(_0x30c918,_0x1fdab1,_0x2eabd1){return new BPromise(function(_0xdb15c3,_0x56e82b){return client[_0x04d5('0x11')](_0x30c918,_0x2eabd1)[_0x04d5('0x12')](function(_0xa9bb78){logger['info']('Team,\x20%s,\x20%s',_0x1fdab1,_0x04d5('0x13'));logger[_0x04d5('0x14')]('Team,\x20%s,\x20%s,\x20%s',_0x1fdab1,_0x04d5('0x13'),JSON[_0x04d5('0x15')](_0xa9bb78));if(_0xa9bb78[_0x04d5('0x16')]){if(_0xa9bb78[_0x04d5('0x16')][_0x04d5('0x17')]===0x1f4){logger[_0x04d5('0x16')](_0x04d5('0x18'),_0x1fdab1,_0xa9bb78[_0x04d5('0x16')][_0x04d5('0x19')]);return _0x56e82b(_0xa9bb78[_0x04d5('0x16')]['message']);}logger[_0x04d5('0x16')](_0x04d5('0x18'),_0x1fdab1,_0xa9bb78[_0x04d5('0x16')][_0x04d5('0x19')]);return _0xdb15c3(_0xa9bb78[_0x04d5('0x16')][_0x04d5('0x19')]);}else{logger[_0x04d5('0x1a')](_0x04d5('0x18'),_0x1fdab1,_0x04d5('0x13'));_0xdb15c3(_0xa9bb78['result'][_0x04d5('0x19')]);}})[_0x04d5('0x1b')](function(_0x275d5e){logger[_0x04d5('0x16')](_0x04d5('0x18'),_0x1fdab1,_0x275d5e);_0x56e82b(_0x275d5e);});});} \ No newline at end of file +var _0xe226=['lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0xe226,0x1cb));var _0x6e22=function(_0x1f54b7,_0x42b884){_0x1f54b7=_0x1f54b7-0x0;var _0x1c4b70=_0xe226[_0x1f54b7];return _0x1c4b70;};'use strict';var _=require(_0x6e22('0x0'));var util=require(_0x6e22('0x1'));var moment=require(_0x6e22('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e22('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6e22('0x4'))['db'];var utils=require(_0x6e22('0x5'));var logger=require('../../config/logger')(_0x6e22('0x6'));var config=require('../../config/environment');var jayson=require(_0x6e22('0x7'));var client=jayson[_0x6e22('0x8')][_0x6e22('0x9')]({'port':0x232a});config[_0x6e22('0xa')]=_[_0x6e22('0xb')](config[_0x6e22('0xa')],{'host':_0x6e22('0xc'),'port':0x18eb});var socket=require(_0x6e22('0xd'))(new Redis(config[_0x6e22('0xa')]));require(_0x6e22('0xe'))[_0x6e22('0xf')](socket);function respondWithRpcPromise(_0x39d5ac,_0x5479d3,_0x3917b6){return new BPromise(function(_0x3f4a3a,_0x186c6f){return client['request'](_0x39d5ac,_0x3917b6)[_0x6e22('0x10')](function(_0x1a4562){logger[_0x6e22('0x11')](_0x6e22('0x12'),_0x5479d3,_0x6e22('0x13'));logger[_0x6e22('0x14')](_0x6e22('0x15'),_0x5479d3,'request\x20sent',JSON[_0x6e22('0x16')](_0x1a4562));if(_0x1a4562['error']){if(_0x1a4562['error'][_0x6e22('0x17')]===0x1f4){logger['error'](_0x6e22('0x12'),_0x5479d3,_0x1a4562[_0x6e22('0x18')][_0x6e22('0x19')]);return _0x186c6f(_0x1a4562[_0x6e22('0x18')][_0x6e22('0x19')]);}logger['error'](_0x6e22('0x12'),_0x5479d3,_0x1a4562[_0x6e22('0x18')]['message']);return _0x3f4a3a(_0x1a4562['error'][_0x6e22('0x19')]);}else{logger['info']('Team,\x20%s,\x20%s',_0x5479d3,_0x6e22('0x13'));_0x3f4a3a(_0x1a4562[_0x6e22('0x1a')][_0x6e22('0x19')]);}})['catch'](function(_0x525604){logger[_0x6e22('0x18')](_0x6e22('0x12'),_0x5479d3,_0x525604);_0x186c6f(_0x525604);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index db9d3f3..6ca35b6 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 _0x6ae8=['team:','./team.events','update','emit','removeListener','register','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6ae8,0x190));var _0x86ae=function(_0x362a04,_0x3d71ae){_0x362a04=_0x362a04-0x0;var _0x17a8b0=_0x6ae8[_0x362a04];return _0x17a8b0;};'use strict';var TeamEvents=require(_0x86ae('0x0'));var events=['save','remove',_0x86ae('0x1')];function createListener(_0x41bf64,_0x4b8c7c){return function(_0x2fb9fd){_0x4b8c7c[_0x86ae('0x2')](_0x41bf64,_0x2fb9fd);};}function removeListener(_0x27b2e6,_0x408016){return function(){TeamEvents[_0x86ae('0x3')](_0x27b2e6,_0x408016);};}exports[_0x86ae('0x4')]=function(_0x28197b){for(var _0x528439=0x0,_0x4c5579=events[_0x86ae('0x5')];_0x528439<_0x4c5579;_0x528439++){var _0x34a4bb=events[_0x528439];var _0x1be0a2=createListener(_0x86ae('0x6')+_0x34a4bb,_0x28197b);TeamEvents['on'](_0x34a4bb,_0x1be0a2);}}; \ No newline at end of file +var _0x1752=['removeListener','register','length','save','remove','update'];(function(_0x4a8ad7,_0x616fae){var _0x291d6d=function(_0xe895b3){while(--_0xe895b3){_0x4a8ad7['push'](_0x4a8ad7['shift']());}};_0x291d6d(++_0x616fae);}(_0x1752,0xa5));var _0x2175=function(_0x4430d8,_0x93facb){_0x4430d8=_0x4430d8-0x0;var _0x2cf50f=_0x1752[_0x4430d8];return _0x2cf50f;};'use strict';var TeamEvents=require('./team.events');var events=[_0x2175('0x0'),_0x2175('0x1'),_0x2175('0x2')];function createListener(_0x1886b3,_0x1b2344){return function(_0xe2453c){_0x1b2344['emit'](_0x1886b3,_0xe2453c);};}function removeListener(_0x1ee277,_0x22c167){return function(){TeamEvents[_0x2175('0x3')](_0x1ee277,_0x22c167);};}exports[_0x2175('0x4')]=function(_0x222868){for(var _0x27ff0b=0x0,_0x19ca87=events[_0x2175('0x5')];_0x27ff0b<_0x19ca87;_0x27ff0b++){var _0x339e4d=events[_0x27ff0b];var _0x672ff1=createListener('team:'+_0x339e4d,_0x222868);TeamEvents['on'](_0x339e4d,_0x672ff1);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/index.js b/server/api/teamVoicePrefix/index.js index f878508..a8404e5 100644 --- a/server/api/teamVoicePrefix/index.js +++ b/server/api/teamVoicePrefix/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x1212cf,_0x34fcd8){var _0x443478=function(_0x407adb){while(--_0x407adb){_0x1212cf['push'](_0x1212cf['shift']());}};_0x443478(++_0x34fcd8);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x43f7d7,_0x3f7d79){var _0x12b17b=function(_0x13e16b){while(--_0x13e16b){_0x43f7d7['push'](_0x43f7d7['shift']());}};_0x12b17b(++_0x3f7d79);}(_0xe706,0xa3));var _0x6e70=function(_0x299027,_0x5d2e4f){_0x299027=_0x299027-0x0;var _0x1bc622=_0xe706[_0x299027];return _0x1bc622;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 11ab2ad..a076978 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 _0x2141=['INTEGER','sequelize','exports'];(function(_0x9db544,_0x57dcff){var _0x8c67dd=function(_0x33dbc0){while(--_0x33dbc0){_0x9db544['push'](_0x9db544['shift']());}};_0x8c67dd(++_0x57dcff);}(_0x2141,0x1ba));var _0x1214=function(_0x5bf025,_0x23e922){_0x5bf025=_0x5bf025-0x0;var _0x44d0d5=_0x2141[_0x5bf025];return _0x44d0d5;};'use strict';var Sequelize=require(_0x1214('0x0'));module[_0x1214('0x1')]={'TeamId':{'type':Sequelize[_0x1214('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x1214('0x2')]}}; \ No newline at end of file +var _0xc5ba=['exports','INTEGER','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc5ba,0xb9));var _0xac5b=function(_0x2b78e5,_0x3126f8){_0x2b78e5=_0x2b78e5-0x0;var _0xa8d52d=_0xc5ba[_0x2b78e5];return _0xa8d52d;};'use strict';var Sequelize=require(_0xac5b('0x0'));module[_0xac5b('0x1')]={'TeamId':{'type':Sequelize[_0xac5b('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xac5b('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index a19a752..8c209bb 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 _0x4c4d=['path','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','bluebird'];(function(_0x5d792b,_0x4a41de){var _0x219de9=function(_0x2e27b8){while(--_0x2e27b8){_0x5d792b['push'](_0x5d792b['shift']());}};_0x219de9(++_0x4a41de);}(_0x4c4d,0x1a2));var _0xd4c4=function(_0x8a4dd6,_0x1c9841){_0x8a4dd6=_0x8a4dd6-0x0;var _0x1c1100=_0x4c4d[_0x8a4dd6];return _0x1c1100;};'use strict';var _=require(_0xd4c4('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xd4c4('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd4c4('0x2'));var rimraf=require(_0xd4c4('0x3'));var config=require(_0xd4c4('0x4'));var attributes=require(_0xd4c4('0x5'));module[_0xd4c4('0x6')]=function(_0x207277,_0x4bc0c9){return _0x207277[_0xd4c4('0x7')](_0xd4c4('0x8'),attributes,{'tableName':_0xd4c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd523=['exports','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./teamVoicePrefix.attributes'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd523,0x153));var _0x3d52=function(_0x25c51c,_0x3d424d){_0x25c51c=_0x25c51c-0x0;var _0x132bf4=_0xd523[_0x25c51c];return _0x132bf4;};'use strict';var _=require(_0x3d52('0x0'));var util=require(_0x3d52('0x1'));var logger=require(_0x3d52('0x2'))(_0x3d52('0x3'));var moment=require('moment');var BPromise=require(_0x3d52('0x4'));var rp=require(_0x3d52('0x5'));var fs=require('fs');var path=require(_0x3d52('0x6'));var rimraf=require('rimraf');var config=require(_0x3d52('0x7'));var attributes=require(_0x3d52('0x8'));module[_0x3d52('0x9')]=function(_0x46a0e9,_0x580f82){return _0x46a0e9['define'](_0x3d52('0xa'),attributes,{'tableName':_0x3d52('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.rpc.js b/server/api/teamVoicePrefix/teamVoicePrefix.rpc.js index 32a6d88..4cef1e0 100644 --- a/server/api/teamVoicePrefix/teamVoicePrefix.rpc.js +++ b/server/api/teamVoicePrefix/teamVoicePrefix.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xad00=['catch','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','http','request','then','info','TeamVoicePrefix,\x20%s,\x20%s','TeamVoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x138b5b,_0x3e04a3){var _0x1128ae=function(_0x1c2b8d){while(--_0x1c2b8d){_0x138b5b['push'](_0x138b5b['shift']());}};_0x1128ae(++_0x3e04a3);}(_0xad00,0x166));var _0x0ad0=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xad00[_0x32d457];return _0x338386;};'use strict';var _=require(_0x0ad0('0x0'));var util=require(_0x0ad0('0x1'));var moment=require(_0x0ad0('0x2'));var BPromise=require(_0x0ad0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0ad0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0ad0('0x5'));var logger=require('../../config/logger')(_0x0ad0('0x6'));var config=require(_0x0ad0('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0ad0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2b6b2a,_0x54491d,_0x56bdb9){return new BPromise(function(_0x5eeebd,_0x417d72){return client[_0x0ad0('0x9')](_0x2b6b2a,_0x56bdb9)[_0x0ad0('0xa')](function(_0x53ab29){logger[_0x0ad0('0xb')](_0x0ad0('0xc'),_0x54491d,'request\x20sent');logger['debug'](_0x0ad0('0xd'),_0x54491d,_0x0ad0('0xe'),JSON[_0x0ad0('0xf')](_0x53ab29));if(_0x53ab29[_0x0ad0('0x10')]){if(_0x53ab29['error'][_0x0ad0('0x11')]===0x1f4){logger[_0x0ad0('0x10')](_0x0ad0('0xc'),_0x54491d,_0x53ab29['error'][_0x0ad0('0x12')]);return _0x417d72(_0x53ab29[_0x0ad0('0x10')]['message']);}logger[_0x0ad0('0x10')](_0x0ad0('0xc'),_0x54491d,_0x53ab29['error'][_0x0ad0('0x12')]);return _0x5eeebd(_0x53ab29['error'][_0x0ad0('0x12')]);}else{logger['info']('TeamVoicePrefix,\x20%s,\x20%s',_0x54491d,_0x0ad0('0xe'));_0x5eeebd(_0x53ab29[_0x0ad0('0x13')][_0x0ad0('0x12')]);}})[_0x0ad0('0x14')](function(_0x398bce){logger[_0x0ad0('0x10')](_0x0ad0('0xc'),_0x54491d,_0x398bce);_0x417d72(_0x398bce);});});} \ No newline at end of file +var _0x715b=['TeamVoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug'];(function(_0x3aa1f0,_0x3ee7c9){var _0x520581=function(_0x34824){while(--_0x34824){_0x3aa1f0['push'](_0x3aa1f0['shift']());}};_0x520581(++_0x3ee7c9);}(_0x715b,0x139));var _0xb715=function(_0x3745de,_0x3bf837){_0x3745de=_0x3745de-0x0;var _0x3c55fb=_0x715b[_0x3745de];return _0x3c55fb;};'use strict';var _=require(_0xb715('0x0'));var util=require(_0xb715('0x1'));var moment=require(_0xb715('0x2'));var BPromise=require(_0xb715('0x3'));var rs=require(_0xb715('0x4'));var fs=require('fs');var Redis=require(_0xb715('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb715('0x6'));var logger=require(_0xb715('0x7'))(_0xb715('0x8'));var config=require('../../config/environment');var jayson=require(_0xb715('0x9'));var client=jayson[_0xb715('0xa')][_0xb715('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3ab327,_0x2ce87b,_0x21dcf1){return new BPromise(function(_0x5e604a,_0x829f3f){return client[_0xb715('0xc')](_0x3ab327,_0x21dcf1)[_0xb715('0xd')](function(_0x1902c0){logger[_0xb715('0xe')]('TeamVoicePrefix,\x20%s,\x20%s',_0x2ce87b,_0xb715('0xf'));logger[_0xb715('0x10')](_0xb715('0x11'),_0x2ce87b,_0xb715('0xf'),JSON[_0xb715('0x12')](_0x1902c0));if(_0x1902c0[_0xb715('0x13')]){if(_0x1902c0[_0xb715('0x13')][_0xb715('0x14')]===0x1f4){logger[_0xb715('0x13')]('TeamVoicePrefix,\x20%s,\x20%s',_0x2ce87b,_0x1902c0[_0xb715('0x13')][_0xb715('0x15')]);return _0x829f3f(_0x1902c0[_0xb715('0x13')][_0xb715('0x15')]);}logger[_0xb715('0x13')]('TeamVoicePrefix,\x20%s,\x20%s',_0x2ce87b,_0x1902c0['error']['message']);return _0x5e604a(_0x1902c0[_0xb715('0x13')]['message']);}else{logger['info']('TeamVoicePrefix,\x20%s,\x20%s',_0x2ce87b,_0xb715('0xf'));_0x5e604a(_0x1902c0['result']['message']);}})['catch'](function(_0x173def){logger[_0xb715('0x13')]('TeamVoicePrefix,\x20%s,\x20%s',_0x2ce87b,_0x173def);_0x829f3f(_0x173def);});});} \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 63b8e1d..b6dc328 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(_0x149478,_0x380771){var _0x2bcd4d=function(_0x3fa152){while(--_0x3fa152){_0x149478['push'](_0x149478['shift']());}};_0x2bcd4d(++_0x380771);}(_0x9c44,0x178));var _0x49c4=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x9c44[_0x1d1779];return _0x2377e9;};'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(_0x19d867,_0x4ddeed){var _0x19eff8=function(_0x3e4613){while(--_0x3e4613){_0x19d867['push'](_0x19d867['shift']());}};_0x19eff8(++_0x4ddeed);}(_0xe706,0xa3));var _0x6e70=function(_0x33bb07,_0x5b1849){_0x33bb07=_0x33bb07-0x0;var _0x481c81=_0xe706[_0x33bb07];return _0x481c81;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index dcf9ebd..60ab16f 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 _0x99c9=['INTEGER','sequelize','exports'];(function(_0x126c14,_0x4790a8){var _0x5c53dc=function(_0x64c949){while(--_0x64c949){_0x126c14['push'](_0x126c14['shift']());}};_0x5c53dc(++_0x4790a8);}(_0x99c9,0x13c));var _0x999c=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x99c9[_0x4a53d];return _0x27410e;};'use strict';var Sequelize=require(_0x999c('0x0'));module[_0x999c('0x1')]={'penalty':{'type':Sequelize[_0x999c('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6580=['exports','sequelize'];(function(_0x291b7e,_0x1d92d6){var _0x502780=function(_0x2f4acc){while(--_0x2f4acc){_0x291b7e['push'](_0x291b7e['shift']());}};_0x502780(++_0x1d92d6);}(_0x6580,0x75));var _0x0658=function(_0x51d2c4,_0x3cf68f){_0x51d2c4=_0x51d2c4-0x0;var _0x368e6f=_0x6580[_0x51d2c4];return _0x368e6f;};'use strict';var Sequelize=require(_0x0658('0x0'));module[_0x0658('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 758d5a6..5dbd45f 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 _0x04d0=['request-promise','../../config/environment','exports','define','TeamVoiceQueue','../../config/logger','api','moment','bluebird'];(function(_0x54c5ed,_0x27ca67){var _0x4cb286=function(_0x2cbc6b){while(--_0x2cbc6b){_0x54c5ed['push'](_0x54c5ed['shift']());}};_0x4cb286(++_0x27ca67);}(_0x04d0,0x10a));var _0x004d=function(_0xcf8929,_0x1c5292){_0xcf8929=_0xcf8929-0x0;var _0x421040=_0x04d0[_0xcf8929];return _0x421040;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x004d('0x0'))(_0x004d('0x1'));var moment=require(_0x004d('0x2'));var BPromise=require(_0x004d('0x3'));var rp=require(_0x004d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x004d('0x5'));var attributes=require('./teamVoiceQueue.attributes');module[_0x004d('0x6')]=function(_0x285754,_0x4a3878){return _0x285754[_0x004d('0x7')](_0x004d('0x8'),attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1501=['bluebird','request-promise','path','rimraf','./teamVoiceQueue.attributes','define','TeamVoiceQueue','team_has_voice_queues','util','../../config/logger','api'];(function(_0x270836,_0x350925){var _0x40d416=function(_0x1b796b){while(--_0x1b796b){_0x270836['push'](_0x270836['shift']());}};_0x40d416(++_0x350925);}(_0x1501,0x126));var _0x1150=function(_0x1c20a9,_0x1a7ab1){_0x1c20a9=_0x1c20a9-0x0;var _0x4bfa40=_0x1501[_0x1c20a9];return _0x4bfa40;};'use strict';var _=require('lodash');var util=require(_0x1150('0x0'));var logger=require(_0x1150('0x1'))(_0x1150('0x2'));var moment=require('moment');var BPromise=require(_0x1150('0x3'));var rp=require(_0x1150('0x4'));var fs=require('fs');var path=require(_0x1150('0x5'));var rimraf=require(_0x1150('0x6'));var config=require('../../config/environment');var attributes=require(_0x1150('0x7'));module['exports']=function(_0x63c724,_0x316a7d){return _0x63c724[_0x1150('0x8')](_0x1150('0x9'),attributes,{'tableName':_0x1150('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index ae1f4b6..38965f9 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 _0xb3ea=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','info','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','code','error','TeamVoiceQueue,\x20%s,\x20%s','message','lodash','util','moment'];(function(_0x12d2c2,_0x399678){var _0x3d98bf=function(_0x120e05){while(--_0x120e05){_0x12d2c2['push'](_0x12d2c2['shift']());}};_0x3d98bf(++_0x399678);}(_0xb3ea,0xc5));var _0xab3e=function(_0x1dfba6,_0x25b1fd){_0x1dfba6=_0x1dfba6-0x0;var _0x2f045d=_0xb3ea[_0x1dfba6];return _0x2f045d;};'use strict';var _=require(_0xab3e('0x0'));var util=require(_0xab3e('0x1'));var moment=require(_0xab3e('0x2'));var BPromise=require(_0xab3e('0x3'));var rs=require(_0xab3e('0x4'));var fs=require('fs');var Redis=require(_0xab3e('0x5'));var db=require(_0xab3e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xab3e('0x7'))(_0xab3e('0x8'));var config=require('../../config/environment');var jayson=require(_0xab3e('0x9'));var client=jayson[_0xab3e('0xa')][_0xab3e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5f3a39,_0x4f4c37,_0x1a6192){return new BPromise(function(_0x375b4e,_0xf5a32f){return client['request'](_0x5f3a39,_0x1a6192)['then'](function(_0x2354aa){logger[_0xab3e('0xc')]('TeamVoiceQueue,\x20%s,\x20%s',_0x4f4c37,_0xab3e('0xd'));logger[_0xab3e('0xe')](_0xab3e('0xf'),_0x4f4c37,_0xab3e('0xd'),JSON['stringify'](_0x2354aa));if(_0x2354aa['error']){if(_0x2354aa['error'][_0xab3e('0x10')]===0x1f4){logger[_0xab3e('0x11')](_0xab3e('0x12'),_0x4f4c37,_0x2354aa[_0xab3e('0x11')]['message']);return _0xf5a32f(_0x2354aa['error']['message']);}logger[_0xab3e('0x11')]('TeamVoiceQueue,\x20%s,\x20%s',_0x4f4c37,_0x2354aa[_0xab3e('0x11')][_0xab3e('0x13')]);return _0x375b4e(_0x2354aa['error'][_0xab3e('0x13')]);}else{logger[_0xab3e('0xc')](_0xab3e('0x12'),_0x4f4c37,_0xab3e('0xd'));_0x375b4e(_0x2354aa['result'][_0xab3e('0x13')]);}})['catch'](function(_0x5e35b0){logger[_0xab3e('0x11')](_0xab3e('0x12'),_0x4f4c37,_0x5e35b0);_0xf5a32f(_0x5e35b0);});});} \ No newline at end of file +var _0x6797=['request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0x6797,0xda));var _0x7679=function(_0x1a0619,_0x3dc342){_0x1a0619=_0x1a0619-0x0;var _0xb5142e=_0x6797[_0x1a0619];return _0xb5142e;};'use strict';var _=require(_0x7679('0x0'));var util=require(_0x7679('0x1'));var moment=require(_0x7679('0x2'));var BPromise=require(_0x7679('0x3'));var rs=require(_0x7679('0x4'));var fs=require('fs');var Redis=require(_0x7679('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7679('0x6'));var logger=require('../../config/logger')(_0x7679('0x7'));var config=require(_0x7679('0x8'));var jayson=require(_0x7679('0x9'));var client=jayson[_0x7679('0xa')][_0x7679('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x243fbb,_0x52fcaa,_0x1406b3){return new BPromise(function(_0x23e59a,_0x51be53){return client[_0x7679('0xc')](_0x243fbb,_0x1406b3)[_0x7679('0xd')](function(_0xf3f439){logger[_0x7679('0xe')](_0x7679('0xf'),_0x52fcaa,_0x7679('0x10'));logger[_0x7679('0x11')](_0x7679('0x12'),_0x52fcaa,_0x7679('0x10'),JSON['stringify'](_0xf3f439));if(_0xf3f439['error']){if(_0xf3f439[_0x7679('0x13')][_0x7679('0x14')]===0x1f4){logger[_0x7679('0x13')](_0x7679('0xf'),_0x52fcaa,_0xf3f439[_0x7679('0x13')]['message']);return _0x51be53(_0xf3f439[_0x7679('0x13')][_0x7679('0x15')]);}logger['error'](_0x7679('0xf'),_0x52fcaa,_0xf3f439[_0x7679('0x13')][_0x7679('0x15')]);return _0x23e59a(_0xf3f439[_0x7679('0x13')][_0x7679('0x15')]);}else{logger['info']('TeamVoiceQueue,\x20%s,\x20%s',_0x52fcaa,_0x7679('0x10'));_0x23e59a(_0xf3f439['result'][_0x7679('0x15')]);}})[_0x7679('0x16')](function(_0x473dfb){logger[_0x7679('0x13')](_0x7679('0xf'),_0x52fcaa,_0x473dfb);_0x51be53(_0x473dfb);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 7a12fb2..2e837a2 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 _0x25e7=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x39b479,_0x4ff292){var _0x5b8200=function(_0x2d9239){while(--_0x2d9239){_0x39b479['push'](_0x39b479['shift']());}};_0x5b8200(++_0x4ff292);}(_0x25e7,0x1d6));var _0x725e=function(_0x1d9dfa,_0x30598d){_0x1d9dfa=_0x1d9dfa-0x0;var _0x252661=_0x25e7[_0x1d9dfa];return _0x252661;};'use strict';var multer=require(_0x725e('0x0'));var util=require(_0x725e('0x1'));var path=require(_0x725e('0x2'));var timeout=require(_0x725e('0x3'));var express=require(_0x725e('0x4'));var router=express[_0x725e('0x5')]();var fs_extra=require(_0x725e('0x6'));var auth=require(_0x725e('0x7'));var interaction=require(_0x725e('0x8'));var config=require(_0x725e('0x9'));var controller=require('./template.controller');router['get']('/',auth[_0x725e('0xa')](),controller['index']);router['get'](_0x725e('0xb'),auth[_0x725e('0xa')](),controller[_0x725e('0xc')]);router[_0x725e('0xd')]('/',auth[_0x725e('0xa')](),controller[_0x725e('0xe')]);router[_0x725e('0xf')](_0x725e('0xb'),auth[_0x725e('0xa')](),controller[_0x725e('0x10')]);router[_0x725e('0x11')](_0x725e('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x725e('0x12')]=router; \ No newline at end of file +var _0x0324=['get','isAuthenticated','index','/:id','create','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./template.controller'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x0324,0x90));var _0x4032=function(_0xbd3b61,_0x28c7ad){_0xbd3b61=_0xbd3b61-0x0;var _0x3f61ac=_0x0324[_0xbd3b61];return _0x3f61ac;};'use strict';var multer=require('multer');var util=require(_0x4032('0x0'));var path=require(_0x4032('0x1'));var timeout=require(_0x4032('0x2'));var express=require(_0x4032('0x3'));var router=express[_0x4032('0x4')]();var fs_extra=require(_0x4032('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4032('0x6'));var config=require(_0x4032('0x7'));var controller=require(_0x4032('0x8'));router[_0x4032('0x9')]('/',auth[_0x4032('0xa')](),controller[_0x4032('0xb')]);router['get'](_0x4032('0xc'),auth[_0x4032('0xa')](),controller['show']);router['post']('/',auth[_0x4032('0xa')](),controller[_0x4032('0xd')]);router['put'](_0x4032('0xc'),auth[_0x4032('0xa')](),controller[_0x4032('0xe')]);router[_0x4032('0xf')]('/:id',auth[_0x4032('0xa')](),controller[_0x4032('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 84bfa4b..17a1e20 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 _0x6ac9=['exports','STRING','TEXT','sequelize'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x6ac9,0x12b));var _0x96ac=function(_0x43a0d8,_0x15df0e){_0x43a0d8=_0x43a0d8-0x0;var _0x182886=_0x6ac9[_0x43a0d8];return _0x182886;};'use strict';var Sequelize=require(_0x96ac('0x0'));module[_0x96ac('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x96ac('0x2')]},'html':{'type':Sequelize[_0x96ac('0x3')]}}; \ No newline at end of file +var _0x646b=['exports','TEXT','sequelize'];(function(_0x24e55d,_0x4281de){var _0x4a29c0=function(_0x4ea980){while(--_0x4ea980){_0x24e55d['push'](_0x24e55d['shift']());}};_0x4a29c0(++_0x4281de);}(_0x646b,0xf2));var _0xb646=function(_0x301064,_0x1985aa){_0x301064=_0x301064-0x0;var _0x5bc841=_0x646b[_0x301064];return _0x5bc841;};'use strict';var Sequelize=require(_0xb646('0x0'));module[_0xb646('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0xb646('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 406b4a5..ed9305c 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 _0xd903=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','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','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','apply','save','then','destroy','get','Templates','UserProfileResource','stack','name','send','map','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','type','merge','options','include','Template','rows','catch','show','params','includeAll','find','create','body'];(function(_0xb08b12,_0x2b0a20){var _0x47a353=function(_0x6aa6ad){while(--_0x6aa6ad){_0xb08b12['push'](_0xb08b12['shift']());}};_0x47a353(++_0x2b0a20);}(_0xd903,0x19c));var _0x3d90=function(_0xebfe2d,_0x4950c8){_0xebfe2d=_0xebfe2d-0x0;var _0x38b39d=_0xd903[_0xebfe2d];return _0x38b39d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3d90('0x0'));var zipdir=require(_0x3d90('0x1'));var jsonpatch=require(_0x3d90('0x2'));var rp=require('request-promise');var moment=require(_0x3d90('0x3'));var BPromise=require(_0x3d90('0x4'));var Mustache=require(_0x3d90('0x5'));var util=require(_0x3d90('0x6'));var path=require(_0x3d90('0x7'));var sox=require(_0x3d90('0x8'));var csv=require(_0x3d90('0x9'));var ejs=require(_0x3d90('0xa'));var fs=require('fs');var fs_extra=require(_0x3d90('0xb'));var _=require(_0x3d90('0xc'));var squel=require(_0x3d90('0xd'));var crypto=require(_0x3d90('0xe'));var jsforce=require(_0x3d90('0xf'));var deskjs=require(_0x3d90('0x10'));var toCsv=require(_0x3d90('0x9'));var querystring=require(_0x3d90('0x11'));var Papa=require(_0x3d90('0x12'));var Redis=require('ioredis');var authService=require(_0x3d90('0x13'));var qs=require(_0x3d90('0x14'));var as=require(_0x3d90('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3d90('0x16'))('api');var utils=require(_0x3d90('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x3d90('0x18'));var db=require(_0x3d90('0x19'))['db'];function respondWithStatusCode(_0x69c74f,_0x785a80){_0x785a80=_0x785a80||0xcc;return function(_0x32a1dd){if(_0x32a1dd){return _0x69c74f[_0x3d90('0x1a')](_0x785a80);}return _0x69c74f[_0x3d90('0x1b')](_0x785a80)[_0x3d90('0x1c')]();};}function respondWithResult(_0x335422,_0x20b103){_0x20b103=_0x20b103||0xc8;return function(_0xf0da69){if(_0xf0da69){return _0x335422[_0x3d90('0x1b')](_0x20b103)['json'](_0xf0da69);}};}function respondWithFilteredResult(_0x1675b3,_0x24adb7){return function(_0x3515da){if(_0x3515da){var _0xc726e4=typeof _0x24adb7['offset']==='undefined'&&typeof _0x24adb7['limit']===_0x3d90('0x1d');var _0x501db2=_0x3515da[_0x3d90('0x1e')];var _0x17e670=_0xc726e4?0x0:_0x24adb7[_0x3d90('0x1f')];var _0xa3eff5=_0xc726e4?_0x3515da['count']:_0x24adb7['offset']+_0x24adb7[_0x3d90('0x20')];var _0x2ca0a5;if(_0xa3eff5>=_0x501db2){_0xa3eff5=_0x501db2;_0x2ca0a5=0xc8;}else{_0x2ca0a5=0xce;}_0x1675b3[_0x3d90('0x1b')](_0x2ca0a5);return _0x1675b3[_0x3d90('0x21')](_0x3d90('0x22'),_0x17e670+'-'+_0xa3eff5+'/'+_0x501db2)['json'](_0x3515da);}return null;};}function patchUpdates(_0x3222fb){return function(_0x1f1705){try{jsonpatch[_0x3d90('0x23')](_0x1f1705,_0x3222fb,!![]);}catch(_0x564c6e){return BPromise['reject'](_0x564c6e);}return _0x1f1705[_0x3d90('0x24')]();};}function saveUpdates(_0x3b5d6f,_0x5bc5bd){return function(_0x3e7155){if(_0x3e7155){return _0x3e7155['update'](_0x3b5d6f)[_0x3d90('0x25')](function(_0x522f58){return _0x522f58;});}return null;};}function removeEntity(_0x4e58d6,_0x503e0e){return function(_0x5b3a0d){if(_0x5b3a0d){return _0x5b3a0d[_0x3d90('0x26')]()[_0x3d90('0x25')](function(){var _0xb7628=_0x5b3a0d[_0x3d90('0x27')]({'plain':!![]});var _0x459b22=_0x3d90('0x28');return db[_0x3d90('0x29')][_0x3d90('0x26')]({'where':{'type':_0x459b22,'resourceId':_0xb7628['id']}})[_0x3d90('0x25')](function(){return _0x5b3a0d;});})[_0x3d90('0x25')](function(){_0x4e58d6['status'](0xcc)[_0x3d90('0x1c')]();});}};}function handleEntityNotFound(_0x40300a,_0x32bfaf){return function(_0x2f6529){if(!_0x2f6529){_0x40300a[_0x3d90('0x1a')](0x194);}return _0x2f6529;};}function handleError(_0x446850,_0x1da83d){_0x1da83d=_0x1da83d||0x1f4;return function(_0x520030){logger['error'](_0x520030[_0x3d90('0x2a')]);if(_0x520030[_0x3d90('0x2b')]){delete _0x520030[_0x3d90('0x2b')];}_0x446850[_0x3d90('0x1b')](_0x1da83d)[_0x3d90('0x2c')](_0x520030);};}exports['index']=function(_0x37e1a2,_0x51c9c0){var _0x313452={},_0x44e0af={},_0x25b714={'count':0x0,'rows':[]};var _0x4c8a98=_[_0x3d90('0x2d')](db['Template']['rawAttributes'],function(_0xa33453){return{'name':_0xa33453['fieldName'],'type':_0xa33453['type'][_0x3d90('0x2e')]};});_0x44e0af[_0x3d90('0x2f')]=_[_0x3d90('0x2d')](_0x4c8a98,_0x3d90('0x2b'));_0x44e0af[_0x3d90('0x30')]=_[_0x3d90('0x31')](_0x37e1a2[_0x3d90('0x30')]);_0x44e0af[_0x3d90('0x32')]=_['intersection'](_0x44e0af[_0x3d90('0x2f')],_0x44e0af['query']);_0x313452['attributes']=_[_0x3d90('0x33')](_0x44e0af[_0x3d90('0x2f')],qs[_0x3d90('0x34')](_0x37e1a2[_0x3d90('0x30')]['fields']));_0x313452[_0x3d90('0x35')]=_0x313452['attributes'][_0x3d90('0x36')]?_0x313452['attributes']:_0x44e0af[_0x3d90('0x2f')];if(!_0x37e1a2[_0x3d90('0x30')]['hasOwnProperty'](_0x3d90('0x37'))){_0x313452['limit']=qs[_0x3d90('0x20')](_0x37e1a2['query'][_0x3d90('0x20')]);_0x313452[_0x3d90('0x1f')]=qs[_0x3d90('0x1f')](_0x37e1a2[_0x3d90('0x30')][_0x3d90('0x1f')]);}_0x313452[_0x3d90('0x38')]=qs[_0x3d90('0x39')](_0x37e1a2['query'][_0x3d90('0x39')]);_0x313452[_0x3d90('0x3a')]=qs[_0x3d90('0x32')](_[_0x3d90('0x3b')](_0x37e1a2[_0x3d90('0x30')],_0x44e0af[_0x3d90('0x32')]),_0x4c8a98);if(_0x37e1a2['query'][_0x3d90('0x3c')]){_0x313452['where']=_['merge'](_0x313452[_0x3d90('0x3a')],{'$or':_[_0x3d90('0x2d')](_0x4c8a98,function(_0x9af6a0){if(_0x9af6a0[_0x3d90('0x3d')]!=='VIRTUAL'){var _0x3bd89a={};_0x3bd89a[_0x9af6a0[_0x3d90('0x2b')]]={'$like':'%'+_0x37e1a2[_0x3d90('0x30')][_0x3d90('0x3c')]+'%'};return _0x3bd89a;}})});}_0x313452=_[_0x3d90('0x3e')]({},_0x313452,_0x37e1a2[_0x3d90('0x3f')]);var _0x7f98b3={'where':_0x313452['where']};return db['Template'][_0x3d90('0x1e')](_0x7f98b3)[_0x3d90('0x25')](function(_0x53f4d1){_0x25b714[_0x3d90('0x1e')]=_0x53f4d1;if(_0x37e1a2[_0x3d90('0x30')]['includeAll']){_0x313452[_0x3d90('0x40')]=[{'all':!![]}];}return db[_0x3d90('0x41')]['findAll'](_0x313452);})[_0x3d90('0x25')](function(_0x56ee2b){_0x25b714[_0x3d90('0x42')]=_0x56ee2b;return _0x25b714;})['then'](respondWithFilteredResult(_0x51c9c0,_0x313452))[_0x3d90('0x43')](handleError(_0x51c9c0,null));};exports[_0x3d90('0x44')]=function(_0x9346c3,_0x3e280b){var _0x3c88ea={'raw':!![],'where':{'id':_0x9346c3[_0x3d90('0x45')]['id']}},_0x1e706d={};_0x1e706d[_0x3d90('0x2f')]=_[_0x3d90('0x31')](db['Template']['rawAttributes']);_0x1e706d[_0x3d90('0x30')]=_[_0x3d90('0x31')](_0x9346c3['query']);_0x1e706d[_0x3d90('0x32')]=_[_0x3d90('0x33')](_0x1e706d[_0x3d90('0x2f')],_0x1e706d[_0x3d90('0x30')]);_0x3c88ea['attributes']=_[_0x3d90('0x33')](_0x1e706d['model'],qs['fields'](_0x9346c3['query'][_0x3d90('0x34')]));_0x3c88ea['attributes']=_0x3c88ea[_0x3d90('0x35')][_0x3d90('0x36')]?_0x3c88ea['attributes']:_0x1e706d[_0x3d90('0x2f')];if(_0x9346c3['query'][_0x3d90('0x46')]){_0x3c88ea[_0x3d90('0x40')]=[{'all':!![]}];}_0x3c88ea=_[_0x3d90('0x3e')]({},_0x3c88ea,_0x9346c3['options']);return db[_0x3d90('0x41')][_0x3d90('0x47')](_0x3c88ea)[_0x3d90('0x25')](handleEntityNotFound(_0x3e280b,null))[_0x3d90('0x25')](respondWithResult(_0x3e280b,null))[_0x3d90('0x43')](handleError(_0x3e280b,null));};exports[_0x3d90('0x48')]=function(_0x1ed1ce,_0x51505d){return db['Template'][_0x3d90('0x48')](_0x1ed1ce[_0x3d90('0x49')],{})[_0x3d90('0x25')](function(_0x349613){var _0x201dd9=_0x1ed1ce[_0x3d90('0x4a')][_0x3d90('0x27')]({'plain':!![]});if(!_0x201dd9)throw new Error(_0x3d90('0x4b'));if(_0x201dd9['role']===_0x3d90('0x4a')){var _0x459ea5=_0x349613['get']({'plain':!![]});var _0x53ef99=_0x3d90('0x28');return db[_0x3d90('0x4c')]['find']({'where':{'name':_0x53ef99,'userProfileId':_0x201dd9[_0x3d90('0x4d')]},'raw':!![]})[_0x3d90('0x25')](function(_0x2c09f0){if(_0x2c09f0&&_0x2c09f0[_0x3d90('0x4e')]===0x0){return db[_0x3d90('0x29')][_0x3d90('0x48')]({'name':_0x459ea5[_0x3d90('0x2b')],'resourceId':_0x459ea5['id'],'type':_0x2c09f0[_0x3d90('0x2b')],'sectionId':_0x2c09f0['id']},{})[_0x3d90('0x25')](function(){return _0x349613;});}else{return _0x349613;}})[_0x3d90('0x43')](function(_0x1b120c){logger['error'](_0x3d90('0x4f'),_0x1b120c);throw _0x1b120c;});}return _0x349613;})[_0x3d90('0x25')](respondWithResult(_0x51505d,0xc9))['catch'](handleError(_0x51505d,null));};exports[_0x3d90('0x50')]=function(_0x571371,_0x2d40b3){if(_0x571371[_0x3d90('0x49')]['id']){delete _0x571371[_0x3d90('0x49')]['id'];}return db[_0x3d90('0x41')][_0x3d90('0x47')]({'where':{'id':_0x571371[_0x3d90('0x45')]['id']}})[_0x3d90('0x25')](handleEntityNotFound(_0x2d40b3,null))[_0x3d90('0x25')](saveUpdates(_0x571371[_0x3d90('0x49')],null))[_0x3d90('0x25')](respondWithResult(_0x2d40b3,null))['catch'](handleError(_0x2d40b3,null));};exports[_0x3d90('0x26')]=function(_0x1915c1,_0x1c5c85){return db[_0x3d90('0x41')][_0x3d90('0x47')]({'where':{'id':_0x1915c1[_0x3d90('0x45')]['id']}})[_0x3d90('0x25')](handleEntityNotFound(_0x1c5c85,null))[_0x3d90('0x25')](removeEntity(_0x1c5c85,null))['catch'](handleError(_0x1c5c85,null));}; \ No newline at end of file +var _0xd71f=['Template','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','filter','merge','where','VIRTUAL','include','findAll','params','includeAll','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','Templates','UserProfileResource','error','stack','name','send','map'];(function(_0x2a56ad,_0x2b94bf){var _0x425175=function(_0x342f20){while(--_0x342f20){_0x2a56ad['push'](_0x2a56ad['shift']());}};_0x425175(++_0x2b94bf);}(_0xd71f,0xc8));var _0xfd71=function(_0x53f2e2,_0x51a4cc){_0x53f2e2=_0x53f2e2-0x0;var _0x48882c=_0xd71f[_0x53f2e2];return _0x48882c;};'use strict';var emlformat=require(_0xfd71('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfd71('0x1'));var jsonpatch=require(_0xfd71('0x2'));var rp=require(_0xfd71('0x3'));var moment=require(_0xfd71('0x4'));var BPromise=require(_0xfd71('0x5'));var Mustache=require(_0xfd71('0x6'));var util=require(_0xfd71('0x7'));var path=require(_0xfd71('0x8'));var sox=require(_0xfd71('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfd71('0xa'));var squel=require(_0xfd71('0xb'));var crypto=require(_0xfd71('0xc'));var jsforce=require(_0xfd71('0xd'));var deskjs=require(_0xfd71('0xe'));var toCsv=require(_0xfd71('0xf'));var querystring=require(_0xfd71('0x10'));var Papa=require(_0xfd71('0x11'));var Redis=require(_0xfd71('0x12'));var authService=require(_0xfd71('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xfd71('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfd71('0x15'))(_0xfd71('0x16'));var utils=require(_0xfd71('0x17'));var config=require(_0xfd71('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xfd71('0x19'))['db'];function respondWithStatusCode(_0x3230fc,_0x20c821){_0x20c821=_0x20c821||0xcc;return function(_0x497601){if(_0x497601){return _0x3230fc[_0xfd71('0x1a')](_0x20c821);}return _0x3230fc[_0xfd71('0x1b')](_0x20c821)[_0xfd71('0x1c')]();};}function respondWithResult(_0x35d937,_0x256b80){_0x256b80=_0x256b80||0xc8;return function(_0x13b7d7){if(_0x13b7d7){return _0x35d937[_0xfd71('0x1b')](_0x256b80)[_0xfd71('0x1d')](_0x13b7d7);}};}function respondWithFilteredResult(_0x4f6e94,_0x19b094){return function(_0x1d3ed0){if(_0x1d3ed0){var _0x14747e=typeof _0x19b094[_0xfd71('0x1e')]===_0xfd71('0x1f')&&typeof _0x19b094[_0xfd71('0x20')]===_0xfd71('0x1f');var _0x4464c3=_0x1d3ed0[_0xfd71('0x21')];var _0x48505f=_0x14747e?0x0:_0x19b094[_0xfd71('0x1e')];var _0x5e73b6=_0x14747e?_0x1d3ed0[_0xfd71('0x21')]:_0x19b094['offset']+_0x19b094[_0xfd71('0x20')];var _0x412b86;if(_0x5e73b6>=_0x4464c3){_0x5e73b6=_0x4464c3;_0x412b86=0xc8;}else{_0x412b86=0xce;}_0x4f6e94[_0xfd71('0x1b')](_0x412b86);return _0x4f6e94[_0xfd71('0x22')](_0xfd71('0x23'),_0x48505f+'-'+_0x5e73b6+'/'+_0x4464c3)[_0xfd71('0x1d')](_0x1d3ed0);}return null;};}function patchUpdates(_0x2796d1){return function(_0xe5a158){try{jsonpatch[_0xfd71('0x24')](_0xe5a158,_0x2796d1,!![]);}catch(_0x39a31a){return BPromise[_0xfd71('0x25')](_0x39a31a);}return _0xe5a158[_0xfd71('0x26')]();};}function saveUpdates(_0x3009a3,_0x5f5c48){return function(_0x53fcfe){if(_0x53fcfe){return _0x53fcfe[_0xfd71('0x27')](_0x3009a3)['then'](function(_0x4cc01c){return _0x4cc01c;});}return null;};}function removeEntity(_0x3421d7,_0x3d6107){return function(_0x44567c){if(_0x44567c){return _0x44567c[_0xfd71('0x28')]()[_0xfd71('0x29')](function(){var _0x4e0352=_0x44567c['get']({'plain':!![]});var _0x2136d0=_0xfd71('0x2a');return db[_0xfd71('0x2b')][_0xfd71('0x28')]({'where':{'type':_0x2136d0,'resourceId':_0x4e0352['id']}})[_0xfd71('0x29')](function(){return _0x44567c;});})['then'](function(){_0x3421d7[_0xfd71('0x1b')](0xcc)[_0xfd71('0x1c')]();});}};}function handleEntityNotFound(_0x39a7c0,_0x1b7807){return function(_0x362e84){if(!_0x362e84){_0x39a7c0[_0xfd71('0x1a')](0x194);}return _0x362e84;};}function handleError(_0x18422a,_0x25ec66){_0x25ec66=_0x25ec66||0x1f4;return function(_0x2a55b9){logger[_0xfd71('0x2c')](_0x2a55b9[_0xfd71('0x2d')]);if(_0x2a55b9[_0xfd71('0x2e')]){delete _0x2a55b9[_0xfd71('0x2e')];}_0x18422a[_0xfd71('0x1b')](_0x25ec66)[_0xfd71('0x2f')](_0x2a55b9);};}exports['index']=function(_0xafcb0d,_0x287d51){var _0x282ce3={},_0xb201c={},_0x4c0ec6={'count':0x0,'rows':[]};var _0x5c27fb=_[_0xfd71('0x30')](db[_0xfd71('0x31')][_0xfd71('0x32')],function(_0x525b1f){return{'name':_0x525b1f[_0xfd71('0x33')],'type':_0x525b1f[_0xfd71('0x34')][_0xfd71('0x35')]};});_0xb201c[_0xfd71('0x36')]=_[_0xfd71('0x30')](_0x5c27fb,'name');_0xb201c[_0xfd71('0x37')]=_[_0xfd71('0x38')](_0xafcb0d[_0xfd71('0x37')]);_0xb201c[_0xfd71('0x39')]=_[_0xfd71('0x3a')](_0xb201c[_0xfd71('0x36')],_0xb201c[_0xfd71('0x37')]);_0x282ce3['attributes']=_[_0xfd71('0x3a')](_0xb201c[_0xfd71('0x36')],qs[_0xfd71('0x3b')](_0xafcb0d[_0xfd71('0x37')][_0xfd71('0x3b')]));_0x282ce3['attributes']=_0x282ce3[_0xfd71('0x3c')][_0xfd71('0x3d')]?_0x282ce3[_0xfd71('0x3c')]:_0xb201c[_0xfd71('0x36')];if(!_0xafcb0d['query'][_0xfd71('0x3e')](_0xfd71('0x3f'))){_0x282ce3[_0xfd71('0x20')]=qs[_0xfd71('0x20')](_0xafcb0d[_0xfd71('0x37')]['limit']);_0x282ce3[_0xfd71('0x1e')]=qs[_0xfd71('0x1e')](_0xafcb0d['query'][_0xfd71('0x1e')]);}_0x282ce3['order']=qs['sort'](_0xafcb0d[_0xfd71('0x37')]['sort']);_0x282ce3['where']=qs[_0xfd71('0x39')](_['pick'](_0xafcb0d['query'],_0xb201c['filters']),_0x5c27fb);if(_0xafcb0d[_0xfd71('0x37')][_0xfd71('0x40')]){_0x282ce3['where']=_[_0xfd71('0x41')](_0x282ce3[_0xfd71('0x42')],{'$or':_['map'](_0x5c27fb,function(_0xd8a123){if(_0xd8a123['type']!==_0xfd71('0x43')){var _0x32f02d={};_0x32f02d[_0xd8a123['name']]={'$like':'%'+_0xafcb0d[_0xfd71('0x37')][_0xfd71('0x40')]+'%'};return _0x32f02d;}})});}_0x282ce3=_[_0xfd71('0x41')]({},_0x282ce3,_0xafcb0d['options']);var _0x29cbd8={'where':_0x282ce3[_0xfd71('0x42')]};return db[_0xfd71('0x31')][_0xfd71('0x21')](_0x29cbd8)['then'](function(_0x678ae4){_0x4c0ec6[_0xfd71('0x21')]=_0x678ae4;if(_0xafcb0d[_0xfd71('0x37')]['includeAll']){_0x282ce3[_0xfd71('0x44')]=[{'all':!![]}];}return db[_0xfd71('0x31')][_0xfd71('0x45')](_0x282ce3);})['then'](function(_0x213099){_0x4c0ec6['rows']=_0x213099;return _0x4c0ec6;})[_0xfd71('0x29')](respondWithFilteredResult(_0x287d51,_0x282ce3))['catch'](handleError(_0x287d51,null));};exports['show']=function(_0x24c0c5,_0xe35492){var _0x18b306={'raw':!![],'where':{'id':_0x24c0c5[_0xfd71('0x46')]['id']}},_0x5363fb={};_0x5363fb[_0xfd71('0x36')]=_[_0xfd71('0x38')](db['Template']['rawAttributes']);_0x5363fb['query']=_['keys'](_0x24c0c5[_0xfd71('0x37')]);_0x5363fb[_0xfd71('0x39')]=_[_0xfd71('0x3a')](_0x5363fb['model'],_0x5363fb[_0xfd71('0x37')]);_0x18b306[_0xfd71('0x3c')]=_[_0xfd71('0x3a')](_0x5363fb[_0xfd71('0x36')],qs['fields'](_0x24c0c5[_0xfd71('0x37')][_0xfd71('0x3b')]));_0x18b306['attributes']=_0x18b306[_0xfd71('0x3c')][_0xfd71('0x3d')]?_0x18b306['attributes']:_0x5363fb[_0xfd71('0x36')];if(_0x24c0c5[_0xfd71('0x37')][_0xfd71('0x47')]){_0x18b306['include']=[{'all':!![]}];}_0x18b306=_[_0xfd71('0x41')]({},_0x18b306,_0x24c0c5['options']);return db[_0xfd71('0x31')][_0xfd71('0x48')](_0x18b306)[_0xfd71('0x29')](handleEntityNotFound(_0xe35492,null))[_0xfd71('0x29')](respondWithResult(_0xe35492,null))[_0xfd71('0x49')](handleError(_0xe35492,null));};exports[_0xfd71('0x4a')]=function(_0x2ab4be,_0x3449a5){return db[_0xfd71('0x31')]['create'](_0x2ab4be[_0xfd71('0x4b')],{})[_0xfd71('0x29')](function(_0x327ba9){var _0x39a4ee=_0x2ab4be[_0xfd71('0x4c')][_0xfd71('0x4d')]({'plain':!![]});if(!_0x39a4ee)throw new Error(_0xfd71('0x4e'));if(_0x39a4ee['role']===_0xfd71('0x4c')){var _0x2b7f2a=_0x327ba9[_0xfd71('0x4d')]({'plain':!![]});var _0x5b5743=_0xfd71('0x2a');return db[_0xfd71('0x4f')][_0xfd71('0x48')]({'where':{'name':_0x5b5743,'userProfileId':_0x39a4ee[_0xfd71('0x50')]},'raw':!![]})[_0xfd71('0x29')](function(_0x21ab55){if(_0x21ab55&&_0x21ab55[_0xfd71('0x51')]===0x0){return db[_0xfd71('0x2b')]['create']({'name':_0x2b7f2a['name'],'resourceId':_0x2b7f2a['id'],'type':_0x21ab55[_0xfd71('0x2e')],'sectionId':_0x21ab55['id']},{})[_0xfd71('0x29')](function(){return _0x327ba9;});}else{return _0x327ba9;}})[_0xfd71('0x49')](function(_0x4a0bf7){logger[_0xfd71('0x2c')](_0xfd71('0x52'),_0x4a0bf7);throw _0x4a0bf7;});}return _0x327ba9;})[_0xfd71('0x29')](respondWithResult(_0x3449a5,0xc9))[_0xfd71('0x49')](handleError(_0x3449a5,null));};exports[_0xfd71('0x27')]=function(_0x8f4dd1,_0x8aa936){if(_0x8f4dd1[_0xfd71('0x4b')]['id']){delete _0x8f4dd1[_0xfd71('0x4b')]['id'];}return db[_0xfd71('0x31')][_0xfd71('0x48')]({'where':{'id':_0x8f4dd1[_0xfd71('0x46')]['id']}})['then'](handleEntityNotFound(_0x8aa936,null))['then'](saveUpdates(_0x8f4dd1[_0xfd71('0x4b')],null))[_0xfd71('0x29')](respondWithResult(_0x8aa936,null))[_0xfd71('0x49')](handleError(_0x8aa936,null));};exports[_0xfd71('0x28')]=function(_0x409d25,_0x1e47d3){return db[_0xfd71('0x31')][_0xfd71('0x48')]({'where':{'id':_0x409d25['params']['id']}})[_0xfd71('0x29')](handleEntityNotFound(_0x1e47d3,null))[_0xfd71('0x29')](removeEntity(_0x1e47d3,null))['catch'](handleError(_0x1e47d3,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 086cbba..0916dc1 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 _0x84ac=['request-promise','path','rimraf','./template.attributes','exports','define','lodash','api','moment'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x84ac,0xd5));var _0xc84a=function(_0x1f6437,_0x59ef95){_0x1f6437=_0x1f6437-0x0;var _0x19d158=_0x84ac[_0x1f6437];return _0x19d158;};'use strict';var _=require(_0xc84a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc84a('0x1'));var moment=require(_0xc84a('0x2'));var BPromise=require('bluebird');var rp=require(_0xc84a('0x3'));var fs=require('fs');var path=require(_0xc84a('0x4'));var rimraf=require(_0xc84a('0x5'));var config=require('../../config/environment');var attributes=require(_0xc84a('0x6'));module[_0xc84a('0x7')]=function(_0x19cd48,_0x3f56c4){return _0x19cd48[_0xc84a('0x8')]('Template',attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xab7f=['moment','bluebird','request-promise','path','rimraf','./template.attributes','define','Template','tools_templates','util','../../config/logger','api'];(function(_0x4178af,_0x388652){var _0x20f4b1=function(_0x504188){while(--_0x504188){_0x4178af['push'](_0x4178af['shift']());}};_0x20f4b1(++_0x388652);}(_0xab7f,0x159));var _0xfab7=function(_0xd9d52c,_0x49ca2e){_0xd9d52c=_0xd9d52c-0x0;var _0x510361=_0xab7f[_0xd9d52c];return _0x510361;};'use strict';var _=require('lodash');var util=require(_0xfab7('0x0'));var logger=require(_0xfab7('0x1'))(_0xfab7('0x2'));var moment=require(_0xfab7('0x3'));var BPromise=require(_0xfab7('0x4'));var rp=require(_0xfab7('0x5'));var fs=require('fs');var path=require(_0xfab7('0x6'));var rimraf=require(_0xfab7('0x7'));var config=require('../../config/environment');var attributes=require(_0xfab7('0x8'));module['exports']=function(_0x5175f0,_0x42fde4){return _0x5175f0[_0xfab7('0x9')](_0xfab7('0xa'),attributes,{'tableName':_0xfab7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index cd2e26d..f6bf825 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 _0x9ef5=['../../config/logger','rpc','jayson/promise','client','http','then','debug','Template,\x20%s,\x20%s,\x20%s','error','code','message','Template,\x20%s,\x20%s','info','request\x20sent','result','catch','GetTemplate','findAll','options','raw','where','attributes','limit','map','include','model','stringify','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x7d62cb,_0x7622c){var _0x3a6266=function(_0x1cc5fa){while(--_0x1cc5fa){_0x7d62cb['push'](_0x7d62cb['shift']());}};_0x3a6266(++_0x7622c);}(_0x9ef5,0x1a7));var _0x59ef=function(_0x3de7e0,_0x28cbff){_0x3de7e0=_0x3de7e0-0x0;var _0x11d0b3=_0x9ef5[_0x3de7e0];return _0x11d0b3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x59ef('0x0'));var BPromise=require(_0x59ef('0x1'));var rs=require(_0x59ef('0x2'));var fs=require('fs');var Redis=require(_0x59ef('0x3'));var db=require(_0x59ef('0x4'))['db'];var utils=require(_0x59ef('0x5'));var logger=require(_0x59ef('0x6'))(_0x59ef('0x7'));var config=require('../../config/environment');var jayson=require(_0x59ef('0x8'));var client=jayson[_0x59ef('0x9')][_0x59ef('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a7058,_0x4ac342,_0x537024){return new BPromise(function(_0x1a7179,_0x153e35){return client['request'](_0x2a7058,_0x537024)[_0x59ef('0xb')](function(_0x494c6c){logger['info']('Template,\x20%s,\x20%s',_0x4ac342,'request\x20sent');logger[_0x59ef('0xc')](_0x59ef('0xd'),_0x4ac342,'request\x20sent',JSON['stringify'](_0x494c6c));if(_0x494c6c[_0x59ef('0xe')]){if(_0x494c6c[_0x59ef('0xe')][_0x59ef('0xf')]===0x1f4){logger['error']('Template,\x20%s,\x20%s',_0x4ac342,_0x494c6c['error']['message']);return _0x153e35(_0x494c6c[_0x59ef('0xe')][_0x59ef('0x10')]);}logger[_0x59ef('0xe')](_0x59ef('0x11'),_0x4ac342,_0x494c6c[_0x59ef('0xe')]['message']);return _0x1a7179(_0x494c6c[_0x59ef('0xe')][_0x59ef('0x10')]);}else{logger[_0x59ef('0x12')](_0x59ef('0x11'),_0x4ac342,_0x59ef('0x13'));_0x1a7179(_0x494c6c[_0x59ef('0x14')][_0x59ef('0x10')]);}})[_0x59ef('0x15')](function(_0x535954){logger[_0x59ef('0xe')]('Template,\x20%s,\x20%s',_0x4ac342,_0x535954);_0x153e35(_0x535954);});});}exports[_0x59ef('0x16')]=function(_0x359a9e){var _0x12c386=this;return new Promise(function(_0x394eae,_0x22ae2e){return db['Template'][_0x59ef('0x17')]({'raw':_0x359a9e[_0x59ef('0x18')]?_0x359a9e['options'][_0x59ef('0x19')]===undefined?!![]:![]:!![],'where':_0x359a9e[_0x59ef('0x18')]?_0x359a9e[_0x59ef('0x18')][_0x59ef('0x1a')]||null:null,'attributes':_0x359a9e[_0x59ef('0x18')]?_0x359a9e[_0x59ef('0x18')][_0x59ef('0x1b')]||null:null,'limit':_0x359a9e[_0x59ef('0x18')]?_0x359a9e[_0x59ef('0x18')][_0x59ef('0x1c')]||null:null,'include':_0x359a9e[_0x59ef('0x18')]?_0x359a9e[_0x59ef('0x18')]['include']?_[_0x59ef('0x1d')](_0x359a9e[_0x59ef('0x18')][_0x59ef('0x1e')],function(_0x12587b){return{'model':db[_0x12587b[_0x59ef('0x1f')]],'as':_0x12587b['as'],'attributes':_0x12587b[_0x59ef('0x1b')],'include':_0x12587b[_0x59ef('0x1e')]?_[_0x59ef('0x1d')](_0x12587b['include'],function(_0x221f7a){return{'model':db[_0x221f7a[_0x59ef('0x1f')]],'as':_0x221f7a['as'],'attributes':_0x221f7a[_0x59ef('0x1b')],'include':_0x221f7a['include']?_[_0x59ef('0x1d')](_0x221f7a[_0x59ef('0x1e')],function(_0x2cbba4){return{'model':db[_0x2cbba4[_0x59ef('0x1f')]],'as':_0x2cbba4['as'],'attributes':_0x2cbba4[_0x59ef('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x146d61){logger[_0x59ef('0x12')]('GetTemplate',_0x359a9e);logger[_0x59ef('0xc')](_0x59ef('0x16'),_0x359a9e,JSON[_0x59ef('0x20')](_0x146d61));_0x394eae(_0x146d61);})[_0x59ef('0x15')](function(_0x5fa719){logger[_0x59ef('0xe')](_0x59ef('0x16'),_0x5fa719['message'],_0x359a9e);_0x22ae2e(_0x12c386[_0x59ef('0xe')](0x1f4,_0x5fa719[_0x59ef('0x10')]));});});}; \ No newline at end of file +var _0x63db=['request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTemplate','Template','findAll','options','raw','where','attributes','limit','include','model','map','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Template,\x20%s,\x20%s'];(function(_0x2945d3,_0x63b00f){var _0x10282b=function(_0x378bf7){while(--_0x378bf7){_0x2945d3['push'](_0x2945d3['shift']());}};_0x10282b(++_0x63b00f);}(_0x63db,0x117));var _0xb63d=function(_0x5e2c14,_0xd9609e){_0x5e2c14=_0x5e2c14-0x0;var _0x102ccd=_0x63db[_0x5e2c14];return _0x102ccd;};'use strict';var _=require('lodash');var util=require(_0xb63d('0x0'));var moment=require(_0xb63d('0x1'));var BPromise=require(_0xb63d('0x2'));var rs=require(_0xb63d('0x3'));var fs=require('fs');var Redis=require(_0xb63d('0x4'));var db=require(_0xb63d('0x5'))['db'];var utils=require(_0xb63d('0x6'));var logger=require(_0xb63d('0x7'))(_0xb63d('0x8'));var config=require(_0xb63d('0x9'));var jayson=require(_0xb63d('0xa'));var client=jayson[_0xb63d('0xb')][_0xb63d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x198bd7,_0x3290a5,_0x195ee0){return new BPromise(function(_0x5cf650,_0x4062ff){return client[_0xb63d('0xd')](_0x198bd7,_0x195ee0)[_0xb63d('0xe')](function(_0x88f21){logger[_0xb63d('0xf')](_0xb63d('0x10'),_0x3290a5,_0xb63d('0x11'));logger[_0xb63d('0x12')](_0xb63d('0x13'),_0x3290a5,_0xb63d('0x11'),JSON[_0xb63d('0x14')](_0x88f21));if(_0x88f21[_0xb63d('0x15')]){if(_0x88f21[_0xb63d('0x15')][_0xb63d('0x16')]===0x1f4){logger['error']('Template,\x20%s,\x20%s',_0x3290a5,_0x88f21[_0xb63d('0x15')][_0xb63d('0x17')]);return _0x4062ff(_0x88f21['error'][_0xb63d('0x17')]);}logger[_0xb63d('0x15')]('Template,\x20%s,\x20%s',_0x3290a5,_0x88f21['error'][_0xb63d('0x17')]);return _0x5cf650(_0x88f21[_0xb63d('0x15')][_0xb63d('0x17')]);}else{logger[_0xb63d('0xf')](_0xb63d('0x10'),_0x3290a5,'request\x20sent');_0x5cf650(_0x88f21[_0xb63d('0x18')][_0xb63d('0x17')]);}})[_0xb63d('0x19')](function(_0x5904c8){logger[_0xb63d('0x15')](_0xb63d('0x10'),_0x3290a5,_0x5904c8);_0x4062ff(_0x5904c8);});});}exports[_0xb63d('0x1a')]=function(_0x5685f4){var _0x4b7efb=this;return new Promise(function(_0x22fdbf,_0x921c3){return db[_0xb63d('0x1b')][_0xb63d('0x1c')]({'raw':_0x5685f4[_0xb63d('0x1d')]?_0x5685f4[_0xb63d('0x1d')][_0xb63d('0x1e')]===undefined?!![]:![]:!![],'where':_0x5685f4[_0xb63d('0x1d')]?_0x5685f4[_0xb63d('0x1d')][_0xb63d('0x1f')]||null:null,'attributes':_0x5685f4[_0xb63d('0x1d')]?_0x5685f4[_0xb63d('0x1d')][_0xb63d('0x20')]||null:null,'limit':_0x5685f4[_0xb63d('0x1d')]?_0x5685f4[_0xb63d('0x1d')][_0xb63d('0x21')]||null:null,'include':_0x5685f4[_0xb63d('0x1d')]?_0x5685f4['options']['include']?_['map'](_0x5685f4['options'][_0xb63d('0x22')],function(_0x29f7e8){return{'model':db[_0x29f7e8[_0xb63d('0x23')]],'as':_0x29f7e8['as'],'attributes':_0x29f7e8['attributes'],'include':_0x29f7e8[_0xb63d('0x22')]?_[_0xb63d('0x24')](_0x29f7e8[_0xb63d('0x22')],function(_0x2180de){return{'model':db[_0x2180de['model']],'as':_0x2180de['as'],'attributes':_0x2180de[_0xb63d('0x20')],'include':_0x2180de[_0xb63d('0x22')]?_[_0xb63d('0x24')](_0x2180de[_0xb63d('0x22')],function(_0x3dcc71){return{'model':db[_0x3dcc71['model']],'as':_0x3dcc71['as'],'attributes':_0x3dcc71[_0xb63d('0x20')]};}):[]};}):[]};}):[]:[]})[_0xb63d('0xe')](function(_0x1eb2d2){logger[_0xb63d('0xf')](_0xb63d('0x1a'),_0x5685f4);logger[_0xb63d('0x12')](_0xb63d('0x1a'),_0x5685f4,JSON[_0xb63d('0x14')](_0x1eb2d2));_0x22fdbf(_0x1eb2d2);})[_0xb63d('0x19')](function(_0x49c939){logger[_0xb63d('0x15')](_0xb63d('0x1a'),_0x49c939[_0xb63d('0x17')],_0x5685f4);_0x921c3(_0x4b7efb[_0xb63d('0x15')](0x1f4,_0x49c939[_0xb63d('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 3b689b1..127120f 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 _0x9529=['./trigger.controller','get','isAuthenticated','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','post','create','/:id/actions','addAction','put','/:id','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x2a66a4,_0x43654e){var _0x76d611=function(_0xac6610){while(--_0xac6610){_0x2a66a4['push'](_0x2a66a4['shift']());}};_0x76d611(++_0x43654e);}(_0x9529,0x1f1));var _0x9952=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9529[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x9952('0x0'));var util=require(_0x9952('0x1'));var path=require('path');var timeout=require(_0x9952('0x2'));var express=require(_0x9952('0x3'));var router=express[_0x9952('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9952('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9952('0x6'));var controller=require(_0x9952('0x7'));router[_0x9952('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9952('0x8')]('/:id',auth[_0x9952('0x9')](),controller[_0x9952('0xa')]);router[_0x9952('0x8')](_0x9952('0xb'),auth['isAuthenticated'](),controller[_0x9952('0xc')]);router['get'](_0x9952('0xd'),auth['isAuthenticated'](),controller[_0x9952('0xe')]);router['get']('/:id/actions',auth[_0x9952('0x9')](),controller['getActions']);router[_0x9952('0xf')]('/',auth[_0x9952('0x9')](),controller[_0x9952('0x10')]);router['post'](_0x9952('0xb'),auth[_0x9952('0x9')](),controller['addAllCondition']);router[_0x9952('0xf')](_0x9952('0xd'),auth[_0x9952('0x9')](),controller['addAnyCondition']);router[_0x9952('0xf')](_0x9952('0x11'),auth['isAuthenticated'](),controller[_0x9952('0x12')]);router[_0x9952('0x13')](_0x9952('0x14'),auth[_0x9952('0x9')](),controller[_0x9952('0x15')]);router[_0x9952('0x16')]('/:id',auth[_0x9952('0x9')](),controller[_0x9952('0x17')]);module['exports']=router; \ No newline at end of file +var _0x0b4b=['connect-timeout','Router','../../components/auth/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id','show','/:id/all_conditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','create','post','addAllCondition','addAnyCondition','addAction','put','delete','destroy','exports','multer','path'];(function(_0x31391a,_0x2b46bf){var _0x27e546=function(_0x121f76){while(--_0x121f76){_0x31391a['push'](_0x31391a['shift']());}};_0x27e546(++_0x2b46bf);}(_0x0b4b,0x16a));var _0xb0b4=function(_0xef8146,_0x459c34){_0xef8146=_0xef8146-0x0;var _0x5a6cb0=_0x0b4b[_0xef8146];return _0x5a6cb0;};'use strict';var multer=require(_0xb0b4('0x0'));var util=require('util');var path=require(_0xb0b4('0x1'));var timeout=require(_0xb0b4('0x2'));var express=require('express');var router=express[_0xb0b4('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb0b4('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb0b4('0x5'));var controller=require(_0xb0b4('0x6'));router[_0xb0b4('0x7')]('/',auth[_0xb0b4('0x8')](),controller[_0xb0b4('0x9')]);router[_0xb0b4('0x7')](_0xb0b4('0xa'),auth[_0xb0b4('0x8')](),controller[_0xb0b4('0xb')]);router['get'](_0xb0b4('0xc'),auth[_0xb0b4('0x8')](),controller['getAllConditions']);router[_0xb0b4('0x7')](_0xb0b4('0xd'),auth[_0xb0b4('0x8')](),controller[_0xb0b4('0xe')]);router['get'](_0xb0b4('0xf'),auth[_0xb0b4('0x8')](),controller[_0xb0b4('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb0b4('0x11')]);router[_0xb0b4('0x12')](_0xb0b4('0xc'),auth['isAuthenticated'](),controller[_0xb0b4('0x13')]);router[_0xb0b4('0x12')](_0xb0b4('0xd'),auth[_0xb0b4('0x8')](),controller[_0xb0b4('0x14')]);router[_0xb0b4('0x12')](_0xb0b4('0xf'),auth[_0xb0b4('0x8')](),controller[_0xb0b4('0x15')]);router[_0xb0b4('0x16')](_0xb0b4('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xb0b4('0x17')]('/:id',auth[_0xb0b4('0x8')](),controller[_0xb0b4('0x18')]);module[_0xb0b4('0x19')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 37da6a0..e1a5e72 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 _0x1a64=['STRING','BOOLEAN','sequelize','exports'];(function(_0x14bbf2,_0x1f1bc9){var _0xb1ee82=function(_0x816210){while(--_0x816210){_0x14bbf2['push'](_0x14bbf2['shift']());}};_0xb1ee82(++_0x1f1bc9);}(_0x1a64,0x1d6));var _0x41a6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1a64[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x41a6('0x0'));module[_0x41a6('0x1')]={'name':{'type':Sequelize[_0x41a6('0x2')]},'channel':{'type':Sequelize[_0x41a6('0x2')]},'description':{'type':Sequelize[_0x41a6('0x2')]},'status':{'type':Sequelize[_0x41a6('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x6143=['sequelize','exports','STRING'];(function(_0x5cd6e3,_0x24eb7c){var _0x147b07=function(_0x49f585){while(--_0x49f585){_0x5cd6e3['push'](_0x5cd6e3['shift']());}};_0x147b07(++_0x24eb7c);}(_0x6143,0x117));var _0x3614=function(_0x1a9c56,_0x1fd1c4){_0x1a9c56=_0x1a9c56-0x0;var _0x53d7a4=_0x6143[_0x1a9c56];return _0x53d7a4;};'use strict';var Sequelize=require(_0x3614('0x0'));module[_0x3614('0x1')]={'name':{'type':Sequelize[_0x3614('0x2')]},'channel':{'type':Sequelize[_0x3614('0x2')]},'description':{'type':Sequelize[_0x3614('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index e8f7fb3..41b612d 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 _0xf7d5=['rawAttributes','fieldName','type','key','model','name','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Triggers','UserProfileSection','userProfileId','autoAssociation','update','params','addAllCondition','TriggerAllId','addAnyCondition','TriggerAnyId','getAllConditions','findOne','Condition','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','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','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','save','then','destroy','get','UserProfileResource','end','sendStatus','stack','map','Trigger'];(function(_0x13f899,_0x1a88d6){var _0x3f6f91=function(_0x44ad4e){while(--_0x44ad4e){_0x13f899['push'](_0x13f899['shift']());}};_0x3f6f91(++_0x1a88d6);}(_0xf7d5,0x1b5));var _0x5f7d=function(_0xb4bed2,_0x1ba3db){_0xb4bed2=_0xb4bed2-0x0;var _0x17a2a5=_0xf7d5[_0xb4bed2];return _0x17a2a5;};'use strict';var emlformat=require(_0x5f7d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5f7d('0x1'));var jsonpatch=require(_0x5f7d('0x2'));var rp=require(_0x5f7d('0x3'));var moment=require(_0x5f7d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5f7d('0x5'));var util=require(_0x5f7d('0x6'));var path=require('path');var sox=require(_0x5f7d('0x7'));var csv=require(_0x5f7d('0x8'));var ejs=require(_0x5f7d('0x9'));var fs=require('fs');var fs_extra=require(_0x5f7d('0xa'));var _=require(_0x5f7d('0xb'));var squel=require('squel');var crypto=require(_0x5f7d('0xc'));var jsforce=require(_0x5f7d('0xd'));var deskjs=require(_0x5f7d('0xe'));var toCsv=require(_0x5f7d('0x8'));var querystring=require(_0x5f7d('0xf'));var Papa=require(_0x5f7d('0x10'));var Redis=require('ioredis');var authService=require(_0x5f7d('0x11'));var qs=require(_0x5f7d('0x12'));var as=require(_0x5f7d('0x13'));var hardwareService=require(_0x5f7d('0x14'));var logger=require('../../config/logger')(_0x5f7d('0x15'));var utils=require('../../config/utils');var config=require(_0x5f7d('0x16'));var licenseUtil=require(_0x5f7d('0x17'));var db=require(_0x5f7d('0x18'))['db'];function respondWithStatusCode(_0x38fdec,_0x4f5925){_0x4f5925=_0x4f5925||0xcc;return function(_0x480484){if(_0x480484){return _0x38fdec['sendStatus'](_0x4f5925);}return _0x38fdec[_0x5f7d('0x19')](_0x4f5925)['end']();};}function respondWithResult(_0x1c8f7a,_0x294de1){_0x294de1=_0x294de1||0xc8;return function(_0x4356b8){if(_0x4356b8){return _0x1c8f7a['status'](_0x294de1)[_0x5f7d('0x1a')](_0x4356b8);}};}function respondWithFilteredResult(_0xdab969,_0x2fdfd8){return function(_0x4b87b6){if(_0x4b87b6){var _0x2197c7=typeof _0x2fdfd8[_0x5f7d('0x1b')]===_0x5f7d('0x1c')&&typeof _0x2fdfd8[_0x5f7d('0x1d')]===_0x5f7d('0x1c');var _0x521618=_0x4b87b6[_0x5f7d('0x1e')];var _0x2fd7c9=_0x2197c7?0x0:_0x2fdfd8[_0x5f7d('0x1b')];var _0x58cc29=_0x2197c7?_0x4b87b6[_0x5f7d('0x1e')]:_0x2fdfd8['offset']+_0x2fdfd8[_0x5f7d('0x1d')];var _0x53467c;if(_0x58cc29>=_0x521618){_0x58cc29=_0x521618;_0x53467c=0xc8;}else{_0x53467c=0xce;}_0xdab969[_0x5f7d('0x19')](_0x53467c);return _0xdab969[_0x5f7d('0x1f')](_0x5f7d('0x20'),_0x2fd7c9+'-'+_0x58cc29+'/'+_0x521618)['json'](_0x4b87b6);}return null;};}function patchUpdates(_0x120644){return function(_0x48437c){try{jsonpatch['apply'](_0x48437c,_0x120644,!![]);}catch(_0x25199b){return BPromise['reject'](_0x25199b);}return _0x48437c[_0x5f7d('0x21')]();};}function saveUpdates(_0x4b6725,_0x1a528b){return function(_0x33d6fb){if(_0x33d6fb){return _0x33d6fb['update'](_0x4b6725)[_0x5f7d('0x22')](function(_0x3d4b83){return _0x3d4b83;});}return null;};}function removeEntity(_0x32386d,_0x127854){return function(_0x5bf527){if(_0x5bf527){return _0x5bf527[_0x5f7d('0x23')]()[_0x5f7d('0x22')](function(){var _0x495a37=_0x5bf527[_0x5f7d('0x24')]({'plain':!![]});var _0x25fdfa='Triggers';return db[_0x5f7d('0x25')][_0x5f7d('0x23')]({'where':{'type':_0x25fdfa,'resourceId':_0x495a37['id']}})['then'](function(){return _0x5bf527;});})[_0x5f7d('0x22')](function(){_0x32386d[_0x5f7d('0x19')](0xcc)[_0x5f7d('0x26')]();});}};}function handleEntityNotFound(_0x2f79a2,_0x45e5a6){return function(_0x4057e6){if(!_0x4057e6){_0x2f79a2[_0x5f7d('0x27')](0x194);}return _0x4057e6;};}function handleError(_0x1ec236,_0x232cd9){_0x232cd9=_0x232cd9||0x1f4;return function(_0x3c436e){logger['error'](_0x3c436e[_0x5f7d('0x28')]);if(_0x3c436e['name']){delete _0x3c436e['name'];}_0x1ec236[_0x5f7d('0x19')](_0x232cd9)['send'](_0x3c436e);};}exports['index']=function(_0x4fe4d9,_0x9dd1f0){var _0x49d93e={},_0x510351={},_0x3eedba={'count':0x0,'rows':[]};var _0x51aca4=_[_0x5f7d('0x29')](db[_0x5f7d('0x2a')][_0x5f7d('0x2b')],function(_0x98ab98){return{'name':_0x98ab98[_0x5f7d('0x2c')],'type':_0x98ab98[_0x5f7d('0x2d')][_0x5f7d('0x2e')]};});_0x510351[_0x5f7d('0x2f')]=_[_0x5f7d('0x29')](_0x51aca4,_0x5f7d('0x30'));_0x510351['query']=_[_0x5f7d('0x31')](_0x4fe4d9[_0x5f7d('0x32')]);_0x510351['filters']=_[_0x5f7d('0x33')](_0x510351[_0x5f7d('0x2f')],_0x510351[_0x5f7d('0x32')]);_0x49d93e[_0x5f7d('0x34')]=_[_0x5f7d('0x33')](_0x510351[_0x5f7d('0x2f')],qs[_0x5f7d('0x35')](_0x4fe4d9[_0x5f7d('0x32')]['fields']));_0x49d93e[_0x5f7d('0x34')]=_0x49d93e['attributes']['length']?_0x49d93e['attributes']:_0x510351[_0x5f7d('0x2f')];if(!_0x4fe4d9['query'][_0x5f7d('0x36')](_0x5f7d('0x37'))){_0x49d93e[_0x5f7d('0x1d')]=qs[_0x5f7d('0x1d')](_0x4fe4d9[_0x5f7d('0x32')][_0x5f7d('0x1d')]);_0x49d93e[_0x5f7d('0x1b')]=qs[_0x5f7d('0x1b')](_0x4fe4d9['query'][_0x5f7d('0x1b')]);}_0x49d93e[_0x5f7d('0x38')]=qs['sort'](_0x4fe4d9['query'][_0x5f7d('0x39')]);_0x49d93e['where']=qs[_0x5f7d('0x3a')](_[_0x5f7d('0x3b')](_0x4fe4d9[_0x5f7d('0x32')],_0x510351[_0x5f7d('0x3a')]),_0x51aca4);if(_0x4fe4d9[_0x5f7d('0x32')][_0x5f7d('0x3c')]){_0x49d93e[_0x5f7d('0x3d')]=_[_0x5f7d('0x3e')](_0x49d93e[_0x5f7d('0x3d')],{'$or':_[_0x5f7d('0x29')](_0x51aca4,function(_0x499b3f){if(_0x499b3f[_0x5f7d('0x2d')]!==_0x5f7d('0x3f')){var _0x1caa19={};_0x1caa19[_0x499b3f[_0x5f7d('0x30')]]={'$like':'%'+_0x4fe4d9[_0x5f7d('0x32')]['filter']+'%'};return _0x1caa19;}})});}_0x49d93e=_[_0x5f7d('0x3e')]({},_0x49d93e,_0x4fe4d9[_0x5f7d('0x40')]);var _0x78db2b={'where':_0x49d93e[_0x5f7d('0x3d')]};return db['Trigger']['count'](_0x78db2b)[_0x5f7d('0x22')](function(_0x22c80f){_0x3eedba['count']=_0x22c80f;if(_0x4fe4d9['query'][_0x5f7d('0x41')]){_0x49d93e[_0x5f7d('0x42')]=[{'all':!![]}];}return db['Trigger'][_0x5f7d('0x43')](_0x49d93e);})[_0x5f7d('0x22')](function(_0x5637db){_0x3eedba[_0x5f7d('0x44')]=_0x5637db;return _0x3eedba;})[_0x5f7d('0x22')](respondWithFilteredResult(_0x9dd1f0,_0x49d93e))[_0x5f7d('0x45')](handleError(_0x9dd1f0,null));};exports[_0x5f7d('0x46')]=function(_0x130d1d,_0x341037){var _0x3fae2f={'raw':![],'where':{'id':_0x130d1d['params']['id']}},_0x155241={};_0x155241[_0x5f7d('0x2f')]=_[_0x5f7d('0x31')](db[_0x5f7d('0x2a')][_0x5f7d('0x2b')]);_0x155241['query']=_['keys'](_0x130d1d['query']);_0x155241[_0x5f7d('0x3a')]=_[_0x5f7d('0x33')](_0x155241[_0x5f7d('0x2f')],_0x155241[_0x5f7d('0x32')]);_0x3fae2f[_0x5f7d('0x34')]=_[_0x5f7d('0x33')](_0x155241[_0x5f7d('0x2f')],qs[_0x5f7d('0x35')](_0x130d1d[_0x5f7d('0x32')][_0x5f7d('0x35')]));_0x3fae2f[_0x5f7d('0x34')]=_0x3fae2f[_0x5f7d('0x34')][_0x5f7d('0x47')]?_0x3fae2f[_0x5f7d('0x34')]:_0x155241[_0x5f7d('0x2f')];if(_0x130d1d[_0x5f7d('0x32')]['includeAll']){_0x3fae2f[_0x5f7d('0x42')]=[{'all':!![]}];}_0x3fae2f=_['merge']({},_0x3fae2f,_0x130d1d['options']);return db['Trigger'][_0x5f7d('0x48')](_0x3fae2f)[_0x5f7d('0x22')](handleEntityNotFound(_0x341037,null))['then'](respondWithResult(_0x341037,null))['catch'](handleError(_0x341037,null));};exports['create']=function(_0xe40aa7,_0x125da6){return db['Trigger'][_0x5f7d('0x49')](_0xe40aa7[_0x5f7d('0x4a')],{})[_0x5f7d('0x22')](function(_0x1138f4){var _0x109bb0=_0xe40aa7[_0x5f7d('0x4b')][_0x5f7d('0x24')]({'plain':!![]});if(!_0x109bb0)throw new Error(_0x5f7d('0x4c'));if(_0x109bb0[_0x5f7d('0x4d')]===_0x5f7d('0x4b')){var _0x1b7e03=_0x1138f4[_0x5f7d('0x24')]({'plain':!![]});var _0x145731=_0x5f7d('0x4e');return db[_0x5f7d('0x4f')][_0x5f7d('0x48')]({'where':{'name':_0x145731,'userProfileId':_0x109bb0[_0x5f7d('0x50')]},'raw':!![]})['then'](function(_0x5cb88d){if(_0x5cb88d&&_0x5cb88d[_0x5f7d('0x51')]===0x0){return db[_0x5f7d('0x25')][_0x5f7d('0x49')]({'name':_0x1b7e03[_0x5f7d('0x30')],'resourceId':_0x1b7e03['id'],'type':_0x5cb88d['name'],'sectionId':_0x5cb88d['id']},{})[_0x5f7d('0x22')](function(){return _0x1138f4;});}else{return _0x1138f4;}})[_0x5f7d('0x45')](function(_0x55ba08){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x55ba08);throw _0x55ba08;});}return _0x1138f4;})['then'](respondWithResult(_0x125da6,0xc9))['catch'](handleError(_0x125da6,null));};exports[_0x5f7d('0x52')]=function(_0xac1eef,_0x22b5d5){if(_0xac1eef[_0x5f7d('0x4a')]['id']){delete _0xac1eef[_0x5f7d('0x4a')]['id'];}return db[_0x5f7d('0x2a')][_0x5f7d('0x48')]({'where':{'id':_0xac1eef[_0x5f7d('0x53')]['id']}})[_0x5f7d('0x22')](handleEntityNotFound(_0x22b5d5,null))[_0x5f7d('0x22')](saveUpdates(_0xac1eef[_0x5f7d('0x4a')],null))[_0x5f7d('0x22')](respondWithResult(_0x22b5d5,null))['catch'](handleError(_0x22b5d5,null));};exports[_0x5f7d('0x23')]=function(_0x1be231,_0x4ab99f){return db[_0x5f7d('0x2a')][_0x5f7d('0x48')]({'where':{'id':_0x1be231['params']['id']}})[_0x5f7d('0x22')](handleEntityNotFound(_0x4ab99f,null))[_0x5f7d('0x22')](removeEntity(_0x4ab99f,null))[_0x5f7d('0x45')](handleError(_0x4ab99f,null));};exports[_0x5f7d('0x54')]=function(_0x40cf07,_0x4654f1,_0x23121a){if(_0x40cf07[_0x5f7d('0x4a')]['id']){delete _0x40cf07['body']['id'];}return db[_0x5f7d('0x2a')][_0x5f7d('0x48')]({'where':{'id':_0x40cf07[_0x5f7d('0x53')]['id']}})['then'](handleEntityNotFound(_0x4654f1,null))['then'](function(_0x483fd2){if(_0x483fd2){_0x40cf07['body'][_0x5f7d('0x55')]=_0x483fd2['id'];return db['Condition'][_0x5f7d('0x49')](_0x40cf07['body']);}})[_0x5f7d('0x22')](respondWithResult(_0x4654f1,null))[_0x5f7d('0x45')](handleError(_0x4654f1,null));};exports[_0x5f7d('0x56')]=function(_0x2dfa71,_0x4c96f7,_0xa60afb){if(_0x2dfa71[_0x5f7d('0x4a')]['id']){delete _0x2dfa71['body']['id'];}return db[_0x5f7d('0x2a')][_0x5f7d('0x48')]({'where':{'id':_0x2dfa71['params']['id']}})[_0x5f7d('0x22')](handleEntityNotFound(_0x4c96f7,null))[_0x5f7d('0x22')](function(_0x49feff){if(_0x49feff){_0x2dfa71[_0x5f7d('0x4a')][_0x5f7d('0x57')]=_0x49feff['id'];return db['Condition']['create'](_0x2dfa71[_0x5f7d('0x4a')]);}})['then'](respondWithResult(_0x4c96f7,null))[_0x5f7d('0x45')](handleError(_0x4c96f7,null));};exports[_0x5f7d('0x58')]=function(_0xfc7eb6,_0x56c2bb,_0x544b57){var _0x1b48a6={};var _0x1a48a8={};var _0xd3a066;var _0x25c3ab;return db[_0x5f7d('0x2a')][_0x5f7d('0x59')]({'where':{'id':_0xfc7eb6[_0x5f7d('0x53')]['id']}})[_0x5f7d('0x22')](handleEntityNotFound(_0x56c2bb,null))['then'](function(_0x21d04f){if(_0x21d04f){_0xd3a066=_0x21d04f;_0x1a48a8[_0x5f7d('0x2f')]=_[_0x5f7d('0x31')](db[_0x5f7d('0x5a')][_0x5f7d('0x2b')]);_0x1a48a8[_0x5f7d('0x32')]=_['keys'](_0xfc7eb6[_0x5f7d('0x32')]);_0x1a48a8[_0x5f7d('0x3a')]=_[_0x5f7d('0x33')](_0x1a48a8[_0x5f7d('0x2f')],_0x1a48a8[_0x5f7d('0x32')]);_0x1b48a6[_0x5f7d('0x34')]=_['intersection'](_0x1a48a8[_0x5f7d('0x2f')],qs[_0x5f7d('0x35')](_0xfc7eb6[_0x5f7d('0x32')][_0x5f7d('0x35')]));_0x1b48a6['attributes']=_0x1b48a6['attributes'][_0x5f7d('0x47')]?_0x1b48a6[_0x5f7d('0x34')]:_0x1a48a8[_0x5f7d('0x2f')];_0x1b48a6[_0x5f7d('0x38')]=qs['sort'](_0xfc7eb6[_0x5f7d('0x32')][_0x5f7d('0x39')]);_0x1b48a6[_0x5f7d('0x3d')]=qs['filters'](_[_0x5f7d('0x3b')](_0xfc7eb6['query'],_0x1a48a8[_0x5f7d('0x3a')]));if(_0xfc7eb6['query'][_0x5f7d('0x3c')]){_0x1b48a6['where']=_['merge'](_0x1b48a6[_0x5f7d('0x3d')],{'$or':_['map'](_0x1b48a6[_0x5f7d('0x34')],function(_0x179f9e){var _0x141229={};_0x141229[_0x179f9e]={'$like':'%'+_0xfc7eb6[_0x5f7d('0x32')][_0x5f7d('0x3c')]+'%'};return _0x141229;})});}_0x1b48a6=_[_0x5f7d('0x3e')]({},_0x1b48a6,_0xfc7eb6[_0x5f7d('0x40')]);return _0xd3a066['getAllConditions'](_0x1b48a6);}})[_0x5f7d('0x22')](function(_0x25d933){if(_0x25d933){_0x25c3ab=_0x25d933[_0x5f7d('0x47')];if(!_0xfc7eb6[_0x5f7d('0x32')]['hasOwnProperty'](_0x5f7d('0x37'))){_0x1b48a6[_0x5f7d('0x1d')]=qs[_0x5f7d('0x1d')](_0xfc7eb6[_0x5f7d('0x32')][_0x5f7d('0x1d')]);_0x1b48a6[_0x5f7d('0x1b')]=qs[_0x5f7d('0x1b')](_0xfc7eb6[_0x5f7d('0x32')]['offset']);}return _0xd3a066['getAllConditions'](_0x1b48a6);}})[_0x5f7d('0x22')](function(_0x378ea6){if(_0x378ea6){return _0x378ea6?{'count':_0x25c3ab,'rows':_0x378ea6}:null;}})[_0x5f7d('0x22')](respondWithResult(_0x56c2bb,null))[_0x5f7d('0x45')](handleError(_0x56c2bb,null));};exports[_0x5f7d('0x5b')]=function(_0x433f7b,_0x808059,_0x4d9729){var _0x130f1b={};var _0x1c6478={};var _0x1c9300;var _0x3fad80;return db[_0x5f7d('0x2a')][_0x5f7d('0x59')]({'where':{'id':_0x433f7b['params']['id']}})[_0x5f7d('0x22')](handleEntityNotFound(_0x808059,null))[_0x5f7d('0x22')](function(_0x447482){if(_0x447482){_0x1c9300=_0x447482;_0x1c6478[_0x5f7d('0x2f')]=_[_0x5f7d('0x31')](db[_0x5f7d('0x5a')][_0x5f7d('0x2b')]);_0x1c6478['query']=_[_0x5f7d('0x31')](_0x433f7b['query']);_0x1c6478[_0x5f7d('0x3a')]=_[_0x5f7d('0x33')](_0x1c6478[_0x5f7d('0x2f')],_0x1c6478[_0x5f7d('0x32')]);_0x130f1b[_0x5f7d('0x34')]=_[_0x5f7d('0x33')](_0x1c6478[_0x5f7d('0x2f')],qs[_0x5f7d('0x35')](_0x433f7b[_0x5f7d('0x32')][_0x5f7d('0x35')]));_0x130f1b[_0x5f7d('0x34')]=_0x130f1b[_0x5f7d('0x34')]['length']?_0x130f1b[_0x5f7d('0x34')]:_0x1c6478[_0x5f7d('0x2f')];_0x130f1b['order']=qs[_0x5f7d('0x39')](_0x433f7b[_0x5f7d('0x32')][_0x5f7d('0x39')]);_0x130f1b[_0x5f7d('0x3d')]=qs[_0x5f7d('0x3a')](_[_0x5f7d('0x3b')](_0x433f7b['query'],_0x1c6478[_0x5f7d('0x3a')]));if(_0x433f7b[_0x5f7d('0x32')]['filter']){_0x130f1b['where']=_[_0x5f7d('0x3e')](_0x130f1b[_0x5f7d('0x3d')],{'$or':_['map'](_0x130f1b[_0x5f7d('0x34')],function(_0x190743){var _0x4f2229={};_0x4f2229[_0x190743]={'$like':'%'+_0x433f7b[_0x5f7d('0x32')][_0x5f7d('0x3c')]+'%'};return _0x4f2229;})});}_0x130f1b=_[_0x5f7d('0x3e')]({},_0x130f1b,_0x433f7b['options']);return _0x1c9300[_0x5f7d('0x5b')](_0x130f1b);}})[_0x5f7d('0x22')](function(_0x3d1d52){if(_0x3d1d52){_0x3fad80=_0x3d1d52[_0x5f7d('0x47')];if(!_0x433f7b[_0x5f7d('0x32')][_0x5f7d('0x36')](_0x5f7d('0x37'))){_0x130f1b[_0x5f7d('0x1d')]=qs[_0x5f7d('0x1d')](_0x433f7b[_0x5f7d('0x32')][_0x5f7d('0x1d')]);_0x130f1b[_0x5f7d('0x1b')]=qs[_0x5f7d('0x1b')](_0x433f7b['query'][_0x5f7d('0x1b')]);}return _0x1c9300[_0x5f7d('0x5b')](_0x130f1b);}})['then'](function(_0x2810e5){if(_0x2810e5){return _0x2810e5?{'count':_0x3fad80,'rows':_0x2810e5}:null;}})[_0x5f7d('0x22')](respondWithResult(_0x808059,null))[_0x5f7d('0x45')](handleError(_0x808059,null));};exports[_0x5f7d('0x5c')]=function(_0x4e2f81,_0x2b8e0f,_0x540d15){if(_0x4e2f81['body']['id']){delete _0x4e2f81[_0x5f7d('0x4a')]['id'];}return db[_0x5f7d('0x2a')]['find']({'where':{'id':_0x4e2f81['params']['id']}})[_0x5f7d('0x22')](handleEntityNotFound(_0x2b8e0f,null))[_0x5f7d('0x22')](function(_0x1a875f){if(_0x1a875f){_0x4e2f81[_0x5f7d('0x4a')][_0x5f7d('0x5d')]=_0x1a875f['id'];return db[_0x5f7d('0x5e')][_0x5f7d('0x49')](_0x4e2f81[_0x5f7d('0x4a')]);}})['then'](respondWithResult(_0x2b8e0f,null))['catch'](handleError(_0x2b8e0f,null));};exports[_0x5f7d('0x5f')]=function(_0xba9cc,_0x16c4ed,_0x39a861){var _0x5809cf={};var _0x349bfb={};var _0x53118d;var _0x30b100;return db[_0x5f7d('0x2a')][_0x5f7d('0x59')]({'where':{'id':_0xba9cc['params']['id']}})[_0x5f7d('0x22')](handleEntityNotFound(_0x16c4ed,null))['then'](function(_0x59015a){if(_0x59015a){_0x53118d=_0x59015a;_0x349bfb[_0x5f7d('0x2f')]=_[_0x5f7d('0x31')](db['Action'][_0x5f7d('0x2b')]);_0x349bfb[_0x5f7d('0x32')]=_['keys'](_0xba9cc['query']);_0x349bfb[_0x5f7d('0x3a')]=_[_0x5f7d('0x33')](_0x349bfb['model'],_0x349bfb['query']);_0x5809cf[_0x5f7d('0x34')]=_[_0x5f7d('0x33')](_0x349bfb[_0x5f7d('0x2f')],qs['fields'](_0xba9cc[_0x5f7d('0x32')]['fields']));_0x5809cf[_0x5f7d('0x34')]=_0x5809cf['attributes']['length']?_0x5809cf['attributes']:_0x349bfb['model'];_0x5809cf[_0x5f7d('0x38')]=qs['sort'](_0xba9cc[_0x5f7d('0x32')][_0x5f7d('0x39')]);_0x5809cf[_0x5f7d('0x3d')]=qs['filters'](_[_0x5f7d('0x3b')](_0xba9cc[_0x5f7d('0x32')],_0x349bfb['filters']));if(_0xba9cc[_0x5f7d('0x32')]['filter']){_0x5809cf['where']=_['merge'](_0x5809cf[_0x5f7d('0x3d')],{'$or':_['map'](_0x5809cf[_0x5f7d('0x34')],function(_0x73ecb6){var _0x57644c={};_0x57644c[_0x73ecb6]={'$like':'%'+_0xba9cc[_0x5f7d('0x32')][_0x5f7d('0x3c')]+'%'};return _0x57644c;})});}_0x5809cf=_[_0x5f7d('0x3e')]({},_0x5809cf,_0xba9cc['options']);return _0x53118d[_0x5f7d('0x5f')](_0x5809cf);}})[_0x5f7d('0x22')](function(_0x36685c){if(_0x36685c){_0x30b100=_0x36685c[_0x5f7d('0x47')];if(!_0xba9cc['query'][_0x5f7d('0x36')](_0x5f7d('0x37'))){_0x5809cf[_0x5f7d('0x1d')]=qs[_0x5f7d('0x1d')](_0xba9cc[_0x5f7d('0x32')][_0x5f7d('0x1d')]);_0x5809cf[_0x5f7d('0x1b')]=qs[_0x5f7d('0x1b')](_0xba9cc[_0x5f7d('0x32')]['offset']);}return _0x53118d[_0x5f7d('0x5f')](_0x5809cf);}})[_0x5f7d('0x22')](function(_0x52632a){if(_0x52632a){return _0x52632a?{'count':_0x30b100,'rows':_0x52632a}:null;}})['then'](respondWithResult(_0x16c4ed,null))[_0x5f7d('0x45')](handleError(_0x16c4ed,null));}; \ No newline at end of file +var _0x4841=['params','keys','includeAll','find','create','body','user','role','Triggers','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','addAnyCondition','getAllConditions','findOne','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','sendStatus','stack','name','map','Trigger','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show'];(function(_0xcb8fc6,_0x36987f){var _0x520ed5=function(_0x40ee37){while(--_0x40ee37){_0xcb8fc6['push'](_0xcb8fc6['shift']());}};_0x520ed5(++_0x36987f);}(_0x4841,0x130));var _0x1484=function(_0x4ae9e4,_0x22cc14){_0x4ae9e4=_0x4ae9e4-0x0;var _0x410375=_0x4841[_0x4ae9e4];return _0x410375;};'use strict';var emlformat=require(_0x1484('0x0'));var rimraf=require(_0x1484('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1484('0x2'));var rp=require('request-promise');var moment=require(_0x1484('0x3'));var BPromise=require(_0x1484('0x4'));var Mustache=require('mustache');var util=require(_0x1484('0x5'));var path=require(_0x1484('0x6'));var sox=require('sox');var csv=require(_0x1484('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1484('0x8'));var crypto=require(_0x1484('0x9'));var jsforce=require(_0x1484('0xa'));var deskjs=require(_0x1484('0xb'));var toCsv=require('to-csv');var querystring=require(_0x1484('0xc'));var Papa=require(_0x1484('0xd'));var Redis=require(_0x1484('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1484('0xf'));var hardwareService=require(_0x1484('0x10'));var logger=require(_0x1484('0x11'))(_0x1484('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1484('0x13'));var db=require(_0x1484('0x14'))['db'];function respondWithStatusCode(_0x603a93,_0xbc8325){_0xbc8325=_0xbc8325||0xcc;return function(_0x1643c1){if(_0x1643c1){return _0x603a93['sendStatus'](_0xbc8325);}return _0x603a93[_0x1484('0x15')](_0xbc8325)[_0x1484('0x16')]();};}function respondWithResult(_0x5d5f04,_0x8c7a55){_0x8c7a55=_0x8c7a55||0xc8;return function(_0x114797){if(_0x114797){return _0x5d5f04[_0x1484('0x15')](_0x8c7a55)[_0x1484('0x17')](_0x114797);}};}function respondWithFilteredResult(_0x39d646,_0x5e4ad8){return function(_0x437ce2){if(_0x437ce2){var _0x5da9c5=typeof _0x5e4ad8['offset']===_0x1484('0x18')&&typeof _0x5e4ad8[_0x1484('0x19')]===_0x1484('0x18');var _0x7f7672=_0x437ce2['count'];var _0x16f102=_0x5da9c5?0x0:_0x5e4ad8[_0x1484('0x1a')];var _0x192403=_0x5da9c5?_0x437ce2[_0x1484('0x1b')]:_0x5e4ad8[_0x1484('0x1a')]+_0x5e4ad8['limit'];var _0x28f050;if(_0x192403>=_0x7f7672){_0x192403=_0x7f7672;_0x28f050=0xc8;}else{_0x28f050=0xce;}_0x39d646[_0x1484('0x15')](_0x28f050);return _0x39d646[_0x1484('0x1c')](_0x1484('0x1d'),_0x16f102+'-'+_0x192403+'/'+_0x7f7672)[_0x1484('0x17')](_0x437ce2);}return null;};}function patchUpdates(_0x149cc1){return function(_0xa2ae7f){try{jsonpatch[_0x1484('0x1e')](_0xa2ae7f,_0x149cc1,!![]);}catch(_0x513830){return BPromise[_0x1484('0x1f')](_0x513830);}return _0xa2ae7f['save']();};}function saveUpdates(_0x2f077b,_0x5e0156){return function(_0x634c69){if(_0x634c69){return _0x634c69[_0x1484('0x20')](_0x2f077b)[_0x1484('0x21')](function(_0x54fe27){return _0x54fe27;});}return null;};}function removeEntity(_0x206437,_0x5be36b){return function(_0x24d550){if(_0x24d550){return _0x24d550[_0x1484('0x22')]()[_0x1484('0x21')](function(){var _0x22883d=_0x24d550[_0x1484('0x23')]({'plain':!![]});var _0x24d80d='Triggers';return db[_0x1484('0x24')][_0x1484('0x22')]({'where':{'type':_0x24d80d,'resourceId':_0x22883d['id']}})[_0x1484('0x21')](function(){return _0x24d550;});})[_0x1484('0x21')](function(){_0x206437[_0x1484('0x15')](0xcc)[_0x1484('0x16')]();});}};}function handleEntityNotFound(_0x2d3bbe,_0x2e37d6){return function(_0x341524){if(!_0x341524){_0x2d3bbe[_0x1484('0x25')](0x194);}return _0x341524;};}function handleError(_0xed6467,_0x3adde4){_0x3adde4=_0x3adde4||0x1f4;return function(_0x5bc377){logger['error'](_0x5bc377[_0x1484('0x26')]);if(_0x5bc377[_0x1484('0x27')]){delete _0x5bc377['name'];}_0xed6467[_0x1484('0x15')](_0x3adde4)['send'](_0x5bc377);};}exports['index']=function(_0x46d08f,_0x56796f){var _0x4bbf7d={},_0xc8ddcb={},_0x3fd508={'count':0x0,'rows':[]};var _0x3f9fd7=_[_0x1484('0x28')](db[_0x1484('0x29')][_0x1484('0x2a')],function(_0x41b28e){return{'name':_0x41b28e[_0x1484('0x2b')],'type':_0x41b28e[_0x1484('0x2c')][_0x1484('0x2d')]};});_0xc8ddcb['model']=_['map'](_0x3f9fd7,_0x1484('0x27'));_0xc8ddcb[_0x1484('0x2e')]=_['keys'](_0x46d08f['query']);_0xc8ddcb['filters']=_[_0x1484('0x2f')](_0xc8ddcb[_0x1484('0x30')],_0xc8ddcb[_0x1484('0x2e')]);_0x4bbf7d[_0x1484('0x31')]=_['intersection'](_0xc8ddcb[_0x1484('0x30')],qs[_0x1484('0x32')](_0x46d08f[_0x1484('0x2e')][_0x1484('0x32')]));_0x4bbf7d[_0x1484('0x31')]=_0x4bbf7d[_0x1484('0x31')][_0x1484('0x33')]?_0x4bbf7d[_0x1484('0x31')]:_0xc8ddcb[_0x1484('0x30')];if(!_0x46d08f[_0x1484('0x2e')][_0x1484('0x34')](_0x1484('0x35'))){_0x4bbf7d[_0x1484('0x19')]=qs[_0x1484('0x19')](_0x46d08f['query'][_0x1484('0x19')]);_0x4bbf7d[_0x1484('0x1a')]=qs[_0x1484('0x1a')](_0x46d08f['query'][_0x1484('0x1a')]);}_0x4bbf7d[_0x1484('0x36')]=qs[_0x1484('0x37')](_0x46d08f['query'][_0x1484('0x37')]);_0x4bbf7d[_0x1484('0x38')]=qs[_0x1484('0x39')](_[_0x1484('0x3a')](_0x46d08f[_0x1484('0x2e')],_0xc8ddcb[_0x1484('0x39')]),_0x3f9fd7);if(_0x46d08f[_0x1484('0x2e')][_0x1484('0x3b')]){_0x4bbf7d[_0x1484('0x38')]=_[_0x1484('0x3c')](_0x4bbf7d[_0x1484('0x38')],{'$or':_[_0x1484('0x28')](_0x3f9fd7,function(_0x5b7292){if(_0x5b7292[_0x1484('0x2c')]!==_0x1484('0x3d')){var _0x28e87a={};_0x28e87a[_0x5b7292[_0x1484('0x27')]]={'$like':'%'+_0x46d08f['query'][_0x1484('0x3b')]+'%'};return _0x28e87a;}})});}_0x4bbf7d=_[_0x1484('0x3c')]({},_0x4bbf7d,_0x46d08f[_0x1484('0x3e')]);var _0x37a421={'where':_0x4bbf7d[_0x1484('0x38')]};return db[_0x1484('0x29')][_0x1484('0x1b')](_0x37a421)[_0x1484('0x21')](function(_0x55dc01){_0x3fd508[_0x1484('0x1b')]=_0x55dc01;if(_0x46d08f['query']['includeAll']){_0x4bbf7d[_0x1484('0x3f')]=[{'all':!![]}];}return db[_0x1484('0x29')][_0x1484('0x40')](_0x4bbf7d);})[_0x1484('0x21')](function(_0x17ec2b){_0x3fd508[_0x1484('0x41')]=_0x17ec2b;return _0x3fd508;})['then'](respondWithFilteredResult(_0x56796f,_0x4bbf7d))[_0x1484('0x42')](handleError(_0x56796f,null));};exports[_0x1484('0x43')]=function(_0x5bad45,_0x5cffca){var _0x291a36={'raw':![],'where':{'id':_0x5bad45[_0x1484('0x44')]['id']}},_0xdbdeb4={};_0xdbdeb4[_0x1484('0x30')]=_[_0x1484('0x45')](db[_0x1484('0x29')]['rawAttributes']);_0xdbdeb4[_0x1484('0x2e')]=_[_0x1484('0x45')](_0x5bad45['query']);_0xdbdeb4['filters']=_['intersection'](_0xdbdeb4['model'],_0xdbdeb4[_0x1484('0x2e')]);_0x291a36[_0x1484('0x31')]=_[_0x1484('0x2f')](_0xdbdeb4[_0x1484('0x30')],qs[_0x1484('0x32')](_0x5bad45[_0x1484('0x2e')][_0x1484('0x32')]));_0x291a36[_0x1484('0x31')]=_0x291a36[_0x1484('0x31')][_0x1484('0x33')]?_0x291a36[_0x1484('0x31')]:_0xdbdeb4['model'];if(_0x5bad45['query'][_0x1484('0x46')]){_0x291a36[_0x1484('0x3f')]=[{'all':!![]}];}_0x291a36=_[_0x1484('0x3c')]({},_0x291a36,_0x5bad45[_0x1484('0x3e')]);return db[_0x1484('0x29')][_0x1484('0x47')](_0x291a36)[_0x1484('0x21')](handleEntityNotFound(_0x5cffca,null))[_0x1484('0x21')](respondWithResult(_0x5cffca,null))[_0x1484('0x42')](handleError(_0x5cffca,null));};exports[_0x1484('0x48')]=function(_0x374734,_0x340c3e){return db[_0x1484('0x29')][_0x1484('0x48')](_0x374734[_0x1484('0x49')],{})['then'](function(_0x4206c3){var _0x3205f1=_0x374734[_0x1484('0x4a')][_0x1484('0x23')]({'plain':!![]});if(!_0x3205f1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3205f1[_0x1484('0x4b')]===_0x1484('0x4a')){var _0x547823=_0x4206c3[_0x1484('0x23')]({'plain':!![]});var _0x49b477=_0x1484('0x4c');return db[_0x1484('0x4d')][_0x1484('0x47')]({'where':{'name':_0x49b477,'userProfileId':_0x3205f1[_0x1484('0x4e')]},'raw':!![]})[_0x1484('0x21')](function(_0x291d0a){if(_0x291d0a&&_0x291d0a[_0x1484('0x4f')]===0x0){return db[_0x1484('0x24')][_0x1484('0x48')]({'name':_0x547823[_0x1484('0x27')],'resourceId':_0x547823['id'],'type':_0x291d0a['name'],'sectionId':_0x291d0a['id']},{})[_0x1484('0x21')](function(){return _0x4206c3;});}else{return _0x4206c3;}})[_0x1484('0x42')](function(_0x4a759e){logger[_0x1484('0x50')](_0x1484('0x51'),_0x4a759e);throw _0x4a759e;});}return _0x4206c3;})['then'](respondWithResult(_0x340c3e,0xc9))['catch'](handleError(_0x340c3e,null));};exports[_0x1484('0x20')]=function(_0x49f71c,_0x3dd22c){if(_0x49f71c[_0x1484('0x49')]['id']){delete _0x49f71c[_0x1484('0x49')]['id'];}return db[_0x1484('0x29')][_0x1484('0x47')]({'where':{'id':_0x49f71c[_0x1484('0x44')]['id']}})['then'](handleEntityNotFound(_0x3dd22c,null))['then'](saveUpdates(_0x49f71c[_0x1484('0x49')],null))['then'](respondWithResult(_0x3dd22c,null))[_0x1484('0x42')](handleError(_0x3dd22c,null));};exports['destroy']=function(_0x149c20,_0x343718){return db[_0x1484('0x29')]['find']({'where':{'id':_0x149c20['params']['id']}})[_0x1484('0x21')](handleEntityNotFound(_0x343718,null))[_0x1484('0x21')](removeEntity(_0x343718,null))[_0x1484('0x42')](handleError(_0x343718,null));};exports[_0x1484('0x52')]=function(_0xd10b06,_0x1e180b,_0x4436a8){if(_0xd10b06[_0x1484('0x49')]['id']){delete _0xd10b06[_0x1484('0x49')]['id'];}return db[_0x1484('0x29')]['find']({'where':{'id':_0xd10b06[_0x1484('0x44')]['id']}})['then'](handleEntityNotFound(_0x1e180b,null))[_0x1484('0x21')](function(_0x36d8ec){if(_0x36d8ec){_0xd10b06[_0x1484('0x49')][_0x1484('0x53')]=_0x36d8ec['id'];return db[_0x1484('0x54')][_0x1484('0x48')](_0xd10b06[_0x1484('0x49')]);}})[_0x1484('0x21')](respondWithResult(_0x1e180b,null))['catch'](handleError(_0x1e180b,null));};exports[_0x1484('0x55')]=function(_0x2accab,_0x5838ee,_0x27332f){if(_0x2accab['body']['id']){delete _0x2accab[_0x1484('0x49')]['id'];}return db['Trigger']['find']({'where':{'id':_0x2accab[_0x1484('0x44')]['id']}})[_0x1484('0x21')](handleEntityNotFound(_0x5838ee,null))['then'](function(_0x5af0c2){if(_0x5af0c2){_0x2accab[_0x1484('0x49')]['TriggerAnyId']=_0x5af0c2['id'];return db[_0x1484('0x54')][_0x1484('0x48')](_0x2accab[_0x1484('0x49')]);}})[_0x1484('0x21')](respondWithResult(_0x5838ee,null))[_0x1484('0x42')](handleError(_0x5838ee,null));};exports[_0x1484('0x56')]=function(_0x3504be,_0x5863e7,_0x54a593){var _0x4d61c1={};var _0x28558c={};var _0x57a099;var _0x4cb255;return db[_0x1484('0x29')][_0x1484('0x57')]({'where':{'id':_0x3504be['params']['id']}})[_0x1484('0x21')](handleEntityNotFound(_0x5863e7,null))[_0x1484('0x21')](function(_0x373afc){if(_0x373afc){_0x57a099=_0x373afc;_0x28558c[_0x1484('0x30')]=_[_0x1484('0x45')](db[_0x1484('0x54')]['rawAttributes']);_0x28558c['query']=_[_0x1484('0x45')](_0x3504be[_0x1484('0x2e')]);_0x28558c[_0x1484('0x39')]=_[_0x1484('0x2f')](_0x28558c[_0x1484('0x30')],_0x28558c[_0x1484('0x2e')]);_0x4d61c1[_0x1484('0x31')]=_['intersection'](_0x28558c[_0x1484('0x30')],qs[_0x1484('0x32')](_0x3504be[_0x1484('0x2e')][_0x1484('0x32')]));_0x4d61c1[_0x1484('0x31')]=_0x4d61c1['attributes']['length']?_0x4d61c1[_0x1484('0x31')]:_0x28558c[_0x1484('0x30')];_0x4d61c1[_0x1484('0x36')]=qs[_0x1484('0x37')](_0x3504be[_0x1484('0x2e')]['sort']);_0x4d61c1['where']=qs[_0x1484('0x39')](_[_0x1484('0x3a')](_0x3504be['query'],_0x28558c[_0x1484('0x39')]));if(_0x3504be[_0x1484('0x2e')][_0x1484('0x3b')]){_0x4d61c1['where']=_[_0x1484('0x3c')](_0x4d61c1['where'],{'$or':_[_0x1484('0x28')](_0x4d61c1[_0x1484('0x31')],function(_0x5efa44){var _0x7795d2={};_0x7795d2[_0x5efa44]={'$like':'%'+_0x3504be[_0x1484('0x2e')][_0x1484('0x3b')]+'%'};return _0x7795d2;})});}_0x4d61c1=_[_0x1484('0x3c')]({},_0x4d61c1,_0x3504be['options']);return _0x57a099[_0x1484('0x56')](_0x4d61c1);}})[_0x1484('0x21')](function(_0x5c8cd5){if(_0x5c8cd5){_0x4cb255=_0x5c8cd5[_0x1484('0x33')];if(!_0x3504be[_0x1484('0x2e')][_0x1484('0x34')](_0x1484('0x35'))){_0x4d61c1[_0x1484('0x19')]=qs[_0x1484('0x19')](_0x3504be[_0x1484('0x2e')]['limit']);_0x4d61c1[_0x1484('0x1a')]=qs[_0x1484('0x1a')](_0x3504be['query'][_0x1484('0x1a')]);}return _0x57a099['getAllConditions'](_0x4d61c1);}})['then'](function(_0x5769cf){if(_0x5769cf){return _0x5769cf?{'count':_0x4cb255,'rows':_0x5769cf}:null;}})[_0x1484('0x21')](respondWithResult(_0x5863e7,null))[_0x1484('0x42')](handleError(_0x5863e7,null));};exports[_0x1484('0x58')]=function(_0x55a10a,_0x595650,_0x45ce9e){var _0x1f4089={};var _0x13ece8={};var _0x2af2f8;var _0x25ad93;return db[_0x1484('0x29')][_0x1484('0x57')]({'where':{'id':_0x55a10a['params']['id']}})[_0x1484('0x21')](handleEntityNotFound(_0x595650,null))[_0x1484('0x21')](function(_0x5ae32f){if(_0x5ae32f){_0x2af2f8=_0x5ae32f;_0x13ece8[_0x1484('0x30')]=_[_0x1484('0x45')](db[_0x1484('0x54')][_0x1484('0x2a')]);_0x13ece8['query']=_[_0x1484('0x45')](_0x55a10a[_0x1484('0x2e')]);_0x13ece8[_0x1484('0x39')]=_[_0x1484('0x2f')](_0x13ece8[_0x1484('0x30')],_0x13ece8[_0x1484('0x2e')]);_0x1f4089[_0x1484('0x31')]=_['intersection'](_0x13ece8['model'],qs[_0x1484('0x32')](_0x55a10a[_0x1484('0x2e')][_0x1484('0x32')]));_0x1f4089[_0x1484('0x31')]=_0x1f4089['attributes'][_0x1484('0x33')]?_0x1f4089[_0x1484('0x31')]:_0x13ece8[_0x1484('0x30')];_0x1f4089[_0x1484('0x36')]=qs['sort'](_0x55a10a[_0x1484('0x2e')][_0x1484('0x37')]);_0x1f4089[_0x1484('0x38')]=qs[_0x1484('0x39')](_[_0x1484('0x3a')](_0x55a10a[_0x1484('0x2e')],_0x13ece8[_0x1484('0x39')]));if(_0x55a10a[_0x1484('0x2e')]['filter']){_0x1f4089[_0x1484('0x38')]=_[_0x1484('0x3c')](_0x1f4089[_0x1484('0x38')],{'$or':_['map'](_0x1f4089[_0x1484('0x31')],function(_0x254f7c){var _0x153c71={};_0x153c71[_0x254f7c]={'$like':'%'+_0x55a10a[_0x1484('0x2e')][_0x1484('0x3b')]+'%'};return _0x153c71;})});}_0x1f4089=_[_0x1484('0x3c')]({},_0x1f4089,_0x55a10a['options']);return _0x2af2f8['getAnyConditions'](_0x1f4089);}})[_0x1484('0x21')](function(_0x31efcd){if(_0x31efcd){_0x25ad93=_0x31efcd[_0x1484('0x33')];if(!_0x55a10a[_0x1484('0x2e')]['hasOwnProperty'](_0x1484('0x35'))){_0x1f4089[_0x1484('0x19')]=qs['limit'](_0x55a10a['query'][_0x1484('0x19')]);_0x1f4089[_0x1484('0x1a')]=qs[_0x1484('0x1a')](_0x55a10a[_0x1484('0x2e')][_0x1484('0x1a')]);}return _0x2af2f8[_0x1484('0x58')](_0x1f4089);}})[_0x1484('0x21')](function(_0x2cd8cf){if(_0x2cd8cf){return _0x2cd8cf?{'count':_0x25ad93,'rows':_0x2cd8cf}:null;}})[_0x1484('0x21')](respondWithResult(_0x595650,null))[_0x1484('0x42')](handleError(_0x595650,null));};exports[_0x1484('0x59')]=function(_0x2e4e81,_0x5f3472,_0x718ab2){if(_0x2e4e81['body']['id']){delete _0x2e4e81[_0x1484('0x49')]['id'];}return db[_0x1484('0x29')][_0x1484('0x47')]({'where':{'id':_0x2e4e81['params']['id']}})[_0x1484('0x21')](handleEntityNotFound(_0x5f3472,null))['then'](function(_0x5c2177){if(_0x5c2177){_0x2e4e81[_0x1484('0x49')][_0x1484('0x5a')]=_0x5c2177['id'];return db[_0x1484('0x5b')][_0x1484('0x48')](_0x2e4e81[_0x1484('0x49')]);}})[_0x1484('0x21')](respondWithResult(_0x5f3472,null))['catch'](handleError(_0x5f3472,null));};exports[_0x1484('0x5c')]=function(_0x52591c,_0x21a547,_0x49128f){var _0x38d639={};var _0x4356ea={};var _0x294c6d;var _0x283f5b;return db[_0x1484('0x29')]['findOne']({'where':{'id':_0x52591c['params']['id']}})[_0x1484('0x21')](handleEntityNotFound(_0x21a547,null))['then'](function(_0x4621a9){if(_0x4621a9){_0x294c6d=_0x4621a9;_0x4356ea[_0x1484('0x30')]=_[_0x1484('0x45')](db[_0x1484('0x5b')]['rawAttributes']);_0x4356ea[_0x1484('0x2e')]=_[_0x1484('0x45')](_0x52591c[_0x1484('0x2e')]);_0x4356ea[_0x1484('0x39')]=_[_0x1484('0x2f')](_0x4356ea[_0x1484('0x30')],_0x4356ea['query']);_0x38d639[_0x1484('0x31')]=_[_0x1484('0x2f')](_0x4356ea[_0x1484('0x30')],qs[_0x1484('0x32')](_0x52591c[_0x1484('0x2e')][_0x1484('0x32')]));_0x38d639[_0x1484('0x31')]=_0x38d639[_0x1484('0x31')][_0x1484('0x33')]?_0x38d639[_0x1484('0x31')]:_0x4356ea['model'];_0x38d639[_0x1484('0x36')]=qs['sort'](_0x52591c[_0x1484('0x2e')][_0x1484('0x37')]);_0x38d639['where']=qs[_0x1484('0x39')](_['pick'](_0x52591c['query'],_0x4356ea[_0x1484('0x39')]));if(_0x52591c['query']['filter']){_0x38d639[_0x1484('0x38')]=_[_0x1484('0x3c')](_0x38d639[_0x1484('0x38')],{'$or':_['map'](_0x38d639[_0x1484('0x31')],function(_0x1da3c5){var _0x77c69c={};_0x77c69c[_0x1da3c5]={'$like':'%'+_0x52591c[_0x1484('0x2e')][_0x1484('0x3b')]+'%'};return _0x77c69c;})});}_0x38d639=_[_0x1484('0x3c')]({},_0x38d639,_0x52591c[_0x1484('0x3e')]);return _0x294c6d['getActions'](_0x38d639);}})[_0x1484('0x21')](function(_0xaf616b){if(_0xaf616b){_0x283f5b=_0xaf616b[_0x1484('0x33')];if(!_0x52591c['query'][_0x1484('0x34')](_0x1484('0x35'))){_0x38d639[_0x1484('0x19')]=qs['limit'](_0x52591c[_0x1484('0x2e')]['limit']);_0x38d639[_0x1484('0x1a')]=qs[_0x1484('0x1a')](_0x52591c[_0x1484('0x2e')][_0x1484('0x1a')]);}return _0x294c6d[_0x1484('0x5c')](_0x38d639);}})['then'](function(_0x50ac96){if(_0x50ac96){return _0x50ac96?{'count':_0x283f5b,'rows':_0x50ac96}:null;}})[_0x1484('0x21')](respondWithResult(_0x21a547,null))[_0x1484('0x42')](handleError(_0x21a547,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index e96a86b..a53b7de 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 _0x9d92=['rimraf','../../config/environment','./trigger.attributes','exports','define','Trigger','tools_triggers','lodash','api','moment','request-promise','path'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x9d92,0xdf));var _0x29d9=function(_0x5311e8,_0x57c5bb){_0x5311e8=_0x5311e8-0x0;var _0x582ad8=_0x9d92[_0x5311e8];return _0x582ad8;};'use strict';var _=require(_0x29d9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x29d9('0x1'));var moment=require(_0x29d9('0x2'));var BPromise=require('bluebird');var rp=require(_0x29d9('0x3'));var fs=require('fs');var path=require(_0x29d9('0x4'));var rimraf=require(_0x29d9('0x5'));var config=require(_0x29d9('0x6'));var attributes=require(_0x29d9('0x7'));module[_0x29d9('0x8')]=function(_0x27d032,_0x52932b){return _0x27d032[_0x29d9('0x9')](_0x29d9('0xa'),attributes,{'tableName':_0x29d9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc43c=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./trigger.attributes','exports','define','Trigger','tools_triggers'];(function(_0x2e3d56,_0x4fb6ed){var _0x1815c1=function(_0x45a5fd){while(--_0x45a5fd){_0x2e3d56['push'](_0x2e3d56['shift']());}};_0x1815c1(++_0x4fb6ed);}(_0xc43c,0x152));var _0xcc43=function(_0x1551dc,_0x26be37){_0x1551dc=_0x1551dc-0x0;var _0x269377=_0xc43c[_0x1551dc];return _0x269377;};'use strict';var _=require(_0xcc43('0x0'));var util=require(_0xcc43('0x1'));var logger=require(_0xcc43('0x2'))(_0xcc43('0x3'));var moment=require(_0xcc43('0x4'));var BPromise=require(_0xcc43('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcc43('0x6'));var rimraf=require(_0xcc43('0x7'));var config=require('../../config/environment');var attributes=require(_0xcc43('0x8'));module[_0xcc43('0x9')]=function(_0x217a5e,_0x17d1a2){return _0x217a5e[_0xcc43('0xa')](_0xcc43('0xb'),attributes,{'tableName':_0xcc43('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 89743c6..4100901 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 _0x9581=['debug','Trigger,\x20%s,\x20%s,\x20%s','error','code','Trigger,\x20%s,\x20%s','message','result','catch','GetTrigger','Trigger','findAll','options','where','attributes','limit','include','map','model','then','stringify','ShowTrigger','find','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','http','request','info','request\x20sent'];(function(_0x59d2eb,_0x9da8e3){var _0x4209ee=function(_0x4dc785){while(--_0x4dc785){_0x59d2eb['push'](_0x59d2eb['shift']());}};_0x4209ee(++_0x9da8e3);}(_0x9581,0x7c));var _0x1958=function(_0x18868a,_0x2e02fd){_0x18868a=_0x18868a-0x0;var _0x32084a=_0x9581[_0x18868a];return _0x32084a;};'use strict';var _=require('lodash');var util=require(_0x1958('0x0'));var moment=require(_0x1958('0x1'));var BPromise=require(_0x1958('0x2'));var rs=require(_0x1958('0x3'));var fs=require('fs');var Redis=require(_0x1958('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1958('0x5'))(_0x1958('0x6'));var config=require('../../config/environment');var jayson=require(_0x1958('0x7'));var client=jayson['client'][_0x1958('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5d9f9f,_0x2256d5,_0x1a3ec1){return new BPromise(function(_0x439b92,_0x25ab71){return client[_0x1958('0x9')](_0x5d9f9f,_0x1a3ec1)['then'](function(_0x213d07){logger[_0x1958('0xa')]('Trigger,\x20%s,\x20%s',_0x2256d5,_0x1958('0xb'));logger[_0x1958('0xc')](_0x1958('0xd'),_0x2256d5,_0x1958('0xb'),JSON['stringify'](_0x213d07));if(_0x213d07[_0x1958('0xe')]){if(_0x213d07[_0x1958('0xe')][_0x1958('0xf')]===0x1f4){logger[_0x1958('0xe')](_0x1958('0x10'),_0x2256d5,_0x213d07[_0x1958('0xe')][_0x1958('0x11')]);return _0x25ab71(_0x213d07[_0x1958('0xe')]['message']);}logger['error'](_0x1958('0x10'),_0x2256d5,_0x213d07[_0x1958('0xe')][_0x1958('0x11')]);return _0x439b92(_0x213d07[_0x1958('0xe')][_0x1958('0x11')]);}else{logger['info']('Trigger,\x20%s,\x20%s',_0x2256d5,_0x1958('0xb'));_0x439b92(_0x213d07[_0x1958('0x12')][_0x1958('0x11')]);}})[_0x1958('0x13')](function(_0x499963){logger[_0x1958('0xe')](_0x1958('0x10'),_0x2256d5,_0x499963);_0x25ab71(_0x499963);});});}exports[_0x1958('0x14')]=function(_0x13d0c5){var _0x5730e6=this;return new Promise(function(_0x31a816,_0x714d2f){return db[_0x1958('0x15')][_0x1958('0x16')]({'raw':_0x13d0c5[_0x1958('0x17')]?_0x13d0c5[_0x1958('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x13d0c5[_0x1958('0x17')]?_0x13d0c5[_0x1958('0x17')][_0x1958('0x18')]||null:null,'attributes':_0x13d0c5[_0x1958('0x17')]?_0x13d0c5[_0x1958('0x17')][_0x1958('0x19')]||null:null,'limit':_0x13d0c5[_0x1958('0x17')]?_0x13d0c5['options'][_0x1958('0x1a')]||null:null,'include':_0x13d0c5[_0x1958('0x17')]?_0x13d0c5[_0x1958('0x17')][_0x1958('0x1b')]?_[_0x1958('0x1c')](_0x13d0c5['options']['include'],function(_0x51f179){return{'model':db[_0x51f179[_0x1958('0x1d')]],'as':_0x51f179['as'],'attributes':_0x51f179[_0x1958('0x19')],'include':_0x51f179[_0x1958('0x1b')]?_[_0x1958('0x1c')](_0x51f179['include'],function(_0x525f8a){return{'model':db[_0x525f8a[_0x1958('0x1d')]],'as':_0x525f8a['as'],'attributes':_0x525f8a[_0x1958('0x19')],'include':_0x525f8a['include']?_['map'](_0x525f8a[_0x1958('0x1b')],function(_0x88d60){return{'model':db[_0x88d60[_0x1958('0x1d')]],'as':_0x88d60['as'],'attributes':_0x88d60[_0x1958('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1958('0x1e')](function(_0x38e126){logger[_0x1958('0xa')](_0x1958('0x14'),_0x13d0c5);logger[_0x1958('0xc')](_0x1958('0x14'),_0x13d0c5,JSON[_0x1958('0x1f')](_0x38e126));_0x31a816(_0x38e126);})[_0x1958('0x13')](function(_0x550f80){logger[_0x1958('0xe')](_0x1958('0x14'),_0x550f80['message'],_0x13d0c5);_0x714d2f(_0x5730e6['error'](0x1f4,_0x550f80[_0x1958('0x11')]));});});};exports[_0x1958('0x20')]=function(_0x4f7e14){var _0x473224=this;return new Promise(function(_0x5f54da,_0x233123){return db[_0x1958('0x15')][_0x1958('0x21')]({'raw':_0x4f7e14['options']?_0x4f7e14['options']['raw']===undefined?!![]:![]:!![],'where':_0x4f7e14[_0x1958('0x17')]?_0x4f7e14['options'][_0x1958('0x18')]||null:null,'attributes':_0x4f7e14[_0x1958('0x17')]?_0x4f7e14[_0x1958('0x17')][_0x1958('0x19')]||null:null,'include':_0x4f7e14['options']?_0x4f7e14[_0x1958('0x17')]['include']?_['map'](_0x4f7e14['options'][_0x1958('0x1b')],function(_0x55f1a7){return{'model':db[_0x55f1a7[_0x1958('0x1d')]],'as':_0x55f1a7['as'],'attributes':_0x55f1a7['attributes'],'include':_0x55f1a7[_0x1958('0x1b')]?_[_0x1958('0x1c')](_0x55f1a7['include'],function(_0x7959c4){return{'model':db[_0x7959c4[_0x1958('0x1d')]],'as':_0x7959c4['as'],'attributes':_0x7959c4['attributes'],'include':_0x7959c4[_0x1958('0x1b')]?_[_0x1958('0x1c')](_0x7959c4['include'],function(_0x5c724f){return{'model':db[_0x5c724f[_0x1958('0x1d')]],'as':_0x5c724f['as'],'attributes':_0x5c724f[_0x1958('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1958('0x1e')](function(_0x39042a){logger[_0x1958('0xa')](_0x1958('0x20'),_0x4f7e14);logger[_0x1958('0xc')]('ShowTrigger',_0x4f7e14,JSON['stringify'](_0x39042a));_0x5f54da(_0x39042a);})[_0x1958('0x13')](function(_0x20abb0){logger[_0x1958('0xe')](_0x1958('0x20'),_0x20abb0[_0x1958('0x11')],_0x4f7e14);_0x233123(_0x473224[_0x1958('0xe')](0x1f4,_0x20abb0[_0x1958('0x11')]));});});}; \ No newline at end of file +var _0xa649=['request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','Trigger,\x20%s,\x20%s','message','result','catch','GetTrigger','Trigger','findAll','options','raw','where','limit','include','map','model','attributes','ShowTrigger','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x359cab,_0x15b12c){var _0x37b6de=function(_0x4a5948){while(--_0x4a5948){_0x359cab['push'](_0x359cab['shift']());}};_0x37b6de(++_0x15b12c);}(_0xa649,0x65));var _0x9a64=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xa649[_0x8c43de];return _0xa6591b;};'use strict';var _=require(_0x9a64('0x0'));var util=require(_0x9a64('0x1'));var moment=require(_0x9a64('0x2'));var BPromise=require(_0x9a64('0x3'));var rs=require(_0x9a64('0x4'));var fs=require('fs');var Redis=require(_0x9a64('0x5'));var db=require(_0x9a64('0x6'))['db'];var utils=require(_0x9a64('0x7'));var logger=require(_0x9a64('0x8'))(_0x9a64('0x9'));var config=require(_0x9a64('0xa'));var jayson=require(_0x9a64('0xb'));var client=jayson['client'][_0x9a64('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1ba0de,_0x52e4bd,_0x276da5){return new BPromise(function(_0x19732c,_0x24459b){return client[_0x9a64('0xd')](_0x1ba0de,_0x276da5)[_0x9a64('0xe')](function(_0x4e8f89){logger[_0x9a64('0xf')]('Trigger,\x20%s,\x20%s',_0x52e4bd,_0x9a64('0x10'));logger[_0x9a64('0x11')](_0x9a64('0x12'),_0x52e4bd,'request\x20sent',JSON[_0x9a64('0x13')](_0x4e8f89));if(_0x4e8f89[_0x9a64('0x14')]){if(_0x4e8f89[_0x9a64('0x14')][_0x9a64('0x15')]===0x1f4){logger[_0x9a64('0x14')](_0x9a64('0x16'),_0x52e4bd,_0x4e8f89[_0x9a64('0x14')][_0x9a64('0x17')]);return _0x24459b(_0x4e8f89['error'][_0x9a64('0x17')]);}logger['error'](_0x9a64('0x16'),_0x52e4bd,_0x4e8f89[_0x9a64('0x14')][_0x9a64('0x17')]);return _0x19732c(_0x4e8f89['error'][_0x9a64('0x17')]);}else{logger['info'](_0x9a64('0x16'),_0x52e4bd,_0x9a64('0x10'));_0x19732c(_0x4e8f89[_0x9a64('0x18')][_0x9a64('0x17')]);}})[_0x9a64('0x19')](function(_0x1de23a){logger[_0x9a64('0x14')]('Trigger,\x20%s,\x20%s',_0x52e4bd,_0x1de23a);_0x24459b(_0x1de23a);});});}exports[_0x9a64('0x1a')]=function(_0x3ded79){var _0x3baa95=this;return new Promise(function(_0x5e644b,_0x1667a3){return db[_0x9a64('0x1b')][_0x9a64('0x1c')]({'raw':_0x3ded79['options']?_0x3ded79[_0x9a64('0x1d')][_0x9a64('0x1e')]===undefined?!![]:![]:!![],'where':_0x3ded79[_0x9a64('0x1d')]?_0x3ded79[_0x9a64('0x1d')][_0x9a64('0x1f')]||null:null,'attributes':_0x3ded79[_0x9a64('0x1d')]?_0x3ded79[_0x9a64('0x1d')]['attributes']||null:null,'limit':_0x3ded79['options']?_0x3ded79[_0x9a64('0x1d')][_0x9a64('0x20')]||null:null,'include':_0x3ded79['options']?_0x3ded79[_0x9a64('0x1d')][_0x9a64('0x21')]?_[_0x9a64('0x22')](_0x3ded79[_0x9a64('0x1d')][_0x9a64('0x21')],function(_0x97b8ec){return{'model':db[_0x97b8ec[_0x9a64('0x23')]],'as':_0x97b8ec['as'],'attributes':_0x97b8ec[_0x9a64('0x24')],'include':_0x97b8ec[_0x9a64('0x21')]?_[_0x9a64('0x22')](_0x97b8ec['include'],function(_0x611acd){return{'model':db[_0x611acd[_0x9a64('0x23')]],'as':_0x611acd['as'],'attributes':_0x611acd[_0x9a64('0x24')],'include':_0x611acd[_0x9a64('0x21')]?_[_0x9a64('0x22')](_0x611acd[_0x9a64('0x21')],function(_0x3e5fbd){return{'model':db[_0x3e5fbd[_0x9a64('0x23')]],'as':_0x3e5fbd['as'],'attributes':_0x3e5fbd[_0x9a64('0x24')]};}):[]};}):[]};}):[]:[]})[_0x9a64('0xe')](function(_0x38a7bb){logger[_0x9a64('0xf')](_0x9a64('0x1a'),_0x3ded79);logger['debug'](_0x9a64('0x1a'),_0x3ded79,JSON['stringify'](_0x38a7bb));_0x5e644b(_0x38a7bb);})['catch'](function(_0x5a6e9d){logger[_0x9a64('0x14')]('GetTrigger',_0x5a6e9d[_0x9a64('0x17')],_0x3ded79);_0x1667a3(_0x3baa95[_0x9a64('0x14')](0x1f4,_0x5a6e9d['message']));});});};exports[_0x9a64('0x25')]=function(_0x35e255){var _0x23abaf=this;return new Promise(function(_0x53ed51,_0x55af69){return db[_0x9a64('0x1b')][_0x9a64('0x26')]({'raw':_0x35e255[_0x9a64('0x1d')]?_0x35e255[_0x9a64('0x1d')][_0x9a64('0x1e')]===undefined?!![]:![]:!![],'where':_0x35e255[_0x9a64('0x1d')]?_0x35e255['options']['where']||null:null,'attributes':_0x35e255['options']?_0x35e255[_0x9a64('0x1d')]['attributes']||null:null,'include':_0x35e255[_0x9a64('0x1d')]?_0x35e255['options']['include']?_['map'](_0x35e255[_0x9a64('0x1d')][_0x9a64('0x21')],function(_0x1bbbd1){return{'model':db[_0x1bbbd1['model']],'as':_0x1bbbd1['as'],'attributes':_0x1bbbd1[_0x9a64('0x24')],'include':_0x1bbbd1['include']?_[_0x9a64('0x22')](_0x1bbbd1[_0x9a64('0x21')],function(_0x5b9c52){return{'model':db[_0x5b9c52[_0x9a64('0x23')]],'as':_0x5b9c52['as'],'attributes':_0x5b9c52[_0x9a64('0x24')],'include':_0x5b9c52[_0x9a64('0x21')]?_['map'](_0x5b9c52[_0x9a64('0x21')],function(_0x24dc5f){return{'model':db[_0x24dc5f[_0x9a64('0x23')]],'as':_0x24dc5f['as'],'attributes':_0x24dc5f[_0x9a64('0x24')]};}):[]};}):[]};}):[]:[]})[_0x9a64('0xe')](function(_0x24e583){logger[_0x9a64('0xf')](_0x9a64('0x25'),_0x35e255);logger[_0x9a64('0x11')](_0x9a64('0x25'),_0x35e255,JSON[_0x9a64('0x13')](_0x24e583));_0x53ed51(_0x24e583);})[_0x9a64('0x19')](function(_0x436cd6){logger['error'](_0x9a64('0x25'),_0x436cd6[_0x9a64('0x17')],_0x35e255);_0x55af69(_0x23abaf[_0x9a64('0x14')](0x1f4,_0x436cd6['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index e852097..e40261e 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 _0xf040=['put','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./trunk.controller','get','isAuthenticated','/:id','post','/:id/clone','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf040,0x1cd));var _0x0f04=function(_0x3a2749,_0x3c152c){_0x3a2749=_0x3a2749-0x0;var _0x3f18dd=_0xf040[_0x3a2749];return _0x3f18dd;};'use strict';var multer=require(_0x0f04('0x0'));var util=require(_0x0f04('0x1'));var path=require(_0x0f04('0x2'));var timeout=require(_0x0f04('0x3'));var express=require(_0x0f04('0x4'));var router=express[_0x0f04('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0f04('0x6'));var interaction=require(_0x0f04('0x7'));var config=require('../../config/environment');var controller=require(_0x0f04('0x8'));router[_0x0f04('0x9')]('/',auth[_0x0f04('0xa')](),controller['index']);router[_0x0f04('0x9')](_0x0f04('0xb'),auth[_0x0f04('0xa')](),controller['show']);router[_0x0f04('0xc')](_0x0f04('0xd'),auth[_0x0f04('0xa')](),controller['clone']);router[_0x0f04('0xc')]('/',auth[_0x0f04('0xa')](),controller[_0x0f04('0xe')]);router[_0x0f04('0xf')]('/:id',auth[_0x0f04('0xa')](),controller['update']);router[_0x0f04('0x10')](_0x0f04('0xb'),auth[_0x0f04('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6f72=['update','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','show','post','/:id/clone','clone','create','put'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x6f72,0x136));var _0x26f7=function(_0x27d329,_0x339866){_0x27d329=_0x27d329-0x0;var _0x5579d7=_0x6f72[_0x27d329];return _0x5579d7;};'use strict';var multer=require(_0x26f7('0x0'));var util=require(_0x26f7('0x1'));var path=require('path');var timeout=require(_0x26f7('0x2'));var express=require(_0x26f7('0x3'));var router=express[_0x26f7('0x4')]();var fs_extra=require(_0x26f7('0x5'));var auth=require(_0x26f7('0x6'));var interaction=require(_0x26f7('0x7'));var config=require(_0x26f7('0x8'));var controller=require(_0x26f7('0x9'));router[_0x26f7('0xa')]('/',auth[_0x26f7('0xb')](),controller[_0x26f7('0xc')]);router['get'](_0x26f7('0xd'),auth['isAuthenticated'](),controller[_0x26f7('0xe')]);router[_0x26f7('0xf')](_0x26f7('0x10'),auth[_0x26f7('0xb')](),controller[_0x26f7('0x11')]);router[_0x26f7('0xf')]('/',auth[_0x26f7('0xb')](),controller[_0x26f7('0x12')]);router[_0x26f7('0x13')]('/:id',auth[_0x26f7('0xb')](),controller[_0x26f7('0x14')]);router['delete'](_0x26f7('0xd'),auth[_0x26f7('0xb')](),controller[_0x26f7('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index dfddb6f..73f2782 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 _0x79c6=['from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','setDataValue','getDataValue','transport','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','\x22\x22\x20<>','always','accept','uac','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','update,nonat','BOOLEAN','exports','name','ENUM','friend','STRING'];(function(_0x34f533,_0x59d65c){var _0x6f22b8=function(_0x4dffcc){while(--_0x4dffcc){_0x34f533['push'](_0x34f533['shift']());}};_0x6f22b8(++_0x59d65c);}(_0x79c6,0xb7));var _0x679c=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0x79c6[_0x58e469];return _0x4c01c5;};'use strict';var Sequelize=require('sequelize');module[_0x679c('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x679c('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x679c('0x2')](_0x679c('0x3'),'user','peer'),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x679c('0x4')],'allowNull':![],'defaultValue':_0x679c('0x5')},'callingpres':{'type':Sequelize[_0x679c('0x2')](_0x679c('0x6'),'ALLOWED_PASSED_SCREEN',_0x679c('0x7'),'ALLOWED',_0x679c('0x8'),_0x679c('0x9'),_0x679c('0xa'),'PROHIB')},'deny':{'type':Sequelize[_0x679c('0x4')]},'permit':{'type':Sequelize[_0x679c('0x4')]},'secret':{'type':Sequelize[_0x679c('0x4')]},'md5secret':{'type':Sequelize[_0x679c('0x4')]},'remotesecret':{'type':Sequelize[_0x679c('0x4')]},'transport':{'type':Sequelize[_0x679c('0x4')],'defaultValue':_0x679c('0xb'),'set':function(_0x3de8b5){this[_0x679c('0xc')]('transport',_0x3de8b5?_0x3de8b5['join'](','):null);},'get':function(){return this[_0x679c('0xd')](_0x679c('0xe'))?this['getDataValue'](_0x679c('0xe'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x679c('0x2')](_0x679c('0xf'),_0x679c('0x10'),_0x679c('0x11'),_0x679c('0x12'),_0x679c('0x13')),'defaultValue':_0x679c('0xf')},'directmedia':{'type':Sequelize[_0x679c('0x2')](_0x679c('0x14'),'no',_0x679c('0x15'),_0x679c('0x16'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x679c('0x2')](_0x679c('0x14'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x679c('0x4')]},'directmediadeny':{'type':Sequelize[_0x679c('0x4')]},'nat':{'type':Sequelize[_0x679c('0x4')],'defaultValue':'force_rport,comedia','set':function(_0x3b498b){this[_0x679c('0xc')](_0x679c('0x17'),_0x3b498b?_0x3b498b[_0x679c('0x18')](','):null);},'get':function(){return this[_0x679c('0xd')](_0x679c('0x17'))?this[_0x679c('0xd')](_0x679c('0x17'))['split'](','):null;},'comment':_0x679c('0x19')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x679c('0x4')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x679c('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x679c('0x4')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x679c('0x4')],'defaultValue':'all'},'allow':{'type':Sequelize[_0x679c('0x4')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x45cf3e){this['setDataValue']('allow',_0x45cf3e?_0x45cf3e['join'](';'):_0x679c('0x1a'));},'get':function(){return this[_0x679c('0xd')](_0x679c('0x1b'))?this[_0x679c('0xd')](_0x679c('0x1b'))[_0x679c('0x1c')](';'):null;},'comment':_0x679c('0x1d')},'autoframing':{'type':Sequelize[_0x679c('0x2')](_0x679c('0x14'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':'port,invite','set':function(_0xdf90fa){this[_0x679c('0xc')](_0x679c('0x1e'),_0xdf90fa?_0xdf90fa[_0x679c('0x18')](','):null);},'get':function(){return this['getDataValue'](_0x679c('0x1e'))?this[_0x679c('0xd')]('insecure')[_0x679c('0x1c')](','):null;},'comment':_0x679c('0x1f')},'trustrpid':{'type':Sequelize[_0x679c('0x2')](_0x679c('0x14'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x679c('0x2')](_0x679c('0x14'),'no','never')},'promiscredir':{'type':Sequelize['ENUM'](_0x679c('0x14'),'no')},'useclientcode':{'type':Sequelize[_0x679c('0x2')]('yes','no')},'accountcode':{'type':Sequelize[_0x679c('0x20')](0xb)},'setvar':{'type':Sequelize[_0x679c('0x4')]},'callerid':{'type':Sequelize[_0x679c('0x4')],'defaultValue':_0x679c('0x21')},'amaflags':{'type':Sequelize[_0x679c('0x4')]},'callcounter':{'type':Sequelize[_0x679c('0x2')](_0x679c('0x14'),'no'),'defaultValue':_0x679c('0x14')},'busylevel':{'type':Sequelize[_0x679c('0x20')](0xb)},'allowoverlap':{'type':Sequelize[_0x679c('0x2')](_0x679c('0x14'),'no')},'allowsubscribe':{'type':Sequelize[_0x679c('0x2')]('yes','no')},'allowtransfer':{'type':Sequelize[_0x679c('0x2')](_0x679c('0x14'),'no')},'ignoresdpversion':{'type':Sequelize[_0x679c('0x2')](_0x679c('0x14'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x679c('0x4')]},'videosupport':{'type':Sequelize['ENUM']('yes','no',_0x679c('0x22')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x679c('0x20')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x679c('0x2')](_0x679c('0x14'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize['ENUM'](_0x679c('0x23'),'refuse','originate')},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x679c('0x20')](0xb)},'session_refresher':{'type':Sequelize[_0x679c('0x2')](_0x679c('0x24'),_0x679c('0x25')),'defaultValue':_0x679c('0x25')},'t38pt_usertpsource':{'type':Sequelize[_0x679c('0x4')]},'regexten':{'type':Sequelize[_0x679c('0x4')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x679c('0x4')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0x679c('0x2')](_0x679c('0x14'),'no'),'defaultValue':_0x679c('0x14')},'keepalive':{'type':Sequelize[_0x679c('0x20')](0xb)},'defaultip':{'type':Sequelize[_0x679c('0x4')]},'defaultuser':{'type':Sequelize[_0x679c('0x4')]},'rtptimeout':{'type':Sequelize[_0x679c('0x20')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x679c('0x20')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x679c('0x20')](0xb)},'sendrpid':{'type':Sequelize[_0x679c('0x2')](_0x679c('0x14'),'no',_0x679c('0x26')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x679c('0x4')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x679c('0x20')](0xb)},'timerb':{'type':Sequelize[_0x679c('0x20')](0xb)},'qualifyfreq':{'type':Sequelize[_0x679c('0x20')](0xb)},'contactpermit':{'type':Sequelize[_0x679c('0x4')]},'contactdeny':{'type':Sequelize[_0x679c('0x4')]},'contactacl':{'type':Sequelize[_0x679c('0x4')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x679c('0x20')](0xb)},'encryption':{'type':Sequelize[_0x679c('0x2')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x679c('0x2')](_0x679c('0x14'),'no')},'force_avp':{'type':Sequelize[_0x679c('0x2')]('yes','no')},'icesupport':{'type':Sequelize[_0x679c('0x2')](_0x679c('0x14'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x679c('0x14'),'no')},'dtlsverify':{'type':Sequelize[_0x679c('0x2')]('yes','no',_0x679c('0x27'),_0x679c('0x28'))},'dtlsrekey':{'type':Sequelize[_0x679c('0x20')](0xb)},'dtlscertfile':{'type':Sequelize[_0x679c('0x4')]},'dtlsprivatekey':{'type':Sequelize[_0x679c('0x4')]},'dtlscipher':{'type':Sequelize[_0x679c('0x4')]},'dtlscafile':{'type':Sequelize[_0x679c('0x4')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0x679c('0x2')](_0x679c('0x29'),_0x679c('0x2a'),_0x679c('0x2b')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x679c('0x4')]},'usereqphone':{'type':Sequelize['ENUM'](_0x679c('0x14'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x679c('0x4')]},'recordofffeature':{'type':Sequelize[_0x679c('0x4')]},'call_limit':{'type':Sequelize[_0x679c('0x20')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x679c('0x2')](_0x679c('0x14'),'no')},'subscribemwi':{'type':Sequelize[_0x679c('0x2')](_0x679c('0x14'),'no')},'vmexten':{'type':Sequelize[_0x679c('0x4')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0x679c('0x4')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x679c('0x4')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0x679c('0x2c')},'canreinvite':{'type':Sequelize['ENUM'](_0x679c('0x14'),'no',_0x679c('0x15'),_0x679c('0x16'),_0x679c('0x2d')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x679c('0x4')]},'otherFields':{'type':Sequelize[_0x679c('0x4')]},'active':{'type':Sequelize[_0x679c('0x2e')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x679c('0x4')],'defaultValue':'no'}}; \ No newline at end of file +var _0x8c88=['refuse','uac','uas','pai','fingerprint','active','passive','actpass','update,nonat','BOOLEAN','sequelize','STRING','name','ENUM','friend','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','join','getDataValue','transport','split','rfc2833','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','setDataValue','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','\x22\x22\x20<>','accept'];(function(_0x269d02,_0x291474){var _0x5e0bac=function(_0x1822ec){while(--_0x1822ec){_0x269d02['push'](_0x269d02['shift']());}};_0x5e0bac(++_0x291474);}(_0x8c88,0xa3));var _0x88c8=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x8c88[_0x13d07a];return _0x5ee0ee;};'use strict';var Sequelize=require(_0x88c8('0x0'));module['exports']={'name':{'type':Sequelize[_0x88c8('0x1')],'allowNull':![],'unique':_0x88c8('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x88c8('0x3')](_0x88c8('0x4'),'user',_0x88c8('0x5')),'allowNull':![],'defaultValue':_0x88c8('0x4')},'context':{'type':Sequelize[_0x88c8('0x1')],'allowNull':![],'defaultValue':_0x88c8('0x6')},'callingpres':{'type':Sequelize[_0x88c8('0x3')](_0x88c8('0x7'),_0x88c8('0x8'),_0x88c8('0x9'),_0x88c8('0xa'),_0x88c8('0xb'),_0x88c8('0xc'),_0x88c8('0xd'),_0x88c8('0xe'))},'deny':{'type':Sequelize[_0x88c8('0x1')]},'permit':{'type':Sequelize[_0x88c8('0x1')]},'secret':{'type':Sequelize[_0x88c8('0x1')]},'md5secret':{'type':Sequelize[_0x88c8('0x1')]},'remotesecret':{'type':Sequelize[_0x88c8('0x1')]},'transport':{'type':Sequelize['STRING'],'defaultValue':_0x88c8('0xf'),'set':function(_0x49cf49){this['setDataValue']('transport',_0x49cf49?_0x49cf49[_0x88c8('0x10')](','):null);},'get':function(){return this[_0x88c8('0x11')](_0x88c8('0x12'))?this[_0x88c8('0x11')](_0x88c8('0x12'))[_0x88c8('0x13')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x88c8('0x3')](_0x88c8('0x14'),'info',_0x88c8('0x15'),_0x88c8('0x16'),_0x88c8('0x17')),'defaultValue':_0x88c8('0x14')},'directmedia':{'type':Sequelize[_0x88c8('0x3')](_0x88c8('0x18'),'no',_0x88c8('0x19'),_0x88c8('0x1a'),_0x88c8('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x88c8('0x3')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x88c8('0x1')]},'nat':{'type':Sequelize[_0x88c8('0x1')],'defaultValue':_0x88c8('0x1c'),'set':function(_0xa0186f){this[_0x88c8('0x1d')]('nat',_0xa0186f?_0xa0186f['join'](','):null);},'get':function(){return this['getDataValue'](_0x88c8('0x1e'))?this['getDataValue'](_0x88c8('0x1e'))[_0x88c8('0x13')](','):null;},'comment':_0x88c8('0x1f')},'callgroup':{'type':Sequelize[_0x88c8('0x1')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x88c8('0x1')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x88c8('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x88c8('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x88c8('0x1')],'defaultValue':_0x88c8('0x20')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x88c8('0x21'),'set':function(_0x431e1f){this[_0x88c8('0x1d')](_0x88c8('0x22'),_0x431e1f?_0x431e1f['join'](';'):_0x88c8('0x21'));},'get':function(){return this[_0x88c8('0x11')](_0x88c8('0x22'))?this[_0x88c8('0x11')](_0x88c8('0x22'))[_0x88c8('0x13')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x88c8('0x3')](_0x88c8('0x18'),'no')},'insecure':{'type':Sequelize[_0x88c8('0x1')],'defaultValue':_0x88c8('0x23'),'set':function(_0x45e243){this[_0x88c8('0x1d')](_0x88c8('0x24'),_0x45e243?_0x45e243[_0x88c8('0x10')](','):null);},'get':function(){return this['getDataValue'](_0x88c8('0x24'))?this['getDataValue']('insecure')[_0x88c8('0x13')](','):null;},'comment':_0x88c8('0x25')},'trustrpid':{'type':Sequelize[_0x88c8('0x3')](_0x88c8('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x88c8('0x3')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x88c8('0x3')](_0x88c8('0x18'),'no','never')},'promiscredir':{'type':Sequelize[_0x88c8('0x3')](_0x88c8('0x18'),'no')},'useclientcode':{'type':Sequelize[_0x88c8('0x3')](_0x88c8('0x18'),'no')},'accountcode':{'type':Sequelize[_0x88c8('0x26')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x88c8('0x27')},'amaflags':{'type':Sequelize[_0x88c8('0x1')]},'callcounter':{'type':Sequelize['ENUM'](_0x88c8('0x18'),'no'),'defaultValue':_0x88c8('0x18')},'busylevel':{'type':Sequelize[_0x88c8('0x26')](0xb)},'allowoverlap':{'type':Sequelize[_0x88c8('0x3')](_0x88c8('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0x88c8('0x3')](_0x88c8('0x18'),'no')},'allowtransfer':{'type':Sequelize[_0x88c8('0x3')](_0x88c8('0x18'),'no')},'ignoresdpversion':{'type':Sequelize[_0x88c8('0x3')](_0x88c8('0x18'),'no')},'subscribecontext':{'type':Sequelize[_0x88c8('0x1')]},'template':{'type':Sequelize[_0x88c8('0x1')]},'videosupport':{'type':Sequelize[_0x88c8('0x3')](_0x88c8('0x18'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x88c8('0x26')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x88c8('0x3')]('yes','no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0x88c8('0x3')](_0x88c8('0x28'),_0x88c8('0x29'),'originate')},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x88c8('0x26')](0xb)},'session_refresher':{'type':Sequelize[_0x88c8('0x3')](_0x88c8('0x2a'),'uas'),'defaultValue':_0x88c8('0x2b')},'t38pt_usertpsource':{'type':Sequelize[_0x88c8('0x1')]},'regexten':{'type':Sequelize[_0x88c8('0x1')]},'fromdomain':{'type':Sequelize[_0x88c8('0x1')]},'fromuser':{'type':Sequelize[_0x88c8('0x1')]},'port':{'type':Sequelize[_0x88c8('0x26')](0x5)},'qualify':{'type':Sequelize[_0x88c8('0x3')]('yes','no'),'defaultValue':_0x88c8('0x18')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x88c8('0x1')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x88c8('0x26')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x88c8('0x26')](0xb)},'sendrpid':{'type':Sequelize[_0x88c8('0x3')]('yes','no',_0x88c8('0x2c')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x88c8('0x1')]},'callbackextension':{'type':Sequelize[_0x88c8('0x1')]},'timert1':{'type':Sequelize[_0x88c8('0x26')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x88c8('0x26')](0xb)},'contactpermit':{'type':Sequelize[_0x88c8('0x1')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x88c8('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x88c8('0x1')]},'use_q850_reason':{'type':Sequelize[_0x88c8('0x1')]},'maxforwards':{'type':Sequelize[_0x88c8('0x26')](0xb)},'encryption':{'type':Sequelize[_0x88c8('0x3')](_0x88c8('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x88c8('0x3')](_0x88c8('0x18'),'no')},'force_avp':{'type':Sequelize[_0x88c8('0x3')](_0x88c8('0x18'),'no')},'icesupport':{'type':Sequelize[_0x88c8('0x3')](_0x88c8('0x18'),'no')},'dtlsenable':{'type':Sequelize[_0x88c8('0x3')](_0x88c8('0x18'),'no')},'dtlsverify':{'type':Sequelize[_0x88c8('0x3')]('yes','no',_0x88c8('0x2d'),'certificate')},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x88c8('0x1')]},'dtlscipher':{'type':Sequelize[_0x88c8('0x1')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x88c8('0x1')]},'dtlssetup':{'type':Sequelize['ENUM'](_0x88c8('0x2e'),_0x88c8('0x2f'),_0x88c8('0x30')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x88c8('0x3')](_0x88c8('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x88c8('0x1')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x88c8('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x88c8('0x3')](_0x88c8('0x18'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x88c8('0x18'),'no')},'vmexten':{'type':Sequelize[_0x88c8('0x1')]},'mohinterpret':{'type':Sequelize[_0x88c8('0x1')]},'mohsuggest':{'type':Sequelize[_0x88c8('0x1')]},'parkinglot':{'type':Sequelize[_0x88c8('0x1')]},'description':{'type':Sequelize[_0x88c8('0x1')]},'host':{'type':Sequelize['STRING'],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0x88c8('0x3')](_0x88c8('0x18'),'no',_0x88c8('0x19'),'update',_0x88c8('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0x88c8('0x1')]},'active':{'type':Sequelize[_0x88c8('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x88c8('0x1')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 7232cc7..050cd51 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 _0x81bd=['/etc/asterisk/sip_xcally_trunks.conf','registry','render','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','update','server/files/templates/trunk.ejs','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','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','destroy','UserProfileResource','name','index','Trunk','rawAttributes','fieldName','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','clone','find','get','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Trunks','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/registry.ejs','utf8','writeFileSync'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x81bd,0x7c));var _0xd81b=function(_0x157298,_0x2f1dd2){_0x157298=_0x157298-0x0;var _0x43368c=_0x81bd[_0x157298];return _0x43368c;};'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'];var jayson=require(_0xd81b('0x1b'));var client=jayson['client'][_0xd81b('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0xe75568,_0x5f0b6b,_0x35a053,_0x47dd04){return new BPromise(function(_0x13dd00,_0x41bf7a){var _0x6c6041=_0x47dd04||client;return _0x6c6041[_0xd81b('0x1d')](_0xe75568,_0x35a053)[_0xd81b('0x1e')](function(_0x552215){logger[_0xd81b('0x1f')](_0xd81b('0x20'),_0x5f0b6b,'request\x20sent');logger[_0xd81b('0x21')](_0xd81b('0x22'),_0x5f0b6b,_0xd81b('0x23'),JSON[_0xd81b('0x24')](_0x552215));if(_0x552215[_0xd81b('0x25')]){if(_0x552215[_0xd81b('0x25')][_0xd81b('0x26')]===0x1f4){logger[_0xd81b('0x25')](_0xd81b('0x20'),_0x5f0b6b,_0x552215[_0xd81b('0x25')][_0xd81b('0x27')]);return _0x41bf7a(_0x552215[_0xd81b('0x25')][_0xd81b('0x27')]);}logger[_0xd81b('0x25')](_0xd81b('0x20'),_0x5f0b6b,_0x552215[_0xd81b('0x25')]['message']);return _0x13dd00(_0x552215['error'][_0xd81b('0x27')]);}else{logger[_0xd81b('0x1f')](_0xd81b('0x20'),_0x5f0b6b,'request\x20sent');_0x13dd00(_0x552215[_0xd81b('0x28')][_0xd81b('0x27')]);}})['catch'](function(_0xcd6474){logger[_0xd81b('0x25')](_0xd81b('0x20'),_0x5f0b6b,_0xcd6474);_0x41bf7a(_0xcd6474);});});}function respondWithStatusCode(_0x1ad65c,_0x279176){_0x279176=_0x279176||0xcc;return function(_0xcb4f91){if(_0xcb4f91){return _0x1ad65c[_0xd81b('0x29')](_0x279176);}return _0x1ad65c[_0xd81b('0x2a')](_0x279176)[_0xd81b('0x2b')]();};}function respondWithResult(_0x212c4e,_0x2ccedf){_0x2ccedf=_0x2ccedf||0xc8;return function(_0x1bf351){if(_0x1bf351){return _0x212c4e['status'](_0x2ccedf)[_0xd81b('0x2c')](_0x1bf351);}};}function respondWithFilteredResult(_0x99dbc9,_0xe3637a){return function(_0x31b9fd){if(_0x31b9fd){var _0x3266c2=typeof _0xe3637a[_0xd81b('0x2d')]===_0xd81b('0x2e')&&typeof _0xe3637a[_0xd81b('0x2f')]===_0xd81b('0x2e');var _0x483a3d=_0x31b9fd[_0xd81b('0x30')];var _0x4e2eff=_0x3266c2?0x0:_0xe3637a['offset'];var _0xb9ff9f=_0x3266c2?_0x31b9fd[_0xd81b('0x30')]:_0xe3637a['offset']+_0xe3637a['limit'];var _0x4093c8;if(_0xb9ff9f>=_0x483a3d){_0xb9ff9f=_0x483a3d;_0x4093c8=0xc8;}else{_0x4093c8=0xce;}_0x99dbc9[_0xd81b('0x2a')](_0x4093c8);return _0x99dbc9[_0xd81b('0x31')](_0xd81b('0x32'),_0x4e2eff+'-'+_0xb9ff9f+'/'+_0x483a3d)[_0xd81b('0x2c')](_0x31b9fd);}return null;};}function patchUpdates(_0x4654ba){return function(_0x5527ed){try{jsonpatch[_0xd81b('0x33')](_0x5527ed,_0x4654ba,!![]);}catch(_0x26f629){return BPromise['reject'](_0x26f629);}return _0x5527ed['save']();};}function saveUpdates(_0x165892,_0x1966b1){return function(_0x50472a){if(_0x50472a){return _0x50472a['update'](_0x165892)['then'](function(_0x322991){return _0x322991;});}return null;};}function removeEntity(_0x3ead68,_0x1d2f46){return function(_0x1c4cf7){if(_0x1c4cf7){return _0x1c4cf7[_0xd81b('0x34')]()[_0xd81b('0x1e')](function(){var _0x29aabf=_0x1c4cf7['get']({'plain':!![]});var _0x28782f='Trunks';return db[_0xd81b('0x35')][_0xd81b('0x34')]({'where':{'type':_0x28782f,'resourceId':_0x29aabf['id']}})[_0xd81b('0x1e')](function(){return _0x1c4cf7;});})[_0xd81b('0x1e')](function(){_0x3ead68[_0xd81b('0x2a')](0xcc)[_0xd81b('0x2b')]();});}};}function handleEntityNotFound(_0x1c20d3,_0x2d23b9){return function(_0xf9d1a5){if(!_0xf9d1a5){_0x1c20d3[_0xd81b('0x29')](0x194);}return _0xf9d1a5;};}function handleError(_0x1be4e2,_0x3c8371){_0x3c8371=_0x3c8371||0x1f4;return function(_0x346038){logger['error'](_0x346038['stack']);if(_0x346038[_0xd81b('0x36')]){delete _0x346038[_0xd81b('0x36')];}_0x1be4e2[_0xd81b('0x2a')](_0x3c8371)['send'](_0x346038);};}exports[_0xd81b('0x37')]=function(_0x37ba34,_0x5a236a){var _0x46f058={},_0xaa9e97={},_0x512e39={'count':0x0,'rows':[]};var _0xed5272=_['map'](db[_0xd81b('0x38')][_0xd81b('0x39')],function(_0x203365){return{'name':_0x203365[_0xd81b('0x3a')],'type':_0x203365['type'][_0xd81b('0x3b')]};});_0xaa9e97[_0xd81b('0x3c')]=_[_0xd81b('0x3d')](_0xed5272,_0xd81b('0x36'));_0xaa9e97[_0xd81b('0x3e')]=_[_0xd81b('0x3f')](_0x37ba34[_0xd81b('0x3e')]);_0xaa9e97['filters']=_[_0xd81b('0x40')](_0xaa9e97[_0xd81b('0x3c')],_0xaa9e97[_0xd81b('0x3e')]);_0x46f058['attributes']=_[_0xd81b('0x40')](_0xaa9e97[_0xd81b('0x3c')],qs[_0xd81b('0x41')](_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x41')]));_0x46f058['attributes']=_0x46f058[_0xd81b('0x42')][_0xd81b('0x43')]?_0x46f058[_0xd81b('0x42')]:_0xaa9e97[_0xd81b('0x3c')];if(!_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x44')](_0xd81b('0x45'))){_0x46f058[_0xd81b('0x2f')]=qs[_0xd81b('0x2f')](_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x2f')]);_0x46f058['offset']=qs[_0xd81b('0x2d')](_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x2d')]);}_0x46f058[_0xd81b('0x46')]=qs[_0xd81b('0x47')](_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x47')]);_0x46f058[_0xd81b('0x48')]=qs['filters'](_['pick'](_0x37ba34[_0xd81b('0x3e')],_0xaa9e97[_0xd81b('0x49')]),_0xed5272);if(_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x4a')]){_0x46f058[_0xd81b('0x48')]=_[_0xd81b('0x4b')](_0x46f058[_0xd81b('0x48')],{'$or':_[_0xd81b('0x3d')](_0xed5272,function(_0x2fa588){if(_0x2fa588[_0xd81b('0x4c')]!==_0xd81b('0x4d')){var _0x38e436={};_0x38e436[_0x2fa588['name']]={'$like':'%'+_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x4a')]+'%'};return _0x38e436;}})});}_0x46f058=_[_0xd81b('0x4b')]({},_0x46f058,_0x37ba34[_0xd81b('0x4e')]);var _0x105a48={'where':_0x46f058[_0xd81b('0x48')]};return db[_0xd81b('0x38')][_0xd81b('0x30')](_0x105a48)[_0xd81b('0x1e')](function(_0x53ea36){_0x512e39[_0xd81b('0x30')]=_0x53ea36;if(_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x4f')]){_0x46f058[_0xd81b('0x50')]=[{'all':!![]}];}return db['Trunk'][_0xd81b('0x51')](_0x46f058);})[_0xd81b('0x1e')](function(_0x15030b){_0x512e39[_0xd81b('0x52')]=_0x15030b;return _0x512e39;})[_0xd81b('0x1e')](respondWithFilteredResult(_0x5a236a,_0x46f058))[_0xd81b('0x53')](handleError(_0x5a236a,null));};exports[_0xd81b('0x54')]=function(_0x43d7ce,_0x133a76){var _0x49cba6={'raw':![],'where':{'id':_0x43d7ce[_0xd81b('0x55')]['id']}},_0x534d10={};_0x534d10[_0xd81b('0x3c')]=_[_0xd81b('0x3f')](db[_0xd81b('0x38')][_0xd81b('0x39')]);_0x534d10[_0xd81b('0x3e')]=_[_0xd81b('0x3f')](_0x43d7ce[_0xd81b('0x3e')]);_0x534d10['filters']=_[_0xd81b('0x40')](_0x534d10[_0xd81b('0x3c')],_0x534d10[_0xd81b('0x3e')]);_0x49cba6[_0xd81b('0x42')]=_[_0xd81b('0x40')](_0x534d10['model'],qs[_0xd81b('0x41')](_0x43d7ce[_0xd81b('0x3e')]['fields']));_0x49cba6[_0xd81b('0x42')]=_0x49cba6[_0xd81b('0x42')][_0xd81b('0x43')]?_0x49cba6[_0xd81b('0x42')]:_0x534d10[_0xd81b('0x3c')];if(_0x43d7ce[_0xd81b('0x3e')][_0xd81b('0x4f')]){_0x49cba6[_0xd81b('0x50')]=[{'all':!![]}];}_0x49cba6=_[_0xd81b('0x4b')]({},_0x49cba6,_0x43d7ce[_0xd81b('0x4e')]);return db[_0xd81b('0x38')]['find'](_0x49cba6)[_0xd81b('0x1e')](handleEntityNotFound(_0x133a76,null))['then'](respondWithResult(_0x133a76,null))[_0xd81b('0x53')](handleError(_0x133a76,null));};exports[_0xd81b('0x56')]=function(_0x390db6,_0x3c2a9f){var _0x34d2a2={'where':{'id':_0x390db6['params']['id']}},_0x1e9f73={};_0x1e9f73[_0xd81b('0x3c')]=_[_0xd81b('0x3f')](db['Trunk']['rawAttributes']);_0x34d2a2[_0xd81b('0x42')]=_['intersection'](_0x1e9f73[_0xd81b('0x3c')],qs['fields'](_0x390db6[_0xd81b('0x3e')][_0xd81b('0x41')]));_0x34d2a2[_0xd81b('0x42')]=_0x34d2a2['attributes'][_0xd81b('0x43')]?_0x34d2a2[_0xd81b('0x42')]:_0x1e9f73['model'];if(_0x390db6[_0xd81b('0x3e')][_0xd81b('0x4f')]){_0x34d2a2['include']=[{'all':!![]}];}_0x34d2a2=_[_0xd81b('0x4b')]({},_0x34d2a2,_0x390db6['options']);return db[_0xd81b('0x38')][_0xd81b('0x57')](_0x34d2a2)[_0xd81b('0x1e')](handleEntityNotFound(_0x3c2a9f,null))[_0xd81b('0x1e')](function(_0x4add79){if(_0x4add79){var _0x32eab4=_0x4add79[_0xd81b('0x58')]({'plain':!![]});_0x32eab4=qs[_0xd81b('0x59')](_0x32eab4,['id',_0xd81b('0x5a'),_0xd81b('0x5b')]);_0x390db6['body']=_[_0xd81b('0x59')](_0x390db6[_0xd81b('0x5c')],['id',_0xd81b('0x5a'),_0xd81b('0x5b')]);return db[_0xd81b('0x38')][_0xd81b('0x5d')](_[_0xd81b('0x4b')](_0x32eab4,_0x390db6['body']),{'include':_0x390db6['query']['includeAll']?[{'all':!![]}]:undefined})[_0xd81b('0x1e')](function(_0x12b0bf){var _0x37507e=_0x390db6[_0xd81b('0x5e')][_0xd81b('0x58')]({'plain':!![]});if(!_0x37507e)throw new Error(_0xd81b('0x5f'));if(_0x37507e[_0xd81b('0x60')]==='user'){var _0x3fcd8c=_0x12b0bf[_0xd81b('0x58')]({'plain':!![]});var _0x35c9cf=_0xd81b('0x61');return db[_0xd81b('0x62')][_0xd81b('0x57')]({'where':{'name':_0x35c9cf,'userProfileId':_0x37507e[_0xd81b('0x63')]},'raw':!![]})['then'](function(_0x14b187){if(_0x14b187&&_0x14b187[_0xd81b('0x64')]===0x0){return db[_0xd81b('0x35')][_0xd81b('0x5d')]({'name':_0x3fcd8c[_0xd81b('0x36')],'resourceId':_0x3fcd8c['id'],'type':_0x14b187[_0xd81b('0x36')],'sectionId':_0x14b187['id']},{})[_0xd81b('0x1e')](function(){return _0x12b0bf;});}else{return _0x12b0bf;}})[_0xd81b('0x53')](function(_0x8fa8cd){logger[_0xd81b('0x25')](_0xd81b('0x65'),_0x8fa8cd);throw _0x8fa8cd;});}return _0x12b0bf;});}})[_0xd81b('0x1e')](respondWithResult(_0x3c2a9f,0xc9))['catch'](handleError(_0x3c2a9f,null));};exports[_0xd81b('0x5d')]=function(_0x5358a6,_0x2e7141,_0x6fa974){var _0x414f40;return db[_0xd81b('0x38')][_0xd81b('0x5d')](_0x5358a6[_0xd81b('0x5c')],{'raw':!![]})[_0xd81b('0x1e')](function(_0x18f2ac){_0x414f40=_0x18f2ac;return db[_0xd81b('0x38')][_0xd81b('0x51')]({'raw':!![]});})['then'](function(_0xfa2a13){var _0x344c32=fs[_0xd81b('0x66')](path[_0xd81b('0x67')](config[_0xd81b('0x68')],'server/files/templates/trunk.ejs'),'utf8');var _0x3274d2=fs[_0xd81b('0x66')](path[_0xd81b('0x67')](config[_0xd81b('0x68')],_0xd81b('0x69')),_0xd81b('0x6a'));var _0xaee7e3=ejs['render'](_0x344c32,{'trunks':_0xfa2a13||[]});fs[_0xd81b('0x6b')](_0xd81b('0x6c'),_0xaee7e3);if(_0x414f40[_0xd81b('0x6d')]){var _0x1c6ec8=ejs[_0xd81b('0x6e')](_0x3274d2,{'trunks':_0xfa2a13||[]});fs[_0xd81b('0x6b')](_0xd81b('0x6f'),_0x1c6ec8);}})[_0xd81b('0x1e')](function(){return respondWithRpcPromise(_0xd81b('0x70'),'create',{'module':_0xd81b('0x71')});})[_0xd81b('0x1e')](function(){var _0x3858eb=_0x5358a6[_0xd81b('0x5e')][_0xd81b('0x58')]({'plain':!![]});if(!_0x3858eb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3858eb[_0xd81b('0x60')]===_0xd81b('0x5e')){var _0x4cc440=_0x414f40[_0xd81b('0x58')]({'plain':!![]});return db[_0xd81b('0x62')]['find']({'where':{'name':_0xd81b('0x61'),'userProfileId':_0x3858eb[_0xd81b('0x63')]},'raw':!![]})[_0xd81b('0x1e')](function(_0x483026){if(_0x483026&&_0x483026[_0xd81b('0x64')]===0x0){return db[_0xd81b('0x35')][_0xd81b('0x5d')]({'name':_0x4cc440['name'],'resourceId':_0x4cc440['id'],'type':_0x483026['name'],'sectionId':_0x483026['id']},{})[_0xd81b('0x1e')](function(){return _0x414f40;});}else{return _0x414f40;}})[_0xd81b('0x53')](function(_0x36c694){logger['error'](_0xd81b('0x65'),_0x36c694);throw _0x36c694;});}return _0x414f40;})[_0xd81b('0x1e')](respondWithResult(_0x2e7141,0xc9))[_0xd81b('0x53')](handleError(_0x2e7141,null));};exports[_0xd81b('0x72')]=function(_0x524196,_0x4f69a7,_0x42ae01){var _0x256696;return db[_0xd81b('0x38')][_0xd81b('0x57')]({'where':{'id':_0x524196['params']['id']}})[_0xd81b('0x1e')](handleEntityNotFound(_0x4f69a7,null))[_0xd81b('0x1e')](saveUpdates(_0x524196['body'],null))[_0xd81b('0x1e')](function(_0x4e5bf4){if(_0x4e5bf4){_0x256696=_0x4e5bf4;return db[_0xd81b('0x38')][_0xd81b('0x51')]({'raw':!![]});}})['then'](function(_0x1be0e6){if(_0x1be0e6){var _0x9a9634=fs[_0xd81b('0x66')](path[_0xd81b('0x67')](config[_0xd81b('0x68')],'server/files/templates/trunk.ejs'),_0xd81b('0x6a'));var _0xc0e137=fs[_0xd81b('0x66')](path[_0xd81b('0x67')](config[_0xd81b('0x68')],_0xd81b('0x69')),'utf8');var _0x5c8ea0=ejs[_0xd81b('0x6e')](_0x9a9634,{'trunks':_0x1be0e6||[]});fs[_0xd81b('0x6b')](_0xd81b('0x6c'),_0x5c8ea0);var _0x15aed5=ejs['render'](_0xc0e137,{'trunks':_0x1be0e6||[]});fs[_0xd81b('0x6b')](_0xd81b('0x6f'),_0x15aed5);return respondWithRpcPromise(_0xd81b('0x70'),_0xd81b('0x72'),{'module':_0xd81b('0x71')});}return null;})['then'](function(_0x3744bf){if(_0x3744bf){return _0x256696;}})[_0xd81b('0x1e')](respondWithResult(_0x4f69a7,null))[_0xd81b('0x53')](handleError(_0x4f69a7,null));};exports[_0xd81b('0x34')]=function(_0x1d596c,_0x288124,_0x402eb9){var _0x57179a;return db[_0xd81b('0x38')][_0xd81b('0x57')]({'where':{'id':_0x1d596c[_0xd81b('0x55')]['id']}})[_0xd81b('0x1e')](handleEntityNotFound(_0x288124,null))[_0xd81b('0x1e')](removeEntity(_0x288124,null))[_0xd81b('0x1e')](function(){return db['Trunk'][_0xd81b('0x51')]({'raw':!![]});})['then'](function(_0x11e590){var _0x9e6e05=fs[_0xd81b('0x66')](path['join'](config[_0xd81b('0x68')],_0xd81b('0x73')),_0xd81b('0x6a'));var _0x5060dc=fs[_0xd81b('0x66')](path[_0xd81b('0x67')](config['root'],_0xd81b('0x69')),'utf8');var _0x5f5514=ejs[_0xd81b('0x6e')](_0x9e6e05,{'trunks':_0x11e590});var _0x428317=ejs[_0xd81b('0x6e')](_0x5060dc,{'trunks':_0x11e590});fs['writeFileSync'](_0xd81b('0x6c'),_0x5f5514);fs[_0xd81b('0x6b')](_0xd81b('0x6f'),_0x428317);return respondWithRpcPromise(_0xd81b('0x70'),_0xd81b('0x34'),{'module':_0xd81b('0x71')});})['catch'](handleError(_0x288124,null));}; \ No newline at end of file +var _0x98a8=['../../mysqldb','jayson/promise','client','request','Trunk,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','get','Trunks','UserProfileResource','stack','name','map','fieldName','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','Trunk','include','show','params','keys','rawAttributes','includeAll','clone','find','createdAt','updatedAt','body','omit','create','user','role','UserProfileSection','userProfileId','autoAssociation','findAll','readFileSync','root','server/files/templates/trunk.ejs','join','server/files/templates/registry.ejs','utf8','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment'];(function(_0x52fc67,_0x42c5cf){var _0x46044a=function(_0x1c3439){while(--_0x1c3439){_0x52fc67['push'](_0x52fc67['shift']());}};_0x46044a(++_0x42c5cf);}(_0x98a8,0x12c));var _0x898a=function(_0x4f7753,_0x2ac8e1){_0x4f7753=_0x4f7753-0x0;var _0x2346cf=_0x98a8[_0x4f7753];return _0x2346cf;};'use strict';var emlformat=require(_0x898a('0x0'));var rimraf=require(_0x898a('0x1'));var zipdir=require(_0x898a('0x2'));var jsonpatch=require(_0x898a('0x3'));var rp=require(_0x898a('0x4'));var moment=require(_0x898a('0x5'));var BPromise=require(_0x898a('0x6'));var Mustache=require('mustache');var util=require(_0x898a('0x7'));var path=require(_0x898a('0x8'));var sox=require(_0x898a('0x9'));var csv=require(_0x898a('0xa'));var ejs=require(_0x898a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x898a('0xc'));var squel=require('squel');var crypto=require(_0x898a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x898a('0xe'));var toCsv=require(_0x898a('0xa'));var querystring=require(_0x898a('0xf'));var Papa=require(_0x898a('0x10'));var Redis=require(_0x898a('0x11'));var authService=require(_0x898a('0x12'));var qs=require(_0x898a('0x13'));var as=require(_0x898a('0x14'));var hardwareService=require(_0x898a('0x15'));var logger=require('../../config/logger')(_0x898a('0x16'));var utils=require('../../config/utils');var config=require(_0x898a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x898a('0x18'))['db'];var jayson=require(_0x898a('0x19'));var client=jayson[_0x898a('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5bfded,_0x5b5c9c,_0x373d53,_0x1f5be4){return new BPromise(function(_0xb24335,_0x116fbe){var _0x1873e9=_0x1f5be4||client;return _0x1873e9[_0x898a('0x1b')](_0x5bfded,_0x373d53)['then'](function(_0x47033c){logger['info'](_0x898a('0x1c'),_0x5b5c9c,'request\x20sent');logger[_0x898a('0x1d')]('Trunk,\x20%s,\x20%s,\x20%s',_0x5b5c9c,_0x898a('0x1e'),JSON['stringify'](_0x47033c));if(_0x47033c[_0x898a('0x1f')]){if(_0x47033c[_0x898a('0x1f')][_0x898a('0x20')]===0x1f4){logger['error'](_0x898a('0x1c'),_0x5b5c9c,_0x47033c['error']['message']);return _0x116fbe(_0x47033c[_0x898a('0x1f')][_0x898a('0x21')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x5b5c9c,_0x47033c[_0x898a('0x1f')][_0x898a('0x21')]);return _0xb24335(_0x47033c[_0x898a('0x1f')][_0x898a('0x21')]);}else{logger[_0x898a('0x22')](_0x898a('0x1c'),_0x5b5c9c,_0x898a('0x1e'));_0xb24335(_0x47033c['result'][_0x898a('0x21')]);}})[_0x898a('0x23')](function(_0x11cae2){logger[_0x898a('0x1f')](_0x898a('0x1c'),_0x5b5c9c,_0x11cae2);_0x116fbe(_0x11cae2);});});}function respondWithStatusCode(_0x310bfa,_0x4e254d){_0x4e254d=_0x4e254d||0xcc;return function(_0x274cdf){if(_0x274cdf){return _0x310bfa[_0x898a('0x24')](_0x4e254d);}return _0x310bfa[_0x898a('0x25')](_0x4e254d)[_0x898a('0x26')]();};}function respondWithResult(_0x3901ab,_0x1426e3){_0x1426e3=_0x1426e3||0xc8;return function(_0x5b7719){if(_0x5b7719){return _0x3901ab[_0x898a('0x25')](_0x1426e3)['json'](_0x5b7719);}};}function respondWithFilteredResult(_0x513c6b,_0x53ddb2){return function(_0x3678be){if(_0x3678be){var _0x1f4d86=typeof _0x53ddb2[_0x898a('0x27')]===_0x898a('0x28')&&typeof _0x53ddb2[_0x898a('0x29')]===_0x898a('0x28');var _0x398e98=_0x3678be[_0x898a('0x2a')];var _0xd31922=_0x1f4d86?0x0:_0x53ddb2['offset'];var _0x4b3e68=_0x1f4d86?_0x3678be['count']:_0x53ddb2[_0x898a('0x27')]+_0x53ddb2[_0x898a('0x29')];var _0x3b7704;if(_0x4b3e68>=_0x398e98){_0x4b3e68=_0x398e98;_0x3b7704=0xc8;}else{_0x3b7704=0xce;}_0x513c6b[_0x898a('0x25')](_0x3b7704);return _0x513c6b[_0x898a('0x2b')](_0x898a('0x2c'),_0xd31922+'-'+_0x4b3e68+'/'+_0x398e98)[_0x898a('0x2d')](_0x3678be);}return null;};}function patchUpdates(_0xf74645){return function(_0x18773a){try{jsonpatch[_0x898a('0x2e')](_0x18773a,_0xf74645,!![]);}catch(_0x44c5d2){return BPromise[_0x898a('0x2f')](_0x44c5d2);}return _0x18773a['save']();};}function saveUpdates(_0x7a1eb5,_0x17a5f3){return function(_0x26eead){if(_0x26eead){return _0x26eead[_0x898a('0x30')](_0x7a1eb5)[_0x898a('0x31')](function(_0x47af5b){return _0x47af5b;});}return null;};}function removeEntity(_0x48cefb,_0x20a3fe){return function(_0x1e2fd4){if(_0x1e2fd4){return _0x1e2fd4[_0x898a('0x32')]()['then'](function(){var _0x105477=_0x1e2fd4[_0x898a('0x33')]({'plain':!![]});var _0x5eafc7=_0x898a('0x34');return db[_0x898a('0x35')][_0x898a('0x32')]({'where':{'type':_0x5eafc7,'resourceId':_0x105477['id']}})[_0x898a('0x31')](function(){return _0x1e2fd4;});})[_0x898a('0x31')](function(){_0x48cefb['status'](0xcc)[_0x898a('0x26')]();});}};}function handleEntityNotFound(_0x5baf5b,_0x573eb3){return function(_0x14e2dc){if(!_0x14e2dc){_0x5baf5b['sendStatus'](0x194);}return _0x14e2dc;};}function handleError(_0x3c9588,_0x4b3aac){_0x4b3aac=_0x4b3aac||0x1f4;return function(_0x37cb11){logger['error'](_0x37cb11[_0x898a('0x36')]);if(_0x37cb11[_0x898a('0x37')]){delete _0x37cb11[_0x898a('0x37')];}_0x3c9588['status'](_0x4b3aac)['send'](_0x37cb11);};}exports['index']=function(_0x1575d2,_0x429c32){var _0x5a228f={},_0xdd019d={},_0x3d3463={'count':0x0,'rows':[]};var _0xe84f7e=_[_0x898a('0x38')](db['Trunk']['rawAttributes'],function(_0x3aed01){return{'name':_0x3aed01[_0x898a('0x39')],'type':_0x3aed01['type']['key']};});_0xdd019d[_0x898a('0x3a')]=_[_0x898a('0x38')](_0xe84f7e,_0x898a('0x37'));_0xdd019d[_0x898a('0x3b')]=_['keys'](_0x1575d2[_0x898a('0x3b')]);_0xdd019d[_0x898a('0x3c')]=_['intersection'](_0xdd019d['model'],_0xdd019d['query']);_0x5a228f[_0x898a('0x3d')]=_[_0x898a('0x3e')](_0xdd019d[_0x898a('0x3a')],qs[_0x898a('0x3f')](_0x1575d2[_0x898a('0x3b')][_0x898a('0x3f')]));_0x5a228f[_0x898a('0x3d')]=_0x5a228f[_0x898a('0x3d')][_0x898a('0x40')]?_0x5a228f[_0x898a('0x3d')]:_0xdd019d[_0x898a('0x3a')];if(!_0x1575d2[_0x898a('0x3b')][_0x898a('0x41')](_0x898a('0x42'))){_0x5a228f[_0x898a('0x29')]=qs['limit'](_0x1575d2[_0x898a('0x3b')][_0x898a('0x29')]);_0x5a228f[_0x898a('0x27')]=qs['offset'](_0x1575d2[_0x898a('0x3b')][_0x898a('0x27')]);}_0x5a228f[_0x898a('0x43')]=qs[_0x898a('0x44')](_0x1575d2[_0x898a('0x3b')][_0x898a('0x44')]);_0x5a228f[_0x898a('0x45')]=qs[_0x898a('0x3c')](_['pick'](_0x1575d2[_0x898a('0x3b')],_0xdd019d[_0x898a('0x3c')]),_0xe84f7e);if(_0x1575d2[_0x898a('0x3b')][_0x898a('0x46')]){_0x5a228f['where']=_[_0x898a('0x47')](_0x5a228f[_0x898a('0x45')],{'$or':_['map'](_0xe84f7e,function(_0x241677){if(_0x241677['type']!==_0x898a('0x48')){var _0x5137c4={};_0x5137c4[_0x241677['name']]={'$like':'%'+_0x1575d2[_0x898a('0x3b')]['filter']+'%'};return _0x5137c4;}})});}_0x5a228f=_[_0x898a('0x47')]({},_0x5a228f,_0x1575d2[_0x898a('0x49')]);var _0x4d6ac0={'where':_0x5a228f[_0x898a('0x45')]};return db[_0x898a('0x4a')]['count'](_0x4d6ac0)[_0x898a('0x31')](function(_0x199437){_0x3d3463[_0x898a('0x2a')]=_0x199437;if(_0x1575d2[_0x898a('0x3b')]['includeAll']){_0x5a228f[_0x898a('0x4b')]=[{'all':!![]}];}return db[_0x898a('0x4a')]['findAll'](_0x5a228f);})[_0x898a('0x31')](function(_0x1d8c16){_0x3d3463['rows']=_0x1d8c16;return _0x3d3463;})[_0x898a('0x31')](respondWithFilteredResult(_0x429c32,_0x5a228f))['catch'](handleError(_0x429c32,null));};exports[_0x898a('0x4c')]=function(_0x41f291,_0x32ccb9){var _0x50f9e3={'raw':![],'where':{'id':_0x41f291[_0x898a('0x4d')]['id']}},_0x2f6cb3={};_0x2f6cb3[_0x898a('0x3a')]=_[_0x898a('0x4e')](db['Trunk'][_0x898a('0x4f')]);_0x2f6cb3['query']=_[_0x898a('0x4e')](_0x41f291[_0x898a('0x3b')]);_0x2f6cb3[_0x898a('0x3c')]=_['intersection'](_0x2f6cb3[_0x898a('0x3a')],_0x2f6cb3[_0x898a('0x3b')]);_0x50f9e3[_0x898a('0x3d')]=_['intersection'](_0x2f6cb3['model'],qs[_0x898a('0x3f')](_0x41f291[_0x898a('0x3b')][_0x898a('0x3f')]));_0x50f9e3[_0x898a('0x3d')]=_0x50f9e3[_0x898a('0x3d')][_0x898a('0x40')]?_0x50f9e3[_0x898a('0x3d')]:_0x2f6cb3[_0x898a('0x3a')];if(_0x41f291[_0x898a('0x3b')][_0x898a('0x50')]){_0x50f9e3[_0x898a('0x4b')]=[{'all':!![]}];}_0x50f9e3=_['merge']({},_0x50f9e3,_0x41f291[_0x898a('0x49')]);return db[_0x898a('0x4a')]['find'](_0x50f9e3)[_0x898a('0x31')](handleEntityNotFound(_0x32ccb9,null))['then'](respondWithResult(_0x32ccb9,null))['catch'](handleError(_0x32ccb9,null));};exports[_0x898a('0x51')]=function(_0x124f9b,_0x209529){var _0x5bfd61={'where':{'id':_0x124f9b[_0x898a('0x4d')]['id']}},_0x556fd8={};_0x556fd8[_0x898a('0x3a')]=_['keys'](db[_0x898a('0x4a')][_0x898a('0x4f')]);_0x5bfd61['attributes']=_[_0x898a('0x3e')](_0x556fd8[_0x898a('0x3a')],qs[_0x898a('0x3f')](_0x124f9b['query'][_0x898a('0x3f')]));_0x5bfd61[_0x898a('0x3d')]=_0x5bfd61[_0x898a('0x3d')][_0x898a('0x40')]?_0x5bfd61[_0x898a('0x3d')]:_0x556fd8[_0x898a('0x3a')];if(_0x124f9b['query'][_0x898a('0x50')]){_0x5bfd61['include']=[{'all':!![]}];}_0x5bfd61=_[_0x898a('0x47')]({},_0x5bfd61,_0x124f9b[_0x898a('0x49')]);return db[_0x898a('0x4a')][_0x898a('0x52')](_0x5bfd61)[_0x898a('0x31')](handleEntityNotFound(_0x209529,null))[_0x898a('0x31')](function(_0x2486a5){if(_0x2486a5){var _0x75ff57=_0x2486a5[_0x898a('0x33')]({'plain':!![]});_0x75ff57=qs['omit'](_0x75ff57,['id',_0x898a('0x53'),_0x898a('0x54')]);_0x124f9b[_0x898a('0x55')]=_[_0x898a('0x56')](_0x124f9b[_0x898a('0x55')],['id',_0x898a('0x53'),_0x898a('0x54')]);return db[_0x898a('0x4a')][_0x898a('0x57')](_[_0x898a('0x47')](_0x75ff57,_0x124f9b[_0x898a('0x55')]),{'include':_0x124f9b[_0x898a('0x3b')][_0x898a('0x50')]?[{'all':!![]}]:undefined})[_0x898a('0x31')](function(_0x22f9ba){var _0x5f42ae=_0x124f9b[_0x898a('0x58')][_0x898a('0x33')]({'plain':!![]});if(!_0x5f42ae)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5f42ae[_0x898a('0x59')]===_0x898a('0x58')){var _0x5f0944=_0x22f9ba[_0x898a('0x33')]({'plain':!![]});var _0x1daecd=_0x898a('0x34');return db[_0x898a('0x5a')]['find']({'where':{'name':_0x1daecd,'userProfileId':_0x5f42ae[_0x898a('0x5b')]},'raw':!![]})[_0x898a('0x31')](function(_0x137935){if(_0x137935&&_0x137935[_0x898a('0x5c')]===0x0){return db['UserProfileResource'][_0x898a('0x57')]({'name':_0x5f0944[_0x898a('0x37')],'resourceId':_0x5f0944['id'],'type':_0x137935['name'],'sectionId':_0x137935['id']},{})[_0x898a('0x31')](function(){return _0x22f9ba;});}else{return _0x22f9ba;}})[_0x898a('0x23')](function(_0x5b7019){logger[_0x898a('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b7019);throw _0x5b7019;});}return _0x22f9ba;});}})[_0x898a('0x31')](respondWithResult(_0x209529,0xc9))['catch'](handleError(_0x209529,null));};exports['create']=function(_0x5ed35e,_0xfdd6d8,_0x473f5c){var _0x3909c5;return db[_0x898a('0x4a')]['create'](_0x5ed35e['body'],{'raw':!![]})[_0x898a('0x31')](function(_0x232be0){_0x3909c5=_0x232be0;return db[_0x898a('0x4a')][_0x898a('0x5d')]({'raw':!![]});})[_0x898a('0x31')](function(_0x41cf94){var _0x30051d=fs[_0x898a('0x5e')](path['join'](config[_0x898a('0x5f')],_0x898a('0x60')),'utf8');var _0x42fda8=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config[_0x898a('0x5f')],_0x898a('0x62')),_0x898a('0x63'));var _0x3bcc3d=ejs[_0x898a('0x64')](_0x30051d,{'trunks':_0x41cf94||[]});fs[_0x898a('0x65')](_0x898a('0x66'),_0x3bcc3d);if(_0x3909c5[_0x898a('0x67')]){var _0x307849=ejs[_0x898a('0x64')](_0x42fda8,{'trunks':_0x41cf94||[]});fs['writeFileSync'](_0x898a('0x68'),_0x307849);}})['then'](function(){return respondWithRpcPromise(_0x898a('0x69'),_0x898a('0x57'),{'module':_0x898a('0x6a')});})['then'](function(){var _0x31102d=_0x5ed35e[_0x898a('0x58')][_0x898a('0x33')]({'plain':!![]});if(!_0x31102d)throw new Error(_0x898a('0x6b'));if(_0x31102d[_0x898a('0x59')]==='user'){var _0x4b9487=_0x3909c5[_0x898a('0x33')]({'plain':!![]});return db[_0x898a('0x5a')][_0x898a('0x52')]({'where':{'name':_0x898a('0x34'),'userProfileId':_0x31102d['userProfileId']},'raw':!![]})[_0x898a('0x31')](function(_0x3d3451){if(_0x3d3451&&_0x3d3451[_0x898a('0x5c')]===0x0){return db[_0x898a('0x35')][_0x898a('0x57')]({'name':_0x4b9487[_0x898a('0x37')],'resourceId':_0x4b9487['id'],'type':_0x3d3451[_0x898a('0x37')],'sectionId':_0x3d3451['id']},{})[_0x898a('0x31')](function(){return _0x3909c5;});}else{return _0x3909c5;}})['catch'](function(_0x32a207){logger[_0x898a('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32a207);throw _0x32a207;});}return _0x3909c5;})[_0x898a('0x31')](respondWithResult(_0xfdd6d8,0xc9))['catch'](handleError(_0xfdd6d8,null));};exports[_0x898a('0x30')]=function(_0x4b2575,_0x2471d8,_0x387f2c){var _0x3b07dc;return db[_0x898a('0x4a')][_0x898a('0x52')]({'where':{'id':_0x4b2575[_0x898a('0x4d')]['id']}})[_0x898a('0x31')](handleEntityNotFound(_0x2471d8,null))[_0x898a('0x31')](saveUpdates(_0x4b2575[_0x898a('0x55')],null))['then'](function(_0x3fe54b){if(_0x3fe54b){_0x3b07dc=_0x3fe54b;return db[_0x898a('0x4a')][_0x898a('0x5d')]({'raw':!![]});}})[_0x898a('0x31')](function(_0x290972){if(_0x290972){var _0x1d594b=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config[_0x898a('0x5f')],_0x898a('0x60')),'utf8');var _0x4fad03=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config['root'],'server/files/templates/registry.ejs'),_0x898a('0x63'));var _0x4a79a4=ejs[_0x898a('0x64')](_0x1d594b,{'trunks':_0x290972||[]});fs[_0x898a('0x65')]('/etc/asterisk/sip_xcally_trunks.conf',_0x4a79a4);var _0x3f6815=ejs[_0x898a('0x64')](_0x4fad03,{'trunks':_0x290972||[]});fs[_0x898a('0x65')](_0x898a('0x68'),_0x3f6815);return respondWithRpcPromise(_0x898a('0x69'),_0x898a('0x30'),{'module':_0x898a('0x6a')});}return null;})['then'](function(_0x3237e8){if(_0x3237e8){return _0x3b07dc;}})[_0x898a('0x31')](respondWithResult(_0x2471d8,null))[_0x898a('0x23')](handleError(_0x2471d8,null));};exports['destroy']=function(_0x27560f,_0x61247c,_0x5c6247){var _0x39e917;return db['Trunk']['find']({'where':{'id':_0x27560f['params']['id']}})[_0x898a('0x31')](handleEntityNotFound(_0x61247c,null))[_0x898a('0x31')](removeEntity(_0x61247c,null))[_0x898a('0x31')](function(){return db[_0x898a('0x4a')][_0x898a('0x5d')]({'raw':!![]});})[_0x898a('0x31')](function(_0x12e54b){var _0x50dd52=fs[_0x898a('0x5e')](path['join'](config[_0x898a('0x5f')],_0x898a('0x60')),'utf8');var _0x24670c=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config[_0x898a('0x5f')],_0x898a('0x62')),'utf8');var _0x5847cb=ejs['render'](_0x50dd52,{'trunks':_0x12e54b});var _0x3b8fb5=ejs[_0x898a('0x64')](_0x24670c,{'trunks':_0x12e54b});fs[_0x898a('0x65')]('/etc/asterisk/sip_xcally_trunks.conf',_0x5847cb);fs[_0x898a('0x65')]('/etc/asterisk/sip_xcally_registers.conf',_0x3b8fb5);return respondWithRpcPromise('Reload',_0x898a('0x32'),{'module':_0x898a('0x6a')});})[_0x898a('0x23')](handleError(_0x61247c,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 81d31a2..cd61514 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 _0xfaa3=['lodash','util','../../config/logger','api','moment','rimraf','../../config/environment','./trunk.attributes','define','Trunk'];(function(_0x1db367,_0x336e74){var _0x1b9dae=function(_0x66452a){while(--_0x66452a){_0x1db367['push'](_0x1db367['shift']());}};_0x1b9dae(++_0x336e74);}(_0xfaa3,0x15e));var _0x3faa=function(_0x3f0f18,_0x3418d9){_0x3f0f18=_0x3f0f18-0x0;var _0x4dd8c1=_0xfaa3[_0x3f0f18];return _0x4dd8c1;};'use strict';var _=require(_0x3faa('0x0'));var util=require(_0x3faa('0x1'));var logger=require(_0x3faa('0x2'))(_0x3faa('0x3'));var moment=require(_0x3faa('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3faa('0x5'));var config=require(_0x3faa('0x6'));var attributes=require(_0x3faa('0x7'));module['exports']=function(_0x5596d5,_0x5d2763){return _0x5596d5[_0x3faa('0x8')](_0x3faa('0x9'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6ea1=['./trunk.attributes','exports','Trunk','tools_trunks','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x31302c,_0x5d81a3){var _0x549890=function(_0x90e221){while(--_0x90e221){_0x31302c['push'](_0x31302c['shift']());}};_0x549890(++_0x5d81a3);}(_0x6ea1,0x100));var _0x16ea=function(_0x3fa620,_0x150e24){_0x3fa620=_0x3fa620-0x0;var _0x393e58=_0x6ea1[_0x3fa620];return _0x393e58;};'use strict';var _=require(_0x16ea('0x0'));var util=require(_0x16ea('0x1'));var logger=require(_0x16ea('0x2'))(_0x16ea('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x16ea('0x4'));var fs=require('fs');var path=require(_0x16ea('0x5'));var rimraf=require(_0x16ea('0x6'));var config=require(_0x16ea('0x7'));var attributes=require(_0x16ea('0x8'));module[_0x16ea('0x9')]=function(_0x3ee485,_0x597a8b){return _0x3ee485['define'](_0x16ea('0xa'),attributes,{'tableName':_0x16ea('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index df35bd2..dd3a41e 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 _0xfa40=['result','catch','Trunk','options','where','attributes','limit','include','model','map','GetTrunk','ShowTrunk','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x2ed552,_0x5e4bf3){var _0x326a1b=function(_0x37aecc){while(--_0x37aecc){_0x2ed552['push'](_0x2ed552['shift']());}};_0x326a1b(++_0x5e4bf3);}(_0xfa40,0x91));var _0x0fa4=function(_0x4bc65f,_0x39ec43){_0x4bc65f=_0x4bc65f-0x0;var _0x44f85f=_0xfa40[_0x4bc65f];return _0x44f85f;};'use strict';var _=require(_0x0fa4('0x0'));var util=require(_0x0fa4('0x1'));var moment=require(_0x0fa4('0x2'));var BPromise=require(_0x0fa4('0x3'));var rs=require(_0x0fa4('0x4'));var fs=require('fs');var Redis=require(_0x0fa4('0x5'));var db=require(_0x0fa4('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0fa4('0x7'))('rpc');var config=require(_0x0fa4('0x8'));var jayson=require(_0x0fa4('0x9'));var client=jayson[_0x0fa4('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x21fc3f,_0x44e577,_0x15e6f0){return new BPromise(function(_0x28ab46,_0x2f28ee){return client['request'](_0x21fc3f,_0x15e6f0)[_0x0fa4('0xb')](function(_0x2dc679){logger[_0x0fa4('0xc')](_0x0fa4('0xd'),_0x44e577,'request\x20sent');logger[_0x0fa4('0xe')](_0x0fa4('0xf'),_0x44e577,_0x0fa4('0x10'),JSON[_0x0fa4('0x11')](_0x2dc679));if(_0x2dc679['error']){if(_0x2dc679[_0x0fa4('0x12')]['code']===0x1f4){logger[_0x0fa4('0x12')](_0x0fa4('0xd'),_0x44e577,_0x2dc679['error'][_0x0fa4('0x13')]);return _0x2f28ee(_0x2dc679[_0x0fa4('0x12')]['message']);}logger[_0x0fa4('0x12')]('Trunk,\x20%s,\x20%s',_0x44e577,_0x2dc679[_0x0fa4('0x12')]['message']);return _0x28ab46(_0x2dc679[_0x0fa4('0x12')]['message']);}else{logger['info'](_0x0fa4('0xd'),_0x44e577,_0x0fa4('0x10'));_0x28ab46(_0x2dc679[_0x0fa4('0x14')][_0x0fa4('0x13')]);}})[_0x0fa4('0x15')](function(_0x35c53f){logger[_0x0fa4('0x12')](_0x0fa4('0xd'),_0x44e577,_0x35c53f);_0x2f28ee(_0x35c53f);});});}exports['GetTrunk']=function(_0x473ea6){var _0x1612e2=this;return new Promise(function(_0x258489,_0x2e3357){return db[_0x0fa4('0x16')]['findAll']({'raw':_0x473ea6[_0x0fa4('0x17')]?_0x473ea6['options']['raw']===undefined?!![]:![]:!![],'where':_0x473ea6[_0x0fa4('0x17')]?_0x473ea6['options'][_0x0fa4('0x18')]||null:null,'attributes':_0x473ea6['options']?_0x473ea6[_0x0fa4('0x17')][_0x0fa4('0x19')]||null:null,'limit':_0x473ea6[_0x0fa4('0x17')]?_0x473ea6[_0x0fa4('0x17')][_0x0fa4('0x1a')]||null:null,'include':_0x473ea6['options']?_0x473ea6[_0x0fa4('0x17')][_0x0fa4('0x1b')]?_['map'](_0x473ea6['options'][_0x0fa4('0x1b')],function(_0x43c765){return{'model':db[_0x43c765[_0x0fa4('0x1c')]],'as':_0x43c765['as'],'attributes':_0x43c765[_0x0fa4('0x19')],'include':_0x43c765[_0x0fa4('0x1b')]?_[_0x0fa4('0x1d')](_0x43c765[_0x0fa4('0x1b')],function(_0x5e5704){return{'model':db[_0x5e5704[_0x0fa4('0x1c')]],'as':_0x5e5704['as'],'attributes':_0x5e5704[_0x0fa4('0x19')],'include':_0x5e5704[_0x0fa4('0x1b')]?_['map'](_0x5e5704['include'],function(_0x524a83){return{'model':db[_0x524a83[_0x0fa4('0x1c')]],'as':_0x524a83['as'],'attributes':_0x524a83[_0x0fa4('0x19')]};}):[]};}):[]};}):[]:[]})[_0x0fa4('0xb')](function(_0x41198c){logger['info'](_0x0fa4('0x1e'),_0x473ea6);logger['debug'](_0x0fa4('0x1e'),_0x473ea6,JSON['stringify'](_0x41198c));_0x258489(_0x41198c);})[_0x0fa4('0x15')](function(_0x255083){logger[_0x0fa4('0x12')](_0x0fa4('0x1e'),_0x255083[_0x0fa4('0x13')],_0x473ea6);_0x2e3357(_0x1612e2[_0x0fa4('0x12')](0x1f4,_0x255083['message']));});});};exports[_0x0fa4('0x1f')]=function(_0x43efaa){var _0xd56405=this;return new Promise(function(_0x33b93e,_0x32c11b){return db[_0x0fa4('0x16')][_0x0fa4('0x20')]({'raw':_0x43efaa[_0x0fa4('0x17')]?_0x43efaa[_0x0fa4('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x43efaa[_0x0fa4('0x17')]?_0x43efaa[_0x0fa4('0x17')][_0x0fa4('0x18')]||null:null,'attributes':_0x43efaa[_0x0fa4('0x17')]?_0x43efaa['options'][_0x0fa4('0x19')]||null:null,'include':_0x43efaa[_0x0fa4('0x17')]?_0x43efaa[_0x0fa4('0x17')][_0x0fa4('0x1b')]?_[_0x0fa4('0x1d')](_0x43efaa[_0x0fa4('0x17')]['include'],function(_0x18c1ee){return{'model':db[_0x18c1ee[_0x0fa4('0x1c')]],'as':_0x18c1ee['as'],'attributes':_0x18c1ee[_0x0fa4('0x19')],'include':_0x18c1ee[_0x0fa4('0x1b')]?_[_0x0fa4('0x1d')](_0x18c1ee[_0x0fa4('0x1b')],function(_0x3a6154){return{'model':db[_0x3a6154[_0x0fa4('0x1c')]],'as':_0x3a6154['as'],'attributes':_0x3a6154[_0x0fa4('0x19')],'include':_0x3a6154[_0x0fa4('0x1b')]?_[_0x0fa4('0x1d')](_0x3a6154[_0x0fa4('0x1b')],function(_0x54d935){return{'model':db[_0x54d935['model']],'as':_0x54d935['as'],'attributes':_0x54d935[_0x0fa4('0x19')]};}):[]};}):[]};}):[]:[]})[_0x0fa4('0xb')](function(_0x171fc){logger[_0x0fa4('0xc')](_0x0fa4('0x1f'),_0x43efaa);logger['debug']('ShowTrunk',_0x43efaa,JSON[_0x0fa4('0x11')](_0x171fc));_0x33b93e(_0x171fc);})[_0x0fa4('0x15')](function(_0x1a784c){logger[_0x0fa4('0x12')](_0x0fa4('0x1f'),_0x1a784c[_0x0fa4('0x13')],_0x43efaa);_0x32c11b(_0xd56405[_0x0fa4('0x12')](0x1f4,_0x1a784c[_0x0fa4('0x13')]));});});}; \ No newline at end of file +var _0x59a0=['raw','where','limit','include','map','model','attributes','ShowTrunk','Trunk','find','debug','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','stringify','error','code','message','Trunk,\x20%s,\x20%s','result','catch','GetTrunk','findAll','options'];(function(_0x21c424,_0x4083ab){var _0x9b6900=function(_0x48d3e2){while(--_0x48d3e2){_0x21c424['push'](_0x21c424['shift']());}};_0x9b6900(++_0x4083ab);}(_0x59a0,0xbf));var _0x059a=function(_0x5bbc59,_0x77aa05){_0x5bbc59=_0x5bbc59-0x0;var _0x27a027=_0x59a0[_0x5bbc59];return _0x27a027;};'use strict';var _=require(_0x059a('0x0'));var util=require('util');var moment=require(_0x059a('0x1'));var BPromise=require(_0x059a('0x2'));var rs=require(_0x059a('0x3'));var fs=require('fs');var Redis=require(_0x059a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x059a('0x5'));var logger=require(_0x059a('0x6'))(_0x059a('0x7'));var config=require(_0x059a('0x8'));var jayson=require(_0x059a('0x9'));var client=jayson[_0x059a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1966c2,_0x36104a,_0x17536a){return new BPromise(function(_0x1f9af7,_0x6edeba){return client[_0x059a('0xb')](_0x1966c2,_0x17536a)[_0x059a('0xc')](function(_0x494899){logger[_0x059a('0xd')]('Trunk,\x20%s,\x20%s',_0x36104a,'request\x20sent');logger['debug']('Trunk,\x20%s,\x20%s,\x20%s',_0x36104a,_0x059a('0xe'),JSON[_0x059a('0xf')](_0x494899));if(_0x494899[_0x059a('0x10')]){if(_0x494899[_0x059a('0x10')][_0x059a('0x11')]===0x1f4){logger[_0x059a('0x10')]('Trunk,\x20%s,\x20%s',_0x36104a,_0x494899['error'][_0x059a('0x12')]);return _0x6edeba(_0x494899['error']['message']);}logger[_0x059a('0x10')](_0x059a('0x13'),_0x36104a,_0x494899[_0x059a('0x10')][_0x059a('0x12')]);return _0x1f9af7(_0x494899[_0x059a('0x10')][_0x059a('0x12')]);}else{logger[_0x059a('0xd')](_0x059a('0x13'),_0x36104a,_0x059a('0xe'));_0x1f9af7(_0x494899[_0x059a('0x14')][_0x059a('0x12')]);}})[_0x059a('0x15')](function(_0x482135){logger[_0x059a('0x10')](_0x059a('0x13'),_0x36104a,_0x482135);_0x6edeba(_0x482135);});});}exports[_0x059a('0x16')]=function(_0xab3023){var _0x11f0bb=this;return new Promise(function(_0x3cdcc7,_0x49634d){return db['Trunk'][_0x059a('0x17')]({'raw':_0xab3023['options']?_0xab3023[_0x059a('0x18')][_0x059a('0x19')]===undefined?!![]:![]:!![],'where':_0xab3023[_0x059a('0x18')]?_0xab3023['options'][_0x059a('0x1a')]||null:null,'attributes':_0xab3023['options']?_0xab3023[_0x059a('0x18')]['attributes']||null:null,'limit':_0xab3023[_0x059a('0x18')]?_0xab3023['options'][_0x059a('0x1b')]||null:null,'include':_0xab3023[_0x059a('0x18')]?_0xab3023['options'][_0x059a('0x1c')]?_[_0x059a('0x1d')](_0xab3023['options'][_0x059a('0x1c')],function(_0x4f23a3){return{'model':db[_0x4f23a3[_0x059a('0x1e')]],'as':_0x4f23a3['as'],'attributes':_0x4f23a3[_0x059a('0x1f')],'include':_0x4f23a3['include']?_[_0x059a('0x1d')](_0x4f23a3[_0x059a('0x1c')],function(_0xea7ac4){return{'model':db[_0xea7ac4['model']],'as':_0xea7ac4['as'],'attributes':_0xea7ac4[_0x059a('0x1f')],'include':_0xea7ac4['include']?_['map'](_0xea7ac4[_0x059a('0x1c')],function(_0x3711f4){return{'model':db[_0x3711f4[_0x059a('0x1e')]],'as':_0x3711f4['as'],'attributes':_0x3711f4[_0x059a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x059a('0xc')](function(_0x34455f){logger[_0x059a('0xd')](_0x059a('0x16'),_0xab3023);logger['debug'](_0x059a('0x16'),_0xab3023,JSON[_0x059a('0xf')](_0x34455f));_0x3cdcc7(_0x34455f);})[_0x059a('0x15')](function(_0x1d179b){logger[_0x059a('0x10')]('GetTrunk',_0x1d179b[_0x059a('0x12')],_0xab3023);_0x49634d(_0x11f0bb[_0x059a('0x10')](0x1f4,_0x1d179b[_0x059a('0x12')]));});});};exports[_0x059a('0x20')]=function(_0x3cadfd){var _0x33b612=this;return new Promise(function(_0x5b50d7,_0x59db67){return db[_0x059a('0x21')][_0x059a('0x22')]({'raw':_0x3cadfd[_0x059a('0x18')]?_0x3cadfd[_0x059a('0x18')][_0x059a('0x19')]===undefined?!![]:![]:!![],'where':_0x3cadfd[_0x059a('0x18')]?_0x3cadfd['options'][_0x059a('0x1a')]||null:null,'attributes':_0x3cadfd[_0x059a('0x18')]?_0x3cadfd[_0x059a('0x18')][_0x059a('0x1f')]||null:null,'include':_0x3cadfd[_0x059a('0x18')]?_0x3cadfd[_0x059a('0x18')][_0x059a('0x1c')]?_['map'](_0x3cadfd[_0x059a('0x18')][_0x059a('0x1c')],function(_0x122b4a){return{'model':db[_0x122b4a[_0x059a('0x1e')]],'as':_0x122b4a['as'],'attributes':_0x122b4a[_0x059a('0x1f')],'include':_0x122b4a[_0x059a('0x1c')]?_[_0x059a('0x1d')](_0x122b4a[_0x059a('0x1c')],function(_0x2162ca){return{'model':db[_0x2162ca[_0x059a('0x1e')]],'as':_0x2162ca['as'],'attributes':_0x2162ca[_0x059a('0x1f')],'include':_0x2162ca[_0x059a('0x1c')]?_[_0x059a('0x1d')](_0x2162ca[_0x059a('0x1c')],function(_0x362d88){return{'model':db[_0x362d88[_0x059a('0x1e')]],'as':_0x362d88['as'],'attributes':_0x362d88[_0x059a('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x555c03){logger[_0x059a('0xd')](_0x059a('0x20'),_0x3cadfd);logger[_0x059a('0x23')](_0x059a('0x20'),_0x3cadfd,JSON[_0x059a('0xf')](_0x555c03));_0x5b50d7(_0x555c03);})[_0x059a('0x15')](function(_0x3f67d8){logger[_0x059a('0x10')](_0x059a('0x20'),_0x3f67d8['message'],_0x3cadfd);_0x59db67(_0x33b612[_0x059a('0x10')](0x1f4,_0x3f67d8[_0x059a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 656c803..7e38204 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 _0x02d7=['/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','/:id/openchannel_accounts','addOpenchannelAccounts','/:id/sms_accounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','createApiKey','put','changePassword','delete','/:id','destroy','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','/:id/fax_accounts','removeMailAccounts','removeOpenchannelAccounts','/:id/chat_websites','removeChatWebsites','/:id/whatsapp_accounts','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','/describe','/whoami','/presence','getPresence','show','/:id/avatar','getAvatar','getOpenTabs','getContacts','/:id/queues','getQueues','/:id/queues_rt','/:id/groups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','getFaxAccounts','/:id/mail_accounts','getMailAccounts','getOpenchannelAccounts','getSmsAccounts','getChatWebsites','/:id/square_projects','getScheduledCalls','/:id/api_key','getApiKey','post','/:id/contacts','/create_many','bulkCreate','addQueues','diskStorage','root','server/files/images/','format','%s-%s','now','originalname','single','file','addAvatar','/:id/login','/:id/logout','/:id/pause','pause'];(function(_0x2cd3d8,_0x5ddfb0){var _0x1ee6e1=function(_0x39b230){while(--_0x39b230){_0x2cd3d8['push'](_0x2cd3d8['shift']());}};_0x1ee6e1(++_0x5ddfb0);}(_0x02d7,0x114));var _0x702d=function(_0x5a5666,_0x3ac26e){_0x5a5666=_0x5a5666-0x0;var _0x5a7ec1=_0x02d7[_0x5a5666];return _0x5a7ec1;};'use strict';var multer=require(_0x702d('0x0'));var util=require(_0x702d('0x1'));var path=require(_0x702d('0x2'));var timeout=require(_0x702d('0x3'));var express=require('express');var router=express[_0x702d('0x4')]();var fs_extra=require(_0x702d('0x5'));var auth=require(_0x702d('0x6'));var interaction=require(_0x702d('0x7'));var config=require(_0x702d('0x8'));var controller=require(_0x702d('0x9'));router[_0x702d('0xa')]('/',auth[_0x702d('0xb')](),controller['index']);router['get'](_0x702d('0xc'),auth[_0x702d('0xb')](),controller['describe']);router[_0x702d('0xa')](_0x702d('0xd'),auth[_0x702d('0xb')](),controller['whoami']);router[_0x702d('0xa')](_0x702d('0xe'),auth[_0x702d('0xb')](),controller[_0x702d('0xf')]);router[_0x702d('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x702d('0x10')]);router[_0x702d('0xa')](_0x702d('0x11'),controller[_0x702d('0x12')]);router['get']('/:id/open_tabs',auth['isAuthenticated'](),controller[_0x702d('0x13')]);router['get']('/:id/contacts',auth[_0x702d('0xb')](),controller[_0x702d('0x14')]);router[_0x702d('0xa')](_0x702d('0x15'),auth[_0x702d('0xb')](),controller[_0x702d('0x16')]);router[_0x702d('0xa')](_0x702d('0x17'),auth[_0x702d('0xb')](),controller['getVoiceQueuesRt']);router[_0x702d('0xa')](_0x702d('0x18'),auth[_0x702d('0xb')](),controller['getGroups']);router[_0x702d('0xa')](_0x702d('0x19'),auth[_0x702d('0xb')](),controller[_0x702d('0x1a')]);router[_0x702d('0xa')](_0x702d('0x1b'),auth[_0x702d('0xb')](),controller[_0x702d('0x1c')]);router[_0x702d('0xa')](_0x702d('0x1d'),auth[_0x702d('0xb')](),controller[_0x702d('0x1e')]);router[_0x702d('0xa')](_0x702d('0x1f'),auth[_0x702d('0xb')](),controller[_0x702d('0x20')]);router[_0x702d('0xa')]('/:id/mail/interactions',auth[_0x702d('0xb')](),controller[_0x702d('0x21')]);router[_0x702d('0xa')](_0x702d('0x22'),auth[_0x702d('0xb')](),controller[_0x702d('0x23')]);router[_0x702d('0xa')](_0x702d('0x24'),auth[_0x702d('0xb')](),controller['getFaxInteractions']);router[_0x702d('0xa')](_0x702d('0x25'),auth[_0x702d('0xb')](),controller[_0x702d('0x26')]);router[_0x702d('0xa')](_0x702d('0x27'),auth['isAuthenticated'](),controller[_0x702d('0x28')]);router[_0x702d('0xa')](_0x702d('0x29'),auth[_0x702d('0xb')](),controller['getLists']);router['get'](_0x702d('0x2a'),auth['isAuthenticated'](),controller[_0x702d('0x2b')]);router[_0x702d('0xa')](_0x702d('0x2c'),auth['isAuthenticated'](),controller[_0x702d('0x2d')]);router[_0x702d('0xa')]('/:id/fax_accounts',auth[_0x702d('0xb')](),controller[_0x702d('0x2e')]);router[_0x702d('0xa')](_0x702d('0x2f'),auth[_0x702d('0xb')](),controller[_0x702d('0x30')]);router[_0x702d('0xa')]('/:id/openchannel_accounts',auth[_0x702d('0xb')](),controller[_0x702d('0x31')]);router[_0x702d('0xa')]('/:id/sms_accounts',auth[_0x702d('0xb')](),controller[_0x702d('0x32')]);router[_0x702d('0xa')]('/:id/chat_websites',auth['isAuthenticated'](),controller[_0x702d('0x33')]);router[_0x702d('0xa')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller['getWhatsappAccounts']);router['get'](_0x702d('0x34'),auth[_0x702d('0xb')](),controller['getSquareProjects']);router[_0x702d('0xa')]('/:id/scheduled_calls',auth[_0x702d('0xb')](),controller[_0x702d('0x35')]);router[_0x702d('0xa')](_0x702d('0x36'),auth[_0x702d('0xb')](),controller[_0x702d('0x37')]);router[_0x702d('0x38')](_0x702d('0x39'),auth[_0x702d('0xb')](),controller['addContacts']);router[_0x702d('0x38')]('/',auth[_0x702d('0xb')](),controller['create']);router['post'](_0x702d('0x3a'),auth['isAuthenticated'](),controller[_0x702d('0x3b')]);router['post'](_0x702d('0x15'),auth['isAuthenticated'](),controller[_0x702d('0x3c')]);var upload=multer({'storage':multer[_0x702d('0x3d')]({'destination':function(_0x5533e2,_0x52ca28,_0x530996){_0x530996(null,path['join'](config[_0x702d('0x3e')],_0x702d('0x3f')));},'filename':function(_0x4e8457,_0x2278df,_0x9d506b){_0x9d506b(null,util[_0x702d('0x40')](_0x702d('0x41'),Date[_0x702d('0x42')](),_0x2278df[_0x702d('0x43')]));}})});router[_0x702d('0x38')](_0x702d('0x11'),upload[_0x702d('0x44')](_0x702d('0x45')),controller[_0x702d('0x46')]);router[_0x702d('0x38')](_0x702d('0x47'),auth[_0x702d('0xb')](),controller['login']);router[_0x702d('0x38')](_0x702d('0x48'),auth[_0x702d('0xb')](),controller['logout']);router[_0x702d('0x38')](_0x702d('0x49'),auth[_0x702d('0xb')](),controller[_0x702d('0x4a')]);router[_0x702d('0x38')](_0x702d('0x4b'),auth[_0x702d('0xb')](),controller[_0x702d('0x4c')]);router[_0x702d('0x38')](_0x702d('0x27'),auth[_0x702d('0xb')](),controller[_0x702d('0x4d')]);router['post'](_0x702d('0x4e'),auth[_0x702d('0xb')](),controller[_0x702d('0x4f')]);router['post'](_0x702d('0x50'),auth['isAuthenticated'](),controller['addMailInteractions']);router[_0x702d('0x38')](_0x702d('0x51'),auth['isAuthenticated'](),controller[_0x702d('0x52')]);router[_0x702d('0x38')]('/:id/sms_interactions',auth[_0x702d('0xb')](),controller[_0x702d('0x53')]);router[_0x702d('0x38')](_0x702d('0x54'),auth[_0x702d('0xb')](),controller[_0x702d('0x55')]);router['post']('/:id/whatsapp_interactions',auth[_0x702d('0xb')](),controller[_0x702d('0x56')]);router[_0x702d('0x38')]('/:id/fax_accounts',auth[_0x702d('0xb')](),controller[_0x702d('0x57')]);router[_0x702d('0x38')](_0x702d('0x2f'),auth[_0x702d('0xb')](),controller[_0x702d('0x58')]);router[_0x702d('0x38')](_0x702d('0x59'),auth['isAuthenticated'](),controller[_0x702d('0x5a')]);router[_0x702d('0x38')](_0x702d('0x5b'),auth[_0x702d('0xb')](),controller[_0x702d('0x5c')]);router[_0x702d('0x38')]('/:id/chat_websites',auth[_0x702d('0xb')](),controller[_0x702d('0x5d')]);router[_0x702d('0x38')]('/:id/whatsapp_accounts',auth[_0x702d('0xb')](),controller[_0x702d('0x5e')]);router[_0x702d('0x38')](_0x702d('0x34'),auth[_0x702d('0xb')](),controller[_0x702d('0x5f')]);router[_0x702d('0x38')](_0x702d('0x36'),auth['isAuthenticated'](),controller[_0x702d('0x60')]);router[_0x702d('0x61')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x702d('0x61')]('/:id/password',auth[_0x702d('0xb')](),controller[_0x702d('0x62')]);router[_0x702d('0x63')](_0x702d('0x15'),auth[_0x702d('0xb')](),controller['removeQueues']);router[_0x702d('0x63')](_0x702d('0x27'),auth[_0x702d('0xb')](),controller['removeTeams']);router[_0x702d('0x63')](_0x702d('0x64'),auth[_0x702d('0xb')](),controller[_0x702d('0x65')]);router['delete'](_0x702d('0x4e'),auth[_0x702d('0xb')](),controller['removeChatInteractions']);router[_0x702d('0x63')]('/:id/mail_interactions',auth[_0x702d('0xb')](),controller['removeMailInteractions']);router[_0x702d('0x63')]('/:id/fax_interactions',auth[_0x702d('0xb')](),controller[_0x702d('0x66')]);router['delete']('/:id/sms_interactions',auth[_0x702d('0xb')](),controller[_0x702d('0x67')]);router[_0x702d('0x63')](_0x702d('0x54'),auth['isAuthenticated'](),controller[_0x702d('0x68')]);router[_0x702d('0x63')](_0x702d('0x69'),auth['isAuthenticated'](),controller[_0x702d('0x6a')]);router['delete'](_0x702d('0x6b'),auth[_0x702d('0xb')](),controller['removeFaxAccounts']);router[_0x702d('0x63')](_0x702d('0x2f'),auth[_0x702d('0xb')](),controller[_0x702d('0x6c')]);router[_0x702d('0x63')](_0x702d('0x59'),auth['isAuthenticated'](),controller[_0x702d('0x6d')]);router['delete']('/:id/sms_accounts',auth[_0x702d('0xb')](),controller['removeSmsAccounts']);router[_0x702d('0x63')](_0x702d('0x6e'),auth['isAuthenticated'](),controller[_0x702d('0x6f')]);router[_0x702d('0x63')](_0x702d('0x70'),auth[_0x702d('0xb')](),controller[_0x702d('0x71')]);router[_0x702d('0x63')](_0x702d('0x34'),auth[_0x702d('0xb')](),controller[_0x702d('0x72')]);router['delete'](_0x702d('0x36'),auth['isAuthenticated'](),controller[_0x702d('0x73')]);module[_0x702d('0x74')]=router; \ No newline at end of file +var _0x58c1=['addWhatsappInteractions','addMailAccounts','addOpenchannelAccounts','/:id/sms_accounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','/:id/api_key','createApiKey','put','/:id','update','delete','removeQueues','destroy','/:id/chat_interactions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./user.controller','isAuthenticated','index','get','/describe','describe','/whoami','whoami','getPresence','show','/:id/avatar','getAvatar','/:id/open_tabs','/:id/queues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','getRecordings','/:id/screen_recordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','/:id/scheduled_calls','getScheduledCalls','getApiKey','post','/:id/contacts','addContacts','/create_many','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','now','originalname','single','file','addAvatar','/:id/login','login','logout','/:id/pause','/:id/unpause','unpause','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions'];(function(_0x1d317e,_0x3ed004){var _0x1f9dda=function(_0x1f79f8){while(--_0x1f79f8){_0x1d317e['push'](_0x1d317e['shift']());}};_0x1f9dda(++_0x3ed004);}(_0x58c1,0x102));var _0x158c=function(_0x2d5632,_0x4c3187){_0x2d5632=_0x2d5632-0x0;var _0x21ad99=_0x58c1[_0x2d5632];return _0x21ad99;};'use strict';var multer=require(_0x158c('0x0'));var util=require(_0x158c('0x1'));var path=require(_0x158c('0x2'));var timeout=require(_0x158c('0x3'));var express=require('express');var router=express[_0x158c('0x4')]();var fs_extra=require(_0x158c('0x5'));var auth=require(_0x158c('0x6'));var interaction=require(_0x158c('0x7'));var config=require('../../config/environment');var controller=require(_0x158c('0x8'));router['get']('/',auth[_0x158c('0x9')](),controller[_0x158c('0xa')]);router[_0x158c('0xb')](_0x158c('0xc'),auth[_0x158c('0x9')](),controller[_0x158c('0xd')]);router[_0x158c('0xb')](_0x158c('0xe'),auth[_0x158c('0x9')](),controller[_0x158c('0xf')]);router[_0x158c('0xb')]('/presence',auth[_0x158c('0x9')](),controller[_0x158c('0x10')]);router[_0x158c('0xb')]('/:id',auth[_0x158c('0x9')](),controller[_0x158c('0x11')]);router[_0x158c('0xb')](_0x158c('0x12'),controller[_0x158c('0x13')]);router['get'](_0x158c('0x14'),auth[_0x158c('0x9')](),controller['getOpenTabs']);router[_0x158c('0xb')]('/:id/contacts',auth[_0x158c('0x9')](),controller['getContacts']);router[_0x158c('0xb')](_0x158c('0x15'),auth[_0x158c('0x9')](),controller['getQueues']);router[_0x158c('0xb')](_0x158c('0x16'),auth[_0x158c('0x9')](),controller[_0x158c('0x17')]);router['get'](_0x158c('0x18'),auth[_0x158c('0x9')](),controller[_0x158c('0x19')]);router[_0x158c('0xb')]('/:id/recordings',auth['isAuthenticated'](),controller[_0x158c('0x1a')]);router[_0x158c('0xb')](_0x158c('0x1b'),auth[_0x158c('0x9')](),controller['getScreenRecordings']);router['get'](_0x158c('0x1c'),auth[_0x158c('0x9')](),controller[_0x158c('0x1d')]);router[_0x158c('0xb')](_0x158c('0x1e'),auth[_0x158c('0x9')](),controller[_0x158c('0x1f')]);router[_0x158c('0xb')]('/:id/mail/interactions',auth[_0x158c('0x9')](),controller['getMailInteractions']);router[_0x158c('0xb')]('/:id/sms/interactions',auth[_0x158c('0x9')](),controller['getSmsInteractions']);router[_0x158c('0xb')](_0x158c('0x20'),auth['isAuthenticated'](),controller[_0x158c('0x21')]);router[_0x158c('0xb')](_0x158c('0x22'),auth['isAuthenticated'](),controller[_0x158c('0x23')]);router[_0x158c('0xb')](_0x158c('0x24'),auth[_0x158c('0x9')](),controller[_0x158c('0x25')]);router[_0x158c('0xb')](_0x158c('0x26'),auth[_0x158c('0x9')](),controller[_0x158c('0x27')]);router[_0x158c('0xb')](_0x158c('0x28'),auth['isAuthenticated'](),controller[_0x158c('0x29')]);router[_0x158c('0xb')](_0x158c('0x2a'),auth[_0x158c('0x9')](),controller['getVoicePrefixes']);router[_0x158c('0xb')](_0x158c('0x2b'),auth['isAuthenticated'](),controller[_0x158c('0x2c')]);router[_0x158c('0xb')](_0x158c('0x2d'),auth['isAuthenticated'](),controller[_0x158c('0x2e')]);router[_0x158c('0xb')](_0x158c('0x2f'),auth[_0x158c('0x9')](),controller['getOpenchannelAccounts']);router[_0x158c('0xb')]('/:id/sms_accounts',auth[_0x158c('0x9')](),controller['getSmsAccounts']);router[_0x158c('0xb')](_0x158c('0x30'),auth[_0x158c('0x9')](),controller[_0x158c('0x31')]);router['get'](_0x158c('0x32'),auth['isAuthenticated'](),controller[_0x158c('0x33')]);router[_0x158c('0xb')](_0x158c('0x34'),auth[_0x158c('0x9')](),controller['getSquareProjects']);router['get'](_0x158c('0x35'),auth['isAuthenticated'](),controller[_0x158c('0x36')]);router[_0x158c('0xb')]('/:id/api_key',auth[_0x158c('0x9')](),controller[_0x158c('0x37')]);router[_0x158c('0x38')](_0x158c('0x39'),auth[_0x158c('0x9')](),controller[_0x158c('0x3a')]);router[_0x158c('0x38')]('/',auth[_0x158c('0x9')](),controller['create']);router[_0x158c('0x38')](_0x158c('0x3b'),auth[_0x158c('0x9')](),controller[_0x158c('0x3c')]);router['post']('/:id/queues',auth[_0x158c('0x9')](),controller[_0x158c('0x3d')]);var upload=multer({'storage':multer[_0x158c('0x3e')]({'destination':function(_0x1a5b31,_0xed0890,_0x5d36fa){_0x5d36fa(null,path[_0x158c('0x3f')](config[_0x158c('0x40')],_0x158c('0x41')));},'filename':function(_0x56797e,_0x8bdb80,_0x5a7ee3){_0x5a7ee3(null,util[_0x158c('0x42')]('%s-%s',Date[_0x158c('0x43')](),_0x8bdb80[_0x158c('0x44')]));}})});router[_0x158c('0x38')](_0x158c('0x12'),upload[_0x158c('0x45')](_0x158c('0x46')),controller[_0x158c('0x47')]);router[_0x158c('0x38')](_0x158c('0x48'),auth[_0x158c('0x9')](),controller[_0x158c('0x49')]);router[_0x158c('0x38')]('/:id/logout',auth[_0x158c('0x9')](),controller[_0x158c('0x4a')]);router[_0x158c('0x38')](_0x158c('0x4b'),auth[_0x158c('0x9')](),controller['pause']);router['post'](_0x158c('0x4c'),auth['isAuthenticated'](),controller[_0x158c('0x4d')]);router[_0x158c('0x38')](_0x158c('0x24'),auth['isAuthenticated'](),controller['addTeams']);router[_0x158c('0x38')]('/:id/chat_interactions',auth[_0x158c('0x9')](),controller['addChatInteractions']);router[_0x158c('0x38')](_0x158c('0x4e'),auth['isAuthenticated'](),controller[_0x158c('0x4f')]);router[_0x158c('0x38')](_0x158c('0x50'),auth[_0x158c('0x9')](),controller[_0x158c('0x51')]);router[_0x158c('0x38')](_0x158c('0x52'),auth['isAuthenticated'](),controller[_0x158c('0x53')]);router[_0x158c('0x38')](_0x158c('0x54'),auth[_0x158c('0x9')](),controller[_0x158c('0x55')]);router[_0x158c('0x38')](_0x158c('0x56'),auth[_0x158c('0x9')](),controller[_0x158c('0x57')]);router['post'](_0x158c('0x2b'),auth[_0x158c('0x9')](),controller['addFaxAccounts']);router[_0x158c('0x38')](_0x158c('0x2d'),auth[_0x158c('0x9')](),controller[_0x158c('0x58')]);router[_0x158c('0x38')](_0x158c('0x2f'),auth[_0x158c('0x9')](),controller[_0x158c('0x59')]);router[_0x158c('0x38')](_0x158c('0x5a'),auth[_0x158c('0x9')](),controller['addSmsAccounts']);router[_0x158c('0x38')](_0x158c('0x30'),auth[_0x158c('0x9')](),controller[_0x158c('0x5b')]);router[_0x158c('0x38')]('/:id/whatsapp_accounts',auth[_0x158c('0x9')](),controller[_0x158c('0x5c')]);router[_0x158c('0x38')]('/:id/square_projects',auth[_0x158c('0x9')](),controller[_0x158c('0x5d')]);router[_0x158c('0x38')](_0x158c('0x5e'),auth['isAuthenticated'](),controller[_0x158c('0x5f')]);router[_0x158c('0x60')](_0x158c('0x61'),auth[_0x158c('0x9')](),controller[_0x158c('0x62')]);router[_0x158c('0x60')]('/:id/password',auth[_0x158c('0x9')](),controller['changePassword']);router[_0x158c('0x63')]('/:id/queues',auth[_0x158c('0x9')](),controller[_0x158c('0x64')]);router[_0x158c('0x63')]('/:id/teams',auth[_0x158c('0x9')](),controller['removeTeams']);router[_0x158c('0x63')](_0x158c('0x61'),auth[_0x158c('0x9')](),controller[_0x158c('0x65')]);router['delete'](_0x158c('0x66'),auth['isAuthenticated'](),controller['removeChatInteractions']);router[_0x158c('0x63')](_0x158c('0x4e'),auth[_0x158c('0x9')](),controller[_0x158c('0x67')]);router[_0x158c('0x63')](_0x158c('0x50'),auth['isAuthenticated'](),controller[_0x158c('0x68')]);router[_0x158c('0x63')](_0x158c('0x52'),auth[_0x158c('0x9')](),controller[_0x158c('0x69')]);router['delete']('/:id/openchannel_interactions',auth['isAuthenticated'](),controller[_0x158c('0x6a')]);router[_0x158c('0x63')](_0x158c('0x56'),auth[_0x158c('0x9')](),controller['removeWhatsappInteractions']);router[_0x158c('0x63')](_0x158c('0x2b'),auth[_0x158c('0x9')](),controller[_0x158c('0x6b')]);router['delete'](_0x158c('0x2d'),auth['isAuthenticated'](),controller[_0x158c('0x6c')]);router['delete'](_0x158c('0x2f'),auth[_0x158c('0x9')](),controller[_0x158c('0x6d')]);router['delete']('/:id/sms_accounts',auth[_0x158c('0x9')](),controller['removeSmsAccounts']);router['delete'](_0x158c('0x30'),auth[_0x158c('0x9')](),controller[_0x158c('0x6e')]);router[_0x158c('0x63')](_0x158c('0x32'),auth['isAuthenticated'](),controller[_0x158c('0x6f')]);router['delete']('/:id/square_projects',auth[_0x158c('0x9')](),controller[_0x158c('0x70')]);router[_0x158c('0x63')]('/:id/api_key',auth['isAuthenticated'](),controller[_0x158c('0x71')]);module[_0x158c('0x72')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 2f240c7..fe96aa2 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 _0xea31=['permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','blockedAt','UNSIGNED','sequelize','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','email','toLowerCase','admin','agent','telephone','local','INTEGER','internal','accountcode','BOOLEAN','DATE','DEFAULT\x20PAUSE','ENUM','friend','user','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','certificate','active','passive','actpass','update,nonat','TEXT','showWebBar','get','isArray','udp','force_avp','icesupport','dtlsenable','dtlsverify','dtlscertfile','dtlsprivatekey','wss','encryption','avpf','dtlssetup','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key'];(function(_0x499d15,_0x5376c1){var _0x189291=function(_0x52884f){while(--_0x52884f){_0x499d15['push'](_0x499d15['shift']());}};_0x189291(++_0x5376c1);}(_0xea31,0x6b));var _0x1ea3=function(_0x3951f5,_0x1c091e){_0x3951f5=_0x3951f5-0x0;var _0x127b2e=_0xea31[_0x3951f5];return _0x127b2e;};'use strict';var Sequelize=require(_0x1ea3('0x0'));var moment=require('moment');var util=require(_0x1ea3('0x1'));var _=require(_0x1ea3('0x2'));module[_0x1ea3('0x3')]={'name':{'type':Sequelize[_0x1ea3('0x4')],'allowNull':![],'unique':_0x1ea3('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x194853){this[_0x1ea3('0x6')]('name',_0x194853);this[_0x1ea3('0x6')](_0x1ea3('0x7'),_0x194853);},'comment':_0x1ea3('0x8')},'fullname':{'type':Sequelize[_0x1ea3('0x4')],'allowNull':![],'set':function(_0x13e6fb){this['setDataValue'](_0x1ea3('0x9'),_0x13e6fb);this[_0x1ea3('0x6')](_0x1ea3('0xa'),util[_0x1ea3('0xb')](_0x1ea3('0xc'),_0x13e6fb,this[_0x1ea3('0xd')]('internal')));}},'alias':{'type':Sequelize[_0x1ea3('0x4')]},'email':{'type':Sequelize[_0x1ea3('0x4')],'allowNull':![],'unique':_0x1ea3('0xe'),'validate':{'isEmail':!![]},'set':function(_0x12dc3f){if(_0x12dc3f){this[_0x1ea3('0x6')](_0x1ea3('0xe'),_0x12dc3f[_0x1ea3('0xf')]());}}},'role':{'type':Sequelize['ENUM'](_0x1ea3('0x10'),'user',_0x1ea3('0x11'),_0x1ea3('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0x1ea3('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x1ea3('0x13')},'internal':{'type':Sequelize[_0x1ea3('0x14')](0xb),'allowNull':![],'unique':_0x1ea3('0x15'),'set':function(_0x4b0af9){this[_0x1ea3('0x6')](_0x1ea3('0x15'),_0x4b0af9);this[_0x1ea3('0x6')](_0x1ea3('0x16'),_0x4b0af9);this[_0x1ea3('0x6')](_0x1ea3('0xa'),util[_0x1ea3('0xb')]('\x22%s\x22\x20<%s>',this[_0x1ea3('0xd')](_0x1ea3('0x9')),_0x4b0af9));}},'salt':{'type':Sequelize[_0x1ea3('0x4')]},'phone':{'type':Sequelize[_0x1ea3('0x4')]},'mobile':{'type':Sequelize[_0x1ea3('0x4')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0x1ea3('0x4')]},'userpic':{'type':Sequelize[_0x1ea3('0x4')]},'city':{'type':Sequelize[_0x1ea3('0x4')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0x1ea3('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x1ea3('0x18')]},'voicePause':{'type':Sequelize[_0x1ea3('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x1ea3('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x1ea3('0x17')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x1ea3('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x1ea3('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x1ea3('0x4')],'defaultValue':_0x1ea3('0x19')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0x1ea3('0x14')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x1ea3('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x1ea3('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x1ea3('0x14')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x1ea3('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x1ea3('0x14')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x1ea3('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x1ea3('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x1ea3('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x1ea3('0x17')],'defaultValue':![]},'description':{'type':Sequelize[_0x1ea3('0x4')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0x1ea3('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0x1ea3('0x14')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x1ea3('0x14')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x1ea3('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x1ea3('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x1ea3('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x1ea3('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x1ea3('0x1a')](_0x1ea3('0x1b'),_0x1ea3('0x1c'),_0x1ea3('0x1d')),'allowNull':!![],'defaultValue':_0x1ea3('0x1b')},'context':{'type':Sequelize[_0x1ea3('0x4')],'allowNull':!![],'defaultValue':_0x1ea3('0x1e')},'callingpres':{'type':Sequelize[_0x1ea3('0x1a')](_0x1ea3('0x1f'),'ALLOWED_PASSED_SCREEN',_0x1ea3('0x20'),_0x1ea3('0x21'),_0x1ea3('0x22'),_0x1ea3('0x23'),_0x1ea3('0x24'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x1ea3('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0x1ea3('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x1ea3('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x1ea3('0x4')],'allowNull':!![],'defaultValue':'udp','set':function(_0x4c16ef){this[_0x1ea3('0x6')](_0x1ea3('0x25'),_0x4c16ef?_0x4c16ef[_0x1ea3('0x26')](','):null);},'get':function(){return this[_0x1ea3('0xd')](_0x1ea3('0x25'))?this[_0x1ea3('0xd')](_0x1ea3('0x25'))[_0x1ea3('0x27')](','):null;},'comment':_0x1ea3('0x28')},'dtmfmode':{'type':Sequelize['ENUM'](_0x1ea3('0x29'),_0x1ea3('0x2a'),_0x1ea3('0x2b'),_0x1ea3('0x2c'),_0x1ea3('0x2d')),'allowNull':!![],'defaultValue':_0x1ea3('0x29')},'directmedia':{'type':Sequelize[_0x1ea3('0x1a')](_0x1ea3('0x2e'),'no',_0x1ea3('0x2f'),_0x1ea3('0x30'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x1ea3('0x1a')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x1ea3('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x1ea3('0x31'),'set':function(_0x570677){this['setDataValue']('nat',_0x570677?_0x570677[_0x1ea3('0x26')](','):null);},'get':function(){return this[_0x1ea3('0xd')](_0x1ea3('0x32'))?this[_0x1ea3('0xd')](_0x1ea3('0x32'))['split'](','):null;},'comment':_0x1ea3('0x33')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x1ea3('0x4')]},'pickupgroup':{'type':Sequelize[_0x1ea3('0x4')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x1ea3('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x1ea3('0x4')]},'disallow':{'type':Sequelize[_0x1ea3('0x4')],'allowNull':![],'defaultValue':_0x1ea3('0x34')},'allow':{'type':Sequelize[_0x1ea3('0x4')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x12da5a){this['setDataValue'](_0x1ea3('0x35'),_0x12da5a?_0x12da5a[_0x1ea3('0x26')](';'):_0x1ea3('0x36'));},'get':function(){return this[_0x1ea3('0xd')](_0x1ea3('0x35'))?this[_0x1ea3('0xd')](_0x1ea3('0x35'))[_0x1ea3('0x27')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x1ea3('0x1a')](_0x1ea3('0x2e'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x1ea3('0x4')],'allowNull':!![],'set':function(_0x4dc0e2){this[_0x1ea3('0x6')](_0x1ea3('0x37'),_0x4dc0e2?_0x4dc0e2['join'](','):null);},'get':function(){return this[_0x1ea3('0xd')](_0x1ea3('0x37'))?this['getDataValue'](_0x1ea3('0x37'))[_0x1ea3('0x27')](','):null;},'comment':_0x1ea3('0x38')},'trustrpid':{'type':Sequelize[_0x1ea3('0x1a')](_0x1ea3('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x1ea3('0x1a')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x1ea3('0x1a')](_0x1ea3('0x2e'),'no',_0x1ea3('0x39')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x1ea3('0x2e'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x1ea3('0x1a')](_0x1ea3('0x2e'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x1ea3('0x14')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x1ea3('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x1ea3('0x4')],'allowNull':!![],'defaultValue':_0x1ea3('0x3a')},'amaflags':{'type':Sequelize[_0x1ea3('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x1ea3('0x1a')](_0x1ea3('0x2e'),'no'),'allowNull':!![],'defaultValue':_0x1ea3('0x2e')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x1ea3('0x1a')](_0x1ea3('0x2e'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x1ea3('0x1a')](_0x1ea3('0x2e'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x1ea3('0x2e'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x1ea3('0x1a')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x1ea3('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0x1ea3('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x1ea3('0x1a')](_0x1ea3('0x2e'),'no',_0x1ea3('0x3b')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x1ea3('0x14')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x1ea3('0x1a')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x1ea3('0x3c'),_0x1ea3('0x3d'),_0x1ea3('0x3e')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x1ea3('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x1ea3('0x14')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x1ea3('0x3f'),'uas'),'allowNull':!![],'defaultValue':_0x1ea3('0x40')},'t38pt_usertpsource':{'type':Sequelize[_0x1ea3('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x1ea3('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x1ea3('0x1a')](_0x1ea3('0x2e'),'no'),'allowNull':!![],'defaultValue':_0x1ea3('0x2e')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x1ea3('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x1ea3('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x1ea3('0x14')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x1ea3('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x1ea3('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x1ea3('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x1ea3('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x1ea3('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x1ea3('0x14')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x1ea3('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x1ea3('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x1ea3('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x1ea3('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x1ea3('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x1ea3('0x14')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x1ea3('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x1ea3('0x2e'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x1ea3('0x1a')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x1ea3('0x1a')](_0x1ea3('0x2e'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x1ea3('0x1a')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM']('yes','no','fingerprint',_0x1ea3('0x41')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x1ea3('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x1ea3('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x1ea3('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x1ea3('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x1ea3('0x1a')](_0x1ea3('0x42'),_0x1ea3('0x43'),_0x1ea3('0x44')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x1ea3('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x1ea3('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x1ea3('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x1ea3('0x1a')](_0x1ea3('0x2e'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x1ea3('0x1a')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x1ea3('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x1ea3('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x1ea3('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x1ea3('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x1ea3('0x2e'),'no','nonat','update',_0x1ea3('0x45')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x1ea3('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x1ea3('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0x1ea3('0x18')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x1ea3('0x46')]},'showWebBar':{'type':Sequelize[_0x1ea3('0x14')],'defaultValue':0x0,'set':function(_0xa94d08){this['setDataValue'](_0x1ea3('0x47'),_0xa94d08);var _0x33946f=this[_0x1ea3('0x48')]({'plain':!![]});switch(_0xa94d08){case 0x0:case 0x1:var _0x4284b8=_0x33946f[_0x1ea3('0x25')]?_[_0x1ea3('0x49')](_0x33946f[_0x1ea3('0x25')])?_0x33946f[_0x1ea3('0x25')][_0x1ea3('0x26')]():_0x33946f['transport']:'udp';if(_0x4284b8==='wss'){_0x4284b8=_0x1ea3('0x4a');}this['setDataValue'](_0x1ea3('0x25'),_0x4284b8);this[_0x1ea3('0x6')]('encryption','no');this[_0x1ea3('0x6')]('avpf',null);this[_0x1ea3('0x6')](_0x1ea3('0x4b'),null);this[_0x1ea3('0x6')](_0x1ea3('0x4c'),null);this[_0x1ea3('0x6')](_0x1ea3('0x4d'),null);this[_0x1ea3('0x6')](_0x1ea3('0x4e'),null);this[_0x1ea3('0x6')]('dtlssetup',null);this[_0x1ea3('0x6')](_0x1ea3('0x4f'),null);this[_0x1ea3('0x6')](_0x1ea3('0x50'),null);this[_0x1ea3('0x6')]('rtcp_mux','no');break;case 0x2:this[_0x1ea3('0x6')](_0x1ea3('0x25'),_0x1ea3('0x51'));this[_0x1ea3('0x6')](_0x1ea3('0x52'),_0x1ea3('0x2e'));this[_0x1ea3('0x6')](_0x1ea3('0x53'),'yes');this[_0x1ea3('0x6')](_0x1ea3('0x4b'),'yes');this[_0x1ea3('0x6')]('icesupport','yes');this[_0x1ea3('0x6')](_0x1ea3('0x4d'),_0x1ea3('0x2e'));this['setDataValue'](_0x1ea3('0x4e'),'no');this['setDataValue'](_0x1ea3('0x54'),_0x1ea3('0x44'));this['setDataValue'](_0x1ea3('0x4f'),_0x33946f[_0x1ea3('0x4f')]||_0x1ea3('0x55'));this[_0x1ea3('0x6')](_0x1ea3('0x50'),_0x33946f[_0x1ea3('0x50')]||_0x1ea3('0x56'));this[_0x1ea3('0x6')]('rtcp_mux','yes');break;default:}}},'permissions':{'type':Sequelize[_0x1ea3('0x46')],'set':function(_0x22b180){this['setDataValue']('permissions',_0x22b180?_0x22b180[_0x1ea3('0x26')](','):[]);},'get':function(){return this[_0x1ea3('0xd')](_0x1ea3('0x57'))?_[_0x1ea3('0x58')](this[_0x1ea3('0xd')](_0x1ea3('0x57'))['split'](','),function(_0x318c6d){return parseInt(_0x318c6d,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x1ea3('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x1ea3('0x4')]},'phoneBarUnconditional':{'type':Sequelize[_0x1ea3('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x1ea3('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x1ea3('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x1ea3('0x14')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x1ea3('0x14')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x1ea3('0x1a')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x1ea3('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x1ea3('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x1ea3('0x59')],'get':function(){return this['getDataValue'](_0x1ea3('0x5a'))?this[_0x1ea3('0xd')](_0x1ea3('0x5a')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x1ea3('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x1ea3('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x1ea3('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x1ea3('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x1ea3('0x17')],'defaultValue':![],'set':function(_0x3443c5){if(typeof _0x3443c5==='string'){var _0x3e84af=_0x3443c5==='1'?!![]:_0x3443c5==='0'?![]:_0x3443c5===_0x1ea3('0x5b')?!![]:_0x3443c5===_0x1ea3('0x5c')?![]:![];this['setDataValue'](_0x1ea3('0x5d'),_0x3e84af);}else{this['setDataValue'](_0x1ea3('0x5d'),_0x3443c5);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x4ab1c){this[_0x1ea3('0x6')](_0x1ea3('0x5e'),_0x4ab1c);if(_0x4ab1c===!![]){this[_0x1ea3('0x6')]('blockedAt',moment());this['setDataValue']('loginAttempts',0x0);}else{this[_0x1ea3('0x6')](_0x1ea3('0x5f'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x1ea3('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x1ea3('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x1ea3('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x1ea3('0x14')](0x5)[_0x1ea3('0x60')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x1ea3('0x17')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x1ea3('0x17')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x1ea3('0x17')],'defaultValue':!![]}}; \ No newline at end of file +var _0x5b20=['ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','always','accept','refuse','originate','uac','uas','fingerprint','certificate','active','passive','actpass','update,nonat','TEXT','showWebBar','get','isArray','wss','udp','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlsprivatekey','rtcp_mux','encryption','dtlssetup','dtlscertfile','/etc/pki/tls/private/motion.key','permissions','map','phoneBarEnableScreenRecordingByAgent','string','true','screenrecording','blocked','loginAttempts','UNSIGNED','sequelize','moment','util','lodash','exports','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','user','agent','telephone','local','INTEGER','BOOLEAN','DATE','DEFAULT\x20PAUSE','peer','friend','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','transport','join','split','rfc2833','inband','auto','yes','nonat','update','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all'];(function(_0x57eb0f,_0x4a5cfc){var _0xc5518d=function(_0xe6d150){while(--_0xe6d150){_0x57eb0f['push'](_0x57eb0f['shift']());}};_0xc5518d(++_0x4a5cfc);}(_0x5b20,0x86));var _0x05b2=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5b20[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x05b2('0x0'));var moment=require(_0x05b2('0x1'));var util=require(_0x05b2('0x2'));var _=require(_0x05b2('0x3'));module[_0x05b2('0x4')]={'name':{'type':Sequelize[_0x05b2('0x5')],'allowNull':![],'unique':_0x05b2('0x6'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x7d6d53){this[_0x05b2('0x7')](_0x05b2('0x6'),_0x7d6d53);this[_0x05b2('0x7')]('defaultuser',_0x7d6d53);},'comment':_0x05b2('0x8')},'fullname':{'type':Sequelize[_0x05b2('0x5')],'allowNull':![],'set':function(_0x541855){this[_0x05b2('0x7')](_0x05b2('0x9'),_0x541855);this[_0x05b2('0x7')](_0x05b2('0xa'),util[_0x05b2('0xb')](_0x05b2('0xc'),_0x541855,this[_0x05b2('0xd')](_0x05b2('0xe'))));}},'alias':{'type':Sequelize[_0x05b2('0x5')]},'email':{'type':Sequelize[_0x05b2('0x5')],'allowNull':![],'unique':_0x05b2('0xf'),'validate':{'isEmail':!![]},'set':function(_0x2f2e4a){if(_0x2f2e4a){this[_0x05b2('0x7')](_0x05b2('0xf'),_0x2f2e4a[_0x05b2('0x10')]());}}},'role':{'type':Sequelize[_0x05b2('0x11')]('admin',_0x05b2('0x12'),_0x05b2('0x13'),_0x05b2('0x14')),'allowNull':![]},'password':{'type':Sequelize[_0x05b2('0x5')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x05b2('0x15')},'internal':{'type':Sequelize[_0x05b2('0x16')](0xb),'allowNull':![],'unique':_0x05b2('0xe'),'set':function(_0x5a12d4){this['setDataValue'](_0x05b2('0xe'),_0x5a12d4);this[_0x05b2('0x7')]('accountcode',_0x5a12d4);this['setDataValue'](_0x05b2('0xa'),util[_0x05b2('0xb')](_0x05b2('0xc'),this[_0x05b2('0xd')](_0x05b2('0x9')),_0x5a12d4));}},'salt':{'type':Sequelize[_0x05b2('0x5')]},'phone':{'type':Sequelize[_0x05b2('0x5')]},'mobile':{'type':Sequelize[_0x05b2('0x5')]},'address':{'type':Sequelize[_0x05b2('0x5')]},'zipcode':{'type':Sequelize[_0x05b2('0x5')]},'userpic':{'type':Sequelize[_0x05b2('0x5')]},'city':{'type':Sequelize[_0x05b2('0x5')]},'country':{'type':Sequelize[_0x05b2('0x5')]},'online':{'type':Sequelize[_0x05b2('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x05b2('0x18')]},'voicePause':{'type':Sequelize[_0x05b2('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x05b2('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x05b2('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x05b2('0x17')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x05b2('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x05b2('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x05b2('0x5')],'defaultValue':_0x05b2('0x19')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0x05b2('0x16')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x05b2('0x16')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x05b2('0x16')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x05b2('0x16')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x05b2('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x05b2('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x05b2('0x16')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x05b2('0x16')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x05b2('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x05b2('0x16')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x05b2('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0x05b2('0x16')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x05b2('0x16')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x05b2('0x16')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x05b2('0x11')]('friend',_0x05b2('0x12'),_0x05b2('0x1a')),'allowNull':!![],'defaultValue':_0x05b2('0x1b')},'context':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x05b2('0x11')]('ALLOWED_NOT_SCREENED',_0x05b2('0x1c'),_0x05b2('0x1d'),_0x05b2('0x1e'),_0x05b2('0x1f'),'PROHIB_PASSED_SCREEN',_0x05b2('0x20'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'udp','set':function(_0x1be4b3){this[_0x05b2('0x7')](_0x05b2('0x21'),_0x1be4b3?_0x1be4b3[_0x05b2('0x22')](','):null);},'get':function(){return this['getDataValue'](_0x05b2('0x21'))?this['getDataValue'](_0x05b2('0x21'))[_0x05b2('0x23')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x05b2('0x11')](_0x05b2('0x24'),'info','shortinfo',_0x05b2('0x25'),_0x05b2('0x26')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x05b2('0x11')](_0x05b2('0x27'),'no',_0x05b2('0x28'),_0x05b2('0x29'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x05b2('0x2a'),'set':function(_0x30b774){this[_0x05b2('0x7')](_0x05b2('0x2b'),_0x30b774?_0x30b774[_0x05b2('0x22')](','):null);},'get':function(){return this[_0x05b2('0xd')](_0x05b2('0x2b'))?this['getDataValue'](_0x05b2('0x2b'))[_0x05b2('0x23')](','):null;},'comment':_0x05b2('0x2c')},'callgroup':{'type':Sequelize[_0x05b2('0x5')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x05b2('0x5')]},'namedpickupgroup':{'type':Sequelize[_0x05b2('0x5')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0x05b2('0x5')],'allowNull':![],'defaultValue':_0x05b2('0x2d')},'allow':{'type':Sequelize[_0x05b2('0x5')],'allowNull':![],'defaultValue':_0x05b2('0x2e'),'set':function(_0xbf443){this[_0x05b2('0x7')](_0x05b2('0x2f'),_0xbf443?_0xbf443[_0x05b2('0x22')](';'):'ulaw;alaw;gsm');},'get':function(){return this['getDataValue'](_0x05b2('0x2f'))?this[_0x05b2('0xd')]('allow')[_0x05b2('0x23')](';'):null;},'comment':_0x05b2('0x30')},'autoframing':{'type':Sequelize[_0x05b2('0x11')](_0x05b2('0x27'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![],'set':function(_0x44476a){this[_0x05b2('0x7')]('insecure',_0x44476a?_0x44476a[_0x05b2('0x22')](','):null);},'get':function(){return this['getDataValue'](_0x05b2('0x31'))?this[_0x05b2('0xd')]('insecure')[_0x05b2('0x23')](','):null;},'comment':_0x05b2('0x32')},'trustrpid':{'type':Sequelize['ENUM'](_0x05b2('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x05b2('0x11')](_0x05b2('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x05b2('0x11')](_0x05b2('0x27'),'no',_0x05b2('0x33')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x05b2('0x11')](_0x05b2('0x27'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x05b2('0x16')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x05b2('0x11')]('yes','no'),'allowNull':!![],'defaultValue':_0x05b2('0x27')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x05b2('0x11')](_0x05b2('0x27'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x05b2('0x11')](_0x05b2('0x27'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x05b2('0x11')](_0x05b2('0x27'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x05b2('0x11')](_0x05b2('0x27'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x05b2('0x11')](_0x05b2('0x27'),'no',_0x05b2('0x34')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x05b2('0x16')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x05b2('0x11')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x05b2('0x11')](_0x05b2('0x35'),_0x05b2('0x36'),_0x05b2('0x37')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x05b2('0x16')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x05b2('0x16')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x05b2('0x38'),_0x05b2('0x39')),'allowNull':!![],'defaultValue':_0x05b2('0x39')},'t38pt_usertpsource':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0x05b2('0x11')](_0x05b2('0x27'),'no'),'allowNull':!![],'defaultValue':_0x05b2('0x27')},'keepalive':{'type':Sequelize[_0x05b2('0x16')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x05b2('0x16')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x05b2('0x16')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x05b2('0x16')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x05b2('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x05b2('0x16')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x05b2('0x16')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x05b2('0x16')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x05b2('0x16')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x05b2('0x11')](_0x05b2('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x05b2('0x11')](_0x05b2('0x27'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x05b2('0x11')](_0x05b2('0x27'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x05b2('0x27'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x05b2('0x11')](_0x05b2('0x27'),'no',_0x05b2('0x3a'),_0x05b2('0x3b')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x05b2('0x16')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x05b2('0x11')](_0x05b2('0x3c'),_0x05b2('0x3d'),_0x05b2('0x3e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x05b2('0x11')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x05b2('0x16')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x05b2('0x27'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x05b2('0x27'),'no',_0x05b2('0x28'),'update',_0x05b2('0x3f')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x05b2('0x5')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x05b2('0x18')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x05b2('0x40')]},'showWebBar':{'type':Sequelize[_0x05b2('0x16')],'defaultValue':0x0,'set':function(_0x1209c9){this['setDataValue'](_0x05b2('0x41'),_0x1209c9);var _0x1e035c=this[_0x05b2('0x42')]({'plain':!![]});switch(_0x1209c9){case 0x0:case 0x1:var _0x1b7a70=_0x1e035c[_0x05b2('0x21')]?_[_0x05b2('0x43')](_0x1e035c[_0x05b2('0x21')])?_0x1e035c['transport'][_0x05b2('0x22')]():_0x1e035c[_0x05b2('0x21')]:'udp';if(_0x1b7a70===_0x05b2('0x44')){_0x1b7a70=_0x05b2('0x45');}this[_0x05b2('0x7')](_0x05b2('0x21'),_0x1b7a70);this['setDataValue']('encryption','no');this[_0x05b2('0x7')](_0x05b2('0x46'),null);this[_0x05b2('0x7')](_0x05b2('0x47'),null);this[_0x05b2('0x7')](_0x05b2('0x48'),null);this['setDataValue'](_0x05b2('0x49'),null);this['setDataValue'](_0x05b2('0x4a'),null);this[_0x05b2('0x7')]('dtlssetup',null);this[_0x05b2('0x7')]('dtlscertfile',null);this[_0x05b2('0x7')](_0x05b2('0x4b'),null);this['setDataValue'](_0x05b2('0x4c'),'no');break;case 0x2:this['setDataValue']('transport',_0x05b2('0x44'));this[_0x05b2('0x7')](_0x05b2('0x4d'),'yes');this[_0x05b2('0x7')](_0x05b2('0x46'),_0x05b2('0x27'));this[_0x05b2('0x7')]('force_avp',_0x05b2('0x27'));this[_0x05b2('0x7')]('icesupport',_0x05b2('0x27'));this[_0x05b2('0x7')](_0x05b2('0x49'),_0x05b2('0x27'));this[_0x05b2('0x7')]('dtlsverify','no');this[_0x05b2('0x7')](_0x05b2('0x4e'),'actpass');this['setDataValue'](_0x05b2('0x4f'),_0x1e035c[_0x05b2('0x4f')]||'/etc/pki/tls/certs/motion.crt');this[_0x05b2('0x7')]('dtlsprivatekey',_0x1e035c['dtlsprivatekey']||_0x05b2('0x50'));this['setDataValue'](_0x05b2('0x4c'),_0x05b2('0x27'));break;default:}}},'permissions':{'type':Sequelize[_0x05b2('0x40')],'set':function(_0x434137){this[_0x05b2('0x7')]('permissions',_0x434137?_0x434137[_0x05b2('0x22')](','):[]);},'get':function(){return this[_0x05b2('0xd')](_0x05b2('0x51'))?_[_0x05b2('0x52')](this[_0x05b2('0xd')](_0x05b2('0x51'))[_0x05b2('0x23')](','),function(_0x66b401){return parseInt(_0x66b401,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x05b2('0x5')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x05b2('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x05b2('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x05b2('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x05b2('0x5')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x05b2('0x16')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x05b2('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x05b2('0x5')]},'phoneBarEnableJaws':{'type':Sequelize[_0x05b2('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x05b2('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x05b2('0xd')](_0x05b2('0x53'))?this[_0x05b2('0xd')](_0x05b2('0x53')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x05b2('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x05b2('0x17')],'defaultValue':![]},'interface':{'type':Sequelize[_0x05b2('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x05b2('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x05b2('0x5')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x38a8f9){if(typeof _0x38a8f9===_0x05b2('0x54')){var _0x3c6f7c=_0x38a8f9==='1'?!![]:_0x38a8f9==='0'?![]:_0x38a8f9===_0x05b2('0x55')?!![]:_0x38a8f9==='false'?![]:![];this[_0x05b2('0x7')](_0x05b2('0x56'),_0x3c6f7c);}else{this[_0x05b2('0x7')](_0x05b2('0x56'),_0x38a8f9);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x40da35){this[_0x05b2('0x7')](_0x05b2('0x57'),_0x40da35);if(_0x40da35===!![]){this[_0x05b2('0x7')]('blockedAt',moment());this[_0x05b2('0x7')](_0x05b2('0x58'),0x0);}else{this[_0x05b2('0x7')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0x05b2('0x18')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x05b2('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x05b2('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x05b2('0x16')](0x5)[_0x05b2('0x59')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x05b2('0x17')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x05b2('0x17')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x05b2('0x17')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 37efe78..4ce0663 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 _0x5f4d=['openchannelPause','whatsapppause','pauseType','lastPauseAt','manual','%s%s','Pause','getTeams','addTeams','setDataValue','Voice','getMailQueues','getSmsQueues','Sms','getWhatsappQueues','Whatsapp','getFaxQueues','Fax','Openchannel','flatten','transaction','addAgent','online','getDataValue','UserVoicePrefix','removeTeams','Team','Chat','Mail','getOpenchannelQueues','removeAgent','TeamVoicePrefix','VoicePrefixId','getLists','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','removeSquareProjects','getScheduledCalls','CmHopper','concat','$and','$gt','$lt','$ne','$eq','$between','$in','$notIn','$like','$notLike','$contained','$any','firstName','Contact','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','Unable\x20to\x20retrieve\x20the\x20current\x20user','getPresence','teams','queues','getAgents','lower','toString','asc','substring','uniqBy','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','idle','unknown','unavailable','busy','charAt','toUpperCase','slice','select','ui.','InteractionId','field','user_has_','_interactions','ui.UserId\x20=\x20?','OpenTabs','moment','bluebird','util','lodash','squel','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','socket.io-emitter','./user.socket','register','redis','defaults','localhost','client','http','request','then','info','User,\x20%s,\x20%s','User,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','destroy','role','Users','user','Agents','agent','Telephones','telephone','ignore','map','value','includes','find','name','UserProfileResource','stack','send','User','fieldName','type','key','filter','password','salt','getOptions','where','includeAll','attributes','findAll','rows','openTabs','true','length','push','chat','dataValues','whatsapp','all','show','params','model','keys','rawAttributes','query','filters','fields','include','merge','options','openchannel','fax','mail','update','body','describe','addContacts','ids','omit','internal','Setting','findById','securePassword','validatePasswordPattern','max','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','SELECT','from','voicemail','mailbox','VoiceMail','fullname','email','permissions','102','113','110','104','105','106','107','109','100','114','115','create','Unauthorized','admin','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','checkUserLimits','settingsEnabled','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','isEmpty','compact','changePassword','oldPassword','newPassword','Sequelize','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','ValidationError','Wrong\x20credentials','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','passwordHistoryLimit','previousPasswords','validatePasswordHistory','addQueues','channel','loginInPause','voicePause','Unknown\x20channel','add','capitalize','spread','QueueId','emit','toLowerCase','Queue:save','VoiceQueue','get','interface','SIP/%s','penalty','each','UserVoiceQueueRt','upsert','removeQueues','isValidChannel','remove','isArray','Queue:remove','voice','addAvatar','userpic','file','getAvatar','root','server/files/images/logos/default_profile.png','download','join','server/files/images/','getOpenTabs','sms','ChatOpenTabs','CHAT','createdAt','FAX','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','CmContact','intersection','sort','pick','hasOwnProperty','CmList','List','Tags','color','tag','nolimit','Queue','order','Unknown\x20role','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','SmsInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','phone','format','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','headers','x-forwarded-for','connection','socket','remoteAddress','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','getChannels','YYYY-MM-DD\x20HH:mm:ss','LOGIN','device','PAUSE','LOGININPAUSE','bulkCreate','resolve','QueuePause','pause','updateAttributes','DEFAULT\x20PAUSE','unpause','chatPause','faxPause'];(function(_0x3081f1,_0x581565){var _0x19f390=function(_0x1dc224){while(--_0x1dc224){_0x3081f1['push'](_0x3081f1['shift']());}};_0x19f390(++_0x581565);}(_0x5f4d,0x91));var _0xd5f4=function(_0x2573ca,_0x550022){_0x2573ca=_0x2573ca-0x0;var _0x220656=_0x5f4d[_0x2573ca];return _0x220656;};'use strict';var moment=require(_0xd5f4('0x0'));var BPromise=require(_0xd5f4('0x1'));var util=require(_0xd5f4('0x2'));var path=require('path');var fs=require('fs');var _=require(_0xd5f4('0x3'));var squel=require(_0xd5f4('0x4'));var jayson=require('jayson/promise');var Redis=require('ioredis');var authService=require(_0xd5f4('0x5'));var qs=require('../../components/parsers/qs');var logger=require(_0xd5f4('0x6'))(_0xd5f4('0x7'));var utils=require(_0xd5f4('0x8'));var config=require(_0xd5f4('0x9'));var licenseUtil=require(_0xd5f4('0xa'));var db=require(_0xd5f4('0xb'))['db'];var socket=require(_0xd5f4('0xc'))(new Redis(config['redis']));require(_0xd5f4('0xd'))[_0xd5f4('0xe')](socket);config[_0xd5f4('0xf')]=_[_0xd5f4('0x10')](config['redis'],{'host':_0xd5f4('0x11'),'port':0x18eb});var client=jayson[_0xd5f4('0x12')][_0xd5f4('0x13')]({'port':0x232a});var values;function respondWithRpcPromise(_0x568db8,_0x214873,_0x3f45b4,_0x22a5dd){return new BPromise(function(_0x16b7ac,_0x2e27d2){var _0x51148f=_0x22a5dd||client;return _0x51148f[_0xd5f4('0x14')](_0x568db8,_0x3f45b4)[_0xd5f4('0x15')](function(_0x2c1ec1){logger[_0xd5f4('0x16')](_0xd5f4('0x17'),_0x214873,'request\x20sent');logger['debug'](_0xd5f4('0x18'),_0x214873,_0xd5f4('0x19'),JSON[_0xd5f4('0x1a')](_0x2c1ec1));if(_0x2c1ec1[_0xd5f4('0x1b')]){if(_0x2c1ec1[_0xd5f4('0x1b')][_0xd5f4('0x1c')]===0x1f4){logger[_0xd5f4('0x1b')]('User,\x20%s,\x20%s',_0x214873,_0x2c1ec1[_0xd5f4('0x1b')]['message']);return _0x2e27d2(_0x2c1ec1[_0xd5f4('0x1b')]['message']);}logger['error'](_0xd5f4('0x17'),_0x214873,_0x2c1ec1['error']['message']);return _0x16b7ac(_0x2c1ec1[_0xd5f4('0x1b')]['message']);}else{logger[_0xd5f4('0x16')](_0xd5f4('0x17'),_0x214873,_0xd5f4('0x19'));_0x16b7ac(_0x2c1ec1['result'][_0xd5f4('0x1d')]);}})[_0xd5f4('0x1e')](function(_0x3e0df9){logger[_0xd5f4('0x1b')](_0xd5f4('0x17'),_0x214873,_0x3e0df9);_0x2e27d2(_0x3e0df9);});});}function respondWithStatusCode(_0x5d6847,_0x187177){_0x187177=_0x187177||0xcc;return function(_0x1d6fd4){if(_0x1d6fd4){return _0x5d6847[_0xd5f4('0x1f')](_0x187177);}return _0x5d6847[_0xd5f4('0x20')](_0x187177)[_0xd5f4('0x21')]();};}function respondWithResult(_0x265299,_0x268ee0){_0x268ee0=_0x268ee0||0xc8;return function(_0x256722){if(_0x256722){return _0x265299['status'](_0x268ee0)[_0xd5f4('0x22')](_0x256722);}};}function respondWithFilteredResult(_0x1356a5,_0x5cd927){return function(_0x4a3541){if(_0x4a3541){var _0x5ef01f=typeof _0x5cd927['offset']===_0xd5f4('0x23')&&typeof _0x5cd927[_0xd5f4('0x24')]===_0xd5f4('0x23');var _0x1b811c=_0x4a3541[_0xd5f4('0x25')];var _0x247e92=_0x5ef01f?0x0:_0x5cd927[_0xd5f4('0x26')];var _0x58fd9c=_0x5ef01f?_0x4a3541[_0xd5f4('0x25')]:_0x5cd927[_0xd5f4('0x26')]+_0x5cd927[_0xd5f4('0x24')];var _0xde3914;if(_0x58fd9c>=_0x1b811c){_0x58fd9c=_0x1b811c;_0xde3914=0xc8;}else{_0xde3914=0xce;}_0x1356a5[_0xd5f4('0x20')](_0xde3914);return _0x1356a5[_0xd5f4('0x27')](_0xd5f4('0x28'),_0x247e92+'-'+_0x58fd9c+'/'+_0x1b811c)[_0xd5f4('0x22')](_0x4a3541);}return null;};}function saveUpdates(_0x53fb69){return function(_0x2bf553){if(_0x2bf553){return _0x2bf553['update'](_0x53fb69)[_0xd5f4('0x15')](function(_0x114023){return _0x114023;});}return null;};}function removeEntity(_0x19a6c7){return function(_0x104e99){if(_0x104e99){return _0x104e99[_0xd5f4('0x29')]()[_0xd5f4('0x15')](function(){var _0x1d7ebd=_0x104e99['get']({'plain':!![]});if(_0x1d7ebd[_0xd5f4('0x2a')]==='admin')return;var _0x2f907b=[{'name':_0xd5f4('0x2b'),'value':_0xd5f4('0x2c'),'ignore':!![]},{'name':_0xd5f4('0x2d'),'value':_0xd5f4('0x2e'),'ignore':![]},{'name':_0xd5f4('0x2f'),'value':_0xd5f4('0x30'),'ignore':![]}];var _0x14192d=_(_0x2f907b)['filter'](_0xd5f4('0x31'))[_0xd5f4('0x32')](_0xd5f4('0x33'))['value']();if(_[_0xd5f4('0x34')](_0x14192d,_0x1d7ebd[_0xd5f4('0x2a')])){return;}var _0x3c8156=_[_0xd5f4('0x35')](_0x2f907b,[_0xd5f4('0x33'),_0x1d7ebd[_0xd5f4('0x2a')]])[_0xd5f4('0x36')];return db[_0xd5f4('0x37')][_0xd5f4('0x29')]({'where':{'type':_0x3c8156,'resourceId':_0x1d7ebd['id']}})['then'](function(){return _0x104e99;});})['then'](function(){_0x19a6c7[_0xd5f4('0x20')](0xcc)[_0xd5f4('0x21')]();});}};}function handleEntityNotFound(_0x69a49d){return function(_0x4dcf31){if(!_0x4dcf31){_0x69a49d[_0xd5f4('0x1f')](0x194);}return _0x4dcf31;};}function handleError(_0x48a1d6,_0x19bf44){_0x19bf44=_0x19bf44||0x1f4;return function(_0x11f72c){logger[_0xd5f4('0x1b')](_0x11f72c[_0xd5f4('0x38')]);if(_0x11f72c[_0xd5f4('0x36')]){delete _0x11f72c[_0xd5f4('0x36')];}_0x48a1d6[_0xd5f4('0x20')](_0x19bf44)[_0xd5f4('0x39')](_0x11f72c);};}exports['index']=function(_0x319efd,_0x28fa0f){var _0x2350fe={},_0x5ed6b8={'count':0x0,'rows':[]};var _0x51f1d3=_(db[_0xd5f4('0x3a')]['rawAttributes'])[_0xd5f4('0x32')](function(_0x5969e3){return{'name':_0x5969e3[_0xd5f4('0x3b')],'type':_0x5969e3[_0xd5f4('0x3c')][_0xd5f4('0x3d')]};})[_0xd5f4('0x3e')](function(_0x174eaa){return!_[_0xd5f4('0x34')]([_0xd5f4('0x3f'),_0xd5f4('0x40')],_0x174eaa[_0xd5f4('0x36')]);})[_0xd5f4('0x33')]();_0x2350fe=qs[_0xd5f4('0x41')](_0x51f1d3,_0x319efd);var _0x342d47={'where':_0x2350fe[_0xd5f4('0x42')]};return db[_0xd5f4('0x3a')][_0xd5f4('0x25')](_0x342d47)[_0xd5f4('0x15')](function(_0x32b528){_0x5ed6b8[_0xd5f4('0x25')]=_0x32b528;if(_0x319efd['query'][_0xd5f4('0x43')]){_0x2350fe['include']=[{'all':!![]}];}if(!_[_0xd5f4('0x34')](_0x2350fe[_0xd5f4('0x44')],'id')){_0x2350fe[_0xd5f4('0x44')]['push']('id');}return db[_0xd5f4('0x3a')][_0xd5f4('0x45')](_0x2350fe);})[_0xd5f4('0x15')](function(_0x4a7455){_0x5ed6b8[_0xd5f4('0x46')]=_0x4a7455;if(_0x319efd['query'][_0xd5f4('0x47')]===_0xd5f4('0x48')){var _0x4f6d66=[];for(var _0x16bcb7=0x0;_0x16bcb7<_0x5ed6b8[_0xd5f4('0x46')][_0xd5f4('0x49')];_0x16bcb7++){_0x4f6d66[_0xd5f4('0x4a')](get_open_tabs(_0xd5f4('0x4b'),_0x5ed6b8[_0xd5f4('0x46')][_0x16bcb7][_0xd5f4('0x4c')]));_0x4f6d66['push'](get_open_tabs('sms',_0x5ed6b8[_0xd5f4('0x46')][_0x16bcb7][_0xd5f4('0x4c')]));_0x4f6d66[_0xd5f4('0x4a')](get_open_tabs('fax',_0x5ed6b8[_0xd5f4('0x46')][_0x16bcb7]['dataValues']));_0x4f6d66[_0xd5f4('0x4a')](get_open_tabs('mail',_0x5ed6b8['rows'][_0x16bcb7]['dataValues']));_0x4f6d66[_0xd5f4('0x4a')](get_open_tabs('openchannel',_0x5ed6b8['rows'][_0x16bcb7]['dataValues']));_0x4f6d66[_0xd5f4('0x4a')](get_open_tabs(_0xd5f4('0x4d'),_0x5ed6b8[_0xd5f4('0x46')][_0x16bcb7]['dataValues']));}return BPromise[_0xd5f4('0x4e')](_0x4f6d66)[_0xd5f4('0x15')](function(_0x3bc05a){return _0x5ed6b8;});}else{return _0x5ed6b8;}})[_0xd5f4('0x15')](respondWithFilteredResult(_0x28fa0f,_0x2350fe))[_0xd5f4('0x1e')](handleError(_0x28fa0f,null));};exports[_0xd5f4('0x4f')]=function(_0x59503c,_0x4feefa){var _0x16d77d={'raw':![],'where':{'id':_0x59503c[_0xd5f4('0x50')]['id']}},_0x4f4bc7={};_0x4f4bc7[_0xd5f4('0x51')]=_['differenceBy'](_[_0xd5f4('0x52')](db['User'][_0xd5f4('0x53')]),['password',_0xd5f4('0x40')]);_0x4f4bc7[_0xd5f4('0x54')]=_[_0xd5f4('0x52')](_0x59503c['query']);_0x4f4bc7[_0xd5f4('0x55')]=_['intersection'](_0x4f4bc7['model'],_0x4f4bc7['query']);_0x16d77d[_0xd5f4('0x44')]=_['intersection'](_0x4f4bc7[_0xd5f4('0x51')],qs[_0xd5f4('0x56')](_0x59503c[_0xd5f4('0x54')]['fields']));_0x16d77d[_0xd5f4('0x44')]=_0x16d77d[_0xd5f4('0x44')]['length']?_0x16d77d[_0xd5f4('0x44')]:_0x4f4bc7[_0xd5f4('0x51')];if(_0x59503c[_0xd5f4('0x54')]['includeAll']){_0x16d77d[_0xd5f4('0x57')]=[{'all':!![]}];}_0x16d77d=_[_0xd5f4('0x58')]({},_0x16d77d,_0x59503c[_0xd5f4('0x59')]);if(!_[_0xd5f4('0x34')](_0x16d77d['attributes'],'id')){_0x16d77d[_0xd5f4('0x44')][_0xd5f4('0x4a')]('id');}return db[_0xd5f4('0x3a')]['find'](_0x16d77d)[_0xd5f4('0x15')](handleEntityNotFound(_0x4feefa,null))[_0xd5f4('0x15')](function(_0x1010b1){var _0x31f337=[];values=_0x1010b1;if(_0x59503c[_0xd5f4('0x54')][_0xd5f4('0x47')]===_0xd5f4('0x48')){_0x31f337[_0xd5f4('0x4a')](get_open_tabs(_0xd5f4('0x4b'),_0x1010b1[_0xd5f4('0x4c')]));_0x31f337['push'](get_open_tabs('sms',_0x1010b1[_0xd5f4('0x4c')]));_0x31f337[_0xd5f4('0x4a')](get_open_tabs(_0xd5f4('0x5a'),_0x1010b1[_0xd5f4('0x4c')]));_0x31f337['push'](get_open_tabs(_0xd5f4('0x4d'),_0x1010b1[_0xd5f4('0x4c')]));_0x31f337[_0xd5f4('0x4a')](get_open_tabs(_0xd5f4('0x5b'),_0x1010b1[_0xd5f4('0x4c')]));_0x31f337[_0xd5f4('0x4a')](get_open_tabs(_0xd5f4('0x5c'),_0x1010b1[_0xd5f4('0x4c')]));return BPromise[_0xd5f4('0x4e')](_0x31f337);}else{return values;}})[_0xd5f4('0x15')](function(_0x4a7fa6){return values;})[_0xd5f4('0x15')](respondWithResult(_0x4feefa,null))[_0xd5f4('0x1e')](handleError(_0x4feefa,null));};exports[_0xd5f4('0x5d')]=function(_0x2c26e5,_0x9d42a3){if(_0x2c26e5[_0xd5f4('0x5e')]['id']){delete _0x2c26e5['body']['id'];}delete _0x2c26e5[_0xd5f4('0x5e')][_0xd5f4('0x2a')];return db[_0xd5f4('0x3a')]['find']({'where':{'id':_0x2c26e5['params']['id']}})[_0xd5f4('0x15')](handleEntityNotFound(_0x9d42a3,null))[_0xd5f4('0x15')](saveUpdates(_0x2c26e5['body'],null))[_0xd5f4('0x15')](respondWithResult(_0x9d42a3,null))[_0xd5f4('0x1e')](handleError(_0x9d42a3,null));};exports['describe']=function(_0x10ad28,_0x4824c7){return db[_0xd5f4('0x3a')][_0xd5f4('0x5f')]()[_0xd5f4('0x15')](respondWithResult(_0x4824c7,null))[_0xd5f4('0x1e')](handleError(_0x4824c7,null));};exports[_0xd5f4('0x60')]=function(_0x2edbbc,_0x52ed25){return db[_0xd5f4('0x3a')][_0xd5f4('0x35')]({'where':{'id':_0x2edbbc['params']['id']}})[_0xd5f4('0x15')](handleEntityNotFound(_0x52ed25,null))[_0xd5f4('0x15')](function(_0x53e09b){if(_0x53e09b){return _0x53e09b[_0xd5f4('0x60')](_0x2edbbc[_0xd5f4('0x5e')][_0xd5f4('0x61')],_[_0xd5f4('0x62')](_0x2edbbc[_0xd5f4('0x5e')],[_0xd5f4('0x61'),'id'])||{});}})[_0xd5f4('0x15')](respondWithResult(_0x52ed25,null))[_0xd5f4('0x1e')](handleError(_0x52ed25,null));};function validateUser(_0x2fd4d8){return new BPromise(function(_0x47bb4d,_0x29abd6){if(_0x2fd4d8[_0xd5f4('0x63')])return _0x47bb4d(_0x2fd4d8);return db[_0xd5f4('0x64')][_0xd5f4('0x65')](0x1)[_0xd5f4('0x15')](function(_0x56e9ba){if(_0x56e9ba[_0xd5f4('0x66')])authService[_0xd5f4('0x67')](_0x2fd4d8[_0xd5f4('0x3f')]);db[_0xd5f4('0x3a')][_0xd5f4('0x68')](_0xd5f4('0x63'))['then'](function(_0x32e6a9){if(_[_0xd5f4('0x69')](_0x32e6a9)){_0x2fd4d8[_0xd5f4('0x63')]=_0x56e9ba[_0xd5f4('0x6a')]||0x1;return;}if(_[_0xd5f4('0x69')](_0x56e9ba[_0xd5f4('0x6a')])||_0x56e9ba[_0xd5f4('0x6a')]===_0x32e6a9){_0x2fd4d8[_0xd5f4('0x63')]=_0x32e6a9+0x1;return;}if(_0x56e9ba[_0xd5f4('0x6a')]>_0x32e6a9){_0x2fd4d8['internal']=_0x56e9ba[_0xd5f4('0x6a')];return;}return db[_0xd5f4('0x6b')]['query'](_0xd5f4('0x6c'),{'type':db[_0xd5f4('0x6b')]['QueryTypes'][_0xd5f4('0x6d')]})[_0xd5f4('0x15')](function(_0x370f0c){if(_0x370f0c&&_0x370f0c[_0xd5f4('0x49')]){for(var _0x5aaf34=0x0,_0x5e9bf2=_0x370f0c[_0xd5f4('0x49')];_0x5aaf34<_0x5e9bf2&&_[_0xd5f4('0x69')](_0x2fd4d8[_0xd5f4('0x63')]);_0x5aaf34++){if(_0x56e9ba[_0xd5f4('0x6a')]<=_0x370f0c[_0x5aaf34][_0xd5f4('0x6e')]){_0x2fd4d8[_0xd5f4('0x63')]=_0x370f0c[_0x5aaf34][_0xd5f4('0x6e')];}else if(_0x56e9ba[_0xd5f4('0x6a')]>_0x370f0c[_0x5aaf34][_0xd5f4('0x6e')]&&_0x56e9ba['min_internal']<=_0x370f0c[_0x5aaf34]['to']){_0x2fd4d8[_0xd5f4('0x63')]=_0x56e9ba[_0xd5f4('0x6a')];}}}if(_[_0xd5f4('0x69')](_0x2fd4d8[_0xd5f4('0x63')])){_0x2fd4d8[_0xd5f4('0x63')]=_0x32e6a9+0x1;}return _0x47bb4d(_0x2fd4d8);});});})[_0xd5f4('0x1e')](function(_0x25fd54){_0x29abd6(_0x25fd54);});});}function updateUser(_0x207f56){return new BPromise(function(_0x27e81e,_0x3d1511){try{if(_0x207f56[_0xd5f4('0x6f')]){_0x207f56[_0xd5f4('0x70')]=_0x207f56[_0xd5f4('0x63')];_0x207f56[_0xd5f4('0x71')]={'mailbox':_0x207f56[_0xd5f4('0x63')],'password':_0x207f56[_0xd5f4('0x3f')],'fullname':_0x207f56[_0xd5f4('0x72')],'email':_0x207f56[_0xd5f4('0x73')]};}if(_0x207f56[_0xd5f4('0x2a')]==='agent'){if(!_0x207f56[_0xd5f4('0x74')])_0x207f56[_0xd5f4('0x74')]=['101',_0xd5f4('0x75'),'103',_0xd5f4('0x76'),_0xd5f4('0x77'),_0xd5f4('0x78'),_0xd5f4('0x79'),_0xd5f4('0x7a'),_0xd5f4('0x7b'),'108',_0xd5f4('0x7c'),_0xd5f4('0x7d'),'111',_0xd5f4('0x7e'),_0xd5f4('0x7f')];}_0x27e81e(_0x207f56);}catch(_0x315c32){_0x3d1511(_0x315c32);}});}exports[_0xd5f4('0x80')]=function(_0x3d954a,_0x17357b){if(_0x3d954a[_0xd5f4('0x2c')][_0xd5f4('0x2a')]===_0xd5f4('0x2e'))throw new Error(_0xd5f4('0x81'));if(_0x3d954a[_0xd5f4('0x5e')]['role']===_0xd5f4('0x2c')&&_0x3d954a[_0xd5f4('0x2c')][_0xd5f4('0x2a')]!==_0xd5f4('0x82')){throw new Error(_0xd5f4('0x83'));}if(_0x3d954a[_0xd5f4('0x5e')][_0xd5f4('0x2a')]==='admin'&&_0x3d954a['user'][_0xd5f4('0x2a')]!==_0xd5f4('0x82')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0xd5f4('0x84')]([_0x3d954a['body']])[_0xd5f4('0x15')](function(){return validateUser(_0x3d954a[_0xd5f4('0x5e')]);})[_0xd5f4('0x15')](function(_0x2eb159){return updateUser(_0x2eb159)[_0xd5f4('0x15')](function(_0x525a05){if(_0x525a05[_0xd5f4('0x2a')]===_0xd5f4('0x82')){_0x525a05['settingsEnabled']=_0x3d954a[_0xd5f4('0x2c')][_0xd5f4('0x85')];delete _0x525a05['userProfileId'];}return _0x525a05;});})[_0xd5f4('0x15')](function(_0x2b602d){return db[_0xd5f4('0x3a')][_0xd5f4('0x80')](_0x2b602d,{'include':[{'model':db[_0xd5f4('0x71')],'as':'VoiceMail'}]});})[_0xd5f4('0x15')](function(_0x4e1e86){if(_0x3d954a[_0xd5f4('0x5e')]['role']===_0xd5f4('0x2c'))return _0x4e1e86;if(_0x3d954a[_0xd5f4('0x2c')][_0xd5f4('0x2a')]!==_0xd5f4('0x2c'))return _0x4e1e86;return db[_0xd5f4('0x86')][_0xd5f4('0x35')]({'where':{'name':_0x4e1e86[_0xd5f4('0x2a')]===_0xd5f4('0x2e')?'Agents':'Telephones','userProfileId':_0x3d954a[_0xd5f4('0x2c')][_0xd5f4('0x87')]},'raw':!![]})[_0xd5f4('0x15')](function(_0x5eaee6){if(!_0x5eaee6||_0x5eaee6[_0xd5f4('0x88')]!=0x0)return _0x4e1e86;return db['UserProfileResource'][_0xd5f4('0x80')]({'name':_0x4e1e86['name'],'resourceId':_0x4e1e86['id'],'type':_0x5eaee6[_0xd5f4('0x36')],'sectionId':_0x5eaee6['id']},{})[_0xd5f4('0x15')](function(){return _0x4e1e86;});})[_0xd5f4('0x1e')](function(_0x1969ca){logger[_0xd5f4('0x1b')](_0xd5f4('0x89'),_0x1969ca);throw _0x1969ca;});})[_0xd5f4('0x15')](respondWithResult(_0x17357b,0xc9))[_0xd5f4('0x1e')](handleError(_0x17357b,null));};exports['bulkCreate']=function(_0x3e1ab3,_0x59dc7b){var _0x2dc3cf=_0x3e1ab3[_0xd5f4('0x5e')];var _0x4f9c06=[];if(_0x3e1ab3[_0xd5f4('0x2c')][_0xd5f4('0x2a')]===_0xd5f4('0x2e'))throw new Error(_0xd5f4('0x81'));if(_[_0xd5f4('0x8a')](_0x2dc3cf,['role',_0xd5f4('0x2c')])&&_0x3e1ab3['user'][_0xd5f4('0x2a')]!==_0xd5f4('0x82')){throw new Error(_0xd5f4('0x83'));}if(_[_0xd5f4('0x8a')](_0x2dc3cf,[_0xd5f4('0x2a'),'admin'])&&_0x3e1ab3[_0xd5f4('0x2c')]['role']!=='admin'){throw new Error(_0xd5f4('0x8b'));}return licenseUtil[_0xd5f4('0x84')](_0x2dc3cf)['then'](function(){return validateUser(_0x2dc3cf[0x0]);})[_0xd5f4('0x15')](function(){for(var _0x4c4c43=0x1;_0x4c4c43<_0x2dc3cf['length'];_0x4c4c43++){var _0x5ec82e=_0x2dc3cf[_0x4c4c43-0x1][_0xd5f4('0x63')];if(!_0x2dc3cf[_0x4c4c43][_0xd5f4('0x63')])_0x2dc3cf[_0x4c4c43][_0xd5f4('0x63')]=_0x5ec82e+0x1;_0x4f9c06[_0xd5f4('0x4a')](validateUser(_0x2dc3cf[_0x4c4c43]));}return BPromise[_0xd5f4('0x4e')](_0x4f9c06);})[_0xd5f4('0x15')](function(){_0x4f9c06=[];for(var _0x30c2a5=0x0;_0x30c2a5<_0x2dc3cf['length'];_0x30c2a5++){_0x4f9c06['push'](updateUser(_0x2dc3cf[_0x30c2a5]));}return BPromise[_0xd5f4('0x4e')](_0x4f9c06);})[_0xd5f4('0x15')](function(){return BPromise['each'](_0x2dc3cf,function(_0x99bee2){return db[_0xd5f4('0x3a')][_0xd5f4('0x80')](_0x99bee2,{'include':[{'model':db['VoiceMail'],'as':_0xd5f4('0x71')}]})[_0xd5f4('0x15')](function(_0x3ec336){_0x99bee2['id']=_0x3ec336['id'];return _0x99bee2;});});})['then'](function(_0x239f45){if(_0x3e1ab3[_0xd5f4('0x5e')][_0xd5f4('0x2a')]===_0xd5f4('0x2c'))return _0x239f45;if(_0x3e1ab3[_0xd5f4('0x2c')][_0xd5f4('0x2a')]!=='user')return _0x239f45;var _0x41ff29=_[_0xd5f4('0x8a')](_0x239f45,function(_0x4df184){return _0x4df184[_0xd5f4('0x2a')]===_0xd5f4('0x2e')||_0x4df184[_0xd5f4('0x2a')]===_0xd5f4('0x30');});if(!_0x41ff29)return _0x239f45;return db[_0xd5f4('0x86')][_0xd5f4('0x45')]({'where':{'name':{'$or':[_0xd5f4('0x2d'),_0xd5f4('0x2f')]},'userProfileId':_0x3e1ab3[_0xd5f4('0x2c')][_0xd5f4('0x87')]},'raw':!![]})[_0xd5f4('0x15')](function(_0x53b4f5){if(_[_0xd5f4('0x8c')](_0x53b4f5)||!_[_0xd5f4('0x8a')](_0x53b4f5,[_0xd5f4('0x88'),0x0]))return _0x239f45;_0x4f9c06=[];var _0x27709e=_(_0x53b4f5)[_0xd5f4('0x32')](function(_0x2778f2){if(_0x2778f2[_0xd5f4('0x88')]===0x1)return;return _0x2778f2['name']===_0xd5f4('0x2d')?_0xd5f4('0x2e'):_0xd5f4('0x30');})[_0xd5f4('0x8d')]()[_0xd5f4('0x33')]();for(var _0x8914a=0x0;_0x8914a<_0x239f45[_0xd5f4('0x49')];_0x8914a++){if(!_[_0xd5f4('0x34')](_0x27709e,_0x239f45[_0x8914a][_0xd5f4('0x2a')]))return;var _0x500cec=_0x239f45[_0x8914a][_0xd5f4('0x2a')]===_0xd5f4('0x2e')?'Agents':_0xd5f4('0x2f');_0x4f9c06[_0xd5f4('0x4a')](db[_0xd5f4('0x37')][_0xd5f4('0x80')]({'name':_0x239f45[_0x8914a][_0xd5f4('0x36')],'resourceId':_0x239f45[_0x8914a]['id'],'type':_0x500cec,'sectionId':_[_0xd5f4('0x35')](_0x53b4f5,[_0xd5f4('0x36'),_0x500cec])['id']},{}));}return BPromise['all'](_0x4f9c06);});})[_0xd5f4('0x15')](respondWithResult(_0x59dc7b,0xc9))[_0xd5f4('0x1e')](handleError(_0x59dc7b,null));};exports[_0xd5f4('0x8e')]=function(_0xc16434,_0x3a7b91){if(_0xc16434[_0xd5f4('0x5e')]['id']){delete _0xc16434[_0xd5f4('0x5e')]['id'];}return db[_0xd5f4('0x3a')][_0xd5f4('0x35')]({'where':{'id':_0xc16434['params']['id']}})[_0xd5f4('0x15')](function(_0x32590b){if(!_0x32590b)return null;if(_0x32590b['id']===_0xc16434[_0xd5f4('0x2c')]['id']){if(!_0xc16434['body'][_0xd5f4('0x8f')]||!_0xc16434[_0xd5f4('0x5e')][_0xd5f4('0x90')]){throw new db[(_0xd5f4('0x91'))]['ValidationError'](_0xd5f4('0x92'));}if(!_0x32590b[_0xd5f4('0x93')](_0xc16434['body'][_0xd5f4('0x8f')])){throw new db['Sequelize'][(_0xd5f4('0x94'))](_0xd5f4('0x95'));}if(_0xc16434['body'][_0xd5f4('0x8f')]===_0xc16434[_0xd5f4('0x5e')][_0xd5f4('0x90')]){throw new db[(_0xd5f4('0x91'))][(_0xd5f4('0x94'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0xc16434[_0xd5f4('0x2c')][_0xd5f4('0x2a')]===_0xd5f4('0x82')){if(!_0xc16434[_0xd5f4('0x5e')][_0xd5f4('0x90')]){throw new db[(_0xd5f4('0x91'))][(_0xd5f4('0x94'))](_0xd5f4('0x96'));}}else if(_0xc16434[_0xd5f4('0x2c')]['role']==='user'){if(!_0xc16434[_0xd5f4('0x5e')][_0xd5f4('0x90')]){throw new db['Sequelize'][(_0xd5f4('0x94'))](_0xd5f4('0x96'));}if(_0x32590b[_0xd5f4('0x2a')]!==_0xd5f4('0x2e')){throw new db[(_0xd5f4('0x91'))][(_0xd5f4('0x94'))](_0xd5f4('0x81'));}}else{throw new db[(_0xd5f4('0x91'))][(_0xd5f4('0x94'))](_0xd5f4('0x81'));}return _0x32590b;})['then'](handleEntityNotFound(_0x3a7b91,null))[_0xd5f4('0x15')](function(_0x5e0d28){return db['Setting'][_0xd5f4('0x97')]({'attributes':['id','securePassword','enforcePasswordHistory',_0xd5f4('0x98')]})[_0xd5f4('0x15')](function(_0x539dfe){if(_0x539dfe['securePassword'])authService[_0xd5f4('0x67')](_0xc16434['body'][_0xd5f4('0x90')]);if(!_0x539dfe['enforcePasswordHistory']||!_0x5e0d28[_0xd5f4('0x99')])return _0x5e0d28;authService[_0xd5f4('0x9a')](_0xc16434[_0xd5f4('0x5e')][_0xd5f4('0x90')],_0x5e0d28[_0xd5f4('0x99')],_0x539dfe[_0xd5f4('0x98')]);return _0x5e0d28;})[_0xd5f4('0x15')](saveUpdates({'password':_0xc16434[_0xd5f4('0x5e')][_0xd5f4('0x90')],'passwordResetAt':_0xc16434['user']['id']==_0xc16434[_0xd5f4('0x50')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0xc16434[_0xd5f4('0x5e')][_0xd5f4('0x90')],_0x5e0d28[_0xd5f4('0x99')])},null));})[_0xd5f4('0x15')](respondWithResult(_0x3a7b91,null))[_0xd5f4('0x1e')](handleError(_0x3a7b91,null));};exports[_0xd5f4('0x9b')]=function(_0x2bde23,_0x5857a1){var _0x52cd4d=_0x2bde23[_0xd5f4('0x5e')][_0xd5f4('0x9c')];return db['User'][_0xd5f4('0x35')]({'where':{'id':_0x2bde23['params']['id']},'attributes':['id',_0xd5f4('0x36'),_0xd5f4('0x2a'),'online',_0xd5f4('0x9d'),_0xd5f4('0x9e'),'interface']})[_0xd5f4('0x15')](handleEntityNotFound(_0x5857a1,null))['then'](function(_0x1e738f){if(_0x1e738f){if(!utils['isValidChannel'](_0x52cd4d)){throw new db[(_0xd5f4('0x91'))]['ValidationError'](_0xd5f4('0x9f'));}return _0x1e738f[_0xd5f4('0xa0')+_[_0xd5f4('0xa1')](_0x52cd4d['toLowerCase']())+'Queues'](_0x2bde23['body']['ids'],{'penalty':_0x2bde23[_0xd5f4('0x5e')]['penalty']||0x0})[_0xd5f4('0xa2')](function(_0x26fa7e){for(var _0x3b9445=0x0;_0x3b9445<_0x2bde23[_0xd5f4('0x5e')]['ids'][_0xd5f4('0x49')];_0x3b9445+=0x1){var _0x1d83cf={'UserId':Number(_0x2bde23['params']['id'])};_0x1d83cf[_[_0xd5f4('0xa1')](_0x52cd4d['toLowerCase']())+_0xd5f4('0xa3')]=Number(_0x2bde23[_0xd5f4('0x5e')][_0xd5f4('0x61')][_0x3b9445]);socket[_0xd5f4('0xa4')](_0xd5f4('0x2c')+_[_0xd5f4('0xa1')](_0x52cd4d[_0xd5f4('0xa5')]())+_0xd5f4('0xa6'),_0x1d83cf);}return _0x26fa7e;})[_0xd5f4('0x15')](function(){if(_0x52cd4d==='voice'){return db[_0xd5f4('0xa7')][_0xd5f4('0x45')]({'where':{'id':_0x2bde23[_0xd5f4('0x5e')][_0xd5f4('0x61')]||[]},'raw':!![],'attributes':['id',_0xd5f4('0x36')]});}})['then'](function(_0x3ffb97){var _0x367fc3=_0x1e738f[_0xd5f4('0xa8')]({'plain':!![]});var _0x4175de=[];if(_0x52cd4d==='voice'&&_0x367fc3[_0xd5f4('0x2a')]===_0xd5f4('0x2e')&&_0x367fc3['online']){for(var _0x597409=0x0;_0x597409<_0x3ffb97['length'];_0x597409+=0x1){_0x4175de[_0xd5f4('0x4a')]({'membername':_0x367fc3[_0xd5f4('0x36')],'UserId':_0x367fc3['id'],'queue_name':_0x3ffb97[_0x597409][_0xd5f4('0x36')],'VoiceQueueId':_0x3ffb97[_0x597409]['id'],'interface':_[_0xd5f4('0x69')](_0x367fc3[_0xd5f4('0xa9')])?util['format'](_0xd5f4('0xaa'),_0x367fc3[_0xd5f4('0x36')]):_0x367fc3[_0xd5f4('0xa9')],'paused':_0x367fc3['voicePause']||![],'penalty':_0x2bde23['body'][_0xd5f4('0xab')]||0x0});}return BPromise[_0xd5f4('0xac')](_0x4175de,function(_0x594f70){return db[_0xd5f4('0xad')][_0xd5f4('0xae')](_0x594f70);});}return _0x1e738f;});}})[_0xd5f4('0x15')](respondWithStatusCode(_0x5857a1,null))[_0xd5f4('0x1e')](handleError(_0x5857a1,null));};exports[_0xd5f4('0xaf')]=function(_0x436b71,_0x1eb615){var _0x242459;return db['User'][_0xd5f4('0x35')]({'where':{'id':_0x436b71[_0xd5f4('0x50')]['id']},'attributes':['id',_0xd5f4('0x36'),_0xd5f4('0x2a')]})[_0xd5f4('0x15')](handleEntityNotFound(_0x1eb615,null))[_0xd5f4('0x15')](function(_0x5e575c){if(_0x5e575c){_0x242459=_0x5e575c;if(!_0x436b71[_0xd5f4('0x54')]['channel']||!utils[_0xd5f4('0xb0')](_0x436b71[_0xd5f4('0x54')][_0xd5f4('0x9c')])){throw new db[(_0xd5f4('0x91'))]['ValidationError'](_0xd5f4('0x9f'));}return _0x5e575c[_0xd5f4('0xb1')+_[_0xd5f4('0xa1')](_0x436b71[_0xd5f4('0x54')][_0xd5f4('0x9c')][_0xd5f4('0xa5')]())+'Queues'](_0x436b71[_0xd5f4('0x54')][_0xd5f4('0x61')]);}})['then'](function(_0x18b010){if(_[_0xd5f4('0xb2')](_0x436b71[_0xd5f4('0x54')][_0xd5f4('0x61')])){for(var _0x23939d=0x0;_0x23939d<_0x436b71[_0xd5f4('0x54')][_0xd5f4('0x61')][_0xd5f4('0x49')];_0x23939d+=0x1){var _0xea4ca0={'UserId':Number(_0x436b71[_0xd5f4('0x50')]['id'])};_0xea4ca0[_[_0xd5f4('0xa1')](_0x436b71[_0xd5f4('0x54')][_0xd5f4('0x9c')][_0xd5f4('0xa5')]())+'QueueId']=Number(_0x436b71[_0xd5f4('0x54')][_0xd5f4('0x61')][_0x23939d]);socket[_0xd5f4('0xa4')](_0xd5f4('0x2c')+_[_0xd5f4('0xa1')](_0x436b71[_0xd5f4('0x54')][_0xd5f4('0x9c')][_0xd5f4('0xa5')]())+_0xd5f4('0xb3'),_0xea4ca0);}}else{var _0xea4ca0={'UserId':Number(_0x436b71['params']['id'])};_0xea4ca0[_[_0xd5f4('0xa1')](_0x436b71[_0xd5f4('0x54')][_0xd5f4('0x9c')][_0xd5f4('0xa5')]())+_0xd5f4('0xa3')]=Number(_0x436b71[_0xd5f4('0x54')][_0xd5f4('0x61')]);socket[_0xd5f4('0xa4')]('user'+_['capitalize'](_0x436b71[_0xd5f4('0x54')][_0xd5f4('0x9c')]['toLowerCase']())+_0xd5f4('0xb3'),_0xea4ca0);}return _0x18b010;})[_0xd5f4('0x15')](function(){if(_0x436b71[_0xd5f4('0x54')][_0xd5f4('0x9c')]===_0xd5f4('0xb4')){return db['UserVoiceQueueRt'][_0xd5f4('0x29')]({'where':{'UserId':_0x436b71[_0xd5f4('0x50')]['id'],'VoiceQueueId':_0x436b71[_0xd5f4('0x54')]['ids']},'individualHooks':!![]})[_0xd5f4('0x15')](function(){return _0x242459;});}return _0x242459;})[_0xd5f4('0x15')](respondWithStatusCode(_0x1eb615,null))[_0xd5f4('0x1e')](handleError(_0x1eb615,null));};exports[_0xd5f4('0xb5')]=function(_0x443b0e,_0x17f31d){_0x443b0e['body'][_0xd5f4('0xb6')]=_0x443b0e[_0xd5f4('0xb7')]['filename'];return db[_0xd5f4('0x3a')]['find']({'where':{'id':_0x443b0e[_0xd5f4('0x50')]['id']}})[_0xd5f4('0x15')](handleEntityNotFound(_0x17f31d,null))['then'](saveUpdates(_0x443b0e['body'],null))[_0xd5f4('0x15')](respondWithResult(_0x17f31d,null))[_0xd5f4('0x1e')](handleError(_0x17f31d,null));};exports[_0xd5f4('0xb8')]=function(_0xc9aa77,_0x736af6){var _0x81031b=path['join'](config[_0xd5f4('0xb9')],_0xd5f4('0xba'));return db[_0xd5f4('0x3a')][_0xd5f4('0x35')]({'where':{'id':_0xc9aa77[_0xd5f4('0x50')]['id']},'attributes':['id',_0xd5f4('0xb6')],'raw':!![]})[_0xd5f4('0x15')](handleEntityNotFound(_0x736af6,null))[_0xd5f4('0x15')](function(_0x1a1d16){if(_0x1a1d16){if(_['isNil'](_0x1a1d16[_0xd5f4('0xb6')])){return _0x736af6[_0xd5f4('0xbb')](_0x81031b);}else{if(!fs['existsSync'](path[_0xd5f4('0xbc')](config[_0xd5f4('0xb9')],'server/files/images/',_0x1a1d16[_0xd5f4('0xb6')]))){return _0x736af6[_0xd5f4('0xbb')](_0x81031b);}return _0x736af6[_0xd5f4('0xbb')](path[_0xd5f4('0xbc')](config[_0xd5f4('0xb9')],_0xd5f4('0xbd'),_0x1a1d16[_0xd5f4('0xb6')]));}}})[_0xd5f4('0x1e')](handleError(_0x736af6,null));};exports[_0xd5f4('0xbe')]=function(_0x2dd282,_0x3c7baf){return db[_0xd5f4('0x3a')]['find']({'where':{'id':_0x2dd282[_0xd5f4('0x50')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x3c7baf,null))[_0xd5f4('0x15')](function(_0x44fee0){var _0x29a9bd=[];values=_0x44fee0['dataValues'];_0x29a9bd['push'](get_open_tabs('chat',_0x44fee0['dataValues']));_0x29a9bd[_0xd5f4('0x4a')](get_open_tabs(_0xd5f4('0xbf'),_0x44fee0[_0xd5f4('0x4c')]));_0x29a9bd[_0xd5f4('0x4a')](get_open_tabs('openchannel',_0x44fee0[_0xd5f4('0x4c')]));_0x29a9bd[_0xd5f4('0x4a')](get_open_tabs('whatsapp',_0x44fee0['dataValues']));_0x29a9bd[_0xd5f4('0x4a')](get_open_tabs('fax',_0x44fee0[_0xd5f4('0x4c')]));_0x29a9bd[_0xd5f4('0x4a')](get_open_tabs(_0xd5f4('0x5c'),_0x44fee0[_0xd5f4('0x4c')]));return BPromise[_0xd5f4('0x4e')](_0x29a9bd);})[_0xd5f4('0x15')](function(_0x1bdbb8){var _0x39be50=[];if(_0x1bdbb8){for(var _0x43ac78=0x0;_0x43ac78=_0x43966a){_0x2aa651=_0x43966a;_0x2a931d=0xc8;}else{_0x2a931d=0xce;}_0x1c3ab0[_0x0da2('0x19')](_0x2a931d);return _0x1c3ab0[_0x0da2('0x20')](_0x0da2('0x21'),_0x40fc6a+'-'+_0x2aa651+'/'+_0x43966a)['json'](_0x336c76);}return null;};}function saveUpdates(_0x1b657d){return function(_0x538970){if(_0x538970){return _0x538970[_0x0da2('0x22')](_0x1b657d)[_0x0da2('0x13')](function(_0x19058e){return _0x19058e;});}return null;};}function removeEntity(_0x3a2625){return function(_0x1d17ad){if(_0x1d17ad){return _0x1d17ad[_0x0da2('0x23')]()[_0x0da2('0x13')](function(){var _0x3c5460=_0x1d17ad[_0x0da2('0x24')]({'plain':!![]});if(_0x3c5460[_0x0da2('0x25')]===_0x0da2('0x26'))return;var _0x5e1596=[{'name':'Users','value':'user','ignore':!![]},{'name':_0x0da2('0x27'),'value':_0x0da2('0x28'),'ignore':![]},{'name':'Telephones','value':'telephone','ignore':![]}];var _0x1c4ea4=_(_0x5e1596)[_0x0da2('0x29')](_0x0da2('0x2a'))[_0x0da2('0x2b')]('value')[_0x0da2('0x2c')]();if(_['includes'](_0x1c4ea4,_0x3c5460[_0x0da2('0x25')])){return;}var _0x5fccd=_[_0x0da2('0x2d')](_0x5e1596,[_0x0da2('0x2c'),_0x3c5460[_0x0da2('0x25')]])[_0x0da2('0x2e')];return db[_0x0da2('0x2f')]['destroy']({'where':{'type':_0x5fccd,'resourceId':_0x3c5460['id']}})[_0x0da2('0x13')](function(){return _0x1d17ad;});})[_0x0da2('0x13')](function(){_0x3a2625[_0x0da2('0x19')](0xcc)[_0x0da2('0x1a')]();});}};}function handleEntityNotFound(_0x2cfddc){return function(_0x1b3c60){if(!_0x1b3c60){_0x2cfddc['sendStatus'](0x194);}return _0x1b3c60;};}function handleError(_0x408b21,_0x390cb9){_0x390cb9=_0x390cb9||0x1f4;return function(_0x314ea2){logger[_0x0da2('0x16')](_0x314ea2['stack']);if(_0x314ea2['name']){delete _0x314ea2[_0x0da2('0x2e')];}_0x408b21[_0x0da2('0x19')](_0x390cb9)[_0x0da2('0x30')](_0x314ea2);};}exports[_0x0da2('0x31')]=function(_0x2eee02,_0x124dbc){var _0xe4bf41={},_0x306704={'count':0x0,'rows':[]};var _0x267333=_(db['User'][_0x0da2('0x32')])[_0x0da2('0x2b')](function(_0x3b7959){return{'name':_0x3b7959[_0x0da2('0x33')],'type':_0x3b7959[_0x0da2('0x34')][_0x0da2('0x35')]};})[_0x0da2('0x29')](function(_0x25817c){return!_['includes']([_0x0da2('0x36'),'salt'],_0x25817c['name']);})[_0x0da2('0x2c')]();_0xe4bf41=qs['getOptions'](_0x267333,_0x2eee02);var _0xfe1cd3={'where':_0xe4bf41[_0x0da2('0x37')]};return db[_0x0da2('0x38')][_0x0da2('0x1f')](_0xfe1cd3)['then'](function(_0x249735){_0x306704[_0x0da2('0x1f')]=_0x249735;if(_0x2eee02[_0x0da2('0x39')][_0x0da2('0x3a')]){_0xe4bf41[_0x0da2('0x3b')]=[{'all':!![]}];}if(!_[_0x0da2('0x3c')](_0xe4bf41[_0x0da2('0x3d')],'id')){_0xe4bf41[_0x0da2('0x3d')]['push']('id');}return db['User'][_0x0da2('0x3e')](_0xe4bf41);})['then'](function(_0x325732){_0x306704['rows']=_0x325732;if(_0x2eee02[_0x0da2('0x39')]['openTabs']==='true'){var _0x5693ca=[];for(var _0xa9ef0=0x0;_0xa9ef0<_0x306704[_0x0da2('0x3f')][_0x0da2('0x40')];_0xa9ef0++){_0x5693ca[_0x0da2('0x41')](get_open_tabs('chat',_0x306704[_0x0da2('0x3f')][_0xa9ef0]['dataValues']));_0x5693ca[_0x0da2('0x41')](get_open_tabs(_0x0da2('0x42'),_0x306704['rows'][_0xa9ef0][_0x0da2('0x43')]));_0x5693ca[_0x0da2('0x41')](get_open_tabs(_0x0da2('0x44'),_0x306704[_0x0da2('0x3f')][_0xa9ef0]['dataValues']));_0x5693ca[_0x0da2('0x41')](get_open_tabs(_0x0da2('0x45'),_0x306704['rows'][_0xa9ef0][_0x0da2('0x43')]));_0x5693ca[_0x0da2('0x41')](get_open_tabs(_0x0da2('0x46'),_0x306704[_0x0da2('0x3f')][_0xa9ef0]['dataValues']));_0x5693ca[_0x0da2('0x41')](get_open_tabs('whatsapp',_0x306704[_0x0da2('0x3f')][_0xa9ef0][_0x0da2('0x43')]));}return BPromise[_0x0da2('0x47')](_0x5693ca)[_0x0da2('0x13')](function(_0x2e36c6){return _0x306704;});}else{return _0x306704;}})['then'](respondWithFilteredResult(_0x124dbc,_0xe4bf41))[_0x0da2('0x48')](handleError(_0x124dbc,null));};exports[_0x0da2('0x49')]=function(_0x13236c,_0x464fed){var _0x47c2f5={'raw':![],'where':{'id':_0x13236c[_0x0da2('0x4a')]['id']}},_0x1d7bef={};_0x1d7bef[_0x0da2('0x4b')]=_[_0x0da2('0x4c')](_[_0x0da2('0x4d')](db['User'][_0x0da2('0x32')]),[_0x0da2('0x36'),_0x0da2('0x4e')]);_0x1d7bef[_0x0da2('0x39')]=_[_0x0da2('0x4d')](_0x13236c[_0x0da2('0x39')]);_0x1d7bef[_0x0da2('0x4f')]=_['intersection'](_0x1d7bef[_0x0da2('0x4b')],_0x1d7bef['query']);_0x47c2f5['attributes']=_['intersection'](_0x1d7bef[_0x0da2('0x4b')],qs[_0x0da2('0x50')](_0x13236c[_0x0da2('0x39')][_0x0da2('0x50')]));_0x47c2f5['attributes']=_0x47c2f5[_0x0da2('0x3d')]['length']?_0x47c2f5['attributes']:_0x1d7bef['model'];if(_0x13236c[_0x0da2('0x39')][_0x0da2('0x3a')]){_0x47c2f5[_0x0da2('0x3b')]=[{'all':!![]}];}_0x47c2f5=_[_0x0da2('0x51')]({},_0x47c2f5,_0x13236c['options']);if(!_[_0x0da2('0x3c')](_0x47c2f5[_0x0da2('0x3d')],'id')){_0x47c2f5[_0x0da2('0x3d')][_0x0da2('0x41')]('id');}return db[_0x0da2('0x38')][_0x0da2('0x2d')](_0x47c2f5)[_0x0da2('0x13')](handleEntityNotFound(_0x464fed,null))['then'](function(_0x328cb7){var _0x1fa268=[];values=_0x328cb7;if(_0x13236c[_0x0da2('0x39')][_0x0da2('0x52')]===_0x0da2('0x53')){_0x1fa268['push'](get_open_tabs('chat',_0x328cb7[_0x0da2('0x43')]));_0x1fa268[_0x0da2('0x41')](get_open_tabs('sms',_0x328cb7['dataValues']));_0x1fa268[_0x0da2('0x41')](get_open_tabs(_0x0da2('0x46'),_0x328cb7[_0x0da2('0x43')]));_0x1fa268[_0x0da2('0x41')](get_open_tabs(_0x0da2('0x54'),_0x328cb7[_0x0da2('0x43')]));_0x1fa268[_0x0da2('0x41')](get_open_tabs(_0x0da2('0x44'),_0x328cb7[_0x0da2('0x43')]));_0x1fa268[_0x0da2('0x41')](get_open_tabs(_0x0da2('0x45'),_0x328cb7[_0x0da2('0x43')]));return BPromise[_0x0da2('0x47')](_0x1fa268);}else{return values;}})[_0x0da2('0x13')](function(_0x489e36){return values;})[_0x0da2('0x13')](respondWithResult(_0x464fed,null))['catch'](handleError(_0x464fed,null));};exports['update']=function(_0x3a2295,_0x2b7eb1){if(_0x3a2295[_0x0da2('0x55')]['id']){delete _0x3a2295[_0x0da2('0x55')]['id'];}delete _0x3a2295[_0x0da2('0x55')][_0x0da2('0x25')];return db[_0x0da2('0x38')]['find']({'where':{'id':_0x3a2295['params']['id']}})[_0x0da2('0x13')](handleEntityNotFound(_0x2b7eb1,null))['then'](saveUpdates(_0x3a2295['body'],null))[_0x0da2('0x13')](respondWithResult(_0x2b7eb1,null))[_0x0da2('0x48')](handleError(_0x2b7eb1,null));};exports[_0x0da2('0x56')]=function(_0xed6587,_0x32d92f){return db[_0x0da2('0x38')]['describe']()[_0x0da2('0x13')](respondWithResult(_0x32d92f,null))[_0x0da2('0x48')](handleError(_0x32d92f,null));};exports[_0x0da2('0x57')]=function(_0x2a035c,_0x4d2cf9){return db[_0x0da2('0x38')][_0x0da2('0x2d')]({'where':{'id':_0x2a035c['params']['id']}})[_0x0da2('0x13')](handleEntityNotFound(_0x4d2cf9,null))['then'](function(_0x19db59){if(_0x19db59){return _0x19db59[_0x0da2('0x57')](_0x2a035c[_0x0da2('0x55')][_0x0da2('0x58')],_[_0x0da2('0x59')](_0x2a035c[_0x0da2('0x55')],['ids','id'])||{});}})['then'](respondWithResult(_0x4d2cf9,null))['catch'](handleError(_0x4d2cf9,null));};function validateUser(_0x187d03){return new BPromise(function(_0x3313b2,_0x1f8dd1){if(_0x187d03['internal'])return _0x3313b2(_0x187d03);return db['Setting'][_0x0da2('0x5a')](0x1)['then'](function(_0x3e4681){if(_0x3e4681[_0x0da2('0x5b')])authService[_0x0da2('0x5c')](_0x187d03[_0x0da2('0x36')]);db[_0x0da2('0x38')][_0x0da2('0x5d')](_0x0da2('0x5e'))[_0x0da2('0x13')](function(_0x5c3944){if(_['isNil'](_0x5c3944)){_0x187d03['internal']=_0x3e4681[_0x0da2('0x5f')]||0x1;return;}if(_[_0x0da2('0x60')](_0x3e4681[_0x0da2('0x5f')])||_0x3e4681[_0x0da2('0x5f')]===_0x5c3944){_0x187d03[_0x0da2('0x5e')]=_0x5c3944+0x1;return;}if(_0x3e4681[_0x0da2('0x5f')]>_0x5c3944){_0x187d03[_0x0da2('0x5e')]=_0x3e4681[_0x0da2('0x5f')];return;}return db[_0x0da2('0x61')][_0x0da2('0x39')](_0x0da2('0x62'),{'type':db[_0x0da2('0x61')][_0x0da2('0x63')][_0x0da2('0x64')]})[_0x0da2('0x13')](function(_0x486b2a){if(_0x486b2a&&_0x486b2a[_0x0da2('0x40')]){for(var _0x20e796=0x0,_0x52ee70=_0x486b2a[_0x0da2('0x40')];_0x20e796<_0x52ee70&&_[_0x0da2('0x60')](_0x187d03[_0x0da2('0x5e')]);_0x20e796++){if(_0x3e4681[_0x0da2('0x5f')]<=_0x486b2a[_0x20e796]['from']){_0x187d03['internal']=_0x486b2a[_0x20e796][_0x0da2('0x65')];}else if(_0x3e4681[_0x0da2('0x5f')]>_0x486b2a[_0x20e796][_0x0da2('0x65')]&&_0x3e4681[_0x0da2('0x5f')]<=_0x486b2a[_0x20e796]['to']){_0x187d03[_0x0da2('0x5e')]=_0x3e4681[_0x0da2('0x5f')];}}}if(_[_0x0da2('0x60')](_0x187d03['internal'])){_0x187d03[_0x0da2('0x5e')]=_0x5c3944+0x1;}return _0x3313b2(_0x187d03);});});})[_0x0da2('0x48')](function(_0x1806df){_0x1f8dd1(_0x1806df);});});}function updateUser(_0x12e6ae){return new BPromise(function(_0x19cfd0,_0x588e05){try{if(_0x12e6ae[_0x0da2('0x66')]){_0x12e6ae[_0x0da2('0x67')]=_0x12e6ae['internal'];_0x12e6ae[_0x0da2('0x68')]={'mailbox':_0x12e6ae[_0x0da2('0x5e')],'password':_0x12e6ae[_0x0da2('0x36')],'fullname':_0x12e6ae[_0x0da2('0x69')],'email':_0x12e6ae[_0x0da2('0x6a')]};}if(_0x12e6ae[_0x0da2('0x25')]===_0x0da2('0x28')){if(!_0x12e6ae[_0x0da2('0x6b')])_0x12e6ae[_0x0da2('0x6b')]=[_0x0da2('0x6c'),_0x0da2('0x6d'),_0x0da2('0x6e'),'113','110',_0x0da2('0x6f'),_0x0da2('0x70'),'106',_0x0da2('0x71'),_0x0da2('0x72'),_0x0da2('0x73'),_0x0da2('0x74'),_0x0da2('0x75'),_0x0da2('0x76'),_0x0da2('0x77')];}_0x19cfd0(_0x12e6ae);}catch(_0x3cc453){_0x588e05(_0x3cc453);}});}exports['create']=function(_0x26d05c,_0x381402){if(_0x26d05c[_0x0da2('0x78')][_0x0da2('0x25')]===_0x0da2('0x28'))throw new Error(_0x0da2('0x79'));if(_0x26d05c[_0x0da2('0x55')][_0x0da2('0x25')]===_0x0da2('0x78')&&_0x26d05c['user']['role']!==_0x0da2('0x26')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x26d05c['body'][_0x0da2('0x25')]===_0x0da2('0x26')&&_0x26d05c[_0x0da2('0x78')][_0x0da2('0x25')]!==_0x0da2('0x26')){throw new Error(_0x0da2('0x7a'));}return licenseUtil[_0x0da2('0x7b')]([_0x26d05c[_0x0da2('0x55')]])[_0x0da2('0x13')](function(){return validateUser(_0x26d05c['body']);})[_0x0da2('0x13')](function(_0x466258){return updateUser(_0x466258)[_0x0da2('0x13')](function(_0x47fedb){if(_0x47fedb[_0x0da2('0x25')]===_0x0da2('0x26')){_0x47fedb[_0x0da2('0x7c')]=_0x26d05c[_0x0da2('0x78')][_0x0da2('0x7c')];delete _0x47fedb[_0x0da2('0x7d')];}return _0x47fedb;});})[_0x0da2('0x13')](function(_0x41c1fb){return db[_0x0da2('0x38')][_0x0da2('0x7e')](_0x41c1fb,{'include':[{'model':db[_0x0da2('0x68')],'as':'VoiceMail'}]});})[_0x0da2('0x13')](function(_0x295aac){if(_0x26d05c['body'][_0x0da2('0x25')]==='user')return _0x295aac;if(_0x26d05c[_0x0da2('0x78')][_0x0da2('0x25')]!==_0x0da2('0x78'))return _0x295aac;return db[_0x0da2('0x7f')][_0x0da2('0x2d')]({'where':{'name':_0x295aac[_0x0da2('0x25')]===_0x0da2('0x28')?'Agents':_0x0da2('0x80'),'userProfileId':_0x26d05c[_0x0da2('0x78')]['userProfileId']},'raw':!![]})[_0x0da2('0x13')](function(_0x36432f){if(!_0x36432f||_0x36432f[_0x0da2('0x81')]!=0x0)return _0x295aac;return db['UserProfileResource'][_0x0da2('0x7e')]({'name':_0x295aac[_0x0da2('0x2e')],'resourceId':_0x295aac['id'],'type':_0x36432f[_0x0da2('0x2e')],'sectionId':_0x36432f['id']},{})['then'](function(){return _0x295aac;});})[_0x0da2('0x48')](function(_0xdf4b71){logger[_0x0da2('0x16')](_0x0da2('0x82'),_0xdf4b71);throw _0xdf4b71;});})[_0x0da2('0x13')](respondWithResult(_0x381402,0xc9))[_0x0da2('0x48')](handleError(_0x381402,null));};exports[_0x0da2('0x83')]=function(_0x90eee8,_0xc2d651){var _0x35ffcd=_0x90eee8[_0x0da2('0x55')];var _0x70da18=[];if(_0x90eee8[_0x0da2('0x78')][_0x0da2('0x25')]===_0x0da2('0x28'))throw new Error(_0x0da2('0x79'));if(_['some'](_0x35ffcd,[_0x0da2('0x25'),_0x0da2('0x78')])&&_0x90eee8[_0x0da2('0x78')][_0x0da2('0x25')]!==_0x0da2('0x26')){throw new Error(_0x0da2('0x84'));}if(_[_0x0da2('0x85')](_0x35ffcd,[_0x0da2('0x25'),_0x0da2('0x26')])&&_0x90eee8['user'][_0x0da2('0x25')]!==_0x0da2('0x26')){throw new Error(_0x0da2('0x86'));}return licenseUtil[_0x0da2('0x7b')](_0x35ffcd)['then'](function(){return validateUser(_0x35ffcd[0x0]);})['then'](function(){for(var _0x2dd621=0x1;_0x2dd621<_0x35ffcd[_0x0da2('0x40')];_0x2dd621++){var _0x3b3d66=_0x35ffcd[_0x2dd621-0x1][_0x0da2('0x5e')];if(!_0x35ffcd[_0x2dd621]['internal'])_0x35ffcd[_0x2dd621][_0x0da2('0x5e')]=_0x3b3d66+0x1;_0x70da18[_0x0da2('0x41')](validateUser(_0x35ffcd[_0x2dd621]));}return BPromise[_0x0da2('0x47')](_0x70da18);})[_0x0da2('0x13')](function(){_0x70da18=[];for(var _0x45ac81=0x0;_0x45ac81<_0x35ffcd['length'];_0x45ac81++){_0x70da18[_0x0da2('0x41')](updateUser(_0x35ffcd[_0x45ac81]));}return BPromise['all'](_0x70da18);})[_0x0da2('0x13')](function(){return BPromise[_0x0da2('0x87')](_0x35ffcd,function(_0x48f397){return db[_0x0da2('0x38')]['create'](_0x48f397,{'include':[{'model':db['VoiceMail'],'as':_0x0da2('0x68')}]})[_0x0da2('0x13')](function(_0x9000eb){_0x48f397['id']=_0x9000eb['id'];return _0x48f397;});});})['then'](function(_0x3ace5f){if(_0x90eee8[_0x0da2('0x55')]['role']===_0x0da2('0x78'))return _0x3ace5f;if(_0x90eee8[_0x0da2('0x78')][_0x0da2('0x25')]!==_0x0da2('0x78'))return _0x3ace5f;var _0x45bafd=_[_0x0da2('0x85')](_0x3ace5f,function(_0x51dff0){return _0x51dff0[_0x0da2('0x25')]===_0x0da2('0x28')||_0x51dff0[_0x0da2('0x25')]===_0x0da2('0x88');});if(!_0x45bafd)return _0x3ace5f;return db['UserProfileSection'][_0x0da2('0x3e')]({'where':{'name':{'$or':['Agents','Telephones']},'userProfileId':_0x90eee8['user'][_0x0da2('0x7d')]},'raw':!![]})[_0x0da2('0x13')](function(_0x25ead7){if(_[_0x0da2('0x89')](_0x25ead7)||!_[_0x0da2('0x85')](_0x25ead7,['autoAssociation',0x0]))return _0x3ace5f;_0x70da18=[];var _0x156d5d=_(_0x25ead7)[_0x0da2('0x2b')](function(_0x5801b8){if(_0x5801b8[_0x0da2('0x81')]===0x1)return;return _0x5801b8[_0x0da2('0x2e')]===_0x0da2('0x27')?_0x0da2('0x28'):_0x0da2('0x88');})['compact']()[_0x0da2('0x2c')]();for(var _0x5a3a3e=0x0;_0x5a3a3e<_0x3ace5f[_0x0da2('0x40')];_0x5a3a3e++){if(!_[_0x0da2('0x3c')](_0x156d5d,_0x3ace5f[_0x5a3a3e][_0x0da2('0x25')]))return;var _0x4c03b7=_0x3ace5f[_0x5a3a3e]['role']===_0x0da2('0x28')?'Agents':_0x0da2('0x80');_0x70da18[_0x0da2('0x41')](db['UserProfileResource']['create']({'name':_0x3ace5f[_0x5a3a3e][_0x0da2('0x2e')],'resourceId':_0x3ace5f[_0x5a3a3e]['id'],'type':_0x4c03b7,'sectionId':_[_0x0da2('0x2d')](_0x25ead7,[_0x0da2('0x2e'),_0x4c03b7])['id']},{}));}return BPromise[_0x0da2('0x47')](_0x70da18);});})[_0x0da2('0x13')](respondWithResult(_0xc2d651,0xc9))[_0x0da2('0x48')](handleError(_0xc2d651,null));};exports['changePassword']=function(_0x11151f,_0xf1b6eb){if(_0x11151f[_0x0da2('0x55')]['id']){delete _0x11151f[_0x0da2('0x55')]['id'];}return db[_0x0da2('0x38')][_0x0da2('0x2d')]({'where':{'id':_0x11151f[_0x0da2('0x4a')]['id']}})[_0x0da2('0x13')](function(_0xabb845){if(!_0xabb845)return null;if(_0xabb845['id']===_0x11151f['user']['id']){if(!_0x11151f[_0x0da2('0x55')][_0x0da2('0x8a')]||!_0x11151f[_0x0da2('0x55')][_0x0da2('0x8b')]){throw new db['Sequelize'][(_0x0da2('0x8c'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0xabb845[_0x0da2('0x8d')](_0x11151f['body'][_0x0da2('0x8a')])){throw new db[(_0x0da2('0x8e'))][(_0x0da2('0x8c'))](_0x0da2('0x8f'));}if(_0x11151f[_0x0da2('0x55')][_0x0da2('0x8a')]===_0x11151f[_0x0da2('0x55')][_0x0da2('0x8b')]){throw new db[(_0x0da2('0x8e'))][(_0x0da2('0x8c'))](_0x0da2('0x90'));}}else if(_0x11151f[_0x0da2('0x78')][_0x0da2('0x25')]===_0x0da2('0x26')){if(!_0x11151f['body']['newPassword']){throw new db[(_0x0da2('0x8e'))][(_0x0da2('0x8c'))](_0x0da2('0x91'));}}else if(_0x11151f[_0x0da2('0x78')][_0x0da2('0x25')]===_0x0da2('0x78')){if(!_0x11151f['body'][_0x0da2('0x8b')]){throw new db[(_0x0da2('0x8e'))][(_0x0da2('0x8c'))](_0x0da2('0x91'));}if(_0xabb845[_0x0da2('0x25')]!=='agent'){throw new db['Sequelize'][(_0x0da2('0x8c'))](_0x0da2('0x79'));}}else{throw new db['Sequelize'][(_0x0da2('0x8c'))](_0x0da2('0x79'));}return _0xabb845;})[_0x0da2('0x13')](handleEntityNotFound(_0xf1b6eb,null))[_0x0da2('0x13')](function(_0x332b10){return db[_0x0da2('0x92')][_0x0da2('0x93')]({'attributes':['id',_0x0da2('0x5b'),_0x0da2('0x94'),_0x0da2('0x95')]})[_0x0da2('0x13')](function(_0x48f667){if(_0x48f667[_0x0da2('0x5b')])authService[_0x0da2('0x5c')](_0x11151f[_0x0da2('0x55')][_0x0da2('0x8b')]);if(!_0x48f667[_0x0da2('0x94')]||!_0x332b10[_0x0da2('0x96')])return _0x332b10;authService[_0x0da2('0x97')](_0x11151f[_0x0da2('0x55')][_0x0da2('0x8b')],_0x332b10[_0x0da2('0x96')],_0x48f667[_0x0da2('0x95')]);return _0x332b10;})['then'](saveUpdates({'password':_0x11151f[_0x0da2('0x55')]['newPassword'],'passwordResetAt':_0x11151f[_0x0da2('0x78')]['id']==_0x11151f[_0x0da2('0x4a')]['id']?moment():null,'previousPasswords':authService[_0x0da2('0x98')](_0x11151f['body'][_0x0da2('0x8b')],_0x332b10[_0x0da2('0x96')])},null));})['then'](respondWithResult(_0xf1b6eb,null))['catch'](handleError(_0xf1b6eb,null));};exports[_0x0da2('0x99')]=function(_0x17c0bd,_0x308738){var _0x26d7b3=_0x17c0bd[_0x0da2('0x55')][_0x0da2('0x9a')];return db[_0x0da2('0x38')]['find']({'where':{'id':_0x17c0bd['params']['id']},'attributes':['id',_0x0da2('0x2e'),'role',_0x0da2('0x9b'),_0x0da2('0x9c'),_0x0da2('0x9d'),'interface']})['then'](handleEntityNotFound(_0x308738,null))[_0x0da2('0x13')](function(_0x79b8df){if(_0x79b8df){if(!utils[_0x0da2('0x9e')](_0x26d7b3)){throw new db['Sequelize'][(_0x0da2('0x8c'))](_0x0da2('0x9f'));}return _0x79b8df[_0x0da2('0xa0')+_['capitalize'](_0x26d7b3[_0x0da2('0xa1')]())+_0x0da2('0xa2')](_0x17c0bd[_0x0da2('0x55')]['ids'],{'penalty':_0x17c0bd[_0x0da2('0x55')][_0x0da2('0xa3')]||0x0})[_0x0da2('0xa4')](function(_0x4c1616){for(var _0x167495=0x0;_0x167495<_0x17c0bd[_0x0da2('0x55')]['ids'][_0x0da2('0x40')];_0x167495+=0x1){var _0x62a53b={'UserId':Number(_0x17c0bd[_0x0da2('0x4a')]['id'])};_0x62a53b[_[_0x0da2('0xa5')](_0x26d7b3[_0x0da2('0xa1')]())+_0x0da2('0xa6')]=Number(_0x17c0bd['body'][_0x0da2('0x58')][_0x167495]);socket[_0x0da2('0xa7')]('user'+_['capitalize'](_0x26d7b3[_0x0da2('0xa1')]())+_0x0da2('0xa8'),_0x62a53b);}return _0x4c1616;})['then'](function(){if(_0x26d7b3===_0x0da2('0xa9')){return db['VoiceQueue'][_0x0da2('0x3e')]({'where':{'id':_0x17c0bd[_0x0da2('0x55')]['ids']||[]},'raw':!![],'attributes':['id','name']});}})[_0x0da2('0x13')](function(_0x11d0ca){var _0x261c47=_0x79b8df[_0x0da2('0x24')]({'plain':!![]});var _0x1f1509=[];if(_0x26d7b3===_0x0da2('0xa9')&&_0x261c47[_0x0da2('0x25')]===_0x0da2('0x28')&&_0x261c47['online']){for(var _0x18a167=0x0;_0x18a167<_0x11d0ca['length'];_0x18a167+=0x1){_0x1f1509[_0x0da2('0x41')]({'membername':_0x261c47[_0x0da2('0x2e')],'UserId':_0x261c47['id'],'queue_name':_0x11d0ca[_0x18a167][_0x0da2('0x2e')],'VoiceQueueId':_0x11d0ca[_0x18a167]['id'],'interface':_['isNil'](_0x261c47[_0x0da2('0xaa')])?util[_0x0da2('0xab')](_0x0da2('0xac'),_0x261c47['name']):_0x261c47[_0x0da2('0xaa')],'paused':_0x261c47[_0x0da2('0x9d')]||![],'penalty':_0x17c0bd['body'][_0x0da2('0xa3')]||0x0});}return BPromise['each'](_0x1f1509,function(_0x1ab9c2){return db[_0x0da2('0xad')]['upsert'](_0x1ab9c2);});}return _0x79b8df;});}})['then'](respondWithStatusCode(_0x308738,null))['catch'](handleError(_0x308738,null));};exports[_0x0da2('0xae')]=function(_0x2b4e26,_0x1cee2f){var _0x343329;return db[_0x0da2('0x38')][_0x0da2('0x2d')]({'where':{'id':_0x2b4e26[_0x0da2('0x4a')]['id']},'attributes':['id',_0x0da2('0x2e'),'role']})[_0x0da2('0x13')](handleEntityNotFound(_0x1cee2f,null))['then'](function(_0xbd16c5){if(_0xbd16c5){_0x343329=_0xbd16c5;if(!_0x2b4e26[_0x0da2('0x39')][_0x0da2('0x9a')]||!utils[_0x0da2('0x9e')](_0x2b4e26[_0x0da2('0x39')][_0x0da2('0x9a')])){throw new db['Sequelize'][(_0x0da2('0x8c'))](_0x0da2('0x9f'));}return _0xbd16c5[_0x0da2('0xaf')+_['capitalize'](_0x2b4e26[_0x0da2('0x39')][_0x0da2('0x9a')]['toLowerCase']())+_0x0da2('0xa2')](_0x2b4e26[_0x0da2('0x39')][_0x0da2('0x58')]);}})['then'](function(_0x5069f1){if(_[_0x0da2('0xb0')](_0x2b4e26[_0x0da2('0x39')][_0x0da2('0x58')])){for(var _0xb49063=0x0;_0xb49063<_0x2b4e26[_0x0da2('0x39')][_0x0da2('0x58')][_0x0da2('0x40')];_0xb49063+=0x1){var _0x26bd5d={'UserId':Number(_0x2b4e26[_0x0da2('0x4a')]['id'])};_0x26bd5d[_[_0x0da2('0xa5')](_0x2b4e26[_0x0da2('0x39')]['channel'][_0x0da2('0xa1')]())+'QueueId']=Number(_0x2b4e26[_0x0da2('0x39')]['ids'][_0xb49063]);socket[_0x0da2('0xa7')]('user'+_['capitalize'](_0x2b4e26[_0x0da2('0x39')][_0x0da2('0x9a')][_0x0da2('0xa1')]())+_0x0da2('0xb1'),_0x26bd5d);}}else{var _0x26bd5d={'UserId':Number(_0x2b4e26[_0x0da2('0x4a')]['id'])};_0x26bd5d[_['capitalize'](_0x2b4e26['query'][_0x0da2('0x9a')]['toLowerCase']())+_0x0da2('0xa6')]=Number(_0x2b4e26['query']['ids']);socket[_0x0da2('0xa7')](_0x0da2('0x78')+_[_0x0da2('0xa5')](_0x2b4e26[_0x0da2('0x39')][_0x0da2('0x9a')][_0x0da2('0xa1')]())+'Queue:remove',_0x26bd5d);}return _0x5069f1;})['then'](function(){if(_0x2b4e26[_0x0da2('0x39')][_0x0da2('0x9a')]===_0x0da2('0xa9')){return db[_0x0da2('0xad')][_0x0da2('0x23')]({'where':{'UserId':_0x2b4e26['params']['id'],'VoiceQueueId':_0x2b4e26['query'][_0x0da2('0x58')]},'individualHooks':!![]})['then'](function(){return _0x343329;});}return _0x343329;})[_0x0da2('0x13')](respondWithStatusCode(_0x1cee2f,null))[_0x0da2('0x48')](handleError(_0x1cee2f,null));};exports[_0x0da2('0xb2')]=function(_0x24e4ca,_0x10eef2){_0x24e4ca[_0x0da2('0x55')]['userpic']=_0x24e4ca['file'][_0x0da2('0xb3')];return db[_0x0da2('0x38')]['find']({'where':{'id':_0x24e4ca[_0x0da2('0x4a')]['id']}})['then'](handleEntityNotFound(_0x10eef2,null))[_0x0da2('0x13')](saveUpdates(_0x24e4ca[_0x0da2('0x55')],null))['then'](respondWithResult(_0x10eef2,null))['catch'](handleError(_0x10eef2,null));};exports[_0x0da2('0xb4')]=function(_0xa6a1bb,_0x3f791e){var _0x4804a5=path[_0x0da2('0xb5')](config[_0x0da2('0xb6')],'server/files/images/logos/default_profile.png');return db[_0x0da2('0x38')][_0x0da2('0x2d')]({'where':{'id':_0xa6a1bb['params']['id']},'attributes':['id',_0x0da2('0xb7')],'raw':!![]})['then'](handleEntityNotFound(_0x3f791e,null))['then'](function(_0x34c9cf){if(_0x34c9cf){if(_['isNil'](_0x34c9cf[_0x0da2('0xb7')])){return _0x3f791e[_0x0da2('0xb8')](_0x4804a5);}else{if(!fs['existsSync'](path[_0x0da2('0xb5')](config[_0x0da2('0xb6')],'server/files/images/',_0x34c9cf[_0x0da2('0xb7')]))){return _0x3f791e[_0x0da2('0xb8')](_0x4804a5);}return _0x3f791e[_0x0da2('0xb8')](path[_0x0da2('0xb5')](config[_0x0da2('0xb6')],_0x0da2('0xb9'),_0x34c9cf['userpic']));}}})[_0x0da2('0x48')](handleError(_0x3f791e,null));};exports['getOpenTabs']=function(_0x4e4758,_0x27c5d8){return db[_0x0da2('0x38')][_0x0da2('0x2d')]({'where':{'id':_0x4e4758[_0x0da2('0x4a')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x27c5d8,null))[_0x0da2('0x13')](function(_0x48c116){var _0x4f6c20=[];values=_0x48c116[_0x0da2('0x43')];_0x4f6c20['push'](get_open_tabs('chat',_0x48c116[_0x0da2('0x43')]));_0x4f6c20[_0x0da2('0x41')](get_open_tabs(_0x0da2('0x42'),_0x48c116[_0x0da2('0x43')]));_0x4f6c20[_0x0da2('0x41')](get_open_tabs(_0x0da2('0x46'),_0x48c116[_0x0da2('0x43')]));_0x4f6c20[_0x0da2('0x41')](get_open_tabs(_0x0da2('0x54'),_0x48c116[_0x0da2('0x43')]));_0x4f6c20[_0x0da2('0x41')](get_open_tabs(_0x0da2('0x44'),_0x48c116['dataValues']));_0x4f6c20[_0x0da2('0x41')](get_open_tabs(_0x0da2('0x45'),_0x48c116[_0x0da2('0x43')]));return BPromise[_0x0da2('0x47')](_0x4f6c20);})[_0x0da2('0x13')](function(_0x3e1cdd){var _0x1eba2b=[];if(_0x3e1cdd){for(var _0x397a46=0x0;_0x397a46=_0x4dce47[_0x1947('0x55')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x1947('0x12')](function(){if(_0x4c7a5e){return db['UserVoiceQueueRt'][_0x1947('0x4f')]({'where':{'membername':_0x4c7a5e['name']},'individualHooks':!![]});}})['then'](function(){if(_0x4c7a5e){return _0x4c7a5e[_0x1947('0x56')]({'raw':!![]});}})[_0x1947('0x12')](function(_0x137506){if(_0x4c7a5e){if(_0x137506){var _0x41eef3=[];_0x1f7d29=_0x137506;if(_0x1f7d29['length']){for(var _0x8e77d4=0x0;_0x8e77d4<_0x1f7d29[_0x1947('0x32')];_0x8e77d4++){_0x41eef3[_0x1947('0x37')](db[_0x1947('0x2d')][_0x1947('0x57')]({'membername':_0x4c7a5e[_0x1947('0x30')],'UserId':_0x4c7a5e['id'],'queue_name':_0x1f7d29[_0x8e77d4][_0x1947('0x30')],'VoiceQueueId':_0x1f7d29[_0x8e77d4]['id'],'interface':_0x1e225f,'paused':_0x4c7a5e[_0x1947('0x52')]||![],'penalty':_0x1f7d29[_0x8e77d4][_0x1947('0x58')]||0x0}));}return BPromise[_0x1947('0x4c')](_0x41eef3);}}}})[_0x1947('0x12')](function(){if(_0x4c7a5e){return db['MemberReport'][_0x1947('0x1f')]({'where':{'membername':_0x4c7a5e[_0x1947('0x30')],'exitAt':null}});}})[_0x1947('0x12')](function(_0x37d0a4){if(_0x4c7a5e){if(_0x37d0a4&&_0x37d0a4[_0x1947('0x32')]){var _0x46da1a=[];_0x37d0a4['forEach'](function(_0x185c7a){_0x46da1a[_0x1947('0x37')](_0x185c7a['update']({'exitAt':moment()[_0x1947('0x33')](_0x1947('0x3a'))}));});return BPromise[_0x1947('0x4c')](_0x46da1a);}}})[_0x1947('0x12')](function(_0x22954e){if(_0x4c7a5e){var _0x21087b=[];var _0x2ebf10=[];var _0xd1a839=utils[_0x1947('0x35')]();var _0x2b697c={'membername':_0x4c7a5e[_0x1947('0x30')],'interface':_0x1e225f,'enterAt':moment()[_0x1947('0x33')](_0x1947('0x3a')),'role':_0x4c7a5e['role'],'internal':_0x4c7a5e[_0x1947('0x2b')]};_0xd1a839[_0x1947('0x36')](function(_0x24b704){_0x21087b['push'](_[_0x1947('0x59')]({'channel':_0x24b704,'type':_0x1947('0x5a'),'data1':_0x1947('0x5b'),'data2':_0x1e225f},_0x2b697c));if(_0x4c7a5e[_0x1947('0x52')]){_0x2ebf10[_0x1947('0x37')](_['merge']({'channel':_0x24b704,'type':_0x1947('0x31'),'data1':_0x1947('0x5c')},_0x2b697c));}});return db['MemberReport'][_0x1947('0x40')](_0x21087b['concat'](_0x2ebf10),{'individualHooks':!![]});}})[_0x1947('0x12')](function(){if(_0x4c7a5e){return _0x4c7a5e[_0x1947('0x2e')]({'online':!![],'lastLoginAt':moment()[_0x1947('0x33')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x4c7a5e[_0x1947('0x52')]||![],'mailPause':_0x4c7a5e[_0x1947('0x52')]||![],'chatPause':_0x4c7a5e['loginInPause']||![],'faxPause':_0x4c7a5e[_0x1947('0x52')]||![],'smsPause':_0x4c7a5e['loginInPause']||![],'openchannelPause':_0x4c7a5e[_0x1947('0x52')]||![],'pauseType':_0x4c7a5e['loginInPause']?_0x1947('0x5c'):null,'lastPauseAt':moment()[_0x1947('0x33')](_0x1947('0x3a')),'interface':_0x1e225f});}})['then'](function(_0x26b9cd){_0x34b9b9(_0x26b9cd);})[_0x1947('0x1c')](function(_0x4a6b24){_0x14aad0(_0x5e42ae[_0x1947('0x17')](0x1f4,_0x4a6b24[_0x1947('0x1a')]));});});}; \ No newline at end of file +var _0xdac7=['map','model','User','find','where','ShowUser','PauseUser','name','role','internal','UserVoiceQueueRt','update','MemberReport','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','push','interface','SIP/%s','PAUSE','body','type','uniqueid','UnpauseUser','findOne','channel','isValidChannel','Unknown\x20channel','voice','mail','chat','fax','sms','system','set','%s%s','Pause','all','LogoutUser','destroy','LoginUser','mobile','phone','agent','../../config/license/util','getLicense','getVoiceQueues','loginInPause','UserVoiceQueue.penalty','LOGIN','callysquare','merge','LOGININPAUSE','bulkCreate','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','register','then','info','User,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','catch','GetUser','findAll','options','raw','attributes','limit','include'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xdac7,0x93));var _0x7dac=function(_0x20c3d0,_0x594474){_0x20c3d0=_0x20c3d0-0x0;var _0x38573d=_0xdac7[_0x20c3d0];return _0x38573d;};'use strict';var _=require(_0x7dac('0x0'));var util=require(_0x7dac('0x1'));var moment=require(_0x7dac('0x2'));var BPromise=require(_0x7dac('0x3'));var rs=require(_0x7dac('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7dac('0x5'))['db'];var utils=require(_0x7dac('0x6'));var logger=require(_0x7dac('0x7'))(_0x7dac('0x8'));var config=require(_0x7dac('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7dac('0xa')]({'port':0x232a});config[_0x7dac('0xb')]=_[_0x7dac('0xc')](config[_0x7dac('0xb')],{'host':_0x7dac('0xd'),'port':0x18eb});var socket=require(_0x7dac('0xe'))(new Redis(config[_0x7dac('0xb')]));require('./user.socket')[_0x7dac('0xf')](socket);function respondWithRpcPromise(_0x41f3ac,_0x47641a,_0x35903a){return new BPromise(function(_0x35df42,_0x2872d1){return client['request'](_0x41f3ac,_0x35903a)[_0x7dac('0x10')](function(_0x5f2cf4){logger[_0x7dac('0x11')](_0x7dac('0x12'),_0x47641a,_0x7dac('0x13'));logger[_0x7dac('0x14')]('User,\x20%s,\x20%s,\x20%s',_0x47641a,_0x7dac('0x13'),JSON[_0x7dac('0x15')](_0x5f2cf4));if(_0x5f2cf4['error']){if(_0x5f2cf4['error'][_0x7dac('0x16')]===0x1f4){logger[_0x7dac('0x17')](_0x7dac('0x12'),_0x47641a,_0x5f2cf4[_0x7dac('0x17')][_0x7dac('0x18')]);return _0x2872d1(_0x5f2cf4[_0x7dac('0x17')]['message']);}logger[_0x7dac('0x17')](_0x7dac('0x12'),_0x47641a,_0x5f2cf4[_0x7dac('0x17')][_0x7dac('0x18')]);return _0x35df42(_0x5f2cf4[_0x7dac('0x17')][_0x7dac('0x18')]);}else{logger['info'](_0x7dac('0x12'),_0x47641a,_0x7dac('0x13'));_0x35df42(_0x5f2cf4['result'][_0x7dac('0x18')]);}})[_0x7dac('0x19')](function(_0x2d7287){logger[_0x7dac('0x17')](_0x7dac('0x12'),_0x47641a,_0x2d7287);_0x2872d1(_0x2d7287);});});}exports[_0x7dac('0x1a')]=function(_0x558908){var _0x33e231=this;return new Promise(function(_0x13d4c6,_0x141c93){return db['User'][_0x7dac('0x1b')]({'raw':_0x558908[_0x7dac('0x1c')]?_0x558908[_0x7dac('0x1c')][_0x7dac('0x1d')]===undefined?!![]:![]:!![],'where':_0x558908[_0x7dac('0x1c')]?_0x558908[_0x7dac('0x1c')]['where']||null:null,'attributes':_0x558908[_0x7dac('0x1c')]?_0x558908[_0x7dac('0x1c')][_0x7dac('0x1e')]||null:null,'limit':_0x558908['options']?_0x558908['options'][_0x7dac('0x1f')]||null:null,'include':_0x558908[_0x7dac('0x1c')]?_0x558908[_0x7dac('0x1c')][_0x7dac('0x20')]?_[_0x7dac('0x21')](_0x558908[_0x7dac('0x1c')]['include'],function(_0x139c66){return{'model':db[_0x139c66[_0x7dac('0x22')]],'as':_0x139c66['as'],'attributes':_0x139c66[_0x7dac('0x1e')],'include':_0x139c66[_0x7dac('0x20')]?_[_0x7dac('0x21')](_0x139c66['include'],function(_0x2c1383){return{'model':db[_0x2c1383[_0x7dac('0x22')]],'as':_0x2c1383['as'],'attributes':_0x2c1383[_0x7dac('0x1e')],'include':_0x2c1383[_0x7dac('0x20')]?_[_0x7dac('0x21')](_0x2c1383[_0x7dac('0x20')],function(_0x3dc411){return{'model':db[_0x3dc411[_0x7dac('0x22')]],'as':_0x3dc411['as'],'attributes':_0x3dc411[_0x7dac('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7dac('0x10')](function(_0x737048){logger[_0x7dac('0x11')](_0x7dac('0x1a'),_0x558908);logger[_0x7dac('0x14')](_0x7dac('0x1a'),_0x558908,JSON['stringify'](_0x737048));_0x13d4c6(_0x737048);})[_0x7dac('0x19')](function(_0x272c9c){logger[_0x7dac('0x17')](_0x7dac('0x1a'),_0x272c9c['message'],_0x558908);_0x141c93(_0x33e231[_0x7dac('0x17')](0x1f4,_0x272c9c[_0x7dac('0x18')]));});});};exports['ShowUser']=function(_0x46e290){var _0x32f2db=this;return new Promise(function(_0x2c18db,_0x289dd3){return db[_0x7dac('0x23')][_0x7dac('0x24')]({'raw':_0x46e290[_0x7dac('0x1c')]?_0x46e290[_0x7dac('0x1c')][_0x7dac('0x1d')]===undefined?!![]:![]:!![],'where':_0x46e290[_0x7dac('0x1c')]?_0x46e290['options'][_0x7dac('0x25')]||null:null,'attributes':_0x46e290['options']?_0x46e290[_0x7dac('0x1c')][_0x7dac('0x1e')]||null:null,'include':_0x46e290['options']?_0x46e290[_0x7dac('0x1c')][_0x7dac('0x20')]?_[_0x7dac('0x21')](_0x46e290['options'][_0x7dac('0x20')],function(_0x5e0de7){return{'model':db[_0x5e0de7[_0x7dac('0x22')]],'as':_0x5e0de7['as'],'attributes':_0x5e0de7[_0x7dac('0x1e')],'include':_0x5e0de7['include']?_[_0x7dac('0x21')](_0x5e0de7[_0x7dac('0x20')],function(_0x2f79e5){return{'model':db[_0x2f79e5['model']],'as':_0x2f79e5['as'],'attributes':_0x2f79e5['attributes'],'include':_0x2f79e5[_0x7dac('0x20')]?_[_0x7dac('0x21')](_0x2f79e5[_0x7dac('0x20')],function(_0x50bb39){return{'model':db[_0x50bb39[_0x7dac('0x22')]],'as':_0x50bb39['as'],'attributes':_0x50bb39['attributes']};}):[]};}):[]};}):[]:[]})[_0x7dac('0x10')](function(_0x4e8d19){logger[_0x7dac('0x11')](_0x7dac('0x26'),_0x46e290);logger['debug'](_0x7dac('0x26'),_0x46e290,JSON[_0x7dac('0x15')](_0x4e8d19));_0x2c18db(_0x4e8d19);})[_0x7dac('0x19')](function(_0x795ff5){logger[_0x7dac('0x17')]('ShowUser',_0x795ff5[_0x7dac('0x18')],_0x46e290);_0x289dd3(_0x32f2db[_0x7dac('0x17')](0x1f4,_0x795ff5[_0x7dac('0x18')]));});});};exports[_0x7dac('0x27')]=function(_0x4c4c90){var _0x1a4005=this;return new Promise(function(_0x91dd5a,_0x1e8506){var _0x54be1a;return db[_0x7dac('0x23')][_0x7dac('0x24')]({'where':_0x4c4c90[_0x7dac('0x1c')][_0x7dac('0x25')]||{},'attributes':['id',_0x7dac('0x28'),_0x7dac('0x29'),_0x7dac('0x2a'),'interface']})['then'](function(_0x3b6a18){if(_0x3b6a18){_0x54be1a=_0x3b6a18;return db[_0x7dac('0x2b')][_0x7dac('0x2c')]({'paused':0x1},{'where':{'UserId':_0x54be1a['id']},'individualHooks':!![]});}})[_0x7dac('0x10')](function(){if(_0x54be1a){return db[_0x7dac('0x2d')][_0x7dac('0x1b')]({'where':{'membername':_0x54be1a['name'],'type':'PAUSE','exitAt':null}});}})[_0x7dac('0x10')](function(_0x5d2f04){if(_0x54be1a){if(_0x5d2f04&&_0x5d2f04[_0x7dac('0x2e')]){var _0x194ff7=moment()[_0x7dac('0x2f')](_0x7dac('0x30'));for(var _0x2a7a87=0x0,_0x102d99=_0x5d2f04['length'];_0x2a7a87<_0x102d99;_0x2a7a87++){_0x5d2f04[_0x2a7a87][_0x7dac('0x31')]({'exitAt':_0x194ff7});}}}})[_0x7dac('0x10')](function(){if(_0x54be1a){var _0x2709fd=[];var _0x27775c=utils[_0x7dac('0x32')]();_0x27775c[_0x7dac('0x33')](function(_0x136233){_0x2709fd[_0x7dac('0x34')]({'channel':_0x136233,'membername':_0x54be1a[_0x7dac('0x28')],'interface':_['isNil'](_0x54be1a[_0x7dac('0x35')])?util[_0x7dac('0x2f')](_0x7dac('0x36'),_0x54be1a['name']):_0x54be1a[_0x7dac('0x35')],'type':_0x7dac('0x37'),'enterAt':moment()[_0x7dac('0x2f')](_0x7dac('0x30')),'data1':_0x4c4c90[_0x7dac('0x38')][_0x7dac('0x39')]||'DEFAULT\x20PAUSE','role':_0x54be1a[_0x7dac('0x29')],'internal':_0x54be1a[_0x7dac('0x2a')],'uniqueid':_0x4c4c90[_0x7dac('0x38')][_0x7dac('0x3a')]||null});});return db['MemberReport']['bulkCreate'](_0x2709fd,{'individualHooks':!![]});}})['then'](function(){if(_0x54be1a){return _0x54be1a[_0x7dac('0x2c')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x4c4c90['body'][_0x7dac('0x39')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x7dac('0x2f')](_0x7dac('0x30'))});}})[_0x7dac('0x10')](function(_0x3123bf){_0x91dd5a(_0x3123bf);})[_0x7dac('0x19')](function(_0x53c932){_0x1e8506(_0x1a4005[_0x7dac('0x17')](0x1f4,_0x53c932[_0x7dac('0x18')]));});});};exports[_0x7dac('0x3b')]=function(_0x17cf1b){var _0x29448a=this;return new Promise(function(_0x3617c6,_0x5aec6e){var _0x4aea61;return db[_0x7dac('0x23')][_0x7dac('0x3c')]({'where':_0x17cf1b[_0x7dac('0x1c')][_0x7dac('0x25')]||{},'attributes':['id',_0x7dac('0x28')]})['then'](function(_0x4b9c94){if(_0x4b9c94){_0x4aea61=_0x4b9c94;if(_0x17cf1b[_0x7dac('0x38')][_0x7dac('0x3d')]&&!utils[_0x7dac('0x3e')](_0x17cf1b[_0x7dac('0x38')][_0x7dac('0x3d')])){throw new Error(_0x7dac('0x3f'));}switch(_0x17cf1b[_0x7dac('0x38')][_0x7dac('0x3d')]){case _0x7dac('0x40'):return db[_0x7dac('0x2b')][_0x7dac('0x2c')]({'paused':0x0},{'where':{'UserId':_0x4aea61['id']}})['then'](function(){return db[_0x7dac('0x2d')][_0x7dac('0x24')]({'where':{'channel':_0x17cf1b[_0x7dac('0x38')][_0x7dac('0x3d')],'membername':_0x4aea61[_0x7dac('0x28')],'type':_0x7dac('0x37'),'exitAt':null}});})['then'](function(_0x3c4b13){if(_0x3c4b13){return _0x3c4b13[_0x7dac('0x2c')]({'exitAt':moment()[_0x7dac('0x2f')](_0x7dac('0x30')),'data2':'system'},{'individualHooks':!![]});}return null;})[_0x7dac('0x10')](function(){return _0x4aea61[_0x7dac('0x2c')]({'voicePause':![]});});case _0x7dac('0x41'):case _0x7dac('0x42'):case _0x7dac('0x43'):case _0x7dac('0x44'):case'openchannel':case'whatsapp':return db[_0x7dac('0x2d')][_0x7dac('0x24')]({'where':{'channel':_0x17cf1b['body'][_0x7dac('0x3d')],'membername':_0x4aea61[_0x7dac('0x28')],'type':_0x7dac('0x37'),'exitAt':null}})[_0x7dac('0x10')](function(_0x3fab49){return _0x3fab49[_0x7dac('0x2c')]({'exitAt':moment()[_0x7dac('0x2f')](_0x7dac('0x30')),'data2':_0x7dac('0x45')},{'individualHooks':!![]});})[_0x7dac('0x10')](function(){var _0x386cbc={};_[_0x7dac('0x46')](_0x386cbc,util[_0x7dac('0x2f')](_0x7dac('0x47'),_0x17cf1b['body']['channel'],_0x7dac('0x48')),![]);return _0x4aea61[_0x7dac('0x2c')](_0x386cbc);});default:return db['UserVoiceQueueRt'][_0x7dac('0x2c')]({'paused':0x0},{'where':{'UserId':_0x4aea61['id']}})[_0x7dac('0x10')](function(){return db['MemberReport'][_0x7dac('0x1b')]({'where':{'membername':_0x4aea61['name'],'type':_0x7dac('0x37'),'exitAt':null}});})[_0x7dac('0x10')](function(_0x2b1daa){var _0x2cf321=[];_0x2b1daa[_0x7dac('0x33')](function(_0x5e0a16){_0x2cf321[_0x7dac('0x34')](_0x5e0a16[_0x7dac('0x2c')]({'exitAt':moment()[_0x7dac('0x2f')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x7dac('0x45')}));});return BPromise[_0x7dac('0x49')](_0x2cf321);})['then'](function(){return _0x4aea61[_0x7dac('0x2c')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})['then'](function(_0x18e93c){_0x3617c6(_0x18e93c);})[_0x7dac('0x19')](function(_0x4b005e){_0x5aec6e(_0x29448a['error'](0x1f4,_0x4b005e[_0x7dac('0x18')]));});});};exports[_0x7dac('0x4a')]=function(_0x1bf178){var _0x586f09=this;return new Promise(function(_0x3bb9cb,_0x7aa7cc){var _0x4090f3;return db[_0x7dac('0x23')][_0x7dac('0x3c')]({'where':_0x1bf178[_0x7dac('0x1c')]['where']||{},'attributes':['id',_0x7dac('0x28')]})[_0x7dac('0x10')](function(_0x5acb50){if(_0x5acb50){_0x4090f3=_0x5acb50;return db[_0x7dac('0x2b')][_0x7dac('0x4b')]({'where':{'membername':_0x4090f3[_0x7dac('0x28')]},'individualHooks':!![]});}})[_0x7dac('0x10')](function(){if(_0x4090f3){return db[_0x7dac('0x2d')][_0x7dac('0x1b')]({'where':{'membername':_0x4090f3[_0x7dac('0x28')],'exitAt':null}});}})[_0x7dac('0x10')](function(_0x1de092){if(_0x4090f3){if(_0x1de092&&_0x1de092['length']){var _0x2cbe8c=[];_0x1de092[_0x7dac('0x33')](function(_0x29246d){_0x2cbe8c[_0x7dac('0x34')](_0x29246d[_0x7dac('0x2c')]({'exitAt':moment()['format'](_0x7dac('0x30'))}));});return BPromise[_0x7dac('0x49')](_0x2cbe8c);}}})[_0x7dac('0x10')](function(){if(_0x4090f3){return _0x4090f3[_0x7dac('0x2c')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x7dac('0x10')](function(_0x154b6f){_0x3bb9cb(_0x154b6f);})[_0x7dac('0x19')](function(_0x1a68db){_0x7aa7cc(_0x586f09[_0x7dac('0x17')](0x1f4,_0x1a68db[_0x7dac('0x18')]));});});};exports[_0x7dac('0x4c')]=function(_0xf3f6ea){var _0x4fd174=this;return new Promise(function(_0x34faae,_0x5a5727){var _0x1f8b9f;var _0x3b0e24;var _0x2b0a39;var _0x5aa0ac;return db[_0x7dac('0x23')]['findOne']({'where':_0xf3f6ea['options'][_0x7dac('0x25')]||{},'attributes':['id',_0x7dac('0x28'),_0x7dac('0x29'),_0x7dac('0x4d'),_0x7dac('0x4e'),_0x7dac('0x2a'),'loginInPause','interface']})[_0x7dac('0x10')](function(_0x5d4e27){if(_0x5d4e27){_0x1f8b9f=_0x5d4e27;_0x5aa0ac=_0xf3f6ea[_0x7dac('0x38')][_0x7dac('0x35')]?_0xf3f6ea[_0x7dac('0x38')][_0x7dac('0x35')]:util[_0x7dac('0x2f')](_0x7dac('0x36'),_0x1f8b9f[_0x7dac('0x28')]);return db['User']['count']({'where':{'role':_0x7dac('0x4f'),'online':!![],'id':{'$ne':_0x1f8b9f['id']}}});}})[_0x7dac('0x10')](function(_0x409688){if(_0x409688){_0x2b0a39=_0x409688;return require(_0x7dac('0x50'))[_0x7dac('0x51')]();}})[_0x7dac('0x10')](function(_0x2d66f4){if(_0x2d66f4&&_0x2d66f4['agents']&&_0x2b0a39>=_0x2d66f4['agents']){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x7dac('0x10')](function(){if(_0x1f8b9f){return db[_0x7dac('0x2b')][_0x7dac('0x4b')]({'where':{'membername':_0x1f8b9f[_0x7dac('0x28')]},'individualHooks':!![]});}})['then'](function(){if(_0x1f8b9f){return _0x1f8b9f[_0x7dac('0x52')]({'raw':!![]});}})['then'](function(_0x28040c){if(_0x1f8b9f){if(_0x28040c){var _0x3966df=[];_0x3b0e24=_0x28040c;if(_0x3b0e24[_0x7dac('0x2e')]){for(var _0x53b0d0=0x0;_0x53b0d0<_0x3b0e24[_0x7dac('0x2e')];_0x53b0d0++){_0x3966df['push'](db['UserVoiceQueueRt']['upsert']({'membername':_0x1f8b9f[_0x7dac('0x28')],'UserId':_0x1f8b9f['id'],'queue_name':_0x3b0e24[_0x53b0d0][_0x7dac('0x28')],'VoiceQueueId':_0x3b0e24[_0x53b0d0]['id'],'interface':_0x5aa0ac,'paused':_0x1f8b9f[_0x7dac('0x53')]||![],'penalty':_0x3b0e24[_0x53b0d0][_0x7dac('0x54')]||0x0}));}return BPromise['all'](_0x3966df);}}}})['then'](function(){if(_0x1f8b9f){return db['MemberReport'][_0x7dac('0x1b')]({'where':{'membername':_0x1f8b9f['name'],'exitAt':null}});}})[_0x7dac('0x10')](function(_0xdcafc0){if(_0x1f8b9f){if(_0xdcafc0&&_0xdcafc0[_0x7dac('0x2e')]){var _0x2ff1b0=[];_0xdcafc0[_0x7dac('0x33')](function(_0x1ab606){_0x2ff1b0[_0x7dac('0x34')](_0x1ab606[_0x7dac('0x2c')]({'exitAt':moment()[_0x7dac('0x2f')](_0x7dac('0x30'))}));});return BPromise[_0x7dac('0x49')](_0x2ff1b0);}}})[_0x7dac('0x10')](function(_0x2729a1){if(_0x1f8b9f){var _0x4df5a3=[];var _0x262d80=[];var _0x1dea58=utils[_0x7dac('0x32')]();var _0x447375={'membername':_0x1f8b9f[_0x7dac('0x28')],'interface':_0x5aa0ac,'enterAt':moment()[_0x7dac('0x2f')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x1f8b9f['role'],'internal':_0x1f8b9f[_0x7dac('0x2a')]};_0x1dea58[_0x7dac('0x33')](function(_0x6734ff){_0x4df5a3[_0x7dac('0x34')](_['merge']({'channel':_0x6734ff,'type':_0x7dac('0x55'),'data1':_0x7dac('0x56'),'data2':_0x5aa0ac},_0x447375));if(_0x1f8b9f[_0x7dac('0x53')]){_0x262d80[_0x7dac('0x34')](_[_0x7dac('0x57')]({'channel':_0x6734ff,'type':_0x7dac('0x37'),'data1':_0x7dac('0x58')},_0x447375));}});return db[_0x7dac('0x2d')][_0x7dac('0x59')](_0x4df5a3['concat'](_0x262d80),{'individualHooks':!![]});}})[_0x7dac('0x10')](function(){if(_0x1f8b9f){return _0x1f8b9f[_0x7dac('0x2c')]({'online':!![],'lastLoginAt':moment()['format'](_0x7dac('0x30')),'voicePause':_0x1f8b9f[_0x7dac('0x53')]||![],'mailPause':_0x1f8b9f[_0x7dac('0x53')]||![],'chatPause':_0x1f8b9f[_0x7dac('0x53')]||![],'faxPause':_0x1f8b9f[_0x7dac('0x53')]||![],'smsPause':_0x1f8b9f[_0x7dac('0x53')]||![],'openchannelPause':_0x1f8b9f[_0x7dac('0x53')]||![],'pauseType':_0x1f8b9f[_0x7dac('0x53')]?'LOGININPAUSE':null,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x5aa0ac});}})[_0x7dac('0x10')](function(_0x1db769){_0x34faae(_0x1db769);})['catch'](function(_0x537048){_0x5a5727(_0x4fd174[_0x7dac('0x17')](0x1f4,_0x537048['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index ff4752d..3f050ab 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 _0xb966=['./user.events','save','update','emit','removeListener','length','user:'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb966,0x13b));var _0x6b96=function(_0xf21d5d,_0xaeedc2){_0xf21d5d=_0xf21d5d-0x0;var _0x1970ad=_0xb966[_0xf21d5d];return _0x1970ad;};'use strict';var UserEvents=require(_0x6b96('0x0'));var events=[_0x6b96('0x1'),'remove',_0x6b96('0x2')];function createListener(_0x119e21,_0x47098f){return function(_0x48a082){_0x47098f[_0x6b96('0x3')](_0x119e21,_0x48a082);};}function removeListener(_0x38ad48,_0x584b77){return function(){UserEvents[_0x6b96('0x4')](_0x38ad48,_0x584b77);};}exports['register']=function(_0x2f7e3c){for(var _0x219c4a=0x0,_0x39e3a1=events[_0x6b96('0x5')];_0x219c4a<_0x39e3a1;_0x219c4a++){var _0x50e590=events[_0x219c4a];var _0x21d24c=createListener(_0x6b96('0x6')+_0x50e590,_0x2f7e3c);UserEvents['on'](_0x50e590,_0x21d24c);}}; \ No newline at end of file +var _0x731c=['removeListener','length','user:','./user.events','save','remove','emit'];(function(_0x266618,_0x18f637){var _0x54dbf5=function(_0x1f7985){while(--_0x1f7985){_0x266618['push'](_0x266618['shift']());}};_0x54dbf5(++_0x18f637);}(_0x731c,0xa4));var _0xc731=function(_0x34f3a5,_0x4ff5c9){_0x34f3a5=_0x34f3a5-0x0;var _0x29af8e=_0x731c[_0x34f3a5];return _0x29af8e;};'use strict';var UserEvents=require(_0xc731('0x0'));var events=[_0xc731('0x1'),_0xc731('0x2'),'update'];function createListener(_0x2a3025,_0x3393a3){return function(_0x4bd918){_0x3393a3[_0xc731('0x3')](_0x2a3025,_0x4bd918);};}function removeListener(_0x20d365,_0x455dd1){return function(){UserEvents[_0xc731('0x4')](_0x20d365,_0x455dd1);};}exports['register']=function(_0x87536a){for(var _0xad0c45=0x0,_0x3884c4=events[_0xc731('0x5')];_0xad0c45<_0x3884c4;_0xad0c45++){var _0xa0a098=events[_0xad0c45];var _0xe4771=createListener(_0xc731('0x6')+_0xa0a098,_0x87536a);UserEvents['on'](_0xa0a098,_0xe4771);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 37f1ceb..80c17ae 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x9602fc,_0xef878b){var _0x2e446d=function(_0x52c4b1){while(--_0x52c4b1){_0x9602fc['push'](_0x9602fc['shift']());}};_0x2e446d(++_0xef878b);}(_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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x4048dd,_0x534f21){var _0x41ff9d=function(_0x45dc90){while(--_0x45dc90){_0x4048dd['push'](_0x4048dd['shift']());}};_0x41ff9d(++_0x534f21);}(_0xe706,0xa3));var _0x6e70=function(_0x355adc,_0xac51ab){_0x355adc=_0x355adc-0x0;var _0x4df04f=_0xe706[_0x355adc];return _0x4df04f;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 8abe5c3..5bc2a65 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 _0xbe2a=['exports','INTEGER','sequelize'];(function(_0x7b4f2f,_0x4f1f09){var _0x4a7c1e=function(_0x39dcd2){while(--_0x39dcd2){_0x7b4f2f['push'](_0x7b4f2f['shift']());}};_0x4a7c1e(++_0x4f1f09);}(_0xbe2a,0x1d9));var _0xabe2=function(_0x397f6c,_0x58e7ae){_0x397f6c=_0x397f6c-0x0;var _0x5309fa=_0xbe2a[_0x397f6c];return _0x5309fa;};'use strict';var Sequelize=require(_0xabe2('0x0'));module[_0xabe2('0x1')]={'penalty':{'type':Sequelize[_0xabe2('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4fe0=['INTEGER','exports'];(function(_0x38bc15,_0x46e4d9){var _0x54682a=function(_0x5419eb){while(--_0x5419eb){_0x38bc15['push'](_0x38bc15['shift']());}};_0x54682a(++_0x46e4d9);}(_0x4fe0,0x195));var _0x04fe=function(_0x1ef1fe,_0x30d723){_0x1ef1fe=_0x1ef1fe-0x0;var _0x53f529=_0x4fe0[_0x1ef1fe];return _0x53f529;};'use strict';var Sequelize=require('sequelize');module[_0x04fe('0x0')]={'penalty':{'type':Sequelize[_0x04fe('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index e3df21f..32c18b5 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 _0x932c=['exports','define','UserChatQueue','user_has_chat_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userChatQueue.attributes'];(function(_0x378a05,_0xbd55ae){var _0x3b90ee=function(_0x2e4fd8){while(--_0x2e4fd8){_0x378a05['push'](_0x378a05['shift']());}};_0x3b90ee(++_0xbd55ae);}(_0x932c,0x1be));var _0xc932=function(_0x2263d6,_0x23ef72){_0x2263d6=_0x2263d6-0x0;var _0x392795=_0x932c[_0x2263d6];return _0x392795;};'use strict';var _=require(_0xc932('0x0'));var util=require('util');var logger=require(_0xc932('0x1'))(_0xc932('0x2'));var moment=require(_0xc932('0x3'));var BPromise=require(_0xc932('0x4'));var rp=require(_0xc932('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc932('0x6'));var config=require(_0xc932('0x7'));var attributes=require(_0xc932('0x8'));module[_0xc932('0x9')]=function(_0x2528ae,_0x147f85){return _0x2528ae[_0xc932('0xa')](_0xc932('0xb'),attributes,{'tableName':_0xc932('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x75e1=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserChatQueue','user_has_chat_queues'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x75e1,0x12b));var _0x175e=function(_0x4cc1c1,_0x3ad908){_0x4cc1c1=_0x4cc1c1-0x0;var _0x483778=_0x75e1[_0x4cc1c1];return _0x483778;};'use strict';var _=require(_0x175e('0x0'));var util=require(_0x175e('0x1'));var logger=require(_0x175e('0x2'))(_0x175e('0x3'));var moment=require('moment');var BPromise=require(_0x175e('0x4'));var rp=require(_0x175e('0x5'));var fs=require('fs');var path=require(_0x175e('0x6'));var rimraf=require(_0x175e('0x7'));var config=require(_0x175e('0x8'));var attributes=require('./userChatQueue.attributes');module[_0x175e('0x9')]=function(_0x12193c,_0xa7625){return _0x12193c[_0x175e('0xa')](_0x175e('0xb'),attributes,{'tableName':_0x175e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 8d68ad8..1e7aa2e 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 _0xcc55=['debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x54b649,_0x66ce69){var _0x2e5bba=function(_0x2d2ba0){while(--_0x2d2ba0){_0x54b649['push'](_0x54b649['shift']());}};_0x2e5bba(++_0x66ce69);}(_0xcc55,0x1d5));var _0x5cc5=function(_0x8ffcb9,_0x453ddb){_0x8ffcb9=_0x8ffcb9-0x0;var _0x4ddfae=_0xcc55[_0x8ffcb9];return _0x4ddfae;};'use strict';var _=require('lodash');var util=require(_0x5cc5('0x0'));var moment=require(_0x5cc5('0x1'));var BPromise=require(_0x5cc5('0x2'));var rs=require(_0x5cc5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5cc5('0x4'));var logger=require(_0x5cc5('0x5'))(_0x5cc5('0x6'));var config=require('../../config/environment');var jayson=require(_0x5cc5('0x7'));var client=jayson['client'][_0x5cc5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x51f92e,_0x4f43f6,_0x2c29fc){return new BPromise(function(_0x14782e,_0x51bb1b){return client[_0x5cc5('0x9')](_0x51f92e,_0x2c29fc)[_0x5cc5('0xa')](function(_0xde1322){logger[_0x5cc5('0xb')](_0x5cc5('0xc'),_0x4f43f6,_0x5cc5('0xd'));logger[_0x5cc5('0xe')](_0x5cc5('0xf'),_0x4f43f6,_0x5cc5('0xd'),JSON[_0x5cc5('0x10')](_0xde1322));if(_0xde1322['error']){if(_0xde1322[_0x5cc5('0x11')][_0x5cc5('0x12')]===0x1f4){logger[_0x5cc5('0x11')](_0x5cc5('0xc'),_0x4f43f6,_0xde1322[_0x5cc5('0x11')][_0x5cc5('0x13')]);return _0x51bb1b(_0xde1322[_0x5cc5('0x11')][_0x5cc5('0x13')]);}logger[_0x5cc5('0x11')](_0x5cc5('0xc'),_0x4f43f6,_0xde1322[_0x5cc5('0x11')][_0x5cc5('0x13')]);return _0x14782e(_0xde1322[_0x5cc5('0x11')][_0x5cc5('0x13')]);}else{logger['info'](_0x5cc5('0xc'),_0x4f43f6,'request\x20sent');_0x14782e(_0xde1322[_0x5cc5('0x14')][_0x5cc5('0x13')]);}})['catch'](function(_0x2d5b14){logger[_0x5cc5('0x11')]('UserChatQueue,\x20%s,\x20%s',_0x4f43f6,_0x2d5b14);_0x51bb1b(_0x2d5b14);});});} \ No newline at end of file +var _0xfe27=['catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserChatQueue,\x20%s,\x20%s','message'];(function(_0x26631e,_0x205f46){var _0x2bbdbc=function(_0x6f4b26){while(--_0x6f4b26){_0x26631e['push'](_0x26631e['shift']());}};_0x2bbdbc(++_0x205f46);}(_0xfe27,0xfe));var _0x7fe2=function(_0x28d434,_0x2d2610){_0x28d434=_0x28d434-0x0;var _0x1109c6=_0xfe27[_0x28d434];return _0x1109c6;};'use strict';var _=require(_0x7fe2('0x0'));var util=require(_0x7fe2('0x1'));var moment=require(_0x7fe2('0x2'));var BPromise=require(_0x7fe2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7fe2('0x4'))['db'];var utils=require(_0x7fe2('0x5'));var logger=require(_0x7fe2('0x6'))(_0x7fe2('0x7'));var config=require(_0x7fe2('0x8'));var jayson=require(_0x7fe2('0x9'));var client=jayson[_0x7fe2('0xa')][_0x7fe2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x46a5e4,_0x1f8bb7,_0x268fce){return new BPromise(function(_0x2ce415,_0x3a5ecf){return client[_0x7fe2('0xc')](_0x46a5e4,_0x268fce)[_0x7fe2('0xd')](function(_0x304119){logger[_0x7fe2('0xe')]('UserChatQueue,\x20%s,\x20%s',_0x1f8bb7,_0x7fe2('0xf'));logger[_0x7fe2('0x10')](_0x7fe2('0x11'),_0x1f8bb7,_0x7fe2('0xf'),JSON[_0x7fe2('0x12')](_0x304119));if(_0x304119['error']){if(_0x304119[_0x7fe2('0x13')]['code']===0x1f4){logger[_0x7fe2('0x13')](_0x7fe2('0x14'),_0x1f8bb7,_0x304119[_0x7fe2('0x13')][_0x7fe2('0x15')]);return _0x3a5ecf(_0x304119[_0x7fe2('0x13')][_0x7fe2('0x15')]);}logger[_0x7fe2('0x13')](_0x7fe2('0x14'),_0x1f8bb7,_0x304119[_0x7fe2('0x13')]['message']);return _0x2ce415(_0x304119['error'][_0x7fe2('0x15')]);}else{logger[_0x7fe2('0xe')]('UserChatQueue,\x20%s,\x20%s',_0x1f8bb7,_0x7fe2('0xf'));_0x2ce415(_0x304119['result'][_0x7fe2('0x15')]);}})[_0x7fe2('0x16')](function(_0x5aedc1){logger[_0x7fe2('0x13')]('UserChatQueue,\x20%s,\x20%s',_0x1f8bb7,_0x5aedc1);_0x3a5ecf(_0x5aedc1);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index c668e18..b19b6dc 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x122cac,_0x473824){var _0xe35004=function(_0x2f7953){while(--_0x2f7953){_0x122cac['push'](_0x122cac['shift']());}};_0xe35004(++_0x473824);}(_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'));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(_0x25c43c,_0x3a3aa3){var _0x28e108=function(_0x425bfe){while(--_0x425bfe){_0x25c43c['push'](_0x25c43c['shift']());}};_0x28e108(++_0x3a3aa3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 45e056b..5666fdb 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 _0x2c67=['INTEGER','STRING','sequelize','exports'];(function(_0x30e004,_0x46f8c2){var _0x5ca247=function(_0x20d80f){while(--_0x20d80f){_0x30e004['push'](_0x30e004['shift']());}};_0x5ca247(++_0x46f8c2);}(_0x2c67,0x17a));var _0x72c6=function(_0x4aadd8,_0x598e1e){_0x4aadd8=_0x4aadd8-0x0;var _0x2343ae=_0x2c67[_0x4aadd8];return _0x2343ae;};'use strict';var Sequelize=require(_0x72c6('0x0'));module[_0x72c6('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x72c6('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x72c6('0x3')]}}; \ No newline at end of file +var _0x8ab8=['INTEGER','STRING','sequelize','exports'];(function(_0xa2d364,_0x1f90a6){var _0x3851c4=function(_0xf58f39){while(--_0xf58f39){_0xa2d364['push'](_0xa2d364['shift']());}};_0x3851c4(++_0x1f90a6);}(_0x8ab8,0x9a));var _0x88ab=function(_0x2f539d,_0x4b0bb1){_0x2f539d=_0x2f539d-0x0;var _0x2a7b83=_0x8ab8[_0x2f539d];return _0x2a7b83;};'use strict';var Sequelize=require(_0x88ab('0x0'));module[_0x88ab('0x1')]={'penalty':{'type':Sequelize[_0x88ab('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x88ab('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x88ab('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 4491538..3a23dc9 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 _0xf084=['user_has_fax_queues','util','../../config/logger','api','moment','path','rimraf','./userFaxQueue.attributes','define','UserFaxQueue'];(function(_0x33f27f,_0x25dac0){var _0x15faed=function(_0x2521a8){while(--_0x2521a8){_0x33f27f['push'](_0x33f27f['shift']());}};_0x15faed(++_0x25dac0);}(_0xf084,0xab));var _0x4f08=function(_0x321767,_0x125109){_0x321767=_0x321767-0x0;var _0x43dd96=_0xf084[_0x321767];return _0x43dd96;};'use strict';var _=require('lodash');var util=require(_0x4f08('0x0'));var logger=require(_0x4f08('0x1'))(_0x4f08('0x2'));var moment=require(_0x4f08('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4f08('0x4'));var rimraf=require(_0x4f08('0x5'));var config=require('../../config/environment');var attributes=require(_0x4f08('0x6'));module['exports']=function(_0x43dc45,_0x3a6d17){return _0x43dc45[_0x4f08('0x7')](_0x4f08('0x8'),attributes,{'tableName':_0x4f08('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2bf1=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userFaxQueue.attributes','define','UserFaxQueue','user_has_fax_queues','lodash'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x2bf1,0xb3));var _0x12bf=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x2bf1[_0x134c2e];return _0x2825db;};'use strict';var _=require(_0x12bf('0x0'));var util=require('util');var logger=require(_0x12bf('0x1'))(_0x12bf('0x2'));var moment=require(_0x12bf('0x3'));var BPromise=require(_0x12bf('0x4'));var rp=require(_0x12bf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x12bf('0x6'));var config=require(_0x12bf('0x7'));var attributes=require(_0x12bf('0x8'));module['exports']=function(_0x19a8bd,_0x361849){return _0x19a8bd[_0x12bf('0x9')](_0x12bf('0xa'),attributes,{'tableName':_0x12bf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index c4c7810..e975e34 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 _0x7b79=['stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s'];(function(_0x51a57d,_0x35b93e){var _0x4d392a=function(_0x30de58){while(--_0x30de58){_0x51a57d['push'](_0x51a57d['shift']());}};_0x4d392a(++_0x35b93e);}(_0x7b79,0x1b6));var _0x97b7=function(_0x450cef,_0x309639){_0x450cef=_0x450cef-0x0;var _0x337f5d=_0x7b79[_0x450cef];return _0x337f5d;};'use strict';var _=require(_0x97b7('0x0'));var util=require(_0x97b7('0x1'));var moment=require(_0x97b7('0x2'));var BPromise=require('bluebird');var rs=require(_0x97b7('0x3'));var fs=require('fs');var Redis=require(_0x97b7('0x4'));var db=require(_0x97b7('0x5'))['db'];var utils=require(_0x97b7('0x6'));var logger=require('../../config/logger')(_0x97b7('0x7'));var config=require(_0x97b7('0x8'));var jayson=require(_0x97b7('0x9'));var client=jayson[_0x97b7('0xa')][_0x97b7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x43390b,_0x54d06e,_0x58d79a){return new BPromise(function(_0x59cbc1,_0x5e7124){return client[_0x97b7('0xc')](_0x43390b,_0x58d79a)[_0x97b7('0xd')](function(_0x3d245c){logger[_0x97b7('0xe')](_0x97b7('0xf'),_0x54d06e,'request\x20sent');logger[_0x97b7('0x10')](_0x97b7('0x11'),_0x54d06e,'request\x20sent',JSON[_0x97b7('0x12')](_0x3d245c));if(_0x3d245c[_0x97b7('0x13')]){if(_0x3d245c['error'][_0x97b7('0x14')]===0x1f4){logger[_0x97b7('0x13')](_0x97b7('0xf'),_0x54d06e,_0x3d245c['error'][_0x97b7('0x15')]);return _0x5e7124(_0x3d245c[_0x97b7('0x13')][_0x97b7('0x15')]);}logger[_0x97b7('0x13')](_0x97b7('0xf'),_0x54d06e,_0x3d245c[_0x97b7('0x13')][_0x97b7('0x15')]);return _0x59cbc1(_0x3d245c[_0x97b7('0x13')]['message']);}else{logger[_0x97b7('0xe')](_0x97b7('0xf'),_0x54d06e,'request\x20sent');_0x59cbc1(_0x3d245c[_0x97b7('0x16')][_0x97b7('0x15')]);}})[_0x97b7('0x17')](function(_0x3afd52){logger[_0x97b7('0x13')]('UserFaxQueue,\x20%s,\x20%s',_0x54d06e,_0x3afd52);_0x5e7124(_0x3afd52);});});} \ No newline at end of file +var _0x53ed=['request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x54a6ce,_0x215937){var _0x3ccc0e=function(_0x151f69){while(--_0x151f69){_0x54a6ce['push'](_0x54a6ce['shift']());}};_0x3ccc0e(++_0x215937);}(_0x53ed,0x199));var _0xd53e=function(_0x1cd5ee,_0x5741b3){_0x1cd5ee=_0x1cd5ee-0x0;var _0x4fce8f=_0x53ed[_0x1cd5ee];return _0x4fce8f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd53e('0x0'));var BPromise=require(_0xd53e('0x1'));var rs=require(_0xd53e('0x2'));var fs=require('fs');var Redis=require(_0xd53e('0x3'));var db=require(_0xd53e('0x4'))['db'];var utils=require(_0xd53e('0x5'));var logger=require('../../config/logger')(_0xd53e('0x6'));var config=require(_0xd53e('0x7'));var jayson=require(_0xd53e('0x8'));var client=jayson[_0xd53e('0x9')][_0xd53e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e546b,_0x248bce,_0x556548){return new BPromise(function(_0x487993,_0x1b167a){return client[_0xd53e('0xb')](_0x1e546b,_0x556548)[_0xd53e('0xc')](function(_0x34d53c){logger[_0xd53e('0xd')](_0xd53e('0xe'),_0x248bce,_0xd53e('0xf'));logger['debug']('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x248bce,_0xd53e('0xf'),JSON[_0xd53e('0x10')](_0x34d53c));if(_0x34d53c[_0xd53e('0x11')]){if(_0x34d53c[_0xd53e('0x11')][_0xd53e('0x12')]===0x1f4){logger[_0xd53e('0x11')](_0xd53e('0xe'),_0x248bce,_0x34d53c['error'][_0xd53e('0x13')]);return _0x1b167a(_0x34d53c[_0xd53e('0x11')][_0xd53e('0x13')]);}logger[_0xd53e('0x11')](_0xd53e('0xe'),_0x248bce,_0x34d53c[_0xd53e('0x11')][_0xd53e('0x13')]);return _0x487993(_0x34d53c[_0xd53e('0x11')][_0xd53e('0x13')]);}else{logger[_0xd53e('0xd')](_0xd53e('0xe'),_0x248bce,_0xd53e('0xf'));_0x487993(_0x34d53c['result']['message']);}})[_0xd53e('0x14')](function(_0x47c404){logger[_0xd53e('0x11')]('UserFaxQueue,\x20%s,\x20%s',_0x248bce,_0x47c404);_0x1b167a(_0x47c404);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 46a9e3f..38359a3 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x2014a6,_0x192c31){var _0x148b0e=function(_0x47a110){while(--_0x47a110){_0x2014a6['push'](_0x2014a6['shift']());}};_0x148b0e(++_0x192c31);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x37b04d,_0x761b4f){var _0x1af4a5=function(_0x1f2d60){while(--_0x1f2d60){_0x37b04d['push'](_0x37b04d['shift']());}};_0x1af4a5(++_0x761b4f);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xcb91[_0x5f1391];return _0x50ebe3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 0b30e04..e6afe03 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 _0x2525=['INTEGER','sequelize'];(function(_0x41ae64,_0xc94141){var _0x2f1537=function(_0x303dbb){while(--_0x303dbb){_0x41ae64['push'](_0x41ae64['shift']());}};_0x2f1537(++_0xc94141);}(_0x2525,0x9f));var _0x5252=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0x2525[_0x4b7b62];return _0x2280df;};'use strict';var Sequelize=require(_0x5252('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x5252('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb589=['INTEGER','exports'];(function(_0x520d66,_0x22897e){var _0x53ff25=function(_0x524e9b){while(--_0x524e9b){_0x520d66['push'](_0x520d66['shift']());}};_0x53ff25(++_0x22897e);}(_0xb589,0x143));var _0x9b58=function(_0x405778,_0xa4dd3b){_0x405778=_0x405778-0x0;var _0x341735=_0xb589[_0x405778];return _0x341735;};'use strict';var Sequelize=require('sequelize');module[_0x9b58('0x0')]={'penalty':{'type':Sequelize[_0x9b58('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 58f0fe9..077e817 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 _0x532c=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','define','UserMailQueue','lodash','util','../../config/logger','api'];(function(_0x3ad0ac,_0x295556){var _0x5c458f=function(_0x2580ae){while(--_0x2580ae){_0x3ad0ac['push'](_0x3ad0ac['shift']());}};_0x5c458f(++_0x295556);}(_0x532c,0x7e));var _0xc532=function(_0x431d78,_0x3cd5a8){_0x431d78=_0x431d78-0x0;var _0x3994e0=_0x532c[_0x431d78];return _0x3994e0;};'use strict';var _=require(_0xc532('0x0'));var util=require(_0xc532('0x1'));var logger=require(_0xc532('0x2'))(_0xc532('0x3'));var moment=require(_0xc532('0x4'));var BPromise=require(_0xc532('0x5'));var rp=require(_0xc532('0x6'));var fs=require('fs');var path=require(_0xc532('0x7'));var rimraf=require(_0xc532('0x8'));var config=require(_0xc532('0x9'));var attributes=require(_0xc532('0xa'));module['exports']=function(_0x53daf8,_0x35032f){return _0x53daf8[_0xc532('0xb')](_0xc532('0xc'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf731=['./userMailQueue.attributes','exports','define','UserMailQueue','api','moment','bluebird','path','../../config/environment'];(function(_0x422725,_0x3bd4a2){var _0x1de746=function(_0x55faee){while(--_0x55faee){_0x422725['push'](_0x422725['shift']());}};_0x1de746(++_0x3bd4a2);}(_0xf731,0xc1));var _0x1f73=function(_0x1a8a86,_0x5d89ac){_0x1a8a86=_0x1a8a86-0x0;var _0x254a94=_0xf731[_0x1a8a86];return _0x254a94;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x1f73('0x0'));var moment=require(_0x1f73('0x1'));var BPromise=require(_0x1f73('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1f73('0x3'));var rimraf=require('rimraf');var config=require(_0x1f73('0x4'));var attributes=require(_0x1f73('0x5'));module[_0x1f73('0x6')]=function(_0x3d5562,_0x5bf1da){return _0x3d5562[_0x1f73('0x7')](_0x1f73('0x8'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 2d77006..5abc8ab 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 _0x3e74=['rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','UserMailQueue,\x20%s,\x20%s','message','info','catch','lodash','moment','bluebird','randomstring','../../config/utils'];(function(_0x4f37d0,_0x48da69){var _0x246ff5=function(_0x3f1046){while(--_0x3f1046){_0x4f37d0['push'](_0x4f37d0['shift']());}};_0x246ff5(++_0x48da69);}(_0x3e74,0x175));var _0x43e7=function(_0xaee3ef,_0x1647f3){_0xaee3ef=_0xaee3ef-0x0;var _0x524d6f=_0x3e74[_0xaee3ef];return _0x524d6f;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var moment=require(_0x43e7('0x1'));var BPromise=require(_0x43e7('0x2'));var rs=require(_0x43e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x43e7('0x4'));var logger=require('../../config/logger')(_0x43e7('0x5'));var config=require(_0x43e7('0x6'));var jayson=require(_0x43e7('0x7'));var client=jayson[_0x43e7('0x8')][_0x43e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x503698,_0x45a0d1,_0x3491d6){return new BPromise(function(_0x2ede2d,_0x8528fc){return client[_0x43e7('0xa')](_0x503698,_0x3491d6)['then'](function(_0x212c6c){logger['info']('UserMailQueue,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'));logger[_0x43e7('0xc')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'),JSON['stringify'](_0x212c6c));if(_0x212c6c[_0x43e7('0xd')]){if(_0x212c6c[_0x43e7('0xd')]['code']===0x1f4){logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')][_0x43e7('0xf')]);return _0x8528fc(_0x212c6c['error']['message']);}logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')]['message']);return _0x2ede2d(_0x212c6c['error'][_0x43e7('0xf')]);}else{logger[_0x43e7('0x10')](_0x43e7('0xe'),_0x45a0d1,_0x43e7('0xb'));_0x2ede2d(_0x212c6c['result']['message']);}})[_0x43e7('0x11')](function(_0x264575){logger[_0x43e7('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x45a0d1,_0x264575);_0x8528fc(_0x264575);});});} \ No newline at end of file +var _0x008c=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','UserMailQueue,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x008c,0x188));var _0xc008=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x008c[_0x187ee1];return _0x388160;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var moment=require(_0xc008('0x2'));var BPromise=require(_0xc008('0x3'));var rs=require(_0xc008('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc008('0x5'))['db'];var utils=require(_0xc008('0x6'));var logger=require(_0xc008('0x7'))(_0xc008('0x8'));var config=require(_0xc008('0x9'));var jayson=require(_0xc008('0xa'));var client=jayson[_0xc008('0xb')][_0xc008('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9c8cb2,_0x4af530,_0x428fa9){return new BPromise(function(_0x5aa09b,_0x30be38){return client['request'](_0x9c8cb2,_0x428fa9)['then'](function(_0x27830d){logger[_0xc008('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,'request\x20sent');logger['debug'](_0xc008('0xe'),_0x4af530,_0xc008('0xf'),JSON['stringify'](_0x27830d));if(_0x27830d[_0xc008('0x10')]){if(_0x27830d[_0xc008('0x10')][_0xc008('0x11')]===0x1f4){logger[_0xc008('0x10')](_0xc008('0x12'),_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x30be38(_0x27830d['error']['message']);}logger[_0xc008('0x10')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x5aa09b(_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);}else{logger[_0xc008('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,'request\x20sent');_0x5aa09b(_0x27830d['result'][_0xc008('0x13')]);}})[_0xc008('0x14')](function(_0x3cafe3){logger[_0xc008('0x10')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,_0x3cafe3);_0x30be38(_0x3cafe3);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 9f43bb5..a8885f2 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 _0x7606=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','exports','multer'];(function(_0x35b353,_0x22d8c0){var _0x5436a6=function(_0xf77d23){while(--_0xf77d23){_0x35b353['push'](_0x35b353['shift']());}};_0x5436a6(++_0x22d8c0);}(_0x7606,0x12b));var _0x6760=function(_0x28a101,_0x22f330){_0x28a101=_0x28a101-0x0;var _0x15a146=_0x7606[_0x28a101];return _0x15a146;};'use strict';var multer=require(_0x6760('0x0'));var util=require('util');var path=require(_0x6760('0x1'));var timeout=require(_0x6760('0x2'));var express=require(_0x6760('0x3'));var router=express['Router']();var fs_extra=require(_0x6760('0x4'));var auth=require(_0x6760('0x5'));var interaction=require(_0x6760('0x6'));var config=require(_0x6760('0x7'));var controller=require('./userNotification.controller');router['post']('/',auth[_0x6760('0x8')](),controller['sendUserNotification']);module[_0x6760('0x9')]=router; \ No newline at end of file +var _0xfda6=['post','isAuthenticated','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller'];(function(_0x593e8a,_0x33f440){var _0x47cd1c=function(_0x522cff){while(--_0x522cff){_0x593e8a['push'](_0x593e8a['shift']());}};_0x47cd1c(++_0x33f440);}(_0xfda6,0x121));var _0x6fda=function(_0x3266c1,_0x38ffbf){_0x3266c1=_0x3266c1-0x0;var _0x10e827=_0xfda6[_0x3266c1];return _0x10e827;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6fda('0x0'));var timeout=require('connect-timeout');var express=require(_0x6fda('0x1'));var router=express[_0x6fda('0x2')]();var fs_extra=require(_0x6fda('0x3'));var auth=require(_0x6fda('0x4'));var interaction=require(_0x6fda('0x5'));var config=require(_0x6fda('0x6'));var controller=require(_0x6fda('0x7'));router[_0x6fda('0x8')]('/',auth[_0x6fda('0x9')](),controller['sendUserNotification']);module[_0x6fda('0xa')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index af8de25..90d1ea4 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 _0x067d=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x1f55f7,_0x3c245f){var _0x39368c=function(_0x3556d2){while(--_0x3556d2){_0x1f55f7['push'](_0x1f55f7['shift']());}};_0x39368c(++_0x3c245f);}(_0x067d,0x1cf));var _0xd067=function(_0x555263,_0xefc087){_0x555263=_0x555263-0x0;var _0x28bf16=_0x067d[_0x555263];return _0x28bf16;};'use strict';var Sequelize=require(_0xd067('0x0'));module[_0xd067('0x1')]={'body':{'type':Sequelize[_0xd067('0x2')]},'senderName':{'type':Sequelize[_0xd067('0x3')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0xd067('0x3')]},'beep':{'type':Sequelize[_0xd067('0x4')]}}; \ No newline at end of file +var _0xc3d7=['TEXT','BOOLEAN','sequelize','exports'];(function(_0x1c99f7,_0x14134f){var _0x443613=function(_0x129e02){while(--_0x129e02){_0x1c99f7['push'](_0x1c99f7['shift']());}};_0x443613(++_0x14134f);}(_0xc3d7,0x122));var _0x7c3d=function(_0x20462b,_0x314408){_0x20462b=_0x20462b-0x0;var _0x783773=_0xc3d7[_0x20462b];return _0x783773;};'use strict';var Sequelize=require(_0x7c3d('0x0'));module[_0x7c3d('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0x7c3d('0x2')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x7c3d('0x3')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index b20669a..08b2202 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 _0x1ca9=['user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','transaction','UserNotification','create','forEach','catch','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','render','html','startCase','ids','queue','replace','all','union','flatten','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','register','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','update','then','destroy','end','error','name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Sequelize','recipients','Missing\x20\x27recipients\x27\x20parameter','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team'];(function(_0x18b629,_0xf138ce){var _0x50d859=function(_0x13ac9e){while(--_0x13ac9e){_0x18b629['push'](_0x18b629['shift']());}};_0x50d859(++_0xf138ce);}(_0x1ca9,0xe5));var _0x91ca=function(_0x317242,_0x5158aa){_0x317242=_0x317242-0x0;var _0x3cf98f=_0x1ca9[_0x317242];return _0x3cf98f;};'use strict';var emlformat=require(_0x91ca('0x0'));var rimraf=require(_0x91ca('0x1'));var zipdir=require(_0x91ca('0x2'));var jsonpatch=require(_0x91ca('0x3'));var rp=require('request-promise');var moment=require(_0x91ca('0x4'));var BPromise=require(_0x91ca('0x5'));var Mustache=require(_0x91ca('0x6'));var util=require(_0x91ca('0x7'));var path=require(_0x91ca('0x8'));var sox=require('sox');var csv=require(_0x91ca('0x9'));var ejs=require(_0x91ca('0xa'));var fs=require('fs');var fs_extra=require(_0x91ca('0xb'));var _=require(_0x91ca('0xc'));var squel=require('squel');var crypto=require(_0x91ca('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x91ca('0xe'));var Papa=require(_0x91ca('0xf'));var Redis=require(_0x91ca('0x10'));var authService=require(_0x91ca('0x11'));var qs=require(_0x91ca('0x12'));var as=require(_0x91ca('0x13'));var hardwareService=require(_0x91ca('0x14'));var logger=require('../../config/logger')(_0x91ca('0x15'));var utils=require(_0x91ca('0x16'));var config=require(_0x91ca('0x17'));var licenseUtil=require(_0x91ca('0x18'));var db=require(_0x91ca('0x19'))['db'];config['redis']=_[_0x91ca('0x1a')](config[_0x91ca('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x91ca('0x1c'))(new Redis(config[_0x91ca('0x1b')]));require('./userNotification.socket')[_0x91ca('0x1d')](socket);function respondWithStatusCode(_0x1ca875,_0x190a8c){_0x190a8c=_0x190a8c||0xcc;return function(_0x4102b2){if(_0x4102b2){return _0x1ca875[_0x91ca('0x1e')](_0x190a8c);}return _0x1ca875[_0x91ca('0x1f')](_0x190a8c)['end']();};}function respondWithResult(_0x185797,_0x103cc9){_0x103cc9=_0x103cc9||0xc8;return function(_0x1bafc4){if(_0x1bafc4){return _0x185797[_0x91ca('0x1f')](_0x103cc9)[_0x91ca('0x20')](_0x1bafc4);}};}function respondWithFilteredResult(_0x190b2b,_0x1ef3ca){return function(_0x19762c){if(_0x19762c){var _0x231642=typeof _0x1ef3ca['offset']===_0x91ca('0x21')&&typeof _0x1ef3ca[_0x91ca('0x22')]==='undefined';var _0x5cd43a=_0x19762c[_0x91ca('0x23')];var _0x4f9bbc=_0x231642?0x0:_0x1ef3ca[_0x91ca('0x24')];var _0x3a8a1e=_0x231642?_0x19762c[_0x91ca('0x23')]:_0x1ef3ca['offset']+_0x1ef3ca['limit'];var _0x10be14;if(_0x3a8a1e>=_0x5cd43a){_0x3a8a1e=_0x5cd43a;_0x10be14=0xc8;}else{_0x10be14=0xce;}_0x190b2b['status'](_0x10be14);return _0x190b2b['set'](_0x91ca('0x25'),_0x4f9bbc+'-'+_0x3a8a1e+'/'+_0x5cd43a)[_0x91ca('0x20')](_0x19762c);}return null;};}function patchUpdates(_0x44ac2c){return function(_0x278372){try{jsonpatch[_0x91ca('0x26')](_0x278372,_0x44ac2c,!![]);}catch(_0x104e70){return BPromise['reject'](_0x104e70);}return _0x278372['save']();};}function saveUpdates(_0x5ba9ea,_0x2aa646){return function(_0x316265){if(_0x316265){return _0x316265[_0x91ca('0x27')](_0x5ba9ea)[_0x91ca('0x28')](function(_0x5a1901){return _0x5a1901;});}return null;};}function removeEntity(_0x4ef2cd,_0x4d3d03){return function(_0x4ca9b){if(_0x4ca9b){return _0x4ca9b[_0x91ca('0x29')]()[_0x91ca('0x28')](function(){_0x4ef2cd[_0x91ca('0x1f')](0xcc)[_0x91ca('0x2a')]();});}};}function handleEntityNotFound(_0x1861b2,_0x3d5759){return function(_0x21108f){if(!_0x21108f){_0x1861b2[_0x91ca('0x1e')](0x194);}return _0x21108f;};}function handleError(_0x10a0f7,_0x8c872a){_0x8c872a=_0x8c872a||0x1f4;return function(_0x2b9ac2){logger[_0x91ca('0x2b')](_0x2b9ac2['stack']);if(_0x2b9ac2[_0x91ca('0x2c')]){delete _0x2b9ac2[_0x91ca('0x2c')];}_0x10a0f7['status'](_0x8c872a)[_0x91ca('0x2d')](_0x2b9ac2);};}exports[_0x91ca('0x2e')]=function(_0x1b0c83,_0x46695,_0x2d2b84){if(!_0x1b0c83[_0x91ca('0x2f')][_0x91ca('0x30')](_0x91ca('0x31'))&&!_0x1b0c83[_0x91ca('0x2f')][_0x91ca('0x30')](_0x91ca('0x32'))){throw new db['Sequelize'][(_0x91ca('0x33'))](_0x91ca('0x34'));}else{if(_0x1b0c83['body']['hasOwnProperty'](_0x91ca('0x32'))&&!_0x1b0c83[_0x91ca('0x2f')][_0x91ca('0x30')](_0x91ca('0x35'))){throw new db[(_0x91ca('0x36'))]['ValidationError']('Missing\x20\x27view\x27\x20parameter');}if(!_0x1b0c83[_0x91ca('0x2f')]['hasOwnProperty'](_0x91ca('0x37'))){throw new db[(_0x91ca('0x36'))]['ValidationError'](_0x91ca('0x38'));}else{try{var _0x368f32=JSON['parse'](_0x1b0c83[_0x91ca('0x2f')][_0x91ca('0x37')]);}catch(_0x1ba255){logger['error'](_0x1ba255);throw new db[(_0x91ca('0x36'))][(_0x91ca('0x33'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x479e1b=[_0x91ca('0x39'),_0x91ca('0x3a'),_0x91ca('0x3b'),_0x91ca('0x3c'),_0x91ca('0x3d'),_0x91ca('0x3e'),_0x91ca('0x3f'),_0x91ca('0x40'),_0x91ca('0x41')];if(_[_0x91ca('0x42')](_0x368f32,function(_0x36248b){return!_[_0x91ca('0x43')](_0x479e1b,_0x36248b[_0x91ca('0x44')][_0x91ca('0x45')]());})){throw new db[(_0x91ca('0x36'))][(_0x91ca('0x33'))](_0x91ca('0x46'));}}}var _0x1cfee3={};_0x1cfee3[_0x91ca('0x47')]=_0x1b0c83[_0x91ca('0x2f')][_0x91ca('0x30')](_0x91ca('0x47'))?_0x1b0c83[_0x91ca('0x2f')]['senderName']:_0x1b0c83['user'][_0x91ca('0x48')];_0x1cfee3[_0x91ca('0x49')]=_[_0x91ca('0x4a')](_0x1b0c83[_0x91ca('0x2f')]['recipientsDescription'])?null:_0x1b0c83['body']['recipientsDescription'];_0x1cfee3[_0x91ca('0x4b')]=_0x1b0c83[_0x91ca('0x2f')][_0x91ca('0x4b')]||![];_0x1cfee3[_0x91ca('0x4c')]=_0x1b0c83[_0x91ca('0x41')]['id'];return getContent(_0x1b0c83[_0x91ca('0x2f')])[_0x91ca('0x28')](function(_0x37c37b){_0x1cfee3[_0x91ca('0x2f')]=_0x37c37b;return getRecipients(_0x368f32);})[_0x91ca('0x28')](function(_0x1f5bc0){_0x1cfee3[_0x91ca('0x4d')]=_[_0x91ca('0x4e')](_0x1f5bc0)[_0x91ca('0x4f')](',');return db['sequelize'][_0x91ca('0x50')](function(_0x2b0cc2){return db[_0x91ca('0x51')][_0x91ca('0x52')](_0x1cfee3,{'raw':!![],'transaction':_0x2b0cc2})[_0x91ca('0x28')](function(_0x26b518){var _0x476335={'sender':_0x1cfee3[_0x91ca('0x47')],'description':_0x1cfee3[_0x91ca('0x49')],'content':_0x1cfee3[_0x91ca('0x2f')],'beep':_0x1cfee3[_0x91ca('0x4b')]};_0x1f5bc0[_0x91ca('0x53')](function(_0xdaf8a4){_0x476335['recipient']=_0xdaf8a4;socket['emit']('userNotification:send',_0x476335);});return _0x26b518;});});})['then'](respondWithResult(_0x46695,0xc9))[_0x91ca('0x54')](handleError(_0x46695,null));};function getContent(_0x50b2fc){return new BPromise(function(_0x2139ef,_0x112c2f){if(_0x50b2fc[_0x91ca('0x31')]){_0x2139ef(_0x50b2fc[_0x91ca('0x31')]);return;}return db[_0x91ca('0x55')][_0x91ca('0x56')]({'attributes':['html'],'where':{'id':_0x50b2fc[_0x91ca('0x32')]},'raw':!![]})[_0x91ca('0x28')](function(_0x4032d8){if(!_0x4032d8)throw new db[(_0x91ca('0x36'))]['ValidationError'](_0x91ca('0x57'));var _0x41a8ca=Mustache[_0x91ca('0x58')](_0x4032d8[_0x91ca('0x59')],_0x50b2fc['view']);_0x2139ef(_0x41a8ca);})[_0x91ca('0x54')](function(_0x27c9b7){_0x112c2f(_0x27c9b7);});});}function getRecipients(_0x20a5e8){return new BPromise(function(_0x12155b,_0x1144c2){var _0x43af94=[];var _0x3883f4=[];_0x20a5e8[_0x91ca('0x53')](function(_0x5ddb2c){var _0x10b98f=_[_0x91ca('0x5a')](_0x5ddb2c['model'][_0x91ca('0x45')]());if(_0x10b98f==='User'){_0x43af94=_['union'](_0x43af94,_0x5ddb2c[_0x91ca('0x5b')]);}else{if(_[_0x91ca('0x43')](_0x10b98f,_0x91ca('0x5c')))_0x10b98f=_0x10b98f[_0x91ca('0x5d')]('queue','Queue');_0x5ddb2c[_0x91ca('0x5b')][_0x91ca('0x53')](function(_0x552e27){_0x3883f4['push'](getAgents(_0x10b98f,_0x552e27));});}});return BPromise[_0x91ca('0x5e')](_0x3883f4)[_0x91ca('0x28')](function(_0x343cbd){_0x43af94=_[_0x91ca('0x5f')](_0x43af94,_[_0x91ca('0x60')](_0x343cbd));_0x12155b(_0x43af94);})[_0x91ca('0x54')](function(_0x3bd7fe){_0x1144c2(_0x3bd7fe);});});}function getAgents(_0x5c85ef,_0x3be449){return new BPromise(function(_0xb33dc4,_0x1af07d){return db[_0x5c85ef][_0x91ca('0x56')]({'where':{'id':_0x3be449}})[_0x91ca('0x28')](function(_0x34836e){return _0x34836e[_0x91ca('0x61')]({'attributes':['id'],'raw':!![]})[_0x91ca('0x28')](function(_0x20da38){var _0x45cee7=_['map'](_0x20da38,'id');_0xb33dc4(_0x45cee7);});})[_0x91ca('0x54')](function(_0x54e618){_0x1af07d(_0x54e618);});});} \ No newline at end of file +var _0xa96a=['papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./userNotification.socket','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','sendUserNotification','hasOwnProperty','body','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Sequelize','Missing\x20\x27recipients\x27\x20parameter','recipients','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','openchannelqueue','voicequeue','team','user','some','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','beep','SenderId','recipientsId','sortBy','sequelize','transaction','UserNotification','create','forEach','emit','text','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','catch','User','union','ids','queue','replace','all','flatten','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x1b8ffe,_0x819fb){var _0x3a1c1b=function(_0x3b1dfa){while(--_0x3b1dfa){_0x1b8ffe['push'](_0x1b8ffe['shift']());}};_0x3a1c1b(++_0x819fb);}(_0xa96a,0x188));var _0xaa96=function(_0x475cd1,_0x427791){_0x475cd1=_0x475cd1-0x0;var _0x475ffb=_0xa96a[_0x475cd1];return _0x475ffb;};'use strict';var emlformat=require(_0xaa96('0x0'));var rimraf=require(_0xaa96('0x1'));var zipdir=require(_0xaa96('0x2'));var jsonpatch=require(_0xaa96('0x3'));var rp=require(_0xaa96('0x4'));var moment=require(_0xaa96('0x5'));var BPromise=require(_0xaa96('0x6'));var Mustache=require(_0xaa96('0x7'));var util=require(_0xaa96('0x8'));var path=require(_0xaa96('0x9'));var sox=require(_0xaa96('0xa'));var csv=require(_0xaa96('0xb'));var ejs=require(_0xaa96('0xc'));var fs=require('fs');var fs_extra=require(_0xaa96('0xd'));var _=require(_0xaa96('0xe'));var squel=require(_0xaa96('0xf'));var crypto=require(_0xaa96('0x10'));var jsforce=require(_0xaa96('0x11'));var deskjs=require(_0xaa96('0x12'));var toCsv=require(_0xaa96('0xb'));var querystring=require(_0xaa96('0x13'));var Papa=require(_0xaa96('0x14'));var Redis=require(_0xaa96('0x15'));var authService=require(_0xaa96('0x16'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaa96('0x17'));var logger=require(_0xaa96('0x18'))(_0xaa96('0x19'));var utils=require(_0xaa96('0x1a'));var config=require(_0xaa96('0x1b'));var licenseUtil=require(_0xaa96('0x1c'));var db=require(_0xaa96('0x1d'))['db'];config['redis']=_[_0xaa96('0x1e')](config[_0xaa96('0x1f')],{'host':'localhost','port':0x18eb});var socket=require(_0xaa96('0x20'))(new Redis(config[_0xaa96('0x1f')]));require(_0xaa96('0x21'))['register'](socket);function respondWithStatusCode(_0xb66540,_0x3bc748){_0x3bc748=_0x3bc748||0xcc;return function(_0x243481){if(_0x243481){return _0xb66540[_0xaa96('0x22')](_0x3bc748);}return _0xb66540[_0xaa96('0x23')](_0x3bc748)[_0xaa96('0x24')]();};}function respondWithResult(_0x3b1e80,_0x2a383b){_0x2a383b=_0x2a383b||0xc8;return function(_0x4f4e5d){if(_0x4f4e5d){return _0x3b1e80['status'](_0x2a383b)[_0xaa96('0x25')](_0x4f4e5d);}};}function respondWithFilteredResult(_0x2554b7,_0x21cea8){return function(_0x3c9111){if(_0x3c9111){var _0x201845=typeof _0x21cea8[_0xaa96('0x26')]===_0xaa96('0x27')&&typeof _0x21cea8[_0xaa96('0x28')]===_0xaa96('0x27');var _0xf9e247=_0x3c9111['count'];var _0x5b744c=_0x201845?0x0:_0x21cea8[_0xaa96('0x26')];var _0x49c46c=_0x201845?_0x3c9111[_0xaa96('0x29')]:_0x21cea8[_0xaa96('0x26')]+_0x21cea8['limit'];var _0x4b706a;if(_0x49c46c>=_0xf9e247){_0x49c46c=_0xf9e247;_0x4b706a=0xc8;}else{_0x4b706a=0xce;}_0x2554b7[_0xaa96('0x23')](_0x4b706a);return _0x2554b7['set'](_0xaa96('0x2a'),_0x5b744c+'-'+_0x49c46c+'/'+_0xf9e247)[_0xaa96('0x25')](_0x3c9111);}return null;};}function patchUpdates(_0x1f7845){return function(_0x4f25db){try{jsonpatch[_0xaa96('0x2b')](_0x4f25db,_0x1f7845,!![]);}catch(_0x57fe0f){return BPromise[_0xaa96('0x2c')](_0x57fe0f);}return _0x4f25db[_0xaa96('0x2d')]();};}function saveUpdates(_0x225d2b,_0x4ad272){return function(_0x4976a0){if(_0x4976a0){return _0x4976a0[_0xaa96('0x2e')](_0x225d2b)[_0xaa96('0x2f')](function(_0x14f0fd){return _0x14f0fd;});}return null;};}function removeEntity(_0x13452c,_0x122c7d){return function(_0x24d03d){if(_0x24d03d){return _0x24d03d[_0xaa96('0x30')]()[_0xaa96('0x2f')](function(){_0x13452c[_0xaa96('0x23')](0xcc)[_0xaa96('0x24')]();});}};}function handleEntityNotFound(_0x42dfc9,_0x51497a){return function(_0x251cdb){if(!_0x251cdb){_0x42dfc9['sendStatus'](0x194);}return _0x251cdb;};}function handleError(_0x57c77c,_0x117390){_0x117390=_0x117390||0x1f4;return function(_0x14518a){logger[_0xaa96('0x31')](_0x14518a[_0xaa96('0x32')]);if(_0x14518a[_0xaa96('0x33')]){delete _0x14518a[_0xaa96('0x33')];}_0x57c77c[_0xaa96('0x23')](_0x117390)[_0xaa96('0x34')](_0x14518a);};}exports[_0xaa96('0x35')]=function(_0x1ced43,_0x5b0916,_0x3bd229){if(!_0x1ced43['body'][_0xaa96('0x36')]('text')&&!_0x1ced43[_0xaa96('0x37')][_0xaa96('0x36')](_0xaa96('0x38'))){throw new db['Sequelize'][(_0xaa96('0x39'))](_0xaa96('0x3a'));}else{if(_0x1ced43[_0xaa96('0x37')][_0xaa96('0x36')](_0xaa96('0x38'))&&!_0x1ced43[_0xaa96('0x37')][_0xaa96('0x36')](_0xaa96('0x3b'))){throw new db[(_0xaa96('0x3c'))][(_0xaa96('0x39'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x1ced43['body']['hasOwnProperty']('recipients')){throw new db[(_0xaa96('0x3c'))][(_0xaa96('0x39'))](_0xaa96('0x3d'));}else{try{var _0x52ae1a=JSON['parse'](_0x1ced43[_0xaa96('0x37')][_0xaa96('0x3e')]);}catch(_0x251b9d){logger[_0xaa96('0x31')](_0x251b9d);throw new db[(_0xaa96('0x3c'))][(_0xaa96('0x39'))](_0xaa96('0x3f'));}var _0x1964d2=[_0xaa96('0x40'),_0xaa96('0x41'),'mailqueue',_0xaa96('0x42'),'smsqueue',_0xaa96('0x43'),'whatsappqueue',_0xaa96('0x44'),_0xaa96('0x45')];if(_[_0xaa96('0x46')](_0x52ae1a,function(_0x54faf3){return!_['includes'](_0x1964d2,_0x54faf3[_0xaa96('0x47')][_0xaa96('0x48')]());})){throw new db['Sequelize'][(_0xaa96('0x39'))](_0xaa96('0x49'));}}}var _0x1e7f6f={};_0x1e7f6f[_0xaa96('0x4a')]=_0x1ced43[_0xaa96('0x37')][_0xaa96('0x36')](_0xaa96('0x4a'))?_0x1ced43[_0xaa96('0x37')][_0xaa96('0x4a')]:_0x1ced43[_0xaa96('0x45')][_0xaa96('0x4b')];_0x1e7f6f[_0xaa96('0x4c')]=_['isEmpty'](_0x1ced43['body'][_0xaa96('0x4c')])?null:_0x1ced43['body'][_0xaa96('0x4c')];_0x1e7f6f[_0xaa96('0x4d')]=_0x1ced43[_0xaa96('0x37')][_0xaa96('0x4d')]||![];_0x1e7f6f[_0xaa96('0x4e')]=_0x1ced43[_0xaa96('0x45')]['id'];return getContent(_0x1ced43[_0xaa96('0x37')])['then'](function(_0x83062a){_0x1e7f6f[_0xaa96('0x37')]=_0x83062a;return getRecipients(_0x52ae1a);})['then'](function(_0x379bbe){_0x1e7f6f[_0xaa96('0x4f')]=_[_0xaa96('0x50')](_0x379bbe)['join'](',');return db[_0xaa96('0x51')][_0xaa96('0x52')](function(_0x45e7b5){return db[_0xaa96('0x53')][_0xaa96('0x54')](_0x1e7f6f,{'raw':!![],'transaction':_0x45e7b5})['then'](function(_0x211c31){var _0x265836={'sender':_0x1e7f6f[_0xaa96('0x4a')],'description':_0x1e7f6f[_0xaa96('0x4c')],'content':_0x1e7f6f[_0xaa96('0x37')],'beep':_0x1e7f6f[_0xaa96('0x4d')]};_0x379bbe[_0xaa96('0x55')](function(_0x4467af){_0x265836['recipient']=_0x4467af;socket[_0xaa96('0x56')]('userNotification:send',_0x265836);});return _0x211c31;});});})['then'](respondWithResult(_0x5b0916,0xc9))['catch'](handleError(_0x5b0916,null));};function getContent(_0x38e43d){return new BPromise(function(_0x46eb6f,_0x832f37){if(_0x38e43d[_0xaa96('0x57')]){_0x46eb6f(_0x38e43d[_0xaa96('0x57')]);return;}return db[_0xaa96('0x58')][_0xaa96('0x59')]({'attributes':[_0xaa96('0x5a')],'where':{'id':_0x38e43d[_0xaa96('0x38')]},'raw':!![]})['then'](function(_0x6cdea3){if(!_0x6cdea3)throw new db[(_0xaa96('0x3c'))][(_0xaa96('0x39'))](_0xaa96('0x5b'));var _0x3e2905=Mustache[_0xaa96('0x5c')](_0x6cdea3[_0xaa96('0x5a')],_0x38e43d['view']);_0x46eb6f(_0x3e2905);})[_0xaa96('0x5d')](function(_0x2fddfb){_0x832f37(_0x2fddfb);});});}function getRecipients(_0x3b5010){return new BPromise(function(_0x34f14c,_0x457c52){var _0x280492=[];var _0x1b596e=[];_0x3b5010[_0xaa96('0x55')](function(_0x4dd9dd){var _0x1f4b4d=_['startCase'](_0x4dd9dd[_0xaa96('0x47')][_0xaa96('0x48')]());if(_0x1f4b4d===_0xaa96('0x5e')){_0x280492=_[_0xaa96('0x5f')](_0x280492,_0x4dd9dd[_0xaa96('0x60')]);}else{if(_['includes'](_0x1f4b4d,_0xaa96('0x61')))_0x1f4b4d=_0x1f4b4d[_0xaa96('0x62')]('queue','Queue');_0x4dd9dd[_0xaa96('0x60')][_0xaa96('0x55')](function(_0x47d57b){_0x1b596e['push'](getAgents(_0x1f4b4d,_0x47d57b));});}});return BPromise[_0xaa96('0x63')](_0x1b596e)[_0xaa96('0x2f')](function(_0x4d1585){_0x280492=_['union'](_0x280492,_[_0xaa96('0x64')](_0x4d1585));_0x34f14c(_0x280492);})['catch'](function(_0x4ef06e){_0x457c52(_0x4ef06e);});});}function getAgents(_0x3c8635,_0x4a4f98){return new BPromise(function(_0x4a48cc,_0x1d9761){return db[_0x3c8635][_0xaa96('0x59')]({'where':{'id':_0x4a4f98}})[_0xaa96('0x2f')](function(_0x4cf50){return _0x4cf50[_0xaa96('0x65')]({'attributes':['id'],'raw':!![]})['then'](function(_0x26e75d){var _0x583c6b=_[_0xaa96('0x66')](_0x26e75d,'id');_0x4a48cc(_0x583c6b);});})[_0xaa96('0x5d')](function(_0x3e4a0c){_0x1d9761(_0x3e4a0c);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 355961b..ac7d5d6 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 _0x7e42=['UserNotification','setMaxListeners','update','emit','hook','exports','events','../../mysqldb'];(function(_0x1aa281,_0x565c2b){var _0x5169d3=function(_0x5bc401){while(--_0x5bc401){_0x1aa281['push'](_0x1aa281['shift']());}};_0x5169d3(++_0x565c2b);}(_0x7e42,0x15e));var _0x27e4=function(_0x155869,_0xb6951a){_0x155869=_0x155869-0x0;var _0x46a686=_0x7e42[_0x155869];return _0x46a686;};'use strict';var EventEmitter=require(_0x27e4('0x0'));var UserNotification=require(_0x27e4('0x1'))['db'][_0x27e4('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x27e4('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x27e4('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4ce8b9){return function(_0x26da35,_0x77005e,_0x5a68ee){UserNotificationEvents[_0x27e4('0x5')](_0x4ce8b9+':'+_0x26da35['id'],_0x26da35);UserNotificationEvents[_0x27e4('0x5')](_0x4ce8b9,_0x26da35);_0x5a68ee(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0x27e4('0x6')](e,emitEvent(event));}}module[_0x27e4('0x7')]=UserNotificationEvents; \ No newline at end of file +var _0x7bd0=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserNotification','setMaxListeners'];(function(_0x204a47,_0x1cd473){var _0x314a06=function(_0x4b1fab){while(--_0x4b1fab){_0x204a47['push'](_0x204a47['shift']());}};_0x314a06(++_0x1cd473);}(_0x7bd0,0x71));var _0x07bd=function(_0x37c8ef,_0x334449){_0x37c8ef=_0x37c8ef-0x0;var _0x5eaee9=_0x7bd0[_0x37c8ef];return _0x5eaee9;};'use strict';var EventEmitter=require(_0x07bd('0x0'));var UserNotification=require(_0x07bd('0x1'))['db'][_0x07bd('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x07bd('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x07bd('0x4')};function emitEvent(_0x47b039){return function(_0x149860,_0x168387,_0x5d26f2){UserNotificationEvents[_0x07bd('0x5')](_0x47b039+':'+_0x149860['id'],_0x149860);UserNotificationEvents['emit'](_0x47b039,_0x149860);_0x5d26f2(null);};}for(var e in events){if(events[_0x07bd('0x6')](e)){var event=events[e];UserNotification[_0x07bd('0x7')](e,emitEvent(event));}}module[_0x07bd('0x8')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index a49b028..36d64a7 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 _0x80fa=['request-promise','path','../../config/environment','./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4de003,_0x1677e9){var _0x2875b9=function(_0x686fda){while(--_0x686fda){_0x4de003['push'](_0x4de003['shift']());}};_0x2875b9(++_0x1677e9);}(_0x80fa,0x18a));var _0xa80f=function(_0x2afe18,_0x1951c9){_0x2afe18=_0x2afe18-0x0;var _0xb1051d=_0x80fa[_0x2afe18];return _0xb1051d;};'use strict';var _=require(_0xa80f('0x0'));var util=require(_0xa80f('0x1'));var logger=require(_0xa80f('0x2'))(_0xa80f('0x3'));var moment=require(_0xa80f('0x4'));var BPromise=require(_0xa80f('0x5'));var rp=require(_0xa80f('0x6'));var fs=require('fs');var path=require(_0xa80f('0x7'));var rimraf=require('rimraf');var config=require(_0xa80f('0x8'));var attributes=require(_0xa80f('0x9'));module[_0xa80f('0xa')]=function(_0x4bae07,_0x52b315){return _0x4bae07[_0xa80f('0xb')](_0xa80f('0xc'),attributes,{'tableName':_0xa80f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa80f('0xe'),'collate':_0xa80f('0xf')});}; \ No newline at end of file +var _0xff0c=['lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x485196,_0xd584d8){var _0x1ee3c2=function(_0x5b7e7f){while(--_0x5b7e7f){_0x485196['push'](_0x485196['shift']());}};_0x1ee3c2(++_0xd584d8);}(_0xff0c,0x142));var _0xcff0=function(_0x9e0cb3,_0x9cd497){_0x9e0cb3=_0x9e0cb3-0x0;var _0x5926b7=_0xff0c[_0x9e0cb3];return _0x5926b7;};'use strict';var _=require(_0xcff0('0x0'));var util=require('util');var logger=require(_0xcff0('0x1'))('api');var moment=require(_0xcff0('0x2'));var BPromise=require('bluebird');var rp=require(_0xcff0('0x3'));var fs=require('fs');var path=require(_0xcff0('0x4'));var rimraf=require(_0xcff0('0x5'));var config=require(_0xcff0('0x6'));var attributes=require(_0xcff0('0x7'));module[_0xcff0('0x8')]=function(_0x2abae3,_0x14d92e){return _0x2abae3[_0xcff0('0x9')](_0xcff0('0xa'),attributes,{'tableName':_0xcff0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcff0('0xc'),'collate':_0xcff0('0xd')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index cd5842e..11acc10 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 _0x22c7=['then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./userNotification.socket','register','request'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x22c7,0xb2));var _0x722c=function(_0x116739,_0x5b3dc5){_0x116739=_0x116739-0x0;var _0x46afdb=_0x22c7[_0x116739];return _0x46afdb;};'use strict';var _=require(_0x722c('0x0'));var util=require(_0x722c('0x1'));var moment=require(_0x722c('0x2'));var BPromise=require(_0x722c('0x3'));var rs=require(_0x722c('0x4'));var fs=require('fs');var Redis=require(_0x722c('0x5'));var db=require(_0x722c('0x6'))['db'];var utils=require(_0x722c('0x7'));var logger=require(_0x722c('0x8'))('rpc');var config=require(_0x722c('0x9'));var jayson=require(_0x722c('0xa'));var client=jayson[_0x722c('0xb')]['http']({'port':0x232a});config[_0x722c('0xc')]=_[_0x722c('0xd')](config[_0x722c('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x722c('0xe'))(new Redis(config['redis']));require(_0x722c('0xf'))[_0x722c('0x10')](socket);function respondWithRpcPromise(_0x2c087a,_0x7c8f14,_0x5b3e58){return new BPromise(function(_0x44db39,_0x1821a6){return client[_0x722c('0x11')](_0x2c087a,_0x5b3e58)[_0x722c('0x12')](function(_0x4e2ca1){logger[_0x722c('0x13')](_0x722c('0x14'),_0x7c8f14,_0x722c('0x15'));logger[_0x722c('0x16')](_0x722c('0x17'),_0x7c8f14,_0x722c('0x15'),JSON[_0x722c('0x18')](_0x4e2ca1));if(_0x4e2ca1['error']){if(_0x4e2ca1[_0x722c('0x19')]['code']===0x1f4){logger[_0x722c('0x19')](_0x722c('0x14'),_0x7c8f14,_0x4e2ca1[_0x722c('0x19')][_0x722c('0x1a')]);return _0x1821a6(_0x4e2ca1[_0x722c('0x19')][_0x722c('0x1a')]);}logger['error'](_0x722c('0x14'),_0x7c8f14,_0x4e2ca1[_0x722c('0x19')]['message']);return _0x44db39(_0x4e2ca1[_0x722c('0x19')][_0x722c('0x1a')]);}else{logger[_0x722c('0x13')]('UserNotification,\x20%s,\x20%s',_0x7c8f14,_0x722c('0x15'));_0x44db39(_0x4e2ca1['result'][_0x722c('0x1a')]);}})[_0x722c('0x1b')](function(_0x2ba15a){logger[_0x722c('0x19')](_0x722c('0x14'),_0x7c8f14,_0x2ba15a);_0x1821a6(_0x2ba15a);});});} \ No newline at end of file +var _0xde14=['request','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','code','error','message','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','client','http','localhost','socket.io-emitter','redis','./userNotification.socket','register'];(function(_0x37e845,_0x219f9f){var _0x59e55b=function(_0x5dc6c8){while(--_0x5dc6c8){_0x37e845['push'](_0x37e845['shift']());}};_0x59e55b(++_0x219f9f);}(_0xde14,0x11e));var _0x4de1=function(_0x35e5d1,_0x26ca68){_0x35e5d1=_0x35e5d1-0x0;var _0x5eca29=_0xde14[_0x35e5d1];return _0x5eca29;};'use strict';var _=require('lodash');var util=require(_0x4de1('0x0'));var moment=require(_0x4de1('0x1'));var BPromise=require(_0x4de1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4de1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4de1('0x4'));var logger=require(_0x4de1('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4de1('0x6')][_0x4de1('0x7')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x4de1('0x8'),'port':0x18eb});var socket=require(_0x4de1('0x9'))(new Redis(config[_0x4de1('0xa')]));require(_0x4de1('0xb'))[_0x4de1('0xc')](socket);function respondWithRpcPromise(_0x262724,_0x29234b,_0x5c015b){return new BPromise(function(_0x9404a9,_0x3fb07e){return client[_0x4de1('0xd')](_0x262724,_0x5c015b)['then'](function(_0x31ae73){logger[_0x4de1('0xe')](_0x4de1('0xf'),_0x29234b,_0x4de1('0x10'));logger[_0x4de1('0x11')](_0x4de1('0x12'),_0x29234b,_0x4de1('0x10'),JSON['stringify'](_0x31ae73));if(_0x31ae73['error']){if(_0x31ae73['error'][_0x4de1('0x13')]===0x1f4){logger[_0x4de1('0x14')](_0x4de1('0xf'),_0x29234b,_0x31ae73[_0x4de1('0x14')][_0x4de1('0x15')]);return _0x3fb07e(_0x31ae73['error']['message']);}logger[_0x4de1('0x14')](_0x4de1('0xf'),_0x29234b,_0x31ae73['error']['message']);return _0x9404a9(_0x31ae73['error']['message']);}else{logger[_0x4de1('0xe')](_0x4de1('0xf'),_0x29234b,'request\x20sent');_0x9404a9(_0x31ae73['result'][_0x4de1('0x15')]);}})[_0x4de1('0x16')](function(_0x1f783f){logger['error']('UserNotification,\x20%s,\x20%s',_0x29234b,_0x1f783f);_0x3fb07e(_0x1f783f);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 0c8ae49..472945b 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 _0x2437=['emit','register','save','remove','update'];(function(_0x4b1665,_0xb0c095){var _0x5850c0=function(_0x44b7a4){while(--_0x44b7a4){_0x4b1665['push'](_0x4b1665['shift']());}};_0x5850c0(++_0xb0c095);}(_0x2437,0x98));var _0x7243=function(_0x5998d9,_0x2aab99){_0x5998d9=_0x5998d9-0x0;var _0x3d7dd6=_0x2437[_0x5998d9];return _0x3d7dd6;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0x7243('0x0'),_0x7243('0x1'),_0x7243('0x2')];function createListener(_0x184c9a,_0x509dbc){return function(_0x2c88ce){_0x509dbc[_0x7243('0x3')](_0x184c9a,_0x2c88ce);};}function removeListener(_0x1df57d,_0x1a78ae){return function(){UserNotificationEvents['removeListener'](_0x1df57d,_0x1a78ae);};}exports[_0x7243('0x4')]=function(_0xf18937){for(var _0x4162c2=0x0,_0x20e65c=events['length'];_0x4162c2<_0x20e65c;_0x4162c2++){var _0x5c050a=events[_0x4162c2];var _0x24842e=createListener('userNotification:'+_0x5c050a,_0xf18937);UserNotificationEvents['on'](_0x5c050a,_0x24842e);}}; \ No newline at end of file +var _0x3538=['emit','register','length','./userNotification.events','save','remove','update'];(function(_0x5179a5,_0x419746){var _0x15c8ce=function(_0x1b13c4){while(--_0x1b13c4){_0x5179a5['push'](_0x5179a5['shift']());}};_0x15c8ce(++_0x419746);}(_0x3538,0x88));var _0x8353=function(_0x12f9c4,_0x3fc12c){_0x12f9c4=_0x12f9c4-0x0;var _0x3c0b16=_0x3538[_0x12f9c4];return _0x3c0b16;};'use strict';var UserNotificationEvents=require(_0x8353('0x0'));var events=[_0x8353('0x1'),_0x8353('0x2'),_0x8353('0x3')];function createListener(_0x59b0c1,_0x4f8ce6){return function(_0x2c8b8a){_0x4f8ce6[_0x8353('0x4')](_0x59b0c1,_0x2c8b8a);};}function removeListener(_0x38014f,_0x4ad0a9){return function(){UserNotificationEvents['removeListener'](_0x38014f,_0x4ad0a9);};}exports[_0x8353('0x5')]=function(_0x5765e7){for(var _0xfb1ce1=0x0,_0x27fb29=events[_0x8353('0x6')];_0xfb1ce1<_0x27fb29;_0xfb1ce1++){var _0x43f0ff=events[_0xfb1ce1];var _0x4af4a6=createListener('userNotification:'+_0x43f0ff,_0x5765e7);UserNotificationEvents['on'](_0x43f0ff,_0x4af4a6);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 9a1d692..25c96dc 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(_0x1818f4,_0x598dd3){var _0x546d98=function(_0x100a04){while(--_0x100a04){_0x1818f4['push'](_0x1818f4['shift']());}};_0x546d98(++_0x598dd3);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x371cb7,_0x46566d){var _0xb50075=function(_0xc5ce29){while(--_0xc5ce29){_0x371cb7['push'](_0x371cb7['shift']());}};_0xb50075(++_0x46566d);}(_0xe706,0xa3));var _0x6e70=function(_0x136e11,_0x29bd0b){_0x136e11=_0x136e11-0x0;var _0x36d346=_0xe706[_0x136e11];return _0x36d346;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 09cbdeb..0b7a5e2 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 _0xf380=['exports'];(function(_0x57e563,_0x410311){var _0x829e2b=function(_0x571cf2){while(--_0x571cf2){_0x57e563['push'](_0x57e563['shift']());}};_0x829e2b(++_0x410311);}(_0xf380,0xb9));var _0x0f38=function(_0x36cf8c,_0xc45aec){_0x36cf8c=_0x36cf8c-0x0;var _0x4a3d59=_0xf380[_0x36cf8c];return _0x4a3d59;};'use strict';var Sequelize=require('sequelize');module[_0x0f38('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xfab5=['INTEGER','exports'];(function(_0x34e4ab,_0x193e14){var _0x5a2466=function(_0xf5d9fb){while(--_0xf5d9fb){_0x34e4ab['push'](_0x34e4ab['shift']());}};_0x5a2466(++_0x193e14);}(_0xfab5,0x199));var _0x5fab=function(_0x462bdc,_0x1556d2){_0x462bdc=_0x462bdc-0x0;var _0x5815e5=_0xfab5[_0x462bdc];return _0x5815e5;};'use strict';var Sequelize=require('sequelize');module[_0x5fab('0x0')]={'penalty':{'type':Sequelize[_0x5fab('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 0a4a5a3..731fa8a 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 _0xc64d=['../../config/logger','api','bluebird','path','./userOpenchannelQueue.attributes','exports','define','user_has_openchannel_queues','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc64d,0x80));var _0xdc64=function(_0x3e3ce5,_0x106769){_0x3e3ce5=_0x3e3ce5-0x0;var _0x1b2e22=_0xc64d[_0x3e3ce5];return _0x1b2e22;};'use strict';var _=require(_0xdc64('0x0'));var util=require(_0xdc64('0x1'));var logger=require(_0xdc64('0x2'))(_0xdc64('0x3'));var moment=require('moment');var BPromise=require(_0xdc64('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdc64('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xdc64('0x6'));module[_0xdc64('0x7')]=function(_0x210ae4,_0x42ccd2){return _0x210ae4[_0xdc64('0x8')]('UserOpenchannelQueue',attributes,{'tableName':_0xdc64('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x16c4=['request-promise','path','rimraf','./userOpenchannelQueue.attributes','exports','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3d4876,_0x366386){var _0x58ca9d=function(_0x5bd045){while(--_0x5bd045){_0x3d4876['push'](_0x3d4876['shift']());}};_0x58ca9d(++_0x366386);}(_0x16c4,0xd7));var _0x416c=function(_0x37a7c6,_0x3a84b6){_0x37a7c6=_0x37a7c6-0x0;var _0x539905=_0x16c4[_0x37a7c6];return _0x539905;};'use strict';var _=require(_0x416c('0x0'));var util=require(_0x416c('0x1'));var logger=require(_0x416c('0x2'))(_0x416c('0x3'));var moment=require(_0x416c('0x4'));var BPromise=require(_0x416c('0x5'));var rp=require(_0x416c('0x6'));var fs=require('fs');var path=require(_0x416c('0x7'));var rimraf=require(_0x416c('0x8'));var config=require('../../config/environment');var attributes=require(_0x416c('0x9'));module[_0x416c('0xa')]=function(_0x29ec57,_0x30fb8f){return _0x29ec57['define'](_0x416c('0xb'),attributes,{'tableName':_0x416c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 2eabce8..766877f 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 _0xb545=['jayson/promise','client','http','then','info','UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment'];(function(_0x2be01d,_0x5e7bae){var _0x2918a9=function(_0x1bd70e){while(--_0x1bd70e){_0x2be01d['push'](_0x2be01d['shift']());}};_0x2918a9(++_0x5e7bae);}(_0xb545,0x1c3));var _0x5b54=function(_0x23e5a4,_0xa29853){_0x23e5a4=_0x23e5a4-0x0;var _0x1b0d0a=_0xb545[_0x23e5a4];return _0x1b0d0a;};'use strict';var _=require(_0x5b54('0x0'));var util=require(_0x5b54('0x1'));var moment=require(_0x5b54('0x2'));var BPromise=require(_0x5b54('0x3'));var rs=require(_0x5b54('0x4'));var fs=require('fs');var Redis=require(_0x5b54('0x5'));var db=require(_0x5b54('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5b54('0x7'))('rpc');var config=require(_0x5b54('0x8'));var jayson=require(_0x5b54('0x9'));var client=jayson[_0x5b54('0xa')][_0x5b54('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x93f3ad,_0x3b148b,_0x34c67c){return new BPromise(function(_0x5cc11c,_0x56e0b8){return client['request'](_0x93f3ad,_0x34c67c)[_0x5b54('0xc')](function(_0x2496cd){logger[_0x5b54('0xd')](_0x5b54('0xe'),_0x3b148b,'request\x20sent');logger[_0x5b54('0xf')](_0x5b54('0x10'),_0x3b148b,_0x5b54('0x11'),JSON[_0x5b54('0x12')](_0x2496cd));if(_0x2496cd['error']){if(_0x2496cd[_0x5b54('0x13')]['code']===0x1f4){logger[_0x5b54('0x13')](_0x5b54('0xe'),_0x3b148b,_0x2496cd[_0x5b54('0x13')][_0x5b54('0x14')]);return _0x56e0b8(_0x2496cd['error'][_0x5b54('0x14')]);}logger[_0x5b54('0x13')](_0x5b54('0xe'),_0x3b148b,_0x2496cd['error']['message']);return _0x5cc11c(_0x2496cd[_0x5b54('0x13')][_0x5b54('0x14')]);}else{logger['info'](_0x5b54('0xe'),_0x3b148b,_0x5b54('0x11'));_0x5cc11c(_0x2496cd[_0x5b54('0x15')]['message']);}})[_0x5b54('0x16')](function(_0x43a9c8){logger[_0x5b54('0x13')](_0x5b54('0xe'),_0x3b148b,_0x43a9c8);_0x56e0b8(_0x43a9c8);});});} \ No newline at end of file +var _0x02e1=['../../mysqldb','rpc','../../config/environment','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x57db49,_0x288094){var _0xd0636f=function(_0x227787){while(--_0x227787){_0x57db49['push'](_0x57db49['shift']());}};_0xd0636f(++_0x288094);}(_0x02e1,0x72));var _0x102e=function(_0x34157,_0x5e44ac){_0x34157=_0x34157-0x0;var _0x569681=_0x02e1[_0x34157];return _0x569681;};'use strict';var _=require(_0x102e('0x0'));var util=require(_0x102e('0x1'));var moment=require(_0x102e('0x2'));var BPromise=require(_0x102e('0x3'));var rs=require(_0x102e('0x4'));var fs=require('fs');var Redis=require(_0x102e('0x5'));var db=require(_0x102e('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x102e('0x7'));var config=require(_0x102e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x102e('0x9')][_0x102e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x336d27,_0x456c61,_0x380482){return new BPromise(function(_0x210671,_0x2a99aa){return client[_0x102e('0xb')](_0x336d27,_0x380482)[_0x102e('0xc')](function(_0x5cbe9e){logger[_0x102e('0xd')](_0x102e('0xe'),_0x456c61,_0x102e('0xf'));logger[_0x102e('0x10')](_0x102e('0x11'),_0x456c61,_0x102e('0xf'),JSON[_0x102e('0x12')](_0x5cbe9e));if(_0x5cbe9e['error']){if(_0x5cbe9e[_0x102e('0x13')][_0x102e('0x14')]===0x1f4){logger[_0x102e('0x13')](_0x102e('0xe'),_0x456c61,_0x5cbe9e[_0x102e('0x13')][_0x102e('0x15')]);return _0x2a99aa(_0x5cbe9e[_0x102e('0x13')][_0x102e('0x15')]);}logger['error'](_0x102e('0xe'),_0x456c61,_0x5cbe9e['error'][_0x102e('0x15')]);return _0x210671(_0x5cbe9e['error'][_0x102e('0x15')]);}else{logger[_0x102e('0xd')](_0x102e('0xe'),_0x456c61,'request\x20sent');_0x210671(_0x5cbe9e[_0x102e('0x16')][_0x102e('0x15')]);}})[_0x102e('0x17')](function(_0x17e91b){logger['error'](_0x102e('0xe'),_0x456c61,_0x17e91b);_0x2a99aa(_0x17e91b);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index c48978a..d6fc3b0 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 _0xb8a5=['fs-extra','../../components/auth/service','../../components/interaction/service','./userProfile.controller','get','isAuthenticated','index','/describe','show','/:id/resources','post','/:id/clone','clone','/:id/sections','addSections','addResources','put','/:id','update','delete','destroy','removeSections','removeResources','exports','multer','util','connect-timeout','express','Router'];(function(_0xa656ef,_0x3d31df){var _0x20e81=function(_0x128119){while(--_0x128119){_0xa656ef['push'](_0xa656ef['shift']());}};_0x20e81(++_0x3d31df);}(_0xb8a5,0xc6));var _0x5b8a=function(_0x206780,_0x3f69f1){_0x206780=_0x206780-0x0;var _0x23c400=_0xb8a5[_0x206780];return _0x23c400;};'use strict';var multer=require(_0x5b8a('0x0'));var util=require(_0x5b8a('0x1'));var path=require('path');var timeout=require(_0x5b8a('0x2'));var express=require(_0x5b8a('0x3'));var router=express[_0x5b8a('0x4')]();var fs_extra=require(_0x5b8a('0x5'));var auth=require(_0x5b8a('0x6'));var interaction=require(_0x5b8a('0x7'));var config=require('../../config/environment');var controller=require(_0x5b8a('0x8'));router[_0x5b8a('0x9')]('/',auth[_0x5b8a('0xa')](),controller[_0x5b8a('0xb')]);router[_0x5b8a('0x9')](_0x5b8a('0xc'),auth[_0x5b8a('0xa')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x5b8a('0xd')]);router[_0x5b8a('0x9')]('/:id/sections',auth[_0x5b8a('0xa')](),controller['getSections']);router[_0x5b8a('0x9')](_0x5b8a('0xe'),auth['isAuthenticated'](),controller['getResources']);router[_0x5b8a('0xf')]('/',auth[_0x5b8a('0xa')](),controller['create']);router[_0x5b8a('0xf')](_0x5b8a('0x10'),auth['isAuthenticated'](),controller[_0x5b8a('0x11')]);router[_0x5b8a('0xf')](_0x5b8a('0x12'),auth[_0x5b8a('0xa')](),controller[_0x5b8a('0x13')]);router[_0x5b8a('0xf')](_0x5b8a('0xe'),auth[_0x5b8a('0xa')](),controller[_0x5b8a('0x14')]);router[_0x5b8a('0x15')](_0x5b8a('0x16'),auth[_0x5b8a('0xa')](),controller[_0x5b8a('0x17')]);router[_0x5b8a('0x18')]('/:id',auth[_0x5b8a('0xa')](),controller[_0x5b8a('0x19')]);router[_0x5b8a('0x18')]('/:id/sections',auth[_0x5b8a('0xa')](),controller[_0x5b8a('0x1a')]);router[_0x5b8a('0x18')](_0x5b8a('0xe'),auth['isAuthenticated'](),controller[_0x5b8a('0x1b')]);module[_0x5b8a('0x1c')]=router; \ No newline at end of file +var _0x63f6=['/:id','show','/:id/sections','getSections','/:id/resources','getResources','post','create','addResources','put','delete','destroy','removeSections','removeResources','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x3fbc9e,_0x517bc2){var _0x4fe0a0=function(_0x474454){while(--_0x474454){_0x3fbc9e['push'](_0x3fbc9e['shift']());}};_0x4fe0a0(++_0x517bc2);}(_0x63f6,0xf7));var _0x663f=function(_0x5326df,_0x4babd6){_0x5326df=_0x5326df-0x0;var _0x6a86fd=_0x63f6[_0x5326df];return _0x6a86fd;};'use strict';var multer=require('multer');var util=require(_0x663f('0x0'));var path=require(_0x663f('0x1'));var timeout=require(_0x663f('0x2'));var express=require(_0x663f('0x3'));var router=express[_0x663f('0x4')]();var fs_extra=require(_0x663f('0x5'));var auth=require(_0x663f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x663f('0x7'));var controller=require(_0x663f('0x8'));router[_0x663f('0x9')]('/',auth[_0x663f('0xa')](),controller[_0x663f('0xb')]);router[_0x663f('0x9')](_0x663f('0xc'),auth['isAuthenticated'](),controller[_0x663f('0xd')]);router[_0x663f('0x9')](_0x663f('0xe'),auth[_0x663f('0xa')](),controller[_0x663f('0xf')]);router[_0x663f('0x9')](_0x663f('0x10'),auth[_0x663f('0xa')](),controller[_0x663f('0x11')]);router['get'](_0x663f('0x12'),auth[_0x663f('0xa')](),controller[_0x663f('0x13')]);router[_0x663f('0x14')]('/',auth[_0x663f('0xa')](),controller[_0x663f('0x15')]);router[_0x663f('0x14')]('/:id/clone',auth['isAuthenticated'](),controller['clone']);router[_0x663f('0x14')](_0x663f('0x10'),auth['isAuthenticated'](),controller['addSections']);router[_0x663f('0x14')](_0x663f('0x12'),auth[_0x663f('0xa')](),controller[_0x663f('0x16')]);router[_0x663f('0x17')](_0x663f('0xe'),auth[_0x663f('0xa')](),controller['update']);router[_0x663f('0x18')](_0x663f('0xe'),auth[_0x663f('0xa')](),controller[_0x663f('0x19')]);router['delete'](_0x663f('0x10'),auth[_0x663f('0xa')](),controller[_0x663f('0x1a')]);router[_0x663f('0x18')]('/:id/resources',auth[_0x663f('0xa')](),controller[_0x663f('0x1b')]);module[_0x663f('0x1c')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 693e832..69a11fd 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 _0xd7b2=['getDataValue','crudPermissions','split','BOOLEAN','sequelize','exports','STRING','name','setDataValue','join'];(function(_0x27ba36,_0x3f66a8){var _0x765b76=function(_0x301c5d){while(--_0x301c5d){_0x27ba36['push'](_0x27ba36['shift']());}};_0x765b76(++_0x3f66a8);}(_0xd7b2,0x13a));var _0x2d7b=function(_0x4c6956,_0x49e832){_0x4c6956=_0x4c6956-0x0;var _0x24a82f=_0xd7b2[_0x4c6956];return _0x24a82f;};'use strict';var Sequelize=require(_0x2d7b('0x0'));module[_0x2d7b('0x1')]={'name':{'type':Sequelize[_0x2d7b('0x2')],'allowNull':![],'unique':_0x2d7b('0x3')},'crudPermissions':{'type':Sequelize[_0x2d7b('0x2')],'set':function(_0x338b22){this[_0x2d7b('0x4')]('crudPermissions',_0x338b22?_0x338b22[_0x2d7b('0x5')](''):[]);},'get':function(){return this[_0x2d7b('0x6')](_0x2d7b('0x7'))?this['getDataValue'](_0x2d7b('0x7'))[_0x2d7b('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x2d7b('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x2d7b('0x9')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x2d7b('0x9')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x2d7b('0x9')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x2d7b('0x9')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x2d7b('0x9')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x2d7b('0x9')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xca79=['STRING','setDataValue','crudPermissions','getDataValue','BOOLEAN','sequelize'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0xca79,0x149));var _0x9ca7=function(_0x526173,_0x30044a){_0x526173=_0x526173-0x0;var _0x500264=_0xca79[_0x526173];return _0x500264;};'use strict';var Sequelize=require(_0x9ca7('0x0'));module['exports']={'name':{'type':Sequelize[_0x9ca7('0x1')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x9ca7('0x1')],'set':function(_0x51400a){this[_0x9ca7('0x2')](_0x9ca7('0x3'),_0x51400a?_0x51400a['join'](''):[]);},'get':function(){return this[_0x9ca7('0x4')](_0x9ca7('0x3'))?this[_0x9ca7('0x4')](_0x9ca7('0x3'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x9ca7('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x9ca7('0x5')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x9ca7('0x5')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x9ca7('0x5')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x9ca7('0x5')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x9ca7('0x5')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 39f3a28..c4f3674 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 _0xd983=['UserProfileResource','sectionId','userProfileId','Resources','update','describe','transaction','push','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','register','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','error','stack','name','index','map','UserProfile','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','then','includeAll','include','rows','show','params','options','find','catch','create','body','get','omit','createdAt','updatedAt','crudPermissions','sequelize','UserProfileSection','findAll','each','autoAssociation'];(function(_0x28e62d,_0x3fcc98){var _0x24f1bc=function(_0x36d56a){while(--_0x36d56a){_0x28e62d['push'](_0x28e62d['shift']());}};_0x24f1bc(++_0x3fcc98);}(_0xd983,0x1df));var _0x3d98=function(_0x4f16f7,_0x1bdf3b){_0x4f16f7=_0x4f16f7-0x0;var _0x3f5198=_0xd983[_0x4f16f7];return _0x3f5198;};'use strict';var emlformat=require(_0x3d98('0x0'));var rimraf=require(_0x3d98('0x1'));var zipdir=require(_0x3d98('0x2'));var jsonpatch=require(_0x3d98('0x3'));var rp=require(_0x3d98('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3d98('0x5'));var util=require(_0x3d98('0x6'));var path=require(_0x3d98('0x7'));var sox=require(_0x3d98('0x8'));var csv=require(_0x3d98('0x9'));var ejs=require(_0x3d98('0xa'));var fs=require('fs');var fs_extra=require(_0x3d98('0xb'));var _=require('lodash');var squel=require(_0x3d98('0xc'));var crypto=require(_0x3d98('0xd'));var jsforce=require(_0x3d98('0xe'));var deskjs=require(_0x3d98('0xf'));var toCsv=require(_0x3d98('0x9'));var querystring=require(_0x3d98('0x10'));var Papa=require(_0x3d98('0x11'));var Redis=require(_0x3d98('0x12'));var authService=require(_0x3d98('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3d98('0x14'));var logger=require(_0x3d98('0x15'))(_0x3d98('0x16'));var utils=require(_0x3d98('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3d98('0x18'))['db'];config[_0x3d98('0x19')]=_[_0x3d98('0x1a')](config[_0x3d98('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x3d98('0x1b'))(new Redis(config[_0x3d98('0x19')]));require('./userProfile.socket')[_0x3d98('0x1c')](socket);function respondWithStatusCode(_0x566423,_0x2e1b11){_0x2e1b11=_0x2e1b11||0xcc;return function(_0x4fc94d){if(_0x4fc94d){return _0x566423['sendStatus'](_0x2e1b11);}return _0x566423[_0x3d98('0x1d')](_0x2e1b11)[_0x3d98('0x1e')]();};}function respondWithResult(_0x23867a,_0x57b493){_0x57b493=_0x57b493||0xc8;return function(_0x1e6408){if(_0x1e6408){return _0x23867a[_0x3d98('0x1d')](_0x57b493)['json'](_0x1e6408);}};}function respondWithFilteredResult(_0x2f1843,_0x245e94){return function(_0x4e2a73){if(_0x4e2a73){var _0xb63af3=typeof _0x245e94[_0x3d98('0x1f')]===_0x3d98('0x20')&&typeof _0x245e94[_0x3d98('0x21')]===_0x3d98('0x20');var _0x55c620=_0x4e2a73[_0x3d98('0x22')];var _0xe407f2=_0xb63af3?0x0:_0x245e94[_0x3d98('0x1f')];var _0x35a40f=_0xb63af3?_0x4e2a73['count']:_0x245e94[_0x3d98('0x1f')]+_0x245e94[_0x3d98('0x21')];var _0x39c884;if(_0x35a40f>=_0x55c620){_0x35a40f=_0x55c620;_0x39c884=0xc8;}else{_0x39c884=0xce;}_0x2f1843['status'](_0x39c884);return _0x2f1843[_0x3d98('0x23')](_0x3d98('0x24'),_0xe407f2+'-'+_0x35a40f+'/'+_0x55c620)['json'](_0x4e2a73);}return null;};}function patchUpdates(_0x54f448){return function(_0xf7a6cc){try{jsonpatch[_0x3d98('0x25')](_0xf7a6cc,_0x54f448,!![]);}catch(_0x4c4cf8){return BPromise[_0x3d98('0x26')](_0x4c4cf8);}return _0xf7a6cc[_0x3d98('0x27')]();};}function saveUpdates(_0x366702,_0x245ffa){return function(_0x5264e0){if(_0x5264e0){return _0x5264e0['update'](_0x366702)['then'](function(_0x229809){return _0x229809;});}return null;};}function removeEntity(_0x5a2067,_0x30692c){return function(_0x867f85){if(_0x867f85){return _0x867f85[_0x3d98('0x28')]()['then'](function(){_0x5a2067[_0x3d98('0x1d')](0xcc)[_0x3d98('0x1e')]();});}};}function handleEntityNotFound(_0x2bb81,_0x2dca32){return function(_0x4409ff){if(!_0x4409ff){_0x2bb81['sendStatus'](0x194);}return _0x4409ff;};}function handleError(_0x29c14f,_0x105679){_0x105679=_0x105679||0x1f4;return function(_0x4bd15a){logger[_0x3d98('0x29')](_0x4bd15a[_0x3d98('0x2a')]);if(_0x4bd15a[_0x3d98('0x2b')]){delete _0x4bd15a['name'];}_0x29c14f[_0x3d98('0x1d')](_0x105679)['send'](_0x4bd15a);};}exports[_0x3d98('0x2c')]=function(_0x1cfbf4,_0x26df3c){var _0x2d6bf0={},_0x5390e5={},_0x2aee8a={'count':0x0,'rows':[]};var _0x1b393e=_[_0x3d98('0x2d')](db[_0x3d98('0x2e')][_0x3d98('0x2f')],function(_0xfca729){return{'name':_0xfca729[_0x3d98('0x30')],'type':_0xfca729[_0x3d98('0x31')]['key']};});_0x5390e5[_0x3d98('0x32')]=_[_0x3d98('0x2d')](_0x1b393e,_0x3d98('0x2b'));_0x5390e5[_0x3d98('0x33')]=_['keys'](_0x1cfbf4['query']);_0x5390e5[_0x3d98('0x34')]=_['intersection'](_0x5390e5[_0x3d98('0x32')],_0x5390e5['query']);_0x2d6bf0['attributes']=_[_0x3d98('0x35')](_0x5390e5[_0x3d98('0x32')],qs['fields'](_0x1cfbf4[_0x3d98('0x33')][_0x3d98('0x36')]));_0x2d6bf0[_0x3d98('0x37')]=_0x2d6bf0[_0x3d98('0x37')][_0x3d98('0x38')]?_0x2d6bf0[_0x3d98('0x37')]:_0x5390e5[_0x3d98('0x32')];if(!_0x1cfbf4[_0x3d98('0x33')][_0x3d98('0x39')](_0x3d98('0x3a'))){_0x2d6bf0['limit']=qs[_0x3d98('0x21')](_0x1cfbf4[_0x3d98('0x33')][_0x3d98('0x21')]);_0x2d6bf0['offset']=qs['offset'](_0x1cfbf4[_0x3d98('0x33')][_0x3d98('0x1f')]);}_0x2d6bf0['order']=qs[_0x3d98('0x3b')](_0x1cfbf4['query']['sort']);_0x2d6bf0[_0x3d98('0x3c')]=qs[_0x3d98('0x34')](_[_0x3d98('0x3d')](_0x1cfbf4[_0x3d98('0x33')],_0x5390e5[_0x3d98('0x34')]),_0x1b393e);if(_0x1cfbf4[_0x3d98('0x33')][_0x3d98('0x3e')]){_0x2d6bf0[_0x3d98('0x3c')]=_[_0x3d98('0x3f')](_0x2d6bf0[_0x3d98('0x3c')],{'$or':_[_0x3d98('0x2d')](_0x1b393e,function(_0x55eb11){if(_0x55eb11[_0x3d98('0x31')]!==_0x3d98('0x40')){var _0x13bb82={};_0x13bb82[_0x55eb11[_0x3d98('0x2b')]]={'$like':'%'+_0x1cfbf4[_0x3d98('0x33')]['filter']+'%'};return _0x13bb82;}})});}_0x2d6bf0=_[_0x3d98('0x3f')]({},_0x2d6bf0,_0x1cfbf4['options']);var _0x5155d6={'where':_0x2d6bf0[_0x3d98('0x3c')]};return db[_0x3d98('0x2e')][_0x3d98('0x22')](_0x5155d6)[_0x3d98('0x41')](function(_0x498a8e){_0x2aee8a[_0x3d98('0x22')]=_0x498a8e;if(_0x1cfbf4[_0x3d98('0x33')][_0x3d98('0x42')]){_0x2d6bf0[_0x3d98('0x43')]=[{'all':!![]}];}return db['UserProfile']['findAll'](_0x2d6bf0);})[_0x3d98('0x41')](function(_0x821856){_0x2aee8a[_0x3d98('0x44')]=_0x821856;return _0x2aee8a;})[_0x3d98('0x41')](respondWithFilteredResult(_0x26df3c,_0x2d6bf0))['catch'](handleError(_0x26df3c,null));};exports[_0x3d98('0x45')]=function(_0x514efc,_0x18d0e3){var _0x2805e6={'raw':![],'where':{'id':_0x514efc[_0x3d98('0x46')]['id']}},_0x1dc504={};_0x1dc504[_0x3d98('0x32')]=_['keys'](db['UserProfile'][_0x3d98('0x2f')]);_0x1dc504[_0x3d98('0x33')]=_['keys'](_0x514efc[_0x3d98('0x33')]);_0x1dc504[_0x3d98('0x34')]=_['intersection'](_0x1dc504[_0x3d98('0x32')],_0x1dc504[_0x3d98('0x33')]);_0x2805e6[_0x3d98('0x37')]=_[_0x3d98('0x35')](_0x1dc504[_0x3d98('0x32')],qs[_0x3d98('0x36')](_0x514efc[_0x3d98('0x33')][_0x3d98('0x36')]));_0x2805e6[_0x3d98('0x37')]=_0x2805e6['attributes']['length']?_0x2805e6[_0x3d98('0x37')]:_0x1dc504[_0x3d98('0x32')];if(_0x514efc['query'][_0x3d98('0x42')]){_0x2805e6[_0x3d98('0x43')]=[{'all':!![]}];}_0x2805e6=_[_0x3d98('0x3f')]({},_0x2805e6,_0x514efc[_0x3d98('0x47')]);return db['UserProfile'][_0x3d98('0x48')](_0x2805e6)[_0x3d98('0x41')](handleEntityNotFound(_0x18d0e3,null))[_0x3d98('0x41')](respondWithResult(_0x18d0e3,null))[_0x3d98('0x49')](handleError(_0x18d0e3,null));};exports[_0x3d98('0x4a')]=function(_0x463027,_0x1798a5){return db[_0x3d98('0x2e')][_0x3d98('0x4a')](_0x463027[_0x3d98('0x4b')],{})[_0x3d98('0x41')](respondWithResult(_0x1798a5,0xc9))[_0x3d98('0x49')](handleError(_0x1798a5,null));};exports['clone']=function(_0x1245ab,_0x3c1b91){var _0xb2456={'where':{'id':_0x1245ab[_0x3d98('0x46')]['id']}},_0x89b09c={};_0x89b09c[_0x3d98('0x32')]=_['keys'](db['UserProfile']['rawAttributes']);_0xb2456[_0x3d98('0x37')]=_[_0x3d98('0x35')](_0x89b09c['model'],qs[_0x3d98('0x36')](_0x1245ab['query'][_0x3d98('0x36')]));_0xb2456['attributes']=_0xb2456[_0x3d98('0x37')]['length']?_0xb2456['attributes']:_0x89b09c[_0x3d98('0x32')];if(_0x1245ab[_0x3d98('0x33')]['includeAll']){_0xb2456['include']=[{'all':!![]}];}_0xb2456=_[_0x3d98('0x3f')]({},_0xb2456,_0x1245ab['options']);return db[_0x3d98('0x2e')][_0x3d98('0x48')](_0xb2456)['then'](handleEntityNotFound(_0x3c1b91,null))[_0x3d98('0x41')](function(_0x2e6348){if(_0x2e6348){var _0x1bb559=_0x2e6348[_0x3d98('0x4c')]({'plain':!![]});_0x1bb559=qs[_0x3d98('0x4d')](_0x1bb559,['id',_0x3d98('0x4e'),_0x3d98('0x4f'),_0x3d98('0x50')]);_0x1245ab[_0x3d98('0x4b')]=_[_0x3d98('0x4d')](_0x1245ab['body'],['id',_0x3d98('0x4e'),'updatedAt']);return db[_0x3d98('0x51')]['transaction'](function(_0x5a0226){return db[_0x3d98('0x2e')][_0x3d98('0x4a')](_[_0x3d98('0x3f')](_0x1bb559,_0x1245ab[_0x3d98('0x4b')]),{'include':_0x1245ab[_0x3d98('0x33')][_0x3d98('0x42')]?[{'all':!![]}]:undefined,'transaction':_0x5a0226})[_0x3d98('0x41')](function(_0x1469f6){var _0x429e66=_0x1469f6['get']({'plain':!![]});return db[_0x3d98('0x52')][_0x3d98('0x53')]({'where':{'userProfileId':_0x1245ab[_0x3d98('0x46')]['id']},'raw':!![]})[_0x3d98('0x41')](function(_0x5b74a9){if(_0x5b74a9){return BPromise[_0x3d98('0x54')](_0x5b74a9,function(_0x2ee695){return new BPromise(function(_0x3289e2,_0x5a3e27){if(_0x2ee695['autoAssociation']===null||_0x2ee695[_0x3d98('0x55')]===0x1)_0x3289e2(null);return db[_0x3d98('0x56')][_0x3d98('0x53')]({'where':{'sectionId':_0x2ee695['id']},'raw':!![]})['then'](function(_0x4459db){var _0x54efd0=_[_0x3d98('0x2d')](_0x4459db,function(_0xc51b6a){return qs[_0x3d98('0x4d')](_0xc51b6a,['id',_0x3d98('0x4e'),_0x3d98('0x4f'),_0x3d98('0x57')]);});_0x3289e2(_0x54efd0);})['catch'](function(_0x239992){_0x5a3e27(_0x239992);});})[_0x3d98('0x41')](function(_0x5a9a77){var _0x308167=qs[_0x3d98('0x4d')](_0x2ee695,['id',_0x3d98('0x4e'),_0x3d98('0x4f')]);_0x308167[_0x3d98('0x58')]=_0x429e66['id'];if(_0x5a9a77)_0x308167[_0x3d98('0x59')]=_0x5a9a77;return _0x308167;})[_0x3d98('0x41')](function(_0x175773){return db[_0x3d98('0x52')][_0x3d98('0x4a')](_0x175773,{'include':[{'model':db[_0x3d98('0x56')],'as':_0x3d98('0x59')}],'raw':!![],'transaction':_0x5a0226});});})[_0x3d98('0x41')](function(){return _0x429e66;});}});});});}})[_0x3d98('0x41')](respondWithResult(_0x3c1b91,0xc9))[_0x3d98('0x49')](handleError(_0x3c1b91,null));};exports[_0x3d98('0x5a')]=function(_0x30ea1a,_0x199776){if(_0x30ea1a[_0x3d98('0x4b')]['id']){delete _0x30ea1a[_0x3d98('0x4b')]['id'];}return db[_0x3d98('0x2e')][_0x3d98('0x48')]({'where':{'id':_0x30ea1a['params']['id']}})['then'](handleEntityNotFound(_0x199776,null))[_0x3d98('0x41')](saveUpdates(_0x30ea1a['body'],null))[_0x3d98('0x41')](respondWithResult(_0x199776,null))[_0x3d98('0x49')](handleError(_0x199776,null));};exports['destroy']=function(_0xf4a5fb,_0x73964){return db[_0x3d98('0x2e')]['find']({'where':{'id':_0xf4a5fb[_0x3d98('0x46')]['id']}})[_0x3d98('0x41')](handleEntityNotFound(_0x73964,null))[_0x3d98('0x41')](removeEntity(_0x73964,null))['catch'](handleError(_0x73964,null));};exports[_0x3d98('0x5b')]=function(_0x3f0010,_0x5dd1e3){return db[_0x3d98('0x2e')][_0x3d98('0x5b')]()['then'](respondWithResult(_0x5dd1e3,null))['catch'](handleError(_0x5dd1e3,null));};exports['addSections']=function(_0x528b51,_0x5393fe){var _0x437630=_0x528b51[_0x3d98('0x4b')];return db[_0x3d98('0x2e')][_0x3d98('0x48')]({'where':{'id':_0x528b51[_0x3d98('0x46')]['id']}})[_0x3d98('0x41')](handleEntityNotFound(_0x5393fe,null))[_0x3d98('0x41')](function(_0x421404){if(_0x421404){return db[_0x3d98('0x51')][_0x3d98('0x5c')](function(_0x6df858){return db[_0x3d98('0x52')]['destroy']({'where':{'userProfileId':_0x528b51['params']['id'],'sectionId':_[_0x3d98('0x2d')](_0x437630,function(_0x5b1184){return _0x5b1184[_0x3d98('0x57')];})},'transaction':_0x6df858})['then'](function(){var _0x8d97b9=_['map'](_0x437630,function(_0x14be0b){_0x14be0b[_0x3d98('0x58')]=_0x528b51[_0x3d98('0x46')]['id'];return _0x14be0b;});var _0x481951=[];return BPromise['each'](_0x8d97b9,function(_0x30c08b){return db['UserProfileSection'][_0x3d98('0x4a')](_0x30c08b,{'include':[{'model':db['UserProfileResource'],'as':_0x3d98('0x59')}],'raw':!![],'transaction':_0x6df858})[_0x3d98('0x41')](function(_0x33f7f3){_0x481951[_0x3d98('0x5d')](_0x33f7f3[_0x3d98('0x4c')]({'plain':!![]}));});})['then'](function(){return _0x481951;});});});}})[_0x3d98('0x41')](function(_0x382ac7){return _0x382ac7;})[_0x3d98('0x41')](respondWithResult(_0x5393fe,null))[_0x3d98('0x49')](handleError(_0x5393fe,null));};exports[_0x3d98('0x5e')]=function(_0x194bdb,_0x4fe38a){var _0x466bf6;return db[_0x3d98('0x2e')][_0x3d98('0x48')]({'where':{'id':_0x194bdb[_0x3d98('0x46')]['id']},'attributes':['id','name']})[_0x3d98('0x41')](handleEntityNotFound(_0x4fe38a,null))[_0x3d98('0x41')](function(_0x3fd06a){if(_0x3fd06a){_0x466bf6=_0x3fd06a;return db['UserProfileSection'][_0x3d98('0x28')]({'where':{'userProfileId':_0x194bdb[_0x3d98('0x46')]['id'],'sectionId':_0x194bdb[_0x3d98('0x33')][_0x3d98('0x5f')]}});}})[_0x3d98('0x41')](function(){return _0x466bf6;})[_0x3d98('0x41')](respondWithStatusCode(_0x4fe38a,null))['catch'](handleError(_0x4fe38a,null));};exports[_0x3d98('0x60')]=function(_0xdf90cb,_0x201734){var _0xf2de19=[];var _0x53a659=[];return db[_0x3d98('0x52')][_0x3d98('0x53')]({'where':{'userProfileId':_0xdf90cb['params']['id']},'raw':!![]})[_0x3d98('0x41')](function(_0x1b9183){_0xf2de19=_['filter'](_0x1b9183,function(_0x2ebbf9){return _0x2ebbf9[_0x3d98('0x61')]===0x1||_[_0x3d98('0x62')]([0x3eb,0x709],_0x2ebbf9[_0x3d98('0x57')]);});if(!_[_0x3d98('0x63')](_0xf2de19)){return _[_0x3d98('0x2d')](_0xf2de19,function(_0x3eafa3){return _0x3eafa3[_0x3d98('0x57')];});}else{return;}})[_0x3d98('0x41')](function(_0x5d8c52){if(_0x5d8c52)_0x53a659=_0x5d8c52;if(_[_0x3d98('0x62')](_0x53a659,0x64)){var _0x75c4ec=_[_0x3d98('0x48')](_0xf2de19,{'sectionId':0x64});return hasDefaultDashboard(_0x75c4ec)[_0x3d98('0x41')](function(_0x2d68f7){return _['map'](_0xf2de19,function(_0x31de15){if(_0x31de15[_0x3d98('0x57')]===0x64){_0x31de15[_0x3d98('0x64')]=_0x2d68f7;}return _0x31de15;});});}else{return;}})[_0x3d98('0x41')](function(_0x126e91){if(_0x126e91)_0xf2de19=_0x126e91;if(_['includes'](_0x53a659,0x3eb)){var _0x20416b=_[_0x3d98('0x48')](_0xf2de19,{'sectionId':0x3eb});return getCustomDashboards(_0x20416b)[_0x3d98('0x41')](function(_0x22235b){return _[_0x3d98('0x2d')](_0xf2de19,function(_0x19c42c){if(_0x20416b[_0x3d98('0x61')]){if(_0x19c42c[_0x3d98('0x57')]===0x3eb){_0x19c42c['subsections']=_0x22235b;}}else{if(_0x19c42c['sectionId']===0x64){_0x19c42c['subsections']=_0x22235b;}}return _0x19c42c;});});}else{return;}})[_0x3d98('0x41')](function(_0x250afd){if(_0x250afd)_0xf2de19=_0x250afd;if(_['includes'](_0x53a659,0x709)){var _0x5a75e9=_[_0x3d98('0x48')](_0xf2de19,{'sectionId':0x709});return getPlugins(_0x5a75e9)[_0x3d98('0x41')](function(_0x3a451d){if(_0x5a75e9[_0x3d98('0x61')]){return _[_0x3d98('0x2d')](_0xf2de19,function(_0x518d2b){if(_0x518d2b[_0x3d98('0x57')]===0x709){_0x518d2b['subsections']=_0x3a451d;}return _0x518d2b;});}else{var _0x584e70={'sectionId':0x76c,'enabled':0x1,'subsections':_0x3a451d};var _0x2ca405=_['map'](_0xf2de19);_0x2ca405[_0x3d98('0x5d')](_0x584e70);return _0x2ca405;}});}else{return;}})[_0x3d98('0x41')](function(_0x49ef96){if(_0x49ef96)_0xf2de19=_0x49ef96;return _[_0x3d98('0x3e')](_0xf2de19,[_0x3d98('0x61'),0x1]);})['then'](respondWithResult(_0x201734,null))[_0x3d98('0x49')](handleError(_0x201734,null));};function hasDefaultDashboard(_0x479d06){var _0x510e39=[0x65];return new BPromise(function(_0x4f632a,_0x4e9fee){try{if(_0x479d06['autoAssociation']){_0x4f632a(_0x510e39);}else{return db[_0x3d98('0x56')][_0x3d98('0x65')]({'where':{'sectionId':_0x479d06['id']},'raw':!![]})[_0x3d98('0x41')](function(_0x6abcfe){_0x6abcfe?_0x4f632a(_0x510e39):_0x4f632a();});}}catch(_0x2aff9a){_0x4e9fee(_0x2aff9a);}});}function getCustomDashboards(_0x3972c5){var _0x3fd666=[];return new BPromise(function(_0x579bf9,_0x4f3698){try{if(_0x3972c5[_0x3d98('0x55')]){return db[_0x3d98('0x66')][_0x3d98('0x53')]({'raw':!![]})['then'](function(_0x48119c){_0x48119c[_0x3d98('0x67')](function(_0x5bf589){_0x3fd666[_0x3d98('0x5d')](_0x5bf589['id']+0x1869f);});_0x579bf9(_0x3fd666);});}else{return db[_0x3d98('0x56')][_0x3d98('0x53')]({'where':{'sectionId':_0x3972c5['id']},'raw':!![]})['then'](function(_0x259786){_0x259786[_0x3d98('0x67')](function(_0x599078){_0x3fd666[_0x3d98('0x5d')](_0x599078[_0x3d98('0x68')]+0x1869f);});_0x579bf9(_0x3fd666);});}}catch(_0x390cfa){_0x4f3698(_0x390cfa);}});}function getPlugins(_0x28d791){var _0x26a559=[];return new BPromise(function(_0x5a23a5,_0x58433e){try{if(_0x28d791[_0x3d98('0x55')]){return db[_0x3d98('0x69')][_0x3d98('0x53')]({'raw':!![]})[_0x3d98('0x41')](function(_0x5f21f3){_0x5f21f3[_0x3d98('0x67')](function(_0x585617){_0x26a559[_0x3d98('0x5d')](_0x585617['id']+0x15b38);});_0x5a23a5(_0x26a559);});}else{return db['UserProfileResource'][_0x3d98('0x53')]({'where':{'sectionId':_0x28d791['id']},'raw':!![]})[_0x3d98('0x41')](function(_0x1f68e9){_0x1f68e9[_0x3d98('0x67')](function(_0x9cb261){_0x26a559[_0x3d98('0x5d')](_0x9cb261['resourceId']+0x15b38);});_0x5a23a5(_0x26a559);});}}catch(_0x2a16ef){_0x58433e(_0x2a16ef);}});}exports[_0x3d98('0x6a')]=function(_0x3e242a,_0x46b22b){return db[_0x3d98('0x2e')]['find']({'where':{'id':_0x3e242a[_0x3d98('0x46')]['id']}})[_0x3d98('0x41')](handleEntityNotFound(_0x46b22b,null))[_0x3d98('0x41')](function(_0x1d9ed6){if(_0x1d9ed6){return db[_0x3d98('0x51')][_0x3d98('0x5c')](function(_0x51a71e){return db[_0x3d98('0x52')]['findAll']({'where':{'userProfileId':_0x3e242a[_0x3d98('0x46')]['id']},'attributes':['id'],'raw':!![]})[_0x3d98('0x41')](function(_0x1d836e){if(_0x1d836e){return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x3e242a['params']['id'],'id':_['map'](_0x1d836e,function(_0x394b65){return _0x394b65['id'];})},'transaction':_0x51a71e});}})[_0x3d98('0x41')](function(_0x42a497){var _0xd25db0=_[_0x3d98('0x2d')](_0x3e242a[_0x3d98('0x4b')],function(_0x5d7b46){_0x5d7b46['userProfileId']=_0x3e242a[_0x3d98('0x46')]['id'];return _0x5d7b46;});return db[_0x3d98('0x52')][_0x3d98('0x6b')](_0xd25db0,{'raw':!![],'transaction':_0x51a71e});})['then'](function(_0x526e3c){var _0x25e72b=_[_0x3d98('0x3e')](_[_0x3d98('0x2d')](_0x526e3c,function(_0x532145){return _0x532145['get']({'plain':!![]});}),{'includeAll':![]});if(_0x25e72b){return db['UserProfileSection'][_0x3d98('0x53')]({'where':{'userProfileId':_0x3e242a[_0x3d98('0x46')]['id'],'sectionId':_['map'](_0x25e72b,function(_0x388143){return _0x388143[_0x3d98('0x57')];})},'attributes':['id',_0x3d98('0x57')],'raw':!![]})['then'](function(_0x2476cb){var _0x82f544=_[_0x3d98('0x2d')](_0x3e242a[_0x3d98('0x4b')],function(_0x10bcb0){_0x10bcb0[_0x3d98('0x58')]=_0x3e242a[_0x3d98('0x46')]['id'];return _0x10bcb0;});return db['UserProfileResource']['bulkCreate'](_0x82f544,{'raw':!![],'transaction':_0x51a71e});});}})[_0x3d98('0x49')](handleError(_0x46b22b,null));});}})['then'](function(_0x2a003d){var _0x2235ef=_['map'](_0x2a003d,function(_0x49db5a){return _0x49db5a[_0x3d98('0x4c')]({'plain':!![]});});})[_0x3d98('0x41')](respondWithResult(_0x46b22b,null))['catch'](handleError(_0x46b22b,null));};exports[_0x3d98('0x6c')]=function(_0xb67ce0,_0x487c80,_0x3254e7){return db[_0x3d98('0x2e')][_0x3d98('0x48')]({'where':{'id':_0xb67ce0[_0x3d98('0x46')]['id']}})[_0x3d98('0x41')](handleEntityNotFound(_0x487c80,null))[_0x3d98('0x41')](function(_0xe4cba5){if(_0xe4cba5){return _0xe4cba5[_0x3d98('0x6c')](_0xb67ce0[_0x3d98('0x33')][_0x3d98('0x5f')]);}})[_0x3d98('0x41')](respondWithStatusCode(_0x487c80,null))[_0x3d98('0x49')](handleError(_0x487c80,null));};exports['getResources']=function(_0xbb0d51,_0x587611){var _0x5a1b0a={};if(!_0xbb0d51['query'][_0x3d98('0x6d')])throw new Error(_0x3d98('0x6e'));if(!_0xbb0d51['query']['hasOwnProperty'](_0x3d98('0x3a'))){_0x5a1b0a['limit']=qs[_0x3d98('0x21')](_0xbb0d51['query'][_0x3d98('0x21')]);_0x5a1b0a['offset']=qs[_0x3d98('0x1f')](_0xbb0d51['query'][_0x3d98('0x1f')]);}return db[_0x3d98('0x2e')][_0x3d98('0x48')]({'where':{'id':_0xbb0d51['params']['id']}})[_0x3d98('0x41')](function(_0x338c8f){if(!_0x338c8f)throw new Error(_0x3d98('0x6f')+_0xbb0d51[_0x3d98('0x46')]['id']);return db['UserProfile'][_0x3d98('0x70')](_0xbb0d51);})[_0x3d98('0x41')](respondWithFilteredResult(_0x587611,_0x5a1b0a))[_0x3d98('0x49')](handleError(_0x587611,null));}; \ No newline at end of file +var _0xdef9=['each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','UserProfileSection','update','describe','push','removeSections','ids','getSections','enabled','includes','subsections','findOne','Dashboard','forEach','Plugin','resourceId','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','hasOwnProperty','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./userProfile.socket','register','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','error','name','index','map','UserProfile','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','clone','get','omit','createdAt','updatedAt','crudPermissions','body','sequelize','transaction'];(function(_0x1c029b,_0x1e288c){var _0x44a1a3=function(_0x55c12c){while(--_0x55c12c){_0x1c029b['push'](_0x1c029b['shift']());}};_0x44a1a3(++_0x1e288c);}(_0xdef9,0x1ed));var _0x9def=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xdef9[_0x110c3d];return _0x226d67;};'use strict';var emlformat=require(_0x9def('0x0'));var rimraf=require(_0x9def('0x1'));var zipdir=require(_0x9def('0x2'));var jsonpatch=require(_0x9def('0x3'));var rp=require(_0x9def('0x4'));var moment=require(_0x9def('0x5'));var BPromise=require(_0x9def('0x6'));var Mustache=require(_0x9def('0x7'));var util=require(_0x9def('0x8'));var path=require(_0x9def('0x9'));var sox=require(_0x9def('0xa'));var csv=require(_0x9def('0xb'));var ejs=require(_0x9def('0xc'));var fs=require('fs');var fs_extra=require(_0x9def('0xd'));var _=require(_0x9def('0xe'));var squel=require(_0x9def('0xf'));var crypto=require(_0x9def('0x10'));var jsforce=require(_0x9def('0x11'));var deskjs=require(_0x9def('0x12'));var toCsv=require('to-csv');var querystring=require(_0x9def('0x13'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9def('0x14'));var qs=require(_0x9def('0x15'));var as=require(_0x9def('0x16'));var hardwareService=require(_0x9def('0x17'));var logger=require('../../config/logger')(_0x9def('0x18'));var utils=require(_0x9def('0x19'));var config=require(_0x9def('0x1a'));var licenseUtil=require(_0x9def('0x1b'));var db=require('../../mysqldb')['db'];config[_0x9def('0x1c')]=_[_0x9def('0x1d')](config['redis'],{'host':_0x9def('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9def('0x1f'))[_0x9def('0x20')](socket);function respondWithStatusCode(_0x4649dd,_0x4d5f6b){_0x4d5f6b=_0x4d5f6b||0xcc;return function(_0x2f8f21){if(_0x2f8f21){return _0x4649dd['sendStatus'](_0x4d5f6b);}return _0x4649dd['status'](_0x4d5f6b)[_0x9def('0x21')]();};}function respondWithResult(_0x29dce4,_0x1e8da8){_0x1e8da8=_0x1e8da8||0xc8;return function(_0x40e44f){if(_0x40e44f){return _0x29dce4[_0x9def('0x22')](_0x1e8da8)[_0x9def('0x23')](_0x40e44f);}};}function respondWithFilteredResult(_0x162e7e,_0x39687f){return function(_0x2d3f63){if(_0x2d3f63){var _0x160711=typeof _0x39687f[_0x9def('0x24')]===_0x9def('0x25')&&typeof _0x39687f[_0x9def('0x26')]==='undefined';var _0x47150a=_0x2d3f63[_0x9def('0x27')];var _0x5b9828=_0x160711?0x0:_0x39687f[_0x9def('0x24')];var _0x4ddd1b=_0x160711?_0x2d3f63[_0x9def('0x27')]:_0x39687f['offset']+_0x39687f[_0x9def('0x26')];var _0x354f14;if(_0x4ddd1b>=_0x47150a){_0x4ddd1b=_0x47150a;_0x354f14=0xc8;}else{_0x354f14=0xce;}_0x162e7e['status'](_0x354f14);return _0x162e7e[_0x9def('0x28')](_0x9def('0x29'),_0x5b9828+'-'+_0x4ddd1b+'/'+_0x47150a)[_0x9def('0x23')](_0x2d3f63);}return null;};}function patchUpdates(_0x5a99ab){return function(_0x30274c){try{jsonpatch['apply'](_0x30274c,_0x5a99ab,!![]);}catch(_0x4366de){return BPromise[_0x9def('0x2a')](_0x4366de);}return _0x30274c[_0x9def('0x2b')]();};}function saveUpdates(_0x2e61e8,_0x494e88){return function(_0x1ee823){if(_0x1ee823){return _0x1ee823['update'](_0x2e61e8)[_0x9def('0x2c')](function(_0x19b4ea){return _0x19b4ea;});}return null;};}function removeEntity(_0x5f2846,_0x273779){return function(_0x21b4ee){if(_0x21b4ee){return _0x21b4ee[_0x9def('0x2d')]()['then'](function(){_0x5f2846['status'](0xcc)[_0x9def('0x21')]();});}};}function handleEntityNotFound(_0x2bfc62,_0x2dc7e5){return function(_0x45ebb1){if(!_0x45ebb1){_0x2bfc62['sendStatus'](0x194);}return _0x45ebb1;};}function handleError(_0x459428,_0xda3a7f){_0xda3a7f=_0xda3a7f||0x1f4;return function(_0x1aa212){logger[_0x9def('0x2e')](_0x1aa212['stack']);if(_0x1aa212['name']){delete _0x1aa212[_0x9def('0x2f')];}_0x459428[_0x9def('0x22')](_0xda3a7f)['send'](_0x1aa212);};}exports[_0x9def('0x30')]=function(_0x14f546,_0x4ba5f8){var _0x34818a={},_0x3c88fc={},_0x23daf3={'count':0x0,'rows':[]};var _0x22a7d3=_[_0x9def('0x31')](db[_0x9def('0x32')]['rawAttributes'],function(_0x34c554){return{'name':_0x34c554['fieldName'],'type':_0x34c554[_0x9def('0x33')][_0x9def('0x34')]};});_0x3c88fc[_0x9def('0x35')]=_[_0x9def('0x31')](_0x22a7d3,_0x9def('0x2f'));_0x3c88fc['query']=_[_0x9def('0x36')](_0x14f546[_0x9def('0x37')]);_0x3c88fc[_0x9def('0x38')]=_[_0x9def('0x39')](_0x3c88fc['model'],_0x3c88fc[_0x9def('0x37')]);_0x34818a[_0x9def('0x3a')]=_[_0x9def('0x39')](_0x3c88fc[_0x9def('0x35')],qs[_0x9def('0x3b')](_0x14f546[_0x9def('0x37')][_0x9def('0x3b')]));_0x34818a[_0x9def('0x3a')]=_0x34818a[_0x9def('0x3a')][_0x9def('0x3c')]?_0x34818a[_0x9def('0x3a')]:_0x3c88fc[_0x9def('0x35')];if(!_0x14f546[_0x9def('0x37')]['hasOwnProperty'](_0x9def('0x3d'))){_0x34818a[_0x9def('0x26')]=qs[_0x9def('0x26')](_0x14f546[_0x9def('0x37')][_0x9def('0x26')]);_0x34818a[_0x9def('0x24')]=qs['offset'](_0x14f546[_0x9def('0x37')][_0x9def('0x24')]);}_0x34818a['order']=qs['sort'](_0x14f546['query'][_0x9def('0x3e')]);_0x34818a[_0x9def('0x3f')]=qs[_0x9def('0x38')](_[_0x9def('0x40')](_0x14f546[_0x9def('0x37')],_0x3c88fc[_0x9def('0x38')]),_0x22a7d3);if(_0x14f546['query'][_0x9def('0x41')]){_0x34818a['where']=_[_0x9def('0x42')](_0x34818a[_0x9def('0x3f')],{'$or':_[_0x9def('0x31')](_0x22a7d3,function(_0x34b6f5){if(_0x34b6f5[_0x9def('0x33')]!=='VIRTUAL'){var _0x5e761b={};_0x5e761b[_0x34b6f5['name']]={'$like':'%'+_0x14f546['query']['filter']+'%'};return _0x5e761b;}})});}_0x34818a=_[_0x9def('0x42')]({},_0x34818a,_0x14f546['options']);var _0x25a51f={'where':_0x34818a[_0x9def('0x3f')]};return db[_0x9def('0x32')][_0x9def('0x27')](_0x25a51f)[_0x9def('0x2c')](function(_0x321843){_0x23daf3[_0x9def('0x27')]=_0x321843;if(_0x14f546[_0x9def('0x37')][_0x9def('0x43')]){_0x34818a[_0x9def('0x44')]=[{'all':!![]}];}return db[_0x9def('0x32')][_0x9def('0x45')](_0x34818a);})[_0x9def('0x2c')](function(_0x44ced8){_0x23daf3[_0x9def('0x46')]=_0x44ced8;return _0x23daf3;})[_0x9def('0x2c')](respondWithFilteredResult(_0x4ba5f8,_0x34818a))[_0x9def('0x47')](handleError(_0x4ba5f8,null));};exports[_0x9def('0x48')]=function(_0x2f7d51,_0x1923e5){var _0x6553aa={'raw':![],'where':{'id':_0x2f7d51[_0x9def('0x49')]['id']}},_0x169960={};_0x169960[_0x9def('0x35')]=_[_0x9def('0x36')](db['UserProfile'][_0x9def('0x4a')]);_0x169960[_0x9def('0x37')]=_[_0x9def('0x36')](_0x2f7d51[_0x9def('0x37')]);_0x169960[_0x9def('0x38')]=_[_0x9def('0x39')](_0x169960[_0x9def('0x35')],_0x169960[_0x9def('0x37')]);_0x6553aa[_0x9def('0x3a')]=_['intersection'](_0x169960[_0x9def('0x35')],qs[_0x9def('0x3b')](_0x2f7d51[_0x9def('0x37')][_0x9def('0x3b')]));_0x6553aa['attributes']=_0x6553aa['attributes'][_0x9def('0x3c')]?_0x6553aa[_0x9def('0x3a')]:_0x169960['model'];if(_0x2f7d51[_0x9def('0x37')][_0x9def('0x43')]){_0x6553aa['include']=[{'all':!![]}];}_0x6553aa=_['merge']({},_0x6553aa,_0x2f7d51[_0x9def('0x4b')]);return db[_0x9def('0x32')][_0x9def('0x4c')](_0x6553aa)[_0x9def('0x2c')](handleEntityNotFound(_0x1923e5,null))[_0x9def('0x2c')](respondWithResult(_0x1923e5,null))[_0x9def('0x47')](handleError(_0x1923e5,null));};exports[_0x9def('0x4d')]=function(_0x34cbfe,_0x283525){return db[_0x9def('0x32')][_0x9def('0x4d')](_0x34cbfe['body'],{})[_0x9def('0x2c')](respondWithResult(_0x283525,0xc9))[_0x9def('0x47')](handleError(_0x283525,null));};exports[_0x9def('0x4e')]=function(_0x539eba,_0x570797){var _0x3f8609={'where':{'id':_0x539eba[_0x9def('0x49')]['id']}},_0x191c05={};_0x191c05[_0x9def('0x35')]=_['keys'](db['UserProfile'][_0x9def('0x4a')]);_0x3f8609[_0x9def('0x3a')]=_[_0x9def('0x39')](_0x191c05[_0x9def('0x35')],qs['fields'](_0x539eba[_0x9def('0x37')][_0x9def('0x3b')]));_0x3f8609[_0x9def('0x3a')]=_0x3f8609[_0x9def('0x3a')][_0x9def('0x3c')]?_0x3f8609[_0x9def('0x3a')]:_0x191c05['model'];if(_0x539eba[_0x9def('0x37')][_0x9def('0x43')]){_0x3f8609[_0x9def('0x44')]=[{'all':!![]}];}_0x3f8609=_['merge']({},_0x3f8609,_0x539eba[_0x9def('0x4b')]);return db['UserProfile'][_0x9def('0x4c')](_0x3f8609)['then'](handleEntityNotFound(_0x570797,null))[_0x9def('0x2c')](function(_0x6f9e8b){if(_0x6f9e8b){var _0x388f52=_0x6f9e8b[_0x9def('0x4f')]({'plain':!![]});_0x388f52=qs[_0x9def('0x50')](_0x388f52,['id',_0x9def('0x51'),_0x9def('0x52'),_0x9def('0x53')]);_0x539eba[_0x9def('0x54')]=_[_0x9def('0x50')](_0x539eba['body'],['id',_0x9def('0x51'),_0x9def('0x52')]);return db[_0x9def('0x55')][_0x9def('0x56')](function(_0x2658c3){return db[_0x9def('0x32')][_0x9def('0x4d')](_['merge'](_0x388f52,_0x539eba[_0x9def('0x54')]),{'include':_0x539eba[_0x9def('0x37')][_0x9def('0x43')]?[{'all':!![]}]:undefined,'transaction':_0x2658c3})[_0x9def('0x2c')](function(_0xf8f6e6){var _0x272432=_0xf8f6e6[_0x9def('0x4f')]({'plain':!![]});return db['UserProfileSection'][_0x9def('0x45')]({'where':{'userProfileId':_0x539eba['params']['id']},'raw':!![]})[_0x9def('0x2c')](function(_0x3fc837){if(_0x3fc837){return BPromise[_0x9def('0x57')](_0x3fc837,function(_0xa976da){return new BPromise(function(_0x59ae3e,_0x2fe050){if(_0xa976da['autoAssociation']===null||_0xa976da[_0x9def('0x58')]===0x1)_0x59ae3e(null);return db[_0x9def('0x59')]['findAll']({'where':{'sectionId':_0xa976da['id']},'raw':!![]})[_0x9def('0x2c')](function(_0x4f9f24){var _0x261ade=_[_0x9def('0x31')](_0x4f9f24,function(_0x1f2bcd){return qs[_0x9def('0x50')](_0x1f2bcd,['id',_0x9def('0x51'),'updatedAt',_0x9def('0x5a')]);});_0x59ae3e(_0x261ade);})[_0x9def('0x47')](function(_0x3cb8ee){_0x2fe050(_0x3cb8ee);});})[_0x9def('0x2c')](function(_0x102f66){var _0x2463c4=qs[_0x9def('0x50')](_0xa976da,['id',_0x9def('0x51'),_0x9def('0x52')]);_0x2463c4[_0x9def('0x5b')]=_0x272432['id'];if(_0x102f66)_0x2463c4[_0x9def('0x5c')]=_0x102f66;return _0x2463c4;})[_0x9def('0x2c')](function(_0x222e90){return db[_0x9def('0x5d')][_0x9def('0x4d')](_0x222e90,{'include':[{'model':db[_0x9def('0x59')],'as':'Resources'}],'raw':!![],'transaction':_0x2658c3});});})[_0x9def('0x2c')](function(){return _0x272432;});}});});});}})[_0x9def('0x2c')](respondWithResult(_0x570797,0xc9))[_0x9def('0x47')](handleError(_0x570797,null));};exports[_0x9def('0x5e')]=function(_0x1dcb7d,_0x1fa3e1){if(_0x1dcb7d[_0x9def('0x54')]['id']){delete _0x1dcb7d[_0x9def('0x54')]['id'];}return db[_0x9def('0x32')][_0x9def('0x4c')]({'where':{'id':_0x1dcb7d[_0x9def('0x49')]['id']}})[_0x9def('0x2c')](handleEntityNotFound(_0x1fa3e1,null))[_0x9def('0x2c')](saveUpdates(_0x1dcb7d[_0x9def('0x54')],null))[_0x9def('0x2c')](respondWithResult(_0x1fa3e1,null))[_0x9def('0x47')](handleError(_0x1fa3e1,null));};exports[_0x9def('0x2d')]=function(_0x29370d,_0x56ab4a){return db[_0x9def('0x32')][_0x9def('0x4c')]({'where':{'id':_0x29370d[_0x9def('0x49')]['id']}})[_0x9def('0x2c')](handleEntityNotFound(_0x56ab4a,null))[_0x9def('0x2c')](removeEntity(_0x56ab4a,null))[_0x9def('0x47')](handleError(_0x56ab4a,null));};exports['describe']=function(_0x4cc439,_0x4f5e17){return db['UserProfile'][_0x9def('0x5f')]()[_0x9def('0x2c')](respondWithResult(_0x4f5e17,null))[_0x9def('0x47')](handleError(_0x4f5e17,null));};exports['addSections']=function(_0x12ea1d,_0x1c3750){var _0x5efa12=_0x12ea1d[_0x9def('0x54')];return db[_0x9def('0x32')]['find']({'where':{'id':_0x12ea1d['params']['id']}})['then'](handleEntityNotFound(_0x1c3750,null))[_0x9def('0x2c')](function(_0x417b02){if(_0x417b02){return db[_0x9def('0x55')][_0x9def('0x56')](function(_0x1ff349){return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x12ea1d[_0x9def('0x49')]['id'],'sectionId':_[_0x9def('0x31')](_0x5efa12,function(_0x1f939f){return _0x1f939f[_0x9def('0x5a')];})},'transaction':_0x1ff349})[_0x9def('0x2c')](function(){var _0x428bf0=_[_0x9def('0x31')](_0x5efa12,function(_0x5bebf3){_0x5bebf3[_0x9def('0x5b')]=_0x12ea1d['params']['id'];return _0x5bebf3;});var _0x187dca=[];return BPromise['each'](_0x428bf0,function(_0x5e95d5){return db[_0x9def('0x5d')][_0x9def('0x4d')](_0x5e95d5,{'include':[{'model':db[_0x9def('0x59')],'as':_0x9def('0x5c')}],'raw':!![],'transaction':_0x1ff349})[_0x9def('0x2c')](function(_0x6853f2){_0x187dca[_0x9def('0x60')](_0x6853f2[_0x9def('0x4f')]({'plain':!![]}));});})[_0x9def('0x2c')](function(){return _0x187dca;});});});}})['then'](function(_0x44f02d){return _0x44f02d;})['then'](respondWithResult(_0x1c3750,null))[_0x9def('0x47')](handleError(_0x1c3750,null));};exports[_0x9def('0x61')]=function(_0x4632a4,_0x4d7259){var _0x4a3421;return db[_0x9def('0x32')]['find']({'where':{'id':_0x4632a4[_0x9def('0x49')]['id']},'attributes':['id',_0x9def('0x2f')]})['then'](handleEntityNotFound(_0x4d7259,null))[_0x9def('0x2c')](function(_0x185147){if(_0x185147){_0x4a3421=_0x185147;return db[_0x9def('0x5d')][_0x9def('0x2d')]({'where':{'userProfileId':_0x4632a4[_0x9def('0x49')]['id'],'sectionId':_0x4632a4[_0x9def('0x37')][_0x9def('0x62')]}});}})[_0x9def('0x2c')](function(){return _0x4a3421;})['then'](respondWithStatusCode(_0x4d7259,null))[_0x9def('0x47')](handleError(_0x4d7259,null));};exports[_0x9def('0x63')]=function(_0x116bd0,_0x18612f){var _0x2be68a=[];var _0x5107d7=[];return db[_0x9def('0x5d')]['findAll']({'where':{'userProfileId':_0x116bd0['params']['id']},'raw':!![]})['then'](function(_0x42be46){_0x2be68a=_[_0x9def('0x41')](_0x42be46,function(_0x49e1b1){return _0x49e1b1[_0x9def('0x64')]===0x1||_[_0x9def('0x65')]([0x3eb,0x709],_0x49e1b1[_0x9def('0x5a')]);});if(!_['isEmpty'](_0x2be68a)){return _[_0x9def('0x31')](_0x2be68a,function(_0x18f98d){return _0x18f98d[_0x9def('0x5a')];});}else{return;}})[_0x9def('0x2c')](function(_0x984e4e){if(_0x984e4e)_0x5107d7=_0x984e4e;if(_[_0x9def('0x65')](_0x5107d7,0x64)){var _0x2666f3=_[_0x9def('0x4c')](_0x2be68a,{'sectionId':0x64});return hasDefaultDashboard(_0x2666f3)[_0x9def('0x2c')](function(_0x28428b){return _[_0x9def('0x31')](_0x2be68a,function(_0x40e368){if(_0x40e368['sectionId']===0x64){_0x40e368[_0x9def('0x66')]=_0x28428b;}return _0x40e368;});});}else{return;}})[_0x9def('0x2c')](function(_0xd9a3ae){if(_0xd9a3ae)_0x2be68a=_0xd9a3ae;if(_[_0x9def('0x65')](_0x5107d7,0x3eb)){var _0x2831bc=_[_0x9def('0x4c')](_0x2be68a,{'sectionId':0x3eb});return getCustomDashboards(_0x2831bc)[_0x9def('0x2c')](function(_0x5a979){return _[_0x9def('0x31')](_0x2be68a,function(_0x4ff782){if(_0x2831bc['enabled']){if(_0x4ff782[_0x9def('0x5a')]===0x3eb){_0x4ff782[_0x9def('0x66')]=_0x5a979;}}else{if(_0x4ff782[_0x9def('0x5a')]===0x64){_0x4ff782[_0x9def('0x66')]=_0x5a979;}}return _0x4ff782;});});}else{return;}})[_0x9def('0x2c')](function(_0x32acb0){if(_0x32acb0)_0x2be68a=_0x32acb0;if(_['includes'](_0x5107d7,0x709)){var _0x926ad2=_['find'](_0x2be68a,{'sectionId':0x709});return getPlugins(_0x926ad2)[_0x9def('0x2c')](function(_0x55e326){if(_0x926ad2[_0x9def('0x64')]){return _['map'](_0x2be68a,function(_0x4eb177){if(_0x4eb177[_0x9def('0x5a')]===0x709){_0x4eb177['subsections']=_0x55e326;}return _0x4eb177;});}else{var _0x42ee10={'sectionId':0x76c,'enabled':0x1,'subsections':_0x55e326};var _0xdfe388=_[_0x9def('0x31')](_0x2be68a);_0xdfe388[_0x9def('0x60')](_0x42ee10);return _0xdfe388;}});}else{return;}})[_0x9def('0x2c')](function(_0x486aaf){if(_0x486aaf)_0x2be68a=_0x486aaf;return _[_0x9def('0x41')](_0x2be68a,[_0x9def('0x64'),0x1]);})[_0x9def('0x2c')](respondWithResult(_0x18612f,null))[_0x9def('0x47')](handleError(_0x18612f,null));};function hasDefaultDashboard(_0x4ba0bb){var _0x28efa2=[0x65];return new BPromise(function(_0xc653b3,_0x5a1ce6){try{if(_0x4ba0bb[_0x9def('0x58')]){_0xc653b3(_0x28efa2);}else{return db[_0x9def('0x59')][_0x9def('0x67')]({'where':{'sectionId':_0x4ba0bb['id']},'raw':!![]})[_0x9def('0x2c')](function(_0x4d6fc1){_0x4d6fc1?_0xc653b3(_0x28efa2):_0xc653b3();});}}catch(_0x477c5d){_0x5a1ce6(_0x477c5d);}});}function getCustomDashboards(_0x420337){var _0x4d7188=[];return new BPromise(function(_0x26d41b,_0x35df9f){try{if(_0x420337['autoAssociation']){return db[_0x9def('0x68')]['findAll']({'raw':!![]})[_0x9def('0x2c')](function(_0x528b55){_0x528b55['forEach'](function(_0x2274bf){_0x4d7188['push'](_0x2274bf['id']+0x1869f);});_0x26d41b(_0x4d7188);});}else{return db[_0x9def('0x59')][_0x9def('0x45')]({'where':{'sectionId':_0x420337['id']},'raw':!![]})[_0x9def('0x2c')](function(_0x470e32){_0x470e32[_0x9def('0x69')](function(_0x4df52b){_0x4d7188[_0x9def('0x60')](_0x4df52b['resourceId']+0x1869f);});_0x26d41b(_0x4d7188);});}}catch(_0xd097a4){_0x35df9f(_0xd097a4);}});}function getPlugins(_0x399cb8){var _0x4952c5=[];return new BPromise(function(_0x240e43,_0x235ba6){try{if(_0x399cb8[_0x9def('0x58')]){return db[_0x9def('0x6a')][_0x9def('0x45')]({'raw':!![]})[_0x9def('0x2c')](function(_0x2d7302){_0x2d7302[_0x9def('0x69')](function(_0xd0d043){_0x4952c5[_0x9def('0x60')](_0xd0d043['id']+0x15b38);});_0x240e43(_0x4952c5);});}else{return db['UserProfileResource'][_0x9def('0x45')]({'where':{'sectionId':_0x399cb8['id']},'raw':!![]})['then'](function(_0x491df9){_0x491df9[_0x9def('0x69')](function(_0x551743){_0x4952c5[_0x9def('0x60')](_0x551743[_0x9def('0x6b')]+0x15b38);});_0x240e43(_0x4952c5);});}}catch(_0x191617){_0x235ba6(_0x191617);}});}exports[_0x9def('0x6c')]=function(_0x187b14,_0x38b44d){return db['UserProfile'][_0x9def('0x4c')]({'where':{'id':_0x187b14['params']['id']}})[_0x9def('0x2c')](handleEntityNotFound(_0x38b44d,null))[_0x9def('0x2c')](function(_0x3e5ffe){if(_0x3e5ffe){return db['sequelize']['transaction'](function(_0x13983f){return db['UserProfileSection'][_0x9def('0x45')]({'where':{'userProfileId':_0x187b14[_0x9def('0x49')]['id']},'attributes':['id'],'raw':!![]})[_0x9def('0x2c')](function(_0x4e2555){if(_0x4e2555){return db[_0x9def('0x5d')][_0x9def('0x2d')]({'where':{'userProfileId':_0x187b14['params']['id'],'id':_[_0x9def('0x31')](_0x4e2555,function(_0x36c832){return _0x36c832['id'];})},'transaction':_0x13983f});}})[_0x9def('0x2c')](function(_0x40a6ed){var _0x1edb5f=_['map'](_0x187b14[_0x9def('0x54')],function(_0x33a23c){_0x33a23c[_0x9def('0x5b')]=_0x187b14[_0x9def('0x49')]['id'];return _0x33a23c;});return db[_0x9def('0x5d')][_0x9def('0x6d')](_0x1edb5f,{'raw':!![],'transaction':_0x13983f});})[_0x9def('0x2c')](function(_0x10ec58){var _0x235705=_['filter'](_[_0x9def('0x31')](_0x10ec58,function(_0x362990){return _0x362990['get']({'plain':!![]});}),{'includeAll':![]});if(_0x235705){return db[_0x9def('0x5d')]['findAll']({'where':{'userProfileId':_0x187b14[_0x9def('0x49')]['id'],'sectionId':_[_0x9def('0x31')](_0x235705,function(_0x575980){return _0x575980[_0x9def('0x5a')];})},'attributes':['id',_0x9def('0x5a')],'raw':!![]})[_0x9def('0x2c')](function(_0x175234){var _0x4fe9c8=_[_0x9def('0x31')](_0x187b14[_0x9def('0x54')],function(_0x231911){_0x231911[_0x9def('0x5b')]=_0x187b14[_0x9def('0x49')]['id'];return _0x231911;});return db['UserProfileResource'][_0x9def('0x6d')](_0x4fe9c8,{'raw':!![],'transaction':_0x13983f});});}})[_0x9def('0x47')](handleError(_0x38b44d,null));});}})[_0x9def('0x2c')](function(_0x182bcf){var _0x4ed546=_[_0x9def('0x31')](_0x182bcf,function(_0x26debe){return _0x26debe[_0x9def('0x4f')]({'plain':!![]});});})['then'](respondWithResult(_0x38b44d,null))[_0x9def('0x47')](handleError(_0x38b44d,null));};exports[_0x9def('0x6e')]=function(_0x10c250,_0x12fa2a,_0xb55da8){return db[_0x9def('0x32')]['find']({'where':{'id':_0x10c250[_0x9def('0x49')]['id']}})[_0x9def('0x2c')](handleEntityNotFound(_0x12fa2a,null))[_0x9def('0x2c')](function(_0x3ef147){if(_0x3ef147){return _0x3ef147[_0x9def('0x6e')](_0x10c250[_0x9def('0x37')][_0x9def('0x62')]);}})[_0x9def('0x2c')](respondWithStatusCode(_0x12fa2a,null))[_0x9def('0x47')](handleError(_0x12fa2a,null));};exports[_0x9def('0x6f')]=function(_0x397446,_0x590e97){var _0x34cff8={};if(!_0x397446[_0x9def('0x37')][_0x9def('0x70')])throw new Error(_0x9def('0x71'));if(!_0x397446[_0x9def('0x37')][_0x9def('0x72')]('nolimit')){_0x34cff8[_0x9def('0x26')]=qs[_0x9def('0x26')](_0x397446['query'][_0x9def('0x26')]);_0x34cff8[_0x9def('0x24')]=qs[_0x9def('0x24')](_0x397446[_0x9def('0x37')][_0x9def('0x24')]);}return db['UserProfile'][_0x9def('0x4c')]({'where':{'id':_0x397446['params']['id']}})[_0x9def('0x2c')](function(_0x33e32f){if(!_0x33e32f)throw new Error(_0x9def('0x73')+_0x397446[_0x9def('0x49')]['id']);return db[_0x9def('0x32')][_0x9def('0x6f')](_0x397446);})[_0x9def('0x2c')](respondWithFilteredResult(_0x590e97,_0x34cff8))[_0x9def('0x47')](handleError(_0x590e97,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 369b29b..7e9d1ea 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 _0xdb8b=['remove','emit','hasOwnProperty','exports','../../mysqldb','UserProfile','setMaxListeners'];(function(_0x328092,_0x2bb4c6){var _0x39f32b=function(_0x1cb24b){while(--_0x1cb24b){_0x328092['push'](_0x328092['shift']());}};_0x39f32b(++_0x2bb4c6);}(_0xdb8b,0x1c4));var _0xbdb8=function(_0x3c9d7d,_0x1bd63c){_0x3c9d7d=_0x3c9d7d-0x0;var _0x480277=_0xdb8b[_0x3c9d7d];return _0x480277;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0xbdb8('0x0'))['db'][_0xbdb8('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xbdb8('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xbdb8('0x3')};function emitEvent(_0x5e5f57){return function(_0x3149c6,_0x2ec8cc,_0x33b3d2){UserProfileEvents[_0xbdb8('0x4')](_0x5e5f57+':'+_0x3149c6['id'],_0x3149c6);UserProfileEvents['emit'](_0x5e5f57,_0x3149c6);_0x33b3d2(null);};}for(var e in events){if(events[_0xbdb8('0x5')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0xbdb8('0x6')]=UserProfileEvents; \ No newline at end of file +var _0x2da6=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserProfile','setMaxListeners','save','update','remove'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0x2da6,0x1dd));var _0x62da=function(_0x165822,_0x4d83f9){_0x165822=_0x165822-0x0;var _0x29600f=_0x2da6[_0x165822];return _0x29600f;};'use strict';var EventEmitter=require(_0x62da('0x0'));var UserProfile=require(_0x62da('0x1'))['db'][_0x62da('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x62da('0x3')](0x0);var events={'afterCreate':_0x62da('0x4'),'afterUpdate':_0x62da('0x5'),'afterDestroy':_0x62da('0x6')};function emitEvent(_0x3552dc){return function(_0x4c079d,_0x4a8428,_0xe28204){UserProfileEvents[_0x62da('0x7')](_0x3552dc+':'+_0x4c079d['id'],_0x4c079d);UserProfileEvents[_0x62da('0x7')](_0x3552dc,_0x4c079d);_0xe28204(null);};}for(var e in events){if(events[_0x62da('0x8')](e)){var event=events[e];UserProfile[_0x62da('0x9')](e,emitEvent(event));}}module[_0x62da('0xa')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 6dbbb2e..46cfb6c 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 _0xe5af=['ListId','companies','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','FaxAccount','internalroutes','outboundroutes','VoiceExtension','contexts','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','role','agent','Telephones','User','telephone','VoiceQueues','queue','VoiceQueue','type','inbound','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','MailSubstatus','OpenchannelQueue','OpenchannelAccount','smsqueues','SmsQueue','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','QueueCampaigns','users','agents','telephones','admin','user','zendeskaccounts','ZendeskAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','DeskAccount','cannedanswers','CannedAnswer','dispositions','Disposition','Dashboard','intervals','Interval','pauses','Pause','scheduler','sounds','Sound','Tag','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','Sequelize','QueryTypes','select','ui.','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','UserProfile','user_profiles','section','mergeResources','push','UserProfileSection','find','params','ignore','isEmpty','union','length','autoAssociation','all','rawAttributes','model','keys','intersection','fields','attributes','limit','offset','order','sort','filters','pick','merge','VIRTUAL','foreignKey','forEach','options','includeAll','include','default','custom','CustomReports','count','CmContact','Tags','color','tag','ThroughTags','openTabs','true','rows','chat','sms','dataValues','mail','whatsapp','./userProfile.attributes','../../components/parsers/qs','exports','filter','field','value','then','map','catch','findAll','associatedResources','name','resolve','AnalyticExtractedReport','resourceId','toLowerCase','squareprojects','SquareProject','odbc','childModel','SquareOdbc','SquareRecording','parentSections','SquareProjects','projectName','projects','Lists'];(function(_0x43a071,_0x1b2ef6){var _0x2bb312=function(_0x423bd8){while(--_0x423bd8){_0x43a071['push'](_0x43a071['shift']());}};_0x2bb312(++_0x1b2ef6);}(_0xe5af,0x9c));var _0xfe5a=function(_0x8c540d,_0x1eed5b){_0x8c540d=_0x8c540d-0x0;var _0x22ed75=_0xe5af[_0x8c540d];return _0x22ed75;};'use strict';var _=require('lodash');var attributes=require(_0xfe5a('0x0'));var qs=require(_0xfe5a('0x1'));var squel=require('squel');module[_0xfe5a('0x2')]=function(_0x1bad12){var _0x23b7f0=_0x1bad12['models'];function _0x1165e3(_0x48e3a7,_0x526677){return new Promise(function(_0x37455d,_0x2039cd){if(!_0x526677)return _0x37455d(null);var _0x4e418f=_0x526677['filter']?{[_0x526677[_0xfe5a('0x3')][_0xfe5a('0x4')]]:_0x526677[_0xfe5a('0x3')][_0xfe5a('0x5')]}:undefined;return _0x23b7f0[_0x48e3a7]['findAll']({'where':_0x4e418f,'raw':!![]})[_0xfe5a('0x6')](function(_0x5a48ff){_0x526677['associatedResources']=_[_0xfe5a('0x7')](_0x5a48ff,'id');_0x37455d(_0x526677);})[_0xfe5a('0x8')](function(_0x543619){_0x2039cd(_0x543619);});});}function _0xb51e47(_0x3e3c1c,_0x803a28){return new Promise(function(_0x50024c,_0x3a3e97){var _0x5bf3b4=_0x3e3c1c[_0xfe5a('0x3')]?{[_0x3e3c1c[_0xfe5a('0x3')][_0xfe5a('0x4')]]:_0x3e3c1c[_0xfe5a('0x3')][_0xfe5a('0x5')]}:undefined;return _0x23b7f0[_0x3e3c1c['model']][_0xfe5a('0x9')]({'where':_0x5bf3b4,'raw':!![]})[_0xfe5a('0x6')](function(_0x42969b){_0x803a28[_0xfe5a('0xa')]=_[_0xfe5a('0x7')](_0x42969b,function(_0x217976){return _0x217976[_0xfe5a('0xb')];});_0x50024c(_0x803a28);})[_0xfe5a('0x8')](function(_0x111d4d){_0x3a3e97(_0x111d4d);});});}function _0x18c57b(_0x38f12e,_0x2cb5c5,_0x22afa7){if(!_0x2cb5c5)return Promise[_0xfe5a('0xc')](null);return new Promise(function(_0x3edcab,_0x3ffbbb){return _0x23b7f0['UserProfileResource'][_0xfe5a('0x9')]({'where':{'sectionId':_0x2cb5c5['id']},'raw':!![]})[_0xfe5a('0x6')](function(_0x54d5fb){if(_0x38f12e[_0xfe5a('0x4')]&&_0x38f12e[_0xfe5a('0x4')]!=='id'){_0x2cb5c5[_0xfe5a('0xa')]=_['map'](_0x54d5fb,function(_0x485c15){return _0x485c15[_0x38f12e[_0xfe5a('0x4')]];});}else{if(_0x22afa7===_0xfe5a('0xd')){_0x2cb5c5[_0xfe5a('0xa')]=_[_0xfe5a('0x7')](_0x54d5fb,function(_0x1467a0){return{'id':_0x1467a0[_0xfe5a('0xe')],'type':_0x1467a0['type']};});}else{_0x2cb5c5[_0xfe5a('0xa')]=_['map'](_0x54d5fb,function(_0x3dfa57){return _0x3dfa57[_0xfe5a('0xe')];});}}_0x3edcab(_0x2cb5c5);})[_0xfe5a('0x8')](function(_0x4b0112){_0x3ffbbb(_0x4b0112);});});}function _0x4bbef1(_0x247be4,_0x3e55fd){var _0x494df3={'parentSections':[]};switch(_0x247be4[_0xfe5a('0xf')]()){case _0xfe5a('0x10'):_0x494df3['childModel']=_0xfe5a('0x11');break;case _0xfe5a('0x12'):_0x494df3[_0xfe5a('0x13')]=_0xfe5a('0x14');break;case'squarerecordings':_0x494df3[_0xfe5a('0x13')]=_0xfe5a('0x15');_0x494df3[_0xfe5a('0x16')]=[{'name':_0xfe5a('0x17'),'field':_0xfe5a('0xb'),'foreignKey':_0xfe5a('0x18')}];break;case _0xfe5a('0x19'):_0x494df3[_0xfe5a('0x13')]='JscriptyProject';break;case'contacts':_0x494df3[_0xfe5a('0x13')]='CmContact';_0x494df3[_0xfe5a('0x16')]=[{'name':_0xfe5a('0x1a'),'field':'id','foreignKey':_0xfe5a('0x1b')}];break;case'lists':_0x494df3['childModel']='CmList';break;case _0xfe5a('0x1c'):_0x494df3['childModel']='CmCompany';break;case'globalcustomfields':_0x494df3[_0xfe5a('0x13')]=_0xfe5a('0x1d');break;case _0xfe5a('0x1e'):_0x494df3[_0xfe5a('0x13')]=_0xfe5a('0x1f');break;case _0xfe5a('0x20'):_0x494df3[_0xfe5a('0x13')]=_0xfe5a('0x21');break;case _0xfe5a('0x22'):_0x494df3[_0xfe5a('0x13')]=_0xfe5a('0x23');break;case'faxaccounts':_0x494df3[_0xfe5a('0x13')]=_0xfe5a('0x24');break;case'inboundroutes':case _0xfe5a('0x25'):case _0xfe5a('0x26'):_0x494df3[_0xfe5a('0x13')]=_0xfe5a('0x27');break;case _0xfe5a('0x28'):_0x494df3['childModel']='VoiceContext';break;case _0xfe5a('0x29'):_0x494df3['childModel']=_0xfe5a('0x2a');break;case _0xfe5a('0x2b'):_0x494df3[_0xfe5a('0x13')]=_0xfe5a('0x2c');_0x494df3['parentSections']=[{'name':_0xfe5a('0x2d'),'field':_0xfe5a('0xb'),'foreignKey':_0xfe5a('0x2e'),'model':'User','filter':{'field':_0xfe5a('0x2f'),'value':[_0xfe5a('0x30')]}},{'name':_0xfe5a('0x31'),'field':_0xfe5a('0xb'),'foreignKey':'membername','model':_0xfe5a('0x32'),'filter':{'field':'role','value':[_0xfe5a('0x33')]}},{'name':_0xfe5a('0x34'),'field':'name','foreignKey':_0xfe5a('0x35'),'model':_0xfe5a('0x36'),'filter':{'field':_0xfe5a('0x37'),'value':[_0xfe5a('0x38')]}},{'name':'QueueCampaigns','field':_0xfe5a('0xb'),'foreignKey':_0xfe5a('0x35'),'model':_0xfe5a('0x36'),'filter':{'field':'type','value':[_0xfe5a('0x39')]}}];break;case _0xfe5a('0x3a'):_0x494df3[_0xfe5a('0x13')]=_0xfe5a('0x3b');break;case _0xfe5a('0x3c'):_0x494df3[_0xfe5a('0x13')]=_0xfe5a('0x3d');break;case _0xfe5a('0x3e'):_0x494df3[_0xfe5a('0x13')]=_0xfe5a('0x3f');break;case _0xfe5a('0x40'):_0x494df3['childModel']=_0xfe5a('0x41');break;case _0xfe5a('0x42'):_0x494df3[_0xfe5a('0x13')]=_0xfe5a('0x43');break;case _0xfe5a('0x44'):_0x494df3[_0xfe5a('0x13')]=_0xfe5a('0x45');break;case'mailsubstatuses':_0x494df3[_0xfe5a('0x13')]=_0xfe5a('0x46');break;case'openchannelqueues':_0x494df3['childModel']=_0xfe5a('0x47');break;case'openchannelaccounts':_0x494df3['childModel']=_0xfe5a('0x48');break;case _0xfe5a('0x49'):_0x494df3['childModel']=_0xfe5a('0x4a');break;case'smsaccounts':_0x494df3[_0xfe5a('0x13')]=_0xfe5a('0x4b');break;case _0xfe5a('0x4c'):_0x494df3[_0xfe5a('0x13')]=_0xfe5a('0x4d');break;case _0xfe5a('0x4e'):_0x494df3['childModel']=_0xfe5a('0x4f');break;case _0xfe5a('0x50'):_0x494df3[_0xfe5a('0x13')]=_0xfe5a('0x51');break;case _0xfe5a('0x52'):case _0xfe5a('0x53'):_0x494df3[_0xfe5a('0x13')]=_0xfe5a('0x36');if(_0x3e55fd){_0x494df3[_0xfe5a('0x16')]=[{'name':_0xfe5a('0x34')},{'name':_0xfe5a('0x54')}];}break;case _0xfe5a('0x55'):case _0xfe5a('0x56'):case _0xfe5a('0x57'):_0x494df3['childModel']=_0xfe5a('0x32');if(_0x3e55fd){_0x494df3[_0xfe5a('0x16')]=[{'name':'Users','filter':{'field':'role','value':[_0xfe5a('0x58'),_0xfe5a('0x59')]},'ignore':!![]},{'name':_0xfe5a('0x2d')},{'name':_0xfe5a('0x31')}];}break;case _0xfe5a('0x5a'):_0x494df3[_0xfe5a('0x13')]=_0xfe5a('0x5b');break;case'salesforceaccounts':_0x494df3[_0xfe5a('0x13')]='SalesforceAccount';break;case _0xfe5a('0x5c'):_0x494df3['childModel']=_0xfe5a('0x5d');break;case _0xfe5a('0x5e'):_0x494df3[_0xfe5a('0x13')]=_0xfe5a('0x5f');break;case'deskaccounts':_0x494df3[_0xfe5a('0x13')]=_0xfe5a('0x60');break;case'zohoaccounts':_0x494df3[_0xfe5a('0x13')]='ZohoAccount';break;case'vtigeraccounts':_0x494df3[_0xfe5a('0x13')]='User';break;case _0xfe5a('0x61'):_0x494df3[_0xfe5a('0x13')]=_0xfe5a('0x62');break;case _0xfe5a('0x63'):_0x494df3['childModel']=_0xfe5a('0x64');break;case'customdashboards':_0x494df3[_0xfe5a('0x13')]=_0xfe5a('0x65');break;case _0xfe5a('0x66'):_0x494df3['childModel']=_0xfe5a('0x67');break;case _0xfe5a('0x68'):_0x494df3['childModel']=_0xfe5a('0x69');break;case _0xfe5a('0x6a'):_0x494df3[_0xfe5a('0x13')]='Schedule';break;case _0xfe5a('0x6b'):_0x494df3[_0xfe5a('0x13')]=_0xfe5a('0x6c');break;case'tags':_0x494df3[_0xfe5a('0x13')]=_0xfe5a('0x6d');break;case'templates':_0x494df3[_0xfe5a('0x13')]='Template';break;case _0xfe5a('0x6e'):_0x494df3[_0xfe5a('0x13')]=_0xfe5a('0x6f');break;case _0xfe5a('0x70'):_0x494df3[_0xfe5a('0x13')]=_0xfe5a('0x71');break;case _0xfe5a('0x72'):_0x494df3[_0xfe5a('0x13')]=_0xfe5a('0x73');break;case _0xfe5a('0x74'):_0x494df3[_0xfe5a('0x13')]=_0xfe5a('0x75');break;case _0xfe5a('0x76'):_0x494df3[_0xfe5a('0x13')]=_0xfe5a('0xd');_0x494df3[_0xfe5a('0x16')]=[{'name':'Reports','field':'id','foreignKey':_0xfe5a('0x77')}];break;case _0xfe5a('0x78'):_0x494df3[_0xfe5a('0x13')]=_0xfe5a('0x79');break;}return _0x494df3;}function _0x1b531f(_0x2e061e,_0x1895fd){var _0x15ceb7=_0x2e061e[_0xfe5a('0x7a')](0x0)[_0xfe5a('0x7b')]()+_0x2e061e['slice'](0x1);var _0x409bf0={'type':_0x23b7f0[_0xfe5a('0x7c')][_0xfe5a('0x7d')]['SELECT'],'raw':!![]};return new Promise(function(_0xe99cbe,_0x38c742){var _0x4eea75=squel[_0xfe5a('0x7e')]()['field'](_0xfe5a('0x7f')+_0x15ceb7+'InteractionId','id')[_0xfe5a('0x4')]('ui.createdAt')['from']('user_has_'+_0x2e061e+_0xfe5a('0x80'),'ui')[_0xfe5a('0x81')](_0xfe5a('0x82'),_0x1895fd['id']);return _0x23b7f0[_0xfe5a('0x83')][_0xfe5a('0x84')](_0x4eea75['toString'](),_0x409bf0)['then'](function(_0x35b584){_0x1895fd[_0x15ceb7+'OpenTabs']=_0x35b584;_0xe99cbe(_0x35b584);})[_0xfe5a('0x8')](function(_0x50628b){_0x38c742(_0x50628b);});});}return _0x1bad12['define'](_0xfe5a('0x85'),attributes,{'tableName':_0xfe5a('0x86'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x3845e6){var _0x3cf2ef={'raw':![],'where':{}};var _0x3d4250={};var _0x45c29b={'count':0x0,'rows':[]};var _0x5a3d72=_0x3845e6[_0xfe5a('0x84')][_0xfe5a('0x87')];var _0x243537=_0x3845e6[_0xfe5a('0x84')][_0xfe5a('0x88')]||![];var _0x1a9839=_0x4bbef1(_0x5a3d72,_0x243537);if(!_0x1a9839[_0xfe5a('0x13')])throw new Error('Invalid\x20section\x20\x27'+_0x5a3d72+'\x27');var _0x4beb54=[{'name':_0x5a3d72}];if(!_['isEmpty'](_0x1a9839[_0xfe5a('0x16')]))_0x4beb54=_0x1a9839['parentSections'];var _0x21f471=[];for(var _0x1af84d=0x0;_0x1af84d<_0x4beb54['length'];_0x1af84d++){_0x21f471[_0xfe5a('0x89')](_0x23b7f0[_0xfe5a('0x8a')][_0xfe5a('0x8b')]({'where':{'userProfileId':_0x3845e6[_0xfe5a('0x8c')]['id'],'name':_0x4beb54[_0x1af84d][_0xfe5a('0xb')]},'raw':!![]}));}return Promise['all'](_0x21f471)[_0xfe5a('0x6')](function(_0x1cad8a){var _0x499a13=_['filter'](_0x1cad8a,function(_0x35c45c){return _0x35c45c?_0x35c45c:undefined;});var _0x59cb82=_[_0xfe5a('0x3')](_0x4beb54,[_0xfe5a('0x8d'),!![]]);var _0x44b4b2=_[_0xfe5a('0x8e')](_0x499a13)&&_[_0xfe5a('0x8e')](_0x59cb82)?null:_[_0xfe5a('0x8f')](_0x59cb82,_0x499a13);if(!_0x44b4b2)return null;var _0x173f4e=[];for(var _0x528bc0=0x0;_0x528bc0<_0x44b4b2[_0xfe5a('0x90')];_0x528bc0++){var _0x24806b=_[_0xfe5a('0x8b')](_0x4beb54,function(_0x4459ac){return _0x44b4b2[_0x528bc0]?_0x4459ac[_0xfe5a('0xb')]===_0x44b4b2[_0x528bc0]['name']:null;});if(_0x24806b){if(_0x44b4b2[_0x528bc0][_0xfe5a('0x8d')]){_0x173f4e[_0xfe5a('0x89')](_0x1165e3(_0x1a9839['childModel'],_0x44b4b2[_0x528bc0]));}else{if(!_0x44b4b2[_0x528bc0][_0xfe5a('0x91')]){_0x173f4e[_0xfe5a('0x89')](_0x18c57b(_0x24806b,_0x44b4b2[_0x528bc0],_0x1a9839[_0xfe5a('0x13')]));}else{if(_0x24806b['model']){_0x173f4e[_0xfe5a('0x89')](_0xb51e47(_0x24806b,_0x44b4b2[_0x528bc0]));}}}}}return Promise[_0xfe5a('0x92')](_0x173f4e);})['then'](function(_0x1dadfe){var _0x1d4a93=_0x1dadfe;var _0x5492b1=null;if(_0x1d4a93){_0x5492b1=_0x1d4a93[_0xfe5a('0x90')]===0x1?_0x1d4a93[0x0]:null;}if(!_0x5492b1&&!_0x1d4a93)return _0x45c29b;var _0x58ad21=_0x23b7f0[_0x1a9839[_0xfe5a('0x13')]][_0xfe5a('0x93')];_0x3d4250[_0xfe5a('0x94')]=_[_0xfe5a('0x95')](_0x58ad21);_0x3d4250['query']=_[_0xfe5a('0x95')](_0x3845e6['query']);_0x3d4250['filters']=_[_0xfe5a('0x96')](_0x3d4250[_0xfe5a('0x94')],_0x3d4250[_0xfe5a('0x84')]);_0x3cf2ef['attributes']=_[_0xfe5a('0x96')](_0x3d4250['model'],qs[_0xfe5a('0x97')](_0x3845e6[_0xfe5a('0x84')][_0xfe5a('0x97')]));_0x3cf2ef[_0xfe5a('0x98')]=_0x3cf2ef['attributes'][_0xfe5a('0x90')]?_0x3cf2ef[_0xfe5a('0x98')]:_0x3d4250['model'];if(!_0x3845e6[_0xfe5a('0x84')]['hasOwnProperty']('nolimit')){_0x3cf2ef[_0xfe5a('0x99')]=qs['limit'](_0x3845e6[_0xfe5a('0x84')]['limit']);_0x3cf2ef[_0xfe5a('0x9a')]=qs[_0xfe5a('0x9a')](_0x3845e6[_0xfe5a('0x84')][_0xfe5a('0x9a')]);}_0x3cf2ef[_0xfe5a('0x9b')]=qs[_0xfe5a('0x9c')](_0x3845e6[_0xfe5a('0x84')][_0xfe5a('0x9c')]);_0x3cf2ef[_0xfe5a('0x81')]=qs[_0xfe5a('0x9d')](_[_0xfe5a('0x9e')](_0x3845e6[_0xfe5a('0x84')],_0x3d4250[_0xfe5a('0x9d')]));if(_0x3845e6[_0xfe5a('0x84')]['filter']){_0x3cf2ef[_0xfe5a('0x81')]=_[_0xfe5a('0x9f')](_0x3cf2ef['where'],{'$or':_[_0xfe5a('0x7')](_0x58ad21,function(_0x4a61a7){if(_0x4a61a7[_0xfe5a('0x37')]['key']!==_0xfe5a('0xa0')){var _0x5602ca={};_0x5602ca[_0x4a61a7[_0xfe5a('0x4')]]={'$like':'%'+_0x3845e6[_0xfe5a('0x84')][_0xfe5a('0x3')]+'%'};return _0x5602ca;}})});}var _0x2e75b7=[];var _0x18560c=null;var _0x236e76={};if(_0x5492b1){_0x18560c=_[_0xfe5a('0x8b')](_0x4beb54,[_0xfe5a('0xb'),_0x5492b1[_0xfe5a('0xb')]]);if(_0x18560c['field']){_0x236e76={};if(_0x1a9839['childModel']===_0xfe5a('0xd')){_0x236e76[_0x18560c[_0xfe5a('0xa1')]]=_[_0xfe5a('0x7')](_0x5492b1[_0xfe5a('0xa')],'id');}else{_0x236e76[_0x18560c[_0xfe5a('0xa1')]]=_0x5492b1[_0xfe5a('0xa')];}_0x2e75b7[_0xfe5a('0x89')](_0x236e76);}else{_0x3cf2ef['where']['id']=_0x5492b1[_0xfe5a('0xa')];}}else{for(var _0x29c0cc=0x0;_0x29c0cc<_0x1d4a93[_0xfe5a('0x90')];_0x29c0cc++){_0x18560c=_[_0xfe5a('0x8b')](_0x4beb54,[_0xfe5a('0xb'),_0x1d4a93[_0x29c0cc]['name']]);if(_0x18560c[_0xfe5a('0x4')]){_0x236e76={};_0x236e76[_0x18560c[_0xfe5a('0xa1')]]=_0x1d4a93[_0x29c0cc]['associatedResources'];_0x2e75b7[_0xfe5a('0x89')](_0x236e76);}else{if(!_0x3cf2ef[_0xfe5a('0x81')]['id'])_0x3cf2ef[_0xfe5a('0x81')]['id']=[];_0x1d4a93[_0x29c0cc][_0xfe5a('0xa')][_0xfe5a('0xa2')](function(_0x59834f){_0x3cf2ef[_0xfe5a('0x81')]['id'][_0xfe5a('0x89')](_0x59834f);});}}}if(!_['isEmpty'](_0x2e75b7)){_0x3cf2ef['where']=_['merge'](_0x3cf2ef['where'],{'$and':{'$or':_0x2e75b7}});}_0x3cf2ef=_[_0xfe5a('0x9f')]({},_0x3cf2ef,_0x3845e6[_0xfe5a('0xa3')]);if(_0x5492b1&&!_0x5492b1['autoAssociation']&&_0x1a9839['childModel']===_0xfe5a('0xd')){if(_0x3845e6[_0xfe5a('0x84')][_0xfe5a('0xa4')]){_0x3cf2ef[_0xfe5a('0xa5')]=[{'all':!![]}];}return _0x23b7f0[_0x1a9839[_0xfe5a('0x13')]][_0xfe5a('0x9')](_0x3cf2ef)[_0xfe5a('0x6')](function(_0x1c1d81){var _0x5c8f28=[];_0x1c1d81['forEach'](function(_0x1b23a4){var _0x36de1e;switch(_0x1b23a4['reportType']){case _0xfe5a('0xa6'):_0x36de1e=_[_0xfe5a('0x8b')](_0x5492b1[_0xfe5a('0xa')],function(_0x242df1){return _0x242df1['id']===_0x1b23a4[_0xfe5a('0x77')]&&_0x242df1[_0xfe5a('0x37')]==='DefaultReports';});break;case _0xfe5a('0xa7'):_0x36de1e=_[_0xfe5a('0x8b')](_0x5492b1[_0xfe5a('0xa')],function(_0x47f23e){return _0x47f23e['id']===_0x1b23a4[_0xfe5a('0x77')]&&_0x47f23e[_0xfe5a('0x37')]===_0xfe5a('0xa8');});break;}if(_0x36de1e)_0x5c8f28[_0xfe5a('0x89')](_0x1b23a4);});_0x45c29b['count']=_0x5c8f28[_0xfe5a('0x90')];_0x45c29b['rows']=_0x5c8f28;return _0x45c29b;});}else{return _0x23b7f0[_0x1a9839[_0xfe5a('0x13')]][_0xfe5a('0xa9')]({'where':_0x3cf2ef[_0xfe5a('0x81')]})[_0xfe5a('0x6')](function(_0x3c6eaf){_0x45c29b['count']=_0x3c6eaf;if(_0x3845e6[_0xfe5a('0x84')][_0xfe5a('0xa4')]){if(_0x1a9839[_0xfe5a('0x13')]===_0xfe5a('0xaa')){_0x3cf2ef[_0xfe5a('0xa5')]=[{'model':_0x23b7f0[_0xfe5a('0x6d')],'as':_0xfe5a('0xab'),'attributes':['id','name',_0xfe5a('0xac')],'required':_0x3845e6[_0xfe5a('0x84')][_0xfe5a('0xad')]?!![]:![]},{'model':_0x23b7f0[_0xfe5a('0x6d')],'as':_0xfe5a('0xae'),'attributes':['id',_0xfe5a('0xb'),_0xfe5a('0xac')],'through':_0x3845e6[_0xfe5a('0x84')][_0xfe5a('0xad')]?{'attributes':[],'where':{'TagId':_0x3845e6[_0xfe5a('0x84')][_0xfe5a('0xad')]||undefined}}:{},'required':_0x3845e6[_0xfe5a('0x84')][_0xfe5a('0xad')]?!![]:![]}];}else{_0x3cf2ef[_0xfe5a('0xa5')]=[{'all':!![]}];}}return _0x23b7f0[_0x1a9839[_0xfe5a('0x13')]][_0xfe5a('0x9')](_0x3cf2ef);})[_0xfe5a('0x6')](function(_0x58ffea){_0x45c29b['rows']=_0x58ffea;if(_0x5a3d72===_0xfe5a('0x2d')&&_0x3845e6[_0xfe5a('0x84')][_0xfe5a('0xaf')]===_0xfe5a('0xb0')){var _0x4511fe=[];for(var _0xcfcfb2=0x0;_0xcfcfb2<_0x45c29b[_0xfe5a('0xb1')][_0xfe5a('0x90')];_0xcfcfb2++){_0x4511fe[_0xfe5a('0x89')](_0x1b531f(_0xfe5a('0xb2'),_0x45c29b['rows'][_0xcfcfb2]['dataValues']));_0x4511fe[_0xfe5a('0x89')](_0x1b531f(_0xfe5a('0xb3'),_0x45c29b[_0xfe5a('0xb1')][_0xcfcfb2][_0xfe5a('0xb4')]));_0x4511fe['push'](_0x1b531f('fax',_0x45c29b['rows'][_0xcfcfb2][_0xfe5a('0xb4')]));_0x4511fe[_0xfe5a('0x89')](_0x1b531f(_0xfe5a('0xb5'),_0x45c29b['rows'][_0xcfcfb2][_0xfe5a('0xb4')]));_0x4511fe['push'](_0x1b531f('openchannel',_0x45c29b['rows'][_0xcfcfb2]['dataValues']));_0x4511fe[_0xfe5a('0x89')](_0x1b531f(_0xfe5a('0xb6'),_0x45c29b['rows'][_0xcfcfb2][_0xfe5a('0xb4')]));}return Promise[_0xfe5a('0x92')](_0x4511fe)[_0xfe5a('0x6')](function(){return _0x45c29b;});}return _0x45c29b;});}});}}});}; \ No newline at end of file +var _0x741c=['length','find','all','ignore','autoAssociation','push','keys','intersection','fields','attributes','nolimit','limit','offset','order','sort','pick','filters','merge','key','foreignKey','forEach','options','includeAll','include','reportType','default','DefaultReports','custom','CustomReports','count','rows','CmContact','color','ThroughTags','tag','openTabs','true','chat','sms','dataValues','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','squel','exports','filter','field','value','findAll','catch','model','associatedResources','name','then','map','AnalyticExtractedReport','resourceId','toLowerCase','squareprojects','childModel','SquareOdbc','squarerecordings','SquareRecording','parentSections','projectName','projects','JscriptyProject','contacts','Lists','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatwebsites','faxqueues','FaxQueue','FaxAccount','inboundroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','voicerecordings','VoiceRecording','Agents','User','role','Telephones','membername','telephone','VoiceQueues','queue','VoiceQueue','type','QueueCampaigns','outbound','musiconholds','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','Campaign','mailqueues','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','whatsappqueues','WhatsappQueue','WhatsappAccount','Team','queuecampaigns','users','telephones','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','intervals','Interval','pauses','Pause','scheduler','Schedule','tags','Tag','templates','Template','trunks','Trunk','variables','extractedreports','Reports','reportId','metrics','AnalyticMetric','toUpperCase','slice','SELECT','select','ui.','ui.createdAt','from','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','UserProfile','user_profiles','section','mergeResources','isEmpty'];(function(_0x5444d2,_0x467674){var _0x327f96=function(_0x5507e5){while(--_0x5507e5){_0x5444d2['push'](_0x5444d2['shift']());}};_0x327f96(++_0x467674);}(_0x741c,0x196));var _0xc741=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x741c[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xc741('0x0'));var attributes=require(_0xc741('0x1'));var qs=require(_0xc741('0x2'));var squel=require(_0xc741('0x3'));module[_0xc741('0x4')]=function(_0x31de60){var _0x5c8d3b=_0x31de60['models'];function _0x4089bf(_0x4ccc27,_0xc80e99){return new Promise(function(_0x1935b4,_0x3708ae){if(!_0xc80e99)return _0x1935b4(null);var _0x133bc4=_0xc80e99[_0xc741('0x5')]?{[_0xc80e99[_0xc741('0x5')][_0xc741('0x6')]]:_0xc80e99['filter'][_0xc741('0x7')]}:undefined;return _0x5c8d3b[_0x4ccc27][_0xc741('0x8')]({'where':_0x133bc4,'raw':!![]})['then'](function(_0xc6555){_0xc80e99['associatedResources']=_['map'](_0xc6555,'id');_0x1935b4(_0xc80e99);})[_0xc741('0x9')](function(_0x264cb9){_0x3708ae(_0x264cb9);});});}function _0x40639b(_0x47501c,_0xa1abb1){return new Promise(function(_0x29920b,_0x312684){var _0x506b51=_0x47501c['filter']?{[_0x47501c['filter'][_0xc741('0x6')]]:_0x47501c[_0xc741('0x5')][_0xc741('0x7')]}:undefined;return _0x5c8d3b[_0x47501c[_0xc741('0xa')]][_0xc741('0x8')]({'where':_0x506b51,'raw':!![]})['then'](function(_0xde1da){_0xa1abb1[_0xc741('0xb')]=_['map'](_0xde1da,function(_0xc0383){return _0xc0383[_0xc741('0xc')];});_0x29920b(_0xa1abb1);})[_0xc741('0x9')](function(_0x450179){_0x312684(_0x450179);});});}function _0x21514e(_0x5bbe86,_0x4dcf16,_0x341f54){if(!_0x4dcf16)return Promise['resolve'](null);return new Promise(function(_0x1c4f3a,_0x3903c6){return _0x5c8d3b['UserProfileResource']['findAll']({'where':{'sectionId':_0x4dcf16['id']},'raw':!![]})[_0xc741('0xd')](function(_0x477cc2){if(_0x5bbe86[_0xc741('0x6')]&&_0x5bbe86['field']!=='id'){_0x4dcf16[_0xc741('0xb')]=_[_0xc741('0xe')](_0x477cc2,function(_0x475348){return _0x475348[_0x5bbe86[_0xc741('0x6')]];});}else{if(_0x341f54===_0xc741('0xf')){_0x4dcf16[_0xc741('0xb')]=_[_0xc741('0xe')](_0x477cc2,function(_0x30b7ea){return{'id':_0x30b7ea[_0xc741('0x10')],'type':_0x30b7ea['type']};});}else{_0x4dcf16[_0xc741('0xb')]=_['map'](_0x477cc2,function(_0x212c67){return _0x212c67['resourceId'];});}}_0x1c4f3a(_0x4dcf16);})[_0xc741('0x9')](function(_0x3c3497){_0x3903c6(_0x3c3497);});});}function _0x38e752(_0x5ca96f,_0x71c786){var _0x5a89bd={'parentSections':[]};switch(_0x5ca96f[_0xc741('0x11')]()){case _0xc741('0x12'):_0x5a89bd[_0xc741('0x13')]='SquareProject';break;case'odbc':_0x5a89bd['childModel']=_0xc741('0x14');break;case _0xc741('0x15'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x16');_0x5a89bd[_0xc741('0x17')]=[{'name':'SquareProjects','field':'name','foreignKey':_0xc741('0x18')}];break;case _0xc741('0x19'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x1a');break;case _0xc741('0x1b'):_0x5a89bd[_0xc741('0x13')]='CmContact';_0x5a89bd[_0xc741('0x17')]=[{'name':_0xc741('0x1c'),'field':'id','foreignKey':'ListId'}];break;case _0xc741('0x1d'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x1e');break;case _0xc741('0x1f'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x20');break;case _0xc741('0x21'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x22');break;case'chatqueues':_0x5a89bd[_0xc741('0x13')]='ChatQueue';break;case _0xc741('0x23'):_0x5a89bd['childModel']='ChatWebsite';break;case _0xc741('0x24'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x25');break;case'faxaccounts':_0x5a89bd[_0xc741('0x13')]=_0xc741('0x26');break;case _0xc741('0x27'):case'internalroutes':case _0xc741('0x28'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x29');break;case _0xc741('0x2a'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x2b');break;case _0xc741('0x2c'):_0x5a89bd['childModel']='VoiceMail';break;case _0xc741('0x2d'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x2e');_0x5a89bd[_0xc741('0x17')]=[{'name':_0xc741('0x2f'),'field':_0xc741('0xc'),'foreignKey':'membername','model':_0xc741('0x30'),'filter':{'field':_0xc741('0x31'),'value':['agent']}},{'name':_0xc741('0x32'),'field':_0xc741('0xc'),'foreignKey':_0xc741('0x33'),'model':'User','filter':{'field':_0xc741('0x31'),'value':[_0xc741('0x34')]}},{'name':_0xc741('0x35'),'field':_0xc741('0xc'),'foreignKey':_0xc741('0x36'),'model':_0xc741('0x37'),'filter':{'field':_0xc741('0x38'),'value':['inbound']}},{'name':_0xc741('0x39'),'field':_0xc741('0xc'),'foreignKey':_0xc741('0x36'),'model':_0xc741('0x37'),'filter':{'field':_0xc741('0x38'),'value':[_0xc741('0x3a')]}}];break;case _0xc741('0x3b'):_0x5a89bd[_0xc741('0x13')]='VoiceMusicOnHold';break;case _0xc741('0x3c'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x3d');break;case _0xc741('0x3e'):_0x5a89bd['childModel']=_0xc741('0x3f');break;case'ivrcampaigns':_0x5a89bd[_0xc741('0x13')]=_0xc741('0x40');break;case _0xc741('0x41'):_0x5a89bd['childModel']='MailQueue';break;case _0xc741('0x42'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x43');break;case _0xc741('0x44'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x45');break;case _0xc741('0x46'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x47');break;case _0xc741('0x48'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x49');break;case _0xc741('0x4a'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x4b');break;case _0xc741('0x4c'):_0x5a89bd[_0xc741('0x13')]='SmsAccount';break;case _0xc741('0x4d'):_0x5a89bd['childModel']=_0xc741('0x4e');break;case'whatsappaccounts':_0x5a89bd[_0xc741('0x13')]=_0xc741('0x4f');break;case'teams':_0x5a89bd[_0xc741('0x13')]=_0xc741('0x50');break;case'voicequeues':case _0xc741('0x51'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x37');if(_0x71c786){_0x5a89bd[_0xc741('0x17')]=[{'name':_0xc741('0x35')},{'name':_0xc741('0x39')}];}break;case _0xc741('0x52'):case'agents':case _0xc741('0x53'):_0x5a89bd['childModel']='User';if(_0x71c786){_0x5a89bd[_0xc741('0x17')]=[{'name':'Users','filter':{'field':_0xc741('0x31'),'value':[_0xc741('0x54'),_0xc741('0x55')]},'ignore':!![]},{'name':_0xc741('0x2f')},{'name':_0xc741('0x32')}];}break;case _0xc741('0x56'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x57');break;case _0xc741('0x58'):_0x5a89bd['childModel']='SalesforceAccount';break;case _0xc741('0x59'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x5a');break;case _0xc741('0x5b'):_0x5a89bd['childModel']=_0xc741('0x5c');break;case'deskaccounts':_0x5a89bd[_0xc741('0x13')]=_0xc741('0x5d');break;case _0xc741('0x5e'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x5f');break;case _0xc741('0x60'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x30');break;case _0xc741('0x61'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x62');break;case _0xc741('0x63'):_0x5a89bd['childModel']=_0xc741('0x64');break;case _0xc741('0x65'):_0x5a89bd[_0xc741('0x13')]='Dashboard';break;case _0xc741('0x66'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x67');break;case _0xc741('0x68'):_0x5a89bd['childModel']=_0xc741('0x69');break;case _0xc741('0x6a'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x6b');break;case'sounds':_0x5a89bd[_0xc741('0x13')]='Sound';break;case _0xc741('0x6c'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x6d');break;case _0xc741('0x6e'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x6f');break;case'triggers':_0x5a89bd[_0xc741('0x13')]='Trigger';break;case _0xc741('0x70'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x71');break;case _0xc741('0x72'):_0x5a89bd[_0xc741('0x13')]='Variable';break;case'plugins':_0x5a89bd[_0xc741('0x13')]='Plugin';break;case _0xc741('0x73'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0xf');_0x5a89bd[_0xc741('0x17')]=[{'name':_0xc741('0x74'),'field':'id','foreignKey':_0xc741('0x75')}];break;case _0xc741('0x76'):_0x5a89bd[_0xc741('0x13')]=_0xc741('0x77');break;}return _0x5a89bd;}function _0x335eb6(_0xc1c742,_0x1e31bb){var _0x4f386b=_0xc1c742['charAt'](0x0)[_0xc741('0x78')]()+_0xc1c742[_0xc741('0x79')](0x1);var _0xe0b6d8={'type':_0x5c8d3b['Sequelize']['QueryTypes'][_0xc741('0x7a')],'raw':!![]};return new Promise(function(_0x5a4f5b,_0x394be8){var _0x3523a2=squel[_0xc741('0x7b')]()[_0xc741('0x6')](_0xc741('0x7c')+_0x4f386b+'InteractionId','id')['field'](_0xc741('0x7d'))[_0xc741('0x7e')]('user_has_'+_0xc1c742+_0xc741('0x7f'),'ui')[_0xc741('0x80')](_0xc741('0x81'),_0x1e31bb['id']);return _0x5c8d3b[_0xc741('0x82')][_0xc741('0x83')](_0x3523a2['toString'](),_0xe0b6d8)['then'](function(_0x2802a7){_0x1e31bb[_0x4f386b+'OpenTabs']=_0x2802a7;_0x5a4f5b(_0x2802a7);})[_0xc741('0x9')](function(_0x43471d){_0x394be8(_0x43471d);});});}return _0x31de60['define'](_0xc741('0x84'),attributes,{'tableName':_0xc741('0x85'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0xf47dfd){var _0x1aecb3={'raw':![],'where':{}};var _0x1c5c67={};var _0x9027d1={'count':0x0,'rows':[]};var _0xd0575b=_0xf47dfd['query'][_0xc741('0x86')];var _0x28390d=_0xf47dfd['query'][_0xc741('0x87')]||![];var _0x2d9a96=_0x38e752(_0xd0575b,_0x28390d);if(!_0x2d9a96[_0xc741('0x13')])throw new Error('Invalid\x20section\x20\x27'+_0xd0575b+'\x27');var _0xe0f852=[{'name':_0xd0575b}];if(!_[_0xc741('0x88')](_0x2d9a96['parentSections']))_0xe0f852=_0x2d9a96[_0xc741('0x17')];var _0x3768ef=[];for(var _0xfa0e86=0x0;_0xfa0e86<_0xe0f852[_0xc741('0x89')];_0xfa0e86++){_0x3768ef['push'](_0x5c8d3b['UserProfileSection'][_0xc741('0x8a')]({'where':{'userProfileId':_0xf47dfd['params']['id'],'name':_0xe0f852[_0xfa0e86][_0xc741('0xc')]},'raw':!![]}));}return Promise[_0xc741('0x8b')](_0x3768ef)[_0xc741('0xd')](function(_0x1d0401){var _0x438997=_[_0xc741('0x5')](_0x1d0401,function(_0x5eab1a){return _0x5eab1a?_0x5eab1a:undefined;});var _0x40cfe0=_['filter'](_0xe0f852,[_0xc741('0x8c'),!![]]);var _0x1931e2=_[_0xc741('0x88')](_0x438997)&&_[_0xc741('0x88')](_0x40cfe0)?null:_['union'](_0x40cfe0,_0x438997);if(!_0x1931e2)return null;var _0x31c533=[];for(var _0x19b48a=0x0;_0x19b48a<_0x1931e2[_0xc741('0x89')];_0x19b48a++){var _0x164525=_[_0xc741('0x8a')](_0xe0f852,function(_0x240865){return _0x1931e2[_0x19b48a]?_0x240865[_0xc741('0xc')]===_0x1931e2[_0x19b48a][_0xc741('0xc')]:null;});if(_0x164525){if(_0x1931e2[_0x19b48a][_0xc741('0x8c')]){_0x31c533['push'](_0x4089bf(_0x2d9a96['childModel'],_0x1931e2[_0x19b48a]));}else{if(!_0x1931e2[_0x19b48a][_0xc741('0x8d')]){_0x31c533[_0xc741('0x8e')](_0x21514e(_0x164525,_0x1931e2[_0x19b48a],_0x2d9a96[_0xc741('0x13')]));}else{if(_0x164525[_0xc741('0xa')]){_0x31c533['push'](_0x40639b(_0x164525,_0x1931e2[_0x19b48a]));}}}}}return Promise[_0xc741('0x8b')](_0x31c533);})[_0xc741('0xd')](function(_0x22982b){var _0x3f3b84=_0x22982b;var _0x31c314=null;if(_0x3f3b84){_0x31c314=_0x3f3b84[_0xc741('0x89')]===0x1?_0x3f3b84[0x0]:null;}if(!_0x31c314&&!_0x3f3b84)return _0x9027d1;var _0x2cb099=_0x5c8d3b[_0x2d9a96[_0xc741('0x13')]]['rawAttributes'];_0x1c5c67[_0xc741('0xa')]=_['keys'](_0x2cb099);_0x1c5c67['query']=_[_0xc741('0x8f')](_0xf47dfd[_0xc741('0x83')]);_0x1c5c67['filters']=_[_0xc741('0x90')](_0x1c5c67[_0xc741('0xa')],_0x1c5c67['query']);_0x1aecb3['attributes']=_[_0xc741('0x90')](_0x1c5c67[_0xc741('0xa')],qs['fields'](_0xf47dfd[_0xc741('0x83')][_0xc741('0x91')]));_0x1aecb3[_0xc741('0x92')]=_0x1aecb3[_0xc741('0x92')][_0xc741('0x89')]?_0x1aecb3[_0xc741('0x92')]:_0x1c5c67[_0xc741('0xa')];if(!_0xf47dfd[_0xc741('0x83')]['hasOwnProperty'](_0xc741('0x93'))){_0x1aecb3[_0xc741('0x94')]=qs[_0xc741('0x94')](_0xf47dfd[_0xc741('0x83')]['limit']);_0x1aecb3[_0xc741('0x95')]=qs[_0xc741('0x95')](_0xf47dfd['query'][_0xc741('0x95')]);}_0x1aecb3[_0xc741('0x96')]=qs[_0xc741('0x97')](_0xf47dfd[_0xc741('0x83')]['sort']);_0x1aecb3['where']=qs['filters'](_[_0xc741('0x98')](_0xf47dfd[_0xc741('0x83')],_0x1c5c67[_0xc741('0x99')]));if(_0xf47dfd[_0xc741('0x83')]['filter']){_0x1aecb3[_0xc741('0x80')]=_[_0xc741('0x9a')](_0x1aecb3['where'],{'$or':_['map'](_0x2cb099,function(_0x110cac){if(_0x110cac[_0xc741('0x38')][_0xc741('0x9b')]!=='VIRTUAL'){var _0x3922e1={};_0x3922e1[_0x110cac[_0xc741('0x6')]]={'$like':'%'+_0xf47dfd[_0xc741('0x83')]['filter']+'%'};return _0x3922e1;}})});}var _0x4a3c3a=[];var _0x58b414=null;var _0x2e7cfa={};if(_0x31c314){_0x58b414=_[_0xc741('0x8a')](_0xe0f852,['name',_0x31c314['name']]);if(_0x58b414[_0xc741('0x6')]){_0x2e7cfa={};if(_0x2d9a96[_0xc741('0x13')]==='AnalyticExtractedReport'){_0x2e7cfa[_0x58b414[_0xc741('0x9c')]]=_['map'](_0x31c314['associatedResources'],'id');}else{_0x2e7cfa[_0x58b414['foreignKey']]=_0x31c314[_0xc741('0xb')];}_0x4a3c3a[_0xc741('0x8e')](_0x2e7cfa);}else{_0x1aecb3[_0xc741('0x80')]['id']=_0x31c314[_0xc741('0xb')];}}else{for(var _0x59822a=0x0;_0x59822a<_0x3f3b84[_0xc741('0x89')];_0x59822a++){_0x58b414=_['find'](_0xe0f852,[_0xc741('0xc'),_0x3f3b84[_0x59822a]['name']]);if(_0x58b414['field']){_0x2e7cfa={};_0x2e7cfa[_0x58b414[_0xc741('0x9c')]]=_0x3f3b84[_0x59822a][_0xc741('0xb')];_0x4a3c3a['push'](_0x2e7cfa);}else{if(!_0x1aecb3[_0xc741('0x80')]['id'])_0x1aecb3[_0xc741('0x80')]['id']=[];_0x3f3b84[_0x59822a][_0xc741('0xb')][_0xc741('0x9d')](function(_0x3103bd){_0x1aecb3[_0xc741('0x80')]['id']['push'](_0x3103bd);});}}}if(!_[_0xc741('0x88')](_0x4a3c3a)){_0x1aecb3[_0xc741('0x80')]=_[_0xc741('0x9a')](_0x1aecb3[_0xc741('0x80')],{'$and':{'$or':_0x4a3c3a}});}_0x1aecb3=_[_0xc741('0x9a')]({},_0x1aecb3,_0xf47dfd[_0xc741('0x9e')]);if(_0x31c314&&!_0x31c314[_0xc741('0x8d')]&&_0x2d9a96[_0xc741('0x13')]===_0xc741('0xf')){if(_0xf47dfd[_0xc741('0x83')][_0xc741('0x9f')]){_0x1aecb3[_0xc741('0xa0')]=[{'all':!![]}];}return _0x5c8d3b[_0x2d9a96['childModel']]['findAll'](_0x1aecb3)['then'](function(_0x4c78dc){var _0x1a693a=[];_0x4c78dc[_0xc741('0x9d')](function(_0xb83d6e){var _0x2e1962;switch(_0xb83d6e[_0xc741('0xa1')]){case _0xc741('0xa2'):_0x2e1962=_[_0xc741('0x8a')](_0x31c314[_0xc741('0xb')],function(_0x252e16){return _0x252e16['id']===_0xb83d6e[_0xc741('0x75')]&&_0x252e16[_0xc741('0x38')]===_0xc741('0xa3');});break;case _0xc741('0xa4'):_0x2e1962=_['find'](_0x31c314[_0xc741('0xb')],function(_0x211cee){return _0x211cee['id']===_0xb83d6e[_0xc741('0x75')]&&_0x211cee[_0xc741('0x38')]===_0xc741('0xa5');});break;}if(_0x2e1962)_0x1a693a[_0xc741('0x8e')](_0xb83d6e);});_0x9027d1[_0xc741('0xa6')]=_0x1a693a[_0xc741('0x89')];_0x9027d1[_0xc741('0xa7')]=_0x1a693a;return _0x9027d1;});}else{return _0x5c8d3b[_0x2d9a96[_0xc741('0x13')]][_0xc741('0xa6')]({'where':_0x1aecb3[_0xc741('0x80')]})['then'](function(_0x3d755c){_0x9027d1[_0xc741('0xa6')]=_0x3d755c;if(_0xf47dfd[_0xc741('0x83')]['includeAll']){if(_0x2d9a96[_0xc741('0x13')]===_0xc741('0xa8')){_0x1aecb3['include']=[{'model':_0x5c8d3b[_0xc741('0x6d')],'as':'Tags','attributes':['id',_0xc741('0xc'),_0xc741('0xa9')],'required':_0xf47dfd[_0xc741('0x83')]['tag']?!![]:![]},{'model':_0x5c8d3b[_0xc741('0x6d')],'as':_0xc741('0xaa'),'attributes':['id','name','color'],'through':_0xf47dfd[_0xc741('0x83')][_0xc741('0xab')]?{'attributes':[],'where':{'TagId':_0xf47dfd[_0xc741('0x83')][_0xc741('0xab')]||undefined}}:{},'required':_0xf47dfd['query'][_0xc741('0xab')]?!![]:![]}];}else{_0x1aecb3[_0xc741('0xa0')]=[{'all':!![]}];}}return _0x5c8d3b[_0x2d9a96[_0xc741('0x13')]][_0xc741('0x8')](_0x1aecb3);})[_0xc741('0xd')](function(_0x4045cc){_0x9027d1[_0xc741('0xa7')]=_0x4045cc;if(_0xd0575b==='Agents'&&_0xf47dfd[_0xc741('0x83')][_0xc741('0xac')]===_0xc741('0xad')){var _0x62d071=[];for(var _0x193414=0x0;_0x193414<_0x9027d1[_0xc741('0xa7')]['length'];_0x193414++){_0x62d071[_0xc741('0x8e')](_0x335eb6(_0xc741('0xae'),_0x9027d1['rows'][_0x193414]['dataValues']));_0x62d071[_0xc741('0x8e')](_0x335eb6(_0xc741('0xaf'),_0x9027d1['rows'][_0x193414][_0xc741('0xb0')]));_0x62d071[_0xc741('0x8e')](_0x335eb6(_0xc741('0xb1'),_0x9027d1[_0xc741('0xa7')][_0x193414][_0xc741('0xb0')]));_0x62d071[_0xc741('0x8e')](_0x335eb6(_0xc741('0xb2'),_0x9027d1[_0xc741('0xa7')][_0x193414][_0xc741('0xb0')]));_0x62d071[_0xc741('0x8e')](_0x335eb6(_0xc741('0xb3'),_0x9027d1['rows'][_0x193414]['dataValues']));_0x62d071[_0xc741('0x8e')](_0x335eb6(_0xc741('0xb4'),_0x9027d1[_0xc741('0xa7')][_0x193414]['dataValues']));}return Promise[_0xc741('0x8b')](_0x62d071)['then'](function(){return _0x9027d1;});}return _0x9027d1;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 49b9b5a..455b558 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 _0x6455=['error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./userProfile.socket','register','request','then','UserProfile,\x20%s,\x20%s','debug','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0xf70361,_0x12cbbc){var _0x26324c=function(_0x247e7c){while(--_0x247e7c){_0xf70361['push'](_0xf70361['shift']());}};_0x26324c(++_0x12cbbc);}(_0x6455,0x97));var _0x5645=function(_0x1a6f1e,_0x1c012a){_0x1a6f1e=_0x1a6f1e-0x0;var _0x573c03=_0x6455[_0x1a6f1e];return _0x573c03;};'use strict';var _=require(_0x5645('0x0'));var util=require('util');var moment=require(_0x5645('0x1'));var BPromise=require(_0x5645('0x2'));var rs=require(_0x5645('0x3'));var fs=require('fs');var Redis=require(_0x5645('0x4'));var db=require(_0x5645('0x5'))['db'];var utils=require(_0x5645('0x6'));var logger=require('../../config/logger')(_0x5645('0x7'));var config=require(_0x5645('0x8'));var jayson=require(_0x5645('0x9'));var client=jayson[_0x5645('0xa')][_0x5645('0xb')]({'port':0x232a});config[_0x5645('0xc')]=_[_0x5645('0xd')](config[_0x5645('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5645('0xc')]));require(_0x5645('0xe'))[_0x5645('0xf')](socket);function respondWithRpcPromise(_0x34fe4e,_0x7f9893,_0x16af81){return new BPromise(function(_0x587c61,_0x212e46){return client[_0x5645('0x10')](_0x34fe4e,_0x16af81)[_0x5645('0x11')](function(_0x21e32c){logger['info'](_0x5645('0x12'),_0x7f9893,'request\x20sent');logger[_0x5645('0x13')](_0x5645('0x14'),_0x7f9893,_0x5645('0x15'),JSON[_0x5645('0x16')](_0x21e32c));if(_0x21e32c[_0x5645('0x17')]){if(_0x21e32c[_0x5645('0x17')][_0x5645('0x18')]===0x1f4){logger[_0x5645('0x17')]('UserProfile,\x20%s,\x20%s',_0x7f9893,_0x21e32c[_0x5645('0x17')][_0x5645('0x19')]);return _0x212e46(_0x21e32c[_0x5645('0x17')]['message']);}logger['error'](_0x5645('0x12'),_0x7f9893,_0x21e32c[_0x5645('0x17')]['message']);return _0x587c61(_0x21e32c[_0x5645('0x17')][_0x5645('0x19')]);}else{logger[_0x5645('0x1a')]('UserProfile,\x20%s,\x20%s',_0x7f9893,_0x5645('0x15'));_0x587c61(_0x21e32c[_0x5645('0x1b')][_0x5645('0x19')]);}})[_0x5645('0x1c')](function(_0x5ac9ee){logger[_0x5645('0x17')]('UserProfile,\x20%s,\x20%s',_0x7f9893,_0x5ac9ee);_0x212e46(_0x5ac9ee);});});} \ No newline at end of file +var _0x5d0a=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','stringify','error','UserProfile,\x20%s,\x20%s','message','result','lodash','moment'];(function(_0x597d30,_0x3faeff){var _0x3e0c69=function(_0x1f0b74){while(--_0x1f0b74){_0x597d30['push'](_0x597d30['shift']());}};_0x3e0c69(++_0x3faeff);}(_0x5d0a,0x175));var _0xa5d0=function(_0x558ad6,_0x258bf7){_0x558ad6=_0x558ad6-0x0;var _0x24b541=_0x5d0a[_0x558ad6];return _0x24b541;};'use strict';var _=require(_0xa5d0('0x0'));var util=require('util');var moment=require(_0xa5d0('0x1'));var BPromise=require('bluebird');var rs=require(_0xa5d0('0x2'));var fs=require('fs');var Redis=require(_0xa5d0('0x3'));var db=require(_0xa5d0('0x4'))['db'];var utils=require(_0xa5d0('0x5'));var logger=require('../../config/logger')(_0xa5d0('0x6'));var config=require(_0xa5d0('0x7'));var jayson=require(_0xa5d0('0x8'));var client=jayson[_0xa5d0('0x9')][_0xa5d0('0xa')]({'port':0x232a});config[_0xa5d0('0xb')]=_[_0xa5d0('0xc')](config[_0xa5d0('0xb')],{'host':_0xa5d0('0xd'),'port':0x18eb});var socket=require(_0xa5d0('0xe'))(new Redis(config[_0xa5d0('0xb')]));require('./userProfile.socket')[_0xa5d0('0xf')](socket);function respondWithRpcPromise(_0x29a3c1,_0x1f4235,_0x23e569){return new BPromise(function(_0x14fea2,_0x23f06a){return client[_0xa5d0('0x10')](_0x29a3c1,_0x23e569)[_0xa5d0('0x11')](function(_0xc847c9){logger[_0xa5d0('0x12')]('UserProfile,\x20%s,\x20%s',_0x1f4235,_0xa5d0('0x13'));logger['debug']('UserProfile,\x20%s,\x20%s,\x20%s',_0x1f4235,_0xa5d0('0x13'),JSON[_0xa5d0('0x14')](_0xc847c9));if(_0xc847c9[_0xa5d0('0x15')]){if(_0xc847c9[_0xa5d0('0x15')]['code']===0x1f4){logger['error'](_0xa5d0('0x16'),_0x1f4235,_0xc847c9[_0xa5d0('0x15')][_0xa5d0('0x17')]);return _0x23f06a(_0xc847c9[_0xa5d0('0x15')][_0xa5d0('0x17')]);}logger[_0xa5d0('0x15')](_0xa5d0('0x16'),_0x1f4235,_0xc847c9['error'][_0xa5d0('0x17')]);return _0x14fea2(_0xc847c9['error'][_0xa5d0('0x17')]);}else{logger[_0xa5d0('0x12')]('UserProfile,\x20%s,\x20%s',_0x1f4235,'request\x20sent');_0x14fea2(_0xc847c9[_0xa5d0('0x18')][_0xa5d0('0x17')]);}})['catch'](function(_0x39beba){logger[_0xa5d0('0x15')](_0xa5d0('0x16'),_0x1f4235,_0x39beba);_0x23f06a(_0x39beba);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index e18bd0c..b84f9b6 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 _0x0836=['removeListener','register','length','userProfile:','./userProfile.events','save','update','emit'];(function(_0x1f69bc,_0xaffd71){var _0x1ac3c5=function(_0x3cd005){while(--_0x3cd005){_0x1f69bc['push'](_0x1f69bc['shift']());}};_0x1ac3c5(++_0xaffd71);}(_0x0836,0x1ac));var _0x6083=function(_0x5300bf,_0xcc7c66){_0x5300bf=_0x5300bf-0x0;var _0x282ba1=_0x0836[_0x5300bf];return _0x282ba1;};'use strict';var UserProfileEvents=require(_0x6083('0x0'));var events=[_0x6083('0x1'),'remove',_0x6083('0x2')];function createListener(_0x16c3d0,_0x4130c3){return function(_0x2b8a43){_0x4130c3[_0x6083('0x3')](_0x16c3d0,_0x2b8a43);};}function removeListener(_0xc6b368,_0x38699e){return function(){UserProfileEvents[_0x6083('0x4')](_0xc6b368,_0x38699e);};}exports[_0x6083('0x5')]=function(_0x5464eb){for(var _0x50e311=0x0,_0x113594=events[_0x6083('0x6')];_0x50e311<_0x113594;_0x50e311++){var _0x2495a8=events[_0x50e311];var _0x3200c2=createListener(_0x6083('0x7')+_0x2495a8,_0x5464eb);UserProfileEvents['on'](_0x2495a8,_0x3200c2);}}; \ No newline at end of file +var _0x217e=['register','length','userProfile:','./userProfile.events','remove','update'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x217e,0x1e3));var _0xe217=function(_0x2227dd,_0x48ca1a){_0x2227dd=_0x2227dd-0x0;var _0x111a47=_0x217e[_0x2227dd];return _0x111a47;};'use strict';var UserProfileEvents=require(_0xe217('0x0'));var events=['save',_0xe217('0x1'),_0xe217('0x2')];function createListener(_0x46710a,_0x28281f){return function(_0x36d92b){_0x28281f['emit'](_0x46710a,_0x36d92b);};}function removeListener(_0x41222c,_0x228f7d){return function(){UserProfileEvents['removeListener'](_0x41222c,_0x228f7d);};}exports[_0xe217('0x3')]=function(_0x1b0f7f){for(var _0x476906=0x0,_0x1d6776=events[_0xe217('0x4')];_0x476906<_0x1d6776;_0x476906++){var _0xfc4f56=events[_0x476906];var _0x3399b5=createListener(_0xe217('0x5')+_0xfc4f56,_0x1b0f7f);UserProfileEvents['on'](_0xfc4f56,_0x3399b5);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 59cbd4e..2adb044 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 _0x7193=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','show','post','create','put','delete','destroy','util'];(function(_0x51f4fc,_0x1fe3ef){var _0x4d96fc=function(_0xddc9){while(--_0xddc9){_0x51f4fc['push'](_0x51f4fc['shift']());}};_0x4d96fc(++_0x1fe3ef);}(_0x7193,0x1e5));var _0x3719=function(_0x2d08c5,_0x2b19f1){_0x2d08c5=_0x2d08c5-0x0;var _0x5c71b1=_0x7193[_0x2d08c5];return _0x5c71b1;};'use strict';var multer=require('multer');var util=require(_0x3719('0x0'));var path=require('path');var timeout=require(_0x3719('0x1'));var express=require(_0x3719('0x2'));var router=express[_0x3719('0x3')]();var fs_extra=require(_0x3719('0x4'));var auth=require(_0x3719('0x5'));var interaction=require(_0x3719('0x6'));var config=require(_0x3719('0x7'));var controller=require('./userProfileResource.controller');router[_0x3719('0x8')]('/',auth[_0x3719('0x9')](),controller['index']);router[_0x3719('0x8')]('/describe',auth[_0x3719('0x9')](),controller[_0x3719('0xa')]);router[_0x3719('0x8')](_0x3719('0xb'),auth[_0x3719('0x9')](),controller[_0x3719('0xc')]);router[_0x3719('0xd')]('/',auth[_0x3719('0x9')](),controller[_0x3719('0xe')]);router[_0x3719('0xf')](_0x3719('0xb'),auth[_0x3719('0x9')](),controller['update']);router[_0x3719('0x10')](_0x3719('0xb'),auth[_0x3719('0x9')](),controller[_0x3719('0x11')]);module['exports']=router; \ No newline at end of file +var _0xa880=['/describe','isAuthenticated','describe','/:id','show','post','create','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./userProfileResource.controller','get','index'];(function(_0x7cb4c,_0x5eeecd){var _0x13ecfd=function(_0x1086c8){while(--_0x1086c8){_0x7cb4c['push'](_0x7cb4c['shift']());}};_0x13ecfd(++_0x5eeecd);}(_0xa880,0x1ee));var _0x0a88=function(_0x223729,_0x470bb5){_0x223729=_0x223729-0x0;var _0x2119b6=_0xa880[_0x223729];return _0x2119b6;};'use strict';var multer=require(_0x0a88('0x0'));var util=require('util');var path=require(_0x0a88('0x1'));var timeout=require(_0x0a88('0x2'));var express=require(_0x0a88('0x3'));var router=express[_0x0a88('0x4')]();var fs_extra=require(_0x0a88('0x5'));var auth=require(_0x0a88('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0a88('0x7'));router[_0x0a88('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a88('0x9')]);router['get'](_0x0a88('0xa'),auth[_0x0a88('0xb')](),controller[_0x0a88('0xc')]);router[_0x0a88('0x8')](_0x0a88('0xd'),auth['isAuthenticated'](),controller[_0x0a88('0xe')]);router[_0x0a88('0xf')]('/',auth[_0x0a88('0xb')](),controller[_0x0a88('0x10')]);router['put'](_0x0a88('0xd'),auth[_0x0a88('0xb')](),controller['update']);router['delete']('/:id',auth[_0x0a88('0xb')](),controller[_0x0a88('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 5789110..0f27203 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 _0x07bb=['STRING','INTEGER','sequelize'];(function(_0x5561be,_0x1b9491){var _0x103b5d=function(_0x9d20ff){while(--_0x9d20ff){_0x5561be['push'](_0x5561be['shift']());}};_0x103b5d(++_0x1b9491);}(_0x07bb,0x1c1));var _0xb07b=function(_0x3db86b,_0xc3ca3e){_0x3db86b=_0x3db86b-0x0;var _0x34a8e1=_0x07bb[_0x3db86b];return _0x34a8e1;};'use strict';var Sequelize=require(_0xb07b('0x0'));module['exports']={'name':{'type':Sequelize[_0xb07b('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xb07b('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xb07b('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x8705=['STRING','INTEGER','sequelize','exports'];(function(_0xf55e73,_0x3fecc5){var _0x116b99=function(_0x314e0c){while(--_0x314e0c){_0xf55e73['push'](_0xf55e73['shift']());}};_0x116b99(++_0x3fecc5);}(_0x8705,0x82));var _0x5870=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x8705[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require(_0x5870('0x0'));module[_0x5870('0x1')]={'name':{'type':Sequelize[_0x5870('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x5870('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x5870('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 7489831..4ee5bdd 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 _0xacf4=['findAll','rows','catch','show','params','intersection','length','includeAll','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','map','UserProfileResource','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','hasOwnProperty','sort','where','pick','filter','type','VIRTUAL','merge','options','include'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0xacf4,0xe7));var _0x4acf=function(_0x160476,_0x5bdd7c){_0x160476=_0x160476-0x0;var _0x5dc472=_0xacf4[_0x160476];return _0x5dc472;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4acf('0x0'));var jsonpatch=require(_0x4acf('0x1'));var rp=require(_0x4acf('0x2'));var moment=require(_0x4acf('0x3'));var BPromise=require(_0x4acf('0x4'));var Mustache=require(_0x4acf('0x5'));var util=require(_0x4acf('0x6'));var path=require('path');var sox=require(_0x4acf('0x7'));var csv=require(_0x4acf('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4acf('0x9'));var _=require(_0x4acf('0xa'));var squel=require(_0x4acf('0xb'));var crypto=require(_0x4acf('0xc'));var jsforce=require(_0x4acf('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4acf('0xe'));var Papa=require('papaparse');var Redis=require(_0x4acf('0xf'));var authService=require(_0x4acf('0x10'));var qs=require(_0x4acf('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4acf('0x12'));var logger=require(_0x4acf('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x4acf('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1783d2,_0x979f49){_0x979f49=_0x979f49||0xcc;return function(_0x3734e1){if(_0x3734e1){return _0x1783d2[_0x4acf('0x15')](_0x979f49);}return _0x1783d2[_0x4acf('0x16')](_0x979f49)[_0x4acf('0x17')]();};}function respondWithResult(_0x7ab3ea,_0x15386a){_0x15386a=_0x15386a||0xc8;return function(_0x2025ca){if(_0x2025ca){return _0x7ab3ea[_0x4acf('0x16')](_0x15386a)[_0x4acf('0x18')](_0x2025ca);}};}function respondWithFilteredResult(_0x5f0260,_0x1b584a){return function(_0x57d8e0){if(_0x57d8e0){var _0x34cec1=typeof _0x1b584a[_0x4acf('0x19')]===_0x4acf('0x1a')&&typeof _0x1b584a['limit']==='undefined';var _0x13d10e=_0x57d8e0[_0x4acf('0x1b')];var _0x240c00=_0x34cec1?0x0:_0x1b584a['offset'];var _0x2a678b=_0x34cec1?_0x57d8e0[_0x4acf('0x1b')]:_0x1b584a[_0x4acf('0x19')]+_0x1b584a[_0x4acf('0x1c')];var _0x2f0cec;if(_0x2a678b>=_0x13d10e){_0x2a678b=_0x13d10e;_0x2f0cec=0xc8;}else{_0x2f0cec=0xce;}_0x5f0260[_0x4acf('0x16')](_0x2f0cec);return _0x5f0260[_0x4acf('0x1d')](_0x4acf('0x1e'),_0x240c00+'-'+_0x2a678b+'/'+_0x13d10e)[_0x4acf('0x18')](_0x57d8e0);}return null;};}function patchUpdates(_0x2feb89){return function(_0x1a3118){try{jsonpatch['apply'](_0x1a3118,_0x2feb89,!![]);}catch(_0x28d698){return BPromise[_0x4acf('0x1f')](_0x28d698);}return _0x1a3118['save']();};}function saveUpdates(_0x41e5d2,_0x17775f){return function(_0x569d9e){if(_0x569d9e){return _0x569d9e[_0x4acf('0x20')](_0x41e5d2)[_0x4acf('0x21')](function(_0x433b7a){return _0x433b7a;});}return null;};}function removeEntity(_0x454555,_0x53885f){return function(_0x1a2286){if(_0x1a2286){return _0x1a2286[_0x4acf('0x22')]()['then'](function(){_0x454555[_0x4acf('0x16')](0xcc)[_0x4acf('0x17')]();});}};}function handleEntityNotFound(_0x52a84a,_0x126522){return function(_0x7ebb){if(!_0x7ebb){_0x52a84a[_0x4acf('0x15')](0x194);}return _0x7ebb;};}function handleError(_0x16458f,_0x571a30){_0x571a30=_0x571a30||0x1f4;return function(_0x50236d){logger[_0x4acf('0x23')](_0x50236d[_0x4acf('0x24')]);if(_0x50236d[_0x4acf('0x25')]){delete _0x50236d[_0x4acf('0x25')];}_0x16458f[_0x4acf('0x16')](_0x571a30)[_0x4acf('0x26')](_0x50236d);};}exports[_0x4acf('0x27')]=function(_0x7a1e79,_0x382c41){var _0x2a3830={},_0x57989e={},_0x3521c2={'count':0x0,'rows':[]};var _0x3f5614=_[_0x4acf('0x28')](db[_0x4acf('0x29')][_0x4acf('0x2a')],function(_0x28570f){return{'name':_0x28570f[_0x4acf('0x2b')],'type':_0x28570f['type'][_0x4acf('0x2c')]};});_0x57989e[_0x4acf('0x2d')]=_[_0x4acf('0x28')](_0x3f5614,'name');_0x57989e[_0x4acf('0x2e')]=_[_0x4acf('0x2f')](_0x7a1e79[_0x4acf('0x2e')]);_0x57989e[_0x4acf('0x30')]=_['intersection'](_0x57989e[_0x4acf('0x2d')],_0x57989e[_0x4acf('0x2e')]);_0x2a3830[_0x4acf('0x31')]=_['intersection'](_0x57989e[_0x4acf('0x2d')],qs[_0x4acf('0x32')](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x32')]));_0x2a3830[_0x4acf('0x31')]=_0x2a3830[_0x4acf('0x31')]['length']?_0x2a3830[_0x4acf('0x31')]:_0x57989e[_0x4acf('0x2d')];if(!_0x7a1e79['query'][_0x4acf('0x33')]('nolimit')){_0x2a3830['limit']=qs['limit'](_0x7a1e79['query']['limit']);_0x2a3830['offset']=qs['offset'](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x19')]);}_0x2a3830['order']=qs[_0x4acf('0x34')](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x34')]);_0x2a3830[_0x4acf('0x35')]=qs[_0x4acf('0x30')](_[_0x4acf('0x36')](_0x7a1e79[_0x4acf('0x2e')],_0x57989e[_0x4acf('0x30')]),_0x3f5614);if(_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x37')]){_0x2a3830['where']=_['merge'](_0x2a3830[_0x4acf('0x35')],{'$or':_[_0x4acf('0x28')](_0x3f5614,function(_0x4859b6){if(_0x4859b6[_0x4acf('0x38')]!==_0x4acf('0x39')){var _0x43a2ea={};_0x43a2ea[_0x4859b6[_0x4acf('0x25')]]={'$like':'%'+_0x7a1e79['query']['filter']+'%'};return _0x43a2ea;}})});}_0x2a3830=_[_0x4acf('0x3a')]({},_0x2a3830,_0x7a1e79[_0x4acf('0x3b')]);var _0x3d5529={'where':_0x2a3830[_0x4acf('0x35')]};return db['UserProfileResource'][_0x4acf('0x1b')](_0x3d5529)[_0x4acf('0x21')](function(_0x4e9370){_0x3521c2['count']=_0x4e9370;if(_0x7a1e79['query']['includeAll']){_0x2a3830[_0x4acf('0x3c')]=[{'all':!![]}];}return db[_0x4acf('0x29')][_0x4acf('0x3d')](_0x2a3830);})['then'](function(_0x1015e3){_0x3521c2[_0x4acf('0x3e')]=_0x1015e3;return _0x3521c2;})[_0x4acf('0x21')](respondWithFilteredResult(_0x382c41,_0x2a3830))[_0x4acf('0x3f')](handleError(_0x382c41,null));};exports[_0x4acf('0x40')]=function(_0xea75e4,_0x7cf2a){var _0x17d5e9={'raw':![],'where':{'id':_0xea75e4[_0x4acf('0x41')]['id']}},_0x461547={};_0x461547[_0x4acf('0x2d')]=_['keys'](db[_0x4acf('0x29')][_0x4acf('0x2a')]);_0x461547[_0x4acf('0x2e')]=_[_0x4acf('0x2f')](_0xea75e4[_0x4acf('0x2e')]);_0x461547['filters']=_['intersection'](_0x461547[_0x4acf('0x2d')],_0x461547[_0x4acf('0x2e')]);_0x17d5e9[_0x4acf('0x31')]=_[_0x4acf('0x42')](_0x461547[_0x4acf('0x2d')],qs[_0x4acf('0x32')](_0xea75e4['query'][_0x4acf('0x32')]));_0x17d5e9['attributes']=_0x17d5e9[_0x4acf('0x31')][_0x4acf('0x43')]?_0x17d5e9['attributes']:_0x461547['model'];if(_0xea75e4[_0x4acf('0x2e')][_0x4acf('0x44')]){_0x17d5e9[_0x4acf('0x3c')]=[{'all':!![]}];}_0x17d5e9=_[_0x4acf('0x3a')]({},_0x17d5e9,_0xea75e4['options']);return db[_0x4acf('0x29')][_0x4acf('0x45')](_0x17d5e9)[_0x4acf('0x21')](handleEntityNotFound(_0x7cf2a,null))[_0x4acf('0x21')](respondWithResult(_0x7cf2a,null))[_0x4acf('0x3f')](handleError(_0x7cf2a,null));};exports[_0x4acf('0x46')]=function(_0x1bd7d0,_0x2d946c){return db['UserProfileResource']['create'](_0x1bd7d0[_0x4acf('0x47')],{})[_0x4acf('0x21')](respondWithResult(_0x2d946c,0xc9))[_0x4acf('0x3f')](handleError(_0x2d946c,null));};exports[_0x4acf('0x20')]=function(_0x287406,_0x859247){if(_0x287406[_0x4acf('0x47')]['id']){delete _0x287406[_0x4acf('0x47')]['id'];}return db[_0x4acf('0x29')][_0x4acf('0x45')]({'where':{'id':_0x287406[_0x4acf('0x41')]['id']}})[_0x4acf('0x21')](handleEntityNotFound(_0x859247,null))['then'](saveUpdates(_0x287406[_0x4acf('0x47')],null))[_0x4acf('0x21')](respondWithResult(_0x859247,null))[_0x4acf('0x3f')](handleError(_0x859247,null));};exports[_0x4acf('0x22')]=function(_0x392dac,_0x3cf54a){return db[_0x4acf('0x29')][_0x4acf('0x45')]({'where':{'id':_0x392dac[_0x4acf('0x41')]['id']}})[_0x4acf('0x21')](handleEntityNotFound(_0x3cf54a,null))[_0x4acf('0x21')](removeEntity(_0x3cf54a,null))[_0x4acf('0x3f')](handleError(_0x3cf54a,null));};exports[_0x4acf('0x48')]=function(_0x2b62bc,_0x113425){return db[_0x4acf('0x29')]['describe']()[_0x4acf('0x21')](respondWithResult(_0x113425,null))[_0x4acf('0x3f')](handleError(_0x113425,null));}; \ No newline at end of file +var _0x71ab=['filters','model','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','UserProfileResource','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','update','then','destroy','error','stack','name','send','index','map','type','key','query','keys'];(function(_0x594f02,_0x3e6145){var _0x1c32dc=function(_0x5237d4){while(--_0x5237d4){_0x594f02['push'](_0x594f02['shift']());}};_0x1c32dc(++_0x3e6145);}(_0x71ab,0x64));var _0xb71a=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x71ab[_0x465028];return _0xb783d4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb71a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb71a('0x1'));var rp=require('request-promise');var moment=require(_0xb71a('0x2'));var BPromise=require(_0xb71a('0x3'));var Mustache=require(_0xb71a('0x4'));var util=require(_0xb71a('0x5'));var path=require(_0xb71a('0x6'));var sox=require(_0xb71a('0x7'));var csv=require(_0xb71a('0x8'));var ejs=require(_0xb71a('0x9'));var fs=require('fs');var fs_extra=require(_0xb71a('0xa'));var _=require(_0xb71a('0xb'));var squel=require(_0xb71a('0xc'));var crypto=require(_0xb71a('0xd'));var jsforce=require(_0xb71a('0xe'));var deskjs=require(_0xb71a('0xf'));var toCsv=require(_0xb71a('0x8'));var querystring=require(_0xb71a('0x10'));var Papa=require(_0xb71a('0x11'));var Redis=require(_0xb71a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb71a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb71a('0x14'));var logger=require(_0xb71a('0x15'))(_0xb71a('0x16'));var utils=require('../../config/utils');var config=require(_0xb71a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xb71a('0x18'))['db'];function respondWithStatusCode(_0x50030d,_0x50b43b){_0x50b43b=_0x50b43b||0xcc;return function(_0x3346a5){if(_0x3346a5){return _0x50030d[_0xb71a('0x19')](_0x50b43b);}return _0x50030d[_0xb71a('0x1a')](_0x50b43b)[_0xb71a('0x1b')]();};}function respondWithResult(_0x483d77,_0x47ee48){_0x47ee48=_0x47ee48||0xc8;return function(_0x5364e3){if(_0x5364e3){return _0x483d77[_0xb71a('0x1a')](_0x47ee48)[_0xb71a('0x1c')](_0x5364e3);}};}function respondWithFilteredResult(_0x15252a,_0x42fc55){return function(_0x3cd0f0){if(_0x3cd0f0){var _0x1e9363=typeof _0x42fc55[_0xb71a('0x1d')]===_0xb71a('0x1e')&&typeof _0x42fc55[_0xb71a('0x1f')]==='undefined';var _0x1ca65e=_0x3cd0f0[_0xb71a('0x20')];var _0x374c8c=_0x1e9363?0x0:_0x42fc55[_0xb71a('0x1d')];var _0x2bdb61=_0x1e9363?_0x3cd0f0[_0xb71a('0x20')]:_0x42fc55[_0xb71a('0x1d')]+_0x42fc55[_0xb71a('0x1f')];var _0x20bdfe;if(_0x2bdb61>=_0x1ca65e){_0x2bdb61=_0x1ca65e;_0x20bdfe=0xc8;}else{_0x20bdfe=0xce;}_0x15252a[_0xb71a('0x1a')](_0x20bdfe);return _0x15252a[_0xb71a('0x21')]('Content-Range',_0x374c8c+'-'+_0x2bdb61+'/'+_0x1ca65e)['json'](_0x3cd0f0);}return null;};}function patchUpdates(_0x1358f2){return function(_0x578fe4){try{jsonpatch['apply'](_0x578fe4,_0x1358f2,!![]);}catch(_0x4d8871){return BPromise[_0xb71a('0x22')](_0x4d8871);}return _0x578fe4['save']();};}function saveUpdates(_0x76d6dc,_0x4227c7){return function(_0x3ac77b){if(_0x3ac77b){return _0x3ac77b[_0xb71a('0x23')](_0x76d6dc)[_0xb71a('0x24')](function(_0x14b2a1){return _0x14b2a1;});}return null;};}function removeEntity(_0x2f4fac,_0x14aac7){return function(_0x5f3f19){if(_0x5f3f19){return _0x5f3f19[_0xb71a('0x25')]()[_0xb71a('0x24')](function(){_0x2f4fac[_0xb71a('0x1a')](0xcc)[_0xb71a('0x1b')]();});}};}function handleEntityNotFound(_0x3401f7,_0x1a010d){return function(_0x20ed75){if(!_0x20ed75){_0x3401f7[_0xb71a('0x19')](0x194);}return _0x20ed75;};}function handleError(_0x31085b,_0x2a847a){_0x2a847a=_0x2a847a||0x1f4;return function(_0x45b849){logger[_0xb71a('0x26')](_0x45b849[_0xb71a('0x27')]);if(_0x45b849['name']){delete _0x45b849[_0xb71a('0x28')];}_0x31085b[_0xb71a('0x1a')](_0x2a847a)[_0xb71a('0x29')](_0x45b849);};}exports[_0xb71a('0x2a')]=function(_0x2fbd73,_0x38178c){var _0x44826e={},_0x25364c={},_0x42c086={'count':0x0,'rows':[]};var _0x421fcf=_[_0xb71a('0x2b')](db['UserProfileResource']['rawAttributes'],function(_0x3112d3){return{'name':_0x3112d3['fieldName'],'type':_0x3112d3[_0xb71a('0x2c')][_0xb71a('0x2d')]};});_0x25364c['model']=_[_0xb71a('0x2b')](_0x421fcf,_0xb71a('0x28'));_0x25364c[_0xb71a('0x2e')]=_[_0xb71a('0x2f')](_0x2fbd73[_0xb71a('0x2e')]);_0x25364c[_0xb71a('0x30')]=_['intersection'](_0x25364c[_0xb71a('0x31')],_0x25364c[_0xb71a('0x2e')]);_0x44826e[_0xb71a('0x32')]=_[_0xb71a('0x33')](_0x25364c['model'],qs[_0xb71a('0x34')](_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x34')]));_0x44826e[_0xb71a('0x32')]=_0x44826e[_0xb71a('0x32')][_0xb71a('0x35')]?_0x44826e[_0xb71a('0x32')]:_0x25364c[_0xb71a('0x31')];if(!_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x36')]('nolimit')){_0x44826e['limit']=qs[_0xb71a('0x1f')](_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x1f')]);_0x44826e[_0xb71a('0x1d')]=qs[_0xb71a('0x1d')](_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x1d')]);}_0x44826e['order']=qs[_0xb71a('0x37')](_0x2fbd73['query'][_0xb71a('0x37')]);_0x44826e[_0xb71a('0x38')]=qs[_0xb71a('0x30')](_[_0xb71a('0x39')](_0x2fbd73['query'],_0x25364c[_0xb71a('0x30')]),_0x421fcf);if(_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x3a')]){_0x44826e[_0xb71a('0x38')]=_[_0xb71a('0x3b')](_0x44826e[_0xb71a('0x38')],{'$or':_[_0xb71a('0x2b')](_0x421fcf,function(_0x2756b9){if(_0x2756b9[_0xb71a('0x2c')]!=='VIRTUAL'){var _0x24a3af={};_0x24a3af[_0x2756b9['name']]={'$like':'%'+_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x3a')]+'%'};return _0x24a3af;}})});}_0x44826e=_[_0xb71a('0x3b')]({},_0x44826e,_0x2fbd73[_0xb71a('0x3c')]);var _0xce7b8a={'where':_0x44826e[_0xb71a('0x38')]};return db['UserProfileResource']['count'](_0xce7b8a)['then'](function(_0x35fea9){_0x42c086['count']=_0x35fea9;if(_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x3d')]){_0x44826e[_0xb71a('0x3e')]=[{'all':!![]}];}return db[_0xb71a('0x3f')][_0xb71a('0x40')](_0x44826e);})[_0xb71a('0x24')](function(_0x59530a){_0x42c086[_0xb71a('0x41')]=_0x59530a;return _0x42c086;})[_0xb71a('0x24')](respondWithFilteredResult(_0x38178c,_0x44826e))[_0xb71a('0x42')](handleError(_0x38178c,null));};exports[_0xb71a('0x43')]=function(_0x7d305,_0x2f08d2){var _0x55cbca={'raw':![],'where':{'id':_0x7d305[_0xb71a('0x44')]['id']}},_0x2afff3={};_0x2afff3[_0xb71a('0x31')]=_[_0xb71a('0x2f')](db[_0xb71a('0x3f')][_0xb71a('0x45')]);_0x2afff3[_0xb71a('0x2e')]=_['keys'](_0x7d305['query']);_0x2afff3[_0xb71a('0x30')]=_[_0xb71a('0x33')](_0x2afff3[_0xb71a('0x31')],_0x2afff3[_0xb71a('0x2e')]);_0x55cbca['attributes']=_[_0xb71a('0x33')](_0x2afff3['model'],qs[_0xb71a('0x34')](_0x7d305[_0xb71a('0x2e')]['fields']));_0x55cbca[_0xb71a('0x32')]=_0x55cbca[_0xb71a('0x32')][_0xb71a('0x35')]?_0x55cbca[_0xb71a('0x32')]:_0x2afff3['model'];if(_0x7d305[_0xb71a('0x2e')][_0xb71a('0x3d')]){_0x55cbca[_0xb71a('0x3e')]=[{'all':!![]}];}_0x55cbca=_['merge']({},_0x55cbca,_0x7d305[_0xb71a('0x3c')]);return db[_0xb71a('0x3f')][_0xb71a('0x46')](_0x55cbca)['then'](handleEntityNotFound(_0x2f08d2,null))[_0xb71a('0x24')](respondWithResult(_0x2f08d2,null))[_0xb71a('0x42')](handleError(_0x2f08d2,null));};exports[_0xb71a('0x47')]=function(_0x1f29b7,_0x365bed){return db['UserProfileResource'][_0xb71a('0x47')](_0x1f29b7[_0xb71a('0x48')],{})[_0xb71a('0x24')](respondWithResult(_0x365bed,0xc9))[_0xb71a('0x42')](handleError(_0x365bed,null));};exports['update']=function(_0x48fbde,_0x23b4c0){if(_0x48fbde[_0xb71a('0x48')]['id']){delete _0x48fbde[_0xb71a('0x48')]['id'];}return db[_0xb71a('0x3f')][_0xb71a('0x46')]({'where':{'id':_0x48fbde[_0xb71a('0x44')]['id']}})[_0xb71a('0x24')](handleEntityNotFound(_0x23b4c0,null))[_0xb71a('0x24')](saveUpdates(_0x48fbde[_0xb71a('0x48')],null))[_0xb71a('0x24')](respondWithResult(_0x23b4c0,null))['catch'](handleError(_0x23b4c0,null));};exports[_0xb71a('0x25')]=function(_0x2ce711,_0x500196){return db[_0xb71a('0x3f')]['find']({'where':{'id':_0x2ce711[_0xb71a('0x44')]['id']}})[_0xb71a('0x24')](handleEntityNotFound(_0x500196,null))[_0xb71a('0x24')](removeEntity(_0x500196,null))[_0xb71a('0x42')](handleError(_0x500196,null));};exports[_0xb71a('0x49')]=function(_0x4b26d2,_0x1ea17b){return db['UserProfileResource'][_0xb71a('0x49')]()[_0xb71a('0x24')](respondWithResult(_0x1ea17b,null))['catch'](handleError(_0x1ea17b,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index d3843f1..1862015 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 _0x2bd6=['compositeIndex','sectionId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource'];(function(_0x3999fc,_0x15af75){var _0x530898=function(_0x3b7c6f){while(--_0x3b7c6f){_0x3999fc['push'](_0x3999fc['shift']());}};_0x530898(++_0x15af75);}(_0x2bd6,0x110));var _0x62bd=function(_0x5466ab,_0x227b13){_0x5466ab=_0x5466ab-0x0;var _0x40751a=_0x2bd6[_0x5466ab];return _0x40751a;};'use strict';var _=require(_0x62bd('0x0'));var util=require(_0x62bd('0x1'));var logger=require(_0x62bd('0x2'))(_0x62bd('0x3'));var moment=require(_0x62bd('0x4'));var BPromise=require(_0x62bd('0x5'));var rp=require(_0x62bd('0x6'));var fs=require('fs');var path=require(_0x62bd('0x7'));var rimraf=require('rimraf');var config=require(_0x62bd('0x8'));var attributes=require(_0x62bd('0x9'));module[_0x62bd('0xa')]=function(_0x2a715f,_0x2c2e27){return _0x2a715f[_0x62bd('0xb')](_0x62bd('0xc'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x62bd('0xd'),'fields':['resourceId',_0x62bd('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9dd3=['exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes'];(function(_0x471be7,_0x43c97c){var _0x3de9fc=function(_0x29f3d0){while(--_0x29f3d0){_0x471be7['push'](_0x471be7['shift']());}};_0x3de9fc(++_0x43c97c);}(_0x9dd3,0x187));var _0x39dd=function(_0x4f3b05,_0x32fb04){_0x4f3b05=_0x4f3b05-0x0;var _0x198d53=_0x9dd3[_0x4f3b05];return _0x198d53;};'use strict';var _=require('lodash');var util=require(_0x39dd('0x0'));var logger=require(_0x39dd('0x1'))(_0x39dd('0x2'));var moment=require('moment');var BPromise=require(_0x39dd('0x3'));var rp=require(_0x39dd('0x4'));var fs=require('fs');var path=require(_0x39dd('0x5'));var rimraf=require(_0x39dd('0x6'));var config=require(_0x39dd('0x7'));var attributes=require(_0x39dd('0x8'));module[_0x39dd('0x9')]=function(_0x31137c,_0x473e42){return _0x31137c[_0x39dd('0xa')](_0x39dd('0xb'),attributes,{'tableName':_0x39dd('0xc'),'paranoid':![],'indexes':[{'name':_0x39dd('0xd'),'fields':[_0x39dd('0xe'),_0x39dd('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 0d7b87d..ef8b921 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 _0x19cd=['lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileResource,\x20%s,\x20%s','message','result','catch'];(function(_0x288a2a,_0x22ef98){var _0x1fda09=function(_0x1f0bd0){while(--_0x1f0bd0){_0x288a2a['push'](_0x288a2a['shift']());}};_0x1fda09(++_0x22ef98);}(_0x19cd,0xf2));var _0xd19c=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0x19cd[_0x4a3898];return _0x25ceb0;};'use strict';var _=require(_0xd19c('0x0'));var util=require(_0xd19c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd19c('0x2'));var db=require(_0xd19c('0x3'))['db'];var utils=require(_0xd19c('0x4'));var logger=require(_0xd19c('0x5'))(_0xd19c('0x6'));var config=require(_0xd19c('0x7'));var jayson=require(_0xd19c('0x8'));var client=jayson['client'][_0xd19c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x48e5ea,_0x3e88c9,_0x53048f){return new BPromise(function(_0x576e39,_0x2c23b8){return client['request'](_0x48e5ea,_0x53048f)[_0xd19c('0xa')](function(_0x2d56c9){logger[_0xd19c('0xb')]('UserProfileResource,\x20%s,\x20%s',_0x3e88c9,_0xd19c('0xc'));logger[_0xd19c('0xd')](_0xd19c('0xe'),_0x3e88c9,'request\x20sent',JSON[_0xd19c('0xf')](_0x2d56c9));if(_0x2d56c9['error']){if(_0x2d56c9[_0xd19c('0x10')][_0xd19c('0x11')]===0x1f4){logger[_0xd19c('0x10')](_0xd19c('0x12'),_0x3e88c9,_0x2d56c9[_0xd19c('0x10')][_0xd19c('0x13')]);return _0x2c23b8(_0x2d56c9[_0xd19c('0x10')]['message']);}logger[_0xd19c('0x10')](_0xd19c('0x12'),_0x3e88c9,_0x2d56c9[_0xd19c('0x10')]['message']);return _0x576e39(_0x2d56c9[_0xd19c('0x10')][_0xd19c('0x13')]);}else{logger[_0xd19c('0xb')](_0xd19c('0x12'),_0x3e88c9,'request\x20sent');_0x576e39(_0x2d56c9[_0xd19c('0x14')]['message']);}})[_0xd19c('0x15')](function(_0x2f80d0){logger['error'](_0xd19c('0x12'),_0x3e88c9,_0x2f80d0);_0x2c23b8(_0x2f80d0);});});} \ No newline at end of file +var _0xeef8=['error','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3e59ba,_0x3cb09a){var _0x4ad043=function(_0x3e145d){while(--_0x3e145d){_0x3e59ba['push'](_0x3e59ba['shift']());}};_0x4ad043(++_0x3cb09a);}(_0xeef8,0x1a3));var _0x8eef=function(_0x2912f9,_0x3bdd4a){_0x2912f9=_0x2912f9-0x0;var _0x4a200f=_0xeef8[_0x2912f9];return _0x4a200f;};'use strict';var _=require('lodash');var util=require(_0x8eef('0x0'));var moment=require(_0x8eef('0x1'));var BPromise=require(_0x8eef('0x2'));var rs=require(_0x8eef('0x3'));var fs=require('fs');var Redis=require(_0x8eef('0x4'));var db=require(_0x8eef('0x5'))['db'];var utils=require(_0x8eef('0x6'));var logger=require(_0x8eef('0x7'))('rpc');var config=require(_0x8eef('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8eef('0x9')][_0x8eef('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59c340,_0x22ead6,_0xf36a63){return new BPromise(function(_0x3147db,_0x5125d){return client[_0x8eef('0xb')](_0x59c340,_0xf36a63)[_0x8eef('0xc')](function(_0x15745f){logger['info'](_0x8eef('0xd'),_0x22ead6,_0x8eef('0xe'));logger[_0x8eef('0xf')](_0x8eef('0x10'),_0x22ead6,_0x8eef('0xe'),JSON[_0x8eef('0x11')](_0x15745f));if(_0x15745f['error']){if(_0x15745f[_0x8eef('0x12')]['code']===0x1f4){logger[_0x8eef('0x12')](_0x8eef('0xd'),_0x22ead6,_0x15745f[_0x8eef('0x12')]['message']);return _0x5125d(_0x15745f[_0x8eef('0x12')][_0x8eef('0x13')]);}logger[_0x8eef('0x12')](_0x8eef('0xd'),_0x22ead6,_0x15745f[_0x8eef('0x12')][_0x8eef('0x13')]);return _0x3147db(_0x15745f[_0x8eef('0x12')][_0x8eef('0x13')]);}else{logger[_0x8eef('0x14')](_0x8eef('0xd'),_0x22ead6,_0x8eef('0xe'));_0x3147db(_0x15745f[_0x8eef('0x15')]['message']);}})[_0x8eef('0x16')](function(_0xa8d162){logger['error'](_0x8eef('0xd'),_0x22ead6,_0xa8d162);_0x5125d(_0xa8d162);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 174a1f7..b5270f1 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 _0xcfea=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','destroy','exports','multer','util'];(function(_0x1f7d2f,_0x4694c9){var _0x4bffe0=function(_0x3b64a6){while(--_0x3b64a6){_0x1f7d2f['push'](_0x1f7d2f['shift']());}};_0x4bffe0(++_0x4694c9);}(_0xcfea,0x1b6));var _0xacfe=function(_0x2c4525,_0x1559de){_0x2c4525=_0x2c4525-0x0;var _0x3122ac=_0xcfea[_0x2c4525];return _0x3122ac;};'use strict';var multer=require(_0xacfe('0x0'));var util=require(_0xacfe('0x1'));var path=require(_0xacfe('0x2'));var timeout=require(_0xacfe('0x3'));var express=require(_0xacfe('0x4'));var router=express[_0xacfe('0x5')]();var fs_extra=require(_0xacfe('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xacfe('0x7'));var config=require(_0xacfe('0x8'));var controller=require(_0xacfe('0x9'));router[_0xacfe('0xa')]('/',auth[_0xacfe('0xb')](),controller[_0xacfe('0xc')]);router[_0xacfe('0xa')](_0xacfe('0xd'),auth[_0xacfe('0xb')](),controller[_0xacfe('0xe')]);router['get'](_0xacfe('0xf'),auth[_0xacfe('0xb')](),controller[_0xacfe('0x10')]);router['post']('/',auth[_0xacfe('0xb')](),controller[_0xacfe('0x11')]);router[_0xacfe('0x12')](_0xacfe('0xf'),auth[_0xacfe('0xb')](),controller[_0xacfe('0x13')]);router['delete'](_0xacfe('0xf'),auth[_0xacfe('0xb')](),controller[_0xacfe('0x14')]);module[_0xacfe('0x15')]=router; \ No newline at end of file +var _0xb6e5=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileSection.controller','get','index','/describe','isAuthenticated','describe','/:id','put','update','delete'];(function(_0x304708,_0x243f40){var _0x5ea96e=function(_0xdbbdaf){while(--_0xdbbdaf){_0x304708['push'](_0x304708['shift']());}};_0x5ea96e(++_0x243f40);}(_0xb6e5,0x7a));var _0x5b6e=function(_0x1a75d6,_0x34c802){_0x1a75d6=_0x1a75d6-0x0;var _0x3e7e95=_0xb6e5[_0x1a75d6];return _0x3e7e95;};'use strict';var multer=require('multer');var util=require(_0x5b6e('0x0'));var path=require(_0x5b6e('0x1'));var timeout=require(_0x5b6e('0x2'));var express=require(_0x5b6e('0x3'));var router=express[_0x5b6e('0x4')]();var fs_extra=require(_0x5b6e('0x5'));var auth=require(_0x5b6e('0x6'));var interaction=require(_0x5b6e('0x7'));var config=require('../../config/environment');var controller=require(_0x5b6e('0x8'));router[_0x5b6e('0x9')]('/',auth['isAuthenticated'](),controller[_0x5b6e('0xa')]);router['get'](_0x5b6e('0xb'),auth[_0x5b6e('0xc')](),controller[_0x5b6e('0xd')]);router[_0x5b6e('0x9')](_0x5b6e('0xe'),auth[_0x5b6e('0xc')](),controller['show']);router['post']('/',auth[_0x5b6e('0xc')](),controller['create']);router[_0x5b6e('0xf')]('/:id',auth[_0x5b6e('0xc')](),controller[_0x5b6e('0x10')]);router[_0x5b6e('0x11')](_0x5b6e('0xe'),auth['isAuthenticated'](),controller[_0x5b6e('0x12')]);module[_0x5b6e('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 04b7fcb..55dbf80 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 _0x69d3=['crudPermissions','split','sequelize','exports','STRING','INTEGER','BOOLEAN','join','getDataValue'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x69d3,0xda));var _0x369d=function(_0x3953c8,_0x46f514){_0x3953c8=_0x3953c8-0x0;var _0xd35780=_0x69d3[_0x3953c8];return _0xd35780;};'use strict';var Sequelize=require(_0x369d('0x0'));module[_0x369d('0x1')]={'name':{'type':Sequelize[_0x369d('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x369d('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x369d('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0xe38740){this['setDataValue']('crudPermissions',_0xe38740?_0xe38740[_0x369d('0x5')](''):[]);},'get':function(){return this[_0x369d('0x6')](_0x369d('0x7'))?this[_0x369d('0x6')](_0x369d('0x7'))[_0x369d('0x8')](''):[];}}}; \ No newline at end of file +var _0x4024=['crudPermissions','split','sequelize','exports','STRING','INTEGER','BOOLEAN','setDataValue','getDataValue'];(function(_0x25cca1,_0x38e476){var _0x48b27a=function(_0x13aca2){while(--_0x13aca2){_0x25cca1['push'](_0x25cca1['shift']());}};_0x48b27a(++_0x38e476);}(_0x4024,0x89));var _0x4402=function(_0x3689fd,_0x47e501){_0x3689fd=_0x3689fd-0x0;var _0x507da5=_0x4024[_0x3689fd];return _0x507da5;};'use strict';var Sequelize=require(_0x4402('0x0'));module[_0x4402('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0x4402('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x4402('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x4402('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x950c82){this[_0x4402('0x5')]('crudPermissions',_0x950c82?_0x950c82['join'](''):[]);},'get':function(){return this[_0x4402('0x6')](_0x4402('0x7'))?this[_0x4402('0x6')]('crudPermissions')[_0x4402('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 035fba3..8c7371c 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 _0x05e6=['options','find','create','body','params','describe','rimraf','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','offset','undefined','limit','count','status','json','apply','reject','save','update','destroy','then','stack','name','send','index','map','UserProfileSection','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','catch','show'];(function(_0x287a0b,_0x4d3444){var _0x2a20f8=function(_0x3c4c15){while(--_0x3c4c15){_0x287a0b['push'](_0x287a0b['shift']());}};_0x2a20f8(++_0x4d3444);}(_0x05e6,0x1bc));var _0x605e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x05e6[_0x376b45];return _0x2341b3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x605e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x605e('0x1'));var rp=require('request-promise');var moment=require(_0x605e('0x2'));var BPromise=require(_0x605e('0x3'));var Mustache=require(_0x605e('0x4'));var util=require(_0x605e('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x605e('0x6'));var ejs=require(_0x605e('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x605e('0x8'));var squel=require(_0x605e('0x9'));var crypto=require(_0x605e('0xa'));var jsforce=require(_0x605e('0xb'));var deskjs=require(_0x605e('0xc'));var toCsv=require(_0x605e('0x6'));var querystring=require(_0x605e('0xd'));var Papa=require(_0x605e('0xe'));var Redis=require('ioredis');var authService=require(_0x605e('0xf'));var qs=require(_0x605e('0x10'));var as=require(_0x605e('0x11'));var hardwareService=require(_0x605e('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x605e('0x13'));var config=require(_0x605e('0x14'));var licenseUtil=require(_0x605e('0x15'));var db=require(_0x605e('0x16'))['db'];function respondWithStatusCode(_0x46e332,_0x2dc01d){_0x2dc01d=_0x2dc01d||0xcc;return function(_0x57448c){if(_0x57448c){return _0x46e332['sendStatus'](_0x2dc01d);}return _0x46e332['status'](_0x2dc01d)[_0x605e('0x17')]();};}function respondWithResult(_0x5b4cdf,_0x208944){_0x208944=_0x208944||0xc8;return function(_0x17bf94){if(_0x17bf94){return _0x5b4cdf['status'](_0x208944)['json'](_0x17bf94);}};}function respondWithFilteredResult(_0x5c1b09,_0x232038){return function(_0x501dd6){if(_0x501dd6){var _0x53af76=typeof _0x232038[_0x605e('0x18')]===_0x605e('0x19')&&typeof _0x232038[_0x605e('0x1a')]===_0x605e('0x19');var _0x3b2030=_0x501dd6[_0x605e('0x1b')];var _0x3fee76=_0x53af76?0x0:_0x232038['offset'];var _0x51f3a6=_0x53af76?_0x501dd6['count']:_0x232038['offset']+_0x232038[_0x605e('0x1a')];var _0x476cb0;if(_0x51f3a6>=_0x3b2030){_0x51f3a6=_0x3b2030;_0x476cb0=0xc8;}else{_0x476cb0=0xce;}_0x5c1b09[_0x605e('0x1c')](_0x476cb0);return _0x5c1b09['set']('Content-Range',_0x3fee76+'-'+_0x51f3a6+'/'+_0x3b2030)[_0x605e('0x1d')](_0x501dd6);}return null;};}function patchUpdates(_0x449f0d){return function(_0x40fc1d){try{jsonpatch[_0x605e('0x1e')](_0x40fc1d,_0x449f0d,!![]);}catch(_0x413ccb){return BPromise[_0x605e('0x1f')](_0x413ccb);}return _0x40fc1d[_0x605e('0x20')]();};}function saveUpdates(_0x2db16b,_0x20f7c5){return function(_0xdab803){if(_0xdab803){return _0xdab803[_0x605e('0x21')](_0x2db16b)['then'](function(_0x42a0ed){return _0x42a0ed;});}return null;};}function removeEntity(_0x19d817,_0x50fea3){return function(_0x601515){if(_0x601515){return _0x601515[_0x605e('0x22')]()[_0x605e('0x23')](function(){_0x19d817[_0x605e('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49181e,_0xcd9535){return function(_0x17f478){if(!_0x17f478){_0x49181e['sendStatus'](0x194);}return _0x17f478;};}function handleError(_0x8ab34,_0xbc1e8d){_0xbc1e8d=_0xbc1e8d||0x1f4;return function(_0x39a78c){logger['error'](_0x39a78c[_0x605e('0x24')]);if(_0x39a78c[_0x605e('0x25')]){delete _0x39a78c[_0x605e('0x25')];}_0x8ab34[_0x605e('0x1c')](_0xbc1e8d)[_0x605e('0x26')](_0x39a78c);};}exports[_0x605e('0x27')]=function(_0x285d2c,_0x35d810){var _0x3f2d91={},_0x326039={},_0x55febb={'count':0x0,'rows':[]};var _0x527366=_[_0x605e('0x28')](db[_0x605e('0x29')][_0x605e('0x2a')],function(_0x44c2bc){return{'name':_0x44c2bc[_0x605e('0x2b')],'type':_0x44c2bc[_0x605e('0x2c')][_0x605e('0x2d')]};});_0x326039[_0x605e('0x2e')]=_[_0x605e('0x28')](_0x527366,_0x605e('0x25'));_0x326039['query']=_[_0x605e('0x2f')](_0x285d2c[_0x605e('0x30')]);_0x326039[_0x605e('0x31')]=_[_0x605e('0x32')](_0x326039[_0x605e('0x2e')],_0x326039[_0x605e('0x30')]);_0x3f2d91[_0x605e('0x33')]=_['intersection'](_0x326039[_0x605e('0x2e')],qs[_0x605e('0x34')](_0x285d2c['query']['fields']));_0x3f2d91[_0x605e('0x33')]=_0x3f2d91[_0x605e('0x33')][_0x605e('0x35')]?_0x3f2d91[_0x605e('0x33')]:_0x326039['model'];if(!_0x285d2c[_0x605e('0x30')][_0x605e('0x36')](_0x605e('0x37'))){_0x3f2d91[_0x605e('0x1a')]=qs[_0x605e('0x1a')](_0x285d2c['query']['limit']);_0x3f2d91[_0x605e('0x18')]=qs[_0x605e('0x18')](_0x285d2c['query'][_0x605e('0x18')]);}_0x3f2d91[_0x605e('0x38')]=qs['sort'](_0x285d2c[_0x605e('0x30')][_0x605e('0x39')]);_0x3f2d91['where']=qs[_0x605e('0x31')](_[_0x605e('0x3a')](_0x285d2c[_0x605e('0x30')],_0x326039['filters']),_0x527366);if(_0x285d2c['query'][_0x605e('0x3b')]){_0x3f2d91[_0x605e('0x3c')]=_[_0x605e('0x3d')](_0x3f2d91[_0x605e('0x3c')],{'$or':_[_0x605e('0x28')](_0x527366,function(_0x2b7a96){if(_0x2b7a96['type']!==_0x605e('0x3e')){var _0x4e6528={};_0x4e6528[_0x2b7a96[_0x605e('0x25')]]={'$like':'%'+_0x285d2c[_0x605e('0x30')][_0x605e('0x3b')]+'%'};return _0x4e6528;}})});}_0x3f2d91=_[_0x605e('0x3d')]({},_0x3f2d91,_0x285d2c['options']);var _0x8da27b={'where':_0x3f2d91[_0x605e('0x3c')]};return db['UserProfileSection'][_0x605e('0x1b')](_0x8da27b)['then'](function(_0x1d01b7){_0x55febb[_0x605e('0x1b')]=_0x1d01b7;if(_0x285d2c[_0x605e('0x30')][_0x605e('0x3f')]){_0x3f2d91[_0x605e('0x40')]=[{'all':!![]}];}return db[_0x605e('0x29')]['findAll'](_0x3f2d91);})[_0x605e('0x23')](function(_0x3264cb){_0x55febb['rows']=_0x3264cb;return _0x55febb;})[_0x605e('0x23')](respondWithFilteredResult(_0x35d810,_0x3f2d91))[_0x605e('0x41')](handleError(_0x35d810,null));};exports[_0x605e('0x42')]=function(_0xa96314,_0x33083c){var _0x26bfc1={'raw':![],'where':{'id':_0xa96314['params']['id']}},_0x25d9df={};_0x25d9df[_0x605e('0x2e')]=_[_0x605e('0x2f')](db['UserProfileSection'][_0x605e('0x2a')]);_0x25d9df[_0x605e('0x30')]=_[_0x605e('0x2f')](_0xa96314[_0x605e('0x30')]);_0x25d9df[_0x605e('0x31')]=_[_0x605e('0x32')](_0x25d9df[_0x605e('0x2e')],_0x25d9df[_0x605e('0x30')]);_0x26bfc1[_0x605e('0x33')]=_['intersection'](_0x25d9df[_0x605e('0x2e')],qs[_0x605e('0x34')](_0xa96314[_0x605e('0x30')]['fields']));_0x26bfc1[_0x605e('0x33')]=_0x26bfc1[_0x605e('0x33')][_0x605e('0x35')]?_0x26bfc1[_0x605e('0x33')]:_0x25d9df['model'];if(_0xa96314['query'][_0x605e('0x3f')]){_0x26bfc1[_0x605e('0x40')]=[{'all':!![]}];}_0x26bfc1=_[_0x605e('0x3d')]({},_0x26bfc1,_0xa96314[_0x605e('0x43')]);return db['UserProfileSection'][_0x605e('0x44')](_0x26bfc1)['then'](handleEntityNotFound(_0x33083c,null))[_0x605e('0x23')](respondWithResult(_0x33083c,null))['catch'](handleError(_0x33083c,null));};exports[_0x605e('0x45')]=function(_0x5bbe01,_0x131ee2){return db[_0x605e('0x29')][_0x605e('0x45')](_0x5bbe01[_0x605e('0x46')],{})[_0x605e('0x23')](respondWithResult(_0x131ee2,0xc9))[_0x605e('0x41')](handleError(_0x131ee2,null));};exports[_0x605e('0x21')]=function(_0x570d2a,_0x185e92){if(_0x570d2a[_0x605e('0x46')]['id']){delete _0x570d2a[_0x605e('0x46')]['id'];}return db['UserProfileSection']['find']({'where':{'id':_0x570d2a[_0x605e('0x47')]['id']}})['then'](handleEntityNotFound(_0x185e92,null))['then'](saveUpdates(_0x570d2a[_0x605e('0x46')],null))[_0x605e('0x23')](respondWithResult(_0x185e92,null))[_0x605e('0x41')](handleError(_0x185e92,null));};exports['destroy']=function(_0x4eaef4,_0x4bb775){return db[_0x605e('0x29')]['find']({'where':{'id':_0x4eaef4[_0x605e('0x47')]['id']}})[_0x605e('0x23')](handleEntityNotFound(_0x4bb775,null))[_0x605e('0x23')](removeEntity(_0x4bb775,null))[_0x605e('0x41')](handleError(_0x4bb775,null));};exports[_0x605e('0x48')]=function(_0x16d6a4,_0x33d616){return db['UserProfileSection'][_0x605e('0x48')]()[_0x605e('0x23')](respondWithResult(_0x33d616,null))[_0x605e('0x41')](handleError(_0x33d616,null));}; \ No newline at end of file +var _0x77cb=['name','send','index','map','UserProfileSection','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','include','findAll','rows','catch','show','keys','includeAll','find','create','body','update','params','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','then','destroy','sendStatus','error'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x77cb,0x19b));var _0xb77c=function(_0x5c1f3b,_0x29ee0d){_0x5c1f3b=_0x5c1f3b-0x0;var _0xc5c830=_0x77cb[_0x5c1f3b];return _0xc5c830;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb77c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb77c('0x1'));var rp=require(_0xb77c('0x2'));var moment=require(_0xb77c('0x3'));var BPromise=require(_0xb77c('0x4'));var Mustache=require(_0xb77c('0x5'));var util=require(_0xb77c('0x6'));var path=require(_0xb77c('0x7'));var sox=require(_0xb77c('0x8'));var csv=require('to-csv');var ejs=require(_0xb77c('0x9'));var fs=require('fs');var fs_extra=require(_0xb77c('0xa'));var _=require(_0xb77c('0xb'));var squel=require('squel');var crypto=require(_0xb77c('0xc'));var jsforce=require(_0xb77c('0xd'));var deskjs=require(_0xb77c('0xe'));var toCsv=require(_0xb77c('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb77c('0x10'));var authService=require(_0xb77c('0x11'));var qs=require(_0xb77c('0x12'));var as=require(_0xb77c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb77c('0x14'))('api');var utils=require(_0xb77c('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xb77c('0x16'));var db=require(_0xb77c('0x17'))['db'];function respondWithStatusCode(_0x434723,_0x450ce9){_0x450ce9=_0x450ce9||0xcc;return function(_0x77d611){if(_0x77d611){return _0x434723['sendStatus'](_0x450ce9);}return _0x434723[_0xb77c('0x18')](_0x450ce9)[_0xb77c('0x19')]();};}function respondWithResult(_0x1f944c,_0x3b8002){_0x3b8002=_0x3b8002||0xc8;return function(_0x36bfd3){if(_0x36bfd3){return _0x1f944c[_0xb77c('0x18')](_0x3b8002)[_0xb77c('0x1a')](_0x36bfd3);}};}function respondWithFilteredResult(_0x17e99d,_0x35e563){return function(_0x21aeb6){if(_0x21aeb6){var _0x234d2d=typeof _0x35e563[_0xb77c('0x1b')]==='undefined'&&typeof _0x35e563[_0xb77c('0x1c')]===_0xb77c('0x1d');var _0x7653bb=_0x21aeb6[_0xb77c('0x1e')];var _0x479ba6=_0x234d2d?0x0:_0x35e563[_0xb77c('0x1b')];var _0x57be08=_0x234d2d?_0x21aeb6[_0xb77c('0x1e')]:_0x35e563[_0xb77c('0x1b')]+_0x35e563['limit'];var _0x57f280;if(_0x57be08>=_0x7653bb){_0x57be08=_0x7653bb;_0x57f280=0xc8;}else{_0x57f280=0xce;}_0x17e99d[_0xb77c('0x18')](_0x57f280);return _0x17e99d['set'](_0xb77c('0x1f'),_0x479ba6+'-'+_0x57be08+'/'+_0x7653bb)[_0xb77c('0x1a')](_0x21aeb6);}return null;};}function patchUpdates(_0x2322a2){return function(_0x3d6417){try{jsonpatch[_0xb77c('0x20')](_0x3d6417,_0x2322a2,!![]);}catch(_0x366bc4){return BPromise[_0xb77c('0x21')](_0x366bc4);}return _0x3d6417[_0xb77c('0x22')]();};}function saveUpdates(_0x11c39d,_0x16cb19){return function(_0x603d1c){if(_0x603d1c){return _0x603d1c['update'](_0x11c39d)[_0xb77c('0x23')](function(_0x30428f){return _0x30428f;});}return null;};}function removeEntity(_0xaba966,_0x1fd55f){return function(_0x582336){if(_0x582336){return _0x582336[_0xb77c('0x24')]()[_0xb77c('0x23')](function(){_0xaba966['status'](0xcc)[_0xb77c('0x19')]();});}};}function handleEntityNotFound(_0x423c40,_0xcdcd71){return function(_0x2169c2){if(!_0x2169c2){_0x423c40[_0xb77c('0x25')](0x194);}return _0x2169c2;};}function handleError(_0x4d1ade,_0x49db3d){_0x49db3d=_0x49db3d||0x1f4;return function(_0x3c816a){logger[_0xb77c('0x26')](_0x3c816a['stack']);if(_0x3c816a[_0xb77c('0x27')]){delete _0x3c816a['name'];}_0x4d1ade[_0xb77c('0x18')](_0x49db3d)[_0xb77c('0x28')](_0x3c816a);};}exports[_0xb77c('0x29')]=function(_0x43b2ad,_0x2c2ac1){var _0x332c4d={},_0x1c7015={},_0x2bdff4={'count':0x0,'rows':[]};var _0x138dfc=_[_0xb77c('0x2a')](db[_0xb77c('0x2b')][_0xb77c('0x2c')],function(_0x261639){return{'name':_0x261639[_0xb77c('0x2d')],'type':_0x261639[_0xb77c('0x2e')][_0xb77c('0x2f')]};});_0x1c7015[_0xb77c('0x30')]=_[_0xb77c('0x2a')](_0x138dfc,_0xb77c('0x27'));_0x1c7015[_0xb77c('0x31')]=_['keys'](_0x43b2ad[_0xb77c('0x31')]);_0x1c7015['filters']=_[_0xb77c('0x32')](_0x1c7015['model'],_0x1c7015[_0xb77c('0x31')]);_0x332c4d[_0xb77c('0x33')]=_['intersection'](_0x1c7015[_0xb77c('0x30')],qs['fields'](_0x43b2ad['query'][_0xb77c('0x34')]));_0x332c4d[_0xb77c('0x33')]=_0x332c4d[_0xb77c('0x33')]['length']?_0x332c4d[_0xb77c('0x33')]:_0x1c7015[_0xb77c('0x30')];if(!_0x43b2ad['query'][_0xb77c('0x35')](_0xb77c('0x36'))){_0x332c4d['limit']=qs[_0xb77c('0x1c')](_0x43b2ad[_0xb77c('0x31')][_0xb77c('0x1c')]);_0x332c4d['offset']=qs[_0xb77c('0x1b')](_0x43b2ad[_0xb77c('0x31')][_0xb77c('0x1b')]);}_0x332c4d['order']=qs[_0xb77c('0x37')](_0x43b2ad[_0xb77c('0x31')][_0xb77c('0x37')]);_0x332c4d[_0xb77c('0x38')]=qs[_0xb77c('0x39')](_[_0xb77c('0x3a')](_0x43b2ad['query'],_0x1c7015[_0xb77c('0x39')]),_0x138dfc);if(_0x43b2ad[_0xb77c('0x31')][_0xb77c('0x3b')]){_0x332c4d['where']=_[_0xb77c('0x3c')](_0x332c4d[_0xb77c('0x38')],{'$or':_['map'](_0x138dfc,function(_0x280d84){if(_0x280d84[_0xb77c('0x2e')]!=='VIRTUAL'){var _0x31db26={};_0x31db26[_0x280d84['name']]={'$like':'%'+_0x43b2ad[_0xb77c('0x31')]['filter']+'%'};return _0x31db26;}})});}_0x332c4d=_[_0xb77c('0x3c')]({},_0x332c4d,_0x43b2ad[_0xb77c('0x3d')]);var _0x34e3a2={'where':_0x332c4d[_0xb77c('0x38')]};return db[_0xb77c('0x2b')]['count'](_0x34e3a2)[_0xb77c('0x23')](function(_0x33cc69){_0x2bdff4['count']=_0x33cc69;if(_0x43b2ad['query']['includeAll']){_0x332c4d[_0xb77c('0x3e')]=[{'all':!![]}];}return db[_0xb77c('0x2b')][_0xb77c('0x3f')](_0x332c4d);})[_0xb77c('0x23')](function(_0x4757dd){_0x2bdff4[_0xb77c('0x40')]=_0x4757dd;return _0x2bdff4;})['then'](respondWithFilteredResult(_0x2c2ac1,_0x332c4d))[_0xb77c('0x41')](handleError(_0x2c2ac1,null));};exports[_0xb77c('0x42')]=function(_0x19f565,_0x3b4498){var _0x4a02a1={'raw':![],'where':{'id':_0x19f565['params']['id']}},_0x2ae8f8={};_0x2ae8f8[_0xb77c('0x30')]=_[_0xb77c('0x43')](db['UserProfileSection']['rawAttributes']);_0x2ae8f8[_0xb77c('0x31')]=_[_0xb77c('0x43')](_0x19f565[_0xb77c('0x31')]);_0x2ae8f8['filters']=_[_0xb77c('0x32')](_0x2ae8f8[_0xb77c('0x30')],_0x2ae8f8[_0xb77c('0x31')]);_0x4a02a1[_0xb77c('0x33')]=_[_0xb77c('0x32')](_0x2ae8f8['model'],qs['fields'](_0x19f565[_0xb77c('0x31')][_0xb77c('0x34')]));_0x4a02a1[_0xb77c('0x33')]=_0x4a02a1[_0xb77c('0x33')]['length']?_0x4a02a1[_0xb77c('0x33')]:_0x2ae8f8[_0xb77c('0x30')];if(_0x19f565[_0xb77c('0x31')][_0xb77c('0x44')]){_0x4a02a1['include']=[{'all':!![]}];}_0x4a02a1=_[_0xb77c('0x3c')]({},_0x4a02a1,_0x19f565[_0xb77c('0x3d')]);return db[_0xb77c('0x2b')][_0xb77c('0x45')](_0x4a02a1)[_0xb77c('0x23')](handleEntityNotFound(_0x3b4498,null))['then'](respondWithResult(_0x3b4498,null))[_0xb77c('0x41')](handleError(_0x3b4498,null));};exports[_0xb77c('0x46')]=function(_0x32f568,_0x2a59d1){return db[_0xb77c('0x2b')]['create'](_0x32f568[_0xb77c('0x47')],{})[_0xb77c('0x23')](respondWithResult(_0x2a59d1,0xc9))[_0xb77c('0x41')](handleError(_0x2a59d1,null));};exports[_0xb77c('0x48')]=function(_0x530c0d,_0x159947){if(_0x530c0d[_0xb77c('0x47')]['id']){delete _0x530c0d[_0xb77c('0x47')]['id'];}return db[_0xb77c('0x2b')][_0xb77c('0x45')]({'where':{'id':_0x530c0d['params']['id']}})[_0xb77c('0x23')](handleEntityNotFound(_0x159947,null))[_0xb77c('0x23')](saveUpdates(_0x530c0d[_0xb77c('0x47')],null))[_0xb77c('0x23')](respondWithResult(_0x159947,null))[_0xb77c('0x41')](handleError(_0x159947,null));};exports[_0xb77c('0x24')]=function(_0x14445b,_0x3726d2){return db['UserProfileSection'][_0xb77c('0x45')]({'where':{'id':_0x14445b[_0xb77c('0x49')]['id']}})[_0xb77c('0x23')](handleEntityNotFound(_0x3726d2,null))[_0xb77c('0x23')](removeEntity(_0x3726d2,null))[_0xb77c('0x41')](handleError(_0x3726d2,null));};exports[_0xb77c('0x4a')]=function(_0x4d532d,_0x4ac3b0){return db[_0xb77c('0x2b')]['describe']()[_0xb77c('0x23')](respondWithResult(_0x4ac3b0,null))[_0xb77c('0x41')](handleError(_0x4ac3b0,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 6e1d0d4..3476ec6 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 _0xc212=['sectionId','userProfileId','lodash','util','api','moment','request-promise','path','rimraf','./userProfileSection.attributes','exports','UserProfileSection','user_profile_has_sections','compositeIndex'];(function(_0x33ebf5,_0x258ec6){var _0x66957b=function(_0x49739a){while(--_0x49739a){_0x33ebf5['push'](_0x33ebf5['shift']());}};_0x66957b(++_0x258ec6);}(_0xc212,0x80));var _0x2c21=function(_0x5bd7de,_0x267a53){_0x5bd7de=_0x5bd7de-0x0;var _0x4c4e55=_0xc212[_0x5bd7de];return _0x4c4e55;};'use strict';var _=require(_0x2c21('0x0'));var util=require(_0x2c21('0x1'));var logger=require('../../config/logger')(_0x2c21('0x2'));var moment=require(_0x2c21('0x3'));var BPromise=require('bluebird');var rp=require(_0x2c21('0x4'));var fs=require('fs');var path=require(_0x2c21('0x5'));var rimraf=require(_0x2c21('0x6'));var config=require('../../config/environment');var attributes=require(_0x2c21('0x7'));module[_0x2c21('0x8')]=function(_0x448f4b,_0x5675f3){return _0x448f4b['define'](_0x2c21('0x9'),attributes,{'tableName':_0x2c21('0xa'),'paranoid':![],'indexes':[{'name':_0x2c21('0xb'),'fields':[_0x2c21('0xc'),_0x2c21('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6463=['request-promise','rimraf','../../config/environment','./userProfileSection.attributes','user_profile_has_sections','compositeIndex','userProfileId','util','../../config/logger','api','moment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6463,0xb7));var _0x3646=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6463[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x3646('0x0'));var logger=require(_0x3646('0x1'))(_0x3646('0x2'));var moment=require(_0x3646('0x3'));var BPromise=require('bluebird');var rp=require(_0x3646('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3646('0x5'));var config=require(_0x3646('0x6'));var attributes=require(_0x3646('0x7'));module['exports']=function(_0x6a6798,_0x3de8e2){return _0x6a6798['define']('UserProfileSection',attributes,{'tableName':_0x3646('0x8'),'paranoid':![],'indexes':[{'name':_0x3646('0x9'),'fields':['sectionId',_0x3646('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 7b7e8b2..bc261cc 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 _0x48db=['lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','UserProfileSection,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0x17fb2a,_0xe3f0af){var _0x20bcc2=function(_0x46ca03){while(--_0x46ca03){_0x17fb2a['push'](_0x17fb2a['shift']());}};_0x20bcc2(++_0xe3f0af);}(_0x48db,0x1e4));var _0xb48d=function(_0x43a1bf,_0xa35554){_0x43a1bf=_0x43a1bf-0x0;var _0x153633=_0x48db[_0x43a1bf];return _0x153633;};'use strict';var _=require(_0xb48d('0x0'));var util=require(_0xb48d('0x1'));var moment=require(_0xb48d('0x2'));var BPromise=require(_0xb48d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb48d('0x4'))['db'];var utils=require(_0xb48d('0x5'));var logger=require(_0xb48d('0x6'))(_0xb48d('0x7'));var config=require(_0xb48d('0x8'));var jayson=require(_0xb48d('0x9'));var client=jayson[_0xb48d('0xa')][_0xb48d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f442f,_0x5acf6a,_0x22ea6b){return new BPromise(function(_0x11efef,_0x44f215){return client[_0xb48d('0xc')](_0x4f442f,_0x22ea6b)[_0xb48d('0xd')](function(_0x387ae6){logger['info'](_0xb48d('0xe'),_0x5acf6a,'request\x20sent');logger['debug']('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x5acf6a,'request\x20sent',JSON[_0xb48d('0xf')](_0x387ae6));if(_0x387ae6[_0xb48d('0x10')]){if(_0x387ae6[_0xb48d('0x10')][_0xb48d('0x11')]===0x1f4){logger[_0xb48d('0x10')](_0xb48d('0xe'),_0x5acf6a,_0x387ae6[_0xb48d('0x10')]['message']);return _0x44f215(_0x387ae6[_0xb48d('0x10')][_0xb48d('0x12')]);}logger[_0xb48d('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x5acf6a,_0x387ae6['error'][_0xb48d('0x12')]);return _0x11efef(_0x387ae6[_0xb48d('0x10')][_0xb48d('0x12')]);}else{logger[_0xb48d('0x13')](_0xb48d('0xe'),_0x5acf6a,'request\x20sent');_0x11efef(_0x387ae6[_0xb48d('0x14')][_0xb48d('0x12')]);}})[_0xb48d('0x15')](function(_0x51f9f1){logger['error'](_0xb48d('0xe'),_0x5acf6a,_0x51f9f1);_0x44f215(_0x51f9f1);});});} \ No newline at end of file +var _0x711a=['UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserProfileSection,\x20%s,\x20%s','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','debug'];(function(_0x3503e8,_0xb9e08b){var _0xc5668=function(_0x477ba8){while(--_0x477ba8){_0x3503e8['push'](_0x3503e8['shift']());}};_0xc5668(++_0xb9e08b);}(_0x711a,0x14a));var _0xa711=function(_0x524e76,_0x38c12d){_0x524e76=_0x524e76-0x0;var _0x5826c6=_0x711a[_0x524e76];return _0x5826c6;};'use strict';var _=require(_0xa711('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa711('0x1'));var rs=require(_0xa711('0x2'));var fs=require('fs');var Redis=require(_0xa711('0x3'));var db=require(_0xa711('0x4'))['db'];var utils=require(_0xa711('0x5'));var logger=require(_0xa711('0x6'))(_0xa711('0x7'));var config=require(_0xa711('0x8'));var jayson=require(_0xa711('0x9'));var client=jayson[_0xa711('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a8ddc,_0x1232a3,_0x218614){return new BPromise(function(_0x29b84b,_0x318cca){return client[_0xa711('0xb')](_0x3a8ddc,_0x218614)[_0xa711('0xc')](function(_0x3fb0ef){logger[_0xa711('0xd')]('UserProfileSection,\x20%s,\x20%s',_0x1232a3,'request\x20sent');logger[_0xa711('0xe')](_0xa711('0xf'),_0x1232a3,_0xa711('0x10'),JSON[_0xa711('0x11')](_0x3fb0ef));if(_0x3fb0ef[_0xa711('0x12')]){if(_0x3fb0ef[_0xa711('0x12')][_0xa711('0x13')]===0x1f4){logger[_0xa711('0x12')](_0xa711('0x14'),_0x1232a3,_0x3fb0ef[_0xa711('0x12')][_0xa711('0x15')]);return _0x318cca(_0x3fb0ef[_0xa711('0x12')][_0xa711('0x15')]);}logger[_0xa711('0x12')](_0xa711('0x14'),_0x1232a3,_0x3fb0ef[_0xa711('0x12')][_0xa711('0x15')]);return _0x29b84b(_0x3fb0ef[_0xa711('0x12')]['message']);}else{logger[_0xa711('0xd')](_0xa711('0x14'),_0x1232a3,_0xa711('0x10'));_0x29b84b(_0x3fb0ef['result'][_0xa711('0x15')]);}})[_0xa711('0x16')](function(_0x168363){logger[_0xa711('0x12')](_0xa711('0x14'),_0x1232a3,_0x168363);_0x318cca(_0x168363);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 9ad383d..05966cd 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0xc85513,_0x49e852){var _0x3e70be=function(_0x53bbd6){while(--_0x53bbd6){_0xc85513['push'](_0xc85513['shift']());}};_0x3e70be(++_0x49e852);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x336281,_0x50b7c1){var _0x4935f5=function(_0x341e50){while(--_0x341e50){_0x336281['push'](_0x336281['shift']());}};_0x4935f5(++_0x50b7c1);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x36d25e,_0x1a047d){_0x36d25e=_0x36d25e-0x0;var _0x4b95b8=_0xcb91[_0x36d25e];return _0x4b95b8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index dde018c..3feb302 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 _0xf101=['exports'];(function(_0x5c374b,_0x2f5048){var _0x2a6a05=function(_0x1e89e2){while(--_0x1e89e2){_0x5c374b['push'](_0x5c374b['shift']());}};_0x2a6a05(++_0x2f5048);}(_0xf101,0x12a));var _0x1f10=function(_0x3c04d7,_0x472801){_0x3c04d7=_0x3c04d7-0x0;var _0x2fb24=_0xf101[_0x3c04d7];return _0x2fb24;};'use strict';var Sequelize=require('sequelize');module[_0x1f10('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x1135=['INTEGER','sequelize'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x1135,0x119));var _0x5113=function(_0x468a5a,_0x366cb2){_0x468a5a=_0x468a5a-0x0;var _0x255887=_0x1135[_0x468a5a];return _0x255887;};'use strict';var Sequelize=require(_0x5113('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x5113('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index e419db7..1dc9a44 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 _0x66fa=['define','UserSmsQueue','user_has_sms_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x25248b,_0x3c8491){var _0x509939=function(_0x457a27){while(--_0x457a27){_0x25248b['push'](_0x25248b['shift']());}};_0x509939(++_0x3c8491);}(_0x66fa,0x117));var _0xa66f=function(_0x23b095,_0x204034){_0x23b095=_0x23b095-0x0;var _0xf707b1=_0x66fa[_0x23b095];return _0xf707b1;};'use strict';var _=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var logger=require('../../config/logger')(_0xa66f('0x2'));var moment=require(_0xa66f('0x3'));var BPromise=require(_0xa66f('0x4'));var rp=require(_0xa66f('0x5'));var fs=require('fs');var path=require(_0xa66f('0x6'));var rimraf=require(_0xa66f('0x7'));var config=require(_0xa66f('0x8'));var attributes=require('./userSmsQueue.attributes');module['exports']=function(_0x2239d3,_0x20a150){return _0x2239d3[_0xa66f('0x9')](_0xa66f('0xa'),attributes,{'tableName':_0xa66f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','UserSmsQueue','user_has_sms_queues','lodash','util'];(function(_0x5b682f,_0x3befac){var _0x47f01b=function(_0xe2c7be){while(--_0xe2c7be){_0x5b682f['push'](_0x5b682f['shift']());}};_0x47f01b(++_0x3befac);}(_0x7a54,0x106));var _0x47a5=function(_0xb66a16,_0x28ca86){_0xb66a16=_0xb66a16-0x0;var _0x5c8431=_0x7a54[_0xb66a16];return _0x5c8431;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 8b44d7e..89ac60e 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 _0x16d0=['request','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0x16d0,0xfa));var _0x016d=function(_0x14b4f9,_0x5f18d0){_0x14b4f9=_0x14b4f9-0x0;var _0x1da730=_0x16d0[_0x14b4f9];return _0x1da730;};'use strict';var _=require('lodash');var util=require(_0x016d('0x0'));var moment=require(_0x016d('0x1'));var BPromise=require(_0x016d('0x2'));var rs=require(_0x016d('0x3'));var fs=require('fs');var Redis=require(_0x016d('0x4'));var db=require(_0x016d('0x5'))['db'];var utils=require(_0x016d('0x6'));var logger=require(_0x016d('0x7'))('rpc');var config=require(_0x016d('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x016d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2476e2,_0x153d3d,_0x331118){return new BPromise(function(_0x3abcab,_0x23b0da){return client[_0x016d('0xa')](_0x2476e2,_0x331118)['then'](function(_0x208d52){logger[_0x016d('0xb')](_0x016d('0xc'),_0x153d3d,_0x016d('0xd'));logger[_0x016d('0xe')](_0x016d('0xf'),_0x153d3d,_0x016d('0xd'),JSON['stringify'](_0x208d52));if(_0x208d52[_0x016d('0x10')]){if(_0x208d52['error'][_0x016d('0x11')]===0x1f4){logger[_0x016d('0x10')](_0x016d('0xc'),_0x153d3d,_0x208d52[_0x016d('0x10')][_0x016d('0x12')]);return _0x23b0da(_0x208d52['error'][_0x016d('0x12')]);}logger[_0x016d('0x10')](_0x016d('0xc'),_0x153d3d,_0x208d52[_0x016d('0x10')][_0x016d('0x12')]);return _0x3abcab(_0x208d52['error'][_0x016d('0x12')]);}else{logger[_0x016d('0xb')](_0x016d('0xc'),_0x153d3d,_0x016d('0xd'));_0x3abcab(_0x208d52[_0x016d('0x13')][_0x016d('0x12')]);}})['catch'](function(_0x15fe1b){logger[_0x016d('0x10')]('UserSmsQueue,\x20%s,\x20%s',_0x153d3d,_0x15fe1b);_0x23b0da(_0x15fe1b);});});} \ No newline at end of file +var _0x2922=['../../config/utils','../../config/logger','rpc','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','ioredis','../../mysqldb'];(function(_0x3165a8,_0x2c3f5e){var _0x365307=function(_0x425009){while(--_0x425009){_0x3165a8['push'](_0x3165a8['shift']());}};_0x365307(++_0x2c3f5e);}(_0x2922,0x1b4));var _0x2292=function(_0x27c1f2,_0x3a3b9d){_0x27c1f2=_0x27c1f2-0x0;var _0x5ea234=_0x2922[_0x27c1f2];return _0x5ea234;};'use strict';var _=require(_0x2292('0x0'));var util=require(_0x2292('0x1'));var moment=require('moment');var BPromise=require(_0x2292('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2292('0x3'));var db=require(_0x2292('0x4'))['db'];var utils=require(_0x2292('0x5'));var logger=require(_0x2292('0x6'))(_0x2292('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x2292('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x31137b,_0x3f338a,_0x305be0){return new BPromise(function(_0x42c665,_0x959cd){return client[_0x2292('0x9')](_0x31137b,_0x305be0)[_0x2292('0xa')](function(_0x1b1268){logger[_0x2292('0xb')](_0x2292('0xc'),_0x3f338a,_0x2292('0xd'));logger[_0x2292('0xe')](_0x2292('0xf'),_0x3f338a,_0x2292('0xd'),JSON[_0x2292('0x10')](_0x1b1268));if(_0x1b1268[_0x2292('0x11')]){if(_0x1b1268[_0x2292('0x11')][_0x2292('0x12')]===0x1f4){logger[_0x2292('0x11')]('UserSmsQueue,\x20%s,\x20%s',_0x3f338a,_0x1b1268[_0x2292('0x11')][_0x2292('0x13')]);return _0x959cd(_0x1b1268[_0x2292('0x11')]['message']);}logger['error'](_0x2292('0xc'),_0x3f338a,_0x1b1268['error'][_0x2292('0x13')]);return _0x42c665(_0x1b1268[_0x2292('0x11')][_0x2292('0x13')]);}else{logger['info'](_0x2292('0xc'),_0x3f338a,_0x2292('0xd'));_0x42c665(_0x1b1268['result']['message']);}})[_0x2292('0x14')](function(_0x5b2d0c){logger['error'](_0x2292('0xc'),_0x3f338a,_0x5b2d0c);_0x959cd(_0x5b2d0c);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/index.js b/server/api/userVoicePrefix/index.js index 57c0923..dff1488 100644 --- a/server/api/userVoicePrefix/index.js +++ b/server/api/userVoicePrefix/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x2aa92d,_0x322683){var _0x321efc=function(_0x3a7060){while(--_0x3a7060){_0x2aa92d['push'](_0x2aa92d['shift']());}};_0x321efc(++_0x322683);}(_0x70e0,0x17b));var _0x070e=function(_0xfb0cc8,_0x52cc49){_0xfb0cc8=_0xfb0cc8-0x0;var _0x5c1722=_0x70e0[_0xfb0cc8];return _0x5c1722;};'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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x4f83ea,_0x4b484e){var _0x3e41f6=function(_0x5cfcdc){while(--_0x5cfcdc){_0x4f83ea['push'](_0x4f83ea['shift']());}};_0x3e41f6(++_0x4b484e);}(_0x9c44,0x178));var _0x49c4=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x9c44[_0x550d12];return _0x12103d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index c7d7673..24b60f9 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 _0xf937=['exports','INTEGER'];(function(_0xeabd33,_0x29d7e3){var _0x45a055=function(_0x44032f){while(--_0x44032f){_0xeabd33['push'](_0xeabd33['shift']());}};_0x45a055(++_0x29d7e3);}(_0xf937,0x118));var _0x7f93=function(_0x7abd7,_0x1ca3f9){_0x7abd7=_0x7abd7-0x0;var _0x3a2577=_0xf937[_0x7abd7];return _0x3a2577;};'use strict';var Sequelize=require('sequelize');module[_0x7f93('0x0')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x7f93('0x1')]}}; \ No newline at end of file +var _0x4080=['exports','sequelize'];(function(_0x292fc9,_0x5d982b){var _0x57c52b=function(_0xf33773){while(--_0xf33773){_0x292fc9['push'](_0x292fc9['shift']());}};_0x57c52b(++_0x5d982b);}(_0x4080,0x1ad));var _0x0408=function(_0x350343,_0x256f69){_0x350343=_0x350343-0x0;var _0x9afc1c=_0x4080[_0x350343];return _0x9afc1c;};'use strict';var Sequelize=require(_0x0408('0x0'));module[_0x0408('0x1')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index cf9b3b9..b76dd67 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(_0x754a23,_0x428d2b){var _0x220355=function(_0x5d186f){while(--_0x5d186f){_0x754a23['push'](_0x754a23['shift']());}};_0x220355(++_0x428d2b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'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(_0x3e338c,_0x32fdcd){var _0x322a19=function(_0x2de733){while(--_0x2de733){_0x3e338c['push'](_0x3e338c['shift']());}};_0x322a19(++_0x32fdcd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.rpc.js b/server/api/userVoicePrefix/userVoicePrefix.rpc.js index 509fdcf..b9af116 100644 --- a/server/api/userVoicePrefix/userVoicePrefix.rpc.js +++ b/server/api/userVoicePrefix/userVoicePrefix.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdf86=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','UserVoicePrefix,\x20%s,\x20%s','request\x20sent','UserVoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util'];(function(_0x552d53,_0x56ced2){var _0x2cc575=function(_0x28bf93){while(--_0x28bf93){_0x552d53['push'](_0x552d53['shift']());}};_0x2cc575(++_0x56ced2);}(_0xdf86,0x1a1));var _0x6df8=function(_0x2e913b,_0x4b7071){_0x2e913b=_0x2e913b-0x0;var _0x173899=_0xdf86[_0x2e913b];return _0x173899;};'use strict';var _=require('lodash');var util=require(_0x6df8('0x0'));var moment=require(_0x6df8('0x1'));var BPromise=require(_0x6df8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6df8('0x3'));var db=require(_0x6df8('0x4'))['db'];var utils=require(_0x6df8('0x5'));var logger=require(_0x6df8('0x6'))('rpc');var config=require(_0x6df8('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6df8('0x8')][_0x6df8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x49fda1,_0x3048b7,_0x1fd4f5){return new BPromise(function(_0xb53ca6,_0x19d077){return client[_0x6df8('0xa')](_0x49fda1,_0x1fd4f5)[_0x6df8('0xb')](function(_0x4f74be){logger[_0x6df8('0xc')](_0x6df8('0xd'),_0x3048b7,_0x6df8('0xe'));logger['debug'](_0x6df8('0xf'),_0x3048b7,'request\x20sent',JSON[_0x6df8('0x10')](_0x4f74be));if(_0x4f74be[_0x6df8('0x11')]){if(_0x4f74be[_0x6df8('0x11')][_0x6df8('0x12')]===0x1f4){logger[_0x6df8('0x11')]('UserVoicePrefix,\x20%s,\x20%s',_0x3048b7,_0x4f74be[_0x6df8('0x11')][_0x6df8('0x13')]);return _0x19d077(_0x4f74be[_0x6df8('0x11')][_0x6df8('0x13')]);}logger['error'](_0x6df8('0xd'),_0x3048b7,_0x4f74be[_0x6df8('0x11')][_0x6df8('0x13')]);return _0xb53ca6(_0x4f74be[_0x6df8('0x11')][_0x6df8('0x13')]);}else{logger['info'](_0x6df8('0xd'),_0x3048b7,_0x6df8('0xe'));_0xb53ca6(_0x4f74be[_0x6df8('0x14')]['message']);}})[_0x6df8('0x15')](function(_0x4dd897){logger[_0x6df8('0x11')](_0x6df8('0xd'),_0x3048b7,_0x4dd897);_0x19d077(_0x4dd897);});});} \ No newline at end of file +var _0xa73e=['../../config/environment','jayson/promise','http','request','then','info','UserVoicePrefix,\x20%s,\x20%s','request\x20sent','debug','UserVoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x16f537,_0x25e0c8){var _0x2b6951=function(_0x2c7eaf){while(--_0x2c7eaf){_0x16f537['push'](_0x16f537['shift']());}};_0x2b6951(++_0x25e0c8);}(_0xa73e,0xbf));var _0xea73=function(_0x62fcf1,_0x4e0b8c){_0x62fcf1=_0x62fcf1-0x0;var _0x3a6f1d=_0xa73e[_0x62fcf1];return _0x3a6f1d;};'use strict';var _=require('lodash');var util=require(_0xea73('0x0'));var moment=require(_0xea73('0x1'));var BPromise=require(_0xea73('0x2'));var rs=require(_0xea73('0x3'));var fs=require('fs');var Redis=require(_0xea73('0x4'));var db=require(_0xea73('0x5'))['db'];var utils=require(_0xea73('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xea73('0x7'));var jayson=require(_0xea73('0x8'));var client=jayson['client'][_0xea73('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2623b0,_0x4692b3,_0x1704f0){return new BPromise(function(_0x2402a4,_0xd085c9){return client[_0xea73('0xa')](_0x2623b0,_0x1704f0)[_0xea73('0xb')](function(_0x747901){logger[_0xea73('0xc')](_0xea73('0xd'),_0x4692b3,_0xea73('0xe'));logger[_0xea73('0xf')](_0xea73('0x10'),_0x4692b3,_0xea73('0xe'),JSON[_0xea73('0x11')](_0x747901));if(_0x747901[_0xea73('0x12')]){if(_0x747901[_0xea73('0x12')][_0xea73('0x13')]===0x1f4){logger['error'](_0xea73('0xd'),_0x4692b3,_0x747901[_0xea73('0x12')][_0xea73('0x14')]);return _0xd085c9(_0x747901['error'][_0xea73('0x14')]);}logger[_0xea73('0x12')](_0xea73('0xd'),_0x4692b3,_0x747901[_0xea73('0x12')]['message']);return _0x2402a4(_0x747901[_0xea73('0x12')][_0xea73('0x14')]);}else{logger[_0xea73('0xc')]('UserVoicePrefix,\x20%s,\x20%s',_0x4692b3,_0xea73('0xe'));_0x2402a4(_0x747901['result']['message']);}})[_0xea73('0x15')](function(_0xf1a9c7){logger['error']('UserVoicePrefix,\x20%s,\x20%s',_0x4692b3,_0xf1a9c7);_0xd085c9(_0xf1a9c7);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 092d10d..74af53f 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(_0x35cf09,_0x5e86eb){var _0x3063f8=function(_0x55187a){while(--_0x55187a){_0x35cf09['push'](_0x35cf09['shift']());}};_0x3063f8(++_0x5e86eb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x160954,_0x894789){var _0xf6bef8=function(_0x33a33e){while(--_0x33a33e){_0x160954['push'](_0x160954['shift']());}};_0xf6bef8(++_0x894789);}(_0x70e0,0x17b));var _0x070e=function(_0x1362ff,_0xea0a19){_0x1362ff=_0x1362ff-0x0;var _0x51c736=_0x70e0[_0x1362ff];return _0x51c736;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 426b9f0..866e340 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 _0xc788=['sequelize','exports'];(function(_0x3b59d8,_0x182017){var _0x44c9b4=function(_0x2f1037){while(--_0x2f1037){_0x3b59d8['push'](_0x3b59d8['shift']());}};_0x44c9b4(++_0x182017);}(_0xc788,0x82));var _0x8c78=function(_0x4dbda8,_0xbce830){_0x4dbda8=_0x4dbda8-0x0;var _0x1149ed=_0xc788[_0x4dbda8];return _0x1149ed;};'use strict';var Sequelize=require(_0x8c78('0x0'));module[_0x8c78('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xe51f=['sequelize','exports','INTEGER'];(function(_0x2a21a,_0x4a0abd){var _0x320b31=function(_0x1dd8af){while(--_0x1dd8af){_0x2a21a['push'](_0x2a21a['shift']());}};_0x320b31(++_0x4a0abd);}(_0xe51f,0x19b));var _0xfe51=function(_0xd3d35a,_0x4c5967){_0xd3d35a=_0xd3d35a-0x0;var _0x29e6b7=_0xe51f[_0xd3d35a];return _0x29e6b7;};'use strict';var Sequelize=require(_0xfe51('0x0'));module[_0xfe51('0x1')]={'penalty':{'type':Sequelize[_0xfe51('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 0df1f11..11397e0 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 _0x51a4=['define','UserVoiceQueue','user_has_voice_queues','util','../../config/logger','api','bluebird','./userVoiceQueue.attributes','exports'];(function(_0x576f52,_0x2c8082){var _0x1dc879=function(_0x17fc73){while(--_0x17fc73){_0x576f52['push'](_0x576f52['shift']());}};_0x1dc879(++_0x2c8082);}(_0x51a4,0x17d));var _0x451a=function(_0x19f52b,_0x1451e5){_0x19f52b=_0x19f52b-0x0;var _0x57f3c6=_0x51a4[_0x19f52b];return _0x57f3c6;};'use strict';var _=require('lodash');var util=require(_0x451a('0x0'));var logger=require(_0x451a('0x1'))(_0x451a('0x2'));var moment=require('moment');var BPromise=require(_0x451a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x451a('0x4'));module[_0x451a('0x5')]=function(_0x1c55b8,_0x29e93c){return _0x1c55b8[_0x451a('0x6')](_0x451a('0x7'),attributes,{'tableName':_0x451a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x581d=['user_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','UserVoiceQueue'];(function(_0x18ceb5,_0x1beb00){var _0x24381f=function(_0x28457a){while(--_0x28457a){_0x18ceb5['push'](_0x18ceb5['shift']());}};_0x24381f(++_0x1beb00);}(_0x581d,0x76));var _0xd581=function(_0x13b683,_0x3013aa){_0x13b683=_0x13b683-0x0;var _0x4044a0=_0x581d[_0x13b683];return _0x4044a0;};'use strict';var _=require(_0xd581('0x0'));var util=require(_0xd581('0x1'));var logger=require(_0xd581('0x2'))(_0xd581('0x3'));var moment=require(_0xd581('0x4'));var BPromise=require(_0xd581('0x5'));var rp=require(_0xd581('0x6'));var fs=require('fs');var path=require(_0xd581('0x7'));var rimraf=require(_0xd581('0x8'));var config=require(_0xd581('0x9'));var attributes=require(_0xd581('0xa'));module['exports']=function(_0xa6411b,_0x530d4d){return _0xa6411b['define'](_0xd581('0xb'),attributes,{'tableName':_0xd581('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 85be8bd..8dc9ec8 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 _0x4152=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','debug','error','code','message','request\x20sent','result','catch','bluebird','randomstring'];(function(_0x12ef5c,_0x5b4325){var _0x11ab79=function(_0x1dbd38){while(--_0x1dbd38){_0x12ef5c['push'](_0x12ef5c['shift']());}};_0x11ab79(++_0x5b4325);}(_0x4152,0x163));var _0x2415=function(_0x5a92ad,_0x2219a6){_0x5a92ad=_0x5a92ad-0x0;var _0x2466f8=_0x4152[_0x5a92ad];return _0x2466f8;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x2415('0x0'));var rs=require(_0x2415('0x1'));var fs=require('fs');var Redis=require(_0x2415('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x2415('0x3'));var logger=require(_0x2415('0x4'))(_0x2415('0x5'));var config=require(_0x2415('0x6'));var jayson=require(_0x2415('0x7'));var client=jayson[_0x2415('0x8')][_0x2415('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1f965f,_0x48f984,_0x51e1f4){return new BPromise(function(_0x512246,_0x144e67){return client[_0x2415('0xa')](_0x1f965f,_0x51e1f4)[_0x2415('0xb')](function(_0x4241ee){logger[_0x2415('0xc')](_0x2415('0xd'),_0x48f984,'request\x20sent');logger[_0x2415('0xe')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x48f984,'request\x20sent',JSON['stringify'](_0x4241ee));if(_0x4241ee[_0x2415('0xf')]){if(_0x4241ee[_0x2415('0xf')][_0x2415('0x10')]===0x1f4){logger[_0x2415('0xf')]('UserVoiceQueue,\x20%s,\x20%s',_0x48f984,_0x4241ee[_0x2415('0xf')][_0x2415('0x11')]);return _0x144e67(_0x4241ee[_0x2415('0xf')][_0x2415('0x11')]);}logger[_0x2415('0xf')](_0x2415('0xd'),_0x48f984,_0x4241ee['error'][_0x2415('0x11')]);return _0x512246(_0x4241ee['error'][_0x2415('0x11')]);}else{logger[_0x2415('0xc')](_0x2415('0xd'),_0x48f984,_0x2415('0x12'));_0x512246(_0x4241ee[_0x2415('0x13')][_0x2415('0x11')]);}})[_0x2415('0x14')](function(_0x594e62){logger['error'](_0x2415('0xd'),_0x48f984,_0x594e62);_0x144e67(_0x594e62);});});} \ No newline at end of file +var _0xe727=['request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','info','UserVoiceQueue,\x20%s,\x20%s'];(function(_0x2ca4fd,_0x1611cc){var _0x24d1cd=function(_0x22ed79){while(--_0x22ed79){_0x2ca4fd['push'](_0x2ca4fd['shift']());}};_0x24d1cd(++_0x1611cc);}(_0xe727,0xd9));var _0x7e72=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xe727[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0x7e72('0x0'));var util=require(_0x7e72('0x1'));var moment=require(_0x7e72('0x2'));var BPromise=require(_0x7e72('0x3'));var rs=require(_0x7e72('0x4'));var fs=require('fs');var Redis=require(_0x7e72('0x5'));var db=require(_0x7e72('0x6'))['db'];var utils=require(_0x7e72('0x7'));var logger=require(_0x7e72('0x8'))(_0x7e72('0x9'));var config=require(_0x7e72('0xa'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2d1e82,_0x4c8b3a,_0x197f55){return new BPromise(function(_0x40e829,_0x231be6){return client[_0x7e72('0xb')](_0x2d1e82,_0x197f55)['then'](function(_0x432aaa){logger[_0x7e72('0xc')](_0x7e72('0xd'),_0x4c8b3a,_0x7e72('0xe'));logger[_0x7e72('0xf')](_0x7e72('0x10'),_0x4c8b3a,_0x7e72('0xe'),JSON['stringify'](_0x432aaa));if(_0x432aaa[_0x7e72('0x11')]){if(_0x432aaa[_0x7e72('0x11')]['code']===0x1f4){logger['error'](_0x7e72('0xd'),_0x4c8b3a,_0x432aaa[_0x7e72('0x11')]['message']);return _0x231be6(_0x432aaa[_0x7e72('0x11')][_0x7e72('0x12')]);}logger[_0x7e72('0x11')](_0x7e72('0xd'),_0x4c8b3a,_0x432aaa[_0x7e72('0x11')][_0x7e72('0x12')]);return _0x40e829(_0x432aaa['error']['message']);}else{logger[_0x7e72('0xc')](_0x7e72('0xd'),_0x4c8b3a,'request\x20sent');_0x40e829(_0x432aaa[_0x7e72('0x13')][_0x7e72('0x12')]);}})[_0x7e72('0x14')](function(_0x23abc3){logger['error'](_0x7e72('0xd'),_0x4c8b3a,_0x23abc3);_0x231be6(_0x23abc3);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index fbcf47d..fe9a800 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x5621e8,_0x257e0d){var _0x20d8a7=function(_0x34b36a){while(--_0x34b36a){_0x5621e8['push'](_0x5621e8['shift']());}};_0x20d8a7(++_0x257e0d);}(_0x9c44,0x178));var _0x49c4=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x9c44[_0x3ab51d];return _0x29a04e;};'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(_0x16481b,_0x3f3ba7){var _0x420bcd=function(_0x397e4d){while(--_0x397e4d){_0x16481b['push'](_0x16481b['shift']());}};_0x420bcd(++_0x3f3ba7);}(_0x70e0,0x17b));var _0x070e=function(_0x2438c3,_0x14c94c){_0x2438c3=_0x2438c3-0x0;var _0x6a70da=_0x70e0[_0x2438c3];return _0x6a70da;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index fea95da..8e33619 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 _0xa108=['Required\x20by\x20Asterisk','INTEGER','STRING','queue_interface','sequelize'];(function(_0xb4710a,_0x585188){var _0x602935=function(_0x1e86bd){while(--_0x1e86bd){_0xb4710a['push'](_0xb4710a['shift']());}};_0x602935(++_0x585188);}(_0xa108,0x130));var _0x8a10=function(_0x450e84,_0x168105){_0x450e84=_0x450e84-0x0;var _0x531342=_0xa108[_0x450e84];return _0x531342;};'use strict';var Sequelize=require(_0x8a10('0x0'));module['exports']={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0x8a10('0x1')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x8a10('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x8a10('0x3')],'allowNull':![],'unique':_0x8a10('0x4'),'comment':_0x8a10('0x1')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x8a10('0x3')],'allowNull':![],'unique':_0x8a10('0x4'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x8a10('0x2')](0xb),'defaultValue':0x0,'comment':_0x8a10('0x1')}}; \ No newline at end of file +var _0x189b=['INTEGER','STRING','Required\x20by\x20Asterisk','queue_interface','sequelize'];(function(_0x8fb7a4,_0x607700){var _0x1fdca2=function(_0x300754){while(--_0x300754){_0x8fb7a4['push'](_0x8fb7a4['shift']());}};_0x1fdca2(++_0x607700);}(_0x189b,0x15d));var _0xb189=function(_0x26a901,_0x29dd83){_0x26a901=_0x26a901-0x0;var _0x305c2a=_0x189b[_0x26a901];return _0x305c2a;};'use strict';var Sequelize=require(_0xb189('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xb189('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0xb189('0x2')],'allowNull':![],'comment':_0xb189('0x3')},'UserId':{'type':Sequelize[_0xb189('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xb189('0x4'),'comment':_0xb189('0x3')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0xb189('0x2')],'allowNull':![],'unique':_0xb189('0x4'),'comment':_0xb189('0x3')},'penalty':{'type':Sequelize[_0xb189('0x1')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0xb189('0x1')](0xb),'defaultValue':0x0,'comment':_0xb189('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index d015239..b8601d3 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 _0xf5d9=['setMaxListeners','save','remove','emit','hook','events'];(function(_0x11a92b,_0x3b3a7b){var _0xe4a20f=function(_0x3012cb){while(--_0x3012cb){_0x11a92b['push'](_0x11a92b['shift']());}};_0xe4a20f(++_0x3b3a7b);}(_0xf5d9,0xb3));var _0x9f5d=function(_0x5cc8,_0x1faa02){_0x5cc8=_0x5cc8-0x0;var _0x450661=_0xf5d9[_0x5cc8];return _0x450661;};'use strict';var EventEmitter=require(_0x9f5d('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x9f5d('0x1')](0x0);var events={'afterCreate':_0x9f5d('0x2'),'afterUpdate':'update','afterDestroy':_0x9f5d('0x3')};function emitEvent(_0x23aae3){return function(_0x3a899a,_0x1c9590,_0x4f7873){UserVoiceQueueRtEvents[_0x9f5d('0x4')](_0x23aae3+':'+_0x3a899a['id'],_0x3a899a);UserVoiceQueueRtEvents['emit'](_0x23aae3,_0x3a899a);_0x4f7873(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x9f5d('0x5')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xb67c=['exports','UserVoiceQueueRt','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x40ba7b,_0x4aa904){var _0x56fcef=function(_0x59b2c6){while(--_0x59b2c6){_0x40ba7b['push'](_0x40ba7b['shift']());}};_0x56fcef(++_0x4aa904);}(_0xb67c,0x149));var _0xcb67=function(_0x3dd822,_0x3b9fed){_0x3dd822=_0x3dd822-0x0;var _0x4f58d0=_0xb67c[_0x3dd822];return _0x4f58d0;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require('../../mysqldb')['db'][_0xcb67('0x0')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xcb67('0x1'),'afterUpdate':_0xcb67('0x2'),'afterDestroy':_0xcb67('0x3')};function emitEvent(_0x2b056e){return function(_0xe9b7b0,_0x27ca95,_0x577097){UserVoiceQueueRtEvents['emit'](_0x2b056e+':'+_0xe9b7b0['id'],_0xe9b7b0);UserVoiceQueueRtEvents[_0xcb67('0x4')](_0x2b056e,_0xe9b7b0);_0x577097(null);};}for(var e in events){if(events[_0xcb67('0x5')](e)){var event=events[e];UserVoiceQueueRt[_0xcb67('0x6')](e,emitEvent(event));}}module[_0xcb67('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 5e8af78..525f3f8 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 _0x3c6e=['user_has_voice_queues_rt','util','api','request-promise','path','../../config/environment','exports','define'];(function(_0x528fa3,_0x3c8282){var _0x5a3760=function(_0x7248db){while(--_0x7248db){_0x528fa3['push'](_0x528fa3['shift']());}};_0x5a3760(++_0x3c8282);}(_0x3c6e,0xd9));var _0xe3c6=function(_0x1bb780,_0x13dcac){_0x1bb780=_0x1bb780-0x0;var _0x170e8d=_0x3c6e[_0x1bb780];return _0x170e8d;};'use strict';var _=require('lodash');var util=require(_0xe3c6('0x0'));var logger=require('../../config/logger')(_0xe3c6('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe3c6('0x2'));var fs=require('fs');var path=require(_0xe3c6('0x3'));var rimraf=require('rimraf');var config=require(_0xe3c6('0x4'));var attributes=require('./userVoiceQueueRt.attributes');module[_0xe3c6('0x5')]=function(_0x11b35b,_0x4f2015){return _0x11b35b[_0xe3c6('0x6')]('UserVoiceQueueRt',attributes,{'tableName':_0xe3c6('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2cc6=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','user_has_voice_queues_rt','lodash'];(function(_0xdef91c,_0x28dbab){var _0x225a4e=function(_0xea90cd){while(--_0xea90cd){_0xdef91c['push'](_0xdef91c['shift']());}};_0x225a4e(++_0x28dbab);}(_0x2cc6,0xb5));var _0x62cc=function(_0x4cfc35,_0xb52690){_0x4cfc35=_0x4cfc35-0x0;var _0x43a384=_0x2cc6[_0x4cfc35];return _0x43a384;};'use strict';var _=require(_0x62cc('0x0'));var util=require(_0x62cc('0x1'));var logger=require(_0x62cc('0x2'))(_0x62cc('0x3'));var moment=require(_0x62cc('0x4'));var BPromise=require(_0x62cc('0x5'));var rp=require(_0x62cc('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x62cc('0x7'));var config=require(_0x62cc('0x8'));var attributes=require(_0x62cc('0x9'));module[_0x62cc('0xa')]=function(_0x9940be,_0x519963){return _0x9940be[_0x62cc('0xb')]('UserVoiceQueueRt',attributes,{'tableName':_0x62cc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 8ecab10..8ebb7e1 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 _0x2ce2=['../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','options','raw','where','sequelize','COUNT','outboundQueuePauses','GetVoiceQueueRtPauses','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x26887c,_0x5c88ab){var _0x3a778d=function(_0x3ad25c){while(--_0x3ad25c){_0x26887c['push'](_0x26887c['shift']());}};_0x3a778d(++_0x5c88ab);}(_0x2ce2,0x1f0));var _0x22ce=function(_0x3115fa,_0x1bf37e){_0x3115fa=_0x3115fa-0x0;var _0x3a5567=_0x2ce2[_0x3115fa];return _0x3a5567;};'use strict';var _=require(_0x22ce('0x0'));var util=require(_0x22ce('0x1'));var moment=require(_0x22ce('0x2'));var BPromise=require(_0x22ce('0x3'));var rs=require(_0x22ce('0x4'));var fs=require('fs');var Redis=require(_0x22ce('0x5'));var db=require(_0x22ce('0x6'))['db'];var utils=require(_0x22ce('0x7'));var logger=require(_0x22ce('0x8'))(_0x22ce('0x9'));var config=require(_0x22ce('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x22ce('0xb')][_0x22ce('0xc')]({'port':0x232a});config[_0x22ce('0xd')]=_['defaults'](config['redis'],{'host':_0x22ce('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x22ce('0xd')]));require(_0x22ce('0xf'))[_0x22ce('0x10')](socket);function respondWithRpcPromise(_0x2b03e5,_0x3207ff,_0xc58a3d){return new BPromise(function(_0x33ddf0,_0x19344c){return client[_0x22ce('0x11')](_0x2b03e5,_0xc58a3d)[_0x22ce('0x12')](function(_0x272f1d){logger[_0x22ce('0x13')](_0x22ce('0x14'),_0x3207ff,_0x22ce('0x15'));logger[_0x22ce('0x16')](_0x22ce('0x17'),_0x3207ff,_0x22ce('0x15'),JSON[_0x22ce('0x18')](_0x272f1d));if(_0x272f1d['error']){if(_0x272f1d['error']['code']===0x1f4){logger[_0x22ce('0x19')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x3207ff,_0x272f1d[_0x22ce('0x19')][_0x22ce('0x1a')]);return _0x19344c(_0x272f1d[_0x22ce('0x19')][_0x22ce('0x1a')]);}logger[_0x22ce('0x19')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x3207ff,_0x272f1d[_0x22ce('0x19')]['message']);return _0x33ddf0(_0x272f1d[_0x22ce('0x19')]['message']);}else{logger[_0x22ce('0x13')](_0x22ce('0x14'),_0x3207ff,'request\x20sent');_0x33ddf0(_0x272f1d[_0x22ce('0x1b')][_0x22ce('0x1a')]);}})[_0x22ce('0x1c')](function(_0x14c26d){logger[_0x22ce('0x19')](_0x22ce('0x14'),_0x3207ff,_0x14c26d);_0x19344c(_0x14c26d);});});}exports['GetVoiceQueueRtPauses']=function(_0xf3f13c){var _0x13724f=this;return new Promise(function(_0x172be2,_0x3c3fd3){return db['UserVoiceQueueRt']['findAll']({'raw':_0xf3f13c[_0x22ce('0x1d')]?_0xf3f13c[_0x22ce('0x1d')][_0x22ce('0x1e')]===undefined?!![]:![]:!![],'where':_0xf3f13c[_0x22ce('0x1d')]?_0xf3f13c[_0x22ce('0x1d')][_0x22ce('0x1f')]||null:null,'attributes':[[db[_0x22ce('0x20')]['fn'](_0x22ce('0x21'),db[_0x22ce('0x20')]['fn']('IF',db[_0x22ce('0x20')]['literal']('`paused`\x20=\x201,\x201,\x20null'))),_0x22ce('0x22')]]})['then'](function(_0x38f051){logger['info']('GetVoiceQueueRtPauses',_0xf3f13c);logger['debug'](_0x22ce('0x23'),_0xf3f13c,JSON[_0x22ce('0x18')](_0x38f051));_0x172be2(_0x38f051);})[_0x22ce('0x1c')](function(_0x8beef){logger[_0x22ce('0x19')](_0x22ce('0x23'),_0x8beef[_0x22ce('0x1a')],_0xf3f13c);_0x3c3fd3(_0x13724f[_0x22ce('0x19')](0x1f4,_0x8beef['message']));});});}; \ No newline at end of file +var _0x7b88=['./userVoiceQueueRt.socket','register','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVoiceQueueRtPauses','options','raw','where','sequelize','COUNT','`paused`\x20=\x201,\x201,\x20null','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x4ba5d0,_0x4c08e3){var _0x22c193=function(_0x3536ba){while(--_0x3536ba){_0x4ba5d0['push'](_0x4ba5d0['shift']());}};_0x22c193(++_0x4c08e3);}(_0x7b88,0x7a));var _0x87b8=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x7b88[_0x1da527];return _0x40fc7c;};'use strict';var _=require(_0x87b8('0x0'));var util=require(_0x87b8('0x1'));var moment=require(_0x87b8('0x2'));var BPromise=require(_0x87b8('0x3'));var rs=require(_0x87b8('0x4'));var fs=require('fs');var Redis=require(_0x87b8('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x87b8('0x6'))('rpc');var config=require(_0x87b8('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x87b8('0x8')][_0x87b8('0x9')]({'port':0x232a});config[_0x87b8('0xa')]=_[_0x87b8('0xb')](config[_0x87b8('0xa')],{'host':_0x87b8('0xc'),'port':0x18eb});var socket=require(_0x87b8('0xd'))(new Redis(config['redis']));require(_0x87b8('0xe'))[_0x87b8('0xf')](socket);function respondWithRpcPromise(_0xd72258,_0x210152,_0x49a3a3){return new BPromise(function(_0x57b411,_0x479e89){return client['request'](_0xd72258,_0x49a3a3)[_0x87b8('0x10')](function(_0x108704){logger[_0x87b8('0x11')](_0x87b8('0x12'),_0x210152,_0x87b8('0x13'));logger[_0x87b8('0x14')](_0x87b8('0x15'),_0x210152,'request\x20sent',JSON[_0x87b8('0x16')](_0x108704));if(_0x108704['error']){if(_0x108704[_0x87b8('0x17')]['code']===0x1f4){logger[_0x87b8('0x17')](_0x87b8('0x12'),_0x210152,_0x108704[_0x87b8('0x17')][_0x87b8('0x18')]);return _0x479e89(_0x108704[_0x87b8('0x17')][_0x87b8('0x18')]);}logger[_0x87b8('0x17')](_0x87b8('0x12'),_0x210152,_0x108704['error']['message']);return _0x57b411(_0x108704['error'][_0x87b8('0x18')]);}else{logger['info'](_0x87b8('0x12'),_0x210152,_0x87b8('0x13'));_0x57b411(_0x108704[_0x87b8('0x19')]['message']);}})[_0x87b8('0x1a')](function(_0x2a3054){logger[_0x87b8('0x17')](_0x87b8('0x12'),_0x210152,_0x2a3054);_0x479e89(_0x2a3054);});});}exports[_0x87b8('0x1b')]=function(_0x154744){var _0x970ff4=this;return new Promise(function(_0x3a9452,_0x43ff6f){return db['UserVoiceQueueRt']['findAll']({'raw':_0x154744['options']?_0x154744[_0x87b8('0x1c')][_0x87b8('0x1d')]===undefined?!![]:![]:!![],'where':_0x154744[_0x87b8('0x1c')]?_0x154744[_0x87b8('0x1c')][_0x87b8('0x1e')]||null:null,'attributes':[[db[_0x87b8('0x1f')]['fn'](_0x87b8('0x20'),db[_0x87b8('0x1f')]['fn']('IF',db[_0x87b8('0x1f')]['literal'](_0x87b8('0x21')))),'outboundQueuePauses']]})[_0x87b8('0x10')](function(_0x3c606e){logger[_0x87b8('0x11')](_0x87b8('0x1b'),_0x154744);logger[_0x87b8('0x14')]('GetVoiceQueueRtPauses',_0x154744,JSON[_0x87b8('0x16')](_0x3c606e));_0x3a9452(_0x3c606e);})[_0x87b8('0x1a')](function(_0x2cb534){logger['error'](_0x87b8('0x1b'),_0x2cb534[_0x87b8('0x18')],_0x154744);_0x43ff6f(_0x970ff4[_0x87b8('0x17')](0x1f4,_0x2cb534[_0x87b8('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index e3c8da9..350db4d 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 _0x8819=['removeListener','register','length','userVoiceQueueRt:','remove','update'];(function(_0x2539e6,_0x595d36){var _0xe83570=function(_0x2a8b2e){while(--_0x2a8b2e){_0x2539e6['push'](_0x2539e6['shift']());}};_0xe83570(++_0x595d36);}(_0x8819,0x94));var _0x9881=function(_0x11a356,_0x5e41a){_0x11a356=_0x11a356-0x0;var _0x14c5d1=_0x8819[_0x11a356];return _0x14c5d1;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=['save',_0x9881('0x0'),_0x9881('0x1')];function createListener(_0x317d26,_0x14cd6c){return function(_0x17e6bf){_0x14cd6c['emit'](_0x317d26,_0x17e6bf);};}function removeListener(_0x333d6f,_0x446deb){return function(){UserVoiceQueueRtEvents[_0x9881('0x2')](_0x333d6f,_0x446deb);};}exports[_0x9881('0x3')]=function(_0x1791fd){for(var _0x2a3664=0x0,_0x5f1d45=events[_0x9881('0x4')];_0x2a3664<_0x5f1d45;_0x2a3664++){var _0x4a6471=events[_0x2a3664];var _0x530547=createListener(_0x9881('0x5')+_0x4a6471,_0x1791fd);UserVoiceQueueRtEvents['on'](_0x4a6471,_0x530547);}}; \ No newline at end of file +var _0x9829=['remove','update','emit','removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save'];(function(_0x50c710,_0x504134){var _0x2d5f79=function(_0x73e66c){while(--_0x73e66c){_0x50c710['push'](_0x50c710['shift']());}};_0x2d5f79(++_0x504134);}(_0x9829,0xc4));var _0x9982=function(_0x308213,_0x224541){_0x308213=_0x308213-0x0;var _0x2e1619=_0x9829[_0x308213];return _0x2e1619;};'use strict';var UserVoiceQueueRtEvents=require(_0x9982('0x0'));var events=[_0x9982('0x1'),_0x9982('0x2'),_0x9982('0x3')];function createListener(_0x338564,_0x4c01a9){return function(_0x399b6c){_0x4c01a9[_0x9982('0x4')](_0x338564,_0x399b6c);};}function removeListener(_0x2f782a,_0x4bee19){return function(){UserVoiceQueueRtEvents[_0x9982('0x5')](_0x2f782a,_0x4bee19);};}exports[_0x9982('0x6')]=function(_0x58f8fe){for(var _0x500dfd=0x0,_0x340d62=events[_0x9982('0x7')];_0x500dfd<_0x340d62;_0x500dfd++){var _0x5d0824=events[_0x500dfd];var _0x25f30a=createListener(_0x9982('0x8')+_0x5d0824,_0x58f8fe);UserVoiceQueueRtEvents['on'](_0x5d0824,_0x25f30a);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index ed87dd6..1b44d73 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(_0x37d0bc,_0x109b96){var _0x170e60=function(_0xae2ad){while(--_0xae2ad){_0x37d0bc['push'](_0x37d0bc['shift']());}};_0x170e60(++_0x109b96);}(_0x9c44,0x178));var _0x49c4=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x9c44[_0x50a0c2];return _0x5ebadd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x2d1ee7,_0x3f22f0){var _0x1a40fb=function(_0xcceeb8){while(--_0xcceeb8){_0x2d1ee7['push'](_0x2d1ee7['shift']());}};_0x1a40fb(++_0x3f22f0);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x16cb03,_0x43ea58){_0x16cb03=_0x16cb03-0x0;var _0x10944e=_0xcb91[_0x16cb03];return _0x10944e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 524105f..6d32187 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 _0xf6d0=['sequelize'];(function(_0x248361,_0x21ecf9){var _0x20c2a2=function(_0x148166){while(--_0x148166){_0x248361['push'](_0x248361['shift']());}};_0x20c2a2(++_0x21ecf9);}(_0xf6d0,0x163));var _0x0f6d=function(_0x3d8043,_0x3d541f){_0x3d8043=_0x3d8043-0x0;var _0x34e4c6=_0xf6d0[_0x3d8043];return _0x34e4c6;};'use strict';var Sequelize=require(_0x0f6d('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xb2c0=['sequelize','INTEGER'];(function(_0x39f648,_0x1e9ff3){var _0x53546a=function(_0x23fab6){while(--_0x23fab6){_0x39f648['push'](_0x39f648['shift']());}};_0x53546a(++_0x1e9ff3);}(_0xb2c0,0x110));var _0x0b2c=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xb2c0[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x0b2c('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x0b2c('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index f43e8be..9ecc7ff 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 _0x3bde=['../../config/environment','./userWhatsappQueue.attributes','define','user_has_whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x48cd52,_0x1894ba){var _0x3caaee=function(_0x2c567e){while(--_0x2c567e){_0x48cd52['push'](_0x48cd52['shift']());}};_0x3caaee(++_0x1894ba);}(_0x3bde,0x9e));var _0xe3bd=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0x3bde[_0xd09668];return _0x68726;};'use strict';var _=require(_0xe3bd('0x0'));var util=require(_0xe3bd('0x1'));var logger=require(_0xe3bd('0x2'))(_0xe3bd('0x3'));var moment=require(_0xe3bd('0x4'));var BPromise=require(_0xe3bd('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe3bd('0x6'));var rimraf=require('rimraf');var config=require(_0xe3bd('0x7'));var attributes=require(_0xe3bd('0x8'));module['exports']=function(_0x3df2e1,_0x1dab71){return _0x3df2e1[_0xe3bd('0x9')]('UserWhatsappQueue',attributes,{'tableName':_0xe3bd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c45=['path','rimraf','../../config/environment','exports','define','UserWhatsappQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x496f2c,_0x333179){var _0x242388=function(_0x13f0a4){while(--_0x13f0a4){_0x496f2c['push'](_0x496f2c['shift']());}};_0x242388(++_0x333179);}(_0x3c45,0x1c0));var _0x53c4=function(_0x454f02,_0x32ce79){_0x454f02=_0x454f02-0x0;var _0x3369f7=_0x3c45[_0x454f02];return _0x3369f7;};'use strict';var _=require(_0x53c4('0x0'));var util=require(_0x53c4('0x1'));var logger=require(_0x53c4('0x2'))(_0x53c4('0x3'));var moment=require(_0x53c4('0x4'));var BPromise=require(_0x53c4('0x5'));var rp=require(_0x53c4('0x6'));var fs=require('fs');var path=require(_0x53c4('0x7'));var rimraf=require(_0x53c4('0x8'));var config=require(_0x53c4('0x9'));var attributes=require('./userWhatsappQueue.attributes');module[_0x53c4('0xa')]=function(_0x29c1e7,_0x471c92){return _0x29c1e7[_0x53c4('0xb')](_0x53c4('0xc'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 06ed012..a35a800 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 _0xc901=['message','info','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','client','http','request','then','UserWhatsappQueue,\x20%s,\x20%s','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error'];(function(_0x385ce8,_0x332ed5){var _0x12867d=function(_0x16d67c){while(--_0x16d67c){_0x385ce8['push'](_0x385ce8['shift']());}};_0x12867d(++_0x332ed5);}(_0xc901,0xe1));var _0x1c90=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xc901[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x1c90('0x0'));var util=require(_0x1c90('0x1'));var moment=require(_0x1c90('0x2'));var BPromise=require(_0x1c90('0x3'));var rs=require(_0x1c90('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1c90('0x5'))(_0x1c90('0x6'));var config=require(_0x1c90('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1c90('0x8')][_0x1c90('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3d25b4,_0x57981f,_0x39bbc7){return new BPromise(function(_0x446a77,_0x2b4155){return client[_0x1c90('0xa')](_0x3d25b4,_0x39bbc7)[_0x1c90('0xb')](function(_0x484232){logger['info'](_0x1c90('0xc'),_0x57981f,'request\x20sent');logger['debug'](_0x1c90('0xd'),_0x57981f,'request\x20sent',JSON['stringify'](_0x484232));if(_0x484232['error']){if(_0x484232[_0x1c90('0xe')]['code']===0x1f4){logger['error'](_0x1c90('0xc'),_0x57981f,_0x484232[_0x1c90('0xe')][_0x1c90('0xf')]);return _0x2b4155(_0x484232['error'][_0x1c90('0xf')]);}logger[_0x1c90('0xe')]('UserWhatsappQueue,\x20%s,\x20%s',_0x57981f,_0x484232['error']['message']);return _0x446a77(_0x484232[_0x1c90('0xe')][_0x1c90('0xf')]);}else{logger[_0x1c90('0x10')]('UserWhatsappQueue,\x20%s,\x20%s',_0x57981f,_0x1c90('0x11'));_0x446a77(_0x484232[_0x1c90('0x12')][_0x1c90('0xf')]);}})[_0x1c90('0x13')](function(_0x193cb1){logger['error']('UserWhatsappQueue,\x20%s,\x20%s',_0x57981f,_0x193cb1);_0x2b4155(_0x193cb1);});});} \ No newline at end of file +var _0x23af=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x290aa5,_0x201fcc){var _0x425aec=function(_0x10f589){while(--_0x10f589){_0x290aa5['push'](_0x290aa5['shift']());}};_0x425aec(++_0x201fcc);}(_0x23af,0x136));var _0xf23a=function(_0x1e1d5c,_0x2ffacd){_0x1e1d5c=_0x1e1d5c-0x0;var _0x2a3ce9=_0x23af[_0x1e1d5c];return _0x2a3ce9;};'use strict';var _=require(_0xf23a('0x0'));var util=require(_0xf23a('0x1'));var moment=require('moment');var BPromise=require(_0xf23a('0x2'));var rs=require(_0xf23a('0x3'));var fs=require('fs');var Redis=require(_0xf23a('0x4'));var db=require(_0xf23a('0x5'))['db'];var utils=require(_0xf23a('0x6'));var logger=require(_0xf23a('0x7'))(_0xf23a('0x8'));var config=require(_0xf23a('0x9'));var jayson=require(_0xf23a('0xa'));var client=jayson[_0xf23a('0xb')][_0xf23a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5e1965,_0x3b9980,_0x3a9a59){return new BPromise(function(_0x5c2e37,_0x6e8d14){return client[_0xf23a('0xd')](_0x5e1965,_0x3a9a59)['then'](function(_0x46ff1e){logger[_0xf23a('0xe')](_0xf23a('0xf'),_0x3b9980,_0xf23a('0x10'));logger['debug'](_0xf23a('0x11'),_0x3b9980,_0xf23a('0x10'),JSON[_0xf23a('0x12')](_0x46ff1e));if(_0x46ff1e[_0xf23a('0x13')]){if(_0x46ff1e[_0xf23a('0x13')][_0xf23a('0x14')]===0x1f4){logger['error'](_0xf23a('0xf'),_0x3b9980,_0x46ff1e[_0xf23a('0x13')][_0xf23a('0x15')]);return _0x6e8d14(_0x46ff1e['error'][_0xf23a('0x15')]);}logger['error'](_0xf23a('0xf'),_0x3b9980,_0x46ff1e['error'][_0xf23a('0x15')]);return _0x5c2e37(_0x46ff1e[_0xf23a('0x13')][_0xf23a('0x15')]);}else{logger[_0xf23a('0xe')](_0xf23a('0xf'),_0x3b9980,_0xf23a('0x10'));_0x5c2e37(_0x46ff1e[_0xf23a('0x16')]['message']);}})[_0xf23a('0x17')](function(_0x45ba22){logger[_0xf23a('0x13')](_0xf23a('0xf'),_0x3b9980,_0x45ba22);_0x6e8d14(_0x45ba22);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index c2cd9da..8df7dc6 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 _0x9181=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show'];(function(_0x5ded68,_0x4f321d){var _0x20c888=function(_0x270df1){while(--_0x270df1){_0x5ded68['push'](_0x5ded68['shift']());}};_0x20c888(++_0x4f321d);}(_0x9181,0x182));var _0x1918=function(_0x14651d,_0x45a042){_0x14651d=_0x14651d-0x0;var _0xa99a05=_0x9181[_0x14651d];return _0xa99a05;};'use strict';var multer=require(_0x1918('0x0'));var util=require(_0x1918('0x1'));var path=require(_0x1918('0x2'));var timeout=require(_0x1918('0x3'));var express=require(_0x1918('0x4'));var router=express['Router']();var fs_extra=require(_0x1918('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1918('0x6'));var config=require(_0x1918('0x7'));var controller=require(_0x1918('0x8'));router[_0x1918('0x9')]('/',auth[_0x1918('0xa')](),controller[_0x1918('0xb')]);router['get'](_0x1918('0xc'),auth['isAuthenticated'](),controller[_0x1918('0xd')]);router['post']('/',auth[_0x1918('0xa')](),controller[_0x1918('0xe')]);router[_0x1918('0xf')](_0x1918('0xc'),auth[_0x1918('0xa')](),controller[_0x1918('0x10')]);router[_0x1918('0x11')](_0x1918('0xc'),auth[_0x1918('0xa')](),controller[_0x1918('0x12')]);module[_0x1918('0x13')]=router; \ No newline at end of file +var _0xdb4b=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','show','post','create','/:id','update','delete','exports','util'];(function(_0x34023d,_0x25ecce){var _0x3669d0=function(_0x3f081b){while(--_0x3f081b){_0x34023d['push'](_0x34023d['shift']());}};_0x3669d0(++_0x25ecce);}(_0xdb4b,0xd7));var _0xbdb4=function(_0x30fc1f,_0x56890f){_0x30fc1f=_0x30fc1f-0x0;var _0x5b25ff=_0xdb4b[_0x30fc1f];return _0x5b25ff;};'use strict';var multer=require('multer');var util=require(_0xbdb4('0x0'));var path=require('path');var timeout=require(_0xbdb4('0x1'));var express=require(_0xbdb4('0x2'));var router=express[_0xbdb4('0x3')]();var fs_extra=require(_0xbdb4('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xbdb4('0x5'));var config=require(_0xbdb4('0x6'));var controller=require(_0xbdb4('0x7'));router[_0xbdb4('0x8')]('/',auth[_0xbdb4('0x9')](),controller[_0xbdb4('0xa')]);router[_0xbdb4('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xbdb4('0xb')]);router[_0xbdb4('0xc')]('/',auth[_0xbdb4('0x9')](),controller[_0xbdb4('0xd')]);router['put'](_0xbdb4('0xe'),auth['isAuthenticated'](),controller[_0xbdb4('0xf')]);router[_0xbdb4('0x10')](_0xbdb4('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0xbdb4('0x11')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 3f10e36..f6cafac 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 _0x7118=['name','STRING'];(function(_0x603961,_0xdc5cdd){var _0x247340=function(_0x3f3ae0){while(--_0x3f3ae0){_0x603961['push'](_0x603961['shift']());}};_0x247340(++_0xdc5cdd);}(_0x7118,0x159));var _0x8711=function(_0x3d2256,_0x3020eb){_0x3d2256=_0x3d2256-0x0;var _0x439082=_0x7118[_0x3d2256];return _0x439082;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8711('0x0')],'unique':_0x8711('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6c42=['exports','name'];(function(_0x225fe2,_0x148d32){var _0x16079b=function(_0x2dd30d){while(--_0x2dd30d){_0x225fe2['push'](_0x225fe2['shift']());}};_0x16079b(++_0x148d32);}(_0x6c42,0xd0));var _0x26c4=function(_0x2678d6,_0x4e2001){_0x2678d6=_0x2678d6-0x0;var _0x475503=_0x6c42[_0x2678d6];return _0x475503;};'use strict';var Sequelize=require('sequelize');module[_0x26c4('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x26c4('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 17ddaea..3abb6f7 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 _0x5abb=['reject','save','then','destroy','get','Variables','UserProfileResource','stack','name','map','Variable','rawAttributes','fieldName','type','keys','intersection','model','attributes','fields','query','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','options','includeAll','include','rows','catch','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','crypto','jsforce','to-csv','../../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','apply'];(function(_0x261e29,_0x10fffd){var _0x25ef43=function(_0x21b8e7){while(--_0x21b8e7){_0x261e29['push'](_0x261e29['shift']());}};_0x25ef43(++_0x10fffd);}(_0x5abb,0x78));var _0xb5ab=function(_0x1feb5d,_0x5b7c06){_0x1feb5d=_0x1feb5d-0x0;var _0x3efb40=_0x5abb[_0x1feb5d];return _0x3efb40;};'use strict';var emlformat=require(_0xb5ab('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb5ab('0x1'));var jsonpatch=require(_0xb5ab('0x2'));var rp=require(_0xb5ab('0x3'));var moment=require(_0xb5ab('0x4'));var BPromise=require(_0xb5ab('0x5'));var Mustache=require(_0xb5ab('0x6'));var util=require(_0xb5ab('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb5ab('0x8'));var fs=require('fs');var fs_extra=require(_0xb5ab('0x9'));var _=require(_0xb5ab('0xa'));var squel=require('squel');var crypto=require(_0xb5ab('0xb'));var jsforce=require(_0xb5ab('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb5ab('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb5ab('0xe'));var as=require(_0xb5ab('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb5ab('0x10'))(_0xb5ab('0x11'));var utils=require(_0xb5ab('0x12'));var config=require(_0xb5ab('0x13'));var licenseUtil=require(_0xb5ab('0x14'));var db=require(_0xb5ab('0x15'))['db'];function respondWithStatusCode(_0x16bdda,_0x4e4a31){_0x4e4a31=_0x4e4a31||0xcc;return function(_0x3fe889){if(_0x3fe889){return _0x16bdda[_0xb5ab('0x16')](_0x4e4a31);}return _0x16bdda[_0xb5ab('0x17')](_0x4e4a31)[_0xb5ab('0x18')]();};}function respondWithResult(_0x4a176d,_0x5e6393){_0x5e6393=_0x5e6393||0xc8;return function(_0x2f9fea){if(_0x2f9fea){return _0x4a176d[_0xb5ab('0x17')](_0x5e6393)[_0xb5ab('0x19')](_0x2f9fea);}};}function respondWithFilteredResult(_0x3dc1d9,_0x5115e5){return function(_0x4d7773){if(_0x4d7773){var _0x4a65af=typeof _0x5115e5[_0xb5ab('0x1a')]===_0xb5ab('0x1b')&&typeof _0x5115e5[_0xb5ab('0x1c')]===_0xb5ab('0x1b');var _0x2e5066=_0x4d7773[_0xb5ab('0x1d')];var _0x327bf0=_0x4a65af?0x0:_0x5115e5['offset'];var _0x4d9be8=_0x4a65af?_0x4d7773[_0xb5ab('0x1d')]:_0x5115e5['offset']+_0x5115e5['limit'];var _0x33ac59;if(_0x4d9be8>=_0x2e5066){_0x4d9be8=_0x2e5066;_0x33ac59=0xc8;}else{_0x33ac59=0xce;}_0x3dc1d9[_0xb5ab('0x17')](_0x33ac59);return _0x3dc1d9[_0xb5ab('0x1e')]('Content-Range',_0x327bf0+'-'+_0x4d9be8+'/'+_0x2e5066)[_0xb5ab('0x19')](_0x4d7773);}return null;};}function patchUpdates(_0x7c7810){return function(_0x2de9ac){try{jsonpatch[_0xb5ab('0x1f')](_0x2de9ac,_0x7c7810,!![]);}catch(_0x5b1253){return BPromise[_0xb5ab('0x20')](_0x5b1253);}return _0x2de9ac[_0xb5ab('0x21')]();};}function saveUpdates(_0x5b4f30,_0x5ca9dd){return function(_0x45c876){if(_0x45c876){return _0x45c876['update'](_0x5b4f30)[_0xb5ab('0x22')](function(_0x4fc2b9){return _0x4fc2b9;});}return null;};}function removeEntity(_0x3c4d0d,_0x16e2c1){return function(_0x3539a1){if(_0x3539a1){return _0x3539a1[_0xb5ab('0x23')]()[_0xb5ab('0x22')](function(){var _0x5aac8e=_0x3539a1[_0xb5ab('0x24')]({'plain':!![]});var _0x277d48=_0xb5ab('0x25');return db[_0xb5ab('0x26')][_0xb5ab('0x23')]({'where':{'type':_0x277d48,'resourceId':_0x5aac8e['id']}})[_0xb5ab('0x22')](function(){return _0x3539a1;});})[_0xb5ab('0x22')](function(){_0x3c4d0d[_0xb5ab('0x17')](0xcc)[_0xb5ab('0x18')]();});}};}function handleEntityNotFound(_0x30fa97,_0x12743d){return function(_0x126f07){if(!_0x126f07){_0x30fa97[_0xb5ab('0x16')](0x194);}return _0x126f07;};}function handleError(_0x3e7386,_0xf59a33){_0xf59a33=_0xf59a33||0x1f4;return function(_0x2f8b59){logger['error'](_0x2f8b59[_0xb5ab('0x27')]);if(_0x2f8b59[_0xb5ab('0x28')]){delete _0x2f8b59[_0xb5ab('0x28')];}_0x3e7386[_0xb5ab('0x17')](_0xf59a33)['send'](_0x2f8b59);};}exports['index']=function(_0x5f3460,_0x48bfc4){var _0x550e8c={},_0x2eb80e={},_0x293cb0={'count':0x0,'rows':[]};var _0x10b855=_[_0xb5ab('0x29')](db[_0xb5ab('0x2a')][_0xb5ab('0x2b')],function(_0x15da5f){return{'name':_0x15da5f[_0xb5ab('0x2c')],'type':_0x15da5f[_0xb5ab('0x2d')]['key']};});_0x2eb80e['model']=_['map'](_0x10b855,_0xb5ab('0x28'));_0x2eb80e['query']=_[_0xb5ab('0x2e')](_0x5f3460['query']);_0x2eb80e['filters']=_[_0xb5ab('0x2f')](_0x2eb80e[_0xb5ab('0x30')],_0x2eb80e['query']);_0x550e8c[_0xb5ab('0x31')]=_['intersection'](_0x2eb80e[_0xb5ab('0x30')],qs[_0xb5ab('0x32')](_0x5f3460[_0xb5ab('0x33')][_0xb5ab('0x32')]));_0x550e8c[_0xb5ab('0x31')]=_0x550e8c[_0xb5ab('0x31')][_0xb5ab('0x34')]?_0x550e8c[_0xb5ab('0x31')]:_0x2eb80e[_0xb5ab('0x30')];if(!_0x5f3460[_0xb5ab('0x33')][_0xb5ab('0x35')](_0xb5ab('0x36'))){_0x550e8c[_0xb5ab('0x1c')]=qs['limit'](_0x5f3460[_0xb5ab('0x33')][_0xb5ab('0x1c')]);_0x550e8c[_0xb5ab('0x1a')]=qs[_0xb5ab('0x1a')](_0x5f3460[_0xb5ab('0x33')][_0xb5ab('0x1a')]);}_0x550e8c['order']=qs[_0xb5ab('0x37')](_0x5f3460['query']['sort']);_0x550e8c[_0xb5ab('0x38')]=qs['filters'](_['pick'](_0x5f3460[_0xb5ab('0x33')],_0x2eb80e[_0xb5ab('0x39')]),_0x10b855);if(_0x5f3460['query'][_0xb5ab('0x3a')]){_0x550e8c[_0xb5ab('0x38')]=_['merge'](_0x550e8c[_0xb5ab('0x38')],{'$or':_['map'](_0x10b855,function(_0x1f960e){if(_0x1f960e[_0xb5ab('0x2d')]!=='VIRTUAL'){var _0x582ed6={};_0x582ed6[_0x1f960e['name']]={'$like':'%'+_0x5f3460[_0xb5ab('0x33')][_0xb5ab('0x3a')]+'%'};return _0x582ed6;}})});}_0x550e8c=_[_0xb5ab('0x3b')]({},_0x550e8c,_0x5f3460[_0xb5ab('0x3c')]);var _0x267877={'where':_0x550e8c['where']};return db[_0xb5ab('0x2a')][_0xb5ab('0x1d')](_0x267877)['then'](function(_0x288990){_0x293cb0[_0xb5ab('0x1d')]=_0x288990;if(_0x5f3460[_0xb5ab('0x33')][_0xb5ab('0x3d')]){_0x550e8c[_0xb5ab('0x3e')]=[{'all':!![]}];}return db[_0xb5ab('0x2a')]['findAll'](_0x550e8c);})['then'](function(_0x4b59d7){_0x293cb0[_0xb5ab('0x3f')]=_0x4b59d7;return _0x293cb0;})['then'](respondWithFilteredResult(_0x48bfc4,_0x550e8c))[_0xb5ab('0x40')](handleError(_0x48bfc4,null));};exports['show']=function(_0x4aefc9,_0x4ca293){var _0x4e69ce={'raw':!![],'where':{'id':_0x4aefc9[_0xb5ab('0x41')]['id']}},_0x5382c0={};_0x5382c0[_0xb5ab('0x30')]=_['keys'](db['Variable']['rawAttributes']);_0x5382c0['query']=_[_0xb5ab('0x2e')](_0x4aefc9[_0xb5ab('0x33')]);_0x5382c0['filters']=_[_0xb5ab('0x2f')](_0x5382c0[_0xb5ab('0x30')],_0x5382c0['query']);_0x4e69ce[_0xb5ab('0x31')]=_[_0xb5ab('0x2f')](_0x5382c0['model'],qs[_0xb5ab('0x32')](_0x4aefc9[_0xb5ab('0x33')][_0xb5ab('0x32')]));_0x4e69ce['attributes']=_0x4e69ce[_0xb5ab('0x31')]['length']?_0x4e69ce[_0xb5ab('0x31')]:_0x5382c0['model'];if(_0x4aefc9[_0xb5ab('0x33')][_0xb5ab('0x3d')]){_0x4e69ce[_0xb5ab('0x3e')]=[{'all':!![]}];}_0x4e69ce=_['merge']({},_0x4e69ce,_0x4aefc9[_0xb5ab('0x3c')]);return db[_0xb5ab('0x2a')][_0xb5ab('0x42')](_0x4e69ce)[_0xb5ab('0x22')](handleEntityNotFound(_0x4ca293,null))[_0xb5ab('0x22')](respondWithResult(_0x4ca293,null))[_0xb5ab('0x40')](handleError(_0x4ca293,null));};exports['create']=function(_0x4b3730,_0x50532e){return db['Variable'][_0xb5ab('0x43')](_0x4b3730['body'],{})['then'](function(_0x1dec8b){var _0x22c8f3=_0x4b3730[_0xb5ab('0x44')][_0xb5ab('0x24')]({'plain':!![]});if(!_0x22c8f3)throw new Error(_0xb5ab('0x45'));if(_0x22c8f3[_0xb5ab('0x46')]==='user'){var _0x6c3d6b=_0x1dec8b[_0xb5ab('0x24')]({'plain':!![]});var _0x5dc5da=_0xb5ab('0x25');return db['UserProfileSection'][_0xb5ab('0x42')]({'where':{'name':_0x5dc5da,'userProfileId':_0x22c8f3[_0xb5ab('0x47')]},'raw':!![]})[_0xb5ab('0x22')](function(_0x2cf297){if(_0x2cf297&&_0x2cf297[_0xb5ab('0x48')]===0x0){return db[_0xb5ab('0x26')][_0xb5ab('0x43')]({'name':_0x6c3d6b['name'],'resourceId':_0x6c3d6b['id'],'type':_0x2cf297['name'],'sectionId':_0x2cf297['id']},{})['then'](function(){return _0x1dec8b;});}else{return _0x1dec8b;}})[_0xb5ab('0x40')](function(_0x58f664){logger[_0xb5ab('0x49')](_0xb5ab('0x4a'),_0x58f664);throw _0x58f664;});}return _0x1dec8b;})[_0xb5ab('0x22')](respondWithResult(_0x50532e,0xc9))['catch'](handleError(_0x50532e,null));};exports['update']=function(_0x330875,_0x27f3a9){if(_0x330875[_0xb5ab('0x4b')]['id']){delete _0x330875[_0xb5ab('0x4b')]['id'];}return db[_0xb5ab('0x2a')][_0xb5ab('0x42')]({'where':{'id':_0x330875['params']['id']}})[_0xb5ab('0x22')](handleEntityNotFound(_0x27f3a9,null))[_0xb5ab('0x22')](saveUpdates(_0x330875['body'],null))[_0xb5ab('0x22')](respondWithResult(_0x27f3a9,null))['catch'](handleError(_0x27f3a9,null));};exports['destroy']=function(_0x4d0f39,_0x227368){return db['Variable'][_0xb5ab('0x42')]({'where':{'id':_0x4d0f39[_0xb5ab('0x41')]['id']}})[_0xb5ab('0x22')](handleEntityNotFound(_0x227368,null))['then'](removeEntity(_0x227368,null))['catch'](handleError(_0x227368,null));}; \ No newline at end of file +var _0xaf8a=['query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','filter','where','map','VIRTUAL','merge','options','include','catch','show','params','length','includeAll','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Variables','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','get','UserProfileResource','error','name','send','index','Variable','rawAttributes','type','key','model','keys'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xaf8a,0x160));var _0xaaf8=function(_0x37644a,_0x2b336a){_0x37644a=_0x37644a-0x0;var _0x523024=_0xaf8a[_0x37644a];return _0x523024;};'use strict';var emlformat=require(_0xaaf8('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xaaf8('0x1'));var rp=require(_0xaaf8('0x2'));var moment=require(_0xaaf8('0x3'));var BPromise=require(_0xaaf8('0x4'));var Mustache=require(_0xaaf8('0x5'));var util=require('util');var path=require('path');var sox=require(_0xaaf8('0x6'));var csv=require('to-csv');var ejs=require(_0xaaf8('0x7'));var fs=require('fs');var fs_extra=require(_0xaaf8('0x8'));var _=require(_0xaaf8('0x9'));var squel=require(_0xaaf8('0xa'));var crypto=require(_0xaaf8('0xb'));var jsforce=require(_0xaaf8('0xc'));var deskjs=require(_0xaaf8('0xd'));var toCsv=require(_0xaaf8('0xe'));var querystring=require(_0xaaf8('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xaaf8('0x10'));var qs=require(_0xaaf8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaaf8('0x12'));var logger=require(_0xaaf8('0x13'))(_0xaaf8('0x14'));var utils=require('../../config/utils');var config=require(_0xaaf8('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d828d,_0x3f37d3){_0x3f37d3=_0x3f37d3||0xcc;return function(_0x1a39d2){if(_0x1a39d2){return _0x3d828d[_0xaaf8('0x16')](_0x3f37d3);}return _0x3d828d[_0xaaf8('0x17')](_0x3f37d3)[_0xaaf8('0x18')]();};}function respondWithResult(_0x212ae7,_0x4a3f7f){_0x4a3f7f=_0x4a3f7f||0xc8;return function(_0x329250){if(_0x329250){return _0x212ae7[_0xaaf8('0x17')](_0x4a3f7f)[_0xaaf8('0x19')](_0x329250);}};}function respondWithFilteredResult(_0x5d5720,_0x167900){return function(_0x136f14){if(_0x136f14){var _0x62d33b=typeof _0x167900[_0xaaf8('0x1a')]===_0xaaf8('0x1b')&&typeof _0x167900[_0xaaf8('0x1c')]===_0xaaf8('0x1b');var _0x184bc8=_0x136f14[_0xaaf8('0x1d')];var _0x40ebf5=_0x62d33b?0x0:_0x167900['offset'];var _0x559a31=_0x62d33b?_0x136f14[_0xaaf8('0x1d')]:_0x167900[_0xaaf8('0x1a')]+_0x167900[_0xaaf8('0x1c')];var _0x3420f1;if(_0x559a31>=_0x184bc8){_0x559a31=_0x184bc8;_0x3420f1=0xc8;}else{_0x3420f1=0xce;}_0x5d5720[_0xaaf8('0x17')](_0x3420f1);return _0x5d5720[_0xaaf8('0x1e')](_0xaaf8('0x1f'),_0x40ebf5+'-'+_0x559a31+'/'+_0x184bc8)['json'](_0x136f14);}return null;};}function patchUpdates(_0x3e9fec){return function(_0xe7c146){try{jsonpatch[_0xaaf8('0x20')](_0xe7c146,_0x3e9fec,!![]);}catch(_0x31f59c){return BPromise['reject'](_0x31f59c);}return _0xe7c146[_0xaaf8('0x21')]();};}function saveUpdates(_0x2f6780,_0xba6d91){return function(_0x48c662){if(_0x48c662){return _0x48c662['update'](_0x2f6780)[_0xaaf8('0x22')](function(_0x5dc78b){return _0x5dc78b;});}return null;};}function removeEntity(_0x1f9be5,_0x4a1925){return function(_0x507334){if(_0x507334){return _0x507334[_0xaaf8('0x23')]()[_0xaaf8('0x22')](function(){var _0x514c9f=_0x507334[_0xaaf8('0x24')]({'plain':!![]});var _0x5720d2='Variables';return db[_0xaaf8('0x25')][_0xaaf8('0x23')]({'where':{'type':_0x5720d2,'resourceId':_0x514c9f['id']}})[_0xaaf8('0x22')](function(){return _0x507334;});})[_0xaaf8('0x22')](function(){_0x1f9be5[_0xaaf8('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a7e3b,_0x4fa60e){return function(_0x485eef){if(!_0x485eef){_0x1a7e3b[_0xaaf8('0x16')](0x194);}return _0x485eef;};}function handleError(_0x5cfddf,_0x24a8df){_0x24a8df=_0x24a8df||0x1f4;return function(_0x238f10){logger[_0xaaf8('0x26')](_0x238f10['stack']);if(_0x238f10[_0xaaf8('0x27')]){delete _0x238f10[_0xaaf8('0x27')];}_0x5cfddf['status'](_0x24a8df)[_0xaaf8('0x28')](_0x238f10);};}exports[_0xaaf8('0x29')]=function(_0x39330c,_0x4691f4){var _0x5399e3={},_0x136c37={},_0x157080={'count':0x0,'rows':[]};var _0x164886=_['map'](db[_0xaaf8('0x2a')][_0xaaf8('0x2b')],function(_0x2e56f3){return{'name':_0x2e56f3['fieldName'],'type':_0x2e56f3[_0xaaf8('0x2c')][_0xaaf8('0x2d')]};});_0x136c37[_0xaaf8('0x2e')]=_['map'](_0x164886,'name');_0x136c37['query']=_[_0xaaf8('0x2f')](_0x39330c[_0xaaf8('0x30')]);_0x136c37[_0xaaf8('0x31')]=_['intersection'](_0x136c37[_0xaaf8('0x2e')],_0x136c37['query']);_0x5399e3[_0xaaf8('0x32')]=_[_0xaaf8('0x33')](_0x136c37['model'],qs['fields'](_0x39330c[_0xaaf8('0x30')][_0xaaf8('0x34')]));_0x5399e3['attributes']=_0x5399e3[_0xaaf8('0x32')]['length']?_0x5399e3[_0xaaf8('0x32')]:_0x136c37[_0xaaf8('0x2e')];if(!_0x39330c[_0xaaf8('0x30')][_0xaaf8('0x35')](_0xaaf8('0x36'))){_0x5399e3[_0xaaf8('0x1c')]=qs['limit'](_0x39330c[_0xaaf8('0x30')][_0xaaf8('0x1c')]);_0x5399e3[_0xaaf8('0x1a')]=qs[_0xaaf8('0x1a')](_0x39330c[_0xaaf8('0x30')]['offset']);}_0x5399e3['order']=qs[_0xaaf8('0x37')](_0x39330c[_0xaaf8('0x30')][_0xaaf8('0x37')]);_0x5399e3['where']=qs['filters'](_['pick'](_0x39330c[_0xaaf8('0x30')],_0x136c37[_0xaaf8('0x31')]),_0x164886);if(_0x39330c[_0xaaf8('0x30')][_0xaaf8('0x38')]){_0x5399e3[_0xaaf8('0x39')]=_['merge'](_0x5399e3['where'],{'$or':_[_0xaaf8('0x3a')](_0x164886,function(_0x3d1a7c){if(_0x3d1a7c[_0xaaf8('0x2c')]!==_0xaaf8('0x3b')){var _0x544c14={};_0x544c14[_0x3d1a7c[_0xaaf8('0x27')]]={'$like':'%'+_0x39330c[_0xaaf8('0x30')][_0xaaf8('0x38')]+'%'};return _0x544c14;}})});}_0x5399e3=_[_0xaaf8('0x3c')]({},_0x5399e3,_0x39330c[_0xaaf8('0x3d')]);var _0xcf3e6d={'where':_0x5399e3['where']};return db[_0xaaf8('0x2a')]['count'](_0xcf3e6d)[_0xaaf8('0x22')](function(_0x2101c5){_0x157080[_0xaaf8('0x1d')]=_0x2101c5;if(_0x39330c[_0xaaf8('0x30')]['includeAll']){_0x5399e3[_0xaaf8('0x3e')]=[{'all':!![]}];}return db['Variable']['findAll'](_0x5399e3);})[_0xaaf8('0x22')](function(_0xfaa19e){_0x157080['rows']=_0xfaa19e;return _0x157080;})[_0xaaf8('0x22')](respondWithFilteredResult(_0x4691f4,_0x5399e3))[_0xaaf8('0x3f')](handleError(_0x4691f4,null));};exports[_0xaaf8('0x40')]=function(_0x2d6591,_0x48b644){var _0x5d2000={'raw':!![],'where':{'id':_0x2d6591[_0xaaf8('0x41')]['id']}},_0x4e2bbc={};_0x4e2bbc[_0xaaf8('0x2e')]=_[_0xaaf8('0x2f')](db[_0xaaf8('0x2a')][_0xaaf8('0x2b')]);_0x4e2bbc[_0xaaf8('0x30')]=_[_0xaaf8('0x2f')](_0x2d6591[_0xaaf8('0x30')]);_0x4e2bbc[_0xaaf8('0x31')]=_[_0xaaf8('0x33')](_0x4e2bbc[_0xaaf8('0x2e')],_0x4e2bbc['query']);_0x5d2000['attributes']=_['intersection'](_0x4e2bbc[_0xaaf8('0x2e')],qs['fields'](_0x2d6591[_0xaaf8('0x30')][_0xaaf8('0x34')]));_0x5d2000['attributes']=_0x5d2000[_0xaaf8('0x32')][_0xaaf8('0x42')]?_0x5d2000['attributes']:_0x4e2bbc['model'];if(_0x2d6591[_0xaaf8('0x30')][_0xaaf8('0x43')]){_0x5d2000[_0xaaf8('0x3e')]=[{'all':!![]}];}_0x5d2000=_[_0xaaf8('0x3c')]({},_0x5d2000,_0x2d6591[_0xaaf8('0x3d')]);return db[_0xaaf8('0x2a')][_0xaaf8('0x44')](_0x5d2000)[_0xaaf8('0x22')](handleEntityNotFound(_0x48b644,null))[_0xaaf8('0x22')](respondWithResult(_0x48b644,null))[_0xaaf8('0x3f')](handleError(_0x48b644,null));};exports[_0xaaf8('0x45')]=function(_0x15a366,_0xfee18e){return db[_0xaaf8('0x2a')]['create'](_0x15a366['body'],{})[_0xaaf8('0x22')](function(_0x32bd10){var _0x26ff15=_0x15a366['user'][_0xaaf8('0x24')]({'plain':!![]});if(!_0x26ff15)throw new Error(_0xaaf8('0x46'));if(_0x26ff15[_0xaaf8('0x47')]===_0xaaf8('0x48')){var _0x5a597d=_0x32bd10[_0xaaf8('0x24')]({'plain':!![]});var _0x284d37=_0xaaf8('0x49');return db[_0xaaf8('0x4a')][_0xaaf8('0x44')]({'where':{'name':_0x284d37,'userProfileId':_0x26ff15[_0xaaf8('0x4b')]},'raw':!![]})[_0xaaf8('0x22')](function(_0x37dbe8){if(_0x37dbe8&&_0x37dbe8[_0xaaf8('0x4c')]===0x0){return db[_0xaaf8('0x25')][_0xaaf8('0x45')]({'name':_0x5a597d[_0xaaf8('0x27')],'resourceId':_0x5a597d['id'],'type':_0x37dbe8[_0xaaf8('0x27')],'sectionId':_0x37dbe8['id']},{})['then'](function(){return _0x32bd10;});}else{return _0x32bd10;}})[_0xaaf8('0x3f')](function(_0x201983){logger[_0xaaf8('0x26')](_0xaaf8('0x4d'),_0x201983);throw _0x201983;});}return _0x32bd10;})['then'](respondWithResult(_0xfee18e,0xc9))[_0xaaf8('0x3f')](handleError(_0xfee18e,null));};exports[_0xaaf8('0x4e')]=function(_0x5ae851,_0x46b896){if(_0x5ae851['body']['id']){delete _0x5ae851['body']['id'];}return db['Variable'][_0xaaf8('0x44')]({'where':{'id':_0x5ae851[_0xaaf8('0x41')]['id']}})[_0xaaf8('0x22')](handleEntityNotFound(_0x46b896,null))[_0xaaf8('0x22')](saveUpdates(_0x5ae851[_0xaaf8('0x4f')],null))[_0xaaf8('0x22')](respondWithResult(_0x46b896,null))[_0xaaf8('0x3f')](handleError(_0x46b896,null));};exports[_0xaaf8('0x23')]=function(_0x359a59,_0x141eaa){return db['Variable']['find']({'where':{'id':_0x359a59[_0xaaf8('0x41')]['id']}})[_0xaaf8('0x22')](handleEntityNotFound(_0x141eaa,null))[_0xaaf8('0x22')](removeEntity(_0x141eaa,null))['catch'](handleError(_0x141eaa,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index a67d34e..787dd62 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 _0x2400=['exports','Variable','lodash','../../config/logger','path'];(function(_0x45cecc,_0x48eba5){var _0x282340=function(_0x273016){while(--_0x273016){_0x45cecc['push'](_0x45cecc['shift']());}};_0x282340(++_0x48eba5);}(_0x2400,0x98));var _0x0240=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x2400[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x0240('0x0'));var util=require('util');var logger=require(_0x0240('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0240('0x2'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./variable.attributes');module[_0x0240('0x3')]=function(_0x31657e,_0x183277){return _0x31657e['define'](_0x0240('0x4'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1d8c=['util','api','moment','bluebird','rimraf','./variable.attributes','define','Variable','tools_variables','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1d8c,0x12b));var _0xc1d8=function(_0x55d0bd,_0x5dc78a){_0x55d0bd=_0x55d0bd-0x0;var _0x2d5d28=_0x1d8c[_0x55d0bd];return _0x2d5d28;};'use strict';var _=require(_0xc1d8('0x0'));var util=require(_0xc1d8('0x1'));var logger=require('../../config/logger')(_0xc1d8('0x2'));var moment=require(_0xc1d8('0x3'));var BPromise=require(_0xc1d8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc1d8('0x5'));var config=require('../../config/environment');var attributes=require(_0xc1d8('0x6'));module['exports']=function(_0x15b22a,_0x454dec){return _0x15b22a[_0xc1d8('0x7')](_0xc1d8('0x8'),attributes,{'tableName':_0xc1d8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 1754b28..9337fd1 100644 --- a/server/api/variable/variable.rpc.js +++ b/server/api/variable/variable.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf494=['where','attributes','include','map','model','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','Variable,\x20%s,\x20%s,\x20%s','error','message','catch','ShowVariable','find','options','raw'];(function(_0x17df16,_0x84c577){var _0x1ba549=function(_0x4a368c){while(--_0x4a368c){_0x17df16['push'](_0x17df16['shift']());}};_0x1ba549(++_0x84c577);}(_0xf494,0x1c6));var _0x4f49=function(_0x3da7b4,_0x5c65ba){_0x3da7b4=_0x3da7b4-0x0;var _0x42bd11=_0xf494[_0x3da7b4];return _0x42bd11;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var moment=require(_0x4f49('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f49('0x3'));var fs=require('fs');var Redis=require(_0x4f49('0x4'));var db=require(_0x4f49('0x5'))['db'];var utils=require(_0x4f49('0x6'));var logger=require(_0x4f49('0x7'))(_0x4f49('0x8'));var config=require(_0x4f49('0x9'));var jayson=require(_0x4f49('0xa'));var client=jayson[_0x4f49('0xb')][_0x4f49('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42b0e8,_0x5eb186,_0x58e9a0){return new BPromise(function(_0x169c95,_0x327bd5){return client[_0x4f49('0xd')](_0x42b0e8,_0x58e9a0)[_0x4f49('0xe')](function(_0x185174){logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,_0x4f49('0x11'));logger['debug'](_0x4f49('0x12'),_0x5eb186,_0x4f49('0x11'),JSON['stringify'](_0x185174));if(_0x185174[_0x4f49('0x13')]){if(_0x185174['error']['code']===0x1f4){logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174['error'][_0x4f49('0x14')]);return _0x327bd5(_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);}logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);return _0x169c95(_0x185174['error'][_0x4f49('0x14')]);}else{logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,'request\x20sent');_0x169c95(_0x185174['result'][_0x4f49('0x14')]);}})[_0x4f49('0x15')](function(_0x74886e){logger['error'](_0x4f49('0x10'),_0x5eb186,_0x74886e);_0x327bd5(_0x74886e);});});}exports[_0x4f49('0x16')]=function(_0x4e85df){var _0x49cdaf=this;return new Promise(function(_0x5bb23b,_0x560592){return db['Variable'][_0x4f49('0x17')]({'raw':_0x4e85df[_0x4f49('0x18')]?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x19')]===undefined?!![]:![]:!![],'where':_0x4e85df['options']?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x1a')]||null:null,'attributes':_0x4e85df[_0x4f49('0x18')]?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x1b')]||null:null,'include':_0x4e85df['options']?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x1c')]?_[_0x4f49('0x1d')](_0x4e85df['options'][_0x4f49('0x1c')],function(_0x1d70a7){return{'model':db[_0x1d70a7[_0x4f49('0x1e')]],'as':_0x1d70a7['as'],'attributes':_0x1d70a7[_0x4f49('0x1b')],'include':_0x1d70a7[_0x4f49('0x1c')]?_[_0x4f49('0x1d')](_0x1d70a7['include'],function(_0x4e9041){return{'model':db[_0x4e9041[_0x4f49('0x1e')]],'as':_0x4e9041['as'],'attributes':_0x4e9041[_0x4f49('0x1b')],'include':_0x4e9041['include']?_[_0x4f49('0x1d')](_0x4e9041[_0x4f49('0x1c')],function(_0x35f8e0){return{'model':db[_0x35f8e0['model']],'as':_0x35f8e0['as'],'attributes':_0x35f8e0[_0x4f49('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4f49('0xe')](function(_0x298785){logger[_0x4f49('0xf')](_0x4f49('0x16'),_0x4e85df);logger[_0x4f49('0x1f')]('ShowVariable',_0x4e85df,JSON['stringify'](_0x298785));_0x5bb23b(_0x298785);})[_0x4f49('0x15')](function(_0x2c00ee){logger[_0x4f49('0x13')]('ShowVariable',_0x2c00ee[_0x4f49('0x14')],_0x4e85df);_0x560592(_0x49cdaf[_0x4f49('0x13')](0x1f4,_0x2c00ee[_0x4f49('0x14')]));});});}; \ No newline at end of file +var _0xf494=['where','attributes','include','map','model','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','Variable,\x20%s,\x20%s,\x20%s','error','message','catch','ShowVariable','find','options','raw'];(function(_0x4fdf4b,_0x937091){var _0x257469=function(_0x21678e){while(--_0x21678e){_0x4fdf4b['push'](_0x4fdf4b['shift']());}};_0x257469(++_0x937091);}(_0xf494,0x1c6));var _0x4f49=function(_0x5d1026,_0x8c8732){_0x5d1026=_0x5d1026-0x0;var _0xe2bef3=_0xf494[_0x5d1026];return _0xe2bef3;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var moment=require(_0x4f49('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f49('0x3'));var fs=require('fs');var Redis=require(_0x4f49('0x4'));var db=require(_0x4f49('0x5'))['db'];var utils=require(_0x4f49('0x6'));var logger=require(_0x4f49('0x7'))(_0x4f49('0x8'));var config=require(_0x4f49('0x9'));var jayson=require(_0x4f49('0xa'));var client=jayson[_0x4f49('0xb')][_0x4f49('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42b0e8,_0x5eb186,_0x58e9a0){return new BPromise(function(_0x169c95,_0x327bd5){return client[_0x4f49('0xd')](_0x42b0e8,_0x58e9a0)[_0x4f49('0xe')](function(_0x185174){logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,_0x4f49('0x11'));logger['debug'](_0x4f49('0x12'),_0x5eb186,_0x4f49('0x11'),JSON['stringify'](_0x185174));if(_0x185174[_0x4f49('0x13')]){if(_0x185174['error']['code']===0x1f4){logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174['error'][_0x4f49('0x14')]);return _0x327bd5(_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);}logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);return _0x169c95(_0x185174['error'][_0x4f49('0x14')]);}else{logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,'request\x20sent');_0x169c95(_0x185174['result'][_0x4f49('0x14')]);}})[_0x4f49('0x15')](function(_0x74886e){logger['error'](_0x4f49('0x10'),_0x5eb186,_0x74886e);_0x327bd5(_0x74886e);});});}exports[_0x4f49('0x16')]=function(_0x4e85df){var _0x49cdaf=this;return new Promise(function(_0x5bb23b,_0x560592){return db['Variable'][_0x4f49('0x17')]({'raw':_0x4e85df[_0x4f49('0x18')]?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x19')]===undefined?!![]:![]:!![],'where':_0x4e85df['options']?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x1a')]||null:null,'attributes':_0x4e85df[_0x4f49('0x18')]?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x1b')]||null:null,'include':_0x4e85df['options']?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x1c')]?_[_0x4f49('0x1d')](_0x4e85df['options'][_0x4f49('0x1c')],function(_0x1d70a7){return{'model':db[_0x1d70a7[_0x4f49('0x1e')]],'as':_0x1d70a7['as'],'attributes':_0x1d70a7[_0x4f49('0x1b')],'include':_0x1d70a7[_0x4f49('0x1c')]?_[_0x4f49('0x1d')](_0x1d70a7['include'],function(_0x4e9041){return{'model':db[_0x4e9041[_0x4f49('0x1e')]],'as':_0x4e9041['as'],'attributes':_0x4e9041[_0x4f49('0x1b')],'include':_0x4e9041['include']?_[_0x4f49('0x1d')](_0x4e9041[_0x4f49('0x1c')],function(_0x35f8e0){return{'model':db[_0x35f8e0['model']],'as':_0x35f8e0['as'],'attributes':_0x35f8e0[_0x4f49('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4f49('0xe')](function(_0x298785){logger[_0x4f49('0xf')](_0x4f49('0x16'),_0x4e85df);logger[_0x4f49('0x1f')]('ShowVariable',_0x4e85df,JSON['stringify'](_0x298785));_0x5bb23b(_0x298785);})[_0x4f49('0x15')](function(_0x2c00ee){logger[_0x4f49('0x13')]('ShowVariable',_0x2c00ee[_0x4f49('0x14')],_0x4e85df);_0x560592(_0x49cdaf[_0x4f49('0x13')](0x1f4,_0x2c00ee[_0x4f49('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 7950563..bfd4cba 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 _0x1ae0=['get','index','/fetch','isAuthenticated','fetch','/reset','canUpdate','reset','/pull','pull','/restart','restart','/migrations','migrations','exports','express','../../components/auth/service','./version.controller'];(function(_0x403d1f,_0x109e26){var _0xaedd13=function(_0x17878b){while(--_0x17878b){_0x403d1f['push'](_0x403d1f['shift']());}};_0xaedd13(++_0x109e26);}(_0x1ae0,0x189));var _0x01ae=function(_0x505db0,_0x5454d5){_0x505db0=_0x505db0-0x0;var _0x5e65a8=_0x1ae0[_0x505db0];return _0x5e65a8;};'use strict';var express=require(_0x01ae('0x0'));var router=express['Router']();var auth=require(_0x01ae('0x1'));var controller=require(_0x01ae('0x2'));router[_0x01ae('0x3')]('/',controller[_0x01ae('0x4')]);router['get'](_0x01ae('0x5'),auth[_0x01ae('0x6')](),auth['canUpdate'](),controller[_0x01ae('0x7')]);router[_0x01ae('0x3')](_0x01ae('0x8'),auth['isAuthenticated'](),auth[_0x01ae('0x9')](),controller[_0x01ae('0xa')]);router[_0x01ae('0x3')](_0x01ae('0xb'),auth['isAuthenticated'](),auth[_0x01ae('0x9')](),controller[_0x01ae('0xc')]);router[_0x01ae('0x3')](_0x01ae('0xd'),auth[_0x01ae('0x6')](),controller[_0x01ae('0xe')]);router[_0x01ae('0x3')](_0x01ae('0xf'),controller[_0x01ae('0x10')]);module[_0x01ae('0x11')]=router; \ No newline at end of file +var _0xe83d=['get','isAuthenticated','fetch','/reset','canUpdate','reset','restart','/migrations','migrations','express','Router','../../components/auth/service','./version.controller'];(function(_0x15313d,_0x8dfc7){var _0x5dd736=function(_0x50a0a0){while(--_0x50a0a0){_0x15313d['push'](_0x15313d['shift']());}};_0x5dd736(++_0x8dfc7);}(_0xe83d,0x168));var _0xde83=function(_0x4b4aa4,_0x43d1e2){_0x4b4aa4=_0x4b4aa4-0x0;var _0x3c6a71=_0xe83d[_0x4b4aa4];return _0x3c6a71;};'use strict';var express=require(_0xde83('0x0'));var router=express[_0xde83('0x1')]();var auth=require(_0xde83('0x2'));var controller=require(_0xde83('0x3'));router[_0xde83('0x4')]('/',controller['index']);router[_0xde83('0x4')]('/fetch',auth[_0xde83('0x5')](),auth['canUpdate'](),controller[_0xde83('0x6')]);router[_0xde83('0x4')](_0xde83('0x7'),auth[_0xde83('0x5')](),auth[_0xde83('0x8')](),controller[_0xde83('0x9')]);router[_0xde83('0x4')]('/pull',auth[_0xde83('0x5')](),auth[_0xde83('0x8')](),controller['pull']);router[_0xde83('0x4')]('/restart',auth[_0xde83('0x5')](),controller[_0xde83('0xa')]);router[_0xde83('0x4')](_0xde83('0xb'),controller[_0xde83('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 1f6ebef..b3dd0f1 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 _0xe663=['json','origin','git\x20fetch','reset','--hard','FETCH_HEAD','error','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','info','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','length','replace','push','sort','Migration','getQueryInterface','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','.js','Database\x20migrated\x20successfully\x20from\x20version\x20','last','UniqueConstraintError','umzug','lodash','pkginfo','version','compare-versions','exec','../../mysqldb','../../config/environment','update','simple-git','exports','query','latest','fetch','tags','2.0.0','status'];(function(_0x46fa6f,_0x40bf69){var _0x3f54c7=function(_0x461ceb){while(--_0x461ceb){_0x46fa6f['push'](_0x46fa6f['shift']());}};_0x3f54c7(++_0x40bf69);}(_0xe663,0x1ba));var _0x3e66=function(_0x45b239,_0x503fa7){_0x45b239=_0x45b239-0x0;var _0x446240=_0xe663[_0x45b239];return _0x446240;};'use strict';var Umzug=require(_0x3e66('0x0'));var path=require('path');var fs=require('fs');var _=require(_0x3e66('0x1'));var pkginfo=require(_0x3e66('0x2'))(module,_0x3e66('0x3'));var compareVersions=require(_0x3e66('0x4'));var exec=require('child_process')[_0x3e66('0x5')];var db=require(_0x3e66('0x6'))['db'];var config=require(_0x3e66('0x7'));var pm2=require('../../config/pm2');var logger=require('../../config/logger')(_0x3e66('0x8'));var git=require(_0x3e66('0x9'))(config['root']);exports['index']=function(_0x289324,_0x4a0c11){var _0x4466f4={'current':module[_0x3e66('0xa')][_0x3e66('0x3')],'phonebar':0x2};if(_0x289324[_0x3e66('0xb')]&&_0x289324['query'][_0x3e66('0xc')]){return git[_0x3e66('0xd')]()[_0x3e66('0xe')](function(_0x20164b,_0x43fc19){_0x4466f4['latest']=(_0x20164b?module[_0x3e66('0xa')][_0x3e66('0x3')]:_0x43fc19['latest'])||_0x3e66('0xf');return _0x4a0c11[_0x3e66('0x10')](0xc8)[_0x3e66('0x11')](_0x4466f4);});}else{return _0x4a0c11['status'](0xc8)[_0x3e66('0x11')](_0x4466f4);}};exports[_0x3e66('0xd')]=function(_0x4efd4e,_0x5b007e){return git['fetch']([_0x3e66('0x12'),'master'],function(_0x36a385){if(_0x36a385){logger['error'](_0x36a385);return _0x5b007e[_0x3e66('0x10')](0x1f4)[_0x3e66('0x11')](_0x36a385);}logger['info'](_0x3e66('0x13'));return _0x5b007e['status'](0xc8)['json']({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x3e66('0x14')]=function(_0x552589,_0x549992){return git[_0x3e66('0x14')]([_0x3e66('0x15'),_0x3e66('0x16')],function(_0x5e475b){if(_0x5e475b){logger[_0x3e66('0x17')](_0x5e475b);return _0x549992[_0x3e66('0x10')](0x1f4)[_0x3e66('0x11')](_0x5e475b);}logger['info'](_0x3e66('0x18'));return _0x549992[_0x3e66('0x10')](0xc8)[_0x3e66('0x11')]({'output':_0x3e66('0x19')});});};exports[_0x3e66('0x1a')]=function(_0x513589,_0x18cbf){exec(_0x3e66('0x1b'),function(_0x1d01cb,_0x49fc72,_0x3de71d){logger['info'](_0x49fc72);logger['info'](_0x3de71d);if(_0x1d01cb){logger[_0x3e66('0x17')](_0x1d01cb);return _0x18cbf[_0x3e66('0x10')](0x1f4)[_0x3e66('0x11')](_0x1d01cb);}return _0x18cbf[_0x3e66('0x10')](0xc8)[_0x3e66('0x11')]({'output':_0x49fc72});});};exports[_0x3e66('0x1c')]=function(_0x160231,_0x35e9eb){return pm2[_0x3e66('0x1c')](_0x3e66('0x1d'))[_0x3e66('0x1e')](function(_0x56610b){logger[_0x3e66('0x1f')](_0x3e66('0x20'),_0x56610b);return _0x35e9eb[_0x3e66('0x10')](0xc8)[_0x3e66('0x11')]({'output':_0x3e66('0x21')});})[_0x3e66('0x22')](function(_0x58f15c){logger[_0x3e66('0x17')](_0x58f15c);return _0x35e9eb[_0x3e66('0x10')](0x1f4)[_0x3e66('0x11')](_0x58f15c);});};exports[_0x3e66('0x23')]=function(_0x230d72,_0x53dedd){var _0x26dbf2=fs[_0x3e66('0x24')](path[_0x3e66('0x25')](config['root'],_0x3e66('0x26'),'migrations'));var _0x27c31b=[];for(var _0x4e19c8=0x0;_0x4e19c8<_0x26dbf2[_0x3e66('0x27')];_0x4e19c8++){var _0x3cd124=_0x26dbf2[_0x4e19c8][_0x3e66('0x28')]('.js','');if(compareVersions(module[_0x3e66('0xa')][_0x3e66('0x3')],_0x3cd124)===-0x1){_0x27c31b[_0x3e66('0x29')](_0x3cd124);}}if(_0x27c31b[_0x3e66('0x27')]){var _0x1d4ddd=_0x27c31b[_0x3e66('0x2a')](compareVersions);var _0x1a4999=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0x3e66('0x2b')],'modelName':_0x3e66('0x2b'),'columnName':_0x3e66('0x3')},'migrations':{'params':[db['sequelize'][_0x3e66('0x2c')](),db['sequelize']['constructor'],function(){throw new Error(_0x3e66('0x2d'));}],'path':path[_0x3e66('0x25')](config['root'],_0x3e66('0x26'),'migrations'),'pattern':/\.js$/}});_0x1a4999['up']({'migrations':_[_0x3e66('0x2e')](_0x1d4ddd,function(_0x45775b){return _0x45775b+_0x3e66('0x2f');})})[_0x3e66('0x1e')](function(){return _0x53dedd[_0x3e66('0x10')](0xc8)['json']({'output':_0x3e66('0x30')+module[_0x3e66('0xa')]['version']+'\x20to\x20'+_[_0x3e66('0x31')](_0x1d4ddd),'migrations':_[_0x3e66('0x25')](_0x1d4ddd)});})[_0x3e66('0x22')](function(_0x2dbd2b){if(_0x2dbd2b instanceof db['sequelize'][_0x3e66('0x32')]){return _0x53dedd[_0x3e66('0x10')](0xc8)[_0x3e66('0x11')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x53dedd[_0x3e66('0x10')](0x1f4)[_0x3e66('0x11')](_0x2dbd2b);}});}else{return _0x53dedd[_0x3e66('0x10')](0xc8)[_0x3e66('0x11')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file +var _0x82dd=['npm\x20install\x20--production','restart','then','pm2\x20restart\x20motion\x20%s','catch','migrations','root','server','replace','length','sort','sequelize','Migration','getQueryInterface','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','map','.js','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','exec','../../mysqldb','../../config/environment','update','simple-git','query','latest','tags','exports','2.0.0','status','origin','error','json','info','git\x20fetch\x20origin\x20master','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull'];(function(_0x38073a,_0x22b89e){var _0x36784c=function(_0x323803){while(--_0x323803){_0x38073a['push'](_0x38073a['shift']());}};_0x36784c(++_0x22b89e);}(_0x82dd,0x1c6));var _0xd82d=function(_0x4804d7,_0x56ef10){_0x4804d7=_0x4804d7-0x0;var _0x532259=_0x82dd[_0x4804d7];return _0x532259;};'use strict';var Umzug=require(_0xd82d('0x0'));var path=require(_0xd82d('0x1'));var fs=require('fs');var _=require(_0xd82d('0x2'));var pkginfo=require(_0xd82d('0x3'))(module,_0xd82d('0x4'));var compareVersions=require('compare-versions');var exec=require('child_process')[_0xd82d('0x5')];var db=require(_0xd82d('0x6'))['db'];var config=require(_0xd82d('0x7'));var pm2=require('../../config/pm2');var logger=require('../../config/logger')(_0xd82d('0x8'));var git=require(_0xd82d('0x9'))(config['root']);exports['index']=function(_0x4ed46b,_0x292c2e){var _0x1b640d={'current':module['exports']['version'],'phonebar':0x2};if(_0x4ed46b[_0xd82d('0xa')]&&_0x4ed46b[_0xd82d('0xa')][_0xd82d('0xb')]){return git['fetch']()[_0xd82d('0xc')](function(_0x1c76b2,_0x1bd6ee){_0x1b640d[_0xd82d('0xb')]=(_0x1c76b2?module[_0xd82d('0xd')][_0xd82d('0x4')]:_0x1bd6ee[_0xd82d('0xb')])||_0xd82d('0xe');return _0x292c2e[_0xd82d('0xf')](0xc8)['json'](_0x1b640d);});}else{return _0x292c2e[_0xd82d('0xf')](0xc8)['json'](_0x1b640d);}};exports['fetch']=function(_0x553ec8,_0x4f13bb){return git['fetch']([_0xd82d('0x10'),'master'],function(_0x2c9387){if(_0x2c9387){logger[_0xd82d('0x11')](_0x2c9387);return _0x4f13bb[_0xd82d('0xf')](0x1f4)[_0xd82d('0x12')](_0x2c9387);}logger[_0xd82d('0x13')]('git\x20fetch');return _0x4f13bb['status'](0xc8)[_0xd82d('0x12')]({'output':_0xd82d('0x14')});});};exports['reset']=function(_0x334262,_0x5f0b4e){return git[_0xd82d('0x15')]([_0xd82d('0x16'),'FETCH_HEAD'],function(_0x56d012){if(_0x56d012){logger['error'](_0x56d012);return _0x5f0b4e[_0xd82d('0xf')](0x1f4)[_0xd82d('0x12')](_0x56d012);}logger[_0xd82d('0x13')](_0xd82d('0x17'));return _0x5f0b4e['status'](0xc8)[_0xd82d('0x12')]({'output':_0xd82d('0x18')});});};exports[_0xd82d('0x19')]=function(_0x35869f,_0x3da773){exec(_0xd82d('0x1a'),function(_0x5a5603,_0x3bec41,_0x35dff6){logger[_0xd82d('0x13')](_0x3bec41);logger[_0xd82d('0x13')](_0x35dff6);if(_0x5a5603){logger[_0xd82d('0x11')](_0x5a5603);return _0x3da773[_0xd82d('0xf')](0x1f4)['json'](_0x5a5603);}return _0x3da773[_0xd82d('0xf')](0xc8)[_0xd82d('0x12')]({'output':_0x3bec41});});};exports[_0xd82d('0x1b')]=function(_0x16b41f,_0x2ecc15){return pm2[_0xd82d('0x1b')]('motion2')[_0xd82d('0x1c')](function(_0x431b68){logger[_0xd82d('0x13')](_0xd82d('0x1d'),_0x431b68);return _0x2ecc15[_0xd82d('0xf')](0xc8)['json']({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0xd82d('0x1e')](function(_0x2de12d){logger[_0xd82d('0x11')](_0x2de12d);return _0x2ecc15['status'](0x1f4)['json'](_0x2de12d);});};exports[_0xd82d('0x1f')]=function(_0x1a3959,_0xef8fb7){var _0x6df423=fs['readdirSync'](path['join'](config[_0xd82d('0x20')],_0xd82d('0x21'),_0xd82d('0x1f')));var _0x2625af=[];for(var _0x49a141=0x0;_0x49a141<_0x6df423['length'];_0x49a141++){var _0x198525=_0x6df423[_0x49a141][_0xd82d('0x22')]('.js','');if(compareVersions(module[_0xd82d('0xd')][_0xd82d('0x4')],_0x198525)===-0x1){_0x2625af['push'](_0x198525);}}if(_0x2625af[_0xd82d('0x23')]){var _0x51c461=_0x2625af[_0xd82d('0x24')](compareVersions);var _0x4f0fa7=new Umzug({'storage':_0xd82d('0x25'),'storageOptions':{'model':db[_0xd82d('0x26')],'modelName':_0xd82d('0x26'),'columnName':'version'},'migrations':{'params':[db[_0xd82d('0x25')][_0xd82d('0x27')](),db[_0xd82d('0x25')]['constructor'],function(){throw new Error(_0xd82d('0x28'));}],'path':path[_0xd82d('0x29')](config[_0xd82d('0x20')],_0xd82d('0x21'),_0xd82d('0x1f')),'pattern':/\.js$/}});_0x4f0fa7['up']({'migrations':_[_0xd82d('0x2a')](_0x51c461,function(_0x2c716a){return _0x2c716a+_0xd82d('0x2b');})})['then'](function(){return _0xef8fb7[_0xd82d('0xf')](0xc8)[_0xd82d('0x12')]({'output':_0xd82d('0x2c')+module[_0xd82d('0xd')][_0xd82d('0x4')]+_0xd82d('0x2d')+_['last'](_0x51c461),'migrations':_[_0xd82d('0x29')](_0x51c461)});})['catch'](function(_0x3592cd){if(_0x3592cd instanceof db[_0xd82d('0x25')][_0xd82d('0x2e')]){return _0xef8fb7['status'](0xc8)[_0xd82d('0x12')]({'output':_0xd82d('0x2f')});}else{return _0xef8fb7[_0xd82d('0xf')](0x1f4)[_0xd82d('0x12')](_0x3592cd);}});}else{return _0xef8fb7[_0xd82d('0xf')](0xc8)['json']({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 81da43e..4bac9e0 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 _0x842f=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','put','update','destroy','exports'];(function(_0x12432c,_0x4113e5){var _0x35de25=function(_0x440da6){while(--_0x440da6){_0x12432c['push'](_0x12432c['shift']());}};_0x35de25(++_0x4113e5);}(_0x842f,0xf2));var _0xf842=function(_0x185f01,_0x3930e3){_0x185f01=_0x185f01-0x0;var _0x330844=_0x842f[_0x185f01];return _0x330844;};'use strict';var multer=require(_0xf842('0x0'));var util=require(_0xf842('0x1'));var path=require(_0xf842('0x2'));var timeout=require(_0xf842('0x3'));var express=require(_0xf842('0x4'));var router=express[_0xf842('0x5')]();var fs_extra=require(_0xf842('0x6'));var auth=require(_0xf842('0x7'));var interaction=require(_0xf842('0x8'));var config=require(_0xf842('0x9'));var controller=require(_0xf842('0xa'));router[_0xf842('0xb')]('/',auth[_0xf842('0xc')](),controller['index']);router[_0xf842('0xb')](_0xf842('0xd'),auth['isAuthenticated'](),controller[_0xf842('0xe')]);router[_0xf842('0xb')](_0xf842('0xf'),auth[_0xf842('0xc')](),controller[_0xf842('0x10')]);router[_0xf842('0x11')]('/',auth[_0xf842('0xc')](),controller['create']);router[_0xf842('0x12')](_0xf842('0xf'),auth[_0xf842('0xc')](),controller[_0xf842('0x13')]);router['delete'](_0xf842('0xf'),auth[_0xf842('0xc')](),controller[_0xf842('0x14')]);module[_0xf842('0x15')]=router; \ No newline at end of file +var _0x84fd=['/describe','describe','/:id','show','post','put','update','delete','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index'];(function(_0x155ff1,_0x554d55){var _0x13912d=function(_0x3b0838){while(--_0x3b0838){_0x155ff1['push'](_0x155ff1['shift']());}};_0x13912d(++_0x554d55);}(_0x84fd,0x170));var _0xd84f=function(_0x5a3c94,_0x3e1834){_0x5a3c94=_0x5a3c94-0x0;var _0x3fbec3=_0x84fd[_0x5a3c94];return _0x3fbec3;};'use strict';var multer=require(_0xd84f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd84f('0x1'));var express=require(_0xd84f('0x2'));var router=express[_0xd84f('0x3')]();var fs_extra=require(_0xd84f('0x4'));var auth=require(_0xd84f('0x5'));var interaction=require(_0xd84f('0x6'));var config=require(_0xd84f('0x7'));var controller=require(_0xd84f('0x8'));router[_0xd84f('0x9')]('/',auth[_0xd84f('0xa')](),controller[_0xd84f('0xb')]);router[_0xd84f('0x9')](_0xd84f('0xc'),auth['isAuthenticated'](),controller[_0xd84f('0xd')]);router[_0xd84f('0x9')](_0xd84f('0xe'),auth[_0xd84f('0xa')](),controller[_0xd84f('0xf')]);router[_0xd84f('0x10')]('/',auth[_0xd84f('0xa')](),controller['create']);router[_0xd84f('0x11')](_0xd84f('0xe'),auth[_0xd84f('0xa')](),controller[_0xd84f('0x12')]);router[_0xd84f('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index d55a99e..b5e266c 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 _0x536f=['DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING'];(function(_0x1b2bb9,_0x30b17b){var _0x479c15=function(_0x2132e5){while(--_0x2132e5){_0x1b2bb9['push'](_0x1b2bb9['shift']());}};_0x479c15(++_0x30b17b);}(_0x536f,0x70));var _0xf536=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x536f[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xf536('0x0'));module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xf536('0x1')]},'queue':{'type':Sequelize[_0xf536('0x1')]},'interface':{'type':Sequelize[_0xf536('0x1')]},'membername':{'type':Sequelize[_0xf536('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xf536('0x2')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0xf536('0x2')]},'agentdumpAt':{'type':Sequelize[_0xf536('0x2')]},'holdtime':{'type':Sequelize[_0xf536('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xf536('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xf536('0x3')]},'agentacw':{'type':Sequelize[_0xf536('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xf536('0x3')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xf536('0x1')]},'channelstate':{'type':Sequelize[_0xf536('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xf536('0x1')]},'language':{'type':Sequelize[_0xf536('0x1')]},'accountcode':{'type':Sequelize[_0xf536('0x1')]},'context':{'type':Sequelize[_0xf536('0x1')]},'exten':{'type':Sequelize[_0xf536('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xf536('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xf536('0x1')]},'destcalleridnum':{'type':Sequelize[_0xf536('0x1')]},'destcalleridname':{'type':Sequelize[_0xf536('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xf536('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xf536('0x1')]},'destlanguage':{'type':Sequelize[_0xf536('0x1')]},'destaccountcode':{'type':Sequelize[_0xf536('0x1')]},'destcontext':{'type':Sequelize[_0xf536('0x1')]},'destexten':{'type':Sequelize[_0xf536('0x1')]},'destpriority':{'type':Sequelize[_0xf536('0x1')]},'destuniqueid':{'type':Sequelize[_0xf536('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xf536('0x1')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xf536('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xf536('0x5')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0xf536('0x1')]},'agententerreason':{'type':Sequelize[_0xf536('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbcff=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','BOOLEAN','INTEGER'];(function(_0x307060,_0x26dc3d){var _0x3a2587=function(_0x283dde){while(--_0x283dde){_0x307060['push'](_0x307060['shift']());}};_0x3a2587(++_0x26dc3d);}(_0xbcff,0x12e));var _0xfbcf=function(_0x3962f2,_0x5a7154){_0x3962f2=_0x3962f2-0x0;var _0x4d7dab=_0xbcff[_0x3962f2];return _0x4d7dab;};'use strict';var Sequelize=require(_0xfbcf('0x0'));module[_0xfbcf('0x1')]={'type':{'type':Sequelize[_0xfbcf('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xfbcf('0x2')]},'calleridname':{'type':Sequelize[_0xfbcf('0x2')]},'queue':{'type':Sequelize[_0xfbcf('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xfbcf('0x2')]},'agentcalledAt':{'type':Sequelize[_0xfbcf('0x3')]},'agentconnectAt':{'type':Sequelize[_0xfbcf('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0xfbcf('0x3')]},'agentdumpAt':{'type':Sequelize[_0xfbcf('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xfbcf('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xfbcf('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0xfbcf('0x5')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xfbcf('0x5')]},'reason':{'type':Sequelize[_0xfbcf('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xfbcf('0x5')]},'channelstatedesc':{'type':Sequelize[_0xfbcf('0x2')]},'connectedlinenum':{'type':Sequelize[_0xfbcf('0x2')]},'connectedlinename':{'type':Sequelize[_0xfbcf('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xfbcf('0x2')]},'context':{'type':Sequelize[_0xfbcf('0x2')]},'exten':{'type':Sequelize[_0xfbcf('0x2')]},'priority':{'type':Sequelize[_0xfbcf('0x2')]},'destchannel':{'type':Sequelize[_0xfbcf('0x2')]},'destchannelstate':{'type':Sequelize[_0xfbcf('0x5')]},'destchannelstatedesc':{'type':Sequelize[_0xfbcf('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xfbcf('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xfbcf('0x2')]},'destlanguage':{'type':Sequelize[_0xfbcf('0x2')]},'destaccountcode':{'type':Sequelize[_0xfbcf('0x2')]},'destcontext':{'type':Sequelize[_0xfbcf('0x2')]},'destexten':{'type':Sequelize[_0xfbcf('0x2')]},'destpriority':{'type':Sequelize[_0xfbcf('0x2')]},'destuniqueid':{'type':Sequelize[_0xfbcf('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xfbcf('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xfbcf('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xfbcf('0x2')],'comment':_0xfbcf('0x6')},'transferexten':{'type':Sequelize[_0xfbcf('0x2')]},'transferuniqueid':{'type':Sequelize[_0xfbcf('0x2')]},'agententerreason':{'type':Sequelize[_0xfbcf('0x5')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 07871f2..062b569 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(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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(_0x19b3f9,_0xade753){var _0x18c3f6=function(_0x21439f){while(--_0x21439f){_0x19b3f9['push'](_0x19b3f9['shift']());}};_0x18c3f6(++_0xade753);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index 82d4e01..7de88ff 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 _0x5a5a=['moment','bluebird','path','rimraf','../../config/environment','VoiceAgentReport','report_agent','uniqueid','destuniqueid','util','../../config/logger','api'];(function(_0x102ac0,_0x142f22){var _0x322b9e=function(_0x45c5a1){while(--_0x45c5a1){_0x102ac0['push'](_0x102ac0['shift']());}};_0x322b9e(++_0x142f22);}(_0x5a5a,0x1d1));var _0xa5a5=function(_0x305c93,_0x3421dc){_0x305c93=_0x305c93-0x0;var _0x5bae39=_0x5a5a[_0x305c93];return _0x5bae39;};'use strict';var _=require('lodash');var util=require(_0xa5a5('0x0'));var logger=require(_0xa5a5('0x1'))(_0xa5a5('0x2'));var moment=require(_0xa5a5('0x3'));var BPromise=require(_0xa5a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa5a5('0x5'));var rimraf=require(_0xa5a5('0x6'));var config=require(_0xa5a5('0x7'));var attributes=require('./voiceAgentReport.attributes');module['exports']=function(_0x43943d,_0x1fe96d){return _0x43943d['define'](_0xa5a5('0x8'),attributes,{'tableName':_0xa5a5('0x9'),'paranoid':![],'indexes':[{'fields':[_0xa5a5('0xa'),_0xa5a5('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x64f5=['path','../../config/environment','./voiceAgentReport.attributes','exports','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','moment','request-promise'];(function(_0x35b2a1,_0x4cdca8){var _0x6023da=function(_0x10cd9f){while(--_0x10cd9f){_0x35b2a1['push'](_0x35b2a1['shift']());}};_0x6023da(++_0x4cdca8);}(_0x64f5,0x17e));var _0x564f=function(_0x1986b4,_0x4cc601){_0x1986b4=_0x1986b4-0x0;var _0x2f7d5d=_0x64f5[_0x1986b4];return _0x2f7d5d;};'use strict';var _=require(_0x564f('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x564f('0x1'));var BPromise=require('bluebird');var rp=require(_0x564f('0x2'));var fs=require('fs');var path=require(_0x564f('0x3'));var rimraf=require('rimraf');var config=require(_0x564f('0x4'));var attributes=require(_0x564f('0x5'));module[_0x564f('0x6')]=function(_0x72b009,_0x4bbedf){return _0x72b009['define'](_0x564f('0x7'),attributes,{'tableName':_0x564f('0x8'),'paranoid':![],'indexes':[{'fields':[_0x564f('0x9'),_0x564f('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 80721be..2f06272 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 _0xb19a=['moment','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','VoiceAgentReport,\x20%s,\x20%s','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','stringify','UpdateVoiceAgentReport','update','attributes','then','lodash'];(function(_0x39fb6a,_0x8b07ae){var _0x1452a1=function(_0x391804){while(--_0x391804){_0x39fb6a['push'](_0x39fb6a['shift']());}};_0x1452a1(++_0x8b07ae);}(_0xb19a,0x173));var _0xab19=function(_0x2e7b9b,_0x1351b8){_0x2e7b9b=_0x2e7b9b-0x0;var _0x180aab=_0xb19a[_0x2e7b9b];return _0x180aab;};'use strict';var _=require(_0xab19('0x0'));var util=require('util');var moment=require(_0xab19('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xab19('0x2'));var db=require(_0xab19('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xab19('0x4'));var config=require(_0xab19('0x5'));var jayson=require(_0xab19('0x6'));var client=jayson[_0xab19('0x7')][_0xab19('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1c4ec3,_0x3a59b8,_0x5507f9){return new BPromise(function(_0x8cbd8b,_0x5b2624){return client[_0xab19('0x9')](_0x1c4ec3,_0x5507f9)['then'](function(_0xd7b329){logger[_0xab19('0xa')]('VoiceAgentReport,\x20%s,\x20%s',_0x3a59b8,_0xab19('0xb'));logger[_0xab19('0xc')](_0xab19('0xd'),_0x3a59b8,_0xab19('0xb'),JSON['stringify'](_0xd7b329));if(_0xd7b329[_0xab19('0xe')]){if(_0xd7b329[_0xab19('0xe')][_0xab19('0xf')]===0x1f4){logger['error'](_0xab19('0x10'),_0x3a59b8,_0xd7b329[_0xab19('0xe')]['message']);return _0x5b2624(_0xd7b329[_0xab19('0xe')][_0xab19('0x11')]);}logger[_0xab19('0xe')](_0xab19('0x10'),_0x3a59b8,_0xd7b329[_0xab19('0xe')]['message']);return _0x8cbd8b(_0xd7b329[_0xab19('0xe')]['message']);}else{logger[_0xab19('0xa')](_0xab19('0x10'),_0x3a59b8,_0xab19('0xb'));_0x8cbd8b(_0xd7b329[_0xab19('0x12')]['message']);}})[_0xab19('0x13')](function(_0x4799f7){logger[_0xab19('0xe')]('VoiceAgentReport,\x20%s,\x20%s',_0x3a59b8,_0x4799f7);_0x5b2624(_0x4799f7);});});}exports[_0xab19('0x14')]=function(_0x40b584){var _0x2ac4c1=this;return new Promise(function(_0x16c2ec,_0x113d0d){return db[_0xab19('0x15')][_0xab19('0x16')](_0x40b584[_0xab19('0x17')],{'raw':_0x40b584[_0xab19('0x18')]?_0x40b584[_0xab19('0x18')][_0xab19('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1864ca){logger[_0xab19('0xa')](_0xab19('0x14'),_0x40b584);logger[_0xab19('0xc')](_0xab19('0x14'),_0x40b584,JSON[_0xab19('0x1a')](_0x1864ca));_0x16c2ec(_0x1864ca);})[_0xab19('0x13')](function(_0x29b30e){logger['error'](_0xab19('0x14'),_0x29b30e[_0xab19('0x11')],_0x40b584);_0x113d0d(_0x2ac4c1[_0xab19('0xe')](0x1f4,_0x29b30e[_0xab19('0x11')]));});});};exports[_0xab19('0x1b')]=function(_0x16b0dc){var _0x1f4855=this;return new Promise(function(_0x1359bd,_0x24f56d){return db[_0xab19('0x15')][_0xab19('0x1c')](_0x16b0dc['body'],{'raw':_0x16b0dc[_0xab19('0x18')]?_0x16b0dc[_0xab19('0x18')][_0xab19('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x16b0dc[_0xab19('0x18')]?_0x16b0dc[_0xab19('0x18')]['where']||null:null,'attributes':_0x16b0dc['options']?_0x16b0dc[_0xab19('0x18')][_0xab19('0x1d')]||null:null,'limit':_0x16b0dc[_0xab19('0x18')]?_0x16b0dc[_0xab19('0x18')]['limit']||null:null})[_0xab19('0x1e')](function(_0x53aad8){logger[_0xab19('0xa')](_0xab19('0x1b'),_0x16b0dc);logger[_0xab19('0xc')](_0xab19('0x1b'),_0x16b0dc,JSON[_0xab19('0x1a')](_0x53aad8));_0x1359bd(_0x53aad8);})[_0xab19('0x13')](function(_0x584f53){logger[_0xab19('0xe')](_0xab19('0x1b'),_0x584f53[_0xab19('0x11')],_0x16b0dc);_0x24f56d(_0x1f4855[_0xab19('0xe')](0x1f4,_0x584f53[_0xab19('0x11')]));});});}; \ No newline at end of file +var _0xf216=['VoiceAgentReport','catch','UpdateVoiceAgentReport','body','options','raw','where','attributes','limit','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','CreateVoiceAgentReport'];(function(_0x4583a4,_0xe2503f){var _0x133aec=function(_0x32638f){while(--_0x32638f){_0x4583a4['push'](_0x4583a4['shift']());}};_0x133aec(++_0xe2503f);}(_0xf216,0x1e5));var _0x6f21=function(_0x117f4c,_0x36a9b1){_0x117f4c=_0x117f4c-0x0;var _0x2b24e9=_0xf216[_0x117f4c];return _0x2b24e9;};'use strict';var _=require(_0x6f21('0x0'));var util=require(_0x6f21('0x1'));var moment=require(_0x6f21('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6f21('0x3'));var db=require(_0x6f21('0x4'))['db'];var utils=require(_0x6f21('0x5'));var logger=require(_0x6f21('0x6'))(_0x6f21('0x7'));var config=require(_0x6f21('0x8'));var jayson=require(_0x6f21('0x9'));var client=jayson[_0x6f21('0xa')][_0x6f21('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f271b,_0x42a44d,_0x324ccb){return new BPromise(function(_0x3891a1,_0x1e8959){return client[_0x6f21('0xc')](_0x3f271b,_0x324ccb)[_0x6f21('0xd')](function(_0x321a97){logger['info'](_0x6f21('0xe'),_0x42a44d,_0x6f21('0xf'));logger[_0x6f21('0x10')](_0x6f21('0x11'),_0x42a44d,'request\x20sent',JSON[_0x6f21('0x12')](_0x321a97));if(_0x321a97[_0x6f21('0x13')]){if(_0x321a97[_0x6f21('0x13')][_0x6f21('0x14')]===0x1f4){logger[_0x6f21('0x13')]('VoiceAgentReport,\x20%s,\x20%s',_0x42a44d,_0x321a97[_0x6f21('0x13')]['message']);return _0x1e8959(_0x321a97[_0x6f21('0x13')][_0x6f21('0x15')]);}logger[_0x6f21('0x13')](_0x6f21('0xe'),_0x42a44d,_0x321a97[_0x6f21('0x13')]['message']);return _0x3891a1(_0x321a97[_0x6f21('0x13')][_0x6f21('0x15')]);}else{logger[_0x6f21('0x16')](_0x6f21('0xe'),_0x42a44d,_0x6f21('0xf'));_0x3891a1(_0x321a97[_0x6f21('0x17')][_0x6f21('0x15')]);}})['catch'](function(_0x1f2b61){logger['error'](_0x6f21('0xe'),_0x42a44d,_0x1f2b61);_0x1e8959(_0x1f2b61);});});}exports[_0x6f21('0x18')]=function(_0x4b687b){var _0x37ec3a=this;return new Promise(function(_0x1af6b0,_0x35bcfb){return db[_0x6f21('0x19')]['create'](_0x4b687b['body'],{'raw':_0x4b687b['options']?_0x4b687b['options']['raw']===undefined?!![]:![]:!![]})[_0x6f21('0xd')](function(_0x1343ad){logger[_0x6f21('0x16')]('CreateVoiceAgentReport',_0x4b687b);logger[_0x6f21('0x10')](_0x6f21('0x18'),_0x4b687b,JSON[_0x6f21('0x12')](_0x1343ad));_0x1af6b0(_0x1343ad);})[_0x6f21('0x1a')](function(_0x17fa2e){logger[_0x6f21('0x13')](_0x6f21('0x18'),_0x17fa2e[_0x6f21('0x15')],_0x4b687b);_0x35bcfb(_0x37ec3a[_0x6f21('0x13')](0x1f4,_0x17fa2e[_0x6f21('0x15')]));});});};exports[_0x6f21('0x1b')]=function(_0x25aaf7){var _0x283cd9=this;return new Promise(function(_0x272a23,_0x4e50b9){return db[_0x6f21('0x19')]['update'](_0x25aaf7[_0x6f21('0x1c')],{'raw':_0x25aaf7['options']?_0x25aaf7[_0x6f21('0x1d')][_0x6f21('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x25aaf7[_0x6f21('0x1d')]?_0x25aaf7['options'][_0x6f21('0x1f')]||null:null,'attributes':_0x25aaf7[_0x6f21('0x1d')]?_0x25aaf7['options'][_0x6f21('0x20')]||null:null,'limit':_0x25aaf7[_0x6f21('0x1d')]?_0x25aaf7['options'][_0x6f21('0x21')]||null:null})[_0x6f21('0xd')](function(_0x5c0c17){logger[_0x6f21('0x16')](_0x6f21('0x1b'),_0x25aaf7);logger['debug'](_0x6f21('0x1b'),_0x25aaf7,JSON[_0x6f21('0x12')](_0x5c0c17));_0x272a23(_0x5c0c17);})[_0x6f21('0x1a')](function(_0x8d482d){logger['error'](_0x6f21('0x1b'),_0x8d482d[_0x6f21('0x15')],_0x25aaf7);_0x4e50b9(_0x283cd9[_0x6f21('0x13')](0x1f4,_0x8d482d[_0x6f21('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index fd10068..1034785 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 _0x3435=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe','/:id','show','create','put','delete','exports','multer','util'];(function(_0x34fd6f,_0x113571){var _0x26161d=function(_0x4669ef){while(--_0x4669ef){_0x34fd6f['push'](_0x34fd6f['shift']());}};_0x26161d(++_0x113571);}(_0x3435,0xfa));var _0x5343=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x3435[_0x209941];return _0x1e8729;};'use strict';var multer=require(_0x5343('0x0'));var util=require(_0x5343('0x1'));var path=require(_0x5343('0x2'));var timeout=require(_0x5343('0x3'));var express=require(_0x5343('0x4'));var router=express[_0x5343('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5343('0x6'));var interaction=require(_0x5343('0x7'));var config=require('../../config/environment');var controller=require('./voiceCallReport.controller');router[_0x5343('0x8')]('/',auth[_0x5343('0x9')](),controller['index']);router['get'](_0x5343('0xa'),auth[_0x5343('0x9')](),controller[_0x5343('0xb')]);router[_0x5343('0x8')](_0x5343('0xc'),auth['isAuthenticated'](),controller[_0x5343('0xd')]);router['post']('/',auth[_0x5343('0x9')](),controller[_0x5343('0xe')]);router[_0x5343('0xf')](_0x5343('0xc'),auth[_0x5343('0x9')](),controller['update']);router[_0x5343('0x10')](_0x5343('0xc'),auth[_0x5343('0x9')](),controller['destroy']);module[_0x5343('0x11')]=router; \ No newline at end of file +var _0x950a=['/:id','isAuthenticated','show','post','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceCallReport.controller','get','index','describe'];(function(_0x1cc408,_0x4b007b){var _0x31eead=function(_0xacf0b4){while(--_0xacf0b4){_0x1cc408['push'](_0x1cc408['shift']());}};_0x31eead(++_0x4b007b);}(_0x950a,0x111));var _0xa950=function(_0x159037,_0x3ca10a){_0x159037=_0x159037-0x0;var _0x135522=_0x950a[_0x159037];return _0x135522;};'use strict';var multer=require(_0xa950('0x0'));var util=require(_0xa950('0x1'));var path=require(_0xa950('0x2'));var timeout=require(_0xa950('0x3'));var express=require('express');var router=express[_0xa950('0x4')]();var fs_extra=require(_0xa950('0x5'));var auth=require(_0xa950('0x6'));var interaction=require(_0xa950('0x7'));var config=require('../../config/environment');var controller=require(_0xa950('0x8'));router[_0xa950('0x9')]('/',auth['isAuthenticated'](),controller[_0xa950('0xa')]);router[_0xa950('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xa950('0xb')]);router[_0xa950('0x9')](_0xa950('0xc'),auth[_0xa950('0xd')](),controller[_0xa950('0xe')]);router[_0xa950('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xa950('0xc'),auth['isAuthenticated'](),controller[_0xa950('0x10')]);router[_0xa950('0x11')](_0xa950('0xc'),auth['isAuthenticated'](),controller[_0xa950('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 9dc3cce..dd27167 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 _0xa9e7=['exports','STRING','ENUM','inbound','internal','inbound-fax','outbound-fax','dialer','TEXT','DATE','INTEGER'];(function(_0x3bca07,_0x362624){var _0x442bf3=function(_0x5759ae){while(--_0x5759ae){_0x3bca07['push'](_0x3bca07['shift']());}};_0x442bf3(++_0x362624);}(_0xa9e7,0x79));var _0x7a9e=function(_0x121bd6,_0x53c4b4){_0x121bd6=_0x121bd6-0x0;var _0x2f9055=_0xa9e7[_0x121bd6];return _0x2f9055;};'use strict';var Sequelize=require('sequelize');module[_0x7a9e('0x0')]={'uniqueid':{'type':Sequelize[_0x7a9e('0x1')]},'type':{'type':Sequelize[_0x7a9e('0x2')](_0x7a9e('0x3'),_0x7a9e('0x4'),'outbound',_0x7a9e('0x5'),_0x7a9e('0x6'),_0x7a9e('0x7'))},'tag':{'type':Sequelize[_0x7a9e('0x1')]},'accountcode':{'type':Sequelize[_0x7a9e('0x1')]},'source':{'type':Sequelize[_0x7a9e('0x1')]},'destination':{'type':Sequelize[_0x7a9e('0x1')]},'destinationcontext':{'type':Sequelize[_0x7a9e('0x1')]},'callerid':{'type':Sequelize[_0x7a9e('0x1')]},'channel':{'type':Sequelize[_0x7a9e('0x1')]},'destinationchannel':{'type':Sequelize[_0x7a9e('0x1')]},'lastapplication':{'type':Sequelize[_0x7a9e('0x1')]},'lastdata':{'type':Sequelize[_0x7a9e('0x8')]},'starttime':{'type':Sequelize[_0x7a9e('0x9')]},'systemanswertime':{'type':Sequelize[_0x7a9e('0x9')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x7a9e('0x9')]},'duration':{'type':Sequelize[_0x7a9e('0xa')]},'billableseconds':{'type':Sequelize[_0x7a9e('0xa')]},'mohtime':{'type':Sequelize[_0x7a9e('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x7a9e('0x1')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x7a9e('0x1')]},'userDisposition':{'type':Sequelize[_0x7a9e('0x1')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x7a9e('0x1')]},'note':{'type':Sequelize[_0x7a9e('0x1')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0x7a9e('0xa')]},'sipcallid':{'type':Sequelize[_0x7a9e('0x1')]}}; \ No newline at end of file +var _0xa6f9=['DATE','INTEGER','exports','STRING','ENUM','internal','dialer','TEXT'];(function(_0x7e35f4,_0x51d1d2){var _0x1fe7c8=function(_0x3bd6e5){while(--_0x3bd6e5){_0x7e35f4['push'](_0x7e35f4['shift']());}};_0x1fe7c8(++_0x51d1d2);}(_0xa6f9,0x11a));var _0x9a6f=function(_0x216200,_0x4575e6){_0x216200=_0x216200-0x0;var _0x57002d=_0xa6f9[_0x216200];return _0x57002d;};'use strict';var Sequelize=require('sequelize');module[_0x9a6f('0x0')]={'uniqueid':{'type':Sequelize[_0x9a6f('0x1')]},'type':{'type':Sequelize[_0x9a6f('0x2')]('inbound',_0x9a6f('0x3'),'outbound','inbound-fax','outbound-fax',_0x9a6f('0x4'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0x9a6f('0x1')]},'destination':{'type':Sequelize[_0x9a6f('0x1')]},'destinationcontext':{'type':Sequelize[_0x9a6f('0x1')]},'callerid':{'type':Sequelize[_0x9a6f('0x1')]},'channel':{'type':Sequelize[_0x9a6f('0x1')]},'destinationchannel':{'type':Sequelize[_0x9a6f('0x1')]},'lastapplication':{'type':Sequelize[_0x9a6f('0x1')]},'lastdata':{'type':Sequelize[_0x9a6f('0x5')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x9a6f('0x6')]},'endtime':{'type':Sequelize[_0x9a6f('0x6')]},'duration':{'type':Sequelize[_0x9a6f('0x7')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x9a6f('0x7')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x9a6f('0x1')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x9a6f('0x1')]},'userDisposition':{'type':Sequelize[_0x9a6f('0x1')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x9a6f('0x1')]},'note':{'type':Sequelize[_0x9a6f('0x1')]},'prefix':{'type':Sequelize[_0x9a6f('0x1')]},'routeid':{'type':Sequelize[_0x9a6f('0x7')]},'sipcallid':{'type':Sequelize[_0x9a6f('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 6273e59..de1da25 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 _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(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x2ef3,0xba));var _0x32ef=function(_0xe4e1a0,_0x450728){_0xe4e1a0=_0xe4e1a0-0x0;var _0x2bb33b=_0x2ef3[_0xe4e1a0];return _0x2bb33b;};'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 +var _0x5f66=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','destroy','then','error','name','send','index','map','VoiceCallReport','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','type','VIRTUAL','includeAll','include','fullname','alias','User','rows','catch','show','params','find','create','body','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x5f66[_0x4cf98e];return _0x1623ac;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x65f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65f6('0x1'));var rp=require(_0x65f6('0x2'));var moment=require(_0x65f6('0x3'));var BPromise=require(_0x65f6('0x4'));var Mustache=require(_0x65f6('0x5'));var util=require('util');var path=require(_0x65f6('0x6'));var sox=require('sox');var csv=require(_0x65f6('0x7'));var ejs=require(_0x65f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x7'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x65f6('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x419819,_0x4862a5){_0x4862a5=_0x4862a5||0xcc;return function(_0x2f964a){if(_0x2f964a){return _0x419819[_0x65f6('0x14')](_0x4862a5);}return _0x419819[_0x65f6('0x15')](_0x4862a5)[_0x65f6('0x16')]();};}function respondWithResult(_0x369f96,_0x1d29fd){_0x1d29fd=_0x1d29fd||0xc8;return function(_0x44144b){if(_0x44144b){return _0x369f96[_0x65f6('0x15')](_0x1d29fd)[_0x65f6('0x17')](_0x44144b);}};}function respondWithFilteredResult(_0x3440af,_0x59154e){return function(_0x19b9ff){if(_0x19b9ff){var _0x49a913=typeof _0x59154e['offset']===_0x65f6('0x18')&&typeof _0x59154e[_0x65f6('0x19')]===_0x65f6('0x18');var _0x1c955c=_0x19b9ff[_0x65f6('0x1a')];var _0x1f974c=_0x49a913?0x0:_0x59154e[_0x65f6('0x1b')];var _0x18380e=_0x49a913?_0x19b9ff['count']:_0x59154e['offset']+_0x59154e[_0x65f6('0x19')];var _0x5b4055;if(_0x18380e>=_0x1c955c){_0x18380e=_0x1c955c;_0x5b4055=0xc8;}else{_0x5b4055=0xce;}_0x3440af['status'](_0x5b4055);return _0x3440af['set'](_0x65f6('0x1c'),_0x1f974c+'-'+_0x18380e+'/'+_0x1c955c)[_0x65f6('0x17')](_0x19b9ff);}return null;};}function patchUpdates(_0x5114a4){return function(_0x39e19f){try{jsonpatch[_0x65f6('0x1d')](_0x39e19f,_0x5114a4,!![]);}catch(_0xbee6a4){return BPromise[_0x65f6('0x1e')](_0xbee6a4);}return _0x39e19f[_0x65f6('0x1f')]();};}function saveUpdates(_0xc139c2,_0x581374){return function(_0x197a49){if(_0x197a49){return _0x197a49['update'](_0xc139c2)['then'](function(_0x212247){return _0x212247;});}return null;};}function removeEntity(_0xd173f4,_0x524e42){return function(_0x1eeaaa){if(_0x1eeaaa){return _0x1eeaaa[_0x65f6('0x20')]()[_0x65f6('0x21')](function(){_0xd173f4[_0x65f6('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9d7bb0,_0x59ea32){return function(_0x20a161){if(!_0x20a161){_0x9d7bb0['sendStatus'](0x194);}return _0x20a161;};}function handleError(_0x5cb131,_0x4fde2f){_0x4fde2f=_0x4fde2f||0x1f4;return function(_0x29abdb){logger[_0x65f6('0x22')](_0x29abdb['stack']);if(_0x29abdb[_0x65f6('0x23')]){delete _0x29abdb[_0x65f6('0x23')];}_0x5cb131['status'](_0x4fde2f)[_0x65f6('0x24')](_0x29abdb);};}exports[_0x65f6('0x25')]=function(_0x28d0df,_0x559330){var _0x4ac04b={},_0x488d36={},_0x266cfe={'count':0x0,'rows':[]};var _0x3c032f=_[_0x65f6('0x26')](db[_0x65f6('0x27')][_0x65f6('0x28')],function(_0x14a387){return{'name':_0x14a387[_0x65f6('0x29')],'type':_0x14a387['type']['key']};});_0x488d36[_0x65f6('0x2a')]=_[_0x65f6('0x26')](_0x3c032f,'name');_0x488d36['query']=_[_0x65f6('0x2b')](_0x28d0df[_0x65f6('0x2c')]);_0x488d36[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],_0x488d36[_0x65f6('0x2c')]);_0x4ac04b['attributes']=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],qs[_0x65f6('0x2f')](_0x28d0df['query'][_0x65f6('0x2f')]));_0x4ac04b[_0x65f6('0x30')]=_0x4ac04b[_0x65f6('0x30')][_0x65f6('0x31')]?_0x4ac04b[_0x65f6('0x30')]:_0x488d36[_0x65f6('0x2a')];if(!_0x28d0df['query'][_0x65f6('0x32')](_0x65f6('0x33'))){_0x4ac04b['limit']=qs[_0x65f6('0x19')](_0x28d0df['query'][_0x65f6('0x19')]);_0x4ac04b['offset']=qs[_0x65f6('0x1b')](_0x28d0df[_0x65f6('0x2c')]['offset']);}_0x4ac04b[_0x65f6('0x34')]=qs[_0x65f6('0x35')](_0x28d0df[_0x65f6('0x2c')]['sort']);_0x4ac04b['where']=qs[_0x65f6('0x2d')](_['pick'](_0x28d0df[_0x65f6('0x2c')],_0x488d36['filters']),_0x3c032f);if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]){_0x4ac04b['where']=_[_0x65f6('0x37')](_0x4ac04b['where'],{'$or':_['map'](_0x3c032f,function(_0x71b16b){if(_0x71b16b[_0x65f6('0x38')]!==_0x65f6('0x39')){var _0x313be5={};_0x313be5[_0x71b16b[_0x65f6('0x23')]]={'$like':'%'+_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]+'%'};return _0x313be5;}})});}_0x4ac04b=_[_0x65f6('0x37')]({},_0x4ac04b,_0x28d0df['options']);var _0x3aa254={'where':_0x4ac04b['where']};return db[_0x65f6('0x27')][_0x65f6('0x1a')](_0x3aa254)[_0x65f6('0x21')](function(_0x2ea7f7){_0x266cfe['count']=_0x2ea7f7;if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x4ac04b[_0x65f6('0x3b')]=[{'attributes':['id',_0x65f6('0x23'),_0x65f6('0x3c'),_0x65f6('0x3d')],'model':db[_0x65f6('0x3e')],'as':_0x65f6('0x3e')}];}return db[_0x65f6('0x27')]['findAll'](_0x4ac04b);})[_0x65f6('0x21')](function(_0x400ed2){_0x266cfe[_0x65f6('0x3f')]=_0x400ed2;return _0x266cfe;})[_0x65f6('0x21')](respondWithFilteredResult(_0x559330,_0x4ac04b))[_0x65f6('0x40')](handleError(_0x559330,null));};exports[_0x65f6('0x41')]=function(_0xe0b72d,_0x2e91e8){var _0x461393={'raw':!![],'where':{'id':_0xe0b72d[_0x65f6('0x42')]['id']}},_0x2abbed={};_0x2abbed[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](db[_0x65f6('0x27')][_0x65f6('0x28')]);_0x2abbed[_0x65f6('0x2c')]=_['keys'](_0xe0b72d[_0x65f6('0x2c')]);_0x2abbed[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x2abbed[_0x65f6('0x2a')],_0x2abbed['query']);_0x461393[_0x65f6('0x30')]=_[_0x65f6('0x2e')](_0x2abbed[_0x65f6('0x2a')],qs['fields'](_0xe0b72d[_0x65f6('0x2c')][_0x65f6('0x2f')]));_0x461393[_0x65f6('0x30')]=_0x461393[_0x65f6('0x30')]['length']?_0x461393[_0x65f6('0x30')]:_0x2abbed['model'];if(_0xe0b72d[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x461393['include']=[{'all':!![]}];}_0x461393=_[_0x65f6('0x37')]({},_0x461393,_0xe0b72d['options']);return db[_0x65f6('0x27')][_0x65f6('0x43')](_0x461393)[_0x65f6('0x21')](handleEntityNotFound(_0x2e91e8,null))[_0x65f6('0x21')](respondWithResult(_0x2e91e8,null))[_0x65f6('0x40')](handleError(_0x2e91e8,null));};exports[_0x65f6('0x44')]=function(_0x4d30c5,_0x51bf6c){return db[_0x65f6('0x27')][_0x65f6('0x44')](_0x4d30c5[_0x65f6('0x45')],{})[_0x65f6('0x21')](respondWithResult(_0x51bf6c,0xc9))[_0x65f6('0x40')](handleError(_0x51bf6c,null));};exports[_0x65f6('0x20')]=function(_0x149c28,_0x41690c){return db[_0x65f6('0x27')]['find']({'where':{'id':_0x149c28[_0x65f6('0x42')]['id']}})[_0x65f6('0x21')](handleEntityNotFound(_0x41690c,null))[_0x65f6('0x21')](removeEntity(_0x41690c,null))['catch'](handleError(_0x41690c,null));};exports[_0x65f6('0x46')]=function(_0x42d453,_0x49ba5a){return db[_0x65f6('0x27')][_0x65f6('0x46')]()['then'](respondWithResult(_0x49ba5a,null))[_0x65f6('0x40')](handleError(_0x49ba5a,null));};exports['update']=function(_0x247be3,_0x3b241f){if(_0x247be3[_0x65f6('0x45')]['uniqueid']){delete _0x247be3[_0x65f6('0x45')][_0x65f6('0x47')];}return db['VoiceCallReport'][_0x65f6('0x43')]({'where':{'uniqueid':_0x247be3[_0x65f6('0x42')]['id'],'UserId':{'$or':[null,_0x247be3['user']['id']]}}})[_0x65f6('0x21')](handleEntityNotFound(_0x3b241f,null))[_0x65f6('0x21')](saveUpdates(_0x247be3[_0x65f6('0x45')],null))[_0x65f6('0x21')](respondWithResult(_0x3b241f,null))[_0x65f6('0x40')](handleError(_0x3b241f,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index ad6d8cd..514771c 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 _0xde46=['rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xde46,0x174));var _0x6de4=function(_0x38faad,_0x51c726){_0x38faad=_0x38faad-0x0;var _0x18e992=_0xde46[_0x38faad];return _0x18e992;};'use strict';var _=require(_0x6de4('0x0'));var util=require('util');var logger=require(_0x6de4('0x1'))('api');var moment=require(_0x6de4('0x2'));var BPromise=require(_0x6de4('0x3'));var rp=require(_0x6de4('0x4'));var fs=require('fs');var path=require(_0x6de4('0x5'));var rimraf=require(_0x6de4('0x6'));var config=require(_0x6de4('0x7'));var attributes=require(_0x6de4('0x8'));module[_0x6de4('0x9')]=function(_0x52d8ad,_0x1c9de2){return _0x52d8ad[_0x6de4('0xa')](_0x6de4('0xb'),attributes,{'tableName':_0x6de4('0xc'),'paranoid':![],'indexes':[{'fields':[_0x6de4('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe0d6=['define','VoiceCallReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x138240,_0x4becbf){var _0x5f4388=function(_0x32d18e){while(--_0x32d18e){_0x138240['push'](_0x138240['shift']());}};_0x5f4388(++_0x4becbf);}(_0xe0d6,0x18f));var _0x6e0d=function(_0x5a87cf,_0x4aee0c){_0x5a87cf=_0x5a87cf-0x0;var _0x593645=_0xe0d6[_0x5a87cf];return _0x593645;};'use strict';var _=require(_0x6e0d('0x0'));var util=require(_0x6e0d('0x1'));var logger=require(_0x6e0d('0x2'))(_0x6e0d('0x3'));var moment=require(_0x6e0d('0x4'));var BPromise=require(_0x6e0d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6e0d('0x6'));var rimraf=require(_0x6e0d('0x7'));var config=require(_0x6e0d('0x8'));var attributes=require('./voiceCallReport.attributes');module['exports']=function(_0x29cb7c,_0x8eb52b){return _0x29cb7c[_0x6e0d('0x9')](_0x6e0d('0xa'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x6e0d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 907dde3..5453037 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 _0xa124=['create','body','CreateVoiceCallReport','UpdateVoiceCallReport','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','VoiceCallReport,\x20%s,\x20%s','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVoiceCallReport','options','raw','attributes','include','map','model'];(function(_0x3e1857,_0xc448e4){var _0x11cd4a=function(_0x1cb1c2){while(--_0x1cb1c2){_0x3e1857['push'](_0x3e1857['shift']());}};_0x11cd4a(++_0xc448e4);}(_0xa124,0x126));var _0x4a12=function(_0x559a80,_0x3d193d){_0x559a80=_0x559a80-0x0;var _0x42f555=_0xa124[_0x559a80];return _0x42f555;};'use strict';var _=require(_0x4a12('0x0'));var util=require(_0x4a12('0x1'));var moment=require(_0x4a12('0x2'));var BPromise=require(_0x4a12('0x3'));var rs=require(_0x4a12('0x4'));var fs=require('fs');var Redis=require(_0x4a12('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4a12('0x6'));var logger=require(_0x4a12('0x7'))('rpc');var config=require(_0x4a12('0x8'));var jayson=require(_0x4a12('0x9'));var client=jayson['client'][_0x4a12('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b18c5,_0x207538,_0x4ffabb){return new BPromise(function(_0x475308,_0x3e19d3){return client['request'](_0x4b18c5,_0x4ffabb)[_0x4a12('0xb')](function(_0x1ee02c){logger[_0x4a12('0xc')](_0x4a12('0xd'),_0x207538,'request\x20sent');logger[_0x4a12('0xe')](_0x4a12('0xf'),_0x207538,_0x4a12('0x10'),JSON[_0x4a12('0x11')](_0x1ee02c));if(_0x1ee02c['error']){if(_0x1ee02c[_0x4a12('0x12')][_0x4a12('0x13')]===0x1f4){logger[_0x4a12('0x12')](_0x4a12('0xd'),_0x207538,_0x1ee02c['error'][_0x4a12('0x14')]);return _0x3e19d3(_0x1ee02c[_0x4a12('0x12')][_0x4a12('0x14')]);}logger[_0x4a12('0x12')](_0x4a12('0xd'),_0x207538,_0x1ee02c['error'][_0x4a12('0x14')]);return _0x475308(_0x1ee02c['error'][_0x4a12('0x14')]);}else{logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x207538,'request\x20sent');_0x475308(_0x1ee02c[_0x4a12('0x15')][_0x4a12('0x14')]);}})[_0x4a12('0x16')](function(_0x3f3f40){logger[_0x4a12('0x12')]('VoiceCallReport,\x20%s,\x20%s',_0x207538,_0x3f3f40);_0x3e19d3(_0x3f3f40);});});}exports[_0x4a12('0x17')]=function(_0x41efa8){var _0x9d556d=this;return new Promise(function(_0x31842b,_0x50e112){return db['VoiceCallReport']['findAll']({'raw':_0x41efa8['options']?_0x41efa8[_0x4a12('0x18')][_0x4a12('0x19')]===undefined?!![]:![]:!![],'where':_0x41efa8[_0x4a12('0x18')]?_0x41efa8['options']['where']||null:null,'attributes':_0x41efa8['options']?_0x41efa8['options'][_0x4a12('0x1a')]||null:null,'limit':_0x41efa8['options']?_0x41efa8[_0x4a12('0x18')]['limit']||null:null,'include':_0x41efa8[_0x4a12('0x18')]?_0x41efa8['options'][_0x4a12('0x1b')]?_[_0x4a12('0x1c')](_0x41efa8[_0x4a12('0x18')][_0x4a12('0x1b')],function(_0x586ece){return{'model':db[_0x586ece[_0x4a12('0x1d')]],'as':_0x586ece['as'],'attributes':_0x586ece[_0x4a12('0x1a')],'include':_0x586ece[_0x4a12('0x1b')]?_['map'](_0x586ece[_0x4a12('0x1b')],function(_0x42a465){return{'model':db[_0x42a465[_0x4a12('0x1d')]],'as':_0x42a465['as'],'attributes':_0x42a465['attributes'],'include':_0x42a465['include']?_[_0x4a12('0x1c')](_0x42a465[_0x4a12('0x1b')],function(_0x1b9850){return{'model':db[_0x1b9850[_0x4a12('0x1d')]],'as':_0x1b9850['as'],'attributes':_0x1b9850[_0x4a12('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x22cd61){logger['info']('GetVoiceCallReport',_0x41efa8);logger[_0x4a12('0xe')](_0x4a12('0x17'),_0x41efa8,JSON[_0x4a12('0x11')](_0x22cd61));_0x31842b(_0x22cd61);})[_0x4a12('0x16')](function(_0x812024){logger['error'](_0x4a12('0x17'),_0x812024[_0x4a12('0x14')],_0x41efa8);_0x50e112(_0x9d556d[_0x4a12('0x12')](0x1f4,_0x812024[_0x4a12('0x14')]));});});};exports['CreateVoiceCallReport']=function(_0x130d24){var _0x35e977=this;return new Promise(function(_0x285d19,_0x382f06){return db['VoiceCallReport'][_0x4a12('0x1e')](_0x130d24[_0x4a12('0x1f')],{'raw':_0x130d24[_0x4a12('0x18')]?_0x130d24[_0x4a12('0x18')][_0x4a12('0x19')]===undefined?!![]:![]:!![]})[_0x4a12('0xb')](function(_0x43ef90){logger[_0x4a12('0xc')]('CreateVoiceCallReport',_0x130d24);logger[_0x4a12('0xe')]('CreateVoiceCallReport',_0x130d24,JSON['stringify'](_0x43ef90));_0x285d19(_0x43ef90);})['catch'](function(_0x1e805d){logger[_0x4a12('0x12')](_0x4a12('0x20'),_0x1e805d[_0x4a12('0x14')],_0x130d24);_0x382f06(_0x35e977[_0x4a12('0x12')](0x1f4,_0x1e805d[_0x4a12('0x14')]));});});};exports[_0x4a12('0x21')]=function(_0xd51068){var _0x35dc6a=this;return new Promise(function(_0x4a78ab,_0x124ec0){return db['VoiceCallReport']['update'](_0xd51068['body'],{'raw':_0xd51068[_0x4a12('0x18')]?_0xd51068[_0x4a12('0x18')][_0x4a12('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd51068[_0x4a12('0x18')]?_0xd51068[_0x4a12('0x18')][_0x4a12('0x22')]||null:null,'attributes':_0xd51068[_0x4a12('0x18')]?_0xd51068[_0x4a12('0x18')][_0x4a12('0x1a')]||null:null,'limit':_0xd51068[_0x4a12('0x18')]?_0xd51068['options'][_0x4a12('0x23')]||null:null})[_0x4a12('0xb')](function(_0x54081f){logger[_0x4a12('0xc')](_0x4a12('0x21'),_0xd51068);logger[_0x4a12('0xe')]('UpdateVoiceCallReport',_0xd51068,JSON[_0x4a12('0x11')](_0x54081f));_0x4a78ab(_0x54081f);})[_0x4a12('0x16')](function(_0x5574b0){logger[_0x4a12('0x12')](_0x4a12('0x21'),_0x5574b0[_0x4a12('0x14')],_0xd51068);_0x124ec0(_0x35dc6a[_0x4a12('0x12')](0x1f4,_0x5574b0[_0x4a12('0x14')]));});});}; \ No newline at end of file +var _0x459d=['client','http','request','then','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','info','result','GetVoiceCallReport','findAll','options','raw','where','limit','include','attributes','model','map','VoiceCallReport','create','body','CreateVoiceCallReport','catch','UpdateVoiceCallReport','update','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x4279fe,_0x1b41c7){var _0xdc6438=function(_0x4299c5){while(--_0x4299c5){_0x4279fe['push'](_0x4279fe['shift']());}};_0xdc6438(++_0x1b41c7);}(_0x459d,0x157));var _0xd459=function(_0x4c072f,_0x268523){_0x4c072f=_0x4c072f-0x0;var _0x187628=_0x459d[_0x4c072f];return _0x187628;};'use strict';var _=require(_0xd459('0x0'));var util=require(_0xd459('0x1'));var moment=require('moment');var BPromise=require(_0xd459('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd459('0x3'));var db=require(_0xd459('0x4'))['db'];var utils=require(_0xd459('0x5'));var logger=require(_0xd459('0x6'))('rpc');var config=require(_0xd459('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd459('0x8')][_0xd459('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x438bd0,_0x4d861b,_0x3e188d){return new BPromise(function(_0x571535,_0x5a7a3c){return client[_0xd459('0xa')](_0x438bd0,_0x3e188d)[_0xd459('0xb')](function(_0x19b642){logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x4d861b,_0xd459('0xc'));logger[_0xd459('0xd')](_0xd459('0xe'),_0x4d861b,_0xd459('0xc'),JSON[_0xd459('0xf')](_0x19b642));if(_0x19b642[_0xd459('0x10')]){if(_0x19b642[_0xd459('0x10')][_0xd459('0x11')]===0x1f4){logger[_0xd459('0x10')](_0xd459('0x12'),_0x4d861b,_0x19b642[_0xd459('0x10')]['message']);return _0x5a7a3c(_0x19b642[_0xd459('0x10')][_0xd459('0x13')]);}logger[_0xd459('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0x4d861b,_0x19b642[_0xd459('0x10')][_0xd459('0x13')]);return _0x571535(_0x19b642[_0xd459('0x10')][_0xd459('0x13')]);}else{logger[_0xd459('0x14')](_0xd459('0x12'),_0x4d861b,'request\x20sent');_0x571535(_0x19b642[_0xd459('0x15')][_0xd459('0x13')]);}})['catch'](function(_0x53b477){logger[_0xd459('0x10')](_0xd459('0x12'),_0x4d861b,_0x53b477);_0x5a7a3c(_0x53b477);});});}exports[_0xd459('0x16')]=function(_0x13df04){var _0x409640=this;return new Promise(function(_0x1a7a0a,_0x103e12){return db['VoiceCallReport'][_0xd459('0x17')]({'raw':_0x13df04['options']?_0x13df04[_0xd459('0x18')][_0xd459('0x19')]===undefined?!![]:![]:!![],'where':_0x13df04[_0xd459('0x18')]?_0x13df04[_0xd459('0x18')][_0xd459('0x1a')]||null:null,'attributes':_0x13df04[_0xd459('0x18')]?_0x13df04[_0xd459('0x18')]['attributes']||null:null,'limit':_0x13df04[_0xd459('0x18')]?_0x13df04['options'][_0xd459('0x1b')]||null:null,'include':_0x13df04[_0xd459('0x18')]?_0x13df04[_0xd459('0x18')]['include']?_['map'](_0x13df04[_0xd459('0x18')][_0xd459('0x1c')],function(_0x13a056){return{'model':db[_0x13a056['model']],'as':_0x13a056['as'],'attributes':_0x13a056[_0xd459('0x1d')],'include':_0x13a056['include']?_['map'](_0x13a056[_0xd459('0x1c')],function(_0x4cfa6a){return{'model':db[_0x4cfa6a[_0xd459('0x1e')]],'as':_0x4cfa6a['as'],'attributes':_0x4cfa6a[_0xd459('0x1d')],'include':_0x4cfa6a[_0xd459('0x1c')]?_[_0xd459('0x1f')](_0x4cfa6a[_0xd459('0x1c')],function(_0x464b45){return{'model':db[_0x464b45[_0xd459('0x1e')]],'as':_0x464b45['as'],'attributes':_0x464b45[_0xd459('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd459('0xb')](function(_0x4d89ae){logger['info']('GetVoiceCallReport',_0x13df04);logger[_0xd459('0xd')]('GetVoiceCallReport',_0x13df04,JSON[_0xd459('0xf')](_0x4d89ae));_0x1a7a0a(_0x4d89ae);})['catch'](function(_0x5e92c5){logger[_0xd459('0x10')](_0xd459('0x16'),_0x5e92c5[_0xd459('0x13')],_0x13df04);_0x103e12(_0x409640[_0xd459('0x10')](0x1f4,_0x5e92c5[_0xd459('0x13')]));});});};exports['CreateVoiceCallReport']=function(_0x567715){var _0x34a88b=this;return new Promise(function(_0x2f6ece,_0x177e79){return db[_0xd459('0x20')][_0xd459('0x21')](_0x567715[_0xd459('0x22')],{'raw':_0x567715[_0xd459('0x18')]?_0x567715[_0xd459('0x18')][_0xd459('0x19')]===undefined?!![]:![]:!![]})[_0xd459('0xb')](function(_0x2b8ad0){logger[_0xd459('0x14')](_0xd459('0x23'),_0x567715);logger[_0xd459('0xd')](_0xd459('0x23'),_0x567715,JSON[_0xd459('0xf')](_0x2b8ad0));_0x2f6ece(_0x2b8ad0);})[_0xd459('0x24')](function(_0x1a1d0e){logger[_0xd459('0x10')](_0xd459('0x23'),_0x1a1d0e[_0xd459('0x13')],_0x567715);_0x177e79(_0x34a88b[_0xd459('0x10')](0x1f4,_0x1a1d0e[_0xd459('0x13')]));});});};exports[_0xd459('0x25')]=function(_0x5ad861){var _0x3f533a=this;return new Promise(function(_0xb6fff3,_0x390615){return db[_0xd459('0x20')][_0xd459('0x26')](_0x5ad861[_0xd459('0x22')],{'raw':_0x5ad861[_0xd459('0x18')]?_0x5ad861[_0xd459('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ad861[_0xd459('0x18')]?_0x5ad861[_0xd459('0x18')][_0xd459('0x1a')]||null:null,'attributes':_0x5ad861[_0xd459('0x18')]?_0x5ad861[_0xd459('0x18')][_0xd459('0x1d')]||null:null,'limit':_0x5ad861[_0xd459('0x18')]?_0x5ad861[_0xd459('0x18')][_0xd459('0x1b')]||null:null})[_0xd459('0xb')](function(_0x5dc957){logger[_0xd459('0x14')](_0xd459('0x25'),_0x5ad861);logger[_0xd459('0xd')](_0xd459('0x25'),_0x5ad861,JSON[_0xd459('0xf')](_0x5dc957));_0xb6fff3(_0x5dc957);})[_0xd459('0x24')](function(_0x3376a9){logger['error'](_0xd459('0x25'),_0x3376a9['message'],_0x5ad861);_0x390615(_0x3f533a[_0xd459('0x10')](0x1f4,_0x3376a9['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 468eddf..eac8274 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 _0xdb33=['post','isAuthenticated','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceChanSpy.controller','get','/:id','show'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xdb33,0x1ce));var _0x3db3=function(_0x55ff3e,_0x41077f){_0x55ff3e=_0x55ff3e-0x0;var _0x2709eb=_0xdb33[_0x55ff3e];return _0x2709eb;};'use strict';var multer=require(_0x3db3('0x0'));var util=require(_0x3db3('0x1'));var path=require(_0x3db3('0x2'));var timeout=require(_0x3db3('0x3'));var express=require(_0x3db3('0x4'));var router=express[_0x3db3('0x5')]();var fs_extra=require(_0x3db3('0x6'));var auth=require(_0x3db3('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x3db3('0x8'));var controller=require(_0x3db3('0x9'));router[_0x3db3('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x3db3('0xb'),auth['isAuthenticated'](),controller[_0x3db3('0xc')]);router[_0x3db3('0xd')]('/',auth[_0x3db3('0xe')](),controller['create']);router[_0x3db3('0xf')](_0x3db3('0xb'),auth[_0x3db3('0xe')](),controller['update']);router[_0x3db3('0x10')]('/:id',auth[_0x3db3('0xe')](),controller[_0x3db3('0x11')]);module[_0x3db3('0x12')]=router; \ No newline at end of file +var _0x1808=['show','update','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','index','/:id','isAuthenticated'];(function(_0x473463,_0x21da73){var _0x42f406=function(_0x34a5be){while(--_0x34a5be){_0x473463['push'](_0x473463['shift']());}};_0x42f406(++_0x21da73);}(_0x1808,0xe2));var _0x8180=function(_0x518b8f,_0x476de4){_0x518b8f=_0x518b8f-0x0;var _0x51cece=_0x1808[_0x518b8f];return _0x51cece;};'use strict';var multer=require(_0x8180('0x0'));var util=require(_0x8180('0x1'));var path=require('path');var timeout=require(_0x8180('0x2'));var express=require(_0x8180('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8180('0x4'));var interaction=require(_0x8180('0x5'));var config=require(_0x8180('0x6'));var controller=require(_0x8180('0x7'));router[_0x8180('0x8')]('/',auth['isAuthenticated'](),controller[_0x8180('0x9')]);router[_0x8180('0x8')](_0x8180('0xa'),auth[_0x8180('0xb')](),controller[_0x8180('0xc')]);router['post']('/',auth[_0x8180('0xb')](),controller['create']);router['put'](_0x8180('0xa'),auth[_0x8180('0xb')](),controller[_0x8180('0xd')]);router[_0x8180('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x8180('0xf')]);module[_0x8180('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 7cd9e74..6bfc609 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 _0x0a2f=['BOOLEAN','sequelize','STRING','setDataValue','options','join','getDataValue','split'];(function(_0x583c17,_0x3e26c3){var _0x3629a5=function(_0x540c11){while(--_0x540c11){_0x583c17['push'](_0x583c17['shift']());}};_0x3629a5(++_0x3e26c3);}(_0x0a2f,0x179));var _0xf0a2=function(_0x202d24,_0x5e8641){_0x202d24=_0x202d24-0x0;var _0x2b3a8e=_0x0a2f[_0x202d24];return _0x2b3a8e;};'use strict';var Sequelize=require(_0xf0a2('0x0'));module['exports']={'name':{'type':Sequelize[_0xf0a2('0x1')]},'prefix':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x132e73){this[_0xf0a2('0x2')](_0xf0a2('0x3'),_0x132e73?_0x132e73[_0xf0a2('0x4')](''):[]);},'get':function(){return this[_0xf0a2('0x5')](_0xf0a2('0x3'))?this[_0xf0a2('0x5')](_0xf0a2('0x3'))[_0xf0a2('0x6')](''):[];}},'auth':{'type':Sequelize[_0xf0a2('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0xf0a2('0x1')]},'record':{'type':Sequelize[_0xf0a2('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xf0a2('0x1')]},'description':{'type':Sequelize[_0xf0a2('0x1')]}}; \ No newline at end of file +var _0x95dc=['options','join','getDataValue','split','sequelize','exports','STRING','name','setDataValue'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0x95dc,0x136));var _0xc95d=function(_0x47890e,_0x3e3b2b){_0x47890e=_0x47890e-0x0;var _0x5843f9=_0x95dc[_0x47890e];return _0x5843f9;};'use strict';var Sequelize=require(_0xc95d('0x0'));module[_0xc95d('0x1')]={'name':{'type':Sequelize[_0xc95d('0x2')]},'prefix':{'type':Sequelize['STRING'],'unique':_0xc95d('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xc95d('0x2')],'set':function(_0x5b7a29){this[_0xc95d('0x4')](_0xc95d('0x5'),_0x5b7a29?_0x5b7a29[_0xc95d('0x6')](''):[]);},'get':function(){return this[_0xc95d('0x7')]('options')?this[_0xc95d('0x7')](_0xc95d('0x5'))[_0xc95d('0x8')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xc95d('0x2')]},'description':{'type':Sequelize[_0xc95d('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 1bd15de..b9a7e9f 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 _0xa699=['length','nolimit','order','sort','where','merge','VIRTUAL','filter','options','include','rows','keys','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','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','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','then','get','ChanSpies','error','stack','send','map','VoiceChanSpy','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','attributes','fields'];(function(_0x467ed7,_0x5f3c23){var _0x4572d2=function(_0x8ccf07){while(--_0x8ccf07){_0x467ed7['push'](_0x467ed7['shift']());}};_0x4572d2(++_0x5f3c23);}(_0xa699,0x6b));var _0x9a69=function(_0x3a9661,_0x530b12){_0x3a9661=_0x3a9661-0x0;var _0x5bb119=_0xa699[_0x3a9661];return _0x5bb119;};'use strict';var emlformat=require(_0x9a69('0x0'));var rimraf=require(_0x9a69('0x1'));var zipdir=require(_0x9a69('0x2'));var jsonpatch=require(_0x9a69('0x3'));var rp=require(_0x9a69('0x4'));var moment=require(_0x9a69('0x5'));var BPromise=require(_0x9a69('0x6'));var Mustache=require(_0x9a69('0x7'));var util=require(_0x9a69('0x8'));var path=require(_0x9a69('0x9'));var sox=require(_0x9a69('0xa'));var csv=require(_0x9a69('0xb'));var ejs=require(_0x9a69('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9a69('0xd'));var squel=require(_0x9a69('0xe'));var crypto=require(_0x9a69('0xf'));var jsforce=require(_0x9a69('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x9a69('0xb'));var querystring=require(_0x9a69('0x11'));var Papa=require(_0x9a69('0x12'));var Redis=require(_0x9a69('0x13'));var authService=require(_0x9a69('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9a69('0x15'));var logger=require('../../config/logger')(_0x9a69('0x16'));var utils=require(_0x9a69('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x9a69('0x18'));var db=require(_0x9a69('0x19'))['db'];function respondWithStatusCode(_0x56e43f,_0x81dfb1){_0x81dfb1=_0x81dfb1||0xcc;return function(_0x2e613e){if(_0x2e613e){return _0x56e43f[_0x9a69('0x1a')](_0x81dfb1);}return _0x56e43f[_0x9a69('0x1b')](_0x81dfb1)[_0x9a69('0x1c')]();};}function respondWithResult(_0x70475b,_0x34b5b0){_0x34b5b0=_0x34b5b0||0xc8;return function(_0x2a5b83){if(_0x2a5b83){return _0x70475b[_0x9a69('0x1b')](_0x34b5b0)['json'](_0x2a5b83);}};}function respondWithFilteredResult(_0x2323ae,_0x17de41){return function(_0x2be3ec){if(_0x2be3ec){var _0x5e982d=typeof _0x17de41[_0x9a69('0x1d')]===_0x9a69('0x1e')&&typeof _0x17de41[_0x9a69('0x1f')]===_0x9a69('0x1e');var _0xed2c19=_0x2be3ec['count'];var _0x2e4264=_0x5e982d?0x0:_0x17de41[_0x9a69('0x1d')];var _0x186a5a=_0x5e982d?_0x2be3ec[_0x9a69('0x20')]:_0x17de41[_0x9a69('0x1d')]+_0x17de41[_0x9a69('0x1f')];var _0x2633d5;if(_0x186a5a>=_0xed2c19){_0x186a5a=_0xed2c19;_0x2633d5=0xc8;}else{_0x2633d5=0xce;}_0x2323ae[_0x9a69('0x1b')](_0x2633d5);return _0x2323ae[_0x9a69('0x21')](_0x9a69('0x22'),_0x2e4264+'-'+_0x186a5a+'/'+_0xed2c19)['json'](_0x2be3ec);}return null;};}function patchUpdates(_0x4d8db9){return function(_0x5ebb09){try{jsonpatch[_0x9a69('0x23')](_0x5ebb09,_0x4d8db9,!![]);}catch(_0x12ebe5){return BPromise['reject'](_0x12ebe5);}return _0x5ebb09[_0x9a69('0x24')]();};}function saveUpdates(_0x527ca6,_0x265291){return function(_0x4d6a93){if(_0x4d6a93){return _0x4d6a93['update'](_0x527ca6)['then'](function(_0x189989){return _0x189989;});}return null;};}function removeEntity(_0x5f4138,_0x140cbe){return function(_0x28f5f7){if(_0x28f5f7){return _0x28f5f7[_0x9a69('0x25')]()[_0x9a69('0x26')](function(){var _0x593a1a=_0x28f5f7[_0x9a69('0x27')]({'plain':!![]});var _0x5130b2=_0x9a69('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x5130b2,'resourceId':_0x593a1a['id']}})[_0x9a69('0x26')](function(){return _0x28f5f7;});})[_0x9a69('0x26')](function(){_0x5f4138[_0x9a69('0x1b')](0xcc)[_0x9a69('0x1c')]();});}};}function handleEntityNotFound(_0x26369e,_0x2514fa){return function(_0x1e8334){if(!_0x1e8334){_0x26369e[_0x9a69('0x1a')](0x194);}return _0x1e8334;};}function handleError(_0xbdd2c0,_0x36af38){_0x36af38=_0x36af38||0x1f4;return function(_0x47916a){logger[_0x9a69('0x29')](_0x47916a[_0x9a69('0x2a')]);if(_0x47916a['name']){delete _0x47916a['name'];}_0xbdd2c0['status'](_0x36af38)[_0x9a69('0x2b')](_0x47916a);};}exports['index']=function(_0x14e7da,_0x2d15e3){var _0x31b83b={},_0x1fccab={},_0x10e247={'count':0x0,'rows':[]};var _0x10076d=_[_0x9a69('0x2c')](db[_0x9a69('0x2d')][_0x9a69('0x2e')],function(_0x420c44){return{'name':_0x420c44[_0x9a69('0x2f')],'type':_0x420c44[_0x9a69('0x30')][_0x9a69('0x31')]};});_0x1fccab[_0x9a69('0x32')]=_[_0x9a69('0x2c')](_0x10076d,_0x9a69('0x33'));_0x1fccab[_0x9a69('0x34')]=_['keys'](_0x14e7da['query']);_0x1fccab[_0x9a69('0x35')]=_[_0x9a69('0x36')](_0x1fccab[_0x9a69('0x32')],_0x1fccab[_0x9a69('0x34')]);_0x31b83b[_0x9a69('0x37')]=_['intersection'](_0x1fccab['model'],qs['fields'](_0x14e7da['query'][_0x9a69('0x38')]));_0x31b83b[_0x9a69('0x37')]=_0x31b83b[_0x9a69('0x37')][_0x9a69('0x39')]?_0x31b83b[_0x9a69('0x37')]:_0x1fccab[_0x9a69('0x32')];if(!_0x14e7da['query']['hasOwnProperty'](_0x9a69('0x3a'))){_0x31b83b[_0x9a69('0x1f')]=qs[_0x9a69('0x1f')](_0x14e7da['query'][_0x9a69('0x1f')]);_0x31b83b[_0x9a69('0x1d')]=qs[_0x9a69('0x1d')](_0x14e7da[_0x9a69('0x34')][_0x9a69('0x1d')]);}_0x31b83b[_0x9a69('0x3b')]=qs[_0x9a69('0x3c')](_0x14e7da[_0x9a69('0x34')][_0x9a69('0x3c')]);_0x31b83b[_0x9a69('0x3d')]=qs[_0x9a69('0x35')](_['pick'](_0x14e7da[_0x9a69('0x34')],_0x1fccab['filters']),_0x10076d);if(_0x14e7da['query']['filter']){_0x31b83b['where']=_[_0x9a69('0x3e')](_0x31b83b[_0x9a69('0x3d')],{'$or':_['map'](_0x10076d,function(_0x47c1fc){if(_0x47c1fc['type']!==_0x9a69('0x3f')){var _0x1ca2a2={};_0x1ca2a2[_0x47c1fc[_0x9a69('0x33')]]={'$like':'%'+_0x14e7da['query'][_0x9a69('0x40')]+'%'};return _0x1ca2a2;}})});}_0x31b83b=_[_0x9a69('0x3e')]({},_0x31b83b,_0x14e7da[_0x9a69('0x41')]);var _0x2914a4={'where':_0x31b83b[_0x9a69('0x3d')]};return db[_0x9a69('0x2d')]['count'](_0x2914a4)[_0x9a69('0x26')](function(_0x27d0db){_0x10e247[_0x9a69('0x20')]=_0x27d0db;if(_0x14e7da[_0x9a69('0x34')]['includeAll']){_0x31b83b[_0x9a69('0x42')]=[{'all':!![]}];}return db[_0x9a69('0x2d')]['findAll'](_0x31b83b);})[_0x9a69('0x26')](function(_0x3c78e2){_0x10e247[_0x9a69('0x43')]=_0x3c78e2;return _0x10e247;})['then'](respondWithFilteredResult(_0x2d15e3,_0x31b83b))['catch'](handleError(_0x2d15e3,null));};exports['show']=function(_0x2645e7,_0x7115b1){var _0x17a6bd={'raw':![],'where':{'id':_0x2645e7['params']['id']}},_0x436371={};_0x436371[_0x9a69('0x32')]=_[_0x9a69('0x44')](db[_0x9a69('0x2d')][_0x9a69('0x2e')]);_0x436371['query']=_[_0x9a69('0x44')](_0x2645e7[_0x9a69('0x34')]);_0x436371[_0x9a69('0x35')]=_[_0x9a69('0x36')](_0x436371['model'],_0x436371[_0x9a69('0x34')]);_0x17a6bd['attributes']=_[_0x9a69('0x36')](_0x436371['model'],qs[_0x9a69('0x38')](_0x2645e7['query'][_0x9a69('0x38')]));_0x17a6bd['attributes']=_0x17a6bd[_0x9a69('0x37')][_0x9a69('0x39')]?_0x17a6bd[_0x9a69('0x37')]:_0x436371[_0x9a69('0x32')];if(_0x2645e7['query'][_0x9a69('0x45')]){_0x17a6bd[_0x9a69('0x42')]=[{'all':!![]}];}_0x17a6bd=_[_0x9a69('0x3e')]({},_0x17a6bd,_0x2645e7[_0x9a69('0x41')]);return db[_0x9a69('0x2d')][_0x9a69('0x46')](_0x17a6bd)[_0x9a69('0x26')](handleEntityNotFound(_0x7115b1,null))[_0x9a69('0x26')](respondWithResult(_0x7115b1,null))[_0x9a69('0x47')](handleError(_0x7115b1,null));};exports['create']=function(_0x281ef0,_0x6046a7){return db[_0x9a69('0x2d')][_0x9a69('0x48')](_0x281ef0[_0x9a69('0x49')],{})[_0x9a69('0x26')](function(_0x1da268){var _0x41c2a9=_0x281ef0[_0x9a69('0x4a')][_0x9a69('0x27')]({'plain':!![]});if(!_0x41c2a9)throw new Error(_0x9a69('0x4b'));if(_0x41c2a9[_0x9a69('0x4c')]===_0x9a69('0x4a')){var _0x43b084=_0x1da268[_0x9a69('0x27')]({'plain':!![]});var _0x4c5b25=_0x9a69('0x28');return db[_0x9a69('0x4d')][_0x9a69('0x46')]({'where':{'name':_0x4c5b25,'userProfileId':_0x41c2a9[_0x9a69('0x4e')]},'raw':!![]})[_0x9a69('0x26')](function(_0x3d9ac2){if(_0x3d9ac2&&_0x3d9ac2[_0x9a69('0x4f')]===0x0){return db['UserProfileResource'][_0x9a69('0x48')]({'name':_0x43b084[_0x9a69('0x33')],'resourceId':_0x43b084['id'],'type':_0x3d9ac2[_0x9a69('0x33')],'sectionId':_0x3d9ac2['id']},{})[_0x9a69('0x26')](function(){return _0x1da268;});}else{return _0x1da268;}})[_0x9a69('0x47')](function(_0x32c826){logger[_0x9a69('0x29')](_0x9a69('0x50'),_0x32c826);throw _0x32c826;});}return _0x1da268;})[_0x9a69('0x26')](respondWithResult(_0x6046a7,0xc9))[_0x9a69('0x47')](handleError(_0x6046a7,null));};exports[_0x9a69('0x51')]=function(_0x546243,_0x29e337){if(_0x546243[_0x9a69('0x49')]['id']){delete _0x546243[_0x9a69('0x49')]['id'];}return db['VoiceChanSpy'][_0x9a69('0x46')]({'where':{'id':_0x546243['params']['id']}})['then'](handleEntityNotFound(_0x29e337,null))[_0x9a69('0x26')](saveUpdates(_0x546243[_0x9a69('0x49')],null))[_0x9a69('0x26')](respondWithResult(_0x29e337,null))[_0x9a69('0x47')](handleError(_0x29e337,null));};exports['destroy']=function(_0x5f3f2b,_0x42e685){return db['VoiceChanSpy'][_0x9a69('0x46')]({'where':{'id':_0x5f3f2b['params']['id']}})['then'](handleEntityNotFound(_0x42e685,null))[_0x9a69('0x26')](removeEntity(_0x42e685,null))[_0x9a69('0x47')](handleError(_0x42e685,null));}; \ No newline at end of file +var _0x9a62=['index','VoiceChanSpy','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','status','end','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','get','ChanSpies','UserProfileResource','destroy','sendStatus','error','stack','name'];(function(_0x356770,_0x5abe91){var _0xff2a1c=function(_0x1120dc){while(--_0x1120dc){_0x356770['push'](_0x356770['shift']());}};_0xff2a1c(++_0x5abe91);}(_0x9a62,0x1bc));var _0x29a6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9a62[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x29a6('0x0'));var zipdir=require(_0x29a6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x29a6('0x2'));var moment=require(_0x29a6('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x29a6('0x4'));var path=require(_0x29a6('0x5'));var sox=require(_0x29a6('0x6'));var csv=require(_0x29a6('0x7'));var ejs=require(_0x29a6('0x8'));var fs=require('fs');var fs_extra=require(_0x29a6('0x9'));var _=require(_0x29a6('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x29a6('0xb'));var deskjs=require(_0x29a6('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x29a6('0xd'));var Redis=require(_0x29a6('0xe'));var authService=require(_0x29a6('0xf'));var qs=require(_0x29a6('0x10'));var as=require(_0x29a6('0x11'));var hardwareService=require(_0x29a6('0x12'));var logger=require(_0x29a6('0x13'))('api');var utils=require(_0x29a6('0x14'));var config=require(_0x29a6('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e918f,_0x1d78fa){_0x1d78fa=_0x1d78fa||0xcc;return function(_0x7acc03){if(_0x7acc03){return _0x4e918f['sendStatus'](_0x1d78fa);}return _0x4e918f[_0x29a6('0x16')](_0x1d78fa)[_0x29a6('0x17')]();};}function respondWithResult(_0x535e3a,_0x50c663){_0x50c663=_0x50c663||0xc8;return function(_0x36d6fd){if(_0x36d6fd){return _0x535e3a[_0x29a6('0x16')](_0x50c663)['json'](_0x36d6fd);}};}function respondWithFilteredResult(_0x389255,_0x22378a){return function(_0x307dd9){if(_0x307dd9){var _0x4fef5c=typeof _0x22378a[_0x29a6('0x18')]===_0x29a6('0x19')&&typeof _0x22378a[_0x29a6('0x1a')]===_0x29a6('0x19');var _0x2ccb06=_0x307dd9[_0x29a6('0x1b')];var _0xa3d845=_0x4fef5c?0x0:_0x22378a[_0x29a6('0x18')];var _0x4c8cbc=_0x4fef5c?_0x307dd9[_0x29a6('0x1b')]:_0x22378a['offset']+_0x22378a[_0x29a6('0x1a')];var _0x35bc3b;if(_0x4c8cbc>=_0x2ccb06){_0x4c8cbc=_0x2ccb06;_0x35bc3b=0xc8;}else{_0x35bc3b=0xce;}_0x389255[_0x29a6('0x16')](_0x35bc3b);return _0x389255['set'](_0x29a6('0x1c'),_0xa3d845+'-'+_0x4c8cbc+'/'+_0x2ccb06)['json'](_0x307dd9);}return null;};}function patchUpdates(_0x4da844){return function(_0x5a8d55){try{jsonpatch[_0x29a6('0x1d')](_0x5a8d55,_0x4da844,!![]);}catch(_0x319573){return BPromise[_0x29a6('0x1e')](_0x319573);}return _0x5a8d55[_0x29a6('0x1f')]();};}function saveUpdates(_0x36c103,_0x552bc7){return function(_0x13341e){if(_0x13341e){return _0x13341e[_0x29a6('0x20')](_0x36c103)[_0x29a6('0x21')](function(_0x3ed7de){return _0x3ed7de;});}return null;};}function removeEntity(_0x46fcc7,_0x2dc6c0){return function(_0xedfa4){if(_0xedfa4){return _0xedfa4['destroy']()[_0x29a6('0x21')](function(){var _0xfdd465=_0xedfa4[_0x29a6('0x22')]({'plain':!![]});var _0x2280f7=_0x29a6('0x23');return db[_0x29a6('0x24')][_0x29a6('0x25')]({'where':{'type':_0x2280f7,'resourceId':_0xfdd465['id']}})['then'](function(){return _0xedfa4;});})['then'](function(){_0x46fcc7[_0x29a6('0x16')](0xcc)[_0x29a6('0x17')]();});}};}function handleEntityNotFound(_0x291dff,_0x6f9041){return function(_0x237f3e){if(!_0x237f3e){_0x291dff[_0x29a6('0x26')](0x194);}return _0x237f3e;};}function handleError(_0x596a0b,_0x570517){_0x570517=_0x570517||0x1f4;return function(_0x31c2e4){logger[_0x29a6('0x27')](_0x31c2e4[_0x29a6('0x28')]);if(_0x31c2e4[_0x29a6('0x29')]){delete _0x31c2e4[_0x29a6('0x29')];}_0x596a0b['status'](_0x570517)['send'](_0x31c2e4);};}exports[_0x29a6('0x2a')]=function(_0x1bdf5f,_0x1d5cf2){var _0x4250f4={},_0x3b6394={},_0x3a58e0={'count':0x0,'rows':[]};var _0x4b5019=_['map'](db[_0x29a6('0x2b')][_0x29a6('0x2c')],function(_0x388ff3){return{'name':_0x388ff3[_0x29a6('0x2d')],'type':_0x388ff3[_0x29a6('0x2e')][_0x29a6('0x2f')]};});_0x3b6394[_0x29a6('0x30')]=_['map'](_0x4b5019,_0x29a6('0x29'));_0x3b6394[_0x29a6('0x31')]=_[_0x29a6('0x32')](_0x1bdf5f[_0x29a6('0x31')]);_0x3b6394[_0x29a6('0x33')]=_[_0x29a6('0x34')](_0x3b6394[_0x29a6('0x30')],_0x3b6394[_0x29a6('0x31')]);_0x4250f4[_0x29a6('0x35')]=_['intersection'](_0x3b6394[_0x29a6('0x30')],qs[_0x29a6('0x36')](_0x1bdf5f[_0x29a6('0x31')][_0x29a6('0x36')]));_0x4250f4[_0x29a6('0x35')]=_0x4250f4[_0x29a6('0x35')][_0x29a6('0x37')]?_0x4250f4['attributes']:_0x3b6394['model'];if(!_0x1bdf5f['query'][_0x29a6('0x38')](_0x29a6('0x39'))){_0x4250f4[_0x29a6('0x1a')]=qs[_0x29a6('0x1a')](_0x1bdf5f[_0x29a6('0x31')][_0x29a6('0x1a')]);_0x4250f4['offset']=qs[_0x29a6('0x18')](_0x1bdf5f[_0x29a6('0x31')]['offset']);}_0x4250f4[_0x29a6('0x3a')]=qs[_0x29a6('0x3b')](_0x1bdf5f['query'][_0x29a6('0x3b')]);_0x4250f4[_0x29a6('0x3c')]=qs[_0x29a6('0x33')](_['pick'](_0x1bdf5f[_0x29a6('0x31')],_0x3b6394[_0x29a6('0x33')]),_0x4b5019);if(_0x1bdf5f[_0x29a6('0x31')]['filter']){_0x4250f4['where']=_[_0x29a6('0x3d')](_0x4250f4['where'],{'$or':_[_0x29a6('0x3e')](_0x4b5019,function(_0x82be9f){if(_0x82be9f['type']!==_0x29a6('0x3f')){var _0x417bb5={};_0x417bb5[_0x82be9f[_0x29a6('0x29')]]={'$like':'%'+_0x1bdf5f[_0x29a6('0x31')][_0x29a6('0x40')]+'%'};return _0x417bb5;}})});}_0x4250f4=_[_0x29a6('0x3d')]({},_0x4250f4,_0x1bdf5f[_0x29a6('0x41')]);var _0x3621a3={'where':_0x4250f4[_0x29a6('0x3c')]};return db[_0x29a6('0x2b')][_0x29a6('0x1b')](_0x3621a3)[_0x29a6('0x21')](function(_0x44351d){_0x3a58e0['count']=_0x44351d;if(_0x1bdf5f[_0x29a6('0x31')][_0x29a6('0x42')]){_0x4250f4[_0x29a6('0x43')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0x29a6('0x44')](_0x4250f4);})['then'](function(_0x46dc89){_0x3a58e0[_0x29a6('0x45')]=_0x46dc89;return _0x3a58e0;})[_0x29a6('0x21')](respondWithFilteredResult(_0x1d5cf2,_0x4250f4))[_0x29a6('0x46')](handleError(_0x1d5cf2,null));};exports['show']=function(_0x100be4,_0x4556f7){var _0x245c32={'raw':![],'where':{'id':_0x100be4[_0x29a6('0x47')]['id']}},_0x4a4bf0={};_0x4a4bf0[_0x29a6('0x30')]=_['keys'](db[_0x29a6('0x2b')][_0x29a6('0x2c')]);_0x4a4bf0[_0x29a6('0x31')]=_[_0x29a6('0x32')](_0x100be4[_0x29a6('0x31')]);_0x4a4bf0[_0x29a6('0x33')]=_[_0x29a6('0x34')](_0x4a4bf0[_0x29a6('0x30')],_0x4a4bf0[_0x29a6('0x31')]);_0x245c32[_0x29a6('0x35')]=_[_0x29a6('0x34')](_0x4a4bf0[_0x29a6('0x30')],qs[_0x29a6('0x36')](_0x100be4[_0x29a6('0x31')][_0x29a6('0x36')]));_0x245c32[_0x29a6('0x35')]=_0x245c32['attributes']['length']?_0x245c32['attributes']:_0x4a4bf0[_0x29a6('0x30')];if(_0x100be4['query'][_0x29a6('0x42')]){_0x245c32['include']=[{'all':!![]}];}_0x245c32=_['merge']({},_0x245c32,_0x100be4[_0x29a6('0x41')]);return db['VoiceChanSpy'][_0x29a6('0x48')](_0x245c32)[_0x29a6('0x21')](handleEntityNotFound(_0x4556f7,null))['then'](respondWithResult(_0x4556f7,null))[_0x29a6('0x46')](handleError(_0x4556f7,null));};exports[_0x29a6('0x49')]=function(_0x2c7556,_0x477085){return db[_0x29a6('0x2b')][_0x29a6('0x49')](_0x2c7556[_0x29a6('0x4a')],{})[_0x29a6('0x21')](function(_0x918a8b){var _0x3e631b=_0x2c7556['user'][_0x29a6('0x22')]({'plain':!![]});if(!_0x3e631b)throw new Error(_0x29a6('0x4b'));if(_0x3e631b[_0x29a6('0x4c')]===_0x29a6('0x4d')){var _0x5671db=_0x918a8b[_0x29a6('0x22')]({'plain':!![]});var _0x36ce7e='ChanSpies';return db['UserProfileSection']['find']({'where':{'name':_0x36ce7e,'userProfileId':_0x3e631b[_0x29a6('0x4e')]},'raw':!![]})[_0x29a6('0x21')](function(_0x6e2ab5){if(_0x6e2ab5&&_0x6e2ab5[_0x29a6('0x4f')]===0x0){return db['UserProfileResource'][_0x29a6('0x49')]({'name':_0x5671db[_0x29a6('0x29')],'resourceId':_0x5671db['id'],'type':_0x6e2ab5['name'],'sectionId':_0x6e2ab5['id']},{})[_0x29a6('0x21')](function(){return _0x918a8b;});}else{return _0x918a8b;}})[_0x29a6('0x46')](function(_0x40f52b){logger[_0x29a6('0x27')](_0x29a6('0x50'),_0x40f52b);throw _0x40f52b;});}return _0x918a8b;})[_0x29a6('0x21')](respondWithResult(_0x477085,0xc9))['catch'](handleError(_0x477085,null));};exports[_0x29a6('0x20')]=function(_0x371313,_0x4ab03f){if(_0x371313[_0x29a6('0x4a')]['id']){delete _0x371313['body']['id'];}return db[_0x29a6('0x2b')]['find']({'where':{'id':_0x371313[_0x29a6('0x47')]['id']}})[_0x29a6('0x21')](handleEntityNotFound(_0x4ab03f,null))[_0x29a6('0x21')](saveUpdates(_0x371313[_0x29a6('0x4a')],null))['then'](respondWithResult(_0x4ab03f,null))[_0x29a6('0x46')](handleError(_0x4ab03f,null));};exports[_0x29a6('0x25')]=function(_0x2d244f,_0x49a9a9){return db['VoiceChanSpy']['find']({'where':{'id':_0x2d244f['params']['id']}})['then'](handleEntityNotFound(_0x49a9a9,null))[_0x29a6('0x21')](removeEntity(_0x49a9a9,null))[_0x29a6('0x46')](handleError(_0x49a9a9,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 3ed28d9..bec19eb 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 _0xf646=['lodash','bluebird','context','format','%s%s','prefix','system','merge','Set','CDR(type)=%s','record','push','MixMonitor','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','concat','internal','findAll','agent','then','catch','exports','models','define','voice_chanspy','length','VoiceExtension','destroy'];(function(_0x3e3d3a,_0x564979){var _0x1de2eb=function(_0x3594cf){while(--_0x3594cf){_0x3e3d3a['push'](_0x3e3d3a['shift']());}};_0x1de2eb(++_0x564979);}(_0xf646,0x1d4));var _0x6f64=function(_0x5a4dd3,_0x29da5f){_0x5a4dd3=_0x5a4dd3-0x0;var _0x4677c0=_0xf646[_0x5a4dd3];return _0x4677c0;};'use strict';var _=require(_0x6f64('0x0'));var util=require('util');var BPromise=require(_0x6f64('0x1'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x58d390,_0x40e02c,_0x190ef9){var _0x3699d4=0x1;var _0x47882e=[];var _0x412979={'context':_0x40e02c[_0x6f64('0x2')]||'from-sip','exten':util[_0x6f64('0x3')](_0x6f64('0x4'),_0x58d390[_0x6f64('0x5')],_0x190ef9),'type':_0x6f64('0x6'),'isApp':![],'ChanSpyId':_0x58d390['id'],'UserId':_0x40e02c['id']};_0x47882e['push'](_[_0x6f64('0x7')]({'app':_0x6f64('0x8'),'appdata':util[_0x6f64('0x3')](_0x6f64('0x9'),'chanspy'),'priority':_0x3699d4++},_0x412979));if(_0x58d390[_0x6f64('0xa')]){_0x47882e[_0x6f64('0xb')](_['merge']({'app':_0x6f64('0xc'),'appdata':util['format']('${UNIQUEID}.%s,a',_0x58d390[_0x6f64('0xd')]),'priority':_0x3699d4++},_0x412979));}if(_0x58d390[_0x6f64('0xe')]){_0x47882e[_0x6f64('0xb')](_['merge']({'app':_0x6f64('0xf'),'appdata':_0x58d390[_0x6f64('0x10')],'priority':_0x3699d4++},_0x412979));}_0x47882e[_0x6f64('0xb')](_[_0x6f64('0x7')]({'app':_0x6f64('0x11'),'appdata':util['format'](_0x6f64('0x12'),_0x40e02c[_0x6f64('0x13')],_0x58d390[_0x6f64('0x14')]?_0x58d390['options'][_0x6f64('0x15')](''):''),'priority':_0x3699d4++},_0x412979));if(_0x58d390['record']){_0x47882e[_0x6f64('0xb')](_['merge']({'app':_0x6f64('0x16'),'priority':_0x3699d4++},_0x412979));}return _0x47882e;};var getChanSpyApplications=function(_0xae4a91,_0x463c66){var _0x305fd8=[];for(var _0x5e5c96=0x0,_0x40f507=0x1;_0x5e5c96<_0x463c66['length'];_0x5e5c96++,_0x40f507=0x1){_0x305fd8=_0x305fd8[_0x6f64('0x17')](getUserApplications(_0xae4a91,_0x463c66[_0x5e5c96],_0x463c66[_0x5e5c96][_0x6f64('0x18')]));if(_0x463c66[_0x5e5c96]['internal']!=_0x463c66[_0x5e5c96][_0x6f64('0x13')]){_0x305fd8=_0x305fd8['concat'](getUserApplications(_0xae4a91,_0x463c66[_0x5e5c96],_0x463c66[_0x5e5c96][_0x6f64('0x13')]));}}return _0x305fd8;};var getChanSpyPromise=function(_0x8d65df,_0x4a1fef){return new BPromise(function(_0x16aaa6,_0x3fbb3b){return _0x8d65df['User'][_0x6f64('0x19')]({'attributes':['id',_0x6f64('0x13'),_0x6f64('0x18')],'where':{'role':_0x6f64('0x1a'),'chanspy':!![]},'raw':!![]})[_0x6f64('0x1b')](function(_0x18d792){if(_0x18d792){return _0x16aaa6(getChanSpyApplications(_0x4a1fef,_0x18d792));}return _0x16aaa6([]);})[_0x6f64('0x1c')](function(_0x28cc1c){_0x3fbb3b(_0x28cc1c);});});};module[_0x6f64('0x1d')]=function(_0x58afcf,_0x5654a9){var _0x8a3fda=_0x58afcf[_0x6f64('0x1e')];return _0x58afcf[_0x6f64('0x1f')]('VoiceChanSpy',attributes,{'tableName':_0x6f64('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x48a397,_0x1b5d78,_0x36c0f3){return getChanSpyPromise(_0x8a3fda,_0x48a397)[_0x6f64('0x1b')](function(_0x2bb149){if(_0x2bb149&&_0x2bb149[_0x6f64('0x21')]){return _0x8a3fda['VoiceExtension']['bulkCreate'](_0x2bb149);}})[_0x6f64('0x1b')](function(){_0x36c0f3();})[_0x6f64('0x1c')](function(_0x3624ca){_0x36c0f3(_0x3624ca);});},'afterUpdate':function(_0x364215,_0x9169f7,_0x37f47d){return _0x8a3fda[_0x6f64('0x22')]['destroy']({'where':{'ChanSpyId':_0x364215['id']}})[_0x6f64('0x1b')](function(){return getChanSpyPromise(_0x8a3fda,_0x364215);})['then'](function(_0x243265){if(_0x243265&&_0x243265[_0x6f64('0x21')]){return _0x8a3fda[_0x6f64('0x22')]['bulkCreate'](_0x243265);}})[_0x6f64('0x1b')](function(){_0x37f47d();})[_0x6f64('0x1c')](function(_0xb91108){_0x37f47d(_0xb91108);});},'afterDestroy':function(_0x4c5195,_0x13fef9,_0x1b5cc2){return _0x8a3fda[_0x6f64('0x22')][_0x6f64('0x23')]({'where':{'ChanSpyId':_0x4c5195['id']}})[_0x6f64('0x1b')](function(){_0x1b5cc2();})[_0x6f64('0x1c')](function(_0x54b671){_0x1b5cc2(_0x54b671);});}}});}; \ No newline at end of file +var _0x4ae4=['prefix','system','chanspy','record','push','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','merge','Authenticate','password','ChanSpy','SIP/%s,%s','options','join','StopMixMonitor','length','concat','internal','name','User','findAll','agent','then','catch','models','define','voice_chanspy','VoiceExtension','bulkCreate','destroy','lodash','bluebird','./voiceChanSpy.attributes','format','%s%s'];(function(_0x1ebc52,_0x2bcd09){var _0x2bef05=function(_0x3d3e6b){while(--_0x3d3e6b){_0x1ebc52['push'](_0x1ebc52['shift']());}};_0x2bef05(++_0x2bcd09);}(_0x4ae4,0x8f));var _0x44ae=function(_0x4fc3d7,_0x13777d){_0x4fc3d7=_0x4fc3d7-0x0;var _0x4ece22=_0x4ae4[_0x4fc3d7];return _0x4ece22;};'use strict';var _=require(_0x44ae('0x0'));var util=require('util');var BPromise=require(_0x44ae('0x1'));var attributes=require(_0x44ae('0x2'));var getUserApplications=function(_0x2fd909,_0x49468c,_0x242deb){var _0x502969=0x1;var _0x1a509c=[];var _0x32e4b6={'context':_0x49468c['context']||'from-sip','exten':util[_0x44ae('0x3')](_0x44ae('0x4'),_0x2fd909[_0x44ae('0x5')],_0x242deb),'type':_0x44ae('0x6'),'isApp':![],'ChanSpyId':_0x2fd909['id'],'UserId':_0x49468c['id']};_0x1a509c['push'](_['merge']({'app':'Set','appdata':util[_0x44ae('0x3')]('CDR(type)=%s',_0x44ae('0x7')),'priority':_0x502969++},_0x32e4b6));if(_0x2fd909[_0x44ae('0x8')]){_0x1a509c[_0x44ae('0x9')](_['merge']({'app':_0x44ae('0xa'),'appdata':util[_0x44ae('0x3')](_0x44ae('0xb'),_0x2fd909[_0x44ae('0xc')]),'priority':_0x502969++},_0x32e4b6));}if(_0x2fd909[_0x44ae('0xd')]){_0x1a509c[_0x44ae('0x9')](_[_0x44ae('0xe')]({'app':_0x44ae('0xf'),'appdata':_0x2fd909[_0x44ae('0x10')],'priority':_0x502969++},_0x32e4b6));}_0x1a509c[_0x44ae('0x9')](_[_0x44ae('0xe')]({'app':_0x44ae('0x11'),'appdata':util[_0x44ae('0x3')](_0x44ae('0x12'),_0x49468c['name'],_0x2fd909[_0x44ae('0x13')]?_0x2fd909[_0x44ae('0x13')][_0x44ae('0x14')](''):''),'priority':_0x502969++},_0x32e4b6));if(_0x2fd909[_0x44ae('0x8')]){_0x1a509c['push'](_['merge']({'app':_0x44ae('0x15'),'priority':_0x502969++},_0x32e4b6));}return _0x1a509c;};var getChanSpyApplications=function(_0xcfbe83,_0x527c4b){var _0x51f037=[];for(var _0x38d545=0x0,_0x4ba343=0x1;_0x38d545<_0x527c4b[_0x44ae('0x16')];_0x38d545++,_0x4ba343=0x1){_0x51f037=_0x51f037[_0x44ae('0x17')](getUserApplications(_0xcfbe83,_0x527c4b[_0x38d545],_0x527c4b[_0x38d545][_0x44ae('0x18')]));if(_0x527c4b[_0x38d545][_0x44ae('0x18')]!=_0x527c4b[_0x38d545][_0x44ae('0x19')]){_0x51f037=_0x51f037[_0x44ae('0x17')](getUserApplications(_0xcfbe83,_0x527c4b[_0x38d545],_0x527c4b[_0x38d545][_0x44ae('0x19')]));}}return _0x51f037;};var getChanSpyPromise=function(_0x142699,_0x4022ef){return new BPromise(function(_0x154d07,_0xf95a33){return _0x142699[_0x44ae('0x1a')][_0x44ae('0x1b')]({'attributes':['id','name','internal'],'where':{'role':_0x44ae('0x1c'),'chanspy':!![]},'raw':!![]})[_0x44ae('0x1d')](function(_0x390934){if(_0x390934){return _0x154d07(getChanSpyApplications(_0x4022ef,_0x390934));}return _0x154d07([]);})[_0x44ae('0x1e')](function(_0x3d3446){_0xf95a33(_0x3d3446);});});};module['exports']=function(_0x599c6b,_0x19037d){var _0x2152fb=_0x599c6b[_0x44ae('0x1f')];return _0x599c6b[_0x44ae('0x20')]('VoiceChanSpy',attributes,{'tableName':_0x44ae('0x21'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x11d8da,_0x22846f,_0x4f12bd){return getChanSpyPromise(_0x2152fb,_0x11d8da)[_0x44ae('0x1d')](function(_0x35844c){if(_0x35844c&&_0x35844c[_0x44ae('0x16')]){return _0x2152fb[_0x44ae('0x22')][_0x44ae('0x23')](_0x35844c);}})[_0x44ae('0x1d')](function(){_0x4f12bd();})[_0x44ae('0x1e')](function(_0x5189d3){_0x4f12bd(_0x5189d3);});},'afterUpdate':function(_0x4e8322,_0x53cacd,_0x1e6fc9){return _0x2152fb[_0x44ae('0x22')][_0x44ae('0x24')]({'where':{'ChanSpyId':_0x4e8322['id']}})[_0x44ae('0x1d')](function(){return getChanSpyPromise(_0x2152fb,_0x4e8322);})[_0x44ae('0x1d')](function(_0x34c97e){if(_0x34c97e&&_0x34c97e[_0x44ae('0x16')]){return _0x2152fb[_0x44ae('0x22')][_0x44ae('0x23')](_0x34c97e);}})[_0x44ae('0x1d')](function(){_0x1e6fc9();})[_0x44ae('0x1e')](function(_0x280458){_0x1e6fc9(_0x280458);});},'afterDestroy':function(_0x2d8261,_0xc9cc1a,_0x11946f){return _0x2152fb[_0x44ae('0x22')][_0x44ae('0x24')]({'where':{'ChanSpyId':_0x2d8261['id']}})['then'](function(){_0x11946f();})[_0x44ae('0x1e')](function(_0x47805e){_0x11946f(_0x47805e);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index fbd45d3..c283a84 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 _0x0db9=['code','message','catch','lodash','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2d2ca6,_0x719754){var _0x4104fb=function(_0x2561f9){while(--_0x2561f9){_0x2d2ca6['push'](_0x2d2ca6['shift']());}};_0x4104fb(++_0x719754);}(_0x0db9,0xa3));var _0x90db=function(_0x119cd8,_0x556b73){_0x119cd8=_0x119cd8-0x0;var _0x7072a3=_0x0db9[_0x119cd8];return _0x7072a3;};'use strict';var _=require(_0x90db('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x90db('0x1'));var fs=require('fs');var Redis=require(_0x90db('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x90db('0x3'));var logger=require('../../config/logger')(_0x90db('0x4'));var config=require(_0x90db('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x90db('0x6')][_0x90db('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x476491,_0xee21f8,_0x915ca){return new BPromise(function(_0x9b6d0d,_0x4b0c1d){return client[_0x90db('0x8')](_0x476491,_0x915ca)[_0x90db('0x9')](function(_0x39512e){logger[_0x90db('0xa')](_0x90db('0xb'),_0xee21f8,_0x90db('0xc'));logger[_0x90db('0xd')](_0x90db('0xe'),_0xee21f8,_0x90db('0xc'),JSON[_0x90db('0xf')](_0x39512e));if(_0x39512e[_0x90db('0x10')]){if(_0x39512e['error'][_0x90db('0x11')]===0x1f4){logger[_0x90db('0x10')](_0x90db('0xb'),_0xee21f8,_0x39512e[_0x90db('0x10')][_0x90db('0x12')]);return _0x4b0c1d(_0x39512e[_0x90db('0x10')][_0x90db('0x12')]);}logger[_0x90db('0x10')](_0x90db('0xb'),_0xee21f8,_0x39512e[_0x90db('0x10')][_0x90db('0x12')]);return _0x9b6d0d(_0x39512e[_0x90db('0x10')][_0x90db('0x12')]);}else{logger[_0x90db('0xa')]('VoiceChanSpy,\x20%s,\x20%s',_0xee21f8,_0x90db('0xc'));_0x9b6d0d(_0x39512e['result'][_0x90db('0x12')]);}})[_0x90db('0x13')](function(_0x3de860){logger[_0x90db('0x10')](_0x90db('0xb'),_0xee21f8,_0x3de860);_0x4b0c1d(_0x3de860);});});} \ No newline at end of file +var _0x44a3=['http','request','then','info','request\x20sent','debug','error','code','message','VoiceChanSpy,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x2830e2,_0x534445){var _0x2c31da=function(_0x3b6ba4){while(--_0x3b6ba4){_0x2830e2['push'](_0x2830e2['shift']());}};_0x2c31da(++_0x534445);}(_0x44a3,0x1a9));var _0x344a=function(_0x23b3e0,_0x802d57){_0x23b3e0=_0x23b3e0-0x0;var _0x122558=_0x44a3[_0x23b3e0];return _0x122558;};'use strict';var _=require(_0x344a('0x0'));var util=require(_0x344a('0x1'));var moment=require(_0x344a('0x2'));var BPromise=require(_0x344a('0x3'));var rs=require(_0x344a('0x4'));var fs=require('fs');var Redis=require(_0x344a('0x5'));var db=require(_0x344a('0x6'))['db'];var utils=require(_0x344a('0x7'));var logger=require('../../config/logger')(_0x344a('0x8'));var config=require(_0x344a('0x9'));var jayson=require(_0x344a('0xa'));var client=jayson[_0x344a('0xb')][_0x344a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x504bd1,_0x553d97,_0x55ddca){return new BPromise(function(_0x484661,_0x475dab){return client[_0x344a('0xd')](_0x504bd1,_0x55ddca)[_0x344a('0xe')](function(_0x233ca1){logger[_0x344a('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0x553d97,_0x344a('0x10'));logger[_0x344a('0x11')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x553d97,_0x344a('0x10'),JSON['stringify'](_0x233ca1));if(_0x233ca1[_0x344a('0x12')]){if(_0x233ca1['error'][_0x344a('0x13')]===0x1f4){logger[_0x344a('0x12')]('VoiceChanSpy,\x20%s,\x20%s',_0x553d97,_0x233ca1['error'][_0x344a('0x14')]);return _0x475dab(_0x233ca1[_0x344a('0x12')][_0x344a('0x14')]);}logger[_0x344a('0x12')](_0x344a('0x15'),_0x553d97,_0x233ca1[_0x344a('0x12')]['message']);return _0x484661(_0x233ca1[_0x344a('0x12')][_0x344a('0x14')]);}else{logger[_0x344a('0xf')](_0x344a('0x15'),_0x553d97,'request\x20sent');_0x484661(_0x233ca1['result'][_0x344a('0x14')]);}})[_0x344a('0x16')](function(_0x36227e){logger[_0x344a('0x12')]('VoiceChanSpy,\x20%s,\x20%s',_0x553d97,_0x36227e);_0x475dab(_0x36227e);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index be6e154..75f5d00 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 _0x8bc5=['fs-extra','../../components/auth/service','../../config/environment','./voiceContext.controller','isAuthenticated','index','get','/:id','show','post','create','put','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0xe1462e,_0x397c9d){var _0x286dc1=function(_0x367a48){while(--_0x367a48){_0xe1462e['push'](_0xe1462e['shift']());}};_0x286dc1(++_0x397c9d);}(_0x8bc5,0x105));var _0x58bc=function(_0x3b172a,_0x18da41){_0x3b172a=_0x3b172a-0x0;var _0x30b96a=_0x8bc5[_0x3b172a];return _0x30b96a;};'use strict';var multer=require(_0x58bc('0x0'));var util=require(_0x58bc('0x1'));var path=require(_0x58bc('0x2'));var timeout=require(_0x58bc('0x3'));var express=require(_0x58bc('0x4'));var router=express['Router']();var fs_extra=require(_0x58bc('0x5'));var auth=require(_0x58bc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x58bc('0x7'));var controller=require(_0x58bc('0x8'));router['get']('/',auth[_0x58bc('0x9')](),controller[_0x58bc('0xa')]);router[_0x58bc('0xb')](_0x58bc('0xc'),auth[_0x58bc('0x9')](),controller[_0x58bc('0xd')]);router[_0x58bc('0xe')]('/',auth['isAuthenticated'](),controller[_0x58bc('0xf')]);router[_0x58bc('0x10')](_0x58bc('0xc'),auth[_0x58bc('0x9')](),controller['update']);router[_0x58bc('0x11')](_0x58bc('0xc'),auth[_0x58bc('0x9')](),controller[_0x58bc('0x12')]);module['exports']=router; \ No newline at end of file +var _0xdda7=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','create','put','/:id','update','delete','destroy','exports'];(function(_0x4413a1,_0x55a868){var _0x184cf3=function(_0x52db9b){while(--_0x52db9b){_0x4413a1['push'](_0x4413a1['shift']());}};_0x184cf3(++_0x55a868);}(_0xdda7,0xcc));var _0x7dda=function(_0x3b7016,_0x381698){_0x3b7016=_0x3b7016-0x0;var _0x1c72b5=_0xdda7[_0x3b7016];return _0x1c72b5;};'use strict';var multer=require('multer');var util=require(_0x7dda('0x0'));var path=require('path');var timeout=require(_0x7dda('0x1'));var express=require(_0x7dda('0x2'));var router=express[_0x7dda('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7dda('0x4'));var interaction=require(_0x7dda('0x5'));var config=require(_0x7dda('0x6'));var controller=require('./voiceContext.controller');router[_0x7dda('0x7')]('/',auth[_0x7dda('0x8')](),controller['index']);router[_0x7dda('0x7')]('/:id',auth[_0x7dda('0x8')](),controller[_0x7dda('0x9')]);router['post']('/',auth[_0x7dda('0x8')](),controller[_0x7dda('0xa')]);router[_0x7dda('0xb')](_0x7dda('0xc'),auth['isAuthenticated'](),controller[_0x7dda('0xd')]);router[_0x7dda('0xe')](_0x7dda('0xc'),auth['isAuthenticated'](),controller[_0x7dda('0xf')]);module[_0x7dda('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 451ac9b..a82caf4 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 _0x3046=['name','BOOLEAN','sequelize','exports','STRING'];(function(_0x51731f,_0x15b4ce){var _0x35d00b=function(_0x3031d2){while(--_0x3031d2){_0x51731f['push'](_0x51731f['shift']());}};_0x35d00b(++_0x15b4ce);}(_0x3046,0x147));var _0x6304=function(_0x2ed880,_0x2ad96c){_0x2ed880=_0x2ed880-0x0;var _0x61faf=_0x3046[_0x2ed880];return _0x61faf;};'use strict';var Sequelize=require(_0x6304('0x0'));module[_0x6304('0x1')]={'name':{'type':Sequelize[_0x6304('0x2')],'unique':_0x6304('0x3')},'description':{'type':Sequelize[_0x6304('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x6304('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe4c7=['sequelize','STRING','name','BOOLEAN'];(function(_0xc8db78,_0x58b5a7){var _0x3483f3=function(_0x2089ee){while(--_0x2089ee){_0xc8db78['push'](_0xc8db78['shift']());}};_0x3483f3(++_0x58b5a7);}(_0xe4c7,0xf8));var _0x7e4c=function(_0x21afde,_0x4454ce){_0x21afde=_0x21afde-0x0;var _0x33cde=_0xe4c7[_0x21afde];return _0x33cde;};'use strict';var Sequelize=require(_0x7e4c('0x0'));module['exports']={'name':{'type':Sequelize[_0x7e4c('0x1')],'unique':_0x7e4c('0x2')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x7e4c('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 58ce625..f1e901a 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 _0xa35a=['crypto','desk.js','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','request','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','destroy','UserProfileResource','stack','name','index','map','VoiceContext','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','options','findAll','rows','show','length','includeAll','include','merge','create','readFileSync','join','server/files/templates/context.ejs','utf8','render','Reload','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Contexts','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','body','writeFileSync','chan_sip.so','/etc/asterisk/extensions_xcally_contexts.conf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash'];(function(_0x198ec7,_0x3b5b32){var _0x4bba9a=function(_0x3e5394){while(--_0x3e5394){_0x198ec7['push'](_0x198ec7['shift']());}};_0x4bba9a(++_0x3b5b32);}(_0xa35a,0xc3));var _0xaa35=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xa35a[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0xaa35('0x0'));var rimraf=require(_0xaa35('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xaa35('0x2'));var moment=require(_0xaa35('0x3'));var BPromise=require(_0xaa35('0x4'));var Mustache=require(_0xaa35('0x5'));var util=require(_0xaa35('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xaa35('0x7'));var ejs=require(_0xaa35('0x8'));var fs=require('fs');var fs_extra=require(_0xaa35('0x9'));var _=require(_0xaa35('0xa'));var squel=require('squel');var crypto=require(_0xaa35('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xaa35('0xc'));var toCsv=require(_0xaa35('0x7'));var querystring=require('querystring');var Papa=require(_0xaa35('0xd'));var Redis=require(_0xaa35('0xe'));var authService=require(_0xaa35('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xaa35('0x10'));var hardwareService=require(_0xaa35('0x11'));var logger=require(_0xaa35('0x12'))(_0xaa35('0x13'));var utils=require(_0xaa35('0x14'));var config=require(_0xaa35('0x15'));var licenseUtil=require(_0xaa35('0x16'));var db=require(_0xaa35('0x17'))['db'];var jayson=require(_0xaa35('0x18'));var client=jayson[_0xaa35('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x58d1a0,_0x59e1e3,_0x1a4fce,_0x4db440){return new BPromise(function(_0x3a99ee,_0x2fbd5a){var _0x420ccb=_0x4db440||client;return _0x420ccb[_0xaa35('0x1a')](_0x58d1a0,_0x1a4fce)[_0xaa35('0x1b')](function(_0x224a01){logger[_0xaa35('0x1c')](_0xaa35('0x1d'),_0x59e1e3,'request\x20sent');logger[_0xaa35('0x1e')](_0xaa35('0x1f'),_0x59e1e3,_0xaa35('0x20'),JSON['stringify'](_0x224a01));if(_0x224a01['error']){if(_0x224a01['error']['code']===0x1f4){logger[_0xaa35('0x21')](_0xaa35('0x1d'),_0x59e1e3,_0x224a01['error'][_0xaa35('0x22')]);return _0x2fbd5a(_0x224a01[_0xaa35('0x21')][_0xaa35('0x22')]);}logger[_0xaa35('0x21')](_0xaa35('0x1d'),_0x59e1e3,_0x224a01['error'][_0xaa35('0x22')]);return _0x3a99ee(_0x224a01[_0xaa35('0x21')][_0xaa35('0x22')]);}else{logger[_0xaa35('0x1c')]('VoiceContext,\x20%s,\x20%s',_0x59e1e3,_0xaa35('0x20'));_0x3a99ee(_0x224a01[_0xaa35('0x23')]['message']);}})[_0xaa35('0x24')](function(_0x48fbaf){logger[_0xaa35('0x21')](_0xaa35('0x1d'),_0x59e1e3,_0x48fbaf);_0x2fbd5a(_0x48fbaf);});});}function respondWithStatusCode(_0x247ca5,_0x44070d){_0x44070d=_0x44070d||0xcc;return function(_0x218c77){if(_0x218c77){return _0x247ca5[_0xaa35('0x25')](_0x44070d);}return _0x247ca5[_0xaa35('0x26')](_0x44070d)[_0xaa35('0x27')]();};}function respondWithResult(_0x38a832,_0x42edb3){_0x42edb3=_0x42edb3||0xc8;return function(_0x109a2d){if(_0x109a2d){return _0x38a832[_0xaa35('0x26')](_0x42edb3)[_0xaa35('0x28')](_0x109a2d);}};}function respondWithFilteredResult(_0x3e71fa,_0x3b64fb){return function(_0x2e4dad){if(_0x2e4dad){var _0x52f6ea=typeof _0x3b64fb['offset']===_0xaa35('0x29')&&typeof _0x3b64fb[_0xaa35('0x2a')]==='undefined';var _0x407a93=_0x2e4dad['count'];var _0x32571b=_0x52f6ea?0x0:_0x3b64fb[_0xaa35('0x2b')];var _0x3ced95=_0x52f6ea?_0x2e4dad[_0xaa35('0x2c')]:_0x3b64fb['offset']+_0x3b64fb[_0xaa35('0x2a')];var _0x3b69c6;if(_0x3ced95>=_0x407a93){_0x3ced95=_0x407a93;_0x3b69c6=0xc8;}else{_0x3b69c6=0xce;}_0x3e71fa[_0xaa35('0x26')](_0x3b69c6);return _0x3e71fa[_0xaa35('0x2d')](_0xaa35('0x2e'),_0x32571b+'-'+_0x3ced95+'/'+_0x407a93)[_0xaa35('0x28')](_0x2e4dad);}return null;};}function patchUpdates(_0x46d68e){return function(_0x293de4){try{jsonpatch[_0xaa35('0x2f')](_0x293de4,_0x46d68e,!![]);}catch(_0x1f4e84){return BPromise[_0xaa35('0x30')](_0x1f4e84);}return _0x293de4[_0xaa35('0x31')]();};}function saveUpdates(_0x59e9d3,_0x127990){return function(_0x102a62){if(_0x102a62){return _0x102a62[_0xaa35('0x32')](_0x59e9d3)[_0xaa35('0x1b')](function(_0x416695){return _0x416695;});}return null;};}function removeEntity(_0x656c8e,_0x156738){return function(_0x458bbb){if(_0x458bbb){return _0x458bbb[_0xaa35('0x33')]()[_0xaa35('0x1b')](function(){var _0x4f1480=_0x458bbb['get']({'plain':!![]});var _0x2b66a8='Contexts';return db[_0xaa35('0x34')][_0xaa35('0x33')]({'where':{'type':_0x2b66a8,'resourceId':_0x4f1480['id']}})[_0xaa35('0x1b')](function(){return _0x458bbb;});})[_0xaa35('0x1b')](function(){_0x656c8e[_0xaa35('0x26')](0xcc)[_0xaa35('0x27')]();});}};}function handleEntityNotFound(_0x1d0e3c,_0x56d490){return function(_0x308b38){if(!_0x308b38){_0x1d0e3c[_0xaa35('0x25')](0x194);}return _0x308b38;};}function handleError(_0x49164e,_0x1ed548){_0x1ed548=_0x1ed548||0x1f4;return function(_0xe6c392){logger[_0xaa35('0x21')](_0xe6c392[_0xaa35('0x35')]);if(_0xe6c392[_0xaa35('0x36')]){delete _0xe6c392[_0xaa35('0x36')];}_0x49164e[_0xaa35('0x26')](_0x1ed548)['send'](_0xe6c392);};}exports[_0xaa35('0x37')]=function(_0x1afe15,_0x2d5d5d){var _0x1da7fa={},_0x34b0de={},_0x18eefc={'count':0x0,'rows':[]};var _0x346944=_[_0xaa35('0x38')](db[_0xaa35('0x39')][_0xaa35('0x3a')],function(_0xf048f3){return{'name':_0xf048f3[_0xaa35('0x3b')],'type':_0xf048f3[_0xaa35('0x3c')][_0xaa35('0x3d')]};});_0x34b0de[_0xaa35('0x3e')]=_[_0xaa35('0x38')](_0x346944,_0xaa35('0x36'));_0x34b0de[_0xaa35('0x3f')]=_[_0xaa35('0x40')](_0x1afe15[_0xaa35('0x3f')]);_0x34b0de[_0xaa35('0x41')]=_['intersection'](_0x34b0de[_0xaa35('0x3e')],_0x34b0de['query']);_0x1da7fa[_0xaa35('0x42')]=_[_0xaa35('0x43')](_0x34b0de['model'],qs[_0xaa35('0x44')](_0x1afe15[_0xaa35('0x3f')][_0xaa35('0x44')]));_0x1da7fa[_0xaa35('0x42')]=_0x1da7fa[_0xaa35('0x42')]['length']?_0x1da7fa[_0xaa35('0x42')]:_0x34b0de[_0xaa35('0x3e')];if(!_0x1afe15[_0xaa35('0x3f')][_0xaa35('0x45')](_0xaa35('0x46'))){_0x1da7fa[_0xaa35('0x2a')]=qs['limit'](_0x1afe15[_0xaa35('0x3f')][_0xaa35('0x2a')]);_0x1da7fa[_0xaa35('0x2b')]=qs['offset'](_0x1afe15[_0xaa35('0x3f')][_0xaa35('0x2b')]);}_0x1da7fa[_0xaa35('0x47')]=qs['sort'](_0x1afe15['query']['sort']);_0x1da7fa[_0xaa35('0x48')]=qs[_0xaa35('0x41')](_[_0xaa35('0x49')](_0x1afe15[_0xaa35('0x3f')],_0x34b0de['filters']),_0x346944);if(_0x1afe15[_0xaa35('0x3f')][_0xaa35('0x4a')]){_0x1da7fa[_0xaa35('0x48')]=_['merge'](_0x1da7fa['where'],{'$or':_['map'](_0x346944,function(_0x4078dc){if(_0x4078dc[_0xaa35('0x3c')]!==_0xaa35('0x4b')){var _0x3dee2f={};_0x3dee2f[_0x4078dc['name']]={'$like':'%'+_0x1afe15['query'][_0xaa35('0x4a')]+'%'};return _0x3dee2f;}})});}_0x1da7fa=_['merge']({},_0x1da7fa,_0x1afe15[_0xaa35('0x4c')]);var _0x143040={'where':_0x1da7fa[_0xaa35('0x48')]};return db[_0xaa35('0x39')]['count'](_0x143040)[_0xaa35('0x1b')](function(_0x5e1e55){_0x18eefc[_0xaa35('0x2c')]=_0x5e1e55;if(_0x1afe15[_0xaa35('0x3f')]['includeAll']){_0x1da7fa['include']=[{'all':!![]}];}return db['VoiceContext'][_0xaa35('0x4d')](_0x1da7fa);})['then'](function(_0x1a388c){_0x18eefc[_0xaa35('0x4e')]=_0x1a388c;return _0x18eefc;})['then'](respondWithFilteredResult(_0x2d5d5d,_0x1da7fa))[_0xaa35('0x24')](handleError(_0x2d5d5d,null));};exports[_0xaa35('0x4f')]=function(_0x50996c,_0x27cd8b){var _0x13843b={'raw':![],'where':{'id':_0x50996c['params']['id']}},_0x40a310={};_0x40a310[_0xaa35('0x3e')]=_[_0xaa35('0x40')](db[_0xaa35('0x39')][_0xaa35('0x3a')]);_0x40a310['query']=_[_0xaa35('0x40')](_0x50996c[_0xaa35('0x3f')]);_0x40a310['filters']=_[_0xaa35('0x43')](_0x40a310[_0xaa35('0x3e')],_0x40a310[_0xaa35('0x3f')]);_0x13843b['attributes']=_[_0xaa35('0x43')](_0x40a310[_0xaa35('0x3e')],qs['fields'](_0x50996c[_0xaa35('0x3f')]['fields']));_0x13843b[_0xaa35('0x42')]=_0x13843b[_0xaa35('0x42')][_0xaa35('0x50')]?_0x13843b['attributes']:_0x40a310[_0xaa35('0x3e')];if(_0x50996c[_0xaa35('0x3f')][_0xaa35('0x51')]){_0x13843b[_0xaa35('0x52')]=[{'all':!![]}];}_0x13843b=_[_0xaa35('0x53')]({},_0x13843b,_0x50996c[_0xaa35('0x4c')]);return db[_0xaa35('0x39')]['find'](_0x13843b)['then'](handleEntityNotFound(_0x27cd8b,null))['then'](respondWithResult(_0x27cd8b,null))[_0xaa35('0x24')](handleError(_0x27cd8b,null));};exports[_0xaa35('0x54')]=function(_0x43a622,_0x1be7ad,_0x423367){var _0x2bb742;return db[_0xaa35('0x39')][_0xaa35('0x54')](_0x43a622['body'],{'raw':!![]})['then'](function(_0x44e3fc){_0x2bb742=_0x44e3fc;return db['VoiceContext'][_0xaa35('0x4d')]({'raw':!![]});})['then'](function(_0x3ddb7c){var _0x8b8774=fs[_0xaa35('0x55')](path[_0xaa35('0x56')](config['root'],_0xaa35('0x57')),_0xaa35('0x58'));var _0x360f9d=ejs[_0xaa35('0x59')](_0x8b8774,{'contexts':_0x3ddb7c||[]});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x360f9d);})['then'](function(){return respondWithRpcPromise(_0xaa35('0x5a'),_0xaa35('0x54'),{'module':'chan_sip.so'});})[_0xaa35('0x1b')](function(){var _0x4d3d36=_0x43a622[_0xaa35('0x5b')][_0xaa35('0x5c')]({'plain':!![]});if(!_0x4d3d36)throw new Error(_0xaa35('0x5d'));if(_0x4d3d36['role']===_0xaa35('0x5b')){var _0x13e11e=_0x2bb742[_0xaa35('0x5c')]({'plain':!![]});return db[_0xaa35('0x5e')]['find']({'where':{'name':_0xaa35('0x5f'),'userProfileId':_0x4d3d36[_0xaa35('0x60')]},'raw':!![]})[_0xaa35('0x1b')](function(_0x2e8c8b){if(_0x2e8c8b&&_0x2e8c8b['autoAssociation']===0x0){return db[_0xaa35('0x34')][_0xaa35('0x54')]({'name':_0x13e11e[_0xaa35('0x36')],'resourceId':_0x13e11e['id'],'type':_0x2e8c8b[_0xaa35('0x36')],'sectionId':_0x2e8c8b['id']},{})[_0xaa35('0x1b')](function(){return _0x2bb742;});}else{return _0x2bb742;}})[_0xaa35('0x24')](function(_0x32096c){logger[_0xaa35('0x21')](_0xaa35('0x61'),_0x32096c);throw _0x32096c;});}return _0x2bb742;})[_0xaa35('0x1b')](respondWithResult(_0x1be7ad,0xc9))['catch'](handleError(_0x1be7ad,null));};exports[_0xaa35('0x32')]=function(_0x4f9055,_0xf92681,_0x321472){var _0x2ccc89;return db[_0xaa35('0x39')]['find']({'where':{'id':_0x4f9055[_0xaa35('0x62')]['id']}})[_0xaa35('0x1b')](handleEntityNotFound(_0xf92681,null))['then'](saveUpdates(_0x4f9055[_0xaa35('0x63')],null))[_0xaa35('0x1b')](function(_0x5f21fd){if(_0x5f21fd){_0x2ccc89=_0x5f21fd;return db[_0xaa35('0x39')][_0xaa35('0x4d')]({'raw':!![]});}})['then'](function(_0x3cbddc){var _0x7be0b0=fs[_0xaa35('0x55')](path[_0xaa35('0x56')](config['root'],_0xaa35('0x57')),_0xaa35('0x58'));var _0x18875a=ejs[_0xaa35('0x59')](_0x7be0b0,{'contexts':_0x3cbddc||[]});fs[_0xaa35('0x64')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x18875a);})[_0xaa35('0x1b')](function(){return respondWithRpcPromise(_0xaa35('0x5a'),_0xaa35('0x32'),{'module':_0xaa35('0x65')});})[_0xaa35('0x1b')](function(){return _0x2ccc89;})[_0xaa35('0x1b')](respondWithResult(_0xf92681,null))[_0xaa35('0x24')](handleError(_0xf92681,null));};exports['destroy']=function(_0x14ab1d,_0x48d9ed,_0x463e3f){var _0x3d2209;return db[_0xaa35('0x39')]['find']({'where':{'id':_0x14ab1d[_0xaa35('0x62')]['id']}})[_0xaa35('0x1b')](handleEntityNotFound(_0x48d9ed,null))[_0xaa35('0x1b')](removeEntity(_0x48d9ed,null))[_0xaa35('0x1b')](function(){return db[_0xaa35('0x39')][_0xaa35('0x4d')]({'raw':!![]});})['then'](function(_0x4b293f){var _0x10b76d=fs[_0xaa35('0x55')](path[_0xaa35('0x56')](config['root'],'server/files/templates/context.ejs'),'utf8');var _0x380ceb=ejs['render'](_0x10b76d,{'contexts':_0x4b293f});fs[_0xaa35('0x64')](_0xaa35('0x66'),_0x380ceb);return respondWithRpcPromise(_0xaa35('0x5a'),_0xaa35('0x33'),{'module':'chan_sip.so'});})['catch'](handleError(_0x48d9ed,null));}; \ No newline at end of file +var _0xa7fb=['Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','server/files/templates/context.ejs','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','get','Contexts','UserProfileResource','destroy','stack','name','send','map','VoiceContext','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','order','sort','filters','pick','where','VIRTUAL','filter','options','includeAll','include','rows','params','length','merge','find','create','body','findAll','readFileSync','join','root','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf'];(function(_0x2bc05f,_0x2df7ce){var _0x49950a=function(_0x4fb3a1){while(--_0x4fb3a1){_0x2bc05f['push'](_0x2bc05f['shift']());}};_0x49950a(++_0x2df7ce);}(_0xa7fb,0x1b5));var _0xba7f=function(_0x4323d4,_0x1c38df){_0x4323d4=_0x4323d4-0x0;var _0x1c3864=_0xa7fb[_0x4323d4];return _0x1c3864;};'use strict';var emlformat=require(_0xba7f('0x0'));var rimraf=require(_0xba7f('0x1'));var zipdir=require(_0xba7f('0x2'));var jsonpatch=require(_0xba7f('0x3'));var rp=require(_0xba7f('0x4'));var moment=require('moment');var BPromise=require(_0xba7f('0x5'));var Mustache=require(_0xba7f('0x6'));var util=require(_0xba7f('0x7'));var path=require('path');var sox=require(_0xba7f('0x8'));var csv=require('to-csv');var ejs=require(_0xba7f('0x9'));var fs=require('fs');var fs_extra=require(_0xba7f('0xa'));var _=require(_0xba7f('0xb'));var squel=require(_0xba7f('0xc'));var crypto=require(_0xba7f('0xd'));var jsforce=require(_0xba7f('0xe'));var deskjs=require(_0xba7f('0xf'));var toCsv=require('to-csv');var querystring=require(_0xba7f('0x10'));var Papa=require(_0xba7f('0x11'));var Redis=require(_0xba7f('0x12'));var authService=require(_0xba7f('0x13'));var qs=require(_0xba7f('0x14'));var as=require(_0xba7f('0x15'));var hardwareService=require(_0xba7f('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xba7f('0x17'));var config=require(_0xba7f('0x18'));var licenseUtil=require(_0xba7f('0x19'));var db=require(_0xba7f('0x1a'))['db'];var jayson=require(_0xba7f('0x1b'));var client=jayson[_0xba7f('0x1c')][_0xba7f('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x14b1d5,_0x169c02,_0x73aba4,_0x4aad55){return new BPromise(function(_0x3f6435,_0x2b7137){var _0x16083b=_0x4aad55||client;return _0x16083b[_0xba7f('0x1e')](_0x14b1d5,_0x73aba4)[_0xba7f('0x1f')](function(_0x3c4f66){logger[_0xba7f('0x20')](_0xba7f('0x21'),_0x169c02,_0xba7f('0x22'));logger['debug']('VoiceContext,\x20%s,\x20%s,\x20%s',_0x169c02,_0xba7f('0x22'),JSON[_0xba7f('0x23')](_0x3c4f66));if(_0x3c4f66[_0xba7f('0x24')]){if(_0x3c4f66[_0xba7f('0x24')][_0xba7f('0x25')]===0x1f4){logger['error'](_0xba7f('0x21'),_0x169c02,_0x3c4f66['error'][_0xba7f('0x26')]);return _0x2b7137(_0x3c4f66[_0xba7f('0x24')][_0xba7f('0x26')]);}logger[_0xba7f('0x24')](_0xba7f('0x21'),_0x169c02,_0x3c4f66[_0xba7f('0x24')][_0xba7f('0x26')]);return _0x3f6435(_0x3c4f66[_0xba7f('0x24')][_0xba7f('0x26')]);}else{logger['info'](_0xba7f('0x21'),_0x169c02,_0xba7f('0x22'));_0x3f6435(_0x3c4f66[_0xba7f('0x27')][_0xba7f('0x26')]);}})[_0xba7f('0x28')](function(_0x2ddaa0){logger[_0xba7f('0x24')]('VoiceContext,\x20%s,\x20%s',_0x169c02,_0x2ddaa0);_0x2b7137(_0x2ddaa0);});});}function respondWithStatusCode(_0x44deb1,_0x4115b0){_0x4115b0=_0x4115b0||0xcc;return function(_0x1b5fd0){if(_0x1b5fd0){return _0x44deb1[_0xba7f('0x29')](_0x4115b0);}return _0x44deb1[_0xba7f('0x2a')](_0x4115b0)[_0xba7f('0x2b')]();};}function respondWithResult(_0x267348,_0x208ff4){_0x208ff4=_0x208ff4||0xc8;return function(_0x58ebba){if(_0x58ebba){return _0x267348['status'](_0x208ff4)[_0xba7f('0x2c')](_0x58ebba);}};}function respondWithFilteredResult(_0x1b91e4,_0xf0ba08){return function(_0x17d716){if(_0x17d716){var _0x10a0b3=typeof _0xf0ba08['offset']==='undefined'&&typeof _0xf0ba08['limit']===_0xba7f('0x2d');var _0x2dfe15=_0x17d716[_0xba7f('0x2e')];var _0x38b8cc=_0x10a0b3?0x0:_0xf0ba08['offset'];var _0x199096=_0x10a0b3?_0x17d716[_0xba7f('0x2e')]:_0xf0ba08[_0xba7f('0x2f')]+_0xf0ba08[_0xba7f('0x30')];var _0x15006f;if(_0x199096>=_0x2dfe15){_0x199096=_0x2dfe15;_0x15006f=0xc8;}else{_0x15006f=0xce;}_0x1b91e4[_0xba7f('0x2a')](_0x15006f);return _0x1b91e4['set'](_0xba7f('0x31'),_0x38b8cc+'-'+_0x199096+'/'+_0x2dfe15)[_0xba7f('0x2c')](_0x17d716);}return null;};}function patchUpdates(_0x357cc5){return function(_0x39b6d5){try{jsonpatch[_0xba7f('0x32')](_0x39b6d5,_0x357cc5,!![]);}catch(_0x3fa89c){return BPromise[_0xba7f('0x33')](_0x3fa89c);}return _0x39b6d5[_0xba7f('0x34')]();};}function saveUpdates(_0x209983,_0x3dd10c){return function(_0x5c6079){if(_0x5c6079){return _0x5c6079[_0xba7f('0x35')](_0x209983)['then'](function(_0x3db04e){return _0x3db04e;});}return null;};}function removeEntity(_0x59c527,_0x45f136){return function(_0x4cd0bd){if(_0x4cd0bd){return _0x4cd0bd['destroy']()['then'](function(){var _0x3699c9=_0x4cd0bd[_0xba7f('0x36')]({'plain':!![]});var _0x2096d2=_0xba7f('0x37');return db[_0xba7f('0x38')][_0xba7f('0x39')]({'where':{'type':_0x2096d2,'resourceId':_0x3699c9['id']}})[_0xba7f('0x1f')](function(){return _0x4cd0bd;});})[_0xba7f('0x1f')](function(){_0x59c527[_0xba7f('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29bb96,_0x18b1c1){return function(_0x4f807a){if(!_0x4f807a){_0x29bb96[_0xba7f('0x29')](0x194);}return _0x4f807a;};}function handleError(_0x1869dd,_0x570d39){_0x570d39=_0x570d39||0x1f4;return function(_0x195008){logger['error'](_0x195008[_0xba7f('0x3a')]);if(_0x195008[_0xba7f('0x3b')]){delete _0x195008[_0xba7f('0x3b')];}_0x1869dd['status'](_0x570d39)[_0xba7f('0x3c')](_0x195008);};}exports['index']=function(_0x2730ff,_0x2550dc){var _0x59012a={},_0x1f91e7={},_0x4947cb={'count':0x0,'rows':[]};var _0x151f97=_[_0xba7f('0x3d')](db[_0xba7f('0x3e')][_0xba7f('0x3f')],function(_0x54966b){return{'name':_0x54966b[_0xba7f('0x40')],'type':_0x54966b[_0xba7f('0x41')][_0xba7f('0x42')]};});_0x1f91e7[_0xba7f('0x43')]=_['map'](_0x151f97,_0xba7f('0x3b'));_0x1f91e7[_0xba7f('0x44')]=_[_0xba7f('0x45')](_0x2730ff[_0xba7f('0x44')]);_0x1f91e7['filters']=_['intersection'](_0x1f91e7['model'],_0x1f91e7[_0xba7f('0x44')]);_0x59012a['attributes']=_[_0xba7f('0x46')](_0x1f91e7[_0xba7f('0x43')],qs[_0xba7f('0x47')](_0x2730ff[_0xba7f('0x44')][_0xba7f('0x47')]));_0x59012a[_0xba7f('0x48')]=_0x59012a[_0xba7f('0x48')]['length']?_0x59012a['attributes']:_0x1f91e7[_0xba7f('0x43')];if(!_0x2730ff[_0xba7f('0x44')]['hasOwnProperty']('nolimit')){_0x59012a[_0xba7f('0x30')]=qs['limit'](_0x2730ff[_0xba7f('0x44')][_0xba7f('0x30')]);_0x59012a[_0xba7f('0x2f')]=qs[_0xba7f('0x2f')](_0x2730ff[_0xba7f('0x44')][_0xba7f('0x2f')]);}_0x59012a[_0xba7f('0x49')]=qs[_0xba7f('0x4a')](_0x2730ff['query']['sort']);_0x59012a['where']=qs[_0xba7f('0x4b')](_[_0xba7f('0x4c')](_0x2730ff[_0xba7f('0x44')],_0x1f91e7[_0xba7f('0x4b')]),_0x151f97);if(_0x2730ff[_0xba7f('0x44')]['filter']){_0x59012a[_0xba7f('0x4d')]=_['merge'](_0x59012a['where'],{'$or':_[_0xba7f('0x3d')](_0x151f97,function(_0x36af16){if(_0x36af16['type']!==_0xba7f('0x4e')){var _0x77daa9={};_0x77daa9[_0x36af16[_0xba7f('0x3b')]]={'$like':'%'+_0x2730ff[_0xba7f('0x44')][_0xba7f('0x4f')]+'%'};return _0x77daa9;}})});}_0x59012a=_['merge']({},_0x59012a,_0x2730ff[_0xba7f('0x50')]);var _0x571950={'where':_0x59012a['where']};return db[_0xba7f('0x3e')][_0xba7f('0x2e')](_0x571950)[_0xba7f('0x1f')](function(_0x5e0aa7){_0x4947cb[_0xba7f('0x2e')]=_0x5e0aa7;if(_0x2730ff[_0xba7f('0x44')][_0xba7f('0x51')]){_0x59012a[_0xba7f('0x52')]=[{'all':!![]}];}return db[_0xba7f('0x3e')]['findAll'](_0x59012a);})[_0xba7f('0x1f')](function(_0xfdc18c){_0x4947cb[_0xba7f('0x53')]=_0xfdc18c;return _0x4947cb;})['then'](respondWithFilteredResult(_0x2550dc,_0x59012a))[_0xba7f('0x28')](handleError(_0x2550dc,null));};exports['show']=function(_0x5eb810,_0x56f6ba){var _0x2a70e9={'raw':![],'where':{'id':_0x5eb810[_0xba7f('0x54')]['id']}},_0x5bbefd={};_0x5bbefd[_0xba7f('0x43')]=_[_0xba7f('0x45')](db[_0xba7f('0x3e')][_0xba7f('0x3f')]);_0x5bbefd[_0xba7f('0x44')]=_[_0xba7f('0x45')](_0x5eb810[_0xba7f('0x44')]);_0x5bbefd[_0xba7f('0x4b')]=_[_0xba7f('0x46')](_0x5bbefd[_0xba7f('0x43')],_0x5bbefd[_0xba7f('0x44')]);_0x2a70e9['attributes']=_[_0xba7f('0x46')](_0x5bbefd[_0xba7f('0x43')],qs[_0xba7f('0x47')](_0x5eb810[_0xba7f('0x44')][_0xba7f('0x47')]));_0x2a70e9[_0xba7f('0x48')]=_0x2a70e9[_0xba7f('0x48')][_0xba7f('0x55')]?_0x2a70e9[_0xba7f('0x48')]:_0x5bbefd['model'];if(_0x5eb810[_0xba7f('0x44')][_0xba7f('0x51')]){_0x2a70e9[_0xba7f('0x52')]=[{'all':!![]}];}_0x2a70e9=_[_0xba7f('0x56')]({},_0x2a70e9,_0x5eb810['options']);return db[_0xba7f('0x3e')][_0xba7f('0x57')](_0x2a70e9)['then'](handleEntityNotFound(_0x56f6ba,null))['then'](respondWithResult(_0x56f6ba,null))[_0xba7f('0x28')](handleError(_0x56f6ba,null));};exports[_0xba7f('0x58')]=function(_0x2e9e91,_0xd08c86,_0x144624){var _0x2e9c95;return db['VoiceContext'][_0xba7f('0x58')](_0x2e9e91[_0xba7f('0x59')],{'raw':!![]})[_0xba7f('0x1f')](function(_0xdf15f2){_0x2e9c95=_0xdf15f2;return db['VoiceContext'][_0xba7f('0x5a')]({'raw':!![]});})['then'](function(_0x1f591c){var _0x4b053c=fs[_0xba7f('0x5b')](path[_0xba7f('0x5c')](config[_0xba7f('0x5d')],'server/files/templates/context.ejs'),_0xba7f('0x5e'));var _0x11df43=ejs[_0xba7f('0x5f')](_0x4b053c,{'contexts':_0x1f591c||[]});fs[_0xba7f('0x60')](_0xba7f('0x61'),_0x11df43);})[_0xba7f('0x1f')](function(){return respondWithRpcPromise(_0xba7f('0x62'),_0xba7f('0x58'),{'module':_0xba7f('0x63')});})[_0xba7f('0x1f')](function(){var _0x85ab1=_0x2e9e91[_0xba7f('0x64')][_0xba7f('0x36')]({'plain':!![]});if(!_0x85ab1)throw new Error(_0xba7f('0x65'));if(_0x85ab1[_0xba7f('0x66')]===_0xba7f('0x64')){var _0x5dc674=_0x2e9c95[_0xba7f('0x36')]({'plain':!![]});return db[_0xba7f('0x67')][_0xba7f('0x57')]({'where':{'name':'Contexts','userProfileId':_0x85ab1[_0xba7f('0x68')]},'raw':!![]})[_0xba7f('0x1f')](function(_0x32936a){if(_0x32936a&&_0x32936a[_0xba7f('0x69')]===0x0){return db[_0xba7f('0x38')][_0xba7f('0x58')]({'name':_0x5dc674[_0xba7f('0x3b')],'resourceId':_0x5dc674['id'],'type':_0x32936a[_0xba7f('0x3b')],'sectionId':_0x32936a['id']},{})[_0xba7f('0x1f')](function(){return _0x2e9c95;});}else{return _0x2e9c95;}})[_0xba7f('0x28')](function(_0x57afe7){logger[_0xba7f('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x57afe7);throw _0x57afe7;});}return _0x2e9c95;})[_0xba7f('0x1f')](respondWithResult(_0xd08c86,0xc9))[_0xba7f('0x28')](handleError(_0xd08c86,null));};exports[_0xba7f('0x35')]=function(_0x799886,_0x1a4aae,_0x2323f3){var _0x532db9;return db[_0xba7f('0x3e')][_0xba7f('0x57')]({'where':{'id':_0x799886[_0xba7f('0x54')]['id']}})[_0xba7f('0x1f')](handleEntityNotFound(_0x1a4aae,null))[_0xba7f('0x1f')](saveUpdates(_0x799886[_0xba7f('0x59')],null))['then'](function(_0x15ebb9){if(_0x15ebb9){_0x532db9=_0x15ebb9;return db['VoiceContext']['findAll']({'raw':!![]});}})[_0xba7f('0x1f')](function(_0x96c997){var _0x2a1a81=fs['readFileSync'](path[_0xba7f('0x5c')](config[_0xba7f('0x5d')],_0xba7f('0x6a')),_0xba7f('0x5e'));var _0x34e69b=ejs['render'](_0x2a1a81,{'contexts':_0x96c997||[]});fs[_0xba7f('0x60')](_0xba7f('0x61'),_0x34e69b);})[_0xba7f('0x1f')](function(){return respondWithRpcPromise('Reload',_0xba7f('0x35'),{'module':_0xba7f('0x63')});})['then'](function(){return _0x532db9;})[_0xba7f('0x1f')](respondWithResult(_0x1a4aae,null))[_0xba7f('0x28')](handleError(_0x1a4aae,null));};exports[_0xba7f('0x39')]=function(_0x19235f,_0x1defe4,_0x1771bc){var _0xb289ec;return db[_0xba7f('0x3e')][_0xba7f('0x57')]({'where':{'id':_0x19235f[_0xba7f('0x54')]['id']}})[_0xba7f('0x1f')](handleEntityNotFound(_0x1defe4,null))[_0xba7f('0x1f')](removeEntity(_0x1defe4,null))[_0xba7f('0x1f')](function(){return db[_0xba7f('0x3e')][_0xba7f('0x5a')]({'raw':!![]});})['then'](function(_0x773011){var _0x5d9f02=fs[_0xba7f('0x5b')](path['join'](config[_0xba7f('0x5d')],_0xba7f('0x6a')),'utf8');var _0x1c8ae0=ejs[_0xba7f('0x5f')](_0x5d9f02,{'contexts':_0x773011});fs[_0xba7f('0x60')](_0xba7f('0x61'),_0x1c8ae0);return respondWithRpcPromise(_0xba7f('0x62'),_0xba7f('0x39'),{'module':_0xba7f('0x63')});})[_0xba7f('0x28')](handleError(_0x1defe4,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index f30ad5e..a5c768a 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 _0x6a95=['util','moment','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','define','VoiceContext','voice_contexts','lodash'];(function(_0x1e11c2,_0x1bcbca){var _0x4faa44=function(_0x4c3bf3){while(--_0x4c3bf3){_0x1e11c2['push'](_0x1e11c2['shift']());}};_0x4faa44(++_0x1bcbca);}(_0x6a95,0xdb));var _0x56a9=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x6a95[_0x4baae2];return _0x1a2285;};'use strict';var _=require(_0x56a9('0x0'));var util=require(_0x56a9('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x56a9('0x2'));var BPromise=require('bluebird');var rp=require(_0x56a9('0x3'));var fs=require('fs');var path=require(_0x56a9('0x4'));var rimraf=require(_0x56a9('0x5'));var config=require(_0x56a9('0x6'));var attributes=require(_0x56a9('0x7'));module['exports']=function(_0x49309a,_0x2fee2c){return _0x49309a[_0x56a9('0x8')](_0x56a9('0x9'),attributes,{'tableName':_0x56a9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9679=['voice_contexts','lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./voiceContext.attributes','define','VoiceContext'];(function(_0x37115b,_0x1d0f0b){var _0xee794a=function(_0x3c9903){while(--_0x3c9903){_0x37115b['push'](_0x37115b['shift']());}};_0xee794a(++_0x1d0f0b);}(_0x9679,0x11f));var _0x9967=function(_0x39d513,_0x3b587f){_0x39d513=_0x39d513-0x0;var _0x2e5db9=_0x9679[_0x39d513];return _0x2e5db9;};'use strict';var _=require(_0x9967('0x0'));var util=require(_0x9967('0x1'));var logger=require(_0x9967('0x2'))('api');var moment=require(_0x9967('0x3'));var BPromise=require('bluebird');var rp=require(_0x9967('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9967('0x5'));var config=require(_0x9967('0x6'));var attributes=require(_0x9967('0x7'));module['exports']=function(_0x105c43,_0xb8b9a7){return _0x105c43[_0x9967('0x8')](_0x9967('0x9'),attributes,{'tableName':_0x9967('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index fab7d3c..d65972a 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 _0xa45b=['VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceContext,\x20%s,\x20%s','info','request\x20sent','result','catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','debug'];(function(_0x4e0b8c,_0x443f31){var _0x633ecc=function(_0x1f1f36){while(--_0x1f1f36){_0x4e0b8c['push'](_0x4e0b8c['shift']());}};_0x633ecc(++_0x443f31);}(_0xa45b,0x199));var _0xba45=function(_0x10fa39,_0x476a44){_0x10fa39=_0x10fa39-0x0;var _0x399292=_0xa45b[_0x10fa39];return _0x399292;};'use strict';var _=require('lodash');var util=require(_0xba45('0x0'));var moment=require(_0xba45('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xba45('0x2'))['db'];var utils=require(_0xba45('0x3'));var logger=require(_0xba45('0x4'))(_0xba45('0x5'));var config=require('../../config/environment');var jayson=require(_0xba45('0x6'));var client=jayson[_0xba45('0x7')][_0xba45('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x298bfc,_0x404229,_0x20905f){return new BPromise(function(_0x1a7a40,_0x374412){return client['request'](_0x298bfc,_0x20905f)[_0xba45('0x9')](function(_0x495a41){logger['info']('VoiceContext,\x20%s,\x20%s',_0x404229,'request\x20sent');logger[_0xba45('0xa')](_0xba45('0xb'),_0x404229,'request\x20sent',JSON[_0xba45('0xc')](_0x495a41));if(_0x495a41[_0xba45('0xd')]){if(_0x495a41[_0xba45('0xd')][_0xba45('0xe')]===0x1f4){logger[_0xba45('0xd')]('VoiceContext,\x20%s,\x20%s',_0x404229,_0x495a41[_0xba45('0xd')][_0xba45('0xf')]);return _0x374412(_0x495a41[_0xba45('0xd')][_0xba45('0xf')]);}logger['error'](_0xba45('0x10'),_0x404229,_0x495a41['error'][_0xba45('0xf')]);return _0x1a7a40(_0x495a41[_0xba45('0xd')][_0xba45('0xf')]);}else{logger[_0xba45('0x11')](_0xba45('0x10'),_0x404229,_0xba45('0x12'));_0x1a7a40(_0x495a41[_0xba45('0x13')][_0xba45('0xf')]);}})[_0xba45('0x14')](function(_0xe9a683){logger['error'](_0xba45('0x10'),_0x404229,_0xe9a683);_0x374412(_0xe9a683);});});} \ No newline at end of file +var _0xafcb=['VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','VoiceContext,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xafcb,0xb6));var _0xbafc=function(_0x4e36c4,_0xad83ca){_0x4e36c4=_0x4e36c4-0x0;var _0x2d4280=_0xafcb[_0x4e36c4];return _0x2d4280;};'use strict';var _=require(_0xbafc('0x0'));var util=require(_0xbafc('0x1'));var moment=require(_0xbafc('0x2'));var BPromise=require(_0xbafc('0x3'));var rs=require(_0xbafc('0x4'));var fs=require('fs');var Redis=require(_0xbafc('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xbafc('0x6'));var logger=require(_0xbafc('0x7'))(_0xbafc('0x8'));var config=require(_0xbafc('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xbafc('0xa')][_0xbafc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x645129,_0xe5e508,_0x498a11){return new BPromise(function(_0xa8c557,_0x1a86f5){return client[_0xbafc('0xc')](_0x645129,_0x498a11)['then'](function(_0x47ecdf){logger['info'](_0xbafc('0xd'),_0xe5e508,_0xbafc('0xe'));logger[_0xbafc('0xf')](_0xbafc('0x10'),_0xe5e508,_0xbafc('0xe'),JSON[_0xbafc('0x11')](_0x47ecdf));if(_0x47ecdf[_0xbafc('0x12')]){if(_0x47ecdf['error'][_0xbafc('0x13')]===0x1f4){logger[_0xbafc('0x12')](_0xbafc('0xd'),_0xe5e508,_0x47ecdf[_0xbafc('0x12')][_0xbafc('0x14')]);return _0x1a86f5(_0x47ecdf['error'][_0xbafc('0x14')]);}logger['error'](_0xbafc('0xd'),_0xe5e508,_0x47ecdf['error']['message']);return _0xa8c557(_0x47ecdf['error'][_0xbafc('0x14')]);}else{logger[_0xbafc('0x15')]('VoiceContext,\x20%s,\x20%s',_0xe5e508,_0xbafc('0xe'));_0xa8c557(_0x47ecdf['result'][_0xbafc('0x14')]);}})['catch'](function(_0x3d1307){logger['error'](_0xbafc('0xd'),_0xe5e508,_0x3d1307);_0x1a86f5(_0x3d1307);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 4c6e686..4552092 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 _0xa886=['/:id','show','create','put','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','./voiceDialReport.controller','get','isAuthenticated','/describe','describe'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa886,0x193));var _0x6a88=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xa886[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require('multer');var util=require(_0x6a88('0x0'));var path=require(_0x6a88('0x1'));var timeout=require(_0x6a88('0x2'));var express=require(_0x6a88('0x3'));var router=express[_0x6a88('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6a88('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6a88('0x6'));router[_0x6a88('0x7')]('/',auth[_0x6a88('0x8')](),controller['index']);router[_0x6a88('0x7')](_0x6a88('0x9'),auth['isAuthenticated'](),controller[_0x6a88('0xa')]);router[_0x6a88('0x7')](_0x6a88('0xb'),auth[_0x6a88('0x8')](),controller[_0x6a88('0xc')]);router['post']('/',auth[_0x6a88('0x8')](),controller[_0x6a88('0xd')]);router[_0x6a88('0xe')](_0x6a88('0xb'),auth['isAuthenticated'](),controller[_0x6a88('0xf')]);router[_0x6a88('0x10')](_0x6a88('0xb'),auth[_0x6a88('0x8')](),controller['destroy']);module[_0x6a88('0x11')]=router; \ No newline at end of file +var _0xcf62=['describe','/:id','show','post','create','put','update','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','isAuthenticated','get','/describe'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0xcf62,0x71));var _0x2cf6=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xcf62[_0x68c979];return _0x4f0001;};'use strict';var multer=require(_0x2cf6('0x0'));var util=require(_0x2cf6('0x1'));var path=require('path');var timeout=require(_0x2cf6('0x2'));var express=require(_0x2cf6('0x3'));var router=express[_0x2cf6('0x4')]();var fs_extra=require(_0x2cf6('0x5'));var auth=require(_0x2cf6('0x6'));var interaction=require(_0x2cf6('0x7'));var config=require(_0x2cf6('0x8'));var controller=require(_0x2cf6('0x9'));router['get']('/',auth[_0x2cf6('0xa')](),controller['index']);router[_0x2cf6('0xb')](_0x2cf6('0xc'),auth[_0x2cf6('0xa')](),controller[_0x2cf6('0xd')]);router['get'](_0x2cf6('0xe'),auth[_0x2cf6('0xa')](),controller[_0x2cf6('0xf')]);router[_0x2cf6('0x10')]('/',auth[_0x2cf6('0xa')](),controller[_0x2cf6('0x11')]);router[_0x2cf6('0x12')](_0x2cf6('0xe'),auth[_0x2cf6('0xa')](),controller[_0x2cf6('0x13')]);router['delete'](_0x2cf6('0xe'),auth[_0x2cf6('0xa')](),controller[_0x2cf6('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index b133e3b..6c9b119 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 _0x81bd=['exports','STRING','INTEGER','DATE','sequelize'];(function(_0x2e0afd,_0x1a71f7){var _0x4cefad=function(_0x8f4720){while(--_0x8f4720){_0x2e0afd['push'](_0x2e0afd['shift']());}};_0x4cefad(++_0x1a71f7);}(_0x81bd,0x7c));var _0xd81b=function(_0x233d57,_0x284678){_0x233d57=_0x233d57-0x0;var _0x3eec8c=_0x81bd[_0x233d57];return _0x3eec8c;};'use strict';var Sequelize=require(_0xd81b('0x0'));module[_0xd81b('0x1')]={'privilege':{'type':Sequelize[_0xd81b('0x2')]},'channel':{'type':Sequelize[_0xd81b('0x2')]},'channelstate':{'type':Sequelize[_0xd81b('0x3')]},'channelstatedesc':{'type':Sequelize[_0xd81b('0x2')]},'calleridnum':{'type':Sequelize[_0xd81b('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xd81b('0x2')]},'connectedlinename':{'type':Sequelize[_0xd81b('0x2')]},'language':{'type':Sequelize[_0xd81b('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xd81b('0x2')]},'exten':{'type':Sequelize[_0xd81b('0x2')]},'priority':{'type':Sequelize[_0xd81b('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xd81b('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xd81b('0x2')]},'destcalleridnum':{'type':Sequelize[_0xd81b('0x2')]},'destcalleridname':{'type':Sequelize[_0xd81b('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xd81b('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xd81b('0x2')]},'destlanguage':{'type':Sequelize[_0xd81b('0x2')]},'destaccountcode':{'type':Sequelize[_0xd81b('0x2')]},'destcontext':{'type':Sequelize[_0xd81b('0x2')]},'destexten':{'type':Sequelize[_0xd81b('0x2')]},'destpriority':{'type':Sequelize[_0xd81b('0x3')]},'destuniqueid':{'type':Sequelize[_0xd81b('0x2')]},'destlinkedid':{'type':Sequelize[_0xd81b('0x2')]},'dialstring':{'type':Sequelize[_0xd81b('0x2')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xd81b('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xd81b('0x4')]},'lastevent':{'type':Sequelize[_0xd81b('0x2')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0xd81b('0x3')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0xd81b('0x3')]},'billableseconds':{'type':Sequelize[_0xd81b('0x3')]}}; \ No newline at end of file +var _0x6aa7=['called,connect,complete','sequelize','STRING','INTEGER','DATE'];(function(_0x44fec9,_0x4dff90){var _0x11394f=function(_0x1723df){while(--_0x1723df){_0x44fec9['push'](_0x44fec9['shift']());}};_0x11394f(++_0x4dff90);}(_0x6aa7,0x178));var _0x76aa=function(_0x4fde0d,_0x157f1f){_0x4fde0d=_0x4fde0d-0x0;var _0x494d52=_0x6aa7[_0x4fde0d];return _0x494d52;};'use strict';var Sequelize=require(_0x76aa('0x0'));module['exports']={'privilege':{'type':Sequelize[_0x76aa('0x1')]},'channel':{'type':Sequelize[_0x76aa('0x1')]},'channelstate':{'type':Sequelize[_0x76aa('0x2')]},'channelstatedesc':{'type':Sequelize[_0x76aa('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x76aa('0x1')]},'connectedlinenum':{'type':Sequelize[_0x76aa('0x1')]},'connectedlinename':{'type':Sequelize[_0x76aa('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x76aa('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x76aa('0x2')]},'uniqueid':{'type':Sequelize[_0x76aa('0x1')]},'linkedid':{'type':Sequelize[_0x76aa('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x76aa('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x76aa('0x1')]},'destcalleridnum':{'type':Sequelize[_0x76aa('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x76aa('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x76aa('0x1')]},'destlanguage':{'type':Sequelize[_0x76aa('0x1')]},'destaccountcode':{'type':Sequelize[_0x76aa('0x1')]},'destcontext':{'type':Sequelize[_0x76aa('0x1')]},'destexten':{'type':Sequelize[_0x76aa('0x1')]},'destpriority':{'type':Sequelize[_0x76aa('0x2')]},'destuniqueid':{'type':Sequelize[_0x76aa('0x1')]},'destlinkedid':{'type':Sequelize[_0x76aa('0x1')]},'dialstring':{'type':Sequelize[_0x76aa('0x1')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x76aa('0x3')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x76aa('0x3')]},'lastevent':{'type':Sequelize[_0x76aa('0x1')],'comment':_0x76aa('0x4')},'routeId':{'type':Sequelize[_0x76aa('0x2')]},'duration':{'type':Sequelize[_0x76aa('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index f1e1eeb..834d41c 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 _0x84e4=['to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','offset','undefined','count','set','Content-Range','json','reject','save','then','status','stack','name','send','index','map','fieldName','type','key','query','keys','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','VoiceDialReport','rawAttributes','includeAll','create','update','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x3044b9,_0x9948a){var _0x317047=function(_0x308c07){while(--_0x308c07){_0x3044b9['push'](_0x3044b9['shift']());}};_0x317047(++_0x9948a);}(_0x84e4,0x135));var _0x484e=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0x84e4[_0x9fd887];return _0x1a54ab;};'use strict';var emlformat=require(_0x484e('0x0'));var rimraf=require(_0x484e('0x1'));var zipdir=require(_0x484e('0x2'));var jsonpatch=require(_0x484e('0x3'));var rp=require(_0x484e('0x4'));var moment=require(_0x484e('0x5'));var BPromise=require(_0x484e('0x6'));var Mustache=require(_0x484e('0x7'));var util=require(_0x484e('0x8'));var path=require(_0x484e('0x9'));var sox=require(_0x484e('0xa'));var csv=require(_0x484e('0xb'));var ejs=require(_0x484e('0xc'));var fs=require('fs');var fs_extra=require(_0x484e('0xd'));var _=require('lodash');var squel=require(_0x484e('0xe'));var crypto=require(_0x484e('0xf'));var jsforce=require(_0x484e('0x10'));var deskjs=require(_0x484e('0x11'));var toCsv=require('to-csv');var querystring=require(_0x484e('0x12'));var Papa=require(_0x484e('0x13'));var Redis=require(_0x484e('0x14'));var authService=require(_0x484e('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x484e('0x16'));var hardwareService=require(_0x484e('0x17'));var logger=require(_0x484e('0x18'))('api');var utils=require(_0x484e('0x19'));var config=require(_0x484e('0x1a'));var licenseUtil=require(_0x484e('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d0f18,_0x7ec59a){_0x7ec59a=_0x7ec59a||0xcc;return function(_0xae5253){if(_0xae5253){return _0x3d0f18[_0x484e('0x1c')](_0x7ec59a);}return _0x3d0f18['status'](_0x7ec59a)[_0x484e('0x1d')]();};}function respondWithResult(_0x51096b,_0x97051e){_0x97051e=_0x97051e||0xc8;return function(_0xd25ac5){if(_0xd25ac5){return _0x51096b['status'](_0x97051e)['json'](_0xd25ac5);}};}function respondWithFilteredResult(_0x133590,_0x495ecf){return function(_0x1b8431){if(_0x1b8431){var _0x3777b0=typeof _0x495ecf[_0x484e('0x1e')]==='undefined'&&typeof _0x495ecf['limit']===_0x484e('0x1f');var _0x23cd17=_0x1b8431[_0x484e('0x20')];var _0x21785d=_0x3777b0?0x0:_0x495ecf[_0x484e('0x1e')];var _0x17c1a0=_0x3777b0?_0x1b8431[_0x484e('0x20')]:_0x495ecf['offset']+_0x495ecf['limit'];var _0x468016;if(_0x17c1a0>=_0x23cd17){_0x17c1a0=_0x23cd17;_0x468016=0xc8;}else{_0x468016=0xce;}_0x133590['status'](_0x468016);return _0x133590[_0x484e('0x21')](_0x484e('0x22'),_0x21785d+'-'+_0x17c1a0+'/'+_0x23cd17)[_0x484e('0x23')](_0x1b8431);}return null;};}function patchUpdates(_0x35bdd9){return function(_0x488ca3){try{jsonpatch['apply'](_0x488ca3,_0x35bdd9,!![]);}catch(_0x1396a0){return BPromise[_0x484e('0x24')](_0x1396a0);}return _0x488ca3[_0x484e('0x25')]();};}function saveUpdates(_0x1d03f3,_0x373e29){return function(_0x51b4ce){if(_0x51b4ce){return _0x51b4ce['update'](_0x1d03f3)[_0x484e('0x26')](function(_0x277468){return _0x277468;});}return null;};}function removeEntity(_0x448d95,_0x5a168a){return function(_0x45be0f){if(_0x45be0f){return _0x45be0f['destroy']()[_0x484e('0x26')](function(){_0x448d95[_0x484e('0x27')](0xcc)[_0x484e('0x1d')]();});}};}function handleEntityNotFound(_0x4295bf,_0x3b54a1){return function(_0x3dc567){if(!_0x3dc567){_0x4295bf['sendStatus'](0x194);}return _0x3dc567;};}function handleError(_0x4e9cc9,_0x4fe16c){_0x4fe16c=_0x4fe16c||0x1f4;return function(_0x228952){logger['error'](_0x228952[_0x484e('0x28')]);if(_0x228952['name']){delete _0x228952[_0x484e('0x29')];}_0x4e9cc9[_0x484e('0x27')](_0x4fe16c)[_0x484e('0x2a')](_0x228952);};}exports[_0x484e('0x2b')]=function(_0x22d971,_0x5754f0){var _0x453988={},_0x5a289a={},_0x2df342={'count':0x0,'rows':[]};var _0x5daebf=_[_0x484e('0x2c')](db['VoiceDialReport']['rawAttributes'],function(_0x375c07){return{'name':_0x375c07[_0x484e('0x2d')],'type':_0x375c07[_0x484e('0x2e')][_0x484e('0x2f')]};});_0x5a289a['model']=_[_0x484e('0x2c')](_0x5daebf,_0x484e('0x29'));_0x5a289a[_0x484e('0x30')]=_[_0x484e('0x31')](_0x22d971[_0x484e('0x30')]);_0x5a289a['filters']=_['intersection'](_0x5a289a['model'],_0x5a289a[_0x484e('0x30')]);_0x453988[_0x484e('0x32')]=_[_0x484e('0x33')](_0x5a289a[_0x484e('0x34')],qs[_0x484e('0x35')](_0x22d971[_0x484e('0x30')][_0x484e('0x35')]));_0x453988['attributes']=_0x453988[_0x484e('0x32')][_0x484e('0x36')]?_0x453988[_0x484e('0x32')]:_0x5a289a[_0x484e('0x34')];if(!_0x22d971[_0x484e('0x30')][_0x484e('0x37')](_0x484e('0x38'))){_0x453988[_0x484e('0x39')]=qs['limit'](_0x22d971[_0x484e('0x30')][_0x484e('0x39')]);_0x453988['offset']=qs[_0x484e('0x1e')](_0x22d971[_0x484e('0x30')][_0x484e('0x1e')]);}_0x453988[_0x484e('0x3a')]=qs['sort'](_0x22d971[_0x484e('0x30')][_0x484e('0x3b')]);_0x453988[_0x484e('0x3c')]=qs[_0x484e('0x3d')](_[_0x484e('0x3e')](_0x22d971[_0x484e('0x30')],_0x5a289a[_0x484e('0x3d')]),_0x5daebf);if(_0x22d971[_0x484e('0x30')][_0x484e('0x3f')]){_0x453988[_0x484e('0x3c')]=_[_0x484e('0x40')](_0x453988[_0x484e('0x3c')],{'$or':_['map'](_0x5daebf,function(_0x55d5ef){if(_0x55d5ef['type']!==_0x484e('0x41')){var _0x18f12a={};_0x18f12a[_0x55d5ef[_0x484e('0x29')]]={'$like':'%'+_0x22d971[_0x484e('0x30')][_0x484e('0x3f')]+'%'};return _0x18f12a;}})});}_0x453988=_[_0x484e('0x40')]({},_0x453988,_0x22d971[_0x484e('0x42')]);var _0x282681={'where':_0x453988[_0x484e('0x3c')]};return db['VoiceDialReport'][_0x484e('0x20')](_0x282681)['then'](function(_0x34eedf){_0x2df342[_0x484e('0x20')]=_0x34eedf;if(_0x22d971[_0x484e('0x30')]['includeAll']){_0x453988[_0x484e('0x43')]=[{'all':!![]}];}return db['VoiceDialReport']['findAll'](_0x453988);})[_0x484e('0x26')](function(_0x21eefc){_0x2df342[_0x484e('0x44')]=_0x21eefc;return _0x2df342;})[_0x484e('0x26')](respondWithFilteredResult(_0x5754f0,_0x453988))[_0x484e('0x45')](handleError(_0x5754f0,null));};exports[_0x484e('0x46')]=function(_0x1a2d14,_0x4b01ae){var _0x37db9f={'raw':!![],'where':{'id':_0x1a2d14['params']['id']}},_0x7b0bc8={};_0x7b0bc8[_0x484e('0x34')]=_['keys'](db[_0x484e('0x47')][_0x484e('0x48')]);_0x7b0bc8[_0x484e('0x30')]=_[_0x484e('0x31')](_0x1a2d14[_0x484e('0x30')]);_0x7b0bc8[_0x484e('0x3d')]=_[_0x484e('0x33')](_0x7b0bc8['model'],_0x7b0bc8[_0x484e('0x30')]);_0x37db9f['attributes']=_[_0x484e('0x33')](_0x7b0bc8[_0x484e('0x34')],qs['fields'](_0x1a2d14[_0x484e('0x30')][_0x484e('0x35')]));_0x37db9f[_0x484e('0x32')]=_0x37db9f[_0x484e('0x32')][_0x484e('0x36')]?_0x37db9f[_0x484e('0x32')]:_0x7b0bc8[_0x484e('0x34')];if(_0x1a2d14[_0x484e('0x30')][_0x484e('0x49')]){_0x37db9f['include']=[{'all':!![]}];}_0x37db9f=_[_0x484e('0x40')]({},_0x37db9f,_0x1a2d14[_0x484e('0x42')]);return db['VoiceDialReport']['find'](_0x37db9f)[_0x484e('0x26')](handleEntityNotFound(_0x4b01ae,null))['then'](respondWithResult(_0x4b01ae,null))[_0x484e('0x45')](handleError(_0x4b01ae,null));};exports[_0x484e('0x4a')]=function(_0x8d8a6,_0x27b076){return db[_0x484e('0x47')][_0x484e('0x4a')](_0x8d8a6['body'],{})[_0x484e('0x26')](respondWithResult(_0x27b076,0xc9))[_0x484e('0x45')](handleError(_0x27b076,null));};exports[_0x484e('0x4b')]=function(_0x4c2a9e,_0x54b550){if(_0x4c2a9e[_0x484e('0x4c')]['id']){delete _0x4c2a9e[_0x484e('0x4c')]['id'];}return db[_0x484e('0x47')][_0x484e('0x4d')]({'where':{'id':_0x4c2a9e['params']['id']}})[_0x484e('0x26')](handleEntityNotFound(_0x54b550,null))[_0x484e('0x26')](saveUpdates(_0x4c2a9e[_0x484e('0x4c')],null))[_0x484e('0x26')](respondWithResult(_0x54b550,null))[_0x484e('0x45')](handleError(_0x54b550,null));};exports[_0x484e('0x4e')]=function(_0xa09d8c,_0xe04fb2){return db[_0x484e('0x47')][_0x484e('0x4d')]({'where':{'id':_0xa09d8c['params']['id']}})['then'](handleEntityNotFound(_0xe04fb2,null))['then'](removeEntity(_0xe04fb2,null))[_0x484e('0x45')](handleError(_0xe04fb2,null));};exports[_0x484e('0x4f')]=function(_0x1655fe,_0x34e334){return db[_0x484e('0x47')][_0x484e('0x4f')]()[_0x484e('0x26')](respondWithResult(_0x34e334,null))[_0x484e('0x45')](handleError(_0x34e334,null));}; \ No newline at end of file +var _0x6d9e=['keys','intersection','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','stack','name','send','map','VoiceDialReport','fieldName','type','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params'];(function(_0x42b893,_0x4b1508){var _0x4bb1e7=function(_0x150c63){while(--_0x150c63){_0x42b893['push'](_0x42b893['shift']());}};_0x4bb1e7(++_0x4b1508);}(_0x6d9e,0x136));var _0xe6d9=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6d9e[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xe6d9('0x0'));var rimraf=require(_0xe6d9('0x1'));var zipdir=require(_0xe6d9('0x2'));var jsonpatch=require(_0xe6d9('0x3'));var rp=require('request-promise');var moment=require(_0xe6d9('0x4'));var BPromise=require(_0xe6d9('0x5'));var Mustache=require(_0xe6d9('0x6'));var util=require(_0xe6d9('0x7'));var path=require(_0xe6d9('0x8'));var sox=require('sox');var csv=require(_0xe6d9('0x9'));var ejs=require(_0xe6d9('0xa'));var fs=require('fs');var fs_extra=require(_0xe6d9('0xb'));var _=require(_0xe6d9('0xc'));var squel=require(_0xe6d9('0xd'));var crypto=require(_0xe6d9('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xe6d9('0xf'));var toCsv=require(_0xe6d9('0x9'));var querystring=require(_0xe6d9('0x10'));var Papa=require(_0xe6d9('0x11'));var Redis=require('ioredis');var authService=require(_0xe6d9('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xe6d9('0x13'));var hardwareService=require(_0xe6d9('0x14'));var logger=require(_0xe6d9('0x15'))(_0xe6d9('0x16'));var utils=require(_0xe6d9('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xe6d9('0x18'));var db=require(_0xe6d9('0x19'))['db'];function respondWithStatusCode(_0xc84d34,_0x1baac7){_0x1baac7=_0x1baac7||0xcc;return function(_0x2c5819){if(_0x2c5819){return _0xc84d34[_0xe6d9('0x1a')](_0x1baac7);}return _0xc84d34['status'](_0x1baac7)[_0xe6d9('0x1b')]();};}function respondWithResult(_0x2aa33d,_0x1e84ac){_0x1e84ac=_0x1e84ac||0xc8;return function(_0x216a58){if(_0x216a58){return _0x2aa33d[_0xe6d9('0x1c')](_0x1e84ac)[_0xe6d9('0x1d')](_0x216a58);}};}function respondWithFilteredResult(_0x1ef2a5,_0x25f205){return function(_0x378649){if(_0x378649){var _0x3e9690=typeof _0x25f205[_0xe6d9('0x1e')]===_0xe6d9('0x1f')&&typeof _0x25f205[_0xe6d9('0x20')]===_0xe6d9('0x1f');var _0x39eece=_0x378649['count'];var _0x2d4127=_0x3e9690?0x0:_0x25f205[_0xe6d9('0x1e')];var _0x1886a3=_0x3e9690?_0x378649[_0xe6d9('0x21')]:_0x25f205['offset']+_0x25f205['limit'];var _0x25a282;if(_0x1886a3>=_0x39eece){_0x1886a3=_0x39eece;_0x25a282=0xc8;}else{_0x25a282=0xce;}_0x1ef2a5[_0xe6d9('0x1c')](_0x25a282);return _0x1ef2a5[_0xe6d9('0x22')]('Content-Range',_0x2d4127+'-'+_0x1886a3+'/'+_0x39eece)[_0xe6d9('0x1d')](_0x378649);}return null;};}function patchUpdates(_0x3fed41){return function(_0x5f2645){try{jsonpatch[_0xe6d9('0x23')](_0x5f2645,_0x3fed41,!![]);}catch(_0x1cc5ae){return BPromise['reject'](_0x1cc5ae);}return _0x5f2645[_0xe6d9('0x24')]();};}function saveUpdates(_0x56194c,_0x4fd3e4){return function(_0x496919){if(_0x496919){return _0x496919[_0xe6d9('0x25')](_0x56194c)[_0xe6d9('0x26')](function(_0x433ec1){return _0x433ec1;});}return null;};}function removeEntity(_0xf1698d,_0xf361fb){return function(_0x19915c){if(_0x19915c){return _0x19915c[_0xe6d9('0x27')]()[_0xe6d9('0x26')](function(){_0xf1698d['status'](0xcc)[_0xe6d9('0x1b')]();});}};}function handleEntityNotFound(_0x522bdf,_0x25d5c0){return function(_0x4d874d){if(!_0x4d874d){_0x522bdf['sendStatus'](0x194);}return _0x4d874d;};}function handleError(_0x53109d,_0x42aa48){_0x42aa48=_0x42aa48||0x1f4;return function(_0x9d9fab){logger[_0xe6d9('0x28')](_0x9d9fab[_0xe6d9('0x29')]);if(_0x9d9fab['name']){delete _0x9d9fab[_0xe6d9('0x2a')];}_0x53109d[_0xe6d9('0x1c')](_0x42aa48)[_0xe6d9('0x2b')](_0x9d9fab);};}exports['index']=function(_0x5f35f,_0x326c7f){var _0x572434={},_0x340b0d={},_0x5b5170={'count':0x0,'rows':[]};var _0x14bc2d=_[_0xe6d9('0x2c')](db[_0xe6d9('0x2d')]['rawAttributes'],function(_0x1de914){return{'name':_0x1de914[_0xe6d9('0x2e')],'type':_0x1de914[_0xe6d9('0x2f')]['key']};});_0x340b0d[_0xe6d9('0x30')]=_[_0xe6d9('0x2c')](_0x14bc2d,_0xe6d9('0x2a'));_0x340b0d[_0xe6d9('0x31')]=_['keys'](_0x5f35f[_0xe6d9('0x31')]);_0x340b0d[_0xe6d9('0x32')]=_['intersection'](_0x340b0d[_0xe6d9('0x30')],_0x340b0d['query']);_0x572434[_0xe6d9('0x33')]=_['intersection'](_0x340b0d[_0xe6d9('0x30')],qs[_0xe6d9('0x34')](_0x5f35f[_0xe6d9('0x31')][_0xe6d9('0x34')]));_0x572434[_0xe6d9('0x33')]=_0x572434[_0xe6d9('0x33')][_0xe6d9('0x35')]?_0x572434['attributes']:_0x340b0d[_0xe6d9('0x30')];if(!_0x5f35f[_0xe6d9('0x31')][_0xe6d9('0x36')](_0xe6d9('0x37'))){_0x572434[_0xe6d9('0x20')]=qs['limit'](_0x5f35f[_0xe6d9('0x31')][_0xe6d9('0x20')]);_0x572434[_0xe6d9('0x1e')]=qs[_0xe6d9('0x1e')](_0x5f35f[_0xe6d9('0x31')][_0xe6d9('0x1e')]);}_0x572434[_0xe6d9('0x38')]=qs[_0xe6d9('0x39')](_0x5f35f[_0xe6d9('0x31')][_0xe6d9('0x39')]);_0x572434[_0xe6d9('0x3a')]=qs[_0xe6d9('0x32')](_[_0xe6d9('0x3b')](_0x5f35f['query'],_0x340b0d[_0xe6d9('0x32')]),_0x14bc2d);if(_0x5f35f[_0xe6d9('0x31')][_0xe6d9('0x3c')]){_0x572434['where']=_[_0xe6d9('0x3d')](_0x572434[_0xe6d9('0x3a')],{'$or':_[_0xe6d9('0x2c')](_0x14bc2d,function(_0x213e4d){if(_0x213e4d[_0xe6d9('0x2f')]!==_0xe6d9('0x3e')){var _0x199af3={};_0x199af3[_0x213e4d[_0xe6d9('0x2a')]]={'$like':'%'+_0x5f35f[_0xe6d9('0x31')][_0xe6d9('0x3c')]+'%'};return _0x199af3;}})});}_0x572434=_['merge']({},_0x572434,_0x5f35f[_0xe6d9('0x3f')]);var _0x50c7f8={'where':_0x572434[_0xe6d9('0x3a')]};return db[_0xe6d9('0x2d')][_0xe6d9('0x21')](_0x50c7f8)[_0xe6d9('0x26')](function(_0xaed623){_0x5b5170[_0xe6d9('0x21')]=_0xaed623;if(_0x5f35f[_0xe6d9('0x31')][_0xe6d9('0x40')]){_0x572434[_0xe6d9('0x41')]=[{'all':!![]}];}return db[_0xe6d9('0x2d')][_0xe6d9('0x42')](_0x572434);})['then'](function(_0x27dd45){_0x5b5170[_0xe6d9('0x43')]=_0x27dd45;return _0x5b5170;})['then'](respondWithFilteredResult(_0x326c7f,_0x572434))[_0xe6d9('0x44')](handleError(_0x326c7f,null));};exports['show']=function(_0x2eeb45,_0x167b02){var _0x393426={'raw':!![],'where':{'id':_0x2eeb45[_0xe6d9('0x45')]['id']}},_0x1b9469={};_0x1b9469[_0xe6d9('0x30')]=_[_0xe6d9('0x46')](db[_0xe6d9('0x2d')]['rawAttributes']);_0x1b9469[_0xe6d9('0x31')]=_[_0xe6d9('0x46')](_0x2eeb45[_0xe6d9('0x31')]);_0x1b9469[_0xe6d9('0x32')]=_[_0xe6d9('0x47')](_0x1b9469[_0xe6d9('0x30')],_0x1b9469[_0xe6d9('0x31')]);_0x393426[_0xe6d9('0x33')]=_[_0xe6d9('0x47')](_0x1b9469[_0xe6d9('0x30')],qs['fields'](_0x2eeb45['query'][_0xe6d9('0x34')]));_0x393426['attributes']=_0x393426['attributes'][_0xe6d9('0x35')]?_0x393426['attributes']:_0x1b9469[_0xe6d9('0x30')];if(_0x2eeb45['query'][_0xe6d9('0x40')]){_0x393426[_0xe6d9('0x41')]=[{'all':!![]}];}_0x393426=_['merge']({},_0x393426,_0x2eeb45[_0xe6d9('0x3f')]);return db[_0xe6d9('0x2d')][_0xe6d9('0x48')](_0x393426)['then'](handleEntityNotFound(_0x167b02,null))[_0xe6d9('0x26')](respondWithResult(_0x167b02,null))['catch'](handleError(_0x167b02,null));};exports['create']=function(_0x2d9fde,_0x246616){return db['VoiceDialReport'][_0xe6d9('0x49')](_0x2d9fde[_0xe6d9('0x4a')],{})[_0xe6d9('0x26')](respondWithResult(_0x246616,0xc9))[_0xe6d9('0x44')](handleError(_0x246616,null));};exports[_0xe6d9('0x25')]=function(_0x263dd8,_0x1d1996){if(_0x263dd8[_0xe6d9('0x4a')]['id']){delete _0x263dd8['body']['id'];}return db['VoiceDialReport'][_0xe6d9('0x48')]({'where':{'id':_0x263dd8[_0xe6d9('0x45')]['id']}})[_0xe6d9('0x26')](handleEntityNotFound(_0x1d1996,null))[_0xe6d9('0x26')](saveUpdates(_0x263dd8[_0xe6d9('0x4a')],null))[_0xe6d9('0x26')](respondWithResult(_0x1d1996,null))[_0xe6d9('0x44')](handleError(_0x1d1996,null));};exports[_0xe6d9('0x27')]=function(_0x245459,_0x5c7259){return db[_0xe6d9('0x2d')]['find']({'where':{'id':_0x245459[_0xe6d9('0x45')]['id']}})['then'](handleEntityNotFound(_0x5c7259,null))[_0xe6d9('0x26')](removeEntity(_0x5c7259,null))['catch'](handleError(_0x5c7259,null));};exports['describe']=function(_0x255478,_0x51b4b6){return db[_0xe6d9('0x2d')][_0xe6d9('0x4b')]()[_0xe6d9('0x26')](respondWithResult(_0x51b4b6,null))[_0xe6d9('0x44')](handleError(_0x51b4b6,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 0b3d635..881a183 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 _0x87d9=['report_dial','uniqueid','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','VoiceDialReport'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x87d9,0x1af));var _0x987d=function(_0x4e55aa,_0x48bfd2){_0x4e55aa=_0x4e55aa-0x0;var _0x2f48d6=_0x87d9[_0x4e55aa];return _0x2f48d6;};'use strict';var _=require(_0x987d('0x0'));var util=require('util');var logger=require(_0x987d('0x1'))(_0x987d('0x2'));var moment=require(_0x987d('0x3'));var BPromise=require('bluebird');var rp=require(_0x987d('0x4'));var fs=require('fs');var path=require(_0x987d('0x5'));var rimraf=require(_0x987d('0x6'));var config=require(_0x987d('0x7'));var attributes=require(_0x987d('0x8'));module[_0x987d('0x9')]=function(_0x577bdf,_0x55771d){return _0x577bdf['define'](_0x987d('0xa'),attributes,{'tableName':_0x987d('0xb'),'paranoid':![],'indexes':[{'fields':[_0x987d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6484=['uniqueid','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial'];(function(_0x3485f8,_0x1b66cf){var _0x1fbba7=function(_0x135b73){while(--_0x135b73){_0x3485f8['push'](_0x3485f8['shift']());}};_0x1fbba7(++_0x1b66cf);}(_0x6484,0x1bb));var _0x4648=function(_0x1d9b2f,_0x302212){_0x1d9b2f=_0x1d9b2f-0x0;var _0xaca565=_0x6484[_0x1d9b2f];return _0xaca565;};'use strict';var _=require('lodash');var util=require(_0x4648('0x0'));var logger=require(_0x4648('0x1'))(_0x4648('0x2'));var moment=require(_0x4648('0x3'));var BPromise=require('bluebird');var rp=require(_0x4648('0x4'));var fs=require('fs');var path=require(_0x4648('0x5'));var rimraf=require('rimraf');var config=require(_0x4648('0x6'));var attributes=require(_0x4648('0x7'));module[_0x4648('0x8')]=function(_0x59a611,_0x85581e){return _0x59a611[_0x4648('0x9')](_0x4648('0xa'),attributes,{'tableName':_0x4648('0xb'),'paranoid':![],'indexes':[{'fields':[_0x4648('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index dbd0095..b3c6288 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 _0x9daf=['code','message','result','catch','CreateVoiceDialReport','create','options','raw','then','stringify','VoiceDialReport','update','body','where','attributes','UpdateVoiceDialReport','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x34ade5,_0x299ffd){var _0x3db04e=function(_0x9e118e){while(--_0x9e118e){_0x34ade5['push'](_0x34ade5['shift']());}};_0x3db04e(++_0x299ffd);}(_0x9daf,0x1ec));var _0xf9da=function(_0x3db0ba,_0x2be65c){_0x3db0ba=_0x3db0ba-0x0;var _0x2d8e9a=_0x9daf[_0x3db0ba];return _0x2d8e9a;};'use strict';var _=require('lodash');var util=require(_0xf9da('0x0'));var moment=require('moment');var BPromise=require(_0xf9da('0x1'));var rs=require(_0xf9da('0x2'));var fs=require('fs');var Redis=require(_0xf9da('0x3'));var db=require(_0xf9da('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf9da('0x5'))(_0xf9da('0x6'));var config=require(_0xf9da('0x7'));var jayson=require(_0xf9da('0x8'));var client=jayson[_0xf9da('0x9')][_0xf9da('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d36e3,_0x2c5103,_0x1b5c25){return new BPromise(function(_0x1b008a,_0x3f09a5){return client[_0xf9da('0xb')](_0x4d36e3,_0x1b5c25)['then'](function(_0x47f2a7){logger[_0xf9da('0xc')](_0xf9da('0xd'),_0x2c5103,'request\x20sent');logger[_0xf9da('0xe')](_0xf9da('0xf'),_0x2c5103,_0xf9da('0x10'),JSON['stringify'](_0x47f2a7));if(_0x47f2a7[_0xf9da('0x11')]){if(_0x47f2a7[_0xf9da('0x11')][_0xf9da('0x12')]===0x1f4){logger['error'](_0xf9da('0xd'),_0x2c5103,_0x47f2a7[_0xf9da('0x11')][_0xf9da('0x13')]);return _0x3f09a5(_0x47f2a7[_0xf9da('0x11')][_0xf9da('0x13')]);}logger[_0xf9da('0x11')](_0xf9da('0xd'),_0x2c5103,_0x47f2a7[_0xf9da('0x11')][_0xf9da('0x13')]);return _0x1b008a(_0x47f2a7[_0xf9da('0x11')][_0xf9da('0x13')]);}else{logger[_0xf9da('0xc')](_0xf9da('0xd'),_0x2c5103,_0xf9da('0x10'));_0x1b008a(_0x47f2a7[_0xf9da('0x14')][_0xf9da('0x13')]);}})[_0xf9da('0x15')](function(_0x312e99){logger[_0xf9da('0x11')](_0xf9da('0xd'),_0x2c5103,_0x312e99);_0x3f09a5(_0x312e99);});});}exports[_0xf9da('0x16')]=function(_0x5f2e01){var _0x34231b=this;return new Promise(function(_0x20e6cf,_0xcfadbd){return db['VoiceDialReport'][_0xf9da('0x17')](_0x5f2e01['body'],{'raw':_0x5f2e01['options']?_0x5f2e01[_0xf9da('0x18')][_0xf9da('0x19')]===undefined?!![]:![]:!![]})[_0xf9da('0x1a')](function(_0x27c3ea){logger[_0xf9da('0xc')](_0xf9da('0x16'),_0x5f2e01);logger[_0xf9da('0xe')](_0xf9da('0x16'),_0x5f2e01,JSON[_0xf9da('0x1b')](_0x27c3ea));_0x20e6cf(_0x27c3ea);})[_0xf9da('0x15')](function(_0xca6df0){logger[_0xf9da('0x11')](_0xf9da('0x16'),_0xca6df0[_0xf9da('0x13')],_0x5f2e01);_0xcfadbd(_0x34231b[_0xf9da('0x11')](0x1f4,_0xca6df0[_0xf9da('0x13')]));});});};exports['UpdateVoiceDialReport']=function(_0x48652c){var _0x17448b=this;return new Promise(function(_0x48ea9c,_0x56902c){return db[_0xf9da('0x1c')][_0xf9da('0x1d')](_0x48652c[_0xf9da('0x1e')],{'raw':_0x48652c['options']?_0x48652c[_0xf9da('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48652c[_0xf9da('0x18')]?_0x48652c[_0xf9da('0x18')][_0xf9da('0x1f')]||null:null,'attributes':_0x48652c[_0xf9da('0x18')]?_0x48652c['options'][_0xf9da('0x20')]||null:null,'limit':_0x48652c[_0xf9da('0x18')]?_0x48652c[_0xf9da('0x18')]['limit']||null:null})[_0xf9da('0x1a')](function(_0x349b68){logger[_0xf9da('0xc')]('UpdateVoiceDialReport',_0x48652c);logger[_0xf9da('0xe')]('UpdateVoiceDialReport',_0x48652c,JSON[_0xf9da('0x1b')](_0x349b68));_0x48ea9c(_0x349b68);})[_0xf9da('0x15')](function(_0x30c3d4){logger[_0xf9da('0x11')](_0xf9da('0x21'),_0x30c3d4[_0xf9da('0x13')],_0x48652c);_0x56902c(_0x17448b['error'](0x1f4,_0x30c3d4[_0xf9da('0x13')]));});});}; \ No newline at end of file +var _0x1cbf=['catch','CreateVoiceDialReport','create','body','options','raw','debug','stringify','UpdateVoiceDialReport','VoiceDialReport','where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','then','info','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','VoiceDialReport,\x20%s,\x20%s','message'];(function(_0x5e9060,_0x46d2a2){var _0x5ba7cb=function(_0xe82280){while(--_0xe82280){_0x5e9060['push'](_0x5e9060['shift']());}};_0x5ba7cb(++_0x46d2a2);}(_0x1cbf,0xd8));var _0xf1cb=function(_0x5d3ba2,_0x45b47b){_0x5d3ba2=_0x5d3ba2-0x0;var _0x790c6d=_0x1cbf[_0x5d3ba2];return _0x790c6d;};'use strict';var _=require(_0xf1cb('0x0'));var util=require(_0xf1cb('0x1'));var moment=require(_0xf1cb('0x2'));var BPromise=require(_0xf1cb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf1cb('0x4'));var db=require(_0xf1cb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf1cb('0x6'))('rpc');var config=require(_0xf1cb('0x7'));var jayson=require(_0xf1cb('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3675dc,_0x3cf191,_0xb18d19){return new BPromise(function(_0x62da2c,_0x5ad073){return client['request'](_0x3675dc,_0xb18d19)[_0xf1cb('0x9')](function(_0x1b92e0){logger[_0xf1cb('0xa')]('VoiceDialReport,\x20%s,\x20%s',_0x3cf191,_0xf1cb('0xb'));logger['debug'](_0xf1cb('0xc'),_0x3cf191,_0xf1cb('0xb'),JSON['stringify'](_0x1b92e0));if(_0x1b92e0[_0xf1cb('0xd')]){if(_0x1b92e0['error']['code']===0x1f4){logger[_0xf1cb('0xd')](_0xf1cb('0xe'),_0x3cf191,_0x1b92e0['error']['message']);return _0x5ad073(_0x1b92e0[_0xf1cb('0xd')]['message']);}logger[_0xf1cb('0xd')](_0xf1cb('0xe'),_0x3cf191,_0x1b92e0[_0xf1cb('0xd')][_0xf1cb('0xf')]);return _0x62da2c(_0x1b92e0[_0xf1cb('0xd')][_0xf1cb('0xf')]);}else{logger[_0xf1cb('0xa')](_0xf1cb('0xe'),_0x3cf191,_0xf1cb('0xb'));_0x62da2c(_0x1b92e0['result'][_0xf1cb('0xf')]);}})[_0xf1cb('0x10')](function(_0x2a764a){logger[_0xf1cb('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0x3cf191,_0x2a764a);_0x5ad073(_0x2a764a);});});}exports[_0xf1cb('0x11')]=function(_0x4ee159){var _0x231fe8=this;return new Promise(function(_0x55e568,_0x820e4f){return db['VoiceDialReport'][_0xf1cb('0x12')](_0x4ee159[_0xf1cb('0x13')],{'raw':_0x4ee159[_0xf1cb('0x14')]?_0x4ee159[_0xf1cb('0x14')][_0xf1cb('0x15')]===undefined?!![]:![]:!![]})[_0xf1cb('0x9')](function(_0x4c33fe){logger[_0xf1cb('0xa')](_0xf1cb('0x11'),_0x4ee159);logger[_0xf1cb('0x16')](_0xf1cb('0x11'),_0x4ee159,JSON[_0xf1cb('0x17')](_0x4c33fe));_0x55e568(_0x4c33fe);})['catch'](function(_0x5efaba){logger['error'](_0xf1cb('0x11'),_0x5efaba[_0xf1cb('0xf')],_0x4ee159);_0x820e4f(_0x231fe8['error'](0x1f4,_0x5efaba[_0xf1cb('0xf')]));});});};exports[_0xf1cb('0x18')]=function(_0x126ab8){var _0x2aab7c=this;return new Promise(function(_0x20b09b,_0x69e44c){return db[_0xf1cb('0x19')]['update'](_0x126ab8[_0xf1cb('0x13')],{'raw':_0x126ab8[_0xf1cb('0x14')]?_0x126ab8[_0xf1cb('0x14')][_0xf1cb('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x126ab8[_0xf1cb('0x14')]?_0x126ab8['options'][_0xf1cb('0x1a')]||null:null,'attributes':_0x126ab8[_0xf1cb('0x14')]?_0x126ab8[_0xf1cb('0x14')][_0xf1cb('0x1b')]||null:null,'limit':_0x126ab8['options']?_0x126ab8[_0xf1cb('0x14')][_0xf1cb('0x1c')]||null:null})[_0xf1cb('0x9')](function(_0x236238){logger[_0xf1cb('0xa')](_0xf1cb('0x18'),_0x126ab8);logger[_0xf1cb('0x16')]('UpdateVoiceDialReport',_0x126ab8,JSON[_0xf1cb('0x17')](_0x236238));_0x20b09b(_0x236238);})[_0xf1cb('0x10')](function(_0x1e640d){logger[_0xf1cb('0xd')](_0xf1cb('0x18'),_0x1e640d[_0xf1cb('0xf')],_0x126ab8);_0x69e44c(_0x2aab7c[_0xf1cb('0xd')](0x1f4,_0x1e640d[_0xf1cb('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 5455c1b..f839b0f 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 _0x7b5c=['update','/:id','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','post','create','addApplications'];(function(_0x2b15ab,_0xe50088){var _0x2852a8=function(_0x5dd78f){while(--_0x5dd78f){_0x2b15ab['push'](_0x2b15ab['shift']());}};_0x2852a8(++_0xe50088);}(_0x7b5c,0x135));var _0xc7b5=function(_0xfc6247,_0x5cbddb){_0xfc6247=_0xfc6247-0x0;var _0x291245=_0x7b5c[_0xfc6247];return _0x291245;};'use strict';var multer=require(_0xc7b5('0x0'));var util=require(_0xc7b5('0x1'));var path=require(_0xc7b5('0x2'));var timeout=require(_0xc7b5('0x3'));var express=require(_0xc7b5('0x4'));var router=express[_0xc7b5('0x5')]();var fs_extra=require(_0xc7b5('0x6'));var auth=require(_0xc7b5('0x7'));var interaction=require(_0xc7b5('0x8'));var config=require('../../config/environment');var controller=require('./voiceExtension.controller');router[_0xc7b5('0x9')]('/',auth[_0xc7b5('0xa')](),controller[_0xc7b5('0xb')]);router[_0xc7b5('0x9')]('/:id',auth[_0xc7b5('0xa')](),controller['show']);router[_0xc7b5('0xc')]('/',auth['isAuthenticated'](),controller[_0xc7b5('0xd')]);router[_0xc7b5('0xc')]('/:id/applications',auth[_0xc7b5('0xa')](),controller[_0xc7b5('0xe')]);router['put']('/:id',auth[_0xc7b5('0xa')](),controller[_0xc7b5('0xf')]);router['delete'](_0xc7b5('0x10'),auth['isAuthenticated'](),controller[_0xc7b5('0x11')]);module['exports']=router; \ No newline at end of file +var _0x26e0=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','index','/:id','isAuthenticated','post','create','/:id/applications','put','delete','destroy','exports'];(function(_0x7729b1,_0x468322){var _0x349504=function(_0x401cee){while(--_0x401cee){_0x7729b1['push'](_0x7729b1['shift']());}};_0x349504(++_0x468322);}(_0x26e0,0x165));var _0x026e=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0x26e0[_0x1762b4];return _0x29beda;};'use strict';var multer=require('multer');var util=require(_0x026e('0x0'));var path=require(_0x026e('0x1'));var timeout=require(_0x026e('0x2'));var express=require(_0x026e('0x3'));var router=express[_0x026e('0x4')]();var fs_extra=require(_0x026e('0x5'));var auth=require(_0x026e('0x6'));var interaction=require(_0x026e('0x7'));var config=require(_0x026e('0x8'));var controller=require(_0x026e('0x9'));router[_0x026e('0xa')]('/',auth['isAuthenticated'](),controller[_0x026e('0xb')]);router['get'](_0x026e('0xc'),auth[_0x026e('0xd')](),controller['show']);router[_0x026e('0xe')]('/',auth[_0x026e('0xd')](),controller[_0x026e('0xf')]);router[_0x026e('0xe')](_0x026e('0x10'),auth[_0x026e('0xd')](),controller['addApplications']);router[_0x026e('0x11')](_0x026e('0xc'),auth[_0x026e('0xd')](),controller['update']);router[_0x026e('0x12')](_0x026e('0xc'),auth[_0x026e('0xd')](),controller[_0x026e('0x13')]);module[_0x026e('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index ebd369e..87f5558 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 _0x4bd8=['system','any','INTEGER','BOOLEAN','wav','getDataValue','sequelize','exports','compositeIndex','STRING','outbound','internal','inbound-fax'];(function(_0x52d0b7,_0x1ea015){var _0xb70be2=function(_0x53c2bd){while(--_0x53c2bd){_0x52d0b7['push'](_0x52d0b7['shift']());}};_0xb70be2(++_0x1ea015);}(_0x4bd8,0x10a));var _0x84bd=function(_0x1a683f,_0xef039){_0x1a683f=_0x1a683f-0x0;var _0x2d1dfa=_0x4bd8[_0x1a683f];return _0x2d1dfa;};'use strict';var Sequelize=require(_0x84bd('0x0'));module[_0x84bd('0x1')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x84bd('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x84bd('0x3')],'allowNull':![],'unique':_0x84bd('0x2')},'priority':{'type':Sequelize[_0x84bd('0x3')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x84bd('0x3')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x84bd('0x3')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize[_0x84bd('0x3')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM']('inbound',_0x84bd('0x4'),_0x84bd('0x5'),_0x84bd('0x6'),'outbound-fax',_0x84bd('0x7'),_0x84bd('0x8')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x84bd('0x3')],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0x84bd('0x9')]},'isApp':{'type':Sequelize[_0x84bd('0xa')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x84bd('0x3')],'defaultValue':null},'callerID':{'type':Sequelize[_0x84bd('0x3')],'allowNull':!![]},'record':{'type':Sequelize[_0x84bd('0xa')],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize[_0x84bd('0x3')],'defaultValue':_0x84bd('0xb')},'answer':{'type':Sequelize[_0x84bd('0xa')],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x2fcb17){return this[_0x84bd('0xc')]('exten');}},'alias':{'type':Sequelize[_0x84bd('0x3')],'allowNull':!![]}}; \ No newline at end of file +var _0x93a7=['inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal'];(function(_0xdd0313,_0x251c2b){var _0x2bd7e8=function(_0x340f1f){while(--_0x340f1f){_0xdd0313['push'](_0xdd0313['shift']());}};_0x2bd7e8(++_0x251c2b);}(_0x93a7,0x160));var _0x793a=function(_0x3968e9,_0x354905){_0x3968e9=_0x3968e9-0x0;var _0x45b100=_0x93a7[_0x3968e9];return _0x45b100;};'use strict';var Sequelize=require(_0x793a('0x0'));module[_0x793a('0x1')]={'context':{'type':Sequelize[_0x793a('0x2')],'allowNull':![],'unique':_0x793a('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x793a('0x2')],'allowNull':![],'unique':_0x793a('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x793a('0x3')},'tag':{'type':Sequelize[_0x793a('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x793a('0x2')],'allowNull':![],'defaultValue':_0x793a('0x4')},'appdata':{'type':Sequelize[_0x793a('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x793a('0x5')](_0x793a('0x6'),_0x793a('0x7'),_0x793a('0x8'),_0x793a('0x9'),_0x793a('0xa'),_0x793a('0xb'),_0x793a('0xc')),'allowNull':![]},'description':{'type':Sequelize[_0x793a('0x2')]},'interval':{'type':Sequelize[_0x793a('0x2')],'allowNull':![],'defaultValue':_0x793a('0xd')},'IntervalId':{'type':Sequelize[_0x793a('0xe')]},'isApp':{'type':Sequelize[_0x793a('0xf')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x793a('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x793a('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x793a('0xf')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x793a('0xe')]},'recordingFormat':{'type':Sequelize[_0x793a('0x2')],'defaultValue':_0x793a('0x10')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0x793a('0x11')],'get':function(_0x32b643){return this['getDataValue'](_0x793a('0x12'));}},'alias':{'type':Sequelize[_0x793a('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 3457fef..37327c0 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 _0xa24c=['InboundRoutes','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','description','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','findOne','sequelize','VoiceExtensionId','isApp','rewriteDial','toLowerCase','true','createRouting','bulkCreate','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','inbound','OutboundRoutes','outbound','InternalRoutes','internal','ignore','map','value','includes','type','name','UserProfileResource','error','stack','send','index','VoiceExtension','rawAttributes','fieldName','key','model','query','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','keys','fields','includeAll','find','params','create','body','startsWith','exten','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x2a2b4,_0xcc17b){var _0x16bec5=function(_0x5d5e08){while(--_0x5d5e08){_0x2a2b4['push'](_0x2a2b4['shift']());}};_0x16bec5(++_0xcc17b);}(_0xa24c,0x8b));var _0xca24=function(_0x4da5df,_0x3424b3){_0x4da5df=_0x4da5df-0x0;var _0x45c427=_0xa24c[_0x4da5df];return _0x45c427;};'use strict';var emlformat=require(_0xca24('0x0'));var rimraf=require(_0xca24('0x1'));var zipdir=require(_0xca24('0x2'));var jsonpatch=require(_0xca24('0x3'));var rp=require(_0xca24('0x4'));var moment=require(_0xca24('0x5'));var BPromise=require(_0xca24('0x6'));var Mustache=require('mustache');var util=require(_0xca24('0x7'));var path=require(_0xca24('0x8'));var sox=require(_0xca24('0x9'));var csv=require('to-csv');var ejs=require(_0xca24('0xa'));var fs=require('fs');var fs_extra=require(_0xca24('0xb'));var _=require(_0xca24('0xc'));var squel=require('squel');var crypto=require(_0xca24('0xd'));var jsforce=require(_0xca24('0xe'));var deskjs=require(_0xca24('0xf'));var toCsv=require(_0xca24('0x10'));var querystring=require(_0xca24('0x11'));var Papa=require(_0xca24('0x12'));var Redis=require(_0xca24('0x13'));var authService=require(_0xca24('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xca24('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xca24('0x16'));var licenseUtil=require(_0xca24('0x17'));var db=require(_0xca24('0x18'))['db'];config[_0xca24('0x19')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xca24('0x1a'))(new Redis(config[_0xca24('0x19')]));require('./voiceExtension.socket')['register'](socket);function respondWithStatusCode(_0x27ab12,_0x403177){_0x403177=_0x403177||0xcc;return function(_0x941736){if(_0x941736){return _0x27ab12[_0xca24('0x1b')](_0x403177);}return _0x27ab12[_0xca24('0x1c')](_0x403177)['end']();};}function respondWithResult(_0x47290d,_0x26ed3a){_0x26ed3a=_0x26ed3a||0xc8;return function(_0x2be424){if(_0x2be424){return _0x47290d[_0xca24('0x1c')](_0x26ed3a)[_0xca24('0x1d')](_0x2be424);}};}function respondWithFilteredResult(_0x49500a,_0x3d4017){return function(_0x3348c9){if(_0x3348c9){var _0x10f402=typeof _0x3d4017[_0xca24('0x1e')]===_0xca24('0x1f')&&typeof _0x3d4017[_0xca24('0x20')]===_0xca24('0x1f');var _0x3f7b90=_0x3348c9[_0xca24('0x21')];var _0x43b31e=_0x10f402?0x0:_0x3d4017['offset'];var _0x4c4012=_0x10f402?_0x3348c9[_0xca24('0x21')]:_0x3d4017[_0xca24('0x1e')]+_0x3d4017[_0xca24('0x20')];var _0x460ff1;if(_0x4c4012>=_0x3f7b90){_0x4c4012=_0x3f7b90;_0x460ff1=0xc8;}else{_0x460ff1=0xce;}_0x49500a[_0xca24('0x1c')](_0x460ff1);return _0x49500a[_0xca24('0x22')]('Content-Range',_0x43b31e+'-'+_0x4c4012+'/'+_0x3f7b90)[_0xca24('0x1d')](_0x3348c9);}return null;};}function patchUpdates(_0x2fef58){return function(_0x26616f){try{jsonpatch[_0xca24('0x23')](_0x26616f,_0x2fef58,!![]);}catch(_0x37a2b9){return BPromise[_0xca24('0x24')](_0x37a2b9);}return _0x26616f[_0xca24('0x25')]();};}function saveUpdates(_0x17c10a,_0x185b8f){return function(_0x56281f){if(_0x56281f){return _0x56281f[_0xca24('0x26')](_0x17c10a)[_0xca24('0x27')](function(_0x2f00a4){return _0x2f00a4;});}return null;};}function removeEntity(_0x3babbd,_0x524a77){return function(_0x52b7da){if(_0x52b7da){return _0x52b7da[_0xca24('0x28')]()[_0xca24('0x27')](function(){var _0x5e888b=_0x52b7da[_0xca24('0x29')]({'plain':!![]});var _0x5e8223=[{'name':'InboundRoutes','value':_0xca24('0x2a'),'ignore':![]},{'name':_0xca24('0x2b'),'value':_0xca24('0x2c'),'ignore':![]},{'name':_0xca24('0x2d'),'value':_0xca24('0x2e'),'ignore':![]}];var _0x1734a7=_(_0x5e8223)['filter'](_0xca24('0x2f'))[_0xca24('0x30')](_0xca24('0x31'))[_0xca24('0x31')]();if(_[_0xca24('0x32')](_0x1734a7,_0x5e888b[_0xca24('0x33')])){return;}var _0x9c24e2=_['find'](_0x5e8223,[_0xca24('0x31'),_0x5e888b[_0xca24('0x33')]])[_0xca24('0x34')];return db[_0xca24('0x35')][_0xca24('0x28')]({'where':{'type':_0x9c24e2,'resourceId':_0x5e888b['id']}})['then'](function(){return _0x52b7da;});})[_0xca24('0x27')](function(){_0x3babbd[_0xca24('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40e867,_0x52a746){return function(_0x1cada2){if(!_0x1cada2){_0x40e867['sendStatus'](0x194);}return _0x1cada2;};}function handleError(_0x194d27,_0x3bc07e){_0x3bc07e=_0x3bc07e||0x1f4;return function(_0x1f9f98){logger[_0xca24('0x36')](_0x1f9f98[_0xca24('0x37')]);if(_0x1f9f98[_0xca24('0x34')]){delete _0x1f9f98[_0xca24('0x34')];}_0x194d27[_0xca24('0x1c')](_0x3bc07e)[_0xca24('0x38')](_0x1f9f98);};}exports[_0xca24('0x39')]=function(_0x581456,_0x3ddf3f){var _0x46a832={},_0x2aeda2={},_0x2fc964={'count':0x0,'rows':[]};var _0x33cf17=_[_0xca24('0x30')](db[_0xca24('0x3a')][_0xca24('0x3b')],function(_0x1de00f){return{'name':_0x1de00f[_0xca24('0x3c')],'type':_0x1de00f[_0xca24('0x33')][_0xca24('0x3d')]};});_0x2aeda2[_0xca24('0x3e')]=_[_0xca24('0x30')](_0x33cf17,_0xca24('0x34'));_0x2aeda2[_0xca24('0x3f')]=_['keys'](_0x581456['query']);_0x2aeda2['filters']=_[_0xca24('0x40')](_0x2aeda2[_0xca24('0x3e')],_0x2aeda2[_0xca24('0x3f')]);_0x46a832['attributes']=_[_0xca24('0x40')](_0x2aeda2[_0xca24('0x3e')],qs['fields'](_0x581456[_0xca24('0x3f')]['fields']));_0x46a832[_0xca24('0x41')]=_0x46a832[_0xca24('0x41')][_0xca24('0x42')]?_0x46a832[_0xca24('0x41')]:_0x2aeda2[_0xca24('0x3e')];if(!_0x581456['query'][_0xca24('0x43')](_0xca24('0x44'))){_0x46a832['limit']=qs[_0xca24('0x20')](_0x581456[_0xca24('0x3f')][_0xca24('0x20')]);_0x46a832[_0xca24('0x1e')]=qs[_0xca24('0x1e')](_0x581456[_0xca24('0x3f')][_0xca24('0x1e')]);}_0x46a832[_0xca24('0x45')]=qs['sort'](_0x581456['query'][_0xca24('0x46')]);_0x46a832[_0xca24('0x47')]=qs[_0xca24('0x48')](_[_0xca24('0x49')](_0x581456[_0xca24('0x3f')],_0x2aeda2[_0xca24('0x48')]),_0x33cf17);if(_0x581456[_0xca24('0x3f')][_0xca24('0x4a')]){_0x46a832[_0xca24('0x47')]=_[_0xca24('0x4b')](_0x46a832[_0xca24('0x47')],{'$or':_[_0xca24('0x30')](_0x33cf17,function(_0xf55144){if(_0xf55144[_0xca24('0x33')]!==_0xca24('0x4c')){var _0x224def={};_0x224def[_0xf55144[_0xca24('0x34')]]={'$like':'%'+_0x581456[_0xca24('0x3f')]['filter']+'%'};return _0x224def;}})});}_0x46a832=_['merge']({},_0x46a832,_0x581456[_0xca24('0x4d')]);var _0x54860e={'where':_0x46a832[_0xca24('0x47')]};return db['VoiceExtension'][_0xca24('0x21')](_0x54860e)[_0xca24('0x27')](function(_0x30c1c4){_0x2fc964[_0xca24('0x21')]=_0x30c1c4;if(_0x581456[_0xca24('0x3f')]['includeAll']){_0x46a832[_0xca24('0x4e')]=[{'all':!![]}];}return db['VoiceExtension'][_0xca24('0x4f')](_0x46a832);})[_0xca24('0x27')](function(_0x49fe73){_0x2fc964[_0xca24('0x50')]=_0x49fe73;return _0x2fc964;})['then'](respondWithFilteredResult(_0x3ddf3f,_0x46a832))[_0xca24('0x51')](handleError(_0x3ddf3f,null));};exports[_0xca24('0x52')]=function(_0x61c42d,_0x39e2fd){var _0x1c03f6={'raw':![],'where':{'id':_0x61c42d['params']['id']}},_0x3038ef={};_0x3038ef[_0xca24('0x3e')]=_[_0xca24('0x53')](db['VoiceExtension']['rawAttributes']);_0x3038ef['query']=_[_0xca24('0x53')](_0x61c42d[_0xca24('0x3f')]);_0x3038ef['filters']=_['intersection'](_0x3038ef['model'],_0x3038ef[_0xca24('0x3f')]);_0x1c03f6[_0xca24('0x41')]=_[_0xca24('0x40')](_0x3038ef[_0xca24('0x3e')],qs[_0xca24('0x54')](_0x61c42d['query'][_0xca24('0x54')]));_0x1c03f6[_0xca24('0x41')]=_0x1c03f6['attributes'][_0xca24('0x42')]?_0x1c03f6[_0xca24('0x41')]:_0x3038ef[_0xca24('0x3e')];if(_0x61c42d['query'][_0xca24('0x55')]){_0x1c03f6[_0xca24('0x4e')]=[{'all':!![]}];}_0x1c03f6=_['merge']({},_0x1c03f6,_0x61c42d['options']);return db['VoiceExtension'][_0xca24('0x56')](_0x1c03f6)['then'](handleEntityNotFound(_0x39e2fd,null))[_0xca24('0x27')](respondWithResult(_0x39e2fd,null))['catch'](handleError(_0x39e2fd,null));};exports[_0xca24('0x28')]=function(_0x1552b3,_0xc78026){return db[_0xca24('0x3a')][_0xca24('0x56')]({'where':{'id':_0x1552b3[_0xca24('0x57')]['id']}})[_0xca24('0x27')](handleEntityNotFound(_0xc78026,null))[_0xca24('0x27')](removeEntity(_0xc78026,null))[_0xca24('0x51')](handleError(_0xc78026,null));};exports[_0xca24('0x58')]=function(_0xc31da,_0x595b49){if(_0xc31da[_0xca24('0x59')][_0xca24('0x33')]===_0xca24('0x2c')&&!_[_0xca24('0x5a')](_0xc31da[_0xca24('0x59')]['exten'],'_')){_0xc31da[_0xca24('0x59')][_0xca24('0x5b')]='_'['concat'](_0xc31da[_0xca24('0x59')][_0xca24('0x5b')]);}return db[_0xca24('0x3a')][_0xca24('0x58')](_0xc31da[_0xca24('0x59')],{'raw':![]})['then'](function(_0x81facc){var _0x44e1da=_0xc31da[_0xca24('0x5c')]['get']({'plain':!![]});if(!_0x44e1da)throw new Error(_0xca24('0x5d'));if(_0x44e1da[_0xca24('0x5e')]===_0xca24('0x5c')){var _0x4e8017=_0x81facc[_0xca24('0x29')]({'plain':!![]});var _0x2d0fef=[{'name':_0xca24('0x5f'),'value':_0xca24('0x2a')},{'name':_0xca24('0x2b'),'value':_0xca24('0x2c')},{'name':_0xca24('0x2d'),'value':_0xca24('0x2e')}];var _0x533311=_[_0xca24('0x56')](_0x2d0fef,[_0xca24('0x31'),_0x4e8017[_0xca24('0x33')]])['name'];return db[_0xca24('0x60')][_0xca24('0x56')]({'where':{'name':_0x533311,'userProfileId':_0x44e1da[_0xca24('0x61')]},'raw':!![]})[_0xca24('0x27')](function(_0x13e8f8){if(_0x13e8f8&&_0x13e8f8[_0xca24('0x62')]===0x0){return db['UserProfileResource'][_0xca24('0x58')]({'name':_0x4e8017[_0xca24('0x34')],'resourceId':_0x4e8017['id'],'type':_0x13e8f8[_0xca24('0x34')],'sectionId':_0x13e8f8['id']},{})[_0xca24('0x27')](function(){return _0x81facc;});}else{return _0x81facc;}})['catch'](function(_0x392fa8){logger[_0xca24('0x36')](_0xca24('0x63'),_0x392fa8);throw _0x392fa8;});}return _0x81facc;})[_0xca24('0x27')](respondWithResult(_0x595b49,0xc9))[_0xca24('0x51')](handleError(_0x595b49,null));};exports[_0xca24('0x26')]=function(_0x5c60bc,_0x4da7b7){if(_0x5c60bc[_0xca24('0x59')]['id']){delete _0x5c60bc['body']['id'];}return db[_0xca24('0x3a')]['find']({'where':{'id':_0x5c60bc[_0xca24('0x57')]['id']}})[_0xca24('0x27')](handleEntityNotFound(_0x4da7b7,null))[_0xca24('0x27')](function(_0x326c20){if(_0x326c20){return db['VoiceExtension']['update'](_['pick'](_0x5c60bc[_0xca24('0x59')],[_0xca24('0x5b'),_0xca24('0x64'),_0xca24('0x65'),_0xca24('0x66'),_0xca24('0x67'),_0xca24('0x68'),_0xca24('0x69')]),{'where':{'context':_0x326c20[_0xca24('0x64')],'exten':_0x326c20[_0xca24('0x5b')]},'individualHooks':!![]})[_0xca24('0x27')](function(_0x2a8f09){return _0x2a8f09;});}return null;})[_0xca24('0x27')](respondWithStatusCode(_0x4da7b7,null))['catch'](handleError(_0x4da7b7,null));};exports[_0xca24('0x6a')]=function(_0x12a0a3,_0x29178e){return db[_0xca24('0x3a')][_0xca24('0x6b')]({'where':{'id':_0x12a0a3[_0xca24('0x57')]['id']}})[_0xca24('0x27')](function(_0x38dad0){if(_0x38dad0){return db[_0xca24('0x6c')]['transaction'](function(_0x443c47){return db[_0xca24('0x3a')][_0xca24('0x28')]({'where':{'VoiceExtensionId':_0x12a0a3[_0xca24('0x57')]['id']},'transaction':_0x443c47})[_0xca24('0x27')](function(){var _0x3a2a17=_[_0xca24('0x30')](_0x12a0a3[_0xca24('0x59')],function(_0x42a516){_0x42a516[_0xca24('0x6d')]=_0x12a0a3[_0xca24('0x57')]['id'];_0x42a516[_0xca24('0x6e')]=!![];return _0x42a516;});var _0x4d08ad=_0x12a0a3[_0xca24('0x3f')][_0xca24('0x6f')]&&_0x12a0a3['query'][_0xca24('0x6f')][_0xca24('0x70')]()===_0xca24('0x71')?!![]:![];return _0x38dad0[_0xca24('0x72')](_0x3a2a17,_0x4d08ad);})[_0xca24('0x27')](function(_0x254d84){return db[_0xca24('0x3a')][_0xca24('0x73')](_0x254d84,{'transaction':_0x443c47});});})['then'](function(){return db[_0xca24('0x3a')][_0xca24('0x74')]({'where':{'isApp':!![],'VoiceExtensionId':_0x12a0a3['params']['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})[_0xca24('0x27')](respondWithResult(_0x29178e,null))[_0xca24('0x51')](handleError(_0x29178e,null));}; \ No newline at end of file +var _0x30cd=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','./voiceExtension.socket','sendStatus','status','json','offset','undefined','limit','set','apply','save','update','then','destroy','get','InboundRoutes','OutboundRoutes','outbound','InternalRoutes','internal','map','value','find','name','UserProfileResource','end','error','stack','send','index','VoiceExtension','rawAttributes','fieldName','type','key','query','keys','filters','model','intersection','fields','attributes','length','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','show','params','startsWith','body','exten','concat','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','inbound','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','description','mandatoryDisposition','alias','addApplications','findOne','transaction','VoiceExtensionId','rewriteDial','toLowerCase','true','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','eml-format','rimraf','fast-json-patch','request-promise','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x14727e,_0x3e26bc){var _0x379f7b=function(_0x243b53){while(--_0x243b53){_0x14727e['push'](_0x14727e['shift']());}};_0x379f7b(++_0x3e26bc);}(_0x30cd,0x1a7));var _0xd30c=function(_0x749d4a,_0x57fc65){_0x749d4a=_0x749d4a-0x0;var _0x48453=_0x30cd[_0x749d4a];return _0x48453;};'use strict';var emlformat=require(_0xd30c('0x0'));var rimraf=require(_0xd30c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd30c('0x2'));var rp=require(_0xd30c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd30c('0x4'));var path=require(_0xd30c('0x5'));var sox=require(_0xd30c('0x6'));var csv=require(_0xd30c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd30c('0x8'));var _=require(_0xd30c('0x9'));var squel=require(_0xd30c('0xa'));var crypto=require(_0xd30c('0xb'));var jsforce=require(_0xd30c('0xc'));var deskjs=require(_0xd30c('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd30c('0xe'));var Papa=require(_0xd30c('0xf'));var Redis=require(_0xd30c('0x10'));var authService=require(_0xd30c('0x11'));var qs=require(_0xd30c('0x12'));var as=require(_0xd30c('0x13'));var hardwareService=require(_0xd30c('0x14'));var logger=require(_0xd30c('0x15'))('api');var utils=require(_0xd30c('0x16'));var config=require(_0xd30c('0x17'));var licenseUtil=require(_0xd30c('0x18'));var db=require(_0xd30c('0x19'))['db'];config[_0xd30c('0x1a')]=_['defaults'](config[_0xd30c('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd30c('0x1b'))['register'](socket);function respondWithStatusCode(_0x36ce13,_0x576b8d){_0x576b8d=_0x576b8d||0xcc;return function(_0x4473f8){if(_0x4473f8){return _0x36ce13[_0xd30c('0x1c')](_0x576b8d);}return _0x36ce13[_0xd30c('0x1d')](_0x576b8d)['end']();};}function respondWithResult(_0x17c825,_0x297eaf){_0x297eaf=_0x297eaf||0xc8;return function(_0x328522){if(_0x328522){return _0x17c825['status'](_0x297eaf)[_0xd30c('0x1e')](_0x328522);}};}function respondWithFilteredResult(_0x3d00db,_0x2b2c61){return function(_0x16c1a6){if(_0x16c1a6){var _0x1dcb41=typeof _0x2b2c61[_0xd30c('0x1f')]===_0xd30c('0x20')&&typeof _0x2b2c61['limit']===_0xd30c('0x20');var _0x36d69c=_0x16c1a6['count'];var _0x143c17=_0x1dcb41?0x0:_0x2b2c61[_0xd30c('0x1f')];var _0x2e5128=_0x1dcb41?_0x16c1a6['count']:_0x2b2c61[_0xd30c('0x1f')]+_0x2b2c61[_0xd30c('0x21')];var _0x3b7ea1;if(_0x2e5128>=_0x36d69c){_0x2e5128=_0x36d69c;_0x3b7ea1=0xc8;}else{_0x3b7ea1=0xce;}_0x3d00db[_0xd30c('0x1d')](_0x3b7ea1);return _0x3d00db[_0xd30c('0x22')]('Content-Range',_0x143c17+'-'+_0x2e5128+'/'+_0x36d69c)['json'](_0x16c1a6);}return null;};}function patchUpdates(_0x1d6c95){return function(_0x19f0c8){try{jsonpatch[_0xd30c('0x23')](_0x19f0c8,_0x1d6c95,!![]);}catch(_0x1725e6){return BPromise['reject'](_0x1725e6);}return _0x19f0c8[_0xd30c('0x24')]();};}function saveUpdates(_0x5ad428,_0xcab2a0){return function(_0x166238){if(_0x166238){return _0x166238[_0xd30c('0x25')](_0x5ad428)[_0xd30c('0x26')](function(_0x3bfacb){return _0x3bfacb;});}return null;};}function removeEntity(_0x4ddc14,_0x1fffcb){return function(_0x514497){if(_0x514497){return _0x514497[_0xd30c('0x27')]()[_0xd30c('0x26')](function(){var _0x534b59=_0x514497[_0xd30c('0x28')]({'plain':!![]});var _0x4b45ed=[{'name':_0xd30c('0x29'),'value':'inbound','ignore':![]},{'name':_0xd30c('0x2a'),'value':_0xd30c('0x2b'),'ignore':![]},{'name':_0xd30c('0x2c'),'value':_0xd30c('0x2d'),'ignore':![]}];var _0x112049=_(_0x4b45ed)['filter']('ignore')[_0xd30c('0x2e')](_0xd30c('0x2f'))[_0xd30c('0x2f')]();if(_['includes'](_0x112049,_0x534b59['type'])){return;}var _0x5baf13=_[_0xd30c('0x30')](_0x4b45ed,[_0xd30c('0x2f'),_0x534b59['type']])[_0xd30c('0x31')];return db[_0xd30c('0x32')]['destroy']({'where':{'type':_0x5baf13,'resourceId':_0x534b59['id']}})[_0xd30c('0x26')](function(){return _0x514497;});})['then'](function(){_0x4ddc14[_0xd30c('0x1d')](0xcc)[_0xd30c('0x33')]();});}};}function handleEntityNotFound(_0x145862,_0x192b9c){return function(_0x5c5352){if(!_0x5c5352){_0x145862[_0xd30c('0x1c')](0x194);}return _0x5c5352;};}function handleError(_0x5daced,_0x5b8958){_0x5b8958=_0x5b8958||0x1f4;return function(_0x17fe90){logger[_0xd30c('0x34')](_0x17fe90[_0xd30c('0x35')]);if(_0x17fe90[_0xd30c('0x31')]){delete _0x17fe90['name'];}_0x5daced[_0xd30c('0x1d')](_0x5b8958)[_0xd30c('0x36')](_0x17fe90);};}exports[_0xd30c('0x37')]=function(_0x4beb6c,_0x50d15a){var _0xbe7849={},_0x2c230c={},_0x1e7b03={'count':0x0,'rows':[]};var _0x5f3943=_['map'](db[_0xd30c('0x38')][_0xd30c('0x39')],function(_0x5b8759){return{'name':_0x5b8759[_0xd30c('0x3a')],'type':_0x5b8759[_0xd30c('0x3b')][_0xd30c('0x3c')]};});_0x2c230c['model']=_[_0xd30c('0x2e')](_0x5f3943,_0xd30c('0x31'));_0x2c230c[_0xd30c('0x3d')]=_[_0xd30c('0x3e')](_0x4beb6c[_0xd30c('0x3d')]);_0x2c230c[_0xd30c('0x3f')]=_['intersection'](_0x2c230c[_0xd30c('0x40')],_0x2c230c[_0xd30c('0x3d')]);_0xbe7849['attributes']=_[_0xd30c('0x41')](_0x2c230c['model'],qs[_0xd30c('0x42')](_0x4beb6c[_0xd30c('0x3d')][_0xd30c('0x42')]));_0xbe7849[_0xd30c('0x43')]=_0xbe7849['attributes'][_0xd30c('0x44')]?_0xbe7849['attributes']:_0x2c230c[_0xd30c('0x40')];if(!_0x4beb6c['query']['hasOwnProperty']('nolimit')){_0xbe7849['limit']=qs['limit'](_0x4beb6c['query'][_0xd30c('0x21')]);_0xbe7849[_0xd30c('0x1f')]=qs['offset'](_0x4beb6c[_0xd30c('0x3d')][_0xd30c('0x1f')]);}_0xbe7849['order']=qs[_0xd30c('0x45')](_0x4beb6c[_0xd30c('0x3d')][_0xd30c('0x45')]);_0xbe7849[_0xd30c('0x46')]=qs[_0xd30c('0x3f')](_[_0xd30c('0x47')](_0x4beb6c['query'],_0x2c230c[_0xd30c('0x3f')]),_0x5f3943);if(_0x4beb6c[_0xd30c('0x3d')][_0xd30c('0x48')]){_0xbe7849[_0xd30c('0x46')]=_[_0xd30c('0x49')](_0xbe7849[_0xd30c('0x46')],{'$or':_[_0xd30c('0x2e')](_0x5f3943,function(_0x91d907){if(_0x91d907[_0xd30c('0x3b')]!==_0xd30c('0x4a')){var _0x258870={};_0x258870[_0x91d907['name']]={'$like':'%'+_0x4beb6c[_0xd30c('0x3d')][_0xd30c('0x48')]+'%'};return _0x258870;}})});}_0xbe7849=_[_0xd30c('0x49')]({},_0xbe7849,_0x4beb6c[_0xd30c('0x4b')]);var _0x1ce019={'where':_0xbe7849['where']};return db[_0xd30c('0x38')][_0xd30c('0x4c')](_0x1ce019)[_0xd30c('0x26')](function(_0x3bef2e){_0x1e7b03[_0xd30c('0x4c')]=_0x3bef2e;if(_0x4beb6c[_0xd30c('0x3d')][_0xd30c('0x4d')]){_0xbe7849[_0xd30c('0x4e')]=[{'all':!![]}];}return db['VoiceExtension'][_0xd30c('0x4f')](_0xbe7849);})[_0xd30c('0x26')](function(_0x392f0b){_0x1e7b03['rows']=_0x392f0b;return _0x1e7b03;})['then'](respondWithFilteredResult(_0x50d15a,_0xbe7849))[_0xd30c('0x50')](handleError(_0x50d15a,null));};exports[_0xd30c('0x51')]=function(_0x40e146,_0x50d5e2){var _0x5e57af={'raw':![],'where':{'id':_0x40e146[_0xd30c('0x52')]['id']}},_0x4fc2f9={};_0x4fc2f9['model']=_['keys'](db[_0xd30c('0x38')][_0xd30c('0x39')]);_0x4fc2f9['query']=_[_0xd30c('0x3e')](_0x40e146[_0xd30c('0x3d')]);_0x4fc2f9[_0xd30c('0x3f')]=_[_0xd30c('0x41')](_0x4fc2f9[_0xd30c('0x40')],_0x4fc2f9[_0xd30c('0x3d')]);_0x5e57af[_0xd30c('0x43')]=_[_0xd30c('0x41')](_0x4fc2f9[_0xd30c('0x40')],qs[_0xd30c('0x42')](_0x40e146[_0xd30c('0x3d')][_0xd30c('0x42')]));_0x5e57af[_0xd30c('0x43')]=_0x5e57af[_0xd30c('0x43')][_0xd30c('0x44')]?_0x5e57af[_0xd30c('0x43')]:_0x4fc2f9[_0xd30c('0x40')];if(_0x40e146[_0xd30c('0x3d')][_0xd30c('0x4d')]){_0x5e57af[_0xd30c('0x4e')]=[{'all':!![]}];}_0x5e57af=_[_0xd30c('0x49')]({},_0x5e57af,_0x40e146['options']);return db[_0xd30c('0x38')][_0xd30c('0x30')](_0x5e57af)['then'](handleEntityNotFound(_0x50d5e2,null))[_0xd30c('0x26')](respondWithResult(_0x50d5e2,null))[_0xd30c('0x50')](handleError(_0x50d5e2,null));};exports[_0xd30c('0x27')]=function(_0x43b3f1,_0x12567a){return db['VoiceExtension'][_0xd30c('0x30')]({'where':{'id':_0x43b3f1[_0xd30c('0x52')]['id']}})[_0xd30c('0x26')](handleEntityNotFound(_0x12567a,null))['then'](removeEntity(_0x12567a,null))[_0xd30c('0x50')](handleError(_0x12567a,null));};exports['create']=function(_0x364a96,_0x32745c){if(_0x364a96['body'][_0xd30c('0x3b')]===_0xd30c('0x2b')&&!_[_0xd30c('0x53')](_0x364a96[_0xd30c('0x54')][_0xd30c('0x55')],'_')){_0x364a96[_0xd30c('0x54')][_0xd30c('0x55')]='_'[_0xd30c('0x56')](_0x364a96[_0xd30c('0x54')][_0xd30c('0x55')]);}return db[_0xd30c('0x38')][_0xd30c('0x57')](_0x364a96[_0xd30c('0x54')],{'raw':![]})[_0xd30c('0x26')](function(_0x235559){var _0x260854=_0x364a96['user'][_0xd30c('0x28')]({'plain':!![]});if(!_0x260854)throw new Error(_0xd30c('0x58'));if(_0x260854[_0xd30c('0x59')]==='user'){var _0x125f0d=_0x235559[_0xd30c('0x28')]({'plain':!![]});var _0x178f96=[{'name':_0xd30c('0x29'),'value':_0xd30c('0x5a')},{'name':'OutboundRoutes','value':'outbound'},{'name':_0xd30c('0x2c'),'value':_0xd30c('0x2d')}];var _0x1ee01d=_['find'](_0x178f96,[_0xd30c('0x2f'),_0x125f0d[_0xd30c('0x3b')]])[_0xd30c('0x31')];return db['UserProfileSection'][_0xd30c('0x30')]({'where':{'name':_0x1ee01d,'userProfileId':_0x260854[_0xd30c('0x5b')]},'raw':!![]})[_0xd30c('0x26')](function(_0x1334f3){if(_0x1334f3&&_0x1334f3[_0xd30c('0x5c')]===0x0){return db[_0xd30c('0x32')]['create']({'name':_0x125f0d[_0xd30c('0x31')],'resourceId':_0x125f0d['id'],'type':_0x1334f3[_0xd30c('0x31')],'sectionId':_0x1334f3['id']},{})[_0xd30c('0x26')](function(){return _0x235559;});}else{return _0x235559;}})['catch'](function(_0x149b59){logger[_0xd30c('0x34')](_0xd30c('0x5d'),_0x149b59);throw _0x149b59;});}return _0x235559;})[_0xd30c('0x26')](respondWithResult(_0x32745c,0xc9))[_0xd30c('0x50')](handleError(_0x32745c,null));};exports[_0xd30c('0x25')]=function(_0x18afcf,_0x5906d0){if(_0x18afcf[_0xd30c('0x54')]['id']){delete _0x18afcf['body']['id'];}return db[_0xd30c('0x38')][_0xd30c('0x30')]({'where':{'id':_0x18afcf[_0xd30c('0x52')]['id']}})[_0xd30c('0x26')](handleEntityNotFound(_0x5906d0,null))[_0xd30c('0x26')](function(_0x598724){if(_0x598724){return db['VoiceExtension']['update'](_['pick'](_0x18afcf[_0xd30c('0x54')],['exten',_0xd30c('0x5e'),_0xd30c('0x5f'),'recordingFormat','cutdigits',_0xd30c('0x60'),_0xd30c('0x61')]),{'where':{'context':_0x598724[_0xd30c('0x5e')],'exten':_0x598724['exten']},'individualHooks':!![]})[_0xd30c('0x26')](function(_0x19d08f){return _0x19d08f;});}return null;})['then'](respondWithStatusCode(_0x5906d0,null))[_0xd30c('0x50')](handleError(_0x5906d0,null));};exports[_0xd30c('0x62')]=function(_0x370c49,_0x5a3d60){return db['VoiceExtension'][_0xd30c('0x63')]({'where':{'id':_0x370c49['params']['id']}})[_0xd30c('0x26')](function(_0x28ca15){if(_0x28ca15){return db['sequelize'][_0xd30c('0x64')](function(_0x482542){return db[_0xd30c('0x38')][_0xd30c('0x27')]({'where':{'VoiceExtensionId':_0x370c49['params']['id']},'transaction':_0x482542})[_0xd30c('0x26')](function(){var _0x28fd9a=_[_0xd30c('0x2e')](_0x370c49['body'],function(_0x332989){_0x332989[_0xd30c('0x65')]=_0x370c49[_0xd30c('0x52')]['id'];_0x332989['isApp']=!![];return _0x332989;});var _0x19eea4=_0x370c49[_0xd30c('0x3d')][_0xd30c('0x66')]&&_0x370c49[_0xd30c('0x3d')][_0xd30c('0x66')][_0xd30c('0x67')]()===_0xd30c('0x68')?!![]:![];return _0x28ca15[_0xd30c('0x69')](_0x28fd9a,_0x19eea4);})[_0xd30c('0x26')](function(_0x283ba9){return db[_0xd30c('0x38')][_0xd30c('0x6a')](_0x283ba9,{'transaction':_0x482542});});})['then'](function(){return db['VoiceExtension'][_0xd30c('0x6b')]({'where':{'isApp':!![],'VoiceExtensionId':_0x370c49[_0xd30c('0x52')]['id']},'order':_0xd30c('0x6c')});});}})[_0xd30c('0x26')](respondWithResult(_0x5a3d60,null))[_0xd30c('0x50')](handleError(_0x5a3d60,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 2a1c919..f261786 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 _0xb74d=['VoiceExtension','setMaxListeners','save','update','emit','hasOwnProperty','exports','events'];(function(_0x3cfa78,_0x51222){var _0x531099=function(_0x4a957e){while(--_0x4a957e){_0x3cfa78['push'](_0x3cfa78['shift']());}};_0x531099(++_0x51222);}(_0xb74d,0x13f));var _0xdb74=function(_0x440917,_0x20ea7b){_0x440917=_0x440917-0x0;var _0x5e906b=_0xb74d[_0x440917];return _0x5e906b;};'use strict';var EventEmitter=require(_0xdb74('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0xdb74('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xdb74('0x2')](0x0);var events={'afterCreate':_0xdb74('0x3'),'afterUpdate':_0xdb74('0x4'),'afterDestroy':'remove'};function emitEvent(_0x396c34){return function(_0x1984a2,_0x3fd5c1,_0x14a64d){VoiceExtensionEvents[_0xdb74('0x5')](_0x396c34+':'+_0x1984a2['id'],_0x1984a2);VoiceExtensionEvents[_0xdb74('0x5')](_0x396c34,_0x1984a2);_0x14a64d(null);};}for(var e in events){if(events[_0xdb74('0x6')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0xdb74('0x7')]=VoiceExtensionEvents; \ No newline at end of file +var _0x8cc8=['VoiceExtension','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x146feb,_0x3159f0){var _0x5edb7e=function(_0x4ff67c){while(--_0x4ff67c){_0x146feb['push'](_0x146feb['shift']());}};_0x5edb7e(++_0x3159f0);}(_0x8cc8,0x1f3));var _0x88cc=function(_0x159dfe,_0x170d6a){_0x159dfe=_0x159dfe-0x0;var _0x56bc05=_0x8cc8[_0x159dfe];return _0x56bc05;};'use strict';var EventEmitter=require(_0x88cc('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x88cc('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x88cc('0x2')](0x0);var events={'afterCreate':_0x88cc('0x3'),'afterUpdate':_0x88cc('0x4'),'afterDestroy':_0x88cc('0x5')};function emitEvent(_0x2ed084){return function(_0x264b6f,_0x33d2d5,_0x356312){VoiceExtensionEvents[_0x88cc('0x6')](_0x2ed084+':'+_0x264b6f['id'],_0x264b6f);VoiceExtensionEvents[_0x88cc('0x6')](_0x2ed084,_0x264b6f);_0x356312(null);};}for(var e in events){if(events[_0x88cc('0x7')](e)){var event=events[e];VoiceExtension[_0x88cc('0x8')](e,emitEvent(event));}}module[_0x88cc('0x9')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 0dd7e57..ffb423a 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 _0xcc2d=['No\x20alias\x20set','inbound','push','XCALLY-MOTION-ANSWER=0','exten','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(destination)=','${EXTEN:','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','cutdigits','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','split','name','param','phone','prefix','SIP','join','options','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','then','length','*,*,*,*','intervals','IntervalId','map','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','NoOp(No\x20number\x20available)','answer','queue','playback','includes','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','concat','priority','catch','define','last','Hangup','util','lodash','./voiceExtension.attributes','exports','type','Set','CDR(type)=','context','alias','NoOp','CDR(routeAlias)='];(function(_0x39d625,_0xcbd247){var _0x45bafa=function(_0x40f316){while(--_0x40f316){_0x39d625['push'](_0x39d625['shift']());}};_0x45bafa(++_0xcbd247);}(_0xcc2d,0x99));var _0xdcc2=function(_0x3fc44c,_0x5a6fe8){_0x3fc44c=_0x3fc44c-0x0;var _0x2909b6=_0xcc2d[_0x3fc44c];return _0x2909b6;};'use strict';var util=require(_0xdcc2('0x0'));var _=require(_0xdcc2('0x1'));var attributes=require(_0xdcc2('0x2'));module[_0xdcc2('0x3')]=function(_0x7072d2){var _0x2d9744=_0x7072d2['models'];function _0x1da6c2(_0x5f5c2f){var _0x1902a9=0x2;var _0x337b9e=[{'type':_0x5f5c2f[_0xdcc2('0x4')],'app':_0xdcc2('0x5'),'appdata':_0xdcc2('0x6')+_0x5f5c2f[_0xdcc2('0x4')],'context':_0x5f5c2f[_0xdcc2('0x7')],'exten':_0x5f5c2f['exten'],'priority':_0x1902a9++,'VoiceExtensionId':_0x5f5c2f['id']},{'type':_0x5f5c2f['type'],'app':_0x5f5c2f[_0xdcc2('0x8')]?_0xdcc2('0x5'):_0xdcc2('0x9'),'appdata':_0x5f5c2f[_0xdcc2('0x8')]?_0xdcc2('0xa')+_0x5f5c2f[_0xdcc2('0x8')]:_0xdcc2('0xb'),'context':_0x5f5c2f[_0xdcc2('0x7')],'exten':_0x5f5c2f['exten'],'priority':_0x1902a9++,'VoiceExtensionId':_0x5f5c2f['id']}];if(_0x5f5c2f[_0xdcc2('0x4')]===_0xdcc2('0xc')){_0x337b9e[_0xdcc2('0xd')]({'type':_0xdcc2('0xc'),'app':_0xdcc2('0x5'),'appdata':'CDR(routeid)='+_0x5f5c2f['id'],'context':_0x5f5c2f['context'],'exten':_0x5f5c2f['exten'],'priority':_0x1902a9++,'VoiceExtensionId':_0x5f5c2f['id']});}_0x337b9e[_0xdcc2('0xd')]({'type':_0x5f5c2f['type'],'app':_0xdcc2('0x5'),'appdata':_0xdcc2('0xe'),'context':_0x5f5c2f['context'],'exten':_0x5f5c2f[_0xdcc2('0xf')],'priority':_0x1902a9++,'VoiceExtensionId':_0x5f5c2f['id']},{'type':_0x5f5c2f[_0xdcc2('0x4')],'app':_0xdcc2('0x5'),'appdata':_0xdcc2('0x10'),'context':_0x5f5c2f[_0xdcc2('0x7')],'exten':_0x5f5c2f[_0xdcc2('0xf')],'priority':_0x1902a9++,'VoiceExtensionId':_0x5f5c2f['id']},{'type':_0x5f5c2f['type'],'app':'Set','appdata':_0xdcc2('0x11'),'context':_0x5f5c2f[_0xdcc2('0x7')],'exten':_0x5f5c2f['exten'],'priority':_0x1902a9++,'VoiceExtensionId':_0x5f5c2f['id']});return _0x337b9e;}function _0x67d04f(_0x4cf478){var _0x2f67e1=0x2;var _0x354cbc=[{'type':_0xdcc2('0x12'),'app':_0xdcc2('0x5'),'appdata':'CDR(type)=outbound','context':_0x4cf478[_0xdcc2('0x7')],'exten':_0x4cf478[_0xdcc2('0xf')],'priority':_0x2f67e1++,'VoiceExtensionId':_0x4cf478['id']},{'type':'outbound','app':_0x4cf478[_0xdcc2('0x8')]?_0xdcc2('0x5'):_0xdcc2('0x9'),'appdata':_0x4cf478[_0xdcc2('0x8')]?'CDR(routeAlias)='+_0x4cf478[_0xdcc2('0x8')]:_0xdcc2('0xb'),'context':_0x4cf478[_0xdcc2('0x7')],'exten':_0x4cf478['exten'],'priority':_0x2f67e1++,'VoiceExtensionId':_0x4cf478['id']},{'type':_0xdcc2('0x12'),'app':_0xdcc2('0x5'),'appdata':_0xdcc2('0x13')+(_0x4cf478['cutdigits']?_0xdcc2('0x14')+_0x4cf478['cutdigits']+'}':_0xdcc2('0x15')),'context':_0x4cf478[_0xdcc2('0x7')],'exten':_0x4cf478[_0xdcc2('0xf')],'priority':_0x2f67e1++,'VoiceExtensionId':_0x4cf478['id']},{'type':'outbound','app':'Set','appdata':_0xdcc2('0x16')+_0x4cf478['id'],'context':_0x4cf478['context'],'exten':_0x4cf478[_0xdcc2('0xf')],'priority':_0x2f67e1++,'VoiceExtensionId':_0x4cf478['id']},{'type':_0xdcc2('0x12'),'app':_0xdcc2('0x17'),'appdata':_0xdcc2('0x18')+(_0x2f67e1+0x2)+'):Goto('+(_0x2f67e1+0x1)+')','context':_0x4cf478['context'],'exten':_0x4cf478[_0xdcc2('0xf')],'priority':_0x2f67e1++,'VoiceExtensionId':_0x4cf478['id']},{'type':_0xdcc2('0x12'),'app':_0xdcc2('0x5'),'appdata':_0x4cf478[_0xdcc2('0x19')]?'CDR(prefix)=${EXTEN:0:'+_0x4cf478[_0xdcc2('0x19')]+'}':_0xdcc2('0x1a'),'context':_0x4cf478[_0xdcc2('0x7')],'exten':_0x4cf478[_0xdcc2('0xf')],'priority':_0x2f67e1++,'VoiceExtensionId':_0x4cf478['id']},{'type':_0xdcc2('0x12'),'app':'Set','appdata':_0xdcc2('0xe'),'context':_0x4cf478[_0xdcc2('0x7')],'exten':_0x4cf478[_0xdcc2('0xf')],'priority':_0x2f67e1++,'VoiceExtensionId':_0x4cf478['id']},{'type':'outbound','app':_0xdcc2('0x5'),'appdata':_0xdcc2('0x10'),'context':_0x4cf478[_0xdcc2('0x7')],'exten':_0x4cf478[_0xdcc2('0xf')],'priority':_0x2f67e1++,'VoiceExtensionId':_0x4cf478['id']},{'type':_0xdcc2('0x12'),'app':_0xdcc2('0x5'),'appdata':'MONITOR_OPTIONS=ab','context':_0x4cf478[_0xdcc2('0x7')],'exten':_0x4cf478['exten'],'priority':_0x2f67e1++,'VoiceExtensionId':_0x4cf478['id']},{'type':_0xdcc2('0x12'),'app':'Set','appdata':_0xdcc2('0x1b')+_0x4cf478['id'],'context':_0x4cf478[_0xdcc2('0x7')],'exten':_0x4cf478[_0xdcc2('0xf')],'priority':_0x2f67e1++,'VoiceExtensionId':_0x4cf478['id']}];if(_0x4cf478[_0xdcc2('0x1c')](_0xdcc2('0x1d'))&&_0x4cf478[_0xdcc2('0x1d')]!==_0xdcc2('0x1e')){_0x354cbc['push']({'type':_0xdcc2('0x12'),'app':_0xdcc2('0x5'),'appdata':_0xdcc2('0x1f'),'context':_0x4cf478[_0xdcc2('0x7')],'exten':_0x4cf478['exten'],'priority':_0x2f67e1++,'VoiceExtensionId':_0x4cf478['id']},{'type':_0xdcc2('0x12'),'app':'Set','appdata':_0xdcc2('0x20')+_0x4cf478[_0xdcc2('0x1d')]||_0xdcc2('0x21'),'context':_0x4cf478[_0xdcc2('0x7')],'exten':_0x4cf478['exten'],'priority':_0x2f67e1++,'VoiceExtensionId':_0x4cf478['id']});}return _0x354cbc;}function _0x2705c9(_0xeb6054){var _0x17121e=[{'name':_0xdcc2('0x22'),'param':0x0},{'name':'timeout','param':0x1},{'name':'options','param':0x2},{'name':'url','param':0x3}];var _0x411d5e={};var _0xebbee8=_0xeb6054[_0xdcc2('0x23')](',');var _0x2b553b=[];for(var _0x1979e0=0x0;_0x1979e0<_0x17121e['length'];_0x1979e0++){switch(_0x17121e[_0x1979e0][_0xdcc2('0x24')]){case _0xdcc2('0x22'):_0x411d5e[_0xdcc2('0x22')]=_0xebbee8[_0x17121e[_0x1979e0][_0xdcc2('0x25')]]['split']('/')[0x1];_0x411d5e[_0xdcc2('0x26')]=_0xebbee8[_0x17121e[_0x1979e0][_0xdcc2('0x25')]][_0xdcc2('0x23')]('/')[0x2];_0x411d5e[_0xdcc2('0x27')]=_0x411d5e[_0xdcc2('0x26')]?_0x411d5e['phone'][_0xdcc2('0x23')]('$')[0x0]:undefined;_0x411d5e[_0xdcc2('0x26')]=route['cutdigits']?(_0x411d5e[_0xdcc2('0x27')]||'')+'${EXTEN:'+route[_0xdcc2('0x19')]+'}':(_0x411d5e[_0xdcc2('0x27')]||'')+_0xdcc2('0x15');_0x2b553b[_0x17121e[_0x1979e0][_0xdcc2('0x25')]]=[_0xdcc2('0x28'),_0x411d5e[_0xdcc2('0x22')],_0x411d5e[_0xdcc2('0x26')]][_0xdcc2('0x29')]('/');break;case _0xdcc2('0x2a'):_0x411d5e[_0xdcc2('0x2a')]=_0xebbee8[_0x17121e[_0x1979e0][_0xdcc2('0x25')]];if(route['recordingFormat']!==_0xdcc2('0x1e')){if(_0x411d5e[_0xdcc2('0x2a')][_0xdcc2('0x2b')](_0xdcc2('0x2c'))<0x0){_0x411d5e['options']+='U(xcally-mixmonitor-context)';}}else{_0x411d5e[_0xdcc2('0x2a')]=_0x411d5e[_0xdcc2('0x2a')][_0xdcc2('0x2d')](_0xdcc2('0x2c'),'');}_0x2b553b[_0x17121e[_0x1979e0][_0xdcc2('0x25')]]=_0x411d5e[_0xdcc2('0x2a')];break;default:_0x2b553b[_0x17121e[_0x1979e0]['param']]=_0xebbee8[_0x17121e[_0x1979e0][_0xdcc2('0x25')]];}}return _0x2b553b[_0xdcc2('0x29')](',');}function _0x56dfb7(_0x4927fc,_0x218b4d,_0x245626,_0x442326){return new Promise(function(_0x478700,_0x2a6941){var _0x42634e=[];if(_[_0xdcc2('0x2e')](_0x218b4d))return _0x478700(_0x42634e);_0x2d9744[_0xdcc2('0x2f')][_0xdcc2('0x30')]({'attributes':['id',_0xdcc2('0x31'),'IntervalId'],'raw':!![]})[_0xdcc2('0x32')](function(_0x33de3b){for(var _0x1c44eb=0x0,_0xa4b732=0x0;_0x1c44eb<_0x218b4d[_0xdcc2('0x33')];_0x1c44eb++,_0xa4b732=0x0){var _0x1e7d75=_0x218b4d[_0x1c44eb];var _0xc6e042=[];var _0xaeb61f=[];if(_0x1e7d75[_0xdcc2('0x31')]!==_0xdcc2('0x34')){_0x1e7d75['intervals']=[_0x1e7d75[_0xdcc2('0x31')]];}else{_0x1e7d75[_0xdcc2('0x35')]=_0x1e7d75[_0xdcc2('0x36')]?_[_0xdcc2('0x37')](_[_0xdcc2('0x38')](_0x33de3b,{'IntervalId':_0x1e7d75[_0xdcc2('0x36')]}),_0xdcc2('0x31')):[];}_0x1e7d75[_0xdcc2('0x7')]=_0x4927fc['context'];_0x1e7d75['exten']=_0x4927fc[_0xdcc2('0xf')];if(_0x1e7d75[_0xdcc2('0x4')])_0x1e7d75[_0xdcc2('0x4')]=_0x1e7d75[_0xdcc2('0x4')][_0xdcc2('0x39')]();if(_0x4927fc[_0xdcc2('0x4')]==='outbound'){if(_0x1e7d75[_0xdcc2('0x1c')](_0xdcc2('0x3a'))&&_0x1e7d75[_0xdcc2('0x3a')]&&_0x1e7d75['tag']!=='--'){_0xc6e042['push']({'type':_0x1e7d75[_0xdcc2('0x4')][_0xdcc2('0x39')](),'app':_0xdcc2('0x5'),'appdata':_0xdcc2('0x3b')+_0x1e7d75['tag'],'context':_0x4927fc[_0xdcc2('0x7')],'exten':_0x4927fc['exten'],'priority':_0x1e7d75[_0xdcc2('0x35')][_0xdcc2('0x33')]+_0x245626+_0xa4b732++,'VoiceExtensionId':_0x4927fc['id']});}_0xc6e042['push']({'type':_0x1e7d75[_0xdcc2('0x4')][_0xdcc2('0x39')](),'app':'ExecIf','appdata':_0xdcc2('0x3c')+(_0x1e7d75[_0xdcc2('0x3d')]?'Set(CALLERID(all)='+_0x1e7d75['callerID']+')':_0xdcc2('0x3e')),'context':_0x4927fc[_0xdcc2('0x7')],'exten':_0x4927fc[_0xdcc2('0xf')],'priority':_0x1e7d75['intervals'][_0xdcc2('0x33')]+_0x245626+_0xa4b732++,'VoiceExtensionId':_0x4927fc['id']});}else{if(_0x1e7d75['hasOwnProperty'](_0xdcc2('0x3f'))){if([_0xdcc2('0x40'),_0xdcc2('0x41')][_0xdcc2('0x42')](_0x1e7d75['app'][_0xdcc2('0x39')]())&&_0x1e7d75[_0xdcc2('0x43')]!==_0xdcc2('0x44')){if(_0x1e7d75[_0xdcc2('0x3f')]){_0xc6e042[_0xdcc2('0xd')]({'type':_0x1e7d75[_0xdcc2('0x4')][_0xdcc2('0x39')](),'app':_0xdcc2('0x17'),'appdata':_0xdcc2('0x45'),'context':_0x4927fc[_0xdcc2('0x7')],'exten':_0x4927fc[_0xdcc2('0xf')],'priority':_0x1e7d75[_0xdcc2('0x35')][_0xdcc2('0x33')]+_0x245626+_0xa4b732++,'VoiceExtensionId':_0x4927fc['id']});_0xc6e042[_0xdcc2('0xd')]({'type':_0x1e7d75[_0xdcc2('0x4')]['toLowerCase'](),'app':_0xdcc2('0x5'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x4927fc[_0xdcc2('0x7')],'exten':_0x4927fc[_0xdcc2('0xf')],'priority':_0x1e7d75[_0xdcc2('0x35')]['length']+_0x245626+_0xa4b732++,'VoiceExtensionId':_0x4927fc['id']});}else{_0xc6e042[_0xdcc2('0xd')]({'type':_0x1e7d75['type'][_0xdcc2('0x39')](),'app':_0xdcc2('0x17'),'appdata':_0xdcc2('0x46'),'context':_0x4927fc['context'],'exten':_0x4927fc[_0xdcc2('0xf')],'priority':_0x1e7d75[_0xdcc2('0x35')][_0xdcc2('0x33')]+_0x245626+_0xa4b732++,'VoiceExtensionId':_0x4927fc['id']});_0xc6e042[_0xdcc2('0xd')]({'type':_0x1e7d75[_0xdcc2('0x4')][_0xdcc2('0x39')](),'app':_0xdcc2('0x5'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x4927fc[_0xdcc2('0x7')],'exten':_0x4927fc['exten'],'priority':_0x1e7d75['intervals'][_0xdcc2('0x33')]+_0x245626+_0xa4b732++,'VoiceExtensionId':_0x4927fc['id']});}}}}for(var _0xc93c6=0x0;_0xc93c6<_0x1e7d75[_0xdcc2('0x35')]['length'];_0xc93c6++){var _0xec7da9=_0x245626+_0x1e7d75[_0xdcc2('0x35')][_0xdcc2('0x33')];var _0xc93e89=_0xc93c6===_0x1e7d75[_0xdcc2('0x35')]['length']-0x1?_0x245626+_0xc6e042[_0xdcc2('0x33')]+_0xaeb61f[_0xdcc2('0x33')]+0x2:_0x245626+_0xc93c6+0x1;_0xc6e042[_0xdcc2('0x47')](_0xc93c6,0x0,{'type':_0x4927fc[_0xdcc2('0x4')],'app':_0xdcc2('0x48'),'appdata':_0x1e7d75[_0xdcc2('0x35')][_0xc93c6]+'?'+_0x4927fc[_0xdcc2('0x7')]+_0xdcc2('0x49')+_0xec7da9+':'+_0x4927fc['context']+_0xdcc2('0x49')+_0xc93e89,'exten':_0x4927fc[_0xdcc2('0xf')],'context':_0x4927fc[_0xdcc2('0x7')],'priority':_0x245626+_0xc93c6,'VoiceExtensionId':_0x4927fc['id']});}if(_0x442326&&_0x1e7d75[_0xdcc2('0x43')]===_0xdcc2('0x4a'))_0x1e7d75['appdata']=_0x2705c9(_0x1e7d75[_0xdcc2('0x4b')]);_0x1e7d75['priority']=_0xc6e042[_0xdcc2('0x33')]?_['last'](_0xc6e042)['priority']+0x1:_0x245626;_0x42634e=_[_0xdcc2('0x4c')](_0x42634e,_0xc6e042,[_0x1e7d75],_0xaeb61f);_0x245626=_['last'](_0x42634e)[_0xdcc2('0x4d')]+0x1;}return _0x478700(_0x42634e);})[_0xdcc2('0x4e')](function(_0x53d8ec){_0x2a6941(_0x53d8ec);});});}return _0x7072d2[_0xdcc2('0x4f')]('VoiceExtension',attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0xed307a,_0x8d52df){var _0xfe62f6=this;var _0x194f1d=_0xfe62f6[_0xdcc2('0x4')]==='outbound'?_0x67d04f(_0xfe62f6):_0x1da6c2(_0xfe62f6);return _0x56dfb7(_0xfe62f6,_0xed307a,_[_0xdcc2('0x50')](_0x194f1d)[_0xdcc2('0x4d')]+0x1,_0x8d52df)[_0xdcc2('0x32')](function(_0x324426){var _0xab9674=_[_0xdcc2('0x4c')](_0x194f1d,_0x324426);_0xab9674['push']({'type':_0xfe62f6[_0xdcc2('0x4')],'app':_0xdcc2('0x51'),'exten':_0xfe62f6[_0xdcc2('0xf')],'context':_0xfe62f6[_0xdcc2('0x7')],'priority':_[_0xdcc2('0x50')](_0xab9674)[_0xdcc2('0x4d')]+0x1,'VoiceExtensionId':_0xfe62f6['id']});return _0xab9674;});}}});}; \ No newline at end of file +var _0x256c=['ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','playback','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','outboundDial','appdata','priority','concat','last','catch','VoiceExtension','voice_extensions','models','type','CDR(type)=','exten','Set','NoOp','alias','CDR(routeAlias)=','No\x20alias\x20set','context','inbound','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','cutdigits','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','split','length','name','phone','param','prefix','${EXTEN:','SIP','join','options','indexOf','U(xcally-mixmonitor-context)','isEmpty','findAll','then','interval','*,*,*,*','IntervalId','map','filter','toLowerCase','tag','push','CDR(tag)=','intervals'];(function(_0xf04c6d,_0xe98786){var _0x4a804e=function(_0x431a0a){while(--_0x431a0a){_0xf04c6d['push'](_0xf04c6d['shift']());}};_0x4a804e(++_0xe98786);}(_0x256c,0x1a9));var _0xc256=function(_0x333539,_0x26a377){_0x333539=_0x333539-0x0;var _0x1b6b3a=_0x256c[_0x333539];return _0x1b6b3a;};'use strict';var util=require('util');var _=require('lodash');var attributes=require('./voiceExtension.attributes');module['exports']=function(_0x35f122){var _0x124b50=_0x35f122[_0xc256('0x0')];function _0x2fda71(_0x138928){var _0x3360cd=0x2;var _0x17abda=[{'type':_0x138928[_0xc256('0x1')],'app':'Set','appdata':_0xc256('0x2')+_0x138928[_0xc256('0x1')],'context':_0x138928['context'],'exten':_0x138928[_0xc256('0x3')],'priority':_0x3360cd++,'VoiceExtensionId':_0x138928['id']},{'type':_0x138928[_0xc256('0x1')],'app':_0x138928['alias']?_0xc256('0x4'):_0xc256('0x5'),'appdata':_0x138928[_0xc256('0x6')]?_0xc256('0x7')+_0x138928['alias']:_0xc256('0x8'),'context':_0x138928[_0xc256('0x9')],'exten':_0x138928['exten'],'priority':_0x3360cd++,'VoiceExtensionId':_0x138928['id']}];if(_0x138928[_0xc256('0x1')]===_0xc256('0xa')){_0x17abda['push']({'type':_0xc256('0xa'),'app':'Set','appdata':_0xc256('0xb')+_0x138928['id'],'context':_0x138928[_0xc256('0x9')],'exten':_0x138928['exten'],'priority':_0x3360cd++,'VoiceExtensionId':_0x138928['id']});}_0x17abda['push']({'type':_0x138928[_0xc256('0x1')],'app':_0xc256('0x4'),'appdata':_0xc256('0xc'),'context':_0x138928[_0xc256('0x9')],'exten':_0x138928['exten'],'priority':_0x3360cd++,'VoiceExtensionId':_0x138928['id']},{'type':_0x138928[_0xc256('0x1')],'app':_0xc256('0x4'),'appdata':_0xc256('0xd'),'context':_0x138928[_0xc256('0x9')],'exten':_0x138928[_0xc256('0x3')],'priority':_0x3360cd++,'VoiceExtensionId':_0x138928['id']},{'type':_0x138928[_0xc256('0x1')],'app':_0xc256('0x4'),'appdata':_0xc256('0xe'),'context':_0x138928[_0xc256('0x9')],'exten':_0x138928['exten'],'priority':_0x3360cd++,'VoiceExtensionId':_0x138928['id']});return _0x17abda;}function _0x53bff9(_0x445dc5){var _0x43989e=0x2;var _0x575ad7=[{'type':_0xc256('0xf'),'app':_0xc256('0x4'),'appdata':_0xc256('0x10'),'context':_0x445dc5[_0xc256('0x9')],'exten':_0x445dc5[_0xc256('0x3')],'priority':_0x43989e++,'VoiceExtensionId':_0x445dc5['id']},{'type':_0xc256('0xf'),'app':_0x445dc5['alias']?_0xc256('0x4'):_0xc256('0x5'),'appdata':_0x445dc5[_0xc256('0x6')]?_0xc256('0x7')+_0x445dc5[_0xc256('0x6')]:'No\x20alias\x20set','context':_0x445dc5['context'],'exten':_0x445dc5[_0xc256('0x3')],'priority':_0x43989e++,'VoiceExtensionId':_0x445dc5['id']},{'type':_0xc256('0xf'),'app':_0xc256('0x4'),'appdata':'CDR(destination)='+(_0x445dc5[_0xc256('0x11')]?'${EXTEN:'+_0x445dc5[_0xc256('0x11')]+'}':_0xc256('0x12')),'context':_0x445dc5[_0xc256('0x9')],'exten':_0x445dc5[_0xc256('0x3')],'priority':_0x43989e++,'VoiceExtensionId':_0x445dc5['id']},{'type':_0xc256('0xf'),'app':_0xc256('0x4'),'appdata':_0xc256('0xb')+_0x445dc5['id'],'context':_0x445dc5['context'],'exten':_0x445dc5[_0xc256('0x3')],'priority':_0x43989e++,'VoiceExtensionId':_0x445dc5['id']},{'type':_0xc256('0xf'),'app':'ExecIf','appdata':_0xc256('0x13')+(_0x43989e+0x2)+'):Goto('+(_0x43989e+0x1)+')','context':_0x445dc5['context'],'exten':_0x445dc5['exten'],'priority':_0x43989e++,'VoiceExtensionId':_0x445dc5['id']},{'type':'outbound','app':_0xc256('0x4'),'appdata':_0x445dc5['cutdigits']?_0xc256('0x14')+_0x445dc5[_0xc256('0x11')]+'}':_0xc256('0x15'),'context':_0x445dc5[_0xc256('0x9')],'exten':_0x445dc5[_0xc256('0x3')],'priority':_0x43989e++,'VoiceExtensionId':_0x445dc5['id']},{'type':'outbound','app':_0xc256('0x4'),'appdata':_0xc256('0xc'),'context':_0x445dc5[_0xc256('0x9')],'exten':_0x445dc5['exten'],'priority':_0x43989e++,'VoiceExtensionId':_0x445dc5['id']},{'type':_0xc256('0xf'),'app':'Set','appdata':_0xc256('0xd'),'context':_0x445dc5[_0xc256('0x9')],'exten':_0x445dc5[_0xc256('0x3')],'priority':_0x43989e++,'VoiceExtensionId':_0x445dc5['id']},{'type':'outbound','app':_0xc256('0x4'),'appdata':'MONITOR_OPTIONS=ab','context':_0x445dc5[_0xc256('0x9')],'exten':_0x445dc5[_0xc256('0x3')],'priority':_0x43989e++,'VoiceExtensionId':_0x445dc5['id']},{'type':'outbound','app':_0xc256('0x4'),'appdata':'outboundrouteid='+_0x445dc5['id'],'context':_0x445dc5[_0xc256('0x9')],'exten':_0x445dc5[_0xc256('0x3')],'priority':_0x43989e++,'VoiceExtensionId':_0x445dc5['id']}];if(_0x445dc5[_0xc256('0x16')]('recordingFormat')&&_0x445dc5[_0xc256('0x17')]!==_0xc256('0x18')){_0x575ad7['push']({'type':_0xc256('0xf'),'app':_0xc256('0x4'),'appdata':_0xc256('0x19'),'context':_0x445dc5[_0xc256('0x9')],'exten':_0x445dc5[_0xc256('0x3')],'priority':_0x43989e++,'VoiceExtensionId':_0x445dc5['id']},{'type':_0xc256('0xf'),'app':_0xc256('0x4'),'appdata':_0xc256('0x1a')+_0x445dc5['recordingFormat']||_0xc256('0x1b'),'context':_0x445dc5[_0xc256('0x9')],'exten':_0x445dc5[_0xc256('0x3')],'priority':_0x43989e++,'VoiceExtensionId':_0x445dc5['id']});}return _0x575ad7;}function _0x2d6eb8(_0x574f3b){var _0x26a760=[{'name':_0xc256('0x1c'),'param':0x0},{'name':_0xc256('0x1d'),'param':0x1},{'name':'options','param':0x2},{'name':'url','param':0x3}];var _0x6eafaa={};var _0x407251=_0x574f3b[_0xc256('0x1e')](',');var _0x8240a4=[];for(var _0x293412=0x0;_0x293412<_0x26a760[_0xc256('0x1f')];_0x293412++){switch(_0x26a760[_0x293412][_0xc256('0x20')]){case _0xc256('0x1c'):_0x6eafaa['trunk']=_0x407251[_0x26a760[_0x293412]['param']][_0xc256('0x1e')]('/')[0x1];_0x6eafaa[_0xc256('0x21')]=_0x407251[_0x26a760[_0x293412][_0xc256('0x22')]][_0xc256('0x1e')]('/')[0x2];_0x6eafaa[_0xc256('0x23')]=_0x6eafaa[_0xc256('0x21')]?_0x6eafaa[_0xc256('0x21')]['split']('$')[0x0]:undefined;_0x6eafaa[_0xc256('0x21')]=route['cutdigits']?(_0x6eafaa[_0xc256('0x23')]||'')+_0xc256('0x24')+route['cutdigits']+'}':(_0x6eafaa[_0xc256('0x23')]||'')+_0xc256('0x12');_0x8240a4[_0x26a760[_0x293412][_0xc256('0x22')]]=[_0xc256('0x25'),_0x6eafaa[_0xc256('0x1c')],_0x6eafaa[_0xc256('0x21')]][_0xc256('0x26')]('/');break;case'options':_0x6eafaa[_0xc256('0x27')]=_0x407251[_0x26a760[_0x293412][_0xc256('0x22')]];if(route[_0xc256('0x17')]!==_0xc256('0x18')){if(_0x6eafaa[_0xc256('0x27')][_0xc256('0x28')]('U(xcally-mixmonitor-context)')<0x0){_0x6eafaa[_0xc256('0x27')]+='U(xcally-mixmonitor-context)';}}else{_0x6eafaa[_0xc256('0x27')]=_0x6eafaa[_0xc256('0x27')]['replace'](_0xc256('0x29'),'');}_0x8240a4[_0x26a760[_0x293412][_0xc256('0x22')]]=_0x6eafaa[_0xc256('0x27')];break;default:_0x8240a4[_0x26a760[_0x293412][_0xc256('0x22')]]=_0x407251[_0x26a760[_0x293412][_0xc256('0x22')]];}}return _0x8240a4['join'](',');}function _0xac2390(_0x249b05,_0xb0a168,_0x9b0dd6,_0x28cf6a){return new Promise(function(_0x31f97d,_0x37b226){var _0x218436=[];if(_[_0xc256('0x2a')](_0xb0a168))return _0x31f97d(_0x218436);_0x124b50['Interval'][_0xc256('0x2b')]({'attributes':['id','interval','IntervalId'],'raw':!![]})[_0xc256('0x2c')](function(_0x69109b){for(var _0x438c8b=0x0,_0x372022=0x0;_0x438c8b<_0xb0a168[_0xc256('0x1f')];_0x438c8b++,_0x372022=0x0){var _0x3a5d31=_0xb0a168[_0x438c8b];var _0x3253f9=[];var _0x5a5bc2=[];if(_0x3a5d31[_0xc256('0x2d')]!==_0xc256('0x2e')){_0x3a5d31['intervals']=[_0x3a5d31[_0xc256('0x2d')]];}else{_0x3a5d31['intervals']=_0x3a5d31[_0xc256('0x2f')]?_[_0xc256('0x30')](_[_0xc256('0x31')](_0x69109b,{'IntervalId':_0x3a5d31[_0xc256('0x2f')]}),_0xc256('0x2d')):[];}_0x3a5d31[_0xc256('0x9')]=_0x249b05[_0xc256('0x9')];_0x3a5d31[_0xc256('0x3')]=_0x249b05['exten'];if(_0x3a5d31[_0xc256('0x1')])_0x3a5d31[_0xc256('0x1')]=_0x3a5d31[_0xc256('0x1')][_0xc256('0x32')]();if(_0x249b05[_0xc256('0x1')]===_0xc256('0xf')){if(_0x3a5d31[_0xc256('0x16')]('tag')&&_0x3a5d31[_0xc256('0x33')]&&_0x3a5d31[_0xc256('0x33')]!=='--'){_0x3253f9[_0xc256('0x34')]({'type':_0x3a5d31[_0xc256('0x1')][_0xc256('0x32')](),'app':_0xc256('0x4'),'appdata':_0xc256('0x35')+_0x3a5d31[_0xc256('0x33')],'context':_0x249b05[_0xc256('0x9')],'exten':_0x249b05[_0xc256('0x3')],'priority':_0x3a5d31[_0xc256('0x36')]['length']+_0x9b0dd6+_0x372022++,'VoiceExtensionId':_0x249b05['id']});}_0x3253f9['push']({'type':_0x3a5d31[_0xc256('0x1')][_0xc256('0x32')](),'app':_0xc256('0x37'),'appdata':_0xc256('0x38')+(_0x3a5d31[_0xc256('0x39')]?_0xc256('0x3a')+_0x3a5d31[_0xc256('0x39')]+')':_0xc256('0x3b')),'context':_0x249b05['context'],'exten':_0x249b05['exten'],'priority':_0x3a5d31[_0xc256('0x36')]['length']+_0x9b0dd6+_0x372022++,'VoiceExtensionId':_0x249b05['id']});}else{if(_0x3a5d31['hasOwnProperty'](_0xc256('0x3c'))){if(['queue',_0xc256('0x3d')][_0xc256('0x3e')](_0x3a5d31[_0xc256('0x3f')]['toLowerCase']())&&_0x3a5d31[_0xc256('0x40')]!==_0xc256('0x41')){if(_0x3a5d31[_0xc256('0x3c')]){_0x3253f9[_0xc256('0x34')]({'type':_0x3a5d31[_0xc256('0x1')][_0xc256('0x32')](),'app':_0xc256('0x37'),'appdata':_0xc256('0x42'),'context':_0x249b05[_0xc256('0x9')],'exten':_0x249b05[_0xc256('0x3')],'priority':_0x3a5d31['intervals'][_0xc256('0x1f')]+_0x9b0dd6+_0x372022++,'VoiceExtensionId':_0x249b05['id']});_0x3253f9[_0xc256('0x34')]({'type':_0x3a5d31[_0xc256('0x1')][_0xc256('0x32')](),'app':_0xc256('0x4'),'appdata':_0xc256('0x43'),'context':_0x249b05[_0xc256('0x9')],'exten':_0x249b05[_0xc256('0x3')],'priority':_0x3a5d31[_0xc256('0x36')]['length']+_0x9b0dd6+_0x372022++,'VoiceExtensionId':_0x249b05['id']});}else{_0x3253f9[_0xc256('0x34')]({'type':_0x3a5d31[_0xc256('0x1')][_0xc256('0x32')](),'app':_0xc256('0x37'),'appdata':_0xc256('0x44'),'context':_0x249b05[_0xc256('0x9')],'exten':_0x249b05[_0xc256('0x3')],'priority':_0x3a5d31[_0xc256('0x36')][_0xc256('0x1f')]+_0x9b0dd6+_0x372022++,'VoiceExtensionId':_0x249b05['id']});_0x3253f9[_0xc256('0x34')]({'type':_0x3a5d31[_0xc256('0x1')][_0xc256('0x32')](),'app':_0xc256('0x4'),'appdata':_0xc256('0x45'),'context':_0x249b05[_0xc256('0x9')],'exten':_0x249b05[_0xc256('0x3')],'priority':_0x3a5d31[_0xc256('0x36')][_0xc256('0x1f')]+_0x9b0dd6+_0x372022++,'VoiceExtensionId':_0x249b05['id']});}}}}for(var _0x687a5e=0x0;_0x687a5e<_0x3a5d31[_0xc256('0x36')]['length'];_0x687a5e++){var _0xc1933=_0x9b0dd6+_0x3a5d31[_0xc256('0x36')]['length'];var _0x7435f0=_0x687a5e===_0x3a5d31[_0xc256('0x36')][_0xc256('0x1f')]-0x1?_0x9b0dd6+_0x3253f9[_0xc256('0x1f')]+_0x5a5bc2[_0xc256('0x1f')]+0x2:_0x9b0dd6+_0x687a5e+0x1;_0x3253f9[_0xc256('0x46')](_0x687a5e,0x0,{'type':_0x249b05['type'],'app':'GotoIfTime','appdata':_0x3a5d31[_0xc256('0x36')][_0x687a5e]+'?'+_0x249b05['context']+',${EXTEN},'+_0xc1933+':'+_0x249b05[_0xc256('0x9')]+_0xc256('0x47')+_0x7435f0,'exten':_0x249b05['exten'],'context':_0x249b05['context'],'priority':_0x9b0dd6+_0x687a5e,'VoiceExtensionId':_0x249b05['id']});}if(_0x28cf6a&&_0x3a5d31[_0xc256('0x40')]===_0xc256('0x48'))_0x3a5d31['appdata']=_0x2d6eb8(_0x3a5d31[_0xc256('0x49')]);_0x3a5d31[_0xc256('0x4a')]=_0x3253f9[_0xc256('0x1f')]?_['last'](_0x3253f9)[_0xc256('0x4a')]+0x1:_0x9b0dd6;_0x218436=_[_0xc256('0x4b')](_0x218436,_0x3253f9,[_0x3a5d31],_0x5a5bc2);_0x9b0dd6=_[_0xc256('0x4c')](_0x218436)[_0xc256('0x4a')]+0x1;}return _0x31f97d(_0x218436);})[_0xc256('0x4d')](function(_0x4115ae){_0x37b226(_0x4115ae);});});}return _0x35f122['define'](_0xc256('0x4e'),attributes,{'tableName':_0xc256('0x4f'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x29e72b,_0x2df90f){var _0x25cdc0=this;var _0x35d49a=_0x25cdc0[_0xc256('0x1')]==='outbound'?_0x53bff9(_0x25cdc0):_0x2fda71(_0x25cdc0);return _0xac2390(_0x25cdc0,_0x29e72b,_[_0xc256('0x4c')](_0x35d49a)[_0xc256('0x4a')]+0x1,_0x2df90f)['then'](function(_0x271598){var _0x4e920f=_['concat'](_0x35d49a,_0x271598);_0x4e920f['push']({'type':_0x25cdc0[_0xc256('0x1')],'app':'Hangup','exten':_0x25cdc0['exten'],'context':_0x25cdc0[_0xc256('0x9')],'priority':_[_0xc256('0x4c')](_0x4e920f)[_0xc256('0x4a')]+0x1,'VoiceExtensionId':_0x25cdc0['id']});return _0x4e920f;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index c848625..595f0d5 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 _0x6347=['catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','register','request','then','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceExtension,\x20%s,\x20%s','message','info','result','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','limit','map','include','model'];(function(_0x486014,_0x2064e7){var _0x3c686a=function(_0x1037fd){while(--_0x1037fd){_0x486014['push'](_0x486014['shift']());}};_0x3c686a(++_0x2064e7);}(_0x6347,0x1c9));var _0x7634=function(_0x34563d,_0x3b9345){_0x34563d=_0x34563d-0x0;var _0x4886c7=_0x6347[_0x34563d];return _0x4886c7;};'use strict';var _=require(_0x7634('0x0'));var util=require(_0x7634('0x1'));var moment=require('moment');var BPromise=require(_0x7634('0x2'));var rs=require(_0x7634('0x3'));var fs=require('fs');var Redis=require(_0x7634('0x4'));var db=require(_0x7634('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7634('0x6'))('rpc');var config=require(_0x7634('0x7'));var jayson=require(_0x7634('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x7634('0x9')]=_[_0x7634('0xa')](config[_0x7634('0x9')],{'host':_0x7634('0xb'),'port':0x18eb});var socket=require(_0x7634('0xc'))(new Redis(config[_0x7634('0x9')]));require('./voiceExtension.socket')[_0x7634('0xd')](socket);function respondWithRpcPromise(_0x58f4c6,_0x5c32ca,_0x558499){return new BPromise(function(_0x2b1bef,_0x3e0a86){return client[_0x7634('0xe')](_0x58f4c6,_0x558499)[_0x7634('0xf')](function(_0x3aac0a){logger['info']('VoiceExtension,\x20%s,\x20%s',_0x5c32ca,_0x7634('0x10'));logger[_0x7634('0x11')](_0x7634('0x12'),_0x5c32ca,_0x7634('0x10'),JSON[_0x7634('0x13')](_0x3aac0a));if(_0x3aac0a[_0x7634('0x14')]){if(_0x3aac0a[_0x7634('0x14')][_0x7634('0x15')]===0x1f4){logger['error'](_0x7634('0x16'),_0x5c32ca,_0x3aac0a[_0x7634('0x14')][_0x7634('0x17')]);return _0x3e0a86(_0x3aac0a[_0x7634('0x14')]['message']);}logger[_0x7634('0x14')]('VoiceExtension,\x20%s,\x20%s',_0x5c32ca,_0x3aac0a[_0x7634('0x14')][_0x7634('0x17')]);return _0x2b1bef(_0x3aac0a[_0x7634('0x14')][_0x7634('0x17')]);}else{logger[_0x7634('0x18')](_0x7634('0x16'),_0x5c32ca,'request\x20sent');_0x2b1bef(_0x3aac0a[_0x7634('0x19')][_0x7634('0x17')]);}})['catch'](function(_0x3afe25){logger[_0x7634('0x14')]('VoiceExtension,\x20%s,\x20%s',_0x5c32ca,_0x3afe25);_0x3e0a86(_0x3afe25);});});}exports[_0x7634('0x1a')]=function(_0x514223){var _0x1f1a1a=this;return new Promise(function(_0x47bb83,_0x475635){return db[_0x7634('0x1b')][_0x7634('0x1c')]({'raw':_0x514223[_0x7634('0x1d')]?_0x514223['options'][_0x7634('0x1e')]===undefined?!![]:![]:!![],'where':_0x514223[_0x7634('0x1d')]?_0x514223[_0x7634('0x1d')][_0x7634('0x1f')]||null:null,'attributes':_0x514223[_0x7634('0x1d')]?_0x514223['options'][_0x7634('0x20')]||null:null,'limit':_0x514223[_0x7634('0x1d')]?_0x514223[_0x7634('0x1d')][_0x7634('0x21')]||null:null,'include':_0x514223['options']?_0x514223['options']['include']?_[_0x7634('0x22')](_0x514223['options'][_0x7634('0x23')],function(_0x5d0335){return{'model':db[_0x5d0335['model']],'as':_0x5d0335['as'],'attributes':_0x5d0335[_0x7634('0x20')],'include':_0x5d0335['include']?_[_0x7634('0x22')](_0x5d0335[_0x7634('0x23')],function(_0x4cd8e5){return{'model':db[_0x4cd8e5[_0x7634('0x24')]],'as':_0x4cd8e5['as'],'attributes':_0x4cd8e5[_0x7634('0x20')],'include':_0x4cd8e5[_0x7634('0x23')]?_[_0x7634('0x22')](_0x4cd8e5[_0x7634('0x23')],function(_0x4df6d6){return{'model':db[_0x4df6d6[_0x7634('0x24')]],'as':_0x4df6d6['as'],'attributes':_0x4df6d6[_0x7634('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x38fd9b){logger[_0x7634('0x18')](_0x7634('0x1a'),_0x514223);logger[_0x7634('0x11')]('GetVoiceExtension',_0x514223,JSON[_0x7634('0x13')](_0x38fd9b));_0x47bb83(_0x38fd9b);})[_0x7634('0x25')](function(_0x1fc451){logger['error']('GetVoiceExtension',_0x1fc451[_0x7634('0x17')],_0x514223);_0x475635(_0x1f1a1a[_0x7634('0x14')](0x1f4,_0x1fc451[_0x7634('0x17')]));});});}; \ No newline at end of file +var _0x0eb2=['include','map','model','info','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','client','http','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','VoiceExtension,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','GetVoiceExtension','findAll','options','where','attributes','limit'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x0eb2,0x11c));var _0x20eb=function(_0x12b850,_0x38a78d){_0x12b850=_0x12b850-0x0;var _0x244c49=_0x0eb2[_0x12b850];return _0x244c49;};'use strict';var _=require(_0x20eb('0x0'));var util=require('util');var moment=require(_0x20eb('0x1'));var BPromise=require(_0x20eb('0x2'));var rs=require(_0x20eb('0x3'));var fs=require('fs');var Redis=require(_0x20eb('0x4'));var db=require(_0x20eb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x20eb('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x20eb('0x7')][_0x20eb('0x8')]({'port':0x232a});config[_0x20eb('0x9')]=_['defaults'](config[_0x20eb('0x9')],{'host':_0x20eb('0xa'),'port':0x18eb});var socket=require(_0x20eb('0xb'))(new Redis(config[_0x20eb('0x9')]));require(_0x20eb('0xc'))[_0x20eb('0xd')](socket);function respondWithRpcPromise(_0x2c704d,_0x178e1a,_0x354645){return new BPromise(function(_0x3e6330,_0x198a58){return client[_0x20eb('0xe')](_0x2c704d,_0x354645)[_0x20eb('0xf')](function(_0x304536){logger['info'](_0x20eb('0x10'),_0x178e1a,'request\x20sent');logger[_0x20eb('0x11')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x178e1a,_0x20eb('0x12'),JSON[_0x20eb('0x13')](_0x304536));if(_0x304536[_0x20eb('0x14')]){if(_0x304536[_0x20eb('0x14')][_0x20eb('0x15')]===0x1f4){logger[_0x20eb('0x14')](_0x20eb('0x10'),_0x178e1a,_0x304536[_0x20eb('0x14')][_0x20eb('0x16')]);return _0x198a58(_0x304536[_0x20eb('0x14')][_0x20eb('0x16')]);}logger[_0x20eb('0x14')](_0x20eb('0x10'),_0x178e1a,_0x304536[_0x20eb('0x14')][_0x20eb('0x16')]);return _0x3e6330(_0x304536['error'][_0x20eb('0x16')]);}else{logger['info'](_0x20eb('0x10'),_0x178e1a,_0x20eb('0x12'));_0x3e6330(_0x304536[_0x20eb('0x17')][_0x20eb('0x16')]);}})[_0x20eb('0x18')](function(_0x934bbc){logger[_0x20eb('0x14')]('VoiceExtension,\x20%s,\x20%s',_0x178e1a,_0x934bbc);_0x198a58(_0x934bbc);});});}exports[_0x20eb('0x19')]=function(_0x3c16f2){var _0x50c857=this;return new Promise(function(_0x3763b8,_0x3eb2be){return db['VoiceExtension'][_0x20eb('0x1a')]({'raw':_0x3c16f2[_0x20eb('0x1b')]?_0x3c16f2[_0x20eb('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x3c16f2[_0x20eb('0x1b')]?_0x3c16f2[_0x20eb('0x1b')][_0x20eb('0x1c')]||null:null,'attributes':_0x3c16f2['options']?_0x3c16f2[_0x20eb('0x1b')][_0x20eb('0x1d')]||null:null,'limit':_0x3c16f2[_0x20eb('0x1b')]?_0x3c16f2['options'][_0x20eb('0x1e')]||null:null,'include':_0x3c16f2['options']?_0x3c16f2[_0x20eb('0x1b')][_0x20eb('0x1f')]?_[_0x20eb('0x20')](_0x3c16f2[_0x20eb('0x1b')][_0x20eb('0x1f')],function(_0x391739){return{'model':db[_0x391739[_0x20eb('0x21')]],'as':_0x391739['as'],'attributes':_0x391739[_0x20eb('0x1d')],'include':_0x391739[_0x20eb('0x1f')]?_['map'](_0x391739[_0x20eb('0x1f')],function(_0x33a365){return{'model':db[_0x33a365[_0x20eb('0x21')]],'as':_0x33a365['as'],'attributes':_0x33a365['attributes'],'include':_0x33a365['include']?_['map'](_0x33a365['include'],function(_0x42455f){return{'model':db[_0x42455f[_0x20eb('0x21')]],'as':_0x42455f['as'],'attributes':_0x42455f['attributes']};}):[]};}):[]};}):[]:[]})[_0x20eb('0xf')](function(_0x50b08d){logger[_0x20eb('0x22')]('GetVoiceExtension',_0x3c16f2);logger['debug'](_0x20eb('0x19'),_0x3c16f2,JSON[_0x20eb('0x13')](_0x50b08d));_0x3763b8(_0x50b08d);})['catch'](function(_0x5abe40){logger[_0x20eb('0x14')](_0x20eb('0x19'),_0x5abe40['message'],_0x3c16f2);_0x3eb2be(_0x50c857[_0x20eb('0x14')](0x1f4,_0x5abe40[_0x20eb('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 20a13eb..2552bd7 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 _0x53ec=['length','voiceExtension:','./voiceExtension.events','save','remove','update','emit','removeListener'];(function(_0x215c4d,_0x1e5013){var _0x8f7cae=function(_0x1f7b0f){while(--_0x1f7b0f){_0x215c4d['push'](_0x215c4d['shift']());}};_0x8f7cae(++_0x1e5013);}(_0x53ec,0x192));var _0xc53e=function(_0x1800cb,_0xba50f9){_0x1800cb=_0x1800cb-0x0;var _0x3b5e95=_0x53ec[_0x1800cb];return _0x3b5e95;};'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 +var _0xabce=['voiceExtension:','./voiceExtension.events','save','remove','update','emit'];(function(_0x1bf872,_0x207772){var _0x3db5f7=function(_0x429897){while(--_0x429897){_0x1bf872['push'](_0x1bf872['shift']());}};_0x3db5f7(++_0x207772);}(_0xabce,0x103));var _0xeabc=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xabce[_0x47b58b];return _0x46bebe;};'use strict';var VoiceExtensionEvents=require(_0xeabc('0x0'));var events=[_0xeabc('0x1'),_0xeabc('0x2'),_0xeabc('0x3')];function createListener(_0x49dbcc,_0x5bd1a4){return function(_0x5ebc95){_0x5bd1a4[_0xeabc('0x4')](_0x49dbcc,_0x5ebc95);};}function removeListener(_0x1d9f37,_0x1a88a7){return function(){VoiceExtensionEvents['removeListener'](_0x1d9f37,_0x1a88a7);};}exports['register']=function(_0x1b07a8){for(var _0x52a4d7=0x0,_0x229ba4=events['length'];_0x52a4d7<_0x229ba4;_0x52a4d7++){var _0x3bdc29=events[_0x52a4d7];var _0x9417af=createListener(_0xeabc('0x5')+_0x3bdc29,_0x1b07a8);VoiceExtensionEvents['on'](_0x3bdc29,_0x9417af);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 3e703cb..5548215 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 _0xb091=['getMessages','post','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../config/environment','./voiceMail.controller','isAuthenticated','index','get','show','/:id/messages'];(function(_0x8d9399,_0x490955){var _0x5a0645=function(_0x404d19){while(--_0x404d19){_0x8d9399['push'](_0x8d9399['shift']());}};_0x5a0645(++_0x490955);}(_0xb091,0x16e));var _0x1b09=function(_0x4232b4,_0x388d61){_0x4232b4=_0x4232b4-0x0;var _0xbd36b6=_0xb091[_0x4232b4];return _0xbd36b6;};'use strict';var multer=require('multer');var util=require(_0x1b09('0x0'));var path=require(_0x1b09('0x1'));var timeout=require(_0x1b09('0x2'));var express=require(_0x1b09('0x3'));var router=express['Router']();var fs_extra=require(_0x1b09('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1b09('0x5'));var controller=require(_0x1b09('0x6'));router['get']('/',auth[_0x1b09('0x7')](),controller[_0x1b09('0x8')]);router[_0x1b09('0x9')]('/:id',auth[_0x1b09('0x7')](),controller[_0x1b09('0xa')]);router[_0x1b09('0x9')](_0x1b09('0xb'),auth[_0x1b09('0x7')](),controller[_0x1b09('0xc')]);router[_0x1b09('0xd')]('/',auth[_0x1b09('0x7')](),controller[_0x1b09('0xe')]);router[_0x1b09('0xf')](_0x1b09('0x10'),auth['isAuthenticated'](),controller[_0x1b09('0x11')]);router[_0x1b09('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x1b09('0x13')]);module[_0x1b09('0x14')]=router; \ No newline at end of file +var _0xf2e3=['/:id','show','/:id/messages','getMessages','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','isAuthenticated','index','get'];(function(_0x309076,_0x764a60){var _0x9b2aea=function(_0x2e7af5){while(--_0x2e7af5){_0x309076['push'](_0x309076['shift']());}};_0x9b2aea(++_0x764a60);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0xf2e3[_0x1589dd];return _0x1bddd1;};'use strict';var multer=require(_0x3f2e('0x0'));var util=require('util');var path=require(_0x3f2e('0x1'));var timeout=require(_0x3f2e('0x2'));var express=require(_0x3f2e('0x3'));var router=express[_0x3f2e('0x4')]();var fs_extra=require(_0x3f2e('0x5'));var auth=require(_0x3f2e('0x6'));var interaction=require(_0x3f2e('0x7'));var config=require(_0x3f2e('0x8'));var controller=require(_0x3f2e('0x9'));router['get']('/',auth[_0x3f2e('0xa')](),controller[_0x3f2e('0xb')]);router[_0x3f2e('0xc')](_0x3f2e('0xd'),auth[_0x3f2e('0xa')](),controller[_0x3f2e('0xe')]);router[_0x3f2e('0xc')](_0x3f2e('0xf'),auth[_0x3f2e('0xa')](),controller[_0x3f2e('0x10')]);router[_0x3f2e('0x11')]('/',auth[_0x3f2e('0xa')](),controller[_0x3f2e('0x12')]);router[_0x3f2e('0x13')](_0x3f2e('0xd'),auth[_0x3f2e('0xa')](),controller[_0x3f2e('0x14')]);router[_0x3f2e('0x15')](_0x3f2e('0xd'),auth['isAuthenticated'](),controller[_0x3f2e('0x16')]);module[_0x3f2e('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index e677adf..18b3165 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 _0x1033=['string','trim','central','yes','ENUM','TINYINT(4)','TIMESTAMP','INTEGER','getDataValue','\x20-\x20','sequelize','exports','STRING','contest_mailbox'];(function(_0x32c103,_0x2175e2){var _0x57408e=function(_0x2e7c63){while(--_0x2e7c63){_0x32c103['push'](_0x32c103['shift']());}};_0x57408e(++_0x2175e2);}(_0x1033,0x7a));var _0x3103=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x1033[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x3103('0x0'));module[_0x3103('0x1')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x3103('0x2')],'defaultValue':'from-voicemail','unique':_0x3103('0x3')},'mailbox':{'type':Sequelize[_0x3103('0x2')],'defaultValue':'','allowNull':![],'unique':_0x3103('0x3')},'password':{'type':Sequelize[_0x3103('0x2')]},'fullname':{'type':Sequelize[_0x3103('0x2')]},'email':{'type':Sequelize[_0x3103('0x2')],'validate':{'isEmail':!![]},'set':function(_0x52b56d){this['setDataValue']('email',typeof _0x52b56d===_0x3103('0x4')&&_0x52b56d[_0x3103('0x5')]()?_0x52b56d[_0x3103('0x5')]():null);}},'pager':{'type':Sequelize[_0x3103('0x2')]},'tz':{'type':Sequelize[_0x3103('0x2')],'defaultValue':_0x3103('0x6')},'attach':{'type':Sequelize['ENUM'](_0x3103('0x7'),'no'),'defaultValue':_0x3103('0x7'),'allowNull':![]},'saycid':{'type':Sequelize[_0x3103('0x8')]('yes','no'),'defaultValue':_0x3103('0x7'),'allowNull':![]},'dialout':{'type':Sequelize[_0x3103('0x2')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x3103('0x8')](_0x3103('0x7'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x3103('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x3103('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x3103('0x8')](_0x3103('0x7'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x3103('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x3103('0x8')](_0x3103('0x7'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x3103('0x8')](_0x3103('0x7'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x3103('0x8')](_0x3103('0x7'),'no'),'defaultValue':_0x3103('0x7'),'allowNull':![]},'forcename':{'type':Sequelize[_0x3103('0x8')](_0x3103('0x7'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x3103('0x8')]('yes','no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x3103('0xa')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0x3103('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x3103('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x3103('0xc')]('fullname')+_0x3103('0xd')+this[_0x3103('0xc')]('mailbox');}}}; \ No newline at end of file +var _0x42ef=['mailbox','sequelize','STRING','from-voicemail','email','trim','central','ENUM','yes','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','\x20-\x20'];(function(_0xdce7a2,_0x249e5c){var _0x7e43c3=function(_0x2ef34c){while(--_0x2ef34c){_0xdce7a2['push'](_0xdce7a2['shift']());}};_0x7e43c3(++_0x249e5c);}(_0x42ef,0x119));var _0xf42e=function(_0x33671a,_0x55aee8){_0x33671a=_0x33671a-0x0;var _0x46708e=_0x42ef[_0x33671a];return _0x46708e;};'use strict';var Sequelize=require(_0xf42e('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0xf42e('0x1')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0xf42e('0x2'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0xf42e('0x1')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0xf42e('0x1')]},'fullname':{'type':Sequelize[_0xf42e('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x2f55a3){this['setDataValue'](_0xf42e('0x3'),typeof _0x2f55a3==='string'&&_0x2f55a3[_0xf42e('0x4')]()?_0x2f55a3['trim']():null);}},'pager':{'type':Sequelize[_0xf42e('0x1')]},'tz':{'type':Sequelize[_0xf42e('0x1')],'defaultValue':_0xf42e('0x5')},'attach':{'type':Sequelize[_0xf42e('0x6')](_0xf42e('0x7'),'no'),'defaultValue':_0xf42e('0x7'),'allowNull':![]},'saycid':{'type':Sequelize[_0xf42e('0x6')]('yes','no'),'defaultValue':_0xf42e('0x7'),'allowNull':![]},'dialout':{'type':Sequelize[_0xf42e('0x1')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0xf42e('0x7'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xf42e('0x6')](_0xf42e('0x7'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xf42e('0x6')](_0xf42e('0x7'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xf42e('0x6')](_0xf42e('0x7'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xf42e('0x6')](_0xf42e('0x7'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xf42e('0x6')](_0xf42e('0x7'),'no'),'defaultValue':_0xf42e('0x7'),'allowNull':![]},'forcename':{'type':Sequelize[_0xf42e('0x6')](_0xf42e('0x7'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0xf42e('0x7'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xf42e('0x6')](_0xf42e('0x7'),'no'),'defaultValue':_0xf42e('0x7'),'allowNull':![]},'stamp':{'type':_0xf42e('0x8')},'emailsubject':{'type':Sequelize[_0xf42e('0x1')]},'emailbody':{'type':Sequelize[_0xf42e('0x1')]},'maxsecs':{'type':Sequelize[_0xf42e('0x9')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xf42e('0xa')],'get':function(){return this[_0xf42e('0xb')]('fullname')+_0xf42e('0xc')+this['getDataValue'](_0xf42e('0xd'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 9e73fae..4ca8062 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 _0x4fc2=['nolimit','mailbox','VoiceMailMessage','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','save','update','destroy','then','get','Voicemails','UserProfileResource','stack','name','send','map','VoiceMail','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','type','merge','options','includeAll','findAll','rows','show','params','keys','rawAttributes','include','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','create','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getMessages','findOne'];(function(_0x542491,_0xa7a807){var _0x60de6c=function(_0x4ca19e){while(--_0x4ca19e){_0x542491['push'](_0x542491['shift']());}};_0x60de6c(++_0xa7a807);}(_0x4fc2,0x111));var _0x24fc=function(_0x4f3039,_0x100a43){_0x4f3039=_0x4f3039-0x0;var _0x13218c=_0x4fc2[_0x4f3039];return _0x13218c;};'use strict';var emlformat=require(_0x24fc('0x0'));var rimraf=require(_0x24fc('0x1'));var zipdir=require(_0x24fc('0x2'));var jsonpatch=require(_0x24fc('0x3'));var rp=require('request-promise');var moment=require(_0x24fc('0x4'));var BPromise=require(_0x24fc('0x5'));var Mustache=require(_0x24fc('0x6'));var util=require('util');var path=require(_0x24fc('0x7'));var sox=require(_0x24fc('0x8'));var csv=require('to-csv');var ejs=require(_0x24fc('0x9'));var fs=require('fs');var fs_extra=require(_0x24fc('0xa'));var _=require('lodash');var squel=require(_0x24fc('0xb'));var crypto=require(_0x24fc('0xc'));var jsforce=require(_0x24fc('0xd'));var deskjs=require(_0x24fc('0xe'));var toCsv=require(_0x24fc('0xf'));var querystring=require(_0x24fc('0x10'));var Papa=require('papaparse');var Redis=require(_0x24fc('0x11'));var authService=require(_0x24fc('0x12'));var qs=require(_0x24fc('0x13'));var as=require(_0x24fc('0x14'));var hardwareService=require(_0x24fc('0x15'));var logger=require(_0x24fc('0x16'))(_0x24fc('0x17'));var utils=require(_0x24fc('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x24fc('0x19'));var db=require(_0x24fc('0x1a'))['db'];function respondWithStatusCode(_0x5cc65e,_0x306873){_0x306873=_0x306873||0xcc;return function(_0x76cb25){if(_0x76cb25){return _0x5cc65e[_0x24fc('0x1b')](_0x306873);}return _0x5cc65e[_0x24fc('0x1c')](_0x306873)[_0x24fc('0x1d')]();};}function respondWithResult(_0x326276,_0x537b5c){_0x537b5c=_0x537b5c||0xc8;return function(_0x2a0971){if(_0x2a0971){return _0x326276[_0x24fc('0x1c')](_0x537b5c)[_0x24fc('0x1e')](_0x2a0971);}};}function respondWithFilteredResult(_0x42cbe8,_0x4acd36){return function(_0x2ac989){if(_0x2ac989){var _0x588543=typeof _0x4acd36[_0x24fc('0x1f')]===_0x24fc('0x20')&&typeof _0x4acd36[_0x24fc('0x21')]===_0x24fc('0x20');var _0x25cb40=_0x2ac989['count'];var _0x23873c=_0x588543?0x0:_0x4acd36[_0x24fc('0x1f')];var _0x6cfa0a=_0x588543?_0x2ac989[_0x24fc('0x22')]:_0x4acd36['offset']+_0x4acd36[_0x24fc('0x21')];var _0x4073e0;if(_0x6cfa0a>=_0x25cb40){_0x6cfa0a=_0x25cb40;_0x4073e0=0xc8;}else{_0x4073e0=0xce;}_0x42cbe8[_0x24fc('0x1c')](_0x4073e0);return _0x42cbe8['set'](_0x24fc('0x23'),_0x23873c+'-'+_0x6cfa0a+'/'+_0x25cb40)[_0x24fc('0x1e')](_0x2ac989);}return null;};}function patchUpdates(_0xbf1d6b){return function(_0x2d0e3d){try{jsonpatch['apply'](_0x2d0e3d,_0xbf1d6b,!![]);}catch(_0x323beb){return BPromise['reject'](_0x323beb);}return _0x2d0e3d[_0x24fc('0x24')]();};}function saveUpdates(_0x591c8f,_0x3ed464){return function(_0x44c121){if(_0x44c121){return _0x44c121[_0x24fc('0x25')](_0x591c8f)['then'](function(_0x313a25){return _0x313a25;});}return null;};}function removeEntity(_0x552035,_0x35a9c7){return function(_0x2bb93a){if(_0x2bb93a){return _0x2bb93a[_0x24fc('0x26')]()[_0x24fc('0x27')](function(){var _0x3296fc=_0x2bb93a[_0x24fc('0x28')]({'plain':!![]});var _0x3f0875=_0x24fc('0x29');return db[_0x24fc('0x2a')][_0x24fc('0x26')]({'where':{'type':_0x3f0875,'resourceId':_0x3296fc['id']}})['then'](function(){return _0x2bb93a;});})[_0x24fc('0x27')](function(){_0x552035[_0x24fc('0x1c')](0xcc)[_0x24fc('0x1d')]();});}};}function handleEntityNotFound(_0x5bb4c8,_0xf2f77d){return function(_0x3d1ec8){if(!_0x3d1ec8){_0x5bb4c8[_0x24fc('0x1b')](0x194);}return _0x3d1ec8;};}function handleError(_0x290f84,_0x8f2528){_0x8f2528=_0x8f2528||0x1f4;return function(_0x443796){logger['error'](_0x443796[_0x24fc('0x2b')]);if(_0x443796[_0x24fc('0x2c')]){delete _0x443796[_0x24fc('0x2c')];}_0x290f84[_0x24fc('0x1c')](_0x8f2528)[_0x24fc('0x2d')](_0x443796);};}exports['index']=function(_0x55c27f,_0x4e6f73){var _0x3df6f4={},_0x574ba3={},_0x3f2464={'count':0x0,'rows':[]};var _0x3e6389=_[_0x24fc('0x2e')](db[_0x24fc('0x2f')]['rawAttributes'],function(_0x66eec0){return{'name':_0x66eec0[_0x24fc('0x30')],'type':_0x66eec0['type'][_0x24fc('0x31')]};});_0x574ba3[_0x24fc('0x32')]=_['map'](_0x3e6389,'name');_0x574ba3[_0x24fc('0x33')]=_['keys'](_0x55c27f[_0x24fc('0x33')]);_0x574ba3[_0x24fc('0x34')]=_['intersection'](_0x574ba3[_0x24fc('0x32')],_0x574ba3[_0x24fc('0x33')]);_0x3df6f4[_0x24fc('0x35')]=_[_0x24fc('0x36')](_0x574ba3[_0x24fc('0x32')],qs[_0x24fc('0x37')](_0x55c27f[_0x24fc('0x33')][_0x24fc('0x37')]));_0x3df6f4[_0x24fc('0x35')]=_0x3df6f4['attributes'][_0x24fc('0x38')]?_0x3df6f4[_0x24fc('0x35')]:_0x574ba3[_0x24fc('0x32')];if(!_0x55c27f[_0x24fc('0x33')][_0x24fc('0x39')]('nolimit')){_0x3df6f4['limit']=qs[_0x24fc('0x21')](_0x55c27f['query'][_0x24fc('0x21')]);_0x3df6f4[_0x24fc('0x1f')]=qs[_0x24fc('0x1f')](_0x55c27f[_0x24fc('0x33')]['offset']);}_0x3df6f4[_0x24fc('0x3a')]=qs['sort'](_0x55c27f[_0x24fc('0x33')][_0x24fc('0x3b')]);_0x3df6f4[_0x24fc('0x3c')]=qs[_0x24fc('0x34')](_[_0x24fc('0x3d')](_0x55c27f['query'],_0x574ba3[_0x24fc('0x34')]),_0x3e6389);if(_0x55c27f[_0x24fc('0x33')][_0x24fc('0x3e')]){_0x3df6f4[_0x24fc('0x3c')]=_['merge'](_0x3df6f4[_0x24fc('0x3c')],{'$or':_[_0x24fc('0x2e')](_0x3e6389,function(_0x56306e){if(_0x56306e[_0x24fc('0x3f')]!=='VIRTUAL'){var _0x320f7b={};_0x320f7b[_0x56306e[_0x24fc('0x2c')]]={'$like':'%'+_0x55c27f[_0x24fc('0x33')][_0x24fc('0x3e')]+'%'};return _0x320f7b;}})});}_0x3df6f4=_[_0x24fc('0x40')]({},_0x3df6f4,_0x55c27f[_0x24fc('0x41')]);var _0x77b959={'where':_0x3df6f4[_0x24fc('0x3c')]};return db['VoiceMail'][_0x24fc('0x22')](_0x77b959)[_0x24fc('0x27')](function(_0x32f72c){_0x3f2464['count']=_0x32f72c;if(_0x55c27f[_0x24fc('0x33')][_0x24fc('0x42')]){_0x3df6f4['include']=[{'all':!![]}];}return db[_0x24fc('0x2f')][_0x24fc('0x43')](_0x3df6f4);})[_0x24fc('0x27')](function(_0x5e4e9b){_0x3f2464[_0x24fc('0x44')]=_0x5e4e9b;return _0x3f2464;})[_0x24fc('0x27')](respondWithFilteredResult(_0x4e6f73,_0x3df6f4))['catch'](handleError(_0x4e6f73,null));};exports[_0x24fc('0x45')]=function(_0x169982,_0x158f7b){var _0x2a0ac4={'raw':!![],'where':{'id':_0x169982[_0x24fc('0x46')]['id']}},_0x4c8dad={};_0x4c8dad[_0x24fc('0x32')]=_[_0x24fc('0x47')](db[_0x24fc('0x2f')][_0x24fc('0x48')]);_0x4c8dad['query']=_[_0x24fc('0x47')](_0x169982[_0x24fc('0x33')]);_0x4c8dad[_0x24fc('0x34')]=_[_0x24fc('0x36')](_0x4c8dad['model'],_0x4c8dad[_0x24fc('0x33')]);_0x2a0ac4[_0x24fc('0x35')]=_['intersection'](_0x4c8dad['model'],qs[_0x24fc('0x37')](_0x169982['query']['fields']));_0x2a0ac4[_0x24fc('0x35')]=_0x2a0ac4['attributes'][_0x24fc('0x38')]?_0x2a0ac4[_0x24fc('0x35')]:_0x4c8dad[_0x24fc('0x32')];if(_0x169982['query'][_0x24fc('0x42')]){_0x2a0ac4[_0x24fc('0x49')]=[{'all':!![]}];}_0x2a0ac4=_[_0x24fc('0x40')]({},_0x2a0ac4,_0x169982[_0x24fc('0x41')]);return db[_0x24fc('0x2f')][_0x24fc('0x4a')](_0x2a0ac4)[_0x24fc('0x27')](handleEntityNotFound(_0x158f7b,null))[_0x24fc('0x27')](respondWithResult(_0x158f7b,null))['catch'](handleError(_0x158f7b,null));};exports['create']=function(_0x266378,_0x2f1a99){return db[_0x24fc('0x2f')]['create'](_0x266378['body'],{})[_0x24fc('0x27')](function(_0x213439){var _0x179a60=_0x266378[_0x24fc('0x4b')][_0x24fc('0x28')]({'plain':!![]});if(!_0x179a60)throw new Error(_0x24fc('0x4c'));if(_0x179a60[_0x24fc('0x4d')]===_0x24fc('0x4b')){var _0x1671b0=_0x213439[_0x24fc('0x28')]({'plain':!![]});var _0x434700=_0x24fc('0x29');return db['UserProfileSection'][_0x24fc('0x4a')]({'where':{'name':_0x434700,'userProfileId':_0x179a60[_0x24fc('0x4e')]},'raw':!![]})[_0x24fc('0x27')](function(_0xb0fc00){if(_0xb0fc00&&_0xb0fc00[_0x24fc('0x4f')]===0x0){return db['UserProfileResource'][_0x24fc('0x50')]({'name':_0x1671b0['name'],'resourceId':_0x1671b0['id'],'type':_0xb0fc00[_0x24fc('0x2c')],'sectionId':_0xb0fc00['id']},{})[_0x24fc('0x27')](function(){return _0x213439;});}else{return _0x213439;}})[_0x24fc('0x51')](function(_0x41ddfb){logger[_0x24fc('0x52')](_0x24fc('0x53'),_0x41ddfb);throw _0x41ddfb;});}return _0x213439;})['then'](respondWithResult(_0x2f1a99,0xc9))[_0x24fc('0x51')](handleError(_0x2f1a99,null));};exports[_0x24fc('0x25')]=function(_0xc49d9f,_0x31a2ef){if(_0xc49d9f[_0x24fc('0x54')]['id']){delete _0xc49d9f[_0x24fc('0x54')]['id'];}return db['VoiceMail'][_0x24fc('0x4a')]({'where':{'id':_0xc49d9f[_0x24fc('0x46')]['id']}})[_0x24fc('0x27')](handleEntityNotFound(_0x31a2ef,null))[_0x24fc('0x27')](saveUpdates(_0xc49d9f[_0x24fc('0x54')],null))[_0x24fc('0x27')](respondWithResult(_0x31a2ef,null))[_0x24fc('0x51')](handleError(_0x31a2ef,null));};exports['destroy']=function(_0xd673f8,_0x11690f){return db['VoiceMail'][_0x24fc('0x4a')]({'where':{'id':_0xd673f8[_0x24fc('0x46')]['id']}})[_0x24fc('0x27')](handleEntityNotFound(_0x11690f,null))[_0x24fc('0x27')](removeEntity(_0x11690f,null))[_0x24fc('0x51')](handleError(_0x11690f,null));};exports[_0x24fc('0x55')]=function(_0x50302e,_0x28a44c,_0x4a0524){return db[_0x24fc('0x2f')][_0x24fc('0x56')]({'where':{'id':_0x50302e['params']['id']}})[_0x24fc('0x27')](handleEntityNotFound(_0x28a44c,null))['then'](function(_0x1c1f74){var _0x595c47;var _0xdff811={},_0x27b612={};_0x27b612['model']=_[_0x24fc('0x47')](db['VoiceMailMessage'][_0x24fc('0x48')]);_0x27b612[_0x24fc('0x33')]=_['keys'](_0x50302e[_0x24fc('0x33')]);_0x27b612[_0x24fc('0x34')]=_[_0x24fc('0x36')](_0x27b612[_0x24fc('0x32')],_0x27b612[_0x24fc('0x33')]);_0xdff811['attributes']=_[_0x24fc('0x36')](_0x27b612[_0x24fc('0x32')],qs[_0x24fc('0x37')](_0x50302e[_0x24fc('0x33')][_0x24fc('0x37')]));_0xdff811['attributes']=_0xdff811['attributes'][_0x24fc('0x38')]?_0xdff811[_0x24fc('0x35')]:_0x27b612['model'];if(!_0x50302e['query'][_0x24fc('0x39')](_0x24fc('0x57'))){_0xdff811[_0x24fc('0x21')]=qs[_0x24fc('0x21')](_0x50302e['query'][_0x24fc('0x21')]);_0xdff811[_0x24fc('0x1f')]=qs[_0x24fc('0x1f')](_0x50302e[_0x24fc('0x33')][_0x24fc('0x1f')]);}_0xdff811[_0x24fc('0x3a')]=qs[_0x24fc('0x3b')](_0x50302e[_0x24fc('0x33')][_0x24fc('0x3b')]);_0xdff811[_0x24fc('0x3c')]=qs[_0x24fc('0x34')](_[_0x24fc('0x3d')](_0x50302e[_0x24fc('0x33')],_0x27b612[_0x24fc('0x34')]));if(_0x50302e[_0x24fc('0x33')]['filter']){_0xdff811[_0x24fc('0x3c')]=_[_0x24fc('0x40')](_0xdff811[_0x24fc('0x3c')],{'$or':_[_0x24fc('0x2e')](_0xdff811[_0x24fc('0x35')],function(_0x2eb6dc){var _0x10d148={};_0x10d148[_0x2eb6dc]={'$like':'%'+_0x50302e[_0x24fc('0x33')]['filter']+'%'};return _0x10d148;})});}_0xdff811[_0x24fc('0x3c')]=_[_0x24fc('0x40')](_0xdff811[_0x24fc('0x3c')],{'mailboxuser':_0x1c1f74[_0x24fc('0x58')]});_0xdff811=_['merge']({},_0xdff811,_0x50302e[_0x24fc('0x41')]);return db[_0x24fc('0x59')]['findAndCountAll'](_0xdff811)['then'](respondWithFilteredResult(_0x28a44c,_0xdff811));})['catch'](handleError(_0x28a44c,null));}; \ No newline at end of file +var _0xc788=['role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getMessages','findOne','VoiceMailMessage','mailbox','findAndCountAll','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','Voicemails','error','stack','name','index','map','VoiceMail','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x170a9b,_0x31dc11){var _0x1ca94c=function(_0x5a6130){while(--_0x5a6130){_0x170a9b['push'](_0x170a9b['shift']());}};_0x1ca94c(++_0x31dc11);}(_0xc788,0xc4));var _0x8c78=function(_0x69c0c2,_0x2af0bf){_0x69c0c2=_0x69c0c2-0x0;var _0x3422f6=_0xc788[_0x69c0c2];return _0x3422f6;};'use strict';var emlformat=require(_0x8c78('0x0'));var rimraf=require(_0x8c78('0x1'));var zipdir=require(_0x8c78('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8c78('0x3'));var BPromise=require(_0x8c78('0x4'));var Mustache=require(_0x8c78('0x5'));var util=require(_0x8c78('0x6'));var path=require(_0x8c78('0x7'));var sox=require('sox');var csv=require(_0x8c78('0x8'));var ejs=require(_0x8c78('0x9'));var fs=require('fs');var fs_extra=require(_0x8c78('0xa'));var _=require(_0x8c78('0xb'));var squel=require(_0x8c78('0xc'));var crypto=require('crypto');var jsforce=require(_0x8c78('0xd'));var deskjs=require(_0x8c78('0xe'));var toCsv=require(_0x8c78('0x8'));var querystring=require(_0x8c78('0xf'));var Papa=require(_0x8c78('0x10'));var Redis=require(_0x8c78('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8c78('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8c78('0x13'));var logger=require(_0x8c78('0x14'))('api');var utils=require(_0x8c78('0x15'));var config=require(_0x8c78('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8c78('0x17'))['db'];function respondWithStatusCode(_0x4b2eca,_0x56a802){_0x56a802=_0x56a802||0xcc;return function(_0x349dfa){if(_0x349dfa){return _0x4b2eca[_0x8c78('0x18')](_0x56a802);}return _0x4b2eca[_0x8c78('0x19')](_0x56a802)[_0x8c78('0x1a')]();};}function respondWithResult(_0x2eedff,_0x3d1306){_0x3d1306=_0x3d1306||0xc8;return function(_0xe5f8ae){if(_0xe5f8ae){return _0x2eedff[_0x8c78('0x19')](_0x3d1306)[_0x8c78('0x1b')](_0xe5f8ae);}};}function respondWithFilteredResult(_0x1157d0,_0x4ff4b0){return function(_0x1fa78e){if(_0x1fa78e){var _0x293cfe=typeof _0x4ff4b0['offset']===_0x8c78('0x1c')&&typeof _0x4ff4b0[_0x8c78('0x1d')]===_0x8c78('0x1c');var _0x23824e=_0x1fa78e[_0x8c78('0x1e')];var _0x461eff=_0x293cfe?0x0:_0x4ff4b0['offset'];var _0x4f7bf9=_0x293cfe?_0x1fa78e[_0x8c78('0x1e')]:_0x4ff4b0['offset']+_0x4ff4b0['limit'];var _0xece4f0;if(_0x4f7bf9>=_0x23824e){_0x4f7bf9=_0x23824e;_0xece4f0=0xc8;}else{_0xece4f0=0xce;}_0x1157d0['status'](_0xece4f0);return _0x1157d0[_0x8c78('0x1f')](_0x8c78('0x20'),_0x461eff+'-'+_0x4f7bf9+'/'+_0x23824e)['json'](_0x1fa78e);}return null;};}function patchUpdates(_0x6c9a12){return function(_0x5b111b){try{jsonpatch[_0x8c78('0x21')](_0x5b111b,_0x6c9a12,!![]);}catch(_0x3af73c){return BPromise['reject'](_0x3af73c);}return _0x5b111b[_0x8c78('0x22')]();};}function saveUpdates(_0x188cc3,_0x499603){return function(_0x2bc595){if(_0x2bc595){return _0x2bc595[_0x8c78('0x23')](_0x188cc3)[_0x8c78('0x24')](function(_0x9581c6){return _0x9581c6;});}return null;};}function removeEntity(_0x215940,_0x20f483){return function(_0xbfdf6f){if(_0xbfdf6f){return _0xbfdf6f[_0x8c78('0x25')]()[_0x8c78('0x24')](function(){var _0x4a7d20=_0xbfdf6f[_0x8c78('0x26')]({'plain':!![]});var _0x458763=_0x8c78('0x27');return db['UserProfileResource'][_0x8c78('0x25')]({'where':{'type':_0x458763,'resourceId':_0x4a7d20['id']}})['then'](function(){return _0xbfdf6f;});})[_0x8c78('0x24')](function(){_0x215940[_0x8c78('0x19')](0xcc)[_0x8c78('0x1a')]();});}};}function handleEntityNotFound(_0x496c51,_0x583a74){return function(_0x2568d5){if(!_0x2568d5){_0x496c51['sendStatus'](0x194);}return _0x2568d5;};}function handleError(_0x20b128,_0x4376da){_0x4376da=_0x4376da||0x1f4;return function(_0x394c1d){logger[_0x8c78('0x28')](_0x394c1d[_0x8c78('0x29')]);if(_0x394c1d[_0x8c78('0x2a')]){delete _0x394c1d['name'];}_0x20b128[_0x8c78('0x19')](_0x4376da)['send'](_0x394c1d);};}exports[_0x8c78('0x2b')]=function(_0x17f4c8,_0xb69c52){var _0x4e764f={},_0x1f1a0c={},_0x3816d2={'count':0x0,'rows':[]};var _0x4f0005=_[_0x8c78('0x2c')](db[_0x8c78('0x2d')][_0x8c78('0x2e')],function(_0x487a4c){return{'name':_0x487a4c[_0x8c78('0x2f')],'type':_0x487a4c[_0x8c78('0x30')][_0x8c78('0x31')]};});_0x1f1a0c['model']=_[_0x8c78('0x2c')](_0x4f0005,_0x8c78('0x2a'));_0x1f1a0c['query']=_[_0x8c78('0x32')](_0x17f4c8[_0x8c78('0x33')]);_0x1f1a0c[_0x8c78('0x34')]=_[_0x8c78('0x35')](_0x1f1a0c[_0x8c78('0x36')],_0x1f1a0c[_0x8c78('0x33')]);_0x4e764f[_0x8c78('0x37')]=_[_0x8c78('0x35')](_0x1f1a0c[_0x8c78('0x36')],qs[_0x8c78('0x38')](_0x17f4c8['query'][_0x8c78('0x38')]));_0x4e764f[_0x8c78('0x37')]=_0x4e764f[_0x8c78('0x37')][_0x8c78('0x39')]?_0x4e764f[_0x8c78('0x37')]:_0x1f1a0c['model'];if(!_0x17f4c8[_0x8c78('0x33')][_0x8c78('0x3a')](_0x8c78('0x3b'))){_0x4e764f['limit']=qs[_0x8c78('0x1d')](_0x17f4c8[_0x8c78('0x33')]['limit']);_0x4e764f[_0x8c78('0x3c')]=qs['offset'](_0x17f4c8[_0x8c78('0x33')][_0x8c78('0x3c')]);}_0x4e764f[_0x8c78('0x3d')]=qs[_0x8c78('0x3e')](_0x17f4c8['query'][_0x8c78('0x3e')]);_0x4e764f['where']=qs[_0x8c78('0x34')](_[_0x8c78('0x3f')](_0x17f4c8[_0x8c78('0x33')],_0x1f1a0c['filters']),_0x4f0005);if(_0x17f4c8['query'][_0x8c78('0x40')]){_0x4e764f[_0x8c78('0x41')]=_[_0x8c78('0x42')](_0x4e764f[_0x8c78('0x41')],{'$or':_[_0x8c78('0x2c')](_0x4f0005,function(_0x484931){if(_0x484931[_0x8c78('0x30')]!==_0x8c78('0x43')){var _0x1f0a2b={};_0x1f0a2b[_0x484931[_0x8c78('0x2a')]]={'$like':'%'+_0x17f4c8[_0x8c78('0x33')][_0x8c78('0x40')]+'%'};return _0x1f0a2b;}})});}_0x4e764f=_[_0x8c78('0x42')]({},_0x4e764f,_0x17f4c8['options']);var _0x3995f4={'where':_0x4e764f[_0x8c78('0x41')]};return db['VoiceMail']['count'](_0x3995f4)[_0x8c78('0x24')](function(_0x1612d5){_0x3816d2['count']=_0x1612d5;if(_0x17f4c8[_0x8c78('0x33')][_0x8c78('0x44')]){_0x4e764f['include']=[{'all':!![]}];}return db[_0x8c78('0x2d')][_0x8c78('0x45')](_0x4e764f);})['then'](function(_0x10d521){_0x3816d2[_0x8c78('0x46')]=_0x10d521;return _0x3816d2;})[_0x8c78('0x24')](respondWithFilteredResult(_0xb69c52,_0x4e764f))[_0x8c78('0x47')](handleError(_0xb69c52,null));};exports[_0x8c78('0x48')]=function(_0x4e4880,_0x545d90){var _0x2841c2={'raw':!![],'where':{'id':_0x4e4880[_0x8c78('0x49')]['id']}},_0x2f6a6b={};_0x2f6a6b[_0x8c78('0x36')]=_[_0x8c78('0x32')](db[_0x8c78('0x2d')][_0x8c78('0x2e')]);_0x2f6a6b[_0x8c78('0x33')]=_[_0x8c78('0x32')](_0x4e4880[_0x8c78('0x33')]);_0x2f6a6b[_0x8c78('0x34')]=_['intersection'](_0x2f6a6b[_0x8c78('0x36')],_0x2f6a6b[_0x8c78('0x33')]);_0x2841c2[_0x8c78('0x37')]=_[_0x8c78('0x35')](_0x2f6a6b[_0x8c78('0x36')],qs['fields'](_0x4e4880[_0x8c78('0x33')][_0x8c78('0x38')]));_0x2841c2[_0x8c78('0x37')]=_0x2841c2[_0x8c78('0x37')][_0x8c78('0x39')]?_0x2841c2['attributes']:_0x2f6a6b[_0x8c78('0x36')];if(_0x4e4880['query']['includeAll']){_0x2841c2[_0x8c78('0x4a')]=[{'all':!![]}];}_0x2841c2=_[_0x8c78('0x42')]({},_0x2841c2,_0x4e4880[_0x8c78('0x4b')]);return db['VoiceMail'][_0x8c78('0x4c')](_0x2841c2)[_0x8c78('0x24')](handleEntityNotFound(_0x545d90,null))[_0x8c78('0x24')](respondWithResult(_0x545d90,null))[_0x8c78('0x47')](handleError(_0x545d90,null));};exports[_0x8c78('0x4d')]=function(_0x38083e,_0x26103c){return db[_0x8c78('0x2d')][_0x8c78('0x4d')](_0x38083e['body'],{})[_0x8c78('0x24')](function(_0x1fcf97){var _0xba0de6=_0x38083e[_0x8c78('0x4e')]['get']({'plain':!![]});if(!_0xba0de6)throw new Error(_0x8c78('0x4f'));if(_0xba0de6[_0x8c78('0x50')]===_0x8c78('0x4e')){var _0x431125=_0x1fcf97['get']({'plain':!![]});var _0x336b95=_0x8c78('0x27');return db[_0x8c78('0x51')]['find']({'where':{'name':_0x336b95,'userProfileId':_0xba0de6[_0x8c78('0x52')]},'raw':!![]})['then'](function(_0xae80d){if(_0xae80d&&_0xae80d[_0x8c78('0x53')]===0x0){return db[_0x8c78('0x54')][_0x8c78('0x4d')]({'name':_0x431125[_0x8c78('0x2a')],'resourceId':_0x431125['id'],'type':_0xae80d[_0x8c78('0x2a')],'sectionId':_0xae80d['id']},{})[_0x8c78('0x24')](function(){return _0x1fcf97;});}else{return _0x1fcf97;}})[_0x8c78('0x47')](function(_0x19d807){logger[_0x8c78('0x28')](_0x8c78('0x55'),_0x19d807);throw _0x19d807;});}return _0x1fcf97;})[_0x8c78('0x24')](respondWithResult(_0x26103c,0xc9))[_0x8c78('0x47')](handleError(_0x26103c,null));};exports[_0x8c78('0x23')]=function(_0x54b40d,_0x22fe6c){if(_0x54b40d[_0x8c78('0x56')]['id']){delete _0x54b40d[_0x8c78('0x56')]['id'];}return db[_0x8c78('0x2d')]['find']({'where':{'id':_0x54b40d[_0x8c78('0x49')]['id']}})[_0x8c78('0x24')](handleEntityNotFound(_0x22fe6c,null))[_0x8c78('0x24')](saveUpdates(_0x54b40d[_0x8c78('0x56')],null))[_0x8c78('0x24')](respondWithResult(_0x22fe6c,null))[_0x8c78('0x47')](handleError(_0x22fe6c,null));};exports['destroy']=function(_0x1e616c,_0x42a34e){return db['VoiceMail'][_0x8c78('0x4c')]({'where':{'id':_0x1e616c['params']['id']}})[_0x8c78('0x24')](handleEntityNotFound(_0x42a34e,null))[_0x8c78('0x24')](removeEntity(_0x42a34e,null))[_0x8c78('0x47')](handleError(_0x42a34e,null));};exports[_0x8c78('0x57')]=function(_0x3ff236,_0x35cf85,_0x416a05){return db['VoiceMail'][_0x8c78('0x58')]({'where':{'id':_0x3ff236[_0x8c78('0x49')]['id']}})['then'](handleEntityNotFound(_0x35cf85,null))[_0x8c78('0x24')](function(_0x3529aa){var _0x577361;var _0x425994={},_0x2307d1={};_0x2307d1[_0x8c78('0x36')]=_[_0x8c78('0x32')](db[_0x8c78('0x59')][_0x8c78('0x2e')]);_0x2307d1[_0x8c78('0x33')]=_[_0x8c78('0x32')](_0x3ff236[_0x8c78('0x33')]);_0x2307d1[_0x8c78('0x34')]=_[_0x8c78('0x35')](_0x2307d1[_0x8c78('0x36')],_0x2307d1[_0x8c78('0x33')]);_0x425994[_0x8c78('0x37')]=_['intersection'](_0x2307d1[_0x8c78('0x36')],qs['fields'](_0x3ff236[_0x8c78('0x33')]['fields']));_0x425994['attributes']=_0x425994['attributes'][_0x8c78('0x39')]?_0x425994['attributes']:_0x2307d1['model'];if(!_0x3ff236['query'][_0x8c78('0x3a')](_0x8c78('0x3b'))){_0x425994[_0x8c78('0x1d')]=qs[_0x8c78('0x1d')](_0x3ff236['query'][_0x8c78('0x1d')]);_0x425994[_0x8c78('0x3c')]=qs[_0x8c78('0x3c')](_0x3ff236[_0x8c78('0x33')][_0x8c78('0x3c')]);}_0x425994[_0x8c78('0x3d')]=qs[_0x8c78('0x3e')](_0x3ff236[_0x8c78('0x33')][_0x8c78('0x3e')]);_0x425994[_0x8c78('0x41')]=qs[_0x8c78('0x34')](_[_0x8c78('0x3f')](_0x3ff236[_0x8c78('0x33')],_0x2307d1[_0x8c78('0x34')]));if(_0x3ff236['query'][_0x8c78('0x40')]){_0x425994['where']=_[_0x8c78('0x42')](_0x425994[_0x8c78('0x41')],{'$or':_[_0x8c78('0x2c')](_0x425994['attributes'],function(_0x97df9c){var _0x3e2961={};_0x3e2961[_0x97df9c]={'$like':'%'+_0x3ff236[_0x8c78('0x33')]['filter']+'%'};return _0x3e2961;})});}_0x425994[_0x8c78('0x41')]=_[_0x8c78('0x42')](_0x425994['where'],{'mailboxuser':_0x3529aa[_0x8c78('0x5a')]});_0x425994=_[_0x8c78('0x42')]({},_0x425994,_0x3ff236[_0x8c78('0x4b')]);return db['VoiceMailMessage'][_0x8c78('0x5b')](_0x425994)[_0x8c78('0x24')](respondWithFilteredResult(_0x35cf85,_0x425994));})[_0x8c78('0x47')](handleError(_0x35cf85,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 157ca7c..ae1d045 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 _0x45eb=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','VoiceMail','voice_voicemail','mailbox','context'];(function(_0xb856c3,_0xb89ebe){var _0x428853=function(_0x3c003d){while(--_0x3c003d){_0xb856c3['push'](_0xb856c3['shift']());}};_0x428853(++_0xb89ebe);}(_0x45eb,0x126));var _0xb45e=function(_0x4633d7,_0xe485f5){_0x4633d7=_0x4633d7-0x0;var _0x1ea238=_0x45eb[_0x4633d7];return _0x1ea238;};'use strict';var _=require(_0xb45e('0x0'));var util=require(_0xb45e('0x1'));var logger=require(_0xb45e('0x2'))('api');var moment=require(_0xb45e('0x3'));var BPromise=require(_0xb45e('0x4'));var rp=require(_0xb45e('0x5'));var fs=require('fs');var path=require(_0xb45e('0x6'));var rimraf=require(_0xb45e('0x7'));var config=require(_0xb45e('0x8'));var attributes=require('./voiceMail.attributes');module[_0xb45e('0x9')]=function(_0x1b4c26,_0x3a5a5a){return _0x1b4c26['define'](_0xb45e('0xa'),attributes,{'tableName':_0xb45e('0xb'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0xb45e('0xc'),_0xb45e('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x62bd=['voice_voicemail','mailbox_context','context','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','VoiceMail'];(function(_0x147d25,_0x716e38){var _0x48fa9d=function(_0x4d2f21){while(--_0x4d2f21){_0x147d25['push'](_0x147d25['shift']());}};_0x48fa9d(++_0x716e38);}(_0x62bd,0x9d));var _0xd62b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x62bd[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xd62b('0x0'));var util=require('util');var logger=require(_0xd62b('0x1'))(_0xd62b('0x2'));var moment=require(_0xd62b('0x3'));var BPromise=require(_0xd62b('0x4'));var rp=require(_0xd62b('0x5'));var fs=require('fs');var path=require(_0xd62b('0x6'));var rimraf=require(_0xd62b('0x7'));var config=require(_0xd62b('0x8'));var attributes=require(_0xd62b('0x9'));module['exports']=function(_0x161c0a,_0x557bbd){return _0x161c0a['define'](_0xd62b('0xa'),attributes,{'tableName':_0xd62b('0xb'),'paranoid':![],'indexes':[{'name':_0xd62b('0xc'),'fields':['mailbox',_0xd62b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 9ac03a4..d922573 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 _0xb755=['client','http','request','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x22dac7,_0x45d32a){var _0x3e6cfa=function(_0x4c2e9d){while(--_0x4c2e9d){_0x22dac7['push'](_0x22dac7['shift']());}};_0x3e6cfa(++_0x45d32a);}(_0xb755,0x138));var _0x5b75=function(_0x1ca720,_0x690f25){_0x1ca720=_0x1ca720-0x0;var _0xf97a73=_0xb755[_0x1ca720];return _0xf97a73;};'use strict';var _=require('lodash');var util=require(_0x5b75('0x0'));var moment=require('moment');var BPromise=require(_0x5b75('0x1'));var rs=require(_0x5b75('0x2'));var fs=require('fs');var Redis=require(_0x5b75('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5b75('0x4'))(_0x5b75('0x5'));var config=require(_0x5b75('0x6'));var jayson=require(_0x5b75('0x7'));var client=jayson[_0x5b75('0x8')][_0x5b75('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3f95b0,_0x5a4e1d,_0x4e9dbe){return new BPromise(function(_0x17408c,_0x13c9ce){return client[_0x5b75('0xa')](_0x3f95b0,_0x4e9dbe)['then'](function(_0x30b369){logger['info'](_0x5b75('0xb'),_0x5a4e1d,_0x5b75('0xc'));logger[_0x5b75('0xd')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x5a4e1d,'request\x20sent',JSON[_0x5b75('0xe')](_0x30b369));if(_0x30b369[_0x5b75('0xf')]){if(_0x30b369[_0x5b75('0xf')][_0x5b75('0x10')]===0x1f4){logger[_0x5b75('0xf')](_0x5b75('0xb'),_0x5a4e1d,_0x30b369[_0x5b75('0xf')][_0x5b75('0x11')]);return _0x13c9ce(_0x30b369[_0x5b75('0xf')][_0x5b75('0x11')]);}logger[_0x5b75('0xf')]('VoiceMail,\x20%s,\x20%s',_0x5a4e1d,_0x30b369[_0x5b75('0xf')][_0x5b75('0x11')]);return _0x17408c(_0x30b369[_0x5b75('0xf')][_0x5b75('0x11')]);}else{logger[_0x5b75('0x12')]('VoiceMail,\x20%s,\x20%s',_0x5a4e1d,_0x5b75('0xc'));_0x17408c(_0x30b369[_0x5b75('0x13')][_0x5b75('0x11')]);}})['catch'](function(_0x3e54f1){logger['error'](_0x5b75('0xb'),_0x5a4e1d,_0x3e54f1);_0x13c9ce(_0x3e54f1);});});} \ No newline at end of file +var _0x3176=['VoiceMail,\x20%s,\x20%s','message','info','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','error','code'];(function(_0xf41ec4,_0xe488c1){var _0x5d6815=function(_0x30d90f){while(--_0x30d90f){_0xf41ec4['push'](_0xf41ec4['shift']());}};_0x5d6815(++_0xe488c1);}(_0x3176,0x1e8));var _0x6317=function(_0x2e9de5,_0x22c2cb){_0x2e9de5=_0x2e9de5-0x0;var _0x254b34=_0x3176[_0x2e9de5];return _0x254b34;};'use strict';var _=require(_0x6317('0x0'));var util=require('util');var moment=require(_0x6317('0x1'));var BPromise=require(_0x6317('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6317('0x3'));var db=require(_0x6317('0x4'))['db'];var utils=require(_0x6317('0x5'));var logger=require(_0x6317('0x6'))(_0x6317('0x7'));var config=require(_0x6317('0x8'));var jayson=require(_0x6317('0x9'));var client=jayson[_0x6317('0xa')][_0x6317('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x283e5f,_0xedcce1,_0x5347fd){return new BPromise(function(_0x29bf12,_0xd7c8a3){return client[_0x6317('0xc')](_0x283e5f,_0x5347fd)[_0x6317('0xd')](function(_0x5f1991){logger['info']('VoiceMail,\x20%s,\x20%s',_0xedcce1,_0x6317('0xe'));logger[_0x6317('0xf')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0xedcce1,_0x6317('0xe'),JSON['stringify'](_0x5f1991));if(_0x5f1991[_0x6317('0x10')]){if(_0x5f1991[_0x6317('0x10')][_0x6317('0x11')]===0x1f4){logger['error'](_0x6317('0x12'),_0xedcce1,_0x5f1991[_0x6317('0x10')][_0x6317('0x13')]);return _0xd7c8a3(_0x5f1991[_0x6317('0x10')][_0x6317('0x13')]);}logger[_0x6317('0x10')](_0x6317('0x12'),_0xedcce1,_0x5f1991[_0x6317('0x10')]['message']);return _0x29bf12(_0x5f1991[_0x6317('0x10')][_0x6317('0x13')]);}else{logger[_0x6317('0x14')](_0x6317('0x12'),_0xedcce1,_0x6317('0xe'));_0x29bf12(_0x5f1991['result'][_0x6317('0x13')]);}})[_0x6317('0x15')](function(_0x19d01e){logger[_0x6317('0x10')](_0x6317('0x12'),_0xedcce1,_0x19d01e);_0xd7c8a3(_0x19d01e);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 554884a..62072a0 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 _0xa193=['./voiceMailMessage.controller','isAuthenticated','index','get','/:id/download','download','post','/:id','update','destroy','exports','multer','util','connect-timeout','Router','fs-extra'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa193,0x8b));var _0x3a19=function(_0x45bad5,_0x1d7baf){_0x45bad5=_0x45bad5-0x0;var _0x473397=_0xa193[_0x45bad5];return _0x473397;};'use strict';var multer=require(_0x3a19('0x0'));var util=require(_0x3a19('0x1'));var path=require('path');var timeout=require(_0x3a19('0x2'));var express=require('express');var router=express[_0x3a19('0x3')]();var fs_extra=require(_0x3a19('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3a19('0x5'));router['get']('/',auth[_0x3a19('0x6')](),controller[_0x3a19('0x7')]);router['get']('/:id',auth[_0x3a19('0x6')](),controller['show']);router[_0x3a19('0x8')](_0x3a19('0x9'),auth['isAuthenticated'](),controller[_0x3a19('0xa')]);router[_0x3a19('0xb')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x3a19('0xc'),auth[_0x3a19('0x6')](),controller[_0x3a19('0xd')]);router['delete'](_0x3a19('0xc'),auth[_0x3a19('0x6')](),controller[_0x3a19('0xe')]);module[_0x3a19('0xf')]=router; \ No newline at end of file +var _0x045c=['path','connect-timeout','express','fs-extra','../../components/auth/service','get','index','/:id','isAuthenticated','show','/:id/download','create','put','update','delete','destroy','exports','multer'];(function(_0x35a274,_0x98b399){var _0x40d905=function(_0x5c8455){while(--_0x5c8455){_0x35a274['push'](_0x35a274['shift']());}};_0x40d905(++_0x98b399);}(_0x045c,0x155));var _0xc045=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0x045c[_0x487b0c];return _0x1adbdc;};'use strict';var multer=require(_0xc045('0x0'));var util=require('util');var path=require(_0xc045('0x1'));var timeout=require(_0xc045('0x2'));var express=require(_0xc045('0x3'));var router=express['Router']();var fs_extra=require(_0xc045('0x4'));var auth=require(_0xc045('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceMailMessage.controller');router[_0xc045('0x6')]('/',auth['isAuthenticated'](),controller[_0xc045('0x7')]);router[_0xc045('0x6')](_0xc045('0x8'),auth[_0xc045('0x9')](),controller[_0xc045('0xa')]);router['get'](_0xc045('0xb'),auth[_0xc045('0x9')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0xc045('0xc')]);router[_0xc045('0xd')](_0xc045('0x8'),auth[_0xc045('0x9')](),controller[_0xc045('0xe')]);router[_0xc045('0xf')]('/:id',auth[_0xc045('0x9')](),controller[_0xc045('0x10')]);module[_0xc045('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 3508351..ac1c16d 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 _0x7a62=['VIRTUAL','INTEGER','STRING','BLOB','long','TIMESTAMP'];(function(_0x5c4a36,_0x321e8a){var _0x574b74=function(_0x54fb18){while(--_0x54fb18){_0x5c4a36['push'](_0x5c4a36['shift']());}};_0x574b74(++_0x321e8a);}(_0x7a62,0x168));var _0x27a6=function(_0x59153a,_0x5f4ce7){_0x59153a=_0x59153a-0x0;var _0x1bfaf4=_0x7a62[_0x59153a];return _0x1bfaf4;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x27a6('0x0')],'get':function(_0x338e79){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0x27a6('0x1')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x27a6('0x2')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x27a6('0x2')],'defaultValue':''},'callerid':{'type':Sequelize[_0x27a6('0x2')],'defaultValue':''},'origtime':{'type':Sequelize[_0x27a6('0x2')],'defaultValue':''},'duration':{'type':Sequelize[_0x27a6('0x2')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x27a6('0x2')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0x27a6('0x3')](_0x27a6('0x4')),'defaultValue':null},'flag':{'type':Sequelize[_0x27a6('0x2')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x27a6('0x5'),'defaultValue':Sequelize['literal']('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0x1b95=['BLOB','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','exports','VIRTUAL','INTEGER','STRING'];(function(_0x3a631c,_0x7d1a20){var _0x1efa91=function(_0x538773){while(--_0x538773){_0x3a631c['push'](_0x3a631c['shift']());}};_0x1efa91(++_0x7d1a20);}(_0x1b95,0x15c));var _0x51b9=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0x1b95[_0x4e1d03];return _0x362d4b;};'use strict';var Sequelize=require('sequelize');module[_0x51b9('0x0')]={'name':{'type':Sequelize[_0x51b9('0x1')],'get':function(_0xd5c1fd){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0x51b9('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x51b9('0x3')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x51b9('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0x51b9('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0x51b9('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0x51b9('0x4')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0x51b9('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x51b9('0x3')],'defaultValue':''},'stamp':{'type':_0x51b9('0x5'),'defaultValue':Sequelize[_0x51b9('0x6')](_0x51b9('0x7'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index dc20ade..e2f70cf 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 _0x3a35=['rawAttributes','fieldName','type','key','query','keys','model','intersection','fields','attributes','length','nolimit','order','sort','where','filters','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','update','destroy','download','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','attachment','msg_id','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','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','status','json','offset','undefined','limit','count','set','apply','save','then','end','error','stack','name','send','index','map','VoiceMailMessage'];(function(_0x4f2b4a,_0x4d624a){var _0x24ab95=function(_0x2d6ed2){while(--_0x2d6ed2){_0x4f2b4a['push'](_0x4f2b4a['shift']());}};_0x24ab95(++_0x4d624a);}(_0x3a35,0x17d));var _0x53a3=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0x3a35[_0x20c9b2];return _0x2c6030;};'use strict';var emlformat=require(_0x53a3('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x53a3('0x1'));var rp=require(_0x53a3('0x2'));var moment=require(_0x53a3('0x3'));var BPromise=require(_0x53a3('0x4'));var Mustache=require(_0x53a3('0x5'));var util=require(_0x53a3('0x6'));var path=require(_0x53a3('0x7'));var sox=require(_0x53a3('0x8'));var csv=require(_0x53a3('0x9'));var ejs=require(_0x53a3('0xa'));var fs=require('fs');var fs_extra=require(_0x53a3('0xb'));var _=require(_0x53a3('0xc'));var squel=require('squel');var crypto=require(_0x53a3('0xd'));var jsforce=require(_0x53a3('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x53a3('0xf'));var Papa=require(_0x53a3('0x10'));var Redis=require(_0x53a3('0x11'));var authService=require(_0x53a3('0x12'));var qs=require(_0x53a3('0x13'));var as=require(_0x53a3('0x14'));var hardwareService=require(_0x53a3('0x15'));var logger=require(_0x53a3('0x16'))(_0x53a3('0x17'));var utils=require(_0x53a3('0x18'));var config=require(_0x53a3('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x270e6e,_0x2fc1ad){_0x2fc1ad=_0x2fc1ad||0xcc;return function(_0x43b7ae){if(_0x43b7ae){return _0x270e6e['sendStatus'](_0x2fc1ad);}return _0x270e6e[_0x53a3('0x1a')](_0x2fc1ad)['end']();};}function respondWithResult(_0x267de1,_0x5dc18b){_0x5dc18b=_0x5dc18b||0xc8;return function(_0x2918f4){if(_0x2918f4){return _0x267de1['status'](_0x5dc18b)[_0x53a3('0x1b')](_0x2918f4);}};}function respondWithFilteredResult(_0x200da7,_0xb5057a){return function(_0x2353df){if(_0x2353df){var _0x38e845=typeof _0xb5057a[_0x53a3('0x1c')]===_0x53a3('0x1d')&&typeof _0xb5057a[_0x53a3('0x1e')]===_0x53a3('0x1d');var _0xfa508f=_0x2353df[_0x53a3('0x1f')];var _0x380f4a=_0x38e845?0x0:_0xb5057a[_0x53a3('0x1c')];var _0x4fa1a9=_0x38e845?_0x2353df[_0x53a3('0x1f')]:_0xb5057a[_0x53a3('0x1c')]+_0xb5057a[_0x53a3('0x1e')];var _0x2199c7;if(_0x4fa1a9>=_0xfa508f){_0x4fa1a9=_0xfa508f;_0x2199c7=0xc8;}else{_0x2199c7=0xce;}_0x200da7[_0x53a3('0x1a')](_0x2199c7);return _0x200da7[_0x53a3('0x20')]('Content-Range',_0x380f4a+'-'+_0x4fa1a9+'/'+_0xfa508f)[_0x53a3('0x1b')](_0x2353df);}return null;};}function patchUpdates(_0x1e1043){return function(_0x482e3e){try{jsonpatch[_0x53a3('0x21')](_0x482e3e,_0x1e1043,!![]);}catch(_0x10e9ef){return BPromise['reject'](_0x10e9ef);}return _0x482e3e[_0x53a3('0x22')]();};}function saveUpdates(_0x4912ad,_0x53e820){return function(_0xff8e21){if(_0xff8e21){return _0xff8e21['update'](_0x4912ad)[_0x53a3('0x23')](function(_0x5d122a){return _0x5d122a;});}return null;};}function removeEntity(_0x4d1916,_0x354cc8){return function(_0x1e7bcf){if(_0x1e7bcf){return _0x1e7bcf['destroy']()[_0x53a3('0x23')](function(){_0x4d1916[_0x53a3('0x1a')](0xcc)[_0x53a3('0x24')]();});}};}function handleEntityNotFound(_0xef8d0e,_0xcc19c0){return function(_0x21ee68){if(!_0x21ee68){_0xef8d0e['sendStatus'](0x194);}return _0x21ee68;};}function handleError(_0x1378fd,_0x1c1b6d){_0x1c1b6d=_0x1c1b6d||0x1f4;return function(_0x18d2b2){logger[_0x53a3('0x25')](_0x18d2b2[_0x53a3('0x26')]);if(_0x18d2b2[_0x53a3('0x27')]){delete _0x18d2b2['name'];}_0x1378fd[_0x53a3('0x1a')](_0x1c1b6d)[_0x53a3('0x28')](_0x18d2b2);};}exports[_0x53a3('0x29')]=function(_0xce493a,_0x1b866e){var _0x3df3ed={},_0xfbc204={},_0x1c73b3={'count':0x0,'rows':[]};var _0x5d9f51=_[_0x53a3('0x2a')](db[_0x53a3('0x2b')][_0x53a3('0x2c')],function(_0x3bcb67){return{'name':_0x3bcb67[_0x53a3('0x2d')],'type':_0x3bcb67[_0x53a3('0x2e')][_0x53a3('0x2f')]};});_0xfbc204['model']=_['differenceBy'](_['map'](_0x5d9f51,_0x53a3('0x27')),[_0x53a3('0x27')]);_0xfbc204[_0x53a3('0x30')]=_[_0x53a3('0x31')](_0xce493a[_0x53a3('0x30')]);_0xfbc204['filters']=_['intersection'](_0xfbc204[_0x53a3('0x32')],_0xfbc204[_0x53a3('0x30')]);_0x3df3ed['attributes']=_[_0x53a3('0x33')](_0xfbc204[_0x53a3('0x32')],qs[_0x53a3('0x34')](_0xce493a[_0x53a3('0x30')][_0x53a3('0x34')]));_0x3df3ed[_0x53a3('0x35')]=_0x3df3ed[_0x53a3('0x35')][_0x53a3('0x36')]?_0x3df3ed['attributes']:_0xfbc204[_0x53a3('0x32')];if(!_0xce493a[_0x53a3('0x30')]['hasOwnProperty'](_0x53a3('0x37'))){_0x3df3ed[_0x53a3('0x1e')]=qs[_0x53a3('0x1e')](_0xce493a[_0x53a3('0x30')][_0x53a3('0x1e')]);_0x3df3ed[_0x53a3('0x1c')]=qs['offset'](_0xce493a[_0x53a3('0x30')][_0x53a3('0x1c')]);}_0x3df3ed[_0x53a3('0x38')]=qs[_0x53a3('0x39')](_0xce493a[_0x53a3('0x30')][_0x53a3('0x39')]);_0x3df3ed[_0x53a3('0x3a')]=qs[_0x53a3('0x3b')](_['pick'](_0xce493a[_0x53a3('0x30')],_0xfbc204[_0x53a3('0x3b')]),_0x5d9f51);if(_0xce493a[_0x53a3('0x30')][_0x53a3('0x3c')]){_0x3df3ed[_0x53a3('0x3a')]=_[_0x53a3('0x3d')](_0x3df3ed[_0x53a3('0x3a')],{'$or':_['map'](_0x5d9f51,function(_0x2d74f8){if(_0x2d74f8['type']!=='VIRTUAL'){var _0x4ef38d={};_0x4ef38d[_0x2d74f8[_0x53a3('0x27')]]={'$like':'%'+_0xce493a[_0x53a3('0x30')][_0x53a3('0x3c')]+'%'};return _0x4ef38d;}})});}_0x3df3ed=_[_0x53a3('0x3d')]({},_0x3df3ed,_0xce493a[_0x53a3('0x3e')]);var _0x6cd860={'where':_0x3df3ed[_0x53a3('0x3a')]};return db[_0x53a3('0x2b')][_0x53a3('0x1f')](_0x6cd860)[_0x53a3('0x23')](function(_0x397124){_0x1c73b3[_0x53a3('0x1f')]=_0x397124;if(_0xce493a[_0x53a3('0x30')]['includeAll']){_0x3df3ed[_0x53a3('0x3f')]=[{'all':!![]}];}return db[_0x53a3('0x2b')][_0x53a3('0x40')](_0x3df3ed);})[_0x53a3('0x23')](function(_0x5f408f){_0x1c73b3[_0x53a3('0x41')]=_0x5f408f;return _0x1c73b3;})[_0x53a3('0x23')](respondWithFilteredResult(_0x1b866e,_0x3df3ed))[_0x53a3('0x42')](handleError(_0x1b866e,null));};exports[_0x53a3('0x43')]=function(_0x416ebe,_0x19e262){var _0x4bfed1={'raw':!![],'where':{'id':_0x416ebe[_0x53a3('0x44')]['id']}},_0x297f16={};_0x297f16['model']=_[_0x53a3('0x31')](db['VoiceMailMessage'][_0x53a3('0x2c')]);_0x297f16[_0x53a3('0x30')]=_[_0x53a3('0x31')](_0x416ebe[_0x53a3('0x30')]);_0x297f16[_0x53a3('0x3b')]=_[_0x53a3('0x33')](_0x297f16[_0x53a3('0x32')],_0x297f16['query']);_0x4bfed1[_0x53a3('0x35')]=_[_0x53a3('0x33')](_0x297f16[_0x53a3('0x32')],qs[_0x53a3('0x34')](_0x416ebe['query'][_0x53a3('0x34')]));_0x4bfed1[_0x53a3('0x35')]=_0x4bfed1[_0x53a3('0x35')][_0x53a3('0x36')]?_0x4bfed1[_0x53a3('0x35')]:_0x297f16[_0x53a3('0x32')];if(_0x416ebe[_0x53a3('0x30')][_0x53a3('0x45')]){_0x4bfed1[_0x53a3('0x3f')]=[{'all':!![]}];}_0x4bfed1=_[_0x53a3('0x3d')]({},_0x4bfed1,_0x416ebe['options']);return db[_0x53a3('0x2b')][_0x53a3('0x46')](_0x4bfed1)[_0x53a3('0x23')](handleEntityNotFound(_0x19e262,null))[_0x53a3('0x23')](respondWithResult(_0x19e262,null))[_0x53a3('0x42')](handleError(_0x19e262,null));};exports['create']=function(_0xfea217,_0x2178f8){return db['VoiceMailMessage'][_0x53a3('0x47')](_0xfea217[_0x53a3('0x48')],{})[_0x53a3('0x23')](respondWithResult(_0x2178f8,0xc9))['catch'](handleError(_0x2178f8,null));};exports[_0x53a3('0x49')]=function(_0x5336d9,_0x13971c){if(_0x5336d9[_0x53a3('0x48')]['id']){delete _0x5336d9[_0x53a3('0x48')]['id'];}return db[_0x53a3('0x2b')]['find']({'where':{'id':_0x5336d9['params']['id']}})[_0x53a3('0x23')](handleEntityNotFound(_0x13971c,null))[_0x53a3('0x23')](saveUpdates(_0x5336d9['body'],null))[_0x53a3('0x23')](respondWithResult(_0x13971c,null))[_0x53a3('0x42')](handleError(_0x13971c,null));};exports[_0x53a3('0x4a')]=function(_0x4c1c2b,_0x45efe1){return db[_0x53a3('0x2b')][_0x53a3('0x46')]({'where':{'id':_0x4c1c2b[_0x53a3('0x44')]['id']}})[_0x53a3('0x23')](handleEntityNotFound(_0x45efe1,null))[_0x53a3('0x23')](removeEntity(_0x45efe1,null))[_0x53a3('0x42')](handleError(_0x45efe1,null));};exports[_0x53a3('0x4b')]=function(_0x26d303,_0x45abf7,_0x13383d){return db['VoiceMailMessage'][_0x53a3('0x46')]({'where':{'id':_0x26d303[_0x53a3('0x44')]['id']},'attributes':['id',_0x53a3('0x4c'),'msg_id']})['then'](handleEntityNotFound(_0x45abf7,null))['then'](function(_0x4c9206){if(_0x4c9206){if(!_0x4c9206[_0x53a3('0x4c')]){throw new db[(_0x53a3('0x4d'))][(_0x53a3('0x4e'))](_0x53a3('0x4f'));}var _0x53acef={'Content-Type':'audio/wav','Content-Disposition':_0x53a3('0x50')};if(_0x4c9206[_0x53a3('0x51')]){_0x53acef[_0x53a3('0x52')]=_0x53a3('0x53')+_0x4c9206[_0x53a3('0x51')]+_0x53a3('0x54');}_0x45abf7['set'](_0x53acef);return _0x45abf7[_0x53a3('0x28')](new Buffer(_0x4c9206['recording']));}})[_0x53a3('0x42')](handleError(_0x45abf7,null));}; \ No newline at end of file +var _0x10af=['VoiceMailMessage','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','model','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','fields','length','options','find','body','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map'];(function(_0x2f5a22,_0x5e9f03){var _0x326b70=function(_0x1b7bf9){while(--_0x1b7bf9){_0x2f5a22['push'](_0x2f5a22['shift']());}};_0x326b70(++_0x5e9f03);}(_0x10af,0xdd));var _0xf10a=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x10af[_0x2dadb9];return _0x2f0097;};'use strict';var emlformat=require(_0xf10a('0x0'));var rimraf=require(_0xf10a('0x1'));var zipdir=require(_0xf10a('0x2'));var jsonpatch=require(_0xf10a('0x3'));var rp=require(_0xf10a('0x4'));var moment=require(_0xf10a('0x5'));var BPromise=require(_0xf10a('0x6'));var Mustache=require(_0xf10a('0x7'));var util=require(_0xf10a('0x8'));var path=require(_0xf10a('0x9'));var sox=require(_0xf10a('0xa'));var csv=require(_0xf10a('0xb'));var ejs=require(_0xf10a('0xc'));var fs=require('fs');var fs_extra=require(_0xf10a('0xd'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf10a('0xe'));var jsforce=require(_0xf10a('0xf'));var deskjs=require(_0xf10a('0x10'));var toCsv=require(_0xf10a('0xb'));var querystring=require(_0xf10a('0x11'));var Papa=require(_0xf10a('0x12'));var Redis=require(_0xf10a('0x13'));var authService=require(_0xf10a('0x14'));var qs=require(_0xf10a('0x15'));var as=require(_0xf10a('0x16'));var hardwareService=require(_0xf10a('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0xf10a('0x18'));var config=require(_0xf10a('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xf10a('0x1a'))['db'];function respondWithStatusCode(_0x5b9a19,_0x1e5853){_0x1e5853=_0x1e5853||0xcc;return function(_0x5bae6a){if(_0x5bae6a){return _0x5b9a19[_0xf10a('0x1b')](_0x1e5853);}return _0x5b9a19[_0xf10a('0x1c')](_0x1e5853)[_0xf10a('0x1d')]();};}function respondWithResult(_0x452bb3,_0x2ff4d7){_0x2ff4d7=_0x2ff4d7||0xc8;return function(_0x180a06){if(_0x180a06){return _0x452bb3['status'](_0x2ff4d7)[_0xf10a('0x1e')](_0x180a06);}};}function respondWithFilteredResult(_0x469329,_0x407bcf){return function(_0x59ddb7){if(_0x59ddb7){var _0x4e2e47=typeof _0x407bcf['offset']===_0xf10a('0x1f')&&typeof _0x407bcf[_0xf10a('0x20')]===_0xf10a('0x1f');var _0x5b997a=_0x59ddb7[_0xf10a('0x21')];var _0x1e3cd8=_0x4e2e47?0x0:_0x407bcf[_0xf10a('0x22')];var _0x2d9242=_0x4e2e47?_0x59ddb7[_0xf10a('0x21')]:_0x407bcf[_0xf10a('0x22')]+_0x407bcf['limit'];var _0x450e85;if(_0x2d9242>=_0x5b997a){_0x2d9242=_0x5b997a;_0x450e85=0xc8;}else{_0x450e85=0xce;}_0x469329['status'](_0x450e85);return _0x469329[_0xf10a('0x23')](_0xf10a('0x24'),_0x1e3cd8+'-'+_0x2d9242+'/'+_0x5b997a)[_0xf10a('0x1e')](_0x59ddb7);}return null;};}function patchUpdates(_0x319832){return function(_0x15fd02){try{jsonpatch[_0xf10a('0x25')](_0x15fd02,_0x319832,!![]);}catch(_0x5e9702){return BPromise[_0xf10a('0x26')](_0x5e9702);}return _0x15fd02[_0xf10a('0x27')]();};}function saveUpdates(_0x1279a8,_0x5d5fc3){return function(_0x15c0b2){if(_0x15c0b2){return _0x15c0b2[_0xf10a('0x28')](_0x1279a8)[_0xf10a('0x29')](function(_0x4c29ee){return _0x4c29ee;});}return null;};}function removeEntity(_0x335e32,_0x40bc52){return function(_0x39082a){if(_0x39082a){return _0x39082a[_0xf10a('0x2a')]()[_0xf10a('0x29')](function(){_0x335e32[_0xf10a('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ad03b,_0x2dab73){return function(_0x5bed73){if(!_0x5bed73){_0x1ad03b[_0xf10a('0x1b')](0x194);}return _0x5bed73;};}function handleError(_0x42bd0e,_0x3f4b98){_0x3f4b98=_0x3f4b98||0x1f4;return function(_0x5b09b0){logger[_0xf10a('0x2b')](_0x5b09b0[_0xf10a('0x2c')]);if(_0x5b09b0[_0xf10a('0x2d')]){delete _0x5b09b0['name'];}_0x42bd0e[_0xf10a('0x1c')](_0x3f4b98)[_0xf10a('0x2e')](_0x5b09b0);};}exports[_0xf10a('0x2f')]=function(_0xfaad35,_0x4db3c4){var _0x2d5a59={},_0x3388a2={},_0x41abfc={'count':0x0,'rows':[]};var _0x1d692a=_[_0xf10a('0x30')](db[_0xf10a('0x31')][_0xf10a('0x32')],function(_0x2afd9e){return{'name':_0x2afd9e[_0xf10a('0x33')],'type':_0x2afd9e[_0xf10a('0x34')][_0xf10a('0x35')]};});_0x3388a2['model']=_['differenceBy'](_[_0xf10a('0x30')](_0x1d692a,_0xf10a('0x2d')),['name']);_0x3388a2[_0xf10a('0x36')]=_[_0xf10a('0x37')](_0xfaad35[_0xf10a('0x36')]);_0x3388a2['filters']=_[_0xf10a('0x38')](_0x3388a2['model'],_0x3388a2[_0xf10a('0x36')]);_0x2d5a59[_0xf10a('0x39')]=_[_0xf10a('0x38')](_0x3388a2[_0xf10a('0x3a')],qs['fields'](_0xfaad35[_0xf10a('0x36')]['fields']));_0x2d5a59[_0xf10a('0x39')]=_0x2d5a59[_0xf10a('0x39')]['length']?_0x2d5a59['attributes']:_0x3388a2['model'];if(!_0xfaad35[_0xf10a('0x36')][_0xf10a('0x3b')](_0xf10a('0x3c'))){_0x2d5a59[_0xf10a('0x20')]=qs[_0xf10a('0x20')](_0xfaad35[_0xf10a('0x36')][_0xf10a('0x20')]);_0x2d5a59[_0xf10a('0x22')]=qs[_0xf10a('0x22')](_0xfaad35[_0xf10a('0x36')][_0xf10a('0x22')]);}_0x2d5a59[_0xf10a('0x3d')]=qs[_0xf10a('0x3e')](_0xfaad35[_0xf10a('0x36')][_0xf10a('0x3e')]);_0x2d5a59[_0xf10a('0x3f')]=qs[_0xf10a('0x40')](_[_0xf10a('0x41')](_0xfaad35[_0xf10a('0x36')],_0x3388a2[_0xf10a('0x40')]),_0x1d692a);if(_0xfaad35['query'][_0xf10a('0x42')]){_0x2d5a59[_0xf10a('0x3f')]=_[_0xf10a('0x43')](_0x2d5a59[_0xf10a('0x3f')],{'$or':_[_0xf10a('0x30')](_0x1d692a,function(_0x2bc787){if(_0x2bc787[_0xf10a('0x34')]!==_0xf10a('0x44')){var _0x319cac={};_0x319cac[_0x2bc787['name']]={'$like':'%'+_0xfaad35['query'][_0xf10a('0x42')]+'%'};return _0x319cac;}})});}_0x2d5a59=_['merge']({},_0x2d5a59,_0xfaad35['options']);var _0xab8cf7={'where':_0x2d5a59[_0xf10a('0x3f')]};return db[_0xf10a('0x31')]['count'](_0xab8cf7)[_0xf10a('0x29')](function(_0x45ae20){_0x41abfc[_0xf10a('0x21')]=_0x45ae20;if(_0xfaad35[_0xf10a('0x36')][_0xf10a('0x45')]){_0x2d5a59[_0xf10a('0x46')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0xf10a('0x47')](_0x2d5a59);})[_0xf10a('0x29')](function(_0x2ae119){_0x41abfc[_0xf10a('0x48')]=_0x2ae119;return _0x41abfc;})[_0xf10a('0x29')](respondWithFilteredResult(_0x4db3c4,_0x2d5a59))[_0xf10a('0x49')](handleError(_0x4db3c4,null));};exports[_0xf10a('0x4a')]=function(_0x32cd8d,_0x44ae35){var _0x4a325c={'raw':!![],'where':{'id':_0x32cd8d[_0xf10a('0x4b')]['id']}},_0x57cc9a={};_0x57cc9a['model']=_[_0xf10a('0x37')](db[_0xf10a('0x31')][_0xf10a('0x32')]);_0x57cc9a[_0xf10a('0x36')]=_[_0xf10a('0x37')](_0x32cd8d[_0xf10a('0x36')]);_0x57cc9a[_0xf10a('0x40')]=_[_0xf10a('0x38')](_0x57cc9a[_0xf10a('0x3a')],_0x57cc9a[_0xf10a('0x36')]);_0x4a325c[_0xf10a('0x39')]=_[_0xf10a('0x38')](_0x57cc9a['model'],qs[_0xf10a('0x4c')](_0x32cd8d[_0xf10a('0x36')]['fields']));_0x4a325c[_0xf10a('0x39')]=_0x4a325c[_0xf10a('0x39')][_0xf10a('0x4d')]?_0x4a325c[_0xf10a('0x39')]:_0x57cc9a[_0xf10a('0x3a')];if(_0x32cd8d[_0xf10a('0x36')]['includeAll']){_0x4a325c['include']=[{'all':!![]}];}_0x4a325c=_[_0xf10a('0x43')]({},_0x4a325c,_0x32cd8d[_0xf10a('0x4e')]);return db['VoiceMailMessage'][_0xf10a('0x4f')](_0x4a325c)[_0xf10a('0x29')](handleEntityNotFound(_0x44ae35,null))[_0xf10a('0x29')](respondWithResult(_0x44ae35,null))[_0xf10a('0x49')](handleError(_0x44ae35,null));};exports['create']=function(_0x467bbf,_0x57484e){return db['VoiceMailMessage']['create'](_0x467bbf[_0xf10a('0x50')],{})[_0xf10a('0x29')](respondWithResult(_0x57484e,0xc9))[_0xf10a('0x49')](handleError(_0x57484e,null));};exports['update']=function(_0x5c643c,_0x5127f9){if(_0x5c643c[_0xf10a('0x50')]['id']){delete _0x5c643c[_0xf10a('0x50')]['id'];}return db[_0xf10a('0x31')][_0xf10a('0x4f')]({'where':{'id':_0x5c643c['params']['id']}})['then'](handleEntityNotFound(_0x5127f9,null))[_0xf10a('0x29')](saveUpdates(_0x5c643c['body'],null))['then'](respondWithResult(_0x5127f9,null))['catch'](handleError(_0x5127f9,null));};exports[_0xf10a('0x2a')]=function(_0x4e2323,_0x1c0b88){return db['VoiceMailMessage'][_0xf10a('0x4f')]({'where':{'id':_0x4e2323[_0xf10a('0x4b')]['id']}})[_0xf10a('0x29')](handleEntityNotFound(_0x1c0b88,null))[_0xf10a('0x29')](removeEntity(_0x1c0b88,null))[_0xf10a('0x49')](handleError(_0x1c0b88,null));};exports[_0xf10a('0x51')]=function(_0x573091,_0x311c81,_0x569fe2){return db[_0xf10a('0x31')]['find']({'where':{'id':_0x573091[_0xf10a('0x4b')]['id']},'attributes':['id',_0xf10a('0x52'),_0xf10a('0x53')]})[_0xf10a('0x29')](handleEntityNotFound(_0x311c81,null))[_0xf10a('0x29')](function(_0x61334a){if(_0x61334a){if(!_0x61334a[_0xf10a('0x52')]){throw new db[(_0xf10a('0x54'))][(_0xf10a('0x55'))](_0xf10a('0x56'));}var _0x52b4ec={'Content-Type':'audio/wav','Content-Disposition':'attachment'};if(_0x61334a['msg_id']){_0x52b4ec[_0xf10a('0x57')]=_0xf10a('0x58')+_0x61334a['msg_id']+_0xf10a('0x59');}_0x311c81['set'](_0x52b4ec);return _0x311c81[_0xf10a('0x2e')](new Buffer(_0x61334a[_0xf10a('0x52')]));}})['catch'](handleError(_0x311c81,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index efb4f8b..291dc03 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 _0x1dcc=['./voiceMailMessage.attributes','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x28c9ca,_0x34dc43){var _0x972623=function(_0x4fb428){while(--_0x4fb428){_0x28c9ca['push'](_0x28c9ca['shift']());}};_0x972623(++_0x34dc43);}(_0x1dcc,0x1cc));var _0xc1dc=function(_0x53accc,_0x1f21bd){_0x53accc=_0x53accc-0x0;var _0x2c1bbe=_0x1dcc[_0x53accc];return _0x2c1bbe;};'use strict';var _=require(_0xc1dc('0x0'));var util=require('util');var logger=require(_0xc1dc('0x1'))(_0xc1dc('0x2'));var moment=require(_0xc1dc('0x3'));var BPromise=require(_0xc1dc('0x4'));var rp=require(_0xc1dc('0x5'));var fs=require('fs');var path=require(_0xc1dc('0x6'));var rimraf=require(_0xc1dc('0x7'));var config=require('../../config/environment');var attributes=require(_0xc1dc('0x8'));module['exports']=function(_0x5760e0,_0x512db9){return _0x5760e0[_0xc1dc('0x9')](_0xc1dc('0xa'),attributes,{'tableName':_0xc1dc('0xb'),'paranoid':![],'indexes':[{'name':_0xc1dc('0xc'),'fields':[_0xc1dc('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0x3b1e=['voice_voicemail_messages','dir','../../config/logger','bluebird','request-promise','exports','define'];(function(_0x2b6d59,_0x595871){var _0x1e6a3c=function(_0x35e498){while(--_0x35e498){_0x2b6d59['push'](_0x2b6d59['shift']());}};_0x1e6a3c(++_0x595871);}(_0x3b1e,0x79));var _0xe3b1=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x3b1e[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe3b1('0x0'))('api');var moment=require('moment');var BPromise=require(_0xe3b1('0x1'));var rp=require(_0xe3b1('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceMailMessage.attributes');module[_0xe3b1('0x3')]=function(_0x15e3da,_0x4bacc7){return _0x15e3da[_0xe3b1('0x4')]('VoiceMailMessage',attributes,{'tableName':_0xe3b1('0x5'),'paranoid':![],'indexes':[{'name':_0xe3b1('0x6'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 4db5e14..6493d60 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 _0x6136=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash'];(function(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0x6136,0xaf));var _0x6613=function(_0x46c90e,_0x1555d8){_0x46c90e=_0x46c90e-0x0;var _0x27854c=_0x6136[_0x46c90e];return _0x27854c;};'use strict';var _=require(_0x6613('0x0'));var util=require(_0x6613('0x1'));var moment=require(_0x6613('0x2'));var BPromise=require(_0x6613('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6613('0x4'));var db=require(_0x6613('0x5'))['db'];var utils=require(_0x6613('0x6'));var logger=require(_0x6613('0x7'))(_0x6613('0x8'));var config=require(_0x6613('0x9'));var jayson=require(_0x6613('0xa'));var client=jayson['client'][_0x6613('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xcbfa83,_0x408fb9,_0x9da3f3){return new BPromise(function(_0x33de58,_0x432ee2){return client['request'](_0xcbfa83,_0x9da3f3)[_0x6613('0xc')](function(_0x117650){logger[_0x6613('0xd')](_0x6613('0xe'),_0x408fb9,_0x6613('0xf'));logger['debug'](_0x6613('0x10'),_0x408fb9,_0x6613('0xf'),JSON[_0x6613('0x11')](_0x117650));if(_0x117650[_0x6613('0x12')]){if(_0x117650[_0x6613('0x12')]['code']===0x1f4){logger[_0x6613('0x12')](_0x6613('0xe'),_0x408fb9,_0x117650[_0x6613('0x12')][_0x6613('0x13')]);return _0x432ee2(_0x117650[_0x6613('0x12')][_0x6613('0x13')]);}logger[_0x6613('0x12')](_0x6613('0xe'),_0x408fb9,_0x117650[_0x6613('0x12')][_0x6613('0x13')]);return _0x33de58(_0x117650[_0x6613('0x12')]['message']);}else{logger['info'](_0x6613('0xe'),_0x408fb9,_0x6613('0xf'));_0x33de58(_0x117650[_0x6613('0x14')][_0x6613('0x13')]);}})[_0x6613('0x15')](function(_0xe49fe9){logger[_0x6613('0x12')](_0x6613('0xe'),_0x408fb9,_0xe49fe9);_0x432ee2(_0xe49fe9);});});} \ No newline at end of file +var _0x9c9a=['request','then','info','VoiceMailMessage,\x20%s,\x20%s','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x386394,_0x543996){var _0x4f8d51=function(_0x4b7ae4){while(--_0x4b7ae4){_0x386394['push'](_0x386394['shift']());}};_0x4f8d51(++_0x543996);}(_0x9c9a,0xa2));var _0xa9c9=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9c9a[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xa9c9('0x0'));var util=require(_0xa9c9('0x1'));var moment=require(_0xa9c9('0x2'));var BPromise=require(_0xa9c9('0x3'));var rs=require(_0xa9c9('0x4'));var fs=require('fs');var Redis=require(_0xa9c9('0x5'));var db=require(_0xa9c9('0x6'))['db'];var utils=require(_0xa9c9('0x7'));var logger=require(_0xa9c9('0x8'))(_0xa9c9('0x9'));var config=require(_0xa9c9('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xa9c9('0xb')][_0xa9c9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4733d8,_0x216276,_0x29ece2){return new BPromise(function(_0x567f96,_0x1724b9){return client[_0xa9c9('0xd')](_0x4733d8,_0x29ece2)[_0xa9c9('0xe')](function(_0x1852b4){logger[_0xa9c9('0xf')](_0xa9c9('0x10'),_0x216276,'request\x20sent');logger[_0xa9c9('0x11')](_0xa9c9('0x12'),_0x216276,_0xa9c9('0x13'),JSON['stringify'](_0x1852b4));if(_0x1852b4[_0xa9c9('0x14')]){if(_0x1852b4['error'][_0xa9c9('0x15')]===0x1f4){logger[_0xa9c9('0x14')]('VoiceMailMessage,\x20%s,\x20%s',_0x216276,_0x1852b4['error']['message']);return _0x1724b9(_0x1852b4[_0xa9c9('0x14')]['message']);}logger[_0xa9c9('0x14')]('VoiceMailMessage,\x20%s,\x20%s',_0x216276,_0x1852b4[_0xa9c9('0x14')][_0xa9c9('0x16')]);return _0x567f96(_0x1852b4[_0xa9c9('0x14')]['message']);}else{logger['info'](_0xa9c9('0x10'),_0x216276,'request\x20sent');_0x567f96(_0x1852b4[_0xa9c9('0x17')]['message']);}})[_0xa9c9('0x18')](function(_0x28e35d){logger[_0xa9c9('0x14')](_0xa9c9('0x10'),_0x216276,_0x28e35d);_0x1724b9(_0x28e35d);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 0e7f08f..8bf130d 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 _0xbb2e=['get','isAuthenticated','index','/:id','show','/:id/sounds','post','create','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller'];(function(_0xc0599f,_0x15b994){var _0x2486e0=function(_0xaf5295){while(--_0xaf5295){_0xc0599f['push'](_0xc0599f['shift']());}};_0x2486e0(++_0x15b994);}(_0xbb2e,0xbd));var _0xebb2=function(_0x497eb7,_0x4acd15){_0x497eb7=_0x497eb7-0x0;var _0x291129=_0xbb2e[_0x497eb7];return _0x291129;};'use strict';var multer=require(_0xebb2('0x0'));var util=require(_0xebb2('0x1'));var path=require(_0xebb2('0x2'));var timeout=require(_0xebb2('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xebb2('0x4'));var auth=require(_0xebb2('0x5'));var interaction=require(_0xebb2('0x6'));var config=require(_0xebb2('0x7'));var controller=require(_0xebb2('0x8'));router[_0xebb2('0x9')]('/',auth[_0xebb2('0xa')](),controller[_0xebb2('0xb')]);router['get'](_0xebb2('0xc'),auth[_0xebb2('0xa')](),controller[_0xebb2('0xd')]);router['get'](_0xebb2('0xe'),auth[_0xebb2('0xa')](),controller['getSounds']);router[_0xebb2('0xf')]('/',auth[_0xebb2('0xa')](),controller[_0xebb2('0x10')]);router['post']('/:id/sounds',auth[_0xebb2('0xa')](),controller['addSound']);router['put']('/:id',auth[_0xebb2('0xa')](),controller['update']);router[_0xebb2('0x11')](_0xebb2('0xc'),auth['isAuthenticated'](),controller[_0xebb2('0x12')]);router[_0xebb2('0x11')](_0xebb2('0x13'),auth[_0xebb2('0xa')](),controller[_0xebb2('0x14')]);module[_0xebb2('0x15')]=router; \ No newline at end of file +var _0x77fa=['create','/:id/sounds','addSound','put','update','delete','destroy','/:id/sounds/:id2','removeSound','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMusicOnHold.controller','get','/:id','isAuthenticated','show','post'];(function(_0x132f42,_0x3371cb){var _0x4c0123=function(_0x480e31){while(--_0x480e31){_0x132f42['push'](_0x132f42['shift']());}};_0x4c0123(++_0x3371cb);}(_0x77fa,0x179));var _0xa77f=function(_0x188953,_0x1a1be9){_0x188953=_0x188953-0x0;var _0x4b2a65=_0x77fa[_0x188953];return _0x4b2a65;};'use strict';var multer=require(_0xa77f('0x0'));var util=require(_0xa77f('0x1'));var path=require(_0xa77f('0x2'));var timeout=require(_0xa77f('0x3'));var express=require('express');var router=express[_0xa77f('0x4')]();var fs_extra=require(_0xa77f('0x5'));var auth=require(_0xa77f('0x6'));var interaction=require(_0xa77f('0x7'));var config=require('../../config/environment');var controller=require(_0xa77f('0x8'));router[_0xa77f('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa77f('0x9')](_0xa77f('0xa'),auth[_0xa77f('0xb')](),controller[_0xa77f('0xc')]);router[_0xa77f('0x9')]('/:id/sounds',auth[_0xa77f('0xb')](),controller['getSounds']);router[_0xa77f('0xd')]('/',auth[_0xa77f('0xb')](),controller[_0xa77f('0xe')]);router[_0xa77f('0xd')](_0xa77f('0xf'),auth[_0xa77f('0xb')](),controller[_0xa77f('0x10')]);router[_0xa77f('0x11')](_0xa77f('0xa'),auth[_0xa77f('0xb')](),controller[_0xa77f('0x12')]);router[_0xa77f('0x13')](_0xa77f('0xa'),auth[_0xa77f('0xb')](),controller[_0xa77f('0x14')]);router[_0xa77f('0x13')](_0xa77f('0x15'),auth[_0xa77f('0xb')](),controller[_0xa77f('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index e726782..732cb4d 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 _0xd445=['STRING','name','ENUM','custom','files','quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP','BOOLEAN','exports'];(function(_0x1363da,_0x25554f){var _0x2e84a6=function(_0x3e5206){while(--_0x3e5206){_0x1363da['push'](_0x1363da['shift']());}};_0x2e84a6(++_0x25554f);}(_0xd445,0x173));var _0x5d44=function(_0x402ad4,_0x4a6c53){_0x402ad4=_0x402ad4-0x0;var _0xb862a1=_0xd445[_0x402ad4];return _0xb862a1;};'use strict';var Sequelize=require('sequelize');module[_0x5d44('0x0')]={'name':{'type':Sequelize[_0x5d44('0x1')],'allowNull':![],'unique':_0x5d44('0x2')},'mode':{'type':Sequelize[_0x5d44('0x3')](_0x5d44('0x4'),_0x5d44('0x5'),'mp3nb',_0x5d44('0x6'),_0x5d44('0x7'),_0x5d44('0x8')),'allowNull':!![],'defaultValue':_0x5d44('0x5')},'directory':{'type':Sequelize[_0x5d44('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0x5d44('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0x5d44('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0x5d44('0x1')],'allowNull':!![],'defaultValue':_0x5d44('0x9')},'format':{'type':Sequelize[_0x5d44('0x1')],'allowNull':!![]},'stamp':{'type':_0x5d44('0xa')},'defaultEntry':{'type':Sequelize[_0x5d44('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa60b=['BOOLEAN','sequelize','exports','STRING','ENUM','files','mp3nb','quietmp3nb','quietmp3','alpha','TIMESTAMP'];(function(_0x285a14,_0x394a27){var _0x3430cc=function(_0x46d2d7){while(--_0x46d2d7){_0x285a14['push'](_0x285a14['shift']());}};_0x3430cc(++_0x394a27);}(_0xa60b,0x135));var _0xba60=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xa60b[_0x138adb];return _0x1b27f2;};'use strict';var Sequelize=require(_0xba60('0x0'));module[_0xba60('0x1')]={'name':{'type':Sequelize[_0xba60('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0xba60('0x3')]('custom',_0xba60('0x4'),_0xba60('0x5'),_0xba60('0x6'),_0xba60('0x7'),'mp3'),'allowNull':!![],'defaultValue':_0xba60('0x4')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0xba60('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0xba60('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0xba60('0x2')],'allowNull':!![],'defaultValue':_0xba60('0x8')},'format':{'type':Sequelize[_0xba60('0x2')],'allowNull':!![]},'stamp':{'type':_0xba60('0x9')},'defaultEntry':{'type':Sequelize[_0xba60('0xa')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 7fec1cc..66ce09f 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 _0xfe34=['UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','transaction','directory','readdirSync','forEach','rmdirSync','Sequelize','ValidationError','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','extname','removeSound','id2','unlinkSync','message','getSounds','pick','nolimit','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','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','limit','undefined','count','set','Content-Range','save','update','then','destroy','error','stack','name','send','index','map','VoiceMusicOnHold','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','keys','rawAttributes','include','find','body','create','sequelize','mode','join','root','server/files/moh','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','MusicOnHolds','userProfileId','autoAssociation'];(function(_0x16cb34,_0x36ddf1){var _0x565707=function(_0x326d43){while(--_0x326d43){_0x16cb34['push'](_0x16cb34['shift']());}};_0x565707(++_0x36ddf1);}(_0xfe34,0x1eb));var _0x4fe3=function(_0x3b509d,_0x5dc026){_0x3b509d=_0x3b509d-0x0;var _0x38809f=_0xfe34[_0x3b509d];return _0x38809f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4fe3('0x0'));var jsonpatch=require(_0x4fe3('0x1'));var rp=require(_0x4fe3('0x2'));var moment=require(_0x4fe3('0x3'));var BPromise=require(_0x4fe3('0x4'));var Mustache=require(_0x4fe3('0x5'));var util=require(_0x4fe3('0x6'));var path=require(_0x4fe3('0x7'));var sox=require(_0x4fe3('0x8'));var csv=require(_0x4fe3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4fe3('0xa'));var _=require(_0x4fe3('0xb'));var squel=require('squel');var crypto=require(_0x4fe3('0xc'));var jsforce=require(_0x4fe3('0xd'));var deskjs=require(_0x4fe3('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4fe3('0xf'));var Papa=require(_0x4fe3('0x10'));var Redis=require('ioredis');var authService=require(_0x4fe3('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4fe3('0x12'));var hardwareService=require(_0x4fe3('0x13'));var logger=require(_0x4fe3('0x14'))(_0x4fe3('0x15'));var utils=require(_0x4fe3('0x16'));var config=require(_0x4fe3('0x17'));var licenseUtil=require(_0x4fe3('0x18'));var db=require(_0x4fe3('0x19'))['db'];function respondWithStatusCode(_0x2666f0,_0x12e11b){_0x12e11b=_0x12e11b||0xcc;return function(_0x5d3e55){if(_0x5d3e55){return _0x2666f0[_0x4fe3('0x1a')](_0x12e11b);}return _0x2666f0[_0x4fe3('0x1b')](_0x12e11b)[_0x4fe3('0x1c')]();};}function respondWithResult(_0x3a9a36,_0x146502){_0x146502=_0x146502||0xc8;return function(_0x141e9a){if(_0x141e9a){return _0x3a9a36[_0x4fe3('0x1b')](_0x146502)[_0x4fe3('0x1d')](_0x141e9a);}};}function respondWithFilteredResult(_0x2fc57a,_0xbd88f1){return function(_0x560791){if(_0x560791){var _0x2b2e9a=typeof _0xbd88f1[_0x4fe3('0x1e')]==='undefined'&&typeof _0xbd88f1[_0x4fe3('0x1f')]===_0x4fe3('0x20');var _0x1f060f=_0x560791[_0x4fe3('0x21')];var _0x124b31=_0x2b2e9a?0x0:_0xbd88f1[_0x4fe3('0x1e')];var _0x1d7378=_0x2b2e9a?_0x560791[_0x4fe3('0x21')]:_0xbd88f1['offset']+_0xbd88f1[_0x4fe3('0x1f')];var _0x5370a5;if(_0x1d7378>=_0x1f060f){_0x1d7378=_0x1f060f;_0x5370a5=0xc8;}else{_0x5370a5=0xce;}_0x2fc57a[_0x4fe3('0x1b')](_0x5370a5);return _0x2fc57a[_0x4fe3('0x22')](_0x4fe3('0x23'),_0x124b31+'-'+_0x1d7378+'/'+_0x1f060f)['json'](_0x560791);}return null;};}function patchUpdates(_0x10ce51){return function(_0x29328c){try{jsonpatch['apply'](_0x29328c,_0x10ce51,!![]);}catch(_0xf88a8f){return BPromise['reject'](_0xf88a8f);}return _0x29328c[_0x4fe3('0x24')]();};}function saveUpdates(_0x2f9ba5,_0x397aa8){return function(_0x6712){if(_0x6712){return _0x6712[_0x4fe3('0x25')](_0x2f9ba5)['then'](function(_0x39a5f9){return _0x39a5f9;});}return null;};}function removeEntity(_0x27695f,_0x517a91){return function(_0x57a273){if(_0x57a273){return _0x57a273['destroy']()[_0x4fe3('0x26')](function(){var _0x1e8705=_0x57a273['get']({'plain':!![]});var _0x463d03='MusicOnHolds';return db['UserProfileResource'][_0x4fe3('0x27')]({'where':{'type':_0x463d03,'resourceId':_0x1e8705['id']}})[_0x4fe3('0x26')](function(){return _0x57a273;});})[_0x4fe3('0x26')](function(){_0x27695f[_0x4fe3('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44aa5d,_0x56671e){return function(_0x2372eb){if(!_0x2372eb){_0x44aa5d[_0x4fe3('0x1a')](0x194);}return _0x2372eb;};}function handleError(_0x4cf350,_0x5c1e93){_0x5c1e93=_0x5c1e93||0x1f4;return function(_0x5e3304){logger[_0x4fe3('0x28')](_0x5e3304[_0x4fe3('0x29')]);if(_0x5e3304['name']){delete _0x5e3304[_0x4fe3('0x2a')];}_0x4cf350[_0x4fe3('0x1b')](_0x5c1e93)[_0x4fe3('0x2b')](_0x5e3304);};}exports[_0x4fe3('0x2c')]=function(_0x15e388,_0x265741){var _0x3386b6={},_0x5f3019={},_0x51d9db={'count':0x0,'rows':[]};var _0x260c99=_[_0x4fe3('0x2d')](db[_0x4fe3('0x2e')]['rawAttributes'],function(_0x228879){return{'name':_0x228879['fieldName'],'type':_0x228879[_0x4fe3('0x2f')][_0x4fe3('0x30')]};});_0x5f3019['model']=_[_0x4fe3('0x2d')](_0x260c99,'name');_0x5f3019[_0x4fe3('0x31')]=_['keys'](_0x15e388['query']);_0x5f3019[_0x4fe3('0x32')]=_[_0x4fe3('0x33')](_0x5f3019[_0x4fe3('0x34')],_0x5f3019[_0x4fe3('0x31')]);_0x3386b6['attributes']=_[_0x4fe3('0x33')](_0x5f3019['model'],qs[_0x4fe3('0x35')](_0x15e388[_0x4fe3('0x31')]['fields']));_0x3386b6[_0x4fe3('0x36')]=_0x3386b6['attributes'][_0x4fe3('0x37')]?_0x3386b6[_0x4fe3('0x36')]:_0x5f3019[_0x4fe3('0x34')];if(!_0x15e388['query'][_0x4fe3('0x38')]('nolimit')){_0x3386b6[_0x4fe3('0x1f')]=qs[_0x4fe3('0x1f')](_0x15e388[_0x4fe3('0x31')]['limit']);_0x3386b6[_0x4fe3('0x1e')]=qs[_0x4fe3('0x1e')](_0x15e388['query'][_0x4fe3('0x1e')]);}_0x3386b6[_0x4fe3('0x39')]=qs['sort'](_0x15e388['query'][_0x4fe3('0x3a')]);delete _0x15e388[_0x4fe3('0x31')][_0x4fe3('0x3a')];_0x3386b6[_0x4fe3('0x3b')]=qs[_0x4fe3('0x32')](_['pick'](_0x15e388[_0x4fe3('0x31')],_0x5f3019[_0x4fe3('0x32')]),_0x260c99);if(_0x15e388[_0x4fe3('0x31')][_0x4fe3('0x3c')]){_0x3386b6[_0x4fe3('0x3b')]=_[_0x4fe3('0x3d')](_0x3386b6[_0x4fe3('0x3b')],{'$or':_[_0x4fe3('0x2d')](_0x260c99,function(_0x519bff){if(_0x519bff['type']!==_0x4fe3('0x3e')){var _0x17e869={};_0x17e869[_0x519bff[_0x4fe3('0x2a')]]={'$like':'%'+_0x15e388[_0x4fe3('0x31')][_0x4fe3('0x3c')]+'%'};return _0x17e869;}})});}_0x3386b6=_[_0x4fe3('0x3d')]({},_0x3386b6,_0x15e388[_0x4fe3('0x3f')]);var _0x3bc9db={'where':_0x3386b6[_0x4fe3('0x3b')]};return db['VoiceMusicOnHold']['count'](_0x3bc9db)['then'](function(_0x290493){_0x51d9db['count']=_0x290493;if(_0x15e388['query'][_0x4fe3('0x40')]){_0x3386b6['include']=[{'all':!![]}];}return db[_0x4fe3('0x2e')][_0x4fe3('0x41')](_0x3386b6);})['then'](function(_0x5464b7){_0x51d9db[_0x4fe3('0x42')]=_0x5464b7;return _0x51d9db;})[_0x4fe3('0x26')](respondWithFilteredResult(_0x265741,_0x3386b6))[_0x4fe3('0x43')](handleError(_0x265741,null));};exports['show']=function(_0x3a947d,_0x363e6b){var _0x23dc67={'raw':![],'where':{'id':_0x3a947d[_0x4fe3('0x44')]['id']}},_0x32ea87={};_0x32ea87[_0x4fe3('0x34')]=_[_0x4fe3('0x45')](db[_0x4fe3('0x2e')][_0x4fe3('0x46')]);_0x32ea87[_0x4fe3('0x31')]=_[_0x4fe3('0x45')](_0x3a947d['query']);_0x32ea87[_0x4fe3('0x32')]=_[_0x4fe3('0x33')](_0x32ea87['model'],_0x32ea87[_0x4fe3('0x31')]);_0x23dc67[_0x4fe3('0x36')]=_[_0x4fe3('0x33')](_0x32ea87[_0x4fe3('0x34')],qs['fields'](_0x3a947d[_0x4fe3('0x31')][_0x4fe3('0x35')]));_0x23dc67[_0x4fe3('0x36')]=_0x23dc67[_0x4fe3('0x36')][_0x4fe3('0x37')]?_0x23dc67[_0x4fe3('0x36')]:_0x32ea87['model'];if(_0x3a947d[_0x4fe3('0x31')][_0x4fe3('0x40')]){_0x23dc67[_0x4fe3('0x47')]=[{'all':!![]}];}_0x23dc67=_['merge']({},_0x23dc67,_0x3a947d['options']);return db[_0x4fe3('0x2e')][_0x4fe3('0x48')](_0x23dc67)[_0x4fe3('0x26')](handleEntityNotFound(_0x363e6b,null))[_0x4fe3('0x26')](respondWithResult(_0x363e6b,null))[_0x4fe3('0x43')](handleError(_0x363e6b,null));};exports['update']=function(_0x3ddd37,_0x576efb){if(_0x3ddd37['body']['id']){delete _0x3ddd37['body']['id'];}return db[_0x4fe3('0x2e')]['find']({'where':{'id':_0x3ddd37[_0x4fe3('0x44')]['id']}})[_0x4fe3('0x26')](handleEntityNotFound(_0x576efb,null))[_0x4fe3('0x26')](saveUpdates(_0x3ddd37[_0x4fe3('0x49')],null))[_0x4fe3('0x26')](respondWithResult(_0x576efb,null))[_0x4fe3('0x43')](handleError(_0x576efb,null));};exports[_0x4fe3('0x4a')]=function(_0x5ad728,_0x236ded,_0xa1870a){return db[_0x4fe3('0x4b')]['transaction'](function(_0x24fee5){if(_0x5ad728['body'][_0x4fe3('0x4c')]==='files'){_0x5ad728[_0x4fe3('0x49')]['directory']=path[_0x4fe3('0x4d')](config[_0x4fe3('0x4e')],_0x4fe3('0x4f'),_0x5ad728['body'][_0x4fe3('0x2a')]);}return db['VoiceMusicOnHold']['create'](_0x5ad728[_0x4fe3('0x49')],{'transaction':_0x24fee5})['then'](function(_0x32e4fd){if(_0x5ad728[_0x4fe3('0x49')][_0x4fe3('0x4c')]==='files'){fs['mkdirSync'](_0x32e4fd['directory'],parseInt(_0x4fe3('0x50'),0x8));}var _0x5162e1=_0x5ad728[_0x4fe3('0x51')]['get']({'plain':!![]});if(!_0x5162e1)throw new Error(_0x4fe3('0x52'));if(_0x5162e1[_0x4fe3('0x53')]===_0x4fe3('0x51')){var _0x522b02=_0x32e4fd[_0x4fe3('0x54')]({'plain':!![]});return db[_0x4fe3('0x55')][_0x4fe3('0x48')]({'where':{'name':_0x4fe3('0x56'),'userProfileId':_0x5162e1[_0x4fe3('0x57')]},'raw':!![]})['then'](function(_0x2c3323){if(_0x2c3323&&_0x2c3323[_0x4fe3('0x58')]===0x0){return db[_0x4fe3('0x59')]['create']({'name':_0x522b02[_0x4fe3('0x2a')],'resourceId':_0x522b02['id'],'type':_0x2c3323['name'],'sectionId':_0x2c3323['id']},{})[_0x4fe3('0x26')](function(){return _0x32e4fd;});}else{return _0x32e4fd;}})[_0x4fe3('0x43')](function(_0x13fe01){logger[_0x4fe3('0x28')](_0x4fe3('0x5a'),_0x13fe01);});}return _0x32e4fd;});})[_0x4fe3('0x26')](respondWithResult(_0x236ded,0xc9))[_0x4fe3('0x43')](handleError(_0x236ded,null));};exports[_0x4fe3('0x27')]=function(_0x3a8403,_0x450f36,_0x38d3e8){var _0x112839;return db[_0x4fe3('0x2e')][_0x4fe3('0x48')]({'where':{'id':_0x3a8403[_0x4fe3('0x44')]['id']}})[_0x4fe3('0x26')](function(_0x1ee27e){if(_0x1ee27e){return db[_0x4fe3('0x4b')][_0x4fe3('0x5b')](function(_0x4e94b4){return _0x1ee27e[_0x4fe3('0x27')]({'transaction':_0x4e94b4,'raw':!![]})[_0x4fe3('0x26')](function(_0x51021f){if(_0x51021f[_0x4fe3('0x5c')]){fs[_0x4fe3('0x5d')](_0x51021f[_0x4fe3('0x5c')])[_0x4fe3('0x5e')](function(_0x5aaf04){fs['unlinkSync'](path[_0x4fe3('0x4d')](_0x51021f[_0x4fe3('0x5c')],_0x5aaf04));});fs[_0x4fe3('0x5f')](_0x51021f['directory']);}return _0x51021f;});})[_0x4fe3('0x43')](function(_0x4de2f5){throw new db[(_0x4fe3('0x60'))][(_0x4fe3('0x61'))](_0x4de2f5['message']);});}})[_0x4fe3('0x26')](handleEntityNotFound(_0x450f36,null))[_0x4fe3('0x26')](removeEntity(_0x450f36,null))[_0x4fe3('0x43')](handleError(_0x450f36,null));};exports[_0x4fe3('0x62')]=function(_0x264dd6,_0x3be398,_0x5b4431){return db[_0x4fe3('0x4b')][_0x4fe3('0x5b')](function(_0xd37342){var _0xf1580a;return db[_0x4fe3('0x2e')][_0x4fe3('0x48')]({'where':{'id':_0x264dd6[_0x4fe3('0x44')]['id']}})['then'](function(_0x3f3d5c){if(_0x3f3d5c){_0xf1580a=_0x3f3d5c;return _0x3f3d5c['addSound'](_0x264dd6[_0x4fe3('0x49')]['id'],{'transaction':_0xd37342});}})[_0x4fe3('0x26')](function(_0x26ff7f){if(_0x26ff7f){return db[_0x4fe3('0x63')][_0x4fe3('0x64')]({'where':{'id':_0x264dd6[_0x4fe3('0x49')]['id']},'attributes':['id','name',_0x4fe3('0x65'),_0x4fe3('0x66'),_0x4fe3('0x67')],'raw':!![]});}})[_0x4fe3('0x26')](function(_0x104283){if(_0x104283){var _0x24ef37=path[_0x4fe3('0x4d')](config['root'],_0x4fe3('0x68'),util[_0x4fe3('0x69')](_0x4fe3('0x6a'),path[_0x4fe3('0x6b')](_0x104283['save_name'],path[_0x4fe3('0x6c')](_0x104283[_0x4fe3('0x65')])),_0x104283[_0x4fe3('0x66')]));var _0x1f70d5=path[_0x4fe3('0x4d')](config[_0x4fe3('0x4e')],_0x4fe3('0x4f'),_0xf1580a['name'],util[_0x4fe3('0x69')]('%s.%s',_0x104283[_0x4fe3('0x2a')],_0x104283[_0x4fe3('0x66')]));fs['symlinkSync'](_0x24ef37,_0x1f70d5);return _0x104283;}})[_0x4fe3('0x43')](function(_0x33197e){throw new db[(_0x4fe3('0x60'))]['ValidationError'](_0x33197e['message']);});})['then'](handleEntityNotFound(_0x3be398,null))['then'](respondWithResult(_0x3be398,0xc9))['catch'](handleError(_0x3be398,null));};exports[_0x4fe3('0x6d')]=function(_0x16a172,_0x1aa942,_0x3c6467){return db['sequelize'][_0x4fe3('0x5b')](function(_0x3d4ad6){var _0x2c5d04;return db[_0x4fe3('0x2e')][_0x4fe3('0x64')]({'where':{'id':_0x16a172[_0x4fe3('0x44')]['id']}})['then'](handleEntityNotFound(_0x1aa942,null))[_0x4fe3('0x26')](function(_0x1f114e){if(_0x1f114e){_0x2c5d04=_0x1f114e;return _0x1f114e['removeSound'](_0x16a172[_0x4fe3('0x44')][_0x4fe3('0x6e')]);}})[_0x4fe3('0x26')](function(_0x38cc4c){if(_0x38cc4c){return db[_0x4fe3('0x63')][_0x4fe3('0x64')]({'where':{'id':_0x16a172[_0x4fe3('0x44')][_0x4fe3('0x6e')]},'attributes':['id',_0x4fe3('0x2a'),_0x4fe3('0x65'),_0x4fe3('0x66'),_0x4fe3('0x67')],'raw':!![]});}})[_0x4fe3('0x26')](function(_0x742a0e){if(_0x742a0e){fs[_0x4fe3('0x6f')](path[_0x4fe3('0x4d')](_0x2c5d04[_0x4fe3('0x5c')],util[_0x4fe3('0x69')](_0x4fe3('0x6a'),_0x742a0e['name'],_0x742a0e['converted_format'])));return _0x742a0e;}})['catch'](function(_0x452cd2){throw new db[(_0x4fe3('0x60'))][(_0x4fe3('0x61'))](_0x452cd2[_0x4fe3('0x70')]);});})[_0x4fe3('0x26')](handleEntityNotFound(_0x1aa942,null))[_0x4fe3('0x26')](respondWithStatusCode(_0x1aa942,0xcc))[_0x4fe3('0x43')](handleError(_0x1aa942,null));};exports[_0x4fe3('0x71')]=function(_0x525d84,_0x28de16,_0x4c7b87){var _0x43abed={};var _0xc80667={};var _0x36ff67;var _0x4e3fae;return db[_0x4fe3('0x2e')][_0x4fe3('0x64')]({'where':{'id':_0x525d84['params']['id']}})[_0x4fe3('0x26')](handleEntityNotFound(_0x28de16,null))['then'](function(_0x4bafd9){if(_0x4bafd9){_0x36ff67=_0x4bafd9;_0xc80667['model']=_[_0x4fe3('0x45')](db[_0x4fe3('0x63')][_0x4fe3('0x46')]);_0xc80667['query']=_[_0x4fe3('0x45')](_0x525d84[_0x4fe3('0x31')]);_0xc80667[_0x4fe3('0x32')]=_[_0x4fe3('0x33')](_0xc80667['model'],_0xc80667[_0x4fe3('0x31')]);_0x43abed[_0x4fe3('0x36')]=_['intersection'](_0xc80667[_0x4fe3('0x34')],qs[_0x4fe3('0x35')](_0x525d84['query'][_0x4fe3('0x35')]));_0x43abed['attributes']=_0x43abed[_0x4fe3('0x36')][_0x4fe3('0x37')]?_0x43abed[_0x4fe3('0x36')]:_0xc80667['model'];_0x43abed['order']=qs[_0x4fe3('0x3a')](_0x525d84[_0x4fe3('0x31')]['sort']);_0x43abed[_0x4fe3('0x3b')]=qs['filters'](_[_0x4fe3('0x72')](_0x525d84[_0x4fe3('0x31')],_0xc80667[_0x4fe3('0x32')]));if(_0x525d84[_0x4fe3('0x31')][_0x4fe3('0x3c')]){_0x43abed[_0x4fe3('0x3b')]=_[_0x4fe3('0x3d')](_0x43abed[_0x4fe3('0x3b')],{'$or':_[_0x4fe3('0x2d')](_0x43abed[_0x4fe3('0x36')],function(_0x3772b4){var _0x4471b1={};_0x4471b1[_0x3772b4]={'$like':'%'+_0x525d84[_0x4fe3('0x31')][_0x4fe3('0x3c')]+'%'};return _0x4471b1;})});}_0x43abed=_[_0x4fe3('0x3d')]({},_0x43abed,_0x525d84[_0x4fe3('0x3f')]);return _0x36ff67[_0x4fe3('0x71')](_0x43abed);}})['then'](function(_0x49e85b){if(_0x49e85b){_0x4e3fae=_0x49e85b[_0x4fe3('0x37')];if(!_0x525d84[_0x4fe3('0x31')][_0x4fe3('0x38')](_0x4fe3('0x73'))){_0x43abed['limit']=qs[_0x4fe3('0x1f')](_0x525d84['query']['limit']);_0x43abed[_0x4fe3('0x1e')]=qs[_0x4fe3('0x1e')](_0x525d84[_0x4fe3('0x31')]['offset']);}return _0x36ff67[_0x4fe3('0x71')](_0x43abed);}})['then'](function(_0x528f49){if(_0x528f49){return _0x528f49?{'count':_0x4e3fae,'rows':_0x528f49}:null;}})['then'](respondWithResult(_0x28de16,null))[_0x4fe3('0x43')](handleError(_0x28de16,null));}; \ No newline at end of file +var _0x6ea5=['params','readdirSync','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','extname','symlinkSync','removeSound','id2','unlinkSync','getSounds','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','set','apply','reject','update','then','get','MusicOnHolds','UserProfileResource','destroy','error','stack','name','index','VoiceMusicOnHold','type','key','map','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','count','findAll','rows','show','rawAttributes','keys','includeAll','include','options','catch','body','create','sequelize','transaction','mode','directory','join','server/files/moh','files','mkdirSync','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x57da0a,_0x284aed){var _0x3145d5=function(_0xfe7c3b){while(--_0xfe7c3b){_0x57da0a['push'](_0x57da0a['shift']());}};_0x3145d5(++_0x284aed);}(_0x6ea5,0x166));var _0x56ea=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6ea5[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x56ea('0x0'));var rimraf=require(_0x56ea('0x1'));var zipdir=require(_0x56ea('0x2'));var jsonpatch=require(_0x56ea('0x3'));var rp=require(_0x56ea('0x4'));var moment=require(_0x56ea('0x5'));var BPromise=require(_0x56ea('0x6'));var Mustache=require(_0x56ea('0x7'));var util=require(_0x56ea('0x8'));var path=require(_0x56ea('0x9'));var sox=require(_0x56ea('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x56ea('0xb'));var _=require(_0x56ea('0xc'));var squel=require(_0x56ea('0xd'));var crypto=require(_0x56ea('0xe'));var jsforce=require(_0x56ea('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x56ea('0x10'));var querystring=require('querystring');var Papa=require(_0x56ea('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x56ea('0x12'));var hardwareService=require(_0x56ea('0x13'));var logger=require(_0x56ea('0x14'))(_0x56ea('0x15'));var utils=require(_0x56ea('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x56ea('0x17'));var db=require(_0x56ea('0x18'))['db'];function respondWithStatusCode(_0x5669a7,_0x111204){_0x111204=_0x111204||0xcc;return function(_0x402353){if(_0x402353){return _0x5669a7[_0x56ea('0x19')](_0x111204);}return _0x5669a7[_0x56ea('0x1a')](_0x111204)['end']();};}function respondWithResult(_0x1f543d,_0x4be5a6){_0x4be5a6=_0x4be5a6||0xc8;return function(_0xde6d25){if(_0xde6d25){return _0x1f543d[_0x56ea('0x1a')](_0x4be5a6)[_0x56ea('0x1b')](_0xde6d25);}};}function respondWithFilteredResult(_0x2fa553,_0x2c411e){return function(_0x30ba62){if(_0x30ba62){var _0x456b14=typeof _0x2c411e[_0x56ea('0x1c')]==='undefined'&&typeof _0x2c411e[_0x56ea('0x1d')]==='undefined';var _0x184fd7=_0x30ba62['count'];var _0x12963e=_0x456b14?0x0:_0x2c411e['offset'];var _0x400c37=_0x456b14?_0x30ba62['count']:_0x2c411e[_0x56ea('0x1c')]+_0x2c411e[_0x56ea('0x1d')];var _0x24dcf8;if(_0x400c37>=_0x184fd7){_0x400c37=_0x184fd7;_0x24dcf8=0xc8;}else{_0x24dcf8=0xce;}_0x2fa553[_0x56ea('0x1a')](_0x24dcf8);return _0x2fa553[_0x56ea('0x1e')]('Content-Range',_0x12963e+'-'+_0x400c37+'/'+_0x184fd7)['json'](_0x30ba62);}return null;};}function patchUpdates(_0x2a3087){return function(_0x2311ef){try{jsonpatch[_0x56ea('0x1f')](_0x2311ef,_0x2a3087,!![]);}catch(_0xcf210d){return BPromise[_0x56ea('0x20')](_0xcf210d);}return _0x2311ef['save']();};}function saveUpdates(_0x17a183,_0x147f1e){return function(_0x4970c2){if(_0x4970c2){return _0x4970c2[_0x56ea('0x21')](_0x17a183)[_0x56ea('0x22')](function(_0x5c41e3){return _0x5c41e3;});}return null;};}function removeEntity(_0x52e5e9,_0x56a806){return function(_0x10f230){if(_0x10f230){return _0x10f230['destroy']()[_0x56ea('0x22')](function(){var _0x59aaa2=_0x10f230[_0x56ea('0x23')]({'plain':!![]});var _0x15064e=_0x56ea('0x24');return db[_0x56ea('0x25')][_0x56ea('0x26')]({'where':{'type':_0x15064e,'resourceId':_0x59aaa2['id']}})[_0x56ea('0x22')](function(){return _0x10f230;});})[_0x56ea('0x22')](function(){_0x52e5e9[_0x56ea('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c3f57,_0x3b6c57){return function(_0x9beead){if(!_0x9beead){_0x1c3f57[_0x56ea('0x19')](0x194);}return _0x9beead;};}function handleError(_0xaedd13,_0x4a653){_0x4a653=_0x4a653||0x1f4;return function(_0x352615){logger[_0x56ea('0x27')](_0x352615[_0x56ea('0x28')]);if(_0x352615[_0x56ea('0x29')]){delete _0x352615['name'];}_0xaedd13[_0x56ea('0x1a')](_0x4a653)['send'](_0x352615);};}exports[_0x56ea('0x2a')]=function(_0x471594,_0x441e2c){var _0x5adbf3={},_0x2ab1ac={},_0x5693e2={'count':0x0,'rows':[]};var _0x12b37=_['map'](db[_0x56ea('0x2b')]['rawAttributes'],function(_0x2d529d){return{'name':_0x2d529d['fieldName'],'type':_0x2d529d[_0x56ea('0x2c')][_0x56ea('0x2d')]};});_0x2ab1ac['model']=_[_0x56ea('0x2e')](_0x12b37,'name');_0x2ab1ac[_0x56ea('0x2f')]=_['keys'](_0x471594[_0x56ea('0x2f')]);_0x2ab1ac[_0x56ea('0x30')]=_['intersection'](_0x2ab1ac['model'],_0x2ab1ac['query']);_0x5adbf3[_0x56ea('0x31')]=_[_0x56ea('0x32')](_0x2ab1ac[_0x56ea('0x33')],qs[_0x56ea('0x34')](_0x471594['query'][_0x56ea('0x34')]));_0x5adbf3[_0x56ea('0x31')]=_0x5adbf3['attributes'][_0x56ea('0x35')]?_0x5adbf3[_0x56ea('0x31')]:_0x2ab1ac[_0x56ea('0x33')];if(!_0x471594[_0x56ea('0x2f')][_0x56ea('0x36')](_0x56ea('0x37'))){_0x5adbf3[_0x56ea('0x1d')]=qs[_0x56ea('0x1d')](_0x471594['query'][_0x56ea('0x1d')]);_0x5adbf3[_0x56ea('0x1c')]=qs['offset'](_0x471594['query'][_0x56ea('0x1c')]);}_0x5adbf3[_0x56ea('0x38')]=qs[_0x56ea('0x39')](_0x471594['query']['sort']);delete _0x471594[_0x56ea('0x2f')][_0x56ea('0x39')];_0x5adbf3[_0x56ea('0x3a')]=qs[_0x56ea('0x30')](_[_0x56ea('0x3b')](_0x471594[_0x56ea('0x2f')],_0x2ab1ac[_0x56ea('0x30')]),_0x12b37);if(_0x471594[_0x56ea('0x2f')]['filter']){_0x5adbf3[_0x56ea('0x3a')]=_[_0x56ea('0x3c')](_0x5adbf3['where'],{'$or':_['map'](_0x12b37,function(_0x2b2700){if(_0x2b2700[_0x56ea('0x2c')]!==_0x56ea('0x3d')){var _0x35d793={};_0x35d793[_0x2b2700[_0x56ea('0x29')]]={'$like':'%'+_0x471594[_0x56ea('0x2f')][_0x56ea('0x3e')]+'%'};return _0x35d793;}})});}_0x5adbf3=_['merge']({},_0x5adbf3,_0x471594['options']);var _0x10ae5a={'where':_0x5adbf3[_0x56ea('0x3a')]};return db[_0x56ea('0x2b')][_0x56ea('0x3f')](_0x10ae5a)['then'](function(_0x51aba6){_0x5693e2[_0x56ea('0x3f')]=_0x51aba6;if(_0x471594[_0x56ea('0x2f')]['includeAll']){_0x5adbf3['include']=[{'all':!![]}];}return db[_0x56ea('0x2b')][_0x56ea('0x40')](_0x5adbf3);})[_0x56ea('0x22')](function(_0x309151){_0x5693e2[_0x56ea('0x41')]=_0x309151;return _0x5693e2;})[_0x56ea('0x22')](respondWithFilteredResult(_0x441e2c,_0x5adbf3))['catch'](handleError(_0x441e2c,null));};exports[_0x56ea('0x42')]=function(_0x4117db,_0x577515){var _0x3bebd5={'raw':![],'where':{'id':_0x4117db['params']['id']}},_0x2d53f2={};_0x2d53f2[_0x56ea('0x33')]=_['keys'](db['VoiceMusicOnHold'][_0x56ea('0x43')]);_0x2d53f2[_0x56ea('0x2f')]=_[_0x56ea('0x44')](_0x4117db[_0x56ea('0x2f')]);_0x2d53f2[_0x56ea('0x30')]=_[_0x56ea('0x32')](_0x2d53f2[_0x56ea('0x33')],_0x2d53f2['query']);_0x3bebd5[_0x56ea('0x31')]=_[_0x56ea('0x32')](_0x2d53f2[_0x56ea('0x33')],qs[_0x56ea('0x34')](_0x4117db[_0x56ea('0x2f')][_0x56ea('0x34')]));_0x3bebd5[_0x56ea('0x31')]=_0x3bebd5[_0x56ea('0x31')][_0x56ea('0x35')]?_0x3bebd5[_0x56ea('0x31')]:_0x2d53f2[_0x56ea('0x33')];if(_0x4117db[_0x56ea('0x2f')][_0x56ea('0x45')]){_0x3bebd5[_0x56ea('0x46')]=[{'all':!![]}];}_0x3bebd5=_['merge']({},_0x3bebd5,_0x4117db[_0x56ea('0x47')]);return db[_0x56ea('0x2b')]['find'](_0x3bebd5)[_0x56ea('0x22')](handleEntityNotFound(_0x577515,null))[_0x56ea('0x22')](respondWithResult(_0x577515,null))[_0x56ea('0x48')](handleError(_0x577515,null));};exports[_0x56ea('0x21')]=function(_0x3e1ace,_0x21f5c9){if(_0x3e1ace[_0x56ea('0x49')]['id']){delete _0x3e1ace[_0x56ea('0x49')]['id'];}return db[_0x56ea('0x2b')]['find']({'where':{'id':_0x3e1ace['params']['id']}})[_0x56ea('0x22')](handleEntityNotFound(_0x21f5c9,null))['then'](saveUpdates(_0x3e1ace[_0x56ea('0x49')],null))[_0x56ea('0x22')](respondWithResult(_0x21f5c9,null))[_0x56ea('0x48')](handleError(_0x21f5c9,null));};exports[_0x56ea('0x4a')]=function(_0x31d7b0,_0x21b80c,_0x151bf9){return db[_0x56ea('0x4b')][_0x56ea('0x4c')](function(_0x5a8cf0){if(_0x31d7b0[_0x56ea('0x49')][_0x56ea('0x4d')]==='files'){_0x31d7b0[_0x56ea('0x49')][_0x56ea('0x4e')]=path[_0x56ea('0x4f')](config['root'],_0x56ea('0x50'),_0x31d7b0[_0x56ea('0x49')][_0x56ea('0x29')]);}return db['VoiceMusicOnHold'][_0x56ea('0x4a')](_0x31d7b0[_0x56ea('0x49')],{'transaction':_0x5a8cf0})['then'](function(_0x1b462d){if(_0x31d7b0[_0x56ea('0x49')][_0x56ea('0x4d')]===_0x56ea('0x51')){fs[_0x56ea('0x52')](_0x1b462d[_0x56ea('0x4e')],parseInt('0777',0x8));}var _0x8b9121=_0x31d7b0['user'][_0x56ea('0x23')]({'plain':!![]});if(!_0x8b9121)throw new Error(_0x56ea('0x53'));if(_0x8b9121[_0x56ea('0x54')]===_0x56ea('0x55')){var _0x136ce4=_0x1b462d[_0x56ea('0x23')]({'plain':!![]});return db[_0x56ea('0x56')]['find']({'where':{'name':_0x56ea('0x24'),'userProfileId':_0x8b9121[_0x56ea('0x57')]},'raw':!![]})['then'](function(_0x44282f){if(_0x44282f&&_0x44282f[_0x56ea('0x58')]===0x0){return db['UserProfileResource'][_0x56ea('0x4a')]({'name':_0x136ce4['name'],'resourceId':_0x136ce4['id'],'type':_0x44282f[_0x56ea('0x29')],'sectionId':_0x44282f['id']},{})[_0x56ea('0x22')](function(){return _0x1b462d;});}else{return _0x1b462d;}})['catch'](function(_0x5a87d3){logger['error'](_0x56ea('0x59'),_0x5a87d3);});}return _0x1b462d;});})['then'](respondWithResult(_0x21b80c,0xc9))[_0x56ea('0x48')](handleError(_0x21b80c,null));};exports[_0x56ea('0x26')]=function(_0x56d66e,_0x19c86f,_0x5496a3){var _0x51bf99;return db[_0x56ea('0x2b')]['find']({'where':{'id':_0x56d66e[_0x56ea('0x5a')]['id']}})[_0x56ea('0x22')](function(_0x46a783){if(_0x46a783){return db[_0x56ea('0x4b')][_0x56ea('0x4c')](function(_0x5d017c){return _0x46a783[_0x56ea('0x26')]({'transaction':_0x5d017c,'raw':!![]})[_0x56ea('0x22')](function(_0x4b917b){if(_0x4b917b[_0x56ea('0x4e')]){fs[_0x56ea('0x5b')](_0x4b917b[_0x56ea('0x4e')])['forEach'](function(_0x12ffd7){fs['unlinkSync'](path[_0x56ea('0x4f')](_0x4b917b[_0x56ea('0x4e')],_0x12ffd7));});fs[_0x56ea('0x5c')](_0x4b917b[_0x56ea('0x4e')]);}return _0x4b917b;});})['catch'](function(_0x2ab8a5){throw new db[(_0x56ea('0x5d'))][(_0x56ea('0x5e'))](_0x2ab8a5[_0x56ea('0x5f')]);});}})[_0x56ea('0x22')](handleEntityNotFound(_0x19c86f,null))[_0x56ea('0x22')](removeEntity(_0x19c86f,null))['catch'](handleError(_0x19c86f,null));};exports[_0x56ea('0x60')]=function(_0x4fdb05,_0x1b5efe,_0x9d9942){return db[_0x56ea('0x4b')]['transaction'](function(_0x339ea2){var _0x262171;return db[_0x56ea('0x2b')]['find']({'where':{'id':_0x4fdb05[_0x56ea('0x5a')]['id']}})['then'](function(_0x144a63){if(_0x144a63){_0x262171=_0x144a63;return _0x144a63[_0x56ea('0x60')](_0x4fdb05[_0x56ea('0x49')]['id'],{'transaction':_0x339ea2});}})[_0x56ea('0x22')](function(_0x23d7d7){if(_0x23d7d7){return db[_0x56ea('0x61')][_0x56ea('0x62')]({'where':{'id':_0x4fdb05[_0x56ea('0x49')]['id']},'attributes':['id',_0x56ea('0x29'),_0x56ea('0x63'),_0x56ea('0x64'),_0x56ea('0x65')],'raw':!![]});}})[_0x56ea('0x22')](function(_0x5f39e4){if(_0x5f39e4){var _0x413971=path['join'](config['root'],_0x56ea('0x66'),util[_0x56ea('0x67')](_0x56ea('0x68'),path[_0x56ea('0x69')](_0x5f39e4[_0x56ea('0x63')],path[_0x56ea('0x6a')](_0x5f39e4['save_name'])),_0x5f39e4['converted_format']));var _0x2e55e4=path[_0x56ea('0x4f')](config['root'],'server/files/moh',_0x262171[_0x56ea('0x29')],util[_0x56ea('0x67')](_0x56ea('0x68'),_0x5f39e4['name'],_0x5f39e4[_0x56ea('0x64')]));fs[_0x56ea('0x6b')](_0x413971,_0x2e55e4);return _0x5f39e4;}})[_0x56ea('0x48')](function(_0x161d39){throw new db['Sequelize'][(_0x56ea('0x5e'))](_0x161d39[_0x56ea('0x5f')]);});})['then'](handleEntityNotFound(_0x1b5efe,null))[_0x56ea('0x22')](respondWithResult(_0x1b5efe,0xc9))[_0x56ea('0x48')](handleError(_0x1b5efe,null));};exports[_0x56ea('0x6c')]=function(_0x453840,_0x28b3fc,_0x203c5b){return db[_0x56ea('0x4b')]['transaction'](function(_0x20757d){var _0x39d282;return db[_0x56ea('0x2b')][_0x56ea('0x62')]({'where':{'id':_0x453840['params']['id']}})['then'](handleEntityNotFound(_0x28b3fc,null))['then'](function(_0xe381c7){if(_0xe381c7){_0x39d282=_0xe381c7;return _0xe381c7[_0x56ea('0x6c')](_0x453840[_0x56ea('0x5a')][_0x56ea('0x6d')]);}})[_0x56ea('0x22')](function(_0x5b3905){if(_0x5b3905){return db[_0x56ea('0x61')][_0x56ea('0x62')]({'where':{'id':_0x453840[_0x56ea('0x5a')]['id2']},'attributes':['id',_0x56ea('0x29'),_0x56ea('0x63'),_0x56ea('0x64'),_0x56ea('0x65')],'raw':!![]});}})[_0x56ea('0x22')](function(_0x17206d){if(_0x17206d){fs[_0x56ea('0x6e')](path[_0x56ea('0x4f')](_0x39d282['directory'],util[_0x56ea('0x67')](_0x56ea('0x68'),_0x17206d[_0x56ea('0x29')],_0x17206d[_0x56ea('0x64')])));return _0x17206d;}})['catch'](function(_0x1fd074){throw new db['Sequelize'][(_0x56ea('0x5e'))](_0x1fd074[_0x56ea('0x5f')]);});})[_0x56ea('0x22')](handleEntityNotFound(_0x28b3fc,null))['then'](respondWithStatusCode(_0x28b3fc,0xcc))[_0x56ea('0x48')](handleError(_0x28b3fc,null));};exports[_0x56ea('0x6f')]=function(_0x4abf04,_0x2b34af,_0x446294){var _0x4d3552={};var _0x5a662f={};var _0x2bda86;var _0x5e93dc;return db[_0x56ea('0x2b')][_0x56ea('0x62')]({'where':{'id':_0x4abf04[_0x56ea('0x5a')]['id']}})[_0x56ea('0x22')](handleEntityNotFound(_0x2b34af,null))[_0x56ea('0x22')](function(_0x806f56){if(_0x806f56){_0x2bda86=_0x806f56;_0x5a662f[_0x56ea('0x33')]=_[_0x56ea('0x44')](db[_0x56ea('0x61')][_0x56ea('0x43')]);_0x5a662f['query']=_[_0x56ea('0x44')](_0x4abf04[_0x56ea('0x2f')]);_0x5a662f['filters']=_['intersection'](_0x5a662f[_0x56ea('0x33')],_0x5a662f['query']);_0x4d3552[_0x56ea('0x31')]=_[_0x56ea('0x32')](_0x5a662f[_0x56ea('0x33')],qs[_0x56ea('0x34')](_0x4abf04[_0x56ea('0x2f')][_0x56ea('0x34')]));_0x4d3552[_0x56ea('0x31')]=_0x4d3552[_0x56ea('0x31')][_0x56ea('0x35')]?_0x4d3552[_0x56ea('0x31')]:_0x5a662f[_0x56ea('0x33')];_0x4d3552['order']=qs[_0x56ea('0x39')](_0x4abf04['query'][_0x56ea('0x39')]);_0x4d3552['where']=qs[_0x56ea('0x30')](_[_0x56ea('0x3b')](_0x4abf04['query'],_0x5a662f['filters']));if(_0x4abf04[_0x56ea('0x2f')][_0x56ea('0x3e')]){_0x4d3552['where']=_[_0x56ea('0x3c')](_0x4d3552[_0x56ea('0x3a')],{'$or':_[_0x56ea('0x2e')](_0x4d3552[_0x56ea('0x31')],function(_0x3eea18){var _0x3ec5ea={};_0x3ec5ea[_0x3eea18]={'$like':'%'+_0x4abf04[_0x56ea('0x2f')][_0x56ea('0x3e')]+'%'};return _0x3ec5ea;})});}_0x4d3552=_[_0x56ea('0x3c')]({},_0x4d3552,_0x4abf04[_0x56ea('0x47')]);return _0x2bda86['getSounds'](_0x4d3552);}})['then'](function(_0x5d9adf){if(_0x5d9adf){_0x5e93dc=_0x5d9adf[_0x56ea('0x35')];if(!_0x4abf04[_0x56ea('0x2f')][_0x56ea('0x36')](_0x56ea('0x37'))){_0x4d3552['limit']=qs[_0x56ea('0x1d')](_0x4abf04[_0x56ea('0x2f')][_0x56ea('0x1d')]);_0x4d3552[_0x56ea('0x1c')]=qs[_0x56ea('0x1c')](_0x4abf04[_0x56ea('0x2f')][_0x56ea('0x1c')]);}return _0x2bda86[_0x56ea('0x6f')](_0x4d3552);}})[_0x56ea('0x22')](function(_0x3826bb){if(_0x3826bb){return _0x3826bb?{'count':_0x5e93dc,'rows':_0x3826bb}:null;}})[_0x56ea('0x22')](respondWithResult(_0x2b34af,null))[_0x56ea('0x48')](handleError(_0x2b34af,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 19abc00..7197484 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 _0xff3c=['moment','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','VoiceMusicOnHold','lodash','util','api'];(function(_0x7c962c,_0x411375){var _0x2ae76c=function(_0x5723b1){while(--_0x5723b1){_0x7c962c['push'](_0x7c962c['shift']());}};_0x2ae76c(++_0x411375);}(_0xff3c,0x179));var _0xcff3=function(_0x34880f,_0x38fa2c){_0x34880f=_0x34880f-0x0;var _0x6ddf85=_0xff3c[_0x34880f];return _0x6ddf85;};'use strict';var _=require(_0xcff3('0x0'));var util=require(_0xcff3('0x1'));var logger=require('../../config/logger')(_0xcff3('0x2'));var moment=require(_0xcff3('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xcff3('0x4'));var rimraf=require(_0xcff3('0x5'));var config=require(_0xcff3('0x6'));var attributes=require(_0xcff3('0x7'));module[_0xcff3('0x8')]=function(_0x308a82,_0x47b899){return _0x308a82['define'](_0xcff3('0x9'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f96=['./voiceMusicOnHold.attributes','VoiceMusicOnHold','voice_musiconhold','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x276232,_0x20b6b8){var _0x427024=function(_0x2e7ff8){while(--_0x2e7ff8){_0x276232['push'](_0x276232['shift']());}};_0x427024(++_0x20b6b8);}(_0x3f96,0x1bb));var _0x63f9=function(_0x510591,_0xe66df6){_0x510591=_0x510591-0x0;var _0x1f0624=_0x3f96[_0x510591];return _0x1f0624;};'use strict';var _=require('lodash');var util=require(_0x63f9('0x0'));var logger=require(_0x63f9('0x1'))(_0x63f9('0x2'));var moment=require(_0x63f9('0x3'));var BPromise=require('bluebird');var rp=require(_0x63f9('0x4'));var fs=require('fs');var path=require(_0x63f9('0x5'));var rimraf=require(_0x63f9('0x6'));var config=require(_0x63f9('0x7'));var attributes=require(_0x63f9('0x8'));module['exports']=function(_0x64086e,_0xde6196){return _0x64086e['define'](_0x63f9('0x9'),attributes,{'tableName':_0x63f9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 8b19cfd..55aafa9 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(_0x301c4a,_0x442cdb){var _0x40a923=function(_0x3f16fa){while(--_0x3f16fa){_0x301c4a['push'](_0x301c4a['shift']());}};_0x40a923(++_0x442cdb);}(_0x9c44,0x178));var _0x49c4=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x9c44[_0x2e4aa2];return _0x5e6092;};'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 _0xa9e0=['http','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3afb54,_0x2d90d3){var _0x512d58=function(_0x10a0b1){while(--_0x10a0b1){_0x3afb54['push'](_0x3afb54['shift']());}};_0x512d58(++_0x2d90d3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 5481db5..48edf39 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 _0x5343=['getTeams','post','create','/:id/users','addAgents','/:id/teams','put','delete','destroy','removeAgents','removeTeams','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x2aef4e,_0x229304){var _0xd05333=function(_0x145135){while(--_0x145135){_0x2aef4e['push'](_0x2aef4e['shift']());}};_0xd05333(++_0x229304);}(_0x5343,0x123));var _0x3534=function(_0x4fc93c,_0x3727b0){_0x4fc93c=_0x4fc93c-0x0;var _0x5c1436=_0x5343[_0x4fc93c];return _0x5c1436;};'use strict';var multer=require(_0x3534('0x0'));var util=require(_0x3534('0x1'));var path=require(_0x3534('0x2'));var timeout=require(_0x3534('0x3'));var express=require('express');var router=express[_0x3534('0x4')]();var fs_extra=require(_0x3534('0x5'));var auth=require(_0x3534('0x6'));var interaction=require(_0x3534('0x7'));var config=require(_0x3534('0x8'));var controller=require(_0x3534('0x9'));router[_0x3534('0xa')]('/',auth[_0x3534('0xb')](),controller[_0x3534('0xc')]);router[_0x3534('0xa')](_0x3534('0xd'),auth[_0x3534('0xb')](),controller[_0x3534('0xe')]);router[_0x3534('0xa')](_0x3534('0xf'),auth[_0x3534('0xb')](),controller[_0x3534('0x10')]);router[_0x3534('0xa')]('/:id/users',auth[_0x3534('0xb')](),controller['getAgents']);router[_0x3534('0xa')]('/:id/teams',auth[_0x3534('0xb')](),controller[_0x3534('0x11')]);router[_0x3534('0x12')]('/',auth[_0x3534('0xb')](),controller[_0x3534('0x13')]);router[_0x3534('0x12')](_0x3534('0x14'),auth[_0x3534('0xb')](),controller[_0x3534('0x15')]);router['post'](_0x3534('0x16'),auth[_0x3534('0xb')](),controller['addTeams']);router[_0x3534('0x17')](_0x3534('0xf'),auth[_0x3534('0xb')](),controller['update']);router[_0x3534('0x18')](_0x3534('0xf'),auth[_0x3534('0xb')](),controller[_0x3534('0x19')]);router[_0x3534('0x18')](_0x3534('0x14'),auth[_0x3534('0xb')](),controller[_0x3534('0x1a')]);router['delete'](_0x3534('0x16'),auth['isAuthenticated'](),controller[_0x3534('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x3ee5=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','describe','/:id','show','/:id/users','getAgents','/:id/teams','post','create','put','delete','destroy','removeAgents','removeTeams','exports','util','path','express','Router'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3ee5,0x1b6));var _0x53ee=function(_0x55d4ca,_0x93464b){_0x55d4ca=_0x55d4ca-0x0;var _0x12fc2c=_0x3ee5[_0x55d4ca];return _0x12fc2c;};'use strict';var multer=require('multer');var util=require(_0x53ee('0x0'));var path=require(_0x53ee('0x1'));var timeout=require('connect-timeout');var express=require(_0x53ee('0x2'));var router=express[_0x53ee('0x3')]();var fs_extra=require(_0x53ee('0x4'));var auth=require(_0x53ee('0x5'));var interaction=require(_0x53ee('0x6'));var config=require(_0x53ee('0x7'));var controller=require(_0x53ee('0x8'));router[_0x53ee('0x9')]('/',auth[_0x53ee('0xa')](),controller[_0x53ee('0xb')]);router[_0x53ee('0x9')]('/describe',auth[_0x53ee('0xa')](),controller[_0x53ee('0xc')]);router[_0x53ee('0x9')](_0x53ee('0xd'),auth[_0x53ee('0xa')](),controller[_0x53ee('0xe')]);router[_0x53ee('0x9')](_0x53ee('0xf'),auth[_0x53ee('0xa')](),controller[_0x53ee('0x10')]);router[_0x53ee('0x9')](_0x53ee('0x11'),auth['isAuthenticated'](),controller['getTeams']);router[_0x53ee('0x12')]('/',auth[_0x53ee('0xa')](),controller[_0x53ee('0x13')]);router[_0x53ee('0x12')](_0x53ee('0xf'),auth['isAuthenticated'](),controller['addAgents']);router[_0x53ee('0x12')](_0x53ee('0x11'),auth['isAuthenticated'](),controller['addTeams']);router[_0x53ee('0x14')](_0x53ee('0xd'),auth[_0x53ee('0xa')](),controller['update']);router[_0x53ee('0x15')](_0x53ee('0xd'),auth[_0x53ee('0xa')](),controller[_0x53ee('0x16')]);router[_0x53ee('0x15')](_0x53ee('0xf'),auth['isAuthenticated'](),controller[_0x53ee('0x17')]);router[_0x53ee('0x15')](_0x53ee('0x11'),auth[_0x53ee('0xa')](),controller[_0x53ee('0x18')]);module[_0x53ee('0x19')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index c00b0a9..532b07b 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 _0xf590=['system-','STRING','INTEGER','exports','name','VIRTUAL'];(function(_0x434a99,_0x4b953c){var _0x1d7173=function(_0x2a2ce8){while(--_0x2a2ce8){_0x434a99['push'](_0x434a99['shift']());}};_0x1d7173(++_0x4b953c);}(_0xf590,0x10b));var _0x0f59=function(_0x6ca7f4,_0x51a5df){_0x6ca7f4=_0x6ca7f4-0x0;var _0x494fa6=_0xf590[_0x6ca7f4];return _0x494fa6;};'use strict';var Sequelize=require('sequelize');module[_0x0f59('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0f59('0x1')},'prefix':{'type':Sequelize[_0x0f59('0x2')],'get':function(_0x39c58f){return _0x0f59('0x3')+this['getDataValue'](_0x0f59('0x1'))+'-';}},'description':{'type':Sequelize[_0x0f59('0x4')]},'callerIdAll':{'type':Sequelize[_0x0f59('0x4')]},'VoiceExtensionId':{'type':Sequelize[_0x0f59('0x5')]}}; \ No newline at end of file +var _0xe580=['name','VIRTUAL','STRING','INTEGER','sequelize','exports'];(function(_0x326438,_0x527135){var _0x2fbfaf=function(_0x1b7c8e){while(--_0x1b7c8e){_0x326438['push'](_0x326438['shift']());}};_0x2fbfaf(++_0x527135);}(_0xe580,0xd6));var _0x0e58=function(_0x5ee6f3,_0x226879){_0x5ee6f3=_0x5ee6f3-0x0;var _0x32219f=_0xe580[_0x5ee6f3];return _0x32219f;};'use strict';var Sequelize=require(_0x0e58('0x0'));module[_0x0e58('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0e58('0x2')},'prefix':{'type':Sequelize[_0x0e58('0x3')],'get':function(_0x4e0281){return'system-'+this['getDataValue'](_0x0e58('0x2'))+'-';}},'description':{'type':Sequelize[_0x0e58('0x4')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0x0e58('0x5')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 8eda33f..a8235dd 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 _0x14a0=['mustache','sox','to-csv','ejs','squel','crypto','jsforce','querystring','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','VoicePrefixes','UserProfileResource','stack','name','send','index','map','VoicePrefix','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','catch','params','find','describe','sequelize','body','get','VoiceExtension','VoiceExtensionId','user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','system','description','Voice\x20Prefix\x20Extension','priority','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','create','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','No\x20callerid\x20available','charAt','system-','transaction','addAgents','ids','spread','emit','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','pick','getTeams','addTeams','findAll','User','Agents','online','voicePause','interface','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','userVoicePrefix:save','removeTeams','Team','select','from','join','user_has_teams','clone','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','includes','all','union','compact','isEmpty','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x54d41c,_0x34165d){var _0x5d25fe=function(_0x987467){while(--_0x987467){_0x54d41c['push'](_0x54d41c['shift']());}};_0x5d25fe(++_0x34165d);}(_0x14a0,0x8e));var _0x014a=function(_0x4fe922,_0x3dd7ff){_0x4fe922=_0x4fe922-0x0;var _0x2a78ae=_0x14a0[_0x4fe922];return _0x2a78ae;};'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 hardwareService=require('../../config/license/hardware');var logger=require(_0x014a('0xf'))(_0x014a('0x10'));var utils=require('../../config/utils');var config=require(_0x014a('0x11'));var licenseUtil=require(_0x014a('0x12'));var db=require(_0x014a('0x13'))['db'];config[_0x014a('0x14')]=_[_0x014a('0x15')](config[_0x014a('0x14')],{'host':_0x014a('0x16'),'port':0x18eb});var socket=require(_0x014a('0x17'))(new Redis(config[_0x014a('0x14')]));require(_0x014a('0x18'))[_0x014a('0x19')](socket);function respondWithStatusCode(_0x3c54c8,_0x4fe87c){_0x4fe87c=_0x4fe87c||0xcc;return function(_0x130d13){if(_0x130d13){return _0x3c54c8[_0x014a('0x1a')](_0x4fe87c);}return _0x3c54c8['status'](_0x4fe87c)[_0x014a('0x1b')]();};}function respondWithResult(_0x128c46,_0x59a4ea){_0x59a4ea=_0x59a4ea||0xc8;return function(_0x16e6fc){if(_0x16e6fc){return _0x128c46[_0x014a('0x1c')](_0x59a4ea)[_0x014a('0x1d')](_0x16e6fc);}};}function respondWithFilteredResult(_0x12da95,_0x2c26ac){return function(_0x12d339){if(_0x12d339){var _0x61ec9f=typeof _0x2c26ac[_0x014a('0x1e')]===_0x014a('0x1f')&&typeof _0x2c26ac[_0x014a('0x20')]===_0x014a('0x1f');var _0x89e132=_0x12d339[_0x014a('0x21')];var _0x34e5c3=_0x61ec9f?0x0:_0x2c26ac['offset'];var _0x359903=_0x61ec9f?_0x12d339[_0x014a('0x21')]:_0x2c26ac[_0x014a('0x1e')]+_0x2c26ac[_0x014a('0x20')];var _0xc9a563;if(_0x359903>=_0x89e132){_0x359903=_0x89e132;_0xc9a563=0xc8;}else{_0xc9a563=0xce;}_0x12da95[_0x014a('0x1c')](_0xc9a563);return _0x12da95[_0x014a('0x22')](_0x014a('0x23'),_0x34e5c3+'-'+_0x359903+'/'+_0x89e132)[_0x014a('0x1d')](_0x12d339);}return null;};}function patchUpdates(_0x486e66){return function(_0x3679ed){try{jsonpatch['apply'](_0x3679ed,_0x486e66,!![]);}catch(_0x1a1318){return BPromise[_0x014a('0x24')](_0x1a1318);}return _0x3679ed[_0x014a('0x25')]();};}function saveUpdates(_0x36d52b,_0x2b3c10){return function(_0x113b12){if(_0x113b12){return _0x113b12[_0x014a('0x26')](_0x36d52b)[_0x014a('0x27')](function(_0x165a42){return _0x165a42;});}return null;};}function removeEntity(_0x4c2627,_0x3b4b92){return function(_0x5358e9){if(_0x5358e9){return _0x5358e9[_0x014a('0x28')]()[_0x014a('0x27')](function(){var _0x4f1c44=_0x5358e9['get']({'plain':!![]});var _0x9a901f=_0x014a('0x29');return db[_0x014a('0x2a')]['destroy']({'where':{'type':_0x9a901f,'resourceId':_0x4f1c44['id']}})[_0x014a('0x27')](function(){return _0x5358e9;});})[_0x014a('0x27')](function(){_0x4c2627['status'](0xcc)[_0x014a('0x1b')]();});}};}function handleEntityNotFound(_0x2560a6,_0x496040){return function(_0x4f9c1c){if(!_0x4f9c1c){_0x2560a6[_0x014a('0x1a')](0x194);}return _0x4f9c1c;};}function handleError(_0x3e5a0a,_0xe70dfa){_0xe70dfa=_0xe70dfa||0x1f4;return function(_0x29fce5){logger['error'](_0x29fce5[_0x014a('0x2b')]);if(_0x29fce5[_0x014a('0x2c')]){delete _0x29fce5[_0x014a('0x2c')];}_0x3e5a0a[_0x014a('0x1c')](_0xe70dfa)[_0x014a('0x2d')](_0x29fce5);};}exports[_0x014a('0x2e')]=function(_0x354f4c,_0x1dae8e){var _0xc802d5={},_0x3c8755={},_0x9dfb11={'count':0x0,'rows':[]};var _0x4ed54e=_[_0x014a('0x2f')](db[_0x014a('0x30')][_0x014a('0x31')],function(_0x457883){return{'name':_0x457883[_0x014a('0x32')],'type':_0x457883[_0x014a('0x33')][_0x014a('0x34')]};});_0x3c8755['model']=_[_0x014a('0x2f')](_0x4ed54e,_0x014a('0x2c'));_0x3c8755['query']=_[_0x014a('0x35')](_0x354f4c[_0x014a('0x36')]);_0x3c8755[_0x014a('0x37')]=_[_0x014a('0x38')](_0x3c8755[_0x014a('0x39')],_0x3c8755[_0x014a('0x36')]);_0xc802d5[_0x014a('0x3a')]=_[_0x014a('0x38')](_0x3c8755['model'],qs[_0x014a('0x3b')](_0x354f4c[_0x014a('0x36')][_0x014a('0x3b')]));_0xc802d5[_0x014a('0x3a')]=_0xc802d5['attributes'][_0x014a('0x3c')]?_0xc802d5[_0x014a('0x3a')]:_0x3c8755[_0x014a('0x39')];if(!_0x354f4c[_0x014a('0x36')][_0x014a('0x3d')](_0x014a('0x3e'))){_0xc802d5[_0x014a('0x20')]=qs[_0x014a('0x20')](_0x354f4c[_0x014a('0x36')]['limit']);_0xc802d5[_0x014a('0x1e')]=qs['offset'](_0x354f4c[_0x014a('0x36')][_0x014a('0x1e')]);}_0xc802d5[_0x014a('0x3f')]=qs[_0x014a('0x40')](_0x354f4c[_0x014a('0x36')]['sort']);_0xc802d5[_0x014a('0x41')]=qs[_0x014a('0x37')](_['pick'](_0x354f4c[_0x014a('0x36')],_0x3c8755[_0x014a('0x37')]),_0x4ed54e);if(_0x354f4c[_0x014a('0x36')][_0x014a('0x42')]){_0xc802d5[_0x014a('0x41')]=_[_0x014a('0x43')](_0xc802d5[_0x014a('0x41')],{'$or':_[_0x014a('0x2f')](_0x4ed54e,function(_0x2beddc){if(_0x2beddc['type']!==_0x014a('0x44')){var _0x3baf40={};_0x3baf40[_0x2beddc[_0x014a('0x2c')]]={'$like':'%'+_0x354f4c[_0x014a('0x36')]['filter']+'%'};return _0x3baf40;}})});}_0xc802d5=_[_0x014a('0x43')]({},_0xc802d5,_0x354f4c[_0x014a('0x45')]);var _0x4cd132={'where':_0xc802d5[_0x014a('0x41')]};return db[_0x014a('0x30')][_0x014a('0x21')](_0x4cd132)['then'](function(_0x361866){_0x9dfb11[_0x014a('0x21')]=_0x361866;if(_0x354f4c['query'][_0x014a('0x46')]){_0xc802d5[_0x014a('0x47')]=[{'all':!![]}];}return db[_0x014a('0x30')]['findAll'](_0xc802d5);})[_0x014a('0x27')](function(_0x50a8f0){_0x9dfb11['rows']=_0x50a8f0;return _0x9dfb11;})[_0x014a('0x27')](respondWithFilteredResult(_0x1dae8e,_0xc802d5))[_0x014a('0x48')](handleError(_0x1dae8e,null));};exports['show']=function(_0x1557ad,_0x11c0d5){var _0xa4b68e={'raw':![],'where':{'id':_0x1557ad[_0x014a('0x49')]['id']}},_0x15c5dc={};_0x15c5dc[_0x014a('0x39')]=_['keys'](db[_0x014a('0x30')][_0x014a('0x31')]);_0x15c5dc[_0x014a('0x36')]=_['keys'](_0x1557ad['query']);_0x15c5dc[_0x014a('0x37')]=_['intersection'](_0x15c5dc['model'],_0x15c5dc[_0x014a('0x36')]);_0xa4b68e['attributes']=_[_0x014a('0x38')](_0x15c5dc[_0x014a('0x39')],qs[_0x014a('0x3b')](_0x1557ad['query'][_0x014a('0x3b')]));_0xa4b68e[_0x014a('0x3a')]=_0xa4b68e[_0x014a('0x3a')][_0x014a('0x3c')]?_0xa4b68e[_0x014a('0x3a')]:_0x15c5dc[_0x014a('0x39')];if(_0x1557ad['query'][_0x014a('0x46')]){_0xa4b68e[_0x014a('0x47')]=[{'all':!![]}];}_0xa4b68e=_['merge']({},_0xa4b68e,_0x1557ad[_0x014a('0x45')]);return db[_0x014a('0x30')][_0x014a('0x4a')](_0xa4b68e)[_0x014a('0x27')](handleEntityNotFound(_0x11c0d5,null))[_0x014a('0x27')](respondWithResult(_0x11c0d5,null))[_0x014a('0x48')](handleError(_0x11c0d5,null));};exports[_0x014a('0x28')]=function(_0x21680f,_0x4aa72b){return db[_0x014a('0x30')][_0x014a('0x4a')]({'where':{'id':_0x21680f[_0x014a('0x49')]['id']}})[_0x014a('0x27')](handleEntityNotFound(_0x4aa72b,null))[_0x014a('0x27')](removeEntity(_0x4aa72b,null))['catch'](handleError(_0x4aa72b,null));};exports[_0x014a('0x4b')]=function(_0x5bee56,_0x2da804){return db[_0x014a('0x30')][_0x014a('0x4b')]()[_0x014a('0x27')](respondWithResult(_0x2da804,null))[_0x014a('0x48')](handleError(_0x2da804,null));};exports['create']=function(_0x51e1de,_0x4bb0b2){var _0x58905d;return db[_0x014a('0x4c')]['transaction'](function(_0x1fe253){return db['VoicePrefix']['create'](_0x51e1de[_0x014a('0x4d')],{'transaction':_0x1fe253})['then'](function(_0x1c640b){_0x58905d=_0x1c640b[_0x014a('0x4e')]({'plain':!![]});return db[_0x014a('0x4f')][_0x014a('0x4a')]({'where':{'id':_0x58905d[_0x014a('0x50')]},'raw':!![]})[_0x014a('0x27')](function(_0x35a421){return createVoicePrefixExtensions(_0x58905d,_0x35a421,_0x1fe253);});});})[_0x014a('0x27')](function(){var _0x133fcd=_0x51e1de[_0x014a('0x51')]['get']({'plain':!![]});if(!_0x133fcd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x133fcd[_0x014a('0x52')]===_0x014a('0x51')){var _0x237345=_0x58905d;return db['UserProfileSection']['find']({'where':{'name':_0x014a('0x29'),'userProfileId':_0x133fcd['userProfileId']},'raw':!![]})[_0x014a('0x27')](function(_0x3f6177){if(_0x3f6177&&_0x3f6177[_0x014a('0x53')]===0x0){return db[_0x014a('0x2a')]['create']({'name':_0x237345[_0x014a('0x2c')],'resourceId':_0x237345['id'],'type':_0x3f6177[_0x014a('0x2c')],'sectionId':_0x3f6177['id']},{})[_0x014a('0x27')](function(){return _0x58905d;});}else{return _0x58905d;}})['catch'](function(_0xbaeb5f){logger['error'](_0x014a('0x54'),_0xbaeb5f);throw _0xbaeb5f;});}return _0x58905d;})[_0x014a('0x27')](respondWithResult(_0x4bb0b2,null))[_0x014a('0x48')](handleError(_0x4bb0b2,null));};function Extension(_0x24d433,_0xd0334a,_0x1a308b,_0x4e9260){this[_0x014a('0x55')]=_0x014a('0x56');this[_0x014a('0x57')]=_0x24d433;this['app']=_0x1a308b;this[_0x014a('0x33')]=_0x014a('0x58');this[_0x014a('0x59')]=_0x014a('0x5a');this[_0x014a('0x5b')]=_0xd0334a;this['appdata']=_0x4e9260;}function createVoicePrefixExtensions(_0x8ac9cd,_0x46168d,_0x63c341){return new BPromise(function(_0x37a7b8,_0x3ca7e6){var _0x37b4a5=new Extension(formatPrefixName(_0x8ac9cd[_0x014a('0x5c')]),0x1,_0x014a('0x5d'),_0x014a('0x5e'));_0x37b4a5[_0x014a('0x5f')]=_0x8ac9cd['id'];return db[_0x014a('0x4f')][_0x014a('0x60')](_0x37b4a5,{'transaction':_0x63c341})['then'](function(_0x2ac66a){var _0x5ac216=_0x2ac66a['get']({'plain':!![]});var _0x5c9c47=_['map'](addVoicePrefixExtensions(_0x8ac9cd,_0x46168d),function(_0x5a38b4){_0x5a38b4[_0x014a('0x50')]=_0x5ac216['id'];_0x5a38b4[_0x014a('0x5f')]=_0x8ac9cd['id'];return _0x5a38b4;});return db[_0x014a('0x4f')]['bulkCreate'](_0x5c9c47,{'transaction':_0x63c341})[_0x014a('0x27')](function(_0x2a5007){if(!_0x2a5007){return _0x3ca7e6(_0x014a('0x61'));}else{return _0x37a7b8(_0x2a5007);}})[_0x014a('0x48')](function(_0x4dd210){return _0x3ca7e6(_0x4dd210);});});;});};function addVoicePrefixExtensions(_0x5edf80,_0xd3ab26){var _0x39154c=[];var _0x411948=formatPrefixName(_0x5edf80[_0x014a('0x5c')]);_0x39154c[_0x014a('0x62')](new Extension(_0x411948,0x2,_0x014a('0x63'),_0x014a('0x64')+_0x5edf80[_0x014a('0x2c')]));if(_0x5edf80[_0x014a('0x65')]){_0x39154c[_0x014a('0x62')](new Extension(_0x411948,0x3,_0x014a('0x63'),'PREFIX-CALLERIDALL='+_0x5edf80[_0x014a('0x65')]));}else{_0x39154c[_0x014a('0x62')](new Extension(_0x411948,0x3,'NoOp',_0x014a('0x66')));}_0x39154c[_0x014a('0x62')](new Extension(_0x411948,0x4,'goto',_0xd3ab26[_0x014a('0x55')]+','+'${EXTEN:'+(0x8+_0x5edf80[_0x014a('0x2c')][_0x014a('0x3c')])+'}'+','+0x1));return _0x39154c;}function formatPrefixName(_0xcdcbbb){var _0x456d69='_';for(var _0x37b8f=0x0;_0x37b8f<_0xcdcbbb['length'];_0x37b8f++){if(_0xcdcbbb[_0x014a('0x67')](_0x37b8f)=='-'){_0x456d69+=_0xcdcbbb[_0x014a('0x67')](_0x37b8f);}else{_0x456d69+='['+_0xcdcbbb[_0x014a('0x67')](_0x37b8f)+']';}}_0x456d69+='.';return _0x456d69;}exports[_0x014a('0x26')]=function(_0xbad5ef,_0x52e79e,_0x20cddc){var _0x188e65=_0xbad5ef[_0x014a('0x4d')];_0x188e65['prefix']=_0x014a('0x68')+_0x188e65['name']+'-';return db[_0x014a('0x4c')][_0x014a('0x69')](function(_0x267026){return db[_0x014a('0x30')][_0x014a('0x26')](_0x188e65,{'where':{'id':_0x188e65['id']},'transaction':_0x267026})[_0x014a('0x27')](function(){return db[_0x014a('0x4f')]['destroy']({'where':{'VoicePrefixId':_0x188e65['id']},'transaction':_0x267026})['then'](function(){return db[_0x014a('0x4f')]['find']({'where':{'id':_0x188e65[_0x014a('0x50')]},'raw':!![]})['then'](function(_0x1dcfc6){return createVoicePrefixExtensions(_0x188e65,_0x1dcfc6,_0x267026);});});});})[_0x014a('0x27')](function(){return db['VoicePrefix']['findById'](_0x188e65['id']);})[_0x014a('0x27')](respondWithResult(_0x52e79e,null))[_0x014a('0x48')](handleError(_0x52e79e,null));};exports['addAgents']=function(_0x882fc9,_0x42e4e9,_0x5635fc){return db['VoicePrefix'][_0x014a('0x4a')]({'where':{'id':_0x882fc9[_0x014a('0x49')]['id']}})[_0x014a('0x27')](handleEntityNotFound(_0x42e4e9,null))[_0x014a('0x27')](function(_0x37ea2d){if(_0x37ea2d){return _0x37ea2d[_0x014a('0x6a')](_0x882fc9['body'][_0x014a('0x6b')],_['omit'](_0x882fc9['body'],[_0x014a('0x6b'),'id'])||{})[_0x014a('0x6c')](function(_0x523859){for(var _0x27e363=0x0;_0x27e363<_0x882fc9[_0x014a('0x4d')][_0x014a('0x6b')][_0x014a('0x3c')];_0x27e363+=0x1){socket[_0x014a('0x6d')]('userVoicePrefix:save',{'UserId':Number(_0x882fc9[_0x014a('0x4d')][_0x014a('0x6b')][_0x27e363]),'VoicePrefixId':Number(_0x882fc9[_0x014a('0x49')]['id'])});}return _0x523859;});}})[_0x014a('0x27')](respondWithResult(_0x42e4e9,null))['catch'](handleError(_0x42e4e9,null));};exports[_0x014a('0x6e')]=function(_0x4c568c,_0x469bb0,_0x3807c4){return db[_0x014a('0x30')][_0x014a('0x4a')]({'where':{'id':_0x4c568c[_0x014a('0x49')]['id']}})[_0x014a('0x27')](handleEntityNotFound(_0x469bb0,null))['then'](function(_0x389bfb){if(_0x389bfb){return _0x389bfb[_0x014a('0x6e')](_0x4c568c[_0x014a('0x36')][_0x014a('0x6b')])[_0x014a('0x27')](function(){if(_[_0x014a('0x6f')](_0x4c568c[_0x014a('0x36')][_0x014a('0x6b')])){for(var _0x55cfe7=0x0;_0x55cfe7<_0x4c568c[_0x014a('0x36')][_0x014a('0x6b')][_0x014a('0x3c')];_0x55cfe7+=0x1){socket['emit'](_0x014a('0x70'),{'UserId':Number(_0x4c568c[_0x014a('0x36')][_0x014a('0x6b')][_0x55cfe7]),'VoicePrefixId':Number(_0x4c568c[_0x014a('0x49')]['id'])});}}else{socket[_0x014a('0x6d')](_0x014a('0x70'),{'UserId':Number(_0x4c568c[_0x014a('0x36')]['ids']),'VoicePrefixId':Number(_0x4c568c['params']['id'])});}});}})['then'](respondWithStatusCode(_0x469bb0,null))['catch'](handleError(_0x469bb0,null));};exports[_0x014a('0x71')]=function(_0x32683c,_0x1810a8,_0x3804e1){var _0xe1b5ed={};var _0x7cd599={};var _0x1ba571;var _0x4e5d25;return db[_0x014a('0x30')][_0x014a('0x72')]({'where':{'id':_0x32683c[_0x014a('0x49')]['id']}})[_0x014a('0x27')](handleEntityNotFound(_0x1810a8,null))['then'](function(_0x55d5f1){if(_0x55d5f1){_0x1ba571=_0x55d5f1;_0x7cd599[_0x014a('0x39')]=_[_0x014a('0x35')](db['User']['rawAttributes']);_0x7cd599[_0x014a('0x36')]=_['keys'](_0x32683c['query']);_0x7cd599[_0x014a('0x37')]=_[_0x014a('0x38')](_0x7cd599['model'],_0x7cd599[_0x014a('0x36')]);_0xe1b5ed[_0x014a('0x3a')]=_[_0x014a('0x38')](_0x7cd599[_0x014a('0x39')],qs[_0x014a('0x3b')](_0x32683c[_0x014a('0x36')][_0x014a('0x3b')]));_0xe1b5ed[_0x014a('0x3a')]=_0xe1b5ed['attributes']['length']?_0xe1b5ed[_0x014a('0x3a')]:_0x7cd599['model'];_0xe1b5ed['order']=qs['sort'](_0x32683c[_0x014a('0x36')][_0x014a('0x40')]);_0xe1b5ed[_0x014a('0x41')]=qs['filters'](_[_0x014a('0x73')](_0x32683c[_0x014a('0x36')],_0x7cd599[_0x014a('0x37')]));if(_0x32683c[_0x014a('0x36')]['filter']){_0xe1b5ed[_0x014a('0x41')]=_[_0x014a('0x43')](_0xe1b5ed[_0x014a('0x41')],{'$or':_['map'](_0xe1b5ed[_0x014a('0x3a')],function(_0x52a3a8){var _0x59871d={};_0x59871d[_0x52a3a8]={'$like':'%'+_0x32683c[_0x014a('0x36')][_0x014a('0x42')]+'%'};return _0x59871d;})});}_0xe1b5ed=_[_0x014a('0x43')]({},_0xe1b5ed,_0x32683c['options']);return _0x1ba571[_0x014a('0x71')](_0xe1b5ed);}})[_0x014a('0x27')](function(_0x53c335){if(_0x53c335){_0x4e5d25=_0x53c335[_0x014a('0x3c')];if(!_0x32683c[_0x014a('0x36')][_0x014a('0x3d')](_0x014a('0x3e'))){_0xe1b5ed[_0x014a('0x20')]=qs[_0x014a('0x20')](_0x32683c[_0x014a('0x36')][_0x014a('0x20')]);_0xe1b5ed['offset']=qs[_0x014a('0x1e')](_0x32683c[_0x014a('0x36')]['offset']);}return _0x1ba571['getAgents'](_0xe1b5ed);}})[_0x014a('0x27')](function(_0x45a093){if(_0x45a093){return _0x45a093?{'count':_0x4e5d25,'rows':_0x45a093}:null;}})['then'](respondWithResult(_0x1810a8,null))[_0x014a('0x48')](handleError(_0x1810a8,null));};exports[_0x014a('0x74')]=function(_0x216b27,_0x5ddb47,_0x3a0012){var _0x2c320f={};var _0x5dedaf={};var _0x5baf80;var _0x105786;return db['VoicePrefix'][_0x014a('0x72')]({'where':{'id':_0x216b27['params']['id']}})[_0x014a('0x27')](handleEntityNotFound(_0x5ddb47,null))[_0x014a('0x27')](function(_0xda07b5){if(_0xda07b5){_0x5baf80=_0xda07b5;_0x5dedaf[_0x014a('0x39')]=_[_0x014a('0x35')](db['Team'][_0x014a('0x31')]);_0x5dedaf[_0x014a('0x36')]=_[_0x014a('0x35')](_0x216b27[_0x014a('0x36')]);_0x5dedaf[_0x014a('0x37')]=_[_0x014a('0x38')](_0x5dedaf[_0x014a('0x39')],_0x5dedaf[_0x014a('0x36')]);_0x2c320f['attributes']=_[_0x014a('0x38')](_0x5dedaf['model'],qs[_0x014a('0x3b')](_0x216b27['query']['fields']));_0x2c320f['attributes']=_0x2c320f['attributes'][_0x014a('0x3c')]?_0x2c320f[_0x014a('0x3a')]:_0x5dedaf[_0x014a('0x39')];_0x2c320f[_0x014a('0x3f')]=qs[_0x014a('0x40')](_0x216b27[_0x014a('0x36')][_0x014a('0x40')]);_0x2c320f[_0x014a('0x41')]=qs['filters'](_['pick'](_0x216b27[_0x014a('0x36')],_0x5dedaf[_0x014a('0x37')]));if(_0x216b27[_0x014a('0x36')][_0x014a('0x42')]){_0x2c320f[_0x014a('0x41')]=_[_0x014a('0x43')](_0x2c320f[_0x014a('0x41')],{'$or':_[_0x014a('0x2f')](_0x2c320f['attributes'],function(_0x27431c){var _0x3cfcc7={};_0x3cfcc7[_0x27431c]={'$like':'%'+_0x216b27[_0x014a('0x36')][_0x014a('0x42')]+'%'};return _0x3cfcc7;})});}_0x2c320f=_[_0x014a('0x43')]({},_0x2c320f,_0x216b27['options']);return _0x5baf80[_0x014a('0x74')](_0x2c320f);}})[_0x014a('0x27')](function(_0x2b9496){if(_0x2b9496){_0x105786=_0x2b9496[_0x014a('0x3c')];if(!_0x216b27[_0x014a('0x36')][_0x014a('0x3d')](_0x014a('0x3e'))){_0x2c320f['limit']=qs[_0x014a('0x20')](_0x216b27['query']['limit']);_0x2c320f[_0x014a('0x1e')]=qs[_0x014a('0x1e')](_0x216b27['query'][_0x014a('0x1e')]);}return _0x5baf80[_0x014a('0x74')](_0x2c320f);}})[_0x014a('0x27')](function(_0x5e116d){if(_0x5e116d){return _0x5e116d?{'count':_0x105786,'rows':_0x5e116d}:null;}})[_0x014a('0x27')](respondWithResult(_0x5ddb47,null))[_0x014a('0x48')](handleError(_0x5ddb47,null));};exports[_0x014a('0x75')]=function(_0x336bcf,_0x2f7969,_0x263212){var _0x13c2b2=_0x336bcf[_0x014a('0x4d')][_0x014a('0x6b')];var _0x58341b;return db['Team'][_0x014a('0x76')]({'where':{'id':_0x13c2b2},'attributes':['id'],'include':[{'model':db[_0x014a('0x77')],'as':_0x014a('0x78'),'attributes':['id','name',_0x014a('0x79'),_0x014a('0x7a'),_0x014a('0x7b')],'raw':!![]}]})[_0x014a('0x27')](function(_0x49997){if(_0x49997){_0x58341b=_0x49997;var _0x2888a0=_['flatMap'](_0x49997,function(_0x1c8cba){var _0x3ab005=_0x1c8cba[_0x014a('0x4e')]({'plain':!![]});return _0x3ab005[_0x014a('0x78')];});return db['VoicePrefix'][_0x014a('0x4a')]({'where':{'id':_0x336bcf[_0x014a('0x49')]['id']}})[_0x014a('0x27')](function(_0x30999a){return db[_0x014a('0x4c')]['transaction'](function(_0xcf0aee){return _0x30999a['addTeams'](_0x13c2b2,{'transaction':_0xcf0aee})['then'](function(){return BPromise[_0x014a('0x7c')](_0x58341b,function(_0x369fbd){return db[_0x014a('0x7d')][_0x014a('0x7e')]({'TeamId':_0x369fbd['id'],'VoicePrefixId':_0x336bcf[_0x014a('0x49')]['id']},{'transaction':_0xcf0aee});});})[_0x014a('0x27')](function(){return BPromise[_0x014a('0x7c')](_0x2888a0,function(_0x3a9352){return db[_0x014a('0x7f')][_0x014a('0x80')]({'where':{'UserId':_0x3a9352['id'],'VoicePrefixId':_0x336bcf[_0x014a('0x49')]['id']},'transaction':_0xcf0aee});});})[_0x014a('0x27')](function(){_0x2888a0[_0x014a('0x81')](function(_0x175c12){socket[_0x014a('0x6d')](_0x014a('0x82'),{'UserId':_0x175c12['id'],'VoicePrefixId':_0x30999a['id']});});});});});}})['then'](respondWithStatusCode(_0x2f7969,null))[_0x014a('0x48')](handleError(_0x2f7969,null));};exports[_0x014a('0x83')]=function(_0x3c03ac,_0x4ab9d6,_0x4495c1){return db[_0x014a('0x84')][_0x014a('0x76')]({'where':{'id':_0x3c03ac[_0x014a('0x36')][_0x014a('0x6b')]},'attributes':['id'],'include':[{'model':db[_0x014a('0x77')],'as':_0x014a('0x78'),'attributes':['id'],'raw':!![]}]})[_0x014a('0x27')](handleEntityNotFound(_0x4ab9d6,null))[_0x014a('0x27')](function(_0x480639){var _0x346734=_[_0x014a('0x2f')](_0x480639,'id');var _0x1b1e6a=[];var _0x11aab3=[];var _0x4f91f1=squel[_0x014a('0x85')]();_0x4f91f1['field']('tq.TeamId')[_0x014a('0x86')]('team_has_voice_prefixes','tq')[_0x014a('0x87')](_0x014a('0x88'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x014a('0x41')]('VoicePrefixId\x20=\x20?',_0x3c03ac[_0x014a('0x49')]['id']);for(var _0x8cc35d=0x0;_0x8cc35d<_0x480639['length'];_0x8cc35d+=0x1){let _0x183bf6=_0x480639[_0x8cc35d];for(var _0x1b1c4e=0x0;_0x1b1c4e<_0x183bf6['Agents'][_0x014a('0x3c')];_0x1b1c4e+=0x1){let _0x3f5c3e=_0x183bf6[_0x014a('0x78')][_0x1b1c4e];var _0x383c07=_0x4f91f1[_0x014a('0x89')]();_0x383c07[_0x014a('0x41')](_0x014a('0x8a'),_0x3f5c3e['id']);_0x11aab3[_0x014a('0x62')](db[_0x014a('0x4c')][_0x014a('0x36')](_0x383c07[_0x014a('0x8b')](),{'type':db[_0x014a('0x4c')]['QueryTypes'][_0x014a('0x8c')]})[_0x014a('0x27')](function(_0x3d8d34){if(_0x3d8d34[_0x014a('0x3c')]===0x1){return _0x3f5c3e['id'];}else{var _0x3cf20e=_[_0x014a('0x8d')](_[_0x014a('0x2f')](_0x3d8d34,_0x014a('0x8e')),function(_0x5a7fd0){return _[_0x014a('0x8f')](_0x346734,_0x5a7fd0);});if(_0x3cf20e){return _0x3f5c3e['id'];}}}));}}return BPromise[_0x014a('0x90')](_0x11aab3)[_0x014a('0x27')](function(_0x29d217){_0x1b1e6a=_(_0x1b1e6a)[_0x014a('0x91')](_0x29d217)[_0x014a('0x92')]()['value']();return db[_0x014a('0x30')][_0x014a('0x4a')]({'where':{'id':_0x3c03ac[_0x014a('0x49')]['id']}})['then'](function(_0x4e6844){return db[_0x014a('0x4c')][_0x014a('0x69')](function(_0x262513){return _0x4e6844[_0x014a('0x83')](_0x3c03ac[_0x014a('0x36')]['ids'],{'transaction':_0x262513})[_0x014a('0x27')](function(){if(!_[_0x014a('0x93')](_0x1b1e6a)){return _0x4e6844[_0x014a('0x6e')](_0x1b1e6a,{'transaction':_0x262513});}})[_0x014a('0x27')](function(){_0x1b1e6a[_0x014a('0x81')](function(_0x87c7e5){socket['emit'](_0x014a('0x70'),{'UserId':_0x87c7e5,'VoicePrefixId':_0x4e6844['id']});});});});});});})['then'](respondWithStatusCode(_0x4ab9d6,null))[_0x014a('0x48')](handleError(_0x4ab9d6,null));}; \ No newline at end of file +var _0x160f=['forEach','removeTeams','tq.TeamId','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','includes','all','value','isEmpty','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voicePrefix.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','VoicePrefixes','UserProfileResource','name','send','index','map','VoicePrefix','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','describe','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','exten','app','type','system','description','Voice\x20Prefix\x20Extension','appdata','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtension','bulkCreate','Extensions\x20creation\x20failed','prefix','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','sequelize','VoiceExtensionId','findById','addAgents','ids','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','hasOwnProperty','nolimit','Team','getTeams','Agents','online','voicePause','interface','transaction','addTeams','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate'];(function(_0x12e073,_0x2a6387){var _0x17e67b=function(_0x61b780){while(--_0x61b780){_0x12e073['push'](_0x12e073['shift']());}};_0x17e67b(++_0x2a6387);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xf160('0x0'));var rimraf=require(_0xf160('0x1'));var zipdir=require(_0xf160('0x2'));var jsonpatch=require(_0xf160('0x3'));var rp=require('request-promise');var moment=require(_0xf160('0x4'));var BPromise=require(_0xf160('0x5'));var Mustache=require(_0xf160('0x6'));var util=require(_0xf160('0x7'));var path=require(_0xf160('0x8'));var sox=require(_0xf160('0x9'));var csv=require('to-csv');var ejs=require(_0xf160('0xa'));var fs=require('fs');var fs_extra=require(_0xf160('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf160('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf160('0xd'));var Papa=require(_0xf160('0xe'));var Redis=require(_0xf160('0xf'));var authService=require(_0xf160('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf160('0x11'));var logger=require(_0xf160('0x12'))(_0xf160('0x13'));var utils=require('../../config/utils');var config=require(_0xf160('0x14'));var licenseUtil=require(_0xf160('0x15'));var db=require(_0xf160('0x16'))['db'];config[_0xf160('0x17')]=_[_0xf160('0x18')](config['redis'],{'host':_0xf160('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf160('0x17')]));require(_0xf160('0x1a'))[_0xf160('0x1b')](socket);function respondWithStatusCode(_0x2bb6c7,_0x3a4faa){_0x3a4faa=_0x3a4faa||0xcc;return function(_0x31f7ae){if(_0x31f7ae){return _0x2bb6c7[_0xf160('0x1c')](_0x3a4faa);}return _0x2bb6c7[_0xf160('0x1d')](_0x3a4faa)[_0xf160('0x1e')]();};}function respondWithResult(_0x59ac02,_0x477e4d){_0x477e4d=_0x477e4d||0xc8;return function(_0x400bda){if(_0x400bda){return _0x59ac02[_0xf160('0x1d')](_0x477e4d)[_0xf160('0x1f')](_0x400bda);}};}function respondWithFilteredResult(_0x51824b,_0x36a978){return function(_0x4b8185){if(_0x4b8185){var _0x5388c7=typeof _0x36a978[_0xf160('0x20')]===_0xf160('0x21')&&typeof _0x36a978[_0xf160('0x22')]===_0xf160('0x21');var _0x205afa=_0x4b8185[_0xf160('0x23')];var _0x2a8cb4=_0x5388c7?0x0:_0x36a978[_0xf160('0x20')];var _0x4a58d9=_0x5388c7?_0x4b8185[_0xf160('0x23')]:_0x36a978[_0xf160('0x20')]+_0x36a978[_0xf160('0x22')];var _0x5ad173;if(_0x4a58d9>=_0x205afa){_0x4a58d9=_0x205afa;_0x5ad173=0xc8;}else{_0x5ad173=0xce;}_0x51824b[_0xf160('0x1d')](_0x5ad173);return _0x51824b[_0xf160('0x24')](_0xf160('0x25'),_0x2a8cb4+'-'+_0x4a58d9+'/'+_0x205afa)[_0xf160('0x1f')](_0x4b8185);}return null;};}function patchUpdates(_0x2e03c8){return function(_0x1b0081){try{jsonpatch[_0xf160('0x26')](_0x1b0081,_0x2e03c8,!![]);}catch(_0x5a72d1){return BPromise[_0xf160('0x27')](_0x5a72d1);}return _0x1b0081[_0xf160('0x28')]();};}function saveUpdates(_0x305f6a,_0x49bb5c){return function(_0x578f7d){if(_0x578f7d){return _0x578f7d[_0xf160('0x29')](_0x305f6a)[_0xf160('0x2a')](function(_0x4a8003){return _0x4a8003;});}return null;};}function removeEntity(_0x487c0c,_0x168a09){return function(_0x1cc04c){if(_0x1cc04c){return _0x1cc04c[_0xf160('0x2b')]()['then'](function(){var _0xcfa9bd=_0x1cc04c[_0xf160('0x2c')]({'plain':!![]});var _0x2851e8=_0xf160('0x2d');return db[_0xf160('0x2e')][_0xf160('0x2b')]({'where':{'type':_0x2851e8,'resourceId':_0xcfa9bd['id']}})['then'](function(){return _0x1cc04c;});})['then'](function(){_0x487c0c['status'](0xcc)[_0xf160('0x1e')]();});}};}function handleEntityNotFound(_0x16a5fa,_0xcaab39){return function(_0x26e06b){if(!_0x26e06b){_0x16a5fa[_0xf160('0x1c')](0x194);}return _0x26e06b;};}function handleError(_0x563103,_0x55f9c3){_0x55f9c3=_0x55f9c3||0x1f4;return function(_0x329d6b){logger['error'](_0x329d6b['stack']);if(_0x329d6b[_0xf160('0x2f')]){delete _0x329d6b[_0xf160('0x2f')];}_0x563103['status'](_0x55f9c3)[_0xf160('0x30')](_0x329d6b);};}exports[_0xf160('0x31')]=function(_0x4ab048,_0x528dff){var _0x4b3ef4={},_0x54d17f={},_0x3e7720={'count':0x0,'rows':[]};var _0x2bb5c4=_[_0xf160('0x32')](db[_0xf160('0x33')][_0xf160('0x34')],function(_0x26fc8b){return{'name':_0x26fc8b['fieldName'],'type':_0x26fc8b['type']['key']};});_0x54d17f[_0xf160('0x35')]=_['map'](_0x2bb5c4,'name');_0x54d17f[_0xf160('0x36')]=_[_0xf160('0x37')](_0x4ab048['query']);_0x54d17f[_0xf160('0x38')]=_[_0xf160('0x39')](_0x54d17f[_0xf160('0x35')],_0x54d17f[_0xf160('0x36')]);_0x4b3ef4[_0xf160('0x3a')]=_['intersection'](_0x54d17f[_0xf160('0x35')],qs[_0xf160('0x3b')](_0x4ab048[_0xf160('0x36')]['fields']));_0x4b3ef4[_0xf160('0x3a')]=_0x4b3ef4[_0xf160('0x3a')][_0xf160('0x3c')]?_0x4b3ef4[_0xf160('0x3a')]:_0x54d17f[_0xf160('0x35')];if(!_0x4ab048[_0xf160('0x36')]['hasOwnProperty']('nolimit')){_0x4b3ef4[_0xf160('0x22')]=qs[_0xf160('0x22')](_0x4ab048[_0xf160('0x36')][_0xf160('0x22')]);_0x4b3ef4[_0xf160('0x20')]=qs[_0xf160('0x20')](_0x4ab048[_0xf160('0x36')][_0xf160('0x20')]);}_0x4b3ef4[_0xf160('0x3d')]=qs[_0xf160('0x3e')](_0x4ab048[_0xf160('0x36')][_0xf160('0x3e')]);_0x4b3ef4[_0xf160('0x3f')]=qs[_0xf160('0x38')](_[_0xf160('0x40')](_0x4ab048[_0xf160('0x36')],_0x54d17f[_0xf160('0x38')]),_0x2bb5c4);if(_0x4ab048[_0xf160('0x36')][_0xf160('0x41')]){_0x4b3ef4[_0xf160('0x3f')]=_[_0xf160('0x42')](_0x4b3ef4[_0xf160('0x3f')],{'$or':_[_0xf160('0x32')](_0x2bb5c4,function(_0x1bdc44){if(_0x1bdc44['type']!==_0xf160('0x43')){var _0x476c31={};_0x476c31[_0x1bdc44[_0xf160('0x2f')]]={'$like':'%'+_0x4ab048[_0xf160('0x36')][_0xf160('0x41')]+'%'};return _0x476c31;}})});}_0x4b3ef4=_[_0xf160('0x42')]({},_0x4b3ef4,_0x4ab048[_0xf160('0x44')]);var _0x4f65c9={'where':_0x4b3ef4[_0xf160('0x3f')]};return db['VoicePrefix'][_0xf160('0x23')](_0x4f65c9)[_0xf160('0x2a')](function(_0x530fc5){_0x3e7720[_0xf160('0x23')]=_0x530fc5;if(_0x4ab048[_0xf160('0x36')][_0xf160('0x45')]){_0x4b3ef4[_0xf160('0x46')]=[{'all':!![]}];}return db[_0xf160('0x33')][_0xf160('0x47')](_0x4b3ef4);})[_0xf160('0x2a')](function(_0x4f5eba){_0x3e7720[_0xf160('0x48')]=_0x4f5eba;return _0x3e7720;})[_0xf160('0x2a')](respondWithFilteredResult(_0x528dff,_0x4b3ef4))[_0xf160('0x49')](handleError(_0x528dff,null));};exports[_0xf160('0x4a')]=function(_0x3e4f0e,_0x2caefa){var _0x33bef9={'raw':![],'where':{'id':_0x3e4f0e[_0xf160('0x4b')]['id']}},_0x15b31a={};_0x15b31a[_0xf160('0x35')]=_[_0xf160('0x37')](db['VoicePrefix']['rawAttributes']);_0x15b31a[_0xf160('0x36')]=_[_0xf160('0x37')](_0x3e4f0e[_0xf160('0x36')]);_0x15b31a[_0xf160('0x38')]=_[_0xf160('0x39')](_0x15b31a[_0xf160('0x35')],_0x15b31a['query']);_0x33bef9[_0xf160('0x3a')]=_['intersection'](_0x15b31a['model'],qs[_0xf160('0x3b')](_0x3e4f0e[_0xf160('0x36')]['fields']));_0x33bef9['attributes']=_0x33bef9[_0xf160('0x3a')][_0xf160('0x3c')]?_0x33bef9[_0xf160('0x3a')]:_0x15b31a[_0xf160('0x35')];if(_0x3e4f0e['query']['includeAll']){_0x33bef9['include']=[{'all':!![]}];}_0x33bef9=_['merge']({},_0x33bef9,_0x3e4f0e[_0xf160('0x44')]);return db['VoicePrefix'][_0xf160('0x4c')](_0x33bef9)[_0xf160('0x2a')](handleEntityNotFound(_0x2caefa,null))[_0xf160('0x2a')](respondWithResult(_0x2caefa,null))[_0xf160('0x49')](handleError(_0x2caefa,null));};exports['destroy']=function(_0x45af83,_0x283f55){return db[_0xf160('0x33')]['find']({'where':{'id':_0x45af83[_0xf160('0x4b')]['id']}})[_0xf160('0x2a')](handleEntityNotFound(_0x283f55,null))[_0xf160('0x2a')](removeEntity(_0x283f55,null))['catch'](handleError(_0x283f55,null));};exports[_0xf160('0x4d')]=function(_0x6d8c9b,_0x409e7d){return db[_0xf160('0x33')][_0xf160('0x4d')]()['then'](respondWithResult(_0x409e7d,null))['catch'](handleError(_0x409e7d,null));};exports[_0xf160('0x4e')]=function(_0x5d81b9,_0x1d5168){var _0xf31056;return db['sequelize']['transaction'](function(_0x321309){return db[_0xf160('0x33')]['create'](_0x5d81b9[_0xf160('0x4f')],{'transaction':_0x321309})[_0xf160('0x2a')](function(_0x28605d){_0xf31056=_0x28605d[_0xf160('0x2c')]({'plain':!![]});return db['VoiceExtension'][_0xf160('0x4c')]({'where':{'id':_0xf31056['VoiceExtensionId']},'raw':!![]})[_0xf160('0x2a')](function(_0x1b3ec0){return createVoicePrefixExtensions(_0xf31056,_0x1b3ec0,_0x321309);});});})[_0xf160('0x2a')](function(){var _0x170ca4=_0x5d81b9[_0xf160('0x50')]['get']({'plain':!![]});if(!_0x170ca4)throw new Error(_0xf160('0x51'));if(_0x170ca4['role']===_0xf160('0x50')){var _0x1229cd=_0xf31056;return db[_0xf160('0x52')][_0xf160('0x4c')]({'where':{'name':_0xf160('0x2d'),'userProfileId':_0x170ca4[_0xf160('0x53')]},'raw':!![]})[_0xf160('0x2a')](function(_0x12c22){if(_0x12c22&&_0x12c22[_0xf160('0x54')]===0x0){return db[_0xf160('0x2e')]['create']({'name':_0x1229cd['name'],'resourceId':_0x1229cd['id'],'type':_0x12c22[_0xf160('0x2f')],'sectionId':_0x12c22['id']},{})[_0xf160('0x2a')](function(){return _0xf31056;});}else{return _0xf31056;}})['catch'](function(_0x12083d){logger[_0xf160('0x55')](_0xf160('0x56'),_0x12083d);throw _0x12083d;});}return _0xf31056;})['then'](respondWithResult(_0x1d5168,null))['catch'](handleError(_0x1d5168,null));};function Extension(_0x12ab32,_0x352ddb,_0x5eeab6,_0x3243c6){this[_0xf160('0x57')]='from-sip';this[_0xf160('0x58')]=_0x12ab32;this[_0xf160('0x59')]=_0x5eeab6;this[_0xf160('0x5a')]=_0xf160('0x5b');this[_0xf160('0x5c')]=_0xf160('0x5d');this['priority']=_0x352ddb;this[_0xf160('0x5e')]=_0x3243c6;}function createVoicePrefixExtensions(_0x3dc02f,_0x30f750,_0x1364bc){return new BPromise(function(_0x38ee0f,_0x5a1be3){var _0x1d22bb=new Extension(formatPrefixName(_0x3dc02f['prefix']),0x1,_0xf160('0x5f'),_0xf160('0x60'));_0x1d22bb[_0xf160('0x61')]=_0x3dc02f['id'];return db[_0xf160('0x62')][_0xf160('0x4e')](_0x1d22bb,{'transaction':_0x1364bc})[_0xf160('0x2a')](function(_0x492d5b){var _0x32ec90=_0x492d5b[_0xf160('0x2c')]({'plain':!![]});var _0x291320=_[_0xf160('0x32')](addVoicePrefixExtensions(_0x3dc02f,_0x30f750),function(_0x40e5a1){_0x40e5a1['VoiceExtensionId']=_0x32ec90['id'];_0x40e5a1['VoicePrefixId']=_0x3dc02f['id'];return _0x40e5a1;});return db[_0xf160('0x62')][_0xf160('0x63')](_0x291320,{'transaction':_0x1364bc})[_0xf160('0x2a')](function(_0x3d8c6c){if(!_0x3d8c6c){return _0x5a1be3(_0xf160('0x64'));}else{return _0x38ee0f(_0x3d8c6c);}})[_0xf160('0x49')](function(_0x4c151f){return _0x5a1be3(_0x4c151f);});});;});};function addVoicePrefixExtensions(_0x25f79e,_0x27332f){var _0x351fa9=[];var _0x352063=formatPrefixName(_0x25f79e[_0xf160('0x65')]);_0x351fa9[_0xf160('0x66')](new Extension(_0x352063,0x2,_0xf160('0x67'),_0xf160('0x68')+_0x25f79e['name']));if(_0x25f79e[_0xf160('0x69')]){_0x351fa9['push'](new Extension(_0x352063,0x3,_0xf160('0x67'),_0xf160('0x6a')+_0x25f79e[_0xf160('0x69')]));}else{_0x351fa9[_0xf160('0x66')](new Extension(_0x352063,0x3,_0xf160('0x5f'),_0xf160('0x6b')));}_0x351fa9['push'](new Extension(_0x352063,0x4,_0xf160('0x6c'),_0x27332f[_0xf160('0x57')]+','+_0xf160('0x6d')+(0x8+_0x25f79e['name'][_0xf160('0x3c')])+'}'+','+0x1));return _0x351fa9;}function formatPrefixName(_0x407a4a){var _0x4db1df='_';for(var _0x1db588=0x0;_0x1db588<_0x407a4a[_0xf160('0x3c')];_0x1db588++){if(_0x407a4a[_0xf160('0x6e')](_0x1db588)=='-'){_0x4db1df+=_0x407a4a['charAt'](_0x1db588);}else{_0x4db1df+='['+_0x407a4a[_0xf160('0x6e')](_0x1db588)+']';}}_0x4db1df+='.';return _0x4db1df;}exports[_0xf160('0x29')]=function(_0x4265e1,_0x4b9d21,_0xc78642){var _0x136919=_0x4265e1[_0xf160('0x4f')];_0x136919[_0xf160('0x65')]=_0xf160('0x6f')+_0x136919[_0xf160('0x2f')]+'-';return db[_0xf160('0x70')]['transaction'](function(_0x797ba1){return db[_0xf160('0x33')][_0xf160('0x29')](_0x136919,{'where':{'id':_0x136919['id']},'transaction':_0x797ba1})['then'](function(){return db[_0xf160('0x62')][_0xf160('0x2b')]({'where':{'VoicePrefixId':_0x136919['id']},'transaction':_0x797ba1})[_0xf160('0x2a')](function(){return db[_0xf160('0x62')][_0xf160('0x4c')]({'where':{'id':_0x136919[_0xf160('0x71')]},'raw':!![]})[_0xf160('0x2a')](function(_0x59b63c){return createVoicePrefixExtensions(_0x136919,_0x59b63c,_0x797ba1);});});});})['then'](function(){return db[_0xf160('0x33')][_0xf160('0x72')](_0x136919['id']);})[_0xf160('0x2a')](respondWithResult(_0x4b9d21,null))[_0xf160('0x49')](handleError(_0x4b9d21,null));};exports[_0xf160('0x73')]=function(_0x722f3a,_0x2f434c,_0x484b18){return db[_0xf160('0x33')][_0xf160('0x4c')]({'where':{'id':_0x722f3a['params']['id']}})['then'](handleEntityNotFound(_0x2f434c,null))[_0xf160('0x2a')](function(_0x14d69d){if(_0x14d69d){return _0x14d69d['addAgents'](_0x722f3a[_0xf160('0x4f')][_0xf160('0x74')],_['omit'](_0x722f3a[_0xf160('0x4f')],['ids','id'])||{})[_0xf160('0x75')](function(_0x355226){for(var _0x74028e=0x0;_0x74028e<_0x722f3a[_0xf160('0x4f')]['ids'][_0xf160('0x3c')];_0x74028e+=0x1){socket[_0xf160('0x76')](_0xf160('0x77'),{'UserId':Number(_0x722f3a[_0xf160('0x4f')][_0xf160('0x74')][_0x74028e]),'VoicePrefixId':Number(_0x722f3a['params']['id'])});}return _0x355226;});}})[_0xf160('0x2a')](respondWithResult(_0x2f434c,null))[_0xf160('0x49')](handleError(_0x2f434c,null));};exports[_0xf160('0x78')]=function(_0x5275b4,_0x2396f6,_0x1165f5){return db[_0xf160('0x33')][_0xf160('0x4c')]({'where':{'id':_0x5275b4[_0xf160('0x4b')]['id']}})[_0xf160('0x2a')](handleEntityNotFound(_0x2396f6,null))[_0xf160('0x2a')](function(_0x543534){if(_0x543534){return _0x543534[_0xf160('0x78')](_0x5275b4[_0xf160('0x36')][_0xf160('0x74')])[_0xf160('0x2a')](function(){if(_[_0xf160('0x79')](_0x5275b4['query'][_0xf160('0x74')])){for(var _0x3526cd=0x0;_0x3526cd<_0x5275b4[_0xf160('0x36')][_0xf160('0x74')][_0xf160('0x3c')];_0x3526cd+=0x1){socket[_0xf160('0x76')](_0xf160('0x7a'),{'UserId':Number(_0x5275b4[_0xf160('0x36')][_0xf160('0x74')][_0x3526cd]),'VoicePrefixId':Number(_0x5275b4[_0xf160('0x4b')]['id'])});}}else{socket[_0xf160('0x76')]('userVoicePrefix:remove',{'UserId':Number(_0x5275b4[_0xf160('0x36')]['ids']),'VoicePrefixId':Number(_0x5275b4[_0xf160('0x4b')]['id'])});}});}})[_0xf160('0x2a')](respondWithStatusCode(_0x2396f6,null))[_0xf160('0x49')](handleError(_0x2396f6,null));};exports[_0xf160('0x7b')]=function(_0x6ff6b1,_0x59281e,_0x3f873a){var _0x38426d={};var _0x2a992a={};var _0x185268;var _0x5927c9;return db['VoicePrefix'][_0xf160('0x7c')]({'where':{'id':_0x6ff6b1['params']['id']}})[_0xf160('0x2a')](handleEntityNotFound(_0x59281e,null))['then'](function(_0x21b93a){if(_0x21b93a){_0x185268=_0x21b93a;_0x2a992a['model']=_['keys'](db[_0xf160('0x7d')][_0xf160('0x34')]);_0x2a992a[_0xf160('0x36')]=_[_0xf160('0x37')](_0x6ff6b1[_0xf160('0x36')]);_0x2a992a[_0xf160('0x38')]=_[_0xf160('0x39')](_0x2a992a[_0xf160('0x35')],_0x2a992a[_0xf160('0x36')]);_0x38426d['attributes']=_['intersection'](_0x2a992a[_0xf160('0x35')],qs[_0xf160('0x3b')](_0x6ff6b1[_0xf160('0x36')][_0xf160('0x3b')]));_0x38426d[_0xf160('0x3a')]=_0x38426d['attributes'][_0xf160('0x3c')]?_0x38426d[_0xf160('0x3a')]:_0x2a992a[_0xf160('0x35')];_0x38426d[_0xf160('0x3d')]=qs['sort'](_0x6ff6b1['query']['sort']);_0x38426d[_0xf160('0x3f')]=qs['filters'](_[_0xf160('0x40')](_0x6ff6b1['query'],_0x2a992a[_0xf160('0x38')]));if(_0x6ff6b1[_0xf160('0x36')]['filter']){_0x38426d[_0xf160('0x3f')]=_[_0xf160('0x42')](_0x38426d[_0xf160('0x3f')],{'$or':_[_0xf160('0x32')](_0x38426d[_0xf160('0x3a')],function(_0x39ec7e){var _0x2558b8={};_0x2558b8[_0x39ec7e]={'$like':'%'+_0x6ff6b1['query']['filter']+'%'};return _0x2558b8;})});}_0x38426d=_[_0xf160('0x42')]({},_0x38426d,_0x6ff6b1[_0xf160('0x44')]);return _0x185268[_0xf160('0x7b')](_0x38426d);}})['then'](function(_0x5316c5){if(_0x5316c5){_0x5927c9=_0x5316c5[_0xf160('0x3c')];if(!_0x6ff6b1[_0xf160('0x36')][_0xf160('0x7e')](_0xf160('0x7f'))){_0x38426d[_0xf160('0x22')]=qs[_0xf160('0x22')](_0x6ff6b1[_0xf160('0x36')][_0xf160('0x22')]);_0x38426d[_0xf160('0x20')]=qs[_0xf160('0x20')](_0x6ff6b1['query'][_0xf160('0x20')]);}return _0x185268[_0xf160('0x7b')](_0x38426d);}})[_0xf160('0x2a')](function(_0x3ee8d8){if(_0x3ee8d8){return _0x3ee8d8?{'count':_0x5927c9,'rows':_0x3ee8d8}:null;}})[_0xf160('0x2a')](respondWithResult(_0x59281e,null))[_0xf160('0x49')](handleError(_0x59281e,null));};exports['getTeams']=function(_0x336560,_0x120282,_0x2b6e56){var _0x362718={};var _0xcf5dee={};var _0x2a8af4;var _0x224dcc;return db[_0xf160('0x33')]['findOne']({'where':{'id':_0x336560['params']['id']}})[_0xf160('0x2a')](handleEntityNotFound(_0x120282,null))[_0xf160('0x2a')](function(_0x55865d){if(_0x55865d){_0x2a8af4=_0x55865d;_0xcf5dee[_0xf160('0x35')]=_[_0xf160('0x37')](db[_0xf160('0x80')][_0xf160('0x34')]);_0xcf5dee[_0xf160('0x36')]=_[_0xf160('0x37')](_0x336560[_0xf160('0x36')]);_0xcf5dee[_0xf160('0x38')]=_[_0xf160('0x39')](_0xcf5dee[_0xf160('0x35')],_0xcf5dee['query']);_0x362718[_0xf160('0x3a')]=_[_0xf160('0x39')](_0xcf5dee[_0xf160('0x35')],qs[_0xf160('0x3b')](_0x336560[_0xf160('0x36')]['fields']));_0x362718[_0xf160('0x3a')]=_0x362718[_0xf160('0x3a')][_0xf160('0x3c')]?_0x362718[_0xf160('0x3a')]:_0xcf5dee['model'];_0x362718[_0xf160('0x3d')]=qs[_0xf160('0x3e')](_0x336560['query']['sort']);_0x362718['where']=qs['filters'](_['pick'](_0x336560[_0xf160('0x36')],_0xcf5dee[_0xf160('0x38')]));if(_0x336560['query']['filter']){_0x362718[_0xf160('0x3f')]=_[_0xf160('0x42')](_0x362718['where'],{'$or':_[_0xf160('0x32')](_0x362718['attributes'],function(_0x32fb34){var _0x3b1d1a={};_0x3b1d1a[_0x32fb34]={'$like':'%'+_0x336560[_0xf160('0x36')]['filter']+'%'};return _0x3b1d1a;})});}_0x362718=_[_0xf160('0x42')]({},_0x362718,_0x336560['options']);return _0x2a8af4[_0xf160('0x81')](_0x362718);}})['then'](function(_0x308dd9){if(_0x308dd9){_0x224dcc=_0x308dd9['length'];if(!_0x336560[_0xf160('0x36')]['hasOwnProperty'](_0xf160('0x7f'))){_0x362718[_0xf160('0x22')]=qs['limit'](_0x336560[_0xf160('0x36')][_0xf160('0x22')]);_0x362718['offset']=qs[_0xf160('0x20')](_0x336560[_0xf160('0x36')][_0xf160('0x20')]);}return _0x2a8af4[_0xf160('0x81')](_0x362718);}})['then'](function(_0x5cdecf){if(_0x5cdecf){return _0x5cdecf?{'count':_0x224dcc,'rows':_0x5cdecf}:null;}})[_0xf160('0x2a')](respondWithResult(_0x120282,null))[_0xf160('0x49')](handleError(_0x120282,null));};exports['addTeams']=function(_0x28b2cb,_0x24e3b5,_0x5c0dc8){var _0x182ed8=_0x28b2cb['body'][_0xf160('0x74')];var _0x2eada8;return db[_0xf160('0x80')]['findAll']({'where':{'id':_0x182ed8},'attributes':['id'],'include':[{'model':db[_0xf160('0x7d')],'as':_0xf160('0x82'),'attributes':['id',_0xf160('0x2f'),_0xf160('0x83'),_0xf160('0x84'),_0xf160('0x85')],'raw':!![]}]})[_0xf160('0x2a')](function(_0x2dbb52){if(_0x2dbb52){_0x2eada8=_0x2dbb52;var _0x5b29e0=_['flatMap'](_0x2dbb52,function(_0x2ae1dc){var _0x50912b=_0x2ae1dc['get']({'plain':!![]});return _0x50912b[_0xf160('0x82')];});return db['VoicePrefix'][_0xf160('0x4c')]({'where':{'id':_0x28b2cb[_0xf160('0x4b')]['id']}})[_0xf160('0x2a')](function(_0x26aa72){return db[_0xf160('0x70')][_0xf160('0x86')](function(_0x1bef1a){return _0x26aa72[_0xf160('0x87')](_0x182ed8,{'transaction':_0x1bef1a})[_0xf160('0x2a')](function(){return BPromise[_0xf160('0x88')](_0x2eada8,function(_0x154789){return db[_0xf160('0x89')][_0xf160('0x8a')]({'TeamId':_0x154789['id'],'VoicePrefixId':_0x28b2cb['params']['id']},{'transaction':_0x1bef1a});});})[_0xf160('0x2a')](function(){return BPromise[_0xf160('0x88')](_0x5b29e0,function(_0x3e46d1){return db[_0xf160('0x8b')][_0xf160('0x8c')]({'where':{'UserId':_0x3e46d1['id'],'VoicePrefixId':_0x28b2cb[_0xf160('0x4b')]['id']},'transaction':_0x1bef1a});});})[_0xf160('0x2a')](function(){_0x5b29e0[_0xf160('0x8d')](function(_0x3e9116){socket[_0xf160('0x76')](_0xf160('0x77'),{'UserId':_0x3e9116['id'],'VoicePrefixId':_0x26aa72['id']});});});});});}})[_0xf160('0x2a')](respondWithStatusCode(_0x24e3b5,null))[_0xf160('0x49')](handleError(_0x24e3b5,null));};exports[_0xf160('0x8e')]=function(_0x481f96,_0x4186f7,_0x37579a){return db[_0xf160('0x80')][_0xf160('0x47')]({'where':{'id':_0x481f96[_0xf160('0x36')][_0xf160('0x74')]},'attributes':['id'],'include':[{'model':db[_0xf160('0x7d')],'as':_0xf160('0x82'),'attributes':['id'],'raw':!![]}]})[_0xf160('0x2a')](handleEntityNotFound(_0x4186f7,null))[_0xf160('0x2a')](function(_0x36c1c5){var _0x4753d6=_[_0xf160('0x32')](_0x36c1c5,'id');var _0x2c486d=[];var _0x26332b=[];var _0x539056=squel['select']();_0x539056['field'](_0xf160('0x8f'))[_0xf160('0x90')](_0xf160('0x91'),'tq')[_0xf160('0x92')](_0xf160('0x93'),'ut',_0xf160('0x94'))['where'](_0xf160('0x95'),_0x481f96[_0xf160('0x4b')]['id']);for(var _0x1d308e=0x0;_0x1d308e<_0x36c1c5[_0xf160('0x3c')];_0x1d308e+=0x1){let _0x5bc8a3=_0x36c1c5[_0x1d308e];for(var _0x19dc59=0x0;_0x19dc59<_0x5bc8a3[_0xf160('0x82')][_0xf160('0x3c')];_0x19dc59+=0x1){let _0x35de2b=_0x5bc8a3[_0xf160('0x82')][_0x19dc59];var _0x446548=_0x539056[_0xf160('0x96')]();_0x446548[_0xf160('0x3f')](_0xf160('0x97'),_0x35de2b['id']);_0x26332b[_0xf160('0x66')](db[_0xf160('0x70')][_0xf160('0x36')](_0x446548[_0xf160('0x98')](),{'type':db[_0xf160('0x70')][_0xf160('0x99')][_0xf160('0x9a')]})[_0xf160('0x2a')](function(_0x258ad9){if(_0x258ad9['length']===0x1){return _0x35de2b['id'];}else{var _0x27d3ef=_['every'](_['map'](_0x258ad9,'TeamId'),function(_0x191d89){return _[_0xf160('0x9b')](_0x4753d6,_0x191d89);});if(_0x27d3ef){return _0x35de2b['id'];}}}));}}return BPromise[_0xf160('0x9c')](_0x26332b)[_0xf160('0x2a')](function(_0x2391f9){_0x2c486d=_(_0x2c486d)['union'](_0x2391f9)['compact']()[_0xf160('0x9d')]();return db[_0xf160('0x33')]['find']({'where':{'id':_0x481f96[_0xf160('0x4b')]['id']}})[_0xf160('0x2a')](function(_0x3d9b9b){return db[_0xf160('0x70')][_0xf160('0x86')](function(_0x563e5d){return _0x3d9b9b[_0xf160('0x8e')](_0x481f96['query'][_0xf160('0x74')],{'transaction':_0x563e5d})[_0xf160('0x2a')](function(){if(!_[_0xf160('0x9e')](_0x2c486d)){return _0x3d9b9b['removeAgents'](_0x2c486d,{'transaction':_0x563e5d});}})[_0xf160('0x2a')](function(){_0x2c486d[_0xf160('0x8d')](function(_0xfb5d28){socket[_0xf160('0x76')](_0xf160('0x7a'),{'UserId':_0xfb5d28,'VoicePrefixId':_0x3d9b9b['id']});});});});});});})[_0xf160('0x2a')](respondWithStatusCode(_0x4186f7,null))[_0xf160('0x49')](handleError(_0x4186f7,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index b0b889f..cee93b6 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 _0xfb2f=['VoicePrefix','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x3563e9,_0x12692e){var _0x2842a0=function(_0x3fb0e4){while(--_0x3fb0e4){_0x3563e9['push'](_0x3563e9['shift']());}};_0x2842a0(++_0x12692e);}(_0xfb2f,0x1f3));var _0xffb2=function(_0x3071d0,_0x2502d1){_0x3071d0=_0x3071d0-0x0;var _0x5e6064=_0xfb2f[_0x3071d0];return _0x5e6064;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0xffb2('0x0'))['db'][_0xffb2('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xffb2('0x2')](0x0);var events={'afterCreate':_0xffb2('0x3'),'afterUpdate':_0xffb2('0x4'),'afterDestroy':_0xffb2('0x5')};function emitEvent(_0x4062a8){return function(_0x1394ab,_0x870250,_0x3e5b47){VoicePrefixEvents[_0xffb2('0x6')](_0x4062a8+':'+_0x1394ab['id'],_0x1394ab);VoicePrefixEvents[_0xffb2('0x6')](_0x4062a8,_0x1394ab);_0x3e5b47(null);};}for(var e in events){if(events[_0xffb2('0x7')](e)){var event=events[e];VoicePrefix[_0xffb2('0x8')](e,emitEvent(event));}}module[_0xffb2('0x9')]=VoicePrefixEvents; \ No newline at end of file +var _0x1f24=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x1c7037,_0x262e8f){var _0x38f047=function(_0x20071d){while(--_0x20071d){_0x1c7037['push'](_0x1c7037['shift']());}};_0x38f047(++_0x262e8f);}(_0x1f24,0x12f));var _0x41f2=function(_0x311d01,_0x38df90){_0x311d01=_0x311d01-0x0;var _0x25aa0e=_0x1f24[_0x311d01];return _0x25aa0e;};'use strict';var EventEmitter=require(_0x41f2('0x0'));var VoicePrefix=require('../../mysqldb')['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x41f2('0x1')](0x0);var events={'afterCreate':_0x41f2('0x2'),'afterUpdate':'update','afterDestroy':_0x41f2('0x3')};function emitEvent(_0x5f54b2){return function(_0x2589f0,_0x4bde4a,_0x332055){VoicePrefixEvents[_0x41f2('0x4')](_0x5f54b2+':'+_0x2589f0['id'],_0x2589f0);VoicePrefixEvents[_0x41f2('0x4')](_0x5f54b2,_0x2589f0);_0x332055(null);};}for(var e in events){if(events[_0x41f2('0x5')](e)){var event=events[e];VoicePrefix[_0x41f2('0x6')](e,emitEvent(event));}}module[_0x41f2('0x7')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 31f45d0..1215d3d 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 _0xa754=['path','rimraf','../../config/environment','exports','define','VoicePrefix','voice_prefixes','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x21b706,_0x1022f4){var _0x13b94a=function(_0x3116da){while(--_0x3116da){_0x21b706['push'](_0x21b706['shift']());}};_0x13b94a(++_0x1022f4);}(_0xa754,0x187));var _0x4a75=function(_0x26be12,_0x338b2c){_0x26be12=_0x26be12-0x0;var _0x110b3c=_0xa754[_0x26be12];return _0x110b3c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4a75('0x0'))(_0x4a75('0x1'));var moment=require(_0x4a75('0x2'));var BPromise=require(_0x4a75('0x3'));var rp=require(_0x4a75('0x4'));var fs=require('fs');var path=require(_0x4a75('0x5'));var rimraf=require(_0x4a75('0x6'));var config=require(_0x4a75('0x7'));var attributes=require('./voicePrefix.attributes');module[_0x4a75('0x8')]=function(_0x10313c,_0x165a54){return _0x10313c[_0x4a75('0x9')](_0x4a75('0xa'),attributes,{'tableName':_0x4a75('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfead=['./voicePrefix.attributes','define','VoicePrefix','voice_prefixes','lodash','api','bluebird','request-promise','../../config/environment'];(function(_0x2c7a6f,_0xdae14e){var _0x2df660=function(_0x1a3ca3){while(--_0x1a3ca3){_0x2c7a6f['push'](_0x2c7a6f['shift']());}};_0x2df660(++_0xdae14e);}(_0xfead,0x12d));var _0xdfea=function(_0x590794,_0x4e29b5){_0x590794=_0x590794-0x0;var _0x657a79=_0xfead[_0x590794];return _0x657a79;};'use strict';var _=require(_0xdfea('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xdfea('0x1'));var moment=require('moment');var BPromise=require(_0xdfea('0x2'));var rp=require(_0xdfea('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdfea('0x4'));var attributes=require(_0xdfea('0x5'));module['exports']=function(_0x3080b8,_0x5dc4a1){return _0x3080b8[_0xdfea('0x6')](_0xdfea('0x7'),attributes,{'tableName':_0xdfea('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index eac4698..3a1d682 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 _0x5f2f=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0x2c5463,_0x5b5825){var _0x54541b=function(_0x19c247){while(--_0x19c247){_0x2c5463['push'](_0x2c5463['shift']());}};_0x54541b(++_0x5b5825);}(_0x5f2f,0x73));var _0xf5f2=function(_0x19b677,_0x39f86d){_0x19b677=_0x19b677-0x0;var _0x324f65=_0x5f2f[_0x19b677];return _0x324f65;};'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('./voicePrefix.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);});});} \ No newline at end of file +var _0x7b84=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','ioredis','../../mysqldb'];(function(_0x525d35,_0xe67489){var _0x4813d2=function(_0x4a6dc8){while(--_0x4a6dc8){_0x525d35['push'](_0x525d35['shift']());}};_0x4813d2(++_0xe67489);}(_0x7b84,0x167));var _0x47b8=function(_0x4d94ec,_0x1904ef){_0x4d94ec=_0x4d94ec-0x0;var _0x4078bc=_0x7b84[_0x4d94ec];return _0x4078bc;};'use strict';var _=require(_0x47b8('0x0'));var util=require(_0x47b8('0x1'));var moment=require(_0x47b8('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x47b8('0x3'));var db=require(_0x47b8('0x4'))['db'];var utils=require(_0x47b8('0x5'));var logger=require(_0x47b8('0x6'))(_0x47b8('0x7'));var config=require(_0x47b8('0x8'));var jayson=require(_0x47b8('0x9'));var client=jayson[_0x47b8('0xa')][_0x47b8('0xb')]({'port':0x232a});config[_0x47b8('0xc')]=_[_0x47b8('0xd')](config[_0x47b8('0xc')],{'host':_0x47b8('0xe'),'port':0x18eb});var socket=require(_0x47b8('0xf'))(new Redis(config[_0x47b8('0xc')]));require(_0x47b8('0x10'))[_0x47b8('0x11')](socket);function respondWithRpcPromise(_0x3ddbfd,_0xb3f2b8,_0x520569){return new BPromise(function(_0x5450f6,_0x245bf5){return client[_0x47b8('0x12')](_0x3ddbfd,_0x520569)[_0x47b8('0x13')](function(_0x320fdf){logger['info'](_0x47b8('0x14'),_0xb3f2b8,_0x47b8('0x15'));logger['debug'](_0x47b8('0x16'),_0xb3f2b8,_0x47b8('0x15'),JSON[_0x47b8('0x17')](_0x320fdf));if(_0x320fdf[_0x47b8('0x18')]){if(_0x320fdf[_0x47b8('0x18')]['code']===0x1f4){logger['error'](_0x47b8('0x14'),_0xb3f2b8,_0x320fdf['error'][_0x47b8('0x19')]);return _0x245bf5(_0x320fdf[_0x47b8('0x18')][_0x47b8('0x19')]);}logger[_0x47b8('0x18')](_0x47b8('0x14'),_0xb3f2b8,_0x320fdf[_0x47b8('0x18')][_0x47b8('0x19')]);return _0x5450f6(_0x320fdf[_0x47b8('0x18')][_0x47b8('0x19')]);}else{logger['info'](_0x47b8('0x14'),_0xb3f2b8,_0x47b8('0x15'));_0x5450f6(_0x320fdf[_0x47b8('0x1a')][_0x47b8('0x19')]);}})[_0x47b8('0x1b')](function(_0x593f36){logger[_0x47b8('0x18')]('VoicePrefix,\x20%s,\x20%s',_0xb3f2b8,_0x593f36);_0x245bf5(_0x593f36);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index f66c05a..e2c86dd 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 _0xb910=['length','voicePrefix:','./voicePrefix.events','save','remove','update','emit','removeListener','register'];(function(_0x2786ea,_0x16c3c3){var _0x5c38e5=function(_0x5a53c5){while(--_0x5a53c5){_0x2786ea['push'](_0x2786ea['shift']());}};_0x5c38e5(++_0x16c3c3);}(_0xb910,0x12b));var _0x0b91=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0xb910[_0x2aec52];return _0x3b8835;};'use strict';var VoicePrefixEvents=require(_0x0b91('0x0'));var events=[_0x0b91('0x1'),_0x0b91('0x2'),_0x0b91('0x3')];function createListener(_0x3e7a8b,_0x1a7acd){return function(_0x25927f){_0x1a7acd[_0x0b91('0x4')](_0x3e7a8b,_0x25927f);};}function removeListener(_0x16ba05,_0x1bfbc7){return function(){VoicePrefixEvents[_0x0b91('0x5')](_0x16ba05,_0x1bfbc7);};}exports[_0x0b91('0x6')]=function(_0x295749){for(var _0x1800dc=0x0,_0x5a22b6=events[_0x0b91('0x7')];_0x1800dc<_0x5a22b6;_0x1800dc++){var _0xc65d86=events[_0x1800dc];var _0x3e8800=createListener(_0x0b91('0x8')+_0xc65d86,_0x295749);VoicePrefixEvents['on'](_0xc65d86,_0x3e8800);}}; \ No newline at end of file +var _0x85b5=['voicePrefix:','./voicePrefix.events','save','update','removeListener','register'];(function(_0x4b6830,_0x2bf6fb){var _0x239e4a=function(_0x364735){while(--_0x364735){_0x4b6830['push'](_0x4b6830['shift']());}};_0x239e4a(++_0x2bf6fb);}(_0x85b5,0x7f));var _0x585b=function(_0x4eb805,_0x3e5d37){_0x4eb805=_0x4eb805-0x0;var _0x57658b=_0x85b5[_0x4eb805];return _0x57658b;};'use strict';var VoicePrefixEvents=require(_0x585b('0x0'));var events=[_0x585b('0x1'),'remove',_0x585b('0x2')];function createListener(_0x4a79cf,_0x18ab39){return function(_0x5a7ff0){_0x18ab39['emit'](_0x4a79cf,_0x5a7ff0);};}function removeListener(_0x331fe8,_0x4f37a9){return function(){VoicePrefixEvents[_0x585b('0x3')](_0x331fe8,_0x4f37a9);};}exports[_0x585b('0x4')]=function(_0x9ccfca){for(var _0x5b9e48=0x0,_0x1605b5=events['length'];_0x5b9e48<_0x1605b5;_0x5b9e48++){var _0x432e2d=events[_0x5b9e48];var _0x2f8895=createListener(_0x585b('0x5')+_0x432e2d,_0x9ccfca);VoicePrefixEvents['on'](_0x432e2d,_0x2f8895);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 648bd03..8702279 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 _0x6b68=['multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','get','index','/:id','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_black','getHopperBlacks','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','/:id/teams','addTeams','addAgents','addLists','addBlackLists','update','delete','removeTeams','removeAgents','removeBlackLists','exports'];(function(_0x183c87,_0x1abbb0){var _0x3cc64b=function(_0x3fff44){while(--_0x3fff44){_0x183c87['push'](_0x183c87['shift']());}};_0x3cc64b(++_0x1abbb0);}(_0x6b68,0x1e0));var _0x86b6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6b68[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x86b6('0x0'));var util=require(_0x86b6('0x1'));var path=require(_0x86b6('0x2'));var timeout=require(_0x86b6('0x3'));var express=require(_0x86b6('0x4'));var router=express['Router']();var fs_extra=require(_0x86b6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x86b6('0x6'));var config=require('../../config/environment');var controller=require('./voiceQueue.controller');router[_0x86b6('0x7')]('/',auth['isAuthenticated'](),controller[_0x86b6('0x8')]);router[_0x86b6('0x7')](_0x86b6('0x9'),auth[_0x86b6('0xa')](),controller[_0x86b6('0xb')]);router[_0x86b6('0x7')](_0x86b6('0xc'),auth[_0x86b6('0xa')](),controller[_0x86b6('0xd')]);router[_0x86b6('0x7')](_0x86b6('0xe'),auth[_0x86b6('0xa')](),controller['getHopperHistories']);router[_0x86b6('0x7')]('/:id/hopper_finals',auth[_0x86b6('0xa')](),controller['getHopperFinals']);router[_0x86b6('0x7')](_0x86b6('0xf'),auth[_0x86b6('0xa')](),controller[_0x86b6('0x10')]);router[_0x86b6('0x7')]('/:id/teams',auth[_0x86b6('0xa')](),controller['getTeams']);router[_0x86b6('0x7')](_0x86b6('0x11'),auth[_0x86b6('0xa')](),controller[_0x86b6('0x12')]);router['get'](_0x86b6('0x13'),auth[_0x86b6('0xa')](),controller[_0x86b6('0x14')]);router[_0x86b6('0x7')](_0x86b6('0x15'),auth['isAuthenticated'](),controller[_0x86b6('0x16')]);router[_0x86b6('0x7')](_0x86b6('0x17'),auth[_0x86b6('0xa')](),controller[_0x86b6('0x18')]);router[_0x86b6('0x19')]('/',auth[_0x86b6('0xa')](),controller[_0x86b6('0x1a')]);router[_0x86b6('0x19')](_0x86b6('0x1b'),auth[_0x86b6('0xa')](),controller[_0x86b6('0x1c')]);router[_0x86b6('0x19')](_0x86b6('0x1d'),auth[_0x86b6('0xa')](),controller[_0x86b6('0x1e')]);router['post']('/:id/users',auth[_0x86b6('0xa')](),controller[_0x86b6('0x1f')]);router['post'](_0x86b6('0x15'),auth[_0x86b6('0xa')](),controller[_0x86b6('0x20')]);router[_0x86b6('0x19')](_0x86b6('0x17'),auth[_0x86b6('0xa')](),controller[_0x86b6('0x21')]);router['put']('/:id',auth[_0x86b6('0xa')](),controller[_0x86b6('0x22')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x86b6('0x23')](_0x86b6('0x1d'),auth[_0x86b6('0xa')](),controller[_0x86b6('0x24')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0x86b6('0x25')]);router[_0x86b6('0x23')]('/:id/lists',auth[_0x86b6('0xa')](),controller['removeLists']);router['delete'](_0x86b6('0x17'),auth['isAuthenticated'](),controller[_0x86b6('0x26')]);module[_0x86b6('0x27')]=router; \ No newline at end of file +var _0xd2ca=['/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','/:id/teams','addTeams','addAgents','addLists','put','delete','destroy','removeTeams','removeBlackLists','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','/:id/users','getAgents','/:id/members','getMembers'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0xd2ca,0x1b4));var _0xad2c=function(_0x3dc670,_0x341d60){_0x3dc670=_0x3dc670-0x0;var _0x245003=_0xd2ca[_0x3dc670];return _0x245003;};'use strict';var multer=require(_0xad2c('0x0'));var util=require(_0xad2c('0x1'));var path=require(_0xad2c('0x2'));var timeout=require(_0xad2c('0x3'));var express=require(_0xad2c('0x4'));var router=express[_0xad2c('0x5')]();var fs_extra=require(_0xad2c('0x6'));var auth=require(_0xad2c('0x7'));var interaction=require(_0xad2c('0x8'));var config=require(_0xad2c('0x9'));var controller=require(_0xad2c('0xa'));router[_0xad2c('0xb')]('/',auth[_0xad2c('0xc')](),controller[_0xad2c('0xd')]);router[_0xad2c('0xb')](_0xad2c('0xe'),auth['isAuthenticated'](),controller[_0xad2c('0xf')]);router[_0xad2c('0xb')](_0xad2c('0x10'),auth['isAuthenticated'](),controller[_0xad2c('0x11')]);router[_0xad2c('0xb')]('/:id/hopper_histories',auth[_0xad2c('0xc')](),controller[_0xad2c('0x12')]);router[_0xad2c('0xb')](_0xad2c('0x13'),auth['isAuthenticated'](),controller[_0xad2c('0x14')]);router[_0xad2c('0xb')](_0xad2c('0x15'),auth['isAuthenticated'](),controller['getHopperBlacks']);router[_0xad2c('0xb')]('/:id/teams',auth[_0xad2c('0xc')](),controller['getTeams']);router[_0xad2c('0xb')](_0xad2c('0x16'),auth['isAuthenticated'](),controller[_0xad2c('0x17')]);router[_0xad2c('0xb')](_0xad2c('0x18'),auth[_0xad2c('0xc')](),controller[_0xad2c('0x19')]);router[_0xad2c('0xb')](_0xad2c('0x1a'),auth[_0xad2c('0xc')](),controller[_0xad2c('0x1b')]);router[_0xad2c('0xb')](_0xad2c('0x1c'),auth[_0xad2c('0xc')](),controller[_0xad2c('0x1d')]);router[_0xad2c('0x1e')]('/',auth[_0xad2c('0xc')](),controller[_0xad2c('0x1f')]);router['post'](_0xad2c('0x20'),auth[_0xad2c('0xc')](),controller['clone']);router['post'](_0xad2c('0x21'),auth['isAuthenticated'](),controller[_0xad2c('0x22')]);router['post'](_0xad2c('0x16'),auth[_0xad2c('0xc')](),controller[_0xad2c('0x23')]);router[_0xad2c('0x1e')](_0xad2c('0x1a'),auth[_0xad2c('0xc')](),controller[_0xad2c('0x24')]);router[_0xad2c('0x1e')]('/:id/blacklists',auth['isAuthenticated'](),controller['addBlackLists']);router[_0xad2c('0x25')](_0xad2c('0xe'),auth['isAuthenticated'](),controller['update']);router[_0xad2c('0x26')](_0xad2c('0xe'),auth[_0xad2c('0xc')](),controller[_0xad2c('0x27')]);router['delete'](_0xad2c('0x21'),auth[_0xad2c('0xc')](),controller[_0xad2c('0x28')]);router[_0xad2c('0x26')](_0xad2c('0x16'),auth['isAuthenticated'](),controller['removeAgents']);router['delete'](_0xad2c('0x1a'),auth['isAuthenticated'](),controller['removeLists']);router[_0xad2c('0x26')](_0xad2c('0x1c'),auth[_0xad2c('0xc')](),controller[_0xad2c('0x29')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 9cfa67b..50c6430 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 _0xfa2b=['random','linear','rrordered','setDataValue','strategy','rrmemory','getDataValue','type','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','TEXT','join','periodic_announce','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','preview','Dial\x20Method.','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','UNSIGNED','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','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\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','inbound','outbound','default','ringall','leastrecent','fewestcalls'];(function(_0x14e53d,_0x48c735){var _0x56693a=function(_0x205028){while(--_0x205028){_0x14e53d['push'](_0x14e53d['shift']());}};_0x56693a(++_0x48c735);}(_0xfa2b,0x1b7));var _0xbfa2=function(_0x5eb805,_0x3da56c){_0x5eb805=_0x5eb805-0x0;var _0x588534=_0xfa2b[_0x5eb805];return _0x588534;};'use strict';var Sequelize=require(_0xbfa2('0x0'));module[_0xbfa2('0x1')]={'name':{'type':Sequelize[_0xbfa2('0x2')],'allowNull':![],'unique':_0xbfa2('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xbfa2('0x4')](_0xbfa2('0x5'),_0xbfa2('0x6')),'allowNull':![],'defaultValue':_0xbfa2('0x5')},'musiconhold':{'type':Sequelize[_0xbfa2('0x2')],'defaultValue':_0xbfa2('0x7')},'announce':{'type':Sequelize[_0xbfa2('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0xbfa2('0x4')]('rr',_0xbfa2('0x8'),_0xbfa2('0x9'),_0xbfa2('0xa'),_0xbfa2('0xb'),'rrmemory',_0xbfa2('0xc'),'wrandom',_0xbfa2('0xd')),'allowNull':![],'defaultValue':_0xbfa2('0x8'),'set':function(_0x1b1c13){this[_0xbfa2('0xe')](_0xbfa2('0xf'),_0x1b1c13?_0x1b1c13:_0xbfa2('0x10'));},'get':function(){var _0x442810=this[_0xbfa2('0x11')](_0xbfa2('0x12'));var _0x4e0f1e=this['getDataValue']('dialMethod');var _0x1e1378=this[_0xbfa2('0x11')](_0xbfa2('0xf'));if(_0x442810===_0xbfa2('0x5')){return _0x1e1378;}if(_0x4e0f1e===_0xbfa2('0x13')&&_0x1e1378===_0xbfa2('0x10')||_0x4e0f1e==='booked'&&_0x1e1378===_0xbfa2('0x14')){return _0x1e1378;}if(_0x4e0f1e===_0xbfa2('0x15')||_0x4e0f1e===_0xbfa2('0x16')||_0x4e0f1e===_0xbfa2('0x17')){return _0x1e1378;}return null;}},'servicelevel':{'type':Sequelize[_0xbfa2('0x18')](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xbfa2('0x18')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xbfa2('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xbfa2('0x4')](_0xbfa2('0x19'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0xbfa2('0x4')](_0xbfa2('0x19'),'no',_0xbfa2('0x1a')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xbfa2('0x18')](0xb)},'autopausebusy':{'type':Sequelize[_0xbfa2('0x4')](_0xbfa2('0x19'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xbfa2('0x4')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xbfa2('0x18')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xbfa2('0x4')](_0xbfa2('0x19'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0xbfa2('0x19'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xbfa2('0x4')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xbfa2('0x4')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xbfa2('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xbfa2('0x18')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xbfa2('0x18')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xbfa2('0x18')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xbfa2('0x4')](_0xbfa2('0x19'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0xbfa2('0x4')]('yes','no',_0xbfa2('0x1b')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xbfa2('0x4')](_0xbfa2('0x19'),'no')},'announce_position_limit':{'type':Sequelize[_0xbfa2('0x18')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xbfa2('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xbfa2('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0xbfa2('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xbfa2('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xbfa2('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xbfa2('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xbfa2('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xbfa2('0x2')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0xbfa2('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0xbfa2('0x2')]},'queue_less_than':{'type':Sequelize[_0xbfa2('0x2')]},'periodic_announce':{'type':Sequelize[_0xbfa2('0x1c')],'set':function(_0x49d563){this[_0xbfa2('0xe')]('periodic_announce',_0x49d563?_0x49d563[_0xbfa2('0x1d')](','):[]);},'get':function(){return this[_0xbfa2('0x11')](_0xbfa2('0x1e'))?this['getDataValue'](_0xbfa2('0x1e'))[_0xbfa2('0x1f')](','):[];}},'joinempty':{'type':Sequelize[_0xbfa2('0x2')],'defaultValue':'yes','set':function(_0x47fd5a){this['setDataValue'](_0xbfa2('0x20'),_0x47fd5a?_0x47fd5a[_0xbfa2('0x1d')](','):undefined);},'get':function(){return this['getDataValue'](_0xbfa2('0x20'))?this[_0xbfa2('0x11')](_0xbfa2('0x20'))[_0xbfa2('0x1f')](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x2d20fe){this[_0xbfa2('0xe')]('leavewhenempty',_0x2d20fe?_0x2d20fe[_0xbfa2('0x1d')](','):undefined);},'get':function(){return this[_0xbfa2('0x11')](_0xbfa2('0x21'))?this[_0xbfa2('0x11')](_0xbfa2('0x21'))[_0xbfa2('0x1f')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xbfa2('0x4')](_0xbfa2('0x19'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xbfa2('0x4')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xbfa2('0x18')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0xbfa2('0x19'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xbfa2('0x2')]},'acw':{'type':Sequelize[_0xbfa2('0x22')],'defaultValue':0x0,'set':function(_0x1611b0){this[_0xbfa2('0xe')](_0xbfa2('0x23'),_0x1611b0);if(_0x1611b0){if(this['getDataValue'](_0xbfa2('0x24'))<0x2){this[_0xbfa2('0xe')](_0xbfa2('0x24'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xbfa2('0x18')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xbfa2('0x22')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize['ENUM'](_0xbfa2('0x25'),_0xbfa2('0x15'),_0xbfa2('0x17'),'predictive','booked'),'defaultValue':_0xbfa2('0x15'),'comment':_0xbfa2('0x26')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xbfa2('0x27')},'dialLimitQueue':{'type':Sequelize[_0xbfa2('0x18')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xbfa2('0x28')},'dialPowerLevel':{'type':Sequelize[_0xbfa2('0x29')](0x2)[_0xbfa2('0x2a')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xbfa2('0x2b')},'dialPredictiveOptimization':{'type':Sequelize[_0xbfa2('0x4')](_0xbfa2('0x2c'),_0xbfa2('0x2d')),'defaultValue':_0xbfa2('0x2d'),'comment':_0xbfa2('0x2e')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xbfa2('0x29')](0x2)[_0xbfa2('0x2a')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xbfa2('0x2f')},'dialPredictiveInterval':{'type':Sequelize[_0xbfa2('0x18')](0x3)[_0xbfa2('0x2a')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xbfa2('0x30')},'dialOriginateCallerIdName':{'type':Sequelize[_0xbfa2('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xbfa2('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xbfa2('0x2a')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbfa2('0x31')},'dialQueueOptions':{'type':Sequelize[_0xbfa2('0x2')],'defaultValue':_0xbfa2('0x32'),'comment':_0xbfa2('0x33')},'dialQueueTimeout':{'type':Sequelize[_0xbfa2('0x18')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbfa2('0x34')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0xbfa2('0x35')},'dialCongestionMaxRetry':{'type':Sequelize[_0xbfa2('0x18')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbfa2('0x36')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xbfa2('0x18')](0x5)[_0xbfa2('0x2a')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbfa2('0x37')},'dialBusyMaxRetry':{'type':Sequelize[_0xbfa2('0x18')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbfa2('0x38')},'dialBusyRetryFrequency':{'type':Sequelize[_0xbfa2('0x18')](0x5)[_0xbfa2('0x2a')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbfa2('0x39')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xbfa2('0x18')](0x3)[_0xbfa2('0x2a')],'defaultValue':0x3,'comment':_0xbfa2('0x3a')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xbfa2('0x18')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbfa2('0x3b')},'dialGlobalMaxRetry':{'type':Sequelize[_0xbfa2('0x18')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xbfa2('0x3c')},'dialTimezone':{'type':Sequelize[_0xbfa2('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xbfa2('0x2')],'defaultValue':_0xbfa2('0x3d')},'dialPrefix':{'type':Sequelize[_0xbfa2('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xbfa2('0x4')](_0xbfa2('0x3e'),_0xbfa2('0x3f'),_0xbfa2('0x40')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xbfa2('0x22')],'defaultValue':0x0,'comment':_0xbfa2('0x41')},'dialAMDInitialSilence':{'type':Sequelize[_0xbfa2('0x18')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xbfa2('0x18')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xbfa2('0x42')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xbfa2('0x18')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xbfa2('0x43')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xbfa2('0x18')](0x9)[_0xbfa2('0x2a')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xbfa2('0x18')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xbfa2('0x44')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xbfa2('0x18')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xbfa2('0x45')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xbfa2('0x2a')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xbfa2('0x18')](0x5)[_0xbfa2('0x2a')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xbfa2('0x46')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xbfa2('0x18')](0x9)[_0xbfa2('0x2a')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xbfa2('0x47')},'dialRecallInQueue':{'type':Sequelize[_0xbfa2('0x22')],'defaultValue':0x0,'comment':_0xbfa2('0x48')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xbfa2('0x49'),_0xbfa2('0x4a')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0xbfa2('0x2')],'comment':_0xbfa2('0x35')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xbfa2('0x22')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xbfa2('0x18')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0xbfa2('0x18')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xbfa2('0x4b')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xbfa2('0x18')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbfa2('0x4c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xbfa2('0x18')](0x5)[_0xbfa2('0x2a')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbfa2('0x4d')},'dialDropMaxRetry':{'type':Sequelize[_0xbfa2('0x18')](0x3)[_0xbfa2('0x2a')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbfa2('0x4e')},'dialDropRetryFrequency':{'type':Sequelize[_0xbfa2('0x18')](0x5)[_0xbfa2('0x2a')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbfa2('0x4f')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xbfa2('0x18')](0x3)[_0xbfa2('0x2a')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbfa2('0x50')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xbfa2('0x18')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbfa2('0x51')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xbfa2('0x2a')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbfa2('0x52')},'dialMachineRetryFrequency':{'type':Sequelize[_0xbfa2('0x18')](0x5)[_0xbfa2('0x2a')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbfa2('0x53')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xbfa2('0x18')](0x3)[_0xbfa2('0x2a')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbfa2('0x54')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xbfa2('0x18')](0x5)[_0xbfa2('0x2a')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbfa2('0x55')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0xbfa2('0x56')},'mandatoryDisposition':{'type':Sequelize[_0xbfa2('0x22')],'defaultValue':![],'comment':_0xbfa2('0x57'),'set':function(_0x26ff5e){if(!_0x26ff5e)this['setDataValue'](_0xbfa2('0x58'),null);this[_0xbfa2('0xe')](_0xbfa2('0x59'),_0x26ff5e);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xbfa2('0x18')](0x3)[_0xbfa2('0x2a')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xbfa2('0x2a')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file +var _0xcdc2=['#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','sequelize','STRING','ENUM','outbound','inbound','ringall','fewestcalls','random','linear','wrandom','rrordered','setDataValue','strategy','rrmemory','getDataValue','type','dialMethod','booked','roundrobin','progressive','predictive','INTEGER','yes','all','once','periodic_announce','joinempty','split','leavewhenempty','join','BOOLEAN','wrapuptime','preview','power','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xcdc2,0xae));var _0x2cdc=function(_0x527016,_0x5a00e9){_0x527016=_0x527016-0x0;var _0x45fb66=_0xcdc2[_0x527016];return _0x45fb66;};'use strict';var Sequelize=require(_0x2cdc('0x0'));module['exports']={'name':{'type':Sequelize[_0x2cdc('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x2cdc('0x2')]('inbound',_0x2cdc('0x3')),'allowNull':![],'defaultValue':_0x2cdc('0x4')},'musiconhold':{'type':Sequelize[_0x2cdc('0x1')],'defaultValue':'default'},'announce':{'type':Sequelize[_0x2cdc('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0x2cdc('0x2')]('rr',_0x2cdc('0x5'),'leastrecent',_0x2cdc('0x6'),_0x2cdc('0x7'),'rrmemory',_0x2cdc('0x8'),_0x2cdc('0x9'),_0x2cdc('0xa')),'allowNull':![],'defaultValue':'ringall','set':function(_0x46de33){this[_0x2cdc('0xb')](_0x2cdc('0xc'),_0x46de33?_0x46de33:_0x2cdc('0xd'));},'get':function(){var _0x42dbd7=this[_0x2cdc('0xe')](_0x2cdc('0xf'));var _0x1ff8d9=this[_0x2cdc('0xe')](_0x2cdc('0x10'));var _0x396ee0=this[_0x2cdc('0xe')]('strategy');if(_0x42dbd7===_0x2cdc('0x4')){return _0x396ee0;}if(_0x1ff8d9===_0x2cdc('0x11')&&_0x396ee0===_0x2cdc('0xd')||_0x1ff8d9===_0x2cdc('0x11')&&_0x396ee0===_0x2cdc('0x12')){return _0x396ee0;}if(_0x1ff8d9===_0x2cdc('0x13')||_0x1ff8d9===_0x2cdc('0x14')||_0x1ff8d9==='power'){return _0x396ee0;}return null;}},'servicelevel':{'type':Sequelize[_0x2cdc('0x15')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x2cdc('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x2cdc('0x15')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x2cdc('0x15')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x2cdc('0x1')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x2cdc('0x15')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x2cdc('0x2')](_0x2cdc('0x16'),'no'),'defaultValue':_0x2cdc('0x16')},'autopause':{'type':Sequelize[_0x2cdc('0x2')](_0x2cdc('0x16'),'no',_0x2cdc('0x17')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0x2cdc('0x2')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x2cdc('0x2')](_0x2cdc('0x16'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x2cdc('0x2')](_0x2cdc('0x16'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x2cdc('0x2')](_0x2cdc('0x16'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x2cdc('0x2')](_0x2cdc('0x16'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x2cdc('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x2cdc('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x2cdc('0x15')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x2cdc('0x15')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x2cdc('0x2')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0x2cdc('0x2')]('yes','no',_0x2cdc('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x2cdc('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x2cdc('0x2')](_0x2cdc('0x16'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x2cdc('0x2')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x2cdc('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x2cdc('0x1')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x2cdc('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x2cdc('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x2cdc('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x2cdc('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x2cdc('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x2cdc('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x2cdc('0x1')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0x2cdc('0x1')]},'queue_less_than':{'type':Sequelize[_0x2cdc('0x1')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x3c99c3){this[_0x2cdc('0xb')](_0x2cdc('0x19'),_0x3c99c3?_0x3c99c3['join'](','):[]);},'get':function(){return this['getDataValue'](_0x2cdc('0x19'))?this[_0x2cdc('0xe')](_0x2cdc('0x19'))['split'](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0x2cdc('0x16'),'set':function(_0x6f4066){this[_0x2cdc('0xb')](_0x2cdc('0x1a'),_0x6f4066?_0x6f4066['join'](','):undefined);},'get':function(){return this[_0x2cdc('0xe')](_0x2cdc('0x1a'))?this['getDataValue'](_0x2cdc('0x1a'))[_0x2cdc('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x2cdc('0x1')],'defaultValue':'no','set':function(_0x1bb9a3){this[_0x2cdc('0xb')](_0x2cdc('0x1c'),_0x1bb9a3?_0x1bb9a3[_0x2cdc('0x1d')](','):undefined);},'get':function(){return this[_0x2cdc('0xe')](_0x2cdc('0x1c'))?this[_0x2cdc('0xe')](_0x2cdc('0x1c'))[_0x2cdc('0x1b')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0x2cdc('0x16'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x2cdc('0x16'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x2cdc('0x15')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x2cdc('0x2')](_0x2cdc('0x16'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0x2cdc('0x1e')],'defaultValue':0x0,'set':function(_0x425257){this['setDataValue']('acw',_0x425257);if(_0x425257){if(this[_0x2cdc('0xe')](_0x2cdc('0x1f'))<0x2){this[_0x2cdc('0xb')](_0x2cdc('0x1f'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x2cdc('0x15')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0x2cdc('0x2')](_0x2cdc('0x20'),_0x2cdc('0x13'),_0x2cdc('0x21'),_0x2cdc('0x14'),'booked'),'defaultValue':'progressive','comment':_0x2cdc('0x22')},'dialLimitChannel':{'type':Sequelize[_0x2cdc('0x15')](0x4)[_0x2cdc('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x2cdc('0x24')},'dialLimitQueue':{'type':Sequelize[_0x2cdc('0x15')](0x4)[_0x2cdc('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x2cdc('0x25')},'dialPowerLevel':{'type':Sequelize[_0x2cdc('0x26')](0x2)[_0x2cdc('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x2cdc('0x27')},'dialPredictiveOptimization':{'type':Sequelize[_0x2cdc('0x2')](_0x2cdc('0x28'),_0x2cdc('0x29')),'defaultValue':_0x2cdc('0x29'),'comment':_0x2cdc('0x2a')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x2cdc('0x26')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x2cdc('0x2b')},'dialPredictiveInterval':{'type':Sequelize[_0x2cdc('0x15')](0x3)[_0x2cdc('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x2cdc('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x2cdc('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x2cdc('0x15')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2cdc('0x2c')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0x2cdc('0x2d'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0x2cdc('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2cdc('0x2e')},'dialQueueProject':{'type':Sequelize[_0x2cdc('0x1')],'comment':_0x2cdc('0x2f')},'dialCongestionMaxRetry':{'type':Sequelize[_0x2cdc('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2cdc('0x30')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x2cdc('0x15')](0x5)[_0x2cdc('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2cdc('0x31')},'dialBusyMaxRetry':{'type':Sequelize[_0x2cdc('0x15')](0x3)[_0x2cdc('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2cdc('0x32')},'dialBusyRetryFrequency':{'type':Sequelize[_0x2cdc('0x15')](0x5)[_0x2cdc('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x2cdc('0x15')](0x3)[_0x2cdc('0x23')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x2cdc('0x15')](0x5)[_0x2cdc('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x2cdc('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x2cdc('0x33')},'dialTimezone':{'type':Sequelize[_0x2cdc('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x2cdc('0x1')],'defaultValue':_0x2cdc('0x34')},'dialPrefix':{'type':Sequelize[_0x2cdc('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x2cdc('0x2')]('always',_0x2cdc('0x35'),_0x2cdc('0x36')),'defaultValue':_0x2cdc('0x37')},'dialAMDActive':{'type':Sequelize[_0x2cdc('0x1e')],'defaultValue':0x0,'comment':_0x2cdc('0x38')},'dialAMDInitialSilence':{'type':Sequelize[_0x2cdc('0x15')](0x9)[_0x2cdc('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x2cdc('0x39')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x2cdc('0x3a')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x2cdc('0x15')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x2cdc('0x15')](0x9)[_0x2cdc('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x2cdc('0x3b')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x2cdc('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x2cdc('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x2cdc('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x2cdc('0x15')](0x9)[_0x2cdc('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x2cdc('0x3d')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x2cdc('0x15')](0x5)[_0x2cdc('0x23')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x2cdc('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x2cdc('0x3e')},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)[_0x2cdc('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x2cdc('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0x2cdc('0x1e')],'defaultValue':0x0,'comment':_0x2cdc('0x40')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x2cdc('0x41'),_0x2cdc('0x42')),'defaultValue':_0x2cdc('0x41')},'dialQueueProject2':{'type':Sequelize[_0x2cdc('0x1')],'comment':_0x2cdc('0x2f')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x2cdc('0x1e')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x2cdc('0x15')](0x3)[_0x2cdc('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x2cdc('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x2cdc('0x43')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x2cdc('0x15')](0x3)[_0x2cdc('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x2cdc('0x15')](0x5)[_0x2cdc('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2cdc('0x44')},'dialDropMaxRetry':{'type':Sequelize[_0x2cdc('0x15')](0x3)[_0x2cdc('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x2cdc('0x15')](0x5)[_0x2cdc('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2cdc('0x45')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x2cdc('0x15')](0x3)[_0x2cdc('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2cdc('0x46')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x2cdc('0x15')](0x5)[_0x2cdc('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2cdc('0x47')},'dialMachineMaxRetry':{'type':Sequelize[_0x2cdc('0x15')](0x3)[_0x2cdc('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2cdc('0x48')},'dialMachineRetryFrequency':{'type':Sequelize[_0x2cdc('0x15')](0x5)[_0x2cdc('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2cdc('0x49')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x2cdc('0x15')](0x3)[_0x2cdc('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2cdc('0x4a')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x2cdc('0x15')](0x5)[_0x2cdc('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2cdc('0x4b')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0x2cdc('0x4c')},'mandatoryDisposition':{'type':Sequelize[_0x2cdc('0x1e')],'defaultValue':![],'comment':_0x2cdc('0x4d'),'set':function(_0x56eb18){if(!_0x56eb18)this[_0x2cdc('0xb')](_0x2cdc('0x4e'),null);this['setDataValue']('mandatoryDisposition',_0x56eb18);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x2cdc('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x2cdc('0x15')](0x3)[_0x2cdc('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 9de5e65..1f58af9 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 _0xc686=['lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','filter','ignore','map','value','find','type','name','UserProfileResource','send','index','VoiceQueue','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','merge','VIRTUAL','where','includeAll','include','rows','catch','show','params','create','body','role','userProfileId','error','clone','keys','rawAttributes','options','createdAt','updatedAt','omit','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','outbound','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','CmHopper','pick','VoiceQueueId','findAll','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','getTeams','Team','teams','User','Agents','online','voicePause','interface','forEach','penalty','transaction','TeamVoiceQueue','upsert','each','UserVoiceQueueRt','format','SIP/%s','emit','userVoiceQueue:save','ids','select','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','TeamId','includes','union','removeTeams','removeAgents','userVoiceQueue:remove','addAgents','isEmpty','all','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','phone','field','CmListId','toString','NOW()','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','cm_hopper_final','COALESCE(phone,\x27\x27)','insert','removeLists','getBlackLists','addBlackLists','spread','cm_hopper_black','removeBlackLists','eml-format','rimraf','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra'];(function(_0xc4f4b7,_0x4860a8){var _0x488cd7=function(_0x2b121b){while(--_0x2b121b){_0xc4f4b7['push'](_0xc4f4b7['shift']());}};_0x488cd7(++_0x4860a8);}(_0xc686,0x15a));var _0x6c68=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xc686[_0x433a86];return _0x23000c;};'use strict';var emlformat=require(_0x6c68('0x0'));var rimraf=require(_0x6c68('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6c68('0x2'));var moment=require(_0x6c68('0x3'));var BPromise=require(_0x6c68('0x4'));var Mustache=require('mustache');var util=require(_0x6c68('0x5'));var path=require('path');var sox=require(_0x6c68('0x6'));var csv=require(_0x6c68('0x7'));var ejs=require(_0x6c68('0x8'));var fs=require('fs');var fs_extra=require(_0x6c68('0x9'));var _=require(_0x6c68('0xa'));var squel=require(_0x6c68('0xb'));var crypto=require('crypto');var jsforce=require(_0x6c68('0xc'));var deskjs=require(_0x6c68('0xd'));var toCsv=require(_0x6c68('0x7'));var querystring=require(_0x6c68('0xe'));var Papa=require(_0x6c68('0xf'));var Redis=require(_0x6c68('0x10'));var authService=require(_0x6c68('0x11'));var qs=require(_0x6c68('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6c68('0x13'));var logger=require(_0x6c68('0x14'))(_0x6c68('0x15'));var utils=require(_0x6c68('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x6c68('0x17')]=_[_0x6c68('0x18')](config[_0x6c68('0x17')],{'host':_0x6c68('0x19'),'port':0x18eb});var socket=require(_0x6c68('0x1a'))(new Redis(config[_0x6c68('0x17')]));require('./voiceQueue.socket')['register'](socket);function respondWithStatusCode(_0x4feac0,_0x14b3a9){_0x14b3a9=_0x14b3a9||0xcc;return function(_0x2cd1c0){if(_0x2cd1c0){return _0x4feac0[_0x6c68('0x1b')](_0x14b3a9);}return _0x4feac0[_0x6c68('0x1c')](_0x14b3a9)[_0x6c68('0x1d')]();};}function respondWithResult(_0x4fd7e7,_0x360a6c){_0x360a6c=_0x360a6c||0xc8;return function(_0x414979){if(_0x414979){return _0x4fd7e7[_0x6c68('0x1c')](_0x360a6c)[_0x6c68('0x1e')](_0x414979);}};}function respondWithFilteredResult(_0x4d1708,_0x2e2c1e){return function(_0x2ad46f){if(_0x2ad46f){var _0xf19cc0=typeof _0x2e2c1e['offset']===_0x6c68('0x1f')&&typeof _0x2e2c1e[_0x6c68('0x20')]===_0x6c68('0x1f');var _0x52d44b=_0x2ad46f[_0x6c68('0x21')];var _0x124457=_0xf19cc0?0x0:_0x2e2c1e[_0x6c68('0x22')];var _0x3dc27f=_0xf19cc0?_0x2ad46f[_0x6c68('0x21')]:_0x2e2c1e[_0x6c68('0x22')]+_0x2e2c1e[_0x6c68('0x20')];var _0x773614;if(_0x3dc27f>=_0x52d44b){_0x3dc27f=_0x52d44b;_0x773614=0xc8;}else{_0x773614=0xce;}_0x4d1708[_0x6c68('0x1c')](_0x773614);return _0x4d1708[_0x6c68('0x23')]('Content-Range',_0x124457+'-'+_0x3dc27f+'/'+_0x52d44b)['json'](_0x2ad46f);}return null;};}function patchUpdates(_0x445b64){return function(_0x110a16){try{jsonpatch[_0x6c68('0x24')](_0x110a16,_0x445b64,!![]);}catch(_0x10a59c){return BPromise[_0x6c68('0x25')](_0x10a59c);}return _0x110a16['save']();};}function saveUpdates(_0x25d658,_0x1dac82){return function(_0x342df7){if(_0x342df7){return _0x342df7[_0x6c68('0x26')](_0x25d658)[_0x6c68('0x27')](function(_0x421377){return _0x421377;});}return null;};}function removeEntity(_0x33f666,_0x5f0ee5){return function(_0x3fe509){if(_0x3fe509){return _0x3fe509[_0x6c68('0x28')]()[_0x6c68('0x27')](function(){var _0x48c08e=_0x3fe509[_0x6c68('0x29')]({'plain':!![]});var _0x51d00e=[{'name':_0x6c68('0x2a'),'value':_0x6c68('0x2b'),'ignore':![]},{'name':_0x6c68('0x2c'),'value':'outbound','ignore':![]}];var _0x4782ff=_(_0x51d00e)[_0x6c68('0x2d')](_0x6c68('0x2e'))[_0x6c68('0x2f')](_0x6c68('0x30'))['value']();if(_['includes'](_0x4782ff,_0x48c08e['type'])){return;}var _0x183c80=_[_0x6c68('0x31')](_0x51d00e,['value',_0x48c08e[_0x6c68('0x32')]])[_0x6c68('0x33')];return db[_0x6c68('0x34')][_0x6c68('0x28')]({'where':{'type':_0x183c80,'resourceId':_0x48c08e['id']}})[_0x6c68('0x27')](function(){return _0x3fe509;});})[_0x6c68('0x27')](function(){_0x33f666[_0x6c68('0x1c')](0xcc)[_0x6c68('0x1d')]();});}};}function handleEntityNotFound(_0x573a24,_0x4bb835){return function(_0x37ab70){if(!_0x37ab70){_0x573a24[_0x6c68('0x1b')](0x194);}return _0x37ab70;};}function handleError(_0x35d417,_0x4fe8dc){_0x4fe8dc=_0x4fe8dc||0x1f4;return function(_0x2b8c6e){logger['error'](_0x2b8c6e['stack']);if(_0x2b8c6e['name']){delete _0x2b8c6e['name'];}_0x35d417[_0x6c68('0x1c')](_0x4fe8dc)[_0x6c68('0x35')](_0x2b8c6e);};}exports[_0x6c68('0x36')]=function(_0xbd382c,_0x576f2b){var _0x420b15={},_0x3b868c={},_0xfbd70b={'count':0x0,'rows':[]};var _0x21209d=_[_0x6c68('0x2f')](db[_0x6c68('0x37')]['rawAttributes'],function(_0xc7f559){return{'name':_0xc7f559[_0x6c68('0x38')],'type':_0xc7f559[_0x6c68('0x32')][_0x6c68('0x39')]};});_0x3b868c[_0x6c68('0x3a')]=_['map'](_0x21209d,'name');_0x3b868c[_0x6c68('0x3b')]=_['keys'](_0xbd382c[_0x6c68('0x3b')]);_0x3b868c[_0x6c68('0x3c')]=_['intersection'](_0x3b868c[_0x6c68('0x3a')],_0x3b868c[_0x6c68('0x3b')]);_0x420b15['attributes']=_[_0x6c68('0x3d')](_0x3b868c[_0x6c68('0x3a')],qs[_0x6c68('0x3e')](_0xbd382c['query'][_0x6c68('0x3e')]));_0x420b15['attributes']=_0x420b15[_0x6c68('0x3f')][_0x6c68('0x40')]?_0x420b15['attributes']:_0x3b868c[_0x6c68('0x3a')];if(!_0xbd382c[_0x6c68('0x3b')][_0x6c68('0x41')](_0x6c68('0x42'))){_0x420b15[_0x6c68('0x20')]=qs[_0x6c68('0x20')](_0xbd382c[_0x6c68('0x3b')][_0x6c68('0x20')]);_0x420b15[_0x6c68('0x22')]=qs['offset'](_0xbd382c[_0x6c68('0x3b')][_0x6c68('0x22')]);}_0x420b15[_0x6c68('0x43')]=qs[_0x6c68('0x44')](_0xbd382c['query']['sort']);_0x420b15['where']=qs[_0x6c68('0x3c')](_['pick'](_0xbd382c[_0x6c68('0x3b')],_0x3b868c[_0x6c68('0x3c')]),_0x21209d);if(_0xbd382c[_0x6c68('0x3b')]['filter']){_0x420b15['where']=_[_0x6c68('0x45')](_0x420b15['where'],{'$or':_[_0x6c68('0x2f')](_0x21209d,function(_0x19d728){if(_0x19d728[_0x6c68('0x32')]!==_0x6c68('0x46')){var _0x3883b3={};_0x3883b3[_0x19d728[_0x6c68('0x33')]]={'$like':'%'+_0xbd382c[_0x6c68('0x3b')]['filter']+'%'};return _0x3883b3;}})});}_0x420b15=_['merge']({},_0x420b15,_0xbd382c['options']);var _0x16695b={'where':_0x420b15[_0x6c68('0x47')]};return db[_0x6c68('0x37')][_0x6c68('0x21')](_0x16695b)[_0x6c68('0x27')](function(_0x44c8cc){_0xfbd70b[_0x6c68('0x21')]=_0x44c8cc;if(_0xbd382c[_0x6c68('0x3b')][_0x6c68('0x48')]){_0x420b15[_0x6c68('0x49')]=[{'all':!![]}];}return db[_0x6c68('0x37')]['findAll'](_0x420b15);})[_0x6c68('0x27')](function(_0x12dcd9){_0xfbd70b[_0x6c68('0x4a')]=_0x12dcd9;return _0xfbd70b;})[_0x6c68('0x27')](respondWithFilteredResult(_0x576f2b,_0x420b15))[_0x6c68('0x4b')](handleError(_0x576f2b,null));};exports[_0x6c68('0x4c')]=function(_0x488040,_0x57f53){var _0x222681={'raw':![],'where':{'id':_0x488040[_0x6c68('0x4d')]['id']}},_0x386d1f={};_0x386d1f[_0x6c68('0x3a')]=_['keys'](db[_0x6c68('0x37')]['rawAttributes']);_0x386d1f['query']=_['keys'](_0x488040[_0x6c68('0x3b')]);_0x386d1f[_0x6c68('0x3c')]=_['intersection'](_0x386d1f[_0x6c68('0x3a')],_0x386d1f['query']);_0x222681[_0x6c68('0x3f')]=_['intersection'](_0x386d1f[_0x6c68('0x3a')],qs[_0x6c68('0x3e')](_0x488040[_0x6c68('0x3b')]['fields']));_0x222681[_0x6c68('0x3f')]=_0x222681['attributes']['length']?_0x222681['attributes']:_0x386d1f[_0x6c68('0x3a')];if(_0x488040[_0x6c68('0x3b')]['includeAll']){_0x222681['include']=[{'all':!![]}];}_0x222681=_[_0x6c68('0x45')]({},_0x222681,_0x488040['options']);return db['VoiceQueue'][_0x6c68('0x31')](_0x222681)['then'](handleEntityNotFound(_0x57f53,null))['then'](respondWithResult(_0x57f53,null))[_0x6c68('0x4b')](handleError(_0x57f53,null));};exports['create']=function(_0x2057c7,_0x50ac05){return db['VoiceQueue'][_0x6c68('0x4e')](_0x2057c7[_0x6c68('0x4f')],{})[_0x6c68('0x27')](function(_0x1ea9de){var _0x18d5f1=_0x2057c7['user'][_0x6c68('0x29')]({'plain':!![]});if(!_0x18d5f1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x18d5f1[_0x6c68('0x50')]==='user'){var _0x19b821=_0x1ea9de[_0x6c68('0x29')]({'plain':!![]});var _0x4832c0=[{'name':_0x6c68('0x2a'),'value':'inbound'},{'name':_0x6c68('0x2c'),'value':'outbound'}];var _0x134be4=_[_0x6c68('0x31')](_0x4832c0,['value',_0x19b821['type']])[_0x6c68('0x33')];return db['UserProfileSection'][_0x6c68('0x31')]({'where':{'name':_0x134be4,'userProfileId':_0x18d5f1[_0x6c68('0x51')]},'raw':!![]})[_0x6c68('0x27')](function(_0x364bb1){if(_0x364bb1&&_0x364bb1['autoAssociation']===0x0){return db[_0x6c68('0x34')][_0x6c68('0x4e')]({'name':_0x19b821[_0x6c68('0x33')],'resourceId':_0x19b821['id'],'type':_0x364bb1['name'],'sectionId':_0x364bb1['id']},{})[_0x6c68('0x27')](function(){return _0x1ea9de;});}else{return _0x1ea9de;}})[_0x6c68('0x4b')](function(_0x1ccdd6){logger[_0x6c68('0x52')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1ccdd6);throw _0x1ccdd6;});}return _0x1ea9de;})[_0x6c68('0x27')](respondWithResult(_0x50ac05,0xc9))[_0x6c68('0x4b')](handleError(_0x50ac05,null));};exports[_0x6c68('0x53')]=function(_0x4b2dab,_0x2a663b){var _0x1a0228={'where':{'id':_0x4b2dab[_0x6c68('0x4d')]['id']}},_0x4567b3={};_0x4567b3[_0x6c68('0x3a')]=_[_0x6c68('0x54')](db[_0x6c68('0x37')][_0x6c68('0x55')]);_0x1a0228[_0x6c68('0x3f')]=_[_0x6c68('0x3d')](_0x4567b3[_0x6c68('0x3a')],qs['fields'](_0x4b2dab[_0x6c68('0x3b')][_0x6c68('0x3e')]));_0x1a0228[_0x6c68('0x3f')]=_0x1a0228['attributes']['length']?_0x1a0228[_0x6c68('0x3f')]:_0x4567b3[_0x6c68('0x3a')];if(_0x4b2dab[_0x6c68('0x3b')][_0x6c68('0x48')]){_0x1a0228[_0x6c68('0x49')]=[{'all':!![]}];}_0x1a0228=_[_0x6c68('0x45')]({},_0x1a0228,_0x4b2dab[_0x6c68('0x56')]);return db[_0x6c68('0x37')][_0x6c68('0x31')](_0x1a0228)[_0x6c68('0x27')](handleEntityNotFound(_0x2a663b,null))['then'](function(_0x4f17b9){if(_0x4f17b9){var _0x307975=_0x4f17b9[_0x6c68('0x29')]({'plain':!![]});_0x307975=qs['omit'](_0x307975,['id',_0x6c68('0x57'),_0x6c68('0x58')]);_0x4b2dab[_0x6c68('0x4f')]=_[_0x6c68('0x59')](_0x4b2dab[_0x6c68('0x4f')],['id','createdAt',_0x6c68('0x58')]);return db[_0x6c68('0x37')]['create'](_[_0x6c68('0x45')](_0x307975,_0x4b2dab[_0x6c68('0x4f')]),{'include':_0x4b2dab[_0x6c68('0x3b')][_0x6c68('0x48')]?[{'all':!![]}]:undefined})[_0x6c68('0x27')](function(_0x2310d2){var _0x12a943=_0x4b2dab[_0x6c68('0x5a')][_0x6c68('0x29')]({'plain':!![]});if(!_0x12a943)throw new Error(_0x6c68('0x5b'));if(_0x12a943[_0x6c68('0x50')]===_0x6c68('0x5a')){var _0x5a66e0=_0x2310d2[_0x6c68('0x29')]({'plain':!![]});var _0x2fb10c=[{'name':_0x6c68('0x2a'),'value':'inbound'},{'name':_0x6c68('0x2c'),'value':_0x6c68('0x5c')}];var _0x1fba28=_[_0x6c68('0x31')](_0x2fb10c,['value',_0x5a66e0[_0x6c68('0x32')]])[_0x6c68('0x33')];return db[_0x6c68('0x5d')][_0x6c68('0x31')]({'where':{'name':_0x1fba28,'userProfileId':_0x12a943[_0x6c68('0x51')]},'raw':!![]})[_0x6c68('0x27')](function(_0x3230e0){if(_0x3230e0&&_0x3230e0['autoAssociation']===0x0){return db[_0x6c68('0x34')][_0x6c68('0x4e')]({'name':_0x5a66e0[_0x6c68('0x33')],'resourceId':_0x5a66e0['id'],'type':_0x3230e0['name'],'sectionId':_0x3230e0['id']},{})[_0x6c68('0x27')](function(){return _0x2310d2;});}else{return _0x2310d2;}})[_0x6c68('0x4b')](function(_0x1d5f46){logger['error'](_0x6c68('0x5e'),_0x1d5f46);throw _0x1d5f46;});}return _0x2310d2;});}})[_0x6c68('0x27')](respondWithResult(_0x2a663b,0xc9))[_0x6c68('0x4b')](handleError(_0x2a663b,null));};exports[_0x6c68('0x26')]=function(_0x4db3a8,_0x389715){if(_0x4db3a8[_0x6c68('0x4f')]['id']){delete _0x4db3a8[_0x6c68('0x4f')]['id'];}return db[_0x6c68('0x37')]['find']({'where':{'id':_0x4db3a8['params']['id']}})['then'](handleEntityNotFound(_0x389715,null))[_0x6c68('0x27')](saveUpdates(_0x4db3a8[_0x6c68('0x4f')],null))['then'](respondWithResult(_0x389715,null))['catch'](handleError(_0x389715,null));};exports[_0x6c68('0x28')]=function(_0x33d38f,_0x59e6e7){return db[_0x6c68('0x37')]['find']({'where':{'id':_0x33d38f[_0x6c68('0x4d')]['id']}})[_0x6c68('0x27')](handleEntityNotFound(_0x59e6e7,null))['then'](removeEntity(_0x59e6e7,null))['catch'](handleError(_0x59e6e7,null));};exports['getHoppers']=function(_0x45fc2f,_0x135926,_0x2f6cbc){var _0x316ea0={'raw':![],'where':{}};var _0x17d31e={};var _0x547f25={'count':0x0,'rows':[]};return db[_0x6c68('0x37')][_0x6c68('0x5f')]({'where':{'id':_0x45fc2f['params']['id']}})[_0x6c68('0x27')](handleEntityNotFound(_0x135926,null))[_0x6c68('0x27')](function(_0x3e33bc){if(_0x3e33bc){_0x17d31e['model']=_[_0x6c68('0x54')](db[_0x6c68('0x60')]['rawAttributes']);_0x17d31e['query']=_[_0x6c68('0x54')](_0x45fc2f[_0x6c68('0x3b')]);_0x17d31e[_0x6c68('0x3c')]=_[_0x6c68('0x3d')](_0x17d31e[_0x6c68('0x3a')],_0x17d31e[_0x6c68('0x3b')]);_0x316ea0[_0x6c68('0x3f')]=_[_0x6c68('0x3d')](_0x17d31e['model'],qs[_0x6c68('0x3e')](_0x45fc2f[_0x6c68('0x3b')][_0x6c68('0x3e')]));_0x316ea0[_0x6c68('0x3f')]=_0x316ea0['attributes']['length']?_0x316ea0[_0x6c68('0x3f')]:_0x17d31e[_0x6c68('0x3a')];if(!_0x45fc2f[_0x6c68('0x3b')][_0x6c68('0x41')](_0x6c68('0x42'))){_0x316ea0[_0x6c68('0x20')]=qs[_0x6c68('0x20')](_0x45fc2f[_0x6c68('0x3b')][_0x6c68('0x20')]);_0x316ea0['offset']=qs[_0x6c68('0x22')](_0x45fc2f['query'][_0x6c68('0x22')]);}_0x316ea0[_0x6c68('0x43')]=qs[_0x6c68('0x44')](_0x45fc2f[_0x6c68('0x3b')][_0x6c68('0x44')]);_0x316ea0['where']=qs[_0x6c68('0x3c')](_[_0x6c68('0x61')](_0x45fc2f[_0x6c68('0x3b')],_0x17d31e[_0x6c68('0x3c')]));_0x316ea0['where'][_0x6c68('0x62')]=_0x3e33bc['id'];if(_0x45fc2f['query'][_0x6c68('0x2d')]){_0x316ea0['where']=_[_0x6c68('0x45')](_0x316ea0['where'],{'$or':_['map'](_0x316ea0[_0x6c68('0x3f')],function(_0x4f6c65){var _0x3aa851={};_0x3aa851[_0x4f6c65]={'$like':'%'+_0x45fc2f[_0x6c68('0x3b')][_0x6c68('0x2d')]+'%'};return _0x3aa851;})});}_0x316ea0=_[_0x6c68('0x45')]({},_0x316ea0,_0x45fc2f['options']);return db['CmHopper'][_0x6c68('0x21')]({'where':_0x316ea0[_0x6c68('0x47')]})['then'](function(_0x1be706){_0x547f25[_0x6c68('0x21')]=_0x1be706;if(_0x45fc2f[_0x6c68('0x3b')][_0x6c68('0x48')]){_0x316ea0['include']=[{'all':!![]}];}return db[_0x6c68('0x60')][_0x6c68('0x63')](_0x316ea0);})[_0x6c68('0x27')](function(_0x820773){_0x547f25[_0x6c68('0x4a')]=_0x820773;return _0x547f25;});}})['then'](respondWithFilteredResult(_0x135926,_0x316ea0))[_0x6c68('0x4b')](handleError(_0x135926,null));};exports[_0x6c68('0x64')]=function(_0x55637f,_0x45249f,_0x1786ed){var _0x55f5b3={'raw':!![],'where':{}};var _0x2860f1={};var _0x469e09={'count':0x0,'rows':[]};return db[_0x6c68('0x37')][_0x6c68('0x5f')]({'where':{'id':_0x55637f[_0x6c68('0x4d')]['id']}})[_0x6c68('0x27')](handleEntityNotFound(_0x45249f,null))[_0x6c68('0x27')](function(_0xc5e9e8){if(_0xc5e9e8){_0x2860f1[_0x6c68('0x3a')]=_[_0x6c68('0x54')](db[_0x6c68('0x65')][_0x6c68('0x55')]);_0x2860f1[_0x6c68('0x3b')]=_['keys'](_0x55637f['query']);_0x2860f1[_0x6c68('0x3c')]=_[_0x6c68('0x3d')](_0x2860f1[_0x6c68('0x3a')],_0x2860f1[_0x6c68('0x3b')]);_0x55f5b3[_0x6c68('0x3f')]=_[_0x6c68('0x3d')](_0x2860f1[_0x6c68('0x3a')],qs[_0x6c68('0x3e')](_0x55637f[_0x6c68('0x3b')][_0x6c68('0x3e')]));_0x55f5b3['attributes']=_0x55f5b3[_0x6c68('0x3f')]['length']?_0x55f5b3[_0x6c68('0x3f')]:_0x2860f1[_0x6c68('0x3a')];if(!_0x55637f[_0x6c68('0x3b')]['hasOwnProperty'](_0x6c68('0x42'))){_0x55f5b3[_0x6c68('0x20')]=qs[_0x6c68('0x20')](_0x55637f[_0x6c68('0x3b')][_0x6c68('0x20')]);_0x55f5b3[_0x6c68('0x22')]=qs[_0x6c68('0x22')](_0x55637f[_0x6c68('0x3b')][_0x6c68('0x22')]);}_0x55f5b3[_0x6c68('0x43')]=qs[_0x6c68('0x44')](_0x55637f[_0x6c68('0x3b')][_0x6c68('0x44')]);_0x55f5b3[_0x6c68('0x47')]=qs[_0x6c68('0x3c')](_[_0x6c68('0x61')](_0x55637f[_0x6c68('0x3b')],_0x2860f1[_0x6c68('0x3c')]));_0x55f5b3[_0x6c68('0x47')][_0x6c68('0x62')]=_0xc5e9e8['id'];if(_0x55637f[_0x6c68('0x3b')][_0x6c68('0x2d')]){_0x55f5b3[_0x6c68('0x47')]=_['merge'](_0x55f5b3[_0x6c68('0x47')],{'$or':_[_0x6c68('0x2f')](_0x55f5b3[_0x6c68('0x3f')],function(_0x1d1e0a){var _0x2a1769={};_0x2a1769[_0x1d1e0a]={'$like':'%'+_0x55637f[_0x6c68('0x3b')][_0x6c68('0x2d')]+'%'};return _0x2a1769;})});}_0x55f5b3=_['merge']({},_0x55f5b3,_0x55637f['options']);return db[_0x6c68('0x65')][_0x6c68('0x21')]({'where':_0x55f5b3[_0x6c68('0x47')]})[_0x6c68('0x27')](function(_0x2eaed8){_0x469e09['count']=_0x2eaed8;if(_0x55637f[_0x6c68('0x3b')]['includeAll']){_0x55f5b3[_0x6c68('0x49')]=[{'all':!![]}];}return db[_0x6c68('0x65')][_0x6c68('0x63')](_0x55f5b3);})[_0x6c68('0x27')](function(_0x273ab1){_0x469e09['rows']=_0x273ab1;return _0x469e09;});}})[_0x6c68('0x27')](respondWithFilteredResult(_0x45249f,_0x55f5b3))['catch'](handleError(_0x45249f,null));};exports[_0x6c68('0x66')]=function(_0x461a7d,_0x5d44db,_0x11687d){var _0x6fe158={'raw':!![],'where':{}};var _0x4dde6a={};var _0x2460a1={'count':0x0,'rows':[]};return db[_0x6c68('0x37')][_0x6c68('0x5f')]({'where':{'id':_0x461a7d[_0x6c68('0x4d')]['id']}})[_0x6c68('0x27')](handleEntityNotFound(_0x5d44db,null))[_0x6c68('0x27')](function(_0x1b729f){if(_0x1b729f){_0x4dde6a[_0x6c68('0x3a')]=_[_0x6c68('0x54')](db[_0x6c68('0x67')][_0x6c68('0x55')]);_0x4dde6a[_0x6c68('0x3b')]=_[_0x6c68('0x54')](_0x461a7d[_0x6c68('0x3b')]);_0x4dde6a[_0x6c68('0x3c')]=_[_0x6c68('0x3d')](_0x4dde6a['model'],_0x4dde6a[_0x6c68('0x3b')]);_0x6fe158[_0x6c68('0x3f')]=_['intersection'](_0x4dde6a['model'],qs[_0x6c68('0x3e')](_0x461a7d[_0x6c68('0x3b')]['fields']));_0x6fe158[_0x6c68('0x3f')]=_0x6fe158['attributes'][_0x6c68('0x40')]?_0x6fe158[_0x6c68('0x3f')]:_0x4dde6a['model'];if(!_0x461a7d[_0x6c68('0x3b')][_0x6c68('0x41')](_0x6c68('0x42'))){_0x6fe158[_0x6c68('0x20')]=qs[_0x6c68('0x20')](_0x461a7d[_0x6c68('0x3b')][_0x6c68('0x20')]);_0x6fe158[_0x6c68('0x22')]=qs[_0x6c68('0x22')](_0x461a7d[_0x6c68('0x3b')]['offset']);}_0x6fe158[_0x6c68('0x43')]=qs[_0x6c68('0x44')](_0x461a7d[_0x6c68('0x3b')][_0x6c68('0x44')]);_0x6fe158[_0x6c68('0x47')]=qs[_0x6c68('0x3c')](_[_0x6c68('0x61')](_0x461a7d[_0x6c68('0x3b')],_0x4dde6a['filters']));_0x6fe158['where'][_0x6c68('0x62')]=_0x1b729f['id'];if(_0x461a7d[_0x6c68('0x3b')]['filter']){_0x6fe158[_0x6c68('0x47')]=_[_0x6c68('0x45')](_0x6fe158[_0x6c68('0x47')],{'$or':_[_0x6c68('0x2f')](_0x6fe158[_0x6c68('0x3f')],function(_0x14030c){var _0x2e4851={};_0x2e4851[_0x14030c]={'$like':'%'+_0x461a7d[_0x6c68('0x3b')][_0x6c68('0x2d')]+'%'};return _0x2e4851;})});}_0x6fe158=_['merge']({},_0x6fe158,_0x461a7d[_0x6c68('0x56')]);return db[_0x6c68('0x67')][_0x6c68('0x21')]({'where':_0x6fe158[_0x6c68('0x47')]})[_0x6c68('0x27')](function(_0x1a5c9b){_0x2460a1[_0x6c68('0x21')]=_0x1a5c9b;if(_0x461a7d[_0x6c68('0x3b')][_0x6c68('0x48')]){_0x6fe158[_0x6c68('0x49')]=[{'all':!![]}];}return db[_0x6c68('0x67')]['findAll'](_0x6fe158);})[_0x6c68('0x27')](function(_0x4bb763){_0x2460a1['rows']=_0x4bb763;return _0x2460a1;});}})['then'](respondWithFilteredResult(_0x5d44db,_0x6fe158))[_0x6c68('0x4b')](handleError(_0x5d44db,null));};exports['getHopperBlacks']=function(_0x12bd4f,_0x47c3c5,_0x4d2096){var _0x5a41d1={'raw':!![],'where':{}};var _0x5849c2={};var _0x184bd9={'count':0x0,'rows':[]};return db[_0x6c68('0x37')][_0x6c68('0x5f')]({'where':{'id':_0x12bd4f[_0x6c68('0x4d')]['id']}})[_0x6c68('0x27')](handleEntityNotFound(_0x47c3c5,null))[_0x6c68('0x27')](function(_0x775bad){if(_0x775bad){_0x5849c2['model']=_[_0x6c68('0x54')](db[_0x6c68('0x68')]['rawAttributes']);_0x5849c2[_0x6c68('0x3b')]=_[_0x6c68('0x54')](_0x12bd4f[_0x6c68('0x3b')]);_0x5849c2[_0x6c68('0x3c')]=_[_0x6c68('0x3d')](_0x5849c2[_0x6c68('0x3a')],_0x5849c2['query']);_0x5a41d1[_0x6c68('0x3f')]=_[_0x6c68('0x3d')](_0x5849c2[_0x6c68('0x3a')],qs[_0x6c68('0x3e')](_0x12bd4f[_0x6c68('0x3b')][_0x6c68('0x3e')]));_0x5a41d1[_0x6c68('0x3f')]=_0x5a41d1[_0x6c68('0x3f')][_0x6c68('0x40')]?_0x5a41d1[_0x6c68('0x3f')]:_0x5849c2[_0x6c68('0x3a')];if(!_0x12bd4f[_0x6c68('0x3b')][_0x6c68('0x41')]('nolimit')){_0x5a41d1[_0x6c68('0x20')]=qs[_0x6c68('0x20')](_0x12bd4f['query'][_0x6c68('0x20')]);_0x5a41d1[_0x6c68('0x22')]=qs[_0x6c68('0x22')](_0x12bd4f['query'][_0x6c68('0x22')]);}_0x5a41d1[_0x6c68('0x43')]=qs[_0x6c68('0x44')](_0x12bd4f[_0x6c68('0x3b')][_0x6c68('0x44')]);_0x5a41d1['where']=qs['filters'](_[_0x6c68('0x61')](_0x12bd4f[_0x6c68('0x3b')],_0x5849c2[_0x6c68('0x3c')]));_0x5a41d1['where'][_0x6c68('0x62')]=_0x775bad['id'];if(_0x12bd4f[_0x6c68('0x3b')][_0x6c68('0x2d')]){_0x5a41d1[_0x6c68('0x47')]=_[_0x6c68('0x45')](_0x5a41d1[_0x6c68('0x47')],{'$or':_[_0x6c68('0x2f')](_0x5a41d1[_0x6c68('0x3f')],function(_0x52a154){var _0x212409={};_0x212409[_0x52a154]={'$like':'%'+_0x12bd4f[_0x6c68('0x3b')]['filter']+'%'};return _0x212409;})});}_0x5a41d1=_[_0x6c68('0x45')]({},_0x5a41d1,_0x12bd4f[_0x6c68('0x56')]);return db[_0x6c68('0x68')][_0x6c68('0x21')]({'where':_0x5a41d1[_0x6c68('0x47')]})[_0x6c68('0x27')](function(_0xd0f067){_0x184bd9[_0x6c68('0x21')]=_0xd0f067;if(_0x12bd4f[_0x6c68('0x3b')][_0x6c68('0x48')]){_0x5a41d1[_0x6c68('0x49')]=[{'all':!![]}];}return db[_0x6c68('0x68')][_0x6c68('0x63')](_0x5a41d1);})[_0x6c68('0x27')](function(_0x15f128){_0x184bd9[_0x6c68('0x4a')]=_0x15f128;return _0x184bd9;});}})[_0x6c68('0x27')](respondWithFilteredResult(_0x47c3c5,_0x5a41d1))['catch'](handleError(_0x47c3c5,null));};exports[_0x6c68('0x69')]=function(_0x1fa9e1,_0x14e09c,_0x594b14){var _0x395704={};var _0x52f520={};var _0x181971;var _0x7c3982;return db[_0x6c68('0x37')][_0x6c68('0x5f')]({'where':{'id':_0x1fa9e1[_0x6c68('0x4d')]['id']}})[_0x6c68('0x27')](handleEntityNotFound(_0x14e09c,null))['then'](function(_0x563b89){if(_0x563b89){_0x181971=_0x563b89;_0x52f520[_0x6c68('0x3a')]=_[_0x6c68('0x54')](db[_0x6c68('0x6a')][_0x6c68('0x55')]);_0x52f520[_0x6c68('0x3b')]=_[_0x6c68('0x54')](_0x1fa9e1[_0x6c68('0x3b')]);_0x52f520['filters']=_[_0x6c68('0x3d')](_0x52f520[_0x6c68('0x3a')],_0x52f520[_0x6c68('0x3b')]);_0x395704[_0x6c68('0x3f')]=_[_0x6c68('0x3d')](_0x52f520[_0x6c68('0x3a')],qs[_0x6c68('0x3e')](_0x1fa9e1[_0x6c68('0x3b')][_0x6c68('0x3e')]));_0x395704[_0x6c68('0x3f')]=_0x395704[_0x6c68('0x3f')][_0x6c68('0x40')]?_0x395704['attributes']:_0x52f520[_0x6c68('0x3a')];_0x395704[_0x6c68('0x43')]=qs[_0x6c68('0x44')](_0x1fa9e1[_0x6c68('0x3b')][_0x6c68('0x44')]);_0x395704['where']=qs['filters'](_[_0x6c68('0x61')](_0x1fa9e1[_0x6c68('0x3b')],_0x52f520[_0x6c68('0x3c')]));if(_0x1fa9e1[_0x6c68('0x3b')]['filter']){_0x395704['where']=_[_0x6c68('0x45')](_0x395704[_0x6c68('0x47')],{'$or':_[_0x6c68('0x2f')](_0x395704[_0x6c68('0x3f')],function(_0x47f49f){var _0x54af22={};_0x54af22[_0x47f49f]={'$like':'%'+_0x1fa9e1[_0x6c68('0x3b')]['filter']+'%'};return _0x54af22;})});}_0x395704=_[_0x6c68('0x45')]({},_0x395704,_0x1fa9e1['options']);return _0x181971[_0x6c68('0x69')](_0x395704);}})[_0x6c68('0x27')](function(_0x3343ec){if(_0x3343ec){_0x7c3982=_0x3343ec[_0x6c68('0x40')];if(!_0x1fa9e1[_0x6c68('0x3b')][_0x6c68('0x41')](_0x6c68('0x42'))){_0x395704[_0x6c68('0x20')]=qs[_0x6c68('0x20')](_0x1fa9e1[_0x6c68('0x3b')]['limit']);_0x395704['offset']=qs[_0x6c68('0x22')](_0x1fa9e1[_0x6c68('0x3b')]['offset']);}return _0x181971[_0x6c68('0x69')](_0x395704);}})[_0x6c68('0x27')](function(_0x270ea1){if(_0x270ea1){return _0x270ea1?{'count':_0x7c3982,'rows':_0x270ea1}:null;}})['then'](respondWithResult(_0x14e09c,null))[_0x6c68('0x4b')](handleError(_0x14e09c,null));};exports['addTeams']=function(_0x5eb9c3,_0x1bb874,_0x42d6da){var _0x127ef6=_0x5eb9c3['body'][_0x6c68('0x6b')];var _0x5025fb=_['map'](_0x127ef6,'id');return db[_0x6c68('0x6a')][_0x6c68('0x63')]({'where':{'id':_0x5025fb},'attributes':['id'],'include':[{'model':db[_0x6c68('0x6c')],'as':_0x6c68('0x6d'),'attributes':['id','name',_0x6c68('0x6e'),_0x6c68('0x6f'),_0x6c68('0x70')],'raw':!![]}]})[_0x6c68('0x27')](function(_0x3f8465){if(_0x3f8465){var _0x41b4d8=_['flatMap'](_0x3f8465,function(_0x3edfd5){var _0x46a51c=_0x3edfd5[_0x6c68('0x29')]({'plain':!![]});_0x46a51c[_0x6c68('0x6d')][_0x6c68('0x71')](function(_0x4814b8){_0x4814b8[_0x6c68('0x72')]=_[_0x6c68('0x31')](_0x127ef6,{'id':_0x46a51c['id']})[_0x6c68('0x72')];});return _0x46a51c[_0x6c68('0x6d')];});return db[_0x6c68('0x37')][_0x6c68('0x31')]({'where':{'id':_0x5eb9c3[_0x6c68('0x4d')]['id']}})[_0x6c68('0x27')](function(_0x3ac2e3){return db['sequelize'][_0x6c68('0x73')](function(_0x15cde3){return _0x3ac2e3['addTeams'](_0x5025fb,{'transaction':_0x15cde3})[_0x6c68('0x27')](function(){return BPromise['each'](_0x127ef6,function(_0x3cc5db){return db[_0x6c68('0x74')][_0x6c68('0x75')]({'TeamId':_0x3cc5db['id'],'VoiceQueueId':_0x5eb9c3['params']['id'],'penalty':_0x3cc5db['penalty']},{'transaction':_0x15cde3});});})['then'](function(){return BPromise[_0x6c68('0x76')](_0x41b4d8,function(_0x52c1e1){return db['UserVoiceQueue']['findOrCreate']({'where':{'UserId':_0x52c1e1['id'],'VoiceQueueId':_0x5eb9c3[_0x6c68('0x4d')]['id']},'defaults':{'penalty':_0x52c1e1[_0x6c68('0x72')]},'transaction':_0x15cde3});});})[_0x6c68('0x27')](function(){return BPromise[_0x6c68('0x76')](_['filter'](_0x41b4d8,{'online':!![]}),function(_0xcc8ac5){return db[_0x6c68('0x77')][_0x6c68('0x75')]({'membername':_0xcc8ac5[_0x6c68('0x33')],'UserId':_0xcc8ac5['id'],'queue_name':_0x3ac2e3['name'],'VoiceQueueId':_0x3ac2e3['id'],'interface':_['isNil'](_0xcc8ac5[_0x6c68('0x70')])?util[_0x6c68('0x78')](_0x6c68('0x79'),_0xcc8ac5[_0x6c68('0x33')]):_0xcc8ac5[_0x6c68('0x70')],'paused':_0xcc8ac5['voicePause']||![],'penalty':_0xcc8ac5[_0x6c68('0x72')]},{'transaction':_0x15cde3});});})[_0x6c68('0x27')](function(){_0x41b4d8[_0x6c68('0x71')](function(_0x18efab){socket[_0x6c68('0x7a')](_0x6c68('0x7b'),{'UserId':_0x18efab['id'],'VoiceQueueId':_0x3ac2e3['id']});});});});});}})[_0x6c68('0x27')](respondWithStatusCode(_0x1bb874,null))[_0x6c68('0x4b')](handleError(_0x1bb874,null));};exports['removeTeams']=function(_0x4b02a9,_0x22dbb8,_0x168075){return db[_0x6c68('0x6a')][_0x6c68('0x63')]({'where':{'id':_0x4b02a9['query'][_0x6c68('0x7c')]},'attributes':['id'],'include':[{'model':db[_0x6c68('0x6c')],'as':_0x6c68('0x6d'),'attributes':['id'],'raw':!![]}]})[_0x6c68('0x27')](handleEntityNotFound(_0x22dbb8,null))['then'](function(_0x5ecdfc){var _0x244611=_[_0x6c68('0x2f')](_0x5ecdfc,'id');var _0x47039e=[];var _0x5515ee=[];var _0x35c840=squel[_0x6c68('0x7d')]();_0x35c840['field'](_0x6c68('0x7e'))[_0x6c68('0x7f')](_0x6c68('0x80'),'tq')[_0x6c68('0x81')](_0x6c68('0x82'),'ut',_0x6c68('0x83'))[_0x6c68('0x47')](_0x6c68('0x84'),_0x4b02a9[_0x6c68('0x4d')]['id']);for(var _0x27ffc8=0x0;_0x27ffc8<_0x5ecdfc[_0x6c68('0x40')];_0x27ffc8+=0x1){let _0x33f0d6=_0x5ecdfc[_0x27ffc8];for(var _0x5d01e3=0x0;_0x5d01e3<_0x33f0d6['Agents']['length'];_0x5d01e3+=0x1){let _0x575549=_0x33f0d6[_0x6c68('0x6d')][_0x5d01e3];var _0x18cfb3=_0x35c840['clone']();_0x18cfb3[_0x6c68('0x47')](_0x6c68('0x85'),_0x575549['id']);_0x5515ee[_0x6c68('0x86')](db[_0x6c68('0x87')]['query'](_0x18cfb3['toString'](),{'type':db['sequelize'][_0x6c68('0x88')]['SELECT']})[_0x6c68('0x27')](function(_0x4eb38b){if(_0x4eb38b['length']===0x1){return _0x575549['id'];}else{var _0x4e88c8=_['every'](_[_0x6c68('0x2f')](_0x4eb38b,_0x6c68('0x89')),function(_0x4de12d){return _[_0x6c68('0x8a')](_0x244611,_0x4de12d);});if(_0x4e88c8){return _0x575549['id'];}}}));}}return BPromise['all'](_0x5515ee)[_0x6c68('0x27')](function(_0x4e38a5){_0x47039e=_(_0x47039e)[_0x6c68('0x8b')](_0x4e38a5)['compact']()['value']();return db[_0x6c68('0x37')][_0x6c68('0x31')]({'where':{'id':_0x4b02a9[_0x6c68('0x4d')]['id']}})[_0x6c68('0x27')](function(_0x2f9b75){return db[_0x6c68('0x87')][_0x6c68('0x73')](function(_0x39a531){return _0x2f9b75[_0x6c68('0x8c')](_0x4b02a9[_0x6c68('0x3b')][_0x6c68('0x7c')],{'transaction':_0x39a531})[_0x6c68('0x27')](function(){if(!_['isEmpty'](_0x47039e)){return _0x2f9b75[_0x6c68('0x8d')](_0x47039e,{'transaction':_0x39a531})[_0x6c68('0x27')](function(){return db[_0x6c68('0x77')][_0x6c68('0x28')]({'where':{'VoiceQueueId':_0x4b02a9['params']['id'],'UserId':_0x47039e},'transaction':_0x39a531});});}})[_0x6c68('0x27')](function(){_0x47039e[_0x6c68('0x71')](function(_0x2543e8){socket[_0x6c68('0x7a')](_0x6c68('0x8e'),{'UserId':_0x2543e8,'VoiceQueueId':_0x2f9b75['id']});});});});});});})[_0x6c68('0x27')](respondWithStatusCode(_0x22dbb8,null))['catch'](handleError(_0x22dbb8,null));};exports[_0x6c68('0x8f')]=function(_0x236598,_0x5cf9a6,_0x558b03){var _0x4134a3,_0x912ce7;return db[_0x6c68('0x37')][_0x6c68('0x31')]({'where':{'id':_0x236598['params']['id']}})['then'](handleEntityNotFound(_0x5cf9a6,null))[_0x6c68('0x27')](function(_0x573076){if(_0x573076){_0x912ce7=_0x573076;return _0x573076[_0x6c68('0x8f')](_0x236598[_0x6c68('0x4f')][_0x6c68('0x7c')],_['omit'](_0x236598[_0x6c68('0x4f')],['ids','id'])||{})['spread'](function(_0x2893b9){for(var _0x1792bb=0x0;_0x1792bb<_0x236598[_0x6c68('0x4f')][_0x6c68('0x7c')][_0x6c68('0x40')];_0x1792bb+=0x1){socket[_0x6c68('0x7a')]('userVoiceQueue:save',{'UserId':Number(_0x236598[_0x6c68('0x4f')][_0x6c68('0x7c')][_0x1792bb]),'VoiceQueueId':Number(_0x236598[_0x6c68('0x4d')]['id'])});}return _0x2893b9;});}})[_0x6c68('0x27')](function(_0x44f7e5){_0x4134a3=_0x44f7e5||[];if(_0x912ce7){return db[_0x6c68('0x6c')][_0x6c68('0x63')]({'where':{'id':_0x236598['body'][_0x6c68('0x7c')]},'attributes':['id',_0x6c68('0x33'),_0x6c68('0x6e'),'voicePause','interface'],'raw':!![]});}})[_0x6c68('0x27')](function(_0x52d67d){if(!_[_0x6c68('0x90')](_0x52d67d)){var _0x17d75a=[];for(var _0x2295a9=0x0;_0x2295a9<_0x52d67d[_0x6c68('0x40')];_0x2295a9++){if(_0x52d67d[_0x2295a9]['online']){_0x17d75a['push'](db[_0x6c68('0x77')][_0x6c68('0x75')]({'membername':_0x52d67d[_0x2295a9][_0x6c68('0x33')],'UserId':_0x52d67d[_0x2295a9]['id'],'queue_name':_0x912ce7[_0x6c68('0x33')],'VoiceQueueId':_0x912ce7['id'],'interface':_['isNil'](_0x52d67d[_0x2295a9]['interface'])?util['format']('SIP/%s',_0x52d67d[_0x2295a9][_0x6c68('0x33')]):_0x52d67d[_0x2295a9][_0x6c68('0x70')],'paused':_0x52d67d[_0x2295a9]['voicePause']||![],'penalty':_0x236598[_0x6c68('0x4f')][_0x6c68('0x72')]||0x0}));}}return BPromise[_0x6c68('0x91')](_0x17d75a);}})[_0x6c68('0x27')](function(){return _0x4134a3;})[_0x6c68('0x27')](respondWithResult(_0x5cf9a6,null))['catch'](handleError(_0x5cf9a6,null));};exports[_0x6c68('0x8d')]=function(_0x2ecdf8,_0x30a1f7,_0x43c5df){return db[_0x6c68('0x37')]['find']({'where':{'id':_0x2ecdf8['params']['id']}})['then'](handleEntityNotFound(_0x30a1f7,null))[_0x6c68('0x27')](function(_0x1ba856){if(_0x1ba856){return _0x1ba856[_0x6c68('0x8d')](_0x2ecdf8[_0x6c68('0x3b')][_0x6c68('0x7c')])['then'](function(){if(_[_0x6c68('0x92')](_0x2ecdf8[_0x6c68('0x3b')]['ids'])){for(var _0xec65e5=0x0;_0xec65e5<_0x2ecdf8['query'][_0x6c68('0x7c')][_0x6c68('0x40')];_0xec65e5+=0x1){socket[_0x6c68('0x7a')](_0x6c68('0x8e'),{'UserId':Number(_0x2ecdf8['query'][_0x6c68('0x7c')][_0xec65e5]),'VoiceQueueId':Number(_0x2ecdf8[_0x6c68('0x4d')]['id'])});}}else{socket[_0x6c68('0x7a')](_0x6c68('0x8e'),{'UserId':Number(_0x2ecdf8[_0x6c68('0x3b')][_0x6c68('0x7c')]),'VoiceQueueId':Number(_0x2ecdf8[_0x6c68('0x4d')]['id'])});}});}})[_0x6c68('0x27')](function(_0x5cf4d6){return db[_0x6c68('0x77')][_0x6c68('0x28')]({'where':{'VoiceQueueId':_0x2ecdf8[_0x6c68('0x4d')]['id'],'UserId':_0x2ecdf8[_0x6c68('0x3b')][_0x6c68('0x7c')]}})[_0x6c68('0x27')](function(){return _0x5cf4d6;});})['then'](respondWithStatusCode(_0x30a1f7,null))['catch'](handleError(_0x30a1f7,null));};exports[_0x6c68('0x93')]=function(_0x5f2d4f,_0x1d7f30,_0x87e200){var _0x24371f={};var _0x3c7d4d={};var _0x594f1b;var _0x3eb8d0;return db[_0x6c68('0x37')][_0x6c68('0x5f')]({'where':{'id':_0x5f2d4f['params']['id']}})[_0x6c68('0x27')](handleEntityNotFound(_0x1d7f30,null))[_0x6c68('0x27')](function(_0x4ec69f){if(_0x4ec69f){_0x594f1b=_0x4ec69f;_0x3c7d4d[_0x6c68('0x3a')]=_[_0x6c68('0x54')](db[_0x6c68('0x6c')][_0x6c68('0x55')]);_0x3c7d4d[_0x6c68('0x3b')]=_['keys'](_0x5f2d4f[_0x6c68('0x3b')]);_0x3c7d4d['filters']=_['intersection'](_0x3c7d4d[_0x6c68('0x3a')],_0x3c7d4d[_0x6c68('0x3b')]);_0x24371f[_0x6c68('0x3f')]=_['intersection'](_0x3c7d4d['model'],qs['fields'](_0x5f2d4f['query'][_0x6c68('0x3e')]));_0x24371f['attributes']=_0x24371f[_0x6c68('0x3f')][_0x6c68('0x40')]?_0x24371f[_0x6c68('0x3f')]:_0x3c7d4d[_0x6c68('0x3a')];_0x24371f[_0x6c68('0x43')]=qs[_0x6c68('0x44')](_0x5f2d4f[_0x6c68('0x3b')][_0x6c68('0x44')]);_0x24371f[_0x6c68('0x47')]=qs[_0x6c68('0x3c')](_[_0x6c68('0x61')](_0x5f2d4f[_0x6c68('0x3b')],_0x3c7d4d[_0x6c68('0x3c')]));if(_0x5f2d4f[_0x6c68('0x3b')][_0x6c68('0x2d')]){_0x24371f[_0x6c68('0x47')]=_[_0x6c68('0x45')](_0x24371f[_0x6c68('0x47')],{'$or':_[_0x6c68('0x2f')](_0x24371f['attributes'],function(_0x4130c5){var _0x423958={};_0x423958[_0x4130c5]={'$like':'%'+_0x5f2d4f['query'][_0x6c68('0x2d')]+'%'};return _0x423958;})});}_0x24371f=_[_0x6c68('0x45')]({},_0x24371f,_0x5f2d4f[_0x6c68('0x56')]);return _0x594f1b[_0x6c68('0x93')](_0x24371f);}})[_0x6c68('0x27')](function(_0x5bd388){if(_0x5bd388){_0x3eb8d0=_0x5bd388[_0x6c68('0x40')];if(!_0x5f2d4f[_0x6c68('0x3b')][_0x6c68('0x41')](_0x6c68('0x42'))){_0x24371f[_0x6c68('0x20')]=qs[_0x6c68('0x20')](_0x5f2d4f['query'][_0x6c68('0x20')]);_0x24371f[_0x6c68('0x22')]=qs[_0x6c68('0x22')](_0x5f2d4f[_0x6c68('0x3b')][_0x6c68('0x22')]);}return _0x594f1b[_0x6c68('0x93')](_0x24371f);}})[_0x6c68('0x27')](function(_0x2a6afa){if(_0x2a6afa){return _0x2a6afa?{'count':_0x3eb8d0,'rows':_0x2a6afa}:null;}})[_0x6c68('0x27')](respondWithResult(_0x1d7f30,null))['catch'](handleError(_0x1d7f30,null));};exports['getMembers']=function(_0x3111c8,_0x58f6f3,_0x3c978f){var _0x2861a3={};var _0x2813ce={};var _0x48b2d4;var _0x250eea;return db['VoiceQueue'][_0x6c68('0x5f')]({'where':{'id':_0x3111c8['params']['id']}})['then'](handleEntityNotFound(_0x58f6f3,null))['then'](function(_0x1a7058){if(_0x1a7058){_0x48b2d4=_0x1a7058;_0x2813ce[_0x6c68('0x3a')]=_['keys'](db[_0x6c68('0x77')][_0x6c68('0x55')]);_0x2813ce[_0x6c68('0x3b')]=_['keys'](_0x3111c8[_0x6c68('0x3b')]);_0x2813ce[_0x6c68('0x3c')]=_['intersection'](_0x2813ce['model'],_0x2813ce[_0x6c68('0x3b')]);_0x2861a3['attributes']=_['intersection'](_0x2813ce[_0x6c68('0x3a')],qs['fields'](_0x3111c8[_0x6c68('0x3b')][_0x6c68('0x3e')]));_0x2861a3[_0x6c68('0x3f')]=_0x2861a3[_0x6c68('0x3f')]['length']?_0x2861a3[_0x6c68('0x3f')]:_0x2813ce[_0x6c68('0x3a')];_0x2861a3['order']=qs[_0x6c68('0x44')](_0x3111c8['query']['sort']);_0x2861a3[_0x6c68('0x47')]=qs[_0x6c68('0x3c')](_[_0x6c68('0x61')](_0x3111c8[_0x6c68('0x3b')],_0x2813ce[_0x6c68('0x3c')]));if(_0x3111c8[_0x6c68('0x3b')][_0x6c68('0x2d')]){_0x2861a3[_0x6c68('0x47')]=_[_0x6c68('0x45')](_0x2861a3[_0x6c68('0x47')],{'$or':_[_0x6c68('0x2f')](_0x2861a3['attributes'],function(_0xc9416f){var _0x56658b={};_0x56658b[_0xc9416f]={'$like':'%'+_0x3111c8[_0x6c68('0x3b')]['filter']+'%'};return _0x56658b;})});}_0x2861a3=_[_0x6c68('0x45')]({},_0x2861a3,_0x3111c8[_0x6c68('0x56')]);return _0x48b2d4[_0x6c68('0x94')](_0x2861a3);}})['then'](function(_0xd0cd46){if(_0xd0cd46){_0x250eea=_0xd0cd46['length'];if(!_0x3111c8[_0x6c68('0x3b')]['hasOwnProperty'](_0x6c68('0x42'))){_0x2861a3[_0x6c68('0x20')]=qs['limit'](_0x3111c8[_0x6c68('0x3b')][_0x6c68('0x20')]);_0x2861a3[_0x6c68('0x22')]=qs[_0x6c68('0x22')](_0x3111c8[_0x6c68('0x3b')][_0x6c68('0x22')]);}return _0x48b2d4[_0x6c68('0x94')](_0x2861a3);}})['then'](function(_0x6e66cb){return _0x6e66cb?{'count':_0x250eea,'rows':_0x6e66cb}:null;})[_0x6c68('0x27')](respondWithResult(_0x58f6f3,null))['catch'](handleError(_0x58f6f3,null));};exports[_0x6c68('0x95')]=function(_0x54e51a,_0xc84f29,_0x17f55f){var _0x53d568={};var _0x5dbe90={};var _0x386f63;var _0x5e1382;return db[_0x6c68('0x37')][_0x6c68('0x5f')]({'where':{'id':_0x54e51a[_0x6c68('0x4d')]['id']}})[_0x6c68('0x27')](handleEntityNotFound(_0xc84f29,null))[_0x6c68('0x27')](function(_0x3c9ab3){if(_0x3c9ab3){_0x386f63=_0x3c9ab3;_0x5dbe90[_0x6c68('0x3a')]=_[_0x6c68('0x54')](db[_0x6c68('0x96')][_0x6c68('0x55')]);_0x5dbe90[_0x6c68('0x3b')]=_[_0x6c68('0x54')](_0x54e51a[_0x6c68('0x3b')]);_0x5dbe90[_0x6c68('0x3c')]=_['intersection'](_0x5dbe90[_0x6c68('0x3a')],_0x5dbe90[_0x6c68('0x3b')]);_0x53d568[_0x6c68('0x3f')]=_[_0x6c68('0x3d')](_0x5dbe90[_0x6c68('0x3a')],qs[_0x6c68('0x3e')](_0x54e51a['query'][_0x6c68('0x3e')]));_0x53d568[_0x6c68('0x3f')]=_0x53d568['attributes']['length']?_0x53d568[_0x6c68('0x3f')]:_0x5dbe90[_0x6c68('0x3a')];_0x53d568['order']=qs[_0x6c68('0x44')](_0x54e51a[_0x6c68('0x3b')]['sort']);_0x53d568['where']=qs[_0x6c68('0x3c')](_[_0x6c68('0x61')](_0x54e51a[_0x6c68('0x3b')],_0x5dbe90['filters']));if(_0x54e51a['query'][_0x6c68('0x2d')]){_0x53d568['where']=_[_0x6c68('0x45')](_0x53d568[_0x6c68('0x47')],{'$or':_['map'](_0x53d568[_0x6c68('0x3f')],function(_0x475363){var _0x32395e={};_0x32395e[_0x475363]={'$like':'%'+_0x54e51a[_0x6c68('0x3b')][_0x6c68('0x2d')]+'%'};return _0x32395e;})});}_0x53d568=_['merge']({},_0x53d568,_0x54e51a['options']);return _0x386f63['getLists'](_0x53d568);}})[_0x6c68('0x27')](function(_0x55e5bf){if(_0x55e5bf){_0x5e1382=_0x55e5bf[_0x6c68('0x40')];if(!_0x54e51a[_0x6c68('0x3b')]['hasOwnProperty']('nolimit')){_0x53d568[_0x6c68('0x20')]=qs[_0x6c68('0x20')](_0x54e51a[_0x6c68('0x3b')][_0x6c68('0x20')]);_0x53d568[_0x6c68('0x22')]=qs[_0x6c68('0x22')](_0x54e51a[_0x6c68('0x3b')][_0x6c68('0x22')]);}return _0x386f63[_0x6c68('0x95')](_0x53d568);}})[_0x6c68('0x27')](function(_0x2afad1){if(_0x2afad1){return _0x2afad1?{'count':_0x5e1382,'rows':_0x2afad1}:null;}})[_0x6c68('0x27')](respondWithResult(_0xc84f29,null))[_0x6c68('0x4b')](handleError(_0xc84f29,null));};exports['addLists']=function(_0x1c53d1,_0x2ca038,_0x16789b){var _0x55a5b6,_0x546ef2;return db[_0x6c68('0x37')][_0x6c68('0x31')]({'where':{'id':_0x1c53d1[_0x6c68('0x4d')]['id']}})[_0x6c68('0x27')](handleEntityNotFound(_0x2ca038,null))[_0x6c68('0x27')](function(_0x39c19c){if(_0x39c19c){_0x546ef2=_0x39c19c;return _0x39c19c[_0x6c68('0x97')](_0x1c53d1[_0x6c68('0x4f')]['ids'],_[_0x6c68('0x59')](_0x1c53d1[_0x6c68('0x4f')],[_0x6c68('0x7c'),'id'])||{});}return null;})['spread'](function(_0x2c96a9){var _0x2f43be;_0x55a5b6=_0x2c96a9||[];var _0x26dad9=[];if(_0x2c96a9){for(var _0x21e38a=0x0;_0x21e38a<_0x2c96a9[_0x6c68('0x40')];_0x21e38a+=0x1){var _0x509745=_0x2c96a9[_0x21e38a][_0x6c68('0x29')]({'plain':!![]});_0x546ef2[_0x6c68('0x98')]=_0x1c53d1['body'][_0x6c68('0x98')]?_0x1c53d1[_0x6c68('0x4f')][_0x6c68('0x98')]:_0x546ef2[_0x6c68('0x98')];switch(_0x546ef2[_0x6c68('0x98')]){case _0x6c68('0x99'):_0x2f43be=squel['insert']()[_0x6c68('0x9a')](_0x6c68('0x9b'))[_0x6c68('0x9c')](['phone',_0x6c68('0x9d'),_0x6c68('0x9e'),_0x6c68('0x9f'),'VoiceQueueId',_0x6c68('0x57'),_0x6c68('0x58')],squel['select']()['field'](_0x6c68('0xa0'),'phone')[_0x6c68('0xa1')]('NOW()',_0x6c68('0x9d'))['field']('id',_0x6c68('0x9e'))['field'](_0x509745[_0x6c68('0xa2')]['toString'](),_0x6c68('0x9f'))[_0x6c68('0xa1')](_0x1c53d1[_0x6c68('0x4d')]['id'][_0x6c68('0xa3')](),_0x6c68('0x62'))['field']('NOW()','createdAt')[_0x6c68('0xa1')](_0x6c68('0xa4'),'updatedAt')['from'](_0x6c68('0xa5'))[_0x6c68('0x47')](_0x6c68('0xa6'))[_0x6c68('0x47')](_0x6c68('0xa7'),_0x509745['CmListId'][_0x6c68('0xa3')]())['where'](_0x6c68('0xa8'))[_0x6c68('0x47')]('phone\x20NOT\x20IN\x20(?)',squel[_0x6c68('0x7d')]()[_0x6c68('0xa1')]('COALESCE(calleridnum,\x27\x27)')[_0x6c68('0x7f')](_0x6c68('0xa9'))[_0x6c68('0x47')](_0x6c68('0x84'),_0x1c53d1[_0x6c68('0x4d')]['id'][_0x6c68('0xa3')]()))[_0x6c68('0x47')]('phone\x20NOT\x20IN\x20(?)',squel[_0x6c68('0x7d')]()[_0x6c68('0xa1')](_0x6c68('0xaa'))['from'](_0x6c68('0x9b'))[_0x6c68('0x47')](_0x6c68('0x84'),_0x1c53d1['params']['id']['toString']())))[_0x6c68('0xa3')]();break;case'onlyIfOpen':_0x2f43be=squel[_0x6c68('0xab')]()[_0x6c68('0x9a')](_0x6c68('0x9b'))[_0x6c68('0x9c')]([_0x6c68('0xa0'),_0x6c68('0x9d'),_0x6c68('0x9e'),_0x6c68('0x9f'),_0x6c68('0x62'),_0x6c68('0x57'),_0x6c68('0x58')],squel[_0x6c68('0x7d')]()[_0x6c68('0xa1')]('phone',_0x6c68('0xa0'))['field'](_0x6c68('0xa4'),_0x6c68('0x9d'))[_0x6c68('0xa1')]('id',_0x6c68('0x9e'))[_0x6c68('0xa1')](_0x509745[_0x6c68('0xa2')][_0x6c68('0xa3')](),_0x6c68('0x9f'))['field'](_0x1c53d1[_0x6c68('0x4d')]['id']['toString'](),_0x6c68('0x62'))[_0x6c68('0xa1')](_0x6c68('0xa4'),_0x6c68('0x57'))[_0x6c68('0xa1')](_0x6c68('0xa4'),'updatedAt')[_0x6c68('0x7f')](_0x6c68('0xa5'))[_0x6c68('0x47')](_0x6c68('0xa6'))[_0x6c68('0x47')](_0x6c68('0xa7'),_0x509745['CmListId'][_0x6c68('0xa3')]())['where'](_0x6c68('0xa8'))[_0x6c68('0x47')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x6c68('0xa1')](_0x6c68('0xaa'))[_0x6c68('0x7f')]('cm_hopper')[_0x6c68('0x47')](_0x6c68('0x84'),_0x1c53d1[_0x6c68('0x4d')]['id'][_0x6c68('0xa3')]())))[_0x6c68('0xa3')]();break;default:_0x2f43be=squel[_0x6c68('0xab')]()[_0x6c68('0x9a')](_0x6c68('0x9b'))[_0x6c68('0x9c')]([_0x6c68('0xa0'),_0x6c68('0x9d'),_0x6c68('0x9e'),_0x6c68('0x9f'),_0x6c68('0x62'),_0x6c68('0x57'),_0x6c68('0x58')],squel[_0x6c68('0x7d')]()[_0x6c68('0xa1')](_0x6c68('0xa0'),_0x6c68('0xa0'))['field']('NOW()',_0x6c68('0x9d'))['field']('id',_0x6c68('0x9e'))[_0x6c68('0xa1')](_0x509745[_0x6c68('0xa2')][_0x6c68('0xa3')](),_0x6c68('0x9f'))[_0x6c68('0xa1')](_0x1c53d1[_0x6c68('0x4d')]['id']['toString'](),_0x6c68('0x62'))[_0x6c68('0xa1')]('NOW()',_0x6c68('0x57'))[_0x6c68('0xa1')]('NOW()',_0x6c68('0x58'))[_0x6c68('0x7f')](_0x6c68('0xa5'))[_0x6c68('0x47')](_0x6c68('0xa6'))[_0x6c68('0x47')](_0x6c68('0xa7'),_0x509745[_0x6c68('0xa2')][_0x6c68('0xa3')]())[_0x6c68('0x47')](_0x6c68('0xa8')))[_0x6c68('0xa3')]();}_0x26dad9[_0x6c68('0x86')](db[_0x6c68('0x87')][_0x6c68('0x3b')](_0x2f43be));}return BPromise[_0x6c68('0x91')](_0x26dad9);}})[_0x6c68('0x27')](function(){return _0x55a5b6;})[_0x6c68('0x27')](respondWithResult(_0x2ca038,null))[_0x6c68('0x4b')](handleError(_0x2ca038,null));};exports[_0x6c68('0xac')]=function(_0x598e5b,_0x2929c7,_0x864c53){return db['VoiceQueue']['find']({'where':{'id':_0x598e5b['params']['id']}})[_0x6c68('0x27')](handleEntityNotFound(_0x2929c7,null))[_0x6c68('0x27')](function(_0x6fb94f){if(_0x6fb94f){return _0x6fb94f[_0x6c68('0xac')](_0x598e5b[_0x6c68('0x3b')][_0x6c68('0x7c')]);}})[_0x6c68('0x27')](function(_0x5e77e5){if(_0x5e77e5){return db['CmHopper'][_0x6c68('0x28')]({'where':{'ListId':_0x598e5b[_0x6c68('0x3b')]['ids'],'VoiceQueueId':_0x598e5b[_0x6c68('0x4d')]['id']}})[_0x6c68('0x27')](function(){return _0x5e77e5;});}})['then'](respondWithStatusCode(_0x2929c7,null))['catch'](handleError(_0x2929c7,null));};exports['getBlackLists']=function(_0x5f4d49,_0x1212d6,_0x259b25){var _0x4827aa={};var _0x1034b5={};var _0x50cd43;var _0x2ef59c;return db[_0x6c68('0x37')][_0x6c68('0x5f')]({'where':{'id':_0x5f4d49[_0x6c68('0x4d')]['id']}})[_0x6c68('0x27')](handleEntityNotFound(_0x1212d6,null))[_0x6c68('0x27')](function(_0x3a3729){if(_0x3a3729){_0x50cd43=_0x3a3729;_0x1034b5[_0x6c68('0x3a')]=_['keys'](db['CmList'][_0x6c68('0x55')]);_0x1034b5[_0x6c68('0x3b')]=_['keys'](_0x5f4d49[_0x6c68('0x3b')]);_0x1034b5[_0x6c68('0x3c')]=_[_0x6c68('0x3d')](_0x1034b5['model'],_0x1034b5[_0x6c68('0x3b')]);_0x4827aa[_0x6c68('0x3f')]=_['intersection'](_0x1034b5['model'],qs[_0x6c68('0x3e')](_0x5f4d49[_0x6c68('0x3b')]['fields']));_0x4827aa['attributes']=_0x4827aa[_0x6c68('0x3f')][_0x6c68('0x40')]?_0x4827aa[_0x6c68('0x3f')]:_0x1034b5[_0x6c68('0x3a')];_0x4827aa[_0x6c68('0x43')]=qs[_0x6c68('0x44')](_0x5f4d49[_0x6c68('0x3b')]['sort']);_0x4827aa['where']=qs[_0x6c68('0x3c')](_[_0x6c68('0x61')](_0x5f4d49[_0x6c68('0x3b')],_0x1034b5[_0x6c68('0x3c')]));if(_0x5f4d49[_0x6c68('0x3b')][_0x6c68('0x2d')]){_0x4827aa['where']=_['merge'](_0x4827aa['where'],{'$or':_['map'](_0x4827aa[_0x6c68('0x3f')],function(_0x3a4d37){var _0x2d3836={};_0x2d3836[_0x3a4d37]={'$like':'%'+_0x5f4d49[_0x6c68('0x3b')][_0x6c68('0x2d')]+'%'};return _0x2d3836;})});}_0x4827aa=_[_0x6c68('0x45')]({},_0x4827aa,_0x5f4d49[_0x6c68('0x56')]);return _0x50cd43['getBlackLists'](_0x4827aa);}})[_0x6c68('0x27')](function(_0x22df83){if(_0x22df83){_0x2ef59c=_0x22df83[_0x6c68('0x40')];if(!_0x5f4d49[_0x6c68('0x3b')][_0x6c68('0x41')](_0x6c68('0x42'))){_0x4827aa[_0x6c68('0x20')]=qs[_0x6c68('0x20')](_0x5f4d49['query'][_0x6c68('0x20')]);_0x4827aa[_0x6c68('0x22')]=qs['offset'](_0x5f4d49['query'][_0x6c68('0x22')]);}return _0x50cd43[_0x6c68('0xad')](_0x4827aa);}})[_0x6c68('0x27')](function(_0x7d9a4c){if(_0x7d9a4c){return _0x7d9a4c?{'count':_0x2ef59c,'rows':_0x7d9a4c}:null;}})[_0x6c68('0x27')](respondWithResult(_0x1212d6,null))[_0x6c68('0x4b')](handleError(_0x1212d6,null));};exports['addBlackLists']=function(_0xbc986,_0x9b8ce0,_0x585a70){var _0x2ae103,_0x3d767e;return db[_0x6c68('0x37')][_0x6c68('0x31')]({'where':{'id':_0xbc986[_0x6c68('0x4d')]['id']}})[_0x6c68('0x27')](handleEntityNotFound(_0x9b8ce0,null))[_0x6c68('0x27')](function(_0x3abe72){if(_0x3abe72){_0x3d767e=_0x3abe72;return _0x3abe72[_0x6c68('0xae')](_0xbc986[_0x6c68('0x4f')][_0x6c68('0x7c')],_['omit'](_0xbc986[_0x6c68('0x4f')],[_0x6c68('0x7c'),'id'])||{});}return null;})[_0x6c68('0xaf')](function(_0x168b69){var _0x142d8d;_0x2ae103=_0x168b69||[];var _0x1a9948=[];if(_0x168b69){for(var _0x3e39a=0x0;_0x3e39a<_0x168b69['length'];_0x3e39a+=0x1){var _0x38da35=_0x168b69[_0x3e39a]['get']({'plain':!![]});_0x142d8d=squel[_0x6c68('0xab')]()[_0x6c68('0x9a')](_0x6c68('0xb0'))[_0x6c68('0x9c')]([_0x6c68('0xa0'),_0x6c68('0x9e'),_0x6c68('0x9f'),'VoiceQueueId',_0x6c68('0x57'),_0x6c68('0x58')],squel[_0x6c68('0x7d')]()['field'](_0x6c68('0xa0'),'phone')[_0x6c68('0xa1')]('id','ContactId')[_0x6c68('0xa1')](_0x38da35[_0x6c68('0xa2')][_0x6c68('0xa3')](),_0x6c68('0x9f'))['field'](_0xbc986[_0x6c68('0x4d')]['id'][_0x6c68('0xa3')](),_0x6c68('0x62'))[_0x6c68('0xa1')](_0x6c68('0xa4'),_0x6c68('0x57'))[_0x6c68('0xa1')]('NOW()',_0x6c68('0x58'))['from']('cm_contacts')[_0x6c68('0x47')](_0x6c68('0xa6'))[_0x6c68('0x47')](_0x6c68('0xa7'),_0x38da35[_0x6c68('0xa2')][_0x6c68('0xa3')]())[_0x6c68('0x47')](_0x6c68('0xa8')))[_0x6c68('0xa3')]();_0x1a9948[_0x6c68('0x86')](db[_0x6c68('0x87')][_0x6c68('0x3b')](_0x142d8d));}return BPromise[_0x6c68('0x91')](_0x1a9948);}})['then'](function(){return _0x2ae103;})['then'](respondWithResult(_0x9b8ce0,null))[_0x6c68('0x4b')](handleError(_0x9b8ce0,null));};exports[_0x6c68('0xb1')]=function(_0x470fdf,_0x23a3cf,_0x188353){return db[_0x6c68('0x37')]['find']({'where':{'id':_0x470fdf[_0x6c68('0x4d')]['id']}})[_0x6c68('0x27')](handleEntityNotFound(_0x23a3cf,null))[_0x6c68('0x27')](function(_0x3fed6d){if(_0x3fed6d){return _0x3fed6d[_0x6c68('0xb1')](_0x470fdf[_0x6c68('0x3b')][_0x6c68('0x7c')]);}})[_0x6c68('0x27')](function(_0x23cc41){if(_0x23cc41){return db[_0x6c68('0x68')]['destroy']({'where':{'ListId':_0x470fdf[_0x6c68('0x3b')][_0x6c68('0x7c')],'VoiceQueueId':_0x470fdf[_0x6c68('0x4d')]['id']}})[_0x6c68('0x27')](function(){return _0x23cc41;});}})[_0x6c68('0x27')](respondWithStatusCode(_0x23a3cf,null))[_0x6c68('0x4b')](handleError(_0x23a3cf,null));}; \ No newline at end of file +var _0x614e=['undefined','limit','count','set','apply','reject','save','update','then','destroy','get','VoiceQueues','QueueCampaigns','filter','ignore','map','value','includes','type','find','name','UserProfileResource','stack','send','index','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','VoiceQueue','includeAll','findAll','rows','show','include','options','catch','create','body','user','role','inbound','outbound','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','getHoppers','findOne','VoiceQueueId','CmHopper','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','teams','User','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','transaction','addTeams','each','TeamVoiceQueue','upsert','isNil','SIP/%s','emit','userVoiceQueue:save','removeTeams','field','tq.TeamId','team_has_voice_queues','user_has_teams','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','all','union','compact','ids','isEmpty','removeAgents','UserVoiceQueueRt','userVoiceQueue:remove','addAgents','spread','format','isArray','getAgents','getMembers','getLists','addLists','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','select','phone','NOW()','from','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','deletedAt\x20IS\x20NULL','CmListId','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','removeBlackLists','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset'];(function(_0x412c5f,_0x58e200){var _0x3e8ef1=function(_0x556dbf){while(--_0x556dbf){_0x412c5f['push'](_0x412c5f['shift']());}};_0x3e8ef1(++_0x58e200);}(_0x614e,0x159));var _0xe614=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x614e[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe614('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe614('0x1'));var BPromise=require(_0xe614('0x2'));var Mustache=require(_0xe614('0x3'));var util=require(_0xe614('0x4'));var path=require(_0xe614('0x5'));var sox=require(_0xe614('0x6'));var csv=require(_0xe614('0x7'));var ejs=require(_0xe614('0x8'));var fs=require('fs');var fs_extra=require(_0xe614('0x9'));var _=require(_0xe614('0xa'));var squel=require(_0xe614('0xb'));var crypto=require('crypto');var jsforce=require(_0xe614('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe614('0x7'));var querystring=require('querystring');var Papa=require(_0xe614('0xd'));var Redis=require('ioredis');var authService=require(_0xe614('0xe'));var qs=require(_0xe614('0xf'));var as=require(_0xe614('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe614('0x11'))(_0xe614('0x12'));var utils=require(_0xe614('0x13'));var config=require(_0xe614('0x14'));var licenseUtil=require(_0xe614('0x15'));var db=require(_0xe614('0x16'))['db'];config[_0xe614('0x17')]=_[_0xe614('0x18')](config[_0xe614('0x17')],{'host':_0xe614('0x19'),'port':0x18eb});var socket=require(_0xe614('0x1a'))(new Redis(config[_0xe614('0x17')]));require('./voiceQueue.socket')[_0xe614('0x1b')](socket);function respondWithStatusCode(_0x5c0a7d,_0x356a46){_0x356a46=_0x356a46||0xcc;return function(_0x195224){if(_0x195224){return _0x5c0a7d[_0xe614('0x1c')](_0x356a46);}return _0x5c0a7d[_0xe614('0x1d')](_0x356a46)[_0xe614('0x1e')]();};}function respondWithResult(_0x188398,_0x2593ae){_0x2593ae=_0x2593ae||0xc8;return function(_0x3f1072){if(_0x3f1072){return _0x188398[_0xe614('0x1d')](_0x2593ae)[_0xe614('0x1f')](_0x3f1072);}};}function respondWithFilteredResult(_0x23c4bb,_0xde7767){return function(_0x881b0e){if(_0x881b0e){var _0x521767=typeof _0xde7767[_0xe614('0x20')]===_0xe614('0x21')&&typeof _0xde7767[_0xe614('0x22')]===_0xe614('0x21');var _0x56086f=_0x881b0e[_0xe614('0x23')];var _0x54bba3=_0x521767?0x0:_0xde7767[_0xe614('0x20')];var _0x28e505=_0x521767?_0x881b0e[_0xe614('0x23')]:_0xde7767[_0xe614('0x20')]+_0xde7767[_0xe614('0x22')];var _0x5016ec;if(_0x28e505>=_0x56086f){_0x28e505=_0x56086f;_0x5016ec=0xc8;}else{_0x5016ec=0xce;}_0x23c4bb[_0xe614('0x1d')](_0x5016ec);return _0x23c4bb[_0xe614('0x24')]('Content-Range',_0x54bba3+'-'+_0x28e505+'/'+_0x56086f)['json'](_0x881b0e);}return null;};}function patchUpdates(_0x5940c2){return function(_0x2da0a9){try{jsonpatch[_0xe614('0x25')](_0x2da0a9,_0x5940c2,!![]);}catch(_0x1d99fe){return BPromise[_0xe614('0x26')](_0x1d99fe);}return _0x2da0a9[_0xe614('0x27')]();};}function saveUpdates(_0x39fa2f,_0x2ad3bd){return function(_0x4bcb32){if(_0x4bcb32){return _0x4bcb32[_0xe614('0x28')](_0x39fa2f)[_0xe614('0x29')](function(_0x3383e2){return _0x3383e2;});}return null;};}function removeEntity(_0x1164a2,_0x423915){return function(_0x7432f3){if(_0x7432f3){return _0x7432f3[_0xe614('0x2a')]()[_0xe614('0x29')](function(){var _0x4325fe=_0x7432f3[_0xe614('0x2b')]({'plain':!![]});var _0x16538c=[{'name':_0xe614('0x2c'),'value':'inbound','ignore':![]},{'name':_0xe614('0x2d'),'value':'outbound','ignore':![]}];var _0x30d1be=_(_0x16538c)[_0xe614('0x2e')](_0xe614('0x2f'))[_0xe614('0x30')](_0xe614('0x31'))['value']();if(_[_0xe614('0x32')](_0x30d1be,_0x4325fe[_0xe614('0x33')])){return;}var _0x2ce4c5=_[_0xe614('0x34')](_0x16538c,[_0xe614('0x31'),_0x4325fe[_0xe614('0x33')]])[_0xe614('0x35')];return db[_0xe614('0x36')][_0xe614('0x2a')]({'where':{'type':_0x2ce4c5,'resourceId':_0x4325fe['id']}})[_0xe614('0x29')](function(){return _0x7432f3;});})['then'](function(){_0x1164a2[_0xe614('0x1d')](0xcc)[_0xe614('0x1e')]();});}};}function handleEntityNotFound(_0x3971cb,_0x488847){return function(_0x4b1efa){if(!_0x4b1efa){_0x3971cb[_0xe614('0x1c')](0x194);}return _0x4b1efa;};}function handleError(_0x254dcf,_0x8ea656){_0x8ea656=_0x8ea656||0x1f4;return function(_0x577916){logger['error'](_0x577916[_0xe614('0x37')]);if(_0x577916['name']){delete _0x577916[_0xe614('0x35')];}_0x254dcf[_0xe614('0x1d')](_0x8ea656)[_0xe614('0x38')](_0x577916);};}exports[_0xe614('0x39')]=function(_0x55451e,_0x3c4fa9){var _0xdebff9={},_0x33fa8c={},_0x2c6cda={'count':0x0,'rows':[]};var _0x4a1416=_[_0xe614('0x30')](db['VoiceQueue'][_0xe614('0x3a')],function(_0x583dd8){return{'name':_0x583dd8[_0xe614('0x3b')],'type':_0x583dd8['type'][_0xe614('0x3c')]};});_0x33fa8c['model']=_[_0xe614('0x30')](_0x4a1416,_0xe614('0x35'));_0x33fa8c[_0xe614('0x3d')]=_[_0xe614('0x3e')](_0x55451e[_0xe614('0x3d')]);_0x33fa8c['filters']=_[_0xe614('0x3f')](_0x33fa8c[_0xe614('0x40')],_0x33fa8c[_0xe614('0x3d')]);_0xdebff9[_0xe614('0x41')]=_['intersection'](_0x33fa8c['model'],qs['fields'](_0x55451e[_0xe614('0x3d')][_0xe614('0x42')]));_0xdebff9[_0xe614('0x41')]=_0xdebff9[_0xe614('0x41')][_0xe614('0x43')]?_0xdebff9['attributes']:_0x33fa8c[_0xe614('0x40')];if(!_0x55451e['query'][_0xe614('0x44')](_0xe614('0x45'))){_0xdebff9[_0xe614('0x22')]=qs[_0xe614('0x22')](_0x55451e[_0xe614('0x3d')][_0xe614('0x22')]);_0xdebff9[_0xe614('0x20')]=qs[_0xe614('0x20')](_0x55451e[_0xe614('0x3d')][_0xe614('0x20')]);}_0xdebff9[_0xe614('0x46')]=qs[_0xe614('0x47')](_0x55451e[_0xe614('0x3d')][_0xe614('0x47')]);_0xdebff9[_0xe614('0x48')]=qs[_0xe614('0x49')](_[_0xe614('0x4a')](_0x55451e['query'],_0x33fa8c[_0xe614('0x49')]),_0x4a1416);if(_0x55451e['query']['filter']){_0xdebff9['where']=_[_0xe614('0x4b')](_0xdebff9[_0xe614('0x48')],{'$or':_[_0xe614('0x30')](_0x4a1416,function(_0x47e857){if(_0x47e857[_0xe614('0x33')]!==_0xe614('0x4c')){var _0x28fd94={};_0x28fd94[_0x47e857[_0xe614('0x35')]]={'$like':'%'+_0x55451e[_0xe614('0x3d')]['filter']+'%'};return _0x28fd94;}})});}_0xdebff9=_[_0xe614('0x4b')]({},_0xdebff9,_0x55451e['options']);var _0x2c490d={'where':_0xdebff9[_0xe614('0x48')]};return db[_0xe614('0x4d')][_0xe614('0x23')](_0x2c490d)[_0xe614('0x29')](function(_0x130d94){_0x2c6cda[_0xe614('0x23')]=_0x130d94;if(_0x55451e['query'][_0xe614('0x4e')]){_0xdebff9['include']=[{'all':!![]}];}return db['VoiceQueue'][_0xe614('0x4f')](_0xdebff9);})['then'](function(_0x1c0e22){_0x2c6cda[_0xe614('0x50')]=_0x1c0e22;return _0x2c6cda;})[_0xe614('0x29')](respondWithFilteredResult(_0x3c4fa9,_0xdebff9))['catch'](handleError(_0x3c4fa9,null));};exports[_0xe614('0x51')]=function(_0x4b580d,_0x203879){var _0x332c0b={'raw':![],'where':{'id':_0x4b580d['params']['id']}},_0x1cb830={};_0x1cb830[_0xe614('0x40')]=_[_0xe614('0x3e')](db[_0xe614('0x4d')]['rawAttributes']);_0x1cb830[_0xe614('0x3d')]=_[_0xe614('0x3e')](_0x4b580d['query']);_0x1cb830[_0xe614('0x49')]=_[_0xe614('0x3f')](_0x1cb830['model'],_0x1cb830[_0xe614('0x3d')]);_0x332c0b[_0xe614('0x41')]=_['intersection'](_0x1cb830[_0xe614('0x40')],qs[_0xe614('0x42')](_0x4b580d[_0xe614('0x3d')][_0xe614('0x42')]));_0x332c0b[_0xe614('0x41')]=_0x332c0b['attributes'][_0xe614('0x43')]?_0x332c0b[_0xe614('0x41')]:_0x1cb830[_0xe614('0x40')];if(_0x4b580d['query'][_0xe614('0x4e')]){_0x332c0b[_0xe614('0x52')]=[{'all':!![]}];}_0x332c0b=_[_0xe614('0x4b')]({},_0x332c0b,_0x4b580d[_0xe614('0x53')]);return db[_0xe614('0x4d')][_0xe614('0x34')](_0x332c0b)['then'](handleEntityNotFound(_0x203879,null))[_0xe614('0x29')](respondWithResult(_0x203879,null))[_0xe614('0x54')](handleError(_0x203879,null));};exports[_0xe614('0x55')]=function(_0x4c9d6b,_0x15cd4b){return db[_0xe614('0x4d')][_0xe614('0x55')](_0x4c9d6b[_0xe614('0x56')],{})['then'](function(_0x5a4776){var _0x581b44=_0x4c9d6b[_0xe614('0x57')]['get']({'plain':!![]});if(!_0x581b44)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x581b44[_0xe614('0x58')]===_0xe614('0x57')){var _0x2c5f8b=_0x5a4776[_0xe614('0x2b')]({'plain':!![]});var _0xb66b0a=[{'name':_0xe614('0x2c'),'value':_0xe614('0x59')},{'name':_0xe614('0x2d'),'value':_0xe614('0x5a')}];var _0x97470=_['find'](_0xb66b0a,[_0xe614('0x31'),_0x2c5f8b['type']])[_0xe614('0x35')];return db[_0xe614('0x5b')]['find']({'where':{'name':_0x97470,'userProfileId':_0x581b44['userProfileId']},'raw':!![]})[_0xe614('0x29')](function(_0x1f6c1d){if(_0x1f6c1d&&_0x1f6c1d[_0xe614('0x5c')]===0x0){return db[_0xe614('0x36')][_0xe614('0x55')]({'name':_0x2c5f8b[_0xe614('0x35')],'resourceId':_0x2c5f8b['id'],'type':_0x1f6c1d[_0xe614('0x35')],'sectionId':_0x1f6c1d['id']},{})[_0xe614('0x29')](function(){return _0x5a4776;});}else{return _0x5a4776;}})[_0xe614('0x54')](function(_0x1a6d90){logger[_0xe614('0x5d')](_0xe614('0x5e'),_0x1a6d90);throw _0x1a6d90;});}return _0x5a4776;})[_0xe614('0x29')](respondWithResult(_0x15cd4b,0xc9))[_0xe614('0x54')](handleError(_0x15cd4b,null));};exports[_0xe614('0x5f')]=function(_0x7794fd,_0x3a8eb3){var _0x4efd33={'where':{'id':_0x7794fd[_0xe614('0x60')]['id']}},_0x4b1370={};_0x4b1370['model']=_['keys'](db[_0xe614('0x4d')][_0xe614('0x3a')]);_0x4efd33['attributes']=_['intersection'](_0x4b1370['model'],qs[_0xe614('0x42')](_0x7794fd[_0xe614('0x3d')][_0xe614('0x42')]));_0x4efd33[_0xe614('0x41')]=_0x4efd33[_0xe614('0x41')][_0xe614('0x43')]?_0x4efd33[_0xe614('0x41')]:_0x4b1370[_0xe614('0x40')];if(_0x7794fd[_0xe614('0x3d')][_0xe614('0x4e')]){_0x4efd33[_0xe614('0x52')]=[{'all':!![]}];}_0x4efd33=_[_0xe614('0x4b')]({},_0x4efd33,_0x7794fd['options']);return db[_0xe614('0x4d')][_0xe614('0x34')](_0x4efd33)['then'](handleEntityNotFound(_0x3a8eb3,null))[_0xe614('0x29')](function(_0x575f32){if(_0x575f32){var _0x32fffd=_0x575f32[_0xe614('0x2b')]({'plain':!![]});_0x32fffd=qs[_0xe614('0x61')](_0x32fffd,['id',_0xe614('0x62'),_0xe614('0x63')]);_0x7794fd[_0xe614('0x56')]=_[_0xe614('0x61')](_0x7794fd[_0xe614('0x56')],['id',_0xe614('0x62'),_0xe614('0x63')]);return db[_0xe614('0x4d')]['create'](_[_0xe614('0x4b')](_0x32fffd,_0x7794fd[_0xe614('0x56')]),{'include':_0x7794fd[_0xe614('0x3d')][_0xe614('0x4e')]?[{'all':!![]}]:undefined})[_0xe614('0x29')](function(_0x3e2472){var _0x4ce8c5=_0x7794fd[_0xe614('0x57')][_0xe614('0x2b')]({'plain':!![]});if(!_0x4ce8c5)throw new Error(_0xe614('0x64'));if(_0x4ce8c5[_0xe614('0x58')]===_0xe614('0x57')){var _0x3c0e4a=_0x3e2472[_0xe614('0x2b')]({'plain':!![]});var _0x35ed20=[{'name':_0xe614('0x2c'),'value':'inbound'},{'name':_0xe614('0x2d'),'value':_0xe614('0x5a')}];var _0x9a5b4d=_[_0xe614('0x34')](_0x35ed20,[_0xe614('0x31'),_0x3c0e4a['type']])[_0xe614('0x35')];return db['UserProfileSection'][_0xe614('0x34')]({'where':{'name':_0x9a5b4d,'userProfileId':_0x4ce8c5[_0xe614('0x65')]},'raw':!![]})[_0xe614('0x29')](function(_0x524cc4){if(_0x524cc4&&_0x524cc4['autoAssociation']===0x0){return db[_0xe614('0x36')][_0xe614('0x55')]({'name':_0x3c0e4a[_0xe614('0x35')],'resourceId':_0x3c0e4a['id'],'type':_0x524cc4[_0xe614('0x35')],'sectionId':_0x524cc4['id']},{})[_0xe614('0x29')](function(){return _0x3e2472;});}else{return _0x3e2472;}})['catch'](function(_0x43726c){logger[_0xe614('0x5d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x43726c);throw _0x43726c;});}return _0x3e2472;});}})['then'](respondWithResult(_0x3a8eb3,0xc9))['catch'](handleError(_0x3a8eb3,null));};exports[_0xe614('0x28')]=function(_0x2fea00,_0x2316e9){if(_0x2fea00[_0xe614('0x56')]['id']){delete _0x2fea00[_0xe614('0x56')]['id'];}return db[_0xe614('0x4d')][_0xe614('0x34')]({'where':{'id':_0x2fea00[_0xe614('0x60')]['id']}})['then'](handleEntityNotFound(_0x2316e9,null))[_0xe614('0x29')](saveUpdates(_0x2fea00[_0xe614('0x56')],null))[_0xe614('0x29')](respondWithResult(_0x2316e9,null))[_0xe614('0x54')](handleError(_0x2316e9,null));};exports['destroy']=function(_0x116795,_0x2912a0){return db[_0xe614('0x4d')][_0xe614('0x34')]({'where':{'id':_0x116795[_0xe614('0x60')]['id']}})[_0xe614('0x29')](handleEntityNotFound(_0x2912a0,null))[_0xe614('0x29')](removeEntity(_0x2912a0,null))[_0xe614('0x54')](handleError(_0x2912a0,null));};exports[_0xe614('0x66')]=function(_0x40c0e0,_0x16478a,_0x4273d0){var _0x5e9c6e={'raw':![],'where':{}};var _0x448f63={};var _0x32546f={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xe614('0x67')]({'where':{'id':_0x40c0e0[_0xe614('0x60')]['id']}})['then'](handleEntityNotFound(_0x16478a,null))[_0xe614('0x29')](function(_0x246fa7){if(_0x246fa7){_0x448f63[_0xe614('0x40')]=_['keys'](db['CmHopper'][_0xe614('0x3a')]);_0x448f63[_0xe614('0x3d')]=_[_0xe614('0x3e')](_0x40c0e0[_0xe614('0x3d')]);_0x448f63[_0xe614('0x49')]=_[_0xe614('0x3f')](_0x448f63['model'],_0x448f63[_0xe614('0x3d')]);_0x5e9c6e[_0xe614('0x41')]=_['intersection'](_0x448f63['model'],qs[_0xe614('0x42')](_0x40c0e0[_0xe614('0x3d')][_0xe614('0x42')]));_0x5e9c6e[_0xe614('0x41')]=_0x5e9c6e[_0xe614('0x41')]['length']?_0x5e9c6e[_0xe614('0x41')]:_0x448f63[_0xe614('0x40')];if(!_0x40c0e0['query'][_0xe614('0x44')](_0xe614('0x45'))){_0x5e9c6e[_0xe614('0x22')]=qs[_0xe614('0x22')](_0x40c0e0[_0xe614('0x3d')][_0xe614('0x22')]);_0x5e9c6e[_0xe614('0x20')]=qs[_0xe614('0x20')](_0x40c0e0[_0xe614('0x3d')][_0xe614('0x20')]);}_0x5e9c6e[_0xe614('0x46')]=qs['sort'](_0x40c0e0[_0xe614('0x3d')][_0xe614('0x47')]);_0x5e9c6e[_0xe614('0x48')]=qs[_0xe614('0x49')](_[_0xe614('0x4a')](_0x40c0e0[_0xe614('0x3d')],_0x448f63['filters']));_0x5e9c6e[_0xe614('0x48')][_0xe614('0x68')]=_0x246fa7['id'];if(_0x40c0e0[_0xe614('0x3d')]['filter']){_0x5e9c6e[_0xe614('0x48')]=_['merge'](_0x5e9c6e['where'],{'$or':_[_0xe614('0x30')](_0x5e9c6e[_0xe614('0x41')],function(_0x64a43d){var _0x40742a={};_0x40742a[_0x64a43d]={'$like':'%'+_0x40c0e0[_0xe614('0x3d')][_0xe614('0x2e')]+'%'};return _0x40742a;})});}_0x5e9c6e=_['merge']({},_0x5e9c6e,_0x40c0e0[_0xe614('0x53')]);return db[_0xe614('0x69')][_0xe614('0x23')]({'where':_0x5e9c6e[_0xe614('0x48')]})[_0xe614('0x29')](function(_0x5ba661){_0x32546f[_0xe614('0x23')]=_0x5ba661;if(_0x40c0e0[_0xe614('0x3d')][_0xe614('0x4e')]){_0x5e9c6e['include']=[{'all':!![]}];}return db['CmHopper'][_0xe614('0x4f')](_0x5e9c6e);})['then'](function(_0x212644){_0x32546f[_0xe614('0x50')]=_0x212644;return _0x32546f;});}})[_0xe614('0x29')](respondWithFilteredResult(_0x16478a,_0x5e9c6e))[_0xe614('0x54')](handleError(_0x16478a,null));};exports[_0xe614('0x6a')]=function(_0x45e078,_0x37a57b,_0x5235b9){var _0x14e570={'raw':!![],'where':{}};var _0x37610d={};var _0x5f0bae={'count':0x0,'rows':[]};return db[_0xe614('0x4d')][_0xe614('0x67')]({'where':{'id':_0x45e078[_0xe614('0x60')]['id']}})[_0xe614('0x29')](handleEntityNotFound(_0x37a57b,null))[_0xe614('0x29')](function(_0x342e13){if(_0x342e13){_0x37610d['model']=_['keys'](db[_0xe614('0x6b')]['rawAttributes']);_0x37610d[_0xe614('0x3d')]=_[_0xe614('0x3e')](_0x45e078[_0xe614('0x3d')]);_0x37610d[_0xe614('0x49')]=_[_0xe614('0x3f')](_0x37610d[_0xe614('0x40')],_0x37610d[_0xe614('0x3d')]);_0x14e570[_0xe614('0x41')]=_[_0xe614('0x3f')](_0x37610d[_0xe614('0x40')],qs['fields'](_0x45e078['query'][_0xe614('0x42')]));_0x14e570[_0xe614('0x41')]=_0x14e570[_0xe614('0x41')][_0xe614('0x43')]?_0x14e570[_0xe614('0x41')]:_0x37610d[_0xe614('0x40')];if(!_0x45e078[_0xe614('0x3d')][_0xe614('0x44')]('nolimit')){_0x14e570['limit']=qs[_0xe614('0x22')](_0x45e078['query']['limit']);_0x14e570[_0xe614('0x20')]=qs[_0xe614('0x20')](_0x45e078[_0xe614('0x3d')][_0xe614('0x20')]);}_0x14e570[_0xe614('0x46')]=qs[_0xe614('0x47')](_0x45e078[_0xe614('0x3d')][_0xe614('0x47')]);_0x14e570[_0xe614('0x48')]=qs[_0xe614('0x49')](_['pick'](_0x45e078[_0xe614('0x3d')],_0x37610d[_0xe614('0x49')]));_0x14e570[_0xe614('0x48')][_0xe614('0x68')]=_0x342e13['id'];if(_0x45e078['query'][_0xe614('0x2e')]){_0x14e570['where']=_[_0xe614('0x4b')](_0x14e570[_0xe614('0x48')],{'$or':_['map'](_0x14e570['attributes'],function(_0xd12790){var _0x2c9e14={};_0x2c9e14[_0xd12790]={'$like':'%'+_0x45e078['query']['filter']+'%'};return _0x2c9e14;})});}_0x14e570=_['merge']({},_0x14e570,_0x45e078[_0xe614('0x53')]);return db[_0xe614('0x6b')][_0xe614('0x23')]({'where':_0x14e570[_0xe614('0x48')]})[_0xe614('0x29')](function(_0x30a984){_0x5f0bae['count']=_0x30a984;if(_0x45e078['query'][_0xe614('0x4e')]){_0x14e570[_0xe614('0x52')]=[{'all':!![]}];}return db[_0xe614('0x6b')]['findAll'](_0x14e570);})[_0xe614('0x29')](function(_0x2b9203){_0x5f0bae['rows']=_0x2b9203;return _0x5f0bae;});}})[_0xe614('0x29')](respondWithFilteredResult(_0x37a57b,_0x14e570))[_0xe614('0x54')](handleError(_0x37a57b,null));};exports[_0xe614('0x6c')]=function(_0x1ca92c,_0x5c2a0d,_0x42ad8b){var _0x1b6054={'raw':!![],'where':{}};var _0x20ba8c={};var _0x1f0bd7={'count':0x0,'rows':[]};return db[_0xe614('0x4d')][_0xe614('0x67')]({'where':{'id':_0x1ca92c[_0xe614('0x60')]['id']}})[_0xe614('0x29')](handleEntityNotFound(_0x5c2a0d,null))['then'](function(_0x30de15){if(_0x30de15){_0x20ba8c[_0xe614('0x40')]=_['keys'](db[_0xe614('0x6d')][_0xe614('0x3a')]);_0x20ba8c['query']=_['keys'](_0x1ca92c['query']);_0x20ba8c[_0xe614('0x49')]=_['intersection'](_0x20ba8c['model'],_0x20ba8c[_0xe614('0x3d')]);_0x1b6054[_0xe614('0x41')]=_[_0xe614('0x3f')](_0x20ba8c[_0xe614('0x40')],qs[_0xe614('0x42')](_0x1ca92c[_0xe614('0x3d')][_0xe614('0x42')]));_0x1b6054['attributes']=_0x1b6054[_0xe614('0x41')]['length']?_0x1b6054[_0xe614('0x41')]:_0x20ba8c[_0xe614('0x40')];if(!_0x1ca92c[_0xe614('0x3d')][_0xe614('0x44')](_0xe614('0x45'))){_0x1b6054['limit']=qs['limit'](_0x1ca92c[_0xe614('0x3d')][_0xe614('0x22')]);_0x1b6054[_0xe614('0x20')]=qs[_0xe614('0x20')](_0x1ca92c[_0xe614('0x3d')][_0xe614('0x20')]);}_0x1b6054[_0xe614('0x46')]=qs['sort'](_0x1ca92c['query'][_0xe614('0x47')]);_0x1b6054[_0xe614('0x48')]=qs[_0xe614('0x49')](_['pick'](_0x1ca92c['query'],_0x20ba8c[_0xe614('0x49')]));_0x1b6054[_0xe614('0x48')]['VoiceQueueId']=_0x30de15['id'];if(_0x1ca92c[_0xe614('0x3d')][_0xe614('0x2e')]){_0x1b6054['where']=_[_0xe614('0x4b')](_0x1b6054[_0xe614('0x48')],{'$or':_['map'](_0x1b6054['attributes'],function(_0x5e3863){var _0x150d6b={};_0x150d6b[_0x5e3863]={'$like':'%'+_0x1ca92c[_0xe614('0x3d')]['filter']+'%'};return _0x150d6b;})});}_0x1b6054=_[_0xe614('0x4b')]({},_0x1b6054,_0x1ca92c[_0xe614('0x53')]);return db[_0xe614('0x6d')]['count']({'where':_0x1b6054[_0xe614('0x48')]})['then'](function(_0xaa30b9){_0x1f0bd7[_0xe614('0x23')]=_0xaa30b9;if(_0x1ca92c[_0xe614('0x3d')][_0xe614('0x4e')]){_0x1b6054[_0xe614('0x52')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xe614('0x4f')](_0x1b6054);})['then'](function(_0x1c2278){_0x1f0bd7[_0xe614('0x50')]=_0x1c2278;return _0x1f0bd7;});}})[_0xe614('0x29')](respondWithFilteredResult(_0x5c2a0d,_0x1b6054))[_0xe614('0x54')](handleError(_0x5c2a0d,null));};exports[_0xe614('0x6e')]=function(_0xbaa716,_0x4239c6,_0x27319e){var _0x4b5f73={'raw':!![],'where':{}};var _0x32b2de={};var _0x14e955={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xe614('0x67')]({'where':{'id':_0xbaa716[_0xe614('0x60')]['id']}})[_0xe614('0x29')](handleEntityNotFound(_0x4239c6,null))[_0xe614('0x29')](function(_0x53ada6){if(_0x53ada6){_0x32b2de[_0xe614('0x40')]=_[_0xe614('0x3e')](db['CmHopperBlack'][_0xe614('0x3a')]);_0x32b2de[_0xe614('0x3d')]=_[_0xe614('0x3e')](_0xbaa716['query']);_0x32b2de[_0xe614('0x49')]=_[_0xe614('0x3f')](_0x32b2de['model'],_0x32b2de['query']);_0x4b5f73[_0xe614('0x41')]=_[_0xe614('0x3f')](_0x32b2de[_0xe614('0x40')],qs['fields'](_0xbaa716[_0xe614('0x3d')][_0xe614('0x42')]));_0x4b5f73[_0xe614('0x41')]=_0x4b5f73[_0xe614('0x41')][_0xe614('0x43')]?_0x4b5f73[_0xe614('0x41')]:_0x32b2de['model'];if(!_0xbaa716['query'][_0xe614('0x44')]('nolimit')){_0x4b5f73[_0xe614('0x22')]=qs[_0xe614('0x22')](_0xbaa716[_0xe614('0x3d')][_0xe614('0x22')]);_0x4b5f73['offset']=qs[_0xe614('0x20')](_0xbaa716[_0xe614('0x3d')][_0xe614('0x20')]);}_0x4b5f73['order']=qs[_0xe614('0x47')](_0xbaa716[_0xe614('0x3d')][_0xe614('0x47')]);_0x4b5f73['where']=qs[_0xe614('0x49')](_[_0xe614('0x4a')](_0xbaa716[_0xe614('0x3d')],_0x32b2de[_0xe614('0x49')]));_0x4b5f73['where'][_0xe614('0x68')]=_0x53ada6['id'];if(_0xbaa716[_0xe614('0x3d')]['filter']){_0x4b5f73[_0xe614('0x48')]=_['merge'](_0x4b5f73['where'],{'$or':_[_0xe614('0x30')](_0x4b5f73['attributes'],function(_0x4185de){var _0x525e8e={};_0x525e8e[_0x4185de]={'$like':'%'+_0xbaa716[_0xe614('0x3d')][_0xe614('0x2e')]+'%'};return _0x525e8e;})});}_0x4b5f73=_[_0xe614('0x4b')]({},_0x4b5f73,_0xbaa716['options']);return db[_0xe614('0x6f')][_0xe614('0x23')]({'where':_0x4b5f73[_0xe614('0x48')]})['then'](function(_0x32a5cc){_0x14e955[_0xe614('0x23')]=_0x32a5cc;if(_0xbaa716['query'][_0xe614('0x4e')]){_0x4b5f73[_0xe614('0x52')]=[{'all':!![]}];}return db[_0xe614('0x6f')][_0xe614('0x4f')](_0x4b5f73);})[_0xe614('0x29')](function(_0x19ff6f){_0x14e955[_0xe614('0x50')]=_0x19ff6f;return _0x14e955;});}})[_0xe614('0x29')](respondWithFilteredResult(_0x4239c6,_0x4b5f73))[_0xe614('0x54')](handleError(_0x4239c6,null));};exports['getTeams']=function(_0x562889,_0x533d91,_0x2c9f5f){var _0x22a7f2={};var _0x3a50ed={};var _0xc91a4a;var _0x50d639;return db['VoiceQueue'][_0xe614('0x67')]({'where':{'id':_0x562889['params']['id']}})['then'](handleEntityNotFound(_0x533d91,null))['then'](function(_0x5f7f25){if(_0x5f7f25){_0xc91a4a=_0x5f7f25;_0x3a50ed[_0xe614('0x40')]=_[_0xe614('0x3e')](db[_0xe614('0x70')][_0xe614('0x3a')]);_0x3a50ed[_0xe614('0x3d')]=_[_0xe614('0x3e')](_0x562889[_0xe614('0x3d')]);_0x3a50ed['filters']=_[_0xe614('0x3f')](_0x3a50ed['model'],_0x3a50ed['query']);_0x22a7f2['attributes']=_[_0xe614('0x3f')](_0x3a50ed[_0xe614('0x40')],qs[_0xe614('0x42')](_0x562889[_0xe614('0x3d')][_0xe614('0x42')]));_0x22a7f2[_0xe614('0x41')]=_0x22a7f2['attributes'][_0xe614('0x43')]?_0x22a7f2[_0xe614('0x41')]:_0x3a50ed['model'];_0x22a7f2[_0xe614('0x46')]=qs[_0xe614('0x47')](_0x562889['query'][_0xe614('0x47')]);_0x22a7f2[_0xe614('0x48')]=qs[_0xe614('0x49')](_['pick'](_0x562889[_0xe614('0x3d')],_0x3a50ed[_0xe614('0x49')]));if(_0x562889[_0xe614('0x3d')][_0xe614('0x2e')]){_0x22a7f2[_0xe614('0x48')]=_[_0xe614('0x4b')](_0x22a7f2[_0xe614('0x48')],{'$or':_['map'](_0x22a7f2[_0xe614('0x41')],function(_0x601acd){var _0x446556={};_0x446556[_0x601acd]={'$like':'%'+_0x562889['query']['filter']+'%'};return _0x446556;})});}_0x22a7f2=_[_0xe614('0x4b')]({},_0x22a7f2,_0x562889[_0xe614('0x53')]);return _0xc91a4a[_0xe614('0x71')](_0x22a7f2);}})[_0xe614('0x29')](function(_0x49756){if(_0x49756){_0x50d639=_0x49756[_0xe614('0x43')];if(!_0x562889['query'][_0xe614('0x44')](_0xe614('0x45'))){_0x22a7f2[_0xe614('0x22')]=qs['limit'](_0x562889[_0xe614('0x3d')][_0xe614('0x22')]);_0x22a7f2[_0xe614('0x20')]=qs['offset'](_0x562889['query'][_0xe614('0x20')]);}return _0xc91a4a['getTeams'](_0x22a7f2);}})[_0xe614('0x29')](function(_0x52554b){if(_0x52554b){return _0x52554b?{'count':_0x50d639,'rows':_0x52554b}:null;}})[_0xe614('0x29')](respondWithResult(_0x533d91,null))[_0xe614('0x54')](handleError(_0x533d91,null));};exports['addTeams']=function(_0x5c0e26,_0x5c8ccf,_0x2950a5){var _0x447398=_0x5c0e26[_0xe614('0x56')][_0xe614('0x72')];var _0x59b917=_[_0xe614('0x30')](_0x447398,'id');return db[_0xe614('0x70')][_0xe614('0x4f')]({'where':{'id':_0x59b917},'attributes':['id'],'include':[{'model':db[_0xe614('0x73')],'as':_0xe614('0x74'),'attributes':['id',_0xe614('0x35'),_0xe614('0x75'),_0xe614('0x76'),_0xe614('0x77')],'raw':!![]}]})[_0xe614('0x29')](function(_0x1b19df){if(_0x1b19df){var _0x1506cc=_[_0xe614('0x78')](_0x1b19df,function(_0x936a4b){var _0x1d49d4=_0x936a4b[_0xe614('0x2b')]({'plain':!![]});_0x1d49d4[_0xe614('0x74')][_0xe614('0x79')](function(_0x20a03f){_0x20a03f[_0xe614('0x7a')]=_[_0xe614('0x34')](_0x447398,{'id':_0x1d49d4['id']})['penalty'];});return _0x1d49d4[_0xe614('0x74')];});return db[_0xe614('0x4d')][_0xe614('0x34')]({'where':{'id':_0x5c0e26[_0xe614('0x60')]['id']}})[_0xe614('0x29')](function(_0xc5eaef){return db[_0xe614('0x7b')][_0xe614('0x7c')](function(_0x533f86){return _0xc5eaef[_0xe614('0x7d')](_0x59b917,{'transaction':_0x533f86})['then'](function(){return BPromise[_0xe614('0x7e')](_0x447398,function(_0x4b347d){return db[_0xe614('0x7f')][_0xe614('0x80')]({'TeamId':_0x4b347d['id'],'VoiceQueueId':_0x5c0e26[_0xe614('0x60')]['id'],'penalty':_0x4b347d[_0xe614('0x7a')]},{'transaction':_0x533f86});});})[_0xe614('0x29')](function(){return BPromise[_0xe614('0x7e')](_0x1506cc,function(_0x2e0f2a){return db['UserVoiceQueue']['findOrCreate']({'where':{'UserId':_0x2e0f2a['id'],'VoiceQueueId':_0x5c0e26[_0xe614('0x60')]['id']},'defaults':{'penalty':_0x2e0f2a[_0xe614('0x7a')]},'transaction':_0x533f86});});})[_0xe614('0x29')](function(){return BPromise[_0xe614('0x7e')](_[_0xe614('0x2e')](_0x1506cc,{'online':!![]}),function(_0x4023b1){return db['UserVoiceQueueRt']['upsert']({'membername':_0x4023b1['name'],'UserId':_0x4023b1['id'],'queue_name':_0xc5eaef[_0xe614('0x35')],'VoiceQueueId':_0xc5eaef['id'],'interface':_[_0xe614('0x81')](_0x4023b1['interface'])?util['format'](_0xe614('0x82'),_0x4023b1[_0xe614('0x35')]):_0x4023b1[_0xe614('0x77')],'paused':_0x4023b1['voicePause']||![],'penalty':_0x4023b1['penalty']},{'transaction':_0x533f86});});})['then'](function(){_0x1506cc['forEach'](function(_0x32774d){socket[_0xe614('0x83')](_0xe614('0x84'),{'UserId':_0x32774d['id'],'VoiceQueueId':_0xc5eaef['id']});});});});});}})[_0xe614('0x29')](respondWithStatusCode(_0x5c8ccf,null))['catch'](handleError(_0x5c8ccf,null));};exports[_0xe614('0x85')]=function(_0x3de484,_0x41bd3a,_0x54fb86){return db[_0xe614('0x70')][_0xe614('0x4f')]({'where':{'id':_0x3de484[_0xe614('0x3d')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe614('0x74'),'attributes':['id'],'raw':!![]}]})[_0xe614('0x29')](handleEntityNotFound(_0x41bd3a,null))[_0xe614('0x29')](function(_0x16d129){var _0x985362=_[_0xe614('0x30')](_0x16d129,'id');var _0x2ae2e8=[];var _0x1c342a=[];var _0x55a576=squel['select']();_0x55a576[_0xe614('0x86')](_0xe614('0x87'))['from'](_0xe614('0x88'),'tq')['join'](_0xe614('0x89'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xe614('0x8a'),_0x3de484['params']['id']);for(var _0x437f4c=0x0;_0x437f4c<_0x16d129[_0xe614('0x43')];_0x437f4c+=0x1){let _0x5f264b=_0x16d129[_0x437f4c];for(var _0x581438=0x0;_0x581438<_0x5f264b['Agents'][_0xe614('0x43')];_0x581438+=0x1){let _0x54a5f2=_0x5f264b[_0xe614('0x74')][_0x581438];var _0x5b5a03=_0x55a576['clone']();_0x5b5a03[_0xe614('0x48')](_0xe614('0x8b'),_0x54a5f2['id']);_0x1c342a[_0xe614('0x8c')](db[_0xe614('0x7b')][_0xe614('0x3d')](_0x5b5a03[_0xe614('0x8d')](),{'type':db[_0xe614('0x7b')][_0xe614('0x8e')][_0xe614('0x8f')]})[_0xe614('0x29')](function(_0x34d88e){if(_0x34d88e['length']===0x1){return _0x54a5f2['id'];}else{var _0x24852c=_[_0xe614('0x90')](_[_0xe614('0x30')](_0x34d88e,'TeamId'),function(_0x2fc579){return _[_0xe614('0x32')](_0x985362,_0x2fc579);});if(_0x24852c){return _0x54a5f2['id'];}}}));}}return BPromise[_0xe614('0x91')](_0x1c342a)[_0xe614('0x29')](function(_0x244726){_0x2ae2e8=_(_0x2ae2e8)[_0xe614('0x92')](_0x244726)[_0xe614('0x93')]()['value']();return db[_0xe614('0x4d')][_0xe614('0x34')]({'where':{'id':_0x3de484[_0xe614('0x60')]['id']}})['then'](function(_0x4b5657){return db['sequelize']['transaction'](function(_0x1bf7dd){return _0x4b5657[_0xe614('0x85')](_0x3de484[_0xe614('0x3d')][_0xe614('0x94')],{'transaction':_0x1bf7dd})[_0xe614('0x29')](function(){if(!_[_0xe614('0x95')](_0x2ae2e8)){return _0x4b5657[_0xe614('0x96')](_0x2ae2e8,{'transaction':_0x1bf7dd})[_0xe614('0x29')](function(){return db[_0xe614('0x97')][_0xe614('0x2a')]({'where':{'VoiceQueueId':_0x3de484['params']['id'],'UserId':_0x2ae2e8},'transaction':_0x1bf7dd});});}})[_0xe614('0x29')](function(){_0x2ae2e8['forEach'](function(_0x15e551){socket['emit'](_0xe614('0x98'),{'UserId':_0x15e551,'VoiceQueueId':_0x4b5657['id']});});});});});});})[_0xe614('0x29')](respondWithStatusCode(_0x41bd3a,null))['catch'](handleError(_0x41bd3a,null));};exports[_0xe614('0x99')]=function(_0x34a25a,_0x56b20b,_0x346b3d){var _0x39e3a1,_0x1cd6d0;return db['VoiceQueue'][_0xe614('0x34')]({'where':{'id':_0x34a25a[_0xe614('0x60')]['id']}})['then'](handleEntityNotFound(_0x56b20b,null))[_0xe614('0x29')](function(_0x1b840a){if(_0x1b840a){_0x1cd6d0=_0x1b840a;return _0x1b840a['addAgents'](_0x34a25a[_0xe614('0x56')][_0xe614('0x94')],_[_0xe614('0x61')](_0x34a25a[_0xe614('0x56')],[_0xe614('0x94'),'id'])||{})[_0xe614('0x9a')](function(_0x3cd83f){for(var _0x4c7ff3=0x0;_0x4c7ff3<_0x34a25a[_0xe614('0x56')]['ids'][_0xe614('0x43')];_0x4c7ff3+=0x1){socket[_0xe614('0x83')](_0xe614('0x84'),{'UserId':Number(_0x34a25a[_0xe614('0x56')][_0xe614('0x94')][_0x4c7ff3]),'VoiceQueueId':Number(_0x34a25a[_0xe614('0x60')]['id'])});}return _0x3cd83f;});}})['then'](function(_0xf3f99f){_0x39e3a1=_0xf3f99f||[];if(_0x1cd6d0){return db['User'][_0xe614('0x4f')]({'where':{'id':_0x34a25a[_0xe614('0x56')][_0xe614('0x94')]},'attributes':['id',_0xe614('0x35'),_0xe614('0x75'),_0xe614('0x76'),_0xe614('0x77')],'raw':!![]});}})[_0xe614('0x29')](function(_0x2c575d){if(!_[_0xe614('0x95')](_0x2c575d)){var _0x34ccb0=[];for(var _0x4d999a=0x0;_0x4d999a<_0x2c575d[_0xe614('0x43')];_0x4d999a++){if(_0x2c575d[_0x4d999a][_0xe614('0x75')]){_0x34ccb0['push'](db[_0xe614('0x97')][_0xe614('0x80')]({'membername':_0x2c575d[_0x4d999a][_0xe614('0x35')],'UserId':_0x2c575d[_0x4d999a]['id'],'queue_name':_0x1cd6d0[_0xe614('0x35')],'VoiceQueueId':_0x1cd6d0['id'],'interface':_[_0xe614('0x81')](_0x2c575d[_0x4d999a][_0xe614('0x77')])?util[_0xe614('0x9b')](_0xe614('0x82'),_0x2c575d[_0x4d999a]['name']):_0x2c575d[_0x4d999a]['interface'],'paused':_0x2c575d[_0x4d999a][_0xe614('0x76')]||![],'penalty':_0x34a25a[_0xe614('0x56')][_0xe614('0x7a')]||0x0}));}}return BPromise[_0xe614('0x91')](_0x34ccb0);}})[_0xe614('0x29')](function(){return _0x39e3a1;})[_0xe614('0x29')](respondWithResult(_0x56b20b,null))[_0xe614('0x54')](handleError(_0x56b20b,null));};exports[_0xe614('0x96')]=function(_0x2b3b58,_0x86219b,_0x4b8c5d){return db[_0xe614('0x4d')][_0xe614('0x34')]({'where':{'id':_0x2b3b58[_0xe614('0x60')]['id']}})[_0xe614('0x29')](handleEntityNotFound(_0x86219b,null))[_0xe614('0x29')](function(_0x34d12c){if(_0x34d12c){return _0x34d12c['removeAgents'](_0x2b3b58[_0xe614('0x3d')][_0xe614('0x94')])['then'](function(){if(_[_0xe614('0x9c')](_0x2b3b58[_0xe614('0x3d')][_0xe614('0x94')])){for(var _0x4b5e40=0x0;_0x4b5e40<_0x2b3b58[_0xe614('0x3d')][_0xe614('0x94')]['length'];_0x4b5e40+=0x1){socket['emit'](_0xe614('0x98'),{'UserId':Number(_0x2b3b58[_0xe614('0x3d')]['ids'][_0x4b5e40]),'VoiceQueueId':Number(_0x2b3b58[_0xe614('0x60')]['id'])});}}else{socket['emit']('userVoiceQueue:remove',{'UserId':Number(_0x2b3b58[_0xe614('0x3d')][_0xe614('0x94')]),'VoiceQueueId':Number(_0x2b3b58[_0xe614('0x60')]['id'])});}});}})[_0xe614('0x29')](function(_0x4542d8){return db[_0xe614('0x97')][_0xe614('0x2a')]({'where':{'VoiceQueueId':_0x2b3b58[_0xe614('0x60')]['id'],'UserId':_0x2b3b58['query'][_0xe614('0x94')]}})[_0xe614('0x29')](function(){return _0x4542d8;});})[_0xe614('0x29')](respondWithStatusCode(_0x86219b,null))[_0xe614('0x54')](handleError(_0x86219b,null));};exports[_0xe614('0x9d')]=function(_0x3055f5,_0x5c9986,_0x30da1d){var _0x5d1880={};var _0x40b660={};var _0x22608b;var _0x4b202b;return db['VoiceQueue'][_0xe614('0x67')]({'where':{'id':_0x3055f5['params']['id']}})['then'](handleEntityNotFound(_0x5c9986,null))[_0xe614('0x29')](function(_0x59af1b){if(_0x59af1b){_0x22608b=_0x59af1b;_0x40b660[_0xe614('0x40')]=_[_0xe614('0x3e')](db['User']['rawAttributes']);_0x40b660[_0xe614('0x3d')]=_['keys'](_0x3055f5[_0xe614('0x3d')]);_0x40b660[_0xe614('0x49')]=_[_0xe614('0x3f')](_0x40b660['model'],_0x40b660[_0xe614('0x3d')]);_0x5d1880[_0xe614('0x41')]=_['intersection'](_0x40b660[_0xe614('0x40')],qs[_0xe614('0x42')](_0x3055f5[_0xe614('0x3d')][_0xe614('0x42')]));_0x5d1880[_0xe614('0x41')]=_0x5d1880[_0xe614('0x41')]['length']?_0x5d1880[_0xe614('0x41')]:_0x40b660[_0xe614('0x40')];_0x5d1880[_0xe614('0x46')]=qs[_0xe614('0x47')](_0x3055f5[_0xe614('0x3d')][_0xe614('0x47')]);_0x5d1880[_0xe614('0x48')]=qs[_0xe614('0x49')](_[_0xe614('0x4a')](_0x3055f5['query'],_0x40b660[_0xe614('0x49')]));if(_0x3055f5['query'][_0xe614('0x2e')]){_0x5d1880[_0xe614('0x48')]=_[_0xe614('0x4b')](_0x5d1880[_0xe614('0x48')],{'$or':_[_0xe614('0x30')](_0x5d1880[_0xe614('0x41')],function(_0x387166){var _0x323f1e={};_0x323f1e[_0x387166]={'$like':'%'+_0x3055f5[_0xe614('0x3d')][_0xe614('0x2e')]+'%'};return _0x323f1e;})});}_0x5d1880=_[_0xe614('0x4b')]({},_0x5d1880,_0x3055f5[_0xe614('0x53')]);return _0x22608b[_0xe614('0x9d')](_0x5d1880);}})[_0xe614('0x29')](function(_0x26e4ca){if(_0x26e4ca){_0x4b202b=_0x26e4ca[_0xe614('0x43')];if(!_0x3055f5[_0xe614('0x3d')][_0xe614('0x44')](_0xe614('0x45'))){_0x5d1880[_0xe614('0x22')]=qs['limit'](_0x3055f5[_0xe614('0x3d')][_0xe614('0x22')]);_0x5d1880[_0xe614('0x20')]=qs['offset'](_0x3055f5['query'][_0xe614('0x20')]);}return _0x22608b[_0xe614('0x9d')](_0x5d1880);}})[_0xe614('0x29')](function(_0x3337f6){if(_0x3337f6){return _0x3337f6?{'count':_0x4b202b,'rows':_0x3337f6}:null;}})['then'](respondWithResult(_0x5c9986,null))['catch'](handleError(_0x5c9986,null));};exports['getMembers']=function(_0x33da6c,_0x5e3d6e,_0x4fd7a4){var _0x5da689={};var _0x575c4c={};var _0x560ff0;var _0x344570;return db[_0xe614('0x4d')][_0xe614('0x67')]({'where':{'id':_0x33da6c[_0xe614('0x60')]['id']}})[_0xe614('0x29')](handleEntityNotFound(_0x5e3d6e,null))['then'](function(_0xa232f7){if(_0xa232f7){_0x560ff0=_0xa232f7;_0x575c4c[_0xe614('0x40')]=_[_0xe614('0x3e')](db[_0xe614('0x97')]['rawAttributes']);_0x575c4c[_0xe614('0x3d')]=_['keys'](_0x33da6c[_0xe614('0x3d')]);_0x575c4c[_0xe614('0x49')]=_[_0xe614('0x3f')](_0x575c4c[_0xe614('0x40')],_0x575c4c[_0xe614('0x3d')]);_0x5da689[_0xe614('0x41')]=_[_0xe614('0x3f')](_0x575c4c[_0xe614('0x40')],qs[_0xe614('0x42')](_0x33da6c[_0xe614('0x3d')][_0xe614('0x42')]));_0x5da689['attributes']=_0x5da689[_0xe614('0x41')][_0xe614('0x43')]?_0x5da689[_0xe614('0x41')]:_0x575c4c[_0xe614('0x40')];_0x5da689[_0xe614('0x46')]=qs[_0xe614('0x47')](_0x33da6c[_0xe614('0x3d')]['sort']);_0x5da689['where']=qs['filters'](_[_0xe614('0x4a')](_0x33da6c['query'],_0x575c4c[_0xe614('0x49')]));if(_0x33da6c[_0xe614('0x3d')][_0xe614('0x2e')]){_0x5da689[_0xe614('0x48')]=_[_0xe614('0x4b')](_0x5da689[_0xe614('0x48')],{'$or':_[_0xe614('0x30')](_0x5da689[_0xe614('0x41')],function(_0x64436c){var _0x1676ae={};_0x1676ae[_0x64436c]={'$like':'%'+_0x33da6c[_0xe614('0x3d')]['filter']+'%'};return _0x1676ae;})});}_0x5da689=_['merge']({},_0x5da689,_0x33da6c[_0xe614('0x53')]);return _0x560ff0[_0xe614('0x9e')](_0x5da689);}})[_0xe614('0x29')](function(_0x2df8f3){if(_0x2df8f3){_0x344570=_0x2df8f3[_0xe614('0x43')];if(!_0x33da6c[_0xe614('0x3d')][_0xe614('0x44')]('nolimit')){_0x5da689[_0xe614('0x22')]=qs[_0xe614('0x22')](_0x33da6c['query'][_0xe614('0x22')]);_0x5da689[_0xe614('0x20')]=qs['offset'](_0x33da6c[_0xe614('0x3d')][_0xe614('0x20')]);}return _0x560ff0[_0xe614('0x9e')](_0x5da689);}})[_0xe614('0x29')](function(_0x22c6ce){return _0x22c6ce?{'count':_0x344570,'rows':_0x22c6ce}:null;})['then'](respondWithResult(_0x5e3d6e,null))['catch'](handleError(_0x5e3d6e,null));};exports[_0xe614('0x9f')]=function(_0x2846f6,_0x108197,_0x4381ac){var _0x1a5efc={};var _0x5e5c9c={};var _0x413c00;var _0x32122a;return db[_0xe614('0x4d')][_0xe614('0x67')]({'where':{'id':_0x2846f6[_0xe614('0x60')]['id']}})[_0xe614('0x29')](handleEntityNotFound(_0x108197,null))[_0xe614('0x29')](function(_0x1a19fb){if(_0x1a19fb){_0x413c00=_0x1a19fb;_0x5e5c9c['model']=_[_0xe614('0x3e')](db['CmList'][_0xe614('0x3a')]);_0x5e5c9c[_0xe614('0x3d')]=_[_0xe614('0x3e')](_0x2846f6[_0xe614('0x3d')]);_0x5e5c9c[_0xe614('0x49')]=_[_0xe614('0x3f')](_0x5e5c9c[_0xe614('0x40')],_0x5e5c9c[_0xe614('0x3d')]);_0x1a5efc['attributes']=_[_0xe614('0x3f')](_0x5e5c9c['model'],qs['fields'](_0x2846f6[_0xe614('0x3d')]['fields']));_0x1a5efc[_0xe614('0x41')]=_0x1a5efc[_0xe614('0x41')]['length']?_0x1a5efc['attributes']:_0x5e5c9c[_0xe614('0x40')];_0x1a5efc[_0xe614('0x46')]=qs['sort'](_0x2846f6[_0xe614('0x3d')][_0xe614('0x47')]);_0x1a5efc[_0xe614('0x48')]=qs[_0xe614('0x49')](_[_0xe614('0x4a')](_0x2846f6['query'],_0x5e5c9c[_0xe614('0x49')]));if(_0x2846f6[_0xe614('0x3d')]['filter']){_0x1a5efc[_0xe614('0x48')]=_[_0xe614('0x4b')](_0x1a5efc[_0xe614('0x48')],{'$or':_[_0xe614('0x30')](_0x1a5efc['attributes'],function(_0x28dab5){var _0x4f99f4={};_0x4f99f4[_0x28dab5]={'$like':'%'+_0x2846f6[_0xe614('0x3d')][_0xe614('0x2e')]+'%'};return _0x4f99f4;})});}_0x1a5efc=_['merge']({},_0x1a5efc,_0x2846f6[_0xe614('0x53')]);return _0x413c00[_0xe614('0x9f')](_0x1a5efc);}})[_0xe614('0x29')](function(_0x2db88c){if(_0x2db88c){_0x32122a=_0x2db88c[_0xe614('0x43')];if(!_0x2846f6['query']['hasOwnProperty'](_0xe614('0x45'))){_0x1a5efc['limit']=qs[_0xe614('0x22')](_0x2846f6[_0xe614('0x3d')][_0xe614('0x22')]);_0x1a5efc[_0xe614('0x20')]=qs[_0xe614('0x20')](_0x2846f6[_0xe614('0x3d')][_0xe614('0x20')]);}return _0x413c00[_0xe614('0x9f')](_0x1a5efc);}})[_0xe614('0x29')](function(_0x33c6b8){if(_0x33c6b8){return _0x33c6b8?{'count':_0x32122a,'rows':_0x33c6b8}:null;}})[_0xe614('0x29')](respondWithResult(_0x108197,null))[_0xe614('0x54')](handleError(_0x108197,null));};exports[_0xe614('0xa0')]=function(_0x2bf436,_0x14d239,_0x57921e){var _0x35aa31,_0x36d6a5;return db[_0xe614('0x4d')]['find']({'where':{'id':_0x2bf436['params']['id']}})[_0xe614('0x29')](handleEntityNotFound(_0x14d239,null))['then'](function(_0x5b8440){if(_0x5b8440){_0x36d6a5=_0x5b8440;return _0x5b8440[_0xe614('0xa0')](_0x2bf436[_0xe614('0x56')][_0xe614('0x94')],_[_0xe614('0x61')](_0x2bf436[_0xe614('0x56')],['ids','id'])||{});}return null;})['spread'](function(_0x5e1995){var _0x4d694f;_0x35aa31=_0x5e1995||[];var _0x1a92a5=[];if(_0x5e1995){for(var _0x5e1702=0x0;_0x5e1702<_0x5e1995[_0xe614('0x43')];_0x5e1702+=0x1){var _0x546a51=_0x5e1995[_0x5e1702][_0xe614('0x2b')]({'plain':!![]});_0x36d6a5[_0xe614('0xa1')]=_0x2bf436['body'][_0xe614('0xa1')]?_0x2bf436['body'][_0xe614('0xa1')]:_0x36d6a5['dialCheckDuplicateType'];switch(_0x36d6a5[_0xe614('0xa1')]){case'always':_0x4d694f=squel[_0xe614('0xa2')]()[_0xe614('0xa3')](_0xe614('0xa4'))[_0xe614('0xa5')](['phone',_0xe614('0xa6'),_0xe614('0xa7'),_0xe614('0xa8'),_0xe614('0x68'),_0xe614('0x62'),'updatedAt'],squel[_0xe614('0xa9')]()[_0xe614('0x86')](_0xe614('0xaa'),_0xe614('0xaa'))[_0xe614('0x86')]('NOW()',_0xe614('0xa6'))[_0xe614('0x86')]('id','ContactId')[_0xe614('0x86')](_0x546a51['CmListId'][_0xe614('0x8d')](),_0xe614('0xa8'))[_0xe614('0x86')](_0x2bf436[_0xe614('0x60')]['id'][_0xe614('0x8d')](),'VoiceQueueId')['field']('NOW()','createdAt')['field'](_0xe614('0xab'),_0xe614('0x63'))[_0xe614('0xac')](_0xe614('0xad'))[_0xe614('0x48')]('deletedAt\x20IS\x20NULL')[_0xe614('0x48')](_0xe614('0xae'),_0x546a51['CmListId']['toString']())['where'](_0xe614('0xaf'))['where'](_0xe614('0xb0'),squel[_0xe614('0xa9')]()[_0xe614('0x86')](_0xe614('0xb1'))[_0xe614('0xac')](_0xe614('0xb2'))['where'](_0xe614('0x8a'),_0x2bf436[_0xe614('0x60')]['id'][_0xe614('0x8d')]()))['where'](_0xe614('0xb0'),squel[_0xe614('0xa9')]()['field'](_0xe614('0xb3'))[_0xe614('0xac')](_0xe614('0xa4'))['where'](_0xe614('0x8a'),_0x2bf436[_0xe614('0x60')]['id'][_0xe614('0x8d')]())))[_0xe614('0x8d')]();break;case _0xe614('0xb4'):_0x4d694f=squel['insert']()[_0xe614('0xa3')](_0xe614('0xa4'))['fromQuery'](['phone',_0xe614('0xa6'),_0xe614('0xa7'),'ListId','VoiceQueueId','createdAt',_0xe614('0x63')],squel[_0xe614('0xa9')]()[_0xe614('0x86')](_0xe614('0xaa'),_0xe614('0xaa'))[_0xe614('0x86')](_0xe614('0xab'),_0xe614('0xa6'))[_0xe614('0x86')]('id','ContactId')[_0xe614('0x86')](_0x546a51['CmListId'][_0xe614('0x8d')](),_0xe614('0xa8'))[_0xe614('0x86')](_0x2bf436[_0xe614('0x60')]['id'][_0xe614('0x8d')](),_0xe614('0x68'))[_0xe614('0x86')]('NOW()',_0xe614('0x62'))[_0xe614('0x86')](_0xe614('0xab'),_0xe614('0x63'))[_0xe614('0xac')](_0xe614('0xad'))[_0xe614('0x48')](_0xe614('0xb5'))[_0xe614('0x48')](_0xe614('0xae'),_0x546a51[_0xe614('0xb6')]['toString']())[_0xe614('0x48')](_0xe614('0xaf'))[_0xe614('0x48')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xe614('0x86')](_0xe614('0xb3'))['from']('cm_hopper')[_0xe614('0x48')](_0xe614('0x8a'),_0x2bf436['params']['id']['toString']())))['toString']();break;default:_0x4d694f=squel[_0xe614('0xa2')]()[_0xe614('0xa3')](_0xe614('0xa4'))['fromQuery']([_0xe614('0xaa'),_0xe614('0xa6'),'ContactId',_0xe614('0xa8'),'VoiceQueueId',_0xe614('0x62'),'updatedAt'],squel[_0xe614('0xa9')]()[_0xe614('0x86')](_0xe614('0xaa'),'phone')[_0xe614('0x86')]('NOW()',_0xe614('0xa6'))[_0xe614('0x86')]('id',_0xe614('0xa7'))['field'](_0x546a51['CmListId'][_0xe614('0x8d')](),_0xe614('0xa8'))[_0xe614('0x86')](_0x2bf436[_0xe614('0x60')]['id'][_0xe614('0x8d')](),_0xe614('0x68'))[_0xe614('0x86')](_0xe614('0xab'),'createdAt')[_0xe614('0x86')](_0xe614('0xab'),_0xe614('0x63'))['from']('cm_contacts')[_0xe614('0x48')](_0xe614('0xb5'))[_0xe614('0x48')](_0xe614('0xae'),_0x546a51[_0xe614('0xb6')][_0xe614('0x8d')]())[_0xe614('0x48')](_0xe614('0xaf')))[_0xe614('0x8d')]();}_0x1a92a5[_0xe614('0x8c')](db[_0xe614('0x7b')]['query'](_0x4d694f));}return BPromise[_0xe614('0x91')](_0x1a92a5);}})[_0xe614('0x29')](function(){return _0x35aa31;})[_0xe614('0x29')](respondWithResult(_0x14d239,null))[_0xe614('0x54')](handleError(_0x14d239,null));};exports[_0xe614('0xb7')]=function(_0x31b22b,_0x4a7143,_0x3514d3){return db[_0xe614('0x4d')][_0xe614('0x34')]({'where':{'id':_0x31b22b['params']['id']}})['then'](handleEntityNotFound(_0x4a7143,null))[_0xe614('0x29')](function(_0x4d983b){if(_0x4d983b){return _0x4d983b[_0xe614('0xb7')](_0x31b22b['query'][_0xe614('0x94')]);}})[_0xe614('0x29')](function(_0x50fa31){if(_0x50fa31){return db[_0xe614('0x69')][_0xe614('0x2a')]({'where':{'ListId':_0x31b22b[_0xe614('0x3d')][_0xe614('0x94')],'VoiceQueueId':_0x31b22b[_0xe614('0x60')]['id']}})[_0xe614('0x29')](function(){return _0x50fa31;});}})[_0xe614('0x29')](respondWithStatusCode(_0x4a7143,null))[_0xe614('0x54')](handleError(_0x4a7143,null));};exports[_0xe614('0xb8')]=function(_0x1230e6,_0x485c7a,_0x3d8e6b){var _0x5ee142={};var _0x488d63={};var _0x9b7f5c;var _0x5b1a99;return db[_0xe614('0x4d')][_0xe614('0x67')]({'where':{'id':_0x1230e6[_0xe614('0x60')]['id']}})['then'](handleEntityNotFound(_0x485c7a,null))[_0xe614('0x29')](function(_0x1d7857){if(_0x1d7857){_0x9b7f5c=_0x1d7857;_0x488d63[_0xe614('0x40')]=_[_0xe614('0x3e')](db[_0xe614('0xb9')][_0xe614('0x3a')]);_0x488d63[_0xe614('0x3d')]=_['keys'](_0x1230e6[_0xe614('0x3d')]);_0x488d63[_0xe614('0x49')]=_[_0xe614('0x3f')](_0x488d63['model'],_0x488d63['query']);_0x5ee142['attributes']=_[_0xe614('0x3f')](_0x488d63['model'],qs['fields'](_0x1230e6[_0xe614('0x3d')]['fields']));_0x5ee142[_0xe614('0x41')]=_0x5ee142[_0xe614('0x41')][_0xe614('0x43')]?_0x5ee142[_0xe614('0x41')]:_0x488d63[_0xe614('0x40')];_0x5ee142[_0xe614('0x46')]=qs[_0xe614('0x47')](_0x1230e6[_0xe614('0x3d')][_0xe614('0x47')]);_0x5ee142[_0xe614('0x48')]=qs[_0xe614('0x49')](_[_0xe614('0x4a')](_0x1230e6[_0xe614('0x3d')],_0x488d63[_0xe614('0x49')]));if(_0x1230e6[_0xe614('0x3d')][_0xe614('0x2e')]){_0x5ee142[_0xe614('0x48')]=_[_0xe614('0x4b')](_0x5ee142[_0xe614('0x48')],{'$or':_['map'](_0x5ee142['attributes'],function(_0x302dec){var _0x14592c={};_0x14592c[_0x302dec]={'$like':'%'+_0x1230e6[_0xe614('0x3d')][_0xe614('0x2e')]+'%'};return _0x14592c;})});}_0x5ee142=_['merge']({},_0x5ee142,_0x1230e6[_0xe614('0x53')]);return _0x9b7f5c[_0xe614('0xb8')](_0x5ee142);}})[_0xe614('0x29')](function(_0x5a78cc){if(_0x5a78cc){_0x5b1a99=_0x5a78cc['length'];if(!_0x1230e6[_0xe614('0x3d')]['hasOwnProperty']('nolimit')){_0x5ee142['limit']=qs[_0xe614('0x22')](_0x1230e6['query'][_0xe614('0x22')]);_0x5ee142[_0xe614('0x20')]=qs[_0xe614('0x20')](_0x1230e6[_0xe614('0x3d')]['offset']);}return _0x9b7f5c[_0xe614('0xb8')](_0x5ee142);}})[_0xe614('0x29')](function(_0x2dce9d){if(_0x2dce9d){return _0x2dce9d?{'count':_0x5b1a99,'rows':_0x2dce9d}:null;}})['then'](respondWithResult(_0x485c7a,null))[_0xe614('0x54')](handleError(_0x485c7a,null));};exports[_0xe614('0xba')]=function(_0x2c9847,_0x22bea1,_0x43e119){var _0x1cc38f,_0x6dfcdb;return db[_0xe614('0x4d')][_0xe614('0x34')]({'where':{'id':_0x2c9847[_0xe614('0x60')]['id']}})[_0xe614('0x29')](handleEntityNotFound(_0x22bea1,null))[_0xe614('0x29')](function(_0x2255c4){if(_0x2255c4){_0x6dfcdb=_0x2255c4;return _0x2255c4['addBlackLists'](_0x2c9847[_0xe614('0x56')]['ids'],_['omit'](_0x2c9847[_0xe614('0x56')],['ids','id'])||{});}return null;})[_0xe614('0x9a')](function(_0x3268fd){var _0x4efb56;_0x1cc38f=_0x3268fd||[];var _0x3a4473=[];if(_0x3268fd){for(var _0x4fcf93=0x0;_0x4fcf93<_0x3268fd[_0xe614('0x43')];_0x4fcf93+=0x1){var _0x2bb962=_0x3268fd[_0x4fcf93][_0xe614('0x2b')]({'plain':!![]});_0x4efb56=squel[_0xe614('0xa2')]()['into'](_0xe614('0xbb'))[_0xe614('0xa5')]([_0xe614('0xaa'),'ContactId','ListId','VoiceQueueId',_0xe614('0x62'),_0xe614('0x63')],squel[_0xe614('0xa9')]()[_0xe614('0x86')]('phone','phone')[_0xe614('0x86')]('id',_0xe614('0xa7'))['field'](_0x2bb962[_0xe614('0xb6')][_0xe614('0x8d')](),_0xe614('0xa8'))[_0xe614('0x86')](_0x2c9847[_0xe614('0x60')]['id'][_0xe614('0x8d')](),_0xe614('0x68'))[_0xe614('0x86')](_0xe614('0xab'),_0xe614('0x62'))[_0xe614('0x86')](_0xe614('0xab'),_0xe614('0x63'))[_0xe614('0xac')](_0xe614('0xad'))[_0xe614('0x48')](_0xe614('0xb5'))['where'](_0xe614('0xae'),_0x2bb962[_0xe614('0xb6')][_0xe614('0x8d')]())[_0xe614('0x48')]('phone\x20IS\x20NOT\x20NULL'))[_0xe614('0x8d')]();_0x3a4473[_0xe614('0x8c')](db['sequelize'][_0xe614('0x3d')](_0x4efb56));}return BPromise[_0xe614('0x91')](_0x3a4473);}})[_0xe614('0x29')](function(){return _0x1cc38f;})['then'](respondWithResult(_0x22bea1,null))[_0xe614('0x54')](handleError(_0x22bea1,null));};exports[_0xe614('0xbc')]=function(_0x56d333,_0x2dd9b8,_0x4e76b7){return db['VoiceQueue'][_0xe614('0x34')]({'where':{'id':_0x56d333[_0xe614('0x60')]['id']}})[_0xe614('0x29')](handleEntityNotFound(_0x2dd9b8,null))[_0xe614('0x29')](function(_0x47277d){if(_0x47277d){return _0x47277d[_0xe614('0xbc')](_0x56d333[_0xe614('0x3d')][_0xe614('0x94')]);}})[_0xe614('0x29')](function(_0x15af2c){if(_0x15af2c){return db[_0xe614('0x6f')]['destroy']({'where':{'ListId':_0x56d333[_0xe614('0x3d')][_0xe614('0x94')],'VoiceQueueId':_0x56d333['params']['id']}})[_0xe614('0x29')](function(){return _0x15af2c;});}})[_0xe614('0x29')](respondWithStatusCode(_0x2dd9b8,null))[_0xe614('0x54')](handleError(_0x2dd9b8,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 96af46a..25c9e61 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 _0x0a3b=['events','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x48116b,_0x29424c){var _0x5cc9fa=function(_0x267ab6){while(--_0x267ab6){_0x48116b['push'](_0x48116b['shift']());}};_0x5cc9fa(++_0x29424c);}(_0x0a3b,0xe0));var _0xb0a3=function(_0x53bcc3,_0x364374){_0x53bcc3=_0x53bcc3-0x0;var _0x47c959=_0x0a3b[_0x53bcc3];return _0x47c959;};'use strict';var EventEmitter=require(_0xb0a3('0x0'));var VoiceQueue=require('../../mysqldb')['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xb0a3('0x1')](0x0);var events={'afterCreate':_0xb0a3('0x2'),'afterUpdate':_0xb0a3('0x3'),'afterDestroy':_0xb0a3('0x4')};function emitEvent(_0x2fe060){return function(_0x2dddbc,_0x24e1fa,_0x137e9c){VoiceQueueEvents[_0xb0a3('0x5')](_0x2fe060+':'+_0x2dddbc['id'],_0x2dddbc);VoiceQueueEvents[_0xb0a3('0x5')](_0x2fe060,_0x2dddbc);_0x137e9c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0xb0a3('0x6')](e,emitEvent(event));}}module[_0xb0a3('0x7')]=VoiceQueueEvents; \ No newline at end of file +var _0x65ea=['save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x108d5f,_0x33f82d){var _0x456ea3=function(_0x228200){while(--_0x228200){_0x108d5f['push'](_0x108d5f['shift']());}};_0x456ea3(++_0x33f82d);}(_0x65ea,0x1b7));var _0xa65e=function(_0x596ebe,_0x53fd6a){_0x596ebe=_0x596ebe-0x0;var _0x4cb7e0=_0x65ea[_0x596ebe];return _0x4cb7e0;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0xa65e('0x0'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa65e('0x1'),'afterUpdate':_0xa65e('0x2'),'afterDestroy':_0xa65e('0x3')};function emitEvent(_0x1aaa30){return function(_0x3aeb59,_0x4c5d5b,_0x594efc){VoiceQueueEvents['emit'](_0x1aaa30+':'+_0x3aeb59['id'],_0x3aeb59);VoiceQueueEvents[_0xa65e('0x4')](_0x1aaa30,_0x3aeb59);_0x594efc(null);};}for(var e in events){if(events[_0xa65e('0x5')](e)){var event=events[e];VoiceQueue[_0xa65e('0x6')](e,emitEvent(event));}}module[_0xa65e('0x7')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index d53370e..0b64075 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 _0x3e74=['exports','VoiceQueue','voice_queues','lodash','../../config/logger','api','moment','path','../../config/environment','./voiceQueue.attributes'];(function(_0xd93b26,_0x12bbf2){var _0x25f668=function(_0x133ff7){while(--_0x133ff7){_0xd93b26['push'](_0xd93b26['shift']());}};_0x25f668(++_0x12bbf2);}(_0x3e74,0x175));var _0x43e7=function(_0x23a376,_0x49f290){_0x23a376=_0x23a376-0x0;var _0xff6b0b=_0x3e74[_0x23a376];return _0xff6b0b;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x008c=['define','voice_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports'];(function(_0xd2f4f5,_0x341930){var _0x41fc10=function(_0x496824){while(--_0x496824){_0xd2f4f5['push'](_0xd2f4f5['shift']());}};_0x41fc10(++_0x341930);}(_0x008c,0x188));var _0xc008=function(_0x149c1f,_0x7b4dc6){_0x149c1f=_0x149c1f-0x0;var _0x309eeb=_0x008c[_0x149c1f];return _0x309eeb;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('VoiceQueue',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 0b7630e..69c4862 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 _0x511d=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','request','then','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetVoiceQueue','VoiceQueue','findAll','raw','options','attributes','limit','include','map','model','ShowVoiceQueue','find','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x531ef1,_0x53c97e){var _0x50dd44=function(_0x8c82b4){while(--_0x8c82b4){_0x531ef1['push'](_0x531ef1['shift']());}};_0x50dd44(++_0x53c97e);}(_0x511d,0x1bd));var _0xd511=function(_0x8a969d,_0x339d9f){_0x8a969d=_0x8a969d-0x0;var _0x1d8dc7=_0x511d[_0x8a969d];return _0x1d8dc7;};'use strict';var _=require(_0xd511('0x0'));var util=require(_0xd511('0x1'));var moment=require(_0xd511('0x2'));var BPromise=require(_0xd511('0x3'));var rs=require(_0xd511('0x4'));var fs=require('fs');var Redis=require(_0xd511('0x5'));var db=require(_0xd511('0x6'))['db'];var utils=require(_0xd511('0x7'));var logger=require('../../config/logger')(_0xd511('0x8'));var config=require(_0xd511('0x9'));var jayson=require(_0xd511('0xa'));var client=jayson[_0xd511('0xb')]['http']({'port':0x232a});config[_0xd511('0xc')]=_[_0xd511('0xd')](config[_0xd511('0xc')],{'host':_0xd511('0xe'),'port':0x18eb});var socket=require(_0xd511('0xf'))(new Redis(config[_0xd511('0xc')]));require(_0xd511('0x10'))['register'](socket);function respondWithRpcPromise(_0x49a64c,_0x5c69dd,_0x2ee775){return new BPromise(function(_0x2ca1eb,_0x29b80f){return client[_0xd511('0x11')](_0x49a64c,_0x2ee775)[_0xd511('0x12')](function(_0x2e813c){logger['info'](_0xd511('0x13'),_0x5c69dd,_0xd511('0x14'));logger[_0xd511('0x15')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x5c69dd,_0xd511('0x14'),JSON[_0xd511('0x16')](_0x2e813c));if(_0x2e813c[_0xd511('0x17')]){if(_0x2e813c[_0xd511('0x17')][_0xd511('0x18')]===0x1f4){logger['error']('VoiceQueue,\x20%s,\x20%s',_0x5c69dd,_0x2e813c[_0xd511('0x17')]['message']);return _0x29b80f(_0x2e813c[_0xd511('0x17')][_0xd511('0x19')]);}logger['error'](_0xd511('0x13'),_0x5c69dd,_0x2e813c[_0xd511('0x17')][_0xd511('0x19')]);return _0x2ca1eb(_0x2e813c[_0xd511('0x17')][_0xd511('0x19')]);}else{logger[_0xd511('0x1a')]('VoiceQueue,\x20%s,\x20%s',_0x5c69dd,_0xd511('0x14'));_0x2ca1eb(_0x2e813c[_0xd511('0x1b')]['message']);}})[_0xd511('0x1c')](function(_0x17c919){logger['error'](_0xd511('0x13'),_0x5c69dd,_0x17c919);_0x29b80f(_0x17c919);});});}exports[_0xd511('0x1d')]=function(_0x39b691){var _0x3e79b5=this;return new Promise(function(_0x1029a8,_0x1e28f8){return db[_0xd511('0x1e')][_0xd511('0x1f')]({'raw':_0x39b691['options']?_0x39b691['options'][_0xd511('0x20')]===undefined?!![]:![]:!![],'where':_0x39b691[_0xd511('0x21')]?_0x39b691[_0xd511('0x21')]['where']||null:null,'attributes':_0x39b691[_0xd511('0x21')]?_0x39b691[_0xd511('0x21')][_0xd511('0x22')]||null:null,'limit':_0x39b691[_0xd511('0x21')]?_0x39b691[_0xd511('0x21')][_0xd511('0x23')]||null:null,'include':_0x39b691['options']?_0x39b691['options'][_0xd511('0x24')]?_[_0xd511('0x25')](_0x39b691[_0xd511('0x21')]['include'],function(_0x7538a5){return{'model':db[_0x7538a5['model']],'as':_0x7538a5['as'],'attributes':_0x7538a5[_0xd511('0x22')],'include':_0x7538a5['include']?_['map'](_0x7538a5[_0xd511('0x24')],function(_0x24e278){return{'model':db[_0x24e278[_0xd511('0x26')]],'as':_0x24e278['as'],'attributes':_0x24e278['attributes'],'include':_0x24e278[_0xd511('0x24')]?_['map'](_0x24e278['include'],function(_0x47684d){return{'model':db[_0x47684d[_0xd511('0x26')]],'as':_0x47684d['as'],'attributes':_0x47684d[_0xd511('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5c9b21){logger[_0xd511('0x1a')]('GetVoiceQueue',_0x39b691);logger[_0xd511('0x15')](_0xd511('0x1d'),_0x39b691,JSON['stringify'](_0x5c9b21));_0x1029a8(_0x5c9b21);})[_0xd511('0x1c')](function(_0x1c5af2){logger['error'](_0xd511('0x1d'),_0x1c5af2[_0xd511('0x19')],_0x39b691);_0x1e28f8(_0x3e79b5['error'](0x1f4,_0x1c5af2[_0xd511('0x19')]));});});};exports[_0xd511('0x27')]=function(_0x9da125){var _0x26c3a5=this;return new Promise(function(_0x52a4f7,_0x526930){return db[_0xd511('0x1e')][_0xd511('0x28')]({'raw':_0x9da125[_0xd511('0x21')]?_0x9da125['options'][_0xd511('0x20')]===undefined?!![]:![]:!![],'where':_0x9da125[_0xd511('0x21')]?_0x9da125[_0xd511('0x21')]['where']||null:null,'attributes':_0x9da125[_0xd511('0x21')]?_0x9da125['options'][_0xd511('0x22')]||null:null,'include':_0x9da125[_0xd511('0x21')]?_0x9da125[_0xd511('0x21')][_0xd511('0x24')]?_[_0xd511('0x25')](_0x9da125[_0xd511('0x21')][_0xd511('0x24')],function(_0x2cb605){return{'model':db[_0x2cb605['model']],'as':_0x2cb605['as'],'attributes':_0x2cb605[_0xd511('0x22')],'include':_0x2cb605['include']?_[_0xd511('0x25')](_0x2cb605['include'],function(_0x254686){return{'model':db[_0x254686['model']],'as':_0x254686['as'],'attributes':_0x254686[_0xd511('0x22')],'include':_0x254686[_0xd511('0x24')]?_[_0xd511('0x25')](_0x254686[_0xd511('0x24')],function(_0x44ccfd){return{'model':db[_0x44ccfd['model']],'as':_0x44ccfd['as'],'attributes':_0x44ccfd[_0xd511('0x22')]};}):[]};}):[]};}):[]:[]})[_0xd511('0x12')](function(_0x4bc00a){logger[_0xd511('0x1a')](_0xd511('0x27'),_0x9da125);logger[_0xd511('0x15')](_0xd511('0x27'),_0x9da125,JSON[_0xd511('0x16')](_0x4bc00a));_0x52a4f7(_0x4bc00a);})['catch'](function(_0x5221b2){logger['error'](_0xd511('0x27'),_0x5221b2[_0xd511('0x19')],_0x9da125);_0x526930(_0x26c3a5['error'](0x1f4,_0x5221b2[_0xd511('0x19')]));});});}; \ No newline at end of file +var _0x130d=['client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','where','include','map','attributes','model','then','ShowVoiceQueue','raw','util','moment','bluebird','randomstring','../../config/logger','jayson/promise'];(function(_0xd576a0,_0x36cc02){var _0x3ff77c=function(_0x149512){while(--_0x149512){_0xd576a0['push'](_0xd576a0['shift']());}};_0x3ff77c(++_0x36cc02);}(_0x130d,0x1aa));var _0xd130=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x130d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xd130('0x0'));var moment=require(_0xd130('0x1'));var BPromise=require(_0xd130('0x2'));var rs=require(_0xd130('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd130('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd130('0x5'));var client=jayson[_0xd130('0x6')][_0xd130('0x7')]({'port':0x232a});config[_0xd130('0x8')]=_[_0xd130('0x9')](config[_0xd130('0x8')],{'host':_0xd130('0xa'),'port':0x18eb});var socket=require(_0xd130('0xb'))(new Redis(config[_0xd130('0x8')]));require(_0xd130('0xc'))['register'](socket);function respondWithRpcPromise(_0x5abf1e,_0x5ee249,_0x5d504d){return new BPromise(function(_0x35706a,_0x16e123){return client['request'](_0x5abf1e,_0x5d504d)['then'](function(_0x15ec25){logger[_0xd130('0xd')](_0xd130('0xe'),_0x5ee249,_0xd130('0xf'));logger[_0xd130('0x10')](_0xd130('0x11'),_0x5ee249,_0xd130('0xf'),JSON[_0xd130('0x12')](_0x15ec25));if(_0x15ec25[_0xd130('0x13')]){if(_0x15ec25[_0xd130('0x13')][_0xd130('0x14')]===0x1f4){logger[_0xd130('0x13')](_0xd130('0xe'),_0x5ee249,_0x15ec25[_0xd130('0x13')]['message']);return _0x16e123(_0x15ec25[_0xd130('0x13')][_0xd130('0x15')]);}logger[_0xd130('0x13')](_0xd130('0xe'),_0x5ee249,_0x15ec25[_0xd130('0x13')]['message']);return _0x35706a(_0x15ec25[_0xd130('0x13')]['message']);}else{logger['info'](_0xd130('0xe'),_0x5ee249,_0xd130('0xf'));_0x35706a(_0x15ec25[_0xd130('0x16')][_0xd130('0x15')]);}})[_0xd130('0x17')](function(_0xc79441){logger['error']('VoiceQueue,\x20%s,\x20%s',_0x5ee249,_0xc79441);_0x16e123(_0xc79441);});});}exports[_0xd130('0x18')]=function(_0x7d3bd7){var _0x500b45=this;return new Promise(function(_0x27a0cb,_0x53b9d3){return db[_0xd130('0x19')][_0xd130('0x1a')]({'raw':_0x7d3bd7['options']?_0x7d3bd7[_0xd130('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x7d3bd7[_0xd130('0x1b')]?_0x7d3bd7[_0xd130('0x1b')][_0xd130('0x1c')]||null:null,'attributes':_0x7d3bd7[_0xd130('0x1b')]?_0x7d3bd7[_0xd130('0x1b')]['attributes']||null:null,'limit':_0x7d3bd7['options']?_0x7d3bd7[_0xd130('0x1b')]['limit']||null:null,'include':_0x7d3bd7[_0xd130('0x1b')]?_0x7d3bd7[_0xd130('0x1b')][_0xd130('0x1d')]?_[_0xd130('0x1e')](_0x7d3bd7[_0xd130('0x1b')]['include'],function(_0x68fe73){return{'model':db[_0x68fe73['model']],'as':_0x68fe73['as'],'attributes':_0x68fe73[_0xd130('0x1f')],'include':_0x68fe73[_0xd130('0x1d')]?_[_0xd130('0x1e')](_0x68fe73[_0xd130('0x1d')],function(_0x5ebd7d){return{'model':db[_0x5ebd7d[_0xd130('0x20')]],'as':_0x5ebd7d['as'],'attributes':_0x5ebd7d[_0xd130('0x1f')],'include':_0x5ebd7d['include']?_['map'](_0x5ebd7d[_0xd130('0x1d')],function(_0x3a3c85){return{'model':db[_0x3a3c85[_0xd130('0x20')]],'as':_0x3a3c85['as'],'attributes':_0x3a3c85[_0xd130('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd130('0x21')](function(_0x41fb99){logger[_0xd130('0xd')](_0xd130('0x18'),_0x7d3bd7);logger[_0xd130('0x10')](_0xd130('0x18'),_0x7d3bd7,JSON['stringify'](_0x41fb99));_0x27a0cb(_0x41fb99);})['catch'](function(_0x56fc7a){logger[_0xd130('0x13')](_0xd130('0x18'),_0x56fc7a['message'],_0x7d3bd7);_0x53b9d3(_0x500b45[_0xd130('0x13')](0x1f4,_0x56fc7a['message']));});});};exports[_0xd130('0x22')]=function(_0x244508){var _0x599c23=this;return new Promise(function(_0x26acbb,_0x41789c){return db[_0xd130('0x19')]['find']({'raw':_0x244508[_0xd130('0x1b')]?_0x244508[_0xd130('0x1b')][_0xd130('0x23')]===undefined?!![]:![]:!![],'where':_0x244508[_0xd130('0x1b')]?_0x244508[_0xd130('0x1b')][_0xd130('0x1c')]||null:null,'attributes':_0x244508[_0xd130('0x1b')]?_0x244508[_0xd130('0x1b')][_0xd130('0x1f')]||null:null,'include':_0x244508[_0xd130('0x1b')]?_0x244508[_0xd130('0x1b')]['include']?_[_0xd130('0x1e')](_0x244508[_0xd130('0x1b')][_0xd130('0x1d')],function(_0x1cb49c){return{'model':db[_0x1cb49c[_0xd130('0x20')]],'as':_0x1cb49c['as'],'attributes':_0x1cb49c[_0xd130('0x1f')],'include':_0x1cb49c[_0xd130('0x1d')]?_[_0xd130('0x1e')](_0x1cb49c[_0xd130('0x1d')],function(_0x3b2205){return{'model':db[_0x3b2205[_0xd130('0x20')]],'as':_0x3b2205['as'],'attributes':_0x3b2205[_0xd130('0x1f')],'include':_0x3b2205['include']?_[_0xd130('0x1e')](_0x3b2205[_0xd130('0x1d')],function(_0x241073){return{'model':db[_0x241073[_0xd130('0x20')]],'as':_0x241073['as'],'attributes':_0x241073[_0xd130('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd130('0x21')](function(_0xdefd56){logger[_0xd130('0xd')](_0xd130('0x22'),_0x244508);logger[_0xd130('0x10')](_0xd130('0x22'),_0x244508,JSON[_0xd130('0x12')](_0xdefd56));_0x26acbb(_0xdefd56);})[_0xd130('0x17')](function(_0xb9b0c9){logger[_0xd130('0x13')](_0xd130('0x22'),_0xb9b0c9[_0xd130('0x15')],_0x244508);_0x41789c(_0x599c23[_0xd130('0x13')](0x1f4,_0xb9b0c9[_0xd130('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 841bfb0..21ccad6 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 _0x8c5d=['voiceQueue:','./voiceQueue.events','remove','removeListener','register','length'];(function(_0x45c4f2,_0x240311){var _0x3958ca=function(_0xff26b2){while(--_0xff26b2){_0x45c4f2['push'](_0x45c4f2['shift']());}};_0x3958ca(++_0x240311);}(_0x8c5d,0x1d5));var _0xd8c5=function(_0x4a2006,_0x2cf745){_0x4a2006=_0x4a2006-0x0;var _0x149505=_0x8c5d[_0x4a2006];return _0x149505;};'use strict';var VoiceQueueEvents=require(_0xd8c5('0x0'));var events=['save',_0xd8c5('0x1'),'update'];function createListener(_0x538060,_0x30fb94){return function(_0x532bb1){_0x30fb94['emit'](_0x538060,_0x532bb1);};}function removeListener(_0x363321,_0x11f629){return function(){VoiceQueueEvents[_0xd8c5('0x2')](_0x363321,_0x11f629);};}exports[_0xd8c5('0x3')]=function(_0xe33b7f){for(var _0x182434=0x0,_0x2552d8=events[_0xd8c5('0x4')];_0x182434<_0x2552d8;_0x182434++){var _0x496068=events[_0x182434];var _0x2d21b9=createListener(_0xd8c5('0x5')+_0x496068,_0xe33b7f);VoiceQueueEvents['on'](_0x496068,_0x2d21b9);}}; \ No newline at end of file +var _0x637a=['length','voiceQueue:','./voiceQueue.events','save','remove','update','emit','register'];(function(_0x39f3b9,_0xce6411){var _0x1f141f=function(_0x9c15aa){while(--_0x9c15aa){_0x39f3b9['push'](_0x39f3b9['shift']());}};_0x1f141f(++_0xce6411);}(_0x637a,0xfa));var _0xa637=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x637a[_0x501510];return _0x1e6ee5;};'use strict';var VoiceQueueEvents=require(_0xa637('0x0'));var events=[_0xa637('0x1'),_0xa637('0x2'),_0xa637('0x3')];function createListener(_0x57673a,_0x4f3515){return function(_0x258472){_0x4f3515[_0xa637('0x4')](_0x57673a,_0x258472);};}function removeListener(_0xbd7eb0,_0x50939e){return function(){VoiceQueueEvents['removeListener'](_0xbd7eb0,_0x50939e);};}exports[_0xa637('0x5')]=function(_0xa8e087){for(var _0x35519d=0x0,_0x8d03ff=events[_0xa637('0x6')];_0x35519d<_0x8d03ff;_0x35519d++){var _0x1af670=events[_0x35519d];var _0x55c57a=createListener(_0xa637('0x7')+_0x1af670,_0xa8e087);VoiceQueueEvents['on'](_0x1af670,_0x55c57a);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 7b6f3df..acf774c 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 _0x58e7=['get','/describe','describe','/index','getVoiceQueuesReport','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','isAuthenticated'];(function(_0x4ae309,_0x41b608){var _0x15a908=function(_0x26b8fb){while(--_0x26b8fb){_0x4ae309['push'](_0x4ae309['shift']());}};_0x15a908(++_0x41b608);}(_0x58e7,0x18e));var _0x758e=function(_0x4c3dcc,_0x2aa22d){_0x4c3dcc=_0x4c3dcc-0x0;var _0x3456ce=_0x58e7[_0x4c3dcc];return _0x3456ce;};'use strict';var multer=require(_0x758e('0x0'));var util=require(_0x758e('0x1'));var path=require(_0x758e('0x2'));var timeout=require(_0x758e('0x3'));var express=require('express');var router=express[_0x758e('0x4')]();var fs_extra=require(_0x758e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x758e('0x6'));var config=require(_0x758e('0x7'));var controller=require(_0x758e('0x8'));router['get']('/',auth[_0x758e('0x9')](),controller['index']);router[_0x758e('0xa')](_0x758e('0xb'),auth[_0x758e('0x9')](),controller[_0x758e('0xc')]);router[_0x758e('0xa')](_0x758e('0xd'),auth[_0x758e('0x9')](),controller[_0x758e('0xe')]);router[_0x758e('0xa')](_0x758e('0xf'),auth[_0x758e('0x9')](),controller[_0x758e('0x10')]);router[_0x758e('0x11')]('/',auth[_0x758e('0x9')](),controller[_0x758e('0x12')]);router[_0x758e('0x13')](_0x758e('0xf'),auth['isAuthenticated'](),controller[_0x758e('0x14')]);router[_0x758e('0x15')](_0x758e('0xf'),auth[_0x758e('0x9')](),controller[_0x758e('0x16')]);module[_0x758e('0x17')]=router; \ No newline at end of file +var _0xec87=['/index','show','post','create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','index','get','isAuthenticated','describe'];(function(_0x3404b2,_0x1a0c3f){var _0x340e31=function(_0x2cca4f){while(--_0x2cca4f){_0x3404b2['push'](_0x3404b2['shift']());}};_0x340e31(++_0x1a0c3f);}(_0xec87,0xc1));var _0x7ec8=function(_0x367336,_0x18c229){_0x367336=_0x367336-0x0;var _0x3423a7=_0xec87[_0x367336];return _0x3423a7;};'use strict';var multer=require(_0x7ec8('0x0'));var util=require(_0x7ec8('0x1'));var path=require(_0x7ec8('0x2'));var timeout=require(_0x7ec8('0x3'));var express=require(_0x7ec8('0x4'));var router=express['Router']();var fs_extra=require(_0x7ec8('0x5'));var auth=require(_0x7ec8('0x6'));var interaction=require(_0x7ec8('0x7'));var config=require(_0x7ec8('0x8'));var controller=require(_0x7ec8('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x7ec8('0xa')]);router[_0x7ec8('0xb')]('/describe',auth[_0x7ec8('0xc')](),controller[_0x7ec8('0xd')]);router[_0x7ec8('0xb')](_0x7ec8('0xe'),auth[_0x7ec8('0xc')](),controller['getVoiceQueuesReport']);router['get']('/:id',auth[_0x7ec8('0xc')](),controller[_0x7ec8('0xf')]);router[_0x7ec8('0x10')]('/',auth[_0x7ec8('0xc')](),controller[_0x7ec8('0x11')]);router['put'](_0x7ec8('0x12'),auth[_0x7ec8('0xc')](),controller[_0x7ec8('0x13')]);router[_0x7ec8('0x14')](_0x7ec8('0x12'),auth[_0x7ec8('0xc')](),controller[_0x7ec8('0x15')]);module[_0x7ec8('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 386eb44..4db9b27 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 _0xf25e=['DATE','getDataValue','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','moment','exports','STRING'];(function(_0x1340e4,_0x24aaca){var _0x5e28a2=function(_0x460c4a){while(--_0x460c4a){_0x1340e4['push'](_0x1340e4['shift']());}};_0x5e28a2(++_0x24aaca);}(_0xf25e,0xb1));var _0xef25=function(_0x1dde35,_0x5a16f1){_0x1dde35=_0x1dde35-0x0;var _0x2fe2eb=_0xf25e[_0x1dde35];return _0x2fe2eb;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xef25('0x0'));module[_0xef25('0x1')]={'type':{'type':Sequelize[_0xef25('0x2')]},'uniqueid':{'type':Sequelize[_0xef25('0x2')]},'calleridnum':{'type':Sequelize[_0xef25('0x2')]},'calleridname':{'type':Sequelize[_0xef25('0x2')]},'queue':{'type':Sequelize[_0xef25('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0xef25('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0xef25('0x3')],'set':function(_0x5a0dc8){var _0x3b48a1=moment(_0x5a0dc8);var _0x126b80=moment(this[_0xef25('0x4')]('queuecallerjoinAt'))[_0xef25('0x5')](_0xef25('0x6'));var _0xbeeb47=_0x3b48a1[_0xef25('0x7')](_0x126b80,_0xef25('0x8'));this[_0xef25('0x9')](_0xef25('0xa'),_0x5a0dc8);this[_0xef25('0x9')](_0xef25('0xb'),_0xbeeb47||null);}},'position':{'type':Sequelize[_0xef25('0xc')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xef25('0x3')]},'queuecallercomplete':{'type':Sequelize[_0xef25('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xef25('0x3')]},'queuecallerexit':{'type':Sequelize[_0xef25('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xef25('0x3')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0xef25('0xe')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xef25('0x2')]},'connectedlinename':{'type':Sequelize[_0xef25('0x2')]},'accountcode':{'type':Sequelize[_0xef25('0x2')]},'context':{'type':Sequelize[_0xef25('0x2')]},'exten':{'type':Sequelize[_0xef25('0x2')]},'priority':{'type':Sequelize[_0xef25('0x2')]},'holdtime':{'type':Sequelize[_0xef25('0xc')]},'mohtime':{'type':Sequelize[_0xef25('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xef25('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xef25('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xef25('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xef25('0x2')]},'transferuniqueid':{'type':Sequelize[_0xef25('0x2')]},'disposition':{'type':Sequelize[_0xef25('0x2')]},'secondDisposition':{'type':Sequelize[_0xef25('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0xef25('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0xdfd7=['BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','exports','STRING','DATE','getDataValue','YYYY-MM-DD\x20HH:mm:ss','seconds','setDataValue','queuecallerleaveAt','INTEGER'];(function(_0x458ed6,_0x504646){var _0xa5dfd9=function(_0x504e7b){while(--_0x504e7b){_0x458ed6['push'](_0x458ed6['shift']());}};_0xa5dfd9(++_0x504646);}(_0xdfd7,0x1a6));var _0x7dfd=function(_0x1b4c1e,_0x562c41){_0x1b4c1e=_0x1b4c1e-0x0;var _0x548433=_0xdfd7[_0x1b4c1e];return _0x548433;};'use strict';var Sequelize=require(_0x7dfd('0x0'));var moment=require('moment');module[_0x7dfd('0x1')]={'type':{'type':Sequelize[_0x7dfd('0x2')]},'uniqueid':{'type':Sequelize[_0x7dfd('0x2')]},'calleridnum':{'type':Sequelize[_0x7dfd('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x7dfd('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x7dfd('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x7dfd('0x3')],'set':function(_0xc9495f){var _0xc1863f=moment(_0xc9495f);var _0x5863c3=moment(this[_0x7dfd('0x4')]('queuecallerjoinAt'))['format'](_0x7dfd('0x5'));var _0x414129=_0xc1863f['diff'](_0x5863c3,_0x7dfd('0x6'));this[_0x7dfd('0x7')](_0x7dfd('0x8'),_0xc9495f);this[_0x7dfd('0x7')]('holdtime',_0x414129||null);}},'position':{'type':Sequelize[_0x7dfd('0x9')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x7dfd('0xa')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x7dfd('0xa')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0x7dfd('0x2')],'comment':_0x7dfd('0xb')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x7dfd('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x7dfd('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x7dfd('0x2')]},'priority':{'type':Sequelize[_0x7dfd('0x2')]},'holdtime':{'type':Sequelize[_0x7dfd('0x9')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x7dfd('0xa')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x7dfd('0x2')]},'transfer':{'type':Sequelize[_0x7dfd('0xa')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x7dfd('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x7dfd('0x2')]},'transferuniqueid':{'type':Sequelize[_0x7dfd('0x2')]},'disposition':{'type':Sequelize[_0x7dfd('0x2')]},'secondDisposition':{'type':Sequelize[_0x7dfd('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x7dfd('0x9')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 0bcfe47..188dcae 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 _0xab76=['send','index','map','rawAttributes','fieldName','key','model','name','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','VoiceQueueReport','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','getVoiceQueuesReport','order','eml-format','rimraf','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./voiceQueueReport.socket','status','end','json','undefined','limit','count','offset','set','Content-Range','save','update','then','destroy','sendStatus','error'];(function(_0x511e16,_0x34a468){var _0x37344e=function(_0x1a3edc){while(--_0x1a3edc){_0x511e16['push'](_0x511e16['shift']());}};_0x37344e(++_0x34a468);}(_0xab76,0x77));var _0x6ab7=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xab76[_0x411add];return _0x238242;};'use strict';var emlformat=require(_0x6ab7('0x0'));var rimraf=require(_0x6ab7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6ab7('0x2'));var Mustache=require('mustache');var util=require(_0x6ab7('0x3'));var path=require(_0x6ab7('0x4'));var sox=require(_0x6ab7('0x5'));var csv=require(_0x6ab7('0x6'));var ejs=require(_0x6ab7('0x7'));var fs=require('fs');var fs_extra=require(_0x6ab7('0x8'));var _=require(_0x6ab7('0x9'));var squel=require('squel');var crypto=require(_0x6ab7('0xa'));var jsforce=require(_0x6ab7('0xb'));var deskjs=require(_0x6ab7('0xc'));var toCsv=require(_0x6ab7('0x6'));var querystring=require(_0x6ab7('0xd'));var Papa=require(_0x6ab7('0xe'));var Redis=require(_0x6ab7('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6ab7('0x10'));var hardwareService=require(_0x6ab7('0x11'));var logger=require(_0x6ab7('0x12'))(_0x6ab7('0x13'));var utils=require(_0x6ab7('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x6ab7('0x15'));var db=require(_0x6ab7('0x16'))['db'];config[_0x6ab7('0x17')]=_['defaults'](config[_0x6ab7('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x6ab7('0x18'))(new Redis(config[_0x6ab7('0x17')]));require(_0x6ab7('0x19'))['register'](socket);function respondWithStatusCode(_0x5e6d2b,_0x389715){_0x389715=_0x389715||0xcc;return function(_0x565954){if(_0x565954){return _0x5e6d2b['sendStatus'](_0x389715);}return _0x5e6d2b[_0x6ab7('0x1a')](_0x389715)[_0x6ab7('0x1b')]();};}function respondWithResult(_0x1e2e02,_0x35c31b){_0x35c31b=_0x35c31b||0xc8;return function(_0x25fcd2){if(_0x25fcd2){return _0x1e2e02[_0x6ab7('0x1a')](_0x35c31b)[_0x6ab7('0x1c')](_0x25fcd2);}};}function respondWithFilteredResult(_0x1527ce,_0x2bd588){return function(_0x488e6f){if(_0x488e6f){var _0x4e0a44=typeof _0x2bd588['offset']===_0x6ab7('0x1d')&&typeof _0x2bd588[_0x6ab7('0x1e')]==='undefined';var _0x50c814=_0x488e6f[_0x6ab7('0x1f')];var _0x34f035=_0x4e0a44?0x0:_0x2bd588[_0x6ab7('0x20')];var _0x5f07e4=_0x4e0a44?_0x488e6f[_0x6ab7('0x1f')]:_0x2bd588[_0x6ab7('0x20')]+_0x2bd588[_0x6ab7('0x1e')];var _0x4d6733;if(_0x5f07e4>=_0x50c814){_0x5f07e4=_0x50c814;_0x4d6733=0xc8;}else{_0x4d6733=0xce;}_0x1527ce[_0x6ab7('0x1a')](_0x4d6733);return _0x1527ce[_0x6ab7('0x21')](_0x6ab7('0x22'),_0x34f035+'-'+_0x5f07e4+'/'+_0x50c814)[_0x6ab7('0x1c')](_0x488e6f);}return null;};}function patchUpdates(_0x37b416){return function(_0x1c4ed6){try{jsonpatch['apply'](_0x1c4ed6,_0x37b416,!![]);}catch(_0x1319ce){return BPromise['reject'](_0x1319ce);}return _0x1c4ed6[_0x6ab7('0x23')]();};}function saveUpdates(_0x1753fa,_0x5c19ea){return function(_0x43777d){if(_0x43777d){return _0x43777d[_0x6ab7('0x24')](_0x1753fa)[_0x6ab7('0x25')](function(_0x42c896){return _0x42c896;});}return null;};}function removeEntity(_0x4f6957,_0x41ece3){return function(_0x121f10){if(_0x121f10){return _0x121f10[_0x6ab7('0x26')]()[_0x6ab7('0x25')](function(){_0x4f6957[_0x6ab7('0x1a')](0xcc)[_0x6ab7('0x1b')]();});}};}function handleEntityNotFound(_0xde0e50,_0x4c0142){return function(_0x604cca){if(!_0x604cca){_0xde0e50[_0x6ab7('0x27')](0x194);}return _0x604cca;};}function handleError(_0x4b7681,_0xb593c0){_0xb593c0=_0xb593c0||0x1f4;return function(_0x54a7f5){logger[_0x6ab7('0x28')](_0x54a7f5['stack']);if(_0x54a7f5['name']){delete _0x54a7f5['name'];}_0x4b7681[_0x6ab7('0x1a')](_0xb593c0)[_0x6ab7('0x29')](_0x54a7f5);};}exports[_0x6ab7('0x2a')]=function(_0xafe05c,_0x50ec7a){var _0x3a2d05={},_0x3bbb78={},_0x2e3539={'count':0x0,'rows':[]};var _0x5d9031=_[_0x6ab7('0x2b')](db['VoiceQueueReport'][_0x6ab7('0x2c')],function(_0x32e972){return{'name':_0x32e972[_0x6ab7('0x2d')],'type':_0x32e972['type'][_0x6ab7('0x2e')]};});_0x3bbb78[_0x6ab7('0x2f')]=_['map'](_0x5d9031,_0x6ab7('0x30'));_0x3bbb78['query']=_[_0x6ab7('0x31')](_0xafe05c[_0x6ab7('0x32')]);_0x3bbb78['filters']=_[_0x6ab7('0x33')](_0x3bbb78['model'],_0x3bbb78[_0x6ab7('0x32')]);_0x3a2d05[_0x6ab7('0x34')]=_[_0x6ab7('0x33')](_0x3bbb78[_0x6ab7('0x2f')],qs[_0x6ab7('0x35')](_0xafe05c[_0x6ab7('0x32')][_0x6ab7('0x35')]));_0x3a2d05[_0x6ab7('0x34')]=_0x3a2d05['attributes'][_0x6ab7('0x36')]?_0x3a2d05[_0x6ab7('0x34')]:_0x3bbb78[_0x6ab7('0x2f')];if(!_0xafe05c[_0x6ab7('0x32')][_0x6ab7('0x37')](_0x6ab7('0x38'))){_0x3a2d05[_0x6ab7('0x1e')]=qs[_0x6ab7('0x1e')](_0xafe05c[_0x6ab7('0x32')]['limit']);_0x3a2d05[_0x6ab7('0x20')]=qs[_0x6ab7('0x20')](_0xafe05c[_0x6ab7('0x32')][_0x6ab7('0x20')]);}_0x3a2d05['order']=qs[_0x6ab7('0x39')](_0xafe05c['query'][_0x6ab7('0x39')]);_0x3a2d05[_0x6ab7('0x3a')]=qs['filters'](_[_0x6ab7('0x3b')](_0xafe05c['query'],_0x3bbb78[_0x6ab7('0x3c')]),_0x5d9031);if(_0xafe05c[_0x6ab7('0x32')][_0x6ab7('0x3d')]){_0x3a2d05[_0x6ab7('0x3a')]=_[_0x6ab7('0x3e')](_0x3a2d05[_0x6ab7('0x3a')],{'$or':_[_0x6ab7('0x2b')](_0x5d9031,function(_0x2fa97a){if(_0x2fa97a[_0x6ab7('0x3f')]!==_0x6ab7('0x40')){var _0x32d794={};_0x32d794[_0x2fa97a[_0x6ab7('0x30')]]={'$like':'%'+_0xafe05c[_0x6ab7('0x32')][_0x6ab7('0x3d')]+'%'};return _0x32d794;}})});}_0x3a2d05=_['merge']({},_0x3a2d05,_0xafe05c[_0x6ab7('0x41')]);var _0x2addc7={'where':_0x3a2d05[_0x6ab7('0x3a')]};return db[_0x6ab7('0x42')][_0x6ab7('0x1f')](_0x2addc7)['then'](function(_0x1e587f){_0x2e3539['count']=_0x1e587f;if(_0xafe05c[_0x6ab7('0x32')][_0x6ab7('0x43')]){_0x3a2d05[_0x6ab7('0x44')]=[{'all':!![]}];}return db[_0x6ab7('0x42')][_0x6ab7('0x45')](_0x3a2d05);})['then'](function(_0x6d8c1b){_0x2e3539[_0x6ab7('0x46')]=_0x6d8c1b;return _0x2e3539;})[_0x6ab7('0x25')](respondWithFilteredResult(_0x50ec7a,_0x3a2d05))[_0x6ab7('0x47')](handleError(_0x50ec7a,null));};exports[_0x6ab7('0x48')]=function(_0x2e74e3,_0xe74777){var _0x21610d={'raw':![],'where':{'id':_0x2e74e3[_0x6ab7('0x49')]['id']}},_0x1600cb={};_0x1600cb[_0x6ab7('0x2f')]=_[_0x6ab7('0x31')](db['VoiceQueueReport'][_0x6ab7('0x2c')]);_0x1600cb[_0x6ab7('0x32')]=_[_0x6ab7('0x31')](_0x2e74e3[_0x6ab7('0x32')]);_0x1600cb[_0x6ab7('0x3c')]=_[_0x6ab7('0x33')](_0x1600cb[_0x6ab7('0x2f')],_0x1600cb[_0x6ab7('0x32')]);_0x21610d[_0x6ab7('0x34')]=_[_0x6ab7('0x33')](_0x1600cb[_0x6ab7('0x2f')],qs[_0x6ab7('0x35')](_0x2e74e3[_0x6ab7('0x32')][_0x6ab7('0x35')]));_0x21610d[_0x6ab7('0x34')]=_0x21610d[_0x6ab7('0x34')][_0x6ab7('0x36')]?_0x21610d[_0x6ab7('0x34')]:_0x1600cb[_0x6ab7('0x2f')];if(_0x2e74e3[_0x6ab7('0x32')][_0x6ab7('0x43')]){_0x21610d['include']=[{'all':!![]}];}_0x21610d=_[_0x6ab7('0x3e')]({},_0x21610d,_0x2e74e3['options']);return db['VoiceQueueReport']['find'](_0x21610d)[_0x6ab7('0x25')](handleEntityNotFound(_0xe74777,null))['then'](respondWithResult(_0xe74777,null))[_0x6ab7('0x47')](handleError(_0xe74777,null));};exports[_0x6ab7('0x4a')]=function(_0x1cbb7f,_0x12f244){return db[_0x6ab7('0x42')][_0x6ab7('0x4a')](_0x1cbb7f[_0x6ab7('0x4b')],{})[_0x6ab7('0x25')](respondWithResult(_0x12f244,0xc9))[_0x6ab7('0x47')](handleError(_0x12f244,null));};exports[_0x6ab7('0x24')]=function(_0x1b90cf,_0x5edde5){if(_0x1b90cf['body']['id']){delete _0x1b90cf[_0x6ab7('0x4b')]['id'];}return db[_0x6ab7('0x42')][_0x6ab7('0x4c')]({'where':{'id':_0x1b90cf['params']['id']}})[_0x6ab7('0x25')](handleEntityNotFound(_0x5edde5,null))[_0x6ab7('0x25')](saveUpdates(_0x1b90cf[_0x6ab7('0x4b')],null))[_0x6ab7('0x25')](respondWithResult(_0x5edde5,null))[_0x6ab7('0x47')](handleError(_0x5edde5,null));};exports['destroy']=function(_0x3b3565,_0x5f123b){return db[_0x6ab7('0x42')][_0x6ab7('0x4c')]({'where':{'id':_0x3b3565[_0x6ab7('0x49')]['id']}})[_0x6ab7('0x25')](handleEntityNotFound(_0x5f123b,null))[_0x6ab7('0x25')](removeEntity(_0x5f123b,null))[_0x6ab7('0x47')](handleError(_0x5f123b,null));};exports[_0x6ab7('0x4d')]=function(_0x413c67,_0xb43d84){return db[_0x6ab7('0x42')][_0x6ab7('0x4d')]()[_0x6ab7('0x25')](respondWithResult(_0xb43d84,null))[_0x6ab7('0x47')](handleError(_0xb43d84,null));};exports[_0x6ab7('0x4e')]=function(_0x1364c1,_0x4135b0){var _0x170a8d={},_0x18770d={},_0x3fd9c5={'count':0x0,'rows':[]};_0x18770d[_0x6ab7('0x2f')]=_[_0x6ab7('0x31')](db['VoiceQueueReport']['rawAttributes']);_0x18770d[_0x6ab7('0x32')]=_['keys'](_0x1364c1[_0x6ab7('0x32')]);_0x18770d[_0x6ab7('0x3c')]=_['intersection'](_0x18770d['model'],_0x18770d[_0x6ab7('0x32')]);_0x170a8d['attributes']=_[_0x6ab7('0x33')](_0x18770d['model'],qs[_0x6ab7('0x35')](_0x1364c1[_0x6ab7('0x32')][_0x6ab7('0x35')]));_0x170a8d['attributes']=_0x170a8d[_0x6ab7('0x34')][_0x6ab7('0x36')]?_0x170a8d[_0x6ab7('0x34')]:_0x18770d[_0x6ab7('0x2f')];if(!_0x1364c1[_0x6ab7('0x32')][_0x6ab7('0x37')]('nolimit')){_0x170a8d[_0x6ab7('0x1e')]=qs['limit'](_0x1364c1[_0x6ab7('0x32')][_0x6ab7('0x1e')]);_0x170a8d['offset']=qs[_0x6ab7('0x20')](_0x1364c1[_0x6ab7('0x32')][_0x6ab7('0x20')]);}_0x170a8d[_0x6ab7('0x4f')]=qs[_0x6ab7('0x39')](_0x1364c1['query']['sort']);_0x170a8d['where']=qs['filters'](_[_0x6ab7('0x3b')](_0x1364c1[_0x6ab7('0x32')],_0x18770d[_0x6ab7('0x3c')]));if(_0x1364c1[_0x6ab7('0x32')]['filter']){_0x170a8d[_0x6ab7('0x3a')]=_[_0x6ab7('0x3e')](_0x170a8d['where'],{'$or':_[_0x6ab7('0x2b')](_0x170a8d[_0x6ab7('0x34')],function(_0x4cb8c0){var _0x198b35={};_0x198b35[_0x4cb8c0]={'$like':'%'+_0x1364c1[_0x6ab7('0x32')][_0x6ab7('0x3d')]+'%'};return _0x198b35;})});}_0x170a8d=_[_0x6ab7('0x3e')]({},_0x170a8d,_0x1364c1[_0x6ab7('0x41')]);var _0xb015f5={'where':_0x170a8d[_0x6ab7('0x3a')]};return db['VoiceQueueReport'][_0x6ab7('0x1f')](_0xb015f5)[_0x6ab7('0x25')](function(_0x4826c0){_0x3fd9c5[_0x6ab7('0x1f')]=_0x4826c0;if(_0x1364c1[_0x6ab7('0x32')]['includeAll']){_0x170a8d[_0x6ab7('0x44')]=[{'all':!![]}];}return db[_0x6ab7('0x42')][_0x6ab7('0x45')](_0x170a8d);})[_0x6ab7('0x25')](function(_0x52bc09){_0x3fd9c5[_0x6ab7('0x46')]=_0x52bc09;return _0x3fd9c5;})[_0x6ab7('0x25')](respondWithFilteredResult(_0x4135b0,_0x170a8d,_0x6ab7('0x4e')))['catch'](handleError(_0x4135b0,null,_0x6ab7('0x4e')));}; \ No newline at end of file +var _0xa8fb=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','VoiceQueueReport','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','map','merge','options','include','findAll','catch','params','keys','find','create','body','describe','getVoiceQueuesReport','pick','includeAll','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis'];(function(_0x1ba3f0,_0x3b220d){var _0x53064d=function(_0x4ac6e3){while(--_0x4ac6e3){_0x1ba3f0['push'](_0x1ba3f0['shift']());}};_0x53064d(++_0x3b220d);}(_0xa8fb,0x137));var _0xba8f=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xa8fb[_0x4ae6ef];return _0x3cbb4e;};'use strict';var emlformat=require(_0xba8f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xba8f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xba8f('0x2'));var moment=require(_0xba8f('0x3'));var BPromise=require(_0xba8f('0x4'));var Mustache=require(_0xba8f('0x5'));var util=require(_0xba8f('0x6'));var path=require(_0xba8f('0x7'));var sox=require('sox');var csv=require(_0xba8f('0x8'));var ejs=require(_0xba8f('0x9'));var fs=require('fs');var fs_extra=require(_0xba8f('0xa'));var _=require(_0xba8f('0xb'));var squel=require('squel');var crypto=require(_0xba8f('0xc'));var jsforce=require(_0xba8f('0xd'));var deskjs=require(_0xba8f('0xe'));var toCsv=require(_0xba8f('0x8'));var querystring=require('querystring');var Papa=require(_0xba8f('0xf'));var Redis=require(_0xba8f('0x10'));var authService=require(_0xba8f('0x11'));var qs=require(_0xba8f('0x12'));var as=require(_0xba8f('0x13'));var hardwareService=require(_0xba8f('0x14'));var logger=require(_0xba8f('0x15'))(_0xba8f('0x16'));var utils=require('../../config/utils');var config=require(_0xba8f('0x17'));var licenseUtil=require(_0xba8f('0x18'));var db=require('../../mysqldb')['db'];config[_0xba8f('0x19')]=_[_0xba8f('0x1a')](config[_0xba8f('0x19')],{'host':_0xba8f('0x1b'),'port':0x18eb});var socket=require(_0xba8f('0x1c'))(new Redis(config[_0xba8f('0x19')]));require('./voiceQueueReport.socket')[_0xba8f('0x1d')](socket);function respondWithStatusCode(_0x521a2c,_0x833913){_0x833913=_0x833913||0xcc;return function(_0x2de7e4){if(_0x2de7e4){return _0x521a2c[_0xba8f('0x1e')](_0x833913);}return _0x521a2c[_0xba8f('0x1f')](_0x833913)['end']();};}function respondWithResult(_0x561441,_0x5c1365){_0x5c1365=_0x5c1365||0xc8;return function(_0x2336a8){if(_0x2336a8){return _0x561441['status'](_0x5c1365)[_0xba8f('0x20')](_0x2336a8);}};}function respondWithFilteredResult(_0x5ac177,_0x5d7797){return function(_0x4c09ae){if(_0x4c09ae){var _0xfbf17b=typeof _0x5d7797[_0xba8f('0x21')]===_0xba8f('0x22')&&typeof _0x5d7797[_0xba8f('0x23')]===_0xba8f('0x22');var _0x2d2d19=_0x4c09ae['count'];var _0x57df68=_0xfbf17b?0x0:_0x5d7797[_0xba8f('0x21')];var _0x2cd58c=_0xfbf17b?_0x4c09ae[_0xba8f('0x24')]:_0x5d7797[_0xba8f('0x21')]+_0x5d7797['limit'];var _0x3a6e9b;if(_0x2cd58c>=_0x2d2d19){_0x2cd58c=_0x2d2d19;_0x3a6e9b=0xc8;}else{_0x3a6e9b=0xce;}_0x5ac177['status'](_0x3a6e9b);return _0x5ac177[_0xba8f('0x25')](_0xba8f('0x26'),_0x57df68+'-'+_0x2cd58c+'/'+_0x2d2d19)['json'](_0x4c09ae);}return null;};}function patchUpdates(_0x1ac5ba){return function(_0x50fe77){try{jsonpatch[_0xba8f('0x27')](_0x50fe77,_0x1ac5ba,!![]);}catch(_0x32153a){return BPromise[_0xba8f('0x28')](_0x32153a);}return _0x50fe77[_0xba8f('0x29')]();};}function saveUpdates(_0x845490,_0x52c7f4){return function(_0x20bf8c){if(_0x20bf8c){return _0x20bf8c[_0xba8f('0x2a')](_0x845490)['then'](function(_0x41c5ee){return _0x41c5ee;});}return null;};}function removeEntity(_0x36c92b,_0x48ca08){return function(_0x3b0c43){if(_0x3b0c43){return _0x3b0c43[_0xba8f('0x2b')]()[_0xba8f('0x2c')](function(){_0x36c92b[_0xba8f('0x1f')](0xcc)[_0xba8f('0x2d')]();});}};}function handleEntityNotFound(_0xd55003,_0x47e199){return function(_0x5c29b0){if(!_0x5c29b0){_0xd55003[_0xba8f('0x1e')](0x194);}return _0x5c29b0;};}function handleError(_0x18d457,_0x3a3005){_0x3a3005=_0x3a3005||0x1f4;return function(_0x32a7db){logger[_0xba8f('0x2e')](_0x32a7db[_0xba8f('0x2f')]);if(_0x32a7db['name']){delete _0x32a7db[_0xba8f('0x30')];}_0x18d457[_0xba8f('0x1f')](_0x3a3005)[_0xba8f('0x31')](_0x32a7db);};}exports[_0xba8f('0x32')]=function(_0x5390b9,_0x54a5a1){var _0x3c67ea={},_0xdb07c0={},_0x108648={'count':0x0,'rows':[]};var _0x21f33b=_['map'](db[_0xba8f('0x33')][_0xba8f('0x34')],function(_0x427267){return{'name':_0x427267['fieldName'],'type':_0x427267[_0xba8f('0x35')]['key']};});_0xdb07c0[_0xba8f('0x36')]=_['map'](_0x21f33b,'name');_0xdb07c0[_0xba8f('0x37')]=_['keys'](_0x5390b9[_0xba8f('0x37')]);_0xdb07c0[_0xba8f('0x38')]=_[_0xba8f('0x39')](_0xdb07c0['model'],_0xdb07c0['query']);_0x3c67ea[_0xba8f('0x3a')]=_[_0xba8f('0x39')](_0xdb07c0[_0xba8f('0x36')],qs['fields'](_0x5390b9[_0xba8f('0x37')][_0xba8f('0x3b')]));_0x3c67ea[_0xba8f('0x3a')]=_0x3c67ea[_0xba8f('0x3a')][_0xba8f('0x3c')]?_0x3c67ea[_0xba8f('0x3a')]:_0xdb07c0[_0xba8f('0x36')];if(!_0x5390b9[_0xba8f('0x37')][_0xba8f('0x3d')](_0xba8f('0x3e'))){_0x3c67ea[_0xba8f('0x23')]=qs['limit'](_0x5390b9[_0xba8f('0x37')][_0xba8f('0x23')]);_0x3c67ea[_0xba8f('0x21')]=qs[_0xba8f('0x21')](_0x5390b9[_0xba8f('0x37')]['offset']);}_0x3c67ea[_0xba8f('0x3f')]=qs[_0xba8f('0x40')](_0x5390b9[_0xba8f('0x37')]['sort']);_0x3c67ea['where']=qs[_0xba8f('0x38')](_['pick'](_0x5390b9['query'],_0xdb07c0[_0xba8f('0x38')]),_0x21f33b);if(_0x5390b9[_0xba8f('0x37')][_0xba8f('0x41')]){_0x3c67ea['where']=_['merge'](_0x3c67ea[_0xba8f('0x42')],{'$or':_[_0xba8f('0x43')](_0x21f33b,function(_0x3cddfe){if(_0x3cddfe[_0xba8f('0x35')]!=='VIRTUAL'){var _0x3ae652={};_0x3ae652[_0x3cddfe[_0xba8f('0x30')]]={'$like':'%'+_0x5390b9[_0xba8f('0x37')][_0xba8f('0x41')]+'%'};return _0x3ae652;}})});}_0x3c67ea=_[_0xba8f('0x44')]({},_0x3c67ea,_0x5390b9[_0xba8f('0x45')]);var _0x286c7a={'where':_0x3c67ea[_0xba8f('0x42')]};return db[_0xba8f('0x33')]['count'](_0x286c7a)['then'](function(_0x4e7fbb){_0x108648[_0xba8f('0x24')]=_0x4e7fbb;if(_0x5390b9['query']['includeAll']){_0x3c67ea[_0xba8f('0x46')]=[{'all':!![]}];}return db[_0xba8f('0x33')][_0xba8f('0x47')](_0x3c67ea);})['then'](function(_0x19ae83){_0x108648['rows']=_0x19ae83;return _0x108648;})[_0xba8f('0x2c')](respondWithFilteredResult(_0x54a5a1,_0x3c67ea))[_0xba8f('0x48')](handleError(_0x54a5a1,null));};exports['show']=function(_0x307bf0,_0x36f9a9){var _0x393f45={'raw':![],'where':{'id':_0x307bf0[_0xba8f('0x49')]['id']}},_0x30bfe6={};_0x30bfe6['model']=_[_0xba8f('0x4a')](db[_0xba8f('0x33')]['rawAttributes']);_0x30bfe6['query']=_['keys'](_0x307bf0[_0xba8f('0x37')]);_0x30bfe6[_0xba8f('0x38')]=_['intersection'](_0x30bfe6['model'],_0x30bfe6[_0xba8f('0x37')]);_0x393f45[_0xba8f('0x3a')]=_[_0xba8f('0x39')](_0x30bfe6[_0xba8f('0x36')],qs['fields'](_0x307bf0[_0xba8f('0x37')]['fields']));_0x393f45[_0xba8f('0x3a')]=_0x393f45[_0xba8f('0x3a')]['length']?_0x393f45[_0xba8f('0x3a')]:_0x30bfe6[_0xba8f('0x36')];if(_0x307bf0[_0xba8f('0x37')]['includeAll']){_0x393f45[_0xba8f('0x46')]=[{'all':!![]}];}_0x393f45=_['merge']({},_0x393f45,_0x307bf0[_0xba8f('0x45')]);return db['VoiceQueueReport'][_0xba8f('0x4b')](_0x393f45)['then'](handleEntityNotFound(_0x36f9a9,null))[_0xba8f('0x2c')](respondWithResult(_0x36f9a9,null))['catch'](handleError(_0x36f9a9,null));};exports[_0xba8f('0x4c')]=function(_0x5e5135,_0x36b846){return db[_0xba8f('0x33')][_0xba8f('0x4c')](_0x5e5135[_0xba8f('0x4d')],{})[_0xba8f('0x2c')](respondWithResult(_0x36b846,0xc9))[_0xba8f('0x48')](handleError(_0x36b846,null));};exports[_0xba8f('0x2a')]=function(_0x306272,_0x568e9f){if(_0x306272['body']['id']){delete _0x306272['body']['id'];}return db[_0xba8f('0x33')][_0xba8f('0x4b')]({'where':{'id':_0x306272['params']['id']}})[_0xba8f('0x2c')](handleEntityNotFound(_0x568e9f,null))[_0xba8f('0x2c')](saveUpdates(_0x306272[_0xba8f('0x4d')],null))[_0xba8f('0x2c')](respondWithResult(_0x568e9f,null))[_0xba8f('0x48')](handleError(_0x568e9f,null));};exports[_0xba8f('0x2b')]=function(_0x47854f,_0x29c3a7){return db[_0xba8f('0x33')][_0xba8f('0x4b')]({'where':{'id':_0x47854f[_0xba8f('0x49')]['id']}})[_0xba8f('0x2c')](handleEntityNotFound(_0x29c3a7,null))[_0xba8f('0x2c')](removeEntity(_0x29c3a7,null))['catch'](handleError(_0x29c3a7,null));};exports[_0xba8f('0x4e')]=function(_0x2df437,_0x40ae03){return db[_0xba8f('0x33')][_0xba8f('0x4e')]()[_0xba8f('0x2c')](respondWithResult(_0x40ae03,null))['catch'](handleError(_0x40ae03,null));};exports[_0xba8f('0x4f')]=function(_0x432391,_0x3d9d51){var _0xe5fdcb={},_0x18cc18={},_0x20011a={'count':0x0,'rows':[]};_0x18cc18[_0xba8f('0x36')]=_['keys'](db['VoiceQueueReport'][_0xba8f('0x34')]);_0x18cc18[_0xba8f('0x37')]=_[_0xba8f('0x4a')](_0x432391[_0xba8f('0x37')]);_0x18cc18['filters']=_[_0xba8f('0x39')](_0x18cc18['model'],_0x18cc18[_0xba8f('0x37')]);_0xe5fdcb['attributes']=_[_0xba8f('0x39')](_0x18cc18[_0xba8f('0x36')],qs['fields'](_0x432391[_0xba8f('0x37')]['fields']));_0xe5fdcb[_0xba8f('0x3a')]=_0xe5fdcb[_0xba8f('0x3a')][_0xba8f('0x3c')]?_0xe5fdcb['attributes']:_0x18cc18[_0xba8f('0x36')];if(!_0x432391[_0xba8f('0x37')][_0xba8f('0x3d')]('nolimit')){_0xe5fdcb[_0xba8f('0x23')]=qs[_0xba8f('0x23')](_0x432391[_0xba8f('0x37')][_0xba8f('0x23')]);_0xe5fdcb[_0xba8f('0x21')]=qs[_0xba8f('0x21')](_0x432391['query'][_0xba8f('0x21')]);}_0xe5fdcb[_0xba8f('0x3f')]=qs[_0xba8f('0x40')](_0x432391[_0xba8f('0x37')][_0xba8f('0x40')]);_0xe5fdcb['where']=qs[_0xba8f('0x38')](_[_0xba8f('0x50')](_0x432391[_0xba8f('0x37')],_0x18cc18['filters']));if(_0x432391[_0xba8f('0x37')]['filter']){_0xe5fdcb['where']=_[_0xba8f('0x44')](_0xe5fdcb[_0xba8f('0x42')],{'$or':_[_0xba8f('0x43')](_0xe5fdcb[_0xba8f('0x3a')],function(_0x5bcec5){var _0xe98f59={};_0xe98f59[_0x5bcec5]={'$like':'%'+_0x432391['query']['filter']+'%'};return _0xe98f59;})});}_0xe5fdcb=_['merge']({},_0xe5fdcb,_0x432391[_0xba8f('0x45')]);var _0x1dc800={'where':_0xe5fdcb[_0xba8f('0x42')]};return db[_0xba8f('0x33')][_0xba8f('0x24')](_0x1dc800)[_0xba8f('0x2c')](function(_0x581441){_0x20011a[_0xba8f('0x24')]=_0x581441;if(_0x432391[_0xba8f('0x37')][_0xba8f('0x51')]){_0xe5fdcb[_0xba8f('0x46')]=[{'all':!![]}];}return db[_0xba8f('0x33')][_0xba8f('0x47')](_0xe5fdcb);})[_0xba8f('0x2c')](function(_0x1baa14){_0x20011a['rows']=_0x1baa14;return _0x20011a;})['then'](respondWithFilteredResult(_0x3d9d51,_0xe5fdcb,_0xba8f('0x4f')))['catch'](handleError(_0x3d9d51,null,_0xba8f('0x4f')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index ace962a..131f97f 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 _0x2ec3=['setMaxListeners','save','remove','emit','hook','VoiceQueueReport'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x2ec3,0x137));var _0x32ec=function(_0x2b0dc8,_0x586497){_0x2b0dc8=_0x2b0dc8-0x0;var _0x442272=_0x2ec3[_0x2b0dc8];return _0x442272;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require('../../mysqldb')['db'][_0x32ec('0x0')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x32ec('0x1')](0x0);var events={'afterCreate':_0x32ec('0x2'),'afterUpdate':'update','afterDestroy':_0x32ec('0x3')};function emitEvent(_0x3f8ed7){return function(_0x12a5ee,_0x2a069b,_0x2cfd4e){VoiceQueueReportEvents[_0x32ec('0x4')](_0x3f8ed7+':'+_0x12a5ee['id'],_0x12a5ee);VoiceQueueReportEvents[_0x32ec('0x4')](_0x3f8ed7,_0x12a5ee);_0x2cfd4e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x32ec('0x5')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0xc641=['emit','hasOwnProperty','hook','exports','../../mysqldb','VoiceQueueReport','setMaxListeners','remove'];(function(_0x24d61f,_0x38cebb){var _0x29ae79=function(_0x5ae6b7){while(--_0x5ae6b7){_0x24d61f['push'](_0x24d61f['shift']());}};_0x29ae79(++_0x38cebb);}(_0xc641,0x164));var _0x1c64=function(_0x43cc3d,_0x395ac9){_0x43cc3d=_0x43cc3d-0x0;var _0x3377e0=_0xc641[_0x43cc3d];return _0x3377e0;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0x1c64('0x0'))['db'][_0x1c64('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x1c64('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x1c64('0x3')};function emitEvent(_0x2f31c8){return function(_0x3159fa,_0x371790,_0x4c45ac){VoiceQueueReportEvents[_0x1c64('0x4')](_0x2f31c8+':'+_0x3159fa['id'],_0x3159fa);VoiceQueueReportEvents[_0x1c64('0x4')](_0x2f31c8,_0x3159fa);_0x4c45ac(null);};}for(var e in events){if(events[_0x1c64('0x5')](e)){var event=events[e];VoiceQueueReport[_0x1c64('0x6')](e,emitEvent(event));}}module[_0x1c64('0x7')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index ccf0553..3dc39f3 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 _0x050c=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','calleridnum'];(function(_0x1b852e,_0x185f0d){var _0x2fd5cf=function(_0x1dc638){while(--_0x1dc638){_0x1b852e['push'](_0x1b852e['shift']());}};_0x2fd5cf(++_0x185f0d);}(_0x050c,0x14a));var _0xc050=function(_0x4bf6a4,_0x56d73d){_0x4bf6a4=_0x4bf6a4-0x0;var _0x2c8c9a=_0x050c[_0x4bf6a4];return _0x2c8c9a;};'use strict';var _=require(_0xc050('0x0'));var util=require(_0xc050('0x1'));var logger=require(_0xc050('0x2'))('api');var moment=require(_0xc050('0x3'));var BPromise=require(_0xc050('0x4'));var rp=require(_0xc050('0x5'));var fs=require('fs');var path=require(_0xc050('0x6'));var rimraf=require(_0xc050('0x7'));var config=require('../../config/environment');var attributes=require(_0xc050('0x8'));module[_0xc050('0x9')]=function(_0x1cac31,_0x2aa271){return _0x1cac31[_0xc050('0xa')](_0xc050('0xb'),attributes,{'tableName':_0xc050('0xc'),'paranoid':![],'indexes':[{'fields':[_0xc050('0xd')]},{'fields':[_0xc050('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2570=['api','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','VoiceQueueReport','report_queue','calleridnum','lodash','../../config/logger'];(function(_0x1b3d60,_0x51583b){var _0x4abc3d=function(_0x5c9acb){while(--_0x5c9acb){_0x1b3d60['push'](_0x1b3d60['shift']());}};_0x4abc3d(++_0x51583b);}(_0x2570,0x1d7));var _0x0257=function(_0x3ee244,_0x2e67db){_0x3ee244=_0x3ee244-0x0;var _0x2e75ee=_0x2570[_0x3ee244];return _0x2e75ee;};'use strict';var _=require(_0x0257('0x0'));var util=require('util');var logger=require(_0x0257('0x1'))(_0x0257('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0257('0x3'));var rimraf=require(_0x0257('0x4'));var config=require(_0x0257('0x5'));var attributes=require(_0x0257('0x6'));module[_0x0257('0x7')]=function(_0x24ee04,_0x43b0ba){return _0x24ee04['define'](_0x0257('0x8'),attributes,{'tableName':_0x0257('0x9'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0x0257('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index c2cdb3c..fac9ad1 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 _0x7d98=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','redis','defaults','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','options','raw','attributes','include','map','model','GetVoiceQueueReport','create','CreateVoiceQueueReport','catch','VoiceQueueReport','update','body','where','limit','UpdateVoiceQueueReport','lodash','util'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7d98,0x181));var _0x87d9=function(_0x22e47a,_0x4ea10c){_0x22e47a=_0x22e47a-0x0;var _0x15a12a=_0x7d98[_0x22e47a];return _0x15a12a;};'use strict';var _=require(_0x87d9('0x0'));var util=require(_0x87d9('0x1'));var moment=require('moment');var BPromise=require(_0x87d9('0x2'));var rs=require(_0x87d9('0x3'));var fs=require('fs');var Redis=require(_0x87d9('0x4'));var db=require(_0x87d9('0x5'))['db'];var utils=require(_0x87d9('0x6'));var logger=require('../../config/logger')(_0x87d9('0x7'));var config=require(_0x87d9('0x8'));var jayson=require(_0x87d9('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x87d9('0xa')]=_[_0x87d9('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x87d9('0xc'))(new Redis(config[_0x87d9('0xa')]));require(_0x87d9('0xd'))[_0x87d9('0xe')](socket);function respondWithRpcPromise(_0x463459,_0x23de4c,_0x4c62ff){return new BPromise(function(_0x8df1c4,_0x57177e){return client[_0x87d9('0xf')](_0x463459,_0x4c62ff)[_0x87d9('0x10')](function(_0x1c74a3){logger[_0x87d9('0x11')](_0x87d9('0x12'),_0x23de4c,_0x87d9('0x13'));logger[_0x87d9('0x14')](_0x87d9('0x15'),_0x23de4c,_0x87d9('0x13'),JSON[_0x87d9('0x16')](_0x1c74a3));if(_0x1c74a3[_0x87d9('0x17')]){if(_0x1c74a3[_0x87d9('0x17')][_0x87d9('0x18')]===0x1f4){logger[_0x87d9('0x17')](_0x87d9('0x12'),_0x23de4c,_0x1c74a3[_0x87d9('0x17')]['message']);return _0x57177e(_0x1c74a3['error'][_0x87d9('0x19')]);}logger[_0x87d9('0x17')](_0x87d9('0x12'),_0x23de4c,_0x1c74a3['error'][_0x87d9('0x19')]);return _0x8df1c4(_0x1c74a3[_0x87d9('0x17')]['message']);}else{logger[_0x87d9('0x11')](_0x87d9('0x12'),_0x23de4c,_0x87d9('0x13'));_0x8df1c4(_0x1c74a3[_0x87d9('0x1a')][_0x87d9('0x19')]);}})['catch'](function(_0x2c5c9c){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x23de4c,_0x2c5c9c);_0x57177e(_0x2c5c9c);});});}exports['GetVoiceQueueReport']=function(_0x2219f2){var _0x51952d=this;return new Promise(function(_0x260e2f,_0x9a7a63){return db['VoiceQueueReport']['findAll']({'raw':_0x2219f2['options']?_0x2219f2[_0x87d9('0x1b')][_0x87d9('0x1c')]===undefined?!![]:![]:!![],'where':_0x2219f2[_0x87d9('0x1b')]?_0x2219f2[_0x87d9('0x1b')]['where']||null:null,'attributes':_0x2219f2[_0x87d9('0x1b')]?_0x2219f2['options'][_0x87d9('0x1d')]||null:null,'limit':_0x2219f2[_0x87d9('0x1b')]?_0x2219f2[_0x87d9('0x1b')]['limit']||null:null,'include':_0x2219f2[_0x87d9('0x1b')]?_0x2219f2[_0x87d9('0x1b')][_0x87d9('0x1e')]?_[_0x87d9('0x1f')](_0x2219f2[_0x87d9('0x1b')][_0x87d9('0x1e')],function(_0x2a9732){return{'model':db[_0x2a9732['model']],'as':_0x2a9732['as'],'attributes':_0x2a9732['attributes'],'include':_0x2a9732[_0x87d9('0x1e')]?_['map'](_0x2a9732[_0x87d9('0x1e')],function(_0x21a6b9){return{'model':db[_0x21a6b9['model']],'as':_0x21a6b9['as'],'attributes':_0x21a6b9['attributes'],'include':_0x21a6b9[_0x87d9('0x1e')]?_[_0x87d9('0x1f')](_0x21a6b9[_0x87d9('0x1e')],function(_0x2295be){return{'model':db[_0x2295be[_0x87d9('0x20')]],'as':_0x2295be['as'],'attributes':_0x2295be['attributes']};}):[]};}):[]};}):[]:[]})[_0x87d9('0x10')](function(_0x53e1c6){logger[_0x87d9('0x11')](_0x87d9('0x21'),_0x2219f2);logger[_0x87d9('0x14')]('GetVoiceQueueReport',_0x2219f2,JSON[_0x87d9('0x16')](_0x53e1c6));_0x260e2f(_0x53e1c6);})['catch'](function(_0x2f1468){logger[_0x87d9('0x17')](_0x87d9('0x21'),_0x2f1468[_0x87d9('0x19')],_0x2219f2);_0x9a7a63(_0x51952d[_0x87d9('0x17')](0x1f4,_0x2f1468[_0x87d9('0x19')]));});});};exports['CreateVoiceQueueReport']=function(_0x1e2fc6){var _0x5f4412=this;return new Promise(function(_0x519f0a,_0x16a678){return db['VoiceQueueReport'][_0x87d9('0x22')](_0x1e2fc6['body'],{'raw':_0x1e2fc6[_0x87d9('0x1b')]?_0x1e2fc6[_0x87d9('0x1b')][_0x87d9('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x249b10){logger[_0x87d9('0x11')](_0x87d9('0x23'),_0x1e2fc6);logger[_0x87d9('0x14')]('CreateVoiceQueueReport',_0x1e2fc6,JSON[_0x87d9('0x16')](_0x249b10));_0x519f0a(_0x249b10);})[_0x87d9('0x24')](function(_0x477cab){logger[_0x87d9('0x17')]('CreateVoiceQueueReport',_0x477cab[_0x87d9('0x19')],_0x1e2fc6);_0x16a678(_0x5f4412[_0x87d9('0x17')](0x1f4,_0x477cab[_0x87d9('0x19')]));});});};exports['UpdateVoiceQueueReport']=function(_0x2771fd){var _0x4690e2=this;return new Promise(function(_0x24678a,_0x4a1908){return db[_0x87d9('0x25')][_0x87d9('0x26')](_0x2771fd[_0x87d9('0x27')],{'raw':_0x2771fd['options']?_0x2771fd['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2771fd[_0x87d9('0x1b')]?_0x2771fd[_0x87d9('0x1b')][_0x87d9('0x28')]||null:null,'attributes':_0x2771fd[_0x87d9('0x1b')]?_0x2771fd[_0x87d9('0x1b')][_0x87d9('0x1d')]||null:null,'limit':_0x2771fd[_0x87d9('0x1b')]?_0x2771fd[_0x87d9('0x1b')][_0x87d9('0x29')]||null:null})[_0x87d9('0x10')](function(_0x5c232b){logger['info']('UpdateVoiceQueueReport',_0x2771fd);logger[_0x87d9('0x14')](_0x87d9('0x2a'),_0x2771fd,JSON[_0x87d9('0x16')](_0x5c232b));_0x24678a(_0x5c232b);})[_0x87d9('0x24')](function(_0x1289ce){logger[_0x87d9('0x17')]('UpdateVoiceQueueReport',_0x1289ce[_0x87d9('0x19')],_0x2771fd);_0x4a1908(_0x4690e2[_0x87d9('0x17')](0x1f4,_0x1289ce[_0x87d9('0x19')]));});});}; \ No newline at end of file +var _0x3e03=['VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVoiceQueueReport','findAll','options','raw','limit','include','model','attributes','map','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','VoiceQueueReport','where','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','http','defaults','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0x3e03,0xb9));var _0x33e0=function(_0x55c3d9,_0x3bf75c){_0x55c3d9=_0x55c3d9-0x0;var _0x19fd97=_0x3e03[_0x55c3d9];return _0x19fd97;};'use strict';var _=require('lodash');var util=require(_0x33e0('0x0'));var moment=require(_0x33e0('0x1'));var BPromise=require(_0x33e0('0x2'));var rs=require(_0x33e0('0x3'));var fs=require('fs');var Redis=require(_0x33e0('0x4'));var db=require(_0x33e0('0x5'))['db'];var utils=require(_0x33e0('0x6'));var logger=require('../../config/logger')(_0x33e0('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x33e0('0x8')]({'port':0x232a});config['redis']=_[_0x33e0('0x9')](config[_0x33e0('0xa')],{'host':_0x33e0('0xb'),'port':0x18eb});var socket=require(_0x33e0('0xc'))(new Redis(config['redis']));require(_0x33e0('0xd'))['register'](socket);function respondWithRpcPromise(_0xcae63e,_0x45594d,_0x4ad64d){return new BPromise(function(_0x7f693e,_0x1c35e2){return client[_0x33e0('0xe')](_0xcae63e,_0x4ad64d)[_0x33e0('0xf')](function(_0x32a7aa){logger[_0x33e0('0x10')](_0x33e0('0x11'),_0x45594d,_0x33e0('0x12'));logger[_0x33e0('0x13')](_0x33e0('0x14'),_0x45594d,'request\x20sent',JSON[_0x33e0('0x15')](_0x32a7aa));if(_0x32a7aa['error']){if(_0x32a7aa['error']['code']===0x1f4){logger['error'](_0x33e0('0x11'),_0x45594d,_0x32a7aa[_0x33e0('0x16')]['message']);return _0x1c35e2(_0x32a7aa['error'][_0x33e0('0x17')]);}logger['error'](_0x33e0('0x11'),_0x45594d,_0x32a7aa['error'][_0x33e0('0x17')]);return _0x7f693e(_0x32a7aa[_0x33e0('0x16')][_0x33e0('0x17')]);}else{logger[_0x33e0('0x10')](_0x33e0('0x11'),_0x45594d,_0x33e0('0x12'));_0x7f693e(_0x32a7aa[_0x33e0('0x18')][_0x33e0('0x17')]);}})[_0x33e0('0x19')](function(_0x497250){logger[_0x33e0('0x16')]('VoiceQueueReport,\x20%s,\x20%s',_0x45594d,_0x497250);_0x1c35e2(_0x497250);});});}exports[_0x33e0('0x1a')]=function(_0x2a0675){var _0x44d498=this;return new Promise(function(_0x4c4987,_0x1c53e1){return db['VoiceQueueReport'][_0x33e0('0x1b')]({'raw':_0x2a0675[_0x33e0('0x1c')]?_0x2a0675[_0x33e0('0x1c')][_0x33e0('0x1d')]===undefined?!![]:![]:!![],'where':_0x2a0675[_0x33e0('0x1c')]?_0x2a0675['options']['where']||null:null,'attributes':_0x2a0675['options']?_0x2a0675[_0x33e0('0x1c')]['attributes']||null:null,'limit':_0x2a0675[_0x33e0('0x1c')]?_0x2a0675[_0x33e0('0x1c')][_0x33e0('0x1e')]||null:null,'include':_0x2a0675[_0x33e0('0x1c')]?_0x2a0675[_0x33e0('0x1c')][_0x33e0('0x1f')]?_['map'](_0x2a0675[_0x33e0('0x1c')]['include'],function(_0x352de9){return{'model':db[_0x352de9[_0x33e0('0x20')]],'as':_0x352de9['as'],'attributes':_0x352de9[_0x33e0('0x21')],'include':_0x352de9[_0x33e0('0x1f')]?_[_0x33e0('0x22')](_0x352de9['include'],function(_0x3ac0e6){return{'model':db[_0x3ac0e6['model']],'as':_0x3ac0e6['as'],'attributes':_0x3ac0e6[_0x33e0('0x21')],'include':_0x3ac0e6[_0x33e0('0x1f')]?_[_0x33e0('0x22')](_0x3ac0e6['include'],function(_0x5c36ab){return{'model':db[_0x5c36ab[_0x33e0('0x20')]],'as':_0x5c36ab['as'],'attributes':_0x5c36ab[_0x33e0('0x21')]};}):[]};}):[]};}):[]:[]})[_0x33e0('0xf')](function(_0x31e8e2){logger['info']('GetVoiceQueueReport',_0x2a0675);logger[_0x33e0('0x13')]('GetVoiceQueueReport',_0x2a0675,JSON[_0x33e0('0x15')](_0x31e8e2));_0x4c4987(_0x31e8e2);})[_0x33e0('0x19')](function(_0x1ec010){logger[_0x33e0('0x16')]('GetVoiceQueueReport',_0x1ec010['message'],_0x2a0675);_0x1c53e1(_0x44d498[_0x33e0('0x16')](0x1f4,_0x1ec010[_0x33e0('0x17')]));});});};exports[_0x33e0('0x23')]=function(_0x44f8c8){var _0x35f7c4=this;return new Promise(function(_0x5465b1,_0xd29a36){return db['VoiceQueueReport'][_0x33e0('0x24')](_0x44f8c8[_0x33e0('0x25')],{'raw':_0x44f8c8['options']?_0x44f8c8[_0x33e0('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5e3888){logger[_0x33e0('0x10')](_0x33e0('0x23'),_0x44f8c8);logger[_0x33e0('0x13')](_0x33e0('0x23'),_0x44f8c8,JSON[_0x33e0('0x15')](_0x5e3888));_0x5465b1(_0x5e3888);})['catch'](function(_0x1af5d1){logger[_0x33e0('0x16')](_0x33e0('0x23'),_0x1af5d1[_0x33e0('0x17')],_0x44f8c8);_0xd29a36(_0x35f7c4[_0x33e0('0x16')](0x1f4,_0x1af5d1['message']));});});};exports[_0x33e0('0x26')]=function(_0xc7d542){var _0x1b2880=this;return new Promise(function(_0x987e,_0x10e23f){return db[_0x33e0('0x27')]['update'](_0xc7d542['body'],{'raw':_0xc7d542['options']?_0xc7d542['options'][_0x33e0('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc7d542['options']?_0xc7d542[_0x33e0('0x1c')][_0x33e0('0x28')]||null:null,'attributes':_0xc7d542[_0x33e0('0x1c')]?_0xc7d542[_0x33e0('0x1c')]['attributes']||null:null,'limit':_0xc7d542[_0x33e0('0x1c')]?_0xc7d542['options']['limit']||null:null})[_0x33e0('0xf')](function(_0xc96578){logger['info']('UpdateVoiceQueueReport',_0xc7d542);logger[_0x33e0('0x13')](_0x33e0('0x26'),_0xc7d542,JSON['stringify'](_0xc96578));_0x987e(_0xc96578);})[_0x33e0('0x19')](function(_0x39dd8){logger[_0x33e0('0x16')](_0x33e0('0x26'),_0x39dd8[_0x33e0('0x17')],_0xc7d542);_0x10e23f(_0x1b2880[_0x33e0('0x16')](0x1f4,_0x39dd8[_0x33e0('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index ab90fc5..6dccf40 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 _0x7793=['emit','removeListener','register','save','remove'];(function(_0xbec422,_0x15be0e){var _0x60f26=function(_0x1e338b){while(--_0x1e338b){_0xbec422['push'](_0xbec422['shift']());}};_0x60f26(++_0x15be0e);}(_0x7793,0x120));var _0x3779=function(_0x593ba4,_0x20f01d){_0x593ba4=_0x593ba4-0x0;var _0x18d242=_0x7793[_0x593ba4];return _0x18d242;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x3779('0x0'),_0x3779('0x1'),'update'];function createListener(_0x39429e,_0x4ae5ae){return function(_0x524173){_0x4ae5ae[_0x3779('0x2')](_0x39429e,_0x524173);};}function removeListener(_0x37a2e1,_0x498410){return function(){VoiceQueueReportEvents[_0x3779('0x3')](_0x37a2e1,_0x498410);};}exports[_0x3779('0x4')]=function(_0x59dfb7){for(var _0x25b30d=0x0,_0x60c378=events['length'];_0x25b30d<_0x60c378;_0x25b30d++){var _0x4073a8=events[_0x25b30d];var _0x1bf618=createListener('voiceQueueReport:'+_0x4073a8,_0x59dfb7);VoiceQueueReportEvents['on'](_0x4073a8,_0x1bf618);}}; \ No newline at end of file +var _0x9829=['remove','update','emit','removeListener','register','length','voiceQueueReport:','./voiceQueueReport.events','save'];(function(_0x1a9ca4,_0x5115db){var _0x19a2c2=function(_0x13a68f){while(--_0x13a68f){_0x1a9ca4['push'](_0x1a9ca4['shift']());}};_0x19a2c2(++_0x5115db);}(_0x9829,0xc4));var _0x9982=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x9829[_0x13b02f];return _0x12e9a6;};'use strict';var VoiceQueueReportEvents=require(_0x9982('0x0'));var events=[_0x9982('0x1'),_0x9982('0x2'),_0x9982('0x3')];function createListener(_0x338564,_0x4c01a9){return function(_0x399b6c){_0x4c01a9[_0x9982('0x4')](_0x338564,_0x399b6c);};}function removeListener(_0x2f782a,_0x4bee19){return function(){VoiceQueueReportEvents[_0x9982('0x5')](_0x2f782a,_0x4bee19);};}exports[_0x9982('0x6')]=function(_0x58f8fe){for(var _0x500dfd=0x0,_0x340d62=events[_0x9982('0x7')];_0x500dfd<_0x340d62;_0x500dfd++){var _0x5d0824=events[_0x500dfd];var _0x25f30a=createListener(_0x9982('0x8')+_0x5d0824,_0x58f8fe);VoiceQueueReportEvents['on'](_0x5d0824,_0x25f30a);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index b5b1921..b068111 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 _0xbfb0=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','isAuthenticated','index','get','show','post','create','put','/:id','update','delete','exports','multer','path'];(function(_0x29598c,_0x103ff6){var _0x2cc251=function(_0xb0e561){while(--_0xb0e561){_0x29598c['push'](_0x29598c['shift']());}};_0x2cc251(++_0x103ff6);}(_0xbfb0,0x166));var _0x0bfb=function(_0x31e5cb,_0x2f5adf){_0x31e5cb=_0x31e5cb-0x0;var _0x4170df=_0xbfb0[_0x31e5cb];return _0x4170df;};'use strict';var multer=require(_0x0bfb('0x0'));var util=require('util');var path=require(_0x0bfb('0x1'));var timeout=require('connect-timeout');var express=require(_0x0bfb('0x2'));var router=express[_0x0bfb('0x3')]();var fs_extra=require(_0x0bfb('0x4'));var auth=require(_0x0bfb('0x5'));var interaction=require(_0x0bfb('0x6'));var config=require(_0x0bfb('0x7'));var controller=require(_0x0bfb('0x8'));router['get']('/',auth[_0x0bfb('0x9')](),controller[_0x0bfb('0xa')]);router[_0x0bfb('0xb')]('/:id',auth[_0x0bfb('0x9')](),controller[_0x0bfb('0xc')]);router[_0x0bfb('0xd')]('/',auth[_0x0bfb('0x9')](),controller[_0x0bfb('0xe')]);router[_0x0bfb('0xf')](_0x0bfb('0x10'),auth[_0x0bfb('0x9')](),controller[_0x0bfb('0x11')]);router[_0x0bfb('0x12')](_0x0bfb('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0x0bfb('0x13')]=router; \ No newline at end of file +var _0x53f9=['index','show','post','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated'];(function(_0x1b8ab9,_0x3e0b87){var _0x2ce691=function(_0xdd48cb){while(--_0xdd48cb){_0x1b8ab9['push'](_0x1b8ab9['shift']());}};_0x2ce691(++_0x3e0b87);}(_0x53f9,0xf8));var _0x953f=function(_0x51904f,_0x439694){_0x51904f=_0x51904f-0x0;var _0x24dc27=_0x53f9[_0x51904f];return _0x24dc27;};'use strict';var multer=require(_0x953f('0x0'));var util=require('util');var path=require(_0x953f('0x1'));var timeout=require(_0x953f('0x2'));var express=require(_0x953f('0x3'));var router=express[_0x953f('0x4')]();var fs_extra=require(_0x953f('0x5'));var auth=require(_0x953f('0x6'));var interaction=require(_0x953f('0x7'));var config=require(_0x953f('0x8'));var controller=require(_0x953f('0x9'));router[_0x953f('0xa')]('/',auth[_0x953f('0xb')](),controller[_0x953f('0xc')]);router[_0x953f('0xa')]('/:id',auth[_0x953f('0xb')](),controller[_0x953f('0xd')]);router[_0x953f('0xe')]('/',auth[_0x953f('0xb')](),controller['create']);router['put'](_0x953f('0xf'),auth['isAuthenticated'](),controller[_0x953f('0x10')]);router[_0x953f('0x11')](_0x953f('0xf'),auth[_0x953f('0xb')](),controller[_0x953f('0x12')]);module[_0x953f('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index b03a5a6..c6c2816 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 _0x6877=['moment','exports','STRING','YYYY-MM-DD\x20HH:mm:ss','sequelize'];(function(_0x198774,_0xdc6c5c){var _0x41c146=function(_0x191571){while(--_0x191571){_0x198774['push'](_0x198774['shift']());}};_0x41c146(++_0xdc6c5c);}(_0x6877,0xa4));var _0x7687=function(_0x4de877,_0x340170){_0x4de877=_0x4de877-0x0;var _0xb2cfeb=_0x6877[_0x4de877];return _0xb2cfeb;};'use strict';var Sequelize=require(_0x7687('0x0'));var moment=require(_0x7687('0x1'));module[_0x7687('0x2')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x7687('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x7687('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x7687('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x7687('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x7687('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x7687('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x7687('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x7687('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()['format'](_0x7687('0x4'))}}; \ No newline at end of file +var _0xc2a0=['sequelize','moment','exports','STRING','DATE','format'];(function(_0x2de4e8,_0x3de149){var _0x261241=function(_0x33b3c4){while(--_0x33b3c4){_0x2de4e8['push'](_0x2de4e8['shift']());}};_0x261241(++_0x3de149);}(_0xc2a0,0x1aa));var _0x0c2a=function(_0x5a3db7,_0x2c1af0){_0x5a3db7=_0x5a3db7-0x0;var _0x52b418=_0xc2a0[_0x5a3db7];return _0x52b418;};'use strict';var Sequelize=require(_0x0c2a('0x0'));var moment=require(_0x0c2a('0x1'));module[_0x0c2a('0x2')]={'time':{'type':Sequelize[_0x0c2a('0x3')]},'callid':{'type':Sequelize[_0x0c2a('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x0c2a('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x0c2a('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x0c2a('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x0c2a('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x0c2a('0x4')],'allowNull':![],'defaultValue':moment()[_0x0c2a('0x5')]('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 2a676fe..3a6dab4 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 _0x6e7a=['apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','VoiceQueuesLog','includeAll','findAll','rows','catch','params','include','find','create','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range'];(function(_0x2e682b,_0x12b632){var _0x44d6a4=function(_0x240aa9){while(--_0x240aa9){_0x2e682b['push'](_0x2e682b['shift']());}};_0x44d6a4(++_0x12b632);}(_0x6e7a,0xca));var _0xa6e7=function(_0x472ded,_0x7b9b67){_0x472ded=_0x472ded-0x0;var _0x4cdf81=_0x6e7a[_0x472ded];return _0x4cdf81;};'use strict';var emlformat=require(_0xa6e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa6e7('0x1'));var jsonpatch=require(_0xa6e7('0x2'));var rp=require('request-promise');var moment=require(_0xa6e7('0x3'));var BPromise=require(_0xa6e7('0x4'));var Mustache=require(_0xa6e7('0x5'));var util=require(_0xa6e7('0x6'));var path=require(_0xa6e7('0x7'));var sox=require(_0xa6e7('0x8'));var csv=require(_0xa6e7('0x9'));var ejs=require(_0xa6e7('0xa'));var fs=require('fs');var fs_extra=require(_0xa6e7('0xb'));var _=require(_0xa6e7('0xc'));var squel=require(_0xa6e7('0xd'));var crypto=require('crypto');var jsforce=require(_0xa6e7('0xe'));var deskjs=require(_0xa6e7('0xf'));var toCsv=require(_0xa6e7('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa6e7('0x10'));var authService=require(_0xa6e7('0x11'));var qs=require(_0xa6e7('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa6e7('0x13'));var logger=require('../../config/logger')(_0xa6e7('0x14'));var utils=require(_0xa6e7('0x15'));var config=require(_0xa6e7('0x16'));var licenseUtil=require(_0xa6e7('0x17'));var db=require(_0xa6e7('0x18'))['db'];function respondWithStatusCode(_0x3c8183,_0x4e6055){_0x4e6055=_0x4e6055||0xcc;return function(_0x5abd91){if(_0x5abd91){return _0x3c8183['sendStatus'](_0x4e6055);}return _0x3c8183[_0xa6e7('0x19')](_0x4e6055)['end']();};}function respondWithResult(_0x202324,_0x5e9cb2){_0x5e9cb2=_0x5e9cb2||0xc8;return function(_0x123d72){if(_0x123d72){return _0x202324[_0xa6e7('0x19')](_0x5e9cb2)[_0xa6e7('0x1a')](_0x123d72);}};}function respondWithFilteredResult(_0x16f3b4,_0x15c7de){return function(_0x2defbc){if(_0x2defbc){var _0x995f20=typeof _0x15c7de[_0xa6e7('0x1b')]===_0xa6e7('0x1c')&&typeof _0x15c7de[_0xa6e7('0x1d')]===_0xa6e7('0x1c');var _0x2f1ba1=_0x2defbc[_0xa6e7('0x1e')];var _0x13e5c7=_0x995f20?0x0:_0x15c7de[_0xa6e7('0x1b')];var _0x3ef05b=_0x995f20?_0x2defbc[_0xa6e7('0x1e')]:_0x15c7de['offset']+_0x15c7de[_0xa6e7('0x1d')];var _0x484be6;if(_0x3ef05b>=_0x2f1ba1){_0x3ef05b=_0x2f1ba1;_0x484be6=0xc8;}else{_0x484be6=0xce;}_0x16f3b4[_0xa6e7('0x19')](_0x484be6);return _0x16f3b4['set'](_0xa6e7('0x1f'),_0x13e5c7+'-'+_0x3ef05b+'/'+_0x2f1ba1)['json'](_0x2defbc);}return null;};}function patchUpdates(_0x2ad5a5){return function(_0x534a2a){try{jsonpatch[_0xa6e7('0x20')](_0x534a2a,_0x2ad5a5,!![]);}catch(_0x5f28f3){return BPromise[_0xa6e7('0x21')](_0x5f28f3);}return _0x534a2a[_0xa6e7('0x22')]();};}function saveUpdates(_0x4906c5,_0x3268fa){return function(_0x5452cc){if(_0x5452cc){return _0x5452cc[_0xa6e7('0x23')](_0x4906c5)[_0xa6e7('0x24')](function(_0x43feea){return _0x43feea;});}return null;};}function removeEntity(_0x454496,_0x20c397){return function(_0x1e2efe){if(_0x1e2efe){return _0x1e2efe[_0xa6e7('0x25')]()[_0xa6e7('0x24')](function(){_0x454496[_0xa6e7('0x19')](0xcc)[_0xa6e7('0x26')]();});}};}function handleEntityNotFound(_0x17238b,_0x176d0f){return function(_0x4dd89a){if(!_0x4dd89a){_0x17238b[_0xa6e7('0x27')](0x194);}return _0x4dd89a;};}function handleError(_0x560ac7,_0x5bb56b){_0x5bb56b=_0x5bb56b||0x1f4;return function(_0x25b2d1){logger[_0xa6e7('0x28')](_0x25b2d1[_0xa6e7('0x29')]);if(_0x25b2d1[_0xa6e7('0x2a')]){delete _0x25b2d1[_0xa6e7('0x2a')];}_0x560ac7[_0xa6e7('0x19')](_0x5bb56b)[_0xa6e7('0x2b')](_0x25b2d1);};}exports[_0xa6e7('0x2c')]=function(_0x59762d,_0x5bb536){var _0x2a1928={},_0x31cd62={},_0x3b5dbe={'count':0x0,'rows':[]};var _0x5853f1=_[_0xa6e7('0x2d')](db['VoiceQueuesLog'][_0xa6e7('0x2e')],function(_0xaafbc9){return{'name':_0xaafbc9[_0xa6e7('0x2f')],'type':_0xaafbc9[_0xa6e7('0x30')][_0xa6e7('0x31')]};});_0x31cd62[_0xa6e7('0x32')]=_['map'](_0x5853f1,'name');_0x31cd62[_0xa6e7('0x33')]=_[_0xa6e7('0x34')](_0x59762d[_0xa6e7('0x33')]);_0x31cd62[_0xa6e7('0x35')]=_['intersection'](_0x31cd62[_0xa6e7('0x32')],_0x31cd62['query']);_0x2a1928['attributes']=_[_0xa6e7('0x36')](_0x31cd62[_0xa6e7('0x32')],qs['fields'](_0x59762d['query'][_0xa6e7('0x37')]));_0x2a1928[_0xa6e7('0x38')]=_0x2a1928['attributes'][_0xa6e7('0x39')]?_0x2a1928[_0xa6e7('0x38')]:_0x31cd62[_0xa6e7('0x32')];if(!_0x59762d[_0xa6e7('0x33')][_0xa6e7('0x3a')](_0xa6e7('0x3b'))){_0x2a1928[_0xa6e7('0x1d')]=qs['limit'](_0x59762d[_0xa6e7('0x33')]['limit']);_0x2a1928['offset']=qs['offset'](_0x59762d[_0xa6e7('0x33')][_0xa6e7('0x1b')]);}_0x2a1928[_0xa6e7('0x3c')]=qs[_0xa6e7('0x3d')](_0x59762d[_0xa6e7('0x33')][_0xa6e7('0x3d')]);_0x2a1928[_0xa6e7('0x3e')]=qs[_0xa6e7('0x35')](_[_0xa6e7('0x3f')](_0x59762d['query'],_0x31cd62['filters']),_0x5853f1);if(_0x59762d[_0xa6e7('0x33')][_0xa6e7('0x40')]){_0x2a1928[_0xa6e7('0x3e')]=_['merge'](_0x2a1928[_0xa6e7('0x3e')],{'$or':_[_0xa6e7('0x2d')](_0x5853f1,function(_0x42f301){if(_0x42f301[_0xa6e7('0x30')]!==_0xa6e7('0x41')){var _0x6c98ce={};_0x6c98ce[_0x42f301[_0xa6e7('0x2a')]]={'$like':'%'+_0x59762d[_0xa6e7('0x33')][_0xa6e7('0x40')]+'%'};return _0x6c98ce;}})});}_0x2a1928=_[_0xa6e7('0x42')]({},_0x2a1928,_0x59762d[_0xa6e7('0x43')]);var _0x97eaeb={'where':_0x2a1928[_0xa6e7('0x3e')]};return db[_0xa6e7('0x44')][_0xa6e7('0x1e')](_0x97eaeb)['then'](function(_0x548323){_0x3b5dbe[_0xa6e7('0x1e')]=_0x548323;if(_0x59762d['query'][_0xa6e7('0x45')]){_0x2a1928['include']=[{'all':!![]}];}return db[_0xa6e7('0x44')][_0xa6e7('0x46')](_0x2a1928);})['then'](function(_0x3feca9){_0x3b5dbe[_0xa6e7('0x47')]=_0x3feca9;return _0x3b5dbe;})[_0xa6e7('0x24')](respondWithFilteredResult(_0x5bb536,_0x2a1928))[_0xa6e7('0x48')](handleError(_0x5bb536,null));};exports['show']=function(_0x22c86d,_0x51d2d2){var _0x2a5bf7={'raw':!![],'where':{'id':_0x22c86d[_0xa6e7('0x49')]['id']}},_0x3b5981={};_0x3b5981['model']=_[_0xa6e7('0x34')](db[_0xa6e7('0x44')][_0xa6e7('0x2e')]);_0x3b5981['query']=_[_0xa6e7('0x34')](_0x22c86d[_0xa6e7('0x33')]);_0x3b5981[_0xa6e7('0x35')]=_[_0xa6e7('0x36')](_0x3b5981[_0xa6e7('0x32')],_0x3b5981[_0xa6e7('0x33')]);_0x2a5bf7['attributes']=_[_0xa6e7('0x36')](_0x3b5981['model'],qs['fields'](_0x22c86d[_0xa6e7('0x33')][_0xa6e7('0x37')]));_0x2a5bf7['attributes']=_0x2a5bf7[_0xa6e7('0x38')]['length']?_0x2a5bf7[_0xa6e7('0x38')]:_0x3b5981['model'];if(_0x22c86d[_0xa6e7('0x33')][_0xa6e7('0x45')]){_0x2a5bf7[_0xa6e7('0x4a')]=[{'all':!![]}];}_0x2a5bf7=_[_0xa6e7('0x42')]({},_0x2a5bf7,_0x22c86d[_0xa6e7('0x43')]);return db['VoiceQueuesLog'][_0xa6e7('0x4b')](_0x2a5bf7)[_0xa6e7('0x24')](handleEntityNotFound(_0x51d2d2,null))[_0xa6e7('0x24')](respondWithResult(_0x51d2d2,null))[_0xa6e7('0x48')](handleError(_0x51d2d2,null));};exports[_0xa6e7('0x4c')]=function(_0x59380c,_0x27fbc3){return db[_0xa6e7('0x44')][_0xa6e7('0x4c')](_0x59380c[_0xa6e7('0x4d')],{})[_0xa6e7('0x24')](respondWithResult(_0x27fbc3,0xc9))[_0xa6e7('0x48')](handleError(_0x27fbc3,null));};exports[_0xa6e7('0x23')]=function(_0x566c84,_0x3e63f7){if(_0x566c84[_0xa6e7('0x4d')]['id']){delete _0x566c84[_0xa6e7('0x4d')]['id'];}return db[_0xa6e7('0x44')][_0xa6e7('0x4b')]({'where':{'id':_0x566c84[_0xa6e7('0x49')]['id']}})['then'](handleEntityNotFound(_0x3e63f7,null))['then'](saveUpdates(_0x566c84[_0xa6e7('0x4d')],null))[_0xa6e7('0x24')](respondWithResult(_0x3e63f7,null))[_0xa6e7('0x48')](handleError(_0x3e63f7,null));};exports[_0xa6e7('0x25')]=function(_0x2a9cbf,_0x1f2d42){return db['VoiceQueuesLog'][_0xa6e7('0x4b')]({'where':{'id':_0x2a9cbf['params']['id']}})[_0xa6e7('0x24')](handleEntityNotFound(_0x1f2d42,null))[_0xa6e7('0x24')](removeEntity(_0x1f2d42,null))[_0xa6e7('0x48')](handleError(_0x1f2d42,null));}; \ No newline at end of file +var _0xd5ba=['VoiceQueuesLog','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','VIRTUAL','filter','merge','where','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','reject','then','destroy','error','name','index'];(function(_0x433795,_0x253d09){var _0x27661e=function(_0x1c4870){while(--_0x1c4870){_0x433795['push'](_0x433795['shift']());}};_0x27661e(++_0x253d09);}(_0xd5ba,0xb2));var _0xad5b=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0xd5ba[_0x1762b4];return _0x29beda;};'use strict';var emlformat=require(_0xad5b('0x0'));var rimraf=require(_0xad5b('0x1'));var zipdir=require(_0xad5b('0x2'));var jsonpatch=require(_0xad5b('0x3'));var rp=require(_0xad5b('0x4'));var moment=require(_0xad5b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xad5b('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xad5b('0x7'));var ejs=require(_0xad5b('0x8'));var fs=require('fs');var fs_extra=require(_0xad5b('0x9'));var _=require(_0xad5b('0xa'));var squel=require('squel');var crypto=require(_0xad5b('0xb'));var jsforce=require(_0xad5b('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xad5b('0x7'));var querystring=require(_0xad5b('0xd'));var Papa=require(_0xad5b('0xe'));var Redis=require(_0xad5b('0xf'));var authService=require(_0xad5b('0x10'));var qs=require(_0xad5b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xad5b('0x12'));var logger=require(_0xad5b('0x13'))(_0xad5b('0x14'));var utils=require('../../config/utils');var config=require(_0xad5b('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xad5b('0x16'))['db'];function respondWithStatusCode(_0x5d052a,_0x1b7d54){_0x1b7d54=_0x1b7d54||0xcc;return function(_0x449b6b){if(_0x449b6b){return _0x5d052a[_0xad5b('0x17')](_0x1b7d54);}return _0x5d052a['status'](_0x1b7d54)[_0xad5b('0x18')]();};}function respondWithResult(_0x2144af,_0x985a98){_0x985a98=_0x985a98||0xc8;return function(_0x5c8327){if(_0x5c8327){return _0x2144af[_0xad5b('0x19')](_0x985a98)[_0xad5b('0x1a')](_0x5c8327);}};}function respondWithFilteredResult(_0x1ff27b,_0x59d79d){return function(_0x438601){if(_0x438601){var _0x14bac6=typeof _0x59d79d[_0xad5b('0x1b')]===_0xad5b('0x1c')&&typeof _0x59d79d['limit']===_0xad5b('0x1c');var _0x1b4e84=_0x438601[_0xad5b('0x1d')];var _0x438cb8=_0x14bac6?0x0:_0x59d79d[_0xad5b('0x1b')];var _0xdf408e=_0x14bac6?_0x438601[_0xad5b('0x1d')]:_0x59d79d[_0xad5b('0x1b')]+_0x59d79d[_0xad5b('0x1e')];var _0x5805e8;if(_0xdf408e>=_0x1b4e84){_0xdf408e=_0x1b4e84;_0x5805e8=0xc8;}else{_0x5805e8=0xce;}_0x1ff27b[_0xad5b('0x19')](_0x5805e8);return _0x1ff27b[_0xad5b('0x1f')]('Content-Range',_0x438cb8+'-'+_0xdf408e+'/'+_0x1b4e84)[_0xad5b('0x1a')](_0x438601);}return null;};}function patchUpdates(_0x362997){return function(_0x25233a){try{jsonpatch['apply'](_0x25233a,_0x362997,!![]);}catch(_0x138ff2){return BPromise[_0xad5b('0x20')](_0x138ff2);}return _0x25233a['save']();};}function saveUpdates(_0x18d445,_0x9d5b6d){return function(_0x2627b8){if(_0x2627b8){return _0x2627b8['update'](_0x18d445)[_0xad5b('0x21')](function(_0x29c4d4){return _0x29c4d4;});}return null;};}function removeEntity(_0x36a27a,_0x443b9f){return function(_0x35cb88){if(_0x35cb88){return _0x35cb88[_0xad5b('0x22')]()[_0xad5b('0x21')](function(){_0x36a27a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a1073,_0xe9f74d){return function(_0x1b684d){if(!_0x1b684d){_0x5a1073['sendStatus'](0x194);}return _0x1b684d;};}function handleError(_0x31dc33,_0x2eb4f6){_0x2eb4f6=_0x2eb4f6||0x1f4;return function(_0x418676){logger[_0xad5b('0x23')](_0x418676['stack']);if(_0x418676[_0xad5b('0x24')]){delete _0x418676['name'];}_0x31dc33[_0xad5b('0x19')](_0x2eb4f6)['send'](_0x418676);};}exports[_0xad5b('0x25')]=function(_0x51aee4,_0x2818c9){var _0x134480={},_0x5bd1f6={},_0x2b1034={'count':0x0,'rows':[]};var _0x2e96c1=_['map'](db[_0xad5b('0x26')][_0xad5b('0x27')],function(_0x2a206e){return{'name':_0x2a206e[_0xad5b('0x28')],'type':_0x2a206e[_0xad5b('0x29')][_0xad5b('0x2a')]};});_0x5bd1f6[_0xad5b('0x2b')]=_[_0xad5b('0x2c')](_0x2e96c1,_0xad5b('0x24'));_0x5bd1f6[_0xad5b('0x2d')]=_[_0xad5b('0x2e')](_0x51aee4[_0xad5b('0x2d')]);_0x5bd1f6[_0xad5b('0x2f')]=_[_0xad5b('0x30')](_0x5bd1f6[_0xad5b('0x2b')],_0x5bd1f6[_0xad5b('0x2d')]);_0x134480[_0xad5b('0x31')]=_[_0xad5b('0x30')](_0x5bd1f6['model'],qs['fields'](_0x51aee4[_0xad5b('0x2d')][_0xad5b('0x32')]));_0x134480[_0xad5b('0x31')]=_0x134480[_0xad5b('0x31')][_0xad5b('0x33')]?_0x134480[_0xad5b('0x31')]:_0x5bd1f6[_0xad5b('0x2b')];if(!_0x51aee4[_0xad5b('0x2d')][_0xad5b('0x34')](_0xad5b('0x35'))){_0x134480[_0xad5b('0x1e')]=qs[_0xad5b('0x1e')](_0x51aee4[_0xad5b('0x2d')][_0xad5b('0x1e')]);_0x134480[_0xad5b('0x1b')]=qs['offset'](_0x51aee4[_0xad5b('0x2d')]['offset']);}_0x134480[_0xad5b('0x36')]=qs[_0xad5b('0x37')](_0x51aee4[_0xad5b('0x2d')][_0xad5b('0x37')]);_0x134480['where']=qs['filters'](_['pick'](_0x51aee4[_0xad5b('0x2d')],_0x5bd1f6[_0xad5b('0x2f')]),_0x2e96c1);if(_0x51aee4[_0xad5b('0x2d')]['filter']){_0x134480['where']=_['merge'](_0x134480['where'],{'$or':_[_0xad5b('0x2c')](_0x2e96c1,function(_0x4bc528){if(_0x4bc528[_0xad5b('0x29')]!==_0xad5b('0x38')){var _0x5ccb3e={};_0x5ccb3e[_0x4bc528[_0xad5b('0x24')]]={'$like':'%'+_0x51aee4[_0xad5b('0x2d')][_0xad5b('0x39')]+'%'};return _0x5ccb3e;}})});}_0x134480=_[_0xad5b('0x3a')]({},_0x134480,_0x51aee4['options']);var _0x5f4265={'where':_0x134480[_0xad5b('0x3b')]};return db[_0xad5b('0x26')]['count'](_0x5f4265)[_0xad5b('0x21')](function(_0x37f2f2){_0x2b1034[_0xad5b('0x1d')]=_0x37f2f2;if(_0x51aee4[_0xad5b('0x2d')][_0xad5b('0x3c')]){_0x134480[_0xad5b('0x3d')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0xad5b('0x3e')](_0x134480);})[_0xad5b('0x21')](function(_0x556a56){_0x2b1034[_0xad5b('0x3f')]=_0x556a56;return _0x2b1034;})[_0xad5b('0x21')](respondWithFilteredResult(_0x2818c9,_0x134480))[_0xad5b('0x40')](handleError(_0x2818c9,null));};exports[_0xad5b('0x41')]=function(_0x448e49,_0x47ed92){var _0x411608={'raw':!![],'where':{'id':_0x448e49[_0xad5b('0x42')]['id']}},_0x15f2f3={};_0x15f2f3['model']=_['keys'](db[_0xad5b('0x26')][_0xad5b('0x27')]);_0x15f2f3[_0xad5b('0x2d')]=_[_0xad5b('0x2e')](_0x448e49[_0xad5b('0x2d')]);_0x15f2f3['filters']=_['intersection'](_0x15f2f3[_0xad5b('0x2b')],_0x15f2f3[_0xad5b('0x2d')]);_0x411608[_0xad5b('0x31')]=_['intersection'](_0x15f2f3[_0xad5b('0x2b')],qs[_0xad5b('0x32')](_0x448e49[_0xad5b('0x2d')][_0xad5b('0x32')]));_0x411608[_0xad5b('0x31')]=_0x411608[_0xad5b('0x31')][_0xad5b('0x33')]?_0x411608[_0xad5b('0x31')]:_0x15f2f3[_0xad5b('0x2b')];if(_0x448e49[_0xad5b('0x2d')][_0xad5b('0x3c')]){_0x411608[_0xad5b('0x3d')]=[{'all':!![]}];}_0x411608=_[_0xad5b('0x3a')]({},_0x411608,_0x448e49[_0xad5b('0x43')]);return db['VoiceQueuesLog'][_0xad5b('0x44')](_0x411608)[_0xad5b('0x21')](handleEntityNotFound(_0x47ed92,null))[_0xad5b('0x21')](respondWithResult(_0x47ed92,null))[_0xad5b('0x40')](handleError(_0x47ed92,null));};exports['create']=function(_0x17ac67,_0x2e5a23){return db[_0xad5b('0x26')][_0xad5b('0x45')](_0x17ac67[_0xad5b('0x46')],{})[_0xad5b('0x21')](respondWithResult(_0x2e5a23,0xc9))[_0xad5b('0x40')](handleError(_0x2e5a23,null));};exports[_0xad5b('0x47')]=function(_0x87a73d,_0xc860a7){if(_0x87a73d[_0xad5b('0x46')]['id']){delete _0x87a73d['body']['id'];}return db[_0xad5b('0x26')]['find']({'where':{'id':_0x87a73d[_0xad5b('0x42')]['id']}})['then'](handleEntityNotFound(_0xc860a7,null))[_0xad5b('0x21')](saveUpdates(_0x87a73d['body'],null))['then'](respondWithResult(_0xc860a7,null))[_0xad5b('0x40')](handleError(_0xc860a7,null));};exports[_0xad5b('0x22')]=function(_0x3113b1,_0x387cd5){return db[_0xad5b('0x26')][_0xad5b('0x44')]({'where':{'id':_0x3113b1['params']['id']}})[_0xad5b('0x21')](handleEntityNotFound(_0x387cd5,null))[_0xad5b('0x21')](removeEntity(_0x387cd5,null))[_0xad5b('0x40')](handleError(_0x387cd5,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 420c578..3caf3d2 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 _0x9290=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','util','../../config/logger','api','moment'];(function(_0x13345d,_0x53cb21){var _0x4095b5=function(_0x304972){while(--_0x304972){_0x13345d['push'](_0x13345d['shift']());}};_0x4095b5(++_0x53cb21);}(_0x9290,0x79));var _0x0929=function(_0x40f991,_0x576819){_0x40f991=_0x40f991-0x0;var _0x38eca2=_0x9290[_0x40f991];return _0x38eca2;};'use strict';var _=require(_0x0929('0x0'));var util=require(_0x0929('0x1'));var logger=require(_0x0929('0x2'))(_0x0929('0x3'));var moment=require(_0x0929('0x4'));var BPromise=require(_0x0929('0x5'));var rp=require(_0x0929('0x6'));var fs=require('fs');var path=require(_0x0929('0x7'));var rimraf=require(_0x0929('0x8'));var config=require(_0x0929('0x9'));var attributes=require(_0x0929('0xa'));module[_0x0929('0xb')]=function(_0x54b97e,_0x4ebba4){return _0x54b97e[_0x0929('0xc')](_0x0929('0xd'),attributes,{'tableName':_0x0929('0xe'),'paranoid':![],'indexes':[{'name':_0x0929('0xf'),'fields':[_0x0929('0x10'),_0x0929('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0xb01a=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','define','voice_queues_log','event_dtm','event','dtm'];(function(_0x56b29a,_0x446611){var _0x26ba7d=function(_0x224cbe){while(--_0x224cbe){_0x56b29a['push'](_0x56b29a['shift']());}};_0x26ba7d(++_0x446611);}(_0xb01a,0xe0));var _0xab01=function(_0x2a744b,_0x393bbc){_0x2a744b=_0x2a744b-0x0;var _0x430a5e=_0xb01a[_0x2a744b];return _0x430a5e;};'use strict';var _=require(_0xab01('0x0'));var util=require(_0xab01('0x1'));var logger=require(_0xab01('0x2'))(_0xab01('0x3'));var moment=require(_0xab01('0x4'));var BPromise=require(_0xab01('0x5'));var rp=require(_0xab01('0x6'));var fs=require('fs');var path=require(_0xab01('0x7'));var rimraf=require(_0xab01('0x8'));var config=require(_0xab01('0x9'));var attributes=require(_0xab01('0xa'));module['exports']=function(_0x502e33,_0x4ff501){return _0x502e33[_0xab01('0xb')]('VoiceQueuesLog',attributes,{'tableName':_0xab01('0xc'),'paranoid':![],'indexes':[{'name':_0xab01('0xd'),'fields':[_0xab01('0xe'),_0xab01('0xf')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 13dcdb8..2d1d19b 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 _0x45c2=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','info','VoiceQueuesLog,\x20%s,\x20%s','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x45c2,0x13a));var _0x245c=function(_0x4fbb3e,_0x55785f){_0x4fbb3e=_0x4fbb3e-0x0;var _0x1eb197=_0x45c2[_0x4fbb3e];return _0x1eb197;};'use strict';var _=require(_0x245c('0x0'));var util=require(_0x245c('0x1'));var moment=require(_0x245c('0x2'));var BPromise=require(_0x245c('0x3'));var rs=require(_0x245c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x245c('0x5'))['db'];var utils=require(_0x245c('0x6'));var logger=require(_0x245c('0x7'))(_0x245c('0x8'));var config=require(_0x245c('0x9'));var jayson=require(_0x245c('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4a6441,_0x4cabaa,_0x508dde){return new BPromise(function(_0x58314a,_0x24dc4d){return client['request'](_0x4a6441,_0x508dde)['then'](function(_0x8ed8e5){logger[_0x245c('0xb')](_0x245c('0xc'),_0x4cabaa,'request\x20sent');logger[_0x245c('0xd')](_0x245c('0xe'),_0x4cabaa,_0x245c('0xf'),JSON[_0x245c('0x10')](_0x8ed8e5));if(_0x8ed8e5[_0x245c('0x11')]){if(_0x8ed8e5[_0x245c('0x11')][_0x245c('0x12')]===0x1f4){logger[_0x245c('0x11')](_0x245c('0xc'),_0x4cabaa,_0x8ed8e5['error'][_0x245c('0x13')]);return _0x24dc4d(_0x8ed8e5[_0x245c('0x11')][_0x245c('0x13')]);}logger[_0x245c('0x11')](_0x245c('0xc'),_0x4cabaa,_0x8ed8e5[_0x245c('0x11')][_0x245c('0x13')]);return _0x58314a(_0x8ed8e5[_0x245c('0x11')]['message']);}else{logger[_0x245c('0xb')](_0x245c('0xc'),_0x4cabaa,_0x245c('0xf'));_0x58314a(_0x8ed8e5['result'][_0x245c('0x13')]);}})['catch'](function(_0x2d56d3){logger[_0x245c('0x11')]('VoiceQueuesLog,\x20%s,\x20%s',_0x4cabaa,_0x2d56d3);_0x24dc4d(_0x2d56d3);});});} \ No newline at end of file +var _0x0d98=['request\x20sent','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','VoiceQueuesLog,\x20%s,\x20%s'];(function(_0x4a2b0b,_0xf81dc7){var _0x2db990=function(_0x2896d5){while(--_0x2896d5){_0x4a2b0b['push'](_0x4a2b0b['shift']());}};_0x2db990(++_0xf81dc7);}(_0x0d98,0x149));var _0x80d9=function(_0x3ee832,_0x4ac779){_0x3ee832=_0x3ee832-0x0;var _0x22f0e8=_0x0d98[_0x3ee832];return _0x22f0e8;};'use strict';var _=require(_0x80d9('0x0'));var util=require(_0x80d9('0x1'));var moment=require(_0x80d9('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x80d9('0x3'))['db'];var utils=require(_0x80d9('0x4'));var logger=require(_0x80d9('0x5'))(_0x80d9('0x6'));var config=require('../../config/environment');var jayson=require(_0x80d9('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5e5f6b,_0x45f2f1,_0xb8d05){return new BPromise(function(_0x5cc7b7,_0x4f3fe9){return client[_0x80d9('0x8')](_0x5e5f6b,_0xb8d05)[_0x80d9('0x9')](function(_0x4e874d){logger['info'](_0x80d9('0xa'),_0x45f2f1,_0x80d9('0xb'));logger['debug'](_0x80d9('0xc'),_0x45f2f1,_0x80d9('0xb'),JSON[_0x80d9('0xd')](_0x4e874d));if(_0x4e874d[_0x80d9('0xe')]){if(_0x4e874d[_0x80d9('0xe')][_0x80d9('0xf')]===0x1f4){logger['error'](_0x80d9('0xa'),_0x45f2f1,_0x4e874d[_0x80d9('0xe')]['message']);return _0x4f3fe9(_0x4e874d[_0x80d9('0xe')][_0x80d9('0x10')]);}logger[_0x80d9('0xe')]('VoiceQueuesLog,\x20%s,\x20%s',_0x45f2f1,_0x4e874d[_0x80d9('0xe')]['message']);return _0x5cc7b7(_0x4e874d[_0x80d9('0xe')][_0x80d9('0x10')]);}else{logger[_0x80d9('0x11')](_0x80d9('0xa'),_0x45f2f1,'request\x20sent');_0x5cc7b7(_0x4e874d[_0x80d9('0x12')][_0x80d9('0x10')]);}})[_0x80d9('0x13')](function(_0xa8c7e9){logger[_0x80d9('0xe')](_0x80d9('0xa'),_0x45f2f1,_0xa8c7e9);_0x4f3fe9(_0xa8c7e9);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 82b8997..507840a 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 _0xae48=['Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceRecording.controller','isAuthenticated','index','get','describe','show','download','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x56eb70,_0x2bd75c){var _0x47f1fe=function(_0x1fbb17){while(--_0x1fbb17){_0x56eb70['push'](_0x56eb70['shift']());}};_0x47f1fe(++_0x2bd75c);}(_0xae48,0x12f));var _0x8ae4=function(_0x61bb05,_0x47421f){_0x61bb05=_0x61bb05-0x0;var _0x3ceb3e=_0xae48[_0x61bb05];return _0x3ceb3e;};'use strict';var multer=require(_0x8ae4('0x0'));var util=require(_0x8ae4('0x1'));var path=require(_0x8ae4('0x2'));var timeout=require(_0x8ae4('0x3'));var express=require(_0x8ae4('0x4'));var router=express[_0x8ae4('0x5')]();var fs_extra=require(_0x8ae4('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x8ae4('0x7'));var config=require(_0x8ae4('0x8'));var controller=require(_0x8ae4('0x9'));router['get']('/',auth[_0x8ae4('0xa')](),controller[_0x8ae4('0xb')]);router[_0x8ae4('0xc')]('/describe',auth[_0x8ae4('0xa')](),controller[_0x8ae4('0xd')]);router[_0x8ae4('0xc')]('/:id',auth[_0x8ae4('0xa')](),controller[_0x8ae4('0xe')]);router[_0x8ae4('0xc')]('/:id/download',auth[_0x8ae4('0xa')](),controller[_0x8ae4('0xf')]);router[_0x8ae4('0xc')]('/:id/downloads',controller[_0x8ae4('0x10')]);router[_0x8ae4('0xc')](_0x8ae4('0x11'),auth['isAuthenticated'](),controller[_0x8ae4('0x12')]);router[_0x8ae4('0x13')]('/',auth[_0x8ae4('0xa')](),controller[_0x8ae4('0x14')]);router['post'](_0x8ae4('0x11'),auth[_0x8ae4('0xa')](),controller[_0x8ae4('0x15')]);router[_0x8ae4('0x16')](_0x8ae4('0x17'),auth[_0x8ae4('0xa')](),controller[_0x8ae4('0x18')]);router[_0x8ae4('0x19')](_0x8ae4('0x17'),auth['isAuthenticated'](),controller[_0x8ae4('0x1a')]);module[_0x8ae4('0x1b')]=router; \ No newline at end of file +var _0x0d97=['../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','runTranscribe','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x44377b,_0x41e8c4){var _0x217201=function(_0x439424){while(--_0x439424){_0x44377b['push'](_0x44377b['shift']());}};_0x217201(++_0x41e8c4);}(_0x0d97,0x6c));var _0x70d9=function(_0x42993f,_0x46b735){_0x42993f=_0x42993f-0x0;var _0x3a2677=_0x0d97[_0x42993f];return _0x3a2677;};'use strict';var multer=require(_0x70d9('0x0'));var util=require('util');var path=require(_0x70d9('0x1'));var timeout=require(_0x70d9('0x2'));var express=require(_0x70d9('0x3'));var router=express[_0x70d9('0x4')]();var fs_extra=require(_0x70d9('0x5'));var auth=require(_0x70d9('0x6'));var interaction=require(_0x70d9('0x7'));var config=require(_0x70d9('0x8'));var controller=require(_0x70d9('0x9'));router[_0x70d9('0xa')]('/',auth[_0x70d9('0xb')](),controller[_0x70d9('0xc')]);router['get'](_0x70d9('0xd'),auth[_0x70d9('0xb')](),controller[_0x70d9('0xe')]);router['get'](_0x70d9('0xf'),auth['isAuthenticated'](),controller[_0x70d9('0x10')]);router['get'](_0x70d9('0x11'),auth[_0x70d9('0xb')](),controller['download']);router['get'](_0x70d9('0x12'),controller[_0x70d9('0x13')]);router[_0x70d9('0xa')](_0x70d9('0x14'),auth[_0x70d9('0xb')](),controller[_0x70d9('0x15')]);router[_0x70d9('0x16')]('/',auth[_0x70d9('0xb')](),controller['create']);router[_0x70d9('0x16')]('/:id/transcribe',auth[_0x70d9('0xb')](),controller[_0x70d9('0x17')]);router[_0x70d9('0x18')](_0x70d9('0xf'),auth[_0x70d9('0xb')](),controller[_0x70d9('0x19')]);router[_0x70d9('0x1a')](_0x70d9('0xf'),auth[_0x70d9('0xb')](),controller[_0x70d9('0x1b')]);module[_0x70d9('0x1c')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 9e04322..d5001a4 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(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'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(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 9cffa0f..b611c1c 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 _0xf5c6=['Not\x20found','sequelize','MD5','col','$and','push','recording','extname','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','TranscribeService','startTranscriptionJob','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','secrets','Voice\x20Recording\x20not\x20found','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','data2','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','tempSentiment','writeFile','downloadTranscribe','root','Transcript\x20not\x20available','eml-format','rimraf','fast-json-patch','moment','bluebird','path','sox','to-csv','fs-extra','squel','crypto','querystring','papaparse','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','error','name','send','index','map','VoiceRecording','fieldName','type','key','model','differenceBy','format','keys','filters','intersection','query','attributes','fields','length','order','sort','filter','where','merge','options','includeAll','findAll','rows','rawAttributes','include','catch','create','update','body','find','params','describe','../../components/encryptor','uniqueid','value','%s.cypher','decryptFile','existsSync','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','unlink','download','message'];(function(_0x428f8f,_0x2badad){var _0x424d27=function(_0x593d5c){while(--_0x593d5c){_0x428f8f['push'](_0x428f8f['shift']());}};_0x424d27(++_0x2badad);}(_0xf5c6,0xca));var _0x6f5c=function(_0x11d694,_0x59cf76){_0x11d694=_0x11d694-0x0;var _0x3ba8d4=_0xf5c6[_0x11d694];return _0x3ba8d4;};'use strict';var emlformat=require(_0x6f5c('0x0'));var rimraf=require(_0x6f5c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6f5c('0x2'));var rp=require('request-promise');var moment=require(_0x6f5c('0x3'));var BPromise=require(_0x6f5c('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6f5c('0x5'));var sox=require(_0x6f5c('0x6'));var csv=require(_0x6f5c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6f5c('0x8'));var _=require('lodash');var squel=require(_0x6f5c('0x9'));var crypto=require(_0x6f5c('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6f5c('0xb'));var Papa=require(_0x6f5c('0xc'));var AWS=require('aws-sdk');var uuidv4=require(_0x6f5c('0xd'));var Redis=require(_0x6f5c('0xe'));var authService=require(_0x6f5c('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x6f5c('0x10'));var hardwareService=require(_0x6f5c('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x6f5c('0x12'));var licenseUtil=require(_0x6f5c('0x13'));var db=require(_0x6f5c('0x14'))['db'];function respondWithStatusCode(_0x31806d,_0x456794){_0x456794=_0x456794||0xcc;return function(_0x10f22c){if(_0x10f22c){return _0x31806d[_0x6f5c('0x15')](_0x456794);}return _0x31806d[_0x6f5c('0x16')](_0x456794)[_0x6f5c('0x17')]();};}function respondWithResult(_0x48298b,_0x39b748){_0x39b748=_0x39b748||0xc8;return function(_0x210d09){if(_0x210d09){return _0x48298b[_0x6f5c('0x16')](_0x39b748)[_0x6f5c('0x18')](_0x210d09);}};}function respondWithFilteredResult(_0x21142d,_0xe90283){return function(_0x245407){if(_0x245407){var _0x39c852=typeof _0xe90283[_0x6f5c('0x19')]===_0x6f5c('0x1a')&&typeof _0xe90283[_0x6f5c('0x1b')]===_0x6f5c('0x1a');var _0xd9c989=_0x245407[_0x6f5c('0x1c')];var _0x15d73a=_0x39c852?0x0:_0xe90283[_0x6f5c('0x19')];var _0x3d0f63=_0x39c852?_0x245407[_0x6f5c('0x1c')]:_0xe90283[_0x6f5c('0x19')]+_0xe90283[_0x6f5c('0x1b')];var _0x3d5975;if(_0x3d0f63>=_0xd9c989){_0x3d0f63=_0xd9c989;_0x3d5975=0xc8;}else{_0x3d5975=0xce;}_0x21142d['status'](_0x3d5975);return _0x21142d[_0x6f5c('0x1d')](_0x6f5c('0x1e'),_0x15d73a+'-'+_0x3d0f63+'/'+_0xd9c989)['json'](_0x245407);}return null;};}function patchUpdates(_0x2f3e75){return function(_0x195e76){try{jsonpatch['apply'](_0x195e76,_0x2f3e75,!![]);}catch(_0x151eb7){return BPromise[_0x6f5c('0x1f')](_0x151eb7);}return _0x195e76[_0x6f5c('0x20')]();};}function saveUpdates(_0x24369a,_0x581429){return function(_0x2b2ef0){if(_0x2b2ef0){return _0x2b2ef0['update'](_0x24369a)[_0x6f5c('0x21')](function(_0xf147aa){return _0xf147aa;});}return null;};}function removeEntity(_0x2cdbf5,_0x34a49d){return function(_0x2483b1){if(_0x2483b1){return _0x2483b1['destroy']()[_0x6f5c('0x21')](function(){_0x2cdbf5[_0x6f5c('0x16')](0xcc)[_0x6f5c('0x17')]();});}};}function handleEntityNotFound(_0x3b4004,_0x15665a){return function(_0x2ff40a){if(!_0x2ff40a){_0x3b4004['sendStatus'](0x194);}return _0x2ff40a;};}function handleError(_0x4797e3,_0x6c9b9d){_0x6c9b9d=_0x6c9b9d||0x1f4;return function(_0x29780){logger[_0x6f5c('0x22')](_0x29780['stack']);if(_0x29780[_0x6f5c('0x23')]){delete _0x29780[_0x6f5c('0x23')];}_0x4797e3[_0x6f5c('0x16')](_0x6c9b9d)[_0x6f5c('0x24')](_0x29780);};}exports[_0x6f5c('0x25')]=function(_0x38a3b5,_0x37fc80){var _0x54fe9c={},_0x69d2a9={},_0x22bfa8={'count':0x0,'rows':[]};var _0x155561=_[_0x6f5c('0x26')](db[_0x6f5c('0x27')]['rawAttributes'],function(_0x19ff3a){return{'name':_0x19ff3a[_0x6f5c('0x28')],'type':_0x19ff3a[_0x6f5c('0x29')][_0x6f5c('0x2a')]};});_0x69d2a9[_0x6f5c('0x2b')]=_[_0x6f5c('0x2c')](_[_0x6f5c('0x26')](_0x155561,'name'),[_0x6f5c('0x2d')]);_0x69d2a9['query']=_[_0x6f5c('0x2e')](_0x38a3b5['query']);_0x69d2a9[_0x6f5c('0x2f')]=_[_0x6f5c('0x30')](_0x69d2a9[_0x6f5c('0x2b')],_0x69d2a9[_0x6f5c('0x31')]);_0x54fe9c[_0x6f5c('0x32')]=_['intersection'](_0x69d2a9[_0x6f5c('0x2b')],qs['fields'](_0x38a3b5[_0x6f5c('0x31')][_0x6f5c('0x33')]));_0x54fe9c[_0x6f5c('0x32')]=_0x54fe9c[_0x6f5c('0x32')][_0x6f5c('0x34')]?_0x54fe9c[_0x6f5c('0x32')]:_0x69d2a9[_0x6f5c('0x2b')];if(!_0x38a3b5[_0x6f5c('0x31')]['hasOwnProperty']('nolimit')){_0x54fe9c[_0x6f5c('0x1b')]=qs[_0x6f5c('0x1b')](_0x38a3b5['query'][_0x6f5c('0x1b')]);_0x54fe9c[_0x6f5c('0x19')]=qs[_0x6f5c('0x19')](_0x38a3b5['query']['offset']);}_0x54fe9c[_0x6f5c('0x35')]=qs[_0x6f5c('0x36')](_0x38a3b5['query'][_0x6f5c('0x36')]);_0x54fe9c['where']=qs[_0x6f5c('0x2f')](_['pick'](_0x38a3b5[_0x6f5c('0x31')],_0x69d2a9[_0x6f5c('0x2f')]),_0x155561);if(_0x38a3b5[_0x6f5c('0x31')][_0x6f5c('0x37')]){_0x54fe9c[_0x6f5c('0x38')]=_[_0x6f5c('0x39')](_0x54fe9c[_0x6f5c('0x38')],{'$or':_[_0x6f5c('0x26')](_0x155561,function(_0x76401f){if(_0x76401f[_0x6f5c('0x29')]!=='VIRTUAL'){var _0x1a2169={};_0x1a2169[_0x76401f[_0x6f5c('0x23')]]={'$like':'%'+_0x38a3b5[_0x6f5c('0x31')][_0x6f5c('0x37')]+'%'};return _0x1a2169;}})});}_0x54fe9c=_['merge']({},_0x54fe9c,_0x38a3b5[_0x6f5c('0x3a')]);var _0x4b4a7c={'where':_0x54fe9c[_0x6f5c('0x38')]};return db['VoiceRecording'][_0x6f5c('0x1c')](_0x4b4a7c)[_0x6f5c('0x21')](function(_0x532c09){_0x22bfa8[_0x6f5c('0x1c')]=_0x532c09;if(_0x38a3b5[_0x6f5c('0x31')][_0x6f5c('0x3b')]){_0x54fe9c['include']=[{'all':!![]}];}return db[_0x6f5c('0x27')][_0x6f5c('0x3c')](_0x54fe9c);})[_0x6f5c('0x21')](function(_0xe1f26f){_0x22bfa8[_0x6f5c('0x3d')]=_0xe1f26f;return _0x22bfa8;})['then'](respondWithFilteredResult(_0x37fc80,_0x54fe9c))['catch'](handleError(_0x37fc80,null));};exports['show']=function(_0x292abc,_0x380cf5){var _0x3f21f2={'raw':![],'where':{'id':_0x292abc['params']['id']}},_0x30b061={};_0x30b061[_0x6f5c('0x2b')]=_[_0x6f5c('0x2e')](db[_0x6f5c('0x27')][_0x6f5c('0x3e')]);_0x30b061[_0x6f5c('0x31')]=_[_0x6f5c('0x2e')](_0x292abc[_0x6f5c('0x31')]);_0x30b061[_0x6f5c('0x2f')]=_[_0x6f5c('0x30')](_0x30b061[_0x6f5c('0x2b')],_0x30b061[_0x6f5c('0x31')]);_0x3f21f2[_0x6f5c('0x32')]=_['intersection'](_0x30b061[_0x6f5c('0x2b')],qs[_0x6f5c('0x33')](_0x292abc[_0x6f5c('0x31')][_0x6f5c('0x33')]));_0x3f21f2['attributes']=_0x3f21f2[_0x6f5c('0x32')][_0x6f5c('0x34')]?_0x3f21f2[_0x6f5c('0x32')]:_0x30b061[_0x6f5c('0x2b')];if(_0x292abc[_0x6f5c('0x31')][_0x6f5c('0x3b')]){_0x3f21f2[_0x6f5c('0x3f')]=[{'all':!![]}];}_0x3f21f2=_['merge']({},_0x3f21f2,_0x292abc['options']);return db[_0x6f5c('0x27')]['find'](_0x3f21f2)[_0x6f5c('0x21')](handleEntityNotFound(_0x380cf5,null))[_0x6f5c('0x21')](respondWithResult(_0x380cf5,null))[_0x6f5c('0x40')](handleError(_0x380cf5,null));};exports['create']=function(_0x454f8f,_0x5ce483){return db[_0x6f5c('0x27')][_0x6f5c('0x41')](_0x454f8f['body'],{})[_0x6f5c('0x21')](respondWithResult(_0x5ce483,0xc9))['catch'](handleError(_0x5ce483,null));};exports[_0x6f5c('0x42')]=function(_0x54b0de,_0x427c4c){if(_0x54b0de[_0x6f5c('0x43')]['id']){delete _0x54b0de[_0x6f5c('0x43')]['id'];}return db[_0x6f5c('0x27')][_0x6f5c('0x44')]({'where':{'id':_0x54b0de[_0x6f5c('0x45')]['id']}})[_0x6f5c('0x21')](handleEntityNotFound(_0x427c4c,null))[_0x6f5c('0x21')](saveUpdates(_0x54b0de[_0x6f5c('0x43')],null))[_0x6f5c('0x21')](respondWithResult(_0x427c4c,null))[_0x6f5c('0x40')](handleError(_0x427c4c,null));};exports['describe']=function(_0x2b4201,_0x51b9e0){return db[_0x6f5c('0x27')][_0x6f5c('0x46')]()['then'](respondWithResult(_0x51b9e0,null))[_0x6f5c('0x40')](handleError(_0x51b9e0,null));};exports['download']=function(_0x32487e,_0x53dfca,_0x77e189){var _0x27f237=require(_0x6f5c('0x47'));var _0x1bca41=![];var _0x3ca756={};if(_0x32487e[_0x6f5c('0x31')][_0x6f5c('0x29')]&&_0x32487e[_0x6f5c('0x31')][_0x6f5c('0x29')]===_0x6f5c('0x48')){_0x3ca756[_0x6f5c('0x48')]=_0x32487e[_0x6f5c('0x45')]['id'];}else{_0x3ca756['id']=_0x32487e[_0x6f5c('0x45')]['id'];}return db[_0x6f5c('0x27')]['find']({'where':_0x3ca756,'attributes':['id',_0x6f5c('0x49')],'raw':!![]})[_0x6f5c('0x21')](handleEntityNotFound(_0x53dfca,null))[_0x6f5c('0x21')](function(_0x3c2c52){if(_0x3c2c52){var _0x7b3757=_0x3c2c52['value'];var _0x342433=util['format'](_0x6f5c('0x4a'),_0x7b3757);if(fs['existsSync'](_0x342433)){_0x1bca41=!![];return _0x27f237[_0x6f5c('0x4b')](_0x342433,_0x7b3757,config['secrets']['recording'])[_0x6f5c('0x21')](function(){return _0x3c2c52;});}return _0x3c2c52;}})['then'](function(_0x2329ba){if(_0x2329ba){var _0x3b4b55=_0x2329ba['value'];if(!fs[_0x6f5c('0x4c')](_0x3b4b55)){throw new db[(_0x6f5c('0x4d'))][(_0x6f5c('0x4e'))](_0x6f5c('0x4f'));}if(_0x2329ba[_0x6f5c('0x50')]){return _0x53dfca['download'](_0x3b4b55,_0x2329ba[_0x6f5c('0x50')]+path['extname'](_0x3b4b55),function(){if(_0x1bca41){fs[_0x6f5c('0x51')](_0x3b4b55);}});}else{return _0x53dfca[_0x6f5c('0x52')](_0x3b4b55,function(_0x31970f){if(_0x1bca41){fs[_0x6f5c('0x51')](_0x3b4b55);}});}}})[_0x6f5c('0x40')](function(_0x352075){if(_0x352075[_0x6f5c('0x53')]===_0x6f5c('0x4f')){_0x53dfca[_0x6f5c('0x16')](0x194)[_0x6f5c('0x24')](_0x6f5c('0x54'));}else{return handleError(_0x53dfca,null);}});};exports['downloads']=function(_0x56a051,_0x311329,_0x24460f){var _0x4935ed=require(_0x6f5c('0x47'));var _0x1bdd04=![];var _0x49000f={'$and':[db[_0x6f5c('0x55')][_0x6f5c('0x38')](db[_0x6f5c('0x55')]['fn'](_0x6f5c('0x56'),db[_0x6f5c('0x55')][_0x6f5c('0x57')](_0x6f5c('0x48'))),_0x56a051[_0x6f5c('0x31')]['token'])]};if(_0x56a051['query'][_0x6f5c('0x29')]&&_0x56a051['query'][_0x6f5c('0x29')]==='uniqueid'){_0x49000f[_0x6f5c('0x58')][_0x6f5c('0x59')]({'uniqueid':_0x56a051['params']['id']});}else{_0x49000f[_0x6f5c('0x58')]['push']({'id':_0x56a051[_0x6f5c('0x45')]['id']});}return db['VoiceRecording'][_0x6f5c('0x44')]({'where':_0x49000f,'attributes':['id','value'],'raw':!![]})[_0x6f5c('0x21')](handleEntityNotFound(_0x311329,null))[_0x6f5c('0x21')](function(_0xdb4acf){if(_0xdb4acf){var _0x5ee9aa=util[_0x6f5c('0x2d')](_0x6f5c('0x4a'),_0xdb4acf['value']);if(fs[_0x6f5c('0x4c')](_0x5ee9aa)){_0x1bdd04=!![];return _0x4935ed[_0x6f5c('0x4b')](_0x5ee9aa,_0xdb4acf[_0x6f5c('0x49')],config['secrets'][_0x6f5c('0x5a')])[_0x6f5c('0x21')](function(){return _0xdb4acf;});}return _0xdb4acf;}})['then'](function(_0x29e330){if(_0x29e330){if(!fs[_0x6f5c('0x4c')](_0x29e330[_0x6f5c('0x49')])){throw new db[(_0x6f5c('0x4d'))][(_0x6f5c('0x4e'))](_0x6f5c('0x4f'));}if(_0x29e330['filename']){return _0x311329[_0x6f5c('0x52')](_0x29e330[_0x6f5c('0x49')],_0x29e330[_0x6f5c('0x50')]+path[_0x6f5c('0x5b')](_0x29e330[_0x6f5c('0x49')]),function(){if(_0x1bdd04){fs[_0x6f5c('0x51')](_0x29e330[_0x6f5c('0x49')]);}});}else{return _0x311329[_0x6f5c('0x52')](_0x29e330['value'],function(_0x12594f){if(_0x1bdd04){fs[_0x6f5c('0x51')](_0x29e330[_0x6f5c('0x49')]);}});}}})[_0x6f5c('0x40')](handleError(_0x311329,null));};exports[_0x6f5c('0x5c')]=function(_0x372acb,_0x2ad69a){return db['VoiceRecording'][_0x6f5c('0x44')]({'where':{'id':_0x372acb[_0x6f5c('0x45')]['id']}})[_0x6f5c('0x21')](function(_0x4512ac){if(_[_0x6f5c('0x5d')](_0x4512ac)){throw new ReferenceError(_0x6f5c('0x5e'));}return _0x4512ac;})[_0x6f5c('0x21')](function(_0x42bb5b){var _0x26d2ec=_0x42bb5b[_0x6f5c('0x49')];logger[_0x6f5c('0x5f')](_0x6f5c('0x60'),_0x26d2ec);if(!_[_0x6f5c('0x5d')](_0x42bb5b[_0x6f5c('0x49')])&&fs[_0x6f5c('0x4c')](_0x26d2ec)){logger['info'](_0x6f5c('0x61')+_0x26d2ec+_0x6f5c('0x62'));fs[_0x6f5c('0x63')](_0x26d2ec);}_0x26d2ec=_0x26d2ec+_0x6f5c('0x64');if(!_[_0x6f5c('0x5d')](_0x42bb5b['value'])&&fs[_0x6f5c('0x4c')](_0x26d2ec)){logger[_0x6f5c('0x5f')]('File:\x20\x22'+_0x26d2ec+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x6f5c('0x63')](_0x26d2ec);}return _0x42bb5b;})[_0x6f5c('0x21')](function(_0x178292){if(!_0x178292)throw new InternalError();return _0x178292[_0x6f5c('0x5c')]();})['then'](function(){_0x2ad69a[_0x6f5c('0x16')](0xcc)['end']();})[_0x6f5c('0x40')](handleError(_0x2ad69a,null));};function getBucketslist(_0x3f18ba,_0x222474,_0x36c8c9){return new Promise(function(_0x100d5d,_0x1dce6e){var _0x277c2d=new AWS['S3']({'accessKeyId':_0x222474,'secretAccessKey':_0x3f18ba,'region':_0x36c8c9});_0x277c2d[_0x6f5c('0x65')]({},function(_0x43ab92,_0x1b290c){if(_0x43ab92){return _0x1dce6e(_0x43ab92);}else{return _0x100d5d(_0x1b290c);}});});}function createBucket(_0x542c5c,_0x1ec43a,_0x2c6bbf,_0x438a6f){return new Promise(function(_0x15e4a2,_0x2c7f02){var _0x43bfb7=new AWS['S3']({'accessKeyId':_0x1ec43a,'secretAccessKey':_0x542c5c,'region':_0x2c6bbf});_0x43bfb7[_0x6f5c('0x66')]({'Bucket':_0x438a6f},function(_0x5604e8,_0x49b6a3){if(_0x5604e8){return _0x2c7f02(_0x5604e8);}else{return _0x15e4a2(_0x49b6a3);}});});}function uploadFile(_0xea50cf,_0x1201a5,_0x288690,_0x395282,_0x3320bd,_0x112d88){return new Promise(function(_0x3adf51,_0x5c3ddd){var _0x2c0de2=new AWS['S3']({'accessKeyId':_0x1201a5,'secretAccessKey':_0xea50cf,'region':_0x288690});_0x2c0de2['upload']({'Bucket':_0x395282,'Key':_0x3320bd,'Body':_0x112d88},function(_0x479270,_0x5890dd){if(_0x479270){return _0x5c3ddd(_0x479270);}else{return _0x3adf51(_0x5890dd);}});});}function startTranscribe(_0x4c2982,_0x2e71c6,_0x1cb62d,_0x28399d,_0x1c6df6,_0x5a6481){return new Promise(function(_0x386c68,_0x2868aa){var _0x438271=new AWS[(_0x6f5c('0x67'))]({'accessKeyId':_0x2e71c6,'secretAccessKey':_0x4c2982,'region':_0x1cb62d});_0x438271[_0x6f5c('0x68')]({'TranscriptionJobName':_0x28399d,'LanguageCode':_0x1c6df6,'Media':{'MediaFileUri':_0x5a6481}},function(_0x455066,_0x5698ad){if(_0x455066){return _0x2868aa(_0x455066);}else{return _0x386c68(_0x5698ad);}});});}function transcribe(_0x4679e7,_0x5aff63,_0x17ef19,_0x176daf,_0x4da330,_0x28be4f,_0x307cf8){return new Promise(function(_0x599c5d,_0x320a7d){var _0x33def2={};logger['info'](util[_0x6f5c('0x2d')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x4679e7,_0x4da330));return uploadFile(_0x5aff63,_0x17ef19,_0x176daf,_0x4da330,path['basename'](_0x28be4f),fs[_0x6f5c('0x69')](_0x28be4f))[_0x6f5c('0x21')](function(_0x4122c9){logger[_0x6f5c('0x5f')](util[_0x6f5c('0x2d')](_0x6f5c('0x6a'),_0x4679e7,_0x4da330,_0x4122c9[_0x6f5c('0x6b')]));_0x33def2[_0x6f5c('0x6c')]=_0x4122c9[_0x6f5c('0x6d')];_0x33def2[_0x6f5c('0x6e')]=_0x4122c9[_0x6f5c('0x6b')];logger[_0x6f5c('0x5f')](util[_0x6f5c('0x2d')](_0x6f5c('0x6f'),_0x4679e7));return startTranscribe(_0x5aff63,_0x17ef19,_0x176daf,uuidv4(),_0x307cf8,_0x4122c9[_0x6f5c('0x6b')]);})[_0x6f5c('0x21')](function(_0x43f978){logger[_0x6f5c('0x5f')](util[_0x6f5c('0x2d')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x4679e7,_0x43f978[_0x6f5c('0x70')][_0x6f5c('0x71')]));_0x33def2['transcribeName']=_0x43f978[_0x6f5c('0x70')]['TranscriptionJobName'];_0x33def2[_0x6f5c('0x72')]=_0x43f978[_0x6f5c('0x70')][_0x6f5c('0x73')];return _0x599c5d(_0x33def2);})['catch'](function(_0x1ef89d){return _0x320a7d(_0x1ef89d);});});}exports[_0x6f5c('0x74')]=function(_0x3b7fc2,_0x2d6cb8,_0xa648dc){var _0x5e93be;var _0x46c32d;var _0x488f48;var _0x1ad011=require(_0x6f5c('0x47'));return db[_0x6f5c('0x27')][_0x6f5c('0x75')]({'where':{'id':_0x3b7fc2[_0x6f5c('0x45')]['id']}})[_0x6f5c('0x21')](function(_0x599746){if(_0x599746){var _0x2d24b3=util[_0x6f5c('0x2d')](_0x6f5c('0x4a'),_0x599746[_0x6f5c('0x49')]);if(fs['existsSync'](_0x2d24b3)){cypher=!![];return _0x1ad011[_0x6f5c('0x4b')](_0x2d24b3,_0x599746['value'],config[_0x6f5c('0x76')][_0x6f5c('0x5a')])[_0x6f5c('0x21')](function(){return _0x599746;});}return _0x599746;}})[_0x6f5c('0x21')](function(_0x1c3f00){if(!_0x1c3f00){throw new db[(_0x6f5c('0x4d'))][(_0x6f5c('0x4e'))](_0x6f5c('0x77'));}_0x46c32d=_0x1c3f00;return db['Setting'][_0x6f5c('0x75')]({'where':{'id':0x1}});})[_0x6f5c('0x21')](handleEntityNotFound(_0x2d6cb8,null))['then'](function(_0xd26829){if(_0xd26829){_0x5e93be=_0xd26829;if(!_0x5e93be[_0x6f5c('0x78')]||!_0x5e93be[_0x6f5c('0x79')]||!_0x5e93be[_0x6f5c('0x7a')]||!_0x5e93be[_0x6f5c('0x7b')]||!_0x5e93be[_0x6f5c('0x6c')]){throw new db[(_0x6f5c('0x4d'))]['ValidationError'](_0x6f5c('0x7c'));}if(_0x3b7fc2[_0x6f5c('0x43')]['runSentiment']&&(!_0x5e93be[_0x6f5c('0x7d')]||!_0x5e93be[_0x6f5c('0x7e')]||!_0x5e93be[_0x6f5c('0x7f')]||!_0x5e93be[_0x6f5c('0x7b')]||!_0x5e93be[_0x6f5c('0x6c')])){throw new db[(_0x6f5c('0x4d'))]['ValidationError'](_0x6f5c('0x80'));}return db['CloudProvider'][_0x6f5c('0x75')]({'where':{'id':_0x5e93be[_0x6f5c('0x79')]}});}})[_0x6f5c('0x21')](function(_0x528dd1){if(!_0x528dd1){throw new db[(_0x6f5c('0x4d'))][(_0x6f5c('0x4e'))](_0x6f5c('0x81'));}if(!_0x528dd1[_0x6f5c('0x82')]||!_0x528dd1['data2']){throw new db[(_0x6f5c('0x4d'))]['ValidationError'](_0x6f5c('0x83'));}_0x488f48=_0x528dd1;return getBucketslist(_0x488f48['data1'],_0x488f48[_0x6f5c('0x84')],_0x5e93be['transcribeRegion']);})[_0x6f5c('0x21')](function(_0x351420){if(_0x351420&&_0x351420[_0x6f5c('0x85')]){var _0x371889=_[_0x6f5c('0x44')](_0x351420[_0x6f5c('0x85')],function(_0x2be867){return _0x2be867['Name']===_0x5e93be['bucket'];});if(!_0x371889){logger[_0x6f5c('0x5f')](util[_0x6f5c('0x2d')](_0x6f5c('0x86'),_0x3b7fc2[_0x6f5c('0x45')]['id'],_0x5e93be[_0x6f5c('0x6c')]));return createBucket(_0x488f48['data1'],_0x488f48[_0x6f5c('0x84')],_0x5e93be[_0x6f5c('0x7a')],_0x5e93be[_0x6f5c('0x6c')]);}logger[_0x6f5c('0x5f')](util[_0x6f5c('0x2d')](_0x6f5c('0x87'),_0x3b7fc2[_0x6f5c('0x45')]['id'],_0x5e93be['bucket']));return;}})[_0x6f5c('0x21')](function(_0x102182){if(_0x46c32d[_0x6f5c('0x72')]===_0x6f5c('0x88')){return transcribe(_0x3b7fc2[_0x6f5c('0x45')]['id'],_0x488f48['data1'],_0x488f48['data2'],_0x5e93be[_0x6f5c('0x7a')],_0x5e93be[_0x6f5c('0x6c')],_0x46c32d[_0x6f5c('0x49')],_0x5e93be[_0x6f5c('0x7b')]);}else{logger[_0x6f5c('0x5f')](util[_0x6f5c('0x2d')](_0x6f5c('0x89'),_0x3b7fc2[_0x6f5c('0x45')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0x6f5c('0x21')](function(_0x16c504){if(_0x16c504){_0x16c504[_0x6f5c('0x8a')]=_0x3b7fc2[_0x6f5c('0x43')]['runSentiment'];return _0x46c32d['updateAttributes'](_0x16c504);}})['then'](respondWithResult(_0x2d6cb8,null))['catch'](handleError(_0x2d6cb8,null));};function writeFile(_0x18d8e0,_0x3d793b){return new Promise(function(_0x405455,_0x2fd9ee){fs[_0x6f5c('0x8b')](_0x3d793b,_0x18d8e0,function(_0x576a2c,_0x453ff2){if(_0x576a2c){return _0x2fd9ee(_0x576a2c);}else{return _0x405455(_0x453ff2);}});});}exports[_0x6f5c('0x8c')]=function(_0x47e34e,_0x2491d7,_0x185f2b){return db[_0x6f5c('0x27')][_0x6f5c('0x75')]({'where':{'id':_0x47e34e[_0x6f5c('0x45')]['id']}})['then'](handleEntityNotFound(_0x2491d7))[_0x6f5c('0x21')](function(_0xf7ebb6){if(_0xf7ebb6&&_0xf7ebb6['fileText']){var _0x5e1dad=_0xf7ebb6['fileText'];var _0x3e8760=config[_0x6f5c('0x8d')]+'/server/files/transcribes/transcribe_'+_0xf7ebb6['id']+'.txt';if(fs[_0x6f5c('0x4c')](_0x3e8760)){return _0x3e8760;}return writeFile(_0x5e1dad,_0x3e8760)[_0x6f5c('0x21')](function(){return _0x3e8760;});}else{throw new db[(_0x6f5c('0x4d'))][(_0x6f5c('0x4e'))](_0x6f5c('0x8e'));}})[_0x6f5c('0x21')](function(_0x39df4d){return _0x2491d7[_0x6f5c('0x52')](_0x39df4d);})[_0x6f5c('0x40')](handleError(_0x2491d7));}; \ No newline at end of file +var _0x6c33=['[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','zip-dir','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','squel','desk.js','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','sendStatus','error','stack','name','index','map','VoiceRecording','rawAttributes','fieldName','type','key','differenceBy','format','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','uniqueid','value','%s.cypher','existsSync','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','extname','unlink','send','Not\x20found','../../components/encryptor','sequelize','MD5','$and','push','decryptFile','secrets','filename','download','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','Location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','runTranscribe','findOne','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','data2','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','NEW'];(function(_0x7709d5,_0x3a0bc4){var _0x36e23c=function(_0xaeb4e3){while(--_0xaeb4e3){_0x7709d5['push'](_0x7709d5['shift']());}};_0x36e23c(++_0x3a0bc4);}(_0x6c33,0x1cc));var _0x36c3=function(_0x46b057,_0x25aa56){_0x46b057=_0x46b057-0x0;var _0x25cf84=_0x6c33[_0x46b057];return _0x25cf84;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x36c3('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x36c3('0x1'));var moment=require(_0x36c3('0x2'));var BPromise=require(_0x36c3('0x3'));var Mustache=require(_0x36c3('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x36c3('0x5'));var ejs=require(_0x36c3('0x6'));var fs=require('fs');var fs_extra=require(_0x36c3('0x7'));var _=require('lodash');var squel=require(_0x36c3('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x36c3('0x9'));var toCsv=require(_0x36c3('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var AWS=require('aws-sdk');var uuidv4=require(_0x36c3('0xa'));var Redis=require(_0x36c3('0xb'));var authService=require(_0x36c3('0xc'));var qs=require(_0x36c3('0xd'));var as=require(_0x36c3('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x36c3('0xf'));var utils=require(_0x36c3('0x10'));var config=require(_0x36c3('0x11'));var licenseUtil=require(_0x36c3('0x12'));var db=require(_0x36c3('0x13'))['db'];function respondWithStatusCode(_0x4589f8,_0x4243d3){_0x4243d3=_0x4243d3||0xcc;return function(_0x3d8574){if(_0x3d8574){return _0x4589f8['sendStatus'](_0x4243d3);}return _0x4589f8['status'](_0x4243d3)[_0x36c3('0x14')]();};}function respondWithResult(_0x34346d,_0x514315){_0x514315=_0x514315||0xc8;return function(_0xd0693c){if(_0xd0693c){return _0x34346d[_0x36c3('0x15')](_0x514315)['json'](_0xd0693c);}};}function respondWithFilteredResult(_0xd350e5,_0x4eb3c5){return function(_0x2a743d){if(_0x2a743d){var _0x1d62df=typeof _0x4eb3c5[_0x36c3('0x16')]===_0x36c3('0x17')&&typeof _0x4eb3c5[_0x36c3('0x18')]===_0x36c3('0x17');var _0x5d332c=_0x2a743d[_0x36c3('0x19')];var _0x366e8e=_0x1d62df?0x0:_0x4eb3c5[_0x36c3('0x16')];var _0x46eb47=_0x1d62df?_0x2a743d[_0x36c3('0x19')]:_0x4eb3c5[_0x36c3('0x16')]+_0x4eb3c5[_0x36c3('0x18')];var _0x322164;if(_0x46eb47>=_0x5d332c){_0x46eb47=_0x5d332c;_0x322164=0xc8;}else{_0x322164=0xce;}_0xd350e5[_0x36c3('0x15')](_0x322164);return _0xd350e5[_0x36c3('0x1a')](_0x36c3('0x1b'),_0x366e8e+'-'+_0x46eb47+'/'+_0x5d332c)[_0x36c3('0x1c')](_0x2a743d);}return null;};}function patchUpdates(_0xbc0cdb){return function(_0x3207cc){try{jsonpatch[_0x36c3('0x1d')](_0x3207cc,_0xbc0cdb,!![]);}catch(_0x441be8){return BPromise[_0x36c3('0x1e')](_0x441be8);}return _0x3207cc[_0x36c3('0x1f')]();};}function saveUpdates(_0x2e87cf,_0x3fdb63){return function(_0x2eb992){if(_0x2eb992){return _0x2eb992[_0x36c3('0x20')](_0x2e87cf)['then'](function(_0x18a71d){return _0x18a71d;});}return null;};}function removeEntity(_0x2658e0,_0x4d2b6a){return function(_0x539803){if(_0x539803){return _0x539803['destroy']()[_0x36c3('0x21')](function(){_0x2658e0[_0x36c3('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x295e9d,_0x43f039){return function(_0x4536d2){if(!_0x4536d2){_0x295e9d[_0x36c3('0x22')](0x194);}return _0x4536d2;};}function handleError(_0x1ea73a,_0x5cf7e9){_0x5cf7e9=_0x5cf7e9||0x1f4;return function(_0x134cb5){logger[_0x36c3('0x23')](_0x134cb5[_0x36c3('0x24')]);if(_0x134cb5[_0x36c3('0x25')]){delete _0x134cb5[_0x36c3('0x25')];}_0x1ea73a[_0x36c3('0x15')](_0x5cf7e9)['send'](_0x134cb5);};}exports[_0x36c3('0x26')]=function(_0xf85063,_0x597690){var _0x59b6a2={},_0x260ca4={},_0x13e149={'count':0x0,'rows':[]};var _0x325206=_[_0x36c3('0x27')](db[_0x36c3('0x28')][_0x36c3('0x29')],function(_0x1d4054){return{'name':_0x1d4054[_0x36c3('0x2a')],'type':_0x1d4054[_0x36c3('0x2b')][_0x36c3('0x2c')]};});_0x260ca4['model']=_[_0x36c3('0x2d')](_[_0x36c3('0x27')](_0x325206,_0x36c3('0x25')),[_0x36c3('0x2e')]);_0x260ca4[_0x36c3('0x2f')]=_['keys'](_0xf85063['query']);_0x260ca4[_0x36c3('0x30')]=_[_0x36c3('0x31')](_0x260ca4[_0x36c3('0x32')],_0x260ca4[_0x36c3('0x2f')]);_0x59b6a2['attributes']=_[_0x36c3('0x31')](_0x260ca4[_0x36c3('0x32')],qs['fields'](_0xf85063[_0x36c3('0x2f')][_0x36c3('0x33')]));_0x59b6a2[_0x36c3('0x34')]=_0x59b6a2['attributes'][_0x36c3('0x35')]?_0x59b6a2[_0x36c3('0x34')]:_0x260ca4[_0x36c3('0x32')];if(!_0xf85063[_0x36c3('0x2f')]['hasOwnProperty'](_0x36c3('0x36'))){_0x59b6a2[_0x36c3('0x18')]=qs[_0x36c3('0x18')](_0xf85063['query'][_0x36c3('0x18')]);_0x59b6a2[_0x36c3('0x16')]=qs[_0x36c3('0x16')](_0xf85063[_0x36c3('0x2f')]['offset']);}_0x59b6a2[_0x36c3('0x37')]=qs[_0x36c3('0x38')](_0xf85063['query'][_0x36c3('0x38')]);_0x59b6a2[_0x36c3('0x39')]=qs[_0x36c3('0x30')](_[_0x36c3('0x3a')](_0xf85063['query'],_0x260ca4[_0x36c3('0x30')]),_0x325206);if(_0xf85063[_0x36c3('0x2f')][_0x36c3('0x3b')]){_0x59b6a2[_0x36c3('0x39')]=_[_0x36c3('0x3c')](_0x59b6a2[_0x36c3('0x39')],{'$or':_[_0x36c3('0x27')](_0x325206,function(_0x46a0ed){if(_0x46a0ed['type']!==_0x36c3('0x3d')){var _0x135c32={};_0x135c32[_0x46a0ed[_0x36c3('0x25')]]={'$like':'%'+_0xf85063[_0x36c3('0x2f')]['filter']+'%'};return _0x135c32;}})});}_0x59b6a2=_['merge']({},_0x59b6a2,_0xf85063[_0x36c3('0x3e')]);var _0x1baf19={'where':_0x59b6a2[_0x36c3('0x39')]};return db[_0x36c3('0x28')][_0x36c3('0x19')](_0x1baf19)[_0x36c3('0x21')](function(_0x32758e){_0x13e149[_0x36c3('0x19')]=_0x32758e;if(_0xf85063[_0x36c3('0x2f')][_0x36c3('0x3f')]){_0x59b6a2[_0x36c3('0x40')]=[{'all':!![]}];}return db['VoiceRecording'][_0x36c3('0x41')](_0x59b6a2);})['then'](function(_0x4b6eee){_0x13e149[_0x36c3('0x42')]=_0x4b6eee;return _0x13e149;})[_0x36c3('0x21')](respondWithFilteredResult(_0x597690,_0x59b6a2))[_0x36c3('0x43')](handleError(_0x597690,null));};exports[_0x36c3('0x44')]=function(_0x52d51a,_0x1670fc){var _0x3bbf83={'raw':![],'where':{'id':_0x52d51a[_0x36c3('0x45')]['id']}},_0x548556={};_0x548556[_0x36c3('0x32')]=_[_0x36c3('0x46')](db['VoiceRecording']['rawAttributes']);_0x548556['query']=_['keys'](_0x52d51a[_0x36c3('0x2f')]);_0x548556[_0x36c3('0x30')]=_[_0x36c3('0x31')](_0x548556['model'],_0x548556[_0x36c3('0x2f')]);_0x3bbf83[_0x36c3('0x34')]=_[_0x36c3('0x31')](_0x548556[_0x36c3('0x32')],qs[_0x36c3('0x33')](_0x52d51a['query']['fields']));_0x3bbf83['attributes']=_0x3bbf83['attributes'][_0x36c3('0x35')]?_0x3bbf83['attributes']:_0x548556[_0x36c3('0x32')];if(_0x52d51a[_0x36c3('0x2f')]['includeAll']){_0x3bbf83[_0x36c3('0x40')]=[{'all':!![]}];}_0x3bbf83=_[_0x36c3('0x3c')]({},_0x3bbf83,_0x52d51a['options']);return db[_0x36c3('0x28')]['find'](_0x3bbf83)['then'](handleEntityNotFound(_0x1670fc,null))[_0x36c3('0x21')](respondWithResult(_0x1670fc,null))[_0x36c3('0x43')](handleError(_0x1670fc,null));};exports['create']=function(_0x27d412,_0x2e75ec){return db['VoiceRecording'][_0x36c3('0x47')](_0x27d412[_0x36c3('0x48')],{})[_0x36c3('0x21')](respondWithResult(_0x2e75ec,0xc9))[_0x36c3('0x43')](handleError(_0x2e75ec,null));};exports[_0x36c3('0x20')]=function(_0x3d6692,_0x142bcc){if(_0x3d6692[_0x36c3('0x48')]['id']){delete _0x3d6692[_0x36c3('0x48')]['id'];}return db[_0x36c3('0x28')][_0x36c3('0x49')]({'where':{'id':_0x3d6692[_0x36c3('0x45')]['id']}})[_0x36c3('0x21')](handleEntityNotFound(_0x142bcc,null))[_0x36c3('0x21')](saveUpdates(_0x3d6692[_0x36c3('0x48')],null))[_0x36c3('0x21')](respondWithResult(_0x142bcc,null))[_0x36c3('0x43')](handleError(_0x142bcc,null));};exports['describe']=function(_0x2e6b89,_0x23e418){return db[_0x36c3('0x28')]['describe']()['then'](respondWithResult(_0x23e418,null))[_0x36c3('0x43')](handleError(_0x23e418,null));};exports['download']=function(_0x1d8566,_0x22acad,_0x43f79b){var _0x10f76a=require('../../components/encryptor');var _0xea0315=![];var _0x41c7dd={};if(_0x1d8566[_0x36c3('0x2f')]['type']&&_0x1d8566[_0x36c3('0x2f')][_0x36c3('0x2b')]===_0x36c3('0x4a')){_0x41c7dd[_0x36c3('0x4a')]=_0x1d8566[_0x36c3('0x45')]['id'];}else{_0x41c7dd['id']=_0x1d8566[_0x36c3('0x45')]['id'];}return db['VoiceRecording'][_0x36c3('0x49')]({'where':_0x41c7dd,'attributes':['id',_0x36c3('0x4b')],'raw':!![]})[_0x36c3('0x21')](handleEntityNotFound(_0x22acad,null))[_0x36c3('0x21')](function(_0x7fb2ad){if(_0x7fb2ad){var _0x858299=_0x7fb2ad[_0x36c3('0x4b')];var _0x1c23bf=util[_0x36c3('0x2e')](_0x36c3('0x4c'),_0x858299);if(fs[_0x36c3('0x4d')](_0x1c23bf)){_0xea0315=!![];return _0x10f76a['decryptFile'](_0x1c23bf,_0x858299,config['secrets'][_0x36c3('0x4e')])['then'](function(){return _0x7fb2ad;});}return _0x7fb2ad;}})['then'](function(_0x4ecdd3){if(_0x4ecdd3){var _0x3c149b=_0x4ecdd3['value'];if(!fs['existsSync'](_0x3c149b)){throw new db[(_0x36c3('0x4f'))][(_0x36c3('0x50'))](_0x36c3('0x51'));}if(_0x4ecdd3['filename']){return _0x22acad['download'](_0x3c149b,_0x4ecdd3['filename']+path[_0x36c3('0x52')](_0x3c149b),function(){if(_0xea0315){fs[_0x36c3('0x53')](_0x3c149b);}});}else{return _0x22acad['download'](_0x3c149b,function(_0x59fb65){if(_0xea0315){fs['unlink'](_0x3c149b);}});}}})[_0x36c3('0x43')](function(_0x567b3e){if(_0x567b3e['message']===_0x36c3('0x51')){_0x22acad[_0x36c3('0x15')](0x194)[_0x36c3('0x54')](_0x36c3('0x55'));}else{return handleError(_0x22acad,null);}});};exports['downloads']=function(_0x2a05d0,_0x4f5b28,_0x54ddac){var _0x541ae6=require(_0x36c3('0x56'));var _0x434004=![];var _0x2e2f5d={'$and':[db[_0x36c3('0x57')][_0x36c3('0x39')](db[_0x36c3('0x57')]['fn'](_0x36c3('0x58'),db[_0x36c3('0x57')]['col'](_0x36c3('0x4a'))),_0x2a05d0[_0x36c3('0x2f')]['token'])]};if(_0x2a05d0['query'][_0x36c3('0x2b')]&&_0x2a05d0['query'][_0x36c3('0x2b')]==='uniqueid'){_0x2e2f5d[_0x36c3('0x59')][_0x36c3('0x5a')]({'uniqueid':_0x2a05d0[_0x36c3('0x45')]['id']});}else{_0x2e2f5d[_0x36c3('0x59')]['push']({'id':_0x2a05d0[_0x36c3('0x45')]['id']});}return db['VoiceRecording'][_0x36c3('0x49')]({'where':_0x2e2f5d,'attributes':['id',_0x36c3('0x4b')],'raw':!![]})[_0x36c3('0x21')](handleEntityNotFound(_0x4f5b28,null))[_0x36c3('0x21')](function(_0x23423c){if(_0x23423c){var _0x3b1c9c=util[_0x36c3('0x2e')](_0x36c3('0x4c'),_0x23423c['value']);if(fs[_0x36c3('0x4d')](_0x3b1c9c)){_0x434004=!![];return _0x541ae6[_0x36c3('0x5b')](_0x3b1c9c,_0x23423c['value'],config[_0x36c3('0x5c')][_0x36c3('0x4e')])[_0x36c3('0x21')](function(){return _0x23423c;});}return _0x23423c;}})['then'](function(_0x346726){if(_0x346726){if(!fs['existsSync'](_0x346726[_0x36c3('0x4b')])){throw new db[(_0x36c3('0x4f'))][(_0x36c3('0x50'))](_0x36c3('0x51'));}if(_0x346726[_0x36c3('0x5d')]){return _0x4f5b28[_0x36c3('0x5e')](_0x346726[_0x36c3('0x4b')],_0x346726[_0x36c3('0x5d')]+path[_0x36c3('0x52')](_0x346726[_0x36c3('0x4b')]),function(){if(_0x434004){fs['unlink'](_0x346726[_0x36c3('0x4b')]);}});}else{return _0x4f5b28[_0x36c3('0x5e')](_0x346726[_0x36c3('0x4b')],function(_0x2d3fd1){if(_0x434004){fs['unlink'](_0x346726[_0x36c3('0x4b')]);}});}}})[_0x36c3('0x43')](handleError(_0x4f5b28,null));};exports[_0x36c3('0x5f')]=function(_0x42de69,_0x1958d7){return db[_0x36c3('0x28')][_0x36c3('0x49')]({'where':{'id':_0x42de69[_0x36c3('0x45')]['id']}})[_0x36c3('0x21')](function(_0x3ebe17){if(_[_0x36c3('0x60')](_0x3ebe17)){throw new ReferenceError(_0x36c3('0x61'));}return _0x3ebe17;})['then'](function(_0x4f577e){var _0x19dc6f=_0x4f577e[_0x36c3('0x4b')];logger[_0x36c3('0x62')](_0x36c3('0x63'),_0x19dc6f);if(!_[_0x36c3('0x60')](_0x4f577e[_0x36c3('0x4b')])&&fs[_0x36c3('0x4d')](_0x19dc6f)){logger[_0x36c3('0x62')](_0x36c3('0x64')+_0x19dc6f+_0x36c3('0x65'));fs[_0x36c3('0x66')](_0x19dc6f);}_0x19dc6f=_0x19dc6f+_0x36c3('0x67');if(!_[_0x36c3('0x60')](_0x4f577e[_0x36c3('0x4b')])&&fs[_0x36c3('0x4d')](_0x19dc6f)){logger['info'](_0x36c3('0x64')+_0x19dc6f+_0x36c3('0x65'));fs[_0x36c3('0x66')](_0x19dc6f);}return _0x4f577e;})[_0x36c3('0x21')](function(_0x11d210){if(!_0x11d210)throw new InternalError();return _0x11d210[_0x36c3('0x5f')]();})[_0x36c3('0x21')](function(){_0x1958d7[_0x36c3('0x15')](0xcc)[_0x36c3('0x14')]();})[_0x36c3('0x43')](handleError(_0x1958d7,null));};function getBucketslist(_0xcda6b6,_0x1f3273,_0x2ddc3d){return new Promise(function(_0x43d1fe,_0x40f58c){var _0x3972bf=new AWS['S3']({'accessKeyId':_0x1f3273,'secretAccessKey':_0xcda6b6,'region':_0x2ddc3d});_0x3972bf[_0x36c3('0x68')]({},function(_0xeede0f,_0x7a4b51){if(_0xeede0f){return _0x40f58c(_0xeede0f);}else{return _0x43d1fe(_0x7a4b51);}});});}function createBucket(_0x19eef3,_0xa7f533,_0x7cda6b,_0x43b5b7){return new Promise(function(_0x379463,_0x3091b6){var _0x593365=new AWS['S3']({'accessKeyId':_0xa7f533,'secretAccessKey':_0x19eef3,'region':_0x7cda6b});_0x593365['createBucket']({'Bucket':_0x43b5b7},function(_0x83681d,_0xa1faa7){if(_0x83681d){return _0x3091b6(_0x83681d);}else{return _0x379463(_0xa1faa7);}});});}function uploadFile(_0x5e06dd,_0x29d935,_0x295889,_0x2cebd1,_0x1d0be1,_0x29c3be){return new Promise(function(_0x19e0ca,_0x296502){var _0x258628=new AWS['S3']({'accessKeyId':_0x29d935,'secretAccessKey':_0x5e06dd,'region':_0x295889});_0x258628[_0x36c3('0x69')]({'Bucket':_0x2cebd1,'Key':_0x1d0be1,'Body':_0x29c3be},function(_0x591299,_0x381216){if(_0x591299){return _0x296502(_0x591299);}else{return _0x19e0ca(_0x381216);}});});}function startTranscribe(_0x46c361,_0x3598e8,_0x831736,_0x4ef263,_0x4279ad,_0x5d23a4){return new Promise(function(_0x5d82da,_0x334bd0){var _0x1c610a=new AWS[(_0x36c3('0x6a'))]({'accessKeyId':_0x3598e8,'secretAccessKey':_0x46c361,'region':_0x831736});_0x1c610a[_0x36c3('0x6b')]({'TranscriptionJobName':_0x4ef263,'LanguageCode':_0x4279ad,'Media':{'MediaFileUri':_0x5d23a4}},function(_0x3dc05a,_0x53c3f7){if(_0x3dc05a){return _0x334bd0(_0x3dc05a);}else{return _0x5d82da(_0x53c3f7);}});});}function transcribe(_0x3028f6,_0x17a9fd,_0x6d86c3,_0x756d1,_0x148910,_0x105603,_0x1f910a){return new Promise(function(_0x592337,_0x3914a4){var _0x3ec940={};logger['info'](util[_0x36c3('0x2e')](_0x36c3('0x6c'),_0x3028f6,_0x148910));return uploadFile(_0x17a9fd,_0x6d86c3,_0x756d1,_0x148910,path[_0x36c3('0x6d')](_0x105603),fs[_0x36c3('0x6e')](_0x105603))[_0x36c3('0x21')](function(_0x5b5223){logger[_0x36c3('0x62')](util[_0x36c3('0x2e')](_0x36c3('0x6f'),_0x3028f6,_0x148910,_0x5b5223['Location']));_0x3ec940[_0x36c3('0x70')]=_0x5b5223['Bucket'];_0x3ec940['location']=_0x5b5223[_0x36c3('0x71')];logger[_0x36c3('0x62')](util['format']('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x3028f6));return startTranscribe(_0x17a9fd,_0x6d86c3,_0x756d1,uuidv4(),_0x1f910a,_0x5b5223['Location']);})[_0x36c3('0x21')](function(_0xe6d416){logger[_0x36c3('0x62')](util[_0x36c3('0x2e')](_0x36c3('0x72'),_0x3028f6,_0xe6d416[_0x36c3('0x73')][_0x36c3('0x74')]));_0x3ec940['transcribeName']=_0xe6d416[_0x36c3('0x73')][_0x36c3('0x74')];_0x3ec940['transcribeStatus']=_0xe6d416[_0x36c3('0x73')]['TranscriptionJobStatus'];return _0x592337(_0x3ec940);})['catch'](function(_0x232a49){return _0x3914a4(_0x232a49);});});}exports[_0x36c3('0x75')]=function(_0x44dfc0,_0x36df38,_0xcafd95){var _0x4e77e6;var _0x18b1f6;var _0x2ec33a;var _0x5c172c=require(_0x36c3('0x56'));return db['VoiceRecording'][_0x36c3('0x76')]({'where':{'id':_0x44dfc0['params']['id']}})[_0x36c3('0x21')](function(_0x5ce834){if(_0x5ce834){var _0x41a40f=util['format'](_0x36c3('0x4c'),_0x5ce834[_0x36c3('0x4b')]);if(fs[_0x36c3('0x4d')](_0x41a40f)){cypher=!![];return _0x5c172c[_0x36c3('0x5b')](_0x41a40f,_0x5ce834[_0x36c3('0x4b')],config['secrets']['recording'])[_0x36c3('0x21')](function(){return _0x5ce834;});}return _0x5ce834;}})['then'](function(_0x1748f4){if(!_0x1748f4){throw new db[(_0x36c3('0x4f'))][(_0x36c3('0x50'))]('Voice\x20Recording\x20not\x20found');}_0x18b1f6=_0x1748f4;return db[_0x36c3('0x77')][_0x36c3('0x76')]({'where':{'id':0x1}});})[_0x36c3('0x21')](handleEntityNotFound(_0x36df38,null))['then'](function(_0x2f1fe0){if(_0x2f1fe0){_0x4e77e6=_0x2f1fe0;if(!_0x4e77e6[_0x36c3('0x78')]||!_0x4e77e6[_0x36c3('0x79')]||!_0x4e77e6[_0x36c3('0x7a')]||!_0x4e77e6[_0x36c3('0x7b')]||!_0x4e77e6['bucket']){throw new db['Sequelize'][(_0x36c3('0x50'))](_0x36c3('0x7c'));}if(_0x44dfc0['body'][_0x36c3('0x7d')]&&(!_0x4e77e6[_0x36c3('0x7e')]||!_0x4e77e6[_0x36c3('0x7f')]||!_0x4e77e6[_0x36c3('0x80')]||!_0x4e77e6[_0x36c3('0x7b')]||!_0x4e77e6['bucket'])){throw new db[(_0x36c3('0x4f'))][(_0x36c3('0x50'))](_0x36c3('0x81'));}return db[_0x36c3('0x82')][_0x36c3('0x76')]({'where':{'id':_0x4e77e6[_0x36c3('0x79')]}});}})['then'](function(_0x5167dd){if(!_0x5167dd){throw new db[(_0x36c3('0x4f'))][(_0x36c3('0x50'))](_0x36c3('0x83'));}if(!_0x5167dd[_0x36c3('0x84')]||!_0x5167dd['data2']){throw new db[(_0x36c3('0x4f'))][(_0x36c3('0x50'))](_0x36c3('0x85'));}_0x2ec33a=_0x5167dd;return getBucketslist(_0x2ec33a[_0x36c3('0x84')],_0x2ec33a[_0x36c3('0x86')],_0x4e77e6[_0x36c3('0x7a')]);})[_0x36c3('0x21')](function(_0x34e4d0){if(_0x34e4d0&&_0x34e4d0['Buckets']){var _0x244450=_[_0x36c3('0x49')](_0x34e4d0['Buckets'],function(_0x41beaf){return _0x41beaf[_0x36c3('0x87')]===_0x4e77e6['bucket'];});if(!_0x244450){logger[_0x36c3('0x62')](util[_0x36c3('0x2e')](_0x36c3('0x88'),_0x44dfc0[_0x36c3('0x45')]['id'],_0x4e77e6[_0x36c3('0x70')]));return createBucket(_0x2ec33a['data1'],_0x2ec33a[_0x36c3('0x86')],_0x4e77e6[_0x36c3('0x7a')],_0x4e77e6[_0x36c3('0x70')]);}logger[_0x36c3('0x62')](util[_0x36c3('0x2e')](_0x36c3('0x89'),_0x44dfc0['params']['id'],_0x4e77e6[_0x36c3('0x70')]));return;}})[_0x36c3('0x21')](function(_0x319ded){if(_0x18b1f6[_0x36c3('0x8a')]===_0x36c3('0x8b')){return transcribe(_0x44dfc0[_0x36c3('0x45')]['id'],_0x2ec33a[_0x36c3('0x84')],_0x2ec33a[_0x36c3('0x86')],_0x4e77e6[_0x36c3('0x7a')],_0x4e77e6['bucket'],_0x18b1f6[_0x36c3('0x4b')],_0x4e77e6['language']);}else{logger[_0x36c3('0x62')](util['format'](_0x36c3('0x8c'),_0x44dfc0['params']['id']));return{'transcribeStatus':_0x36c3('0x8d')};}})[_0x36c3('0x21')](function(_0x39cd95){if(_0x39cd95){_0x39cd95['tempSentiment']=_0x44dfc0[_0x36c3('0x48')]['runSentiment'];return _0x18b1f6[_0x36c3('0x8e')](_0x39cd95);}})[_0x36c3('0x21')](respondWithResult(_0x36df38,null))[_0x36c3('0x43')](handleError(_0x36df38,null));};function writeFile(_0x13ff47,_0x58edff){return new Promise(function(_0x58adc8,_0x2874cb){fs[_0x36c3('0x8f')](_0x58edff,_0x13ff47,function(_0x8f646e,_0x2f970c){if(_0x8f646e){return _0x2874cb(_0x8f646e);}else{return _0x58adc8(_0x2f970c);}});});}exports[_0x36c3('0x90')]=function(_0x140f6b,_0x5aa904,_0x40802f){return db[_0x36c3('0x28')][_0x36c3('0x76')]({'where':{'id':_0x140f6b[_0x36c3('0x45')]['id']}})[_0x36c3('0x21')](handleEntityNotFound(_0x5aa904))[_0x36c3('0x21')](function(_0x27c149){if(_0x27c149&&_0x27c149[_0x36c3('0x91')]){var _0x38d758=_0x27c149['fileText'];var _0x44201c=config[_0x36c3('0x92')]+_0x36c3('0x93')+_0x27c149['id']+_0x36c3('0x94');if(fs[_0x36c3('0x4d')](_0x44201c)){return _0x44201c;}return writeFile(_0x38d758,_0x44201c)[_0x36c3('0x21')](function(){return _0x44201c;});}else{throw new db[(_0x36c3('0x4f'))]['ValidationError'](_0x36c3('0x95'));}})[_0x36c3('0x21')](function(_0x22e67f){return _0x5aa904[_0x36c3('0x5e')](_0x22e67f);})[_0x36c3('0x43')](handleError(_0x5aa904));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index dae356d..0c102a6 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 _0x8926=['./voiceRecording.attributes','exports','define','voice_recordings','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x152688,_0x51dfd5){var _0x4544af=function(_0x2f03f8){while(--_0x2f03f8){_0x152688['push'](_0x152688['shift']());}};_0x4544af(++_0x51dfd5);}(_0x8926,0x10f));var _0x6892=function(_0x224fb1,_0x20901f){_0x224fb1=_0x224fb1-0x0;var _0x43ea49=_0x8926[_0x224fb1];return _0x43ea49;};'use strict';var _=require(_0x6892('0x0'));var util=require('util');var logger=require(_0x6892('0x1'))(_0x6892('0x2'));var moment=require(_0x6892('0x3'));var BPromise=require(_0x6892('0x4'));var rp=require(_0x6892('0x5'));var fs=require('fs');var path=require(_0x6892('0x6'));var rimraf=require(_0x6892('0x7'));var config=require(_0x6892('0x8'));var attributes=require(_0x6892('0x9'));module[_0x6892('0xa')]=function(_0xc11143,_0x4189d0){return _0xc11143[_0x6892('0xb')]('VoiceRecording',attributes,{'tableName':_0x6892('0xc'),'paranoid':![],'indexes':[{'name':_0x6892('0xd'),'fields':[_0x6892('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1534=['moment','bluebird','path','rimraf','./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings','uniqueid','lodash','util','../../config/logger'];(function(_0x211e15,_0x395d76){var _0x563752=function(_0x2dd7b5){while(--_0x2dd7b5){_0x211e15['push'](_0x211e15['shift']());}};_0x563752(++_0x395d76);}(_0x1534,0xda));var _0x4153=function(_0x499c0d,_0x3a36b7){_0x499c0d=_0x499c0d-0x0;var _0x19dfb4=_0x1534[_0x499c0d];return _0x19dfb4;};'use strict';var _=require(_0x4153('0x0'));var util=require(_0x4153('0x1'));var logger=require(_0x4153('0x2'))('api');var moment=require(_0x4153('0x3'));var BPromise=require(_0x4153('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4153('0x5'));var rimraf=require(_0x4153('0x6'));var config=require('../../config/environment');var attributes=require(_0x4153('0x7'));module[_0x4153('0x8')]=function(_0x2b7e54,_0x85a1cc){return _0x2b7e54[_0x4153('0x9')](_0x4153('0xa'),attributes,{'tableName':_0x4153('0xb'),'paranoid':![],'indexes':[{'name':_0x4153('0xc'),'fields':[_0x4153('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index edfaa48..e7ff59c 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 _0xdf55=['create','value','format','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','error','code','VoiceRecording,\x20%s,\x20%s','message','info','result','catch','UpdateVoiceRecording','update','options','raw','attributes','limit','debug','stringify','CreateVoiceRecording','findOne','callRecordingEncryption'];(function(_0x203f97,_0x58d393){var _0x1b2ab2=function(_0x5ee91b){while(--_0x5ee91b){_0x203f97['push'](_0x203f97['shift']());}};_0x1b2ab2(++_0x58d393);}(_0xdf55,0x83));var _0x5df5=function(_0x3ab687,_0x2f3a18){_0x3ab687=_0x3ab687-0x0;var _0x512596=_0xdf55[_0x3ab687];return _0x512596;};'use strict';var _=require(_0x5df5('0x0'));var util=require(_0x5df5('0x1'));var moment=require('moment');var BPromise=require(_0x5df5('0x2'));var rs=require(_0x5df5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5df5('0x4'))['db'];var utils=require(_0x5df5('0x5'));var logger=require(_0x5df5('0x6'))('rpc');var config=require(_0x5df5('0x7'));var jayson=require(_0x5df5('0x8'));var client=jayson[_0x5df5('0x9')][_0x5df5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9b8756,_0x2b7ed9,_0x4722a2){return new BPromise(function(_0x3743f3,_0x4d43a3){return client[_0x5df5('0xb')](_0x9b8756,_0x4722a2)[_0x5df5('0xc')](function(_0x41941e){logger['info']('VoiceRecording,\x20%s,\x20%s',_0x2b7ed9,_0x5df5('0xd'));logger['debug'](_0x5df5('0xe'),_0x2b7ed9,_0x5df5('0xd'),JSON['stringify'](_0x41941e));if(_0x41941e['error']){if(_0x41941e[_0x5df5('0xf')][_0x5df5('0x10')]===0x1f4){logger[_0x5df5('0xf')](_0x5df5('0x11'),_0x2b7ed9,_0x41941e[_0x5df5('0xf')][_0x5df5('0x12')]);return _0x4d43a3(_0x41941e[_0x5df5('0xf')][_0x5df5('0x12')]);}logger[_0x5df5('0xf')](_0x5df5('0x11'),_0x2b7ed9,_0x41941e['error'][_0x5df5('0x12')]);return _0x3743f3(_0x41941e['error'][_0x5df5('0x12')]);}else{logger[_0x5df5('0x13')](_0x5df5('0x11'),_0x2b7ed9,_0x5df5('0xd'));_0x3743f3(_0x41941e[_0x5df5('0x14')]['message']);}})[_0x5df5('0x15')](function(_0x457205){logger['error'](_0x5df5('0x11'),_0x2b7ed9,_0x457205);_0x4d43a3(_0x457205);});});}exports[_0x5df5('0x16')]=function(_0xb7e1c2){var _0x44f700=this;return new Promise(function(_0x215d59,_0x4b499d){return db['VoiceRecording'][_0x5df5('0x17')](_0xb7e1c2['body'],{'raw':_0xb7e1c2[_0x5df5('0x18')]?_0xb7e1c2[_0x5df5('0x18')][_0x5df5('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb7e1c2[_0x5df5('0x18')]?_0xb7e1c2[_0x5df5('0x18')]['where']||null:null,'attributes':_0xb7e1c2[_0x5df5('0x18')]?_0xb7e1c2[_0x5df5('0x18')][_0x5df5('0x1a')]||null:null,'limit':_0xb7e1c2[_0x5df5('0x18')]?_0xb7e1c2[_0x5df5('0x18')][_0x5df5('0x1b')]||null:null})['then'](function(_0x2e99a1){logger[_0x5df5('0x13')](_0x5df5('0x16'),_0xb7e1c2);logger[_0x5df5('0x1c')]('UpdateVoiceRecording',_0xb7e1c2,JSON[_0x5df5('0x1d')](_0x2e99a1));_0x215d59(_0x2e99a1);})[_0x5df5('0x15')](function(_0x395f3e){logger['error']('UpdateVoiceRecording',_0x395f3e['message'],_0xb7e1c2);_0x4b499d(_0x44f700[_0x5df5('0xf')](0x1f4,_0x395f3e[_0x5df5('0x12')]));});});};exports[_0x5df5('0x1e')]=function(_0xa7f4b3){var _0x1baf52=this;return new Promise(function(_0x1fd83c,_0x210d20){var _0x28723e=require('../../components/encryptor');var _0x18bb61;return db['Setting'][_0x5df5('0x1f')]({'attributes':['id',_0x5df5('0x20')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x3854d0){_0x18bb61=_0x3854d0;return db['VoiceRecording'][_0x5df5('0x21')](_0xa7f4b3['body']);})[_0x5df5('0xc')](function(_0x4afe36){if(_0x18bb61[_0x5df5('0x20')]&&fs['existsSync'](_0x4afe36[_0x5df5('0x22')])){var _0x47bebb=util[_0x5df5('0x23')]('%s.cypher',_0x4afe36[_0x5df5('0x22')]);return _0x28723e[_0x5df5('0x24')](_0x4afe36[_0x5df5('0x22')],_0x47bebb,config[_0x5df5('0x25')][_0x5df5('0x26')])[_0x5df5('0xc')](function(){fs[_0x5df5('0x27')](_0x4afe36['value']);logger['info'](_0x5df5('0x28'));return _0x4afe36;});}return _0x4afe36;})[_0x5df5('0xc')](function(_0x3bbd2b){logger[_0x5df5('0x13')](_0x5df5('0x1e'),_0xa7f4b3);logger[_0x5df5('0x1c')]('CreateVoiceRecording',_0xa7f4b3,JSON[_0x5df5('0x1d')](_0x3bbd2b));_0x1fd83c(_0x3bbd2b);})[_0x5df5('0x15')](function(_0x2f1001){logger[_0x5df5('0xf')]('CreateVoiceRecording',_0x2f1001[_0x5df5('0x12')],_0xa7f4b3);_0x210d20(_0x1baf52['error'](0x1f4,_0x2f1001[_0x5df5('0x12')]));});});}; \ No newline at end of file +var _0x8e3f=['where','attributes','limit','stringify','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','value','format','%s.cypher','encryptFile','recording','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','error','code','message','catch','UpdateVoiceRecording','VoiceRecording','body','options','raw'];(function(_0x45853d,_0x2317a1){var _0x8bbe39=function(_0x40a612){while(--_0x40a612){_0x45853d['push'](_0x45853d['shift']());}};_0x8bbe39(++_0x2317a1);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x8e3f[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0xf8e3('0x0'));var util=require(_0xf8e3('0x1'));var moment=require(_0xf8e3('0x2'));var BPromise=require('bluebird');var rs=require(_0xf8e3('0x3'));var fs=require('fs');var Redis=require(_0xf8e3('0x4'));var db=require(_0xf8e3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf8e3('0x6'))(_0xf8e3('0x7'));var config=require('../../config/environment');var jayson=require(_0xf8e3('0x8'));var client=jayson[_0xf8e3('0x9')][_0xf8e3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ee9f3,_0x4e9e57,_0x4504dd){return new BPromise(function(_0x2e39b7,_0x17f56c){return client[_0xf8e3('0xb')](_0x1ee9f3,_0x4504dd)[_0xf8e3('0xc')](function(_0x4055e2){logger[_0xf8e3('0xd')](_0xf8e3('0xe'),_0x4e9e57,_0xf8e3('0xf'));logger[_0xf8e3('0x10')](_0xf8e3('0x11'),_0x4e9e57,_0xf8e3('0xf'),JSON['stringify'](_0x4055e2));if(_0x4055e2[_0xf8e3('0x12')]){if(_0x4055e2[_0xf8e3('0x12')][_0xf8e3('0x13')]===0x1f4){logger['error'](_0xf8e3('0xe'),_0x4e9e57,_0x4055e2[_0xf8e3('0x12')][_0xf8e3('0x14')]);return _0x17f56c(_0x4055e2[_0xf8e3('0x12')]['message']);}logger[_0xf8e3('0x12')](_0xf8e3('0xe'),_0x4e9e57,_0x4055e2[_0xf8e3('0x12')]['message']);return _0x2e39b7(_0x4055e2[_0xf8e3('0x12')]['message']);}else{logger[_0xf8e3('0xd')](_0xf8e3('0xe'),_0x4e9e57,_0xf8e3('0xf'));_0x2e39b7(_0x4055e2['result']['message']);}})[_0xf8e3('0x15')](function(_0x385dde){logger[_0xf8e3('0x12')](_0xf8e3('0xe'),_0x4e9e57,_0x385dde);_0x17f56c(_0x385dde);});});}exports[_0xf8e3('0x16')]=function(_0x11d4cc){var _0x7a81c3=this;return new Promise(function(_0x2e27e3,_0x1337ae){return db[_0xf8e3('0x17')]['update'](_0x11d4cc[_0xf8e3('0x18')],{'raw':_0x11d4cc[_0xf8e3('0x19')]?_0x11d4cc[_0xf8e3('0x19')][_0xf8e3('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11d4cc[_0xf8e3('0x19')]?_0x11d4cc[_0xf8e3('0x19')][_0xf8e3('0x1b')]||null:null,'attributes':_0x11d4cc[_0xf8e3('0x19')]?_0x11d4cc['options'][_0xf8e3('0x1c')]||null:null,'limit':_0x11d4cc[_0xf8e3('0x19')]?_0x11d4cc[_0xf8e3('0x19')][_0xf8e3('0x1d')]||null:null})['then'](function(_0x39df34){logger['info'](_0xf8e3('0x16'),_0x11d4cc);logger[_0xf8e3('0x10')](_0xf8e3('0x16'),_0x11d4cc,JSON[_0xf8e3('0x1e')](_0x39df34));_0x2e27e3(_0x39df34);})[_0xf8e3('0x15')](function(_0x3ac384){logger['error'](_0xf8e3('0x16'),_0x3ac384[_0xf8e3('0x14')],_0x11d4cc);_0x1337ae(_0x7a81c3[_0xf8e3('0x12')](0x1f4,_0x3ac384[_0xf8e3('0x14')]));});});};exports[_0xf8e3('0x1f')]=function(_0x3b41a1){var _0x2963ed=this;return new Promise(function(_0x157a2d,_0x56fa8e){var _0x356e0a=require(_0xf8e3('0x20'));var _0x12ebd2;return db[_0xf8e3('0x21')][_0xf8e3('0x22')]({'attributes':['id',_0xf8e3('0x23')],'where':{'id':0x1},'raw':!![]})[_0xf8e3('0xc')](function(_0xfaf15d){_0x12ebd2=_0xfaf15d;return db['VoiceRecording'][_0xf8e3('0x24')](_0x3b41a1[_0xf8e3('0x18')]);})[_0xf8e3('0xc')](function(_0x28b2f2){if(_0x12ebd2['callRecordingEncryption']&&fs[_0xf8e3('0x25')](_0x28b2f2[_0xf8e3('0x26')])){var _0x40f64d=util[_0xf8e3('0x27')](_0xf8e3('0x28'),_0x28b2f2[_0xf8e3('0x26')]);return _0x356e0a[_0xf8e3('0x29')](_0x28b2f2[_0xf8e3('0x26')],_0x40f64d,config['secrets'][_0xf8e3('0x2a')])[_0xf8e3('0xc')](function(){fs['unlink'](_0x28b2f2['value']);logger['info'](_0xf8e3('0x2b'));return _0x28b2f2;});}return _0x28b2f2;})['then'](function(_0x2559ea){logger[_0xf8e3('0xd')](_0xf8e3('0x1f'),_0x3b41a1);logger[_0xf8e3('0x10')]('CreateVoiceRecording',_0x3b41a1,JSON['stringify'](_0x2559ea));_0x157a2d(_0x2559ea);})[_0xf8e3('0x15')](function(_0x2f87d8){logger[_0xf8e3('0x12')](_0xf8e3('0x1f'),_0x2f87d8[_0xf8e3('0x14')],_0x3b41a1);_0x56fa8e(_0x2963ed[_0xf8e3('0x12')](0x1f4,_0x2f87d8['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 275e76c..11ae264 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 _0x4559=['index','describe','show','post','create','put','/:id','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated'];(function(_0x206416,_0x4633a6){var _0x282baf=function(_0x4ae0d2){while(--_0x4ae0d2){_0x206416['push'](_0x206416['shift']());}};_0x282baf(++_0x4633a6);}(_0x4559,0x1d5));var _0x9455=function(_0x2709bb,_0x41eede){_0x2709bb=_0x2709bb-0x0;var _0x5a5bbd=_0x4559[_0x2709bb];return _0x5a5bbd;};'use strict';var multer=require(_0x9455('0x0'));var util=require('util');var path=require(_0x9455('0x1'));var timeout=require(_0x9455('0x2'));var express=require(_0x9455('0x3'));var router=express[_0x9455('0x4')]();var fs_extra=require(_0x9455('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9455('0x6'));var config=require(_0x9455('0x7'));var controller=require(_0x9455('0x8'));router[_0x9455('0x9')]('/',auth[_0x9455('0xa')](),controller[_0x9455('0xb')]);router['get']('/describe',auth[_0x9455('0xa')](),controller[_0x9455('0xc')]);router[_0x9455('0x9')]('/:id',auth[_0x9455('0xa')](),controller[_0x9455('0xd')]);router[_0x9455('0xe')]('/',auth[_0x9455('0xa')](),controller[_0x9455('0xf')]);router[_0x9455('0x10')](_0x9455('0x11'),auth[_0x9455('0xa')](),controller['update']);router['delete'](_0x9455('0x11'),auth[_0x9455('0xa')](),controller[_0x9455('0x12')]);module[_0x9455('0x13')]=router; \ No newline at end of file +var _0xf3a9=['delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update'];(function(_0x12c206,_0xfceab7){var _0x21bb14=function(_0x25b18f){while(--_0x25b18f){_0x12c206['push'](_0x12c206['shift']());}};_0x21bb14(++_0xfceab7);}(_0xf3a9,0x71));var _0x9f3a=function(_0x2d0850,_0x2a649a){_0x2d0850=_0x2d0850-0x0;var _0x3081e5=_0xf3a9[_0x2d0850];return _0x3081e5;};'use strict';var multer=require(_0x9f3a('0x0'));var util=require('util');var path=require(_0x9f3a('0x1'));var timeout=require(_0x9f3a('0x2'));var express=require('express');var router=express[_0x9f3a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9f3a('0x4'));var interaction=require(_0x9f3a('0x5'));var config=require(_0x9f3a('0x6'));var controller=require(_0x9f3a('0x7'));router[_0x9f3a('0x8')]('/',auth[_0x9f3a('0x9')](),controller[_0x9f3a('0xa')]);router[_0x9f3a('0x8')](_0x9f3a('0xb'),auth[_0x9f3a('0x9')](),controller[_0x9f3a('0xc')]);router['get'](_0x9f3a('0xd'),auth[_0x9f3a('0x9')](),controller[_0x9f3a('0xe')]);router[_0x9f3a('0xf')]('/',auth[_0x9f3a('0x9')](),controller[_0x9f3a('0x10')]);router[_0x9f3a('0x11')]('/:id',auth[_0x9f3a('0x9')](),controller[_0x9f3a('0x12')]);router[_0x9f3a('0x13')]('/:id',auth[_0x9f3a('0x9')](),controller[_0x9f3a('0x14')]);module[_0x9f3a('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 22f2076..30db52c 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 _0x2e63=['sequelize','moment','exports','blind','attended','STRING','ENUM'];(function(_0x52a3dc,_0x1c2f40){var _0x140079=function(_0x154649){while(--_0x154649){_0x52a3dc['push'](_0x52a3dc['shift']());}};_0x140079(++_0x1c2f40);}(_0x2e63,0x11f));var _0x32e6=function(_0x1d537c,_0x2b834d){_0x1d537c=_0x1d537c-0x0;var _0x184fb9=_0x2e63[_0x1d537c];return _0x184fb9;};'use strict';var Sequelize=require(_0x32e6('0x0'));var moment=require(_0x32e6('0x1'));module[_0x32e6('0x2')]={'type':{'type':Sequelize['ENUM'](_0x32e6('0x3'),_0x32e6('0x4'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x32e6('0x5')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x32e6('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x32e6('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x32e6('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x32e6('0x5')]},'transferercontext':{'type':Sequelize[_0x32e6('0x5')]},'transfererexten':{'type':Sequelize[_0x32e6('0x5')]},'transfererlinkedid':{'type':Sequelize[_0x32e6('0x5')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0x32e6('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x32e6('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0x32e6('0x5')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x32e6('0x5')]},'transfereeexten':{'type':Sequelize[_0x32e6('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x32e6('0x5')]},'isexternal':{'type':Sequelize[_0x32e6('0x6')]('Yes','No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x32e6('0x5')]}}; \ No newline at end of file +var _0xf4cf=['Yes','sequelize','moment','exports','ENUM','blind','attended','STRING'];(function(_0xe43d15,_0x2d0b69){var _0x2172af=function(_0x271128){while(--_0x271128){_0xe43d15['push'](_0xe43d15['shift']());}};_0x2172af(++_0x2d0b69);}(_0xf4cf,0xf1));var _0xff4c=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xf4cf[_0x422905];return _0x33dc6c;};'use strict';var Sequelize=require(_0xff4c('0x0'));var moment=require(_0xff4c('0x1'));module[_0xff4c('0x2')]={'type':{'type':Sequelize[_0xff4c('0x3')](_0xff4c('0x4'),_0xff4c('0x5'))},'result':{'type':Sequelize[_0xff4c('0x6')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0xff4c('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0xff4c('0x6')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0xff4c('0x6')]},'transfererexten':{'type':Sequelize[_0xff4c('0x6')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0xff4c('0x6')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0xff4c('0x6')]},'transfereeconnectedlinename':{'type':Sequelize[_0xff4c('0x6')]},'transfereeaccountcode':{'type':Sequelize[_0xff4c('0x6')]},'transfereecontext':{'type':Sequelize[_0xff4c('0x6')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0xff4c('0x6')]},'isexternal':{'type':Sequelize[_0xff4c('0x3')](_0xff4c('0x7'),'No')},'context':{'type':Sequelize[_0xff4c('0x6')]},'extension':{'type':Sequelize[_0xff4c('0x6')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 4328ae3..5aa3a9a 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 _0xd6f8=['type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','rawAttributes','length','merge','find','update','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','apply','reject','save','then','error','name','send','index','map','VoiceTransferReport','fieldName'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd6f8,0x1ee));var _0x8d6f=function(_0x2d513f,_0x126f93){_0x2d513f=_0x2d513f-0x0;var _0x2488c3=_0xd6f8[_0x2d513f];return _0x2488c3;};'use strict';var emlformat=require(_0x8d6f('0x0'));var rimraf=require(_0x8d6f('0x1'));var zipdir=require(_0x8d6f('0x2'));var jsonpatch=require(_0x8d6f('0x3'));var rp=require(_0x8d6f('0x4'));var moment=require(_0x8d6f('0x5'));var BPromise=require(_0x8d6f('0x6'));var Mustache=require(_0x8d6f('0x7'));var util=require('util');var path=require(_0x8d6f('0x8'));var sox=require(_0x8d6f('0x9'));var csv=require(_0x8d6f('0xa'));var ejs=require(_0x8d6f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8d6f('0xc'));var squel=require(_0x8d6f('0xd'));var crypto=require(_0x8d6f('0xe'));var jsforce=require(_0x8d6f('0xf'));var deskjs=require(_0x8d6f('0x10'));var toCsv=require(_0x8d6f('0xa'));var querystring=require(_0x8d6f('0x11'));var Papa=require(_0x8d6f('0x12'));var Redis=require(_0x8d6f('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8d6f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8d6f('0x15'))(_0x8d6f('0x16'));var utils=require('../../config/utils');var config=require(_0x8d6f('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8d6f('0x18'))['db'];function respondWithStatusCode(_0x24ea52,_0x218d96){_0x218d96=_0x218d96||0xcc;return function(_0x383682){if(_0x383682){return _0x24ea52[_0x8d6f('0x19')](_0x218d96);}return _0x24ea52[_0x8d6f('0x1a')](_0x218d96)[_0x8d6f('0x1b')]();};}function respondWithResult(_0x1523de,_0x163fb3){_0x163fb3=_0x163fb3||0xc8;return function(_0x1fd333){if(_0x1fd333){return _0x1523de['status'](_0x163fb3)['json'](_0x1fd333);}};}function respondWithFilteredResult(_0x1c1a9c,_0x48b3cb){return function(_0x3ec5e8){if(_0x3ec5e8){var _0xbe9d04=typeof _0x48b3cb[_0x8d6f('0x1c')]==='undefined'&&typeof _0x48b3cb[_0x8d6f('0x1d')]===_0x8d6f('0x1e');var _0x45df92=_0x3ec5e8[_0x8d6f('0x1f')];var _0x2186c6=_0xbe9d04?0x0:_0x48b3cb['offset'];var _0x418d99=_0xbe9d04?_0x3ec5e8[_0x8d6f('0x1f')]:_0x48b3cb[_0x8d6f('0x1c')]+_0x48b3cb[_0x8d6f('0x1d')];var _0x45a5ae;if(_0x418d99>=_0x45df92){_0x418d99=_0x45df92;_0x45a5ae=0xc8;}else{_0x45a5ae=0xce;}_0x1c1a9c[_0x8d6f('0x1a')](_0x45a5ae);return _0x1c1a9c['set'](_0x8d6f('0x20'),_0x2186c6+'-'+_0x418d99+'/'+_0x45df92)[_0x8d6f('0x21')](_0x3ec5e8);}return null;};}function patchUpdates(_0x31647e){return function(_0x494f44){try{jsonpatch[_0x8d6f('0x22')](_0x494f44,_0x31647e,!![]);}catch(_0x17f134){return BPromise[_0x8d6f('0x23')](_0x17f134);}return _0x494f44[_0x8d6f('0x24')]();};}function saveUpdates(_0x1d81fe,_0x5a37dd){return function(_0x587dd3){if(_0x587dd3){return _0x587dd3['update'](_0x1d81fe)[_0x8d6f('0x25')](function(_0x1de1b9){return _0x1de1b9;});}return null;};}function removeEntity(_0x404ff4,_0x549f9e){return function(_0x347371){if(_0x347371){return _0x347371['destroy']()['then'](function(){_0x404ff4[_0x8d6f('0x1a')](0xcc)[_0x8d6f('0x1b')]();});}};}function handleEntityNotFound(_0x59c0a1,_0x2ea60e){return function(_0x3adf28){if(!_0x3adf28){_0x59c0a1['sendStatus'](0x194);}return _0x3adf28;};}function handleError(_0x32fa1e,_0x3f806e){_0x3f806e=_0x3f806e||0x1f4;return function(_0x34f1e8){logger[_0x8d6f('0x26')](_0x34f1e8['stack']);if(_0x34f1e8['name']){delete _0x34f1e8[_0x8d6f('0x27')];}_0x32fa1e[_0x8d6f('0x1a')](_0x3f806e)[_0x8d6f('0x28')](_0x34f1e8);};}exports[_0x8d6f('0x29')]=function(_0x3170ec,_0x1e56e0){var _0x962927={},_0x41d970={},_0x37557a={'count':0x0,'rows':[]};var _0xc846f4=_[_0x8d6f('0x2a')](db[_0x8d6f('0x2b')]['rawAttributes'],function(_0x566fe4){return{'name':_0x566fe4[_0x8d6f('0x2c')],'type':_0x566fe4[_0x8d6f('0x2d')][_0x8d6f('0x2e')]};});_0x41d970[_0x8d6f('0x2f')]=_[_0x8d6f('0x2a')](_0xc846f4,_0x8d6f('0x27'));_0x41d970['query']=_['keys'](_0x3170ec[_0x8d6f('0x30')]);_0x41d970[_0x8d6f('0x31')]=_[_0x8d6f('0x32')](_0x41d970[_0x8d6f('0x2f')],_0x41d970[_0x8d6f('0x30')]);_0x962927[_0x8d6f('0x33')]=_['intersection'](_0x41d970[_0x8d6f('0x2f')],qs[_0x8d6f('0x34')](_0x3170ec[_0x8d6f('0x30')]['fields']));_0x962927[_0x8d6f('0x33')]=_0x962927[_0x8d6f('0x33')]['length']?_0x962927['attributes']:_0x41d970['model'];if(!_0x3170ec[_0x8d6f('0x30')][_0x8d6f('0x35')](_0x8d6f('0x36'))){_0x962927[_0x8d6f('0x1d')]=qs[_0x8d6f('0x1d')](_0x3170ec[_0x8d6f('0x30')]['limit']);_0x962927[_0x8d6f('0x1c')]=qs[_0x8d6f('0x1c')](_0x3170ec[_0x8d6f('0x30')][_0x8d6f('0x1c')]);}_0x962927[_0x8d6f('0x37')]=qs['sort'](_0x3170ec[_0x8d6f('0x30')][_0x8d6f('0x38')]);_0x962927[_0x8d6f('0x39')]=qs[_0x8d6f('0x31')](_[_0x8d6f('0x3a')](_0x3170ec[_0x8d6f('0x30')],_0x41d970[_0x8d6f('0x31')]),_0xc846f4);if(_0x3170ec[_0x8d6f('0x30')][_0x8d6f('0x3b')]){_0x962927[_0x8d6f('0x39')]=_['merge'](_0x962927['where'],{'$or':_[_0x8d6f('0x2a')](_0xc846f4,function(_0x5394f0){if(_0x5394f0[_0x8d6f('0x2d')]!==_0x8d6f('0x3c')){var _0x36a377={};_0x36a377[_0x5394f0[_0x8d6f('0x27')]]={'$like':'%'+_0x3170ec['query'][_0x8d6f('0x3b')]+'%'};return _0x36a377;}})});}_0x962927=_['merge']({},_0x962927,_0x3170ec[_0x8d6f('0x3d')]);var _0x3365cc={'where':_0x962927['where']};return db[_0x8d6f('0x2b')][_0x8d6f('0x1f')](_0x3365cc)[_0x8d6f('0x25')](function(_0x40ce19){_0x37557a[_0x8d6f('0x1f')]=_0x40ce19;if(_0x3170ec['query'][_0x8d6f('0x3e')]){_0x962927[_0x8d6f('0x3f')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0x8d6f('0x40')](_0x962927);})['then'](function(_0x34d7a3){_0x37557a['rows']=_0x34d7a3;return _0x37557a;})[_0x8d6f('0x25')](respondWithFilteredResult(_0x1e56e0,_0x962927))[_0x8d6f('0x41')](handleError(_0x1e56e0,null));};exports[_0x8d6f('0x42')]=function(_0x1731cc,_0xf1301d){var _0x10465b={'raw':!![],'where':{'id':_0x1731cc[_0x8d6f('0x43')]['id']}},_0x212151={};_0x212151[_0x8d6f('0x2f')]=_[_0x8d6f('0x44')](db[_0x8d6f('0x2b')][_0x8d6f('0x45')]);_0x212151['query']=_[_0x8d6f('0x44')](_0x1731cc[_0x8d6f('0x30')]);_0x212151['filters']=_[_0x8d6f('0x32')](_0x212151[_0x8d6f('0x2f')],_0x212151[_0x8d6f('0x30')]);_0x10465b['attributes']=_[_0x8d6f('0x32')](_0x212151[_0x8d6f('0x2f')],qs[_0x8d6f('0x34')](_0x1731cc[_0x8d6f('0x30')][_0x8d6f('0x34')]));_0x10465b[_0x8d6f('0x33')]=_0x10465b['attributes'][_0x8d6f('0x46')]?_0x10465b['attributes']:_0x212151[_0x8d6f('0x2f')];if(_0x1731cc[_0x8d6f('0x30')][_0x8d6f('0x3e')]){_0x10465b['include']=[{'all':!![]}];}_0x10465b=_[_0x8d6f('0x47')]({},_0x10465b,_0x1731cc[_0x8d6f('0x3d')]);return db['VoiceTransferReport'][_0x8d6f('0x48')](_0x10465b)[_0x8d6f('0x25')](handleEntityNotFound(_0xf1301d,null))[_0x8d6f('0x25')](respondWithResult(_0xf1301d,null))['catch'](handleError(_0xf1301d,null));};exports['create']=function(_0x2c2392,_0x1ad682){return db[_0x8d6f('0x2b')]['create'](_0x2c2392['body'],{})[_0x8d6f('0x25')](respondWithResult(_0x1ad682,0xc9))['catch'](handleError(_0x1ad682,null));};exports[_0x8d6f('0x49')]=function(_0x344955,_0x3708ad){if(_0x344955[_0x8d6f('0x4a')]['id']){delete _0x344955[_0x8d6f('0x4a')]['id'];}return db['VoiceTransferReport'][_0x8d6f('0x48')]({'where':{'id':_0x344955[_0x8d6f('0x43')]['id']}})[_0x8d6f('0x25')](handleEntityNotFound(_0x3708ad,null))[_0x8d6f('0x25')](saveUpdates(_0x344955[_0x8d6f('0x4a')],null))[_0x8d6f('0x25')](respondWithResult(_0x3708ad,null))[_0x8d6f('0x41')](handleError(_0x3708ad,null));};exports[_0x8d6f('0x4b')]=function(_0x5a0bd3,_0x5bfe6f){return db[_0x8d6f('0x2b')][_0x8d6f('0x48')]({'where':{'id':_0x5a0bd3[_0x8d6f('0x43')]['id']}})[_0x8d6f('0x25')](handleEntityNotFound(_0x5bfe6f,null))[_0x8d6f('0x25')](removeEntity(_0x5bfe6f,null))['catch'](handleError(_0x5bfe6f,null));};exports['describe']=function(_0x42df0b,_0x413979){return db[_0x8d6f('0x2b')][_0x8d6f('0x4c')]()[_0x8d6f('0x25')](respondWithResult(_0x413979,null))['catch'](handleError(_0x413979,null));}; \ No newline at end of file +var _0x7364=['filter','merge','VIRTUAL','options','includeAll','include','VoiceTransferReport','findAll','rows','catch','show','params','find','create','body','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','error','name','send','index','rawAttributes','fieldName','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7364,0xfb));var _0x4736=function(_0x5427ac,_0x37c4a9){_0x5427ac=_0x5427ac-0x0;var _0x8c30f9=_0x7364[_0x5427ac];return _0x8c30f9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4736('0x0'));var zipdir=require(_0x4736('0x1'));var jsonpatch=require(_0x4736('0x2'));var rp=require(_0x4736('0x3'));var moment=require(_0x4736('0x4'));var BPromise=require(_0x4736('0x5'));var Mustache=require(_0x4736('0x6'));var util=require('util');var path=require('path');var sox=require(_0x4736('0x7'));var csv=require(_0x4736('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4736('0x9'));var _=require(_0x4736('0xa'));var squel=require('squel');var crypto=require(_0x4736('0xb'));var jsforce=require(_0x4736('0xc'));var deskjs=require(_0x4736('0xd'));var toCsv=require('to-csv');var querystring=require(_0x4736('0xe'));var Papa=require(_0x4736('0xf'));var Redis=require(_0x4736('0x10'));var authService=require(_0x4736('0x11'));var qs=require(_0x4736('0x12'));var as=require(_0x4736('0x13'));var hardwareService=require(_0x4736('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x4736('0x15'));var config=require(_0x4736('0x16'));var licenseUtil=require(_0x4736('0x17'));var db=require(_0x4736('0x18'))['db'];function respondWithStatusCode(_0x49ec95,_0x2bd3b2){_0x2bd3b2=_0x2bd3b2||0xcc;return function(_0x10394d){if(_0x10394d){return _0x49ec95[_0x4736('0x19')](_0x2bd3b2);}return _0x49ec95[_0x4736('0x1a')](_0x2bd3b2)[_0x4736('0x1b')]();};}function respondWithResult(_0x5f3771,_0x32c2ad){_0x32c2ad=_0x32c2ad||0xc8;return function(_0x136135){if(_0x136135){return _0x5f3771[_0x4736('0x1a')](_0x32c2ad)['json'](_0x136135);}};}function respondWithFilteredResult(_0x35fab0,_0x353f38){return function(_0x36483a){if(_0x36483a){var _0x3bc984=typeof _0x353f38[_0x4736('0x1c')]===_0x4736('0x1d')&&typeof _0x353f38[_0x4736('0x1e')]==='undefined';var _0x3e50fa=_0x36483a[_0x4736('0x1f')];var _0x3d21c4=_0x3bc984?0x0:_0x353f38[_0x4736('0x1c')];var _0x56b92b=_0x3bc984?_0x36483a[_0x4736('0x1f')]:_0x353f38[_0x4736('0x1c')]+_0x353f38['limit'];var _0x28098e;if(_0x56b92b>=_0x3e50fa){_0x56b92b=_0x3e50fa;_0x28098e=0xc8;}else{_0x28098e=0xce;}_0x35fab0['status'](_0x28098e);return _0x35fab0[_0x4736('0x20')](_0x4736('0x21'),_0x3d21c4+'-'+_0x56b92b+'/'+_0x3e50fa)[_0x4736('0x22')](_0x36483a);}return null;};}function patchUpdates(_0x22bc12){return function(_0xb0cdec){try{jsonpatch[_0x4736('0x23')](_0xb0cdec,_0x22bc12,!![]);}catch(_0x2a9919){return BPromise[_0x4736('0x24')](_0x2a9919);}return _0xb0cdec[_0x4736('0x25')]();};}function saveUpdates(_0x218e07,_0x4359c1){return function(_0x1999e7){if(_0x1999e7){return _0x1999e7['update'](_0x218e07)[_0x4736('0x26')](function(_0x281ae1){return _0x281ae1;});}return null;};}function removeEntity(_0x464566,_0x4d11f1){return function(_0x1fd71b){if(_0x1fd71b){return _0x1fd71b[_0x4736('0x27')]()[_0x4736('0x26')](function(){_0x464566['status'](0xcc)[_0x4736('0x1b')]();});}};}function handleEntityNotFound(_0x523e18,_0x3efcb5){return function(_0x28bea5){if(!_0x28bea5){_0x523e18[_0x4736('0x19')](0x194);}return _0x28bea5;};}function handleError(_0x3b113b,_0x4d207d){_0x4d207d=_0x4d207d||0x1f4;return function(_0x30f7b0){logger[_0x4736('0x28')](_0x30f7b0['stack']);if(_0x30f7b0['name']){delete _0x30f7b0[_0x4736('0x29')];}_0x3b113b[_0x4736('0x1a')](_0x4d207d)[_0x4736('0x2a')](_0x30f7b0);};}exports[_0x4736('0x2b')]=function(_0x5b03ea,_0x30ce3b){var _0xa3e412={},_0x273c84={},_0x4c6c85={'count':0x0,'rows':[]};var _0x548deb=_['map'](db['VoiceTransferReport'][_0x4736('0x2c')],function(_0xf0e5c0){return{'name':_0xf0e5c0[_0x4736('0x2d')],'type':_0xf0e5c0['type']['key']};});_0x273c84[_0x4736('0x2e')]=_[_0x4736('0x2f')](_0x548deb,_0x4736('0x29'));_0x273c84[_0x4736('0x30')]=_[_0x4736('0x31')](_0x5b03ea[_0x4736('0x30')]);_0x273c84['filters']=_[_0x4736('0x32')](_0x273c84[_0x4736('0x2e')],_0x273c84[_0x4736('0x30')]);_0xa3e412[_0x4736('0x33')]=_['intersection'](_0x273c84[_0x4736('0x2e')],qs['fields'](_0x5b03ea[_0x4736('0x30')][_0x4736('0x34')]));_0xa3e412[_0x4736('0x33')]=_0xa3e412[_0x4736('0x33')][_0x4736('0x35')]?_0xa3e412[_0x4736('0x33')]:_0x273c84[_0x4736('0x2e')];if(!_0x5b03ea[_0x4736('0x30')][_0x4736('0x36')](_0x4736('0x37'))){_0xa3e412[_0x4736('0x1e')]=qs[_0x4736('0x1e')](_0x5b03ea[_0x4736('0x30')][_0x4736('0x1e')]);_0xa3e412[_0x4736('0x1c')]=qs['offset'](_0x5b03ea[_0x4736('0x30')][_0x4736('0x1c')]);}_0xa3e412[_0x4736('0x38')]=qs[_0x4736('0x39')](_0x5b03ea['query'][_0x4736('0x39')]);_0xa3e412[_0x4736('0x3a')]=qs[_0x4736('0x3b')](_[_0x4736('0x3c')](_0x5b03ea[_0x4736('0x30')],_0x273c84[_0x4736('0x3b')]),_0x548deb);if(_0x5b03ea[_0x4736('0x30')][_0x4736('0x3d')]){_0xa3e412[_0x4736('0x3a')]=_[_0x4736('0x3e')](_0xa3e412[_0x4736('0x3a')],{'$or':_[_0x4736('0x2f')](_0x548deb,function(_0x1f057c){if(_0x1f057c['type']!==_0x4736('0x3f')){var _0x2aa664={};_0x2aa664[_0x1f057c['name']]={'$like':'%'+_0x5b03ea['query'][_0x4736('0x3d')]+'%'};return _0x2aa664;}})});}_0xa3e412=_['merge']({},_0xa3e412,_0x5b03ea[_0x4736('0x40')]);var _0x9428e1={'where':_0xa3e412[_0x4736('0x3a')]};return db['VoiceTransferReport'][_0x4736('0x1f')](_0x9428e1)[_0x4736('0x26')](function(_0x2aa146){_0x4c6c85['count']=_0x2aa146;if(_0x5b03ea['query'][_0x4736('0x41')]){_0xa3e412[_0x4736('0x42')]=[{'all':!![]}];}return db[_0x4736('0x43')][_0x4736('0x44')](_0xa3e412);})[_0x4736('0x26')](function(_0x4c5af7){_0x4c6c85[_0x4736('0x45')]=_0x4c5af7;return _0x4c6c85;})[_0x4736('0x26')](respondWithFilteredResult(_0x30ce3b,_0xa3e412))[_0x4736('0x46')](handleError(_0x30ce3b,null));};exports[_0x4736('0x47')]=function(_0x1239d7,_0x467da6){var _0x1055eb={'raw':!![],'where':{'id':_0x1239d7[_0x4736('0x48')]['id']}},_0x5b2ffa={};_0x5b2ffa['model']=_[_0x4736('0x31')](db[_0x4736('0x43')][_0x4736('0x2c')]);_0x5b2ffa['query']=_['keys'](_0x1239d7[_0x4736('0x30')]);_0x5b2ffa[_0x4736('0x3b')]=_['intersection'](_0x5b2ffa['model'],_0x5b2ffa[_0x4736('0x30')]);_0x1055eb[_0x4736('0x33')]=_[_0x4736('0x32')](_0x5b2ffa[_0x4736('0x2e')],qs['fields'](_0x1239d7[_0x4736('0x30')]['fields']));_0x1055eb[_0x4736('0x33')]=_0x1055eb[_0x4736('0x33')]['length']?_0x1055eb[_0x4736('0x33')]:_0x5b2ffa[_0x4736('0x2e')];if(_0x1239d7['query']['includeAll']){_0x1055eb[_0x4736('0x42')]=[{'all':!![]}];}_0x1055eb=_[_0x4736('0x3e')]({},_0x1055eb,_0x1239d7[_0x4736('0x40')]);return db['VoiceTransferReport'][_0x4736('0x49')](_0x1055eb)[_0x4736('0x26')](handleEntityNotFound(_0x467da6,null))[_0x4736('0x26')](respondWithResult(_0x467da6,null))[_0x4736('0x46')](handleError(_0x467da6,null));};exports[_0x4736('0x4a')]=function(_0x5c453c,_0x36d7a4){return db[_0x4736('0x43')]['create'](_0x5c453c[_0x4736('0x4b')],{})['then'](respondWithResult(_0x36d7a4,0xc9))[_0x4736('0x46')](handleError(_0x36d7a4,null));};exports[_0x4736('0x4c')]=function(_0x266a18,_0x1f0017){if(_0x266a18['body']['id']){delete _0x266a18[_0x4736('0x4b')]['id'];}return db[_0x4736('0x43')][_0x4736('0x49')]({'where':{'id':_0x266a18[_0x4736('0x48')]['id']}})[_0x4736('0x26')](handleEntityNotFound(_0x1f0017,null))[_0x4736('0x26')](saveUpdates(_0x266a18['body'],null))[_0x4736('0x26')](respondWithResult(_0x1f0017,null))['catch'](handleError(_0x1f0017,null));};exports[_0x4736('0x27')]=function(_0x3f94bc,_0x4afa22){return db[_0x4736('0x43')]['find']({'where':{'id':_0x3f94bc[_0x4736('0x48')]['id']}})['then'](handleEntityNotFound(_0x4afa22,null))['then'](removeEntity(_0x4afa22,null))[_0x4736('0x46')](handleError(_0x4afa22,null));};exports[_0x4736('0x4d')]=function(_0x860529,_0x5820be){return db['VoiceTransferReport'][_0x4736('0x4d')]()[_0x4736('0x26')](respondWithResult(_0x5820be,null))['catch'](handleError(_0x5820be,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 81d2554..cac2f2f 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 _0x076f=['path','./voiceTransferReport.attributes','exports','define','lodash','util','../../config/logger','api','bluebird'];(function(_0x9dcaa2,_0x2970ed){var _0x2971b6=function(_0x569a76){while(--_0x569a76){_0x9dcaa2['push'](_0x9dcaa2['shift']());}};_0x2971b6(++_0x2970ed);}(_0x076f,0x1ea));var _0xf076=function(_0x5e5cf0,_0x2d97a9){_0x5e5cf0=_0x5e5cf0-0x0;var _0x486355=_0x076f[_0x5e5cf0];return _0x486355;};'use strict';var _=require(_0xf076('0x0'));var util=require(_0xf076('0x1'));var logger=require(_0xf076('0x2'))(_0xf076('0x3'));var moment=require('moment');var BPromise=require(_0xf076('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf076('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf076('0x6'));module[_0xf076('0x7')]=function(_0x7be68c,_0x4f91f9){return _0x7be68c[_0xf076('0x8')]('VoiceTransferReport',attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfc3f=['path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','util','../../config/logger','api','bluebird','request-promise'];(function(_0xae05de,_0x518819){var _0xb859db=function(_0x4817ec){while(--_0x4817ec){_0xae05de['push'](_0xae05de['shift']());}};_0xb859db(++_0x518819);}(_0xfc3f,0x127));var _0xffc3=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xfc3f[_0x5447fd];return _0x15b28a;};'use strict';var _=require('lodash');var util=require(_0xffc3('0x0'));var logger=require(_0xffc3('0x1'))(_0xffc3('0x2'));var moment=require('moment');var BPromise=require(_0xffc3('0x3'));var rp=require(_0xffc3('0x4'));var fs=require('fs');var path=require(_0xffc3('0x5'));var rimraf=require(_0xffc3('0x6'));var config=require(_0xffc3('0x7'));var attributes=require(_0xffc3('0x8'));module[_0xffc3('0x9')]=function(_0x4539c2,_0x31882c){return _0x4539c2[_0xffc3('0xa')](_0xffc3('0xb'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index f7e6b80..765a037 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 _0x4301=['CreateVoiceTransferReport','create','body','raw','debug','util','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','VoiceTransferReport,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','result','catch'];(function(_0x5fc121,_0x1b4628){var _0x1aad81=function(_0x148cd3){while(--_0x148cd3){_0x5fc121['push'](_0x5fc121['shift']());}};_0x1aad81(++_0x1b4628);}(_0x4301,0x130));var _0x1430=function(_0x1a79f3,_0x1c72e2){_0x1a79f3=_0x1a79f3-0x0;var _0x4ee510=_0x4301[_0x1a79f3];return _0x4ee510;};'use strict';var _=require('lodash');var util=require(_0x1430('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1430('0x1'));var fs=require('fs');var Redis=require(_0x1430('0x2'));var db=require(_0x1430('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1430('0x4'))('rpc');var config=require(_0x1430('0x5'));var jayson=require(_0x1430('0x6'));var client=jayson[_0x1430('0x7')][_0x1430('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x35f44d,_0x22ac3d,_0x555356){return new BPromise(function(_0x55f362,_0x1b1872){return client['request'](_0x35f44d,_0x555356)[_0x1430('0x9')](function(_0x30102f){logger['info'](_0x1430('0xa'),_0x22ac3d,'request\x20sent');logger['debug']('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x22ac3d,'request\x20sent',JSON[_0x1430('0xb')](_0x30102f));if(_0x30102f[_0x1430('0xc')]){if(_0x30102f[_0x1430('0xc')]['code']===0x1f4){logger[_0x1430('0xc')](_0x1430('0xa'),_0x22ac3d,_0x30102f[_0x1430('0xc')][_0x1430('0xd')]);return _0x1b1872(_0x30102f[_0x1430('0xc')][_0x1430('0xd')]);}logger[_0x1430('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x22ac3d,_0x30102f[_0x1430('0xc')][_0x1430('0xd')]);return _0x55f362(_0x30102f[_0x1430('0xc')][_0x1430('0xd')]);}else{logger[_0x1430('0xe')](_0x1430('0xa'),_0x22ac3d,_0x1430('0xf'));_0x55f362(_0x30102f[_0x1430('0x10')][_0x1430('0xd')]);}})[_0x1430('0x11')](function(_0x2fed27){logger[_0x1430('0xc')](_0x1430('0xa'),_0x22ac3d,_0x2fed27);_0x1b1872(_0x2fed27);});});}exports[_0x1430('0x12')]=function(_0x1e8023){var _0x29ffe3=this;return new Promise(function(_0x4c02e4,_0x2967f0){return db['VoiceTransferReport'][_0x1430('0x13')](_0x1e8023[_0x1430('0x14')],{'raw':_0x1e8023['options']?_0x1e8023['options'][_0x1430('0x15')]===undefined?!![]:![]:!![]})[_0x1430('0x9')](function(_0x1bb592){logger[_0x1430('0xe')](_0x1430('0x12'),_0x1e8023);logger[_0x1430('0x16')](_0x1430('0x12'),_0x1e8023,JSON['stringify'](_0x1bb592));_0x4c02e4(_0x1bb592);})[_0x1430('0x11')](function(_0x536537){logger[_0x1430('0xc')](_0x1430('0x12'),_0x536537[_0x1430('0xd')],_0x1e8023);_0x2967f0(_0x29ffe3[_0x1430('0xc')](0x1f4,_0x536537['message']));});});}; \ No newline at end of file +var _0x46c7=['VoiceTransferReport','create','options','raw','then','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceTransferReport'];(function(_0x230ed,_0x425805){var _0x241186=function(_0x2c472c){while(--_0x2c472c){_0x230ed['push'](_0x230ed['shift']());}};_0x241186(++_0x425805);}(_0x46c7,0x13d));var _0x746c=function(_0x2adbeb,_0x5581be){_0x2adbeb=_0x2adbeb-0x0;var _0x5e18a6=_0x46c7[_0x2adbeb];return _0x5e18a6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x746c('0x0'));var BPromise=require(_0x746c('0x1'));var rs=require(_0x746c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x746c('0x3'))['db'];var utils=require(_0x746c('0x4'));var logger=require(_0x746c('0x5'))(_0x746c('0x6'));var config=require(_0x746c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x746c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1061d6,_0x3d9162,_0x49811a){return new BPromise(function(_0x1c2a70,_0x56ff3d){return client['request'](_0x1061d6,_0x49811a)['then'](function(_0x13e4e0){logger[_0x746c('0x9')](_0x746c('0xa'),_0x3d9162,_0x746c('0xb'));logger[_0x746c('0xc')](_0x746c('0xd'),_0x3d9162,_0x746c('0xb'),JSON[_0x746c('0xe')](_0x13e4e0));if(_0x13e4e0[_0x746c('0xf')]){if(_0x13e4e0[_0x746c('0xf')][_0x746c('0x10')]===0x1f4){logger[_0x746c('0xf')]('VoiceTransferReport,\x20%s,\x20%s',_0x3d9162,_0x13e4e0[_0x746c('0xf')][_0x746c('0x11')]);return _0x56ff3d(_0x13e4e0[_0x746c('0xf')][_0x746c('0x11')]);}logger[_0x746c('0xf')](_0x746c('0xa'),_0x3d9162,_0x13e4e0[_0x746c('0xf')][_0x746c('0x11')]);return _0x1c2a70(_0x13e4e0[_0x746c('0xf')]['message']);}else{logger[_0x746c('0x9')](_0x746c('0xa'),_0x3d9162,_0x746c('0xb'));_0x1c2a70(_0x13e4e0[_0x746c('0x12')][_0x746c('0x11')]);}})[_0x746c('0x13')](function(_0x572a52){logger[_0x746c('0xf')](_0x746c('0xa'),_0x3d9162,_0x572a52);_0x56ff3d(_0x572a52);});});}exports[_0x746c('0x14')]=function(_0x445867){var _0x20f6ed=this;return new Promise(function(_0x462550,_0x45c3c9){return db[_0x746c('0x15')][_0x746c('0x16')](_0x445867['body'],{'raw':_0x445867[_0x746c('0x17')]?_0x445867['options'][_0x746c('0x18')]===undefined?!![]:![]:!![]})[_0x746c('0x19')](function(_0x3214ac){logger[_0x746c('0x9')](_0x746c('0x14'),_0x445867);logger[_0x746c('0xc')](_0x746c('0x14'),_0x445867,JSON[_0x746c('0xe')](_0x3214ac));_0x462550(_0x3214ac);})[_0x746c('0x13')](function(_0x22c017){logger[_0x746c('0xf')](_0x746c('0x14'),_0x22c017[_0x746c('0x11')],_0x445867);_0x45c3c9(_0x20f6ed[_0x746c('0xf')](0x1f4,_0x22c017[_0x746c('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index eafccdf..d2b13d5 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 _0x284b=['exports','./webbar.controller','post','isAuthenticated','originate','/hangup','/answer','canUpdate','answer','hold','/unhold','unhold','/calls','calls','transfer'];(function(_0x5cfbfb,_0xb17b69){var _0x33cbe0=function(_0x16275b){while(--_0x16275b){_0x5cfbfb['push'](_0x5cfbfb['shift']());}};_0x33cbe0(++_0xb17b69);}(_0x284b,0x12d));var _0xb284=function(_0x179f01,_0x3d0abd){_0x179f01=_0x179f01-0x0;var _0x14aa9b=_0x284b[_0x179f01];return _0x14aa9b;};'use strict';var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0xb284('0x0'));router[_0xb284('0x1')]('/originate',auth[_0xb284('0x2')](),auth['canUpdate'](),controller[_0xb284('0x3')]);router[_0xb284('0x1')](_0xb284('0x4'),auth[_0xb284('0x2')](),auth['canUpdate'](),controller['hangup']);router[_0xb284('0x1')](_0xb284('0x5'),auth[_0xb284('0x2')](),auth[_0xb284('0x6')](),controller[_0xb284('0x7')]);router[_0xb284('0x1')]('/hold',auth[_0xb284('0x2')](),auth[_0xb284('0x6')](),controller[_0xb284('0x8')]);router[_0xb284('0x1')](_0xb284('0x9'),auth[_0xb284('0x2')](),auth['canUpdate'](),controller[_0xb284('0xa')]);router[_0xb284('0x1')](_0xb284('0xb'),auth[_0xb284('0x2')](),auth[_0xb284('0x6')](),controller[_0xb284('0xc')]);router[_0xb284('0x1')]('/transfer',auth[_0xb284('0x2')](),auth[_0xb284('0x6')](),controller[_0xb284('0xd')]);module[_0xb284('0xe')]=router; \ No newline at end of file +var _0xc13f=['isAuthenticated','canUpdate','originate','post','/hangup','hangup','/answer','answer','/hold','/unhold','unhold','/calls','calls','/transfer','transfer','express','Router','../../components/auth/service','./webbar.controller'];(function(_0x18bfcc,_0x32f883){var _0x4e1798=function(_0x2c0b38){while(--_0x2c0b38){_0x18bfcc['push'](_0x18bfcc['shift']());}};_0x4e1798(++_0x32f883);}(_0xc13f,0x94));var _0xfc13=function(_0x3d556c,_0x47108b){_0x3d556c=_0x3d556c-0x0;var _0x12b0b1=_0xc13f[_0x3d556c];return _0x12b0b1;};'use strict';var express=require(_0xfc13('0x0'));var router=express[_0xfc13('0x1')]();var auth=require(_0xfc13('0x2'));var controller=require(_0xfc13('0x3'));router['post']('/originate',auth[_0xfc13('0x4')](),auth[_0xfc13('0x5')](),controller[_0xfc13('0x6')]);router[_0xfc13('0x7')](_0xfc13('0x8'),auth[_0xfc13('0x4')](),auth[_0xfc13('0x5')](),controller[_0xfc13('0x9')]);router[_0xfc13('0x7')](_0xfc13('0xa'),auth[_0xfc13('0x4')](),auth[_0xfc13('0x5')](),controller[_0xfc13('0xb')]);router[_0xfc13('0x7')](_0xfc13('0xc'),auth[_0xfc13('0x4')](),auth[_0xfc13('0x5')](),controller['hold']);router['post'](_0xfc13('0xd'),auth[_0xfc13('0x4')](),auth[_0xfc13('0x5')](),controller[_0xfc13('0xe')]);router[_0xfc13('0x7')](_0xfc13('0xf'),auth[_0xfc13('0x4')](),auth[_0xfc13('0x5')](),controller[_0xfc13('0x10')]);router['post'](_0xfc13('0x11'),auth['isAuthenticated'](),auth[_0xfc13('0x5')](),controller[_0xfc13('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 8303fc2..b41e9da 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 _0xe13a=['number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','info','stringify','emit','log','handleError:','error','stack','name','send','status','NotFound','request','code','result','catch','User','agent','VoiceChannels','then','filter','rows','UserId','length','sessionId\x20','\x20not\x20found!','originate','body','json','userId','callNumber','entityFound:','user:%s','webbar:originate','hangup','hangup\x20fired:','sessionId','format','webbar:hangup','answer','webbar:answer','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','all','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','lodash','../../mysqldb','../../config/environment','util','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','socket.io-emitter','validate'];(function(_0x192be8,_0x14727d){var _0x27fce9=function(_0x193355){while(--_0x193355){_0x192be8['push'](_0x192be8['shift']());}};_0x27fce9(++_0x14727d);}(_0xe13a,0x178));var _0xae13=function(_0xe60206,_0x46d0a0){_0xe60206=_0xe60206-0x0;var _0x5fad6d=_0xe13a[_0xe60206];return _0x5fad6d;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0xae13('0x0'));var db=require(_0xae13('0x1'))['db'];var config=require(_0xae13('0x2'));var util=require(_0xae13('0x3'));var BPromise=require('bluebird');var jayson=require(_0xae13('0x4'));var amiClient=jayson[_0xae13('0x5')][_0xae13('0x6')]({'port':0x232a});var logger=require(_0xae13('0x7'))(_0xae13('0x8'));var Redis=require(_0xae13('0x9'));config[_0xae13('0xa')]=_[_0xae13('0xb')](config[_0xae13('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0xae13('0xc'))(new Redis(config[_0xae13('0xa')]));var Schema=require(_0xae13('0xd'));var originateValidation=new Schema({'userId':{'type':_0xae13('0xe'),'required':[!![],_0xae13('0xf')]},'callNumber':{'type':_0xae13('0x10'),'required':[!![],_0xae13('0x11')]},'callerId':{'type':_0xae13('0x10')},'callbackUrl':{'type':_0xae13('0x10')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0xae13('0xf')]},'sessionId':{'type':_0xae13('0x10'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xae13('0xe'),'required':[!![],_0xae13('0xf')]},'sessionId':{'type':_0xae13('0x10'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xae13('0xe'),'required':[!![],_0xae13('0xf')]},'sessionId':{'type':'string','required':[!![],_0xae13('0x12')]},'transferNumber':{'type':_0xae13('0x10'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xae13('0xf')]},'sessionId':{'type':_0xae13('0x10'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xae13('0xe'),'required':[!![],_0xae13('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0xae13('0xe'),'required':[!![],_0xae13('0xf')]}});function emit(_0x5c25a4,_0x3c488f,_0x5e46bc){logger[_0xae13('0x13')](_0x5c25a4,_0x3c488f,JSON[_0xae13('0x14')](_0x5e46bc));io['to'](_0x5c25a4)[_0xae13('0x15')](_0x3c488f,_0x5e46bc);}function handleError(_0x118e52){return function(_0x1a9c07){console[_0xae13('0x16')](_0xae13('0x17'),_0x1a9c07,_0x1a9c07 instanceof RangeError);logger[_0xae13('0x18')](_0x1a9c07[_0xae13('0x19')]);if(_0x1a9c07 instanceof RangeError){if(_0x1a9c07['name']){delete _0x1a9c07[_0xae13('0x1a')];}_0x118e52['status'](0x194)[_0xae13('0x1b')](_0x1a9c07);}else{if(_0x1a9c07[_0xae13('0x1a')]){delete _0x1a9c07['name'];}_0x118e52[_0xae13('0x1c')](0x1f4)[_0xae13('0x1b')](_0x1a9c07);}};}function checkError(){return function(_0x3e4bc8){if(!_0x3e4bc8){throw new RangeError(_0xae13('0x1d'));}return _0x3e4bc8;};}function respondWithRpcPromise(_0x184375,_0x2fd0e9){return new BPromise(function(_0x54b3b4,_0x520692){var _0x149eda=amiClient;return _0x149eda[_0xae13('0x1e')](_0x184375,_0x2fd0e9)['then'](function(_0x168b92){if(_0x168b92['error']){if(_0x168b92[_0xae13('0x18')][_0xae13('0x1f')]===0x1f4){return _0x520692(_0x168b92[_0xae13('0x18')]['message']);}return _0x54b3b4(_0x168b92['error']['message']);}else{_0x54b3b4(_0x168b92[_0xae13('0x20')]);}})[_0xae13('0x21')](function(_0x17ce58){_0x520692(_0x17ce58);});});}function getAgent(_0x55a39b){return db[_0xae13('0x22')]['findOne']({'where':{'id':_0x55a39b,'role':_0xae13('0x23')}})['then'](checkError());}function getAgentCheckSession(_0xbeda8d,_0x3117c2){return new BPromise(function(_0x526e4e,_0xa98d6c){var _0x370ee0=respondWithRpcPromise(_0xae13('0x24'));var _0x306dfb=getAgent(_0xbeda8d);Promise['all']([_0x370ee0,_0x306dfb])[_0xae13('0x25')](function(_0x27b737){var _0x1d7152=_0x27b737[0x0];var _0x68ce70=_0x27b737[0x1];var _0x742759=_[_0xae13('0x26')](_0x1d7152[_0xae13('0x27')],function(_0x5bd0ee){return _0x5bd0ee[_0xae13('0x28')]==_0x68ce70['id']&&_0x5bd0ee['sessionId']==_0x3117c2;});if(_0x742759[_0xae13('0x29')]==0x1){_0x526e4e(_0x68ce70);}else{_0xa98d6c(new RangeError(_0xae13('0x2a')+_0x3117c2+_0xae13('0x2b')));}});});}exports[_0xae13('0x2c')]=function(_0x352aec,_0x39718f){logger[_0xae13('0x13')]('originate\x20fired:',_0x352aec['body']);var _0x30d2c0=originateValidation[_0xae13('0xd')](_0x352aec[_0xae13('0x2d')]);if(_0x30d2c0[_0xae13('0x29')]>0x0){return _0x39718f[_0xae13('0x1c')](0x190)[_0xae13('0x2e')](_0x30d2c0);}var _0x126686=_0x352aec[_0xae13('0x2d')][_0xae13('0x2f')];var _0x23f9d7=_0x352aec['body'][_0xae13('0x30')];var _0x116270=_0x352aec[_0xae13('0x2d')]['callerId'];var _0x53b5f6=_0x352aec['body']['callbackUrl'];return getAgent(_0x126686)['then'](function(_0x5ee151){logger[_0xae13('0x13')](_0xae13('0x31'),_0x5ee151[_0xae13('0x1a')]);emit(util['format'](_0xae13('0x32'),_0x5ee151[_0xae13('0x1a')]),_0xae13('0x33'),{'callNumber':_0x23f9d7,'callerId':_0x116270,'callbackUrl':_0x53b5f6});return _0x39718f[_0xae13('0x1c')](0xc8)[_0xae13('0x2e')]({'error':![],'message':'originate\x20executed!'});})[_0xae13('0x21')](handleError(_0x39718f));};exports[_0xae13('0x34')]=function(_0x15865c,_0x535b0b){logger['info'](_0xae13('0x35'),_0x15865c[_0xae13('0x2d')]);var _0x120346=hangupValidation[_0xae13('0xd')](_0x15865c['body']);if(_0x120346[_0xae13('0x29')]>0x0){return _0x535b0b[_0xae13('0x1c')](0x190)['json'](_0x120346);}var _0x249058=_0x15865c[_0xae13('0x2d')]['userId'];var _0x1bf423=_0x15865c[_0xae13('0x2d')][_0xae13('0x36')];return getAgent(_0x249058)[_0xae13('0x25')](function(_0x4d7405){logger[_0xae13('0x13')](_0xae13('0x31'),_0x4d7405[_0xae13('0x1a')]);emit(util[_0xae13('0x37')]('user:%s',_0x4d7405[_0xae13('0x1a')]),_0xae13('0x38'),{'sessionId':_0x1bf423});return _0x535b0b[_0xae13('0x1c')](0xc8)[_0xae13('0x2e')]({'error':![],'message':'hangup\x20executed!'});})['catch'](handleError(_0x535b0b));};exports[_0xae13('0x39')]=function(_0xde6962,_0x4bff9d){logger[_0xae13('0x13')]('answer\x20fired:',_0xde6962[_0xae13('0x2d')]);var _0x230ba6=answerValidation[_0xae13('0xd')](_0xde6962['body']);if(_0x230ba6[_0xae13('0x29')]>0x0){return _0x4bff9d[_0xae13('0x1c')](0x190)[_0xae13('0x2e')](_0x230ba6);}var _0x16b403=_0xde6962['body'][_0xae13('0x2f')];var _0x36a3c4=_0xde6962[_0xae13('0x2d')][_0xae13('0x36')];return getAgent(_0x16b403)[_0xae13('0x25')](function(_0x74e6b3){logger[_0xae13('0x13')](_0xae13('0x31'),_0x74e6b3['name']);emit(util[_0xae13('0x37')]('user:%s',_0x74e6b3[_0xae13('0x1a')]),_0xae13('0x3a'),{'sessionId':_0x36a3c4});return _0x4bff9d[_0xae13('0x1c')](0xc8)[_0xae13('0x2e')]({'error':![],'message':'answer\x20executed!'});})[_0xae13('0x21')](handleError(_0x4bff9d));};exports['hold']=function(_0x3a1140,_0x935090){logger['info'](_0xae13('0x3b'),_0x3a1140[_0xae13('0x2d')]);var _0x352ea5=holdValidation[_0xae13('0xd')](_0x3a1140[_0xae13('0x2d')]);if(_0x352ea5[_0xae13('0x29')]>0x0){return _0x935090['status'](0x190)[_0xae13('0x2e')](_0x352ea5);}var _0x26dcbb=_0x3a1140[_0xae13('0x2d')][_0xae13('0x2f')];var _0x29ba1=_0x3a1140['body'][_0xae13('0x36')];return getAgent(_0x26dcbb)[_0xae13('0x25')](function(_0x8e6f1e){logger['info']('entityFound:',_0x8e6f1e['name']);emit(util['format'](_0xae13('0x32'),_0x8e6f1e['name']),_0xae13('0x3c'),{'sessionId':_0x29ba1});return _0x935090['status'](0xc8)[_0xae13('0x2e')]({'error':![],'message':_0xae13('0x3d')});})[_0xae13('0x21')](handleError(_0x935090));};exports[_0xae13('0x3e')]=function(_0x4509ea,_0x53d341){logger[_0xae13('0x13')](_0xae13('0x3f'),_0x4509ea['body']);var _0x67d3a8=unholdValidation[_0xae13('0xd')](_0x4509ea['body']);if(_0x67d3a8['length']>0x0){return _0x53d341['status'](0x190)['json'](_0x67d3a8);}var _0x22f828=_0x4509ea[_0xae13('0x2d')]['userId'];var _0x3c9552=_0x4509ea[_0xae13('0x2d')]['sessionId'];return getAgent(_0x22f828)[_0xae13('0x25')](function(_0x277213){logger[_0xae13('0x13')](_0xae13('0x31'),_0x277213[_0xae13('0x1a')]);emit(util[_0xae13('0x37')](_0xae13('0x32'),_0x277213[_0xae13('0x1a')]),_0xae13('0x40'),{'sessionId':_0x3c9552});return _0x53d341[_0xae13('0x1c')](0xc8)['json']({'error':![],'message':_0xae13('0x41')});})[_0xae13('0x21')](handleError(_0x53d341));};exports[_0xae13('0x42')]=function(_0x481c30,_0x3b890c){logger['info'](_0xae13('0x43'),_0x3b890c[_0xae13('0x2d')]);var _0xd76dc7=callsValidation['validate'](_0x481c30['body']);if(_0xd76dc7[_0xae13('0x29')]>0x0){return _0x3b890c[_0xae13('0x1c')](0x190)[_0xae13('0x2e')](_0xd76dc7);}var _0x3ce119=_0x481c30[_0xae13('0x2d')][_0xae13('0x2f')];var _0x3b9840=respondWithRpcPromise('VoiceChannels');var _0x1a653e=getAgent(_0x3ce119);return Promise[_0xae13('0x44')]([_0x3b9840,_0x1a653e])[_0xae13('0x25')](function(_0x346fdd){var _0xcbac5b=_0x346fdd[0x0];var _0x67e5d3=_0x346fdd[0x1];var _0x14f543=_['filter'](_0xcbac5b[_0xae13('0x27')],function(_0x1989fe){return _0x1989fe['UserId']==_0x67e5d3['id'];});return _0x3b890c[_0xae13('0x1c')](0xc8)[_0xae13('0x2e')]({'count':_0x14f543[_0xae13('0x29')],'rows':_0x14f543});})['catch'](handleError(_0x3b890c));};exports[_0xae13('0x45')]=function(_0x7fa6c5,_0x50166a){logger[_0xae13('0x13')](_0xae13('0x46'),_0x7fa6c5[_0xae13('0x2d')]);var _0x1a839a=conferenceValidation[_0xae13('0xd')](_0x7fa6c5[_0xae13('0x2d')]);if(_0x1a839a['length']>0x0){return _0x50166a['status'](0x190)[_0xae13('0x2e')](_0x1a839a);}var _0x2dd9ad=_0x7fa6c5[_0xae13('0x2d')][_0xae13('0x2f')];return getAgent(_0x2dd9ad)[_0xae13('0x25')](function(_0x43e176){logger['info'](_0xae13('0x31'),_0x43e176[_0xae13('0x1a')]);emit(util['format']('user:%s',_0x43e176['name']),_0xae13('0x47'));return _0x50166a[_0xae13('0x1c')](0xc8)[_0xae13('0x2e')]({'error':![],'message':_0xae13('0x48')});})[_0xae13('0x21')](handleError(_0x50166a));};exports[_0xae13('0x49')]=function(_0x31e4af,_0x2e4415){logger[_0xae13('0x13')](_0xae13('0x4a'),_0x31e4af[_0xae13('0x2d')]);var _0x28bb14=transferValidation[_0xae13('0xd')](_0x31e4af[_0xae13('0x2d')]);if(_0x28bb14[_0xae13('0x29')]>0x0){return _0x2e4415['status'](0x190)[_0xae13('0x2e')](_0x28bb14);}var _0x259f12=_0x31e4af['body'][_0xae13('0x2f')];var _0x59a2e0=_0x31e4af['body'][_0xae13('0x36')];var _0x25cc60=_0x31e4af[_0xae13('0x2d')][_0xae13('0x4b')];return getAgent(_0x259f12)[_0xae13('0x25')](function(_0x3797da){logger['info']('entityFound:',_0x3797da[_0xae13('0x1a')]);emit(util[_0xae13('0x37')](_0xae13('0x32'),_0x3797da['name']),_0xae13('0x4c'),{'sessionId':_0x59a2e0,'transferNumber':_0x25cc60});return _0x2e4415['status'](0xc8)[_0xae13('0x2e')]({'error':![],'message':_0xae13('0x4d')});})[_0xae13('0x21')](handleError(_0x2e4415));}; \ No newline at end of file +var _0x70e0=['rows','conference','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','bluebird','jayson/promise','client','http','webbarapi','redis','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','emit','log','handleError:','stack','name','status','send','NotFound','request','then','error','code','message','catch','User','findOne','agent','VoiceChannels','all','filter','UserId','sessionId','length','\x20not\x20found!','originate','body','userId','callNumber','callerId','info','entityFound:','user:%s','json','hangup\x20fired:','format','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls\x20fired:'];(function(_0x33f274,_0x7ef4d8){var _0x4bcaab=function(_0x2c2168){while(--_0x2c2168){_0x33f274['push'](_0x33f274['shift']());}};_0x4bcaab(++_0x7ef4d8);}(_0x70e0,0x17b));var _0x070e=function(_0x3ef8a1,_0xab77f4){_0x3ef8a1=_0x3ef8a1-0x0;var _0x4a392e=_0x70e0[_0x3ef8a1];return _0x4a392e;};'use strict';var path=require(_0x070e('0x0'));var fs=require('fs');var _=require(_0x070e('0x1'));var db=require(_0x070e('0x2'))['db'];var config=require('../../config/environment');var util=require('util');var BPromise=require(_0x070e('0x3'));var jayson=require(_0x070e('0x4'));var amiClient=jayson[_0x070e('0x5')][_0x070e('0x6')]({'port':0x232a});var logger=require('../../config/logger')(_0x070e('0x7'));var Redis=require('ioredis');config[_0x070e('0x8')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x070e('0x9'))(new Redis(config[_0x070e('0x8')]));var Schema=require(_0x070e('0xa'));var originateValidation=new Schema({'userId':{'type':_0x070e('0xb'),'required':[!![],_0x070e('0xc')]},'callNumber':{'type':_0x070e('0xd'),'required':[!![],_0x070e('0xe')]},'callerId':{'type':'string'},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0x070e('0xb'),'required':[!![],_0x070e('0xc')]},'sessionId':{'type':_0x070e('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x070e('0xb'),'required':[!![],_0x070e('0xc')]},'sessionId':{'type':_0x070e('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x070e('0xb'),'required':[!![],_0x070e('0xc')]},'sessionId':{'type':_0x070e('0xd'),'required':[!![],_0x070e('0xf')]},'transferNumber':{'type':_0x070e('0xd'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x070e('0xc')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x070e('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x070e('0xb'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x070e('0xc')]}});function emit(_0xeae1a5,_0x180897,_0x19d9da){logger['info'](_0xeae1a5,_0x180897,JSON['stringify'](_0x19d9da));io['to'](_0xeae1a5)[_0x070e('0x10')](_0x180897,_0x19d9da);}function handleError(_0x2bd937){return function(_0x38f6e6){console[_0x070e('0x11')](_0x070e('0x12'),_0x38f6e6,_0x38f6e6 instanceof RangeError);logger['error'](_0x38f6e6[_0x070e('0x13')]);if(_0x38f6e6 instanceof RangeError){if(_0x38f6e6[_0x070e('0x14')]){delete _0x38f6e6[_0x070e('0x14')];}_0x2bd937[_0x070e('0x15')](0x194)[_0x070e('0x16')](_0x38f6e6);}else{if(_0x38f6e6['name']){delete _0x38f6e6['name'];}_0x2bd937['status'](0x1f4)[_0x070e('0x16')](_0x38f6e6);}};}function checkError(){return function(_0x3004f0){if(!_0x3004f0){throw new RangeError(_0x070e('0x17'));}return _0x3004f0;};}function respondWithRpcPromise(_0x4be0d7,_0x5b184){return new BPromise(function(_0x5dc5d2,_0xf8dd5d){var _0x3f6985=amiClient;return _0x3f6985[_0x070e('0x18')](_0x4be0d7,_0x5b184)[_0x070e('0x19')](function(_0x28a1c3){if(_0x28a1c3[_0x070e('0x1a')]){if(_0x28a1c3[_0x070e('0x1a')][_0x070e('0x1b')]===0x1f4){return _0xf8dd5d(_0x28a1c3['error'][_0x070e('0x1c')]);}return _0x5dc5d2(_0x28a1c3[_0x070e('0x1a')][_0x070e('0x1c')]);}else{_0x5dc5d2(_0x28a1c3['result']);}})[_0x070e('0x1d')](function(_0x5f3e9d){_0xf8dd5d(_0x5f3e9d);});});}function getAgent(_0x4a2dbd){return db[_0x070e('0x1e')][_0x070e('0x1f')]({'where':{'id':_0x4a2dbd,'role':_0x070e('0x20')}})[_0x070e('0x19')](checkError());}function getAgentCheckSession(_0x4763c6,_0x497f58){return new BPromise(function(_0x374c54,_0x219e48){var _0x1d72d6=respondWithRpcPromise(_0x070e('0x21'));var _0x43dd96=getAgent(_0x4763c6);Promise[_0x070e('0x22')]([_0x1d72d6,_0x43dd96])[_0x070e('0x19')](function(_0x26373b){var _0x5e8326=_0x26373b[0x0];var _0x282344=_0x26373b[0x1];var _0x351641=_[_0x070e('0x23')](_0x5e8326['rows'],function(_0x5c5f0d){return _0x5c5f0d[_0x070e('0x24')]==_0x282344['id']&&_0x5c5f0d[_0x070e('0x25')]==_0x497f58;});if(_0x351641[_0x070e('0x26')]==0x1){_0x374c54(_0x282344);}else{_0x219e48(new RangeError('sessionId\x20'+_0x497f58+_0x070e('0x27')));}});});}exports[_0x070e('0x28')]=function(_0x3a9425,_0x5f2bee){logger['info']('originate\x20fired:',_0x3a9425['body']);var _0x59c5b4=originateValidation[_0x070e('0xa')](_0x3a9425['body']);if(_0x59c5b4[_0x070e('0x26')]>0x0){return _0x5f2bee[_0x070e('0x15')](0x190)['json'](_0x59c5b4);}var _0x47a739=_0x3a9425[_0x070e('0x29')][_0x070e('0x2a')];var _0x55288a=_0x3a9425['body'][_0x070e('0x2b')];var _0x27dd1f=_0x3a9425[_0x070e('0x29')][_0x070e('0x2c')];var _0x18f0ad=_0x3a9425['body']['callbackUrl'];return getAgent(_0x47a739)[_0x070e('0x19')](function(_0x3011c4){logger[_0x070e('0x2d')](_0x070e('0x2e'),_0x3011c4[_0x070e('0x14')]);emit(util['format'](_0x070e('0x2f'),_0x3011c4[_0x070e('0x14')]),'webbar:originate',{'callNumber':_0x55288a,'callerId':_0x27dd1f,'callbackUrl':_0x18f0ad});return _0x5f2bee[_0x070e('0x15')](0xc8)[_0x070e('0x30')]({'error':![],'message':'originate\x20executed!'});})['catch'](handleError(_0x5f2bee));};exports['hangup']=function(_0x363bff,_0x3dfbf7){logger[_0x070e('0x2d')](_0x070e('0x31'),_0x363bff[_0x070e('0x29')]);var _0x5e3827=hangupValidation[_0x070e('0xa')](_0x363bff[_0x070e('0x29')]);if(_0x5e3827[_0x070e('0x26')]>0x0){return _0x3dfbf7['status'](0x190)[_0x070e('0x30')](_0x5e3827);}var _0x72cbc7=_0x363bff[_0x070e('0x29')]['userId'];var _0x13982f=_0x363bff[_0x070e('0x29')]['sessionId'];return getAgent(_0x72cbc7)[_0x070e('0x19')](function(_0x5d689b){logger[_0x070e('0x2d')](_0x070e('0x2e'),_0x5d689b[_0x070e('0x14')]);emit(util[_0x070e('0x32')](_0x070e('0x2f'),_0x5d689b['name']),_0x070e('0x33'),{'sessionId':_0x13982f});return _0x3dfbf7['status'](0xc8)['json']({'error':![],'message':_0x070e('0x34')});})[_0x070e('0x1d')](handleError(_0x3dfbf7));};exports[_0x070e('0x35')]=function(_0x4d52ff,_0x2ad56c){logger[_0x070e('0x2d')](_0x070e('0x36'),_0x4d52ff[_0x070e('0x29')]);var _0x4a4ee3=answerValidation[_0x070e('0xa')](_0x4d52ff['body']);if(_0x4a4ee3['length']>0x0){return _0x2ad56c['status'](0x190)[_0x070e('0x30')](_0x4a4ee3);}var _0x926533=_0x4d52ff[_0x070e('0x29')][_0x070e('0x2a')];var _0x34f23e=_0x4d52ff['body'][_0x070e('0x25')];return getAgent(_0x926533)['then'](function(_0x23dac5){logger[_0x070e('0x2d')](_0x070e('0x2e'),_0x23dac5['name']);emit(util['format'](_0x070e('0x2f'),_0x23dac5['name']),_0x070e('0x37'),{'sessionId':_0x34f23e});return _0x2ad56c[_0x070e('0x15')](0xc8)[_0x070e('0x30')]({'error':![],'message':'answer\x20executed!'});})[_0x070e('0x1d')](handleError(_0x2ad56c));};exports[_0x070e('0x38')]=function(_0x48d836,_0x589b97){logger[_0x070e('0x2d')](_0x070e('0x39'),_0x48d836[_0x070e('0x29')]);var _0x1fc7c4=holdValidation[_0x070e('0xa')](_0x48d836['body']);if(_0x1fc7c4[_0x070e('0x26')]>0x0){return _0x589b97[_0x070e('0x15')](0x190)[_0x070e('0x30')](_0x1fc7c4);}var _0x391dee=_0x48d836[_0x070e('0x29')][_0x070e('0x2a')];var _0x1f54d5=_0x48d836[_0x070e('0x29')][_0x070e('0x25')];return getAgent(_0x391dee)[_0x070e('0x19')](function(_0x210c4d){logger[_0x070e('0x2d')](_0x070e('0x2e'),_0x210c4d[_0x070e('0x14')]);emit(util[_0x070e('0x32')]('user:%s',_0x210c4d[_0x070e('0x14')]),_0x070e('0x3a'),{'sessionId':_0x1f54d5});return _0x589b97[_0x070e('0x15')](0xc8)[_0x070e('0x30')]({'error':![],'message':_0x070e('0x3b')});})[_0x070e('0x1d')](handleError(_0x589b97));};exports[_0x070e('0x3c')]=function(_0x35dbaf,_0x1c64d2){logger['info'](_0x070e('0x3d'),_0x35dbaf['body']);var _0x1acddb=unholdValidation[_0x070e('0xa')](_0x35dbaf['body']);if(_0x1acddb[_0x070e('0x26')]>0x0){return _0x1c64d2[_0x070e('0x15')](0x190)[_0x070e('0x30')](_0x1acddb);}var _0xa74805=_0x35dbaf[_0x070e('0x29')][_0x070e('0x2a')];var _0x83f21e=_0x35dbaf['body'][_0x070e('0x25')];return getAgent(_0xa74805)['then'](function(_0x516161){logger[_0x070e('0x2d')](_0x070e('0x2e'),_0x516161[_0x070e('0x14')]);emit(util[_0x070e('0x32')](_0x070e('0x2f'),_0x516161[_0x070e('0x14')]),_0x070e('0x3e'),{'sessionId':_0x83f21e});return _0x1c64d2[_0x070e('0x15')](0xc8)['json']({'error':![],'message':_0x070e('0x3f')});})['catch'](handleError(_0x1c64d2));};exports['calls']=function(_0x3a76e2,_0x20acc6){logger['info'](_0x070e('0x40'),_0x20acc6[_0x070e('0x29')]);var _0x210f4a=callsValidation[_0x070e('0xa')](_0x3a76e2[_0x070e('0x29')]);if(_0x210f4a[_0x070e('0x26')]>0x0){return _0x20acc6[_0x070e('0x15')](0x190)['json'](_0x210f4a);}var _0x5874cd=_0x3a76e2['body'][_0x070e('0x2a')];var _0x1948a5=respondWithRpcPromise(_0x070e('0x21'));var _0x2f8fcb=getAgent(_0x5874cd);return Promise['all']([_0x1948a5,_0x2f8fcb])[_0x070e('0x19')](function(_0x5d3c3a){var _0x212710=_0x5d3c3a[0x0];var _0x1cbb7e=_0x5d3c3a[0x1];var _0x476804=_[_0x070e('0x23')](_0x212710[_0x070e('0x41')],function(_0x15dbc4){return _0x15dbc4['UserId']==_0x1cbb7e['id'];});return _0x20acc6[_0x070e('0x15')](0xc8)[_0x070e('0x30')]({'count':_0x476804[_0x070e('0x26')],'rows':_0x476804});})['catch'](handleError(_0x20acc6));};exports[_0x070e('0x42')]=function(_0x1da803,_0x5cd534){logger[_0x070e('0x2d')]('conference\x20fired:',_0x1da803[_0x070e('0x29')]);var _0x569f92=conferenceValidation['validate'](_0x1da803['body']);if(_0x569f92[_0x070e('0x26')]>0x0){return _0x5cd534[_0x070e('0x15')](0x190)[_0x070e('0x30')](_0x569f92);}var _0x122198=_0x1da803[_0x070e('0x29')][_0x070e('0x2a')];return getAgent(_0x122198)['then'](function(_0x841c89){logger['info'](_0x070e('0x2e'),_0x841c89['name']);emit(util[_0x070e('0x32')](_0x070e('0x2f'),_0x841c89['name']),_0x070e('0x43'));return _0x5cd534['status'](0xc8)[_0x070e('0x30')]({'error':![],'message':_0x070e('0x44')});})[_0x070e('0x1d')](handleError(_0x5cd534));};exports[_0x070e('0x45')]=function(_0x764b06,_0x20c772){logger[_0x070e('0x2d')](_0x070e('0x46'),_0x764b06[_0x070e('0x29')]);var _0x3332d0=transferValidation[_0x070e('0xa')](_0x764b06[_0x070e('0x29')]);if(_0x3332d0[_0x070e('0x26')]>0x0){return _0x20c772[_0x070e('0x15')](0x190)['json'](_0x3332d0);}var _0x45bf20=_0x764b06[_0x070e('0x29')][_0x070e('0x2a')];var _0x93301a=_0x764b06['body'][_0x070e('0x25')];var _0x4e8e58=_0x764b06[_0x070e('0x29')][_0x070e('0x47')];return getAgent(_0x45bf20)[_0x070e('0x19')](function(_0x12a58f){logger['info'](_0x070e('0x2e'),_0x12a58f[_0x070e('0x14')]);emit(util[_0x070e('0x32')](_0x070e('0x2f'),_0x12a58f['name']),_0x070e('0x48'),{'sessionId':_0x93301a,'transferNumber':_0x4e8e58});return _0x20c772['status'](0xc8)[_0x070e('0x30')]({'error':![],'message':_0x070e('0x49')});})[_0x070e('0x1d')](handleError(_0x20c772));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 4b1c192..04fbcb1 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 _0xf4f4=['../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/users','getAgents','/:id/applications','getApplications','create','post','addDisposition','addAnswer','addAgents','addApplications','/:id/notify','notify','/:id/send','send','put','/:id','update','delete','destroy','removeAnswers','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x309d65,_0x568cc0){var _0x4915d2=function(_0x8fb6d4){while(--_0x8fb6d4){_0x309d65['push'](_0x309d65['shift']());}};_0x4915d2(++_0x568cc0);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x237b89,_0x11548f){_0x237b89=_0x237b89-0x0;var _0x282e5c=_0xf4f4[_0x237b89];return _0x282e5c;};'use strict';var multer=require(_0x4f4f('0x0'));var util=require(_0x4f4f('0x1'));var path=require('path');var timeout=require(_0x4f4f('0x2'));var express=require(_0x4f4f('0x3'));var router=express[_0x4f4f('0x4')]();var fs_extra=require(_0x4f4f('0x5'));var auth=require(_0x4f4f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4f4f('0x7'));var controller=require('./whatsappAccount.controller');router[_0x4f4f('0x8')]('/',auth[_0x4f4f('0x9')](),controller[_0x4f4f('0xa')]);router[_0x4f4f('0x8')](_0x4f4f('0xb'),auth[_0x4f4f('0x9')](),controller[_0x4f4f('0xc')]);router[_0x4f4f('0x8')]('/:id',auth[_0x4f4f('0x9')](),controller[_0x4f4f('0xd')]);router[_0x4f4f('0x8')](_0x4f4f('0xe'),auth[_0x4f4f('0x9')](),controller[_0x4f4f('0xf')]);router[_0x4f4f('0x8')](_0x4f4f('0x10'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x4f4f('0x8')](_0x4f4f('0x11'),auth[_0x4f4f('0x9')](),controller[_0x4f4f('0x12')]);router[_0x4f4f('0x8')](_0x4f4f('0x13'),auth['isAuthenticated'](),controller[_0x4f4f('0x14')]);router['post']('/',auth[_0x4f4f('0x9')](),controller[_0x4f4f('0x15')]);router[_0x4f4f('0x16')](_0x4f4f('0xe'),auth['isAuthenticated'](),controller[_0x4f4f('0x17')]);router['post']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x4f4f('0x18')]);router[_0x4f4f('0x16')](_0x4f4f('0x11'),auth[_0x4f4f('0x9')](),controller[_0x4f4f('0x19')]);router[_0x4f4f('0x16')](_0x4f4f('0x13'),auth[_0x4f4f('0x9')](),controller[_0x4f4f('0x1a')]);router[_0x4f4f('0x16')](_0x4f4f('0x1b'),controller[_0x4f4f('0x1c')]);router['post'](_0x4f4f('0x1d'),auth[_0x4f4f('0x9')](),controller[_0x4f4f('0x1e')]);router[_0x4f4f('0x1f')](_0x4f4f('0x20'),auth[_0x4f4f('0x9')](),controller[_0x4f4f('0x21')]);router[_0x4f4f('0x22')](_0x4f4f('0x20'),auth[_0x4f4f('0x9')](),controller[_0x4f4f('0x23')]);router[_0x4f4f('0x22')](_0x4f4f('0xe'),auth[_0x4f4f('0x9')](),controller['removeDispositions']);router['delete']('/:id/canned_answers',auth[_0x4f4f('0x9')](),controller[_0x4f4f('0x24')]);router['delete'](_0x4f4f('0x11'),auth[_0x4f4f('0x9')](),controller[_0x4f4f('0x25')]);module[_0x4f4f('0x26')]=router; \ No newline at end of file +var _0xd4a2=['../../components/auth/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','addDisposition','/:id/canned_answers','addAnswer','addAgents','notify','/:id/send','send','put','update','delete','destroy','removeAnswers','removeAgents','multer','connect-timeout','Router'];(function(_0x57de67,_0x39e978){var _0x457854=function(_0x4c1a7f){while(--_0x4c1a7f){_0x57de67['push'](_0x57de67['shift']());}};_0x457854(++_0x39e978);}(_0xd4a2,0x173));var _0x2d4a=function(_0x14cabf,_0x2c7991){_0x14cabf=_0x14cabf-0x0;var _0x433f7d=_0xd4a2[_0x14cabf];return _0x433f7d;};'use strict';var multer=require(_0x2d4a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2d4a('0x1'));var express=require('express');var router=express[_0x2d4a('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x2d4a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x2d4a('0x4'));var controller=require(_0x2d4a('0x5'));router[_0x2d4a('0x6')]('/',auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x8')]);router['get'](_0x2d4a('0x9'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0xa')]);router[_0x2d4a('0x6')](_0x2d4a('0xb'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0xc')]);router[_0x2d4a('0x6')](_0x2d4a('0xd'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0xe')]);router[_0x2d4a('0x6')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x2d4a('0xf')]);router['get'](_0x2d4a('0x10'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x11')]);router[_0x2d4a('0x6')](_0x2d4a('0x12'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x13')]);router[_0x2d4a('0x14')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2d4a('0x14')]('/:id/dispositions',auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x15')]);router[_0x2d4a('0x14')](_0x2d4a('0x16'),auth['isAuthenticated'](),controller[_0x2d4a('0x17')]);router['post'](_0x2d4a('0x10'),auth['isAuthenticated'](),controller[_0x2d4a('0x18')]);router[_0x2d4a('0x14')](_0x2d4a('0x12'),auth[_0x2d4a('0x7')](),controller['addApplications']);router['post']('/:id/notify',controller[_0x2d4a('0x19')]);router[_0x2d4a('0x14')](_0x2d4a('0x1a'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x1b')]);router[_0x2d4a('0x1c')]('/:id',auth['isAuthenticated'](),controller[_0x2d4a('0x1d')]);router[_0x2d4a('0x1e')](_0x2d4a('0xb'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x1f')]);router[_0x2d4a('0x1e')](_0x2d4a('0xd'),auth[_0x2d4a('0x7')](),controller['removeDispositions']);router[_0x2d4a('0x1e')](_0x2d4a('0x16'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x20')]);router[_0x2d4a('0x1e')](_0x2d4a('0x10'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x21')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index a8d644d..2213e9e 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 _0x3b54=['generate','ENUM','twilio','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','name'];(function(_0x5b36bd,_0x4dfb36){var _0x1614fe=function(_0x559b7c){while(--_0x559b7c){_0x5b36bd['push'](_0x5b36bd['shift']());}};_0x1614fe(++_0x4dfb36);}(_0x3b54,0x195));var _0x43b5=function(_0x4a3ee3,_0x304512){_0x4a3ee3=_0x4a3ee3-0x0;var _0x56d16d=_0x3b54[_0x4a3ee3];return _0x56d16d;};'use strict';var Sequelize=require(_0x43b5('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0x43b5('0x1')],'unique':_0x43b5('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x43b5('0x1')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x43b5('0x1')],'defaultValue':function(){return rs[_0x43b5('0x3')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x43b5('0x4')](_0x43b5('0x5'))},'accountSid':{'type':Sequelize[_0x43b5('0x1')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x43b5('0x6')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x43b5('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x43b5('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x43b5('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x43b5('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x43b5('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x43b5('0x7')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x43b5('0x6')],'defaultValue':![],'comment':_0x43b5('0x8'),'set':function(_0x280487){if(!_0x280487){this[_0x43b5('0x9')](_0x43b5('0xa'),null);}this[_0x43b5('0x9')](_0x43b5('0xb'),_0x280487);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5fa6=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x418ad2,_0xeae93b){var _0x4f4fe5=function(_0x424e28){while(--_0x424e28){_0x418ad2['push'](_0x418ad2['shift']());}};_0x4f4fe5(++_0xeae93b);}(_0x5fa6,0x1a4));var _0x65fa=function(_0x4c742f,_0x2bd40a){_0x4c742f=_0x4c742f-0x0;var _0x2913ae=_0x5fa6[_0x4c742f];return _0x2913ae;};'use strict';var Sequelize=require(_0x65fa('0x0'));var rs=require('randomstring');module[_0x65fa('0x1')]={'name':{'type':Sequelize[_0x65fa('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x65fa('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x65fa('0x2')]},'type':{'type':Sequelize[_0x65fa('0x3')]('twilio')},'accountSid':{'type':Sequelize[_0x65fa('0x2')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x65fa('0x4')],'defaultValue':function(){return _0x65fa('0x5');}},'notificationSound':{'type':Sequelize[_0x65fa('0x6')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x65fa('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x65fa('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x65fa('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x65fa('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x65fa('0x6')],'defaultValue':![],'comment':_0x65fa('0x9'),'set':function(_0x27966c){if(!_0x27966c){this[_0x65fa('0xa')](_0x65fa('0xb'),null);}this[_0x65fa('0xa')](_0x65fa('0xc'),_0x27966c);}},'description':{'type':Sequelize[_0x65fa('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 5e5833b..9335b5d 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 _0x158e=['redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','then','info','debug','request\x20sent','stringify','code','error','WhatsappAccount,\x20%s,\x20%s','message','result','catch','status','end','json','offset','count','limit','set','Content-Range','apply','reject','save','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','send','map','WhatsappAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','findAll','rows','params','Pause','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','mandatoryDispositionPause','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','emit','userWhatsappAccount:save','removeAgents','userWhatsappAccount:remove','getAgents','addApplications','sequelize','transaction','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','notify','whatsapp','account','applications','orderBy','Applications','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','twilio','from','replace','Body','messageId','MessageSid','Sequelize','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','DESC','list','omit','Contacts','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','AttachmentId','UserId','User','agent','Start','startRouting','WhatsappAccount,\x20%s,\x20%s,\x20%s','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','Content-Type','text/xml','\x0a','List','out','WhatsappMessage','Messages','spread','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','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','../../mysqldb'];(function(_0x5dbc6a,_0x55c7c6){var _0x33c9c7=function(_0x376bf8){while(--_0x376bf8){_0x5dbc6a['push'](_0x5dbc6a['shift']());}};_0x33c9c7(++_0x55c7c6);}(_0x158e,0xa1));var _0xe158=function(_0x3e4b52,_0xf50721){_0x3e4b52=_0x3e4b52-0x0;var _0x2ad7e0=_0x158e[_0x3e4b52];return _0x2ad7e0;};'use strict';var emlformat=require(_0xe158('0x0'));var rimraf=require(_0xe158('0x1'));var zipdir=require(_0xe158('0x2'));var jsonpatch=require(_0xe158('0x3'));var rp=require('request-promise');var moment=require(_0xe158('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe158('0x5'));var util=require(_0xe158('0x6'));var path=require(_0xe158('0x7'));var sox=require(_0xe158('0x8'));var csv=require('to-csv');var ejs=require(_0xe158('0x9'));var fs=require('fs');var fs_extra=require(_0xe158('0xa'));var _=require(_0xe158('0xb'));var squel=require(_0xe158('0xc'));var crypto=require(_0xe158('0xd'));var jsforce=require(_0xe158('0xe'));var deskjs=require(_0xe158('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe158('0x10'));var Papa=require(_0xe158('0x11'));var Redis=require('ioredis');var authService=require(_0xe158('0x12'));var qs=require(_0xe158('0x13'));var as=require(_0xe158('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe158('0x15'))(_0xe158('0x16'));var utils=require(_0xe158('0x17'));var config=require(_0xe158('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe158('0x19'))['db'];config[_0xe158('0x1a')]=_[_0xe158('0x1b')](config[_0xe158('0x1a')],{'host':_0xe158('0x1c'),'port':0x18eb});var socket=require(_0xe158('0x1d'))(new Redis(config[_0xe158('0x1a')]));require(_0xe158('0x1e'))[_0xe158('0x1f')](socket);var jayson=require(_0xe158('0x20'));var client=jayson[_0xe158('0x21')][_0xe158('0x22')]({'port':0x232c});function respondWithRpcPromise(_0x5be6c4,_0x5a4fe1,_0x45dbf1,_0x19b895){return new BPromise(function(_0x5001b9,_0x4c6eb7){var _0x59b7c2=_0x19b895||client;return _0x59b7c2['request'](_0x5be6c4,_0x45dbf1)[_0xe158('0x23')](function(_0x2606c7){logger[_0xe158('0x24')]('WhatsappAccount,\x20%s,\x20%s',_0x5a4fe1,'request\x20sent');logger[_0xe158('0x25')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x5a4fe1,_0xe158('0x26'),JSON[_0xe158('0x27')](_0x2606c7));if(_0x2606c7['error']){if(_0x2606c7['error'][_0xe158('0x28')]===0x1f4){logger[_0xe158('0x29')](_0xe158('0x2a'),_0x5a4fe1,_0x2606c7[_0xe158('0x29')][_0xe158('0x2b')]);return _0x4c6eb7(_0x2606c7[_0xe158('0x29')][_0xe158('0x2b')]);}logger['error'](_0xe158('0x2a'),_0x5a4fe1,_0x2606c7['error'][_0xe158('0x2b')]);return _0x5001b9(_0x2606c7['error']['message']);}else{logger[_0xe158('0x24')](_0xe158('0x2a'),_0x5a4fe1,_0xe158('0x26'));_0x5001b9(_0x2606c7[_0xe158('0x2c')]['message']);}})[_0xe158('0x2d')](function(_0x4abd6c){logger[_0xe158('0x29')](_0xe158('0x2a'),_0x5a4fe1,_0x4abd6c);_0x4c6eb7(_0x4abd6c);});});}function respondWithStatusCode(_0xdac043,_0x5dcfc1){_0x5dcfc1=_0x5dcfc1||0xcc;return function(_0x5bcf7c){if(_0x5bcf7c){return _0xdac043['sendStatus'](_0x5dcfc1);}return _0xdac043[_0xe158('0x2e')](_0x5dcfc1)[_0xe158('0x2f')]();};}function respondWithResult(_0x2e2916,_0x33d2f3){_0x33d2f3=_0x33d2f3||0xc8;return function(_0x1a0d64){if(_0x1a0d64){return _0x2e2916[_0xe158('0x2e')](_0x33d2f3)[_0xe158('0x30')](_0x1a0d64);}};}function respondWithFilteredResult(_0x36398b,_0x50b734){return function(_0x3f235d){if(_0x3f235d){var _0x363de5=typeof _0x50b734[_0xe158('0x31')]==='undefined'&&typeof _0x50b734['limit']==='undefined';var _0x4d57dd=_0x3f235d[_0xe158('0x32')];var _0x2d6db6=_0x363de5?0x0:_0x50b734[_0xe158('0x31')];var _0x282ac6=_0x363de5?_0x3f235d['count']:_0x50b734[_0xe158('0x31')]+_0x50b734[_0xe158('0x33')];var _0x584cbc;if(_0x282ac6>=_0x4d57dd){_0x282ac6=_0x4d57dd;_0x584cbc=0xc8;}else{_0x584cbc=0xce;}_0x36398b[_0xe158('0x2e')](_0x584cbc);return _0x36398b[_0xe158('0x34')](_0xe158('0x35'),_0x2d6db6+'-'+_0x282ac6+'/'+_0x4d57dd)[_0xe158('0x30')](_0x3f235d);}return null;};}function patchUpdates(_0x18b729){return function(_0x590b74){try{jsonpatch[_0xe158('0x36')](_0x590b74,_0x18b729,!![]);}catch(_0xc19639){return BPromise[_0xe158('0x37')](_0xc19639);}return _0x590b74[_0xe158('0x38')]();};}function saveUpdates(_0x1f3776,_0x43a6f7){return function(_0x5135e8){if(_0x5135e8){return _0x5135e8['update'](_0x1f3776)[_0xe158('0x23')](function(_0x5031b5){return _0x5031b5;});}return null;};}function removeEntity(_0x28a1a4,_0x4f691e){return function(_0x1adc59){if(_0x1adc59){return _0x1adc59[_0xe158('0x39')]()[_0xe158('0x23')](function(){var _0x19879e=_0x1adc59[_0xe158('0x3a')]({'plain':!![]});var _0x465c95=_0xe158('0x3b');return db[_0xe158('0x3c')][_0xe158('0x39')]({'where':{'type':_0x465c95,'resourceId':_0x19879e['id']}})[_0xe158('0x23')](function(){return _0x1adc59;});})[_0xe158('0x23')](function(){_0x28a1a4[_0xe158('0x2e')](0xcc)[_0xe158('0x2f')]();});}};}function handleEntityNotFound(_0x24e34d,_0x2805e0){return function(_0x347a9b){if(!_0x347a9b){_0x24e34d['sendStatus'](0x194);}return _0x347a9b;};}function handleError(_0x4e918d,_0x3b6bcb){_0x3b6bcb=_0x3b6bcb||0x1f4;return function(_0x31cd62){logger[_0xe158('0x29')](_0x31cd62[_0xe158('0x3d')]);if(_0x31cd62[_0xe158('0x3e')]){delete _0x31cd62[_0xe158('0x3e')];}_0x4e918d[_0xe158('0x2e')](_0x3b6bcb)[_0xe158('0x3f')](_0x31cd62);};}exports['index']=function(_0x269942,_0x38a6fd){var _0x28df67={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x4dce03={},_0x8199be={'count':0x0,'rows':[]};var _0x4a21c0=_[_0xe158('0x40')](db[_0xe158('0x41')][_0xe158('0x42')],function(_0x46a60c){return{'name':_0x46a60c[_0xe158('0x43')],'type':_0x46a60c[_0xe158('0x44')][_0xe158('0x45')]};});_0x4dce03[_0xe158('0x46')]=_[_0xe158('0x40')](_0x4a21c0,_0xe158('0x3e'));_0x4dce03['query']=_[_0xe158('0x47')](_0x269942[_0xe158('0x48')]);_0x4dce03[_0xe158('0x49')]=_['intersection'](_0x4dce03['model'],_0x4dce03['query']);_0x28df67[_0xe158('0x4a')]=_[_0xe158('0x4b')](_0x4dce03[_0xe158('0x46')],qs['fields'](_0x269942[_0xe158('0x48')][_0xe158('0x4c')]));_0x28df67[_0xe158('0x4a')]=_0x28df67['attributes'][_0xe158('0x4d')]?_0x28df67[_0xe158('0x4a')]:_0x4dce03[_0xe158('0x46')];if(!_0x269942[_0xe158('0x48')][_0xe158('0x4e')](_0xe158('0x4f'))){_0x28df67[_0xe158('0x33')]=qs[_0xe158('0x33')](_0x269942[_0xe158('0x48')]['limit']);_0x28df67[_0xe158('0x31')]=qs[_0xe158('0x31')](_0x269942['query'][_0xe158('0x31')]);}_0x28df67[_0xe158('0x50')]=qs[_0xe158('0x51')](_0x269942[_0xe158('0x48')][_0xe158('0x51')]);_0x28df67[_0xe158('0x52')]=qs[_0xe158('0x49')](_[_0xe158('0x53')](_0x269942['query'],_0x4dce03['filters']),_0x4a21c0);if(_0x269942[_0xe158('0x48')]['filter']){_0x28df67[_0xe158('0x52')]=_[_0xe158('0x54')](_0x28df67['where'],{'$or':_[_0xe158('0x40')](_0x4a21c0,function(_0x3a8c7f){if(_0x3a8c7f[_0xe158('0x44')]!==_0xe158('0x55')){var _0x26f368={};_0x26f368[_0x3a8c7f[_0xe158('0x3e')]]={'$like':'%'+_0x269942['query'][_0xe158('0x56')]+'%'};return _0x26f368;}})});}_0x28df67=_[_0xe158('0x54')]({},_0x28df67,_0x269942[_0xe158('0x57')]);var _0x2b8b48={'where':_0x28df67['where']};return db[_0xe158('0x41')]['count'](_0x2b8b48)[_0xe158('0x23')](function(_0x422f36){_0x8199be[_0xe158('0x32')]=_0x422f36;if(_0x269942[_0xe158('0x48')]['includeAll']){_0x28df67['include']=[{'all':!![]}];}return db[_0xe158('0x41')][_0xe158('0x58')](_0x28df67);})[_0xe158('0x23')](function(_0x2d8960){_0x8199be[_0xe158('0x59')]=_0x2d8960;return _0x8199be;})[_0xe158('0x23')](respondWithFilteredResult(_0x38a6fd,_0x28df67))[_0xe158('0x2d')](handleError(_0x38a6fd,null));};exports['show']=function(_0x538e48,_0x265942){var _0x19cbc5={'raw':![],'where':{'id':_0x538e48[_0xe158('0x5a')]['id']},'include':[{'model':db[_0xe158('0x5b')],'as':'mandatoryDispositionPause'}]},_0x1a903e={};_0x1a903e[_0xe158('0x46')]=_[_0xe158('0x47')](db[_0xe158('0x41')][_0xe158('0x42')]);_0x1a903e[_0xe158('0x48')]=_['keys'](_0x538e48[_0xe158('0x48')]);_0x1a903e['filters']=_[_0xe158('0x4b')](_0x1a903e[_0xe158('0x46')],_0x1a903e[_0xe158('0x48')]);_0x19cbc5[_0xe158('0x4a')]=_['intersection'](_0x1a903e['model'],qs[_0xe158('0x4c')](_0x538e48[_0xe158('0x48')][_0xe158('0x4c')]));_0x19cbc5['attributes']=_0x19cbc5[_0xe158('0x4a')][_0xe158('0x4d')]?_0x19cbc5[_0xe158('0x4a')]:_0x1a903e[_0xe158('0x46')];if(_0x538e48[_0xe158('0x48')][_0xe158('0x5c')]){_0x19cbc5[_0xe158('0x5d')]=[{'all':!![]}];}_0x19cbc5=_['merge']({},_0x19cbc5,_0x538e48['options']);return db[_0xe158('0x41')][_0xe158('0x5e')](_0x19cbc5)[_0xe158('0x23')](handleEntityNotFound(_0x265942,null))[_0xe158('0x23')](respondWithResult(_0x265942,null))[_0xe158('0x2d')](handleError(_0x265942,null));};exports[_0xe158('0x5f')]=function(_0xc82b08,_0x18178e){return db[_0xe158('0x41')][_0xe158('0x5f')](_0xc82b08[_0xe158('0x60')],{})[_0xe158('0x23')](function(_0xb1debf){var _0x19bae2=_0xc82b08[_0xe158('0x61')][_0xe158('0x3a')]({'plain':!![]});if(!_0x19bae2)throw new Error(_0xe158('0x62'));if(_0x19bae2[_0xe158('0x63')]===_0xe158('0x61')){var _0x44d13c=_0xb1debf[_0xe158('0x3a')]({'plain':!![]});var _0x26a867=_0xe158('0x3b');return db[_0xe158('0x64')][_0xe158('0x5e')]({'where':{'name':_0x26a867,'userProfileId':_0x19bae2[_0xe158('0x65')]},'raw':!![]})[_0xe158('0x23')](function(_0x4590cc){if(_0x4590cc&&_0x4590cc['autoAssociation']===0x0){return db['UserProfileResource'][_0xe158('0x5f')]({'name':_0x44d13c[_0xe158('0x3e')],'resourceId':_0x44d13c['id'],'type':_0x4590cc[_0xe158('0x3e')],'sectionId':_0x4590cc['id']},{})[_0xe158('0x23')](function(){return _0xb1debf;});}else{return _0xb1debf;}})[_0xe158('0x2d')](function(_0x3a2cbe){logger[_0xe158('0x29')](_0xe158('0x66'),_0x3a2cbe);throw _0x3a2cbe;});}return _0xb1debf;})[_0xe158('0x23')](respondWithResult(_0x18178e,0xc9))[_0xe158('0x2d')](handleError(_0x18178e,null));};exports['update']=function(_0x1fcdc7,_0x302c49){if(_0x1fcdc7[_0xe158('0x60')]['id']){delete _0x1fcdc7['body']['id'];}return db['WhatsappAccount'][_0xe158('0x5e')]({'where':{'id':_0x1fcdc7[_0xe158('0x5a')]['id']},'include':[{'model':db[_0xe158('0x5b')],'as':_0xe158('0x67')}]})['then'](handleEntityNotFound(_0x302c49,null))[_0xe158('0x23')](saveUpdates(_0x1fcdc7[_0xe158('0x60')],null))[_0xe158('0x23')](respondWithResult(_0x302c49,null))[_0xe158('0x2d')](handleError(_0x302c49,null));};exports['destroy']=function(_0x57b804,_0x38b158){return db['WhatsappAccount'][_0xe158('0x5e')]({'where':{'id':_0x57b804[_0xe158('0x5a')]['id']}})[_0xe158('0x23')](handleEntityNotFound(_0x38b158,null))['then'](removeEntity(_0x38b158,null))[_0xe158('0x2d')](handleError(_0x38b158,null));};exports[_0xe158('0x68')]=function(_0x1b4fea,_0x4f519e){return db[_0xe158('0x41')][_0xe158('0x68')]()[_0xe158('0x23')](respondWithResult(_0x4f519e,null))[_0xe158('0x2d')](handleError(_0x4f519e,null));};exports[_0xe158('0x69')]=function(_0x563615,_0x230b28,_0x43edeb){if(_0x563615[_0xe158('0x60')]['id']){delete _0x563615[_0xe158('0x60')]['id'];}return db['WhatsappAccount'][_0xe158('0x5e')]({'where':{'id':_0x563615[_0xe158('0x5a')]['id']}})[_0xe158('0x23')](handleEntityNotFound(_0x230b28,null))[_0xe158('0x23')](function(_0x1c9269){if(_0x1c9269){_0x563615['body'][_0xe158('0x6a')]=_0x1c9269['id'];return db[_0xe158('0x6b')][_0xe158('0x5f')](_0x563615['body']);}})[_0xe158('0x23')](respondWithResult(_0x230b28,null))[_0xe158('0x2d')](handleError(_0x230b28,null));};exports[_0xe158('0x6c')]=function(_0x2e2e4b,_0x50581b,_0x5aea21){var _0x5a5c32={'raw':![],'where':{}};var _0x1779ff={};var _0x237025={'count':0x0,'rows':[]};return db[_0xe158('0x41')][_0xe158('0x6d')]({'where':{'id':_0x2e2e4b[_0xe158('0x5a')]['id']}})[_0xe158('0x23')](handleEntityNotFound(_0x50581b,null))['then'](function(_0x98001d){if(_0x98001d){_0x1779ff[_0xe158('0x46')]=_[_0xe158('0x47')](db[_0xe158('0x6b')]['rawAttributes']);_0x1779ff['query']=_['keys'](_0x2e2e4b['query']);_0x1779ff['filters']=_[_0xe158('0x4b')](_0x1779ff[_0xe158('0x46')],_0x1779ff[_0xe158('0x48')]);_0x5a5c32[_0xe158('0x4a')]=_['intersection'](_0x1779ff['model'],qs[_0xe158('0x4c')](_0x2e2e4b[_0xe158('0x48')][_0xe158('0x4c')]));_0x5a5c32[_0xe158('0x4a')]=_0x5a5c32[_0xe158('0x4a')][_0xe158('0x4d')]?_0x5a5c32[_0xe158('0x4a')]:_0x1779ff[_0xe158('0x46')];if(!_0x2e2e4b[_0xe158('0x48')][_0xe158('0x4e')]('nolimit')){_0x5a5c32[_0xe158('0x33')]=qs['limit'](_0x2e2e4b[_0xe158('0x48')][_0xe158('0x33')]);_0x5a5c32[_0xe158('0x31')]=qs[_0xe158('0x31')](_0x2e2e4b['query'][_0xe158('0x31')]);}_0x5a5c32['order']=qs['sort'](_0x2e2e4b['query'][_0xe158('0x51')]);_0x5a5c32[_0xe158('0x52')]=qs[_0xe158('0x49')](_['pick'](_0x2e2e4b['query'],_0x1779ff[_0xe158('0x49')]));_0x5a5c32['where'][_0xe158('0x6a')]=_0x98001d['id'];if(_0x2e2e4b['query'][_0xe158('0x56')]){_0x5a5c32[_0xe158('0x52')]=_[_0xe158('0x54')](_0x5a5c32['where'],{'$or':_[_0xe158('0x40')](_0x5a5c32[_0xe158('0x4a')],function(_0x5a4002){var _0x59586b={};_0x59586b[_0x5a4002]={'$like':'%'+_0x2e2e4b[_0xe158('0x48')]['filter']+'%'};return _0x59586b;})});}_0x5a5c32=_['merge']({},_0x5a5c32,_0x2e2e4b['options']);return db[_0xe158('0x6b')]['count']({'where':_0x5a5c32[_0xe158('0x52')]})[_0xe158('0x23')](function(_0x370c93){_0x237025['count']=_0x370c93;if(_0x2e2e4b[_0xe158('0x48')][_0xe158('0x5c')]){_0x5a5c32['include']=[{'all':!![]}];}return db[_0xe158('0x6b')][_0xe158('0x58')](_0x5a5c32);})[_0xe158('0x23')](function(_0x490d93){_0x237025[_0xe158('0x59')]=_0x490d93;return _0x237025;});}})[_0xe158('0x23')](respondWithFilteredResult(_0x50581b,_0x5a5c32))[_0xe158('0x2d')](handleError(_0x50581b,null));};exports[_0xe158('0x6e')]=function(_0x172c0c,_0xb25962,_0x5e7158){return db[_0xe158('0x41')]['find']({'where':{'id':_0x172c0c['params']['id']}})['then'](handleEntityNotFound(_0xb25962,null))[_0xe158('0x23')](function(_0xed605f){if(_0xed605f){return _0xed605f[_0xe158('0x6e')](_0x172c0c[_0xe158('0x48')][_0xe158('0x6f')]);}})[_0xe158('0x23')](respondWithStatusCode(_0xb25962,null))[_0xe158('0x2d')](handleError(_0xb25962,null));};exports[_0xe158('0x70')]=function(_0x550544,_0x139b57,_0x22e846){if(_0x550544['body']['id']){delete _0x550544[_0xe158('0x60')]['id'];}return db[_0xe158('0x41')][_0xe158('0x5e')]({'where':{'id':_0x550544[_0xe158('0x5a')]['id']}})[_0xe158('0x23')](handleEntityNotFound(_0x139b57,null))[_0xe158('0x23')](function(_0x399924){if(_0x399924){_0x550544[_0xe158('0x60')][_0xe158('0x6a')]=_0x399924['id'];return db[_0xe158('0x71')]['create'](_0x550544[_0xe158('0x60')]);}})[_0xe158('0x23')](respondWithResult(_0x139b57,null))['catch'](handleError(_0x139b57,null));};exports[_0xe158('0x72')]=function(_0x2eb316,_0xfd74f0,_0x4c59cb){var _0x217472={'raw':![],'where':{}};var _0xb9b681={};var _0x3559b5={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xe158('0x6d')]({'where':{'id':_0x2eb316[_0xe158('0x5a')]['id']}})['then'](handleEntityNotFound(_0xfd74f0,null))['then'](function(_0x498c80){if(_0x498c80){_0xb9b681['model']=_['keys'](db[_0xe158('0x71')][_0xe158('0x42')]);_0xb9b681[_0xe158('0x48')]=_[_0xe158('0x47')](_0x2eb316[_0xe158('0x48')]);_0xb9b681[_0xe158('0x49')]=_[_0xe158('0x4b')](_0xb9b681[_0xe158('0x46')],_0xb9b681[_0xe158('0x48')]);_0x217472[_0xe158('0x4a')]=_[_0xe158('0x4b')](_0xb9b681[_0xe158('0x46')],qs[_0xe158('0x4c')](_0x2eb316[_0xe158('0x48')][_0xe158('0x4c')]));_0x217472[_0xe158('0x4a')]=_0x217472[_0xe158('0x4a')][_0xe158('0x4d')]?_0x217472[_0xe158('0x4a')]:_0xb9b681[_0xe158('0x46')];if(!_0x2eb316[_0xe158('0x48')][_0xe158('0x4e')](_0xe158('0x4f'))){_0x217472['limit']=qs[_0xe158('0x33')](_0x2eb316[_0xe158('0x48')][_0xe158('0x33')]);_0x217472[_0xe158('0x31')]=qs[_0xe158('0x31')](_0x2eb316['query'][_0xe158('0x31')]);}_0x217472[_0xe158('0x50')]=qs[_0xe158('0x51')](_0x2eb316['query'][_0xe158('0x51')]);_0x217472['where']=qs[_0xe158('0x49')](_[_0xe158('0x53')](_0x2eb316['query'],_0xb9b681['filters']));_0x217472[_0xe158('0x52')][_0xe158('0x6a')]=_0x498c80['id'];if(_0x2eb316[_0xe158('0x48')]['filter']){_0x217472[_0xe158('0x52')]=_[_0xe158('0x54')](_0x217472[_0xe158('0x52')],{'$or':_[_0xe158('0x40')](_0x217472[_0xe158('0x4a')],function(_0x5f5843){var _0x1bad78={};_0x1bad78[_0x5f5843]={'$like':'%'+_0x2eb316['query'][_0xe158('0x56')]+'%'};return _0x1bad78;})});}_0x217472=_[_0xe158('0x54')]({},_0x217472,_0x2eb316[_0xe158('0x57')]);return db[_0xe158('0x71')][_0xe158('0x32')]({'where':_0x217472['where']})['then'](function(_0x921dbf){_0x3559b5[_0xe158('0x32')]=_0x921dbf;if(_0x2eb316[_0xe158('0x48')]['includeAll']){_0x217472['include']=[{'all':!![]}];}return db[_0xe158('0x71')]['findAll'](_0x217472);})[_0xe158('0x23')](function(_0x480975){_0x3559b5[_0xe158('0x59')]=_0x480975;return _0x3559b5;});}})['then'](respondWithFilteredResult(_0xfd74f0,_0x217472))[_0xe158('0x2d')](handleError(_0xfd74f0,null));};exports[_0xe158('0x73')]=function(_0x134f16,_0xb6bbcd,_0x350660){return db[_0xe158('0x41')][_0xe158('0x5e')]({'where':{'id':_0x134f16[_0xe158('0x5a')]['id']}})[_0xe158('0x23')](handleEntityNotFound(_0xb6bbcd,null))['then'](function(_0x2b4bb8){if(_0x2b4bb8){return _0x2b4bb8[_0xe158('0x73')](_0x134f16[_0xe158('0x48')][_0xe158('0x6f')]);}})[_0xe158('0x23')](respondWithStatusCode(_0xb6bbcd,null))[_0xe158('0x2d')](handleError(_0xb6bbcd,null));};exports[_0xe158('0x74')]=function(_0x5c2772,_0x4f8d4d,_0x6d13ae){return db[_0xe158('0x41')]['find']({'where':{'id':_0x5c2772[_0xe158('0x5a')]['id']}})[_0xe158('0x23')](handleEntityNotFound(_0x4f8d4d,null))['then'](function(_0xcf1b98){if(_0xcf1b98){return _0xcf1b98[_0xe158('0x74')](_0x5c2772['body']['ids'],_['omit'](_0x5c2772[_0xe158('0x60')],[_0xe158('0x6f'),'id'])||{})['spread'](function(_0x2679cb){for(var _0x46d8e9=0x0;_0x46d8e9<_0x5c2772[_0xe158('0x60')][_0xe158('0x6f')][_0xe158('0x4d')];_0x46d8e9+=0x1){socket[_0xe158('0x75')](_0xe158('0x76'),{'UserId':Number(_0x5c2772['body'][_0xe158('0x6f')][_0x46d8e9]),'WhatsappAccountId':Number(_0x5c2772[_0xe158('0x5a')]['id'])});}return _0x2679cb;});}})['then'](respondWithResult(_0x4f8d4d,null))[_0xe158('0x2d')](handleError(_0x4f8d4d,null));};exports[_0xe158('0x77')]=function(_0xc5ed8a,_0x421880,_0x1438b5){return db[_0xe158('0x41')][_0xe158('0x5e')]({'where':{'id':_0xc5ed8a[_0xe158('0x5a')]['id']}})['then'](handleEntityNotFound(_0x421880,null))['then'](function(_0x10c251){if(_0x10c251){return _0x10c251[_0xe158('0x77')](_0xc5ed8a['query'][_0xe158('0x6f')])[_0xe158('0x23')](function(){if(_['isArray'](_0xc5ed8a[_0xe158('0x48')][_0xe158('0x6f')])){for(var _0x3c9e5d=0x0;_0x3c9e5d<_0xc5ed8a['query'][_0xe158('0x6f')][_0xe158('0x4d')];_0x3c9e5d+=0x1){socket[_0xe158('0x75')](_0xe158('0x78'),{'UserId':Number(_0xc5ed8a[_0xe158('0x48')][_0xe158('0x6f')][_0x3c9e5d]),'WhatsappAccountId':Number(_0xc5ed8a[_0xe158('0x5a')]['id'])});}}else{socket[_0xe158('0x75')]('userWhatsappAccount:remove',{'UserId':Number(_0xc5ed8a[_0xe158('0x48')]['ids']),'WhatsappAccountId':Number(_0xc5ed8a[_0xe158('0x5a')]['id'])});}});}})[_0xe158('0x23')](respondWithStatusCode(_0x421880,null))[_0xe158('0x2d')](handleError(_0x421880,null));};exports[_0xe158('0x79')]=function(_0x16971e,_0x3d7b48,_0x543ca7){var _0x5510b0={};var _0x35f9e8={};var _0x155980;var _0x5f26ca;return db[_0xe158('0x41')][_0xe158('0x6d')]({'where':{'id':_0x16971e[_0xe158('0x5a')]['id']}})[_0xe158('0x23')](handleEntityNotFound(_0x3d7b48,null))[_0xe158('0x23')](function(_0x82e163){if(_0x82e163){_0x155980=_0x82e163;_0x35f9e8['model']=_['keys'](db['User']['rawAttributes']);_0x35f9e8[_0xe158('0x48')]=_['keys'](_0x16971e[_0xe158('0x48')]);_0x35f9e8[_0xe158('0x49')]=_[_0xe158('0x4b')](_0x35f9e8[_0xe158('0x46')],_0x35f9e8[_0xe158('0x48')]);_0x5510b0[_0xe158('0x4a')]=_[_0xe158('0x4b')](_0x35f9e8[_0xe158('0x46')],qs['fields'](_0x16971e[_0xe158('0x48')][_0xe158('0x4c')]));_0x5510b0[_0xe158('0x4a')]=_0x5510b0['attributes'][_0xe158('0x4d')]?_0x5510b0[_0xe158('0x4a')]:_0x35f9e8[_0xe158('0x46')];_0x5510b0[_0xe158('0x50')]=qs[_0xe158('0x51')](_0x16971e[_0xe158('0x48')][_0xe158('0x51')]);_0x5510b0[_0xe158('0x52')]=qs[_0xe158('0x49')](_[_0xe158('0x53')](_0x16971e[_0xe158('0x48')],_0x35f9e8[_0xe158('0x49')]));if(_0x16971e[_0xe158('0x48')][_0xe158('0x56')]){_0x5510b0[_0xe158('0x52')]=_[_0xe158('0x54')](_0x5510b0[_0xe158('0x52')],{'$or':_[_0xe158('0x40')](_0x5510b0[_0xe158('0x4a')],function(_0x2f5638){var _0x2cb46a={};_0x2cb46a[_0x2f5638]={'$like':'%'+_0x16971e[_0xe158('0x48')][_0xe158('0x56')]+'%'};return _0x2cb46a;})});}_0x5510b0=_['merge']({},_0x5510b0,_0x16971e['options']);return _0x155980[_0xe158('0x79')](_0x5510b0);}})[_0xe158('0x23')](function(_0x156a47){if(_0x156a47){_0x5f26ca=_0x156a47[_0xe158('0x4d')];if(!_0x16971e[_0xe158('0x48')][_0xe158('0x4e')](_0xe158('0x4f'))){_0x5510b0[_0xe158('0x33')]=qs[_0xe158('0x33')](_0x16971e[_0xe158('0x48')][_0xe158('0x33')]);_0x5510b0[_0xe158('0x31')]=qs[_0xe158('0x31')](_0x16971e[_0xe158('0x48')][_0xe158('0x31')]);}return _0x155980[_0xe158('0x79')](_0x5510b0);}})[_0xe158('0x23')](function(_0x168352){if(_0x168352){return _0x168352?{'count':_0x5f26ca,'rows':_0x168352}:null;}})[_0xe158('0x23')](respondWithResult(_0x3d7b48,null))[_0xe158('0x2d')](handleError(_0x3d7b48,null));};exports[_0xe158('0x7a')]=function(_0x1d61af,_0x3aa063,_0x11e57c){return db[_0xe158('0x41')][_0xe158('0x6d')]({'where':{'id':_0x1d61af[_0xe158('0x5a')]['id']}})[_0xe158('0x23')](handleEntityNotFound(_0x3aa063,null))[_0xe158('0x23')](function(_0x594bca){if(_0x594bca){return db[_0xe158('0x7b')][_0xe158('0x7c')](function(_0x1ca527){return db[_0xe158('0x7d')][_0xe158('0x39')]({'where':{'WhatsappAccountId':_0x1d61af[_0xe158('0x5a')]['id']},'transaction':_0x1ca527})[_0xe158('0x23')](function(_0x148d8a){var _0x2f880f=_[_0xe158('0x40')](_0x1d61af[_0xe158('0x60')],function(_0x52cb48){_0x52cb48[_0xe158('0x6a')]=_0x1d61af[_0xe158('0x5a')]['id'];return _0x52cb48;});return db[_0xe158('0x7d')][_0xe158('0x7e')](_0x2f880f,{'transaction':_0x1ca527});});})['then'](function(){return db[_0xe158('0x7d')][_0xe158('0x7f')]({'where':{'WhatsappAccountId':_0x1d61af[_0xe158('0x5a')]['id']},'order':_0xe158('0x80')});});}})[_0xe158('0x23')](respondWithResult(_0x3aa063,null))['catch'](handleError(_0x3aa063,null));};exports['getApplications']=function(_0x3f0d41,_0xb02da2,_0xf6522c){var _0x1b53fa={};var _0x5cc331={};var _0x1c10d7;var _0x1eab9f;return db[_0xe158('0x41')][_0xe158('0x6d')]({'where':{'id':_0x3f0d41[_0xe158('0x5a')]['id']}})[_0xe158('0x23')](handleEntityNotFound(_0xb02da2,null))[_0xe158('0x23')](function(_0x4b7fa9){if(_0x4b7fa9){_0x1c10d7=_0x4b7fa9;_0x5cc331[_0xe158('0x46')]=_[_0xe158('0x47')](db[_0xe158('0x7d')][_0xe158('0x42')]);_0x5cc331[_0xe158('0x48')]=_[_0xe158('0x47')](_0x3f0d41[_0xe158('0x48')]);_0x5cc331[_0xe158('0x49')]=_[_0xe158('0x4b')](_0x5cc331[_0xe158('0x46')],_0x5cc331[_0xe158('0x48')]);_0x1b53fa[_0xe158('0x4a')]=_['intersection'](_0x5cc331['model'],qs[_0xe158('0x4c')](_0x3f0d41[_0xe158('0x48')][_0xe158('0x4c')]));_0x1b53fa['attributes']=_0x1b53fa['attributes'][_0xe158('0x4d')]?_0x1b53fa['attributes']:_0x5cc331[_0xe158('0x46')];_0x1b53fa['order']=qs[_0xe158('0x51')](_0x3f0d41[_0xe158('0x48')][_0xe158('0x51')]);_0x1b53fa[_0xe158('0x52')]=qs['filters'](_['pick'](_0x3f0d41[_0xe158('0x48')],_0x5cc331[_0xe158('0x49')]));if(_0x3f0d41[_0xe158('0x48')][_0xe158('0x56')]){_0x1b53fa[_0xe158('0x52')]=_[_0xe158('0x54')](_0x1b53fa['where'],{'$or':_[_0xe158('0x40')](_0x1b53fa[_0xe158('0x4a')],function(_0x5aaee4){var _0x200ec0={};_0x200ec0[_0x5aaee4]={'$like':'%'+_0x3f0d41[_0xe158('0x48')]['filter']+'%'};return _0x200ec0;})});}_0x1b53fa=_[_0xe158('0x54')]({},_0x1b53fa,_0x3f0d41[_0xe158('0x57')]);return _0x1c10d7[_0xe158('0x81')](_0x1b53fa);}})[_0xe158('0x23')](function(_0x5fc3f8){if(_0x5fc3f8){_0x1eab9f=_0x5fc3f8['length'];if(!_0x3f0d41[_0xe158('0x48')]['hasOwnProperty'](_0xe158('0x4f'))){_0x1b53fa['limit']=qs[_0xe158('0x33')](_0x3f0d41[_0xe158('0x48')][_0xe158('0x33')]);_0x1b53fa['offset']=qs[_0xe158('0x31')](_0x3f0d41['query'][_0xe158('0x31')]);}return _0x1c10d7[_0xe158('0x81')](_0x1b53fa);}})[_0xe158('0x23')](function(_0x14732b){if(_0x14732b){return _0x14732b?{'count':_0x1eab9f,'rows':_0x14732b}:null;}})[_0xe158('0x23')](respondWithResult(_0xb02da2,null))['catch'](handleError(_0xb02da2,null));};exports[_0xe158('0x82')]=function(_0x2ee95a,_0x3fad2b,_0x190659){var _0x12f982={'channel':_0xe158('0x83')};var _0x2905c7=[];var _0x4beaa7=[];var _0xefd293={};return db[_0xe158('0x41')][_0xe158('0x5e')]({'where':{'id':_0x2ee95a[_0xe158('0x5a')]['id']},'include':[{'model':db[_0xe158('0x7d')],'as':'Applications'}]})['then'](handleEntityNotFound(_0x3fad2b,null))[_0xe158('0x23')](function(_0x34965c){_0x12f982[_0xe158('0x84')]=_0x34965c;_0x12f982[_0xe158('0x85')]=_[_0xe158('0x86')](_0x34965c[_0xe158('0x87')],[_0xe158('0x80')],['asc']);if(_0x12f982['account']['Applications']){delete _0x12f982[_0xe158('0x84')][_0xe158('0x87')];}return db[_0xe158('0x88')][_0xe158('0x68')]();})[_0xe158('0x23')](function(_0x4a3155){if(!_0x4a3155){throw new db['Sequelize'][(_0xe158('0x89'))](_0xe158('0x8a'));}_0x2905c7=_[_0xe158('0x8b')](_[_0xe158('0x47')](_0x4a3155),[_0xe158('0x8c'),'updatedAt']);_0x4beaa7=_[_0xe158('0x8b')](_[_0xe158('0x47')](_0x4a3155),[_0xe158('0x8c'),_0xe158('0x8d'),'CompanyId','ListId']);_0x12f982['body']={'mapKey':'mobile'};if(_0x12f982['account'][_0xe158('0x44')]&&_0x12f982['account'][_0xe158('0x44')]===_0xe158('0x8e')){_0x12f982[_0xe158('0x60')][_0xe158('0x8f')]=_0x2ee95a['body']['From'][_0xe158('0x90')]('whatsapp:','');_0x12f982[_0xe158('0x60')]['body']=_0x2ee95a[_0xe158('0x60')][_0xe158('0x91')];_0x12f982[_0xe158('0x60')][_0xe158('0x92')]=_0x2ee95a[_0xe158('0x60')][_0xe158('0x93')];}if(_0x12f982[_0xe158('0x60')]['id']){delete _0x12f982['body']['id'];}if(_['isNil'](_0x12f982[_0xe158('0x60')][_0xe158('0x8f')])){throw new db[(_0xe158('0x94'))][(_0xe158('0x89'))]('from\x20is\x20mandatory');}if(_[_0xe158('0x95')](_0x12f982[_0xe158('0x60')][_0xe158('0x60')])||_0x12f982[_0xe158('0x60')]['body']===''){throw new db[(_0xe158('0x94'))][(_0xe158('0x89'))](_0xe158('0x96'));}if(_[_0xe158('0x95')](_0x12f982[_0xe158('0x60')][_0xe158('0x97')])){throw new db[(_0xe158('0x94'))][(_0xe158('0x89'))](_0xe158('0x98')+_0x4beaa7);}if(!_[_0xe158('0x99')](_0x4beaa7,_0x12f982[_0xe158('0x60')][_0xe158('0x97')])){throw new db['Sequelize'][(_0xe158('0x89'))](_0xe158('0x9a')+_0x4beaa7);}_0xefd293[_0x12f982[_0xe158('0x60')][_0xe158('0x97')]]=_0x12f982['body'][_0xe158('0x8f')];return db[_0xe158('0x9b')][_0xe158('0x5e')]({'where':{'id':_0x12f982[_0xe158('0x84')][_0xe158('0x9c')]},'include':[{'model':db[_0xe158('0x88')],'as':'Contacts','where':_0xefd293,'limit':0x1,'order':[['updatedAt',_0xe158('0x9d')]]}]});})[_0xe158('0x23')](handleEntityNotFound(_0x3fad2b,null))['then'](function(_0x45f21f){if(_0x45f21f){_0x12f982[_0xe158('0x9e')]=_[_0xe158('0x9f')](_0x45f21f,[_0xe158('0xa0')]);if(_0x45f21f[_0xe158('0xa0')][_0xe158('0x4d')]){return _0x45f21f[_0xe158('0xa0')][0x0];}var _0x3c7dc3=_[_0xe158('0x1b')](_0x12f982[_0xe158('0x60')],{'firstName':_0x12f982['body']['from'],'ListId':_0x45f21f['id']});_0x3c7dc3[_0x12f982[_0xe158('0x60')][_0xe158('0x97')]]=_0x12f982[_0xe158('0x60')][_0xe158('0x8f')];return db['CmContact'][_0xe158('0x5f')](_0x3c7dc3,{'fields':_0x2905c7,'raw':!![]});}})[_0xe158('0x23')](handleEntityNotFound(_0x3fad2b,null))[_0xe158('0x23')](function(_0x21e947){if(_0x21e947){_0x12f982['contact']=_0x21e947;var _0x1042d1={'ContactId':_0x21e947['id'],'phone':_0x12f982[_0xe158('0x60')][_0xe158('0x8f')],'WhatsappAccountId':_0x2ee95a[_0xe158('0x5a')]['id']};var _0x5d4fda={'ContactId':_0x21e947['id'],'WhatsappAccountId':_0x2ee95a['params']['id'],'closed':![]};return db[_0xe158('0xa1')][_0xe158('0x5e')]({'where':_0x5d4fda})[_0xe158('0x23')](function(_0x434aa1){if(_0x434aa1){return[_0x434aa1,![]];}return db[_0xe158('0xa1')][_0xe158('0x5f')](_0x1042d1)[_0xe158('0x23')](function(_0x43d5ed){return[_0x43d5ed,!![]];});});}})['spread'](function(_0x143616,_0x1fd6d0){_0x12f982[_0xe158('0xa2')]=_0x143616[_0xe158('0x3a')]({'plain':!![]});_0x12f982[_0xe158('0xa2')][_0xe158('0xa3')]=![];if(_0x1fd6d0){if(_0x12f982['account'][_0xe158('0xa4')]){_0x12f982['applications'][_0xe158('0xa5')]({'id':0x0,'priority':_0x12f982[_0xe158('0x85')]['length']+0x1,'app':_0xe158('0xa6'),'appdata':_0xe158('0xa7'),'interval':_0xe158('0xa8')});}_0x12f982[_0xe158('0xa2')][_0xe158('0xa3')]=!![];}return db['WhatsappMessage'][_0xe158('0x5f')]({'phone':_0x12f982[_0xe158('0x60')][_0xe158('0x8f')],'messageId':_0x12f982[_0xe158('0x60')][_0xe158('0x92')],'body':_0x12f982[_0xe158('0x60')]['body'],'WhatsappAccountId':_0x2ee95a[_0xe158('0x5a')]['id'],'WhatsappInteractionId':_0x143616['id'],'direction':'in','ContactId':_0x143616['ContactId'],'AttachmentId':_0x12f982[_0xe158('0x60')][_0xe158('0xa9')]});})[_0xe158('0x23')](function(_0x37a64e){_0x12f982['message']=_0x37a64e;if(_0x12f982[_0xe158('0xa2')][_0xe158('0xaa')]){return db[_0xe158('0xab')][_0xe158('0x5e')]({'attributes':['id','name'],'where':{'id':_0x12f982[_0xe158('0xa2')]['UserId']}})[_0xe158('0x23')](function(_0x261933){if(_0x261933){_0x12f982[_0xe158('0x85')]['unshift']({'id':0x0,'priority':0x0,'app':_0xe158('0xac'),'appdata':_0x261933[_0xe158('0x3e')]+','+(_0x12f982[_0xe158('0x84')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xe158('0xad'),_0xe158('0xae'),_0x12f982);});}return respondWithRpcPromise(_0xe158('0xad'),_0xe158('0xae'),_0x12f982);})[_0xe158('0x23')](function(_0xbe4cfa){if(_0xbe4cfa){var _0x1cbaad=0xc8;var _0x1dad1c='receiveMessage';logger[_0xe158('0x24')](_0xe158('0xaf'),_0x1dad1c,_0x1cbaad,'entity\x20found');logger['debug'](_0xe158('0xb0'),_0x1dad1c,_0x1cbaad,_0xe158('0xb1'),JSON[_0xe158('0x27')](_0xbe4cfa));if(_0x12f982[_0xe158('0x84')][_0xe158('0x44')]===_0xe158('0x8e')){return _0x3fad2b['status'](_0x1cbaad)[_0xe158('0x34')](_0xe158('0xb2'),_0xe158('0xb3'))[_0xe158('0x3f')](_0xe158('0xb4'));}else{return _0x3fad2b[_0xe158('0x2e')](_0x1cbaad)[_0xe158('0x30')](_0xbe4cfa);}}})['catch'](handleError(_0x3fad2b,null));};exports[_0xe158('0x3f')]=function(_0x5b852c,_0x52ad98,_0x322fb9){var _0x1f121d,_0x655cc8,_0x29194d;if(_[_0xe158('0x95')](_0x5b852c['body'][_0xe158('0x60')])||_0x5b852c['body'][_0xe158('0x60')]===''){throw new db[(_0xe158('0x94'))][(_0xe158('0x89'))](_0xe158('0x96'));}if(_[_0xe158('0x95')](_0x5b852c['body']['to'])){throw new db[(_0xe158('0x94'))][(_0xe158('0x89'))]('to\x20is\x20mandatory');}_0x1f121d=_0x5b852c[_0xe158('0x60')]['to'];return db['WhatsappAccount'][_0xe158('0x5e')]({'where':{'id':_0x5b852c['params']['id']},'include':[{'model':db[_0xe158('0x9b')],'as':'List','include':[{'model':db[_0xe158('0x88')],'as':_0xe158('0xa0'),'where':{'mobile':_0x1f121d},'limit':0x1,'order':[[_0xe158('0x8d'),_0xe158('0x9d')]]}]}]})[_0xe158('0x23')](handleEntityNotFound(_0x52ad98,null))[_0xe158('0x23')](function(_0x3fb442){if(_0x3fb442&&_0x3fb442[_0xe158('0xb5')]){_0x655cc8=_0x3fb442['get']({'plain':!![]});if(_0x655cc8[_0xe158('0xb5')]&&_0x655cc8['List']['Contacts'][_0xe158('0x4d')]){return _0x655cc8['List']['Contacts'][0x0];}return db[_0xe158('0x88')][_0xe158('0x5f')](_['defaults'](_0x5b852c[_0xe158('0x60')],{'firstName':_0x1f121d,'mobile':_0x1f121d,'phone':_0x1f121d,'ListId':_0x655cc8[_0xe158('0x9c')]}));}})[_0xe158('0x23')](handleEntityNotFound(_0x52ad98,null))['then'](function(_0x3f1908){if(_0x3f1908){_0x29194d=_0x3f1908;return db['WhatsappInteraction'][_0xe158('0x5e')]({'where':{'ContactId':_0x29194d['id'],'closed':![],'WhatsappAccountId':_0x655cc8['id']}})['then'](function(_0x2623a8){if(_0x2623a8){return[_0x2623a8,![]];}return db[_0xe158('0xa1')][_0xe158('0x5f')]({'UserId':_0x5b852c[_0xe158('0x61')]['id'],'ContactId':_0x29194d['id'],'WhatsappAccountId':_0x655cc8['id'],'phone':_0x1f121d,'firstMsgDirection':_0xe158('0xb6'),'Messages':[_[_0xe158('0x54')](_0x5b852c[_0xe158('0x60')],{'read':![],'body':_0x5b852c[_0xe158('0x60')][_0xe158('0x60')],'phone':_0x1f121d,'WhatsappAccountId':_0x655cc8['id'],'UserId':_0x5b852c[_0xe158('0x61')]['id'],'ContactId':_0x29194d['id']})]},{'include':[{'model':db[_0xe158('0xb7')],'as':_0xe158('0xb8')}]})[_0xe158('0x23')](function(_0x2894a0){return[_0x2894a0,!![]];});});}})[_0xe158('0xb9')](function(_0x3b57a7,_0xbe5ec1){if(_0xbe5ec1){return _0x3b57a7;}return db['WhatsappMessage'][_0xe158('0x5f')](_['merge'](_0x5b852c[_0xe158('0x60')],{'read':![],'body':_0x5b852c['body']['body'],'phone':_0x1f121d,'WhatsappAccountId':_0x655cc8['id'],'WhatsappInteractionId':_0x3b57a7['id'],'UserId':_0x5b852c[_0xe158('0x61')]['id'],'ContactId':_0x29194d['id']}))[_0xe158('0x23')](function(_0x48119d){_0x3b57a7[_0xe158('0xba')]['Messages']=[];_0x3b57a7[_0xe158('0xba')][_0xe158('0xb8')][_0xe158('0xa5')](_0x48119d['dataValues']);return _0x3b57a7;});})['then'](respondWithResult(_0x52ad98,null))[_0xe158('0x2d')](handleError(_0x52ad98,null));}; \ No newline at end of file +var _0xae35=['redis','defaults','localhost','socket.io-emitter','register','jayson/promise','http','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','index','map','rawAttributes','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','WhatsappAccount','includeAll','findAll','rows','show','params','Pause','mandatoryDispositionPause','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','findOne','WhatsappAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','include','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','userWhatsappAccount:remove','getAgents','User','addApplications','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','notify','whatsapp','account','orderBy','Applications','asc','CmContact','ValidationError','no\x20available\x20attributes','createdAt','difference','updatedAt','CompanyId','ListId','type','twilio','from','From','replace','whatsapp:','MessageSid','isNil','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','CmList','DESC','list','Contacts','contact','WhatsappInteraction','interaction','autoclose','push','close','unmanaged','*,*,*,*','WhatsappMessage','messageId','ContactId','AttachmentId','UserId','applications','unshift','agent','waitForTheAssignedAgent','startRouting','Start','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','send','to\x20is\x20mandatory','List','out','Messages','dataValues','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/license/util','../../mysqldb'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0xae35,0xa7));var _0x5ae3=function(_0x4cff4f,_0xc60b75){_0x4cff4f=_0x4cff4f-0x0;var _0x4a392c=_0xae35[_0x4cff4f];return _0x4a392c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5ae3('0x0'));var jsonpatch=require(_0x5ae3('0x1'));var rp=require('request-promise');var moment=require(_0x5ae3('0x2'));var BPromise=require(_0x5ae3('0x3'));var Mustache=require(_0x5ae3('0x4'));var util=require(_0x5ae3('0x5'));var path=require(_0x5ae3('0x6'));var sox=require(_0x5ae3('0x7'));var csv=require(_0x5ae3('0x8'));var ejs=require(_0x5ae3('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5ae3('0xa'));var squel=require('squel');var crypto=require(_0x5ae3('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5ae3('0x8'));var querystring=require(_0x5ae3('0xc'));var Papa=require(_0x5ae3('0xd'));var Redis=require(_0x5ae3('0xe'));var authService=require(_0x5ae3('0xf'));var qs=require(_0x5ae3('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5ae3('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5ae3('0x12'));var db=require(_0x5ae3('0x13'))['db'];config[_0x5ae3('0x14')]=_[_0x5ae3('0x15')](config['redis'],{'host':_0x5ae3('0x16'),'port':0x18eb});var socket=require(_0x5ae3('0x17'))(new Redis(config['redis']));require('./whatsappAccount.socket')[_0x5ae3('0x18')](socket);var jayson=require(_0x5ae3('0x19'));var client=jayson['client'][_0x5ae3('0x1a')]({'port':0x232c});function respondWithRpcPromise(_0x15fd2c,_0x464859,_0x3ebbd0,_0x1cf609){return new BPromise(function(_0x800076,_0x4265be){var _0xb85a94=_0x1cf609||client;return _0xb85a94['request'](_0x15fd2c,_0x3ebbd0)['then'](function(_0x4cd283){logger[_0x5ae3('0x1b')](_0x5ae3('0x1c'),_0x464859,_0x5ae3('0x1d'));logger[_0x5ae3('0x1e')](_0x5ae3('0x1f'),_0x464859,_0x5ae3('0x1d'),JSON[_0x5ae3('0x20')](_0x4cd283));if(_0x4cd283[_0x5ae3('0x21')]){if(_0x4cd283[_0x5ae3('0x21')]['code']===0x1f4){logger[_0x5ae3('0x21')](_0x5ae3('0x1c'),_0x464859,_0x4cd283[_0x5ae3('0x21')][_0x5ae3('0x22')]);return _0x4265be(_0x4cd283[_0x5ae3('0x21')]['message']);}logger['error'](_0x5ae3('0x1c'),_0x464859,_0x4cd283['error'][_0x5ae3('0x22')]);return _0x800076(_0x4cd283[_0x5ae3('0x21')][_0x5ae3('0x22')]);}else{logger[_0x5ae3('0x1b')]('WhatsappAccount,\x20%s,\x20%s',_0x464859,'request\x20sent');_0x800076(_0x4cd283[_0x5ae3('0x23')][_0x5ae3('0x22')]);}})[_0x5ae3('0x24')](function(_0x1196d4){logger['error'](_0x5ae3('0x1c'),_0x464859,_0x1196d4);_0x4265be(_0x1196d4);});});}function respondWithStatusCode(_0x845c6,_0x59e4d6){_0x59e4d6=_0x59e4d6||0xcc;return function(_0x4b92c4){if(_0x4b92c4){return _0x845c6[_0x5ae3('0x25')](_0x59e4d6);}return _0x845c6[_0x5ae3('0x26')](_0x59e4d6)[_0x5ae3('0x27')]();};}function respondWithResult(_0x47584b,_0x41b0a1){_0x41b0a1=_0x41b0a1||0xc8;return function(_0x307fde){if(_0x307fde){return _0x47584b[_0x5ae3('0x26')](_0x41b0a1)[_0x5ae3('0x28')](_0x307fde);}};}function respondWithFilteredResult(_0x1b5916,_0x287041){return function(_0x193a7f){if(_0x193a7f){var _0xdfe7f8=typeof _0x287041[_0x5ae3('0x29')]===_0x5ae3('0x2a')&&typeof _0x287041['limit']===_0x5ae3('0x2a');var _0x84a44b=_0x193a7f[_0x5ae3('0x2b')];var _0x179fc0=_0xdfe7f8?0x0:_0x287041[_0x5ae3('0x29')];var _0x1817c8=_0xdfe7f8?_0x193a7f['count']:_0x287041[_0x5ae3('0x29')]+_0x287041[_0x5ae3('0x2c')];var _0x6eaff8;if(_0x1817c8>=_0x84a44b){_0x1817c8=_0x84a44b;_0x6eaff8=0xc8;}else{_0x6eaff8=0xce;}_0x1b5916[_0x5ae3('0x26')](_0x6eaff8);return _0x1b5916[_0x5ae3('0x2d')](_0x5ae3('0x2e'),_0x179fc0+'-'+_0x1817c8+'/'+_0x84a44b)[_0x5ae3('0x28')](_0x193a7f);}return null;};}function patchUpdates(_0x3de2ec){return function(_0x4e9b80){try{jsonpatch['apply'](_0x4e9b80,_0x3de2ec,!![]);}catch(_0xbd8ffa){return BPromise[_0x5ae3('0x2f')](_0xbd8ffa);}return _0x4e9b80[_0x5ae3('0x30')]();};}function saveUpdates(_0x10a1e5,_0x4ca1e3){return function(_0x428553){if(_0x428553){return _0x428553[_0x5ae3('0x31')](_0x10a1e5)[_0x5ae3('0x32')](function(_0x64b255){return _0x64b255;});}return null;};}function removeEntity(_0xc047c5,_0x69ea82){return function(_0x43ba52){if(_0x43ba52){return _0x43ba52[_0x5ae3('0x33')]()['then'](function(){var _0x360a19=_0x43ba52[_0x5ae3('0x34')]({'plain':!![]});var _0x3b69b5=_0x5ae3('0x35');return db[_0x5ae3('0x36')][_0x5ae3('0x33')]({'where':{'type':_0x3b69b5,'resourceId':_0x360a19['id']}})[_0x5ae3('0x32')](function(){return _0x43ba52;});})[_0x5ae3('0x32')](function(){_0xc047c5[_0x5ae3('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18f38c,_0x47502a){return function(_0x396a1e){if(!_0x396a1e){_0x18f38c[_0x5ae3('0x25')](0x194);}return _0x396a1e;};}function handleError(_0x5cb827,_0xece9f5){_0xece9f5=_0xece9f5||0x1f4;return function(_0x2c7049){logger['error'](_0x2c7049[_0x5ae3('0x37')]);if(_0x2c7049[_0x5ae3('0x38')]){delete _0x2c7049[_0x5ae3('0x38')];}_0x5cb827[_0x5ae3('0x26')](_0xece9f5)['send'](_0x2c7049);};}exports[_0x5ae3('0x39')]=function(_0x5cc1ba,_0x2b3920){var _0x3c9ace={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x4957a3={},_0x100258={'count':0x0,'rows':[]};var _0x365af2=_[_0x5ae3('0x3a')](db['WhatsappAccount'][_0x5ae3('0x3b')],function(_0x42441d){return{'name':_0x42441d['fieldName'],'type':_0x42441d['type'][_0x5ae3('0x3c')]};});_0x4957a3['model']=_[_0x5ae3('0x3a')](_0x365af2,_0x5ae3('0x38'));_0x4957a3[_0x5ae3('0x3d')]=_[_0x5ae3('0x3e')](_0x5cc1ba[_0x5ae3('0x3d')]);_0x4957a3[_0x5ae3('0x3f')]=_[_0x5ae3('0x40')](_0x4957a3[_0x5ae3('0x41')],_0x4957a3[_0x5ae3('0x3d')]);_0x3c9ace[_0x5ae3('0x42')]=_[_0x5ae3('0x40')](_0x4957a3[_0x5ae3('0x41')],qs['fields'](_0x5cc1ba[_0x5ae3('0x3d')]['fields']));_0x3c9ace[_0x5ae3('0x42')]=_0x3c9ace['attributes'][_0x5ae3('0x43')]?_0x3c9ace[_0x5ae3('0x42')]:_0x4957a3[_0x5ae3('0x41')];if(!_0x5cc1ba['query'][_0x5ae3('0x44')](_0x5ae3('0x45'))){_0x3c9ace[_0x5ae3('0x2c')]=qs[_0x5ae3('0x2c')](_0x5cc1ba[_0x5ae3('0x3d')][_0x5ae3('0x2c')]);_0x3c9ace[_0x5ae3('0x29')]=qs[_0x5ae3('0x29')](_0x5cc1ba['query'][_0x5ae3('0x29')]);}_0x3c9ace[_0x5ae3('0x46')]=qs[_0x5ae3('0x47')](_0x5cc1ba[_0x5ae3('0x3d')]['sort']);_0x3c9ace[_0x5ae3('0x48')]=qs[_0x5ae3('0x3f')](_[_0x5ae3('0x49')](_0x5cc1ba['query'],_0x4957a3[_0x5ae3('0x3f')]),_0x365af2);if(_0x5cc1ba['query'][_0x5ae3('0x4a')]){_0x3c9ace['where']=_[_0x5ae3('0x4b')](_0x3c9ace[_0x5ae3('0x48')],{'$or':_[_0x5ae3('0x3a')](_0x365af2,function(_0x528263){if(_0x528263['type']!==_0x5ae3('0x4c')){var _0x18ac1a={};_0x18ac1a[_0x528263[_0x5ae3('0x38')]]={'$like':'%'+_0x5cc1ba[_0x5ae3('0x3d')]['filter']+'%'};return _0x18ac1a;}})});}_0x3c9ace=_[_0x5ae3('0x4b')]({},_0x3c9ace,_0x5cc1ba[_0x5ae3('0x4d')]);var _0x16fb60={'where':_0x3c9ace['where']};return db[_0x5ae3('0x4e')][_0x5ae3('0x2b')](_0x16fb60)[_0x5ae3('0x32')](function(_0x300a34){_0x100258[_0x5ae3('0x2b')]=_0x300a34;if(_0x5cc1ba[_0x5ae3('0x3d')][_0x5ae3('0x4f')]){_0x3c9ace['include']=[{'all':!![]}];}return db[_0x5ae3('0x4e')][_0x5ae3('0x50')](_0x3c9ace);})[_0x5ae3('0x32')](function(_0x3f0df4){_0x100258[_0x5ae3('0x51')]=_0x3f0df4;return _0x100258;})[_0x5ae3('0x32')](respondWithFilteredResult(_0x2b3920,_0x3c9ace))[_0x5ae3('0x24')](handleError(_0x2b3920,null));};exports[_0x5ae3('0x52')]=function(_0xbd8e1d,_0x33edb8){var _0x4538b7={'raw':![],'where':{'id':_0xbd8e1d[_0x5ae3('0x53')]['id']},'include':[{'model':db[_0x5ae3('0x54')],'as':_0x5ae3('0x55')}]},_0xf079d={};_0xf079d[_0x5ae3('0x41')]=_[_0x5ae3('0x3e')](db['WhatsappAccount'][_0x5ae3('0x3b')]);_0xf079d[_0x5ae3('0x3d')]=_[_0x5ae3('0x3e')](_0xbd8e1d[_0x5ae3('0x3d')]);_0xf079d[_0x5ae3('0x3f')]=_['intersection'](_0xf079d[_0x5ae3('0x41')],_0xf079d['query']);_0x4538b7[_0x5ae3('0x42')]=_['intersection'](_0xf079d[_0x5ae3('0x41')],qs[_0x5ae3('0x56')](_0xbd8e1d['query'][_0x5ae3('0x56')]));_0x4538b7[_0x5ae3('0x42')]=_0x4538b7['attributes'][_0x5ae3('0x43')]?_0x4538b7[_0x5ae3('0x42')]:_0xf079d[_0x5ae3('0x41')];if(_0xbd8e1d[_0x5ae3('0x3d')][_0x5ae3('0x4f')]){_0x4538b7['include']=[{'all':!![]}];}_0x4538b7=_[_0x5ae3('0x4b')]({},_0x4538b7,_0xbd8e1d[_0x5ae3('0x4d')]);return db[_0x5ae3('0x4e')][_0x5ae3('0x57')](_0x4538b7)['then'](handleEntityNotFound(_0x33edb8,null))[_0x5ae3('0x32')](respondWithResult(_0x33edb8,null))[_0x5ae3('0x24')](handleError(_0x33edb8,null));};exports[_0x5ae3('0x58')]=function(_0x531868,_0x5d426f){return db[_0x5ae3('0x4e')]['create'](_0x531868[_0x5ae3('0x59')],{})[_0x5ae3('0x32')](function(_0x44f9c8){var _0x510c22=_0x531868[_0x5ae3('0x5a')]['get']({'plain':!![]});if(!_0x510c22)throw new Error(_0x5ae3('0x5b'));if(_0x510c22[_0x5ae3('0x5c')]===_0x5ae3('0x5a')){var _0x336ee3=_0x44f9c8['get']({'plain':!![]});var _0x410245=_0x5ae3('0x35');return db[_0x5ae3('0x5d')][_0x5ae3('0x57')]({'where':{'name':_0x410245,'userProfileId':_0x510c22[_0x5ae3('0x5e')]},'raw':!![]})['then'](function(_0x284444){if(_0x284444&&_0x284444[_0x5ae3('0x5f')]===0x0){return db[_0x5ae3('0x36')][_0x5ae3('0x58')]({'name':_0x336ee3[_0x5ae3('0x38')],'resourceId':_0x336ee3['id'],'type':_0x284444[_0x5ae3('0x38')],'sectionId':_0x284444['id']},{})['then'](function(){return _0x44f9c8;});}else{return _0x44f9c8;}})[_0x5ae3('0x24')](function(_0x49af23){logger[_0x5ae3('0x21')](_0x5ae3('0x60'),_0x49af23);throw _0x49af23;});}return _0x44f9c8;})[_0x5ae3('0x32')](respondWithResult(_0x5d426f,0xc9))[_0x5ae3('0x24')](handleError(_0x5d426f,null));};exports[_0x5ae3('0x31')]=function(_0x30c9aa,_0xf8866f){if(_0x30c9aa['body']['id']){delete _0x30c9aa[_0x5ae3('0x59')]['id'];}return db['WhatsappAccount'][_0x5ae3('0x57')]({'where':{'id':_0x30c9aa[_0x5ae3('0x53')]['id']},'include':[{'model':db['Pause'],'as':_0x5ae3('0x55')}]})[_0x5ae3('0x32')](handleEntityNotFound(_0xf8866f,null))['then'](saveUpdates(_0x30c9aa[_0x5ae3('0x59')],null))[_0x5ae3('0x32')](respondWithResult(_0xf8866f,null))[_0x5ae3('0x24')](handleError(_0xf8866f,null));};exports[_0x5ae3('0x33')]=function(_0x4af3ed,_0x3b0675){return db[_0x5ae3('0x4e')][_0x5ae3('0x57')]({'where':{'id':_0x4af3ed['params']['id']}})['then'](handleEntityNotFound(_0x3b0675,null))['then'](removeEntity(_0x3b0675,null))['catch'](handleError(_0x3b0675,null));};exports[_0x5ae3('0x61')]=function(_0x19a8e2,_0x2521f3){return db[_0x5ae3('0x4e')][_0x5ae3('0x61')]()['then'](respondWithResult(_0x2521f3,null))[_0x5ae3('0x24')](handleError(_0x2521f3,null));};exports[_0x5ae3('0x62')]=function(_0x1103b8,_0x38b250,_0x6ae10e){if(_0x1103b8['body']['id']){delete _0x1103b8['body']['id'];}return db[_0x5ae3('0x4e')][_0x5ae3('0x57')]({'where':{'id':_0x1103b8[_0x5ae3('0x53')]['id']}})[_0x5ae3('0x32')](handleEntityNotFound(_0x38b250,null))['then'](function(_0x145194){if(_0x145194){_0x1103b8[_0x5ae3('0x59')]['WhatsappAccountId']=_0x145194['id'];return db[_0x5ae3('0x63')][_0x5ae3('0x58')](_0x1103b8[_0x5ae3('0x59')]);}})[_0x5ae3('0x32')](respondWithResult(_0x38b250,null))['catch'](handleError(_0x38b250,null));};exports[_0x5ae3('0x64')]=function(_0x4d0557,_0x349dcc,_0x441c37){var _0x1a9550={'raw':![],'where':{}};var _0x161536={};var _0x57663d={'count':0x0,'rows':[]};return db[_0x5ae3('0x4e')][_0x5ae3('0x65')]({'where':{'id':_0x4d0557[_0x5ae3('0x53')]['id']}})[_0x5ae3('0x32')](handleEntityNotFound(_0x349dcc,null))[_0x5ae3('0x32')](function(_0x292fce){if(_0x292fce){_0x161536[_0x5ae3('0x41')]=_[_0x5ae3('0x3e')](db[_0x5ae3('0x63')][_0x5ae3('0x3b')]);_0x161536[_0x5ae3('0x3d')]=_[_0x5ae3('0x3e')](_0x4d0557[_0x5ae3('0x3d')]);_0x161536[_0x5ae3('0x3f')]=_['intersection'](_0x161536[_0x5ae3('0x41')],_0x161536['query']);_0x1a9550[_0x5ae3('0x42')]=_[_0x5ae3('0x40')](_0x161536[_0x5ae3('0x41')],qs[_0x5ae3('0x56')](_0x4d0557[_0x5ae3('0x3d')]['fields']));_0x1a9550[_0x5ae3('0x42')]=_0x1a9550[_0x5ae3('0x42')][_0x5ae3('0x43')]?_0x1a9550[_0x5ae3('0x42')]:_0x161536[_0x5ae3('0x41')];if(!_0x4d0557['query'][_0x5ae3('0x44')](_0x5ae3('0x45'))){_0x1a9550[_0x5ae3('0x2c')]=qs[_0x5ae3('0x2c')](_0x4d0557['query']['limit']);_0x1a9550['offset']=qs[_0x5ae3('0x29')](_0x4d0557['query'][_0x5ae3('0x29')]);}_0x1a9550['order']=qs[_0x5ae3('0x47')](_0x4d0557['query'][_0x5ae3('0x47')]);_0x1a9550[_0x5ae3('0x48')]=qs['filters'](_[_0x5ae3('0x49')](_0x4d0557[_0x5ae3('0x3d')],_0x161536[_0x5ae3('0x3f')]));_0x1a9550['where'][_0x5ae3('0x66')]=_0x292fce['id'];if(_0x4d0557['query']['filter']){_0x1a9550[_0x5ae3('0x48')]=_[_0x5ae3('0x4b')](_0x1a9550[_0x5ae3('0x48')],{'$or':_['map'](_0x1a9550['attributes'],function(_0x5e4892){var _0x3eede3={};_0x3eede3[_0x5e4892]={'$like':'%'+_0x4d0557[_0x5ae3('0x3d')][_0x5ae3('0x4a')]+'%'};return _0x3eede3;})});}_0x1a9550=_[_0x5ae3('0x4b')]({},_0x1a9550,_0x4d0557[_0x5ae3('0x4d')]);return db[_0x5ae3('0x63')]['count']({'where':_0x1a9550[_0x5ae3('0x48')]})['then'](function(_0xbc2a5a){_0x57663d[_0x5ae3('0x2b')]=_0xbc2a5a;if(_0x4d0557[_0x5ae3('0x3d')][_0x5ae3('0x4f')]){_0x1a9550['include']=[{'all':!![]}];}return db[_0x5ae3('0x63')][_0x5ae3('0x50')](_0x1a9550);})[_0x5ae3('0x32')](function(_0x280f65){_0x57663d[_0x5ae3('0x51')]=_0x280f65;return _0x57663d;});}})[_0x5ae3('0x32')](respondWithFilteredResult(_0x349dcc,_0x1a9550))[_0x5ae3('0x24')](handleError(_0x349dcc,null));};exports[_0x5ae3('0x67')]=function(_0x1631f1,_0x1903df,_0x2dba85){return db[_0x5ae3('0x4e')]['find']({'where':{'id':_0x1631f1['params']['id']}})['then'](handleEntityNotFound(_0x1903df,null))['then'](function(_0x38c792){if(_0x38c792){return _0x38c792[_0x5ae3('0x67')](_0x1631f1[_0x5ae3('0x3d')][_0x5ae3('0x68')]);}})[_0x5ae3('0x32')](respondWithStatusCode(_0x1903df,null))['catch'](handleError(_0x1903df,null));};exports[_0x5ae3('0x69')]=function(_0x2aeec4,_0x214d6b,_0x480ccc){if(_0x2aeec4['body']['id']){delete _0x2aeec4[_0x5ae3('0x59')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x2aeec4['params']['id']}})[_0x5ae3('0x32')](handleEntityNotFound(_0x214d6b,null))['then'](function(_0x2b88fd){if(_0x2b88fd){_0x2aeec4[_0x5ae3('0x59')]['WhatsappAccountId']=_0x2b88fd['id'];return db[_0x5ae3('0x6a')]['create'](_0x2aeec4[_0x5ae3('0x59')]);}})[_0x5ae3('0x32')](respondWithResult(_0x214d6b,null))[_0x5ae3('0x24')](handleError(_0x214d6b,null));};exports[_0x5ae3('0x6b')]=function(_0x4995e8,_0x11f9f6,_0x27a5a1){var _0x5038fa={'raw':![],'where':{}};var _0x345310={};var _0x4f9ec7={'count':0x0,'rows':[]};return db[_0x5ae3('0x4e')][_0x5ae3('0x65')]({'where':{'id':_0x4995e8[_0x5ae3('0x53')]['id']}})[_0x5ae3('0x32')](handleEntityNotFound(_0x11f9f6,null))[_0x5ae3('0x32')](function(_0x353d42){if(_0x353d42){_0x345310[_0x5ae3('0x41')]=_[_0x5ae3('0x3e')](db['CannedAnswer']['rawAttributes']);_0x345310['query']=_['keys'](_0x4995e8[_0x5ae3('0x3d')]);_0x345310['filters']=_['intersection'](_0x345310[_0x5ae3('0x41')],_0x345310[_0x5ae3('0x3d')]);_0x5038fa[_0x5ae3('0x42')]=_['intersection'](_0x345310[_0x5ae3('0x41')],qs[_0x5ae3('0x56')](_0x4995e8[_0x5ae3('0x3d')]['fields']));_0x5038fa[_0x5ae3('0x42')]=_0x5038fa[_0x5ae3('0x42')][_0x5ae3('0x43')]?_0x5038fa['attributes']:_0x345310[_0x5ae3('0x41')];if(!_0x4995e8['query'][_0x5ae3('0x44')](_0x5ae3('0x45'))){_0x5038fa[_0x5ae3('0x2c')]=qs[_0x5ae3('0x2c')](_0x4995e8[_0x5ae3('0x3d')][_0x5ae3('0x2c')]);_0x5038fa[_0x5ae3('0x29')]=qs[_0x5ae3('0x29')](_0x4995e8['query'][_0x5ae3('0x29')]);}_0x5038fa[_0x5ae3('0x46')]=qs[_0x5ae3('0x47')](_0x4995e8[_0x5ae3('0x3d')]['sort']);_0x5038fa[_0x5ae3('0x48')]=qs['filters'](_[_0x5ae3('0x49')](_0x4995e8[_0x5ae3('0x3d')],_0x345310[_0x5ae3('0x3f')]));_0x5038fa['where'][_0x5ae3('0x66')]=_0x353d42['id'];if(_0x4995e8[_0x5ae3('0x3d')][_0x5ae3('0x4a')]){_0x5038fa[_0x5ae3('0x48')]=_[_0x5ae3('0x4b')](_0x5038fa['where'],{'$or':_[_0x5ae3('0x3a')](_0x5038fa['attributes'],function(_0x3c89e5){var _0x40d962={};_0x40d962[_0x3c89e5]={'$like':'%'+_0x4995e8['query'][_0x5ae3('0x4a')]+'%'};return _0x40d962;})});}_0x5038fa=_[_0x5ae3('0x4b')]({},_0x5038fa,_0x4995e8[_0x5ae3('0x4d')]);return db['CannedAnswer'][_0x5ae3('0x2b')]({'where':_0x5038fa[_0x5ae3('0x48')]})[_0x5ae3('0x32')](function(_0x141204){_0x4f9ec7['count']=_0x141204;if(_0x4995e8[_0x5ae3('0x3d')]['includeAll']){_0x5038fa[_0x5ae3('0x6c')]=[{'all':!![]}];}return db[_0x5ae3('0x6a')][_0x5ae3('0x50')](_0x5038fa);})['then'](function(_0x25a096){_0x4f9ec7[_0x5ae3('0x51')]=_0x25a096;return _0x4f9ec7;});}})[_0x5ae3('0x32')](respondWithFilteredResult(_0x11f9f6,_0x5038fa))['catch'](handleError(_0x11f9f6,null));};exports['removeAnswers']=function(_0x475beb,_0x3d2df0,_0x3b3784){return db[_0x5ae3('0x4e')][_0x5ae3('0x57')]({'where':{'id':_0x475beb[_0x5ae3('0x53')]['id']}})[_0x5ae3('0x32')](handleEntityNotFound(_0x3d2df0,null))[_0x5ae3('0x32')](function(_0x31303d){if(_0x31303d){return _0x31303d[_0x5ae3('0x6d')](_0x475beb['query'][_0x5ae3('0x68')]);}})['then'](respondWithStatusCode(_0x3d2df0,null))[_0x5ae3('0x24')](handleError(_0x3d2df0,null));};exports[_0x5ae3('0x6e')]=function(_0x1d1b39,_0x37c37d,_0x4f0703){return db['WhatsappAccount'][_0x5ae3('0x57')]({'where':{'id':_0x1d1b39[_0x5ae3('0x53')]['id']}})[_0x5ae3('0x32')](handleEntityNotFound(_0x37c37d,null))['then'](function(_0x3083c9){if(_0x3083c9){return _0x3083c9['addAgents'](_0x1d1b39[_0x5ae3('0x59')][_0x5ae3('0x68')],_[_0x5ae3('0x6f')](_0x1d1b39[_0x5ae3('0x59')],[_0x5ae3('0x68'),'id'])||{})[_0x5ae3('0x70')](function(_0xc17081){for(var _0x530de8=0x0;_0x530de8<_0x1d1b39[_0x5ae3('0x59')][_0x5ae3('0x68')][_0x5ae3('0x43')];_0x530de8+=0x1){socket[_0x5ae3('0x71')](_0x5ae3('0x72'),{'UserId':Number(_0x1d1b39[_0x5ae3('0x59')][_0x5ae3('0x68')][_0x530de8]),'WhatsappAccountId':Number(_0x1d1b39['params']['id'])});}return _0xc17081;});}})[_0x5ae3('0x32')](respondWithResult(_0x37c37d,null))['catch'](handleError(_0x37c37d,null));};exports[_0x5ae3('0x73')]=function(_0x3e454b,_0x1fa77d,_0x34bf8b){return db[_0x5ae3('0x4e')][_0x5ae3('0x57')]({'where':{'id':_0x3e454b[_0x5ae3('0x53')]['id']}})[_0x5ae3('0x32')](handleEntityNotFound(_0x1fa77d,null))['then'](function(_0x46a7ad){if(_0x46a7ad){return _0x46a7ad[_0x5ae3('0x73')](_0x3e454b[_0x5ae3('0x3d')][_0x5ae3('0x68')])[_0x5ae3('0x32')](function(){if(_['isArray'](_0x3e454b['query'][_0x5ae3('0x68')])){for(var _0x95606=0x0;_0x95606<_0x3e454b[_0x5ae3('0x3d')]['ids'][_0x5ae3('0x43')];_0x95606+=0x1){socket[_0x5ae3('0x71')]('userWhatsappAccount:remove',{'UserId':Number(_0x3e454b[_0x5ae3('0x3d')][_0x5ae3('0x68')][_0x95606]),'WhatsappAccountId':Number(_0x3e454b['params']['id'])});}}else{socket['emit'](_0x5ae3('0x74'),{'UserId':Number(_0x3e454b[_0x5ae3('0x3d')][_0x5ae3('0x68')]),'WhatsappAccountId':Number(_0x3e454b[_0x5ae3('0x53')]['id'])});}});}})['then'](respondWithStatusCode(_0x1fa77d,null))[_0x5ae3('0x24')](handleError(_0x1fa77d,null));};exports[_0x5ae3('0x75')]=function(_0x31d4f6,_0x93bfd1,_0x23fe9){var _0x52f1c9={};var _0x588dda={};var _0x1379ce;var _0x5a3467;return db[_0x5ae3('0x4e')][_0x5ae3('0x65')]({'where':{'id':_0x31d4f6['params']['id']}})[_0x5ae3('0x32')](handleEntityNotFound(_0x93bfd1,null))[_0x5ae3('0x32')](function(_0x419b49){if(_0x419b49){_0x1379ce=_0x419b49;_0x588dda[_0x5ae3('0x41')]=_[_0x5ae3('0x3e')](db[_0x5ae3('0x76')]['rawAttributes']);_0x588dda[_0x5ae3('0x3d')]=_[_0x5ae3('0x3e')](_0x31d4f6[_0x5ae3('0x3d')]);_0x588dda[_0x5ae3('0x3f')]=_['intersection'](_0x588dda[_0x5ae3('0x41')],_0x588dda[_0x5ae3('0x3d')]);_0x52f1c9['attributes']=_[_0x5ae3('0x40')](_0x588dda[_0x5ae3('0x41')],qs[_0x5ae3('0x56')](_0x31d4f6[_0x5ae3('0x3d')][_0x5ae3('0x56')]));_0x52f1c9[_0x5ae3('0x42')]=_0x52f1c9['attributes'][_0x5ae3('0x43')]?_0x52f1c9[_0x5ae3('0x42')]:_0x588dda[_0x5ae3('0x41')];_0x52f1c9[_0x5ae3('0x46')]=qs['sort'](_0x31d4f6['query']['sort']);_0x52f1c9[_0x5ae3('0x48')]=qs['filters'](_[_0x5ae3('0x49')](_0x31d4f6['query'],_0x588dda[_0x5ae3('0x3f')]));if(_0x31d4f6[_0x5ae3('0x3d')][_0x5ae3('0x4a')]){_0x52f1c9[_0x5ae3('0x48')]=_['merge'](_0x52f1c9['where'],{'$or':_[_0x5ae3('0x3a')](_0x52f1c9[_0x5ae3('0x42')],function(_0x54c3f4){var _0xff11ef={};_0xff11ef[_0x54c3f4]={'$like':'%'+_0x31d4f6[_0x5ae3('0x3d')]['filter']+'%'};return _0xff11ef;})});}_0x52f1c9=_['merge']({},_0x52f1c9,_0x31d4f6[_0x5ae3('0x4d')]);return _0x1379ce[_0x5ae3('0x75')](_0x52f1c9);}})[_0x5ae3('0x32')](function(_0x112c8b){if(_0x112c8b){_0x5a3467=_0x112c8b[_0x5ae3('0x43')];if(!_0x31d4f6[_0x5ae3('0x3d')][_0x5ae3('0x44')](_0x5ae3('0x45'))){_0x52f1c9[_0x5ae3('0x2c')]=qs['limit'](_0x31d4f6['query'][_0x5ae3('0x2c')]);_0x52f1c9[_0x5ae3('0x29')]=qs[_0x5ae3('0x29')](_0x31d4f6[_0x5ae3('0x3d')]['offset']);}return _0x1379ce['getAgents'](_0x52f1c9);}})[_0x5ae3('0x32')](function(_0x4e0772){if(_0x4e0772){return _0x4e0772?{'count':_0x5a3467,'rows':_0x4e0772}:null;}})[_0x5ae3('0x32')](respondWithResult(_0x93bfd1,null))[_0x5ae3('0x24')](handleError(_0x93bfd1,null));};exports[_0x5ae3('0x77')]=function(_0x3d6d8d,_0x589f81,_0x26c8f4){return db[_0x5ae3('0x4e')][_0x5ae3('0x65')]({'where':{'id':_0x3d6d8d['params']['id']}})[_0x5ae3('0x32')](handleEntityNotFound(_0x589f81,null))[_0x5ae3('0x32')](function(_0x4f3605){if(_0x4f3605){return db['sequelize']['transaction'](function(_0x73b5e6){return db['WhatsappApplication']['destroy']({'where':{'WhatsappAccountId':_0x3d6d8d[_0x5ae3('0x53')]['id']},'transaction':_0x73b5e6})[_0x5ae3('0x32')](function(_0x31f6a6){var _0x3f4873=_[_0x5ae3('0x3a')](_0x3d6d8d[_0x5ae3('0x59')],function(_0x5128bc){_0x5128bc[_0x5ae3('0x66')]=_0x3d6d8d[_0x5ae3('0x53')]['id'];return _0x5128bc;});return db[_0x5ae3('0x78')][_0x5ae3('0x79')](_0x3f4873,{'transaction':_0x73b5e6});});})[_0x5ae3('0x32')](function(){return db[_0x5ae3('0x78')][_0x5ae3('0x7a')]({'where':{'WhatsappAccountId':_0x3d6d8d[_0x5ae3('0x53')]['id']},'order':_0x5ae3('0x7b')});});}})[_0x5ae3('0x32')](respondWithResult(_0x589f81,null))[_0x5ae3('0x24')](handleError(_0x589f81,null));};exports[_0x5ae3('0x7c')]=function(_0x170494,_0x399ffd,_0x21fbf7){var _0x456767={};var _0xd79545={};var _0x2ad78f;var _0x1fdbf5;return db[_0x5ae3('0x4e')][_0x5ae3('0x65')]({'where':{'id':_0x170494[_0x5ae3('0x53')]['id']}})[_0x5ae3('0x32')](handleEntityNotFound(_0x399ffd,null))[_0x5ae3('0x32')](function(_0x2e9dba){if(_0x2e9dba){_0x2ad78f=_0x2e9dba;_0xd79545[_0x5ae3('0x41')]=_[_0x5ae3('0x3e')](db[_0x5ae3('0x78')][_0x5ae3('0x3b')]);_0xd79545[_0x5ae3('0x3d')]=_[_0x5ae3('0x3e')](_0x170494[_0x5ae3('0x3d')]);_0xd79545['filters']=_[_0x5ae3('0x40')](_0xd79545['model'],_0xd79545[_0x5ae3('0x3d')]);_0x456767[_0x5ae3('0x42')]=_[_0x5ae3('0x40')](_0xd79545[_0x5ae3('0x41')],qs[_0x5ae3('0x56')](_0x170494[_0x5ae3('0x3d')][_0x5ae3('0x56')]));_0x456767['attributes']=_0x456767[_0x5ae3('0x42')][_0x5ae3('0x43')]?_0x456767[_0x5ae3('0x42')]:_0xd79545[_0x5ae3('0x41')];_0x456767[_0x5ae3('0x46')]=qs[_0x5ae3('0x47')](_0x170494[_0x5ae3('0x3d')][_0x5ae3('0x47')]);_0x456767[_0x5ae3('0x48')]=qs[_0x5ae3('0x3f')](_[_0x5ae3('0x49')](_0x170494[_0x5ae3('0x3d')],_0xd79545[_0x5ae3('0x3f')]));if(_0x170494[_0x5ae3('0x3d')]['filter']){_0x456767[_0x5ae3('0x48')]=_[_0x5ae3('0x4b')](_0x456767[_0x5ae3('0x48')],{'$or':_[_0x5ae3('0x3a')](_0x456767[_0x5ae3('0x42')],function(_0x1eff78){var _0x49160a={};_0x49160a[_0x1eff78]={'$like':'%'+_0x170494[_0x5ae3('0x3d')]['filter']+'%'};return _0x49160a;})});}_0x456767=_['merge']({},_0x456767,_0x170494[_0x5ae3('0x4d')]);return _0x2ad78f[_0x5ae3('0x7c')](_0x456767);}})['then'](function(_0x1c180a){if(_0x1c180a){_0x1fdbf5=_0x1c180a[_0x5ae3('0x43')];if(!_0x170494[_0x5ae3('0x3d')][_0x5ae3('0x44')]('nolimit')){_0x456767[_0x5ae3('0x2c')]=qs[_0x5ae3('0x2c')](_0x170494[_0x5ae3('0x3d')][_0x5ae3('0x2c')]);_0x456767['offset']=qs[_0x5ae3('0x29')](_0x170494[_0x5ae3('0x3d')][_0x5ae3('0x29')]);}return _0x2ad78f[_0x5ae3('0x7c')](_0x456767);}})[_0x5ae3('0x32')](function(_0x1c73c1){if(_0x1c73c1){return _0x1c73c1?{'count':_0x1fdbf5,'rows':_0x1c73c1}:null;}})[_0x5ae3('0x32')](respondWithResult(_0x399ffd,null))[_0x5ae3('0x24')](handleError(_0x399ffd,null));};exports[_0x5ae3('0x7d')]=function(_0x39ba3b,_0x27bdc4,_0x42da4f){var _0x46cfde={'channel':_0x5ae3('0x7e')};var _0x14f045=[];var _0x5e7d9f=[];var _0x39b314={};return db[_0x5ae3('0x4e')][_0x5ae3('0x57')]({'where':{'id':_0x39ba3b[_0x5ae3('0x53')]['id']},'include':[{'model':db['WhatsappApplication'],'as':'Applications'}]})[_0x5ae3('0x32')](handleEntityNotFound(_0x27bdc4,null))['then'](function(_0x43b779){_0x46cfde[_0x5ae3('0x7f')]=_0x43b779;_0x46cfde['applications']=_[_0x5ae3('0x80')](_0x43b779[_0x5ae3('0x81')],[_0x5ae3('0x7b')],[_0x5ae3('0x82')]);if(_0x46cfde[_0x5ae3('0x7f')][_0x5ae3('0x81')]){delete _0x46cfde[_0x5ae3('0x7f')][_0x5ae3('0x81')];}return db[_0x5ae3('0x83')][_0x5ae3('0x61')]();})[_0x5ae3('0x32')](function(_0x4f991a){if(!_0x4f991a){throw new db['Sequelize'][(_0x5ae3('0x84'))](_0x5ae3('0x85'));}_0x14f045=_['difference'](_[_0x5ae3('0x3e')](_0x4f991a),[_0x5ae3('0x86'),'updatedAt']);_0x5e7d9f=_[_0x5ae3('0x87')](_[_0x5ae3('0x3e')](_0x4f991a),[_0x5ae3('0x86'),_0x5ae3('0x88'),_0x5ae3('0x89'),_0x5ae3('0x8a')]);_0x46cfde[_0x5ae3('0x59')]={'mapKey':'mobile'};if(_0x46cfde['account'][_0x5ae3('0x8b')]&&_0x46cfde[_0x5ae3('0x7f')]['type']===_0x5ae3('0x8c')){_0x46cfde['body'][_0x5ae3('0x8d')]=_0x39ba3b[_0x5ae3('0x59')][_0x5ae3('0x8e')][_0x5ae3('0x8f')](_0x5ae3('0x90'),'');_0x46cfde[_0x5ae3('0x59')][_0x5ae3('0x59')]=_0x39ba3b['body']['Body'];_0x46cfde[_0x5ae3('0x59')]['messageId']=_0x39ba3b['body'][_0x5ae3('0x91')];}if(_0x46cfde['body']['id']){delete _0x46cfde[_0x5ae3('0x59')]['id'];}if(_[_0x5ae3('0x92')](_0x46cfde['body'][_0x5ae3('0x8d')])){throw new db[(_0x5ae3('0x93'))][(_0x5ae3('0x84'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x46cfde[_0x5ae3('0x59')][_0x5ae3('0x59')])||_0x46cfde[_0x5ae3('0x59')][_0x5ae3('0x59')]===''){throw new db[(_0x5ae3('0x93'))][(_0x5ae3('0x84'))](_0x5ae3('0x94'));}if(_[_0x5ae3('0x92')](_0x46cfde[_0x5ae3('0x59')]['mapKey'])){throw new db['Sequelize']['ValidationError'](_0x5ae3('0x95')+_0x5e7d9f);}if(!_[_0x5ae3('0x96')](_0x5e7d9f,_0x46cfde[_0x5ae3('0x59')]['mapKey'])){throw new db[(_0x5ae3('0x93'))][(_0x5ae3('0x84'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5e7d9f);}_0x39b314[_0x46cfde[_0x5ae3('0x59')][_0x5ae3('0x97')]]=_0x46cfde[_0x5ae3('0x59')]['from'];return db[_0x5ae3('0x98')][_0x5ae3('0x57')]({'where':{'id':_0x46cfde['account'][_0x5ae3('0x8a')]},'include':[{'model':db[_0x5ae3('0x83')],'as':'Contacts','where':_0x39b314,'limit':0x1,'order':[[_0x5ae3('0x88'),_0x5ae3('0x99')]]}]});})[_0x5ae3('0x32')](handleEntityNotFound(_0x27bdc4,null))[_0x5ae3('0x32')](function(_0x5203cf){if(_0x5203cf){_0x46cfde[_0x5ae3('0x9a')]=_[_0x5ae3('0x6f')](_0x5203cf,[_0x5ae3('0x9b')]);if(_0x5203cf[_0x5ae3('0x9b')]['length']){return _0x5203cf[_0x5ae3('0x9b')][0x0];}var _0x4d0486=_[_0x5ae3('0x15')](_0x46cfde[_0x5ae3('0x59')],{'firstName':_0x46cfde[_0x5ae3('0x59')]['from'],'ListId':_0x5203cf['id']});_0x4d0486[_0x46cfde[_0x5ae3('0x59')][_0x5ae3('0x97')]]=_0x46cfde[_0x5ae3('0x59')][_0x5ae3('0x8d')];return db['CmContact'][_0x5ae3('0x58')](_0x4d0486,{'fields':_0x14f045,'raw':!![]});}})['then'](handleEntityNotFound(_0x27bdc4,null))[_0x5ae3('0x32')](function(_0x3c873b){if(_0x3c873b){_0x46cfde[_0x5ae3('0x9c')]=_0x3c873b;var _0x12de67={'ContactId':_0x3c873b['id'],'phone':_0x46cfde['body'][_0x5ae3('0x8d')],'WhatsappAccountId':_0x39ba3b[_0x5ae3('0x53')]['id']};var _0x575804={'ContactId':_0x3c873b['id'],'WhatsappAccountId':_0x39ba3b[_0x5ae3('0x53')]['id'],'closed':![]};return db[_0x5ae3('0x9d')]['find']({'where':_0x575804})[_0x5ae3('0x32')](function(_0x3b9e2f){if(_0x3b9e2f){return[_0x3b9e2f,![]];}return db[_0x5ae3('0x9d')]['create'](_0x12de67)[_0x5ae3('0x32')](function(_0x296de1){return[_0x296de1,!![]];});});}})['spread'](function(_0x4136d3,_0x447273){_0x46cfde['interaction']=_0x4136d3[_0x5ae3('0x34')]({'plain':!![]});_0x46cfde[_0x5ae3('0x9e')]['created']=![];if(_0x447273){if(_0x46cfde[_0x5ae3('0x7f')][_0x5ae3('0x9f')]){_0x46cfde['applications'][_0x5ae3('0xa0')]({'id':0x0,'priority':_0x46cfde['applications']['length']+0x1,'app':_0x5ae3('0xa1'),'appdata':_0x5ae3('0xa2'),'interval':_0x5ae3('0xa3')});}_0x46cfde[_0x5ae3('0x9e')]['created']=!![];}return db[_0x5ae3('0xa4')]['create']({'phone':_0x46cfde[_0x5ae3('0x59')][_0x5ae3('0x8d')],'messageId':_0x46cfde[_0x5ae3('0x59')][_0x5ae3('0xa5')],'body':_0x46cfde[_0x5ae3('0x59')]['body'],'WhatsappAccountId':_0x39ba3b[_0x5ae3('0x53')]['id'],'WhatsappInteractionId':_0x4136d3['id'],'direction':'in','ContactId':_0x4136d3[_0x5ae3('0xa6')],'AttachmentId':_0x46cfde[_0x5ae3('0x59')][_0x5ae3('0xa7')]});})[_0x5ae3('0x32')](function(_0x505004){_0x46cfde[_0x5ae3('0x22')]=_0x505004;if(_0x46cfde[_0x5ae3('0x9e')][_0x5ae3('0xa8')]){return db[_0x5ae3('0x76')]['find']({'attributes':['id',_0x5ae3('0x38')],'where':{'id':_0x46cfde['interaction'][_0x5ae3('0xa8')]}})['then'](function(_0x366e44){if(_0x366e44){_0x46cfde[_0x5ae3('0xa9')][_0x5ae3('0xaa')]({'id':0x0,'priority':0x0,'app':_0x5ae3('0xab'),'appdata':_0x366e44[_0x5ae3('0x38')]+','+(_0x46cfde['account'][_0x5ae3('0xac')]||0xa),'interval':_0x5ae3('0xa3')});}return respondWithRpcPromise('Start',_0x5ae3('0xad'),_0x46cfde);});}return respondWithRpcPromise(_0x5ae3('0xae'),_0x5ae3('0xad'),_0x46cfde);})['then'](function(_0x526558){if(_0x526558){var _0x185027=0xc8;var _0x27291e=_0x5ae3('0xaf');logger['info']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x27291e,_0x185027,_0x5ae3('0xb0'));logger[_0x5ae3('0x1e')](_0x5ae3('0xb1'),_0x27291e,_0x185027,_0x5ae3('0xb0'),JSON['stringify'](_0x526558));if(_0x46cfde[_0x5ae3('0x7f')]['type']===_0x5ae3('0x8c')){return _0x27bdc4[_0x5ae3('0x26')](_0x185027)[_0x5ae3('0x2d')](_0x5ae3('0xb2'),_0x5ae3('0xb3'))['send'](_0x5ae3('0xb4'));}else{return _0x27bdc4['status'](_0x185027)[_0x5ae3('0x28')](_0x526558);}}})[_0x5ae3('0x24')](handleError(_0x27bdc4,null));};exports[_0x5ae3('0xb5')]=function(_0x4a7be8,_0xe73bc8,_0x275d59){var _0x5afa8e,_0x345388,_0x39b6fd;if(_[_0x5ae3('0x92')](_0x4a7be8[_0x5ae3('0x59')][_0x5ae3('0x59')])||_0x4a7be8[_0x5ae3('0x59')][_0x5ae3('0x59')]===''){throw new db[(_0x5ae3('0x93'))]['ValidationError'](_0x5ae3('0x94'));}if(_[_0x5ae3('0x92')](_0x4a7be8[_0x5ae3('0x59')]['to'])){throw new db[(_0x5ae3('0x93'))]['ValidationError'](_0x5ae3('0xb6'));}_0x5afa8e=_0x4a7be8[_0x5ae3('0x59')]['to'];return db[_0x5ae3('0x4e')][_0x5ae3('0x57')]({'where':{'id':_0x4a7be8[_0x5ae3('0x53')]['id']},'include':[{'model':db[_0x5ae3('0x98')],'as':_0x5ae3('0xb7'),'include':[{'model':db[_0x5ae3('0x83')],'as':_0x5ae3('0x9b'),'where':{'mobile':_0x5afa8e},'limit':0x1,'order':[[_0x5ae3('0x88'),_0x5ae3('0x99')]]}]}]})[_0x5ae3('0x32')](handleEntityNotFound(_0xe73bc8,null))[_0x5ae3('0x32')](function(_0x21a9c9){if(_0x21a9c9&&_0x21a9c9[_0x5ae3('0xb7')]){_0x345388=_0x21a9c9[_0x5ae3('0x34')]({'plain':!![]});if(_0x345388['List']&&_0x345388[_0x5ae3('0xb7')][_0x5ae3('0x9b')][_0x5ae3('0x43')]){return _0x345388[_0x5ae3('0xb7')][_0x5ae3('0x9b')][0x0];}return db[_0x5ae3('0x83')][_0x5ae3('0x58')](_[_0x5ae3('0x15')](_0x4a7be8[_0x5ae3('0x59')],{'firstName':_0x5afa8e,'mobile':_0x5afa8e,'phone':_0x5afa8e,'ListId':_0x345388[_0x5ae3('0x8a')]}));}})[_0x5ae3('0x32')](handleEntityNotFound(_0xe73bc8,null))[_0x5ae3('0x32')](function(_0x468965){if(_0x468965){_0x39b6fd=_0x468965;return db['WhatsappInteraction'][_0x5ae3('0x57')]({'where':{'ContactId':_0x39b6fd['id'],'closed':![],'WhatsappAccountId':_0x345388['id']}})[_0x5ae3('0x32')](function(_0xd7e843){if(_0xd7e843){return[_0xd7e843,![]];}return db[_0x5ae3('0x9d')]['create']({'UserId':_0x4a7be8[_0x5ae3('0x5a')]['id'],'ContactId':_0x39b6fd['id'],'WhatsappAccountId':_0x345388['id'],'phone':_0x5afa8e,'firstMsgDirection':_0x5ae3('0xb8'),'Messages':[_['merge'](_0x4a7be8[_0x5ae3('0x59')],{'read':![],'body':_0x4a7be8[_0x5ae3('0x59')][_0x5ae3('0x59')],'phone':_0x5afa8e,'WhatsappAccountId':_0x345388['id'],'UserId':_0x4a7be8[_0x5ae3('0x5a')]['id'],'ContactId':_0x39b6fd['id']})]},{'include':[{'model':db[_0x5ae3('0xa4')],'as':_0x5ae3('0xb9')}]})['then'](function(_0x1cd609){return[_0x1cd609,!![]];});});}})[_0x5ae3('0x70')](function(_0x1d7921,_0x20ad46){if(_0x20ad46){return _0x1d7921;}return db[_0x5ae3('0xa4')][_0x5ae3('0x58')](_[_0x5ae3('0x4b')](_0x4a7be8[_0x5ae3('0x59')],{'read':![],'body':_0x4a7be8[_0x5ae3('0x59')][_0x5ae3('0x59')],'phone':_0x5afa8e,'WhatsappAccountId':_0x345388['id'],'WhatsappInteractionId':_0x1d7921['id'],'UserId':_0x4a7be8[_0x5ae3('0x5a')]['id'],'ContactId':_0x39b6fd['id']}))['then'](function(_0x5e2256){_0x1d7921[_0x5ae3('0xba')][_0x5ae3('0xb9')]=[];_0x1d7921[_0x5ae3('0xba')][_0x5ae3('0xb9')][_0x5ae3('0xa0')](_0x5e2256[_0x5ae3('0xba')]);return _0x1d7921;});})[_0x5ae3('0x32')](respondWithResult(_0xe73bc8,null))[_0x5ae3('0x24')](handleError(_0xe73bc8,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 8af8aba..24fcf51 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 _0xa26a=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappAccount','save'];(function(_0x71e493,_0x4308b7){var _0x3d40ab=function(_0x29715){while(--_0x29715){_0x71e493['push'](_0x71e493['shift']());}};_0x3d40ab(++_0x4308b7);}(_0xa26a,0x18c));var _0xaa26=function(_0x4288da,_0x13acaf){_0x4288da=_0x4288da-0x0;var _0x5a4fa8=_0xa26a[_0x4288da];return _0x5a4fa8;};'use strict';var EventEmitter=require(_0xaa26('0x0'));var WhatsappAccount=require(_0xaa26('0x1'))['db'][_0xaa26('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xaa26('0x3'),'afterUpdate':_0xaa26('0x4'),'afterDestroy':_0xaa26('0x5')};function emitEvent(_0x1f31cb){return function(_0x121841,_0x265fe6,_0x9836e0){WhatsappAccountEvents['emit'](_0x1f31cb+':'+_0x121841['id'],_0x121841);WhatsappAccountEvents[_0xaa26('0x6')](_0x1f31cb,_0x121841);_0x9836e0(null);};}for(var e in events){if(events[_0xaa26('0x7')](e)){var event=events[e];WhatsappAccount[_0xaa26('0x8')](e,emitEvent(event));}}module[_0xaa26('0x9')]=WhatsappAccountEvents; \ No newline at end of file +var _0x25af=['../../mysqldb','WhatsappAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x50745e,_0x4722a9){var _0x17886c=function(_0x49a8e9){while(--_0x49a8e9){_0x50745e['push'](_0x50745e['shift']());}};_0x17886c(++_0x4722a9);}(_0x25af,0x11d));var _0xf25a=function(_0x14c264,_0x43f982){_0x14c264=_0x14c264-0x0;var _0xe1519c=_0x25af[_0x14c264];return _0xe1519c;};'use strict';var EventEmitter=require(_0xf25a('0x0'));var WhatsappAccount=require(_0xf25a('0x1'))['db'][_0xf25a('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xf25a('0x3')](0x0);var events={'afterCreate':_0xf25a('0x4'),'afterUpdate':_0xf25a('0x5'),'afterDestroy':_0xf25a('0x6')};function emitEvent(_0x5f055a){return function(_0x5cd475,_0x791411,_0x250ae9){WhatsappAccountEvents[_0xf25a('0x7')](_0x5f055a+':'+_0x5cd475['id'],_0x5cd475);WhatsappAccountEvents['emit'](_0x5f055a,_0x5cd475);_0x250ae9(null);};}for(var e in events){if(events[_0xf25a('0x8')](e)){var event=events[e];WhatsappAccount[_0xf25a('0x9')](e,emitEvent(event));}}module[_0xf25a('0xa')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index a7d62f9..81c78ee 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 _0x2366=['lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','whatsapp_accounts'];(function(_0x311374,_0x132c28){var _0x1bf041=function(_0x97fff2){while(--_0x97fff2){_0x311374['push'](_0x311374['shift']());}};_0x1bf041(++_0x132c28);}(_0x2366,0x160));var _0x6236=function(_0x127783,_0x258715){_0x127783=_0x127783-0x0;var _0x14f298=_0x2366[_0x127783];return _0x14f298;};'use strict';var _=require(_0x6236('0x0'));var util=require('util');var logger=require(_0x6236('0x1'))(_0x6236('0x2'));var moment=require('moment');var BPromise=require(_0x6236('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6236('0x4'));var rimraf=require(_0x6236('0x5'));var config=require(_0x6236('0x6'));var attributes=require(_0x6236('0x7'));module[_0x6236('0x8')]=function(_0x3218d2,_0x279de0){return _0x3218d2[_0x6236('0x9')]('WhatsappAccount',attributes,{'tableName':_0x6236('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc6af=['../../config/environment','./whatsappAccount.attributes','exports','WhatsappAccount','whatsapp_accounts','lodash','util','api','moment','bluebird','request-promise','rimraf'];(function(_0x39da4a,_0x936a2c){var _0x478f8f=function(_0x44dea9){while(--_0x44dea9){_0x39da4a['push'](_0x39da4a['shift']());}};_0x478f8f(++_0x936a2c);}(_0xc6af,0xe9));var _0xfc6a=function(_0x32234e,_0x2391c4){_0x32234e=_0x32234e-0x0;var _0x558436=_0xc6af[_0x32234e];return _0x558436;};'use strict';var _=require(_0xfc6a('0x0'));var util=require(_0xfc6a('0x1'));var logger=require('../../config/logger')(_0xfc6a('0x2'));var moment=require(_0xfc6a('0x3'));var BPromise=require(_0xfc6a('0x4'));var rp=require(_0xfc6a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfc6a('0x6'));var config=require(_0xfc6a('0x7'));var attributes=require(_0xfc6a('0x8'));module[_0xfc6a('0x9')]=function(_0xaa57d4,_0x470b05){return _0xaa57d4['define'](_0xfc6a('0xa'),attributes,{'tableName':_0xfc6a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 3815c45..10fcb46 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 _0x57e9=['jayson/promise','client','http','redis','socket.io-emitter','./whatsappAccount.socket','register','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','where','attributes','include','map','model','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment'];(function(_0x10f9f9,_0x3b21c6){var _0x5ae7a8=function(_0x122a16){while(--_0x122a16){_0x10f9f9['push'](_0x10f9f9['shift']());}};_0x5ae7a8(++_0x3b21c6);}(_0x57e9,0x12b));var _0x957e=function(_0x38c3df,_0x5630c9){_0x38c3df=_0x38c3df-0x0;var _0x3a3dcb=_0x57e9[_0x38c3df];return _0x3a3dcb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x957e('0x0'));var BPromise=require(_0x957e('0x1'));var rs=require(_0x957e('0x2'));var fs=require('fs');var Redis=require(_0x957e('0x3'));var db=require(_0x957e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x957e('0x5'))('rpc');var config=require(_0x957e('0x6'));var jayson=require(_0x957e('0x7'));var client=jayson[_0x957e('0x8')][_0x957e('0x9')]({'port':0x232a});config[_0x957e('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x957e('0xb'))(new Redis(config[_0x957e('0xa')]));require(_0x957e('0xc'))[_0x957e('0xd')](socket);function respondWithRpcPromise(_0x4e4f32,_0x265185,_0x226f8a){return new BPromise(function(_0x421de3,_0x276060){return client['request'](_0x4e4f32,_0x226f8a)[_0x957e('0xe')](function(_0x34da6e){logger['info'](_0x957e('0xf'),_0x265185,_0x957e('0x10'));logger[_0x957e('0x11')](_0x957e('0x12'),_0x265185,_0x957e('0x10'),JSON[_0x957e('0x13')](_0x34da6e));if(_0x34da6e['error']){if(_0x34da6e['error']['code']===0x1f4){logger[_0x957e('0x14')](_0x957e('0xf'),_0x265185,_0x34da6e[_0x957e('0x14')][_0x957e('0x15')]);return _0x276060(_0x34da6e[_0x957e('0x14')][_0x957e('0x15')]);}logger[_0x957e('0x14')](_0x957e('0xf'),_0x265185,_0x34da6e[_0x957e('0x14')][_0x957e('0x15')]);return _0x421de3(_0x34da6e[_0x957e('0x14')][_0x957e('0x15')]);}else{logger[_0x957e('0x16')](_0x957e('0xf'),_0x265185,'request\x20sent');_0x421de3(_0x34da6e[_0x957e('0x17')][_0x957e('0x15')]);}})[_0x957e('0x18')](function(_0x22ec8b){logger['error'](_0x957e('0xf'),_0x265185,_0x22ec8b);_0x276060(_0x22ec8b);});});}exports[_0x957e('0x19')]=function(_0x586e91){var _0x4d9455=this;return new Promise(function(_0x412a5c,_0x129313){return db[_0x957e('0x1a')][_0x957e('0x1b')]({'raw':_0x586e91[_0x957e('0x1c')]?_0x586e91['options']['raw']===undefined?!![]:![]:!![],'where':_0x586e91[_0x957e('0x1c')]?_0x586e91['options'][_0x957e('0x1d')]||null:null,'attributes':_0x586e91[_0x957e('0x1c')]?_0x586e91['options'][_0x957e('0x1e')]||null:null,'include':_0x586e91[_0x957e('0x1c')]?_0x586e91[_0x957e('0x1c')][_0x957e('0x1f')]?_[_0x957e('0x20')](_0x586e91[_0x957e('0x1c')][_0x957e('0x1f')],function(_0x2c1414){return{'model':db[_0x2c1414[_0x957e('0x21')]],'as':_0x2c1414['as'],'attributes':_0x2c1414[_0x957e('0x1e')],'include':_0x2c1414[_0x957e('0x1f')]?_[_0x957e('0x20')](_0x2c1414[_0x957e('0x1f')],function(_0x2d4e63){return{'model':db[_0x2d4e63[_0x957e('0x21')]],'as':_0x2d4e63['as'],'attributes':_0x2d4e63[_0x957e('0x1e')],'include':_0x2d4e63[_0x957e('0x1f')]?_['map'](_0x2d4e63['include'],function(_0x1eb56b){return{'model':db[_0x1eb56b['model']],'as':_0x1eb56b['as'],'attributes':_0x1eb56b[_0x957e('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x55f226){logger[_0x957e('0x16')]('ShowWhatsappAccount',_0x586e91);logger[_0x957e('0x11')](_0x957e('0x19'),_0x586e91,JSON['stringify'](_0x55f226));_0x412a5c(_0x55f226);})[_0x957e('0x18')](function(_0x38eaa0){logger[_0x957e('0x14')](_0x957e('0x19'),_0x38eaa0[_0x957e('0x15')],_0x586e91);_0x129313(_0x4d9455[_0x957e('0x14')](0x1f4,_0x38eaa0[_0x957e('0x15')]));});});}; \ No newline at end of file +var _0x0f2a=['options','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./whatsappAccount.socket','register','then','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find'];(function(_0x48fde6,_0x25872f){var _0x4f22a4=function(_0x5b7125){while(--_0x5b7125){_0x48fde6['push'](_0x48fde6['shift']());}};_0x4f22a4(++_0x25872f);}(_0x0f2a,0x12e));var _0xa0f2=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0f2a[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xa0f2('0x0'));var util=require(_0xa0f2('0x1'));var moment=require(_0xa0f2('0x2'));var BPromise=require(_0xa0f2('0x3'));var rs=require(_0xa0f2('0x4'));var fs=require('fs');var Redis=require(_0xa0f2('0x5'));var db=require(_0xa0f2('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa0f2('0x7'))(_0xa0f2('0x8'));var config=require(_0xa0f2('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa0f2('0xa')][_0xa0f2('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xa0f2('0xc')],{'host':_0xa0f2('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa0f2('0xc')]));require(_0xa0f2('0xe'))[_0xa0f2('0xf')](socket);function respondWithRpcPromise(_0x837566,_0x2234ba,_0x24032d){return new BPromise(function(_0x179249,_0x197935){return client['request'](_0x837566,_0x24032d)[_0xa0f2('0x10')](function(_0x144675){logger[_0xa0f2('0x11')]('WhatsappAccount,\x20%s,\x20%s',_0x2234ba,_0xa0f2('0x12'));logger[_0xa0f2('0x13')](_0xa0f2('0x14'),_0x2234ba,_0xa0f2('0x12'),JSON[_0xa0f2('0x15')](_0x144675));if(_0x144675[_0xa0f2('0x16')]){if(_0x144675['error'][_0xa0f2('0x17')]===0x1f4){logger[_0xa0f2('0x16')](_0xa0f2('0x18'),_0x2234ba,_0x144675[_0xa0f2('0x16')]['message']);return _0x197935(_0x144675[_0xa0f2('0x16')][_0xa0f2('0x19')]);}logger[_0xa0f2('0x16')](_0xa0f2('0x18'),_0x2234ba,_0x144675['error'][_0xa0f2('0x19')]);return _0x179249(_0x144675[_0xa0f2('0x16')]['message']);}else{logger[_0xa0f2('0x11')](_0xa0f2('0x18'),_0x2234ba,'request\x20sent');_0x179249(_0x144675[_0xa0f2('0x1a')][_0xa0f2('0x19')]);}})[_0xa0f2('0x1b')](function(_0x39e262){logger[_0xa0f2('0x16')](_0xa0f2('0x18'),_0x2234ba,_0x39e262);_0x197935(_0x39e262);});});}exports[_0xa0f2('0x1c')]=function(_0x1017fb){var _0x12badd=this;return new Promise(function(_0x4a62f5,_0x263802){return db[_0xa0f2('0x1d')][_0xa0f2('0x1e')]({'raw':_0x1017fb['options']?_0x1017fb[_0xa0f2('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x1017fb[_0xa0f2('0x1f')]?_0x1017fb['options'][_0xa0f2('0x20')]||null:null,'attributes':_0x1017fb[_0xa0f2('0x1f')]?_0x1017fb[_0xa0f2('0x1f')][_0xa0f2('0x21')]||null:null,'include':_0x1017fb[_0xa0f2('0x1f')]?_0x1017fb['options'][_0xa0f2('0x22')]?_[_0xa0f2('0x23')](_0x1017fb[_0xa0f2('0x1f')][_0xa0f2('0x22')],function(_0x9cc128){return{'model':db[_0x9cc128[_0xa0f2('0x24')]],'as':_0x9cc128['as'],'attributes':_0x9cc128[_0xa0f2('0x21')],'include':_0x9cc128[_0xa0f2('0x22')]?_[_0xa0f2('0x23')](_0x9cc128['include'],function(_0x8faba9){return{'model':db[_0x8faba9[_0xa0f2('0x24')]],'as':_0x8faba9['as'],'attributes':_0x8faba9[_0xa0f2('0x21')],'include':_0x8faba9[_0xa0f2('0x22')]?_['map'](_0x8faba9[_0xa0f2('0x22')],function(_0x529cdb){return{'model':db[_0x529cdb[_0xa0f2('0x24')]],'as':_0x529cdb['as'],'attributes':_0x529cdb[_0xa0f2('0x21')]};}):[]};}):[]};}):[]:[]})[_0xa0f2('0x10')](function(_0x4b8005){logger['info'](_0xa0f2('0x1c'),_0x1017fb);logger[_0xa0f2('0x13')](_0xa0f2('0x1c'),_0x1017fb,JSON[_0xa0f2('0x15')](_0x4b8005));_0x4a62f5(_0x4b8005);})[_0xa0f2('0x1b')](function(_0xb2458d){logger[_0xa0f2('0x16')](_0xa0f2('0x1c'),_0xb2458d['message'],_0x1017fb);_0x263802(_0x12badd['error'](0x1f4,_0xb2458d[_0xa0f2('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index b7ac51b..1b328be 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 _0x7878=['register','length','whatsappAccount:','./whatsappAccount.events','save','remove','update','emit'];(function(_0x21ab67,_0x151ee5){var _0x581067=function(_0xd89adf){while(--_0xd89adf){_0x21ab67['push'](_0x21ab67['shift']());}};_0x581067(++_0x151ee5);}(_0x7878,0xab));var _0x8787=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7878[_0x3dd15e];return _0x231fd0;};'use strict';var WhatsappAccountEvents=require(_0x8787('0x0'));var events=[_0x8787('0x1'),_0x8787('0x2'),_0x8787('0x3')];function createListener(_0x19823a,_0x1d68a1){return function(_0x586d47){_0x1d68a1[_0x8787('0x4')](_0x19823a,_0x586d47);};}function removeListener(_0x4c1ed2,_0x1bc6f7){return function(){WhatsappAccountEvents['removeListener'](_0x4c1ed2,_0x1bc6f7);};}exports[_0x8787('0x5')]=function(_0x10b86e){for(var _0x2c1afe=0x0,_0x1ff213=events[_0x8787('0x6')];_0x2c1afe<_0x1ff213;_0x2c1afe++){var _0x5936fd=events[_0x2c1afe];var _0x5c4bf3=createListener(_0x8787('0x7')+_0x5936fd,_0x10b86e);WhatsappAccountEvents['on'](_0x5936fd,_0x5c4bf3);}}; \ No newline at end of file +var _0x6cee=['register','length','./whatsappAccount.events','save','remove','update','emit','removeListener'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x6cee,0x1f2));var _0xe6ce=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0x6cee[_0xf0bcac];return _0x4e4c65;};'use strict';var WhatsappAccountEvents=require(_0xe6ce('0x0'));var events=[_0xe6ce('0x1'),_0xe6ce('0x2'),_0xe6ce('0x3')];function createListener(_0xee05ec,_0x46c499){return function(_0xcf4610){_0x46c499[_0xe6ce('0x4')](_0xee05ec,_0xcf4610);};}function removeListener(_0x2491a8,_0x386ed3){return function(){WhatsappAccountEvents[_0xe6ce('0x5')](_0x2491a8,_0x386ed3);};}exports[_0xe6ce('0x6')]=function(_0xc76943){for(var _0x455fad=0x0,_0x2add3d=events[_0xe6ce('0x7')];_0x455fad<_0x2add3d;_0x455fad++){var _0x1b0776=events[_0x455fad];var _0x1681cd=createListener('whatsappAccount:'+_0x1b0776,_0xc76943);WhatsappAccountEvents['on'](_0x1b0776,_0x1681cd);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 0a54dd0..bf2214e 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 _0x90fe=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./whatsappApplication.controller','isAuthenticated','get','/:id','show','create','put','update'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x90fe,0x144));var _0xe90f=function(_0xcab1ec,_0x3884a6){_0xcab1ec=_0xcab1ec-0x0;var _0x5d29fa=_0x90fe[_0xcab1ec];return _0x5d29fa;};'use strict';var multer=require(_0xe90f('0x0'));var util=require(_0xe90f('0x1'));var path=require(_0xe90f('0x2'));var timeout=require(_0xe90f('0x3'));var express=require(_0xe90f('0x4'));var router=express[_0xe90f('0x5')]();var fs_extra=require(_0xe90f('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe90f('0x7'));var controller=require(_0xe90f('0x8'));router['get']('/',auth[_0xe90f('0x9')](),controller['index']);router[_0xe90f('0xa')](_0xe90f('0xb'),auth[_0xe90f('0x9')](),controller[_0xe90f('0xc')]);router['post']('/',auth[_0xe90f('0x9')](),controller[_0xe90f('0xd')]);router[_0xe90f('0xe')](_0xe90f('0xb'),auth[_0xe90f('0x9')](),controller[_0xe90f('0xf')]);router['delete'](_0xe90f('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xe90f('0x10')]=router; \ No newline at end of file +var _0x2eb2=['util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','create','update','delete','destroy','multer'];(function(_0x2b56b2,_0x3d6de0){var _0x29145b=function(_0x357348){while(--_0x357348){_0x2b56b2['push'](_0x2b56b2['shift']());}};_0x29145b(++_0x3d6de0);}(_0x2eb2,0x131));var _0x22eb=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0x2eb2[_0x54d4a8];return _0x3b321b;};'use strict';var multer=require(_0x22eb('0x0'));var util=require(_0x22eb('0x1'));var path=require('path');var timeout=require(_0x22eb('0x2'));var express=require(_0x22eb('0x3'));var router=express[_0x22eb('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x22eb('0x5'));var config=require(_0x22eb('0x6'));var controller=require('./whatsappApplication.controller');router['get']('/',auth[_0x22eb('0x7')](),controller[_0x22eb('0x8')]);router[_0x22eb('0x9')](_0x22eb('0xa'),auth['isAuthenticated'](),controller[_0x22eb('0xb')]);router[_0x22eb('0xc')]('/',auth[_0x22eb('0x7')](),controller[_0x22eb('0xd')]);router['put'](_0x22eb('0xa'),auth[_0x22eb('0x7')](),controller[_0x22eb('0xe')]);router[_0x22eb('0xf')](_0x22eb('0xa'),auth[_0x22eb('0x7')](),controller[_0x22eb('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index adb9f5b..104a04a 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 _0xb2d8=['STRING','TEXT','*,*,*,*','sequelize'];(function(_0x35ef11,_0xb01a39){var _0x1a0083=function(_0x2f33b3){while(--_0x2f33b3){_0x35ef11['push'](_0x35ef11['shift']());}};_0x1a0083(++_0xb01a39);}(_0xb2d8,0x6b));var _0x8b2d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb2d8[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x8b2d('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x8b2d('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x8b2d('0x2')]()},'description':{'type':Sequelize[_0x8b2d('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x8b2d('0x3')}}; \ No newline at end of file +var _0xf413=['*,*,*,*','sequelize','exports','STRING','TEXT'];(function(_0x3e8896,_0x186c45){var _0x1dc4e1=function(_0x3af2c9){while(--_0x3af2c9){_0x3e8896['push'](_0x3e8896['shift']());}};_0x1dc4e1(++_0x186c45);}(_0xf413,0xfb));var _0x3f41=function(_0x43ad6b,_0x40d78a){_0x43ad6b=_0x43ad6b-0x0;var _0x1c39d8=_0xf413[_0x43ad6b];return _0x1c39d8;};'use strict';var Sequelize=require(_0x3f41('0x0'));module[_0x3f41('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x3f41('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x3f41('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x3f41('0x2')],'defaultValue':_0x3f41('0x4')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index ef3fa55..e422ab5 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 _0xb6a6=['bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','set','Content-Range','update','then','destroy','sendStatus','error','send','index','map','WhatsappApplication','rawAttributes','type','name','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','find','body','params','eml-format','rimraf','request-promise','moment'];(function(_0x3bbf44,_0x47758e){var _0x2ba39a=function(_0x24a62c){while(--_0x24a62c){_0x3bbf44['push'](_0x3bbf44['shift']());}};_0x2ba39a(++_0x47758e);}(_0xb6a6,0x1a0));var _0x6b6a=function(_0x16a4ff,_0x2745b7){_0x16a4ff=_0x16a4ff-0x0;var _0x560703=_0xb6a6[_0x16a4ff];return _0x560703;};'use strict';var emlformat=require(_0x6b6a('0x0'));var rimraf=require(_0x6b6a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6b6a('0x2'));var moment=require(_0x6b6a('0x3'));var BPromise=require(_0x6b6a('0x4'));var Mustache=require(_0x6b6a('0x5'));var util=require(_0x6b6a('0x6'));var path=require('path');var sox=require(_0x6b6a('0x7'));var csv=require(_0x6b6a('0x8'));var ejs=require(_0x6b6a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6b6a('0xa'));var squel=require(_0x6b6a('0xb'));var crypto=require('crypto');var jsforce=require(_0x6b6a('0xc'));var deskjs=require(_0x6b6a('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6b6a('0xe'));var Papa=require('papaparse');var Redis=require(_0x6b6a('0xf'));var authService=require(_0x6b6a('0x10'));var qs=require(_0x6b6a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b6a('0x12'))(_0x6b6a('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6b6a('0x14'));var db=require(_0x6b6a('0x15'))['db'];function respondWithStatusCode(_0x51aad7,_0x2d5a9a){_0x2d5a9a=_0x2d5a9a||0xcc;return function(_0x2e09da){if(_0x2e09da){return _0x51aad7['sendStatus'](_0x2d5a9a);}return _0x51aad7[_0x6b6a('0x16')](_0x2d5a9a)[_0x6b6a('0x17')]();};}function respondWithResult(_0x57ac41,_0x1a4a6d){_0x1a4a6d=_0x1a4a6d||0xc8;return function(_0xd5a6a4){if(_0xd5a6a4){return _0x57ac41[_0x6b6a('0x16')](_0x1a4a6d)[_0x6b6a('0x18')](_0xd5a6a4);}};}function respondWithFilteredResult(_0x56dc6a,_0x6155e8){return function(_0x3b58cb){if(_0x3b58cb){var _0x4f7600=typeof _0x6155e8[_0x6b6a('0x19')]===_0x6b6a('0x1a')&&typeof _0x6155e8[_0x6b6a('0x1b')]===_0x6b6a('0x1a');var _0x2a726d=_0x3b58cb['count'];var _0x36c02e=_0x4f7600?0x0:_0x6155e8[_0x6b6a('0x19')];var _0x3b7181=_0x4f7600?_0x3b58cb['count']:_0x6155e8[_0x6b6a('0x19')]+_0x6155e8['limit'];var _0x27250e;if(_0x3b7181>=_0x2a726d){_0x3b7181=_0x2a726d;_0x27250e=0xc8;}else{_0x27250e=0xce;}_0x56dc6a[_0x6b6a('0x16')](_0x27250e);return _0x56dc6a[_0x6b6a('0x1c')](_0x6b6a('0x1d'),_0x36c02e+'-'+_0x3b7181+'/'+_0x2a726d)[_0x6b6a('0x18')](_0x3b58cb);}return null;};}function patchUpdates(_0x455ff1){return function(_0x5963d4){try{jsonpatch['apply'](_0x5963d4,_0x455ff1,!![]);}catch(_0x3a7e48){return BPromise['reject'](_0x3a7e48);}return _0x5963d4['save']();};}function saveUpdates(_0x1edaf0,_0x4c29eb){return function(_0x7f44b1){if(_0x7f44b1){return _0x7f44b1[_0x6b6a('0x1e')](_0x1edaf0)[_0x6b6a('0x1f')](function(_0x26e9a3){return _0x26e9a3;});}return null;};}function removeEntity(_0x37a295,_0xcea9de){return function(_0x478e82){if(_0x478e82){return _0x478e82[_0x6b6a('0x20')]()['then'](function(){_0x37a295['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1730ea,_0x555e63){return function(_0x1807ee){if(!_0x1807ee){_0x1730ea[_0x6b6a('0x21')](0x194);}return _0x1807ee;};}function handleError(_0x56f08f,_0xab14d9){_0xab14d9=_0xab14d9||0x1f4;return function(_0x5ea698){logger[_0x6b6a('0x22')](_0x5ea698['stack']);if(_0x5ea698['name']){delete _0x5ea698['name'];}_0x56f08f[_0x6b6a('0x16')](_0xab14d9)[_0x6b6a('0x23')](_0x5ea698);};}exports[_0x6b6a('0x24')]=function(_0x530e31,_0xa6ce4b){var _0x5170a5={},_0x12a4d2={},_0x11a24e={'count':0x0,'rows':[]};var _0x313f20=_[_0x6b6a('0x25')](db[_0x6b6a('0x26')][_0x6b6a('0x27')],function(_0x56a89e){return{'name':_0x56a89e['fieldName'],'type':_0x56a89e[_0x6b6a('0x28')]['key']};});_0x12a4d2['model']=_['map'](_0x313f20,_0x6b6a('0x29'));_0x12a4d2[_0x6b6a('0x2a')]=_[_0x6b6a('0x2b')](_0x530e31[_0x6b6a('0x2a')]);_0x12a4d2[_0x6b6a('0x2c')]=_[_0x6b6a('0x2d')](_0x12a4d2[_0x6b6a('0x2e')],_0x12a4d2[_0x6b6a('0x2a')]);_0x5170a5[_0x6b6a('0x2f')]=_[_0x6b6a('0x2d')](_0x12a4d2[_0x6b6a('0x2e')],qs[_0x6b6a('0x30')](_0x530e31['query'][_0x6b6a('0x30')]));_0x5170a5[_0x6b6a('0x2f')]=_0x5170a5[_0x6b6a('0x2f')][_0x6b6a('0x31')]?_0x5170a5[_0x6b6a('0x2f')]:_0x12a4d2[_0x6b6a('0x2e')];if(!_0x530e31['query'][_0x6b6a('0x32')](_0x6b6a('0x33'))){_0x5170a5[_0x6b6a('0x1b')]=qs['limit'](_0x530e31[_0x6b6a('0x2a')][_0x6b6a('0x1b')]);_0x5170a5[_0x6b6a('0x19')]=qs[_0x6b6a('0x19')](_0x530e31[_0x6b6a('0x2a')]['offset']);}_0x5170a5[_0x6b6a('0x34')]=qs['sort'](_0x530e31[_0x6b6a('0x2a')][_0x6b6a('0x35')]);_0x5170a5[_0x6b6a('0x36')]=qs[_0x6b6a('0x2c')](_[_0x6b6a('0x37')](_0x530e31[_0x6b6a('0x2a')],_0x12a4d2[_0x6b6a('0x2c')]),_0x313f20);if(_0x530e31[_0x6b6a('0x2a')][_0x6b6a('0x38')]){_0x5170a5['where']=_[_0x6b6a('0x39')](_0x5170a5[_0x6b6a('0x36')],{'$or':_[_0x6b6a('0x25')](_0x313f20,function(_0x3159d6){if(_0x3159d6[_0x6b6a('0x28')]!==_0x6b6a('0x3a')){var _0x2a7425={};_0x2a7425[_0x3159d6[_0x6b6a('0x29')]]={'$like':'%'+_0x530e31[_0x6b6a('0x2a')][_0x6b6a('0x38')]+'%'};return _0x2a7425;}})});}_0x5170a5=_[_0x6b6a('0x39')]({},_0x5170a5,_0x530e31[_0x6b6a('0x3b')]);var _0xca8354={'where':_0x5170a5[_0x6b6a('0x36')]};return db[_0x6b6a('0x26')]['count'](_0xca8354)[_0x6b6a('0x1f')](function(_0x691085){_0x11a24e[_0x6b6a('0x3c')]=_0x691085;if(_0x530e31[_0x6b6a('0x2a')][_0x6b6a('0x3d')]){_0x5170a5[_0x6b6a('0x3e')]=[{'all':!![]}];}return db[_0x6b6a('0x26')][_0x6b6a('0x3f')](_0x5170a5);})['then'](function(_0x2d4cd1){_0x11a24e[_0x6b6a('0x40')]=_0x2d4cd1;return _0x11a24e;})['then'](respondWithFilteredResult(_0xa6ce4b,_0x5170a5))[_0x6b6a('0x41')](handleError(_0xa6ce4b,null));};exports[_0x6b6a('0x42')]=function(_0x32fac2,_0x2b72c6){var _0x14c4d1={'raw':!![],'where':{'id':_0x32fac2['params']['id']}},_0x2465ec={};_0x2465ec[_0x6b6a('0x2e')]=_[_0x6b6a('0x2b')](db[_0x6b6a('0x26')]['rawAttributes']);_0x2465ec[_0x6b6a('0x2a')]=_['keys'](_0x32fac2['query']);_0x2465ec[_0x6b6a('0x2c')]=_['intersection'](_0x2465ec['model'],_0x2465ec[_0x6b6a('0x2a')]);_0x14c4d1[_0x6b6a('0x2f')]=_['intersection'](_0x2465ec[_0x6b6a('0x2e')],qs[_0x6b6a('0x30')](_0x32fac2['query'][_0x6b6a('0x30')]));_0x14c4d1[_0x6b6a('0x2f')]=_0x14c4d1[_0x6b6a('0x2f')]['length']?_0x14c4d1[_0x6b6a('0x2f')]:_0x2465ec['model'];if(_0x32fac2[_0x6b6a('0x2a')][_0x6b6a('0x3d')]){_0x14c4d1['include']=[{'all':!![]}];}_0x14c4d1=_[_0x6b6a('0x39')]({},_0x14c4d1,_0x32fac2[_0x6b6a('0x3b')]);return db[_0x6b6a('0x26')][_0x6b6a('0x43')](_0x14c4d1)[_0x6b6a('0x1f')](handleEntityNotFound(_0x2b72c6,null))[_0x6b6a('0x1f')](respondWithResult(_0x2b72c6,null))['catch'](handleError(_0x2b72c6,null));};exports['create']=function(_0x458292,_0x8e3404){return db[_0x6b6a('0x26')]['create'](_0x458292[_0x6b6a('0x44')],{})[_0x6b6a('0x1f')](respondWithResult(_0x8e3404,0xc9))[_0x6b6a('0x41')](handleError(_0x8e3404,null));};exports[_0x6b6a('0x1e')]=function(_0x3b2310,_0x3d42f3){if(_0x3b2310[_0x6b6a('0x44')]['id']){delete _0x3b2310[_0x6b6a('0x44')]['id'];}return db[_0x6b6a('0x26')][_0x6b6a('0x43')]({'where':{'id':_0x3b2310[_0x6b6a('0x45')]['id']}})['then'](handleEntityNotFound(_0x3d42f3,null))[_0x6b6a('0x1f')](saveUpdates(_0x3b2310['body'],null))[_0x6b6a('0x1f')](respondWithResult(_0x3d42f3,null))['catch'](handleError(_0x3d42f3,null));};exports['destroy']=function(_0x5b63b3,_0x38f77f){return db['WhatsappApplication']['find']({'where':{'id':_0x5b63b3['params']['id']}})[_0x6b6a('0x1f')](handleEntityNotFound(_0x38f77f,null))[_0x6b6a('0x1f')](removeEntity(_0x38f77f,null))[_0x6b6a('0x41')](handleError(_0x38f77f,null));}; \ No newline at end of file +var _0xaa64=['type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','includeAll','findAll','rows','catch','show','params','keys','find','create','body','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','WhatsappApplication','rawAttributes'];(function(_0x237674,_0x2e8cf3){var _0x3f8880=function(_0x42089a){while(--_0x42089a){_0x237674['push'](_0x237674['shift']());}};_0x3f8880(++_0x2e8cf3);}(_0xaa64,0xf7));var _0x4aa6=function(_0x229f85,_0x57b6e6){_0x229f85=_0x229f85-0x0;var _0x425c85=_0xaa64[_0x229f85];return _0x425c85;};'use strict';var emlformat=require(_0x4aa6('0x0'));var rimraf=require(_0x4aa6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4aa6('0x2'));var rp=require('request-promise');var moment=require(_0x4aa6('0x3'));var BPromise=require(_0x4aa6('0x4'));var Mustache=require(_0x4aa6('0x5'));var util=require('util');var path=require(_0x4aa6('0x6'));var sox=require(_0x4aa6('0x7'));var csv=require(_0x4aa6('0x8'));var ejs=require(_0x4aa6('0x9'));var fs=require('fs');var fs_extra=require(_0x4aa6('0xa'));var _=require(_0x4aa6('0xb'));var squel=require(_0x4aa6('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4aa6('0xd'));var toCsv=require(_0x4aa6('0x8'));var querystring=require('querystring');var Papa=require(_0x4aa6('0xe'));var Redis=require('ioredis');var authService=require(_0x4aa6('0xf'));var qs=require(_0x4aa6('0x10'));var as=require(_0x4aa6('0x11'));var hardwareService=require(_0x4aa6('0x12'));var logger=require('../../config/logger')(_0x4aa6('0x13'));var utils=require(_0x4aa6('0x14'));var config=require(_0x4aa6('0x15'));var licenseUtil=require(_0x4aa6('0x16'));var db=require(_0x4aa6('0x17'))['db'];function respondWithStatusCode(_0xa8dd06,_0x32401e){_0x32401e=_0x32401e||0xcc;return function(_0x14a12a){if(_0x14a12a){return _0xa8dd06[_0x4aa6('0x18')](_0x32401e);}return _0xa8dd06[_0x4aa6('0x19')](_0x32401e)['end']();};}function respondWithResult(_0x413222,_0x5b0133){_0x5b0133=_0x5b0133||0xc8;return function(_0x561f5d){if(_0x561f5d){return _0x413222[_0x4aa6('0x19')](_0x5b0133)[_0x4aa6('0x1a')](_0x561f5d);}};}function respondWithFilteredResult(_0x326953,_0x11e4d7){return function(_0x375c09){if(_0x375c09){var _0x238f10=typeof _0x11e4d7[_0x4aa6('0x1b')]===_0x4aa6('0x1c')&&typeof _0x11e4d7['limit']===_0x4aa6('0x1c');var _0x5458ad=_0x375c09[_0x4aa6('0x1d')];var _0x5c6d3c=_0x238f10?0x0:_0x11e4d7['offset'];var _0x266707=_0x238f10?_0x375c09[_0x4aa6('0x1d')]:_0x11e4d7[_0x4aa6('0x1b')]+_0x11e4d7[_0x4aa6('0x1e')];var _0x2aa5d7;if(_0x266707>=_0x5458ad){_0x266707=_0x5458ad;_0x2aa5d7=0xc8;}else{_0x2aa5d7=0xce;}_0x326953[_0x4aa6('0x19')](_0x2aa5d7);return _0x326953[_0x4aa6('0x1f')](_0x4aa6('0x20'),_0x5c6d3c+'-'+_0x266707+'/'+_0x5458ad)[_0x4aa6('0x1a')](_0x375c09);}return null;};}function patchUpdates(_0x4c9159){return function(_0x313e73){try{jsonpatch[_0x4aa6('0x21')](_0x313e73,_0x4c9159,!![]);}catch(_0x9a1a7e){return BPromise[_0x4aa6('0x22')](_0x9a1a7e);}return _0x313e73[_0x4aa6('0x23')]();};}function saveUpdates(_0x1e121f,_0x594665){return function(_0xa0f5be){if(_0xa0f5be){return _0xa0f5be[_0x4aa6('0x24')](_0x1e121f)[_0x4aa6('0x25')](function(_0x3af19f){return _0x3af19f;});}return null;};}function removeEntity(_0xa18442,_0x44d151){return function(_0x568a5c){if(_0x568a5c){return _0x568a5c[_0x4aa6('0x26')]()[_0x4aa6('0x25')](function(){_0xa18442['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x347856,_0x109a7c){return function(_0x3efa6b){if(!_0x3efa6b){_0x347856[_0x4aa6('0x18')](0x194);}return _0x3efa6b;};}function handleError(_0x2001ce,_0x5e53a7){_0x5e53a7=_0x5e53a7||0x1f4;return function(_0x44c6cf){logger[_0x4aa6('0x27')](_0x44c6cf[_0x4aa6('0x28')]);if(_0x44c6cf[_0x4aa6('0x29')]){delete _0x44c6cf[_0x4aa6('0x29')];}_0x2001ce[_0x4aa6('0x19')](_0x5e53a7)['send'](_0x44c6cf);};}exports[_0x4aa6('0x2a')]=function(_0x41bdc8,_0x5bc756){var _0x149c9a={},_0x121b97={},_0x2b629e={'count':0x0,'rows':[]};var _0x1fe9cb=_['map'](db[_0x4aa6('0x2b')][_0x4aa6('0x2c')],function(_0x3646c8){return{'name':_0x3646c8['fieldName'],'type':_0x3646c8[_0x4aa6('0x2d')][_0x4aa6('0x2e')]};});_0x121b97[_0x4aa6('0x2f')]=_['map'](_0x1fe9cb,_0x4aa6('0x29'));_0x121b97[_0x4aa6('0x30')]=_['keys'](_0x41bdc8[_0x4aa6('0x30')]);_0x121b97[_0x4aa6('0x31')]=_[_0x4aa6('0x32')](_0x121b97[_0x4aa6('0x2f')],_0x121b97[_0x4aa6('0x30')]);_0x149c9a['attributes']=_['intersection'](_0x121b97[_0x4aa6('0x2f')],qs[_0x4aa6('0x33')](_0x41bdc8[_0x4aa6('0x30')]['fields']));_0x149c9a['attributes']=_0x149c9a[_0x4aa6('0x34')][_0x4aa6('0x35')]?_0x149c9a[_0x4aa6('0x34')]:_0x121b97[_0x4aa6('0x2f')];if(!_0x41bdc8[_0x4aa6('0x30')][_0x4aa6('0x36')](_0x4aa6('0x37'))){_0x149c9a[_0x4aa6('0x1e')]=qs['limit'](_0x41bdc8[_0x4aa6('0x30')][_0x4aa6('0x1e')]);_0x149c9a[_0x4aa6('0x1b')]=qs[_0x4aa6('0x1b')](_0x41bdc8[_0x4aa6('0x30')][_0x4aa6('0x1b')]);}_0x149c9a['order']=qs[_0x4aa6('0x38')](_0x41bdc8[_0x4aa6('0x30')]['sort']);_0x149c9a[_0x4aa6('0x39')]=qs[_0x4aa6('0x31')](_[_0x4aa6('0x3a')](_0x41bdc8[_0x4aa6('0x30')],_0x121b97['filters']),_0x1fe9cb);if(_0x41bdc8['query'][_0x4aa6('0x3b')]){_0x149c9a[_0x4aa6('0x39')]=_[_0x4aa6('0x3c')](_0x149c9a['where'],{'$or':_[_0x4aa6('0x3d')](_0x1fe9cb,function(_0x2ad949){if(_0x2ad949['type']!==_0x4aa6('0x3e')){var _0x394319={};_0x394319[_0x2ad949[_0x4aa6('0x29')]]={'$like':'%'+_0x41bdc8[_0x4aa6('0x30')][_0x4aa6('0x3b')]+'%'};return _0x394319;}})});}_0x149c9a=_[_0x4aa6('0x3c')]({},_0x149c9a,_0x41bdc8['options']);var _0x47daed={'where':_0x149c9a[_0x4aa6('0x39')]};return db[_0x4aa6('0x2b')][_0x4aa6('0x1d')](_0x47daed)[_0x4aa6('0x25')](function(_0x14fb78){_0x2b629e['count']=_0x14fb78;if(_0x41bdc8[_0x4aa6('0x30')][_0x4aa6('0x3f')]){_0x149c9a['include']=[{'all':!![]}];}return db[_0x4aa6('0x2b')][_0x4aa6('0x40')](_0x149c9a);})[_0x4aa6('0x25')](function(_0x47787d){_0x2b629e[_0x4aa6('0x41')]=_0x47787d;return _0x2b629e;})['then'](respondWithFilteredResult(_0x5bc756,_0x149c9a))[_0x4aa6('0x42')](handleError(_0x5bc756,null));};exports[_0x4aa6('0x43')]=function(_0x599921,_0x3fefa6){var _0xb9572a={'raw':!![],'where':{'id':_0x599921[_0x4aa6('0x44')]['id']}},_0x5968d9={};_0x5968d9[_0x4aa6('0x2f')]=_['keys'](db[_0x4aa6('0x2b')][_0x4aa6('0x2c')]);_0x5968d9[_0x4aa6('0x30')]=_[_0x4aa6('0x45')](_0x599921[_0x4aa6('0x30')]);_0x5968d9[_0x4aa6('0x31')]=_[_0x4aa6('0x32')](_0x5968d9['model'],_0x5968d9[_0x4aa6('0x30')]);_0xb9572a[_0x4aa6('0x34')]=_[_0x4aa6('0x32')](_0x5968d9[_0x4aa6('0x2f')],qs[_0x4aa6('0x33')](_0x599921[_0x4aa6('0x30')][_0x4aa6('0x33')]));_0xb9572a[_0x4aa6('0x34')]=_0xb9572a['attributes'][_0x4aa6('0x35')]?_0xb9572a['attributes']:_0x5968d9[_0x4aa6('0x2f')];if(_0x599921[_0x4aa6('0x30')][_0x4aa6('0x3f')]){_0xb9572a['include']=[{'all':!![]}];}_0xb9572a=_[_0x4aa6('0x3c')]({},_0xb9572a,_0x599921['options']);return db['WhatsappApplication'][_0x4aa6('0x46')](_0xb9572a)[_0x4aa6('0x25')](handleEntityNotFound(_0x3fefa6,null))['then'](respondWithResult(_0x3fefa6,null))[_0x4aa6('0x42')](handleError(_0x3fefa6,null));};exports[_0x4aa6('0x47')]=function(_0x5788ae,_0x10affb){return db['WhatsappApplication']['create'](_0x5788ae[_0x4aa6('0x48')],{})['then'](respondWithResult(_0x10affb,0xc9))[_0x4aa6('0x42')](handleError(_0x10affb,null));};exports[_0x4aa6('0x24')]=function(_0x2fd2b8,_0x5a844f){if(_0x2fd2b8[_0x4aa6('0x48')]['id']){delete _0x2fd2b8[_0x4aa6('0x48')]['id'];}return db[_0x4aa6('0x2b')]['find']({'where':{'id':_0x2fd2b8['params']['id']}})[_0x4aa6('0x25')](handleEntityNotFound(_0x5a844f,null))[_0x4aa6('0x25')](saveUpdates(_0x2fd2b8[_0x4aa6('0x48')],null))['then'](respondWithResult(_0x5a844f,null))[_0x4aa6('0x42')](handleError(_0x5a844f,null));};exports[_0x4aa6('0x26')]=function(_0x23b33f,_0x25b9cc){return db['WhatsappApplication']['find']({'where':{'id':_0x23b33f[_0x4aa6('0x44')]['id']}})[_0x4aa6('0x25')](handleEntityNotFound(_0x25b9cc,null))[_0x4aa6('0x25')](removeEntity(_0x25b9cc,null))[_0x4aa6('0x42')](handleError(_0x25b9cc,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index d3d7741..e1089ec 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 _0xfd0f=['api','moment','bluebird','path','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','lodash','util'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xfd0f,0x1b8));var _0xffd0=function(_0x33a5b2,_0x58e2c2){_0x33a5b2=_0x33a5b2-0x0;var _0xac6d2e=_0xfd0f[_0x33a5b2];return _0xac6d2e;};'use strict';var _=require(_0xffd0('0x0'));var util=require(_0xffd0('0x1'));var logger=require('../../config/logger')(_0xffd0('0x2'));var moment=require(_0xffd0('0x3'));var BPromise=require(_0xffd0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xffd0('0x5'));var rimraf=require('rimraf');var config=require(_0xffd0('0x6'));var attributes=require(_0xffd0('0x7'));module[_0xffd0('0x8')]=function(_0x9e9c1f,_0xd7f075){return _0x9e9c1f[_0xffd0('0x9')](_0xffd0('0xa'),attributes,{'tableName':_0xffd0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xffd0('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xf23b=['request-promise','path','rimraf','./whatsappApplication.attributes','exports','define','utf8mb4','lodash','util','../../config/logger','api','moment'];(function(_0x4cf394,_0x382eb7){var _0x63692a=function(_0x4b7859){while(--_0x4b7859){_0x4cf394['push'](_0x4cf394['shift']());}};_0x63692a(++_0x382eb7);}(_0xf23b,0x133));var _0xbf23=function(_0x325d33,_0x56116e){_0x325d33=_0x325d33-0x0;var _0x4d32d7=_0xf23b[_0x325d33];return _0x4d32d7;};'use strict';var _=require(_0xbf23('0x0'));var util=require(_0xbf23('0x1'));var logger=require(_0xbf23('0x2'))(_0xbf23('0x3'));var moment=require(_0xbf23('0x4'));var BPromise=require('bluebird');var rp=require(_0xbf23('0x5'));var fs=require('fs');var path=require(_0xbf23('0x6'));var rimraf=require(_0xbf23('0x7'));var config=require('../../config/environment');var attributes=require(_0xbf23('0x8'));module[_0xbf23('0x9')]=function(_0xc5e7dd,_0x393a52){return _0xc5e7dd[_0xbf23('0xa')]('WhatsappApplication',attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbf23('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 4c5aafd..ffb092a 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 _0x425d=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../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','code','message','catch'];(function(_0x4774a9,_0x9ff711){var _0x75832=function(_0x3141b5){while(--_0x3141b5){_0x4774a9['push'](_0x4774a9['shift']());}};_0x75832(++_0x9ff711);}(_0x425d,0x1e0));var _0xd425=function(_0x5ecce5,_0x45f8fb){_0x5ecce5=_0x5ecce5-0x0;var _0xc2f006=_0x425d[_0x5ecce5];return _0xc2f006;};'use strict';var _=require(_0xd425('0x0'));var util=require('util');var moment=require(_0xd425('0x1'));var BPromise=require(_0xd425('0x2'));var rs=require(_0xd425('0x3'));var fs=require('fs');var Redis=require(_0xd425('0x4'));var db=require(_0xd425('0x5'))['db'];var utils=require(_0xd425('0x6'));var logger=require(_0xd425('0x7'))('rpc');var config=require(_0xd425('0x8'));var jayson=require(_0xd425('0x9'));var client=jayson[_0xd425('0xa')][_0xd425('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d97d9,_0x1d2ed0,_0x50b061){return new BPromise(function(_0xb6ba8e,_0x374c3d){return client[_0xd425('0xc')](_0x1d97d9,_0x50b061)[_0xd425('0xd')](function(_0x2db9da){logger[_0xd425('0xe')](_0xd425('0xf'),_0x1d2ed0,_0xd425('0x10'));logger[_0xd425('0x11')](_0xd425('0x12'),_0x1d2ed0,_0xd425('0x10'),JSON[_0xd425('0x13')](_0x2db9da));if(_0x2db9da[_0xd425('0x14')]){if(_0x2db9da[_0xd425('0x14')][_0xd425('0x15')]===0x1f4){logger[_0xd425('0x14')](_0xd425('0xf'),_0x1d2ed0,_0x2db9da[_0xd425('0x14')][_0xd425('0x16')]);return _0x374c3d(_0x2db9da[_0xd425('0x14')]['message']);}logger[_0xd425('0x14')](_0xd425('0xf'),_0x1d2ed0,_0x2db9da[_0xd425('0x14')]['message']);return _0xb6ba8e(_0x2db9da[_0xd425('0x14')][_0xd425('0x16')]);}else{logger[_0xd425('0xe')](_0xd425('0xf'),_0x1d2ed0,_0xd425('0x10'));_0xb6ba8e(_0x2db9da['result'][_0xd425('0x16')]);}})[_0xd425('0x17')](function(_0x7e267e){logger[_0xd425('0x14')]('WhatsappApplication,\x20%s,\x20%s',_0x1d2ed0,_0x7e267e);_0x374c3d(_0x7e267e);});});} \ No newline at end of file +var _0x99e9=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x2d37b7,_0x3bf618){var _0x4dfbdb=function(_0x18fc40){while(--_0x18fc40){_0x2d37b7['push'](_0x2d37b7['shift']());}};_0x4dfbdb(++_0x3bf618);}(_0x99e9,0xb4));var _0x999e=function(_0xabbd2f,_0x44d05a){_0xabbd2f=_0xabbd2f-0x0;var _0x34a040=_0x99e9[_0xabbd2f];return _0x34a040;};'use strict';var _=require('lodash');var util=require(_0x999e('0x0'));var moment=require(_0x999e('0x1'));var BPromise=require(_0x999e('0x2'));var rs=require(_0x999e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x999e('0x4'))['db'];var utils=require(_0x999e('0x5'));var logger=require(_0x999e('0x6'))('rpc');var config=require(_0x999e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x999e('0x8')][_0x999e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x100330,_0x18f337,_0x5c1c17){return new BPromise(function(_0x46aeae,_0x38a692){return client[_0x999e('0xa')](_0x100330,_0x5c1c17)[_0x999e('0xb')](function(_0x2c38cf){logger[_0x999e('0xc')](_0x999e('0xd'),_0x18f337,_0x999e('0xe'));logger[_0x999e('0xf')](_0x999e('0x10'),_0x18f337,_0x999e('0xe'),JSON[_0x999e('0x11')](_0x2c38cf));if(_0x2c38cf[_0x999e('0x12')]){if(_0x2c38cf[_0x999e('0x12')][_0x999e('0x13')]===0x1f4){logger[_0x999e('0x12')](_0x999e('0xd'),_0x18f337,_0x2c38cf['error'][_0x999e('0x14')]);return _0x38a692(_0x2c38cf['error'][_0x999e('0x14')]);}logger[_0x999e('0x12')](_0x999e('0xd'),_0x18f337,_0x2c38cf['error'][_0x999e('0x14')]);return _0x46aeae(_0x2c38cf['error'][_0x999e('0x14')]);}else{logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x18f337,_0x999e('0xe'));_0x46aeae(_0x2c38cf[_0x999e('0x15')][_0x999e('0x14')]);}})[_0x999e('0x16')](function(_0x1e9bff){logger[_0x999e('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x18f337,_0x1e9bff);_0x38a692(_0x1e9bff);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 15ddadd..2f0d557 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 _0x7046=['whatsappinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','show','/:id/messages','getMessages','/:id/download','post','addMessage','/:id/tags','tracked','whatsapp','addTags','put','/:id','whatsappinteraction:update','update','delete'];(function(_0x47a9a6,_0x326072){var _0x2222fc=function(_0x391a16){while(--_0x391a16){_0x47a9a6['push'](_0x47a9a6['shift']());}};_0x2222fc(++_0x326072);}(_0x7046,0x144));var _0x6704=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x7046[_0x8c43de];return _0xa6591b;};'use strict';var multer=require(_0x6704('0x0'));var util=require(_0x6704('0x1'));var path=require(_0x6704('0x2'));var timeout=require(_0x6704('0x3'));var express=require('express');var router=express[_0x6704('0x4')]();var fs_extra=require(_0x6704('0x5'));var auth=require(_0x6704('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6704('0x7'));var controller=require(_0x6704('0x8'));router[_0x6704('0x9')]('/',auth[_0x6704('0xa')](),controller[_0x6704('0xb')]);router['get'](_0x6704('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x6704('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x6704('0xd')]);router[_0x6704('0x9')](_0x6704('0xe'),auth[_0x6704('0xa')](),controller[_0x6704('0xf')]);router[_0x6704('0x9')](_0x6704('0x10'),auth[_0x6704('0xa')](),controller['download']);router[_0x6704('0x11')]('/',auth[_0x6704('0xa')](),controller['create']);router[_0x6704('0x11')](_0x6704('0xe'),auth[_0x6704('0xa')](),controller[_0x6704('0x12')]);router[_0x6704('0x11')](_0x6704('0x13'),auth[_0x6704('0xa')](),interaction[_0x6704('0x14')](_0x6704('0x15'),'whatsappinteraction:addtags'),controller[_0x6704('0x16')]);router[_0x6704('0x17')](_0x6704('0x18'),auth['isAuthenticated'](),interaction[_0x6704('0x14')](_0x6704('0x15'),_0x6704('0x19')),controller[_0x6704('0x1a')]);router[_0x6704('0x1b')]('/:id',auth[_0x6704('0xa')](),interaction[_0x6704('0x14')](_0x6704('0x15'),_0x6704('0x1c')),controller[_0x6704('0x1d')]);router['delete'](_0x6704('0x13'),auth[_0x6704('0xa')](),controller[_0x6704('0x1e')]);module[_0x6704('0x1f')]=router; \ No newline at end of file +var _0xdf98=['create','post','addMessage','/:id/tags','whatsapp','whatsappinteraction:addtags','addTags','/:id','tracked','whatsappinteraction:update','update','delete','destroy','removeTags','exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id/messages','getMessages','/:id/download','download'];(function(_0x28b498,_0x4c514f){var _0x8fd1bb=function(_0x1b9887){while(--_0x1b9887){_0x28b498['push'](_0x28b498['shift']());}};_0x8fd1bb(++_0x4c514f);}(_0xdf98,0xcf));var _0x8df9=function(_0x2da71d,_0x34f66b){_0x2da71d=_0x2da71d-0x0;var _0x16c334=_0xdf98[_0x2da71d];return _0x16c334;};'use strict';var multer=require(_0x8df9('0x0'));var util=require('util');var path=require(_0x8df9('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8df9('0x2')]();var fs_extra=require(_0x8df9('0x3'));var auth=require(_0x8df9('0x4'));var interaction=require(_0x8df9('0x5'));var config=require(_0x8df9('0x6'));var controller=require(_0x8df9('0x7'));router[_0x8df9('0x8')]('/',auth[_0x8df9('0x9')](),controller[_0x8df9('0xa')]);router['get'](_0x8df9('0xb'),auth[_0x8df9('0x9')](),controller[_0x8df9('0xc')]);router['get']('/:id',auth[_0x8df9('0x9')](),controller['show']);router[_0x8df9('0x8')](_0x8df9('0xd'),auth[_0x8df9('0x9')](),controller[_0x8df9('0xe')]);router[_0x8df9('0x8')](_0x8df9('0xf'),auth[_0x8df9('0x9')](),controller[_0x8df9('0x10')]);router['post']('/',auth[_0x8df9('0x9')](),controller[_0x8df9('0x11')]);router[_0x8df9('0x12')]('/:id/messages',auth[_0x8df9('0x9')](),controller[_0x8df9('0x13')]);router[_0x8df9('0x12')](_0x8df9('0x14'),auth['isAuthenticated'](),interaction['tracked'](_0x8df9('0x15'),_0x8df9('0x16')),controller[_0x8df9('0x17')]);router['put'](_0x8df9('0x18'),auth['isAuthenticated'](),interaction[_0x8df9('0x19')]('whatsapp',_0x8df9('0x1a')),controller[_0x8df9('0x1b')]);router[_0x8df9('0x1c')](_0x8df9('0x18'),auth[_0x8df9('0x9')](),interaction[_0x8df9('0x19')]('whatsapp','whatsappinteraction:destroy'),controller[_0x8df9('0x1d')]);router['delete']('/:id/tags',auth[_0x8df9('0x9')](),controller[_0x8df9('0x1e')]);module[_0x8df9('0x1f')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index b82eff6..97ec830 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 _0x3831=['STRING','ENUM','sequelize','exports','BOOLEAN','DATE'];(function(_0x223ebe,_0x2a72e4){var _0x497374=function(_0x28909c){while(--_0x28909c){_0x223ebe['push'](_0x223ebe['shift']());}};_0x497374(++_0x2a72e4);}(_0x3831,0x14c));var _0x1383=function(_0x4283c0,_0xc694d5){_0x4283c0=_0x4283c0-0x0;var _0x6b47ab=_0x3831[_0x4283c0];return _0x6b47ab;};'use strict';var Sequelize=require(_0x1383('0x0'));var moment=require('moment');module[_0x1383('0x1')]={'closed':{'type':Sequelize[_0x1383('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1383('0x3')]},'disposition':{'type':Sequelize[_0x1383('0x4')]},'secondDisposition':{'type':Sequelize[_0x1383('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x1383('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x1383('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x1383('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x1383('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xed1f=['STRING','ENUM','out','BOOLEAN','sequelize','moment','DATE'];(function(_0x5ab232,_0x570056){var _0x457b86=function(_0x189f6b){while(--_0x189f6b){_0x5ab232['push'](_0x5ab232['shift']());}};_0x457b86(++_0x570056);}(_0xed1f,0x170));var _0xfed1=function(_0x38537f,_0x252124){_0x38537f=_0x38537f-0x0;var _0x141e23=_0xed1f[_0x38537f];return _0x141e23;};'use strict';var Sequelize=require(_0xfed1('0x0'));var moment=require(_0xfed1('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xfed1('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xfed1('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xfed1('0x3')]},'phone':{'type':Sequelize[_0xfed1('0x3')]},'read1stAt':{'type':Sequelize[_0xfed1('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xfed1('0x4')]('in',_0xfed1('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xfed1('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xfed1('0x4')]('in',_0xfed1('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xfed1('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 87c5b5c..87a1004 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 _0x0a25=['i.id','Sequelize','QueryTypes','DESC','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','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','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','o.fullname','Owner.fullname','o.internal','Owner.internal','groupBy','WhatsappInteractionId','all','rows','catch','rawAttributes','includeAll','include','options','create','body','update','params','describe','addMessage','WhatsappMessage','omit','ids','getMessages','nolimit','$gte','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','spread','findAll','emit','whatsappInteractionTags:save','download','unix','root','server','files','tmp','attachments','join','transcript-%d-%s.zip','User','CmContact','firstName','lastName','Attachment','Messages','direction','WhatsappAccount','Account','mkdirSync','Whatsapp','Owner','N.A.','closed','closedAt','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','secret','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','log','err','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','map','fullname','TagIds','Tags','split','forEach','push','index','WhatsappInteraction','type','model','keys','query','filters','intersection','fields','attributes','length','order','sort','pick','field','color','from','tools_tags','select','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','Contact','operator','$substring','getFullTextValue','ContactId','buildExpression','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','some','compact','isEmpty','WhatsappAccountId','where','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?'];(function(_0x3d9176,_0x399d6f){var _0x12adc5=function(_0x700b01){while(--_0x700b01){_0x3d9176['push'](_0x3d9176['shift']());}};_0x12adc5(++_0x399d6f);}(_0x0a25,0x68));var _0x50a2=function(_0xbb9455,_0x5a058e){_0xbb9455=_0xbb9455-0x0;var _0x4b7fe1=_0x0a25[_0xbb9455];return _0x4b7fe1;};'use strict';var emlformat=require(_0x50a2('0x0'));var rimraf=require(_0x50a2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x50a2('0x2'));var rp=require(_0x50a2('0x3'));var moment=require('moment');var BPromise=require(_0x50a2('0x4'));var Mustache=require(_0x50a2('0x5'));var util=require(_0x50a2('0x6'));var path=require(_0x50a2('0x7'));var sox=require(_0x50a2('0x8'));var csv=require(_0x50a2('0x9'));var ejs=require(_0x50a2('0xa'));var fs=require('fs');var fs_extra=require(_0x50a2('0xb'));var _=require(_0x50a2('0xc'));var squel=require(_0x50a2('0xd'));var crypto=require(_0x50a2('0xe'));var jsforce=require(_0x50a2('0xf'));var deskjs=require(_0x50a2('0x10'));var toCsv=require(_0x50a2('0x9'));var querystring=require(_0x50a2('0x11'));var Papa=require(_0x50a2('0x12'));var Redis=require(_0x50a2('0x13'));var authService=require(_0x50a2('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x50a2('0x15'));var pdf=require(_0x50a2('0x16'));var hardwareService=require(_0x50a2('0x17'));var logger=require(_0x50a2('0x18'))(_0x50a2('0x19'));var utils=require(_0x50a2('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x50a2('0x1b'));var db=require(_0x50a2('0x1c'))['db'];config[_0x50a2('0x1d')]=_[_0x50a2('0x1e')](config[_0x50a2('0x1d')],{'host':_0x50a2('0x1f'),'port':0x18eb});var socket=require(_0x50a2('0x20'))(new Redis(config[_0x50a2('0x1d')]));require('./whatsappInteraction.socket')['register'](socket);function respondWithStatusCode(_0x535230,_0x2dede9){_0x2dede9=_0x2dede9||0xcc;return function(_0x1aaf13){if(_0x1aaf13){return _0x535230[_0x50a2('0x21')](_0x2dede9);}return _0x535230['status'](_0x2dede9)[_0x50a2('0x22')]();};}function respondWithResult(_0x1e3b00,_0x20f00d){_0x20f00d=_0x20f00d||0xc8;return function(_0x922ce8){if(_0x922ce8){return _0x1e3b00[_0x50a2('0x23')](_0x20f00d)[_0x50a2('0x24')](_0x922ce8);}};}function respondWithFilteredResult(_0x399523,_0x5934d3){return function(_0x37301f){if(_0x37301f){var _0x3987d5=typeof _0x5934d3[_0x50a2('0x25')]===_0x50a2('0x26')&&typeof _0x5934d3[_0x50a2('0x27')]===_0x50a2('0x26');var _0x57c97b=_0x37301f[_0x50a2('0x28')];var _0x4f0d53=_0x3987d5?0x0:_0x5934d3[_0x50a2('0x25')];var _0x43daf1=_0x3987d5?_0x37301f[_0x50a2('0x28')]:_0x5934d3[_0x50a2('0x25')]+_0x5934d3['limit'];var _0x5afc6d;if(_0x43daf1>=_0x57c97b){_0x43daf1=_0x57c97b;_0x5afc6d=0xc8;}else{_0x5afc6d=0xce;}_0x399523[_0x50a2('0x23')](_0x5afc6d);return _0x399523[_0x50a2('0x29')](_0x50a2('0x2a'),_0x4f0d53+'-'+_0x43daf1+'/'+_0x57c97b)[_0x50a2('0x24')](_0x37301f);}return null;};}function patchUpdates(_0x5e5e1e){return function(_0xf093f8){try{jsonpatch[_0x50a2('0x2b')](_0xf093f8,_0x5e5e1e,!![]);}catch(_0x2c0f50){return BPromise[_0x50a2('0x2c')](_0x2c0f50);}return _0xf093f8[_0x50a2('0x2d')]();};}function saveUpdates(_0x33ed8b,_0x4a65d3){return function(_0x1827dc){if(_0x1827dc){return _0x1827dc['update'](_0x33ed8b)[_0x50a2('0x2e')](function(_0xc0c44f){return _0xc0c44f;});}return null;};}function removeEntity(_0x2e9769,_0x3b034f){return function(_0xf54ae){if(_0xf54ae){return _0xf54ae[_0x50a2('0x2f')]()[_0x50a2('0x2e')](function(){_0x2e9769[_0x50a2('0x23')](0xcc)[_0x50a2('0x22')]();});}};}function handleEntityNotFound(_0x1295d4,_0x534c10){return function(_0x193132){if(!_0x193132){_0x1295d4[_0x50a2('0x21')](0x194);}return _0x193132;};}function handleError(_0x40d633,_0x492fa1){_0x492fa1=_0x492fa1||0x1f4;return function(_0x2bec60){logger[_0x50a2('0x30')](_0x2bec60[_0x50a2('0x31')]);if(_0x2bec60[_0x50a2('0x32')]){delete _0x2bec60[_0x50a2('0x32')];}_0x40d633[_0x50a2('0x23')](_0x492fa1)[_0x50a2('0x33')](_0x2bec60);};}function getInteractionUsers(_0x17d167,_0x342e01){return new BPromise(function(_0x2a60ad,_0x5c9642){try{if(_0x342e01[_0x17d167['id']]){_0x17d167['Users']=_[_0x50a2('0x34')](_0x342e01[_0x17d167['id']],function(_0x30e3ef){return{'id':_0x30e3ef['id'],'fullname':_0x30e3ef[_0x50a2('0x35')]};});}}catch(_0x49dc45){_0x5c9642(_0x49dc45);}_0x2a60ad(_0x17d167);});}function getInteractionTags(_0x2a1917,_0x4e0e3d){return new BPromise(function(_0x2fef3d,_0x4f6e11){try{if(_0x2a1917[_0x50a2('0x36')]){_0x2a1917[_0x50a2('0x37')]=[];_0x2a1917['TagIds'][_0x50a2('0x38')](',')[_0x50a2('0x39')](function(_0x328266){_0x2a1917[_0x50a2('0x37')][_0x50a2('0x3a')](_0x4e0e3d[_0x328266]);});}delete _0x2a1917['TagIds'];}catch(_0x517879){_0x4f6e11(_0x517879);}_0x2fef3d(_0x2a1917);});}function updateWhatsappInteraction(_0x58a4d4,_0x1cfd3a,_0x1af6c5){return new BPromise(function(_0x2295d1,_0x106f16){return getInteractionUsers(_0x58a4d4,_0x1af6c5)['then'](function(_0x3df980){return getInteractionTags(_0x3df980,_0x1cfd3a);})[_0x50a2('0x2e')](function(_0x5b56f0){_0x2295d1(_0x5b56f0);})['catch'](function(_0x64df2e){_0x106f16(_0x64df2e);});});}exports[_0x50a2('0x3b')]=function(_0x6aa24d,_0x5db6cf){var _0x28b310={},_0x46fff6={},_0x50ab1a={'count':0x0,'rows':[]};var _0x4e5d14=_['map'](db[_0x50a2('0x3c')]['rawAttributes'],function(_0x13521b){return{'name':_0x13521b['fieldName'],'type':_0x13521b[_0x50a2('0x3d')]['key']};});_0x46fff6[_0x50a2('0x3e')]=_[_0x50a2('0x34')](_0x4e5d14,_0x50a2('0x32'));_0x46fff6['query']=_[_0x50a2('0x3f')](_0x6aa24d[_0x50a2('0x40')]);_0x46fff6[_0x50a2('0x41')]=_[_0x50a2('0x42')](_0x46fff6[_0x50a2('0x3e')],_0x46fff6[_0x50a2('0x40')]);_0x28b310['attributes']=_[_0x50a2('0x42')](_0x46fff6[_0x50a2('0x3e')],qs['fields'](_0x6aa24d['query'][_0x50a2('0x43')]));_0x28b310[_0x50a2('0x44')]=_0x28b310[_0x50a2('0x44')][_0x50a2('0x45')]?_0x28b310['attributes']:_0x46fff6[_0x50a2('0x3e')];if(!_0x6aa24d[_0x50a2('0x40')]['hasOwnProperty']('nolimit')){_0x28b310['limit']=qs['limit'](_0x6aa24d[_0x50a2('0x40')]['limit']);_0x28b310['offset']=qs[_0x50a2('0x25')](_0x6aa24d[_0x50a2('0x40')][_0x50a2('0x25')]);}_0x28b310[_0x50a2('0x46')]=qs[_0x50a2('0x47')](_0x6aa24d[_0x50a2('0x40')][_0x50a2('0x47')]);_0x28b310['where']=qs[_0x50a2('0x41')](_[_0x50a2('0x48')](_0x6aa24d[_0x50a2('0x40')],_0x46fff6[_0x50a2('0x41')]),_0x4e5d14);var _0x5a54fa=[];var _0xf7e280=squel['select']()[_0x50a2('0x49')]('id')[_0x50a2('0x49')](_0x50a2('0x32'))['field'](_0x50a2('0x4a'))[_0x50a2('0x4b')](_0x50a2('0x4c'));var _0x4b8890=squel[_0x50a2('0x4d')]()[_0x50a2('0x49')]('u.id')[_0x50a2('0x49')](_0x50a2('0x4e'))[_0x50a2('0x49')](_0x50a2('0x4f'))[_0x50a2('0x4b')](_0x50a2('0x50'),'ui')[_0x50a2('0x51')]('users','u','u.id\x20=\x20ui.UserId');var _0x453463=squel[_0x50a2('0x4d')]()[_0x50a2('0x4b')](_0x50a2('0x52'),'i')['left_join'](_0x50a2('0x53'),'c',_0x50a2('0x54'))[_0x50a2('0x51')](_0x50a2('0x55'),'o','o.id\x20=\x20i.UserId')[_0x50a2('0x51')]('whatsapp_accounts','a','a.id\x20=\x20i.WhatsappAccountId')[_0x50a2('0x51')]('whatsapp_messages','me',_0x50a2('0x56'))[_0x50a2('0x51')](_0x50a2('0x57'),'it','it.WhatsappInteractionId\x20=\x20i.id')[_0x50a2('0x51')](_0x50a2('0x4c'),'t','t.id\x20=\x20it.TagId');var _0x1aa8d6=squel[_0x50a2('0x58')]();var _0x4a0016=[];var _0x3b8167=squel[_0x50a2('0x58')]();var _0x1905bc;if(_0x6aa24d[_0x50a2('0x40')][_0x50a2('0x59')]){_0x1905bc=as[_0x50a2('0x5a')](_0x6aa24d[_0x50a2('0x40')]['search']);var _0x34139f=_0x1905bc[_0x50a2('0x5b')];for(var _0x38fc18=0x0;_0x38fc18<_0x1905bc[_0x50a2('0x5c')]['length'];_0x38fc18++){var _0x40d14d=_0x1905bc[_0x50a2('0x5c')][_0x38fc18];var _0x1d844d='i';var _0x42bf48=_[_0x50a2('0x5d')](_0x4e5d14,[_0x50a2('0x32'),_0x40d14d[_0x50a2('0x49')]]);if(!_0x42bf48){switch(_0x40d14d[_0x50a2('0x49')]){case _0x50a2('0x5e'):if(_0x40d14d[_0x50a2('0x5f')]==0x1){_0x453463['having']('`'+_0x40d14d[_0x50a2('0x49')]+_0x50a2('0x60'));}else{_0x453463[_0x50a2('0x61')]('`'+_0x40d14d[_0x50a2('0x49')]+_0x50a2('0x62'));}break;case _0x50a2('0x63'):if(_0x40d14d[_0x50a2('0x64')]===_0x50a2('0x65')){if(_0x40d14d[_0x50a2('0x5f')]['split']('\x20')['length']>0x1){_0x1aa8d6[_0x34139f]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x50a2('0x66')](_0x40d14d['value']),null);}else{var _0x2995ad='%'+_0x40d14d['value']+'%';_0x1aa8d6[_0x34139f]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x2995ad,_0x2995ad,_0x2995ad);}}else{_0x42bf48=_['find'](_0x4e5d14,[_0x50a2('0x32'),_0x50a2('0x67')]);_0x40d14d[_0x50a2('0x49')]=_0x50a2('0x67');_0x556482=as[_0x50a2('0x68')](_0x1d844d,_0x42bf48[_0x50a2('0x3d')],_0x40d14d);_0x1aa8d6[_0x34139f](_0x556482[_0x50a2('0x69')],_0x556482['value']['start'],_0x556482[_0x50a2('0x5f')][_0x50a2('0x22')]);}break;case _0x50a2('0x6a'):var _0x1dcbb2=_0x40d14d[_0x50a2('0x5f')][_0x50a2('0x38')](',')[_0x50a2('0x34')](function(_0xd52efb){return Number(_0xd52efb);});_0x1dcbb2[_0x50a2('0x39')](function(_0x4c7d9c){_0x3b8167['or'](_0x50a2('0x6b'),'%,'+_0x4c7d9c+',%');});_0x4a0016=_['union'](_0x4a0016,_0x1dcbb2);break;case'User':if(_0x40d14d[_0x50a2('0x64')]===_0x50a2('0x65')){_0x1aa8d6[_0x34139f](_0x50a2('0x6c'),'%'+_0x40d14d[_0x50a2('0x5f')]+'%',null);}else{_0x42bf48=_['find'](_0x4e5d14,[_0x50a2('0x32'),_0x50a2('0x6d')]);_0x40d14d[_0x50a2('0x49')]='UserId';_0x556482=as[_0x50a2('0x68')](_0x1d844d,_0x42bf48[_0x50a2('0x3d')],_0x40d14d);_0x1aa8d6[_0x34139f](_0x556482[_0x50a2('0x69')],_0x556482[_0x50a2('0x5f')][_0x50a2('0x6e')],_0x556482['value'][_0x50a2('0x22')]);}break;case'body':_0x556482=as['buildExpression']('me',null,_0x40d14d);_0x1aa8d6[_0x34139f](_0x556482[_0x50a2('0x69')],_0x556482[_0x50a2('0x5f')]['start'],_0x556482['value'][_0x50a2('0x22')]);break;}}else{var _0x556482=as[_0x50a2('0x68')](_0x1d844d,_0x42bf48[_0x50a2('0x3d')],_0x40d14d);_0x1aa8d6[_0x34139f](_0x556482[_0x50a2('0x69')],_0x556482[_0x50a2('0x5f')][_0x50a2('0x6e')],_0x556482['value'][_0x50a2('0x22')]);}}}else{var _0x3d9ed2=_(_0x6aa24d[_0x50a2('0x40')])['keys']()[_0x50a2('0x34')](function(_0xfe5820){return _[_0x50a2('0x6f')](_0x4e5d14,[_0x50a2('0x32'),_0xfe5820])?_0xfe5820:undefined;})[_0x50a2('0x70')]()['value']();if(!_[_0x50a2('0x71')](_0x3d9ed2)){_0x3d9ed2['forEach'](function(_0x16ddfb){if(_0x16ddfb===_0x50a2('0x72')){_0x453463[_0x50a2('0x73')](_0x50a2('0x74'),[][_0x50a2('0x75')](_0x6aa24d['query'][_0x16ddfb]));}else if(_0x16ddfb===_0x50a2('0x76')){var _0x35255c=JSON[_0x50a2('0x77')](_0x6aa24d[_0x50a2('0x40')][_0x16ddfb])['$gte'];var _0x1e1be0=JSON['parse'](_0x6aa24d[_0x50a2('0x40')][_0x16ddfb])[_0x50a2('0x78')];_0x453463[_0x50a2('0x73')](_0x50a2('0x79'),_0x35255c,_0x1e1be0);}else{if(_0x6aa24d[_0x50a2('0x40')][_0x16ddfb]===_0x50a2('0x7a')){_0x453463[_0x50a2('0x73')]('i.'+_0x16ddfb+'\x20IS\x20NULL');}else{_0x453463[_0x50a2('0x73')]('i.'+_0x16ddfb+_0x50a2('0x7b'),_0x6aa24d[_0x50a2('0x40')][_0x16ddfb]);}}});}if(_0x6aa24d[_0x50a2('0x40')][_0x50a2('0x7c')]){if(_0x6aa24d[_0x50a2('0x40')][_0x50a2('0x7c')]==0x1){_0x453463['having'](_0x50a2('0x7d'));}else{_0x453463[_0x50a2('0x61')](_0x50a2('0x7e'));}}if(_0x6aa24d[_0x50a2('0x40')][_0x50a2('0x7f')]){_0x4a0016=_[_0x50a2('0x80')](_0x6aa24d[_0x50a2('0x40')][_0x50a2('0x7f')])?_0x6aa24d['query'][_0x50a2('0x7f')]:new Array(_0x6aa24d['query'][_0x50a2('0x7f')]);_0x4a0016[_0x50a2('0x39')](function(_0x3915ba){_0x3b8167['or'](_0x50a2('0x6b'),'%,'+_0x3915ba+',%');});}if(_0x6aa24d[_0x50a2('0x40')][_0x50a2('0x81')]){var _0x5a13e8=_0x6aa24d[_0x50a2('0x40')][_0x50a2('0x81')][_0x50a2('0x82')]('\x5c','\x5c\x5c')[_0x50a2('0x82')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x5a13e8)){_0x1aa8d6['or'](_0x50a2('0x83'),_0x5a13e8+'%')['or']('i.phone\x20LIKE\x20?',_0x5a13e8+'%');}else{_0x1aa8d6['or'](_0x50a2('0x84'),qs[_0x50a2('0x66')](_0x5a13e8))['or'](_0x50a2('0x85'),_0x5a13e8+'%');}}}_0x453463[_0x50a2('0x73')](_0x1aa8d6);_0x453463['group'](_0x50a2('0x86'));var _0x3509a1={'type':db[_0x50a2('0x87')][_0x50a2('0x88')]['SELECT'],'raw':!![]};var _0x24fadb=_0x453463['clone']();_0x24fadb[_0x50a2('0x49')]('i.id');_0x24fadb[_0x50a2('0x49')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x50a2('0x5e'));if(_0x28b310[_0x50a2('0x46')]){_0x28b310[_0x50a2('0x46')][_0x50a2('0x39')](function(_0x6c4dd3){var _0x407229=_0x6c4dd3[0x0]==='contactName'?_0x6c4dd3[0x0]:'i.'+_0x6c4dd3[0x0];_0x453463[_0x50a2('0x46')](_0x407229,_0x6c4dd3[0x1]===_0x50a2('0x89')?![]:!![]);});}if(!_['isEmpty'](_0x4a0016)){_0x453463[_0x50a2('0x61')](_0x3b8167);_0x24fadb[_0x50a2('0x73')]('t.id\x20IN\x20?',_0x4a0016);}BPromise[_0x50a2('0x8a')]()[_0x50a2('0x2e')](function(){if(!_0x1905bc){if(_0x6aa24d['query'][_0x50a2('0x72')])return;_0x24fadb[_0x50a2('0x73')](_0x50a2('0x8b'));_0x453463[_0x50a2('0x73')](_0x50a2('0x8b'));return;}if(_0x6aa24d['user'][_0x50a2('0x8c')]!==_0x50a2('0x8d'))return;return _0x6aa24d[_0x50a2('0x8e')][_0x50a2('0x8f')]({'attributes':['id'],'raw':!![]})[_0x50a2('0x2e')](function(_0x428a55){if(_[_0x50a2('0x71')](_0x428a55)){_0x24fadb[_0x50a2('0x73')](_0x50a2('0x90'));_0x453463[_0x50a2('0x73')](_0x50a2('0x90'));}else{_0x24fadb[_0x50a2('0x73')]('i.WhatsappAccountId\x20IN\x20?',_[_0x50a2('0x34')](_0x428a55,'id'));_0x453463[_0x50a2('0x73')](_0x50a2('0x74'),_['map'](_0x428a55,'id'));}});})['then'](function(){if(_0x6aa24d[_0x50a2('0x8e')][_0x50a2('0x8c')]===_0x50a2('0x8d')&&!_0x1905bc&&!_0x6aa24d[_0x50a2('0x40')][_0x50a2('0x72')])return[];return db[_0x50a2('0x91')][_0x50a2('0x40')](_0x24fadb[_0x50a2('0x92')](),_0x3509a1);})[_0x50a2('0x2e')](function(_0x249dd3){_0x50ab1a[_0x50a2('0x28')]=_0x249dd3['length'];if(_0x50ab1a[_0x50a2('0x28')]===0x0)return[];return db[_0x50a2('0x91')]['query'](_0xf7e280[_0x50a2('0x92')](),_0x3509a1)[_0x50a2('0x2e')](function(_0x1979a2){_0x5a54fa=_[_0x50a2('0x93')](_0x1979a2,'id');_0x3509a1=_[_0x50a2('0x94')](_0x3509a1,{'model':db[_0x50a2('0x3c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x6aa24d[_0x50a2('0x40')][_0x50a2('0x43')]){_0x28b310['attributes'][_0x50a2('0x39')](function(_0x5a4f93){_0x453463[_0x50a2('0x49')]('i.'+_0x5a4f93);});}else{_0x453463[_0x50a2('0x49')](_0x50a2('0x95'),'unreadMessages');_0x453463[_0x50a2('0x49')](_0x50a2('0x96'),_0x50a2('0x97'));_0x453463[_0x50a2('0x49')](_0x50a2('0x98'),_0x50a2('0x99'));_0x453463[_0x50a2('0x49')](_0x50a2('0x9a'),_0x50a2('0x9b'));_0x453463[_0x50a2('0x49')](_0x50a2('0x9c'));_0x453463[_0x50a2('0x49')](_0x50a2('0x9d'),_0x50a2('0x9e'));_0x453463['field'](_0x50a2('0x9f'),_0x50a2('0xa0'));_0x453463['field'](_0x50a2('0xa1'),_0x50a2('0xa2'));_0x453463[_0x50a2('0x49')](_0x50a2('0xa3'),_0x50a2('0xa4'));_0x453463[_0x50a2('0x49')]('c.mobile',_0x50a2('0xa5'));_0x453463['field']('c.fax','Contact.fax');_0x453463['field'](_0x50a2('0xa6'),_0x50a2('0xa7'));_0x453463[_0x50a2('0x49')](_0x50a2('0xa8'),_0x50a2('0xa9'));_0x453463[_0x50a2('0x49')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x50a2('0x36'));}if(_0x28b310[_0x50a2('0x27')])_0x453463[_0x50a2('0x27')](_0x28b310[_0x50a2('0x27')]);if(_0x28b310[_0x50a2('0x25')])_0x453463[_0x50a2('0x25')](_0x28b310['offset']);return db['sequelize'][_0x50a2('0x40')](_0x453463[_0x50a2('0x92')](),_0x3509a1);})['then'](function(_0x2822d8){if(_0x2822d8[_0x50a2('0x45')]>0x0)_0x4b8890[_0x50a2('0x73')]('ui.WhatsappInteractionId\x20IN\x20?',_['map'](_0x2822d8,'id'));return db[_0x50a2('0x91')][_0x50a2('0x40')](_0x4b8890[_0x50a2('0x92')](),_0x3509a1)[_0x50a2('0x2e')](function(_0x56c609){var _0x4acc68=_[_0x50a2('0xaa')](_0x56c609,_0x50a2('0xab'));var _0x1be4f3=[];_0x2822d8[_0x50a2('0x39')](function(_0x269fd4){_0x1be4f3[_0x50a2('0x3a')](updateWhatsappInteraction(_0x269fd4,_0x5a54fa,_0x4acc68));});return BPromise[_0x50a2('0xac')](_0x1be4f3);});});})[_0x50a2('0x2e')](function(_0x59564d){_0x50ab1a[_0x50a2('0xad')]=_0x59564d;return _0x50ab1a;})['then'](respondWithFilteredResult(_0x5db6cf,_0x28b310))[_0x50a2('0xae')](handleError(_0x5db6cf,null));};exports['show']=function(_0x3168fd,_0x3c16e0){var _0x5c01b9={'raw':![],'where':{'id':_0x3168fd['params']['id']}},_0x21e1c1={};_0x21e1c1[_0x50a2('0x3e')]=_[_0x50a2('0x3f')](db[_0x50a2('0x3c')][_0x50a2('0xaf')]);_0x21e1c1['query']=_[_0x50a2('0x3f')](_0x3168fd[_0x50a2('0x40')]);_0x21e1c1['filters']=_[_0x50a2('0x42')](_0x21e1c1[_0x50a2('0x3e')],_0x21e1c1[_0x50a2('0x40')]);_0x5c01b9['attributes']=_[_0x50a2('0x42')](_0x21e1c1['model'],qs[_0x50a2('0x43')](_0x3168fd[_0x50a2('0x40')][_0x50a2('0x43')]));_0x5c01b9['attributes']=_0x5c01b9[_0x50a2('0x44')][_0x50a2('0x45')]?_0x5c01b9[_0x50a2('0x44')]:_0x21e1c1['model'];if(_0x3168fd[_0x50a2('0x40')][_0x50a2('0xb0')]){_0x5c01b9[_0x50a2('0xb1')]=[{'all':!![]}];}_0x5c01b9=_[_0x50a2('0x94')]({},_0x5c01b9,_0x3168fd[_0x50a2('0xb2')]);return db['WhatsappInteraction'][_0x50a2('0x5d')](_0x5c01b9)['then'](handleEntityNotFound(_0x3c16e0,null))[_0x50a2('0x2e')](respondWithResult(_0x3c16e0,null))['catch'](handleError(_0x3c16e0,null));};exports[_0x50a2('0xb3')]=function(_0x4f4949,_0x526f92){return db['WhatsappInteraction'][_0x50a2('0xb3')](_0x4f4949[_0x50a2('0xb4')],{})['then'](respondWithResult(_0x526f92,0xc9))['catch'](handleError(_0x526f92,null));};exports[_0x50a2('0xb5')]=function(_0x45d7c6,_0x346488){if(_0x45d7c6['body']['id']){delete _0x45d7c6[_0x50a2('0xb4')]['id'];}return db[_0x50a2('0x3c')][_0x50a2('0x5d')]({'where':{'id':_0x45d7c6[_0x50a2('0xb6')]['id']}})[_0x50a2('0x2e')](handleEntityNotFound(_0x346488,null))[_0x50a2('0x2e')](saveUpdates(_0x45d7c6['body'],null))['then'](respondWithResult(_0x346488,null))[_0x50a2('0xae')](handleError(_0x346488,null));};exports[_0x50a2('0x2f')]=function(_0x53ac4a,_0x5c9971){return db[_0x50a2('0x3c')][_0x50a2('0x5d')]({'where':{'id':_0x53ac4a[_0x50a2('0xb6')]['id']}})[_0x50a2('0x2e')](handleEntityNotFound(_0x5c9971,null))[_0x50a2('0x2e')](removeEntity(_0x5c9971,null))[_0x50a2('0xae')](handleError(_0x5c9971,null));};exports[_0x50a2('0xb7')]=function(_0x16e490,_0x5396e4){return db[_0x50a2('0x3c')][_0x50a2('0xb7')]()[_0x50a2('0x2e')](respondWithResult(_0x5396e4,null))[_0x50a2('0xae')](handleError(_0x5396e4,null));};exports[_0x50a2('0xb8')]=function(_0x209655,_0x17bdd2,_0x37ec57){return db[_0x50a2('0xb9')][_0x50a2('0x5d')]({'where':{'id':_0x209655[_0x50a2('0xb6')]['id']}})[_0x50a2('0x2e')](handleEntityNotFound(_0x17bdd2,null))[_0x50a2('0x2e')](function(_0xdc394){if(_0xdc394){return _0xdc394[_0x50a2('0xb8')](_0x209655[_0x50a2('0xb4')]['ids'],_[_0x50a2('0xba')](_0x209655[_0x50a2('0xb4')],[_0x50a2('0xbb'),'id'])||{});}})[_0x50a2('0x2e')](respondWithResult(_0x17bdd2,null))[_0x50a2('0xae')](handleError(_0x17bdd2,null));};exports[_0x50a2('0xbc')]=function(_0x1a8bd0,_0x4e120d,_0x1484e6){var _0x2a65f2={'raw':![],'where':{}};var _0x502de0={};var _0x5189b9={'count':0x0,'rows':[]};return db[_0x50a2('0x3c')]['findOne']({'where':{'id':_0x1a8bd0[_0x50a2('0xb6')]['id']}})['then'](handleEntityNotFound(_0x4e120d,null))[_0x50a2('0x2e')](function(_0x1707e8){if(_0x1707e8){_0x502de0['model']=_[_0x50a2('0x3f')](db[_0x50a2('0xb9')][_0x50a2('0xaf')]);_0x502de0['query']=_[_0x50a2('0x3f')](_0x1a8bd0['query']);_0x502de0['filters']=_[_0x50a2('0x42')](_0x502de0[_0x50a2('0x3e')],_0x502de0[_0x50a2('0x40')]);_0x2a65f2[_0x50a2('0x44')]=_[_0x50a2('0x42')](_0x502de0[_0x50a2('0x3e')],qs['fields'](_0x1a8bd0[_0x50a2('0x40')][_0x50a2('0x43')]));_0x2a65f2[_0x50a2('0x44')]=_0x2a65f2[_0x50a2('0x44')][_0x50a2('0x45')]?_0x2a65f2[_0x50a2('0x44')]:_0x502de0[_0x50a2('0x3e')];if(!_0x1a8bd0[_0x50a2('0x40')]['hasOwnProperty'](_0x50a2('0xbd'))){_0x2a65f2[_0x50a2('0x27')]=qs['limit'](_0x1a8bd0[_0x50a2('0x40')]['limit']);_0x2a65f2['offset']=qs[_0x50a2('0x25')](_0x1a8bd0[_0x50a2('0x40')][_0x50a2('0x25')]);}_0x2a65f2[_0x50a2('0x46')]=qs[_0x50a2('0x47')](_0x1a8bd0['query']['sort']);_0x2a65f2[_0x50a2('0x73')]=qs['filters'](_[_0x50a2('0x48')](_0x1a8bd0[_0x50a2('0x40')],_0x502de0['filters']));_0x2a65f2[_0x50a2('0x73')]['WhatsappInteractionId']=_0x1707e8['id'];if(_0x1a8bd0[_0x50a2('0x40')]['filter']){_0x2a65f2[_0x50a2('0x73')]=_[_0x50a2('0x94')](_0x2a65f2[_0x50a2('0x73')],{'$or':_[_0x50a2('0x34')](_0x2a65f2[_0x50a2('0x44')],function(_0x23769f){var _0x330b85={};_0x330b85[_0x23769f]={'$like':'%'+_0x1a8bd0[_0x50a2('0x40')][_0x50a2('0x81')]+'%'};return _0x330b85;})});}if(_0x1a8bd0[_0x50a2('0x40')][_0x50a2('0xbe')]){var _0x2ca4b2=_0x1a8bd0[_0x50a2('0x40')]['$gte']['split'](',');var _0x467ace={};_0x467ace[_0x2ca4b2[0x0]]={'$gte':moment(_0x2ca4b2[0x1])[_0x50a2('0xbf')](_0x50a2('0xc0'))};_0x2a65f2[_0x50a2('0x73')]=_[_0x50a2('0x94')](_0x2a65f2[_0x50a2('0x73')],_0x467ace);}_0x2a65f2=_['merge']({},_0x2a65f2,_0x1a8bd0[_0x50a2('0xb2')]);return db[_0x50a2('0xb9')]['count']({'where':_0x2a65f2['where']})['then'](function(_0x4a625c){_0x5189b9[_0x50a2('0x28')]=_0x4a625c;if(_0x1a8bd0['query']['includeAll']){_0x2a65f2[_0x50a2('0xb1')]=[{'all':!![]}];}return db[_0x50a2('0xb9')]['findAll'](_0x2a65f2);})[_0x50a2('0x2e')](function(_0x56536c){_0x5189b9['rows']=_0x56536c;return _0x5189b9;});}})['then'](respondWithFilteredResult(_0x4e120d,_0x2a65f2))[_0x50a2('0xae')](handleError(_0x4e120d,null));};exports[_0x50a2('0xc1')]=function(_0x2bea57,_0x119ee2,_0x54d25b){return db['WhatsappInteraction'][_0x50a2('0x5d')]({'where':{'id':_0x2bea57[_0x50a2('0xb6')]['id']}})['then'](handleEntityNotFound(_0x119ee2,null))[_0x50a2('0x2e')](function(_0x5bd788){if(_0x5bd788){return _0x5bd788[_0x50a2('0xc2')](_0x2bea57[_0x50a2('0xb4')][_0x50a2('0xbb')],_['omit'](_0x2bea57[_0x50a2('0xb4')],[_0x50a2('0xbb'),'id'])||{})[_0x50a2('0xc3')](function(){return db[_0x50a2('0x6a')][_0x50a2('0xc4')]({'attributes':['id','name',_0x50a2('0x4a')],'where':{'id':_0x2bea57['body'][_0x50a2('0xbb')]}});})[_0x50a2('0x2e')](function(_0x517c96){socket[_0x50a2('0xc5')](_0x50a2('0xc6'),{'id':Number(_0x2bea57[_0x50a2('0xb6')]['id']),'tags':_0x517c96||[]});return{'id':Number(_0x2bea57[_0x50a2('0xb6')]['id']),'tags':_0x517c96||[]};});}})[_0x50a2('0x2e')](respondWithResult(_0x119ee2,null))['catch'](handleError(_0x119ee2,null));};exports['removeTags']=function(_0x2bab1d,_0x167fc5,_0x47c30c){return db[_0x50a2('0x3c')][_0x50a2('0x5d')]({'where':{'id':_0x2bab1d[_0x50a2('0xb6')]['id']}})['then'](handleEntityNotFound(_0x167fc5,null))[_0x50a2('0x2e')](function(_0x3abc5b){if(_0x3abc5b){return _0x3abc5b['removeTags'](_0x2bab1d['query'][_0x50a2('0xbb')]);}})[_0x50a2('0x2e')](respondWithStatusCode(_0x167fc5,null))[_0x50a2('0xae')](handleError(_0x167fc5,null));};exports[_0x50a2('0xc7')]=function(_0xd1e303,_0x25f89c){var _0x3e69d1=moment()[_0x50a2('0xc8')]()[_0x50a2('0x92')]();var _0x637b00=path['join'](config[_0x50a2('0xc9')],_0x50a2('0xca'),_0x50a2('0xcb'),_0x50a2('0xcc'));var _0x6b89c5=path['join'](config['root'],_0x50a2('0xca'),_0x50a2('0xcb'),_0x50a2('0xcd'));var _0x335f74=path[_0x50a2('0xce')](_0x637b00,_0x3e69d1);var _0x3eedcd=util['format'](_0x50a2('0xcf'),_0xd1e303['params']['id'],_0x3e69d1);var _0x37c3ff=path[_0x50a2('0xce')](_0x637b00,_0x3eedcd);var _0x31c5ac=[];_0x31c5ac['push']({'model':db[_0x50a2('0xd0')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x31c5ac[_0x50a2('0x3a')]({'model':db[_0x50a2('0xd1')],'as':_0x50a2('0x63'),'attributes':['id',_0x50a2('0xd2'),_0x50a2('0xd3')],'raw':!![]});if(_0xd1e303[_0x50a2('0x40')][_0x50a2('0xcd')]){_0x31c5ac['push']({'model':db['Attachment'],'as':_0x50a2('0xd4'),'raw':!![]});}var _0x56310a=[{'model':db[_0x50a2('0xb9')],'as':_0x50a2('0xd5'),'attributes':['id',_0x50a2('0xb4'),'createdAt',_0x50a2('0xd6'),'secret','read'],'include':_0x31c5ac}];_0x56310a[_0x50a2('0x3a')]({'model':db[_0x50a2('0xd7')],'as':_0x50a2('0xd8'),'attributes':['id',_0x50a2('0x32')]});_0x56310a[_0x50a2('0x3a')]({'model':db[_0x50a2('0xd0')],'as':'Owner','attributes':['id',_0x50a2('0x35')]});return db['WhatsappInteraction'][_0x50a2('0x5d')]({'where':{'id':_0xd1e303['params']['id']},'include':_0x56310a})['then'](handleEntityNotFound(_0x25f89c,null))[_0x50a2('0x2e')](function(_0x1b0dac){if(_0x1b0dac){var _0x1e44ba=_0x1b0dac['get']({'plain':!![]});fs[_0x50a2('0xd9')](_0x335f74);var _0x136053={'channel':_0x50a2('0xda'),'account':_0x1e44ba[_0x50a2('0xd8')][_0x50a2('0x32')],'agent':_0x1e44ba['Owner']?_0x1e44ba[_0x50a2('0xdb')][_0x50a2('0x35')]:_0x50a2('0xdc'),'createdAt':moment(_0x1e44ba[_0x50a2('0x76')])[_0x50a2('0xbf')](_0x50a2('0xc0'))[_0x50a2('0x92')](),'closedAt':_0x1e44ba[_0x50a2('0xdd')]?moment(_0x1e44ba[_0x50a2('0xde')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x50a2('0x92')]():'','disposition':_0x1e44ba['disposition'],'messages':_(_0x1e44ba[_0x50a2('0xd5')])[_0x50a2('0x81')]({'secret':![]})[_0x50a2('0x34')](function(_0x342b54){if(_0x342b54['Attachment']){var _0x35c5b2=path[_0x50a2('0xce')](_0x6b89c5,_0x342b54[_0x50a2('0xd4')][_0x50a2('0xdf')]);if(fs[_0x50a2('0xe0')](_0x35c5b2)){fs[_0x50a2('0xe1')](_0x35c5b2)[_0x50a2('0xe2')](fs[_0x50a2('0xe3')](path['join'](_0x335f74,_0x342b54['Attachment'][_0x50a2('0xdf')])));}}return{'date':moment(_0x342b54[_0x50a2('0x76')])[_0x50a2('0xbf')](_0x50a2('0xc0'))[_0x50a2('0x92')](),'sender':_0x342b54[_0x50a2('0xd6')]===_0x50a2('0xe4')?_0x342b54[_0x50a2('0xd0')]?_0x342b54[_0x50a2('0xd0')][_0x50a2('0x35')]:_0x50a2('0xe5'):_0x342b54[_0x50a2('0x63')]['firstName']+(_0x342b54[_0x50a2('0x63')][_0x50a2('0xd3')]?'\x20'+_0x342b54[_0x50a2('0x63')][_0x50a2('0xd3')]:''),'body':_0x342b54['Attachment']?_0x342b54[_0x50a2('0xd4')][_0x50a2('0xdf')]:_0x342b54[_0x50a2('0xb4')],'direction':_0x342b54[_0x50a2('0xd6')]==='out'?'A':'C','secret':_0x342b54[_0x50a2('0xe6')],'read':_0x342b54['read'],'attachment':_0x342b54[_0x50a2('0xd4')]};})[_0x50a2('0x5f')]()};return ejs[_0x50a2('0xe7')](path['join'](config[_0x50a2('0xc9')],_0x50a2('0xca'),_0x50a2('0xe8'),_0x50a2('0xe9')),{'interaction':_0x136053})[_0x50a2('0x2e')](function(_0x509e99){var _0x318a2b=path[_0x50a2('0xce')](_0x335f74,_0x50a2('0xea')+_0x1e44ba['id']+'-'+_0x3e69d1+_0x50a2('0xeb'));var _0xfa01ce={'path':_0x318a2b,'channel':'Whatsapp','interactionId':_0x1e44ba['id']};return pdf['createPdfFromHTML'](_0x509e99,_0xfa01ce);})[_0x50a2('0x2e')](function(){return new BPromise(function(_0x359fd6,_0x45ebc0){zipdir(_0x335f74,{'saveTo':_0x37c3ff},function(_0xaafbf9,_0x1cbf86){if(_0xaafbf9)return _0x45ebc0(_0xaafbf9);return _0x359fd6(_0x1cbf86);});})[_0x50a2('0x2e')](function(){return new BPromise(function(_0x42621f,_0x3b2ece){rimraf(_0x335f74,function(_0x1fcbab){if(_0x1fcbab)_0x3b2ece(_0x1fcbab);return _0x42621f();});});})[_0x50a2('0x2e')](function(){return _0x25f89c[_0x50a2('0xc7')](_0x37c3ff,_0x3eedcd,function(_0x5e38d3){if(_0x5e38d3){console[_0x50a2('0xec')](_0x50a2('0xed'),_0x5e38d3);}else{fs['unlinkSync'](_0x37c3ff);}});});});}else{return _0x25f89c[_0x50a2('0x21')](0xc8);}})[_0x50a2('0xae')](handleError(_0x25f89c,null));}; \ No newline at end of file +var _0x86dd=['removeTags','download','unix','server','tmp','transcript-%d-%s.zip','join','fullname','CmContact','firstName','lastName','Attachment','Messages','direction','secret','Account','Owner','get','Whatsapp','N.A.','createdAt','closed','disposition','createReadStream','pipe','createWriteStream','basename','out','System','renderFile','root','transcript-','.pdf','createPdfFromHTML','log','err','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./whatsappInteraction.socket','register','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','destroy','error','name','send','Users','map','Tags','split','forEach','TagIds','then','catch','index','WhatsappInteraction','rawAttributes','type','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','select','field','color','tools_tags','u.fullname','ui.WhatsappInteractionId','from','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','concat','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','WhatsappAccountId','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','i.WhatsappAccountId\x20IN\x20?','toString','sequelize','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.mobile','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','push','all','show','params','include','create','describe','addMessage','WhatsappMessage','omit','getMessages','format','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','setTags','ids','findAll','emit','whatsappInteractionTags:save'];(function(_0x4306f7,_0x57cd08){var _0x54188a=function(_0xad612a){while(--_0xad612a){_0x4306f7['push'](_0x4306f7['shift']());}};_0x54188a(++_0x57cd08);}(_0x86dd,0x1ee));var _0xd86d=function(_0x34691b,_0x1b9707){_0x34691b=_0x34691b-0x0;var _0x3e8032=_0x86dd[_0x34691b];return _0x3e8032;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd86d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd86d('0x1'));var rp=require(_0xd86d('0x2'));var moment=require(_0xd86d('0x3'));var BPromise=require(_0xd86d('0x4'));var Mustache=require(_0xd86d('0x5'));var util=require(_0xd86d('0x6'));var path=require(_0xd86d('0x7'));var sox=require(_0xd86d('0x8'));var csv=require(_0xd86d('0x9'));var ejs=require(_0xd86d('0xa'));var fs=require('fs');var fs_extra=require(_0xd86d('0xb'));var _=require(_0xd86d('0xc'));var squel=require('squel');var crypto=require(_0xd86d('0xd'));var jsforce=require(_0xd86d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd86d('0x9'));var querystring=require(_0xd86d('0xf'));var Papa=require(_0xd86d('0x10'));var Redis=require(_0xd86d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xd86d('0x12'));var as=require(_0xd86d('0x13'));var pdf=require(_0xd86d('0x14'));var hardwareService=require(_0xd86d('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xd86d('0x16'));var config=require(_0xd86d('0x17'));var licenseUtil=require(_0xd86d('0x18'));var db=require(_0xd86d('0x19'))['db'];config[_0xd86d('0x1a')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd86d('0x1b'))(new Redis(config[_0xd86d('0x1a')]));require(_0xd86d('0x1c'))[_0xd86d('0x1d')](socket);function respondWithStatusCode(_0x4457b0,_0x397931){_0x397931=_0x397931||0xcc;return function(_0x3aa815){if(_0x3aa815){return _0x4457b0['sendStatus'](_0x397931);}return _0x4457b0[_0xd86d('0x1e')](_0x397931)[_0xd86d('0x1f')]();};}function respondWithResult(_0x38dc37,_0x413fb8){_0x413fb8=_0x413fb8||0xc8;return function(_0x34ee10){if(_0x34ee10){return _0x38dc37[_0xd86d('0x1e')](_0x413fb8)[_0xd86d('0x20')](_0x34ee10);}};}function respondWithFilteredResult(_0x418270,_0x3086a5){return function(_0x21efda){if(_0x21efda){var _0x5aabdb=typeof _0x3086a5['offset']===_0xd86d('0x21')&&typeof _0x3086a5[_0xd86d('0x22')]===_0xd86d('0x21');var _0x573556=_0x21efda[_0xd86d('0x23')];var _0x19e4de=_0x5aabdb?0x0:_0x3086a5[_0xd86d('0x24')];var _0x5a632c=_0x5aabdb?_0x21efda[_0xd86d('0x23')]:_0x3086a5[_0xd86d('0x24')]+_0x3086a5['limit'];var _0x384bb3;if(_0x5a632c>=_0x573556){_0x5a632c=_0x573556;_0x384bb3=0xc8;}else{_0x384bb3=0xce;}_0x418270[_0xd86d('0x1e')](_0x384bb3);return _0x418270[_0xd86d('0x25')]('Content-Range',_0x19e4de+'-'+_0x5a632c+'/'+_0x573556)[_0xd86d('0x20')](_0x21efda);}return null;};}function patchUpdates(_0x30c0f1){return function(_0xdc92c1){try{jsonpatch[_0xd86d('0x26')](_0xdc92c1,_0x30c0f1,!![]);}catch(_0x49845b){return BPromise[_0xd86d('0x27')](_0x49845b);}return _0xdc92c1[_0xd86d('0x28')]();};}function saveUpdates(_0x5e1ea3,_0x59f60e){return function(_0x5497e5){if(_0x5497e5){return _0x5497e5[_0xd86d('0x29')](_0x5e1ea3)['then'](function(_0x158dcb){return _0x158dcb;});}return null;};}function removeEntity(_0x4b42ca,_0x48c7cc){return function(_0x327a2e){if(_0x327a2e){return _0x327a2e[_0xd86d('0x2a')]()['then'](function(){_0x4b42ca[_0xd86d('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38e4b3,_0x4b99f7){return function(_0x593007){if(!_0x593007){_0x38e4b3['sendStatus'](0x194);}return _0x593007;};}function handleError(_0x5eacd9,_0x345bb7){_0x345bb7=_0x345bb7||0x1f4;return function(_0x5daa94){logger[_0xd86d('0x2b')](_0x5daa94['stack']);if(_0x5daa94[_0xd86d('0x2c')]){delete _0x5daa94[_0xd86d('0x2c')];}_0x5eacd9[_0xd86d('0x1e')](_0x345bb7)[_0xd86d('0x2d')](_0x5daa94);};}function getInteractionUsers(_0x5e02a9,_0x2be14e){return new BPromise(function(_0x260219,_0x3f6d72){try{if(_0x2be14e[_0x5e02a9['id']]){_0x5e02a9[_0xd86d('0x2e')]=_[_0xd86d('0x2f')](_0x2be14e[_0x5e02a9['id']],function(_0x15cbe0){return{'id':_0x15cbe0['id'],'fullname':_0x15cbe0['fullname']};});}}catch(_0x222d22){_0x3f6d72(_0x222d22);}_0x260219(_0x5e02a9);});}function getInteractionTags(_0x2dafd7,_0x19bd35){return new BPromise(function(_0x331e3a,_0x5ac42d){try{if(_0x2dafd7['TagIds']){_0x2dafd7[_0xd86d('0x30')]=[];_0x2dafd7['TagIds'][_0xd86d('0x31')](',')[_0xd86d('0x32')](function(_0x2db3c8){_0x2dafd7[_0xd86d('0x30')]['push'](_0x19bd35[_0x2db3c8]);});}delete _0x2dafd7[_0xd86d('0x33')];}catch(_0x11e5b8){_0x5ac42d(_0x11e5b8);}_0x331e3a(_0x2dafd7);});}function updateWhatsappInteraction(_0x506a2e,_0x23e985,_0x2efe2e){return new BPromise(function(_0x3cd8f7,_0x5eb8f3){return getInteractionUsers(_0x506a2e,_0x2efe2e)[_0xd86d('0x34')](function(_0x535c3a){return getInteractionTags(_0x535c3a,_0x23e985);})[_0xd86d('0x34')](function(_0x5e77ad){_0x3cd8f7(_0x5e77ad);})[_0xd86d('0x35')](function(_0x1bd874){_0x5eb8f3(_0x1bd874);});});}exports[_0xd86d('0x36')]=function(_0x581f1c,_0x1325dc){var _0x4cd9d4={},_0x4000b8={},_0x479ac8={'count':0x0,'rows':[]};var _0x20a77f=_[_0xd86d('0x2f')](db[_0xd86d('0x37')][_0xd86d('0x38')],function(_0x8ff892){return{'name':_0x8ff892['fieldName'],'type':_0x8ff892[_0xd86d('0x39')]['key']};});_0x4000b8[_0xd86d('0x3a')]=_['map'](_0x20a77f,_0xd86d('0x2c'));_0x4000b8['query']=_[_0xd86d('0x3b')](_0x581f1c['query']);_0x4000b8['filters']=_[_0xd86d('0x3c')](_0x4000b8[_0xd86d('0x3a')],_0x4000b8[_0xd86d('0x3d')]);_0x4cd9d4[_0xd86d('0x3e')]=_['intersection'](_0x4000b8['model'],qs[_0xd86d('0x3f')](_0x581f1c[_0xd86d('0x3d')][_0xd86d('0x3f')]));_0x4cd9d4[_0xd86d('0x3e')]=_0x4cd9d4['attributes'][_0xd86d('0x40')]?_0x4cd9d4[_0xd86d('0x3e')]:_0x4000b8[_0xd86d('0x3a')];if(!_0x581f1c[_0xd86d('0x3d')][_0xd86d('0x41')](_0xd86d('0x42'))){_0x4cd9d4[_0xd86d('0x22')]=qs[_0xd86d('0x22')](_0x581f1c['query'][_0xd86d('0x22')]);_0x4cd9d4['offset']=qs[_0xd86d('0x24')](_0x581f1c[_0xd86d('0x3d')][_0xd86d('0x24')]);}_0x4cd9d4[_0xd86d('0x43')]=qs['sort'](_0x581f1c[_0xd86d('0x3d')][_0xd86d('0x44')]);_0x4cd9d4[_0xd86d('0x45')]=qs[_0xd86d('0x46')](_[_0xd86d('0x47')](_0x581f1c[_0xd86d('0x3d')],_0x4000b8[_0xd86d('0x46')]),_0x20a77f);var _0x50515b=[];var _0x873f9d=squel[_0xd86d('0x48')]()[_0xd86d('0x49')]('id')[_0xd86d('0x49')](_0xd86d('0x2c'))[_0xd86d('0x49')](_0xd86d('0x4a'))['from'](_0xd86d('0x4b'));var _0x29183f=squel['select']()['field']('u.id')[_0xd86d('0x49')](_0xd86d('0x4c'))['field'](_0xd86d('0x4d'))[_0xd86d('0x4e')](_0xd86d('0x4f'),'ui')[_0xd86d('0x50')](_0xd86d('0x51'),'u',_0xd86d('0x52'));var _0x263cf4=squel['select']()['from'](_0xd86d('0x53'),'i')[_0xd86d('0x50')]('cm_contacts','c',_0xd86d('0x54'))[_0xd86d('0x50')](_0xd86d('0x51'),'o',_0xd86d('0x55'))['left_join'](_0xd86d('0x56'),'a',_0xd86d('0x57'))[_0xd86d('0x50')]('whatsapp_messages','me',_0xd86d('0x58'))[_0xd86d('0x50')](_0xd86d('0x59'),'it','it.WhatsappInteractionId\x20=\x20i.id')[_0xd86d('0x50')](_0xd86d('0x4b'),'t',_0xd86d('0x5a'));var _0x53ca96=squel[_0xd86d('0x5b')]();var _0xf007cc=[];var _0x537df3=squel[_0xd86d('0x5b')]();var _0x387cdd;if(_0x581f1c[_0xd86d('0x3d')][_0xd86d('0x5c')]){_0x387cdd=as[_0xd86d('0x5d')](_0x581f1c['query']['search']);var _0x33963a=_0x387cdd[_0xd86d('0x5e')];for(var _0x1e6b4a=0x0;_0x1e6b4a<_0x387cdd[_0xd86d('0x5f')][_0xd86d('0x40')];_0x1e6b4a++){var _0x3f5d98=_0x387cdd[_0xd86d('0x5f')][_0x1e6b4a];var _0x55a7c5='i';var _0x477b3e=_[_0xd86d('0x60')](_0x20a77f,[_0xd86d('0x2c'),_0x3f5d98['field']]);if(!_0x477b3e){switch(_0x3f5d98[_0xd86d('0x49')]){case _0xd86d('0x61'):if(_0x3f5d98[_0xd86d('0x62')]==0x1){_0x263cf4[_0xd86d('0x63')]('`'+_0x3f5d98[_0xd86d('0x49')]+_0xd86d('0x64'));}else{_0x263cf4[_0xd86d('0x63')]('`'+_0x3f5d98['field']+_0xd86d('0x65'));}break;case _0xd86d('0x66'):if(_0x3f5d98[_0xd86d('0x67')]===_0xd86d('0x68')){if(_0x3f5d98['value']['split']('\x20')[_0xd86d('0x40')]>0x1){_0x53ca96[_0x33963a](_0xd86d('0x69'),qs[_0xd86d('0x6a')](_0x3f5d98[_0xd86d('0x62')]),null);}else{var _0x1184bf='%'+_0x3f5d98[_0xd86d('0x62')]+'%';_0x53ca96[_0x33963a](_0xd86d('0x6b'),_0x1184bf,_0x1184bf,_0x1184bf);}}else{_0x477b3e=_[_0xd86d('0x60')](_0x20a77f,[_0xd86d('0x2c'),_0xd86d('0x6c')]);_0x3f5d98[_0xd86d('0x49')]=_0xd86d('0x6c');_0x5cce59=as[_0xd86d('0x6d')](_0x55a7c5,_0x477b3e[_0xd86d('0x39')],_0x3f5d98);_0x53ca96[_0x33963a](_0x5cce59[_0xd86d('0x6e')],_0x5cce59[_0xd86d('0x62')][_0xd86d('0x6f')],_0x5cce59['value'][_0xd86d('0x1f')]);}break;case _0xd86d('0x70'):var _0x3f2d10=_0x3f5d98[_0xd86d('0x62')][_0xd86d('0x31')](',')[_0xd86d('0x2f')](function(_0x389b50){return Number(_0x389b50);});_0x3f2d10[_0xd86d('0x32')](function(_0x4018be){_0x537df3['or'](_0xd86d('0x71'),'%,'+_0x4018be+',%');});_0xf007cc=_['union'](_0xf007cc,_0x3f2d10);break;case _0xd86d('0x72'):if(_0x3f5d98[_0xd86d('0x67')]===_0xd86d('0x68')){_0x53ca96[_0x33963a](_0xd86d('0x73'),'%'+_0x3f5d98[_0xd86d('0x62')]+'%',null);}else{_0x477b3e=_['find'](_0x20a77f,[_0xd86d('0x2c'),_0xd86d('0x74')]);_0x3f5d98['field']=_0xd86d('0x74');_0x5cce59=as['buildExpression'](_0x55a7c5,_0x477b3e['type'],_0x3f5d98);_0x53ca96[_0x33963a](_0x5cce59['text'],_0x5cce59[_0xd86d('0x62')][_0xd86d('0x6f')],_0x5cce59['value'][_0xd86d('0x1f')]);}break;case _0xd86d('0x75'):_0x5cce59=as[_0xd86d('0x6d')]('me',null,_0x3f5d98);_0x53ca96[_0x33963a](_0x5cce59[_0xd86d('0x6e')],_0x5cce59[_0xd86d('0x62')]['start'],_0x5cce59[_0xd86d('0x62')][_0xd86d('0x1f')]);break;}}else{var _0x5cce59=as[_0xd86d('0x6d')](_0x55a7c5,_0x477b3e['type'],_0x3f5d98);_0x53ca96[_0x33963a](_0x5cce59[_0xd86d('0x6e')],_0x5cce59[_0xd86d('0x62')]['start'],_0x5cce59[_0xd86d('0x62')][_0xd86d('0x1f')]);}}}else{var _0xc29719=_(_0x581f1c[_0xd86d('0x3d')])[_0xd86d('0x3b')]()[_0xd86d('0x2f')](function(_0xd14708){return _[_0xd86d('0x76')](_0x20a77f,[_0xd86d('0x2c'),_0xd14708])?_0xd14708:undefined;})[_0xd86d('0x77')]()['value']();if(!_['isEmpty'](_0xc29719)){_0xc29719[_0xd86d('0x32')](function(_0x6a1cd5){if(_0x6a1cd5==='WhatsappAccountId'){_0x263cf4[_0xd86d('0x45')]('i.WhatsappAccountId\x20IN\x20?',[][_0xd86d('0x78')](_0x581f1c[_0xd86d('0x3d')][_0x6a1cd5]));}else if(_0x6a1cd5==='createdAt'){var _0x138af7=JSON[_0xd86d('0x79')](_0x581f1c['query'][_0x6a1cd5])[_0xd86d('0x7a')];var _0x29e8f0=JSON['parse'](_0x581f1c[_0xd86d('0x3d')][_0x6a1cd5])[_0xd86d('0x7b')];_0x263cf4[_0xd86d('0x45')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x138af7,_0x29e8f0);}else{if(_0x581f1c[_0xd86d('0x3d')][_0x6a1cd5]===_0xd86d('0x7c')){_0x263cf4[_0xd86d('0x45')]('i.'+_0x6a1cd5+_0xd86d('0x7d'));}else{_0x263cf4['where']('i.'+_0x6a1cd5+_0xd86d('0x7e'),_0x581f1c['query'][_0x6a1cd5]);}}});}if(_0x581f1c['query']['read']){if(_0x581f1c[_0xd86d('0x3d')][_0xd86d('0x7f')]==0x1){_0x263cf4['having']('`unreadMessages`\x20=\x200');}else{_0x263cf4['having'](_0xd86d('0x80'));}}if(_0x581f1c[_0xd86d('0x3d')][_0xd86d('0x81')]){_0xf007cc=_[_0xd86d('0x82')](_0x581f1c['query'][_0xd86d('0x81')])?_0x581f1c[_0xd86d('0x3d')][_0xd86d('0x81')]:new Array(_0x581f1c[_0xd86d('0x3d')][_0xd86d('0x81')]);_0xf007cc[_0xd86d('0x32')](function(_0x2b50cd){_0x537df3['or'](_0xd86d('0x71'),'%,'+_0x2b50cd+',%');});}if(_0x581f1c[_0xd86d('0x3d')][_0xd86d('0x83')]){var _0x3a449a=_0x581f1c[_0xd86d('0x3d')][_0xd86d('0x83')][_0xd86d('0x84')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xd86d('0x85')](_0x3a449a)){_0x53ca96['or']('i.id\x20LIKE\x20?',_0x3a449a+'%')['or'](_0xd86d('0x86'),_0x3a449a+'%');}else{_0x53ca96['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xd86d('0x6a')](_0x3a449a))['or'](_0xd86d('0x87'),_0x3a449a+'%');}}}_0x263cf4['where'](_0x53ca96);_0x263cf4['group'](_0xd86d('0x88'));var _0x2eb4fa={'type':db[_0xd86d('0x89')]['QueryTypes']['SELECT'],'raw':!![]};var _0x32ad46=_0x263cf4['clone']();_0x32ad46[_0xd86d('0x49')](_0xd86d('0x88'));_0x32ad46[_0xd86d('0x49')](_0xd86d('0x8a'),'unreadMessages');if(_0x4cd9d4[_0xd86d('0x43')]){_0x4cd9d4[_0xd86d('0x43')]['forEach'](function(_0x24426f){var _0x533de2=_0x24426f[0x0]===_0xd86d('0x8b')?_0x24426f[0x0]:'i.'+_0x24426f[0x0];_0x263cf4[_0xd86d('0x43')](_0x533de2,_0x24426f[0x1]===_0xd86d('0x8c')?![]:!![]);});}if(!_['isEmpty'](_0xf007cc)){_0x263cf4['having'](_0x537df3);_0x32ad46[_0xd86d('0x45')](_0xd86d('0x8d'),_0xf007cc);}BPromise[_0xd86d('0x8e')]()[_0xd86d('0x34')](function(){if(!_0x387cdd){if(_0x581f1c['query'][_0xd86d('0x8f')])return;_0x32ad46[_0xd86d('0x45')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x263cf4[_0xd86d('0x45')](_0xd86d('0x90'));return;}if(_0x581f1c[_0xd86d('0x91')][_0xd86d('0x92')]!==_0xd86d('0x93'))return;return _0x581f1c[_0xd86d('0x91')][_0xd86d('0x94')]({'attributes':['id'],'raw':!![]})[_0xd86d('0x34')](function(_0x4e1771){if(_['isEmpty'](_0x4e1771)){_0x32ad46[_0xd86d('0x45')](_0xd86d('0x95'));_0x263cf4['where'](_0xd86d('0x95'));}else{_0x32ad46['where'](_0xd86d('0x96'),_[_0xd86d('0x2f')](_0x4e1771,'id'));_0x263cf4[_0xd86d('0x45')]('i.WhatsappAccountId\x20IN\x20?',_[_0xd86d('0x2f')](_0x4e1771,'id'));}});})['then'](function(){if(_0x581f1c['user']['role']==='agent'&&!_0x387cdd&&!_0x581f1c[_0xd86d('0x3d')][_0xd86d('0x8f')])return[];return db['sequelize'][_0xd86d('0x3d')](_0x32ad46[_0xd86d('0x97')](),_0x2eb4fa);})[_0xd86d('0x34')](function(_0x3fdfc5){_0x479ac8['count']=_0x3fdfc5[_0xd86d('0x40')];if(_0x479ac8[_0xd86d('0x23')]===0x0)return[];return db[_0xd86d('0x98')][_0xd86d('0x3d')](_0x873f9d[_0xd86d('0x97')](),_0x2eb4fa)[_0xd86d('0x34')](function(_0x1f4286){_0x50515b=_[_0xd86d('0x99')](_0x1f4286,'id');_0x2eb4fa=_[_0xd86d('0x9a')](_0x2eb4fa,{'model':db[_0xd86d('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x581f1c[_0xd86d('0x3d')][_0xd86d('0x3f')]){_0x4cd9d4[_0xd86d('0x3e')][_0xd86d('0x32')](function(_0xc706dd){_0x263cf4['field']('i.'+_0xc706dd);});}else{_0x263cf4['field'](_0xd86d('0x8a'),'unreadMessages');_0x263cf4[_0xd86d('0x49')](_0xd86d('0x9b'),_0xd86d('0x9c'));_0x263cf4['field'](_0xd86d('0x9d'),_0xd86d('0x9e'));_0x263cf4['field'](_0xd86d('0x9f'),_0xd86d('0x8b'));_0x263cf4['field'](_0xd86d('0xa0'));_0x263cf4[_0xd86d('0x49')]('c.firstName',_0xd86d('0xa1'));_0x263cf4[_0xd86d('0x49')](_0xd86d('0xa2'),'Contact.lastName');_0x263cf4[_0xd86d('0x49')](_0xd86d('0xa3'),_0xd86d('0xa4'));_0x263cf4[_0xd86d('0x49')](_0xd86d('0xa5'),'Contact.phone');_0x263cf4[_0xd86d('0x49')]('c.mobile',_0xd86d('0xa6'));_0x263cf4[_0xd86d('0x49')]('c.fax','Contact.fax');_0x263cf4['field']('o.fullname','Owner.fullname');_0x263cf4[_0xd86d('0x49')](_0xd86d('0xa7'),_0xd86d('0xa8'));_0x263cf4[_0xd86d('0x49')](_0xd86d('0xa9'),_0xd86d('0x33'));}if(_0x4cd9d4[_0xd86d('0x22')])_0x263cf4[_0xd86d('0x22')](_0x4cd9d4[_0xd86d('0x22')]);if(_0x4cd9d4['offset'])_0x263cf4[_0xd86d('0x24')](_0x4cd9d4[_0xd86d('0x24')]);return db[_0xd86d('0x98')]['query'](_0x263cf4[_0xd86d('0x97')](),_0x2eb4fa);})['then'](function(_0x5ba520){if(_0x5ba520['length']>0x0)_0x29183f['where'](_0xd86d('0xaa'),_[_0xd86d('0x2f')](_0x5ba520,'id'));return db['sequelize'][_0xd86d('0x3d')](_0x29183f[_0xd86d('0x97')](),_0x2eb4fa)['then'](function(_0x173c3d){var _0x3585a1=_[_0xd86d('0xab')](_0x173c3d,_0xd86d('0xac'));var _0xeeeedd=[];_0x5ba520['forEach'](function(_0x34469a){_0xeeeedd[_0xd86d('0xad')](updateWhatsappInteraction(_0x34469a,_0x50515b,_0x3585a1));});return BPromise[_0xd86d('0xae')](_0xeeeedd);});});})[_0xd86d('0x34')](function(_0x3d2eda){_0x479ac8['rows']=_0x3d2eda;return _0x479ac8;})[_0xd86d('0x34')](respondWithFilteredResult(_0x1325dc,_0x4cd9d4))['catch'](handleError(_0x1325dc,null));};exports[_0xd86d('0xaf')]=function(_0x3b66f1,_0x404564){var _0x4e8229={'raw':![],'where':{'id':_0x3b66f1[_0xd86d('0xb0')]['id']}},_0x250244={};_0x250244[_0xd86d('0x3a')]=_[_0xd86d('0x3b')](db[_0xd86d('0x37')]['rawAttributes']);_0x250244[_0xd86d('0x3d')]=_[_0xd86d('0x3b')](_0x3b66f1[_0xd86d('0x3d')]);_0x250244[_0xd86d('0x46')]=_[_0xd86d('0x3c')](_0x250244[_0xd86d('0x3a')],_0x250244[_0xd86d('0x3d')]);_0x4e8229[_0xd86d('0x3e')]=_[_0xd86d('0x3c')](_0x250244[_0xd86d('0x3a')],qs[_0xd86d('0x3f')](_0x3b66f1[_0xd86d('0x3d')]['fields']));_0x4e8229['attributes']=_0x4e8229[_0xd86d('0x3e')]['length']?_0x4e8229[_0xd86d('0x3e')]:_0x250244[_0xd86d('0x3a')];if(_0x3b66f1[_0xd86d('0x3d')]['includeAll']){_0x4e8229[_0xd86d('0xb1')]=[{'all':!![]}];}_0x4e8229=_['merge']({},_0x4e8229,_0x3b66f1['options']);return db[_0xd86d('0x37')]['find'](_0x4e8229)[_0xd86d('0x34')](handleEntityNotFound(_0x404564,null))[_0xd86d('0x34')](respondWithResult(_0x404564,null))[_0xd86d('0x35')](handleError(_0x404564,null));};exports[_0xd86d('0xb2')]=function(_0x3d48d0,_0x1ba996){return db[_0xd86d('0x37')][_0xd86d('0xb2')](_0x3d48d0[_0xd86d('0x75')],{})['then'](respondWithResult(_0x1ba996,0xc9))[_0xd86d('0x35')](handleError(_0x1ba996,null));};exports[_0xd86d('0x29')]=function(_0x59c321,_0x486335){if(_0x59c321[_0xd86d('0x75')]['id']){delete _0x59c321[_0xd86d('0x75')]['id'];}return db[_0xd86d('0x37')]['find']({'where':{'id':_0x59c321[_0xd86d('0xb0')]['id']}})['then'](handleEntityNotFound(_0x486335,null))[_0xd86d('0x34')](saveUpdates(_0x59c321[_0xd86d('0x75')],null))['then'](respondWithResult(_0x486335,null))[_0xd86d('0x35')](handleError(_0x486335,null));};exports['destroy']=function(_0xdd0a71,_0x4f5a90){return db[_0xd86d('0x37')][_0xd86d('0x60')]({'where':{'id':_0xdd0a71[_0xd86d('0xb0')]['id']}})[_0xd86d('0x34')](handleEntityNotFound(_0x4f5a90,null))[_0xd86d('0x34')](removeEntity(_0x4f5a90,null))[_0xd86d('0x35')](handleError(_0x4f5a90,null));};exports[_0xd86d('0xb3')]=function(_0xfff635,_0x532756){return db['WhatsappInteraction'][_0xd86d('0xb3')]()['then'](respondWithResult(_0x532756,null))[_0xd86d('0x35')](handleError(_0x532756,null));};exports[_0xd86d('0xb4')]=function(_0x114bb1,_0x205d01,_0x377653){return db[_0xd86d('0xb5')][_0xd86d('0x60')]({'where':{'id':_0x114bb1[_0xd86d('0xb0')]['id']}})[_0xd86d('0x34')](handleEntityNotFound(_0x205d01,null))[_0xd86d('0x34')](function(_0x1b0532){if(_0x1b0532){return _0x1b0532[_0xd86d('0xb4')](_0x114bb1[_0xd86d('0x75')]['ids'],_[_0xd86d('0xb6')](_0x114bb1['body'],['ids','id'])||{});}})[_0xd86d('0x34')](respondWithResult(_0x205d01,null))[_0xd86d('0x35')](handleError(_0x205d01,null));};exports[_0xd86d('0xb7')]=function(_0x317f9a,_0x2be092,_0x58ad81){var _0x2deaaf={'raw':![],'where':{}};var _0x58f65c={};var _0x3a5869={'count':0x0,'rows':[]};return db[_0xd86d('0x37')]['findOne']({'where':{'id':_0x317f9a[_0xd86d('0xb0')]['id']}})[_0xd86d('0x34')](handleEntityNotFound(_0x2be092,null))['then'](function(_0x3a1616){if(_0x3a1616){_0x58f65c[_0xd86d('0x3a')]=_[_0xd86d('0x3b')](db[_0xd86d('0xb5')][_0xd86d('0x38')]);_0x58f65c['query']=_['keys'](_0x317f9a['query']);_0x58f65c['filters']=_[_0xd86d('0x3c')](_0x58f65c[_0xd86d('0x3a')],_0x58f65c[_0xd86d('0x3d')]);_0x2deaaf[_0xd86d('0x3e')]=_['intersection'](_0x58f65c[_0xd86d('0x3a')],qs[_0xd86d('0x3f')](_0x317f9a[_0xd86d('0x3d')]['fields']));_0x2deaaf[_0xd86d('0x3e')]=_0x2deaaf['attributes'][_0xd86d('0x40')]?_0x2deaaf['attributes']:_0x58f65c[_0xd86d('0x3a')];if(!_0x317f9a['query'][_0xd86d('0x41')]('nolimit')){_0x2deaaf[_0xd86d('0x22')]=qs[_0xd86d('0x22')](_0x317f9a[_0xd86d('0x3d')][_0xd86d('0x22')]);_0x2deaaf[_0xd86d('0x24')]=qs['offset'](_0x317f9a[_0xd86d('0x3d')][_0xd86d('0x24')]);}_0x2deaaf[_0xd86d('0x43')]=qs[_0xd86d('0x44')](_0x317f9a['query'][_0xd86d('0x44')]);_0x2deaaf['where']=qs['filters'](_['pick'](_0x317f9a[_0xd86d('0x3d')],_0x58f65c[_0xd86d('0x46')]));_0x2deaaf[_0xd86d('0x45')][_0xd86d('0xac')]=_0x3a1616['id'];if(_0x317f9a['query'][_0xd86d('0x83')]){_0x2deaaf[_0xd86d('0x45')]=_['merge'](_0x2deaaf['where'],{'$or':_[_0xd86d('0x2f')](_0x2deaaf['attributes'],function(_0x32ad1a){var _0x4abe69={};_0x4abe69[_0x32ad1a]={'$like':'%'+_0x317f9a[_0xd86d('0x3d')][_0xd86d('0x83')]+'%'};return _0x4abe69;})});}if(_0x317f9a['query'][_0xd86d('0x7a')]){var _0x1b0b86=_0x317f9a[_0xd86d('0x3d')]['$gte'][_0xd86d('0x31')](',');var _0x55bccd={};_0x55bccd[_0x1b0b86[0x0]]={'$gte':moment(_0x1b0b86[0x1])[_0xd86d('0xb8')](_0xd86d('0xb9'))};_0x2deaaf[_0xd86d('0x45')]=_[_0xd86d('0x9a')](_0x2deaaf[_0xd86d('0x45')],_0x55bccd);}_0x2deaaf=_['merge']({},_0x2deaaf,_0x317f9a[_0xd86d('0xba')]);return db[_0xd86d('0xb5')][_0xd86d('0x23')]({'where':_0x2deaaf[_0xd86d('0x45')]})['then'](function(_0xe0e96c){_0x3a5869[_0xd86d('0x23')]=_0xe0e96c;if(_0x317f9a[_0xd86d('0x3d')][_0xd86d('0xbb')]){_0x2deaaf[_0xd86d('0xb1')]=[{'all':!![]}];}return db[_0xd86d('0xb5')]['findAll'](_0x2deaaf);})[_0xd86d('0x34')](function(_0x3bbcfd){_0x3a5869['rows']=_0x3bbcfd;return _0x3a5869;});}})['then'](respondWithFilteredResult(_0x2be092,_0x2deaaf))['catch'](handleError(_0x2be092,null));};exports['addTags']=function(_0x5d1025,_0x44c5eb,_0x36e8b7){return db[_0xd86d('0x37')][_0xd86d('0x60')]({'where':{'id':_0x5d1025[_0xd86d('0xb0')]['id']}})['then'](handleEntityNotFound(_0x44c5eb,null))[_0xd86d('0x34')](function(_0x582b6d){if(_0x582b6d){return _0x582b6d[_0xd86d('0xbc')](_0x5d1025[_0xd86d('0x75')][_0xd86d('0xbd')],_[_0xd86d('0xb6')](_0x5d1025['body'],[_0xd86d('0xbd'),'id'])||{})['spread'](function(){return db[_0xd86d('0x70')][_0xd86d('0xbe')]({'attributes':['id',_0xd86d('0x2c'),_0xd86d('0x4a')],'where':{'id':_0x5d1025[_0xd86d('0x75')][_0xd86d('0xbd')]}});})[_0xd86d('0x34')](function(_0x109b9a){socket[_0xd86d('0xbf')](_0xd86d('0xc0'),{'id':Number(_0x5d1025[_0xd86d('0xb0')]['id']),'tags':_0x109b9a||[]});return{'id':Number(_0x5d1025[_0xd86d('0xb0')]['id']),'tags':_0x109b9a||[]};});}})[_0xd86d('0x34')](respondWithResult(_0x44c5eb,null))['catch'](handleError(_0x44c5eb,null));};exports['removeTags']=function(_0x3bf82f,_0x3e34a3,_0x315458){return db[_0xd86d('0x37')]['find']({'where':{'id':_0x3bf82f[_0xd86d('0xb0')]['id']}})[_0xd86d('0x34')](handleEntityNotFound(_0x3e34a3,null))['then'](function(_0x30767a){if(_0x30767a){return _0x30767a[_0xd86d('0xc1')](_0x3bf82f[_0xd86d('0x3d')]['ids']);}})[_0xd86d('0x34')](respondWithStatusCode(_0x3e34a3,null))['catch'](handleError(_0x3e34a3,null));};exports[_0xd86d('0xc2')]=function(_0xafd8f0,_0x4977b8){var _0x5f51c6=moment()[_0xd86d('0xc3')]()[_0xd86d('0x97')]();var _0x23196e=path['join'](config['root'],_0xd86d('0xc4'),'files',_0xd86d('0xc5'));var _0x961bf7=path['join'](config['root'],_0xd86d('0xc4'),'files','attachments');var _0x4fb58d=path['join'](_0x23196e,_0x5f51c6);var _0x1c3c0c=util[_0xd86d('0xb8')](_0xd86d('0xc6'),_0xafd8f0[_0xd86d('0xb0')]['id'],_0x5f51c6);var _0x5bc9a8=path[_0xd86d('0xc7')](_0x23196e,_0x1c3c0c);var _0x6d3e17=[];_0x6d3e17['push']({'model':db[_0xd86d('0x72')],'as':_0xd86d('0x72'),'attributes':['id',_0xd86d('0xc8')],'raw':!![]});_0x6d3e17[_0xd86d('0xad')]({'model':db[_0xd86d('0xc9')],'as':_0xd86d('0x66'),'attributes':['id',_0xd86d('0xca'),_0xd86d('0xcb')],'raw':!![]});if(_0xafd8f0[_0xd86d('0x3d')]['attachments']){_0x6d3e17[_0xd86d('0xad')]({'model':db[_0xd86d('0xcc')],'as':_0xd86d('0xcc'),'raw':!![]});}var _0x497793=[{'model':db[_0xd86d('0xb5')],'as':_0xd86d('0xcd'),'attributes':['id',_0xd86d('0x75'),'createdAt',_0xd86d('0xce'),_0xd86d('0xcf'),_0xd86d('0x7f')],'include':_0x6d3e17}];_0x497793['push']({'model':db['WhatsappAccount'],'as':_0xd86d('0xd0'),'attributes':['id','name']});_0x497793['push']({'model':db[_0xd86d('0x72')],'as':_0xd86d('0xd1'),'attributes':['id',_0xd86d('0xc8')]});return db['WhatsappInteraction'][_0xd86d('0x60')]({'where':{'id':_0xafd8f0[_0xd86d('0xb0')]['id']},'include':_0x497793})[_0xd86d('0x34')](handleEntityNotFound(_0x4977b8,null))[_0xd86d('0x34')](function(_0x5b4840){if(_0x5b4840){var _0x1c7886=_0x5b4840[_0xd86d('0xd2')]({'plain':!![]});fs['mkdirSync'](_0x4fb58d);var _0x170b44={'channel':_0xd86d('0xd3'),'account':_0x1c7886[_0xd86d('0xd0')][_0xd86d('0x2c')],'agent':_0x1c7886['Owner']?_0x1c7886[_0xd86d('0xd1')]['fullname']:_0xd86d('0xd4'),'createdAt':moment(_0x1c7886[_0xd86d('0xd5')])[_0xd86d('0xb8')](_0xd86d('0xb9'))[_0xd86d('0x97')](),'closedAt':_0x1c7886[_0xd86d('0xd6')]?moment(_0x1c7886['closedAt'])[_0xd86d('0xb8')](_0xd86d('0xb9'))[_0xd86d('0x97')]():'','disposition':_0x1c7886[_0xd86d('0xd7')],'messages':_(_0x1c7886[_0xd86d('0xcd')])['filter']({'secret':![]})[_0xd86d('0x2f')](function(_0x3980e1){if(_0x3980e1[_0xd86d('0xcc')]){var _0x4631e7=path[_0xd86d('0xc7')](_0x961bf7,_0x3980e1[_0xd86d('0xcc')]['basename']);if(fs['existsSync'](_0x4631e7)){fs[_0xd86d('0xd8')](_0x4631e7)[_0xd86d('0xd9')](fs[_0xd86d('0xda')](path[_0xd86d('0xc7')](_0x4fb58d,_0x3980e1[_0xd86d('0xcc')][_0xd86d('0xdb')])));}}return{'date':moment(_0x3980e1['createdAt'])[_0xd86d('0xb8')](_0xd86d('0xb9'))['toString'](),'sender':_0x3980e1['direction']===_0xd86d('0xdc')?_0x3980e1[_0xd86d('0x72')]?_0x3980e1[_0xd86d('0x72')][_0xd86d('0xc8')]:_0xd86d('0xdd'):_0x3980e1[_0xd86d('0x66')][_0xd86d('0xca')]+(_0x3980e1[_0xd86d('0x66')][_0xd86d('0xcb')]?'\x20'+_0x3980e1[_0xd86d('0x66')][_0xd86d('0xcb')]:''),'body':_0x3980e1['Attachment']?_0x3980e1['Attachment'][_0xd86d('0xdb')]:_0x3980e1['body'],'direction':_0x3980e1[_0xd86d('0xce')]==='out'?'A':'C','secret':_0x3980e1[_0xd86d('0xcf')],'read':_0x3980e1[_0xd86d('0x7f')],'attachment':_0x3980e1[_0xd86d('0xcc')]};})[_0xd86d('0x62')]()};return ejs[_0xd86d('0xde')](path[_0xd86d('0xc7')](config[_0xd86d('0xdf')],'server','views','downloadInteraction.ejs'),{'interaction':_0x170b44})[_0xd86d('0x34')](function(_0x199d67){var _0x50994b=path['join'](_0x4fb58d,_0xd86d('0xe0')+_0x1c7886['id']+'-'+_0x5f51c6+_0xd86d('0xe1'));var _0x440879={'path':_0x50994b,'channel':_0xd86d('0xd3'),'interactionId':_0x1c7886['id']};return pdf[_0xd86d('0xe2')](_0x199d67,_0x440879);})[_0xd86d('0x34')](function(){return new BPromise(function(_0x3c764d,_0x1ec0e5){zipdir(_0x4fb58d,{'saveTo':_0x5bc9a8},function(_0xcc07b4,_0x3f113c){if(_0xcc07b4)return _0x1ec0e5(_0xcc07b4);return _0x3c764d(_0x3f113c);});})[_0xd86d('0x34')](function(){return new BPromise(function(_0x849db8,_0xc7001a){rimraf(_0x4fb58d,function(_0x53edb3){if(_0x53edb3)_0xc7001a(_0x53edb3);return _0x849db8();});});})[_0xd86d('0x34')](function(){return _0x4977b8[_0xd86d('0xc2')](_0x5bc9a8,_0x1c3c0c,function(_0x18577a){if(_0x18577a){console[_0xd86d('0xe3')](_0xd86d('0xe4'),_0x18577a);}else{fs['unlinkSync'](_0x5bc9a8);}});});});}else{return _0x4977b8['sendStatus'](0xc8);}})[_0xd86d('0x35')](handleError(_0x4977b8,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index d0403fd..2010845 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 _0x7d13=['length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll'];(function(_0x3207e7,_0x5b0b8e){var _0x2e0d86=function(_0x1022cd){while(--_0x1022cd){_0x3207e7['push'](_0x3207e7['shift']());}};_0x2e0d86(++_0x5b0b8e);}(_0x7d13,0x6c));var _0x37d1=function(_0x599798,_0x2cbe80){_0x599798=_0x599798-0x0;var _0x592116=_0x7d13[_0x599798];return _0x592116;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0x37d1('0x0'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x37d1('0x0'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x37d1('0x1')](0x0);var events={'afterCreate':_0x37d1('0x2'),'afterUpdate':_0x37d1('0x3'),'afterDestroy':_0x37d1('0x4')};function emitEvent(_0x1bfec7){return function(_0x491797,_0x2c28e1,_0x2255e5){_0x491797[_0x37d1('0x5')]({'attributes':['id'],'raw':!![]})[_0x37d1('0x6')](function(_0x5146e3){_0x491797[_0x37d1('0x7')](_0x37d1('0x8'),_0x5146e3[_0x37d1('0x9')](function(_0x3e39aa){return{'id':_0x3e39aa['id']};}));return WhatsappMessage[_0x37d1('0xa')]({'where':{'WhatsappInteractionId':_0x491797['id'],'direction':'in','read':![]},'raw':!![]});})[_0x37d1('0x6')](function(_0x418bb1){_0x491797['setDataValue']('unreadMessages',_0x418bb1[_0x37d1('0xb')]);WhatsappInteractionEvents[_0x37d1('0xc')](_0x1bfec7+':'+_0x491797['id'],_0x491797);WhatsappInteractionEvents['emit'](_0x1bfec7,_0x491797);_0x2255e5(null);})[_0x37d1('0xd')](_0x2255e5(null));};}for(var e in events){if(events[_0x37d1('0xe')](e)){var event=events[e];WhatsappInteraction[_0x37d1('0xf')](e,emitEvent(event));}}module[_0x37d1('0x10')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x12c9=['then','setDataValue','map','length','emit','catch','hasOwnProperty','hook','exports','events','WhatsappInteraction','WhatsappMessage','save','update','remove'];(function(_0x572839,_0x2ef05d){var _0x3a02c6=function(_0x13b8cb){while(--_0x13b8cb){_0x572839['push'](_0x572839['shift']());}};_0x3a02c6(++_0x2ef05d);}(_0x12c9,0x9f));var _0x912c=function(_0x247f32,_0x133b06){_0x247f32=_0x247f32-0x0;var _0x3b3182=_0x12c9[_0x247f32];return _0x3b3182;};'use strict';var EventEmitter=require(_0x912c('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0x912c('0x1')];var WhatsappMessage=require('../../mysqldb')['db'][_0x912c('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x912c('0x3'),'afterUpdate':_0x912c('0x4'),'afterDestroy':_0x912c('0x5')};function emitEvent(_0x2a35f5){return function(_0x2afc58,_0x10e658,_0x572179){_0x2afc58['getUsers']({'attributes':['id'],'raw':!![]})[_0x912c('0x6')](function(_0xf08f88){_0x2afc58[_0x912c('0x7')]('Users',_0xf08f88[_0x912c('0x8')](function(_0x5a6c03){return{'id':_0x5a6c03['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x2afc58['id'],'direction':'in','read':![]},'raw':!![]});})[_0x912c('0x6')](function(_0x484f33){_0x2afc58['setDataValue']('unreadMessages',_0x484f33[_0x912c('0x9')]);WhatsappInteractionEvents['emit'](_0x2a35f5+':'+_0x2afc58['id'],_0x2afc58);WhatsappInteractionEvents[_0x912c('0xa')](_0x2a35f5,_0x2afc58);_0x572179(null);})[_0x912c('0xb')](_0x572179(null));};}for(var e in events){if(events[_0x912c('0xc')](e)){var event=events[e];WhatsappInteraction[_0x912c('0xd')](e,emitEvent(event));}}module[_0x912c('0xe')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index a6b45b7..d25ffd4 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 _0x13ac=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','request-promise','path','rimraf','./whatsappInteraction.attributes','define','WhatsappInteraction','whatsapp_interactions','changed'];(function(_0xd9c274,_0x58f1ef){var _0x56aa81=function(_0x20029f){while(--_0x20029f){_0xd9c274['push'](_0xd9c274['shift']());}};_0x56aa81(++_0x58f1ef);}(_0x13ac,0x120));var _0xc13a=function(_0x1a6231,_0x49427d){_0x1a6231=_0x1a6231-0x0;var _0x19347f=_0x13ac[_0x1a6231];return _0x19347f;};'use strict';var _=require(_0xc13a('0x0'));var util=require('util');var logger=require(_0xc13a('0x1'))(_0xc13a('0x2'));var moment=require(_0xc13a('0x3'));var BPromise=require('bluebird');var rp=require(_0xc13a('0x4'));var fs=require('fs');var path=require(_0xc13a('0x5'));var rimraf=require(_0xc13a('0x6'));var config=require('../../config/environment');var attributes=require(_0xc13a('0x7'));module['exports']=function(_0x53aa3a,_0x54348e){return _0x53aa3a[_0xc13a('0x8')](_0xc13a('0x9'),attributes,{'tableName':_0xc13a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x14f057,_0x42475d,_0x3ddc19){if(_0x14f057[_0xc13a('0xb')]('closed')){_0x14f057[_0xc13a('0xc')]=moment()[_0xc13a('0xd')](_0xc13a('0xe'));}_0x3ddc19(null,_0x14f057);}}});}; \ No newline at end of file +var _0x2c38=['exports','WhatsappInteraction','whatsapp_interactions','closed','closedAt','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappInteraction.attributes'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x2c38,0x109));var _0x82c3=function(_0x57eabc,_0x33c089){_0x57eabc=_0x57eabc-0x0;var _0x4c1ce4=_0x2c38[_0x57eabc];return _0x4c1ce4;};'use strict';var _=require(_0x82c3('0x0'));var util=require(_0x82c3('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x82c3('0x2'));var BPromise=require(_0x82c3('0x3'));var rp=require(_0x82c3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x82c3('0x5'));var config=require(_0x82c3('0x6'));var attributes=require(_0x82c3('0x7'));module[_0x82c3('0x8')]=function(_0x72ba87,_0x1c760f){return _0x72ba87['define'](_0x82c3('0x9'),attributes,{'tableName':_0x82c3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x371d87,_0x588b32,_0x46635b){if(_0x371d87['changed'](_0x82c3('0xb'))){_0x371d87[_0x82c3('0xc')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x46635b(null,_0x371d87);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index b99a4a5..e0f4ccf 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 _0xed0c=['addTags','omit','ids','spread','AddTags','lodash','util','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','limit','debug','AddTagsToWhatsappInteraction','find'];(function(_0x242c97,_0x5d1f9e){var _0x3bce18=function(_0x31cb68){while(--_0x31cb68){_0x242c97['push'](_0x242c97['shift']());}};_0x3bce18(++_0x5d1f9e);}(_0xed0c,0x12b));var _0xced0=function(_0x2c64df,_0x29f51b){_0x2c64df=_0x2c64df-0x0;var _0x3108dd=_0xed0c[_0x2c64df];return _0x3108dd;};'use strict';var _=require(_0xced0('0x0'));var util=require(_0xced0('0x1'));var moment=require('moment');var BPromise=require(_0xced0('0x2'));var rs=require(_0xced0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xced0('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xced0('0x5'));var config=require(_0xced0('0x6'));var jayson=require(_0xced0('0x7'));var client=jayson['client'][_0xced0('0x8')]({'port':0x232a});config[_0xced0('0x9')]=_[_0xced0('0xa')](config[_0xced0('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xced0('0xb'))(new Redis(config[_0xced0('0x9')]));require(_0xced0('0xc'))['register'](socket);function respondWithRpcPromise(_0x4a93dd,_0x1dd0df,_0x225b02){return new BPromise(function(_0x476ce7,_0x4a5c87){return client[_0xced0('0xd')](_0x4a93dd,_0x225b02)[_0xced0('0xe')](function(_0x3531b4){logger[_0xced0('0xf')](_0xced0('0x10'),_0x1dd0df,_0xced0('0x11'));logger['debug'](_0xced0('0x12'),_0x1dd0df,_0xced0('0x11'),JSON[_0xced0('0x13')](_0x3531b4));if(_0x3531b4[_0xced0('0x14')]){if(_0x3531b4[_0xced0('0x14')][_0xced0('0x15')]===0x1f4){logger[_0xced0('0x14')]('WhatsappInteraction,\x20%s,\x20%s',_0x1dd0df,_0x3531b4[_0xced0('0x14')][_0xced0('0x16')]);return _0x4a5c87(_0x3531b4['error']['message']);}logger[_0xced0('0x14')](_0xced0('0x10'),_0x1dd0df,_0x3531b4[_0xced0('0x14')][_0xced0('0x16')]);return _0x476ce7(_0x3531b4[_0xced0('0x14')]['message']);}else{logger[_0xced0('0xf')]('WhatsappInteraction,\x20%s,\x20%s',_0x1dd0df,_0xced0('0x11'));_0x476ce7(_0x3531b4[_0xced0('0x17')][_0xced0('0x16')]);}})[_0xced0('0x18')](function(_0x4a76d6){logger[_0xced0('0x14')]('WhatsappInteraction,\x20%s,\x20%s',_0x1dd0df,_0x4a76d6);_0x4a5c87(_0x4a76d6);});});}exports[_0xced0('0x19')]=function(_0x4f370f){var _0x13ad98=this;return new Promise(function(_0x32e008,_0x4bc7db){return db[_0xced0('0x1a')][_0xced0('0x1b')](_0x4f370f[_0xced0('0x1c')],{'raw':_0x4f370f[_0xced0('0x1d')]?_0x4f370f[_0xced0('0x1d')][_0xced0('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f370f[_0xced0('0x1d')]?_0x4f370f[_0xced0('0x1d')][_0xced0('0x1f')]||null:null,'attributes':_0x4f370f[_0xced0('0x1d')]?_0x4f370f[_0xced0('0x1d')][_0xced0('0x20')]||null:null,'limit':_0x4f370f['options']?_0x4f370f[_0xced0('0x1d')][_0xced0('0x21')]||null:null})[_0xced0('0xe')](function(_0x4b0d5e){logger[_0xced0('0xf')]('UpdateWhatsappInteraction',_0x4f370f);logger[_0xced0('0x22')](_0xced0('0x19'),_0x4f370f,JSON[_0xced0('0x13')](_0x4b0d5e));_0x32e008(_0x4b0d5e);})[_0xced0('0x18')](function(_0x2ba4f1){logger[_0xced0('0x14')](_0xced0('0x19'),_0x2ba4f1[_0xced0('0x16')],_0x4f370f);_0x4bc7db(_0x13ad98[_0xced0('0x14')](0x1f4,_0x2ba4f1[_0xced0('0x16')]));});});};exports[_0xced0('0x23')]=function(_0x449004){return new Promise(function(_0x50f553,_0x12d0a7){return db[_0xced0('0x1a')][_0xced0('0x24')]({'where':_0x449004[_0xced0('0x1d')]?_0x449004['options'][_0xced0('0x1f')]||null:null})['then'](function(_0x14ec14){if(_0x14ec14){return _0x14ec14[_0xced0('0x25')](_0x449004[_0xced0('0x1c')]['ids'],_[_0xced0('0x26')](_0x449004[_0xced0('0x1c')],[_0xced0('0x27'),'id'])||{});}})[_0xced0('0x28')](function(_0x315995){logger[_0xced0('0xf')](_0xced0('0x29'),_0x449004);logger[_0xced0('0x22')]('AddTags',_0x449004,JSON[_0xced0('0x13')](_0x315995));_0x50f553(_0x315995);})[_0xced0('0x18')](function(_0x1e054d){logger[_0xced0('0x14')]('AddTags',_0x1e054d[_0xced0('0x16')],_0x449004);_0x12d0a7(_this['error'](0x1f4,_0x1e054d['message']));});});}; \ No newline at end of file +var _0x929f=['message','result','WhatsappInteraction','options','raw','attributes','then','UpdateWhatsappInteraction','find','where','addTags','body','ids','spread','AddTags','debug','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','info','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x929f,0x130));var _0xf929=function(_0x24afdc,_0x6aa8c1){_0x24afdc=_0x24afdc-0x0;var _0x530701=_0x929f[_0x24afdc];return _0x530701;};'use strict';var _=require(_0xf929('0x0'));var util=require('util');var moment=require(_0xf929('0x1'));var BPromise=require('bluebird');var rs=require(_0xf929('0x2'));var fs=require('fs');var Redis=require(_0xf929('0x3'));var db=require(_0xf929('0x4'))['db'];var utils=require(_0xf929('0x5'));var logger=require(_0xf929('0x6'))('rpc');var config=require(_0xf929('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf929('0x8')][_0xf929('0x9')]({'port':0x232a});config['redis']=_[_0xf929('0xa')](config[_0xf929('0xb')],{'host':_0xf929('0xc'),'port':0x18eb});var socket=require(_0xf929('0xd'))(new Redis(config['redis']));require(_0xf929('0xe'))[_0xf929('0xf')](socket);function respondWithRpcPromise(_0x3a2841,_0x1fc49b,_0x30d091){return new BPromise(function(_0x35af59,_0x83d6f5){return client[_0xf929('0x10')](_0x3a2841,_0x30d091)['then'](function(_0x9ed24e){logger[_0xf929('0x11')]('WhatsappInteraction,\x20%s,\x20%s',_0x1fc49b,_0xf929('0x12'));logger['debug'](_0xf929('0x13'),_0x1fc49b,_0xf929('0x12'),JSON[_0xf929('0x14')](_0x9ed24e));if(_0x9ed24e[_0xf929('0x15')]){if(_0x9ed24e[_0xf929('0x15')][_0xf929('0x16')]===0x1f4){logger['error'](_0xf929('0x17'),_0x1fc49b,_0x9ed24e[_0xf929('0x15')]['message']);return _0x83d6f5(_0x9ed24e['error'][_0xf929('0x18')]);}logger[_0xf929('0x15')]('WhatsappInteraction,\x20%s,\x20%s',_0x1fc49b,_0x9ed24e[_0xf929('0x15')]['message']);return _0x35af59(_0x9ed24e[_0xf929('0x15')]['message']);}else{logger[_0xf929('0x11')](_0xf929('0x17'),_0x1fc49b,'request\x20sent');_0x35af59(_0x9ed24e[_0xf929('0x19')][_0xf929('0x18')]);}})['catch'](function(_0x1db843){logger[_0xf929('0x15')](_0xf929('0x17'),_0x1fc49b,_0x1db843);_0x83d6f5(_0x1db843);});});}exports['UpdateWhatsappInteraction']=function(_0x19729a){var _0x383cad=this;return new Promise(function(_0x2c0fb1,_0x38e389){return db[_0xf929('0x1a')]['update'](_0x19729a['body'],{'raw':_0x19729a[_0xf929('0x1b')]?_0x19729a[_0xf929('0x1b')][_0xf929('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19729a[_0xf929('0x1b')]?_0x19729a[_0xf929('0x1b')]['where']||null:null,'attributes':_0x19729a[_0xf929('0x1b')]?_0x19729a[_0xf929('0x1b')][_0xf929('0x1d')]||null:null,'limit':_0x19729a[_0xf929('0x1b')]?_0x19729a[_0xf929('0x1b')]['limit']||null:null})[_0xf929('0x1e')](function(_0x4e10f1){logger[_0xf929('0x11')](_0xf929('0x1f'),_0x19729a);logger['debug'](_0xf929('0x1f'),_0x19729a,JSON[_0xf929('0x14')](_0x4e10f1));_0x2c0fb1(_0x4e10f1);})['catch'](function(_0x45c4e0){logger[_0xf929('0x15')](_0xf929('0x1f'),_0x45c4e0[_0xf929('0x18')],_0x19729a);_0x38e389(_0x383cad['error'](0x1f4,_0x45c4e0['message']));});});};exports['AddTagsToWhatsappInteraction']=function(_0x430989){return new Promise(function(_0x150064,_0x18f7d5){return db['WhatsappInteraction'][_0xf929('0x20')]({'where':_0x430989[_0xf929('0x1b')]?_0x430989['options'][_0xf929('0x21')]||null:null})[_0xf929('0x1e')](function(_0x2dad5e){if(_0x2dad5e){return _0x2dad5e[_0xf929('0x22')](_0x430989[_0xf929('0x23')][_0xf929('0x24')],_['omit'](_0x430989['body'],[_0xf929('0x24'),'id'])||{});}})[_0xf929('0x25')](function(_0xab14cc){logger['info'](_0xf929('0x26'),_0x430989);logger[_0xf929('0x27')](_0xf929('0x26'),_0x430989,JSON['stringify'](_0xab14cc));_0x150064(_0xab14cc);})[_0xf929('0x28')](function(_0x18a19c){logger[_0xf929('0x15')]('AddTags',_0x18a19c[_0xf929('0x18')],_0x430989);_0x18f7d5(_this[_0xf929('0x15')](0x1f4,_0x18a19c[_0xf929('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index bcfe711..01971fa 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 _0x949b=['register','whatsappInteraction:','save','removeListener'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x949b,0x1de));var _0xb949=function(_0x5b8642,_0x49d4d5){_0x5b8642=_0x5b8642-0x0;var _0x5c0d3b=_0x949b[_0x5b8642];return _0x5c0d3b;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0xb949('0x0'),'remove','update'];function createListener(_0x377ee5,_0xfa87c8){return function(_0x4975f2){_0xfa87c8['emit'](_0x377ee5,_0x4975f2);};}function removeListener(_0x595c4e,_0x2c78c4){return function(){WhatsappInteractionEvents[_0xb949('0x1')](_0x595c4e,_0x2c78c4);};}exports[_0xb949('0x2')]=function(_0x1d1395){for(var _0x1ec548=0x0,_0x487394=events['length'];_0x1ec548<_0x487394;_0x1ec548++){var _0x13a84d=events[_0x1ec548];var _0x39bd11=createListener(_0xb949('0x3')+_0x13a84d,_0x1d1395);WhatsappInteractionEvents['on'](_0x13a84d,_0x39bd11);}}; \ No newline at end of file +var _0x9591=['./whatsappInteraction.events','save','update','emit','removeListener','register','length','whatsappInteraction:'];(function(_0x3ab380,_0x382d01){var _0x8a0f9a=function(_0x3ade5f){while(--_0x3ade5f){_0x3ab380['push'](_0x3ab380['shift']());}};_0x8a0f9a(++_0x382d01);}(_0x9591,0xa8));var _0x1959=function(_0x373dcb,_0x11eab1){_0x373dcb=_0x373dcb-0x0;var _0x2ece70=_0x9591[_0x373dcb];return _0x2ece70;};'use strict';var WhatsappInteractionEvents=require(_0x1959('0x0'));var events=[_0x1959('0x1'),'remove',_0x1959('0x2')];function createListener(_0x3df685,_0x19ca84){return function(_0x388fb7){_0x19ca84[_0x1959('0x3')](_0x3df685,_0x388fb7);};}function removeListener(_0x1a80c2,_0x479de1){return function(){WhatsappInteractionEvents[_0x1959('0x4')](_0x1a80c2,_0x479de1);};}exports[_0x1959('0x5')]=function(_0x21e65a){for(var _0x3596cb=0x0,_0x54ba1f=events[_0x1959('0x6')];_0x3596cb<_0x54ba1f;_0x3596cb++){var _0x1c1162=events[_0x3596cb];var _0x244d93=createListener(_0x1959('0x7')+_0x1c1162,_0x21e65a);WhatsappInteractionEvents['on'](_0x1c1162,_0x244d93);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index a2cc4f3..f631c74 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 _0xe152=['../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe','/:id','post','whatsapp','whatsappmessage:create','create','/:id/status','status','put','update','/:id/accept','accept','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x8ee07d,_0x1b6c8d){var _0x4a4a17=function(_0x624d72){while(--_0x624d72){_0x8ee07d['push'](_0x8ee07d['shift']());}};_0x4a4a17(++_0x1b6c8d);}(_0xe152,0xca));var _0x2e15=function(_0x52d2bb,_0x2a496f){_0x52d2bb=_0x52d2bb-0x0;var _0x4cb948=_0xe152[_0x52d2bb];return _0x4cb948;};'use strict';var multer=require('multer');var util=require(_0x2e15('0x0'));var path=require(_0x2e15('0x1'));var timeout=require(_0x2e15('0x2'));var express=require(_0x2e15('0x3'));var router=express[_0x2e15('0x4')]();var fs_extra=require(_0x2e15('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2e15('0x6'));var controller=require(_0x2e15('0x7'));router[_0x2e15('0x8')]('/',auth[_0x2e15('0x9')](),controller[_0x2e15('0xa')]);router[_0x2e15('0x8')](_0x2e15('0xb'),auth[_0x2e15('0x9')](),controller['describe']);router[_0x2e15('0x8')](_0x2e15('0xc'),auth[_0x2e15('0x9')](),controller['show']);router[_0x2e15('0xd')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x2e15('0xe'),_0x2e15('0xf')),controller[_0x2e15('0x10')]);router['post'](_0x2e15('0x11'),controller[_0x2e15('0x12')]);router[_0x2e15('0x13')](_0x2e15('0xc'),auth['isAuthenticated'](),controller[_0x2e15('0x14')]);router[_0x2e15('0x13')](_0x2e15('0x15'),auth[_0x2e15('0x9')](),controller[_0x2e15('0x16')]);router[_0x2e15('0x13')]('/:id/reject',auth['isAuthenticated'](),controller['reject']);router[_0x2e15('0x17')]('/:id',auth[_0x2e15('0x9')](),controller[_0x2e15('0x18')]);module[_0x2e15('0x19')]=router; \ No newline at end of file +var _0xd835=['fs-extra','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put','/:id','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x3c624d,_0x3b7597){var _0x4c5c3f=function(_0xf58afb){while(--_0xf58afb){_0x3c624d['push'](_0x3c624d['shift']());}};_0x4c5c3f(++_0x3b7597);}(_0xd835,0xf3));var _0x5d83=function(_0x296809,_0x1c9665){_0x296809=_0x296809-0x0;var _0x18c0d3=_0xd835[_0x296809];return _0x18c0d3;};'use strict';var multer=require(_0x5d83('0x0'));var util=require(_0x5d83('0x1'));var path=require(_0x5d83('0x2'));var timeout=require(_0x5d83('0x3'));var express=require('express');var router=express[_0x5d83('0x4')]();var fs_extra=require(_0x5d83('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5d83('0x6'));var config=require(_0x5d83('0x7'));var controller=require(_0x5d83('0x8'));router[_0x5d83('0x9')]('/',auth[_0x5d83('0xa')](),controller[_0x5d83('0xb')]);router[_0x5d83('0x9')](_0x5d83('0xc'),auth[_0x5d83('0xa')](),controller[_0x5d83('0xd')]);router[_0x5d83('0x9')]('/:id',auth[_0x5d83('0xa')](),controller[_0x5d83('0xe')]);router[_0x5d83('0xf')]('/',auth[_0x5d83('0xa')](),interaction[_0x5d83('0x10')](_0x5d83('0x11'),_0x5d83('0x12')),controller[_0x5d83('0x13')]);router[_0x5d83('0xf')](_0x5d83('0x14'),controller[_0x5d83('0x15')]);router[_0x5d83('0x16')](_0x5d83('0x17'),auth[_0x5d83('0xa')](),controller['update']);router[_0x5d83('0x16')](_0x5d83('0x18'),auth[_0x5d83('0xa')](),controller[_0x5d83('0x19')]);router[_0x5d83('0x16')](_0x5d83('0x1a'),auth[_0x5d83('0xa')](),controller[_0x5d83('0x1b')]);router[_0x5d83('0x1c')](_0x5d83('0x17'),auth[_0x5d83('0xa')](),controller[_0x5d83('0x1d')]);module[_0x5d83('0x1e')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index c529f88..45334b5 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 _0xdb57=['BOOLEAN','STRING','DATE','TEXT','exports','medium'];(function(_0x240362,_0x156794){var _0x26de18=function(_0x4a4431){while(--_0x4a4431){_0x240362['push'](_0x240362['shift']());}};_0x26de18(++_0x156794);}(_0xdb57,0x148));var _0x7db5=function(_0x48ce69,_0x458674){_0x48ce69=_0x48ce69-0x0;var _0x1de6de=_0xdb57[_0x48ce69];return _0x1de6de;};'use strict';var Sequelize=require('sequelize');module[_0x7db5('0x0')]={'body':{'type':Sequelize['TEXT'](_0x7db5('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x7db5('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x7db5('0x3')]},'readAt':{'type':Sequelize[_0x7db5('0x4')]},'secret':{'type':Sequelize[_0x7db5('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x7db5('0x3')]},'providerResponse':{'type':Sequelize[_0x7db5('0x5')]}}; \ No newline at end of file +var _0x1f44=['BOOLEAN','STRING','sequelize','TEXT'];(function(_0x8bedec,_0x271809){var _0x24f1d8=function(_0x5e9031){while(--_0x5e9031){_0x8bedec['push'](_0x8bedec['shift']());}};_0x24f1d8(++_0x271809);}(_0x1f44,0x14a));var _0x41f4=function(_0x49ab21,_0x49afb4){_0x49ab21=_0x49ab21-0x0;var _0x4a5934=_0x1f44[_0x49ab21];return _0x4a5934;};'use strict';var Sequelize=require(_0x41f4('0x0'));module['exports']={'body':{'type':Sequelize[_0x41f4('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x41f4('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x41f4('0x3')](0xbe)},'phone':{'type':Sequelize[_0x41f4('0x3')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x41f4('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 6dab24a..1a8fee8 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 _0x6e12=['where','merge','include','findAll','show','keys','includeAll','options','find','create','body','params','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','contact','fullname','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','User','email','interface','WhatsappAccount','WhatsappAccountId','debug','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','MessageStatus','twilio','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','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','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','end','json','undefined','count','offset','limit','status','set','Content-Range','reject','save','update','destroy','sendStatus','name','send','index','WhatsappMessage','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter'];(function(_0x2d110a,_0x266520){var _0x4dd80c=function(_0x43a498){while(--_0x43a498){_0x2d110a['push'](_0x2d110a['shift']());}};_0x4dd80c(++_0x266520);}(_0x6e12,0x154));var _0x26e1=function(_0x5431d5,_0x580386){_0x5431d5=_0x5431d5-0x0;var _0x542470=_0x6e12[_0x5431d5];return _0x542470;};'use strict';var emlformat=require(_0x26e1('0x0'));var rimraf=require(_0x26e1('0x1'));var zipdir=require(_0x26e1('0x2'));var jsonpatch=require(_0x26e1('0x3'));var rp=require('request-promise');var moment=require(_0x26e1('0x4'));var BPromise=require(_0x26e1('0x5'));var Mustache=require(_0x26e1('0x6'));var util=require('util');var path=require('path');var sox=require(_0x26e1('0x7'));var csv=require(_0x26e1('0x8'));var ejs=require(_0x26e1('0x9'));var fs=require('fs');var fs_extra=require(_0x26e1('0xa'));var _=require(_0x26e1('0xb'));var squel=require('squel');var crypto=require(_0x26e1('0xc'));var jsforce=require(_0x26e1('0xd'));var deskjs=require(_0x26e1('0xe'));var toCsv=require(_0x26e1('0x8'));var querystring=require(_0x26e1('0xf'));var Papa=require('papaparse');var Redis=require(_0x26e1('0x10'));var authService=require(_0x26e1('0x11'));var qs=require(_0x26e1('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x26e1('0x13'));var logger=require(_0x26e1('0x14'))(_0x26e1('0x15'));var utils=require(_0x26e1('0x16'));var config=require(_0x26e1('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x26e1('0x18'))['db'];config[_0x26e1('0x19')]=_[_0x26e1('0x1a')](config['redis'],{'host':_0x26e1('0x1b'),'port':0x18eb});var socket=require(_0x26e1('0x1c'))(new Redis(config[_0x26e1('0x19')]));require(_0x26e1('0x1d'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x26e1('0x1e')][_0x26e1('0x1f')]({'port':0x232c});var client9002=jayson[_0x26e1('0x1e')][_0x26e1('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x438eca,_0x5edd81,_0x28f87b,_0x411b9d){return new BPromise(function(_0x545727,_0x1f4d1f){var _0x1043e1=_0x411b9d||client;return _0x1043e1[_0x26e1('0x20')](_0x438eca,_0x28f87b)[_0x26e1('0x21')](function(_0x2bb105){logger[_0x26e1('0x22')](_0x26e1('0x23'),_0x5edd81,'request\x20sent');logger['debug'](_0x26e1('0x24'),_0x5edd81,_0x26e1('0x25'),JSON[_0x26e1('0x26')](_0x2bb105));if(_0x2bb105['error']){if(_0x2bb105[_0x26e1('0x27')]['code']===0x1f4){logger[_0x26e1('0x27')]('WhatsappMessage,\x20%s,\x20%s',_0x5edd81,_0x2bb105[_0x26e1('0x27')][_0x26e1('0x28')]);return _0x1f4d1f(_0x2bb105[_0x26e1('0x27')]['message']);}logger[_0x26e1('0x27')](_0x26e1('0x23'),_0x5edd81,_0x2bb105[_0x26e1('0x27')][_0x26e1('0x28')]);return _0x545727(_0x2bb105[_0x26e1('0x27')][_0x26e1('0x28')]);}else{logger[_0x26e1('0x22')](_0x26e1('0x23'),_0x5edd81,_0x26e1('0x25'));_0x545727(_0x2bb105['result'][_0x26e1('0x28')]);}})[_0x26e1('0x29')](function(_0x21ed95){logger[_0x26e1('0x27')](_0x26e1('0x23'),_0x5edd81,_0x21ed95);_0x1f4d1f(_0x21ed95);});});}function respondWithStatusCode(_0x1d166c,_0x112285){_0x112285=_0x112285||0xcc;return function(_0x5973c1){if(_0x5973c1){return _0x1d166c['sendStatus'](_0x112285);}return _0x1d166c['status'](_0x112285)[_0x26e1('0x2a')]();};}function respondWithResult(_0x28278d,_0x198d1f){_0x198d1f=_0x198d1f||0xc8;return function(_0x587113){if(_0x587113){return _0x28278d['status'](_0x198d1f)[_0x26e1('0x2b')](_0x587113);}};}function respondWithFilteredResult(_0xeed638,_0x385698){return function(_0x2abff3){if(_0x2abff3){var _0x2e4c78=typeof _0x385698['offset']==='undefined'&&typeof _0x385698['limit']===_0x26e1('0x2c');var _0x2d7f78=_0x2abff3[_0x26e1('0x2d')];var _0x412b2f=_0x2e4c78?0x0:_0x385698['offset'];var _0x51396d=_0x2e4c78?_0x2abff3[_0x26e1('0x2d')]:_0x385698[_0x26e1('0x2e')]+_0x385698[_0x26e1('0x2f')];var _0xe0a08d;if(_0x51396d>=_0x2d7f78){_0x51396d=_0x2d7f78;_0xe0a08d=0xc8;}else{_0xe0a08d=0xce;}_0xeed638[_0x26e1('0x30')](_0xe0a08d);return _0xeed638[_0x26e1('0x31')](_0x26e1('0x32'),_0x412b2f+'-'+_0x51396d+'/'+_0x2d7f78)['json'](_0x2abff3);}return null;};}function patchUpdates(_0x96e6da){return function(_0x3b3006){try{jsonpatch['apply'](_0x3b3006,_0x96e6da,!![]);}catch(_0x13eb0d){return BPromise[_0x26e1('0x33')](_0x13eb0d);}return _0x3b3006[_0x26e1('0x34')]();};}function saveUpdates(_0x4dbc94,_0x4ac6f0){return function(_0x2c2a1c){if(_0x2c2a1c){return _0x2c2a1c[_0x26e1('0x35')](_0x4dbc94)[_0x26e1('0x21')](function(_0x50700a){return _0x50700a;});}return null;};}function removeEntity(_0x1a91c6,_0x1e9265){return function(_0xd14d1c){if(_0xd14d1c){return _0xd14d1c[_0x26e1('0x36')]()[_0x26e1('0x21')](function(){_0x1a91c6[_0x26e1('0x30')](0xcc)[_0x26e1('0x2a')]();});}};}function handleEntityNotFound(_0x27c4fc,_0x37a60d){return function(_0x11c8e0){if(!_0x11c8e0){_0x27c4fc[_0x26e1('0x37')](0x194);}return _0x11c8e0;};}function handleError(_0x576df7,_0x155d92){_0x155d92=_0x155d92||0x1f4;return function(_0x39584a){logger[_0x26e1('0x27')](_0x39584a['stack']);if(_0x39584a[_0x26e1('0x38')]){delete _0x39584a['name'];}_0x576df7[_0x26e1('0x30')](_0x155d92)[_0x26e1('0x39')](_0x39584a);};}exports[_0x26e1('0x3a')]=function(_0x395f56,_0x3cf73d){var _0x547d62={},_0x1401f6={},_0x4803aa={'count':0x0,'rows':[]};var _0x36ff0e=_['map'](db[_0x26e1('0x3b')][_0x26e1('0x3c')],function(_0x81efc2){return{'name':_0x81efc2[_0x26e1('0x3d')],'type':_0x81efc2[_0x26e1('0x3e')][_0x26e1('0x3f')]};});_0x1401f6['model']=_[_0x26e1('0x40')](_0x36ff0e,_0x26e1('0x38'));_0x1401f6[_0x26e1('0x41')]=_['keys'](_0x395f56[_0x26e1('0x41')]);_0x1401f6[_0x26e1('0x42')]=_[_0x26e1('0x43')](_0x1401f6[_0x26e1('0x44')],_0x1401f6[_0x26e1('0x41')]);_0x547d62[_0x26e1('0x45')]=_[_0x26e1('0x43')](_0x1401f6[_0x26e1('0x44')],qs['fields'](_0x395f56['query'][_0x26e1('0x46')]));_0x547d62[_0x26e1('0x45')]=_0x547d62[_0x26e1('0x45')][_0x26e1('0x47')]?_0x547d62['attributes']:_0x1401f6[_0x26e1('0x44')];if(!_0x395f56[_0x26e1('0x41')][_0x26e1('0x48')](_0x26e1('0x49'))){_0x547d62[_0x26e1('0x2f')]=qs[_0x26e1('0x2f')](_0x395f56[_0x26e1('0x41')][_0x26e1('0x2f')]);_0x547d62[_0x26e1('0x2e')]=qs['offset'](_0x395f56[_0x26e1('0x41')][_0x26e1('0x2e')]);}_0x547d62[_0x26e1('0x4a')]=qs[_0x26e1('0x4b')](_0x395f56[_0x26e1('0x41')]['sort']);_0x547d62['where']=qs[_0x26e1('0x42')](_['pick'](_0x395f56[_0x26e1('0x41')],_0x1401f6['filters']),_0x36ff0e);if(_0x395f56['query'][_0x26e1('0x4c')]){_0x547d62[_0x26e1('0x4d')]=_[_0x26e1('0x4e')](_0x547d62['where'],{'$or':_['map'](_0x36ff0e,function(_0x4d2d04){if(_0x4d2d04['type']!=='VIRTUAL'){var _0x126e12={};_0x126e12[_0x4d2d04[_0x26e1('0x38')]]={'$like':'%'+_0x395f56['query']['filter']+'%'};return _0x126e12;}})});}_0x547d62=_[_0x26e1('0x4e')]({},_0x547d62,_0x395f56['options']);var _0x301db1={'where':_0x547d62[_0x26e1('0x4d')]};return db[_0x26e1('0x3b')][_0x26e1('0x2d')](_0x301db1)[_0x26e1('0x21')](function(_0x3a1770){_0x4803aa[_0x26e1('0x2d')]=_0x3a1770;if(_0x395f56['query']['includeAll']){_0x547d62[_0x26e1('0x4f')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x26e1('0x50')](_0x547d62);})['then'](function(_0x442125){_0x4803aa['rows']=_0x442125;return _0x4803aa;})[_0x26e1('0x21')](respondWithFilteredResult(_0x3cf73d,_0x547d62))['catch'](handleError(_0x3cf73d,null));};exports[_0x26e1('0x51')]=function(_0xb2b76e,_0x1c1ddf){var _0xe7841={'raw':!![],'where':{'id':_0xb2b76e['params']['id']}},_0x16b73f={};_0x16b73f[_0x26e1('0x44')]=_[_0x26e1('0x52')](db[_0x26e1('0x3b')]['rawAttributes']);_0x16b73f['query']=_[_0x26e1('0x52')](_0xb2b76e[_0x26e1('0x41')]);_0x16b73f[_0x26e1('0x42')]=_['intersection'](_0x16b73f['model'],_0x16b73f[_0x26e1('0x41')]);_0xe7841[_0x26e1('0x45')]=_[_0x26e1('0x43')](_0x16b73f[_0x26e1('0x44')],qs[_0x26e1('0x46')](_0xb2b76e[_0x26e1('0x41')]['fields']));_0xe7841['attributes']=_0xe7841[_0x26e1('0x45')][_0x26e1('0x47')]?_0xe7841[_0x26e1('0x45')]:_0x16b73f[_0x26e1('0x44')];if(_0xb2b76e[_0x26e1('0x41')][_0x26e1('0x53')]){_0xe7841[_0x26e1('0x4f')]=[{'all':!![]}];}_0xe7841=_[_0x26e1('0x4e')]({},_0xe7841,_0xb2b76e[_0x26e1('0x54')]);return db[_0x26e1('0x3b')][_0x26e1('0x55')](_0xe7841)['then'](handleEntityNotFound(_0x1c1ddf,null))[_0x26e1('0x21')](respondWithResult(_0x1c1ddf,null))[_0x26e1('0x29')](handleError(_0x1c1ddf,null));};exports[_0x26e1('0x56')]=function(_0x4276a6,_0x1f1573){return db[_0x26e1('0x3b')][_0x26e1('0x56')](_0x4276a6[_0x26e1('0x57')],{})['then'](respondWithResult(_0x1f1573,0xc9))[_0x26e1('0x29')](handleError(_0x1f1573,null));};exports[_0x26e1('0x35')]=function(_0x3a8b77,_0x36622e){if(_0x3a8b77[_0x26e1('0x57')]['id']){delete _0x3a8b77['body']['id'];}return db['WhatsappMessage']['find']({'where':{'id':_0x3a8b77[_0x26e1('0x58')]['id']}})[_0x26e1('0x21')](handleEntityNotFound(_0x36622e,null))[_0x26e1('0x21')](saveUpdates(_0x3a8b77[_0x26e1('0x57')],null))[_0x26e1('0x21')](respondWithResult(_0x36622e,null))[_0x26e1('0x29')](handleError(_0x36622e,null));};exports[_0x26e1('0x36')]=function(_0x581dd1,_0x56b9cd){return db[_0x26e1('0x3b')][_0x26e1('0x55')]({'where':{'id':_0x581dd1[_0x26e1('0x58')]['id']}})[_0x26e1('0x21')](handleEntityNotFound(_0x56b9cd,null))[_0x26e1('0x21')](removeEntity(_0x56b9cd,null))[_0x26e1('0x29')](handleError(_0x56b9cd,null));};exports['describe']=function(_0x1256ea,_0x3ab10a){return db[_0x26e1('0x3b')][_0x26e1('0x59')]()['then'](respondWithResult(_0x3ab10a,null))[_0x26e1('0x29')](handleError(_0x3ab10a,null));};var interaction_log=require('../../config/logger')(_0x26e1('0x5a'));exports[_0x26e1('0x5b')]=function(_0x2d5377,_0x5410c6,_0x299cc0){var _0x4191ed={'agent':{},'channel':_0x26e1('0x5c')};if(_0x2d5377[_0x26e1('0x57')]['id']){delete _0x2d5377[_0x26e1('0x57')]['id'];}_0x2d5377[_0x26e1('0x57')][_0x26e1('0x5d')]=!![];_0x2d5377['body'][_0x26e1('0x5e')]=moment()[_0x26e1('0x5f')](_0x26e1('0x60'));_0x2d5377[_0x26e1('0x57')][_0x26e1('0x61')]=_0x2d5377[_0x26e1('0x57')][_0x26e1('0x61')]||_0x2d5377[_0x26e1('0x62')]['id'];_0x4191ed[_0x26e1('0x63')]['id']=_0x2d5377[_0x26e1('0x57')]['UserId'];return db[_0x26e1('0x3b')][_0x26e1('0x55')]({'where':{'id':_0x2d5377['params']['id'],'UserId':null}})[_0x26e1('0x21')](handleEntityNotFound(_0x5410c6,null))[_0x26e1('0x21')](saveUpdates(_0x2d5377[_0x26e1('0x57')],null))[_0x26e1('0x21')](function(_0x530d4d){if(_0x530d4d){_0x4191ed[_0x26e1('0x28')]=_0x530d4d[_0x26e1('0x64')]({'plain':!![]});return db[_0x26e1('0x65')][_0x26e1('0x55')]({'where':{'id':_0x530d4d[_0x26e1('0x66')]}});}return null;})[_0x26e1('0x21')](handleEntityNotFound(_0x5410c6,null))[_0x26e1('0x21')](function(_0x4c3ef2){if(_0x4c3ef2){return _0x4c3ef2[_0x26e1('0x35')]({'UserId':_0x2d5377[_0x26e1('0x57')][_0x26e1('0x61')],'read1stAt':_[_0x26e1('0x67')](_0x4c3ef2[_0x26e1('0x68')])?moment()[_0x26e1('0x5f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x437774){if(_0x437774){_0x4191ed[_0x26e1('0x69')]=_0x437774[_0x26e1('0x64')]({'plain':!![]});interaction_log['info']('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2d5377[_0x26e1('0x62')]['id'],_0x2d5377[_0x26e1('0x62')]['name'],_0x2d5377['user']['role'],_0x4191ed['interaction']['id'],_0x2d5377['body']?JSON[_0x26e1('0x26')](_0x2d5377['body']):_0x26e1('0x6a'));return respondWithRpcPromise('AcceptMessage',_0x26e1('0x6b'),_0x4191ed);}return null;})[_0x26e1('0x21')](function(_0x4b4d04){var _0x3aa053=_0x26e1('0x6c')+_0x4b4d04['message'][_0x26e1('0x6d')];return db[_0x26e1('0x6e')][_0x26e1('0x41')](_0x3aa053,{'type':db['Sequelize'][_0x26e1('0x6f')]['SELECT'],'raw':!![]})[_0x26e1('0x21')](function(_0x90327d){return _0x90327d;});})[_0x26e1('0x21')](function(_0x598a55){if(_0x598a55){_0x4191ed['message'][_0x26e1('0x70')]=_0x598a55[0x0];if(!_0x2d5377['body'][_0x26e1('0x61')])return;return db['User'][_0x26e1('0x55')]({'where':{'id':_0x2d5377[_0x26e1('0x57')][_0x26e1('0x61')],'role':_0x26e1('0x63')},'attributes':['id',_0x26e1('0x38'),_0x26e1('0x71'),'email',_0x26e1('0x72')],'raw':!![]});}return null;})['then'](function(_0x5981db){if(!_0x5981db)return null;_0x4191ed[_0x26e1('0x28')][_0x26e1('0x63')]=_0x5981db;return _0x4191ed;})[_0x26e1('0x21')](function(_0x2e33a6){if(_0x2e33a6){if(_0x2d5377[_0x26e1('0x57')][_0x26e1('0x73')]){_0x4191ed[_0x26e1('0x28')]['interface']=util[_0x26e1('0x5f')](_0x26e1('0x74'),_0x2d5377[_0x26e1('0x62')]['name']);_0x4191ed[_0x26e1('0x28')]['channel']=_0x4191ed[_0x26e1('0x75')];_0x4191ed['message'][_0x26e1('0x76')]=_0x4191ed[_0x26e1('0x75')];_0x4191ed[_0x26e1('0x28')][_0x26e1('0x77')]=_0x26e1('0x5b');return respondWithRpcPromise('EventManager',_0x26e1('0x78'),{'event':_0x26e1('0x79'),'message':_0x4191ed[_0x26e1('0x28')]},client9002)[_0x26e1('0x21')](function(){return _0x4191ed;});}return _0x4191ed;}return null;})[_0x26e1('0x21')](respondWithResult(_0x5410c6,null))['catch'](handleError(_0x5410c6,null));};var interaction_log=require(_0x26e1('0x14'))('whatsapp-interactions');exports['reject']=function(_0x583271,_0x57d39e,_0x540d78){var _0x25b96f={'agent':{},'channel':_0x26e1('0x5c')};if(_0x583271[_0x26e1('0x57')]['id']){delete _0x583271[_0x26e1('0x57')]['id'];}_0x583271[_0x26e1('0x57')][_0x26e1('0x61')]=_0x583271['body'][_0x26e1('0x61')]||_0x583271[_0x26e1('0x62')]['id'];_0x25b96f[_0x26e1('0x63')]['id']=_0x583271[_0x26e1('0x57')][_0x26e1('0x61')];return db[_0x26e1('0x3b')][_0x26e1('0x55')]({'where':{'id':_0x583271['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x57d39e,null))[_0x26e1('0x21')](function(_0x88cd5d){if(_0x88cd5d){_0x25b96f['message']=_0x88cd5d[_0x26e1('0x64')]({'plain':!![]});return db[_0x26e1('0x65')][_0x26e1('0x55')]({'where':{'id':_0x88cd5d['WhatsappInteractionId']}});}return null;})[_0x26e1('0x21')](handleEntityNotFound(_0x57d39e,null))[_0x26e1('0x21')](function(_0x268484){if(_0x268484){_0x25b96f[_0x26e1('0x69')]=_0x268484[_0x26e1('0x64')]({'plain':!![]});interaction_log[_0x26e1('0x22')](_0x26e1('0x7a'),_0x583271[_0x26e1('0x62')]['id'],_0x583271[_0x26e1('0x62')][_0x26e1('0x38')],_0x583271[_0x26e1('0x62')][_0x26e1('0x7b')],_0x25b96f[_0x26e1('0x69')]['id'],_0x583271['body']?JSON[_0x26e1('0x26')](_0x583271[_0x26e1('0x57')]):'null');return respondWithRpcPromise(_0x26e1('0x7c'),_0x26e1('0x7d'),_0x25b96f);}return null;})[_0x26e1('0x21')](function(_0x504730){var _0xfa3800=_0x26e1('0x6c')+_0x504730[_0x26e1('0x28')]['ContactId'];return db['sequelize']['query'](_0xfa3800,{'type':db['Sequelize'][_0x26e1('0x6f')]['SELECT'],'raw':!![]})['then'](function(_0x18f42e){return _0x18f42e;});})[_0x26e1('0x21')](function(_0x167239){if(_0x167239){_0x25b96f[_0x26e1('0x28')][_0x26e1('0x70')]=_0x167239[0x0];if(!_0x583271[_0x26e1('0x57')]['UserId'])return;return db[_0x26e1('0x7e')]['find']({'where':{'id':_0x583271[_0x26e1('0x57')]['UserId'],'role':_0x26e1('0x63')},'attributes':['id',_0x26e1('0x38'),_0x26e1('0x71'),_0x26e1('0x7f'),'internal'],'raw':!![]});}return null;})['then'](function(_0x3a2b2f){if(!_0x3a2b2f)return null;_0x25b96f[_0x26e1('0x28')][_0x26e1('0x63')]=_0x3a2b2f;return _0x25b96f;})[_0x26e1('0x21')](function(_0x4a82e3){if(_0x4a82e3){_0x4a82e3['message'][_0x26e1('0x80')]=util['format']('SIP/%s',_0x583271['user'][_0x26e1('0x38')]);_0x4a82e3[_0x26e1('0x28')]['channel']=_0x25b96f[_0x26e1('0x75')];_0x4a82e3[_0x26e1('0x28')][_0x26e1('0x76')]=_0x25b96f[_0x26e1('0x75')];_0x4a82e3[_0x26e1('0x28')]['event']=_0x26e1('0x33');respondWithRpcPromise(_0x26e1('0x78'),_0x26e1('0x78'),{'event':'rejectmessage','message':_0x4a82e3['message']},client9002);return _0x25b96f;}return null;})[_0x26e1('0x21')](respondWithResult(_0x57d39e,null))[_0x26e1('0x29')](handleError(_0x57d39e,null));};exports[_0x26e1('0x30')]=function(_0x1500e6,_0xcf595b,_0x4096ec){if(_0x1500e6[_0x26e1('0x57')]['id']){delete _0x1500e6[_0x26e1('0x57')]['id'];}var _0x13a2a9;return db[_0x26e1('0x3b')][_0x26e1('0x55')]({'where':{'id':_0x1500e6[_0x26e1('0x58')]['id']}})[_0x26e1('0x21')](handleEntityNotFound(_0xcf595b,null))[_0x26e1('0x21')](function(_0x312599){if(_0x312599){_0x13a2a9=_0x312599;return db[_0x26e1('0x81')][_0x26e1('0x55')]({'where':{'id':_0x312599[_0x26e1('0x82')]}});}})['then'](handleEntityNotFound(_0xcf595b,null))[_0x26e1('0x21')](function(_0x5973ee){if(_0x5973ee){logger[_0x26e1('0x83')](_0x26e1('0x84'),_0x26e1('0x30'),_0x26e1('0x85'),_0x5973ee[_0x26e1('0x3e')],util[_0x26e1('0x86')](_0x1500e6[_0x26e1('0x57')],{'showHidden':![],'depth':null}));switch(_0x5973ee[_0x26e1('0x3e')]){case'twilio':if(_0x1500e6[_0x26e1('0x57')]['MessageSid']&&_0x1500e6[_0x26e1('0x57')][_0x26e1('0x87')]===_0x13a2a9[_0x26e1('0x88')]&&_0x1500e6[_0x26e1('0x57')][_0x26e1('0x89')]&&_0x1500e6[_0x26e1('0x57')][_0x26e1('0x89')]===_0x26e1('0x5d')){return _0x13a2a9[_0x26e1('0x35')]({'read':!![]});}else{logger['error']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x26e1('0x30'),_0x26e1('0x8a'),util[_0x26e1('0x86')](_0x1500e6[_0x26e1('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x13a2a9;}})[_0x26e1('0x21')](respondWithResult(_0xcf595b,null))[_0x26e1('0x29')](handleError(_0xcf595b,null));}; \ No newline at end of file +var _0x8fe9=['destroy','stack','name','send','map','WhatsappMessage','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','create','body','find','describe','whatsapp-interactions','accept','read','readAt','format','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','reject','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','fullname','email','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','twilio','WhatsappAccount,\x20%s,\x20%s,\x20%s','inspect','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./whatsappMessage.socket','register','client','http','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','end','status','offset','undefined','count','limit','json','apply','update'];(function(_0x399873,_0x44bb8b){var _0x1cf2e3=function(_0x261a5b){while(--_0x261a5b){_0x399873['push'](_0x399873['shift']());}};_0x1cf2e3(++_0x44bb8b);}(_0x8fe9,0x15d));var _0x98fe=function(_0x210603,_0x4adbac){_0x210603=_0x210603-0x0;var _0x1bcb7d=_0x8fe9[_0x210603];return _0x1bcb7d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x98fe('0x0'));var jsonpatch=require(_0x98fe('0x1'));var rp=require(_0x98fe('0x2'));var moment=require('moment');var BPromise=require(_0x98fe('0x3'));var Mustache=require(_0x98fe('0x4'));var util=require(_0x98fe('0x5'));var path=require(_0x98fe('0x6'));var sox=require(_0x98fe('0x7'));var csv=require(_0x98fe('0x8'));var ejs=require(_0x98fe('0x9'));var fs=require('fs');var fs_extra=require(_0x98fe('0xa'));var _=require(_0x98fe('0xb'));var squel=require('squel');var crypto=require(_0x98fe('0xc'));var jsforce=require(_0x98fe('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x98fe('0x8'));var querystring=require(_0x98fe('0xe'));var Papa=require(_0x98fe('0xf'));var Redis=require(_0x98fe('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x98fe('0x11'));var as=require(_0x98fe('0x12'));var hardwareService=require(_0x98fe('0x13'));var logger=require(_0x98fe('0x14'))(_0x98fe('0x15'));var utils=require(_0x98fe('0x16'));var config=require(_0x98fe('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x98fe('0x18'))['db'];config[_0x98fe('0x19')]=_[_0x98fe('0x1a')](config[_0x98fe('0x19')],{'host':_0x98fe('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x98fe('0x19')]));require(_0x98fe('0x1c'))[_0x98fe('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x98fe('0x1e')][_0x98fe('0x1f')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x26bfe1,_0x4f4ab7,_0x2b7eba,_0x365c0){return new BPromise(function(_0x3556e2,_0x434678){var _0x5118a3=_0x365c0||client;return _0x5118a3['request'](_0x26bfe1,_0x2b7eba)[_0x98fe('0x20')](function(_0x1a7a25){logger[_0x98fe('0x21')](_0x98fe('0x22'),_0x4f4ab7,_0x98fe('0x23'));logger[_0x98fe('0x24')](_0x98fe('0x25'),_0x4f4ab7,_0x98fe('0x23'),JSON[_0x98fe('0x26')](_0x1a7a25));if(_0x1a7a25['error']){if(_0x1a7a25[_0x98fe('0x27')]['code']===0x1f4){logger[_0x98fe('0x27')]('WhatsappMessage,\x20%s,\x20%s',_0x4f4ab7,_0x1a7a25[_0x98fe('0x27')][_0x98fe('0x28')]);return _0x434678(_0x1a7a25[_0x98fe('0x27')]['message']);}logger[_0x98fe('0x27')]('WhatsappMessage,\x20%s,\x20%s',_0x4f4ab7,_0x1a7a25[_0x98fe('0x27')][_0x98fe('0x28')]);return _0x3556e2(_0x1a7a25['error'][_0x98fe('0x28')]);}else{logger[_0x98fe('0x21')]('WhatsappMessage,\x20%s,\x20%s',_0x4f4ab7,'request\x20sent');_0x3556e2(_0x1a7a25[_0x98fe('0x29')][_0x98fe('0x28')]);}})[_0x98fe('0x2a')](function(_0x3a84d6){logger[_0x98fe('0x27')](_0x98fe('0x22'),_0x4f4ab7,_0x3a84d6);_0x434678(_0x3a84d6);});});}function respondWithStatusCode(_0x43d340,_0x51882a){_0x51882a=_0x51882a||0xcc;return function(_0x1f7f9c){if(_0x1f7f9c){return _0x43d340[_0x98fe('0x2b')](_0x51882a);}return _0x43d340['status'](_0x51882a)[_0x98fe('0x2c')]();};}function respondWithResult(_0x40b687,_0x4f0981){_0x4f0981=_0x4f0981||0xc8;return function(_0x5e07a9){if(_0x5e07a9){return _0x40b687[_0x98fe('0x2d')](_0x4f0981)['json'](_0x5e07a9);}};}function respondWithFilteredResult(_0xb071f9,_0x389b01){return function(_0x2c252d){if(_0x2c252d){var _0x42af7e=typeof _0x389b01[_0x98fe('0x2e')]==='undefined'&&typeof _0x389b01['limit']===_0x98fe('0x2f');var _0xc78130=_0x2c252d['count'];var _0x8ae17b=_0x42af7e?0x0:_0x389b01[_0x98fe('0x2e')];var _0x39bbbf=_0x42af7e?_0x2c252d[_0x98fe('0x30')]:_0x389b01['offset']+_0x389b01[_0x98fe('0x31')];var _0x3ed36a;if(_0x39bbbf>=_0xc78130){_0x39bbbf=_0xc78130;_0x3ed36a=0xc8;}else{_0x3ed36a=0xce;}_0xb071f9[_0x98fe('0x2d')](_0x3ed36a);return _0xb071f9['set']('Content-Range',_0x8ae17b+'-'+_0x39bbbf+'/'+_0xc78130)[_0x98fe('0x32')](_0x2c252d);}return null;};}function patchUpdates(_0x12a435){return function(_0x2ef844){try{jsonpatch[_0x98fe('0x33')](_0x2ef844,_0x12a435,!![]);}catch(_0x369fad){return BPromise['reject'](_0x369fad);}return _0x2ef844['save']();};}function saveUpdates(_0x39216f,_0x1571e3){return function(_0xadf821){if(_0xadf821){return _0xadf821[_0x98fe('0x34')](_0x39216f)[_0x98fe('0x20')](function(_0x19cbab){return _0x19cbab;});}return null;};}function removeEntity(_0x5c9731,_0x1235bc){return function(_0x117933){if(_0x117933){return _0x117933[_0x98fe('0x35')]()[_0x98fe('0x20')](function(){_0x5c9731[_0x98fe('0x2d')](0xcc)[_0x98fe('0x2c')]();});}};}function handleEntityNotFound(_0x126d4e,_0x1ab431){return function(_0x175f09){if(!_0x175f09){_0x126d4e['sendStatus'](0x194);}return _0x175f09;};}function handleError(_0x5e4a5c,_0x2c90b3){_0x2c90b3=_0x2c90b3||0x1f4;return function(_0x4d2005){logger[_0x98fe('0x27')](_0x4d2005[_0x98fe('0x36')]);if(_0x4d2005[_0x98fe('0x37')]){delete _0x4d2005['name'];}_0x5e4a5c[_0x98fe('0x2d')](_0x2c90b3)[_0x98fe('0x38')](_0x4d2005);};}exports['index']=function(_0x1b9bc0,_0x57ecf1){var _0x34c456={},_0x49031a={},_0x588494={'count':0x0,'rows':[]};var _0x1b939d=_[_0x98fe('0x39')](db[_0x98fe('0x3a')]['rawAttributes'],function(_0x178bb8){return{'name':_0x178bb8['fieldName'],'type':_0x178bb8[_0x98fe('0x3b')][_0x98fe('0x3c')]};});_0x49031a[_0x98fe('0x3d')]=_[_0x98fe('0x39')](_0x1b939d,_0x98fe('0x37'));_0x49031a['query']=_['keys'](_0x1b9bc0[_0x98fe('0x3e')]);_0x49031a[_0x98fe('0x3f')]=_[_0x98fe('0x40')](_0x49031a[_0x98fe('0x3d')],_0x49031a['query']);_0x34c456[_0x98fe('0x41')]=_[_0x98fe('0x40')](_0x49031a['model'],qs[_0x98fe('0x42')](_0x1b9bc0[_0x98fe('0x3e')][_0x98fe('0x42')]));_0x34c456[_0x98fe('0x41')]=_0x34c456[_0x98fe('0x41')][_0x98fe('0x43')]?_0x34c456[_0x98fe('0x41')]:_0x49031a[_0x98fe('0x3d')];if(!_0x1b9bc0['query'][_0x98fe('0x44')]('nolimit')){_0x34c456[_0x98fe('0x31')]=qs[_0x98fe('0x31')](_0x1b9bc0[_0x98fe('0x3e')][_0x98fe('0x31')]);_0x34c456[_0x98fe('0x2e')]=qs[_0x98fe('0x2e')](_0x1b9bc0[_0x98fe('0x3e')][_0x98fe('0x2e')]);}_0x34c456[_0x98fe('0x45')]=qs[_0x98fe('0x46')](_0x1b9bc0['query'][_0x98fe('0x46')]);_0x34c456[_0x98fe('0x47')]=qs[_0x98fe('0x3f')](_['pick'](_0x1b9bc0['query'],_0x49031a['filters']),_0x1b939d);if(_0x1b9bc0[_0x98fe('0x3e')][_0x98fe('0x48')]){_0x34c456['where']=_[_0x98fe('0x49')](_0x34c456[_0x98fe('0x47')],{'$or':_[_0x98fe('0x39')](_0x1b939d,function(_0x4a02c3){if(_0x4a02c3[_0x98fe('0x3b')]!==_0x98fe('0x4a')){var _0x458a26={};_0x458a26[_0x4a02c3[_0x98fe('0x37')]]={'$like':'%'+_0x1b9bc0[_0x98fe('0x3e')][_0x98fe('0x48')]+'%'};return _0x458a26;}})});}_0x34c456=_[_0x98fe('0x49')]({},_0x34c456,_0x1b9bc0[_0x98fe('0x4b')]);var _0x2bc845={'where':_0x34c456[_0x98fe('0x47')]};return db[_0x98fe('0x3a')]['count'](_0x2bc845)['then'](function(_0x1af13c){_0x588494[_0x98fe('0x30')]=_0x1af13c;if(_0x1b9bc0[_0x98fe('0x3e')][_0x98fe('0x4c')]){_0x34c456[_0x98fe('0x4d')]=[{'all':!![]}];}return db[_0x98fe('0x3a')][_0x98fe('0x4e')](_0x34c456);})[_0x98fe('0x20')](function(_0x45c598){_0x588494[_0x98fe('0x4f')]=_0x45c598;return _0x588494;})[_0x98fe('0x20')](respondWithFilteredResult(_0x57ecf1,_0x34c456))[_0x98fe('0x2a')](handleError(_0x57ecf1,null));};exports[_0x98fe('0x50')]=function(_0x37fe53,_0x696d60){var _0x18e4f3={'raw':!![],'where':{'id':_0x37fe53[_0x98fe('0x51')]['id']}},_0x5a26a9={};_0x5a26a9[_0x98fe('0x3d')]=_[_0x98fe('0x52')](db[_0x98fe('0x3a')][_0x98fe('0x53')]);_0x5a26a9['query']=_[_0x98fe('0x52')](_0x37fe53[_0x98fe('0x3e')]);_0x5a26a9['filters']=_[_0x98fe('0x40')](_0x5a26a9['model'],_0x5a26a9[_0x98fe('0x3e')]);_0x18e4f3[_0x98fe('0x41')]=_[_0x98fe('0x40')](_0x5a26a9[_0x98fe('0x3d')],qs[_0x98fe('0x42')](_0x37fe53[_0x98fe('0x3e')][_0x98fe('0x42')]));_0x18e4f3['attributes']=_0x18e4f3[_0x98fe('0x41')]['length']?_0x18e4f3[_0x98fe('0x41')]:_0x5a26a9[_0x98fe('0x3d')];if(_0x37fe53['query'][_0x98fe('0x4c')]){_0x18e4f3[_0x98fe('0x4d')]=[{'all':!![]}];}_0x18e4f3=_[_0x98fe('0x49')]({},_0x18e4f3,_0x37fe53['options']);return db[_0x98fe('0x3a')]['find'](_0x18e4f3)[_0x98fe('0x20')](handleEntityNotFound(_0x696d60,null))['then'](respondWithResult(_0x696d60,null))['catch'](handleError(_0x696d60,null));};exports[_0x98fe('0x54')]=function(_0x4e73ca,_0x26277b){return db[_0x98fe('0x3a')][_0x98fe('0x54')](_0x4e73ca[_0x98fe('0x55')],{})[_0x98fe('0x20')](respondWithResult(_0x26277b,0xc9))['catch'](handleError(_0x26277b,null));};exports[_0x98fe('0x34')]=function(_0x54c3c6,_0x3a9223){if(_0x54c3c6[_0x98fe('0x55')]['id']){delete _0x54c3c6[_0x98fe('0x55')]['id'];}return db[_0x98fe('0x3a')][_0x98fe('0x56')]({'where':{'id':_0x54c3c6['params']['id']}})['then'](handleEntityNotFound(_0x3a9223,null))[_0x98fe('0x20')](saveUpdates(_0x54c3c6['body'],null))[_0x98fe('0x20')](respondWithResult(_0x3a9223,null))['catch'](handleError(_0x3a9223,null));};exports[_0x98fe('0x35')]=function(_0xfaaaf1,_0x46ad01){return db['WhatsappMessage'][_0x98fe('0x56')]({'where':{'id':_0xfaaaf1[_0x98fe('0x51')]['id']}})['then'](handleEntityNotFound(_0x46ad01,null))['then'](removeEntity(_0x46ad01,null))[_0x98fe('0x2a')](handleError(_0x46ad01,null));};exports[_0x98fe('0x57')]=function(_0x367ba4,_0x25cfc6){return db['WhatsappMessage']['describe']()[_0x98fe('0x20')](respondWithResult(_0x25cfc6,null))[_0x98fe('0x2a')](handleError(_0x25cfc6,null));};var interaction_log=require(_0x98fe('0x14'))(_0x98fe('0x58'));exports[_0x98fe('0x59')]=function(_0x2484b3,_0x2edccd,_0x45121b){var _0x2eebb9={'agent':{},'channel':'whatsapp'};if(_0x2484b3[_0x98fe('0x55')]['id']){delete _0x2484b3[_0x98fe('0x55')]['id'];}_0x2484b3[_0x98fe('0x55')][_0x98fe('0x5a')]=!![];_0x2484b3[_0x98fe('0x55')][_0x98fe('0x5b')]=moment()[_0x98fe('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x2484b3[_0x98fe('0x55')][_0x98fe('0x5d')]=_0x2484b3[_0x98fe('0x55')][_0x98fe('0x5d')]||_0x2484b3[_0x98fe('0x5e')]['id'];_0x2eebb9[_0x98fe('0x5f')]['id']=_0x2484b3[_0x98fe('0x55')][_0x98fe('0x5d')];return db['WhatsappMessage']['find']({'where':{'id':_0x2484b3['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2edccd,null))[_0x98fe('0x20')](saveUpdates(_0x2484b3[_0x98fe('0x55')],null))[_0x98fe('0x20')](function(_0x5e7d0e){if(_0x5e7d0e){_0x2eebb9[_0x98fe('0x28')]=_0x5e7d0e[_0x98fe('0x60')]({'plain':!![]});return db[_0x98fe('0x61')]['find']({'where':{'id':_0x5e7d0e[_0x98fe('0x62')]}});}return null;})[_0x98fe('0x20')](handleEntityNotFound(_0x2edccd,null))[_0x98fe('0x20')](function(_0x29099d){if(_0x29099d){return _0x29099d[_0x98fe('0x34')]({'UserId':_0x2484b3[_0x98fe('0x55')][_0x98fe('0x5d')],'read1stAt':_[_0x98fe('0x63')](_0x29099d[_0x98fe('0x64')])?moment()[_0x98fe('0x5c')](_0x98fe('0x65')):undefined});}return null;})[_0x98fe('0x20')](function(_0x2f506c){if(_0x2f506c){_0x2eebb9[_0x98fe('0x66')]=_0x2f506c[_0x98fe('0x60')]({'plain':!![]});interaction_log[_0x98fe('0x21')](_0x98fe('0x67'),_0x2484b3[_0x98fe('0x5e')]['id'],_0x2484b3[_0x98fe('0x5e')]['name'],_0x2484b3[_0x98fe('0x5e')][_0x98fe('0x68')],_0x2eebb9[_0x98fe('0x66')]['id'],_0x2484b3[_0x98fe('0x55')]?JSON[_0x98fe('0x26')](_0x2484b3[_0x98fe('0x55')]):'null');return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x2eebb9);}return null;})[_0x98fe('0x20')](function(_0xe70a30){var _0x1adf23=_0x98fe('0x69')+_0xe70a30['message'][_0x98fe('0x6a')];return db[_0x98fe('0x6b')][_0x98fe('0x3e')](_0x1adf23,{'type':db[_0x98fe('0x6c')][_0x98fe('0x6d')][_0x98fe('0x6e')],'raw':!![]})[_0x98fe('0x20')](function(_0x3e4155){return _0x3e4155;});})[_0x98fe('0x20')](function(_0x258e5d){if(_0x258e5d){_0x2eebb9[_0x98fe('0x28')][_0x98fe('0x6f')]=_0x258e5d[0x0];if(!_0x2484b3[_0x98fe('0x55')]['UserId'])return;return db[_0x98fe('0x70')]['find']({'where':{'id':_0x2484b3[_0x98fe('0x55')][_0x98fe('0x5d')],'role':_0x98fe('0x5f')},'attributes':['id',_0x98fe('0x37'),'fullname','email',_0x98fe('0x71')],'raw':!![]});}return null;})[_0x98fe('0x20')](function(_0x473224){if(!_0x473224)return null;_0x2eebb9[_0x98fe('0x28')]['agent']=_0x473224;return _0x2eebb9;})[_0x98fe('0x20')](function(_0x586cff){if(_0x586cff){if(_0x2484b3[_0x98fe('0x55')][_0x98fe('0x72')]){_0x2eebb9[_0x98fe('0x28')][_0x98fe('0x73')]=util[_0x98fe('0x5c')](_0x98fe('0x74'),_0x2484b3['user'][_0x98fe('0x37')]);_0x2eebb9['message'][_0x98fe('0x75')]=_0x2eebb9['channel'];_0x2eebb9['message'][_0x98fe('0x76')]=_0x2eebb9[_0x98fe('0x75')];_0x2eebb9[_0x98fe('0x28')][_0x98fe('0x77')]=_0x98fe('0x59');return respondWithRpcPromise(_0x98fe('0x78'),_0x98fe('0x78'),{'event':_0x98fe('0x79'),'message':_0x2eebb9['message']},client9002)[_0x98fe('0x20')](function(){return _0x2eebb9;});}return _0x2eebb9;}return null;})[_0x98fe('0x20')](respondWithResult(_0x2edccd,null))[_0x98fe('0x2a')](handleError(_0x2edccd,null));};var interaction_log=require(_0x98fe('0x14'))(_0x98fe('0x58'));exports[_0x98fe('0x7a')]=function(_0x3b4c91,_0x3ff2ca,_0xd9382b){var _0xcd99e5={'agent':{},'channel':'whatsapp'};if(_0x3b4c91['body']['id']){delete _0x3b4c91[_0x98fe('0x55')]['id'];}_0x3b4c91[_0x98fe('0x55')][_0x98fe('0x5d')]=_0x3b4c91[_0x98fe('0x55')][_0x98fe('0x5d')]||_0x3b4c91[_0x98fe('0x5e')]['id'];_0xcd99e5['agent']['id']=_0x3b4c91[_0x98fe('0x55')]['UserId'];return db['WhatsappMessage'][_0x98fe('0x56')]({'where':{'id':_0x3b4c91[_0x98fe('0x51')]['id'],'UserId':null}})[_0x98fe('0x20')](handleEntityNotFound(_0x3ff2ca,null))['then'](function(_0x3b6dd4){if(_0x3b6dd4){_0xcd99e5[_0x98fe('0x28')]=_0x3b6dd4[_0x98fe('0x60')]({'plain':!![]});return db[_0x98fe('0x61')][_0x98fe('0x56')]({'where':{'id':_0x3b6dd4[_0x98fe('0x62')]}});}return null;})[_0x98fe('0x20')](handleEntityNotFound(_0x3ff2ca,null))[_0x98fe('0x20')](function(_0x330511){if(_0x330511){_0xcd99e5[_0x98fe('0x66')]=_0x330511['get']({'plain':!![]});interaction_log[_0x98fe('0x21')](_0x98fe('0x7b'),_0x3b4c91['user']['id'],_0x3b4c91[_0x98fe('0x5e')]['name'],_0x3b4c91[_0x98fe('0x5e')][_0x98fe('0x68')],_0xcd99e5['interaction']['id'],_0x3b4c91[_0x98fe('0x55')]?JSON[_0x98fe('0x26')](_0x3b4c91[_0x98fe('0x55')]):_0x98fe('0x7c'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0xcd99e5);}return null;})[_0x98fe('0x20')](function(_0x4e2160){var _0x210fd0=_0x98fe('0x69')+_0x4e2160[_0x98fe('0x28')]['ContactId'];return db[_0x98fe('0x6b')][_0x98fe('0x3e')](_0x210fd0,{'type':db[_0x98fe('0x6c')][_0x98fe('0x6d')][_0x98fe('0x6e')],'raw':!![]})[_0x98fe('0x20')](function(_0x3f89e4){return _0x3f89e4;});})[_0x98fe('0x20')](function(_0x16d1bc){if(_0x16d1bc){_0xcd99e5[_0x98fe('0x28')][_0x98fe('0x6f')]=_0x16d1bc[0x0];if(!_0x3b4c91['body'][_0x98fe('0x5d')])return;return db[_0x98fe('0x70')][_0x98fe('0x56')]({'where':{'id':_0x3b4c91[_0x98fe('0x55')][_0x98fe('0x5d')],'role':_0x98fe('0x5f')},'attributes':['id',_0x98fe('0x37'),_0x98fe('0x7d'),_0x98fe('0x7e'),_0x98fe('0x71')],'raw':!![]});}return null;})[_0x98fe('0x20')](function(_0xa2fc31){if(!_0xa2fc31)return null;_0xcd99e5[_0x98fe('0x28')][_0x98fe('0x5f')]=_0xa2fc31;return _0xcd99e5;})[_0x98fe('0x20')](function(_0x17d1b2){if(_0x17d1b2){_0x17d1b2[_0x98fe('0x28')][_0x98fe('0x73')]=util[_0x98fe('0x5c')](_0x98fe('0x74'),_0x3b4c91['user']['name']);_0x17d1b2[_0x98fe('0x28')][_0x98fe('0x75')]=_0xcd99e5[_0x98fe('0x75')];_0x17d1b2[_0x98fe('0x28')][_0x98fe('0x76')]=_0xcd99e5[_0x98fe('0x75')];_0x17d1b2[_0x98fe('0x28')][_0x98fe('0x77')]=_0x98fe('0x7a');respondWithRpcPromise(_0x98fe('0x78'),_0x98fe('0x78'),{'event':_0x98fe('0x7f'),'message':_0x17d1b2['message']},client9002);return _0xcd99e5;}return null;})['then'](respondWithResult(_0x3ff2ca,null))[_0x98fe('0x2a')](handleError(_0x3ff2ca,null));};exports[_0x98fe('0x2d')]=function(_0x3e6782,_0x1e08f9,_0x5727c5){if(_0x3e6782[_0x98fe('0x55')]['id']){delete _0x3e6782[_0x98fe('0x55')]['id'];}var _0x14352f;return db['WhatsappMessage'][_0x98fe('0x56')]({'where':{'id':_0x3e6782[_0x98fe('0x51')]['id']}})[_0x98fe('0x20')](handleEntityNotFound(_0x1e08f9,null))[_0x98fe('0x20')](function(_0x182f6b){if(_0x182f6b){_0x14352f=_0x182f6b;return db[_0x98fe('0x80')][_0x98fe('0x56')]({'where':{'id':_0x182f6b[_0x98fe('0x81')]}});}})['then'](handleEntityNotFound(_0x1e08f9,null))['then'](function(_0xac7dd5){if(_0xac7dd5){logger['debug'](_0x98fe('0x82'),_0x98fe('0x2d'),'received\x20delivery\x20report\x20from',_0xac7dd5[_0x98fe('0x3b')],util['inspect'](_0x3e6782['body'],{'showHidden':![],'depth':null}));switch(_0xac7dd5['type']){case _0x98fe('0x83'):if(_0x3e6782[_0x98fe('0x55')]['MessageSid']&&_0x3e6782['body']['MessageSid']===_0x14352f['messageId']&&_0x3e6782[_0x98fe('0x55')]['MessageStatus']&&_0x3e6782[_0x98fe('0x55')]['MessageStatus']===_0x98fe('0x5a')){return _0x14352f[_0x98fe('0x34')]({'read':!![]});}else{logger[_0x98fe('0x27')](_0x98fe('0x84'),_0x98fe('0x2d'),_0x98fe('0x83'),util[_0x98fe('0x85')](_0x3e6782['body'],{'showHidden':![],'depth':null}));}break;}return _0x14352f;}})['then'](respondWithResult(_0x1e08f9,null))[_0x98fe('0x2a')](handleError(_0x1e08f9,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 567ca3d..d69b20d 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 _0xcb91=['save','update','emit','hasOwnProperty','hook','WhatsappMessage','setMaxListeners'];(function(_0x42706a,_0x56a438){var _0x467178=function(_0xce87){while(--_0xce87){_0x42706a['push'](_0x42706a['shift']());}};_0x467178(++_0x56a438);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4b12ae,_0xf2b3b){_0x4b12ae=_0x4b12ae-0x0;var _0x16957b=_0xcb91[_0x4b12ae];return _0x16957b;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require('../../mysqldb')['db'][_0x1cb9('0x0')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x1cb9('0x1')](0x0);var events={'afterCreate':_0x1cb9('0x2'),'afterUpdate':_0x1cb9('0x3'),'afterDestroy':'remove'};function emitEvent(_0x8c392f){return function(_0x2c17b8,_0x545a34,_0x13d5fd){WhatsappMessageEvents[_0x1cb9('0x4')](_0x8c392f+':'+_0x2c17b8['id'],_0x2c17b8);WhatsappMessageEvents['emit'](_0x8c392f,_0x2c17b8);_0x13d5fd(null);};}for(var e in events){if(events[_0x1cb9('0x5')](e)){var event=events[e];WhatsappMessage[_0x1cb9('0x6')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0xcecc=['update','remove','emit','hasOwnProperty','hook','exports','events','WhatsappMessage'];(function(_0x244797,_0x6a7e67){var _0x4a6258=function(_0x345a0b){while(--_0x345a0b){_0x244797['push'](_0x244797['shift']());}};_0x4a6258(++_0x6a7e67);}(_0xcecc,0x186));var _0xccec=function(_0x125704,_0x389e3d){_0x125704=_0x125704-0x0;var _0x49caa7=_0xcecc[_0x125704];return _0x49caa7;};'use strict';var EventEmitter=require(_0xccec('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0xccec('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xccec('0x2'),'afterDestroy':_0xccec('0x3')};function emitEvent(_0x338b16){return function(_0xa10c6f,_0x4b1996,_0x4b0fb9){WhatsappMessageEvents[_0xccec('0x4')](_0x338b16+':'+_0xa10c6f['id'],_0xa10c6f);WhatsappMessageEvents['emit'](_0x338b16,_0xa10c6f);_0x4b0fb9(null);};}for(var e in events){if(events[_0xccec('0x5')](e)){var event=events[e];WhatsappMessage[_0xccec('0x6')](e,emitEvent(event));}}module[_0xccec('0x7')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index ef38bab..569e17b 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 _0x8305=['twilio','accountSid','authToken','phone','messages','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4_unicode_ci','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','catch','error','find','type'];(function(_0x4ba9ab,_0x26fe50){var _0x5a5802=function(_0xc78947){while(--_0xc78947){_0x4ba9ab['push'](_0x4ba9ab['shift']());}};_0x5a5802(++_0x26fe50);}(_0x8305,0x1d3));var _0x5830=function(_0x1a52c9,_0x2eebc9){_0x1a52c9=_0x1a52c9-0x0;var _0x583a25=_0x8305[_0x1a52c9];return _0x583a25;};'use strict';var _=require(_0x5830('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5830('0x1'));var moment=require('moment');var BPromise=require(_0x5830('0x2'));var rp=require(_0x5830('0x3'));var fs=require('fs');var path=require(_0x5830('0x4'));var rimraf=require(_0x5830('0x5'));var config=require(_0x5830('0x6'));var attributes=require(_0x5830('0x7'));module['exports']=function(_0x5cc336,_0x462c23){return _0x5cc336['define']('WhatsappMessage',attributes,{'tableName':_0x5830('0x8'),'paranoid':![],'indexes':[{'name':_0x5830('0x9'),'fields':['messageId']},{'name':_0x5830('0xa'),'fields':[_0x5830('0xb')],'type':_0x5830('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x55658a,_0x24f6e0,_0x589979){var _0x2ac30f=_0x5cc336['models'];var _0x4baea5=_0x55658a['get']({'plain':!![]});if(_0x4baea5[_0x5830('0xd')][_0x5830('0xe')]()==='in'||_0x4baea5[_0x5830('0xd')][_0x5830('0xe')]()===_0x5830('0xf')&&!_0x4baea5[_0x5830('0x10')]&&!_[_0x5830('0x11')](_0x4baea5[_0x5830('0x12')])){_0x2ac30f[_0x5830('0x13')][_0x5830('0x14')]({'where':{'id':_0x4baea5[_0x5830('0x15')]}})[_0x5830('0x16')](function(_0x30cd08){if(_0x30cd08){_0x30cd08[_0x5830('0x17')]({'lastMsgAt':_0x4baea5['createdAt'],'lastMsgDirection':_0x4baea5[_0x5830('0xd')]['toLowerCase']()});}})[_0x5830('0x18')](function(_0x5a0852){console[_0x5830('0x19')](_0x5a0852);});}if(_0x4baea5[_0x5830('0xd')]===_0x5830('0xf')&&!_0x4baea5['secret']){var _0x2d615d;_0x2ac30f['WhatsappAccount'][_0x5830('0x1a')]({'where':{'id':_0x4baea5['WhatsappAccountId']},'raw':!![]})[_0x5830('0x16')](function(_0x28b58f){_0x2d615d=_0x28b58f;if(_0x2d615d&&_0x2d615d[_0x5830('0x1b')]){switch(_0x2d615d['type']){case _0x5830('0x1c'):var _0x1ccdf6=require(_0x5830('0x1c'));if(_0x2d615d[_0x5830('0x1d')]&&_0x2d615d[_0x5830('0x1e')]&&_0x2d615d[_0x5830('0x1f')]){var _0xc3813e=new _0x1ccdf6(_0x2d615d[_0x5830('0x1d')],_0x2d615d[_0x5830('0x1e')]);_0xc3813e[_0x5830('0x20')]['create']({'body':_0x4baea5['body'],'to':_0x5830('0x21')+_0x4baea5[_0x5830('0x1f')],'from':_0x5830('0x21')+_0x2d615d[_0x5830('0x1f')],'statusCallback':_0x2d615d[_0x5830('0x22')]+_0x5830('0x23')+_0x4baea5['id']+_0x5830('0x24')+_0x2d615d[_0x5830('0x25')]})[_0x5830('0x16')](function(_0x3e3499){if(_0x3e3499[_0x5830('0x26')]){return _0x55658a[_0x5830('0x17')]({'messageId':_0x3e3499[_0x5830('0x26')]});}})[_0x5830('0x18')](function(_0x247922){logger[_0x5830('0x19')](_0x5830('0x27'),'afterCreate',_0x5830('0x1c'),util[_0x5830('0x28')](_0x247922,{'showHidden':![],'depth':null}));});}else{logger[_0x5830('0x19')](_0x5830('0x27'),_0x5830('0x29'),_0x5830('0x1c'),_0x5830('0x2a'));}break;}}})[_0x5830('0x2b')](function(){_0x589979();});}else{_0x589979();}}},'charset':'utf8mb4','collate':_0x5830('0x2c')});}; \ No newline at end of file +var _0xc7a7=['models','direction','toLowerCase','out','secret','isNil','WhatsappInteraction','findOne','WhatsappInteractionId','then','createdAt','catch','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','authToken','create','whatsapp:','phone','remote','/api/whatsapp/messages/','token','update','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','whatsapp_messages','messageId','body','FULLTEXT'];(function(_0x1b3581,_0x93be01){var _0x40dac5=function(_0x47cc9b){while(--_0x47cc9b){_0x1b3581['push'](_0x1b3581['shift']());}};_0x40dac5(++_0x93be01);}(_0xc7a7,0x171));var _0x7c7a=function(_0x2acef0,_0x341553){_0x2acef0=_0x2acef0-0x0;var _0x2e7a8e=_0xc7a7[_0x2acef0];return _0x2e7a8e;};'use strict';var _=require(_0x7c7a('0x0'));var util=require(_0x7c7a('0x1'));var logger=require(_0x7c7a('0x2'))('api');var moment=require(_0x7c7a('0x3'));var BPromise=require(_0x7c7a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7c7a('0x5'));var rimraf=require(_0x7c7a('0x6'));var config=require(_0x7c7a('0x7'));var attributes=require(_0x7c7a('0x8'));module[_0x7c7a('0x9')]=function(_0xc84abf,_0x346f96){return _0xc84abf[_0x7c7a('0xa')]('WhatsappMessage',attributes,{'tableName':_0x7c7a('0xb'),'paranoid':![],'indexes':[{'name':_0x7c7a('0xc'),'fields':[_0x7c7a('0xc')]},{'name':'fti_whatsapp_messages','fields':[_0x7c7a('0xd')],'type':_0x7c7a('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x112bf9,_0x1c93b6,_0x21a16b){var _0x402e94=_0xc84abf[_0x7c7a('0xf')];var _0x375ec0=_0x112bf9['get']({'plain':!![]});if(_0x375ec0[_0x7c7a('0x10')][_0x7c7a('0x11')]()==='in'||_0x375ec0[_0x7c7a('0x10')][_0x7c7a('0x11')]()===_0x7c7a('0x12')&&!_0x375ec0[_0x7c7a('0x13')]&&!_[_0x7c7a('0x14')](_0x375ec0['UserId'])){_0x402e94[_0x7c7a('0x15')][_0x7c7a('0x16')]({'where':{'id':_0x375ec0[_0x7c7a('0x17')]}})[_0x7c7a('0x18')](function(_0xd97646){if(_0xd97646){_0xd97646['update']({'lastMsgAt':_0x375ec0[_0x7c7a('0x19')],'lastMsgDirection':_0x375ec0['direction'][_0x7c7a('0x11')]()});}})[_0x7c7a('0x1a')](function(_0x7da88b){console[_0x7c7a('0x1b')](_0x7da88b);});}if(_0x375ec0[_0x7c7a('0x10')]===_0x7c7a('0x12')&&!_0x375ec0[_0x7c7a('0x13')]){var _0x20e32d;_0x402e94[_0x7c7a('0x1c')][_0x7c7a('0x1d')]({'where':{'id':_0x375ec0[_0x7c7a('0x1e')]},'raw':!![]})[_0x7c7a('0x18')](function(_0x482fb1){_0x20e32d=_0x482fb1;if(_0x20e32d&&_0x20e32d[_0x7c7a('0x1f')]){switch(_0x20e32d[_0x7c7a('0x1f')]){case _0x7c7a('0x20'):var _0x1c60ef=require('twilio');if(_0x20e32d['accountSid']&&_0x20e32d[_0x7c7a('0x21')]&&_0x20e32d['phone']){var _0x3a267a=new _0x1c60ef(_0x20e32d['accountSid'],_0x20e32d[_0x7c7a('0x21')]);_0x3a267a['messages'][_0x7c7a('0x22')]({'body':_0x375ec0[_0x7c7a('0xd')],'to':'whatsapp:'+_0x375ec0['phone'],'from':_0x7c7a('0x23')+_0x20e32d[_0x7c7a('0x24')],'statusCallback':_0x20e32d[_0x7c7a('0x25')]+_0x7c7a('0x26')+_0x375ec0['id']+'/status?token='+_0x20e32d[_0x7c7a('0x27')]})[_0x7c7a('0x18')](function(_0x568aec){if(_0x568aec['sid']){return _0x112bf9[_0x7c7a('0x28')]({'messageId':_0x568aec[_0x7c7a('0x29')]});}})[_0x7c7a('0x1a')](function(_0x43a847){logger[_0x7c7a('0x1b')](_0x7c7a('0x2a'),_0x7c7a('0x2b'),_0x7c7a('0x20'),util[_0x7c7a('0x2c')](_0x43a847,{'showHidden':![],'depth':null}));});}else{logger[_0x7c7a('0x1b')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x7c7a('0x2b'),'twilio',_0x7c7a('0x2d'));}break;}}})[_0x7c7a('0x2e')](function(){_0x21a16b();});}else{_0x21a16b();}}},'charset':'utf8mb4','collate':_0x7c7a('0x2f')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 2f4edd1..5d8b341 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 _0x3d6d=['WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','./whatsappMessage.socket','register','request','then','info'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x3d6d,0x10c));var _0xd3d6=function(_0x193a6e,_0x45dd00){_0x193a6e=_0x193a6e-0x0;var _0x599a9b=_0x3d6d[_0x193a6e];return _0x599a9b;};'use strict';var _=require(_0xd3d6('0x0'));var util=require(_0xd3d6('0x1'));var moment=require(_0xd3d6('0x2'));var BPromise=require(_0xd3d6('0x3'));var rs=require(_0xd3d6('0x4'));var fs=require('fs');var Redis=require(_0xd3d6('0x5'));var db=require(_0xd3d6('0x6'))['db'];var utils=require(_0xd3d6('0x7'));var logger=require(_0xd3d6('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd3d6('0x9'));var client=jayson[_0xd3d6('0xa')][_0xd3d6('0xb')]({'port':0x232a});config[_0xd3d6('0xc')]=_[_0xd3d6('0xd')](config['redis'],{'host':_0xd3d6('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd3d6('0xc')]));require(_0xd3d6('0xf'))[_0xd3d6('0x10')](socket);function respondWithRpcPromise(_0x56f5d0,_0x1956c5,_0x2d0f54){return new BPromise(function(_0x3e41a5,_0x187558){return client[_0xd3d6('0x11')](_0x56f5d0,_0x2d0f54)[_0xd3d6('0x12')](function(_0x56ac0e){logger[_0xd3d6('0x13')](_0xd3d6('0x14'),_0x1956c5,'request\x20sent');logger[_0xd3d6('0x15')](_0xd3d6('0x16'),_0x1956c5,_0xd3d6('0x17'),JSON[_0xd3d6('0x18')](_0x56ac0e));if(_0x56ac0e['error']){if(_0x56ac0e[_0xd3d6('0x19')][_0xd3d6('0x1a')]===0x1f4){logger['error'](_0xd3d6('0x14'),_0x1956c5,_0x56ac0e[_0xd3d6('0x19')][_0xd3d6('0x1b')]);return _0x187558(_0x56ac0e['error'][_0xd3d6('0x1b')]);}logger[_0xd3d6('0x19')](_0xd3d6('0x14'),_0x1956c5,_0x56ac0e[_0xd3d6('0x19')]['message']);return _0x3e41a5(_0x56ac0e[_0xd3d6('0x19')][_0xd3d6('0x1b')]);}else{logger[_0xd3d6('0x13')](_0xd3d6('0x14'),_0x1956c5,_0xd3d6('0x17'));_0x3e41a5(_0x56ac0e[_0xd3d6('0x1c')][_0xd3d6('0x1b')]);}})[_0xd3d6('0x1d')](function(_0xebbdc9){logger[_0xd3d6('0x19')](_0xd3d6('0x14'),_0x1956c5,_0xebbdc9);_0x187558(_0xebbdc9);});});}exports[_0xd3d6('0x1e')]=function(_0xbc69d){var _0x230a25=this;return new Promise(function(_0xd447a2,_0x2f5109){return db[_0xd3d6('0x1f')][_0xd3d6('0x20')](_0xbc69d[_0xd3d6('0x21')],{'raw':_0xbc69d[_0xd3d6('0x22')]?_0xbc69d[_0xd3d6('0x22')][_0xd3d6('0x23')]===undefined?!![]:![]:!![]})[_0xd3d6('0x12')](function(_0x1103b5){logger[_0xd3d6('0x13')](_0xd3d6('0x1e'),_0xbc69d);logger[_0xd3d6('0x15')](_0xd3d6('0x1e'),_0xbc69d,JSON[_0xd3d6('0x18')](_0x1103b5));_0xd447a2(_0x1103b5);})[_0xd3d6('0x1d')](function(_0x1198ea){logger[_0xd3d6('0x19')](_0xd3d6('0x1e'),_0x1198ea[_0xd3d6('0x1b')],_0xbc69d);_0x2f5109(_0x230a25[_0xd3d6('0x19')](0x1f4,_0x1198ea[_0xd3d6('0x1b')]));});});}; \ No newline at end of file +var _0xe1a8=['localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CreateWhatsappMessage','WhatsappMessage','options','raw','debug','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults'];(function(_0x3a0cb2,_0x17bf0f){var _0x5ef05b=function(_0x35ee33){while(--_0x35ee33){_0x3a0cb2['push'](_0x3a0cb2['shift']());}};_0x5ef05b(++_0x17bf0f);}(_0xe1a8,0xe5));var _0x8e1a=function(_0x2e7b1b,_0x4b375e){_0x2e7b1b=_0x2e7b1b-0x0;var _0x167cf5=_0xe1a8[_0x2e7b1b];return _0x167cf5;};'use strict';var _=require('lodash');var util=require(_0x8e1a('0x0'));var moment=require(_0x8e1a('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8e1a('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x8e1a('0x3'));var logger=require(_0x8e1a('0x4'))(_0x8e1a('0x5'));var config=require(_0x8e1a('0x6'));var jayson=require(_0x8e1a('0x7'));var client=jayson['client'][_0x8e1a('0x8')]({'port':0x232a});config[_0x8e1a('0x9')]=_[_0x8e1a('0xa')](config[_0x8e1a('0x9')],{'host':_0x8e1a('0xb'),'port':0x18eb});var socket=require(_0x8e1a('0xc'))(new Redis(config[_0x8e1a('0x9')]));require(_0x8e1a('0xd'))[_0x8e1a('0xe')](socket);function respondWithRpcPromise(_0xff05dd,_0x10f4f0,_0x338e43){return new BPromise(function(_0x4bb02d,_0x314bfe){return client[_0x8e1a('0xf')](_0xff05dd,_0x338e43)[_0x8e1a('0x10')](function(_0x46641b){logger[_0x8e1a('0x11')](_0x8e1a('0x12'),_0x10f4f0,_0x8e1a('0x13'));logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x10f4f0,_0x8e1a('0x13'),JSON[_0x8e1a('0x14')](_0x46641b));if(_0x46641b['error']){if(_0x46641b[_0x8e1a('0x15')][_0x8e1a('0x16')]===0x1f4){logger[_0x8e1a('0x15')](_0x8e1a('0x12'),_0x10f4f0,_0x46641b[_0x8e1a('0x15')][_0x8e1a('0x17')]);return _0x314bfe(_0x46641b[_0x8e1a('0x15')][_0x8e1a('0x17')]);}logger['error'](_0x8e1a('0x12'),_0x10f4f0,_0x46641b['error'][_0x8e1a('0x17')]);return _0x4bb02d(_0x46641b['error']['message']);}else{logger[_0x8e1a('0x11')](_0x8e1a('0x12'),_0x10f4f0,_0x8e1a('0x13'));_0x4bb02d(_0x46641b[_0x8e1a('0x18')]['message']);}})['catch'](function(_0x9b58c5){logger[_0x8e1a('0x15')](_0x8e1a('0x12'),_0x10f4f0,_0x9b58c5);_0x314bfe(_0x9b58c5);});});}exports[_0x8e1a('0x19')]=function(_0xd414d7){var _0x3ade5b=this;return new Promise(function(_0x1b9d7a,_0x45faad){return db[_0x8e1a('0x1a')]['create'](_0xd414d7['body'],{'raw':_0xd414d7[_0x8e1a('0x1b')]?_0xd414d7[_0x8e1a('0x1b')][_0x8e1a('0x1c')]===undefined?!![]:![]:!![]})[_0x8e1a('0x10')](function(_0xe17a92){logger[_0x8e1a('0x11')](_0x8e1a('0x19'),_0xd414d7);logger[_0x8e1a('0x1d')](_0x8e1a('0x19'),_0xd414d7,JSON[_0x8e1a('0x14')](_0xe17a92));_0x1b9d7a(_0xe17a92);})['catch'](function(_0x268755){logger['error'](_0x8e1a('0x19'),_0x268755[_0x8e1a('0x17')],_0xd414d7);_0x45faad(_0x3ade5b[_0x8e1a('0x15')](0x1f4,_0x268755[_0x8e1a('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index ddb0910..396ea71 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 _0x8606=['./whatsappMessage.events','update','emit','register','length'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x8606,0x1f4));var _0x6860=function(_0x1e41ba,_0x455a21){_0x1e41ba=_0x1e41ba-0x0;var _0x201d61=_0x8606[_0x1e41ba];return _0x201d61;};'use strict';var WhatsappMessageEvents=require(_0x6860('0x0'));var events=['save','remove',_0x6860('0x1')];function createListener(_0x36c61c,_0x4bd4a5){return function(_0xe7e0f){_0x4bd4a5[_0x6860('0x2')](_0x36c61c,_0xe7e0f);};}function removeListener(_0x329ef5,_0x526ba1){return function(){WhatsappMessageEvents['removeListener'](_0x329ef5,_0x526ba1);};}exports[_0x6860('0x3')]=function(_0x26a576){for(var _0x252943=0x0,_0x44e108=events[_0x6860('0x4')];_0x252943<_0x44e108;_0x252943++){var _0x21ebfd=events[_0x252943];var _0x193edb=createListener('whatsappMessage:'+_0x21ebfd,_0x26a576);WhatsappMessageEvents['on'](_0x21ebfd,_0x193edb);}}; \ No newline at end of file +var _0x9086=['whatsappMessage:','./whatsappMessage.events','save','remove','update','removeListener','register','length'];(function(_0x552de0,_0x1d65e0){var _0x1be83b=function(_0xa52a50){while(--_0xa52a50){_0x552de0['push'](_0x552de0['shift']());}};_0x1be83b(++_0x1d65e0);}(_0x9086,0x1f1));var _0x6908=function(_0x1b745b,_0x3e2d40){_0x1b745b=_0x1b745b-0x0;var _0x120a9d=_0x9086[_0x1b745b];return _0x120a9d;};'use strict';var WhatsappMessageEvents=require(_0x6908('0x0'));var events=[_0x6908('0x1'),_0x6908('0x2'),_0x6908('0x3')];function createListener(_0x2dbfab,_0x4b3cdc){return function(_0x20794f){_0x4b3cdc['emit'](_0x2dbfab,_0x20794f);};}function removeListener(_0x4e94dd,_0x462c45){return function(){WhatsappMessageEvents[_0x6908('0x4')](_0x4e94dd,_0x462c45);};}exports[_0x6908('0x5')]=function(_0x575aa8){for(var _0x4e7315=0x0,_0x4399f6=events[_0x6908('0x6')];_0x4e7315<_0x4399f6;_0x4e7315++){var _0x251067=events[_0x4e7315];var _0x3c6ee7=createListener(_0x6908('0x7')+_0x251067,_0x575aa8);WhatsappMessageEvents['on'](_0x251067,_0x3c6ee7);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 9a232ba..ee11607 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 _0x482d=['../../components/interaction/service','./whatsappQueue.controller','isAuthenticated','index','get','/describe','/:id','show','getTeams','/:id/users','create','post','/:id/teams','addTeams','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','multer','util','express','Router','fs-extra','../../components/auth/service'];(function(_0x19b69c,_0x451651){var _0x4a4c3c=function(_0x40d37a){while(--_0x40d37a){_0x19b69c['push'](_0x19b69c['shift']());}};_0x4a4c3c(++_0x451651);}(_0x482d,0xed));var _0xd482=function(_0x44a04f,_0x4ab353){_0x44a04f=_0x44a04f-0x0;var _0x43af46=_0x482d[_0x44a04f];return _0x43af46;};'use strict';var multer=require(_0xd482('0x0'));var util=require(_0xd482('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd482('0x2'));var router=express[_0xd482('0x3')]();var fs_extra=require(_0xd482('0x4'));var auth=require(_0xd482('0x5'));var interaction=require(_0xd482('0x6'));var config=require('../../config/environment');var controller=require(_0xd482('0x7'));router['get']('/',auth[_0xd482('0x8')](),controller[_0xd482('0x9')]);router[_0xd482('0xa')](_0xd482('0xb'),auth[_0xd482('0x8')](),controller['describe']);router[_0xd482('0xa')](_0xd482('0xc'),auth['isAuthenticated'](),controller[_0xd482('0xd')]);router['get']('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0xd482('0xa')]('/:id/teams',auth[_0xd482('0x8')](),controller[_0xd482('0xe')]);router['get'](_0xd482('0xf'),auth[_0xd482('0x8')](),controller['getAgents']);router['post']('/',auth[_0xd482('0x8')](),controller[_0xd482('0x10')]);router[_0xd482('0x11')](_0xd482('0x12'),auth[_0xd482('0x8')](),controller[_0xd482('0x13')]);router[_0xd482('0x11')](_0xd482('0xf'),auth['isAuthenticated'](),controller[_0xd482('0x14')]);router[_0xd482('0x15')]('/:id',auth[_0xd482('0x8')](),controller['update']);router[_0xd482('0x16')](_0xd482('0xc'),auth[_0xd482('0x8')](),controller[_0xd482('0x17')]);router[_0xd482('0x16')](_0xd482('0x12'),auth['isAuthenticated'](),controller[_0xd482('0x18')]);router[_0xd482('0x16')]('/:id/users',auth[_0xd482('0x8')](),controller[_0xd482('0x19')]);module[_0xd482('0x1a')]=router; \ No newline at end of file +var _0x2fa9=['fs-extra','../../components/auth/service','../../config/environment','./whatsappQueue.controller','isAuthenticated','/describe','describe','get','show','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router'];(function(_0x59b787,_0x389245){var _0x25db1a=function(_0x30c3a0){while(--_0x30c3a0){_0x59b787['push'](_0x59b787['shift']());}};_0x25db1a(++_0x389245);}(_0x2fa9,0x91));var _0x92fa=function(_0x342b91,_0x1725e0){_0x342b91=_0x342b91-0x0;var _0x1a0803=_0x2fa9[_0x342b91];return _0x1a0803;};'use strict';var multer=require(_0x92fa('0x0'));var util=require(_0x92fa('0x1'));var path=require('path');var timeout=require(_0x92fa('0x2'));var express=require(_0x92fa('0x3'));var router=express[_0x92fa('0x4')]();var fs_extra=require(_0x92fa('0x5'));var auth=require(_0x92fa('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x92fa('0x7'));var controller=require(_0x92fa('0x8'));router['get']('/',auth[_0x92fa('0x9')](),controller['index']);router['get'](_0x92fa('0xa'),auth[_0x92fa('0x9')](),controller[_0x92fa('0xb')]);router[_0x92fa('0xc')]('/:id',auth[_0x92fa('0x9')](),controller[_0x92fa('0xd')]);router[_0x92fa('0xc')]('/:id/members',auth[_0x92fa('0x9')](),controller['getMembers']);router[_0x92fa('0xc')](_0x92fa('0xe'),auth[_0x92fa('0x9')](),controller[_0x92fa('0xf')]);router['get'](_0x92fa('0x10'),auth[_0x92fa('0x9')](),controller[_0x92fa('0x11')]);router[_0x92fa('0x12')]('/',auth[_0x92fa('0x9')](),controller[_0x92fa('0x13')]);router[_0x92fa('0x12')](_0x92fa('0xe'),auth[_0x92fa('0x9')](),controller[_0x92fa('0x14')]);router[_0x92fa('0x12')](_0x92fa('0x10'),auth[_0x92fa('0x9')](),controller[_0x92fa('0x15')]);router[_0x92fa('0x16')](_0x92fa('0x17'),auth[_0x92fa('0x9')](),controller[_0x92fa('0x18')]);router[_0x92fa('0x19')](_0x92fa('0x17'),auth[_0x92fa('0x9')](),controller[_0x92fa('0x1a')]);router[_0x92fa('0x19')](_0x92fa('0xe'),auth[_0x92fa('0x9')](),controller[_0x92fa('0x1b')]);router['delete']('/:id/users',auth[_0x92fa('0x9')](),controller[_0x92fa('0x1c')]);module[_0x92fa('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 6eb9441..1816e11 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 _0xbe45=['sequelize','exports','name','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x10e4fc,_0x51091b){var _0x3fda14=function(_0x1ede56){while(--_0x1ede56){_0x10e4fc['push'](_0x10e4fc['shift']());}};_0x3fda14(++_0x51091b);}(_0xbe45,0xf0));var _0x5be4=function(_0x3687ea,_0x189f76){_0x3687ea=_0x3687ea-0x0;var _0x2f7577=_0xbe45[_0x3687ea];return _0x2f7577;};'use strict';var Sequelize=require(_0x5be4('0x0'));module[_0x5be4('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x5be4('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x5be4('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5be4('0x4')](_0x5be4('0x5'),_0x5be4('0x6'),_0x5be4('0x7'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3f19=['sequelize','INTEGER','rrmemory','beepall','roundrobin','STRING'];(function(_0x13e02a,_0x1bd79d){var _0x187f95=function(_0x4c8306){while(--_0x4c8306){_0x13e02a['push'](_0x13e02a['shift']());}};_0x187f95(++_0x1bd79d);}(_0x3f19,0xc0));var _0x93f1=function(_0x29cb9b,_0x247dd1){_0x29cb9b=_0x29cb9b-0x0;var _0x544ff3=_0x3f19[_0x29cb9b];return _0x544ff3;};'use strict';var Sequelize=require(_0x93f1('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x93f1('0x1')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x93f1('0x2'),_0x93f1('0x3'),_0x93f1('0x4'))},'description':{'type':Sequelize[_0x93f1('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 6e03fdb..b9dd0cc 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 _0xfdc1=['findAndCountAll','agent','updatedAt','createdAt','%s/%s','SIP','whatsappPause','getTeams','Team','addTeams','ids','voicePause','flatMap','transaction','each','findOrCreate','emit','userWhatsappQueue:save','Agents','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','toString','sequelize','QueryTypes','SELECT','TeamId','includes','compact','isEmpty','userWhatsappQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../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','reject','save','then','destroy','WhatsappQueues','UserProfileResource','error','stack','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','sort','pick','filter','where','merge','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','userProfileId','update','getMembers','findOne','UserWhatsappQueue','hasOwnProperty','order','WhatsappQueueId','options','User'];(function(_0x7eb2d4,_0x3caf95){var _0x913df9=function(_0x4cd0ba){while(--_0x4cd0ba){_0x7eb2d4['push'](_0x7eb2d4['shift']());}};_0x913df9(++_0x3caf95);}(_0xfdc1,0xb6));var _0x1fdc=function(_0x307086,_0x3bfe4e){_0x307086=_0x307086-0x0;var _0x699043=_0xfdc1[_0x307086];return _0x699043;};'use strict';var emlformat=require(_0x1fdc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1fdc('0x1'));var jsonpatch=require(_0x1fdc('0x2'));var rp=require(_0x1fdc('0x3'));var moment=require(_0x1fdc('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1fdc('0x5'));var util=require(_0x1fdc('0x6'));var path=require(_0x1fdc('0x7'));var sox=require(_0x1fdc('0x8'));var csv=require('to-csv');var ejs=require(_0x1fdc('0x9'));var fs=require('fs');var fs_extra=require(_0x1fdc('0xa'));var _=require(_0x1fdc('0xb'));var squel=require(_0x1fdc('0xc'));var crypto=require(_0x1fdc('0xd'));var jsforce=require(_0x1fdc('0xe'));var deskjs=require(_0x1fdc('0xf'));var toCsv=require(_0x1fdc('0x10'));var querystring=require(_0x1fdc('0x11'));var Papa=require('papaparse');var Redis=require(_0x1fdc('0x12'));var authService=require(_0x1fdc('0x13'));var qs=require(_0x1fdc('0x14'));var as=require(_0x1fdc('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1fdc('0x16'))(_0x1fdc('0x17'));var utils=require(_0x1fdc('0x18'));var config=require(_0x1fdc('0x19'));var licenseUtil=require(_0x1fdc('0x1a'));var db=require(_0x1fdc('0x1b'))['db'];config['redis']=_['defaults'](config[_0x1fdc('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x1fdc('0x1d'))(new Redis(config['redis']));require('./whatsappQueue.socket')[_0x1fdc('0x1e')](socket);function respondWithStatusCode(_0x19f267,_0x318684){_0x318684=_0x318684||0xcc;return function(_0x45af22){if(_0x45af22){return _0x19f267[_0x1fdc('0x1f')](_0x318684);}return _0x19f267[_0x1fdc('0x20')](_0x318684)[_0x1fdc('0x21')]();};}function respondWithResult(_0x5424ad,_0x57d28a){_0x57d28a=_0x57d28a||0xc8;return function(_0x2e4744){if(_0x2e4744){return _0x5424ad[_0x1fdc('0x20')](_0x57d28a)[_0x1fdc('0x22')](_0x2e4744);}};}function respondWithFilteredResult(_0x1b633d,_0x4b5f4a){return function(_0x138841){if(_0x138841){var _0x4646ce=typeof _0x4b5f4a[_0x1fdc('0x23')]===_0x1fdc('0x24')&&typeof _0x4b5f4a[_0x1fdc('0x25')]===_0x1fdc('0x24');var _0xa6523=_0x138841[_0x1fdc('0x26')];var _0x125d86=_0x4646ce?0x0:_0x4b5f4a[_0x1fdc('0x23')];var _0x167c8d=_0x4646ce?_0x138841[_0x1fdc('0x26')]:_0x4b5f4a[_0x1fdc('0x23')]+_0x4b5f4a[_0x1fdc('0x25')];var _0x1bdddb;if(_0x167c8d>=_0xa6523){_0x167c8d=_0xa6523;_0x1bdddb=0xc8;}else{_0x1bdddb=0xce;}_0x1b633d[_0x1fdc('0x20')](_0x1bdddb);return _0x1b633d[_0x1fdc('0x27')](_0x1fdc('0x28'),_0x125d86+'-'+_0x167c8d+'/'+_0xa6523)[_0x1fdc('0x22')](_0x138841);}return null;};}function patchUpdates(_0x5ab500){return function(_0x521f86){try{jsonpatch[_0x1fdc('0x29')](_0x521f86,_0x5ab500,!![]);}catch(_0x190143){return BPromise[_0x1fdc('0x2a')](_0x190143);}return _0x521f86[_0x1fdc('0x2b')]();};}function saveUpdates(_0x25ab07,_0x5cb7ea){return function(_0x38375b){if(_0x38375b){return _0x38375b['update'](_0x25ab07)[_0x1fdc('0x2c')](function(_0x305c20){return _0x305c20;});}return null;};}function removeEntity(_0x183294,_0x3aea48){return function(_0x2d95a2){if(_0x2d95a2){return _0x2d95a2[_0x1fdc('0x2d')]()[_0x1fdc('0x2c')](function(){var _0x14157a=_0x2d95a2['get']({'plain':!![]});var _0x2e100f=_0x1fdc('0x2e');return db[_0x1fdc('0x2f')][_0x1fdc('0x2d')]({'where':{'type':_0x2e100f,'resourceId':_0x14157a['id']}})[_0x1fdc('0x2c')](function(){return _0x2d95a2;});})['then'](function(){_0x183294[_0x1fdc('0x20')](0xcc)[_0x1fdc('0x21')]();});}};}function handleEntityNotFound(_0x514a8b,_0x460729){return function(_0x3b43a4){if(!_0x3b43a4){_0x514a8b[_0x1fdc('0x1f')](0x194);}return _0x3b43a4;};}function handleError(_0x4ca419,_0x3bead4){_0x3bead4=_0x3bead4||0x1f4;return function(_0x4ded81){logger[_0x1fdc('0x30')](_0x4ded81[_0x1fdc('0x31')]);if(_0x4ded81[_0x1fdc('0x32')]){delete _0x4ded81[_0x1fdc('0x32')];}_0x4ca419[_0x1fdc('0x20')](_0x3bead4)[_0x1fdc('0x33')](_0x4ded81);};}exports[_0x1fdc('0x34')]=function(_0x24734a,_0x28747d){var _0x2a2137={},_0x38e3ed={},_0x298530={'count':0x0,'rows':[]};var _0x36a92a=_[_0x1fdc('0x35')](db[_0x1fdc('0x36')][_0x1fdc('0x37')],function(_0x3d8d06){return{'name':_0x3d8d06[_0x1fdc('0x38')],'type':_0x3d8d06[_0x1fdc('0x39')][_0x1fdc('0x3a')]};});_0x38e3ed['model']=_['map'](_0x36a92a,'name');_0x38e3ed[_0x1fdc('0x3b')]=_[_0x1fdc('0x3c')](_0x24734a['query']);_0x38e3ed[_0x1fdc('0x3d')]=_[_0x1fdc('0x3e')](_0x38e3ed[_0x1fdc('0x3f')],_0x38e3ed[_0x1fdc('0x3b')]);_0x2a2137['attributes']=_['intersection'](_0x38e3ed[_0x1fdc('0x3f')],qs['fields'](_0x24734a[_0x1fdc('0x3b')][_0x1fdc('0x40')]));_0x2a2137['attributes']=_0x2a2137[_0x1fdc('0x41')][_0x1fdc('0x42')]?_0x2a2137['attributes']:_0x38e3ed[_0x1fdc('0x3f')];if(!_0x24734a['query']['hasOwnProperty'](_0x1fdc('0x43'))){_0x2a2137[_0x1fdc('0x25')]=qs[_0x1fdc('0x25')](_0x24734a[_0x1fdc('0x3b')]['limit']);_0x2a2137[_0x1fdc('0x23')]=qs[_0x1fdc('0x23')](_0x24734a[_0x1fdc('0x3b')][_0x1fdc('0x23')]);}_0x2a2137['order']=qs[_0x1fdc('0x44')](_0x24734a[_0x1fdc('0x3b')][_0x1fdc('0x44')]);_0x2a2137['where']=qs[_0x1fdc('0x3d')](_[_0x1fdc('0x45')](_0x24734a['query'],_0x38e3ed[_0x1fdc('0x3d')]),_0x36a92a);if(_0x24734a[_0x1fdc('0x3b')][_0x1fdc('0x46')]){_0x2a2137[_0x1fdc('0x47')]=_[_0x1fdc('0x48')](_0x2a2137[_0x1fdc('0x47')],{'$or':_[_0x1fdc('0x35')](_0x36a92a,function(_0x468c07){if(_0x468c07['type']!==_0x1fdc('0x49')){var _0x58a25c={};_0x58a25c[_0x468c07[_0x1fdc('0x32')]]={'$like':'%'+_0x24734a['query'][_0x1fdc('0x46')]+'%'};return _0x58a25c;}})});}_0x2a2137=_[_0x1fdc('0x48')]({},_0x2a2137,_0x24734a['options']);var _0x22e7a9={'where':_0x2a2137[_0x1fdc('0x47')]};return db[_0x1fdc('0x36')][_0x1fdc('0x26')](_0x22e7a9)['then'](function(_0x5616bb){_0x298530[_0x1fdc('0x26')]=_0x5616bb;if(_0x24734a['query']['includeAll']){_0x2a2137[_0x1fdc('0x4a')]=[{'all':!![]}];}return db['WhatsappQueue'][_0x1fdc('0x4b')](_0x2a2137);})[_0x1fdc('0x2c')](function(_0x392208){_0x298530[_0x1fdc('0x4c')]=_0x392208;return _0x298530;})[_0x1fdc('0x2c')](respondWithFilteredResult(_0x28747d,_0x2a2137))[_0x1fdc('0x4d')](handleError(_0x28747d,null));};exports[_0x1fdc('0x4e')]=function(_0x2f17d8,_0x44e319){var _0x5f4eea={'raw':!![],'where':{'id':_0x2f17d8[_0x1fdc('0x4f')]['id']}},_0x15f132={};_0x15f132[_0x1fdc('0x3f')]=_[_0x1fdc('0x3c')](db[_0x1fdc('0x36')]['rawAttributes']);_0x15f132[_0x1fdc('0x3b')]=_[_0x1fdc('0x3c')](_0x2f17d8[_0x1fdc('0x3b')]);_0x15f132[_0x1fdc('0x3d')]=_[_0x1fdc('0x3e')](_0x15f132[_0x1fdc('0x3f')],_0x15f132[_0x1fdc('0x3b')]);_0x5f4eea[_0x1fdc('0x41')]=_[_0x1fdc('0x3e')](_0x15f132[_0x1fdc('0x3f')],qs['fields'](_0x2f17d8[_0x1fdc('0x3b')][_0x1fdc('0x40')]));_0x5f4eea[_0x1fdc('0x41')]=_0x5f4eea[_0x1fdc('0x41')]['length']?_0x5f4eea[_0x1fdc('0x41')]:_0x15f132[_0x1fdc('0x3f')];if(_0x2f17d8[_0x1fdc('0x3b')][_0x1fdc('0x50')]){_0x5f4eea[_0x1fdc('0x4a')]=[{'all':!![]}];}_0x5f4eea=_['merge']({},_0x5f4eea,_0x2f17d8['options']);return db[_0x1fdc('0x36')][_0x1fdc('0x51')](_0x5f4eea)[_0x1fdc('0x2c')](handleEntityNotFound(_0x44e319,null))[_0x1fdc('0x2c')](respondWithResult(_0x44e319,null))[_0x1fdc('0x4d')](handleError(_0x44e319,null));};exports[_0x1fdc('0x52')]=function(_0x147aee,_0x43b190){return db[_0x1fdc('0x36')]['create'](_0x147aee[_0x1fdc('0x53')],{})[_0x1fdc('0x2c')](function(_0x5e7d7c){var _0x5a73e9=_0x147aee[_0x1fdc('0x54')]['get']({'plain':!![]});if(!_0x5a73e9)throw new Error(_0x1fdc('0x55'));if(_0x5a73e9[_0x1fdc('0x56')]===_0x1fdc('0x54')){var _0x2c9382=_0x5e7d7c[_0x1fdc('0x57')]({'plain':!![]});var _0x45e7ca=_0x1fdc('0x2e');return db['UserProfileSection']['find']({'where':{'name':_0x45e7ca,'userProfileId':_0x5a73e9[_0x1fdc('0x58')]},'raw':!![]})[_0x1fdc('0x2c')](function(_0x25237a){if(_0x25237a&&_0x25237a['autoAssociation']===0x0){return db[_0x1fdc('0x2f')][_0x1fdc('0x52')]({'name':_0x2c9382['name'],'resourceId':_0x2c9382['id'],'type':_0x25237a[_0x1fdc('0x32')],'sectionId':_0x25237a['id']},{})[_0x1fdc('0x2c')](function(){return _0x5e7d7c;});}else{return _0x5e7d7c;}})[_0x1fdc('0x4d')](function(_0x1f0157){logger[_0x1fdc('0x30')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1f0157);throw _0x1f0157;});}return _0x5e7d7c;})['then'](respondWithResult(_0x43b190,0xc9))['catch'](handleError(_0x43b190,null));};exports[_0x1fdc('0x59')]=function(_0x2c2dd5,_0x1a6421){if(_0x2c2dd5['body']['id']){delete _0x2c2dd5[_0x1fdc('0x53')]['id'];}return db['WhatsappQueue']['find']({'where':{'id':_0x2c2dd5[_0x1fdc('0x4f')]['id']}})[_0x1fdc('0x2c')](handleEntityNotFound(_0x1a6421,null))['then'](saveUpdates(_0x2c2dd5[_0x1fdc('0x53')],null))['then'](respondWithResult(_0x1a6421,null))[_0x1fdc('0x4d')](handleError(_0x1a6421,null));};exports[_0x1fdc('0x2d')]=function(_0x349265,_0x2387b1){return db[_0x1fdc('0x36')]['find']({'where':{'id':_0x349265[_0x1fdc('0x4f')]['id']}})[_0x1fdc('0x2c')](handleEntityNotFound(_0x2387b1,null))['then'](removeEntity(_0x2387b1,null))[_0x1fdc('0x4d')](handleError(_0x2387b1,null));};exports['describe']=function(_0x2fb6a4,_0x3e4390){return db[_0x1fdc('0x36')]['describe']()['then'](respondWithResult(_0x3e4390,null))[_0x1fdc('0x4d')](handleError(_0x3e4390,null));};exports[_0x1fdc('0x5a')]=function(_0x17ebbf,_0x1db514,_0xdc303d){var _0x28726c={'raw':!![],'where':{}},_0x3aac9d={},_0x1d6210;return db[_0x1fdc('0x36')][_0x1fdc('0x5b')]({'where':{'id':_0x17ebbf[_0x1fdc('0x4f')]['id']}})[_0x1fdc('0x2c')](handleEntityNotFound(_0x1db514,null))['then'](function(_0x26861b){if(_0x26861b){_0x1d6210=_0x26861b[_0x1fdc('0x57')]({'plain':!![]});_0x3aac9d[_0x1fdc('0x3f')]=_[_0x1fdc('0x3c')](db[_0x1fdc('0x5c')][_0x1fdc('0x37')]);_0x3aac9d[_0x1fdc('0x3b')]=_[_0x1fdc('0x3c')](_0x17ebbf['query']);_0x3aac9d[_0x1fdc('0x3d')]=_[_0x1fdc('0x3e')](_0x3aac9d['model'],_0x3aac9d[_0x1fdc('0x3b')]);_0x28726c[_0x1fdc('0x41')]=_[_0x1fdc('0x3e')](_0x3aac9d[_0x1fdc('0x3f')],qs[_0x1fdc('0x40')](_0x17ebbf[_0x1fdc('0x3b')][_0x1fdc('0x40')]));_0x28726c[_0x1fdc('0x41')]=_0x28726c['attributes']['length']?_0x28726c[_0x1fdc('0x41')]:_0x3aac9d[_0x1fdc('0x3f')];if(!_0x17ebbf[_0x1fdc('0x3b')][_0x1fdc('0x5d')]('nolimit')){_0x28726c['limit']=qs[_0x1fdc('0x25')](_0x17ebbf[_0x1fdc('0x3b')][_0x1fdc('0x25')]);_0x28726c[_0x1fdc('0x23')]=qs['offset'](_0x17ebbf[_0x1fdc('0x3b')][_0x1fdc('0x23')]);}_0x28726c[_0x1fdc('0x5e')]=qs['sort'](_0x17ebbf['query'][_0x1fdc('0x44')]);_0x28726c[_0x1fdc('0x47')]=qs[_0x1fdc('0x3d')](_['pick'](_0x17ebbf[_0x1fdc('0x3b')],_0x3aac9d[_0x1fdc('0x3d')]));_0x28726c[_0x1fdc('0x47')][_0x1fdc('0x5f')]=_0x26861b['id'];if(_0x17ebbf[_0x1fdc('0x3b')][_0x1fdc('0x46')]){_0x28726c[_0x1fdc('0x47')]=_[_0x1fdc('0x48')](_0x28726c[_0x1fdc('0x47')],{'$or':_[_0x1fdc('0x35')](_0x28726c[_0x1fdc('0x41')],function(_0x63d8c){var _0x5c3c08={};_0x5c3c08[_0x63d8c]={'$like':'%'+_0x17ebbf[_0x1fdc('0x3b')][_0x1fdc('0x46')]+'%'};return _0x5c3c08;})});}_0x28726c=_[_0x1fdc('0x48')]({},_0x28726c,_0x17ebbf[_0x1fdc('0x60')]);return db[_0x1fdc('0x5c')][_0x1fdc('0x4b')](_0x28726c);}})[_0x1fdc('0x2c')](function(_0x1089e6){if(_0x1089e6){return db[_0x1fdc('0x61')][_0x1fdc('0x62')]({'where':{'id':_['map'](_0x1089e6,'UserId'),'role':_0x1fdc('0x63')},'attributes':['id','name','whatsappPause',_0x1fdc('0x64'),_0x1fdc('0x65')]});}})['then'](function(_0xe05d09){if(_0xe05d09){return{'count':_0xe05d09['count'],'rows':_[_0x1fdc('0x35')](_0xe05d09[_0x1fdc('0x4c')],function(_0x48ab89){return{'membername':_0x48ab89[_0x1fdc('0x32')],'UserId':_0x48ab89['id'],'queue_name':_0x1d6210[_0x1fdc('0x32')],'WhatsappQueueId':_0x1d6210['id'],'interface':util['format'](_0x1fdc('0x66'),_0x1fdc('0x67'),_0x48ab89['name']),'penalty':0x0,'paused':_0x48ab89[_0x1fdc('0x68')],'createdAt':_0x48ab89[_0x1fdc('0x65')],'updatedAt':_0x48ab89[_0x1fdc('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x1db514,_0x28726c))['catch'](handleError(_0x1db514,null));};exports[_0x1fdc('0x69')]=function(_0x1ea9f0,_0x1898f4,_0x1f0e44){var _0x55d610={};var _0x52542c={};var _0x261964;var _0x5bdf71;return db['WhatsappQueue']['findOne']({'where':{'id':_0x1ea9f0[_0x1fdc('0x4f')]['id']}})[_0x1fdc('0x2c')](handleEntityNotFound(_0x1898f4,null))[_0x1fdc('0x2c')](function(_0x111d32){if(_0x111d32){_0x261964=_0x111d32;_0x52542c[_0x1fdc('0x3f')]=_[_0x1fdc('0x3c')](db[_0x1fdc('0x6a')]['rawAttributes']);_0x52542c[_0x1fdc('0x3b')]=_['keys'](_0x1ea9f0[_0x1fdc('0x3b')]);_0x52542c['filters']=_[_0x1fdc('0x3e')](_0x52542c[_0x1fdc('0x3f')],_0x52542c[_0x1fdc('0x3b')]);_0x55d610[_0x1fdc('0x41')]=_[_0x1fdc('0x3e')](_0x52542c[_0x1fdc('0x3f')],qs[_0x1fdc('0x40')](_0x1ea9f0[_0x1fdc('0x3b')]['fields']));_0x55d610[_0x1fdc('0x41')]=_0x55d610[_0x1fdc('0x41')][_0x1fdc('0x42')]?_0x55d610['attributes']:_0x52542c[_0x1fdc('0x3f')];_0x55d610[_0x1fdc('0x5e')]=qs[_0x1fdc('0x44')](_0x1ea9f0[_0x1fdc('0x3b')][_0x1fdc('0x44')]);_0x55d610[_0x1fdc('0x47')]=qs[_0x1fdc('0x3d')](_['pick'](_0x1ea9f0[_0x1fdc('0x3b')],_0x52542c['filters']));if(_0x1ea9f0[_0x1fdc('0x3b')][_0x1fdc('0x46')]){_0x55d610[_0x1fdc('0x47')]=_[_0x1fdc('0x48')](_0x55d610[_0x1fdc('0x47')],{'$or':_['map'](_0x55d610[_0x1fdc('0x41')],function(_0x20dc05){var _0x3e584c={};_0x3e584c[_0x20dc05]={'$like':'%'+_0x1ea9f0[_0x1fdc('0x3b')][_0x1fdc('0x46')]+'%'};return _0x3e584c;})});}_0x55d610=_[_0x1fdc('0x48')]({},_0x55d610,_0x1ea9f0[_0x1fdc('0x60')]);return _0x261964[_0x1fdc('0x69')](_0x55d610);}})[_0x1fdc('0x2c')](function(_0x2216e0){if(_0x2216e0){_0x5bdf71=_0x2216e0[_0x1fdc('0x42')];if(!_0x1ea9f0[_0x1fdc('0x3b')][_0x1fdc('0x5d')](_0x1fdc('0x43'))){_0x55d610[_0x1fdc('0x25')]=qs[_0x1fdc('0x25')](_0x1ea9f0['query']['limit']);_0x55d610[_0x1fdc('0x23')]=qs[_0x1fdc('0x23')](_0x1ea9f0[_0x1fdc('0x3b')][_0x1fdc('0x23')]);}return _0x261964[_0x1fdc('0x69')](_0x55d610);}})['then'](function(_0x5d3347){if(_0x5d3347){return _0x5d3347?{'count':_0x5bdf71,'rows':_0x5d3347}:null;}})['then'](respondWithResult(_0x1898f4,null))[_0x1fdc('0x4d')](handleError(_0x1898f4,null));};exports[_0x1fdc('0x6b')]=function(_0x4e7ad4,_0x23546f,_0x22fd59){var _0x945543=_0x4e7ad4['body'][_0x1fdc('0x6c')];return db['Team'][_0x1fdc('0x4b')]({'where':{'id':_0x945543},'attributes':['id'],'include':[{'model':db[_0x1fdc('0x61')],'as':'Agents','attributes':['id','name','online',_0x1fdc('0x6d'),'interface'],'raw':!![]}]})[_0x1fdc('0x2c')](function(_0x297fbe){if(_0x297fbe){var _0x589e0f=_[_0x1fdc('0x6e')](_0x297fbe,function(_0x4acc41){var _0x25aa33=_0x4acc41[_0x1fdc('0x57')]({'plain':!![]});return _0x25aa33['Agents'];});return db[_0x1fdc('0x36')][_0x1fdc('0x51')]({'where':{'id':_0x4e7ad4[_0x1fdc('0x4f')]['id']}})[_0x1fdc('0x2c')](function(_0x128b3d){return db['sequelize'][_0x1fdc('0x6f')](function(_0x29f850){return _0x128b3d[_0x1fdc('0x6b')](_0x945543,{'transaction':_0x29f850})[_0x1fdc('0x2c')](function(){return BPromise[_0x1fdc('0x70')](_0x589e0f,function(_0x39b1a7){return db[_0x1fdc('0x5c')][_0x1fdc('0x71')]({'where':{'UserId':_0x39b1a7['id'],'WhatsappQueueId':_0x4e7ad4[_0x1fdc('0x4f')]['id']},'transaction':_0x29f850});});})[_0x1fdc('0x2c')](function(){_0x589e0f['forEach'](function(_0x3ddd98){socket[_0x1fdc('0x72')](_0x1fdc('0x73'),{'UserId':_0x3ddd98['id'],'WhatsappQueueId':_0x128b3d['id']});});});});});}})[_0x1fdc('0x2c')](respondWithStatusCode(_0x23546f,null))[_0x1fdc('0x4d')](handleError(_0x23546f,null));};exports['removeTeams']=function(_0xb47c55,_0x380dd0,_0x23b817){return db[_0x1fdc('0x6a')][_0x1fdc('0x4b')]({'where':{'id':_0xb47c55[_0x1fdc('0x3b')][_0x1fdc('0x6c')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x1fdc('0x74'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x380dd0,null))[_0x1fdc('0x2c')](function(_0xe5a3f5){var _0x5cb7c0=_['map'](_0xe5a3f5,'id');var _0x59261e=[];var _0x39b21c=[];var _0xad7c11=squel['select']();_0xad7c11[_0x1fdc('0x75')](_0x1fdc('0x76'))[_0x1fdc('0x77')](_0x1fdc('0x78'),'tq')[_0x1fdc('0x79')](_0x1fdc('0x7a'),'ut',_0x1fdc('0x7b'))[_0x1fdc('0x47')](_0x1fdc('0x7c'),_0xb47c55['params']['id']);for(var _0x72fa55=0x0;_0x72fa55<_0xe5a3f5[_0x1fdc('0x42')];_0x72fa55+=0x1){let _0x150bba=_0xe5a3f5[_0x72fa55];for(var _0x15d54c=0x0;_0x15d54c<_0x150bba[_0x1fdc('0x74')][_0x1fdc('0x42')];_0x15d54c+=0x1){let _0x243c38=_0x150bba['Agents'][_0x15d54c];var _0x5eb7df=_0xad7c11['clone']();_0x5eb7df[_0x1fdc('0x47')]('ut.UserId\x20=\x20?',_0x243c38['id']);_0x39b21c['push'](db['sequelize'][_0x1fdc('0x3b')](_0x5eb7df[_0x1fdc('0x7d')](),{'type':db[_0x1fdc('0x7e')][_0x1fdc('0x7f')][_0x1fdc('0x80')]})[_0x1fdc('0x2c')](function(_0x347e93){if(_0x347e93[_0x1fdc('0x42')]===0x1){return _0x243c38['id'];}else{var _0xd1766e=_['every'](_[_0x1fdc('0x35')](_0x347e93,_0x1fdc('0x81')),function(_0x4e792f){return _[_0x1fdc('0x82')](_0x5cb7c0,_0x4e792f);});if(_0xd1766e){return _0x243c38['id'];}}}));}}return BPromise['all'](_0x39b21c)[_0x1fdc('0x2c')](function(_0x2b4584){_0x59261e=_(_0x59261e)['union'](_0x2b4584)[_0x1fdc('0x83')]()['value']();return db['WhatsappQueue'][_0x1fdc('0x51')]({'where':{'id':_0xb47c55['params']['id']}})[_0x1fdc('0x2c')](function(_0x1e7dc0){return db[_0x1fdc('0x7e')][_0x1fdc('0x6f')](function(_0xc07607){return _0x1e7dc0['removeTeams'](_0xb47c55[_0x1fdc('0x3b')][_0x1fdc('0x6c')],{'transaction':_0xc07607})[_0x1fdc('0x2c')](function(){if(!_[_0x1fdc('0x84')](_0x59261e)){return _0x1e7dc0['removeAgents'](_0x59261e,{'transaction':_0xc07607});}})[_0x1fdc('0x2c')](function(){_0x59261e['forEach'](function(_0xd5fc84){socket[_0x1fdc('0x72')](_0x1fdc('0x85'),{'UserId':_0xd5fc84,'WhatsappQueueId':_0x1e7dc0['id']});});});});});});})[_0x1fdc('0x2c')](respondWithStatusCode(_0x380dd0,null))['catch'](handleError(_0x380dd0,null));};exports[_0x1fdc('0x86')]=function(_0x3dd961,_0x190509,_0x35a0f4){return db['WhatsappQueue'][_0x1fdc('0x51')]({'where':{'id':_0x3dd961['params']['id']}})['then'](handleEntityNotFound(_0x190509,null))[_0x1fdc('0x2c')](function(_0x1d626b){if(_0x1d626b){return _0x1d626b[_0x1fdc('0x86')](_0x3dd961[_0x1fdc('0x53')]['ids'],_[_0x1fdc('0x87')](_0x3dd961[_0x1fdc('0x53')],[_0x1fdc('0x6c'),'id'])||{})[_0x1fdc('0x88')](function(_0x4bfc55){for(var _0x1451d7=0x0;_0x1451d7<_0x3dd961['body'][_0x1fdc('0x6c')][_0x1fdc('0x42')];_0x1451d7+=0x1){socket[_0x1fdc('0x72')]('userWhatsappQueue:save',{'UserId':Number(_0x3dd961[_0x1fdc('0x53')][_0x1fdc('0x6c')][_0x1451d7]),'WhatsappQueueId':Number(_0x3dd961[_0x1fdc('0x4f')]['id'])});}return _0x4bfc55;});}})['then'](respondWithResult(_0x190509,null))[_0x1fdc('0x4d')](handleError(_0x190509,null));};exports[_0x1fdc('0x89')]=function(_0x17e9b7,_0x1abf54,_0x32628d){return db[_0x1fdc('0x36')][_0x1fdc('0x51')]({'where':{'id':_0x17e9b7[_0x1fdc('0x4f')]['id']}})[_0x1fdc('0x2c')](handleEntityNotFound(_0x1abf54,null))[_0x1fdc('0x2c')](function(_0x70d8b6){if(_0x70d8b6){return _0x70d8b6['removeAgents'](_0x17e9b7[_0x1fdc('0x3b')][_0x1fdc('0x6c')])['then'](function(){if(_[_0x1fdc('0x8a')](_0x17e9b7[_0x1fdc('0x3b')][_0x1fdc('0x6c')])){for(var _0xf871fb=0x0;_0xf871fb<_0x17e9b7[_0x1fdc('0x3b')][_0x1fdc('0x6c')]['length'];_0xf871fb+=0x1){socket[_0x1fdc('0x72')]('userWhatsappQueue:remove',{'UserId':Number(_0x17e9b7[_0x1fdc('0x3b')][_0x1fdc('0x6c')][_0xf871fb]),'WhatsappQueueId':Number(_0x17e9b7['params']['id'])});}}else{socket['emit']('userWhatsappQueue:remove',{'UserId':Number(_0x17e9b7[_0x1fdc('0x3b')]['ids']),'WhatsappQueueId':Number(_0x17e9b7[_0x1fdc('0x4f')]['id'])});}});}})[_0x1fdc('0x2c')](respondWithStatusCode(_0x1abf54,null))[_0x1fdc('0x4d')](handleError(_0x1abf54,null));};exports['getAgents']=function(_0x510ab2,_0xf7e2ea,_0x22aad9){var _0x2447ae={};var _0x2060d8={};var _0x1bae83;var _0xcb329d;return db[_0x1fdc('0x36')][_0x1fdc('0x5b')]({'where':{'id':_0x510ab2[_0x1fdc('0x4f')]['id']}})[_0x1fdc('0x2c')](handleEntityNotFound(_0xf7e2ea,null))[_0x1fdc('0x2c')](function(_0x141a51){if(_0x141a51){_0x1bae83=_0x141a51;_0x2060d8['model']=_[_0x1fdc('0x3c')](db[_0x1fdc('0x61')][_0x1fdc('0x37')]);_0x2060d8[_0x1fdc('0x3b')]=_[_0x1fdc('0x3c')](_0x510ab2[_0x1fdc('0x3b')]);_0x2060d8['filters']=_[_0x1fdc('0x3e')](_0x2060d8[_0x1fdc('0x3f')],_0x2060d8[_0x1fdc('0x3b')]);_0x2447ae[_0x1fdc('0x41')]=_[_0x1fdc('0x3e')](_0x2060d8[_0x1fdc('0x3f')],qs[_0x1fdc('0x40')](_0x510ab2[_0x1fdc('0x3b')]['fields']));_0x2447ae[_0x1fdc('0x41')]=_0x2447ae[_0x1fdc('0x41')]['length']?_0x2447ae[_0x1fdc('0x41')]:_0x2060d8[_0x1fdc('0x3f')];_0x2447ae[_0x1fdc('0x5e')]=qs[_0x1fdc('0x44')](_0x510ab2['query'][_0x1fdc('0x44')]);_0x2447ae[_0x1fdc('0x47')]=qs['filters'](_[_0x1fdc('0x45')](_0x510ab2['query'],_0x2060d8[_0x1fdc('0x3d')]));if(_0x510ab2[_0x1fdc('0x3b')][_0x1fdc('0x46')]){_0x2447ae[_0x1fdc('0x47')]=_[_0x1fdc('0x48')](_0x2447ae[_0x1fdc('0x47')],{'$or':_[_0x1fdc('0x35')](_0x2447ae['attributes'],function(_0x4dc812){var _0x3d2660={};_0x3d2660[_0x4dc812]={'$like':'%'+_0x510ab2[_0x1fdc('0x3b')]['filter']+'%'};return _0x3d2660;})});}_0x2447ae=_[_0x1fdc('0x48')]({},_0x2447ae,_0x510ab2[_0x1fdc('0x60')]);return _0x1bae83[_0x1fdc('0x8b')](_0x2447ae);}})[_0x1fdc('0x2c')](function(_0x30116b){if(_0x30116b){_0xcb329d=_0x30116b['length'];if(!_0x510ab2['query']['hasOwnProperty'](_0x1fdc('0x43'))){_0x2447ae[_0x1fdc('0x25')]=qs['limit'](_0x510ab2['query'][_0x1fdc('0x25')]);_0x2447ae[_0x1fdc('0x23')]=qs['offset'](_0x510ab2[_0x1fdc('0x3b')][_0x1fdc('0x23')]);}return _0x1bae83[_0x1fdc('0x8b')](_0x2447ae);}})[_0x1fdc('0x2c')](function(_0x20e063){if(_0x20e063){return _0x20e063?{'count':_0xcb329d,'rows':_0x20e063}:null;}})[_0x1fdc('0x2c')](respondWithResult(_0xf7e2ea,null))[_0x1fdc('0x4d')](handleError(_0xf7e2ea,null));}; \ No newline at end of file +var _0xdff0=['zip-dir','fast-json-patch','moment','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','register','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','error','stack','name','send','index','map','WhatsappQueue','rawAttributes','type','model','keys','filters','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','intersection','find','create','body','user','get','role','WhatsappQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserWhatsappQueue','WhatsappQueueId','User','UserId','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','userWhatsappQueue:save','removeTeams','select','tq.TeamId','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','emit','addAgents','omit','spread','removeAgents','userWhatsappQueue:remove','getAgents','eml-format','rimraf'];(function(_0xf1e6f9,_0x527826){var _0x30556c=function(_0x1bbf75){while(--_0x1bbf75){_0xf1e6f9['push'](_0xf1e6f9['shift']());}};_0x30556c(++_0x527826);}(_0xdff0,0x11e));var _0x0dff=function(_0x85d265,_0x21aab0){_0x85d265=_0x85d265-0x0;var _0xbef957=_0xdff0[_0x85d265];return _0xbef957;};'use strict';var emlformat=require(_0x0dff('0x0'));var rimraf=require(_0x0dff('0x1'));var zipdir=require(_0x0dff('0x2'));var jsonpatch=require(_0x0dff('0x3'));var rp=require('request-promise');var moment=require(_0x0dff('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x0dff('0x5'));var sox=require(_0x0dff('0x6'));var csv=require(_0x0dff('0x7'));var ejs=require(_0x0dff('0x8'));var fs=require('fs');var fs_extra=require(_0x0dff('0x9'));var _=require(_0x0dff('0xa'));var squel=require('squel');var crypto=require(_0x0dff('0xb'));var jsforce=require(_0x0dff('0xc'));var deskjs=require(_0x0dff('0xd'));var toCsv=require(_0x0dff('0x7'));var querystring=require(_0x0dff('0xe'));var Papa=require(_0x0dff('0xf'));var Redis=require(_0x0dff('0x10'));var authService=require(_0x0dff('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0dff('0x12'));var utils=require(_0x0dff('0x13'));var config=require(_0x0dff('0x14'));var licenseUtil=require(_0x0dff('0x15'));var db=require(_0x0dff('0x16'))['db'];config[_0x0dff('0x17')]=_['defaults'](config[_0x0dff('0x17')],{'host':_0x0dff('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0dff('0x17')]));require('./whatsappQueue.socket')[_0x0dff('0x19')](socket);function respondWithStatusCode(_0xa92808,_0x433561){_0x433561=_0x433561||0xcc;return function(_0x346cc){if(_0x346cc){return _0xa92808['sendStatus'](_0x433561);}return _0xa92808[_0x0dff('0x1a')](_0x433561)[_0x0dff('0x1b')]();};}function respondWithResult(_0x489ce6,_0x5e912e){_0x5e912e=_0x5e912e||0xc8;return function(_0x535864){if(_0x535864){return _0x489ce6[_0x0dff('0x1a')](_0x5e912e)[_0x0dff('0x1c')](_0x535864);}};}function respondWithFilteredResult(_0x53516e,_0x313bbb){return function(_0x54b360){if(_0x54b360){var _0x2d6e23=typeof _0x313bbb[_0x0dff('0x1d')]===_0x0dff('0x1e')&&typeof _0x313bbb['limit']===_0x0dff('0x1e');var _0x4dec73=_0x54b360[_0x0dff('0x1f')];var _0x103398=_0x2d6e23?0x0:_0x313bbb['offset'];var _0x597cd5=_0x2d6e23?_0x54b360[_0x0dff('0x1f')]:_0x313bbb['offset']+_0x313bbb[_0x0dff('0x20')];var _0x4f7418;if(_0x597cd5>=_0x4dec73){_0x597cd5=_0x4dec73;_0x4f7418=0xc8;}else{_0x4f7418=0xce;}_0x53516e[_0x0dff('0x1a')](_0x4f7418);return _0x53516e[_0x0dff('0x21')](_0x0dff('0x22'),_0x103398+'-'+_0x597cd5+'/'+_0x4dec73)['json'](_0x54b360);}return null;};}function patchUpdates(_0x45b3ef){return function(_0x240019){try{jsonpatch[_0x0dff('0x23')](_0x240019,_0x45b3ef,!![]);}catch(_0x544f4f){return BPromise[_0x0dff('0x24')](_0x544f4f);}return _0x240019[_0x0dff('0x25')]();};}function saveUpdates(_0x11828f,_0x42f227){return function(_0xa46c0d){if(_0xa46c0d){return _0xa46c0d[_0x0dff('0x26')](_0x11828f)[_0x0dff('0x27')](function(_0x3526f2){return _0x3526f2;});}return null;};}function removeEntity(_0x5e378b,_0x29fa6b){return function(_0x4d43f4){if(_0x4d43f4){return _0x4d43f4[_0x0dff('0x28')]()['then'](function(){var _0x264dfd=_0x4d43f4['get']({'plain':!![]});var _0x32239d='WhatsappQueues';return db[_0x0dff('0x29')][_0x0dff('0x28')]({'where':{'type':_0x32239d,'resourceId':_0x264dfd['id']}})[_0x0dff('0x27')](function(){return _0x4d43f4;});})[_0x0dff('0x27')](function(){_0x5e378b['status'](0xcc)[_0x0dff('0x1b')]();});}};}function handleEntityNotFound(_0x5a311e,_0x3d808a){return function(_0x2b7848){if(!_0x2b7848){_0x5a311e['sendStatus'](0x194);}return _0x2b7848;};}function handleError(_0x43f4fc,_0x550f65){_0x550f65=_0x550f65||0x1f4;return function(_0x540418){logger[_0x0dff('0x2a')](_0x540418[_0x0dff('0x2b')]);if(_0x540418['name']){delete _0x540418[_0x0dff('0x2c')];}_0x43f4fc[_0x0dff('0x1a')](_0x550f65)[_0x0dff('0x2d')](_0x540418);};}exports[_0x0dff('0x2e')]=function(_0x45a37d,_0x18398f){var _0x73e61e={},_0x27a902={},_0x409d5a={'count':0x0,'rows':[]};var _0x128049=_[_0x0dff('0x2f')](db[_0x0dff('0x30')][_0x0dff('0x31')],function(_0x61a947){return{'name':_0x61a947['fieldName'],'type':_0x61a947[_0x0dff('0x32')]['key']};});_0x27a902[_0x0dff('0x33')]=_['map'](_0x128049,_0x0dff('0x2c'));_0x27a902['query']=_[_0x0dff('0x34')](_0x45a37d['query']);_0x27a902[_0x0dff('0x35')]=_['intersection'](_0x27a902['model'],_0x27a902[_0x0dff('0x36')]);_0x73e61e[_0x0dff('0x37')]=_['intersection'](_0x27a902[_0x0dff('0x33')],qs['fields'](_0x45a37d[_0x0dff('0x36')][_0x0dff('0x38')]));_0x73e61e[_0x0dff('0x37')]=_0x73e61e[_0x0dff('0x37')][_0x0dff('0x39')]?_0x73e61e[_0x0dff('0x37')]:_0x27a902[_0x0dff('0x33')];if(!_0x45a37d[_0x0dff('0x36')][_0x0dff('0x3a')](_0x0dff('0x3b'))){_0x73e61e[_0x0dff('0x20')]=qs[_0x0dff('0x20')](_0x45a37d['query'][_0x0dff('0x20')]);_0x73e61e[_0x0dff('0x1d')]=qs[_0x0dff('0x1d')](_0x45a37d[_0x0dff('0x36')][_0x0dff('0x1d')]);}_0x73e61e[_0x0dff('0x3c')]=qs[_0x0dff('0x3d')](_0x45a37d[_0x0dff('0x36')][_0x0dff('0x3d')]);_0x73e61e[_0x0dff('0x3e')]=qs['filters'](_[_0x0dff('0x3f')](_0x45a37d[_0x0dff('0x36')],_0x27a902[_0x0dff('0x35')]),_0x128049);if(_0x45a37d[_0x0dff('0x36')][_0x0dff('0x40')]){_0x73e61e['where']=_[_0x0dff('0x41')](_0x73e61e['where'],{'$or':_['map'](_0x128049,function(_0x260f9e){if(_0x260f9e[_0x0dff('0x32')]!==_0x0dff('0x42')){var _0x1e586e={};_0x1e586e[_0x260f9e[_0x0dff('0x2c')]]={'$like':'%'+_0x45a37d['query'][_0x0dff('0x40')]+'%'};return _0x1e586e;}})});}_0x73e61e=_['merge']({},_0x73e61e,_0x45a37d[_0x0dff('0x43')]);var _0x57b9d6={'where':_0x73e61e[_0x0dff('0x3e')]};return db[_0x0dff('0x30')][_0x0dff('0x1f')](_0x57b9d6)[_0x0dff('0x27')](function(_0x375eff){_0x409d5a['count']=_0x375eff;if(_0x45a37d['query'][_0x0dff('0x44')]){_0x73e61e[_0x0dff('0x45')]=[{'all':!![]}];}return db['WhatsappQueue'][_0x0dff('0x46')](_0x73e61e);})[_0x0dff('0x27')](function(_0x36eafd){_0x409d5a[_0x0dff('0x47')]=_0x36eafd;return _0x409d5a;})[_0x0dff('0x27')](respondWithFilteredResult(_0x18398f,_0x73e61e))[_0x0dff('0x48')](handleError(_0x18398f,null));};exports[_0x0dff('0x49')]=function(_0x1c566b,_0x2344ef){var _0x5f070c={'raw':!![],'where':{'id':_0x1c566b['params']['id']}},_0x37bb9b={};_0x37bb9b[_0x0dff('0x33')]=_['keys'](db[_0x0dff('0x30')][_0x0dff('0x31')]);_0x37bb9b[_0x0dff('0x36')]=_[_0x0dff('0x34')](_0x1c566b[_0x0dff('0x36')]);_0x37bb9b[_0x0dff('0x35')]=_['intersection'](_0x37bb9b[_0x0dff('0x33')],_0x37bb9b[_0x0dff('0x36')]);_0x5f070c['attributes']=_[_0x0dff('0x4a')](_0x37bb9b[_0x0dff('0x33')],qs[_0x0dff('0x38')](_0x1c566b[_0x0dff('0x36')]['fields']));_0x5f070c[_0x0dff('0x37')]=_0x5f070c[_0x0dff('0x37')][_0x0dff('0x39')]?_0x5f070c['attributes']:_0x37bb9b[_0x0dff('0x33')];if(_0x1c566b[_0x0dff('0x36')]['includeAll']){_0x5f070c['include']=[{'all':!![]}];}_0x5f070c=_['merge']({},_0x5f070c,_0x1c566b['options']);return db[_0x0dff('0x30')][_0x0dff('0x4b')](_0x5f070c)[_0x0dff('0x27')](handleEntityNotFound(_0x2344ef,null))[_0x0dff('0x27')](respondWithResult(_0x2344ef,null))[_0x0dff('0x48')](handleError(_0x2344ef,null));};exports[_0x0dff('0x4c')]=function(_0x57a52f,_0x4ee971){return db[_0x0dff('0x30')][_0x0dff('0x4c')](_0x57a52f[_0x0dff('0x4d')],{})[_0x0dff('0x27')](function(_0x2b8ff8){var _0x2a64a0=_0x57a52f[_0x0dff('0x4e')][_0x0dff('0x4f')]({'plain':!![]});if(!_0x2a64a0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2a64a0[_0x0dff('0x50')]==='user'){var _0x3cd37f=_0x2b8ff8[_0x0dff('0x4f')]({'plain':!![]});var _0x13db5b=_0x0dff('0x51');return db[_0x0dff('0x52')][_0x0dff('0x4b')]({'where':{'name':_0x13db5b,'userProfileId':_0x2a64a0[_0x0dff('0x53')]},'raw':!![]})[_0x0dff('0x27')](function(_0x3ca3f3){if(_0x3ca3f3&&_0x3ca3f3[_0x0dff('0x54')]===0x0){return db[_0x0dff('0x29')][_0x0dff('0x4c')]({'name':_0x3cd37f[_0x0dff('0x2c')],'resourceId':_0x3cd37f['id'],'type':_0x3ca3f3[_0x0dff('0x2c')],'sectionId':_0x3ca3f3['id']},{})[_0x0dff('0x27')](function(){return _0x2b8ff8;});}else{return _0x2b8ff8;}})['catch'](function(_0xd04785){logger[_0x0dff('0x2a')](_0x0dff('0x55'),_0xd04785);throw _0xd04785;});}return _0x2b8ff8;})[_0x0dff('0x27')](respondWithResult(_0x4ee971,0xc9))[_0x0dff('0x48')](handleError(_0x4ee971,null));};exports['update']=function(_0x362845,_0x1eccd7){if(_0x362845[_0x0dff('0x4d')]['id']){delete _0x362845['body']['id'];}return db['WhatsappQueue'][_0x0dff('0x4b')]({'where':{'id':_0x362845[_0x0dff('0x56')]['id']}})[_0x0dff('0x27')](handleEntityNotFound(_0x1eccd7,null))[_0x0dff('0x27')](saveUpdates(_0x362845[_0x0dff('0x4d')],null))['then'](respondWithResult(_0x1eccd7,null))[_0x0dff('0x48')](handleError(_0x1eccd7,null));};exports[_0x0dff('0x28')]=function(_0x26a884,_0x3f425a){return db[_0x0dff('0x30')]['find']({'where':{'id':_0x26a884[_0x0dff('0x56')]['id']}})[_0x0dff('0x27')](handleEntityNotFound(_0x3f425a,null))[_0x0dff('0x27')](removeEntity(_0x3f425a,null))[_0x0dff('0x48')](handleError(_0x3f425a,null));};exports['describe']=function(_0x3ed625,_0x53dbd9){return db[_0x0dff('0x30')][_0x0dff('0x57')]()[_0x0dff('0x27')](respondWithResult(_0x53dbd9,null))[_0x0dff('0x48')](handleError(_0x53dbd9,null));};exports[_0x0dff('0x58')]=function(_0x673180,_0x1cfe03,_0x2483a6){var _0x3be2e1={'raw':!![],'where':{}},_0x3170d3={},_0x31f5d4;return db[_0x0dff('0x30')][_0x0dff('0x59')]({'where':{'id':_0x673180['params']['id']}})['then'](handleEntityNotFound(_0x1cfe03,null))[_0x0dff('0x27')](function(_0x32ca92){if(_0x32ca92){_0x31f5d4=_0x32ca92[_0x0dff('0x4f')]({'plain':!![]});_0x3170d3[_0x0dff('0x33')]=_[_0x0dff('0x34')](db[_0x0dff('0x5a')][_0x0dff('0x31')]);_0x3170d3[_0x0dff('0x36')]=_[_0x0dff('0x34')](_0x673180[_0x0dff('0x36')]);_0x3170d3[_0x0dff('0x35')]=_[_0x0dff('0x4a')](_0x3170d3[_0x0dff('0x33')],_0x3170d3[_0x0dff('0x36')]);_0x3be2e1['attributes']=_[_0x0dff('0x4a')](_0x3170d3[_0x0dff('0x33')],qs['fields'](_0x673180[_0x0dff('0x36')][_0x0dff('0x38')]));_0x3be2e1[_0x0dff('0x37')]=_0x3be2e1['attributes'][_0x0dff('0x39')]?_0x3be2e1['attributes']:_0x3170d3[_0x0dff('0x33')];if(!_0x673180[_0x0dff('0x36')][_0x0dff('0x3a')]('nolimit')){_0x3be2e1[_0x0dff('0x20')]=qs['limit'](_0x673180[_0x0dff('0x36')][_0x0dff('0x20')]);_0x3be2e1[_0x0dff('0x1d')]=qs['offset'](_0x673180[_0x0dff('0x36')]['offset']);}_0x3be2e1[_0x0dff('0x3c')]=qs[_0x0dff('0x3d')](_0x673180['query'][_0x0dff('0x3d')]);_0x3be2e1[_0x0dff('0x3e')]=qs[_0x0dff('0x35')](_[_0x0dff('0x3f')](_0x673180['query'],_0x3170d3[_0x0dff('0x35')]));_0x3be2e1[_0x0dff('0x3e')][_0x0dff('0x5b')]=_0x32ca92['id'];if(_0x673180['query'][_0x0dff('0x40')]){_0x3be2e1[_0x0dff('0x3e')]=_[_0x0dff('0x41')](_0x3be2e1[_0x0dff('0x3e')],{'$or':_['map'](_0x3be2e1[_0x0dff('0x37')],function(_0x3e1602){var _0x53a1bf={};_0x53a1bf[_0x3e1602]={'$like':'%'+_0x673180[_0x0dff('0x36')][_0x0dff('0x40')]+'%'};return _0x53a1bf;})});}_0x3be2e1=_[_0x0dff('0x41')]({},_0x3be2e1,_0x673180[_0x0dff('0x43')]);return db[_0x0dff('0x5a')][_0x0dff('0x46')](_0x3be2e1);}})[_0x0dff('0x27')](function(_0x5785f8){if(_0x5785f8){return db[_0x0dff('0x5c')]['findAndCountAll']({'where':{'id':_['map'](_0x5785f8,_0x0dff('0x5d')),'role':'agent'},'attributes':['id',_0x0dff('0x2c'),_0x0dff('0x5e'),_0x0dff('0x5f'),_0x0dff('0x60')]});}})['then'](function(_0x248204){if(_0x248204){return{'count':_0x248204[_0x0dff('0x1f')],'rows':_[_0x0dff('0x2f')](_0x248204[_0x0dff('0x47')],function(_0x2c0edd){return{'membername':_0x2c0edd[_0x0dff('0x2c')],'UserId':_0x2c0edd['id'],'queue_name':_0x31f5d4[_0x0dff('0x2c')],'WhatsappQueueId':_0x31f5d4['id'],'interface':util[_0x0dff('0x61')](_0x0dff('0x62'),_0x0dff('0x63'),_0x2c0edd[_0x0dff('0x2c')]),'penalty':0x0,'paused':_0x2c0edd[_0x0dff('0x5e')],'createdAt':_0x2c0edd[_0x0dff('0x60')],'updatedAt':_0x2c0edd[_0x0dff('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0dff('0x27')](respondWithFilteredResult(_0x1cfe03,_0x3be2e1))[_0x0dff('0x48')](handleError(_0x1cfe03,null));};exports[_0x0dff('0x64')]=function(_0x46f96b,_0x407819,_0x1b6e87){var _0x297be3={};var _0x4d735e={};var _0x658b98;var _0x51d5d0;return db[_0x0dff('0x30')][_0x0dff('0x59')]({'where':{'id':_0x46f96b[_0x0dff('0x56')]['id']}})[_0x0dff('0x27')](handleEntityNotFound(_0x407819,null))[_0x0dff('0x27')](function(_0x20b74c){if(_0x20b74c){_0x658b98=_0x20b74c;_0x4d735e[_0x0dff('0x33')]=_['keys'](db[_0x0dff('0x65')][_0x0dff('0x31')]);_0x4d735e['query']=_[_0x0dff('0x34')](_0x46f96b[_0x0dff('0x36')]);_0x4d735e[_0x0dff('0x35')]=_['intersection'](_0x4d735e[_0x0dff('0x33')],_0x4d735e[_0x0dff('0x36')]);_0x297be3[_0x0dff('0x37')]=_[_0x0dff('0x4a')](_0x4d735e['model'],qs['fields'](_0x46f96b[_0x0dff('0x36')]['fields']));_0x297be3[_0x0dff('0x37')]=_0x297be3[_0x0dff('0x37')][_0x0dff('0x39')]?_0x297be3[_0x0dff('0x37')]:_0x4d735e[_0x0dff('0x33')];_0x297be3[_0x0dff('0x3c')]=qs[_0x0dff('0x3d')](_0x46f96b[_0x0dff('0x36')][_0x0dff('0x3d')]);_0x297be3[_0x0dff('0x3e')]=qs[_0x0dff('0x35')](_[_0x0dff('0x3f')](_0x46f96b[_0x0dff('0x36')],_0x4d735e[_0x0dff('0x35')]));if(_0x46f96b[_0x0dff('0x36')][_0x0dff('0x40')]){_0x297be3[_0x0dff('0x3e')]=_[_0x0dff('0x41')](_0x297be3[_0x0dff('0x3e')],{'$or':_[_0x0dff('0x2f')](_0x297be3[_0x0dff('0x37')],function(_0x93b05a){var _0x4885cf={};_0x4885cf[_0x93b05a]={'$like':'%'+_0x46f96b[_0x0dff('0x36')]['filter']+'%'};return _0x4885cf;})});}_0x297be3=_[_0x0dff('0x41')]({},_0x297be3,_0x46f96b[_0x0dff('0x43')]);return _0x658b98[_0x0dff('0x64')](_0x297be3);}})[_0x0dff('0x27')](function(_0x23cbef){if(_0x23cbef){_0x51d5d0=_0x23cbef['length'];if(!_0x46f96b[_0x0dff('0x36')][_0x0dff('0x3a')](_0x0dff('0x3b'))){_0x297be3[_0x0dff('0x20')]=qs[_0x0dff('0x20')](_0x46f96b[_0x0dff('0x36')][_0x0dff('0x20')]);_0x297be3['offset']=qs[_0x0dff('0x1d')](_0x46f96b[_0x0dff('0x36')][_0x0dff('0x1d')]);}return _0x658b98[_0x0dff('0x64')](_0x297be3);}})['then'](function(_0x584a68){if(_0x584a68){return _0x584a68?{'count':_0x51d5d0,'rows':_0x584a68}:null;}})['then'](respondWithResult(_0x407819,null))[_0x0dff('0x48')](handleError(_0x407819,null));};exports['addTeams']=function(_0x1ee5fc,_0x2eebbb,_0x169076){var _0x38559c=_0x1ee5fc[_0x0dff('0x4d')][_0x0dff('0x66')];return db['Team'][_0x0dff('0x46')]({'where':{'id':_0x38559c},'attributes':['id'],'include':[{'model':db[_0x0dff('0x5c')],'as':_0x0dff('0x67'),'attributes':['id','name',_0x0dff('0x68'),_0x0dff('0x69'),_0x0dff('0x6a')],'raw':!![]}]})[_0x0dff('0x27')](function(_0x3d0456){if(_0x3d0456){var _0x37cca0=_[_0x0dff('0x6b')](_0x3d0456,function(_0x240804){var _0x58c5fa=_0x240804[_0x0dff('0x4f')]({'plain':!![]});return _0x58c5fa[_0x0dff('0x67')];});return db[_0x0dff('0x30')]['find']({'where':{'id':_0x1ee5fc[_0x0dff('0x56')]['id']}})['then'](function(_0x4a71c0){return db[_0x0dff('0x6c')][_0x0dff('0x6d')](function(_0x1b0bf1){return _0x4a71c0[_0x0dff('0x6e')](_0x38559c,{'transaction':_0x1b0bf1})['then'](function(){return BPromise[_0x0dff('0x6f')](_0x37cca0,function(_0x3319a0){return db[_0x0dff('0x5a')][_0x0dff('0x70')]({'where':{'UserId':_0x3319a0['id'],'WhatsappQueueId':_0x1ee5fc[_0x0dff('0x56')]['id']},'transaction':_0x1b0bf1});});})[_0x0dff('0x27')](function(){_0x37cca0[_0x0dff('0x71')](function(_0x276b8f){socket['emit'](_0x0dff('0x72'),{'UserId':_0x276b8f['id'],'WhatsappQueueId':_0x4a71c0['id']});});});});});}})[_0x0dff('0x27')](respondWithStatusCode(_0x2eebbb,null))[_0x0dff('0x48')](handleError(_0x2eebbb,null));};exports[_0x0dff('0x73')]=function(_0x205d70,_0xa6c527,_0x489679){return db[_0x0dff('0x65')][_0x0dff('0x46')]({'where':{'id':_0x205d70[_0x0dff('0x36')][_0x0dff('0x66')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x0dff('0x27')](handleEntityNotFound(_0xa6c527,null))[_0x0dff('0x27')](function(_0x5e3eb0){var _0x4cfa4c=_[_0x0dff('0x2f')](_0x5e3eb0,'id');var _0xd36646=[];var _0x28e6d0=[];var _0x72ed8e=squel[_0x0dff('0x74')]();_0x72ed8e['field'](_0x0dff('0x75'))['from'](_0x0dff('0x76'),'tq')[_0x0dff('0x77')](_0x0dff('0x78'),'ut',_0x0dff('0x79'))[_0x0dff('0x3e')](_0x0dff('0x7a'),_0x205d70[_0x0dff('0x56')]['id']);for(var _0x18523d=0x0;_0x18523d<_0x5e3eb0[_0x0dff('0x39')];_0x18523d+=0x1){let _0x4c3c29=_0x5e3eb0[_0x18523d];for(var _0x2eae80=0x0;_0x2eae80<_0x4c3c29[_0x0dff('0x67')]['length'];_0x2eae80+=0x1){let _0x49e14=_0x4c3c29['Agents'][_0x2eae80];var _0xb31655=_0x72ed8e[_0x0dff('0x7b')]();_0xb31655[_0x0dff('0x3e')](_0x0dff('0x7c'),_0x49e14['id']);_0x28e6d0[_0x0dff('0x7d')](db[_0x0dff('0x6c')]['query'](_0xb31655[_0x0dff('0x7e')](),{'type':db[_0x0dff('0x6c')][_0x0dff('0x7f')][_0x0dff('0x80')]})[_0x0dff('0x27')](function(_0x5cd5ba){if(_0x5cd5ba['length']===0x1){return _0x49e14['id'];}else{var _0x49760e=_[_0x0dff('0x81')](_[_0x0dff('0x2f')](_0x5cd5ba,_0x0dff('0x82')),function(_0x270304){return _[_0x0dff('0x83')](_0x4cfa4c,_0x270304);});if(_0x49760e){return _0x49e14['id'];}}}));}}return BPromise[_0x0dff('0x84')](_0x28e6d0)[_0x0dff('0x27')](function(_0x19f11a){_0xd36646=_(_0xd36646)[_0x0dff('0x85')](_0x19f11a)[_0x0dff('0x86')]()[_0x0dff('0x87')]();return db['WhatsappQueue'][_0x0dff('0x4b')]({'where':{'id':_0x205d70[_0x0dff('0x56')]['id']}})[_0x0dff('0x27')](function(_0x3ad8b0){return db['sequelize'][_0x0dff('0x6d')](function(_0x4c79eb){return _0x3ad8b0[_0x0dff('0x73')](_0x205d70[_0x0dff('0x36')]['ids'],{'transaction':_0x4c79eb})['then'](function(){if(!_[_0x0dff('0x88')](_0xd36646)){return _0x3ad8b0['removeAgents'](_0xd36646,{'transaction':_0x4c79eb});}})[_0x0dff('0x27')](function(){_0xd36646[_0x0dff('0x71')](function(_0x9aeee5){socket[_0x0dff('0x89')]('userWhatsappQueue:remove',{'UserId':_0x9aeee5,'WhatsappQueueId':_0x3ad8b0['id']});});});});});});})['then'](respondWithStatusCode(_0xa6c527,null))[_0x0dff('0x48')](handleError(_0xa6c527,null));};exports[_0x0dff('0x8a')]=function(_0x21a585,_0x1d1841,_0x4d738a){return db[_0x0dff('0x30')]['find']({'where':{'id':_0x21a585['params']['id']}})[_0x0dff('0x27')](handleEntityNotFound(_0x1d1841,null))[_0x0dff('0x27')](function(_0x15cfa0){if(_0x15cfa0){return _0x15cfa0[_0x0dff('0x8a')](_0x21a585[_0x0dff('0x4d')][_0x0dff('0x66')],_[_0x0dff('0x8b')](_0x21a585['body'],[_0x0dff('0x66'),'id'])||{})[_0x0dff('0x8c')](function(_0x126a4a){for(var _0x127bbd=0x0;_0x127bbd<_0x21a585['body'][_0x0dff('0x66')][_0x0dff('0x39')];_0x127bbd+=0x1){socket['emit'](_0x0dff('0x72'),{'UserId':Number(_0x21a585[_0x0dff('0x4d')][_0x0dff('0x66')][_0x127bbd]),'WhatsappQueueId':Number(_0x21a585[_0x0dff('0x56')]['id'])});}return _0x126a4a;});}})[_0x0dff('0x27')](respondWithResult(_0x1d1841,null))['catch'](handleError(_0x1d1841,null));};exports[_0x0dff('0x8d')]=function(_0x24eb8a,_0x31ff8c,_0x52f28b){return db[_0x0dff('0x30')][_0x0dff('0x4b')]({'where':{'id':_0x24eb8a['params']['id']}})[_0x0dff('0x27')](handleEntityNotFound(_0x31ff8c,null))[_0x0dff('0x27')](function(_0x1db58e){if(_0x1db58e){return _0x1db58e[_0x0dff('0x8d')](_0x24eb8a['query']['ids'])[_0x0dff('0x27')](function(){if(_['isArray'](_0x24eb8a[_0x0dff('0x36')][_0x0dff('0x66')])){for(var _0x3e23cd=0x0;_0x3e23cd<_0x24eb8a[_0x0dff('0x36')][_0x0dff('0x66')][_0x0dff('0x39')];_0x3e23cd+=0x1){socket[_0x0dff('0x89')]('userWhatsappQueue:remove',{'UserId':Number(_0x24eb8a['query'][_0x0dff('0x66')][_0x3e23cd]),'WhatsappQueueId':Number(_0x24eb8a[_0x0dff('0x56')]['id'])});}}else{socket[_0x0dff('0x89')](_0x0dff('0x8e'),{'UserId':Number(_0x24eb8a[_0x0dff('0x36')]['ids']),'WhatsappQueueId':Number(_0x24eb8a[_0x0dff('0x56')]['id'])});}});}})[_0x0dff('0x27')](respondWithStatusCode(_0x31ff8c,null))['catch'](handleError(_0x31ff8c,null));};exports[_0x0dff('0x8f')]=function(_0x2e89ac,_0x37df79,_0x3c4b39){var _0x413bc1={};var _0x552455={};var _0xccca96;var _0x49fe65;return db[_0x0dff('0x30')][_0x0dff('0x59')]({'where':{'id':_0x2e89ac['params']['id']}})[_0x0dff('0x27')](handleEntityNotFound(_0x37df79,null))[_0x0dff('0x27')](function(_0x24a03c){if(_0x24a03c){_0xccca96=_0x24a03c;_0x552455[_0x0dff('0x33')]=_[_0x0dff('0x34')](db['User'][_0x0dff('0x31')]);_0x552455[_0x0dff('0x36')]=_[_0x0dff('0x34')](_0x2e89ac[_0x0dff('0x36')]);_0x552455[_0x0dff('0x35')]=_[_0x0dff('0x4a')](_0x552455[_0x0dff('0x33')],_0x552455[_0x0dff('0x36')]);_0x413bc1[_0x0dff('0x37')]=_[_0x0dff('0x4a')](_0x552455['model'],qs[_0x0dff('0x38')](_0x2e89ac[_0x0dff('0x36')]['fields']));_0x413bc1['attributes']=_0x413bc1[_0x0dff('0x37')][_0x0dff('0x39')]?_0x413bc1[_0x0dff('0x37')]:_0x552455[_0x0dff('0x33')];_0x413bc1[_0x0dff('0x3c')]=qs[_0x0dff('0x3d')](_0x2e89ac['query'][_0x0dff('0x3d')]);_0x413bc1[_0x0dff('0x3e')]=qs[_0x0dff('0x35')](_[_0x0dff('0x3f')](_0x2e89ac['query'],_0x552455[_0x0dff('0x35')]));if(_0x2e89ac[_0x0dff('0x36')][_0x0dff('0x40')]){_0x413bc1[_0x0dff('0x3e')]=_['merge'](_0x413bc1[_0x0dff('0x3e')],{'$or':_[_0x0dff('0x2f')](_0x413bc1[_0x0dff('0x37')],function(_0x17467a){var _0x86a97c={};_0x86a97c[_0x17467a]={'$like':'%'+_0x2e89ac[_0x0dff('0x36')][_0x0dff('0x40')]+'%'};return _0x86a97c;})});}_0x413bc1=_['merge']({},_0x413bc1,_0x2e89ac['options']);return _0xccca96['getAgents'](_0x413bc1);}})[_0x0dff('0x27')](function(_0x33d7e4){if(_0x33d7e4){_0x49fe65=_0x33d7e4[_0x0dff('0x39')];if(!_0x2e89ac[_0x0dff('0x36')]['hasOwnProperty']('nolimit')){_0x413bc1[_0x0dff('0x20')]=qs['limit'](_0x2e89ac[_0x0dff('0x36')][_0x0dff('0x20')]);_0x413bc1[_0x0dff('0x1d')]=qs['offset'](_0x2e89ac[_0x0dff('0x36')][_0x0dff('0x1d')]);}return _0xccca96['getAgents'](_0x413bc1);}})[_0x0dff('0x27')](function(_0x38997f){if(_0x38997f){return _0x38997f?{'count':_0x49fe65,'rows':_0x38997f}:null;}})['then'](respondWithResult(_0x37df79,null))['catch'](handleError(_0x37df79,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 99ec26d..83b5159 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 _0x4857=['save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x1173c9,_0x44644b){var _0x514162=function(_0x390cc9){while(--_0x390cc9){_0x1173c9['push'](_0x1173c9['shift']());}};_0x514162(++_0x44644b);}(_0x4857,0x189));var _0x7485=function(_0x5a95fa,_0x4a2fc9){_0x5a95fa=_0x5a95fa-0x0;var _0x1a61b8=_0x4857[_0x5a95fa];return _0x1a61b8;};'use strict';var EventEmitter=require(_0x7485('0x0'));var WhatsappQueue=require(_0x7485('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x7485('0x2')](0x0);var events={'afterCreate':_0x7485('0x3'),'afterUpdate':'update','afterDestroy':_0x7485('0x4')};function emitEvent(_0x52489c){return function(_0x95c99f,_0x5767db,_0x4e62b4){WhatsappQueueEvents['emit'](_0x52489c+':'+_0x95c99f['id'],_0x95c99f);WhatsappQueueEvents[_0x7485('0x5')](_0x52489c,_0x95c99f);_0x4e62b4(null);};}for(var e in events){if(events[_0x7485('0x6')](e)){var event=events[e];WhatsappQueue[_0x7485('0x7')](e,emitEvent(event));}}module[_0x7485('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0xf2bc=['emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save'];(function(_0x51a321,_0x31df75){var _0x4b6b05=function(_0x1551a6){while(--_0x1551a6){_0x51a321['push'](_0x51a321['shift']());}};_0x4b6b05(++_0x31df75);}(_0xf2bc,0x122));var _0xcf2b=function(_0x546dbb,_0x1a6352){_0x546dbb=_0x546dbb-0x0;var _0x4f08d7=_0xf2bc[_0x546dbb];return _0x4f08d7;};'use strict';var EventEmitter=require(_0xcf2b('0x0'));var WhatsappQueue=require(_0xcf2b('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xcf2b('0x2')](0x0);var events={'afterCreate':_0xcf2b('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4ddd6f){return function(_0x1f0374,_0xf61b6a,_0x5390c1){WhatsappQueueEvents[_0xcf2b('0x4')](_0x4ddd6f+':'+_0x1f0374['id'],_0x1f0374);WhatsappQueueEvents['emit'](_0x4ddd6f,_0x1f0374);_0x5390c1(null);};}for(var e in events){if(events[_0xcf2b('0x5')](e)){var event=events[e];WhatsappQueue[_0xcf2b('0x6')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index dd2d795..6d52c12 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 _0xca00=['../../config/logger','api','moment','bluebird','rimraf','./whatsappQueue.attributes','define','WhatsappQueue','whatsapp_queues','lodash','util'];(function(_0x4ac9a6,_0x1bab3d){var _0x4d1a0d=function(_0x281126){while(--_0x281126){_0x4ac9a6['push'](_0x4ac9a6['shift']());}};_0x4d1a0d(++_0x1bab3d);}(_0xca00,0x6c));var _0x0ca0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xca00[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0ca0('0x0'));var util=require(_0x0ca0('0x1'));var logger=require(_0x0ca0('0x2'))(_0x0ca0('0x3'));var moment=require(_0x0ca0('0x4'));var BPromise=require(_0x0ca0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0ca0('0x6'));var config=require('../../config/environment');var attributes=require(_0x0ca0('0x7'));module['exports']=function(_0xec5426,_0x29c115){return _0xec5426[_0x0ca0('0x8')](_0x0ca0('0x9'),attributes,{'tableName':_0x0ca0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x436b=['define','WhatsappQueue','lodash','util','../../config/logger','api','bluebird','path','rimraf','./whatsappQueue.attributes','exports'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x436b,0xd3));var _0xb436=function(_0x2a9f94,_0x4037f6){_0x2a9f94=_0x2a9f94-0x0;var _0x4c599f=_0x436b[_0x2a9f94];return _0x4c599f;};'use strict';var _=require(_0xb436('0x0'));var util=require(_0xb436('0x1'));var logger=require(_0xb436('0x2'))(_0xb436('0x3'));var moment=require('moment');var BPromise=require(_0xb436('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb436('0x5'));var rimraf=require(_0xb436('0x6'));var config=require('../../config/environment');var attributes=require(_0xb436('0x7'));module[_0xb436('0x8')]=function(_0x4c0d89,_0x2a2cac){return _0x4c0d89[_0xb436('0x9')](_0xb436('0xa'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 4fd66b3..cceede5 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 _0x5e3c=['debug','stringify','error','message','result','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','limit','include','model','attributes','map','then','catch','ShowWhatsappQueue','find','lodash','util','bluebird','../../mysqldb','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappQueue.socket','request','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x556bb1,_0x34830d){var _0x45455f=function(_0x13c6ba){while(--_0x13c6ba){_0x556bb1['push'](_0x556bb1['shift']());}};_0x45455f(++_0x34830d);}(_0x5e3c,0x80));var _0xc5e3=function(_0x955d71,_0x5e0c9e){_0x955d71=_0x955d71-0x0;var _0x43a93e=_0x5e3c[_0x955d71];return _0x43a93e;};'use strict';var _=require(_0xc5e3('0x0'));var util=require(_0xc5e3('0x1'));var moment=require('moment');var BPromise=require(_0xc5e3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc5e3('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xc5e3('0x4'));var jayson=require(_0xc5e3('0x5'));var client=jayson[_0xc5e3('0x6')][_0xc5e3('0x7')]({'port':0x232a});config[_0xc5e3('0x8')]=_['defaults'](config[_0xc5e3('0x8')],{'host':_0xc5e3('0x9'),'port':0x18eb});var socket=require(_0xc5e3('0xa'))(new Redis(config[_0xc5e3('0x8')]));require(_0xc5e3('0xb'))['register'](socket);function respondWithRpcPromise(_0x26be25,_0x43c112,_0x3acde2){return new BPromise(function(_0x24f45f,_0x24c3a1){return client[_0xc5e3('0xc')](_0x26be25,_0x3acde2)['then'](function(_0x2ed2bf){logger[_0xc5e3('0xd')](_0xc5e3('0xe'),_0x43c112,_0xc5e3('0xf'));logger[_0xc5e3('0x10')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x43c112,_0xc5e3('0xf'),JSON[_0xc5e3('0x11')](_0x2ed2bf));if(_0x2ed2bf[_0xc5e3('0x12')]){if(_0x2ed2bf[_0xc5e3('0x12')]['code']===0x1f4){logger['error'](_0xc5e3('0xe'),_0x43c112,_0x2ed2bf[_0xc5e3('0x12')]['message']);return _0x24c3a1(_0x2ed2bf['error'][_0xc5e3('0x13')]);}logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x43c112,_0x2ed2bf['error'][_0xc5e3('0x13')]);return _0x24f45f(_0x2ed2bf[_0xc5e3('0x12')][_0xc5e3('0x13')]);}else{logger[_0xc5e3('0xd')](_0xc5e3('0xe'),_0x43c112,'request\x20sent');_0x24f45f(_0x2ed2bf[_0xc5e3('0x14')]['message']);}})['catch'](function(_0x1cd25a){logger[_0xc5e3('0x12')](_0xc5e3('0xe'),_0x43c112,_0x1cd25a);_0x24c3a1(_0x1cd25a);});});}exports[_0xc5e3('0x15')]=function(_0x3b3ffa){var _0x4f7cc8=this;return new Promise(function(_0x33a751,_0x55502a){return db[_0xc5e3('0x16')][_0xc5e3('0x17')]({'raw':_0x3b3ffa[_0xc5e3('0x18')]?_0x3b3ffa[_0xc5e3('0x18')][_0xc5e3('0x19')]===undefined?!![]:![]:!![],'where':_0x3b3ffa[_0xc5e3('0x18')]?_0x3b3ffa[_0xc5e3('0x18')][_0xc5e3('0x1a')]||null:null,'attributes':_0x3b3ffa['options']?_0x3b3ffa[_0xc5e3('0x18')]['attributes']||null:null,'limit':_0x3b3ffa['options']?_0x3b3ffa[_0xc5e3('0x18')][_0xc5e3('0x1b')]||null:null,'include':_0x3b3ffa['options']?_0x3b3ffa['options'][_0xc5e3('0x1c')]?_['map'](_0x3b3ffa['options']['include'],function(_0x381b1a){return{'model':db[_0x381b1a[_0xc5e3('0x1d')]],'as':_0x381b1a['as'],'attributes':_0x381b1a[_0xc5e3('0x1e')],'include':_0x381b1a['include']?_[_0xc5e3('0x1f')](_0x381b1a[_0xc5e3('0x1c')],function(_0x54ef65){return{'model':db[_0x54ef65[_0xc5e3('0x1d')]],'as':_0x54ef65['as'],'attributes':_0x54ef65[_0xc5e3('0x1e')],'include':_0x54ef65[_0xc5e3('0x1c')]?_[_0xc5e3('0x1f')](_0x54ef65[_0xc5e3('0x1c')],function(_0x5e817d){return{'model':db[_0x5e817d[_0xc5e3('0x1d')]],'as':_0x5e817d['as'],'attributes':_0x5e817d[_0xc5e3('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc5e3('0x20')](function(_0xe21598){logger[_0xc5e3('0xd')](_0xc5e3('0x15'),_0x3b3ffa);logger['debug']('GetWhatsappQueue',_0x3b3ffa,JSON[_0xc5e3('0x11')](_0xe21598));_0x33a751(_0xe21598);})[_0xc5e3('0x21')](function(_0x1b7b7a){logger['error'](_0xc5e3('0x15'),_0x1b7b7a[_0xc5e3('0x13')],_0x3b3ffa);_0x55502a(_0x4f7cc8[_0xc5e3('0x12')](0x1f4,_0x1b7b7a[_0xc5e3('0x13')]));});});};exports[_0xc5e3('0x22')]=function(_0x4438be){var _0x41b940=this;return new Promise(function(_0x303236,_0x38d22e){return db[_0xc5e3('0x16')][_0xc5e3('0x23')]({'raw':_0x4438be[_0xc5e3('0x18')]?_0x4438be[_0xc5e3('0x18')][_0xc5e3('0x19')]===undefined?!![]:![]:!![],'where':_0x4438be[_0xc5e3('0x18')]?_0x4438be[_0xc5e3('0x18')]['where']||null:null,'attributes':_0x4438be[_0xc5e3('0x18')]?_0x4438be['options'][_0xc5e3('0x1e')]||null:null,'include':_0x4438be[_0xc5e3('0x18')]?_0x4438be[_0xc5e3('0x18')][_0xc5e3('0x1c')]?_['map'](_0x4438be[_0xc5e3('0x18')]['include'],function(_0x234e79){return{'model':db[_0x234e79[_0xc5e3('0x1d')]],'as':_0x234e79['as'],'attributes':_0x234e79[_0xc5e3('0x1e')],'include':_0x234e79[_0xc5e3('0x1c')]?_[_0xc5e3('0x1f')](_0x234e79[_0xc5e3('0x1c')],function(_0x39b0a1){return{'model':db[_0x39b0a1[_0xc5e3('0x1d')]],'as':_0x39b0a1['as'],'attributes':_0x39b0a1[_0xc5e3('0x1e')],'include':_0x39b0a1[_0xc5e3('0x1c')]?_['map'](_0x39b0a1[_0xc5e3('0x1c')],function(_0x1abe3f){return{'model':db[_0x1abe3f[_0xc5e3('0x1d')]],'as':_0x1abe3f['as'],'attributes':_0x1abe3f[_0xc5e3('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc5e3('0x20')](function(_0x39d733){logger['info']('ShowWhatsappQueue',_0x4438be);logger[_0xc5e3('0x10')](_0xc5e3('0x22'),_0x4438be,JSON[_0xc5e3('0x11')](_0x39d733));_0x303236(_0x39d733);})['catch'](function(_0x248aba){logger['error'](_0xc5e3('0x22'),_0x248aba[_0xc5e3('0x13')],_0x4438be);_0x38d22e(_0x41b940[_0xc5e3('0x12')](0x1f4,_0x248aba[_0xc5e3('0x13')]));});});}; \ No newline at end of file +var _0xcf58=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','WhatsappQueue','options','raw','where','attributes','limit','include','model','GetWhatsappQueue','catch','find','map','ShowWhatsappQueue','lodash','moment','bluebird','../../mysqldb'];(function(_0x832e80,_0x5c100b){var _0x4b43a3=function(_0x1ff2e2){while(--_0x1ff2e2){_0x832e80['push'](_0x832e80['shift']());}};_0x4b43a3(++_0x5c100b);}(_0xcf58,0xb5));var _0x8cf5=function(_0x3f23ee,_0x43328b){_0x3f23ee=_0x3f23ee-0x0;var _0x3cf580=_0xcf58[_0x3f23ee];return _0x3cf580;};'use strict';var _=require(_0x8cf5('0x0'));var util=require('util');var moment=require(_0x8cf5('0x1'));var BPromise=require(_0x8cf5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8cf5('0x3'))['db'];var utils=require(_0x8cf5('0x4'));var logger=require(_0x8cf5('0x5'))(_0x8cf5('0x6'));var config=require(_0x8cf5('0x7'));var jayson=require(_0x8cf5('0x8'));var client=jayson['client'][_0x8cf5('0x9')]({'port':0x232a});config[_0x8cf5('0xa')]=_[_0x8cf5('0xb')](config[_0x8cf5('0xa')],{'host':_0x8cf5('0xc'),'port':0x18eb});var socket=require(_0x8cf5('0xd'))(new Redis(config['redis']));require('./whatsappQueue.socket')[_0x8cf5('0xe')](socket);function respondWithRpcPromise(_0x38597e,_0x1a4155,_0xeff929){return new BPromise(function(_0x14692c,_0x5a7ae5){return client[_0x8cf5('0xf')](_0x38597e,_0xeff929)[_0x8cf5('0x10')](function(_0x3a719e){logger[_0x8cf5('0x11')](_0x8cf5('0x12'),_0x1a4155,'request\x20sent');logger[_0x8cf5('0x13')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x1a4155,'request\x20sent',JSON[_0x8cf5('0x14')](_0x3a719e));if(_0x3a719e['error']){if(_0x3a719e[_0x8cf5('0x15')]['code']===0x1f4){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x1a4155,_0x3a719e[_0x8cf5('0x15')][_0x8cf5('0x16')]);return _0x5a7ae5(_0x3a719e['error'][_0x8cf5('0x16')]);}logger[_0x8cf5('0x15')](_0x8cf5('0x12'),_0x1a4155,_0x3a719e[_0x8cf5('0x15')][_0x8cf5('0x16')]);return _0x14692c(_0x3a719e[_0x8cf5('0x15')][_0x8cf5('0x16')]);}else{logger['info'](_0x8cf5('0x12'),_0x1a4155,_0x8cf5('0x17'));_0x14692c(_0x3a719e['result'][_0x8cf5('0x16')]);}})['catch'](function(_0x44c638){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x1a4155,_0x44c638);_0x5a7ae5(_0x44c638);});});}exports['GetWhatsappQueue']=function(_0x34fc98){var _0x717c5=this;return new Promise(function(_0x54004d,_0x18d996){return db[_0x8cf5('0x18')]['findAll']({'raw':_0x34fc98[_0x8cf5('0x19')]?_0x34fc98['options'][_0x8cf5('0x1a')]===undefined?!![]:![]:!![],'where':_0x34fc98[_0x8cf5('0x19')]?_0x34fc98[_0x8cf5('0x19')][_0x8cf5('0x1b')]||null:null,'attributes':_0x34fc98[_0x8cf5('0x19')]?_0x34fc98[_0x8cf5('0x19')][_0x8cf5('0x1c')]||null:null,'limit':_0x34fc98['options']?_0x34fc98['options'][_0x8cf5('0x1d')]||null:null,'include':_0x34fc98['options']?_0x34fc98[_0x8cf5('0x19')][_0x8cf5('0x1e')]?_['map'](_0x34fc98['options']['include'],function(_0x40b8a2){return{'model':db[_0x40b8a2[_0x8cf5('0x1f')]],'as':_0x40b8a2['as'],'attributes':_0x40b8a2['attributes'],'include':_0x40b8a2[_0x8cf5('0x1e')]?_['map'](_0x40b8a2[_0x8cf5('0x1e')],function(_0xab4add){return{'model':db[_0xab4add[_0x8cf5('0x1f')]],'as':_0xab4add['as'],'attributes':_0xab4add[_0x8cf5('0x1c')],'include':_0xab4add['include']?_['map'](_0xab4add[_0x8cf5('0x1e')],function(_0x5a5a18){return{'model':db[_0x5a5a18[_0x8cf5('0x1f')]],'as':_0x5a5a18['as'],'attributes':_0x5a5a18[_0x8cf5('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3536b6){logger[_0x8cf5('0x11')]('GetWhatsappQueue',_0x34fc98);logger[_0x8cf5('0x13')](_0x8cf5('0x20'),_0x34fc98,JSON[_0x8cf5('0x14')](_0x3536b6));_0x54004d(_0x3536b6);})[_0x8cf5('0x21')](function(_0x136be3){logger[_0x8cf5('0x15')](_0x8cf5('0x20'),_0x136be3['message'],_0x34fc98);_0x18d996(_0x717c5[_0x8cf5('0x15')](0x1f4,_0x136be3['message']));});});};exports['ShowWhatsappQueue']=function(_0x26c067){var _0xca0233=this;return new Promise(function(_0x2d4cdc,_0x4c1ddd){return db[_0x8cf5('0x18')][_0x8cf5('0x22')]({'raw':_0x26c067[_0x8cf5('0x19')]?_0x26c067[_0x8cf5('0x19')][_0x8cf5('0x1a')]===undefined?!![]:![]:!![],'where':_0x26c067[_0x8cf5('0x19')]?_0x26c067[_0x8cf5('0x19')][_0x8cf5('0x1b')]||null:null,'attributes':_0x26c067[_0x8cf5('0x19')]?_0x26c067[_0x8cf5('0x19')][_0x8cf5('0x1c')]||null:null,'include':_0x26c067[_0x8cf5('0x19')]?_0x26c067['options'][_0x8cf5('0x1e')]?_[_0x8cf5('0x23')](_0x26c067['options'][_0x8cf5('0x1e')],function(_0x27c170){return{'model':db[_0x27c170[_0x8cf5('0x1f')]],'as':_0x27c170['as'],'attributes':_0x27c170[_0x8cf5('0x1c')],'include':_0x27c170[_0x8cf5('0x1e')]?_[_0x8cf5('0x23')](_0x27c170[_0x8cf5('0x1e')],function(_0x3466e4){return{'model':db[_0x3466e4[_0x8cf5('0x1f')]],'as':_0x3466e4['as'],'attributes':_0x3466e4[_0x8cf5('0x1c')],'include':_0x3466e4[_0x8cf5('0x1e')]?_[_0x8cf5('0x23')](_0x3466e4['include'],function(_0x130d15){return{'model':db[_0x130d15[_0x8cf5('0x1f')]],'as':_0x130d15['as'],'attributes':_0x130d15['attributes']};}):[]};}):[]};}):[]:[]})[_0x8cf5('0x10')](function(_0x34269e){logger[_0x8cf5('0x11')](_0x8cf5('0x24'),_0x26c067);logger[_0x8cf5('0x13')]('ShowWhatsappQueue',_0x26c067,JSON[_0x8cf5('0x14')](_0x34269e));_0x2d4cdc(_0x34269e);})['catch'](function(_0x205f72){logger[_0x8cf5('0x15')](_0x8cf5('0x24'),_0x205f72['message'],_0x26c067);_0x4c1ddd(_0xca0233[_0x8cf5('0x15')](0x1f4,_0x205f72[_0x8cf5('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 87d1c7d..7b8fcaa 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 _0x5ac8=['remove','update','removeListener','register','save'];(function(_0x21de89,_0x367053){var _0x290b7e=function(_0x540704){while(--_0x540704){_0x21de89['push'](_0x21de89['shift']());}};_0x290b7e(++_0x367053);}(_0x5ac8,0x86));var _0x85ac=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5ac8[_0x3dd15e];return _0x231fd0;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x85ac('0x0'),_0x85ac('0x1'),_0x85ac('0x2')];function createListener(_0xd187ad,_0x1ab43d){return function(_0x154fc3){_0x1ab43d['emit'](_0xd187ad,_0x154fc3);};}function removeListener(_0x14027d,_0x25bc4f){return function(){WhatsappQueueEvents[_0x85ac('0x3')](_0x14027d,_0x25bc4f);};}exports[_0x85ac('0x4')]=function(_0x2e116b){for(var _0x2dafa4=0x0,_0x5839d4=events['length'];_0x2dafa4<_0x5839d4;_0x2dafa4++){var _0x2f2252=events[_0x2dafa4];var _0x3dc23a=createListener('whatsappQueue:'+_0x2f2252,_0x2e116b);WhatsappQueueEvents['on'](_0x2f2252,_0x3dc23a);}}; \ No newline at end of file +var _0x40f2=['emit','removeListener','register','length','whatsappQueue:','./whatsappQueue.events','save','remove','update'];(function(_0x2de020,_0x252df0){var _0x182b7c=function(_0xcbcdaa){while(--_0xcbcdaa){_0x2de020['push'](_0x2de020['shift']());}};_0x182b7c(++_0x252df0);}(_0x40f2,0x137));var _0x240f=function(_0x399c7a,_0x16eada){_0x399c7a=_0x399c7a-0x0;var _0x2975ba=_0x40f2[_0x399c7a];return _0x2975ba;};'use strict';var WhatsappQueueEvents=require(_0x240f('0x0'));var events=[_0x240f('0x1'),_0x240f('0x2'),_0x240f('0x3')];function createListener(_0x57e96d,_0x4a3ba8){return function(_0xd4219f){_0x4a3ba8[_0x240f('0x4')](_0x57e96d,_0xd4219f);};}function removeListener(_0x3b6933,_0x322ce3){return function(){WhatsappQueueEvents[_0x240f('0x5')](_0x3b6933,_0x322ce3);};}exports[_0x240f('0x6')]=function(_0x5819c7){for(var _0x40093c=0x0,_0x16a830=events[_0x240f('0x7')];_0x40093c<_0x16a830;_0x40093c++){var _0x1f5905=events[_0x40093c];var _0x47159b=createListener(_0x240f('0x8')+_0x1f5905,_0x5819c7);WhatsappQueueEvents['on'](_0x1f5905,_0x47159b);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index c5c42da..90501a7 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 _0x88c1=['exports','multer','util','path','express','Router','fs-extra','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','update','delete'];(function(_0x47c76d,_0x7473f5){var _0xdf0a3b=function(_0xfa7076){while(--_0xfa7076){_0x47c76d['push'](_0x47c76d['shift']());}};_0xdf0a3b(++_0x7473f5);}(_0x88c1,0xf8));var _0x188c=function(_0x26255f,_0x42fb1a){_0x26255f=_0x26255f-0x0;var _0x215b9a=_0x88c1[_0x26255f];return _0x215b9a;};'use strict';var multer=require(_0x188c('0x0'));var util=require(_0x188c('0x1'));var path=require(_0x188c('0x2'));var timeout=require('connect-timeout');var express=require(_0x188c('0x3'));var router=express[_0x188c('0x4')]();var fs_extra=require(_0x188c('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x188c('0x6'));var controller=require(_0x188c('0x7'));router[_0x188c('0x8')]('/',auth[_0x188c('0x9')](),controller[_0x188c('0xa')]);router[_0x188c('0x8')](_0x188c('0xb'),auth[_0x188c('0x9')](),controller[_0x188c('0xc')]);router[_0x188c('0x8')](_0x188c('0xd'),auth['isAuthenticated'](),controller[_0x188c('0xe')]);router[_0x188c('0xf')]('/',auth[_0x188c('0x9')](),controller['create']);router['put'](_0x188c('0xd'),auth[_0x188c('0x9')](),controller[_0x188c('0x10')]);router[_0x188c('0x11')]('/:id',auth[_0x188c('0x9')](),controller['destroy']);module[_0x188c('0x12')]=router; \ No newline at end of file +var _0xe117=['describe','get','/:id','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','isAuthenticated','/describe'];(function(_0x5a6afe,_0x2ea084){var _0x3c7275=function(_0x35bcf2){while(--_0x35bcf2){_0x5a6afe['push'](_0x5a6afe['shift']());}};_0x3c7275(++_0x2ea084);}(_0xe117,0xc4));var _0x7e11=function(_0x2bddf4,_0x44c47b){_0x2bddf4=_0x2bddf4-0x0;var _0x20ca51=_0xe117[_0x2bddf4];return _0x20ca51;};'use strict';var multer=require(_0x7e11('0x0'));var util=require(_0x7e11('0x1'));var path=require(_0x7e11('0x2'));var timeout=require(_0x7e11('0x3'));var express=require(_0x7e11('0x4'));var router=express[_0x7e11('0x5')]();var fs_extra=require(_0x7e11('0x6'));var auth=require(_0x7e11('0x7'));var interaction=require(_0x7e11('0x8'));var config=require(_0x7e11('0x9'));var controller=require(_0x7e11('0xa'));router['get']('/',auth[_0x7e11('0xb')](),controller['index']);router['get'](_0x7e11('0xc'),auth['isAuthenticated'](),controller[_0x7e11('0xd')]);router[_0x7e11('0xe')](_0x7e11('0xf'),auth[_0x7e11('0xb')](),controller['show']);router['post']('/',auth[_0x7e11('0xb')](),controller['create']);router[_0x7e11('0x10')](_0x7e11('0xf'),auth[_0x7e11('0xb')](),controller[_0x7e11('0x11')]);router[_0x7e11('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index eb59fc8..57cacdd 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(_0x33efdf,_0x566b28){var _0x1d6574=function(_0x4922ad){while(--_0x4922ad){_0x33efdf['push'](_0x33efdf['shift']());}};_0x1d6574(++_0x566b28);}(_0x7a54,0x106));var _0x47a5=function(_0x4881ff,_0x1dd12e){_0x4881ff=_0x4881ff-0x0;var _0x5bdaeb=_0x7a54[_0x4881ff];return _0x5bdaeb;};'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(_0xea07f0,_0x3f9b0e){var _0x379315=function(_0x531354){while(--_0x531354){_0xea07f0['push'](_0xea07f0['shift']());}};_0x379315(++_0x3f9b0e);}(_0x7a54,0x106));var _0x47a5=function(_0x3407d2,_0xed9df4){_0x3407d2=_0x3407d2-0x0;var _0x244294=_0x7a54[_0x3407d2];return _0x244294;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 691796c..c2436f0 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 _0xa5fa=['offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','index','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','options','WhatsappQueueReport','includeAll','rows','catch','show','params','fields','include','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status'];(function(_0x1cf6c6,_0x78635e){var _0x9a64c=function(_0x477c01){while(--_0x477c01){_0x1cf6c6['push'](_0x1cf6c6['shift']());}};_0x9a64c(++_0x78635e);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x3b5e9f,_0x29601e){_0x3b5e9f=_0x3b5e9f-0x0;var _0x1e9a49=_0xa5fa[_0x3b5e9f];return _0x1e9a49;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaa5f('0x0'));var zipdir=require(_0xaa5f('0x1'));var jsonpatch=require(_0xaa5f('0x2'));var rp=require(_0xaa5f('0x3'));var moment=require('moment');var BPromise=require(_0xaa5f('0x4'));var Mustache=require(_0xaa5f('0x5'));var util=require('util');var path=require(_0xaa5f('0x6'));var sox=require(_0xaa5f('0x7'));var csv=require(_0xaa5f('0x8'));var ejs=require(_0xaa5f('0x9'));var fs=require('fs');var fs_extra=require(_0xaa5f('0xa'));var _=require(_0xaa5f('0xb'));var squel=require(_0xaa5f('0xc'));var crypto=require(_0xaa5f('0xd'));var jsforce=require(_0xaa5f('0xe'));var deskjs=require(_0xaa5f('0xf'));var toCsv=require(_0xaa5f('0x8'));var querystring=require('querystring');var Papa=require(_0xaa5f('0x10'));var Redis=require(_0xaa5f('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaa5f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xaa5f('0x13'));var utils=require('../../config/utils');var config=require(_0xaa5f('0x14'));var licenseUtil=require(_0xaa5f('0x15'));var db=require(_0xaa5f('0x16'))['db'];function respondWithStatusCode(_0x9aeae9,_0x252ae0){_0x252ae0=_0x252ae0||0xcc;return function(_0x48d1d3){if(_0x48d1d3){return _0x9aeae9[_0xaa5f('0x17')](_0x252ae0);}return _0x9aeae9['status'](_0x252ae0)[_0xaa5f('0x18')]();};}function respondWithResult(_0x23f872,_0x31eabc){_0x31eabc=_0x31eabc||0xc8;return function(_0x19aa27){if(_0x19aa27){return _0x23f872[_0xaa5f('0x19')](_0x31eabc)['json'](_0x19aa27);}};}function respondWithFilteredResult(_0x4fc828,_0x1f37fb){return function(_0x291042){if(_0x291042){var _0xb0bfb6=typeof _0x1f37fb[_0xaa5f('0x1a')]===_0xaa5f('0x1b')&&typeof _0x1f37fb[_0xaa5f('0x1c')]===_0xaa5f('0x1b');var _0x28407c=_0x291042[_0xaa5f('0x1d')];var _0x3d874f=_0xb0bfb6?0x0:_0x1f37fb[_0xaa5f('0x1a')];var _0x1019e8=_0xb0bfb6?_0x291042['count']:_0x1f37fb[_0xaa5f('0x1a')]+_0x1f37fb[_0xaa5f('0x1c')];var _0x1cbab5;if(_0x1019e8>=_0x28407c){_0x1019e8=_0x28407c;_0x1cbab5=0xc8;}else{_0x1cbab5=0xce;}_0x4fc828[_0xaa5f('0x19')](_0x1cbab5);return _0x4fc828[_0xaa5f('0x1e')](_0xaa5f('0x1f'),_0x3d874f+'-'+_0x1019e8+'/'+_0x28407c)[_0xaa5f('0x20')](_0x291042);}return null;};}function patchUpdates(_0x194691){return function(_0x2d8fc3){try{jsonpatch[_0xaa5f('0x21')](_0x2d8fc3,_0x194691,!![]);}catch(_0x40c223){return BPromise[_0xaa5f('0x22')](_0x40c223);}return _0x2d8fc3[_0xaa5f('0x23')]();};}function saveUpdates(_0x5238a8,_0x1e917d){return function(_0x57082c){if(_0x57082c){return _0x57082c[_0xaa5f('0x24')](_0x5238a8)[_0xaa5f('0x25')](function(_0x561381){return _0x561381;});}return null;};}function removeEntity(_0x1baa2e,_0x1032ce){return function(_0x5b9f0b){if(_0x5b9f0b){return _0x5b9f0b[_0xaa5f('0x26')]()[_0xaa5f('0x25')](function(){_0x1baa2e[_0xaa5f('0x19')](0xcc)[_0xaa5f('0x18')]();});}};}function handleEntityNotFound(_0x1f66c0,_0xacbded){return function(_0x3d7bca){if(!_0x3d7bca){_0x1f66c0[_0xaa5f('0x17')](0x194);}return _0x3d7bca;};}function handleError(_0x51eb55,_0x2445a6){_0x2445a6=_0x2445a6||0x1f4;return function(_0x3a66e8){logger[_0xaa5f('0x27')](_0x3a66e8['stack']);if(_0x3a66e8[_0xaa5f('0x28')]){delete _0x3a66e8[_0xaa5f('0x28')];}_0x51eb55[_0xaa5f('0x19')](_0x2445a6)['send'](_0x3a66e8);};}exports[_0xaa5f('0x29')]=function(_0x479f29,_0x5990d2){var _0x27d1a4={},_0x50998f={},_0x1bffec={'count':0x0,'rows':[]};var _0x4e0ec9=_['map'](db['WhatsappQueueReport'][_0xaa5f('0x2a')],function(_0x4ddebd){return{'name':_0x4ddebd[_0xaa5f('0x2b')],'type':_0x4ddebd[_0xaa5f('0x2c')]['key']};});_0x50998f['model']=_[_0xaa5f('0x2d')](_0x4e0ec9,'name');_0x50998f[_0xaa5f('0x2e')]=_[_0xaa5f('0x2f')](_0x479f29['query']);_0x50998f[_0xaa5f('0x30')]=_[_0xaa5f('0x31')](_0x50998f[_0xaa5f('0x32')],_0x50998f['query']);_0x27d1a4[_0xaa5f('0x33')]=_[_0xaa5f('0x31')](_0x50998f['model'],qs['fields'](_0x479f29['query']['fields']));_0x27d1a4[_0xaa5f('0x33')]=_0x27d1a4[_0xaa5f('0x33')][_0xaa5f('0x34')]?_0x27d1a4[_0xaa5f('0x33')]:_0x50998f[_0xaa5f('0x32')];if(!_0x479f29[_0xaa5f('0x2e')][_0xaa5f('0x35')]('nolimit')){_0x27d1a4[_0xaa5f('0x1c')]=qs[_0xaa5f('0x1c')](_0x479f29[_0xaa5f('0x2e')][_0xaa5f('0x1c')]);_0x27d1a4[_0xaa5f('0x1a')]=qs[_0xaa5f('0x1a')](_0x479f29['query'][_0xaa5f('0x1a')]);}_0x27d1a4[_0xaa5f('0x36')]=qs[_0xaa5f('0x37')](_0x479f29[_0xaa5f('0x2e')][_0xaa5f('0x37')]);_0x27d1a4['where']=qs['filters'](_[_0xaa5f('0x38')](_0x479f29[_0xaa5f('0x2e')],_0x50998f[_0xaa5f('0x30')]),_0x4e0ec9);if(_0x479f29[_0xaa5f('0x2e')]['filter']){_0x27d1a4[_0xaa5f('0x39')]=_[_0xaa5f('0x3a')](_0x27d1a4[_0xaa5f('0x39')],{'$or':_[_0xaa5f('0x2d')](_0x4e0ec9,function(_0x37db88){if(_0x37db88[_0xaa5f('0x2c')]!==_0xaa5f('0x3b')){var _0x2c4d29={};_0x2c4d29[_0x37db88[_0xaa5f('0x28')]]={'$like':'%'+_0x479f29[_0xaa5f('0x2e')][_0xaa5f('0x3c')]+'%'};return _0x2c4d29;}})});}_0x27d1a4=_['merge']({},_0x27d1a4,_0x479f29[_0xaa5f('0x3d')]);var _0x2562ce={'where':_0x27d1a4[_0xaa5f('0x39')]};return db[_0xaa5f('0x3e')][_0xaa5f('0x1d')](_0x2562ce)[_0xaa5f('0x25')](function(_0x1fb572){_0x1bffec[_0xaa5f('0x1d')]=_0x1fb572;if(_0x479f29[_0xaa5f('0x2e')][_0xaa5f('0x3f')]){_0x27d1a4['include']=[{'all':!![]}];}return db[_0xaa5f('0x3e')]['findAll'](_0x27d1a4);})[_0xaa5f('0x25')](function(_0x21f4bc){_0x1bffec[_0xaa5f('0x40')]=_0x21f4bc;return _0x1bffec;})['then'](respondWithFilteredResult(_0x5990d2,_0x27d1a4))[_0xaa5f('0x41')](handleError(_0x5990d2,null));};exports[_0xaa5f('0x42')]=function(_0xe49f8,_0x528b08){var _0x12a8e4={'raw':!![],'where':{'id':_0xe49f8[_0xaa5f('0x43')]['id']}},_0x179be8={};_0x179be8[_0xaa5f('0x32')]=_['keys'](db[_0xaa5f('0x3e')][_0xaa5f('0x2a')]);_0x179be8[_0xaa5f('0x2e')]=_[_0xaa5f('0x2f')](_0xe49f8[_0xaa5f('0x2e')]);_0x179be8[_0xaa5f('0x30')]=_[_0xaa5f('0x31')](_0x179be8[_0xaa5f('0x32')],_0x179be8['query']);_0x12a8e4[_0xaa5f('0x33')]=_['intersection'](_0x179be8[_0xaa5f('0x32')],qs['fields'](_0xe49f8[_0xaa5f('0x2e')][_0xaa5f('0x44')]));_0x12a8e4['attributes']=_0x12a8e4[_0xaa5f('0x33')][_0xaa5f('0x34')]?_0x12a8e4[_0xaa5f('0x33')]:_0x179be8['model'];if(_0xe49f8['query']['includeAll']){_0x12a8e4[_0xaa5f('0x45')]=[{'all':!![]}];}_0x12a8e4=_['merge']({},_0x12a8e4,_0xe49f8[_0xaa5f('0x3d')]);return db[_0xaa5f('0x3e')][_0xaa5f('0x46')](_0x12a8e4)[_0xaa5f('0x25')](handleEntityNotFound(_0x528b08,null))['then'](respondWithResult(_0x528b08,null))[_0xaa5f('0x41')](handleError(_0x528b08,null));};exports[_0xaa5f('0x47')]=function(_0x3c6a17,_0x231ad1){return db[_0xaa5f('0x3e')][_0xaa5f('0x47')](_0x3c6a17[_0xaa5f('0x48')],{})[_0xaa5f('0x25')](respondWithResult(_0x231ad1,0xc9))[_0xaa5f('0x41')](handleError(_0x231ad1,null));};exports[_0xaa5f('0x24')]=function(_0x3ea553,_0x2de737){if(_0x3ea553[_0xaa5f('0x48')]['id']){delete _0x3ea553[_0xaa5f('0x48')]['id'];}return db[_0xaa5f('0x3e')][_0xaa5f('0x46')]({'where':{'id':_0x3ea553['params']['id']}})[_0xaa5f('0x25')](handleEntityNotFound(_0x2de737,null))[_0xaa5f('0x25')](saveUpdates(_0x3ea553[_0xaa5f('0x48')],null))[_0xaa5f('0x25')](respondWithResult(_0x2de737,null))[_0xaa5f('0x41')](handleError(_0x2de737,null));};exports[_0xaa5f('0x26')]=function(_0x32bbed,_0x4aa556){return db[_0xaa5f('0x3e')][_0xaa5f('0x46')]({'where':{'id':_0x32bbed[_0xaa5f('0x43')]['id']}})[_0xaa5f('0x25')](handleEntityNotFound(_0x4aa556,null))['then'](removeEntity(_0x4aa556,null))[_0xaa5f('0x41')](handleError(_0x4aa556,null));};exports[_0xaa5f('0x49')]=function(_0x36c4aa,_0x575803){return db['WhatsappQueueReport']['describe']()['then'](respondWithResult(_0x575803,null))['catch'](handleError(_0x575803,null));}; \ No newline at end of file +var _0xb62e=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','findAll','show','find','catch','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','type','key','model','query','keys','filters','attributes','fields'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb62e,0x1de));var _0xeb62=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xb62e[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require(_0xeb62('0x0'));var rimraf=require(_0xeb62('0x1'));var zipdir=require(_0xeb62('0x2'));var jsonpatch=require(_0xeb62('0x3'));var rp=require('request-promise');var moment=require(_0xeb62('0x4'));var BPromise=require(_0xeb62('0x5'));var Mustache=require(_0xeb62('0x6'));var util=require(_0xeb62('0x7'));var path=require(_0xeb62('0x8'));var sox=require(_0xeb62('0x9'));var csv=require('to-csv');var ejs=require(_0xeb62('0xa'));var fs=require('fs');var fs_extra=require(_0xeb62('0xb'));var _=require(_0xeb62('0xc'));var squel=require('squel');var crypto=require(_0xeb62('0xd'));var jsforce=require(_0xeb62('0xe'));var deskjs=require(_0xeb62('0xf'));var toCsv=require(_0xeb62('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xeb62('0x11'));var authService=require(_0xeb62('0x12'));var qs=require(_0xeb62('0x13'));var as=require(_0xeb62('0x14'));var hardwareService=require(_0xeb62('0x15'));var logger=require(_0xeb62('0x16'))(_0xeb62('0x17'));var utils=require(_0xeb62('0x18'));var config=require(_0xeb62('0x19'));var licenseUtil=require(_0xeb62('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x422daf,_0xcc11c4){_0xcc11c4=_0xcc11c4||0xcc;return function(_0x27671e){if(_0x27671e){return _0x422daf[_0xeb62('0x1b')](_0xcc11c4);}return _0x422daf['status'](_0xcc11c4)[_0xeb62('0x1c')]();};}function respondWithResult(_0x2fbad2,_0x23fb15){_0x23fb15=_0x23fb15||0xc8;return function(_0x4da178){if(_0x4da178){return _0x2fbad2[_0xeb62('0x1d')](_0x23fb15)[_0xeb62('0x1e')](_0x4da178);}};}function respondWithFilteredResult(_0x2fd4c7,_0x4ce9fa){return function(_0x1f6a1f){if(_0x1f6a1f){var _0x15b3e8=typeof _0x4ce9fa[_0xeb62('0x1f')]===_0xeb62('0x20')&&typeof _0x4ce9fa[_0xeb62('0x21')]===_0xeb62('0x20');var _0x1fb460=_0x1f6a1f[_0xeb62('0x22')];var _0x39b138=_0x15b3e8?0x0:_0x4ce9fa[_0xeb62('0x1f')];var _0x27efc8=_0x15b3e8?_0x1f6a1f[_0xeb62('0x22')]:_0x4ce9fa[_0xeb62('0x1f')]+_0x4ce9fa['limit'];var _0x38c5e4;if(_0x27efc8>=_0x1fb460){_0x27efc8=_0x1fb460;_0x38c5e4=0xc8;}else{_0x38c5e4=0xce;}_0x2fd4c7[_0xeb62('0x1d')](_0x38c5e4);return _0x2fd4c7[_0xeb62('0x23')](_0xeb62('0x24'),_0x39b138+'-'+_0x27efc8+'/'+_0x1fb460)[_0xeb62('0x1e')](_0x1f6a1f);}return null;};}function patchUpdates(_0x24cbf3){return function(_0x2ed96d){try{jsonpatch['apply'](_0x2ed96d,_0x24cbf3,!![]);}catch(_0x599d0b){return BPromise[_0xeb62('0x25')](_0x599d0b);}return _0x2ed96d[_0xeb62('0x26')]();};}function saveUpdates(_0x11ed9c,_0x13243f){return function(_0x122b15){if(_0x122b15){return _0x122b15['update'](_0x11ed9c)['then'](function(_0x4664ce){return _0x4664ce;});}return null;};}function removeEntity(_0x132861,_0x182781){return function(_0x395b70){if(_0x395b70){return _0x395b70['destroy']()['then'](function(){_0x132861[_0xeb62('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x448327,_0x4b0f46){return function(_0xfe3e16){if(!_0xfe3e16){_0x448327['sendStatus'](0x194);}return _0xfe3e16;};}function handleError(_0x3ac28c,_0x6bfbbc){_0x6bfbbc=_0x6bfbbc||0x1f4;return function(_0x46d1bb){logger['error'](_0x46d1bb[_0xeb62('0x27')]);if(_0x46d1bb[_0xeb62('0x28')]){delete _0x46d1bb[_0xeb62('0x28')];}_0x3ac28c[_0xeb62('0x1d')](_0x6bfbbc)[_0xeb62('0x29')](_0x46d1bb);};}exports[_0xeb62('0x2a')]=function(_0x511202,_0x192517){var _0x1616ee={},_0x57169a={},_0x157474={'count':0x0,'rows':[]};var _0x2b51b2=_[_0xeb62('0x2b')](db[_0xeb62('0x2c')][_0xeb62('0x2d')],function(_0x5195bf){return{'name':_0x5195bf['fieldName'],'type':_0x5195bf[_0xeb62('0x2e')][_0xeb62('0x2f')]};});_0x57169a[_0xeb62('0x30')]=_[_0xeb62('0x2b')](_0x2b51b2,_0xeb62('0x28'));_0x57169a[_0xeb62('0x31')]=_[_0xeb62('0x32')](_0x511202['query']);_0x57169a[_0xeb62('0x33')]=_['intersection'](_0x57169a['model'],_0x57169a[_0xeb62('0x31')]);_0x1616ee[_0xeb62('0x34')]=_['intersection'](_0x57169a[_0xeb62('0x30')],qs['fields'](_0x511202[_0xeb62('0x31')][_0xeb62('0x35')]));_0x1616ee['attributes']=_0x1616ee[_0xeb62('0x34')][_0xeb62('0x36')]?_0x1616ee['attributes']:_0x57169a[_0xeb62('0x30')];if(!_0x511202[_0xeb62('0x31')][_0xeb62('0x37')](_0xeb62('0x38'))){_0x1616ee['limit']=qs[_0xeb62('0x21')](_0x511202[_0xeb62('0x31')]['limit']);_0x1616ee['offset']=qs[_0xeb62('0x1f')](_0x511202[_0xeb62('0x31')]['offset']);}_0x1616ee[_0xeb62('0x39')]=qs[_0xeb62('0x3a')](_0x511202[_0xeb62('0x31')][_0xeb62('0x3a')]);_0x1616ee[_0xeb62('0x3b')]=qs[_0xeb62('0x33')](_[_0xeb62('0x3c')](_0x511202['query'],_0x57169a['filters']),_0x2b51b2);if(_0x511202[_0xeb62('0x31')][_0xeb62('0x3d')]){_0x1616ee[_0xeb62('0x3b')]=_[_0xeb62('0x3e')](_0x1616ee['where'],{'$or':_[_0xeb62('0x2b')](_0x2b51b2,function(_0x510c7d){if(_0x510c7d[_0xeb62('0x2e')]!==_0xeb62('0x3f')){var _0x2dac2f={};_0x2dac2f[_0x510c7d[_0xeb62('0x28')]]={'$like':'%'+_0x511202[_0xeb62('0x31')][_0xeb62('0x3d')]+'%'};return _0x2dac2f;}})});}_0x1616ee=_[_0xeb62('0x3e')]({},_0x1616ee,_0x511202[_0xeb62('0x40')]);var _0x5e8ef8={'where':_0x1616ee[_0xeb62('0x3b')]};return db[_0xeb62('0x2c')][_0xeb62('0x22')](_0x5e8ef8)[_0xeb62('0x41')](function(_0x5dd0e3){_0x157474['count']=_0x5dd0e3;if(_0x511202[_0xeb62('0x31')][_0xeb62('0x42')]){_0x1616ee['include']=[{'all':!![]}];}return db[_0xeb62('0x2c')][_0xeb62('0x43')](_0x1616ee);})['then'](function(_0x25e9f0){_0x157474['rows']=_0x25e9f0;return _0x157474;})[_0xeb62('0x41')](respondWithFilteredResult(_0x192517,_0x1616ee))['catch'](handleError(_0x192517,null));};exports[_0xeb62('0x44')]=function(_0x5dde1d,_0x2bf77f){var _0x609b2d={'raw':!![],'where':{'id':_0x5dde1d['params']['id']}},_0x317f50={};_0x317f50['model']=_[_0xeb62('0x32')](db[_0xeb62('0x2c')][_0xeb62('0x2d')]);_0x317f50[_0xeb62('0x31')]=_[_0xeb62('0x32')](_0x5dde1d['query']);_0x317f50[_0xeb62('0x33')]=_['intersection'](_0x317f50[_0xeb62('0x30')],_0x317f50['query']);_0x609b2d[_0xeb62('0x34')]=_['intersection'](_0x317f50[_0xeb62('0x30')],qs['fields'](_0x5dde1d[_0xeb62('0x31')][_0xeb62('0x35')]));_0x609b2d[_0xeb62('0x34')]=_0x609b2d[_0xeb62('0x34')][_0xeb62('0x36')]?_0x609b2d[_0xeb62('0x34')]:_0x317f50['model'];if(_0x5dde1d[_0xeb62('0x31')][_0xeb62('0x42')]){_0x609b2d['include']=[{'all':!![]}];}_0x609b2d=_['merge']({},_0x609b2d,_0x5dde1d['options']);return db['WhatsappQueueReport'][_0xeb62('0x45')](_0x609b2d)[_0xeb62('0x41')](handleEntityNotFound(_0x2bf77f,null))['then'](respondWithResult(_0x2bf77f,null))[_0xeb62('0x46')](handleError(_0x2bf77f,null));};exports[_0xeb62('0x47')]=function(_0x412e93,_0x16e262){return db[_0xeb62('0x2c')]['create'](_0x412e93[_0xeb62('0x48')],{})['then'](respondWithResult(_0x16e262,0xc9))[_0xeb62('0x46')](handleError(_0x16e262,null));};exports[_0xeb62('0x49')]=function(_0x7fb53f,_0x18c40d){if(_0x7fb53f[_0xeb62('0x48')]['id']){delete _0x7fb53f[_0xeb62('0x48')]['id'];}return db[_0xeb62('0x2c')][_0xeb62('0x45')]({'where':{'id':_0x7fb53f[_0xeb62('0x4a')]['id']}})[_0xeb62('0x41')](handleEntityNotFound(_0x18c40d,null))[_0xeb62('0x41')](saveUpdates(_0x7fb53f[_0xeb62('0x48')],null))['then'](respondWithResult(_0x18c40d,null))[_0xeb62('0x46')](handleError(_0x18c40d,null));};exports['destroy']=function(_0x4edd8c,_0x2dcb2d){return db[_0xeb62('0x2c')]['find']({'where':{'id':_0x4edd8c[_0xeb62('0x4a')]['id']}})[_0xeb62('0x41')](handleEntityNotFound(_0x2dcb2d,null))['then'](removeEntity(_0x2dcb2d,null))[_0xeb62('0x46')](handleError(_0x2dcb2d,null));};exports[_0xeb62('0x4b')]=function(_0x20b73b,_0x60617){return db[_0xeb62('0x2c')][_0xeb62('0x4b')]()[_0xeb62('0x41')](respondWithResult(_0x60617,null))[_0xeb62('0x46')](handleError(_0x60617,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 1618b71..2cd6493 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 _0x6243=['define','WhatsappQueueReport','uniqueid','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports'];(function(_0x1a687e,_0x5af335){var _0x594664=function(_0x476ef8){while(--_0x476ef8){_0x1a687e['push'](_0x1a687e['shift']());}};_0x594664(++_0x5af335);}(_0x6243,0x155));var _0x3624=function(_0x402d50,_0x3e2a8f){_0x402d50=_0x402d50-0x0;var _0x4e3dc7=_0x6243[_0x402d50];return _0x4e3dc7;};'use strict';var _=require(_0x3624('0x0'));var util=require('util');var logger=require(_0x3624('0x1'))(_0x3624('0x2'));var moment=require(_0x3624('0x3'));var BPromise=require('bluebird');var rp=require(_0x3624('0x4'));var fs=require('fs');var path=require(_0x3624('0x5'));var rimraf=require(_0x3624('0x6'));var config=require(_0x3624('0x7'));var attributes=require(_0x3624('0x8'));module[_0x3624('0x9')]=function(_0x38849f,_0x522649){return _0x38849f[_0x3624('0xa')](_0x3624('0xb'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x3624('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc601=['rimraf','../../config/environment','./whatsappQueueReport.attributes','uniqueid','lodash','util','../../config/logger','bluebird','path'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xc601,0xaf));var _0x1c60=function(_0x39266c,_0xd4d1d8){_0x39266c=_0x39266c-0x0;var _0x8f3ac9=_0xc601[_0x39266c];return _0x8f3ac9;};'use strict';var _=require(_0x1c60('0x0'));var util=require(_0x1c60('0x1'));var logger=require(_0x1c60('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1c60('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1c60('0x4'));var rimraf=require(_0x1c60('0x5'));var config=require(_0x1c60('0x6'));var attributes=require(_0x1c60('0x7'));module['exports']=function(_0x75bd6c,_0x491501){return _0x75bd6c['define']('WhatsappQueueReport',attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x1c60('0x8'),'fields':[_0x1c60('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index d834a2e..00b48a2 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 _0x9817=['request\x20sent','stringify','error','code','message','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','UpdateWhatsappQueueReport','update','where','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','then','info','WhatsappQueueReport,\x20%s,\x20%s','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x582df7,_0x3d02cf){var _0x5081fd=function(_0x3f197c){while(--_0x3f197c){_0x582df7['push'](_0x582df7['shift']());}};_0x5081fd(++_0x3d02cf);}(_0x9817,0x100));var _0x7981=function(_0x2cb321,_0x4966fe){_0x2cb321=_0x2cb321-0x0;var _0x24c609=_0x9817[_0x2cb321];return _0x24c609;};'use strict';var _=require(_0x7981('0x0'));var util=require(_0x7981('0x1'));var moment=require('moment');var BPromise=require(_0x7981('0x2'));var rs=require(_0x7981('0x3'));var fs=require('fs');var Redis=require(_0x7981('0x4'));var db=require(_0x7981('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7981('0x6'));var config=require(_0x7981('0x7'));var jayson=require(_0x7981('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xf7ac3,_0x1bf2fb,_0x1ebf27){return new BPromise(function(_0x3309d5,_0x314a52){return client['request'](_0xf7ac3,_0x1ebf27)[_0x7981('0x9')](function(_0x504b03){logger[_0x7981('0xa')](_0x7981('0xb'),_0x1bf2fb,'request\x20sent');logger[_0x7981('0xc')](_0x7981('0xd'),_0x1bf2fb,_0x7981('0xe'),JSON[_0x7981('0xf')](_0x504b03));if(_0x504b03[_0x7981('0x10')]){if(_0x504b03[_0x7981('0x10')][_0x7981('0x11')]===0x1f4){logger[_0x7981('0x10')](_0x7981('0xb'),_0x1bf2fb,_0x504b03[_0x7981('0x10')]['message']);return _0x314a52(_0x504b03['error'][_0x7981('0x12')]);}logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x1bf2fb,_0x504b03[_0x7981('0x10')][_0x7981('0x12')]);return _0x3309d5(_0x504b03['error'][_0x7981('0x12')]);}else{logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x1bf2fb,'request\x20sent');_0x3309d5(_0x504b03['result'][_0x7981('0x12')]);}})[_0x7981('0x13')](function(_0x1cd52d){logger['error'](_0x7981('0xb'),_0x1bf2fb,_0x1cd52d);_0x314a52(_0x1cd52d);});});}exports[_0x7981('0x14')]=function(_0x400cc8){var _0x4a6e61=this;return new Promise(function(_0x41e6e3,_0x4f8bf6){return db[_0x7981('0x15')][_0x7981('0x16')](_0x400cc8[_0x7981('0x17')],{'raw':_0x400cc8[_0x7981('0x18')]?_0x400cc8[_0x7981('0x18')][_0x7981('0x19')]===undefined?!![]:![]:!![]})[_0x7981('0x9')](function(_0x109d27){logger[_0x7981('0xa')]('CreateWhatsappQueueReport',_0x400cc8);logger[_0x7981('0xc')](_0x7981('0x14'),_0x400cc8,JSON[_0x7981('0xf')](_0x109d27));_0x41e6e3(_0x109d27);})[_0x7981('0x13')](function(_0x42c882){logger[_0x7981('0x10')](_0x7981('0x14'),_0x42c882[_0x7981('0x12')],_0x400cc8);_0x4f8bf6(_0x4a6e61[_0x7981('0x10')](0x1f4,_0x42c882['message']));});});};exports[_0x7981('0x1a')]=function(_0x5479e3){var _0x6aa2eb=this;return new Promise(function(_0x1f799e,_0x32b2be){return db[_0x7981('0x15')][_0x7981('0x1b')](_0x5479e3['body'],{'raw':_0x5479e3[_0x7981('0x18')]?_0x5479e3[_0x7981('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5479e3[_0x7981('0x18')]?_0x5479e3[_0x7981('0x18')][_0x7981('0x1c')]||null:null,'attributes':_0x5479e3[_0x7981('0x18')]?_0x5479e3[_0x7981('0x18')]['attributes']||null:null,'limit':_0x5479e3[_0x7981('0x18')]?_0x5479e3[_0x7981('0x18')][_0x7981('0x1d')]||null:null})[_0x7981('0x9')](function(_0x49b162){logger[_0x7981('0xa')](_0x7981('0x1a'),_0x5479e3);logger['debug']('UpdateWhatsappQueueReport',_0x5479e3,JSON[_0x7981('0xf')](_0x49b162));_0x1f799e(_0x49b162);})[_0x7981('0x13')](function(_0x3c84f9){logger['error'](_0x7981('0x1a'),_0x3c84f9[_0x7981('0x12')],_0x5479e3);_0x32b2be(_0x6aa2eb[_0x7981('0x10')](0x1f4,_0x3c84f9[_0x7981('0x12')]));});});}; \ No newline at end of file +var _0xb25d=['WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','UpdateWhatsappQueueReport','update','raw','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x175f74,_0x31e6a4){var _0x4c1e80=function(_0x4a5a10){while(--_0x4a5a10){_0x175f74['push'](_0x175f74['shift']());}};_0x4c1e80(++_0x31e6a4);}(_0xb25d,0xc3));var _0xdb25=function(_0x294032,_0x4ed889){_0x294032=_0x294032-0x0;var _0x5e9616=_0xb25d[_0x294032];return _0x5e9616;};'use strict';var _=require('lodash');var util=require(_0xdb25('0x0'));var moment=require(_0xdb25('0x1'));var BPromise=require(_0xdb25('0x2'));var rs=require(_0xdb25('0x3'));var fs=require('fs');var Redis=require(_0xdb25('0x4'));var db=require(_0xdb25('0x5'))['db'];var utils=require(_0xdb25('0x6'));var logger=require(_0xdb25('0x7'))(_0xdb25('0x8'));var config=require(_0xdb25('0x9'));var jayson=require(_0xdb25('0xa'));var client=jayson[_0xdb25('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x52ae75,_0x1265c2,_0x3a28ee){return new BPromise(function(_0x11af23,_0x5317b1){return client[_0xdb25('0xc')](_0x52ae75,_0x3a28ee)[_0xdb25('0xd')](function(_0x15abb7){logger[_0xdb25('0xe')](_0xdb25('0xf'),_0x1265c2,_0xdb25('0x10'));logger[_0xdb25('0x11')](_0xdb25('0x12'),_0x1265c2,_0xdb25('0x10'),JSON[_0xdb25('0x13')](_0x15abb7));if(_0x15abb7[_0xdb25('0x14')]){if(_0x15abb7[_0xdb25('0x14')][_0xdb25('0x15')]===0x1f4){logger[_0xdb25('0x14')](_0xdb25('0xf'),_0x1265c2,_0x15abb7[_0xdb25('0x14')][_0xdb25('0x16')]);return _0x5317b1(_0x15abb7['error'][_0xdb25('0x16')]);}logger[_0xdb25('0x14')](_0xdb25('0xf'),_0x1265c2,_0x15abb7[_0xdb25('0x14')][_0xdb25('0x16')]);return _0x11af23(_0x15abb7[_0xdb25('0x14')][_0xdb25('0x16')]);}else{logger[_0xdb25('0xe')](_0xdb25('0xf'),_0x1265c2,_0xdb25('0x10'));_0x11af23(_0x15abb7['result'][_0xdb25('0x16')]);}})[_0xdb25('0x17')](function(_0x387b68){logger['error'](_0xdb25('0xf'),_0x1265c2,_0x387b68);_0x5317b1(_0x387b68);});});}exports[_0xdb25('0x18')]=function(_0x2dca73){var _0x3d8d25=this;return new Promise(function(_0x52b620,_0x33c3b0){return db[_0xdb25('0x19')][_0xdb25('0x1a')](_0x2dca73[_0xdb25('0x1b')],{'raw':_0x2dca73['options']?_0x2dca73[_0xdb25('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0xdb25('0xd')](function(_0xf28bab){logger[_0xdb25('0xe')]('CreateWhatsappQueueReport',_0x2dca73);logger[_0xdb25('0x11')](_0xdb25('0x18'),_0x2dca73,JSON[_0xdb25('0x13')](_0xf28bab));_0x52b620(_0xf28bab);})[_0xdb25('0x17')](function(_0x3a74fc){logger[_0xdb25('0x14')](_0xdb25('0x18'),_0x3a74fc['message'],_0x2dca73);_0x33c3b0(_0x3d8d25[_0xdb25('0x14')](0x1f4,_0x3a74fc['message']));});});};exports[_0xdb25('0x1d')]=function(_0x392e15){var _0x46bf1c=this;return new Promise(function(_0x50a255,_0x1274fe){return db['WhatsappQueueReport'][_0xdb25('0x1e')](_0x392e15[_0xdb25('0x1b')],{'raw':_0x392e15['options']?_0x392e15[_0xdb25('0x1c')][_0xdb25('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x392e15[_0xdb25('0x1c')]?_0x392e15[_0xdb25('0x1c')][_0xdb25('0x20')]||null:null,'attributes':_0x392e15[_0xdb25('0x1c')]?_0x392e15[_0xdb25('0x1c')][_0xdb25('0x21')]||null:null,'limit':_0x392e15[_0xdb25('0x1c')]?_0x392e15[_0xdb25('0x1c')][_0xdb25('0x22')]||null:null})[_0xdb25('0xd')](function(_0x1ae1c8){logger[_0xdb25('0xe')]('UpdateWhatsappQueueReport',_0x392e15);logger[_0xdb25('0x11')]('UpdateWhatsappQueueReport',_0x392e15,JSON[_0xdb25('0x13')](_0x1ae1c8));_0x50a255(_0x1ae1c8);})[_0xdb25('0x17')](function(_0x5c93ab){logger[_0xdb25('0x14')]('UpdateWhatsappQueueReport',_0x5c93ab[_0xdb25('0x16')],_0x392e15);_0x1274fe(_0x46bf1c['error'](0x1f4,_0x5c93ab[_0xdb25('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index e039540..164b1d7 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 _0x13eb=['../../config/environment','./whatsappTransferReport.controller','isAuthenticated','/describe','describe','get','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x13eb,0x126));var _0xb13e=function(_0x26c26c,_0x39f9cf){_0x26c26c=_0x26c26c-0x0;var _0x153b04=_0x13eb[_0x26c26c];return _0x153b04;};'use strict';var multer=require(_0xb13e('0x0'));var util=require(_0xb13e('0x1'));var path=require(_0xb13e('0x2'));var timeout=require(_0xb13e('0x3'));var express=require('express');var router=express[_0xb13e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb13e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb13e('0x6'));var controller=require(_0xb13e('0x7'));router['get']('/',auth[_0xb13e('0x8')](),controller['index']);router['get'](_0xb13e('0x9'),auth[_0xb13e('0x8')](),controller[_0xb13e('0xa')]);router[_0xb13e('0xb')](_0xb13e('0xc'),auth[_0xb13e('0x8')](),controller[_0xb13e('0xd')]);router['post']('/',auth[_0xb13e('0x8')](),controller[_0xb13e('0xe')]);router[_0xb13e('0xf')](_0xb13e('0xc'),auth[_0xb13e('0x8')](),controller[_0xb13e('0x10')]);router[_0xb13e('0x11')]('/:id',auth[_0xb13e('0x8')](),controller[_0xb13e('0x12')]);module[_0xb13e('0x13')]=router; \ No newline at end of file +var _0x2034=['index','isAuthenticated','describe','/:id','show','put','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get'];(function(_0x5d1647,_0x4b6210){var _0x55a58b=function(_0x110731){while(--_0x110731){_0x5d1647['push'](_0x5d1647['shift']());}};_0x55a58b(++_0x4b6210);}(_0x2034,0xbd));var _0x4203=function(_0x410e78,_0x308cc4){_0x410e78=_0x410e78-0x0;var _0x4e900e=_0x2034[_0x410e78];return _0x4e900e;};'use strict';var multer=require(_0x4203('0x0'));var util=require(_0x4203('0x1'));var path=require(_0x4203('0x2'));var timeout=require(_0x4203('0x3'));var express=require('express');var router=express[_0x4203('0x4')]();var fs_extra=require(_0x4203('0x5'));var auth=require(_0x4203('0x6'));var interaction=require(_0x4203('0x7'));var config=require(_0x4203('0x8'));var controller=require(_0x4203('0x9'));router[_0x4203('0xa')]('/',auth['isAuthenticated'](),controller[_0x4203('0xb')]);router['get']('/describe',auth[_0x4203('0xc')](),controller[_0x4203('0xd')]);router[_0x4203('0xa')](_0x4203('0xe'),auth[_0x4203('0xc')](),controller[_0x4203('0xf')]);router['post']('/',auth[_0x4203('0xc')](),controller['create']);router[_0x4203('0x10')](_0x4203('0xe'),auth[_0x4203('0xc')](),controller[_0x4203('0x11')]);router[_0x4203('0x12')](_0x4203('0xe'),auth['isAuthenticated'](),controller[_0x4203('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 9218d3c..e37bba9 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 _0x68b7=['queue','DATE','sequelize','STRING','ENUM','account'];(function(_0x285b92,_0x2a57cc){var _0x11c28b=function(_0x41f56b){while(--_0x41f56b){_0x285b92['push'](_0x285b92['shift']());}};_0x11c28b(++_0x2a57cc);}(_0x68b7,0x8c));var _0x768b=function(_0x4e7ef7,_0x35a32b){_0x4e7ef7=_0x4e7ef7-0x0;var _0x466bb2=_0x68b7[_0x4e7ef7];return _0x466bb2;};'use strict';var Sequelize=require(_0x768b('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x768b('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x768b('0x2')](_0x768b('0x3'),'agent',_0x768b('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x768b('0x5')]}}; \ No newline at end of file +var _0x4b17=['DATE','sequelize','STRING','account','agent'];(function(_0x4b8bf7,_0x3ecddb){var _0x2f0adf=function(_0x3cc7d4){while(--_0x3cc7d4){_0x4b8bf7['push'](_0x4b8bf7['shift']());}};_0x2f0adf(++_0x3ecddb);}(_0x4b17,0x10f));var _0x74b1=function(_0x3e5bc8,_0x457d89){_0x3e5bc8=_0x3e5bc8-0x0;var _0xfd84bc=_0x4b17[_0x3e5bc8];return _0xfd84bc;};'use strict';var Sequelize=require(_0x74b1('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x74b1('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x74b1('0x2'),_0x74b1('0x3'),'queue'),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x74b1('0x4')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 4cd311e..d54651d 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 _0x28df=['limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','keys','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x120222,_0x57697b){var _0xd5badd=function(_0x6fcdf1){while(--_0x6fcdf1){_0x120222['push'](_0x120222['shift']());}};_0xd5badd(++_0x57697b);}(_0x28df,0x1ee));var _0xf28d=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x28df[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require(_0xf28d('0x0'));var rimraf=require(_0xf28d('0x1'));var zipdir=require(_0xf28d('0x2'));var jsonpatch=require(_0xf28d('0x3'));var rp=require(_0xf28d('0x4'));var moment=require(_0xf28d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf28d('0x6'));var util=require(_0xf28d('0x7'));var path=require('path');var sox=require(_0xf28d('0x8'));var csv=require('to-csv');var ejs=require(_0xf28d('0x9'));var fs=require('fs');var fs_extra=require(_0xf28d('0xa'));var _=require(_0xf28d('0xb'));var squel=require(_0xf28d('0xc'));var crypto=require(_0xf28d('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf28d('0xe'));var Papa=require(_0xf28d('0xf'));var Redis=require(_0xf28d('0x10'));var authService=require(_0xf28d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf28d('0x12'));var hardwareService=require(_0xf28d('0x13'));var logger=require('../../config/logger')(_0xf28d('0x14'));var utils=require(_0xf28d('0x15'));var config=require(_0xf28d('0x16'));var licenseUtil=require(_0xf28d('0x17'));var db=require(_0xf28d('0x18'))['db'];function respondWithStatusCode(_0x4463db,_0x4f1017){_0x4f1017=_0x4f1017||0xcc;return function(_0x494119){if(_0x494119){return _0x4463db[_0xf28d('0x19')](_0x4f1017);}return _0x4463db[_0xf28d('0x1a')](_0x4f1017)[_0xf28d('0x1b')]();};}function respondWithResult(_0x5d4580,_0x774e1c){_0x774e1c=_0x774e1c||0xc8;return function(_0x2caf4d){if(_0x2caf4d){return _0x5d4580[_0xf28d('0x1a')](_0x774e1c)[_0xf28d('0x1c')](_0x2caf4d);}};}function respondWithFilteredResult(_0x234072,_0x59d292){return function(_0x449cea){if(_0x449cea){var _0x34b71d=typeof _0x59d292[_0xf28d('0x1d')]===_0xf28d('0x1e')&&typeof _0x59d292[_0xf28d('0x1f')]==='undefined';var _0x5dc890=_0x449cea['count'];var _0x4216da=_0x34b71d?0x0:_0x59d292[_0xf28d('0x1d')];var _0x4aa27f=_0x34b71d?_0x449cea[_0xf28d('0x20')]:_0x59d292[_0xf28d('0x1d')]+_0x59d292[_0xf28d('0x1f')];var _0x4a928e;if(_0x4aa27f>=_0x5dc890){_0x4aa27f=_0x5dc890;_0x4a928e=0xc8;}else{_0x4a928e=0xce;}_0x234072[_0xf28d('0x1a')](_0x4a928e);return _0x234072[_0xf28d('0x21')]('Content-Range',_0x4216da+'-'+_0x4aa27f+'/'+_0x5dc890)[_0xf28d('0x1c')](_0x449cea);}return null;};}function patchUpdates(_0x2c67e3){return function(_0x44539a){try{jsonpatch[_0xf28d('0x22')](_0x44539a,_0x2c67e3,!![]);}catch(_0x4fe561){return BPromise[_0xf28d('0x23')](_0x4fe561);}return _0x44539a[_0xf28d('0x24')]();};}function saveUpdates(_0x295a83,_0x47f385){return function(_0x5c49c0){if(_0x5c49c0){return _0x5c49c0[_0xf28d('0x25')](_0x295a83)[_0xf28d('0x26')](function(_0x19f540){return _0x19f540;});}return null;};}function removeEntity(_0x1ba22c,_0x557ed0){return function(_0x1861a2){if(_0x1861a2){return _0x1861a2[_0xf28d('0x27')]()[_0xf28d('0x26')](function(){_0x1ba22c[_0xf28d('0x1a')](0xcc)[_0xf28d('0x1b')]();});}};}function handleEntityNotFound(_0x14a0db,_0x13fa05){return function(_0x44bf2f){if(!_0x44bf2f){_0x14a0db[_0xf28d('0x19')](0x194);}return _0x44bf2f;};}function handleError(_0x47c3d8,_0x231325){_0x231325=_0x231325||0x1f4;return function(_0x4c464d){logger[_0xf28d('0x28')](_0x4c464d[_0xf28d('0x29')]);if(_0x4c464d[_0xf28d('0x2a')]){delete _0x4c464d[_0xf28d('0x2a')];}_0x47c3d8[_0xf28d('0x1a')](_0x231325)['send'](_0x4c464d);};}exports[_0xf28d('0x2b')]=function(_0x4850d9,_0x499a81){var _0x20c600={},_0x215232={},_0x2cfa5d={'count':0x0,'rows':[]};var _0x1b255b=_[_0xf28d('0x2c')](db[_0xf28d('0x2d')][_0xf28d('0x2e')],function(_0x1a32b7){return{'name':_0x1a32b7[_0xf28d('0x2f')],'type':_0x1a32b7[_0xf28d('0x30')][_0xf28d('0x31')]};});_0x215232[_0xf28d('0x32')]=_['map'](_0x1b255b,_0xf28d('0x2a'));_0x215232['query']=_['keys'](_0x4850d9[_0xf28d('0x33')]);_0x215232[_0xf28d('0x34')]=_[_0xf28d('0x35')](_0x215232[_0xf28d('0x32')],_0x215232[_0xf28d('0x33')]);_0x20c600[_0xf28d('0x36')]=_[_0xf28d('0x35')](_0x215232['model'],qs[_0xf28d('0x37')](_0x4850d9['query'][_0xf28d('0x37')]));_0x20c600[_0xf28d('0x36')]=_0x20c600['attributes'][_0xf28d('0x38')]?_0x20c600[_0xf28d('0x36')]:_0x215232[_0xf28d('0x32')];if(!_0x4850d9[_0xf28d('0x33')][_0xf28d('0x39')]('nolimit')){_0x20c600[_0xf28d('0x1f')]=qs[_0xf28d('0x1f')](_0x4850d9[_0xf28d('0x33')]['limit']);_0x20c600['offset']=qs[_0xf28d('0x1d')](_0x4850d9[_0xf28d('0x33')][_0xf28d('0x1d')]);}_0x20c600[_0xf28d('0x3a')]=qs[_0xf28d('0x3b')](_0x4850d9[_0xf28d('0x33')][_0xf28d('0x3b')]);_0x20c600[_0xf28d('0x3c')]=qs['filters'](_[_0xf28d('0x3d')](_0x4850d9[_0xf28d('0x33')],_0x215232[_0xf28d('0x34')]),_0x1b255b);if(_0x4850d9[_0xf28d('0x33')][_0xf28d('0x3e')]){_0x20c600[_0xf28d('0x3c')]=_[_0xf28d('0x3f')](_0x20c600[_0xf28d('0x3c')],{'$or':_['map'](_0x1b255b,function(_0x5e509a){if(_0x5e509a['type']!==_0xf28d('0x40')){var _0x1a86fd={};_0x1a86fd[_0x5e509a[_0xf28d('0x2a')]]={'$like':'%'+_0x4850d9[_0xf28d('0x33')][_0xf28d('0x3e')]+'%'};return _0x1a86fd;}})});}_0x20c600=_[_0xf28d('0x3f')]({},_0x20c600,_0x4850d9[_0xf28d('0x41')]);var _0x1d2600={'where':_0x20c600['where']};return db[_0xf28d('0x2d')][_0xf28d('0x20')](_0x1d2600)[_0xf28d('0x26')](function(_0x2f7316){_0x2cfa5d['count']=_0x2f7316;if(_0x4850d9[_0xf28d('0x33')][_0xf28d('0x42')]){_0x20c600[_0xf28d('0x43')]=[{'all':!![]}];}return db['WhatsappTransferReport']['findAll'](_0x20c600);})[_0xf28d('0x26')](function(_0x3da48e){_0x2cfa5d['rows']=_0x3da48e;return _0x2cfa5d;})['then'](respondWithFilteredResult(_0x499a81,_0x20c600))[_0xf28d('0x44')](handleError(_0x499a81,null));};exports[_0xf28d('0x45')]=function(_0x48135c,_0x544872){var _0x45b622={'raw':!![],'where':{'id':_0x48135c[_0xf28d('0x46')]['id']}},_0x1d01ec={};_0x1d01ec[_0xf28d('0x32')]=_[_0xf28d('0x47')](db[_0xf28d('0x2d')][_0xf28d('0x2e')]);_0x1d01ec[_0xf28d('0x33')]=_[_0xf28d('0x47')](_0x48135c[_0xf28d('0x33')]);_0x1d01ec['filters']=_[_0xf28d('0x35')](_0x1d01ec[_0xf28d('0x32')],_0x1d01ec['query']);_0x45b622[_0xf28d('0x36')]=_[_0xf28d('0x35')](_0x1d01ec[_0xf28d('0x32')],qs[_0xf28d('0x37')](_0x48135c[_0xf28d('0x33')][_0xf28d('0x37')]));_0x45b622[_0xf28d('0x36')]=_0x45b622[_0xf28d('0x36')][_0xf28d('0x38')]?_0x45b622[_0xf28d('0x36')]:_0x1d01ec[_0xf28d('0x32')];if(_0x48135c['query'][_0xf28d('0x42')]){_0x45b622[_0xf28d('0x43')]=[{'all':!![]}];}_0x45b622=_[_0xf28d('0x3f')]({},_0x45b622,_0x48135c[_0xf28d('0x41')]);return db[_0xf28d('0x2d')][_0xf28d('0x48')](_0x45b622)['then'](handleEntityNotFound(_0x544872,null))[_0xf28d('0x26')](respondWithResult(_0x544872,null))[_0xf28d('0x44')](handleError(_0x544872,null));};exports['create']=function(_0x456bff,_0x29d3b8){return db[_0xf28d('0x2d')][_0xf28d('0x49')](_0x456bff[_0xf28d('0x4a')],{})[_0xf28d('0x26')](respondWithResult(_0x29d3b8,0xc9))[_0xf28d('0x44')](handleError(_0x29d3b8,null));};exports['update']=function(_0x583dfc,_0x3ba795){if(_0x583dfc[_0xf28d('0x4a')]['id']){delete _0x583dfc[_0xf28d('0x4a')]['id'];}return db[_0xf28d('0x2d')][_0xf28d('0x48')]({'where':{'id':_0x583dfc[_0xf28d('0x46')]['id']}})[_0xf28d('0x26')](handleEntityNotFound(_0x3ba795,null))[_0xf28d('0x26')](saveUpdates(_0x583dfc['body'],null))['then'](respondWithResult(_0x3ba795,null))[_0xf28d('0x44')](handleError(_0x3ba795,null));};exports[_0xf28d('0x27')]=function(_0x3633d9,_0x2e72c8){return db[_0xf28d('0x2d')][_0xf28d('0x48')]({'where':{'id':_0x3633d9[_0xf28d('0x46')]['id']}})[_0xf28d('0x26')](handleEntityNotFound(_0x2e72c8,null))[_0xf28d('0x26')](removeEntity(_0x2e72c8,null))[_0xf28d('0x44')](handleError(_0x2e72c8,null));};exports['describe']=function(_0x104972,_0x160323){return db[_0xf28d('0x2d')]['describe']()['then'](respondWithResult(_0x160323,null))['catch'](handleError(_0x160323,null));}; \ No newline at end of file +var _0xfe4a=['send','index','map','WhatsappTransferReport','rawAttributes','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','update','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','error','stack','name'];(function(_0x94ed7c,_0x592bd8){var _0x4a9ae3=function(_0x125057){while(--_0x125057){_0x94ed7c['push'](_0x94ed7c['shift']());}};_0x4a9ae3(++_0x592bd8);}(_0xfe4a,0x10b));var _0xafe4=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0xfe4a[_0x4b2436];return _0x4f5ab2;};'use strict';var emlformat=require(_0xafe4('0x0'));var rimraf=require(_0xafe4('0x1'));var zipdir=require(_0xafe4('0x2'));var jsonpatch=require(_0xafe4('0x3'));var rp=require(_0xafe4('0x4'));var moment=require(_0xafe4('0x5'));var BPromise=require(_0xafe4('0x6'));var Mustache=require(_0xafe4('0x7'));var util=require('util');var path=require(_0xafe4('0x8'));var sox=require(_0xafe4('0x9'));var csv=require(_0xafe4('0xa'));var ejs=require(_0xafe4('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xafe4('0xc'));var squel=require(_0xafe4('0xd'));var crypto=require('crypto');var jsforce=require(_0xafe4('0xe'));var deskjs=require(_0xafe4('0xf'));var toCsv=require(_0xafe4('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xafe4('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xafe4('0x11'));var hardwareService=require(_0xafe4('0x12'));var logger=require(_0xafe4('0x13'))(_0xafe4('0x14'));var utils=require(_0xafe4('0x15'));var config=require(_0xafe4('0x16'));var licenseUtil=require(_0xafe4('0x17'));var db=require(_0xafe4('0x18'))['db'];function respondWithStatusCode(_0x5553c5,_0x1ed16b){_0x1ed16b=_0x1ed16b||0xcc;return function(_0x811f05){if(_0x811f05){return _0x5553c5[_0xafe4('0x19')](_0x1ed16b);}return _0x5553c5['status'](_0x1ed16b)['end']();};}function respondWithResult(_0xfcc728,_0x2a1068){_0x2a1068=_0x2a1068||0xc8;return function(_0x524004){if(_0x524004){return _0xfcc728[_0xafe4('0x1a')](_0x2a1068)[_0xafe4('0x1b')](_0x524004);}};}function respondWithFilteredResult(_0x309a9c,_0x254461){return function(_0x57ccea){if(_0x57ccea){var _0x452b6c=typeof _0x254461['offset']===_0xafe4('0x1c')&&typeof _0x254461[_0xafe4('0x1d')]===_0xafe4('0x1c');var _0x482cc7=_0x57ccea[_0xafe4('0x1e')];var _0x5b5aa3=_0x452b6c?0x0:_0x254461['offset'];var _0x12d9ab=_0x452b6c?_0x57ccea[_0xafe4('0x1e')]:_0x254461[_0xafe4('0x1f')]+_0x254461[_0xafe4('0x1d')];var _0x6d8b89;if(_0x12d9ab>=_0x482cc7){_0x12d9ab=_0x482cc7;_0x6d8b89=0xc8;}else{_0x6d8b89=0xce;}_0x309a9c[_0xafe4('0x1a')](_0x6d8b89);return _0x309a9c[_0xafe4('0x20')](_0xafe4('0x21'),_0x5b5aa3+'-'+_0x12d9ab+'/'+_0x482cc7)['json'](_0x57ccea);}return null;};}function patchUpdates(_0x300af5){return function(_0x512d04){try{jsonpatch[_0xafe4('0x22')](_0x512d04,_0x300af5,!![]);}catch(_0x39bb91){return BPromise['reject'](_0x39bb91);}return _0x512d04[_0xafe4('0x23')]();};}function saveUpdates(_0x531f80,_0xda7868){return function(_0x4a8f63){if(_0x4a8f63){return _0x4a8f63['update'](_0x531f80)[_0xafe4('0x24')](function(_0x130345){return _0x130345;});}return null;};}function removeEntity(_0x57628f,_0x3d65f7){return function(_0x4bc6f1){if(_0x4bc6f1){return _0x4bc6f1[_0xafe4('0x25')]()[_0xafe4('0x24')](function(){_0x57628f[_0xafe4('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa51208,_0x1af754){return function(_0xee0a4c){if(!_0xee0a4c){_0xa51208['sendStatus'](0x194);}return _0xee0a4c;};}function handleError(_0x22508d,_0x47ee7d){_0x47ee7d=_0x47ee7d||0x1f4;return function(_0x5b67d0){logger[_0xafe4('0x26')](_0x5b67d0[_0xafe4('0x27')]);if(_0x5b67d0[_0xafe4('0x28')]){delete _0x5b67d0[_0xafe4('0x28')];}_0x22508d[_0xafe4('0x1a')](_0x47ee7d)[_0xafe4('0x29')](_0x5b67d0);};}exports[_0xafe4('0x2a')]=function(_0x4c898b,_0x58c36c){var _0x1141e8={},_0x50b5d6={},_0x17ab12={'count':0x0,'rows':[]};var _0x1a4a91=_[_0xafe4('0x2b')](db[_0xafe4('0x2c')][_0xafe4('0x2d')],function(_0x1e9bfd){return{'name':_0x1e9bfd['fieldName'],'type':_0x1e9bfd['type'][_0xafe4('0x2e')]};});_0x50b5d6[_0xafe4('0x2f')]=_[_0xafe4('0x2b')](_0x1a4a91,_0xafe4('0x28'));_0x50b5d6[_0xafe4('0x30')]=_[_0xafe4('0x31')](_0x4c898b[_0xafe4('0x30')]);_0x50b5d6['filters']=_[_0xafe4('0x32')](_0x50b5d6[_0xafe4('0x2f')],_0x50b5d6[_0xafe4('0x30')]);_0x1141e8[_0xafe4('0x33')]=_['intersection'](_0x50b5d6['model'],qs[_0xafe4('0x34')](_0x4c898b[_0xafe4('0x30')][_0xafe4('0x34')]));_0x1141e8[_0xafe4('0x33')]=_0x1141e8[_0xafe4('0x33')]['length']?_0x1141e8[_0xafe4('0x33')]:_0x50b5d6[_0xafe4('0x2f')];if(!_0x4c898b[_0xafe4('0x30')][_0xafe4('0x35')](_0xafe4('0x36'))){_0x1141e8[_0xafe4('0x1d')]=qs[_0xafe4('0x1d')](_0x4c898b[_0xafe4('0x30')][_0xafe4('0x1d')]);_0x1141e8['offset']=qs[_0xafe4('0x1f')](_0x4c898b[_0xafe4('0x30')][_0xafe4('0x1f')]);}_0x1141e8[_0xafe4('0x37')]=qs[_0xafe4('0x38')](_0x4c898b[_0xafe4('0x30')][_0xafe4('0x38')]);_0x1141e8[_0xafe4('0x39')]=qs['filters'](_[_0xafe4('0x3a')](_0x4c898b[_0xafe4('0x30')],_0x50b5d6[_0xafe4('0x3b')]),_0x1a4a91);if(_0x4c898b[_0xafe4('0x30')][_0xafe4('0x3c')]){_0x1141e8[_0xafe4('0x39')]=_[_0xafe4('0x3d')](_0x1141e8[_0xafe4('0x39')],{'$or':_[_0xafe4('0x2b')](_0x1a4a91,function(_0x1a550d){if(_0x1a550d[_0xafe4('0x3e')]!==_0xafe4('0x3f')){var _0x7b64e2={};_0x7b64e2[_0x1a550d[_0xafe4('0x28')]]={'$like':'%'+_0x4c898b[_0xafe4('0x30')][_0xafe4('0x3c')]+'%'};return _0x7b64e2;}})});}_0x1141e8=_[_0xafe4('0x3d')]({},_0x1141e8,_0x4c898b[_0xafe4('0x40')]);var _0xe5eca9={'where':_0x1141e8['where']};return db[_0xafe4('0x2c')][_0xafe4('0x1e')](_0xe5eca9)[_0xafe4('0x24')](function(_0x1e1ce4){_0x17ab12[_0xafe4('0x1e')]=_0x1e1ce4;if(_0x4c898b[_0xafe4('0x30')][_0xafe4('0x41')]){_0x1141e8[_0xafe4('0x42')]=[{'all':!![]}];}return db[_0xafe4('0x2c')][_0xafe4('0x43')](_0x1141e8);})[_0xafe4('0x24')](function(_0x3540ad){_0x17ab12[_0xafe4('0x44')]=_0x3540ad;return _0x17ab12;})['then'](respondWithFilteredResult(_0x58c36c,_0x1141e8))[_0xafe4('0x45')](handleError(_0x58c36c,null));};exports[_0xafe4('0x46')]=function(_0x550da5,_0x481751){var _0x17cf78={'raw':!![],'where':{'id':_0x550da5[_0xafe4('0x47')]['id']}},_0x28b9b0={};_0x28b9b0['model']=_[_0xafe4('0x31')](db[_0xafe4('0x2c')][_0xafe4('0x2d')]);_0x28b9b0[_0xafe4('0x30')]=_[_0xafe4('0x31')](_0x550da5[_0xafe4('0x30')]);_0x28b9b0[_0xafe4('0x3b')]=_[_0xafe4('0x32')](_0x28b9b0[_0xafe4('0x2f')],_0x28b9b0[_0xafe4('0x30')]);_0x17cf78[_0xafe4('0x33')]=_[_0xafe4('0x32')](_0x28b9b0['model'],qs[_0xafe4('0x34')](_0x550da5[_0xafe4('0x30')][_0xafe4('0x34')]));_0x17cf78[_0xafe4('0x33')]=_0x17cf78[_0xafe4('0x33')]['length']?_0x17cf78['attributes']:_0x28b9b0[_0xafe4('0x2f')];if(_0x550da5[_0xafe4('0x30')][_0xafe4('0x41')]){_0x17cf78[_0xafe4('0x42')]=[{'all':!![]}];}_0x17cf78=_['merge']({},_0x17cf78,_0x550da5[_0xafe4('0x40')]);return db[_0xafe4('0x2c')]['find'](_0x17cf78)[_0xafe4('0x24')](handleEntityNotFound(_0x481751,null))[_0xafe4('0x24')](respondWithResult(_0x481751,null))[_0xafe4('0x45')](handleError(_0x481751,null));};exports[_0xafe4('0x48')]=function(_0x563f3f,_0x27c20b){return db['WhatsappTransferReport'][_0xafe4('0x48')](_0x563f3f[_0xafe4('0x49')],{})[_0xafe4('0x24')](respondWithResult(_0x27c20b,0xc9))[_0xafe4('0x45')](handleError(_0x27c20b,null));};exports[_0xafe4('0x4a')]=function(_0x551a79,_0x5527b6){if(_0x551a79['body']['id']){delete _0x551a79[_0xafe4('0x49')]['id'];}return db[_0xafe4('0x2c')][_0xafe4('0x4b')]({'where':{'id':_0x551a79[_0xafe4('0x47')]['id']}})[_0xafe4('0x24')](handleEntityNotFound(_0x5527b6,null))['then'](saveUpdates(_0x551a79[_0xafe4('0x49')],null))[_0xafe4('0x24')](respondWithResult(_0x5527b6,null))[_0xafe4('0x45')](handleError(_0x5527b6,null));};exports[_0xafe4('0x25')]=function(_0x2c7cf0,_0x2555ed){return db[_0xafe4('0x2c')][_0xafe4('0x4b')]({'where':{'id':_0x2c7cf0[_0xafe4('0x47')]['id']}})[_0xafe4('0x24')](handleEntityNotFound(_0x2555ed,null))[_0xafe4('0x24')](removeEntity(_0x2555ed,null))[_0xafe4('0x45')](handleError(_0x2555ed,null));};exports[_0xafe4('0x4c')]=function(_0x255b1e,_0x74ff38){return db[_0xafe4('0x2c')][_0xafe4('0x4c')]()[_0xafe4('0x24')](respondWithResult(_0x74ff38,null))[_0xafe4('0x45')](handleError(_0x74ff38,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 4e05928..41ab31a 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 _0xcf9e=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','report_whatsapp_transfer','uniqueid','lodash'];(function(_0x5050f4,_0x36fc54){var _0x656400=function(_0x3316dc){while(--_0x3316dc){_0x5050f4['push'](_0x5050f4['shift']());}};_0x656400(++_0x36fc54);}(_0xcf9e,0x1c1));var _0xecf9=function(_0x55ef89,_0x283422){_0x55ef89=_0x55ef89-0x0;var _0x138719=_0xcf9e[_0x55ef89];return _0x138719;};'use strict';var _=require(_0xecf9('0x0'));var util=require(_0xecf9('0x1'));var logger=require(_0xecf9('0x2'))('api');var moment=require(_0xecf9('0x3'));var BPromise=require(_0xecf9('0x4'));var rp=require(_0xecf9('0x5'));var fs=require('fs');var path=require(_0xecf9('0x6'));var rimraf=require(_0xecf9('0x7'));var config=require('../../config/environment');var attributes=require('./whatsappTransferReport.attributes');module['exports']=function(_0x49c586,_0x5f3eac){return _0x49c586['define']('WhatsappTransferReport',attributes,{'tableName':_0xecf9('0x8'),'paranoid':![],'indexes':[{'name':_0xecf9('0x9'),'fields':[_0xecf9('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8359=['../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x50bf5a,_0x807bba){var _0x4ddc1d=function(_0x349a61){while(--_0x349a61){_0x50bf5a['push'](_0x50bf5a['shift']());}};_0x4ddc1d(++_0x807bba);}(_0x8359,0x149));var _0x9835=function(_0x417955,_0x4ed8c8){_0x417955=_0x417955-0x0;var _0x3a94ef=_0x8359[_0x417955];return _0x3a94ef;};'use strict';var _=require(_0x9835('0x0'));var util=require('util');var logger=require(_0x9835('0x1'))(_0x9835('0x2'));var moment=require(_0x9835('0x3'));var BPromise=require('bluebird');var rp=require(_0x9835('0x4'));var fs=require('fs');var path=require(_0x9835('0x5'));var rimraf=require(_0x9835('0x6'));var config=require(_0x9835('0x7'));var attributes=require(_0x9835('0x8'));module[_0x9835('0x9')]=function(_0xe4acab,_0x49d0e2){return _0xe4acab[_0x9835('0xa')](_0x9835('0xb'),attributes,{'tableName':_0x9835('0xc'),'paranoid':![],'indexes':[{'name':_0x9835('0xd'),'fields':[_0x9835('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 57d2ed6..c4d05cb 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 _0xe5c3=['error','code','WhatsappTransferReport,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','request','then','info','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xe5c3,0x1aa));var _0x3e5c=function(_0x5e36d1,_0x471178){_0x5e36d1=_0x5e36d1-0x0;var _0x950b9e=_0xe5c3[_0x5e36d1];return _0x950b9e;};'use strict';var _=require(_0x3e5c('0x0'));var util=require('util');var moment=require(_0x3e5c('0x1'));var BPromise=require(_0x3e5c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3e5c('0x3'));var db=require(_0x3e5c('0x4'))['db'];var utils=require(_0x3e5c('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x3e5c('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3e5c('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34bb5f,_0x71695a,_0x53e50f){return new BPromise(function(_0x2a9155,_0x215176){return client[_0x3e5c('0x8')](_0x34bb5f,_0x53e50f)[_0x3e5c('0x9')](function(_0x39adc7){logger[_0x3e5c('0xa')]('WhatsappTransferReport,\x20%s,\x20%s',_0x71695a,_0x3e5c('0xb'));logger[_0x3e5c('0xc')](_0x3e5c('0xd'),_0x71695a,'request\x20sent',JSON[_0x3e5c('0xe')](_0x39adc7));if(_0x39adc7['error']){if(_0x39adc7[_0x3e5c('0xf')][_0x3e5c('0x10')]===0x1f4){logger[_0x3e5c('0xf')](_0x3e5c('0x11'),_0x71695a,_0x39adc7[_0x3e5c('0xf')][_0x3e5c('0x12')]);return _0x215176(_0x39adc7[_0x3e5c('0xf')][_0x3e5c('0x12')]);}logger['error'](_0x3e5c('0x11'),_0x71695a,_0x39adc7[_0x3e5c('0xf')][_0x3e5c('0x12')]);return _0x2a9155(_0x39adc7['error'][_0x3e5c('0x12')]);}else{logger[_0x3e5c('0xa')](_0x3e5c('0x11'),_0x71695a,_0x3e5c('0xb'));_0x2a9155(_0x39adc7[_0x3e5c('0x13')]['message']);}})[_0x3e5c('0x14')](function(_0x16e2d4){logger[_0x3e5c('0xf')](_0x3e5c('0x11'),_0x71695a,_0x16e2d4);_0x215176(_0x16e2d4);});});} \ No newline at end of file +var _0x5c91=['info','WhatsappTransferReport,\x20%s,\x20%s','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','request','then'];(function(_0x29b902,_0x4baa6f){var _0x34d0f6=function(_0x37a2cf){while(--_0x37a2cf){_0x29b902['push'](_0x29b902['shift']());}};_0x34d0f6(++_0x4baa6f);}(_0x5c91,0x113));var _0x15c9=function(_0x4af815,_0x22f3e9){_0x4af815=_0x4af815-0x0;var _0x5dec4f=_0x5c91[_0x4af815];return _0x5dec4f;};'use strict';var _=require(_0x15c9('0x0'));var util=require(_0x15c9('0x1'));var moment=require(_0x15c9('0x2'));var BPromise=require(_0x15c9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x15c9('0x4'));var db=require(_0x15c9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x15c9('0x6'))(_0x15c9('0x7'));var config=require(_0x15c9('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1a2271,_0x50bf4c,_0x1b8b83){return new BPromise(function(_0x1527dc,_0x103c18){return client[_0x15c9('0x9')](_0x1a2271,_0x1b8b83)[_0x15c9('0xa')](function(_0x3a54d2){logger[_0x15c9('0xb')](_0x15c9('0xc'),_0x50bf4c,'request\x20sent');logger[_0x15c9('0xd')](_0x15c9('0xe'),_0x50bf4c,_0x15c9('0xf'),JSON[_0x15c9('0x10')](_0x3a54d2));if(_0x3a54d2['error']){if(_0x3a54d2[_0x15c9('0x11')][_0x15c9('0x12')]===0x1f4){logger[_0x15c9('0x11')](_0x15c9('0xc'),_0x50bf4c,_0x3a54d2[_0x15c9('0x11')][_0x15c9('0x13')]);return _0x103c18(_0x3a54d2[_0x15c9('0x11')][_0x15c9('0x13')]);}logger[_0x15c9('0x11')]('WhatsappTransferReport,\x20%s,\x20%s',_0x50bf4c,_0x3a54d2[_0x15c9('0x11')][_0x15c9('0x13')]);return _0x1527dc(_0x3a54d2['error'][_0x15c9('0x13')]);}else{logger[_0x15c9('0xb')](_0x15c9('0xc'),_0x50bf4c,'request\x20sent');_0x1527dc(_0x3a54d2[_0x15c9('0x14')][_0x15c9('0x13')]);}})[_0x15c9('0x15')](function(_0x33be7a){logger[_0x15c9('0x11')]('WhatsappTransferReport,\x20%s,\x20%s',_0x50bf4c,_0x33be7a);_0x103c18(_0x33be7a);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 5ffafe1..ec425f7 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x60b6=['sync','listen','then','info','start','Online\x20apps:','map','online','name','join','Offline\x20apps:','status','default','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./rpc','./config/environment','./config/logger','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','sequelize'];(function(_0x5a603f,_0x4e4409){var _0x175309=function(_0x514e60){while(--_0x514e60){_0x5a603f['push'](_0x5a603f['shift']());}};_0x175309(++_0x4e4409);}(_0x60b6,0x1ec));var _0x660b=function(_0x1d1989,_0x110d07){_0x1d1989=_0x1d1989-0x0;var _0x2da3fc=_0x60b6[_0x1d1989];return _0x2da3fc;};'use strict';var _=require('lodash');var mysqldb=require(_0x660b('0x0'));var rpc=require(_0x660b('0x1'));var config=require(_0x660b('0x2'));var logger=require(_0x660b('0x3'))('app');var pm2=require('./config/pm2');var pm2Config=require('./config/pm2/config');var schedule=require(_0x660b('0x4'));var chat=require(_0x660b('0x5'));var whatsapp=require(_0x660b('0x6'));var transcribe=require('./config/schedule/transcribe');function main(){return mysqldb['db'][_0x660b('0x7')][_0x660b('0x8')]()['then'](function(){return rpc[_0x660b('0x9')]();})[_0x660b('0xa')](function(_0x1b9aed){logger[_0x660b('0xb')](_0x1b9aed);return chat[_0x660b('0xc')]();})[_0x660b('0xa')](function(){return whatsapp['start']();})[_0x660b('0xa')](function(){return schedule['start']();})[_0x660b('0xa')](function(){return transcribe[_0x660b('0xc')]();})['then'](function(_0x253e2b){logger[_0x660b('0xb')](_0x253e2b);return pm2['start'](pm2Config);})['then'](function(_0x2daf2f){logger[_0x660b('0xb')](_0x660b('0xd'),_[_0x660b('0xe')](_['filter'](_0x2daf2f,{'status':_0x660b('0xf')}),_0x660b('0x10'))[_0x660b('0x11')]());logger[_0x660b('0xb')](_0x660b('0x12'),_[_0x660b('0xe')](_['filter'](_0x2daf2f,function(_0x1fa31c){return _0x1fa31c[_0x660b('0x13')]!=='online';}),_0x660b('0x10'))[_0x660b('0x11')]()||'None');config['seedDB']&&require('./config/seedDB')[_0x660b('0x14')]();require('./config/license')[_0x660b('0x14')]();})[_0x660b('0x15')](function(_0x2fd00c){logger[_0x660b('0x16')](_0x660b('0x17'),_0x2fd00c);process[_0x660b('0x18')](0x1);});}main(); \ No newline at end of file +var _0xe486=['status','join','None','default','catch','error','exit','lodash','./mysqldb','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sync','listen','then','info','start','Online\x20apps:','map','filter','online','name','Offline\x20apps:'];(function(_0x1c43ac,_0x45465c){var _0xe3170d=function(_0x21eef0){while(--_0x21eef0){_0x1c43ac['push'](_0x1c43ac['shift']());}};_0xe3170d(++_0x45465c);}(_0xe486,0x180));var _0x6e48=function(_0x2416b9,_0x313d5d){_0x2416b9=_0x2416b9-0x0;var _0x9eefeb=_0xe486[_0x2416b9];return _0x9eefeb;};'use strict';var _=require(_0x6e48('0x0'));var mysqldb=require(_0x6e48('0x1'));var rpc=require('./rpc');var config=require(_0x6e48('0x2'));var logger=require(_0x6e48('0x3'))(_0x6e48('0x4'));var pm2=require(_0x6e48('0x5'));var pm2Config=require(_0x6e48('0x6'));var schedule=require(_0x6e48('0x7'));var chat=require(_0x6e48('0x8'));var whatsapp=require(_0x6e48('0x9'));var transcribe=require(_0x6e48('0xa'));function main(){return mysqldb['db']['sequelize'][_0x6e48('0xb')]()['then'](function(){return rpc[_0x6e48('0xc')]();})[_0x6e48('0xd')](function(_0x35cad1){logger[_0x6e48('0xe')](_0x35cad1);return chat[_0x6e48('0xf')]();})[_0x6e48('0xd')](function(){return whatsapp['start']();})[_0x6e48('0xd')](function(){return schedule[_0x6e48('0xf')]();})[_0x6e48('0xd')](function(){return transcribe[_0x6e48('0xf')]();})[_0x6e48('0xd')](function(_0x100d1f){logger[_0x6e48('0xe')](_0x100d1f);return pm2[_0x6e48('0xf')](pm2Config);})[_0x6e48('0xd')](function(_0x44df17){logger['info'](_0x6e48('0x10'),_[_0x6e48('0x11')](_[_0x6e48('0x12')](_0x44df17,{'status':_0x6e48('0x13')}),_0x6e48('0x14'))['join']());logger[_0x6e48('0xe')](_0x6e48('0x15'),_['map'](_[_0x6e48('0x12')](_0x44df17,function(_0x12b9fa){return _0x12b9fa[_0x6e48('0x16')]!==_0x6e48('0x13');}),_0x6e48('0x14'))[_0x6e48('0x17')]()||_0x6e48('0x18'));config['seedDB']&&require('./config/seedDB')[_0x6e48('0x19')]();require('./config/license')['default']();})[_0x6e48('0x1a')](function(_0x2f9ee7){logger[_0x6e48('0x1b')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x2f9ee7);process[_0x6e48('0x1c')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 59f66f1..5299f38 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 _0x759a=['passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','downloadOmnichannelInteractions','isAuthenticated','use','user','ChatInteraction','findOne','disposition','closed','unmanaged','json','catch','headers','authorization','startsWith','User','then','pass','status','Wrong\x20credentials.','Bearer','query','apikey','getUuid','find','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','User\x20not\x20found.','getLicense','Forbidden','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','redirect','/dashboards/general','send','isNil','apiKeyNonce','generateApiKey','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','splice','encryptString','join','promisify','secret','payload','verify','hex','floor','toString','HS512','../../mysqldb','../../config/license/util','../encryptor','lodash','jsonwebtoken','composable-middleware','crypto','util','moment','secrets','session','role','fullname','name','internal','email','userpic','md5secret','chatPause','smsPause','showWebBar','allowmessenger'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x759a,0x137));var _0xa759=function(_0x16ea76,_0x54b900){_0x16ea76=_0x16ea76-0x0;var _0x3bac5=_0x759a[_0x16ea76];return _0x3bac5;};'use strict';var db=require(_0xa759('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0xa759('0x1'));var encryptor=require(_0xa759('0x2'));var _=require(_0xa759('0x3'));var jwt=require(_0xa759('0x4'));var expressJwt=require('express-jwt');var compose=require(_0xa759('0x5'));var basicAuth=require('basic-auth');var crypto=require(_0xa759('0x6'));var BPromise=require('bluebird');var util=require(_0xa759('0x7'));var moment=require(_0xa759('0x8'));var validateJwt=expressJwt({'secret':config[_0xa759('0x9')][_0xa759('0xa')]});var userAttributes=['id',_0xa759('0xb'),_0xa759('0xc'),_0xa759('0xd'),_0xa759('0xe'),_0xa759('0xf'),_0xa759('0x10'),'permissions',_0xa759('0x11'),'voicePause',_0xa759('0x12'),'mailPause','faxPause',_0xa759('0x13'),'openchannelPause','pauseType',_0xa759('0x14'),'lastLoginAt','lastPauseAt','crudPermissions',_0xa759('0x15'),_0xa759('0x16'),_0xa759('0x17'),_0xa759('0x18'),_0xa759('0x19'),_0xa759('0x1a'),'phoneBarEnableRecording',_0xa759('0x1b'),_0xa759('0x1c'),_0xa759('0x1d'),'phoneBarPrefixRequired',_0xa759('0x1e'),_0xa759('0x1f'),_0xa759('0x20'),_0xa759('0x21'),_0xa759('0x22'),_0xa759('0x23'),_0xa759('0x24'),'wssPort','downloadVoiceRecordings',_0xa759('0x25'),'downloadAttachments'];exports['isChatInteractionAuthorized']=function(){return this[_0xa759('0x26')](!![])[_0xa759('0x27')](function(_0x5cd58e,_0x7beabf,_0x42d54b){if(_0x5cd58e[_0xa759('0x28')]){_0x42d54b();}else{return db[_0xa759('0x29')][_0xa759('0x2a')]({'where':{'id':_0x5cd58e['params']['id']},'attributes':['id','closed',_0xa759('0x2b')],'raw':!![]})['then'](function(_0x457360){if(_0x457360&&_0x457360[_0xa759('0x2c')]){return _0x7beabf['status'](_0x457360['disposition']===_0xa759('0x2d')?0x195:0x193)[_0xa759('0x2e')]({'message':_0x457360[_0xa759('0x2b')]===_0xa759('0x2d')?'Unmanaged.':'Forbidden.'});}else{_0x42d54b();}})[_0xa759('0x2f')](function(_0x1abb3a){_0x42d54b(_0x1abb3a);});}});};exports[_0xa759('0x26')]=function isAuthenticated(_0x3ec367){return compose()[_0xa759('0x27')](function(_0x2a1016,_0x4bb510,_0x5b0725){var _0x56d444;if(_0x2a1016[_0xa759('0x30')][_0xa759('0x31')]){if(_[_0xa759('0x32')](_0x2a1016[_0xa759('0x30')][_0xa759('0x31')],'Basic')){var _0x395e37=basicAuth(_0x2a1016);db[_0xa759('0x33')]['find']({'where':{'name':_0x395e37[_0xa759('0xd')]}})[_0xa759('0x34')](function(_0x24c101){if(!_0x24c101||!_0x24c101['authenticate'](_0x395e37[_0xa759('0x35')])){return _0x4bb510[_0xa759('0x36')](0x191)[_0xa759('0x2e')]({'message':_0xa759('0x37')});}_0x2a1016[_0xa759('0x28')]={'id':_0x24c101['id']};_0x5b0725();})[_0xa759('0x2f')](function(_0x24e54f){_0x5b0725(_0x24e54f);});}else if(_[_0xa759('0x32')](_0x2a1016[_0xa759('0x30')][_0xa759('0x31')],_0xa759('0x38'))){validateJwt(_0x2a1016,_0x4bb510,_0x5b0725);}else{if(_0x3ec367){_0x5b0725();}else{return _0x4bb510[_0xa759('0x36')](0x193)[_0xa759('0x2e')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x2a1016[_0xa759('0x39')][_0xa759('0x3a')]){try{var _0x2a10a8={'audience':hardwareConf[_0xa759('0x3b')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x2a1016['query'][_0xa759('0x3a')],_0x2a10a8)[_0xa759('0x34')](function(_0x5dfbca){return db[_0xa759('0x33')][_0xa759('0x3c')]({'where':{'id':_0x5dfbca[_0xa759('0x3d')]}})[_0xa759('0x34')](function(_0x5b1a40){_0x56d444=_0x5b1a40;return db[_0xa759('0x3e')][_0xa759('0x2a')]({'where':{'id':0x1},'attributes':[_0xa759('0x3f'),_0xa759('0x40')],'raw':!![]});})[_0xa759('0x34')](function(_0x5ec4d7){if(!_0x56d444||!_[_0xa759('0x41')](_0x56d444['apiKeyNonce'],_0x5dfbca[_0xa759('0x42')])){return _0x4bb510[_0xa759('0x36')](0x191)[_0xa759('0x2e')]({'message':_0xa759('0x43')});}if(_0x56d444[_0xa759('0x44')]){return _0x4bb510[_0xa759('0x36')](0x191)[_0xa759('0x2e')]({'message':_0xa759('0x45')});}if(_0x56d444[_0xa759('0x46')]){if(_0x5ec4d7[_0xa759('0x40')]>0x0){if(moment(_0x56d444[_0xa759('0x47')])[_0xa759('0x48')](_0x5ec4d7['blockDuration'],_0xa759('0x49'))>moment()){return _0x4bb510[_0xa759('0x36')](0x191)[_0xa759('0x2e')]({'message':_0xa759('0x45')});}}else{return _0x4bb510[_0xa759('0x36')](0x191)[_0xa759('0x2e')]({'message':_0xa759('0x45')});}}_0x2a1016[_0xa759('0x28')]={'id':_0x56d444['id']};_0x5b0725();});})[_0xa759('0x2f')](function(){return _0x4bb510[_0xa759('0x36')](0x191)[_0xa759('0x2e')]({'message':_0xa759('0x45')});});}catch(_0x2901dc){_0x5b0725(_0x2901dc);}}else if(_0x3ec367){_0x5b0725();}else{return _0x4bb510[_0xa759('0x36')](0x193)[_0xa759('0x2e')]({'message':'Unknown\x20authorization\x20format'});}})[_0xa759('0x27')](function(_0xfeaab5,_0x1bb361,_0x5c9721){if(_0xfeaab5[_0xa759('0x28')]){db['User'][_0xa759('0x3c')]({'where':{'id':_0xfeaab5[_0xa759('0x28')]['id']},'attributes':userAttributes})[_0xa759('0x34')](function(_0x4432f8){if(!_0x4432f8){return _0x1bb361['status'](0x194)[_0xa759('0x2e')]({'message':_0xa759('0x4a')});}_0xfeaab5['user']=_0x4432f8;_0x5c9721();})[_0xa759('0x2f')](function(_0x464250){_0x5c9721(_0x464250);});}else if(_0x3ec367){_0x5c9721();}else{return _0x1bb361['status'](0x194)[_0xa759('0x2e')]({'message':'User\x20object\x20not\x20found.'});}});};exports['canUpdate']=function canUpdate(){return compose()['use'](function(_0x40401d,_0x123e51,_0x356614){return licenseUtil[_0xa759('0x4b')]()['then'](function(_0x20760b){if(_0x20760b['update']){_0x356614();}else{return _0x123e51[_0xa759('0x36')](0x193)['json']({'message':_0xa759('0x4c')});}})[_0xa759('0x2f')](function(_0x168999){_0x356614(_0x168999);});});};exports['isMiddleware']=function(_0x1a4604,_0x338233,_0x208eb4){_0x1a4604['isMiddleware']=!![];return _0x208eb4();};exports[_0xa759('0x4d')]=function signToken(_0x66a4e){return signJwt(_0x66a4e);};exports['setTokenCookie']=function(_0xe5718e,_0xd8f322){if(!_0xe5718e['user']){return _0xd8f322[_0xa759('0x36')](0x194)['json']({'message':_0xa759('0x4e')});}var _0x35e39b={'payload':{'id':_0xe5718e[_0xa759('0x28')]['id'],'role':_0xe5718e[_0xa759('0x28')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x35e39b)[_0xa759('0x34')](function(_0xaab27f){_0xd8f322['cookie']('motion.token',_0xaab27f);_0xd8f322[_0xa759('0x4f')](_0xa759('0x50'));})[_0xa759('0x2f')](function(_0x4fba52){return _0xd8f322[_0xa759('0x36')](0x1f4)[_0xa759('0x51')](_0x4fba52);});};exports['retrieveApiKey']=function(_0x17d4aa){if(_[_0xa759('0x52')](_0x17d4aa[_0xa759('0x53')])||_[_0xa759('0x52')](_0x17d4aa['apiKeyIat'])){return null;}else{return createJwt(_0x17d4aa);}};exports[_0xa759('0x54')]=function(_0x4b62fc){_0x4b62fc[_0xa759('0x53')]=generateNonce();_0x4b62fc[_0xa759('0x55')]=generateIssuedAt();return createJwt(_0x4b62fc);};exports[_0xa759('0x56')]=function(_0xe1483e,_0x1d16e6){var _0x39f55c=_0xe1483e[_0xa759('0x39')]['apikey'];if(_0x39f55c){var _0x41923e={'nonce':_0x1d16e6['apiKeyNonce'],'iat':_0x1d16e6[_0xa759('0x55')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xa759('0x3b')]()};return verifyJwt(_0x39f55c,_0x41923e)[_0xa759('0x34')](function(){return generateApiKey(_0x1d16e6);});}else{throw{'message':_0xa759('0x57')};}};exports['validatePasswordPattern']=function(_0x1f46c1){var _0xc39fa9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0xc39fa9[_0xa759('0x58')](_0x1f46c1))throw new db[(_0xa759('0x59'))][(_0xa759('0x5a'))](_0xa759('0x5b'));return;};exports[_0xa759('0x5c')]=function(_0x32ff20,_0x1836ad,_0x3ebc50){var _0x324a8b=encryptor[_0xa759('0x5d')](_0x1836ad)[_0xa759('0x5e')](',');for(var _0x208052=0x0;_0x208052<_0x3ebc50;_0x208052++){if(!_0x324a8b[_0x208052])break;if(_0x32ff20[_0xa759('0x5f')]()===_0x324a8b[_0x208052][_0xa759('0x5f')]()){var _0x2b947b=util[_0xa759('0x60')](_0xa759('0x61'),_0x3ebc50);if(_0x3ebc50===0x1){_0x2b947b='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0xa759('0x59'))][(_0xa759('0x5a'))](_0x2b947b);}}return;};exports[_0xa759('0x62')]=function(_0x50fef6,_0x58d093){var _0x239388=_0x58d093?encryptor['decryptString'](_0x58d093)[_0xa759('0x5e')](','):[];if(_0x239388[_0xa759('0x63')]===0x5){_0x239388[_0xa759('0x64')](-0x1,0x1);}_0x239388['unshift'](_0x50fef6);return encryptor[_0xa759('0x65')](_0x239388[_0xa759('0x66')](','));};function signJwt(_0x5c5240){var _0x2f51cc=BPromise[_0xa759('0x67')](jwt['sign'],{'context':jwt});var _0x403280=_0x5c5240[_0xa759('0x68')]||config[_0xa759('0x9')][_0xa759('0xa')];return new BPromise(function(_0x2c4062,_0xc5bd13){_0x2f51cc(_0x5c5240[_0xa759('0x69')],_0x403280,_0x5c5240['options'])['then'](function(_0xb0acd8){_0x2c4062(_0xb0acd8);})[_0xa759('0x2f')](function(_0x4abe53){_0xc5bd13(_0x4abe53);});});}function verifyJwt(_0x2dc080,_0x4295f0,_0x35ac59){var _0x1a6a92=BPromise[_0xa759('0x67')](jwt[_0xa759('0x6a')],{'context':jwt});var _0xec1878=_0x35ac59||config['secrets'][_0xa759('0xa')];return new BPromise(function(_0x5b1bf1,_0x2dca72){_0x1a6a92(_0x2dc080,_0xec1878,_0x4295f0)[_0xa759('0x34')](function(_0x4aa263){_0x5b1bf1(_0x4aa263);})[_0xa759('0x2f')](function(_0x5efd83){_0x2dca72(_0x5efd83);});});}function generateNonce(){return crypto['randomBytes'](0x10)['toString'](_0xa759('0x6b'));}function generateIssuedAt(){return Math[_0xa759('0x6c')](Date['now']()/0x3e8)[_0xa759('0x6d')]();}function createJwt(_0x3adb23){var _0x5c2519={'payload':{'iat':_0x3adb23['apiKeyIat'],'nonce':_0x3adb23[_0xa759('0x53')]},'options':{'algorithm':_0xa759('0x6e'),'subject':_0x3adb23['id'][_0xa759('0x6d')](),'issuer':hardwareConf[_0xa759('0x3b')](),'audience':hardwareConf[_0xa759('0x3b')]()}};return signJwt(_0x5c2519)[_0xa759('0x34')](function(_0x18f74c){return{'iat':_0x3adb23['apiKeyIat'],'nonce':_0x3adb23[_0xa759('0x53')],'token':_0x18f74c};});} \ No newline at end of file +var _0x6ae3=['User','name','pass','Wrong\x20credentials.','Unknown\x20authorization\x20format','query','apikey','getUuid','find','findOne','blockDuration','apiKeyNonce','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','canUpdate','getLicense','update','Forbidden','isMiddleware','signToken','role','cookie','motion.token','redirect','/dashboards/general','send','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','unshift','encryptString','join','promisify','payload','options','verify','secrets','randomBytes','hex','floor','toString','HS512','../../mysqldb','../../config/license/hardware','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','bluebird','moment','session','fullname','internal','email','userpic','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','crudPermissions','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','privacyEnabled','settingsEnabled','wssPort','downloadOmnichannelInteractions','downloadAttachments','use','user','ChatInteraction','params','closed','disposition','then','status','unmanaged','json','Unmanaged.','Forbidden.','catch','isAuthenticated','headers','authorization','startsWith'];(function(_0x9cd9fb,_0x25338c){var _0x207fcd=function(_0x24b005){while(--_0x24b005){_0x9cd9fb['push'](_0x9cd9fb['shift']());}};_0x207fcd(++_0x25338c);}(_0x6ae3,0x127));var _0x36ae=function(_0x5dd56a,_0x3ab71b){_0x5dd56a=_0x5dd56a-0x0;var _0x22fb2b=_0x6ae3[_0x5dd56a];return _0x22fb2b;};'use strict';var db=require(_0x36ae('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0x36ae('0x1'));var licenseUtil=require('../../config/license/util');var encryptor=require(_0x36ae('0x2'));var _=require(_0x36ae('0x3'));var jwt=require(_0x36ae('0x4'));var expressJwt=require(_0x36ae('0x5'));var compose=require(_0x36ae('0x6'));var basicAuth=require(_0x36ae('0x7'));var crypto=require('crypto');var BPromise=require(_0x36ae('0x8'));var util=require('util');var moment=require(_0x36ae('0x9'));var validateJwt=expressJwt({'secret':config['secrets'][_0x36ae('0xa')]});var userAttributes=['id','role',_0x36ae('0xb'),'name',_0x36ae('0xc'),_0x36ae('0xd'),_0x36ae('0xe'),'permissions',_0x36ae('0xf'),_0x36ae('0x10'),_0x36ae('0x11'),_0x36ae('0x12'),_0x36ae('0x13'),_0x36ae('0x14'),_0x36ae('0x15'),_0x36ae('0x16'),_0x36ae('0x17'),'lastLoginAt','lastPauseAt',_0x36ae('0x18'),'allowmessenger',_0x36ae('0x19'),_0x36ae('0x1a'),_0x36ae('0x1b'),_0x36ae('0x1c'),_0x36ae('0x1d'),_0x36ae('0x1e'),_0x36ae('0x1f'),_0x36ae('0x20'),_0x36ae('0x21'),'phoneBarPrefixRequired',_0x36ae('0x22'),_0x36ae('0x23'),'hotdesk',_0x36ae('0x24'),'userProfileId',_0x36ae('0x25'),_0x36ae('0x26'),_0x36ae('0x27'),'downloadVoiceRecordings',_0x36ae('0x28'),_0x36ae('0x29')];exports['isChatInteractionAuthorized']=function(){return this['isAuthenticated'](!![])[_0x36ae('0x2a')](function(_0x576345,_0x404041,_0x1f4bb9){if(_0x576345[_0x36ae('0x2b')]){_0x1f4bb9();}else{return db[_0x36ae('0x2c')]['findOne']({'where':{'id':_0x576345[_0x36ae('0x2d')]['id']},'attributes':['id',_0x36ae('0x2e'),_0x36ae('0x2f')],'raw':!![]})[_0x36ae('0x30')](function(_0xd96bc8){if(_0xd96bc8&&_0xd96bc8['closed']){return _0x404041[_0x36ae('0x31')](_0xd96bc8[_0x36ae('0x2f')]===_0x36ae('0x32')?0x195:0x193)[_0x36ae('0x33')]({'message':_0xd96bc8['disposition']===_0x36ae('0x32')?_0x36ae('0x34'):_0x36ae('0x35')});}else{_0x1f4bb9();}})[_0x36ae('0x36')](function(_0x157b17){_0x1f4bb9(_0x157b17);});}});};exports[_0x36ae('0x37')]=function isAuthenticated(_0x55215e){return compose()[_0x36ae('0x2a')](function(_0x510d28,_0x5f0110,_0x16b181){var _0x74f73d;if(_0x510d28[_0x36ae('0x38')][_0x36ae('0x39')]){if(_[_0x36ae('0x3a')](_0x510d28[_0x36ae('0x38')][_0x36ae('0x39')],'Basic')){var _0x24caf4=basicAuth(_0x510d28);db[_0x36ae('0x3b')]['find']({'where':{'name':_0x24caf4[_0x36ae('0x3c')]}})[_0x36ae('0x30')](function(_0xd19084){if(!_0xd19084||!_0xd19084['authenticate'](_0x24caf4[_0x36ae('0x3d')])){return _0x5f0110[_0x36ae('0x31')](0x191)['json']({'message':_0x36ae('0x3e')});}_0x510d28[_0x36ae('0x2b')]={'id':_0xd19084['id']};_0x16b181();})[_0x36ae('0x36')](function(_0x8881f2){_0x16b181(_0x8881f2);});}else if(_[_0x36ae('0x3a')](_0x510d28[_0x36ae('0x38')][_0x36ae('0x39')],'Bearer')){validateJwt(_0x510d28,_0x5f0110,_0x16b181);}else{if(_0x55215e){_0x16b181();}else{return _0x5f0110[_0x36ae('0x31')](0x193)[_0x36ae('0x33')]({'message':_0x36ae('0x3f')});}}}else if(_0x510d28[_0x36ae('0x40')][_0x36ae('0x41')]){try{var _0x3ef116={'audience':hardwareConf[_0x36ae('0x42')](),'issuer':hardwareConf[_0x36ae('0x42')]()};verifyJwt(_0x510d28['query'][_0x36ae('0x41')],_0x3ef116)[_0x36ae('0x30')](function(_0x965450){return db[_0x36ae('0x3b')][_0x36ae('0x43')]({'where':{'id':_0x965450['sub']}})[_0x36ae('0x30')](function(_0x37daee){_0x74f73d=_0x37daee;return db['Setting'][_0x36ae('0x44')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x36ae('0x45')],'raw':!![]});})[_0x36ae('0x30')](function(_0x2eb834){if(!_0x74f73d||!_['isEqual'](_0x74f73d[_0x36ae('0x46')],_0x965450['nonce'])){return _0x5f0110[_0x36ae('0x31')](0x191)[_0x36ae('0x33')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x74f73d['disabled']){return _0x5f0110['status'](0x191)[_0x36ae('0x33')]({'message':_0x36ae('0x47')});}if(_0x74f73d[_0x36ae('0x48')]){if(_0x2eb834[_0x36ae('0x45')]>0x0){if(moment(_0x74f73d[_0x36ae('0x49')])[_0x36ae('0x4a')](_0x2eb834['blockDuration'],_0x36ae('0x4b'))>moment()){return _0x5f0110[_0x36ae('0x31')](0x191)['json']({'message':_0x36ae('0x47')});}}else{return _0x5f0110[_0x36ae('0x31')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}}_0x510d28[_0x36ae('0x2b')]={'id':_0x74f73d['id']};_0x16b181();});})[_0x36ae('0x36')](function(){return _0x5f0110['status'](0x191)[_0x36ae('0x33')]({'message':_0x36ae('0x47')});});}catch(_0x13db2b){_0x16b181(_0x13db2b);}}else if(_0x55215e){_0x16b181();}else{return _0x5f0110['status'](0x193)[_0x36ae('0x33')]({'message':'Unknown\x20authorization\x20format'});}})[_0x36ae('0x2a')](function(_0x534be7,_0x30db85,_0x577713){if(_0x534be7[_0x36ae('0x2b')]){db[_0x36ae('0x3b')][_0x36ae('0x43')]({'where':{'id':_0x534be7[_0x36ae('0x2b')]['id']},'attributes':userAttributes})[_0x36ae('0x30')](function(_0x7579b4){if(!_0x7579b4){return _0x30db85[_0x36ae('0x31')](0x194)[_0x36ae('0x33')]({'message':'User\x20not\x20found.'});}_0x534be7[_0x36ae('0x2b')]=_0x7579b4;_0x577713();})[_0x36ae('0x36')](function(_0x28e88d){_0x577713(_0x28e88d);});}else if(_0x55215e){_0x577713();}else{return _0x30db85['status'](0x194)[_0x36ae('0x33')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0x36ae('0x4c')]=function canUpdate(){return compose()[_0x36ae('0x2a')](function(_0xe7755d,_0x57eecc,_0xf44d59){return licenseUtil[_0x36ae('0x4d')]()['then'](function(_0x208173){if(_0x208173[_0x36ae('0x4e')]){_0xf44d59();}else{return _0x57eecc[_0x36ae('0x31')](0x193)[_0x36ae('0x33')]({'message':_0x36ae('0x4f')});}})['catch'](function(_0x44c7bb){_0xf44d59(_0x44c7bb);});});};exports[_0x36ae('0x50')]=function(_0x407440,_0x51303a,_0x469190){_0x407440[_0x36ae('0x50')]=!![];return _0x469190();};exports[_0x36ae('0x51')]=function signToken(_0x44b91f){return signJwt(_0x44b91f);};exports['setTokenCookie']=function(_0x4ee994,_0x4e5a16){if(!_0x4ee994[_0x36ae('0x2b')]){return _0x4e5a16['status'](0x194)[_0x36ae('0x33')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x535ab2={'payload':{'id':_0x4ee994[_0x36ae('0x2b')]['id'],'role':_0x4ee994[_0x36ae('0x2b')][_0x36ae('0x52')]},'options':{'expiresIn':0x15180}};return signJwt(_0x535ab2)[_0x36ae('0x30')](function(_0x376eed){_0x4e5a16[_0x36ae('0x53')](_0x36ae('0x54'),_0x376eed);_0x4e5a16[_0x36ae('0x55')](_0x36ae('0x56'));})[_0x36ae('0x36')](function(_0x244219){return _0x4e5a16[_0x36ae('0x31')](0x1f4)[_0x36ae('0x57')](_0x244219);});};exports['retrieveApiKey']=function(_0x4a2c7b){if(_['isNil'](_0x4a2c7b[_0x36ae('0x46')])||_[_0x36ae('0x58')](_0x4a2c7b[_0x36ae('0x59')])){return null;}else{return createJwt(_0x4a2c7b);}};exports[_0x36ae('0x5a')]=function(_0x3b633c){_0x3b633c[_0x36ae('0x46')]=generateNonce();_0x3b633c[_0x36ae('0x59')]=generateIssuedAt();return createJwt(_0x3b633c);};exports[_0x36ae('0x5b')]=function(_0x551ae5,_0x1fa4f6){var _0x1b2dd0=_0x551ae5['query']['apikey'];if(_0x1b2dd0){var _0x4ed47e={'nonce':_0x1fa4f6[_0x36ae('0x46')],'iat':_0x1fa4f6[_0x36ae('0x59')],'audience':hardwareConf[_0x36ae('0x42')](),'issuer':hardwareConf[_0x36ae('0x42')]()};return verifyJwt(_0x1b2dd0,_0x4ed47e)['then'](function(){return generateApiKey(_0x1fa4f6);});}else{throw{'message':_0x36ae('0x5c')};}};exports[_0x36ae('0x5d')]=function(_0x3a0eaf){var _0x3272cc=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x3272cc[_0x36ae('0x5e')](_0x3a0eaf))throw new db[(_0x36ae('0x5f'))][(_0x36ae('0x60'))](_0x36ae('0x61'));return;};exports['validatePasswordHistory']=function(_0xd14316,_0x28f481,_0x347d00){var _0x55bf51=encryptor[_0x36ae('0x62')](_0x28f481)[_0x36ae('0x63')](',');for(var _0x13003e=0x0;_0x13003e<_0x347d00;_0x13003e++){if(!_0x55bf51[_0x13003e])break;if(_0xd14316['toLowerCase']()===_0x55bf51[_0x13003e][_0x36ae('0x64')]()){var _0x582ad7=util[_0x36ae('0x65')](_0x36ae('0x66'),_0x347d00);if(_0x347d00===0x1){_0x582ad7=_0x36ae('0x67');}throw new db[(_0x36ae('0x5f'))][(_0x36ae('0x60'))](_0x582ad7);}}return;};exports[_0x36ae('0x68')]=function(_0x40f17b,_0x155148){var _0xac9f9e=_0x155148?encryptor[_0x36ae('0x62')](_0x155148)[_0x36ae('0x63')](','):[];if(_0xac9f9e['length']===0x5){_0xac9f9e['splice'](-0x1,0x1);}_0xac9f9e[_0x36ae('0x69')](_0x40f17b);return encryptor[_0x36ae('0x6a')](_0xac9f9e[_0x36ae('0x6b')](','));};function signJwt(_0x27f696){var _0x48650d=BPromise[_0x36ae('0x6c')](jwt['sign'],{'context':jwt});var _0x50001f=_0x27f696['secret']||config['secrets'][_0x36ae('0xa')];return new BPromise(function(_0x1103da,_0x50aeed){_0x48650d(_0x27f696[_0x36ae('0x6d')],_0x50001f,_0x27f696[_0x36ae('0x6e')])[_0x36ae('0x30')](function(_0x50fd2d){_0x1103da(_0x50fd2d);})[_0x36ae('0x36')](function(_0x4d9ca4){_0x50aeed(_0x4d9ca4);});});}function verifyJwt(_0x5ce592,_0x2c588f,_0x27482f){var _0x590a68=BPromise['promisify'](jwt[_0x36ae('0x6f')],{'context':jwt});var _0x4b4662=_0x27482f||config[_0x36ae('0x70')][_0x36ae('0xa')];return new BPromise(function(_0x5fb565,_0x5d5d4f){_0x590a68(_0x5ce592,_0x4b4662,_0x2c588f)[_0x36ae('0x30')](function(_0x32b351){_0x5fb565(_0x32b351);})[_0x36ae('0x36')](function(_0x420171){_0x5d5d4f(_0x420171);});});}function generateNonce(){return crypto[_0x36ae('0x71')](0x10)['toString'](_0x36ae('0x72'));}function generateIssuedAt(){return Math[_0x36ae('0x73')](Date['now']()/0x3e8)[_0x36ae('0x74')]();}function createJwt(_0x5c6051){var _0xdacfaf={'payload':{'iat':_0x5c6051[_0x36ae('0x59')],'nonce':_0x5c6051[_0x36ae('0x46')]},'options':{'algorithm':_0x36ae('0x75'),'subject':_0x5c6051['id'][_0x36ae('0x74')](),'issuer':hardwareConf[_0x36ae('0x42')](),'audience':hardwareConf[_0x36ae('0x42')]()}};return signJwt(_0xdacfaf)['then'](function(_0x19ef90){return{'iat':_0x5c6051[_0x36ae('0x59')],'nonce':_0x5c6051[_0x36ae('0x46')],'token':_0x19ef90};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 4e6dcfa..a39b1d7 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 _0x4043=['aes192','encrypt','algorithm','join','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createCipher','data','binary','write','end','close','unlink','update','final','encryptString','base64','secret','utf8','crypto','bluebird','lodash','../../config/environment','secrets','session','aes-256-ctr'];(function(_0x1d425e,_0x3616eb){var _0x181438=function(_0x25333a){while(--_0x25333a){_0x1d425e['push'](_0x1d425e['shift']());}};_0x181438(++_0x3616eb);}(_0x4043,0x1ab));var _0x3404=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4043[_0x2dafbe];return _0x58a45a;};'use strict';var crypto=require(_0x3404('0x0'));var fs=require('fs');var BPromise=require(_0x3404('0x1'));var _=require(_0x3404('0x2'));var config=require(_0x3404('0x3'));var logger=require('../../config/logger')('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x3404('0x4')][_0x3404('0x5')],'algorithm':_0x3404('0x6')};const fileOptions={'algorithm':_0x3404('0x7')};if(config['encrypt']&&config[_0x3404('0x8')]['algorithm']){var isSupported=isAlgorithmSupported(config[_0x3404('0x8')]['algorithm']);if(isSupported){fileOptions[_0x3404('0x9')]=config['encrypt'][_0x3404('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x3404('0xa')](',\x20');logger['error'](config[_0x3404('0x8')]['algorithm'],_0x3404('0xb'),supportedAlgorithms);}}function isASupportedCipher(_0x7dd8c){return AES_SUPPORTED_RX[_0x3404('0xc')](_0x7dd8c);}function getSupportedCiphers(){return crypto['getCiphers']()[_0x3404('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x5cbb73){return getSupportedCiphers()[_0x3404('0xe')](_0x5cbb73)>-0x1;}function combineOptions(_0xd547dc){var _0x31fb0c={};for(var _0x16459e in fileOptions){if(fileOptions[_0x3404('0xf')](_0x16459e)){_0x31fb0c[_0x16459e]=fileOptions[_0x16459e];}}if(_0xd547dc){for(var _0x51db2b in _0xd547dc){if(_0xd547dc[_0x3404('0xf')](_0x51db2b)){_0x31fb0c[_0x51db2b]=_0xd547dc[_0x51db2b];}}}return _0x31fb0c;}exports[_0x3404('0x10')]=function(_0x58a3a4,_0x3c39e9,_0xe94834,_0x358fa5){return new BPromise(function(_0x4a4cee,_0x43085c){_0x358fa5=combineOptions(_0x358fa5);var _0x225d37=new Buffer(_0xe94834);var _0x9cdd1b=fs[_0x3404('0x11')](_0x58a3a4);var _0x2568d4=fs['createWriteStream'](_0x3c39e9);var _0x5e958d=crypto[_0x3404('0x12')](_0x358fa5[_0x3404('0x9')],_0x225d37);_0x9cdd1b['on'](_0x3404('0x13'),function(_0x3949e2){var _0x2c17c0=new Buffer(_0x5e958d['update'](_0x3949e2),_0x3404('0x14'));_0x2568d4[_0x3404('0x15')](_0x2c17c0);});_0x9cdd1b['on'](_0x3404('0x16'),function(){try{var _0x4430ee=new Buffer(_0x5e958d['final'](_0x3404('0x14')),_0x3404('0x14'));_0x2568d4[_0x3404('0x15')](_0x4430ee);_0x2568d4[_0x3404('0x16')]();_0x2568d4['on'](_0x3404('0x17'),function(){return _0x4a4cee(_0x3c39e9);});}catch(_0x3647b5){fs[_0x3404('0x18')](_0x3c39e9);return _0x43085c(_0x3647b5);}});});};exports['decryptFile']=function(_0x5bf417,_0x218237,_0x33795b,_0x4f0e80){return new BPromise(function(_0x8cbc4f,_0x429feb){_0x4f0e80=combineOptions(_0x4f0e80);var _0x1150f5=new Buffer(_0x33795b);var _0xed40d9=fs[_0x3404('0x11')](_0x5bf417);var _0x3360f7=fs['createWriteStream'](_0x218237);var _0x10a73c=crypto['createDecipher'](_0x4f0e80['algorithm'],_0x1150f5);_0xed40d9['on'](_0x3404('0x13'),function(_0xbdc677){var _0x28e2b9=new Buffer(_0x10a73c[_0x3404('0x19')](_0xbdc677),_0x3404('0x14'));_0x3360f7['write'](_0x28e2b9);});_0xed40d9['on'](_0x3404('0x16'),function(){try{var _0xee3345=new Buffer(_0x10a73c[_0x3404('0x1a')](_0x3404('0x14')),_0x3404('0x14'));_0x3360f7[_0x3404('0x15')](_0xee3345);_0x3360f7[_0x3404('0x16')]();_0x3360f7['on'](_0x3404('0x17'),function(){return _0x8cbc4f(_0x218237);});}catch(_0x2f2ac0){fs['unlink'](_0x218237);return _0x429feb(_0x2f2ac0);}});});};exports[_0x3404('0x1b')]=function(_0x19feff,_0x2302b6,_0x4ce16f){var _0x349746=_0x4ce16f||stringOptions[_0x3404('0x9')];var _0x34fba9=_0x2302b6||stringOptions['secret'];var _0x3d41fc=crypto[_0x3404('0x12')](_0x349746,_0x34fba9);var _0x5d9c62=_0x3d41fc[_0x3404('0x19')](_0x19feff,'utf8','base64');_0x5d9c62+=_0x3d41fc[_0x3404('0x1a')](_0x3404('0x1c'));return _0x5d9c62;};exports['decryptString']=function(_0x55048c,_0x4d20d7,_0x4f7dd6){var _0x4ecdb2=_0x4f7dd6||stringOptions['algorithm'];var _0x4a6ee5=_0x4d20d7||stringOptions[_0x3404('0x1d')];var _0x57df0a=crypto['createDecipher'](_0x4ecdb2,_0x4a6ee5);var _0x3df9ba=_0x57df0a[_0x3404('0x19')](_0x55048c,_0x3404('0x1c'),'utf8');_0x3df9ba+=_0x57df0a[_0x3404('0x1a')](_0x3404('0x1e'));return _0x3df9ba;}; \ No newline at end of file +var _0x941f=['test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createWriteStream','createCipher','data','binary','end','write','close','decryptFile','createReadStream','createDecipher','update','unlink','encryptString','secret','utf8','final','base64','crypto','bluebird','../../config/environment','../../config/logger','app','secrets','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:'];(function(_0x4ef024,_0x3db22a){var _0x4314a7=function(_0x200041){while(--_0x200041){_0x4ef024['push'](_0x4ef024['shift']());}};_0x4314a7(++_0x3db22a);}(_0x941f,0x113));var _0xf941=function(_0x1bcb4b,_0x32fbe9){_0x1bcb4b=_0x1bcb4b-0x0;var _0x1c8c26=_0x941f[_0x1bcb4b];return _0x1c8c26;};'use strict';var crypto=require(_0xf941('0x0'));var fs=require('fs');var BPromise=require(_0xf941('0x1'));var _=require('lodash');var config=require(_0xf941('0x2'));var logger=require(_0xf941('0x3'))(_0xf941('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xf941('0x5')]['session'],'algorithm':_0xf941('0x6')};const fileOptions={'algorithm':_0xf941('0x7')};if(config[_0xf941('0x8')]&&config[_0xf941('0x8')][_0xf941('0x9')]){var isSupported=isAlgorithmSupported(config[_0xf941('0x8')][_0xf941('0x9')]);if(isSupported){fileOptions[_0xf941('0x9')]=config[_0xf941('0x8')][_0xf941('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xf941('0xa')](',\x20');logger[_0xf941('0xb')](config[_0xf941('0x8')][_0xf941('0x9')],_0xf941('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x6e2e60){return AES_SUPPORTED_RX[_0xf941('0xd')](_0x6e2e60);}function getSupportedCiphers(){return crypto[_0xf941('0xe')]()[_0xf941('0xf')](isASupportedCipher);}function isAlgorithmSupported(_0x28226c){return getSupportedCiphers()[_0xf941('0x10')](_0x28226c)>-0x1;}function combineOptions(_0x1c9aac){var _0xe50a13={};for(var _0x2f1196 in fileOptions){if(fileOptions[_0xf941('0x11')](_0x2f1196)){_0xe50a13[_0x2f1196]=fileOptions[_0x2f1196];}}if(_0x1c9aac){for(var _0x4f064a in _0x1c9aac){if(_0x1c9aac[_0xf941('0x11')](_0x4f064a)){_0xe50a13[_0x4f064a]=_0x1c9aac[_0x4f064a];}}}return _0xe50a13;}exports[_0xf941('0x12')]=function(_0x432dec,_0x483af6,_0x57777b,_0x52f03b){return new BPromise(function(_0x4f5afc,_0x1fffe3){_0x52f03b=combineOptions(_0x52f03b);var _0x5ddb12=new Buffer(_0x57777b);var _0x5e7e74=fs['createReadStream'](_0x432dec);var _0x48d04=fs[_0xf941('0x13')](_0x483af6);var _0x4cd2cb=crypto[_0xf941('0x14')](_0x52f03b[_0xf941('0x9')],_0x5ddb12);_0x5e7e74['on'](_0xf941('0x15'),function(_0x144bf2){var _0x5c13f6=new Buffer(_0x4cd2cb['update'](_0x144bf2),_0xf941('0x16'));_0x48d04['write'](_0x5c13f6);});_0x5e7e74['on'](_0xf941('0x17'),function(){try{var _0x4ae69c=new Buffer(_0x4cd2cb['final'](_0xf941('0x16')),_0xf941('0x16'));_0x48d04[_0xf941('0x18')](_0x4ae69c);_0x48d04[_0xf941('0x17')]();_0x48d04['on'](_0xf941('0x19'),function(){return _0x4f5afc(_0x483af6);});}catch(_0x301131){fs['unlink'](_0x483af6);return _0x1fffe3(_0x301131);}});});};exports[_0xf941('0x1a')]=function(_0x2eafa4,_0x18a3f2,_0x5855be,_0x54e9fb){return new BPromise(function(_0x285d11,_0x3b6857){_0x54e9fb=combineOptions(_0x54e9fb);var _0x122776=new Buffer(_0x5855be);var _0x255726=fs[_0xf941('0x1b')](_0x2eafa4);var _0x5c73de=fs[_0xf941('0x13')](_0x18a3f2);var _0x4a17ef=crypto[_0xf941('0x1c')](_0x54e9fb[_0xf941('0x9')],_0x122776);_0x255726['on'](_0xf941('0x15'),function(_0x13efb1){var _0xfb6606=new Buffer(_0x4a17ef[_0xf941('0x1d')](_0x13efb1),_0xf941('0x16'));_0x5c73de[_0xf941('0x18')](_0xfb6606);});_0x255726['on'](_0xf941('0x17'),function(){try{var _0x1c9f02=new Buffer(_0x4a17ef['final'](_0xf941('0x16')),'binary');_0x5c73de[_0xf941('0x18')](_0x1c9f02);_0x5c73de[_0xf941('0x17')]();_0x5c73de['on']('close',function(){return _0x285d11(_0x18a3f2);});}catch(_0x5c097d){fs[_0xf941('0x1e')](_0x18a3f2);return _0x3b6857(_0x5c097d);}});});};exports[_0xf941('0x1f')]=function(_0x142158,_0x327b4b,_0x2e6bd1){var _0x18353b=_0x2e6bd1||stringOptions[_0xf941('0x9')];var _0x4744fa=_0x327b4b||stringOptions[_0xf941('0x20')];var _0x48e43b=crypto[_0xf941('0x14')](_0x18353b,_0x4744fa);var _0x5882dc=_0x48e43b[_0xf941('0x1d')](_0x142158,_0xf941('0x21'),'base64');_0x5882dc+=_0x48e43b[_0xf941('0x22')](_0xf941('0x23'));return _0x5882dc;};exports['decryptString']=function(_0x14b656,_0x1a2ad3,_0x32be6e){var _0x574794=_0x32be6e||stringOptions[_0xf941('0x9')];var _0x100467=_0x1a2ad3||stringOptions['secret'];var _0x1a592c=crypto[_0xf941('0x1c')](_0x574794,_0x100467);var _0x29f739=_0x1a592c['update'](_0x14b656,_0xf941('0x23'),'utf8');_0x29f739+=_0x1a592c[_0xf941('0x22')]('utf8');return _0x29f739;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 6e7d6b1..17f4b59 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 _0xc5c0=['length','existsSync','join','mkdirSync','each','%s%d.%s','csv','writeFileSync','zip','zip\x20finished','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','util','path','lodash','to-csv','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','find','split','splitSizeCsv','sequelize','QueryTypes','SELECT','then','num','Empty','range','isInteger','forEach','query','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.csv'];(function(_0x6c75da,_0x1b96d6){var _0x5f5d21=function(_0x5ef793){while(--_0x5ef793){_0x6c75da['push'](_0x6c75da['shift']());}};_0x5f5d21(++_0x1b96d6);}(_0xc5c0,0xd3));var _0x0c5c=function(_0x2552d2,_0x2dff80){_0x2552d2=_0x2552d2-0x0;var _0xb3e739=_0xc5c0[_0x2552d2];return _0xb3e739;};'use strict';var util=require(_0x0c5c('0x0'));var path=require(_0x0c5c('0x1'));var _=require(_0x0c5c('0x2'));var csv=require(_0x0c5c('0x3'));var fs=require('fs');var BPromise=require(_0x0c5c('0x4'));var zipdir=require(_0x0c5c('0x5'));var rimraf=require('rimraf');var db=require(_0x0c5c('0x6'))['db'];var dbH=require(_0x0c5c('0x6'))[_0x0c5c('0x7')];var logger=require(_0x0c5c('0x8'))(_0x0c5c('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x0c5c('0xa')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x0c5c('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x52e256,_0x24de5a){var _0x5648d2={'status':_0x52e256};var _0x51a9ef={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x24de5a){_0x5648d2[_0x0c5c('0xb')]=_0x24de5a;}return db[_0x0c5c('0xc')][_0x0c5c('0xd')](_0x5648d2,_0x51a9ef);}function main(){var _0x7eebd5=0x1388;var _0xe9f7e7;logger[_0x0c5c('0xe')](util[_0x0c5c('0xf')](_0x0c5c('0x10'),EXTRACTED_REPORT_ID,_0x0c5c('0x11')));return db['Setting'][_0x0c5c('0x12')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0c5c('0x13'),_0x0c5c('0x14')]})['then'](function(_0x4333d5){if(_0x4333d5){_0xe9f7e7=_0x4333d5;_0x7eebd5=_0xe9f7e7[_0x0c5c('0x14')]||0x1388;}})['then'](function(){return dbH[_0x0c5c('0x15')]['query'](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x0c5c('0x15')][_0x0c5c('0x16')][_0x0c5c('0x17')]});})[_0x0c5c('0x18')](function(_0x35ef16){if(!_0x35ef16[0x0][_0x0c5c('0x19')]){return analyticExtractedReport(_0x0c5c('0x1a'));}var _0x49a682=[];var _0xe9be76=0x0;if(_0xe9f7e7['split']){if(_0x35ef16&&_0x35ef16['length']){var _0x2c436a=_[_0x0c5c('0x1b')](_0x35ef16[0x0][_0x0c5c('0x19')]/_0x7eebd5);var _0x1e4c6e=Number[_0x0c5c('0x1c')](_0x35ef16[0x0][_0x0c5c('0x19')]/_0x7eebd5)?_0x35ef16[0x0]['num']%_0x7eebd5:0x0;_0x2c436a[_0x0c5c('0x1d')](function(_0x3ef683){if(_0x3ef683>0x0){_0xe9be76+=_0x7eebd5;}_0x49a682['push'](dbH[_0x0c5c('0x15')][_0x0c5c('0x1e')](util[_0x0c5c('0xf')](_0x0c5c('0x1f'),QUERY,_0x7eebd5,_0xe9be76),{'type':dbH['sequelize'][_0x0c5c('0x16')][_0x0c5c('0x17')]}));});if(_0x1e4c6e>0x0){_0xe9be76+=_0x7eebd5;_0x49a682['push'](dbH[_0x0c5c('0x15')][_0x0c5c('0x1e')](util[_0x0c5c('0xf')](_0x0c5c('0x1f'),QUERY,_0x1e4c6e,_0xe9be76),{'type':dbH[_0x0c5c('0x15')][_0x0c5c('0x16')][_0x0c5c('0x17')]}));}}}else{_0x49a682['push'](dbH[_0x0c5c('0x15')][_0x0c5c('0x1e')](QUERY,{'type':dbH[_0x0c5c('0x15')][_0x0c5c('0x16')][_0x0c5c('0x17')]}));}var _0x54b7a6=path['dirname'](PATH);var _0x2f164b=path[_0x0c5c('0x20')](PATH,_0x0c5c('0x21'));var _0x138b4b=_0xe9f7e7[_0x0c5c('0x13')]&&_0x49a682[_0x0c5c('0x22')]>0x1;var _0x42ea09=[];if(!fs[_0x0c5c('0x23')](path[_0x0c5c('0x24')](_0x54b7a6,_0x2f164b))&&_0x138b4b){fs[_0x0c5c('0x25')](path[_0x0c5c('0x24')](_0x54b7a6,_0x2f164b));}return BPromise[_0x0c5c('0x26')](_0x49a682,function(_0x4c4c26){_0x42ea09['push'](_0x4c4c26);})[_0x0c5c('0x18')](function(){for(var _0xc67e8c=0x0;_0xc67e8c<_0x42ea09[_0x0c5c('0x22')];_0xc67e8c+=0x1){var _0x9a23d6;var _0x5d65e9=_0x42ea09[_0xc67e8c];if(_0x138b4b){_0x9a23d6=path[_0x0c5c('0x24')](_0x54b7a6,_0x2f164b,util[_0x0c5c('0xf')](_0x0c5c('0x27'),_0x2f164b,_0xc67e8c,'csv'));}else{_0x9a23d6=path[_0x0c5c('0x24')](_0x54b7a6,util[_0x0c5c('0xf')]('%s.%s',_0x2f164b,_0x0c5c('0x28')));}fs[_0x0c5c('0x29')](_0x9a23d6,csv(_0x5d65e9));}})[_0x0c5c('0x18')](function(){if(_0x138b4b){return new Promise(function(_0xd0fea4){zipdir(path['join'](_0x54b7a6,_0x2f164b),{'saveTo':path[_0x0c5c('0x24')](_0x54b7a6,util['format']('%s.%s',_0x2f164b,_0x0c5c('0x2a')))},function(_0x54c9a8,_0x4bc2df){rimraf(path[_0x0c5c('0x24')](_0x54b7a6,_0x2f164b),function(){});_0xd0fea4(_0x0c5c('0x2b'));});});}})[_0x0c5c('0x18')](function(){logger[_0x0c5c('0xe')](util[_0x0c5c('0xf')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x0c5c('0x2c'),_0x138b4b?util[_0x0c5c('0xf')]('%s.%s',_0x2f164b,_0x138b4b?'zip':_0x0c5c('0x28')):null);});})[_0x0c5c('0x2d')](function(_0x285fa2){logger[_0x0c5c('0xe')](util[_0x0c5c('0xf')](_0x0c5c('0x2e'),EXTRACTED_REPORT_ID,_0x0c5c('0x11')),util[_0x0c5c('0x2f')](_0x285fa2,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x0c5c('0x30')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0x4662=['then','%s.%s','csv','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path','lodash','bluebird','zip-dir','../../mysqldb','../../config/logger','argv','savename','update','info','CSV','Setting','split','splitSizeCsv','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num','Empty','length','range','isInteger','forEach','push','SELECT','dirname','basename','join','mkdirSync'];(function(_0x5e7514,_0x30c2e1){var _0x12f472=function(_0x33ddb6){while(--_0x33ddb6){_0x5e7514['push'](_0x5e7514['shift']());}};_0x12f472(++_0x30c2e1);}(_0x4662,0x114));var _0x2466=function(_0x3af823,_0x48e911){_0x3af823=_0x3af823-0x0;var _0x4b474f=_0x4662[_0x3af823];return _0x4b474f;};'use strict';var util=require(_0x2466('0x0'));var path=require(_0x2466('0x1'));var _=require(_0x2466('0x2'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x2466('0x3'));var zipdir=require(_0x2466('0x4'));var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require(_0x2466('0x5'))['dbH'];var logger=require(_0x2466('0x6'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x2466('0x7')][0x3];var PATH=process[_0x2466('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x30dff2,_0x195845){var _0x53a31e={'status':_0x30dff2};var _0x236a41={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x195845){_0x53a31e[_0x2466('0x8')]=_0x195845;}return db['AnalyticExtractedReport'][_0x2466('0x9')](_0x53a31e,_0x236a41);}function main(){var _0x31ef7c=0x1388;var _0x3aa3d0;logger[_0x2466('0xa')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x2466('0xb')));return db[_0x2466('0xc')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x2466('0xd'),_0x2466('0xe')]})['then'](function(_0x5894d1){if(_0x5894d1){_0x3aa3d0=_0x5894d1;_0x31ef7c=_0x3aa3d0['splitSizeCsv']||0x1388;}})['then'](function(){return dbH[_0x2466('0xf')][_0x2466('0x10')](util[_0x2466('0x11')](_0x2466('0x12'),QUERY),{'type':dbH[_0x2466('0xf')][_0x2466('0x13')]['SELECT']});})['then'](function(_0x2dcc87){if(!_0x2dcc87[0x0][_0x2466('0x14')]){return analyticExtractedReport(_0x2466('0x15'));}var _0xee8f38=[];var _0x1e482f=0x0;if(_0x3aa3d0[_0x2466('0xd')]){if(_0x2dcc87&&_0x2dcc87[_0x2466('0x16')]){var _0x5118e8=_[_0x2466('0x17')](_0x2dcc87[0x0][_0x2466('0x14')]/_0x31ef7c);var _0x3d9559=Number[_0x2466('0x18')](_0x2dcc87[0x0][_0x2466('0x14')]/_0x31ef7c)?_0x2dcc87[0x0][_0x2466('0x14')]%_0x31ef7c:0x0;_0x5118e8[_0x2466('0x19')](function(_0x168802){if(_0x168802>0x0){_0x1e482f+=_0x31ef7c;}_0xee8f38[_0x2466('0x1a')](dbH[_0x2466('0xf')][_0x2466('0x10')](util[_0x2466('0x11')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x31ef7c,_0x1e482f),{'type':dbH['sequelize'][_0x2466('0x13')][_0x2466('0x1b')]}));});if(_0x3d9559>0x0){_0x1e482f+=_0x31ef7c;_0xee8f38['push'](dbH['sequelize'][_0x2466('0x10')](util[_0x2466('0x11')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x3d9559,_0x1e482f),{'type':dbH[_0x2466('0xf')][_0x2466('0x13')]['SELECT']}));}}}else{_0xee8f38[_0x2466('0x1a')](dbH[_0x2466('0xf')]['query'](QUERY,{'type':dbH[_0x2466('0xf')][_0x2466('0x13')]['SELECT']}));}var _0x350893=path[_0x2466('0x1c')](PATH);var _0x2aff14=path[_0x2466('0x1d')](PATH,'.csv');var _0xf731de=_0x3aa3d0['split']&&_0xee8f38[_0x2466('0x16')]>0x1;var _0x2078f6=[];if(!fs['existsSync'](path[_0x2466('0x1e')](_0x350893,_0x2aff14))&&_0xf731de){fs[_0x2466('0x1f')](path[_0x2466('0x1e')](_0x350893,_0x2aff14));}return BPromise['each'](_0xee8f38,function(_0x16a8b9){_0x2078f6[_0x2466('0x1a')](_0x16a8b9);})[_0x2466('0x20')](function(){for(var _0x421e47=0x0;_0x421e47<_0x2078f6[_0x2466('0x16')];_0x421e47+=0x1){var _0x3fea57;var _0x38a3ab=_0x2078f6[_0x421e47];if(_0xf731de){_0x3fea57=path[_0x2466('0x1e')](_0x350893,_0x2aff14,util[_0x2466('0x11')]('%s%d.%s',_0x2aff14,_0x421e47,'csv'));}else{_0x3fea57=path[_0x2466('0x1e')](_0x350893,util[_0x2466('0x11')](_0x2466('0x21'),_0x2aff14,_0x2466('0x22')));}fs[_0x2466('0x23')](_0x3fea57,csv(_0x38a3ab));}})[_0x2466('0x20')](function(){if(_0xf731de){return new Promise(function(_0xdec5fb){zipdir(path[_0x2466('0x1e')](_0x350893,_0x2aff14),{'saveTo':path[_0x2466('0x1e')](_0x350893,util[_0x2466('0x11')]('%s.%s',_0x2aff14,_0x2466('0x24')))},function(_0x3d245e,_0x48fb26){rimraf(path['join'](_0x350893,_0x2aff14),function(){});_0xdec5fb(_0x2466('0x25'));});});}})['then'](function(){logger[_0x2466('0xa')](util[_0x2466('0x11')](_0x2466('0x26'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x2466('0x27'),_0xf731de?util[_0x2466('0x11')](_0x2466('0x21'),_0x2aff14,_0xf731de?_0x2466('0x24'):_0x2466('0x22')):null);});})[_0x2466('0x28')](function(_0x229a12){logger[_0x2466('0xa')](util['format'](_0x2466('0x29'),EXTRACTED_REPORT_ID,_0x2466('0xb')),util[_0x2466('0x2a')](_0x229a12,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x2466('0x2b'));})['finally'](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index d9a0a92..4dcc836 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 _0x7564=['YYYY-MM-DD','Arial','center','Interaction\x20Transcript','header','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','createWriteStream','finish','error','end','createPdfFromHTML','catch','lodash','util','path','moment','html-to-pdfmake','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','update','map','pick','value','fill','length','auto','body','push','keys','forEach','name','format','endDate','pageBreak','margin','landscape','toString','black','Empty','Setting','find','split','splitSizePdf','then','range','isInteger','num','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','query','QueryTypes','dirname','basename','existsSync','join','mkdirSync','each','createPdfKitDocument','%s%d.%s','%s.%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','AnalyticExtractedReport','findOne','inspect','finally','exit','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','channel','interactionId'];(function(_0x450d87,_0x2ae298){var _0x204e75=function(_0x4f4f7d){while(--_0x4f4f7d){_0x450d87['push'](_0x450d87['shift']());}};_0x204e75(++_0x2ae298);}(_0x7564,0x118));var _0x4756=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x7564[_0xc6be3a];return _0x56a310;};'use strict';var _=require(_0x4756('0x0'));var fs=require('fs');var util=require(_0x4756('0x1'));var path=require(_0x4756('0x2'));var moment=require(_0x4756('0x3'));var htmlToPdfmake=require(_0x4756('0x4'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0x4756('0x5'));var rimraf=require(_0x4756('0x6'));var JSDOM=require(_0x4756('0x7'))[_0x4756('0x8')];var window=new JSDOM('')[_0x4756('0x9')];var BPromise=require(_0x4756('0xa'));var db=require(_0x4756('0xb'))['db'];var dbH=require(_0x4756('0xb'))[_0x4756('0xc')];var logger=require(_0x4756('0xd'))(_0x4756('0xe'));var EXTRACTED_REPORT_ID=Number(process[_0x4756('0xf')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x4756('0xf')][0x4];var NAME=process[_0x4756('0xf')][0x5];var FORMAT=_0x4756('0x10');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x3675b3,_0x2553c3){var _0x1ab06b={'status':_0x3675b3};var _0x1843dd={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2553c3){_0x1ab06b['savename']=_0x2553c3;}return db['AnalyticExtractedReport'][_0x4756('0x11')](_0x1ab06b,_0x1843dd);}function getHeaders(_0x715ef9){return _[_0x4756('0x12')](_0x715ef9,function(_0x5a02e2){return{'text':_0x5a02e2,'style':'tableHeader'};});}function getRows(_0x286fc4,_0x81e54f){return _[_0x4756('0x12')](_0x81e54f,function(_0x138212){return _(_0x138212)[_0x4756('0x13')](_0x286fc4)[_0x4756('0x12')](function(_0x4293a5){return _0x4293a5?_['toString'](_0x4293a5):'';})[_0x4756('0x14')]();});}function createTable(_0x30d6af,_0x23cff7){var _0x37e2bc={'widths':_[_0x4756('0x15')](Array(_0x30d6af[_0x4756('0x16')]),0x91),'heights':function(_0xaca87f){return _0xaca87f===0x0?_0x4756('0x17'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x47c8ee=getHeaders(_0x30d6af);_0x37e2bc[_0x4756('0x18')][_0x4756('0x19')](_0x47c8ee);var _0x326f88=getRows(_0x30d6af,_0x23cff7);_0x37e2bc[_0x4756('0x18')]=_0x37e2bc['body']['concat'](_0x326f88);return _0x37e2bc;}function createTables(_0x6b6d82){var _0x3ceceb=[];var _0x4a249a=_['chunk'](Object[_0x4756('0x1a')](_0x6b6d82[0x0]),0x5);_0x4a249a[_0x4756('0x1b')](function(_0xa57f96){_0x3ceceb[_0x4756('0x19')](createTable(_0xa57f96,_0x6b6d82));});return _0x3ceceb;}function getPDFDocDefinition(_0x49d402){var _0x5ca3d2=util['format']('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0x4756('0x1c')],moment(EXTRACTED_REPORT['startDate'])[_0x4756('0x1d')](FORMAT),moment(EXTRACTED_REPORT[_0x4756('0x1e')])[_0x4756('0x1d')](FORMAT));var _0x5b2513=[];for(var _0x4ca390=0x0;_0x4ca390<_0x49d402[_0x4756('0x16')];_0x4ca390++){var _0x8c6b47=[];if(_0x4ca390===0x0){_0x8c6b47[_0x4756('0x19')]({'text':_0x5ca3d2,'style':'header'});}var _0x129fd4={'table':_0x49d402[_0x4ca390]};if(_0x4ca390>0x0){_0x129fd4[_0x4756('0x1f')]='before';_0x129fd4[_0x4756('0x20')]=[0x0,0x46,0x0,0x0];}_0x8c6b47[_0x4756('0x19')](_0x129fd4);_0x5b2513[_0x4756('0x19')](_0x8c6b47);}return{'pageSize':'A4','pageOrientation':_0x4756('0x21'),'content':_0x5b2513,'footer':function(_0x3960a7,_0x12ad03){return{'text':_0x3960a7[_0x4756('0x22')]()+'\x20/\x20'+_0x12ad03,'style':'footer'};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x4756('0x23')},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0xf6a75c){var _0x2e8317=0x1388;var _0x460825;if(!_0xf6a75c[0x0]['num']){return analyticExtractedReport(_0x4756('0x24'));}return db[_0x4756('0x25')][_0x4756('0x26')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x4756('0x27'),_0x4756('0x28')]})[_0x4756('0x29')](function(_0x3c37f0){if(_0x3c37f0){_0x460825=_0x3c37f0;_0x2e8317=_0x460825['splitSizePdf']||0x3e8;}})[_0x4756('0x29')](function(){var _0x2defa6=[];var _0x1ecb8c=0x0;if(_0x460825['split']){if(_0xf6a75c&&_0xf6a75c[_0x4756('0x16')]){var _0x32ff44=_[_0x4756('0x2a')](_0xf6a75c[0x0]['num']/_0x2e8317);var _0x5a75cf=Number[_0x4756('0x2b')](_0xf6a75c[0x0]['num']/_0x2e8317)?_0xf6a75c[0x0][_0x4756('0x2c')]%_0x2e8317:0x0;_0x32ff44[_0x4756('0x1b')](function(_0x105532){if(_0x105532>0x0){_0x1ecb8c+=_0x2e8317;}_0x2defa6['push'](dbH[_0x4756('0x2d')]['query'](util[_0x4756('0x1d')](_0x4756('0x2e'),QUERY,_0x2e8317,_0x1ecb8c),{'type':dbH[_0x4756('0x2d')]['QueryTypes'][_0x4756('0x2f')]}));});if(_0x5a75cf>0x0){_0x1ecb8c+=_0x2e8317;_0x2defa6['push'](dbH[_0x4756('0x2d')][_0x4756('0x30')](util[_0x4756('0x1d')](_0x4756('0x2e'),QUERY,_0x5a75cf,_0x1ecb8c),{'type':dbH[_0x4756('0x2d')][_0x4756('0x31')][_0x4756('0x2f')]}));}}}else{_0x2defa6['push'](dbH[_0x4756('0x2d')][_0x4756('0x30')](QUERY,{'type':dbH[_0x4756('0x2d')]['QueryTypes'][_0x4756('0x2f')]}));}var _0x12b0e4=path[_0x4756('0x32')](PATH);var _0x214235=path[_0x4756('0x33')](PATH,'.pdf');var _0x8bd8fd=_0x460825['split']&&_0x2defa6[_0x4756('0x16')]>0x1;var _0x16f7b7=[];if(!fs[_0x4756('0x34')](path[_0x4756('0x35')](_0x12b0e4,_0x214235))&&_0x8bd8fd){fs[_0x4756('0x36')](path[_0x4756('0x35')](_0x12b0e4,_0x214235));}return BPromise[_0x4756('0x37')](_0x2defa6,function(_0x572d1b){_0x16f7b7[_0x4756('0x19')](_0x572d1b);})[_0x4756('0x29')](function(){var _0x1ea800=[];for(var _0x1341b1=0x0;_0x1341b1<_0x16f7b7[_0x4756('0x16')];_0x1341b1+=0x1){var _0x39911f=_0x16f7b7[_0x1341b1];var _0x244571=createTables(_['flatten'](_0x39911f));var _0x2cbec1;var _0x37793a=getPDFDocDefinition(_0x244571);var _0x4deec0=getPDFPrinter();var _0x2c8655=_0x4deec0[_0x4756('0x38')](_0x37793a);if(_0x8bd8fd){_0x2cbec1=path[_0x4756('0x35')](_0x12b0e4,_0x214235,util['format'](_0x4756('0x39'),_0x214235,_0x1341b1,'pdf'));}else{_0x2cbec1=path[_0x4756('0x35')](_0x12b0e4,util[_0x4756('0x1d')](_0x4756('0x3a'),_0x214235,_0x4756('0x3b')));}_0x1ea800[_0x4756('0x19')](writePDFDocument(_0x2c8655,_0x2cbec1));}return Promise['all'](_0x1ea800);})[_0x4756('0x29')](function(){if(_0x8bd8fd){return new Promise(function(_0x213a8e){zipdir(path['join'](_0x12b0e4,_0x214235),{'saveTo':path[_0x4756('0x35')](_0x12b0e4,util[_0x4756('0x1d')]('%s.%s',_0x214235,_0x4756('0x3c')))},function(){rimraf(path[_0x4756('0x35')](_0x12b0e4,_0x214235),function(){});_0x213a8e('zip\x20finished');});});}})[_0x4756('0x29')](function(){if(!_0x8bd8fd)return;rimraf(path[_0x4756('0x35')](_0x12b0e4,_0x214235),function(){});})[_0x4756('0x29')](function(){logger[_0x4756('0x3d')](util[_0x4756('0x1d')](_0x4756('0x3e'),EXTRACTED_REPORT_ID,_0x4756('0x3f')));return analyticExtractedReport(_0x4756('0x40'),_0x8bd8fd?util['format'](_0x4756('0x3a'),_0x214235,_0x8bd8fd?'zip':_0x4756('0x3b')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x4756('0x3d')](util[_0x4756('0x1d')](_0x4756('0x41'),EXTRACTED_REPORT_ID,_0x4756('0x3f')));return db[_0x4756('0x42')][_0x4756('0x43')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x4756('0x29')](function(_0xbab44d){EXTRACTED_REPORT=_0xbab44d;return dbH[_0x4756('0x2d')][_0x4756('0x30')](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x4756('0x2d')]['QueryTypes']['SELECT']});})[_0x4756('0x29')](extractReport)['catch'](function(_0x73dec1){logger[_0x4756('0x3d')](util[_0x4756('0x1d')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x4756('0x3f')),util[_0x4756('0x44')](_0x73dec1,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x4756('0x45')](function(){process[_0x4756('0x46')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x2c3f4f=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0x4756('0x47'),'italics':__dirname+_0x4756('0x48'),'bolditalics':__dirname+_0x4756('0x49')}});return _0x2c3f4f;}function getPDFDocDefinitionFromHTML(_0x1c0315,_0x455291){var _0x1f1501=util['format']('%s\x20#%d',_0x455291[_0x4756('0x4a')],_0x455291[_0x4756('0x4b')]);var _0x1c6d8e=moment()[_0x4756('0x1d')](_0x4756('0x4c'))['toString']();var _0x383e05=htmlToPdfmake(_0x1c0315,{'window':window,'tableAutoSize':!![]});return{'content':[_0x383e05],'defaultStyle':{'font':_0x4756('0x4d')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x4756('0x4e'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x4756('0x4e')}},'header':function(){return[{'text':_0x4756('0x4f'),'style':_0x4756('0x50')}];},'footer':function(_0x12c7ed,_0x3e1549){return[{'text':util['format'](_0x4756('0x51'),_0x1f1501,_0x12c7ed,_0x3e1549,_0x1c6d8e),'style':_0x4756('0x52')}];}};}function writePDFDocument(_0xf8971,_0x3003f2){return new Promise(function(_0x80a2e0,_0x646131){var _0x1e6555=_0xf8971['pipe'](fs[_0x4756('0x53')](_0x3003f2));_0x1e6555['on']('finish',function(){_0x80a2e0(_0x4756('0x54'));});_0x1e6555['on'](_0x4756('0x55'),function(_0x288320){_0x646131(_0x288320);});_0xf8971[_0x4756('0x56')]();});}exports[_0x4756('0x57')]=function(_0x2a923b,_0x28789b){var _0xec19a2=getPDFPrinter();var _0x2a06b3=getPDFDocDefinitionFromHTML(_0x2a923b,_0x28789b);var _0x57a23f=_0xec19a2[_0x4756('0x38')](_0x2a06b3);return writePDFDocument(_0x57a23f,_0x28789b['path'])[_0x4756('0x58')](function(_0x21d7a1){throw _0x21d7a1;});}; \ No newline at end of file +var _0xa9aa=['finally','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','finish','error','end','createPdfFromHTML','catch','lodash','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','toString','fill','auto','body','push','concat','chunk','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','length','header','pageBreak','before','landscape','\x20/\x20','Arial','black','num','Empty','Setting','find','splitSizePdf','then','split','range','isInteger','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','query','dirname','basename','existsSync','mkdirSync','flatten','createPdfKitDocument','join','%s%d.%s','%s.%s','pdf','all','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','zip','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed'];(function(_0x2d0230,_0xc380c){var _0x494278=function(_0x142b9a){while(--_0x142b9a){_0x2d0230['push'](_0x2d0230['shift']());}};_0x494278(++_0xc380c);}(_0xa9aa,0x1e1));var _0xaa9a=function(_0x1c117d,_0x3f439d){_0x1c117d=_0x1c117d-0x0;var _0x3566e4=_0xa9aa[_0x1c117d];return _0x3566e4;};'use strict';var _=require(_0xaa9a('0x0'));var fs=require('fs');var util=require('util');var path=require(_0xaa9a('0x1'));var moment=require(_0xaa9a('0x2'));var htmlToPdfmake=require(_0xaa9a('0x3'));var PdfPrinter=require(_0xaa9a('0x4'));var zipdir=require(_0xaa9a('0x5'));var rimraf=require(_0xaa9a('0x6'));var JSDOM=require(_0xaa9a('0x7'))[_0xaa9a('0x8')];var window=new JSDOM('')[_0xaa9a('0x9')];var BPromise=require(_0xaa9a('0xa'));var db=require(_0xaa9a('0xb'))['db'];var dbH=require(_0xaa9a('0xb'))[_0xaa9a('0xc')];var logger=require('../../config/logger')(_0xaa9a('0xd'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xaa9a('0xe')][0x5];var FORMAT=_0xaa9a('0xf');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x3468da,_0x12102b){var _0x2dc3cc={'status':_0x3468da};var _0x27258c={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x12102b){_0x2dc3cc[_0xaa9a('0x10')]=_0x12102b;}return db[_0xaa9a('0x11')][_0xaa9a('0x12')](_0x2dc3cc,_0x27258c);}function getHeaders(_0x45715b){return _[_0xaa9a('0x13')](_0x45715b,function(_0x3deb3e){return{'text':_0x3deb3e,'style':_0xaa9a('0x14')};});}function getRows(_0x30ea75,_0x5bf042){return _[_0xaa9a('0x13')](_0x5bf042,function(_0x458e70){return _(_0x458e70)['pick'](_0x30ea75)[_0xaa9a('0x13')](function(_0x4bdbb8){return _0x4bdbb8?_[_0xaa9a('0x15')](_0x4bdbb8):'';})['value']();});}function createTable(_0x26af38,_0x5e619d){var _0x2afd09={'widths':_[_0xaa9a('0x16')](Array(_0x26af38['length']),0x91),'heights':function(_0x4a7091){return _0x4a7091===0x0?_0xaa9a('0x17'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x2d2298=getHeaders(_0x26af38);_0x2afd09[_0xaa9a('0x18')][_0xaa9a('0x19')](_0x2d2298);var _0x527909=getRows(_0x26af38,_0x5e619d);_0x2afd09[_0xaa9a('0x18')]=_0x2afd09[_0xaa9a('0x18')][_0xaa9a('0x1a')](_0x527909);return _0x2afd09;}function createTables(_0x1642a6){var _0x3f029b=[];var _0x274bdf=_[_0xaa9a('0x1b')](Object['keys'](_0x1642a6[0x0]),0x5);_0x274bdf['forEach'](function(_0xb0a64a){_0x3f029b[_0xaa9a('0x19')](createTable(_0xb0a64a,_0x1642a6));});return _0x3f029b;}function getPDFDocDefinition(_0x429a11){var _0x5587a7=util[_0xaa9a('0x1c')](_0xaa9a('0x1d'),NAME,EXTRACTED_REPORT[_0xaa9a('0x1e')],moment(EXTRACTED_REPORT[_0xaa9a('0x1f')])[_0xaa9a('0x1c')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0xaa9a('0x1c')](FORMAT));var _0x1ffc85=[];for(var _0x228e22=0x0;_0x228e22<_0x429a11[_0xaa9a('0x20')];_0x228e22++){var _0x5c1c39=[];if(_0x228e22===0x0){_0x5c1c39['push']({'text':_0x5587a7,'style':_0xaa9a('0x21')});}var _0x335ef9={'table':_0x429a11[_0x228e22]};if(_0x228e22>0x0){_0x335ef9[_0xaa9a('0x22')]=_0xaa9a('0x23');_0x335ef9['margin']=[0x0,0x46,0x0,0x0];}_0x5c1c39['push'](_0x335ef9);_0x1ffc85[_0xaa9a('0x19')](_0x5c1c39);}return{'pageSize':'A4','pageOrientation':_0xaa9a('0x24'),'content':_0x1ffc85,'footer':function(_0x20ac86,_0x529463){return{'text':_0x20ac86[_0xaa9a('0x15')]()+_0xaa9a('0x25')+_0x529463,'style':'footer'};},'defaultStyle':{'font':_0xaa9a('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xaa9a('0x27')},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x2d63bd){var _0x588af8=0x1388;var _0x29907e;if(!_0x2d63bd[0x0][_0xaa9a('0x28')]){return analyticExtractedReport(_0xaa9a('0x29'));}return db[_0xaa9a('0x2a')][_0xaa9a('0x2b')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xaa9a('0x2c')]})[_0xaa9a('0x2d')](function(_0x90112c){if(_0x90112c){_0x29907e=_0x90112c;_0x588af8=_0x29907e[_0xaa9a('0x2c')]||0x3e8;}})[_0xaa9a('0x2d')](function(){var _0x308e4d=[];var _0x114ec3=0x0;if(_0x29907e[_0xaa9a('0x2e')]){if(_0x2d63bd&&_0x2d63bd[_0xaa9a('0x20')]){var _0x1fdb58=_[_0xaa9a('0x2f')](_0x2d63bd[0x0][_0xaa9a('0x28')]/_0x588af8);var _0x113478=Number[_0xaa9a('0x30')](_0x2d63bd[0x0]['num']/_0x588af8)?_0x2d63bd[0x0][_0xaa9a('0x28')]%_0x588af8:0x0;_0x1fdb58['forEach'](function(_0x52b16a){if(_0x52b16a>0x0){_0x114ec3+=_0x588af8;}_0x308e4d['push'](dbH[_0xaa9a('0x31')]['query'](util[_0xaa9a('0x1c')](_0xaa9a('0x32'),QUERY,_0x588af8,_0x114ec3),{'type':dbH[_0xaa9a('0x31')][_0xaa9a('0x33')][_0xaa9a('0x34')]}));});if(_0x113478>0x0){_0x114ec3+=_0x588af8;_0x308e4d['push'](dbH[_0xaa9a('0x31')][_0xaa9a('0x35')](util[_0xaa9a('0x1c')](_0xaa9a('0x32'),QUERY,_0x113478,_0x114ec3),{'type':dbH[_0xaa9a('0x31')][_0xaa9a('0x33')][_0xaa9a('0x34')]}));}}}else{_0x308e4d[_0xaa9a('0x19')](dbH[_0xaa9a('0x31')][_0xaa9a('0x35')](QUERY,{'type':dbH[_0xaa9a('0x31')][_0xaa9a('0x33')][_0xaa9a('0x34')]}));}var _0x2b9614=path[_0xaa9a('0x36')](PATH);var _0xb6f82b=path[_0xaa9a('0x37')](PATH,'.pdf');var _0x63de42=_0x29907e[_0xaa9a('0x2e')]&&_0x308e4d['length']>0x1;var _0x5ddfd6=[];if(!fs[_0xaa9a('0x38')](path['join'](_0x2b9614,_0xb6f82b))&&_0x63de42){fs[_0xaa9a('0x39')](path['join'](_0x2b9614,_0xb6f82b));}return BPromise['each'](_0x308e4d,function(_0x5db986){_0x5ddfd6[_0xaa9a('0x19')](_0x5db986);})[_0xaa9a('0x2d')](function(){var _0x7d1c9f=[];for(var _0x576eed=0x0;_0x576eed<_0x5ddfd6[_0xaa9a('0x20')];_0x576eed+=0x1){var _0x1c4868=_0x5ddfd6[_0x576eed];var _0x24de9f=createTables(_[_0xaa9a('0x3a')](_0x1c4868));var _0x4a85c9;var _0x2a422a=getPDFDocDefinition(_0x24de9f);var _0x562619=getPDFPrinter();var _0x595d37=_0x562619[_0xaa9a('0x3b')](_0x2a422a);if(_0x63de42){_0x4a85c9=path[_0xaa9a('0x3c')](_0x2b9614,_0xb6f82b,util[_0xaa9a('0x1c')](_0xaa9a('0x3d'),_0xb6f82b,_0x576eed,'pdf'));}else{_0x4a85c9=path['join'](_0x2b9614,util[_0xaa9a('0x1c')](_0xaa9a('0x3e'),_0xb6f82b,_0xaa9a('0x3f')));}_0x7d1c9f[_0xaa9a('0x19')](writePDFDocument(_0x595d37,_0x4a85c9));}return Promise[_0xaa9a('0x40')](_0x7d1c9f);})[_0xaa9a('0x2d')](function(){if(_0x63de42){return new Promise(function(_0x399005){zipdir(path[_0xaa9a('0x3c')](_0x2b9614,_0xb6f82b),{'saveTo':path['join'](_0x2b9614,util[_0xaa9a('0x1c')](_0xaa9a('0x3e'),_0xb6f82b,'zip'))},function(){rimraf(path[_0xaa9a('0x3c')](_0x2b9614,_0xb6f82b),function(){});_0x399005(_0xaa9a('0x41'));});});}})['then'](function(){if(!_0x63de42)return;rimraf(path[_0xaa9a('0x3c')](_0x2b9614,_0xb6f82b),function(){});})['then'](function(){logger[_0xaa9a('0x42')](util[_0xaa9a('0x1c')](_0xaa9a('0x43'),EXTRACTED_REPORT_ID,_0xaa9a('0x44')));return analyticExtractedReport(_0xaa9a('0x45'),_0x63de42?util[_0xaa9a('0x1c')]('%s.%s',_0xb6f82b,_0x63de42?_0xaa9a('0x46'):_0xaa9a('0x3f')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xaa9a('0x42')](util[_0xaa9a('0x1c')](_0xaa9a('0x47'),EXTRACTED_REPORT_ID,_0xaa9a('0x44')));return db[_0xaa9a('0x11')][_0xaa9a('0x48')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x43d7fa){EXTRACTED_REPORT=_0x43d7fa;return dbH[_0xaa9a('0x31')][_0xaa9a('0x35')](util['format'](_0xaa9a('0x49'),QUERY),{'type':dbH[_0xaa9a('0x31')][_0xaa9a('0x33')][_0xaa9a('0x34')]});})[_0xaa9a('0x2d')](extractReport)['catch'](function(_0xc63b80){logger[_0xaa9a('0x42')](util[_0xaa9a('0x1c')](_0xaa9a('0x4a'),EXTRACTED_REPORT_ID,_0xaa9a('0x44')),util[_0xaa9a('0x4b')](_0xc63b80,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xaa9a('0x4c'));})[_0xaa9a('0x4d')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x241507=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0xaa9a('0x4e'),'italics':__dirname+_0xaa9a('0x4f'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x241507;}function getPDFDocDefinitionFromHTML(_0x1b322b,_0x20931c){var _0xce1bdc=util[_0xaa9a('0x1c')](_0xaa9a('0x50'),_0x20931c[_0xaa9a('0x51')],_0x20931c[_0xaa9a('0x52')]);var _0x5063a1=moment()[_0xaa9a('0x1c')](_0xaa9a('0x53'))[_0xaa9a('0x15')]();var _0x3d5979=htmlToPdfmake(_0x1b322b,{'window':window,'tableAutoSize':!![]});return{'content':[_0x3d5979],'defaultStyle':{'font':_0xaa9a('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xaa9a('0x54'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xaa9a('0x54'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xaa9a('0x54')}},'header':function(){return[{'text':_0xaa9a('0x55'),'style':_0xaa9a('0x21')}];},'footer':function(_0x4d0a1c,_0x41734c){return[{'text':util[_0xaa9a('0x1c')](_0xaa9a('0x56'),_0xce1bdc,_0x4d0a1c,_0x41734c,_0x5063a1),'style':'footer'}];}};}function writePDFDocument(_0x3b73db,_0x4c65bb){return new Promise(function(_0x2e013d,_0x36cb50){var _0x477b7d=_0x3b73db[_0xaa9a('0x57')](fs['createWriteStream'](_0x4c65bb));_0x477b7d['on'](_0xaa9a('0x58'),function(){_0x2e013d(_0xaa9a('0x58'));});_0x477b7d['on'](_0xaa9a('0x59'),function(_0x12d62f){_0x36cb50(_0x12d62f);});_0x3b73db[_0xaa9a('0x5a')]();});}exports[_0xaa9a('0x5b')]=function(_0x3f3c7c,_0x391701){var _0x5b7b81=getPDFPrinter();var _0xd72bcd=getPDFDocDefinitionFromHTML(_0x3f3c7c,_0x391701);var _0x3bd9af=_0x5b7b81[_0xaa9a('0x3b')](_0xd72bcd);return writePDFDocument(_0x3bd9af,_0x391701[_0xaa9a('0x1')])[_0xaa9a('0x5c')](function(_0x1ec0bc){throw _0x1ec0bc;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 3b6809e..7eabfd8 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 _0x4170=['lodash','json2xls','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','AnalyticExtractedReport','update','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','format','sequelize','QueryTypes','SELECT','num','length','range','forEach','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','existsSync','join','mkdirSync','%s%d.%s','xlsx','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','info','inspect','finally','exit','util','path'];(function(_0x1fdce8,_0x21f3be){var _0x4ae5ce=function(_0x16895e){while(--_0x16895e){_0x1fdce8['push'](_0x1fdce8['shift']());}};_0x4ae5ce(++_0x21f3be);}(_0x4170,0x166));var _0x0417=function(_0xd3e8ed,_0x1edd23){_0xd3e8ed=_0xd3e8ed-0x0;var _0x3578b9=_0x4170[_0xd3e8ed];return _0x3578b9;};'use strict';var util=require(_0x0417('0x0'));var path=require(_0x0417('0x1'));var _=require(_0x0417('0x2'));var fs=require('fs');var json2xls=require(_0x0417('0x3'));var BPromise=require('bluebird');var zipdir=require(_0x0417('0x4'));var rimraf=require(_0x0417('0x5'));var db=require(_0x0417('0x6'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0x0417('0x7'))(_0x0417('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x0417('0x9')][0x2]);var QUERY=process[_0x0417('0x9')][0x3];var PATH=process[_0x0417('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x253547,_0x363cd9){var _0x55eed0={'status':_0x253547};var _0x5e9399={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x363cd9){_0x55eed0['savename']=_0x363cd9;}return db[_0x0417('0xa')][_0x0417('0xb')](_0x55eed0,_0x5e9399);}function main(){var _0x1cb3f4=0x1388;var _0x88fe46;logger['info'](util['format'](_0x0417('0xc'),EXTRACTED_REPORT_ID,_0x0417('0xd')));return db[_0x0417('0xe')][_0x0417('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0417('0x10'),_0x0417('0x11')]})['then'](function(_0x2ebb97){if(_0x2ebb97){_0x88fe46=_0x2ebb97;_0x1cb3f4=_0x88fe46['splitSizeXlsx']||0x1388;}})[_0x0417('0x12')](function(){return dbH['sequelize']['query'](util[_0x0417('0x13')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x0417('0x14')][_0x0417('0x15')][_0x0417('0x16')]});})['then'](function(_0x1a2060){if(!_0x1a2060[0x0][_0x0417('0x17')]){return analyticExtractedReport('Empty');}var _0x2a779a=[];var _0x3221bd=0x0;if(_0x88fe46[_0x0417('0x10')]){if(_0x1a2060&&_0x1a2060[_0x0417('0x18')]){var _0xdb60d=_[_0x0417('0x19')](_0x1a2060[0x0]['num']/_0x1cb3f4);var _0x4bb5a3=Number['isInteger'](_0x1a2060[0x0][_0x0417('0x17')]/_0x1cb3f4)?_0x1a2060[0x0][_0x0417('0x17')]%_0x1cb3f4:0x0;_0xdb60d[_0x0417('0x1a')](function(_0x2ee500){if(_0x2ee500>0x0){_0x3221bd+=_0x1cb3f4;}_0x2a779a[_0x0417('0x1b')](dbH[_0x0417('0x14')]['query'](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x1cb3f4,_0x3221bd),{'type':dbH[_0x0417('0x14')][_0x0417('0x15')][_0x0417('0x16')]}));});if(_0x4bb5a3>0x0){_0x3221bd+=_0x1cb3f4;_0x2a779a[_0x0417('0x1b')](dbH[_0x0417('0x14')][_0x0417('0x1c')](util[_0x0417('0x13')](_0x0417('0x1d'),QUERY,_0x4bb5a3,_0x3221bd),{'type':dbH[_0x0417('0x14')][_0x0417('0x15')]['SELECT']}));}}}else{_0x2a779a[_0x0417('0x1b')](dbH[_0x0417('0x14')][_0x0417('0x1c')](QUERY,{'type':dbH[_0x0417('0x14')][_0x0417('0x15')]['SELECT']}));}var _0x508683=path[_0x0417('0x1e')](PATH);var _0x1a92fd=path['basename'](PATH,'.xlsx');var _0x490883=_0x88fe46[_0x0417('0x10')]&&_0x2a779a['length']>0x1;var _0x32f073=[];if(!fs[_0x0417('0x1f')](path[_0x0417('0x20')](_0x508683,_0x1a92fd))&&_0x490883){fs[_0x0417('0x21')](path[_0x0417('0x20')](_0x508683,_0x1a92fd));}return BPromise['each'](_0x2a779a,function(_0x36cf27){_0x32f073[_0x0417('0x1b')](_0x36cf27);})['then'](function(){for(var _0x47df20=0x0;_0x47df20<_0x32f073[_0x0417('0x18')];_0x47df20+=0x1){var _0x59cc2d;var _0x54dbb4=_0x32f073[_0x47df20];if(_0x490883){_0x59cc2d=path[_0x0417('0x20')](_0x508683,_0x1a92fd,util[_0x0417('0x13')](_0x0417('0x22'),_0x1a92fd,_0x47df20,_0x0417('0x23')));}else{_0x59cc2d=path[_0x0417('0x20')](_0x508683,util[_0x0417('0x13')](_0x0417('0x24'),_0x1a92fd,'xlsx'));}fs['writeFileSync'](_0x59cc2d,json2xls(_0x54dbb4),'binary');}})[_0x0417('0x12')](function(){if(_0x490883){return new Promise(function(_0x153e16){zipdir(path[_0x0417('0x20')](_0x508683,_0x1a92fd),{'saveTo':path['join'](_0x508683,util['format'](_0x0417('0x24'),_0x1a92fd,_0x0417('0x25')))},function(_0x1f4e5f,_0x3d4c10){rimraf(path[_0x0417('0x20')](_0x508683,_0x1a92fd),function(){});_0x153e16('zip\x20finished');});});}})['then'](function(){logger['info'](util['format'](_0x0417('0x26'),EXTRACTED_REPORT_ID,_0x0417('0xd')));return analyticExtractedReport(_0x0417('0x27'),_0x490883?util['format']('%s.%s',_0x1a92fd,_0x490883?_0x0417('0x25'):'xlsx'):null);});})[_0x0417('0x28')](function(_0x2c5b89){logger[_0x0417('0x29')](util[_0x0417('0x13')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'),util[_0x0417('0x2a')](_0x2c5b89,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x0417('0x2b')](function(){process[_0x0417('0x2c')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xc7ee=['dirname','.xlsx','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','writeFileSync','%s.%s','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','exit','util','path','lodash','json2xls','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','format','SELECT','Empty','length','range','num','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push'];(function(_0x283376,_0x485afa){var _0x159184=function(_0x359fca){while(--_0x359fca){_0x283376['push'](_0x283376['shift']());}};_0x159184(++_0x485afa);}(_0xc7ee,0x1aa));var _0xec7e=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xc7ee[_0x3bf83f];return _0x22c4a9;};'use strict';var util=require(_0xec7e('0x0'));var path=require(_0xec7e('0x1'));var _=require(_0xec7e('0x2'));var fs=require('fs');var json2xls=require(_0xec7e('0x3'));var BPromise=require(_0xec7e('0x4'));var zipdir=require(_0xec7e('0x5'));var rimraf=require('rimraf');var db=require(_0xec7e('0x6'))['db'];var dbH=require(_0xec7e('0x6'))[_0xec7e('0x7')];var logger=require(_0xec7e('0x8'))(_0xec7e('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0xec7e('0xa')][0x2]);var QUERY=process[_0xec7e('0xa')][0x3];var PATH=process[_0xec7e('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x6c6886,_0x42b468){var _0x2d1f7f={'status':_0x6c6886};var _0x37d03a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x42b468){_0x2d1f7f[_0xec7e('0xb')]=_0x42b468;}return db[_0xec7e('0xc')]['update'](_0x2d1f7f,_0x37d03a);}function main(){var _0x311495=0x1388;var _0x25ee79;logger[_0xec7e('0xd')](util['format'](_0xec7e('0xe'),EXTRACTED_REPORT_ID,_0xec7e('0xf')));return db[_0xec7e('0x10')][_0xec7e('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xec7e('0x12'),_0xec7e('0x13')]})[_0xec7e('0x14')](function(_0x6fabd4){if(_0x6fabd4){_0x25ee79=_0x6fabd4;_0x311495=_0x25ee79['splitSizeXlsx']||0x1388;}})[_0xec7e('0x14')](function(){return dbH[_0xec7e('0x15')][_0xec7e('0x16')](util[_0xec7e('0x17')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xec7e('0x15')]['QueryTypes'][_0xec7e('0x18')]});})[_0xec7e('0x14')](function(_0x22510a){if(!_0x22510a[0x0]['num']){return analyticExtractedReport(_0xec7e('0x19'));}var _0x50bc12=[];var _0x4b25cb=0x0;if(_0x25ee79[_0xec7e('0x12')]){if(_0x22510a&&_0x22510a[_0xec7e('0x1a')]){var _0x252705=_[_0xec7e('0x1b')](_0x22510a[0x0][_0xec7e('0x1c')]/_0x311495);var _0x353ab3=Number['isInteger'](_0x22510a[0x0][_0xec7e('0x1c')]/_0x311495)?_0x22510a[0x0][_0xec7e('0x1c')]%_0x311495:0x0;_0x252705[_0xec7e('0x1d')](function(_0xdb6bc5){if(_0xdb6bc5>0x0){_0x4b25cb+=_0x311495;}_0x50bc12['push'](dbH[_0xec7e('0x15')]['query'](util[_0xec7e('0x17')](_0xec7e('0x1e'),QUERY,_0x311495,_0x4b25cb),{'type':dbH['sequelize'][_0xec7e('0x1f')][_0xec7e('0x18')]}));});if(_0x353ab3>0x0){_0x4b25cb+=_0x311495;_0x50bc12[_0xec7e('0x20')](dbH[_0xec7e('0x15')][_0xec7e('0x16')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x353ab3,_0x4b25cb),{'type':dbH[_0xec7e('0x15')][_0xec7e('0x1f')]['SELECT']}));}}}else{_0x50bc12[_0xec7e('0x20')](dbH['sequelize'][_0xec7e('0x16')](QUERY,{'type':dbH[_0xec7e('0x15')][_0xec7e('0x1f')]['SELECT']}));}var _0x481fb5=path[_0xec7e('0x21')](PATH);var _0x55f819=path['basename'](PATH,_0xec7e('0x22'));var _0x5dc19c=_0x25ee79[_0xec7e('0x12')]&&_0x50bc12[_0xec7e('0x1a')]>0x1;var _0x2f61e7=[];if(!fs[_0xec7e('0x23')](path[_0xec7e('0x24')](_0x481fb5,_0x55f819))&&_0x5dc19c){fs[_0xec7e('0x25')](path['join'](_0x481fb5,_0x55f819));}return BPromise[_0xec7e('0x26')](_0x50bc12,function(_0x337faa){_0x2f61e7[_0xec7e('0x20')](_0x337faa);})[_0xec7e('0x14')](function(){for(var _0x3b2e27=0x0;_0x3b2e27<_0x2f61e7[_0xec7e('0x1a')];_0x3b2e27+=0x1){var _0x24cf8e;var _0x2f9b97=_0x2f61e7[_0x3b2e27];if(_0x5dc19c){_0x24cf8e=path[_0xec7e('0x24')](_0x481fb5,_0x55f819,util['format'](_0xec7e('0x27'),_0x55f819,_0x3b2e27,_0xec7e('0x28')));}else{_0x24cf8e=path[_0xec7e('0x24')](_0x481fb5,util[_0xec7e('0x17')]('%s.%s',_0x55f819,'xlsx'));}fs[_0xec7e('0x29')](_0x24cf8e,json2xls(_0x2f9b97),'binary');}})['then'](function(){if(_0x5dc19c){return new Promise(function(_0x6dedce){zipdir(path[_0xec7e('0x24')](_0x481fb5,_0x55f819),{'saveTo':path[_0xec7e('0x24')](_0x481fb5,util[_0xec7e('0x17')](_0xec7e('0x2a'),_0x55f819,'zip'))},function(_0x19ac47,_0x441ecb){rimraf(path[_0xec7e('0x24')](_0x481fb5,_0x55f819),function(){});_0x6dedce(_0xec7e('0x2b'));});});}})[_0xec7e('0x14')](function(){logger['info'](util['format'](_0xec7e('0x2c'),EXTRACTED_REPORT_ID,_0xec7e('0xf')));return analyticExtractedReport(_0xec7e('0x2d'),_0x5dc19c?util[_0xec7e('0x17')](_0xec7e('0x2a'),_0x55f819,_0x5dc19c?_0xec7e('0x2e'):_0xec7e('0x28')):null);});})[_0xec7e('0x2f')](function(_0x46aa1a){logger[_0xec7e('0xd')](util['format'](_0xec7e('0x30'),EXTRACTED_REPORT_ID,_0xec7e('0xf')),util[_0xec7e('0x31')](_0x46aa1a,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process[_0xec7e('0x32')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index d3d82dd..340ca42 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 _0xfd0e=['CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','exten','queue','playback','priority','extensions','extension','find','push','Set','CDR(type)=%s','type','context','VoiceExtensionId','CDR(routeid)=','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','updatedAt','interval','*,*,*,*','IntervalId','tag','CDR(tag)=','hasOwnProperty','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime','last','concat','Hangup','transaction','bulkCreate','sortBy','rewrite','lodash','util','Interval','intervals','models','VoiceExtension','findAll','then','uniq','map'];(function(_0x15eeb5,_0x18125d){var _0x2aa5e4=function(_0x256785){while(--_0x256785){_0x15eeb5['push'](_0x15eeb5['shift']());}};_0x2aa5e4(++_0x18125d);}(_0xfd0e,0x159));var _0xefd0=function(_0x31172e,_0xa59e5){_0x31172e=_0x31172e-0x0;var _0x414ada=_0xfd0e[_0x31172e];return _0x414ada;};'use strict';var _=require(_0xefd0('0x0'));var util=require(_0xefd0('0x1'));function rewrite(_0x5b4bad,_0x67f82e){var _0x586152=this;return _0x5b4bad['models'][_0xefd0('0x2')]['findAll']({'raw':!![]})['then'](function(_0x4e89cb){_0x586152[_0xefd0('0x3')]=_0x4e89cb;return _0x5b4bad[_0xefd0('0x4')][_0xefd0('0x5')][_0xefd0('0x6')]({'where':{'IntervalId':_0x67f82e['IntervalId']},'raw':!![]});})[_0xefd0('0x7')](function(_0x4f0227){return _0x5b4bad[_0xefd0('0x4')][_0xefd0('0x5')][_0xefd0('0x6')]({'where':{'exten':{'$in':_[_0xefd0('0x8')](_[_0xefd0('0x9')](_0x4f0227,'exten'))}},'order':[{'raw':_0xefd0('0xa')}],'raw':!![]});})[_0xefd0('0x7')](function(_0x21c72d){var _0x43725b=_[_0xefd0('0xb')](_0x21c72d,{'priority':'1'});var _0x1a8d29=_[_0xefd0('0xb')](_0x21c72d,{'isApp':0x1});var _0x1b057d=_[_0xefd0('0xc')](_0x1a8d29,_0xefd0('0xd'));var _0x340bb0=[_0xefd0('0xe'),_0xefd0('0xf')];var _0x56e6a8=[];var _0x17b7e0=[];for(var _0x13c4f5 in _0x1b057d){if(_0x1b057d['hasOwnProperty'](_0x13c4f5)){_0x586152[_0xefd0('0x10')]=0x2;_0x586152[_0xefd0('0x11')]=[];_0x586152[_0xefd0('0x12')]=_[_0xefd0('0x13')](_0x43725b,{'exten':_0x1b057d[_0x13c4f5][0x0]['exten']});_0x586152[_0xefd0('0x11')][_0xefd0('0x14')]({'type':_0x1b057d[_0x13c4f5][0x0]['type'],'app':_0xefd0('0x15'),'appdata':util['format'](_0xefd0('0x16'),_0x1b057d[_0x13c4f5][0x0][_0xefd0('0x17')]),'context':_0x1b057d[_0x13c4f5][0x0][_0xefd0('0x18')],'exten':_0x1b057d[_0x13c4f5][0x0][_0xefd0('0xd')],'priority':_0x586152[_0xefd0('0x10')]++,'VoiceExtensionId':_0x1b057d[_0x13c4f5][0x0][_0xefd0('0x19')]});if(_0x1b057d[_0x13c4f5][0x0][_0xefd0('0x17')]==='inbound'){_0x586152[_0xefd0('0x11')]['push']({'type':_0x1b057d[_0x13c4f5][0x0][_0xefd0('0x17')],'app':_0xefd0('0x15'),'appdata':_0xefd0('0x1a')+_0x1b057d[_0x13c4f5][0x0][_0xefd0('0x19')],'context':_0x1b057d[_0x13c4f5][0x0][_0xefd0('0x18')],'exten':_0x1b057d[_0x13c4f5][0x0]['exten'],'priority':_0x586152[_0xefd0('0x10')]++,'VoiceExtensionId':_0x1b057d[_0x13c4f5][0x0][_0xefd0('0x19')]});}else if(_0x1b057d[_0x13c4f5][0x0][_0xefd0('0x17')]===_0xefd0('0x1b')){if(_0x586152[_0xefd0('0x12')]){_0x586152[_0xefd0('0x11')]['push']({'type':_0x1b057d[_0x13c4f5][0x0]['type'],'app':'Set','appdata':_0xefd0('0x1c')+(_0x586152[_0xefd0('0x12')][_0xefd0('0x1d')]?_0xefd0('0x1e')+_0x586152['extension']['cutdigits']+'}':_0xefd0('0x1f')),'context':_0x1b057d[_0x13c4f5][0x0][_0xefd0('0x18')],'exten':_0x1b057d[_0x13c4f5][0x0]['exten'],'priority':_0x586152[_0xefd0('0x10')]++,'VoiceExtensionId':_0x1b057d[_0x13c4f5][0x0][_0xefd0('0x19')]});}_0x586152['extensions'][_0xefd0('0x14')]({'type':_0x1b057d[_0x13c4f5][0x0][_0xefd0('0x17')],'app':_0xefd0('0x15'),'appdata':'CDR(routeid)='+_0x1b057d[_0x13c4f5][0x0]['VoiceExtensionId'],'context':_0x1b057d[_0x13c4f5][0x0][_0xefd0('0x18')],'exten':_0x1b057d[_0x13c4f5][0x0][_0xefd0('0xd')],'priority':_0x586152[_0xefd0('0x10')]++,'VoiceExtensionId':_0x1b057d[_0x13c4f5][0x0][_0xefd0('0x19')]});var _0x17d491=_0x586152['priority']++;_0x586152[_0xefd0('0x11')]['push']({'type':_0x1b057d[_0x13c4f5][0x0][_0xefd0('0x17')],'app':_0xefd0('0x20'),'appdata':_0xefd0('0x21')+(_0x17d491+0x2)+_0xefd0('0x22')+(_0x17d491+0x1)+')','context':_0x1b057d[_0x13c4f5][0x0]['context'],'exten':_0x1b057d[_0x13c4f5][0x0][_0xefd0('0xd')],'priority':_0x17d491,'VoiceExtensionId':_0x1b057d[_0x13c4f5][0x0][_0xefd0('0x19')]});if(_0x586152[_0xefd0('0x12')]){_0x586152[_0xefd0('0x11')]['push']({'type':_0x1b057d[_0x13c4f5][0x0][_0xefd0('0x17')],'app':_0xefd0('0x15'),'appdata':_0x586152['extension'][_0xefd0('0x1d')]?_0xefd0('0x23')+_0x586152[_0xefd0('0x12')][_0xefd0('0x1d')]+'}':_0xefd0('0x24'),'context':_0x1b057d[_0x13c4f5][0x0][_0xefd0('0x18')],'exten':_0x1b057d[_0x13c4f5][0x0]['exten'],'priority':_0x586152['priority']++,'VoiceExtensionId':_0x1b057d[_0x13c4f5][0x0][_0xefd0('0x19')]});}_0x586152[_0xefd0('0x11')][_0xefd0('0x14')]({'type':_0x1b057d[_0x13c4f5][0x0]['type'],'app':'Set','appdata':_0xefd0('0x25')+_0x1b057d[_0x13c4f5][0x0][_0xefd0('0x19')],'context':_0x1b057d[_0x13c4f5][0x0][_0xefd0('0x18')],'exten':_0x1b057d[_0x13c4f5][0x0][_0xefd0('0xd')],'priority':_0x586152['priority']++,'VoiceExtensionId':_0x1b057d[_0x13c4f5][0x0]['VoiceExtensionId']});if(_0x586152[_0xefd0('0x12')]&&_0x586152[_0xefd0('0x12')]['hasOwnProperty'](_0xefd0('0x26'))&&_0x586152[_0xefd0('0x12')][_0xefd0('0x26')]!==_0xefd0('0x27')){_0x586152[_0xefd0('0x11')][_0xefd0('0x14')]({'type':_0x1b057d[_0x13c4f5][0x0][_0xefd0('0x17')],'app':_0xefd0('0x15'),'appdata':_0xefd0('0x28'),'context':_0x1b057d[_0x13c4f5][0x0][_0xefd0('0x18')],'exten':_0x1b057d[_0x13c4f5][0x0]['exten'],'priority':_0x586152['priority']++,'VoiceExtensionId':_0x1b057d[_0x13c4f5][0x0]['VoiceExtensionId']});_0x586152[_0xefd0('0x11')][_0xefd0('0x14')]({'type':_0x1b057d[_0x13c4f5][0x0][_0xefd0('0x17')],'app':_0xefd0('0x15'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x586152[_0xefd0('0x12')][_0xefd0('0x26')]||'wav','context':_0x1b057d[_0x13c4f5][0x0][_0xefd0('0x18')],'exten':_0x1b057d[_0x13c4f5][0x0]['exten'],'priority':_0x586152['priority']++,'VoiceExtensionId':_0x1b057d[_0x13c4f5][0x0][_0xefd0('0x19')]});}}_0x586152[_0xefd0('0x11')][_0xefd0('0x14')]({'type':_0x1b057d[_0x13c4f5][0x0][_0xefd0('0x17')],'app':_0xefd0('0x15'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x1b057d[_0x13c4f5][0x0][_0xefd0('0x18')],'exten':_0x1b057d[_0x13c4f5][0x0][_0xefd0('0xd')],'priority':_0x586152[_0xefd0('0x10')]++,'VoiceExtensionId':_0x1b057d[_0x13c4f5][0x0][_0xefd0('0x19')]});_0x586152[_0xefd0('0x11')]['push']({'type':_0x1b057d[_0x13c4f5][0x0][_0xefd0('0x17')],'app':_0xefd0('0x15'),'appdata':_0xefd0('0x29'),'context':_0x1b057d[_0x13c4f5][0x0][_0xefd0('0x18')],'exten':_0x1b057d[_0x13c4f5][0x0][_0xefd0('0xd')],'priority':_0x586152[_0xefd0('0x10')]++,'VoiceExtensionId':_0x1b057d[_0x13c4f5][0x0][_0xefd0('0x19')]});_0x586152[_0xefd0('0x11')][_0xefd0('0x14')]({'type':_0x1b057d[_0x13c4f5][0x0][_0xefd0('0x17')],'app':_0xefd0('0x15'),'appdata':_0xefd0('0x2a'),'context':_0x1b057d[_0x13c4f5][0x0][_0xefd0('0x18')],'exten':_0x1b057d[_0x13c4f5][0x0]['exten'],'priority':_0x586152['priority']++,'VoiceExtensionId':_0x1b057d[_0x13c4f5][0x0][_0xefd0('0x19')]});for(var _0x518779=0x0,_0x3c78e9=0x0;_0x518779<_0x1b057d[_0x13c4f5][_0xefd0('0x2b')];_0x518779+=0x1,_0x3c78e9=0x0){var _0x51db69=_0x1b057d[_0x13c4f5][_0x518779];if(_0x51db69['type']){_0x51db69[_0xefd0('0x17')]=_0x51db69['type'][_0xefd0('0x2c')]();}var _0x3b663a=[];var _0x44dab3=[];delete _0x51db69['id'];delete _0x51db69['createdAt'];delete _0x51db69[_0xefd0('0x2d')];var _0x1d4fab=_0x51db69[_0xefd0('0x2e')]!==_0xefd0('0x2f')?[_0x51db69[_0xefd0('0x2e')]]:_0x51db69[_0xefd0('0x30')]?_['map'](_[_0xefd0('0xb')](_0x586152['intervals'],{'IntervalId':_0x51db69[_0xefd0('0x30')]}),_0xefd0('0x2e')):[];if(_0x51db69['hasOwnProperty'](_0xefd0('0x31'))){if(_0x51db69[_0xefd0('0x31')]&&_0x51db69[_0xefd0('0x31')]!=='--'){_0x3b663a[_0xefd0('0x14')]({'type':_0x51db69['type'],'app':_0xefd0('0x15'),'appdata':_0xefd0('0x32')+_0x51db69[_0xefd0('0x31')],'context':_0x51db69[_0xefd0('0x18')],'exten':_0x51db69[_0xefd0('0xd')],'priority':_0x1d4fab[_0xefd0('0x2b')]+_0x586152['priority']+_0x3c78e9++,'VoiceExtensionId':_0x51db69[_0xefd0('0x19')]});}}if(_0x51db69[_0xefd0('0x17')]===_0xefd0('0x1b')&&_0x51db69[_0xefd0('0x33')](_0xefd0('0x34'))){if(_0x51db69[_0xefd0('0x34')]){_0x3b663a[_0xefd0('0x14')]({'type':_0x51db69[_0xefd0('0x17')],'app':_0xefd0('0x20'),'appdata':_0xefd0('0x35')+_0x51db69[_0xefd0('0x34')]+')','context':_0x51db69[_0xefd0('0x18')],'exten':_0x51db69[_0xefd0('0xd')],'priority':_0x1d4fab[_0xefd0('0x2b')]+_0x586152[_0xefd0('0x10')]+_0x3c78e9++,'VoiceExtensionId':_0x51db69['VoiceExtensionId']});}else{_0x3b663a[_0xefd0('0x14')]({'type':_0x51db69[_0xefd0('0x17')],'app':_0xefd0('0x20'),'appdata':_0xefd0('0x36'),'context':_0x51db69['context'],'exten':_0x51db69[_0xefd0('0xd')],'priority':_0x1d4fab[_0xefd0('0x2b')]+_0x586152[_0xefd0('0x10')]+_0x3c78e9++,'VoiceExtensionId':_0x51db69[_0xefd0('0x19')]});}}if(_0x51db69['hasOwnProperty'](_0xefd0('0x37'))){if(_0x340bb0[_0xefd0('0x38')](_0x51db69[_0xefd0('0x39')][_0xefd0('0x2c')]())>=0x0&&_0x51db69['appType']!==_0xefd0('0x3a')){if(_0x51db69[_0xefd0('0x37')]){_0x3b663a[_0xefd0('0x14')]({'type':_0x51db69[_0xefd0('0x17')],'app':_0xefd0('0x20'),'appdata':_0xefd0('0x3b'),'context':_0x51db69[_0xefd0('0x18')],'exten':_0x51db69[_0xefd0('0xd')],'priority':_0x1d4fab['length']+_0x586152['priority']+_0x3c78e9++,'VoiceExtensionId':_0x51db69[_0xefd0('0x19')]});_0x3b663a[_0xefd0('0x14')]({'type':_0x51db69[_0xefd0('0x17')],'app':_0xefd0('0x15'),'appdata':_0xefd0('0x3c'),'context':_0x51db69['context'],'exten':_0x51db69['exten'],'priority':_0x1d4fab['length']+_0x586152[_0xefd0('0x10')]+_0x3c78e9++,'VoiceExtensionId':_0x51db69['VoiceExtensionId']});}else{_0x3b663a[_0xefd0('0x14')]({'type':_0x51db69[_0xefd0('0x17')],'app':'ExecIf','appdata':_0xefd0('0x3d'),'context':_0x51db69['context'],'exten':_0x51db69[_0xefd0('0xd')],'priority':_0x1d4fab[_0xefd0('0x2b')]+_0x586152[_0xefd0('0x10')]+_0x3c78e9++,'VoiceExtensionId':_0x51db69['VoiceExtensionId']});_0x3b663a['push']({'type':_0x51db69[_0xefd0('0x17')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x51db69[_0xefd0('0x18')],'exten':_0x51db69['exten'],'priority':_0x1d4fab[_0xefd0('0x2b')]+_0x586152[_0xefd0('0x10')]+_0x3c78e9++,'VoiceExtensionId':_0x51db69[_0xefd0('0x19')]});}}}for(var _0x3b6bd5=0x0;_0x3b6bd5<_0x1d4fab[_0xefd0('0x2b')];_0x3b6bd5+=0x1){var _0x29ea7b=_0x586152[_0xefd0('0x10')]+_0x1d4fab[_0xefd0('0x2b')];var _0x520697=_0x3b6bd5===_0x1d4fab[_0xefd0('0x2b')]-0x1?_0x586152[_0xefd0('0x10')]+_0x3b663a[_0xefd0('0x2b')]+_0x44dab3[_0xefd0('0x2b')]+0x2:_0x586152[_0xefd0('0x10')]+_0x3b6bd5+0x1;_0x3b663a[_0xefd0('0x3e')](_0x3b6bd5,0x0,{'type':_0x51db69[_0xefd0('0x17')],'app':_0xefd0('0x3f'),'appdata':_0x1d4fab[_0x3b6bd5]+'?'+_0x51db69[_0xefd0('0x18')]+',${EXTEN},'+_0x29ea7b+':'+_0x51db69['context']+',${EXTEN},'+_0x520697,'exten':_0x51db69['exten'],'context':_0x51db69[_0xefd0('0x18')],'priority':_0x586152['priority']+_0x3b6bd5,'VoiceExtensionId':_0x1b057d[_0x13c4f5][0x0][_0xefd0('0x19')]});}_0x51db69[_0xefd0('0x10')]=_0x3b663a['length']?_[_0xefd0('0x40')](_0x3b663a)[_0xefd0('0x10')]+0x1:_0x586152[_0xefd0('0x10')];_0x586152['priority']=(_0x44dab3[_0xefd0('0x2b')]?_[_0xefd0('0x40')](_0x44dab3)[_0xefd0('0x10')]:_0x51db69[_0xefd0('0x10')])+0x1;_0x586152[_0xefd0('0x11')]=_[_0xefd0('0x41')](_0x586152[_0xefd0('0x11')],_0x3b663a,[_0x51db69],_0x44dab3);}_0x586152[_0xefd0('0x11')][_0xefd0('0x14')]({'type':_0x1b057d[_0x13c4f5][0x0][_0xefd0('0x17')],'app':_0xefd0('0x42'),'exten':_0x1b057d[_0x13c4f5][0x0][_0xefd0('0xd')],'context':_0x1b057d[_0x13c4f5][0x0][_0xefd0('0x18')],'priority':_0x586152[_0xefd0('0x10')],'VoiceExtensionId':_0x1b057d[_0x13c4f5][0x0][_0xefd0('0x19')]});_0x56e6a8['push'](_0x1b057d[_0x13c4f5][0x0][_0xefd0('0x19')]);_0x17b7e0=_[_0xefd0('0x41')](_0x17b7e0,_0x586152[_0xefd0('0x11')]);}}return _0x5b4bad[_0xefd0('0x43')](function(_0x3bb78b){return _0x5b4bad[_0xefd0('0x4')]['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':{'$in':_0x56e6a8}},'transaction':_0x3bb78b})['then'](function(_0x205a33){return _0x5b4bad['models'][_0xefd0('0x5')][_0xefd0('0x44')](_[_0xefd0('0x45')](_0x17b7e0,_0xefd0('0x10')),{'transaction':_0x3bb78b});});});})['catch'](function(_0x14672b){console['error'](_0x14672b);});}exports[_0xefd0('0x46')]=rewrite; \ No newline at end of file +var _0x39ea=['sortBy','catch','error','lodash','util','models','Interval','then','intervals','VoiceExtension','findAll','IntervalId','uniq','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','exten','queue','playback','hasOwnProperty','priority','extensions','push','type','format','CDR(type)=%s','context','inbound','CDR(routeid)=','VoiceExtensionId','Set','extension','cutdigits','${EXTEN}','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','length','createdAt','updatedAt','interval','map','tag','CDR(tag)=','outbound','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','toLowerCase','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','concat','transaction','destroy','bulkCreate'];(function(_0x1b4260,_0x5aeb6d){var _0x48189f=function(_0x556beb){while(--_0x556beb){_0x1b4260['push'](_0x1b4260['shift']());}};_0x48189f(++_0x5aeb6d);}(_0x39ea,0xd8));var _0xa39e=function(_0x452599,_0x454f00){_0x452599=_0x452599-0x0;var _0x3cb6e5=_0x39ea[_0x452599];return _0x3cb6e5;};'use strict';var _=require(_0xa39e('0x0'));var util=require(_0xa39e('0x1'));function rewrite(_0x3a6926,_0x20c64e){var _0x115395=this;return _0x3a6926[_0xa39e('0x2')][_0xa39e('0x3')]['findAll']({'raw':!![]})[_0xa39e('0x4')](function(_0xc00213){_0x115395[_0xa39e('0x5')]=_0xc00213;return _0x3a6926[_0xa39e('0x2')][_0xa39e('0x6')][_0xa39e('0x7')]({'where':{'IntervalId':_0x20c64e[_0xa39e('0x8')]},'raw':!![]});})[_0xa39e('0x4')](function(_0x149c77){return _0x3a6926[_0xa39e('0x2')][_0xa39e('0x6')]['findAll']({'where':{'exten':{'$in':_[_0xa39e('0x9')](_['map'](_0x149c77,'exten'))}},'order':[{'raw':_0xa39e('0xa')}],'raw':!![]});})[_0xa39e('0x4')](function(_0x4176e1){var _0x35e310=_['filter'](_0x4176e1,{'priority':'1'});var _0x34ea40=_[_0xa39e('0xb')](_0x4176e1,{'isApp':0x1});var _0x40dadf=_[_0xa39e('0xc')](_0x34ea40,_0xa39e('0xd'));var _0x2f4d38=[_0xa39e('0xe'),_0xa39e('0xf')];var _0x17ccef=[];var _0x39141c=[];for(var _0x713b12 in _0x40dadf){if(_0x40dadf[_0xa39e('0x10')](_0x713b12)){_0x115395[_0xa39e('0x11')]=0x2;_0x115395['extensions']=[];_0x115395['extension']=_['find'](_0x35e310,{'exten':_0x40dadf[_0x713b12][0x0][_0xa39e('0xd')]});_0x115395[_0xa39e('0x12')][_0xa39e('0x13')]({'type':_0x40dadf[_0x713b12][0x0][_0xa39e('0x14')],'app':'Set','appdata':util[_0xa39e('0x15')](_0xa39e('0x16'),_0x40dadf[_0x713b12][0x0]['type']),'context':_0x40dadf[_0x713b12][0x0][_0xa39e('0x17')],'exten':_0x40dadf[_0x713b12][0x0][_0xa39e('0xd')],'priority':_0x115395[_0xa39e('0x11')]++,'VoiceExtensionId':_0x40dadf[_0x713b12][0x0]['VoiceExtensionId']});if(_0x40dadf[_0x713b12][0x0][_0xa39e('0x14')]===_0xa39e('0x18')){_0x115395['extensions'][_0xa39e('0x13')]({'type':_0x40dadf[_0x713b12][0x0][_0xa39e('0x14')],'app':'Set','appdata':_0xa39e('0x19')+_0x40dadf[_0x713b12][0x0][_0xa39e('0x1a')],'context':_0x40dadf[_0x713b12][0x0][_0xa39e('0x17')],'exten':_0x40dadf[_0x713b12][0x0][_0xa39e('0xd')],'priority':_0x115395[_0xa39e('0x11')]++,'VoiceExtensionId':_0x40dadf[_0x713b12][0x0]['VoiceExtensionId']});}else if(_0x40dadf[_0x713b12][0x0][_0xa39e('0x14')]==='outbound'){if(_0x115395['extension']){_0x115395[_0xa39e('0x12')]['push']({'type':_0x40dadf[_0x713b12][0x0][_0xa39e('0x14')],'app':_0xa39e('0x1b'),'appdata':'CDR(destination)='+(_0x115395[_0xa39e('0x1c')][_0xa39e('0x1d')]?'${EXTEN:'+_0x115395[_0xa39e('0x1c')][_0xa39e('0x1d')]+'}':_0xa39e('0x1e')),'context':_0x40dadf[_0x713b12][0x0]['context'],'exten':_0x40dadf[_0x713b12][0x0][_0xa39e('0xd')],'priority':_0x115395['priority']++,'VoiceExtensionId':_0x40dadf[_0x713b12][0x0][_0xa39e('0x1a')]});}_0x115395['extensions']['push']({'type':_0x40dadf[_0x713b12][0x0]['type'],'app':'Set','appdata':_0xa39e('0x19')+_0x40dadf[_0x713b12][0x0]['VoiceExtensionId'],'context':_0x40dadf[_0x713b12][0x0][_0xa39e('0x17')],'exten':_0x40dadf[_0x713b12][0x0]['exten'],'priority':_0x115395[_0xa39e('0x11')]++,'VoiceExtensionId':_0x40dadf[_0x713b12][0x0][_0xa39e('0x1a')]});var _0xa91992=_0x115395[_0xa39e('0x11')]++;_0x115395[_0xa39e('0x12')][_0xa39e('0x13')]({'type':_0x40dadf[_0x713b12][0x0][_0xa39e('0x14')],'app':'ExecIf','appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0xa91992+0x2)+_0xa39e('0x1f')+(_0xa91992+0x1)+')','context':_0x40dadf[_0x713b12][0x0]['context'],'exten':_0x40dadf[_0x713b12][0x0][_0xa39e('0xd')],'priority':_0xa91992,'VoiceExtensionId':_0x40dadf[_0x713b12][0x0][_0xa39e('0x1a')]});if(_0x115395[_0xa39e('0x1c')]){_0x115395[_0xa39e('0x12')]['push']({'type':_0x40dadf[_0x713b12][0x0][_0xa39e('0x14')],'app':_0xa39e('0x1b'),'appdata':_0x115395[_0xa39e('0x1c')][_0xa39e('0x1d')]?_0xa39e('0x20')+_0x115395[_0xa39e('0x1c')]['cutdigits']+'}':_0xa39e('0x21'),'context':_0x40dadf[_0x713b12][0x0]['context'],'exten':_0x40dadf[_0x713b12][0x0][_0xa39e('0xd')],'priority':_0x115395[_0xa39e('0x11')]++,'VoiceExtensionId':_0x40dadf[_0x713b12][0x0]['VoiceExtensionId']});}_0x115395[_0xa39e('0x12')]['push']({'type':_0x40dadf[_0x713b12][0x0]['type'],'app':'Set','appdata':_0xa39e('0x22')+_0x40dadf[_0x713b12][0x0]['VoiceExtensionId'],'context':_0x40dadf[_0x713b12][0x0][_0xa39e('0x17')],'exten':_0x40dadf[_0x713b12][0x0][_0xa39e('0xd')],'priority':_0x115395[_0xa39e('0x11')]++,'VoiceExtensionId':_0x40dadf[_0x713b12][0x0][_0xa39e('0x1a')]});if(_0x115395[_0xa39e('0x1c')]&&_0x115395['extension'][_0xa39e('0x10')]('recordingFormat')&&_0x115395[_0xa39e('0x1c')][_0xa39e('0x23')]!=='none'){_0x115395[_0xa39e('0x12')][_0xa39e('0x13')]({'type':_0x40dadf[_0x713b12][0x0][_0xa39e('0x14')],'app':_0xa39e('0x1b'),'appdata':_0xa39e('0x24'),'context':_0x40dadf[_0x713b12][0x0][_0xa39e('0x17')],'exten':_0x40dadf[_0x713b12][0x0]['exten'],'priority':_0x115395[_0xa39e('0x11')]++,'VoiceExtensionId':_0x40dadf[_0x713b12][0x0][_0xa39e('0x1a')]});_0x115395['extensions'][_0xa39e('0x13')]({'type':_0x40dadf[_0x713b12][0x0]['type'],'app':_0xa39e('0x1b'),'appdata':_0xa39e('0x25')+_0x115395[_0xa39e('0x1c')][_0xa39e('0x23')]||_0xa39e('0x26'),'context':_0x40dadf[_0x713b12][0x0][_0xa39e('0x17')],'exten':_0x40dadf[_0x713b12][0x0][_0xa39e('0xd')],'priority':_0x115395[_0xa39e('0x11')]++,'VoiceExtensionId':_0x40dadf[_0x713b12][0x0][_0xa39e('0x1a')]});}}_0x115395[_0xa39e('0x12')]['push']({'type':_0x40dadf[_0x713b12][0x0]['type'],'app':_0xa39e('0x1b'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x40dadf[_0x713b12][0x0][_0xa39e('0x17')],'exten':_0x40dadf[_0x713b12][0x0][_0xa39e('0xd')],'priority':_0x115395[_0xa39e('0x11')]++,'VoiceExtensionId':_0x40dadf[_0x713b12][0x0][_0xa39e('0x1a')]});_0x115395[_0xa39e('0x12')][_0xa39e('0x13')]({'type':_0x40dadf[_0x713b12][0x0][_0xa39e('0x14')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x40dadf[_0x713b12][0x0]['context'],'exten':_0x40dadf[_0x713b12][0x0][_0xa39e('0xd')],'priority':_0x115395[_0xa39e('0x11')]++,'VoiceExtensionId':_0x40dadf[_0x713b12][0x0][_0xa39e('0x1a')]});_0x115395[_0xa39e('0x12')][_0xa39e('0x13')]({'type':_0x40dadf[_0x713b12][0x0][_0xa39e('0x14')],'app':_0xa39e('0x1b'),'appdata':'MONITOR_OPTIONS=ab','context':_0x40dadf[_0x713b12][0x0][_0xa39e('0x17')],'exten':_0x40dadf[_0x713b12][0x0][_0xa39e('0xd')],'priority':_0x115395[_0xa39e('0x11')]++,'VoiceExtensionId':_0x40dadf[_0x713b12][0x0]['VoiceExtensionId']});for(var _0xd4c0d9=0x0,_0x3e1df3=0x0;_0xd4c0d9<_0x40dadf[_0x713b12][_0xa39e('0x27')];_0xd4c0d9+=0x1,_0x3e1df3=0x0){var _0xf27235=_0x40dadf[_0x713b12][_0xd4c0d9];if(_0xf27235[_0xa39e('0x14')]){_0xf27235[_0xa39e('0x14')]=_0xf27235['type']['toLowerCase']();}var _0x467e07=[];var _0x42b24a=[];delete _0xf27235['id'];delete _0xf27235[_0xa39e('0x28')];delete _0xf27235[_0xa39e('0x29')];var _0xbcd05c=_0xf27235[_0xa39e('0x2a')]!=='*,*,*,*'?[_0xf27235['interval']]:_0xf27235[_0xa39e('0x8')]?_[_0xa39e('0x2b')](_[_0xa39e('0xb')](_0x115395[_0xa39e('0x5')],{'IntervalId':_0xf27235['IntervalId']}),_0xa39e('0x2a')):[];if(_0xf27235[_0xa39e('0x10')](_0xa39e('0x2c'))){if(_0xf27235[_0xa39e('0x2c')]&&_0xf27235[_0xa39e('0x2c')]!=='--'){_0x467e07[_0xa39e('0x13')]({'type':_0xf27235['type'],'app':_0xa39e('0x1b'),'appdata':_0xa39e('0x2d')+_0xf27235[_0xa39e('0x2c')],'context':_0xf27235[_0xa39e('0x17')],'exten':_0xf27235[_0xa39e('0xd')],'priority':_0xbcd05c['length']+_0x115395[_0xa39e('0x11')]+_0x3e1df3++,'VoiceExtensionId':_0xf27235['VoiceExtensionId']});}}if(_0xf27235['type']===_0xa39e('0x2e')&&_0xf27235[_0xa39e('0x10')](_0xa39e('0x2f'))){if(_0xf27235[_0xa39e('0x2f')]){_0x467e07[_0xa39e('0x13')]({'type':_0xf27235['type'],'app':_0xa39e('0x30'),'appdata':_0xa39e('0x31')+_0xf27235[_0xa39e('0x2f')]+')','context':_0xf27235[_0xa39e('0x17')],'exten':_0xf27235[_0xa39e('0xd')],'priority':_0xbcd05c['length']+_0x115395[_0xa39e('0x11')]+_0x3e1df3++,'VoiceExtensionId':_0xf27235[_0xa39e('0x1a')]});}else{_0x467e07['push']({'type':_0xf27235[_0xa39e('0x14')],'app':_0xa39e('0x30'),'appdata':_0xa39e('0x32'),'context':_0xf27235['context'],'exten':_0xf27235[_0xa39e('0xd')],'priority':_0xbcd05c[_0xa39e('0x27')]+_0x115395[_0xa39e('0x11')]+_0x3e1df3++,'VoiceExtensionId':_0xf27235[_0xa39e('0x1a')]});}}if(_0xf27235[_0xa39e('0x10')](_0xa39e('0x33'))){if(_0x2f4d38[_0xa39e('0x34')](_0xf27235[_0xa39e('0x35')][_0xa39e('0x36')]())>=0x0&&_0xf27235[_0xa39e('0x37')]!==_0xa39e('0x38')){if(_0xf27235[_0xa39e('0x33')]){_0x467e07['push']({'type':_0xf27235[_0xa39e('0x14')],'app':_0xa39e('0x30'),'appdata':_0xa39e('0x39'),'context':_0xf27235[_0xa39e('0x17')],'exten':_0xf27235[_0xa39e('0xd')],'priority':_0xbcd05c[_0xa39e('0x27')]+_0x115395[_0xa39e('0x11')]+_0x3e1df3++,'VoiceExtensionId':_0xf27235['VoiceExtensionId']});_0x467e07[_0xa39e('0x13')]({'type':_0xf27235[_0xa39e('0x14')],'app':_0xa39e('0x1b'),'appdata':_0xa39e('0x3a'),'context':_0xf27235[_0xa39e('0x17')],'exten':_0xf27235[_0xa39e('0xd')],'priority':_0xbcd05c[_0xa39e('0x27')]+_0x115395[_0xa39e('0x11')]+_0x3e1df3++,'VoiceExtensionId':_0xf27235[_0xa39e('0x1a')]});}else{_0x467e07[_0xa39e('0x13')]({'type':_0xf27235[_0xa39e('0x14')],'app':_0xa39e('0x30'),'appdata':_0xa39e('0x3b'),'context':_0xf27235[_0xa39e('0x17')],'exten':_0xf27235[_0xa39e('0xd')],'priority':_0xbcd05c[_0xa39e('0x27')]+_0x115395['priority']+_0x3e1df3++,'VoiceExtensionId':_0xf27235['VoiceExtensionId']});_0x467e07[_0xa39e('0x13')]({'type':_0xf27235[_0xa39e('0x14')],'app':_0xa39e('0x1b'),'appdata':_0xa39e('0x3c'),'context':_0xf27235['context'],'exten':_0xf27235['exten'],'priority':_0xbcd05c[_0xa39e('0x27')]+_0x115395[_0xa39e('0x11')]+_0x3e1df3++,'VoiceExtensionId':_0xf27235[_0xa39e('0x1a')]});}}}for(var _0xe2d4bd=0x0;_0xe2d4bd<_0xbcd05c[_0xa39e('0x27')];_0xe2d4bd+=0x1){var _0x39f9d8=_0x115395[_0xa39e('0x11')]+_0xbcd05c[_0xa39e('0x27')];var _0x394b2a=_0xe2d4bd===_0xbcd05c[_0xa39e('0x27')]-0x1?_0x115395['priority']+_0x467e07[_0xa39e('0x27')]+_0x42b24a[_0xa39e('0x27')]+0x2:_0x115395['priority']+_0xe2d4bd+0x1;_0x467e07['splice'](_0xe2d4bd,0x0,{'type':_0xf27235[_0xa39e('0x14')],'app':_0xa39e('0x3d'),'appdata':_0xbcd05c[_0xe2d4bd]+'?'+_0xf27235[_0xa39e('0x17')]+',${EXTEN},'+_0x39f9d8+':'+_0xf27235[_0xa39e('0x17')]+_0xa39e('0x3e')+_0x394b2a,'exten':_0xf27235[_0xa39e('0xd')],'context':_0xf27235[_0xa39e('0x17')],'priority':_0x115395['priority']+_0xe2d4bd,'VoiceExtensionId':_0x40dadf[_0x713b12][0x0][_0xa39e('0x1a')]});}_0xf27235[_0xa39e('0x11')]=_0x467e07['length']?_[_0xa39e('0x3f')](_0x467e07)[_0xa39e('0x11')]+0x1:_0x115395[_0xa39e('0x11')];_0x115395[_0xa39e('0x11')]=(_0x42b24a['length']?_[_0xa39e('0x3f')](_0x42b24a)[_0xa39e('0x11')]:_0xf27235[_0xa39e('0x11')])+0x1;_0x115395[_0xa39e('0x12')]=_['concat'](_0x115395[_0xa39e('0x12')],_0x467e07,[_0xf27235],_0x42b24a);}_0x115395[_0xa39e('0x12')]['push']({'type':_0x40dadf[_0x713b12][0x0]['type'],'app':'Hangup','exten':_0x40dadf[_0x713b12][0x0][_0xa39e('0xd')],'context':_0x40dadf[_0x713b12][0x0][_0xa39e('0x17')],'priority':_0x115395['priority'],'VoiceExtensionId':_0x40dadf[_0x713b12][0x0][_0xa39e('0x1a')]});_0x17ccef[_0xa39e('0x13')](_0x40dadf[_0x713b12][0x0]['VoiceExtensionId']);_0x39141c=_[_0xa39e('0x40')](_0x39141c,_0x115395[_0xa39e('0x12')]);}}return _0x3a6926[_0xa39e('0x41')](function(_0xd237fa){return _0x3a6926[_0xa39e('0x2')][_0xa39e('0x6')][_0xa39e('0x42')]({'where':{'VoiceExtensionId':{'$in':_0x17ccef}},'transaction':_0xd237fa})[_0xa39e('0x4')](function(_0x5277f2){return _0x3a6926['models'][_0xa39e('0x6')][_0xa39e('0x43')](_[_0xa39e('0x44')](_0x39141c,_0xa39e('0x11')),{'transaction':_0xd237fa});});});})[_0xa39e('0x45')](function(_0x31fcd9){console[_0xa39e('0x46')](_0x31fcd9);});}exports['rewrite']=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 3348331..992ef12 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 _0x3fca=['CmList','get','dialCheckDuplicateType','always','push','sequelize','query','VoiceQueueId','all','outbound','Campaign','CampaignId','onlyIfOpen','BlackLists','cmContact,\x20%s,\x20%s','emit','resume','contact:csv_','Unable\x20to\x20delete\x20temp\x20file:','exit','info','resolve','parse','pause','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','papaparse','ioredis','../../../mysqldb','api','defaults','redis','localhost','../../../api/cmContact/cmContact.socket','argv','undefined','Missing\x20filepath\x20parameter!','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','index','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','ListId','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','pick','catch','stringify','checkHopper','inspect','insert','into','cm_hopper','fromQuery','createdAt','updatedAt','select','field','scheduledAt','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','ContactId','NOW()','id\x20IN\x20?','calleridnum','str','VoiceQueue','findAll'];(function(_0x2e590c,_0x7228bd){var _0x553492=function(_0x3669a3){while(--_0x3669a3){_0x2e590c['push'](_0x2e590c['shift']());}};_0x553492(++_0x7228bd);}(_0x3fca,0x14e));var _0xa3fc=function(_0x4901db,_0x3a03e8){_0x4901db=_0x4901db-0x0;var _0x4fb2cf=_0x3fca[_0x4901db];return _0x4fb2cf;};'use strict';var BPromise=require(_0xa3fc('0x0'));var util=require(_0xa3fc('0x1'));var _=require(_0xa3fc('0x2'));var fs=require('fs');var squel=require(_0xa3fc('0x3'));var Papa=require(_0xa3fc('0x4'));var Redis=require(_0xa3fc('0x5'));var db=require(_0xa3fc('0x6'))['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xa3fc('0x7'));config['redis']=_[_0xa3fc('0x8')](config[_0xa3fc('0x9')],{'host':_0xa3fc('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa3fc('0xb'))['register'](socket);try{if(!process['argv'][0x2]||process[_0xa3fc('0xc')][0x2]===_0xa3fc('0xd')||process[_0xa3fc('0xc')][0x2]==='null'){throw new Error(_0xa3fc('0xe'));}var FILEPATH=process[_0xa3fc('0xc')][0x2];if(!process[_0xa3fc('0xc')][0x3]||process['argv'][0x3]==='undefined'||process['argv'][0x3]===_0xa3fc('0xf')||!process[_0xa3fc('0xc')][0x4]||process[_0xa3fc('0xc')][0x4]===_0xa3fc('0xd')||process['argv'][0x4]==='null'){throw new Error(_0xa3fc('0x10'));}var FIELDS=_[_0xa3fc('0x11')](process[_0xa3fc('0xc')][0x3][_0xa3fc('0x12')](','),process[_0xa3fc('0xc')][0x4][_0xa3fc('0x12')](','));if(!process['argv'][0x5]||process[_0xa3fc('0xc')][0x5]===_0xa3fc('0xd')||process['argv'][0x5]===_0xa3fc('0xf')){throw new Error(_0xa3fc('0x13'));}var LISTID=process['argv'][0x5];var COMPANYID=process[_0xa3fc('0xc')][0x6]&&process[_0xa3fc('0xc')][0x6]!==_0xa3fc('0xd')&&process[_0xa3fc('0xc')][0x6]!==_0xa3fc('0xf')?process[_0xa3fc('0xc')][0x6]:null;var DUPLICATES=process[_0xa3fc('0xc')][0x7]&&process[_0xa3fc('0xc')][0x7]!==_0xa3fc('0xd')&&process['argv'][0x7]!==_0xa3fc('0xf')?process[_0xa3fc('0xc')][0x7]:null;if(!process[_0xa3fc('0xc')][0x8]||process[_0xa3fc('0xc')][0x8]===_0xa3fc('0xd')||process[_0xa3fc('0xc')][0x8]===_0xa3fc('0xf')){throw new Error(_0xa3fc('0x14'));}var SOCKET_TIMESTAMP=process[_0xa3fc('0xc')][0x8];}catch(_0x3c6086){logger[_0xa3fc('0x15')](_0x3c6086);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(_0x917622,_0x14f498,_0x2480fa,_0x56c2bf){var _0x27fbd6={'message':_0x14f498};_0x27fbd6[_0x917622]=!![];if(_0x2480fa){_0x27fbd6['contact']=_0x2480fa;}if(_0x56c2bf){_0x27fbd6[_0xa3fc('0x16')]=_0x56c2bf;}return _0x27fbd6;}function isEmail(_0x2f45ef){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'](_0x2f45ef);}function checkRow(_0x583984,_0x7a8871,_0x51d7f6){return new BPromise(function(_0x3ce733,_0x3b400c){if(_[_0xa3fc('0x17')](_0x583984)){return _0x3b400c(handleCheckRowError(_0xa3fc('0x15'),_0xa3fc('0x18'),null,_0x51d7f6));}if(_0x583984[_0xa3fc('0x19')]&&_0x583984['errors'][_0xa3fc('0x1a')]){var _0x2b9a3b=_[_0xa3fc('0x1b')](_0x583984[_0xa3fc('0x19')],_0xa3fc('0x1c'))['join'](';');return _0x3b400c(handleCheckRowError(_0xa3fc('0x15'),_0x2b9a3b,null,_0x51d7f6));}var _0x46a90c={};for(var _0x50ae8f in FIELDS){if(FIELDS[_0xa3fc('0x1d')](_0x50ae8f)&&FIELDS[_0x50ae8f]){_0x46a90c[_0x50ae8f]=_0x583984[_0xa3fc('0x1e')][0x0][FIELDS[_0x50ae8f]]||_0x583984['data'][0x0]['\ufeff'+FIELDS[_0x50ae8f]];}}if(!_0x46a90c[_0xa3fc('0x1f')]){return _0x3b400c(handleCheckRowError(_0xa3fc('0x15'),_0xa3fc('0x20'),null,_0x51d7f6));}if(!_0x46a90c[_0xa3fc('0x21')]){return _0x3b400c(handleCheckRowError('error','phone\x20not\x20specified!',null,_0x51d7f6));}if(_0x46a90c['birthDate']){var _0x7dbcf1=moment(_0x46a90c[_0xa3fc('0x22')],_0xa3fc('0x23'));if(!_0x7dbcf1[_0xa3fc('0x24')]()){return _0x3b400c(handleCheckRowError(_0xa3fc('0x15'),_0xa3fc('0x25'),null,_0x51d7f6));}}if(_0x46a90c[_0xa3fc('0x26')]){if(!isEmail(_0x46a90c[_0xa3fc('0x26')])){return _0x3b400c(handleCheckRowError(_0xa3fc('0x15'),'email\x20format\x20is\x20not\x20valid!',null,_0x51d7f6));}}_0x46a90c[_0xa3fc('0x27')]=LISTID;_0x46a90c[_0xa3fc('0x28')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xa3fc('0x1a')]&&_0x7a8871){var _0x1d655e={};for(var _0x24655c=0x0,_0x5dd347=DUPLICATES[_0xa3fc('0x1a')];_0x24655c<_0x5dd347;_0x24655c+=0x1){_0x1d655e[DUPLICATES[_0x24655c]]=_0x46a90c[DUPLICATES[_0x24655c]];}var _0x3d607d=_[_0xa3fc('0x29')](_0x7a8871,_0x1d655e);if(_0x3d607d){return _0x3b400c(handleCheckRowError(_0xa3fc('0x2a'),_0xa3fc('0x2b'),_0x3d607d,_0x51d7f6));}}return db[_0xa3fc('0x2c')][_0xa3fc('0x2d')](_0x46a90c,{'raw':!![],'hooks':![],'fields':_[_0xa3fc('0x2e')](_0x46a90c)})[_0xa3fc('0x2f')](function(_0xb3e754){if(DUPLICATES&&DUPLICATES[_0xa3fc('0x1a')]&&_0x7a8871){_0x7a8871['push'](_[_0xa3fc('0x30')](_0x46a90c,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xb3e754['id'];return _0x3ce733();})[_0xa3fc('0x31')](function(_0x26f55b){return _0x3b400c(handleCheckRowError('error','Error\x20while\x20creating\x20contact:\x20'+(_0x26f55b[_0xa3fc('0x1c')]||JSON[_0xa3fc('0x32')](_0x26f55b)),null,_0x51d7f6));});});}function checkHopper(){function _0x2f7793(){return function(_0x26f029){logger[_0xa3fc('0x15')]('cmContact',_0xa3fc('0x33'),util[_0xa3fc('0x34')](_0x26f029,{'showHidden':![],'depth':null}));};}var _0x3e7b04=function(_0x342524,_0x1a8c6f){var _0x2211cc=squel[_0xa3fc('0x35')]()[_0xa3fc('0x36')](_0xa3fc('0x37'))[_0xa3fc('0x38')]([_0xa3fc('0x21'),'scheduledAt','ContactId',_0xa3fc('0x27'),_0x1a8c6f,_0xa3fc('0x39'),_0xa3fc('0x3a')],squel[_0xa3fc('0x3b')]()[_0xa3fc('0x3c')](_0xa3fc('0x21'),_0xa3fc('0x21'))['field']('NOW()',_0xa3fc('0x3d'))['field']('id','ContactId')[_0xa3fc('0x3c')](LISTID['toString'](),_0xa3fc('0x27'))['field'](_0x342524['id'][_0xa3fc('0x3e')](),_0x1a8c6f)[_0xa3fc('0x3c')]('NOW()','createdAt')[_0xa3fc('0x3c')]('NOW()',_0xa3fc('0x3a'))[_0xa3fc('0x3f')](_0xa3fc('0x40'))['where'](_0xa3fc('0x41'))[_0xa3fc('0x42')](_0xa3fc('0x43'),LISTID['toString']())[_0xa3fc('0x42')](_0xa3fc('0x44'))[_0xa3fc('0x42')](_0xa3fc('0x45'),squel['select']()[_0xa3fc('0x3c')]('phone')[_0xa3fc('0x3f')](_0xa3fc('0x37'))[_0xa3fc('0x42')](_0x1a8c6f+_0xa3fc('0x46'),_0x342524['id'][_0xa3fc('0x3e')]())))['toString']();return _0x2211cc;};var _0xf0eae9=function(_0x53ec85,_0x41719f){var _0x4e11ee=squel[_0xa3fc('0x35')]()['into'](_0xa3fc('0x37'))[_0xa3fc('0x38')]([_0xa3fc('0x21'),_0xa3fc('0x3d'),_0xa3fc('0x47'),_0xa3fc('0x27'),_0x41719f,_0xa3fc('0x39'),_0xa3fc('0x3a')],squel[_0xa3fc('0x3b')]()[_0xa3fc('0x3c')](_0xa3fc('0x21'),_0xa3fc('0x21'))['field'](_0xa3fc('0x48'),'scheduledAt')[_0xa3fc('0x3c')]('id',_0xa3fc('0x47'))[_0xa3fc('0x3c')](LISTID[_0xa3fc('0x3e')](),_0xa3fc('0x27'))[_0xa3fc('0x3c')](_0x53ec85['id'][_0xa3fc('0x3e')](),_0x41719f)[_0xa3fc('0x3c')]('NOW()','createdAt')[_0xa3fc('0x3c')](_0xa3fc('0x48'),_0xa3fc('0x3a'))['from'](_0xa3fc('0x40'))[_0xa3fc('0x42')](_0xa3fc('0x41'))[_0xa3fc('0x42')]('ListId\x20=\x20?',LISTID[_0xa3fc('0x3e')]())[_0xa3fc('0x42')](_0xa3fc('0x49'),squel['str'](hopperContacts))[_0xa3fc('0x42')](_0xa3fc('0x44'))[_0xa3fc('0x42')]('phone\x20NOT\x20IN\x20(?)',squel[_0xa3fc('0x3b')]()[_0xa3fc('0x3c')](_0xa3fc('0x4a'))[_0xa3fc('0x3f')]('cm_hopper_final')[_0xa3fc('0x42')](_0x41719f+_0xa3fc('0x46'),_0x53ec85['id']['toString']()))[_0xa3fc('0x42')](_0xa3fc('0x45'),squel[_0xa3fc('0x3b')]()[_0xa3fc('0x3c')](_0xa3fc('0x21'))[_0xa3fc('0x3f')]('cm_hopper')[_0xa3fc('0x42')](_0x41719f+_0xa3fc('0x46'),_0x53ec85['id'][_0xa3fc('0x3e')]())))['toString']();return _0x4e11ee;};function _0x1cf95d(_0x117eae,_0x533c12){var _0x4a7687=squel[_0xa3fc('0x35')]()[_0xa3fc('0x36')](_0xa3fc('0x37'))[_0xa3fc('0x38')](['phone',_0xa3fc('0x3d'),_0xa3fc('0x47'),_0xa3fc('0x27'),_0x533c12,_0xa3fc('0x39'),'updatedAt'],squel[_0xa3fc('0x3b')]()[_0xa3fc('0x3c')](_0xa3fc('0x21'),_0xa3fc('0x21'))[_0xa3fc('0x3c')](_0xa3fc('0x48'),_0xa3fc('0x3d'))['field']('id','ContactId')[_0xa3fc('0x3c')](LISTID[_0xa3fc('0x3e')](),_0xa3fc('0x27'))[_0xa3fc('0x3c')](_0x117eae['id'][_0xa3fc('0x3e')](),_0x533c12)[_0xa3fc('0x3c')](_0xa3fc('0x48'),'createdAt')['field'](_0xa3fc('0x48'),_0xa3fc('0x3a'))[_0xa3fc('0x3f')](_0xa3fc('0x40'))[_0xa3fc('0x42')](_0xa3fc('0x41'))[_0xa3fc('0x42')](_0xa3fc('0x43'),LISTID[_0xa3fc('0x3e')]())[_0xa3fc('0x42')](_0xa3fc('0x49'),squel[_0xa3fc('0x4b')](hopperContacts))[_0xa3fc('0x42')](_0xa3fc('0x44')))[_0xa3fc('0x3e')]();return _0x4a7687;}function _0x711857(_0x12f5a2,_0x110267){var _0x330c58=squel['insert']()[_0xa3fc('0x36')]('cm_hopper_black')[_0xa3fc('0x38')](['phone',_0xa3fc('0x47'),_0xa3fc('0x27'),_0x110267,_0xa3fc('0x39'),_0xa3fc('0x3a')],squel[_0xa3fc('0x3b')]()[_0xa3fc('0x3c')](_0xa3fc('0x21'),_0xa3fc('0x21'))['field']('id','ContactId')[_0xa3fc('0x3c')](LISTID[_0xa3fc('0x3e')](),_0xa3fc('0x27'))['field'](_0x12f5a2['id'][_0xa3fc('0x3e')](),_0x110267)['field'](_0xa3fc('0x48'),_0xa3fc('0x39'))[_0xa3fc('0x3c')]('NOW()','updatedAt')['from'](_0xa3fc('0x40'))['where']('deletedAt\x20IS\x20NULL')[_0xa3fc('0x42')](_0xa3fc('0x43'),LISTID[_0xa3fc('0x3e')]())['where'](_0xa3fc('0x49'),squel[_0xa3fc('0x4b')](hopperContacts))['where'](_0xa3fc('0x44')))[_0xa3fc('0x3e')]();return _0x330c58;}return db[_0xa3fc('0x4c')][_0xa3fc('0x4d')]({'where':{'type':'outbound'},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xa3fc('0x4e')],'as':'Lists','where':{'id':LISTID}}]})['then'](function(_0x2eb85e){var _0x59b631=[];if(_0x2eb85e){var _0xad752;for(var _0x2b3a62=0x0,_0x17e5bd;_0x2b3a62<_0x2eb85e[_0xa3fc('0x1a')];_0x2b3a62+=0x1){_0x17e5bd=_0x2eb85e[_0x2b3a62][_0xa3fc('0x4f')]({'plain':!![]});switch(_0x17e5bd[_0xa3fc('0x50')]){case _0xa3fc('0x51'):_0x59b631[_0xa3fc('0x52')](db[_0xa3fc('0x53')][_0xa3fc('0x54')](_0xf0eae9(_0x17e5bd,_0xa3fc('0x55')))[_0xa3fc('0x2f')](function(){})[_0xa3fc('0x31')](_0x2f7793()));break;case'onlyIfOpen':_0x59b631[_0xa3fc('0x52')](db[_0xa3fc('0x53')]['query'](_0x3e7b04(_0x17e5bd,'VoiceQueueId'))[_0xa3fc('0x2f')](function(){})['catch'](_0x2f7793()));break;default:_0x59b631[_0xa3fc('0x52')](db['sequelize'][_0xa3fc('0x54')](_0x1cf95d(_0x17e5bd,'VoiceQueueId'))['then'](function(){})[_0xa3fc('0x31')](_0x2f7793()));}}}return _0x59b631;})[_0xa3fc('0x56')]()[_0xa3fc('0x2f')](function(){return db['VoiceQueue']['findAll']({'where':{'type':_0xa3fc('0x57')},'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})[_0xa3fc('0x2f')](function(_0x1b2c3e){var _0x535f88=[];if(_0x1b2c3e){var _0x36de79;for(var _0x4bb112=0x0,_0x5645e2;_0x4bb112<_0x1b2c3e[_0xa3fc('0x1a')];_0x4bb112+=0x1){_0x5645e2=_0x1b2c3e[_0x4bb112][_0xa3fc('0x4f')]({'plain':!![]});_0x535f88[_0xa3fc('0x52')](db[_0xa3fc('0x53')][_0xa3fc('0x54')](_0x711857(_0x5645e2,'VoiceQueueId'))[_0xa3fc('0x2f')](function(){})['catch'](_0x2f7793()));}}return _0x535f88;})['all']();})[_0xa3fc('0x2f')](function(){return db[_0xa3fc('0x58')]['findAll']({'attributes':['id',_0xa3fc('0x50')],'include':[{'model':db[_0xa3fc('0x4e')],'as':'Lists','where':{'id':LISTID}}]})[_0xa3fc('0x2f')](function(_0x41ecf9){var _0x14d27f=[];if(_0x41ecf9){for(var _0x38a486=0x0,_0x235c30;_0x38a486<_0x41ecf9[_0xa3fc('0x1a')];_0x38a486+=0x1){_0x235c30=_0x41ecf9[_0x38a486][_0xa3fc('0x4f')]({'plain':!![]});switch(_0x235c30[_0xa3fc('0x50')]){case _0xa3fc('0x51'):_0x14d27f[_0xa3fc('0x52')](db['sequelize'][_0xa3fc('0x54')](_0xf0eae9(_0x235c30,_0xa3fc('0x59')))['then'](function(){})[_0xa3fc('0x31')](_0x2f7793()));break;case _0xa3fc('0x5a'):_0x14d27f[_0xa3fc('0x52')](db[_0xa3fc('0x53')][_0xa3fc('0x54')](_0x3e7b04(_0x235c30,'CampaignId'))[_0xa3fc('0x2f')](function(){})['catch'](_0x2f7793()));break;default:_0x14d27f[_0xa3fc('0x52')](db['sequelize']['query'](_0x1cf95d(_0x235c30,_0xa3fc('0x59')))[_0xa3fc('0x2f')](function(){})[_0xa3fc('0x31')](_0x2f7793()));}}}return _0x14d27f;})[_0xa3fc('0x56')]();})[_0xa3fc('0x2f')](function(){return db[_0xa3fc('0x58')]['findAll']({'attributes':['id'],'include':[{'model':db[_0xa3fc('0x4e')],'as':_0xa3fc('0x5b'),'where':{'id':LISTID}}]})[_0xa3fc('0x2f')](function(_0x577748){var _0x1c14ca=[];if(_0x577748){for(var _0x301161=0x0,_0x3c4d3b;_0x301161<_0x577748[_0xa3fc('0x1a')];_0x301161+=0x1){_0x3c4d3b=_0x577748[_0x301161][_0xa3fc('0x4f')]({'plain':!![]});_0x1c14ca['push'](db['sequelize'][_0xa3fc('0x54')](_0x711857(_0x3c4d3b,_0xa3fc('0x59')))[_0xa3fc('0x2f')](function(){})[_0xa3fc('0x31')](_0x2f7793()));}}return _0x1c14ca;})[_0xa3fc('0x56')]();})[_0xa3fc('0x31')](function(_0x14ceeb){logger['error'](_0xa3fc('0x5c'),'generalCheckHopper',_0x14ceeb[_0xa3fc('0x1c')]);});}var processPromises=function(_0x18363b){return BPromise[_0xa3fc('0x56')](promises)[_0xa3fc('0x2f')](function(_0xef5878){})[_0xa3fc('0x31')](function(_0x4d13ca){logger['error']('Error\x20processing\x20rows\x20block:',JSON[_0xa3fc('0x32')](_0x4d13ca));})['finally'](function(){socket[_0xa3fc('0x5d')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x18363b){return _0x18363b[_0xa3fc('0x5e')]();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0xa3fc('0x2f')](function(){socket[_0xa3fc('0x5d')](_0xa3fc('0x5f')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x12bfe7){logger['error'](_0xa3fc('0x60'),JSON['stringify'](_0x12bfe7));}finally{process[_0xa3fc('0x61')](0x0);}});};process['on']('SIGINT',function(){logger[_0xa3fc('0x62')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0xa3fc('0x63')]()[_0xa3fc('0x2f')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db['CmContact'][_0xa3fc('0x4d')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xa3fc('0x2f')](function(_0x16847a){var _0x436250=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xa3fc('0x64')](_0x436250,{'header':!![],'skipEmptyLines':!![],'step':function(_0x481063,_0x332a66){total+=0x1;var _0x530b1e=total;promises['push'](checkRow(_0x481063,_0x16847a,_0x530b1e)[_0xa3fc('0x2f')](function(){success+=0x1;})[_0xa3fc('0x31')](function(_0x4e3e0b){if(_0x4e3e0b[_0xa3fc('0x15')]){errors+=0x1;delete _0x4e3e0b[_0xa3fc('0x15')];}else if(_0x4e3e0b['duplicate']){duplicates+=0x1;delete _0x4e3e0b[_0xa3fc('0x2a')];}rows[_0xa3fc('0x52')](_0x4e3e0b);}));if(total%0xc8===0x0){_0x332a66[_0xa3fc('0x65')]();return processPromises(_0x332a66);}},'complete':function(){return processPromises()[_0xa3fc('0x2f')](function(){logger[_0xa3fc('0x62')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x15ddfe,_0x55a926){logger[_0xa3fc('0x62')]('CSV\x20parse\x20error',JSON[_0xa3fc('0x32')](_0x15ddfe));endCsv();}});})[_0xa3fc('0x31')](function(_0x34ffd2){logger[_0xa3fc('0x15')](_0xa3fc('0x66'),JSON[_0xa3fc('0x32')](_0x34ffd2));});}main(); \ No newline at end of file +var _0x51f5=['Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','inspect','insert','into','cm_hopper','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field','NOW()','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','id\x20IN\x20?','calleridnum','cm_hopper_final','fromQuery','str','cm_hopper_black','VoiceQueue','dialCheckDuplicateType','CmList','Lists','always','query','VoiceQueueId','onlyIfOpen','sequelize','all','findAll','outbound','BlackLists','get','Campaign','CampaignId','generalCheckHopper','finally','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream','parse','duplicate','pause','CSV\x20parsed\x20correctly!','Error\x20executing\x20contact\x20csv\x20import:','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','defaults','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','contact','index','test','isNil','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','CompanyId','find','Duplicate\x20Contact','CmContact','create','keys','then','push','catch'];(function(_0x49f807,_0x4e6424){var _0x2ef8a6=function(_0x13670a){while(--_0x13670a){_0x49f807['push'](_0x49f807['shift']());}};_0x2ef8a6(++_0x4e6424);}(_0x51f5,0xb0));var _0x551f=function(_0x896dc3,_0xfba64d){_0x896dc3=_0x896dc3-0x0;var _0x2c4938=_0x51f5[_0x896dc3];return _0x2c4938;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require('lodash');var fs=require('fs');var squel=require(_0x551f('0x0'));var Papa=require('papaparse');var Redis=require(_0x551f('0x1'));var db=require(_0x551f('0x2'))['db'];var config=require(_0x551f('0x3'));var logger=require(_0x551f('0x4'))(_0x551f('0x5'));config['redis']=_[_0x551f('0x6')](config[_0x551f('0x7')],{'host':_0x551f('0x8'),'port':0x18eb});var socket=require(_0x551f('0x9'))(new Redis(config['redis']));require(_0x551f('0xa'))[_0x551f('0xb')](socket);try{if(!process[_0x551f('0xc')][0x2]||process[_0x551f('0xc')][0x2]===_0x551f('0xd')||process[_0x551f('0xc')][0x2]===_0x551f('0xe')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process['argv'][0x2];if(!process[_0x551f('0xc')][0x3]||process[_0x551f('0xc')][0x3]===_0x551f('0xd')||process[_0x551f('0xc')][0x3]==='null'||!process[_0x551f('0xc')][0x4]||process['argv'][0x4]===_0x551f('0xd')||process[_0x551f('0xc')][0x4]==='null'){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0x551f('0xf')](process[_0x551f('0xc')][0x3][_0x551f('0x10')](','),process[_0x551f('0xc')][0x4][_0x551f('0x10')](','));if(!process[_0x551f('0xc')][0x5]||process[_0x551f('0xc')][0x5]===_0x551f('0xd')||process['argv'][0x5]==='null'){throw new Error(_0x551f('0x11'));}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x551f('0xc')][0x6]&&process[_0x551f('0xc')][0x6]!==_0x551f('0xd')&&process['argv'][0x6]!=='null'?process['argv'][0x6]:null;var DUPLICATES=process[_0x551f('0xc')][0x7]&&process[_0x551f('0xc')][0x7]!==_0x551f('0xd')&&process[_0x551f('0xc')][0x7]!==_0x551f('0xe')?process['argv'][0x7]:null;if(!process['argv'][0x8]||process[_0x551f('0xc')][0x8]==='undefined'||process[_0x551f('0xc')][0x8]===_0x551f('0xe')){throw new Error(_0x551f('0x12'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x18bd66){logger['error'](_0x18bd66);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x1953a2,_0x28c70b,_0x47b678,_0x233c5d){var _0x7c5e91={'message':_0x28c70b};_0x7c5e91[_0x1953a2]=!![];if(_0x47b678){_0x7c5e91[_0x551f('0x13')]=_0x47b678;}if(_0x233c5d){_0x7c5e91[_0x551f('0x14')]=_0x233c5d;}return _0x7c5e91;}function isEmail(_0x184951){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x551f('0x15')](_0x184951);}function checkRow(_0x683a09,_0x125c30,_0x3c72a3){return new BPromise(function(_0x4ad1d0,_0xb60d78){if(_[_0x551f('0x16')](_0x683a09)){return _0xb60d78(handleCheckRowError(_0x551f('0x17'),_0x551f('0x18'),null,_0x3c72a3));}if(_0x683a09[_0x551f('0x19')]&&_0x683a09[_0x551f('0x19')][_0x551f('0x1a')]){var _0x56fc7a=_[_0x551f('0x1b')](_0x683a09[_0x551f('0x19')],_0x551f('0x1c'))[_0x551f('0x1d')](';');return _0xb60d78(handleCheckRowError(_0x551f('0x17'),_0x56fc7a,null,_0x3c72a3));}var _0x45ddb5={};for(var _0x69ef65 in FIELDS){if(FIELDS[_0x551f('0x1e')](_0x69ef65)&&FIELDS[_0x69ef65]){_0x45ddb5[_0x69ef65]=_0x683a09[_0x551f('0x1f')][0x0][FIELDS[_0x69ef65]]||_0x683a09[_0x551f('0x1f')][0x0]['\ufeff'+FIELDS[_0x69ef65]];}}if(!_0x45ddb5['firstName']){return _0xb60d78(handleCheckRowError(_0x551f('0x17'),'firstName\x20not\x20specified!',null,_0x3c72a3));}if(!_0x45ddb5[_0x551f('0x20')]){return _0xb60d78(handleCheckRowError(_0x551f('0x17'),_0x551f('0x21'),null,_0x3c72a3));}if(_0x45ddb5[_0x551f('0x22')]){var _0x32db95=moment(_0x45ddb5[_0x551f('0x22')],_0x551f('0x23'));if(!_0x32db95[_0x551f('0x24')]()){return _0xb60d78(handleCheckRowError(_0x551f('0x17'),_0x551f('0x25'),null,_0x3c72a3));}}if(_0x45ddb5['email']){if(!isEmail(_0x45ddb5[_0x551f('0x26')])){return _0xb60d78(handleCheckRowError(_0x551f('0x17'),'email\x20format\x20is\x20not\x20valid!',null,_0x3c72a3));}}_0x45ddb5['ListId']=LISTID;_0x45ddb5[_0x551f('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x551f('0x1a')]&&_0x125c30){var _0x392120={};for(var _0x2809ac=0x0,_0x3cfae2=DUPLICATES[_0x551f('0x1a')];_0x2809ac<_0x3cfae2;_0x2809ac+=0x1){_0x392120[DUPLICATES[_0x2809ac]]=_0x45ddb5[DUPLICATES[_0x2809ac]];}var _0x14816e=_[_0x551f('0x28')](_0x125c30,_0x392120);if(_0x14816e){return _0xb60d78(handleCheckRowError('duplicate',_0x551f('0x29'),_0x14816e,_0x3c72a3));}}return db[_0x551f('0x2a')][_0x551f('0x2b')](_0x45ddb5,{'raw':!![],'hooks':![],'fields':_[_0x551f('0x2c')](_0x45ddb5)})[_0x551f('0x2d')](function(_0x2ee79d){if(DUPLICATES&&DUPLICATES[_0x551f('0x1a')]&&_0x125c30){_0x125c30[_0x551f('0x2e')](_['pick'](_0x45ddb5,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x2ee79d['id'];return _0x4ad1d0();})[_0x551f('0x2f')](function(_0xbc86dc){return _0xb60d78(handleCheckRowError(_0x551f('0x17'),_0x551f('0x30')+(_0xbc86dc[_0x551f('0x1c')]||JSON[_0x551f('0x31')](_0xbc86dc)),null,_0x3c72a3));});});}function checkHopper(){function _0x7d1eb7(){return function(_0x29e9ee){logger[_0x551f('0x17')](_0x551f('0x32'),'checkHopper',util[_0x551f('0x33')](_0x29e9ee,{'showHidden':![],'depth':null}));};}var _0x246391=function(_0x3018b7,_0x202774){var _0x34cff0=squel[_0x551f('0x34')]()[_0x551f('0x35')](_0x551f('0x36'))['fromQuery'](['phone',_0x551f('0x37'),_0x551f('0x38'),_0x551f('0x39'),_0x202774,_0x551f('0x3a'),_0x551f('0x3b')],squel[_0x551f('0x3c')]()[_0x551f('0x3d')](_0x551f('0x20'),_0x551f('0x20'))['field'](_0x551f('0x3e'),'scheduledAt')['field']('id',_0x551f('0x38'))[_0x551f('0x3d')](LISTID[_0x551f('0x3f')](),_0x551f('0x39'))[_0x551f('0x3d')](_0x3018b7['id'][_0x551f('0x3f')](),_0x202774)[_0x551f('0x3d')](_0x551f('0x3e'),_0x551f('0x3a'))[_0x551f('0x3d')]('NOW()',_0x551f('0x3b'))[_0x551f('0x40')](_0x551f('0x41'))[_0x551f('0x42')](_0x551f('0x43'))[_0x551f('0x42')](_0x551f('0x44'),LISTID['toString']())[_0x551f('0x42')](_0x551f('0x45'))[_0x551f('0x42')](_0x551f('0x46'),squel[_0x551f('0x3c')]()['field'](_0x551f('0x20'))['from'](_0x551f('0x36'))[_0x551f('0x42')](_0x202774+_0x551f('0x47'),_0x3018b7['id'][_0x551f('0x3f')]())))[_0x551f('0x3f')]();return _0x34cff0;};var _0x5cd641=function(_0x372fd9,_0x45a386){var _0x48c906=squel[_0x551f('0x34')]()[_0x551f('0x35')](_0x551f('0x36'))['fromQuery']([_0x551f('0x20'),'scheduledAt','ContactId',_0x551f('0x39'),_0x45a386,_0x551f('0x3a'),'updatedAt'],squel['select']()['field']('phone','phone')[_0x551f('0x3d')](_0x551f('0x3e'),_0x551f('0x37'))['field']('id','ContactId')[_0x551f('0x3d')](LISTID[_0x551f('0x3f')](),_0x551f('0x39'))[_0x551f('0x3d')](_0x372fd9['id']['toString'](),_0x45a386)[_0x551f('0x3d')](_0x551f('0x3e'),_0x551f('0x3a'))[_0x551f('0x3d')]('NOW()',_0x551f('0x3b'))[_0x551f('0x40')](_0x551f('0x41'))[_0x551f('0x42')](_0x551f('0x43'))[_0x551f('0x42')](_0x551f('0x44'),LISTID[_0x551f('0x3f')]())[_0x551f('0x42')](_0x551f('0x48'),squel['str'](hopperContacts))[_0x551f('0x42')](_0x551f('0x45'))[_0x551f('0x42')](_0x551f('0x46'),squel[_0x551f('0x3c')]()['field'](_0x551f('0x49'))[_0x551f('0x40')](_0x551f('0x4a'))[_0x551f('0x42')](_0x45a386+'\x20=\x20?',_0x372fd9['id'][_0x551f('0x3f')]()))[_0x551f('0x42')](_0x551f('0x46'),squel[_0x551f('0x3c')]()[_0x551f('0x3d')](_0x551f('0x20'))[_0x551f('0x40')](_0x551f('0x36'))[_0x551f('0x42')](_0x45a386+_0x551f('0x47'),_0x372fd9['id'][_0x551f('0x3f')]())))['toString']();return _0x48c906;};function _0x5aa7be(_0x1abcb7,_0x2d9eee){var _0x38caf2=squel[_0x551f('0x34')]()['into'](_0x551f('0x36'))[_0x551f('0x4b')]([_0x551f('0x20'),_0x551f('0x37'),_0x551f('0x38'),_0x551f('0x39'),_0x2d9eee,'createdAt',_0x551f('0x3b')],squel[_0x551f('0x3c')]()['field']('phone',_0x551f('0x20'))['field'](_0x551f('0x3e'),'scheduledAt')[_0x551f('0x3d')]('id',_0x551f('0x38'))[_0x551f('0x3d')](LISTID[_0x551f('0x3f')](),_0x551f('0x39'))[_0x551f('0x3d')](_0x1abcb7['id']['toString'](),_0x2d9eee)[_0x551f('0x3d')](_0x551f('0x3e'),_0x551f('0x3a'))[_0x551f('0x3d')](_0x551f('0x3e'),_0x551f('0x3b'))[_0x551f('0x40')]('cm_contacts')[_0x551f('0x42')](_0x551f('0x43'))[_0x551f('0x42')]('ListId\x20=\x20?',LISTID[_0x551f('0x3f')]())[_0x551f('0x42')](_0x551f('0x48'),squel[_0x551f('0x4c')](hopperContacts))[_0x551f('0x42')]('phone\x20IS\x20NOT\x20NULL'))['toString']();return _0x38caf2;}function _0x25e3ac(_0x3ad815,_0x17884d){var _0x1d6408=squel[_0x551f('0x34')]()['into'](_0x551f('0x4d'))[_0x551f('0x4b')](['phone',_0x551f('0x38'),_0x551f('0x39'),_0x17884d,_0x551f('0x3a'),'updatedAt'],squel[_0x551f('0x3c')]()['field'](_0x551f('0x20'),'phone')[_0x551f('0x3d')]('id',_0x551f('0x38'))[_0x551f('0x3d')](LISTID['toString'](),_0x551f('0x39'))[_0x551f('0x3d')](_0x3ad815['id'][_0x551f('0x3f')](),_0x17884d)[_0x551f('0x3d')](_0x551f('0x3e'),_0x551f('0x3a'))['field']('NOW()','updatedAt')['from'](_0x551f('0x41'))[_0x551f('0x42')](_0x551f('0x43'))[_0x551f('0x42')](_0x551f('0x44'),LISTID[_0x551f('0x3f')]())[_0x551f('0x42')](_0x551f('0x48'),squel[_0x551f('0x4c')](hopperContacts))[_0x551f('0x42')]('phone\x20IS\x20NOT\x20NULL'))[_0x551f('0x3f')]();return _0x1d6408;}return db[_0x551f('0x4e')]['findAll']({'where':{'type':'outbound'},'attributes':['id',_0x551f('0x4f')],'include':[{'model':db[_0x551f('0x50')],'as':_0x551f('0x51'),'where':{'id':LISTID}}]})[_0x551f('0x2d')](function(_0x581fd0){var _0x484d85=[];if(_0x581fd0){var _0x309224;for(var _0x4f12f7=0x0,_0x2dca6a;_0x4f12f7<_0x581fd0[_0x551f('0x1a')];_0x4f12f7+=0x1){_0x2dca6a=_0x581fd0[_0x4f12f7]['get']({'plain':!![]});switch(_0x2dca6a[_0x551f('0x4f')]){case _0x551f('0x52'):_0x484d85[_0x551f('0x2e')](db['sequelize'][_0x551f('0x53')](_0x5cd641(_0x2dca6a,_0x551f('0x54')))['then'](function(){})[_0x551f('0x2f')](_0x7d1eb7()));break;case _0x551f('0x55'):_0x484d85[_0x551f('0x2e')](db['sequelize'][_0x551f('0x53')](_0x246391(_0x2dca6a,'VoiceQueueId'))[_0x551f('0x2d')](function(){})[_0x551f('0x2f')](_0x7d1eb7()));break;default:_0x484d85[_0x551f('0x2e')](db[_0x551f('0x56')][_0x551f('0x53')](_0x5aa7be(_0x2dca6a,_0x551f('0x54')))[_0x551f('0x2d')](function(){})[_0x551f('0x2f')](_0x7d1eb7()));}}}return _0x484d85;})[_0x551f('0x57')]()[_0x551f('0x2d')](function(){return db[_0x551f('0x4e')][_0x551f('0x58')]({'where':{'type':_0x551f('0x59')},'attributes':['id'],'include':[{'model':db[_0x551f('0x50')],'as':_0x551f('0x5a'),'where':{'id':LISTID}}]})[_0x551f('0x2d')](function(_0x443707){var _0xd7cf8b=[];if(_0x443707){var _0x12a2a8;for(var _0x37a18c=0x0,_0x5c95c0;_0x37a18c<_0x443707['length'];_0x37a18c+=0x1){_0x5c95c0=_0x443707[_0x37a18c][_0x551f('0x5b')]({'plain':!![]});_0xd7cf8b[_0x551f('0x2e')](db['sequelize']['query'](_0x25e3ac(_0x5c95c0,'VoiceQueueId'))['then'](function(){})[_0x551f('0x2f')](_0x7d1eb7()));}}return _0xd7cf8b;})['all']();})[_0x551f('0x2d')](function(){return db[_0x551f('0x5c')]['findAll']({'attributes':['id',_0x551f('0x4f')],'include':[{'model':db['CmList'],'as':_0x551f('0x51'),'where':{'id':LISTID}}]})['then'](function(_0x38c651){var _0x4e18c2=[];if(_0x38c651){for(var _0x374659=0x0,_0x8a704f;_0x374659<_0x38c651[_0x551f('0x1a')];_0x374659+=0x1){_0x8a704f=_0x38c651[_0x374659][_0x551f('0x5b')]({'plain':!![]});switch(_0x8a704f[_0x551f('0x4f')]){case _0x551f('0x52'):_0x4e18c2[_0x551f('0x2e')](db[_0x551f('0x56')][_0x551f('0x53')](_0x5cd641(_0x8a704f,_0x551f('0x5d')))['then'](function(){})[_0x551f('0x2f')](_0x7d1eb7()));break;case _0x551f('0x55'):_0x4e18c2['push'](db[_0x551f('0x56')][_0x551f('0x53')](_0x246391(_0x8a704f,_0x551f('0x5d')))[_0x551f('0x2d')](function(){})['catch'](_0x7d1eb7()));break;default:_0x4e18c2[_0x551f('0x2e')](db[_0x551f('0x56')][_0x551f('0x53')](_0x5aa7be(_0x8a704f,'CampaignId'))['then'](function(){})['catch'](_0x7d1eb7()));}}}return _0x4e18c2;})['all']();})[_0x551f('0x2d')](function(){return db[_0x551f('0x5c')]['findAll']({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x551f('0x5a'),'where':{'id':LISTID}}]})[_0x551f('0x2d')](function(_0x5e6c4a){var _0x459e27=[];if(_0x5e6c4a){for(var _0x2677da=0x0,_0x2ad009;_0x2677da<_0x5e6c4a['length'];_0x2677da+=0x1){_0x2ad009=_0x5e6c4a[_0x2677da][_0x551f('0x5b')]({'plain':!![]});_0x459e27[_0x551f('0x2e')](db[_0x551f('0x56')][_0x551f('0x53')](_0x25e3ac(_0x2ad009,_0x551f('0x5d')))['then'](function(){})[_0x551f('0x2f')](_0x7d1eb7()));}}return _0x459e27;})[_0x551f('0x57')]();})[_0x551f('0x2f')](function(_0x1c2316){logger[_0x551f('0x17')]('cmContact,\x20%s,\x20%s',_0x551f('0x5e'),_0x1c2316[_0x551f('0x1c')]);});}var processPromises=function(_0x53c3d5){return BPromise[_0x551f('0x57')](promises)[_0x551f('0x2d')](function(_0x5803c5){})[_0x551f('0x2f')](function(_0x5865bc){logger[_0x551f('0x17')]('Error\x20processing\x20rows\x20block:',JSON[_0x551f('0x31')](_0x5865bc));})[_0x551f('0x5f')](function(){socket[_0x551f('0x60')](_0x551f('0x61')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x53c3d5){return _0x53c3d5[_0x551f('0x62')]();}});};var endCsv=function(){return BPromise[_0x551f('0x63')]()[_0x551f('0x2d')](function(){if(hopperContacts){return checkHopper();}})[_0x551f('0x2d')](function(){socket[_0x551f('0x60')](_0x551f('0x61')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x551f('0x64')](FILEPATH);}catch(_0xf43336){logger['error'](_0x551f('0x65'),JSON[_0x551f('0x31')](_0xf43336));}finally{process[_0x551f('0x66')](0x0);}});};process['on'](_0x551f('0x67'),function(){logger[_0x551f('0x68')](_0x551f('0x69'));endCsv();});function main(){return BPromise[_0x551f('0x63')]()[_0x551f('0x2d')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x551f('0x10')](',');return db[_0x551f('0x2a')][_0x551f('0x58')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x551f('0x2d')](function(_0x348557){var _0xdc90e9=fs[_0x551f('0x6a')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x551f('0x6b')](_0xdc90e9,{'header':!![],'skipEmptyLines':!![],'step':function(_0x4611df,_0x2f26de){total+=0x1;var _0x5abefe=total;promises[_0x551f('0x2e')](checkRow(_0x4611df,_0x348557,_0x5abefe)[_0x551f('0x2d')](function(){success+=0x1;})[_0x551f('0x2f')](function(_0x4dec38){if(_0x4dec38[_0x551f('0x17')]){errors+=0x1;delete _0x4dec38[_0x551f('0x17')];}else if(_0x4dec38[_0x551f('0x6c')]){duplicates+=0x1;delete _0x4dec38[_0x551f('0x6c')];}rows['push'](_0x4dec38);}));if(total%0xc8===0x0){_0x2f26de[_0x551f('0x6d')]();return processPromises(_0x2f26de);}},'complete':function(){return processPromises()[_0x551f('0x2d')](function(){logger[_0x551f('0x68')](_0x551f('0x6e'));endCsv();});},'error':function(_0x236c41,_0x1d2e05){logger[_0x551f('0x68')]('CSV\x20parse\x20error',JSON[_0x551f('0x31')](_0x236c41));endCsv();}});})[_0x551f('0x2f')](function(_0x21362d){logger[_0x551f('0x17')](_0x551f('0x6f'),JSON['stringify'](_0x21362d));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index d7072b9..adb5ff7 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 _0xa938=['join','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','ContactId','ListId','updatedAt','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_contacts.phone','cm_hopper_black','createdAt','.CmListId\x20=\x20?','field','\x20=\x20?','concat','CompanyId','ListId\x20=\x20?','min_id','group','info','error','message','exit','code','sequelize','query','spread','push','catch','main','stringify','send','start','socket_timestamp','root','keys','header','writeFileSync','createReadStream','length','errors','data','hasOwnProperty','replace','scheduledat','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','SystemRow','rows','emit','contact:import:','Abort\x20parser','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','isNil',',\x20scheduledAt\x20=\x20NOW()','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns','CampaignId','campaigns_has_cm_blacklists','each','then','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','server/files/tmp','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','binding','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','util','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','select','phone','from','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20('];(function(_0x4fa3a6,_0x187624){var _0x43edb5=function(_0x5c4ee4){while(--_0x5c4ee4){_0x4fa3a6['push'](_0x4fa3a6['shift']());}};_0x43edb5(++_0x187624);}(_0xa938,0x172));var _0x8a93=function(_0x50f86d,_0x306ce2){_0x50f86d=_0x50f86d-0x0;var _0x187ea9=_0xa938[_0x50f86d];return _0x187ea9;};'use strict';var fs=require('fs');var path=require(_0x8a93('0x0'));var _=require(_0x8a93('0x1'));var Papa=require('papaparse');var util=require(_0x8a93('0x2'));var BPromise=require('bluebird');var moment=require('moment');var squel=require('squel');var Redis=require('ioredis');var db=require(_0x8a93('0x3'))['db'];var config=require(_0x8a93('0x4'));var logger=require(_0x8a93('0x5'))(_0x8a93('0x6'));config[_0x8a93('0x7')]=_['defaults'](config[_0x8a93('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x8a93('0x8'))(new Redis(config[_0x8a93('0x7')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()['format'](_0x8a93('0x9'));function isEmail(_0x5b6398){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'](_0x5b6398);}function selectNotIn(_0x8879f7,_0x617813,_0x2e7d7b,_0x5e4bb1,_0x374962){return squel[_0x8a93('0xa')]()['field'](_0x8a93('0xb'))[_0x8a93('0xc')](_0x5e4bb1)['join'](_0x617813,null,_0x617813+_0x8a93('0xd')+_0x5e4bb1+'.'+_0x2e7d7b)[_0x8a93('0xe')](_0x5e4bb1+'.'+_0x2e7d7b+_0x8a93('0xf')+_0x8879f7+'.'+_0x2e7d7b)[_0x8a93('0xe')](_0x617813+_0x8a93('0x10')+_0x374962[_0x8a93('0x11')]()+')');}function insertCmHopper(_0x21fa51,_0x20c66e,_0x51f9ee,_0x4abac0,_0x15b2f7){var _0x131371=['cm_contacts.phone',_0x8a93('0x12'),_0x8a93('0x13'),_0x8a93('0x14'),_0x20c66e+'.'+_0x4abac0,_0x8a93('0x15'),_0x8a93('0x16'),_0x8a93('0x17'),_0x8a93('0x18'),'\x22'+_0x15b2f7+'\x22'];return squel[_0x8a93('0x19')]()[_0x8a93('0x1a')](_0x8a93('0x1b'))[_0x8a93('0x1c')]([_0x8a93('0xb'),'scheduledat',_0x8a93('0x1d'),_0x8a93('0x1e'),_0x4abac0,'createdAt',_0x8a93('0x1f'),'priority',_0x8a93('0x20'),_0x8a93('0x21')],squel['select']()[_0x8a93('0x22')](_0x131371)[_0x8a93('0xc')](_0x20c66e)['join'](_0x8a93('0x23'),null,_0x8a93('0x24')+_0x20c66e+_0x8a93('0x25'))[_0x8a93('0x11')](_0x51f9ee,null,_0x51f9ee+_0x8a93('0xd')+_0x20c66e+'.'+_0x4abac0)['where'](_0x20c66e+'.CmListId\x20=\x20?',_0x21fa51)['where'](_0x8a93('0x26'),NOW)[_0x8a93('0xe')](_0x8a93('0x27'),selectNotIn(_0x20c66e,_0x51f9ee,_0x4abac0,_0x8a93('0x1b'),['\x22always\x22','\x22onlyIfOpen\x22']))[_0x8a93('0xe')](_0x8a93('0x27'),selectNotIn(_0x20c66e,_0x51f9ee,_0x4abac0,_0x8a93('0x1b'),[_0x8a93('0x28')])))[_0x8a93('0x29')]();}function insertCmHopperBlack(_0x6ff49e,_0x307747,_0x5b99f7,_0x2b28b7){var _0x49ff11=[_0x8a93('0x2a'),_0x8a93('0x13'),_0x8a93('0x14'),_0x307747+'.'+_0x2b28b7,_0x8a93('0x15'),'cm_contacts.updatedAt'];return squel[_0x8a93('0x19')]()['into'](_0x8a93('0x2b'))[_0x8a93('0x1c')]([_0x8a93('0xb'),'ContactId',_0x8a93('0x1e'),_0x2b28b7,_0x8a93('0x2c'),_0x8a93('0x1f')],squel[_0x8a93('0xa')]()[_0x8a93('0x22')](_0x49ff11)[_0x8a93('0xc')](_0x307747)[_0x8a93('0x11')](_0x8a93('0x23'),null,'cm_contacts.ListId\x20=\x20'+_0x307747+_0x8a93('0x25'))[_0x8a93('0x11')](_0x5b99f7,null,_0x5b99f7+_0x8a93('0xd')+_0x307747+'.'+_0x2b28b7)['where'](_0x307747+_0x8a93('0x2d'),_0x6ff49e)[_0x8a93('0xe')](_0x8a93('0x26'),NOW)[_0x8a93('0xe')](_0x8a93('0x27'),squel['select']()[_0x8a93('0x2e')](_0x8a93('0xb'))[_0x8a93('0xc')](_0x8a93('0x2b'))[_0x8a93('0xe')]('ListId\x20=\x20?',_0x6ff49e)[_0x8a93('0xe')](_0x2b28b7+_0x8a93('0x2f'),_0x307747+'.'+_0x2b28b7)))[_0x8a93('0x29')]();}function insertCmContact(_0x35ebe5,_0x1c5bf4,_0x486487,_0x100c84){var _0x1a55f2=_[_0x8a93('0x30')](_['keys'](_0x100c84),['ListId',_0x8a93('0x31'),_0x8a93('0x2c'),'updatedAt']);return squel[_0x8a93('0x19')]()['into'](_0x8a93('0x23'))[_0x8a93('0x1c')](_0x1a55f2,squel[_0x8a93('0xa')]()[_0x8a93('0x22')](_0x1a55f2)['from'](_0x1c5bf4)[_0x8a93('0xe')]('('+_0x486487[_0x8a93('0x11')](',')+')\x20NOT\x20IN\x20?',squel[_0x8a93('0xa')]()[_0x8a93('0x22')](_0x486487)[_0x8a93('0xc')]('cm_contacts')[_0x8a93('0xe')](_0x8a93('0x32'),_0x35ebe5)[_0x8a93('0xe')]('deletedAt\x20IS\x20NULL'))[_0x8a93('0xe')]('id\x20IN\x20?',squel[_0x8a93('0xa')]()[_0x8a93('0x2e')]('MIN(id)',_0x8a93('0x33'))['from'](_0x1c5bf4)[_0x8a93('0x34')](_0x486487[_0x8a93('0x11')](','))))['toString']();}function handleStop(){logger[_0x8a93('0x35')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x2405bb){logger[_0x8a93('0x36')](_0x2405bb[_0x8a93('0x37')]);process[_0x8a93('0x38')](0x1);}function handleError(_0x4e1217,_0x3d0775){stats['errors']['push']({'name':_0x3d0775[_0x8a93('0x39')],'message':_0x3d0775[_0x8a93('0x37')],'row':_0x4e1217});}function handleQuery(_0x2dd582){logger['info'](_0x2dd582);return db[_0x8a93('0x3a')][_0x8a93('0x3b')](_0x2dd582)[_0x8a93('0x3c')](function(_0x27deab){results[_0x8a93('0x3d')](_0x27deab);})[_0x8a93('0x3e')](function(_0x201610){logger[_0x8a93('0x36')](_0x201610['message']);});}function main(_0x18d55a,_0x4672fb,_0x459f79,_0x549393){logger[_0x8a93('0x35')](_0x8a93('0x3f'),_0x18d55a,JSON[_0x8a93('0x40')](_0x4672fb));process[_0x8a93('0x41')](_0x8a93('0x42'));var _0x211fe1=_0x4672fb['binding'];var _0x445b6a=_0x4672fb[_0x8a93('0x43')];var _0x4d3b48=path[_0x8a93('0x11')](config[_0x8a93('0x44')],'server/files/tmp',_0x445b6a+'.csv');var _0x55cfcb=_[_0x8a93('0x45')](_0x211fe1)[_0x8a93('0x11')]();logger[_0x8a93('0x35')](_0x8a93('0x46'),_0x55cfcb);fs[_0x8a93('0x47')](_0x4d3b48,_0x55cfcb+'\x0a');Papa['parse'](fs[_0x8a93('0x48')](_0x18d55a),{'header':!![],'skipEmptyLines':!![],'step':function(_0x39d8f4,_0x5962b5){try{for(var _0xbeb8fc=0x0,_0x5367f8=[];_0xbeb8fc<_0x39d8f4['data'][_0x8a93('0x49')];_0xbeb8fc++){stats['rows']+=0x1;if(_0x39d8f4[_0x8a93('0x4a')][_0xbeb8fc]){handleError(_0x39d8f4[_0x8a93('0x4b')][_0xbeb8fc],_0x39d8f4['errors'][_0xbeb8fc]);}else{var _0x31cff2=[];for(var _0x3665d2 in _0x211fe1){if(_0x211fe1[_0x8a93('0x4c')](_0x3665d2)){if(_0x39d8f4['data'][_0xbeb8fc][_0x211fe1[_0x3665d2]]){var _0x3c6845=_['trim'](_0x39d8f4[_0x8a93('0x4b')][_0xbeb8fc][_0x211fe1[_0x3665d2]][_0x8a93('0x4d')](/"/g,'\x27'));switch(_0x3665d2){case _0x8a93('0x4e'):var _0x56c745=moment(_0x3c6845,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x56c745['isValid']()){_0x5367f8[_0x8a93('0x3d')]('\x22'+_0x3c6845+'\x22');}else{_0x31cff2[_0x8a93('0x3d')](_0x8a93('0x4f'));}break;case _0x8a93('0x50'):var _0x5a510d=parseInt(_0x3c6845);_0x3c6845=_['isNaN'](_0x5a510d)||_0x5a510d<0x0||_0x5a510d>0x4?_0x549393?0x3:0x2:_0x5a510d;_0x5367f8[_0x8a93('0x3d')]('\x22'+_0x3c6845+'\x22');break;case _0x8a93('0x20'):var _0xead74d=parseInt(_0x3c6845);if(_[_0x8a93('0x51')](_0xead74d)&&_['includes'](_0x459f79,_0xead74d)){_0x5367f8['push']('\x22'+_0xead74d+'\x22');}else{_0x31cff2[_0x8a93('0x3d')](_0x8a93('0x52'));}break;case _0x8a93('0x53'):if(isEmail(_0x3c6845)){_0x5367f8[_0x8a93('0x3d')]('\x22'+_0x3c6845+'\x22');}else{_0x31cff2[_0x8a93('0x3d')](_0x8a93('0x54'));}break;case _0x8a93('0x55'):var _0x789554=moment(_0x3c6845,_0x8a93('0x56'),!![]);if(_0x789554[_0x8a93('0x57')]()){_0x5367f8['push']('\x22'+_0x3c6845+'\x22');}else{_0x31cff2[_0x8a93('0x3d')](_0x8a93('0x58'));}break;default:_0x5367f8[_0x8a93('0x3d')]('\x22'+_0x3c6845+'\x22');}}else{switch(_0x3665d2){case _0x8a93('0x59'):case'phone':_0x31cff2[_0x8a93('0x3d')](_0x3665d2+'\x20not\x20specified');break;default:_0x5367f8['push']('\x22\x22');}}}}if(_0x31cff2['length']){handleError(_0x39d8f4['data'][_0xbeb8fc],{'code':_0x8a93('0x5a'),'message':_0x31cff2['join']()});}else{fs['appendFileSync'](_0x4d3b48,_0x5367f8[_0x8a93('0x11')]()+'\x0a');}_0x5367f8=[];}if(!(stats[_0x8a93('0x5b')]%0xc8)){socket[_0x8a93('0x5c')](_0x8a93('0x5d')+_0x445b6a,stats);stats[_0x8a93('0x4a')]=[];}}if(stopped){logger[_0x8a93('0x35')](_0x8a93('0x5e'));_0x5962b5['abort']();}}catch(_0x2bb643){handleError(_0x39d8f4[_0x8a93('0x4b')][_0xbeb8fc],{'code':_0x8a93('0x5f'),'message':_0x2bb643['message']});logger[_0x8a93('0x36')](_0x8a93('0x60'),_0x2bb643[_0x8a93('0x37')]);}},'complete':function(){try{var _0x306558=[];var _0x525749=_0x8a93('0x23');if(_0x4672fb[_0x8a93('0x61')]&&_0x4672fb[_0x8a93('0x61')][_0x8a93('0x49')]){_0x525749=_0x8a93('0x62')+_0x445b6a;_0x306558['push'](_0x8a93('0x63')+_0x525749+_0x8a93('0x64'));}var _0x2e7f17=util['format'](_0x8a93('0x65'),_0x4d3b48,_0x525749,_0x55cfcb,_0x4672fb[_0x8a93('0x1e')],_0x4672fb[_0x8a93('0x31')]||null,NOW,NOW);if(_[_0x8a93('0x66')](_0x211fe1['scheduledat'])){_0x2e7f17+=_0x8a93('0x67');}_0x306558['push'](_0x2e7f17);if(_0x4672fb['duplicates']&&_0x4672fb[_0x8a93('0x61')][_0x8a93('0x49')]){_0x306558[_0x8a93('0x3d')](insertCmContact(_0x4672fb[_0x8a93('0x1e')],_0x525749,_0x4672fb['duplicates'],_0x211fe1));_0x306558[_0x8a93('0x3d')]('DROP\x20TABLE\x20'+_0x525749+';');}_0x306558[_0x8a93('0x3d')](insertCmHopper(_0x4672fb['ListId'],'voice_queues_has_cm_lists',_0x8a93('0x68'),_0x8a93('0x69'),_0x549393));_0x306558[_0x8a93('0x3d')](insertCmHopperBlack(_0x4672fb[_0x8a93('0x1e')],_0x8a93('0x6a'),'voice_queues','VoiceQueueId'));_0x306558[_0x8a93('0x3d')](insertCmHopper(_0x4672fb[_0x8a93('0x1e')],'campaigns_has_cm_lists',_0x8a93('0x6b'),_0x8a93('0x6c'),_0x549393));_0x306558[_0x8a93('0x3d')](insertCmHopperBlack(_0x4672fb[_0x8a93('0x1e')],_0x8a93('0x6d'),_0x8a93('0x6b'),'CampaignId'));BPromise[_0x8a93('0x6e')](_0x306558,handleQuery)[_0x8a93('0x6f')](function(_0x467917){stats[_0x8a93('0x70')]=!![];stats[_0x8a93('0x71')]=_0x4672fb[_0x8a93('0x61')]&&_0x4672fb[_0x8a93('0x61')][_0x8a93('0x49')]?results[0x2][_0x8a93('0x71')]:results[0x0][_0x8a93('0x71')];socket[_0x8a93('0x5c')](_0x8a93('0x5d')+_0x445b6a,stats);fs[_0x8a93('0x72')](_0x18d55a);fs[_0x8a93('0x72')](_0x4d3b48);process[_0x8a93('0x38')](0x0);})['catch'](function(_0x792104){logger[_0x8a93('0x36')](_0x792104[_0x8a93('0x37')]);process[_0x8a93('0x38')](0x1);});}catch(_0x387b69){logger[_0x8a93('0x36')](_0x8a93('0x73'),_0x387b69[_0x8a93('0x37')]);process[_0x8a93('0x38')](0x1);}},'error':function(_0x26f23e,_0x29f3c1,_0x9048e7,_0x147b31){throw new Error(_0x147b31);}});}function validate(){if(process[_0x8a93('0x74')]&&process[_0x8a93('0x74')][_0x8a93('0x49')]<0x4){throw new Error(_0x8a93('0x75'));}var _0x3a0ac0=path[_0x8a93('0x11')](config[_0x8a93('0x44')],_0x8a93('0x76'),process[_0x8a93('0x74')][0x2]);if(!fs['existsSync'](_0x3a0ac0)){throw new Error(_0x8a93('0x77'));}var _0x4fffec={};try{_0x4fffec=JSON[_0x8a93('0x78')](process[_0x8a93('0x74')][0x3]);if(!_0x4fffec['binding']){throw new Error(_0x8a93('0x79'));}if(!_0x4fffec[_0x8a93('0x7a')][_0x8a93('0xb')]){throw new Error(_0x8a93('0x7b'));}if(!_0x4fffec[_0x8a93('0x7a')][_0x8a93('0x59')]){throw new Error('firstName\x20is\x20mandatory');}var _0x3296f9=0x0;if(_0x4fffec['binding'][_0x8a93('0x20')]){_0x3296f9=0x1;}if(!_0x4fffec[_0x8a93('0x1e')]){throw new Error(_0x8a93('0x7c'));}}catch(_0xe55f95){throw new Error('body\x20id\x20mandatory');}var _0x30d879=[];try{_0x30d879=_[_0x8a93('0x7d')](JSON['parse'](process[_0x8a93('0x74')][0x4]),'id');}catch(_0x41dda8){logger[_0x8a93('0x35')](_0x8a93('0x7e'));}main(_0x3a0ac0,_0x4fffec,_0x30d879,_0x3296f9);}validate();process['on'](_0x8a93('0x7f'),handleStop);process['on'](_0x8a93('0x80'),handleUncaughtException); \ No newline at end of file +var _0x0ba8=['header','writeFileSync','parse','data','length','rows','hasOwnProperty','trim','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','isValid','firstName','SystemRow','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','CREATE\x20TABLE\x20','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns','CampaignId','each','then','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','existsSync','binding\x20doesn\x27t\x20exists','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','path','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.id','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','phone','scheduledat','ContactId','createdAt','priority','UserId','recallme','select','fields','from','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.ListId','cm_hopper_black','ListId\x20=\x20?','concat','keys','ListId','CompanyId','updatedAt',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','group','toString','info','Received\x20SIGINT','error','exit','errors','push','code','message','sequelize','query','spread','catch','main','send','start','binding','socket_timestamp','root','server/files/tmp'];(function(_0x5c0993,_0x1d8da6){var _0x218155=function(_0x320cfc){while(--_0x320cfc){_0x5c0993['push'](_0x5c0993['shift']());}};_0x218155(++_0x1d8da6);}(_0x0ba8,0x1bb));var _0x80ba=function(_0x14ae01,_0x861682){_0x14ae01=_0x14ae01-0x0;var _0x4cdfaa=_0x0ba8[_0x14ae01];return _0x4cdfaa;};'use strict';var fs=require('fs');var path=require(_0x80ba('0x0'));var _=require('lodash');var Papa=require(_0x80ba('0x1'));var util=require(_0x80ba('0x2'));var BPromise=require(_0x80ba('0x3'));var moment=require(_0x80ba('0x4'));var squel=require(_0x80ba('0x5'));var Redis=require(_0x80ba('0x6'));var db=require(_0x80ba('0x7'))['db'];var config=require(_0x80ba('0x8'));var logger=require(_0x80ba('0x9'))('import');config[_0x80ba('0xa')]=_['defaults'](config[_0x80ba('0xa')],{'host':_0x80ba('0xb'),'port':0x18eb});var socket=require(_0x80ba('0xc'))(new Redis(config[_0x80ba('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x80ba('0xd')](_0x80ba('0xe'));function isEmail(_0x167996){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x80ba('0xf')](_0x167996);}function selectNotIn(_0xcbe06a,_0x4ec4d4,_0x5a1d18,_0x3411aa,_0x96bfbe){return squel['select']()['field']('phone')['from'](_0x3411aa)[_0x80ba('0x10')](_0x4ec4d4,null,_0x4ec4d4+_0x80ba('0x11')+_0x3411aa+'.'+_0x5a1d18)[_0x80ba('0x12')](_0x3411aa+'.'+_0x5a1d18+_0x80ba('0x13')+_0xcbe06a+'.'+_0x5a1d18)[_0x80ba('0x12')](_0x4ec4d4+_0x80ba('0x14')+_0x96bfbe['join']()+')');}function insertCmHopper(_0x15becd,_0x54c52f,_0x5e9987,_0x3e5c52,_0x2cee8f){var _0xa67a3e=[_0x80ba('0x15'),'cm_contacts.scheduledat',_0x80ba('0x16'),'cm_contacts.ListId',_0x54c52f+'.'+_0x3e5c52,_0x80ba('0x17'),'cm_contacts.updatedAt',_0x80ba('0x18'),_0x80ba('0x19'),'\x22'+_0x2cee8f+'\x22'];return squel[_0x80ba('0x1a')]()[_0x80ba('0x1b')](_0x80ba('0x1c'))[_0x80ba('0x1d')]([_0x80ba('0x1e'),_0x80ba('0x1f'),_0x80ba('0x20'),'ListId',_0x3e5c52,_0x80ba('0x21'),'updatedAt',_0x80ba('0x22'),_0x80ba('0x23'),_0x80ba('0x24')],squel[_0x80ba('0x25')]()[_0x80ba('0x26')](_0xa67a3e)[_0x80ba('0x27')](_0x54c52f)[_0x80ba('0x10')](_0x80ba('0x28'),null,_0x80ba('0x29')+_0x54c52f+_0x80ba('0x2a'))[_0x80ba('0x10')](_0x5e9987,null,_0x5e9987+_0x80ba('0x11')+_0x54c52f+'.'+_0x3e5c52)['where'](_0x54c52f+_0x80ba('0x2b'),_0x15becd)[_0x80ba('0x12')](_0x80ba('0x2c'),NOW)[_0x80ba('0x12')](_0x80ba('0x2d'),selectNotIn(_0x54c52f,_0x5e9987,_0x3e5c52,_0x80ba('0x1c'),[_0x80ba('0x2e'),_0x80ba('0x2f')]))[_0x80ba('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x54c52f,_0x5e9987,_0x3e5c52,'cm_hopper',[_0x80ba('0x2e')])))['toString']();}function insertCmHopperBlack(_0x7de8ac,_0x3b8846,_0x2640af,_0x29ccf2){var _0x13493a=[_0x80ba('0x15'),_0x80ba('0x16'),_0x80ba('0x30'),_0x3b8846+'.'+_0x29ccf2,_0x80ba('0x17'),'cm_contacts.updatedAt'];return squel[_0x80ba('0x1a')]()[_0x80ba('0x1b')]('cm_hopper_black')[_0x80ba('0x1d')]([_0x80ba('0x1e'),_0x80ba('0x20'),'ListId',_0x29ccf2,_0x80ba('0x21'),'updatedAt'],squel[_0x80ba('0x25')]()[_0x80ba('0x26')](_0x13493a)[_0x80ba('0x27')](_0x3b8846)['join'](_0x80ba('0x28'),null,_0x80ba('0x29')+_0x3b8846+'.CmListId')['join'](_0x2640af,null,_0x2640af+'.id\x20=\x20'+_0x3b8846+'.'+_0x29ccf2)[_0x80ba('0x12')](_0x3b8846+'.CmListId\x20=\x20?',_0x7de8ac)[_0x80ba('0x12')](_0x80ba('0x2c'),NOW)[_0x80ba('0x12')](_0x80ba('0x2d'),squel[_0x80ba('0x25')]()['field'](_0x80ba('0x1e'))[_0x80ba('0x27')](_0x80ba('0x31'))[_0x80ba('0x12')](_0x80ba('0x32'),_0x7de8ac)[_0x80ba('0x12')](_0x29ccf2+'\x20=\x20?',_0x3b8846+'.'+_0x29ccf2)))['toString']();}function insertCmContact(_0x537cd2,_0x397710,_0xf8cb5f,_0x230429){var _0x4d17e9=_[_0x80ba('0x33')](_[_0x80ba('0x34')](_0x230429),[_0x80ba('0x35'),_0x80ba('0x36'),_0x80ba('0x21'),_0x80ba('0x37')]);return squel[_0x80ba('0x1a')]()[_0x80ba('0x1b')](_0x80ba('0x28'))[_0x80ba('0x1d')](_0x4d17e9,squel['select']()[_0x80ba('0x26')](_0x4d17e9)[_0x80ba('0x27')](_0x397710)['where']('('+_0xf8cb5f[_0x80ba('0x10')](',')+_0x80ba('0x38'),squel[_0x80ba('0x25')]()[_0x80ba('0x26')](_0xf8cb5f)[_0x80ba('0x27')]('cm_contacts')[_0x80ba('0x12')](_0x80ba('0x32'),_0x537cd2)[_0x80ba('0x12')]('deletedAt\x20IS\x20NULL'))['where'](_0x80ba('0x39'),squel[_0x80ba('0x25')]()['field'](_0x80ba('0x3a'),_0x80ba('0x3b'))[_0x80ba('0x27')](_0x397710)[_0x80ba('0x3c')](_0xf8cb5f[_0x80ba('0x10')](','))))[_0x80ba('0x3d')]();}function handleStop(){logger[_0x80ba('0x3e')](_0x80ba('0x3f'));stopped=!![];}function handleUncaughtException(_0x2f210c){logger[_0x80ba('0x40')](_0x2f210c['message']);process[_0x80ba('0x41')](0x1);}function handleError(_0x10b21d,_0x49ec2b){stats[_0x80ba('0x42')][_0x80ba('0x43')]({'name':_0x49ec2b[_0x80ba('0x44')],'message':_0x49ec2b[_0x80ba('0x45')],'row':_0x10b21d});}function handleQuery(_0x338dd7){logger[_0x80ba('0x3e')](_0x338dd7);return db[_0x80ba('0x46')][_0x80ba('0x47')](_0x338dd7)[_0x80ba('0x48')](function(_0x54cb67){results[_0x80ba('0x43')](_0x54cb67);})[_0x80ba('0x49')](function(_0xad5ac8){logger[_0x80ba('0x40')](_0xad5ac8[_0x80ba('0x45')]);});}function main(_0x1b3a29,_0x54d093,_0x2370ec,_0x4ee362){logger[_0x80ba('0x3e')](_0x80ba('0x4a'),_0x1b3a29,JSON['stringify'](_0x54d093));process[_0x80ba('0x4b')](_0x80ba('0x4c'));var _0xc3013f=_0x54d093[_0x80ba('0x4d')];var _0x3290d0=_0x54d093[_0x80ba('0x4e')];var _0xd35da9=path[_0x80ba('0x10')](config[_0x80ba('0x4f')],_0x80ba('0x50'),_0x3290d0+'.csv');var _0x364783=_[_0x80ba('0x34')](_0xc3013f)['join']();logger[_0x80ba('0x3e')](_0x80ba('0x51'),_0x364783);fs[_0x80ba('0x52')](_0xd35da9,_0x364783+'\x0a');Papa[_0x80ba('0x53')](fs['createReadStream'](_0x1b3a29),{'header':!![],'skipEmptyLines':!![],'step':function(_0x236749,_0x3aa9f0){try{for(var _0x6e8a95=0x0,_0x52f186=[];_0x6e8a95<_0x236749[_0x80ba('0x54')][_0x80ba('0x55')];_0x6e8a95++){stats[_0x80ba('0x56')]+=0x1;if(_0x236749[_0x80ba('0x42')][_0x6e8a95]){handleError(_0x236749[_0x80ba('0x54')][_0x6e8a95],_0x236749[_0x80ba('0x42')][_0x6e8a95]);}else{var _0x1149e2=[];for(var _0x3bdcfa in _0xc3013f){if(_0xc3013f[_0x80ba('0x57')](_0x3bdcfa)){if(_0x236749['data'][_0x6e8a95][_0xc3013f[_0x3bdcfa]]){var _0x5c6eae=_[_0x80ba('0x58')](_0x236749[_0x80ba('0x54')][_0x6e8a95][_0xc3013f[_0x3bdcfa]][_0x80ba('0x59')](/"/g,'\x27'));switch(_0x3bdcfa){case _0x80ba('0x1f'):var _0x3a88d5=moment(_0x5c6eae,_0x80ba('0xe'),!![]);if(_0x3a88d5['isValid']()){_0x52f186[_0x80ba('0x43')]('\x22'+_0x5c6eae+'\x22');}else{_0x1149e2[_0x80ba('0x43')](_0x80ba('0x5a'));}break;case _0x80ba('0x22'):var _0xa157cb=parseInt(_0x5c6eae);_0x5c6eae=_['isNaN'](_0xa157cb)||_0xa157cb<0x0||_0xa157cb>0x4?_0x4ee362?0x3:0x2:_0xa157cb;_0x52f186['push']('\x22'+_0x5c6eae+'\x22');break;case _0x80ba('0x23'):var _0x2177aa=parseInt(_0x5c6eae);if(_['isNumber'](_0x2177aa)&&_['includes'](_0x2370ec,_0x2177aa)){_0x52f186[_0x80ba('0x43')]('\x22'+_0x2177aa+'\x22');}else{_0x1149e2[_0x80ba('0x43')](_0x80ba('0x5b'));}break;case _0x80ba('0x5c'):if(isEmail(_0x5c6eae)){_0x52f186[_0x80ba('0x43')]('\x22'+_0x5c6eae+'\x22');}else{_0x1149e2[_0x80ba('0x43')](_0x80ba('0x5d'));}break;case _0x80ba('0x5e'):var _0x18d2bf=moment(_0x5c6eae,_0x80ba('0x5f'),!![]);if(_0x18d2bf[_0x80ba('0x60')]()){_0x52f186[_0x80ba('0x43')]('\x22'+_0x5c6eae+'\x22');}else{_0x1149e2[_0x80ba('0x43')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x52f186[_0x80ba('0x43')]('\x22'+_0x5c6eae+'\x22');}}else{switch(_0x3bdcfa){case _0x80ba('0x61'):case _0x80ba('0x1e'):_0x1149e2[_0x80ba('0x43')](_0x3bdcfa+'\x20not\x20specified');break;default:_0x52f186['push']('\x22\x22');}}}}if(_0x1149e2[_0x80ba('0x55')]){handleError(_0x236749[_0x80ba('0x54')][_0x6e8a95],{'code':_0x80ba('0x62'),'message':_0x1149e2[_0x80ba('0x10')]()});}else{fs['appendFileSync'](_0xd35da9,_0x52f186[_0x80ba('0x10')]()+'\x0a');}_0x52f186=[];}if(!(stats[_0x80ba('0x56')]%0xc8)){socket[_0x80ba('0x63')](_0x80ba('0x64')+_0x3290d0,stats);stats[_0x80ba('0x42')]=[];}}if(stopped){logger['info'](_0x80ba('0x65'));_0x3aa9f0[_0x80ba('0x66')]();}}catch(_0x141ab4){handleError(_0x236749[_0x80ba('0x54')][_0x6e8a95],{'code':_0x80ba('0x67'),'message':_0x141ab4[_0x80ba('0x45')]});logger[_0x80ba('0x40')](_0x80ba('0x68'),_0x141ab4['message']);}},'complete':function(){try{var _0x53ca14=[];var _0x282acb='cm_contacts';if(_0x54d093[_0x80ba('0x69')]&&_0x54d093['duplicates']['length']){_0x282acb='cm_contacts_'+_0x3290d0;_0x53ca14['push'](_0x80ba('0x6a')+_0x282acb+'\x20LIKE\x20cm_contacts;');}var _0x3c5b62=util[_0x80ba('0xd')](_0x80ba('0x6b'),_0xd35da9,_0x282acb,_0x364783,_0x54d093[_0x80ba('0x35')],_0x54d093[_0x80ba('0x36')]||null,NOW,NOW);if(_['isNil'](_0xc3013f[_0x80ba('0x1f')])){_0x3c5b62+=_0x80ba('0x6c');}_0x53ca14[_0x80ba('0x43')](_0x3c5b62);if(_0x54d093[_0x80ba('0x69')]&&_0x54d093[_0x80ba('0x69')][_0x80ba('0x55')]){_0x53ca14[_0x80ba('0x43')](insertCmContact(_0x54d093[_0x80ba('0x35')],_0x282acb,_0x54d093[_0x80ba('0x69')],_0xc3013f));_0x53ca14[_0x80ba('0x43')](_0x80ba('0x6d')+_0x282acb+';');}_0x53ca14[_0x80ba('0x43')](insertCmHopper(_0x54d093[_0x80ba('0x35')],_0x80ba('0x6e'),_0x80ba('0x6f'),_0x80ba('0x70'),_0x4ee362));_0x53ca14['push'](insertCmHopperBlack(_0x54d093[_0x80ba('0x35')],_0x80ba('0x71'),_0x80ba('0x6f'),_0x80ba('0x70')));_0x53ca14[_0x80ba('0x43')](insertCmHopper(_0x54d093[_0x80ba('0x35')],_0x80ba('0x72'),_0x80ba('0x73'),_0x80ba('0x74'),_0x4ee362));_0x53ca14['push'](insertCmHopperBlack(_0x54d093['ListId'],'campaigns_has_cm_blacklists',_0x80ba('0x73'),_0x80ba('0x74')));BPromise[_0x80ba('0x75')](_0x53ca14,handleQuery)[_0x80ba('0x76')](function(_0x56b576){stats[_0x80ba('0x77')]=!![];stats[_0x80ba('0x78')]=_0x54d093[_0x80ba('0x69')]&&_0x54d093[_0x80ba('0x69')][_0x80ba('0x55')]?results[0x2][_0x80ba('0x78')]:results[0x0][_0x80ba('0x78')];socket[_0x80ba('0x63')](_0x80ba('0x64')+_0x3290d0,stats);fs[_0x80ba('0x79')](_0x1b3a29);fs['unlink'](_0xd35da9);process[_0x80ba('0x41')](0x0);})['catch'](function(_0x5bca6c){logger[_0x80ba('0x40')](_0x5bca6c[_0x80ba('0x45')]);process[_0x80ba('0x41')](0x1);});}catch(_0x38a6a0){logger['error'](_0x80ba('0x7a'),_0x38a6a0[_0x80ba('0x45')]);process[_0x80ba('0x41')](0x1);}},'error':function(_0x4d685b,_0x12495,_0x14f6a4,_0x198f79){throw new Error(_0x198f79);}});}function validate(){if(process[_0x80ba('0x7b')]&&process[_0x80ba('0x7b')][_0x80ba('0x55')]<0x4){throw new Error(_0x80ba('0x7c'));}var _0x3b79c7=path[_0x80ba('0x10')](config['root'],_0x80ba('0x50'),process[_0x80ba('0x7b')][0x2]);if(!fs[_0x80ba('0x7d')](_0x3b79c7)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x5dc760={};try{_0x5dc760=JSON[_0x80ba('0x53')](process[_0x80ba('0x7b')][0x3]);if(!_0x5dc760['binding']){throw new Error(_0x80ba('0x7e'));}if(!_0x5dc760['binding'][_0x80ba('0x1e')]){throw new Error('phone\x20is\x20mandatory');}if(!_0x5dc760[_0x80ba('0x4d')][_0x80ba('0x61')]){throw new Error('firstName\x20is\x20mandatory');}var _0x577be0=0x0;if(_0x5dc760[_0x80ba('0x4d')][_0x80ba('0x23')]){_0x577be0=0x1;}if(!_0x5dc760[_0x80ba('0x35')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x57003f){throw new Error(_0x80ba('0x7f'));}var _0xf50071=[];try{_0xf50071=_['map'](JSON[_0x80ba('0x53')](process[_0x80ba('0x7b')][0x4]),'id');}catch(_0x2062db){logger[_0x80ba('0x3e')](_0x80ba('0x80'));}main(_0x3b79c7,_0x5dc760,_0xf50071,_0x577be0);}validate();process['on'](_0x80ba('0x81'),handleStop);process['on'](_0x80ba('0x82'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index b36711b..a4737f1 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 _0x4dfa=['Agent\x20Name','destcalleridname','destcalleridnum','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','Hold\x20Time','talktime','membername','UniqueId','starttime','Answer\x20Time','answertime','Complete\x20Time','endtime','Duration','duration','Billable\x20Time','billableseconds','string','[xCALLY\x20Ticket]','toLowerCase','inbound','push','variable','queue','calleridnum','Outbound\x20Call','voice','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','Call\x20To','destexten','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x4dfa,0x1d8));var _0xa4df=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x4dfa[_0x2f5ac5];return _0x37c9a8;};'use strict';exports['getSubjects']=function(_0x26104b,_0x337ed1){var _0x450523=[{'type':_0xa4df('0x0'),'content':_0xa4df('0x1'),'variableName':null}];switch(_0x26104b[_0xa4df('0x2')]()){case'voice':switch(_0x337ed1[_0xa4df('0x2')]()){case _0xa4df('0x3'):_0x450523[_0xa4df('0x4')]({'type':_0xa4df('0x5'),'content':'','variableName':_0xa4df('0x6')});_0x450523[_0xa4df('0x4')]({'type':_0xa4df('0x5'),'content':'','variableName':_0xa4df('0x7')});break;case'outbound':_0x450523[_0xa4df('0x4')]({'type':_0xa4df('0x0'),'content':_0xa4df('0x8'),'variableName':null});_0x450523['push']({'type':_0xa4df('0x5'),'content':'','variableName':'destcalleridnum'});break;}}return _0x450523;};exports['getDescriptions']=function(_0x53b050,_0x8a5023){var _0x27f3ba=[];switch(_0x53b050[_0xa4df('0x2')]()){case _0xa4df('0x9'):switch(_0x8a5023[_0xa4df('0x2')]()){case'inbound':_0x27f3ba=[{'type':'string','content':_0xa4df('0xa'),'key':null,'keyType':null,'variableName':null},{'type':_0xa4df('0xb'),'content':'','key':_0xa4df('0xc'),'keyType':_0xa4df('0x5'),'variableName':_0xa4df('0x7')},{'type':_0xa4df('0xb'),'content':'','key':_0xa4df('0xd'),'keyType':_0xa4df('0x5'),'variableName':'calleridname'},{'type':_0xa4df('0xb'),'content':'','key':_0xa4df('0xe'),'keyType':_0xa4df('0x5'),'variableName':_0xa4df('0xf')},{'type':_0xa4df('0xb'),'content':'','key':'Queue','keyType':_0xa4df('0x5'),'variableName':_0xa4df('0x6')},{'type':_0xa4df('0xb'),'content':'','key':'UniqueId','keyType':_0xa4df('0x5'),'variableName':_0xa4df('0x10')},{'type':_0xa4df('0xb'),'content':'','key':_0xa4df('0x11'),'keyType':_0xa4df('0x5'),'variableName':_0xa4df('0x12')},{'type':'string','content':_0xa4df('0x13'),'key':null,'keyType':null,'variableName':null},{'type':_0xa4df('0xb'),'content':'','key':_0xa4df('0x14'),'keyType':_0xa4df('0x5'),'variableName':_0xa4df('0x15')},{'type':_0xa4df('0xb'),'content':'','key':'Agent\x20Number','keyType':_0xa4df('0x5'),'variableName':_0xa4df('0x16')},{'type':'string','content':_0xa4df('0x17'),'key':null,'keyType':null,'variableName':null},{'type':_0xa4df('0xb'),'content':'','key':_0xa4df('0x18'),'keyType':_0xa4df('0x5'),'variableName':_0xa4df('0x12')},{'type':_0xa4df('0xb'),'content':'','key':_0xa4df('0x19'),'keyType':'variable','variableName':_0xa4df('0x1a')},{'type':_0xa4df('0xb'),'content':'','key':_0xa4df('0x1b'),'keyType':'variable','variableName':'agentcompleteAt'},{'type':_0xa4df('0xb'),'content':'','key':_0xa4df('0x1c'),'keyType':_0xa4df('0x5'),'variableName':'holdtime'},{'type':_0xa4df('0xb'),'content':'','key':'Talk\x20Time','keyType':_0xa4df('0x5'),'variableName':_0xa4df('0x1d')}];break;case'outbound':_0x27f3ba=[{'type':_0xa4df('0x0'),'content':_0xa4df('0xa'),'variableName':null},{'type':_0xa4df('0xb'),'content':'','key':'Called\x20Number','keyType':_0xa4df('0x5'),'keyContent':'','variableName':_0xa4df('0x16')},{'type':_0xa4df('0xb'),'content':'','key':'Member\x20Name','keyType':_0xa4df('0x5'),'keyContent':'','variableName':_0xa4df('0x1e')},{'type':_0xa4df('0xb'),'content':'','key':_0xa4df('0x1f'),'keyType':'variable','keyContent':'','variableName':'uniqueid'},{'type':_0xa4df('0xb'),'content':'','key':_0xa4df('0x11'),'keyType':_0xa4df('0x5'),'keyContent':'','variableName':_0xa4df('0x20')},{'type':_0xa4df('0x0'),'content':'***\x20Time\x20Info\x20***'},{'type':_0xa4df('0xb'),'content':'','key':_0xa4df('0x21'),'keyType':_0xa4df('0x5'),'keyContent':'','variableName':_0xa4df('0x22')},{'type':'keyValue','content':'','key':_0xa4df('0x23'),'keyType':'variable','keyContent':'','variableName':_0xa4df('0x24')},{'type':_0xa4df('0xb'),'content':'','key':_0xa4df('0x25'),'keyType':_0xa4df('0x5'),'keyContent':'','variableName':_0xa4df('0x26')},{'type':_0xa4df('0xb'),'content':'','key':_0xa4df('0x27'),'keyType':_0xa4df('0x5'),'keyContent':'','variableName':_0xa4df('0x28')}];break;}}return _0x27f3ba;}; \ No newline at end of file +var _0xe12f=['getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','inbound','push','variable','queue','calleridnum','outbound','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','calleridname','destexten','Queue','UniqueId','uniqueid','Date','agentcalledAt','destcalleridname','Agent\x20Number','destcalleridnum','***\x20Time\x20Info\x20***','Agent\x20Connect','agentcompleteAt','holdtime','membername','starttime','Complete\x20Time','endtime','Duration','duration','Billable\x20Time','billableseconds'];(function(_0x34cd13,_0x113ac4){var _0x15de19=function(_0x13bdea){while(--_0x13bdea){_0x34cd13['push'](_0x34cd13['shift']());}};_0x15de19(++_0x113ac4);}(_0xe12f,0xde));var _0xfe12=function(_0x293ad8,_0x180ac5){_0x293ad8=_0x293ad8-0x0;var _0x4dc4b8=_0xe12f[_0x293ad8];return _0x4dc4b8;};'use strict';exports[_0xfe12('0x0')]=function(_0x42e5b9,_0x3575f5){var _0x3a8cd8=[{'type':_0xfe12('0x1'),'content':_0xfe12('0x2'),'variableName':null}];switch(_0x42e5b9[_0xfe12('0x3')]()){case'voice':switch(_0x3575f5[_0xfe12('0x3')]()){case _0xfe12('0x4'):_0x3a8cd8[_0xfe12('0x5')]({'type':_0xfe12('0x6'),'content':'','variableName':_0xfe12('0x7')});_0x3a8cd8['push']({'type':_0xfe12('0x6'),'content':'','variableName':_0xfe12('0x8')});break;case _0xfe12('0x9'):_0x3a8cd8['push']({'type':_0xfe12('0x1'),'content':'Outbound\x20Call','variableName':null});_0x3a8cd8['push']({'type':_0xfe12('0x6'),'content':'','variableName':'destcalleridnum'});break;}}return _0x3a8cd8;};exports[_0xfe12('0xa')]=function(_0x33069d,_0x180851){var _0x5284bc=[];switch(_0x33069d['toLowerCase']()){case'voice':switch(_0x180851['toLowerCase']()){case _0xfe12('0x4'):_0x5284bc=[{'type':_0xfe12('0x1'),'content':_0xfe12('0xb'),'key':null,'keyType':null,'variableName':null},{'type':_0xfe12('0xc'),'content':'','key':_0xfe12('0xd'),'keyType':'variable','variableName':'calleridnum'},{'type':_0xfe12('0xc'),'content':'','key':_0xfe12('0xe'),'keyType':_0xfe12('0x6'),'variableName':_0xfe12('0xf')},{'type':'keyValue','content':'','key':'Call\x20To','keyType':_0xfe12('0x6'),'variableName':_0xfe12('0x10')},{'type':'keyValue','content':'','key':_0xfe12('0x11'),'keyType':_0xfe12('0x6'),'variableName':_0xfe12('0x7')},{'type':'keyValue','content':'','key':_0xfe12('0x12'),'keyType':'variable','variableName':_0xfe12('0x13')},{'type':'keyValue','content':'','key':_0xfe12('0x14'),'keyType':_0xfe12('0x6'),'variableName':_0xfe12('0x15')},{'type':_0xfe12('0x1'),'content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0xfe12('0xc'),'content':'','key':'Agent\x20Name','keyType':_0xfe12('0x6'),'variableName':_0xfe12('0x16')},{'type':_0xfe12('0xc'),'content':'','key':_0xfe12('0x17'),'keyType':'variable','variableName':_0xfe12('0x18')},{'type':_0xfe12('0x1'),'content':_0xfe12('0x19'),'key':null,'keyType':null,'variableName':null},{'type':_0xfe12('0xc'),'content':'','key':'Agent\x20Ring','keyType':'variable','variableName':_0xfe12('0x15')},{'type':_0xfe12('0xc'),'content':'','key':_0xfe12('0x1a'),'keyType':_0xfe12('0x6'),'variableName':'agentconnectAt'},{'type':_0xfe12('0xc'),'content':'','key':'Agent\x20Complete','keyType':_0xfe12('0x6'),'variableName':_0xfe12('0x1b')},{'type':_0xfe12('0xc'),'content':'','key':'Hold\x20Time','keyType':_0xfe12('0x6'),'variableName':_0xfe12('0x1c')},{'type':'keyValue','content':'','key':'Talk\x20Time','keyType':'variable','variableName':'talktime'}];break;case _0xfe12('0x9'):_0x5284bc=[{'type':_0xfe12('0x1'),'content':_0xfe12('0xb'),'variableName':null},{'type':_0xfe12('0xc'),'content':'','key':'Called\x20Number','keyType':'variable','keyContent':'','variableName':_0xfe12('0x18')},{'type':_0xfe12('0xc'),'content':'','key':'Member\x20Name','keyType':_0xfe12('0x6'),'keyContent':'','variableName':_0xfe12('0x1d')},{'type':'keyValue','content':'','key':_0xfe12('0x12'),'keyType':'variable','keyContent':'','variableName':_0xfe12('0x13')},{'type':_0xfe12('0xc'),'content':'','key':'Date','keyType':'variable','keyContent':'','variableName':_0xfe12('0x1e')},{'type':_0xfe12('0x1'),'content':_0xfe12('0x19')},{'type':_0xfe12('0xc'),'content':'','key':'Answer\x20Time','keyType':'variable','keyContent':'','variableName':'answertime'},{'type':_0xfe12('0xc'),'content':'','key':_0xfe12('0x1f'),'keyType':_0xfe12('0x6'),'keyContent':'','variableName':_0xfe12('0x20')},{'type':'keyValue','content':'','key':_0xfe12('0x21'),'keyType':_0xfe12('0x6'),'keyContent':'','variableName':_0xfe12('0x22')},{'type':_0xfe12('0xc'),'content':'','key':_0xfe12('0x23'),'keyType':'variable','keyContent':'','variableName':_0xfe12('0x24')}];break;}}return _0x5284bc;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 6061f81..47ccb3f 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 _0x49cf=['info','catch','error','tracked','user','query','clone','body','html','phone','fax','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','stringify','Interaction','findOne','then','update'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x49cf,0xc8));var _0xf49c=function(_0x581c2b,_0xa6d0cb){_0x581c2b=_0x581c2b-0x0;var _0x403750=_0x49cf[_0x581c2b];return _0x403750;};'use strict';var _=require('lodash');var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0xf49c('0x0'))(_0xf49c('0x1')),'mail':require(_0xf49c('0x0'))(_0xf49c('0x2')),'fax':require(_0xf49c('0x0'))(_0xf49c('0x3')),'sms':require('../../config/logger')('sms-interactions'),'chat':require('../../config/logger')('chat-interactions'),'whatsapp':require(_0xf49c('0x0'))(_0xf49c('0x4'))};function getInteractionId(_0x252d9e,_0x4d0fc1,_0x36ac95){if(_0x252d9e&&_0x252d9e[_[_0xf49c('0x5')](_0x36ac95)+_0xf49c('0x6')]){return _0x252d9e[_['upperFirst'](_0x36ac95)+_0xf49c('0x6')];}else if(_0x252d9e&&_0x252d9e['id']){return _0x252d9e['id'];}else if(_0x4d0fc1&&_0x4d0fc1['id']){return _0x4d0fc1['id'];}else{return _0xf49c('0x7');}}function log(_0xd2f8a6,_0x4db60f,_0x54cba5,_0x54edea,_0x271b31,_0x1acbe7){loggers[_0x271b31[_0xf49c('0x8')]()][_0xd2f8a6](_0xf49c('0x9'),_0x1acbe7['toUpperCase'](),_0x4db60f?_0x4db60f['id']:null,_0x4db60f?_0x4db60f[_0xf49c('0xa')]:null,_0x4db60f?_0x4db60f['role']:null,getInteractionId(_0x54cba5,_0x54edea,_0x271b31),_0x54cba5?JSON[_0xf49c('0xb')](_0x54cba5):'null');}function updateUser(_0x4a9b21,_0x53a68e,_0x2fcc8e,_0x1da42e,_0x2af00b){db[_['upperFirst'](_0x1da42e)+_0xf49c('0xc')][_0xf49c('0xd')]({'where':{'id':getInteractionId(_0x53a68e,_0x2fcc8e,_0x1da42e)}})[_0xf49c('0xe')](function(_0x1949f9){if(_0x1949f9){return _0x1949f9[_0xf49c('0xf')]({'UserId':_0x4a9b21?_0x4a9b21['id']:null});}})['then'](function(_0x4c103d){if(_0x4c103d){log(_0xf49c('0x10'),_0x4a9b21,_0x53a68e,_0x2fcc8e,_0x1da42e,_0x2af00b);}})[_0xf49c('0x11')](function(){log(_0xf49c('0x12'),_0x4a9b21,_0x53a68e,_0x2fcc8e,_0x1da42e,_0x2af00b);});}exports[_0xf49c('0x13')]=function(_0x4a1d86,_0x117d06){return function(_0x4d080f,_0xf7376b,_0x15eed4){var _0x4fc674=_0x4d080f[_0xf49c('0x14')];var _0x3f0de1={};var _0x5b26a1=_0x4d080f[_0xf49c('0x15')];if(_0x3f0de1){_0x3f0de1=_[_0xf49c('0x16')](_0x4d080f[_0xf49c('0x17')]);_0x3f0de1=_['omit'](_0x3f0de1,[_0xf49c('0x17'),_0xf49c('0x18'),_0xf49c('0x19'),_0xf49c('0x1a'),'mobile']);}updateUser(_0x4fc674,_0x3f0de1,_0x5b26a1,_0x4a1d86,_0x117d06);_0x15eed4(null);};}; \ No newline at end of file +var _0xaffb=['[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','null','findOne','then','update','info','catch','error','tracked','user','query','body','omit','html','lodash','../../mysqldb','../../config/logger','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','toLowerCase'];(function(_0x2c6df3,_0x379693){var _0x2fe1cc=function(_0x29cb03){while(--_0x29cb03){_0x2c6df3['push'](_0x2c6df3['shift']());}};_0x2fe1cc(++_0x379693);}(_0xaffb,0x85));var _0xbaff=function(_0x4715d2,_0x3371b2){_0x4715d2=_0x4715d2-0x0;var _0x141811=_0xaffb[_0x4715d2];return _0x141811;};'use strict';var _=require(_0xbaff('0x0'));var db=require(_0xbaff('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')('openchannel-interactions'),'mail':require(_0xbaff('0x2'))(_0xbaff('0x3')),'fax':require(_0xbaff('0x2'))(_0xbaff('0x4')),'sms':require(_0xbaff('0x2'))(_0xbaff('0x5')),'chat':require(_0xbaff('0x2'))(_0xbaff('0x6')),'whatsapp':require(_0xbaff('0x2'))(_0xbaff('0x7'))};function getInteractionId(_0x3f861e,_0xc23ea4,_0x295e39){if(_0x3f861e&&_0x3f861e[_[_0xbaff('0x8')](_0x295e39)+_0xbaff('0x9')]){return _0x3f861e[_[_0xbaff('0x8')](_0x295e39)+_0xbaff('0x9')];}else if(_0x3f861e&&_0x3f861e['id']){return _0x3f861e['id'];}else if(_0xc23ea4&&_0xc23ea4['id']){return _0xc23ea4['id'];}else{return _0xbaff('0xa');}}function log(_0x52b335,_0x1d5ca5,_0x5caec6,_0x5d9e24,_0x1e540b,_0x479c3e){loggers[_0x1e540b[_0xbaff('0xb')]()][_0x52b335](_0xbaff('0xc'),_0x479c3e[_0xbaff('0xd')](),_0x1d5ca5?_0x1d5ca5['id']:null,_0x1d5ca5?_0x1d5ca5[_0xbaff('0xe')]:null,_0x1d5ca5?_0x1d5ca5[_0xbaff('0xf')]:null,getInteractionId(_0x5caec6,_0x5d9e24,_0x1e540b),_0x5caec6?JSON['stringify'](_0x5caec6):_0xbaff('0x10'));}function updateUser(_0xa82d8f,_0x5d4236,_0x16450c,_0x3f580c,_0x20a503){db[_[_0xbaff('0x8')](_0x3f580c)+'Interaction'][_0xbaff('0x11')]({'where':{'id':getInteractionId(_0x5d4236,_0x16450c,_0x3f580c)}})[_0xbaff('0x12')](function(_0x1a6d0b){if(_0x1a6d0b){return _0x1a6d0b[_0xbaff('0x13')]({'UserId':_0xa82d8f?_0xa82d8f['id']:null});}})[_0xbaff('0x12')](function(_0x3bbac4){if(_0x3bbac4){log(_0xbaff('0x14'),_0xa82d8f,_0x5d4236,_0x16450c,_0x3f580c,_0x20a503);}})[_0xbaff('0x15')](function(){log(_0xbaff('0x16'),_0xa82d8f,_0x5d4236,_0x16450c,_0x3f580c,_0x20a503);});}exports[_0xbaff('0x17')]=function(_0x3f6f94,_0x5e5060){return function(_0x5809a5,_0x30ff3d,_0x12e5c8){var _0x3ab75a=_0x5809a5[_0xbaff('0x18')];var _0x2e378b={};var _0xc362ff=_0x5809a5[_0xbaff('0x19')];if(_0x2e378b){_0x2e378b=_['clone'](_0x5809a5[_0xbaff('0x1a')]);_0x2e378b=_[_0xbaff('0x1b')](_0x2e378b,[_0xbaff('0x1a'),_0xbaff('0x1c'),'phone','fax','mobile']);}updateUser(_0x3ab75a,_0x2e378b,_0xc362ff,_0x3f6f94,_0x5e5060);_0x12e5c8(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index d85194d..13c1c97 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 _0x5dba=['../../config/environment','data1','license','split','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','parse','hasOwnProperty','use','then','status','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','user','isUserLimit','crypto','util','../../mysqldb'];(function(_0x46b9a5,_0x4ab71f){var _0x37ac9f=function(_0x498f81){while(--_0x498f81){_0x46b9a5['push'](_0x46b9a5['shift']());}};_0x37ac9f(++_0x4ab71f);}(_0x5dba,0x8d));var _0xa5db=function(_0x43bd62,_0x107420){_0x43bd62=_0x43bd62-0x0;var _0x22321c=_0x5dba[_0x43bd62];return _0x22321c;};'use strict';var crypto=require(_0xa5db('0x0'));var util=require(_0xa5db('0x1'));var compose=require('composable-middleware');var db=require(_0xa5db('0x2'))['db'];var config=require(_0xa5db('0x3'));function getValueFromLicense(_0x30d98c,_0x34b72b){if(_0x30d98c&&_0x34b72b){if(_0x34b72b[_0xa5db('0x4')]&&_0x34b72b[_0xa5db('0x5')]){var _0x2dbb8c=_0x34b72b[_0xa5db('0x4')];var _0x3e9282=_0x34b72b['license'];var _0x3caf4a=_0x2dbb8c[_0xa5db('0x6')]('-')[0x4];var _0xa3298a=_0x2dbb8c['split']('-')[0x0];var _0x1decfe=crypto['createDecipher'](_0xa5db('0x7'),util[_0xa5db('0x8')](_0xa5db('0x9'),_0x3caf4a,_0x2dbb8c,_0xa3298a));var _0x45c32c=_0x1decfe[_0xa5db('0xa')](_0x3e9282,_0xa5db('0xb'),_0xa5db('0xc'));_0x45c32c+=_0x1decfe['final'](_0xa5db('0xc'));var _0xb19425=JSON[_0xa5db('0xd')](_0x45c32c);return _0xb19425[_0xa5db('0xe')](_0x30d98c)?_0xb19425[_0x30d98c]:null;}}return null;}function isLimit(_0x6a210c,_0x37b6dd,_0x4fdabf,_0x4364dd){var _0x1f50a7=_0x37b6dd;return compose()[_0xa5db('0xf')](function(_0x3e7736,_0x161849,_0x349f6f){return db['License']['findOne']({'where':{'id':0x1},'raw':!![]})[_0xa5db('0x10')](function(_0x5302e2){var _0x34be74=getValueFromLicense(_0x6a210c,_0x5302e2);return _0x34be74?_0x34be74:_0x1f50a7;})['then'](function(_0x33c48e){_0x1f50a7=_0x33c48e;return _0x4fdabf['count'](_0x4364dd);})[_0xa5db('0x10')](function(_0x596674){if(_0x596674>=_0x1f50a7){return _0x161849[_0xa5db('0x11')](0x193)['json']({'message':util[_0xa5db('0x8')](_0xa5db('0x12'),_0x6a210c)});}_0x349f6f();})[_0xa5db('0x13')](function(_0x4e8e02){_0x349f6f(_0x4e8e02);});});}function isUserLimit(){return isLimit(_0xa5db('0x14'),0x1,db[_0xa5db('0x15')],{'where':{'$or':[{'role':'admin'},{'role':_0xa5db('0x16')}]}});}exports[_0xa5db('0x17')]=isUserLimit; \ No newline at end of file +var _0x29b0=['util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','use','License','findOne','then','count','status','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','User','admin','user','isUserLimit'];(function(_0x3477c4,_0x309176){var _0xb1b1b5=function(_0x497eeb){while(--_0x497eeb){_0x3477c4['push'](_0x3477c4['shift']());}};_0xb1b1b5(++_0x309176);}(_0x29b0,0x8c));var _0x029b=function(_0x99e8f7,_0x4950d1){_0x99e8f7=_0x99e8f7-0x0;var _0xb866d2=_0x29b0[_0x99e8f7];return _0xb866d2;};'use strict';var crypto=require('crypto');var util=require(_0x029b('0x0'));var compose=require(_0x029b('0x1'));var db=require(_0x029b('0x2'))['db'];var config=require(_0x029b('0x3'));function getValueFromLicense(_0xb35459,_0x96080d){if(_0xb35459&&_0x96080d){if(_0x96080d[_0x029b('0x4')]&&_0x96080d[_0x029b('0x5')]){var _0x29160b=_0x96080d[_0x029b('0x4')];var _0x15c131=_0x96080d['license'];var _0xbfe64=_0x29160b[_0x029b('0x6')]('-')[0x4];var _0x44187d=_0x29160b['split']('-')[0x0];var _0x36c202=crypto[_0x029b('0x7')]('aes-256-ctr',util['format'](_0x029b('0x8'),_0xbfe64,_0x29160b,_0x44187d));var _0x7d1c4f=_0x36c202[_0x029b('0x9')](_0x15c131,_0x029b('0xa'),_0x029b('0xb'));_0x7d1c4f+=_0x36c202[_0x029b('0xc')](_0x029b('0xb'));var _0x3c6f07=JSON[_0x029b('0xd')](_0x7d1c4f);return _0x3c6f07[_0x029b('0xe')](_0xb35459)?_0x3c6f07[_0xb35459]:null;}}return null;}function isLimit(_0x155a28,_0x57eea9,_0x5aee7a,_0x346578){var _0x5e97f5=_0x57eea9;return compose()[_0x029b('0xf')](function(_0x3a18ed,_0x2e2df1,_0x45ba7c){return db[_0x029b('0x10')][_0x029b('0x11')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x2dc6ce){var _0x57316f=getValueFromLicense(_0x155a28,_0x2dc6ce);return _0x57316f?_0x57316f:_0x5e97f5;})[_0x029b('0x12')](function(_0x342148){_0x5e97f5=_0x342148;return _0x5aee7a[_0x029b('0x13')](_0x346578);})['then'](function(_0x4dce6b){if(_0x4dce6b>=_0x5e97f5){return _0x2e2df1[_0x029b('0x14')](0x193)['json']({'message':util[_0x029b('0x15')](_0x029b('0x16'),_0x155a28)});}_0x45ba7c();})['catch'](function(_0x2afe69){_0x45ba7c(_0x2afe69);});});}function isUserLimit(){return isLimit(_0x029b('0x17'),0x1,db[_0x029b('0x18')],{'where':{'$or':[{'role':_0x029b('0x19')},{'role':_0x029b('0x1a')}]}});}exports[_0x029b('0x1b')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 1627f83..0aff543 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 _0xe49a=['and','replace','split','length','slice','forEach','match','filter','indexOf','map','conditions','push','buildExpression','DATE','operator','$eq','$between','value','includes','$gt','$lte','add','format','YYYY-MM-DD','CAST(','\x20AS\x20','castTo','text','$ne','\x20OR\x20','\x20IS\x20NULL)','IN\x20?','$notIn','NOT\x20IN\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','$in','start','pop','utcOffset','hours','minutes','seconds','lodash','moment','parseSearch','startsWith','[$or]'];(function(_0x5e4046,_0x22b8a8){var _0x26fcc5=function(_0x53ebef){while(--_0x53ebef){_0x5e4046['push'](_0x5e4046['shift']());}};_0x26fcc5(++_0x22b8a8);}(_0xe49a,0x1b3));var _0xae49=function(_0x25844c,_0x2682a2){_0x25844c=_0x25844c-0x0;var _0x49e34b=_0xe49a[_0x25844c];return _0x49e34b;};'use strict';var _=require(_0xae49('0x0'));var moment=require(_0xae49('0x1'));exports[_0xae49('0x2')]=function(_0x475ce7){var _0x1da491={'conditions':[]};_0x1da491['sqlOperator']=_[_0xae49('0x3')](_0x475ce7,_0xae49('0x4'))?'or':_0xae49('0x5');var _0x2279b5=_0x475ce7[_0xae49('0x6')]('[$and]','')['replace'](_0xae49('0x4'),'')[_0xae49('0x7')]('||');for(var _0x2284dd=0x0;_0x2284dd<_0x2279b5[_0xae49('0x8')];_0x2284dd++){var _0x128b0a=_0x2279b5[_0x2284dd]['split'](':=');var _0x432ad8=_0x128b0a[0x0];var _0x17844e=_0x128b0a[_0xae49('0x9')](0x1);_0x17844e[_0xae49('0xa')](function(_0x1560fb){var _0x148763=_0x1560fb[_0xae49('0x7')]('[')['shift']();var _0x334e20=_0x1560fb[_0xae49('0xb')](/\[(.*?)\]/g);_0x334e20['forEach'](function(_0x48664b){var _0x1a0b23=_0x48664b['split']('[')[_0xae49('0xc')](function(_0x303e47){return _0x303e47[_0xae49('0xd')](']')>-0x1;})[_0xae49('0xe')](function(_0x319ed3){return _0x319ed3[_0xae49('0x7')](']')[0x0];})[0x0];_0x1da491[_0xae49('0xf')][_0xae49('0x10')]({'field':_0x432ad8,'operator':_0x148763,'value':_0x1a0b23});});});}return _0x1da491;};exports[_0xae49('0x11')]=function(_0x1ce321,_0x2ca94b,_0x2c5e9e){var _0x2817a0={};if(_0x2ca94b===_0xae49('0x12')){if(_0x2c5e9e[_0xae49('0x13')]===_0xae49('0x14')){_0x2c5e9e[_0xae49('0x13')]=_0xae49('0x15');_0x2c5e9e[_0xae49('0x16')]+=','+_0x2c5e9e[_0xae49('0x16')];}else if(_[_0xae49('0x17')]([_0xae49('0x18'),_0xae49('0x19')],_0x2c5e9e[_0xae49('0x13')])){_0x2c5e9e[_0xae49('0x16')]=moment(_0x2c5e9e[_0xae49('0x16')])[_0xae49('0x1a')](0x1,'days')[_0xae49('0x1b')](_0xae49('0x1c'));}}if(_0x2c5e9e['castTo']){_0x2ca94b=_0x2c5e9e['castTo'];_0x2817a0['text']=_0xae49('0x1d')+_0x1ce321+'.'+_0x2c5e9e['field']+_0xae49('0x1e')+_0x2c5e9e[_0xae49('0x1f')]+')\x20'+parseOperator(_0x2c5e9e[_0xae49('0x13')]);}else{_0x2817a0[_0xae49('0x20')]=_0x1ce321+'.'+_0x2c5e9e['field']+'\x20'+parseOperator(_0x2c5e9e['operator']);}if(_[_0xae49('0x17')]([_0xae49('0x21'),'$notIn'],_0x2c5e9e[_0xae49('0x13')]))_0x2817a0[_0xae49('0x20')]='('+_0x2817a0[_0xae49('0x20')]+_0xae49('0x22')+_0x1ce321+'.'+_0x2c5e9e['field']+_0xae49('0x23');_0x2817a0[_0xae49('0x16')]=parseValue(_0x2ca94b,_0x2c5e9e['operator'],_0x2c5e9e['value']);return _0x2817a0;};function parseOperator(_0x358a80){var _0x59b3b7;switch(_0x358a80){case'$in':_0x59b3b7=_0xae49('0x24');break;case _0xae49('0x25'):_0x59b3b7=_0xae49('0x26');break;case _0xae49('0x14'):_0x59b3b7='=\x20?';break;case _0xae49('0x21'):_0x59b3b7='<>\x20?';break;case _0xae49('0x27'):case _0xae49('0x28'):case _0xae49('0x29'):_0x59b3b7=_0xae49('0x2a');break;case _0xae49('0x2b'):_0x59b3b7=_0xae49('0x2c');break;case _0xae49('0x18'):_0x59b3b7='>\x20?';break;case _0xae49('0x19'):_0x59b3b7='<=\x20?';break;case _0xae49('0x2d'):_0x59b3b7=_0xae49('0x2e');break;case'$between':_0x59b3b7=_0xae49('0x2f');break;}return _0x59b3b7;}function parseValue(_0x988af7,_0x29fea4,_0x4b4a59){var _0x39281c={'start':undefined,'end':undefined};switch(_0x29fea4){case _0xae49('0x30'):case _0xae49('0x25'):_0x39281c['start']=_0x4b4a59[_0xae49('0x7')](',');break;case _0xae49('0x27'):_0x39281c['start']='%'+_0x4b4a59+'%';break;case _0xae49('0x28'):_0x39281c[_0xae49('0x31')]=_0x4b4a59+'%';break;case _0xae49('0x29'):_0x39281c['start']='%'+_0x4b4a59;break;case _0xae49('0x15'):var _0x399ee5=_0x4b4a59[_0xae49('0x7')](',');var _0x4b4a59=_0x399ee5['shift']();var _0x165790=_0x399ee5[_0xae49('0x32')]();if(_0x988af7==='DATE'){_0x4b4a59=moment(_0x4b4a59)[_0xae49('0x33')](0x0,!![])[_0xae49('0x1b')]();_0x165790=moment(_0x165790)[_0xae49('0x33')](0x0,!![])[_0xae49('0x1a')](0x17,_0xae49('0x34'))['add'](0x3b,_0xae49('0x35'))[_0xae49('0x1a')](0x3b,_0xae49('0x36'))['format']();}_0x39281c={'start':_0x4b4a59,'end':_0x165790};break;default:_0x39281c[_0xae49('0x31')]=_0x4b4a59;break;}return _0x39281c;} \ No newline at end of file +var _0x0f5a=['YYYY-MM-DD','castTo','CAST(','field','text','$ne','$notIn','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','$eq','=\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','$gt','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','DATE','utcOffset','hours','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','[$and]','length','split','slice','shift','match','forEach','filter','indexOf','conditions','buildExpression','operator','$between','value','includes','$lte','add','format'];(function(_0xe40cf5,_0x16af23){var _0x5e189e=function(_0x82418d){while(--_0x82418d){_0xe40cf5['push'](_0xe40cf5['shift']());}};_0x5e189e(++_0x16af23);}(_0x0f5a,0xc0));var _0xa0f5=function(_0x40c849,_0xbc22a1){_0x40c849=_0x40c849-0x0;var _0x7d3bef=_0x0f5a[_0x40c849];return _0x7d3bef;};'use strict';var _=require(_0xa0f5('0x0'));var moment=require(_0xa0f5('0x1'));exports[_0xa0f5('0x2')]=function(_0x3f39c1){var _0x45d5be={'conditions':[]};_0x45d5be[_0xa0f5('0x3')]=_[_0xa0f5('0x4')](_0x3f39c1,_0xa0f5('0x5'))?'or':'and';var _0x137944=_0x3f39c1['replace'](_0xa0f5('0x6'),'')['replace'](_0xa0f5('0x5'),'')['split']('||');for(var _0xfa0e0b=0x0;_0xfa0e0b<_0x137944[_0xa0f5('0x7')];_0xfa0e0b++){var _0x28fd9c=_0x137944[_0xfa0e0b][_0xa0f5('0x8')](':=');var _0x547d5d=_0x28fd9c[0x0];var _0x304615=_0x28fd9c[_0xa0f5('0x9')](0x1);_0x304615['forEach'](function(_0x485db3){var _0x30f569=_0x485db3['split']('[')[_0xa0f5('0xa')]();var _0x6d95d9=_0x485db3[_0xa0f5('0xb')](/\[(.*?)\]/g);_0x6d95d9[_0xa0f5('0xc')](function(_0x281985){var _0x3b5da3=_0x281985[_0xa0f5('0x8')]('[')[_0xa0f5('0xd')](function(_0x26e0a3){return _0x26e0a3[_0xa0f5('0xe')](']')>-0x1;})['map'](function(_0x1c4791){return _0x1c4791[_0xa0f5('0x8')](']')[0x0];})[0x0];_0x45d5be[_0xa0f5('0xf')]['push']({'field':_0x547d5d,'operator':_0x30f569,'value':_0x3b5da3});});});}return _0x45d5be;};exports[_0xa0f5('0x10')]=function(_0x215a0d,_0xb7acd8,_0x5232f7){var _0x168c2c={};if(_0xb7acd8==='DATE'){if(_0x5232f7['operator']==='$eq'){_0x5232f7[_0xa0f5('0x11')]=_0xa0f5('0x12');_0x5232f7[_0xa0f5('0x13')]+=','+_0x5232f7[_0xa0f5('0x13')];}else if(_[_0xa0f5('0x14')](['$gt',_0xa0f5('0x15')],_0x5232f7['operator'])){_0x5232f7[_0xa0f5('0x13')]=moment(_0x5232f7[_0xa0f5('0x13')])[_0xa0f5('0x16')](0x1,'days')[_0xa0f5('0x17')](_0xa0f5('0x18'));}}if(_0x5232f7[_0xa0f5('0x19')]){_0xb7acd8=_0x5232f7[_0xa0f5('0x19')];_0x168c2c['text']=_0xa0f5('0x1a')+_0x215a0d+'.'+_0x5232f7[_0xa0f5('0x1b')]+'\x20AS\x20'+_0x5232f7[_0xa0f5('0x19')]+')\x20'+parseOperator(_0x5232f7[_0xa0f5('0x11')]);}else{_0x168c2c[_0xa0f5('0x1c')]=_0x215a0d+'.'+_0x5232f7[_0xa0f5('0x1b')]+'\x20'+parseOperator(_0x5232f7[_0xa0f5('0x11')]);}if(_['includes']([_0xa0f5('0x1d'),_0xa0f5('0x1e')],_0x5232f7[_0xa0f5('0x11')]))_0x168c2c['text']='('+_0x168c2c[_0xa0f5('0x1c')]+'\x20OR\x20'+_0x215a0d+'.'+_0x5232f7[_0xa0f5('0x1b')]+_0xa0f5('0x1f');_0x168c2c[_0xa0f5('0x13')]=parseValue(_0xb7acd8,_0x5232f7[_0xa0f5('0x11')],_0x5232f7[_0xa0f5('0x13')]);return _0x168c2c;};function parseOperator(_0x1570d4){var _0x5a3f1e;switch(_0x1570d4){case _0xa0f5('0x20'):_0x5a3f1e=_0xa0f5('0x21');break;case _0xa0f5('0x1e'):_0x5a3f1e=_0xa0f5('0x22');break;case _0xa0f5('0x23'):_0x5a3f1e=_0xa0f5('0x24');break;case'$ne':_0x5a3f1e='<>\x20?';break;case _0xa0f5('0x25'):case _0xa0f5('0x26'):case _0xa0f5('0x27'):_0x5a3f1e=_0xa0f5('0x28');break;case _0xa0f5('0x29'):_0x5a3f1e='<\x20?';break;case _0xa0f5('0x2a'):_0x5a3f1e=_0xa0f5('0x2b');break;case _0xa0f5('0x15'):_0x5a3f1e=_0xa0f5('0x2c');break;case _0xa0f5('0x2d'):_0x5a3f1e=_0xa0f5('0x2e');break;case'$between':_0x5a3f1e=_0xa0f5('0x2f');break;}return _0x5a3f1e;}function parseValue(_0x3603b7,_0xdc01ea,_0x6f92e4){var _0x4a4be2={'start':undefined,'end':undefined};switch(_0xdc01ea){case _0xa0f5('0x20'):case _0xa0f5('0x1e'):_0x4a4be2[_0xa0f5('0x30')]=_0x6f92e4[_0xa0f5('0x8')](',');break;case _0xa0f5('0x25'):_0x4a4be2[_0xa0f5('0x30')]='%'+_0x6f92e4+'%';break;case _0xa0f5('0x26'):_0x4a4be2[_0xa0f5('0x30')]=_0x6f92e4+'%';break;case _0xa0f5('0x27'):_0x4a4be2['start']='%'+_0x6f92e4;break;case _0xa0f5('0x12'):var _0x5785df=_0x6f92e4[_0xa0f5('0x8')](',');var _0x6f92e4=_0x5785df[_0xa0f5('0xa')]();var _0x2be5f2=_0x5785df['pop']();if(_0x3603b7===_0xa0f5('0x31')){_0x6f92e4=moment(_0x6f92e4)['utcOffset'](0x0,!![])[_0xa0f5('0x17')]();_0x2be5f2=moment(_0x2be5f2)[_0xa0f5('0x32')](0x0,!![])['add'](0x17,_0xa0f5('0x33'))['add'](0x3b,_0xa0f5('0x34'))['add'](0x3b,_0xa0f5('0x35'))[_0xa0f5('0x17')]();}_0x4a4be2={'start':_0x6f92e4,'end':_0x2be5f2};break;default:_0x4a4be2[_0xa0f5('0x30')]=_0x6f92e4;break;}return _0x4a4be2;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 967bbca..a0cecf4 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 _0x00db=['format','YYYY-MM-DD','utc','$lte','name','uniqueid','isArray','sort','indexOf','priority','col','unsigned','substr','cast','ASC','omit','length','isObject','isString','unset','hasOwnProperty','match','^[+]?[0-9]*$','getFullTextValue','push','join','query','$id','model','map','attributes','nolimit','limit','offset','order','where','filters','pick','filter','type','VIRTUAL','lower','merge','options','sequelize','moment','parse','keys','fields','split','isEmpty','forOwn','DATE','isPlainObject','$gte'];(function(_0x498a11,_0x4eb6a2){var _0x1e8248=function(_0x5ab39c){while(--_0x5ab39c){_0x498a11['push'](_0x498a11['shift']());}};_0x1e8248(++_0x4eb6a2);}(_0x00db,0x1e4));var _0xb00d=function(_0x11fc74,_0x4ccac0){_0x11fc74=_0x11fc74-0x0;var _0x51c324=_0x00db[_0x11fc74];return _0x51c324;};'use strict';var _=require('lodash');var sequelize=require(_0xb00d('0x0'));var moment=require(_0xb00d('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x40712f){var _0x44b479=['ne'];try{var _0x37a2bd=JSON[_0xb00d('0x2')](_0x40712f);var _0x38e3d3=Object['keys'](_0x37a2bd)[0x0];return _0x44b479['includes'](_0x38e3d3);}catch(_0x244894){return![];}}function getOperatorValue(_0xe4b670){var _0x2a90bb=JSON['parse'](_0xe4b670);var _0x2e51b8=Object[_0xb00d('0x3')](_0x2a90bb)[0x0];var _0x366f00=_0x2a90bb[_0x2e51b8];return{['$'+_0x2e51b8]:_0x366f00};}exports[_0xb00d('0x4')]=function(_0x203984){var _0x48c990=null;if(_0x203984){_0x48c990=_0x203984[_0xb00d('0x5')](',');}return _0x48c990;};exports['filters']=function(_0x8e5f73,_0x48f7de){var _0x523a9a={};if(!_[_0xb00d('0x6')](_0x8e5f73)){_[_0xb00d('0x7')](_0x8e5f73,function(_0x20e2cc,_0x416bc9){try{if(_0x48f7de){var _0x40fe72=_['find'](_0x48f7de,{'name':_0x416bc9})||{};if(hasSequelizeOperator(_0x20e2cc)){_0x523a9a[_0x416bc9]=getOperatorValue(_0x20e2cc);}else if(_0x40fe72['type']===_0xb00d('0x8')&&_[_0xb00d('0x9')](_0x20e2cc)){var _0x497961=JSON[_0xb00d('0x2')](_0x20e2cc);var _0x49f4e2={'$gte':moment(moment(_0x497961[_0xb00d('0xa')])[_0xb00d('0xb')](_0xb00d('0xc')))[_0xb00d('0xd')]()[_0xb00d('0xb')](),'$lte':moment(moment(_0x497961[_0xb00d('0xe')])[_0xb00d('0xb')]('YYYY-MM-DD'))[_0xb00d('0xd')]()['subtract'](0x1,'s')[_0xb00d('0xb')]()};_0x523a9a[_0x416bc9]=_0x49f4e2;}else if(_0x40fe72[_0xb00d('0xf')]===_0xb00d('0x10')){_0x523a9a[_0x416bc9]=_0x20e2cc;}else{_0x523a9a[_0x416bc9]=_[_0xb00d('0x11')](_0x20e2cc)?_0x20e2cc:JSON[_0xb00d('0x2')](_0x20e2cc);}}else{_0x523a9a[_0x416bc9]=_[_0xb00d('0x11')](_0x20e2cc)?_0x20e2cc:JSON[_0xb00d('0x2')](_0x20e2cc);}}catch(_0xef97bd){_0x523a9a[_0x416bc9]=_0x20e2cc[_0xb00d('0x5')](',');}});}return _0x523a9a;};exports['limit']=function(_0x592c15){_0x592c15=parseInt(_0x592c15,0xa);if(!_0x592c15||_0x592c15<0x0){_0x592c15=LIMIT_VALUE;}return _0x592c15;};exports['offset']=function(_0x3b9b67){_0x3b9b67=parseInt(_0x3b9b67,0xa);if(!_0x3b9b67||_0x3b9b67<0x0){_0x3b9b67=0x0;}return _0x3b9b67;};exports[_0xb00d('0x12')]=function(_0x3291bd){var _0x291d6f,_0x196e8d=null;if(_0x3291bd){_0x291d6f=_0x3291bd['split'](',');_0x196e8d=_['map'](_0x291d6f,function(_0x50d62d){if(_0x50d62d[_0xb00d('0x13')]('-')===0x0){return[_0x50d62d===_0xb00d('0x14')?sequelize['cast'](sequelize[_0xb00d('0x15')](_0xb00d('0x14')),_0xb00d('0x16')):_0x50d62d[_0xb00d('0x17')](0x1),'DESC'];}else{return[_0x50d62d===_0xb00d('0x14')?sequelize[_0xb00d('0x18')](sequelize['col'](_0xb00d('0x14')),_0xb00d('0x16')):_0x50d62d,_0xb00d('0x19')];}});}return _0x196e8d;};exports[_0xb00d('0x1a')]=function(_0x504c60,_0x339c36){if(_[_0xb00d('0x6')](_0x504c60)){return _0x504c60;}if(_[_0xb00d('0x11')](_0x504c60)){for(var _0x14f42f=0x0;_0x14f42f<_0x504c60[_0xb00d('0x1b')];_0x14f42f+=0x1){_0x504c60[_0x14f42f]=this[_0xb00d('0x1a')](_0x504c60[_0x14f42f],_0x339c36);}return _0x504c60;}if(!_[_0xb00d('0x1c')](_0x504c60)){return _0x504c60;}if(_[_0xb00d('0x1d')](_0x339c36)){_0x339c36=[_0x339c36];}if(!_[_0xb00d('0x11')](_0x339c36)){return _0x504c60;}for(var _0x30e8c5=0x0;_0x30e8c5<_0x339c36[_0xb00d('0x1b')];_0x30e8c5+=0x1){_[_0xb00d('0x1e')](_0x504c60,_0x339c36[_0x30e8c5]);}for(var _0x4e237c in _0x504c60){if(_0x504c60[_0xb00d('0x1f')](_0x4e237c)){_0x504c60[_0x4e237c]=this[_0xb00d('0x1a')](_0x504c60[_0x4e237c],_0x339c36);}}return _0x504c60;};exports['isNumeric']=function(_0x25ec0f){return _0x25ec0f[_0xb00d('0x20')](RegExp(_0xb00d('0x21')))?!![]:![];};exports['isEmail']=function(_0x2c7dfa){return _0x2c7dfa[_0xb00d('0x20')](/^\S+@\S+$/)?!![]:![];};exports[_0xb00d('0x22')]=function(_0x463b8a){var _0x5dee07=[];_0x463b8a['split'](/[ ,]+/)['forEach'](function(_0x32ae7a){_0x32ae7a=_0x32ae7a['replace'](/([^:]")"+/g,'$1');_0x32ae7a='+'+_0x32ae7a+'*';if(_0x32ae7a['includes']('@'))_0x32ae7a='\x22'+_0x32ae7a+'\x22';_0x5dee07[_0xb00d('0x23')](_0x32ae7a);});return _0x5dee07[_0xb00d('0x24')]('\x20');};exports['getOptions']=function(_0x89184e,_0x47ac41,_0x1ff911){var _0x35d7a0={},_0x2d984a={};if(_0x47ac41[_0xb00d('0x25')][_0xb00d('0x26')]){_0x47ac41['query']['id']=_0x47ac41['query'][_0xb00d('0x26')];delete _0x47ac41[_0xb00d('0x25')][_0xb00d('0x26')];}_0x35d7a0[_0xb00d('0x27')]=_[_0xb00d('0x28')](_0x89184e,_0xb00d('0xf'));_0x35d7a0[_0xb00d('0x25')]=_[_0xb00d('0x3')](_0x47ac41[_0xb00d('0x25')]);_0x35d7a0['filters']=_['intersection'](_0x35d7a0[_0xb00d('0x27')],_0x35d7a0[_0xb00d('0x25')]);_0x2d984a['attributes']=_['intersection'](_0x35d7a0[_0xb00d('0x27')],this[_0xb00d('0x4')](_0x47ac41[_0xb00d('0x25')]['fields']));_0x2d984a[_0xb00d('0x29')]=_0x2d984a['attributes'][_0xb00d('0x1b')]?_0x2d984a[_0xb00d('0x29')]:_0x35d7a0[_0xb00d('0x27')];if(!_0x47ac41[_0xb00d('0x25')][_0xb00d('0x1f')](_0xb00d('0x2a'))){_0x2d984a[_0xb00d('0x2b')]=this['limit'](_0x47ac41[_0xb00d('0x25')][_0xb00d('0x2b')]);_0x2d984a[_0xb00d('0x2c')]=this[_0xb00d('0x2c')](_0x47ac41[_0xb00d('0x25')][_0xb00d('0x2c')]);}_0x2d984a[_0xb00d('0x2d')]=this['sort'](_0x47ac41[_0xb00d('0x25')]['sort']);_0x2d984a[_0xb00d('0x2e')]=this[_0xb00d('0x2f')](_[_0xb00d('0x30')](_0x47ac41[_0xb00d('0x25')],_0x35d7a0[_0xb00d('0x2f')]),_0x89184e);if(_0x47ac41['query'][_0xb00d('0x31')]){_0x2d984a[_0xb00d('0x2e')]=_['merge'](_0x2d984a['where'],{'$or':_[_0xb00d('0x28')](_0x89184e,function(_0x24a6ad){if(_0x24a6ad[_0xb00d('0x32')]!==_0xb00d('0x33')){if(_0x1ff911){return sequelize['where'](sequelize['fn'](_0xb00d('0x34'),sequelize['col'](_0x24a6ad['name'])),{'$like':sequelize['fn'](_0xb00d('0x34'),'%'+_0x47ac41[_0xb00d('0x25')][_0xb00d('0x31')]+'%')});}else{var _0x1e02ad={};_0x1e02ad[_0x24a6ad[_0xb00d('0xf')]]={'$like':'%'+_0x47ac41[_0xb00d('0x25')]['filter']+'%'};return _0x1e02ad;}}})});}_0x2d984a=_[_0xb00d('0x35')]({},_0x2d984a,_0x47ac41[_0xb00d('0x36')]);return _0x2d984a;}; \ No newline at end of file +var _0x377c=['offset','sort','pick','filter','where','VIRTUAL','lower','options','lodash','sequelize','moment','keys','includes','parse','isEmpty','forOwn','find','type','DATE','isPlainObject','YYYY-MM-DD','utc','$lte','name','isArray','split','map','indexOf','priority','cast','col','unsigned','substr','DESC','ASC','omit','length','isObject','isString','unset','isNumeric','match','^[+]?[0-9]*$','getFullTextValue','push','join','getOptions','query','$id','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x377c,0x7a));var _0xc377=function(_0x1c8727,_0x45a343){_0x1c8727=_0x1c8727-0x0;var _0x58c264=_0x377c[_0x1c8727];return _0x58c264;};'use strict';var _=require(_0xc377('0x0'));var sequelize=require(_0xc377('0x1'));var moment=require(_0xc377('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x2e89f8){var _0x21dcb4=['ne'];try{var _0x114a7f=JSON['parse'](_0x2e89f8);var _0x512b0f=Object[_0xc377('0x3')](_0x114a7f)[0x0];return _0x21dcb4[_0xc377('0x4')](_0x512b0f);}catch(_0x40db95){return![];}}function getOperatorValue(_0x4698a9){var _0x21c7be=JSON[_0xc377('0x5')](_0x4698a9);var _0x3aa11c=Object[_0xc377('0x3')](_0x21c7be)[0x0];var _0x3ac3fb=_0x21c7be[_0x3aa11c];return{['$'+_0x3aa11c]:_0x3ac3fb};}exports['fields']=function(_0xb42343){var _0x1f6153=null;if(_0xb42343){_0x1f6153=_0xb42343['split'](',');}return _0x1f6153;};exports['filters']=function(_0x5db2c5,_0x20fc8f){var _0x14c711={};if(!_[_0xc377('0x6')](_0x5db2c5)){_[_0xc377('0x7')](_0x5db2c5,function(_0x9e4274,_0x74f46c){try{if(_0x20fc8f){var _0x160c9c=_[_0xc377('0x8')](_0x20fc8f,{'name':_0x74f46c})||{};if(hasSequelizeOperator(_0x9e4274)){_0x14c711[_0x74f46c]=getOperatorValue(_0x9e4274);}else if(_0x160c9c[_0xc377('0x9')]===_0xc377('0xa')&&_[_0xc377('0xb')](_0x9e4274)){var _0x21cd12=JSON['parse'](_0x9e4274);var _0x4c2691={'$gte':moment(moment(_0x21cd12['$gte'])['format'](_0xc377('0xc')))[_0xc377('0xd')]()['format'](),'$lte':moment(moment(_0x21cd12[_0xc377('0xe')])['format']('YYYY-MM-DD'))[_0xc377('0xd')]()['subtract'](0x1,'s')['format']()};_0x14c711[_0x74f46c]=_0x4c2691;}else if(_0x160c9c[_0xc377('0xf')]==='uniqueid'){_0x14c711[_0x74f46c]=_0x9e4274;}else{_0x14c711[_0x74f46c]=_['isArray'](_0x9e4274)?_0x9e4274:JSON[_0xc377('0x5')](_0x9e4274);}}else{_0x14c711[_0x74f46c]=_[_0xc377('0x10')](_0x9e4274)?_0x9e4274:JSON[_0xc377('0x5')](_0x9e4274);}}catch(_0x1e639d){_0x14c711[_0x74f46c]=_0x9e4274[_0xc377('0x11')](',');}});}return _0x14c711;};exports['limit']=function(_0x19047f){_0x19047f=parseInt(_0x19047f,0xa);if(!_0x19047f||_0x19047f<0x0){_0x19047f=LIMIT_VALUE;}return _0x19047f;};exports['offset']=function(_0x55c919){_0x55c919=parseInt(_0x55c919,0xa);if(!_0x55c919||_0x55c919<0x0){_0x55c919=0x0;}return _0x55c919;};exports['sort']=function(_0x5b32ba){var _0xe60435,_0x2f4721=null;if(_0x5b32ba){_0xe60435=_0x5b32ba['split'](',');_0x2f4721=_[_0xc377('0x12')](_0xe60435,function(_0xc7d9ad){if(_0xc7d9ad[_0xc377('0x13')]('-')===0x0){return[_0xc7d9ad===_0xc377('0x14')?sequelize[_0xc377('0x15')](sequelize[_0xc377('0x16')](_0xc377('0x14')),_0xc377('0x17')):_0xc7d9ad[_0xc377('0x18')](0x1),_0xc377('0x19')];}else{return[_0xc7d9ad==='priority'?sequelize[_0xc377('0x15')](sequelize['col'](_0xc377('0x14')),_0xc377('0x17')):_0xc7d9ad,_0xc377('0x1a')];}});}return _0x2f4721;};exports[_0xc377('0x1b')]=function(_0x2ecb32,_0xff2bc5){if(_[_0xc377('0x6')](_0x2ecb32)){return _0x2ecb32;}if(_['isArray'](_0x2ecb32)){for(var _0x10970f=0x0;_0x10970f<_0x2ecb32[_0xc377('0x1c')];_0x10970f+=0x1){_0x2ecb32[_0x10970f]=this[_0xc377('0x1b')](_0x2ecb32[_0x10970f],_0xff2bc5);}return _0x2ecb32;}if(!_[_0xc377('0x1d')](_0x2ecb32)){return _0x2ecb32;}if(_[_0xc377('0x1e')](_0xff2bc5)){_0xff2bc5=[_0xff2bc5];}if(!_[_0xc377('0x10')](_0xff2bc5)){return _0x2ecb32;}for(var _0x3f4038=0x0;_0x3f4038<_0xff2bc5[_0xc377('0x1c')];_0x3f4038+=0x1){_[_0xc377('0x1f')](_0x2ecb32,_0xff2bc5[_0x3f4038]);}for(var _0x57fdc4 in _0x2ecb32){if(_0x2ecb32['hasOwnProperty'](_0x57fdc4)){_0x2ecb32[_0x57fdc4]=this[_0xc377('0x1b')](_0x2ecb32[_0x57fdc4],_0xff2bc5);}}return _0x2ecb32;};exports[_0xc377('0x20')]=function(_0x2cf3b9){return _0x2cf3b9[_0xc377('0x21')](RegExp(_0xc377('0x22')))?!![]:![];};exports['isEmail']=function(_0xe50433){return _0xe50433[_0xc377('0x21')](/^\S+@\S+$/)?!![]:![];};exports[_0xc377('0x23')]=function(_0xaf03da){var _0x31a6e0=[];_0xaf03da[_0xc377('0x11')](/[ ,]+/)['forEach'](function(_0x3c29ea){_0x3c29ea=_0x3c29ea['replace'](/([^:]")"+/g,'$1');_0x3c29ea='+'+_0x3c29ea+'*';if(_0x3c29ea[_0xc377('0x4')]('@'))_0x3c29ea='\x22'+_0x3c29ea+'\x22';_0x31a6e0[_0xc377('0x24')](_0x3c29ea);});return _0x31a6e0[_0xc377('0x25')]('\x20');};exports[_0xc377('0x26')]=function(_0x5e3c7d,_0x2cc1ff,_0x3adbd6){var _0x35d56={},_0x5da34b={};if(_0x2cc1ff[_0xc377('0x27')]['$id']){_0x2cc1ff[_0xc377('0x27')]['id']=_0x2cc1ff[_0xc377('0x27')][_0xc377('0x28')];delete _0x2cc1ff[_0xc377('0x27')][_0xc377('0x28')];}_0x35d56['model']=_['map'](_0x5e3c7d,_0xc377('0xf'));_0x35d56[_0xc377('0x27')]=_['keys'](_0x2cc1ff[_0xc377('0x27')]);_0x35d56[_0xc377('0x29')]=_[_0xc377('0x2a')](_0x35d56[_0xc377('0x2b')],_0x35d56['query']);_0x5da34b[_0xc377('0x2c')]=_[_0xc377('0x2a')](_0x35d56[_0xc377('0x2b')],this[_0xc377('0x2d')](_0x2cc1ff['query'][_0xc377('0x2d')]));_0x5da34b[_0xc377('0x2c')]=_0x5da34b['attributes'][_0xc377('0x1c')]?_0x5da34b[_0xc377('0x2c')]:_0x35d56[_0xc377('0x2b')];if(!_0x2cc1ff['query'][_0xc377('0x2e')](_0xc377('0x2f'))){_0x5da34b[_0xc377('0x30')]=this[_0xc377('0x30')](_0x2cc1ff['query'][_0xc377('0x30')]);_0x5da34b[_0xc377('0x31')]=this[_0xc377('0x31')](_0x2cc1ff[_0xc377('0x27')][_0xc377('0x31')]);}_0x5da34b['order']=this[_0xc377('0x32')](_0x2cc1ff[_0xc377('0x27')][_0xc377('0x32')]);_0x5da34b['where']=this[_0xc377('0x29')](_[_0xc377('0x33')](_0x2cc1ff['query'],_0x35d56[_0xc377('0x29')]),_0x5e3c7d);if(_0x2cc1ff[_0xc377('0x27')][_0xc377('0x34')]){_0x5da34b[_0xc377('0x35')]=_['merge'](_0x5da34b[_0xc377('0x35')],{'$or':_['map'](_0x5e3c7d,function(_0x8d5625){if(_0x8d5625[_0xc377('0x9')]!==_0xc377('0x36')){if(_0x3adbd6){return sequelize[_0xc377('0x35')](sequelize['fn'](_0xc377('0x37'),sequelize[_0xc377('0x16')](_0x8d5625[_0xc377('0xf')])),{'$like':sequelize['fn'](_0xc377('0x37'),'%'+_0x2cc1ff['query'][_0xc377('0x34')]+'%')});}else{var _0x435f86={};_0x435f86[_0x8d5625[_0xc377('0xf')]]={'$like':'%'+_0x2cc1ff['query'][_0xc377('0x34')]+'%'};return _0x435f86;}}})});}_0x5da34b=_['merge']({},_0x5da34b,_0x2cc1ff[_0xc377('0x38')]);return _0x5da34b;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 661b8d4..83e6c2a 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xba2c=['public','development','test','set','use','toISOString','views','/server/views','html','renderFile','urlencoded','50mb','initialize','serve-favicon','body-parser','method-override','cookie-parser','passport','cors','moment','default','get','env','appPath','join','root'];(function(_0x4d337e,_0x2f7eed){var _0x247963=function(_0x3d6564){while(--_0x3d6564){_0x4d337e['push'](_0x4d337e['shift']());}};_0x247963(++_0x2f7eed);}(_0xba2c,0x1c7));var _0xcba2=function(_0x28b6c7,_0x2e9e33){_0x28b6c7=_0x28b6c7-0x0;var _0x55776d=_0xba2c[_0x28b6c7];return _0x55776d;};'use strict';var express=require('express');var favicon=require(_0xcba2('0x0'));var bodyParser=require(_0xcba2('0x1'));var methodOverride=require(_0xcba2('0x2'));var cookieParser=require(_0xcba2('0x3'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0xcba2('0x4'));var cors=require(_0xcba2('0x5'));var moment=require(_0xcba2('0x6'));var config=require('./environment');var db=require('../mysqldb')['db'];exports[_0xcba2('0x7')]=function(_0x452387){var _0x1f54c5=_0x452387[_0xcba2('0x8')](_0xcba2('0x9'));if(_0x1f54c5==='production'){_0x452387['set'](_0xcba2('0xa'),path[_0xcba2('0xb')](config[_0xcba2('0xc')],_0xcba2('0xd')));}if(_0x1f54c5===_0xcba2('0xe')||_0x1f54c5===_0xcba2('0xf')){_0x452387[_0xcba2('0x10')](_0xcba2('0xa'),path[_0xcba2('0xb')](config[_0xcba2('0xc')],'client'));_0x452387[_0xcba2('0x11')](errorHandler());}_0x452387[_0xcba2('0x10')]('json\x20replacer',function(_0x17238a,_0x801ab5){if(this[_0x17238a]instanceof Date){_0x801ab5=this[_0x17238a][_0xcba2('0x12')]()['split']('.')[0x0]+'Z';}return _0x801ab5;});_0x452387[_0xcba2('0x11')](express['static'](_0x452387['get'](_0xcba2('0xa'))));_0x452387['set'](_0xcba2('0x13'),config[_0xcba2('0xc')]+_0xcba2('0x14'));_0x452387['engine'](_0xcba2('0x15'),require('ejs')[_0xcba2('0x16')]);_0x452387[_0xcba2('0x10')]('view\x20engine',_0xcba2('0x15'));_0x452387[_0xcba2('0x11')](bodyParser[_0xcba2('0x17')]({'limit':_0xcba2('0x18'),'extended':!![]}));_0x452387[_0xcba2('0x11')](bodyParser['json']({'limit':_0xcba2('0x18')}));_0x452387[_0xcba2('0x11')](cors());_0x452387['use'](methodOverride());_0x452387['use'](cookieParser());_0x452387[_0xcba2('0x11')](passport[_0xcba2('0x19')]());}; \ No newline at end of file +var _0x5960=['../mysqldb','default','get','env','set','appPath','join','root','public','development','client','use','json\x20replacer','toISOString','split','static','views','html','ejs','view\x20engine','urlencoded','50mb','json','serve-favicon','body-parser','cookie-parser','errorhandler','path','passport','moment','./environment'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x5960,0xf0));var _0x0596=function(_0x1e6bdc,_0x186895){_0x1e6bdc=_0x1e6bdc-0x0;var _0x53163a=_0x5960[_0x1e6bdc];return _0x53163a;};'use strict';var express=require('express');var favicon=require(_0x0596('0x0'));var bodyParser=require(_0x0596('0x1'));var methodOverride=require('method-override');var cookieParser=require(_0x0596('0x2'));var errorHandler=require(_0x0596('0x3'));var path=require(_0x0596('0x4'));var passport=require(_0x0596('0x5'));var cors=require('cors');var moment=require(_0x0596('0x6'));var config=require(_0x0596('0x7'));var db=require(_0x0596('0x8'))['db'];exports[_0x0596('0x9')]=function(_0x37527e){var _0x431eb4=_0x37527e[_0x0596('0xa')](_0x0596('0xb'));if(_0x431eb4==='production'){_0x37527e[_0x0596('0xc')](_0x0596('0xd'),path[_0x0596('0xe')](config[_0x0596('0xf')],_0x0596('0x10')));}if(_0x431eb4===_0x0596('0x11')||_0x431eb4==='test'){_0x37527e['set'](_0x0596('0xd'),path[_0x0596('0xe')](config[_0x0596('0xf')],_0x0596('0x12')));_0x37527e[_0x0596('0x13')](errorHandler());}_0x37527e[_0x0596('0xc')](_0x0596('0x14'),function(_0x3d2b8f,_0xedb808){if(this[_0x3d2b8f]instanceof Date){_0xedb808=this[_0x3d2b8f][_0x0596('0x15')]()[_0x0596('0x16')]('.')[0x0]+'Z';}return _0xedb808;});_0x37527e['use'](express[_0x0596('0x17')](_0x37527e['get'](_0x0596('0xd'))));_0x37527e[_0x0596('0xc')](_0x0596('0x18'),config['root']+'/server/views');_0x37527e['engine'](_0x0596('0x19'),require(_0x0596('0x1a'))['renderFile']);_0x37527e[_0x0596('0xc')](_0x0596('0x1b'),_0x0596('0x19'));_0x37527e['use'](bodyParser[_0x0596('0x1c')]({'limit':_0x0596('0x1d'),'extended':!![]}));_0x37527e[_0x0596('0x13')](bodyParser[_0x0596('0x1e')]({'limit':_0x0596('0x1d')}));_0x37527e[_0x0596('0x13')](cors());_0x37527e[_0x0596('0x13')](methodOverride());_0x37527e[_0x0596('0x13')](cookieParser());_0x37527e[_0x0596('0x13')](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 15a857e..79c5d8c 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 _0xdf86=['getFirstInterface','map','model','join','createHash','digest','getUuid','platform','licenseToken','dmidecode\x20--string\x20system-uuid','utf8','replace','macAddress','ipAddress','md5','update','hex','substring','bimedia-machine-uuid','child_process','../environment','networkInterfaces','keys','filter','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1'];(function(_0x1883a0,_0x1e3536){var _0x5adff4=function(_0x3d644a){while(--_0x3d644a){_0x1883a0['push'](_0x1883a0['shift']());}};_0x5adff4(++_0x1e3536);}(_0xdf86,0x1b2));var _0x6df8=function(_0x2534cf,_0x545be6){_0x2534cf=_0x2534cf-0x0;var _0x221461=_0xdf86[_0x2534cf];return _0x221461;};'use strict';var _=require('lodash');var os=require('os');var crypto=require('crypto');var machine=require(_0x6df8('0x0'));var exec=require(_0x6df8('0x1'))['execSync'];var config=require(_0x6df8('0x2'));function getInterfaces(){var _0x13c3c9=[];var _0x40340e=os[_0x6df8('0x3')]();var _0x505720=_['orderBy'](_[_0x6df8('0x4')](_0x40340e));for(var _0x168421=0x0;_0x168421<_0x505720['length'];_0x168421++){var _0x1c9024=_0x40340e[_0x505720[_0x168421]][_0x6df8('0x5')](function(_0x37bc4f){return _0x37bc4f['family']===_0x6df8('0x6')&&_0x37bc4f[_0x6df8('0x7')]===![];});_0x13c3c9=_0x13c3c9[_0x6df8('0x8')](_0x1c9024);}return _0x13c3c9;}function getFirstInterface(){var _0x352870=_[_0x6df8('0x9')](getInterfaces());return{'macAddress':_0x352870&&_0x352870[_0x6df8('0xa')]?_0x352870['mac']:_0x6df8('0xb'),'ipAddress':_0x352870&&_0x352870[_0x6df8('0xc')]?_0x352870[_0x6df8('0xc')]:_0x6df8('0xd')};}exports[_0x6df8('0xe')]=getFirstInterface;function getCPUhash(){var _0x526d0c=_['orderBy'](os['cpus']()[_0x6df8('0xf')](function(_0x5bd906){return _0x5bd906[_0x6df8('0x10')];}))[_0x6df8('0x11')](':');return crypto[_0x6df8('0x12')]('md5')['update'](_0x526d0c)[_0x6df8('0x13')]('hex');}exports[_0x6df8('0x14')]=function(){var _0xe9d798=os[_0x6df8('0x15')]();var _0x25fd70=/[0-9a-f-]{36}/;if(config[_0x6df8('0x16')]&&_0x25fd70['test'](config[_0x6df8('0x16')])){return config['licenseToken'];}else if(_0xe9d798==='win32'){return exec(_0x6df8('0x17'),{'encoding':_0x6df8('0x18')})[_0x6df8('0x19')]('\x0d\x0a','');}else{var _0x53b41a=getFirstInterface();var _0x4fde9f=getCPUhash();var _0x126f47=_0x4fde9f+'|'+os['hostname']()+'|'+_0x53b41a[_0x6df8('0x1a')]+'|'+_0x53b41a[_0x6df8('0x1b')];var _0x44c127=crypto[_0x6df8('0x12')](_0x6df8('0x1c'))[_0x6df8('0x1d')](_0x126f47)[_0x6df8('0x13')](_0x6df8('0x1e'));return _0x44c127[_0x6df8('0x1f')](0x0,0x8)+'-'+_0x44c127[_0x6df8('0x1f')](0x8,0xc)+'-'+_0x44c127[_0x6df8('0x1f')](0xc,0x10)+'-'+_0x44c127[_0x6df8('0x1f')](0x10,0x14)+'-'+_0x44c127[_0x6df8('0x1f')](0x14);}}; \ No newline at end of file +var _0x0faa=['substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','networkInterfaces','orderBy','filter','family','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','map','model','join','createHash','md5','update','digest','hex','getUuid','platform','licenseToken','test','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0x0faa,0xb5));var _0xa0fa=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x0faa[_0x5f1391];return _0x50ebe3;};'use strict';var _=require(_0xa0fa('0x0'));var os=require('os');var crypto=require(_0xa0fa('0x1'));var machine=require(_0xa0fa('0x2'));var exec=require(_0xa0fa('0x3'))[_0xa0fa('0x4')];var config=require('../environment');function getInterfaces(){var _0x2f12df=[];var _0x133bbc=os[_0xa0fa('0x5')]();var _0x2b1b7b=_[_0xa0fa('0x6')](_['keys'](_0x133bbc));for(var _0x53fe62=0x0;_0x53fe62<_0x2b1b7b['length'];_0x53fe62++){var _0x176c3c=_0x133bbc[_0x2b1b7b[_0x53fe62]][_0xa0fa('0x7')](function(_0x5d78b5){return _0x5d78b5[_0xa0fa('0x8')]==='IPv4'&&_0x5d78b5[_0xa0fa('0x9')]===![];});_0x2f12df=_0x2f12df[_0xa0fa('0xa')](_0x176c3c);}return _0x2f12df;}function getFirstInterface(){var _0x54240a=_[_0xa0fa('0xb')](getInterfaces());return{'macAddress':_0x54240a&&_0x54240a[_0xa0fa('0xc')]?_0x54240a['mac']:_0xa0fa('0xd'),'ipAddress':_0x54240a&&_0x54240a['address']?_0x54240a[_0xa0fa('0xe')]:_0xa0fa('0xf')};}exports[_0xa0fa('0x10')]=getFirstInterface;function getCPUhash(){var _0x3757b7=_[_0xa0fa('0x6')](os['cpus']()[_0xa0fa('0x11')](function(_0x197588){return _0x197588[_0xa0fa('0x12')];}))[_0xa0fa('0x13')](':');return crypto[_0xa0fa('0x14')](_0xa0fa('0x15'))[_0xa0fa('0x16')](_0x3757b7)[_0xa0fa('0x17')](_0xa0fa('0x18'));}exports[_0xa0fa('0x19')]=function(){var _0x2deb6d=os[_0xa0fa('0x1a')]();var _0x179b60=/[0-9a-f-]{36}/;if(config[_0xa0fa('0x1b')]&&_0x179b60[_0xa0fa('0x1c')](config[_0xa0fa('0x1b')])){return config[_0xa0fa('0x1b')];}else if(_0x2deb6d==='win32'){return exec(_0xa0fa('0x1d'),{'encoding':_0xa0fa('0x1e')})[_0xa0fa('0x1f')]('\x0d\x0a','');}else{var _0x52d22d=getFirstInterface();var _0x2230ee=getCPUhash();var _0x4369cc=_0x2230ee+'|'+os[_0xa0fa('0x20')]()+'|'+_0x52d22d[_0xa0fa('0x21')]+'|'+_0x52d22d[_0xa0fa('0x22')];var _0x807350=crypto[_0xa0fa('0x14')](_0xa0fa('0x15'))[_0xa0fa('0x16')](_0x4369cc)[_0xa0fa('0x17')]('hex');return _0x807350[_0xa0fa('0x23')](0x0,0x8)+'-'+_0x807350[_0xa0fa('0x23')](0x8,0xc)+'-'+_0x807350[_0xa0fa('0x23')](0xc,0x10)+'-'+_0x807350[_0xa0fa('0x23')](0x10,0x14)+'-'+_0x807350[_0xa0fa('0x23')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 7e9235c..df6ea54 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 _0xedae=['finally','getUuid','License','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','message','default','util','moment','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','data2','data1','active','license','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','Disabled','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','toUpperCase','encryptString','YYYY-MM-DD\x20HH:mm','diff','decryptString','DEMO\x20START\x20AT\x20%s','update','error'];(function(_0x193666,_0x5dc370){var _0x36e01a=function(_0x5f32e4){while(--_0x5f32e4){_0x193666['push'](_0x193666['shift']());}};_0x36e01a(++_0x5dc370);}(_0xedae,0xfd));var _0xeeda=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xedae[_0x5b78e8];return _0xf2c321;};'use strict';var util=require(_0xeeda('0x0'));var moment=require(_0xeeda('0x1'));var rp=require('request-promise');var BPromise=require('bluebird');var pkginfo=require(_0xeeda('0x2'))(module,_0xeeda('0x3'));var db=require(_0xeeda('0x4'))['db'];var encryptor=require(_0xeeda('0x5'));var hardware=require(_0xeeda('0x6'));var logger=require(_0xeeda('0x7'))('license');var HOST=_0xeeda('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x49edd4){return new BPromise(function(_0x4c277b,_0x3c488e){var _0x4a1a12=util[_0xeeda('0x9')](_0xeeda('0xa'),HOST,_0x49edd4,module[_0xeeda('0xb')][_0xeeda('0x3')]);if(oldToken){_0x4a1a12=util[_0xeeda('0x9')](_0xeeda('0xc'),HOST,_0x49edd4,module[_0xeeda('0xb')]['version'],oldToken);}var _0x4fd0fa={'uri':_0x4a1a12,'method':_0xeeda('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x4fd0fa)[_0xeeda('0xe')](function(_0x3eccc3){_0x4c277b(_0x3eccc3);})[_0xeeda('0xf')](function(_0x39b11e){_0x3c488e(_0x39b11e);});});}function manageLicense(_0x384b6f,_0x3486eb){var _0x567218=_0x3486eb['get']({'plain':!![]});if(!isOldTokenSent&&_0x567218['data1']!==_0x384b6f&&!_0x567218[_0xeeda('0x10')]){oldToken=_0x567218[_0xeeda('0x11')];}httpRequest(_0x384b6f)[_0xeeda('0xe')](function(_0x4cb173){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x4cb173[_0xeeda('0x12')]){isOldTokenSent=![];if(!_0x567218[_0xeeda('0x13')]&&_0x567218[_0xeeda('0x13')]!=_0x4cb173[_0xeeda('0x13')]||_0x567218[_0xeeda('0x13')]&&_0x567218[_0xeeda('0x10')]){logger[_0xeeda('0x14')](_0xeeda('0x15'));}if(_0x567218[_0xeeda('0x13')]&&!_0x567218['data2']&&_0x567218[_0xeeda('0x13')]!=_0x4cb173[_0xeeda('0x13')]){logger[_0xeeda('0x14')](_0xeeda('0x16'));}if(_0x567218['license']&&!_0x567218[_0xeeda('0x10')]&&_0x567218[_0xeeda('0x13')]==_0x4cb173['license']){return _0x3486eb;}return _0x3486eb['update']({'data1':_0x384b6f,'data2':null,'license':_0x4cb173[_0xeeda('0x13')]});}else{if(_0x4cb173[_0xeeda('0x13')]||_0x567218[_0xeeda('0x13')]){if(!_0x567218[_0xeeda('0x10')]){if(_0x567218[_0xeeda('0x11')]==_0x384b6f){GRAY_PERIOD_REASON=_0xeeda('0x17');logger[_0xeeda('0x14')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0xeeda('0x18');logger[_0xeeda('0x14')](_0xeeda('0x19'),_0x567218[_0xeeda('0x11')],_0x384b6f);}logger[_0xeeda('0x14')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0xeeda('0x1a')](),moment()['format']('YYYY-MM-DD\x20HH:mm'));return _0x3486eb['update']({'data2':encryptor[_0xeeda('0x1b')](moment()['format'](_0xeeda('0x1c')))});}else{if(moment()[_0xeeda('0x1d')](encryptor[_0xeeda('0x1e')](_0x567218[_0xeeda('0x10')]),'days')>DAYS){logger['info'](_0xeeda('0x1f'),moment()[_0xeeda('0x9')](_0xeeda('0x1c')));isOldTokenSent=![];return _0x3486eb[_0xeeda('0x20')]({'data1':_0x384b6f,'data2':null,'license':null});}}}else{if(_0x567218[_0xeeda('0x11')]!=_0x384b6f){logger[_0xeeda('0x14')](_0xeeda('0x19'),_0x567218[_0xeeda('0x11')],_0x384b6f);return _0x3486eb[_0xeeda('0x20')]({'data1':_0x384b6f,'data2':null,'license':null});}}}return _0x3486eb;})[_0xeeda('0xe')](function(_0x302c97){_0x3486eb=_0x302c97;})[_0xeeda('0xf')](function(_0x3d6f57){logger[_0xeeda('0x21')](_0x3d6f57['message']);})[_0xeeda('0x22')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x3486eb);},TIME);});}function defaultLicense(){var _0x1051aa=hardware[_0xeeda('0x23')]();if(_0x1051aa){return db[_0xeeda('0x24')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x1051aa}})[_0xeeda('0x25')](function(_0x3fa0f7,_0x467908){logger[_0xeeda('0x14')](_0xeeda('0x26'),_0x1051aa);manageLicense(_0x1051aa,_0x3fa0f7);})['catch'](function(_0x2383e5){logger[_0xeeda('0x21')](_0x2383e5[_0xeeda('0x27')]);});}}exports[_0xeeda('0x28')]=defaultLicense; \ No newline at end of file +var _0x903e=['DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','util','moment','request-promise','bluebird','pkginfo','version','../../components/encryptor','../logger','license','format','%s/api/servers/%s/check?version=%s','exports','GET','then','catch','data1','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','Disabled','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','update','encryptString','diff','decryptString'];(function(_0x5f46ee,_0x550dbb){var _0x5f3804=function(_0x1fcd12){while(--_0x1fcd12){_0x5f46ee['push'](_0x5f46ee['shift']());}};_0x5f3804(++_0x550dbb);}(_0x903e,0x7e));var _0xe903=function(_0x2cc8bb,_0x5f2607){_0x2cc8bb=_0x2cc8bb-0x0;var _0x140e40=_0x903e[_0x2cc8bb];return _0x140e40;};'use strict';var util=require(_0xe903('0x0'));var moment=require(_0xe903('0x1'));var rp=require(_0xe903('0x2'));var BPromise=require(_0xe903('0x3'));var pkginfo=require(_0xe903('0x4'))(module,_0xe903('0x5'));var db=require('../../mysqldb')['db'];var encryptor=require(_0xe903('0x6'));var hardware=require('./hardware');var logger=require(_0xe903('0x7'))(_0xe903('0x8'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x8d057d){return new BPromise(function(_0x2fffd9,_0xdaf973){var _0x281039=util[_0xe903('0x9')](_0xe903('0xa'),HOST,_0x8d057d,module['exports'][_0xe903('0x5')]);if(oldToken){_0x281039=util['format']('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x8d057d,module[_0xe903('0xb')][_0xe903('0x5')],oldToken);}var _0x21a06d={'uri':_0x281039,'method':_0xe903('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x21a06d)[_0xe903('0xd')](function(_0x3d6327){_0x2fffd9(_0x3d6327);})[_0xe903('0xe')](function(_0x9ebf){_0xdaf973(_0x9ebf);});});}function manageLicense(_0x55d875,_0x310403){var _0x13333f=_0x310403['get']({'plain':!![]});if(!isOldTokenSent&&_0x13333f[_0xe903('0xf')]!==_0x55d875&&!_0x13333f['data2']){oldToken=_0x13333f['data1'];}httpRequest(_0x55d875)['then'](function(_0x23b42e){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x23b42e[_0xe903('0x10')]){isOldTokenSent=![];if(!_0x13333f['license']&&_0x13333f[_0xe903('0x8')]!=_0x23b42e['license']||_0x13333f[_0xe903('0x8')]&&_0x13333f[_0xe903('0x11')]){logger[_0xe903('0x12')](_0xe903('0x13'));}if(_0x13333f[_0xe903('0x8')]&&!_0x13333f[_0xe903('0x11')]&&_0x13333f[_0xe903('0x8')]!=_0x23b42e[_0xe903('0x8')]){logger[_0xe903('0x12')](_0xe903('0x14'));}if(_0x13333f[_0xe903('0x8')]&&!_0x13333f[_0xe903('0x11')]&&_0x13333f[_0xe903('0x8')]==_0x23b42e[_0xe903('0x8')]){return _0x310403;}return _0x310403['update']({'data1':_0x55d875,'data2':null,'license':_0x23b42e['license']});}else{if(_0x23b42e[_0xe903('0x8')]||_0x13333f[_0xe903('0x8')]){if(!_0x13333f[_0xe903('0x11')]){if(_0x13333f['data1']==_0x55d875){GRAY_PERIOD_REASON=_0xe903('0x15');logger[_0xe903('0x12')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0xe903('0x16');logger[_0xe903('0x12')](_0xe903('0x17'),_0x13333f[_0xe903('0xf')],_0x55d875);}logger[_0xe903('0x12')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0xe903('0x18')](),moment()[_0xe903('0x9')](_0xe903('0x19')));return _0x310403[_0xe903('0x1a')]({'data2':encryptor[_0xe903('0x1b')](moment()['format']('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0xe903('0x1c')](encryptor[_0xe903('0x1d')](_0x13333f['data2']),'days')>DAYS){logger['info'](_0xe903('0x1e'),moment()[_0xe903('0x9')](_0xe903('0x19')));isOldTokenSent=![];return _0x310403['update']({'data1':_0x55d875,'data2':null,'license':null});}}}else{if(_0x13333f['data1']!=_0x55d875){logger['info'](_0xe903('0x17'),_0x13333f[_0xe903('0xf')],_0x55d875);return _0x310403[_0xe903('0x1a')]({'data1':_0x55d875,'data2':null,'license':null});}}}return _0x310403;})[_0xe903('0xd')](function(_0x4398a9){_0x310403=_0x4398a9;})[_0xe903('0xe')](function(_0x37fa75){logger[_0xe903('0x1f')](_0x37fa75[_0xe903('0x20')]);})[_0xe903('0x21')](function(){setTimeout(function(){manageLicense(hardware[_0xe903('0x22')](),_0x310403);},TIME);});}function defaultLicense(){var _0x532435=hardware['getUuid']();if(_0x532435){return db[_0xe903('0x23')][_0xe903('0x24')]({'where':{'id':0x1},'defaults':{'data1':_0x532435}})[_0xe903('0x25')](function(_0x1755db,_0x1d941d){logger['info'](_0xe903('0x26'),_0x532435);manageLicense(_0x532435,_0x1755db);})[_0xe903('0xe')](function(_0x3a0a2b){logger['error'](_0x3a0a2b['message']);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 2ad75ff..0f75b57 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 _0x62e8=['gray','deadline','add','grayReason','machineUuid','changed','disabled','message','User','findAll','role','sequelize','COUNT','col','count','admin','user','telephone','forEach','pick','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','util','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','then','catch','uuid','license','isEmpty','data2','split','decryptString','format','%s:%s:%s','parse','demo'];(function(_0x15bbde,_0x406fa2){var _0x455d52=function(_0x4046da){while(--_0x4046da){_0x15bbde['push'](_0x15bbde['shift']());}};_0x455d52(++_0x406fa2);}(_0x62e8,0x74));var _0x862e=function(_0x54cb5e,_0x276e51){_0x54cb5e=_0x54cb5e-0x0;var _0x4faa9e=_0x62e8[_0x54cb5e];return _0x4faa9e;};'use strict';var util=require(_0x862e('0x0'));var _=require(_0x862e('0x1'));var moment=require(_0x862e('0x2'));var BPromise=require(_0x862e('0x3'));var hardware=require(_0x862e('0x4'));var encryptor=require(_0x862e('0x5'));var db=require(_0x862e('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x862e('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x862e('0x8'),'machineUuid':hardware[_0x862e('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x862e('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x862e('0xa'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x3d850d){return new BPromise(function(_0x18b4b8,_0x33ff4f){return db[_0x862e('0xb')][_0x862e('0xc')](_['defaults'](_0x3d850d,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x5b91fb){return checkLicense(_0x5b91fb,null);})[_0x862e('0xd')](function(_0x525f23){_0x18b4b8(_0x525f23);return;})[_0x862e('0xe')](function(_0x2754ad){_0x33ff4f(_0x2754ad);});});}function checkLicense(_0x27f65c,_0x107bfb){if(!_0x27f65c){demoLicense[_0x862e('0xf')]=_0x27f65c['data1'];return demoLicense;}try{var _0x105f77=_0x107bfb||_0x27f65c[_0x862e('0x10')];if(_[_0x862e('0x11')](_0x105f77)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x29c876=_0x27f65c['data1'];var _0x1bc689=_0x27f65c[_0x862e('0x12')];var _0x1d8a24=_0x29c876[_0x862e('0x13')]('-')[0x4];var _0x247d4a=_0x29c876[_0x862e('0x13')]('-')[0x0];var _0x28fe70=encryptor[_0x862e('0x14')](_0x105f77,util[_0x862e('0x15')](_0x862e('0x16'),_0x1d8a24,_0x29c876,_0x247d4a));var _0x904284=JSON[_0x862e('0x17')](_0x28fe70);_0x904284[_0x862e('0x18')]=![];_0x904284['uuid']=_0x29c876;_0x904284['machineUuid']=hardware[_0x862e('0x9')]();if(_0x1bc689){var _0x3b9e4d=encryptor['decryptString'](_0x1bc689);_0x904284[_0x862e('0x19')]=_0x3b9e4d;_0x904284[_0x862e('0x1a')]=moment(_0x3b9e4d)[_0x862e('0x1b')](0x7,'days')['format']();_0x904284[_0x862e('0x1c')]=_0x904284[_0x862e('0xf')]!=_0x904284[_0x862e('0x1d')]?_0x862e('0x1e'):_0x862e('0x1f');}return _0x904284;}catch(_0xd7b77){breakingLicense[_0x862e('0xf')]=_0x27f65c['data1'];breakingLicense[_0x862e('0x20')]=_0xd7b77[_0x862e('0x20')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x4d8825,_0x48758a){getLicense()['then'](function(_0x4d9c5f){return db[_0x862e('0x21')][_0x862e('0x22')]({'attributes':[_0x862e('0x23'),[db[_0x862e('0x24')]['fn'](_0x862e('0x25'),db[_0x862e('0x24')][_0x862e('0x26')](_0x862e('0x23'))),_0x862e('0x27')]],'group':'role','where':{'role':{'$or':[_0x862e('0x28'),_0x862e('0x29'),_0x862e('0x2a')]}},'raw':!![]})['then'](function(_0x3e6890){var _0x1e0f3a={'user':_0x4d9c5f['users']||0x0,'telephone':_0x4d9c5f['telephones']||0x0};_0x3e6890[_0x862e('0x2b')](function(_0x465229){var _0x20f7f3=_0x465229['role']===_0x862e('0x28')?_0x862e('0x29'):_0x465229['role'];_0x1e0f3a[_0x20f7f3]-=_0x465229[_0x862e('0x27')];if(_0x1e0f3a[_0x20f7f3]<0x0)_0x1e0f3a[_0x20f7f3]=0x0;});_0x4d8825(_0x1e0f3a);return;});})['catch'](function(_0x4d7bf4){_0x48758a(_0x4d7bf4);});});}function checkUserLimits(_0x33ab6f){return new BPromise(function(_0x5ae407,_0x3ecb3a){getLimits()[_0x862e('0xd')](function(_0x525f1a){var _0x24d4f4=_[_0x862e('0x2c')](_['countBy'](_0x33ab6f,_0x862e('0x23')),[_0x862e('0x28'),_0x862e('0x29'),_0x862e('0x2a')]);var _0x5115ae=(_0x24d4f4['admin']||0x0)+(_0x24d4f4[_0x862e('0x29')]||0x0);var _0x512f09=_0x24d4f4[_0x862e('0x2a')]||0x0;if(_0x5115ae>_0x525f1a['user'])return _0x3ecb3a(_0x862e('0x2d'));if(_0x512f09>_0x525f1a[_0x862e('0x2a')])return _0x3ecb3a(_0x862e('0x2e'));return _0x5ae407();})[_0x862e('0xe')](function(_0x19cf4a){_0x3ecb3a(_0x19cf4a);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xc934=['gray','grayReason','message','findAll','role','sequelize','COUNT','count','admin','user','telephone','users','pick','countBy','License\x20limit\x20reached\x20for\x20telephones','exports','lodash','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','then','catch','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','parse','demo','uuid','machineUuid'];(function(_0x3d4e0f,_0x23f4ef){var _0x3e3dc1=function(_0x414a11){while(--_0x414a11){_0x3d4e0f['push'](_0x3d4e0f['shift']());}};_0x3e3dc1(++_0x23f4ef);}(_0xc934,0x181));var _0x4c93=function(_0x110124,_0x5e1c72){_0x110124=_0x110124-0x0;var _0x3782a7=_0xc934[_0x110124];return _0x3782a7;};'use strict';var util=require('util');var _=require(_0x4c93('0x0'));var moment=require('moment');var BPromise=require(_0x4c93('0x1'));var hardware=require(_0x4c93('0x2'));var encryptor=require(_0x4c93('0x3'));var db=require(_0x4c93('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x4c93('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x4c93('0x6'),'machineUuid':hardware[_0x4c93('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x4c93('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x4c93('0x8'),'machineUuid':hardware[_0x4c93('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x5a21d1){return new BPromise(function(_0x27278d,_0x5c429f){return db[_0x4c93('0x9')]['find'](_['defaults'](_0x5a21d1,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x8c3649){return checkLicense(_0x8c3649,null);})[_0x4c93('0xa')](function(_0x508e6f){_0x27278d(_0x508e6f);return;})[_0x4c93('0xb')](function(_0x187971){_0x5c429f(_0x187971);});});}function checkLicense(_0x1dbe0b,_0x261af4){if(!_0x1dbe0b){demoLicense['uuid']=_0x1dbe0b[_0x4c93('0xc')];return demoLicense;}try{var _0x2bb6a6=_0x261af4||_0x1dbe0b[_0x4c93('0xd')];if(_[_0x4c93('0xe')](_0x2bb6a6)){throw new Error(_0x4c93('0xf'));}var _0x3f96f2=_0x1dbe0b[_0x4c93('0xc')];var _0x3c0bbb=_0x1dbe0b[_0x4c93('0x10')];var _0x55406f=_0x3f96f2[_0x4c93('0x11')]('-')[0x4];var _0x4fcf8a=_0x3f96f2[_0x4c93('0x11')]('-')[0x0];var _0x4d54a9=encryptor[_0x4c93('0x12')](_0x2bb6a6,util[_0x4c93('0x13')](_0x4c93('0x14'),_0x55406f,_0x3f96f2,_0x4fcf8a));var _0x6be3c3=JSON[_0x4c93('0x15')](_0x4d54a9);_0x6be3c3[_0x4c93('0x16')]=![];_0x6be3c3[_0x4c93('0x17')]=_0x3f96f2;_0x6be3c3[_0x4c93('0x18')]=hardware[_0x4c93('0x7')]();if(_0x3c0bbb){var _0x3a5236=encryptor['decryptString'](_0x3c0bbb);_0x6be3c3[_0x4c93('0x19')]=_0x3a5236;_0x6be3c3['deadline']=moment(_0x3a5236)['add'](0x7,'days')['format']();_0x6be3c3[_0x4c93('0x1a')]=_0x6be3c3[_0x4c93('0x17')]!=_0x6be3c3['machineUuid']?'changed':'disabled';}return _0x6be3c3;}catch(_0x57288d){breakingLicense[_0x4c93('0x17')]=_0x1dbe0b[_0x4c93('0xc')];breakingLicense[_0x4c93('0x1b')]=_0x57288d['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x44f0b2,_0x417873){getLicense()[_0x4c93('0xa')](function(_0x4c7bc2){return db['User'][_0x4c93('0x1c')]({'attributes':[_0x4c93('0x1d'),[db[_0x4c93('0x1e')]['fn'](_0x4c93('0x1f'),db[_0x4c93('0x1e')]['col'](_0x4c93('0x1d'))),_0x4c93('0x20')]],'group':_0x4c93('0x1d'),'where':{'role':{'$or':[_0x4c93('0x21'),_0x4c93('0x22'),_0x4c93('0x23')]}},'raw':!![]})[_0x4c93('0xa')](function(_0x3dd93e){var _0x57aec4={'user':_0x4c7bc2[_0x4c93('0x24')]||0x0,'telephone':_0x4c7bc2['telephones']||0x0};_0x3dd93e['forEach'](function(_0x3b0488){var _0xbb8cba=_0x3b0488[_0x4c93('0x1d')]===_0x4c93('0x21')?_0x4c93('0x22'):_0x3b0488[_0x4c93('0x1d')];_0x57aec4[_0xbb8cba]-=_0x3b0488['count'];if(_0x57aec4[_0xbb8cba]<0x0)_0x57aec4[_0xbb8cba]=0x0;});_0x44f0b2(_0x57aec4);return;});})[_0x4c93('0xb')](function(_0x15666c){_0x417873(_0x15666c);});});}function checkUserLimits(_0x2128fe){return new BPromise(function(_0x117d78,_0x3f5a0a){getLimits()[_0x4c93('0xa')](function(_0x55c521){var _0x907b7f=_[_0x4c93('0x25')](_[_0x4c93('0x26')](_0x2128fe,'role'),[_0x4c93('0x21'),_0x4c93('0x22'),_0x4c93('0x23')]);var _0x19570f=(_0x907b7f[_0x4c93('0x21')]||0x0)+(_0x907b7f[_0x4c93('0x22')]||0x0);var _0xcd7484=_0x907b7f['telephone']||0x0;if(_0x19570f>_0x55c521['user'])return _0x3f5a0a('License\x20limit\x20reached\x20for\x20users');if(_0xcd7484>_0x55c521[_0x4c93('0x23')])return _0x3f5a0a(_0x4c93('0x27'));return _0x117d78();})[_0x4c93('0xb')](function(_0xd97e69){_0x3f5a0a(_0xd97e69);});});}module[_0x4c93('0x28')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 06279a8..a25c354 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 _0xfef3=['secret','exports','myappanuglar-secret'];(function(_0x2a4330,_0x543e22){var _0x11a7bd=function(_0x4c3cba){while(--_0x4c3cba){_0x2a4330['push'](_0x2a4330['shift']());}};_0x11a7bd(++_0x543e22);}(_0xfef3,0x118));var _0x3fef=function(_0x5efa26,_0x372633){_0x5efa26=_0x5efa26-0x0;var _0xcd29a=_0xfef3[_0x5efa26];return _0xcd29a;};'use strict';module[_0x3fef('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x3fef('0x1'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':_0x3fef('0x2'),'DEBUG':''}; \ No newline at end of file +var _0x1c7c=['exports','http://localhost:9000','myappanuglar-secret','app-id'];(function(_0x1e7e6f,_0xbe1b64){var _0x157afb=function(_0x293ab8){while(--_0x293ab8){_0x1e7e6f['push'](_0x1e7e6f['shift']());}};_0x157afb(++_0xbe1b64);}(_0x1c7c,0x164));var _0xc1c7=function(_0x4f971d,_0x1dfa7c){_0x4f971d=_0x4f971d-0x0;var _0x240ceb=_0x1c7c[_0x4f971d];return _0x240ceb;};'use strict';module[_0xc1c7('0x0')]={'DOMAIN':_0xc1c7('0x1'),'SESSION_SECRET':_0xc1c7('0x2'),'GOOGLE_ID':_0xc1c7('0x3'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 7b57135..3922fa2 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xca4e=['error','File','%s-%s','info','debugLevel','winston','util','path','INFO','/var','log','xcally','format','%s-%s.log','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','level','toUpperCase','exports','Logger','transports'];(function(_0x476b7f,_0x7d705a){var _0x2f5661=function(_0x4badff){while(--_0x4badff){_0x476b7f['push'](_0x476b7f['shift']());}};_0x2f5661(++_0x7d705a);}(_0xca4e,0x65));var _0xeca4=function(_0x4bfaeb,_0x409051){_0x4bfaeb=_0x4bfaeb-0x0;var _0x136067=_0xca4e[_0x4bfaeb];return _0x136067;};'use strict';var moment=require('moment');var winston=require(_0xeca4('0x0'));var util=require(_0xeca4('0x1'));var path=require(_0xeca4('0x2'));var debugLevel=_0xeca4('0x3');function filename(_0x2e56ea,_0x1095b2){return path['join'](_0xeca4('0x4'),_0xeca4('0x5'),_0xeca4('0x6'),util[_0xeca4('0x7')](_0xeca4('0x8'),_0x2e56ea,_0x1095b2));}function formatter(_0x339b1a,_0x463d48){_0x463d48['message']=_0x463d48[_0xeca4('0x9')][_0xeca4('0xa')](/@@{/g,_0xeca4('0xb'))[_0xeca4('0xa')](/}@@/g,_0xeca4('0xc'))[_0xeca4('0xa')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0xeca4('0x7')](_0xeca4('0xd'),moment()[_0xeca4('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),_0x463d48[_0xeca4('0xe')][_0xeca4('0xf')](),_0x339b1a,_0x463d48[_0xeca4('0x9')]);}module[_0xeca4('0x10')]=function(_0x5bfa7){return new winston[(_0xeca4('0x11'))]({'transports':[new winston[(_0xeca4('0x12'))]['File']({'name':util[_0xeca4('0x7')]('%s-%s',_0x5bfa7,_0xeca4('0x13')),'filename':filename(_0x5bfa7,_0xeca4('0x13')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3675d4){return formatter(_0x5bfa7,_0x3675d4);}}),new winston[(_0xeca4('0x12'))][(_0xeca4('0x14'))]({'name':util[_0xeca4('0x7')](_0xeca4('0x15'),_0x5bfa7,'info'),'filename':filename(_0x5bfa7,_0xeca4('0x16')),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x13fa53){return formatter(_0x5bfa7,_0x13fa53);}}),new winston[(_0xeca4('0x12'))]['Console']({'level':process['env'][_0xeca4('0x17')]||debugLevel,'json':![],'formatter':function(_0x28e5da){return formatter(_0x5bfa7,_0x28e5da);}})]});}; \ No newline at end of file +var _0x4d23=['debugLevel','util','path','INFO','join','/var','log','xcally','format','%s-%s.log','message','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','level','toUpperCase','exports','Logger','File','error','transports','info','env'];(function(_0x1696c3,_0x168bf2){var _0x4f748e=function(_0x384bc5){while(--_0x384bc5){_0x1696c3['push'](_0x1696c3['shift']());}};_0x4f748e(++_0x168bf2);}(_0x4d23,0x12c));var _0x34d2=function(_0x1b2c50,_0x48996f){_0x1b2c50=_0x1b2c50-0x0;var _0x585674=_0x4d23[_0x1b2c50];return _0x585674;};'use strict';var moment=require('moment');var winston=require('winston');var util=require(_0x34d2('0x0'));var path=require(_0x34d2('0x1'));var debugLevel=_0x34d2('0x2');function filename(_0x2acdcc,_0x11b1c6){return path[_0x34d2('0x3')](_0x34d2('0x4'),_0x34d2('0x5'),_0x34d2('0x6'),util[_0x34d2('0x7')](_0x34d2('0x8'),_0x2acdcc,_0x11b1c6));}function formatter(_0x56cf21,_0x28042f){_0x28042f[_0x34d2('0x9')]=_0x28042f['message']['replace'](/@@{/g,'{{{')[_0x34d2('0xa')](/}@@/g,_0x34d2('0xb'))[_0x34d2('0xa')](/@{/g,'{{')[_0x34d2('0xa')](/}@/g,'}}');return util[_0x34d2('0x7')](_0x34d2('0xc'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),_0x28042f[_0x34d2('0xd')][_0x34d2('0xe')](),_0x56cf21,_0x28042f[_0x34d2('0x9')]);}module[_0x34d2('0xf')]=function(_0x4bf678){return new winston[(_0x34d2('0x10'))]({'transports':[new winston['transports'][(_0x34d2('0x11'))]({'name':util['format']('%s-%s',_0x4bf678,_0x34d2('0x12')),'filename':filename(_0x4bf678,_0x34d2('0x12')),'level':_0x34d2('0x12'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x33c130){return formatter(_0x4bf678,_0x33c130);}}),new winston[(_0x34d2('0x13'))][(_0x34d2('0x11'))]({'name':util[_0x34d2('0x7')]('%s-%s',_0x4bf678,_0x34d2('0x14')),'filename':filename(_0x4bf678,_0x34d2('0x14')),'level':_0x34d2('0x14'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x34f288){return formatter(_0x4bf678,_0x34f288);}}),new winston[(_0x34d2('0x13'))]['Console']({'level':process[_0x34d2('0x15')][_0x34d2('0x16')]||debugLevel,'json':![],'formatter':function(_0x1c575e){return formatter(_0x4bf678,_0x1c575e);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 2e78f6c..507cc2c 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 _0x7b41=['../../services/xdr/index.js','exports','path','express','join','../../services/express/index.js','ami','../../services/ami/index.js','../../services/agi/index.js','email','../../services/email/index.js','routing','xdr'];(function(_0x52883d,_0x12aede){var _0x33aae4=function(_0x41f253){while(--_0x41f253){_0x52883d['push'](_0x52883d['shift']());}};_0x33aae4(++_0x12aede);}(_0x7b41,0xb8));var _0x17b4=function(_0x5b13b0,_0x462042){_0x5b13b0=_0x5b13b0-0x0;var _0x27763c=_0x7b41[_0x5b13b0];return _0x27763c;};'use strict';var path=require(_0x17b4('0x0'));var os=require('os');var config={'apps':[{'name':_0x17b4('0x1'),'script':path[_0x17b4('0x2')](__dirname,_0x17b4('0x3'))},{'name':_0x17b4('0x4'),'script':path[_0x17b4('0x2')](__dirname,_0x17b4('0x5'))},{'name':'agi','script':path[_0x17b4('0x2')](__dirname,_0x17b4('0x6'))},{'name':_0x17b4('0x7'),'script':path[_0x17b4('0x2')](__dirname,_0x17b4('0x8'))},{'name':_0x17b4('0x9'),'script':path[_0x17b4('0x2')](__dirname,'../../services/routing/index.js')},{'name':_0x17b4('0xa'),'script':path[_0x17b4('0x2')](__dirname,_0x17b4('0xb'))}]};module[_0x17b4('0xc')]=config; \ No newline at end of file +var _0x0085=['../../services/email/index.js','routing','xdr','../../services/xdr/index.js','exports','path','express','join','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x0085,0x147));var _0x5008=function(_0x372cd8,_0x5b5c1f){_0x372cd8=_0x372cd8-0x0;var _0x4d70a7=_0x0085[_0x372cd8];return _0x4d70a7;};'use strict';var path=require(_0x5008('0x0'));var os=require('os');var config={'apps':[{'name':_0x5008('0x1'),'script':path[_0x5008('0x2')](__dirname,_0x5008('0x3'))},{'name':_0x5008('0x4'),'script':path['join'](__dirname,_0x5008('0x5'))},{'name':_0x5008('0x6'),'script':path[_0x5008('0x2')](__dirname,_0x5008('0x7'))},{'name':_0x5008('0x8'),'script':path[_0x5008('0x2')](__dirname,_0x5008('0x9'))},{'name':_0x5008('0xa'),'script':path[_0x5008('0x2')](__dirname,'../../services/routing/index.js')},{'name':_0x5008('0xb'),'script':path[_0x5008('0x2')](__dirname,_0x5008('0xc'))}]};module[_0x5008('0xd')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index fdaeb57..7292ca6 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 _0xd327=['restart','list','describe','delete','dump','saved','pm2','bluebird','./config','connect','connected','start','disconnect','stop','then'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xd327,0x15f));var _0x7d32=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xd327[_0x432682];return _0x463d05;};'use strict';var pm2=require(_0x7d32('0x0'));var BPromise=require(_0x7d32('0x1'));var config=require(_0x7d32('0x2'));function connect(){return new BPromise(function(_0x38086d,_0x599c91){return pm2[_0x7d32('0x3')](function(_0x4f951a){if(_0x4f951a){return _0x599c91(_0x4f951a);}return _0x38086d(_0x7d32('0x4'));});});};exports[_0x7d32('0x5')]=function(_0x4ad00d){return connect()['then'](function(){return new BPromise(function(_0x7e5ec2,_0x163804){return pm2[_0x7d32('0x5')](_0x4ad00d,function(_0x3c14a6,_0x302741){if(_0x3c14a6){return _0x163804(_0x3c14a6);}pm2[_0x7d32('0x6')]();return _0x7e5ec2(_0x302741);});});});};exports[_0x7d32('0x7')]=function(_0x5706b1){return connect()[_0x7d32('0x8')](function(){return new BPromise(function(_0x1c0292,_0x28ee41){return pm2[_0x7d32('0x7')](_0x5706b1,function(_0x39c4f0,_0x24574f){if(_0x39c4f0){return _0x28ee41(_0x39c4f0);}pm2[_0x7d32('0x6')]();return _0x1c0292(_0x24574f);});});});};exports[_0x7d32('0x9')]=function(_0x30edcb){return connect()[_0x7d32('0x8')](function(){return new BPromise(function(_0x380b18,_0x28842b){return pm2[_0x7d32('0x9')](_0x30edcb,function(_0xb500e2,_0x1e36e5){if(_0xb500e2){return _0x28842b(_0xb500e2);}pm2[_0x7d32('0x6')]();return _0x380b18(_0x1e36e5);});});});};exports[_0x7d32('0xa')]=function(){return connect()[_0x7d32('0x8')](function(){return new BPromise(function(_0x202883,_0x21ba70){return pm2[_0x7d32('0xa')](function(_0x4f447c,_0x40827a){if(_0x4f447c){return _0x21ba70(_0x4f447c);}pm2['disconnect']();return _0x202883(_0x40827a);});});});};exports['describe']=function(_0x195b6a){return connect()[_0x7d32('0x8')](function(){return new BPromise(function(_0x38a6e0,_0x59ca18){return pm2[_0x7d32('0xb')](_0x195b6a,function(_0xfc2bfd,_0x467317){if(_0xfc2bfd){return _0x59ca18(_0xfc2bfd);}pm2[_0x7d32('0x6')]();return _0x38a6e0(_0x467317);});});});};exports[_0x7d32('0xc')]=function(_0x9031dc){return connect()[_0x7d32('0x8')](function(){return new BPromise(function(_0x35b852,_0x3e991b){return pm2[_0x7d32('0xc')](_0x9031dc,function(_0x578b25,_0x5b4057){if(_0x578b25){return _0x3e991b(_0x578b25);}pm2[_0x7d32('0x6')]();return _0x35b852(_0x5b4057);});});});};exports[_0x7d32('0xd')]=function(){return connect()[_0x7d32('0x8')](function(){return new BPromise(function(_0x7c2df,_0x3efd6a){return pm2[_0x7d32('0xd')](function(_0x2794b3){if(_0x2794b3){return _0x3efd6a(_0x2794b3);}return _0x7c2df(_0x7d32('0xe'));});});});}; \ No newline at end of file +var _0x62bb=['describe','delete','pm2','bluebird','./config','connect','connected','start','stop','then','restart','disconnect','list'];(function(_0x5a090e,_0x223f2c){var _0x2215fe=function(_0x4d2daf){while(--_0x4d2daf){_0x5a090e['push'](_0x5a090e['shift']());}};_0x2215fe(++_0x223f2c);}(_0x62bb,0x106));var _0xb62b=function(_0x3f8c86,_0x42001c){_0x3f8c86=_0x3f8c86-0x0;var _0x3c4b45=_0x62bb[_0x3f8c86];return _0x3c4b45;};'use strict';var pm2=require(_0xb62b('0x0'));var BPromise=require(_0xb62b('0x1'));var config=require(_0xb62b('0x2'));function connect(){return new BPromise(function(_0x339234,_0x5a6ab5){return pm2[_0xb62b('0x3')](function(_0x329119){if(_0x329119){return _0x5a6ab5(_0x329119);}return _0x339234(_0xb62b('0x4'));});});};exports[_0xb62b('0x5')]=function(_0x5c2c34){return connect()['then'](function(){return new BPromise(function(_0x27766e,_0x5c606d){return pm2['start'](_0x5c2c34,function(_0x22a4f0,_0x183063){if(_0x22a4f0){return _0x5c606d(_0x22a4f0);}pm2['disconnect']();return _0x27766e(_0x183063);});});});};exports[_0xb62b('0x6')]=function(_0x2fb49b){return connect()[_0xb62b('0x7')](function(){return new BPromise(function(_0xfddd67,_0x5e569f){return pm2[_0xb62b('0x6')](_0x2fb49b,function(_0x3f910f,_0x3ad66a){if(_0x3f910f){return _0x5e569f(_0x3f910f);}pm2['disconnect']();return _0xfddd67(_0x3ad66a);});});});};exports[_0xb62b('0x8')]=function(_0x1e9ed5){return connect()[_0xb62b('0x7')](function(){return new BPromise(function(_0x53ba38,_0x11704f){return pm2['restart'](_0x1e9ed5,function(_0x30d1ad,_0x2c82a7){if(_0x30d1ad){return _0x11704f(_0x30d1ad);}pm2[_0xb62b('0x9')]();return _0x53ba38(_0x2c82a7);});});});};exports[_0xb62b('0xa')]=function(){return connect()['then'](function(){return new BPromise(function(_0x23792a,_0x25bae0){return pm2['list'](function(_0x1c808d,_0x2a0644){if(_0x1c808d){return _0x25bae0(_0x1c808d);}pm2[_0xb62b('0x9')]();return _0x23792a(_0x2a0644);});});});};exports[_0xb62b('0xb')]=function(_0x563513){return connect()[_0xb62b('0x7')](function(){return new BPromise(function(_0x53fb48,_0x3b7bd2){return pm2[_0xb62b('0xb')](_0x563513,function(_0x48a6ca,_0x4fceeb){if(_0x48a6ca){return _0x3b7bd2(_0x48a6ca);}pm2['disconnect']();return _0x53fb48(_0x4fceeb);});});});};exports[_0xb62b('0xc')]=function(_0x31f0c1){return connect()[_0xb62b('0x7')](function(){return new BPromise(function(_0x16c288,_0x30a2cc){return pm2[_0xb62b('0xc')](_0x31f0c1,function(_0x625317,_0x2b1a4f){if(_0x625317){return _0x30a2cc(_0x625317);}pm2[_0xb62b('0x9')]();return _0x16c288(_0x2b1a4f);});});});};exports['dump']=function(){return connect()[_0xb62b('0x7')](function(){return new BPromise(function(_0x5c7b81,_0x4e29e6){return pm2['dump'](function(_0x412450){if(_0x412450){return _0x4e29e6(_0x412450);}return _0x5c7b81('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 842d6f2..2bdb912 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 _0xb890=['length','info','[CHAT]\x20Interactions\x20to\x20close:','join','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','chatInteraction:update','catch','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','ioredis','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','ChatInteraction','findAll','lastMsgAt','then'];(function(_0x57d13b,_0x52d8cb){var _0x467696=function(_0x153000){while(--_0x153000){_0x57d13b['push'](_0x57d13b['shift']());}};_0x467696(++_0x52d8cb);}(_0xb890,0x106));var _0x0b89=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb890[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0b89('0x0'));var moment=require('moment');var Redis=require(_0x0b89('0x1'));var util=require('util');var config=require(_0x0b89('0x2'));var db=require(_0x0b89('0x3'))['db'];var logger=require(_0x0b89('0x4'))(_0x0b89('0x5'));config[_0x0b89('0x6')]=_[_0x0b89('0x7')](config[_0x0b89('0x6')],{'host':_0x0b89('0x8'),'port':0x18eb});var io=require(_0x0b89('0x9'))(new Redis(config[_0x0b89('0x6')]));function closeInteractions(){var _0x5982b2=0x0;var _0x431875=[];return db[_0x0b89('0xa')][_0x0b89('0xb')]({'raw':!![],'attributes':['id',_0x0b89('0xc')],'where':{'id':0x1}})['then'](function(_0x425acb){_0x5982b2=_0x425acb['chatTimeout'];if(_0x5982b2){return db[_0x0b89('0xd')][_0x0b89('0xe')]({'raw':!![],'attributes':['id',_0x0b89('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x425acb[_0x0b89('0xc')],'minutes')}}});}else{return[];}})[_0x0b89('0x10')](function(_0x21332b){if(_0x21332b&&_0x21332b[_0x0b89('0x11')]){_0x431875=_['map'](_0x21332b||[],'id');logger[_0x0b89('0x12')](_0x0b89('0x13'),_0x431875[_0x0b89('0x14')]());return db['ChatInteraction']['update']({'closeReason':_0x0b89('0x15'),'disposition':_0x0b89('0x16'),'closed':!![],'closedAt':moment()[_0x0b89('0x17')](_0x0b89('0x18'))},{'where':{'id':_0x431875}});}})[_0x0b89('0x10')](function(){if(_0x431875&&_0x431875['length']){logger[_0x0b89('0x12')](_0x0b89('0x19'),_0x431875[_0x0b89('0x14')]());for(var _0x5ca524=0x0;_0x5ca524<_0x431875[_0x0b89('0x11')];_0x5ca524++){io['emit'](_0x0b89('0x1a'),{'id':_0x431875[_0x5ca524],'closed':!![]});}}})[_0x0b89('0x1b')](function(_0x16e97b){logger['error'](_0x0b89('0x1c'),_0x16e97b?util[_0x0b89('0x1d')](_0x16e97b,{'showHidden':![],'depth':null}):'');});}exports[_0x0b89('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xada4=['format','YYYY-MM-DD\x20HH:mm:ss','length','info','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','join','chatInteraction:update','catch','[CHAT]\x20Error\x20closing\x20interactions','start','lodash','moment','../../config/environment','../../mysqldb','../logger','defaults','redis','localhost','socket.io-emitter','chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','minutes','then','map','[CHAT]\x20Interactions\x20to\x20close:','update','system'];(function(_0x19cae8,_0x49dd0d){var _0x3ea9d1=function(_0x51c5c7){while(--_0x51c5c7){_0x19cae8['push'](_0x19cae8['shift']());}};_0x3ea9d1(++_0x49dd0d);}(_0xada4,0x64));var _0x4ada=function(_0x534d30,_0x60d2b2){_0x534d30=_0x534d30-0x0;var _0x4c4751=_0xada4[_0x534d30];return _0x4c4751;};'use strict';var _=require(_0x4ada('0x0'));var moment=require(_0x4ada('0x1'));var Redis=require('ioredis');var util=require('util');var config=require(_0x4ada('0x2'));var db=require(_0x4ada('0x3'))['db'];var logger=require(_0x4ada('0x4'))('schedule');config['redis']=_[_0x4ada('0x5')](config[_0x4ada('0x6')],{'host':_0x4ada('0x7'),'port':0x18eb});var io=require(_0x4ada('0x8'))(new Redis(config[_0x4ada('0x6')]));function closeInteractions(){var _0x13f672=0x0;var _0x497c78=[];return db['Setting']['find']({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})['then'](function(_0x8883e){_0x13f672=_0x8883e[_0x4ada('0x9')];if(_0x13f672){return db[_0x4ada('0xa')][_0x4ada('0xb')]({'raw':!![],'attributes':['id',_0x4ada('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x4ada('0xd')](_0x8883e[_0x4ada('0x9')],_0x4ada('0xe'))}}});}else{return[];}})[_0x4ada('0xf')](function(_0x550947){if(_0x550947&&_0x550947['length']){_0x497c78=_[_0x4ada('0x10')](_0x550947||[],'id');logger['info'](_0x4ada('0x11'),_0x497c78['join']());return db['ChatInteraction'][_0x4ada('0x12')]({'closeReason':_0x4ada('0x13'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x4ada('0x14')](_0x4ada('0x15'))},{'where':{'id':_0x497c78}});}})[_0x4ada('0xf')](function(){if(_0x497c78&&_0x497c78[_0x4ada('0x16')]){logger[_0x4ada('0x17')](_0x4ada('0x18'),_0x497c78[_0x4ada('0x19')]());for(var _0x2e0654=0x0;_0x2e0654<_0x497c78['length'];_0x2e0654++){io['emit'](_0x4ada('0x1a'),{'id':_0x497c78[_0x2e0654],'closed':!![]});}}})[_0x4ada('0x1b')](function(_0x228ff3){logger['error'](_0x4ada('0x1c'),_0x228ff3?util['inspect'](_0x228ff3,{'showHidden':![],'depth':null}):'');});}exports[_0x4ada('0x1d')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 0ade233..5d0b5e8 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 _0x8bd2=['Smtp','host','port','secure','authentication','auth','user','format','\x22%s\x22\x20<%s>','name','email','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','join','savename','%s.%s','basename','extname','message','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','existsSync','status','attachments','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','info','SendMail','then','error','error\x20mail','email\x20sent','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','keyBy','toString','difference','length','exists','stop','delete\x20cron','toRun','index','my\x20id','resolve','cron','active','isBetween','startAt','endAt','add','start','add\x20cron','deleteJob','update\x20cron','run','util','path','lodash','moment','cron-job-manager','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','Try\x20to\x20send\x20a\x20mail\x20to','service','MailAccount'];(function(_0x1125d8,_0x1a9084){var _0x193648=function(_0xd6a9f1){while(--_0xd6a9f1){_0x1125d8['push'](_0x1125d8['shift']());}};_0x193648(++_0x1a9084);}(_0x8bd2,0xa5));var _0x28bd=function(_0x21d36e,_0x5dc096){_0x21d36e=_0x21d36e-0x0;var _0x4cc307=_0x8bd2[_0x21d36e];return _0x4cc307;};'use strict';var fs=require('fs');var util=require(_0x28bd('0x0'));var path=require(_0x28bd('0x1'));var _=require(_0x28bd('0x2'));var moment=require(_0x28bd('0x3'));var CronJobManager=require(_0x28bd('0x4'));var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x28bd('0x5'))(_0x28bd('0x6'));var db=require(_0x28bd('0x7'))['db'];var analyticCustomReportController=require(_0x28bd('0x8'));var analyticDefaultReportController=require(_0x28bd('0x9'));var client=jayson[_0x28bd('0xa')][_0x28bd('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x6397b,_0xecf2d4){return function(){logger['info'](_0x28bd('0xc'),_0x6397b['email']);var _0x43ccd9=!![];var _0x2795c0={'tls':{'rejectUnauthorized':![]}};if(_0x6397b['MailAccount']['Smtp'][_0x28bd('0xd')]){_0x2795c0['service']=_0x6397b[_0x28bd('0xe')][_0x28bd('0xf')]['service'];}else{_0x2795c0[_0x28bd('0x10')]=_0x6397b[_0x28bd('0xe')]['Smtp'][_0x28bd('0x10')];_0x2795c0['port']=_0x6397b[_0x28bd('0xe')]['Smtp'][_0x28bd('0x11')];_0x2795c0['secure']=_0x6397b['MailAccount']['Smtp'][_0x28bd('0x12')];}if(_0x6397b[_0x28bd('0xe')][_0x28bd('0xf')][_0x28bd('0x13')]){_0x2795c0[_0x28bd('0x14')]={'user':_0x6397b[_0x28bd('0xe')][_0x28bd('0xf')][_0x28bd('0x15')],'pass':_0x6397b[_0x28bd('0xe')]['Smtp']['pass']};}var _0xc44da5={'account':_0x2795c0,'message':{'from':util[_0x28bd('0x16')](_0x28bd('0x17'),_0x6397b['MailAccount'][_0x28bd('0x18')],_0x6397b[_0x28bd('0xe')][_0x28bd('0x19')]||_0x6397b[_0x28bd('0xe')][_0x28bd('0xf')][_0x28bd('0x15')]),'to':_0x6397b[_0x28bd('0x19')],'cc':_0x6397b['cc'],'bcc':_0x6397b[_0x28bd('0x1a')],'subject':util[_0x28bd('0x16')](_0x28bd('0x1b'),_0xecf2d4['name'],_0x6397b[_0x28bd('0x1c')],_0x6397b['subtractUnit'])}};var _0x42eba0=path[_0x28bd('0x1d')](__dirname,'../../files/reports');var _0x1c6362=_0xecf2d4[_0x28bd('0x1e')];var _0x47ffef=util['format'](_0x28bd('0x1f'),path[_0x28bd('0x20')](_0xecf2d4[_0x28bd('0x1e')],path[_0x28bd('0x21')](_0xecf2d4['savename'])),'zip');var _0x3a54ea=path[_0x28bd('0x1d')](_0x42eba0,_0x1c6362);var _0x1b9f65=path[_0x28bd('0x1d')](_0x42eba0,_0x47ffef);if(fs['existsSync'](_0x3a54ea)){_0xecf2d4['status']='Sent';_0xc44da5[_0x28bd('0x22')]['attachments']=[{'filename':_0x1c6362,'path':_0x3a54ea}];_0xc44da5[_0x28bd('0x22')]['text']=util[_0x28bd('0x16')](_0x28bd('0x23'),JSON[_0x28bd('0x24')](_0xecf2d4,null,0x2));}else if(fs[_0x28bd('0x25')](_0x1b9f65)){_0xecf2d4[_0x28bd('0x26')]='Sent';_0xc44da5[_0x28bd('0x22')][_0x28bd('0x27')]=[{'filename':_0x47ffef,'path':_0x1b9f65}];}else{_0xc44da5['message'][_0x28bd('0x28')]=_0x28bd('0x29');if(!_0x6397b[_0x28bd('0x2a')]){_0x43ccd9=![];logger[_0x28bd('0x2b')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x43ccd9){return client['request'](_0x28bd('0x2c'),_0xc44da5)[_0x28bd('0x2d')](function(_0x59db9a){if(_0x59db9a[_0x28bd('0x2e')]){return logger[_0x28bd('0x2e')](_0x28bd('0x2f'),JSON['stringify'](_0x59db9a));}return logger['info'](_0x28bd('0x30'));})[_0x28bd('0x31')](function(_0x469b2){return logger[_0x28bd('0x2e')](_0x28bd('0x2f'),JSON['stringify'](_0x469b2));});}};}function handleError(){return function(_0x33c030){return logger[_0x28bd('0x2e')](JSON[_0x28bd('0x24')](_0x33c030));};}function handleResult(_0xe08bed){return function(_0x156012){logger[_0x28bd('0x2b')](_0x28bd('0x32'),JSON[_0x28bd('0x24')](_0x156012));if(_0xe08bed['MailAccount']&&_0xe08bed[_0x28bd('0xe')][_0x28bd('0xf')]&&!_['isNil'](_0xe08bed[_0x28bd('0x19')])){setTimeout(handleSendEmail(_0xe08bed,_0x156012),0x3c*0x3e8);}};}function handleJob(_0x5e2f1e){return function(){try{if(_[_0x28bd('0x33')](_0x5e2f1e[_0x28bd('0x1c')])){return logger['info'](_0x28bd('0x34'));}if(_[_0x28bd('0x33')](_0x5e2f1e[_0x28bd('0x35')])){return logger[_0x28bd('0x2b')](_0x28bd('0x36'));}var _0x422b16={'startDate':moment()[_0x28bd('0x37')](_0x5e2f1e[_0x28bd('0x1c')],_0x5e2f1e[_0x28bd('0x35')])[_0x28bd('0x16')](_0x28bd('0x38')),'endDate':moment()[_0x28bd('0x16')](_0x28bd('0x38')),'type':_0x28bd('0x39'),'output':_0x5e2f1e[_0x28bd('0x3a')],'name':_0x5e2f1e['name']};if(!_[_0x28bd('0x33')](_0x5e2f1e[_0x28bd('0x3b')])){logger[_0x28bd('0x2b')](_0x28bd('0x3c'),_0x5e2f1e[_0x28bd('0x3b')]);return analyticDefaultReportController[_0x28bd('0x3d')]({'id':_0x5e2f1e[_0x28bd('0x3b')]},_0x422b16)[_0x28bd('0x2d')](handleResult(_0x5e2f1e))[_0x28bd('0x31')](handleError());}if(!_[_0x28bd('0x33')](_0x5e2f1e[_0x28bd('0x3e')])){logger[_0x28bd('0x2b')]('exec\x20custom\x20report\x20id:%s',_0x5e2f1e[_0x28bd('0x3e')]);return analyticCustomReportController['runReport']({'id':_0x5e2f1e[_0x28bd('0x3e')]},_0x422b16)[_0x28bd('0x2d')](handleResult(_0x5e2f1e))[_0x28bd('0x31')](handleError());}}catch(_0x3cf2a8){logger[_0x28bd('0x2e')](JSON[_0x28bd('0x24')](_0x3cf2a8));}return logger[_0x28bd('0x2b')](_0x28bd('0x3f'));};}function getJobs(_0x2875f2){var _0x5e53eb={};if(_0x2875f2){_0x5e53eb['id']=_0x2875f2;}return db[_0x28bd('0x40')][_0x28bd('0x41')]({'where':_0x5e53eb,'include':[{'model':db['MailAccount'],'attributes':['id',_0x28bd('0x18'),'email'],'include':[{'model':db[_0x28bd('0x42')],'as':_0x28bd('0xf')}]}]})[_0x28bd('0x2d')](function(_0x15eace){var _0x5e7777=_[_0x28bd('0x43')](manager['jobs']);var _0x3eb8cb=_['map'](_0x15eace,function(_0x459583){return _0x459583['id']['toString']();});var _0x17985c=_[_0x28bd('0x44')](_0x15eace,function(_0x51571f){return _0x51571f['id'][_0x28bd('0x45')]();});var _0x58e901=_0x2875f2?_0x3eb8cb:_['difference'](_0x3eb8cb,_0x5e7777);var _0x3551eb=_['intersection'](_0x3eb8cb,_0x5e7777);var _0x10fda2=_[_0x28bd('0x46')](_0x5e7777,_0x3eb8cb);var _0x5921a9;var _0x363f0c;for(_0x5921a9=0x0;_0x5921a9<_0x10fda2[_0x28bd('0x47')]&&!_0x2875f2;_0x5921a9+=0x1){_0x363f0c=_0x10fda2[_0x5921a9][_0x28bd('0x45')]();if(manager[_0x28bd('0x48')](_0x363f0c)){manager[_0x28bd('0x49')](_0x363f0c);manager['deleteJob'](_0x363f0c);logger['info'](_0x28bd('0x4a'),_0x363f0c);}}logger[_0x28bd('0x2b')](_0x28bd('0x4b'),JSON[_0x28bd('0x24')](_0x58e901));for(_0x5921a9=0x0;_0x5921a9<_0x58e901[_0x28bd('0x47')];_0x5921a9+=0x1){_0x363f0c=_0x58e901[_0x5921a9][_0x28bd('0x45')]();logger[_0x28bd('0x2b')](_0x28bd('0x4c'),_0x363f0c);if(_0x2875f2){logger[_0x28bd('0x2b')](_0x28bd('0x4d'),_0x2875f2);logger[_0x28bd('0x2b')](JSON[_0x28bd('0x24')](_0x17985c[_0x363f0c]));BPromise[_0x28bd('0x4e')]()[_0x28bd('0x2d')](handleJob(_0x17985c[_0x363f0c]));logger['info']('run\x20job',_0x17985c[_0x363f0c][_0x28bd('0x18')],_0x17985c[_0x363f0c][_0x28bd('0x4f')]);}else if(_0x17985c[_0x363f0c][_0x28bd('0x4f')]&&_0x17985c[_0x363f0c][_0x28bd('0x50')]&&moment()[_0x28bd('0x51')](_0x17985c[_0x363f0c][_0x28bd('0x52')],_0x17985c[_0x363f0c][_0x28bd('0x53')])){manager[_0x28bd('0x54')](_0x363f0c,_0x17985c[_0x363f0c]['cron'],handleJob(_0x17985c[_0x363f0c]));manager[_0x28bd('0x55')](_0x363f0c);logger['info'](_0x28bd('0x56'),_0x17985c[_0x363f0c][_0x28bd('0x18')],_0x17985c[_0x363f0c][_0x28bd('0x4f')]);}else if(manager[_0x28bd('0x48')](_0x363f0c)){manager[_0x28bd('0x49')](_0x363f0c);manager[_0x28bd('0x57')](_0x363f0c);logger[_0x28bd('0x2b')]('stop\x20cron',_0x17985c[_0x363f0c]['name'],_0x17985c[_0x363f0c][_0x28bd('0x4f')]);}}for(_0x5921a9=0x0,_0x363f0c;_0x5921a9<_0x3551eb[_0x28bd('0x47')]&&!_0x2875f2;_0x5921a9+=0x1){_0x363f0c=_0x3551eb[_0x5921a9][_0x28bd('0x45')]();if(manager[_0x28bd('0x48')](_0x363f0c)){if(_0x17985c[_0x363f0c][_0x28bd('0x4f')]&&_0x17985c[_0x363f0c][_0x28bd('0x50')]&&moment()[_0x28bd('0x51')](_0x17985c[_0x363f0c][_0x28bd('0x52')],_0x17985c[_0x363f0c][_0x28bd('0x53')])){manager['update'](_0x363f0c,_0x17985c[_0x363f0c][_0x28bd('0x4f')],handleJob(_0x17985c[_0x363f0c]));logger[_0x28bd('0x2b')](_0x28bd('0x58'),_0x17985c[_0x363f0c]['name'],_0x17985c[_0x363f0c][_0x28bd('0x4f')]);}else{manager[_0x28bd('0x49')](_0x363f0c);manager['deleteJob'](_0x363f0c);logger[_0x28bd('0x2b')]('stop\x20cron',_0x17985c[_0x363f0c][_0x28bd('0x18')],_0x17985c[_0x363f0c][_0x28bd('0x4f')]);}}}})['catch'](function(_0x3064fa){logger[_0x28bd('0x2e')](JSON[_0x28bd('0x24')](_0x3064fa));});}exports[_0x28bd('0x59')]=function(_0x3e7181){return getJobs(_0x3e7181);};exports[_0x28bd('0x55')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xe203=['email\x20sent','catch','error\x20mail','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','then','CustomReportId','runReport','no\x20report\x20id','findAll','MailServerOut','keys','map','toString','keyBy','intersection','difference','length','exists','stop','deleteJob','delete\x20cron','toRun','index','resolve','cron','active','isBetween','startAt','endAt','add','start','add\x20cron','stop\x20cron','update','run','lodash','cron-job-manager','jayson/promise','schedule','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','host','port','secure','authentication','auth','pass','format','\x22%s\x22\x20<%s>','name','user','bcc','subtractNumber','join','../../files/reports','savename','%s.%s','extname','zip','existsSync','status','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','sendIfEmpty','request','error'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0xe203,0x183));var _0x3e20=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe203[_0x3dd15e];return _0x231fd0;};'use strict';var fs=require('fs');var util=require('util');var path=require('path');var _=require(_0x3e20('0x0'));var moment=require('moment');var CronJobManager=require(_0x3e20('0x1'));var jayson=require(_0x3e20('0x2'));var BPromise=require('bluebird');var logger=require('../logger')(_0x3e20('0x3'));var db=require(_0x3e20('0x4'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x3e20('0x5'));var client=jayson[_0x3e20('0x6')][_0x3e20('0x7')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x25539e,_0x25b30f){return function(){logger[_0x3e20('0x8')](_0x3e20('0x9'),_0x25539e[_0x3e20('0xa')]);var _0x299bfe=!![];var _0x28c930={'tls':{'rejectUnauthorized':![]}};if(_0x25539e[_0x3e20('0xb')][_0x3e20('0xc')]['service']){_0x28c930[_0x3e20('0xd')]=_0x25539e[_0x3e20('0xb')][_0x3e20('0xc')][_0x3e20('0xd')];}else{_0x28c930[_0x3e20('0xe')]=_0x25539e[_0x3e20('0xb')][_0x3e20('0xc')][_0x3e20('0xe')];_0x28c930['port']=_0x25539e['MailAccount'][_0x3e20('0xc')][_0x3e20('0xf')];_0x28c930[_0x3e20('0x10')]=_0x25539e['MailAccount'][_0x3e20('0xc')]['secure'];}if(_0x25539e['MailAccount'][_0x3e20('0xc')][_0x3e20('0x11')]){_0x28c930[_0x3e20('0x12')]={'user':_0x25539e[_0x3e20('0xb')][_0x3e20('0xc')]['user'],'pass':_0x25539e[_0x3e20('0xb')]['Smtp'][_0x3e20('0x13')]};}var _0x224b3f={'account':_0x28c930,'message':{'from':util[_0x3e20('0x14')](_0x3e20('0x15'),_0x25539e[_0x3e20('0xb')][_0x3e20('0x16')],_0x25539e['MailAccount']['email']||_0x25539e[_0x3e20('0xb')][_0x3e20('0xc')][_0x3e20('0x17')]),'to':_0x25539e[_0x3e20('0xa')],'cc':_0x25539e['cc'],'bcc':_0x25539e[_0x3e20('0x18')],'subject':util[_0x3e20('0x14')]('Report\x20%s\x20last\x20%s\x20%s',_0x25b30f['name'],_0x25539e[_0x3e20('0x19')],_0x25539e['subtractUnit'])}};var _0x5d9ffb=path[_0x3e20('0x1a')](__dirname,_0x3e20('0x1b'));var _0x445048=_0x25b30f[_0x3e20('0x1c')];var _0x5a2d3a=util[_0x3e20('0x14')](_0x3e20('0x1d'),path['basename'](_0x25b30f['savename'],path[_0x3e20('0x1e')](_0x25b30f['savename'])),_0x3e20('0x1f'));var _0x443f3e=path[_0x3e20('0x1a')](_0x5d9ffb,_0x445048);var _0x42130b=path[_0x3e20('0x1a')](_0x5d9ffb,_0x5a2d3a);if(fs[_0x3e20('0x20')](_0x443f3e)){_0x25b30f[_0x3e20('0x21')]=_0x3e20('0x22');_0x224b3f[_0x3e20('0x23')][_0x3e20('0x24')]=[{'filename':_0x445048,'path':_0x443f3e}];_0x224b3f['message'][_0x3e20('0x25')]=util[_0x3e20('0x14')](_0x3e20('0x26'),JSON[_0x3e20('0x27')](_0x25b30f,null,0x2));}else if(fs[_0x3e20('0x20')](_0x42130b)){_0x25b30f['status']=_0x3e20('0x22');_0x224b3f['message'][_0x3e20('0x24')]=[{'filename':_0x5a2d3a,'path':_0x42130b}];}else{_0x224b3f['message'][_0x3e20('0x25')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x25539e[_0x3e20('0x28')]){_0x299bfe=![];logger[_0x3e20('0x8')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x299bfe){return client[_0x3e20('0x29')]('SendMail',_0x224b3f)['then'](function(_0x559d96){if(_0x559d96[_0x3e20('0x2a')]){return logger[_0x3e20('0x2a')]('error\x20mail',JSON[_0x3e20('0x27')](_0x559d96));}return logger[_0x3e20('0x8')](_0x3e20('0x2b'));})[_0x3e20('0x2c')](function(_0x4f1acf){return logger['error'](_0x3e20('0x2d'),JSON[_0x3e20('0x27')](_0x4f1acf));});}};}function handleError(){return function(_0x40cf6d){return logger[_0x3e20('0x2a')](JSON['stringify'](_0x40cf6d));};}function handleResult(_0x2d298b){return function(_0x1d0e8e){logger['info'](_0x3e20('0x2e'),JSON['stringify'](_0x1d0e8e));if(_0x2d298b[_0x3e20('0xb')]&&_0x2d298b[_0x3e20('0xb')][_0x3e20('0xc')]&&!_[_0x3e20('0x2f')](_0x2d298b[_0x3e20('0xa')])){setTimeout(handleSendEmail(_0x2d298b,_0x1d0e8e),0x3c*0x3e8);}};}function handleJob(_0x3e1d1e){return function(){try{if(_[_0x3e20('0x2f')](_0x3e1d1e[_0x3e20('0x19')])){return logger[_0x3e20('0x8')](_0x3e20('0x30'));}if(_['isNil'](_0x3e1d1e[_0x3e20('0x31')])){return logger[_0x3e20('0x8')](_0x3e20('0x32'));}var _0x51f20b={'startDate':moment()[_0x3e20('0x33')](_0x3e1d1e[_0x3e20('0x19')],_0x3e1d1e['subtractUnit'])[_0x3e20('0x14')](_0x3e20('0x34')),'endDate':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x3e20('0x35'),'output':_0x3e1d1e[_0x3e20('0x36')],'name':_0x3e1d1e[_0x3e20('0x16')]};if(!_['isNil'](_0x3e1d1e['DefaultReportId'])){logger['info']('exec\x20defaul\x20report\x20id:%s',_0x3e1d1e['DefaultReportId']);return analyticDefaultReportController['runReport']({'id':_0x3e1d1e['DefaultReportId']},_0x51f20b)[_0x3e20('0x37')](handleResult(_0x3e1d1e))[_0x3e20('0x2c')](handleError());}if(!_['isNil'](_0x3e1d1e[_0x3e20('0x38')])){logger['info']('exec\x20custom\x20report\x20id:%s',_0x3e1d1e[_0x3e20('0x38')]);return analyticCustomReportController[_0x3e20('0x39')]({'id':_0x3e1d1e[_0x3e20('0x38')]},_0x51f20b)['then'](handleResult(_0x3e1d1e))[_0x3e20('0x2c')](handleError());}}catch(_0x23b667){logger[_0x3e20('0x2a')](JSON[_0x3e20('0x27')](_0x23b667));}return logger['info'](_0x3e20('0x3a'));};}function getJobs(_0x4ff1f7){var _0x6bb5ab={};if(_0x4ff1f7){_0x6bb5ab['id']=_0x4ff1f7;}return db['Schedule'][_0x3e20('0x3b')]({'where':_0x6bb5ab,'include':[{'model':db[_0x3e20('0xb')],'attributes':['id',_0x3e20('0x16'),_0x3e20('0xa')],'include':[{'model':db[_0x3e20('0x3c')],'as':_0x3e20('0xc')}]}]})[_0x3e20('0x37')](function(_0x5c2192){var _0x137b1e=_[_0x3e20('0x3d')](manager['jobs']);var _0x49f766=_[_0x3e20('0x3e')](_0x5c2192,function(_0x2744fd){return _0x2744fd['id'][_0x3e20('0x3f')]();});var _0x1b10e4=_[_0x3e20('0x40')](_0x5c2192,function(_0x4f5a23){return _0x4f5a23['id'][_0x3e20('0x3f')]();});var _0x2d4298=_0x4ff1f7?_0x49f766:_['difference'](_0x49f766,_0x137b1e);var _0x40468d=_[_0x3e20('0x41')](_0x49f766,_0x137b1e);var _0x50c486=_[_0x3e20('0x42')](_0x137b1e,_0x49f766);var _0x269de6;var _0x24b046;for(_0x269de6=0x0;_0x269de6<_0x50c486[_0x3e20('0x43')]&&!_0x4ff1f7;_0x269de6+=0x1){_0x24b046=_0x50c486[_0x269de6]['toString']();if(manager[_0x3e20('0x44')](_0x24b046)){manager[_0x3e20('0x45')](_0x24b046);manager[_0x3e20('0x46')](_0x24b046);logger[_0x3e20('0x8')](_0x3e20('0x47'),_0x24b046);}}logger[_0x3e20('0x8')](_0x3e20('0x48'),JSON[_0x3e20('0x27')](_0x2d4298));for(_0x269de6=0x0;_0x269de6<_0x2d4298[_0x3e20('0x43')];_0x269de6+=0x1){_0x24b046=_0x2d4298[_0x269de6][_0x3e20('0x3f')]();logger[_0x3e20('0x8')](_0x3e20('0x49'),_0x24b046);if(_0x4ff1f7){logger[_0x3e20('0x8')]('my\x20id',_0x4ff1f7);logger[_0x3e20('0x8')](JSON[_0x3e20('0x27')](_0x1b10e4[_0x24b046]));BPromise[_0x3e20('0x4a')]()[_0x3e20('0x37')](handleJob(_0x1b10e4[_0x24b046]));logger['info']('run\x20job',_0x1b10e4[_0x24b046][_0x3e20('0x16')],_0x1b10e4[_0x24b046]['cron']);}else if(_0x1b10e4[_0x24b046][_0x3e20('0x4b')]&&_0x1b10e4[_0x24b046][_0x3e20('0x4c')]&&moment()[_0x3e20('0x4d')](_0x1b10e4[_0x24b046][_0x3e20('0x4e')],_0x1b10e4[_0x24b046][_0x3e20('0x4f')])){manager[_0x3e20('0x50')](_0x24b046,_0x1b10e4[_0x24b046][_0x3e20('0x4b')],handleJob(_0x1b10e4[_0x24b046]));manager[_0x3e20('0x51')](_0x24b046);logger[_0x3e20('0x8')](_0x3e20('0x52'),_0x1b10e4[_0x24b046][_0x3e20('0x16')],_0x1b10e4[_0x24b046]['cron']);}else if(manager[_0x3e20('0x44')](_0x24b046)){manager['stop'](_0x24b046);manager['deleteJob'](_0x24b046);logger[_0x3e20('0x8')](_0x3e20('0x53'),_0x1b10e4[_0x24b046][_0x3e20('0x16')],_0x1b10e4[_0x24b046]['cron']);}}for(_0x269de6=0x0,_0x24b046;_0x269de6<_0x40468d['length']&&!_0x4ff1f7;_0x269de6+=0x1){_0x24b046=_0x40468d[_0x269de6][_0x3e20('0x3f')]();if(manager[_0x3e20('0x44')](_0x24b046)){if(_0x1b10e4[_0x24b046][_0x3e20('0x4b')]&&_0x1b10e4[_0x24b046][_0x3e20('0x4c')]&&moment()[_0x3e20('0x4d')](_0x1b10e4[_0x24b046][_0x3e20('0x4e')],_0x1b10e4[_0x24b046][_0x3e20('0x4f')])){manager[_0x3e20('0x54')](_0x24b046,_0x1b10e4[_0x24b046][_0x3e20('0x4b')],handleJob(_0x1b10e4[_0x24b046]));logger[_0x3e20('0x8')]('update\x20cron',_0x1b10e4[_0x24b046][_0x3e20('0x16')],_0x1b10e4[_0x24b046]['cron']);}else{manager[_0x3e20('0x45')](_0x24b046);manager[_0x3e20('0x46')](_0x24b046);logger[_0x3e20('0x8')](_0x3e20('0x53'),_0x1b10e4[_0x24b046][_0x3e20('0x16')],_0x1b10e4[_0x24b046][_0x3e20('0x4b')]);}}}})[_0x3e20('0x2c')](function(_0x5183e6){logger['error'](JSON[_0x3e20('0x27')](_0x5183e6));});}exports[_0x3e20('0x55')]=function(_0x3da418){return getJobs(_0x3da418);};exports[_0x3e20('0x51')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index 00679a2..6a3b6a5 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 _0xdf79=['Mixed','Neutral','FAILED','update','FailureReason','tempSentiment','Transcript\x20not\x20available','CloudProvider','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Sentiment','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','findOne','Settings\x20not\x20available','transcribe','Transcribe\x20not\x20configured','forEach','all','start','request-promise','util','bluebird','../../mysqldb','../../config/logger','getTranscriptionJob','detectSentiment','substring','info','format','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','transcribeName','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','length','transcripts','transcript','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Positive','SentimentScore','Negative'];(function(_0x59d89e,_0x55edf5){var _0x554e93=function(_0x3d40bc){while(--_0x3d40bc){_0x59d89e['push'](_0x59d89e['shift']());}};_0x554e93(++_0x55edf5);}(_0xdf79,0xa7));var _0x9df7=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xdf79[_0x14add3];return _0x4a174f;};var _=require('lodash');var AWS=require('aws-sdk');var rp=require(_0x9df7('0x0'));var util=require(_0x9df7('0x1'));var BPromise=require(_0x9df7('0x2'));var db=require(_0x9df7('0x3'))['db'];var logger=require(_0x9df7('0x4'))('transcribe');function getTranscriptionJob(_0x5b7b63,_0x5c0301,_0x531eed,_0x975891){return new Promise(function(_0x23c80b,_0x3350cd){var _0x39f3c2=new AWS['TranscribeService']({'accessKeyId':_0x5c0301,'secretAccessKey':_0x5b7b63,'region':_0x531eed});_0x39f3c2[_0x9df7('0x5')]({'TranscriptionJobName':_0x975891},function(_0x4cc7d5,_0x1663c8){if(_0x4cc7d5){return _0x3350cd(_0x4cc7d5);}else{return _0x23c80b(_0x1663c8);}});});}function sentiment(_0x57abfe,_0x459c62,_0x1d86ed,_0x340553,_0x4ee4aa){return new Promise(function(_0x2b457d,_0x6d46a9){var _0x2296e7=new AWS['Comprehend']({'accessKeyId':_0x459c62,'secretAccessKey':_0x57abfe,'region':_0x1d86ed});_0x2296e7[_0x9df7('0x6')]({'Text':_0x340553,'LanguageCode':_0x4ee4aa[_0x9df7('0x7')](0x0,0x2)},function(_0x2b3cdb,_0x368f28){if(_0x2b3cdb){return _0x6d46a9(_0x2b3cdb);}else{return _0x2b457d(_0x368f28);}});});}function checkTranscribeJob(_0x2cbe7f,_0x878af2,_0x1c2bf0){var _0x6a24cb;return new BPromise(function(_0x1d9b30,_0x168f47){logger[_0x9df7('0x8')](util[_0x9df7('0x9')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x2cbe7f['id'],_0x2cbe7f['transcribeName']));return getTranscriptionJob(_0x1c2bf0[_0x9df7('0xa')],_0x1c2bf0[_0x9df7('0xb')],_0x878af2[_0x9df7('0xc')],_0x2cbe7f['transcribeName'])[_0x9df7('0xd')](function(_0x5cb6dc){logger['info'](util['format'](_0x9df7('0xe'),_0x2cbe7f['id'],_0x2cbe7f[_0x9df7('0xf')],_0x5cb6dc[_0x9df7('0x10')][_0x9df7('0x11')]));if(!_0x2cbe7f[_0x9df7('0x12')]){switch(_0x5cb6dc[_0x9df7('0x10')][_0x9df7('0x11')]){case _0x9df7('0x13'):var _0x1c9a02={'transcribeStatus':_0x5cb6dc[_0x9df7('0x10')][_0x9df7('0x11')],'fileUri':_0x5cb6dc[_0x9df7('0x10')][_0x9df7('0x14')]['TranscriptFileUri']};logger['info'](util[_0x9df7('0x9')](_0x9df7('0x15'),_0x2cbe7f['id']));return rp({'uri':_0x5cb6dc['TranscriptionJob'][_0x9df7('0x14')]['TranscriptFileUri'],'json':!![]})[_0x9df7('0xd')](function(_0x466d34){logger[_0x9df7('0x8')](util[_0x9df7('0x9')](_0x9df7('0x16'),_0x2cbe7f['id']));if(_0x466d34&&_0x466d34[_0x9df7('0x17')]&&_0x466d34[_0x9df7('0x17')]['transcripts']&&_0x466d34[_0x9df7('0x17')]['transcripts'][_0x9df7('0x18')]){_0x1c9a02[_0x9df7('0x12')]='';for(var _0x1fa27c=0x0;_0x1fa27c<_0x466d34['results'][_0x9df7('0x19')][_0x9df7('0x18')];_0x1fa27c++){_0x1c9a02[_0x9df7('0x12')]+=_0x466d34['results'][_0x9df7('0x19')][_0x1fa27c][_0x9df7('0x1a')]+'';}}return _0x2cbe7f['update'](_0x1c9a02);})[_0x9df7('0xd')](function(){logger['info'](util[_0x9df7('0x9')](_0x9df7('0x1b'),_0x2cbe7f['id']));if(!_0x2cbe7f['tempSentiment']){throw new db[(_0x9df7('0x1c'))][(_0x9df7('0x1d'))](_0x9df7('0x1e'));}if(!_0x878af2[_0x9df7('0x1f')]||!_0x878af2[_0x9df7('0x20')]||!_0x878af2[_0x9df7('0x21')]||!_0x878af2[_0x9df7('0x22')]||!_0x878af2[_0x9df7('0x23')]){throw new db['Sequelize'][(_0x9df7('0x1d'))](_0x9df7('0x24'));}if(!_0x1c9a02[_0x9df7('0x12')]){throw new Error('Transcript\x20not\x20available');}if(_0x878af2[_0x9df7('0x20')]===_0x1c2bf0['id']){return _0x1c2bf0;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings[_0x9df7('0x20')]}});}})[_0x9df7('0xd')](function(_0x327160){if(!_0x327160){throw new db[(_0x9df7('0x1c'))][(_0x9df7('0x1d'))](_0x9df7('0x25'));}if(!_0x327160['data1']||!_0x327160[_0x9df7('0xb')]){throw new db[(_0x9df7('0x1c'))][(_0x9df7('0x1d'))](_0x9df7('0x26'));}_0x6a24cb=_0x327160;logger[_0x9df7('0x8')](util[_0x9df7('0x9')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x2cbe7f['id']));return sentiment(_0x6a24cb[_0x9df7('0xa')],_0x6a24cb[_0x9df7('0xb')],_0x878af2[_0x9df7('0x21')],_0x1c9a02[_0x9df7('0x12')],_0x878af2['language']);})[_0x9df7('0xd')](function(_0x1ab3bd){logger[_0x9df7('0x8')](util[_0x9df7('0x9')](_0x9df7('0x27'),_0x2cbe7f['id']));return _0x2cbe7f['update']({'sentiment':_0x1ab3bd['Sentiment'],'sPositive':_0x1ab3bd['SentimentScore'][_0x9df7('0x28')],'sNegative':_0x1ab3bd[_0x9df7('0x29')][_0x9df7('0x2a')],'sMixed':_0x1ab3bd[_0x9df7('0x29')][_0x9df7('0x2b')],'sNeutral':_0x1ab3bd['SentimentScore'][_0x9df7('0x2c')]});})[_0x9df7('0xd')](function(){logger[_0x9df7('0x8')](util[_0x9df7('0x9')](_0x9df7('0x1b'),_0x2cbe7f['id']));_0x1d9b30();});case _0x9df7('0x2d'):return _0x2cbe7f[_0x9df7('0x2e')]({'transcribeStatus':_0x9df7('0x2d'),'failureReason':_0x5cb6dc[_0x9df7('0x10')][_0x9df7('0x2f')]})[_0x9df7('0xd')](function(){logger[_0x9df7('0x8')](util['format'](_0x9df7('0x1b'),_0x2cbe7f['id']));_0x1d9b30();});default:logger[_0x9df7('0x8')](util['format']('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x2cbe7f['id']));break;}}else{return BPromise['resolve']()[_0x9df7('0xd')](function(){if(!_0x2cbe7f[_0x9df7('0x30')]){throw new db[(_0x9df7('0x1c'))]['ValidationError'](_0x9df7('0x1e'));}if(!_0x878af2[_0x9df7('0x1f')]||!_0x878af2[_0x9df7('0x20')]||!_0x878af2[_0x9df7('0x21')]||!_0x878af2[_0x9df7('0x22')]||!_0x878af2[_0x9df7('0x23')]){throw new db['Sequelize'][(_0x9df7('0x1d'))](_0x9df7('0x24'));}if(!_0x2cbe7f[_0x9df7('0x12')]){throw new Error(_0x9df7('0x31'));}if(_0x878af2[_0x9df7('0x20')]===_0x1c2bf0['id']){return _0x1c2bf0;}else{return db[_0x9df7('0x32')]['findOne']({'where':{'id':_settings[_0x9df7('0x20')]}});}})[_0x9df7('0xd')](function(_0xe42193){if(!_0xe42193){throw new db[(_0x9df7('0x1c'))][(_0x9df7('0x1d'))](_0x9df7('0x25'));}if(!_0xe42193['data1']||!_0xe42193[_0x9df7('0xb')]){throw new db[(_0x9df7('0x1c'))][(_0x9df7('0x1d'))]('Cloud\x20Provider\x20not\x20configured');}_0x6a24cb=_0xe42193;logger[_0x9df7('0x8')](util[_0x9df7('0x9')](_0x9df7('0x33'),_0x2cbe7f['id']));return sentiment(_0x6a24cb[_0x9df7('0xa')],_0x6a24cb[_0x9df7('0xb')],_0x878af2[_0x9df7('0x21')],_0x2cbe7f[_0x9df7('0x12')],_0x878af2[_0x9df7('0x22')]);})['then'](function(_0x10f1d9){logger['info'](util[_0x9df7('0x9')](_0x9df7('0x27'),_0x2cbe7f['id']));return _0x2cbe7f[_0x9df7('0x2e')]({'sentiment':_0x10f1d9[_0x9df7('0x34')],'sPositive':_0x10f1d9[_0x9df7('0x29')][_0x9df7('0x28')],'sNegative':_0x10f1d9['SentimentScore'][_0x9df7('0x2a')],'sMixed':_0x10f1d9[_0x9df7('0x29')][_0x9df7('0x2b')],'sNeutral':_0x10f1d9[_0x9df7('0x29')][_0x9df7('0x2c')],'transcribeStatus':_0x9df7('0x13')});})['then'](function(){logger[_0x9df7('0x8')](util[_0x9df7('0x9')](_0x9df7('0x1b'),_0x2cbe7f['id']));_0x1d9b30();});}})[_0x9df7('0x35')](function(_0x1594db){if(_0x1594db){if(!_0x1594db[_0x9df7('0x36')]||_0x1594db[_0x9df7('0x36')]!==_0x9df7('0x37')){logger[_0x9df7('0x38')](util[_0x9df7('0x9')](_0x9df7('0x39'),_0x2cbe7f['id']),util[_0x9df7('0x3a')](_0x1594db,{'showHidden':![],'depth':null}));}}_0x1d9b30();});});}function checkTranscribe(){var _0x5e2211;var _0x1d8bfc;var _0x50c22b;return db[_0x9df7('0x3b')]['findAll']({'where':{'transcribeStatus':_0x9df7('0x3c')}})[_0x9df7('0xd')](function(_0x3a7683){if(!_0x3a7683||!_0x3a7683['length']){throw new db[(_0x9df7('0x1c'))][(_0x9df7('0x1d'))](_0x9df7('0x3d'));}_0x5e2211=_0x3a7683;return db[_0x9df7('0x3e')][_0x9df7('0x3f')]({'where':{'id':0x1}});})[_0x9df7('0xd')](function(_0x245d94){if(!_0x245d94){throw new db[(_0x9df7('0x1c'))][(_0x9df7('0x1d'))](_0x9df7('0x40'));}_0x1d8bfc=_0x245d94;if(!_0x1d8bfc[_0x9df7('0x41')]||!_0x1d8bfc['transcribeAccountId']||!_0x1d8bfc[_0x9df7('0xc')]||!_0x1d8bfc[_0x9df7('0x22')]||!_0x1d8bfc[_0x9df7('0x23')]){throw new db[(_0x9df7('0x1c'))]['ValidationError'](_0x9df7('0x42'));}return db[_0x9df7('0x32')]['findOne']({'where':{'id':_0x1d8bfc['transcribeAccountId']}});})['then'](function(_0x59f673){if(!_0x59f673){throw new db[(_0x9df7('0x1c'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x59f673['data1']||!_0x59f673[_0x9df7('0xb')]){throw new db[(_0x9df7('0x1c'))][(_0x9df7('0x1d'))](_0x9df7('0x26'));}_0x50c22b=_0x59f673;var _0x51e657=[];_0x5e2211[_0x9df7('0x43')](function(_0x440e0d){_0x51e657['push'](checkTranscribeJob(_0x440e0d,_0x1d8bfc,_0x50c22b));});return BPromise[_0x9df7('0x44')](_0x51e657);})[_0x9df7('0x35')](function(_0x389a77){if(_0x389a77){if(!_0x389a77[_0x9df7('0x36')]||_0x389a77[_0x9df7('0x36')]!==_0x9df7('0x37')){logger[_0x9df7('0x38')](util[_0x9df7('0x3a')](_0x389a77,{'showHidden':![],'depth':null}));}}});}exports[_0x9df7('0x45')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x3423=['[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','bucket','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','findOne','then','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','CloudProvider','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','Settings\x20not\x20available','Transcribe\x20not\x20configured','transcribeAccountId','forEach','push','error','start','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','transcribeRegion','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','update'];(function(_0x4bc0bd,_0x5d7b4e){var _0x4520f0=function(_0x212d89){while(--_0x212d89){_0x4bc0bd['push'](_0x4bc0bd['shift']());}};_0x4520f0(++_0x5d7b4e);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};var _=require('lodash');var AWS=require('aws-sdk');var rp=require(_0x3342('0x0'));var util=require(_0x3342('0x1'));var BPromise=require(_0x3342('0x2'));var db=require(_0x3342('0x3'))['db'];var logger=require(_0x3342('0x4'))(_0x3342('0x5'));function getTranscriptionJob(_0x2207ce,_0x3c5d8d,_0x3075f8,_0x19206f){return new Promise(function(_0x467453,_0x2ccbe0){var _0x29c40c=new AWS[(_0x3342('0x6'))]({'accessKeyId':_0x3c5d8d,'secretAccessKey':_0x2207ce,'region':_0x3075f8});_0x29c40c[_0x3342('0x7')]({'TranscriptionJobName':_0x19206f},function(_0xce08ab,_0x305d13){if(_0xce08ab){return _0x2ccbe0(_0xce08ab);}else{return _0x467453(_0x305d13);}});});}function sentiment(_0xd9d129,_0x9cc419,_0x4ae4f3,_0x582c37,_0x2d0cb0){return new Promise(function(_0x481a17,_0x5a1fba){var _0x51b276=new AWS['Comprehend']({'accessKeyId':_0x9cc419,'secretAccessKey':_0xd9d129,'region':_0x4ae4f3});_0x51b276[_0x3342('0x8')]({'Text':_0x582c37,'LanguageCode':_0x2d0cb0[_0x3342('0x9')](0x0,0x2)},function(_0x51496d,_0x2d14c4){if(_0x51496d){return _0x5a1fba(_0x51496d);}else{return _0x481a17(_0x2d14c4);}});});}function checkTranscribeJob(_0x5a3cb1,_0x716d80,_0x36e1f4){var _0x592ba8;return new BPromise(function(_0x3e418d,_0x334f0e){logger[_0x3342('0xa')](util[_0x3342('0xb')](_0x3342('0xc'),_0x5a3cb1['id'],_0x5a3cb1[_0x3342('0xd')]));return getTranscriptionJob(_0x36e1f4[_0x3342('0xe')],_0x36e1f4['data2'],_0x716d80[_0x3342('0xf')],_0x5a3cb1[_0x3342('0xd')])['then'](function(_0x40d609){logger[_0x3342('0xa')](util['format']('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x5a3cb1['id'],_0x5a3cb1[_0x3342('0xd')],_0x40d609[_0x3342('0x10')][_0x3342('0x11')]));if(!_0x5a3cb1[_0x3342('0x12')]){switch(_0x40d609[_0x3342('0x10')][_0x3342('0x11')]){case _0x3342('0x13'):var _0x3ebf6b={'transcribeStatus':_0x40d609[_0x3342('0x10')]['TranscriptionJobStatus'],'fileUri':_0x40d609[_0x3342('0x10')][_0x3342('0x14')][_0x3342('0x15')]};logger['info'](util[_0x3342('0xb')](_0x3342('0x16'),_0x5a3cb1['id']));return rp({'uri':_0x40d609['TranscriptionJob'][_0x3342('0x14')][_0x3342('0x15')],'json':!![]})['then'](function(_0x4e1b19){logger['info'](util[_0x3342('0xb')](_0x3342('0x17'),_0x5a3cb1['id']));if(_0x4e1b19&&_0x4e1b19[_0x3342('0x18')]&&_0x4e1b19[_0x3342('0x18')][_0x3342('0x19')]&&_0x4e1b19[_0x3342('0x18')][_0x3342('0x19')][_0x3342('0x1a')]){_0x3ebf6b['fileText']='';for(var _0x30ffc9=0x0;_0x30ffc9<_0x4e1b19['results']['transcripts'][_0x3342('0x1a')];_0x30ffc9++){_0x3ebf6b['fileText']+=_0x4e1b19['results'][_0x3342('0x19')][_0x30ffc9]['transcript']+'';}}return _0x5a3cb1[_0x3342('0x1b')](_0x3ebf6b);})['then'](function(){logger['info'](util['format'](_0x3342('0x1c'),_0x5a3cb1['id']));if(!_0x5a3cb1[_0x3342('0x1d')]){throw new db[(_0x3342('0x1e'))]['ValidationError'](_0x3342('0x1f'));}if(!_0x716d80[_0x3342('0x20')]||!_0x716d80[_0x3342('0x21')]||!_0x716d80[_0x3342('0x22')]||!_0x716d80['language']||!_0x716d80[_0x3342('0x23')]){throw new db[(_0x3342('0x1e'))][(_0x3342('0x24'))](_0x3342('0x25'));}if(!_0x3ebf6b[_0x3342('0x12')]){throw new Error(_0x3342('0x26'));}if(_0x716d80[_0x3342('0x21')]===_0x36e1f4['id']){return _0x36e1f4;}else{return db['CloudProvider'][_0x3342('0x27')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x3342('0x28')](function(_0x407f8c){if(!_0x407f8c){throw new db['Sequelize'][(_0x3342('0x24'))](_0x3342('0x29'));}if(!_0x407f8c[_0x3342('0xe')]||!_0x407f8c[_0x3342('0x2a')]){throw new db['Sequelize'][(_0x3342('0x24'))](_0x3342('0x2b'));}_0x592ba8=_0x407f8c;logger[_0x3342('0xa')](util[_0x3342('0xb')](_0x3342('0x2c'),_0x5a3cb1['id']));return sentiment(_0x592ba8[_0x3342('0xe')],_0x592ba8[_0x3342('0x2a')],_0x716d80[_0x3342('0x22')],_0x3ebf6b[_0x3342('0x12')],_0x716d80[_0x3342('0x2d')]);})[_0x3342('0x28')](function(_0x30dcea){logger['info'](util['format'](_0x3342('0x2e'),_0x5a3cb1['id']));return _0x5a3cb1['update']({'sentiment':_0x30dcea[_0x3342('0x2f')],'sPositive':_0x30dcea[_0x3342('0x30')][_0x3342('0x31')],'sNegative':_0x30dcea[_0x3342('0x30')][_0x3342('0x32')],'sMixed':_0x30dcea[_0x3342('0x30')][_0x3342('0x33')],'sNeutral':_0x30dcea['SentimentScore'][_0x3342('0x34')]});})[_0x3342('0x28')](function(){logger[_0x3342('0xa')](util[_0x3342('0xb')](_0x3342('0x1c'),_0x5a3cb1['id']));_0x3e418d();});case'FAILED':return _0x5a3cb1[_0x3342('0x1b')]({'transcribeStatus':'FAILED','failureReason':_0x40d609[_0x3342('0x10')][_0x3342('0x35')]})[_0x3342('0x28')](function(){logger[_0x3342('0xa')](util['format'](_0x3342('0x1c'),_0x5a3cb1['id']));_0x3e418d();});default:logger['info'](util[_0x3342('0xb')](_0x3342('0x36'),_0x5a3cb1['id']));break;}}else{return BPromise[_0x3342('0x37')]()[_0x3342('0x28')](function(){if(!_0x5a3cb1[_0x3342('0x1d')]){throw new db[(_0x3342('0x1e'))][(_0x3342('0x24'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x716d80[_0x3342('0x20')]||!_0x716d80[_0x3342('0x21')]||!_0x716d80['sentimentRegion']||!_0x716d80[_0x3342('0x2d')]||!_0x716d80[_0x3342('0x23')]){throw new db['Sequelize'][(_0x3342('0x24'))](_0x3342('0x25'));}if(!_0x5a3cb1['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x716d80['sentimentAccountId']===_0x36e1f4['id']){return _0x36e1f4;}else{return db[_0x3342('0x38')][_0x3342('0x27')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x3342('0x28')](function(_0x2a1f7e){if(!_0x2a1f7e){throw new db[(_0x3342('0x1e'))][(_0x3342('0x24'))](_0x3342('0x29'));}if(!_0x2a1f7e[_0x3342('0xe')]||!_0x2a1f7e[_0x3342('0x2a')]){throw new db[(_0x3342('0x1e'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x592ba8=_0x2a1f7e;logger[_0x3342('0xa')](util[_0x3342('0xb')](_0x3342('0x2c'),_0x5a3cb1['id']));return sentiment(_0x592ba8[_0x3342('0xe')],_0x592ba8[_0x3342('0x2a')],_0x716d80[_0x3342('0x22')],_0x5a3cb1['fileText'],_0x716d80[_0x3342('0x2d')]);})[_0x3342('0x28')](function(_0x283ce9){logger[_0x3342('0xa')](util[_0x3342('0xb')](_0x3342('0x2e'),_0x5a3cb1['id']));return _0x5a3cb1['update']({'sentiment':_0x283ce9[_0x3342('0x2f')],'sPositive':_0x283ce9['SentimentScore'][_0x3342('0x31')],'sNegative':_0x283ce9[_0x3342('0x30')][_0x3342('0x32')],'sMixed':_0x283ce9[_0x3342('0x30')]['Mixed'],'sNeutral':_0x283ce9[_0x3342('0x30')][_0x3342('0x34')],'transcribeStatus':'COMPLETED'});})[_0x3342('0x28')](function(){logger[_0x3342('0xa')](util[_0x3342('0xb')](_0x3342('0x1c'),_0x5a3cb1['id']));_0x3e418d();});}})['catch'](function(_0x2e2ebc){if(_0x2e2ebc){if(!_0x2e2ebc[_0x3342('0x39')]||_0x2e2ebc['name']!==_0x3342('0x3a')){logger['error'](util['format'](_0x3342('0x3b'),_0x5a3cb1['id']),util[_0x3342('0x3c')](_0x2e2ebc,{'showHidden':![],'depth':null}));}}_0x3e418d();});});}function checkTranscribe(){var _0x346534;var _0x296cbb;var _0x23925e;return db[_0x3342('0x3d')][_0x3342('0x3e')]({'where':{'transcribeStatus':'IN_PROGRESS'}})['then'](function(_0x3817fd){if(!_0x3817fd||!_0x3817fd['length']){throw new db[(_0x3342('0x1e'))]['ValidationError']('No\x20transcribe\x20job\x20to\x20check');}_0x346534=_0x3817fd;return db['Setting'][_0x3342('0x27')]({'where':{'id':0x1}});})[_0x3342('0x28')](function(_0x29ccb6){if(!_0x29ccb6){throw new db[(_0x3342('0x1e'))]['ValidationError'](_0x3342('0x3f'));}_0x296cbb=_0x29ccb6;if(!_0x296cbb[_0x3342('0x5')]||!_0x296cbb['transcribeAccountId']||!_0x296cbb[_0x3342('0xf')]||!_0x296cbb[_0x3342('0x2d')]||!_0x296cbb[_0x3342('0x23')]){throw new db['Sequelize'][(_0x3342('0x24'))](_0x3342('0x40'));}return db[_0x3342('0x38')][_0x3342('0x27')]({'where':{'id':_0x296cbb[_0x3342('0x41')]}});})['then'](function(_0x2699d2){if(!_0x2699d2){throw new db[(_0x3342('0x1e'))][(_0x3342('0x24'))](_0x3342('0x29'));}if(!_0x2699d2[_0x3342('0xe')]||!_0x2699d2[_0x3342('0x2a')]){throw new db[(_0x3342('0x1e'))][(_0x3342('0x24'))](_0x3342('0x2b'));}_0x23925e=_0x2699d2;var _0x542181=[];_0x346534[_0x3342('0x42')](function(_0x4eebaa){_0x542181[_0x3342('0x43')](checkTranscribeJob(_0x4eebaa,_0x296cbb,_0x23925e));});return BPromise['all'](_0x542181);})['catch'](function(_0x5bff74){if(_0x5bff74){if(!_0x5bff74['name']||_0x5bff74[_0x3342('0x39')]!==_0x3342('0x3a')){logger[_0x3342('0x44')](util[_0x3342('0x3c')](_0x5bff74,{'showHidden':![],'depth':null}));}}});}exports[_0x3342('0x45')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index e01d870..b4b3e39 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 _0xf935=['../logger','schedule','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','then','length','map','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','info','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','inspect','lodash','moment','ioredis','../../mysqldb'];(function(_0x1bce27,_0x468041){var _0x18747d=function(_0x1e2f93){while(--_0x1e2f93){_0x1bce27['push'](_0x1bce27['shift']());}};_0x18747d(++_0x468041);}(_0xf935,0xbc));var _0x5f93=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xf935[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x5f93('0x0'));var moment=require(_0x5f93('0x1'));var Redis=require(_0x5f93('0x2'));var util=require('util');var config=require('../../config/environment');var db=require(_0x5f93('0x3'))['db'];var logger=require(_0x5f93('0x4'))(_0x5f93('0x5'));config[_0x5f93('0x6')]=_[_0x5f93('0x7')](config[_0x5f93('0x6')],{'host':_0x5f93('0x8'),'port':0x18eb});var io=require(_0x5f93('0x9'))(new Redis(config[_0x5f93('0x6')]));function closeInteractions(){var _0x514976=[];return db[_0x5f93('0xa')][_0x5f93('0xb')]({'raw':!![],'attributes':['id',_0x5f93('0xc')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x5f93('0xd')](0x18,_0x5f93('0xe'))}}})[_0x5f93('0xf')](function(_0x23a2ac){if(_0x23a2ac&&_0x23a2ac[_0x5f93('0x10')]){_0x514976=_[_0x5f93('0x11')](_0x23a2ac||[],'id');logger['info'](_0x5f93('0x12'),_0x514976[_0x5f93('0x13')]());return db[_0x5f93('0xa')][_0x5f93('0x14')]({'closeReason':_0x5f93('0x15'),'disposition':_0x5f93('0x16'),'closed':!![],'closedAt':moment()[_0x5f93('0x17')](_0x5f93('0x18'))},{'where':{'id':_0x514976}});}})[_0x5f93('0xf')](function(){if(_0x514976&&_0x514976[_0x5f93('0x10')]){logger[_0x5f93('0x19')](_0x5f93('0x1a'),_0x514976['join']());for(var _0x535532=0x0;_0x535532<_0x514976['length'];_0x535532++){io[_0x5f93('0x1b')](_0x5f93('0x1c'),{'id':_0x514976[_0x535532],'closed':!![]});}}})[_0x5f93('0x1d')](function(_0x3130e7){logger[_0x5f93('0x1e')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x3130e7?util[_0x5f93('0x1f')](_0x3130e7,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x116a=['schedule','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','map','info','update','system','timeout','then','join','length','emit','whatsappInteraction:update','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash','moment','ioredis','util','../../config/environment','../logger'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0x116a,0x174));var _0xa116=function(_0x518b8b,_0x366fbf){_0x518b8b=_0x518b8b-0x0;var _0x1c8596=_0x116a[_0x518b8b];return _0x1c8596;};'use strict';var _=require(_0xa116('0x0'));var moment=require(_0xa116('0x1'));var Redis=require(_0xa116('0x2'));var util=require(_0xa116('0x3'));var config=require(_0xa116('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0xa116('0x5'))(_0xa116('0x6'));config[_0xa116('0x7')]=_[_0xa116('0x8')](config[_0xa116('0x7')],{'host':_0xa116('0x9'),'port':0x18eb});var io=require(_0xa116('0xa'))(new Redis(config[_0xa116('0x7')]));function closeInteractions(){var _0xf93552=[];return db[_0xa116('0xb')][_0xa116('0xc')]({'raw':!![],'attributes':['id',_0xa116('0xd')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,'hours')}}})['then'](function(_0x52925f){if(_0x52925f&&_0x52925f['length']){_0xf93552=_[_0xa116('0xe')](_0x52925f||[],'id');logger[_0xa116('0xf')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0xf93552['join']());return db['WhatsappInteraction'][_0xa116('0x10')]({'closeReason':_0xa116('0x11'),'disposition':_0xa116('0x12'),'closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0xf93552}});}})[_0xa116('0x13')](function(){if(_0xf93552&&_0xf93552['length']){logger[_0xa116('0xf')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0xf93552[_0xa116('0x14')]());for(var _0x27b457=0x0;_0x27b457<_0xf93552[_0xa116('0x15')];_0x27b457++){io[_0xa116('0x16')](_0xa116('0x17'),{'id':_0xf93552[_0x27b457],'closed':!![]});}}})['catch'](function(_0x5739de){logger[_0xa116('0x18')](_0xa116('0x19'),_0x5739de?util[_0xa116('0x1a')](_0x5739de,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 62f00ba..3c1bebb 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6b8b=['finished\x20populating','contacts1','CmHopper','log','hopper1','CmContact','hopper2','catch','push','Innocenzo','Biondo','innocenzo.biondo','now','@xcally.com','destroy','bulkCreate','then'];(function(_0x2d773c,_0xde83a0){var _0x16c275=function(_0x27b9c2){while(--_0x27b9c2){_0x2d773c['push'](_0x2d773c['shift']());}};_0x16c275(++_0xde83a0);}(_0x6b8b,0x1e4));var _0xb6b8=function(_0x4d26fb,_0x5a515e){_0x4d26fb=_0x4d26fb-0x0;var _0x2a7c15=_0x6b8b[_0x4d26fb];return _0x2a7c15;};'use strict';var util=require('util');var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xb6b8('0x0')]({'id':i,'firstName':_0xb6b8('0x1')+i,'lastName':_0xb6b8('0x2')+i,'phone':0xf879fb460+i,'email':_0xb6b8('0x3')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xb6b8('0x0')]({'id':i,'active':![],'scheduledat':Date[_0xb6b8('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xb6b8('0x4')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0xb6b8('0x1')+i,'lastName':_0xb6b8('0x2')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xb6b8('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xb6b8('0x0')]({'id':i,'active':![],'scheduledat':Date[_0xb6b8('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xb6b8('0x4')](),'updatedAt':Date['now']()});}db['CmContact'][_0xb6b8('0x6')]({'where':{}})['then'](function(){return db['CmContact'][_0xb6b8('0x7')](contacts);})[_0xb6b8('0x8')](function(){console['log'](_0xb6b8('0x9'),_0xb6b8('0xa'));return db['CmHopper'][_0xb6b8('0x6')]({'where':{}});})[_0xb6b8('0x8')](function(){return db[_0xb6b8('0xb')]['bulkCreate'](hopper);})[_0xb6b8('0x8')](function(){console[_0xb6b8('0xc')](_0xb6b8('0x9'),_0xb6b8('0xd'));return db[_0xb6b8('0xe')][_0xb6b8('0x7')](contacts2);})[_0xb6b8('0x8')](function(){console[_0xb6b8('0xc')](_0xb6b8('0x9'),'contacts2');return db[_0xb6b8('0xb')][_0xb6b8('0x7')](hopper2);})[_0xb6b8('0x8')](function(){console[_0xb6b8('0xc')](_0xb6b8('0x9'),_0xb6b8('0xf'));})[_0xb6b8('0x10')](function(_0xaf0e62){console[_0xb6b8('0xc')](_0xaf0e62);}); \ No newline at end of file +var _0x4afc=['Biondo','innocenzo.biondo','CmContact','destroy','then','log','CmHopper','bulkCreate','finished\x20populating','contacts2','hopper2','catch','util','../mysqldb','push','Innocenzo','@xcally.com','now'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x4afc,0x13e));var _0xc4af=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x4afc[_0x263a74];return _0x2aa86c;};'use strict';var util=require(_0xc4af('0x0'));var db=require(_0xc4af('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xc4af('0x2')]({'id':i,'firstName':_0xc4af('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xc4af('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xc4af('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xc4af('0x5')](),'updatedAt':Date[_0xc4af('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0xc4af('0x3')+i,'lastName':_0xc4af('0x6')+i,'phone':0xf879fb460+i,'email':_0xc4af('0x7')+i+_0xc4af('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xc4af('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xc4af('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xc4af('0x5')](),'updatedAt':Date[_0xc4af('0x5')]()});}db[_0xc4af('0x8')][_0xc4af('0x9')]({'where':{}})['then'](function(){return db[_0xc4af('0x8')]['bulkCreate'](contacts);})[_0xc4af('0xa')](function(){console[_0xc4af('0xb')]('finished\x20populating','contacts1');return db[_0xc4af('0xc')]['destroy']({'where':{}});})['then'](function(){return db['CmHopper']['bulkCreate'](hopper);})[_0xc4af('0xa')](function(){console['log']('finished\x20populating','hopper1');return db[_0xc4af('0x8')][_0xc4af('0xd')](contacts2);})[_0xc4af('0xa')](function(){console[_0xc4af('0xb')](_0xc4af('0xe'),_0xc4af('0xf'));return db['CmHopper']['bulkCreate'](hopper2);})[_0xc4af('0xa')](function(){console['log']('finished\x20populating',_0xc4af('0x10'));})[_0xc4af('0x11')](function(_0x17f9a8){console[_0xc4af('0xb')](_0x17f9a8);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index b3f1cab..ae7c7ad 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x42bd=['agent','%s%s@xcally.com','password','friend','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','bulkCreate','then','log','catch','util','../mysqldb','push','format','%s%s'];(function(_0x514969,_0x568fb0){var _0x326d9f=function(_0x7724a9){while(--_0x7724a9){_0x514969['push'](_0x514969['shift']());}};_0x326d9f(++_0x568fb0);}(_0x42bd,0x64));var _0xd42b=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x42bd[_0x13d07a];return _0x5ee0ee;};'use strict';var util=require(_0xd42b('0x0'));var db=require(_0xd42b('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xd42b('0x2')]({'name':util[_0xd42b('0x3')](_0xd42b('0x4'),'agent',i),'fullname':util[_0xd42b('0x3')]('%s%s',_0xd42b('0x5'),i),'email':util[_0xd42b('0x3')](_0xd42b('0x6'),_0xd42b('0x5'),i),'role':'agent','password':_0xd42b('0x7'),'internal':0xfa0+i,'type':_0xd42b('0x8'),'transport':['udp','ws',_0xd42b('0x9')],'disallow':[_0xd42b('0xa')],'allow':[_0xd42b('0xb')],'defaultuser':util[_0xd42b('0x3')](_0xd42b('0x4'),_0xd42b('0x5'),i),'encryption':_0xd42b('0xc'),'avpf':'yes','force_avp':_0xd42b('0xc'),'icesupport':_0xd42b('0xc'),'dtlsenable':_0xd42b('0xc'),'dtlsverify':'no','dtlscertfile':_0xd42b('0xd'),'dtlsprivatekey':_0xd42b('0xe'),'dtlssetup':_0xd42b('0xf'),'callerid':util['format'](_0xd42b('0x10'),util['format']('%s%s',_0xd42b('0x5'),i),0xfa0+i)});}db['User'][_0xd42b('0x11')](users)[_0xd42b('0x12')](function(){console[_0xd42b('0x13')]('add\x20user');})[_0xd42b('0x14')](function(_0x55af77){console[_0xd42b('0x13')](_0x55af77);}); \ No newline at end of file +var _0x99b8=['yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','then','log','add\x20user','catch','../mysqldb','push','format','%s%s','agent','friend','udp','wss','ulaw'];(function(_0x493dda,_0x1528d3){var _0x31a5a6=function(_0x43c676){while(--_0x43c676){_0x493dda['push'](_0x493dda['shift']());}};_0x31a5a6(++_0x1528d3);}(_0x99b8,0x7f));var _0x899b=function(_0x57a76c,_0x34edda){_0x57a76c=_0x57a76c-0x0;var _0x13996a=_0x99b8[_0x57a76c];return _0x13996a;};'use strict';var util=require('util');var db=require(_0x899b('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x899b('0x1')]({'name':util[_0x899b('0x2')](_0x899b('0x3'),_0x899b('0x4'),i),'fullname':util['format']('%s%s',_0x899b('0x4'),i),'email':util['format']('%s%s@xcally.com',_0x899b('0x4'),i),'role':_0x899b('0x4'),'password':'password','internal':0xfa0+i,'type':_0x899b('0x5'),'transport':[_0x899b('0x6'),'ws',_0x899b('0x7')],'disallow':['all'],'allow':[_0x899b('0x8')],'defaultuser':util[_0x899b('0x2')]('%s%s','agent',i),'encryption':_0x899b('0x9'),'avpf':_0x899b('0x9'),'force_avp':_0x899b('0x9'),'icesupport':_0x899b('0x9'),'dtlsenable':_0x899b('0x9'),'dtlsverify':'no','dtlscertfile':_0x899b('0xa'),'dtlsprivatekey':_0x899b('0xb'),'dtlssetup':'actpass','callerid':util[_0x899b('0x2')](_0x899b('0xc'),util[_0x899b('0x2')](_0x899b('0x3'),_0x899b('0x4'),i),0xfa0+i)});}db['User']['bulkCreate'](users)[_0x899b('0xd')](function(){console[_0x899b('0xe')](_0x899b('0xf'));})[_0x899b('0x10')](function(_0x44007f){console['log'](_0x44007f);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 79b54a0..bda6bec 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2a2b=['WhatsappQueues','findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','User','where','Campaign','ivr','format','%s:queue:%s','Agents','length','user:%s','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteractions','FaxInteraction','SmsInteraction','SmsInteractions','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:outbound','include','VoiceQueue','ChatQueue','push','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','voice:inbound','SmsQueues','Telephones','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','voice','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','campaign:%s:%s','user_has_chat_interactions:remove','leave','removeMailInteractions','emit','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','setMaxListeners','address','request','SocketIO\x20','DISCONNECTED','lodash','util','../mysqldb','./environment','name','role','agent','telephone','type','UserProfileSection','findOne','then','VoiceQueues','ChatQueues','FaxQueues','MailQueues','OpenchannelQueues'];(function(_0x16b638,_0x5cdab0){var _0xe53735=function(_0x1348bb){while(--_0x1348bb){_0x16b638['push'](_0x16b638['shift']());}};_0xe53735(++_0x5cdab0);}(_0x2a2b,0x1de));var _0xb2a2=function(_0x353ce9,_0x12ffea){_0x353ce9=_0x353ce9-0x0;var _0x2de21a=_0x2a2b[_0x353ce9];return _0x2de21a;};'use strict';var _=require(_0xb2a2('0x0'));var util=require(_0xb2a2('0x1'));var BPromise=require('bluebird');var db=require(_0xb2a2('0x2'))['db'];var config=require(_0xb2a2('0x3'));var queryQueues={'attributes':['id',_0xb2a2('0x4')],'include':[{'as':'Agents','model':db['User'],'attributes':['id','name',_0xb2a2('0x5')],'raw':!![],'where':{'role':_0xb2a2('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xb2a2('0x4')],'where':{'role':_0xb2a2('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0xb2a2('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0xb2a2('0x4')],'where':{'role':_0xb2a2('0x6')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0xb2a2('0x8')],'where':{'type':'ivr'}};function getAssociatedResources(_0x2fec72,_0x3e7917,_0x22bd5b){return db[_0xb2a2('0x9')][_0xb2a2('0xa')]({'where':{'name':_0x2fec72,'userProfileId':_0x3e7917},'raw':!![]})[_0xb2a2('0xb')](function(_0x430777){if(_0x430777){if(_0x430777['autoAssociation']){switch(_0x2fec72){case _0xb2a2('0xc'):case _0xb2a2('0xd'):case _0xb2a2('0xe'):case'SmsQueues':case _0xb2a2('0xf'):case _0xb2a2('0x10'):case _0xb2a2('0x11'):return db[_0x22bd5b]['findAll'](queryQueues);case'Telephones':return db[_0x22bd5b][_0xb2a2('0x12')](queryTelephones);case _0xb2a2('0x13'):return db[_0x22bd5b][_0xb2a2('0x12')](queryTrunks);case _0xb2a2('0x14'):return db[_0x22bd5b][_0xb2a2('0x12')](queryCampaigns);}}else{return db[_0xb2a2('0x15')][_0xb2a2('0x12')]({'attributes':[_0xb2a2('0x16')],'where':{'sectionId':_0x430777['id']},'raw':!![]})['then'](function(_0x26a932){if(_0x26a932){var _0x1785aa={'where':{'id':_[_0xb2a2('0x17')](_0x26a932,_0xb2a2('0x16'))},'raw':!![]};switch(_0x22bd5b){case _0xb2a2('0x18'):_0x1785aa[_0xb2a2('0x19')][_0xb2a2('0x5')]=_0xb2a2('0x7');break;case _0xb2a2('0x1a'):_0x1785aa[_0xb2a2('0x19')][_0xb2a2('0x8')]=_0xb2a2('0x1b');break;}return db[_0x22bd5b][_0xb2a2('0x12')](_0x1785aa);}else{return[];}});}}else{return[];}})[_0xb2a2('0xb')](function(_0x39553f){return _0x39553f;});}function joinOrLeaveQueues(_0x5855b2,_0x48c8f7,_0x3bffbc,_0x484bcc){_0x5855b2[_0x48c8f7](util[_0xb2a2('0x1c')](_0xb2a2('0x1d'),_0x3bffbc,_0x484bcc[_0xb2a2('0x4')]));if(_0x484bcc[_0xb2a2('0x1e')]){for(var _0x5930e3=0x0;_0x5930e3<_0x484bcc[_0xb2a2('0x1e')][_0xb2a2('0x1f')];_0x5930e3+=0x1){_0x5855b2[_0x48c8f7](util[_0xb2a2('0x1c')](_0xb2a2('0x20'),_0x484bcc[_0xb2a2('0x1e')][_0x5930e3][_0xb2a2('0x4')]));}}}function joinOrLeave(_0x3175d5,_0x13b8b6,_0xe052c5){var _0xe01b68;if(_0x3175d5[_0xb2a2('0x21')][_0xb2a2('0x22')]['id']){db[_0xb2a2('0x18')][_0xb2a2('0x23')]({'attributes':['id',_0xb2a2('0x4'),_0xb2a2('0x5'),_0xb2a2('0x24')],'where':{'id':_0x3175d5[_0xb2a2('0x21')][_0xb2a2('0x22')]['id']},'include':[{'model':db[_0xb2a2('0x25')],'as':_0xb2a2('0x26'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0xb2a2('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0xb2a2('0x28')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xb2a2('0x29')],'as':_0xb2a2('0x2a'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0xb2a2('0x2b'),'attributes':['id'],'raw':!![]},{'model':db[_0xb2a2('0x2c')],'as':_0xb2a2('0x2d'),'attributes':['id'],'raw':!![]}]})[_0xb2a2('0xb')](function(_0x5d5836){if(_0x5d5836){_0xe01b68=_0x5d5836;_0x3175d5[_0x13b8b6](util['format'](_0xb2a2('0x20'),_0x5d5836[_0xb2a2('0x4')]));var _0x19673a=[];switch(_0x5d5836[_0xb2a2('0x5')]){case _0xb2a2('0x2e'):_0x3175d5[_0x13b8b6]('voice:inbound');_0x3175d5[_0x13b8b6](_0xb2a2('0x2f'));if(queryQueues['hasOwnProperty'](_0xb2a2('0x30'))){delete queryQueues[_0xb2a2('0x30')];}_0x19673a['push'](db[_0xb2a2('0x31')][_0xb2a2('0x12')](queryQueues));_0x19673a['push'](db[_0xb2a2('0x32')][_0xb2a2('0x12')](queryQueues));_0x19673a[_0xb2a2('0x33')](db[_0xb2a2('0x34')]['findAll'](queryQueues));_0x19673a[_0xb2a2('0x33')](db[_0xb2a2('0x35')][_0xb2a2('0x12')](queryQueues));_0x19673a[_0xb2a2('0x33')](db[_0xb2a2('0x36')]['findAll'](queryQueues));_0x19673a[_0xb2a2('0x33')](db[_0xb2a2('0x37')][_0xb2a2('0x12')](queryQueues));_0x19673a[_0xb2a2('0x33')](db[_0xb2a2('0x38')]['findAll'](queryQueues));_0x19673a[_0xb2a2('0x33')](db[_0xb2a2('0x18')][_0xb2a2('0x12')](queryTelephones));_0x19673a[_0xb2a2('0x33')](db[_0xb2a2('0x39')][_0xb2a2('0x12')](queryTrunks));_0x19673a[_0xb2a2('0x33')](db['Campaign']['findAll'](queryCampaigns));_0x19673a[_0xb2a2('0x33')](db[_0xb2a2('0x18')][_0xb2a2('0x12')](queryAgents));break;case _0xb2a2('0x3a'):_0x3175d5[_0x13b8b6](_0xb2a2('0x3b'));_0x3175d5[_0x13b8b6](_0xb2a2('0x2f'));_0x19673a[_0xb2a2('0x33')](getAssociatedResources(_0xb2a2('0xc'),_0x5d5836['userProfileId'],'VoiceQueue'));_0x19673a[_0xb2a2('0x33')](getAssociatedResources(_0xb2a2('0xd'),_0x5d5836[_0xb2a2('0x24')],'ChatQueue'));_0x19673a[_0xb2a2('0x33')](getAssociatedResources(_0xb2a2('0xe'),_0x5d5836[_0xb2a2('0x24')],_0xb2a2('0x34')));_0x19673a[_0xb2a2('0x33')](getAssociatedResources(_0xb2a2('0x3c'),_0x5d5836[_0xb2a2('0x24')],_0xb2a2('0x35')));_0x19673a['push'](getAssociatedResources('MailQueues',_0x5d5836[_0xb2a2('0x24')],_0xb2a2('0x36')));_0x19673a[_0xb2a2('0x33')](getAssociatedResources(_0xb2a2('0x10'),_0x5d5836[_0xb2a2('0x24')],_0xb2a2('0x37')));_0x19673a[_0xb2a2('0x33')](getAssociatedResources(_0xb2a2('0x11'),_0x5d5836[_0xb2a2('0x24')],_0xb2a2('0x38')));_0x19673a[_0xb2a2('0x33')](getAssociatedResources(_0xb2a2('0x3d'),_0x5d5836[_0xb2a2('0x24')],_0xb2a2('0x18')));_0x19673a['push'](getAssociatedResources('Trunks',_0x5d5836[_0xb2a2('0x24')],_0xb2a2('0x39')));_0x19673a[_0xb2a2('0x33')](getAssociatedResources(_0xb2a2('0x14'),_0x5d5836[_0xb2a2('0x24')],'Campaign'));_0x19673a[_0xb2a2('0x33')](db['User'][_0xb2a2('0x12')](queryAgents));break;case _0xb2a2('0x6'):_0x3175d5[_0x13b8b6](_0xb2a2('0x3b'));_0x3175d5[_0x13b8b6](_0xb2a2('0x2f'));_0x19673a[_0xb2a2('0x33')](_0x5d5836[_0xb2a2('0x3e')]({'attributes':['id',_0xb2a2('0x4')]}));_0x19673a[_0xb2a2('0x33')](_0x5d5836[_0xb2a2('0x3f')]({'attributes':['id',_0xb2a2('0x4')]}));_0x19673a['push'](_0x5d5836[_0xb2a2('0x40')]({'attributes':['id',_0xb2a2('0x4')]}));_0x19673a[_0xb2a2('0x33')](_0x5d5836[_0xb2a2('0x41')]({'attributes':['id',_0xb2a2('0x4')]}));_0x19673a[_0xb2a2('0x33')](_0x5d5836[_0xb2a2('0x42')]({'attributes':['id',_0xb2a2('0x4')]}));_0x19673a['push'](_0x5d5836[_0xb2a2('0x43')]({'attributes':['id',_0xb2a2('0x4')]}));_0x19673a[_0xb2a2('0x33')](_0x5d5836['getWhatsappQueues']({'attributes':['id',_0xb2a2('0x4')]}));break;}return BPromise['all'](_0x19673a);}})[_0xb2a2('0xb')](function(_0x244c0a){if(_0x244c0a&&_0x244c0a[_0xb2a2('0x1f')]){for(var _0xf580d9=0x0;_0xf580d9<_0x244c0a[_0xb2a2('0x1f')];_0xf580d9+=0x1){for(var _0x555b63=0x0;_0x555b63<_0x244c0a[_0xf580d9][_0xb2a2('0x1f')];_0x555b63+=0x1){switch(_0xf580d9){case 0x0:joinOrLeaveQueues(_0x3175d5,_0x13b8b6,_0xb2a2('0x44'),_0x244c0a[_0xf580d9][_0x555b63]);break;case 0x1:joinOrLeaveQueues(_0x3175d5,_0x13b8b6,_0xb2a2('0x45'),_0x244c0a[_0xf580d9][_0x555b63]);break;case 0x2:joinOrLeaveQueues(_0x3175d5,_0x13b8b6,_0xb2a2('0x46'),_0x244c0a[_0xf580d9][_0x555b63]);break;case 0x3:joinOrLeaveQueues(_0x3175d5,_0x13b8b6,_0xb2a2('0x47'),_0x244c0a[_0xf580d9][_0x555b63]);break;case 0x4:joinOrLeaveQueues(_0x3175d5,_0x13b8b6,_0xb2a2('0x48'),_0x244c0a[_0xf580d9][_0x555b63]);break;case 0x5:joinOrLeaveQueues(_0x3175d5,_0x13b8b6,_0xb2a2('0x49'),_0x244c0a[_0xf580d9][_0x555b63]);break;case 0x6:joinOrLeaveQueues(_0x3175d5,_0x13b8b6,_0xb2a2('0x4a'),_0x244c0a[_0xf580d9][_0x555b63]);break;case 0x7:if(_0xe01b68['role']!=='agent')_0x3175d5[_0x13b8b6](util[_0xb2a2('0x1c')](_0xb2a2('0x4b'),_0x244c0a[_0xf580d9][_0x555b63][_0xb2a2('0x4')]));break;case 0x8:if(_0xe01b68[_0xb2a2('0x5')]!==_0xb2a2('0x6'))_0x3175d5[_0x13b8b6](util[_0xb2a2('0x1c')]('trunk:%s',_0x244c0a[_0xf580d9][_0x555b63][_0xb2a2('0x4')]));break;case 0x9:if(_0xe01b68['role']!==_0xb2a2('0x6'))_0x3175d5[_0x13b8b6](util[_0xb2a2('0x1c')](_0xb2a2('0x4c'),_0x244c0a[_0xf580d9][_0x555b63][_0xb2a2('0x8')],_0x244c0a[_0xf580d9][_0x555b63][_0xb2a2('0x4')]));break;case 0xa:_0x3175d5[_0x13b8b6](util[_0xb2a2('0x1c')](_0xb2a2('0x20'),_0x244c0a[_0xf580d9][_0x555b63]['name']));break;}}}}})[_0xb2a2('0xb')](function(){if(_0x13b8b6==='leave'){var _0x190f14=_[_0xb2a2('0x17')](_0xe01b68[_0xb2a2('0x26')],'id');return _0xe01b68['removeChatInteractions'](_0x190f14)[_0xb2a2('0xb')](function(){for(var _0x1be4a9=0x0;_0x1be4a9<_0x190f14['length'];_0x1be4a9+=0x1){_0xe052c5['emit'](_0xb2a2('0x4d'),{'ChatInteractionId':Number(_0x190f14[_0x1be4a9]),'UserId':Number(_0xe01b68['id'])});}});}})[_0xb2a2('0xb')](function(){if(_0x13b8b6===_0xb2a2('0x4e')){var _0x4def54=_[_0xb2a2('0x17')](_0xe01b68[_0xb2a2('0x27')],'id');return _0xe01b68[_0xb2a2('0x4f')](_0x4def54)[_0xb2a2('0xb')](function(){for(var _0x43bc38=0x0;_0x43bc38<_0x4def54[_0xb2a2('0x1f')];_0x43bc38+=0x1){_0xe052c5[_0xb2a2('0x50')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x4def54[_0x43bc38]),'UserId':Number(_0xe01b68['id'])});}});}})[_0xb2a2('0xb')](function(){if(_0x13b8b6===_0xb2a2('0x4e')){var _0x2de2ef=_[_0xb2a2('0x17')](_0xe01b68['FaxInteractions'],'id');return _0xe01b68[_0xb2a2('0x51')](_0x2de2ef)[_0xb2a2('0xb')](function(){for(var _0x2eb44c=0x0;_0x2eb44c<_0x2de2ef[_0xb2a2('0x1f')];_0x2eb44c+=0x1){_0xe052c5['emit'](_0xb2a2('0x52'),{'FaxInteractionId':Number(_0x2de2ef[_0x2eb44c]),'UserId':Number(_0xe01b68['id'])});}});}})[_0xb2a2('0xb')](function(){if(_0x13b8b6===_0xb2a2('0x4e')){var _0x336c41=_['map'](_0xe01b68[_0xb2a2('0x2a')],'id');return _0xe01b68[_0xb2a2('0x53')](_0x336c41)['then'](function(){for(var _0x5023b1=0x0;_0x5023b1<_0x336c41['length'];_0x5023b1+=0x1){_0xe052c5[_0xb2a2('0x50')](_0xb2a2('0x54'),{'SmsInteractionId':Number(_0x336c41[_0x5023b1]),'UserId':Number(_0xe01b68['id'])});}});}})[_0xb2a2('0xb')](function(){if(_0x13b8b6===_0xb2a2('0x4e')){var _0x4190e8=_[_0xb2a2('0x17')](_0xe01b68['OpenchannelInteractions'],'id');return _0xe01b68[_0xb2a2('0x55')](_0x4190e8)['then'](function(){for(var _0xa60784=0x0;_0xa60784<_0x4190e8[_0xb2a2('0x1f')];_0xa60784+=0x1){_0xe052c5['emit'](_0xb2a2('0x56'),{'OpenchannelInteractionId':Number(_0x4190e8[_0xa60784]),'UserId':Number(_0xe01b68['id'])});}});}})[_0xb2a2('0xb')](function(){if(_0x13b8b6==='leave'){var _0x4851a1=_[_0xb2a2('0x17')](_0xe01b68['WhatsappInteractions'],'id');return _0xe01b68[_0xb2a2('0x57')](_0x4851a1)['then'](function(){for(var _0x3a6b7f=0x0;_0x3a6b7f<_0x4851a1[_0xb2a2('0x1f')];_0x3a6b7f+=0x1){_0xe052c5[_0xb2a2('0x50')](_0xb2a2('0x58'),{'WhatsappInteractionId':Number(_0x4851a1[_0x3a6b7f]),'UserId':Number(_0xe01b68['id'])});}});}})[_0xb2a2('0x59')](function(_0x11c1fd){_0x3175d5[_0xb2a2('0x5a')](_0x11c1fd);});}}function onDisconnect(_0x28c847,_0x50af9f){joinOrLeave(_0x28c847,_0xb2a2('0x4e'),_0x50af9f);}function onConnect(_0x95fe24){joinOrLeave(_0x95fe24,_0xb2a2('0x5b'));}exports[_0xb2a2('0x5c')]=function(_0x427daa){_0x427daa['on'](_0xb2a2('0x5d'),function(_0x4db211){_0x4db211[_0xb2a2('0x5e')](0x0);_0x4db211[_0xb2a2('0x5f')]=_0x4db211[_0xb2a2('0x60')]['connection']['remoteAddress']+':'+_0x4db211['request'][_0xb2a2('0x5d')]['remotePort'];_0x4db211['connectedAt']=new Date();_0x4db211[_0xb2a2('0x5a')]=function(_0x2f7140){console['log'](_0xb2a2('0x61')+_0x4db211['nsp']['name']+'['+_0x4db211[_0xb2a2('0x5f')]+']',_0x2f7140);};_0x4db211['on']('disconnect',function(){onDisconnect(_0x4db211,_0x427daa);_0x4db211[_0xb2a2('0x5a')](_0xb2a2('0x62'));});onConnect(_0x4db211);_0x4db211[_0xb2a2('0x5a')]('CONNECTED');});}; \ No newline at end of file +var _0x8d62=['FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','include','push','ChatQueue','SmsQueue','OpenchannelQueue','WhatsappQueue','Campaign','user','VoiceQueues','VoiceQueue','FaxQueue','MailQueue','getChatQueues','getFaxQueues','getMailQueues','getWhatsappQueues','all','voice','mail','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','user:%s','leave','removeChatInteractions','user_has_chat_interactions:remove','user_has_mail_interactions:remove','removeFaxInteractions','emit','user_has_fax_interactions:remove','removeSmsInteractions','user_has_whatsapp_interactions:remove','catch','join','default','connection','setMaxListeners','request','remoteAddress','connectedAt','log','SocketIO\x20','nsp','DISCONNECTED','util','bluebird','../mysqldb','./environment','name','Agents','User','role','agent','telephone','type','ivr','UserProfileSection','findOne','then','autoAssociation','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','%s:queue:%s','length','format','handshake','query','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions'];(function(_0x25917a,_0x1617e1){var _0x2e5603=function(_0x9625b2){while(--_0x9625b2){_0x25917a['push'](_0x25917a['shift']());}};_0x2e5603(++_0x1617e1);}(_0x8d62,0xf8));var _0x28d6=function(_0x46f7f4,_0x3ad8b8){_0x46f7f4=_0x46f7f4-0x0;var _0x1cceee=_0x8d62[_0x46f7f4];return _0x1cceee;};'use strict';var _=require('lodash');var util=require(_0x28d6('0x0'));var BPromise=require(_0x28d6('0x1'));var db=require(_0x28d6('0x2'))['db'];var config=require(_0x28d6('0x3'));var queryQueues={'attributes':['id',_0x28d6('0x4')],'include':[{'as':_0x28d6('0x5'),'model':db[_0x28d6('0x6')],'attributes':['id',_0x28d6('0x4'),_0x28d6('0x7')],'raw':!![],'where':{'role':_0x28d6('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x28d6('0x4')],'where':{'role':_0x28d6('0x9')}};var queryTrunks={'raw':!![],'attributes':['id',_0x28d6('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0x28d6('0x4')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x28d6('0x4'),_0x28d6('0xa')],'where':{'type':_0x28d6('0xb')}};function getAssociatedResources(_0x525c82,_0x274468,_0x4b564f){return db[_0x28d6('0xc')][_0x28d6('0xd')]({'where':{'name':_0x525c82,'userProfileId':_0x274468},'raw':!![]})[_0x28d6('0xe')](function(_0x239297){if(_0x239297){if(_0x239297[_0x28d6('0xf')]){switch(_0x525c82){case'VoiceQueues':case _0x28d6('0x10'):case _0x28d6('0x11'):case _0x28d6('0x12'):case _0x28d6('0x13'):case _0x28d6('0x14'):case _0x28d6('0x15'):return db[_0x4b564f][_0x28d6('0x16')](queryQueues);case _0x28d6('0x17'):return db[_0x4b564f]['findAll'](queryTelephones);case _0x28d6('0x18'):return db[_0x4b564f][_0x28d6('0x16')](queryTrunks);case _0x28d6('0x19'):return db[_0x4b564f]['findAll'](queryCampaigns);}}else{return db[_0x28d6('0x1a')]['findAll']({'attributes':[_0x28d6('0x1b')],'where':{'sectionId':_0x239297['id']},'raw':!![]})[_0x28d6('0xe')](function(_0x4b82e2){if(_0x4b82e2){var _0x1881a8={'where':{'id':_[_0x28d6('0x1c')](_0x4b82e2,_0x28d6('0x1b'))},'raw':!![]};switch(_0x4b564f){case _0x28d6('0x6'):_0x1881a8[_0x28d6('0x1d')]['role']=_0x28d6('0x9');break;case'Campaign':_0x1881a8[_0x28d6('0x1d')][_0x28d6('0xa')]=_0x28d6('0xb');break;}return db[_0x4b564f][_0x28d6('0x16')](_0x1881a8);}else{return[];}});}}else{return[];}})[_0x28d6('0xe')](function(_0x2f1b6b){return _0x2f1b6b;});}function joinOrLeaveQueues(_0x2d521d,_0x55f190,_0x29cfbf,_0x20f2fd){_0x2d521d[_0x55f190](util['format'](_0x28d6('0x1e'),_0x29cfbf,_0x20f2fd[_0x28d6('0x4')]));if(_0x20f2fd[_0x28d6('0x5')]){for(var _0x252c1d=0x0;_0x252c1d<_0x20f2fd[_0x28d6('0x5')][_0x28d6('0x1f')];_0x252c1d+=0x1){_0x2d521d[_0x55f190](util[_0x28d6('0x20')]('user:%s',_0x20f2fd[_0x28d6('0x5')][_0x252c1d]['name']));}}}function joinOrLeave(_0x4572ff,_0x2288eb,_0x455dd6){var _0x3d128b;if(_0x4572ff[_0x28d6('0x21')][_0x28d6('0x22')]['id']){db['User']['find']({'attributes':['id',_0x28d6('0x4'),_0x28d6('0x7'),_0x28d6('0x23')],'where':{'id':_0x4572ff[_0x28d6('0x21')]['query']['id']},'include':[{'model':db[_0x28d6('0x24')],'as':_0x28d6('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x28d6('0x26')],'as':_0x28d6('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x28d6('0x28')],'as':_0x28d6('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x28d6('0x2a')],'as':_0x28d6('0x2b'),'attributes':['id'],'raw':!![]},{'model':db[_0x28d6('0x2c')],'as':_0x28d6('0x2d'),'attributes':['id'],'raw':!![]},{'model':db[_0x28d6('0x2e')],'as':_0x28d6('0x2f'),'attributes':['id'],'raw':!![]}]})[_0x28d6('0xe')](function(_0x3ba89f){if(_0x3ba89f){_0x3d128b=_0x3ba89f;_0x4572ff[_0x2288eb](util['format']('user:%s',_0x3ba89f[_0x28d6('0x4')]));var _0x8bb534=[];switch(_0x3ba89f[_0x28d6('0x7')]){case _0x28d6('0x30'):_0x4572ff[_0x2288eb](_0x28d6('0x31'));_0x4572ff[_0x2288eb](_0x28d6('0x32'));if(queryQueues['hasOwnProperty'](_0x28d6('0x33'))){delete queryQueues['include'];}_0x8bb534[_0x28d6('0x34')](db['VoiceQueue'][_0x28d6('0x16')](queryQueues));_0x8bb534[_0x28d6('0x34')](db[_0x28d6('0x35')][_0x28d6('0x16')](queryQueues));_0x8bb534[_0x28d6('0x34')](db['FaxQueue']['findAll'](queryQueues));_0x8bb534[_0x28d6('0x34')](db[_0x28d6('0x36')]['findAll'](queryQueues));_0x8bb534[_0x28d6('0x34')](db['MailQueue'][_0x28d6('0x16')](queryQueues));_0x8bb534['push'](db[_0x28d6('0x37')]['findAll'](queryQueues));_0x8bb534[_0x28d6('0x34')](db[_0x28d6('0x38')][_0x28d6('0x16')](queryQueues));_0x8bb534[_0x28d6('0x34')](db[_0x28d6('0x6')][_0x28d6('0x16')](queryTelephones));_0x8bb534[_0x28d6('0x34')](db['Trunk'][_0x28d6('0x16')](queryTrunks));_0x8bb534[_0x28d6('0x34')](db[_0x28d6('0x39')][_0x28d6('0x16')](queryCampaigns));_0x8bb534['push'](db[_0x28d6('0x6')][_0x28d6('0x16')](queryAgents));break;case _0x28d6('0x3a'):_0x4572ff[_0x2288eb](_0x28d6('0x31'));_0x4572ff[_0x2288eb]('voice:outbound');_0x8bb534[_0x28d6('0x34')](getAssociatedResources(_0x28d6('0x3b'),_0x3ba89f[_0x28d6('0x23')],_0x28d6('0x3c')));_0x8bb534[_0x28d6('0x34')](getAssociatedResources(_0x28d6('0x10'),_0x3ba89f[_0x28d6('0x23')],_0x28d6('0x35')));_0x8bb534[_0x28d6('0x34')](getAssociatedResources(_0x28d6('0x11'),_0x3ba89f[_0x28d6('0x23')],_0x28d6('0x3d')));_0x8bb534[_0x28d6('0x34')](getAssociatedResources(_0x28d6('0x12'),_0x3ba89f[_0x28d6('0x23')],_0x28d6('0x36')));_0x8bb534['push'](getAssociatedResources('MailQueues',_0x3ba89f['userProfileId'],_0x28d6('0x3e')));_0x8bb534['push'](getAssociatedResources('OpenchannelQueues',_0x3ba89f[_0x28d6('0x23')],'OpenchannelQueue'));_0x8bb534[_0x28d6('0x34')](getAssociatedResources(_0x28d6('0x15'),_0x3ba89f['userProfileId'],_0x28d6('0x38')));_0x8bb534[_0x28d6('0x34')](getAssociatedResources(_0x28d6('0x17'),_0x3ba89f[_0x28d6('0x23')],_0x28d6('0x6')));_0x8bb534[_0x28d6('0x34')](getAssociatedResources(_0x28d6('0x18'),_0x3ba89f[_0x28d6('0x23')],'Trunk'));_0x8bb534[_0x28d6('0x34')](getAssociatedResources(_0x28d6('0x19'),_0x3ba89f['userProfileId'],_0x28d6('0x39')));_0x8bb534[_0x28d6('0x34')](db[_0x28d6('0x6')]['findAll'](queryAgents));break;case _0x28d6('0x8'):_0x4572ff[_0x2288eb](_0x28d6('0x31'));_0x4572ff[_0x2288eb](_0x28d6('0x32'));_0x8bb534[_0x28d6('0x34')](_0x3ba89f['getVoiceQueues']({'attributes':['id',_0x28d6('0x4')]}));_0x8bb534[_0x28d6('0x34')](_0x3ba89f[_0x28d6('0x3f')]({'attributes':['id','name']}));_0x8bb534[_0x28d6('0x34')](_0x3ba89f[_0x28d6('0x40')]({'attributes':['id',_0x28d6('0x4')]}));_0x8bb534[_0x28d6('0x34')](_0x3ba89f['getSmsQueues']({'attributes':['id',_0x28d6('0x4')]}));_0x8bb534[_0x28d6('0x34')](_0x3ba89f[_0x28d6('0x41')]({'attributes':['id',_0x28d6('0x4')]}));_0x8bb534[_0x28d6('0x34')](_0x3ba89f['getOpenchannelQueues']({'attributes':['id',_0x28d6('0x4')]}));_0x8bb534[_0x28d6('0x34')](_0x3ba89f[_0x28d6('0x42')]({'attributes':['id',_0x28d6('0x4')]}));break;}return BPromise[_0x28d6('0x43')](_0x8bb534);}})[_0x28d6('0xe')](function(_0x10a52){if(_0x10a52&&_0x10a52[_0x28d6('0x1f')]){for(var _0x293c76=0x0;_0x293c76<_0x10a52[_0x28d6('0x1f')];_0x293c76+=0x1){for(var _0x4c8295=0x0;_0x4c8295<_0x10a52[_0x293c76]['length'];_0x4c8295+=0x1){switch(_0x293c76){case 0x0:joinOrLeaveQueues(_0x4572ff,_0x2288eb,_0x28d6('0x44'),_0x10a52[_0x293c76][_0x4c8295]);break;case 0x1:joinOrLeaveQueues(_0x4572ff,_0x2288eb,'chat',_0x10a52[_0x293c76][_0x4c8295]);break;case 0x2:joinOrLeaveQueues(_0x4572ff,_0x2288eb,'fax',_0x10a52[_0x293c76][_0x4c8295]);break;case 0x3:joinOrLeaveQueues(_0x4572ff,_0x2288eb,'sms',_0x10a52[_0x293c76][_0x4c8295]);break;case 0x4:joinOrLeaveQueues(_0x4572ff,_0x2288eb,_0x28d6('0x45'),_0x10a52[_0x293c76][_0x4c8295]);break;case 0x5:joinOrLeaveQueues(_0x4572ff,_0x2288eb,'openchannel',_0x10a52[_0x293c76][_0x4c8295]);break;case 0x6:joinOrLeaveQueues(_0x4572ff,_0x2288eb,_0x28d6('0x46'),_0x10a52[_0x293c76][_0x4c8295]);break;case 0x7:if(_0x3d128b['role']!==_0x28d6('0x8'))_0x4572ff[_0x2288eb](util[_0x28d6('0x20')](_0x28d6('0x47'),_0x10a52[_0x293c76][_0x4c8295]['name']));break;case 0x8:if(_0x3d128b['role']!=='agent')_0x4572ff[_0x2288eb](util[_0x28d6('0x20')](_0x28d6('0x48'),_0x10a52[_0x293c76][_0x4c8295]['name']));break;case 0x9:if(_0x3d128b[_0x28d6('0x7')]!==_0x28d6('0x8'))_0x4572ff[_0x2288eb](util[_0x28d6('0x20')](_0x28d6('0x49'),_0x10a52[_0x293c76][_0x4c8295][_0x28d6('0xa')],_0x10a52[_0x293c76][_0x4c8295][_0x28d6('0x4')]));break;case 0xa:_0x4572ff[_0x2288eb](util[_0x28d6('0x20')](_0x28d6('0x4a'),_0x10a52[_0x293c76][_0x4c8295]['name']));break;}}}}})[_0x28d6('0xe')](function(){if(_0x2288eb===_0x28d6('0x4b')){var _0x9fbbe2=_[_0x28d6('0x1c')](_0x3d128b[_0x28d6('0x25')],'id');return _0x3d128b[_0x28d6('0x4c')](_0x9fbbe2)[_0x28d6('0xe')](function(){for(var _0x4a31cb=0x0;_0x4a31cb<_0x9fbbe2[_0x28d6('0x1f')];_0x4a31cb+=0x1){_0x455dd6['emit'](_0x28d6('0x4d'),{'ChatInteractionId':Number(_0x9fbbe2[_0x4a31cb]),'UserId':Number(_0x3d128b['id'])});}});}})[_0x28d6('0xe')](function(){if(_0x2288eb===_0x28d6('0x4b')){var _0x15edd6=_[_0x28d6('0x1c')](_0x3d128b[_0x28d6('0x27')],'id');return _0x3d128b['removeMailInteractions'](_0x15edd6)[_0x28d6('0xe')](function(){for(var _0x5794ae=0x0;_0x5794ae<_0x15edd6[_0x28d6('0x1f')];_0x5794ae+=0x1){_0x455dd6['emit'](_0x28d6('0x4e'),{'MailInteractionId':Number(_0x15edd6[_0x5794ae]),'UserId':Number(_0x3d128b['id'])});}});}})[_0x28d6('0xe')](function(){if(_0x2288eb===_0x28d6('0x4b')){var _0x33a7c3=_['map'](_0x3d128b[_0x28d6('0x29')],'id');return _0x3d128b[_0x28d6('0x4f')](_0x33a7c3)[_0x28d6('0xe')](function(){for(var _0x3a9779=0x0;_0x3a9779<_0x33a7c3[_0x28d6('0x1f')];_0x3a9779+=0x1){_0x455dd6[_0x28d6('0x50')](_0x28d6('0x51'),{'FaxInteractionId':Number(_0x33a7c3[_0x3a9779]),'UserId':Number(_0x3d128b['id'])});}});}})[_0x28d6('0xe')](function(){if(_0x2288eb===_0x28d6('0x4b')){var _0xe55cde=_[_0x28d6('0x1c')](_0x3d128b['SmsInteractions'],'id');return _0x3d128b[_0x28d6('0x52')](_0xe55cde)[_0x28d6('0xe')](function(){for(var _0x45a288=0x0;_0x45a288<_0xe55cde[_0x28d6('0x1f')];_0x45a288+=0x1){_0x455dd6[_0x28d6('0x50')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0xe55cde[_0x45a288]),'UserId':Number(_0x3d128b['id'])});}});}})[_0x28d6('0xe')](function(){if(_0x2288eb===_0x28d6('0x4b')){var _0x40cd58=_[_0x28d6('0x1c')](_0x3d128b[_0x28d6('0x2d')],'id');return _0x3d128b['removeOpenchannelInteractions'](_0x40cd58)[_0x28d6('0xe')](function(){for(var _0x698103=0x0;_0x698103<_0x40cd58[_0x28d6('0x1f')];_0x698103+=0x1){_0x455dd6[_0x28d6('0x50')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x40cd58[_0x698103]),'UserId':Number(_0x3d128b['id'])});}});}})[_0x28d6('0xe')](function(){if(_0x2288eb==='leave'){var _0x3fc83c=_[_0x28d6('0x1c')](_0x3d128b[_0x28d6('0x2f')],'id');return _0x3d128b['removeWhatsappInteractions'](_0x3fc83c)[_0x28d6('0xe')](function(){for(var _0x102bf6=0x0;_0x102bf6<_0x3fc83c[_0x28d6('0x1f')];_0x102bf6+=0x1){_0x455dd6[_0x28d6('0x50')](_0x28d6('0x53'),{'WhatsappInteractionId':Number(_0x3fc83c[_0x102bf6]),'UserId':Number(_0x3d128b['id'])});}});}})[_0x28d6('0x54')](function(_0x312a09){_0x4572ff['log'](_0x312a09);});}}function onDisconnect(_0xf97c6b,_0x3daecc){joinOrLeave(_0xf97c6b,_0x28d6('0x4b'),_0x3daecc);}function onConnect(_0x2cfd63){joinOrLeave(_0x2cfd63,_0x28d6('0x55'));}exports[_0x28d6('0x56')]=function(_0x32e762){_0x32e762['on'](_0x28d6('0x57'),function(_0x3d64d5){_0x3d64d5[_0x28d6('0x58')](0x0);_0x3d64d5['address']=_0x3d64d5[_0x28d6('0x59')][_0x28d6('0x57')][_0x28d6('0x5a')]+':'+_0x3d64d5[_0x28d6('0x59')][_0x28d6('0x57')]['remotePort'];_0x3d64d5[_0x28d6('0x5b')]=new Date();_0x3d64d5[_0x28d6('0x5c')]=function(_0xd6b590){console[_0x28d6('0x5c')](_0x28d6('0x5d')+_0x3d64d5[_0x28d6('0x5e')][_0x28d6('0x4')]+'['+_0x3d64d5['address']+']',_0xd6b590);};_0x3d64d5['on']('disconnect',function(){onDisconnect(_0x3d64d5,_0x32e762);_0x3d64d5[_0x28d6('0x5c')](_0x28d6('0x5f'));});onConnect(_0x3d64d5);_0x3d64d5[_0x28d6('0x5c')]('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 4d8b74c..b8ecf0c 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 _0x4d56=['Sms','SmsInteraction','afterCreate','afterUpdate','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','substatus','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','then','info','Trigger,\x20%s','EventManager','error','code','catch','get','channel','motionChannel','event','direction','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','query','Sequelize','UserId','User','find','name','email','internal','interface','SIP/%s','agent','incomingmessage','outgoingmessage','opened','SELECT','contact','changed','closed','QueryTypes','fullname','format','default','length','hasOwnProperty','model','hook','callback','toLowerCase','condition','util','../../mysqldb','jayson/promise','triggers','lodash','client','http','Chat','ChatInteraction','newinteraction','closedinteraction','ChatMessage','newmessage'];(function(_0xb3f6f8,_0x64420e){var _0x3d49ec=function(_0x23a0c4){while(--_0x23a0c4){_0xb3f6f8['push'](_0xb3f6f8['shift']());}};_0x3d49ec(++_0x64420e);}(_0x4d56,0x16a));var _0x64d5=function(_0x11c6d2,_0x25d150){_0x11c6d2=_0x11c6d2-0x0;var _0x3592f3=_0x4d56[_0x11c6d2];return _0x3592f3;};'use strict';var util=require(_0x64d5('0x0'));var db=require(_0x64d5('0x1'))['db'];var jayson=require(_0x64d5('0x2'));var logger=require('../logger')(_0x64d5('0x3'));var _=require(_0x64d5('0x4'));var client=jayson[_0x64d5('0x5')][_0x64d5('0x6')]({'port':0x232a});var triggers=[{'channel':_0x64d5('0x7'),'model':_0x64d5('0x8'),'event':'afterCreate','condition':_0x64d5('0x9'),'callback':afterCreate},{'channel':_0x64d5('0x7'),'model':_0x64d5('0x8'),'event':'afterUpdate','condition':_0x64d5('0xa'),'callback':afterUpdate},{'channel':_0x64d5('0x7'),'model':_0x64d5('0xb'),'event':'afterCreate','condition':_0x64d5('0xc'),'callback':afterCreateMessage},{'channel':_0x64d5('0xd'),'model':_0x64d5('0xe'),'event':_0x64d5('0xf'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x64d5('0xd'),'model':_0x64d5('0xe'),'event':_0x64d5('0x10'),'condition':_0x64d5('0xa'),'callback':afterUpdate},{'channel':_0x64d5('0xd'),'model':_0x64d5('0x11'),'event':_0x64d5('0xf'),'condition':_0x64d5('0xc'),'callback':afterCreateMessage},{'channel':_0x64d5('0x12'),'model':_0x64d5('0x13'),'event':'afterCreate','condition':_0x64d5('0x9'),'callback':afterCreate},{'channel':_0x64d5('0x12'),'model':'WhatsappInteraction','event':_0x64d5('0x10'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Whatsapp','model':_0x64d5('0x14'),'event':'afterCreate','condition':_0x64d5('0xc'),'callback':afterCreateMessage},{'channel':_0x64d5('0x15'),'model':_0x64d5('0x16'),'event':'afterCreate','condition':_0x64d5('0x9'),'callback':afterCreate},{'channel':_0x64d5('0x15'),'model':_0x64d5('0x16'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0x64d5('0x15'),'model':_0x64d5('0x17'),'event':_0x64d5('0xf'),'condition':_0x64d5('0xc'),'callback':afterCreateMessage},{'channel':_0x64d5('0x18'),'model':_0x64d5('0x19'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0x64d5('0x18'),'model':'MailInteraction','event':_0x64d5('0x10'),'condition':_0x64d5('0xa'),'callback':afterUpdate},{'channel':_0x64d5('0x18'),'model':_0x64d5('0x19'),'event':_0x64d5('0x1a'),'condition':_0x64d5('0x1a'),'callback':afterUpdate},{'channel':'Mail','model':'MailMessage','event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0x64d5('0x1b'),'model':_0x64d5('0x1c'),'event':_0x64d5('0xf'),'condition':_0x64d5('0x9'),'callback':afterCreate},{'channel':_0x64d5('0x1b'),'model':_0x64d5('0x1c'),'event':_0x64d5('0x10'),'condition':_0x64d5('0xa'),'callback':afterUpdate},{'channel':_0x64d5('0x1b'),'model':_0x64d5('0x1d'),'event':_0x64d5('0xf'),'condition':_0x64d5('0xc'),'callback':afterCreateMessage}];function request(_0x57f8ee){return client[_0x64d5('0x1e')]('EventManager',_0x57f8ee)[_0x64d5('0x1f')](function(_0x2fb4b9){logger[_0x64d5('0x20')](_0x64d5('0x21'),_0x64d5('0x22'),_0x2fb4b9);if(_0x2fb4b9[_0x64d5('0x23')]){if(_0x2fb4b9[_0x64d5('0x23')][_0x64d5('0x24')]===0x1f4){logger[_0x64d5('0x23')]('Trigger,\x20%s','EventManager',_0x2fb4b9[_0x64d5('0x23')]);}}})[_0x64d5('0x25')](function(_0x3ec062){logger[_0x64d5('0x23')](_0x64d5('0x21'),_0x64d5('0x22'),_0x3ec062);});}function afterCreateMessage(_0x5963c2,_0x4d26e2){return function(_0x3b6dda,_0x30a851){_0x3b6dda=_0x3b6dda[_0x64d5('0x26')]({'plain':!![]});_0x3b6dda[_0x64d5('0x27')]=_0x5963c2;_0x3b6dda[_0x64d5('0x28')]=_0x5963c2;_0x3b6dda[_0x64d5('0x29')]=_0x3b6dda[_0x64d5('0x2a')];var _0x125044=_0x64d5('0x2b')+_0x3b6dda[_0x64d5('0x2c')];return db[_0x64d5('0x2d')][_0x64d5('0x2e')](_0x125044,{'type':db[_0x64d5('0x2f')]['QueryTypes']['SELECT'],'raw':!![]})[_0x64d5('0x1f')](function(_0x591df6){return _0x591df6;})['then'](function(_0x289714){if(_0x289714){_0x3b6dda['contact']=_0x289714[0x0];}if(_0x3b6dda[_0x64d5('0x30')]){return db[_0x64d5('0x31')][_0x64d5('0x32')]({'where':{'id':_0x3b6dda[_0x64d5('0x30')]},'attributes':['id',_0x64d5('0x33'),'fullname',_0x64d5('0x34'),_0x64d5('0x35')],'raw':!![]})[_0x64d5('0x1f')](function(_0x2eb9b8){_0x3b6dda[_0x64d5('0x36')]=util['format'](_0x64d5('0x37'),_0x2eb9b8[_0x64d5('0x33')]);_0x3b6dda[_0x64d5('0x27')]=_0x5963c2;_0x3b6dda[_0x64d5('0x38')]=_0x2eb9b8;return request({'event':_0x64d5('0x39'),'message':_0x3b6dda});})[_0x64d5('0x25')](function(_0x46e708){console[_0x64d5('0x23')](_0x46e708);});}else{return request({'event':_0x64d5('0x3a'),'message':_0x3b6dda});}});};}function afterCreate(_0x2c4e2a,_0x4b6c92){return function(_0x40d742,_0x45ead0){_0x40d742=_0x40d742['get']({'plain':!![]});_0x40d742['channel']=_0x2c4e2a;_0x40d742[_0x64d5('0x28')]=_0x2c4e2a;_0x40d742['event']=_0x64d5('0x3b');var _0x330f86='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x40d742['ContactId'];return db[_0x64d5('0x2d')][_0x64d5('0x2e')](_0x330f86,{'type':db[_0x64d5('0x2f')]['QueryTypes'][_0x64d5('0x3c')],'raw':!![]})[_0x64d5('0x1f')](function(_0xfa9bf4){return _0xfa9bf4;})['then'](function(_0x35a8ae){if(_0x35a8ae){_0x40d742[_0x64d5('0x3d')]=_0x35a8ae[0x0];}return request({'event':_0x4b6c92,'message':_0x40d742});});};}function afterUpdate(_0x4d8da1,_0x2f9bce){return function(_0x3364db,_0x339504){if(_0x3364db[_0x64d5('0x3e')](_0x64d5('0x3f'))&&_0x3364db[_0x64d5('0x3f')]){_0x3364db=_0x3364db['get']({'plain':!![]});_0x3364db[_0x64d5('0x27')]=_0x4d8da1;_0x3364db[_0x64d5('0x28')]=_0x4d8da1;_0x3364db[_0x64d5('0x29')]=_0x64d5('0x3f');var _0x201be9=_0x64d5('0x2b')+_0x3364db['ContactId'];return db[_0x64d5('0x2d')]['query'](_0x201be9,{'type':db[_0x64d5('0x2f')][_0x64d5('0x40')][_0x64d5('0x3c')],'raw':!![]})['then'](function(_0x289f89){return _0x289f89;})[_0x64d5('0x1f')](function(_0x369a5c){if(_0x369a5c){_0x3364db[_0x64d5('0x3d')]=_0x369a5c[0x0];}if(_0x3364db[_0x64d5('0x30')]){return db[_0x64d5('0x31')][_0x64d5('0x32')]({'where':{'id':_0x3364db[_0x64d5('0x30')]},'attributes':['id','name',_0x64d5('0x41'),_0x64d5('0x34'),_0x64d5('0x35')],'raw':!![]})[_0x64d5('0x1f')](function(_0x470f89){_0x3364db['interface']=util[_0x64d5('0x42')](_0x64d5('0x37'),_0x470f89[_0x64d5('0x33')]);_0x3364db[_0x64d5('0x38')]=_0x470f89;return request({'event':_0x2f9bce,'message':_0x3364db});})[_0x64d5('0x25')](function(_0x2b2eba){console[_0x64d5('0x23')](_0x2b2eba);});}else{return request({'event':_0x2f9bce,'message':_0x3364db});}});}else if(_0x3364db[_0x64d5('0x3e')](_0x64d5('0x1a'))){_0x3364db=_0x3364db['get']({'plain':!![]});_0x3364db[_0x64d5('0x27')]=_0x4d8da1;_0x3364db[_0x64d5('0x29')]=_0x64d5('0x1a');var _0x201be9=_0x64d5('0x2b')+_0x3364db[_0x64d5('0x2c')];return db[_0x64d5('0x2d')][_0x64d5('0x2e')](_0x201be9,{'type':db[_0x64d5('0x2f')][_0x64d5('0x40')][_0x64d5('0x3c')],'raw':!![]})[_0x64d5('0x1f')](function(_0x1240e6){return _0x1240e6;})['then'](function(_0x284ae8){if(_0x284ae8){_0x3364db[_0x64d5('0x3d')]=_0x284ae8[0x0];}if(_0x3364db[_0x64d5('0x30')]){return db[_0x64d5('0x31')]['find']({'where':{'id':_0x3364db['UserId']},'attributes':['id','name',_0x64d5('0x41'),_0x64d5('0x34'),_0x64d5('0x35')],'raw':!![]})[_0x64d5('0x1f')](function(_0xba3898){_0x3364db[_0x64d5('0x36')]=util[_0x64d5('0x42')](_0x64d5('0x37'),_0xba3898[_0x64d5('0x33')]);_0x3364db[_0x64d5('0x38')]=_0xba3898;return request({'event':_0x2f9bce,'message':_0x3364db});})['catch'](function(_0x181432){console[_0x64d5('0x23')](_0x181432);});}else{return request({'event':_0x2f9bce,'message':_0x3364db});}});}};}exports[_0x64d5('0x43')]=function(){for(var _0x1140de=0x0;_0x1140de=_0x40c26c[_0x421b('0x12')]){throw Error(_0x421b('0x13'));}_0xb88298(_0x20cad2);})[_0x421b('0x14')](function(_0x225de0){_0xd64e56(_0x225de0);});});}; \ No newline at end of file +var _0xf440=['isValidChannel','toLowerCase','clearBlockUser','isUndefined','blockedAt','getLicense','role','count','agent','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','./license/util','voice','mail','chat','fax','sms','openchannel','getChannels'];(function(_0x1af482,_0x1af5b7){var _0x7e7580=function(_0x5ed4a7){while(--_0x5ed4a7){_0x1af482['push'](_0x1af482['shift']());}};_0x7e7580(++_0x1af5b7);}(_0xf440,0x1f0));var _0x0f44=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf440[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0f44('0x0'));var BPromise=require(_0x0f44('0x1'));var db=require('../mysqldb')['db'];var util=require(_0x0f44('0x2'));var channels=[_0x0f44('0x3'),_0x0f44('0x4'),_0x0f44('0x5'),_0x0f44('0x6'),_0x0f44('0x7'),'whatsapp',_0x0f44('0x8')];exports[_0x0f44('0x9')]=function(){return channels;};exports[_0x0f44('0xa')]=function(_0x14e963){_0x14e963=_0x14e963[_0x0f44('0xb')]();return _['includes'](channels,_0x14e963);};exports[_0x0f44('0xc')]=function(_0x34a1d4,_0x40613c,_0x31f59a,_0x210be3){var _0x46f035={'loginAttempts':_0x40613c,'blocked':_0x31f59a};if(!_[_0x0f44('0xd')](_0x210be3)){_0x46f035[_0x0f44('0xe')]=_0x210be3;}return _0x34a1d4['updateAttributes'](_0x46f035);};exports[_0x0f44('0xf')]=function(_0x23889f){return new BPromise(function(_0x1bec06,_0x31c314){var _0x37ed33=0x0;if(_0x23889f[_0x0f44('0x10')]!=='agent'){_0x1bec06(_0x23889f);}db['User'][_0x0f44('0x11')]({'where':{'role':_0x0f44('0x12'),'online':!![],'id':{'$ne':_0x23889f['id']}}})[_0x0f44('0x13')](function(_0x398d8f){_0x37ed33=_0x398d8f;return util['getLicense']();})[_0x0f44('0x13')](function(_0x1df3f6){if(_0x1df3f6&&_0x1df3f6[_0x0f44('0x14')]&&_0x37ed33>=_0x1df3f6[_0x0f44('0x14')]){throw Error(_0x0f44('0x15'));}_0x1bec06(_0x23889f);})[_0x0f44('0x16')](function(_0x8a9805){_0x31c314(_0x8a9805);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index f9acbd8..b66e218 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xea5b=['json','send','exports','status'];(function(_0x502918,_0x3f9071){var _0x123c37=function(_0x492afc){while(--_0x492afc){_0x502918['push'](_0x502918['shift']());}};_0x123c37(++_0x3f9071);}(_0xea5b,0x152));var _0xbea5=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xea5b[_0x40a045];return _0x1a687c;};'use strict';module[_0xbea5('0x0')][0x194]=function pageNotFound(_0x166b03,_0x109666){var _0x54049b='404';var _0x1be41e=0x194;var _0x37edf1={'status':_0x1be41e};_0x109666[_0xbea5('0x1')](_0x37edf1[_0xbea5('0x1')]);_0x109666['render'](_0x54049b,{},function(_0x2027df,_0x4e020c){if(_0x2027df){return _0x109666[_0xbea5('0x1')](_0x37edf1[_0xbea5('0x1')])[_0xbea5('0x2')](_0x37edf1);}_0x109666[_0xbea5('0x3')](_0x4e020c);});}; \ No newline at end of file +var _0x65d2=['status','render','json','send','exports','404'];(function(_0x10545c,_0x437d83){var _0x140729=function(_0x4e4e8e){while(--_0x4e4e8e){_0x10545c['push'](_0x10545c['shift']());}};_0x140729(++_0x437d83);}(_0x65d2,0xb8));var _0x265d=function(_0x1045d6,_0x2493f7){_0x1045d6=_0x1045d6-0x0;var _0x13770f=_0x65d2[_0x1045d6];return _0x13770f;};'use strict';module[_0x265d('0x0')][0x194]=function pageNotFound(_0x29ddde,_0x51b2e5){var _0x1dc156=_0x265d('0x1');var _0x3a315b=0x194;var _0x59c81e={'status':_0x3a315b};_0x51b2e5[_0x265d('0x2')](_0x59c81e[_0x265d('0x2')]);_0x51b2e5[_0x265d('0x3')](_0x1dc156,{},function(_0x579b25,_0x3e4ca8){if(_0x579b25){return _0x51b2e5[_0x265d('0x2')](_0x59c81e[_0x265d('0x2')])[_0x265d('0x4')](_0x59c81e);}_0x51b2e5[_0x265d('0x5')](_0x3e4ca8);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 2a08a5f..e16d529 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbb99=['../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','User','hasOne','UserId','hasMany','VoiceQueuesRt','Extensions','cascade','CmHopperFinal','HopperFinals','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotification','UserNotifications','SenderId','belongsTo','userProfileId','Groups','chat_group_has_users','belongsToMany','Contacts','cm_user_has_contacts','Lists','Team','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','SmsInteraction','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','MailQueues','FaxQueues','UserSmsQueue','OpenchannelQueue','OpenchannelQueues','UserOpenchannelQueue','WhatsappQueues','ChatWebsites','user_has_chat_websites','FaxAccount','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','SpiedAgents','ChanSpyId','Applications','Sounds','Members','VoiceQueueId','Hoppers','CmHopperHistory','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackupId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','Contact','ContactId','MailAccountId','Imap','Smtp','Disposition','Dispositions','CannedAnswer','Answers','ListId','TemplateId','Agents','Account','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Interaction','MailApplication','restrict','TagId','FaxAccountId','Interactions','FaxMessage','List','FaxInteractionId','fax_interaction_has_tags','team_has_fax_queues','SmsMessage','SmsApplication','SmsInteractionId','SmsAccountId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelApplication','OpenchannelQueueId','OpenchannelMessage','openchannel_interaction_has_tags','OpenchannelInteractionId','AttachmentId','ChatWebsiteId','ChatApplication','Website','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatInternalMessage','ChatGroupId','CompanyId','OpenchannelInteractions','ChatInteractions','cm_contact_has_tags','Agent','CampaignId','OwnerId','All','OneAll','AutomationAllId','Condition','Any','OneAny','AutomationAnyId','Intervals','MailApplications','ChatApplications','SmsApplications','DefaultReportId','Mohs','whatsapp_interaction_has_tags','AllCondition','TriggerAllId','AnyConditions','AnyCondition','Actions','TriggerId','CustomReportId','AnalyticFieldReport','Fields','MetricId','SalesforceConfiguration','Configurations','AccountId','Subjects','SubjectId','FieldId','Description','DescriptionId','Field','Descriptions','VariableId','DeskAccount','int_desk_configuration_has_tags','Subject','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskField','int_freshdesk_configuration_has_tags','VtigerConfiguration','ServicenowConfiguration','ServicenowField','Dynamics365Account','FromId','ToId','SessionId','ProjectId','user_has_square_projects','team_has_mail_queues','team_has_openchannel_queues','team_has_whatsapp_queues','TrunkBackup','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','ChatOfflineMessageId','MailTransferReport','FromMailAccountId','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToMailAccountId','FromChatWebsiteId','FromAccount','ToQueue','ToChatWebsiteId','ToAccount','FaxTransferReport','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CmCustomField','CustomFields','HopperHistory','Queues','cm_user_has_lists','UserProfileSection','sectionId','WhatsappAccountId','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','database','username','password','options','../api/user/user.model','VoiceChanSpy','import','VoiceContext','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','VoiceDialReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','UserMailQueue','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','../api/faxAccount/faxAccount.model','FaxApplication','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxQueue','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','../api/openchannelMessage/openchannelMessage.model','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','../api/chatApplication/chatApplication.model','ChatInteraction','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','Action','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','AnalyticMetric','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','DeskField','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','../api/intServicenowField/intServicenowField.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','FreshsalesConfiguration','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','SquareReport','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../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/squareMessage/squareMessage.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','../api/plugin/plugin.model','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','CmList','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile'];(function(_0x43e0fd,_0x413c1f){var _0x1dc7e4=function(_0x4ec78a){while(--_0x4ec78a){_0x43e0fd['push'](_0x43e0fd['shift']());}};_0x1dc7e4(++_0x413c1f);}(_0xbb99,0x101));var _0x9bb9=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xbb99[_0x139a3c];return _0x2b375b;};'use strict';var config=require(_0x9bb9('0x0'));var Sequelize=require(_0x9bb9('0x1'));var _=require(_0x9bb9('0x2'));var jstz=require(_0x9bb9('0x3'));var timezone=jstz[_0x9bb9('0x4')]();config[_0x9bb9('0x1')]=_[_0x9bb9('0x5')](config[_0x9bb9('0x1')],{'database':_0x9bb9('0x6'),'username':_0x9bb9('0x7'),'password':_0x9bb9('0x8'),'options':{'host':_0x9bb9('0x9'),'port':0xcea,'dialect':_0x9bb9('0xa'),'dialectOptions':{'charset':_0x9bb9('0xb')},'logging':![],'timezone':timezone[_0x9bb9('0xc')](),'define':{'charset':_0x9bb9('0xd'),'collate':_0x9bb9('0xe')}}});config[_0x9bb9('0xf')]=_['defaultsDeep'](config[_0x9bb9('0xf')],{'database':_0x9bb9('0x6'),'username':'xcall','password':_0x9bb9('0x8'),'options':{'host':_0x9bb9('0x9'),'port':0xcea,'dialect':_0x9bb9('0xa'),'dialectOptions':{'charset':_0x9bb9('0xb')},'logging':![],'timezone':timezone[_0x9bb9('0xc')](),'define':{'charset':'utf8','collate':_0x9bb9('0xe')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x9bb9('0x1')][_0x9bb9('0x10')],config[_0x9bb9('0x1')][_0x9bb9('0x11')],config[_0x9bb9('0x1')][_0x9bb9('0x12')],config[_0x9bb9('0x1')][_0x9bb9('0x13')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x9bb9('0xf')][_0x9bb9('0x10')],config['sequelizeHistory'][_0x9bb9('0x11')],config[_0x9bb9('0xf')][_0x9bb9('0x12')],config[_0x9bb9('0xf')][_0x9bb9('0x13')])};db['User']=db['sequelize']['import'](_0x9bb9('0x14'));db[_0x9bb9('0x15')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0x9bb9('0x17')]=db['sequelize'][_0x9bb9('0x16')]('../api/voiceContext/voiceContext.model');db[_0x9bb9('0x18')]=db[_0x9bb9('0x1')]['import'](_0x9bb9('0x19'));db[_0x9bb9('0x1a')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0x1b'));db[_0x9bb9('0x1c')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0x1d'));db[_0x9bb9('0x1e')]=db[_0x9bb9('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x9bb9('0x1f')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0x20'));db[_0x9bb9('0x21')]=db['sequelize'][_0x9bb9('0x16')](_0x9bb9('0x22'));db[_0x9bb9('0x23')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0x24'));db[_0x9bb9('0x25')]=db['sequelize']['import']('../api/voiceCallReport/voiceCallReport.model');db[_0x9bb9('0x26')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')]('../api/voiceDialReport/voiceDialReport.model');db['VoiceAgentReport']=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0x27'));db[_0x9bb9('0x28')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0x29'));db['MemberReport']=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0x2a'));db[_0x9bb9('0x2b')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0x2c'));db[_0x9bb9('0x2d')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0x2e'));db[_0x9bb9('0x2f')]=db['sequelize'][_0x9bb9('0x16')](_0x9bb9('0x30'));db[_0x9bb9('0x31')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0x32'));db[_0x9bb9('0x33')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')]('../api/userChatQueue/userChatQueue.model');db[_0x9bb9('0x34')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')]('../api/userMailQueue/userMailQueue.model');db[_0x9bb9('0x35')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0x36'));db['UserSmsQueue']=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0x37'));db['UserOpenchannelQueue']=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0x38'));db[_0x9bb9('0x39')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0x3a'));db[_0x9bb9('0x3b')]=db['sequelize'][_0x9bb9('0x16')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0x3c'));db[_0x9bb9('0x3d')]=db['sequelize']['import'](_0x9bb9('0x3e'));db[_0x9bb9('0x3f')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0x40'));db[_0x9bb9('0x41')]=db[_0x9bb9('0x1')]['import'](_0x9bb9('0x42'));db[_0x9bb9('0x43')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0x44'));db[_0x9bb9('0x45')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')]('../api/mailMessage/mailMessage.model');db['MailApplication']=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0x46'));db[_0x9bb9('0x47')]=db['sequelize'][_0x9bb9('0x16')](_0x9bb9('0x48'));db[_0x9bb9('0x49')]=db[_0x9bb9('0x1')]['import'](_0x9bb9('0x4a'));db[_0x9bb9('0x4b')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0x4c'));db['FaxAccount']=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0x4d'));db[_0x9bb9('0x4e')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')]('../api/faxApplication/faxApplication.model');db[_0x9bb9('0x4f')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0x50'));db['FaxMessage']=db[_0x9bb9('0x1')][_0x9bb9('0x16')]('../api/faxMessage/faxMessage.model');db[_0x9bb9('0x51')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')]('../api/faxQueue/faxQueue.model');db[_0x9bb9('0x52')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0x53'));db[_0x9bb9('0x54')]=db[_0x9bb9('0x1')]['import'](_0x9bb9('0x55'));db['SmsApplication']=db[_0x9bb9('0x1')]['import'](_0x9bb9('0x56'));db['SmsInteraction']=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0x57'));db['SmsMessage']=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0x58'));db[_0x9bb9('0x59')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0x5a'));db[_0x9bb9('0x5b')]=db['sequelize']['import'](_0x9bb9('0x5c'));db['OpenchannelApplication']=db['sequelize'][_0x9bb9('0x16')](_0x9bb9('0x5d'));db[_0x9bb9('0x5e')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0x5f'));db['OpenchannelMessage']=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0x60'));db['OpenchannelQueue']=db['sequelize'][_0x9bb9('0x16')](_0x9bb9('0x61'));db[_0x9bb9('0x62')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0x63'));db[_0x9bb9('0x64')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0x65'));db['ChatApplication']=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0x66'));db[_0x9bb9('0x67')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')]('../api/chatInteraction/chatInteraction.model');db[_0x9bb9('0x68')]=db['sequelize'][_0x9bb9('0x16')](_0x9bb9('0x69'));db[_0x9bb9('0x6a')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x9bb9('0x6b')]=db[_0x9bb9('0x1')]['import'](_0x9bb9('0x6c'));db[_0x9bb9('0x6d')]=db['sequelize'][_0x9bb9('0x16')]('../api/chatGroup/chatGroup.model');db[_0x9bb9('0x6e')]=db['sequelize'][_0x9bb9('0x16')](_0x9bb9('0x6f'));db[_0x9bb9('0x70')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0x71'));db[_0x9bb9('0x72')]=db[_0x9bb9('0x1')]['import'](_0x9bb9('0x73'));db[_0x9bb9('0x74')]=db['sequelize']['import'](_0x9bb9('0x75'));db[_0x9bb9('0x76')]=db['sequelize'][_0x9bb9('0x16')](_0x9bb9('0x77'));db['CmHopperFinal']=db['sequelize']['import'](_0x9bb9('0x78'));db['CmHopperHistory']=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0x79'));db[_0x9bb9('0x7a')]=db[_0x9bb9('0x1')]['import'](_0x9bb9('0x7b'));db['CmCustomField']=db[_0x9bb9('0x1')][_0x9bb9('0x16')]('../api/cmCustomField/cmCustomField.model');db[_0x9bb9('0x7c')]=db['sequelize'][_0x9bb9('0x16')]('../api/action/action.model');db[_0x9bb9('0x7d')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0x7e'));db['CannedAnswer']=db['sequelize'][_0x9bb9('0x16')](_0x9bb9('0x7f'));db['Disposition']=db[_0x9bb9('0x1')][_0x9bb9('0x16')]('../api/disposition/disposition.model');db['Condition']=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0x80'));db[_0x9bb9('0x81')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0x82'));db[_0x9bb9('0x83')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0x84'));db['Cdr']=db[_0x9bb9('0x1')][_0x9bb9('0x16')]('../api/cdr/cdr.model');db[_0x9bb9('0x85')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0x86'));db[_0x9bb9('0x87')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')]('../api/schedule/schedule.model');db[_0x9bb9('0x88')]=db['sequelize'][_0x9bb9('0x16')](_0x9bb9('0x89'));db[_0x9bb9('0x8a')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0x8b'));db[_0x9bb9('0x8c')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0x8d'));db[_0x9bb9('0x8e')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0x8f'));db[_0x9bb9('0x90')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0x91'));db[_0x9bb9('0x92')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0x93'));db[_0x9bb9('0x94')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0x95'));db[_0x9bb9('0x96')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')]('../api/analyticCustomReport/analyticCustomReport.model');db[_0x9bb9('0x97')]=db['sequelize'][_0x9bb9('0x16')](_0x9bb9('0x98'));db[_0x9bb9('0x99')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')]('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0x9bb9('0x9a')]=db['sequelize'][_0x9bb9('0x16')]('../api/analyticMetric/analyticMetric.model');db['AnalyticFieldReport']=db['sequelize'][_0x9bb9('0x16')](_0x9bb9('0x9b'));db[_0x9bb9('0x9c')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0x9d'));db[_0x9bb9('0x9e')]=db['sequelize'][_0x9bb9('0x16')](_0x9bb9('0x9f'));db['SalesforceConfiguration']=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0xa0'));db[_0x9bb9('0xa1')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0xa2'));db[_0x9bb9('0xa3')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0xa4'));db[_0x9bb9('0xa5')]=db[_0x9bb9('0x1')]['import'](_0x9bb9('0xa6'));db[_0x9bb9('0xa7')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0xa8'));db['DeskAccount']=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0xa9'));db[_0x9bb9('0xaa')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')]('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0x9bb9('0xab')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')]('../api/intDeskField/intDeskField.model');db[_0x9bb9('0xac')]=db['sequelize'][_0x9bb9('0x16')](_0x9bb9('0xad'));db[_0x9bb9('0xae')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')]('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0x9bb9('0xaf')]=db[_0x9bb9('0x1')]['import'](_0x9bb9('0xb0'));db[_0x9bb9('0xb1')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0xb2'));db['ZendeskConfiguration']=db['sequelize'][_0x9bb9('0x16')](_0x9bb9('0xb3'));db[_0x9bb9('0xb4')]=db['sequelize'][_0x9bb9('0x16')](_0x9bb9('0xb5'));db[_0x9bb9('0xb6')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0xb7'));db[_0x9bb9('0xb8')]=db[_0x9bb9('0x1')]['import'](_0x9bb9('0xb9'));db['FreshdeskField']=db[_0x9bb9('0x1')][_0x9bb9('0x16')]('../api/intFreshdeskField/intFreshdeskField.model');db[_0x9bb9('0xba')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0xbb'));db['VtigerConfiguration']=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0xbc'));db[_0x9bb9('0xbd')]=db[_0x9bb9('0x1')]['import'](_0x9bb9('0xbe'));db[_0x9bb9('0xbf')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0xc0'));db['ServicenowConfiguration']=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0xc1'));db['ServicenowField']=db[_0x9bb9('0x1')]['import'](_0x9bb9('0xc2'));db['Dynamics365Account']=db[_0x9bb9('0x1')][_0x9bb9('0x16')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x9bb9('0xc3')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0xc4'));db[_0x9bb9('0xc5')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0xc6'));db[_0x9bb9('0xc7')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0x9bb9('0xc8')]=db[_0x9bb9('0x1')]['import']('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0x9bb9('0xc9')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0xca'));db[_0x9bb9('0x92')]=db['sequelize'][_0x9bb9('0x16')](_0x9bb9('0x93'));db['Network']=db['sequelize'][_0x9bb9('0x16')](_0x9bb9('0xcb'));db[_0x9bb9('0xcc')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0xcd'));db['ChatInternalMessage']=db[_0x9bb9('0x1')]['import']('../api/chatInternalMessage/chatInternalMessage.model');db[_0x9bb9('0xce')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0xcf'));db[_0x9bb9('0xd0')]=db['sequelize'][_0x9bb9('0x16')](_0x9bb9('0xd1'));db[_0x9bb9('0xd2')]=db[_0x9bb9('0x1')]['import'](_0x9bb9('0xd3'));db[_0x9bb9('0xd4')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')]('../api/smsQueueReport/smsQueueReport.model');db[_0x9bb9('0xd5')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')]('../api/squareReport/squareReport.model');db[_0x9bb9('0xd6')]=db['sequelize'][_0x9bb9('0x16')](_0x9bb9('0xd7'));db[_0x9bb9('0xd8')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0xd9'));db[_0x9bb9('0xda')]=db['sequelize'][_0x9bb9('0x16')](_0x9bb9('0xdb'));db[_0x9bb9('0xdc')]=db['sequelize']['import'](_0x9bb9('0xdd'));db[_0x9bb9('0xde')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0xdf'));db[_0x9bb9('0xe0')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0xe1'));db[_0x9bb9('0xe2')]=db['sequelize'][_0x9bb9('0x16')](_0x9bb9('0xe3'));db['Team']=db[_0x9bb9('0x1')][_0x9bb9('0x16')]('../api/team/team.model');db[_0x9bb9('0xe4')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0xe5'));db[_0x9bb9('0xe6')]=db['sequelize'][_0x9bb9('0x16')](_0x9bb9('0xe7'));db[_0x9bb9('0xe8')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0xe9'));db[_0x9bb9('0xea')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0xeb'));db['Plugin']=db[_0x9bb9('0x1')]['import'](_0x9bb9('0xec'));db['MailTransferReport']=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0xed'));db[_0x9bb9('0xee')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0xef'));db['FaxTransferReport']=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0xf0'));db[_0x9bb9('0xf1')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0xf2'));db['SmsTransferReport']=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0xf3'));db[_0x9bb9('0xf4')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')]('../api/cmList/cmList.model');db[_0x9bb9('0xf5')]=db[_0x9bb9('0x1')]['import'](_0x9bb9('0xf6'));db[_0x9bb9('0xf7')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0xf8'));db['UserProfileSection']=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0xf9'));db[_0x9bb9('0xfa')]=db[_0x9bb9('0x1')]['import'](_0x9bb9('0xfb'));db['UserNotification']=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0xfc'));db[_0x9bb9('0xfd')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0xfe'));db[_0x9bb9('0xff')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')]('../api/whatsappApplication/whatsappApplication.model');db[_0x9bb9('0x100')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')]('../api/whatsappInteraction/whatsappInteraction.model');db[_0x9bb9('0x101')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')]('../api/whatsappMessage/whatsappMessage.model');db[_0x9bb9('0x102')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0x103'));db[_0x9bb9('0x104')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0x105'));db[_0x9bb9('0x106')]=db['sequelize'][_0x9bb9('0x16')](_0x9bb9('0x107'));db[_0x9bb9('0x108')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')](_0x9bb9('0x109'));db[_0x9bb9('0x10a')]=db['sequelize']['import'](_0x9bb9('0x10b'));db[_0x9bb9('0x10c')]=db[_0x9bb9('0x1')][_0x9bb9('0x16')]('../api/teamVoicePrefix/teamVoicePrefix.model');db[_0x9bb9('0x10d')]=db['sequelize'][_0x9bb9('0x16')](_0x9bb9('0x10e'));db[_0x9bb9('0x10f')][_0x9bb9('0x110')](db['VoiceMail'],{'as':_0x9bb9('0x21'),'onDelete':'cascade','foreignKey':_0x9bb9('0x111')});db['User']['hasMany'](db[_0x9bb9('0x1e')],{'as':'Recordings','foreignKey':_0x9bb9('0x111')});db[_0x9bb9('0x10f')][_0x9bb9('0x112')](db[_0x9bb9('0x2f')],{'as':_0x9bb9('0x113'),'foreignKey':_0x9bb9('0x111')});db[_0x9bb9('0x10f')]['hasMany'](db[_0x9bb9('0x18')],{'as':_0x9bb9('0x114'),'onDelete':_0x9bb9('0x115'),'hooks':!![]});db[_0x9bb9('0x10f')]['hasMany'](db[_0x9bb9('0x116')],{'as':_0x9bb9('0x117'),'foreignKey':'UserId'});db[_0x9bb9('0x10f')][_0x9bb9('0x112')](db['CmHopperHistory'],{'as':'HopperHistory','foreignKey':'UserId'});db[_0x9bb9('0x10f')][_0x9bb9('0x112')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0x9bb9('0x111')});db[_0x9bb9('0x10f')]['hasMany'](db[_0x9bb9('0x5e')],{'as':'OpenchannelInteractions','foreignKey':_0x9bb9('0x111')});db[_0x9bb9('0x10f')]['hasMany'](db['ChatInteraction'],{'as':'ChatInteractions','foreignKey':'UserId'});db[_0x9bb9('0x10f')][_0x9bb9('0x112')](db['SmsInteraction'],{'as':_0x9bb9('0x118'),'foreignKey':'UserId'});db[_0x9bb9('0x10f')][_0x9bb9('0x112')](db[_0x9bb9('0x4f')],{'as':_0x9bb9('0x119'),'foreignKey':_0x9bb9('0x111')});db['User']['hasMany'](db[_0x9bb9('0x43')],{'as':_0x9bb9('0x11a'),'foreignKey':_0x9bb9('0x111')});db[_0x9bb9('0x10f')][_0x9bb9('0x112')](db[_0x9bb9('0x100')],{'as':_0x9bb9('0x11b'),'foreignKey':_0x9bb9('0x111')});db['User']['hasMany'](db[_0x9bb9('0x11c')],{'as':_0x9bb9('0x11d'),'foreignKey':_0x9bb9('0x11e')});db[_0x9bb9('0x10f')][_0x9bb9('0x11f')](db[_0x9bb9('0xf7')],{'as':_0x9bb9('0xf7'),'foreignKey':_0x9bb9('0x120')});db[_0x9bb9('0x10f')]['belongsToMany'](db[_0x9bb9('0x6d')],{'as':_0x9bb9('0x121'),'through':_0x9bb9('0x122')});db[_0x9bb9('0x10f')][_0x9bb9('0x123')](db[_0x9bb9('0x72')],{'as':_0x9bb9('0x124'),'through':_0x9bb9('0x125')});db[_0x9bb9('0x10f')]['belongsToMany'](db[_0x9bb9('0xf4')],{'as':_0x9bb9('0x126'),'through':'cm_user_has_lists'});db[_0x9bb9('0x10f')][_0x9bb9('0x123')](db[_0x9bb9('0x127')],{'through':_0x9bb9('0x128')});db[_0x9bb9('0x10f')][_0x9bb9('0x123')](db[_0x9bb9('0x43')],{'as':_0x9bb9('0x11a'),'through':_0x9bb9('0x129')});db['User'][_0x9bb9('0x123')](db[_0x9bb9('0x67')],{'as':'ChatInteractions','through':_0x9bb9('0x12a')});db[_0x9bb9('0x10f')]['belongsToMany'](db[_0x9bb9('0x4f')],{'as':_0x9bb9('0x119'),'through':_0x9bb9('0x12b')});db[_0x9bb9('0x10f')][_0x9bb9('0x123')](db[_0x9bb9('0x12c')],{'as':_0x9bb9('0x118'),'through':_0x9bb9('0x12d')});db[_0x9bb9('0x10f')]['belongsToMany'](db[_0x9bb9('0x5e')],{'as':'OpenchannelInteractions','through':_0x9bb9('0x12e')});db['User']['belongsToMany'](db['WhatsappInteraction'],{'as':_0x9bb9('0x11b'),'through':_0x9bb9('0x12f')});db[_0x9bb9('0x10f')][_0x9bb9('0x123')](db[_0x9bb9('0x1c')],{'as':_0x9bb9('0x130'),'through':'UserVoiceQueue','required':![]});db[_0x9bb9('0x10f')]['belongsToMany'](db[_0x9bb9('0xf5')],{'as':_0x9bb9('0x131'),'through':_0x9bb9('0x10d'),'required':![]});db[_0x9bb9('0x10f')][_0x9bb9('0x123')](db['MailQueue'],{'as':_0x9bb9('0x132'),'through':_0x9bb9('0x34'),'required':![]});db[_0x9bb9('0x10f')][_0x9bb9('0x123')](db[_0x9bb9('0x6b')],{'as':'ChatQueues','through':_0x9bb9('0x33'),'required':![],'hooks':!![]});db[_0x9bb9('0x10f')][_0x9bb9('0x123')](db[_0x9bb9('0x51')],{'as':_0x9bb9('0x133'),'through':_0x9bb9('0x35'),'required':![]});db[_0x9bb9('0x10f')][_0x9bb9('0x123')](db[_0x9bb9('0x59')],{'as':'SmsQueues','through':_0x9bb9('0x134'),'required':![]});db[_0x9bb9('0x10f')]['belongsToMany'](db[_0x9bb9('0x135')],{'as':_0x9bb9('0x136'),'through':_0x9bb9('0x137'),'required':![]});db[_0x9bb9('0x10f')][_0x9bb9('0x123')](db['WhatsappQueue'],{'as':_0x9bb9('0x138'),'through':_0x9bb9('0x39'),'required':![]});db[_0x9bb9('0x10f')][_0x9bb9('0x123')](db[_0x9bb9('0xf4')],{'through':'cm_user_has_lists'});db[_0x9bb9('0x10f')][_0x9bb9('0x123')](db[_0x9bb9('0xf5')],{'as':_0x9bb9('0x131'),'through':'user_has_voice_prefixes','required':![]});db[_0x9bb9('0x10f')][_0x9bb9('0x123')](db[_0x9bb9('0x62')],{'as':_0x9bb9('0x139'),'through':_0x9bb9('0x13a')});db[_0x9bb9('0x10f')][_0x9bb9('0x123')](db[_0x9bb9('0x13b')],{'as':'FaxAccounts','through':_0x9bb9('0x13c')});db['User'][_0x9bb9('0x123')](db[_0x9bb9('0x3d')],{'as':_0x9bb9('0x13d'),'through':_0x9bb9('0x13e')});db['User'][_0x9bb9('0x123')](db['OpenchannelAccount'],{'as':'OpenchannelAccounts','through':_0x9bb9('0x13f')});db['User']['belongsToMany'](db['SmsAccount'],{'as':_0x9bb9('0x140'),'through':_0x9bb9('0x141')});db['User'][_0x9bb9('0x123')](db['WhatsappAccount'],{'as':_0x9bb9('0x142'),'through':_0x9bb9('0x143')});db[_0x9bb9('0x10f')][_0x9bb9('0x123')](db[_0x9bb9('0xde')],{'as':_0x9bb9('0x144'),'through':'user_has_square_projects'});db['VoiceChanSpy'][_0x9bb9('0x112')](db[_0x9bb9('0x18')],{'as':_0x9bb9('0x145'),'onDelete':'cascade','foreignKey':_0x9bb9('0x146')});db[_0x9bb9('0x17')]['hasMany'](db[_0x9bb9('0x18')],{'onDelete':_0x9bb9('0x115')});db['VoiceExtension']['hasMany'](db['VoiceExtension'],{'as':_0x9bb9('0x147'),'onDelete':_0x9bb9('0x115')});db[_0x9bb9('0x1a')]['belongsToMany'](db[_0x9bb9('0x88')],{'as':_0x9bb9('0x148'),'through':'moh_has_sounds'});db[_0x9bb9('0x1c')]['hasMany'](db['UserVoiceQueueRt'],{'as':_0x9bb9('0x149'),'foreignKey':_0x9bb9('0x14a')});db[_0x9bb9('0x1c')]['hasMany'](db[_0x9bb9('0x74')],{'as':_0x9bb9('0x14b'),'foreignKey':'VoiceQueueId'});db[_0x9bb9('0x1c')][_0x9bb9('0x112')](db[_0x9bb9('0x116')],{'as':_0x9bb9('0x117'),'foreignKey':_0x9bb9('0x14a')});db[_0x9bb9('0x1c')]['hasMany'](db[_0x9bb9('0x14c')],{'as':_0x9bb9('0x14d'),'foreignKey':_0x9bb9('0x14a')});db[_0x9bb9('0x1c')][_0x9bb9('0x112')](db['ReportAgentPreview'],{'as':_0x9bb9('0x7a'),'foreignKey':_0x9bb9('0x14a')});db[_0x9bb9('0x1c')]['hasMany'](db['CmHopperBlack'],{'as':_0x9bb9('0x14e'),'foreignKey':'VoiceQueueId'});db[_0x9bb9('0x1c')]['hasMany'](db['JscriptySessionReport'],{'as':_0x9bb9('0x14f'),'foreignKey':_0x9bb9('0x14a')});db[_0x9bb9('0x1c')]['belongsTo'](db[_0x9bb9('0x2b')],{'as':_0x9bb9('0x2b'),'foreignKey':_0x9bb9('0x150')});db['VoiceQueue'][_0x9bb9('0x11f')](db['Trunk'],{'as':'TrunkBackup','foreignKey':_0x9bb9('0x151')});db[_0x9bb9('0x1c')][_0x9bb9('0x11f')](db[_0x9bb9('0x81')],{'as':_0x9bb9('0x81'),'foreignKey':_0x9bb9('0x152')});db[_0x9bb9('0x1c')][_0x9bb9('0x11f')](db[_0x9bb9('0x83')],{'as':_0x9bb9('0x153'),'foreignKey':_0x9bb9('0x154')});db[_0x9bb9('0x1c')][_0x9bb9('0x123')](db['CmList'],{'as':_0x9bb9('0x126'),'through':_0x9bb9('0x155')});db[_0x9bb9('0x1c')][_0x9bb9('0x123')](db[_0x9bb9('0x10f')],{'as':'Agents','through':_0x9bb9('0x31')});db['VoiceQueue'][_0x9bb9('0x123')](db[_0x9bb9('0x127')],{'as':_0x9bb9('0x156'),'through':_0x9bb9('0x10a')});db[_0x9bb9('0x1c')]['belongsToMany'](db[_0x9bb9('0xf4')],{'as':_0x9bb9('0x157'),'through':_0x9bb9('0x158')});db['VoiceRecording']['belongsTo'](db[_0x9bb9('0x10f')],{'as':_0x9bb9('0x10f'),'foreignKey':_0x9bb9('0x111')});db[_0x9bb9('0x1f')]['belongsTo'](db['User'],{'as':_0x9bb9('0x10f'),'foreignKey':_0x9bb9('0x111')});db[_0x9bb9('0x21')]['hasMany'](db[_0x9bb9('0x23')],{'as':_0x9bb9('0x159'),'onDelete':_0x9bb9('0x115'),'foreignKey':_0x9bb9('0x15a'),'sourceKey':_0x9bb9('0x15b')});db[_0x9bb9('0x23')][_0x9bb9('0x11f')](db[_0x9bb9('0x21')],{'foreignKey':_0x9bb9('0x15a'),'targetKey':_0x9bb9('0x15b')});db[_0x9bb9('0x25')]['hasMany'](db[_0x9bb9('0x28')],{'as':_0x9bb9('0x15c'),'foreignKey':_0x9bb9('0x15d'),'constraints':![]});db['VoiceCallReport']['hasMany'](db['VoiceAgentReport'],{'as':'AgentReports','foreignKey':'uniqueid','constraints':![]});db[_0x9bb9('0x25')][_0x9bb9('0x11f')](db[_0x9bb9('0x10f')],{'as':_0x9bb9('0x10f'),'foreignKey':_0x9bb9('0x111')});db[_0x9bb9('0x25')][_0x9bb9('0x11f')](db['CmContact'],{'as':_0x9bb9('0x15e'),'foreignKey':_0x9bb9('0x15f')});db[_0x9bb9('0x3b')][_0x9bb9('0x11f')](db[_0x9bb9('0x3d')],{'as':_0x9bb9('0x3d'),'foreignKey':_0x9bb9('0x160')});db['MailServerOut']['belongsTo'](db[_0x9bb9('0x3d')],{'as':_0x9bb9('0x3d'),'foreignKey':_0x9bb9('0x160')});db[_0x9bb9('0x3d')][_0x9bb9('0x110')](db[_0x9bb9('0x3b')],{'as':_0x9bb9('0x161'),'onDelete':_0x9bb9('0x115')});db[_0x9bb9('0x3d')][_0x9bb9('0x110')](db['MailServerOut'],{'as':_0x9bb9('0x162'),'onDelete':_0x9bb9('0x115')});db[_0x9bb9('0x3d')][_0x9bb9('0x112')](db[_0x9bb9('0x163')],{'as':_0x9bb9('0x164'),'foreignKey':'MailAccountId','onDelete':_0x9bb9('0x115')});db[_0x9bb9('0x3d')][_0x9bb9('0x112')](db[_0x9bb9('0x165')],{'as':_0x9bb9('0x166'),'foreignKey':_0x9bb9('0x160')});db['MailAccount']['hasMany'](db[_0x9bb9('0x45')],{'as':'Messages','foreignKey':_0x9bb9('0x160')});db[_0x9bb9('0x3d')][_0x9bb9('0x112')](db['MailInteraction'],{'as':'Interactions'});db[_0x9bb9('0x3d')][_0x9bb9('0x112')](db['MailApplication'],{'as':_0x9bb9('0x147')});db[_0x9bb9('0x3d')][_0x9bb9('0x11f')](db[_0x9bb9('0xf4')],{'as':'List','foreignKey':_0x9bb9('0x167')});db['MailAccount'][_0x9bb9('0x11f')](db[_0x9bb9('0x8c')],{'as':_0x9bb9('0x8c'),'foreignKey':_0x9bb9('0x168')});db[_0x9bb9('0x3d')][_0x9bb9('0x11f')](db[_0x9bb9('0x83')],{'as':_0x9bb9('0x153'),'foreignKey':_0x9bb9('0x154')});db[_0x9bb9('0x3d')][_0x9bb9('0x123')](db[_0x9bb9('0x10f')],{'as':_0x9bb9('0x169'),'through':_0x9bb9('0x13e')});db['MailQueue']['belongsToMany'](db[_0x9bb9('0x10f')],{'as':'Agents','through':_0x9bb9('0x34')});db['MailQueue'][_0x9bb9('0x123')](db[_0x9bb9('0x127')],{'through':'team_has_mail_queues','as':_0x9bb9('0x156')});db['MailInteraction']['hasMany'](db[_0x9bb9('0x45')],{'as':_0x9bb9('0x159'),'onDelete':_0x9bb9('0x115'),'foreignKey':'MailInteractionId'});db[_0x9bb9('0x43')][_0x9bb9('0x11f')](db[_0x9bb9('0x3d')],{'as':_0x9bb9('0x16a'),'foreignKey':_0x9bb9('0x160')});db[_0x9bb9('0x43')][_0x9bb9('0x11f')](db[_0x9bb9('0x72')],{'as':'Contact','foreignKey':'ContactId'});db[_0x9bb9('0x43')]['belongsTo'](db[_0x9bb9('0x10f')],{'as':_0x9bb9('0x16b'),'foreignKey':_0x9bb9('0x111')});db[_0x9bb9('0x43')]['belongsToMany'](db[_0x9bb9('0x8a')],{'through':_0x9bb9('0x16c'),'as':_0x9bb9('0x16d')});db[_0x9bb9('0x43')]['belongsToMany'](db['Tag'],{'through':_0x9bb9('0x16c'),'as':_0x9bb9('0x16e')});db['MailInteraction']['belongsToMany'](db[_0x9bb9('0x10f')],{'as':_0x9bb9('0x16f'),'through':_0x9bb9('0x129'),'foreignKey':_0x9bb9('0x170')});db[_0x9bb9('0x45')]['hasMany'](db[_0x9bb9('0xea')],{'as':'Attachments','onDelete':_0x9bb9('0x115')});db['MailMessage']['belongsTo'](db[_0x9bb9('0x10f')],{'as':'User'});db[_0x9bb9('0x45')][_0x9bb9('0x11f')](db['CmContact'],{'onDelete':_0x9bb9('0x115'),'as':_0x9bb9('0x15e')});db['MailMessage'][_0x9bb9('0x11f')](db[_0x9bb9('0x43')],{'as':_0x9bb9('0x171'),'foreignKey':'MailInteractionId'});db[_0x9bb9('0x45')][_0x9bb9('0x11f')](db[_0x9bb9('0x3d')],{'as':_0x9bb9('0x16a'),'foreignKey':_0x9bb9('0x160')});db[_0x9bb9('0x45')][_0x9bb9('0x11f')](db[_0x9bb9('0x62')],{'as':_0x9bb9('0x62'),'foreignKey':'ChatWebsiteId'});db[_0x9bb9('0x45')][_0x9bb9('0x11f')](db['ChatOfflineMessage'],{'as':_0x9bb9('0x6a'),'foreignKey':'ChatOfflineMessageId'});db[_0x9bb9('0x172')]['belongsTo'](db[_0x9bb9('0x10f')],{'onDelete':_0x9bb9('0x173')});db[_0x9bb9('0x172')][_0x9bb9('0x11f')](db[_0x9bb9('0x3f')],{'onDelete':_0x9bb9('0x173')});db[_0x9bb9('0x172')][_0x9bb9('0x11f')](db[_0x9bb9('0x3d')],{'onDelete':'restrict'});db[_0x9bb9('0x172')][_0x9bb9('0x11f')](db[_0x9bb9('0x81')],{'onDelete':_0x9bb9('0x173'),'foreignKey':_0x9bb9('0x152')});db['MailApplication']['belongsTo'](db['Tag'],{'onDelete':_0x9bb9('0x173'),'foreignKey':_0x9bb9('0x174')});db[_0x9bb9('0x47')][_0x9bb9('0x11f')](db[_0x9bb9('0x3d')],{});db[_0x9bb9('0x47')][_0x9bb9('0x11f')](db[_0x9bb9('0xf4')],{'as':'List','foreignKey':_0x9bb9('0x167')});db['MailQueueReport'][_0x9bb9('0x11f')](db[_0x9bb9('0x72')],{'as':_0x9bb9('0x15e'),'foreignKey':_0x9bb9('0x15f')});db[_0x9bb9('0x47')][_0x9bb9('0x11f')](db[_0x9bb9('0x43')],{});db[_0x9bb9('0x47')][_0x9bb9('0x11f')](db[_0x9bb9('0x45')],{});db[_0x9bb9('0x47')]['belongsTo'](db[_0x9bb9('0x10f')],{});db[_0x9bb9('0x47')][_0x9bb9('0x11f')](db[_0x9bb9('0x3f')],{});db[_0x9bb9('0x49')]['hasMany'](db[_0x9bb9('0x4b')],{'as':'Items','onDelete':_0x9bb9('0x115')});db[_0x9bb9('0x13b')][_0x9bb9('0x112')](db[_0x9bb9('0x163')],{'as':_0x9bb9('0x164'),'foreignKey':_0x9bb9('0x175'),'onDelete':'cascade'});db[_0x9bb9('0x13b')][_0x9bb9('0x112')](db['CannedAnswer'],{'as':_0x9bb9('0x166'),'foreignKey':_0x9bb9('0x175')});db[_0x9bb9('0x13b')][_0x9bb9('0x112')](db[_0x9bb9('0x4f')],{'as':_0x9bb9('0x176')});db['FaxAccount'][_0x9bb9('0x112')](db[_0x9bb9('0x4e')],{'as':_0x9bb9('0x147')});db[_0x9bb9('0x13b')]['hasMany'](db['VoiceExtension'],{'as':'Exntensions','onDelete':_0x9bb9('0x115')});db[_0x9bb9('0x13b')][_0x9bb9('0x112')](db[_0x9bb9('0x177')],{'as':_0x9bb9('0x159')});db[_0x9bb9('0x13b')][_0x9bb9('0x11f')](db[_0x9bb9('0x2b')],{'as':'Trunk'});db[_0x9bb9('0x13b')][_0x9bb9('0x11f')](db[_0x9bb9('0xf4')],{'as':_0x9bb9('0x178'),'foreignKey':_0x9bb9('0x167')});db[_0x9bb9('0x13b')]['belongsTo'](db[_0x9bb9('0x83')],{'as':_0x9bb9('0x153'),'foreignKey':'mandatoryDispositionPauseId'});db['FaxAccount'][_0x9bb9('0x123')](db[_0x9bb9('0x10f')],{'as':_0x9bb9('0x169'),'through':_0x9bb9('0x13c')});db[_0x9bb9('0x4e')]['belongsTo'](db[_0x9bb9('0x10f')],{'onDelete':_0x9bb9('0x173')});db[_0x9bb9('0x4e')][_0x9bb9('0x11f')](db['FaxQueue'],{'onDelete':_0x9bb9('0x173')});db[_0x9bb9('0x4e')][_0x9bb9('0x11f')](db[_0x9bb9('0x13b')],{'onDelete':_0x9bb9('0x173')});db['FaxApplication']['belongsTo'](db[_0x9bb9('0x8a')],{'onDelete':_0x9bb9('0x173'),'foreignKey':_0x9bb9('0x174')});db[_0x9bb9('0x4f')][_0x9bb9('0x112')](db[_0x9bb9('0x177')],{'as':_0x9bb9('0x159'),'onDelete':_0x9bb9('0x115'),'foreignKey':_0x9bb9('0x179')});db[_0x9bb9('0x4f')][_0x9bb9('0x11f')](db[_0x9bb9('0x13b')],{'as':_0x9bb9('0x16a'),'foreignKey':'FaxAccountId'});db[_0x9bb9('0x4f')][_0x9bb9('0x11f')](db[_0x9bb9('0x72')],{'as':'Contact','foreignKey':_0x9bb9('0x15f')});db[_0x9bb9('0x4f')]['belongsTo'](db[_0x9bb9('0x10f')],{'as':_0x9bb9('0x16b'),'foreignKey':_0x9bb9('0x111')});db['FaxInteraction']['belongsToMany'](db[_0x9bb9('0x8a')],{'through':_0x9bb9('0x17a'),'as':_0x9bb9('0x16d')});db[_0x9bb9('0x4f')][_0x9bb9('0x123')](db[_0x9bb9('0x8a')],{'through':'fax_interaction_has_tags','as':'ThroughTags'});db[_0x9bb9('0x4f')][_0x9bb9('0x123')](db[_0x9bb9('0x10f')],{'as':_0x9bb9('0x16f'),'through':_0x9bb9('0x12b'),'foreignKey':_0x9bb9('0x179')});db['FaxMessage'][_0x9bb9('0x11f')](db[_0x9bb9('0x10f')],{'onDelete':_0x9bb9('0x115'),'as':_0x9bb9('0x10f')});db[_0x9bb9('0x177')][_0x9bb9('0x11f')](db[_0x9bb9('0x4f')],{'as':'Interaction','foreignKey':_0x9bb9('0x179')});db[_0x9bb9('0x177')][_0x9bb9('0x11f')](db[_0x9bb9('0x72')],{'onDelete':'cascade','as':_0x9bb9('0x15e')});db[_0x9bb9('0x177')]['belongsTo'](db['Attachment'],{'as':_0x9bb9('0xea'),'foreignKey':'AttachmentId'});db[_0x9bb9('0x177')][_0x9bb9('0x11f')](db[_0x9bb9('0x13b')],{'as':'Account','foreignKey':_0x9bb9('0x175')});db[_0x9bb9('0x51')][_0x9bb9('0x123')](db[_0x9bb9('0x10f')],{'as':_0x9bb9('0x169'),'through':_0x9bb9('0x35')});db[_0x9bb9('0x51')][_0x9bb9('0x123')](db[_0x9bb9('0x127')],{'through':_0x9bb9('0x17b'),'as':_0x9bb9('0x156')});db[_0x9bb9('0x52')][_0x9bb9('0x11f')](db[_0x9bb9('0x13b')],{});db[_0x9bb9('0x52')]['belongsTo'](db[_0x9bb9('0xf4')],{'as':'List','foreignKey':_0x9bb9('0x167')});db[_0x9bb9('0x52')][_0x9bb9('0x11f')](db[_0x9bb9('0x72')],{'as':_0x9bb9('0x15e'),'foreignKey':_0x9bb9('0x15f')});db[_0x9bb9('0x52')]['belongsTo'](db[_0x9bb9('0x4f')],{});db['FaxQueueReport'][_0x9bb9('0x11f')](db[_0x9bb9('0x177')],{});db[_0x9bb9('0x52')][_0x9bb9('0x11f')](db[_0x9bb9('0x10f')],{});db[_0x9bb9('0x52')][_0x9bb9('0x11f')](db[_0x9bb9('0x51')],{});db['SmsAccount'][_0x9bb9('0x112')](db[_0x9bb9('0x163')],{'as':_0x9bb9('0x164'),'foreignKey':'SmsAccountId','onDelete':_0x9bb9('0x115')});db[_0x9bb9('0x54')][_0x9bb9('0x112')](db['CannedAnswer'],{'as':'Answers','foreignKey':'SmsAccountId'});db['SmsAccount'][_0x9bb9('0x112')](db[_0x9bb9('0x17c')],{'as':_0x9bb9('0x159'),'foreignKey':'SmsAccountId'});db['SmsAccount'][_0x9bb9('0x112')](db[_0x9bb9('0x12c')],{'as':'Interactions'});db[_0x9bb9('0x54')][_0x9bb9('0x112')](db[_0x9bb9('0x17d')],{'as':_0x9bb9('0x147')});db[_0x9bb9('0x54')]['belongsTo'](db['CmList'],{'as':_0x9bb9('0x178'),'foreignKey':_0x9bb9('0x167')});db[_0x9bb9('0x54')][_0x9bb9('0x11f')](db[_0x9bb9('0x83')],{'as':_0x9bb9('0x153'),'foreignKey':_0x9bb9('0x154')});db[_0x9bb9('0x54')]['belongsToMany'](db[_0x9bb9('0x10f')],{'as':_0x9bb9('0x169'),'through':_0x9bb9('0x141')});db[_0x9bb9('0x17d')][_0x9bb9('0x11f')](db[_0x9bb9('0x10f')],{'onDelete':_0x9bb9('0x173')});db['SmsApplication'][_0x9bb9('0x11f')](db['SmsQueue'],{'onDelete':_0x9bb9('0x173')});db[_0x9bb9('0x17d')][_0x9bb9('0x11f')](db['SmsAccount'],{'onDelete':_0x9bb9('0x173')});db['SmsApplication'][_0x9bb9('0x11f')](db['Interval'],{'onDelete':'restrict','foreignKey':_0x9bb9('0x152')});db['SmsApplication'][_0x9bb9('0x11f')](db['Tag'],{'onDelete':_0x9bb9('0x173'),'foreignKey':_0x9bb9('0x174')});db[_0x9bb9('0x12c')][_0x9bb9('0x112')](db[_0x9bb9('0x17c')],{'as':'Messages','onDelete':_0x9bb9('0x115'),'foreignKey':_0x9bb9('0x17e')});db[_0x9bb9('0x12c')][_0x9bb9('0x11f')](db[_0x9bb9('0x54')],{'as':_0x9bb9('0x16a'),'foreignKey':_0x9bb9('0x17f')});db['SmsInteraction'][_0x9bb9('0x11f')](db['CmContact'],{'as':'Contact','foreignKey':_0x9bb9('0x15f')});db[_0x9bb9('0x12c')]['belongsTo'](db[_0x9bb9('0x10f')],{'as':_0x9bb9('0x16b'),'foreignKey':_0x9bb9('0x111')});db['SmsInteraction'][_0x9bb9('0x123')](db[_0x9bb9('0x8a')],{'through':_0x9bb9('0x180'),'as':_0x9bb9('0x16d')});db[_0x9bb9('0x12c')][_0x9bb9('0x123')](db[_0x9bb9('0x8a')],{'through':_0x9bb9('0x180'),'as':_0x9bb9('0x16e')});db[_0x9bb9('0x12c')][_0x9bb9('0x123')](db['User'],{'as':_0x9bb9('0x16f'),'through':_0x9bb9('0x12d'),'foreignKey':'SmsInteractionId'});db['SmsMessage']['belongsTo'](db[_0x9bb9('0x10f')],{'as':_0x9bb9('0x10f')});db[_0x9bb9('0x17c')]['belongsTo'](db['CmContact'],{'onDelete':_0x9bb9('0x115'),'as':_0x9bb9('0x15e')});db[_0x9bb9('0x17c')][_0x9bb9('0x11f')](db['SmsInteraction'],{'onDelete':_0x9bb9('0x115'),'as':_0x9bb9('0x171'),'foreignKey':_0x9bb9('0x17e')});db['SmsMessage'][_0x9bb9('0x11f')](db[_0x9bb9('0x54')],{'as':_0x9bb9('0x16a'),'foreignKey':_0x9bb9('0x17f')});db[_0x9bb9('0x59')][_0x9bb9('0x123')](db[_0x9bb9('0x10f')],{'as':_0x9bb9('0x169'),'through':'UserSmsQueue','foreignKey':_0x9bb9('0x181')});db[_0x9bb9('0x59')]['belongsToMany'](db[_0x9bb9('0x127')],{'through':_0x9bb9('0x182'),'as':_0x9bb9('0x156')});db[_0x9bb9('0x5b')]['hasMany'](db[_0x9bb9('0x163')],{'as':_0x9bb9('0x164'),'foreignKey':_0x9bb9('0x183'),'onDelete':_0x9bb9('0x115')});db[_0x9bb9('0x5b')][_0x9bb9('0x112')](db[_0x9bb9('0x165')],{'as':'Answers','foreignKey':'OpenchannelAccountId'});db[_0x9bb9('0x5b')][_0x9bb9('0x112')](db[_0x9bb9('0x5e')],{'as':_0x9bb9('0x176'),'foreignKey':_0x9bb9('0x183')});db['OpenchannelAccount']['hasMany'](db['OpenchannelMessage'],{'as':_0x9bb9('0x159'),'foreignKey':_0x9bb9('0x183')});db[_0x9bb9('0x5b')][_0x9bb9('0x112')](db[_0x9bb9('0x184')],{'as':_0x9bb9('0x147'),'foreignKey':'OpenchannelAccountId'});db[_0x9bb9('0x5b')][_0x9bb9('0x11f')](db[_0x9bb9('0xf4')],{'as':'List','foreignKey':_0x9bb9('0x167')});db[_0x9bb9('0x5b')]['belongsTo'](db['Pause'],{'as':_0x9bb9('0x153'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x9bb9('0x5b')]['belongsToMany'](db[_0x9bb9('0x10f')],{'as':_0x9bb9('0x169'),'through':_0x9bb9('0x13f')});db[_0x9bb9('0x184')][_0x9bb9('0x11f')](db[_0x9bb9('0x10f')],{'onDelete':_0x9bb9('0x173')});db[_0x9bb9('0x184')][_0x9bb9('0x11f')](db['OpenchannelQueue'],{'onDelete':_0x9bb9('0x173'),'foreignKey':_0x9bb9('0x185')});db[_0x9bb9('0x184')]['belongsTo'](db[_0x9bb9('0x5b')],{'onDelete':_0x9bb9('0x173'),'foreignKey':_0x9bb9('0x183')});db[_0x9bb9('0x184')][_0x9bb9('0x11f')](db[_0x9bb9('0x81')],{'onDelete':'restrict','foreignKey':_0x9bb9('0x152')});db['OpenchannelApplication']['belongsTo'](db[_0x9bb9('0x8a')],{'onDelete':'restrict','foreignKey':_0x9bb9('0x174')});db[_0x9bb9('0x5e')][_0x9bb9('0x112')](db[_0x9bb9('0x186')],{'as':'Messages','onDelete':_0x9bb9('0x115'),'foreignKey':'OpenchannelInteractionId'});db['OpenchannelInteraction']['belongsTo'](db['OpenchannelAccount'],{'as':_0x9bb9('0x16a'),'foreignKey':_0x9bb9('0x183')});db[_0x9bb9('0x5e')]['belongsTo'](db[_0x9bb9('0x72')],{'as':'Contact','foreignKey':_0x9bb9('0x15f')});db[_0x9bb9('0x5e')][_0x9bb9('0x11f')](db[_0x9bb9('0x10f')],{'as':_0x9bb9('0x16b'),'foreignKey':'UserId'});db[_0x9bb9('0x5e')][_0x9bb9('0x123')](db[_0x9bb9('0x8a')],{'through':_0x9bb9('0x187'),'as':'Tags'});db[_0x9bb9('0x5e')][_0x9bb9('0x123')](db[_0x9bb9('0x8a')],{'through':_0x9bb9('0x187'),'as':_0x9bb9('0x16e')});db[_0x9bb9('0x5e')][_0x9bb9('0x123')](db[_0x9bb9('0x10f')],{'as':_0x9bb9('0x16f'),'through':_0x9bb9('0x12e'),'foreignKey':_0x9bb9('0x188')});db[_0x9bb9('0x186')][_0x9bb9('0x11f')](db[_0x9bb9('0x10f')],{'onDelete':'cascade','as':'User'});db[_0x9bb9('0x186')]['belongsTo'](db['CmContact'],{'onDelete':_0x9bb9('0x115'),'as':_0x9bb9('0x15e')});db[_0x9bb9('0x186')]['belongsTo'](db[_0x9bb9('0x5e')],{'onDelete':'cascade','as':_0x9bb9('0x171'),'foreignKey':_0x9bb9('0x188')});db['OpenchannelMessage'][_0x9bb9('0x11f')](db['Attachment'],{'as':_0x9bb9('0xea'),'foreignKey':_0x9bb9('0x189')});db[_0x9bb9('0x186')][_0x9bb9('0x11f')](db[_0x9bb9('0x5b')],{'as':_0x9bb9('0x16a'),'foreignKey':_0x9bb9('0x183')});db['OpenchannelQueue'][_0x9bb9('0x123')](db[_0x9bb9('0x10f')],{'as':_0x9bb9('0x169'),'through':_0x9bb9('0x137'),'foreignKey':_0x9bb9('0x185')});db[_0x9bb9('0x135')]['belongsToMany'](db[_0x9bb9('0x127')],{'through':'team_has_openchannel_queues','as':_0x9bb9('0x156')});db[_0x9bb9('0x62')][_0x9bb9('0x112')](db['Disposition'],{'as':_0x9bb9('0x164'),'foreignKey':_0x9bb9('0x18a'),'onDelete':'cascade'});db['ChatWebsite'][_0x9bb9('0x112')](db[_0x9bb9('0x165')],{'as':_0x9bb9('0x166'),'foreignKey':_0x9bb9('0x18a')});db[_0x9bb9('0x62')]['hasMany'](db[_0x9bb9('0x6e')],{'as':'ProactiveActions'});db[_0x9bb9('0x62')][_0x9bb9('0x112')](db['ChatInteraction'],{'as':_0x9bb9('0x176')});db[_0x9bb9('0x62')][_0x9bb9('0x112')](db[_0x9bb9('0x18b')],{'as':_0x9bb9('0x147')});db[_0x9bb9('0x62')][_0x9bb9('0x112')](db[_0x9bb9('0x68')],{'as':_0x9bb9('0x159')});db[_0x9bb9('0x62')][_0x9bb9('0x11f')](db['CmList'],{'as':_0x9bb9('0x178'),'foreignKey':_0x9bb9('0x167')});db[_0x9bb9('0x62')]['belongsTo'](db['Interval'],{'as':_0x9bb9('0x81'),'foreignKey':_0x9bb9('0x152')});db[_0x9bb9('0x62')][_0x9bb9('0x11f')](db['MailAccount'],{'as':_0x9bb9('0x3d'),'foreignKey':_0x9bb9('0x160')});db['ChatWebsite'][_0x9bb9('0x11f')](db[_0x9bb9('0x83')],{'as':_0x9bb9('0x153'),'foreignKey':_0x9bb9('0x154')});db[_0x9bb9('0x62')][_0x9bb9('0x123')](db[_0x9bb9('0x10f')],{'as':_0x9bb9('0x169'),'through':_0x9bb9('0x13a')});db['OpenchannelQueueReport'][_0x9bb9('0x11f')](db[_0x9bb9('0x5b')],{});db['OpenchannelQueueReport'][_0x9bb9('0x11f')](db[_0x9bb9('0xf4')],{'as':_0x9bb9('0x178'),'foreignKey':_0x9bb9('0x167')});db[_0x9bb9('0x64')][_0x9bb9('0x11f')](db[_0x9bb9('0x72')],{'as':_0x9bb9('0x15e'),'foreignKey':'ContactId'});db[_0x9bb9('0x64')][_0x9bb9('0x11f')](db[_0x9bb9('0x5e')],{});db[_0x9bb9('0x64')][_0x9bb9('0x11f')](db[_0x9bb9('0x186')],{});db[_0x9bb9('0x64')][_0x9bb9('0x11f')](db['User'],{});db[_0x9bb9('0x64')][_0x9bb9('0x11f')](db[_0x9bb9('0x135')],{});db[_0x9bb9('0x18b')][_0x9bb9('0x11f')](db[_0x9bb9('0x10f')],{'as':'Agent','foreignKey':_0x9bb9('0x111'),'onDelete':'restrict'});db[_0x9bb9('0x18b')][_0x9bb9('0x11f')](db[_0x9bb9('0x6b')],{'as':'Queue','foreignKey':'ChatQueueId','onDelete':_0x9bb9('0x173')});db['ChatApplication'][_0x9bb9('0x11f')](db['ChatWebsite'],{'as':_0x9bb9('0x18c'),'foreignKey':'ChatWebsiteId','onDelete':'restrict'});db[_0x9bb9('0x18b')][_0x9bb9('0x11f')](db[_0x9bb9('0x8a')],{'onDelete':_0x9bb9('0x173'),'foreignKey':_0x9bb9('0x174')});db[_0x9bb9('0x67')][_0x9bb9('0x112')](db['ChatMessage'],{'as':'Messages','onDelete':_0x9bb9('0x115'),'foreignKey':_0x9bb9('0x18d')});db['ChatInteraction'][_0x9bb9('0x11f')](db[_0x9bb9('0x62')],{'as':'Account','foreignKey':_0x9bb9('0x18a')});db['ChatInteraction'][_0x9bb9('0x11f')](db[_0x9bb9('0x72')],{'as':_0x9bb9('0x15e'),'foreignKey':'ContactId'});db[_0x9bb9('0x67')][_0x9bb9('0x11f')](db[_0x9bb9('0x10f')],{'as':_0x9bb9('0x16b'),'foreignKey':_0x9bb9('0x111')});db[_0x9bb9('0x67')]['belongsToMany'](db[_0x9bb9('0x8a')],{'through':_0x9bb9('0x18e'),'as':_0x9bb9('0x16d')});db[_0x9bb9('0x67')]['belongsToMany'](db[_0x9bb9('0x8a')],{'through':_0x9bb9('0x18e'),'as':'ThroughTags'});db[_0x9bb9('0x67')]['belongsToMany'](db[_0x9bb9('0x10f')],{'as':_0x9bb9('0x16f'),'through':_0x9bb9('0x12a'),'foreignKey':_0x9bb9('0x18d')});db[_0x9bb9('0x68')][_0x9bb9('0x11f')](db[_0x9bb9('0x10f')],{'onDelete':_0x9bb9('0x115'),'as':_0x9bb9('0x10f')});db['ChatMessage'][_0x9bb9('0x11f')](db[_0x9bb9('0x72')],{'onDelete':_0x9bb9('0x115'),'as':_0x9bb9('0x15e'),'foreignKey':'ContactId'});db[_0x9bb9('0x68')][_0x9bb9('0x11f')](db[_0x9bb9('0x67')],{'onDelete':_0x9bb9('0x115'),'as':_0x9bb9('0x171'),'foreignKey':_0x9bb9('0x18d')});db['ChatMessage'][_0x9bb9('0x11f')](db[_0x9bb9('0xea')],{'as':_0x9bb9('0xea'),'foreignKey':'AttachmentId'});db[_0x9bb9('0x68')][_0x9bb9('0x11f')](db[_0x9bb9('0x62')],{'as':_0x9bb9('0x16a'),'foreignKey':_0x9bb9('0x18a')});db[_0x9bb9('0x6a')]['hasMany'](db[_0x9bb9('0xea')],{'as':'Attachments','foreignKey':'ChatOfflineMessageId','onDelete':_0x9bb9('0x115'),'hooks':!![]});db[_0x9bb9('0x6a')][_0x9bb9('0x11f')](db[_0x9bb9('0x72')],{'onDelete':_0x9bb9('0x115'),'as':_0x9bb9('0x15e'),'foreignKey':_0x9bb9('0x15f')});db[_0x9bb9('0x6a')][_0x9bb9('0x11f')](db['ChatWebsite'],{'as':'Account','foreignKey':_0x9bb9('0x18a')});db[_0x9bb9('0x6b')][_0x9bb9('0x123')](db[_0x9bb9('0x10f')],{'as':_0x9bb9('0x169'),'through':_0x9bb9('0x33'),'hooks':!![]});db['ChatQueue'][_0x9bb9('0x123')](db[_0x9bb9('0x127')],{'through':_0x9bb9('0x18f'),'as':'Teams'});db[_0x9bb9('0x6d')][_0x9bb9('0x112')](db[_0x9bb9('0x190')],{'as':_0x9bb9('0x159'),'foreignKey':_0x9bb9('0x191'),'onDelete':'cascade'});db[_0x9bb9('0x6d')][_0x9bb9('0x123')](db[_0x9bb9('0x10f')],{'as':_0x9bb9('0x149'),'through':_0x9bb9('0x122')});db[_0x9bb9('0x6e')][_0x9bb9('0x11f')](db[_0x9bb9('0x62')],{'as':_0x9bb9('0x18c'),'foreignKey':_0x9bb9('0x18a')});db['CmCompany'][_0x9bb9('0x112')](db[_0x9bb9('0x72')],{'as':'Contacts','foreignKey':_0x9bb9('0x192')});db['CmContact'][_0x9bb9('0x112')](db[_0x9bb9('0x74')],{'as':_0x9bb9('0x14b'),'foreignKey':_0x9bb9('0x15f')});db[_0x9bb9('0x72')][_0x9bb9('0x112')](db['CmHopperFinal'],{'as':_0x9bb9('0x117'),'foreignKey':_0x9bb9('0x15f')});db[_0x9bb9('0x72')]['hasMany'](db[_0x9bb9('0x14c')],{'as':_0x9bb9('0x14d'),'foreignKey':_0x9bb9('0x15f')});db[_0x9bb9('0x72')][_0x9bb9('0x112')](db[_0x9bb9('0x7a')],{'as':_0x9bb9('0x7a'),'foreignKey':'ContactId'});db[_0x9bb9('0x72')][_0x9bb9('0x112')](db[_0x9bb9('0xd2')],{'as':_0x9bb9('0x14f'),'foreignKey':_0x9bb9('0x15f')});db[_0x9bb9('0x72')][_0x9bb9('0x112')](db['OpenchannelInteraction'],{'as':_0x9bb9('0x193'),'foreignKey':_0x9bb9('0x15f'),'onDelete':_0x9bb9('0x173')});db[_0x9bb9('0x72')][_0x9bb9('0x112')](db[_0x9bb9('0x67')],{'as':_0x9bb9('0x194'),'foreignKey':'ContactId','onDelete':_0x9bb9('0x173')});db[_0x9bb9('0x72')][_0x9bb9('0x112')](db[_0x9bb9('0x12c')],{'as':_0x9bb9('0x118'),'foreignKey':_0x9bb9('0x15f'),'onDelete':_0x9bb9('0x173')});db[_0x9bb9('0x72')]['hasMany'](db[_0x9bb9('0x4f')],{'as':'FaxInteractions','foreignKey':_0x9bb9('0x15f'),'onDelete':'restrict'});db[_0x9bb9('0x72')][_0x9bb9('0x112')](db[_0x9bb9('0x43')],{'as':_0x9bb9('0x11a'),'foreignKey':_0x9bb9('0x15f'),'onDelete':'restrict'});db[_0x9bb9('0x72')][_0x9bb9('0x11f')](db[_0x9bb9('0x70')],{'as':'Company','foreignKey':_0x9bb9('0x192')});db[_0x9bb9('0x72')][_0x9bb9('0x11f')](db[_0x9bb9('0xf4')],{'as':_0x9bb9('0x178'),'foreignKey':_0x9bb9('0x167'),'onDelete':_0x9bb9('0x115')});db[_0x9bb9('0x72')][_0x9bb9('0x123')](db[_0x9bb9('0x10f')],{'as':_0x9bb9('0x16f'),'through':'cm_user_has_contacts'});db['CmContact'][_0x9bb9('0x123')](db[_0x9bb9('0x8a')],{'as':'Tags','through':'cm_contact_has_tags'});db[_0x9bb9('0x72')][_0x9bb9('0x123')](db['Tag'],{'through':_0x9bb9('0x195'),'as':_0x9bb9('0x16e')});db['CmHopper'][_0x9bb9('0x11f')](db[_0x9bb9('0x72')],{'as':_0x9bb9('0x15e'),'foreignKey':_0x9bb9('0x15f'),'onDelete':'cascade'});db['CmHopper'][_0x9bb9('0x11f')](db[_0x9bb9('0xf4')],{'as':_0x9bb9('0x178'),'foreignKey':_0x9bb9('0x167'),'onDelete':'cascade'});db[_0x9bb9('0x74')][_0x9bb9('0x11f')](db[_0x9bb9('0x10f')],{'as':_0x9bb9('0x196'),'foreignKey':_0x9bb9('0x111')});db[_0x9bb9('0x74')]['belongsTo'](db[_0x9bb9('0x1c')],{'as':'Queue','foreignKey':_0x9bb9('0x14a'),'onDelete':_0x9bb9('0x115')});db['CmHopper'][_0x9bb9('0x11f')](db['Campaign'],{'as':_0x9bb9('0xe6'),'foreignKey':_0x9bb9('0x197'),'onDelete':_0x9bb9('0x115')});db[_0x9bb9('0x74')]['belongsTo'](db['User'],{'as':_0x9bb9('0x16b'),'foreignKey':_0x9bb9('0x198')});db[_0x9bb9('0x76')][_0x9bb9('0x11f')](db[_0x9bb9('0x72')],{'as':'Contact','foreignKey':_0x9bb9('0x15f'),'onDelete':'cascade'});db[_0x9bb9('0x76')]['belongsTo'](db['CmList'],{'as':_0x9bb9('0x178'),'foreignKey':'ListId','onDelete':_0x9bb9('0x115')});db['CmHopperBlack']['belongsTo'](db[_0x9bb9('0x1c')],{'as':'Queue','foreignKey':_0x9bb9('0x14a'),'onDelete':_0x9bb9('0x115')});db[_0x9bb9('0x76')][_0x9bb9('0x11f')](db[_0x9bb9('0xe6')],{'as':_0x9bb9('0xe6'),'foreignKey':_0x9bb9('0x197'),'onDelete':'cascade'});db[_0x9bb9('0x7d')]['hasMany'](db['Condition'],{'as':{'plural':_0x9bb9('0x199'),'singular':_0x9bb9('0x19a')},'foreignKey':_0x9bb9('0x19b'),'onDelete':_0x9bb9('0x115'),'hooks':!![]});db['Automation']['hasMany'](db[_0x9bb9('0x19c')],{'as':{'plural':_0x9bb9('0x19d'),'singular':_0x9bb9('0x19e')},'foreignKey':_0x9bb9('0x19f'),'onDelete':_0x9bb9('0x115'),'hooks':!![]});db[_0x9bb9('0x7d')][_0x9bb9('0x112')](db[_0x9bb9('0x7c')],{'as':'Actions','foreignKey':'AutomationId','onDelete':_0x9bb9('0x115'),'hooks':!![]});db[_0x9bb9('0x163')][_0x9bb9('0x112')](db[_0x9bb9('0x163')],{'as':_0x9bb9('0x164'),'foreignKey':'ParentId','onDelete':_0x9bb9('0x115')});db['Interval']['hasMany'](db[_0x9bb9('0x81')],{'as':_0x9bb9('0x1a0'),'foreignKey':_0x9bb9('0x152'),'onDelete':'cascade','hooks':!![],'required':![]});db['Interval'][_0x9bb9('0x112')](db[_0x9bb9('0x18')],{'as':_0x9bb9('0x114'),'foreignKey':_0x9bb9('0x152'),'onDelete':_0x9bb9('0x173')});db[_0x9bb9('0x81')][_0x9bb9('0x112')](db[_0x9bb9('0x172')],{'as':_0x9bb9('0x1a1'),'foreignKey':_0x9bb9('0x152')});db[_0x9bb9('0x81')][_0x9bb9('0x112')](db[_0x9bb9('0x18b')],{'as':_0x9bb9('0x1a2'),'foreignKey':'IntervalId'});db['Interval'][_0x9bb9('0x112')](db[_0x9bb9('0x4e')],{'as':'FaxApplications','foreignKey':_0x9bb9('0x152')});db['Interval'][_0x9bb9('0x112')](db[_0x9bb9('0x17d')],{'as':_0x9bb9('0x1a3'),'foreignKey':'IntervalId'});db[_0x9bb9('0x87')][_0x9bb9('0x11f')](db[_0x9bb9('0x3d')],{});db[_0x9bb9('0x87')][_0x9bb9('0x11f')](db[_0x9bb9('0x97')],{'foreignKey':_0x9bb9('0x1a4')});db[_0x9bb9('0x87')]['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':'CustomReportId'});db['Sound']['belongsToMany'](db[_0x9bb9('0x1a')],{'as':_0x9bb9('0x1a5'),'through':'moh_has_sounds','onDelete':_0x9bb9('0x173')});db['Tag']['belongsToMany'](db[_0x9bb9('0x72')],{'through':_0x9bb9('0x195')});db['Tag']['belongsToMany'](db[_0x9bb9('0x67')],{'through':_0x9bb9('0x18e')});db['Tag'][_0x9bb9('0x123')](db['MailInteraction'],{'through':_0x9bb9('0x16c')});db[_0x9bb9('0x8a')]['belongsToMany'](db['SmsInteraction'],{'through':_0x9bb9('0x180')});db['Tag'][_0x9bb9('0x123')](db[_0x9bb9('0x4f')],{'through':_0x9bb9('0x17a')});db[_0x9bb9('0x8a')][_0x9bb9('0x123')](db[_0x9bb9('0x5e')],{'through':_0x9bb9('0x187')});db[_0x9bb9('0x8a')][_0x9bb9('0x123')](db[_0x9bb9('0x100')],{'through':_0x9bb9('0x1a6')});db[_0x9bb9('0x8e')][_0x9bb9('0x112')](db[_0x9bb9('0x19c')],{'as':{'plural':'AllConditions','singular':_0x9bb9('0x1a7')},'foreignKey':_0x9bb9('0x1a8'),'onDelete':_0x9bb9('0x115'),'hooks':!![]});db['Trigger']['hasMany'](db[_0x9bb9('0x19c')],{'as':{'plural':_0x9bb9('0x1a9'),'singular':_0x9bb9('0x1aa')},'foreignKey':'TriggerAnyId','onDelete':_0x9bb9('0x115'),'hooks':!![]});db['Trigger'][_0x9bb9('0x112')](db[_0x9bb9('0x7c')],{'as':_0x9bb9('0x1ab'),'foreignKey':_0x9bb9('0x1ac'),'onDelete':_0x9bb9('0x115'),'hooks':!![]});db[_0x9bb9('0x96')][_0x9bb9('0x112')](db['AnalyticFieldReport'],{'as':'Fields','onDelete':'cascade','foreignKey':_0x9bb9('0x1ad'),'hooks':!![]});db[_0x9bb9('0x97')]['hasMany'](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0x9bb9('0x115'),'foreignKey':_0x9bb9('0x1a4')});db['AnalyticMetric'][_0x9bb9('0x112')](db[_0x9bb9('0x1ae')],{'as':_0x9bb9('0x1af'),'onDelete':_0x9bb9('0x115'),'foreignKey':_0x9bb9('0x1b0')});db[_0x9bb9('0x1ae')][_0x9bb9('0x11f')](db[_0x9bb9('0x9a')],{'foreignKey':_0x9bb9('0x1b0')});db[_0x9bb9('0x9e')]['hasMany'](db[_0x9bb9('0x1b1')],{'as':_0x9bb9('0x1b2'),'onDelete':_0x9bb9('0x115'),'foreignKey':_0x9bb9('0x1b3')});db['SalesforceConfiguration']['hasMany'](db['SalesforceField'],{'as':_0x9bb9('0x1b4'),'onDelete':'cascade','foreignKey':_0x9bb9('0x1b5')});db[_0x9bb9('0x1b1')][_0x9bb9('0x112')](db[_0x9bb9('0xa1')],{'as':'Descriptions','onDelete':_0x9bb9('0x115'),'foreignKey':'DescriptionId'});db[_0x9bb9('0x1b1')][_0x9bb9('0x112')](db[_0x9bb9('0xa1')],{'as':_0x9bb9('0x1af'),'onDelete':_0x9bb9('0x115'),'foreignKey':_0x9bb9('0x1b6')});db[_0x9bb9('0x1b1')][_0x9bb9('0x11f')](db[_0x9bb9('0x9e')],{'as':_0x9bb9('0x16a'),'foreignKey':_0x9bb9('0x1b3')});db[_0x9bb9('0xa1')]['hasMany'](db[_0x9bb9('0xa1')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x9bb9('0xa1')][_0x9bb9('0x112')](db[_0x9bb9('0xa1')],{'as':_0x9bb9('0x1b7'),'foreignKey':_0x9bb9('0x1b8')});db[_0x9bb9('0xa1')][_0x9bb9('0x112')](db[_0x9bb9('0xa1')],{'as':_0x9bb9('0x1b9'),'foreignKey':_0x9bb9('0x1b6')});db[_0x9bb9('0xa1')][_0x9bb9('0x11f')](db[_0x9bb9('0x90')],{'as':_0x9bb9('0x90'),'foreignKey':'VariableId'});db[_0x9bb9('0xa3')][_0x9bb9('0x112')](db['SugarcrmConfiguration'],{'as':_0x9bb9('0x1b2'),'onDelete':_0x9bb9('0x115'),'foreignKey':_0x9bb9('0x1b3')});db[_0x9bb9('0xa5')][_0x9bb9('0x112')](db['SugarcrmField'],{'as':_0x9bb9('0x1b4'),'onDelete':_0x9bb9('0x115'),'foreignKey':_0x9bb9('0x1b5')});db[_0x9bb9('0xa5')]['hasMany'](db[_0x9bb9('0xa7')],{'as':_0x9bb9('0x1ba'),'onDelete':_0x9bb9('0x115'),'foreignKey':_0x9bb9('0x1b8')});db[_0x9bb9('0xa5')][_0x9bb9('0x112')](db[_0x9bb9('0xa7')],{'as':_0x9bb9('0x1af'),'onDelete':_0x9bb9('0x115'),'foreignKey':'FieldId'});db['SugarcrmConfiguration']['belongsTo'](db[_0x9bb9('0xa3')],{'as':_0x9bb9('0x16a'),'foreignKey':_0x9bb9('0x1b3')});db[_0x9bb9('0xa7')]['hasMany'](db[_0x9bb9('0xa7')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x9bb9('0xa7')]['hasMany'](db[_0x9bb9('0xa7')],{'as':'Description','foreignKey':_0x9bb9('0x1b8')});db[_0x9bb9('0xa7')]['hasMany'](db['SugarcrmField'],{'as':_0x9bb9('0x1b9'),'foreignKey':_0x9bb9('0x1b6')});db['SugarcrmField'][_0x9bb9('0x11f')](db['Variable'],{'as':_0x9bb9('0x90'),'foreignKey':_0x9bb9('0x1bb')});db[_0x9bb9('0x1bc')][_0x9bb9('0x112')](db[_0x9bb9('0xaa')],{'as':_0x9bb9('0x1b2'),'onDelete':_0x9bb9('0x115'),'foreignKey':'AccountId'});db[_0x9bb9('0xaa')][_0x9bb9('0x112')](db[_0x9bb9('0xab')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x9bb9('0x1b5')});db[_0x9bb9('0xaa')][_0x9bb9('0x112')](db['DeskField'],{'as':_0x9bb9('0x1ba'),'onDelete':_0x9bb9('0x115'),'foreignKey':_0x9bb9('0x1b8')});db['DeskConfiguration'][_0x9bb9('0x112')](db['DeskField'],{'as':_0x9bb9('0x1af'),'onDelete':_0x9bb9('0x115'),'foreignKey':_0x9bb9('0x1b6')});db[_0x9bb9('0xaa')]['belongsTo'](db['DeskAccount'],{'as':_0x9bb9('0x16a'),'foreignKey':_0x9bb9('0x1b3')});db[_0x9bb9('0xaa')][_0x9bb9('0x123')](db[_0x9bb9('0x8a')],{'through':_0x9bb9('0x1bd')});db[_0x9bb9('0xab')][_0x9bb9('0x112')](db[_0x9bb9('0xab')],{'as':_0x9bb9('0x1be'),'foreignKey':_0x9bb9('0x1b5')});db[_0x9bb9('0xab')][_0x9bb9('0x112')](db[_0x9bb9('0xab')],{'as':'Description','foreignKey':_0x9bb9('0x1b8')});db[_0x9bb9('0xab')][_0x9bb9('0x112')](db[_0x9bb9('0xab')],{'as':'Field','foreignKey':'FieldId'});db[_0x9bb9('0xab')][_0x9bb9('0x11f')](db[_0x9bb9('0x90')],{'as':_0x9bb9('0x90'),'foreignKey':_0x9bb9('0x1bb')});db['ZohoAccount'][_0x9bb9('0x112')](db[_0x9bb9('0xae')],{'as':'Configurations','onDelete':_0x9bb9('0x115'),'foreignKey':'AccountId'});db['ZohoConfiguration'][_0x9bb9('0x112')](db[_0x9bb9('0xaf')],{'as':_0x9bb9('0x1b4'),'onDelete':_0x9bb9('0x115'),'foreignKey':'SubjectId'});db[_0x9bb9('0xae')][_0x9bb9('0x112')](db[_0x9bb9('0xaf')],{'as':_0x9bb9('0x1ba'),'onDelete':_0x9bb9('0x115'),'foreignKey':_0x9bb9('0x1b8')});db[_0x9bb9('0xae')][_0x9bb9('0x112')](db[_0x9bb9('0xaf')],{'as':'Fields','onDelete':_0x9bb9('0x115'),'foreignKey':_0x9bb9('0x1b6')});db['ZohoConfiguration'][_0x9bb9('0x11f')](db[_0x9bb9('0xac')],{'as':_0x9bb9('0x16a'),'foreignKey':'AccountId'});db[_0x9bb9('0xaf')][_0x9bb9('0x112')](db[_0x9bb9('0xaf')],{'as':_0x9bb9('0x1be'),'foreignKey':_0x9bb9('0x1b5')});db['ZohoField'][_0x9bb9('0x112')](db[_0x9bb9('0xaf')],{'as':_0x9bb9('0x1b7'),'foreignKey':_0x9bb9('0x1b8')});db['ZohoField'][_0x9bb9('0x112')](db[_0x9bb9('0xaf')],{'as':'Field','foreignKey':'FieldId'});db[_0x9bb9('0xaf')]['belongsTo'](db[_0x9bb9('0x90')],{'as':_0x9bb9('0x90'),'foreignKey':_0x9bb9('0x1bb')});db['ZendeskAccount'][_0x9bb9('0x112')](db[_0x9bb9('0x1bf')],{'as':'Configurations','onDelete':_0x9bb9('0x115'),'foreignKey':_0x9bb9('0x1b3')});db[_0x9bb9('0x1bf')]['hasMany'](db[_0x9bb9('0xb4')],{'as':_0x9bb9('0x1b4'),'foreignKey':_0x9bb9('0x1b5')});db[_0x9bb9('0x1bf')][_0x9bb9('0x112')](db['ZendeskField'],{'as':_0x9bb9('0x1ba'),'foreignKey':_0x9bb9('0x1b8')});db[_0x9bb9('0x1bf')]['hasMany'](db[_0x9bb9('0xb4')],{'as':'Fields','foreignKey':'FieldId'});db[_0x9bb9('0x1bf')][_0x9bb9('0x11f')](db[_0x9bb9('0xb1')],{'as':_0x9bb9('0x16a'),'foreignKey':_0x9bb9('0x1b3')});db['ZendeskConfiguration'][_0x9bb9('0x123')](db[_0x9bb9('0x8a')],{'through':_0x9bb9('0x1c0')});db[_0x9bb9('0xb4')]['hasMany'](db[_0x9bb9('0xb4')],{'as':_0x9bb9('0x1be'),'foreignKey':'SubjectId'});db[_0x9bb9('0xb4')][_0x9bb9('0x112')](db[_0x9bb9('0xb4')],{'as':'Description','foreignKey':_0x9bb9('0x1b8')});db['ZendeskField'][_0x9bb9('0x112')](db[_0x9bb9('0xb4')],{'as':'Field','foreignKey':_0x9bb9('0x1b6')});db[_0x9bb9('0xb4')]['belongsTo'](db[_0x9bb9('0x90')],{'as':_0x9bb9('0x90'),'foreignKey':_0x9bb9('0x1bb')});db[_0x9bb9('0xb6')]['hasMany'](db[_0x9bb9('0xb8')],{'as':_0x9bb9('0x1b2'),'onDelete':_0x9bb9('0x115'),'foreignKey':_0x9bb9('0x1b3')});db[_0x9bb9('0xb8')][_0x9bb9('0x112')](db[_0x9bb9('0x1c1')],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x9bb9('0xb8')][_0x9bb9('0x112')](db[_0x9bb9('0x1c1')],{'as':_0x9bb9('0x1ba'),'onDelete':_0x9bb9('0x115'),'foreignKey':_0x9bb9('0x1b8')});db['FreshdeskConfiguration'][_0x9bb9('0x112')](db[_0x9bb9('0x1c1')],{'as':'Fields','onDelete':'cascade','foreignKey':'FieldId'});db[_0x9bb9('0xb8')][_0x9bb9('0x11f')](db[_0x9bb9('0xb6')],{'as':_0x9bb9('0x16a'),'foreignKey':_0x9bb9('0x1b3')});db[_0x9bb9('0xb8')][_0x9bb9('0x123')](db[_0x9bb9('0x8a')],{'through':_0x9bb9('0x1c2')});db[_0x9bb9('0x1c1')][_0x9bb9('0x112')](db['FreshdeskField'],{'as':_0x9bb9('0x1be'),'foreignKey':_0x9bb9('0x1b5')});db['FreshdeskField'][_0x9bb9('0x112')](db[_0x9bb9('0x1c1')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x9bb9('0x1c1')][_0x9bb9('0x112')](db[_0x9bb9('0x1c1')],{'as':_0x9bb9('0x1b9'),'foreignKey':'FieldId'});db[_0x9bb9('0x1c1')][_0x9bb9('0x11f')](db[_0x9bb9('0x90')],{'as':_0x9bb9('0x90'),'foreignKey':_0x9bb9('0x1bb')});db[_0x9bb9('0xba')]['hasMany'](db['VtigerConfiguration'],{'as':_0x9bb9('0x1b2'),'onDelete':_0x9bb9('0x115'),'foreignKey':_0x9bb9('0x1b3')});db[_0x9bb9('0x1c3')]['hasMany'](db['VtigerField'],{'as':_0x9bb9('0x1b4'),'foreignKey':_0x9bb9('0x1b5')});db[_0x9bb9('0x1c3')][_0x9bb9('0x112')](db[_0x9bb9('0xbd')],{'as':_0x9bb9('0x1ba'),'foreignKey':_0x9bb9('0x1b8')});db['VtigerConfiguration'][_0x9bb9('0x112')](db[_0x9bb9('0xbd')],{'as':_0x9bb9('0x1af'),'foreignKey':_0x9bb9('0x1b6')});db[_0x9bb9('0x1c3')][_0x9bb9('0x11f')](db[_0x9bb9('0xba')],{'as':'Account','foreignKey':_0x9bb9('0x1b3')});db[_0x9bb9('0xbd')][_0x9bb9('0x112')](db['VtigerField'],{'as':'Subject','foreignKey':_0x9bb9('0x1b5')});db[_0x9bb9('0xbd')][_0x9bb9('0x112')](db[_0x9bb9('0xbd')],{'as':_0x9bb9('0x1b7'),'foreignKey':_0x9bb9('0x1b8')});db[_0x9bb9('0xbd')]['hasMany'](db[_0x9bb9('0xbd')],{'as':'Field','foreignKey':'FieldId'});db[_0x9bb9('0xbd')][_0x9bb9('0x11f')](db[_0x9bb9('0x90')],{'as':_0x9bb9('0x90'),'foreignKey':_0x9bb9('0x1bb')});db[_0x9bb9('0xbf')][_0x9bb9('0x112')](db[_0x9bb9('0x1c4')],{'as':_0x9bb9('0x1b2'),'onDelete':'cascade','foreignKey':_0x9bb9('0x1b3')});db[_0x9bb9('0x1c4')][_0x9bb9('0x112')](db['ServicenowField'],{'as':_0x9bb9('0x1b4'),'foreignKey':_0x9bb9('0x1b5')});db[_0x9bb9('0x1c4')][_0x9bb9('0x112')](db[_0x9bb9('0x1c5')],{'as':_0x9bb9('0x1ba'),'foreignKey':_0x9bb9('0x1b8')});db['ServicenowConfiguration']['hasMany'](db[_0x9bb9('0x1c5')],{'as':_0x9bb9('0x1af'),'foreignKey':'FieldId'});db['ServicenowConfiguration'][_0x9bb9('0x11f')](db[_0x9bb9('0xbf')],{'as':'Account','foreignKey':'AccountId'});db[_0x9bb9('0x1c5')]['hasMany'](db[_0x9bb9('0x1c5')],{'as':_0x9bb9('0x1be'),'foreignKey':_0x9bb9('0x1b5')});db[_0x9bb9('0x1c5')][_0x9bb9('0x112')](db[_0x9bb9('0x1c5')],{'as':'Description','foreignKey':_0x9bb9('0x1b8')});db[_0x9bb9('0x1c5')][_0x9bb9('0x112')](db['ServicenowField'],{'as':_0x9bb9('0x1b9'),'foreignKey':_0x9bb9('0x1b6')});db[_0x9bb9('0x1c5')]['belongsTo'](db[_0x9bb9('0x90')],{'as':_0x9bb9('0x90'),'foreignKey':_0x9bb9('0x1bb')});db[_0x9bb9('0x1c6')][_0x9bb9('0x112')](db[_0x9bb9('0xc3')],{'as':'Configurations','onDelete':_0x9bb9('0x115'),'foreignKey':_0x9bb9('0x1b3')});db['Dynamics365Configuration'][_0x9bb9('0x112')](db[_0x9bb9('0xc5')],{'as':_0x9bb9('0x1b4'),'onDelete':_0x9bb9('0x115'),'foreignKey':_0x9bb9('0x1b5')});db['Dynamics365Configuration'][_0x9bb9('0x112')](db[_0x9bb9('0xc5')],{'as':_0x9bb9('0x1ba'),'onDelete':_0x9bb9('0x115'),'foreignKey':_0x9bb9('0x1b8')});db[_0x9bb9('0xc3')]['hasMany'](db['Dynamics365Field'],{'as':_0x9bb9('0x1af'),'onDelete':_0x9bb9('0x115'),'foreignKey':_0x9bb9('0x1b6')});db[_0x9bb9('0xc3')][_0x9bb9('0x11f')](db['Dynamics365Account'],{'as':'Account','foreignKey':_0x9bb9('0x1b3')});db[_0x9bb9('0xc5')][_0x9bb9('0x112')](db['Dynamics365Field'],{'as':'Subject','foreignKey':_0x9bb9('0x1b5')});db['Dynamics365Field'][_0x9bb9('0x112')](db[_0x9bb9('0xc5')],{'as':_0x9bb9('0x1b7'),'foreignKey':_0x9bb9('0x1b8')});db[_0x9bb9('0xc5')][_0x9bb9('0x112')](db[_0x9bb9('0xc5')],{'as':_0x9bb9('0x1b9'),'foreignKey':_0x9bb9('0x1b6')});db[_0x9bb9('0xc5')][_0x9bb9('0x11f')](db[_0x9bb9('0x90')],{'as':'Variable','foreignKey':_0x9bb9('0x1bb')});db['FreshsalesAccount']['hasMany'](db[_0x9bb9('0xc8')],{'as':_0x9bb9('0x1b2'),'onDelete':_0x9bb9('0x115'),'foreignKey':_0x9bb9('0x1b3')});db[_0x9bb9('0xc8')][_0x9bb9('0x112')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x9bb9('0x1b5')});db[_0x9bb9('0xc8')][_0x9bb9('0x112')](db[_0x9bb9('0xc9')],{'as':_0x9bb9('0x1ba'),'foreignKey':_0x9bb9('0x1b8')});db[_0x9bb9('0xc8')][_0x9bb9('0x112')](db['FreshsalesField'],{'as':_0x9bb9('0x1af'),'foreignKey':_0x9bb9('0x1b6')});db['FreshsalesConfiguration']['belongsTo'](db['FreshsalesAccount'],{'as':_0x9bb9('0x16a'),'foreignKey':'AccountId'});db['FreshsalesField'][_0x9bb9('0x112')](db['FreshsalesField'],{'as':_0x9bb9('0x1be'),'foreignKey':'SubjectId'});db[_0x9bb9('0xc9')]['hasMany'](db['FreshsalesField'],{'as':_0x9bb9('0x1b7'),'foreignKey':_0x9bb9('0x1b8')});db[_0x9bb9('0xc9')][_0x9bb9('0x112')](db[_0x9bb9('0xc9')],{'as':'Field','foreignKey':_0x9bb9('0x1b6')});db['FreshsalesField'][_0x9bb9('0x11f')](db[_0x9bb9('0x90')],{'as':'Variable','foreignKey':_0x9bb9('0x1bb')});db[_0x9bb9('0xcc')][_0x9bb9('0x11f')](db[_0x9bb9('0x62')],{});db[_0x9bb9('0xcc')][_0x9bb9('0x11f')](db[_0x9bb9('0xf4')],{'as':_0x9bb9('0x178'),'foreignKey':_0x9bb9('0x167')});db[_0x9bb9('0xcc')]['belongsTo'](db[_0x9bb9('0x72')],{'as':_0x9bb9('0x15e'),'foreignKey':_0x9bb9('0x15f')});db[_0x9bb9('0xcc')][_0x9bb9('0x11f')](db[_0x9bb9('0x67')],{});db['ChatQueueReport'][_0x9bb9('0x11f')](db[_0x9bb9('0x68')],{});db[_0x9bb9('0xcc')][_0x9bb9('0x11f')](db['User'],{});db[_0x9bb9('0xcc')][_0x9bb9('0x11f')](db['ChatQueue'],{});db['ChatInternalMessage'][_0x9bb9('0x11f')](db[_0x9bb9('0x10f')],{'onDelete':_0x9bb9('0x115'),'foreignKey':_0x9bb9('0x1c7')});db[_0x9bb9('0x190')][_0x9bb9('0x11f')](db[_0x9bb9('0x10f')],{'onDelete':_0x9bb9('0x115'),'foreignKey':_0x9bb9('0x1c8')});db[_0x9bb9('0xd2')][_0x9bb9('0x112')](db[_0x9bb9('0xd0')],{'foreignKey':_0x9bb9('0x1c9'),'onDelete':_0x9bb9('0x115')});db[_0x9bb9('0xd2')][_0x9bb9('0x112')](db[_0x9bb9('0xce')],{'foreignKey':_0x9bb9('0x1c9'),'onDelete':_0x9bb9('0x115')});db['SmsQueueReport']['belongsTo'](db[_0x9bb9('0x54')],{});db[_0x9bb9('0xd4')][_0x9bb9('0x11f')](db[_0x9bb9('0xf4')],{'as':_0x9bb9('0x178'),'foreignKey':_0x9bb9('0x167')});db[_0x9bb9('0xd4')]['belongsTo'](db[_0x9bb9('0x72')],{'as':'Contact','foreignKey':_0x9bb9('0x15f')});db['SmsQueueReport'][_0x9bb9('0x11f')](db['SmsInteraction'],{});db[_0x9bb9('0xd4')][_0x9bb9('0x11f')](db[_0x9bb9('0x17c')],{});db[_0x9bb9('0xd4')][_0x9bb9('0x11f')](db['User'],{});db['SmsQueueReport'][_0x9bb9('0x11f')](db['SmsQueue'],{});db['JscriptyProject'][_0x9bb9('0x112')](db[_0x9bb9('0xd2')],{'foreignKey':_0x9bb9('0x1ca')});db['JscriptyProject'][_0x9bb9('0x112')](db[_0x9bb9('0xd0')],{'foreignKey':'ProjectId'});db[_0x9bb9('0xd8')][_0x9bb9('0x112')](db[_0x9bb9('0xce')],{'foreignKey':_0x9bb9('0x1ca')});db[_0x9bb9('0xde')][_0x9bb9('0x123')](db[_0x9bb9('0x10f')],{'as':_0x9bb9('0x16f'),'through':_0x9bb9('0x1cb')});db[_0x9bb9('0x127')]['belongsToMany'](db[_0x9bb9('0x10f')],{'as':_0x9bb9('0x169'),'through':_0x9bb9('0x128')});db['Team'][_0x9bb9('0x123')](db['VoiceQueue'],{'through':_0x9bb9('0x10a'),'as':_0x9bb9('0x130')});db[_0x9bb9('0x127')][_0x9bb9('0x123')](db['MailQueue'],{'through':_0x9bb9('0x1cc'),'as':_0x9bb9('0x132')});db[_0x9bb9('0x127')]['belongsToMany'](db[_0x9bb9('0x6b')],{'through':_0x9bb9('0x18f'),'as':'ChatQueues'});db['Team'][_0x9bb9('0x123')](db[_0x9bb9('0x51')],{'through':_0x9bb9('0x17b'),'as':_0x9bb9('0x133')});db['Team'][_0x9bb9('0x123')](db['SmsQueue'],{'through':_0x9bb9('0x182'),'as':'SmsQueues'});db[_0x9bb9('0x127')][_0x9bb9('0x123')](db['OpenchannelQueue'],{'through':_0x9bb9('0x1cd'),'as':_0x9bb9('0x136')});db['Team'][_0x9bb9('0x123')](db[_0x9bb9('0x106')],{'through':_0x9bb9('0x1ce'),'as':'WhatsappQueues'});db['Team'][_0x9bb9('0x123')](db[_0x9bb9('0xf5')],{'through':_0x9bb9('0x10c'),'as':_0x9bb9('0x131')});db[_0x9bb9('0xe6')][_0x9bb9('0x112')](db['CmHopper'],{'as':_0x9bb9('0x14b'),'foreignKey':_0x9bb9('0x197')});db[_0x9bb9('0xe6')]['hasMany'](db['CmHopperFinal'],{'as':_0x9bb9('0x117'),'foreignKey':_0x9bb9('0x197')});db[_0x9bb9('0xe6')]['hasMany'](db['CmHopperHistory'],{'as':_0x9bb9('0x14d'),'foreignKey':'CampaignId'});db['Campaign'][_0x9bb9('0x112')](db[_0x9bb9('0x76')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db['Campaign'][_0x9bb9('0x11f')](db[_0x9bb9('0x2b')],{'as':_0x9bb9('0x2b'),'foreignKey':_0x9bb9('0x150')});db[_0x9bb9('0xe6')][_0x9bb9('0x11f')](db[_0x9bb9('0x2b')],{'as':_0x9bb9('0x1cf'),'foreignKey':'TrunkBackupId'});db[_0x9bb9('0xe6')][_0x9bb9('0x11f')](db[_0x9bb9('0x81')],{'as':'Interval','foreignKey':_0x9bb9('0x152')});db[_0x9bb9('0xe6')][_0x9bb9('0x11f')](db['SquareProject'],{'as':'SquareProject','foreignKey':_0x9bb9('0x1d0')});db[_0x9bb9('0xe6')][_0x9bb9('0x123')](db[_0x9bb9('0xf4')],{'as':'Lists','through':_0x9bb9('0x1d1')});db[_0x9bb9('0xe6')][_0x9bb9('0x123')](db[_0x9bb9('0xf4')],{'as':_0x9bb9('0x157'),'through':_0x9bb9('0x1d2')});db[_0x9bb9('0xea')][_0x9bb9('0x11f')](db[_0x9bb9('0x6a')],{'as':_0x9bb9('0x6a'),'foreignKey':_0x9bb9('0x1d3')});db[_0x9bb9('0x1d4')][_0x9bb9('0x11f')](db[_0x9bb9('0x45')],{});db['MailTransferReport'][_0x9bb9('0x11f')](db['MailInteraction'],{});db[_0x9bb9('0x1d4')][_0x9bb9('0x11f')](db['MailAccount'],{'foreignKey':_0x9bb9('0x1d5'),'as':'FromAccount'});db[_0x9bb9('0x1d4')][_0x9bb9('0x11f')](db['User'],{'foreignKey':_0x9bb9('0x1d6'),'as':_0x9bb9('0x1d7')});db['MailTransferReport']['belongsTo'](db[_0x9bb9('0x10f')],{'foreignKey':_0x9bb9('0x1d8'),'as':_0x9bb9('0x1d9')});db['MailTransferReport'][_0x9bb9('0x11f')](db['MailQueue'],{'foreignKey':_0x9bb9('0x1da'),'as':'ToQueue'});db[_0x9bb9('0x1d4')][_0x9bb9('0x11f')](db[_0x9bb9('0x3d')],{'foreignKey':_0x9bb9('0x1db'),'as':'ToAccount'});db[_0x9bb9('0xee')][_0x9bb9('0x11f')](db[_0x9bb9('0x68')],{});db['ChatTransferReport'][_0x9bb9('0x11f')](db[_0x9bb9('0x67')],{});db['ChatTransferReport'][_0x9bb9('0x11f')](db[_0x9bb9('0x62')],{'foreignKey':_0x9bb9('0x1dc'),'as':_0x9bb9('0x1dd')});db[_0x9bb9('0xee')][_0x9bb9('0x11f')](db[_0x9bb9('0x10f')],{'foreignKey':_0x9bb9('0x1d6'),'as':_0x9bb9('0x1d7')});db[_0x9bb9('0xee')][_0x9bb9('0x11f')](db[_0x9bb9('0x10f')],{'foreignKey':_0x9bb9('0x1d8'),'as':'ToAgent'});db[_0x9bb9('0xee')][_0x9bb9('0x11f')](db['ChatQueue'],{'foreignKey':'ToChatQueueId','as':_0x9bb9('0x1de')});db[_0x9bb9('0xee')][_0x9bb9('0x11f')](db['ChatWebsite'],{'foreignKey':_0x9bb9('0x1df'),'as':_0x9bb9('0x1e0')});db[_0x9bb9('0x1e1')]['belongsTo'](db['FaxMessage'],{});db[_0x9bb9('0x1e1')]['belongsTo'](db[_0x9bb9('0x4f')],{});db[_0x9bb9('0x1e1')][_0x9bb9('0x11f')](db['FaxAccount'],{'foreignKey':_0x9bb9('0x1e2'),'as':'FromAccount'});db[_0x9bb9('0x1e1')][_0x9bb9('0x11f')](db[_0x9bb9('0x10f')],{'foreignKey':_0x9bb9('0x1d6'),'as':_0x9bb9('0x1d7')});db[_0x9bb9('0x1e1')][_0x9bb9('0x11f')](db['User'],{'foreignKey':_0x9bb9('0x1d8'),'as':_0x9bb9('0x1d9')});db[_0x9bb9('0x1e1')]['belongsTo'](db[_0x9bb9('0x51')],{'foreignKey':_0x9bb9('0x1e3'),'as':_0x9bb9('0x1de')});db[_0x9bb9('0x1e1')][_0x9bb9('0x11f')](db[_0x9bb9('0x13b')],{'foreignKey':_0x9bb9('0x1e4'),'as':_0x9bb9('0x1e0')});db[_0x9bb9('0xf1')][_0x9bb9('0x11f')](db['OpenchannelMessage'],{});db[_0x9bb9('0xf1')][_0x9bb9('0x11f')](db[_0x9bb9('0x5e')],{});db[_0x9bb9('0xf1')][_0x9bb9('0x11f')](db[_0x9bb9('0x5b')],{'foreignKey':_0x9bb9('0x1e5'),'as':_0x9bb9('0x1dd')});db[_0x9bb9('0xf1')][_0x9bb9('0x11f')](db['User'],{'foreignKey':_0x9bb9('0x1d6'),'as':_0x9bb9('0x1d7')});db[_0x9bb9('0xf1')][_0x9bb9('0x11f')](db[_0x9bb9('0x10f')],{'foreignKey':'ToUserId','as':'ToAgent'});db['OpenchannelTransferReport']['belongsTo'](db[_0x9bb9('0x135')],{'foreignKey':_0x9bb9('0x1e6'),'as':_0x9bb9('0x1de')});db[_0x9bb9('0xf1')][_0x9bb9('0x11f')](db[_0x9bb9('0x5b')],{'foreignKey':'ToOpenchannelAccountId','as':_0x9bb9('0x1e0')});db[_0x9bb9('0x1e7')]['belongsTo'](db[_0x9bb9('0x17c')],{});db[_0x9bb9('0x1e7')][_0x9bb9('0x11f')](db[_0x9bb9('0x12c')],{});db['SmsTransferReport'][_0x9bb9('0x11f')](db['SmsAccount'],{'foreignKey':_0x9bb9('0x1e8'),'as':_0x9bb9('0x1dd')});db[_0x9bb9('0x1e7')][_0x9bb9('0x11f')](db[_0x9bb9('0x10f')],{'foreignKey':_0x9bb9('0x1d6'),'as':_0x9bb9('0x1d7')});db['SmsTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x9bb9('0x1d8'),'as':_0x9bb9('0x1d9')});db['SmsTransferReport'][_0x9bb9('0x11f')](db[_0x9bb9('0x59')],{'foreignKey':_0x9bb9('0x1e9'),'as':_0x9bb9('0x1de')});db[_0x9bb9('0x1e7')]['belongsTo'](db[_0x9bb9('0x54')],{'foreignKey':_0x9bb9('0x1ea'),'as':_0x9bb9('0x1e0')});db['CmList']['hasMany'](db[_0x9bb9('0x163')],{'as':'Dispositions','foreignKey':_0x9bb9('0x167'),'onDelete':'cascade'});db[_0x9bb9('0xf4')]['hasMany'](db[_0x9bb9('0x1eb')],{'as':_0x9bb9('0x1ec'),'foreignKey':_0x9bb9('0x167')});db[_0x9bb9('0xf4')][_0x9bb9('0x112')](db[_0x9bb9('0x72')],{'as':_0x9bb9('0x124'),'onDelete':'cascade','foreignKey':'ListId'});db[_0x9bb9('0xf4')]['hasMany'](db[_0x9bb9('0x116')],{'as':_0x9bb9('0x117'),'foreignKey':_0x9bb9('0x167')});db['CmList'][_0x9bb9('0x112')](db[_0x9bb9('0x14c')],{'as':_0x9bb9('0x1ed'),'foreignKey':_0x9bb9('0x167')});db['CmList'][_0x9bb9('0x112')](db[_0x9bb9('0x7a')],{'as':'ReportAgentPreview','foreignKey':_0x9bb9('0x167')});db['CmList']['belongsToMany'](db['VoiceQueue'],{'as':_0x9bb9('0x1ee'),'through':_0x9bb9('0x155')});db[_0x9bb9('0xf4')][_0x9bb9('0x123')](db[_0x9bb9('0x10f')],{'as':_0x9bb9('0x169'),'through':_0x9bb9('0x1ef')});db[_0x9bb9('0xf5')][_0x9bb9('0x112')](db[_0x9bb9('0x18')],{'as':'Extensions','onDelete':_0x9bb9('0x115')});db[_0x9bb9('0xf5')][_0x9bb9('0x123')](db[_0x9bb9('0x10f')],{'as':'Agents','through':_0x9bb9('0x10d')});db[_0x9bb9('0xf5')][_0x9bb9('0x123')](db[_0x9bb9('0x127')],{'through':_0x9bb9('0x10c'),'as':_0x9bb9('0x156')});db[_0x9bb9('0xf7')]['hasMany'](db[_0x9bb9('0x10f')],{'as':_0x9bb9('0x16f'),'foreignKey':_0x9bb9('0x120')});db[_0x9bb9('0xf7')][_0x9bb9('0x112')](db[_0x9bb9('0x1f0')],{'as':'UserProfileSections','foreignKey':_0x9bb9('0x120'),'onDelete':_0x9bb9('0x115')});db[_0x9bb9('0x1f0')][_0x9bb9('0x112')](db[_0x9bb9('0xfa')],{'as':'Resources','foreignKey':_0x9bb9('0x1f1'),'onDelete':_0x9bb9('0x115')});db[_0x9bb9('0xfd')][_0x9bb9('0x112')](db[_0x9bb9('0x163')],{'as':_0x9bb9('0x164'),'foreignKey':_0x9bb9('0x1f2'),'onDelete':_0x9bb9('0x115')});db[_0x9bb9('0xfd')]['hasMany'](db['CannedAnswer'],{'as':_0x9bb9('0x166'),'foreignKey':_0x9bb9('0x1f2')});db['WhatsappAccount'][_0x9bb9('0x112')](db[_0x9bb9('0x101')],{'as':'Messages','foreignKey':_0x9bb9('0x1f2')});db[_0x9bb9('0xfd')]['hasMany'](db['WhatsappInteraction'],{'as':_0x9bb9('0x176')});db['WhatsappAccount'][_0x9bb9('0x112')](db['WhatsappApplication'],{'as':_0x9bb9('0x147')});db[_0x9bb9('0xfd')]['belongsTo'](db[_0x9bb9('0xf4')],{'as':_0x9bb9('0x178'),'foreignKey':'ListId'});db[_0x9bb9('0xfd')][_0x9bb9('0x11f')](db['Pause'],{'as':_0x9bb9('0x153'),'foreignKey':_0x9bb9('0x154')});db[_0x9bb9('0xfd')][_0x9bb9('0x123')](db[_0x9bb9('0x10f')],{'as':_0x9bb9('0x169'),'through':_0x9bb9('0x143')});db['WhatsappApplication']['belongsTo'](db[_0x9bb9('0x10f')],{'onDelete':'restrict'});db[_0x9bb9('0xff')]['belongsTo'](db[_0x9bb9('0x106')],{'onDelete':'restrict'});db['WhatsappApplication'][_0x9bb9('0x11f')](db[_0x9bb9('0xfd')],{'onDelete':_0x9bb9('0x173')});db[_0x9bb9('0xff')]['belongsTo'](db[_0x9bb9('0x81')],{'onDelete':'restrict','foreignKey':_0x9bb9('0x152')});db[_0x9bb9('0xff')][_0x9bb9('0x11f')](db[_0x9bb9('0x8a')],{'onDelete':_0x9bb9('0x173'),'foreignKey':_0x9bb9('0x174')});db[_0x9bb9('0x100')][_0x9bb9('0x112')](db[_0x9bb9('0x101')],{'as':_0x9bb9('0x159'),'onDelete':_0x9bb9('0x115'),'foreignKey':_0x9bb9('0x1f3')});db['WhatsappInteraction']['belongsTo'](db[_0x9bb9('0xfd')],{'as':_0x9bb9('0x16a'),'foreignKey':_0x9bb9('0x1f2')});db[_0x9bb9('0x100')][_0x9bb9('0x11f')](db['CmContact'],{'as':_0x9bb9('0x15e'),'foreignKey':_0x9bb9('0x15f')});db[_0x9bb9('0x100')][_0x9bb9('0x11f')](db[_0x9bb9('0x10f')],{'as':_0x9bb9('0x16b'),'foreignKey':_0x9bb9('0x111')});db[_0x9bb9('0x100')][_0x9bb9('0x123')](db[_0x9bb9('0x8a')],{'through':_0x9bb9('0x1a6'),'as':_0x9bb9('0x16d')});db['WhatsappInteraction'][_0x9bb9('0x123')](db[_0x9bb9('0x8a')],{'through':_0x9bb9('0x1a6'),'as':'ThroughTags'});db['WhatsappInteraction'][_0x9bb9('0x123')](db[_0x9bb9('0x10f')],{'as':'Users','through':_0x9bb9('0x12f'),'foreignKey':'WhatsappInteractionId'});db['WhatsappMessage']['belongsTo'](db[_0x9bb9('0x10f')],{'as':_0x9bb9('0x10f')});db[_0x9bb9('0x101')][_0x9bb9('0x11f')](db[_0x9bb9('0x72')],{'onDelete':'cascade','as':_0x9bb9('0x15e')});db[_0x9bb9('0x101')]['belongsTo'](db['WhatsappInteraction'],{'onDelete':_0x9bb9('0x115'),'as':_0x9bb9('0x171'),'foreignKey':_0x9bb9('0x1f3')});db[_0x9bb9('0x101')][_0x9bb9('0x11f')](db['WhatsappAccount'],{'as':'Account','foreignKey':_0x9bb9('0x1f2')});db[_0x9bb9('0x102')][_0x9bb9('0x11f')](db[_0x9bb9('0xfd')],{});db[_0x9bb9('0x102')][_0x9bb9('0x11f')](db[_0x9bb9('0xf4')],{'as':'List','foreignKey':'ListId'});db[_0x9bb9('0x102')]['belongsTo'](db[_0x9bb9('0x72')],{'as':_0x9bb9('0x15e'),'foreignKey':_0x9bb9('0x15f')});db[_0x9bb9('0x102')][_0x9bb9('0x11f')](db['WhatsappInteraction'],{});db[_0x9bb9('0x102')][_0x9bb9('0x11f')](db[_0x9bb9('0x106')],{});db[_0x9bb9('0x102')]['belongsTo'](db[_0x9bb9('0x101')],{});db['WhatsappQueueReport'][_0x9bb9('0x11f')](db['User'],{});db[_0x9bb9('0x104')][_0x9bb9('0x11f')](db[_0x9bb9('0x101')],{});db[_0x9bb9('0x104')]['belongsTo'](db[_0x9bb9('0x100')],{});db[_0x9bb9('0x104')][_0x9bb9('0x11f')](db[_0x9bb9('0xfd')],{'foreignKey':_0x9bb9('0x1f4'),'as':_0x9bb9('0x1dd')});db['WhatsappTransferReport'][_0x9bb9('0x11f')](db['WhatsappAccount'],{'foreignKey':_0x9bb9('0x1f5'),'as':_0x9bb9('0x1e0')});db['WhatsappTransferReport']['belongsTo'](db[_0x9bb9('0x106')],{'foreignKey':_0x9bb9('0x1f6'),'as':'ToQueue'});db[_0x9bb9('0x104')][_0x9bb9('0x11f')](db[_0x9bb9('0x10f')],{'foreignKey':_0x9bb9('0x1d6'),'as':_0x9bb9('0x1d7')});db[_0x9bb9('0x104')][_0x9bb9('0x11f')](db[_0x9bb9('0x10f')],{'foreignKey':_0x9bb9('0x1d8'),'as':_0x9bb9('0x1d9')});db['WhatsappQueue'][_0x9bb9('0x123')](db[_0x9bb9('0x10f')],{'as':_0x9bb9('0x169'),'through':_0x9bb9('0x39'),'foreignKey':_0x9bb9('0x1f7')});db[_0x9bb9('0x106')][_0x9bb9('0x123')](db['Team'],{'through':_0x9bb9('0x1ce'),'as':'Teams'});module[_0x9bb9('0x1f8')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x528e=['VoiceExtension','HopperFinals','OpenchannelInteractions','ChatInteractions','SmsInteraction','SmsInteractions','FaxInteractions','MailInteractions','UserNotifications','belongsTo','UserProfile','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','WhatsappInteractions','VoiceQueues','VoicePrefixes','ChatQueue','ChatQueues','FaxQueues','SmsQueues','UserSmsQueue','WhatsappQueue','WhatsappQueues','UserWhatsappQueue','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','ChanSpyId','Applications','VoiceMusicOnHold','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','CmHopperFinal','HopperHistories','JscriptySessions','TrunkId','TrunkBackupId','IntervalId','Pause','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','BlackLists','Messages','mailboxuser','mailbox','QueueCalls','AgentReports','uniqueid','Contact','ContactId','MailServerIn','MailAccountId','hasOne','Imap','Smtp','Dispositions','CannedAnswer','Answers','Interactions','ListId','TemplateId','team_has_mail_queues','MailInteractionId','Account','Owner','Tags','ThroughTags','Users','Attachment','Attachments','Interaction','ChatOfflineMessageId','restrict','List','DashboardItem','Items','FaxAccountId','Exntensions','TagId','fax_interaction_has_tags','FaxInteractionId','AttachmentId','team_has_fax_queues','FaxQueueReport','SmsMessage','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueue','SmsQueueId','OpenchannelAccountId','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','team_has_openchannel_queues','ChatWebsiteId','Queue','Website','chat_interaction_has_tags','ChatInteractionId','team_has_chat_queues','ChatGroupId','CmCompany','CompanyId','Company','cm_contact_has_tags','Agent','CampaignId','OwnerId','CmHopperBlack','All','OneAll','AutomationAllId','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','Extensions','MailApplications','FaxApplications','SmsApplications','Schedule','DefaultReportId','CustomReportId','Sound','Mohs','mail_interaction_has_tags','whatsapp_interaction_has_tags','Trigger','AllConditions','TriggerAllId','AnyCondition','TriggerAnyId','TriggerId','Fields','MetricId','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Description','VariableId','SugarcrmAccount','SugarcrmField','Field','int_desk_configuration_has_tags','ZohoConfiguration','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','ServicenowAccount','FreshsalesField','FromId','ToId','SessionId','ProjectId','MailQueues','team_has_sms_queues','HopperBlacks','TrunkBackup','Lists','campaigns_has_cm_lists','FromMailAccountId','FromAccount','ToUserId','ToAgent','ToQueue','ToMailAccountId','ToAccount','ChatTransferReport','FromUserId','FromAgent','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','ToOpenchannelQueueId','FromSmsAccountId','CustomFields','HopperHistory','Queues','userProfileId','UserProfileSection','UserProfileSections','Resources','sectionId','WhatsappAccountId','user_has_whatsapp_interactions','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','team_has_whatsapp_queues','../config/environment','sequelize','jstz','determine','motion2','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','defaultsDeep','xcall','xC@LL1234','database','username','password','options','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','UserVoiceQueue','UserChatQueue','UserMailQueue','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','../api/userWhatsappQueue/userWhatsappQueue.model','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','FaxInteraction','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsApplication','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','../api/chatQueue/chatQueue.model','ChatGroup','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','CmContact','CmHopper','../api/cmHopper/cmHopper.model','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','Disposition','Condition','Interval','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','../api/schedule/schedule.model','Tag','../api/tag/tag.model','Template','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject','SquareRecording','../api/squareRecording/squareRecording.model','../api/squareMessage/squareMessage.model','../api/team/team.model','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','CmList','VoicePrefix','../api/voicePrefix/voicePrefix.model','../api/userProfile/userProfile.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','WhatsappTransferReport','../api/whatsappQueue/whatsappQueue.model','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','VoiceMail','cascade','VoiceRecording','Recordings','UserId','hasMany','UserVoiceQueueRt'];(function(_0x126f62,_0x470f78){var _0x34e3c6=function(_0x24d630){while(--_0x24d630){_0x126f62['push'](_0x126f62['shift']());}};_0x34e3c6(++_0x470f78);}(_0x528e,0xe5));var _0xe528=function(_0xf76211,_0x2fa5eb){_0xf76211=_0xf76211-0x0;var _0x3dc224=_0x528e[_0xf76211];return _0x3dc224;};'use strict';var config=require(_0xe528('0x0'));var Sequelize=require(_0xe528('0x1'));var _=require('lodash');var jstz=require(_0xe528('0x2'));var timezone=jstz[_0xe528('0x3')]();config[_0xe528('0x1')]=_['defaultsDeep'](config[_0xe528('0x1')],{'database':_0xe528('0x4'),'username':'xcall','password':'xC@LL1234','options':{'host':_0xe528('0x5'),'port':0xcea,'dialect':_0xe528('0x6'),'dialectOptions':{'charset':_0xe528('0x7')},'logging':![],'timezone':timezone[_0xe528('0x8')](),'define':{'charset':_0xe528('0x9'),'collate':_0xe528('0xa')}}});config[_0xe528('0xb')]=_[_0xe528('0xc')](config['sequelizeHistory'],{'database':_0xe528('0x4'),'username':_0xe528('0xd'),'password':_0xe528('0xe'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xe528('0x6'),'dialectOptions':{'charset':_0xe528('0x7')},'logging':![],'timezone':timezone[_0xe528('0x8')](),'define':{'charset':_0xe528('0x9'),'collate':_0xe528('0xa')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0xe528('0xf')],config[_0xe528('0x1')][_0xe528('0x10')],config['sequelize'][_0xe528('0x11')],config[_0xe528('0x1')][_0xe528('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xe528('0xb')][_0xe528('0xf')],config[_0xe528('0xb')][_0xe528('0x10')],config[_0xe528('0xb')][_0xe528('0x11')],config[_0xe528('0xb')][_0xe528('0x12')])};db[_0xe528('0x13')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x15'));db[_0xe528('0x16')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x17'));db[_0xe528('0x18')]=db[_0xe528('0x1')][_0xe528('0x14')]('../api/voiceContext/voiceContext.model');db['VoiceExtension']=db[_0xe528('0x1')][_0xe528('0x14')]('../api/voiceExtension/voiceExtension.model');db['VoiceMusicOnHold']=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x19'));db[_0xe528('0x1a')]=db['sequelize'][_0xe528('0x14')](_0xe528('0x1b'));db['VoiceRecording']=db[_0xe528('0x1')][_0xe528('0x14')]('../api/voiceRecording/voiceRecording.model');db[_0xe528('0x1c')]=db['sequelize']['import'](_0xe528('0x1d'));db['VoiceMail']=db['sequelize'][_0xe528('0x14')](_0xe528('0x1e'));db[_0xe528('0x1f')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x20'));db[_0xe528('0x21')]=db[_0xe528('0x1')]['import'](_0xe528('0x22'));db['VoiceDialReport']=db[_0xe528('0x1')][_0xe528('0x14')]('../api/voiceDialReport/voiceDialReport.model');db[_0xe528('0x23')]=db['sequelize'][_0xe528('0x14')](_0xe528('0x24'));db[_0xe528('0x25')]=db[_0xe528('0x1')]['import']('../api/voiceQueueReport/voiceQueueReport.model');db['MemberReport']=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x26'));db[_0xe528('0x27')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x28'));db['VoiceTransferReport']=db[_0xe528('0x1')][_0xe528('0x14')]('../api/voiceTransferReport/voiceTransferReport.model');db['UserVoiceQueueRt']=db['sequelize'][_0xe528('0x14')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0xe528('0x29')]=db[_0xe528('0x1')][_0xe528('0x14')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0xe528('0x2a')]=db['sequelize'][_0xe528('0x14')]('../api/userChatQueue/userChatQueue.model');db[_0xe528('0x2b')]=db['sequelize'][_0xe528('0x14')](_0xe528('0x2c'));db['UserFaxQueue']=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x2d'));db['UserSmsQueue']=db['sequelize']['import'](_0xe528('0x2e'));db[_0xe528('0x2f')]=db[_0xe528('0x1')]['import'](_0xe528('0x30'));db['UserWhatsappQueue']=db['sequelize'][_0xe528('0x14')](_0xe528('0x31'));db['MailServerIn']=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x32'));db[_0xe528('0x33')]=db[_0xe528('0x1')]['import'](_0xe528('0x34'));db[_0xe528('0x35')]=db['sequelize'][_0xe528('0x14')]('../api/mailAccount/mailAccount.model');db[_0xe528('0x36')]=db[_0xe528('0x1')][_0xe528('0x14')]('../api/mailQueue/mailQueue.model');db[_0xe528('0x37')]=db[_0xe528('0x1')][_0xe528('0x14')]('../api/mailSubstatus/mailSubstatus.model');db[_0xe528('0x38')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x39'));db[_0xe528('0x3a')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x3b'));db[_0xe528('0x3c')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x3d'));db[_0xe528('0x3e')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x3f'));db[_0xe528('0x40')]=db['sequelize'][_0xe528('0x14')]('../api/dashboard/dashboard.model');db['DashboardItem']=db['sequelize'][_0xe528('0x14')]('../api/dashboardItem/dashboardItem.model');db[_0xe528('0x41')]=db['sequelize']['import'](_0xe528('0x42'));db[_0xe528('0x43')]=db[_0xe528('0x1')][_0xe528('0x14')]('../api/faxApplication/faxApplication.model');db[_0xe528('0x44')]=db['sequelize'][_0xe528('0x14')]('../api/faxInteraction/faxInteraction.model');db[_0xe528('0x45')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x46'));db[_0xe528('0x47')]=db['sequelize'][_0xe528('0x14')]('../api/faxQueue/faxQueue.model');db['FaxQueueReport']=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x48'));db[_0xe528('0x49')]=db[_0xe528('0x1')][_0xe528('0x14')]('../api/smsAccount/smsAccount.model');db[_0xe528('0x4a')]=db['sequelize'][_0xe528('0x14')](_0xe528('0x4b'));db['SmsInteraction']=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x4c'));db['SmsMessage']=db[_0xe528('0x1')][_0xe528('0x14')]('../api/smsMessage/smsMessage.model');db['SmsQueue']=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x4d'));db[_0xe528('0x4e')]=db['sequelize']['import'](_0xe528('0x4f'));db[_0xe528('0x50')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x51'));db[_0xe528('0x52')]=db[_0xe528('0x1')][_0xe528('0x14')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0xe528('0x53')]=db['sequelize'][_0xe528('0x14')](_0xe528('0x54'));db[_0xe528('0x55')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x56'));db[_0xe528('0x57')]=db[_0xe528('0x1')]['import'](_0xe528('0x58'));db[_0xe528('0x59')]=db[_0xe528('0x1')]['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0xe528('0x5a')]=db[_0xe528('0x1')]['import'](_0xe528('0x5b'));db[_0xe528('0x5c')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x5d'));db[_0xe528('0x5e')]=db['sequelize'][_0xe528('0x14')](_0xe528('0x5f'));db[_0xe528('0x60')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x61'));db['ChatQueue']=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x62'));db[_0xe528('0x63')]=db[_0xe528('0x1')][_0xe528('0x14')]('../api/chatGroup/chatGroup.model');db[_0xe528('0x64')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x65'));db['CmCompany']=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x66'));db[_0xe528('0x67')]=db[_0xe528('0x1')][_0xe528('0x14')]('../api/cmContact/cmContact.model');db[_0xe528('0x68')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x69'));db['CmHopperBlack']=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x6a'));db['CmHopperFinal']=db['sequelize'][_0xe528('0x14')](_0xe528('0x6b'));db[_0xe528('0x6c')]=db[_0xe528('0x1')][_0xe528('0x14')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0xe528('0x6d')]=db[_0xe528('0x1')]['import'](_0xe528('0x6e'));db[_0xe528('0x6f')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x70'));db[_0xe528('0x71')]=db['sequelize']['import'](_0xe528('0x72'));db[_0xe528('0x73')]=db['sequelize'][_0xe528('0x14')](_0xe528('0x74'));db['CannedAnswer']=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x75'));db[_0xe528('0x76')]=db['sequelize']['import']('../api/disposition/disposition.model');db[_0xe528('0x77')]=db[_0xe528('0x1')]['import']('../api/condition/condition.model');db[_0xe528('0x78')]=db['sequelize']['import']('../api/interval/interval.model');db['Pause']=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x79'));db[_0xe528('0x7a')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x7b'));db[_0xe528('0x7c')]=db['sequelize'][_0xe528('0x14')](_0xe528('0x7d'));db['Schedule']=db['sequelize'][_0xe528('0x14')](_0xe528('0x7e'));db['Sound']=db['sequelize'][_0xe528('0x14')]('../api/sound/sound.model');db[_0xe528('0x7f')]=db['sequelize'][_0xe528('0x14')](_0xe528('0x80'));db[_0xe528('0x81')]=db['sequelize']['import']('../api/template/template.model');db['Trigger']=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x82'));db[_0xe528('0x83')]=db['sequelize']['import'](_0xe528('0x84'));db[_0xe528('0x85')]=db['sequelize'][_0xe528('0x14')](_0xe528('0x86'));db[_0xe528('0x87')]=db[_0xe528('0x1')]['import'](_0xe528('0x88'));db[_0xe528('0x89')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x8a'));db[_0xe528('0x8b')]=db['sequelize']['import'](_0xe528('0x8c'));db[_0xe528('0x8d')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x8e'));db[_0xe528('0x8f')]=db[_0xe528('0x1')][_0xe528('0x14')]('../api/analyticMetric/analyticMetric.model');db[_0xe528('0x90')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x91'));db['AnalyticTreeReport']=db['sequelize']['import']('../api/analyticTreeReport/analyticTreeReport.model');db[_0xe528('0x92')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x93'));db[_0xe528('0x94')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x95'));db[_0xe528('0x96')]=db['sequelize']['import'](_0xe528('0x97'));db['SugarcrmAccount']=db[_0xe528('0x1')]['import']('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0xe528('0x98')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0x99'));db['SugarcrmField']=db['sequelize'][_0xe528('0x14')](_0xe528('0x9a'));db[_0xe528('0x9b')]=db[_0xe528('0x1')]['import'](_0xe528('0x9c'));db[_0xe528('0x9d')]=db['sequelize'][_0xe528('0x14')](_0xe528('0x9e'));db[_0xe528('0x9f')]=db[_0xe528('0x1')]['import'](_0xe528('0xa0'));db['ZohoAccount']=db['sequelize'][_0xe528('0x14')](_0xe528('0xa1'));db['ZohoConfiguration']=db['sequelize'][_0xe528('0x14')](_0xe528('0xa2'));db[_0xe528('0xa3')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0xa4'));db[_0xe528('0xa5')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0xa6'));db[_0xe528('0xa7')]=db[_0xe528('0x1')]['import']('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0xe528('0xa8')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0xa9'));db[_0xe528('0xaa')]=db['sequelize'][_0xe528('0x14')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0xe528('0xab')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0xac'));db[_0xe528('0xad')]=db['sequelize']['import'](_0xe528('0xae'));db[_0xe528('0xaf')]=db['sequelize'][_0xe528('0x14')]('../api/intVtigerAccount/intVtigerAccount.model');db[_0xe528('0xb0')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0xb1'));db[_0xe528('0xb2')]=db['sequelize'][_0xe528('0x14')](_0xe528('0xb3'));db['ServicenowAccount']=db['sequelize'][_0xe528('0x14')](_0xe528('0xb4'));db[_0xe528('0xb5')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0xb6'));db[_0xe528('0xb7')]=db['sequelize'][_0xe528('0x14')](_0xe528('0xb8'));db[_0xe528('0xb9')]=db[_0xe528('0x1')]['import'](_0xe528('0xba'));db[_0xe528('0xbb')]=db[_0xe528('0x1')][_0xe528('0x14')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0xe528('0xbc')]=db[_0xe528('0x1')]['import'](_0xe528('0xbd'));db[_0xe528('0xbe')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0xbf'));db[_0xe528('0xc0')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0xc1'));db['FreshsalesField']=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0xc2'));db['Integration']=db[_0xe528('0x1')][_0xe528('0x14')]('../api/integration/integration.model');db[_0xe528('0xc3')]=db[_0xe528('0x1')]['import'](_0xe528('0xc4'));db[_0xe528('0xc5')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0xc6'));db[_0xe528('0xc7')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0xc8'));db[_0xe528('0xc9')]=db[_0xe528('0x1')]['import'](_0xe528('0xca'));db[_0xe528('0xcb')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0xcc'));db[_0xe528('0xcd')]=db[_0xe528('0x1')][_0xe528('0x14')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0xe528('0xce')]=db['sequelize'][_0xe528('0x14')](_0xe528('0xcf'));db[_0xe528('0xd0')]=db[_0xe528('0x1')][_0xe528('0x14')]('../api/squareReport/squareReport.model');db['SquareDetailsReport']=db[_0xe528('0x1')]['import'](_0xe528('0xd1'));db[_0xe528('0xd2')]=db['sequelize'][_0xe528('0x14')]('../api/jscriptyProject/jscriptyProject.model');db[_0xe528('0xd3')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0xd4'));db['SquareOdbc']=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0xd5'));db[_0xe528('0xd6')]=db[_0xe528('0x1')][_0xe528('0x14')]('../api/squareProject/squareProject.model');db[_0xe528('0xd7')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0xd8'));db['SquareMessage']=db[_0xe528('0x1')]['import'](_0xe528('0xd9'));db['Team']=db[_0xe528('0x1')]['import'](_0xe528('0xda'));db['License']=db['sequelize']['import'](_0xe528('0xdb'));db[_0xe528('0xdc')]=db[_0xe528('0x1')]['import'](_0xe528('0xdd'));db[_0xe528('0xde')]=db['sequelize'][_0xe528('0x14')](_0xe528('0xdf'));db['Attachment']=db[_0xe528('0x1')]['import'](_0xe528('0xe0'));db[_0xe528('0xe1')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0xe2'));db[_0xe528('0xe3')]=db[_0xe528('0x1')][_0xe528('0x14')]('../api/mailTransferReport/mailTransferReport.model');db['ChatTransferReport']=db[_0xe528('0x1')]['import'](_0xe528('0xe4'));db[_0xe528('0xe5')]=db[_0xe528('0x1')]['import'](_0xe528('0xe6'));db[_0xe528('0xe7')]=db[_0xe528('0x1')]['import'](_0xe528('0xe8'));db[_0xe528('0xe9')]=db['sequelize'][_0xe528('0x14')]('../api/smsTransferReport/smsTransferReport.model');db[_0xe528('0xea')]=db[_0xe528('0x1')][_0xe528('0x14')]('../api/cmList/cmList.model');db[_0xe528('0xeb')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0xec'));db['UserProfile']=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0xed'));db['UserProfileSection']=db[_0xe528('0x1')][_0xe528('0x14')]('../api/userProfileSection/userProfileSection.model');db[_0xe528('0xee')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0xef'));db[_0xe528('0xf0')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0xf1'));db[_0xe528('0xf2')]=db['sequelize']['import'](_0xe528('0xf3'));db[_0xe528('0xf4')]=db[_0xe528('0x1')]['import']('../api/whatsappApplication/whatsappApplication.model');db[_0xe528('0xf5')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0xf6'));db[_0xe528('0xf7')]=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0xf8'));db[_0xe528('0xf9')]=db[_0xe528('0x1')]['import']('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0xe528('0xfa')]=db[_0xe528('0x1')][_0xe528('0x14')]('../api/whatsappTransferReport/whatsappTransferReport.model');db['WhatsappQueue']=db[_0xe528('0x1')][_0xe528('0x14')](_0xe528('0xfb'));db['CloudProvider']=db[_0xe528('0x1')][_0xe528('0x14')]('../api/cloudProvider/cloudProvider.model');db['TeamVoiceQueue']=db['sequelize']['import'](_0xe528('0xfc'));db[_0xe528('0xfd')]=db['sequelize'][_0xe528('0x14')](_0xe528('0xfe'));db[_0xe528('0xff')]=db[_0xe528('0x1')][_0xe528('0x14')]('../api/userVoicePrefix/userVoicePrefix.model');db[_0xe528('0x13')]['hasOne'](db[_0xe528('0x100')],{'as':_0xe528('0x100'),'onDelete':_0xe528('0x101'),'foreignKey':'UserId'});db['User']['hasMany'](db[_0xe528('0x102')],{'as':_0xe528('0x103'),'foreignKey':_0xe528('0x104')});db[_0xe528('0x13')][_0xe528('0x105')](db[_0xe528('0x106')],{'as':'VoiceQueuesRt','foreignKey':'UserId'});db[_0xe528('0x13')][_0xe528('0x105')](db[_0xe528('0x107')],{'as':'Extensions','onDelete':_0xe528('0x101'),'hooks':!![]});db[_0xe528('0x13')]['hasMany'](db['CmHopperFinal'],{'as':_0xe528('0x108'),'foreignKey':_0xe528('0x104')});db['User'][_0xe528('0x105')](db[_0xe528('0x6c')],{'as':'HopperHistory','foreignKey':_0xe528('0x104')});db['User'][_0xe528('0x105')](db['ReportAgentPreview'],{'as':_0xe528('0x6d'),'foreignKey':_0xe528('0x104')});db[_0xe528('0x13')][_0xe528('0x105')](db[_0xe528('0x52')],{'as':_0xe528('0x109'),'foreignKey':_0xe528('0x104')});db['User'][_0xe528('0x105')](db[_0xe528('0x5c')],{'as':_0xe528('0x10a'),'foreignKey':_0xe528('0x104')});db[_0xe528('0x13')][_0xe528('0x105')](db[_0xe528('0x10b')],{'as':_0xe528('0x10c'),'foreignKey':'UserId'});db[_0xe528('0x13')]['hasMany'](db[_0xe528('0x44')],{'as':_0xe528('0x10d'),'foreignKey':'UserId'});db[_0xe528('0x13')][_0xe528('0x105')](db['MailInteraction'],{'as':_0xe528('0x10e'),'foreignKey':_0xe528('0x104')});db['User']['hasMany'](db[_0xe528('0xf5')],{'as':'WhatsappInteractions','foreignKey':_0xe528('0x104')});db[_0xe528('0x13')][_0xe528('0x105')](db[_0xe528('0xf0')],{'as':_0xe528('0x10f'),'foreignKey':'SenderId'});db[_0xe528('0x13')][_0xe528('0x110')](db[_0xe528('0x111')],{'as':'UserProfile','foreignKey':'userProfileId'});db[_0xe528('0x13')][_0xe528('0x112')](db[_0xe528('0x63')],{'as':_0xe528('0x113'),'through':_0xe528('0x114')});db[_0xe528('0x13')][_0xe528('0x112')](db[_0xe528('0x67')],{'as':_0xe528('0x115'),'through':_0xe528('0x116')});db[_0xe528('0x13')][_0xe528('0x112')](db[_0xe528('0xea')],{'as':'Lists','through':_0xe528('0x117')});db['User'][_0xe528('0x112')](db[_0xe528('0x118')],{'through':_0xe528('0x119')});db[_0xe528('0x13')][_0xe528('0x112')](db[_0xe528('0x38')],{'as':'MailInteractions','through':_0xe528('0x11a')});db[_0xe528('0x13')][_0xe528('0x112')](db[_0xe528('0x5c')],{'as':'ChatInteractions','through':_0xe528('0x11b')});db[_0xe528('0x13')][_0xe528('0x112')](db[_0xe528('0x44')],{'as':'FaxInteractions','through':_0xe528('0x11c')});db[_0xe528('0x13')]['belongsToMany'](db[_0xe528('0x10b')],{'as':_0xe528('0x10c'),'through':_0xe528('0x11d')});db[_0xe528('0x13')][_0xe528('0x112')](db[_0xe528('0x52')],{'as':_0xe528('0x109'),'through':_0xe528('0x11e')});db[_0xe528('0x13')][_0xe528('0x112')](db[_0xe528('0xf5')],{'as':_0xe528('0x11f'),'through':'user_has_whatsapp_interactions'});db['User'][_0xe528('0x112')](db[_0xe528('0x1a')],{'as':_0xe528('0x120'),'through':'UserVoiceQueue','required':![]});db[_0xe528('0x13')]['belongsToMany'](db[_0xe528('0xeb')],{'as':_0xe528('0x121'),'through':_0xe528('0xff'),'required':![]});db[_0xe528('0x13')]['belongsToMany'](db[_0xe528('0x36')],{'as':'MailQueues','through':_0xe528('0x2b'),'required':![]});db['User']['belongsToMany'](db[_0xe528('0x122')],{'as':_0xe528('0x123'),'through':_0xe528('0x2a'),'required':![],'hooks':!![]});db[_0xe528('0x13')][_0xe528('0x112')](db[_0xe528('0x47')],{'as':_0xe528('0x124'),'through':'UserFaxQueue','required':![]});db[_0xe528('0x13')][_0xe528('0x112')](db['SmsQueue'],{'as':_0xe528('0x125'),'through':_0xe528('0x126'),'required':![]});db[_0xe528('0x13')][_0xe528('0x112')](db[_0xe528('0x55')],{'as':'OpenchannelQueues','through':'UserOpenchannelQueue','required':![]});db[_0xe528('0x13')][_0xe528('0x112')](db[_0xe528('0x127')],{'as':_0xe528('0x128'),'through':_0xe528('0x129'),'required':![]});db[_0xe528('0x13')][_0xe528('0x112')](db['CmList'],{'through':_0xe528('0x117')});db[_0xe528('0x13')][_0xe528('0x112')](db[_0xe528('0xeb')],{'as':_0xe528('0x121'),'through':_0xe528('0x12a'),'required':![]});db[_0xe528('0x13')][_0xe528('0x112')](db[_0xe528('0x57')],{'as':_0xe528('0x12b'),'through':_0xe528('0x12c')});db[_0xe528('0x13')][_0xe528('0x112')](db[_0xe528('0x41')],{'as':_0xe528('0x12d'),'through':_0xe528('0x12e')});db[_0xe528('0x13')][_0xe528('0x112')](db[_0xe528('0x35')],{'as':_0xe528('0x12f'),'through':_0xe528('0x130')});db['User'][_0xe528('0x112')](db[_0xe528('0x4e')],{'as':_0xe528('0x131'),'through':_0xe528('0x132')});db['User'][_0xe528('0x112')](db[_0xe528('0x49')],{'as':_0xe528('0x133'),'through':_0xe528('0x134')});db['User'][_0xe528('0x112')](db['WhatsappAccount'],{'as':_0xe528('0x135'),'through':_0xe528('0x136')});db['User']['belongsToMany'](db[_0xe528('0xd6')],{'as':_0xe528('0x137'),'through':_0xe528('0x138')});db['VoiceChanSpy'][_0xe528('0x105')](db[_0xe528('0x107')],{'as':'SpiedAgents','onDelete':'cascade','foreignKey':_0xe528('0x139')});db['VoiceContext'][_0xe528('0x105')](db['VoiceExtension'],{'onDelete':_0xe528('0x101')});db[_0xe528('0x107')][_0xe528('0x105')](db[_0xe528('0x107')],{'as':_0xe528('0x13a'),'onDelete':_0xe528('0x101')});db[_0xe528('0x13b')][_0xe528('0x112')](db['Sound'],{'as':_0xe528('0x13c'),'through':_0xe528('0x13d')});db[_0xe528('0x1a')][_0xe528('0x105')](db[_0xe528('0x106')],{'as':_0xe528('0x13e'),'foreignKey':_0xe528('0x13f')});db[_0xe528('0x1a')][_0xe528('0x105')](db[_0xe528('0x68')],{'as':_0xe528('0x140'),'foreignKey':_0xe528('0x13f')});db['VoiceQueue'][_0xe528('0x105')](db[_0xe528('0x141')],{'as':_0xe528('0x108'),'foreignKey':_0xe528('0x13f')});db[_0xe528('0x1a')][_0xe528('0x105')](db[_0xe528('0x6c')],{'as':_0xe528('0x142'),'foreignKey':_0xe528('0x13f')});db['VoiceQueue'][_0xe528('0x105')](db[_0xe528('0x6d')],{'as':'ReportAgentPreview','foreignKey':_0xe528('0x13f')});db[_0xe528('0x1a')][_0xe528('0x105')](db['CmHopperBlack'],{'as':'HopperBlacks','foreignKey':_0xe528('0x13f')});db[_0xe528('0x1a')][_0xe528('0x105')](db['JscriptySessionReport'],{'as':_0xe528('0x143'),'foreignKey':'VoiceQueueId'});db[_0xe528('0x1a')][_0xe528('0x110')](db[_0xe528('0x27')],{'as':_0xe528('0x27'),'foreignKey':_0xe528('0x144')});db['VoiceQueue'][_0xe528('0x110')](db[_0xe528('0x27')],{'as':'TrunkBackup','foreignKey':_0xe528('0x145')});db[_0xe528('0x1a')][_0xe528('0x110')](db[_0xe528('0x78')],{'as':_0xe528('0x78'),'foreignKey':_0xe528('0x146')});db[_0xe528('0x1a')]['belongsTo'](db[_0xe528('0x147')],{'as':_0xe528('0x148'),'foreignKey':_0xe528('0x149')});db[_0xe528('0x1a')][_0xe528('0x112')](db[_0xe528('0xea')],{'as':'Lists','through':_0xe528('0x14a')});db[_0xe528('0x1a')]['belongsToMany'](db[_0xe528('0x13')],{'as':_0xe528('0x14b'),'through':_0xe528('0x29')});db[_0xe528('0x1a')][_0xe528('0x112')](db['Team'],{'as':_0xe528('0x14c'),'through':'TeamVoiceQueue'});db[_0xe528('0x1a')][_0xe528('0x112')](db[_0xe528('0xea')],{'as':_0xe528('0x14d'),'through':'voice_queues_has_cm_blacklists'});db[_0xe528('0x102')][_0xe528('0x110')](db[_0xe528('0x13')],{'as':'User','foreignKey':_0xe528('0x104')});db[_0xe528('0x1c')]['belongsTo'](db['User'],{'as':_0xe528('0x13'),'foreignKey':_0xe528('0x104')});db[_0xe528('0x100')][_0xe528('0x105')](db[_0xe528('0x1f')],{'as':_0xe528('0x14e'),'onDelete':'cascade','foreignKey':_0xe528('0x14f'),'sourceKey':'mailbox'});db[_0xe528('0x1f')][_0xe528('0x110')](db[_0xe528('0x100')],{'foreignKey':_0xe528('0x14f'),'targetKey':_0xe528('0x150')});db['VoiceCallReport'][_0xe528('0x105')](db['VoiceQueueReport'],{'as':_0xe528('0x151'),'foreignKey':'uniqueid','constraints':![]});db[_0xe528('0x21')]['hasMany'](db[_0xe528('0x23')],{'as':_0xe528('0x152'),'foreignKey':_0xe528('0x153'),'constraints':![]});db[_0xe528('0x21')]['belongsTo'](db[_0xe528('0x13')],{'as':_0xe528('0x13'),'foreignKey':_0xe528('0x104')});db[_0xe528('0x21')][_0xe528('0x110')](db['CmContact'],{'as':_0xe528('0x154'),'foreignKey':_0xe528('0x155')});db[_0xe528('0x156')]['belongsTo'](db['MailAccount'],{'as':_0xe528('0x35'),'foreignKey':_0xe528('0x157')});db[_0xe528('0x33')]['belongsTo'](db[_0xe528('0x35')],{'as':_0xe528('0x35'),'foreignKey':'MailAccountId'});db[_0xe528('0x35')][_0xe528('0x158')](db[_0xe528('0x156')],{'as':_0xe528('0x159'),'onDelete':_0xe528('0x101')});db[_0xe528('0x35')][_0xe528('0x158')](db[_0xe528('0x33')],{'as':_0xe528('0x15a'),'onDelete':_0xe528('0x101')});db[_0xe528('0x35')][_0xe528('0x105')](db[_0xe528('0x76')],{'as':_0xe528('0x15b'),'foreignKey':_0xe528('0x157'),'onDelete':_0xe528('0x101')});db['MailAccount'][_0xe528('0x105')](db[_0xe528('0x15c')],{'as':_0xe528('0x15d'),'foreignKey':_0xe528('0x157')});db[_0xe528('0x35')]['hasMany'](db[_0xe528('0x3a')],{'as':_0xe528('0x14e'),'foreignKey':_0xe528('0x157')});db[_0xe528('0x35')][_0xe528('0x105')](db[_0xe528('0x38')],{'as':_0xe528('0x15e')});db[_0xe528('0x35')]['hasMany'](db[_0xe528('0x3c')],{'as':_0xe528('0x13a')});db[_0xe528('0x35')][_0xe528('0x110')](db[_0xe528('0xea')],{'as':'List','foreignKey':_0xe528('0x15f')});db[_0xe528('0x35')][_0xe528('0x110')](db[_0xe528('0x81')],{'as':_0xe528('0x81'),'foreignKey':_0xe528('0x160')});db[_0xe528('0x35')][_0xe528('0x110')](db[_0xe528('0x147')],{'as':_0xe528('0x148'),'foreignKey':_0xe528('0x149')});db['MailAccount'][_0xe528('0x112')](db[_0xe528('0x13')],{'as':_0xe528('0x14b'),'through':_0xe528('0x130')});db['MailQueue'][_0xe528('0x112')](db[_0xe528('0x13')],{'as':'Agents','through':_0xe528('0x2b')});db[_0xe528('0x36')][_0xe528('0x112')](db['Team'],{'through':_0xe528('0x161'),'as':'Teams'});db['MailInteraction'][_0xe528('0x105')](db[_0xe528('0x3a')],{'as':_0xe528('0x14e'),'onDelete':_0xe528('0x101'),'foreignKey':_0xe528('0x162')});db['MailInteraction'][_0xe528('0x110')](db['MailAccount'],{'as':_0xe528('0x163'),'foreignKey':_0xe528('0x157')});db[_0xe528('0x38')][_0xe528('0x110')](db[_0xe528('0x67')],{'as':_0xe528('0x154'),'foreignKey':'ContactId'});db[_0xe528('0x38')][_0xe528('0x110')](db[_0xe528('0x13')],{'as':_0xe528('0x164'),'foreignKey':'UserId'});db[_0xe528('0x38')]['belongsToMany'](db[_0xe528('0x7f')],{'through':'mail_interaction_has_tags','as':_0xe528('0x165')});db['MailInteraction'][_0xe528('0x112')](db[_0xe528('0x7f')],{'through':'mail_interaction_has_tags','as':_0xe528('0x166')});db[_0xe528('0x38')][_0xe528('0x112')](db[_0xe528('0x13')],{'as':_0xe528('0x167'),'through':_0xe528('0x11a'),'foreignKey':'MailInteractionId'});db[_0xe528('0x3a')][_0xe528('0x105')](db[_0xe528('0x168')],{'as':_0xe528('0x169'),'onDelete':_0xe528('0x101')});db[_0xe528('0x3a')][_0xe528('0x110')](db['User'],{'as':_0xe528('0x13')});db[_0xe528('0x3a')][_0xe528('0x110')](db[_0xe528('0x67')],{'onDelete':_0xe528('0x101'),'as':_0xe528('0x154')});db['MailMessage'][_0xe528('0x110')](db[_0xe528('0x38')],{'as':_0xe528('0x16a'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0xe528('0x110')](db[_0xe528('0x35')],{'as':'Account','foreignKey':'MailAccountId'});db['MailMessage']['belongsTo'](db[_0xe528('0x57')],{'as':_0xe528('0x57'),'foreignKey':'ChatWebsiteId'});db[_0xe528('0x3a')]['belongsTo'](db[_0xe528('0x60')],{'as':_0xe528('0x60'),'foreignKey':_0xe528('0x16b')});db[_0xe528('0x3c')]['belongsTo'](db[_0xe528('0x13')],{'onDelete':'restrict'});db['MailApplication'][_0xe528('0x110')](db[_0xe528('0x36')],{'onDelete':_0xe528('0x16c')});db[_0xe528('0x3c')][_0xe528('0x110')](db[_0xe528('0x35')],{'onDelete':_0xe528('0x16c')});db[_0xe528('0x3c')][_0xe528('0x110')](db['Interval'],{'onDelete':_0xe528('0x16c'),'foreignKey':'IntervalId'});db[_0xe528('0x3c')][_0xe528('0x110')](db[_0xe528('0x7f')],{'onDelete':_0xe528('0x16c'),'foreignKey':'TagId'});db[_0xe528('0x3e')]['belongsTo'](db[_0xe528('0x35')],{});db[_0xe528('0x3e')]['belongsTo'](db[_0xe528('0xea')],{'as':_0xe528('0x16d'),'foreignKey':'ListId'});db['MailQueueReport']['belongsTo'](db[_0xe528('0x67')],{'as':_0xe528('0x154'),'foreignKey':_0xe528('0x155')});db[_0xe528('0x3e')]['belongsTo'](db[_0xe528('0x38')],{});db[_0xe528('0x3e')][_0xe528('0x110')](db[_0xe528('0x3a')],{});db[_0xe528('0x3e')][_0xe528('0x110')](db[_0xe528('0x13')],{});db[_0xe528('0x3e')][_0xe528('0x110')](db[_0xe528('0x36')],{});db[_0xe528('0x40')]['hasMany'](db[_0xe528('0x16e')],{'as':_0xe528('0x16f'),'onDelete':_0xe528('0x101')});db[_0xe528('0x41')][_0xe528('0x105')](db[_0xe528('0x76')],{'as':_0xe528('0x15b'),'foreignKey':_0xe528('0x170'),'onDelete':_0xe528('0x101')});db[_0xe528('0x41')][_0xe528('0x105')](db[_0xe528('0x15c')],{'as':'Answers','foreignKey':_0xe528('0x170')});db[_0xe528('0x41')]['hasMany'](db[_0xe528('0x44')],{'as':_0xe528('0x15e')});db[_0xe528('0x41')][_0xe528('0x105')](db[_0xe528('0x43')],{'as':_0xe528('0x13a')});db[_0xe528('0x41')][_0xe528('0x105')](db[_0xe528('0x107')],{'as':_0xe528('0x171'),'onDelete':_0xe528('0x101')});db[_0xe528('0x41')][_0xe528('0x105')](db['FaxMessage'],{'as':_0xe528('0x14e')});db[_0xe528('0x41')][_0xe528('0x110')](db['Trunk'],{'as':_0xe528('0x27')});db[_0xe528('0x41')][_0xe528('0x110')](db[_0xe528('0xea')],{'as':_0xe528('0x16d'),'foreignKey':_0xe528('0x15f')});db[_0xe528('0x41')]['belongsTo'](db[_0xe528('0x147')],{'as':_0xe528('0x148'),'foreignKey':'mandatoryDispositionPauseId'});db['FaxAccount'][_0xe528('0x112')](db[_0xe528('0x13')],{'as':'Agents','through':'user_has_fax_accounts'});db['FaxApplication'][_0xe528('0x110')](db['User'],{'onDelete':_0xe528('0x16c')});db[_0xe528('0x43')][_0xe528('0x110')](db['FaxQueue'],{'onDelete':_0xe528('0x16c')});db[_0xe528('0x43')][_0xe528('0x110')](db[_0xe528('0x41')],{'onDelete':_0xe528('0x16c')});db[_0xe528('0x43')][_0xe528('0x110')](db[_0xe528('0x7f')],{'onDelete':_0xe528('0x16c'),'foreignKey':_0xe528('0x172')});db[_0xe528('0x44')][_0xe528('0x105')](db['FaxMessage'],{'as':'Messages','onDelete':_0xe528('0x101'),'foreignKey':'FaxInteractionId'});db[_0xe528('0x44')][_0xe528('0x110')](db[_0xe528('0x41')],{'as':_0xe528('0x163'),'foreignKey':_0xe528('0x170')});db[_0xe528('0x44')]['belongsTo'](db[_0xe528('0x67')],{'as':'Contact','foreignKey':_0xe528('0x155')});db['FaxInteraction'][_0xe528('0x110')](db[_0xe528('0x13')],{'as':_0xe528('0x164'),'foreignKey':_0xe528('0x104')});db[_0xe528('0x44')][_0xe528('0x112')](db['Tag'],{'through':_0xe528('0x173'),'as':_0xe528('0x165')});db['FaxInteraction'][_0xe528('0x112')](db[_0xe528('0x7f')],{'through':_0xe528('0x173'),'as':_0xe528('0x166')});db[_0xe528('0x44')]['belongsToMany'](db[_0xe528('0x13')],{'as':'Users','through':_0xe528('0x11c'),'foreignKey':_0xe528('0x174')});db[_0xe528('0x45')][_0xe528('0x110')](db[_0xe528('0x13')],{'onDelete':'cascade','as':_0xe528('0x13')});db[_0xe528('0x45')][_0xe528('0x110')](db[_0xe528('0x44')],{'as':'Interaction','foreignKey':_0xe528('0x174')});db[_0xe528('0x45')][_0xe528('0x110')](db[_0xe528('0x67')],{'onDelete':_0xe528('0x101'),'as':'Contact'});db[_0xe528('0x45')]['belongsTo'](db[_0xe528('0x168')],{'as':_0xe528('0x168'),'foreignKey':_0xe528('0x175')});db[_0xe528('0x45')][_0xe528('0x110')](db[_0xe528('0x41')],{'as':_0xe528('0x163'),'foreignKey':_0xe528('0x170')});db[_0xe528('0x47')]['belongsToMany'](db['User'],{'as':'Agents','through':'UserFaxQueue'});db['FaxQueue'][_0xe528('0x112')](db['Team'],{'through':_0xe528('0x176'),'as':_0xe528('0x14c')});db['FaxQueueReport'][_0xe528('0x110')](db[_0xe528('0x41')],{});db['FaxQueueReport'][_0xe528('0x110')](db['CmList'],{'as':'List','foreignKey':_0xe528('0x15f')});db[_0xe528('0x177')][_0xe528('0x110')](db['CmContact'],{'as':'Contact','foreignKey':_0xe528('0x155')});db[_0xe528('0x177')][_0xe528('0x110')](db['FaxInteraction'],{});db[_0xe528('0x177')]['belongsTo'](db[_0xe528('0x45')],{});db[_0xe528('0x177')][_0xe528('0x110')](db[_0xe528('0x13')],{});db[_0xe528('0x177')][_0xe528('0x110')](db[_0xe528('0x47')],{});db[_0xe528('0x49')][_0xe528('0x105')](db[_0xe528('0x76')],{'as':'Dispositions','foreignKey':'SmsAccountId','onDelete':_0xe528('0x101')});db[_0xe528('0x49')][_0xe528('0x105')](db[_0xe528('0x15c')],{'as':_0xe528('0x15d'),'foreignKey':'SmsAccountId'});db[_0xe528('0x49')][_0xe528('0x105')](db[_0xe528('0x178')],{'as':_0xe528('0x14e'),'foreignKey':_0xe528('0x179')});db['SmsAccount']['hasMany'](db['SmsInteraction'],{'as':'Interactions'});db['SmsAccount'][_0xe528('0x105')](db['SmsApplication'],{'as':_0xe528('0x13a')});db[_0xe528('0x49')][_0xe528('0x110')](db['CmList'],{'as':_0xe528('0x16d'),'foreignKey':_0xe528('0x15f')});db[_0xe528('0x49')]['belongsTo'](db[_0xe528('0x147')],{'as':'mandatoryDispositionPause','foreignKey':_0xe528('0x149')});db['SmsAccount'][_0xe528('0x112')](db[_0xe528('0x13')],{'as':'Agents','through':_0xe528('0x134')});db['SmsApplication'][_0xe528('0x110')](db[_0xe528('0x13')],{'onDelete':'restrict'});db[_0xe528('0x4a')][_0xe528('0x110')](db['SmsQueue'],{'onDelete':_0xe528('0x16c')});db['SmsApplication'][_0xe528('0x110')](db[_0xe528('0x49')],{'onDelete':'restrict'});db[_0xe528('0x4a')][_0xe528('0x110')](db[_0xe528('0x78')],{'onDelete':_0xe528('0x16c'),'foreignKey':_0xe528('0x146')});db[_0xe528('0x4a')][_0xe528('0x110')](db[_0xe528('0x7f')],{'onDelete':_0xe528('0x16c'),'foreignKey':'TagId'});db[_0xe528('0x10b')][_0xe528('0x105')](db[_0xe528('0x178')],{'as':_0xe528('0x14e'),'onDelete':_0xe528('0x101'),'foreignKey':_0xe528('0x17a')});db[_0xe528('0x10b')][_0xe528('0x110')](db['SmsAccount'],{'as':'Account','foreignKey':_0xe528('0x179')});db[_0xe528('0x10b')][_0xe528('0x110')](db[_0xe528('0x67')],{'as':'Contact','foreignKey':_0xe528('0x155')});db[_0xe528('0x10b')][_0xe528('0x110')](db[_0xe528('0x13')],{'as':'Owner','foreignKey':'UserId'});db[_0xe528('0x10b')]['belongsToMany'](db[_0xe528('0x7f')],{'through':'sms_interaction_has_tags','as':_0xe528('0x165')});db['SmsInteraction'][_0xe528('0x112')](db['Tag'],{'through':_0xe528('0x17b'),'as':_0xe528('0x166')});db[_0xe528('0x10b')]['belongsToMany'](db[_0xe528('0x13')],{'as':_0xe528('0x167'),'through':_0xe528('0x11d'),'foreignKey':_0xe528('0x17a')});db[_0xe528('0x178')][_0xe528('0x110')](db[_0xe528('0x13')],{'as':'User'});db['SmsMessage'][_0xe528('0x110')](db[_0xe528('0x67')],{'onDelete':_0xe528('0x101'),'as':_0xe528('0x154')});db[_0xe528('0x178')][_0xe528('0x110')](db[_0xe528('0x10b')],{'onDelete':'cascade','as':_0xe528('0x16a'),'foreignKey':'SmsInteractionId'});db[_0xe528('0x178')][_0xe528('0x110')](db[_0xe528('0x49')],{'as':_0xe528('0x163'),'foreignKey':_0xe528('0x179')});db[_0xe528('0x17c')][_0xe528('0x112')](db[_0xe528('0x13')],{'as':'Agents','through':_0xe528('0x126'),'foreignKey':_0xe528('0x17d')});db['SmsQueue'][_0xe528('0x112')](db[_0xe528('0x118')],{'through':'team_has_sms_queues','as':_0xe528('0x14c')});db[_0xe528('0x4e')][_0xe528('0x105')](db[_0xe528('0x76')],{'as':_0xe528('0x15b'),'foreignKey':_0xe528('0x17e'),'onDelete':_0xe528('0x101')});db[_0xe528('0x4e')][_0xe528('0x105')](db['CannedAnswer'],{'as':_0xe528('0x15d'),'foreignKey':'OpenchannelAccountId'});db[_0xe528('0x4e')][_0xe528('0x105')](db[_0xe528('0x52')],{'as':_0xe528('0x15e'),'foreignKey':_0xe528('0x17e')});db[_0xe528('0x4e')][_0xe528('0x105')](db[_0xe528('0x53')],{'as':'Messages','foreignKey':_0xe528('0x17e')});db[_0xe528('0x4e')][_0xe528('0x105')](db[_0xe528('0x50')],{'as':_0xe528('0x13a'),'foreignKey':_0xe528('0x17e')});db[_0xe528('0x4e')][_0xe528('0x110')](db['CmList'],{'as':'List','foreignKey':_0xe528('0x15f')});db['OpenchannelAccount'][_0xe528('0x110')](db[_0xe528('0x147')],{'as':_0xe528('0x148'),'foreignKey':_0xe528('0x149')});db['OpenchannelAccount'][_0xe528('0x112')](db[_0xe528('0x13')],{'as':_0xe528('0x14b'),'through':_0xe528('0x132')});db[_0xe528('0x50')][_0xe528('0x110')](db[_0xe528('0x13')],{'onDelete':_0xe528('0x16c')});db[_0xe528('0x50')][_0xe528('0x110')](db[_0xe528('0x55')],{'onDelete':'restrict','foreignKey':_0xe528('0x17f')});db[_0xe528('0x50')][_0xe528('0x110')](db[_0xe528('0x4e')],{'onDelete':'restrict','foreignKey':_0xe528('0x17e')});db[_0xe528('0x50')][_0xe528('0x110')](db['Interval'],{'onDelete':'restrict','foreignKey':_0xe528('0x146')});db['OpenchannelApplication'][_0xe528('0x110')](db[_0xe528('0x7f')],{'onDelete':_0xe528('0x16c'),'foreignKey':_0xe528('0x172')});db[_0xe528('0x52')][_0xe528('0x105')](db[_0xe528('0x53')],{'as':_0xe528('0x14e'),'onDelete':_0xe528('0x101'),'foreignKey':'OpenchannelInteractionId'});db[_0xe528('0x52')][_0xe528('0x110')](db['OpenchannelAccount'],{'as':_0xe528('0x163'),'foreignKey':_0xe528('0x17e')});db[_0xe528('0x52')]['belongsTo'](db[_0xe528('0x67')],{'as':_0xe528('0x154'),'foreignKey':'ContactId'});db[_0xe528('0x52')][_0xe528('0x110')](db['User'],{'as':_0xe528('0x164'),'foreignKey':'UserId'});db['OpenchannelInteraction'][_0xe528('0x112')](db['Tag'],{'through':_0xe528('0x180'),'as':_0xe528('0x165')});db['OpenchannelInteraction']['belongsToMany'](db[_0xe528('0x7f')],{'through':_0xe528('0x180'),'as':'ThroughTags'});db[_0xe528('0x52')][_0xe528('0x112')](db[_0xe528('0x13')],{'as':_0xe528('0x167'),'through':_0xe528('0x11e'),'foreignKey':_0xe528('0x181')});db['OpenchannelMessage'][_0xe528('0x110')](db['User'],{'onDelete':_0xe528('0x101'),'as':_0xe528('0x13')});db[_0xe528('0x53')][_0xe528('0x110')](db[_0xe528('0x67')],{'onDelete':_0xe528('0x101'),'as':_0xe528('0x154')});db[_0xe528('0x53')][_0xe528('0x110')](db['OpenchannelInteraction'],{'onDelete':'cascade','as':'Interaction','foreignKey':'OpenchannelInteractionId'});db['OpenchannelMessage'][_0xe528('0x110')](db[_0xe528('0x168')],{'as':'Attachment','foreignKey':_0xe528('0x175')});db[_0xe528('0x53')][_0xe528('0x110')](db[_0xe528('0x4e')],{'as':_0xe528('0x163'),'foreignKey':'OpenchannelAccountId'});db[_0xe528('0x55')]['belongsToMany'](db[_0xe528('0x13')],{'as':'Agents','through':'UserOpenchannelQueue','foreignKey':_0xe528('0x17f')});db['OpenchannelQueue'][_0xe528('0x112')](db[_0xe528('0x118')],{'through':_0xe528('0x182'),'as':_0xe528('0x14c')});db[_0xe528('0x57')]['hasMany'](db[_0xe528('0x76')],{'as':_0xe528('0x15b'),'foreignKey':_0xe528('0x183'),'onDelete':_0xe528('0x101')});db[_0xe528('0x57')]['hasMany'](db[_0xe528('0x15c')],{'as':'Answers','foreignKey':_0xe528('0x183')});db[_0xe528('0x57')][_0xe528('0x105')](db[_0xe528('0x64')],{'as':'ProactiveActions'});db['ChatWebsite'][_0xe528('0x105')](db['ChatInteraction'],{'as':_0xe528('0x15e')});db['ChatWebsite'][_0xe528('0x105')](db['ChatApplication'],{'as':_0xe528('0x13a')});db['ChatWebsite'][_0xe528('0x105')](db['ChatMessage'],{'as':'Messages'});db['ChatWebsite'][_0xe528('0x110')](db[_0xe528('0xea')],{'as':_0xe528('0x16d'),'foreignKey':'ListId'});db[_0xe528('0x57')]['belongsTo'](db[_0xe528('0x78')],{'as':_0xe528('0x78'),'foreignKey':_0xe528('0x146')});db['ChatWebsite'][_0xe528('0x110')](db[_0xe528('0x35')],{'as':_0xe528('0x35'),'foreignKey':'MailAccountId'});db[_0xe528('0x57')][_0xe528('0x110')](db[_0xe528('0x147')],{'as':_0xe528('0x148'),'foreignKey':_0xe528('0x149')});db[_0xe528('0x57')]['belongsToMany'](db['User'],{'as':_0xe528('0x14b'),'through':_0xe528('0x12c')});db[_0xe528('0x59')][_0xe528('0x110')](db[_0xe528('0x4e')],{});db[_0xe528('0x59')][_0xe528('0x110')](db['CmList'],{'as':_0xe528('0x16d'),'foreignKey':'ListId'});db[_0xe528('0x59')][_0xe528('0x110')](db['CmContact'],{'as':_0xe528('0x154'),'foreignKey':_0xe528('0x155')});db[_0xe528('0x59')][_0xe528('0x110')](db[_0xe528('0x52')],{});db[_0xe528('0x59')][_0xe528('0x110')](db[_0xe528('0x53')],{});db['OpenchannelQueueReport']['belongsTo'](db[_0xe528('0x13')],{});db[_0xe528('0x59')]['belongsTo'](db[_0xe528('0x55')],{});db[_0xe528('0x5a')]['belongsTo'](db[_0xe528('0x13')],{'as':'Agent','foreignKey':_0xe528('0x104'),'onDelete':_0xe528('0x16c')});db['ChatApplication'][_0xe528('0x110')](db[_0xe528('0x122')],{'as':_0xe528('0x184'),'foreignKey':'ChatQueueId','onDelete':'restrict'});db[_0xe528('0x5a')]['belongsTo'](db['ChatWebsite'],{'as':_0xe528('0x185'),'foreignKey':'ChatWebsiteId','onDelete':_0xe528('0x16c')});db[_0xe528('0x5a')][_0xe528('0x110')](db['Tag'],{'onDelete':'restrict','foreignKey':_0xe528('0x172')});db['ChatInteraction'][_0xe528('0x105')](db[_0xe528('0x5e')],{'as':_0xe528('0x14e'),'onDelete':_0xe528('0x101'),'foreignKey':'ChatInteractionId'});db['ChatInteraction'][_0xe528('0x110')](db['ChatWebsite'],{'as':_0xe528('0x163'),'foreignKey':_0xe528('0x183')});db['ChatInteraction']['belongsTo'](db['CmContact'],{'as':_0xe528('0x154'),'foreignKey':'ContactId'});db[_0xe528('0x5c')][_0xe528('0x110')](db[_0xe528('0x13')],{'as':_0xe528('0x164'),'foreignKey':_0xe528('0x104')});db[_0xe528('0x5c')]['belongsToMany'](db[_0xe528('0x7f')],{'through':'chat_interaction_has_tags','as':_0xe528('0x165')});db[_0xe528('0x5c')]['belongsToMany'](db[_0xe528('0x7f')],{'through':_0xe528('0x186'),'as':_0xe528('0x166')});db['ChatInteraction'][_0xe528('0x112')](db[_0xe528('0x13')],{'as':_0xe528('0x167'),'through':_0xe528('0x11b'),'foreignKey':_0xe528('0x187')});db[_0xe528('0x5e')][_0xe528('0x110')](db[_0xe528('0x13')],{'onDelete':'cascade','as':_0xe528('0x13')});db['ChatMessage']['belongsTo'](db[_0xe528('0x67')],{'onDelete':_0xe528('0x101'),'as':_0xe528('0x154'),'foreignKey':_0xe528('0x155')});db['ChatMessage'][_0xe528('0x110')](db[_0xe528('0x5c')],{'onDelete':_0xe528('0x101'),'as':_0xe528('0x16a'),'foreignKey':_0xe528('0x187')});db['ChatMessage'][_0xe528('0x110')](db['Attachment'],{'as':_0xe528('0x168'),'foreignKey':_0xe528('0x175')});db[_0xe528('0x5e')][_0xe528('0x110')](db[_0xe528('0x57')],{'as':_0xe528('0x163'),'foreignKey':_0xe528('0x183')});db[_0xe528('0x60')][_0xe528('0x105')](db[_0xe528('0x168')],{'as':_0xe528('0x169'),'foreignKey':'ChatOfflineMessageId','onDelete':'cascade','hooks':!![]});db[_0xe528('0x60')]['belongsTo'](db['CmContact'],{'onDelete':_0xe528('0x101'),'as':'Contact','foreignKey':'ContactId'});db[_0xe528('0x60')][_0xe528('0x110')](db['ChatWebsite'],{'as':_0xe528('0x163'),'foreignKey':'ChatWebsiteId'});db[_0xe528('0x122')][_0xe528('0x112')](db[_0xe528('0x13')],{'as':_0xe528('0x14b'),'through':_0xe528('0x2a'),'hooks':!![]});db[_0xe528('0x122')][_0xe528('0x112')](db['Team'],{'through':_0xe528('0x188'),'as':_0xe528('0x14c')});db['ChatGroup'][_0xe528('0x105')](db['ChatInternalMessage'],{'as':_0xe528('0x14e'),'foreignKey':_0xe528('0x189'),'onDelete':_0xe528('0x101')});db[_0xe528('0x63')][_0xe528('0x112')](db[_0xe528('0x13')],{'as':'Members','through':'chat_group_has_users'});db[_0xe528('0x64')]['belongsTo'](db[_0xe528('0x57')],{'as':'Website','foreignKey':_0xe528('0x183')});db[_0xe528('0x18a')][_0xe528('0x105')](db[_0xe528('0x67')],{'as':_0xe528('0x115'),'foreignKey':_0xe528('0x18b')});db[_0xe528('0x67')][_0xe528('0x105')](db[_0xe528('0x68')],{'as':_0xe528('0x140'),'foreignKey':_0xe528('0x155')});db[_0xe528('0x67')][_0xe528('0x105')](db['CmHopperFinal'],{'as':_0xe528('0x108'),'foreignKey':_0xe528('0x155')});db[_0xe528('0x67')][_0xe528('0x105')](db[_0xe528('0x6c')],{'as':'HopperHistories','foreignKey':_0xe528('0x155')});db[_0xe528('0x67')]['hasMany'](db[_0xe528('0x6d')],{'as':_0xe528('0x6d'),'foreignKey':_0xe528('0x155')});db[_0xe528('0x67')][_0xe528('0x105')](db['JscriptySessionReport'],{'as':'JscriptySessions','foreignKey':_0xe528('0x155')});db[_0xe528('0x67')]['hasMany'](db['OpenchannelInteraction'],{'as':_0xe528('0x109'),'foreignKey':_0xe528('0x155'),'onDelete':_0xe528('0x16c')});db[_0xe528('0x67')][_0xe528('0x105')](db['ChatInteraction'],{'as':_0xe528('0x10a'),'foreignKey':_0xe528('0x155'),'onDelete':'restrict'});db[_0xe528('0x67')][_0xe528('0x105')](db[_0xe528('0x10b')],{'as':_0xe528('0x10c'),'foreignKey':_0xe528('0x155'),'onDelete':'restrict'});db[_0xe528('0x67')]['hasMany'](db[_0xe528('0x44')],{'as':_0xe528('0x10d'),'foreignKey':_0xe528('0x155'),'onDelete':'restrict'});db['CmContact']['hasMany'](db[_0xe528('0x38')],{'as':'MailInteractions','foreignKey':_0xe528('0x155'),'onDelete':_0xe528('0x16c')});db[_0xe528('0x67')][_0xe528('0x110')](db['CmCompany'],{'as':_0xe528('0x18c'),'foreignKey':_0xe528('0x18b')});db[_0xe528('0x67')][_0xe528('0x110')](db[_0xe528('0xea')],{'as':'List','foreignKey':_0xe528('0x15f'),'onDelete':_0xe528('0x101')});db[_0xe528('0x67')][_0xe528('0x112')](db[_0xe528('0x13')],{'as':_0xe528('0x167'),'through':'cm_user_has_contacts'});db[_0xe528('0x67')][_0xe528('0x112')](db['Tag'],{'as':_0xe528('0x165'),'through':_0xe528('0x18d')});db[_0xe528('0x67')][_0xe528('0x112')](db[_0xe528('0x7f')],{'through':_0xe528('0x18d'),'as':_0xe528('0x166')});db[_0xe528('0x68')]['belongsTo'](db[_0xe528('0x67')],{'as':'Contact','foreignKey':_0xe528('0x155'),'onDelete':_0xe528('0x101')});db[_0xe528('0x68')][_0xe528('0x110')](db[_0xe528('0xea')],{'as':_0xe528('0x16d'),'foreignKey':_0xe528('0x15f'),'onDelete':_0xe528('0x101')});db[_0xe528('0x68')][_0xe528('0x110')](db[_0xe528('0x13')],{'as':_0xe528('0x18e'),'foreignKey':_0xe528('0x104')});db['CmHopper'][_0xe528('0x110')](db[_0xe528('0x1a')],{'as':_0xe528('0x184'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0xe528('0x68')]['belongsTo'](db[_0xe528('0xdc')],{'as':'Campaign','foreignKey':_0xe528('0x18f'),'onDelete':'cascade'});db['CmHopper']['belongsTo'](db[_0xe528('0x13')],{'as':_0xe528('0x164'),'foreignKey':_0xe528('0x190')});db['CmHopperBlack']['belongsTo'](db[_0xe528('0x67')],{'as':_0xe528('0x154'),'foreignKey':_0xe528('0x155'),'onDelete':_0xe528('0x101')});db[_0xe528('0x191')][_0xe528('0x110')](db[_0xe528('0xea')],{'as':_0xe528('0x16d'),'foreignKey':'ListId','onDelete':_0xe528('0x101')});db[_0xe528('0x191')][_0xe528('0x110')](db[_0xe528('0x1a')],{'as':_0xe528('0x184'),'foreignKey':'VoiceQueueId','onDelete':_0xe528('0x101')});db[_0xe528('0x191')][_0xe528('0x110')](db[_0xe528('0xdc')],{'as':_0xe528('0xdc'),'foreignKey':_0xe528('0x18f'),'onDelete':'cascade'});db[_0xe528('0x73')][_0xe528('0x105')](db['Condition'],{'as':{'plural':_0xe528('0x192'),'singular':_0xe528('0x193')},'foreignKey':_0xe528('0x194'),'onDelete':_0xe528('0x101'),'hooks':!![]});db[_0xe528('0x73')][_0xe528('0x105')](db[_0xe528('0x77')],{'as':{'plural':'Any','singular':_0xe528('0x195')},'foreignKey':_0xe528('0x196'),'onDelete':_0xe528('0x101'),'hooks':!![]});db[_0xe528('0x73')][_0xe528('0x105')](db[_0xe528('0x71')],{'as':_0xe528('0x197'),'foreignKey':_0xe528('0x198'),'onDelete':_0xe528('0x101'),'hooks':!![]});db['Disposition'][_0xe528('0x105')](db[_0xe528('0x76')],{'as':_0xe528('0x15b'),'foreignKey':_0xe528('0x199'),'onDelete':_0xe528('0x101')});db['Interval'][_0xe528('0x105')](db[_0xe528('0x78')],{'as':_0xe528('0x19a'),'foreignKey':_0xe528('0x146'),'onDelete':_0xe528('0x101'),'hooks':!![],'required':![]});db[_0xe528('0x78')][_0xe528('0x105')](db[_0xe528('0x107')],{'as':_0xe528('0x19b'),'foreignKey':_0xe528('0x146'),'onDelete':_0xe528('0x16c')});db['Interval'][_0xe528('0x105')](db[_0xe528('0x3c')],{'as':_0xe528('0x19c'),'foreignKey':_0xe528('0x146')});db[_0xe528('0x78')][_0xe528('0x105')](db[_0xe528('0x5a')],{'as':'ChatApplications','foreignKey':_0xe528('0x146')});db['Interval']['hasMany'](db['FaxApplication'],{'as':_0xe528('0x19d'),'foreignKey':_0xe528('0x146')});db[_0xe528('0x78')]['hasMany'](db[_0xe528('0x4a')],{'as':_0xe528('0x19e'),'foreignKey':_0xe528('0x146')});db[_0xe528('0x19f')]['belongsTo'](db[_0xe528('0x35')],{});db[_0xe528('0x19f')]['belongsTo'](db['AnalyticDefaultReport'],{'foreignKey':_0xe528('0x1a0')});db['Schedule'][_0xe528('0x110')](db['AnalyticCustomReport'],{'foreignKey':_0xe528('0x1a1')});db[_0xe528('0x1a2')][_0xe528('0x112')](db[_0xe528('0x13b')],{'as':_0xe528('0x1a3'),'through':_0xe528('0x13d'),'onDelete':_0xe528('0x16c')});db[_0xe528('0x7f')][_0xe528('0x112')](db[_0xe528('0x67')],{'through':_0xe528('0x18d')});db[_0xe528('0x7f')][_0xe528('0x112')](db[_0xe528('0x5c')],{'through':_0xe528('0x186')});db[_0xe528('0x7f')][_0xe528('0x112')](db['MailInteraction'],{'through':_0xe528('0x1a4')});db['Tag'][_0xe528('0x112')](db[_0xe528('0x10b')],{'through':'sms_interaction_has_tags'});db[_0xe528('0x7f')]['belongsToMany'](db[_0xe528('0x44')],{'through':'fax_interaction_has_tags'});db['Tag'][_0xe528('0x112')](db[_0xe528('0x52')],{'through':_0xe528('0x180')});db[_0xe528('0x7f')][_0xe528('0x112')](db['WhatsappInteraction'],{'through':_0xe528('0x1a5')});db[_0xe528('0x1a6')][_0xe528('0x105')](db[_0xe528('0x77')],{'as':{'plural':_0xe528('0x1a7'),'singular':'AllCondition'},'foreignKey':_0xe528('0x1a8'),'onDelete':'cascade','hooks':!![]});db['Trigger']['hasMany'](db[_0xe528('0x77')],{'as':{'plural':'AnyConditions','singular':_0xe528('0x1a9')},'foreignKey':_0xe528('0x1aa'),'onDelete':_0xe528('0x101'),'hooks':!![]});db[_0xe528('0x1a6')][_0xe528('0x105')](db[_0xe528('0x71')],{'as':_0xe528('0x197'),'foreignKey':_0xe528('0x1ab'),'onDelete':_0xe528('0x101'),'hooks':!![]});db[_0xe528('0x89')][_0xe528('0x105')](db[_0xe528('0x90')],{'as':_0xe528('0x1ac'),'onDelete':'cascade','foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0xe528('0x105')](db[_0xe528('0x90')],{'as':_0xe528('0x1ac'),'onDelete':_0xe528('0x101'),'foreignKey':'DefaultReportId'});db[_0xe528('0x8f')]['hasMany'](db[_0xe528('0x90')],{'as':_0xe528('0x1ac'),'onDelete':'cascade','foreignKey':_0xe528('0x1ad')});db[_0xe528('0x90')][_0xe528('0x110')](db[_0xe528('0x8f')],{'foreignKey':_0xe528('0x1ad')});db['SalesforceAccount'][_0xe528('0x105')](db[_0xe528('0x94')],{'as':_0xe528('0x1ae'),'onDelete':_0xe528('0x101'),'foreignKey':_0xe528('0x1af')});db[_0xe528('0x94')][_0xe528('0x105')](db['SalesforceField'],{'as':_0xe528('0x1b0'),'onDelete':_0xe528('0x101'),'foreignKey':_0xe528('0x1b1')});db[_0xe528('0x94')][_0xe528('0x105')](db[_0xe528('0x96')],{'as':_0xe528('0x1b2'),'onDelete':_0xe528('0x101'),'foreignKey':_0xe528('0x1b3')});db[_0xe528('0x94')][_0xe528('0x105')](db[_0xe528('0x96')],{'as':_0xe528('0x1ac'),'onDelete':_0xe528('0x101'),'foreignKey':_0xe528('0x1b4')});db[_0xe528('0x94')][_0xe528('0x110')](db[_0xe528('0x92')],{'as':_0xe528('0x163'),'foreignKey':_0xe528('0x1af')});db[_0xe528('0x96')][_0xe528('0x105')](db[_0xe528('0x96')],{'as':_0xe528('0x1b5'),'foreignKey':_0xe528('0x1b1')});db[_0xe528('0x96')][_0xe528('0x105')](db[_0xe528('0x96')],{'as':_0xe528('0x1b6'),'foreignKey':'DescriptionId'});db[_0xe528('0x96')]['hasMany'](db[_0xe528('0x96')],{'as':'Field','foreignKey':_0xe528('0x1b4')});db[_0xe528('0x96')][_0xe528('0x110')](db['Variable'],{'as':_0xe528('0x83'),'foreignKey':_0xe528('0x1b7')});db[_0xe528('0x1b8')][_0xe528('0x105')](db[_0xe528('0x98')],{'as':'Configurations','onDelete':_0xe528('0x101'),'foreignKey':_0xe528('0x1af')});db[_0xe528('0x98')][_0xe528('0x105')](db['SugarcrmField'],{'as':'Subjects','onDelete':_0xe528('0x101'),'foreignKey':_0xe528('0x1b1')});db[_0xe528('0x98')][_0xe528('0x105')](db[_0xe528('0x1b9')],{'as':_0xe528('0x1b2'),'onDelete':_0xe528('0x101'),'foreignKey':_0xe528('0x1b3')});db['SugarcrmConfiguration'][_0xe528('0x105')](db[_0xe528('0x1b9')],{'as':_0xe528('0x1ac'),'onDelete':'cascade','foreignKey':_0xe528('0x1b4')});db[_0xe528('0x98')][_0xe528('0x110')](db[_0xe528('0x1b8')],{'as':_0xe528('0x163'),'foreignKey':'AccountId'});db[_0xe528('0x1b9')][_0xe528('0x105')](db['SugarcrmField'],{'as':_0xe528('0x1b5'),'foreignKey':_0xe528('0x1b1')});db[_0xe528('0x1b9')][_0xe528('0x105')](db[_0xe528('0x1b9')],{'as':_0xe528('0x1b6'),'foreignKey':_0xe528('0x1b3')});db[_0xe528('0x1b9')][_0xe528('0x105')](db[_0xe528('0x1b9')],{'as':_0xe528('0x1ba'),'foreignKey':'FieldId'});db['SugarcrmField'][_0xe528('0x110')](db[_0xe528('0x83')],{'as':_0xe528('0x83'),'foreignKey':'VariableId'});db['DeskAccount']['hasMany'](db['DeskConfiguration'],{'as':_0xe528('0x1ae'),'onDelete':'cascade','foreignKey':_0xe528('0x1af')});db['DeskConfiguration'][_0xe528('0x105')](db[_0xe528('0x9f')],{'as':_0xe528('0x1b0'),'onDelete':'cascade','foreignKey':_0xe528('0x1b1')});db[_0xe528('0x9d')][_0xe528('0x105')](db[_0xe528('0x9f')],{'as':_0xe528('0x1b2'),'onDelete':_0xe528('0x101'),'foreignKey':'DescriptionId'});db['DeskConfiguration'][_0xe528('0x105')](db[_0xe528('0x9f')],{'as':_0xe528('0x1ac'),'onDelete':_0xe528('0x101'),'foreignKey':_0xe528('0x1b4')});db[_0xe528('0x9d')][_0xe528('0x110')](db[_0xe528('0x9b')],{'as':_0xe528('0x163'),'foreignKey':_0xe528('0x1af')});db['DeskConfiguration'][_0xe528('0x112')](db[_0xe528('0x7f')],{'through':_0xe528('0x1bb')});db[_0xe528('0x9f')]['hasMany'](db[_0xe528('0x9f')],{'as':_0xe528('0x1b5'),'foreignKey':_0xe528('0x1b1')});db['DeskField'][_0xe528('0x105')](db[_0xe528('0x9f')],{'as':_0xe528('0x1b6'),'foreignKey':_0xe528('0x1b3')});db['DeskField'][_0xe528('0x105')](db[_0xe528('0x9f')],{'as':_0xe528('0x1ba'),'foreignKey':'FieldId'});db[_0xe528('0x9f')][_0xe528('0x110')](db['Variable'],{'as':_0xe528('0x83'),'foreignKey':'VariableId'});db['ZohoAccount'][_0xe528('0x105')](db[_0xe528('0x1bc')],{'as':'Configurations','onDelete':_0xe528('0x101'),'foreignKey':'AccountId'});db['ZohoConfiguration'][_0xe528('0x105')](db['ZohoField'],{'as':_0xe528('0x1b0'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0xe528('0x1bc')][_0xe528('0x105')](db['ZohoField'],{'as':_0xe528('0x1b2'),'onDelete':'cascade','foreignKey':_0xe528('0x1b3')});db[_0xe528('0x1bc')][_0xe528('0x105')](db[_0xe528('0xa3')],{'as':_0xe528('0x1ac'),'onDelete':_0xe528('0x101'),'foreignKey':_0xe528('0x1b4')});db[_0xe528('0x1bc')][_0xe528('0x110')](db['ZohoAccount'],{'as':_0xe528('0x163'),'foreignKey':_0xe528('0x1af')});db['ZohoField'][_0xe528('0x105')](db[_0xe528('0xa3')],{'as':'Subject','foreignKey':_0xe528('0x1b1')});db[_0xe528('0xa3')]['hasMany'](db[_0xe528('0xa3')],{'as':_0xe528('0x1b6'),'foreignKey':'DescriptionId'});db[_0xe528('0xa3')][_0xe528('0x105')](db[_0xe528('0xa3')],{'as':_0xe528('0x1ba'),'foreignKey':_0xe528('0x1b4')});db[_0xe528('0xa3')][_0xe528('0x110')](db[_0xe528('0x83')],{'as':_0xe528('0x83'),'foreignKey':_0xe528('0x1b7')});db[_0xe528('0xa5')]['hasMany'](db['ZendeskConfiguration'],{'as':_0xe528('0x1ae'),'onDelete':_0xe528('0x101'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0xe528('0x105')](db[_0xe528('0xa8')],{'as':_0xe528('0x1b0'),'foreignKey':'SubjectId'});db['ZendeskConfiguration'][_0xe528('0x105')](db[_0xe528('0xa8')],{'as':_0xe528('0x1b2'),'foreignKey':_0xe528('0x1b3')});db[_0xe528('0xa7')][_0xe528('0x105')](db[_0xe528('0xa8')],{'as':_0xe528('0x1ac'),'foreignKey':_0xe528('0x1b4')});db[_0xe528('0xa7')][_0xe528('0x110')](db['ZendeskAccount'],{'as':_0xe528('0x163'),'foreignKey':_0xe528('0x1af')});db[_0xe528('0xa7')]['belongsToMany'](db[_0xe528('0x7f')],{'through':_0xe528('0x1bd')});db[_0xe528('0xa8')]['hasMany'](db[_0xe528('0xa8')],{'as':_0xe528('0x1b5'),'foreignKey':_0xe528('0x1b1')});db[_0xe528('0xa8')][_0xe528('0x105')](db['ZendeskField'],{'as':_0xe528('0x1b6'),'foreignKey':_0xe528('0x1b3')});db[_0xe528('0xa8')][_0xe528('0x105')](db[_0xe528('0xa8')],{'as':_0xe528('0x1ba'),'foreignKey':_0xe528('0x1b4')});db[_0xe528('0xa8')]['belongsTo'](db[_0xe528('0x83')],{'as':_0xe528('0x83'),'foreignKey':_0xe528('0x1b7')});db['FreshdeskAccount'][_0xe528('0x105')](db[_0xe528('0xab')],{'as':'Configurations','onDelete':_0xe528('0x101'),'foreignKey':'AccountId'});db['FreshdeskConfiguration'][_0xe528('0x105')](db[_0xe528('0xad')],{'as':_0xe528('0x1b0'),'onDelete':_0xe528('0x101'),'foreignKey':_0xe528('0x1b1')});db[_0xe528('0xab')]['hasMany'](db[_0xe528('0xad')],{'as':_0xe528('0x1b2'),'onDelete':'cascade','foreignKey':_0xe528('0x1b3')});db[_0xe528('0xab')][_0xe528('0x105')](db[_0xe528('0xad')],{'as':'Fields','onDelete':_0xe528('0x101'),'foreignKey':_0xe528('0x1b4')});db[_0xe528('0xab')]['belongsTo'](db[_0xe528('0xaa')],{'as':'Account','foreignKey':_0xe528('0x1af')});db['FreshdeskConfiguration'][_0xe528('0x112')](db[_0xe528('0x7f')],{'through':_0xe528('0x1be')});db['FreshdeskField'][_0xe528('0x105')](db[_0xe528('0xad')],{'as':_0xe528('0x1b5'),'foreignKey':_0xe528('0x1b1')});db[_0xe528('0xad')]['hasMany'](db[_0xe528('0xad')],{'as':_0xe528('0x1b6'),'foreignKey':_0xe528('0x1b3')});db['FreshdeskField'][_0xe528('0x105')](db[_0xe528('0xad')],{'as':_0xe528('0x1ba'),'foreignKey':_0xe528('0x1b4')});db['FreshdeskField'][_0xe528('0x110')](db[_0xe528('0x83')],{'as':_0xe528('0x83'),'foreignKey':_0xe528('0x1b7')});db[_0xe528('0xaf')][_0xe528('0x105')](db[_0xe528('0xb0')],{'as':_0xe528('0x1ae'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0xe528('0xb0')][_0xe528('0x105')](db[_0xe528('0xb2')],{'as':'Subjects','foreignKey':_0xe528('0x1b1')});db[_0xe528('0xb0')][_0xe528('0x105')](db[_0xe528('0xb2')],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0xe528('0xb0')][_0xe528('0x105')](db[_0xe528('0xb2')],{'as':'Fields','foreignKey':_0xe528('0x1b4')});db[_0xe528('0xb0')][_0xe528('0x110')](db[_0xe528('0xaf')],{'as':'Account','foreignKey':_0xe528('0x1af')});db['VtigerField'][_0xe528('0x105')](db[_0xe528('0xb2')],{'as':_0xe528('0x1b5'),'foreignKey':_0xe528('0x1b1')});db[_0xe528('0xb2')][_0xe528('0x105')](db[_0xe528('0xb2')],{'as':_0xe528('0x1b6'),'foreignKey':_0xe528('0x1b3')});db[_0xe528('0xb2')][_0xe528('0x105')](db[_0xe528('0xb2')],{'as':'Field','foreignKey':_0xe528('0x1b4')});db[_0xe528('0xb2')]['belongsTo'](db['Variable'],{'as':_0xe528('0x83'),'foreignKey':_0xe528('0x1b7')});db['ServicenowAccount'][_0xe528('0x105')](db['ServicenowConfiguration'],{'as':_0xe528('0x1ae'),'onDelete':_0xe528('0x101'),'foreignKey':_0xe528('0x1af')});db[_0xe528('0xb5')][_0xe528('0x105')](db['ServicenowField'],{'as':_0xe528('0x1b0'),'foreignKey':'SubjectId'});db[_0xe528('0xb5')]['hasMany'](db[_0xe528('0xb7')],{'as':_0xe528('0x1b2'),'foreignKey':_0xe528('0x1b3')});db[_0xe528('0xb5')][_0xe528('0x105')](db['ServicenowField'],{'as':_0xe528('0x1ac'),'foreignKey':'FieldId'});db[_0xe528('0xb5')][_0xe528('0x110')](db[_0xe528('0x1bf')],{'as':_0xe528('0x163'),'foreignKey':_0xe528('0x1af')});db[_0xe528('0xb7')]['hasMany'](db[_0xe528('0xb7')],{'as':'Subject','foreignKey':_0xe528('0x1b1')});db[_0xe528('0xb7')][_0xe528('0x105')](db[_0xe528('0xb7')],{'as':_0xe528('0x1b6'),'foreignKey':_0xe528('0x1b3')});db[_0xe528('0xb7')][_0xe528('0x105')](db[_0xe528('0xb7')],{'as':'Field','foreignKey':_0xe528('0x1b4')});db[_0xe528('0xb7')]['belongsTo'](db[_0xe528('0x83')],{'as':_0xe528('0x83'),'foreignKey':_0xe528('0x1b7')});db[_0xe528('0xb9')][_0xe528('0x105')](db[_0xe528('0xbb')],{'as':'Configurations','onDelete':_0xe528('0x101'),'foreignKey':_0xe528('0x1af')});db[_0xe528('0xbb')][_0xe528('0x105')](db[_0xe528('0xbc')],{'as':_0xe528('0x1b0'),'onDelete':_0xe528('0x101'),'foreignKey':_0xe528('0x1b1')});db[_0xe528('0xbb')][_0xe528('0x105')](db[_0xe528('0xbc')],{'as':_0xe528('0x1b2'),'onDelete':_0xe528('0x101'),'foreignKey':'DescriptionId'});db[_0xe528('0xbb')][_0xe528('0x105')](db['Dynamics365Field'],{'as':_0xe528('0x1ac'),'onDelete':_0xe528('0x101'),'foreignKey':_0xe528('0x1b4')});db[_0xe528('0xbb')][_0xe528('0x110')](db[_0xe528('0xb9')],{'as':_0xe528('0x163'),'foreignKey':_0xe528('0x1af')});db['Dynamics365Field'][_0xe528('0x105')](db[_0xe528('0xbc')],{'as':_0xe528('0x1b5'),'foreignKey':_0xe528('0x1b1')});db[_0xe528('0xbc')]['hasMany'](db['Dynamics365Field'],{'as':_0xe528('0x1b6'),'foreignKey':_0xe528('0x1b3')});db[_0xe528('0xbc')]['hasMany'](db[_0xe528('0xbc')],{'as':_0xe528('0x1ba'),'foreignKey':_0xe528('0x1b4')});db[_0xe528('0xbc')][_0xe528('0x110')](db['Variable'],{'as':_0xe528('0x83'),'foreignKey':_0xe528('0x1b7')});db[_0xe528('0xbe')][_0xe528('0x105')](db[_0xe528('0xc0')],{'as':'Configurations','onDelete':_0xe528('0x101'),'foreignKey':_0xe528('0x1af')});db[_0xe528('0xc0')]['hasMany'](db[_0xe528('0x1c0')],{'as':_0xe528('0x1b0'),'foreignKey':_0xe528('0x1b1')});db[_0xe528('0xc0')]['hasMany'](db['FreshsalesField'],{'as':'Descriptions','foreignKey':_0xe528('0x1b3')});db[_0xe528('0xc0')][_0xe528('0x105')](db[_0xe528('0x1c0')],{'as':_0xe528('0x1ac'),'foreignKey':_0xe528('0x1b4')});db['FreshsalesConfiguration'][_0xe528('0x110')](db[_0xe528('0xbe')],{'as':_0xe528('0x163'),'foreignKey':_0xe528('0x1af')});db['FreshsalesField'][_0xe528('0x105')](db[_0xe528('0x1c0')],{'as':_0xe528('0x1b5'),'foreignKey':_0xe528('0x1b1')});db[_0xe528('0x1c0')][_0xe528('0x105')](db[_0xe528('0x1c0')],{'as':_0xe528('0x1b6'),'foreignKey':'DescriptionId'});db[_0xe528('0x1c0')]['hasMany'](db[_0xe528('0x1c0')],{'as':_0xe528('0x1ba'),'foreignKey':_0xe528('0x1b4')});db['FreshsalesField'][_0xe528('0x110')](db[_0xe528('0x83')],{'as':_0xe528('0x83'),'foreignKey':'VariableId'});db[_0xe528('0xc5')][_0xe528('0x110')](db[_0xe528('0x57')],{});db['ChatQueueReport'][_0xe528('0x110')](db['CmList'],{'as':_0xe528('0x16d'),'foreignKey':_0xe528('0x15f')});db['ChatQueueReport']['belongsTo'](db[_0xe528('0x67')],{'as':'Contact','foreignKey':_0xe528('0x155')});db[_0xe528('0xc5')][_0xe528('0x110')](db['ChatInteraction'],{});db[_0xe528('0xc5')][_0xe528('0x110')](db[_0xe528('0x5e')],{});db[_0xe528('0xc5')][_0xe528('0x110')](db[_0xe528('0x13')],{});db[_0xe528('0xc5')][_0xe528('0x110')](db[_0xe528('0x122')],{});db[_0xe528('0xc7')][_0xe528('0x110')](db['User'],{'onDelete':_0xe528('0x101'),'foreignKey':_0xe528('0x1c1')});db[_0xe528('0xc7')]['belongsTo'](db[_0xe528('0x13')],{'onDelete':_0xe528('0x101'),'foreignKey':_0xe528('0x1c2')});db[_0xe528('0xcd')][_0xe528('0x105')](db[_0xe528('0xcb')],{'foreignKey':_0xe528('0x1c3'),'onDelete':_0xe528('0x101')});db['JscriptySessionReport']['hasMany'](db[_0xe528('0xc9')],{'foreignKey':_0xe528('0x1c3'),'onDelete':_0xe528('0x101')});db[_0xe528('0xce')][_0xe528('0x110')](db[_0xe528('0x49')],{});db[_0xe528('0xce')]['belongsTo'](db[_0xe528('0xea')],{'as':_0xe528('0x16d'),'foreignKey':_0xe528('0x15f')});db[_0xe528('0xce')][_0xe528('0x110')](db[_0xe528('0x67')],{'as':_0xe528('0x154'),'foreignKey':_0xe528('0x155')});db[_0xe528('0xce')]['belongsTo'](db[_0xe528('0x10b')],{});db[_0xe528('0xce')][_0xe528('0x110')](db[_0xe528('0x178')],{});db[_0xe528('0xce')][_0xe528('0x110')](db[_0xe528('0x13')],{});db[_0xe528('0xce')][_0xe528('0x110')](db[_0xe528('0x17c')],{});db[_0xe528('0xd2')][_0xe528('0x105')](db['JscriptySessionReport'],{'foreignKey':_0xe528('0x1c4')});db[_0xe528('0xd2')][_0xe528('0x105')](db[_0xe528('0xcb')],{'foreignKey':_0xe528('0x1c4')});db[_0xe528('0xd2')][_0xe528('0x105')](db[_0xe528('0xc9')],{'foreignKey':_0xe528('0x1c4')});db[_0xe528('0xd6')]['belongsToMany'](db['User'],{'as':_0xe528('0x167'),'through':_0xe528('0x138')});db[_0xe528('0x118')][_0xe528('0x112')](db['User'],{'as':_0xe528('0x14b'),'through':_0xe528('0x119')});db[_0xe528('0x118')]['belongsToMany'](db[_0xe528('0x1a')],{'through':'TeamVoiceQueue','as':'VoiceQueues'});db['Team'][_0xe528('0x112')](db[_0xe528('0x36')],{'through':_0xe528('0x161'),'as':_0xe528('0x1c5')});db[_0xe528('0x118')]['belongsToMany'](db[_0xe528('0x122')],{'through':_0xe528('0x188'),'as':_0xe528('0x123')});db[_0xe528('0x118')]['belongsToMany'](db[_0xe528('0x47')],{'through':'team_has_fax_queues','as':_0xe528('0x124')});db['Team']['belongsToMany'](db[_0xe528('0x17c')],{'through':_0xe528('0x1c6'),'as':'SmsQueues'});db[_0xe528('0x118')][_0xe528('0x112')](db[_0xe528('0x55')],{'through':_0xe528('0x182'),'as':'OpenchannelQueues'});db[_0xe528('0x118')][_0xe528('0x112')](db[_0xe528('0x127')],{'through':'team_has_whatsapp_queues','as':'WhatsappQueues'});db[_0xe528('0x118')][_0xe528('0x112')](db['VoicePrefix'],{'through':_0xe528('0xfd'),'as':_0xe528('0x121')});db[_0xe528('0xdc')][_0xe528('0x105')](db[_0xe528('0x68')],{'as':_0xe528('0x140'),'foreignKey':'CampaignId'});db[_0xe528('0xdc')][_0xe528('0x105')](db['CmHopperFinal'],{'as':_0xe528('0x108'),'foreignKey':_0xe528('0x18f')});db[_0xe528('0xdc')][_0xe528('0x105')](db[_0xe528('0x6c')],{'as':_0xe528('0x142'),'foreignKey':_0xe528('0x18f')});db[_0xe528('0xdc')]['hasMany'](db[_0xe528('0x191')],{'as':_0xe528('0x1c7'),'foreignKey':'CampaignId'});db[_0xe528('0xdc')][_0xe528('0x110')](db['Trunk'],{'as':_0xe528('0x27'),'foreignKey':_0xe528('0x144')});db[_0xe528('0xdc')][_0xe528('0x110')](db[_0xe528('0x27')],{'as':_0xe528('0x1c8'),'foreignKey':'TrunkBackupId'});db[_0xe528('0xdc')][_0xe528('0x110')](db[_0xe528('0x78')],{'as':_0xe528('0x78'),'foreignKey':_0xe528('0x146')});db[_0xe528('0xdc')][_0xe528('0x110')](db[_0xe528('0xd6')],{'as':_0xe528('0xd6'),'foreignKey':'SquareProjectId'});db[_0xe528('0xdc')]['belongsToMany'](db[_0xe528('0xea')],{'as':_0xe528('0x1c9'),'through':_0xe528('0x1ca')});db[_0xe528('0xdc')][_0xe528('0x112')](db[_0xe528('0xea')],{'as':_0xe528('0x14d'),'through':'campaigns_has_cm_blacklists'});db[_0xe528('0x168')]['belongsTo'](db[_0xe528('0x60')],{'as':_0xe528('0x60'),'foreignKey':_0xe528('0x16b')});db[_0xe528('0xe3')]['belongsTo'](db['MailMessage'],{});db[_0xe528('0xe3')]['belongsTo'](db[_0xe528('0x38')],{});db[_0xe528('0xe3')][_0xe528('0x110')](db[_0xe528('0x35')],{'foreignKey':_0xe528('0x1cb'),'as':_0xe528('0x1cc')});db['MailTransferReport']['belongsTo'](db[_0xe528('0x13')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0xe528('0xe3')][_0xe528('0x110')](db[_0xe528('0x13')],{'foreignKey':_0xe528('0x1cd'),'as':_0xe528('0x1ce')});db[_0xe528('0xe3')]['belongsTo'](db[_0xe528('0x36')],{'foreignKey':'ToMailQueueId','as':_0xe528('0x1cf')});db[_0xe528('0xe3')]['belongsTo'](db['MailAccount'],{'foreignKey':_0xe528('0x1d0'),'as':_0xe528('0x1d1')});db[_0xe528('0x1d2')]['belongsTo'](db[_0xe528('0x5e')],{});db[_0xe528('0x1d2')][_0xe528('0x110')](db['ChatInteraction'],{});db[_0xe528('0x1d2')][_0xe528('0x110')](db[_0xe528('0x57')],{'foreignKey':'FromChatWebsiteId','as':_0xe528('0x1cc')});db['ChatTransferReport']['belongsTo'](db['User'],{'foreignKey':_0xe528('0x1d3'),'as':_0xe528('0x1d4')});db[_0xe528('0x1d2')][_0xe528('0x110')](db['User'],{'foreignKey':_0xe528('0x1cd'),'as':'ToAgent'});db[_0xe528('0x1d2')][_0xe528('0x110')](db['ChatQueue'],{'foreignKey':_0xe528('0x1d5'),'as':_0xe528('0x1cf')});db[_0xe528('0x1d2')][_0xe528('0x110')](db['ChatWebsite'],{'foreignKey':_0xe528('0x1d6'),'as':_0xe528('0x1d1')});db['FaxTransferReport'][_0xe528('0x110')](db['FaxMessage'],{});db[_0xe528('0xe5')]['belongsTo'](db[_0xe528('0x44')],{});db['FaxTransferReport'][_0xe528('0x110')](db[_0xe528('0x41')],{'foreignKey':_0xe528('0x1d7'),'as':'FromAccount'});db[_0xe528('0xe5')][_0xe528('0x110')](db['User'],{'foreignKey':_0xe528('0x1d3'),'as':_0xe528('0x1d4')});db['FaxTransferReport'][_0xe528('0x110')](db[_0xe528('0x13')],{'foreignKey':_0xe528('0x1cd'),'as':'ToAgent'});db[_0xe528('0xe5')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0xe528('0x1d8'),'as':_0xe528('0x1cf')});db['FaxTransferReport']['belongsTo'](db[_0xe528('0x41')],{'foreignKey':_0xe528('0x1d9'),'as':_0xe528('0x1d1')});db[_0xe528('0xe7')]['belongsTo'](db['OpenchannelMessage'],{});db[_0xe528('0xe7')][_0xe528('0x110')](db['OpenchannelInteraction'],{});db['OpenchannelTransferReport'][_0xe528('0x110')](db[_0xe528('0x4e')],{'foreignKey':'FromOpenchannelAccountId','as':'FromAccount'});db[_0xe528('0xe7')][_0xe528('0x110')](db[_0xe528('0x13')],{'foreignKey':_0xe528('0x1d3'),'as':_0xe528('0x1d4')});db['OpenchannelTransferReport']['belongsTo'](db['User'],{'foreignKey':'ToUserId','as':_0xe528('0x1ce')});db['OpenchannelTransferReport']['belongsTo'](db[_0xe528('0x55')],{'foreignKey':_0xe528('0x1da'),'as':'ToQueue'});db[_0xe528('0xe7')][_0xe528('0x110')](db[_0xe528('0x4e')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db[_0xe528('0xe9')][_0xe528('0x110')](db[_0xe528('0x178')],{});db[_0xe528('0xe9')][_0xe528('0x110')](db[_0xe528('0x10b')],{});db['SmsTransferReport']['belongsTo'](db['SmsAccount'],{'foreignKey':_0xe528('0x1db'),'as':'FromAccount'});db[_0xe528('0xe9')][_0xe528('0x110')](db[_0xe528('0x13')],{'foreignKey':_0xe528('0x1d3'),'as':_0xe528('0x1d4')});db[_0xe528('0xe9')][_0xe528('0x110')](db[_0xe528('0x13')],{'foreignKey':_0xe528('0x1cd'),'as':_0xe528('0x1ce')});db[_0xe528('0xe9')][_0xe528('0x110')](db[_0xe528('0x17c')],{'foreignKey':'ToSmsQueueId','as':_0xe528('0x1cf')});db['SmsTransferReport']['belongsTo'](db[_0xe528('0x49')],{'foreignKey':'ToSmsAccountId','as':_0xe528('0x1d1')});db['CmList']['hasMany'](db[_0xe528('0x76')],{'as':'Dispositions','foreignKey':_0xe528('0x15f'),'onDelete':'cascade'});db['CmList']['hasMany'](db[_0xe528('0x6f')],{'as':_0xe528('0x1dc'),'foreignKey':'ListId'});db['CmList'][_0xe528('0x105')](db[_0xe528('0x67')],{'as':_0xe528('0x115'),'onDelete':'cascade','foreignKey':_0xe528('0x15f')});db[_0xe528('0xea')]['hasMany'](db[_0xe528('0x141')],{'as':_0xe528('0x108'),'foreignKey':_0xe528('0x15f')});db[_0xe528('0xea')][_0xe528('0x105')](db[_0xe528('0x6c')],{'as':_0xe528('0x1dd'),'foreignKey':'ListId'});db[_0xe528('0xea')]['hasMany'](db[_0xe528('0x6d')],{'as':_0xe528('0x6d'),'foreignKey':'ListId'});db[_0xe528('0xea')][_0xe528('0x112')](db[_0xe528('0x1a')],{'as':_0xe528('0x1de'),'through':'voice_queues_has_cm_lists'});db[_0xe528('0xea')][_0xe528('0x112')](db[_0xe528('0x13')],{'as':_0xe528('0x14b'),'through':_0xe528('0x117')});db[_0xe528('0xeb')]['hasMany'](db[_0xe528('0x107')],{'as':_0xe528('0x19b'),'onDelete':_0xe528('0x101')});db[_0xe528('0xeb')][_0xe528('0x112')](db[_0xe528('0x13')],{'as':_0xe528('0x14b'),'through':_0xe528('0xff')});db['VoicePrefix']['belongsToMany'](db[_0xe528('0x118')],{'through':_0xe528('0xfd'),'as':'Teams'});db[_0xe528('0x111')]['hasMany'](db['User'],{'as':'Users','foreignKey':_0xe528('0x1df')});db[_0xe528('0x111')]['hasMany'](db[_0xe528('0x1e0')],{'as':_0xe528('0x1e1'),'foreignKey':_0xe528('0x1df'),'onDelete':'cascade'});db[_0xe528('0x1e0')][_0xe528('0x105')](db[_0xe528('0xee')],{'as':_0xe528('0x1e2'),'foreignKey':_0xe528('0x1e3'),'onDelete':_0xe528('0x101')});db[_0xe528('0xf2')][_0xe528('0x105')](db[_0xe528('0x76')],{'as':_0xe528('0x15b'),'foreignKey':'WhatsappAccountId','onDelete':'cascade'});db[_0xe528('0xf2')][_0xe528('0x105')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0xe528('0x1e4')});db['WhatsappAccount']['hasMany'](db[_0xe528('0xf7')],{'as':_0xe528('0x14e'),'foreignKey':_0xe528('0x1e4')});db[_0xe528('0xf2')]['hasMany'](db[_0xe528('0xf5')],{'as':_0xe528('0x15e')});db[_0xe528('0xf2')][_0xe528('0x105')](db[_0xe528('0xf4')],{'as':_0xe528('0x13a')});db[_0xe528('0xf2')][_0xe528('0x110')](db['CmList'],{'as':_0xe528('0x16d'),'foreignKey':'ListId'});db[_0xe528('0xf2')]['belongsTo'](db['Pause'],{'as':_0xe528('0x148'),'foreignKey':_0xe528('0x149')});db['WhatsappAccount'][_0xe528('0x112')](db['User'],{'as':'Agents','through':_0xe528('0x136')});db['WhatsappApplication'][_0xe528('0x110')](db[_0xe528('0x13')],{'onDelete':_0xe528('0x16c')});db[_0xe528('0xf4')][_0xe528('0x110')](db[_0xe528('0x127')],{'onDelete':_0xe528('0x16c')});db[_0xe528('0xf4')][_0xe528('0x110')](db[_0xe528('0xf2')],{'onDelete':_0xe528('0x16c')});db['WhatsappApplication']['belongsTo'](db['Interval'],{'onDelete':_0xe528('0x16c'),'foreignKey':_0xe528('0x146')});db[_0xe528('0xf4')][_0xe528('0x110')](db[_0xe528('0x7f')],{'onDelete':_0xe528('0x16c'),'foreignKey':'TagId'});db[_0xe528('0xf5')][_0xe528('0x105')](db['WhatsappMessage'],{'as':_0xe528('0x14e'),'onDelete':_0xe528('0x101'),'foreignKey':'WhatsappInteractionId'});db['WhatsappInteraction'][_0xe528('0x110')](db['WhatsappAccount'],{'as':_0xe528('0x163'),'foreignKey':_0xe528('0x1e4')});db[_0xe528('0xf5')][_0xe528('0x110')](db[_0xe528('0x67')],{'as':_0xe528('0x154'),'foreignKey':_0xe528('0x155')});db[_0xe528('0xf5')][_0xe528('0x110')](db[_0xe528('0x13')],{'as':_0xe528('0x164'),'foreignKey':_0xe528('0x104')});db['WhatsappInteraction'][_0xe528('0x112')](db[_0xe528('0x7f')],{'through':_0xe528('0x1a5'),'as':_0xe528('0x165')});db[_0xe528('0xf5')]['belongsToMany'](db['Tag'],{'through':'whatsapp_interaction_has_tags','as':_0xe528('0x166')});db['WhatsappInteraction']['belongsToMany'](db[_0xe528('0x13')],{'as':_0xe528('0x167'),'through':_0xe528('0x1e5'),'foreignKey':_0xe528('0x1e6')});db[_0xe528('0xf7')][_0xe528('0x110')](db['User'],{'as':_0xe528('0x13')});db[_0xe528('0xf7')][_0xe528('0x110')](db['CmContact'],{'onDelete':_0xe528('0x101'),'as':_0xe528('0x154')});db['WhatsappMessage'][_0xe528('0x110')](db[_0xe528('0xf5')],{'onDelete':'cascade','as':_0xe528('0x16a'),'foreignKey':_0xe528('0x1e6')});db['WhatsappMessage'][_0xe528('0x110')](db['WhatsappAccount'],{'as':_0xe528('0x163'),'foreignKey':_0xe528('0x1e4')});db[_0xe528('0xf9')][_0xe528('0x110')](db[_0xe528('0xf2')],{});db[_0xe528('0xf9')][_0xe528('0x110')](db[_0xe528('0xea')],{'as':_0xe528('0x16d'),'foreignKey':_0xe528('0x15f')});db[_0xe528('0xf9')]['belongsTo'](db[_0xe528('0x67')],{'as':_0xe528('0x154'),'foreignKey':_0xe528('0x155')});db[_0xe528('0xf9')]['belongsTo'](db[_0xe528('0xf5')],{});db[_0xe528('0xf9')][_0xe528('0x110')](db[_0xe528('0x127')],{});db[_0xe528('0xf9')][_0xe528('0x110')](db[_0xe528('0xf7')],{});db['WhatsappQueueReport']['belongsTo'](db['User'],{});db[_0xe528('0xfa')][_0xe528('0x110')](db['WhatsappMessage'],{});db[_0xe528('0xfa')][_0xe528('0x110')](db[_0xe528('0xf5')],{});db[_0xe528('0xfa')][_0xe528('0x110')](db[_0xe528('0xf2')],{'foreignKey':_0xe528('0x1e7'),'as':_0xe528('0x1cc')});db['WhatsappTransferReport'][_0xe528('0x110')](db[_0xe528('0xf2')],{'foreignKey':_0xe528('0x1e8'),'as':'ToAccount'});db[_0xe528('0xfa')][_0xe528('0x110')](db[_0xe528('0x127')],{'foreignKey':_0xe528('0x1e9'),'as':'ToQueue'});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0xe528('0x1d3'),'as':'FromAgent'});db[_0xe528('0xfa')][_0xe528('0x110')](db[_0xe528('0x13')],{'foreignKey':'ToUserId','as':_0xe528('0x1ce')});db[_0xe528('0x127')][_0xe528('0x112')](db[_0xe528('0x13')],{'as':_0xe528('0x14b'),'through':_0xe528('0x129'),'foreignKey':_0xe528('0x1ea')});db[_0xe528('0x127')][_0xe528('0x112')](db[_0xe528('0x118')],{'through':_0xe528('0x1eb'),'as':_0xe528('0x14c')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 01cefda..f265de5 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1f76=['express-winston','util','./errors','./config/environment','./config/logger','api','default','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','\x20body=%s','format','method','headers','x-forwarded-for','remoteAddress','statusCode','user','name','inspect','use','body','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','connection','url','responseTime','role','test','/api/users','./api/user','./api/voiceChanSpy','./api/voiceContext','./api/voiceExtension','/api/voice/mohs','/api/voice/queues','./api/voiceQueue','/api/screen/recordings','./api/screenRecording','./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/voiceQueueReport','/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/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','./api/mailQueueReport','./api/dashboard','/api/dashboards/items','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/applications','./api/smsApplication','/api/sms/messages','./api/smsMessage','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/applications','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','/api/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/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','/api/actions','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','/api/conditions','./api/condition','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/voiceQueuesLog','./api/schedule','/api/sounds','./api/tag','/api/templates','./api/template','./api/trigger','/api/variables','./api/integration','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','./api/intSugarcrmField','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','./api/intVtigerField','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','./api/intFreshsalesAccount','/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/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/plugins','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','/api/voice/prefixes','./api/voicePrefix','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','/api/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/authLocal','/api/auth/google','/api/jira','/api/rpc','./api/rpc','/api/version','/api/system','./api/system','/api/pm2','./api/pm2','./api/webbar','/apidoc','static','join','root','/www','/demo','snippet','3.0.0','/plugins','/:url(api|auth|components|app|bower_components|assets)/*','get','route','sendFile','resolve','appPath','username','password','apiKey','firstName','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','token','channelSecret','accessToken','authToken','consumerKey','membername','calleridname','calleridnum','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','pass','localstationid','dsn','secret','oldPassword','isPlainObject','isArray','isString','replace','@@{','}@@','includes','lodash','path','express'];(function(_0x338b15,_0x3202d8){var _0x466e43=function(_0x3c79ae){while(--_0x3c79ae){_0x338b15['push'](_0x338b15['shift']());}};_0x466e43(++_0x3202d8);}(_0x1f76,0x14a));var _0x61f7=function(_0x3ce0dc,_0x52d2c9){_0x3ce0dc=_0x3ce0dc-0x0;var _0x19b4c8=_0x1f76[_0x3ce0dc];return _0x19b4c8;};'use strict';var _=require(_0x61f7('0x0'));var path=require(_0x61f7('0x1'));var express=require(_0x61f7('0x2'));var ewinston=require(_0x61f7('0x3'));var util=require(_0x61f7('0x4'));var errors=require(_0x61f7('0x5'));var config=require(_0x61f7('0x6'));var logger=require(_0x61f7('0x7'))(_0x61f7('0x8'));var authLogger=require('./config/logger')('auth');exports[_0x61f7('0x9')]=function(_0x2256f6){_0x2256f6['use'](ewinston[_0x61f7('0xa')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x1e942f,_0x459ba7){var _0x520033=_0x61f7('0xb');if(!_[_0x61f7('0xc')](_0x1e942f['body'])){_0x520033+=_0x61f7('0xd');var _0x31b1b9=_0x1e942f['body'];maskSensitiveData(_0x31b1b9);}return util[_0x61f7('0xe')](_0x520033,_0x1e942f[_0x61f7('0xf')],_0x1e942f[_0x61f7('0x10')][_0x61f7('0x11')]?_0x1e942f[_0x61f7('0x10')][_0x61f7('0x11')]:_0x1e942f['connection'][_0x61f7('0x12')]||_0x1e942f['ip'],_0x1e942f['url'],_0x459ba7[_0x61f7('0x13')],_0x459ba7['responseTime'],_0x1e942f[_0x61f7('0x14')]?_0x1e942f[_0x61f7('0x14')]['id']:null,_0x1e942f['user']?_0x1e942f['user'][_0x61f7('0x15')]:null,_0x1e942f[_0x61f7('0x14')]?_0x1e942f['user']['role']:null,_0x31b1b9?util[_0x61f7('0x16')](_0x31b1b9,![],null):'');}}));_0x2256f6[_0x61f7('0x17')](ewinston[_0x61f7('0xa')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x16f941,_0x2b8674){var _0x25e9df='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x16f941[_0x61f7('0x18')]&&_0x16f941[_0x61f7('0x18')][_0x61f7('0x19')]&&_0x16f941['body'][_0x61f7('0x1a')]){_0x25e9df=_0x61f7('0x1b');}return util[_0x61f7('0xe')](_0x25e9df,_0x16f941['method'],_0x16f941['headers'][_0x61f7('0x11')]?_0x16f941[_0x61f7('0x10')][_0x61f7('0x11')]:_0x16f941[_0x61f7('0x1c')][_0x61f7('0x12')]||_0x16f941['ip'],_0x16f941[_0x61f7('0x1d')],_0x2b8674['statusCode'],_0x2b8674[_0x61f7('0x1e')],_0x16f941[_0x61f7('0x14')]?_0x16f941[_0x61f7('0x14')]['id']:null,_0x16f941[_0x61f7('0x14')]?_0x16f941[_0x61f7('0x14')]['name']:null,_0x16f941[_0x61f7('0x14')]?_0x16f941[_0x61f7('0x14')][_0x61f7('0x1f')]:null,_0x16f941[_0x61f7('0x18')]&&_0x16f941[_0x61f7('0x18')][_0x61f7('0x19')]?_0x16f941[_0x61f7('0x18')][_0x61f7('0x19')]:'other',_0x16f941[_0x61f7('0x18')]&&_0x16f941['body'][_0x61f7('0x1a')]?_0x16f941['body'][_0x61f7('0x1a')]:'',_0x16f941['body']&&_0x16f941[_0x61f7('0x18')]['agent_name']?_0x16f941[_0x61f7('0x18')]['agent_name']:'');},'ignoreRoute':function(_0x5b8859){var _0x5ef5dd=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x5ef5dd[_0x61f7('0x20')](_0x5b8859[_0x61f7('0x1d')]);}}));_0x2256f6[_0x61f7('0x17')](_0x61f7('0x21'),require(_0x61f7('0x22')));_0x2256f6['use']('/api/voice/chanspy',require(_0x61f7('0x23')));_0x2256f6['use']('/api/voice/contexts',require(_0x61f7('0x24')));_0x2256f6[_0x61f7('0x17')]('/api/voice/extensions',require(_0x61f7('0x25')));_0x2256f6['use'](_0x61f7('0x26'),require('./api/voiceMusicOnHold'));_0x2256f6[_0x61f7('0x17')](_0x61f7('0x27'),require(_0x61f7('0x28')));_0x2256f6[_0x61f7('0x17')]('/api/voice/recordings',require('./api/voiceRecording'));_0x2256f6['use'](_0x61f7('0x29'),require(_0x61f7('0x2a')));_0x2256f6['use']('/api/voice/mails',require(_0x61f7('0x2b')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0x2c'),require(_0x61f7('0x2d')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0x2e'),require(_0x61f7('0x2f')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0x30'),require(_0x61f7('0x31')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0x32'),require('./api/voiceAgentReport'));_0x2256f6[_0x61f7('0x17')](_0x61f7('0x33'),require(_0x61f7('0x34')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0x35'),require('./api/memberReport'));_0x2256f6[_0x61f7('0x17')](_0x61f7('0x36'),require(_0x61f7('0x37')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0x38'),require(_0x61f7('0x39')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0x3a'),require(_0x61f7('0x3b')));_0x2256f6['use'](_0x61f7('0x3c'),require(_0x61f7('0x3d')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0x3e'),require(_0x61f7('0x3f')));_0x2256f6[_0x61f7('0x17')]('/api/mail/substatuses',require('./api/mailSubstatus'));_0x2256f6[_0x61f7('0x17')](_0x61f7('0x40'),require(_0x61f7('0x41')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0x42'),require(_0x61f7('0x43')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0x44'),require(_0x61f7('0x45')));_0x2256f6[_0x61f7('0x17')]('/api/mail/reports/queue',require(_0x61f7('0x46')));_0x2256f6[_0x61f7('0x17')]('/api/dashboards',require(_0x61f7('0x47')));_0x2256f6['use'](_0x61f7('0x48'),require('./api/dashboardItem'));_0x2256f6['use']('/api/fax/accounts',require(_0x61f7('0x49')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0x4a'),require(_0x61f7('0x4b')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0x4c'),require(_0x61f7('0x4d')));_0x2256f6['use'](_0x61f7('0x4e'),require(_0x61f7('0x4f')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0x50'),require(_0x61f7('0x51')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0x52'),require(_0x61f7('0x53')));_0x2256f6[_0x61f7('0x17')]('/api/sms/accounts',require('./api/smsAccount'));_0x2256f6[_0x61f7('0x17')](_0x61f7('0x54'),require(_0x61f7('0x55')));_0x2256f6[_0x61f7('0x17')]('/api/sms/interactions',require('./api/smsInteraction'));_0x2256f6[_0x61f7('0x17')](_0x61f7('0x56'),require(_0x61f7('0x57')));_0x2256f6['use']('/api/sms/queues',require(_0x61f7('0x58')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0x59'),require('./api/openchannelAccount'));_0x2256f6[_0x61f7('0x17')](_0x61f7('0x5a'),require('./api/openchannelApplication'));_0x2256f6[_0x61f7('0x17')](_0x61f7('0x5b'),require(_0x61f7('0x5c')));_0x2256f6['use'](_0x61f7('0x5d'),require(_0x61f7('0x5e')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0x5f'),require(_0x61f7('0x60')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0x61'),require(_0x61f7('0x62')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0x63'),require(_0x61f7('0x64')));_0x2256f6['use']('/api/chat/applications',require(_0x61f7('0x65')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0x66'),require(_0x61f7('0x67')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0x68'),require(_0x61f7('0x69')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0x6a'),require(_0x61f7('0x6b')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0x6c'),require(_0x61f7('0x6d')));_0x2256f6['use'](_0x61f7('0x6e'),require(_0x61f7('0x6f')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0x70'),require(_0x61f7('0x71')));_0x2256f6['use'](_0x61f7('0x72'),require(_0x61f7('0x73')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0x74'),require('./api/cmContact'));_0x2256f6[_0x61f7('0x17')](_0x61f7('0x75'),require(_0x61f7('0x76')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0x77'),require(_0x61f7('0x78')));_0x2256f6['use'](_0x61f7('0x79'),require(_0x61f7('0x7a')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0x7b'),require(_0x61f7('0x7c')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0x7d'),require('./api/cmCustomField'));_0x2256f6['use'](_0x61f7('0x7e'),require('./api/action'));_0x2256f6['use']('/api/automations',require(_0x61f7('0x7f')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0x80'),require(_0x61f7('0x81')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0x82'),require('./api/disposition'));_0x2256f6['use'](_0x61f7('0x83'),require(_0x61f7('0x84')));_0x2256f6[_0x61f7('0x17')]('/api/intervals',require(_0x61f7('0x85')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0x86'),require(_0x61f7('0x87')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0x88'),require('./api/cdr'));_0x2256f6[_0x61f7('0x17')]('/api/voiceQueuesLog',require(_0x61f7('0x89')));_0x2256f6[_0x61f7('0x17')]('/api/schedules',require(_0x61f7('0x8a')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0x8b'),require('./api/sound'));_0x2256f6[_0x61f7('0x17')]('/api/tags',require(_0x61f7('0x8c')));_0x2256f6['use'](_0x61f7('0x8d'),require(_0x61f7('0x8e')));_0x2256f6['use']('/api/triggers',require(_0x61f7('0x8f')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0x90'),require('./api/variable'));_0x2256f6['use']('/api/integrations',require(_0x61f7('0x91')));_0x2256f6[_0x61f7('0x17')]('/api/integrations/reports',require(_0x61f7('0x92')));_0x2256f6[_0x61f7('0x17')]('/api/analytics/custom_reports',require(_0x61f7('0x93')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0x94'),require(_0x61f7('0x95')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0x96'),require(_0x61f7('0x97')));_0x2256f6['use'](_0x61f7('0x98'),require(_0x61f7('0x99')));_0x2256f6['use'](_0x61f7('0x9a'),require(_0x61f7('0x9b')));_0x2256f6[_0x61f7('0x17')]('/api/analytics/tree_reports',require('./api/analyticTreeReport'));_0x2256f6[_0x61f7('0x17')](_0x61f7('0x9c'),require(_0x61f7('0x9d')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0x9e'),require(_0x61f7('0x9f')));_0x2256f6[_0x61f7('0x17')]('/api/integrations/salesforce/fields',require(_0x61f7('0xa0')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0xa1'),require('./api/intSugarcrmAccount'));_0x2256f6['use'](_0x61f7('0xa2'),require(_0x61f7('0xa3')));_0x2256f6['use']('/api/integrations/sugarcrm/fields',require(_0x61f7('0xa4')));_0x2256f6[_0x61f7('0x17')]('/api/integrations/desk/accounts',require(_0x61f7('0xa5')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0xa6'),require(_0x61f7('0xa7')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0xa8'),require(_0x61f7('0xa9')));_0x2256f6['use'](_0x61f7('0xaa'),require('./api/intZohoAccount'));_0x2256f6[_0x61f7('0x17')](_0x61f7('0xab'),require(_0x61f7('0xac')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0xad'),require(_0x61f7('0xae')));_0x2256f6[_0x61f7('0x17')]('/api/integrations/zendesk/accounts',require('./api/intZendeskAccount'));_0x2256f6[_0x61f7('0x17')](_0x61f7('0xaf'),require(_0x61f7('0xb0')));_0x2256f6[_0x61f7('0x17')]('/api/integrations/zendesk/fields',require(_0x61f7('0xb1')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0xb2'),require(_0x61f7('0xb3')));_0x2256f6[_0x61f7('0x17')]('/api/integrations/freshdesk/configurations',require('./api/intFreshdeskConfiguration'));_0x2256f6[_0x61f7('0x17')](_0x61f7('0xb4'),require(_0x61f7('0xb5')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0xb6'),require(_0x61f7('0xb7')));_0x2256f6['use'](_0x61f7('0xb8'),require('./api/intVtigerConfiguration'));_0x2256f6[_0x61f7('0x17')](_0x61f7('0xb9'),require(_0x61f7('0xba')));_0x2256f6[_0x61f7('0x17')]('/api/integrations/servicenow/accounts',require(_0x61f7('0xbb')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0xbc'),require(_0x61f7('0xbd')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0xbe'),require(_0x61f7('0xbf')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0xc0'),require(_0x61f7('0xc1')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0xc2'),require('./api/intDynamics365Configuration'));_0x2256f6[_0x61f7('0x17')](_0x61f7('0xc3'),require('./api/intDynamics365Field'));_0x2256f6[_0x61f7('0x17')]('/api/integrations/freshsales/accounts',require(_0x61f7('0xc4')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0xc5'),require(_0x61f7('0xc6')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0xc7'),require(_0x61f7('0xc8')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0xc9'),require(_0x61f7('0xca')));_0x2256f6['use'](_0x61f7('0xcb'),require('./api/chatQueueReport'));_0x2256f6[_0x61f7('0x17')](_0x61f7('0xcc'),require('./api/chatInternalMessage'));_0x2256f6[_0x61f7('0x17')](_0x61f7('0xcd'),require(_0x61f7('0xce')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0xcf'),require(_0x61f7('0xd0')));_0x2256f6[_0x61f7('0x17')]('/api/jscripty/sessions/reports',require('./api/jscriptySessionReport'));_0x2256f6[_0x61f7('0x17')](_0x61f7('0xd1'),require(_0x61f7('0xd2')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0xd3'),require(_0x61f7('0xd4')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0xd5'),require(_0x61f7('0xd6')));_0x2256f6['use'](_0x61f7('0xd7'),require(_0x61f7('0xd8')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0xd9'),require(_0x61f7('0xda')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0xdb'),require(_0x61f7('0xdc')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0xdd'),require(_0x61f7('0xde')));_0x2256f6['use']('/api/square/recordings',require(_0x61f7('0xdf')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0xe0'),require(_0x61f7('0xe1')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0xe2'),require(_0x61f7('0xe3')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0xe4'),require(_0x61f7('0xe5')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0xe6'),require(_0x61f7('0xe7')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0xe8'),require(_0x61f7('0xe9')));_0x2256f6[_0x61f7('0x17')]('/api/attachments',require('./api/attachment'));_0x2256f6[_0x61f7('0x17')](_0x61f7('0xea'),require(_0x61f7('0xeb')));_0x2256f6['use']('/api/mail/reports/transfer',require(_0x61f7('0xec')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0xed'),require(_0x61f7('0xee')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0xef'),require(_0x61f7('0xf0')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0xf1'),require(_0x61f7('0xf2')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0xf3'),require('./api/smsTransferReport'));_0x2256f6['use']('/api/cm/lists',require('./api/cmList'));_0x2256f6[_0x61f7('0x17')](_0x61f7('0xf4'),require(_0x61f7('0xf5')));_0x2256f6['use']('/api/userProfiles',require(_0x61f7('0xf6')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0xf7'),require(_0x61f7('0xf8')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0xf9'),require(_0x61f7('0xfa')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0xfb'),require(_0x61f7('0xfc')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0xfd'),require(_0x61f7('0xfe')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0xff'),require(_0x61f7('0x100')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0x101'),require('./api/whatsappInteraction'));_0x2256f6[_0x61f7('0x17')](_0x61f7('0x102'),require(_0x61f7('0x103')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0x104'),require(_0x61f7('0x105')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0x106'),require(_0x61f7('0x107')));_0x2256f6['use'](_0x61f7('0x108'),require(_0x61f7('0x109')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0x10a'),require(_0x61f7('0x10b')));_0x2256f6[_0x61f7('0x17')]('/api/realtime',require(_0x61f7('0x10c')));_0x2256f6['use']('/api/auth/local',require(_0x61f7('0x10d')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0x10e'),require('./api/authGoogle'));_0x2256f6[_0x61f7('0x17')](_0x61f7('0x10f'),require('./api/jira'));_0x2256f6[_0x61f7('0x17')](_0x61f7('0x110'),require(_0x61f7('0x111')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0x112'),require('./api/version'));_0x2256f6['use'](_0x61f7('0x113'),require(_0x61f7('0x114')));_0x2256f6['use'](_0x61f7('0x115'),require(_0x61f7('0x116')));_0x2256f6['use']('/api/webbar',require(_0x61f7('0x117')));_0x2256f6[_0x61f7('0x17')](_0x61f7('0x118'),express[_0x61f7('0x119')](path[_0x61f7('0x11a')](config[_0x61f7('0x11b')],_0x61f7('0x118'))));_0x2256f6['use'](_0x61f7('0x11c'),express[_0x61f7('0x119')](path[_0x61f7('0x11a')](config[_0x61f7('0x11b')],_0x61f7('0x11c'))));_0x2256f6[_0x61f7('0x17')](_0x61f7('0x11d'),express[_0x61f7('0x119')](path[_0x61f7('0x11a')](config[_0x61f7('0x11b')],_0x61f7('0x11d'))));_0x2256f6[_0x61f7('0x17')]('/snippet',express[_0x61f7('0x119')](path['join'](config['root'],_0x61f7('0x11e'),_0x61f7('0x11f'))));_0x2256f6['use'](_0x61f7('0x120'),express[_0x61f7('0x119')](path[_0x61f7('0x11a')](config[_0x61f7('0x11b')],'/server/files/plugins')));_0x2256f6['route'](_0x61f7('0x121'))[_0x61f7('0x122')](errors[0x194]);_0x2256f6[_0x61f7('0x123')]('/*')['get'](function(_0x5c7f85,_0x2e024b){_0x2e024b[_0x61f7('0x124')](path[_0x61f7('0x125')](_0x2256f6['get'](_0x61f7('0x126'))+'/index.html'));});};var sensitiveFields=[_0x61f7('0x127'),_0x61f7('0x128'),'newPassword',_0x61f7('0x129'),_0x61f7('0x12a'),_0x61f7('0x12b'),_0x61f7('0x12c'),_0x61f7('0x12d'),_0x61f7('0x12e'),_0x61f7('0x12f'),_0x61f7('0x130'),_0x61f7('0x131'),_0x61f7('0x132'),_0x61f7('0x133'),'code','accessKey','tenantId',_0x61f7('0x134'),_0x61f7('0x135'),_0x61f7('0x136'),'accessTokenSecret',_0x61f7('0x137'),_0x61f7('0x138'),'consumerSecret',_0x61f7('0x139'),_0x61f7('0x13a'),_0x61f7('0x13b'),'exten',_0x61f7('0x13c'),_0x61f7('0x13d'),_0x61f7('0x13e'),_0x61f7('0x13f'),_0x61f7('0x140'),'key',_0x61f7('0x14'),_0x61f7('0x141'),'accountSid',_0x61f7('0x142'),_0x61f7('0x143'),_0x61f7('0x144'),'registry',_0x61f7('0x145')];function maskSensitiveData(_0x304275){var _0x1b1529=/(?!^)[\s\S](?!$)/g;if(!_[_0x61f7('0x146')](_0x304275))return;for(var _0x188226 in _0x304275){if(_[_0x61f7('0x147')](_0x304275[_0x188226])){for(var _0x1bd215=0x0;_0x1bd215<_0x304275[_0x188226]['length'];_0x1bd215++){maskSensitiveData(_0x304275[_0x188226][_0x1bd215]);}}else if(_['isPlainObject'](_0x304275[_0x188226])){maskSensitiveData(_0x304275[_0x188226]);}else if(_[_0x61f7('0x148')](_0x304275[_0x188226])){_0x304275[_0x188226]=_0x304275[_0x188226][_0x61f7('0x149')](/{{{/g,_0x61f7('0x14a'))[_0x61f7('0x149')](/}}}/g,_0x61f7('0x14b'))['replace'](/{{/g,'@{')[_0x61f7('0x149')](/}}/g,'}@');if(_[_0x61f7('0x14c')](sensitiveFields,_0x188226)){_0x304275[_0x188226]=_0x304275[_0x188226][_0x61f7('0x149')](_0x1b1529,'*');}}}} \ No newline at end of file +var _0x4891=['./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','./api/intFreshdeskField','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','./api/intVtigerField','./api/intServicenowAccount','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','/api/jscripty/projects','./api/jscriptyProject','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareMessage','/api/teams','/api/license','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','./api/authLocal','/api/auth/google','/api/jira','./api/jira','./api/rpc','/api/version','./api/version','/api/system','./api/system','./api/pm2','/api/webbar','./api/webbar','/apidoc','static','join','/www','root','/demo','snippet','3.0.0','/plugins','/server/files/plugins','route','get','sendFile','resolve','appPath','username','password','newPassword','firstName','lastName','street','mobile','fax','email','clientSecret','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','exten','vidaooApiKey','clientEmail','privateKey','secretaccesskey','key','pass','accountSid','dsn','isPlainObject','isArray','length','isString','replace','@@{','}@@','includes','lodash','express-winston','util','./config/environment','./config/logger','api','auth','default','use','logger','isEmpty','body','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','user','name','role','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','method','device','other','agent_name','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceQueue','/api/voice/recordings','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','/api/voice/calls/reports','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/dashboards','/api/dashboards/items','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/queues','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','/api/chat/queues','/api/chat/groups','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmContact','/api/cm/hopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','./api/disposition','/api/conditions','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','./api/voiceQueuesLog','/api/schedules','/api/sounds','./api/sound','/api/tags','/api/templates','/api/triggers','/api/variables','./api/variable','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','/api/analytics/default_reports','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','/api/integrations/desk/configurations','/api/integrations/desk/fields','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields'];(function(_0x2c9126,_0x437d3d){var _0xd5b615=function(_0x2dc2dd){while(--_0x2dc2dd){_0x2c9126['push'](_0x2c9126['shift']());}};_0xd5b615(++_0x437d3d);}(_0x4891,0x9e));var _0x1489=function(_0x5797d8,_0x4efa24){_0x5797d8=_0x5797d8-0x0;var _0xab7ead=_0x4891[_0x5797d8];return _0xab7ead;};'use strict';var _=require(_0x1489('0x0'));var path=require('path');var express=require('express');var ewinston=require(_0x1489('0x1'));var util=require(_0x1489('0x2'));var errors=require('./errors');var config=require(_0x1489('0x3'));var logger=require(_0x1489('0x4'))(_0x1489('0x5'));var authLogger=require('./config/logger')(_0x1489('0x6'));exports[_0x1489('0x7')]=function(_0xe9580f){_0xe9580f[_0x1489('0x8')](ewinston[_0x1489('0x9')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x1eb92d,_0x442888){var _0x1c202d='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0x1489('0xa')](_0x1eb92d[_0x1489('0xb')])){_0x1c202d+='\x20body=%s';var _0x1df2ef=_0x1eb92d[_0x1489('0xb')];maskSensitiveData(_0x1df2ef);}return util['format'](_0x1c202d,_0x1eb92d['method'],_0x1eb92d[_0x1489('0xc')][_0x1489('0xd')]?_0x1eb92d[_0x1489('0xc')][_0x1489('0xd')]:_0x1eb92d[_0x1489('0xe')][_0x1489('0xf')]||_0x1eb92d['ip'],_0x1eb92d[_0x1489('0x10')],_0x442888[_0x1489('0x11')],_0x442888[_0x1489('0x12')],_0x1eb92d['user']?_0x1eb92d[_0x1489('0x13')]['id']:null,_0x1eb92d[_0x1489('0x13')]?_0x1eb92d['user'][_0x1489('0x14')]:null,_0x1eb92d[_0x1489('0x13')]?_0x1eb92d['user'][_0x1489('0x15')]:null,_0x1df2ef?util[_0x1489('0x16')](_0x1df2ef,![],null):'');}}));_0xe9580f[_0x1489('0x8')](ewinston['logger']({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x2f961f,_0x428cfc){var _0x924d27=_0x1489('0x17');if(_0x2f961f['body']&&_0x2f961f[_0x1489('0xb')]['device']&&_0x2f961f[_0x1489('0xb')][_0x1489('0x18')]){_0x924d27=_0x1489('0x19');}return util[_0x1489('0x1a')](_0x924d27,_0x2f961f[_0x1489('0x1b')],_0x2f961f['headers'][_0x1489('0xd')]?_0x2f961f['headers'][_0x1489('0xd')]:_0x2f961f[_0x1489('0xe')][_0x1489('0xf')]||_0x2f961f['ip'],_0x2f961f[_0x1489('0x10')],_0x428cfc[_0x1489('0x11')],_0x428cfc[_0x1489('0x12')],_0x2f961f[_0x1489('0x13')]?_0x2f961f[_0x1489('0x13')]['id']:null,_0x2f961f[_0x1489('0x13')]?_0x2f961f[_0x1489('0x13')][_0x1489('0x14')]:null,_0x2f961f['user']?_0x2f961f[_0x1489('0x13')]['role']:null,_0x2f961f[_0x1489('0xb')]&&_0x2f961f[_0x1489('0xb')][_0x1489('0x1c')]?_0x2f961f[_0x1489('0xb')]['device']:_0x1489('0x1d'),_0x2f961f['body']&&_0x2f961f[_0x1489('0xb')]['agent_id']?_0x2f961f[_0x1489('0xb')][_0x1489('0x18')]:'',_0x2f961f[_0x1489('0xb')]&&_0x2f961f[_0x1489('0xb')][_0x1489('0x1e')]?_0x2f961f[_0x1489('0xb')][_0x1489('0x1e')]:'');},'ignoreRoute':function(_0x1f1d97){var _0x17255e=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x17255e[_0x1489('0x1f')](_0x1f1d97['url']);}}));_0xe9580f[_0x1489('0x8')](_0x1489('0x20'),require(_0x1489('0x21')));_0xe9580f['use'](_0x1489('0x22'),require(_0x1489('0x23')));_0xe9580f[_0x1489('0x8')](_0x1489('0x24'),require(_0x1489('0x25')));_0xe9580f[_0x1489('0x8')](_0x1489('0x26'),require(_0x1489('0x27')));_0xe9580f['use'](_0x1489('0x28'),require('./api/voiceMusicOnHold'));_0xe9580f[_0x1489('0x8')]('/api/voice/queues',require(_0x1489('0x29')));_0xe9580f[_0x1489('0x8')](_0x1489('0x2a'),require('./api/voiceRecording'));_0xe9580f[_0x1489('0x8')](_0x1489('0x2b'),require(_0x1489('0x2c')));_0xe9580f[_0x1489('0x8')](_0x1489('0x2d'),require(_0x1489('0x2e')));_0xe9580f[_0x1489('0x8')](_0x1489('0x2f'),require('./api/voiceMailMessage'));_0xe9580f[_0x1489('0x8')](_0x1489('0x30'),require('./api/voiceCallReport'));_0xe9580f[_0x1489('0x8')](_0x1489('0x31'),require(_0x1489('0x32')));_0xe9580f[_0x1489('0x8')](_0x1489('0x33'),require(_0x1489('0x34')));_0xe9580f[_0x1489('0x8')](_0x1489('0x35'),require(_0x1489('0x36')));_0xe9580f[_0x1489('0x8')](_0x1489('0x37'),require(_0x1489('0x38')));_0xe9580f['use'](_0x1489('0x39'),require(_0x1489('0x3a')));_0xe9580f['use']('/api/voice/transfers/reports',require('./api/voiceTransferReport'));_0xe9580f[_0x1489('0x8')](_0x1489('0x3b'),require(_0x1489('0x3c')));_0xe9580f[_0x1489('0x8')]('/api/mail/accounts',require(_0x1489('0x3d')));_0xe9580f[_0x1489('0x8')]('/api/mail/queues',require(_0x1489('0x3e')));_0xe9580f[_0x1489('0x8')](_0x1489('0x3f'),require(_0x1489('0x40')));_0xe9580f[_0x1489('0x8')]('/api/mail/interactions',require(_0x1489('0x41')));_0xe9580f[_0x1489('0x8')](_0x1489('0x42'),require(_0x1489('0x43')));_0xe9580f[_0x1489('0x8')](_0x1489('0x44'),require(_0x1489('0x45')));_0xe9580f[_0x1489('0x8')]('/api/mail/reports/queue',require('./api/mailQueueReport'));_0xe9580f[_0x1489('0x8')](_0x1489('0x46'),require('./api/dashboard'));_0xe9580f[_0x1489('0x8')](_0x1489('0x47'),require('./api/dashboardItem'));_0xe9580f['use'](_0x1489('0x48'),require(_0x1489('0x49')));_0xe9580f[_0x1489('0x8')](_0x1489('0x4a'),require(_0x1489('0x4b')));_0xe9580f[_0x1489('0x8')](_0x1489('0x4c'),require(_0x1489('0x4d')));_0xe9580f['use'](_0x1489('0x4e'),require('./api/faxMessage'));_0xe9580f['use'](_0x1489('0x4f'),require(_0x1489('0x50')));_0xe9580f[_0x1489('0x8')](_0x1489('0x51'),require(_0x1489('0x52')));_0xe9580f['use'](_0x1489('0x53'),require(_0x1489('0x54')));_0xe9580f[_0x1489('0x8')](_0x1489('0x55'),require(_0x1489('0x56')));_0xe9580f['use'](_0x1489('0x57'),require(_0x1489('0x58')));_0xe9580f[_0x1489('0x8')]('/api/sms/messages',require('./api/smsMessage'));_0xe9580f[_0x1489('0x8')](_0x1489('0x59'),require('./api/smsQueue'));_0xe9580f[_0x1489('0x8')](_0x1489('0x5a'),require(_0x1489('0x5b')));_0xe9580f['use'](_0x1489('0x5c'),require(_0x1489('0x5d')));_0xe9580f[_0x1489('0x8')](_0x1489('0x5e'),require('./api/openchannelInteraction'));_0xe9580f[_0x1489('0x8')](_0x1489('0x5f'),require(_0x1489('0x60')));_0xe9580f['use'](_0x1489('0x61'),require('./api/openchannelQueue'));_0xe9580f[_0x1489('0x8')](_0x1489('0x62'),require(_0x1489('0x63')));_0xe9580f[_0x1489('0x8')](_0x1489('0x64'),require(_0x1489('0x65')));_0xe9580f[_0x1489('0x8')](_0x1489('0x66'),require(_0x1489('0x67')));_0xe9580f[_0x1489('0x8')](_0x1489('0x68'),require(_0x1489('0x69')));_0xe9580f[_0x1489('0x8')](_0x1489('0x6a'),require(_0x1489('0x6b')));_0xe9580f[_0x1489('0x8')](_0x1489('0x6c'),require('./api/chatOfflineMessage'));_0xe9580f[_0x1489('0x8')](_0x1489('0x6d'),require('./api/chatQueue'));_0xe9580f['use'](_0x1489('0x6e'),require('./api/chatGroup'));_0xe9580f[_0x1489('0x8')](_0x1489('0x6f'),require(_0x1489('0x70')));_0xe9580f[_0x1489('0x8')](_0x1489('0x71'),require('./api/cmCompany'));_0xe9580f['use']('/api/cm/contacts',require(_0x1489('0x72')));_0xe9580f['use'](_0x1489('0x73'),require('./api/cmHopper'));_0xe9580f[_0x1489('0x8')](_0x1489('0x74'),require(_0x1489('0x75')));_0xe9580f['use'](_0x1489('0x76'),require(_0x1489('0x77')));_0xe9580f['use'](_0x1489('0x78'),require(_0x1489('0x79')));_0xe9580f[_0x1489('0x8')](_0x1489('0x7a'),require('./api/cmCustomField'));_0xe9580f['use']('/api/actions',require(_0x1489('0x7b')));_0xe9580f[_0x1489('0x8')](_0x1489('0x7c'),require(_0x1489('0x7d')));_0xe9580f[_0x1489('0x8')](_0x1489('0x7e'),require(_0x1489('0x7f')));_0xe9580f[_0x1489('0x8')]('/api/dispositions',require(_0x1489('0x80')));_0xe9580f[_0x1489('0x8')](_0x1489('0x81'),require('./api/condition'));_0xe9580f[_0x1489('0x8')](_0x1489('0x82'),require(_0x1489('0x83')));_0xe9580f['use'](_0x1489('0x84'),require(_0x1489('0x85')));_0xe9580f['use'](_0x1489('0x86'),require(_0x1489('0x87')));_0xe9580f[_0x1489('0x8')]('/api/voiceQueuesLog',require(_0x1489('0x88')));_0xe9580f[_0x1489('0x8')](_0x1489('0x89'),require('./api/schedule'));_0xe9580f[_0x1489('0x8')](_0x1489('0x8a'),require(_0x1489('0x8b')));_0xe9580f[_0x1489('0x8')](_0x1489('0x8c'),require('./api/tag'));_0xe9580f[_0x1489('0x8')](_0x1489('0x8d'),require('./api/template'));_0xe9580f[_0x1489('0x8')](_0x1489('0x8e'),require('./api/trigger'));_0xe9580f[_0x1489('0x8')](_0x1489('0x8f'),require(_0x1489('0x90')));_0xe9580f[_0x1489('0x8')]('/api/integrations',require(_0x1489('0x91')));_0xe9580f[_0x1489('0x8')](_0x1489('0x92'),require(_0x1489('0x93')));_0xe9580f[_0x1489('0x8')](_0x1489('0x94'),require('./api/analyticCustomReport'));_0xe9580f[_0x1489('0x8')](_0x1489('0x95'),require('./api/analyticDefaultReport'));_0xe9580f[_0x1489('0x8')](_0x1489('0x96'),require(_0x1489('0x97')));_0xe9580f[_0x1489('0x8')](_0x1489('0x98'),require(_0x1489('0x99')));_0xe9580f[_0x1489('0x8')]('/api/analytics/field_reports',require(_0x1489('0x9a')));_0xe9580f[_0x1489('0x8')](_0x1489('0x9b'),require(_0x1489('0x9c')));_0xe9580f[_0x1489('0x8')](_0x1489('0x9d'),require(_0x1489('0x9e')));_0xe9580f[_0x1489('0x8')](_0x1489('0x9f'),require(_0x1489('0xa0')));_0xe9580f['use']('/api/integrations/salesforce/fields',require('./api/intSalesforceField'));_0xe9580f[_0x1489('0x8')](_0x1489('0xa1'),require(_0x1489('0xa2')));_0xe9580f[_0x1489('0x8')](_0x1489('0xa3'),require('./api/intSugarcrmConfiguration'));_0xe9580f['use'](_0x1489('0xa4'),require(_0x1489('0xa5')));_0xe9580f['use'](_0x1489('0xa6'),require('./api/intDeskAccount'));_0xe9580f[_0x1489('0x8')](_0x1489('0xa7'),require('./api/intDeskConfiguration'));_0xe9580f['use'](_0x1489('0xa8'),require('./api/intDeskField'));_0xe9580f[_0x1489('0x8')](_0x1489('0xa9'),require(_0x1489('0xaa')));_0xe9580f[_0x1489('0x8')](_0x1489('0xab'),require(_0x1489('0xac')));_0xe9580f[_0x1489('0x8')](_0x1489('0xad'),require(_0x1489('0xae')));_0xe9580f[_0x1489('0x8')](_0x1489('0xaf'),require(_0x1489('0xb0')));_0xe9580f[_0x1489('0x8')](_0x1489('0xb1'),require(_0x1489('0xb2')));_0xe9580f[_0x1489('0x8')](_0x1489('0xb3'),require(_0x1489('0xb4')));_0xe9580f[_0x1489('0x8')](_0x1489('0xb5'),require('./api/intFreshdeskAccount'));_0xe9580f[_0x1489('0x8')](_0x1489('0xb6'),require(_0x1489('0xb7')));_0xe9580f[_0x1489('0x8')]('/api/integrations/freshdesk/fields',require(_0x1489('0xb8')));_0xe9580f['use']('/api/integrations/vtiger/accounts',require(_0x1489('0xb9')));_0xe9580f[_0x1489('0x8')](_0x1489('0xba'),require(_0x1489('0xbb')));_0xe9580f[_0x1489('0x8')]('/api/integrations/vtiger/fields',require(_0x1489('0xbc')));_0xe9580f[_0x1489('0x8')]('/api/integrations/servicenow/accounts',require(_0x1489('0xbd')));_0xe9580f[_0x1489('0x8')](_0x1489('0xbe'),require('./api/intServicenowConfiguration'));_0xe9580f[_0x1489('0x8')](_0x1489('0xbf'),require(_0x1489('0xc0')));_0xe9580f['use'](_0x1489('0xc1'),require(_0x1489('0xc2')));_0xe9580f[_0x1489('0x8')]('/api/integrations/dynamics365/configurations',require('./api/intDynamics365Configuration'));_0xe9580f[_0x1489('0x8')](_0x1489('0xc3'),require(_0x1489('0xc4')));_0xe9580f[_0x1489('0x8')](_0x1489('0xc5'),require(_0x1489('0xc6')));_0xe9580f['use'](_0x1489('0xc7'),require(_0x1489('0xc8')));_0xe9580f[_0x1489('0x8')](_0x1489('0xc9'),require(_0x1489('0xca')));_0xe9580f[_0x1489('0x8')]('/api/networks',require(_0x1489('0xcb')));_0xe9580f[_0x1489('0x8')](_0x1489('0xcc'),require(_0x1489('0xcd')));_0xe9580f[_0x1489('0x8')](_0x1489('0xce'),require(_0x1489('0xcf')));_0xe9580f[_0x1489('0x8')](_0x1489('0xd0'),require(_0x1489('0xd1')));_0xe9580f['use']('/api/jscripty/questions/reports',require(_0x1489('0xd2')));_0xe9580f['use'](_0x1489('0xd3'),require(_0x1489('0xd4')));_0xe9580f[_0x1489('0x8')](_0x1489('0xd5'),require(_0x1489('0xd6')));_0xe9580f['use'](_0x1489('0xd7'),require(_0x1489('0xd8')));_0xe9580f[_0x1489('0x8')](_0x1489('0xd9'),require('./api/squareReportDetail'));_0xe9580f[_0x1489('0x8')](_0x1489('0xda'),require(_0x1489('0xdb')));_0xe9580f[_0x1489('0x8')]('/api/settings',require(_0x1489('0xdc')));_0xe9580f[_0x1489('0x8')](_0x1489('0xdd'),require(_0x1489('0xde')));_0xe9580f[_0x1489('0x8')](_0x1489('0xdf'),require(_0x1489('0xe0')));_0xe9580f[_0x1489('0x8')](_0x1489('0xe1'),require('./api/squareRecording'));_0xe9580f[_0x1489('0x8')]('/api/square/messages',require(_0x1489('0xe2')));_0xe9580f[_0x1489('0x8')](_0x1489('0xe3'),require('./api/team'));_0xe9580f[_0x1489('0x8')](_0x1489('0xe4'),require('./api/license'));_0xe9580f[_0x1489('0x8')]('/api/campaigns',require(_0x1489('0xe5')));_0xe9580f[_0x1489('0x8')](_0x1489('0xe6'),require(_0x1489('0xe7')));_0xe9580f[_0x1489('0x8')](_0x1489('0xe8'),require(_0x1489('0xe9')));_0xe9580f[_0x1489('0x8')]('/api/plugins',require('./api/plugin'));_0xe9580f[_0x1489('0x8')]('/api/mail/reports/transfer',require(_0x1489('0xea')));_0xe9580f[_0x1489('0x8')](_0x1489('0xeb'),require(_0x1489('0xec')));_0xe9580f['use'](_0x1489('0xed'),require(_0x1489('0xee')));_0xe9580f[_0x1489('0x8')](_0x1489('0xef'),require(_0x1489('0xf0')));_0xe9580f[_0x1489('0x8')](_0x1489('0xf1'),require(_0x1489('0xf2')));_0xe9580f[_0x1489('0x8')](_0x1489('0xf3'),require('./api/cmList'));_0xe9580f['use']('/api/voice/prefixes',require('./api/voicePrefix'));_0xe9580f[_0x1489('0x8')](_0x1489('0xf4'),require(_0x1489('0xf5')));_0xe9580f['use'](_0x1489('0xf6'),require(_0x1489('0xf7')));_0xe9580f[_0x1489('0x8')](_0x1489('0xf8'),require('./api/userProfileResource'));_0xe9580f[_0x1489('0x8')](_0x1489('0xf9'),require(_0x1489('0xfa')));_0xe9580f[_0x1489('0x8')](_0x1489('0xfb'),require(_0x1489('0xfc')));_0xe9580f[_0x1489('0x8')]('/api/whatsapp/applications',require('./api/whatsappApplication'));_0xe9580f['use'](_0x1489('0xfd'),require(_0x1489('0xfe')));_0xe9580f[_0x1489('0x8')](_0x1489('0xff'),require(_0x1489('0x100')));_0xe9580f['use']('/api/whatsapp/reports/queue',require(_0x1489('0x101')));_0xe9580f[_0x1489('0x8')](_0x1489('0x102'),require(_0x1489('0x103')));_0xe9580f[_0x1489('0x8')](_0x1489('0x104'),require(_0x1489('0x105')));_0xe9580f['use'](_0x1489('0x106'),require(_0x1489('0x107')));_0xe9580f[_0x1489('0x8')](_0x1489('0x108'),require(_0x1489('0x109')));_0xe9580f[_0x1489('0x8')]('/api/auth/local',require(_0x1489('0x10a')));_0xe9580f[_0x1489('0x8')](_0x1489('0x10b'),require('./api/authGoogle'));_0xe9580f['use'](_0x1489('0x10c'),require(_0x1489('0x10d')));_0xe9580f[_0x1489('0x8')]('/api/rpc',require(_0x1489('0x10e')));_0xe9580f[_0x1489('0x8')](_0x1489('0x10f'),require(_0x1489('0x110')));_0xe9580f['use'](_0x1489('0x111'),require(_0x1489('0x112')));_0xe9580f['use']('/api/pm2',require(_0x1489('0x113')));_0xe9580f['use'](_0x1489('0x114'),require(_0x1489('0x115')));_0xe9580f[_0x1489('0x8')](_0x1489('0x116'),express[_0x1489('0x117')](path[_0x1489('0x118')](config['root'],_0x1489('0x116'))));_0xe9580f[_0x1489('0x8')](_0x1489('0x119'),express[_0x1489('0x117')](path[_0x1489('0x118')](config[_0x1489('0x11a')],_0x1489('0x119'))));_0xe9580f[_0x1489('0x8')](_0x1489('0x11b'),express[_0x1489('0x117')](path[_0x1489('0x118')](config[_0x1489('0x11a')],_0x1489('0x11b'))));_0xe9580f[_0x1489('0x8')]('/snippet',express[_0x1489('0x117')](path[_0x1489('0x118')](config['root'],_0x1489('0x11c'),_0x1489('0x11d'))));_0xe9580f[_0x1489('0x8')](_0x1489('0x11e'),express[_0x1489('0x117')](path[_0x1489('0x118')](config['root'],_0x1489('0x11f'))));_0xe9580f[_0x1489('0x120')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0x1489('0x121')](errors[0x194]);_0xe9580f[_0x1489('0x120')]('/*')[_0x1489('0x121')](function(_0x54e3c3,_0x498e01){_0x498e01[_0x1489('0x122')](path[_0x1489('0x123')](_0xe9580f[_0x1489('0x121')](_0x1489('0x124'))+'/index.html'));});};var sensitiveFields=[_0x1489('0x125'),_0x1489('0x126'),_0x1489('0x127'),'apiKey',_0x1489('0x128'),_0x1489('0x129'),_0x1489('0x12a'),'phone',_0x1489('0x12b'),_0x1489('0x12c'),_0x1489('0x12d'),'clientId',_0x1489('0x12e'),'securityToken',_0x1489('0x12f'),_0x1489('0x130'),_0x1489('0x131'),_0x1489('0x132'),_0x1489('0x133'),_0x1489('0x134'),_0x1489('0x135'),_0x1489('0x136'),_0x1489('0x137'),_0x1489('0x138'),_0x1489('0x139'),_0x1489('0x13a'),'calleridnum',_0x1489('0x13b'),_0x1489('0x13c'),_0x1489('0x13d'),_0x1489('0x13e'),'accesskeyid',_0x1489('0x13f'),_0x1489('0x140'),_0x1489('0x13'),_0x1489('0x141'),_0x1489('0x142'),'localstationid',_0x1489('0x143'),'secret','registry','oldPassword'];function maskSensitiveData(_0x5ca407){var _0x2b1774=/(?!^)[\s\S](?!$)/g;if(!_[_0x1489('0x144')](_0x5ca407))return;for(var _0x4c4507 in _0x5ca407){if(_[_0x1489('0x145')](_0x5ca407[_0x4c4507])){for(var _0x335736=0x0;_0x335736<_0x5ca407[_0x4c4507][_0x1489('0x146')];_0x335736++){maskSensitiveData(_0x5ca407[_0x4c4507][_0x335736]);}}else if(_[_0x1489('0x144')](_0x5ca407[_0x4c4507])){maskSensitiveData(_0x5ca407[_0x4c4507]);}else if(_[_0x1489('0x147')](_0x5ca407[_0x4c4507])){_0x5ca407[_0x4c4507]=_0x5ca407[_0x4c4507][_0x1489('0x148')](/{{{/g,_0x1489('0x149'))[_0x1489('0x148')](/}}}/g,_0x1489('0x14a'))[_0x1489('0x148')](/{{/g,'@{')[_0x1489('0x148')](/}}/g,'}@');if(_[_0x1489('0x14b')](sensitiveFields,_0x4c4507)){_0x5ca407[_0x4c4507]=_0x5ca407[_0x4c4507][_0x1489('0x148')](_0x2b1774,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 9b48000..955e8a8 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcfbd=['lodash','../config/environment','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','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxQueue/faxQueue.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.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/intDeskAccount/intDeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','server','http','rpc','port','localhost','error','listen','log','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird'];(function(_0x423970,_0x55e2e7){var _0x519005=function(_0x2ad723){while(--_0x2ad723){_0x423970['push'](_0x423970['shift']());}};_0x519005(++_0x55e2e7);}(_0xcfbd,0x166));var _0xdcfb=function(_0x1735e7,_0x13db4c){_0x1735e7=_0x1735e7-0x0;var _0x34e924=_0xcfbd[_0x1735e7];return _0x34e924;};'use strict';var jayson=require(_0xdcfb('0x0'));var BPromise=require(_0xdcfb('0x1'));var _=require(_0xdcfb('0x2'));var config=require(_0xdcfb('0x3'));exports['listen']=function(){return new BPromise(function(_0x4200ee,_0x441a08){var _0x1a15dd={};_0x1a15dd=_[_0xdcfb('0x4')](_0x1a15dd,require('../api/user/user.rpc'));_0x1a15dd=_['merge'](_0x1a15dd,require(_0xdcfb('0x5')));_0x1a15dd=_['merge'](_0x1a15dd,require(_0xdcfb('0x6')));_0x1a15dd=_[_0xdcfb('0x4')](_0x1a15dd,require(_0xdcfb('0x7')));_0x1a15dd=_[_0xdcfb('0x4')](_0x1a15dd,require(_0xdcfb('0x8')));_0x1a15dd=_[_0xdcfb('0x4')](_0x1a15dd,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x1a15dd=_[_0xdcfb('0x4')](_0x1a15dd,require(_0xdcfb('0x9')));_0x1a15dd=_[_0xdcfb('0x4')](_0x1a15dd,require(_0xdcfb('0xa')));_0x1a15dd=_[_0xdcfb('0x4')](_0x1a15dd,require(_0xdcfb('0xb')));_0x1a15dd=_['merge'](_0x1a15dd,require(_0xdcfb('0xc')));_0x1a15dd=_[_0xdcfb('0x4')](_0x1a15dd,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x1a15dd=_[_0xdcfb('0x4')](_0x1a15dd,require(_0xdcfb('0xd')));_0x1a15dd=_[_0xdcfb('0x4')](_0x1a15dd,require(_0xdcfb('0xe')));_0x1a15dd=_[_0xdcfb('0x4')](_0x1a15dd,require('../api/mailAccount/mailAccount.rpc'));_0x1a15dd=_['merge'](_0x1a15dd,require('../api/mailQueue/mailQueue.rpc'));_0x1a15dd=_['merge'](_0x1a15dd,require(_0xdcfb('0xf')));_0x1a15dd=_[_0xdcfb('0x4')](_0x1a15dd,require(_0xdcfb('0x10')));_0x1a15dd=_[_0xdcfb('0x4')](_0x1a15dd,require('../api/mailApplication/mailApplication.rpc'));_0x1a15dd=_['merge'](_0x1a15dd,require(_0xdcfb('0x11')));_0x1a15dd=_[_0xdcfb('0x4')](_0x1a15dd,require(_0xdcfb('0x12')));_0x1a15dd=_[_0xdcfb('0x4')](_0x1a15dd,require(_0xdcfb('0x13')));_0x1a15dd=_[_0xdcfb('0x4')](_0x1a15dd,require('../api/faxInteraction/faxInteraction.rpc'));_0x1a15dd=_[_0xdcfb('0x4')](_0x1a15dd,require('../api/faxMessage/faxMessage.rpc'));_0x1a15dd=_[_0xdcfb('0x4')](_0x1a15dd,require(_0xdcfb('0x14')));_0x1a15dd=_[_0xdcfb('0x4')](_0x1a15dd,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x1a15dd=_[_0xdcfb('0x4')](_0x1a15dd,require(_0xdcfb('0x15')));_0x1a15dd=_[_0xdcfb('0x4')](_0x1a15dd,require(_0xdcfb('0x16')));_0x1a15dd=_[_0xdcfb('0x4')](_0x1a15dd,require(_0xdcfb('0x17')));_0x1a15dd=_[_0xdcfb('0x4')](_0x1a15dd,require(_0xdcfb('0x18')));_0x1a15dd=_['merge'](_0x1a15dd,require(_0xdcfb('0x19')));_0x1a15dd=_['merge'](_0x1a15dd,require(_0xdcfb('0x1a')));_0x1a15dd=_[_0xdcfb('0x4')](_0x1a15dd,require(_0xdcfb('0x1b')));_0x1a15dd=_[_0xdcfb('0x4')](_0x1a15dd,require(_0xdcfb('0x1c')));_0x1a15dd=_[_0xdcfb('0x4')](_0x1a15dd,require(_0xdcfb('0x1d')));_0x1a15dd=_[_0xdcfb('0x4')](_0x1a15dd,require(_0xdcfb('0x1e')));_0x1a15dd=_[_0xdcfb('0x4')](_0x1a15dd,require(_0xdcfb('0x1f')));_0x1a15dd=_[_0xdcfb('0x4')](_0x1a15dd,require('../api/chatQueue/chatQueue.rpc'));_0x1a15dd=_['merge'](_0x1a15dd,require(_0xdcfb('0x20')));_0x1a15dd=_[_0xdcfb('0x4')](_0x1a15dd,require(_0xdcfb('0x21')));_0x1a15dd=_[_0xdcfb('0x4')](_0x1a15dd,require(_0xdcfb('0x22')));_0x1a15dd=_[_0xdcfb('0x4')](_0x1a15dd,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x1a15dd=_['merge'](_0x1a15dd,require(_0xdcfb('0x23')));_0x1a15dd=_[_0xdcfb('0x4')](_0x1a15dd,require(_0xdcfb('0x24')));_0x1a15dd=_[_0xdcfb('0x4')](_0x1a15dd,require(_0xdcfb('0x25')));_0x1a15dd=_[_0xdcfb('0x4')](_0x1a15dd,require(_0xdcfb('0x26')));_0x1a15dd=_[_0xdcfb('0x4')](_0x1a15dd,require(_0xdcfb('0x27')));_0x1a15dd=_[_0xdcfb('0x4')](_0x1a15dd,require(_0xdcfb('0x28')));_0x1a15dd=_['merge'](_0x1a15dd,require(_0xdcfb('0x29')));_0x1a15dd=_[_0xdcfb('0x4')](_0x1a15dd,require(_0xdcfb('0x2a')));_0x1a15dd=_[_0xdcfb('0x4')](_0x1a15dd,require(_0xdcfb('0x2b')));_0x1a15dd=_['merge'](_0x1a15dd,require(_0xdcfb('0x2c')));_0x1a15dd=_[_0xdcfb('0x4')](_0x1a15dd,require(_0xdcfb('0x2d')));_0x1a15dd=_[_0xdcfb('0x4')](_0x1a15dd,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x1a15dd=_[_0xdcfb('0x4')](_0x1a15dd,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x1a15dd=_[_0xdcfb('0x4')](_0x1a15dd,require(_0xdcfb('0x2e')));_0x1a15dd=_['merge'](_0x1a15dd,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x1a15dd=_[_0xdcfb('0x4')](_0x1a15dd,require(_0xdcfb('0x2f')));_0x1a15dd=_[_0xdcfb('0x4')](_0x1a15dd,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x1a15dd=_[_0xdcfb('0x4')](_0x1a15dd,require(_0xdcfb('0x30')));_0x1a15dd=_[_0xdcfb('0x4')](_0x1a15dd,require(_0xdcfb('0x31')));_0x1a15dd=_[_0xdcfb('0x4')](_0x1a15dd,require(_0xdcfb('0x32')));_0x1a15dd=_[_0xdcfb('0x4')](_0x1a15dd,require(_0xdcfb('0x33')));_0x1a15dd=_[_0xdcfb('0x4')](_0x1a15dd,require(_0xdcfb('0x34')));_0x1a15dd=_[_0xdcfb('0x4')](_0x1a15dd,require('../api/setting/setting.rpc'));_0x1a15dd=_[_0xdcfb('0x4')](_0x1a15dd,require(_0xdcfb('0x35')));_0x1a15dd=_[_0xdcfb('0x4')](_0x1a15dd,require('../api/squareProject/squareProject.rpc'));_0x1a15dd=_['merge'](_0x1a15dd,require('../api/squareRecording/squareRecording.rpc'));_0x1a15dd=_[_0xdcfb('0x4')](_0x1a15dd,require(_0xdcfb('0x36')));_0x1a15dd=_[_0xdcfb('0x4')](_0x1a15dd,require(_0xdcfb('0x37')));_0x1a15dd=_[_0xdcfb('0x4')](_0x1a15dd,require(_0xdcfb('0x38')));_0x1a15dd=_[_0xdcfb('0x4')](_0x1a15dd,require('../api/plugin/plugin.rpc'));_0x1a15dd=_[_0xdcfb('0x4')](_0x1a15dd,require(_0xdcfb('0x39')));_0x1a15dd=_[_0xdcfb('0x4')](_0x1a15dd,require(_0xdcfb('0x3a')));_0x1a15dd=_[_0xdcfb('0x4')](_0x1a15dd,require(_0xdcfb('0x3b')));_0x1a15dd=_[_0xdcfb('0x4')](_0x1a15dd,require(_0xdcfb('0x3c')));_0x1a15dd=_[_0xdcfb('0x4')](_0x1a15dd,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x14e5bd=jayson[_0xdcfb('0x3d')](_0x1a15dd)[_0xdcfb('0x3e')]();var _0x5e3658=config[_0xdcfb('0x3f')]['port']||config[_0xdcfb('0x40')]+0x1;var _0x3eac96=config[_0xdcfb('0x3f')]['ip']||_0xdcfb('0x41');_0x14e5bd['on'](_0xdcfb('0x42'),function(_0xcd1e9c){return _0x441a08(_0xcd1e9c);});_0x14e5bd[_0xdcfb('0x43')](_0x5e3658,_0x3eac96,function(){console[_0xdcfb('0x44')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x3eac96,_0x5e3658);require(_0xdcfb('0x45'))[_0xdcfb('0x46')]();return _0x4200ee(_0xdcfb('0x47')+_0x3eac96+':'+_0x5e3658);});});}; \ No newline at end of file +var _0x9a8a=['../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x9a8a,0x143));var _0xa9a8=function(_0x2df3da,_0xa60cd2){_0x2df3da=_0x2df3da-0x0;var _0x5375d9=_0x9a8a[_0x2df3da];return _0x5375d9;};'use strict';var jayson=require(_0xa9a8('0x0'));var BPromise=require('bluebird');var _=require(_0xa9a8('0x1'));var config=require(_0xa9a8('0x2'));exports['listen']=function(){return new BPromise(function(_0x144b52,_0x39eaea){var _0x24ac23={};_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require('../api/user/user.rpc'));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x4')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require('../api/voiceQueue/voiceQueue.rpc'));_0x24ac23=_['merge'](_0x24ac23,require(_0xa9a8('0x5')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x6')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x7')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x8')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x9')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require('../api/trunk/trunk.rpc'));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0xa')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0xb')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0xc')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0xd')));_0x24ac23=_['merge'](_0x24ac23,require(_0xa9a8('0xe')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0xf')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x10')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x11')));_0x24ac23=_['merge'](_0x24ac23,require(_0xa9a8('0x12')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require('../api/faxAccount/faxAccount.rpc'));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x13')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x14')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x15')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x16')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x17')));_0x24ac23=_['merge'](_0x24ac23,require(_0xa9a8('0x18')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x19')));_0x24ac23=_['merge'](_0x24ac23,require(_0xa9a8('0x1a')));_0x24ac23=_['merge'](_0x24ac23,require(_0xa9a8('0x1b')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x24ac23=_['merge'](_0x24ac23,require(_0xa9a8('0x1c')));_0x24ac23=_['merge'](_0x24ac23,require(_0xa9a8('0x1d')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x1e')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x1f')));_0x24ac23=_['merge'](_0x24ac23,require(_0xa9a8('0x20')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require('../api/chatMessage/chatMessage.rpc'));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x21')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require('../api/cmContact/cmContact.rpc'));_0x24ac23=_['merge'](_0x24ac23,require(_0xa9a8('0x22')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x23')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x24')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x25')));_0x24ac23=_['merge'](_0x24ac23,require(_0xa9a8('0x26')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x27')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x28')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require('../api/sound/sound.rpc'));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x29')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require('../api/trigger/trigger.rpc'));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x2a')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x2b')));_0x24ac23=_['merge'](_0x24ac23,require(_0xa9a8('0x2c')));_0x24ac23=_['merge'](_0x24ac23,require(_0xa9a8('0x2d')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x2e')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x2f')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x30')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x31')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x32')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x33')));_0x24ac23=_['merge'](_0x24ac23,require(_0xa9a8('0x34')));_0x24ac23=_['merge'](_0x24ac23,require(_0xa9a8('0x35')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x36')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x37')));_0x24ac23=_['merge'](_0x24ac23,require(_0xa9a8('0x38')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x39')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x3a')));_0x24ac23=_['merge'](_0x24ac23,require(_0xa9a8('0x3b')));_0x24ac23=_['merge'](_0x24ac23,require('../api/squareRecording/squareRecording.rpc'));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x3c')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x3d')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require('../api/attachment/attachment.rpc'));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require('../api/plugin/plugin.rpc'));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x3e')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x3f')));_0x24ac23=_[_0xa9a8('0x3')](_0x24ac23,require(_0xa9a8('0x40')));var _0x16b18c=jayson[_0xa9a8('0x41')](_0x24ac23)[_0xa9a8('0x42')]();var _0x1c2dbc=config[_0xa9a8('0x43')][_0xa9a8('0x44')]||config['port']+0x1;var _0x5b3da8=config[_0xa9a8('0x43')]['ip']||_0xa9a8('0x45');_0x16b18c['on'](_0xa9a8('0x46'),function(_0x5bedd9){return _0x39eaea(_0x5bedd9);});_0x16b18c['listen'](_0x1c2dbc,_0x5b3da8,function(){console[_0xa9a8('0x47')](_0xa9a8('0x48'),_0x5b3da8,_0x1c2dbc);require('../config/triggers')[_0xa9a8('0x49')]();return _0x144b52(_0xa9a8('0x4a')+_0x5b3da8+':'+_0x1c2dbc);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 1ac7582..fb2b975 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 _0x62fd=['SAY\x20DIGITS\x20%s\x20%s','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setPriority','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','wait','exec','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','exports','util','events','./reply','call','setEncoding','utf8','setTimeout','headers','emit','ready','toLowerCase','hangup','substring','search','no\x20code','indexOf','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','function','write','prototype','sendRequest','command','sync','answer','ANSWER','getData','beep','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','isArray','EXEC\x20%s\x20%s','join','format','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','replace','sayNumber','sayDigits'];(function(_0x43eca2,_0x56100a){var _0x68c937=function(_0x2de519){while(--_0x2de519){_0x43eca2['push'](_0x43eca2['shift']());}};_0x68c937(++_0x56100a);}(_0x62fd,0x14b));var _0xd62f=function(_0x20664e,_0x592097){_0x20664e=_0x20664e-0x0;var _0x23b9e7=_0x62fd[_0x20664e];return _0x23b9e7;};'use strict';var util=require(_0xd62f('0x0'));var _=require('lodash');var EventEmitter=require(_0xd62f('0x1'))['EventEmitter'];var AGIReply=require(_0xd62f('0x2'));var AGIError=require('./error');function AGIChannel(_0x26b931){var _0x2bbef7=this,_0x1dd074=new AGIReply(),_0x32eae7=![],_0x58dbb2={};EventEmitter[_0xd62f('0x3')](_0x2bbef7);_0x26b931[_0xd62f('0x4')](_0xd62f('0x5'));_0x26b931[_0xd62f('0x6')](0x8*0x3c*0x3c*0x3e8);_0x1dd074[_0xd62f('0x4')](_0xd62f('0x5'));_0x1dd074['on'](_0xd62f('0x7'),function(_0x1109be){for(var _0x35263d in _0x1109be){_0x2bbef7[_0x35263d]=_0x1109be[_0x35263d];}_0x2bbef7[_0xd62f('0x8')](_0xd62f('0x9'));});_0x1dd074['on']('line',function(_0x496bb7){if(_0x496bb7[_0xd62f('0xa')]()==_0xd62f('0xb')){_0x2bbef7['emit'](_0xd62f('0xb'));return;}if(_0x496bb7[_0xd62f('0xc')](0x0,0xb)=='520-Invalid'){_0x32eae7=!![];}if(_0x32eae7){_0x58dbb2['rx']+=_0x496bb7+'\x0a';if(_0x496bb7[_0xd62f('0xd')]('520\x20End\x20of\x20proper')!=-0x1){_0x32eae7=![];}}else{_0x58dbb2['rx']=_0x496bb7;}if(_0x32eae7){return;}if(typeof _0x58dbb2['cb']=='function'){var _0x466c89=_0x58dbb2['rx'][_0xd62f('0xc')](0x0,0x3),_0x10ec26=null,_0x4d69c3=null;_0x466c89=parseInt(_0x466c89);if(isNaN(_0x466c89)){_0x58dbb2['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xd62f('0xe')});return;}if(_0x466c89!=0xc8){_0x58dbb2['cb'](null,{'code':_0x466c89,'result':-0x1,'extra':'KO'});return;}_0x10ec26=_0x58dbb2['rx'][_0xd62f('0xc')](0x4)['replace']('result=','');if(_0x10ec26['indexOf']('\x20')!=-0x1){_0x10ec26=_0x10ec26['substr'](0x0,_0x10ec26[_0xd62f('0xf')]('\x20'));}if(_[_0xd62f('0x10')](_0x10ec26,'-1')){_0x10ec26=parseInt(_0x10ec26);}_0x4d69c3=_0x58dbb2['rx'][_0xd62f('0x11')]('\x20');if(_0x4d69c3['length']==0x3){_0x4d69c3=_0x4d69c3[0x2][_0xd62f('0xc')](0x1,_0x4d69c3[0x2][_0xd62f('0x12')]-0x1);}else if(_0x4d69c3[_0xd62f('0x12')]>0x3){var _0x25ce2c=/\((.+)\)/;var _0x44330b=_0x58dbb2['rx'][_0xd62f('0x13')](_0x25ce2c);if(_0x44330b){_0x4d69c3=_0x44330b[0x1];}else{_0x4d69c3=null;}}else{_0x4d69c3=null;}_0x58dbb2['cb'](null,{'code':_0x466c89,'result':_0x10ec26,'extra':_0x4d69c3});}});_0x26b931['on'](_0xd62f('0x14'),function(_0x435893){_0x2bbef7['emit']('error',new AGIError(_0xd62f('0x15'),_0x435893[_0xd62f('0x16')]));});_0x26b931['on'](_0xd62f('0x17'),function(){_0x2bbef7[_0xd62f('0x8')](_0xd62f('0x17'),new AGIError(_0xd62f('0x18')));});_0x26b931['on']('timeout',function(){_0x2bbef7[_0xd62f('0x8')](_0xd62f('0x19'),new AGIError(_0xd62f('0x1a')));_0x26b931[_0xd62f('0x1b')]();});_0x26b931[_0xd62f('0x1c')](_0x1dd074);this['command']=function(_0x154d5b,_0x355770){var _0x154d5b=_0x154d5b||'',_0x355770=typeof _0x355770==_0xd62f('0x1d')?_0x355770:new Function();_0x58dbb2={'tx':_0x154d5b,'rx':'','cb':_0x355770};_0x26b931[_0xd62f('0x1e')](_0x154d5b+'\x0a');},this[_0xd62f('0x17')]=function(){_0x26b931[_0xd62f('0x1b')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0xd62f('0x1f')][_0xd62f('0x20')]=function(_0x633068){return this[_0xd62f('0x21')][_0xd62f('0x22')](this,_0x633068);};AGIChannel[_0xd62f('0x1f')][_0xd62f('0x23')]=function(){return this['sendRequest'](_0xd62f('0x24'));};AGIChannel[_0xd62f('0x1f')][_0xd62f('0x25')]=function(_0x4c1a40,_0x4ab0ba,_0x1ab757){_0x4c1a40=_0x4c1a40===undefined?_0xd62f('0x26'):_0x4c1a40;_0x4ab0ba=_0x4ab0ba===undefined?'5':_0x4ab0ba;_0x1ab757=_0x1ab757===undefined?'1':_0x1ab757;return this['sendRequest'](util['format']('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x4c1a40,_0x4ab0ba*0x3e8,_0x1ab757));};AGIChannel[_0xd62f('0x1f')][_0xd62f('0x27')]=function(_0x35742c){_0x35742c=_0x35742c||_0xd62f('0x28');return this['sendRequest'](util['format'](_0xd62f('0x29'),_0x35742c));};AGIChannel[_0xd62f('0x1f')]['exec']=function(_0x27ab80,_0x2da7e2){if(_[_0xd62f('0x2a')](_0x2da7e2)){return this['sendRequest'](util['format'](_0xd62f('0x2b'),_0x27ab80,_0x2da7e2[_0xd62f('0x2c')](',')));}return this[_0xd62f('0x20')](util[_0xd62f('0x2d')]('EXEC\x20%s\x20%s',_0x27ab80,_0x2da7e2));};AGIChannel[_0xd62f('0x1f')][_0xd62f('0x2e')]=function(_0x4ff60f){return this[_0xd62f('0x20')](util['format'](_0xd62f('0x2f'),_0x4ff60f));};AGIChannel['prototype'][_0xd62f('0x30')]=function(_0x564f94){return this['sendRequest'](util[_0xd62f('0x2d')](_0xd62f('0x31'),_0x564f94));};AGIChannel[_0xd62f('0x1f')]['setPriority']=function(_0x502145){return this[_0xd62f('0x20')](util[_0xd62f('0x2d')](_0xd62f('0x32'),_0x502145));};AGIChannel['prototype']['hangup']=function(){return this[_0xd62f('0x20')](_0xd62f('0x33'));};AGIChannel['prototype'][_0xd62f('0x34')]=function(_0x5dc0ab,_0x5c65a0){var _0x1d0564=_['isBoolean'](_0x5c65a0)||_[_0xd62f('0x35')](_0x5c65a0)?_0x5c65a0[_0xd62f('0x36')]():_0x5c65a0;return this[_0xd62f('0x20')](util['format'](_0xd62f('0x37'),_0x5dc0ab,_0x1d0564?_0x1d0564[_0xd62f('0x36')]()[_0xd62f('0x38')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xd62f('0x1f')][_0xd62f('0x39')]=function(_0xaf4ded,_0x2f1472){return this[_0xd62f('0x20')](util[_0xd62f('0x2d')]('SAY\x20NUMBER\x20%s\x20%s',_0xaf4ded,_0x2f1472));};AGIChannel[_0xd62f('0x1f')][_0xd62f('0x3a')]=function(_0x2bbf6c,_0x41efcc){return this['sendRequest'](util['format'](_0xd62f('0x3b'),_0x2bbf6c,_0x41efcc));};AGIChannel[_0xd62f('0x1f')]['sayPhonetic']=function(_0x3fc98c,_0x416871){return this[_0xd62f('0x20')](util['format'](_0xd62f('0x3c'),_0x3fc98c,_0x416871));};AGIChannel[_0xd62f('0x1f')][_0xd62f('0x3d')]=function(_0x597000,_0x26574d,_0x3f35d1){_0x26574d=_0x26574d||this[_0xd62f('0x3e')];_0x3f35d1=_0x3f35d1||0x1;this[_0xd62f('0x2e')](_0x597000);this[_0xd62f('0x30')](_0x26574d);this[_0xd62f('0x3f')](_0x3f35d1);return this['noop'](util['format'](_0xd62f('0x40'),_0x597000,_0x26574d,_0x3f35d1));};AGIChannel[_0xd62f('0x1f')][_0xd62f('0x41')]=function(_0x4c9329){return this['sendRequest'](util[_0xd62f('0x2d')](_0xd62f('0x42'),_0x4c9329));};AGIChannel['prototype'][_0xd62f('0x43')]=function(_0x3dce1e,_0x37e33d,_0x28a2f7,_0x4a558d,_0xbb2663,_0x4342b3){_0x37e33d=_0x37e33d||'wav';_0x28a2f7=_0x28a2f7||'';_0x4a558d=_0x4a558d===undefined?-0x1:_0x4a558d==='-1'?-0x1:_0x4a558d*0x3e8;_0xbb2663=_0xbb2663===undefined?'':'s='+_0xbb2663;_0x4342b3=_0x4342b3?_0xd62f('0x44'):'';return this[_0xd62f('0x20')](util[_0xd62f('0x2d')](_0xd62f('0x45'),_0x3dce1e,_0x37e33d,_0x28a2f7,_0x4a558d,_0x4342b3,_0xbb2663));};AGIChannel[_0xd62f('0x1f')][_0xd62f('0x46')]=function(_0x397b9a,_0x5e5c81){_0x5e5c81=_0x5e5c81||'';return this[_0xd62f('0x20')](util[_0xd62f('0x2d')](_0xd62f('0x47'),_0x397b9a,_0x5e5c81));};AGIChannel[_0xd62f('0x1f')][_0xd62f('0x48')]=function(_0x3468e3){return this['exec']('AGI',_0x3468e3);};AGIChannel[_0xd62f('0x1f')][_0xd62f('0x49')]=function(_0x3f0902){return this[_0xd62f('0x4a')](_0xd62f('0x4b'),_0x3f0902);};AGIChannel['prototype'][_0xd62f('0x14')]=function(_0x154f4f,_0x371973){this[_0xd62f('0x27')](util[_0xd62f('0x2d')](_0xd62f('0x4c'),_0x154f4f['id'],_0x154f4f['label'],_0x371973));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xd62f('0x4d')]=AGIChannel; \ No newline at end of file +var _0x9a6e=['EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','EventEmitter','./reply','./error','call','utf8','headers','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','replace','indexOf','startsWith','split','length','match','E_AGI_SOCKET_ERROR','code','E_AGI_SOCKET_CLOSE','timeout','destroy','pipe','command','write','close','inherits','prototype','sendRequest','sync','answer','ANSWER','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','VERBOSE\x20\x22%s\x22','exec','isArray'];(function(_0x48741f,_0x3895d7){var _0x2805b0=function(_0x133b16){while(--_0x133b16){_0x48741f['push'](_0x48741f['shift']());}};_0x2805b0(++_0x3895d7);}(_0x9a6e,0xc1));var _0xe9a6=function(_0x48910d,_0xe8d0e1){_0x48910d=_0x48910d-0x0;var _0x1b4c22=_0x9a6e[_0x48910d];return _0x1b4c22;};'use strict';var util=require(_0xe9a6('0x0'));var _=require(_0xe9a6('0x1'));var EventEmitter=require('events')[_0xe9a6('0x2')];var AGIReply=require(_0xe9a6('0x3'));var AGIError=require(_0xe9a6('0x4'));function AGIChannel(_0x219397){var _0xc06690=this,_0x9febd8=new AGIReply(),_0x5292c9=![],_0x3e860c={};EventEmitter[_0xe9a6('0x5')](_0xc06690);_0x219397['setEncoding']('utf8');_0x219397['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x9febd8['setEncoding'](_0xe9a6('0x6'));_0x9febd8['on'](_0xe9a6('0x7'),function(_0xc6145f){for(var _0x1a0b47 in _0xc6145f){_0xc06690[_0x1a0b47]=_0xc6145f[_0x1a0b47];}_0xc06690[_0xe9a6('0x8')](_0xe9a6('0x9'));});_0x9febd8['on'](_0xe9a6('0xa'),function(_0x357108){if(_0x357108[_0xe9a6('0xb')]()==_0xe9a6('0xc')){_0xc06690['emit']('hangup');return;}if(_0x357108[_0xe9a6('0xd')](0x0,0xb)==_0xe9a6('0xe')){_0x5292c9=!![];}if(_0x5292c9){_0x3e860c['rx']+=_0x357108+'\x0a';if(_0x357108[_0xe9a6('0xf')](_0xe9a6('0x10'))!=-0x1){_0x5292c9=![];}}else{_0x3e860c['rx']=_0x357108;}if(_0x5292c9){return;}if(typeof _0x3e860c['cb']==_0xe9a6('0x11')){var _0x19e272=_0x3e860c['rx']['substring'](0x0,0x3),_0x2ac6ad=null,_0x57fb36=null;_0x19e272=parseInt(_0x19e272);if(isNaN(_0x19e272)){_0x3e860c['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xe9a6('0x12')});return;}if(_0x19e272!=0xc8){_0x3e860c['cb'](null,{'code':_0x19e272,'result':-0x1,'extra':'KO'});return;}_0x2ac6ad=_0x3e860c['rx'][_0xe9a6('0xd')](0x4)[_0xe9a6('0x13')]('result=','');if(_0x2ac6ad[_0xe9a6('0x14')]('\x20')!=-0x1){_0x2ac6ad=_0x2ac6ad['substr'](0x0,_0x2ac6ad[_0xe9a6('0x14')]('\x20'));}if(_[_0xe9a6('0x15')](_0x2ac6ad,'-1')){_0x2ac6ad=parseInt(_0x2ac6ad);}_0x57fb36=_0x3e860c['rx'][_0xe9a6('0x16')]('\x20');if(_0x57fb36['length']==0x3){_0x57fb36=_0x57fb36[0x2]['substring'](0x1,_0x57fb36[0x2]['length']-0x1);}else if(_0x57fb36[_0xe9a6('0x17')]>0x3){var _0x368276=/\((.+)\)/;var _0x1a11a3=_0x3e860c['rx'][_0xe9a6('0x18')](_0x368276);if(_0x1a11a3){_0x57fb36=_0x1a11a3[0x1];}else{_0x57fb36=null;}}else{_0x57fb36=null;}_0x3e860c['cb'](null,{'code':_0x19e272,'result':_0x2ac6ad,'extra':_0x57fb36});}});_0x219397['on']('error',function(_0x324f8f){_0xc06690[_0xe9a6('0x8')]('error',new AGIError(_0xe9a6('0x19'),_0x324f8f[_0xe9a6('0x1a')]));});_0x219397['on']('close',function(){_0xc06690[_0xe9a6('0x8')]('close',new AGIError(_0xe9a6('0x1b')));});_0x219397['on'](_0xe9a6('0x1c'),function(){_0xc06690[_0xe9a6('0x8')](_0xe9a6('0x1c'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x219397[_0xe9a6('0x1d')]();});_0x219397[_0xe9a6('0x1e')](_0x9febd8);this[_0xe9a6('0x1f')]=function(_0x54c068,_0x3f0ebf){var _0x54c068=_0x54c068||'',_0x3f0ebf=typeof _0x3f0ebf==_0xe9a6('0x11')?_0x3f0ebf:new Function();_0x3e860c={'tx':_0x54c068,'rx':'','cb':_0x3f0ebf};_0x219397[_0xe9a6('0x20')](_0x54c068+'\x0a');},this[_0xe9a6('0x21')]=function(){_0x219397[_0xe9a6('0x1d')]();};}util[_0xe9a6('0x22')](AGIChannel,EventEmitter);AGIChannel[_0xe9a6('0x23')][_0xe9a6('0x24')]=function(_0x36713f){return this['command'][_0xe9a6('0x25')](this,_0x36713f);};AGIChannel['prototype'][_0xe9a6('0x26')]=function(){return this[_0xe9a6('0x24')](_0xe9a6('0x27'));};AGIChannel[_0xe9a6('0x23')]['getData']=function(_0x54abab,_0x1e1030,_0x2b4515){_0x54abab=_0x54abab===undefined?_0xe9a6('0x28'):_0x54abab;_0x1e1030=_0x1e1030===undefined?'5':_0x1e1030;_0x2b4515=_0x2b4515===undefined?'1':_0x2b4515;return this[_0xe9a6('0x24')](util[_0xe9a6('0x29')](_0xe9a6('0x2a'),_0x54abab,_0x1e1030*0x3e8,_0x2b4515));};AGIChannel['prototype'][_0xe9a6('0x2b')]=function(_0x3da878){_0x3da878=_0x3da878||'NO\x20MESSAGE';return this['sendRequest'](util[_0xe9a6('0x29')](_0xe9a6('0x2c'),_0x3da878));};AGIChannel[_0xe9a6('0x23')][_0xe9a6('0x2d')]=function(_0x73e555,_0x348e7b){if(_[_0xe9a6('0x2e')](_0x348e7b)){return this[_0xe9a6('0x24')](util[_0xe9a6('0x29')](_0xe9a6('0x2f'),_0x73e555,_0x348e7b[_0xe9a6('0x30')](',')));}return this[_0xe9a6('0x24')](util[_0xe9a6('0x29')](_0xe9a6('0x2f'),_0x73e555,_0x348e7b));};AGIChannel[_0xe9a6('0x23')][_0xe9a6('0x31')]=function(_0x283a0b){return this[_0xe9a6('0x24')](util['format'](_0xe9a6('0x32'),_0x283a0b));};AGIChannel[_0xe9a6('0x23')][_0xe9a6('0x33')]=function(_0x1c2236){return this[_0xe9a6('0x24')](util[_0xe9a6('0x29')](_0xe9a6('0x34'),_0x1c2236));};AGIChannel[_0xe9a6('0x23')][_0xe9a6('0x35')]=function(_0x51ce17){return this[_0xe9a6('0x24')](util[_0xe9a6('0x29')](_0xe9a6('0x36'),_0x51ce17));};AGIChannel['prototype'][_0xe9a6('0xc')]=function(){return this[_0xe9a6('0x24')]('HANGUP');};AGIChannel[_0xe9a6('0x23')][_0xe9a6('0x37')]=function(_0x5f58e4,_0x338a7a){var _0xb1389d=_[_0xe9a6('0x38')](_0x338a7a)||_[_0xe9a6('0x39')](_0x338a7a)?_0x338a7a[_0xe9a6('0x3a')]():_0x338a7a;return this[_0xe9a6('0x24')](util['format'](_0xe9a6('0x3b'),_0x5f58e4,_0xb1389d?_0xb1389d[_0xe9a6('0x3a')]()[_0xe9a6('0x13')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xe9a6('0x23')][_0xe9a6('0x3c')]=function(_0x1b3aad,_0x42455f){return this[_0xe9a6('0x24')](util['format']('SAY\x20NUMBER\x20%s\x20%s',_0x1b3aad,_0x42455f));};AGIChannel['prototype'][_0xe9a6('0x3d')]=function(_0x22659e,_0xc7013c){return this[_0xe9a6('0x24')](util[_0xe9a6('0x29')](_0xe9a6('0x3e'),_0x22659e,_0xc7013c));};AGIChannel[_0xe9a6('0x23')][_0xe9a6('0x3f')]=function(_0x4aee7d,_0xf503a9){return this[_0xe9a6('0x24')](util[_0xe9a6('0x29')](_0xe9a6('0x40'),_0x4aee7d,_0xf503a9));};AGIChannel['prototype'][_0xe9a6('0x41')]=function(_0x36fe7e,_0x71adeb,_0x484cec){_0x71adeb=_0x71adeb||this['extension'];_0x484cec=_0x484cec||0x1;this[_0xe9a6('0x31')](_0x36fe7e);this['setExtension'](_0x71adeb);this[_0xe9a6('0x35')](_0x484cec);return this[_0xe9a6('0x2b')](util[_0xe9a6('0x29')]('GOTO\x20%s\x20%s\x20%s',_0x36fe7e,_0x71adeb,_0x484cec));};AGIChannel[_0xe9a6('0x23')][_0xe9a6('0x42')]=function(_0x2ce4a3){return this[_0xe9a6('0x24')](util['format'](_0xe9a6('0x43'),_0x2ce4a3));};AGIChannel[_0xe9a6('0x23')][_0xe9a6('0x44')]=function(_0x49a63c,_0x1a00cb,_0x3d91de,_0x30a55b,_0x3f9d73,_0x32b0bf){_0x1a00cb=_0x1a00cb||_0xe9a6('0x45');_0x3d91de=_0x3d91de||'';_0x30a55b=_0x30a55b===undefined?-0x1:_0x30a55b==='-1'?-0x1:_0x30a55b*0x3e8;_0x3f9d73=_0x3f9d73===undefined?'':'s='+_0x3f9d73;_0x32b0bf=_0x32b0bf?_0xe9a6('0x46'):'';return this[_0xe9a6('0x24')](util['format'](_0xe9a6('0x47'),_0x49a63c,_0x1a00cb,_0x3d91de,_0x30a55b,_0x32b0bf,_0x3f9d73));};AGIChannel[_0xe9a6('0x23')][_0xe9a6('0x48')]=function(_0x44aca4,_0x258cf5){_0x258cf5=_0x258cf5||'';return this[_0xe9a6('0x24')](util[_0xe9a6('0x29')](_0xe9a6('0x49'),_0x44aca4,_0x258cf5));};AGIChannel['prototype']['agi']=function(_0x3e2748){return this['exec'](_0xe9a6('0x4a'),_0x3e2748);};AGIChannel[_0xe9a6('0x23')][_0xe9a6('0x4b')]=function(_0x1b34fd){return this['exec'](_0xe9a6('0x4c'),_0x1b34fd);};AGIChannel['prototype']['error']=function(_0x1677f5,_0x93eca4){this[_0xe9a6('0x2b')](util['format'](_0xe9a6('0x4d'),_0x1677f5['id'],_0x1677f5[_0xe9a6('0x4e')],_0x93eca4));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xe9a6('0x4f')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index ddad817..290d47d 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 _0x6099=['exports','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','message'];(function(_0x6afc9c,_0xf6b755){var _0x195d68=function(_0x48f1eb){while(--_0x48f1eb){_0x6afc9c['push'](_0x6afc9c['shift']());}};_0x195d68(++_0xf6b755);}(_0x6099,0xb7));var _0x9609=function(_0x37fae9,_0x336a76){_0x37fae9=_0x37fae9-0x0;var _0x1a8b34=_0x6099[_0x37fae9];return _0x1a8b34;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0x9609('0x0'),'E_AGI_ARGUMENT_PORT':_0x9609('0x1'),'E_AGI_SERVER_ERROR':_0x9609('0x2'),'E_AGI_SERVER_CLOSE':_0x9609('0x3'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x9609('0x4'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x9609('0x5'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0x9609('0x6'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x9609('0x7'),'E_AGI_IVR_ENTRY':_0x9609('0x8')};function AGIError(_0x33add){var _0x33add=_0x33add||null,_0x16bf26=_0x16bf26||[],_0x54f41c=0x1,_0x2e4c87='';if(!error[_0x33add]){_0x33add=_0x9609('0x9');}_0x16bf26['push'](error[_0x33add]);while(arguments[_0x54f41c]){_0x16bf26[_0x9609('0xa')](arguments[_0x54f41c]);_0x54f41c++;}_0x2e4c87=util[_0x9609('0xb')]['apply'](util,_0x16bf26);this[_0x9609('0xc')]=_0x2e4c87;this['name']=_0x33add;}module[_0x9609('0xd')]=AGIError; \ No newline at end of file +var _0xb441=['Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','name','exports','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Empty\x20command.'];(function(_0x2d357c,_0x58bd29){var _0x1a3480=function(_0x4d8264){while(--_0x4d8264){_0x2d357c['push'](_0x2d357c['shift']());}};_0x1a3480(++_0x58bd29);}(_0xb441,0x98));var _0x1b44=function(_0x3943fc,_0x5e44fc){_0x3943fc=_0x3943fc-0x0;var _0x2a432d=_0xb441[_0x3943fc];return _0x2a432d;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0x1b44('0x0'),'E_AGI_ARGUMENT_PORT':_0x1b44('0x1'),'E_AGI_SERVER_ERROR':_0x1b44('0x2'),'E_AGI_SERVER_CLOSE':_0x1b44('0x3'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x1b44('0x4'),'E_AGI_SOCKET_ERROR':_0x1b44('0x5'),'E_AGI_SOCKET_CLOSE':_0x1b44('0x6'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0x1b44('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x1b44('0x8'),'E_AGI_IVR_ENTRY':_0x1b44('0x9')};function AGIError(_0x3156ef){var _0x3156ef=_0x3156ef||null,_0x18bdca=_0x18bdca||[],_0xf6878=0x1,_0x352eb0='';if(!error[_0x3156ef]){_0x3156ef=_0x1b44('0xa');}_0x18bdca[_0x1b44('0xb')](error[_0x3156ef]);while(arguments[_0xf6878]){_0x18bdca['push'](arguments[_0xf6878]);_0xf6878++;}_0x352eb0=util[_0x1b44('0xc')][_0x1b44('0xd')](util,_0x18bdca);this['message']=_0x352eb0;this[_0x1b44('0xe')]=_0x3156ef;}module[_0x1b44('0xf')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 9ed18d9..11d5740 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 _0x2498=['no\x20edge/s\x20available','condition','split','agicommand','vswitch','target','menu','invalid','traverseBFS','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','exports','../../../config/logger','getdigits','getsecretdigits','numberOfEdges','prototype','addVertex','vertices','edges','size','relations','info','no\x20vertex\x20found','stop\x20traverse','length'];(function(_0x25d05a,_0x2cc239){var _0x3a60d5=function(_0x447ce3){while(--_0x447ce3){_0x25d05a['push'](_0x25d05a['shift']());}};_0x3a60d5(++_0x2cc239);}(_0x2498,0x79));var _0x8249=function(_0x515dc9,_0x2c6c4e){_0x515dc9=_0x515dc9-0x0;var _0x591ac9=_0x2498[_0x515dc9];return _0x591ac9;};'use strict';var _=require('lodash');var logger=require(_0x8249('0x0'))('agi');var verticesWithRetry=['menu',_0x8249('0x1'),_0x8249('0x2')];var Graph=function(){this['vertices']={};this['edges']={};this[_0x8249('0x3')]=0x0;};Graph[_0x8249('0x4')][_0x8249('0x5')]=function(_0x3234b6){this[_0x8249('0x6')][_0x3234b6['id']]=_0x3234b6;this[_0x8249('0x7')][_0x3234b6['id']]=[];};Graph[_0x8249('0x4')]['addEdge']=function(_0x244a75,_0x2d8e3b,_0x219c9a){this[_0x8249('0x7')][_0x244a75]['push']({'target':_0x2d8e3b,'condition':_0x219c9a});this[_0x8249('0x3')]+=0x1;};Graph[_0x8249('0x4')][_0x8249('0x8')]=function(){return _[_0x8249('0x8')](this[_0x8249('0x6')]);};Graph[_0x8249('0x4')][_0x8249('0x9')]=function(){return this[_0x8249('0x3')];};Graph[_0x8249('0x4')]['getVertex']=function(_0x4219a6){return this['vertices'][_0x4219a6];};Graph[_0x8249('0x4')]['traverseBFS']=function(_0x2a748b,_0x5732b8){if(!this[_0x8249('0x6')][_0x2a748b]){return logger[_0x8249('0xa')](_0x8249('0xb'));}var _0x54e205=_0x5732b8(this['vertices'][_0x2a748b]);if(!_0x54e205){return logger[_0x8249('0xa')](_0x8249('0xc'));}if(this[_0x8249('0x7')][_0x2a748b][_0x8249('0xd')]===0x0){return logger[_0x8249('0xa')](_0x8249('0xe'));}for(var _0x5df77c=0x0,_0x49ca09=[],_0xbf8d42=![];_0x5df77c\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','mxGraphModel','root','agicommand','retry','addVertex','omit','mxCell','length','target','addEdge','source','value','getSquareProject','catch','createSquareReport','then','hasOwnProperty','indexOf','agi_','substring','inspect','debug','stringify','close','timeout','hangup','sync','production','start','joinAt','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','priority','response','code','isUndefined','result','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','finally','toString','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','extension','continueAt','Project\x20%s\x20not\x20published','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','listening','connection'];(function(_0x5286e7,_0x3f90a0){var _0x3f19d7=function(_0xfc6423){while(--_0xfc6423){_0x5286e7['push'](_0x5286e7['shift']());}};_0x3f19d7(++_0x3f90a0);}(_0x30a7,0x16c));var _0x730a=function(_0x2f6758,_0x3e205d){_0x2f6758=_0x2f6758-0x0;var _0x40e1b4=_0x30a7[_0x2f6758];return _0x40e1b4;};'use strict';var parser=require('xml2json');var _=require(_0x730a('0x0'));var syncho=require(_0x730a('0x1'));var util=require(_0x730a('0x2'));var moment=require(_0x730a('0x3'));var config=require(_0x730a('0x4'));var logger=require('../../config/logger')(_0x730a('0x5'));var utilLicense=require(_0x730a('0x6'));var rpc=require(_0x730a('0x7'));var mailRpc=require('./mailRpc');var Graph=require(_0x730a('0x8'));var Vertices=require(_0x730a('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config['agi']=_['defaults'](config[_0x730a('0x5')],{'ip':_0x730a('0xa'),'port':0x11dd});function connectionHandler(_0x49a605){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x49a605);agiHandler(_0x49a605);}catch(_0x2b72f6){logger[_0x730a('0xb')](_0x2b72f6[_0x730a('0xc')]);}});});}function listeningHandler(){console[_0x730a('0xd')](_0x730a('0xe'),config[_0x730a('0x5')][_0x730a('0xf')]);logger[_0x730a('0x10')](util[_0x730a('0x11')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config['agi']['ip'],config[_0x730a('0x5')][_0x730a('0xf')]));}function errorHandler(_0x13fef0){if(_0x13fef0&&_0x13fef0[_0x730a('0x12')]&&_0x13fef0[_0x730a('0x13')]){logger['error'](util['format'](_0x730a('0x14'),_0x13fef0[_0x730a('0x12')],_0x13fef0[_0x730a('0x13')]));}else{logger['error'](util[_0x730a('0x11')](_0x730a('0x15'),_0x13fef0[_0x730a('0xc')]));}}function closeHandler(){logger[_0x730a('0x10')](util[_0x730a('0x11')](_0x730a('0x16'),this['arg_1'],this[_0x730a('0x17')],this[_0x730a('0x18')],this[_0x730a('0x19')],this[_0x730a('0x1a')]));try{createSquareReport(this);}catch(_0x3b5b9d){logger[_0x730a('0xb')](_0x3b5b9d[_0x730a('0xc')]);}}function timeoutHandler(){logger[_0x730a('0x10')](util['format'](_0x730a('0x1b'),this[_0x730a('0x1c')],this['calleridname'],this[_0x730a('0x18')],this['dnid'],this[_0x730a('0x1a')]));}function hangupHandler(){logger[_0x730a('0x10')](util[_0x730a('0x11')](_0x730a('0x1d'),this['arg_1'],this[_0x730a('0x17')],this['callerid'],this[_0x730a('0x19')],this[_0x730a('0x1a')]));this[_0x730a('0x1e')]=!![];}function getRoot(_0x384e78){return parser[_0x730a('0x1f')](_0x384e78,{'object':!![]})[_0x730a('0x20')][_0x730a('0x21')];}function addVertex(_0x471f09,_0x55ed2c,_0x26e755){_0x55ed2c[_0x730a('0x22')]=_0x26e755;if(_0x55ed2c['hasOwnProperty'](_0x730a('0x23'))){_0x55ed2c['maxRetry']=parseInt(_0x55ed2c[_0x730a('0x23')],0xa);}_0x471f09[_0x730a('0x24')](_[_0x730a('0x25')](_0x55ed2c,_0x730a('0x26')));}function initGraph(_0x1bba63,_0x6f9c76){var _0x1707a6=new Graph();for(var _0x25f493 in _0x1bba63){if(_0x1bba63['hasOwnProperty'](_0x25f493)){if(_['isArray'](_0x1bba63[_0x25f493])){for(var _0x43a25c=0x0;_0x43a25c<_0x1bba63[_0x25f493][_0x730a('0x27')];_0x43a25c+=0x1){addVertex(_0x1707a6,_0x1bba63[_0x25f493][_0x43a25c],_0x25f493);}}else{addVertex(_0x1707a6,_0x1bba63[_0x25f493],_0x25f493);}}}for(var _0x4af035=0x0;_0x4af035<_0x6f9c76[_0x730a('0x27')];_0x4af035+=0x1){if(_0x6f9c76[_0x4af035]['source']&&_0x6f9c76[_0x4af035][_0x730a('0x28')]){_0x1707a6[_0x730a('0x29')](_0x6f9c76[_0x4af035][_0x730a('0x2a')],_0x6f9c76[_0x4af035][_0x730a('0x28')],_0x6f9c76[_0x4af035][_0x730a('0x2b')]);}}return _0x1707a6;}function getSquareProject(_0xc6f45c,_0x3efea5){rpc[_0x730a('0x2c')](_0xc6f45c)['then'](function(_0x19f7bf){_0x3efea5(null,_0x19f7bf);})[_0x730a('0x2d')](function(_0x49fa09){_0x3efea5(null,_0x49fa09);});}function createSquareReport(_0x42cc12,_0xa894da){rpc[_0x730a('0x2e')](_0x42cc12)[_0x730a('0x2f')](function(_0x443703){if(_0xa894da){_0xa894da(null,_0x443703);}})[_0x730a('0x2d')](function(_0x2ae707){if(_0xa894da){_0xa894da(null,_0x2ae707);}});}function setChannelVariables(_0x1b5c99){for(var _0x23fcf0 in _0x1b5c99){if(_0x1b5c99[_0x730a('0x30')](_0x23fcf0)){if(_0x23fcf0[_0x730a('0x31')](_0x730a('0x32'))===0x0){_0x1b5c99[_0x23fcf0[_0x730a('0x33')](0x4)]=_0x1b5c99[_0x23fcf0];delete _0x1b5c99[_0x23fcf0];}}}}function getLogFromObject(_0x481368){return util[_0x730a('0x34')](_0x481368,{'showHidden':![],'depth':null});}function agiHandler(_0x10de8d){var _0x385371,_0x2e60d3,_0x4a1e90,_0x3899f2,_0x26b72f;logger[_0x730a('0x35')]('variables',JSON[_0x730a('0x36')](_0x10de8d,null,0x2));logger[_0x730a('0x10')](util[_0x730a('0x11')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x10de8d['arg_1'],_0x10de8d[_0x730a('0x17')],_0x10de8d[_0x730a('0x18')],_0x10de8d[_0x730a('0x19')],_0x10de8d[_0x730a('0x1a')]));_0x10de8d['on'](_0x730a('0xb'),errorHandler);_0x10de8d['on'](_0x730a('0x37'),closeHandler);_0x10de8d['on'](_0x730a('0x38'),timeoutHandler);_0x10de8d['evtHangup']=![];_0x10de8d['on'](_0x730a('0x39'),hangupHandler);var _0x2e3cd4=getSquareProject[_0x730a('0x3a')](null,_0x10de8d[_0x730a('0x1c')]);if(_0x2e3cd4){if(_0x2e3cd4[_0x730a('0x3b')]){_0x385371=getRoot(_0x2e3cd4[_0x730a('0x3b')]);if(_0x385371&&_0x385371[_0x730a('0x3c')]){logger[_0x730a('0x35')]('root',JSON['stringify'](_0x385371,null,0x2));_0x10de8d[_0x730a('0x3d')]=moment()[_0x730a('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x2e60d3=initGraph(_['omit'](_0x385371,_0x730a('0x26')),_0x385371[_0x730a('0x26')]);_0x4a1e90=new Vertices(_0x10de8d,rpc,mailRpc);logger['info'](util[_0x730a('0x11')](_0x730a('0x3e'),_0x10de8d[_0x730a('0x1c')],_0x10de8d['calleridname'],_0x10de8d[_0x730a('0x18')],_0x10de8d['dnid'],_0x10de8d[_0x730a('0x1a')]));_0x2e60d3[_0x730a('0x3f')](_0x385371['start']['id'],function(_0x4c187c){try{_0x4c187c=_0x4a1e90[_0x730a('0x40')](_0x4c187c);logger['debug'](_0x730a('0x41'),JSON['stringify'](_0x4c187c,null,0x2));if(_0x4c187c['agicommand']===_0x730a('0x42')){logger[_0x730a('0x10')](_0x730a('0x43'));_0x10de8d['context']=_0x4c187c[_0x730a('0x44')]||_0x10de8d[_0x730a('0x44')];_0x10de8d['extension']=_0x4c187c['extension'];_0x10de8d['priority']=_0x4c187c[_0x730a('0x45')]?_0x4c187c[_0x730a('0x45')]-0x1:0x1;return null;}else if(_0x4c187c&&_0x4a1e90[_0x4c187c[_0x730a('0x22')]]){_0x26b72f=_0x4a1e90[_0x4c187c[_0x730a('0x22')]](_0x4c187c);logger['info'](_0x730a('0x46'),JSON['stringify'](_0x26b72f,null,0x2));if(_0x26b72f&&_0x26b72f[_0x730a('0x47')]===AGI_CODE_SUCCESS&&_0x26b72f['result']!==AGI_RESULT_ERROR&&!_0x10de8d['evtHangup']){logger['debug'](_0x730a('0x46'),getLogFromObject(_0x26b72f));return _[_0x730a('0x48')](_0x26b72f[_0x730a('0x49')])?null:_0x26b72f[_0x730a('0x49')]['toString']();}else{logger[_0x730a('0xb')](_0x730a('0x46'),getLogFromObject(_0x26b72f));return null;}}else{logger[_0x730a('0xb')]('agicommand\x20not\x20found');return null;}}catch(_0x2060f2){logger[_0x730a('0xb')](_0x2060f2[_0x730a('0xc')]);return null;}});if(_0x385371['finally']){logger[_0x730a('0x10')](util[_0x730a('0x11')](_0x730a('0x4a'),_0x10de8d['arg_1'],_0x10de8d[_0x730a('0x17')],_0x10de8d[_0x730a('0x18')],_0x10de8d['dnid'],_0x10de8d[_0x730a('0x1a')]));_0x2e60d3[_0x730a('0x3f')](_0x385371[_0x730a('0x4b')]['id'],function(_0x5804b3){try{_0x5804b3=_0x4a1e90[_0x730a('0x40')](_0x5804b3);logger[_0x730a('0x35')](_0x730a('0x41'),JSON[_0x730a('0x36')](_0x5804b3,null,0x2));if(_0x5804b3&&_0x4a1e90[_0x5804b3[_0x730a('0x22')]]){_0x26b72f=_0x4a1e90[_0x5804b3[_0x730a('0x22')]](_0x5804b3);if(_0x26b72f){logger[_0x730a('0x35')]('response',getLogFromObject(_0x26b72f));return _[_0x730a('0x48')](_0x26b72f[_0x730a('0x49')])?null:_0x26b72f[_0x730a('0x49')][_0x730a('0x4c')]();}else{logger[_0x730a('0xb')](_0x730a('0x46'),getLogFromObject(_0x26b72f));return null;}}else{logger[_0x730a('0xb')]('agicommand\x20not\x20found');return null;}}catch(_0x7c328c){logger[_0x730a('0xb')](_0x7c328c[_0x730a('0xc')]);return null;}});}logger[_0x730a('0x10')](util[_0x730a('0x11')](_0x730a('0x4d'),_0x10de8d['arg_1'],_0x10de8d[_0x730a('0x17')],_0x10de8d[_0x730a('0x18')],_0x10de8d[_0x730a('0x19')],_0x10de8d[_0x730a('0x1a')]));logger[_0x730a('0x10')](util[_0x730a('0x11')](_0x730a('0x4e'),_0x10de8d[_0x730a('0x44')],_0x10de8d[_0x730a('0x4f')],parseInt(_0x10de8d[_0x730a('0x45')],0xa)+0x1));_0x10de8d[_0x730a('0x50')](_0x10de8d[_0x730a('0x44')],_0x10de8d['extension'],parseInt(_0x10de8d[_0x730a('0x45')],0xa)+0x1);_0x10de8d[_0x730a('0x37')]();}}else{logger['error'](util[_0x730a('0x11')](_0x730a('0x51'),_0x10de8d['arg_1']));_0x10de8d[_0x730a('0x50')](_0x10de8d[_0x730a('0x44')],_0x10de8d[_0x730a('0x4f')],parseInt(_0x10de8d[_0x730a('0x45')],0xa)+0x1);_0x10de8d['close']();}}else{logger[_0x730a('0xb')](util[_0x730a('0x11')]('Project\x20%s\x20not\x20found',_0x10de8d[_0x730a('0x1c')]));_0x10de8d['continueAt'](_0x10de8d[_0x730a('0x44')],_0x10de8d[_0x730a('0x4f')],parseInt(_0x10de8d['priority'],0xa)+0x1);_0x10de8d[_0x730a('0x37')]();}}function main(){var _0x3ac568;return utilLicense[_0x730a('0x52')]()[_0x730a('0x2f')](function(_0x81ecc2){if(_0x81ecc2){if(_0x81ecc2[_0x730a('0x53')]){if(_0x81ecc2[_0x730a('0x54')]&&_0x81ecc2[_0x730a('0x54')]>0x0){logger[_0x730a('0x10')](util[_0x730a('0x11')](_0x730a('0x55'),_0x81ecc2['callysquare']));_0x3ac568=_0x81ecc2[_0x730a('0x54')];}else{logger[_0x730a('0x10')](_0x730a('0x56'));}}else{logger[_0x730a('0x10')](_0x730a('0x57'));_0x3ac568=-0x1;}}})[_0x730a('0x2d')](function(_0x1b5f7f){logger[_0x730a('0xb')](_0x730a('0x58'),_0x1b5f7f[_0x730a('0xc')]);})[_0x730a('0x4b')](function(){var _0x40a611=require('./server')(config['agi'][_0x730a('0xf')],config[_0x730a('0x5')]['ip'],_0x3ac568);_0x40a611['on']('error',errorHandler);_0x40a611['on'](_0x730a('0x59'),listeningHandler);_0x40a611['on'](_0x730a('0x5a'),connectionHandler);_0x40a611['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0xbc0b=['addVertex','omit','mxCell','length','source','target','addEdge','value','getSquareProject','then','catch','createSquareReport','agi_','substring','inspect','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','timeout','evtHangup','hangup','sync','production','start','joinAt','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','agicommand','response','code','result','isUndefined','toString','agicommand\x20not\x20found','finally','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','connection','xml2json','lodash','syncho','util','../../config/environment','../../config/logger','../../config/license/util','./rpc','./mailRpc','./graph','./vertices','agi','defaults','127.0.0.1','nextTick','error','stack','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','name','message','format','[%s]\x20%s','info','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','mxGraphModel','root','hasOwnProperty','maxRetry'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0xbc0b,0xf1));var _0xbbc0=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0xbc0b[_0x101e7b];return _0x4995c0;};'use strict';var parser=require(_0xbbc0('0x0'));var _=require(_0xbbc0('0x1'));var syncho=require(_0xbbc0('0x2'));var util=require(_0xbbc0('0x3'));var moment=require('moment');var config=require(_0xbbc0('0x4'));var logger=require(_0xbbc0('0x5'))('agi');var utilLicense=require(_0xbbc0('0x6'));var rpc=require(_0xbbc0('0x7'));var mailRpc=require(_0xbbc0('0x8'));var Graph=require(_0xbbc0('0x9'));var Vertices=require(_0xbbc0('0xa'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xbbc0('0xb')]=_[_0xbbc0('0xc')](config[_0xbbc0('0xb')],{'ip':_0xbbc0('0xd'),'port':0x11dd});function connectionHandler(_0x26a635){process[_0xbbc0('0xe')](function(){syncho(function(){try{setChannelVariables(_0x26a635);agiHandler(_0x26a635);}catch(_0x580b75){logger[_0xbbc0('0xf')](_0x580b75[_0xbbc0('0x10')]);}});});}function listeningHandler(){console['log'](_0xbbc0('0x11'),config[_0xbbc0('0xb')][_0xbbc0('0x12')]);logger['info'](util['format']('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0xbbc0('0xb')]['ip'],config[_0xbbc0('0xb')][_0xbbc0('0x12')]));}function errorHandler(_0x40fa8b){if(_0x40fa8b&&_0x40fa8b[_0xbbc0('0x13')]&&_0x40fa8b[_0xbbc0('0x14')]){logger['error'](util[_0xbbc0('0x15')](_0xbbc0('0x16'),_0x40fa8b['name'],_0x40fa8b[_0xbbc0('0x14')]));}else{logger[_0xbbc0('0xf')](util[_0xbbc0('0x15')]('[ERROR]\x20%s',_0x40fa8b[_0xbbc0('0x10')]));}}function closeHandler(){logger[_0xbbc0('0x17')](util['format'](_0xbbc0('0x18'),this[_0xbbc0('0x19')],this[_0xbbc0('0x1a')],this[_0xbbc0('0x1b')],this[_0xbbc0('0x1c')],this[_0xbbc0('0x1d')]));try{createSquareReport(this);}catch(_0x22f4b2){logger[_0xbbc0('0xf')](_0x22f4b2[_0xbbc0('0x10')]);}}function timeoutHandler(){logger['info'](util[_0xbbc0('0x15')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xbbc0('0x19')],this[_0xbbc0('0x1a')],this[_0xbbc0('0x1b')],this[_0xbbc0('0x1c')],this['uniqueid']));}function hangupHandler(){logger[_0xbbc0('0x17')](util['format'](_0xbbc0('0x1e'),this['arg_1'],this[_0xbbc0('0x1a')],this['callerid'],this[_0xbbc0('0x1c')],this['uniqueid']));this['evtHangup']=!![];}function getRoot(_0x36cb2b){return parser['toJson'](_0x36cb2b,{'object':!![]})[_0xbbc0('0x1f')][_0xbbc0('0x20')];}function addVertex(_0x1e3842,_0x55ce71,_0x25f25f){_0x55ce71['agicommand']=_0x25f25f;if(_0x55ce71[_0xbbc0('0x21')]('retry')){_0x55ce71[_0xbbc0('0x22')]=parseInt(_0x55ce71['retry'],0xa);}_0x1e3842[_0xbbc0('0x23')](_[_0xbbc0('0x24')](_0x55ce71,_0xbbc0('0x25')));}function initGraph(_0x3131da,_0x344c7e){var _0x53cff5=new Graph();for(var _0x3004d7 in _0x3131da){if(_0x3131da['hasOwnProperty'](_0x3004d7)){if(_['isArray'](_0x3131da[_0x3004d7])){for(var _0xa52b1d=0x0;_0xa52b1d<_0x3131da[_0x3004d7][_0xbbc0('0x26')];_0xa52b1d+=0x1){addVertex(_0x53cff5,_0x3131da[_0x3004d7][_0xa52b1d],_0x3004d7);}}else{addVertex(_0x53cff5,_0x3131da[_0x3004d7],_0x3004d7);}}}for(var _0x5250b7=0x0;_0x5250b7<_0x344c7e[_0xbbc0('0x26')];_0x5250b7+=0x1){if(_0x344c7e[_0x5250b7][_0xbbc0('0x27')]&&_0x344c7e[_0x5250b7][_0xbbc0('0x28')]){_0x53cff5[_0xbbc0('0x29')](_0x344c7e[_0x5250b7][_0xbbc0('0x27')],_0x344c7e[_0x5250b7][_0xbbc0('0x28')],_0x344c7e[_0x5250b7][_0xbbc0('0x2a')]);}}return _0x53cff5;}function getSquareProject(_0x1898eb,_0x3afa20){rpc[_0xbbc0('0x2b')](_0x1898eb)[_0xbbc0('0x2c')](function(_0x2d33b8){_0x3afa20(null,_0x2d33b8);})[_0xbbc0('0x2d')](function(_0x749b2b){_0x3afa20(null,_0x749b2b);});}function createSquareReport(_0x161847,_0x16eb2d){rpc[_0xbbc0('0x2e')](_0x161847)[_0xbbc0('0x2c')](function(_0x2afe96){if(_0x16eb2d){_0x16eb2d(null,_0x2afe96);}})[_0xbbc0('0x2d')](function(_0x54ee34){if(_0x16eb2d){_0x16eb2d(null,_0x54ee34);}});}function setChannelVariables(_0x484a31){for(var _0x5c8ccb in _0x484a31){if(_0x484a31['hasOwnProperty'](_0x5c8ccb)){if(_0x5c8ccb['indexOf'](_0xbbc0('0x2f'))===0x0){_0x484a31[_0x5c8ccb[_0xbbc0('0x30')](0x4)]=_0x484a31[_0x5c8ccb];delete _0x484a31[_0x5c8ccb];}}}}function getLogFromObject(_0x5e9fcf){return util[_0xbbc0('0x31')](_0x5e9fcf,{'showHidden':![],'depth':null});}function agiHandler(_0x1dc3c5){var _0x10a8cf,_0x4c09ab,_0x5c0064,_0x1c4cf1,_0x434c3b;logger[_0xbbc0('0x32')](_0xbbc0('0x33'),JSON[_0xbbc0('0x34')](_0x1dc3c5,null,0x2));logger[_0xbbc0('0x17')](util['format'](_0xbbc0('0x35'),_0x1dc3c5[_0xbbc0('0x19')],_0x1dc3c5[_0xbbc0('0x1a')],_0x1dc3c5[_0xbbc0('0x1b')],_0x1dc3c5[_0xbbc0('0x1c')],_0x1dc3c5[_0xbbc0('0x1d')]));_0x1dc3c5['on'](_0xbbc0('0xf'),errorHandler);_0x1dc3c5['on']('close',closeHandler);_0x1dc3c5['on'](_0xbbc0('0x36'),timeoutHandler);_0x1dc3c5[_0xbbc0('0x37')]=![];_0x1dc3c5['on'](_0xbbc0('0x38'),hangupHandler);var _0x45e2d5=getSquareProject[_0xbbc0('0x39')](null,_0x1dc3c5[_0xbbc0('0x19')]);if(_0x45e2d5){if(_0x45e2d5[_0xbbc0('0x3a')]){_0x10a8cf=getRoot(_0x45e2d5[_0xbbc0('0x3a')]);if(_0x10a8cf&&_0x10a8cf[_0xbbc0('0x3b')]){logger[_0xbbc0('0x32')](_0xbbc0('0x20'),JSON[_0xbbc0('0x34')](_0x10a8cf,null,0x2));_0x1dc3c5[_0xbbc0('0x3c')]=moment()[_0xbbc0('0x15')]('YYYY-MM-DD\x20HH:mm:ss');_0x4c09ab=initGraph(_[_0xbbc0('0x24')](_0x10a8cf,_0xbbc0('0x25')),_0x10a8cf[_0xbbc0('0x25')]);_0x5c0064=new Vertices(_0x1dc3c5,rpc,mailRpc);logger[_0xbbc0('0x17')](util[_0xbbc0('0x15')](_0xbbc0('0x3d'),_0x1dc3c5[_0xbbc0('0x19')],_0x1dc3c5['calleridname'],_0x1dc3c5[_0xbbc0('0x1b')],_0x1dc3c5['dnid'],_0x1dc3c5[_0xbbc0('0x1d')]));_0x4c09ab[_0xbbc0('0x3e')](_0x10a8cf['start']['id'],function(_0x4ec48f){try{_0x4ec48f=_0x5c0064[_0xbbc0('0x3f')](_0x4ec48f);logger['debug'](_0xbbc0('0x40'),JSON[_0xbbc0('0x34')](_0x4ec48f,null,0x2));if(_0x4ec48f['agicommand']===_0xbbc0('0x41')){logger[_0xbbc0('0x17')](_0xbbc0('0x42'));_0x1dc3c5[_0xbbc0('0x43')]=_0x4ec48f[_0xbbc0('0x43')]||_0x1dc3c5['context'];_0x1dc3c5['extension']=_0x4ec48f[_0xbbc0('0x44')];_0x1dc3c5[_0xbbc0('0x45')]=_0x4ec48f[_0xbbc0('0x45')]?_0x4ec48f[_0xbbc0('0x45')]-0x1:0x1;return null;}else if(_0x4ec48f&&_0x5c0064[_0x4ec48f[_0xbbc0('0x46')]]){_0x434c3b=_0x5c0064[_0x4ec48f[_0xbbc0('0x46')]](_0x4ec48f);logger['info'](_0xbbc0('0x47'),JSON[_0xbbc0('0x34')](_0x434c3b,null,0x2));if(_0x434c3b&&_0x434c3b[_0xbbc0('0x48')]===AGI_CODE_SUCCESS&&_0x434c3b[_0xbbc0('0x49')]!==AGI_RESULT_ERROR&&!_0x1dc3c5[_0xbbc0('0x37')]){logger['debug'](_0xbbc0('0x47'),getLogFromObject(_0x434c3b));return _[_0xbbc0('0x4a')](_0x434c3b[_0xbbc0('0x49')])?null:_0x434c3b[_0xbbc0('0x49')][_0xbbc0('0x4b')]();}else{logger[_0xbbc0('0xf')](_0xbbc0('0x47'),getLogFromObject(_0x434c3b));return null;}}else{logger[_0xbbc0('0xf')](_0xbbc0('0x4c'));return null;}}catch(_0x5cb16a){logger[_0xbbc0('0xf')](_0x5cb16a['stack']);return null;}});if(_0x10a8cf[_0xbbc0('0x4d')]){logger[_0xbbc0('0x17')](util[_0xbbc0('0x15')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x1dc3c5[_0xbbc0('0x19')],_0x1dc3c5['calleridname'],_0x1dc3c5['callerid'],_0x1dc3c5[_0xbbc0('0x1c')],_0x1dc3c5[_0xbbc0('0x1d')]));_0x4c09ab['traverseBFS'](_0x10a8cf[_0xbbc0('0x4d')]['id'],function(_0x495499){try{_0x495499=_0x5c0064['clear'](_0x495499);logger[_0xbbc0('0x32')](_0xbbc0('0x40'),JSON[_0xbbc0('0x34')](_0x495499,null,0x2));if(_0x495499&&_0x5c0064[_0x495499[_0xbbc0('0x46')]]){_0x434c3b=_0x5c0064[_0x495499[_0xbbc0('0x46')]](_0x495499);if(_0x434c3b){logger[_0xbbc0('0x32')](_0xbbc0('0x47'),getLogFromObject(_0x434c3b));return _[_0xbbc0('0x4a')](_0x434c3b[_0xbbc0('0x49')])?null:_0x434c3b[_0xbbc0('0x49')]['toString']();}else{logger[_0xbbc0('0xf')](_0xbbc0('0x47'),getLogFromObject(_0x434c3b));return null;}}else{logger[_0xbbc0('0xf')](_0xbbc0('0x4c'));return null;}}catch(_0x667eeb){logger['error'](_0x667eeb[_0xbbc0('0x10')]);return null;}});}logger[_0xbbc0('0x17')](util[_0xbbc0('0x15')](_0xbbc0('0x4e'),_0x1dc3c5[_0xbbc0('0x19')],_0x1dc3c5[_0xbbc0('0x1a')],_0x1dc3c5[_0xbbc0('0x1b')],_0x1dc3c5[_0xbbc0('0x1c')],_0x1dc3c5[_0xbbc0('0x1d')]));logger[_0xbbc0('0x17')](util[_0xbbc0('0x15')](_0xbbc0('0x4f'),_0x1dc3c5[_0xbbc0('0x43')],_0x1dc3c5[_0xbbc0('0x44')],parseInt(_0x1dc3c5['priority'],0xa)+0x1));_0x1dc3c5[_0xbbc0('0x50')](_0x1dc3c5['context'],_0x1dc3c5[_0xbbc0('0x44')],parseInt(_0x1dc3c5[_0xbbc0('0x45')],0xa)+0x1);_0x1dc3c5[_0xbbc0('0x51')]();}}else{logger[_0xbbc0('0xf')](util['format'](_0xbbc0('0x52'),_0x1dc3c5[_0xbbc0('0x19')]));_0x1dc3c5[_0xbbc0('0x50')](_0x1dc3c5['context'],_0x1dc3c5[_0xbbc0('0x44')],parseInt(_0x1dc3c5[_0xbbc0('0x45')],0xa)+0x1);_0x1dc3c5[_0xbbc0('0x51')]();}}else{logger[_0xbbc0('0xf')](util[_0xbbc0('0x15')](_0xbbc0('0x53'),_0x1dc3c5[_0xbbc0('0x19')]));_0x1dc3c5['continueAt'](_0x1dc3c5[_0xbbc0('0x43')],_0x1dc3c5[_0xbbc0('0x44')],parseInt(_0x1dc3c5[_0xbbc0('0x45')],0xa)+0x1);_0x1dc3c5[_0xbbc0('0x51')]();}}function main(){var _0x19e3a6;return utilLicense['getLicense']()[_0xbbc0('0x2c')](function(_0x1037cf){if(_0x1037cf){if(_0x1037cf[_0xbbc0('0x54')]){if(_0x1037cf['callysquare']&&_0x1037cf[_0xbbc0('0x55')]>0x0){logger[_0xbbc0('0x17')](util[_0xbbc0('0x15')](_0xbbc0('0x56'),_0x1037cf[_0xbbc0('0x55')]));_0x19e3a6=_0x1037cf[_0xbbc0('0x55')];}else{logger['info'](_0xbbc0('0x57'));}}else{logger[_0xbbc0('0x17')](_0xbbc0('0x58'));_0x19e3a6=-0x1;}}})[_0xbbc0('0x2d')](function(_0x5c17be){logger['error'](_0xbbc0('0x59'),_0x5c17be['stack']);})[_0xbbc0('0x4d')](function(){var _0x3f4d4d=require(_0xbbc0('0x5a'))(config[_0xbbc0('0xb')][_0xbbc0('0x12')],config['agi']['ip'],_0x19e3a6);_0x3f4d4d['on']('error',errorHandler);_0x3f4d4d['on']('listening',listeningHandler);_0x3f4d4d['on'](_0xbbc0('0x5b'),connectionHandler);_0x3f4d4d['on']('close',closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index 282a8b3..fac0e98 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 _0x485d=['catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','request','error','result'];(function(_0x16d279,_0x2a4ba0){var _0x254932=function(_0x36c437){while(--_0x36c437){_0x16d279['push'](_0x16d279['shift']());}};_0x254932(++_0x2a4ba0);}(_0x485d,0xa5));var _0xd485=function(_0x2678d6,_0x4e2001){_0x2678d6=_0x2678d6-0x0;var _0x475503=_0x485d[_0x2678d6];return _0x475503;};'use strict';var BPromise=require(_0xd485('0x0'));var jayson=require(_0xd485('0x1'));var client=jayson[_0xd485('0x2')]['http']({'port':0x232b});function request(_0x125dcd,_0x10b0f6){return new BPromise(function(_0x523a9c,_0x1b91ac){return client[_0xd485('0x3')](_0x125dcd,_0x10b0f6)['then'](function(_0x2861eb){if(_0x2861eb[_0xd485('0x4')]){return _0x1b91ac(_0x2861eb[_0xd485('0x4')]['message']);}else{return _0x523a9c(_0x2861eb[_0xd485('0x5')]);}})[_0xd485('0x6')](function(_0x159f66){return _0x1b91ac(_0x159f66);});});}exports[_0xd485('0x7')]=function(_0x2fc10f,_0x4fadd8){return request(_0xd485('0x8'),{'account':_0x2fc10f,'message':_0x4fadd8});}; \ No newline at end of file +var _0xa4f1=['sendMailMessage','SendMail','jayson/promise','request','then','error','result','catch'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa4f1,0x132));var _0x1a4f=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0xa4f1[_0x42bdad];return _0x122626;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x1a4f('0x0'));var client=jayson['client']['http']({'port':0x232b});function request(_0x5466d5,_0x13c15d){return new BPromise(function(_0x367c5e,_0xda4077){return client[_0x1a4f('0x1')](_0x5466d5,_0x13c15d)[_0x1a4f('0x2')](function(_0x358f19){if(_0x358f19[_0x1a4f('0x3')]){return _0xda4077(_0x358f19[_0x1a4f('0x3')]['message']);}else{return _0x367c5e(_0x358f19[_0x1a4f('0x4')]);}})[_0x1a4f('0x5')](function(_0x463686){return _0xda4077(_0x463686);});});}exports[_0x1a4f('0x6')]=function(_0x5498d1,_0x528a8a){return request(_0x1a4f('0x7'),{'account':_0x5498d1,'message':_0x528a8a});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 39b4ce8..e86feeb 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 _0x79a5=['Transform','_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','split','slice','trim','emit','headers','exports','util','stream'];(function(_0x33f4bc,_0x1c0521){var _0x2d6cda=function(_0x16d438){while(--_0x16d438){_0x33f4bc['push'](_0x33f4bc['shift']());}};_0x2d6cda(++_0x1c0521);}(_0x79a5,0x17a));var _0x579a=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0x79a5[_0x4a3898];return _0x25ceb0;};'use strict';var util=require(_0x579a('0x0'));var Transform=require(_0x579a('0x1'))[_0x579a('0x2')];function AGIReply(_0x25b0c3){Transform['call'](this,_0x25b0c3);this[_0x579a('0x3')]='';this[_0x579a('0x4')]=![];}util[_0x579a('0x5')](AGIReply,Transform);AGIReply[_0x579a('0x6')][_0x579a('0x7')]=function(_0x403e6f,_0x42e175,_0x3d345d){var _0x53cc9b='\x0a',_0x5a1b3f=['\x0a\x0a',_0x579a('0x8')],_0x2d1cab=-0x1,_0x3a1777=-0x1,_0x26d1f5='',_0x5d05b5=0x0,_0x23e115='',_0x2e46b1='';this[_0x579a('0x3')]+=_0x403e6f[_0x579a('0x9')]();_0x23e115=this['_localBuffer'];if(!this['_inBody']){_0x5d05b5=0x0;while(_0x5a1b3f[_0x5d05b5]){while((_0x3a1777=_0x23e115[_0x579a('0xa')](_0x5a1b3f[_0x5d05b5]))!=-0x1){_0x26d1f5=_0x5a1b3f[_0x5d05b5];_0x2e46b1=_0x23e115[_0x579a('0xb')](0x0,_0x3a1777);_0x23e115=_0x23e115[_0x579a('0xb')](_0x3a1777+_0x26d1f5[_0x579a('0xc')]);var _0x45fbdf=_0x2e46b1[_0x579a('0xd')](_0x53cc9b),_0x4fd597=0x0,_0x4d35b2={},_0x142572='',_0x28491d='',_0x428e8c=-0x1;while(_0x45fbdf[_0x4fd597]){_0x428e8c=_0x45fbdf[_0x4fd597]['indexOf'](':');if(_0x428e8c!=-0x1){_0x142572=_0x45fbdf[_0x4fd597][_0x579a('0xe')](0x0,_0x428e8c)['trim']();_0x28491d=_0x45fbdf[_0x4fd597][_0x579a('0xe')](_0x428e8c+0x1)[_0x579a('0xf')]();if(_0x142572[_0x579a('0xc')]>0x0){_0x4d35b2[_0x142572]=_0x28491d;}}else{}_0x4fd597++;}this[_0x579a('0x10')](_0x579a('0x11'),_0x4d35b2);this['_inBody']=!![];}_0x5d05b5++;}this[_0x579a('0x3')]=_0x23e115;}else{while((_0x2d1cab=_0x23e115[_0x579a('0xa')](_0x53cc9b))!=-0x1){_0x2e46b1=_0x23e115[_0x579a('0xb')](0x0,_0x2d1cab);this[_0x579a('0x10')]('line',_0x2e46b1);_0x23e115=_0x23e115[_0x579a('0xb')](_0x2d1cab+_0x53cc9b[_0x579a('0xc')]);}this['_localBuffer']=_0x23e115;}_0x3d345d();};module[_0x579a('0x12')]=AGIReply; \ No newline at end of file +var _0xe559=['call','_localBuffer','_inBody','\x0d\x0a\x0d\x0a','indexOf','substring','length','split','slice','trim','headers','emit','exports','util','stream'];(function(_0x15da16,_0x279689){var _0x498922=function(_0x4de3cb){while(--_0x4de3cb){_0x15da16['push'](_0x15da16['shift']());}};_0x498922(++_0x279689);}(_0xe559,0xc1));var _0x9e55=function(_0x4b7bd7,_0x511b87){_0x4b7bd7=_0x4b7bd7-0x0;var _0x4fe4a0=_0xe559[_0x4b7bd7];return _0x4fe4a0;};'use strict';var util=require(_0x9e55('0x0'));var Transform=require(_0x9e55('0x1'))['Transform'];function AGIReply(_0x2a85a7){Transform[_0x9e55('0x2')](this,_0x2a85a7);this[_0x9e55('0x3')]='';this[_0x9e55('0x4')]=![];}util['inherits'](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x2f8e65,_0x234ad0,_0x3f52d0){var _0x488459='\x0a',_0x51599c=['\x0a\x0a',_0x9e55('0x5')],_0x240e85=-0x1,_0x4951b2=-0x1,_0x459f3d='',_0x330914=0x0,_0x3ffb42='',_0x299c8a='';this[_0x9e55('0x3')]+=_0x2f8e65['toString']();_0x3ffb42=this[_0x9e55('0x3')];if(!this[_0x9e55('0x4')]){_0x330914=0x0;while(_0x51599c[_0x330914]){while((_0x4951b2=_0x3ffb42[_0x9e55('0x6')](_0x51599c[_0x330914]))!=-0x1){_0x459f3d=_0x51599c[_0x330914];_0x299c8a=_0x3ffb42[_0x9e55('0x7')](0x0,_0x4951b2);_0x3ffb42=_0x3ffb42['substring'](_0x4951b2+_0x459f3d[_0x9e55('0x8')]);var _0x14c304=_0x299c8a[_0x9e55('0x9')](_0x488459),_0xb6ed1b=0x0,_0x3aff71={},_0x418493='',_0x3d3a3a='',_0x31f22e=-0x1;while(_0x14c304[_0xb6ed1b]){_0x31f22e=_0x14c304[_0xb6ed1b][_0x9e55('0x6')](':');if(_0x31f22e!=-0x1){_0x418493=_0x14c304[_0xb6ed1b][_0x9e55('0xa')](0x0,_0x31f22e)[_0x9e55('0xb')]();_0x3d3a3a=_0x14c304[_0xb6ed1b][_0x9e55('0xa')](_0x31f22e+0x1)['trim']();if(_0x418493[_0x9e55('0x8')]>0x0){_0x3aff71[_0x418493]=_0x3d3a3a;}}else{}_0xb6ed1b++;}this['emit'](_0x9e55('0xc'),_0x3aff71);this[_0x9e55('0x4')]=!![];}_0x330914++;}this[_0x9e55('0x3')]=_0x3ffb42;}else{while((_0x240e85=_0x3ffb42[_0x9e55('0x6')](_0x488459))!=-0x1){_0x299c8a=_0x3ffb42[_0x9e55('0x7')](0x0,_0x240e85);this[_0x9e55('0xd')]('line',_0x299c8a);_0x3ffb42=_0x3ffb42[_0x9e55('0x7')](_0x240e85+_0x488459[_0x9e55('0x8')]);}this['_localBuffer']=_0x3ffb42;}_0x3f52d0();};module[_0x9e55('0xe')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index eaef033..10da9d8 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 _0xfdad=['error','result','catch','getSquareProject','ShowSquareProject','production','MailServerOut','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','dsn','getUserById','ShowUser','getTrunkById','ShowTrunk','getSoundById','ShowSound','getIntervalById','ShowInterval','Interval','Intervals','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId','getPauseById','ShowPause','LoginUser','agentPause','agentLogout','bluebird','moment','lodash','util','jayson/promise','http','request','then'];(function(_0x2ca3d8,_0xf83cb8){var _0x2639d9=function(_0x5ee2bc){while(--_0x5ee2bc){_0x2ca3d8['push'](_0x2ca3d8['shift']());}};_0x2639d9(++_0xf83cb8);}(_0xfdad,0x10b));var _0xdfda=function(_0x19e714,_0x47dc41){_0x19e714=_0x19e714-0x0;var _0x248cf9=_0xfdad[_0x19e714];return _0x248cf9;};'use strict';var BPromise=require(_0xdfda('0x0'));var moment=require(_0xdfda('0x1'));var _=require(_0xdfda('0x2'));var util=require(_0xdfda('0x3'));var jayson=require(_0xdfda('0x4'));var client=jayson['client'][_0xdfda('0x5')]({'port':0x2329});function request(_0x438471,_0x5d171e){return new BPromise(function(_0x5108e5,_0x3e06db){return client[_0xdfda('0x6')](_0x438471,_0x5d171e)[_0xdfda('0x7')](function(_0x11a77e){if(_0x11a77e[_0xdfda('0x8')]){return _0x3e06db(_0x11a77e[_0xdfda('0x8')]['message']);}else{return _0x5108e5(_0x11a77e[_0xdfda('0x9')]);}})[_0xdfda('0xa')](function(_0x5aa271){return _0x3e06db(_0x5aa271);});});}exports[_0xdfda('0xb')]=function(_0x21da2e){return request(_0xdfda('0xc'),{'options':{'raw':![],'where':{'name':_0x21da2e},'attributes':[_0xdfda('0xd')]}});};exports['getMailAccountById']=function(_0x4379b1){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x4379b1},'include':[{'model':_0xdfda('0xe'),'as':'Smtp'}],'attributes':['id',_0xdfda('0xf'),_0xdfda('0x10')]}});};exports[_0xdfda('0x11')]=function(_0x276f00){return request('ShowSquareProject',{'options':{'where':{'id':_0x276f00},'attributes':[_0xdfda('0xf')]}});};exports[_0xdfda('0x12')]=function(_0x32eb3f){return request(_0xdfda('0x13'),{'options':{'where':{'id':_0x32eb3f},'attributes':['name']}});};exports[_0xdfda('0x14')]=function(_0x149290){return request(_0xdfda('0x15'),{'options':{'where':{'id':_0x149290},'attributes':[_0xdfda('0xf')]}});};exports[_0xdfda('0x16')]=function(_0x19d980){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x19d980},'attributes':[_0xdfda('0x17')]}});};exports[_0xdfda('0x18')]=function(_0x5d7058){return request(_0xdfda('0x19'),{'options':{'where':{'id':_0x5d7058},'attributes':[_0xdfda('0xf')]}});};exports[_0xdfda('0x1a')]=function(_0x29287d){return request(_0xdfda('0x1b'),{'options':{'where':{'id':_0x29287d},'attributes':[_0xdfda('0xf')]}});};exports[_0xdfda('0x1c')]=function(_0x27e993){return request(_0xdfda('0x1d'),{'options':{'where':{'id':_0x27e993},'attributes':['save_name']}});};exports[_0xdfda('0x1e')]=function(_0x1c8111){return request(_0xdfda('0x1f'),{'options':{'raw':![],'where':{'id':_0x1c8111},'include':[{'model':_0xdfda('0x20'),'as':_0xdfda('0x21')}]}});};exports['getSmsAccountById']=function(_0x14fa0a){return request('ShowSmsAccount',{'options':{'where':{'id':_0x14fa0a},'attributes':['id',_0xdfda('0xf')]}});};exports['createSmsMessage']=function(_0x3cbee7){return request(_0xdfda('0x22'),{'body':_0x3cbee7});};exports[_0xdfda('0x23')]=function(_0x55b04a){return request(_0xdfda('0x24'),{'body':_0x55b04a});};exports[_0xdfda('0x25')]=function(_0x179be0){return request(_0xdfda('0x26'),{'body':_[_0xdfda('0x27')](_0x179be0,{'project_name':_0x179be0[_0xdfda('0x28')],'prev_project_name':_0x179be0['arg_2']||'','is_subproject':_0x179be0['arg_2']?!![]:![],'leaveAt':moment()[_0xdfda('0x29')](_0xdfda('0x2a'))})});};exports[_0xdfda('0x2b')]=function(_0x209eef){return request(_0xdfda('0x2c'),{'body':_0x209eef});};exports['createSquareMessage']=function(_0x317976){return request(_0xdfda('0x2d'),{'body':_0x317976});};exports[_0xdfda('0x2e')]=function(_0x59fa9c){return request(_0xdfda('0x2f'),{'options':{'raw':![],'where':{'phone':_0x59fa9c[_0xdfda('0x30')],'ListId':_0x59fa9c[_0xdfda('0x31')]}}})[_0xdfda('0x7')](function(_0x485c50){if(_0x485c50){return _0x485c50;}return request('CreateCmContact',{'body':_0x59fa9c});});};exports[_0xdfda('0x32')]=function(_0x2af0e9){return request(_0xdfda('0x33'),{'options':{'where':{'id':_0x2af0e9},'attributes':[_0xdfda('0xf')]}});};exports['agentLogin']=function(_0x11a8d7,_0x12934e){return request(_0xdfda('0x34'),{'body':{'interface':_0x12934e},'options':{'where':_0x11a8d7}});};exports[_0xdfda('0x35')]=function(_0x44d8c2,_0x4eb465,_0x466d1a){return request('PauseUser',{'body':{'type':_0x4eb465,'uniqueid':_0x466d1a},'options':{'where':_0x44d8c2}});};exports['agentUnpause']=function(_0x419779){return request('UnpauseUser',{'body':{},'options':{'where':_0x419779}});};exports[_0xdfda('0x36')]=function(_0x236b87){return request('LogoutUser',{'body':{},'options':{'where':_0x236b87}});}; \ No newline at end of file +var _0x2c7f=['ShowUser','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','CreateSquareReport','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','phone','then','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','LogoutUser','moment','lodash','jayson/promise','client','http','request','error','result','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','email','name','ShowVoiceQueue','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById'];(function(_0x4f52b5,_0x2eb457){var _0x475c11=function(_0x378b2c){while(--_0x378b2c){_0x4f52b5['push'](_0x4f52b5['shift']());}};_0x475c11(++_0x2eb457);}(_0x2c7f,0x103));var _0xf2c7=function(_0x27d65c,_0x67181e){_0x27d65c=_0x27d65c-0x0;var _0x1e514b=_0x2c7f[_0x27d65c];return _0x1e514b;};'use strict';var BPromise=require('bluebird');var moment=require(_0xf2c7('0x0'));var _=require(_0xf2c7('0x1'));var util=require('util');var jayson=require(_0xf2c7('0x2'));var client=jayson[_0xf2c7('0x3')][_0xf2c7('0x4')]({'port':0x2329});function request(_0x67a107,_0x3553fd){return new BPromise(function(_0x2145d8,_0x4ea853){return client[_0xf2c7('0x5')](_0x67a107,_0x3553fd)['then'](function(_0x2ddf18){if(_0x2ddf18[_0xf2c7('0x6')]){return _0x4ea853(_0x2ddf18['error']['message']);}else{return _0x2145d8(_0x2ddf18[_0xf2c7('0x7')]);}})['catch'](function(_0x18ae62){return _0x4ea853(_0x18ae62);});});}exports[_0xf2c7('0x8')]=function(_0x22cecb){return request(_0xf2c7('0x9'),{'options':{'raw':![],'where':{'name':_0x22cecb},'attributes':['production']}});};exports[_0xf2c7('0xa')]=function(_0x3df300){return request(_0xf2c7('0xb'),{'options':{'raw':![],'where':{'id':_0x3df300},'include':[{'model':_0xf2c7('0xc'),'as':'Smtp'}],'attributes':['id','name',_0xf2c7('0xd')]}});};exports['getSquareProjectById']=function(_0xc4eade){return request(_0xf2c7('0x9'),{'options':{'where':{'id':_0xc4eade},'attributes':[_0xf2c7('0xe')]}});};exports['getVoiceQueueById']=function(_0x3f0de7){return request(_0xf2c7('0xf'),{'options':{'where':{'id':_0x3f0de7},'attributes':[_0xf2c7('0xe')]}});};exports['getVariableById']=function(_0xea2575){return request(_0xf2c7('0x10'),{'options':{'where':{'id':_0xea2575},'attributes':[_0xf2c7('0xe')]}});};exports[_0xf2c7('0x11')]=function(_0x4e5114){return request(_0xf2c7('0x12'),{'options':{'where':{'id':_0x4e5114},'attributes':[_0xf2c7('0x13')]}});};exports[_0xf2c7('0x14')]=function(_0x23d1d8){return request(_0xf2c7('0x15'),{'options':{'where':{'id':_0x23d1d8},'attributes':['name']}});};exports[_0xf2c7('0x16')]=function(_0x374b54){return request(_0xf2c7('0x17'),{'options':{'where':{'id':_0x374b54},'attributes':[_0xf2c7('0xe')]}});};exports[_0xf2c7('0x18')]=function(_0x54f5df){return request(_0xf2c7('0x19'),{'options':{'where':{'id':_0x54f5df},'attributes':[_0xf2c7('0x1a')]}});};exports[_0xf2c7('0x1b')]=function(_0x3b2640){return request(_0xf2c7('0x1c'),{'options':{'raw':![],'where':{'id':_0x3b2640},'include':[{'model':_0xf2c7('0x1d'),'as':_0xf2c7('0x1e')}]}});};exports[_0xf2c7('0x1f')]=function(_0x59100d){return request(_0xf2c7('0x20'),{'options':{'where':{'id':_0x59100d},'attributes':['id',_0xf2c7('0xe')]}});};exports[_0xf2c7('0x21')]=function(_0x4973d3){return request(_0xf2c7('0x22'),{'body':_0x4973d3});};exports[_0xf2c7('0x23')]=function(_0x45db04){return request(_0xf2c7('0x24'),{'body':_0x45db04});};exports['createSquareReport']=function(_0x213ed1){return request(_0xf2c7('0x25'),{'body':_['merge'](_0x213ed1,{'project_name':_0x213ed1[_0xf2c7('0x26')],'prev_project_name':_0x213ed1[_0xf2c7('0x27')]||'','is_subproject':_0x213ed1['arg_2']?!![]:![],'leaveAt':moment()[_0xf2c7('0x28')](_0xf2c7('0x29'))})});};exports['createSquareRecording']=function(_0x12d32c){return request(_0xf2c7('0x2a'),{'body':_0x12d32c});};exports[_0xf2c7('0x2b')]=function(_0x3266f4){return request(_0xf2c7('0x2c'),{'body':_0x3266f4});};exports[_0xf2c7('0x2d')]=function(_0x468974){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x468974[_0xf2c7('0x2e')],'ListId':_0x468974['ListId']}}})[_0xf2c7('0x2f')](function(_0x4fd50c){if(_0x4fd50c){return _0x4fd50c;}return request('CreateCmContact',{'body':_0x468974});});};exports['getPauseById']=function(_0x1a92d7){return request(_0xf2c7('0x30'),{'options':{'where':{'id':_0x1a92d7},'attributes':[_0xf2c7('0xe')]}});};exports[_0xf2c7('0x31')]=function(_0x4715f1,_0x4d94a3){return request(_0xf2c7('0x32'),{'body':{'interface':_0x4d94a3},'options':{'where':_0x4715f1}});};exports[_0xf2c7('0x33')]=function(_0x2367b7,_0x1fe29a,_0x4e2056){return request(_0xf2c7('0x34'),{'body':{'type':_0x1fe29a,'uniqueid':_0x4e2056},'options':{'where':_0x2367b7}});};exports[_0xf2c7('0x35')]=function(_0x27306e){return request(_0xf2c7('0x36'),{'body':{},'options':{'where':_0x27306e}});};exports['agentLogout']=function(_0x24e8a1){return request(_0xf2c7('0x37'),{'body':{},'options':{'where':_0x24e8a1}});}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/index.js b/server/services/agi/scripts/aws/index.js index e12e3c1..b4e3777 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 _0xd2f5=['./polly','exports'];(function(_0x4b93bf,_0x4ff40c){var _0x3bfea6=function(_0x8389a6){while(--_0x8389a6){_0x4b93bf['push'](_0x4b93bf['shift']());}};_0x3bfea6(++_0x4ff40c);}(_0xd2f5,0x144));var _0x5d2f=function(_0x579d5b,_0x576c9c){_0x579d5b=_0x579d5b-0x0;var _0x5a93c8=_0xd2f5[_0x579d5b];return _0x5a93c8;};var polly=require(_0x5d2f('0x0'));var lex=require('./lex');module[_0x5d2f('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x307e=['./polly','./lex','exports'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x307e,0xc9));var _0xe307=function(_0x1f850a,_0x39d53f){_0x1f850a=_0x1f850a-0x0;var _0x29e43b=_0x307e[_0x1f850a];return _0x29e43b;};var polly=require(_0xe307('0x0'));var lex=require(_0xe307('0x1'));module[_0xe307('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 9a4a8dd..c648559 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 _0x70e0=['exports','./lib/api'];(function(_0x3e6d5d,_0x264c7a){var _0x238923=function(_0x201b19){while(--_0x201b19){_0x3e6d5d['push'](_0x3e6d5d['shift']());}};_0x238923(++_0x264c7a);}(_0x70e0,0x17b));var _0x070e=function(_0x3b6253,_0x1f3662){_0x3b6253=_0x3b6253-0x0;var _0x53da5b=_0x70e0[_0x3b6253];return _0x53da5b;};'use strict';var lex=require(_0x070e('0x0'));module[_0x070e('0x1')]=function(_0x198c2e,_0x4d95bb,_0x579b83,_0x16e651,_0xee173,_0x277d32){return lex(_0x198c2e,_0x4d95bb,_0x579b83,_0x16e651,_0xee173,_0x277d32);}; \ No newline at end of file +var _0x6e6c=['exports','./lib/api'];(function(_0x523adf,_0x3e1620){var _0x283870=function(_0xa0e816){while(--_0xa0e816){_0x523adf['push'](_0x523adf['shift']());}};_0x283870(++_0x3e1620);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x6e6c[_0x397e5f];return _0x5302b8;};'use strict';var lex=require(_0xc6e6('0x0'));module[_0xc6e6('0x1')]=function(_0x545f2c,_0x370b21,_0x1b63fe,_0x58f303,_0x550e47,_0x2e97f5){return lex(_0x545f2c,_0x370b21,_0x1b63fe,_0x58f303,_0x550e47,_0x2e97f5);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/lib/api.js b/server/services/agi/scripts/aws/lex/lib/api.js index 4bae414..cf6d794 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(_0x371f88,_0x44041a){var _0x227818=function(_0x110430){while(--_0x110430){_0x371f88['push'](_0x371f88['shift']());}};_0x227818(++_0x44041a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'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(_0x587359,_0x19f7c2){var _0x275b34=function(_0x9cf4eb){while(--_0x9cf4eb){_0x587359['push'](_0x587359['shift']());}};_0x275b34(++_0x19f7c2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/polly/index.js b/server/services/agi/scripts/aws/polly/index.js index 2d0ecde..bccc3fe 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 _0xb869=['exports','./lib/api'];(function(_0x2c7607,_0x50c2d1){var _0x31e65c=function(_0xd173aa){while(--_0xd173aa){_0x2c7607['push'](_0x2c7607['shift']());}};_0x31e65c(++_0x50c2d1);}(_0xb869,0x18d));var _0x9b86=function(_0x70b67e,_0x370a64){_0x70b67e=_0x70b67e-0x0;var _0x57afd2=_0xb869[_0x70b67e];return _0x57afd2;};'use strict';var polly=require(_0x9b86('0x0'));module[_0x9b86('0x1')]=function(_0x48687c,_0x39f1ad,_0x5a03e8,_0x1e4b6f,_0x3a250e,_0x41b228,_0x5f3255){return polly(_0x48687c,_0x39f1ad,_0x5a03e8,_0x1e4b6f,_0x3a250e,_0x41b228,_0x5f3255);}; \ No newline at end of file +var _0x4743=['./lib/api'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x4743,0xed));var _0x3474=function(_0x3d8291,_0x560e85){_0x3d8291=_0x3d8291-0x0;var _0x2bad5c=_0x4743[_0x3d8291];return _0x2bad5c;};'use strict';var polly=require(_0x3474('0x0'));module['exports']=function(_0x1b0e3e,_0x40e94b,_0x4c7c7a,_0x1718bf,_0x517ed9,_0x530303,_0x552f88){return polly(_0x1b0e3e,_0x40e94b,_0x4c7c7a,_0x1718bf,_0x517ed9,_0x530303,_0x552f88);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/polly/lib/api.js b/server/services/agi/scripts/aws/polly/lib/api.js index 9e883bd..082456b 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 _0xbef3=['Polly','text','mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports'];(function(_0x2b0ea4,_0x516d1e){var _0xf602f=function(_0x3f80b4){while(--_0x3f80b4){_0x2b0ea4['push'](_0x2b0ea4['shift']());}};_0xf602f(++_0x516d1e);}(_0xbef3,0xe0));var _0x3bef=function(_0x28249c,_0x505c47){_0x28249c=_0x28249c-0x0;var _0x46deef=_0xbef3[_0x28249c];return _0x46deef;};'use strict';var fs=require('fs');var path=require(_0x3bef('0x0'));var BPromise=require(_0x3bef('0x1'));var rs=require(_0x3bef('0x2'));var AWS=require(_0x3bef('0x3'));function pollyResult(_0x24ad05,_0x355c73,_0x472c9c){return new BPromise(function(_0x17726b,_0x2d39ae){_0x24ad05[_0x3bef('0x4')](_0x355c73,function(_0x2bfc7f,_0x5e76f5){if(_0x2bfc7f){_0x2d39ae(_0x2bfc7f);}else if(_0x5e76f5){if(_0x5e76f5[_0x3bef('0x5')]instanceof Buffer){fs[_0x3bef('0x6')](_0x472c9c,_0x5e76f5[_0x3bef('0x5')],function(_0x273719){if(_0x273719){_0x2d39ae(_0x273719);}else{_0x17726b();}});}else{_0x2d39ae(new Error(_0x3bef('0x7')));}}else{_0x2d39ae(new Error(_0x3bef('0x8')));}});});}module[_0x3bef('0x9')]=function(_0x33eeab,_0x1af6a4,_0x2682ec,_0x5531ae,_0x2c2c0c,_0x1a02d5,_0x46703f){var _0x3b970f=new AWS[(_0x3bef('0xa'))]({'accessKeyId':_0x33eeab,'secretAccessKey':_0x1af6a4,'region':_0x2682ec});var _0x577548={'Text':_0x2c2c0c,'TextType':_0x1a02d5||_0x3bef('0xb'),'OutputFormat':_0x3bef('0xc'),'VoiceId':_0x5531ae};return pollyResult(_0x3b970f,_0x577548,_0x46703f);}; \ No newline at end of file +var _0x8d4c=['aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','path','bluebird','randomstring'];(function(_0x41bfe2,_0x103a52){var _0x444437=function(_0x22fcaa){while(--_0x22fcaa){_0x41bfe2['push'](_0x41bfe2['shift']());}};_0x444437(++_0x103a52);}(_0x8d4c,0x194));var _0xc8d4=function(_0x5cb4f0,_0xb16665){_0x5cb4f0=_0x5cb4f0-0x0;var _0x22208=_0x8d4c[_0x5cb4f0];return _0x22208;};'use strict';var fs=require('fs');var path=require(_0xc8d4('0x0'));var BPromise=require(_0xc8d4('0x1'));var rs=require(_0xc8d4('0x2'));var AWS=require(_0xc8d4('0x3'));function pollyResult(_0x24a710,_0x271b33,_0x547c16){return new BPromise(function(_0x1f7116,_0x4e8e1d){_0x24a710[_0xc8d4('0x4')](_0x271b33,function(_0x4bb1d9,_0x192c5a){if(_0x4bb1d9){_0x4e8e1d(_0x4bb1d9);}else if(_0x192c5a){if(_0x192c5a[_0xc8d4('0x5')]instanceof Buffer){fs[_0xc8d4('0x6')](_0x547c16,_0x192c5a[_0xc8d4('0x5')],function(_0x9b3ddc){if(_0x9b3ddc){_0x4e8e1d(_0x9b3ddc);}else{_0x1f7116();}});}else{_0x4e8e1d(new Error(_0xc8d4('0x7')));}}else{_0x4e8e1d(new Error(_0xc8d4('0x8')));}});});}module[_0xc8d4('0x9')]=function(_0x3f34f2,_0x462b12,_0x2ff05e,_0x59d995,_0x35ca09,_0x1f8080,_0x309cbb){var _0x3db253=new AWS[(_0xc8d4('0xa'))]({'accessKeyId':_0x3f34f2,'secretAccessKey':_0x462b12,'region':_0x2ff05e});var _0xa53bd4={'Text':_0x35ca09,'TextType':_0x1f8080||'text','OutputFormat':'mp3','VoiceId':_0x59d995};return pollyResult(_0x3db253,_0xa53bd4,_0x309cbb);}; \ No newline at end of file diff --git a/server/services/agi/scripts/google/asr/index.js b/server/services/agi/scripts/google/asr/index.js index 6f77216..87d4f62 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 _0x72b3=['./lib/api','exports'];(function(_0xdb100e,_0x334f06){var _0x451e7c=function(_0x3ef5bd){while(--_0x3ef5bd){_0xdb100e['push'](_0xdb100e['shift']());}};_0x451e7c(++_0x334f06);}(_0x72b3,0x1d6));var _0x372b=function(_0x22b8a3,_0x2a79a7){_0x22b8a3=_0x22b8a3-0x0;var _0x199a0c=_0x72b3[_0x22b8a3];return _0x199a0c;};'use strict';var asr=require(_0x372b('0x0'));module[_0x372b('0x1')]=function(_0x4b3ced,_0x16f85a,_0x100e7e,_0xf57342){return asr(_0x4b3ced,_0x16f85a,_0x100e7e);}; \ No newline at end of file +'use strict';var asr=require('./lib/api');module['exports']=function(_0x2ae631,_0x39586a,_0x3faa30,_0x1ea7cf){return asr(_0x2ae631,_0x39586a,_0x3faa30);}; \ No newline at end of file diff --git a/server/services/agi/scripts/google/asr/lib/api.js b/server/services/agi/scripts/google/asr/lib/api.js index e1d009f..5cafdad 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 _0x2750=['/v1/speech:recognize?key=','LINEAR16','8000','url','https://speech.googleapis.com','exports','string','length','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x2750,0x13b));var _0x0275=function(_0x52138e,_0x477634){_0x52138e=_0x52138e-0x0;var _0x1f9275=_0x2750[_0x52138e];return _0x1f9275;};'use strict';var url=require(_0x0275('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host=_0x0275('0x1');module[_0x0275('0x2')]=function(_0x372744,_0x429a37,_0x101b26){return new BPromise(function(_0x41ec06,_0x20273d){var _0x4960;if(typeof _0x372744!==_0x0275('0x3')||_0x372744[_0x0275('0x4')]===0x0){return _0x20273d('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x429a37!==_0x0275('0x3')||_0x429a37[_0x0275('0x4')]===0x0){return _0x20273d(_0x0275('0x5'));}if(typeof _0x101b26!==_0x0275('0x6')&&(typeof _0x101b26!=='string'||_0x101b26[_0x0275('0x4')]===0x0)){return _0x20273d(_0x0275('0x7'));}try{_0x4960=fs[_0x0275('0x8')](_0x372744)['toString']('base64');}catch(_0x224e0f){return _0x20273d(_0x224e0f);}return _0x41ec06({'method':'POST','uri':host+_0x0275('0x9')+_0x429a37,'body':{'config':{'encoding':_0x0275('0xa'),'sampleRateHertz':_0x0275('0xb'),'languageCode':_0x101b26},'audio':{'content':_0x4960}},'json':!![]});});}; \ No newline at end of file +var _0xad95=['/v1/speech:recognize?key=','8000','url','bluebird','https://speech.googleapis.com','length','key\x20should\x20be\x20a\x20string','undefined','string','readFileSync','POST'];(function(_0x133ebd,_0x5471e0){var _0xc485d4=function(_0x4dcc42){while(--_0x4dcc42){_0x133ebd['push'](_0x133ebd['shift']());}};_0xc485d4(++_0x5471e0);}(_0xad95,0x70));var _0x5ad9=function(_0xc6d513,_0x2aac65){_0xc6d513=_0xc6d513-0x0;var _0x2464c6=_0xad95[_0xc6d513];return _0x2464c6;};'use strict';var url=require(_0x5ad9('0x0'));var BPromise=require(_0x5ad9('0x1'));var fs=require('fs');var host=_0x5ad9('0x2');module['exports']=function(_0x52ad89,_0x409d5b,_0x235c61){return new BPromise(function(_0x59809d,_0x5c9fd6){var _0x185bff;if(typeof _0x52ad89!=='string'||_0x52ad89['length']===0x0){return _0x5c9fd6('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x409d5b!=='string'||_0x409d5b[_0x5ad9('0x3')]===0x0){return _0x5c9fd6(_0x5ad9('0x4'));}if(typeof _0x235c61!==_0x5ad9('0x5')&&(typeof _0x235c61!==_0x5ad9('0x6')||_0x235c61[_0x5ad9('0x3')]===0x0)){return _0x5c9fd6('lang\x20should\x20be\x20a\x20string');}try{_0x185bff=fs[_0x5ad9('0x7')](_0x52ad89)['toString']('base64');}catch(_0x301e69){return _0x5c9fd6(_0x301e69);}return _0x59809d({'method':_0x5ad9('0x8'),'uri':host+_0x5ad9('0x9')+_0x409d5b,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0x5ad9('0xa'),'languageCode':_0x235c61},'audio':{'content':_0x185bff}},'json':!![]});});}; \ No newline at end of file diff --git a/server/services/agi/scripts/google/index.js b/server/services/agi/scripts/google/index.js index 8076c3c..326e80d 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 _0x9b0a=['./asr','exports'];(function(_0x46fbd6,_0xc723e1){var _0x330b19=function(_0x38072a){while(--_0x38072a){_0x46fbd6['push'](_0x46fbd6['shift']());}};_0x330b19(++_0xc723e1);}(_0x9b0a,0x1cc));var _0xa9b0=function(_0x410b7f,_0xdc867a){_0x410b7f=_0x410b7f-0x0;var _0x19d3c7=_0x9b0a[_0x410b7f];return _0x19d3c7;};var asr=require(_0xa9b0('0x0'));module[_0xa9b0('0x1')]={'asr':asr}; \ No newline at end of file +var _0x4d79=['exports'];(function(_0xd97532,_0x338f9b){var _0x2993c4=function(_0x1a5cc9){while(--_0x1a5cc9){_0xd97532['push'](_0xd97532['shift']());}};_0x2993c4(++_0x338f9b);}(_0x4d79,0x6e));var _0x94d7=function(_0x34a6e9,_0x25cabe){_0x34a6e9=_0x34a6e9-0x0;var _0x11015c=_0x4d79[_0x34a6e9];return _0x11015c;};var asr=require('./asr');module[_0x94d7('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 59ab7ca..51e06be 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 _0xaeda=['Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','path','querystring','randomstring','sox','google-tts-api','url','parse','util','./google','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','end','https:','transcode','wav','error\x20convert','finish\x20to\x20convert','resolve','generate','writeFileSync','base64','chmodSync','777','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','then','tmp','.mp3','from','audioContent','writeFile','.wav','googleCloudTTS\x20path','split','googleTTS','utf8','POST','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','slice','parse\x20response\x20failed:\x0a','data','length','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','message','googleDialogflow','textRequest','result','source','action','actionIncomplete','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','fulfillmentText','intent','name','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','freeform=3','sestekNDA','nda','channelData','CustomAction','CustomActionData','AudioFromTts'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xaeda,0x94));var _0xaaed=function(_0x2dcaf6,_0x3c8ccc){_0x2dcaf6=_0x2dcaf6-0x0;var _0x3eb1e6=_0xaeda[_0x2dcaf6];return _0x3eb1e6;};'use strict';var apiai=require(_0xaaed('0x0'));var BPromise=require(_0xaaed('0x1'));var dialogflow=require(_0xaaed('0x2'));var fs=require('fs');var http=require(_0xaaed('0x3'));var https=require(_0xaaed('0x4'));var md5=require('md5');var path=require(_0xaaed('0x5'));var querystring=require(_0xaaed('0x6'));var rp=require('request-promise');var rs=require(_0xaaed('0x7'));var sox=require(_0xaaed('0x8'));var tts=require(_0xaaed('0x9'));var urlParse=require(_0xaaed('0xa'))[_0xaaed('0xb')];var util=require(_0xaaed('0xc'));var aws=require('./aws');var google=require(_0xaaed('0xd'));var sestek=require('./sestek');var tilde=require(_0xaaed('0xe'));var logger=require(_0xaaed('0xf'))(_0xaaed('0x10'));var ISPEECH_API=_0xaaed('0x11');function downloadFile(_0x66a4c4,_0x9debb8){return new BPromise(function(_0x283245,_0x374c15){var _0x2bd257=urlParse(_0x66a4c4);var _0x12f547=_0x2bd257[_0xaaed('0x12')]==='https:'?https:http;var _0x12dd03={'host':_0x2bd257[_0xaaed('0x13')],'path':_0x2bd257['path'],'headers':{'user-agent':_0xaaed('0x14')}};_0x12f547[_0xaaed('0x15')](_0x12dd03,function(_0x46f9f9){if(_0x46f9f9[_0xaaed('0x16')]!==0xc8){logger[_0xaaed('0x17')](_0xaaed('0x18')+_0x66a4c4+_0xaaed('0x19')+_0x46f9f9[_0xaaed('0x16')]+'\x20('+_0x46f9f9['statusMessage']+')');_0x374c15(new Error(_0xaaed('0x18')+_0x66a4c4+_0xaaed('0x19')+_0x46f9f9[_0xaaed('0x16')]+'\x20('+_0x46f9f9[_0xaaed('0x1a')]+')'));return;}var _0x3d2b22=fs[_0xaaed('0x1b')](_0x9debb8);_0x3d2b22['on'](_0xaaed('0x1c'),function(){logger[_0xaaed('0x1d')](_0xaaed('0x1e'));_0x3d2b22[_0xaaed('0x1f')](_0x283245);});_0x3d2b22['on'](_0xaaed('0x17'),function(_0x5e8f40){fs[_0xaaed('0x20')](_0x9debb8);logger[_0xaaed('0x17')]('download\x20error',_0x5e8f40);_0x374c15(_0x5e8f40);});_0x46f9f9['pipe'](_0x3d2b22);})['on']('error',function(_0xdee710){logger['error'](_0xdee710);_0x374c15(_0xdee710);})[_0xaaed('0x21')]();});}function uploadFile(_0x3f418e){return new BPromise(function(_0x3f457f,_0xbdfb60){var _0x4e9ecd=urlParse(_0x3f418e);var _0x240546=_0x4e9ecd[_0xaaed('0x12')]===_0xaaed('0x22')?https:http;var _0x3e9131={'host':_0x4e9ecd[_0xaaed('0x13')],'path':_0x4e9ecd[_0xaaed('0x5')],'headers':{'user-agent':_0xaaed('0x14')}};_0x240546[_0xaaed('0x15')](_0x3e9131,function(_0x3abc33){if(_0x3abc33['statusCode']!==0xc8){_0xbdfb60(new Error('request\x20to\x20'+_0x3f418e+_0xaaed('0x19')+_0x3abc33['statusCode']+'\x20('+_0x3abc33[_0xaaed('0x1a')]+')'));return;}var _0x192b8b='';_0x3abc33['on']('data',function(_0x4b98b5){_0x192b8b+=_0x4b98b5;});_0x3abc33['on'](_0xaaed('0x21'),function(){_0x3f457f(_0x192b8b);});})['on'](_0xaaed('0x17'),function(_0xccfdac){_0xbdfb60(_0xccfdac);})['end']();});}function convertFile(_0x44ced0,_0x442510){return new BPromise(function(_0x5ca5e4,_0x46d3ca){var _0x531e09=sox[_0xaaed('0x23')](_0x44ced0,_0x442510,{'sampleRate':0x1f40,'format':_0xaaed('0x24'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x531e09['on'](_0xaaed('0x17'),function(_0x2c56ab){logger[_0xaaed('0x17')](_0xaaed('0x25'),_0x2c56ab);_0x46d3ca(_0x2c56ab);});_0x531e09['on'](_0xaaed('0x21'),function(){logger[_0xaaed('0x1d')](_0xaaed('0x26'));_0x5ca5e4();});_0x531e09['start']();});}function base64Decode(_0x2f26c7,_0x5f02c3){var _0xf3df11=path[_0xaaed('0x27')](__dirname,'tmp',rs[_0xaaed('0x28')](0x4)+'.wav');fs[_0xaaed('0x29')](_0xf3df11,_0x2f26c7,_0xaaed('0x2a'));return convertFile(_0xf3df11,_0x5f02c3)['then'](function(){try{fs[_0xaaed('0x20')](_0xf3df11);fs[_0xaaed('0x2b')](_0x5f02c3,_0xaaed('0x2c'));}catch(_0x3825ef){logger[_0xaaed('0x17')](_0x3825ef);}return _0x5f02c3['split']('.')[0x0];});}function base64Encode(_0xcde217){var _0x4e5aa3=fs['readFileSync'](_0xcde217);return new Buffer(_0x4e5aa3)[_0xaaed('0x2d')](_0xaaed('0x2a'));}exports[_0xaaed('0x2e')]=function(_0x41aa5c,_0x143797,_0x155c80,_0x1a0b9f,_0x479c50,_0x3b22f0){var _0x1e39d6,_0x5c03e7;var _0x159767=_0xaaed('0x2f');var _0x187ccf=_0xaaed('0x30')+_0x41aa5c;var _0x5b1406={};if(_0x143797===_0xaaed('0x31')){_0x5b1406[_0xaaed('0x32')]={'ssml':_0x155c80};}else{_0x5b1406[_0xaaed('0x32')]={'text':_0x155c80};};_0x5b1406[_0xaaed('0x33')]={'languageCode':_0x1a0b9f,'ssmlGender':_0x479c50};_0x5b1406[_0xaaed('0x34')]={'audioEncoding':_0xaaed('0x35'),'sampleRateHertz':0x1f40};var _0x299a5a={'url':_0x159767+_0xaaed('0x36')+_0x187ccf,'method':'POST','json':!![],'body':_0x5b1406};return rp(_0x299a5a)[_0xaaed('0x37')](function(_0x36682e){return new BPromise(function(_0x4f5d32,_0xb593d4){_0x1e39d6=path[_0xaaed('0x27')](__dirname,_0xaaed('0x38'),rs[_0xaaed('0x28')](0x4)+_0xaaed('0x39'));var _0x262bcf=Buffer[_0xaaed('0x3a')](_0x36682e[_0xaaed('0x3b')],_0xaaed('0x2a'));return fs[_0xaaed('0x3c')](_0x1e39d6,_0x262bcf,function(_0x2ec346){_0xb593d4(_0x2ec346);},function(_0x53c724){fs[_0xaaed('0x2b')](_0x1e39d6,_0xaaed('0x2c'));_0x4f5d32(_0x53c724);});});})[_0xaaed('0x37')](function(_0x3a6b50){_0x5c03e7=path[_0xaaed('0x27')](__dirname,_0xaaed('0x38'),rs[_0xaaed('0x28')](0x4)+_0xaaed('0x3d'));return convertFile(_0x1e39d6,_0x5c03e7);})[_0xaaed('0x37')](function(){try{fs['unlink'](_0x1e39d6);fs[_0xaaed('0x2b')](_0x5c03e7,_0xaaed('0x2c'));}catch(_0xb34906){logger[_0xaaed('0x17')](_0xb34906);}logger[_0xaaed('0x1d')](_0xaaed('0x3e'),_0x5c03e7[_0xaaed('0x3f')]('.')[0x0]);return _0x5c03e7[_0xaaed('0x3f')]('.')[0x0];});};exports[_0xaaed('0x40')]=function(_0x40ac35,_0x8d7028){var _0x3b6717='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x5866aa,_0x51b135;var _0x3dc270;var _0x48e264={'encoding':_0xaaed('0x41'),'method':_0xaaed('0x42'),'timeout':0x2710,'url':_0x3b6717,'headers':{'Content-Type':_0xaaed('0x43')},'body':_0xaaed('0x44')+encodeURIComponent(JSON[_0xaaed('0x45')]([[[_0xaaed('0x46'),JSON[_0xaaed('0x45')]([_0x40ac35,_0x8d7028||'en',![],_0xaaed('0x47')]),null,_0xaaed('0x48')]]]))};return rp(_0x48e264)[_0xaaed('0x37')](function(_0x37a085){try{_0x3dc270=eval(_0x37a085[_0xaaed('0x49')](0x5))[0x0][0x2];}catch(_0x9c8ee1){throw new Error(_0xaaed('0x4a')+_0x37a085[_0xaaed('0x4b')]);}if(!_0x3dc270){if(_0x40ac35[_0xaaed('0x4c')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error('lang\x20\x22'+_0x8d7028+_0xaaed('0x4d'));}}try{_0x3dc270=eval(_0x3dc270)[0x0];}catch(_0x98b282){throw new Error(_0xaaed('0x4a')+res[_0xaaed('0x4b')]);}const _0x528155=_0x3dc270;_0x5866aa=path['resolve'](__dirname,_0xaaed('0x38'),rs[_0xaaed('0x28')](0x4)+'.mp3');fs[_0xaaed('0x29')](_0x5866aa,_0x3dc270,{'encoding':'base64'});_0x51b135=path[_0xaaed('0x27')](__dirname,_0xaaed('0x38'),rs[_0xaaed('0x28')](0x4)+_0xaaed('0x3d'));return convertFile(_0x5866aa,_0x51b135);})[_0xaaed('0x37')](function(){try{fs[_0xaaed('0x20')](_0x5866aa);fs[_0xaaed('0x2b')](_0x51b135,_0xaaed('0x2c'));}catch(_0x9c0e75){logger[_0xaaed('0x17')](_0x9c0e75);}logger[_0xaaed('0x1d')](_0xaaed('0x4e'),_0x51b135['split']('.')[0x0]);return _0x51b135[_0xaaed('0x3f')]('.')[0x0];});};exports[_0xaaed('0x4f')]=function(_0x4e6572,_0x43b3f7,_0x2dd740){return google[_0xaaed('0x50')](_0x4e6572,_0x43b3f7,_0x2dd740)[_0xaaed('0x37')](function(_0x28c76c){logger['info'](_0x28c76c[_0xaaed('0x51')]);return rp(_0x28c76c);})['then'](function(_0xd6cbaf){var _0x39cb9c='';var _0x4987d9=0x0;try{fs[_0xaaed('0x20')](_0x4e6572);}catch(_0x48e2f2){logger['error'](_0x48e2f2);}if(_0xd6cbaf&&_0xd6cbaf[_0xaaed('0x52')]){_0x39cb9c=_0xd6cbaf[_0xaaed('0x52')][_0xaaed('0x53')](function(_0x2d844a){return _0x2d844a&&_0x2d844a[_0xaaed('0x54')][0x0]&&_0x2d844a[_0xaaed('0x54')][0x0][_0xaaed('0x55')]?_0x2d844a[_0xaaed('0x54')][0x0][_0xaaed('0x55')]:'';})[_0xaaed('0x56')]('\x0a');_0x4987d9=_0xd6cbaf['results'][_0xaaed('0x53')](function(_0x419be5){return _0x419be5&&_0x419be5[_0xaaed('0x54')][0x0]&&_0x419be5[_0xaaed('0x54')][0x0][_0xaaed('0x57')]?_0x419be5[_0xaaed('0x54')][0x0]['confidence']:0x0;})[_0xaaed('0x56')]('\x0a');}logger['info'](_0xaaed('0x58'),_0x39cb9c);logger[_0xaaed('0x1d')](_0xaaed('0x59'),_0x4987d9);return{'transcript':_0x39cb9c,'confidence':_0x4987d9};})[_0xaaed('0x5a')](function(_0x50b968){logger[_0xaaed('0x17')](_0xaaed('0x5b'),_0x50b968[_0xaaed('0x16')],_0x50b968['name'],_0x50b968[_0xaaed('0x5c')]);});};exports[_0xaaed('0x5d')]=function(_0x442f9a,_0x4cde1b,_0x2dd65e,_0x4fd9b9){var _0x4d4430=apiai(_0x4cde1b,{'language':_0x4fd9b9||'en'});return _0x4d4430[_0xaaed('0x5e')](_0x2dd65e,{'sessionId':md5(_0x442f9a)})[_0xaaed('0x37')](function(_0x370498){logger['info'](JSON['stringify'](_0x370498));return{'source':_0x370498[_0xaaed('0x5f')][_0xaaed('0x60')],'resolvedQuery':_0x370498['result']['resolvedQuery'],'action':_0x370498[_0xaaed('0x5f')][_0xaaed('0x61')],'actionIncomplete':_0x370498[_0xaaed('0x5f')][_0xaaed('0x62')],'speech':_0x370498['result']['fulfillment']['speech'],'score':_0x370498[_0xaaed('0x5f')]['score'],'statusCode':_0x370498[_0xaaed('0x63')][_0xaaed('0x64')],'endConversation':_0x370498[_0xaaed('0x5f')][_0xaaed('0x65')][_0xaaed('0x66')]||![],'isFallbackIntent':_0x370498[_0xaaed('0x5f')][_0xaaed('0x65')][_0xaaed('0x67')]};});};exports[_0xaaed('0x68')]=function(_0x184084,_0x4ec00c,_0xc546c2,_0x48cf47,_0xd50457,_0x31e498){var _0x29b697=_0x48cf47[_0xaaed('0x69')](/\\n/g,'\x0a');var _0x120721={'credentials':{'private_key':_0x29b697,'client_email':_0xc546c2}};var _0x43cc54=new dialogflow[(_0xaaed('0x6a'))](_0x120721);var _0x3dff95=_0x43cc54[_0xaaed('0x6b')](_0x4ec00c,md5(_0x184084));var _0x1230ff={'session':_0x3dff95,'queryInput':{'text':{'text':_0xd50457,'languageCode':_0x31e498}}};return _0x43cc54[_0xaaed('0x6c')](_0x1230ff)[_0xaaed('0x37')](function(_0x27aa47){if(_0x27aa47&&_0x27aa47[_0xaaed('0x4c')]){logger[_0xaaed('0x1d')]('Dialogflow\x20V2\x20response:',JSON[_0xaaed('0x45')](_0x27aa47));var _0x1f4c09=_0x27aa47[0x0];if(_0x1f4c09){var _0x3e0505={'action':_0x1f4c09[_0xaaed('0x6d')][_0xaaed('0x61')],'allRequiredParamsPresent':_0x1f4c09[_0xaaed('0x6d')][_0xaaed('0x6e')],'endConversation':_0x1f4c09['queryResult'][_0xaaed('0x6f')]&&_0x1f4c09['queryResult']['diagnosticInfo'][_0xaaed('0x70')]?_0x1f4c09[_0xaaed('0x6d')]['diagnosticInfo'][_0xaaed('0x70')][_0xaaed('0x71')]['boolValue']:![],'fulfillmentText':_0x1f4c09[_0xaaed('0x6d')][_0xaaed('0x72')],'intentName':_0x1f4c09[_0xaaed('0x6d')][_0xaaed('0x73')][_0xaaed('0x74')],'intentDisplayName':_0x1f4c09[_0xaaed('0x6d')][_0xaaed('0x73')][_0xaaed('0x75')],'isFallbackIntent':_0x1f4c09[_0xaaed('0x6d')][_0xaaed('0x73')][_0xaaed('0x76')],'languageCode':_0x1f4c09[_0xaaed('0x6d')][_0xaaed('0x77')],'queryText':_0x1f4c09[_0xaaed('0x6d')][_0xaaed('0x78')],'responseId':_0x1f4c09[_0xaaed('0x79')],'score':_0x1f4c09[_0xaaed('0x6d')][_0xaaed('0x7a')],'speech':_0x1f4c09[_0xaaed('0x6d')][_0xaaed('0x72')],'providerResponse':JSON[_0xaaed('0x45')](_0x27aa47)};return _0x3e0505;}}});};exports[_0xaaed('0x7b')]=function(_0x4d1733,_0x1c7a2e,_0x2fda6d,_0x5e704a){return tilde[_0xaaed('0x50')](_0x4d1733,_0x1c7a2e,_0x2fda6d,_0x5e704a)['then'](function(_0x185d16){try{fs[_0xaaed('0x20')](_0x4d1733);}catch(_0x93bde2){logger[_0xaaed('0x17')](_0x93bde2);}logger['info'](_0xaaed('0x7c'),_0x185d16['transcript']);logger[_0xaaed('0x1d')](_0xaaed('0x7d'),_0x185d16[_0xaaed('0x57')]);return _0x185d16;});};exports[_0xaaed('0x7e')]=function(_0x3e3bba,_0x513a12,_0x71e361,_0x3f2337,_0x24e178,_0x2e0eb2){var _0x2df40e=path[_0xaaed('0x27')](__dirname,_0xaaed('0x38'),rs['generate'](0x4)+_0xaaed('0x39'));var _0x2ee1f7;return aws[_0xaaed('0x7f')](_0x3e3bba,_0x513a12,_0x71e361,_0x3f2337,_0x24e178,_0x2e0eb2,_0x2df40e)[_0xaaed('0x37')](function(){_0x2ee1f7=path['resolve'](__dirname,'tmp',rs[_0xaaed('0x28')](0x4)+_0xaaed('0x3d'));return convertFile(_0x2df40e,_0x2ee1f7);})['then'](function(){try{fs['unlink'](_0x2df40e);fs[_0xaaed('0x2b')](_0x2ee1f7,_0xaaed('0x2c'));}catch(_0x282d06){logger['error'](_0x282d06);}return _0x2ee1f7[_0xaaed('0x3f')]('.')[0x0];});};exports[_0xaaed('0x80')]=function(_0x261006,_0x293c2e,_0x24f038,_0x1f3064,_0x34e372,_0x809783){return aws[_0xaaed('0x81')](_0x261006,_0x293c2e,_0x24f038,_0x1f3064,_0x34e372,_0x809783)[_0xaaed('0x37')](function(_0x422ad4){logger[_0xaaed('0x1d')](JSON['stringify'](_0x422ad4));return _0x422ad4;});};exports[_0xaaed('0x82')]=function(_0x212a9a,_0x358186,_0x520ea8,_0x2bf08c){var _0x48bb8e=util[_0xaaed('0x83')](_0xaaed('0x84'),ISPEECH_API,_0x212a9a,encodeURIComponent(_0x358186),_0x520ea8,_0x2bf08c);var _0xc50280=path[_0xaaed('0x27')](__dirname,_0xaaed('0x38'),rs['generate'](0x4)+'.mp3');var _0x1f6f41;return downloadFile(_0x48bb8e,_0xc50280)[_0xaaed('0x37')](function(){_0x1f6f41=path[_0xaaed('0x27')](__dirname,_0xaaed('0x38'),rs['generate'](0x4)+_0xaaed('0x3d'));return convertFile(_0xc50280,_0x1f6f41);})[_0xaaed('0x37')](function(){try{fs[_0xaaed('0x20')](_0xc50280);fs['chmodSync'](_0x1f6f41,'777');}catch(_0x48eeba){logger[_0xaaed('0x17')](_0x48eeba);}return _0x1f6f41[_0xaaed('0x3f')]('.')[0x0];});};exports[_0xaaed('0x85')]=function(_0x3c86e9,_0x44386a,_0x3bbf8a,_0x1c1099){var _0x3e2087=util['format'](_0xaaed('0x86'),ISPEECH_API,_0x44386a,_0x3bbf8a,base64Encode(_0x3c86e9),_0x1c1099?util[_0xaaed('0x83')]('model=%s',encodeURIComponent(_0x1c1099)):_0xaaed('0x87'));return uploadFile(_0x3e2087)[_0xaaed('0x37')](function(_0x299790){return querystring[_0xaaed('0xb')](_0x299790);});};exports[_0xaaed('0x88')]=function(_0x7d62e9,_0x218145){return sestek[_0xaaed('0x89')](_0x7d62e9,_0x218145)[_0xaaed('0x37')](function(_0xc86105){logger[_0xaaed('0x1d')](JSON[_0xaaed('0x45')](_0xc86105));var _0x4e08a7={'speech':_0xc86105['text'],'action':_0xc86105['channelData']?_0xc86105[_0xaaed('0x8a')][_0xaaed('0x8b')]:undefined,'actiondata':_0xc86105['channelData']?_0xc86105[_0xaaed('0x8a')][_0xaaed('0x8c')]:undefined};if(_0xc86105[_0xaaed('0x8a')]&&_0xc86105[_0xaaed('0x8a')][_0xaaed('0x8d')]){return base64Decode(_0xc86105[_0xaaed('0x8a')]['AudioFromTts'][_0xaaed('0x8e')],path[_0xaaed('0x27')](__dirname,'tmp',rs[_0xaaed('0x28')](0x4)+'.wav'))[_0xaaed('0x37')](function(_0x96c775){_0x4e08a7[_0xaaed('0x8f')]=_0x96c775;return _0x4e08a7;});}return _0x4e08a7;});};exports[_0xaaed('0x90')]=function(){return __dirname;}; \ No newline at end of file +var _0xdef8=['replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','intent','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','awsPolly','polly','awsLex','lex','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','nda','text','channelData','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','md5','path','querystring','request-promise','randomstring','sox','google-tts-api','url','parse','util','./aws','./google','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','host','WHAT_EVER','get','statusCode','\x20failed,\x20status\x20code\x20=\x20','statusMessage','request\x20to\x20','createWriteStream','finish','info','finish\x20download\x20file','close','error','unlink','download\x20error','pipe','end','https:','data','transcode','error\x20convert','finish\x20to\x20convert','start','tmp','generate','.wav','writeFileSync','base64','then','chmodSync','777','readFileSync','toString','googleCloudTTS','?key=','input','voice','MP3','text:synthesize','POST','resolve','googleCloudTTS\x20path','split','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','stringify','null','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','.mp3','goggleTTS\x20path','googleASR','asr','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdef8,0x1d3));var _0x8def=function(_0x113183,_0x12dba2){_0x113183=_0x113183-0x0;var _0x2197c4=_0xdef8[_0x113183];return _0x2197c4;};'use strict';var apiai=require(_0x8def('0x0'));var BPromise=require(_0x8def('0x1'));var dialogflow=require(_0x8def('0x2'));var fs=require('fs');var http=require('http');var https=require('https');var md5=require(_0x8def('0x3'));var path=require(_0x8def('0x4'));var querystring=require(_0x8def('0x5'));var rp=require(_0x8def('0x6'));var rs=require(_0x8def('0x7'));var sox=require(_0x8def('0x8'));var tts=require(_0x8def('0x9'));var urlParse=require(_0x8def('0xa'))[_0x8def('0xb')];var util=require(_0x8def('0xc'));var aws=require(_0x8def('0xd'));var google=require(_0x8def('0xe'));var sestek=require('./sestek');var tilde=require(_0x8def('0xf'));var logger=require(_0x8def('0x10'))(_0x8def('0x11'));var ISPEECH_API=_0x8def('0x12');function downloadFile(_0x548ca9,_0x3956ed){return new BPromise(function(_0x3ac908,_0x5ae7ac){var _0x5155b0=urlParse(_0x548ca9);var _0x120b6d=_0x5155b0[_0x8def('0x13')]==='https:'?https:http;var _0x47f754={'host':_0x5155b0[_0x8def('0x14')],'path':_0x5155b0[_0x8def('0x4')],'headers':{'user-agent':_0x8def('0x15')}};_0x120b6d[_0x8def('0x16')](_0x47f754,function(_0x2293d6){if(_0x2293d6[_0x8def('0x17')]!==0xc8){logger['error']('request\x20to\x20'+_0x548ca9+_0x8def('0x18')+_0x2293d6['statusCode']+'\x20('+_0x2293d6[_0x8def('0x19')]+')');_0x5ae7ac(new Error(_0x8def('0x1a')+_0x548ca9+_0x8def('0x18')+_0x2293d6[_0x8def('0x17')]+'\x20('+_0x2293d6[_0x8def('0x19')]+')'));return;}var _0x1522ba=fs[_0x8def('0x1b')](_0x3956ed);_0x1522ba['on'](_0x8def('0x1c'),function(){logger[_0x8def('0x1d')](_0x8def('0x1e'));_0x1522ba[_0x8def('0x1f')](_0x3ac908);});_0x1522ba['on'](_0x8def('0x20'),function(_0x1bf1d7){fs[_0x8def('0x21')](_0x3956ed);logger[_0x8def('0x20')](_0x8def('0x22'),_0x1bf1d7);_0x5ae7ac(_0x1bf1d7);});_0x2293d6[_0x8def('0x23')](_0x1522ba);})['on'](_0x8def('0x20'),function(_0x3be9c5){logger['error'](_0x3be9c5);_0x5ae7ac(_0x3be9c5);})[_0x8def('0x24')]();});}function uploadFile(_0x49b9b6){return new BPromise(function(_0x437c2c,_0x84c615){var _0x31b8af=urlParse(_0x49b9b6);var _0x58c28e=_0x31b8af[_0x8def('0x13')]===_0x8def('0x25')?https:http;var _0x208ccb={'host':_0x31b8af[_0x8def('0x14')],'path':_0x31b8af[_0x8def('0x4')],'headers':{'user-agent':_0x8def('0x15')}};_0x58c28e[_0x8def('0x16')](_0x208ccb,function(_0xe19727){if(_0xe19727[_0x8def('0x17')]!==0xc8){_0x84c615(new Error(_0x8def('0x1a')+_0x49b9b6+'\x20failed,\x20status\x20code\x20=\x20'+_0xe19727['statusCode']+'\x20('+_0xe19727[_0x8def('0x19')]+')'));return;}var _0x3badb9='';_0xe19727['on'](_0x8def('0x26'),function(_0x2de022){_0x3badb9+=_0x2de022;});_0xe19727['on']('end',function(){_0x437c2c(_0x3badb9);});})['on'](_0x8def('0x20'),function(_0x3a91d1){_0x84c615(_0x3a91d1);})[_0x8def('0x24')]();});}function convertFile(_0x18fe2a,_0x223d5f){return new BPromise(function(_0xa94405,_0x1bee1b){var _0x503899=sox[_0x8def('0x27')](_0x18fe2a,_0x223d5f,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x503899['on'](_0x8def('0x20'),function(_0xc96019){logger[_0x8def('0x20')](_0x8def('0x28'),_0xc96019);_0x1bee1b(_0xc96019);});_0x503899['on'](_0x8def('0x24'),function(){logger[_0x8def('0x1d')](_0x8def('0x29'));_0xa94405();});_0x503899[_0x8def('0x2a')]();});}function base64Decode(_0x3c57db,_0x1eebce){var _0x530af8=path['resolve'](__dirname,_0x8def('0x2b'),rs[_0x8def('0x2c')](0x4)+_0x8def('0x2d'));fs[_0x8def('0x2e')](_0x530af8,_0x3c57db,_0x8def('0x2f'));return convertFile(_0x530af8,_0x1eebce)[_0x8def('0x30')](function(){try{fs[_0x8def('0x21')](_0x530af8);fs[_0x8def('0x31')](_0x1eebce,_0x8def('0x32'));}catch(_0x36a407){logger[_0x8def('0x20')](_0x36a407);}return _0x1eebce['split']('.')[0x0];});}function base64Encode(_0x5a3972){var _0x21a696=fs[_0x8def('0x33')](_0x5a3972);return new Buffer(_0x21a696)[_0x8def('0x34')](_0x8def('0x2f'));}exports[_0x8def('0x35')]=function(_0x4d7f11,_0x57b006,_0x45a845,_0x5a9569,_0x37a16d,_0x27896a){var _0x92ccb9,_0x3f9d7b;var _0x5518ca='https://texttospeech.googleapis.com/v1/';var _0x24902a=_0x8def('0x36')+_0x4d7f11;var _0x15b17f={};if(_0x57b006==='ssml'){_0x15b17f[_0x8def('0x37')]={'ssml':_0x45a845};}else{_0x15b17f[_0x8def('0x37')]={'text':_0x45a845};};_0x15b17f[_0x8def('0x38')]={'languageCode':_0x5a9569,'ssmlGender':_0x37a16d};_0x15b17f['audioConfig']={'audioEncoding':_0x8def('0x39'),'sampleRateHertz':0x1f40};var _0x2c7df6={'url':_0x5518ca+_0x8def('0x3a')+_0x24902a,'method':_0x8def('0x3b'),'json':!![],'body':_0x15b17f};return rp(_0x2c7df6)['then'](function(_0x2a579c){return new BPromise(function(_0x121ad7,_0x4cd7cd){_0x92ccb9=path[_0x8def('0x3c')](__dirname,_0x8def('0x2b'),rs[_0x8def('0x2c')](0x4)+'.mp3');var _0x21b93e=Buffer['from'](_0x2a579c['audioContent'],'base64');return fs['writeFile'](_0x92ccb9,_0x21b93e,function(_0x1c672a){_0x4cd7cd(_0x1c672a);},function(_0x221e43){fs[_0x8def('0x31')](_0x92ccb9,_0x8def('0x32'));_0x121ad7(_0x221e43);});});})[_0x8def('0x30')](function(_0x731be4){_0x3f9d7b=path['resolve'](__dirname,_0x8def('0x2b'),rs[_0x8def('0x2c')](0x4)+_0x8def('0x2d'));return convertFile(_0x92ccb9,_0x3f9d7b);})[_0x8def('0x30')](function(){try{fs['unlink'](_0x92ccb9);fs[_0x8def('0x31')](_0x3f9d7b,_0x8def('0x32'));}catch(_0x27700){logger[_0x8def('0x20')](_0x27700);}logger[_0x8def('0x1d')](_0x8def('0x3d'),_0x3f9d7b['split']('.')[0x0]);return _0x3f9d7b[_0x8def('0x3e')]('.')[0x0];});};exports['googleTTS']=function(_0xc25a65,_0x5acad5){var _0x500b09=_0x8def('0x3f');var _0x5b4350,_0xf75097;var _0x1754fa;var _0x3f3525={'encoding':_0x8def('0x40'),'method':_0x8def('0x3b'),'timeout':0x2710,'url':_0x500b09,'headers':{'Content-Type':_0x8def('0x41')},'body':'f.req='+encodeURIComponent(JSON[_0x8def('0x42')]([[['jQ1olc',JSON['stringify']([_0xc25a65,_0x5acad5||'en',![],_0x8def('0x43')]),null,_0x8def('0x44')]]]))};return rp(_0x3f3525)['then'](function(_0x539aa4){try{_0x1754fa=eval(_0x539aa4[_0x8def('0x45')](0x5))[0x0][0x2];}catch(_0x3c3845){throw new Error(_0x8def('0x46')+_0x539aa4['data']);}if(!_0x1754fa){if(_0xc25a65[_0x8def('0x47')]>0xc8){throw new Error(_0x8def('0x48'));}else{throw new Error(_0x8def('0x49')+_0x5acad5+_0x8def('0x4a'));}}try{_0x1754fa=eval(_0x1754fa)[0x0];}catch(_0x901d9c){throw new Error('parse\x20response\x20failed:\x0a'+res[_0x8def('0x26')]);}const _0x11e152=_0x1754fa;_0x5b4350=path[_0x8def('0x3c')](__dirname,_0x8def('0x2b'),rs[_0x8def('0x2c')](0x4)+_0x8def('0x4b'));fs['writeFileSync'](_0x5b4350,_0x1754fa,{'encoding':'base64'});_0xf75097=path[_0x8def('0x3c')](__dirname,_0x8def('0x2b'),rs[_0x8def('0x2c')](0x4)+_0x8def('0x2d'));return convertFile(_0x5b4350,_0xf75097);})[_0x8def('0x30')](function(){try{fs['unlink'](_0x5b4350);fs[_0x8def('0x31')](_0xf75097,_0x8def('0x32'));}catch(_0x49ce97){logger[_0x8def('0x20')](_0x49ce97);}logger['info'](_0x8def('0x4c'),_0xf75097[_0x8def('0x3e')]('.')[0x0]);return _0xf75097[_0x8def('0x3e')]('.')[0x0];});};exports[_0x8def('0x4d')]=function(_0x5cc5ee,_0x410ba1,_0x269496){return google[_0x8def('0x4e')](_0x5cc5ee,_0x410ba1,_0x269496)['then'](function(_0x2c823f){logger[_0x8def('0x1d')](_0x2c823f['uri']);return rp(_0x2c823f);})[_0x8def('0x30')](function(_0x2b1456){var _0x56ef5a='';var _0xe32976=0x0;try{fs[_0x8def('0x21')](_0x5cc5ee);}catch(_0x21b46f){logger[_0x8def('0x20')](_0x21b46f);}if(_0x2b1456&&_0x2b1456[_0x8def('0x4f')]){_0x56ef5a=_0x2b1456['results'][_0x8def('0x50')](function(_0x2926a1){return _0x2926a1&&_0x2926a1[_0x8def('0x51')][0x0]&&_0x2926a1[_0x8def('0x51')][0x0][_0x8def('0x52')]?_0x2926a1[_0x8def('0x51')][0x0][_0x8def('0x52')]:'';})[_0x8def('0x53')]('\x0a');_0xe32976=_0x2b1456['results']['map'](function(_0x69239){return _0x69239&&_0x69239[_0x8def('0x51')][0x0]&&_0x69239[_0x8def('0x51')][0x0][_0x8def('0x54')]?_0x69239['alternatives'][0x0][_0x8def('0x54')]:0x0;})['join']('\x0a');}logger[_0x8def('0x1d')](_0x8def('0x55'),_0x56ef5a);logger[_0x8def('0x1d')]('googleASR\x20confidence',_0xe32976);return{'transcript':_0x56ef5a,'confidence':_0xe32976};})[_0x8def('0x56')](function(_0x1b23e0){logger[_0x8def('0x20')](_0x8def('0x57'),_0x1b23e0['statusCode'],_0x1b23e0[_0x8def('0x58')],_0x1b23e0[_0x8def('0x59')]);});};exports[_0x8def('0x5a')]=function(_0x48218b,_0x40e250,_0x237d8d,_0x3eb268){var _0x462070=apiai(_0x40e250,{'language':_0x3eb268||'en'});return _0x462070[_0x8def('0x5b')](_0x237d8d,{'sessionId':md5(_0x48218b)})[_0x8def('0x30')](function(_0x12152c){logger[_0x8def('0x1d')](JSON[_0x8def('0x42')](_0x12152c));return{'source':_0x12152c[_0x8def('0x5c')]['source'],'resolvedQuery':_0x12152c['result'][_0x8def('0x5d')],'action':_0x12152c[_0x8def('0x5c')][_0x8def('0x5e')],'actionIncomplete':_0x12152c[_0x8def('0x5c')][_0x8def('0x5f')],'speech':_0x12152c[_0x8def('0x5c')][_0x8def('0x60')][_0x8def('0x61')],'score':_0x12152c[_0x8def('0x5c')][_0x8def('0x62')],'statusCode':_0x12152c[_0x8def('0x63')][_0x8def('0x64')],'endConversation':_0x12152c[_0x8def('0x5c')][_0x8def('0x65')][_0x8def('0x66')]||![],'isFallbackIntent':_0x12152c[_0x8def('0x5c')][_0x8def('0x65')][_0x8def('0x67')]};});};exports[_0x8def('0x68')]=function(_0x3c48ab,_0x269b0e,_0x2fd38e,_0x2d6f7d,_0x4e760e,_0x1b91a8){var _0x3eb29d=_0x2d6f7d[_0x8def('0x69')](/\\n/g,'\x0a');var _0x576c75={'credentials':{'private_key':_0x3eb29d,'client_email':_0x2fd38e}};var _0x256362=new dialogflow[(_0x8def('0x6a'))](_0x576c75);var _0xeb86e9=_0x256362[_0x8def('0x6b')](_0x269b0e,md5(_0x3c48ab));var _0x30b1c4={'session':_0xeb86e9,'queryInput':{'text':{'text':_0x4e760e,'languageCode':_0x1b91a8}}};return _0x256362[_0x8def('0x6c')](_0x30b1c4)['then'](function(_0x43ab20){if(_0x43ab20&&_0x43ab20['length']){logger[_0x8def('0x1d')](_0x8def('0x6d'),JSON[_0x8def('0x42')](_0x43ab20));var _0x404654=_0x43ab20[0x0];if(_0x404654){var _0x1268fd={'action':_0x404654['queryResult']['action'],'allRequiredParamsPresent':_0x404654[_0x8def('0x6e')][_0x8def('0x6f')],'endConversation':_0x404654['queryResult'][_0x8def('0x70')]&&_0x404654[_0x8def('0x6e')][_0x8def('0x70')][_0x8def('0x71')]?_0x404654[_0x8def('0x6e')][_0x8def('0x70')][_0x8def('0x71')][_0x8def('0x72')][_0x8def('0x73')]:![],'fulfillmentText':_0x404654[_0x8def('0x6e')]['fulfillmentText'],'intentName':_0x404654[_0x8def('0x6e')][_0x8def('0x74')][_0x8def('0x58')],'intentDisplayName':_0x404654['queryResult'][_0x8def('0x74')][_0x8def('0x75')],'isFallbackIntent':_0x404654['queryResult']['intent'][_0x8def('0x76')],'languageCode':_0x404654[_0x8def('0x6e')][_0x8def('0x77')],'queryText':_0x404654[_0x8def('0x6e')][_0x8def('0x78')],'responseId':_0x404654[_0x8def('0x79')],'score':_0x404654[_0x8def('0x6e')][_0x8def('0x7a')],'speech':_0x404654['queryResult']['fulfillmentText'],'providerResponse':JSON[_0x8def('0x42')](_0x43ab20)};return _0x1268fd;}}});};exports[_0x8def('0x7b')]=function(_0x367504,_0x286e05,_0x36819c,_0x42323d){return tilde[_0x8def('0x4e')](_0x367504,_0x286e05,_0x36819c,_0x42323d)[_0x8def('0x30')](function(_0x26d682){try{fs[_0x8def('0x21')](_0x367504);}catch(_0x4a940c){logger['error'](_0x4a940c);}logger[_0x8def('0x1d')](_0x8def('0x7c'),_0x26d682[_0x8def('0x52')]);logger[_0x8def('0x1d')]('Tilde\x20ASR\x20confidence',_0x26d682[_0x8def('0x54')]);return _0x26d682;});};exports[_0x8def('0x7d')]=function(_0x5bb57e,_0x4fa2ca,_0xf24df5,_0x4029fe,_0x166832,_0x1d95e9){var _0x5799a7=path[_0x8def('0x3c')](__dirname,_0x8def('0x2b'),rs[_0x8def('0x2c')](0x4)+_0x8def('0x4b'));var _0x2d65aa;return aws[_0x8def('0x7e')](_0x5bb57e,_0x4fa2ca,_0xf24df5,_0x4029fe,_0x166832,_0x1d95e9,_0x5799a7)[_0x8def('0x30')](function(){_0x2d65aa=path[_0x8def('0x3c')](__dirname,_0x8def('0x2b'),rs[_0x8def('0x2c')](0x4)+'.wav');return convertFile(_0x5799a7,_0x2d65aa);})[_0x8def('0x30')](function(){try{fs[_0x8def('0x21')](_0x5799a7);fs[_0x8def('0x31')](_0x2d65aa,_0x8def('0x32'));}catch(_0x5e9e7e){logger[_0x8def('0x20')](_0x5e9e7e);}return _0x2d65aa['split']('.')[0x0];});};exports[_0x8def('0x7f')]=function(_0x3f502a,_0x4cb39b,_0x3a392c,_0x352dec,_0xb303e2,_0x158a6d){return aws[_0x8def('0x80')](_0x3f502a,_0x4cb39b,_0x3a392c,_0x352dec,_0xb303e2,_0x158a6d)['then'](function(_0x1c3133){logger['info'](JSON[_0x8def('0x42')](_0x1c3133));return _0x1c3133;});};exports[_0x8def('0x81')]=function(_0x35ede5,_0x3120fd,_0x46555c,_0x53601a){var _0x5485e6=util['format'](_0x8def('0x82'),ISPEECH_API,_0x35ede5,encodeURIComponent(_0x3120fd),_0x46555c,_0x53601a);var _0x15365d=path[_0x8def('0x3c')](__dirname,'tmp',rs[_0x8def('0x2c')](0x4)+_0x8def('0x4b'));var _0x4be4b2;return downloadFile(_0x5485e6,_0x15365d)[_0x8def('0x30')](function(){_0x4be4b2=path[_0x8def('0x3c')](__dirname,'tmp',rs[_0x8def('0x2c')](0x4)+_0x8def('0x2d'));return convertFile(_0x15365d,_0x4be4b2);})[_0x8def('0x30')](function(){try{fs[_0x8def('0x21')](_0x15365d);fs[_0x8def('0x31')](_0x4be4b2,'777');}catch(_0x4cc41c){logger[_0x8def('0x20')](_0x4cc41c);}return _0x4be4b2['split']('.')[0x0];});};exports['ispeechASR']=function(_0x4df862,_0x36f025,_0xa4fa2d,_0x54bef8){var _0xf8dabb=util[_0x8def('0x83')](_0x8def('0x84'),ISPEECH_API,_0x36f025,_0xa4fa2d,base64Encode(_0x4df862),_0x54bef8?util['format'](_0x8def('0x85'),encodeURIComponent(_0x54bef8)):_0x8def('0x86'));return uploadFile(_0xf8dabb)[_0x8def('0x30')](function(_0x1d876d){return querystring['parse'](_0x1d876d);});};exports['sestekNDA']=function(_0x54f6cd,_0x4bf03d){return sestek[_0x8def('0x87')](_0x54f6cd,_0x4bf03d)[_0x8def('0x30')](function(_0x15fc2a){logger[_0x8def('0x1d')](JSON['stringify'](_0x15fc2a));var _0x47f4fe={'speech':_0x15fc2a[_0x8def('0x88')],'action':_0x15fc2a[_0x8def('0x89')]?_0x15fc2a[_0x8def('0x89')]['CustomAction']:undefined,'actiondata':_0x15fc2a[_0x8def('0x89')]?_0x15fc2a[_0x8def('0x89')][_0x8def('0x8a')]:undefined};if(_0x15fc2a[_0x8def('0x89')]&&_0x15fc2a[_0x8def('0x89')][_0x8def('0x8b')]){return base64Decode(_0x15fc2a['channelData']['AudioFromTts'][_0x8def('0x8c')],path[_0x8def('0x3c')](__dirname,_0x8def('0x2b'),rs['generate'](0x4)+_0x8def('0x2d')))[_0x8def('0x30')](function(_0x458fa){_0x47f4fe[_0x8def('0x8d')]=_0x458fa;return _0x47f4fe;});}return _0x47f4fe;});};exports[_0x8def('0x8e')]=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index 4ccf20c..a720fa1 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 _0x10e6=['exports','./nda'];(function(_0x19409d,_0xf48905){var _0x5de146=function(_0x117745){while(--_0x117745){_0x19409d['push'](_0x19409d['shift']());}};_0x5de146(++_0xf48905);}(_0x10e6,0x173));var _0x610e=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x10e6[_0x33032e];return _0x13316b;};var nda=require(_0x610e('0x0'));module[_0x610e('0x1')]={'nda':nda}; \ No newline at end of file +var _0x4671=['exports','./nda'];(function(_0xe06071,_0x4eeaa1){var _0x8ad8be=function(_0xb48521){while(--_0xb48521){_0xe06071['push'](_0xe06071['shift']());}};_0x8ad8be(++_0x4eeaa1);}(_0x4671,0x8f));var _0x1467=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4671[_0x14add3];return _0x4a174f;};var nda=require(_0x1467('0x0'));module[_0x1467('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 679f33b..eadd81d 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 _0x7980=['agi','exports','POST','resolve','ndauth_url','password','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','text','Bearer\x20','body','channelData','ProjectName','project','ndagenerate_audio','custom_action','custom_action_data','stringify','request-promise','url','../../../../../config/logger'];(function(_0x176e9a,_0x3adab9){var _0x4bbbac=function(_0x21e84b){while(--_0x21e84b){_0x176e9a['push'](_0x176e9a['shift']());}};_0x4bbbac(++_0x3adab9);}(_0x7980,0xab));var _0x0798=function(_0x1ec31e,_0x3d0030){_0x1ec31e=_0x1ec31e-0x0;var _0x477e2a=_0x7980[_0x1ec31e];return _0x477e2a;};'use strict';var rp=require(_0x0798('0x0'));var url=require(_0x0798('0x1'));var logger=require(_0x0798('0x2'))(_0x0798('0x3'));module[_0x0798('0x4')]=function(_0x48285b,_0x3a9ff7){var _0x31597d={'method':_0x0798('0x5'),'uri':url[_0x0798('0x6')](_0x3a9ff7[_0x0798('0x7')],'/token'),'form':{'grant_type':_0x0798('0x8'),'username':_0x3a9ff7['username'],'password':_0x3a9ff7[_0x0798('0x8')]},'json':!![]};return rp(_0x31597d)[_0x0798('0x9')](function(_0x467859){var _0x54da10={'method':'POST','uri':url[_0x0798('0x6')](_0x3a9ff7[_0x0798('0xa')],_0x0798('0xb')),'body':{'type':_0x3a9ff7[_0x0798('0xc')]||_0x0798('0xd'),'channelId':_0x0798('0xe'),'conversation':{'id':_0x48285b[_0x0798('0xf')]},'from':{'id':_0x48285b[_0x0798('0x10')],'name':_0x48285b[_0x0798('0x11')]},'recipient':{'id':_0x48285b[_0x0798('0x12')],'name':_0x48285b['extension']},'text':_0x3a9ff7[_0x0798('0x13')],'channelData':{}},'headers':{'Authorization':_0x0798('0x14')+_0x467859['access_token']},'json':!![]};if(_0x3a9ff7['project']){_0x54da10[_0x0798('0x15')][_0x0798('0x16')][_0x0798('0x17')]=_0x3a9ff7[_0x0798('0x18')];}if(_0x3a9ff7[_0x0798('0x19')]=='1'){_0x54da10[_0x0798('0x15')][_0x0798('0x16')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x3a9ff7[_0x0798('0x1a')]){_0x54da10[_0x0798('0x15')]['channelData']['CustomAction']=_0x3a9ff7[_0x0798('0x1a')];if(_0x3a9ff7[_0x0798('0x1b')]){_0x54da10[_0x0798('0x15')]['channelData']['CustomActionData']=_0x3a9ff7[_0x0798('0x1b')];}}logger['info'](JSON[_0x0798('0x1c')](_0x54da10));return rp(_0x54da10);});}; \ No newline at end of file +var _0x9086=['exports','POST','ndauth_url','username','then','resolve','/api/NaturalDialogAssistant/v1/Run','message','Nda','uniqueid','callerid','calleridname','extension','text','Bearer\x20','access_token','project','body','channelData','ProjectName','AudioOutputSettings','audio/wav','CustomAction','custom_action','custom_action_data','CustomActionData','info','request-promise','url','agi'];(function(_0xbac38b,_0x594e20){var _0x353527=function(_0xa6cfb0){while(--_0xa6cfb0){_0xbac38b['push'](_0xbac38b['shift']());}};_0x353527(++_0x594e20);}(_0x9086,0x10b));var _0x6908=function(_0x19d828,_0x2439ce){_0x19d828=_0x19d828-0x0;var _0x25b133=_0x9086[_0x19d828];return _0x25b133;};'use strict';var rp=require(_0x6908('0x0'));var url=require(_0x6908('0x1'));var logger=require('../../../../../config/logger')(_0x6908('0x2'));module[_0x6908('0x3')]=function(_0x38d58b,_0x230e29){var _0x17351a={'method':_0x6908('0x4'),'uri':url['resolve'](_0x230e29[_0x6908('0x5')],'/token'),'form':{'grant_type':'password','username':_0x230e29[_0x6908('0x6')],'password':_0x230e29['password']},'json':!![]};return rp(_0x17351a)[_0x6908('0x7')](function(_0x2049a1){var _0x2ce577={'method':'POST','uri':url[_0x6908('0x8')](_0x230e29['ndassistant_url'],_0x6908('0x9')),'body':{'type':_0x230e29['ndaactivity_type']||_0x6908('0xa'),'channelId':_0x6908('0xb'),'conversation':{'id':_0x38d58b[_0x6908('0xc')]},'from':{'id':_0x38d58b[_0x6908('0xd')],'name':_0x38d58b[_0x6908('0xe')]},'recipient':{'id':_0x38d58b['dnid'],'name':_0x38d58b[_0x6908('0xf')]},'text':_0x230e29[_0x6908('0x10')],'channelData':{}},'headers':{'Authorization':_0x6908('0x11')+_0x2049a1[_0x6908('0x12')]},'json':!![]};if(_0x230e29[_0x6908('0x13')]){_0x2ce577[_0x6908('0x14')][_0x6908('0x15')][_0x6908('0x16')]=_0x230e29[_0x6908('0x13')];}if(_0x230e29['ndagenerate_audio']=='1'){_0x2ce577[_0x6908('0x14')]['channelData'][_0x6908('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x6908('0x18')};}if(_0x230e29['custom_action']){_0x2ce577[_0x6908('0x14')][_0x6908('0x15')][_0x6908('0x19')]=_0x230e29[_0x6908('0x1a')];if(_0x230e29[_0x6908('0x1b')]){_0x2ce577['body']['channelData'][_0x6908('0x1c')]=_0x230e29[_0x6908('0x1b')];}}logger[_0x6908('0x1d')](JSON['stringify'](_0x2ce577));return rp(_0x2ce577);});}; \ No newline at end of file diff --git a/server/services/agi/scripts/tilde/asr/index.js b/server/services/agi/scripts/tilde/asr/index.js index d6ffd21..844af1b 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 _0x1666=['./lib/api'];(function(_0x25bca6,_0xe415ea){var _0x3f8d02=function(_0x3e581b){while(--_0x3e581b){_0x25bca6['push'](_0x25bca6['shift']());}};_0x3f8d02(++_0xe415ea);}(_0x1666,0xf7));var _0x6166=function(_0x3b8458,_0x225c6b){_0x3b8458=_0x3b8458-0x0;var _0x44c9a7=_0x1666[_0x3b8458];return _0x44c9a7;};'use strict';var asr=require(_0x6166('0x0'));module['exports']=function(_0x1d87e4,_0x164a1d,_0x213e91,_0x1733a8){return asr(_0x1d87e4,_0x164a1d,_0x213e91,_0x1733a8);}; \ No newline at end of file +var _0xf954=['./lib/api','exports'];(function(_0x27451a,_0x2d14e0){var _0x2296d3=function(_0x4e4042){while(--_0x4e4042){_0x27451a['push'](_0x27451a['shift']());}};_0x2296d3(++_0x2d14e0);}(_0xf954,0x10e));var _0x4f95=function(_0x4c06ac,_0x568788){_0x4c06ac=_0x4c06ac-0x0;var _0x2333cb=_0xf954[_0x4c06ac];return _0x2333cb;};'use strict';var asr=require(_0x4f95('0x0'));module[_0x4f95('0x1')]=function(_0xff99e2,_0x3566ed,_0x3a559c,_0x32b836){return asr(_0xff99e2,_0x3566ed,_0x3a559c,_0x32b836);}; \ No newline at end of file diff --git a/server/services/agi/scripts/tilde/asr/lib/api.js b/server/services/agi/scripts/tilde/asr/lib/api.js index 272ab71..62b970c 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 _0x8d10=['send','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','result','final','Tilde\x20ASR\x20hypoteses','transcript','hypotheses','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','lodash','moment','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','unix','stringify','createReadStream','data','close'];(function(_0x1bf809,_0x536f55){var _0x1caa4e=function(_0x9f9636){while(--_0x9f9636){_0x1bf809['push'](_0x1bf809['shift']());}};_0x1caa4e(++_0x536f55);}(_0x8d10,0x1af));var _0x08d1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8d10[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require('bluebird');var _=require(_0x08d1('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x08d1('0x1'));var crypto=require(_0x08d1('0x2'));var logger=require(_0x08d1('0x3'))(_0x08d1('0x4'));module[_0x08d1('0x5')]=function(_0x2c4604,_0xbe46df,_0x1ecf90,_0x20b2a3){return new BPromise(function(_0x2b89d7,_0x36657b){logger[_0x08d1('0x6')](_0x08d1('0x7'),_0x20b2a3||_0x08d1('0x8'));var _0x5b0ffc=new WebSocket(_0x20b2a3||_0x08d1('0x8'),{'perMessageDeflate':![]});var _0x560d0c='';var _0x2b9c1c='0';var _0x33902b='1';var _0x3c4f0b=_0x08d1('0x9');function _0x73b14a(_0x23c949){var _0x5310a9=crypto[_0x08d1('0xa')](_0x08d1('0xb'));_0x5310a9[_0x08d1('0xc')](_0x23c949);return _0x5310a9[_0x08d1('0xd')](_0x08d1('0xe'));}function _0x3447ce(){try{logger['info']('Open\x20Tilde\x20ASR\x20socket');var _0x19ea77=moment()[_0x08d1('0xf')]();var _0x27a162=_0x73b14a(_0x19ea77+_0xbe46df+_0x1ecf90);_0x5b0ffc['send'](JSON[_0x08d1('0x10')]({'appID':_0xbe46df,'timestamp':_0x19ea77,'appKey':_0x27a162}));var _0x3d5bad=fs[_0x08d1('0x11')](_0x2c4604);_0x3d5bad['on'](_0x08d1('0x12'),function(_0x2f2846){_0x5b0ffc['send'](_0x2f2846);});_0x3d5bad['on'](_0x08d1('0x13'),function(){_0x5b0ffc[_0x08d1('0x14')](_0x08d1('0x15'));});}catch(_0x32e306){logger[_0x08d1('0x16')](_0x08d1('0x17'),JSON['stringify'](_0x32e306));_0x5b0ffc[_0x08d1('0x18')]();}}function _0x213ee7(_0x1541fe){try{if(_0x1541fe){var _0x508150=JSON[_0x08d1('0x19')](_0x1541fe);switch(_0x508150['status']){case 0x0:if(_0x508150[_0x08d1('0x1a')]){if(_0x508150[_0x08d1('0x1a')][_0x08d1('0x1b')]){logger[_0x08d1('0x6')](_0x08d1('0x1c'),JSON[_0x08d1('0x10')](_0x508150[_0x08d1('0x1a')]['hypotheses']));_0x560d0c=_0x508150[_0x08d1('0x1a')]['hypotheses'][0x0][_0x08d1('0x1d')];_0x2b9c1c=_0x508150[_0x08d1('0x1a')][_0x08d1('0x1e')][0x0]['likelihood'];_0x33902b='0';_0x3c4f0b=_0x08d1('0x1f');_0x5b0ffc[_0x08d1('0x18')]();}}break;case 0x1:logger[_0x08d1('0x6')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x33902b='1';_0x3c4f0b=_0x08d1('0x9');break;case 0x2:logger[_0x08d1('0x6')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x33902b='2';_0x3c4f0b=_0x08d1('0x20');break;case 0x9:logger[_0x08d1('0x6')](_0x08d1('0x21'));_0x33902b='9';_0x3c4f0b=_0x08d1('0x21');break;case 0xa:logger['info'](_0x08d1('0x22'));_0x33902b='10';_0x3c4f0b='Authentication\x20failed.';break;case 0xb:logger[_0x08d1('0x6')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x33902b='11';_0x3c4f0b='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x29aea8){logger[_0x08d1('0x16')](_0x08d1('0x23'),JSON[_0x08d1('0x10')](_0x29aea8));_0x5b0ffc[_0x08d1('0x18')]();}}function _0xdcb41(){logger[_0x08d1('0x6')](_0x08d1('0x24'));_0x2b89d7({'transcript':_0x560d0c,'confidence':_0x2b9c1c,'status':_0x33902b,'status_message':_0x3c4f0b});}function _0x3ef8b1(_0x2e5f18){logger[_0x08d1('0x16')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x08d1('0x25')](_0x2e5f18)){logger['error'](_[_0x08d1('0x26')](_0x2e5f18)?JSON[_0x08d1('0x10')](_0x2e5f18):_0x2e5f18);}}_0x5b0ffc['on'](_0x08d1('0x27'),_0x3447ce);_0x5b0ffc['on'](_0x08d1('0x28'),_0x213ee7);_0x5b0ffc['on'](_0x08d1('0x13'),_0xdcb41);_0x5b0ffc['on'](_0x08d1('0x16'),_0x3ef8b1);});}; \ No newline at end of file +var _0xf6e4=['digest','Open\x20Tilde\x20ASR\x20socket','unix','stringify','createReadStream','data','send','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','hypotheses','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','message','bluebird','crypto','../../../../../../config/logger','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','update'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xf6e4,0x1be));var _0x4f6e=function(_0x45f854,_0x1c95dc){_0x45f854=_0x45f854-0x0;var _0x3d4c00=_0xf6e4[_0x45f854];return _0x3d4c00;};'use strict';var BPromise=require(_0x4f6e('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x4f6e('0x1'));var logger=require(_0x4f6e('0x2'))('agi');module[_0x4f6e('0x3')]=function(_0x7b2876,_0x2fd762,_0x1050a3,_0x45ea14){return new BPromise(function(_0x504493,_0x14203c){logger[_0x4f6e('0x4')](_0x4f6e('0x5'),_0x45ea14||_0x4f6e('0x6'));var _0x546bff=new WebSocket(_0x45ea14||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x4afef9='';var _0x50e2f1='0';var _0x5d2495='1';var _0x271305=_0x4f6e('0x7');function _0x50be16(_0x24c4d4){var _0x2e1487=crypto[_0x4f6e('0x8')]('sha1');_0x2e1487[_0x4f6e('0x9')](_0x24c4d4);return _0x2e1487[_0x4f6e('0xa')]('hex');}function _0x2aef93(){try{logger[_0x4f6e('0x4')](_0x4f6e('0xb'));var _0x219e0b=moment()[_0x4f6e('0xc')]();var _0x497388=_0x50be16(_0x219e0b+_0x2fd762+_0x1050a3);_0x546bff['send'](JSON[_0x4f6e('0xd')]({'appID':_0x2fd762,'timestamp':_0x219e0b,'appKey':_0x497388}));var _0xc8cdac=fs[_0x4f6e('0xe')](_0x7b2876);_0xc8cdac['on'](_0x4f6e('0xf'),function(_0x106165){_0x546bff[_0x4f6e('0x10')](_0x106165);});_0xc8cdac['on'](_0x4f6e('0x11'),function(){_0x546bff[_0x4f6e('0x10')](_0x4f6e('0x12'));});}catch(_0x192fae){logger[_0x4f6e('0x13')](_0x4f6e('0x14'),JSON[_0x4f6e('0xd')](_0x192fae));_0x546bff[_0x4f6e('0x15')]();}}function _0x3674a4(_0x36eb02){try{if(_0x36eb02){var _0x2fba30=JSON[_0x4f6e('0x16')](_0x36eb02);switch(_0x2fba30[_0x4f6e('0x17')]){case 0x0:if(_0x2fba30[_0x4f6e('0x18')]){if(_0x2fba30[_0x4f6e('0x18')][_0x4f6e('0x19')]){logger[_0x4f6e('0x4')]('Tilde\x20ASR\x20hypoteses',JSON[_0x4f6e('0xd')](_0x2fba30[_0x4f6e('0x18')]['hypotheses']));_0x4afef9=_0x2fba30[_0x4f6e('0x18')][_0x4f6e('0x1a')][0x0]['transcript'];_0x50e2f1=_0x2fba30[_0x4f6e('0x18')][_0x4f6e('0x1a')][0x0][_0x4f6e('0x1b')];_0x5d2495='0';_0x271305=_0x4f6e('0x1c');_0x546bff[_0x4f6e('0x15')]();}}break;case 0x1:logger[_0x4f6e('0x4')](_0x4f6e('0x7'));_0x5d2495='1';_0x271305='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x4f6e('0x4')](_0x4f6e('0x1d'));_0x5d2495='2';_0x271305=_0x4f6e('0x1d');break;case 0x9:logger[_0x4f6e('0x4')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x5d2495='9';_0x271305='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0x4f6e('0x4')](_0x4f6e('0x1e'));_0x5d2495='10';_0x271305=_0x4f6e('0x1e');break;case 0xb:logger[_0x4f6e('0x4')](_0x4f6e('0x1f'));_0x5d2495='11';_0x271305=_0x4f6e('0x1f');}}}catch(_0xde3224){logger[_0x4f6e('0x13')](_0x4f6e('0x20'),JSON['stringify'](_0xde3224));_0x546bff[_0x4f6e('0x15')]();}}function _0x3d5fc3(){logger['info'](_0x4f6e('0x21'));_0x504493({'transcript':_0x4afef9,'confidence':_0x50e2f1,'status':_0x5d2495,'status_message':_0x271305});}function _0xf48f38(_0x3ebf91){logger[_0x4f6e('0x13')](_0x4f6e('0x22'));if(!_[_0x4f6e('0x23')](_0x3ebf91)){logger[_0x4f6e('0x13')](_[_0x4f6e('0x24')](_0x3ebf91)?JSON[_0x4f6e('0xd')](_0x3ebf91):_0x3ebf91);}}_0x546bff['on']('open',_0x2aef93);_0x546bff['on'](_0x4f6e('0x25'),_0x3674a4);_0x546bff['on'](_0x4f6e('0x11'),_0x3d5fc3);_0x546bff['on'](_0x4f6e('0x13'),_0xf48f38);});}; \ No newline at end of file diff --git a/server/services/agi/scripts/tilde/index.js b/server/services/agi/scripts/tilde/index.js index cc0d420..6216245 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 _0x04af=['./asr','exports'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x04af,0x6a));var _0xf04a=function(_0xee79cb,_0x16d233){_0xee79cb=_0xee79cb-0x0;var _0x23e930=_0x04af[_0xee79cb];return _0x23e930;};var asr=require(_0xf04a('0x0'));module[_0xf04a('0x1')]={'asr':asr}; \ No newline at end of file +var _0x232a=['./asr'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x232a,0xfa));var _0xa232=function(_0x5c1ac9,_0x3664c0){_0x5c1ac9=_0x5c1ac9-0x0;var _0x135919=_0x232a[_0x5c1ac9];return _0x135919;};var asr=require(_0xa232('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index d911f38..2b48fa9 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 _0x1bd2=['events','EventEmitter','./channel','call','emit','error','E_AGI_ARGUMENT_PORT','listen','listening','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_MAXCONNECTION','ready','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','net'];(function(_0x383ebb,_0x210f23){var _0x207a70=function(_0x29f8a9){while(--_0x29f8a9){_0x383ebb['push'](_0x383ebb['shift']());}};_0x207a70(++_0x210f23);}(_0x1bd2,0x18f));var _0x21bd=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x1bd2[_0x1928c9];return _0x51b5fb;};'use strict';var util=require('util');var net=require(_0x21bd('0x0'));var EventEmitter=require(_0x21bd('0x1'))[_0x21bd('0x2')];var AGIError=require('./error');var AGIChannel=require(_0x21bd('0x3'));var AGIServer=function(_0x5a4b5d,_0xdef923,_0x59e969){var _0x421b7f=this,_0x5a4b5d=_0x5a4b5d||0x11dd,_0xdef923=_0xdef923||'127.0.0.1',_0x18e9e7=null,_0x21d382=0x0;EventEmitter[_0x21bd('0x4')](_0x421b7f);function _0x41dc9a(){if(!_0x5a4b5d){_0x421b7f[_0x21bd('0x5')](_0x21bd('0x6'),new AGIError(_0x21bd('0x7')));return![];}_0x18e9e7=net['createServer']();_0x18e9e7[_0x21bd('0x8')](_0x5a4b5d,_0xdef923);_0x18e9e7['on'](_0x21bd('0x9'),function(){_0x421b7f[_0x21bd('0x5')](_0x21bd('0x9'));});_0x18e9e7['on']('connection',function(_0x290766){_0x18e9e7[_0x21bd('0xa')](function(_0x313d6f,_0x198153){if(_0x313d6f){_0x421b7f[_0x21bd('0x5')](_0x21bd('0x6'),new AGIError(_0x21bd('0xb'),_0x313d6f));}else if(_0x59e969&&_0x59e969<0x0){_0x421b7f['emit'](_0x21bd('0x6'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x290766['destroy']();}else if(_0x59e969&&_0x59e969>0x0&&_0x59e969<_0x198153){_0x21d382+=0x1;_0x421b7f[_0x21bd('0x5')](_0x21bd('0x6'),new AGIError(_0x21bd('0xc'),_0x21d382));_0x290766['destroy']();}else{var _0x9bfc1e=new AGIChannel(_0x290766);_0x9bfc1e['on'](_0x21bd('0xd'),function(){_0x421b7f[_0x21bd('0x5')]('connection',_0x9bfc1e);});}});});_0x18e9e7['on'](_0x21bd('0x6'),function(_0x52820b){_0x421b7f['emit'](_0x21bd('0x6'),new AGIError(_0x21bd('0xb'),_0x52820b[_0x21bd('0xe')]));});_0x18e9e7['on'](_0x21bd('0xf'),function(){_0x421b7f[_0x21bd('0x5')]('close',new AGIError(_0x21bd('0x10')));});}process[_0x21bd('0x11')](function(){_0x41dc9a();});};util[_0x21bd('0x12')](AGIServer,EventEmitter);module[_0x21bd('0x13')]=function(_0x12ace6,_0x1e9224,_0x3d7e5b){return new AGIServer(_0x12ace6,_0x1e9224,_0x3d7e5b);}; \ No newline at end of file +var _0xa3ba=['code','close','nextTick','util','events','EventEmitter','./error','127.0.0.1','call','error','E_AGI_ARGUMENT_PORT','emit','listening','getConnections','E_AGI_SERVER_ERROR','destroy','E_AGI_SERVER_MAXCONNECTION','ready'];(function(_0xf1efb2,_0x5af75c){var _0x505f10=function(_0x28f232){while(--_0x28f232){_0xf1efb2['push'](_0xf1efb2['shift']());}};_0x505f10(++_0x5af75c);}(_0xa3ba,0xc9));var _0xaa3b=function(_0x4bc65f,_0x39ec43){_0x4bc65f=_0x4bc65f-0x0;var _0x44f85f=_0xa3ba[_0x4bc65f];return _0x44f85f;};'use strict';var util=require(_0xaa3b('0x0'));var net=require('net');var EventEmitter=require(_0xaa3b('0x1'))[_0xaa3b('0x2')];var AGIError=require(_0xaa3b('0x3'));var AGIChannel=require('./channel');var AGIServer=function(_0x2de794,_0x5bfb58,_0x36c0c6){var _0xf302ef=this,_0x2de794=_0x2de794||0x11dd,_0x5bfb58=_0x5bfb58||_0xaa3b('0x4'),_0x2676ca=null,_0x594c4d=0x0;EventEmitter[_0xaa3b('0x5')](_0xf302ef);function _0x1b51f5(){if(!_0x2de794){_0xf302ef['emit'](_0xaa3b('0x6'),new AGIError(_0xaa3b('0x7')));return![];}_0x2676ca=net['createServer']();_0x2676ca['listen'](_0x2de794,_0x5bfb58);_0x2676ca['on']('listening',function(){_0xf302ef[_0xaa3b('0x8')](_0xaa3b('0x9'));});_0x2676ca['on']('connection',function(_0x5e5875){_0x2676ca[_0xaa3b('0xa')](function(_0x4121bd,_0x5bf63){if(_0x4121bd){_0xf302ef[_0xaa3b('0x8')]('error',new AGIError(_0xaa3b('0xb'),_0x4121bd));}else if(_0x36c0c6&&_0x36c0c6<0x0){_0xf302ef[_0xaa3b('0x8')](_0xaa3b('0x6'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x5e5875[_0xaa3b('0xc')]();}else if(_0x36c0c6&&_0x36c0c6>0x0&&_0x36c0c6<_0x5bf63){_0x594c4d+=0x1;_0xf302ef['emit']('error',new AGIError(_0xaa3b('0xd'),_0x594c4d));_0x5e5875[_0xaa3b('0xc')]();}else{var _0x59e6fa=new AGIChannel(_0x5e5875);_0x59e6fa['on'](_0xaa3b('0xe'),function(){_0xf302ef[_0xaa3b('0x8')]('connection',_0x59e6fa);});}});});_0x2676ca['on']('error',function(_0x137f32){_0xf302ef[_0xaa3b('0x8')]('error',new AGIError(_0xaa3b('0xb'),_0x137f32[_0xaa3b('0xf')]));});_0x2676ca['on'](_0xaa3b('0x10'),function(){_0xf302ef[_0xaa3b('0x8')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0xaa3b('0x11')](function(){_0x1b51f5();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x1c03eb,_0x27f450,_0x211504){return new AGIServer(_0x1c03eb,_0x27f450,_0x211504);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 3a8edcb..bde19d0 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 _0x9934=['no\x20intervals\x20found','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','operation','no\x20operation\x20configured','math\x20%s','no\x20variable\x20found','Enter\x20in\x20MENU\x20(%s)\x20block','output','pause_id','playback','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','indexOf','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%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','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','service','host','port','secure','auth','pass','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','AGI','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','Trying\x20Google\x20Cloud\x20TTS\x20%s','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','agentUnpause','voicemail','VOICEMAIL','mailbox','vswitch','join','exports','util','shelljs','odbc','randomstring','moment','request-promise','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','menu','getdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUserById','getTrunkById','getSound','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervalById','IntervalId','interval','getSoundPath','format','error','Error\x20getting\x20ODBC\x20connection\x20%s','query','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','getSmsAccount','createSmsMessage','createSquareDetailsReport','uniqueid','agicommand','arg_1','callerid','createSquareRecording','context','extension','priority','dnid','file','createSquareMessage','createCmContact','isNil','random','isEmpty','lastName','phone','scheduledAt','callback','toString','getPauseById','agentPause','agent','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','trim','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','timeout','number','includes','POST','PUT','method','rawBody','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','render','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','sestekNDA','ispeechTTS','speed','ispeechASR','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','clone','recursiveNodeIndex','hasOwnProperty','isPlainObject','isString','replaceAllVariables','saveRestApiResult','%s.%s','isArray','length','setVariable','split','extra','getAndSetVariable','result','maxRetry','sync','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','label','grammar','exec','RECOG_INPUT()','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','no\x20list\x20selected','delay','minutes','callback_priority','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','replace','query:\x20%s','getQueryOdbc','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','getUser','sip_id','no\x20user\x20found','DIAL','SIP/%s','opts','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','toUpperCase','speech','Dialogflow\x20is\x20unreachable','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','dialogflowV2_language','no\x20anguage\x20configured','providerResponse','out','dialogflowV2','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','Executed\x20command\x20%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','getsecretdigits','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','unlink','.wav','aws\x20Polly\x20is\x20unreachable','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','%s/recordings/%s','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','no\x20appid\x20configured','no\x20appsecret\x20configured','wav','beep','tilde\x20%s\x20file\x20created','gotoc','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','interval_id','no\x20interval\x20configured','getIntervals'];(function(_0x413aac,_0x5e2430){var _0x569b11=function(_0x52e060){while(--_0x52e060){_0x413aac['push'](_0x413aac['shift']());}};_0x569b11(++_0x5e2430);}(_0x9934,0x7c));var _0x4993=function(_0x489c95,_0x53159c){_0x489c95=_0x489c95-0x0;var _0x10e7a7=_0x9934[_0x489c95];return _0x10e7a7;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x4993('0x0'));var _=require('lodash');var sh=require(_0x4993('0x1'));var odbc=require(_0x4993('0x2'))();var rs=require(_0x4993('0x3'));var moment=require(_0x4993('0x4'));var Mustache=require('mustache');var rp=require(_0x4993('0x5'));var logger=require(_0x4993('0x6'))(_0x4993('0x7'));var config=require(_0x4993('0x8'));var scripts=require(_0x4993('0x9'));var FILES_PATH=_0x4993('0xa');var recursiveMapAttributes=['rawHeaders','rawBody'];var verticesWithRetry=[_0x4993('0xb'),_0x4993('0xc'),'getsecretdigits'];var AGIVertices=function(_0x54233a,_0x5d1193,_0x390beb){this[_0x4993('0xd')]=_0x54233a;this[_0x4993('0xe')]=_0x5d1193;this[_0x4993('0xf')]=_0x390beb;};AGIVertices[_0x4993('0x10')][_0x4993('0x11')]=function(_0x47a7ad,_0x30ac85){this[_0x4993('0xe')][_0x4993('0x12')](_0x47a7ad)[_0x4993('0x13')](function(_0x547f3f){_0x30ac85(null,_0x547f3f?_0x547f3f[_0x4993('0x14')]:![]);})[_0x4993('0x15')](function(_0x2a0f8a){_0x30ac85(_0x2a0f8a);});};AGIVertices['prototype'][_0x4993('0x16')]=function(_0x2d6314,_0x5258fd){this[_0x4993('0xe')][_0x4993('0x17')](_0x2d6314)[_0x4993('0x13')](function(_0x33dc85){_0x5258fd(null,_0x33dc85?_0x33dc85[_0x4993('0x14')]:![]);})[_0x4993('0x15')](function(_0xeba681){_0x5258fd(_0xeba681);});};AGIVertices['prototype'][_0x4993('0x18')]=function(_0x58c4e2,_0x4b4a27){this[_0x4993('0xe')][_0x4993('0x19')](_0x58c4e2)[_0x4993('0x13')](function(_0x276282){_0x4b4a27(null,_0x276282?_0x276282['name']:![]);})['catch'](function(_0x4c0172){_0x4b4a27(_0x4c0172);});};AGIVertices[_0x4993('0x10')][_0x4993('0x1a')]=function(_0x220ddc,_0x1dc131){this[_0x4993('0xe')][_0x4993('0x1b')](_0x220ddc)[_0x4993('0x13')](function(_0x49b97a){_0x1dc131(null,_0x49b97a?_0x49b97a[_0x4993('0x1c')]:![]);})[_0x4993('0x15')](function(_0x46d7a6){_0x1dc131(_0x46d7a6);});};AGIVertices['prototype']['getUser']=function(_0x306adb,_0x498490){this[_0x4993('0xe')][_0x4993('0x1d')](_0x306adb)[_0x4993('0x13')](function(_0x1f38be){_0x498490(null,_0x1f38be?_0x1f38be[_0x4993('0x14')]:![]);})[_0x4993('0x15')](function(_0x37aaba){_0x498490(_0x37aaba);});};AGIVertices[_0x4993('0x10')]['getTrunk']=function(_0x2ad283,_0x4334db){this[_0x4993('0xe')][_0x4993('0x1e')](_0x2ad283)['then'](function(_0x47be56){_0x4334db(null,_0x47be56?_0x47be56['name']:![]);})[_0x4993('0x15')](function(_0x3924c2){_0x4334db(_0x3924c2);});};AGIVertices[_0x4993('0x10')][_0x4993('0x1f')]=function(_0x1abfce,_0x2a2f11){var _0x1b649c=this;this['rpc']['getSoundById'](_0x1abfce)['then'](function(_0x1c14cf){_0x2a2f11(null,_0x1c14cf?_0x1b649c['getSoundPath'](_0x1c14cf[_0x4993('0x20')]):![]);})[_0x4993('0x15')](function(_0x9f10f2){_0x2a2f11(_0x9f10f2);});};AGIVertices[_0x4993('0x10')][_0x4993('0x21')]=function(_0x203b61,_0xa643d){this[_0x4993('0xe')][_0x4993('0x22')](_0x203b61)[_0x4993('0x13')](function(_0x3f0715){_0xa643d(null,_0x3f0715?_0x3f0715:![]);})[_0x4993('0x15')](function(_0x321dd4){_0xa643d(_0x321dd4);});};AGIVertices[_0x4993('0x10')][_0x4993('0x23')]=function(_0xc7208d,_0x8fb9de,_0xb297ae){this[_0x4993('0xf')][_0x4993('0x23')](_0xc7208d,_0x8fb9de)['then'](function(){_0xb297ae(null);})[_0x4993('0x15')](function(_0x3ceb8e){_0xb297ae(_0x3ceb8e);});};AGIVertices[_0x4993('0x10')]['getIntervals']=function(_0x47edb9,_0x19d064){this[_0x4993('0xe')][_0x4993('0x24')](_0x47edb9)[_0x4993('0x13')](function(_0x1a5240){if(_0x1a5240){if(_0x1a5240[_0x4993('0x25')]){_0x19d064(null,[_0x1a5240[_0x4993('0x26')]]);}else{_0x19d064(null,_['map'](_0x1a5240['Intervals'],_0x4993('0x26')));}}else{_0x19d064(null,![]);}})[_0x4993('0x15')](function(_0x145e37){_0x19d064(_0x145e37);});};AGIVertices[_0x4993('0x10')][_0x4993('0x27')]=function(_0x2c6631){return util[_0x4993('0x28')]('%s/sounds/converted/%s',FILES_PATH,_0x2c6631);};AGIVertices['prototype']['getQueryOdbc']=function(_0x249791,_0x3c18b9,_0x34b70e){odbc['open'](_0x249791,function(_0x35239e){if(_0x35239e){logger[_0x4993('0x29')](_0x4993('0x2a'),_0x35239e);_0x34b70e(_0x35239e);}else{logger['info']('ODBC\x20connection\x20successfully');odbc[_0x4993('0x2b')](_0x3c18b9,function(_0x56ae19,_0x233885){if(_0x56ae19){logger[_0x4993('0x2c')](_0x4993('0x2d'),_0x3c18b9);_0x34b70e(_0x56ae19);}else{logger['info'](_0x4993('0x2e'),_0x3c18b9);odbc[_0x4993('0x2f')](function(_0x1c6463){if(_0x1c6463){logger[_0x4993('0x29')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x1c6463);}_0x34b70e(null,_0x233885);});}});}});};AGIVertices['prototype'][_0x4993('0x30')]=function(_0x1deb5d,_0x280960){this[_0x4993('0xe')]['getSmsAccountById'](_0x1deb5d)[_0x4993('0x13')](function(_0x218ffa){_0x280960(null,_0x218ffa?_0x218ffa:![]);})[_0x4993('0x15')](function(_0xe5b8de){_0x280960(_0xe5b8de);});};AGIVertices[_0x4993('0x10')][_0x4993('0x31')]=function(_0x18983d,_0x243ec8){this[_0x4993('0xe')]['createSmsMessage'](_0x18983d)[_0x4993('0x13')](function(_0x4c91ee){_0x243ec8(null,_0x4c91ee);})['catch'](function(_0xd975e0){_0x243ec8(_0xd975e0);});};AGIVertices[_0x4993('0x10')][_0x4993('0x32')]=function(_0x21511f,_0x240edd,_0x56edb0){this[_0x4993('0xe')][_0x4993('0x32')]({'uniqueid':this['channel'][_0x4993('0x33')],'node':_0x21511f['label'],'application':_0x21511f[_0x4993('0x34')],'data':_0x240edd||null,'project_name':this['channel'][_0x4993('0x35')],'callerid':this[_0x4993('0xd')][_0x4993('0x36')]})[_0x4993('0x13')](function(_0x535422){if(_0x56edb0){_0x56edb0(null,_0x535422);}})[_0x4993('0x15')](function(_0x5db952){if(_0x56edb0){_0x56edb0(_0x5db952);}});};AGIVertices[_0x4993('0x10')][_0x4993('0x37')]=function(_0x30586e,_0x424d38,_0x401a61,_0xdbda54){this[_0x4993('0xe')][_0x4993('0x37')]({'uniqueid':this['channel']['uniqueid'],'callerid':this[_0x4993('0xd')][_0x4993('0x36')],'calleridname':this[_0x4993('0xd')]['calleridname'],'context':this[_0x4993('0xd')][_0x4993('0x38')],'extension':this[_0x4993('0xd')][_0x4993('0x39')],'priority':this[_0x4993('0xd')][_0x4993('0x3a')],'accountcode':this[_0x4993('0xd')]['accountcode'],'dnid':this[_0x4993('0xd')][_0x4993('0x3b')],'projectName':this[_0x4993('0xd')][_0x4993('0x35')],'saveName':_0x424d38,'filename':_0x30586e[_0x4993('0x3c')]||_0x424d38,'savePath':_0x401a61})[_0x4993('0x13')](function(_0x56390e){_0xdbda54(null,_0x56390e);})[_0x4993('0x15')](function(_0x473031){_0xdbda54(_0x473031);});};AGIVertices['prototype'][_0x4993('0x3d')]=function(_0x2297aa,_0x4034b7,_0x3f7a0e,_0x6bdb0,_0x1ec067){this[_0x4993('0xe')][_0x4993('0x3d')]({'uniqueid':this[_0x4993('0xd')][_0x4993('0x33')],'body':_0x2297aa,'direction':_0x4034b7,'providerName':_0x3f7a0e,'providerResponse':_0x6bdb0})[_0x4993('0x13')](function(_0x10358d){if(_0x1ec067){_0x1ec067(null,_0x10358d);}})[_0x4993('0x15')](function(_0x381cdd){if(_0x1ec067){_0x1ec067(_0x381cdd);}});};AGIVertices[_0x4993('0x10')][_0x4993('0x3e')]=function(_0x512c33,_0x5bc453){this[_0x4993('0xe')][_0x4993('0x3e')]({'firstName':_['isEmpty'](_0x512c33['name'])||_[_0x4993('0x3f')](_0x512c33[_0x4993('0x14')])?'callback_'+Math[_0x4993('0x40')]():_0x512c33[_0x4993('0x14')],'lastName':_[_0x4993('0x41')](_0x512c33[_0x4993('0x42')])||_[_0x4993('0x3f')](_0x512c33[_0x4993('0x42')])?null:_0x512c33['lastName'],'phone':_0x512c33[_0x4993('0x43')],'ListId':_0x512c33['list_id'],'scheduledat':_0x512c33[_0x4993('0x44')],'callbackUniqueid':this[_0x4993('0xd')]['uniqueid'],'tags':_0x4993('0x45'),'description':'Callback\x20scheduled\x20at\x20'+_0x512c33[_0x4993('0x44')][_0x4993('0x46')](),'priority':_0x512c33['callback_priority']})[_0x4993('0x13')](function(_0x2d5720){_0x5bc453(null,_0x2d5720);})['catch'](function(_0x7df38e){_0x5bc453(_0x7df38e);});};AGIVertices[_0x4993('0x10')]['getPause']=function(_0x3338cd,_0xbb22d9){this[_0x4993('0xe')][_0x4993('0x47')](_0x3338cd)[_0x4993('0x13')](function(_0x2af395){_0xbb22d9(null,_0x2af395?_0x2af395[_0x4993('0x14')]:![]);})[_0x4993('0x15')](function(_0x19bc91){_0xbb22d9(_0x19bc91);});};AGIVertices['prototype'][_0x4993('0x48')]=function(_0x5b58f0,_0x18c5a5,_0x336013){var _0x4be871={'role':'agent'};_0x4be871[_0x5b58f0]=this['channel'][_0x4993('0x36')];this[_0x4993('0xe')]['agentPause'](_0x4be871,_0x18c5a5,this[_0x4993('0xd')][_0x4993('0x33')])[_0x4993('0x13')](function(_0x266467){_0x336013(null,_[_0x4993('0x3f')](_0x266467)?![]:!![]);})[_0x4993('0x15')](function(_0x43b6e0){logger[_0x4993('0x29')](_0x43b6e0);_0x336013(null,![]);});};AGIVertices[_0x4993('0x10')]['agentUnpause']=function(_0x223d2f,_0x2a4193){var _0x1f4b0b={'role':_0x4993('0x49')};_0x1f4b0b[_0x223d2f]=this[_0x4993('0xd')][_0x4993('0x36')];this[_0x4993('0xe')]['agentUnpause'](_0x1f4b0b)[_0x4993('0x13')](function(_0x206a45){_0x2a4193(null,_['isNil'](_0x206a45)?![]:!![]);})[_0x4993('0x15')](function(_0x3f01b3){logger[_0x4993('0x29')](_0x3f01b3);_0x2a4193(null,![]);});};AGIVertices[_0x4993('0x10')][_0x4993('0x4a')]=function(_0xa65ece,_0x47e24f){var _0x3ea21a={'role':'agent'};_0x3ea21a[_0xa65ece]=this['channel'][_0x4993('0x36')];this[_0x4993('0xe')][_0x4993('0x4a')](_0x3ea21a)[_0x4993('0x13')](function(_0x1e920c){_0x47e24f(null,_[_0x4993('0x3f')](_0x1e920c)?![]:!![]);})[_0x4993('0x15')](function(_0x5ebb42){logger[_0x4993('0x29')](_0x5ebb42);_0x47e24f(null,![]);});};AGIVertices[_0x4993('0x10')][_0x4993('0x4b')]=function(_0x450aa9,_0x183d72){var _0x2a2b82={'role':_0x4993('0x49')};_0x2a2b82[_0x450aa9]=this[_0x4993('0xd')]['callerid'];var _0x3820bc=_0x450aa9!=_0x4993('0x4c')?util[_0x4993('0x28')](_0x4993('0x4d'),_0x4993('0x4e'),this[_0x4993('0xd')][_0x4993('0x36')]):undefined;this[_0x4993('0xe')]['agentLogin'](_0x2a2b82,_0x3820bc)[_0x4993('0x13')](function(_0x1c1af8){_0x183d72(null,_['isNil'](_0x1c1af8)?![]:!![]);})['catch'](function(_0x212665){logger[_0x4993('0x29')](_0x212665);_0x183d72(null,![]);});};AGIVertices[_0x4993('0x10')][_0x4993('0x4f')]=function(_0x56bb5f,_0x3a3033){sh['exec'](_[_0x4993('0x50')](_0x56bb5f),function(_0x5e1b68,_0xc63e81){var _0x857525=_0xc63e81['replace'](/(\r\n|\n|\r)/gm,'');_0x3a3033(null,_0x857525);});};AGIVertices[_0x4993('0x10')][_0x4993('0x51')]=function(_0x31f672,_0x6d46f2){scripts[_0x4993('0x51')](_0x31f672[_0x4993('0x52')],_0x31f672[_0x4993('0x53')]||_0x4993('0x54'),_0x31f672[_0x4993('0x54')],_0x31f672[_0x4993('0x55')]||_0x4993('0x56'),_0x31f672[_0x4993('0x57')]||_0x4993('0x58'),_0x31f672[_0x4993('0x59')]||_0x4993('0x5a'))[_0x4993('0x13')](function(_0x54e0f5){_0x6d46f2(null,_0x54e0f5);})[_0x4993('0x15')](function(_0x365c7d){_0x6d46f2(_0x365c7d);});};AGIVertices['prototype']['googleTTS']=function(_0x422ad7,_0x3ddd89){scripts[_0x4993('0x5b')](_0x422ad7[_0x4993('0x54')],_0x422ad7[_0x4993('0x5c')]||'en',0x1)[_0x4993('0x13')](function(_0x106e4d){_0x3ddd89(null,_0x106e4d);})['catch'](function(_0x5ec10a){_0x3ddd89(_0x5ec10a);});};AGIVertices[_0x4993('0x10')][_0x4993('0x5d')]=function(_0x75a2cb,_0x2bdb76){var _0x370e2a={'uri':_0x75a2cb[_0x4993('0x5e')],'method':_0x75a2cb['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x75a2cb[_0x4993('0x5f')])===_0x4993('0x60')&&parseInt(_0x75a2cb[_0x4993('0x5f')])>=0x1?parseInt(_0x75a2cb['timeout'])*0x3e8:0x5*0x3e8};if(_[_0x4993('0x61')]([_0x4993('0x62'),_0x4993('0x63')],_0x370e2a[_0x4993('0x64')]['toUpperCase']())){try{_0x370e2a['body']=_0x75a2cb[_0x4993('0x65')]?JSON[_0x4993('0x66')](_0x75a2cb[_0x4993('0x65')]):{};}catch(_0x153543){logger[_0x4993('0x29')](_0x4993('0x67'),_0x153543);}}try{_0x370e2a[_0x4993('0x68')]=_0x75a2cb['rawHeaders']?JSON[_0x4993('0x66')](_0x75a2cb[_0x4993('0x69')]):{};}catch(_0x40f7bf){logger[_0x4993('0x29')](_0x4993('0x6a'),_0x40f7bf);}if(_0x75a2cb['computedVariables']){try{var _0x4d4638=require(_0x75a2cb[_0x4993('0x6b')])['sync'](this,_0x370e2a);_0x370e2a[_0x4993('0x6c')]=Mustache[_0x4993('0x6d')](_0x75a2cb['url'],_0x4d4638,{},['$$','$$']);if(_0x370e2a['headers']){_0x370e2a['headers']=JSON[_0x4993('0x66')](Mustache['render'](JSON[_0x4993('0x6e')](_0x370e2a[_0x4993('0x68')]),_0x4d4638,{},['$$','$$']));}if(_0x370e2a[_0x4993('0x6f')]){_0x370e2a[_0x4993('0x6f')]=JSON[_0x4993('0x66')](Mustache[_0x4993('0x6d')](JSON[_0x4993('0x6e')](_0x370e2a[_0x4993('0x6f')]),_0x4d4638,{},['$$','$$']));}}catch(_0x4a9a33){logger[_0x4993('0x29')](_0x4993('0x70'),_0x4a9a33);}}rp(_0x370e2a)['then'](function(_0x462adb){var _0x210780={'statusCode':_0x462adb[_0x4993('0x71')]||0xc8,'statusMessage':_0x462adb[_0x4993('0x72')]||'OK','headers':_0x462adb[_0x4993('0x68')]||{},'body':_0x462adb[_0x4993('0x6f')]||{}};_0x2bdb76(null,_0x210780);})[_0x4993('0x15')](function(_0x28d1b9){var _0x5edac3={'statusCode':_0x28d1b9['statusCode']||0x1f4,'statusMessage':_0x28d1b9[_0x4993('0x73')]||_0x4993('0x74'),'headers':_0x28d1b9[_0x4993('0x75')][_0x4993('0x68')]||{},'body':_0x28d1b9[_0x4993('0x75')][_0x4993('0x6f')]||{}};_0x2bdb76(null,_0x5edac3);});};AGIVertices[_0x4993('0x10')][_0x4993('0x76')]=function(_0x5b5a28,_0x2b00){scripts[_0x4993('0x76')](this[_0x4993('0xd')][_0x4993('0x33')],_0x5b5a28[_0x4993('0x77')],_0x5b5a28[_0x4993('0x54')],_0x5b5a28[_0x4993('0x78')]||'en')['then'](function(_0x222e45){_0x2b00(null,_0x222e45);})[_0x4993('0x15')](function(_0x4c130c){_0x2b00(_0x4c130c);});};AGIVertices['prototype'][_0x4993('0x79')]=function(_0x44808b,_0x1e0e00){scripts[_0x4993('0x79')](this[_0x4993('0xd')][_0x4993('0x33')],_0x44808b[_0x4993('0x7a')],_0x44808b[_0x4993('0x7b')],_0x44808b[_0x4993('0x7c')],_0x44808b[_0x4993('0x54')],_0x44808b['dialogflowV2_language']||'en')[_0x4993('0x13')](function(_0x16af61){_0x1e0e00(null,_0x16af61);})['catch'](function(_0x53ff40){_0x1e0e00(_0x53ff40);});};AGIVertices[_0x4993('0x10')][_0x4993('0x7d')]=function(_0x2e2ab4,_0x4409d2){scripts[_0x4993('0x7d')](this['channel'],_0x2e2ab4)[_0x4993('0x13')](function(_0x2b6840){_0x4409d2(null,_0x2b6840);})[_0x4993('0x15')](function(_0xf660fc){_0x4409d2(_0xf660fc);});};AGIVertices[_0x4993('0x10')]['ispeechTTS']=function(_0x2b0a3c,_0x490280){scripts[_0x4993('0x7e')](_0x2b0a3c['key'],_0x2b0a3c[_0x4993('0x54')],_0x2b0a3c['ispeech_tts_language']||_0x4993('0x56'),_0x2b0a3c[_0x4993('0x7f')])[_0x4993('0x13')](function(_0x2b6828){_0x490280(null,_0x2b6828);})[_0x4993('0x15')](function(_0x5290fe){_0x490280(_0x5290fe);});};AGIVertices[_0x4993('0x10')][_0x4993('0x80')]=function(_0x5ed222,_0xc8ddf,_0x2ef943){scripts['ispeechASR'](_0xc8ddf,_0x5ed222[_0x4993('0x77')],_0x5ed222['ispeech_asr_language']||'en-US',this[_0x4993('0x81')](_0x5ed222[_0x4993('0x82')])?_0x5ed222[_0x4993('0x82')]:undefined)[_0x4993('0x13')](function(_0x516e39){_0x2ef943(null,_0x516e39);})['catch'](function(_0x5815c1){_0x2ef943(_0x5815c1);});};AGIVertices[_0x4993('0x10')][_0x4993('0x83')]=function(_0x32cd3c,_0x224cfb){scripts[_0x4993('0x83')](_0x32cd3c[_0x4993('0x84')],_0x32cd3c[_0x4993('0x85')],_0x32cd3c[_0x4993('0x86')],_0x32cd3c[_0x4993('0x87')]||_0x4993('0x88'),_0x32cd3c[_0x4993('0x54')],_0x32cd3c[_0x4993('0x89')]||'text')['then'](function(_0x12993a){_0x224cfb(null,_0x12993a);})['catch'](function(_0x5493f5){_0x224cfb(_0x5493f5);});};AGIVertices[_0x4993('0x10')][_0x4993('0x8a')]=function(_0x24f502,_0x510181){scripts[_0x4993('0x8a')](this[_0x4993('0xd')]['uniqueid'],_0x24f502[_0x4993('0x84')],_0x24f502[_0x4993('0x85')],_0x24f502[_0x4993('0x8b')],_0x24f502[_0x4993('0x54')],_0x24f502[_0x4993('0x8c')])[_0x4993('0x13')](function(_0x16c2a3){_0x510181(null,_0x16c2a3);})[_0x4993('0x15')](function(_0x8b6135){_0x510181(_0x8b6135);});};AGIVertices['prototype'][_0x4993('0x8d')]=function(_0x260518,_0x28576f,_0x3f3d7d){scripts[_0x4993('0x8d')](_0x28576f,_0x260518[_0x4993('0x77')],_0x260518[_0x4993('0x8e')]||_0x4993('0x56'))[_0x4993('0x13')](function(_0x5adef3){_0x3f3d7d(null,_0x5adef3);})[_0x4993('0x15')](function(_0x4826c7){_0x3f3d7d(_0x4826c7);});};AGIVertices[_0x4993('0x10')]['tildeASR']=function(_0x51ba06,_0x212bed,_0xcbb169){scripts[_0x4993('0x8f')](_0x212bed,_0x51ba06[_0x4993('0x90')],_0x51ba06[_0x4993('0x91')],_0x51ba06[_0x4993('0x6c')])[_0x4993('0x13')](function(_0x1a40b7){_0xcbb169(null,_0x1a40b7);})[_0x4993('0x15')](function(_0x22edc2){_0xcbb169(_0x22edc2);});};AGIVertices[_0x4993('0x10')][_0x4993('0x92')]=function(_0x3e1ffb){var _0x130d79=_[_0x4993('0x61')](verticesWithRetry,_0x3e1ffb['agicommand'])?_0x3e1ffb:_[_0x4993('0x93')](_0x3e1ffb);for(var _0x3c3d3f in _0x130d79){if(_0x130d79['hasOwnProperty'](_0x3c3d3f)){if(_0x130d79[_0x3c3d3f]&&_['isString'](_0x130d79[_0x3c3d3f])){if(_['includes'](recursiveMapAttributes,_0x3c3d3f)){_0x130d79[_0x3c3d3f]=this['replaceObjectAllVariables'](_0x130d79[_0x3c3d3f]);}else{_0x130d79[_0x3c3d3f]=this['replaceAllVariables'](_0x130d79[_0x3c3d3f]);}}}}return _0x130d79;};AGIVertices[_0x4993('0x10')][_0x4993('0x94')]=function(_0x48f2b3){for(var _0x5a3783 in _0x48f2b3){if(_0x48f2b3[_0x4993('0x95')](_0x5a3783)){if(_[_0x4993('0x96')](_0x48f2b3[_0x5a3783])){this[_0x4993('0x94')](_0x48f2b3[_0x5a3783]);}else if(_['isArray'](_0x48f2b3[_0x5a3783])){for(var _0x54fa31=0x0;_0x54fa31<_0x48f2b3[_0x5a3783]['length'];_0x54fa31++){this[_0x4993('0x94')](_0x48f2b3[_0x5a3783][_0x54fa31]);}}else if(_[_0x4993('0x97')](_0x48f2b3[_0x5a3783])){_0x48f2b3[_0x5a3783]=this[_0x4993('0x98')](_0x48f2b3[_0x5a3783]);}}}};AGIVertices[_0x4993('0x10')]['saveRestApiResult']=function(_0x287109,_0x381b16){for(var _0x527a96 in _0x287109){if(_0x287109[_0x4993('0x95')](_0x527a96)){if(_[_0x4993('0x96')](_0x287109[_0x527a96])){if(!_[_0x4993('0x41')](_0x287109[_0x527a96])){this[_0x4993('0x99')](_0x287109[_0x527a96],util['format'](_0x4993('0x9a'),_0x381b16,_0x527a96));}}else if(_[_0x4993('0x9b')](_0x287109[_0x527a96])){for(var _0x1375bc=0x0;_0x1375bc<_0x287109[_0x527a96][_0x4993('0x9c')];_0x1375bc++){this[_0x4993('0x99')](_0x287109[_0x527a96][_0x1375bc],util['format'](_0x4993('0x9a'),_0x381b16,_0x527a96+'['+_0x1375bc+']'));}}else{if(!_[_0x4993('0x3f')](_0x287109[_0x527a96])){this['channel'][_0x4993('0x9d')](util[_0x4993('0x28')](_0x4993('0x9a'),_0x381b16,_0x527a96),_0x287109[_0x527a96]);}}}}};AGIVertices[_0x4993('0x10')]['replaceObjectAllVariables']=function(_0x2f7b6b){try{var _0x3f59e2=JSON[_0x4993('0x66')](_0x2f7b6b);this[_0x4993('0x94')](_0x3f59e2);return JSON[_0x4993('0x6e')](_0x3f59e2);}catch(_0x1432c6){return this['replaceAllVariables'](_0x2f7b6b);}};AGIVertices[_0x4993('0x10')]['replaceAllVariables']=function(_0x27521c){var _0x55adca=_0x27521c[_0x4993('0x9e')]('{');for(var _0x21fdea=0x1;_0x21fdea<_0x55adca[_0x4993('0x9c')];_0x21fdea+=0x1){var _0x2b47a6=_0x55adca[_0x21fdea]['split']('}');if(_0x2b47a6['length']>0x1){_0x27521c=_0x27521c['replaceAll']('{'+_0x2b47a6[0x0]+'}',this['channel'][_0x4993('0x11')](_0x2b47a6[0x0])[_0x4993('0x9f')]||_0x2b47a6[0x0]);}}if(_0x55adca['length']===0x1){return _0x27521c[_0x4993('0x46')]();}return this[_0x4993('0x98')](_0x27521c);};AGIVertices[_0x4993('0x10')][_0x4993('0xa0')]=function(_0x35877f,_0x47edfa){var _0x449224=this[_0x4993('0xd')]['getVariable'](_0x35877f);if(_0x449224[_0x4993('0xa1')]===-0x1){return _0x449224;}logger[_0x4993('0x2c')](util['format']('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x47edfa,_0x449224[_0x4993('0x9f')]));return this[_0x4993('0xd')][_0x4993('0x9d')](_0x47edfa,_0x449224['extra']);};AGIVertices[_0x4993('0x10')][_0x4993('0x81')]=function(_0x1d167f){return _0x1d167f&&_0x1d167f!=='0'&&_0x1d167f!=='-1'&&_0x1d167f!=='';};AGIVertices['prototype'][_0x4993('0xa2')]=function(_0x5ee00d){this[_0x4993('0x32')][_0x4993('0xa3')](this,_0x5ee00d,'-');_0x5ee00d[_0x4993('0xa4')]=_0x5ee00d['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0x4993('0x10')][_0x4993('0xa5')]=function(_0x3713c5){logger[_0x4993('0x2c')](util['format'](_0x4993('0xa6'),_0x3713c5['label']));if(!this[_0x4993('0x81')](_0x3713c5[_0x4993('0x54')])){return this[_0x4993('0xd')][_0x4993('0xa7')]('no\x20text\x20configured');}var _0x54cb28='\x22'+_0x3713c5[_0x4993('0x54')]+'\x22';if(this[_0x4993('0x81')](_0x3713c5[_0x4993('0x75')])){_0x54cb28+=','+_0x3713c5[_0x4993('0x75')];}var _0x466241=this['channel']['exec'](_0x4993('0xa8'),_0x54cb28);if(_0x466241[_0x4993('0xa1')]===-0x1){return _0x466241;}return this[_0x4993('0xd')][_0x4993('0xa7')](util[_0x4993('0x28')](_0x4993('0xa9'),_0x54cb28));};AGIVertices[_0x4993('0x10')][_0x4993('0xaa')]=function(_0x585ec7){logger[_0x4993('0x2c')](util[_0x4993('0x28')](_0x4993('0xab'),_0x585ec7[_0x4993('0xac')]));if(!this[_0x4993('0x81')](_0x585ec7[_0x4993('0xad')])){return this[_0x4993('0xd')][_0x4993('0xa7')]('no\x20grammar\x20configured');}var _0x1ae622=_0x585ec7[_0x4993('0xad')];if(this[_0x4993('0x81')](_0x585ec7[_0x4993('0x75')])){_0x1ae622+=','+_0x585ec7['options'];}var _0x3106ef=this[_0x4993('0xd')][_0x4993('0xae')]('MRCPRecog',_0x1ae622);if(_0x3106ef[_0x4993('0xa1')]===-0x1){return _0x3106ef;}var _0x118d1c=this['getAndSetVariable']('RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE');if(_0x118d1c[_0x4993('0xa1')]===-0x1){return _0x118d1c;}var _0x50f45f=this['getAndSetVariable'](_0x4993('0xaf'),'MRCP_RECOG_TRANSCRIPT');if(_0x50f45f[_0x4993('0xa1')]===-0x1){return _0x50f45f;}var _0x4b0d73=this[_0x4993('0xa0')](_0x4993('0xb0'),_0x4993('0xb1'));if(_0x4b0d73['result']===-0x1){return _0x4b0d73;}return this[_0x4993('0xd')][_0x4993('0xa7')](util['format'](_0x4993('0xb2'),_0x1ae622));};AGIVertices['prototype'][_0x4993('0x7')]=function(_0x4a89bc){logger[_0x4993('0x2c')](util[_0x4993('0x28')](_0x4993('0xb3'),_0x4a89bc[_0x4993('0xac')]));return this[_0x4993('0xd')][_0x4993('0x7')]([_0x4a89bc[_0x4993('0xb4')],_0x4a89bc[_0x4993('0xb5')]]);};AGIVertices[_0x4993('0x10')][_0x4993('0xb6')]=function(_0x45c6be){logger['info'](util[_0x4993('0x28')](_0x4993('0xb7'),_0x45c6be[_0x4993('0xac')]));if(this[_0x4993('0x81')](_0x45c6be[_0x4993('0x5f')])){logger[_0x4993('0x2c')](util[_0x4993('0x28')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x45c6be[_0x4993('0x5f')]));var _0x210e9b=this[_0x4993('0xd')]['wait'](_0x45c6be['timeout']);if(_0x210e9b['result']===-0x1){return _0x210e9b;}}return this[_0x4993('0xd')]['answer']();};AGIVertices[_0x4993('0x10')]['callback']=function(_0x1ac6b8){logger[_0x4993('0x2c')](util[_0x4993('0x28')](_0x4993('0xb8'),_0x1ac6b8[_0x4993('0xac')]));if(!this[_0x4993('0x81')](_0x1ac6b8[_0x4993('0xb9')])){return this['channel'][_0x4993('0x29')](_0x1ac6b8,_0x4993('0xba'));}_0x1ac6b8[_0x4993('0x44')]=moment();if(this[_0x4993('0x81')](_0x1ac6b8[_0x4993('0xbb')])){_0x1ac6b8[_0x4993('0x44')]=moment()['add'](_0x1ac6b8['delay'],_0x4993('0xbc'));}if(!this['isConfigured'](_0x1ac6b8[_0x4993('0xbd')])){_0x1ac6b8[_0x4993('0xbd')]=0x2;}this['createCmContact'][_0x4993('0xa3')](this,_0x1ac6b8);return this[_0x4993('0xd')][_0x4993('0xa7')](util[_0x4993('0x28')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x1ac6b8[_0x4993('0x43')],_0x1ac6b8['list_id'],_0x1ac6b8[_0x4993('0x44')]));};AGIVertices[_0x4993('0x10')]['custom_app']=function(_0x3d35d3){logger['info'](util[_0x4993('0x28')](_0x4993('0xbe'),_0x3d35d3['label']));var _0x289296=this[_0x4993('0xd')][_0x4993('0xae')](_0x3d35d3[_0x4993('0xbf')],_0x3d35d3[_0x4993('0x75')]);if(_0x289296['result']===-0x1){return _0x289296;}return this[_0x4993('0xd')][_0x4993('0xa7')](util['format'](_0x4993('0xc0'),_0x3d35d3[_0x4993('0xbf')],_0x3d35d3['options']));};AGIVertices['prototype'][_0x4993('0xc1')]=function(_0x126dc){logger['info'](util[_0x4993('0x28')](_0x4993('0xc2'),_0x126dc[_0x4993('0xac')]));if(!this[_0x4993('0x81')](_0x126dc[_0x4993('0x54')])){return this[_0x4993('0xd')][_0x4993('0xa7')](_0x4993('0xc3'));}var _0xf153b3='\x22'+_0x126dc[_0x4993('0x54')]+'\x22';if(this[_0x4993('0x81')](_0x126dc[_0x4993('0x75')])){_0xf153b3+=','+_0x126dc['options'];}var _0x6828ea=this[_0x4993('0xd')][_0x4993('0xae')](_0x4993('0xa8'),_0xf153b3);if(_0x6828ea[_0x4993('0xa1')]===-0x1){return _0x6828ea;}return this[_0x4993('0xd')][_0x4993('0xa7')](util[_0x4993('0x28')](_0x4993('0xa9'),_0xf153b3));};AGIVertices[_0x4993('0x10')][_0x4993('0xc4')]=function(_0x41673f){logger[_0x4993('0x2c')](util[_0x4993('0x28')](_0x4993('0xc5'),_0x41673f['label']));if(!this[_0x4993('0x81')](_0x41673f[_0x4993('0x54')])){return this['channel'][_0x4993('0xa7')]('no\x20text\x20configured');}var _0x14ddd7='\x22'+_0x41673f[_0x4993('0x54')]+'\x22';if(this[_0x4993('0x81')](_0x41673f[_0x4993('0x75')])){_0x14ddd7+=','+_0x41673f[_0x4993('0x75')];}var _0x2707a1=this['channel'][_0x4993('0xae')](_0x4993('0xa8'),_0x14ddd7);if(_0x2707a1[_0x4993('0xa1')]===-0x1){return _0x2707a1;}return this[_0x4993('0xd')][_0x4993('0xa7')](util[_0x4993('0x28')](_0x4993('0xa9'),_0x14ddd7));};AGIVertices[_0x4993('0x10')]['lumenvoxasr']=function(_0x353ed8){logger[_0x4993('0x2c')](util[_0x4993('0x28')](_0x4993('0xc6'),_0x353ed8[_0x4993('0xac')]));if(!this['isConfigured'](_0x353ed8[_0x4993('0xad')])){return this[_0x4993('0xd')][_0x4993('0xa7')](_0x4993('0xc7'));}var _0x588ce7=_0x353ed8['grammar'];if(this[_0x4993('0x81')](_0x353ed8[_0x4993('0x75')])){_0x588ce7+=','+_0x353ed8[_0x4993('0x75')];}var _0x49e609=this['channel'][_0x4993('0xae')](_0x4993('0xc8'),_0x588ce7);if(_0x49e609[_0x4993('0xa1')]===-0x1){return _0x49e609;}var _0x47b0dc=this['getAndSetVariable'](_0x4993('0xc9'),_0x4993('0xca'));if(_0x47b0dc[_0x4993('0xa1')]===-0x1){return _0x47b0dc;}var _0x12822d=this[_0x4993('0xa0')](_0x4993('0xaf'),_0x4993('0xcb'));if(_0x12822d['result']===-0x1){return _0x12822d;}var _0x57f166=this[_0x4993('0xa0')](_0x4993('0xb0'),'LUMENVOX_ASR_INSTANCE');if(_0x57f166[_0x4993('0xa1')]===-0x1){return _0x57f166;}return this[_0x4993('0xd')][_0x4993('0xa7')](util[_0x4993('0x28')](_0x4993('0xb2'),_0x588ce7));};AGIVertices[_0x4993('0x10')]['sestekasr']=function(_0x146fd7){logger[_0x4993('0x2c')](util[_0x4993('0x28')](_0x4993('0xcc'),_0x146fd7['label']));if(!this[_0x4993('0x81')](_0x146fd7[_0x4993('0xad')])){return this[_0x4993('0xd')][_0x4993('0xa7')](_0x4993('0xc7'));}var _0x2bfb50=_0x146fd7['grammar'];if(this[_0x4993('0x81')](_0x146fd7[_0x4993('0x75')])){_0x2bfb50+=','+_0x146fd7[_0x4993('0x75')];}var _0x2f6243=this[_0x4993('0xd')][_0x4993('0xae')](_0x4993('0xc8'),_0x2bfb50);if(_0x2f6243['result']===-0x1){return _0x2f6243;}var _0x2bd9e0=this[_0x4993('0xa0')](_0x4993('0xc9'),_0x4993('0xcd'));if(_0x2bd9e0[_0x4993('0xa1')]===-0x1){return _0x2bd9e0;}var _0x259c02=this[_0x4993('0xa0')](_0x4993('0xaf'),'SESTEK_ASR_TRANSCRIPT');if(_0x259c02[_0x4993('0xa1')]===-0x1){return _0x259c02;}var _0x15f6fb=this[_0x4993('0xa0')]('RECOG_INSTANCE()','SESTEK_ASR_INSTANCE');if(_0x15f6fb[_0x4993('0xa1')]===-0x1){return _0x15f6fb;}return this[_0x4993('0xd')][_0x4993('0xa7')](util[_0x4993('0x28')](_0x4993('0xb2'),_0x2bfb50));};AGIVertices[_0x4993('0x10')][_0x4993('0xce')]=function(_0x369ff1){logger[_0x4993('0x2c')](util[_0x4993('0x28')](_0x4993('0xcf'),_0x369ff1['label']));if(!this['isConfigured'](_0x369ff1[_0x4993('0xd0')])){return this[_0x4993('0xd')][_0x4993('0x29')](_0x369ff1,_0x4993('0xd1'));}var _0x3f7be9=this['getSquareOdbc'][_0x4993('0xa3')](this,_0x369ff1[_0x4993('0xd0')]);if(!_0x3f7be9){return this['channel'][_0x4993('0x29')](_0x369ff1,_0x4993('0xd2'));}if(!this[_0x4993('0x81')](_0x369ff1[_0x4993('0x2b')])){return this['channel'][_0x4993('0x29')](_0x369ff1,_0x4993('0xd3'));}var _0x3d8b11=_0x369ff1[_0x4993('0x2b')][_0x4993('0xd4')](/(\r\n|\n|\r)/gm,'\x20');this[_0x4993('0xd')]['noop'](util[_0x4993('0x28')](_0x4993('0xd5'),_0x3d8b11));var _0x2755c4=this[_0x4993('0xd6')][_0x4993('0xa3')](this,_0x3f7be9,_0x3d8b11);this[_0x4993('0x32')]['sync'](this,_0x369ff1,_0x3d8b11);if(!this['isConfigured'](_0x369ff1['variable_id'])){return this[_0x4993('0xd')][_0x4993('0xa7')](_0x4993('0xd7'));}var _0x3be158=this[_0x4993('0x11')][_0x4993('0xa3')](this,_0x369ff1[_0x4993('0xd8')]);if(!_0x3be158){return this[_0x4993('0xd')]['error'](_0x369ff1,'no\x20variable\x20found');}var _0x84c54c=this;_0x2755c4[_0x4993('0xd9')](function(_0x47af0d,_0x21d498){Object[_0x4993('0xda')](_0x47af0d)[_0x4993('0xd9')](function(_0x462e5f){_0x84c54c[_0x4993('0xd')][_0x4993('0x9d')](util[_0x4993('0x28')](_0x4993('0xdb'),_0x3be158,_0x21d498,_0x462e5f),_0x47af0d[_0x462e5f]);});});this[_0x4993('0xd')][_0x4993('0x9d')](util[_0x4993('0x28')](_0x4993('0xdc'),_0x3be158),_0x2755c4[_0x4993('0x9c')]);return this['channel']['noop'](util[_0x4993('0x28')](_0x4993('0xdd'),_0x3be158));};AGIVertices[_0x4993('0x10')][_0x4993('0xde')]=function(_0x10ab40){logger[_0x4993('0xdf')](util[_0x4993('0x28')](_0x4993('0xe0'),_0x10ab40[_0x4993('0xac')]));if(!this[_0x4993('0x81')](_0x10ab40['sip_id'])){return this['channel'][_0x4993('0x29')](_0x10ab40,'no\x20user\x20selected');}var _0x3cb962=this[_0x4993('0xe1')][_0x4993('0xa3')](this,_0x10ab40[_0x4993('0xe2')]);if(!_0x3cb962){return this[_0x4993('0xd')][_0x4993('0x29')](_0x10ab40,_0x4993('0xe3'));}var _0x3db012=this[_0x4993('0xd')]['exec'](_0x4993('0xe4'),[util[_0x4993('0x28')](_0x4993('0xe5'),_0x3cb962),_0x10ab40['timeout'],_0x10ab40[_0x4993('0xe6')],_0x10ab40[_0x4993('0x5e')]]);if(_0x3db012['result']===-0x1){return _0x3db012;}return this[_0x4993('0xd')][_0x4993('0xa7')](util[_0x4993('0x28')]('Executed\x20command\x20%s','DIAL'));};AGIVertices[_0x4993('0x10')][_0x4993('0xe7')]=function(_0x413ae6){logger[_0x4993('0x2c')](util[_0x4993('0x28')](_0x4993('0xe8'),_0x413ae6[_0x4993('0xac')]));if(!this[_0x4993('0x81')](_0x413ae6[_0x4993('0x77')])){return this[_0x4993('0xd')][_0x4993('0xa7')](_0x4993('0xe9'));}if(!this['isConfigured'](_0x413ae6[_0x4993('0x54')])){return this[_0x4993('0xd')][_0x4993('0xa7')]('no\x20text\x20configured');}this['channel'][_0x4993('0xea')]=!![];this[_0x4993('0x32')](_0x413ae6);this[_0x4993('0x3d')](_0x413ae6[_0x4993('0x54')],'in','','');this[_0x4993('0xd')][_0x4993('0xa7')](util[_0x4993('0x28')](_0x4993('0xeb'),_0x413ae6[_0x4993('0x54')]));var _0x6c97a7=this['googleDialogflow'][_0x4993('0xa3')](this,_0x413ae6);if(_0x6c97a7){for(var _0x42a86e in _0x6c97a7){if(_0x6c97a7['hasOwnProperty'](_0x42a86e)){this[_0x4993('0xd')][_0x4993('0x9d')](util[_0x4993('0x28')](_0x4993('0xec'),_0x42a86e[_0x4993('0xed')]()),_0x6c97a7[_0x42a86e]);}}this['createSquareMessage'](_0x6c97a7[_0x4993('0xee')],'out','dialogflow','');return this[_0x4993('0xd')][_0x4993('0xa7')](util[_0x4993('0x28')]('Dialogflow\x20Result\x20%s',_0x6c97a7['speech']));}return this['channel']['error'](_0x413ae6,_0x4993('0xef'));};AGIVertices[_0x4993('0x10')]['dialogflowV2']=function(_0x210e2c){logger[_0x4993('0x2c')](util[_0x4993('0x28')](_0x4993('0xf0'),_0x210e2c[_0x4993('0xac')]));if(!this[_0x4993('0x81')](_0x210e2c[_0x4993('0x7a')])){return this[_0x4993('0xd')][_0x4993('0xa7')](_0x4993('0xf1'));}if(!this['isConfigured'](_0x210e2c[_0x4993('0x7b')])){return this[_0x4993('0xd')][_0x4993('0xa7')](_0x4993('0xf2'));}if(!this[_0x4993('0x81')](_0x210e2c[_0x4993('0x7c')])){return this[_0x4993('0xd')]['noop'](_0x4993('0xf3'));}if(!this[_0x4993('0x81')](_0x210e2c[_0x4993('0xf4')])){return this[_0x4993('0xd')][_0x4993('0xa7')](_0x4993('0xf5'));}if(!this['isConfigured'](_0x210e2c[_0x4993('0x54')])){return this['channel']['noop'](_0x4993('0xc3'));}this[_0x4993('0xd')]['bot']=!![];this['createSquareDetailsReport'](_0x210e2c);this['createSquareMessage'](_0x210e2c['text'],'in','','');this[_0x4993('0xd')][_0x4993('0xa7')](util[_0x4993('0x28')]('Trying\x20DialogflowV2:\x20%s',_0x210e2c[_0x4993('0x54')]));var _0x4388d3=this[_0x4993('0x79')][_0x4993('0xa3')](this,_0x210e2c);if(_0x4388d3){for(var _0x1e2af9 in _0x4388d3){if(_0x4388d3[_0x4993('0x95')](_0x1e2af9)){if(_0x1e2af9!==_0x4993('0xf6')){this[_0x4993('0xd')][_0x4993('0x9d')](util[_0x4993('0x28')](_0x4993('0xec'),_0x1e2af9['toUpperCase']()),_0x4388d3[_0x1e2af9]);}}}this[_0x4993('0x3d')](_0x4388d3[_0x4993('0xee')],_0x4993('0xf7'),_0x4993('0xf8'),_0x4388d3[_0x4993('0xf6')]);return this[_0x4993('0xd')][_0x4993('0xa7')](util[_0x4993('0x28')](_0x4993('0xf9'),_0x4388d3[_0x4993('0xee')]));}return this[_0x4993('0xd')][_0x4993('0x29')](_0x210e2c,_0x4993('0xfa'));};AGIVertices['prototype'][_0x4993('0xfb')]=function(_0x853976){logger[_0x4993('0x2c')](util[_0x4993('0x28')](_0x4993('0xfc'),_0x853976['label']));if(!this[_0x4993('0x81')](_0x853976[_0x4993('0xfd')])){return this['channel'][_0x4993('0xa7')](_0x4993('0xfe'));}if(!this[_0x4993('0x81')](_0x853976[_0x4993('0xff')])){return this['channel'][_0x4993('0xa7')](_0x4993('0x100'));}if(!this[_0x4993('0x81')](_0x853976['password'])){return this[_0x4993('0xd')][_0x4993('0xa7')](_0x4993('0x101'));}if(!this[_0x4993('0x81')](_0x853976[_0x4993('0x102')])){return this[_0x4993('0xd')][_0x4993('0xa7')](_0x4993('0xc3'));}this[_0x4993('0xd')][_0x4993('0xea')]=!![];this['createSquareDetailsReport'](_0x853976);this[_0x4993('0x3d')](_0x853976['text'],'in','','');this[_0x4993('0xd')][_0x4993('0xa7')](util[_0x4993('0x28')](_0x4993('0x103'),_0x853976['text']));var _0x2b745a=this[_0x4993('0x7d')]['sync'](this,_0x853976);if(_0x2b745a){for(var _0x503780 in _0x2b745a){if(_0x2b745a[_0x4993('0x95')](_0x503780)){this[_0x4993('0xd')]['setVariable'](util[_0x4993('0x28')](_0x4993('0x104'),_0x503780[_0x4993('0xed')]()),_0x2b745a[_0x503780]);}}this[_0x4993('0x3d')](_0x2b745a[_0x4993('0xee')],_0x4993('0xf7'),_0x4993('0xfb'),'');if(_0x2b745a[_0x4993('0x105')]){this[_0x4993('0xd')][_0x4993('0xa7')](util[_0x4993('0x28')](_0x4993('0x106'),_0x2b745a[_0x4993('0x105')]));var _0x221df6=this[_0x4993('0xd')][_0x4993('0x107')](_0x2b745a[_0x4993('0x105')]);try{fs['unlink'](_0x2b745a[_0x4993('0x105')]+'.wav');}catch(_0x2a027f){logger[_0x4993('0x29')](_0x2a027f);}return _0x221df6;}else{return this[_0x4993('0xd')][_0x4993('0xa7')](util[_0x4993('0x28')]('SestekNDA\x20Result\x20%s',_0x2b745a[_0x4993('0xee')]));}}return this['channel']['error'](_0x853976,_0x4993('0x108'));};AGIVertices[_0x4993('0x10')][_0x4993('0x109')]=function(_0x28379b){logger[_0x4993('0x2c')](util[_0x4993('0x28')](_0x4993('0x10a'),_0x28379b[_0x4993('0xac')]));return this[_0x4993('0xd')][_0x4993('0xa7')](_0x4993('0x109'));};AGIVertices[_0x4993('0x10')][_0x4993('0x10b')]=function(_0x472495){logger[_0x4993('0x2c')](util[_0x4993('0x28')](_0x4993('0x10c'),_0x472495['label']));var _0x445de5='';if(_0x472495['trunk_id']){if(!this[_0x4993('0x81')](_0x472495[_0x4993('0x10d')])){return this['channel'][_0x4993('0x29')](_0x472495,_0x4993('0x10e'));}else{var _0x37515c=parseInt(_0x472495[_0x4993('0x10d')],0xa);if(isNaN(_0x37515c)){_0x445de5=_0x472495[_0x4993('0x10d')];}else{_0x445de5=this['getTrunk']['sync'](this,_0x472495[_0x4993('0x10d')]);if(!_0x445de5){return this[_0x4993('0xd')][_0x4993('0x29')](_0x472495,_0x4993('0x10f'));}}}}else if(_0x472495[_0x4993('0x110')]){_0x445de5=_0x472495[_0x4993('0x110')];}else{return this[_0x4993('0xd')]['error'](_0x472495,_0x4993('0x10e'));}var _0x4e3f96=this['channel'][_0x4993('0xae')](_0x4993('0xe4'),[util[_0x4993('0x28')]('SIP/%s/%s',_0x445de5,_0x472495[_0x4993('0x43')]),_0x472495['timeout'],_0x472495['opts'],_0x472495['url']]);if(_0x4e3f96['result']===-0x1){return _0x4e3f96;}return this[_0x4993('0xd')]['noop'](util[_0x4993('0x28')](_0x4993('0x111'),_0x4993('0xe4')));};AGIVertices['prototype'][_0x4993('0x112')]=function(_0x4ece7a){logger[_0x4993('0x2c')](util[_0x4993('0x28')](_0x4993('0x113'),_0x4ece7a[_0x4993('0xac')]));return this[_0x4993('0xd')]['noop'](_0x4993('0x112'));};AGIVertices[_0x4993('0x10')]['getdigits']=function(_0x65500b){logger[_0x4993('0x2c')](util[_0x4993('0x28')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x65500b[_0x4993('0xac')]));if(_0x65500b[_0x4993('0xa4')]===0x0){return this['maxRetry'](_0x65500b);}_0x65500b[_0x4993('0xa4')]-=0x1;if(!this[_0x4993('0x81')](_0x65500b[_0x4993('0x114')])){return this[_0x4993('0xd')][_0x4993('0x29')](_0x65500b,_0x4993('0x115'));}var _0x38fdee=this[_0x4993('0x1f')]['sync'](this,_0x65500b[_0x4993('0x114')]);if(!_0x38fdee){return this[_0x4993('0xd')][_0x4993('0x29')](_0x65500b,_0x4993('0x116'));}if(!this[_0x4993('0x81')](_0x65500b[_0x4993('0xd8')])){return this[_0x4993('0xd')]['error']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x1a20ea=this[_0x4993('0xd')][_0x4993('0x117')](_0x38fdee,_0x65500b[_0x4993('0x118')],_0x65500b[_0x4993('0x119')]);var _0x54e08a=_0x1a20ea[_0x4993('0xa1')]?_0x1a20ea[_0x4993('0xa1')][_0x4993('0x46')]():'';logger[_0x4993('0x2c')](_0x4993('0x11a'),JSON['stringify'](_0x1a20ea));if(_0x1a20ea[_0x4993('0xa1')]===-0x1){this[_0x4993('0x32')][_0x4993('0xa3')](this,_0x65500b,_0x54e08a);return _0x1a20ea;}else if(_0x1a20ea[_0x4993('0x9f')]===_0x4993('0x5f')){_0x1a20ea[_0x4993('0xa1')]=_0x54e08a[_0x4993('0x9c')]>=parseInt(_0x65500b[_0x4993('0x11b')])?'x':'i';}else{_0x1a20ea['result']=_0x54e08a['length']>=parseInt(_0x65500b['mindigit'])&&_0x54e08a[_0x4993('0x9c')]<=parseInt(_0x65500b[_0x4993('0x119')])?'x':'i';}var _0x329edd=this[_0x4993('0x11')][_0x4993('0xa3')](this,_0x65500b[_0x4993('0xd8')]);if(!_0x329edd){return this['channel']['error'](_0x65500b,'no\x20variable\x20found');}this['channel'][_0x4993('0x9d')](_0x329edd,_0x54e08a);if(this[_0x4993('0x81')](_0x65500b[_0x4993('0x11c')])){var _0x14e39c=parseInt(_0x65500b[_0x4993('0x11c')],0xa);var _0x5df7e6=rs[_0x4993('0x11d')]({'charset':'*','length':_0x14e39c});var _0x61fbf2=_0x54e08a[_0x4993('0x9c')];if(_0x61fbf2>0x0){if(_0x61fbf2>_0x14e39c){this[_0x4993('0x32')]['sync'](this,_0x65500b,_0x65500b[_0x4993('0x11e')]===_0x4993('0x11f')?_0x5df7e6+_0x54e08a[_0x4993('0x120')](_0x14e39c):_0x54e08a[_0x4993('0x120')](0x0,_0x61fbf2-_0x14e39c)+_0x5df7e6);}else{this[_0x4993('0x32')][_0x4993('0xa3')](this,_0x65500b,rs['generate']({'charset':'*','length':_0x61fbf2}));}}else{this['createSquareDetailsReport'][_0x4993('0xa3')](this,_0x65500b,'');}}else{this[_0x4993('0x32')]['sync'](this,_0x65500b,_0x54e08a);}return _0x1a20ea;};AGIVertices[_0x4993('0x10')][_0x4993('0x121')]=function(_0x40165f){logger[_0x4993('0x2c')](util[_0x4993('0x28')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x40165f[_0x4993('0xac')]));return this[_0x4993('0xc')](_0x40165f);};AGIVertices[_0x4993('0x10')][_0x4993('0x122')]=function(_0x4447e2){logger['info'](util[_0x4993('0x28')](_0x4993('0x123'),_0x4447e2[_0x4993('0xac')]));this[_0x4993('0x32')]['sync'](this,_0x4447e2,_0x4447e2['goalname']);return this[_0x4993('0xd')]['noop'](util[_0x4993('0x28')]('GOAL\x20%s',_0x4447e2[_0x4993('0x124')]));};AGIVertices[_0x4993('0x10')][_0x4993('0x125')]=function(_0x2f93c5){logger[_0x4993('0x2c')](util['format'](_0x4993('0x126'),_0x2f93c5['label']));if(!this[_0x4993('0x81')](_0x2f93c5['aws_access_key_id'])||!this['isConfigured'](_0x2f93c5[_0x4993('0x85')])){return this[_0x4993('0xd')][_0x4993('0xa7')](_0x4993('0x127'));}if(!this[_0x4993('0x81')](_0x2f93c5[_0x4993('0x54')])){return this[_0x4993('0xd')]['noop']('no\x20text\x20configured');}this[_0x4993('0xd')]['noop'](util[_0x4993('0x28')](_0x4993('0x128'),_0x2f93c5[_0x4993('0x54')]));var _0x2e1c63=this[_0x4993('0x83')][_0x4993('0xa3')](this,_0x2f93c5);if(_0x2e1c63){this[_0x4993('0xd')][_0x4993('0xa7')](util[_0x4993('0x28')](_0x4993('0x129'),_0x2e1c63));var _0x14800e=this[_0x4993('0xd')][_0x4993('0x107')](_0x2e1c63);try{fs[_0x4993('0x12a')](_0x2e1c63+_0x4993('0x12b'));}catch(_0x73a63e){logger['error'](_0x73a63e);}return _0x14800e;}return this[_0x4993('0xd')]['error'](_0x2f93c5,_0x4993('0x12c'));};AGIVertices[_0x4993('0x10')]['awslex']=function(_0x45f0fc){logger[_0x4993('0x2c')](util['format']('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x45f0fc['label']));if(!this[_0x4993('0x81')](_0x45f0fc[_0x4993('0x84')])||!this['isConfigured'](_0x45f0fc[_0x4993('0x85')])){return this[_0x4993('0xd')][_0x4993('0xa7')](_0x4993('0x127'));}if(!this['isConfigured'](_0x45f0fc[_0x4993('0x8c')])){return this[_0x4993('0xd')][_0x4993('0xa7')](_0x4993('0x12d'));}if(!this[_0x4993('0x81')](_0x45f0fc['text'])){return this['channel'][_0x4993('0xa7')](_0x4993('0xc3'));}this['channel'][_0x4993('0xea')]=!![];this[_0x4993('0x32')](_0x45f0fc);this[_0x4993('0x3d')](_0x45f0fc[_0x4993('0x54')],'in','','');this['channel'][_0x4993('0xa7')](util[_0x4993('0x28')](_0x4993('0x12e'),_0x45f0fc[_0x4993('0x54')]));var _0x3d7c12=this['awsLex']['sync'](this,_0x45f0fc);if(_0x3d7c12){for(var _0x1482e8 in _0x3d7c12){if(_0x3d7c12[_0x4993('0x95')](_0x1482e8)&&_[_0x4993('0x97')](_0x3d7c12[_0x1482e8])){this[_0x4993('0xd')][_0x4993('0x9d')](util[_0x4993('0x28')](_0x4993('0x12f'),_0x1482e8[_0x4993('0xed')]()),_0x3d7c12[_0x1482e8]);}}if(_['isNil'](_0x3d7c12['message'])){return this['channel']['noop'](_0x4993('0x130'));}else{this[_0x4993('0x3d')](_0x3d7c12['message'],_0x4993('0xf7'),'amazonlex','');return this[_0x4993('0xd')]['noop'](util['format']('Amazon\x20Lex\x20Result\x20%s',_0x3d7c12[_0x4993('0x73')]));}}return this['channel']['error'](_0x45f0fc,_0x4993('0x131'));};AGIVertices['prototype'][_0x4993('0x132')]=function(_0x2dec57){logger[_0x4993('0x2c')](util['format'](_0x4993('0x133'),_0x2dec57[_0x4993('0xac')],_0x2dec57[_0x4993('0x5f')]));if(!this[_0x4993('0x81')](_0x2dec57[_0x4993('0x77')])){return this[_0x4993('0xd')][_0x4993('0xa7')](_0x4993('0xe9'));}var _0x5eb9c7='wav';var _0x32badf=util[_0x4993('0x28')](_0x4993('0x134'),FILES_PATH,rs[_0x4993('0x11d')](0x4));var _0x2e670f=util[_0x4993('0x28')](_0x4993('0x9a'),_0x32badf,_0x5eb9c7);var _0x4475d5=!![];if(_0x2dec57['beep']===_0x4993('0x135')){_0x4475d5=![];}var _0x3f1a9a=this[_0x4993('0xd')][_0x4993('0x136')](_0x32badf,_0x5eb9c7,_0x2dec57[_0x4993('0x137')],_0x2dec57[_0x4993('0x5f')],undefined,_0x4475d5);if(_0x3f1a9a['result']!==-0x1){this[_0x4993('0xd')]['noop'](util[_0x4993('0x28')](_0x4993('0x138'),_0x2e670f));var _0x177068=this[_0x4993('0x8d')][_0x4993('0xa3')](this,_0x2dec57,_0x2e670f);if(_0x177068){for(var _0x50081c in _0x177068){if(_0x177068[_0x4993('0x95')](_0x50081c)){this[_0x4993('0xd')][_0x4993('0x9d')](util[_0x4993('0x28')]('GOOGLE_ASR_%s',_0x50081c[_0x4993('0xed')]()),_0x177068[_0x50081c]);}}return this[_0x4993('0xd')]['noop'](util[_0x4993('0x28')](_0x4993('0x139'),JSON[_0x4993('0x6e')](_0x177068)));}}return _0x3f1a9a;};AGIVertices['prototype'][_0x4993('0x13a')]=function(_0x542546){logger[_0x4993('0x2c')](util['format']('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x542546['label']));if(!this[_0x4993('0x81')](_0x542546[_0x4993('0x90')])){return this['channel'][_0x4993('0xa7')](_0x4993('0x13b'));}if(!this['isConfigured'](_0x542546[_0x4993('0x91')])){return this[_0x4993('0xd')][_0x4993('0xa7')](_0x4993('0x13c'));}var _0x29cf2e=_0x4993('0x13d');var _0x4537ea=util['format'](_0x4993('0x134'),FILES_PATH,rs['generate'](0x4));var _0x404d2b=util['format'](_0x4993('0x9a'),_0x4537ea,_0x29cf2e);var _0x4a497b=!![];if(_0x542546[_0x4993('0x13e')]==='NOBEEP'){_0x4a497b=![];}var _0x26fabc=this[_0x4993('0xd')]['recordFile'](_0x4537ea,_0x29cf2e,_0x542546[_0x4993('0x137')],_0x542546['timeout'],undefined,_0x4a497b);if(_0x26fabc['result']!==-0x1){this[_0x4993('0xd')][_0x4993('0xa7')](util[_0x4993('0x28')](_0x4993('0x13f'),_0x404d2b));var _0x4d15d7=this['tildeASR'][_0x4993('0xa3')](this,_0x542546,_0x404d2b);if(_0x4d15d7){for(var _0x1f4f2b in _0x4d15d7){if(_0x4d15d7[_0x4993('0x95')](_0x1f4f2b)){this[_0x4993('0xd')]['setVariable'](util[_0x4993('0x28')]('TILDE_ASR_%s',_0x1f4f2b[_0x4993('0xed')]()),_0x4d15d7[_0x1f4f2b]);}}return this[_0x4993('0xd')]['noop'](util[_0x4993('0x28')]('TildeASR\x20Result\x20%s',JSON['stringify'](_0x4d15d7)));}}return _0x26fabc;};AGIVertices[_0x4993('0x10')][_0x4993('0x140')]=function(_0x42fb91){logger[_0x4993('0x2c')](util[_0x4993('0x28')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x42fb91[_0x4993('0xac')]));return this[_0x4993('0xd')][_0x4993('0x141')](_0x42fb91[_0x4993('0x38')],_0x42fb91[_0x4993('0x39')],_0x42fb91['priority']);};AGIVertices[_0x4993('0x10')][_0x4993('0x142')]=function(_0x1ee888){logger[_0x4993('0x2c')](util[_0x4993('0x28')](_0x4993('0x143'),_0x1ee888[_0x4993('0xac')]));if(!this['isConfigured'](_0x1ee888[_0x4993('0x144')])){return this[_0x4993('0xd')][_0x4993('0x29')](_0x1ee888,_0x4993('0x145'));}try{var _0x1efbd9=eval(_0x1ee888[_0x4993('0x144')])?_0x4993('0x146'):_0x4993('0x147');this[_0x4993('0xd')]['noop'](util[_0x4993('0x28')](_0x4993('0x148'),_0x1ee888['condition'],_0x1efbd9));return{'code':0xc8,'result':_0x1efbd9};}catch(_0x168773){return{'code':0xc8,'result':_0x4993('0x147')};}};AGIVertices[_0x4993('0x10')]['gotoiftime']=function(_0x214a8b){logger[_0x4993('0x2c')](util[_0x4993('0x28')](_0x4993('0x149'),_0x214a8b[_0x4993('0xac')]));if(!this[_0x4993('0x81')](_0x214a8b[_0x4993('0x14a')])){return this[_0x4993('0xd')][_0x4993('0x29')](_0x214a8b,_0x4993('0x14b'));}var _0x3dd5f3=this[_0x4993('0x14c')][_0x4993('0xa3')](this,_0x214a8b['interval_id']);if(!_0x3dd5f3){return this[_0x4993('0xd')][_0x4993('0x29')](_0x214a8b,_0x4993('0x14d'));}for(var _0x5aae5f=0x0;_0x5aae5f<_0x3dd5f3[_0x4993('0x9c')];_0x5aae5f+=0x1){var _0x419b6c=this[_0x4993('0xd')][_0x4993('0x11')](util[_0x4993('0x28')]('IFTIME(%s?true:false)',_0x3dd5f3[_0x5aae5f]));if(_0x419b6c[_0x4993('0xa1')]===-0x1){return _0x419b6c;}logger['info'](util[_0x4993('0x28')](_0x4993('0x14e'),_0x3dd5f3[_0x5aae5f],_0x419b6c[_0x4993('0x9f')]));if(_0x419b6c[_0x4993('0x9f')]===_0x4993('0x146')){logger[_0x4993('0x2c')](util['format'](_0x4993('0x14e'),_0x3dd5f3[_0x5aae5f],_0x4993('0x146')));this[_0x4993('0xd')][_0x4993('0xa7')](util[_0x4993('0x28')](_0x4993('0x14e'),_0x3dd5f3[_0x5aae5f],_0x4993('0x146')));return{'code':0xc8,'result':'true'};}else{logger[_0x4993('0x2c')](util['format'](_0x4993('0x14e'),_0x3dd5f3[_0x5aae5f],'false'));this[_0x4993('0xd')]['noop'](util['format'](_0x4993('0x14e'),_0x3dd5f3[_0x5aae5f],_0x4993('0x147')));}}return{'code':0xc8,'result':_0x4993('0x147')};};AGIVertices[_0x4993('0x10')][_0x4993('0x14f')]=function(_0x1ed432){logger[_0x4993('0x2c')](util[_0x4993('0x28')](_0x4993('0x150'),_0x1ed432[_0x4993('0xac')]));return this[_0x4993('0xd')][_0x4993('0x14f')]();};AGIVertices['prototype'][_0x4993('0x151')]=function(_0xa24cf5){logger[_0x4993('0x2c')](util[_0x4993('0x28')](_0x4993('0x152'),_0xa24cf5['label']));if(!this[_0x4993('0x81')](_0xa24cf5[_0x4993('0x77')])){return this[_0x4993('0xd')][_0x4993('0xa7')](_0x4993('0xe9'));}var _0x411726=_0x4993('0x13d');var _0x4fbf74=util[_0x4993('0x28')](_0x4993('0x134'),FILES_PATH,rs['generate'](0x4));var _0x2df87e=util[_0x4993('0x28')](_0x4993('0x9a'),_0x4fbf74,_0x411726);var _0x57733a=!![];if(_0xa24cf5[_0x4993('0x13e')]==='NOBEEP'){_0x57733a=![];}var _0x5e94a8=this[_0x4993('0xd')][_0x4993('0x136')](_0x4fbf74,_0x411726,_0xa24cf5[_0x4993('0x137')],_0xa24cf5[_0x4993('0x5f')],undefined,_0x57733a);if(_0x5e94a8[_0x4993('0xa1')]!==-0x1){this['channel']['noop'](util[_0x4993('0x28')](_0x4993('0x153'),_0x2df87e));var _0x34842c=this[_0x4993('0x80')]['sync'](this,_0xa24cf5,_0x2df87e);if(_0x34842c){for(var _0x453649 in _0x34842c){if(_0x34842c[_0x4993('0x95')](_0x453649)){this[_0x4993('0xd')][_0x4993('0x9d')](util['format'](_0x4993('0x154'),_0x453649['toUpperCase']()),_0x34842c[_0x453649]);}}return this[_0x4993('0xd')][_0x4993('0xa7')](util[_0x4993('0x28')](_0x4993('0x155'),JSON[_0x4993('0x6e')](_0x34842c)));}}return _0x5e94a8;};AGIVertices[_0x4993('0x10')][_0x4993('0x156')]=function(_0x2e8c52){logger[_0x4993('0x2c')](util[_0x4993('0x28')](_0x4993('0x157'),_0x2e8c52[_0x4993('0xac')]));if(!this['isConfigured'](_0x2e8c52[_0x4993('0x77')])){return this[_0x4993('0xd')][_0x4993('0xa7')](_0x4993('0xe9'));}if(!this['isConfigured'](_0x2e8c52['text'])){return this[_0x4993('0xd')][_0x4993('0xa7')](_0x4993('0xc3'));}this[_0x4993('0xd')]['noop'](util[_0x4993('0x28')](_0x4993('0x158'),_0x2e8c52[_0x4993('0x54')]));var _0x1edfdd=this[_0x4993('0x7e')]['sync'](this,_0x2e8c52);if(_0x1edfdd){this[_0x4993('0xd')][_0x4993('0xa7')](util[_0x4993('0x28')](_0x4993('0x153'),_0x1edfdd));var _0x39be9a=this['channel']['streamFile'](_0x1edfdd,_0x2e8c52[_0x4993('0x137')]);try{fs[_0x4993('0x12a')](_0x1edfdd+_0x4993('0x12b'));}catch(_0x2bd52a){logger['error'](_0x2bd52a);}return _0x39be9a;}return this[_0x4993('0xd')][_0x4993('0x29')](_0x2e8c52,_0x4993('0x159'));};AGIVertices['prototype'][_0x4993('0x15a')]=function(_0x2851f4){logger[_0x4993('0x2c')](util[_0x4993('0x28')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x2851f4[_0x4993('0xac')]));if(!this[_0x4993('0x81')](_0x2851f4[_0x4993('0x15b')])){return this[_0x4993('0xd')][_0x4993('0x29')](_0x2851f4,_0x4993('0x15c'));}logger['info'](util[_0x4993('0x28')](_0x4993('0x15d'),this[_0x4993('0xd')][_0x4993('0x36')],_0x2851f4[_0x4993('0x15b')]));var _0x5c1a20=this[_0x4993('0x4b')][_0x4993('0xa3')](this,_0x2851f4[_0x4993('0x15b')]);if(_0x5c1a20){logger['info'](util[_0x4993('0x28')](_0x4993('0x15e'),this['channel'][_0x4993('0x36')],_0x2851f4['findBy']));this[_0x4993('0xd')][_0x4993('0xa7')](util[_0x4993('0x28')](_0x4993('0x15e'),this[_0x4993('0xd')]['callerid'],_0x2851f4['findBy']));return{'code':0xc8,'result':_0x4993('0x15f')};}else{logger[_0x4993('0x2c')](util['format'](_0x4993('0x160'),this[_0x4993('0xd')]['callerid'],_0x2851f4[_0x4993('0x15b')]));this['channel'][_0x4993('0xa7')](util[_0x4993('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x4993('0xd')][_0x4993('0x36')],_0x2851f4[_0x4993('0x15b')]));return{'code':0xc8,'result':_0x4993('0x161')};}};AGIVertices[_0x4993('0x10')][_0x4993('0x162')]=function(_0x4fbbc5){logger['info'](util[_0x4993('0x28')](_0x4993('0x163'),_0x4fbbc5['label']));if(!this[_0x4993('0x81')](_0x4fbbc5[_0x4993('0x15b')])){return this[_0x4993('0xd')][_0x4993('0x29')](_0x4fbbc5,_0x4993('0x15c'));}logger[_0x4993('0x2c')](util[_0x4993('0x28')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x4993('0xd')][_0x4993('0x36')],_0x4fbbc5[_0x4993('0x15b')]));var _0x4ba0bb=this['agentLogout'][_0x4993('0xa3')](this,_0x4fbbc5[_0x4993('0x15b')]);if(_0x4ba0bb){logger[_0x4993('0x2c')](util['format'](_0x4993('0x15e'),this[_0x4993('0xd')][_0x4993('0x36')],_0x4fbbc5['findBy']));this[_0x4993('0xd')][_0x4993('0xa7')](util['format'](_0x4993('0x15e'),this[_0x4993('0xd')][_0x4993('0x36')],_0x4fbbc5[_0x4993('0x15b')]));return{'code':0xc8,'result':_0x4993('0x15f')};}else{logger[_0x4993('0x2c')](util[_0x4993('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x4993('0xd')][_0x4993('0x36')],_0x4fbbc5[_0x4993('0x15b')]));this['channel'][_0x4993('0xa7')](util[_0x4993('0x28')](_0x4993('0x160'),this[_0x4993('0xd')]['callerid'],_0x4fbbc5[_0x4993('0x15b')]));return{'code':0xc8,'result':_0x4993('0x161')};}};AGIVertices[_0x4993('0x10')][_0x4993('0x164')]=function(_0x45712d){logger['info'](util[_0x4993('0x28')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x45712d[_0x4993('0xac')]));if(!this[_0x4993('0x81')](_0x45712d[_0x4993('0x165')])){return this['channel'][_0x4993('0x29')](_0x45712d,_0x4993('0x166'));}this['channel'][_0x4993('0xa7')](util[_0x4993('0x28')](_0x4993('0x167'),_0x45712d['operation']));var _0x43e343=eval(_0x45712d['operation']);if(!this[_0x4993('0x81')](_0x45712d[_0x4993('0xd8')])){return this[_0x4993('0xd')][_0x4993('0xa7')](_0x4993('0xd7'));}var _0x144c9c=this['getVariable']['sync'](this,_0x45712d[_0x4993('0xd8')]);if(!_0x144c9c){return this[_0x4993('0xd')][_0x4993('0x29')](_0x45712d,_0x4993('0x168'));}if(_[_0x4993('0x9b')](_0x43e343)){var _0x55f25e=this;_0x43e343[_0x4993('0xd9')](function(_0x3733ca,_0x338679){_0x55f25e['channel'][_0x4993('0x9d')](util[_0x4993('0x28')]('%s[%s]',_0x144c9c,_0x338679),_0x3733ca);});return this[_0x4993('0xd')]['noop'](util[_0x4993('0x28')]('variable\x20%s[key]\x20set',_0x144c9c));}else{return this['channel'][_0x4993('0x9d')](_0x144c9c,_0x43e343);}};AGIVertices['prototype'][_0x4993('0xb')]=function(_0x60e933){logger[_0x4993('0x2c')](util[_0x4993('0x28')](_0x4993('0x169'),_0x60e933[_0x4993('0xac')]));if(_0x60e933['retry']===0x0){return this['maxRetry'](_0x60e933);}_0x60e933[_0x4993('0xa4')]-=0x1;if(!this[_0x4993('0x81')](_0x60e933[_0x4993('0x114')])){return this[_0x4993('0xd')][_0x4993('0x29')](_0x60e933,_0x4993('0x115'));}var _0x51152f=this[_0x4993('0x1f')][_0x4993('0xa3')](this,_0x60e933['file_id']);if(!_0x51152f){return this[_0x4993('0xd')][_0x4993('0x29')](_0x60e933,_0x4993('0x116'));}var _0x4e41fd=this['channel'][_0x4993('0x117')](_0x51152f,_0x60e933['response'],_0x60e933['digit']);var _0x3af0b5=_0x4e41fd[_0x4993('0xa1')];if(_0x4e41fd['result']===-0x1){this[_0x4993('0x32')]['sync'](this,_0x60e933,'-1');return _0x4e41fd;}else if(_0x4e41fd[_0x4993('0x9f')]==='timeout'){_0x4e41fd[_0x4993('0xa1')]=_0x4e41fd[_0x4993('0xa1')][_0x4993('0x9c')]>0x0?_0x4e41fd[_0x4993('0xa1')]:'t';}else if(_[_0x4993('0x41')](_0x4e41fd['result'])){_0x4e41fd[_0x4993('0xa1')]='#';_0x3af0b5='#';}if(!this[_0x4993('0x81')](_0x60e933['variable_id'])){this[_0x4993('0xd')][_0x4993('0xa7')](_0x4993('0xd7'));}else{var _0x2d20da=this[_0x4993('0x11')][_0x4993('0xa3')](this,_0x60e933[_0x4993('0xd8')]);if(!_0x2d20da){return this[_0x4993('0xd')][_0x4993('0x29')](_0x60e933,'no\x20variable\x20found');}this['channel'][_0x4993('0x9d')](_0x2d20da,_0x3af0b5);}this[_0x4993('0x32')][_0x4993('0xa3')](this,_0x60e933,_0x3af0b5);return _0x4e41fd;};AGIVertices['prototype'][_0x4993('0xa7')]=function(_0x302bc9){logger['info'](util[_0x4993('0x28')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x302bc9['label']));return this[_0x4993('0xd')][_0x4993('0xa7')](_0x302bc9[_0x4993('0x16a')]||_0x302bc9[_0x4993('0xac')]);};AGIVertices[_0x4993('0x10')]['pause']=function(_0xf02783){logger[_0x4993('0x2c')](util[_0x4993('0x28')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0xf02783[_0x4993('0xac')]));if(!this[_0x4993('0x81')](_0xf02783[_0x4993('0x15b')])){return this[_0x4993('0xd')]['error'](_0xf02783,_0x4993('0x15c'));}logger['info'](util['format'](_0x4993('0x15d'),this['channel'][_0x4993('0x36')],_0xf02783['findBy']));var _0x1051b6=this['getPause'][_0x4993('0xa3')](this,_0xf02783[_0x4993('0x16b')]);var _0xe1e967=this[_0x4993('0x48')][_0x4993('0xa3')](this,_0xf02783[_0x4993('0x15b')],_0x1051b6);if(_0xe1e967){logger[_0x4993('0x2c')](util[_0x4993('0x28')](_0x4993('0x15e'),this['channel'][_0x4993('0x36')],_0xf02783[_0x4993('0x15b')]));this[_0x4993('0xd')][_0x4993('0xa7')](util[_0x4993('0x28')](_0x4993('0x15e'),this[_0x4993('0xd')][_0x4993('0x36')],_0xf02783[_0x4993('0x15b')]));return{'code':0xc8,'result':_0x4993('0x15f')};}else{logger[_0x4993('0x2c')](util[_0x4993('0x28')](_0x4993('0x160'),this[_0x4993('0xd')][_0x4993('0x36')],_0xf02783[_0x4993('0x15b')]));this[_0x4993('0xd')]['noop'](util[_0x4993('0x28')](_0x4993('0x15e'),this[_0x4993('0xd')][_0x4993('0x36')],_0xf02783['findBy']));return{'code':0xc8,'result':_0x4993('0x161')};}};AGIVertices[_0x4993('0x10')][_0x4993('0x16c')]=function(_0x429c48){logger['info'](util['format']('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x429c48[_0x4993('0xac')]));if(!this[_0x4993('0x81')](_0x429c48['file_id'])){return this['channel'][_0x4993('0x29')](_0x429c48,_0x4993('0x115'));}var _0x287167=this[_0x4993('0x1f')]['sync'](this,_0x429c48[_0x4993('0x114')]);if(!_0x287167){return this[_0x4993('0xd')][_0x4993('0x29')](_0x429c48,_0x4993('0x116'));}var _0x47065c=this[_0x4993('0xd')][_0x4993('0xae')](_0x4993('0x16d'),[_0x287167,_0x429c48[_0x4993('0xe6')]]);if(_0x47065c[_0x4993('0xa1')]===-0x1){return _0x47065c;}return this['channel'][_0x4993('0xa7')](util[_0x4993('0x28')](_0x4993('0xc0'),_0x4993('0x16d'),_0x287167));};AGIVertices[_0x4993('0x10')][_0x4993('0x16e')]=function(_0x1a452b){logger[_0x4993('0x2c')](util[_0x4993('0x28')](_0x4993('0x16f'),_0x1a452b[_0x4993('0xac')]));if(!this[_0x4993('0x81')](_0x1a452b[_0x4993('0x170')])){return this[_0x4993('0xd')][_0x4993('0x29')](_0x1a452b,'no\x20queue\x20selected');}var _0x3309b0='';var _0x34c59e=parseInt(_0x1a452b[_0x4993('0x170')],0xa);if(isNaN(_0x34c59e)){_0x3309b0=_0x1a452b[_0x4993('0x170')];}else{_0x3309b0=this['getVoiceQueue']['sync'](this,_0x1a452b[_0x4993('0x170')]);if(!_0x3309b0){return this[_0x4993('0xd')]['error'](_0x1a452b,'no\x20queue\x20found');}}var _0x3b75ae='';if(this['isConfigured'](_0x1a452b[_0x4993('0x114')])){var _0x34910c=this[_0x4993('0x1f')][_0x4993('0xa3')](this,_0x1a452b['file_id']);if(_0x34910c){_0x3b75ae=_0x34910c;}}this[_0x4993('0x32')][_0x4993('0xa3')](this,_0x1a452b,_0x3309b0);if(_0x1a452b[_0x4993('0xe6')]['indexOf']('x')<0x0){_0x1a452b['opts']+='x';}if(_0x1a452b[_0x4993('0xe6')][_0x4993('0x171')]('X')<0x0){_0x1a452b[_0x4993('0xe6')]+='X';}this[_0x4993('0xd')][_0x4993('0x9d')]('XMCS-QUEUE',_0x3309b0?_0x3309b0[_0x4993('0x172')]():'');var _0x237f96=this[_0x4993('0xd')][_0x4993('0xae')](_0x4993('0x173'),[_0x3309b0,_0x1a452b[_0x4993('0xe6')],_0x1a452b[_0x4993('0x5e')],_0x3b75ae,_0x1a452b[_0x4993('0x5f')],_0x1a452b[_0x4993('0x7')],_0x1a452b[_0x4993('0x174')],_0x1a452b[_0x4993('0x175')],'',_0x1a452b[_0x4993('0x176')]]);if(_0x237f96['result']===-0x1){return _0x237f96;}return this[_0x4993('0xd')][_0x4993('0xa7')](util['format']('Executed\x20command\x20%s\x20%s',_0x4993('0x173'),_0x3309b0));};AGIVertices[_0x4993('0x10')][_0x4993('0x177')]=function(_0x2cdd11){logger['info'](util[_0x4993('0x28')](_0x4993('0x178'),_0x2cdd11[_0x4993('0xac')]));var _0x431d77=_0x2cdd11['recordingFormat']||'wav';var _0x43b310=util[_0x4993('0x28')](_0x4993('0x179'),this[_0x4993('0xd')][_0x4993('0x33')],rs[_0x4993('0x11d')](0x5));var _0x5e6fab=util['format'](_0x4993('0x17a'),FILES_PATH,_0x43b310,_0x431d77);var _0x10eae9=util[_0x4993('0x28')](_0x4993('0x134'),FILES_PATH,_0x43b310);this[_0x4993('0x37')][_0x4993('0xa3')](this,_0x2cdd11,_0x43b310,_0x5e6fab);this[_0x4993('0xd')]['setVariable'](_0x4993('0x17b'),_0x43b310);logger[_0x4993('0x2c')](_0x4993('0x17c'),_0x10eae9,_0x431d77,_0x2cdd11[_0x4993('0x17d')],_0x2cdd11[_0x4993('0x5f')]);return this[_0x4993('0xd')][_0x4993('0x136')](_0x10eae9,_0x431d77,_0x2cdd11[_0x4993('0x17d')],_0x2cdd11[_0x4993('0x5f')],undefined,!![]);};AGIVertices[_0x4993('0x10')]['restapi']=function(_0x1230ed){logger[_0x4993('0x2c')](util[_0x4993('0x28')](_0x4993('0x17e'),_0x1230ed[_0x4993('0xac')]));if(!this[_0x4993('0x81')](_0x1230ed[_0x4993('0x5e')])){return this[_0x4993('0xd')]['noop']('no\x20url\x20configured');}var _0x30cea2=this[_0x4993('0x5d')]['sync'](this,_0x1230ed);logger[_0x4993('0x2c')](util['format'](_0x4993('0x17f'),util[_0x4993('0x180')](_0x30cea2,{'showHidden':![],'depth':null})));if(!this[_0x4993('0x81')](_0x1230ed[_0x4993('0xd8')])){return this['channel'][_0x4993('0xa7')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x5d2809=this[_0x4993('0x11')][_0x4993('0xa3')](this,_0x1230ed[_0x4993('0xd8')]);if(!_0x5d2809){return this[_0x4993('0xd')][_0x4993('0x29')](_0x1230ed,_0x4993('0x168'));}this[_0x4993('0xd')][_0x4993('0x9d')](util[_0x4993('0x28')](_0x4993('0x181'),_0x5d2809),_0x30cea2[_0x4993('0x71')]?_0x30cea2['statusCode']:_0x4993('0x182'));this['channel']['setVariable'](util[_0x4993('0x28')](_0x4993('0x183'),_0x5d2809),_0x30cea2['statusMessage']?_0x30cea2[_0x4993('0x72')]:'OK');if(_0x30cea2['body']){try{this[_0x4993('0x99')](_0x30cea2[_0x4993('0x6f')],_0x5d2809);}catch(_0x1baee8){logger[_0x4993('0x29')](util['format']('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x5d2809));}}return this[_0x4993('0xd')][_0x4993('0xa7')](util[_0x4993('0x28')]('variable\x20%s\x20set',_0x5d2809));};AGIVertices[_0x4993('0x10')]['saydigits']=function(_0x12e73a){logger[_0x4993('0x2c')](util[_0x4993('0x28')](_0x4993('0x184'),_0x12e73a[_0x4993('0xac')]));return this[_0x4993('0xd')][_0x4993('0x185')](_0x12e73a[_0x4993('0x186')][_0x4993('0xd4')](/\s+/g,''),_0x12e73a['escape_digits']);};AGIVertices['prototype']['saynumber']=function(_0x5634e0){logger['info'](util[_0x4993('0x28')](_0x4993('0x187'),_0x5634e0[_0x4993('0xac')]));return this[_0x4993('0xd')][_0x4993('0x188')](_0x5634e0[_0x4993('0x60')]['replace'](/\s+/g,''),_0x5634e0[_0x4993('0x17d')]);};AGIVertices[_0x4993('0x10')]['sayphonetic']=function(_0xbd7f1b){logger[_0x4993('0x2c')](util[_0x4993('0x28')](_0x4993('0x189'),_0xbd7f1b[_0x4993('0xac')]));return this[_0x4993('0xd')][_0x4993('0x18a')](_0xbd7f1b['text'],_0xbd7f1b[_0x4993('0x17d')]);};AGIVertices['prototype'][_0x4993('0x18b')]=function(_0x25f6bc){logger['info'](util[_0x4993('0x28')](_0x4993('0x18c'),_0x25f6bc[_0x4993('0xac')]));if(!this['isConfigured'](_0x25f6bc[_0x4993('0x18d')])){return this[_0x4993('0xd')][_0x4993('0xa7')](_0x4993('0x18e'));}var _0x3749c1=this[_0x4993('0x21')][_0x4993('0xa3')](this,_0x25f6bc['account_id']);if(!_0x3749c1||!_0x3749c1[_0x4993('0x18f')]){return this[_0x4993('0xd')][_0x4993('0x29')](_0x25f6bc,_0x4993('0x190'));}var _0x371dc8={'from':util[_0x4993('0x28')](_0x4993('0x191'),_0x3749c1['name'],_0x3749c1[_0x4993('0x192')]||_0x3749c1['Smtp'][_0x4993('0x193')]),'to':_0x25f6bc['to']||'','cc':_0x25f6bc['cc']||'','bcc':_0x25f6bc[_0x4993('0x194')]||'','subject':_0x25f6bc[_0x4993('0x195')],'html':_0x25f6bc[_0x4993('0x54')],'text':_0x25f6bc[_0x4993('0x54')]};var _0x13e207={'tls':{'rejectUnauthorized':![]}};if(_0x3749c1['Smtp'][_0x4993('0x196')]){_0x13e207[_0x4993('0x196')]=_0x3749c1[_0x4993('0x18f')][_0x4993('0x196')];}else{_0x13e207[_0x4993('0x197')]=_0x3749c1[_0x4993('0x18f')][_0x4993('0x197')];_0x13e207[_0x4993('0x198')]=_0x3749c1[_0x4993('0x18f')][_0x4993('0x198')];_0x13e207[_0x4993('0x199')]=_0x3749c1['Smtp'][_0x4993('0x199')];}if(_0x3749c1[_0x4993('0x18f')]['authentication']){_0x13e207[_0x4993('0x19a')]={'user':_0x3749c1[_0x4993('0x18f')][_0x4993('0x193')],'pass':_0x3749c1['Smtp'][_0x4993('0x19b')]};}if(this[_0x4993('0x81')](_0x25f6bc[_0x4993('0x19c')])){}logger[_0x4993('0xdf')](_0x4993('0x19d'),JSON[_0x4993('0x6e')](_0x371dc8));this[_0x4993('0x32')][_0x4993('0xa3')](this,_0x25f6bc,_0x25f6bc[_0x4993('0x18d')]);this['channel'][_0x4993('0xa7')](util[_0x4993('0x28')](_0x4993('0x19e'),_0x3749c1[_0x4993('0x14')]));this[_0x4993('0x23')][_0x4993('0xa3')](this,_0x13e207,_0x371dc8);return this[_0x4993('0xd')][_0x4993('0xa7')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype'][_0x4993('0x19f')]=function(_0x547269){logger[_0x4993('0x2c')](util['format'](_0x4993('0x1a0'),_0x547269[_0x4993('0xac')]));return this[_0x4993('0xd')][_0x4993('0xa7')](_0x4993('0x1a1'));};AGIVertices[_0x4993('0x10')][_0x4993('0x1a2')]=function(_0x3f552d){logger[_0x4993('0x2c')](util[_0x4993('0x28')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x3f552d['label']));if(!this[_0x4993('0x81')](_0x3f552d[_0x4993('0x1a3')])){return this['channel'][_0x4993('0xa7')](_0x4993('0x1a4'));}var _0x2864aa=this[_0x4993('0x30')]['sync'](this,_0x3f552d[_0x4993('0x1a3')]);if(!_0x2864aa){return this[_0x4993('0xd')][_0x4993('0x29')](_0x3f552d,_0x4993('0x1a5'));}var _0xaf1dc={'body':_0x3f552d[_0x4993('0x1a6')],'phone':_0x3f552d['to']||'','SmsAccountId':_0x2864aa['id']};logger[_0x4993('0xdf')]('sendSMS\x20message',JSON[_0x4993('0x6e')](_0xaf1dc));this['createSquareDetailsReport'][_0x4993('0xa3')](this,_0x3f552d,_0x3f552d[_0x4993('0x1a3')]);this[_0x4993('0xd')][_0x4993('0xa7')](util[_0x4993('0x28')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x2864aa[_0x4993('0x14')]));this[_0x4993('0x31')][_0x4993('0xa3')](this,_0xaf1dc);return this[_0x4993('0xd')]['noop'](_0x4993('0x1a7'));};AGIVertices[_0x4993('0x10')][_0x4993('0x1a8')]=function(_0x111d39){logger[_0x4993('0x2c')](util['format'](_0x4993('0x1a9'),_0x111d39[_0x4993('0xac')]));if(!this['isConfigured'](_0x111d39[_0x4993('0xd8')])){return this['channel'][_0x4993('0x29')](_0x111d39,_0x4993('0x1aa'));}var _0x2ab80d=this[_0x4993('0x11')]['sync'](this,_0x111d39[_0x4993('0xd8')]);if(!_0x2ab80d){return this[_0x4993('0xd')][_0x4993('0x29')](_0x111d39,'no\x20variable\x20found');}return this[_0x4993('0xd')][_0x4993('0x9d')](_0x2ab80d,_0x111d39[_0x4993('0x1ab')]);};AGIVertices[_0x4993('0x10')][_0x4993('0x1ac')]=function(_0x369f77){logger[_0x4993('0x2c')](util[_0x4993('0x28')](_0x4993('0x1ad'),_0x369f77[_0x4993('0xac')]));this[_0x4993('0xd')]['noop'](_0x4993('0x1ae'));if(_0x369f77['answer']===_0x4993('0x1af')){this[_0x4993('0xd')][_0x4993('0xa7')](_0x4993('0x1b0'));return this[_0x4993('0xd')]['answer']();}return this['channel'][_0x4993('0xa7')]('Skipped\x20Answer');};AGIVertices[_0x4993('0x10')][_0x4993('0x1b1')]=function(_0x248407){logger[_0x4993('0x2c')](util[_0x4993('0x28')](_0x4993('0x1b2'),_0x248407['label']));if(!this['isConfigured'](_0x248407[_0x4993('0x1b3')])){return this[_0x4993('0xd')]['error'](_0x248407,_0x4993('0x1b4'));}var _0x4c28a6=this['getSquareProject'][_0x4993('0xa3')](this,_0x248407[_0x4993('0x1b3')]);if(!this[_0x4993('0x81')](_0x4c28a6)){return this[_0x4993('0xd')]['error'](_0x248407,util['format'](_0x4993('0x1b5'),_0x248407[_0x4993('0x1b3')]));}if(_0x4c28a6===this[_0x4993('0xd')][_0x4993('0x35')]){return this[_0x4993('0xd')][_0x4993('0x29')](_0x248407,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this['createSquareDetailsReport'][_0x4993('0xa3')](this,_0x248407,_0x4c28a6);var _0x49148a=this[_0x4993('0xd')]['exec']('AGI',util[_0x4993('0x28')](_0x4993('0x1b6'),config[_0x4993('0x7')][_0x4993('0x197')]||_0x4993('0x1b7'),_0x4c28a6,this[_0x4993('0xd')][_0x4993('0x35')]));if(_0x49148a[_0x4993('0xa1')]===-0x1){return _0x49148a;}return this['channel'][_0x4993('0xa7')](util[_0x4993('0x28')](_0x4993('0xc0'),_0x4993('0x1b8'),_0x4c28a6));};AGIVertices[_0x4993('0x10')]['system']=function(_0x317fac){logger[_0x4993('0x2c')](util['format'](_0x4993('0x1b9'),_0x317fac[_0x4993('0xac')]));var _0x520c32=this[_0x4993('0x4f')][_0x4993('0xa3')](this,_0x317fac['command']);this['createSquareDetailsReport']['sync'](this,_0x317fac,_0x317fac[_0x4993('0xb4')]);if(this[_0x4993('0x81')](_0x317fac['variable_id'])){var _0xdd1ec8=this[_0x4993('0x11')][_0x4993('0xa3')](this,_0x317fac[_0x4993('0xd8')]);if(_0xdd1ec8){this[_0x4993('0xd')][_0x4993('0x9d')](_0xdd1ec8,_0x520c32);return this[_0x4993('0xd')][_0x4993('0xa7')](util[_0x4993('0x28')](_0x4993('0x1ba'),_0x317fac[_0x4993('0xb4')],_0xdd1ec8));}}return this[_0x4993('0xd')][_0x4993('0xa7')](util[_0x4993('0x28')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x317fac['command']));};AGIVertices['prototype']['google_cloud_tts']=function(_0x1a5d92){logger[_0x4993('0x2c')](util[_0x4993('0x28')](_0x4993('0x1bb'),_0x1a5d92['label']));_0x1a5d92['text']=_0x1a5d92[_0x4993('0x54')][_0x4993('0xd4')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x4993('0x81')](_0x1a5d92[_0x4993('0x52')])){return this[_0x4993('0xd')][_0x4993('0xa7')]('no\x20apiKey\x20configured');}if(!this[_0x4993('0x81')](_0x1a5d92['text'])){return this[_0x4993('0xd')][_0x4993('0xa7')](_0x4993('0xc3'));}this[_0x4993('0xd')][_0x4993('0xa7')](util[_0x4993('0x28')](_0x4993('0x1bc'),_0x1a5d92[_0x4993('0x54')]));var _0x2eeb=this[_0x4993('0x51')][_0x4993('0xa3')](this,_0x1a5d92);if(_0x2eeb){this[_0x4993('0xd')][_0x4993('0xa7')](util[_0x4993('0x28')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x2eeb));var _0x5aa0ae=this[_0x4993('0xd')][_0x4993('0x107')](_0x2eeb);try{fs[_0x4993('0x12a')](_0x2eeb+_0x4993('0x12b'));}catch(_0x292acf){logger[_0x4993('0x29')](_0x292acf);}return _0x5aa0ae;}return this[_0x4993('0xd')][_0x4993('0x29')](_0x1a5d92,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0x4993('0x10')][_0x4993('0x1bd')]=function(_0x461ef6){logger[_0x4993('0x2c')](util[_0x4993('0x28')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x461ef6[_0x4993('0xac')]));_0x461ef6[_0x4993('0x54')]=_0x461ef6[_0x4993('0x54')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x461ef6[_0x4993('0x54')])){return this[_0x4993('0xd')][_0x4993('0xa7')]('no\x20text\x20configured');}this[_0x4993('0xd')]['noop'](util[_0x4993('0x28')](_0x4993('0x1be'),_0x461ef6[_0x4993('0x54')]));var _0xba7f2f=this['googleTTS'][_0x4993('0xa3')](this,_0x461ef6);if(_0xba7f2f){this[_0x4993('0xd')][_0x4993('0xa7')](util[_0x4993('0x28')]('Google\x20TTS\x20%s\x20file\x20created',_0xba7f2f));var _0xd128aa=this[_0x4993('0xd')][_0x4993('0x107')](_0xba7f2f);try{fs[_0x4993('0x12a')](_0xba7f2f+_0x4993('0x12b'));}catch(_0x449638){logger['error'](_0x449638);}return _0xd128aa;}return this[_0x4993('0xd')][_0x4993('0x29')](_0x461ef6,_0x4993('0x1bf'));};AGIVertices['prototype'][_0x4993('0x1c0')]=function(_0xab5b0c){logger[_0x4993('0x2c')](util[_0x4993('0x28')](_0x4993('0x1c1'),_0xab5b0c['label']));if(!this[_0x4993('0x81')](_0xab5b0c['findBy'])){return this['channel']['error'](_0xab5b0c,_0x4993('0x15c'));}logger['info'](util[_0x4993('0x28')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0x4993('0x36')],_0xab5b0c[_0x4993('0x15b')]));var _0x38f8ae=this[_0x4993('0x1c2')]['sync'](this,_0xab5b0c[_0x4993('0x15b')]);if(_0x38f8ae){logger[_0x4993('0x2c')](util[_0x4993('0x28')](_0x4993('0x15e'),this['channel'][_0x4993('0x36')],_0xab5b0c[_0x4993('0x15b')]));this['channel'][_0x4993('0xa7')](util['format'](_0x4993('0x15e'),this['channel'][_0x4993('0x36')],_0xab5b0c[_0x4993('0x15b')]));return{'code':0xc8,'result':_0x4993('0x15f')};}else{logger[_0x4993('0x2c')](util[_0x4993('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x4993('0xd')][_0x4993('0x36')],_0xab5b0c[_0x4993('0x15b')]));this[_0x4993('0xd')]['noop'](util[_0x4993('0x28')](_0x4993('0x160'),this['channel'][_0x4993('0x36')],_0xab5b0c['findBy']));return{'code':0xc8,'result':_0x4993('0x161')};}};AGIVertices['prototype'][_0x4993('0x1c3')]=function(_0x582e7b){logger[_0x4993('0x2c')](util[_0x4993('0x28')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x582e7b[_0x4993('0xac')]));var _0x556797=this[_0x4993('0xd')][_0x4993('0xae')](_0x4993('0x1c4'),[_0x582e7b[_0x4993('0x1c5')],_0x582e7b[_0x4993('0x75')]]);if(_0x556797[_0x4993('0xa1')]===-0x1){return _0x556797;}return this[_0x4993('0xd')][_0x4993('0xa7')](util[_0x4993('0x28')](_0x4993('0xc0'),'VOICEMAIL',_0x582e7b[_0x4993('0x1c5')]));};AGIVertices[_0x4993('0x10')][_0x4993('0x1c6')]=function(_0x37d862){logger[_0x4993('0x2c')](util['format']('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x37d862[_0x4993('0xac')]));if(!this[_0x4993('0x81')](_0x37d862[_0x4993('0xd8')])){return this['channel'][_0x4993('0x29')](_0x37d862,'no\x20variable\x20selected');}var _0x174f45=this[_0x4993('0x11')][_0x4993('0xa3')](this,_0x37d862[_0x4993('0xd8')]);if(!_0x174f45){return this[_0x4993('0xd')]['error'](_0x37d862,_0x4993('0x168'));}var _0x209223=this[_0x4993('0xd')][_0x4993('0x11')](_0x174f45);return{'code':0xc8,'result':_0x209223[_0x4993('0x9f')]?_0x209223[_0x4993('0x9f')]:'-'};};String[_0x4993('0x10')]['replaceAll']=function(_0x3956f4,_0x21d8e5){return this[_0x4993('0x9e')](_0x3956f4)[_0x4993('0x1c7')](_0x21d8e5);};module[_0x4993('0x1c8')]=AGIVertices; \ No newline at end of file +var _0x199c=['no\x20intervals\x20found','IFTIME\x20%s\x20%s','true','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','FIND\x20AGENT\x20%s\x20BY\x20%s','failure','math','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','pause_id','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Executed\x20command\x20%s\x20%s','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','indexOf','macro','gosub','position','recordingFormat','%s_%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','%s_STATUS_MESSAGE','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','number','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','no\x20mail\x20account\x20configured','account_id','Smtp','no\x20mail\x20account\x20found','email','user','bcc','subject','service','host','port','secure','authentication','auth','pass','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','sms_account_id','no\x20sms\x20account\x20configured','Trying\x20SendSMS\x20with\x20account\x20%s','set','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','yes','Skipped\x20Answer','subproject','project_id','no\x20subproject\x20selected','getSquareProject','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','google_cloud_tts','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','join','exports','path','util','lodash','odbc','randomstring','moment','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','menu','channel','mailRpc','prototype','rpc','name','catch','getVoiceQueue','then','getSquareOdbc','getSquareOdbcById','dsn','getUserById','getTrunk','getTrunkById','getSoundById','getSoundPath','save_name','getMailAccount','getIntervals','getIntervalById','IntervalId','interval','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','extension','priority','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','random','lastName','list_id','scheduledAt','toString','callback_priority','getPauseById','agentPause','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','exec','trim','googleCloudTTS','text','languageCode','en-US','ssmlGender','MALE','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','includes','POST','PUT','toUpperCase','body','rawBody','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','computedVariables','sync','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','client_email','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_text_type','awsLex','aws_lex_region','googleASR','google_asr_language','appsecret','uri','clear','clone','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','hasOwnProperty','isPlainObject','isArray','isString','saveRestApiResult','%s.%s','length','split','extra','getAndSetVariable','setVariable','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','MRCPSynth','result','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCP_RECOG_CONFIDENCE','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','phone','custom_app','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','MRCPRecog','RECOG_CONFIDENCE()','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','query','replace','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','getVariable','forEach','%s_ROWS_COUNT','variable\x20%s\x20set','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','speech','out','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','dialogflowV2_project_id','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DIALOGFLOW_%s','DialogflowV2\x20Result\x20%s','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20password\x20configured','ndassistant_url','bot','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','sesteknda','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','unlink','.wav','SestekNDA\x20Result\x20%s','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','opts','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','getSound','no\x20file\x20audio\x20found','response','maxdigit','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','first','substr','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20%s\x20file\x20created','streamFile','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','aws_bot_name','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20is\x20unreachable','wav','%s/recordings/%s','beep','NOBEEP','intKey','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','no\x20appid\x20configured','no\x20appsecret\x20configured','recordFile','tildeASR','TildeASR\x20Result\x20%s','gotoc','continueAt','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','EVAL\x20CONDITION\x20%s\x20%s','false','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured'];(function(_0x255cab,_0x53a59e){var _0x53fd8b=function(_0x4268c4){while(--_0x4268c4){_0x255cab['push'](_0x255cab['shift']());}};_0x53fd8b(++_0x53a59e);}(_0x199c,0x7b));var _0xc199=function(_0x3fff3b,_0x5be12a){_0x3fff3b=_0x3fff3b-0x0;var _0xdfdc32=_0x199c[_0x3fff3b];return _0xdfdc32;};'use strict';var fs=require('fs');var path=require(_0xc199('0x0'));var util=require(_0xc199('0x1'));var _=require(_0xc199('0x2'));var sh=require('shelljs');var odbc=require(_0xc199('0x3'))();var rs=require(_0xc199('0x4'));var moment=require(_0xc199('0x5'));var Mustache=require('mustache');var rp=require('request-promise');var logger=require(_0xc199('0x6'))(_0xc199('0x7'));var config=require(_0xc199('0x8'));var scripts=require(_0xc199('0x9'));var FILES_PATH=_0xc199('0xa');var recursiveMapAttributes=[_0xc199('0xb'),'rawBody'];var verticesWithRetry=[_0xc199('0xc'),'getdigits','getsecretdigits'];var AGIVertices=function(_0x4d2c0d,_0x172dce,_0x3af5cc){this[_0xc199('0xd')]=_0x4d2c0d;this['rpc']=_0x172dce;this[_0xc199('0xe')]=_0x3af5cc;};AGIVertices[_0xc199('0xf')]['getVariable']=function(_0x1493b5,_0x45d641){this[_0xc199('0x10')]['getVariableById'](_0x1493b5)['then'](function(_0x57c280){_0x45d641(null,_0x57c280?_0x57c280[_0xc199('0x11')]:![]);})[_0xc199('0x12')](function(_0x3112d9){_0x45d641(_0x3112d9);});};AGIVertices[_0xc199('0xf')][_0xc199('0x13')]=function(_0x187dd8,_0x3936c){this['rpc']['getVoiceQueueById'](_0x187dd8)[_0xc199('0x14')](function(_0x414aa5){_0x3936c(null,_0x414aa5?_0x414aa5[_0xc199('0x11')]:![]);})[_0xc199('0x12')](function(_0x3459d9){_0x3936c(_0x3459d9);});};AGIVertices[_0xc199('0xf')]['getSquareProject']=function(_0x25fc10,_0x22ba85){this[_0xc199('0x10')]['getSquareProjectById'](_0x25fc10)['then'](function(_0x44892a){_0x22ba85(null,_0x44892a?_0x44892a['name']:![]);})['catch'](function(_0x445adf){_0x22ba85(_0x445adf);});};AGIVertices['prototype'][_0xc199('0x15')]=function(_0x3a8370,_0x7f3518){this[_0xc199('0x10')][_0xc199('0x16')](_0x3a8370)[_0xc199('0x14')](function(_0x2fb987){_0x7f3518(null,_0x2fb987?_0x2fb987[_0xc199('0x17')]:![]);})[_0xc199('0x12')](function(_0x4857a1){_0x7f3518(_0x4857a1);});};AGIVertices[_0xc199('0xf')]['getUser']=function(_0x20c391,_0x3ed957){this['rpc'][_0xc199('0x18')](_0x20c391)['then'](function(_0x18a20a){_0x3ed957(null,_0x18a20a?_0x18a20a[_0xc199('0x11')]:![]);})[_0xc199('0x12')](function(_0xcf659c){_0x3ed957(_0xcf659c);});};AGIVertices[_0xc199('0xf')][_0xc199('0x19')]=function(_0x1dc1a9,_0x29eb0d){this['rpc'][_0xc199('0x1a')](_0x1dc1a9)[_0xc199('0x14')](function(_0x4e4701){_0x29eb0d(null,_0x4e4701?_0x4e4701[_0xc199('0x11')]:![]);})[_0xc199('0x12')](function(_0x31d098){_0x29eb0d(_0x31d098);});};AGIVertices[_0xc199('0xf')]['getSound']=function(_0x86bbb1,_0x3a97be){var _0x189099=this;this[_0xc199('0x10')][_0xc199('0x1b')](_0x86bbb1)[_0xc199('0x14')](function(_0x7cd50c){_0x3a97be(null,_0x7cd50c?_0x189099[_0xc199('0x1c')](_0x7cd50c[_0xc199('0x1d')]):![]);})[_0xc199('0x12')](function(_0x5558b1){_0x3a97be(_0x5558b1);});};AGIVertices['prototype'][_0xc199('0x1e')]=function(_0x56d576,_0x4c85dd){this[_0xc199('0x10')]['getMailAccountById'](_0x56d576)['then'](function(_0xd09144){_0x4c85dd(null,_0xd09144?_0xd09144:![]);})[_0xc199('0x12')](function(_0x165296){_0x4c85dd(_0x165296);});};AGIVertices[_0xc199('0xf')]['sendMailMessage']=function(_0x42be5d,_0x59a193,_0xbd6526){this[_0xc199('0xe')]['sendMailMessage'](_0x42be5d,_0x59a193)['then'](function(){_0xbd6526(null);})[_0xc199('0x12')](function(_0x2ff295){_0xbd6526(_0x2ff295);});};AGIVertices[_0xc199('0xf')][_0xc199('0x1f')]=function(_0x255277,_0x327cf5){this['rpc'][_0xc199('0x20')](_0x255277)[_0xc199('0x14')](function(_0x271875){if(_0x271875){if(_0x271875[_0xc199('0x21')]){_0x327cf5(null,[_0x271875['interval']]);}else{_0x327cf5(null,_['map'](_0x271875['Intervals'],_0xc199('0x22')));}}else{_0x327cf5(null,![]);}})[_0xc199('0x12')](function(_0xd83b5c){_0x327cf5(_0xd83b5c);});};AGIVertices[_0xc199('0xf')]['getSoundPath']=function(_0xac0f9){return util[_0xc199('0x23')](_0xc199('0x24'),FILES_PATH,_0xac0f9);};AGIVertices[_0xc199('0xf')][_0xc199('0x25')]=function(_0x54ca32,_0x302efd,_0x397061){odbc[_0xc199('0x26')](_0x54ca32,function(_0x2b53d9){if(_0x2b53d9){logger[_0xc199('0x27')](_0xc199('0x28'),_0x2b53d9);_0x397061(_0x2b53d9);}else{logger[_0xc199('0x29')](_0xc199('0x2a'));odbc['query'](_0x302efd,function(_0x3807f6,_0x2779de){if(_0x3807f6){logger['info'](_0xc199('0x2b'),_0x302efd);_0x397061(_0x3807f6);}else{logger['info'](_0xc199('0x2c'),_0x302efd);odbc[_0xc199('0x2d')](function(_0x59d19d){if(_0x59d19d){logger['error'](_0xc199('0x2e'),_0x59d19d);}_0x397061(null,_0x2779de);});}});}});};AGIVertices['prototype']['getSmsAccount']=function(_0x3ccac5,_0xe4614b){this[_0xc199('0x10')]['getSmsAccountById'](_0x3ccac5)['then'](function(_0x24ad25){_0xe4614b(null,_0x24ad25?_0x24ad25:![]);})[_0xc199('0x12')](function(_0x297ea4){_0xe4614b(_0x297ea4);});};AGIVertices['prototype'][_0xc199('0x2f')]=function(_0x42fe43,_0x482137){this[_0xc199('0x10')]['createSmsMessage'](_0x42fe43)[_0xc199('0x14')](function(_0x27a3d0){_0x482137(null,_0x27a3d0);})[_0xc199('0x12')](function(_0xeffa22){_0x482137(_0xeffa22);});};AGIVertices[_0xc199('0xf')][_0xc199('0x30')]=function(_0x62ea5c,_0x25270a,_0x3a6f4d){this[_0xc199('0x10')][_0xc199('0x30')]({'uniqueid':this[_0xc199('0xd')][_0xc199('0x31')],'node':_0x62ea5c[_0xc199('0x32')],'application':_0x62ea5c[_0xc199('0x33')],'data':_0x25270a||null,'project_name':this[_0xc199('0xd')][_0xc199('0x34')],'callerid':this[_0xc199('0xd')][_0xc199('0x35')]})['then'](function(_0x3c7111){if(_0x3a6f4d){_0x3a6f4d(null,_0x3c7111);}})[_0xc199('0x12')](function(_0x5e9d81){if(_0x3a6f4d){_0x3a6f4d(_0x5e9d81);}});};AGIVertices[_0xc199('0xf')][_0xc199('0x36')]=function(_0x31ab0c,_0x3353a7,_0x1ba1bb,_0x5cdcde){this['rpc'][_0xc199('0x36')]({'uniqueid':this['channel'][_0xc199('0x31')],'callerid':this[_0xc199('0xd')][_0xc199('0x35')],'calleridname':this[_0xc199('0xd')]['calleridname'],'context':this[_0xc199('0xd')]['context'],'extension':this[_0xc199('0xd')][_0xc199('0x37')],'priority':this[_0xc199('0xd')][_0xc199('0x38')],'accountcode':this['channel']['accountcode'],'dnid':this[_0xc199('0xd')][_0xc199('0x39')],'projectName':this[_0xc199('0xd')][_0xc199('0x34')],'saveName':_0x3353a7,'filename':_0x31ab0c[_0xc199('0x3a')]||_0x3353a7,'savePath':_0x1ba1bb})['then'](function(_0x1863cd){_0x5cdcde(null,_0x1863cd);})[_0xc199('0x12')](function(_0x35d1e5){_0x5cdcde(_0x35d1e5);});};AGIVertices[_0xc199('0xf')][_0xc199('0x3b')]=function(_0x181c42,_0x5eed75,_0x325a53,_0x3ccee2,_0x30e00d){this[_0xc199('0x10')]['createSquareMessage']({'uniqueid':this['channel'][_0xc199('0x31')],'body':_0x181c42,'direction':_0x5eed75,'providerName':_0x325a53,'providerResponse':_0x3ccee2})['then'](function(_0xd09239){if(_0x30e00d){_0x30e00d(null,_0xd09239);}})[_0xc199('0x12')](function(_0x5dc5ca){if(_0x30e00d){_0x30e00d(_0x5dc5ca);}});};AGIVertices[_0xc199('0xf')][_0xc199('0x3c')]=function(_0x19221a,_0xfbc909){this[_0xc199('0x10')]['createCmContact']({'firstName':_[_0xc199('0x3d')](_0x19221a[_0xc199('0x11')])||_[_0xc199('0x3e')](_0x19221a[_0xc199('0x11')])?'callback_'+Math[_0xc199('0x3f')]():_0x19221a[_0xc199('0x11')],'lastName':_[_0xc199('0x3d')](_0x19221a[_0xc199('0x40')])||_[_0xc199('0x3e')](_0x19221a[_0xc199('0x40')])?null:_0x19221a['lastName'],'phone':_0x19221a['phone'],'ListId':_0x19221a[_0xc199('0x41')],'scheduledat':_0x19221a['scheduledAt'],'callbackUniqueid':this[_0xc199('0xd')][_0xc199('0x31')],'tags':'callback','description':'Callback\x20scheduled\x20at\x20'+_0x19221a[_0xc199('0x42')][_0xc199('0x43')](),'priority':_0x19221a[_0xc199('0x44')]})['then'](function(_0x1eac7a){_0xfbc909(null,_0x1eac7a);})[_0xc199('0x12')](function(_0x31f7bf){_0xfbc909(_0x31f7bf);});};AGIVertices[_0xc199('0xf')]['getPause']=function(_0x1f63ae,_0x5e919f){this['rpc'][_0xc199('0x45')](_0x1f63ae)[_0xc199('0x14')](function(_0x6c1ac9){_0x5e919f(null,_0x6c1ac9?_0x6c1ac9[_0xc199('0x11')]:![]);})[_0xc199('0x12')](function(_0x329805){_0x5e919f(_0x329805);});};AGIVertices[_0xc199('0xf')][_0xc199('0x46')]=function(_0x5e0f05,_0x29f609,_0x41cfcc){var _0x5bd31c={'role':'agent'};_0x5bd31c[_0x5e0f05]=this[_0xc199('0xd')][_0xc199('0x35')];this['rpc'][_0xc199('0x46')](_0x5bd31c,_0x29f609,this['channel'][_0xc199('0x31')])['then'](function(_0x58344f){_0x41cfcc(null,_[_0xc199('0x3e')](_0x58344f)?![]:!![]);})[_0xc199('0x12')](function(_0x39bf3f){logger[_0xc199('0x27')](_0x39bf3f);_0x41cfcc(null,![]);});};AGIVertices['prototype'][_0xc199('0x47')]=function(_0x421084,_0x512776){var _0xd5d450={'role':'agent'};_0xd5d450[_0x421084]=this[_0xc199('0xd')]['callerid'];this['rpc'][_0xc199('0x47')](_0xd5d450)[_0xc199('0x14')](function(_0x47ad96){_0x512776(null,_[_0xc199('0x3e')](_0x47ad96)?![]:!![]);})[_0xc199('0x12')](function(_0x4642f6){logger[_0xc199('0x27')](_0x4642f6);_0x512776(null,![]);});};AGIVertices[_0xc199('0xf')][_0xc199('0x48')]=function(_0x2c9f48,_0x38e9cf){var _0x5b3874={'role':'agent'};_0x5b3874[_0x2c9f48]=this[_0xc199('0xd')][_0xc199('0x35')];this['rpc'][_0xc199('0x48')](_0x5b3874)['then'](function(_0x32bc92){_0x38e9cf(null,_[_0xc199('0x3e')](_0x32bc92)?![]:!![]);})[_0xc199('0x12')](function(_0xeb93a6){logger[_0xc199('0x27')](_0xeb93a6);_0x38e9cf(null,![]);});};AGIVertices[_0xc199('0xf')][_0xc199('0x49')]=function(_0x18a4e0,_0xdf3646){var _0x1132b8={'role':'agent'};_0x1132b8[_0x18a4e0]=this['channel']['callerid'];var _0x3aff9e=_0x18a4e0!=_0xc199('0x4a')?util[_0xc199('0x23')](_0xc199('0x4b'),'LOCAL',this[_0xc199('0xd')]['callerid']):undefined;this['rpc'][_0xc199('0x49')](_0x1132b8,_0x3aff9e)[_0xc199('0x14')](function(_0x30854e){_0xdf3646(null,_[_0xc199('0x3e')](_0x30854e)?![]:!![]);})[_0xc199('0x12')](function(_0x1e3add){logger[_0xc199('0x27')](_0x1e3add);_0xdf3646(null,![]);});};AGIVertices[_0xc199('0xf')]['shellCommand']=function(_0x32addf,_0x4a8273){sh[_0xc199('0x4c')](_[_0xc199('0x4d')](_0x32addf),function(_0x87f0a0,_0x5669e5){var _0x122202=_0x5669e5['replace'](/(\r\n|\n|\r)/gm,'');_0x4a8273(null,_0x122202);});};AGIVertices[_0xc199('0xf')][_0xc199('0x4e')]=function(_0x391b70,_0x12b125){scripts[_0xc199('0x4e')](_0x391b70['apiKey'],_0x391b70['google_cloud_tts_text_type']||_0xc199('0x4f'),_0x391b70['text'],_0x391b70[_0xc199('0x50')]||_0xc199('0x51'),_0x391b70[_0xc199('0x52')]||_0xc199('0x53'),_0x391b70['audioEncoding']||_0xc199('0x54'))[_0xc199('0x14')](function(_0x9a7aa1){_0x12b125(null,_0x9a7aa1);})[_0xc199('0x12')](function(_0x2d4b24){_0x12b125(_0x2d4b24);});};AGIVertices[_0xc199('0xf')][_0xc199('0x55')]=function(_0x5b0f9e,_0x31e788){scripts[_0xc199('0x55')](_0x5b0f9e['text'],_0x5b0f9e[_0xc199('0x56')]||'en',0x1)[_0xc199('0x14')](function(_0x560b86){_0x31e788(null,_0x560b86);})[_0xc199('0x12')](function(_0x41908e){_0x31e788(_0x41908e);});};AGIVertices[_0xc199('0xf')][_0xc199('0x57')]=function(_0x337601,_0xfb6cfe){var _0x1edbc9={'uri':_0x337601[_0xc199('0x58')],'method':_0x337601[_0xc199('0x59')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x337601[_0xc199('0x5a')])==='number'&&parseInt(_0x337601[_0xc199('0x5a')])>=0x1?parseInt(_0x337601[_0xc199('0x5a')])*0x3e8:0x5*0x3e8};if(_[_0xc199('0x5b')]([_0xc199('0x5c'),_0xc199('0x5d')],_0x1edbc9['method'][_0xc199('0x5e')]())){try{_0x1edbc9[_0xc199('0x5f')]=_0x337601[_0xc199('0x60')]?JSON[_0xc199('0x61')](_0x337601[_0xc199('0x60')]):{};}catch(_0xcc7095){logger['error'](_0xc199('0x62'),_0xcc7095);}}try{_0x1edbc9[_0xc199('0x63')]=_0x337601['rawHeaders']?JSON[_0xc199('0x61')](_0x337601[_0xc199('0xb')]):{};}catch(_0x340042){logger[_0xc199('0x27')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x340042);}if(_0x337601[_0xc199('0x64')]){try{var _0x5ede3d=require(_0x337601[_0xc199('0x64')])[_0xc199('0x65')](this,_0x1edbc9);_0x1edbc9['uri']=Mustache['render'](_0x337601[_0xc199('0x58')],_0x5ede3d,{},['$$','$$']);if(_0x1edbc9['headers']){_0x1edbc9['headers']=JSON[_0xc199('0x61')](Mustache[_0xc199('0x66')](JSON['stringify'](_0x1edbc9[_0xc199('0x63')]),_0x5ede3d,{},['$$','$$']));}if(_0x1edbc9[_0xc199('0x5f')]){_0x1edbc9[_0xc199('0x5f')]=JSON['parse'](Mustache[_0xc199('0x66')](JSON[_0xc199('0x67')](_0x1edbc9[_0xc199('0x5f')]),_0x5ede3d,{},['$$','$$']));}}catch(_0x50afa6){logger['error'](_0xc199('0x68'),_0x50afa6);}}rp(_0x1edbc9)['then'](function(_0x773628){var _0x2ab9e7={'statusCode':_0x773628[_0xc199('0x69')]||0xc8,'statusMessage':_0x773628[_0xc199('0x6a')]||'OK','headers':_0x773628['headers']||{},'body':_0x773628[_0xc199('0x5f')]||{}};_0xfb6cfe(null,_0x2ab9e7);})[_0xc199('0x12')](function(_0x146b28){var _0x5ea599={'statusCode':_0x146b28[_0xc199('0x69')]||0x1f4,'statusMessage':_0x146b28[_0xc199('0x6b')]||_0xc199('0x6c'),'headers':_0x146b28[_0xc199('0x6d')][_0xc199('0x63')]||{},'body':_0x146b28[_0xc199('0x6d')][_0xc199('0x5f')]||{}};_0xfb6cfe(null,_0x5ea599);});};AGIVertices[_0xc199('0xf')][_0xc199('0x6e')]=function(_0x122bb3,_0x226cd8){scripts[_0xc199('0x6e')](this['channel'][_0xc199('0x31')],_0x122bb3[_0xc199('0x6f')],_0x122bb3[_0xc199('0x4f')],_0x122bb3[_0xc199('0x70')]||'en')['then'](function(_0x1920eb){_0x226cd8(null,_0x1920eb);})['catch'](function(_0x292457){_0x226cd8(_0x292457);});};AGIVertices['prototype'][_0xc199('0x71')]=function(_0x1eace5,_0x837dee){scripts[_0xc199('0x71')](this[_0xc199('0xd')][_0xc199('0x31')],_0x1eace5['dialogflowV2_project_id'],_0x1eace5[_0xc199('0x72')],_0x1eace5['private_key'],_0x1eace5[_0xc199('0x4f')],_0x1eace5['dialogflowV2_language']||'en')[_0xc199('0x14')](function(_0x171825){_0x837dee(null,_0x171825);})['catch'](function(_0x5be025){_0x837dee(_0x5be025);});};AGIVertices[_0xc199('0xf')][_0xc199('0x73')]=function(_0x1bf146,_0x11fa37){scripts[_0xc199('0x73')](this[_0xc199('0xd')],_0x1bf146)[_0xc199('0x14')](function(_0xb4afd1){_0x11fa37(null,_0xb4afd1);})[_0xc199('0x12')](function(_0x4c530c){_0x11fa37(_0x4c530c);});};AGIVertices['prototype']['ispeechTTS']=function(_0xa8b3ac,_0x16660e){scripts[_0xc199('0x74')](_0xa8b3ac['key'],_0xa8b3ac['text'],_0xa8b3ac[_0xc199('0x75')]||_0xc199('0x51'),_0xa8b3ac[_0xc199('0x76')])[_0xc199('0x14')](function(_0x52259c){_0x16660e(null,_0x52259c);})[_0xc199('0x12')](function(_0x567a95){_0x16660e(_0x567a95);});};AGIVertices[_0xc199('0xf')][_0xc199('0x77')]=function(_0x444b46,_0x5a666b,_0x15545e){scripts[_0xc199('0x77')](_0x5a666b,_0x444b46[_0xc199('0x6f')],_0x444b46[_0xc199('0x78')]||'en-US',this[_0xc199('0x79')](_0x444b46[_0xc199('0x7a')])?_0x444b46[_0xc199('0x7a')]:undefined)[_0xc199('0x14')](function(_0x3bd57a){_0x15545e(null,_0x3bd57a);})[_0xc199('0x12')](function(_0x326044){_0x15545e(_0x326044);});};AGIVertices[_0xc199('0xf')]['awsPolly']=function(_0x5a4381,_0x37b377){scripts[_0xc199('0x7b')](_0x5a4381[_0xc199('0x7c')],_0x5a4381[_0xc199('0x7d')],_0x5a4381['aws_polly_region'],_0x5a4381['aws_polly_voice']||'Amy',_0x5a4381[_0xc199('0x4f')],_0x5a4381[_0xc199('0x7e')]||'text')['then'](function(_0x2005e9){_0x37b377(null,_0x2005e9);})[_0xc199('0x12')](function(_0x16f83d){_0x37b377(_0x16f83d);});};AGIVertices[_0xc199('0xf')][_0xc199('0x7f')]=function(_0x553d6b,_0x3c00bf){scripts[_0xc199('0x7f')](this[_0xc199('0xd')][_0xc199('0x31')],_0x553d6b[_0xc199('0x7c')],_0x553d6b[_0xc199('0x7d')],_0x553d6b[_0xc199('0x80')],_0x553d6b[_0xc199('0x4f')],_0x553d6b['aws_bot_name'])['then'](function(_0x414f1e){_0x3c00bf(null,_0x414f1e);})[_0xc199('0x12')](function(_0x3873d7){_0x3c00bf(_0x3873d7);});};AGIVertices['prototype'][_0xc199('0x81')]=function(_0x45daa7,_0x3943cd,_0x1ceb14){scripts[_0xc199('0x81')](_0x3943cd,_0x45daa7[_0xc199('0x6f')],_0x45daa7[_0xc199('0x82')]||'en-US')['then'](function(_0x377a49){_0x1ceb14(null,_0x377a49);})['catch'](function(_0x19c00f){_0x1ceb14(_0x19c00f);});};AGIVertices['prototype']['tildeASR']=function(_0x45c59d,_0x286c5e,_0xcbc2c4){scripts['tildeASR'](_0x286c5e,_0x45c59d['appid'],_0x45c59d[_0xc199('0x83')],_0x45c59d[_0xc199('0x84')])[_0xc199('0x14')](function(_0x32cb23){_0xcbc2c4(null,_0x32cb23);})[_0xc199('0x12')](function(_0x51f86c){_0xcbc2c4(_0x51f86c);});};AGIVertices['prototype'][_0xc199('0x85')]=function(_0x56334c){var _0x5c0c50=_[_0xc199('0x5b')](verticesWithRetry,_0x56334c[_0xc199('0x33')])?_0x56334c:_[_0xc199('0x86')](_0x56334c);for(var _0x5c02d9 in _0x5c0c50){if(_0x5c0c50['hasOwnProperty'](_0x5c02d9)){if(_0x5c0c50[_0x5c02d9]&&_['isString'](_0x5c0c50[_0x5c02d9])){if(_[_0xc199('0x5b')](recursiveMapAttributes,_0x5c02d9)){_0x5c0c50[_0x5c02d9]=this[_0xc199('0x87')](_0x5c0c50[_0x5c02d9]);}else{_0x5c0c50[_0x5c02d9]=this[_0xc199('0x88')](_0x5c0c50[_0x5c02d9]);}}}}return _0x5c0c50;};AGIVertices[_0xc199('0xf')][_0xc199('0x89')]=function(_0x2e30ba){for(var _0x49dc15 in _0x2e30ba){if(_0x2e30ba[_0xc199('0x8a')](_0x49dc15)){if(_[_0xc199('0x8b')](_0x2e30ba[_0x49dc15])){this[_0xc199('0x89')](_0x2e30ba[_0x49dc15]);}else if(_[_0xc199('0x8c')](_0x2e30ba[_0x49dc15])){for(var _0x89f032=0x0;_0x89f032<_0x2e30ba[_0x49dc15]['length'];_0x89f032++){this[_0xc199('0x89')](_0x2e30ba[_0x49dc15][_0x89f032]);}}else if(_[_0xc199('0x8d')](_0x2e30ba[_0x49dc15])){_0x2e30ba[_0x49dc15]=this[_0xc199('0x88')](_0x2e30ba[_0x49dc15]);}}}};AGIVertices[_0xc199('0xf')][_0xc199('0x8e')]=function(_0x23d6bc,_0x2d0646){for(var _0x16ff62 in _0x23d6bc){if(_0x23d6bc['hasOwnProperty'](_0x16ff62)){if(_[_0xc199('0x8b')](_0x23d6bc[_0x16ff62])){if(!_[_0xc199('0x3d')](_0x23d6bc[_0x16ff62])){this[_0xc199('0x8e')](_0x23d6bc[_0x16ff62],util[_0xc199('0x23')](_0xc199('0x8f'),_0x2d0646,_0x16ff62));}}else if(_[_0xc199('0x8c')](_0x23d6bc[_0x16ff62])){for(var _0x35693c=0x0;_0x35693c<_0x23d6bc[_0x16ff62][_0xc199('0x90')];_0x35693c++){this[_0xc199('0x8e')](_0x23d6bc[_0x16ff62][_0x35693c],util['format']('%s.%s',_0x2d0646,_0x16ff62+'['+_0x35693c+']'));}}else{if(!_[_0xc199('0x3e')](_0x23d6bc[_0x16ff62])){this[_0xc199('0xd')]['setVariable'](util['format']('%s.%s',_0x2d0646,_0x16ff62),_0x23d6bc[_0x16ff62]);}}}}};AGIVertices[_0xc199('0xf')][_0xc199('0x87')]=function(_0x1dabed){try{var _0x7e3e5=JSON['parse'](_0x1dabed);this[_0xc199('0x89')](_0x7e3e5);return JSON['stringify'](_0x7e3e5);}catch(_0x315a28){return this['replaceAllVariables'](_0x1dabed);}};AGIVertices[_0xc199('0xf')][_0xc199('0x88')]=function(_0x53c02b){var _0x8b0286=_0x53c02b[_0xc199('0x91')]('{');for(var _0x3458e6=0x1;_0x3458e6<_0x8b0286[_0xc199('0x90')];_0x3458e6+=0x1){var _0x5a379b=_0x8b0286[_0x3458e6]['split']('}');if(_0x5a379b[_0xc199('0x90')]>0x1){_0x53c02b=_0x53c02b['replaceAll']('{'+_0x5a379b[0x0]+'}',this[_0xc199('0xd')]['getVariable'](_0x5a379b[0x0])[_0xc199('0x92')]||_0x5a379b[0x0]);}}if(_0x8b0286[_0xc199('0x90')]===0x1){return _0x53c02b['toString']();}return this['replaceAllVariables'](_0x53c02b);};AGIVertices[_0xc199('0xf')][_0xc199('0x93')]=function(_0x4557ba,_0x1f8f75){var _0x572d8a=this[_0xc199('0xd')]['getVariable'](_0x4557ba);if(_0x572d8a['result']===-0x1){return _0x572d8a;}logger[_0xc199('0x29')](util['format']('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x1f8f75,_0x572d8a[_0xc199('0x92')]));return this[_0xc199('0xd')][_0xc199('0x94')](_0x1f8f75,_0x572d8a[_0xc199('0x92')]);};AGIVertices[_0xc199('0xf')]['isConfigured']=function(_0xc35f6a){return _0xc35f6a&&_0xc35f6a!=='0'&&_0xc35f6a!=='-1'&&_0xc35f6a!=='';};AGIVertices['prototype'][_0xc199('0x95')]=function(_0x596f63){this['createSquareDetailsReport'][_0xc199('0x65')](this,_0x596f63,'-');_0x596f63['retry']=_0x596f63['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0xc199('0x96')]=function(_0x20c67b){logger['info'](util['format'](_0xc199('0x97'),_0x20c67b[_0xc199('0x32')]));if(!this[_0xc199('0x79')](_0x20c67b[_0xc199('0x4f')])){return this[_0xc199('0xd')]['noop']('no\x20text\x20configured');}var _0x11ad30='\x22'+_0x20c67b[_0xc199('0x4f')]+'\x22';if(this[_0xc199('0x79')](_0x20c67b[_0xc199('0x6d')])){_0x11ad30+=','+_0x20c67b[_0xc199('0x6d')];}var _0x2c1cdd=this[_0xc199('0xd')][_0xc199('0x4c')](_0xc199('0x98'),_0x11ad30);if(_0x2c1cdd[_0xc199('0x99')]===-0x1){return _0x2c1cdd;}return this['channel'][_0xc199('0x9a')](util[_0xc199('0x23')](_0xc199('0x9b'),_0x11ad30));};AGIVertices['prototype'][_0xc199('0x9c')]=function(_0x4c4a7f){logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0x9d'),_0x4c4a7f[_0xc199('0x32')]));if(!this['isConfigured'](_0x4c4a7f[_0xc199('0x9e')])){return this[_0xc199('0xd')]['noop'](_0xc199('0x9f'));}var _0x466f82=_0x4c4a7f[_0xc199('0x9e')];if(this[_0xc199('0x79')](_0x4c4a7f[_0xc199('0x6d')])){_0x466f82+=','+_0x4c4a7f[_0xc199('0x6d')];}var _0x37572a=this[_0xc199('0xd')]['exec']('MRCPRecog',_0x466f82);if(_0x37572a[_0xc199('0x99')]===-0x1){return _0x37572a;}var _0x11928b=this[_0xc199('0x93')]('RECOG_CONFIDENCE()',_0xc199('0xa0'));if(_0x11928b[_0xc199('0x99')]===-0x1){return _0x11928b;}var _0x3a830e=this[_0xc199('0x93')]('RECOG_INPUT()',_0xc199('0xa1'));if(_0x3a830e[_0xc199('0x99')]===-0x1){return _0x3a830e;}var _0x10c133=this[_0xc199('0x93')](_0xc199('0xa2'),_0xc199('0xa3'));if(_0x10c133[_0xc199('0x99')]===-0x1){return _0x10c133;}return this[_0xc199('0xd')][_0xc199('0x9a')](util[_0xc199('0x23')]('Executed\x20command\x20MRCPRecog\x20%s',_0x466f82));};AGIVertices[_0xc199('0xf')]['agi']=function(_0x1a125a){logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0xa4'),_0x1a125a[_0xc199('0x32')]));return this['channel'][_0xc199('0x7')]([_0x1a125a['command'],_0x1a125a['args']]);};AGIVertices[_0xc199('0xf')][_0xc199('0xa5')]=function(_0x439798){logger['info'](util[_0xc199('0x23')](_0xc199('0xa6'),_0x439798[_0xc199('0x32')]));if(this[_0xc199('0x79')](_0x439798[_0xc199('0x5a')])){logger['info'](util[_0xc199('0x23')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x439798['timeout']));var _0x1e1e6c=this[_0xc199('0xd')][_0xc199('0xa7')](_0x439798[_0xc199('0x5a')]);if(_0x1e1e6c[_0xc199('0x99')]===-0x1){return _0x1e1e6c;}}return this['channel']['answer']();};AGIVertices[_0xc199('0xf')][_0xc199('0xa8')]=function(_0xbb0871){logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0xa9'),_0xbb0871['label']));if(!this[_0xc199('0x79')](_0xbb0871[_0xc199('0x41')])){return this[_0xc199('0xd')][_0xc199('0x27')](_0xbb0871,_0xc199('0xaa'));}_0xbb0871[_0xc199('0x42')]=moment();if(this[_0xc199('0x79')](_0xbb0871['delay'])){_0xbb0871[_0xc199('0x42')]=moment()['add'](_0xbb0871[_0xc199('0xab')],'minutes');}if(!this[_0xc199('0x79')](_0xbb0871['callback_priority'])){_0xbb0871['callback_priority']=0x2;}this[_0xc199('0x3c')][_0xc199('0x65')](this,_0xbb0871);return this[_0xc199('0xd')][_0xc199('0x9a')](util[_0xc199('0x23')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0xbb0871[_0xc199('0xac')],_0xbb0871['list_id'],_0xbb0871[_0xc199('0x42')]));};AGIVertices[_0xc199('0xf')][_0xc199('0xad')]=function(_0x2ed745){logger[_0xc199('0x29')](util['format']('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x2ed745[_0xc199('0x32')]));var _0x2f8290=this[_0xc199('0xd')]['exec'](_0x2ed745[_0xc199('0xae')],_0x2ed745[_0xc199('0x6d')]);if(_0x2f8290[_0xc199('0x99')]===-0x1){return _0x2f8290;}return this['channel']['noop'](util[_0xc199('0x23')]('Executed\x20command\x20%s\x20%s',_0x2ed745['application'],_0x2ed745[_0xc199('0x6d')]));};AGIVertices[_0xc199('0xf')][_0xc199('0xaf')]=function(_0x33f636){logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0xb0'),_0x33f636[_0xc199('0x32')]));if(!this[_0xc199('0x79')](_0x33f636[_0xc199('0x4f')])){return this[_0xc199('0xd')][_0xc199('0x9a')](_0xc199('0xb1'));}var _0x57195e='\x22'+_0x33f636['text']+'\x22';if(this[_0xc199('0x79')](_0x33f636['options'])){_0x57195e+=','+_0x33f636[_0xc199('0x6d')];}var _0x28ddbc=this['channel'][_0xc199('0x4c')](_0xc199('0x98'),_0x57195e);if(_0x28ddbc[_0xc199('0x99')]===-0x1){return _0x28ddbc;}return this[_0xc199('0xd')][_0xc199('0x9a')](util[_0xc199('0x23')]('Executed\x20command\x20MRCPSynth\x20%s',_0x57195e));};AGIVertices[_0xc199('0xf')]['sestektts']=function(_0x236f3a){logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0xb2'),_0x236f3a[_0xc199('0x32')]));if(!this[_0xc199('0x79')](_0x236f3a['text'])){return this[_0xc199('0xd')][_0xc199('0x9a')](_0xc199('0xb1'));}var _0x306bf7='\x22'+_0x236f3a[_0xc199('0x4f')]+'\x22';if(this[_0xc199('0x79')](_0x236f3a['options'])){_0x306bf7+=','+_0x236f3a[_0xc199('0x6d')];}var _0x406eb4=this[_0xc199('0xd')][_0xc199('0x4c')](_0xc199('0x98'),_0x306bf7);if(_0x406eb4[_0xc199('0x99')]===-0x1){return _0x406eb4;}return this[_0xc199('0xd')]['noop'](util[_0xc199('0x23')](_0xc199('0x9b'),_0x306bf7));};AGIVertices[_0xc199('0xf')][_0xc199('0xb3')]=function(_0x4bc659){logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0xb4'),_0x4bc659[_0xc199('0x32')]));if(!this[_0xc199('0x79')](_0x4bc659[_0xc199('0x9e')])){return this['channel'][_0xc199('0x9a')](_0xc199('0x9f'));}var _0x56b0d0=_0x4bc659[_0xc199('0x9e')];if(this[_0xc199('0x79')](_0x4bc659[_0xc199('0x6d')])){_0x56b0d0+=','+_0x4bc659[_0xc199('0x6d')];}var _0x420678=this[_0xc199('0xd')][_0xc199('0x4c')]('MRCPRecog',_0x56b0d0);if(_0x420678[_0xc199('0x99')]===-0x1){return _0x420678;}var _0x2f4bde=this[_0xc199('0x93')]('RECOG_CONFIDENCE()',_0xc199('0xb5'));if(_0x2f4bde[_0xc199('0x99')]===-0x1){return _0x2f4bde;}var _0x58928b=this[_0xc199('0x93')](_0xc199('0xb6'),_0xc199('0xb7'));if(_0x58928b[_0xc199('0x99')]===-0x1){return _0x58928b;}var _0x40d29b=this[_0xc199('0x93')](_0xc199('0xa2'),_0xc199('0xb8'));if(_0x40d29b['result']===-0x1){return _0x40d29b;}return this['channel'][_0xc199('0x9a')](util[_0xc199('0x23')](_0xc199('0xb9'),_0x56b0d0));};AGIVertices['prototype'][_0xc199('0xba')]=function(_0x4cd3b9){logger['info'](util[_0xc199('0x23')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x4cd3b9[_0xc199('0x32')]));if(!this[_0xc199('0x79')](_0x4cd3b9[_0xc199('0x9e')])){return this[_0xc199('0xd')][_0xc199('0x9a')](_0xc199('0x9f'));}var _0x519a81=_0x4cd3b9[_0xc199('0x9e')];if(this[_0xc199('0x79')](_0x4cd3b9[_0xc199('0x6d')])){_0x519a81+=','+_0x4cd3b9['options'];}var _0x4d768c=this[_0xc199('0xd')][_0xc199('0x4c')](_0xc199('0xbb'),_0x519a81);if(_0x4d768c[_0xc199('0x99')]===-0x1){return _0x4d768c;}var _0x5b14ec=this['getAndSetVariable'](_0xc199('0xbc'),_0xc199('0xbd'));if(_0x5b14ec['result']===-0x1){return _0x5b14ec;}var _0x22ef52=this[_0xc199('0x93')]('RECOG_INPUT()','SESTEK_ASR_TRANSCRIPT');if(_0x22ef52[_0xc199('0x99')]===-0x1){return _0x22ef52;}var _0x2ab992=this[_0xc199('0x93')](_0xc199('0xa2'),_0xc199('0xbe'));if(_0x2ab992['result']===-0x1){return _0x2ab992;}return this[_0xc199('0xd')][_0xc199('0x9a')](util[_0xc199('0x23')](_0xc199('0xb9'),_0x519a81));};AGIVertices[_0xc199('0xf')][_0xc199('0xbf')]=function(_0x266dc7){logger['info'](util[_0xc199('0x23')](_0xc199('0xc0'),_0x266dc7[_0xc199('0x32')]));if(!this['isConfigured'](_0x266dc7[_0xc199('0xc1')])){return this[_0xc199('0xd')][_0xc199('0x27')](_0x266dc7,_0xc199('0xc2'));}var _0x504a12=this[_0xc199('0x15')]['sync'](this,_0x266dc7[_0xc199('0xc1')]);if(!_0x504a12){return this[_0xc199('0xd')][_0xc199('0x27')](_0x266dc7,_0xc199('0xc3'));}if(!this[_0xc199('0x79')](_0x266dc7[_0xc199('0xc4')])){return this[_0xc199('0xd')]['error'](_0x266dc7,'no\x20query\x20configured');}var _0x2f4e5b=_0x266dc7[_0xc199('0xc4')][_0xc199('0xc5')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0xc199('0x9a')](util[_0xc199('0x23')](_0xc199('0xc6'),_0x2f4e5b));var _0x1103a1=this[_0xc199('0x25')][_0xc199('0x65')](this,_0x504a12,_0x2f4e5b);this[_0xc199('0x30')]['sync'](this,_0x266dc7,_0x2f4e5b);if(!this[_0xc199('0x79')](_0x266dc7[_0xc199('0xc7')])){return this[_0xc199('0xd')][_0xc199('0x9a')](_0xc199('0xc8'));}var _0x29f26b=this[_0xc199('0xc9')]['sync'](this,_0x266dc7['variable_id']);if(!_0x29f26b){return this['channel'][_0xc199('0x27')](_0x266dc7,'no\x20variable\x20found');}var _0x2daf54=this;_0x1103a1[_0xc199('0xca')](function(_0x44461e,_0x1d3b05){Object['keys'](_0x44461e)['forEach'](function(_0x2df578){_0x2daf54[_0xc199('0xd')][_0xc199('0x94')](util['format']('%s[%s][%s]',_0x29f26b,_0x1d3b05,_0x2df578),_0x44461e[_0x2df578]);});});this[_0xc199('0xd')]['setVariable'](util[_0xc199('0x23')](_0xc199('0xcb'),_0x29f26b),_0x1103a1[_0xc199('0x90')]);return this[_0xc199('0xd')][_0xc199('0x9a')](util[_0xc199('0x23')](_0xc199('0xcc'),_0x29f26b));};AGIVertices[_0xc199('0xf')]['dial']=function(_0xc171ff){logger[_0xc199('0xcd')](util[_0xc199('0x23')](_0xc199('0xce'),_0xc171ff[_0xc199('0x32')]));if(!this[_0xc199('0x79')](_0xc171ff[_0xc199('0xcf')])){return this[_0xc199('0xd')][_0xc199('0x27')](_0xc171ff,_0xc199('0xd0'));}var _0x24af19=this['getUser'][_0xc199('0x65')](this,_0xc171ff[_0xc199('0xcf')]);if(!_0x24af19){return this[_0xc199('0xd')][_0xc199('0x27')](_0xc171ff,_0xc199('0xd1'));}var _0x48e023=this[_0xc199('0xd')][_0xc199('0x4c')](_0xc199('0xd2'),[util[_0xc199('0x23')](_0xc199('0xd3'),_0x24af19),_0xc171ff[_0xc199('0x5a')],_0xc171ff['opts'],_0xc171ff[_0xc199('0x58')]]);if(_0x48e023['result']===-0x1){return _0x48e023;}return this[_0xc199('0xd')][_0xc199('0x9a')](util[_0xc199('0x23')](_0xc199('0xd4'),_0xc199('0xd2')));};AGIVertices[_0xc199('0xf')][_0xc199('0xd5')]=function(_0x588eab){logger[_0xc199('0x29')](util['format'](_0xc199('0xd6'),_0x588eab['label']));if(!this['isConfigured'](_0x588eab['key'])){return this[_0xc199('0xd')]['noop'](_0xc199('0xd7'));}if(!this[_0xc199('0x79')](_0x588eab[_0xc199('0x4f')])){return this[_0xc199('0xd')]['noop']('no\x20text\x20configured');}this[_0xc199('0xd')]['bot']=!![];this['createSquareDetailsReport'](_0x588eab);this[_0xc199('0x3b')](_0x588eab[_0xc199('0x4f')],'in','','');this['channel']['noop'](util[_0xc199('0x23')]('Trying\x20Dialogflow:\x20%s',_0x588eab[_0xc199('0x4f')]));var _0x466ffa=this[_0xc199('0x6e')][_0xc199('0x65')](this,_0x588eab);if(_0x466ffa){for(var _0x4051c3 in _0x466ffa){if(_0x466ffa[_0xc199('0x8a')](_0x4051c3)){this[_0xc199('0xd')][_0xc199('0x94')](util[_0xc199('0x23')]('DIALOGFLOW_%s',_0x4051c3[_0xc199('0x5e')]()),_0x466ffa[_0x4051c3]);}}this[_0xc199('0x3b')](_0x466ffa[_0xc199('0xd8')],_0xc199('0xd9'),'dialogflow','');return this[_0xc199('0xd')][_0xc199('0x9a')](util[_0xc199('0x23')]('Dialogflow\x20Result\x20%s',_0x466ffa[_0xc199('0xd8')]));}return this['channel'][_0xc199('0x27')](_0x588eab,_0xc199('0xda'));};AGIVertices[_0xc199('0xf')][_0xc199('0xdb')]=function(_0x389dc3){logger[_0xc199('0x29')](util['format'](_0xc199('0xdc'),_0x389dc3[_0xc199('0x32')]));if(!this[_0xc199('0x79')](_0x389dc3[_0xc199('0xdd')])){return this[_0xc199('0xd')][_0xc199('0x9a')]('no\x20project_id\x20configured');}if(!this[_0xc199('0x79')](_0x389dc3['client_email'])){return this[_0xc199('0xd')]['noop'](_0xc199('0xde'));}if(!this['isConfigured'](_0x389dc3['private_key'])){return this[_0xc199('0xd')]['noop'](_0xc199('0xdf'));}if(!this[_0xc199('0x79')](_0x389dc3['dialogflowV2_language'])){return this[_0xc199('0xd')][_0xc199('0x9a')](_0xc199('0xe0'));}if(!this[_0xc199('0x79')](_0x389dc3[_0xc199('0x4f')])){return this[_0xc199('0xd')]['noop'](_0xc199('0xb1'));}this[_0xc199('0xd')]['bot']=!![];this[_0xc199('0x30')](_0x389dc3);this[_0xc199('0x3b')](_0x389dc3['text'],'in','','');this[_0xc199('0xd')][_0xc199('0x9a')](util[_0xc199('0x23')](_0xc199('0xe1'),_0x389dc3[_0xc199('0x4f')]));var _0x7d8b75=this[_0xc199('0x71')][_0xc199('0x65')](this,_0x389dc3);if(_0x7d8b75){for(var _0x279f54 in _0x7d8b75){if(_0x7d8b75[_0xc199('0x8a')](_0x279f54)){if(_0x279f54!==_0xc199('0xe2')){this[_0xc199('0xd')][_0xc199('0x94')](util[_0xc199('0x23')](_0xc199('0xe3'),_0x279f54[_0xc199('0x5e')]()),_0x7d8b75[_0x279f54]);}}}this['createSquareMessage'](_0x7d8b75[_0xc199('0xd8')],_0xc199('0xd9'),'dialogflowV2',_0x7d8b75[_0xc199('0xe2')]);return this[_0xc199('0xd')][_0xc199('0x9a')](util[_0xc199('0x23')](_0xc199('0xe4'),_0x7d8b75[_0xc199('0xd8')]));}return this[_0xc199('0xd')][_0xc199('0x27')](_0x389dc3,'DialogflowV2\x20is\x20unreachable');};AGIVertices['prototype']['sesteknda']=function(_0x1eb0b5){logger[_0xc199('0x29')](util['format'](_0xc199('0xe5'),_0x1eb0b5[_0xc199('0x32')]));if(!this[_0xc199('0x79')](_0x1eb0b5[_0xc199('0xe6')])){return this[_0xc199('0xd')][_0xc199('0x9a')](_0xc199('0xe7'));}if(!this[_0xc199('0x79')](_0x1eb0b5[_0xc199('0xe8')])){return this['channel'][_0xc199('0x9a')]('no\x20username\x20configured');}if(!this[_0xc199('0x79')](_0x1eb0b5['password'])){return this['channel']['noop'](_0xc199('0xe9'));}if(!this['isConfigured'](_0x1eb0b5[_0xc199('0xea')])){return this[_0xc199('0xd')][_0xc199('0x9a')](_0xc199('0xb1'));}this[_0xc199('0xd')][_0xc199('0xeb')]=!![];this[_0xc199('0x30')](_0x1eb0b5);this[_0xc199('0x3b')](_0x1eb0b5['text'],'in','','');this[_0xc199('0xd')][_0xc199('0x9a')](util['format'](_0xc199('0xec'),_0x1eb0b5['text']));var _0x38f0d1=this['sestekNDA'][_0xc199('0x65')](this,_0x1eb0b5);if(_0x38f0d1){for(var _0x424f6b in _0x38f0d1){if(_0x38f0d1[_0xc199('0x8a')](_0x424f6b)){this[_0xc199('0xd')][_0xc199('0x94')](util['format'](_0xc199('0xed'),_0x424f6b[_0xc199('0x5e')]()),_0x38f0d1[_0x424f6b]);}}this['createSquareMessage'](_0x38f0d1[_0xc199('0xd8')],'out',_0xc199('0xee'),'');if(_0x38f0d1[_0xc199('0xef')]){this['channel'][_0xc199('0x9a')](util[_0xc199('0x23')](_0xc199('0xf0'),_0x38f0d1[_0xc199('0xef')]));var _0xdc59c4=this[_0xc199('0xd')]['streamFile'](_0x38f0d1[_0xc199('0xef')]);try{fs[_0xc199('0xf1')](_0x38f0d1['audiofile']+_0xc199('0xf2'));}catch(_0x30d052){logger['error'](_0x30d052);}return _0xdc59c4;}else{return this[_0xc199('0xd')][_0xc199('0x9a')](util[_0xc199('0x23')](_0xc199('0xf3'),_0x38f0d1[_0xc199('0xd8')]));}}return this[_0xc199('0xd')][_0xc199('0x27')](_0x1eb0b5,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0xc199('0xf')]['end']=function(_0x3d7a40){logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0xf4'),_0x3d7a40[_0xc199('0x32')]));return this[_0xc199('0xd')][_0xc199('0x9a')]('end');};AGIVertices[_0xc199('0xf')][_0xc199('0xf5')]=function(_0x5d564d){logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0xf6'),_0x5d564d[_0xc199('0x32')]));var _0x51b4ec='';if(_0x5d564d[_0xc199('0xf7')]){if(!this[_0xc199('0x79')](_0x5d564d['trunk_id'])){return this[_0xc199('0xd')]['error'](_0x5d564d,_0xc199('0xf8'));}else{var _0xdbb1f=parseInt(_0x5d564d[_0xc199('0xf7')],0xa);if(isNaN(_0xdbb1f)){_0x51b4ec=_0x5d564d[_0xc199('0xf7')];}else{_0x51b4ec=this[_0xc199('0x19')][_0xc199('0x65')](this,_0x5d564d[_0xc199('0xf7')]);if(!_0x51b4ec){return this[_0xc199('0xd')][_0xc199('0x27')](_0x5d564d,_0xc199('0xf9'));}}}}else if(_0x5d564d[_0xc199('0xfa')]){_0x51b4ec=_0x5d564d[_0xc199('0xfa')];}else{return this[_0xc199('0xd')]['error'](_0x5d564d,'no\x20trunk\x20selected');}var _0x578725=this[_0xc199('0xd')][_0xc199('0x4c')](_0xc199('0xd2'),[util[_0xc199('0x23')](_0xc199('0xfb'),_0x51b4ec,_0x5d564d['phone']),_0x5d564d['timeout'],_0x5d564d[_0xc199('0xfc')],_0x5d564d[_0xc199('0x58')]]);if(_0x578725[_0xc199('0x99')]===-0x1){return _0x578725;}return this['channel'][_0xc199('0x9a')](util[_0xc199('0x23')](_0xc199('0xd4'),_0xc199('0xd2')));};AGIVertices[_0xc199('0xf')]['finally']=function(_0x4a3e20){logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0xfd'),_0x4a3e20[_0xc199('0x32')]));return this[_0xc199('0xd')]['noop'](_0xc199('0xfe'));};AGIVertices[_0xc199('0xf')][_0xc199('0xff')]=function(_0x46b5a7){logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0x100'),_0x46b5a7['label']));if(_0x46b5a7[_0xc199('0x101')]===0x0){return this[_0xc199('0x95')](_0x46b5a7);}_0x46b5a7[_0xc199('0x101')]-=0x1;if(!this[_0xc199('0x79')](_0x46b5a7[_0xc199('0x102')])){return this[_0xc199('0xd')][_0xc199('0x27')](_0x46b5a7,'no\x20file\x20audio\x20selected');}var _0x3da274=this[_0xc199('0x103')][_0xc199('0x65')](this,_0x46b5a7[_0xc199('0x102')]);if(!_0x3da274){return this[_0xc199('0xd')][_0xc199('0x27')](_0x46b5a7,_0xc199('0x104'));}if(!this[_0xc199('0x79')](_0x46b5a7[_0xc199('0xc7')])){return this[_0xc199('0xd')][_0xc199('0x27')](_0xc199('0xc8'));}var _0x3aee3f=this['channel']['getData'](_0x3da274,_0x46b5a7[_0xc199('0x105')],_0x46b5a7[_0xc199('0x106')]);var _0x1d86db=_0x3aee3f['result']?_0x3aee3f[_0xc199('0x99')][_0xc199('0x43')]():'';logger[_0xc199('0x29')]('test',JSON[_0xc199('0x67')](_0x3aee3f));if(_0x3aee3f[_0xc199('0x99')]===-0x1){this[_0xc199('0x30')][_0xc199('0x65')](this,_0x46b5a7,_0x1d86db);return _0x3aee3f;}else if(_0x3aee3f['extra']===_0xc199('0x5a')){_0x3aee3f[_0xc199('0x99')]=_0x1d86db[_0xc199('0x90')]>=parseInt(_0x46b5a7[_0xc199('0x107')])?'x':'i';}else{_0x3aee3f[_0xc199('0x99')]=_0x1d86db['length']>=parseInt(_0x46b5a7['mindigit'])&&_0x1d86db[_0xc199('0x90')]<=parseInt(_0x46b5a7['maxdigit'])?'x':'i';}var _0x36efc9=this[_0xc199('0xc9')][_0xc199('0x65')](this,_0x46b5a7[_0xc199('0xc7')]);if(!_0x36efc9){return this[_0xc199('0xd')][_0xc199('0x27')](_0x46b5a7,_0xc199('0x108'));}this[_0xc199('0xd')][_0xc199('0x94')](_0x36efc9,_0x1d86db);if(this[_0xc199('0x79')](_0x46b5a7['hiddendigitsnum'])){var _0x957a24=parseInt(_0x46b5a7[_0xc199('0x109')],0xa);var _0x2f9fdb=rs[_0xc199('0x10a')]({'charset':'*','length':_0x957a24});var _0x2b4b44=_0x1d86db[_0xc199('0x90')];if(_0x2b4b44>0x0){if(_0x2b4b44>_0x957a24){this['createSquareDetailsReport']['sync'](this,_0x46b5a7,_0x46b5a7[_0xc199('0x10b')]===_0xc199('0x10c')?_0x2f9fdb+_0x1d86db[_0xc199('0x10d')](_0x957a24):_0x1d86db[_0xc199('0x10d')](0x0,_0x2b4b44-_0x957a24)+_0x2f9fdb);}else{this[_0xc199('0x30')][_0xc199('0x65')](this,_0x46b5a7,rs[_0xc199('0x10a')]({'charset':'*','length':_0x2b4b44}));}}else{this[_0xc199('0x30')][_0xc199('0x65')](this,_0x46b5a7,'');}}else{this[_0xc199('0x30')]['sync'](this,_0x46b5a7,_0x1d86db);}return _0x3aee3f;};AGIVertices[_0xc199('0xf')][_0xc199('0x10e')]=function(_0x42df10){logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0x10f'),_0x42df10['label']));return this[_0xc199('0xff')](_0x42df10);};AGIVertices[_0xc199('0xf')][_0xc199('0x110')]=function(_0xba101b){logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0x111'),_0xba101b['label']));this[_0xc199('0x30')]['sync'](this,_0xba101b,_0xba101b['goalname']);return this['channel']['noop'](util['format'](_0xc199('0x112'),_0xba101b[_0xc199('0x113')]));};AGIVertices['prototype'][_0xc199('0x114')]=function(_0x1b89c3){logger['info'](util[_0xc199('0x23')](_0xc199('0x115'),_0x1b89c3['label']));if(!this[_0xc199('0x79')](_0x1b89c3[_0xc199('0x7c')])||!this[_0xc199('0x79')](_0x1b89c3[_0xc199('0x7d')])){return this['channel'][_0xc199('0x9a')](_0xc199('0x116'));}if(!this[_0xc199('0x79')](_0x1b89c3['text'])){return this['channel'][_0xc199('0x9a')](_0xc199('0xb1'));}this[_0xc199('0xd')]['noop'](util['format']('Trying\x20aws\x20Polly\x20%s',_0x1b89c3['text']));var _0x374dc2=this[_0xc199('0x7b')][_0xc199('0x65')](this,_0x1b89c3);if(_0x374dc2){this[_0xc199('0xd')][_0xc199('0x9a')](util[_0xc199('0x23')](_0xc199('0x117'),_0x374dc2));var _0x21a257=this['channel'][_0xc199('0x118')](_0x374dc2);try{fs[_0xc199('0xf1')](_0x374dc2+'.wav');}catch(_0x5f3caf){logger['error'](_0x5f3caf);}return _0x21a257;}return this[_0xc199('0xd')][_0xc199('0x27')](_0x1b89c3,_0xc199('0x119'));};AGIVertices[_0xc199('0xf')][_0xc199('0x11a')]=function(_0x14bf88){logger['info'](util[_0xc199('0x23')](_0xc199('0x11b'),_0x14bf88[_0xc199('0x32')]));if(!this[_0xc199('0x79')](_0x14bf88[_0xc199('0x7c')])||!this[_0xc199('0x79')](_0x14bf88[_0xc199('0x7d')])){return this['channel'][_0xc199('0x9a')](_0xc199('0x116'));}if(!this[_0xc199('0x79')](_0x14bf88[_0xc199('0x11c')])){return this['channel']['noop'](_0xc199('0x11d'));}if(!this[_0xc199('0x79')](_0x14bf88[_0xc199('0x4f')])){return this[_0xc199('0xd')]['noop'](_0xc199('0xb1'));}this[_0xc199('0xd')]['bot']=!![];this['createSquareDetailsReport'](_0x14bf88);this['createSquareMessage'](_0x14bf88[_0xc199('0x4f')],'in','','');this[_0xc199('0xd')][_0xc199('0x9a')](util[_0xc199('0x23')](_0xc199('0x11e'),_0x14bf88[_0xc199('0x4f')]));var _0x4461ce=this[_0xc199('0x7f')]['sync'](this,_0x14bf88);if(_0x4461ce){for(var _0x2e6a26 in _0x4461ce){if(_0x4461ce['hasOwnProperty'](_0x2e6a26)&&_[_0xc199('0x8d')](_0x4461ce[_0x2e6a26])){this[_0xc199('0xd')][_0xc199('0x94')](util[_0xc199('0x23')](_0xc199('0x11f'),_0x2e6a26[_0xc199('0x5e')]()),_0x4461ce[_0x2e6a26]);}}if(_[_0xc199('0x3e')](_0x4461ce[_0xc199('0x6b')])){return this['channel'][_0xc199('0x9a')](_0xc199('0x120'));}else{this['createSquareMessage'](_0x4461ce['message'],_0xc199('0xd9'),'amazonlex','');return this['channel'][_0xc199('0x9a')](util[_0xc199('0x23')]('Amazon\x20Lex\x20Result\x20%s',_0x4461ce['message']));}}return this[_0xc199('0xd')][_0xc199('0x27')](_0x14bf88,_0xc199('0x121'));};AGIVertices[_0xc199('0xf')]['googleasr']=function(_0x18f7e8){logger[_0xc199('0x29')](util[_0xc199('0x23')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x18f7e8[_0xc199('0x32')],_0x18f7e8[_0xc199('0x5a')]));if(!this[_0xc199('0x79')](_0x18f7e8[_0xc199('0x6f')])){return this[_0xc199('0xd')][_0xc199('0x9a')](_0xc199('0xd7'));}var _0xe1388f=_0xc199('0x122');var _0xbb94bd=util['format'](_0xc199('0x123'),FILES_PATH,rs[_0xc199('0x10a')](0x4));var _0x46eefa=util[_0xc199('0x23')](_0xc199('0x8f'),_0xbb94bd,_0xe1388f);var _0x4a26de=!![];if(_0x18f7e8[_0xc199('0x124')]===_0xc199('0x125')){_0x4a26de=![];}var _0x20c167=this[_0xc199('0xd')]['recordFile'](_0xbb94bd,_0xe1388f,_0x18f7e8[_0xc199('0x126')],_0x18f7e8['timeout'],undefined,_0x4a26de);if(_0x20c167[_0xc199('0x99')]!==-0x1){this['channel']['noop'](util[_0xc199('0x23')](_0xc199('0x127'),_0x46eefa));var _0x14a9e3=this[_0xc199('0x81')][_0xc199('0x65')](this,_0x18f7e8,_0x46eefa);if(_0x14a9e3){for(var _0x372efd in _0x14a9e3){if(_0x14a9e3['hasOwnProperty'](_0x372efd)){this[_0xc199('0xd')]['setVariable'](util['format']('GOOGLE_ASR_%s',_0x372efd[_0xc199('0x5e')]()),_0x14a9e3[_0x372efd]);}}return this[_0xc199('0xd')][_0xc199('0x9a')](util[_0xc199('0x23')](_0xc199('0x128'),JSON[_0xc199('0x67')](_0x14a9e3)));}}return _0x20c167;};AGIVertices[_0xc199('0xf')][_0xc199('0x129')]=function(_0x2f4292){logger['info'](util['format'](_0xc199('0x12a'),_0x2f4292['label']));if(!this[_0xc199('0x79')](_0x2f4292[_0xc199('0x12b')])){return this[_0xc199('0xd')]['noop'](_0xc199('0x12c'));}if(!this['isConfigured'](_0x2f4292['appsecret'])){return this['channel'][_0xc199('0x9a')](_0xc199('0x12d'));}var _0x1c82bb=_0xc199('0x122');var _0x33e64d=util[_0xc199('0x23')](_0xc199('0x123'),FILES_PATH,rs[_0xc199('0x10a')](0x4));var _0x21e96e=util[_0xc199('0x23')]('%s.%s',_0x33e64d,_0x1c82bb);var _0x4684a4=!![];if(_0x2f4292[_0xc199('0x124')]===_0xc199('0x125')){_0x4684a4=![];}var _0x39870d=this[_0xc199('0xd')][_0xc199('0x12e')](_0x33e64d,_0x1c82bb,_0x2f4292[_0xc199('0x126')],_0x2f4292[_0xc199('0x5a')],undefined,_0x4684a4);if(_0x39870d[_0xc199('0x99')]!==-0x1){this[_0xc199('0xd')]['noop'](util[_0xc199('0x23')]('tilde\x20%s\x20file\x20created',_0x21e96e));var _0x1032f7=this[_0xc199('0x12f')][_0xc199('0x65')](this,_0x2f4292,_0x21e96e);if(_0x1032f7){for(var _0x1af0af in _0x1032f7){if(_0x1032f7[_0xc199('0x8a')](_0x1af0af)){this[_0xc199('0xd')][_0xc199('0x94')](util[_0xc199('0x23')]('TILDE_ASR_%s',_0x1af0af['toUpperCase']()),_0x1032f7[_0x1af0af]);}}return this[_0xc199('0xd')][_0xc199('0x9a')](util['format'](_0xc199('0x130'),JSON['stringify'](_0x1032f7)));}}return _0x39870d;};AGIVertices[_0xc199('0xf')][_0xc199('0x131')]=function(_0x5e1743){logger[_0xc199('0x29')](util[_0xc199('0x23')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x5e1743[_0xc199('0x32')]));return this['channel'][_0xc199('0x132')](_0x5e1743['context'],_0x5e1743['extension'],_0x5e1743['priority']);};AGIVertices[_0xc199('0xf')]['gotoif']=function(_0x28a13a){logger['info'](util[_0xc199('0x23')](_0xc199('0x133'),_0x28a13a[_0xc199('0x32')]));if(!this['isConfigured'](_0x28a13a[_0xc199('0x134')])){return this['channel'][_0xc199('0x27')](_0x28a13a,_0xc199('0x135'));}try{var _0x4acd4c=eval(_0x28a13a[_0xc199('0x134')])?'true':'false';this['channel'][_0xc199('0x9a')](util[_0xc199('0x23')](_0xc199('0x136'),_0x28a13a['condition'],_0x4acd4c));return{'code':0xc8,'result':_0x4acd4c};}catch(_0x359fbf){return{'code':0xc8,'result':_0xc199('0x137')};}};AGIVertices[_0xc199('0xf')]['gotoiftime']=function(_0x745ba2){logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0x138'),_0x745ba2[_0xc199('0x32')]));if(!this[_0xc199('0x79')](_0x745ba2[_0xc199('0x139')])){return this[_0xc199('0xd')][_0xc199('0x27')](_0x745ba2,_0xc199('0x13a'));}var _0x37244d=this['getIntervals'][_0xc199('0x65')](this,_0x745ba2['interval_id']);if(!_0x37244d){return this['channel'][_0xc199('0x27')](_0x745ba2,_0xc199('0x13b'));}for(var _0xf0517a=0x0;_0xf0517a<_0x37244d['length'];_0xf0517a+=0x1){var _0x489967=this[_0xc199('0xd')][_0xc199('0xc9')](util[_0xc199('0x23')]('IFTIME(%s?true:false)',_0x37244d[_0xf0517a]));if(_0x489967[_0xc199('0x99')]===-0x1){return _0x489967;}logger[_0xc199('0x29')](util['format'](_0xc199('0x13c'),_0x37244d[_0xf0517a],_0x489967[_0xc199('0x92')]));if(_0x489967[_0xc199('0x92')]===_0xc199('0x13d')){logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0x13c'),_0x37244d[_0xf0517a],_0xc199('0x13d')));this[_0xc199('0xd')][_0xc199('0x9a')](util[_0xc199('0x23')](_0xc199('0x13c'),_0x37244d[_0xf0517a],_0xc199('0x13d')));return{'code':0xc8,'result':_0xc199('0x13d')};}else{logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0x13c'),_0x37244d[_0xf0517a],_0xc199('0x137')));this[_0xc199('0xd')][_0xc199('0x9a')](util[_0xc199('0x23')](_0xc199('0x13c'),_0x37244d[_0xf0517a],_0xc199('0x137')));}}return{'code':0xc8,'result':_0xc199('0x137')};};AGIVertices[_0xc199('0xf')][_0xc199('0x13e')]=function(_0x56c80c){logger[_0xc199('0x29')](util[_0xc199('0x23')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x56c80c[_0xc199('0x32')]));return this[_0xc199('0xd')]['hangup']();};AGIVertices[_0xc199('0xf')][_0xc199('0x13f')]=function(_0x48dc09){logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0x140'),_0x48dc09['label']));if(!this[_0xc199('0x79')](_0x48dc09['key'])){return this[_0xc199('0xd')]['noop'](_0xc199('0xd7'));}var _0x1526f9=_0xc199('0x122');var _0x5d37d4=util[_0xc199('0x23')]('%s/recordings/%s',FILES_PATH,rs[_0xc199('0x10a')](0x4));var _0x3c5122=util[_0xc199('0x23')](_0xc199('0x8f'),_0x5d37d4,_0x1526f9);var _0x418b14=!![];if(_0x48dc09[_0xc199('0x124')]===_0xc199('0x125')){_0x418b14=![];}var _0x444446=this[_0xc199('0xd')][_0xc199('0x12e')](_0x5d37d4,_0x1526f9,_0x48dc09[_0xc199('0x126')],_0x48dc09[_0xc199('0x5a')],undefined,_0x418b14);if(_0x444446[_0xc199('0x99')]!==-0x1){this[_0xc199('0xd')][_0xc199('0x9a')](util[_0xc199('0x23')](_0xc199('0x141'),_0x3c5122));var _0xb7e914=this['ispeechASR']['sync'](this,_0x48dc09,_0x3c5122);if(_0xb7e914){for(var _0x326c33 in _0xb7e914){if(_0xb7e914['hasOwnProperty'](_0x326c33)){this[_0xc199('0xd')][_0xc199('0x94')](util[_0xc199('0x23')]('ISPEECH_ASR_%s',_0x326c33['toUpperCase']()),_0xb7e914[_0x326c33]);}}return this['channel']['noop'](util[_0xc199('0x23')](_0xc199('0x142'),JSON['stringify'](_0xb7e914)));}}return _0x444446;};AGIVertices['prototype'][_0xc199('0x143')]=function(_0x1ee919){logger[_0xc199('0x29')](util[_0xc199('0x23')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x1ee919[_0xc199('0x32')]));if(!this['isConfigured'](_0x1ee919[_0xc199('0x6f')])){return this[_0xc199('0xd')]['noop']('no\x20key\x20configured');}if(!this['isConfigured'](_0x1ee919[_0xc199('0x4f')])){return this[_0xc199('0xd')][_0xc199('0x9a')](_0xc199('0xb1'));}this[_0xc199('0xd')][_0xc199('0x9a')](util[_0xc199('0x23')](_0xc199('0x144'),_0x1ee919[_0xc199('0x4f')]));var _0x2b4e0a=this['ispeechTTS'][_0xc199('0x65')](this,_0x1ee919);if(_0x2b4e0a){this['channel'][_0xc199('0x9a')](util['format'](_0xc199('0x141'),_0x2b4e0a));var _0x407b02=this['channel'][_0xc199('0x118')](_0x2b4e0a,_0x1ee919[_0xc199('0x126')]);try{fs['unlink'](_0x2b4e0a+_0xc199('0xf2'));}catch(_0x37a3a6){logger['error'](_0x37a3a6);}return _0x407b02;}return this[_0xc199('0xd')][_0xc199('0x27')](_0x1ee919,_0xc199('0x145'));};AGIVertices[_0xc199('0xf')][_0xc199('0x146')]=function(_0x5f27e2){logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0x147'),_0x5f27e2[_0xc199('0x32')]));if(!this[_0xc199('0x79')](_0x5f27e2['findBy'])){return this[_0xc199('0xd')][_0xc199('0x27')](_0x5f27e2,_0xc199('0x148'));}logger[_0xc199('0x29')](util[_0xc199('0x23')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xc199('0xd')][_0xc199('0x35')],_0x5f27e2[_0xc199('0x149')]));var _0x26a785=this[_0xc199('0x49')]['sync'](this,_0x5f27e2['findBy']);if(_0x26a785){logger['info'](util['format'](_0xc199('0x14a'),this[_0xc199('0xd')][_0xc199('0x35')],_0x5f27e2[_0xc199('0x149')]));this['channel']['noop'](util[_0xc199('0x23')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xc199('0xd')][_0xc199('0x35')],_0x5f27e2[_0xc199('0x149')]));return{'code':0xc8,'result':_0xc199('0x14b')};}else{logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0x14c'),this[_0xc199('0xd')][_0xc199('0x35')],_0x5f27e2['findBy']));this[_0xc199('0xd')]['noop'](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel']['callerid'],_0x5f27e2[_0xc199('0x149')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xc199('0xf')][_0xc199('0x14d')]=function(_0x1a64b4){logger['info'](util[_0xc199('0x23')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x1a64b4['label']));if(!this[_0xc199('0x79')](_0x1a64b4[_0xc199('0x149')])){return this[_0xc199('0xd')][_0xc199('0x27')](_0x1a64b4,_0xc199('0x148'));}logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0x14e'),this[_0xc199('0xd')][_0xc199('0x35')],_0x1a64b4[_0xc199('0x149')]));var _0x5801cf=this['agentLogout']['sync'](this,_0x1a64b4[_0xc199('0x149')]);if(_0x5801cf){logger[_0xc199('0x29')](util[_0xc199('0x23')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xc199('0xd')]['callerid'],_0x1a64b4[_0xc199('0x149')]));this['channel'][_0xc199('0x9a')](util[_0xc199('0x23')](_0xc199('0x14a'),this[_0xc199('0xd')][_0xc199('0x35')],_0x1a64b4[_0xc199('0x149')]));return{'code':0xc8,'result':_0xc199('0x14b')};}else{logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0x14c'),this[_0xc199('0xd')]['callerid'],_0x1a64b4['findBy']));this[_0xc199('0xd')][_0xc199('0x9a')](util[_0xc199('0x23')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xc199('0xd')][_0xc199('0x35')],_0x1a64b4[_0xc199('0x149')]));return{'code':0xc8,'result':_0xc199('0x14f')};}};AGIVertices['prototype'][_0xc199('0x150')]=function(_0x3a43f1){logger[_0xc199('0x29')](util['format']('Enter\x20in\x20MATH\x20(%s)\x20block',_0x3a43f1['label']));if(!this[_0xc199('0x79')](_0x3a43f1[_0xc199('0x151')])){return this[_0xc199('0xd')]['error'](_0x3a43f1,_0xc199('0x152'));}this[_0xc199('0xd')][_0xc199('0x9a')](util['format'](_0xc199('0x153'),_0x3a43f1[_0xc199('0x151')]));var _0x5c883f=eval(_0x3a43f1[_0xc199('0x151')]);if(!this[_0xc199('0x79')](_0x3a43f1[_0xc199('0xc7')])){return this[_0xc199('0xd')][_0xc199('0x9a')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0xc06dd3=this[_0xc199('0xc9')][_0xc199('0x65')](this,_0x3a43f1[_0xc199('0xc7')]);if(!_0xc06dd3){return this['channel'][_0xc199('0x27')](_0x3a43f1,_0xc199('0x108'));}if(_[_0xc199('0x8c')](_0x5c883f)){var _0x5d3071=this;_0x5c883f[_0xc199('0xca')](function(_0x5e0f68,_0x17862d){_0x5d3071['channel'][_0xc199('0x94')](util[_0xc199('0x23')](_0xc199('0x154'),_0xc06dd3,_0x17862d),_0x5e0f68);});return this['channel']['noop'](util[_0xc199('0x23')](_0xc199('0x155'),_0xc06dd3));}else{return this[_0xc199('0xd')][_0xc199('0x94')](_0xc06dd3,_0x5c883f);}};AGIVertices['prototype'][_0xc199('0xc')]=function(_0x3f3f75){logger['info'](util['format'](_0xc199('0x156'),_0x3f3f75[_0xc199('0x32')]));if(_0x3f3f75['retry']===0x0){return this[_0xc199('0x95')](_0x3f3f75);}_0x3f3f75[_0xc199('0x101')]-=0x1;if(!this['isConfigured'](_0x3f3f75['file_id'])){return this[_0xc199('0xd')][_0xc199('0x27')](_0x3f3f75,'no\x20file\x20audio\x20selected');}var _0x259b2e=this[_0xc199('0x103')][_0xc199('0x65')](this,_0x3f3f75[_0xc199('0x102')]);if(!_0x259b2e){return this[_0xc199('0xd')][_0xc199('0x27')](_0x3f3f75,_0xc199('0x104'));}var _0x5b77be=this[_0xc199('0xd')]['getData'](_0x259b2e,_0x3f3f75['response'],_0x3f3f75['digit']);var _0x454d7c=_0x5b77be[_0xc199('0x99')];if(_0x5b77be[_0xc199('0x99')]===-0x1){this['createSquareDetailsReport'][_0xc199('0x65')](this,_0x3f3f75,'-1');return _0x5b77be;}else if(_0x5b77be[_0xc199('0x92')]==='timeout'){_0x5b77be['result']=_0x5b77be[_0xc199('0x99')][_0xc199('0x90')]>0x0?_0x5b77be[_0xc199('0x99')]:'t';}else if(_[_0xc199('0x3d')](_0x5b77be[_0xc199('0x99')])){_0x5b77be[_0xc199('0x99')]='#';_0x454d7c='#';}if(!this[_0xc199('0x79')](_0x3f3f75[_0xc199('0xc7')])){this[_0xc199('0xd')][_0xc199('0x9a')](_0xc199('0xc8'));}else{var _0x1ea1b0=this[_0xc199('0xc9')][_0xc199('0x65')](this,_0x3f3f75['variable_id']);if(!_0x1ea1b0){return this[_0xc199('0xd')]['error'](_0x3f3f75,_0xc199('0x108'));}this[_0xc199('0xd')][_0xc199('0x94')](_0x1ea1b0,_0x454d7c);}this['createSquareDetailsReport']['sync'](this,_0x3f3f75,_0x454d7c);return _0x5b77be;};AGIVertices['prototype'][_0xc199('0x9a')]=function(_0x279cd8){logger['info'](util[_0xc199('0x23')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x279cd8[_0xc199('0x32')]));return this[_0xc199('0xd')][_0xc199('0x9a')](_0x279cd8[_0xc199('0x157')]||_0x279cd8['label']);};AGIVertices[_0xc199('0xf')][_0xc199('0x158')]=function(_0x454c3a){logger['info'](util[_0xc199('0x23')](_0xc199('0x159'),_0x454c3a[_0xc199('0x32')]));if(!this[_0xc199('0x79')](_0x454c3a[_0xc199('0x149')])){return this['channel']['error'](_0x454c3a,'no\x20find\x20by\x20configured');}logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0x14e'),this[_0xc199('0xd')][_0xc199('0x35')],_0x454c3a[_0xc199('0x149')]));var _0x4adfc8=this[_0xc199('0x15a')]['sync'](this,_0x454c3a[_0xc199('0x15b')]);var _0xe2fe41=this[_0xc199('0x46')][_0xc199('0x65')](this,_0x454c3a[_0xc199('0x149')],_0x4adfc8);if(_0xe2fe41){logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0x14a'),this[_0xc199('0xd')][_0xc199('0x35')],_0x454c3a[_0xc199('0x149')]));this[_0xc199('0xd')]['noop'](util[_0xc199('0x23')](_0xc199('0x14a'),this[_0xc199('0xd')][_0xc199('0x35')],_0x454c3a[_0xc199('0x149')]));return{'code':0xc8,'result':_0xc199('0x14b')};}else{logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0x14c'),this[_0xc199('0xd')][_0xc199('0x35')],_0x454c3a[_0xc199('0x149')]));this[_0xc199('0xd')][_0xc199('0x9a')](util[_0xc199('0x23')](_0xc199('0x14a'),this[_0xc199('0xd')]['callerid'],_0x454c3a[_0xc199('0x149')]));return{'code':0xc8,'result':_0xc199('0x14f')};}};AGIVertices['prototype']['playback']=function(_0x938d91){logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0x15c'),_0x938d91['label']));if(!this[_0xc199('0x79')](_0x938d91[_0xc199('0x102')])){return this[_0xc199('0xd')][_0xc199('0x27')](_0x938d91,'no\x20file\x20audio\x20selected');}var _0xcfbc1e=this[_0xc199('0x103')][_0xc199('0x65')](this,_0x938d91[_0xc199('0x102')]);if(!_0xcfbc1e){return this['channel'][_0xc199('0x27')](_0x938d91,_0xc199('0x104'));}var _0x54f59e=this[_0xc199('0xd')][_0xc199('0x4c')](_0xc199('0x15d'),[_0xcfbc1e,_0x938d91[_0xc199('0xfc')]]);if(_0x54f59e['result']===-0x1){return _0x54f59e;}return this['channel'][_0xc199('0x9a')](util['format'](_0xc199('0x15e'),_0xc199('0x15d'),_0xcfbc1e));};AGIVertices[_0xc199('0xf')][_0xc199('0x15f')]=function(_0xae16c3){logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0x160'),_0xae16c3['label']));if(!this['isConfigured'](_0xae16c3[_0xc199('0x161')])){return this['channel'][_0xc199('0x27')](_0xae16c3,'no\x20queue\x20selected');}var _0x1c7aa2='';var _0x1b6ddc=parseInt(_0xae16c3[_0xc199('0x161')],0xa);if(isNaN(_0x1b6ddc)){_0x1c7aa2=_0xae16c3['queue_id'];}else{_0x1c7aa2=this[_0xc199('0x13')]['sync'](this,_0xae16c3[_0xc199('0x161')]);if(!_0x1c7aa2){return this[_0xc199('0xd')][_0xc199('0x27')](_0xae16c3,'no\x20queue\x20found');}}var _0x32c12a='';if(this[_0xc199('0x79')](_0xae16c3[_0xc199('0x102')])){var _0x288534=this[_0xc199('0x103')][_0xc199('0x65')](this,_0xae16c3[_0xc199('0x102')]);if(_0x288534){_0x32c12a=_0x288534;}}this['createSquareDetailsReport'][_0xc199('0x65')](this,_0xae16c3,_0x1c7aa2);if(_0xae16c3[_0xc199('0xfc')][_0xc199('0x162')]('x')<0x0){_0xae16c3[_0xc199('0xfc')]+='x';}if(_0xae16c3[_0xc199('0xfc')][_0xc199('0x162')]('X')<0x0){_0xae16c3[_0xc199('0xfc')]+='X';}this['channel'][_0xc199('0x94')]('XMCS-QUEUE',_0x1c7aa2?_0x1c7aa2['toLowerCase']():'');var _0x4a53e6=this[_0xc199('0xd')][_0xc199('0x4c')]('QUEUE',[_0x1c7aa2,_0xae16c3[_0xc199('0xfc')],_0xae16c3[_0xc199('0x58')],_0x32c12a,_0xae16c3['timeout'],_0xae16c3[_0xc199('0x7')],_0xae16c3[_0xc199('0x163')],_0xae16c3[_0xc199('0x164')],'',_0xae16c3[_0xc199('0x165')]]);if(_0x4a53e6[_0xc199('0x99')]===-0x1){return _0x4a53e6;}return this[_0xc199('0xd')][_0xc199('0x9a')](util[_0xc199('0x23')]('Executed\x20command\x20%s\x20%s','QUEUE',_0x1c7aa2));};AGIVertices[_0xc199('0xf')]['record']=function(_0x477fa3){logger[_0xc199('0x29')](util['format']('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x477fa3[_0xc199('0x32')]));var _0x32177b=_0x477fa3[_0xc199('0x166')]||'wav';var _0x2e3aaa=util['format'](_0xc199('0x167'),this[_0xc199('0xd')][_0xc199('0x31')],rs[_0xc199('0x10a')](0x5));var _0x14a834=util[_0xc199('0x23')]('%s/recordings/%s.%s',FILES_PATH,_0x2e3aaa,_0x32177b);var _0x5ab9b0=util[_0xc199('0x23')]('%s/recordings/%s',FILES_PATH,_0x2e3aaa);this['createSquareRecording']['sync'](this,_0x477fa3,_0x2e3aaa,_0x14a834);this[_0xc199('0xd')][_0xc199('0x94')]('RECORDING_SAVENAME',_0x2e3aaa);logger[_0xc199('0x29')](_0xc199('0x168'),_0x5ab9b0,_0x32177b,_0x477fa3[_0xc199('0x169')],_0x477fa3[_0xc199('0x5a')]);return this['channel'][_0xc199('0x12e')](_0x5ab9b0,_0x32177b,_0x477fa3[_0xc199('0x169')],_0x477fa3['timeout'],undefined,!![]);};AGIVertices[_0xc199('0xf')][_0xc199('0x16a')]=function(_0x2562bd){logger['info'](util['format']('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x2562bd[_0xc199('0x32')]));if(!this[_0xc199('0x79')](_0x2562bd['url'])){return this[_0xc199('0xd')][_0xc199('0x9a')]('no\x20url\x20configured');}var _0x3e4519=this[_0xc199('0x57')]['sync'](this,_0x2562bd);logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0x16b'),util[_0xc199('0x16c')](_0x3e4519,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x2562bd[_0xc199('0xc7')])){return this[_0xc199('0xd')]['noop'](_0xc199('0x16d'));}var _0x23fc76=this[_0xc199('0xc9')][_0xc199('0x65')](this,_0x2562bd[_0xc199('0xc7')]);if(!_0x23fc76){return this[_0xc199('0xd')][_0xc199('0x27')](_0x2562bd,'no\x20variable\x20found');}this['channel'][_0xc199('0x94')](util[_0xc199('0x23')](_0xc199('0x16e'),_0x23fc76),_0x3e4519[_0xc199('0x69')]?_0x3e4519['statusCode']:'200');this[_0xc199('0xd')][_0xc199('0x94')](util[_0xc199('0x23')](_0xc199('0x16f'),_0x23fc76),_0x3e4519[_0xc199('0x6a')]?_0x3e4519[_0xc199('0x6a')]:'OK');if(_0x3e4519['body']){try{this[_0xc199('0x8e')](_0x3e4519[_0xc199('0x5f')],_0x23fc76);}catch(_0x422d76){logger[_0xc199('0x27')](util['format']('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x23fc76));}}return this['channel'][_0xc199('0x9a')](util['format'](_0xc199('0xcc'),_0x23fc76));};AGIVertices[_0xc199('0xf')][_0xc199('0x170')]=function(_0x296908){logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0x171'),_0x296908[_0xc199('0x32')]));return this[_0xc199('0xd')][_0xc199('0x172')](_0x296908[_0xc199('0x173')][_0xc199('0xc5')](/\s+/g,''),_0x296908[_0xc199('0x169')]);};AGIVertices[_0xc199('0xf')][_0xc199('0x174')]=function(_0x522aff){logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0x175'),_0x522aff[_0xc199('0x32')]));return this['channel'][_0xc199('0x176')](_0x522aff[_0xc199('0x177')]['replace'](/\s+/g,''),_0x522aff[_0xc199('0x169')]);};AGIVertices[_0xc199('0xf')]['sayphonetic']=function(_0x2b707e){logger['info'](util['format'](_0xc199('0x178'),_0x2b707e[_0xc199('0x32')]));return this['channel']['sayPhonetic'](_0x2b707e[_0xc199('0x4f')],_0x2b707e[_0xc199('0x169')]);};AGIVertices['prototype']['sendMail']=function(_0x67eb5b){logger[_0xc199('0x29')](util['format']('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x67eb5b[_0xc199('0x32')]));if(!this[_0xc199('0x79')](_0x67eb5b['account_id'])){return this[_0xc199('0xd')][_0xc199('0x9a')](_0xc199('0x179'));}var _0x27424f=this[_0xc199('0x1e')][_0xc199('0x65')](this,_0x67eb5b[_0xc199('0x17a')]);if(!_0x27424f||!_0x27424f[_0xc199('0x17b')]){return this[_0xc199('0xd')][_0xc199('0x27')](_0x67eb5b,_0xc199('0x17c'));}var _0x11f46c={'from':util[_0xc199('0x23')]('\x22%s\x22\x20<%s>',_0x27424f[_0xc199('0x11')],_0x27424f[_0xc199('0x17d')]||_0x27424f['Smtp'][_0xc199('0x17e')]),'to':_0x67eb5b['to']||'','cc':_0x67eb5b['cc']||'','bcc':_0x67eb5b[_0xc199('0x17f')]||'','subject':_0x67eb5b[_0xc199('0x180')],'html':_0x67eb5b[_0xc199('0x4f')],'text':_0x67eb5b[_0xc199('0x4f')]};var _0x48a966={'tls':{'rejectUnauthorized':![]}};if(_0x27424f[_0xc199('0x17b')][_0xc199('0x181')]){_0x48a966[_0xc199('0x181')]=_0x27424f[_0xc199('0x17b')][_0xc199('0x181')];}else{_0x48a966['host']=_0x27424f['Smtp'][_0xc199('0x182')];_0x48a966[_0xc199('0x183')]=_0x27424f['Smtp'][_0xc199('0x183')];_0x48a966[_0xc199('0x184')]=_0x27424f['Smtp'][_0xc199('0x184')];}if(_0x27424f[_0xc199('0x17b')][_0xc199('0x185')]){_0x48a966[_0xc199('0x186')]={'user':_0x27424f[_0xc199('0x17b')]['user'],'pass':_0x27424f[_0xc199('0x17b')][_0xc199('0x187')]};}if(this[_0xc199('0x79')](_0x67eb5b[_0xc199('0x188')])){}logger[_0xc199('0xcd')](_0xc199('0x189'),JSON[_0xc199('0x67')](_0x11f46c));this[_0xc199('0x30')][_0xc199('0x65')](this,_0x67eb5b,_0x67eb5b[_0xc199('0x17a')]);this['channel'][_0xc199('0x9a')](util[_0xc199('0x23')](_0xc199('0x18a'),_0x27424f[_0xc199('0x11')]));this['sendMailMessage'][_0xc199('0x65')](this,_0x48a966,_0x11f46c);return this['channel'][_0xc199('0x9a')](_0xc199('0x18b'));};AGIVertices[_0xc199('0xf')][_0xc199('0x18c')]=function(_0x1029f7){logger['info'](util['format'](_0xc199('0x18d'),_0x1029f7[_0xc199('0x32')]));return this['channel']['noop'](_0xc199('0x18e'));};AGIVertices[_0xc199('0xf')][_0xc199('0x18f')]=function(_0x37507f){logger['info'](util[_0xc199('0x23')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x37507f[_0xc199('0x32')]));if(!this[_0xc199('0x79')](_0x37507f[_0xc199('0x190')])){return this[_0xc199('0xd')][_0xc199('0x9a')](_0xc199('0x191'));}var _0x363730=this['getSmsAccount'][_0xc199('0x65')](this,_0x37507f[_0xc199('0x190')]);if(!_0x363730){return this[_0xc199('0xd')][_0xc199('0x27')](_0x37507f,'no\x20sms\x20account\x20found');}var _0x4819d9={'body':_0x37507f['sms_text'],'phone':_0x37507f['to']||'','SmsAccountId':_0x363730['id']};logger[_0xc199('0xcd')]('sendSMS\x20message',JSON['stringify'](_0x4819d9));this[_0xc199('0x30')]['sync'](this,_0x37507f,_0x37507f[_0xc199('0x190')]);this[_0xc199('0xd')][_0xc199('0x9a')](util[_0xc199('0x23')](_0xc199('0x192'),_0x363730[_0xc199('0x11')]));this['createSmsMessage'][_0xc199('0x65')](this,_0x4819d9);return this['channel'][_0xc199('0x9a')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype'][_0xc199('0x193')]=function(_0x313d64){logger[_0xc199('0x29')](util['format']('Enter\x20in\x20SET\x20(%s)\x20block',_0x313d64[_0xc199('0x32')]));if(!this['isConfigured'](_0x313d64[_0xc199('0xc7')])){return this[_0xc199('0xd')][_0xc199('0x27')](_0x313d64,'no\x20variable\x20selected');}var _0x46f071=this['getVariable'][_0xc199('0x65')](this,_0x313d64['variable_id']);if(!_0x46f071){return this[_0xc199('0xd')][_0xc199('0x27')](_0x313d64,_0xc199('0x108'));}return this[_0xc199('0xd')]['setVariable'](_0x46f071,_0x313d64[_0xc199('0x194')]);};AGIVertices['prototype'][_0xc199('0x195')]=function(_0x104375){logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0x196'),_0x104375[_0xc199('0x32')]));this[_0xc199('0xd')]['noop']('START\x20CALLY\x20SQUARE');if(_0x104375[_0xc199('0xa5')]===_0xc199('0x197')){this[_0xc199('0xd')][_0xc199('0x9a')]('Answer');return this[_0xc199('0xd')]['answer']();}return this[_0xc199('0xd')][_0xc199('0x9a')](_0xc199('0x198'));};AGIVertices[_0xc199('0xf')][_0xc199('0x199')]=function(_0xacdf56){logger[_0xc199('0x29')](util[_0xc199('0x23')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0xacdf56[_0xc199('0x32')]));if(!this[_0xc199('0x79')](_0xacdf56[_0xc199('0x19a')])){return this[_0xc199('0xd')][_0xc199('0x27')](_0xacdf56,_0xc199('0x19b'));}var _0x580edb=this[_0xc199('0x19c')]['sync'](this,_0xacdf56[_0xc199('0x19a')]);if(!this[_0xc199('0x79')](_0x580edb)){return this[_0xc199('0xd')][_0xc199('0x27')](_0xacdf56,util[_0xc199('0x23')](_0xc199('0x19d'),_0xacdf56[_0xc199('0x19a')]));}if(_0x580edb===this[_0xc199('0xd')]['arg_1']){return this[_0xc199('0xd')][_0xc199('0x27')](_0xacdf56,_0xc199('0x19e'));}this[_0xc199('0x30')][_0xc199('0x65')](this,_0xacdf56,_0x580edb);var _0x52778b=this[_0xc199('0xd')][_0xc199('0x4c')]('AGI',util[_0xc199('0x23')](_0xc199('0x19f'),config[_0xc199('0x7')][_0xc199('0x182')]||_0xc199('0x1a0'),_0x580edb,this[_0xc199('0xd')][_0xc199('0x34')]));if(_0x52778b[_0xc199('0x99')]===-0x1){return _0x52778b;}return this['channel']['noop'](util[_0xc199('0x23')](_0xc199('0x15e'),'AGI',_0x580edb));};AGIVertices[_0xc199('0xf')][_0xc199('0x1a1')]=function(_0x4d8d70){logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0x1a2'),_0x4d8d70[_0xc199('0x32')]));var _0x120c6d=this['shellCommand'][_0xc199('0x65')](this,_0x4d8d70[_0xc199('0x1a3')]);this['createSquareDetailsReport'][_0xc199('0x65')](this,_0x4d8d70,_0x4d8d70[_0xc199('0x1a3')]);if(this[_0xc199('0x79')](_0x4d8d70[_0xc199('0xc7')])){var _0x10e4d6=this[_0xc199('0xc9')][_0xc199('0x65')](this,_0x4d8d70['variable_id']);if(_0x10e4d6){this[_0xc199('0xd')]['setVariable'](_0x10e4d6,_0x120c6d);return this[_0xc199('0xd')][_0xc199('0x9a')](util[_0xc199('0x23')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x4d8d70[_0xc199('0x1a3')],_0x10e4d6));}}return this[_0xc199('0xd')][_0xc199('0x9a')](util[_0xc199('0x23')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x4d8d70[_0xc199('0x1a3')]));};AGIVertices[_0xc199('0xf')][_0xc199('0x1a4')]=function(_0x285dd4){logger[_0xc199('0x29')](util[_0xc199('0x23')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x285dd4[_0xc199('0x32')]));_0x285dd4[_0xc199('0x4f')]=_0x285dd4['text'][_0xc199('0xc5')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x285dd4[_0xc199('0x1a5')])){return this[_0xc199('0xd')][_0xc199('0x9a')](_0xc199('0x1a6'));}if(!this[_0xc199('0x79')](_0x285dd4[_0xc199('0x4f')])){return this[_0xc199('0xd')]['noop'](_0xc199('0xb1'));}this[_0xc199('0xd')]['noop'](util[_0xc199('0x23')](_0xc199('0x1a7'),_0x285dd4[_0xc199('0x4f')]));var _0x66b03e=this[_0xc199('0x4e')][_0xc199('0x65')](this,_0x285dd4);if(_0x66b03e){this[_0xc199('0xd')][_0xc199('0x9a')](util[_0xc199('0x23')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x66b03e));var _0x16e257=this['channel']['streamFile'](_0x66b03e);try{fs[_0xc199('0xf1')](_0x66b03e+_0xc199('0xf2'));}catch(_0x585032){logger[_0xc199('0x27')](_0x585032);}return _0x16e257;}return this[_0xc199('0xd')]['error'](_0x285dd4,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0xc199('0xf')][_0xc199('0x1a8')]=function(_0x2ab1da){logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0x1a9'),_0x2ab1da['label']));_0x2ab1da[_0xc199('0x4f')]=_0x2ab1da['text'][_0xc199('0xc5')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x2ab1da[_0xc199('0x4f')])){return this[_0xc199('0xd')][_0xc199('0x9a')]('no\x20text\x20configured');}this[_0xc199('0xd')][_0xc199('0x9a')](util[_0xc199('0x23')](_0xc199('0x1aa'),_0x2ab1da[_0xc199('0x4f')]));var _0x59f4b6=this[_0xc199('0x55')][_0xc199('0x65')](this,_0x2ab1da);if(_0x59f4b6){this[_0xc199('0xd')][_0xc199('0x9a')](util[_0xc199('0x23')]('Google\x20TTS\x20%s\x20file\x20created',_0x59f4b6));var _0x1e5341=this['channel'][_0xc199('0x118')](_0x59f4b6);try{fs['unlink'](_0x59f4b6+'.wav');}catch(_0x368b2e){logger[_0xc199('0x27')](_0x368b2e);}return _0x1e5341;}return this[_0xc199('0xd')][_0xc199('0x27')](_0x2ab1da,_0xc199('0x1ab'));};AGIVertices['prototype'][_0xc199('0x1ac')]=function(_0x461b38){logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0x1ad'),_0x461b38[_0xc199('0x32')]));if(!this[_0xc199('0x79')](_0x461b38['findBy'])){return this[_0xc199('0xd')][_0xc199('0x27')](_0x461b38,_0xc199('0x148'));}logger[_0xc199('0x29')](util['format'](_0xc199('0x14e'),this['channel']['callerid'],_0x461b38[_0xc199('0x149')]));var _0x4afca3=this[_0xc199('0x47')][_0xc199('0x65')](this,_0x461b38[_0xc199('0x149')]);if(_0x4afca3){logger[_0xc199('0x29')](util[_0xc199('0x23')](_0xc199('0x14a'),this[_0xc199('0xd')][_0xc199('0x35')],_0x461b38[_0xc199('0x149')]));this[_0xc199('0xd')][_0xc199('0x9a')](util[_0xc199('0x23')](_0xc199('0x14a'),this['channel'][_0xc199('0x35')],_0x461b38[_0xc199('0x149')]));return{'code':0xc8,'result':_0xc199('0x14b')};}else{logger[_0xc199('0x29')](util['format'](_0xc199('0x14c'),this[_0xc199('0xd')][_0xc199('0x35')],_0x461b38[_0xc199('0x149')]));this[_0xc199('0xd')][_0xc199('0x9a')](util[_0xc199('0x23')](_0xc199('0x14c'),this['channel'][_0xc199('0x35')],_0x461b38[_0xc199('0x149')]));return{'code':0xc8,'result':_0xc199('0x14f')};}};AGIVertices[_0xc199('0xf')][_0xc199('0x1ae')]=function(_0x47ff00){logger[_0xc199('0x29')](util['format'](_0xc199('0x1af'),_0x47ff00[_0xc199('0x32')]));var _0x1093d4=this[_0xc199('0xd')][_0xc199('0x4c')](_0xc199('0x1b0'),[_0x47ff00[_0xc199('0x1b1')],_0x47ff00[_0xc199('0x6d')]]);if(_0x1093d4[_0xc199('0x99')]===-0x1){return _0x1093d4;}return this[_0xc199('0xd')][_0xc199('0x9a')](util[_0xc199('0x23')]('Executed\x20command\x20%s\x20%s',_0xc199('0x1b0'),_0x47ff00[_0xc199('0x1b1')]));};AGIVertices['prototype']['vswitch']=function(_0x5a996b){logger['info'](util[_0xc199('0x23')](_0xc199('0x1b2'),_0x5a996b[_0xc199('0x32')]));if(!this[_0xc199('0x79')](_0x5a996b['variable_id'])){return this[_0xc199('0xd')][_0xc199('0x27')](_0x5a996b,_0xc199('0x1b3'));}var _0x228b7f=this[_0xc199('0xc9')][_0xc199('0x65')](this,_0x5a996b[_0xc199('0xc7')]);if(!_0x228b7f){return this['channel'][_0xc199('0x27')](_0x5a996b,'no\x20variable\x20found');}var _0x4d6b63=this[_0xc199('0xd')]['getVariable'](_0x228b7f);return{'code':0xc8,'result':_0x4d6b63[_0xc199('0x92')]?_0x4d6b63[_0xc199('0x92')]:'-'};};String[_0xc199('0xf')]['replaceAll']=function(_0x21c2b4,_0x481cc8){return this[_0xc199('0x91')](_0x21c2b4)[_0xc199('0x1b4')](_0x481cc8);};module[_0xc199('0x1b5')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 08ff661..8af47b6 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 _0xe235=['timer','stopAcw','lastPauseAt','uniqueid','updateAcw','update','info','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','prototype','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ERRORS:%s]','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','attended','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','syncAttendedTransfer','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','../../../config/logger','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','syncHangupRequest','bind','syncHangup','syncAgentRingNoAnswer','attendedtransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','diff','seconds','interface','queue','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout'];(function(_0x576e2b,_0x328953){var _0x46461a=function(_0xce4d9e){while(--_0xce4d9e){_0x576e2b['push'](_0x576e2b['shift']());}};_0x46461a(++_0x328953);}(_0xe235,0x18a));var _0x5e23=function(_0x313b7e,_0x585ac8){_0x313b7e=_0x313b7e-0x0;var _0xb3b50f=_0xe235[_0x313b7e];return _0xb3b50f;};'use strict';var util=require('util');var _=require(_0x5e23('0x0'));var moment=require(_0x5e23('0x1'));var ami=require(_0x5e23('0x2'));var logger=require(_0x5e23('0x3'))(_0x5e23('0x4'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x5e23('0x5'));function Acw(_0x4c05e7){this[_0x5e23('0x6')]=_0x4c05e7['voiceQueues'];this[_0x5e23('0x7')]=_0x4c05e7['agents'];this[_0x5e23('0x8')]=_0x4c05e7[_0x5e23('0x8')];this[_0x5e23('0x9')]={};ami['on'](_0x5e23('0xa'),this[_0x5e23('0xb')]['bind'](this));ami['on']('hanguprequest',this[_0x5e23('0xc')][_0x5e23('0xd')](this));ami['on']('hangup',this[_0x5e23('0xe')]['bind'](this));ami['on']('agentringnoanswer',this[_0x5e23('0xf')][_0x5e23('0xd')](this));ami['on'](_0x5e23('0x10'),this['syncAttendedTransfer'][_0x5e23('0xd')](this));ami['on'](_0x5e23('0x11'),this[_0x5e23('0x12')][_0x5e23('0xd')](this));ami['on'](_0x5e23('0x13'),this['syncAgentConnectPreview']['bind'](this));}function getDiff(_0x57484c){var _0x487da9=moment()[_0x5e23('0x14')](0x0);var _0x5be957=moment(_0x57484c)['milliseconds'](0x0);return _0x487da9[_0x5e23('0x15')](_0x5be957,_0x5e23('0x16'));}Acw['prototype']['startAcw']=function(_0x402850){try{var _0x1763ae=this;var _0x1c2e3f=this[_0x5e23('0x9')][_0x402850][_0x5e23('0x17')];var _0x340c46=this[_0x5e23('0x9')][_0x402850][_0x5e23('0x18')];var _0x404502=this[_0x5e23('0x6')][_0x340c46];var _0x293f60=![];var _0x4dc181='ACW';if(_0x404502[_0x5e23('0x19')]){if(_0x404502[_0x5e23('0x1a')][_0x5e23('0x1b')]){_0x293f60=!![];_0x4dc181=_0x404502[_0x5e23('0x1a')][_0x5e23('0x1b')];}}ami[_0x5e23('0x1c')]({'action':_0x5e23('0x1d'),'interface':_0x1c2e3f,'paused':!![],'reason':_0x4dc181})[_0x5e23('0x1e')](function(_0x161a45){if(_0x1763ae[_0x5e23('0x7')][_0x1c2e3f]){return RpcUser['getAgent'](_0x1763ae[_0x5e23('0x7')][_0x1c2e3f]['id'])[_0x5e23('0x1e')](function(_0x274b49){if(_0x274b49&&!_0x274b49['voicePause']){logger['info'](_0x5e23('0x1f'),_0x402850,_0x1c2e3f,_0x340c46);var _0x544a11=_0x1763ae['channels'][_0x402850]['attended']&&_0x1763ae['channels'][_0x402850][_0x5e23('0x20')]?_0x1763ae['channels'][_0x402850][_0x5e23('0x20')]:_0x402850;return RpcUser[_0x5e23('0x21')](_0x1763ae[_0x5e23('0x7')][_0x1c2e3f],_0x4dc181,_0x544a11)[_0x5e23('0x1e')](function(_0x3555c5){if(!_0x293f60){_0x1763ae[_0x5e23('0x8')][_0x1c2e3f]={};logger['info'](_0x5e23('0x22'),_0x402850,_0x1763ae['voiceQueues'][_0x340c46][_0x5e23('0x23')],_0x1c2e3f,_0x340c46);_0x1763ae['timers'][_0x1c2e3f][_0x5e23('0x24')]=setTimeout(_0x1763ae[_0x5e23('0x25')][_0x5e23('0xd')](_0x1763ae,_0x1c2e3f),_0x1763ae[_0x5e23('0x6')][_0x340c46]['acwTimeout']*0x3e8);_0x1763ae[_0x5e23('0x8')][_0x1c2e3f][_0x5e23('0x26')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1763ae[_0x5e23('0x8')][_0x1c2e3f][_0x5e23('0x27')]=_0x402850;_0x1763ae[_0x5e23('0x8')][_0x1c2e3f]['queue']=_0x340c46;_0x1763ae[_0x5e23('0x8')][_0x1c2e3f][_0x5e23('0x28')]=function(){var _0x35a45f=getDiff(_0x1763ae['timers'][_0x1c2e3f][_0x5e23('0x26')]);clearTimeout(_0x1763ae[_0x5e23('0x8')][_0x1c2e3f][_0x5e23('0x24')]);_0x1763ae[_0x5e23('0x8')][_0x1c2e3f][_0x5e23('0x24')]=![];RpcVoiceAgentReport[_0x5e23('0x29')]({'acwtime':_0x35a45f},_0x1763ae[_0x5e23('0x8')][_0x1c2e3f][_0x5e23('0x27')],_0x1c2e3f)[_0x5e23('0x1e')](function(_0x3290fc){logger[_0x5e23('0x2a')](_0x5e23('0x2b'),_0x402850,_0x35a45f,_0x3290fc);})[_0x5e23('0x2c')](function(_0xb9f00b){logger[_0x5e23('0x2d')]('[%s][UPDATE][ERRORS:%s]',_0x402850,_0xb9f00b);});delete _0x1763ae['timers'][_0x1c2e3f];};}});}else{logger[_0x5e23('0x2a')](_0x5e23('0x2e'),_0x402850,_0x1c2e3f,_0x340c46);}});}})[_0x5e23('0x2c')](function(_0x65069f){logger[_0x5e23('0x2d')](_0x5e23('0x22'),_0x402850,_0x1763ae['voiceQueues'][_0x340c46]['acwTimeout'],_0x1c2e3f,_0x340c46);})[_0x5e23('0x2f')](function(){delete _0x1763ae[_0x5e23('0x9')][_0x402850];});}catch(_0x297935){logger[_0x5e23('0x2d')](_0x5e23('0x30'),_0x297935[_0x5e23('0x31')]);}};Acw[_0x5e23('0x32')]['stopAcw']=function(_0x214e61){try{var _0x2f69f2=this;if(_0x2f69f2[_0x5e23('0x8')][_0x214e61]){_0x2f69f2['timers'][_0x214e61][_0x5e23('0x24')]=![];var _0x538bdb=_0x2f69f2[_0x5e23('0x8')][_0x214e61][_0x5e23('0x27')];var _0x59274d=_0x2f69f2[_0x5e23('0x8')][_0x214e61][_0x5e23('0x18')];var _0x45c39c=_0x2f69f2[_0x5e23('0x6')][_0x59274d][_0x5e23('0x23')];logger[_0x5e23('0x2a')](_0x5e23('0x33'),_0x538bdb,_0x214e61);RpcUser[_0x5e23('0x34')](this[_0x5e23('0x7')][_0x214e61]);RpcVoiceAgentReport[_0x5e23('0x29')]({'acwtime':_0x45c39c,'agentacw':!![]},_0x538bdb,_0x214e61)[_0x5e23('0x1e')](function(_0x2c7293){logger[_0x5e23('0x2a')](_0x5e23('0x2b'),_0x538bdb,_0x45c39c,_0x2c7293);})['catch'](function(_0xa0a385){logger[_0x5e23('0x2d')](_0x5e23('0x35'),_0x538bdb,_0xa0a385);});}else{logger['error']('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x214e61);if(_0x2f69f2[_0x5e23('0x8')]){logger['info'](_0x5e23('0x36'),JSON[_0x5e23('0x37')](_0x2f69f2[_0x5e23('0x8')]));}}}catch(_0x363b89){logger[_0x5e23('0x2d')](_0x5e23('0x38'),_0x363b89[_0x5e23('0x31')]);}};Acw[_0x5e23('0x32')][_0x5e23('0xb')]=function(_0x54d170){try{if(this['voiceQueues'][_0x54d170[_0x5e23('0x18')]]&&(this[_0x5e23('0x6')][_0x54d170['queue']][_0x5e23('0x4')]||this['voiceQueues'][_0x54d170[_0x5e23('0x18')]]['mandatoryDisposition'])){if(this[_0x5e23('0x7')][_0x54d170[_0x5e23('0x17')]]){this[_0x5e23('0x9')][_0x54d170[_0x5e23('0x27')]]={'queue':_0x54d170[_0x5e23('0x18')],'interface':_0x54d170[_0x5e23('0x17')],'destlinkedid':_0x54d170['destlinkedid']};}}}catch(_0x2ed77f){logger[_0x5e23('0x2d')](_0x5e23('0x39'),_0x2ed77f[_0x5e23('0x31')]);}};Acw[_0x5e23('0x32')][_0x5e23('0x3a')]=function(_0x5e7d20){try{if(this[_0x5e23('0x6')][_0x5e7d20[_0x5e23('0x18')]]&&(this['voiceQueues'][_0x5e7d20[_0x5e23('0x18')]][_0x5e23('0x4')]||this[_0x5e23('0x6')][_0x5e7d20[_0x5e23('0x18')]]['mandatoryDisposition'])){if(this['agents'][_0x5e7d20['interface']]){this[_0x5e23('0x9')][_0x5e7d20['uniqueid']]={'queue':_0x5e7d20[_0x5e23('0x18')],'interface':_0x5e7d20['interface']};}}}catch(_0xfa32c1){logger[_0x5e23('0x2d')](_0x5e23('0x3b'),_0xfa32c1[_0x5e23('0x31')]);}};Acw[_0x5e23('0x32')][_0x5e23('0xc')]=function(_0x6a1f70){try{if(this['channels'][_0x6a1f70[_0x5e23('0x27')]]&&_[_0x5e23('0x3c')](this[_0x5e23('0x9')][_0x6a1f70['uniqueid']][_0x5e23('0x3d')])){logger[_0x5e23('0x2a')](_0x5e23('0x3e'),_0x6a1f70[_0x5e23('0x27')]);this[_0x5e23('0x3f')](_0x6a1f70[_0x5e23('0x27')]);}else if(this[_0x5e23('0x9')][_0x6a1f70['linkedid']]&&_[_0x5e23('0x3c')](this[_0x5e23('0x9')][_0x6a1f70[_0x5e23('0x40')]][_0x5e23('0x3d')])){logger[_0x5e23('0x2a')](_0x5e23('0x41'),_0x6a1f70['linkedid']);this[_0x5e23('0x3f')](_0x6a1f70['linkedid']);}}catch(_0x49d241){logger[_0x5e23('0x2d')](_0x5e23('0x42'),_0x49d241['message']);}};Acw[_0x5e23('0x32')]['syncHangup']=function(_0x1b3ea8){try{if(this[_0x5e23('0x9')][_0x1b3ea8[_0x5e23('0x27')]]&&this[_0x5e23('0x9')][_0x1b3ea8[_0x5e23('0x27')]][_0x5e23('0x3d')]){logger['info'](_0x5e23('0x43'),_0x1b3ea8['uniqueid']);this[_0x5e23('0x3f')](_0x1b3ea8[_0x5e23('0x27')]);}else if(this['channels'][_0x1b3ea8[_0x5e23('0x40')]]&&this[_0x5e23('0x9')][_0x1b3ea8['linkedid']][_0x5e23('0x3d')]){logger[_0x5e23('0x2a')](_0x5e23('0x44'),_0x1b3ea8[_0x5e23('0x40')]);this[_0x5e23('0x3f')](_0x1b3ea8['linkedid']);}}catch(_0x559b9c){logger['error'](_0x5e23('0x45'),_0x559b9c[_0x5e23('0x31')]);}};Acw['prototype'][_0x5e23('0x46')]=function(_0x1a3b64){try{if(!_[_0x5e23('0x47')](this[_0x5e23('0x9')][_0x1a3b64[_0x5e23('0x48')]])){this[_0x5e23('0x3f')](_0x1a3b64[_0x5e23('0x48')]);if(this['channels'][_0x1a3b64['secondtransfereruniqueid']]){this[_0x5e23('0x9')][_0x1a3b64[_0x5e23('0x49')]][_0x5e23('0x3d')]=!![];this[_0x5e23('0x9')][_0x1a3b64[_0x5e23('0x4a')]]=this['channels'][_0x1a3b64['secondtransfereruniqueid']];delete this[_0x5e23('0x9')][_0x1a3b64[_0x5e23('0x49')]];}}else if(!_['isNil'](this['channels'][_0x1a3b64[_0x5e23('0x4a')]])){this[_0x5e23('0x3f')](_0x1a3b64[_0x5e23('0x4a')]);if(this[_0x5e23('0x9')][_0x1a3b64[_0x5e23('0x4b')]]){this[_0x5e23('0x9')][_0x1a3b64['origtransfereruniqueid']][_0x5e23('0x3d')]=!![];this[_0x5e23('0x9')][_0x1a3b64[_0x5e23('0x48')]]=this[_0x5e23('0x9')][_0x1a3b64['origtransfereruniqueid']];delete this['channels'][_0x1a3b64[_0x5e23('0x4b')]];}}}catch(_0x687718){logger[_0x5e23('0x2d')]('[ACW][syncAttendedTransfer]\x20%s',_0x687718[_0x5e23('0x31')]);}};Acw['prototype'][_0x5e23('0x12')]=function(_0x29df31){try{if(this['channels'][_0x29df31['transfereruniqueid']]){logger[_0x5e23('0x2a')](_0x5e23('0x4c'),JSON[_0x5e23('0x37')](_0x29df31[_0x5e23('0x4d')]));this[_0x5e23('0x3f')](_0x29df31[_0x5e23('0x4d')]);}else if(this[_0x5e23('0x9')][_0x29df31['transfererlinkedid']]){logger[_0x5e23('0x2a')](_0x5e23('0x4e'),JSON[_0x5e23('0x37')](_0x29df31[_0x5e23('0x4f')]));this[_0x5e23('0x3f')](_0x29df31[_0x5e23('0x4f')]);}}catch(_0x3e3207){logger[_0x5e23('0x2d')](_0x5e23('0x50'),_0x3e3207['message']);}};Acw[_0x5e23('0x32')][_0x5e23('0xf')]=function(_0x17c209){try{if(this[_0x5e23('0x6')][_0x17c209['queue']]&&this[_0x5e23('0x6')][_0x17c209[_0x5e23('0x18')]][_0x5e23('0x51')]===_0x5e23('0x52')){if(this['agents'][_0x17c209[_0x5e23('0x17')]]){logger['info'](_0x5e23('0x53'),_0x17c209[_0x5e23('0x27')],_0x17c209['interface'],_0x17c209['queue']);return RpcUser[_0x5e23('0x21')](this[_0x5e23('0x7')][_0x17c209['interface']],'Auto-Pause',_0x17c209[_0x5e23('0x27')]);}}}catch(_0x5625f8){logger['error'](_0x5e23('0x54'),_0x5625f8['message']);}};module[_0x5e23('0x55')]=Acw; \ No newline at end of file +var _0x012e=['info','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','updateAcw','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','message','acw','[ACW][syncAgentConnect]\x20%s','syncHangupRequest','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','util','lodash','moment','../ami','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','hangup','syncHangup','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause'];(function(_0x430ff2,_0x258c9e){var _0xd6136b=function(_0x5c826c){while(--_0x5c826c){_0x430ff2['push'](_0x430ff2['shift']());}};_0xd6136b(++_0x258c9e);}(_0x012e,0x185));var _0xe012=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x012e[_0x501510];return _0x1e6ee5;};'use strict';var util=require(_0xe012('0x0'));var _=require(_0xe012('0x1'));var moment=require(_0xe012('0x2'));var ami=require(_0xe012('0x3'));var logger=require(_0xe012('0x4'))('acw');var RpcUser=require(_0xe012('0x5'));var RpcVoiceAgentReport=require(_0xe012('0x6'));function Acw(_0x22b0e9){this[_0xe012('0x7')]=_0x22b0e9[_0xe012('0x7')];this['agents']=_0x22b0e9[_0xe012('0x8')];this[_0xe012('0x9')]=_0x22b0e9['timers'];this[_0xe012('0xa')]={};ami['on'](_0xe012('0xb'),this[_0xe012('0xc')][_0xe012('0xd')](this));ami['on'](_0xe012('0xe'),this['syncHangupRequest']['bind'](this));ami['on'](_0xe012('0xf'),this[_0xe012('0x10')][_0xe012('0xd')](this));ami['on']('agentringnoanswer',this[_0xe012('0x11')]['bind'](this));ami['on']('attendedtransfer',this[_0xe012('0x12')][_0xe012('0xd')](this));ami['on'](_0xe012('0x13'),this[_0xe012('0x14')][_0xe012('0xd')](this));ami['on'](_0xe012('0x15'),this['syncAgentConnectPreview']['bind'](this));}function getDiff(_0x4f48e7){var _0x460305=moment()[_0xe012('0x16')](0x0);var _0x2077f2=moment(_0x4f48e7)[_0xe012('0x16')](0x0);return _0x460305[_0xe012('0x17')](_0x2077f2,_0xe012('0x18'));}Acw[_0xe012('0x19')][_0xe012('0x1a')]=function(_0x616c42){try{var _0x25be99=this;var _0x453bc2=this['channels'][_0x616c42][_0xe012('0x1b')];var _0x433be6=this[_0xe012('0xa')][_0x616c42]['queue'];var _0x120b09=this[_0xe012('0x7')][_0x433be6];var _0x88d53e=![];var _0x5e444d=_0xe012('0x1c');if(_0x120b09[_0xe012('0x1d')]){if(_0x120b09[_0xe012('0x1e')][_0xe012('0x1f')]){_0x88d53e=!![];_0x5e444d=_0x120b09['mandatoryDispositionPause'][_0xe012('0x1f')];}}ami[_0xe012('0x20')]({'action':_0xe012('0x21'),'interface':_0x453bc2,'paused':!![],'reason':_0x5e444d})[_0xe012('0x22')](function(_0x4f1f25){if(_0x25be99[_0xe012('0x8')][_0x453bc2]){return RpcUser[_0xe012('0x23')](_0x25be99[_0xe012('0x8')][_0x453bc2]['id'])[_0xe012('0x22')](function(_0x1c35fd){if(_0x1c35fd&&!_0x1c35fd[_0xe012('0x24')]){logger['info'](_0xe012('0x25'),_0x616c42,_0x453bc2,_0x433be6);var _0x521988=_0x25be99[_0xe012('0xa')][_0x616c42][_0xe012('0x26')]&&_0x25be99[_0xe012('0xa')][_0x616c42][_0xe012('0x27')]?_0x25be99[_0xe012('0xa')][_0x616c42][_0xe012('0x27')]:_0x616c42;return RpcUser[_0xe012('0x28')](_0x25be99[_0xe012('0x8')][_0x453bc2],_0x5e444d,_0x521988)[_0xe012('0x22')](function(_0x492ef8){if(!_0x88d53e){_0x25be99['timers'][_0x453bc2]={};logger[_0xe012('0x29')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x616c42,_0x25be99[_0xe012('0x7')][_0x433be6][_0xe012('0x2a')],_0x453bc2,_0x433be6);_0x25be99[_0xe012('0x9')][_0x453bc2][_0xe012('0x2b')]=setTimeout(_0x25be99[_0xe012('0x2c')][_0xe012('0xd')](_0x25be99,_0x453bc2),_0x25be99['voiceQueues'][_0x433be6][_0xe012('0x2a')]*0x3e8);_0x25be99['timers'][_0x453bc2][_0xe012('0x2d')]=moment()[_0xe012('0x2e')](_0xe012('0x2f'));_0x25be99[_0xe012('0x9')][_0x453bc2][_0xe012('0x30')]=_0x616c42;_0x25be99[_0xe012('0x9')][_0x453bc2][_0xe012('0x31')]=_0x433be6;_0x25be99['timers'][_0x453bc2][_0xe012('0x32')]=function(){var _0x3122f5=getDiff(_0x25be99[_0xe012('0x9')][_0x453bc2][_0xe012('0x2d')]);clearTimeout(_0x25be99[_0xe012('0x9')][_0x453bc2][_0xe012('0x2b')]);_0x25be99['timers'][_0x453bc2]['timer']=![];RpcVoiceAgentReport['update']({'acwtime':_0x3122f5},_0x25be99[_0xe012('0x9')][_0x453bc2][_0xe012('0x30')],_0x453bc2)[_0xe012('0x22')](function(_0x5dbf6a){logger[_0xe012('0x29')](_0xe012('0x33'),_0x616c42,_0x3122f5,_0x5dbf6a);})[_0xe012('0x34')](function(_0x2a1b76){logger[_0xe012('0x35')](_0xe012('0x36'),_0x616c42,_0x2a1b76);});delete _0x25be99[_0xe012('0x9')][_0x453bc2];};}});}else{logger[_0xe012('0x29')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x616c42,_0x453bc2,_0x433be6);}});}})[_0xe012('0x34')](function(_0x1d5c70){logger['error'](_0xe012('0x37'),_0x616c42,_0x25be99[_0xe012('0x7')][_0x433be6][_0xe012('0x2a')],_0x453bc2,_0x433be6);})[_0xe012('0x38')](function(){delete _0x25be99[_0xe012('0xa')][_0x616c42];});}catch(_0x3f616f){logger[_0xe012('0x35')](_0xe012('0x39'),_0x3f616f['message']);}};Acw[_0xe012('0x19')][_0xe012('0x2c')]=function(_0x1778a2){try{var _0x3c148e=this;if(_0x3c148e[_0xe012('0x9')][_0x1778a2]){_0x3c148e[_0xe012('0x9')][_0x1778a2][_0xe012('0x2b')]=![];var _0x218856=_0x3c148e[_0xe012('0x9')][_0x1778a2][_0xe012('0x30')];var _0x159327=_0x3c148e[_0xe012('0x9')][_0x1778a2][_0xe012('0x31')];var _0x49a677=_0x3c148e[_0xe012('0x7')][_0x159327][_0xe012('0x2a')];logger['info'](_0xe012('0x3a'),_0x218856,_0x1778a2);RpcUser[_0xe012('0x3b')](this[_0xe012('0x8')][_0x1778a2]);RpcVoiceAgentReport['update']({'acwtime':_0x49a677,'agentacw':!![]},_0x218856,_0x1778a2)[_0xe012('0x22')](function(_0x27e27a){logger[_0xe012('0x29')](_0xe012('0x33'),_0x218856,_0x49a677,_0x27e27a);})['catch'](function(_0x4d6b9b){logger[_0xe012('0x35')](_0xe012('0x36'),_0x218856,_0x4d6b9b);});}else{logger['error'](_0xe012('0x3c'),_0x1778a2);if(_0x3c148e['timers']){logger[_0xe012('0x29')](_0xe012('0x3d'),JSON[_0xe012('0x3e')](_0x3c148e[_0xe012('0x9')]));}}}catch(_0xc9e2a5){logger['error']('[ACW][STOP]\x20%s',_0xc9e2a5[_0xe012('0x3f')]);}};Acw[_0xe012('0x19')]['syncAgentConnect']=function(_0xe8ac1e){try{if(this[_0xe012('0x7')][_0xe8ac1e[_0xe012('0x31')]]&&(this[_0xe012('0x7')][_0xe8ac1e[_0xe012('0x31')]][_0xe012('0x40')]||this[_0xe012('0x7')][_0xe8ac1e[_0xe012('0x31')]]['mandatoryDisposition'])){if(this['agents'][_0xe8ac1e[_0xe012('0x1b')]]){this[_0xe012('0xa')][_0xe8ac1e[_0xe012('0x30')]]={'queue':_0xe8ac1e[_0xe012('0x31')],'interface':_0xe8ac1e[_0xe012('0x1b')],'destlinkedid':_0xe8ac1e[_0xe012('0x27')]};}}}catch(_0xf4214f){logger[_0xe012('0x35')](_0xe012('0x41'),_0xf4214f[_0xe012('0x3f')]);}};Acw[_0xe012('0x19')]['syncAgentConnectPreview']=function(_0x36fd58){try{if(this[_0xe012('0x7')][_0x36fd58[_0xe012('0x31')]]&&(this[_0xe012('0x7')][_0x36fd58[_0xe012('0x31')]][_0xe012('0x40')]||this[_0xe012('0x7')][_0x36fd58['queue']]['mandatoryDisposition'])){if(this[_0xe012('0x8')][_0x36fd58['interface']]){this[_0xe012('0xa')][_0x36fd58['uniqueid']]={'queue':_0x36fd58[_0xe012('0x31')],'interface':_0x36fd58[_0xe012('0x1b')]};}}}catch(_0xee1430){logger[_0xe012('0x35')]('[ACW][syncAgentConnectPreview]\x20%s',_0xee1430[_0xe012('0x3f')]);}};Acw[_0xe012('0x19')][_0xe012('0x42')]=function(_0x1cb7bd){try{if(this[_0xe012('0xa')][_0x1cb7bd[_0xe012('0x30')]]&&_[_0xe012('0x43')](this[_0xe012('0xa')][_0x1cb7bd[_0xe012('0x30')]][_0xe012('0x26')])){logger[_0xe012('0x29')](_0xe012('0x44'),_0x1cb7bd[_0xe012('0x30')]);this[_0xe012('0x1a')](_0x1cb7bd[_0xe012('0x30')]);}else if(this['channels'][_0x1cb7bd[_0xe012('0x45')]]&&_[_0xe012('0x43')](this[_0xe012('0xa')][_0x1cb7bd[_0xe012('0x45')]][_0xe012('0x26')])){logger[_0xe012('0x29')]('[%s][HANGUP:LINKEDID]',_0x1cb7bd[_0xe012('0x45')]);this['startAcw'](_0x1cb7bd[_0xe012('0x45')]);}}catch(_0x915761){logger[_0xe012('0x35')]('[ACW][syncHangupRequest]\x20%s',_0x915761[_0xe012('0x3f')]);}};Acw['prototype'][_0xe012('0x10')]=function(_0x27e1c1){try{if(this[_0xe012('0xa')][_0x27e1c1['uniqueid']]&&this[_0xe012('0xa')][_0x27e1c1[_0xe012('0x30')]][_0xe012('0x26')]){logger[_0xe012('0x29')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x27e1c1[_0xe012('0x30')]);this[_0xe012('0x1a')](_0x27e1c1['uniqueid']);}else if(this[_0xe012('0xa')][_0x27e1c1['linkedid']]&&this[_0xe012('0xa')][_0x27e1c1[_0xe012('0x45')]][_0xe012('0x26')]){logger['info'](_0xe012('0x46'),_0x27e1c1[_0xe012('0x45')]);this[_0xe012('0x1a')](_0x27e1c1[_0xe012('0x45')]);}}catch(_0xc5e5aa){logger[_0xe012('0x35')](_0xe012('0x47'),_0xc5e5aa[_0xe012('0x3f')]);}};Acw[_0xe012('0x19')]['syncAttendedTransfer']=function(_0x2773fc){try{if(!_[_0xe012('0x48')](this[_0xe012('0xa')][_0x2773fc['transfereeuniqueid']])){this[_0xe012('0x1a')](_0x2773fc[_0xe012('0x49')]);if(this[_0xe012('0xa')][_0x2773fc[_0xe012('0x4a')]]){this[_0xe012('0xa')][_0x2773fc[_0xe012('0x4a')]]['attended']=!![];this[_0xe012('0xa')][_0x2773fc[_0xe012('0x4b')]]=this[_0xe012('0xa')][_0x2773fc[_0xe012('0x4a')]];delete this['channels'][_0x2773fc[_0xe012('0x4a')]];}}else if(!_[_0xe012('0x48')](this[_0xe012('0xa')][_0x2773fc[_0xe012('0x4b')]])){this[_0xe012('0x1a')](_0x2773fc[_0xe012('0x4b')]);if(this[_0xe012('0xa')][_0x2773fc[_0xe012('0x4c')]]){this[_0xe012('0xa')][_0x2773fc['origtransfereruniqueid']][_0xe012('0x26')]=!![];this[_0xe012('0xa')][_0x2773fc[_0xe012('0x49')]]=this[_0xe012('0xa')][_0x2773fc[_0xe012('0x4c')]];delete this['channels'][_0x2773fc['origtransfereruniqueid']];}}}catch(_0x51f49d){logger[_0xe012('0x35')]('[ACW][syncAttendedTransfer]\x20%s',_0x51f49d['message']);}};Acw[_0xe012('0x19')][_0xe012('0x14')]=function(_0x5c9fab){try{if(this[_0xe012('0xa')][_0x5c9fab[_0xe012('0x4d')]]){logger['info'](_0xe012('0x4e'),JSON[_0xe012('0x3e')](_0x5c9fab[_0xe012('0x4d')]));this[_0xe012('0x1a')](_0x5c9fab['transfereruniqueid']);}else if(this[_0xe012('0xa')][_0x5c9fab[_0xe012('0x4f')]]){logger[_0xe012('0x29')](_0xe012('0x50'),JSON['stringify'](_0x5c9fab[_0xe012('0x4f')]));this['startAcw'](_0x5c9fab[_0xe012('0x4f')]);}}catch(_0x5881c5){logger['error'](_0xe012('0x51'),_0x5881c5[_0xe012('0x3f')]);}};Acw[_0xe012('0x19')][_0xe012('0x11')]=function(_0x270e8d){try{if(this['voiceQueues'][_0x270e8d[_0xe012('0x31')]]&&this[_0xe012('0x7')][_0x270e8d[_0xe012('0x31')]][_0xe012('0x52')]==='all'){if(this[_0xe012('0x8')][_0x270e8d['interface']]){logger[_0xe012('0x29')](_0xe012('0x53'),_0x270e8d[_0xe012('0x30')],_0x270e8d[_0xe012('0x1b')],_0x270e8d[_0xe012('0x31')]);return RpcUser[_0xe012('0x28')](this[_0xe012('0x8')][_0x270e8d[_0xe012('0x1b')]],_0xe012('0x54'),_0x270e8d[_0xe012('0x30')]);}}}catch(_0x47a20e){logger[_0xe012('0x35')](_0xe012('0x55'),_0x47a20e[_0xe012('0x3f')]);}};module['exports']=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 030f40f..a9dce68 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 _0xd659=['sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','coreshowchannels','info','once','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','username','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionCoreShowChannels','catch','close','exports','moment','util','lodash','ami','../../config/environment','asterisk','Action','action','error','format','port','inspect','actionSipShowRegistry'];(function(_0xde7868,_0x1dffb1){var _0x343ff0=function(_0x3f9211){while(--_0x3f9211){_0xde7868['push'](_0xde7868['shift']());}};_0x343ff0(++_0x1dffb1);}(_0xd659,0x98));var _0x9d65=function(_0x51afc2,_0x189d6e){_0x51afc2=_0x51afc2-0x0;var _0x29fa7e=_0xd659[_0x51afc2];return _0x29fa7e;};'use strict';var Manager=require('asterisk-manager');var BPromise=require('bluebird');var moment=require(_0x9d65('0x0'));var util=require(_0x9d65('0x1'));var _=require(_0x9d65('0x2'));var logger=require('../../config/logger')(_0x9d65('0x3'));var config=require(_0x9d65('0x4'));var ami=new Manager(config[_0x9d65('0x5')]['port'],config[_0x9d65('0x5')]['ip'],config[_0x9d65('0x5')]['username'],config[_0x9d65('0x5')]['password'],!![]);ami['keepConnected']();ami[_0x9d65('0x6')]=BPromise['promisify'](ami[_0x9d65('0x7')]);function error(_0x241bad){logger[_0x9d65('0x8')](util[_0x9d65('0x9')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk']['username'],config['asterisk']['ip'],config[_0x9d65('0x5')][_0x9d65('0xa')],util[_0x9d65('0xb')](_0x241bad,![],null)));}function close(){logger[_0x9d65('0x8')](util[_0x9d65('0x9')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0x9d65('0x5')]['username'],config[_0x9d65('0x5')]['ip'],config[_0x9d65('0x5')]['port']));}ami[_0x9d65('0xc')]=function(){return function(){return ami[_0x9d65('0x6')]({'action':_0x9d65('0xd')});};};ami[_0x9d65('0xe')]=function(){return function(){return ami[_0x9d65('0x6')]({'action':_0x9d65('0xf')});};};ami[_0x9d65('0x10')]=function(){return function(){return ami[_0x9d65('0x6')]({'action':_0x9d65('0x11')});};};ami[_0x9d65('0x12')]=function(){return function(){return ami[_0x9d65('0x6')]({'action':'queuesummary'});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0x9d65('0x6')]({'action':_0x9d65('0x13')});};};function connect(_0x255cfe){logger[_0x9d65('0x14')](util['format']('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0x9d65('0x5')]['username'],config[_0x9d65('0x5')]['ip'],config[_0x9d65('0x5')][_0x9d65('0xa')]));ami[_0x9d65('0x15')]('error',error);ami[_0x9d65('0x15')]('close',close);}ami['on']('connect',connect);ami['on'](_0x9d65('0x16'),function(_0x185914){logger[_0x9d65('0x14')](util[_0x9d65('0x9')](_0x9d65('0x17'),config['asterisk'][_0x9d65('0x18')],config['asterisk']['ip'],config['asterisk'][_0x9d65('0xa')],util[_0x9d65('0xb')](_0x185914,![],null)));});ami['on'](_0x9d65('0x19'),function(_0x4b1f29){logger[_0x9d65('0x14')](util['format'](_0x9d65('0x1a'),config[_0x9d65('0x5')][_0x9d65('0x18')],config['asterisk']['ip'],config['asterisk'][_0x9d65('0xa')]));return BPromise[_0x9d65('0x1b')]()[_0x9d65('0x1c')](ami[_0x9d65('0xc')]())[_0x9d65('0x1c')](ami[_0x9d65('0xe')]())['then'](ami[_0x9d65('0x10')]())['then'](ami[_0x9d65('0x12')]())[_0x9d65('0x1c')](ami[_0x9d65('0x1d')]())[_0x9d65('0x1e')](function(_0x39112a){console['log'](_0x39112a);});});ami[_0x9d65('0x15')]('error',error);ami['once'](_0x9d65('0x1f'),close);module[_0x9d65('0x20')]=ami; \ No newline at end of file +var _0x2098=['info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','close','connect','shutdown','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','catch','once','exports','util','lodash','../../config/logger','ami','../../config/environment','asterisk','port','username','password','keepConnected','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','devicestatelist','actionSipPeerStatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels'];(function(_0x4ffaae,_0x1a9eb3){var _0x2078f6=function(_0x3571ab){while(--_0x3571ab){_0x4ffaae['push'](_0x4ffaae['shift']());}};_0x2078f6(++_0x1a9eb3);}(_0x2098,0x7e));var _0x8209=function(_0x272437,_0xd81a3b){_0x272437=_0x272437-0x0;var _0x4c0438=_0x2098[_0x272437];return _0x4c0438;};'use strict';var Manager=require('asterisk-manager');var BPromise=require('bluebird');var moment=require('moment');var util=require(_0x8209('0x0'));var _=require(_0x8209('0x1'));var logger=require(_0x8209('0x2'))(_0x8209('0x3'));var config=require(_0x8209('0x4'));var ami=new Manager(config[_0x8209('0x5')][_0x8209('0x6')],config[_0x8209('0x5')]['ip'],config[_0x8209('0x5')][_0x8209('0x7')],config[_0x8209('0x5')][_0x8209('0x8')],!![]);ami[_0x8209('0x9')]();ami[_0x8209('0xa')]=BPromise[_0x8209('0xb')](ami[_0x8209('0xc')]);function error(_0x3219a6){logger[_0x8209('0xd')](util[_0x8209('0xe')](_0x8209('0xf'),config['asterisk']['username'],config[_0x8209('0x5')]['ip'],config[_0x8209('0x5')][_0x8209('0x6')],util[_0x8209('0x10')](_0x3219a6,![],null)));}function close(){logger[_0x8209('0xd')](util['format'](_0x8209('0x11'),config[_0x8209('0x5')][_0x8209('0x7')],config[_0x8209('0x5')]['ip'],config['asterisk'][_0x8209('0x6')]));}ami[_0x8209('0x12')]=function(){return function(){return ami[_0x8209('0xa')]({'action':_0x8209('0x13')});};};ami['actionDeviceStateList']=function(){return function(){return ami['Action']({'action':_0x8209('0x14')});};};ami[_0x8209('0x15')]=function(){return function(){return ami[_0x8209('0xa')]({'action':'sippeerstatus'});};};ami[_0x8209('0x16')]=function(){return function(){return ami[_0x8209('0xa')]({'action':_0x8209('0x17')});};};ami[_0x8209('0x18')]=function(){return function(){return ami[_0x8209('0xa')]({'action':_0x8209('0x19')});};};function connect(_0x1b7679){logger[_0x8209('0x1a')](util[_0x8209('0xe')](_0x8209('0x1b'),config[_0x8209('0x5')][_0x8209('0x7')],config[_0x8209('0x5')]['ip'],config[_0x8209('0x5')][_0x8209('0x6')]));ami['once'](_0x8209('0xd'),error);ami['once'](_0x8209('0x1c'),close);}ami['on'](_0x8209('0x1d'),connect);ami['on'](_0x8209('0x1e'),function(_0xa7f91){logger[_0x8209('0x1a')](util[_0x8209('0xe')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0x8209('0x5')]['username'],config['asterisk']['ip'],config[_0x8209('0x5')][_0x8209('0x6')],util['inspect'](_0xa7f91,![],null)));});ami['on'](_0x8209('0x1f'),function(_0x1312fe){logger[_0x8209('0x1a')](util[_0x8209('0xe')](_0x8209('0x20'),config[_0x8209('0x5')][_0x8209('0x7')],config[_0x8209('0x5')]['ip'],config['asterisk'][_0x8209('0x6')]));return BPromise[_0x8209('0x21')]()[_0x8209('0x22')](ami[_0x8209('0x12')]())[_0x8209('0x22')](ami['actionDeviceStateList']())['then'](ami['actionSipPeerStatus']())['then'](ami['actionQueueSummary']())['then'](ami['actionCoreShowChannels']())[_0x8209('0x23')](function(_0x22ed8c){console['log'](_0x22ed8c);});});ami[_0x8209('0x24')](_0x8209('0xd'),error);ami[_0x8209('0x24')]('close',close);module[_0x8209('0x25')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 824949d..ae89ac0 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 _0xd8b0=['message','result','catch','exports','jayson/promise','bluebird','http','Request','then','debug','memberReport','error','rpc'];(function(_0x4f6586,_0x4ec6c6){var _0x27a0e8=function(_0x58f5d1){while(--_0x58f5d1){_0x4f6586['push'](_0x4f6586['shift']());}};_0x27a0e8(++_0x4ec6c6);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var jayson=require(_0x0d8b('0x0'));var BPromise=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('ami');var client=jayson['client'][_0x0d8b('0x2')]({'port':0x2329});client[_0x0d8b('0x3')]=function(_0x43bca1,_0x364286){return new BPromise(function(_0x8196ed,_0x577834){return client['request'](_0x43bca1,_0x364286)[_0x0d8b('0x4')](function(_0x227c63){logger[_0x0d8b('0x5')]('rpc',_0x0d8b('0x6'),_0x43bca1,_0x364286,_0x227c63);if(_0x227c63[_0x0d8b('0x7')]){logger['error'](_0x0d8b('0x8'),_0x0d8b('0x6'),_0x43bca1,_0x227c63[_0x0d8b('0x7')][_0x0d8b('0x9')],_0x364286);return _0x577834(_0x227c63[_0x0d8b('0x7')][_0x0d8b('0x9')]);}else{return _0x8196ed(_0x227c63[_0x0d8b('0xa')]);}})[_0x0d8b('0xb')](function(_0x48fa16){logger[_0x0d8b('0x7')]('rpc',_0x0d8b('0x6'),_0x43bca1,_0x48fa16,_0x364286);return _0x577834(_0x48fa16);});});};module[_0x0d8b('0xc')]=client; \ No newline at end of file +var _0xac4a=['ami','client','http','then','debug','memberReport','error','message','result','catch','rpc','jayson/promise','bluebird','../../config/logger'];(function(_0x491cbe,_0x45c8ba){var _0x59449d=function(_0x21b463){while(--_0x21b463){_0x491cbe['push'](_0x491cbe['shift']());}};_0x59449d(++_0x45c8ba);}(_0xac4a,0x13f));var _0xaac4=function(_0x5ad6cd,_0x5e6599){_0x5ad6cd=_0x5ad6cd-0x0;var _0x3e301b=_0xac4a[_0x5ad6cd];return _0x3e301b;};'use strict';var jayson=require(_0xaac4('0x0'));var BPromise=require(_0xaac4('0x1'));var logger=require(_0xaac4('0x2'))(_0xaac4('0x3'));var client=jayson[_0xaac4('0x4')][_0xaac4('0x5')]({'port':0x2329});client['Request']=function(_0x58626e,_0x2af0f6){return new BPromise(function(_0x2a5762,_0x32d34c){return client['request'](_0x58626e,_0x2af0f6)[_0xaac4('0x6')](function(_0x53d03a){logger[_0xaac4('0x7')]('rpc',_0xaac4('0x8'),_0x58626e,_0x2af0f6,_0x53d03a);if(_0x53d03a[_0xaac4('0x9')]){logger['error']('rpc',_0xaac4('0x8'),_0x58626e,_0x53d03a['error'][_0xaac4('0xa')],_0x2af0f6);return _0x32d34c(_0x53d03a['error']['message']);}else{return _0x2a5762(_0x53d03a[_0xaac4('0xb')]);}})[_0xaac4('0xc')](function(_0x38d1d0){logger[_0xaac4('0x9')](_0xaac4('0xd'),'memberReport',_0x58626e,_0x38d1d0,_0x2af0f6);return _0x32d34c(_0x38d1d0);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index d130d64..1623d08 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 _0xd044=['VoiceQueueId','CampaignId','idHopper','format','callback','callbackuniqueid','callbackat','recallme','prototype','getCaller','voiceQueue','dialCutDigit','substring','getQueue','exports','lodash','moment','isNil','string','name','Contact','firstName','lastName','number','phone','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId'];(function(_0x5c86ac,_0x3ae6d5){var _0x423538=function(_0x3042cc){while(--_0x3042cc){_0x5c86ac['push'](_0x5c86ac['shift']());}};_0x423538(++_0x3ae6d5);}(_0xd044,0x157));var _0x4d04=function(_0x51672a,_0x3b1a3d){_0x51672a=_0x51672a-0x0;var _0x3ee24a=_0xd044[_0x51672a];return _0x3ee24a;};'use strict';var util=require('util');var _=require(_0x4d04('0x0'));var moment=require(_0x4d04('0x1'));function checkNameSurname(_0xed0e0b,_0x51f7a5,_0x37cedb){var _0x411bff='';if(!_[_0x4d04('0x2')](_0x51f7a5)&&_0x4d04('0x3')===typeof _0x51f7a5){_0x411bff+=_0x51f7a5;}if(!_['isNil'](_0x37cedb)&&_0x4d04('0x3')===typeof _0x37cedb){_0x411bff+='\x20'+_0x37cedb;}if(_0x411bff!==''){return _0x411bff;}return _0xed0e0b;}function Action(_0x4338ea,_0x282144,_0x3b3405){this['voiceQueue']=_0x4338ea;this['uniqueid']=_0x3b3405||undefined;this[_0x4d04('0x4')]=checkNameSurname(_0x282144[_0x4d04('0x5')]['phone'],_0x282144['Contact'][_0x4d04('0x6')],_0x282144[_0x4d04('0x5')][_0x4d04('0x7')]);this[_0x4d04('0x8')]=_0x282144[_0x4d04('0x5')][_0x4d04('0x9')];this[_0x4d04('0xa')]=_0x4338ea[_0x4d04('0x4')];this['active']=_0x282144[_0x4d04('0xb')]||![];this[_0x4d04('0xc')]=_0x4338ea['type'];this['dialQueueTimeout']=_0x4338ea[_0x4d04('0xd')]||0x3;this[_0x4d04('0xe')]=_0x282144['scheduledat'];this['countbusyretry']=_0x282144[_0x4d04('0xf')];this[_0x4d04('0x10')]=_0x282144[_0x4d04('0x10')];this['countnoanswerretry']=_0x282144[_0x4d04('0x11')];this[_0x4d04('0x12')]=_0x282144[_0x4d04('0x12')];this[_0x4d04('0x13')]=_0x282144[_0x4d04('0x13')];this[_0x4d04('0x14')]=_0x282144[_0x4d04('0x14')];this[_0x4d04('0x15')]=_0x282144[_0x4d04('0x15')];this[_0x4d04('0x16')]=_0x282144[_0x4d04('0x16')];this[_0x4d04('0x17')]=_0x282144['ContactId'];this[_0x4d04('0x18')]=_0x282144[_0x4d04('0x18')];this[_0x4d04('0x19')]=_0x282144[_0x4d04('0x19')];this[_0x4d04('0x1a')]=_0x282144[_0x4d04('0x1a')];this[_0x4d04('0x1b')]=_0x282144[_0x4d04('0x1b')];this[_0x4d04('0x1c')]=_0x282144['id'];this['ContactFirstName']=_0x282144['Contact'][_0x4d04('0x6')]||'';this['starttime']=moment()[_0x4d04('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x4d04('0x1e')]=_0x282144['callback'];this[_0x4d04('0x1f')]=_0x282144['callbackuniqueid'];this['callbackat']=_0x282144[_0x4d04('0x20')];this[_0x4d04('0x21')]=_0x282144[_0x4d04('0x21')];this['originatecalleridnum']='';this['originatecalleridname']='';}Action[_0x4d04('0x22')][_0x4d04('0x23')]=function(){return util['format']('\x22%s\x22\x20<%s>',this[_0x4d04('0x4')],this[_0x4d04('0x24')][_0x4d04('0x25')]>0x0?this[_0x4d04('0x8')][_0x4d04('0x26')](this[_0x4d04('0x24')][_0x4d04('0x25')]):this[_0x4d04('0x8')]);};Action[_0x4d04('0x22')][_0x4d04('0x27')]=function(){return this[_0x4d04('0xa')];};module[_0x4d04('0x28')]=Action; \ No newline at end of file +var _0x3c7b=['recallme','originatecalleridnum','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','util','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','number','queue','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','callback','callbackuniqueid','callbackat'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x3c7b,0x183));var _0xb3c7=function(_0x45206e,_0x1d786d){_0x45206e=_0x45206e-0x0;var _0x12f285=_0x3c7b[_0x45206e];return _0x12f285;};'use strict';var util=require(_0xb3c7('0x0'));var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x180edb,_0x44a67f,_0x181460){var _0x5f4dd7='';if(!_[_0xb3c7('0x1')](_0x44a67f)&&_0xb3c7('0x2')===typeof _0x44a67f){_0x5f4dd7+=_0x44a67f;}if(!_[_0xb3c7('0x1')](_0x181460)&&_0xb3c7('0x2')===typeof _0x181460){_0x5f4dd7+='\x20'+_0x181460;}if(_0x5f4dd7!==''){return _0x5f4dd7;}return _0x180edb;}function Action(_0x4c6e4e,_0xb2c2b,_0x11a6dd){this[_0xb3c7('0x3')]=_0x4c6e4e;this[_0xb3c7('0x4')]=_0x11a6dd||undefined;this[_0xb3c7('0x5')]=checkNameSurname(_0xb2c2b[_0xb3c7('0x6')][_0xb3c7('0x7')],_0xb2c2b[_0xb3c7('0x6')][_0xb3c7('0x8')],_0xb2c2b[_0xb3c7('0x6')][_0xb3c7('0x9')]);this[_0xb3c7('0xa')]=_0xb2c2b[_0xb3c7('0x6')]['phone'];this[_0xb3c7('0xb')]=_0x4c6e4e[_0xb3c7('0x5')];this['active']=_0xb2c2b['active']||![];this['type']=_0x4c6e4e['type'];this[_0xb3c7('0xc')]=_0x4c6e4e[_0xb3c7('0xc')]||0x3;this[_0xb3c7('0xd')]=_0xb2c2b[_0xb3c7('0xd')];this[_0xb3c7('0xe')]=_0xb2c2b[_0xb3c7('0xe')];this[_0xb3c7('0xf')]=_0xb2c2b[_0xb3c7('0xf')];this['countnoanswerretry']=_0xb2c2b[_0xb3c7('0x10')];this['countnosuchnumberretry']=_0xb2c2b[_0xb3c7('0x11')];this[_0xb3c7('0x12')]=_0xb2c2b[_0xb3c7('0x12')];this['countabandonedretry']=_0xb2c2b['countabandonedretry'];this['countmachineretry']=_0xb2c2b[_0xb3c7('0x13')];this[_0xb3c7('0x14')]=_0xb2c2b[_0xb3c7('0x14')];this[_0xb3c7('0x15')]=_0xb2c2b[_0xb3c7('0x15')];this['ListId']=_0xb2c2b[_0xb3c7('0x16')];this['UserId']=_0xb2c2b[_0xb3c7('0x17')];this[_0xb3c7('0x18')]=_0xb2c2b[_0xb3c7('0x18')];this[_0xb3c7('0x19')]=_0xb2c2b[_0xb3c7('0x19')];this[_0xb3c7('0x1a')]=_0xb2c2b['id'];this[_0xb3c7('0x1b')]=_0xb2c2b[_0xb3c7('0x6')][_0xb3c7('0x8')]||'';this['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xb3c7('0x1c')]=_0xb2c2b[_0xb3c7('0x1c')];this[_0xb3c7('0x1d')]=_0xb2c2b[_0xb3c7('0x1d')];this['callbackat']=_0xb2c2b[_0xb3c7('0x1e')];this[_0xb3c7('0x1f')]=_0xb2c2b[_0xb3c7('0x1f')];this[_0xb3c7('0x20')]='';this['originatecalleridname']='';}Action[_0xb3c7('0x21')][_0xb3c7('0x22')]=function(){return util['format'](_0xb3c7('0x23'),this[_0xb3c7('0x5')],this[_0xb3c7('0x3')][_0xb3c7('0x24')]>0x0?this[_0xb3c7('0xa')][_0xb3c7('0x25')](this[_0xb3c7('0x3')][_0xb3c7('0x24')]):this[_0xb3c7('0xa')]);};Action[_0xb3c7('0x21')]['getQueue']=function(){return this[_0xb3c7('0xb')];};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index d3fc2ff..62aab6d 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 _0xa281=['countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum','number','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','starttime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','seconds','state','Answer','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0xa281,0x1e9));var _0x1a28=function(_0x2fd1e0,_0x1f0e57){_0x2fd1e0=_0x2fd1e0-0x0;var _0x3264c8=_0xa281[_0x2fd1e0];return _0x3264c8;};'use strict';var util=require(_0x1a28('0x0'));var _=require(_0x1a28('0x1'));var moment=require(_0x1a28('0x2'));function getSeconds(_0x53c77e,_0x369751){var _0x3c3aba=moment(_0x53c77e)[_0x1a28('0x3')](0x0);var _0x22affc=moment(_0x369751)[_0x1a28('0x3')](0x0);return _0x3c3aba[_0x1a28('0x4')](_0x22affc,_0x1a28('0x5'));}function AgentComplete(_0x241ab1,_0x12bdcc){this[_0x1a28('0x6')]=0x4;this['statedesc']=_0x1a28('0x7');this[_0x1a28('0x8')]=_0x241ab1['scheduledat'];this[_0x1a28('0x9')]=_0x241ab1[_0x1a28('0x9')];this[_0x1a28('0xa')]=_0x241ab1[_0x1a28('0x9')]==='outbound'?_0x1a28('0xb'):_0x241ab1[_0x1a28('0x9')];this[_0x1a28('0xc')]=_0x241ab1[_0x1a28('0xc')];this[_0x1a28('0xd')]=_0x241ab1['countcongestionretry'];this[_0x1a28('0xe')]=_0x241ab1[_0x1a28('0xe')];this[_0x1a28('0xf')]=_0x241ab1['countbusyretry']+_0x241ab1['countcongestionretry']+_0x241ab1[_0x1a28('0xe')]+_0x241ab1[_0x1a28('0x10')]+_0x241ab1[_0x1a28('0x11')]+_0x241ab1[_0x1a28('0x12')]+_0x241ab1[_0x1a28('0x13')]+_0x241ab1[_0x1a28('0x14')];this[_0x1a28('0x10')]=_0x241ab1[_0x1a28('0x10')];this[_0x1a28('0x11')]=_0x241ab1[_0x1a28('0x11')];this[_0x1a28('0x12')]=_0x241ab1['countabandonedretry'];this[_0x1a28('0x13')]=_0x241ab1[_0x1a28('0x13')];this[_0x1a28('0x14')]=_0x241ab1['countagentrejectretry'];this[_0x1a28('0x15')]=_0x12bdcc[_0x1a28('0x15')];this['calleridname']=_0x241ab1[_0x1a28('0x16')];this[_0x1a28('0x17')]=_0x241ab1[_0x1a28('0x18')];this['starttime']=_0x241ab1['starttime'];this[_0x1a28('0x19')]=_0x241ab1[_0x1a28('0x19')];this[_0x1a28('0x1a')]=_0x241ab1[_0x1a28('0x1a')];this[_0x1a28('0x1b')]=moment()['format'](_0x1a28('0x1c'));this[_0x1a28('0x1d')]=getSeconds(_0x241ab1['responsetime'],_0x241ab1[_0x1a28('0x1e')]);this[_0x1a28('0x1f')]=getSeconds(_0x241ab1[_0x1a28('0x1a')],_0x241ab1[_0x1a28('0x19')]);this[_0x1a28('0x20')]=getSeconds(this[_0x1a28('0x1b')],_0x241ab1[_0x1a28('0x1a')]);this[_0x1a28('0xb')]=_0x12bdcc['queue'];this[_0x1a28('0x21')]=_0x12bdcc[_0x1a28('0x21')];this[_0x1a28('0x22')]=_0x12bdcc[_0x1a28('0x22')];this[_0x1a28('0x23')]=_0x241ab1[_0x1a28('0x23')];this['callbackuniqueid']=_0x241ab1[_0x1a28('0x24')];this[_0x1a28('0x25')]=_0x241ab1[_0x1a28('0x25')];this['recallme']=_0x241ab1[_0x1a28('0x26')];this[_0x1a28('0x27')]=_0x241ab1[_0x1a28('0x27')];this[_0x1a28('0x28')]=_0x241ab1[_0x1a28('0x28')];this[_0x1a28('0x29')]=_0x241ab1[_0x1a28('0x29')];this['VoiceQueueId']=_0x241ab1[_0x1a28('0x2a')];this[_0x1a28('0x2b')]=_0x241ab1[_0x1a28('0x2b')];this[_0x1a28('0x2c')]=_0x241ab1[_0x1a28('0x2c')]||'';this[_0x1a28('0x2d')]=_0x241ab1[_0x1a28('0x2d')]||'';}module['exports']=AgentComplete; \ No newline at end of file +var _0x7cee=['originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','statedesc','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','ringtime','holdtime','talktime','membername','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0x26e312,_0x4c0fed){var _0x3d73ce=function(_0x41e646){while(--_0x41e646){_0x26e312['push'](_0x26e312['shift']());}};_0x3d73ce(++_0x4c0fed);}(_0x7cee,0x1a1));var _0xe7ce=function(_0x145b3c,_0x31ea4a){_0x145b3c=_0x145b3c-0x0;var _0x1b6e36=_0x7cee[_0x145b3c];return _0x1b6e36;};'use strict';var util=require(_0xe7ce('0x0'));var _=require(_0xe7ce('0x1'));var moment=require(_0xe7ce('0x2'));function getSeconds(_0x1f778b,_0x386096){var _0x9f2dbb=moment(_0x1f778b)['milliseconds'](0x0);var _0x511cbc=moment(_0x386096)[_0xe7ce('0x3')](0x0);return _0x9f2dbb[_0xe7ce('0x4')](_0x511cbc,_0xe7ce('0x5'));}function AgentComplete(_0x5dfc53,_0x5b9b71){this['state']=0x4;this[_0xe7ce('0x6')]='Answer';this[_0xe7ce('0x7')]=_0x5dfc53[_0xe7ce('0x7')];this['type']=_0x5dfc53[_0xe7ce('0x8')];this[_0xe7ce('0x9')]=_0x5dfc53[_0xe7ce('0x8')]==='outbound'?_0xe7ce('0xa'):_0x5dfc53[_0xe7ce('0x8')];this[_0xe7ce('0xb')]=_0x5dfc53[_0xe7ce('0xb')];this[_0xe7ce('0xc')]=_0x5dfc53[_0xe7ce('0xc')];this['countnoanswerretry']=_0x5dfc53[_0xe7ce('0xd')];this[_0xe7ce('0xe')]=_0x5dfc53[_0xe7ce('0xb')]+_0x5dfc53[_0xe7ce('0xc')]+_0x5dfc53['countnoanswerretry']+_0x5dfc53[_0xe7ce('0xf')]+_0x5dfc53[_0xe7ce('0x10')]+_0x5dfc53[_0xe7ce('0x11')]+_0x5dfc53[_0xe7ce('0x12')]+_0x5dfc53[_0xe7ce('0x13')];this[_0xe7ce('0xf')]=_0x5dfc53[_0xe7ce('0xf')];this[_0xe7ce('0x10')]=_0x5dfc53[_0xe7ce('0x10')];this['countabandonedretry']=_0x5dfc53['countabandonedretry'];this[_0xe7ce('0x12')]=_0x5dfc53[_0xe7ce('0x12')];this['countagentrejectretry']=_0x5dfc53[_0xe7ce('0x13')];this[_0xe7ce('0x14')]=_0x5b9b71[_0xe7ce('0x14')];this[_0xe7ce('0x15')]=_0x5dfc53[_0xe7ce('0x16')];this[_0xe7ce('0x17')]=_0x5dfc53[_0xe7ce('0x18')];this[_0xe7ce('0x19')]=_0x5dfc53[_0xe7ce('0x19')];this['responsetime']=_0x5dfc53[_0xe7ce('0x1a')];this[_0xe7ce('0x1b')]=_0x5dfc53[_0xe7ce('0x1b')];this[_0xe7ce('0x1c')]=moment()[_0xe7ce('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xe7ce('0x1e')]=getSeconds(_0x5dfc53[_0xe7ce('0x1a')],_0x5dfc53[_0xe7ce('0x19')]);this[_0xe7ce('0x1f')]=getSeconds(_0x5dfc53[_0xe7ce('0x1b')],_0x5dfc53[_0xe7ce('0x1a')]);this[_0xe7ce('0x20')]=getSeconds(this[_0xe7ce('0x1c')],_0x5dfc53[_0xe7ce('0x1b')]);this[_0xe7ce('0xa')]=_0x5b9b71['queue'];this['membername']=_0x5b9b71[_0xe7ce('0x21')];this['reason']=_0x5b9b71['reason'];this['callback']=_0x5dfc53[_0xe7ce('0x22')];this[_0xe7ce('0x23')]=_0x5dfc53[_0xe7ce('0x23')];this[_0xe7ce('0x24')]=_0x5dfc53[_0xe7ce('0x24')];this['recallme']=_0x5dfc53[_0xe7ce('0x25')];this[_0xe7ce('0x26')]=_0x5dfc53[_0xe7ce('0x26')];this[_0xe7ce('0x27')]=_0x5dfc53[_0xe7ce('0x27')];this['UserId']=_0x5dfc53[_0xe7ce('0x28')];this[_0xe7ce('0x29')]=_0x5dfc53[_0xe7ce('0x29')];this[_0xe7ce('0x2a')]=_0x5dfc53[_0xe7ce('0x2a')];this[_0xe7ce('0x2b')]=_0x5dfc53[_0xe7ce('0x2b')]||'';this[_0xe7ce('0x2c')]=_0x5dfc53[_0xe7ce('0x2c')]||'';}module[_0xe7ce('0x2d')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 58f75d8..dff3006 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 _0x723e=['diff','seconds','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countdropretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds'];(function(_0x46001b,_0x20d714){var _0x51e402=function(_0x21c5de){while(--_0x21c5de){_0x46001b['push'](_0x46001b['shift']());}};_0x51e402(++_0x20d714);}(_0x723e,0x179));var _0xe723=function(_0x18a855,_0xa5ce9c){_0x18a855=_0x18a855-0x0;var _0x10f40e=_0x723e[_0x18a855];return _0x10f40e;};'use strict';var util=require('util');var _=require(_0xe723('0x0'));var moment=require(_0xe723('0x1'));function getSeconds(_0x21d00c,_0x161d6b){var _0x2801c5=moment(_0x21d00c)[_0xe723('0x2')](0x0);var _0x39e35c=moment(_0x161d6b)[_0xe723('0x2')](0x0);return _0x2801c5[_0xe723('0x3')](_0x39e35c,_0xe723('0x4'));}function Final(_0x4b1c43){this[_0xe723('0x5')]=_0x4b1c43[_0xe723('0x5')];this[_0xe723('0x6')]=_0x4b1c43[_0xe723('0x6')];this[_0xe723('0x7')]=_0x4b1c43[_0xe723('0x7')];this[_0xe723('0x8')]=_0x4b1c43[_0xe723('0x7')]==='outbound'?_0xe723('0x9'):_0x4b1c43[_0xe723('0x7')];this[_0xe723('0xa')]=_0x4b1c43['countbusyretry'];this[_0xe723('0xb')]=_0x4b1c43[_0xe723('0xb')];this[_0xe723('0xc')]=_0x4b1c43['countnoanswerretry'];this[_0xe723('0xd')]=_0x4b1c43[_0xe723('0xa')]+_0x4b1c43[_0xe723('0xb')]+_0x4b1c43[_0xe723('0xc')]+_0x4b1c43[_0xe723('0xe')]+_0x4b1c43['countdropretry']+_0x4b1c43[_0xe723('0xf')]+_0x4b1c43['countmachineretry']+_0x4b1c43['countagentrejectretry'];this['countnosuchnumberretry']=_0x4b1c43['countnosuchnumberretry'];this[_0xe723('0x10')]=_0x4b1c43[_0xe723('0x10')];this[_0xe723('0xf')]=_0x4b1c43[_0xe723('0xf')];this[_0xe723('0x11')]=_0x4b1c43['countmachineretry'];this[_0xe723('0x12')]=_0x4b1c43[_0xe723('0x12')];this[_0xe723('0x9')]=_0x4b1c43[_0xe723('0x9')];this[_0xe723('0x13')]=_0x4b1c43[_0xe723('0x13')];this[_0xe723('0x14')]=_0x4b1c43[_0xe723('0x14')];this[_0xe723('0x15')]=_0x4b1c43[_0xe723('0x15')];this[_0xe723('0x16')]=_0x4b1c43[_0xe723('0x16')];this[_0xe723('0x17')]=_0x4b1c43[_0xe723('0x16')];this['ringtime']=_0x4b1c43['ringtime']||0x0;this[_0xe723('0x18')]=_0x4b1c43[_0xe723('0x18')]||0x0;this['talktime']=_0x4b1c43[_0xe723('0x19')]||0x0;this[_0xe723('0x1a')]=_0x4b1c43['callback'];this[_0xe723('0x1b')]=_0x4b1c43['callbackuniqueid'];this[_0xe723('0x1c')]=_0x4b1c43[_0xe723('0x1c')];this[_0xe723('0x1d')]=_0x4b1c43[_0xe723('0x1d')];this[_0xe723('0x1e')]=_0x4b1c43[_0xe723('0x1e')];this[_0xe723('0x1f')]=_0x4b1c43[_0xe723('0x1f')];this[_0xe723('0x20')]=_0x4b1c43[_0xe723('0x20')];this[_0xe723('0x21')]=_0x4b1c43[_0xe723('0x21')];this['CampaignId']=_0x4b1c43[_0xe723('0x22')];this['originatecalleridnum']=_0x4b1c43[_0xe723('0x23')]||'';this[_0xe723('0x24')]=_0x4b1c43[_0xe723('0x24')]||'';}module[_0xe723('0x25')]=Final; \ No newline at end of file +var _0x106f=['scheduledat','type','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry','queue','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','seconds','uniqueid'];(function(_0x1b38ad,_0x5c1196){var _0x17bb1e=function(_0x252bcf){while(--_0x252bcf){_0x1b38ad['push'](_0x1b38ad['shift']());}};_0x17bb1e(++_0x5c1196);}(_0x106f,0x162));var _0xf106=function(_0x528ae6,_0x2d752d){_0x528ae6=_0x528ae6-0x0;var _0x1b22f7=_0x106f[_0x528ae6];return _0x1b22f7;};'use strict';var util=require(_0xf106('0x0'));var _=require(_0xf106('0x1'));var moment=require('moment');function getSeconds(_0x4014dd,_0x6d8236){var _0x59bc3a=moment(_0x4014dd)[_0xf106('0x2')](0x0);var _0x4ab04f=moment(_0x6d8236)[_0xf106('0x2')](0x0);return _0x59bc3a[_0xf106('0x3')](_0x4ab04f,_0xf106('0x4'));}function Final(_0x318376){this[_0xf106('0x5')]=_0x318376[_0xf106('0x5')];this[_0xf106('0x6')]=_0x318376['scheduledat'];this[_0xf106('0x7')]=_0x318376[_0xf106('0x7')];this['campaigntype']=_0x318376['type']==='outbound'?'queue':_0x318376['type'];this[_0xf106('0x8')]=_0x318376[_0xf106('0x8')];this[_0xf106('0x9')]=_0x318376[_0xf106('0x9')];this[_0xf106('0xa')]=_0x318376[_0xf106('0xa')];this[_0xf106('0xb')]=_0x318376[_0xf106('0x8')]+_0x318376[_0xf106('0x9')]+_0x318376[_0xf106('0xa')]+_0x318376[_0xf106('0xc')]+_0x318376['countdropretry']+_0x318376[_0xf106('0xd')]+_0x318376[_0xf106('0xe')]+_0x318376['countagentrejectretry'];this['countnosuchnumberretry']=_0x318376[_0xf106('0xc')];this[_0xf106('0xf')]=_0x318376[_0xf106('0xf')];this['countabandonedretry']=_0x318376[_0xf106('0xd')];this[_0xf106('0xe')]=_0x318376[_0xf106('0xe')];this['countagentrejectretry']=_0x318376[_0xf106('0x10')];this[_0xf106('0x11')]=_0x318376['queue'];this[_0xf106('0x12')]=_0x318376[_0xf106('0x12')];this[_0xf106('0x13')]=_0x318376['calleridnum'];this['starttime']=_0x318376[_0xf106('0x14')];this[_0xf106('0x15')]=_0x318376[_0xf106('0x15')];this['endtime']=_0x318376[_0xf106('0x15')];this[_0xf106('0x16')]=_0x318376[_0xf106('0x16')]||0x0;this[_0xf106('0x17')]=_0x318376[_0xf106('0x17')]||0x0;this[_0xf106('0x18')]=_0x318376[_0xf106('0x18')]||0x0;this[_0xf106('0x19')]=_0x318376[_0xf106('0x19')];this['callbackuniqueid']=_0x318376['callbackuniqueid'];this[_0xf106('0x1a')]=_0x318376['callbackat'];this[_0xf106('0x1b')]=_0x318376[_0xf106('0x1b')];this[_0xf106('0x1c')]=_0x318376[_0xf106('0x1c')];this[_0xf106('0x1d')]=_0x318376['ListId'];this['UserId']=_0x318376[_0xf106('0x1e')];this[_0xf106('0x1f')]=_0x318376[_0xf106('0x1f')];this[_0xf106('0x20')]=_0x318376[_0xf106('0x20')];this[_0xf106('0x21')]=_0x318376[_0xf106('0x21')]||'';this[_0xf106('0x22')]=_0x318376[_0xf106('0x22')]||'';}module[_0xf106('0x23')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 3eba610..31888b6 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 _0xa596=['util','lodash','moment','milliseconds','diff','seconds','statedesc','scheduledat','type','campaigntype','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countdropretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','countmachineretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','YYYY-MM-DD\x20HH:mm:ss','holdtime','talktime','endtime','membername','IVR','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId'];(function(_0xb99bad,_0x9deb2d){var _0x41a6a2=function(_0xa24cbb){while(--_0xa24cbb){_0xb99bad['push'](_0xb99bad['shift']());}};_0x41a6a2(++_0x9deb2d);}(_0xa596,0x150));var _0x6a59=function(_0x32ebe2,_0x4a81bb){_0x32ebe2=_0x32ebe2-0x0;var _0x3bf825=_0xa596[_0x32ebe2];return _0x3bf825;};'use strict';var util=require(_0x6a59('0x0'));var _=require(_0x6a59('0x1'));var moment=require(_0x6a59('0x2'));function getSeconds(_0x34f602,_0x329166){var _0x251397=moment(_0x34f602)[_0x6a59('0x3')](0x0);var _0x51697d=moment(_0x329166)[_0x6a59('0x3')](0x0);return _0x251397[_0x6a59('0x4')](_0x51697d,_0x6a59('0x5'));}function Hangup(_0x4e4d86,_0x11d762){this['state']=0x4;this[_0x6a59('0x6')]='Answer';this[_0x6a59('0x7')]=_0x4e4d86[_0x6a59('0x7')];this[_0x6a59('0x8')]=_0x4e4d86['type'];this[_0x6a59('0x9')]=_0x4e4d86['type']===_0x6a59('0xa')?_0x6a59('0xb'):_0x4e4d86[_0x6a59('0x8')];this['countbusyretry']=_0x4e4d86['countbusyretry'];this[_0x6a59('0xc')]=_0x4e4d86[_0x6a59('0xc')];this[_0x6a59('0xd')]=_0x4e4d86[_0x6a59('0xd')];this[_0x6a59('0xe')]=_0x4e4d86[_0x6a59('0xf')]+_0x4e4d86[_0x6a59('0xc')]+_0x4e4d86[_0x6a59('0xd')]+_0x4e4d86['countnosuchnumberretry']+_0x4e4d86[_0x6a59('0x10')]+_0x4e4d86['countabandonedretry']+_0x4e4d86['countmachineretry']+_0x4e4d86[_0x6a59('0x11')];this[_0x6a59('0x12')]=_0x4e4d86['countnosuchnumberretry'];this[_0x6a59('0x10')]=_0x4e4d86['countdropretry'];this[_0x6a59('0x13')]=_0x4e4d86['countabandonedretry'];this[_0x6a59('0x14')]=_0x4e4d86[_0x6a59('0x14')];this[_0x6a59('0x11')]=_0x4e4d86[_0x6a59('0x11')];this[_0x6a59('0x15')]=_0x11d762[_0x6a59('0x15')];this[_0x6a59('0x16')]=_0x4e4d86['name'];this[_0x6a59('0x17')]=_0x4e4d86[_0x6a59('0x18')];this[_0x6a59('0x19')]=_0x4e4d86[_0x6a59('0x19')];this['responsetime']=_0x4e4d86[_0x6a59('0x1a')];this['endtime']=moment()['format'](_0x6a59('0x1b'));this['ringtime']=getSeconds(_0x4e4d86[_0x6a59('0x1a')],_0x4e4d86['starttime']);this[_0x6a59('0x1c')]=0x0;this[_0x6a59('0x1d')]=getSeconds(this[_0x6a59('0x1e')],_0x4e4d86['responsetime']);this[_0x6a59('0xb')]=_0x4e4d86[_0x6a59('0xb')];this[_0x6a59('0x1f')]=_0x6a59('0x20');this[_0x6a59('0x21')]=_0x11d762['cause-txt'];this[_0x6a59('0x22')]=_0x4e4d86[_0x6a59('0x22')];this[_0x6a59('0x23')]=_0x4e4d86[_0x6a59('0x23')];this[_0x6a59('0x24')]=_0x4e4d86[_0x6a59('0x24')];this['recallme']=_0x4e4d86[_0x6a59('0x25')];this[_0x6a59('0x26')]=_0x4e4d86[_0x6a59('0x26')];this['ListId']=_0x4e4d86['ListId'];this['UserId']=_0x4e4d86[_0x6a59('0x27')];this[_0x6a59('0x28')]=_0x4e4d86[_0x6a59('0x28')];this[_0x6a59('0x29')]=_0x4e4d86[_0x6a59('0x29')];}module['exports']=Hangup; \ No newline at end of file +var _0x7e20=['calleridname','name','calleridnum','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','queue','IVR','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','exports','lodash','moment','milliseconds','diff','Answer','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','uniqueid'];(function(_0x3a35eb,_0x29fa51){var _0x4da7d7=function(_0x1464b8){while(--_0x1464b8){_0x3a35eb['push'](_0x3a35eb['shift']());}};_0x4da7d7(++_0x29fa51);}(_0x7e20,0x167));var _0x07e2=function(_0x93701a,_0x41eecb){_0x93701a=_0x93701a-0x0;var _0x55f2e1=_0x7e20[_0x93701a];return _0x55f2e1;};'use strict';var util=require('util');var _=require(_0x07e2('0x0'));var moment=require(_0x07e2('0x1'));function getSeconds(_0x4b55cd,_0x1feab3){var _0x57f6e5=moment(_0x4b55cd)[_0x07e2('0x2')](0x0);var _0x45a539=moment(_0x1feab3)[_0x07e2('0x2')](0x0);return _0x57f6e5[_0x07e2('0x3')](_0x45a539,'seconds');}function Hangup(_0x5eda16,_0x3d8250){this['state']=0x4;this['statedesc']=_0x07e2('0x4');this[_0x07e2('0x5')]=_0x5eda16[_0x07e2('0x5')];this[_0x07e2('0x6')]=_0x5eda16[_0x07e2('0x6')];this[_0x07e2('0x7')]=_0x5eda16[_0x07e2('0x6')]===_0x07e2('0x8')?'queue':_0x5eda16['type'];this[_0x07e2('0x9')]=_0x5eda16[_0x07e2('0x9')];this['countcongestionretry']=_0x5eda16[_0x07e2('0xa')];this['countnoanswerretry']=_0x5eda16['countnoanswerretry'];this[_0x07e2('0xb')]=_0x5eda16[_0x07e2('0x9')]+_0x5eda16[_0x07e2('0xa')]+_0x5eda16[_0x07e2('0xc')]+_0x5eda16[_0x07e2('0xd')]+_0x5eda16['countdropretry']+_0x5eda16['countabandonedretry']+_0x5eda16[_0x07e2('0xe')]+_0x5eda16[_0x07e2('0xf')];this[_0x07e2('0xd')]=_0x5eda16['countnosuchnumberretry'];this[_0x07e2('0x10')]=_0x5eda16[_0x07e2('0x10')];this[_0x07e2('0x11')]=_0x5eda16[_0x07e2('0x11')];this[_0x07e2('0xe')]=_0x5eda16[_0x07e2('0xe')];this[_0x07e2('0xf')]=_0x5eda16[_0x07e2('0xf')];this[_0x07e2('0x12')]=_0x3d8250['uniqueid'];this[_0x07e2('0x13')]=_0x5eda16[_0x07e2('0x14')];this[_0x07e2('0x15')]=_0x5eda16['number'];this['starttime']=_0x5eda16[_0x07e2('0x16')];this[_0x07e2('0x17')]=_0x5eda16[_0x07e2('0x17')];this[_0x07e2('0x18')]=moment()[_0x07e2('0x19')](_0x07e2('0x1a'));this[_0x07e2('0x1b')]=getSeconds(_0x5eda16['responsetime'],_0x5eda16[_0x07e2('0x16')]);this[_0x07e2('0x1c')]=0x0;this[_0x07e2('0x1d')]=getSeconds(this[_0x07e2('0x18')],_0x5eda16[_0x07e2('0x17')]);this[_0x07e2('0x1e')]=_0x5eda16[_0x07e2('0x1e')];this['membername']=_0x07e2('0x1f');this[_0x07e2('0x20')]=_0x3d8250['cause-txt'];this[_0x07e2('0x21')]=_0x5eda16[_0x07e2('0x21')];this['callbackuniqueid']=_0x5eda16[_0x07e2('0x22')];this['callbackat']=_0x5eda16[_0x07e2('0x23')];this['recallme']=_0x5eda16[_0x07e2('0x24')];this[_0x07e2('0x25')]=_0x5eda16[_0x07e2('0x25')];this['ListId']=_0x5eda16['ListId'];this[_0x07e2('0x26')]=_0x5eda16['UserId'];this[_0x07e2('0x27')]=_0x5eda16[_0x07e2('0x27')];this[_0x07e2('0x28')]=_0x5eda16[_0x07e2('0x28')];}module[_0x07e2('0x29')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index e99180b..ddf084d 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 _0xe960=['number','starttime','responsetime','endtime','ringtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum'];(function(_0x5050eb,_0x5cbd73){var _0xdcba78=function(_0x11c2e4){while(--_0x11c2e4){_0x5050eb['push'](_0x5050eb['shift']());}};_0xdcba78(++_0x5cbd73);}(_0xe960,0x1ca));var _0x0e96=function(_0x14cb4e,_0x4c9875){_0x14cb4e=_0x14cb4e-0x0;var _0x579cb4=_0xe960[_0x14cb4e];return _0x579cb4;};'use strict';var util=require(_0x0e96('0x0'));var _=require('lodash');var moment=require(_0x0e96('0x1'));function getSeconds(_0x45d4e2,_0x520417){var _0x26dc0b=moment(_0x45d4e2)['milliseconds'](0x0);var _0x40e4d6=moment(_0x520417)[_0x0e96('0x2')](0x0);return _0x26dc0b[_0x0e96('0x3')](_0x40e4d6,_0x0e96('0x4'));}function History(_0x596f4e){this[_0x0e96('0x5')]=_0x596f4e[_0x0e96('0x5')];this[_0x0e96('0x6')]=_0x596f4e[_0x0e96('0x6')]||undefined;this[_0x0e96('0x7')]=_0x596f4e['type'];this['campaigntype']=_0x596f4e[_0x0e96('0x7')]===_0x0e96('0x8')?_0x0e96('0x9'):_0x596f4e['type'];this['countbusyretry']=_0x596f4e[_0x0e96('0xa')];this[_0x0e96('0xb')]=_0x596f4e[_0x0e96('0xb')];this[_0x0e96('0xc')]=_0x596f4e[_0x0e96('0xc')];this[_0x0e96('0xd')]=_0x596f4e[_0x0e96('0xa')]+_0x596f4e['countcongestionretry']+_0x596f4e[_0x0e96('0xc')]+_0x596f4e[_0x0e96('0xe')]+_0x596f4e[_0x0e96('0xf')]+_0x596f4e[_0x0e96('0x10')]+_0x596f4e[_0x0e96('0x11')]+_0x596f4e[_0x0e96('0x12')];this[_0x0e96('0xe')]=_0x596f4e['countnosuchnumberretry'];this['countdropretry']=_0x596f4e[_0x0e96('0xf')];this[_0x0e96('0x10')]=_0x596f4e[_0x0e96('0x10')];this[_0x0e96('0x11')]=_0x596f4e[_0x0e96('0x11')];this['countagentrejectretry']=_0x596f4e['countagentrejectretry'];this[_0x0e96('0x9')]=_0x596f4e[_0x0e96('0x9')];this[_0x0e96('0x13')]=_0x596f4e[_0x0e96('0x14')];this[_0x0e96('0x15')]=_0x596f4e[_0x0e96('0x16')];this[_0x0e96('0x17')]=_0x596f4e[_0x0e96('0x17')];this[_0x0e96('0x18')]=_0x596f4e['responsetime'];this[_0x0e96('0x19')]=_0x596f4e[_0x0e96('0x18')];this[_0x0e96('0x1a')]=getSeconds(_0x596f4e['responsetime'],_0x596f4e[_0x0e96('0x17')]);this['holdtime']=0x0;this[_0x0e96('0x1b')]=0x0;this['callback']=_0x596f4e[_0x0e96('0x1c')];this[_0x0e96('0x1d')]=_0x596f4e[_0x0e96('0x1d')];this['callbackat']=_0x596f4e[_0x0e96('0x1e')];this[_0x0e96('0x1f')]=_0x596f4e[_0x0e96('0x1f')];this['ContactId']=_0x596f4e[_0x0e96('0x20')];this[_0x0e96('0x21')]=_0x596f4e[_0x0e96('0x21')];this['UserId']=_0x596f4e[_0x0e96('0x22')];this[_0x0e96('0x23')]=_0x596f4e[_0x0e96('0x23')];this[_0x0e96('0x24')]=_0x596f4e[_0x0e96('0x24')];this['originatecalleridnum']=_0x596f4e[_0x0e96('0x25')]||'';this[_0x0e96('0x26')]=_0x596f4e['originatecalleridname']||'';}module[_0x0e96('0x27')]=History; \ No newline at end of file +var _0x3e59=['countagentrejectretry','countnosuchnumberretry','countmachineretry','number','starttime','responsetime','endtime','ringtime','talktime','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x3e59,0xec));var _0x93e5=function(_0x38037a,_0x196abc){_0x38037a=_0x38037a-0x0;var _0x1a1246=_0x3e59[_0x38037a];return _0x1a1246;};'use strict';var util=require(_0x93e5('0x0'));var _=require('lodash');var moment=require(_0x93e5('0x1'));function getSeconds(_0x4ff060,_0x4d56ba){var _0x3ed98a=moment(_0x4ff060)[_0x93e5('0x2')](0x0);var _0x41ca33=moment(_0x4d56ba)[_0x93e5('0x2')](0x0);return _0x3ed98a[_0x93e5('0x3')](_0x41ca33,_0x93e5('0x4'));}function History(_0x571e48){this[_0x93e5('0x5')]=_0x571e48[_0x93e5('0x5')];this[_0x93e5('0x6')]=_0x571e48[_0x93e5('0x6')]||undefined;this['type']=_0x571e48[_0x93e5('0x7')];this[_0x93e5('0x8')]=_0x571e48['type']===_0x93e5('0x9')?_0x93e5('0xa'):_0x571e48[_0x93e5('0x7')];this[_0x93e5('0xb')]=_0x571e48[_0x93e5('0xb')];this[_0x93e5('0xc')]=_0x571e48[_0x93e5('0xc')];this[_0x93e5('0xd')]=_0x571e48[_0x93e5('0xd')];this[_0x93e5('0xe')]=_0x571e48['countbusyretry']+_0x571e48[_0x93e5('0xc')]+_0x571e48['countnoanswerretry']+_0x571e48['countnosuchnumberretry']+_0x571e48['countdropretry']+_0x571e48[_0x93e5('0xf')]+_0x571e48['countmachineretry']+_0x571e48[_0x93e5('0x10')];this[_0x93e5('0x11')]=_0x571e48[_0x93e5('0x11')];this['countdropretry']=_0x571e48['countdropretry'];this['countabandonedretry']=_0x571e48[_0x93e5('0xf')];this[_0x93e5('0x12')]=_0x571e48[_0x93e5('0x12')];this[_0x93e5('0x10')]=_0x571e48['countagentrejectretry'];this['queue']=_0x571e48[_0x93e5('0xa')];this['calleridname']=_0x571e48['name'];this['calleridnum']=_0x571e48[_0x93e5('0x13')];this[_0x93e5('0x14')]=_0x571e48[_0x93e5('0x14')];this[_0x93e5('0x15')]=_0x571e48['responsetime'];this[_0x93e5('0x16')]=_0x571e48['responsetime'];this[_0x93e5('0x17')]=getSeconds(_0x571e48[_0x93e5('0x15')],_0x571e48[_0x93e5('0x14')]);this['holdtime']=0x0;this[_0x93e5('0x18')]=0x0;this[_0x93e5('0x19')]=_0x571e48[_0x93e5('0x19')];this['callbackuniqueid']=_0x571e48[_0x93e5('0x1a')];this['callbackat']=_0x571e48['callbackat'];this[_0x93e5('0x1b')]=_0x571e48[_0x93e5('0x1b')];this['ContactId']=_0x571e48[_0x93e5('0x1c')];this[_0x93e5('0x1d')]=_0x571e48[_0x93e5('0x1d')];this['UserId']=_0x571e48[_0x93e5('0x1e')];this[_0x93e5('0x1f')]=_0x571e48['VoiceQueueId'];this[_0x93e5('0x20')]=_0x571e48[_0x93e5('0x20')];this['originatecalleridnum']=_0x571e48[_0x93e5('0x21')]||'';this[_0x93e5('0x22')]=_0x571e48[_0x93e5('0x22')]||'';}module[_0x93e5('0x23')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 81d8928..7c647d9 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 _0x6f7a=['predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangBusyFactor','Trunk','callerid','format','voice_queue:save','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','ivr','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','length','originated','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','[getContactDialer2][ReScheduled]','contacts','[getContactDialer2][Empty]','sendMessageOneNotActive','talking','available','NOT_ACTIVE','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','endtime','starttime','[uniqueid]','clearZombieChannels','[actions]','enqueue','status','channel','No\x20such\x20channel','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','catch','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','updateOriginated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','pick','ContactId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','active','SIP/%s','reachable','unmonitored','isNil','xcally-motion-dialer','dialAMDActive','value','uniqueid','statedesc','HangupInAMD','membername','AMD','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','add','minutes','ListId','[rescheduleContact][Machine]','HANGUP','countglobal','countnosuchnumberretry','countagentrejectretry','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','YYYY-MM-DD\x20HH:mm:ss','ivrAnswerCallsDay','[syncHangupIvr]','dialQueueProject','AnswerAGI','[syncHangupIvr][createHistory]','cause-txt','Unknow','reason','agent','agiafterat','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','Drop','dropreason','TIMEOUT','dialDropMaxRetry','calleridnum','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actionid','roundrobin','paused','stateinterface','locked','queueBooked','push','[unlockQueueStatus][undefined]','queueStatusComplete','[booked][unlockQueueStatus]','run','idHopper','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','ifTime','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','Failure','\x20Intervals\x20is\x20empty\x20','TIMEZONE_UNKNOW','isArray','command','timezones','content','indexOf','true','Action','iftime\x20%s,%s','all','some','GLOBAL_INTERVAL_IS_OVERTIME','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','launchHandleIvr','dialGlobalInterval','dialTimezone','checkDialMethod','[syncQueueSummary]','\x5cw{0,','pow','replace','random','actionOriginate','object','Contact','originate','getCaller','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','ACTIVE','dialAMDInitialSilence','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDTOTALANALYSISTIME','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','phone','substring','dialCutDigit','trim','from-sip','[originateError]:\x20%s','[originate][error]','originate\x20action\x20Error','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropRetryFrequency','[rescheduleContact][Drop]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','[syncAgentComplete][createHistory][0]','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','floor','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','Agent','unlockContact','outboundReCallsDay','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','handleIvr','[getContactCampaign2][Empty]','RUNNING','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','dialOrderByScheduledAt','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[getContactDialerPredictive]','abandonmentRate','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','[busyFactor]','Ts\x20=\x20','Umin\x20=\x20','exports','util','lodash','bluebird','uuid','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','syncQueueSummary','../ami','redis','defaults','../rpc/cmHopper','../rpc/cmHopperBlack','./action','./history','./final','./agentComplete','./hangup','XCALLY_IP_AGI','127.0.0.1','rrmemory','prototype','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','startPredictive','startProgressive','agentconnect','syncAgentConnect','bind','originateresponse','syncOriginateResponse','syncAgentComplete','hangup','syncHangup','newexten','syncNewExten','syncVarSet','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','name','\x20AGENTS\x20NOT\x20LOGGED','\x20NOT\x20Active','Interval','\x20INTERVAL_IS_NULL','Intervals','INTERVAL_IS_NULL','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','emit','type','outbound','strategy','answered','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls'];(function(_0x7caee1,_0x40dc30){var _0x4d26af=function(_0x479a34){while(--_0x479a34){_0x7caee1['push'](_0x7caee1['shift']());}};_0x4d26af(++_0x40dc30);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x4a7196,_0x1ff12d){_0x4a7196=_0x4a7196-0x0;var _0x4fd31a=_0x6f7a[_0x4a7196];return _0x4fd31a;};'use strict';var util=require(_0xa6f7('0x0'));var _=require(_0xa6f7('0x1'));var BPromise=require(_0xa6f7('0x2'));var uuid=require(_0xa6f7('0x3'));var moment=require('moment');var rr=require('rr');var md5=require(_0xa6f7('0x4'));var Redis=require(_0xa6f7('0x5'));var ut=require(_0xa6f7('0x6'));var config=require(_0xa6f7('0x7'));var logger=require(_0xa6f7('0x8'))(_0xa6f7('0x9'));var loggerBooked=require(_0xa6f7('0x8'))(_0xa6f7('0xa'));var loggerPredictive=require(_0xa6f7('0x8'))(_0xa6f7('0xb'));var loggerPredictiveCalls=require(_0xa6f7('0x8'))('predictiveCalls');var loggerSyncQueueSummary=require('../../../config/logger')(_0xa6f7('0xc'));var ami=require(_0xa6f7('0xd'));config[_0xa6f7('0xe')]=_[_0xa6f7('0xf')](config[_0xa6f7('0xe')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa6f7('0xe')]));var cmHopper=require(_0xa6f7('0x10'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0xa6f7('0x11'));var voiceQueueRt=require('../rpc/voiceQueueRt');var Action=require(_0xa6f7('0x12'));var History=require(_0xa6f7('0x13'));var Final=require(_0xa6f7('0x14'));var AgentComplete=require(_0xa6f7('0x15'));var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require(_0xa6f7('0x16'));var ipAgi=process['env'][_0xa6f7('0x17')]||_0xa6f7('0x18');var strategy={'rrmemory':_0xa6f7('0x19'),'roundrobin':'roundrobin'};var Sequence=function(){};Sequence[_0xa6f7('0x1a')]['enqueue']=function(_0x41bc4d){this['tail']=this[_0xa6f7('0x1b')]?this[_0xa6f7('0x1b')][_0xa6f7('0x1c')](_0x41bc4d):_0x41bc4d();};function Dialer(_0x47e664,_0xdb37e2){this[_0xa6f7('0x1d')]=new Sequence();this[_0xa6f7('0x1e')]=_0xdb37e2;this[_0xa6f7('0x1f')]=_0x47e664['voiceQueues'];this['campaigns']=_0x47e664[_0xa6f7('0x20')];this['agents']=_0x47e664[_0xa6f7('0x21')];this[_0xa6f7('0x22')]=_0x47e664['trunks'];this[_0xa6f7('0x23')]=config[_0xa6f7('0x23')]||0x2;this[_0xa6f7('0x24')]={};this[_0xa6f7('0x25')]={};this[_0xa6f7('0x26')]={};this[_0xa6f7('0x27')]={};this['optionPredictive']={};this[_0xa6f7('0x28')]={};this[_0xa6f7('0x29')]={};this['ivrOriginated']={};this['queueBooked']={};this['queueBookedRR']={};ami['on'](_0xa6f7('0x2a'),this[_0xa6f7('0x2b')]['bind'](this));ami['on']('queuecallerabandon',this['syncQueueCallerAbandon'][_0xa6f7('0x2c')](this));ami['on'](_0xa6f7('0x2d'),this[_0xa6f7('0x2e')]['bind'](this));ami['on']('agentcomplete',this[_0xa6f7('0x2f')]['bind'](this));ami['on']('custom:queuesummary',this[_0xa6f7('0xc')]['bind'](this));ami['on'](_0xa6f7('0x30'),this[_0xa6f7('0x31')][_0xa6f7('0x2c')](this));ami['on'](_0xa6f7('0x32'),this[_0xa6f7('0x33')]['bind'](this));ami['on']('varset',this[_0xa6f7('0x34')][_0xa6f7('0x2c')](this));ami['on']('queuemember',this[_0xa6f7('0x35')][_0xa6f7('0x2c')](this));ami['on'](_0xa6f7('0x36'),this[_0xa6f7('0x37')][_0xa6f7('0x2c')](this));this[_0xa6f7('0x38')]();this[_0xa6f7('0x39')]();}function isNotNull(_0x54f72c){return _0x54f72c!==null&&!_[_0xa6f7('0x3a')](_0x54f72c);}function checkIsLoggedIn(_0x3dee2e,_0x40b0f8){return function(){if(_0x40b0f8<=0x0){_0x3dee2e[_0xa6f7('0x3b')]='AGENTS_NOT_LOGGED';throw _0x3dee2e[_0xa6f7('0x3c')]+_0xa6f7('0x3d');}};}function isActive(_0x5bf8e3){return _0x5bf8e3;}function checkIsActive(_0xd6304f,_0x34d571){return function(){if(!isActive(_0x34d571)){_0xd6304f['message']='NOT_ACTIVE';throw _0xd6304f[_0xa6f7('0x3c')]+_0xa6f7('0x3e');}};}function checkInterval(_0x2b33d){return function(){if(!isNotNull(_0x2b33d[_0xa6f7('0x3f')])){_0x2b33d[_0xa6f7('0x3b')]='INTERVAL_IS_NULL';throw _0x2b33d['name']+_0xa6f7('0x40');}if(!isNotNull(_0x2b33d['Interval'][_0xa6f7('0x41')])){_0x2b33d[_0xa6f7('0x3b')]=_0xa6f7('0x42');throw _0x2b33d[_0xa6f7('0x3c')]+_0xa6f7('0x40');}if(!isNotNull(_[_0xa6f7('0x43')](_0x2b33d['Interval'][_0xa6f7('0x41')]))){_0x2b33d[_0xa6f7('0x3b')]=_0xa6f7('0x42');throw _0x2b33d['name']+_0xa6f7('0x40');}};}function msgResponse(_0x5ab03d,_0x1170c4,_0x2f5632){return{'action':_0x5ab03d,'response':_0x1170c4,'message':_0x2f5632,'stack':_0x2f5632};}function myreject(_0x45837c){return function(_0x4ccbd3){return _0x45837c(msgResponse(_0xa6f7('0x44'),_0xa6f7('0x45'),JSON[_0xa6f7('0x46')](_0x4ccbd3)));};}function getSeconds(_0x37b833,_0x14444c){var _0x28490e=moment(_0x37b833)['milliseconds'](0x0);var _0xc33ec8=moment(_0x14444c)[_0xa6f7('0x47')](0x0);return _0x28490e[_0xa6f7('0x48')](_0xc33ec8,_0xa6f7('0x49'));}function emit(_0x18d18c,_0x56a773,_0x45acdd){io['to'](_0x18d18c)[_0xa6f7('0x4a')](_0x56a773,_0x45acdd);}function emitVoiceQueueSummary(_0x4c2d2e){if(_0x4c2d2e[_0xa6f7('0x4b')]===_0xa6f7('0x4c')){var _0x353e54={'id':_0x4c2d2e['id'],'name':_0x4c2d2e['name'],'strategy':_0x4c2d2e[_0xa6f7('0x4d')],'answered':_0x4c2d2e[_0xa6f7('0x4e')],'available':_0x4c2d2e['available'],'loggedIn':_0x4c2d2e[_0xa6f7('0x4f')],'pTalking':_0x4c2d2e[_0xa6f7('0x50')],'sumBillable':_0x4c2d2e[_0xa6f7('0x51')],'sumDuration':_0x4c2d2e[_0xa6f7('0x52')],'sumHoldTime':_0x4c2d2e[_0xa6f7('0x53')]||0x0,'talking':_0x4c2d2e['talking'],'total':_0x4c2d2e[_0xa6f7('0x54')],'type':_0x4c2d2e[_0xa6f7('0x4b')],'unmanaged':_0x4c2d2e[_0xa6f7('0x55')],'abandoned':_0x4c2d2e[_0xa6f7('0x56')],'waiting':_0x4c2d2e[_0xa6f7('0x57')],'loggedInDb':_0x4c2d2e[_0xa6f7('0x58')],'dialActive':_0x4c2d2e[_0xa6f7('0x59')],'dialMethod':_0x4c2d2e[_0xa6f7('0x5a')],'dialOriginateCallerIdName':_0x4c2d2e['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x4c2d2e['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x4c2d2e[_0xa6f7('0x5b')],'dialPrefix':_0x4c2d2e[_0xa6f7('0x5c')],'outboundAnswerAgiCallsDay':_0x4c2d2e[_0xa6f7('0x5d')],'outboundAnswerCallsDay':_0x4c2d2e[_0xa6f7('0x5e')],'outboundBlacklistCallsDay':_0x4c2d2e[_0xa6f7('0x5f')],'outboundBusyCallsDay':_0x4c2d2e[_0xa6f7('0x60')],'outboundCongestionCallsDay':_0x4c2d2e[_0xa6f7('0x61')],'outboundDropCallsDayACS':_0x4c2d2e[_0xa6f7('0x62')],'outboundDropCallsDayCallersExit':_0x4c2d2e[_0xa6f7('0x63')],'outboundDropCallsDayTimeout':_0x4c2d2e[_0xa6f7('0x64')],'outboundNoAnswerCallsDay':_0x4c2d2e['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x4c2d2e[_0xa6f7('0x65')],'outboundOriginateFailureCallsDay':_0x4c2d2e[_0xa6f7('0x66')],'outboundReCallsDay':_0x4c2d2e['outboundReCallsDay'],'outboundRejectCallsDay':_0x4c2d2e[_0xa6f7('0x67')],'outboundUnknownCallsDay':_0x4c2d2e[_0xa6f7('0x68')],'predictiveIntervalAnsweredCalls':_0x4c2d2e[_0xa6f7('0x69')],'predictiveIntervalAvgHoldtime':_0x4c2d2e[_0xa6f7('0x6a')],'predictiveIntervalAvgTalktime':_0x4c2d2e['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x4c2d2e[_0xa6f7('0x6b')],'predictiveIntervalDroppedCallsTimeout':_0x4c2d2e['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x4c2d2e['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x4c2d2e[_0xa6f7('0x6c')],'predictiveIntervalHitRate':_0x4c2d2e[_0xa6f7('0x6d')],'predictiveIntervalMultiplicativeFactor':_0x4c2d2e[_0xa6f7('0x6e')],'predictiveIntervalPauses':_0x4c2d2e[_0xa6f7('0x6f')],'predictiveIntervalAvailable':_0x4c2d2e[_0xa6f7('0x70')],'predictiveIntervalTotalCalls':_0x4c2d2e[_0xa6f7('0x71')],'message':_0x4c2d2e[_0xa6f7('0x3b')],'originated':_0x4c2d2e['originated'],'erlangCalls':_0x4c2d2e[_0xa6f7('0x72')],'erlangCallToSecond':_0x4c2d2e[_0xa6f7('0x73')],'erlangAbandonmentRate':_0x4c2d2e['erlangAbandonmentRate'],'erlangBusyFactor':_0x4c2d2e[_0xa6f7('0x74')],'startPredictive':_0x4c2d2e[_0xa6f7('0x28')],'startProgressive':_0x4c2d2e[_0xa6f7('0x29')]};if(_0x4c2d2e['Trunk']){_0x353e54[_0xa6f7('0x75')]={'id':_0x4c2d2e['Trunk']['id'],'name':_0x4c2d2e[_0xa6f7('0x75')][_0xa6f7('0x3c')],'active':_0x4c2d2e[_0xa6f7('0x75')]['active'],'callerid':_0x4c2d2e['Trunk'][_0xa6f7('0x76')]};}if(_0x4c2d2e['Interval']){_0x353e54[_0xa6f7('0x3f')]={'id':_0x4c2d2e['Interval']['id'],'name':_0x4c2d2e['Interval'][_0xa6f7('0x3c')]};}var _0x2e3a04=md5(JSON[_0xa6f7('0x46')](_0x353e54));if(_0x4c2d2e[_0xa6f7('0x4')]!==_0x2e3a04){_0x4c2d2e[_0xa6f7('0x4')]=_0x2e3a04;emit(util[_0xa6f7('0x77')]('voice:queue:%s',_0x353e54[_0xa6f7('0x3c')]),_0xa6f7('0x78'),_0x353e54);}}}function emitCampaignSummary(_0x58080f){if(_0x58080f[_0xa6f7('0x4b')]==='ivr'){emit(util[_0xa6f7('0x77')]('campaign:ivr:%s',_0x58080f['name']),_0xa6f7('0x79'),_0x58080f);}}function checkGetDataPredictive(_0x158af5){if(isNotNull(_0x158af5)&&!_[_0xa6f7('0x43')](_0x158af5)){loggerPredictive[_0xa6f7('0x7a')](_0xa6f7('0x7b'));loggerPredictive['info'](_0xa6f7('0x7c'),_0x158af5[_0xa6f7('0x71')]);loggerPredictive['info'](_0xa6f7('0x7d'),_0x158af5['predictiveIntervalAnsweredCalls']);loggerPredictive[_0xa6f7('0x7a')](_0xa6f7('0x7e'),_0x158af5[_0xa6f7('0x7f')]);loggerPredictive['info'](_0xa6f7('0x80'),_0x158af5['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0xa6f7('0x7a')](_0xa6f7('0x81'),_0x158af5[_0xa6f7('0x6a')]);loggerPredictive[_0xa6f7('0x7a')](_0xa6f7('0x82'),_0x158af5['predictiveIntervalAvgTalktime']);loggerPredictive['info'](_0xa6f7('0x83'));if(_0x158af5[_0xa6f7('0x71')]>0x0){if(!_[_0xa6f7('0x3a')](_0x158af5[_0xa6f7('0x84')])&&_0x158af5['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0xa6f7('0x7a')](_0xa6f7('0x85'));if(!_[_0xa6f7('0x3a')](_0x158af5[_0xa6f7('0x6a')])&&_0x158af5[_0xa6f7('0x6a')]>0x0){return!![];}loggerPredictive[_0xa6f7('0x7a')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0xa6f7('0x7a')](_0xa6f7('0x86'));}}else{loggerPredictive[_0xa6f7('0x7a')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0xb049d7){return function(_0x16a2a4){loggerPredictive[_0xa6f7('0x7a')](_0xa6f7('0x87'));loggerPredictive['info']('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x16a2a4[_0xa6f7('0x72')]);loggerPredictive[_0xa6f7('0x7a')](_0xa6f7('0x88'),_0x16a2a4[_0xa6f7('0x73')]);loggerPredictive[_0xa6f7('0x7a')](_0xa6f7('0x89'),_0x16a2a4[_0xa6f7('0x8a')]);loggerPredictive['info'](_0xa6f7('0x8b'),_0x16a2a4[_0xa6f7('0x74')]);loggerPredictive[_0xa6f7('0x7a')](_0xa6f7('0x89'),_0x16a2a4[_0xa6f7('0x8a')]);loggerPredictive[_0xa6f7('0x7a')](_0xa6f7('0x83'));_[_0xa6f7('0x8c')](_0xb049d7,_0x16a2a4);};}function getDiff(_0x444177){var _0x186956=moment()[_0xa6f7('0x47')](0x0);var _0x5719fb=moment(_0x444177)[_0xa6f7('0x47')](0x0);return _0x186956['diff'](_0x5719fb,_0xa6f7('0x49'));}function ifInterval(_0x47a2b1,_0x3a5522){if(_[_0xa6f7('0x3a')](_0x3a5522)){return![];}return getDiff(_0x3a5522)<_0x47a2b1*0x3c;}function freeVariablesPredictive(_0x5a158f){if(isNotNull(_0x5a158f)){if(!_[_0xa6f7('0x3a')](_0x5a158f[_0xa6f7('0x29')])){_0x5a158f[_0xa6f7('0x29')]=undefined;loggerPredictive['info'](_0x5a158f[_0xa6f7('0x3c')],'clearing\x20variable\x20start\x20progressive');}if(!_[_0xa6f7('0x3a')](_0x5a158f[_0xa6f7('0x28')])){_0x5a158f['startPredictive']=undefined;loggerPredictive[_0xa6f7('0x7a')](_0x5a158f['name'],_0xa6f7('0x8d'));}if(!_['isUndefined'](_0x5a158f[_0xa6f7('0x8e')])){clearInterval(_0x5a158f[_0xa6f7('0x8e')]);_0x5a158f[_0xa6f7('0x8e')]=undefined;loggerPredictive[_0xa6f7('0x7a')](_0x5a158f[_0xa6f7('0x3c')],_0xa6f7('0x8f'));}}}function erlangb(_0xfded94,_0x2ebb08){if(_0x2ebb08===0x0){return 0x0;}var _0x153635=0x1;for(var _0x16ef40=0x1;_0x16ef40<=_0x2ebb08;_0x16ef40+=0x1){_0x153635=0x1+_0x153635*_0x16ef40/_0xfded94;}return 0x1/_0x153635;}function isVoiceQueueOutbound(_0x110ea5){return _0x110ea5===_0xa6f7('0x4c');}function isNotPreview(_0x4b0434){return _0x4b0434!==_0xa6f7('0x1e');}function isCampaignIvr(_0x3c0c6e){return _0x3c0c6e===_0xa6f7('0x90');}function getCallerId(_0x466bb6,_0x154c78,_0x3a464e){if(!_[_0xa6f7('0x3a')](_0x3a464e)&&typeof _0x3a464e===_0xa6f7('0x91')&&!_['isEmpty'](_0x3a464e)){if(!_[_0xa6f7('0x3a')](_0x154c78)&&typeof _0x154c78===_0xa6f7('0x91')&&!_[_0xa6f7('0x43')](_0x154c78)){return util['format'](_0xa6f7('0x92'),_0x154c78,_0x3a464e);}return util[_0xa6f7('0x77')](_0xa6f7('0x92'),_0x3a464e,_0x3a464e);}if(!_[_0xa6f7('0x3a')](_0x466bb6)&&typeof _0x466bb6===_0xa6f7('0x91')&&!_[_0xa6f7('0x43')](_0x466bb6)){return _0x466bb6;}return _0xa6f7('0x93');}function loggerCatchQueueSummary(_0x1f69e4,_0x4c1af7){return function(_0x55d245){freeVariablesPredictive(_0x4c1af7);emitVoiceQueueSummary(_0x4c1af7);emitCampaignSummary(_0x4c1af7);loggerSyncQueueSummary[_0xa6f7('0x94')](_0x1f69e4,util[_0xa6f7('0x95')](_0x55d245,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x5e6d94,_0x3aa759){return function(_0x18ff29){loggerPredictive[_0xa6f7('0x94')](_0x3aa759['name'],_0x5e6d94);loggerPredictive[_0xa6f7('0x94')](_0x18ff29['stack']);freeVariablesPredictive(_0x3aa759);};}function loggerCatch(_0x4f156e){return function(_0x59ed13){logger['error'](_0x4f156e,util['inspect'](_0x59ed13,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x39ba3d){return _0x39ba3d&&!_[_0xa6f7('0x3a')](_0x39ba3d)&&_0x39ba3d[_0xa6f7('0x96')]>0x0;}function decremetOriginate(_0x5f00a7){if(!_[_0xa6f7('0x3a')](_0x5f00a7)&&_0x5f00a7!==null){if(typeof _0x5f00a7[_0xa6f7('0x97')]!==_0xa6f7('0x98')){if(_0x5f00a7[_0xa6f7('0x97')]>0x0){_0x5f00a7[_0xa6f7('0x97')]-=0x1;}else{logger[_0xa6f7('0x94')](_0xa6f7('0x99'));}}}else{logger[_0xa6f7('0x94')](_0xa6f7('0x9a'));}}function checkContactLowerLimitOriginate(_0x2a73ae,_0x55ad6b,_0x1103ff){if(_0x55ad6b>_0x1103ff){for(var _0x2d23cf=0x0;_0x2d23cf<_0x55ad6b-_0x1103ff;_0x2d23cf+=0x1){decremetOriginate(_0x2a73ae);}}}function loggerGetContactDialer(_0x2ba30f,_0x380b79,_0x1637d3){return function(_0x39e8a8){checkContactLowerLimitOriginate(_0x380b79,_0x1637d3,0x0);logger[_0xa6f7('0x94')](_0x2ba30f,util[_0xa6f7('0x95')](_0x39e8a8,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x14133e){return function(_0x26435d){if(isNotNull(_0x26435d)&&isNotNull(_0x26435d[0x0])){if(_0x26435d[0x0][_0xa6f7('0x9b')]>0x0){_0x14133e['message']='RESCHEDULED_CONTACTS';logger[_0xa6f7('0x7a')](_0xa6f7('0x9c')+_0x14133e[_0xa6f7('0x3c')],_0x26435d[0x0]['contactsRescheduled'],_0xa6f7('0x9d'));}else{_0x14133e[_0xa6f7('0x3b')]='AVAILABLE_CONTACTS_FINISHED';logger[_0xa6f7('0x7a')](_0xa6f7('0x9e')+_0x14133e['name']);}}};}function notSendMessagesQueue(_0x52dcd9){if(_0x52dcd9[_0xa6f7('0x9f')]){freeVariablesPredictive(_0x52dcd9);if(_0x52dcd9['originated']===0x0&&_0x52dcd9[_0xa6f7('0xa0')]===0x0&&_0x52dcd9[_0xa6f7('0x57')]===0x0&&(_0x52dcd9['pTalking']||0x0)===0x0){_0x52dcd9['sendMessageOneNotActive']=![];_0x52dcd9[_0xa6f7('0xa1')]=0x0;_0x52dcd9[_0xa6f7('0x3b')]=_0xa6f7('0xa2');loggerSyncQueueSummary['error'](_0xa6f7('0xa3'),_0x52dcd9[_0xa6f7('0x3c')],_0xa6f7('0xa4'));}else{_0x52dcd9[_0xa6f7('0x3b')]=_0xa6f7('0xa5');loggerSyncQueueSummary[_0xa6f7('0x94')](_0xa6f7('0xa3'),_0x52dcd9[_0xa6f7('0x3c')],_0xa6f7('0xa6'));}emitVoiceQueueSummary(_0x52dcd9);}}function notSendMessagesCampaign(_0x1f4f19){if(_0x1f4f19[_0xa6f7('0x9f')]){if(_0x1f4f19['originated']===0x0){_0x1f4f19[_0xa6f7('0x9f')]=![];_0x1f4f19[_0xa6f7('0x3b')]=_0xa6f7('0xa2');loggerSyncQueueSummary[_0xa6f7('0x94')](_0xa6f7('0xa7'),_0x1f4f19[_0xa6f7('0x3c')],'is\x20not\x20active');}else{_0x1f4f19[_0xa6f7('0x3b')]=_0xa6f7('0xa5');loggerSyncQueueSummary[_0xa6f7('0x94')](_0xa6f7('0xa7'),_0x1f4f19[_0xa6f7('0x3c')],_0xa6f7('0xa6'));}emitCampaignSummary(_0x1f4f19);}}function createObjHistory(_0x54c4e6,_0x5d5894,_0x7ff027,_0x373ae3,_0x3ae028){_0x54c4e6[_0xa6f7('0x3b')]=_0x7ff027;var _0x12d120=new Action(_0x54c4e6,_0x5d5894);var _0x4b4009=new History(_0x12d120);_0x4b4009[_0xa6f7('0xa8')]=_0x373ae3;_0x4b4009['statedesc']=_0x3ae028;_0x4b4009[_0xa6f7('0xa9')]=_0x12d120[_0xa6f7('0xaa')];return _0x4b4009;}Dialer['prototype']['loopClearZombieChannels']=function(){var _0x24c1f7=this;setInterval(function(){_0x24c1f7['clearZombieChannels'](_0x24c1f7['uniqueId'],_0xa6f7('0xab'));_0x24c1f7[_0xa6f7('0xac')](_0x24c1f7[_0xa6f7('0x25')],_0xa6f7('0xad'));},0x32c8);};Dialer['prototype'][_0xa6f7('0xac')]=function(_0xd2a739,_0x74eb68){var _0x143a3a=this;for(var _0x21cc6b in _0xd2a739){if(typeof _0xd2a739[_0x21cc6b]!==_0xa6f7('0x98')){this['sequence'][_0xa6f7('0xae')](function(){if(!_['isNil'](_0xd2a739[_0x21cc6b])){return ami['Action']({'action':_0xa6f7('0xaf'),'channel':_0xd2a739[_0x21cc6b][_0xa6f7('0xb0')]})['catch'](function(_0x46a8bd){if(_0x46a8bd[_0xa6f7('0x3b')]===_0xa6f7('0xb1')){setTimeout(function(){if(_0xd2a739[_0x21cc6b]&&_0xd2a739[_0x21cc6b]['type']!==_0xa6f7('0x90')){_0x143a3a['updateOriginated'](_0x143a3a[_0xa6f7('0x1f')][_0xd2a739[_0x21cc6b][_0xa6f7('0xb2')]]);logger['error'](_0xa6f7('0xb3'),_0x74eb68,_0x21cc6b,_0xd2a739[_0x21cc6b]['queue']);delete _0xd2a739[_0x21cc6b];}if(_0xd2a739[_0x21cc6b]&&_0xd2a739[_0x21cc6b][_0xa6f7('0x4b')]===_0xa6f7('0x90')){_0x143a3a['updateOriginated'](_0x143a3a[_0xa6f7('0x20')][_0xd2a739[_0x21cc6b][_0xa6f7('0xb2')]]);logger[_0xa6f7('0x94')](_0xa6f7('0xb4'),_0x74eb68,_0x21cc6b,_0xd2a739[_0x21cc6b][_0xa6f7('0xb2')]);delete _0xd2a739[_0x21cc6b];}},0x2328);}});}});}}};Dialer['prototype'][_0xa6f7('0xb5')]=function(_0x37b898){return BPromise[_0xa6f7('0xb6')]()[_0xa6f7('0xb7')](cmHopper['countReScheduled'](_0x37b898))[_0xa6f7('0xb8')](loggerCatch(_0xa6f7('0xb9')));};Dialer[_0xa6f7('0x1a')][_0xa6f7('0xba')]=function(_0x4362d8){return BPromise[_0xa6f7('0xb6')]()[_0xa6f7('0xb7')](cmHopperBlack[_0xa6f7('0xba')](_0x4362d8))['catch'](loggerCatch(_0xa6f7('0xbb')));};Dialer[_0xa6f7('0x1a')]['checkIsBlackListIvr']=function(_0x23c56c){return BPromise['resolve']()[_0xa6f7('0xb7')](cmHopperBlack[_0xa6f7('0xbc')](_0x23c56c))[_0xa6f7('0xb8')](loggerCatch(_0xa6f7('0xbd')));};Dialer[_0xa6f7('0x1a')][_0xa6f7('0xbe')]=function(_0x278ac6){return BPromise[_0xa6f7('0xb6')]()['then'](cmHopperHistory['avgHandleTime'](_0x278ac6))[_0xa6f7('0xb8')](loggerCatch(_0xa6f7('0xbf')));};Dialer[_0xa6f7('0x1a')][_0xa6f7('0xc0')]=function(_0x5c4e41){return BPromise[_0xa6f7('0xb6')]()[_0xa6f7('0xb7')](cmHopper['rescheduleContact'](_0x5c4e41))['catch'](loggerCatch(_0xa6f7('0xc1')));};Dialer[_0xa6f7('0x1a')]['unlockContact']=function(_0x57e8f8,_0x461df5,_0x2309e0){return BPromise['resolve']()[_0xa6f7('0xb7')](cmHopper['unlockContact'](_0x57e8f8,_0x461df5,_0x2309e0))[_0xa6f7('0xb8')](loggerCatch(_0xa6f7('0xc2')));};Dialer['prototype'][_0xa6f7('0xc3')]=function(_0x262c5c,_0x4dfaea,_0x1fb9db,_0xf518ad,_0x380412){return BPromise['resolve']()[_0xa6f7('0xb7')](cmHopper[_0xa6f7('0xc3')](_0x262c5c,_0x4dfaea,_0x1fb9db,_0xf518ad))[_0xa6f7('0xb8')](function(_0x333a85){_0x380412['temp']-=_0x1fb9db;_0x380412[_0xa6f7('0xc4')]=_0x380412[_0xa6f7('0xc4')]>0x0?_0x380412[_0xa6f7('0xc4')]:0x0;loggerCatch(_0xa6f7('0xc5'))(_0x333a85);});};Dialer[_0xa6f7('0x1a')][_0xa6f7('0xc6')]=function(_0x29b0be,_0x826172,_0x34ad42,_0x77b874){return BPromise[_0xa6f7('0xb6')]()[_0xa6f7('0xb7')](cmHopper[_0xa6f7('0xc6')](_0x29b0be,_0x826172,_0x34ad42))[_0xa6f7('0xb8')](function(_0x40df2f){_0x77b874[_0xa6f7('0xc4')]-=_0x826172;_0x77b874[_0xa6f7('0xc4')]=_0x77b874[_0xa6f7('0xc4')]>0x0?_0x77b874[_0xa6f7('0xc4')]:0x0;loggerCatch(_0xa6f7('0xc7'))(_0x40df2f);});};Dialer[_0xa6f7('0x1a')][_0xa6f7('0xc8')]=function(_0x51c125){return BPromise[_0xa6f7('0xb6')]()[_0xa6f7('0xb7')](voiceQueueRt[_0xa6f7('0xc8')](_0x51c125))['catch'](loggerCatch(_0xa6f7('0xc9')));};Dialer[_0xa6f7('0x1a')][_0xa6f7('0xca')]=function(_0x41ec8d){return BPromise[_0xa6f7('0xb6')]()['then'](cmHopper[_0xa6f7('0xca')](_0x41ec8d))[_0xa6f7('0xb8')](loggerCatch(_0xa6f7('0xcb')));};Dialer[_0xa6f7('0x1a')]['createHistory']=function(_0x424f4f){return BPromise['resolve']()['then'](cmHopperHistory[_0xa6f7('0xcc')](_0x424f4f))[_0xa6f7('0xb8')](loggerCatch('[createHistory]\x20'));};Dialer[_0xa6f7('0x1a')][_0xa6f7('0xcd')]=function(_0x19f7f7){if(!_['isUndefined'](_0x19f7f7)&&_0x19f7f7!==null){if(typeof _0x19f7f7['originated']!==_0xa6f7('0x98')){if(_0x19f7f7['originated']>0x0){_0x19f7f7[_0xa6f7('0x97')]-=0x1;}else{logger[_0xa6f7('0x94')](_0xa6f7('0xce'));}}}else{logger[_0xa6f7('0x94')](_0xa6f7('0xcf'));}};Dialer[_0xa6f7('0x1a')][_0xa6f7('0xd0')]=function(_0x33047c,_0x2e89d9){var _0x3a40ff=this;return function(_0x5afef2){_0x3a40ff[_0xa6f7('0xcd')](_0x2e89d9);logger[_0xa6f7('0x94')](_0x33047c,util[_0xa6f7('0x95')](_0x5afef2,{'showHidden':![],'depth':null}));};};Dialer[_0xa6f7('0x1a')][_0xa6f7('0xd1')]=function(_0x4d4d9e,_0x10f80b,_0x850df1){var _0xe5e3c2={'state':0x19,'statedesc':_0xa6f7('0xd2')};this['updateOriginated'](_0x10f80b);this[_0xa6f7('0xd3')](_[_0xa6f7('0x8c')](_0xe5e3c2,_[_0xa6f7('0xd4')](_0x850df1,[_0xa6f7('0xd5'),'ListId',_0xa6f7('0xd6'),_0xa6f7('0xd7'),_0xa6f7('0xd8')])),_0xa6f7('0xd9'),_0xa6f7('0xda'));logger[_0xa6f7('0x94')](_0x4d4d9e);};Dialer[_0xa6f7('0x1a')][_0xa6f7('0xdb')]=function(_0x672fce){return _0x672fce===_0xa6f7('0xdc');};Dialer[_0xa6f7('0x1a')][_0xa6f7('0xdd')]=function(_0x36b646){return!_['isUndefined'](_0x36b646)&&_0x36b646&&!_[_0xa6f7('0x3a')](_0x36b646[_0xa6f7('0x3c')])&&!_[_0xa6f7('0x3a')](_0x36b646[_0xa6f7('0xde')])&&_0x36b646['active']&&(this[_0xa6f7('0x22')][util[_0xa6f7('0x77')](_0xa6f7('0xdf'),_0x36b646[_0xa6f7('0x3c')])]['status']===_0xa6f7('0xe0')||this[_0xa6f7('0x22')][util['format'](_0xa6f7('0xdf'),_0x36b646[_0xa6f7('0x3c')])][_0xa6f7('0xaf')]===_0xa6f7('0xe1'));};Dialer[_0xa6f7('0x1a')][_0xa6f7('0xd3')]=function(_0x5506cb,_0x1cf014,_0x5a6e0a){this[_0xa6f7('0xcc')](_0x5506cb)[_0xa6f7('0xb8')](loggerCatch(_0x1cf014));this[_0xa6f7('0xca')](_0x5506cb)['catch'](loggerCatch(_0x5a6e0a));};Dialer[_0xa6f7('0x1a')][_0xa6f7('0x34')]=function(_0x4299f9){var _0x227c68=this['uniqueId'][_0x4299f9['uniqueid']];var _0x3f2aed;if(!_[_0xa6f7('0xe2')](_0x4299f9)&&!_[_0xa6f7('0xe2')](_0x4299f9['variable'])&&!_[_0xa6f7('0xe2')](_0x4299f9['variable']['amdstatus'])&&_0x4299f9['exten']===_0xa6f7('0xe3')&&_0x227c68){if(_0x227c68[_0xa6f7('0x4b')]!==_0xa6f7('0x90')&&this[_0xa6f7('0x1f')][_0x227c68['queue']][_0xa6f7('0xe4')]&&_0x4299f9[_0xa6f7('0xe5')]==='HANGUP'){delete this[_0xa6f7('0x27')][_0x4299f9[_0xa6f7('0xe6')]];this[_0xa6f7('0xcd')](this[_0xa6f7('0x1f')][_0x227c68[_0xa6f7('0xb2')]]);this[_0xa6f7('0x1f')][_0x227c68[_0xa6f7('0xb2')]][_0xa6f7('0x5e')]+=0x1;this['voiceQueues'][_0x227c68['queue']][_0xa6f7('0x5d')]+=0x1;_0x3f2aed=new Hangup(_0x227c68,_0x4299f9);_0x3f2aed[_0xa6f7('0xa8')]=0x12;_0x3f2aed[_0xa6f7('0xe7')]=_0xa6f7('0xe8');_0x3f2aed[_0xa6f7('0xe9')]=_0xa6f7('0xea');ami[_0xa6f7('0x4a')](_0xa6f7('0xeb'),ut[_0xa6f7('0xec')](_0x3f2aed,_0xa6f7('0xed')));this[_0xa6f7('0xd3')](_0x3f2aed,_0xa6f7('0xee'),_0xa6f7('0xef'));}if(_0x227c68[_0xa6f7('0x4b')]!=='ivr'&&this[_0xa6f7('0x1f')][_0x227c68['queue']][_0xa6f7('0xe4')]&&_0x4299f9[_0xa6f7('0xe5')]===_0xa6f7('0xf0')){var _0x32e44f=this;return new BPromise(function(_0x235b12,_0x2a4e42){delete _0x32e44f['uniqueId'][_0x4299f9[_0xa6f7('0xe6')]];_0x32e44f[_0xa6f7('0xcd')](_0x32e44f[_0xa6f7('0x1f')][_0x227c68['queue']]);_0x32e44f[_0xa6f7('0x1f')][_0x227c68['queue']][_0xa6f7('0x5e')]+=0x1;_0x32e44f[_0xa6f7('0x1f')][_0x227c68['queue']]['outboundAnswerAgiCallsDay']+=0x1;var _0x5cdf85=_0x32e44f[_0xa6f7('0x1f')][_0x227c68[_0xa6f7('0xb2')]];var _0x48328d=new Hangup(_0x227c68,_0x4299f9);_0x48328d['state']=0x13;_0x48328d[_0xa6f7('0xe7')]=_0xa6f7('0xf1');_0x48328d['membername']=_0xa6f7('0xea');_0x48328d[_0xa6f7('0xf2')]+=0x1;_0x48328d['countglobal']+=0x1;_0x48328d[_0xa6f7('0xed')]=!![];ami[_0xa6f7('0x4a')](_0xa6f7('0xeb'),ut[_0xa6f7('0xec')](_0x48328d,_0xa6f7('0xed')));_0x32e44f['createHistory'](_0x48328d)[_0xa6f7('0xb8')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x48328d[_0xa6f7('0xf3')]+_0x48328d[_0xa6f7('0xf4')]+_0x48328d[_0xa6f7('0xf5')]+_0x48328d['countnosuchnumberretry']+_0x48328d[_0xa6f7('0xf6')]+_0x48328d[_0xa6f7('0xf7')]+_0x48328d[_0xa6f7('0xf2')]+_0x48328d['countagentrejectretry']>=_0x5cdf85[_0xa6f7('0xf8')]){_0x32e44f[_0xa6f7('0xf9')](_0x48328d,_0x235b12,_0x2a4e42,_0xa6f7('0xfa'));}else{if(_0x48328d[_0xa6f7('0xf2')]>=_0x5cdf85['dialMachineMaxRetry']){_0x32e44f['createStateFinal'](_0x48328d,_0x235b12,_0x2a4e42,'reason\x2019\x20machine....');}else{_0x32e44f[_0xa6f7('0xc0')]({'active':![],'countmachineretry':_0x48328d[_0xa6f7('0xf2')],'scheduledat':moment()[_0xa6f7('0xfb')](_0x5cdf85['dialMachineRetryFrequency'],_0xa6f7('0xfc'))[_0xa6f7('0x77')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x48328d['ContactId'],'ListId':_0x48328d[_0xa6f7('0xfd')],'VoiceQueueId':_0x48328d['VoiceQueueId']||undefined,'CampaignId':_0x48328d['CampaignId']||undefined})[_0xa6f7('0xb8')](loggerCatch(_0xa6f7('0xfe')));_0x235b12({'reschedule':0x1});}}});}if(_0x227c68[_0xa6f7('0x4b')]===_0xa6f7('0x90')&&this['campaigns'][_0x227c68[_0xa6f7('0xb2')]][_0xa6f7('0xe4')]&&_0x4299f9[_0xa6f7('0xe5')]===_0xa6f7('0xff')){delete this['uniqueId'][_0x4299f9['uniqueid']];this[_0xa6f7('0xcd')](this['campaigns'][_0x227c68[_0xa6f7('0xb2')]]);_0x3f2aed=new Hangup(_0x227c68,_0x4299f9);_0x3f2aed[_0xa6f7('0xa8')]=0x12;_0x3f2aed[_0xa6f7('0xe7')]='HangupInAMD';_0x3f2aed['membername']='AMD';ami[_0xa6f7('0x4a')](_0xa6f7('0xeb'),ut['buildObj'](_0x3f2aed,'amd'));this['saveInDb'](_0x3f2aed,'[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]');}if(_0x227c68[_0xa6f7('0x4b')]===_0xa6f7('0x90')&&this[_0xa6f7('0x20')][_0x227c68[_0xa6f7('0xb2')]][_0xa6f7('0xe4')]&&_0x4299f9[_0xa6f7('0xe5')]===_0xa6f7('0xf0')){var _0x32e44f=this;return new BPromise(function(_0x5d80fb,_0x551d82){delete _0x32e44f[_0xa6f7('0x27')][_0x4299f9[_0xa6f7('0xe6')]];_0x32e44f[_0xa6f7('0xcd')](_0x32e44f[_0xa6f7('0x20')][_0x227c68[_0xa6f7('0xb2')]]);_0x32e44f[_0xa6f7('0x20')][_0x227c68[_0xa6f7('0xb2')]][_0xa6f7('0x5e')]+=0x1;_0x32e44f[_0xa6f7('0x20')][_0x227c68[_0xa6f7('0xb2')]][_0xa6f7('0x5d')]+=0x1;var _0x111b46=_0x32e44f[_0xa6f7('0x20')][_0x227c68[_0xa6f7('0xb2')]];var _0x4c685d=new Hangup(_0x227c68,_0x4299f9);_0x4c685d['state']=0x13;_0x4c685d[_0xa6f7('0xe7')]='Machine';_0x4c685d[_0xa6f7('0xe9')]=_0xa6f7('0xea');_0x4c685d[_0xa6f7('0xf2')]+=0x1;_0x4c685d[_0xa6f7('0x100')]+=0x1;_0x4c685d[_0xa6f7('0xed')]=!![];ami['emit'](_0xa6f7('0xeb'),ut[_0xa6f7('0xec')](_0x4c685d,'amd'));_0x32e44f[_0xa6f7('0xcc')](_0x4c685d)[_0xa6f7('0xb8')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x4c685d[_0xa6f7('0xf3')]+_0x4c685d[_0xa6f7('0xf4')]+_0x4c685d[_0xa6f7('0xf5')]+_0x4c685d[_0xa6f7('0x101')]+_0x4c685d['countdropretry']+_0x4c685d[_0xa6f7('0xf7')]+_0x4c685d[_0xa6f7('0xf2')]+_0x4c685d[_0xa6f7('0x102')]>=_0x111b46[_0xa6f7('0xf8')]){_0x32e44f['stateGlobal'](_0x4c685d,_0x5d80fb,_0x551d82,_0xa6f7('0xfa'));}else{if(_0x4c685d[_0xa6f7('0xf2')]>=_0x111b46[_0xa6f7('0x103')]){_0x32e44f[_0xa6f7('0x104')](_0x4c685d,_0x5d80fb,_0x551d82,_0xa6f7('0x105'));}else{_0x32e44f[_0xa6f7('0xc0')]({'active':![],'countmachineretry':_0x4c685d['countmachineretry'],'scheduledat':moment()['add'](_0x111b46[_0xa6f7('0x106')],'minutes')['format'](_0xa6f7('0x107')),'ContactId':_0x4c685d['ContactId'],'ListId':_0x4c685d['ListId'],'VoiceQueueId':_0x4c685d[_0xa6f7('0xd7')]||undefined,'CampaignId':_0x4c685d[_0xa6f7('0xd8')]||undefined})[_0xa6f7('0xb8')](loggerCatch(_0xa6f7('0xfe')));_0x5d80fb({'reschedule':0x1});}}});}}};Dialer[_0xa6f7('0x1a')][_0xa6f7('0x31')]=function(_0x2642e5){var _0x207261=this[_0xa6f7('0x27')][_0x2642e5[_0xa6f7('0xe6')]];var _0x29f0fa=this;var _0x53201c;if(_0x207261&&_0x207261[_0xa6f7('0x4b')]===_0xa6f7('0x90')){delete this[_0xa6f7('0x27')][_0x2642e5[_0xa6f7('0xe6')]];this['updateOriginated'](this[_0xa6f7('0x20')][_0x207261['queue']]);this['campaigns'][_0x207261['queue']][_0xa6f7('0x108')]+=0x1;_0x53201c=new Hangup(_0x207261,_0x2642e5);this['createHistory'](_0x53201c)[_0xa6f7('0xb8')](loggerCatch('[syncHangupIvr][createHistory]'));this['moveContactManagedDialer'](_0x53201c)['catch'](loggerCatch(_0xa6f7('0x109')));}if(_0x207261&&_0x207261[_0xa6f7('0x4b')]!==_0xa6f7('0x90')&&isNotNull(this['voiceQueues'][_0x207261[_0xa6f7('0xb2')]][_0xa6f7('0x10a')])){delete this[_0xa6f7('0x27')][_0x2642e5[_0xa6f7('0xe6')]];this['updateOriginated'](this['voiceQueues'][_0x207261[_0xa6f7('0xb2')]]);this[_0xa6f7('0x1f')][_0x207261['queue']][_0xa6f7('0x5e')]+=0x1;this[_0xa6f7('0x1f')][_0x207261['queue']][_0xa6f7('0x5d')]+=0x1;_0x53201c=new Hangup(_0x207261,_0x2642e5);_0x53201c['state']=0x10;_0x53201c[_0xa6f7('0xe7')]=_0xa6f7('0x10b');_0x53201c[_0xa6f7('0xe9')]='AGI';this[_0xa6f7('0xcc')](_0x53201c)[_0xa6f7('0xb8')](loggerCatch(_0xa6f7('0x10c')));this[_0xa6f7('0xca')](_0x53201c)[_0xa6f7('0xb8')](loggerCatch(_0xa6f7('0x109')));}if(_0x207261&&_0x207261[_0xa6f7('0x4b')]!==_0xa6f7('0x90')&&!isNotNull(this[_0xa6f7('0x1f')][_0x207261[_0xa6f7('0xb2')]][_0xa6f7('0x10a')])){delete this['uniqueId'][_0x2642e5[_0xa6f7('0xe6')]];this[_0xa6f7('0xcd')](this[_0xa6f7('0x1f')][_0x207261['queue']]);this['voiceQueues'][_0x207261[_0xa6f7('0xb2')]][_0xa6f7('0x68')]+=0x1;_0x53201c=new Hangup(_0x207261,_0x2642e5);_0x53201c[_0xa6f7('0xa8')]=0xc;_0x53201c[_0xa6f7('0xe7')]=_0x2642e5[_0xa6f7('0x10d')];_0x53201c[_0xa6f7('0xe9')]=_0xa6f7('0x10e');this[_0xa6f7('0xcc')](_0x53201c)[_0xa6f7('0xb8')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xa6f7('0xca')](_0x53201c)[_0xa6f7('0xb8')](loggerCatch(_0xa6f7('0x109')));}};Dialer[_0xa6f7('0x1a')]['syncAgentComplete']=function(_0x41817e){var _0x2ebe7a=this[_0xa6f7('0x27')][_0x41817e['uniqueid']];var _0x3a1d95=this;if(this['voiceQueues'][_0x41817e[_0xa6f7('0xb2')]]){if(_0x2ebe7a&&_0x2ebe7a[_0xa6f7('0x4b')]!=='ivr'){delete this['uniqueId'][_0x41817e[_0xa6f7('0xe6')]];this[_0xa6f7('0x1f')][_0x41817e[_0xa6f7('0xb2')]][_0xa6f7('0x5e')]+=0x1;var _0x4f7015=new AgentComplete(_0x2ebe7a,_0x41817e);if(_0x41817e[_0xa6f7('0x10f')]===_0xa6f7('0x110')){_0x4f7015[_0xa6f7('0x111')]=this[_0xa6f7('0x1f')][_0x41817e['queue']]['dialQueueProject2']&&this[_0xa6f7('0x1f')][_0x41817e[_0xa6f7('0xb2')]]['dialAgiAfterHangupAgent']?moment()[_0xa6f7('0x77')](_0xa6f7('0x107')):undefined;}this[_0xa6f7('0xcc')](_0x4f7015)[_0xa6f7('0xb8')](loggerCatch(_0xa6f7('0x112')));this[_0xa6f7('0xca')](_0x4f7015)[_0xa6f7('0xb8')](loggerCatch(_0xa6f7('0x113')));}}};Dialer[_0xa6f7('0x1a')][_0xa6f7('0x2b')]=function(_0x42b6b3){if(this['voiceQueues'][_0x42b6b3[_0xa6f7('0xb2')]]){if(this[_0xa6f7('0x27')][_0x42b6b3[_0xa6f7('0xe6')]]&&this[_0xa6f7('0x27')][_0x42b6b3[_0xa6f7('0xe6')]][_0xa6f7('0x4b')]!==_0xa6f7('0x90')){this[_0xa6f7('0xcd')](this[_0xa6f7('0x1f')][_0x42b6b3[_0xa6f7('0xb2')]]);this[_0xa6f7('0x27')][_0x42b6b3['uniqueid']][_0xa6f7('0x114')]=moment()[_0xa6f7('0x77')](_0xa6f7('0x107'));}}};Dialer[_0xa6f7('0x1a')][_0xa6f7('0x115')]=function(_0x531859){this['createHistory'](_0x531859)[_0xa6f7('0xb8')](loggerCatch(_0xa6f7('0x112')));this[_0xa6f7('0xca')](_0x531859)['catch'](loggerCatch(_0xa6f7('0x116')));};Dialer[_0xa6f7('0x1a')]['syncQueueCallerAbandon']=function(_0x307f12){var _0x709f73=this[_0xa6f7('0x27')][_0x307f12[_0xa6f7('0xe6')]];var _0x4ed272=this;if(this[_0xa6f7('0x1f')][_0x307f12[_0xa6f7('0xb2')]]){if(_0x709f73&&_0x709f73['type']!=='ivr'){delete this[_0xa6f7('0x27')][_0x307f12[_0xa6f7('0xe6')]];this['updateOriginated'](this['voiceQueues'][_0x307f12[_0xa6f7('0xb2')]]);_0x709f73[_0xa6f7('0x117')]=moment()[_0xa6f7('0x77')](_0xa6f7('0x107'));var _0x21b1a9=new QueueCallerAbandon(_0x709f73,_0x307f12);if(getSeconds(_0x709f73[_0xa6f7('0x117')],_0x709f73[_0xa6f7('0x118')])>=_0x709f73[_0xa6f7('0x119')]){this[_0xa6f7('0x1f')][_0x307f12[_0xa6f7('0xb2')]][_0xa6f7('0x7f')]+=0x1;this[_0xa6f7('0x1f')][_0x307f12['queue']]['outboundDropCallsDayTimeout']+=0x1;this[_0xa6f7('0x1f')][_0x307f12['queue']][_0xa6f7('0x6c')]+=0x1;_0x21b1a9[_0xa6f7('0xa8')]=0xa;_0x21b1a9[_0xa6f7('0xe7')]=_0xa6f7('0x11a');_0x21b1a9[_0xa6f7('0x11b')]=_0xa6f7('0x11c');_0x21b1a9[_0xa6f7('0x111')]=this[_0xa6f7('0x1f')][_0x307f12[_0xa6f7('0xb2')]]['dialQueueProject2']?moment()[_0xa6f7('0x77')](_0xa6f7('0x107')):undefined;_0x21b1a9[_0xa6f7('0xf6')]+=0x1;_0x21b1a9[_0xa6f7('0x100')]+=0x1;if(_0x21b1a9[_0xa6f7('0xf6')]>=this[_0xa6f7('0x1f')][_0x307f12[_0xa6f7('0xb2')]][_0xa6f7('0x11d')]){this['queueCallerAbandonCreateState'](_0x21b1a9);}else{this[_0xa6f7('0xc0')]({'active':![],'countdropretry':_0x21b1a9[_0xa6f7('0xf6')],'scheduledat':moment()[_0xa6f7('0xfb')](this[_0xa6f7('0x1f')][_0x307f12[_0xa6f7('0xb2')]]['dialDropRetryFrequency'],_0xa6f7('0xfc'))[_0xa6f7('0x77')](_0xa6f7('0x107')),'ContactId':_0x709f73[_0xa6f7('0xd5')],'ListId':_0x709f73[_0xa6f7('0xfd')],'VoiceQueueId':_0x709f73[_0xa6f7('0xd7')]||undefined,'CampaignId':_0x709f73[_0xa6f7('0xd8')]||undefined})[_0xa6f7('0xb8')](loggerCatch('[rescheduleContact][Drop]'));var _0x2248dd=new History(_0x21b1a9);_0x2248dd[_0xa6f7('0xa8')]=0xa;_0x2248dd[_0xa6f7('0xe7')]=_0xa6f7('0x11a');_0x2248dd[_0xa6f7('0xaa')]=moment()[_0xa6f7('0x77')](_0xa6f7('0x107'));_0x2248dd[_0xa6f7('0xa9')]=_0x2248dd['starttime'];_0x2248dd['calleridname']=_0x21b1a9['calleridname'];_0x2248dd['calleridnum']=_0x21b1a9[_0xa6f7('0x11e')];this['createHistory'](_0x2248dd)[_0xa6f7('0xb8')](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this[_0xa6f7('0x1f')][_0x307f12[_0xa6f7('0xb2')]][_0xa6f7('0x6b')]+=0x1;this[_0xa6f7('0x1f')][_0x307f12[_0xa6f7('0xb2')]][_0xa6f7('0x63')]+=0x1;_0x21b1a9[_0xa6f7('0xa8')]=0xb;_0x21b1a9['statedesc']=_0xa6f7('0x11f');_0x21b1a9[_0xa6f7('0x11b')]=_0xa6f7('0x120');_0x21b1a9[_0xa6f7('0xf7')]+=0x1;_0x21b1a9[_0xa6f7('0x100')]+=0x1;if(_0x21b1a9[_0xa6f7('0xf7')]>=this[_0xa6f7('0x1f')][_0x307f12[_0xa6f7('0xb2')]][_0xa6f7('0x121')]){this[_0xa6f7('0x115')](_0x21b1a9);}else{this[_0xa6f7('0xc0')]({'active':![],'countabandonedretry':_0x21b1a9[_0xa6f7('0xf7')],'scheduledat':moment()['add'](this[_0xa6f7('0x1f')][_0x307f12[_0xa6f7('0xb2')]][_0xa6f7('0x122')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x709f73['ContactId'],'ListId':_0x709f73[_0xa6f7('0xfd')],'VoiceQueueId':_0x709f73[_0xa6f7('0xd7')]||undefined,'CampaignId':_0x709f73[_0xa6f7('0xd8')]||undefined})[_0xa6f7('0xb8')](loggerCatch(_0xa6f7('0x123')));var _0x2248dd=new History(_0x21b1a9);_0x2248dd[_0xa6f7('0xa8')]=0xb;_0x2248dd['statedesc']=_0xa6f7('0x11f');_0x2248dd[_0xa6f7('0xaa')]=moment()[_0xa6f7('0x77')](_0xa6f7('0x107'));_0x2248dd[_0xa6f7('0xa9')]=_0x2248dd[_0xa6f7('0xaa')];_0x2248dd['calleridname']=_0x21b1a9['calleridname'];_0x2248dd[_0xa6f7('0x11e')]=_0x21b1a9[_0xa6f7('0x11e')];this['createHistory'](_0x2248dd)[_0xa6f7('0xb8')](loggerCatch(_0xa6f7('0x124')));}}}}};Dialer[_0xa6f7('0x1a')]['syncNewExten']=function(_0x594eec){if(this[_0xa6f7('0x25')][_0x594eec[_0xa6f7('0xe6')]]){this[_0xa6f7('0x25')][_0x594eec[_0xa6f7('0xe6')]][_0xa6f7('0xb0')]=_0x594eec['channel'];}if(this[_0xa6f7('0x27')][_0x594eec[_0xa6f7('0xe6')]]){this[_0xa6f7('0x27')][_0x594eec[_0xa6f7('0xe6')]][_0xa6f7('0xb0')]=_0x594eec[_0xa6f7('0xb0')];}};Dialer['prototype'][_0xa6f7('0x35')]=function(_0x50fcb7){if(strategy[this['voiceQueues'][this[_0xa6f7('0x25')][_0x50fcb7[_0xa6f7('0x125')]]['queue']]['strategy']]===_0xa6f7('0x126')){if(this[_0xa6f7('0x25')][_0x50fcb7['actionid']]&&_[_0xa6f7('0xe2')](this[_0xa6f7('0x25')][_0x50fcb7['actionid']]['locked'])&&_0x50fcb7[_0xa6f7('0xaf')]==='1'&&_0x50fcb7[_0xa6f7('0x127')]==='0'){if(this['agents'][_0x50fcb7[_0xa6f7('0x128')]]){if(!this[_0xa6f7('0x21')][_0x50fcb7[_0xa6f7('0x128')]][_0xa6f7('0x129')]){this[_0xa6f7('0x21')][_0x50fcb7[_0xa6f7('0x128')]][_0xa6f7('0x129')]=!![];this[_0xa6f7('0x25')][_0x50fcb7[_0xa6f7('0x125')]][_0xa6f7('0x129')]=!![];this['actions'][_0x50fcb7['actionid']]['stateinterface']=_0x50fcb7[_0xa6f7('0x128')];}}}}else if((strategy[this[_0xa6f7('0x1f')][this[_0xa6f7('0x25')][_0x50fcb7[_0xa6f7('0x125')]][_0xa6f7('0xb2')]][_0xa6f7('0x4d')]]||_0xa6f7('0x19'))===_0xa6f7('0x19')){if(this['actions'][_0x50fcb7[_0xa6f7('0x125')]]){if(this['agents'][_0x50fcb7['stateinterface']]){this[_0xa6f7('0x25')][_0x50fcb7[_0xa6f7('0x125')]]['stateinterface']=_0x50fcb7[_0xa6f7('0x128')];if(_[_0xa6f7('0xe2')](this['queueBooked'][this[_0xa6f7('0x25')][_0x50fcb7[_0xa6f7('0x125')]][_0xa6f7('0xb2')]])){this[_0xa6f7('0x12a')][this[_0xa6f7('0x25')][_0x50fcb7[_0xa6f7('0x125')]][_0xa6f7('0xb2')]]=[];}this[_0xa6f7('0x12a')][this[_0xa6f7('0x25')][_0x50fcb7['actionid']]['queue']][_0xa6f7('0x12b')](_['merge'](_['pick'](this[_0xa6f7('0x25')][_0x50fcb7[_0xa6f7('0x125')]],['idHopper',_0xa6f7('0x128')]),{'status':_0x50fcb7['status'],'paused':_0x50fcb7[_0xa6f7('0x127')]}));}}}};function unlockQueueStatus(_0x1fe164,_0x5de2da){setTimeout(function(){if(_['isUndefined'](_0x1fe164['queueStatusComplete'])){loggerBooked[_0xa6f7('0x94')](_0xa6f7('0x12c'),_0x5de2da);}_0x1fe164[_0xa6f7('0x12d')]=!![];loggerBooked[_0xa6f7('0x7a')](_0xa6f7('0x12e'),_0x5de2da,JSON[_0xa6f7('0x46')](_[_0xa6f7('0xd4')](_0x1fe164,[_0xa6f7('0x3c'),_0xa6f7('0x12d')])));},0x1f3);}Dialer[_0xa6f7('0x1a')][_0xa6f7('0x37')]=function(_0x5e3a06){var _0x522323=this;var _0x160bfd=_0x522323[_0xa6f7('0x1f')][_0x522323[_0xa6f7('0x25')][_0x5e3a06['actionid']]['queue']];if(strategy[this[_0xa6f7('0x1f')][this[_0xa6f7('0x25')][_0x5e3a06[_0xa6f7('0x125')]][_0xa6f7('0xb2')]][_0xa6f7('0x4d')]]===_0xa6f7('0x126')){if(this[_0xa6f7('0x25')][_0x5e3a06[_0xa6f7('0x125')]]&&this[_0xa6f7('0x25')][_0x5e3a06['actionid']][_0xa6f7('0x128')]){this[_0xa6f7('0x1e')][_0xa6f7('0x12f')](this[_0xa6f7('0x25')][_0x5e3a06[_0xa6f7('0x125')]][_0xa6f7('0x130')],this[_0xa6f7('0x25')][_0x5e3a06[_0xa6f7('0x125')]][_0xa6f7('0x128')])[_0xa6f7('0xb8')](function(_0x55bf91){logger[_0xa6f7('0x94')]('[Catch][Preview][syncQueueStatusComplete]',util[_0xa6f7('0x95')](_0x55bf91,{'showHidden':![],'depth':null}));})['finally'](function(){_0x522323[_0xa6f7('0xcd')](_0x522323[_0xa6f7('0x1f')][_0x522323['actions'][_0x5e3a06[_0xa6f7('0x125')]][_0xa6f7('0xb2')]]);_0x522323[_0xa6f7('0x21')][_0x522323[_0xa6f7('0x25')][_0x5e3a06[_0xa6f7('0x125')]][_0xa6f7('0x128')]]['locked']=![];delete _0x522323['actions'][_0x5e3a06[_0xa6f7('0x125')]];unlockQueueStatus(_0x160bfd);});}else{this[_0xa6f7('0xcd')](this[_0xa6f7('0x1f')][this[_0xa6f7('0x25')][_0x5e3a06[_0xa6f7('0x125')]][_0xa6f7('0xb2')]]);this[_0xa6f7('0xc0')]({'active':![],'ContactId':this[_0xa6f7('0x25')][_0x5e3a06['actionid']][_0xa6f7('0xd5')],'ListId':this['actions'][_0x5e3a06[_0xa6f7('0x125')]]['ListId'],'VoiceQueueId':this[_0xa6f7('0x25')][_0x5e3a06[_0xa6f7('0x125')]][_0xa6f7('0xd7')]||undefined,'CampaignId':this['actions'][_0x5e3a06[_0xa6f7('0x125')]]['CampaignId']||undefined})[_0xa6f7('0xb8')](loggerCatch(_0xa6f7('0x131')));delete this[_0xa6f7('0x25')][_0x5e3a06['actionid']];unlockQueueStatus(_0x160bfd);}}else if((strategy[this[_0xa6f7('0x1f')][this['actions'][_0x5e3a06[_0xa6f7('0x125')]][_0xa6f7('0xb2')]][_0xa6f7('0x4d')]]||_0xa6f7('0x19'))==='rrmemory'){var _0x4b5ff7;if(this[_0xa6f7('0x25')][_0x5e3a06[_0xa6f7('0x125')]]&&!_['isEmpty'](this[_0xa6f7('0x12a')][this[_0xa6f7('0x25')][_0x5e3a06['actionid']][_0xa6f7('0xb2')]])){if(this[_0xa6f7('0x132')][_0x522323[_0xa6f7('0x25')][_0x5e3a06[_0xa6f7('0x125')]]['queue']]){this[_0xa6f7('0x132')][_0x522323[_0xa6f7('0x25')][_0x5e3a06[_0xa6f7('0x125')]]['queue']]=this[_0xa6f7('0x132')][this[_0xa6f7('0x25')][_0x5e3a06[_0xa6f7('0x125')]]['queue']]?this['queueBookedRR'][this[_0xa6f7('0x25')][_0x5e3a06[_0xa6f7('0x125')]][_0xa6f7('0xb2')]]:this[_0xa6f7('0x12a')][this['actions'][_0x5e3a06[_0xa6f7('0x125')]][_0xa6f7('0xb2')]]?this[_0xa6f7('0x12a')][this[_0xa6f7('0x25')][_0x5e3a06['actionid']][_0xa6f7('0xb2')]][_0xa6f7('0x133')]||0x0:0x0;}this['queueBooked'][this[_0xa6f7('0x25')][_0x5e3a06['actionid']][_0xa6f7('0xb2')]][_0xa6f7('0x133')]=this[_0xa6f7('0x132')][this[_0xa6f7('0x25')][_0x5e3a06[_0xa6f7('0x125')]][_0xa6f7('0xb2')]];for(var _0x4805d2=0x0;_0x4805d2=0x0;})['catch'](myreject(_0xc09f16)));}}else{_0x37057b[_0xa6f7('0x12b')](ami[_0xa6f7('0x14e')]({'action':_0xa6f7('0x149'),'command':util[_0xa6f7('0x77')](_0xa6f7('0x14f'),_0x65ad6a,!_[_0xa6f7('0x3a')](config[_0xa6f7('0x14a')][_0x75a4f4])?_0x75a4f4:'')})[_0xa6f7('0xb7')](function(_0x298b56){return _0x298b56[_0xa6f7('0x14b')]['indexOf'](_0xa6f7('0x14d'))>=0x0;})['catch'](myreject(_0xc09f16)));}BPromise[_0xa6f7('0x150')](_0x37057b)[_0xa6f7('0xb7')](function(_0x2f9531){var _0x3e546e=_[_0xa6f7('0x151')](_0x2f9531);if(_0x3e546e){return _0xb4915a(_0x3e546e);}else{_0x5ac4bb[_0xa6f7('0x3b')]=_0x499ded?_0xa6f7('0x152'):'INTERVAL_IS_OVERTIME';return _0xc09f16(msgResponse('[ifTime][promiseAll]',_0xa6f7('0x145'),_0xa6f7('0x153')+_0x499ded+'\x20'+_0x59c06b+_0xa6f7('0x154')+util[_0xa6f7('0x95')](_0x65ad6a,{'showHidden':![],'depth':null})+_0xa6f7('0x155')+_0x75a4f4));}})['catch'](function(_0x3ec007){return _0xc09f16(msgResponse(_0xa6f7('0x142'),_0xa6f7('0x145'),JSON[_0xa6f7('0x46')](_0x3ec007)));});});};Dialer[_0xa6f7('0x1a')]['checkDialMethod']=function(_0x58e6bc){var _0x168628=this;return function(){switch(_0x58e6bc[_0xa6f7('0x5a')]){case _0xa6f7('0x156'):freeVariablesPredictive(_0x58e6bc);_0x168628[_0xa6f7('0x157')](_0x58e6bc,0x1);break;case _0xa6f7('0x158'):freeVariablesPredictive(_0x58e6bc);_0x168628[_0xa6f7('0x157')](_0x58e6bc,_0x58e6bc[_0xa6f7('0x159')]);break;case'predictive':_0x168628[_0xa6f7('0xb')](_0x58e6bc);break;case _0xa6f7('0xa'):freeVariablesPredictive(_0x58e6bc);_0x168628[_0xa6f7('0x157')](_0x58e6bc,0x1);break;default:freeVariablesPredictive(_0x58e6bc);logger[_0xa6f7('0x94')](_0xa6f7('0x15a'),_0x58e6bc[_0xa6f7('0x3c')],_0xa6f7('0x15b'));}};};Dialer[_0xa6f7('0x1a')][_0xa6f7('0x15c')]=function(_0x3027bb){var _0x3f003e=this;return function(){_0x3f003e['handleIvr'](_0x3027bb);};};Dialer[_0xa6f7('0x1a')]['syncQueueSummary']=function(_0x4a1504){var _0x483526=this;if(isNotPreview(_0x4a1504['dialMethod'])){if(isVoiceQueueOutbound(_0x4a1504[_0xa6f7('0x4b')])&&isActive(_0x4a1504['dialActive'])){_0x4a1504[_0xa6f7('0x9f')]=!![];BPromise['resolve']()[_0xa6f7('0xb7')](checkIsLoggedIn(_0x4a1504,_0x4a1504[_0xa6f7('0x4f')]))['then'](checkIsActive(_0x4a1504,_0x4a1504[_0xa6f7('0x59')]))[_0xa6f7('0xb7')](checkInterval(_0x4a1504))[_0xa6f7('0xb7')](_0x483526[_0xa6f7('0x13d')](_0x4a1504))['then'](_0x483526[_0xa6f7('0x140')](_0x4a1504[_0xa6f7('0x15d')],_0x4a1504[_0xa6f7('0x15e')],_0x4a1504['name'],_0x4a1504))[_0xa6f7('0xb7')](_0x483526[_0xa6f7('0x141')](_0x4a1504['Interval'],_0x4a1504[_0xa6f7('0x15e')],_0x4a1504[_0xa6f7('0x3c')],_0x4a1504))['then'](_0x483526[_0xa6f7('0x15f')](_0x4a1504))[_0xa6f7('0xb8')](loggerCatchQueueSummary(_0xa6f7('0x160'),_0x4a1504));}else{notSendMessagesQueue(_0x4a1504);}}else{freeVariablesPredictive(_0x4a1504);}};Dialer[_0xa6f7('0x1a')][_0xa6f7('0x13c')]=function(){var _0x35bc86=this;var _0x3b3ee1;for(var _0x459fb0 in this['campaigns']){if(typeof this[_0xa6f7('0x20')][_0x459fb0]!==_0xa6f7('0x98')){_0x3b3ee1=this[_0xa6f7('0x20')][_0x459fb0];if(isCampaignIvr(_0x3b3ee1[_0xa6f7('0x4b')])&&isActive(_0x3b3ee1[_0xa6f7('0xde')])){_0x3b3ee1[_0xa6f7('0x9f')]=!![];BPromise['resolve']()[_0xa6f7('0xb7')](checkIsActive(_0x3b3ee1,_0x3b3ee1[_0xa6f7('0xde')]))['then'](checkInterval(_0x3b3ee1))['then'](_0x35bc86[_0xa6f7('0x13d')](_0x3b3ee1))['then'](_0x35bc86['checkIfTime'](_0x3b3ee1[_0xa6f7('0x15d')],_0x3b3ee1['dialTimezone'],_0x3b3ee1[_0xa6f7('0x3c')],_0x3b3ee1))[_0xa6f7('0xb7')](_0x35bc86[_0xa6f7('0x141')](_0x3b3ee1['Interval'],_0x3b3ee1['dialTimezone'],_0x3b3ee1[_0xa6f7('0x3c')],_0x3b3ee1))[_0xa6f7('0xb7')](_0x35bc86[_0xa6f7('0x15c')](_0x3b3ee1))['catch'](loggerCatchQueueSummary('[syncCampaigns]',_0x3b3ee1));}else{notSendMessagesCampaign(_0x3b3ee1);}}}};function getCallerIdRandom(_0x5df639,_0x24e2aa){var _0x36742a;var _0x338305;var _0x4458d1;if(_0x24e2aa<=0x0){_0x24e2aa=0x1;}_0x36742a=new RegExp(_0xa6f7('0x161')+_0x24e2aa+'}$');_0x338305=Math['pow'](0xa,_0x24e2aa-0x1);_0x4458d1=Math[_0xa6f7('0x162')](0xa,_0x24e2aa)-0x1;return util['format']('%s',_[_0xa6f7('0x163')](_0x5df639,_0x36742a,_[_0xa6f7('0x164')](_0x338305,_0x4458d1)));}function extractCalleridName(_0x37e7dc){var _0x4a304e=_0x37e7dc['match'](/"(.*?)"/);return _0x4a304e?_0x4a304e[0x1]:_0x37e7dc;}function extractCalleridNumber(_0x15e5dc){var _0x223fe3=_0x15e5dc['match'](/<(.*?)>/);return _0x223fe3?_0x223fe3[0x1]:_0x15e5dc;}Dialer['prototype'][_0xa6f7('0x165')]=function(_0x36bfcb,_0x48740d){var _0x118c80=this;var _0x3228c6=uuid['v4']();this[_0xa6f7('0x25')][_0x3228c6]=new Action(_0x36bfcb,_0x48740d,_0x3228c6);return new BPromise(function(_0x3f6e98,_0x22fb24){if(_[_0xa6f7('0x3a')](_0x36bfcb)&&typeof _0x36bfcb!==_0xa6f7('0x166')){return _0x22fb24(msgResponse('originate',_0xa6f7('0x145'),'voiceQueue\x20is\x20undefine'));}if(_[_0xa6f7('0x3a')](_0x48740d[_0xa6f7('0x167')]['phone'])||_0x48740d['Contact']['phone']===null){return _0x22fb24(msgResponse(_0xa6f7('0x168'),_0xa6f7('0x145'),'contact\x20is\x20undefine'));}var _0xda2ba9={'XMD-CALLERID':_0x118c80[_0xa6f7('0x25')][_0x3228c6][_0xa6f7('0x169')](),'XMD-AGI':_0x36bfcb[_0xa6f7('0x10a')]?util[_0xa6f7('0x77')](_0xa6f7('0x16a'),ipAgi,_0x36bfcb[_0xa6f7('0x10a')]):_0xa6f7('0x16b'),'XMD-AGIAFTER':_0x36bfcb[_0xa6f7('0x16c')]?util[_0xa6f7('0x77')](_0xa6f7('0x16a'),ipAgi,_0x36bfcb[_0xa6f7('0x16c')]):_0xa6f7('0x16b'),'XMD-QUEUE':_0x36bfcb['type']==='outbound'?util[_0xa6f7('0x77')](_0xa6f7('0x16d'),_0x36bfcb['name'],_0x36bfcb[_0xa6f7('0x16e')]||'',_0x36bfcb[_0xa6f7('0x16f')]?'c':'',_0x36bfcb['dialQueueTimeout']||0x3):_0xa6f7('0x16b'),'XMD-CONTACTID':_0x48740d[_0xa6f7('0xd5')],'XMD-CDRTYPE':_0xa6f7('0x9'),'CALLERID(all)':_0x118c80[_0xa6f7('0x25')][_0x3228c6][_0xa6f7('0x169')](),'XMD-AMD':_0x36bfcb[_0xa6f7('0xe4')]?_0xa6f7('0x170'):_0xa6f7('0x16b'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x36bfcb[_0xa6f7('0xe4')]){_0xda2ba9['XMD-AMDINITIALSILENCE']=_0x36bfcb[_0xa6f7('0x171')]||0x9c4;_0xda2ba9['XMD-AMDGREETING']=_0x36bfcb['dialAMDGreeting']||0x5dc;_0xda2ba9[_0xa6f7('0x172')]=_0x36bfcb['dialAMDAfterGreetingSilence']||0x320;_0xda2ba9[_0xa6f7('0x173')]=_0x36bfcb['dialAMDTotalAnalysisTime']||0x1388;_0xda2ba9['XMD-AMDMINWORDLENGTH']=_0x36bfcb[_0xa6f7('0x174')]||0x64;_0xda2ba9[_0xa6f7('0x175')]=_0x36bfcb[_0xa6f7('0x176')]||0x32;_0xda2ba9['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x36bfcb[_0xa6f7('0x177')]||0x3;_0xda2ba9[_0xa6f7('0x178')]=_0x36bfcb[_0xa6f7('0x179')]||0x100;_0xda2ba9[_0xa6f7('0x17a')]=_0x36bfcb[_0xa6f7('0x17b')]||0x1388;}if(_0x36bfcb[_0xa6f7('0x4b')]==='outbound'){_0xda2ba9[_0xa6f7('0x17c')]=_0x48740d[_0xa6f7('0xd7')];}else{_0xda2ba9[_0xa6f7('0x17d')]=_0x48740d[_0xa6f7('0xd8')];}for(var _0x3505a5 in _0x48740d['Contact']){if(typeof _0x48740d[_0xa6f7('0x167')][_0x3505a5]!==_0xa6f7('0x98')){if(isNotNull(_0x48740d[_0xa6f7('0x167')][_0x3505a5])&&_0x3505a5!=='id'&&_0x3505a5!==_0xa6f7('0x17e')&&_0x3505a5!==_0xa6f7('0x17f')&&_0x3505a5!==_0xa6f7('0x180')){_0xda2ba9[util[_0xa6f7('0x77')](_0xa6f7('0x181'),_0xa6f7('0x182'),_[_0xa6f7('0x183')](_0x3505a5))]=_0x48740d['Contact'][_0x3505a5];}}}var _0x16881e=_0x118c80[_0xa6f7('0xdd')](_0x36bfcb['Trunk'])?getCallerId(_0x36bfcb[_0xa6f7('0x75')][_0xa6f7('0x76')],_0x36bfcb[_0xa6f7('0x184')],_0x36bfcb[_0xa6f7('0x185')]>0x0?getCallerIdRandom(_0x36bfcb['dialOriginateCallerIdNumber'],_0x36bfcb[_0xa6f7('0x185')]):_0x36bfcb[_0xa6f7('0x186')]):getCallerId(_[_0xa6f7('0xe2')](_0x36bfcb[_0xa6f7('0x187')])?_0x36bfcb[_0xa6f7('0x75')][_0xa6f7('0x76')]:_0x36bfcb[_0xa6f7('0x187')][_0xa6f7('0x76')],_0x36bfcb['dialOriginateCallerIdName'],_0x36bfcb[_0xa6f7('0x185')]>0x0?getCallerIdRandom(_0x36bfcb[_0xa6f7('0x186')],_0x36bfcb[_0xa6f7('0x185')]):_0x36bfcb[_0xa6f7('0x186')]);if(_0x16881e){_0xda2ba9[_0xa6f7('0x188')]=_0x118c80[_0xa6f7('0x25')][_0x3228c6][_0xa6f7('0x189')]=extractCalleridName(_0x16881e);_0xda2ba9[_0xa6f7('0x18a')]=_0x118c80[_0xa6f7('0x25')][_0x3228c6]['originatecalleridnum']=extractCalleridNumber(_0x16881e);}return ami['Action']({'actionid':_0x3228c6,'action':_0xa6f7('0x168'),'channel':_0x118c80[_0xa6f7('0xdd')](_0x36bfcb[_0xa6f7('0x75')])?util[_0xa6f7('0x77')](_0xa6f7('0x18b'),_0x36bfcb[_0xa6f7('0x75')]['name'],isNotNull(_0x36bfcb[_0xa6f7('0x5c')])?_0x36bfcb[_0xa6f7('0x5c')]['trim']()||'':'',_0x36bfcb['dialCutDigit']>0x0?_0x48740d[_0xa6f7('0x167')][_0xa6f7('0x18c')][_0xa6f7('0x18d')](_0x36bfcb[_0xa6f7('0x18e')]):_0x48740d[_0xa6f7('0x167')][_0xa6f7('0x18c')]):util['format'](_0xa6f7('0x18b'),_[_0xa6f7('0xe2')](_0x36bfcb[_0xa6f7('0x187')])?_0x36bfcb[_0xa6f7('0x75')][_0xa6f7('0x3c')]:_0x36bfcb[_0xa6f7('0x187')][_0xa6f7('0x3c')],isNotNull(_0x36bfcb['dialPrefix'])?_0x36bfcb['dialPrefix'][_0xa6f7('0x18f')]()||'':'',_0x36bfcb[_0xa6f7('0x18e')]>0x0?_0x48740d[_0xa6f7('0x167')][_0xa6f7('0x18c')]['substring'](_0x36bfcb[_0xa6f7('0x18e')]):_0x48740d[_0xa6f7('0x167')][_0xa6f7('0x18c')]),'callerid':_0x16881e,'Exten':_0xa6f7('0xe3'),'Context':_0xa6f7('0x190'),'Priority':'1','variable':_0xda2ba9,'timeout':(_0x36bfcb['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x3228c6})[_0xa6f7('0xb7')](function(_0x5877e7){return _0x3f6e98(_0x5877e7);})[_0xa6f7('0xb8')](function(_0x347e39){_0x36bfcb['outboundOriginateFailureCallsDay']+=0x1;var _0x1a6d9c=new History(_0x118c80[_0xa6f7('0x25')][_0x3228c6]);logger['error'](util[_0xa6f7('0x77')](_0xa6f7('0x191'),JSON[_0xa6f7('0x46')](_0x347e39)));_0x1a6d9c[_0xa6f7('0xa8')]=0xe;_0x1a6d9c[_0xa6f7('0xe7')]='OriginateError';_0x1a6d9c['starttime']=moment()[_0xa6f7('0x77')](_0xa6f7('0x107'));_0x1a6d9c[_0xa6f7('0xa9')]=_0x1a6d9c[_0xa6f7('0xaa')];_0x118c80[_0xa6f7('0xcc')](_0x1a6d9c)[_0xa6f7('0xb8')](loggerCatch(_0xa6f7('0x192')));_0x118c80['moveContactManagedDialer'](_0x1a6d9c)[_0xa6f7('0xb8')](loggerCatch('[originate][error]'))[_0xa6f7('0x1c')](function(){delete _0x118c80['actions'][_0x3228c6];return _0x22fb24(msgResponse('originate',_0xa6f7('0x45'),_0xa6f7('0x193')));});});});};Dialer[_0xa6f7('0x1a')]['syncOriginateResponse']=function(_0x551c24){var _0x2cee1a=this[_0xa6f7('0x25')][_0x551c24[_0xa6f7('0x125')]];if(_0x2cee1a){delete this[_0xa6f7('0x25')][_0x551c24[_0xa6f7('0x125')]];_0x2cee1a[_0xa6f7('0x118')]=moment()[_0xa6f7('0x77')]('YYYY-MM-DD\x20HH:mm:ss');var _0x165beb=_0x2cee1a['type']===_0xa6f7('0x90')?this[_0xa6f7('0x20')][_0x2cee1a['queue']]:this['voiceQueues'][_0x2cee1a[_0xa6f7('0x194')]()];if(!this[_0xa6f7('0xdb')](_0x551c24[_0xa6f7('0x195')])){this['updateOriginated'](_0x165beb);return this[_0xa6f7('0x196')](_0x2cee1a,_0x165beb,_0x551c24)[_0xa6f7('0xb8')](loggerCatch(_0xa6f7('0x197')));}this[_0xa6f7('0x27')][_0x551c24['uniqueid']]=_0x2cee1a;}};Dialer[_0xa6f7('0x1a')][_0xa6f7('0x198')]=function(_0x468140,_0x1b153d,_0x57171a){var _0x48a29f=new History(_0x1b153d);if(_0x48a29f[_0xa6f7('0xf3')]+_0x48a29f['countcongestionretry']+_0x48a29f[_0xa6f7('0xf5')]+_0x48a29f['countnosuchnumberretry']+_0x48a29f['countdropretry']+_0x48a29f[_0xa6f7('0xf7')]+_0x48a29f[_0xa6f7('0xf2')]+_0x48a29f[_0xa6f7('0x102')]>=_0x57171a[_0xa6f7('0xf8')]-0x1){return!![];}switch(_0x468140){case 0x3:if(_0x48a29f[_0xa6f7('0xf5')]>=_0x57171a[_0xa6f7('0x199')]-0x1){return!![];}this[_0xa6f7('0xc0')]({'active':![],'countnoanswerretry':_0x48a29f[_0xa6f7('0xf5')]+=0x1,'scheduledat':moment()[_0xa6f7('0xfb')](_0x57171a['dialNoAnswerRetryFrequency'],_0xa6f7('0xfc'))[_0xa6f7('0x77')](_0xa6f7('0x107')),'ContactId':_0x48a29f[_0xa6f7('0xd5')],'ListId':_0x48a29f['ListId'],'VoiceQueueId':_0x48a29f['VoiceQueueId']||undefined,'CampaignId':_0x48a29f[_0xa6f7('0xd8')]||undefined})[_0xa6f7('0xb8')](loggerCatch(_0xa6f7('0x19a')));break;case 0x5:if(_0x48a29f['countbusyretry']>=_0x57171a[_0xa6f7('0x19b')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x48a29f['countbusyretry']+=0x1,'scheduledat':moment()[_0xa6f7('0xfb')](_0x57171a[_0xa6f7('0x19c')],_0xa6f7('0xfc'))[_0xa6f7('0x77')](_0xa6f7('0x107')),'ContactId':_0x48a29f[_0xa6f7('0xd5')],'ListId':_0x48a29f['ListId'],'VoiceQueueId':_0x48a29f[_0xa6f7('0xd7')]||undefined,'CampaignId':_0x48a29f[_0xa6f7('0xd8')]||undefined})[_0xa6f7('0xb8')](loggerCatch(_0xa6f7('0x19d')));break;case 0x8:if(_0x48a29f['countcongestionretry']>=_0x57171a['dialCongestionMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0x48a29f[_0xa6f7('0xf4')]+=0x1,'scheduledat':moment()[_0xa6f7('0xfb')](_0x57171a['dialCongestionRetryFrequency'],'minutes')[_0xa6f7('0x77')](_0xa6f7('0x107')),'ContactId':_0x48a29f[_0xa6f7('0xd5')],'ListId':_0x48a29f[_0xa6f7('0xfd')],'VoiceQueueId':_0x48a29f['VoiceQueueId']||undefined,'CampaignId':_0x48a29f[_0xa6f7('0xd8')]||undefined})['catch'](loggerCatch(_0xa6f7('0x19e')));break;case 0x0:if(_0x48a29f['countnosuchnumberretry']>=_0x57171a[_0xa6f7('0x19f')]-0x1){return!![];}else{this[_0xa6f7('0xc0')]({'active':![],'countnosuchnumberretry':_0x48a29f['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0xa6f7('0xfb')](_0x57171a[_0xa6f7('0x1a0')],_0xa6f7('0xfc'))[_0xa6f7('0x77')](_0xa6f7('0x107')),'ContactId':_0x48a29f['ContactId'],'ListId':_0x48a29f[_0xa6f7('0xfd')],'VoiceQueueId':_0x48a29f[_0xa6f7('0xd7')]||undefined,'CampaignId':_0x48a29f[_0xa6f7('0xd8')]||undefined})[_0xa6f7('0xb8')](loggerCatch(_0xa6f7('0x1a1')));}break;case 0xa:if(_0x48a29f[_0xa6f7('0xf6')]>=_0x57171a[_0xa6f7('0x11d')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countdropretry':_0x48a29f[_0xa6f7('0xf6')]+=0x1,'scheduledat':moment()[_0xa6f7('0xfb')](_0x57171a[_0xa6f7('0x1a2')],_0xa6f7('0xfc'))[_0xa6f7('0x77')](_0xa6f7('0x107')),'ContactId':_0x48a29f[_0xa6f7('0xd5')],'ListId':_0x48a29f[_0xa6f7('0xfd')],'VoiceQueueId':_0x48a29f['VoiceQueueId']||undefined,'CampaignId':_0x48a29f[_0xa6f7('0xd8')]||undefined})['catch'](loggerCatch(_0xa6f7('0x1a3')));break;case 0xb:if(_0x48a29f[_0xa6f7('0xf7')]>=_0x57171a['dialAbandonedMaxRetry']-0x1){return!![];}this[_0xa6f7('0xc0')]({'active':![],'countabandonedretry':_0x48a29f[_0xa6f7('0xf7')]+=0x1,'scheduledat':moment()[_0xa6f7('0xfb')](_0x57171a['dialAbandonedRetryFrequency'],_0xa6f7('0xfc'))[_0xa6f7('0x77')](_0xa6f7('0x107')),'ContactId':_0x48a29f[_0xa6f7('0xd5')],'ListId':_0x48a29f[_0xa6f7('0xfd')],'VoiceQueueId':_0x48a29f[_0xa6f7('0xd7')]||undefined,'CampaignId':_0x48a29f['CampaignId']||undefined})['catch'](loggerCatch(_0xa6f7('0x123')));break;case 0x13:if(_0x48a29f[_0xa6f7('0xf2')]>=_0x57171a[_0xa6f7('0x103')]-0x1){return!![];}this[_0xa6f7('0xc0')]({'active':![],'countmachineretry':_0x48a29f[_0xa6f7('0xf2')]+=0x1,'scheduledat':moment()[_0xa6f7('0xfb')](_0x57171a[_0xa6f7('0x106')],'minutes')[_0xa6f7('0x77')](_0xa6f7('0x107')),'ContactId':_0x48a29f[_0xa6f7('0xd5')],'ListId':_0x48a29f[_0xa6f7('0xfd')],'VoiceQueueId':_0x48a29f[_0xa6f7('0xd7')]||undefined,'CampaignId':_0x48a29f['CampaignId']||undefined})[_0xa6f7('0xb8')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x48a29f[_0xa6f7('0x102')]>=_0x57171a[_0xa6f7('0x1a4')]-0x1){return!![];}this[_0xa6f7('0xc0')]({'active':![],'countagentrejectretry':_0x48a29f[_0xa6f7('0x102')]+=0x1,'scheduledat':moment()[_0xa6f7('0xfb')](_0x57171a[_0xa6f7('0x1a5')],_0xa6f7('0xfc'))[_0xa6f7('0x77')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x48a29f[_0xa6f7('0xd5')],'ListId':_0x48a29f[_0xa6f7('0xfd')],'VoiceQueueId':_0x48a29f[_0xa6f7('0xd7')]||undefined,'CampaignId':_0x48a29f[_0xa6f7('0xd8')]||undefined})['catch'](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0xa6f7('0x1a')][_0xa6f7('0x196')]=function(_0xb8568f,_0x5b6bb7,_0x5adfba){var _0x37cd05=this;var _0x3c1b89=new History(_0xb8568f);return new BPromise(function(_0x45c91b,_0x5b5ac4){if(_[_0xa6f7('0x3a')](_0x5b6bb7)&&typeof _0x5b6bb7!==_0xa6f7('0x166')){return _0x5b5ac4(msgResponse(_0xa6f7('0x1a6'),_0xa6f7('0x145'),_0xa6f7('0x1a7')));}if(_[_0xa6f7('0x3a')](_0x5adfba)&&typeof _0x5adfba!==_0xa6f7('0x166')){return _0x5b5ac4(msgResponse(_0xa6f7('0x1a6'),_0xa6f7('0x145'),_0xa6f7('0x1a8')));}switch(_0x5adfba[_0xa6f7('0x10f')]){case'0':_0x5b6bb7[_0xa6f7('0x65')]+=0x1;_0x3c1b89[_0xa6f7('0xa8')]=0x0;_0x3c1b89[_0xa6f7('0xe7')]=_0xa6f7('0x1a9');_0x3c1b89[_0xa6f7('0x101')]+=0x1;_0x3c1b89['countglobal']+=0x1;ami[_0xa6f7('0x4a')](_0xa6f7('0x1aa'),ut[_0xa6f7('0xec')](_0xb8568f,'nosuchnumber'));_0x37cd05['createHistory'](_0x3c1b89)[_0xa6f7('0xb8')](loggerCatch(_0xa6f7('0x1ab')));if(_0x37cd05['checkRetriveMax'](0x0,_0xb8568f,_0x5b6bb7)){if(_0x3c1b89[_0xa6f7('0x101')]>=_0x5b6bb7[_0xa6f7('0x19f')]){_0x37cd05[_0xa6f7('0x104')](_0x3c1b89,_0x45c91b,_0x5b5ac4,_0xa6f7('0x1ac'));}else{_0x37cd05[_0xa6f7('0xf9')](_0x3c1b89,_0x45c91b,_0x5b5ac4,_0xa6f7('0x1ac'));}}break;case'3':_0x5b6bb7[_0xa6f7('0x1ad')]+=0x1;_0x3c1b89[_0xa6f7('0xa8')]=0x3;_0x3c1b89[_0xa6f7('0xe7')]=_0xa6f7('0x1ae');_0x3c1b89[_0xa6f7('0xf5')]+=0x1;_0x3c1b89[_0xa6f7('0x100')]+=0x1;ami[_0xa6f7('0x4a')](_0xa6f7('0x1af'),ut[_0xa6f7('0xec')](_0xb8568f,_0xa6f7('0x1b0')));_0x37cd05['createHistory'](_0x3c1b89)['catch'](loggerCatch(_0xa6f7('0x1b1')));if(_0x37cd05['checkRetriveMax'](0x3,_0xb8568f,_0x5b6bb7)){if(_0x3c1b89[_0xa6f7('0xf5')]>=_0x5b6bb7['dialNoAnswerMaxRetry']){_0x37cd05[_0xa6f7('0x104')](_0x3c1b89,_0x45c91b,_0x5b5ac4,_0xa6f7('0x1b2'));}else{_0x37cd05[_0xa6f7('0xf9')](_0x3c1b89,_0x45c91b,_0x5b5ac4,_0xa6f7('0x1b2'));}}break;case'5':_0x5b6bb7[_0xa6f7('0x60')]+=0x1;_0x3c1b89['state']=0x5;_0x3c1b89[_0xa6f7('0xe7')]=_0xa6f7('0x1b3');_0x3c1b89['countbusyretry']+=0x1;_0x3c1b89[_0xa6f7('0x100')]+=0x1;ami[_0xa6f7('0x4a')](_0xa6f7('0x1b4'),ut[_0xa6f7('0xec')](_0xb8568f,_0xa6f7('0x1b5')));_0x37cd05[_0xa6f7('0xcc')](_0x3c1b89)[_0xa6f7('0xb8')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x37cd05[_0xa6f7('0x198')](0x5,_0xb8568f,_0x5b6bb7)){if(_0x3c1b89['countbusyretry']>=_0x5b6bb7[_0xa6f7('0x19b')]){_0x37cd05[_0xa6f7('0x104')](_0x3c1b89,_0x45c91b,_0x5b5ac4,'reason\x205\x20busy');}else{_0x37cd05['stateGlobal'](_0x3c1b89,_0x45c91b,_0x5b5ac4,_0xa6f7('0x1b6'));}}break;case'8':_0x5b6bb7[_0xa6f7('0x61')]+=0x1;_0x3c1b89[_0xa6f7('0xa8')]=0x8;_0x3c1b89[_0xa6f7('0xe7')]=_0xa6f7('0x1b7');_0x3c1b89['countcongestionretry']+=0x1;_0x3c1b89[_0xa6f7('0x100')]+=0x1;ami[_0xa6f7('0x4a')](_0xa6f7('0x1b8'),ut[_0xa6f7('0xec')](_0xb8568f,_0xa6f7('0x1b9')));_0x37cd05[_0xa6f7('0xcc')](_0x3c1b89)['catch'](loggerCatch(_0xa6f7('0x1ba')));if(_0x37cd05[_0xa6f7('0x198')](0x8,_0xb8568f,_0x5b6bb7)){if(_0x3c1b89[_0xa6f7('0xf4')]>=_0x5b6bb7['dialCongestionMaxRetry']){_0x37cd05['createStateFinal'](_0x3c1b89,_0x45c91b,_0x5b5ac4,_0xa6f7('0x1bb'));}else{_0x37cd05[_0xa6f7('0xf9')](_0x3c1b89,_0x45c91b,_0x5b5ac4,_0xa6f7('0x1bb'));}}break;case'11':_0x5b6bb7[_0xa6f7('0x1bc')]+=0x1;_0x3c1b89[_0xa6f7('0xa8')]=0xb;_0x3c1b89[_0xa6f7('0xe7')]=_0xa6f7('0x11f');_0x3c1b89[_0xa6f7('0xf7')]+=0x1;_0x3c1b89['countglobal']+=0x1;_0x37cd05['createHistory'](_0x3c1b89)[_0xa6f7('0xb8')](loggerCatch(_0xa6f7('0x124')));if(_0x37cd05['checkRetriveMax'](0xb,_0xb8568f,_0x5b6bb7)){if(_0x3c1b89[_0xa6f7('0xf7')]>=_0x5b6bb7[_0xa6f7('0x121')]){_0x37cd05[_0xa6f7('0x104')](_0x3c1b89,_0x45c91b,_0x5b5ac4,_0xa6f7('0x1bd'));}else{_0x37cd05[_0xa6f7('0xf9')](_0x3c1b89,_0x45c91b,_0x5b5ac4,_0xa6f7('0x1bd'));}}break;case'20':_0x5b6bb7[_0xa6f7('0x67')]+=0x1;_0x3c1b89[_0xa6f7('0xa8')]=0x14;_0x3c1b89[_0xa6f7('0xe7')]=_0xa6f7('0x1be');_0x3c1b89[_0xa6f7('0x102')]+=0x1;_0x3c1b89[_0xa6f7('0x100')]+=0x1;ami[_0xa6f7('0x4a')](_0xa6f7('0x1bf'),ut[_0xa6f7('0xec')](_0xb8568f,_0xa6f7('0x1c0')));_0x37cd05[_0xa6f7('0xcc')](_0x3c1b89)[_0xa6f7('0xb8')](loggerCatch(_0xa6f7('0x1c1')));if(_0x37cd05[_0xa6f7('0x198')](0x14,_0xb8568f,_0x5b6bb7)){if(_0x3c1b89[_0xa6f7('0x102')]>=_0x5b6bb7[_0xa6f7('0x1a4')]){_0x37cd05['createStateFinal'](_0x3c1b89,_0x45c91b,_0x5b5ac4,_0xa6f7('0x1c2'));}else{_0x37cd05['stateGlobal'](_0x3c1b89,_0x45c91b,_0x5b5ac4,_0xa6f7('0x1c2'));}}break;default:_0x5b6bb7[_0xa6f7('0x68')]+=0x1;_0x3c1b89['state']=0xc;_0x3c1b89['statedesc']=_0x5adfba['reason'];_0x37cd05['createHistory'](_0x3c1b89)['catch'](loggerCatch(_0xa6f7('0x1c3')));if(_0x37cd05[_0xa6f7('0x198')](_0x5adfba[_0xa6f7('0x10f')],_0xb8568f,_0x5b6bb7)){if(_0x3c1b89[_0xa6f7('0xf3')]+_0x3c1b89['countcongestionretry']+_0x3c1b89['countnoanswerretry']+_0x3c1b89[_0xa6f7('0x101')]+_0x3c1b89['countdropretry']+_0x3c1b89['countabandonedretry']+_0x3c1b89['countmachineretry']+_0x3c1b89[_0xa6f7('0x102')]>=_0x5b6bb7[_0xa6f7('0xf8')]){_0x37cd05['stateGlobal'](_0x3c1b89,_0x45c91b,_0x5b5ac4,_0x5adfba[_0xa6f7('0x10f')]);}else{_0x37cd05['createStateFinal'](_0x3c1b89,_0x45c91b,_0x5b5ac4,_0x5adfba['reason']);}}}});};Dialer[_0xa6f7('0x1a')][_0xa6f7('0xf9')]=function(_0x292821,_0x5e6ebe,_0x29b949,_0x2f220e){var _0x174dee=new Final(_0x292821);_0x174dee[_0xa6f7('0xa8')]=0xf;_0x174dee[_0xa6f7('0xe7')]='Global';this[_0xa6f7('0x104')](_0x174dee,_0x5e6ebe,_0x29b949,_0x2f220e);};Dialer[_0xa6f7('0x1a')][_0xa6f7('0x104')]=function(_0x1f4eb3,_0x5a65fa,_0x4a8982,_0x5752e8){this[_0xa6f7('0xca')](_0x1f4eb3)[_0xa6f7('0xb7')](function(){return _0x5a65fa(msgResponse(_0xa6f7('0x1a6'),_0xa6f7('0xdc'),_0x5752e8));})['catch'](function(){return _0x4a8982(msgResponse(_0xa6f7('0x1c4'),_0xa6f7('0x145'),'contact\x20not\x20moved'));});};Dialer['prototype'][_0xa6f7('0xb')]=function(_0x197eca){var _0x4e8faf=_0x197eca[_0xa6f7('0x1c5')]/0x64;var _0x11b203=_0x197eca[_0xa6f7('0x64')]/(_0x197eca[_0xa6f7('0x64')]+_0x197eca['outboundAnswerCallsDay']);var _0x449a98=Math[_0xa6f7('0x1c6')](_0x197eca[_0xa6f7('0x70')]*(_0x197eca[_0xa6f7('0x1c7')]/0x64));var _0x44c7d7=Math[_0xa6f7('0x1c6')](_0x197eca['predictiveIntervalAvailable']*(_0x197eca['predictiveIntervalMinThreshold']/0x64));var _0x502ce4=_0x197eca[_0xa6f7('0xa1')]+_0x197eca['talking'];var _0x2f6cdc=Math['floor'](_0x197eca[_0xa6f7('0x72')]*_0x197eca[_0xa6f7('0x8a')]*_0x197eca[_0xa6f7('0x6d')]*_0x197eca['predictiveIntervalMultiplicativeFactor']);if(_['isUndefined'](_0x197eca[_0xa6f7('0x29')])){if(!_[_0xa6f7('0x3a')](_0x197eca[_0xa6f7('0x28')])){_0x197eca[_0xa6f7('0x28')]=undefined;loggerPredictive[_0xa6f7('0x94')](_0xa6f7('0x1c8'),_0xa6f7('0x1c9'));}if(!_['isUndefined'](_0x197eca['handlePredictive'])){loggerPredictive['error'](_0xa6f7('0x1c8'),_0xa6f7('0x1ca'));clearInterval(_0x197eca[_0xa6f7('0x8e')]);_0x197eca[_0xa6f7('0x8e')]=undefined;}_0x197eca['startProgressive']=moment()['format'](_0xa6f7('0x107'));loggerPredictive[_0xa6f7('0x7a')](_0x197eca[_0xa6f7('0x3c')],'collection\x20data\x20in\x20progressive\x20at',_0x197eca[_0xa6f7('0x29')]);this[_0xa6f7('0x157')](_0x197eca,0x1);}else if(ifInterval(_0x197eca[_0xa6f7('0x1cb')],_0x197eca['startProgressive'])){this[_0xa6f7('0x157')](_0x197eca,0x1);loggerPredictiveCalls[_0xa6f7('0x7a')](_0xa6f7('0x1cc'),_0x197eca['startProgressive'],_0x197eca[_0xa6f7('0x3c')]);_0x197eca[_0xa6f7('0x72')]=0x0;_0x197eca['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x4e8faf<_0x11b203&&_0x197eca[_0xa6f7('0x1cd')]===_0xa6f7('0x1ce')){freeVariablesPredictive(_0x197eca);loggerPredictive[_0xa6f7('0x7a')](_0xa6f7('0x1cf'),'Dropped\x20calls\x20day',_0x11b203,'startProgressive',_0x197eca['name']);}else if(_0x2f6cdc<_0x197eca[_0xa6f7('0x6c')]&&_0x197eca[_0xa6f7('0x1cd')]===_0xa6f7('0x1ce')){freeVariablesPredictive(_0x197eca);loggerPredictive[_0xa6f7('0x7a')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0xa6f7('0x1d0'),_0x2f6cdc,_0xa6f7('0x1d1'),_0x197eca[_0xa6f7('0x6c')],_0xa6f7('0x29'),_0x197eca['name']);}else if(!ifInterval(_0x197eca[_0xa6f7('0x1cb')],_0x197eca['startProgressive'])&&_[_0xa6f7('0x3a')](_0x197eca['startPredictive'])&&!_['isUndefined'](_0x197eca[_0xa6f7('0x29')])){_0x197eca[_0xa6f7('0x28')]=moment()[_0xa6f7('0x77')](_0xa6f7('0x107'));loggerPredictive[_0xa6f7('0x7a')](_0x197eca[_0xa6f7('0x3c')],_0xa6f7('0x1d2'),_0x197eca[_0xa6f7('0x28')]);this[_0xa6f7('0xbe')](_0x197eca[_0xa6f7('0x1cb')])[_0xa6f7('0xb7')](this[_0xa6f7('0x1d3')](_0x197eca))['then'](mergeDataErlangB(_0x197eca))[_0xa6f7('0xb7')](this[_0xa6f7('0x1d4')](_0x197eca))[_0xa6f7('0xb8')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x197eca));}else if(!ifInterval(_0x197eca[_0xa6f7('0x1cb')],_0x197eca['startPredictive'])){_0x197eca[_0xa6f7('0x6c')]=0x0;_0x197eca['startPredictive']=moment()[_0xa6f7('0x77')](_0xa6f7('0x107'));loggerPredictive[_0xa6f7('0x7a')](_0x197eca[_0xa6f7('0x3c')],_0xa6f7('0x1d5'),_0x197eca[_0xa6f7('0x28')]);clearInterval(_0x197eca[_0xa6f7('0x8e')]);_0x197eca['handlePredictive']=undefined;this['averageHandleTime'](_0x197eca[_0xa6f7('0x1cb')])[_0xa6f7('0xb7')](this[_0xa6f7('0x1d3')](_0x197eca))[_0xa6f7('0xb7')](mergeDataErlangB(_0x197eca))[_0xa6f7('0xb7')](this[_0xa6f7('0x1d4')](_0x197eca))[_0xa6f7('0xb8')](loggerCatchPredictive(_0xa6f7('0x1d6'),_0x197eca));}else if(_0x197eca['predictiveIntervalAvailable']&&_0x502ce4<_0x197eca[_0xa6f7('0x70')]-_0x44c7d7){freeVariablesPredictive(_0x197eca);loggerPredictive[_0xa6f7('0x7a')](_0x197eca[_0xa6f7('0x3c')],_0xa6f7('0x1d7'),_0x502ce4,')\x20are\x20less\x20than\x20threshold\x20(',_0x197eca[_0xa6f7('0x70')],'-',_0x44c7d7,'=',_0x197eca['predictiveIntervalAvailable']-_0x44c7d7,')');}else if(_0x197eca[_0xa6f7('0x70')]&&_0x502ce4>_0x197eca['predictiveIntervalAvailable']+_0x449a98){freeVariablesPredictive(_0x197eca);loggerPredictive[_0xa6f7('0x7a')](_0x197eca['name'],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x502ce4,_0xa6f7('0x1d8'),_0x197eca[_0xa6f7('0x70')],'+',_0x449a98,'=',_0x197eca[_0xa6f7('0x70')]+_0x449a98,')');}};Dialer[_0xa6f7('0x1a')]['getDataPredictive']=function(_0x13f7dd){var _0x45e6c0=this;return function(_0x3e7eb7){return new BPromise(function(_0x474a9d,_0x278d22){_['merge'](_0x13f7dd,_0x3e7eb7[0x0]);if(checkGetDataPredictive(_0x3e7eb7[0x0])){var _0x48c001=_0x13f7dd['predictiveIntervalAvailable']=_0x13f7dd[_0xa6f7('0xa0')]+_0x13f7dd['available'];var _0x2a588e=_0x13f7dd['dialPredictiveInterval']*0x3c;var _0x41a8be=_0x3e7eb7[0x0]['predictiveIntervalAvgTalktime']+_0x3e7eb7[0x0][_0xa6f7('0x6a')];var _0x3cd900=(_0x3e7eb7[0x0][_0xa6f7('0x69')]+_0x3e7eb7[0x0][_0xa6f7('0x7f')]+_0x3e7eb7[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x3e7eb7[0x0][_0xa6f7('0x71')];_0x13f7dd[_0xa6f7('0x6d')]=_0x3cd900>0x0?_0x3cd900:0x1;switch(_0x13f7dd[_0xa6f7('0x1cd')]){case _0xa6f7('0x1ce'):var _0x5ab36a=_0x13f7dd[_0xa6f7('0x1c5')]/0x64;return _0x45e6c0['abandonmentRate'](_0x48c001,_0x2a588e,_0x41a8be,_0x3cd900,_0x5ab36a)[_0xa6f7('0xb7')](function(_0x11d25e){return _0x474a9d(_0x11d25e);});case _0xa6f7('0x1d9'):var _0x1e9732=_0x13f7dd[_0xa6f7('0x1c5')]/0x64;return _0x45e6c0[_0xa6f7('0x1da')](_0x48c001,_0x2a588e,_0x41a8be,_0x3cd900,_0x1e9732)['then'](function(_0x4045d4){return _0x474a9d(_0x4045d4);});default:return _0x278d22(msgResponse(_0xa6f7('0x1db'),_0xa6f7('0x145'),_0xa6f7('0x1dc')));}}else{return _0x278d22(msgResponse(_0xa6f7('0x1db'),'Failure',_0xa6f7('0x1dd')));}});};};Dialer[_0xa6f7('0x1a')][_0xa6f7('0x1de')]=function(_0x26a24d){var _0x220f25=this;return function(_0x1423c4){return new BPromise(function(_0x182df6,_0x402b9f){_[_0xa6f7('0x8c')](_0x26a24d,_0x1423c4[0x0]);if(checkGetDataPredictive(_0x1423c4[0x0])){loggerPredictive[_0xa6f7('0x7a')](JSON['stringify'](_0x1423c4[0x0]));if(_0x26a24d['dialPredictiveOptimization']===_0xa6f7('0x1ce')){return _0x220f25[_0xa6f7('0xc8')](_0x26a24d['id'])['then'](function(_0x4837aa){var _0x315fd5=_0x26a24d['loggedIn']-_0x4837aa[0x0][_0xa6f7('0x1df')];var _0x3bcfe4=_0x26a24d[_0xa6f7('0x1cb')]*0x3c;var _0x14a5fc=_0x1423c4[0x0][_0xa6f7('0x84')]+_0x1423c4[0x0][_0xa6f7('0x6a')];var _0x4f38b7=(_0x1423c4[0x0][_0xa6f7('0x69')]+_0x1423c4[0x0][_0xa6f7('0x7f')]+_0x1423c4[0x0][_0xa6f7('0x6b')])/_0x1423c4[0x0][_0xa6f7('0x71')];var _0x17f815=_0x26a24d['dialPredictiveOptimizationPercentage']/0x64;_0x26a24d[_0xa6f7('0x6f')]=_0x4837aa[0x0][_0xa6f7('0x1df')]||0x0;_0x26a24d[_0xa6f7('0x6d')]=_0x4f38b7>0x0?_0x4f38b7:0x1;return _0x220f25['abandonmentRate'](_0x315fd5,_0x3bcfe4,_0x14a5fc,_0x4f38b7,_0x17f815);})['then'](function(_0x4cdc41){return _0x182df6(_0x4cdc41);})['catch'](function(_0x4664bc){return _0x402b9f(msgResponse('[CatchErlangB]','Failure',JSON[_0xa6f7('0x46')](_0x4664bc)));});}if(_0x26a24d[_0xa6f7('0x1cd')]===_0xa6f7('0x1d9')){return _0x220f25[_0xa6f7('0xc8')](_0x26a24d['id'])[_0xa6f7('0xb7')](function(_0x3e40f9){var _0x3ddefe=_0x26a24d['loggedIn']-_0x3e40f9[0x0]['outboundQueuePauses'];var _0x133eb3=_0x26a24d['dialPredictiveInterval']*0x3c;var _0x8e545e=_0x1423c4[0x0][_0xa6f7('0x84')]+_0x1423c4[0x0][_0xa6f7('0x6a')];var _0x422913=(_0x1423c4[0x0][_0xa6f7('0x69')]+_0x1423c4[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x1423c4[0x0][_0xa6f7('0x6b')])/_0x1423c4[0x0][_0xa6f7('0x71')];var _0x301eba=_0x26a24d[_0xa6f7('0x1c5')]/0x64;_0x26a24d['predictiveIntervalPauses']=_0x3e40f9[0x0][_0xa6f7('0x1df')]||0x0;_0x26a24d[_0xa6f7('0x6d')]=_0x422913>0x0?_0x422913:0x1;return _0x220f25['busyFactor'](_0x3ddefe,_0x133eb3,_0x8e545e,_0x422913,_0x301eba);})[_0xa6f7('0xb7')](function(_0x240e36){return _0x182df6(_0x240e36);})[_0xa6f7('0xb8')](function(_0xdaf0b){return _0x402b9f(msgResponse('[CatchErlangB]',_0xa6f7('0x145'),JSON['stringify'](_0xdaf0b)));});}}else{return _0x402b9f(msgResponse('[getDataPredictive]','Failure',_0xa6f7('0x1dd')));}});};};Dialer[_0xa6f7('0x1a')]['startMethodPredictive']=function(_0x3a6d7d){var _0x4b5bd8=this;return function(){var _0x53afa6=0x0;var _0x586593=Math[_0xa6f7('0x1e0')](_0x3a6d7d['erlangCallToSecond']*0x3e8);if(_0x586593>0x0){_0x586593=_0x586593<0x64?0x64:_0x586593;loggerPredictive['info'](_0x3a6d7d[_0xa6f7('0x3c')],_0xa6f7('0x1e1'),_0x586593,_0xa6f7('0x47'));_0x3a6d7d[_0xa6f7('0x8e')]=setInterval(function(){_0x4b5bd8['handlePredictive'](_0x3a6d7d);loggerPredictiveCalls[_0xa6f7('0x7a')](_0xa6f7('0x1e2'),_0x53afa6+=0x1);},_0x586593);}else{loggerPredictive[_0xa6f7('0x7a')](_0x3a6d7d[_0xa6f7('0x3c')],_0xa6f7('0x1e3'));}};};Dialer[_0xa6f7('0x1a')][_0xa6f7('0x1e4')]=function(_0x4ea419,_0x5e544f){var _0x3d72e1=this;return function(_0x396dc5){if(_[_0xa6f7('0x43')](_0x396dc5)){if(_[_0xa6f7('0xe2')](_0x5e544f['UserId'])||!_0x5e544f[_0xa6f7('0x1e5')]){if(_0x4ea419[_0xa6f7('0x5a')]===_0xa6f7('0xa')){_0x4ea419['queueStatusComplete']=_[_0xa6f7('0x3a')](_0x4ea419['queueStatusComplete'])?!![]:_0x4ea419['queueStatusComplete'];var _0x2163d0=uuid['v4']();_0x3d72e1['actions'][_0x2163d0]=new Action(_0x4ea419,_0x5e544f,_0x2163d0);loggerBooked[_0xa6f7('0x7a')]('[booked][checkContactBlack]',_0x2163d0,_0xa6f7('0x1e6'),JSON[_0xa6f7('0x46')](_0x4ea419[_0xa6f7('0x12d')]),_0xa6f7('0x1e7'),_0x4ea419['name']);if(_0x4ea419[_0xa6f7('0x12d')]){_0x4ea419['queueStatusComplete']=![];_0x3d72e1[_0xa6f7('0x12a')][_0x3d72e1[_0xa6f7('0x25')][_0x2163d0][_0xa6f7('0xb2')]]=[];ami[_0xa6f7('0x14e')]({'actionid':_0x2163d0,'action':_0xa6f7('0x1e8'),'queue':_0x4ea419[_0xa6f7('0x3c')]})[_0xa6f7('0xb8')](function(){_0x3d72e1[_0xa6f7('0xcd')](_0x4ea419);_0x3d72e1[_0xa6f7('0xc0')]({'active':![],'ContactId':_0x3d72e1[_0xa6f7('0x25')][_0x2163d0]['ContactId'],'ListId':_0x3d72e1[_0xa6f7('0x25')][_0x2163d0]['ListId'],'VoiceQueueId':_0x3d72e1['actions'][_0x2163d0][_0xa6f7('0xd7')]||undefined,'CampaignId':_0x3d72e1[_0xa6f7('0x25')][_0x2163d0][_0xa6f7('0xd8')]||undefined})[_0xa6f7('0xb8')](loggerCatch(_0xa6f7('0x1e9')));delete _0x3d72e1[_0xa6f7('0x25')][_0x2163d0];});}else{loggerBooked[_0xa6f7('0x7a')](_0xa6f7('0x1ea'),JSON['stringify'](_0x4ea419[_0xa6f7('0x12d')]),'Queue:\x20',_0x4ea419[_0xa6f7('0x3c')]);_0x3d72e1[_0xa6f7('0xcd')](_0x4ea419);_0x3d72e1['rescheduleContact']({'active':![],'ContactId':_0x3d72e1[_0xa6f7('0x25')][_0x2163d0]['ContactId'],'ListId':_0x3d72e1[_0xa6f7('0x25')][_0x2163d0][_0xa6f7('0xfd')],'VoiceQueueId':_0x3d72e1[_0xa6f7('0x25')][_0x2163d0][_0xa6f7('0xd7')]||undefined,'CampaignId':_0x3d72e1[_0xa6f7('0x25')][_0x2163d0][_0xa6f7('0xd8')]||undefined})[_0xa6f7('0xb8')](loggerCatch(_0xa6f7('0x1e9')));delete _0x3d72e1[_0xa6f7('0x25')][_0x2163d0];}}else{return _0x3d72e1[_0xa6f7('0x165')](_0x4ea419,_0x5e544f);}}else{if(getDiff(_0x5e544f[_0xa6f7('0x1eb')])<_0x4ea419[_0xa6f7('0x1ec')]*0x3c){if(_0x5e544f[_0xa6f7('0x1ed')]&&!_0x5e544f['Agent']['voicePause']){_0x3d72e1[_0xa6f7('0x1e')]['run'](_0x5e544f['id'])[_0xa6f7('0x1c')](function(){_0x3d72e1[_0xa6f7('0xcd')](_0x4ea419);});}else{_0x3d72e1[_0xa6f7('0x1ee')]({'active':![]},_0x5e544f['id'],0x1)[_0xa6f7('0x1c')](function(){_0x3d72e1[_0xa6f7('0xcd')](_0x4ea419);});}}else{_0x4ea419[_0xa6f7('0x1ef')]+=0x1;_0x3d72e1[_0xa6f7('0xcd')](_0x4ea419);if(_0x4ea419['dialRecallInQueue']){_0x3d72e1[_0xa6f7('0xc0')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x5e544f[_0xa6f7('0xd5')],'ListId':_0x5e544f[_0xa6f7('0xfd')],'VoiceQueueId':_0x5e544f[_0xa6f7('0xd7')]||undefined,'CampaignId':_0x5e544f[_0xa6f7('0xd8')]||undefined})['catch'](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x3d72e1[_0xa6f7('0xcc')](createObjHistory(_0x4ea419,_0x5e544f,_0xa6f7('0x1f0'),0x17,_0xa6f7('0x1f1')))[_0xa6f7('0xb8')](loggerCatch(_0xa6f7('0x1f2')));}else{_0x3d72e1[_0xa6f7('0xd3')](createObjHistory(_0x4ea419,_0x5e544f,_0xa6f7('0x1f3'),0x16,_0xa6f7('0x1f4')),_0xa6f7('0x1f5'),_0xa6f7('0x1f6'));}}}}else{_0x4ea419[_0xa6f7('0x5f')]+=0x1;_0x3d72e1[_0xa6f7('0xd3')](createObjHistory(_0x4ea419,_0x5e544f,'BLACKLIST',0xd,_0xa6f7('0x1f7')),_0xa6f7('0x1f8'),_0xa6f7('0x1f9'));throw'inBlackList';}};};Dialer['prototype'][_0xa6f7('0x1fa')]=function(_0x4654e6){var _0x5837a7=this;var _0x542f01=_0x4654e6['limitCalls']-_0x4654e6[_0xa6f7('0x97')]-_0x4654e6[_0xa6f7('0xc4')];emitCampaignSummary(_0x4654e6);if(_0x542f01>0x0){if(_0x542f01>this['maxNumberOriginate']){_0x542f01=this['maxNumberOriginate'];}_0x4654e6['temp']+=_0x542f01;this[_0xa6f7('0xc6')](_0x4654e6['id'],_0x542f01,_0x4654e6['dialOrderByScheduledAt'],_0x4654e6)[_0xa6f7('0xb7')](function(_0x595f6a){_0x4654e6[_0xa6f7('0xc4')]-=_0x542f01;_0x4654e6[_0xa6f7('0xc4')]=_0x4654e6[_0xa6f7('0xc4')]>0x0?_0x4654e6[_0xa6f7('0xc4')]:0x0;if(!checkContactEmpty(_0x595f6a)){_0x4654e6['message']='AVAILABLE_CONTACTS_FINISHED';logger[_0xa6f7('0x7a')](_0xa6f7('0x1fb')+_0x4654e6[_0xa6f7('0x3c')]);}else{_0x4654e6['originated']+=_0x595f6a[_0xa6f7('0x96')];_0x4654e6[_0xa6f7('0x3b')]=_0xa6f7('0x1fc');for(var _0x1b2920=0x0;_0x1b2920<_0x595f6a['length'];_0x1b2920+=0x1){_0x4654e6['ivrTotalCallsDays']+=0x1;if(_[_0xa6f7('0xe2')](_0x595f6a[_0x1b2920])||_[_0xa6f7('0xe2')](_0x595f6a[_0x1b2920][_0xa6f7('0x167')])||_[_0xa6f7('0xe2')](_0x595f6a[_0x1b2920][_0xa6f7('0x167')][_0xa6f7('0x18c')])){_0x5837a7[_0xa6f7('0xd1')](_0xa6f7('0x1fd'),_0x4654e6,_0x595f6a[_0x1b2920]);}else{_0x5837a7[_0xa6f7('0xbc')](_['pick'](_0x595f6a[_0x1b2920],[_0xa6f7('0xd8'),_0xa6f7('0x1fe')]))['then'](_0x5837a7[_0xa6f7('0x1e4')](_0x4654e6,_0x595f6a[_0x1b2920]))['catch'](_0x5837a7[_0xa6f7('0xd0')](_0xa6f7('0x1ff'),_0x4654e6));}}}})[_0xa6f7('0xb8')](loggerGetContactDialer(_0xa6f7('0x200'),_0x4654e6,_0x542f01));}};Dialer[_0xa6f7('0x1a')][_0xa6f7('0x157')]=function(_0x4d4176,_0x3f41bf){var _0x287ed5=this;var _0x177dbb=[];var _0x2fbc72=_0x3f41bf>=0x1?_0x3f41bf:0x1;if(_0x4d4176[_0xa6f7('0x5a')]==='booked'){_0x2fbc72=0x1;}var _0x13034a=Math[_0xa6f7('0x1e0')](_0x4d4176[_0xa6f7('0xa1')]*_0x2fbc72)-_0x4d4176['originated']-_0x4d4176[_0xa6f7('0xc4')];emitVoiceQueueSummary(_0x4d4176);if(_0x4d4176[_0xa6f7('0x201')]>0x0){var _0x1ad53b=_0x4d4176[_0xa6f7('0x201')]-_0x4d4176[_0xa6f7('0x97')]-_0x4d4176[_0xa6f7('0xa0')]-_0x4d4176['temp']-_0x4d4176[_0xa6f7('0x50')];if(_0x13034a>_0x1ad53b){_0x13034a=_0x1ad53b;}}if(_0x13034a>0x0){if(_0x4d4176['dialMethod']==='booked'){_0x13034a=0x1;}if(_0x13034a>this[_0xa6f7('0x23')]){_0x13034a=this[_0xa6f7('0x23')];}_0x4d4176[_0xa6f7('0xc4')]+=_0x13034a;for(var _0x2b3d5a in this['agents']){if(typeof this['agents'][_0x2b3d5a]!=='undefined'){if(this['agents'][_0x2b3d5a][_0xa6f7('0xa8')]===_0xa6f7('0x202')&&this[_0xa6f7('0x21')][_0x2b3d5a][_0xa6f7('0xaf')]===_0xa6f7('0xe0')){_0x177dbb[_0xa6f7('0x12b')](this[_0xa6f7('0x21')][_0x2b3d5a]['id']);}}}this[_0xa6f7('0xc3')](_0x4d4176['id'],_0x177dbb,_0x13034a,_0x4d4176[_0xa6f7('0x203')],_0x4d4176)[_0xa6f7('0xb7')](function(_0x1520e9){_0x4d4176[_0xa6f7('0xc4')]-=_0x13034a;_0x4d4176[_0xa6f7('0xc4')]=_0x4d4176[_0xa6f7('0xc4')]>0x0?_0x4d4176[_0xa6f7('0xc4')]:0x0;if(!checkContactEmpty(_0x1520e9)){_0x287ed5[_0xa6f7('0xb5')](_0x4d4176)[_0xa6f7('0xb7')](sendMessageReschedule(_0x4d4176))['catch'](loggerCatch(_0xa6f7('0xb9')));}else{_0x4d4176['originated']+=_0x1520e9['length'];_0x4d4176[_0xa6f7('0x3b')]=_0x4d4176[_0xa6f7('0x5a')]==='booked'?_0xa6f7('0x170'):'RUNNING';for(var _0x45bd95=0x0;_0x45bd95<_0x1520e9[_0xa6f7('0x96')];_0x45bd95+=0x1){if(_[_0xa6f7('0xe2')](_0x1520e9[_0x45bd95])||_[_0xa6f7('0xe2')](_0x1520e9[_0x45bd95]['Contact'])||_[_0xa6f7('0xe2')](_0x1520e9[_0x45bd95][_0xa6f7('0x167')][_0xa6f7('0x18c')])){_0x287ed5['emptyContact'](_0xa6f7('0x1fd'),_0x4d4176,_0x1520e9[_0x45bd95]);}else{_0x287ed5[_0xa6f7('0xba')](_[_0xa6f7('0xd4')](_0x1520e9[_0x45bd95],['VoiceQueueId',_0xa6f7('0x1fe')]))[_0xa6f7('0xb7')](_0x287ed5[_0xa6f7('0x1e4')](_0x4d4176,_0x1520e9[_0x45bd95]))['catch'](_0x287ed5[_0xa6f7('0xd0')](_0xa6f7('0x1fd'),_0x4d4176));}}}})['catch'](loggerGetContactDialer(_0xa6f7('0x204'),_0x4d4176,_0x13034a));}};Dialer[_0xa6f7('0x1a')][_0xa6f7('0x8e')]=function(_0xcf70fb){if(_0xcf70fb['dialLimitQueue']>0x0){var _0x58147c=_0xcf70fb[_0xa6f7('0x201')]-_0xcf70fb['originated']-_0xcf70fb[_0xa6f7('0xa0')];if(_0x58147c>0x0){this[_0xa6f7('0x205')](_0xcf70fb);}else{loggerPredictiveCalls[_0xa6f7('0x7a')](_0xa6f7('0x206'));}}else{this[_0xa6f7('0x205')](_0xcf70fb);}};Dialer['prototype'][_0xa6f7('0x205')]=function(_0x51b945){var _0x19ae8e=this;var _0x5cb39f=[];_0x51b945[_0xa6f7('0x97')]+=0x1;for(var _0x5ad45d in this[_0xa6f7('0x21')]){if(typeof this['agents'][_0x5ad45d]!==_0xa6f7('0x98')){if(this[_0xa6f7('0x21')][_0x5ad45d][_0xa6f7('0xa8')]===_0xa6f7('0x202')&&this['agents'][_0x5ad45d][_0xa6f7('0xaf')]===_0xa6f7('0xe0')){_0x5cb39f[_0xa6f7('0x12b')](this[_0xa6f7('0x21')][_0x5ad45d]['id']);}}}this[_0xa6f7('0xc3')](_0x51b945['id'],_0x5cb39f,0x1,_0x51b945['dialOrderByScheduledAt'],_0x51b945)[_0xa6f7('0xb7')](function(_0x4d5563){if(!checkContactEmpty(_0x4d5563)){checkContactLowerLimitOriginate(_0x51b945,0x1,0x0);_0x19ae8e[_0xa6f7('0xb5')](_0x51b945)[_0xa6f7('0xb7')](sendMessageReschedule(_0x51b945))['catch'](loggerCatch(_0xa6f7('0xb9')));}else{_0x51b945[_0xa6f7('0x3b')]=_0xa6f7('0x1fc');if(_['isNil'](_0x4d5563[0x0])||_[_0xa6f7('0xe2')](_0x4d5563[0x0]['Contact'])||_[_0xa6f7('0xe2')](_0x4d5563[0x0][_0xa6f7('0x167')][_0xa6f7('0x18c')])){_0x19ae8e[_0xa6f7('0xd1')](_0xa6f7('0x1fd'),_0x51b945,_0x4d5563[0x0]);}else{_0x19ae8e[_0xa6f7('0xba')](_[_0xa6f7('0xd4')](_0x4d5563[0x0],[_0xa6f7('0xd7'),_0xa6f7('0x1fe')]))['then'](_0x19ae8e['checkContactBlack'](_0x51b945,_0x4d5563[0x0]))[_0xa6f7('0xb8')](_0x19ae8e['loggerHandler']('[actionOriginatePredictive]\x20',_0x51b945));}}})['catch'](loggerGetContactDialer(_0xa6f7('0x207'),_0x51b945,0x1));emitVoiceQueueSummary(_0x51b945);};Dialer[_0xa6f7('0x1a')][_0xa6f7('0x208')]=function(_0x1551d7,_0x5ce3e6,_0x5b2bf1,_0x21512f,_0x32be08,_0x38481d){loggerPredictive[_0xa6f7('0x7a')](_0xa6f7('0x209'));loggerPredictive['info'](_0xa6f7('0x20a'),_0x1551d7);loggerPredictive[_0xa6f7('0x7a')](_0xa6f7('0x20b'),_0x5ce3e6);loggerPredictive[_0xa6f7('0x7a')](_0xa6f7('0x20c'),_0x5b2bf1);loggerPredictive[_0xa6f7('0x7a')](_0xa6f7('0x20d'),_0x21512f);loggerPredictive[_0xa6f7('0x7a')](_0xa6f7('0x20e'),_0x32be08);loggerPredictive[_0xa6f7('0x7a')](_0xa6f7('0x83'));return new BPromise(function(_0xce5eaa,_0x44e7b7){if(_0x1551d7<=0x0||isNaN(_0x1551d7)){return _0x44e7b7(msgResponse(_0xa6f7('0x20f'),_0xa6f7('0x45'),_0xa6f7('0x210')+_0x1551d7));}if(_0x5b2bf1<=0x0||isNaN(_0x5b2bf1)){return _0x44e7b7(msgResponse('[abandonmentRate]',_0xa6f7('0x45'),'Ts\x20=\x20'+_0x5b2bf1));}if(_0x21512f<=0x0||isNaN(_0x21512f)){return _0x44e7b7(msgResponse('[abandonmentRate]',_0xa6f7('0x45'),_0xa6f7('0x211')+_0x21512f));}if(_0x5ce3e6<=0x0||isNaN(_0x5ce3e6)){return _0x44e7b7(msgResponse(_0xa6f7('0x20f'),_0xa6f7('0x45'),_0xa6f7('0x212')+_0x5ce3e6));}if(_0x32be08<=0x0||isNaN(_0x32be08)){return _0x44e7b7(msgResponse(_0xa6f7('0x20f'),_0xa6f7('0x45'),_0xa6f7('0x213')+_0x32be08));}_0x38481d=_0x38481d||0x0;var _0x1ce491=0x1/_0x5b2bf1;var _0x18b571=0x0;var _0x2f4f08=0x0;var _0x43a3d1=0x0;var _0x11fbf8=0x0;for(var _0xdc5e18=0x0;_0x43a3d1<_0x32be08;_0xdc5e18+=0x1){_0x2f4f08=_0xdc5e18/_0x5ce3e6;_0x18b571=(_0x21512f*_0x2f4f08+_0x38481d)/_0x1ce491;_0x43a3d1=erlangb(_0x18b571,_0x1551d7);_0x11fbf8=_0x18b571/_0x1551d7*(0x1-erlangb(_0x18b571,_0x1551d7));}return _0xce5eaa({'erlangCalls':_0xdc5e18,'erlangCallToSecond':_0x5ce3e6/_0xdc5e18,'erlangAbandonmentRate':_0x43a3d1,'erlangBusyFactor':_0x11fbf8});});};Dialer[_0xa6f7('0x1a')][_0xa6f7('0x1da')]=function(_0x247597,_0x170c15,_0x36b15b,_0x57b256,_0x2b8da1,_0x408c29){loggerPredictive[_0xa6f7('0x7a')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0xa6f7('0x7a')](_0xa6f7('0x20a'),_0x247597);loggerPredictive[_0xa6f7('0x7a')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x170c15);loggerPredictive['info'](_0xa6f7('0x20c'),_0x36b15b);loggerPredictive['info'](_0xa6f7('0x20d'),_0x57b256);loggerPredictive[_0xa6f7('0x7a')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2b8da1);loggerPredictive[_0xa6f7('0x7a')](_0xa6f7('0x83'));return new BPromise(function(_0x5539c6,_0x1584e7){if(_0x247597<=0x0||isNaN(_0x247597)){return _0x1584e7(msgResponse(_0xa6f7('0x214'),'Error','m\x20=\x20'+_0x247597));}if(_0x36b15b<=0x0||isNaN(_0x36b15b)){return _0x1584e7(msgResponse('[busyFactor]',_0xa6f7('0x45'),_0xa6f7('0x215')+_0x36b15b));}if(_0x57b256<=0x0||isNaN(_0x57b256)){return _0x1584e7(msgResponse(_0xa6f7('0x214'),_0xa6f7('0x45'),'p\x20=\x20'+_0x57b256));}if(_0x170c15<=0x0||isNaN(_0x170c15)){return _0x1584e7(msgResponse(_0xa6f7('0x214'),_0xa6f7('0x45'),'interval\x20=\x20'+_0x170c15));}if(_0x2b8da1<=0x0||isNaN(_0x2b8da1)){return _0x1584e7(msgResponse(_0xa6f7('0x214'),'Error',_0xa6f7('0x216')+_0x2b8da1));}_0x408c29=_0x408c29||0x0;var _0x4217ab=0x1/_0x36b15b;var _0x4f961a=0x0;var _0x174b65=0x0;var _0x3f8be7=0x0;var _0x5a53a0=0x0;for(var _0x42e234=0x0;_0x5a53a0<_0x2b8da1;_0x42e234+=0x1){_0x174b65=_0x42e234/_0x170c15;_0x4f961a=(_0x57b256*_0x174b65+_0x408c29)/_0x4217ab;_0x3f8be7=erlangb(_0x4f961a,_0x247597);_0x5a53a0=_0x4f961a/_0x247597*(0x1-erlangb(_0x4f961a,_0x247597));}return _0x5539c6({'erlangCalls':_0x42e234,'erlangCallToSecond':_0x170c15/_0x42e234,'erlangAbandonmentRate':_0x3f8be7,'erlangBusyFactor':_0x5a53a0});});};module[_0xa6f7('0x217')]=Dialer; \ No newline at end of file +var _0x1542=['[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','Machine','countdropretry','reason\x2019\x20machine....','minutes','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AGI','cause-txt','Unknow','reason','agent','agiafterat','dialQueueProject2','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','dialQueueTimeout','outboundDropCallsDayTimeout','Drop','dropreason','TIMEOUT','dialDropMaxRetry','dialDropRetryFrequency','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','CALLEREXIT','dialAbandonedRetryFrequency','Abandoned','[syncAgentComplete][createHistory][11]','actionid','locked','paused','stateinterface','rrmemory','queueBooked','idHopper','queueStatusComplete','[booked][unlockQueueStatus]','roundrobin','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','contactAgent-idHopper:\x20','run','[booked][RR][finaly]','Agent:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','INTERVAL_IS_EMPTY','Failure','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','length','push','command','iftime\x20%s,%s','interval','content','true','indexOf','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','progressive','handlePower','power','dialPowerLevel','booked','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialActive','dialGlobalInterval','dialTimezone','checkDialMethod','[syncQueueSummary]','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','originate','voiceQueue\x20is\x20undefine','phone','Contact','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','dialAMDMaximumWordLength','XMD-CAMPAIGNID','tags','updatedAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','[originateError]:\x20%s','[originate][error]','originate\x20action\x20Error','responsetime','getQueue','response','[callProgressDetecting]\x20','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','[rescheduleContact][Drop]','dialAbandonedMaxRetry','[callProgressDetecting]','evt\x20is\x20undefine','outboundNoSuchCallsDay','custom:agentnosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Max\x20Drop\x20','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalAnsweredCalls','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','Agent','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','BLACKLIST','inBlackList','limitCalls','dialOrderByScheduledAt','[getContactCampaign2][Empty]','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','checkContactBlack','[actionOriginateIvr]\x20','dialLimitQueue','not_inuse','RUNNING','[getContactDialer2]','[handlePredictive][limitChannel]','tryOriginatePredictive','[actionOriginatePredictive]\x20','--------\x20Drop\x20Rate\x20--------','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','p\x20=\x20','interval\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Ts\x20=\x20','exports','util','lodash','bluebird','uuid','moment','ioredis','../preview/util/util','../../../config/environment/','dialer','../../../config/logger','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/voiceQueueRt','./action','./final','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','prototype','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBookedRR','agentconnect','syncAgentConnect','syncQueueCallerAbandon','bind','originateresponse','agentcomplete','syncAgentComplete','custom:queuesummary','hangup','syncHangup','syncNewExten','varset','queuemember','syncQueueMember','queuestatuscomplete','loopCampaigns','loopClearZombieChannels','isUndefined','AGENTS_NOT_LOGGED','name','message','NOT_ACTIVE','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','emit','type','outbound','strategy','answered','available','loggedIn','sumDuration','sumHoldTime','total','abandoned','waiting','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalAvailable','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','callerid','md5','format','voice_queue:save','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','handlePredictive','clearing\x20variable\x20handle\x20predictive','ivr','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contactsRescheduled','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','talking','pTalking','[syncQueueSummary]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','is\x20disactive','is\x20not\x20active','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','statedesc','endtime','starttime','clearZombieChannels','uniqueId','[uniqueid]','undefined','enqueue','isNil','Action','status','channel','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','resolve','countReScheduled','catch','[countReScheduled]\x20','checkIsBlackList','then','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','pick','ContactId','ListId','UserId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','active','SIP/%s','reachable','saveInDb','syncVarSet','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','state','membername','custom:amd','amd','[syncHangupInAMD]','MACHINE','AMD','countglobal','buildObj','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','add','dialMachineRetryFrequency','YYYY-MM-DD\x20HH:mm:ss','VoiceQueueId','[rescheduleContact][Machine]','HangupInAMD'];(function(_0x4e9701,_0x40592c){var _0x49b20c=function(_0x44de4d){while(--_0x44de4d){_0x4e9701['push'](_0x4e9701['shift']());}};_0x49b20c(++_0x40592c);}(_0x1542,0x116));var _0x2154=function(_0x392850,_0x189b7f){_0x392850=_0x392850-0x0;var _0x174276=_0x1542[_0x392850];return _0x174276;};'use strict';var util=require(_0x2154('0x0'));var _=require(_0x2154('0x1'));var BPromise=require(_0x2154('0x2'));var uuid=require(_0x2154('0x3'));var moment=require(_0x2154('0x4'));var rr=require('rr');var md5=require('md5');var Redis=require(_0x2154('0x5'));var ut=require(_0x2154('0x6'));var config=require(_0x2154('0x7'));var logger=require('../../../config/logger')(_0x2154('0x8'));var loggerBooked=require(_0x2154('0x9'))('booked');var loggerPredictive=require(_0x2154('0x9'))(_0x2154('0xa'));var loggerPredictiveCalls=require(_0x2154('0x9'))(_0x2154('0xb'));var loggerSyncQueueSummary=require(_0x2154('0x9'))(_0x2154('0xc'));var ami=require(_0x2154('0xd'));config[_0x2154('0xe')]=_[_0x2154('0xf')](config[_0x2154('0xe')],{'host':'localhost','port':0x18eb});var io=require(_0x2154('0x10'))(new Redis(config[_0x2154('0xe')]));var cmHopper=require(_0x2154('0x11'));var cmHopperHistory=require(_0x2154('0x12'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x2154('0x13'));var Action=require(_0x2154('0x14'));var History=require('./history');var Final=require(_0x2154('0x15'));var AgentComplete=require(_0x2154('0x16'));var QueueCallerAbandon=require(_0x2154('0x17'));var Hangup=require(_0x2154('0x18'));var ipAgi=process[_0x2154('0x19')][_0x2154('0x1a')]||_0x2154('0x1b');var strategy={'rrmemory':'rrmemory','roundrobin':'roundrobin'};var Sequence=function(){};Sequence[_0x2154('0x1c')]['enqueue']=function(_0x44c441){this['tail']=this['tail']?this['tail'][_0x2154('0x1d')](_0x44c441):_0x44c441();};function Dialer(_0x57e662,_0x157858){this['sequence']=new Sequence();this[_0x2154('0x1e')]=_0x157858;this[_0x2154('0x1f')]=_0x57e662[_0x2154('0x1f')];this[_0x2154('0x20')]=_0x57e662[_0x2154('0x20')];this[_0x2154('0x21')]=_0x57e662[_0x2154('0x21')];this[_0x2154('0x22')]=_0x57e662[_0x2154('0x22')];this[_0x2154('0x23')]=config['maxNumberOriginate']||0x2;this[_0x2154('0x24')]={};this[_0x2154('0x25')]={};this[_0x2154('0x26')]={};this['uniqueId']={};this[_0x2154('0x27')]={};this[_0x2154('0x28')]={};this[_0x2154('0x29')]={};this[_0x2154('0x2a')]={};this['queueBooked']={};this[_0x2154('0x2b')]={};ami['on'](_0x2154('0x2c'),this[_0x2154('0x2d')]['bind'](this));ami['on']('queuecallerabandon',this[_0x2154('0x2e')][_0x2154('0x2f')](this));ami['on'](_0x2154('0x30'),this['syncOriginateResponse']['bind'](this));ami['on'](_0x2154('0x31'),this[_0x2154('0x32')][_0x2154('0x2f')](this));ami['on'](_0x2154('0x33'),this['syncQueueSummary'][_0x2154('0x2f')](this));ami['on'](_0x2154('0x34'),this[_0x2154('0x35')]['bind'](this));ami['on']('newexten',this[_0x2154('0x36')][_0x2154('0x2f')](this));ami['on'](_0x2154('0x37'),this['syncVarSet'][_0x2154('0x2f')](this));ami['on'](_0x2154('0x38'),this[_0x2154('0x39')][_0x2154('0x2f')](this));ami['on'](_0x2154('0x3a'),this['syncQueueStatusComplete'][_0x2154('0x2f')](this));this[_0x2154('0x3b')]();this[_0x2154('0x3c')]();}function isNotNull(_0x156f1a){return _0x156f1a!==null&&!_[_0x2154('0x3d')](_0x156f1a);}function checkIsLoggedIn(_0x2dee3e,_0xe5c717){return function(){if(_0xe5c717<=0x0){_0x2dee3e['message']=_0x2154('0x3e');throw _0x2dee3e[_0x2154('0x3f')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x1c25d7){return _0x1c25d7;}function checkIsActive(_0x504e86,_0x4aa34f){return function(){if(!isActive(_0x4aa34f)){_0x504e86[_0x2154('0x40')]=_0x2154('0x41');throw _0x504e86[_0x2154('0x3f')]+'\x20NOT\x20Active';}};}function checkInterval(_0x3feb60){return function(){if(!isNotNull(_0x3feb60[_0x2154('0x42')])){_0x3feb60[_0x2154('0x40')]=_0x2154('0x43');throw _0x3feb60[_0x2154('0x3f')]+_0x2154('0x44');}if(!isNotNull(_0x3feb60[_0x2154('0x42')][_0x2154('0x45')])){_0x3feb60['message']=_0x2154('0x43');throw _0x3feb60['name']+_0x2154('0x44');}if(!isNotNull(_[_0x2154('0x46')](_0x3feb60[_0x2154('0x42')][_0x2154('0x45')]))){_0x3feb60[_0x2154('0x40')]='INTERVAL_IS_NULL';throw _0x3feb60['name']+_0x2154('0x44');}};}function msgResponse(_0x3ff05a,_0x471c0e,_0x275ee3){return{'action':_0x3ff05a,'response':_0x471c0e,'message':_0x275ee3,'stack':_0x275ee3};}function myreject(_0x32d51d){return function(_0x366c1a){return _0x32d51d(msgResponse(_0x2154('0x47'),_0x2154('0x48'),JSON[_0x2154('0x49')](_0x366c1a)));};}function getSeconds(_0x490046,_0x4fa576){var _0x34582f=moment(_0x490046)['milliseconds'](0x0);var _0x3a160f=moment(_0x4fa576)[_0x2154('0x4a')](0x0);return _0x34582f[_0x2154('0x4b')](_0x3a160f,_0x2154('0x4c'));}function emit(_0x3670a5,_0x392f2a,_0x58ce76){io['to'](_0x3670a5)[_0x2154('0x4d')](_0x392f2a,_0x58ce76);}function emitVoiceQueueSummary(_0x2ccbb5){if(_0x2ccbb5[_0x2154('0x4e')]===_0x2154('0x4f')){var _0x1a4167={'id':_0x2ccbb5['id'],'name':_0x2ccbb5[_0x2154('0x3f')],'strategy':_0x2ccbb5[_0x2154('0x50')],'answered':_0x2ccbb5[_0x2154('0x51')],'available':_0x2ccbb5[_0x2154('0x52')],'loggedIn':_0x2ccbb5[_0x2154('0x53')],'pTalking':_0x2ccbb5['pTalking'],'sumBillable':_0x2ccbb5['sumBillable'],'sumDuration':_0x2ccbb5[_0x2154('0x54')],'sumHoldTime':_0x2ccbb5[_0x2154('0x55')]||0x0,'talking':_0x2ccbb5['talking'],'total':_0x2ccbb5[_0x2154('0x56')],'type':_0x2ccbb5[_0x2154('0x4e')],'unmanaged':_0x2ccbb5['unmanaged'],'abandoned':_0x2ccbb5[_0x2154('0x57')],'waiting':_0x2ccbb5[_0x2154('0x58')],'loggedInDb':_0x2ccbb5['loggedInDb'],'dialActive':_0x2ccbb5['dialActive'],'dialMethod':_0x2ccbb5[_0x2154('0x59')],'dialOriginateCallerIdName':_0x2ccbb5[_0x2154('0x5a')],'dialOriginateCallerIdNumber':_0x2ccbb5[_0x2154('0x5b')],'dialOriginateTimeout':_0x2ccbb5[_0x2154('0x5c')],'dialPrefix':_0x2ccbb5[_0x2154('0x5d')],'outboundAnswerAgiCallsDay':_0x2ccbb5[_0x2154('0x5e')],'outboundAnswerCallsDay':_0x2ccbb5[_0x2154('0x5f')],'outboundBlacklistCallsDay':_0x2ccbb5[_0x2154('0x60')],'outboundBusyCallsDay':_0x2ccbb5[_0x2154('0x61')],'outboundCongestionCallsDay':_0x2ccbb5[_0x2154('0x62')],'outboundDropCallsDayACS':_0x2ccbb5[_0x2154('0x63')],'outboundDropCallsDayCallersExit':_0x2ccbb5['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x2ccbb5['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x2ccbb5[_0x2154('0x64')],'outboundNoSuchCallsDay':_0x2ccbb5['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x2ccbb5[_0x2154('0x65')],'outboundReCallsDay':_0x2ccbb5[_0x2154('0x66')],'outboundRejectCallsDay':_0x2ccbb5[_0x2154('0x67')],'outboundUnknownCallsDay':_0x2ccbb5[_0x2154('0x68')],'predictiveIntervalAnsweredCalls':_0x2ccbb5['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x2ccbb5[_0x2154('0x69')],'predictiveIntervalAvgTalktime':_0x2ccbb5[_0x2154('0x6a')],'predictiveIntervalDroppedCallsCallersExit':_0x2ccbb5[_0x2154('0x6b')],'predictiveIntervalDroppedCallsTimeout':_0x2ccbb5[_0x2154('0x6c')],'predictiveIntervalErlangCalls':_0x2ccbb5[_0x2154('0x6d')],'predictiveIntervalErlangCallsDroppedCalls':_0x2ccbb5[_0x2154('0x6e')],'predictiveIntervalHitRate':_0x2ccbb5['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x2ccbb5['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x2ccbb5['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x2ccbb5[_0x2154('0x6f')],'predictiveIntervalTotalCalls':_0x2ccbb5['predictiveIntervalTotalCalls'],'message':_0x2ccbb5['message'],'originated':_0x2ccbb5[_0x2154('0x70')],'erlangCalls':_0x2ccbb5[_0x2154('0x71')],'erlangCallToSecond':_0x2ccbb5[_0x2154('0x72')],'erlangAbandonmentRate':_0x2ccbb5[_0x2154('0x73')],'erlangBusyFactor':_0x2ccbb5[_0x2154('0x74')],'startPredictive':_0x2ccbb5[_0x2154('0x28')],'startProgressive':_0x2ccbb5[_0x2154('0x29')]};if(_0x2ccbb5[_0x2154('0x75')]){_0x1a4167['Trunk']={'id':_0x2ccbb5[_0x2154('0x75')]['id'],'name':_0x2ccbb5[_0x2154('0x75')][_0x2154('0x3f')],'active':_0x2ccbb5['Trunk']['active'],'callerid':_0x2ccbb5[_0x2154('0x75')][_0x2154('0x76')]};}if(_0x2ccbb5[_0x2154('0x42')]){_0x1a4167['Interval']={'id':_0x2ccbb5[_0x2154('0x42')]['id'],'name':_0x2ccbb5[_0x2154('0x42')][_0x2154('0x3f')]};}var _0x7027c1=md5(JSON[_0x2154('0x49')](_0x1a4167));if(_0x2ccbb5[_0x2154('0x77')]!==_0x7027c1){_0x2ccbb5[_0x2154('0x77')]=_0x7027c1;emit(util[_0x2154('0x78')]('voice:queue:%s',_0x1a4167[_0x2154('0x3f')]),_0x2154('0x79'),_0x1a4167);}}}function emitCampaignSummary(_0x738aa3){if(_0x738aa3[_0x2154('0x4e')]==='ivr'){emit(util[_0x2154('0x78')]('campaign:ivr:%s',_0x738aa3['name']),_0x2154('0x7a'),_0x738aa3);}}function checkGetDataPredictive(_0x436844){if(isNotNull(_0x436844)&&!_[_0x2154('0x46')](_0x436844)){loggerPredictive[_0x2154('0x7b')](_0x2154('0x7c'));loggerPredictive[_0x2154('0x7b')](_0x2154('0x7d'),_0x436844[_0x2154('0x7e')]);loggerPredictive[_0x2154('0x7b')](_0x2154('0x7f'),_0x436844['predictiveIntervalAnsweredCalls']);loggerPredictive['info'](_0x2154('0x80'),_0x436844['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0x2154('0x7b')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x436844[_0x2154('0x6b')]);loggerPredictive[_0x2154('0x7b')](_0x2154('0x81'),_0x436844[_0x2154('0x69')]);loggerPredictive[_0x2154('0x7b')](_0x2154('0x82'),_0x436844[_0x2154('0x6a')]);loggerPredictive[_0x2154('0x7b')](_0x2154('0x83'));if(_0x436844[_0x2154('0x7e')]>0x0){if(!_[_0x2154('0x3d')](_0x436844[_0x2154('0x6a')])&&_0x436844[_0x2154('0x6a')]>0x0){return!![];}loggerPredictive[_0x2154('0x7b')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_['isUndefined'](_0x436844[_0x2154('0x69')])&&_0x436844[_0x2154('0x69')]>0x0){return!![];}loggerPredictive[_0x2154('0x7b')](_0x2154('0x84'));}else{loggerPredictive[_0x2154('0x7b')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive['info'](_0x2154('0x85'));}return![];}function mergeDataErlangB(_0x1b9ba5){return function(_0x442b0b){loggerPredictive[_0x2154('0x7b')](_0x2154('0x86'));loggerPredictive['info'](_0x2154('0x87'),_0x442b0b[_0x2154('0x71')]);loggerPredictive[_0x2154('0x7b')](_0x2154('0x88'),_0x442b0b[_0x2154('0x72')]);loggerPredictive['info'](_0x2154('0x89'),_0x442b0b['erlangAbandonmentRate']);loggerPredictive[_0x2154('0x7b')](_0x2154('0x8a'),_0x442b0b[_0x2154('0x74')]);loggerPredictive[_0x2154('0x7b')](_0x2154('0x89'),_0x442b0b[_0x2154('0x73')]);loggerPredictive['info'](_0x2154('0x83'));_[_0x2154('0x8b')](_0x1b9ba5,_0x442b0b);};}function getDiff(_0x13adfb){var _0x30226b=moment()[_0x2154('0x4a')](0x0);var _0x460e45=moment(_0x13adfb)[_0x2154('0x4a')](0x0);return _0x30226b['diff'](_0x460e45,_0x2154('0x4c'));}function ifInterval(_0x1df413,_0x333899){if(_['isUndefined'](_0x333899)){return![];}return getDiff(_0x333899)<_0x1df413*0x3c;}function freeVariablesPredictive(_0x5a8802){if(isNotNull(_0x5a8802)){if(!_['isUndefined'](_0x5a8802[_0x2154('0x29')])){_0x5a8802['startProgressive']=undefined;loggerPredictive[_0x2154('0x7b')](_0x5a8802['name'],'clearing\x20variable\x20start\x20progressive');}if(!_[_0x2154('0x3d')](_0x5a8802['startPredictive'])){_0x5a8802[_0x2154('0x28')]=undefined;loggerPredictive[_0x2154('0x7b')](_0x5a8802[_0x2154('0x3f')],'clearing\x20variable\x20start\x20predictive');}if(!_[_0x2154('0x3d')](_0x5a8802['handlePredictive'])){clearInterval(_0x5a8802['handlePredictive']);_0x5a8802[_0x2154('0x8c')]=undefined;loggerPredictive[_0x2154('0x7b')](_0x5a8802[_0x2154('0x3f')],_0x2154('0x8d'));}}}function erlangb(_0xeea70b,_0x56c693){if(_0x56c693===0x0){return 0x0;}var _0x393a1a=0x1;for(var _0x5cdc86=0x1;_0x5cdc86<=_0x56c693;_0x5cdc86+=0x1){_0x393a1a=0x1+_0x393a1a*_0x5cdc86/_0xeea70b;}return 0x1/_0x393a1a;}function isVoiceQueueOutbound(_0x9407e1){return _0x9407e1===_0x2154('0x4f');}function isNotPreview(_0xc1dd4f){return _0xc1dd4f!==_0x2154('0x1e');}function isCampaignIvr(_0x5e19f4){return _0x5e19f4===_0x2154('0x8e');}function getCallerId(_0x582acf,_0x47301c,_0xb97e38){if(!_['isUndefined'](_0xb97e38)&&typeof _0xb97e38===_0x2154('0x8f')&&!_[_0x2154('0x46')](_0xb97e38)){if(!_[_0x2154('0x3d')](_0x47301c)&&typeof _0x47301c==='string'&&!_['isEmpty'](_0x47301c)){return util[_0x2154('0x78')](_0x2154('0x90'),_0x47301c,_0xb97e38);}return util['format'](_0x2154('0x90'),_0xb97e38,_0xb97e38);}if(!_[_0x2154('0x3d')](_0x582acf)&&typeof _0x582acf===_0x2154('0x8f')&&!_[_0x2154('0x46')](_0x582acf)){return _0x582acf;}return _0x2154('0x91');}function loggerCatchQueueSummary(_0x478173,_0x1869f7){return function(_0x1208b8){freeVariablesPredictive(_0x1869f7);emitVoiceQueueSummary(_0x1869f7);emitCampaignSummary(_0x1869f7);loggerSyncQueueSummary[_0x2154('0x92')](_0x478173,util[_0x2154('0x93')](_0x1208b8,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x59e144,_0x147927){return function(_0x2f9a07){loggerPredictive[_0x2154('0x92')](_0x147927[_0x2154('0x3f')],_0x59e144);loggerPredictive[_0x2154('0x92')](_0x2f9a07[_0x2154('0x94')]);freeVariablesPredictive(_0x147927);};}function loggerCatch(_0x101d70){return function(_0x106df9){logger['error'](_0x101d70,util[_0x2154('0x93')](_0x106df9,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x3aa46d){return _0x3aa46d&&!_[_0x2154('0x3d')](_0x3aa46d)&&_0x3aa46d['length']>0x0;}function decremetOriginate(_0x5402ff){if(!_[_0x2154('0x3d')](_0x5402ff)&&_0x5402ff!==null){if(typeof _0x5402ff['originated']!=='undefined'){if(_0x5402ff['originated']>0x0){_0x5402ff[_0x2154('0x70')]-=0x1;}else{logger[_0x2154('0x92')](_0x2154('0x95'));}}}else{logger[_0x2154('0x92')](_0x2154('0x96'));}}function checkContactLowerLimitOriginate(_0x51ba5c,_0x26b0d0,_0x31232b){if(_0x26b0d0>_0x31232b){for(var _0x5477e8=0x0;_0x5477e8<_0x26b0d0-_0x31232b;_0x5477e8+=0x1){decremetOriginate(_0x51ba5c);}}}function loggerGetContactDialer(_0x213b63,_0x2f79ab,_0x18b1c8){return function(_0x8443ab){checkContactLowerLimitOriginate(_0x2f79ab,_0x18b1c8,0x0);logger[_0x2154('0x92')](_0x213b63,util['inspect'](_0x8443ab,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x557404){return function(_0x4fcc08){if(isNotNull(_0x4fcc08)&&isNotNull(_0x4fcc08[0x0])){if(_0x4fcc08[0x0]['contactsRescheduled']>0x0){_0x557404[_0x2154('0x40')]=_0x2154('0x97');logger['info'](_0x2154('0x98')+_0x557404[_0x2154('0x3f')],_0x4fcc08[0x0][_0x2154('0x99')],'contacts');}else{_0x557404[_0x2154('0x40')]=_0x2154('0x9a');logger['info'](_0x2154('0x9b')+_0x557404[_0x2154('0x3f')]);}}};}function notSendMessagesQueue(_0x4adacd){if(_0x4adacd[_0x2154('0x9c')]){freeVariablesPredictive(_0x4adacd);if(_0x4adacd[_0x2154('0x70')]===0x0&&_0x4adacd[_0x2154('0x9d')]===0x0&&_0x4adacd['waiting']===0x0&&(_0x4adacd[_0x2154('0x9e')]||0x0)===0x0){_0x4adacd[_0x2154('0x9c')]=![];_0x4adacd[_0x2154('0x52')]=0x0;_0x4adacd[_0x2154('0x40')]=_0x2154('0x41');loggerSyncQueueSummary[_0x2154('0x92')](_0x2154('0x9f'),_0x4adacd[_0x2154('0x3f')],'is\x20not\x20active');}else{_0x4adacd[_0x2154('0x40')]=_0x2154('0xa0');loggerSyncQueueSummary[_0x2154('0x92')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x4adacd[_0x2154('0x3f')],_0x2154('0xa1'));}emitVoiceQueueSummary(_0x4adacd);}}function notSendMessagesCampaign(_0x3245ad){if(_0x3245ad['sendMessageOneNotActive']){if(_0x3245ad[_0x2154('0x70')]===0x0){_0x3245ad[_0x2154('0x9c')]=![];_0x3245ad[_0x2154('0x40')]=_0x2154('0x41');loggerSyncQueueSummary[_0x2154('0x92')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x3245ad[_0x2154('0x3f')],_0x2154('0xa2'));}else{_0x3245ad[_0x2154('0x40')]=_0x2154('0xa0');loggerSyncQueueSummary['error'](_0x2154('0xa3'),_0x3245ad[_0x2154('0x3f')],'is\x20disactive');}emitCampaignSummary(_0x3245ad);}}function createObjHistory(_0x4a641c,_0x24c45b,_0x5ff870,_0x498be2,_0x82fb43){_0x4a641c[_0x2154('0x40')]=_0x5ff870;var _0x4c422c=new Action(_0x4a641c,_0x24c45b);var _0x1feca3=new History(_0x4c422c);_0x1feca3['state']=_0x498be2;_0x1feca3[_0x2154('0xa4')]=_0x82fb43;_0x1feca3[_0x2154('0xa5')]=_0x4c422c[_0x2154('0xa6')];return _0x1feca3;}Dialer[_0x2154('0x1c')]['loopClearZombieChannels']=function(){var _0x3a9ff0=this;setInterval(function(){_0x3a9ff0[_0x2154('0xa7')](_0x3a9ff0[_0x2154('0xa8')],_0x2154('0xa9'));_0x3a9ff0[_0x2154('0xa7')](_0x3a9ff0[_0x2154('0x25')],'[actions]');},0x32c8);};Dialer[_0x2154('0x1c')][_0x2154('0xa7')]=function(_0xed64d9,_0x346d59){var _0x4b9fe6=this;for(var _0x473f99 in _0xed64d9){if(typeof _0xed64d9[_0x473f99]!==_0x2154('0xaa')){this['sequence'][_0x2154('0xab')](function(){if(!_[_0x2154('0xac')](_0xed64d9[_0x473f99])){return ami[_0x2154('0xad')]({'action':_0x2154('0xae'),'channel':_0xed64d9[_0x473f99][_0x2154('0xaf')]})['catch'](function(_0x2a1678){if(_0x2a1678[_0x2154('0x40')]===_0x2154('0xb0')){setTimeout(function(){if(_0xed64d9[_0x473f99]&&_0xed64d9[_0x473f99][_0x2154('0x4e')]!==_0x2154('0x8e')){_0x4b9fe6[_0x2154('0xb1')](_0x4b9fe6[_0x2154('0x1f')][_0xed64d9[_0x473f99][_0x2154('0xb2')]]);logger[_0x2154('0x92')](_0x2154('0xb3'),_0x346d59,_0x473f99,_0xed64d9[_0x473f99]['queue']);delete _0xed64d9[_0x473f99];}if(_0xed64d9[_0x473f99]&&_0xed64d9[_0x473f99][_0x2154('0x4e')]===_0x2154('0x8e')){_0x4b9fe6[_0x2154('0xb1')](_0x4b9fe6[_0x2154('0x20')][_0xed64d9[_0x473f99][_0x2154('0xb2')]]);logger[_0x2154('0x92')](_0x2154('0xb4'),_0x346d59,_0x473f99,_0xed64d9[_0x473f99][_0x2154('0xb2')]);delete _0xed64d9[_0x473f99];}},0x2328);}});}});}}};Dialer[_0x2154('0x1c')]['countReScheduled']=function(_0x3ae502){return BPromise[_0x2154('0xb5')]()['then'](cmHopper[_0x2154('0xb6')](_0x3ae502))[_0x2154('0xb7')](loggerCatch(_0x2154('0xb8')));};Dialer['prototype'][_0x2154('0xb9')]=function(_0x3220a9){return BPromise[_0x2154('0xb5')]()[_0x2154('0xba')](cmHopperBlack[_0x2154('0xb9')](_0x3220a9))[_0x2154('0xb7')](loggerCatch('[checkIsBlackList]\x20'));};Dialer[_0x2154('0x1c')][_0x2154('0xbb')]=function(_0x2ac713){return BPromise[_0x2154('0xb5')]()[_0x2154('0xba')](cmHopperBlack[_0x2154('0xbb')](_0x2ac713))['catch'](loggerCatch(_0x2154('0xbc')));};Dialer[_0x2154('0x1c')][_0x2154('0xbd')]=function(_0x28fe17){return BPromise[_0x2154('0xb5')]()[_0x2154('0xba')](cmHopperHistory['avgHandleTime'](_0x28fe17))['catch'](loggerCatch(_0x2154('0xbe')));};Dialer[_0x2154('0x1c')][_0x2154('0xbf')]=function(_0x17b9f0){return BPromise[_0x2154('0xb5')]()[_0x2154('0xba')](cmHopper[_0x2154('0xbf')](_0x17b9f0))['catch'](loggerCatch(_0x2154('0xc0')));};Dialer[_0x2154('0x1c')][_0x2154('0xc1')]=function(_0x2006eb,_0x4ccacd,_0x3e3007){return BPromise[_0x2154('0xb5')]()['then'](cmHopper[_0x2154('0xc1')](_0x2006eb,_0x4ccacd,_0x3e3007))[_0x2154('0xb7')](loggerCatch(_0x2154('0xc2')));};Dialer['prototype'][_0x2154('0xc3')]=function(_0x3e94d5,_0x1c4900,_0x4063eb,_0x728e7a,_0x33fbe1){return BPromise[_0x2154('0xb5')]()[_0x2154('0xba')](cmHopper['getContactDialer'](_0x3e94d5,_0x1c4900,_0x4063eb,_0x728e7a))[_0x2154('0xb7')](function(_0x38de0f){_0x33fbe1[_0x2154('0xc4')]-=_0x4063eb;_0x33fbe1[_0x2154('0xc4')]=_0x33fbe1['temp']>0x0?_0x33fbe1[_0x2154('0xc4')]:0x0;loggerCatch('[getContactDialer]\x20')(_0x38de0f);});};Dialer['prototype'][_0x2154('0xc5')]=function(_0x24c755,_0x508cda,_0x37d742,_0xc5cb0a){return BPromise[_0x2154('0xb5')]()[_0x2154('0xba')](cmHopper[_0x2154('0xc5')](_0x24c755,_0x508cda,_0x37d742))[_0x2154('0xb7')](function(_0x25cff2){_0xc5cb0a['temp']-=_0x508cda;_0xc5cb0a['temp']=_0xc5cb0a[_0x2154('0xc4')]>0x0?_0xc5cb0a['temp']:0x0;loggerCatch(_0x2154('0xc6'))(_0x25cff2);});};Dialer[_0x2154('0x1c')][_0x2154('0xc7')]=function(_0x507055){return BPromise[_0x2154('0xb5')]()[_0x2154('0xba')](voiceQueueRt[_0x2154('0xc7')](_0x507055))['catch'](loggerCatch(_0x2154('0xc8')));};Dialer[_0x2154('0x1c')]['moveContactManagedDialer']=function(_0x4e1c3c){return BPromise[_0x2154('0xb5')]()[_0x2154('0xba')](cmHopper[_0x2154('0xc9')](_0x4e1c3c))[_0x2154('0xb7')](loggerCatch(_0x2154('0xca')));};Dialer[_0x2154('0x1c')][_0x2154('0xcb')]=function(_0x41f5e3){return BPromise[_0x2154('0xb5')]()[_0x2154('0xba')](cmHopperHistory[_0x2154('0xcb')](_0x41f5e3))[_0x2154('0xb7')](loggerCatch(_0x2154('0xcc')));};Dialer[_0x2154('0x1c')]['updateOriginated']=function(_0x88cf31){if(!_[_0x2154('0x3d')](_0x88cf31)&&_0x88cf31!==null){if(typeof _0x88cf31[_0x2154('0x70')]!==_0x2154('0xaa')){if(_0x88cf31[_0x2154('0x70')]>0x0){_0x88cf31[_0x2154('0x70')]-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x2154('0x92')](_0x2154('0xcd'));}};Dialer['prototype'][_0x2154('0xce')]=function(_0x2d5c21,_0xfa4f23){var _0x50d3aa=this;return function(_0x4ed546){_0x50d3aa[_0x2154('0xb1')](_0xfa4f23);logger[_0x2154('0x92')](_0x2d5c21,util['inspect'](_0x4ed546,{'showHidden':![],'depth':null}));};};Dialer[_0x2154('0x1c')][_0x2154('0xcf')]=function(_0x57e6d1,_0x487618,_0x3b6b55){var _0x112dae={'state':0x19,'statedesc':_0x2154('0xd0')};this[_0x2154('0xb1')](_0x487618);this['saveInDb'](_[_0x2154('0x8b')](_0x112dae,_[_0x2154('0xd1')](_0x3b6b55,[_0x2154('0xd2'),_0x2154('0xd3'),_0x2154('0xd4'),'VoiceQueueId',_0x2154('0xd5')])),_0x2154('0xd6'),_0x2154('0xd7'));logger[_0x2154('0x92')](_0x57e6d1);};Dialer['prototype'][_0x2154('0xd8')]=function(_0x27ac02){return _0x27ac02===_0x2154('0xd9');};Dialer[_0x2154('0x1c')][_0x2154('0xda')]=function(_0x5ee95d){return!_[_0x2154('0x3d')](_0x5ee95d)&&_0x5ee95d&&!_[_0x2154('0x3d')](_0x5ee95d[_0x2154('0x3f')])&&!_[_0x2154('0x3d')](_0x5ee95d[_0x2154('0xdb')])&&_0x5ee95d[_0x2154('0xdb')]&&(this[_0x2154('0x22')][util['format'](_0x2154('0xdc'),_0x5ee95d[_0x2154('0x3f')])][_0x2154('0xae')]===_0x2154('0xdd')||this[_0x2154('0x22')][util[_0x2154('0x78')]('SIP/%s',_0x5ee95d['name'])]['status']==='unmonitored');};Dialer[_0x2154('0x1c')][_0x2154('0xde')]=function(_0x53c295,_0xd7a688,_0x38e059){this[_0x2154('0xcb')](_0x53c295)['catch'](loggerCatch(_0xd7a688));this[_0x2154('0xc9')](_0x53c295)[_0x2154('0xb7')](loggerCatch(_0x38e059));};Dialer['prototype'][_0x2154('0xdf')]=function(_0x185f2a){var _0x4d2457=this['uniqueId'][_0x185f2a[_0x2154('0xe0')]];var _0x597968;if(!_[_0x2154('0xac')](_0x185f2a)&&!_[_0x2154('0xac')](_0x185f2a[_0x2154('0xe1')])&&!_[_0x2154('0xac')](_0x185f2a['variable'][_0x2154('0xe2')])&&_0x185f2a[_0x2154('0xe3')]===_0x2154('0xe4')&&_0x4d2457){if(_0x4d2457[_0x2154('0x4e')]!==_0x2154('0x8e')&&this[_0x2154('0x1f')][_0x4d2457['queue']][_0x2154('0xe5')]&&_0x185f2a[_0x2154('0xe6')]===_0x2154('0xe7')){delete this[_0x2154('0xa8')][_0x185f2a[_0x2154('0xe0')]];this['updateOriginated'](this['voiceQueues'][_0x4d2457[_0x2154('0xb2')]]);this[_0x2154('0x1f')][_0x4d2457[_0x2154('0xb2')]][_0x2154('0x5f')]+=0x1;this[_0x2154('0x1f')][_0x4d2457[_0x2154('0xb2')]][_0x2154('0x5e')]+=0x1;_0x597968=new Hangup(_0x4d2457,_0x185f2a);_0x597968[_0x2154('0xe8')]=0x12;_0x597968['statedesc']='HangupInAMD';_0x597968[_0x2154('0xe9')]='AMD';ami['emit'](_0x2154('0xea'),ut['buildObj'](_0x597968,_0x2154('0xeb')));this[_0x2154('0xde')](_0x597968,'[syncHangupInAMD][createHistory]',_0x2154('0xec'));}if(_0x4d2457[_0x2154('0x4e')]!==_0x2154('0x8e')&&this[_0x2154('0x1f')][_0x4d2457[_0x2154('0xb2')]][_0x2154('0xe5')]&&_0x185f2a['value']===_0x2154('0xed')){var _0x105aab=this;return new BPromise(function(_0x2cb5cb,_0x1f1741){delete _0x105aab[_0x2154('0xa8')][_0x185f2a[_0x2154('0xe0')]];_0x105aab['updateOriginated'](_0x105aab[_0x2154('0x1f')][_0x4d2457[_0x2154('0xb2')]]);_0x105aab[_0x2154('0x1f')][_0x4d2457[_0x2154('0xb2')]][_0x2154('0x5f')]+=0x1;_0x105aab[_0x2154('0x1f')][_0x4d2457['queue']][_0x2154('0x5e')]+=0x1;var _0x209c7a=_0x105aab[_0x2154('0x1f')][_0x4d2457['queue']];var _0x5df506=new Hangup(_0x4d2457,_0x185f2a);_0x5df506[_0x2154('0xe8')]=0x13;_0x5df506[_0x2154('0xa4')]='Machine';_0x5df506[_0x2154('0xe9')]=_0x2154('0xee');_0x5df506['countmachineretry']+=0x1;_0x5df506[_0x2154('0xef')]+=0x1;_0x5df506[_0x2154('0xeb')]=!![];ami[_0x2154('0x4d')](_0x2154('0xea'),ut[_0x2154('0xf0')](_0x5df506,'amd'));_0x105aab['createHistory'](_0x5df506)['catch'](loggerCatch(_0x2154('0xf1')));if(_0x5df506[_0x2154('0xf2')]+_0x5df506[_0x2154('0xf3')]+_0x5df506[_0x2154('0xf4')]+_0x5df506[_0x2154('0xf5')]+_0x5df506['countdropretry']+_0x5df506[_0x2154('0xf6')]+_0x5df506[_0x2154('0xf7')]+_0x5df506[_0x2154('0xf8')]>=_0x209c7a[_0x2154('0xf9')]){_0x105aab[_0x2154('0xfa')](_0x5df506,_0x2cb5cb,_0x1f1741,_0x2154('0xfb'));}else{if(_0x5df506['countmachineretry']>=_0x209c7a[_0x2154('0xfc')]){_0x105aab[_0x2154('0xfd')](_0x5df506,_0x2cb5cb,_0x1f1741,'reason\x2019\x20machine....');}else{_0x105aab[_0x2154('0xbf')]({'active':![],'countmachineretry':_0x5df506[_0x2154('0xf7')],'scheduledat':moment()[_0x2154('0xfe')](_0x209c7a[_0x2154('0xff')],'minutes')[_0x2154('0x78')](_0x2154('0x100')),'ContactId':_0x5df506[_0x2154('0xd2')],'ListId':_0x5df506['ListId'],'VoiceQueueId':_0x5df506[_0x2154('0x101')]||undefined,'CampaignId':_0x5df506[_0x2154('0xd5')]||undefined})[_0x2154('0xb7')](loggerCatch(_0x2154('0x102')));_0x2cb5cb({'reschedule':0x1});}}});}if(_0x4d2457[_0x2154('0x4e')]===_0x2154('0x8e')&&this[_0x2154('0x20')][_0x4d2457[_0x2154('0xb2')]][_0x2154('0xe5')]&&_0x185f2a['value']===_0x2154('0xe7')){delete this[_0x2154('0xa8')][_0x185f2a[_0x2154('0xe0')]];this[_0x2154('0xb1')](this[_0x2154('0x20')][_0x4d2457[_0x2154('0xb2')]]);_0x597968=new Hangup(_0x4d2457,_0x185f2a);_0x597968[_0x2154('0xe8')]=0x12;_0x597968[_0x2154('0xa4')]=_0x2154('0x103');_0x597968[_0x2154('0xe9')]=_0x2154('0xee');ami[_0x2154('0x4d')](_0x2154('0xea'),ut[_0x2154('0xf0')](_0x597968,'amd'));this['saveInDb'](_0x597968,_0x2154('0x104'),_0x2154('0x105'));}if(_0x4d2457['type']===_0x2154('0x8e')&&this[_0x2154('0x20')][_0x4d2457[_0x2154('0xb2')]][_0x2154('0xe5')]&&_0x185f2a[_0x2154('0xe6')]===_0x2154('0xed')){var _0x105aab=this;return new BPromise(function(_0xe12b87,_0x30d5ec){delete _0x105aab[_0x2154('0xa8')][_0x185f2a[_0x2154('0xe0')]];_0x105aab['updateOriginated'](_0x105aab['campaigns'][_0x4d2457[_0x2154('0xb2')]]);_0x105aab[_0x2154('0x20')][_0x4d2457['queue']][_0x2154('0x5f')]+=0x1;_0x105aab[_0x2154('0x20')][_0x4d2457[_0x2154('0xb2')]]['outboundAnswerAgiCallsDay']+=0x1;var _0xd54085=_0x105aab['campaigns'][_0x4d2457['queue']];var _0x3f1527=new Hangup(_0x4d2457,_0x185f2a);_0x3f1527[_0x2154('0xe8')]=0x13;_0x3f1527['statedesc']=_0x2154('0x106');_0x3f1527[_0x2154('0xe9')]=_0x2154('0xee');_0x3f1527[_0x2154('0xf7')]+=0x1;_0x3f1527[_0x2154('0xef')]+=0x1;_0x3f1527[_0x2154('0xeb')]=!![];ami[_0x2154('0x4d')]('custom:amd',ut[_0x2154('0xf0')](_0x3f1527,_0x2154('0xeb')));_0x105aab[_0x2154('0xcb')](_0x3f1527)[_0x2154('0xb7')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x3f1527[_0x2154('0xf2')]+_0x3f1527[_0x2154('0xf3')]+_0x3f1527[_0x2154('0xf4')]+_0x3f1527['countnosuchnumberretry']+_0x3f1527[_0x2154('0x107')]+_0x3f1527[_0x2154('0xf6')]+_0x3f1527['countmachineretry']+_0x3f1527[_0x2154('0xf8')]>=_0xd54085['dialGlobalMaxRetry']){_0x105aab[_0x2154('0xfa')](_0x3f1527,_0xe12b87,_0x30d5ec,_0x2154('0xfb'));}else{if(_0x3f1527['countmachineretry']>=_0xd54085[_0x2154('0xfc')]){_0x105aab[_0x2154('0xfd')](_0x3f1527,_0xe12b87,_0x30d5ec,_0x2154('0x108'));}else{_0x105aab[_0x2154('0xbf')]({'active':![],'countmachineretry':_0x3f1527[_0x2154('0xf7')],'scheduledat':moment()[_0x2154('0xfe')](_0xd54085[_0x2154('0xff')],_0x2154('0x109'))[_0x2154('0x78')](_0x2154('0x100')),'ContactId':_0x3f1527['ContactId'],'ListId':_0x3f1527[_0x2154('0xd3')],'VoiceQueueId':_0x3f1527[_0x2154('0x101')]||undefined,'CampaignId':_0x3f1527[_0x2154('0xd5')]||undefined})[_0x2154('0xb7')](loggerCatch(_0x2154('0x102')));_0xe12b87({'reschedule':0x1});}}});}}};Dialer[_0x2154('0x1c')][_0x2154('0x35')]=function(_0x5b87fb){var _0x4dce57=this[_0x2154('0xa8')][_0x5b87fb[_0x2154('0xe0')]];var _0x5c72a8=this;var _0x43f968;if(_0x4dce57&&_0x4dce57[_0x2154('0x4e')]===_0x2154('0x8e')){delete this['uniqueId'][_0x5b87fb[_0x2154('0xe0')]];this['updateOriginated'](this[_0x2154('0x20')][_0x4dce57[_0x2154('0xb2')]]);this[_0x2154('0x20')][_0x4dce57['queue']][_0x2154('0x10a')]+=0x1;_0x43f968=new Hangup(_0x4dce57,_0x5b87fb);this['createHistory'](_0x43f968)[_0x2154('0xb7')](loggerCatch(_0x2154('0x10b')));this[_0x2154('0xc9')](_0x43f968)['catch'](loggerCatch(_0x2154('0x10c')));}if(_0x4dce57&&_0x4dce57[_0x2154('0x4e')]!=='ivr'&&isNotNull(this[_0x2154('0x1f')][_0x4dce57['queue']][_0x2154('0x10d')])){delete this[_0x2154('0xa8')][_0x5b87fb[_0x2154('0xe0')]];this[_0x2154('0xb1')](this[_0x2154('0x1f')][_0x4dce57[_0x2154('0xb2')]]);this[_0x2154('0x1f')][_0x4dce57[_0x2154('0xb2')]][_0x2154('0x5f')]+=0x1;this[_0x2154('0x1f')][_0x4dce57[_0x2154('0xb2')]]['outboundAnswerAgiCallsDay']+=0x1;_0x43f968=new Hangup(_0x4dce57,_0x5b87fb);_0x43f968[_0x2154('0xe8')]=0x10;_0x43f968[_0x2154('0xa4')]='AnswerAGI';_0x43f968[_0x2154('0xe9')]=_0x2154('0x10e');this['createHistory'](_0x43f968)[_0x2154('0xb7')](loggerCatch(_0x2154('0x10b')));this[_0x2154('0xc9')](_0x43f968)[_0x2154('0xb7')](loggerCatch('[syncHangupIvr]'));}if(_0x4dce57&&_0x4dce57[_0x2154('0x4e')]!==_0x2154('0x8e')&&!isNotNull(this[_0x2154('0x1f')][_0x4dce57[_0x2154('0xb2')]][_0x2154('0x10d')])){delete this[_0x2154('0xa8')][_0x5b87fb[_0x2154('0xe0')]];this[_0x2154('0xb1')](this[_0x2154('0x1f')][_0x4dce57[_0x2154('0xb2')]]);this[_0x2154('0x1f')][_0x4dce57[_0x2154('0xb2')]][_0x2154('0x68')]+=0x1;_0x43f968=new Hangup(_0x4dce57,_0x5b87fb);_0x43f968[_0x2154('0xe8')]=0xc;_0x43f968[_0x2154('0xa4')]=_0x5b87fb[_0x2154('0x10f')];_0x43f968[_0x2154('0xe9')]=_0x2154('0x110');this['createHistory'](_0x43f968)[_0x2154('0xb7')](loggerCatch(_0x2154('0x10b')));this[_0x2154('0xc9')](_0x43f968)[_0x2154('0xb7')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0x2154('0x1c')][_0x2154('0x32')]=function(_0x5aa002){var _0x412ad4=this[_0x2154('0xa8')][_0x5aa002['uniqueid']];var _0x1f360b=this;if(this[_0x2154('0x1f')][_0x5aa002[_0x2154('0xb2')]]){if(_0x412ad4&&_0x412ad4[_0x2154('0x4e')]!=='ivr'){delete this[_0x2154('0xa8')][_0x5aa002[_0x2154('0xe0')]];this['voiceQueues'][_0x5aa002[_0x2154('0xb2')]]['outboundAnswerCallsDay']+=0x1;var _0xddac8d=new AgentComplete(_0x412ad4,_0x5aa002);if(_0x5aa002[_0x2154('0x111')]===_0x2154('0x112')){_0xddac8d[_0x2154('0x113')]=this['voiceQueues'][_0x5aa002[_0x2154('0xb2')]][_0x2154('0x114')]&&this[_0x2154('0x1f')][_0x5aa002[_0x2154('0xb2')]]['dialAgiAfterHangupAgent']?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0x2154('0xcb')](_0xddac8d)[_0x2154('0xb7')](loggerCatch(_0x2154('0x115')));this[_0x2154('0xc9')](_0xddac8d)[_0x2154('0xb7')](loggerCatch(_0x2154('0x116')));}}};Dialer[_0x2154('0x1c')][_0x2154('0x2d')]=function(_0x465c73){if(this[_0x2154('0x1f')][_0x465c73['queue']]){if(this[_0x2154('0xa8')][_0x465c73[_0x2154('0xe0')]]&&this[_0x2154('0xa8')][_0x465c73[_0x2154('0xe0')]][_0x2154('0x4e')]!==_0x2154('0x8e')){this['updateOriginated'](this[_0x2154('0x1f')][_0x465c73['queue']]);this['uniqueId'][_0x465c73['uniqueid']][_0x2154('0x117')]=moment()[_0x2154('0x78')](_0x2154('0x100'));}}};Dialer[_0x2154('0x1c')][_0x2154('0x118')]=function(_0x4150c6){this[_0x2154('0xcb')](_0x4150c6)[_0x2154('0xb7')](loggerCatch('[syncAgentComplete][createHistory]'));this['moveContactManagedDialer'](_0x4150c6)[_0x2154('0xb7')](loggerCatch(_0x2154('0x119')));};Dialer[_0x2154('0x1c')][_0x2154('0x2e')]=function(_0x14fc65){var _0x4b1027=this[_0x2154('0xa8')][_0x14fc65[_0x2154('0xe0')]];var _0x49cc0c=this;if(this[_0x2154('0x1f')][_0x14fc65['queue']]){if(_0x4b1027&&_0x4b1027[_0x2154('0x4e')]!==_0x2154('0x8e')){delete this['uniqueId'][_0x14fc65[_0x2154('0xe0')]];this[_0x2154('0xb1')](this[_0x2154('0x1f')][_0x14fc65['queue']]);_0x4b1027[_0x2154('0x11a')]=moment()[_0x2154('0x78')](_0x2154('0x100'));var _0x376563=new QueueCallerAbandon(_0x4b1027,_0x14fc65);if(getSeconds(_0x4b1027[_0x2154('0x11a')],_0x4b1027['responsetime'])>=_0x4b1027[_0x2154('0x11b')]){this[_0x2154('0x1f')][_0x14fc65[_0x2154('0xb2')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x2154('0x1f')][_0x14fc65[_0x2154('0xb2')]][_0x2154('0x11c')]+=0x1;this[_0x2154('0x1f')][_0x14fc65[_0x2154('0xb2')]][_0x2154('0x6e')]+=0x1;_0x376563[_0x2154('0xe8')]=0xa;_0x376563['statedesc']=_0x2154('0x11d');_0x376563[_0x2154('0x11e')]=_0x2154('0x11f');_0x376563['agiafterat']=this[_0x2154('0x1f')][_0x14fc65[_0x2154('0xb2')]][_0x2154('0x114')]?moment()[_0x2154('0x78')](_0x2154('0x100')):undefined;_0x376563[_0x2154('0x107')]+=0x1;_0x376563[_0x2154('0xef')]+=0x1;if(_0x376563[_0x2154('0x107')]>=this[_0x2154('0x1f')][_0x14fc65['queue']][_0x2154('0x120')]){this[_0x2154('0x118')](_0x376563);}else{this[_0x2154('0xbf')]({'active':![],'countdropretry':_0x376563['countdropretry'],'scheduledat':moment()[_0x2154('0xfe')](this['voiceQueues'][_0x14fc65[_0x2154('0xb2')]][_0x2154('0x121')],_0x2154('0x109'))[_0x2154('0x78')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4b1027['ContactId'],'ListId':_0x4b1027['ListId'],'VoiceQueueId':_0x4b1027['VoiceQueueId']||undefined,'CampaignId':_0x4b1027[_0x2154('0xd5')]||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));var _0x17d1aa=new History(_0x376563);_0x17d1aa['state']=0xa;_0x17d1aa[_0x2154('0xa4')]=_0x2154('0x11d');_0x17d1aa[_0x2154('0xa6')]=moment()[_0x2154('0x78')]('YYYY-MM-DD\x20HH:mm:ss');_0x17d1aa['endtime']=_0x17d1aa[_0x2154('0xa6')];_0x17d1aa[_0x2154('0x122')]=_0x376563['calleridname'];_0x17d1aa[_0x2154('0x123')]=_0x376563[_0x2154('0x123')];this['createHistory'](_0x17d1aa)[_0x2154('0xb7')](loggerCatch(_0x2154('0x124')));}}else{this['voiceQueues'][_0x14fc65[_0x2154('0xb2')]][_0x2154('0x6b')]+=0x1;this[_0x2154('0x1f')][_0x14fc65[_0x2154('0xb2')]]['outboundDropCallsDayCallersExit']+=0x1;_0x376563[_0x2154('0xe8')]=0xb;_0x376563[_0x2154('0xa4')]='Abandoned';_0x376563[_0x2154('0x11e')]=_0x2154('0x125');_0x376563[_0x2154('0xf6')]+=0x1;_0x376563[_0x2154('0xef')]+=0x1;if(_0x376563[_0x2154('0xf6')]>=this[_0x2154('0x1f')][_0x14fc65[_0x2154('0xb2')]]['dialAbandonedMaxRetry']){this[_0x2154('0x118')](_0x376563);}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x376563[_0x2154('0xf6')],'scheduledat':moment()[_0x2154('0xfe')](this[_0x2154('0x1f')][_0x14fc65[_0x2154('0xb2')]][_0x2154('0x126')],_0x2154('0x109'))[_0x2154('0x78')](_0x2154('0x100')),'ContactId':_0x4b1027['ContactId'],'ListId':_0x4b1027[_0x2154('0xd3')],'VoiceQueueId':_0x4b1027[_0x2154('0x101')]||undefined,'CampaignId':_0x4b1027[_0x2154('0xd5')]||undefined})[_0x2154('0xb7')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x17d1aa=new History(_0x376563);_0x17d1aa[_0x2154('0xe8')]=0xb;_0x17d1aa[_0x2154('0xa4')]=_0x2154('0x127');_0x17d1aa['starttime']=moment()[_0x2154('0x78')](_0x2154('0x100'));_0x17d1aa[_0x2154('0xa5')]=_0x17d1aa['starttime'];_0x17d1aa[_0x2154('0x122')]=_0x376563[_0x2154('0x122')];_0x17d1aa[_0x2154('0x123')]=_0x376563[_0x2154('0x123')];this['createHistory'](_0x17d1aa)[_0x2154('0xb7')](loggerCatch(_0x2154('0x128')));}}}}};Dialer[_0x2154('0x1c')][_0x2154('0x36')]=function(_0x3981a7){if(this[_0x2154('0x25')][_0x3981a7[_0x2154('0xe0')]]){this[_0x2154('0x25')][_0x3981a7[_0x2154('0xe0')]][_0x2154('0xaf')]=_0x3981a7[_0x2154('0xaf')];}if(this[_0x2154('0xa8')][_0x3981a7[_0x2154('0xe0')]]){this['uniqueId'][_0x3981a7['uniqueid']][_0x2154('0xaf')]=_0x3981a7[_0x2154('0xaf')];}};Dialer[_0x2154('0x1c')][_0x2154('0x39')]=function(_0x3a3eb1){if(strategy[this['voiceQueues'][this[_0x2154('0x25')][_0x3a3eb1[_0x2154('0x129')]][_0x2154('0xb2')]][_0x2154('0x50')]]==='roundrobin'){if(this[_0x2154('0x25')][_0x3a3eb1[_0x2154('0x129')]]&&_['isNil'](this['actions'][_0x3a3eb1['actionid']][_0x2154('0x12a')])&&_0x3a3eb1['status']==='1'&&_0x3a3eb1[_0x2154('0x12b')]==='0'){if(this[_0x2154('0x21')][_0x3a3eb1[_0x2154('0x12c')]]){if(!this['agents'][_0x3a3eb1[_0x2154('0x12c')]]['locked']){this[_0x2154('0x21')][_0x3a3eb1[_0x2154('0x12c')]][_0x2154('0x12a')]=!![];this['actions'][_0x3a3eb1['actionid']][_0x2154('0x12a')]=!![];this[_0x2154('0x25')][_0x3a3eb1[_0x2154('0x129')]][_0x2154('0x12c')]=_0x3a3eb1[_0x2154('0x12c')];}}}}else if((strategy[this[_0x2154('0x1f')][this['actions'][_0x3a3eb1[_0x2154('0x129')]][_0x2154('0xb2')]][_0x2154('0x50')]]||_0x2154('0x12d'))==='rrmemory'){if(this[_0x2154('0x25')][_0x3a3eb1[_0x2154('0x129')]]){if(this[_0x2154('0x21')][_0x3a3eb1[_0x2154('0x12c')]]){this[_0x2154('0x25')][_0x3a3eb1['actionid']]['stateinterface']=_0x3a3eb1['stateinterface'];if(_['isNil'](this[_0x2154('0x12e')][this['actions'][_0x3a3eb1[_0x2154('0x129')]][_0x2154('0xb2')]])){this['queueBooked'][this[_0x2154('0x25')][_0x3a3eb1[_0x2154('0x129')]][_0x2154('0xb2')]]=[];}this[_0x2154('0x12e')][this[_0x2154('0x25')][_0x3a3eb1[_0x2154('0x129')]][_0x2154('0xb2')]]['push'](_[_0x2154('0x8b')](_[_0x2154('0xd1')](this[_0x2154('0x25')][_0x3a3eb1['actionid']],[_0x2154('0x12f'),_0x2154('0x12c')]),{'status':_0x3a3eb1[_0x2154('0xae')],'paused':_0x3a3eb1['paused']}));}}}};function unlockQueueStatus(_0x3730df,_0x4fc2b8){setTimeout(function(){if(_['isUndefined'](_0x3730df[_0x2154('0x130')])){loggerBooked[_0x2154('0x92')]('[unlockQueueStatus][undefined]',_0x4fc2b8);}_0x3730df[_0x2154('0x130')]=!![];loggerBooked['info'](_0x2154('0x131'),_0x4fc2b8,JSON[_0x2154('0x49')](_[_0x2154('0xd1')](_0x3730df,['name',_0x2154('0x130')])));},0x1f3);}Dialer[_0x2154('0x1c')]['syncQueueStatusComplete']=function(_0x326669){var _0x38dceb=this;var _0x1f8a74=_0x38dceb[_0x2154('0x1f')][_0x38dceb[_0x2154('0x25')][_0x326669[_0x2154('0x129')]]['queue']];if(strategy[this[_0x2154('0x1f')][this['actions'][_0x326669[_0x2154('0x129')]][_0x2154('0xb2')]][_0x2154('0x50')]]===_0x2154('0x132')){if(this[_0x2154('0x25')][_0x326669[_0x2154('0x129')]]&&this[_0x2154('0x25')][_0x326669[_0x2154('0x129')]][_0x2154('0x12c')]){this[_0x2154('0x1e')]['run'](this[_0x2154('0x25')][_0x326669[_0x2154('0x129')]][_0x2154('0x12f')],this[_0x2154('0x25')][_0x326669[_0x2154('0x129')]][_0x2154('0x12c')])['catch'](function(_0x38bf63){logger[_0x2154('0x92')](_0x2154('0x133'),util['inspect'](_0x38bf63,{'showHidden':![],'depth':null}));})[_0x2154('0x1d')](function(){_0x38dceb['updateOriginated'](_0x38dceb['voiceQueues'][_0x38dceb[_0x2154('0x25')][_0x326669[_0x2154('0x129')]][_0x2154('0xb2')]]);_0x38dceb[_0x2154('0x21')][_0x38dceb[_0x2154('0x25')][_0x326669[_0x2154('0x129')]][_0x2154('0x12c')]][_0x2154('0x12a')]=![];delete _0x38dceb['actions'][_0x326669[_0x2154('0x129')]];unlockQueueStatus(_0x1f8a74);});}else{this[_0x2154('0xb1')](this[_0x2154('0x1f')][this[_0x2154('0x25')][_0x326669[_0x2154('0x129')]][_0x2154('0xb2')]]);this[_0x2154('0xbf')]({'active':![],'ContactId':this[_0x2154('0x25')][_0x326669[_0x2154('0x129')]][_0x2154('0xd2')],'ListId':this[_0x2154('0x25')][_0x326669[_0x2154('0x129')]][_0x2154('0xd3')],'VoiceQueueId':this[_0x2154('0x25')][_0x326669[_0x2154('0x129')]][_0x2154('0x101')]||undefined,'CampaignId':this[_0x2154('0x25')][_0x326669['actionid']]['CampaignId']||undefined})[_0x2154('0xb7')](loggerCatch(_0x2154('0x134')));delete this[_0x2154('0x25')][_0x326669[_0x2154('0x129')]];unlockQueueStatus(_0x1f8a74);}}else if((strategy[this[_0x2154('0x1f')][this[_0x2154('0x25')][_0x326669[_0x2154('0x129')]][_0x2154('0xb2')]]['strategy']]||_0x2154('0x12d'))===_0x2154('0x12d')){var _0x5c7942;if(this[_0x2154('0x25')][_0x326669[_0x2154('0x129')]]&&!_[_0x2154('0x46')](this['queueBooked'][this['actions'][_0x326669['actionid']]['queue']])){if(this[_0x2154('0x2b')][_0x38dceb[_0x2154('0x25')][_0x326669[_0x2154('0x129')]]['queue']]){this['queueBookedRR'][_0x38dceb[_0x2154('0x25')][_0x326669[_0x2154('0x129')]][_0x2154('0xb2')]]=this[_0x2154('0x2b')][this[_0x2154('0x25')][_0x326669[_0x2154('0x129')]]['queue']]?this[_0x2154('0x2b')][this[_0x2154('0x25')][_0x326669[_0x2154('0x129')]][_0x2154('0xb2')]]:this[_0x2154('0x12e')][this[_0x2154('0x25')][_0x326669[_0x2154('0x129')]][_0x2154('0xb2')]]?this[_0x2154('0x12e')][this[_0x2154('0x25')][_0x326669[_0x2154('0x129')]][_0x2154('0xb2')]][_0x2154('0x135')]||0x0:0x0;}this[_0x2154('0x12e')][this[_0x2154('0x25')][_0x326669[_0x2154('0x129')]][_0x2154('0xb2')]][_0x2154('0x135')]=this[_0x2154('0x2b')][this[_0x2154('0x25')][_0x326669[_0x2154('0x129')]]['queue']];for(var _0xf697f=0x0;_0xf697f=0x0;})[_0x2154('0xb7')](myreject(_0x1c030b)));}}else{_0x31fbef[_0x2154('0x151')](ami[_0x2154('0xad')]({'action':_0x2154('0x152'),'command':util[_0x2154('0x78')](_0x2154('0x153'),_0x2a84d8,!_['isUndefined'](config['timezones'][_0x3bb635])?_0x3bb635:'')})[_0x2154('0xba')](function(_0x210d5a){return _0x210d5a[_0x2154('0x155')][_0x2154('0x157')](_0x2154('0x156'))>=0x0;})[_0x2154('0xb7')](myreject(_0x1c030b)));}BPromise[_0x2154('0x158')](_0x31fbef)[_0x2154('0xba')](function(_0x2f0421){var _0x8d58bc=_[_0x2154('0x159')](_0x2f0421);if(_0x8d58bc){return _0x50242c(_0x8d58bc);}else{_0x46b8f8[_0x2154('0x40')]=_0x50e309?_0x2154('0x15a'):_0x2154('0x15b');return _0x1c030b(msgResponse('[ifTime][promiseAll]',_0x2154('0x14a'),'Global:\x20'+_0x50e309+'\x20'+_0x25cf27+_0x2154('0x15c')+util[_0x2154('0x93')](_0x2a84d8,{'showHidden':![],'depth':null})+_0x2154('0x15d')+_0x3bb635));}})['catch'](function(_0x1bf0be){return _0x1c030b(msgResponse(_0x2154('0x147'),_0x2154('0x14a'),JSON[_0x2154('0x49')](_0x1bf0be)));});});};Dialer[_0x2154('0x1c')]['checkDialMethod']=function(_0x2930d1){var _0x883afe=this;return function(){switch(_0x2930d1['dialMethod']){case _0x2154('0x15e'):freeVariablesPredictive(_0x2930d1);_0x883afe[_0x2154('0x15f')](_0x2930d1,0x1);break;case _0x2154('0x160'):freeVariablesPredictive(_0x2930d1);_0x883afe[_0x2154('0x15f')](_0x2930d1,_0x2930d1[_0x2154('0x161')]);break;case'predictive':_0x883afe[_0x2154('0xa')](_0x2930d1);break;case _0x2154('0x162'):freeVariablesPredictive(_0x2930d1);_0x883afe[_0x2154('0x15f')](_0x2930d1,0x1);break;default:freeVariablesPredictive(_0x2930d1);logger[_0x2154('0x92')]('Queue',_0x2930d1[_0x2154('0x3f')],_0x2154('0x163'));}};};Dialer[_0x2154('0x1c')][_0x2154('0x164')]=function(_0x3d5c1a){var _0x5c7c2c=this;return function(){_0x5c7c2c[_0x2154('0x165')](_0x3d5c1a);};};Dialer[_0x2154('0x1c')]['syncQueueSummary']=function(_0x54e2a5){var _0x31895e=this;if(isNotPreview(_0x54e2a5[_0x2154('0x59')])){if(isVoiceQueueOutbound(_0x54e2a5[_0x2154('0x4e')])&&isActive(_0x54e2a5[_0x2154('0x166')])){_0x54e2a5[_0x2154('0x9c')]=!![];BPromise[_0x2154('0xb5')]()[_0x2154('0xba')](checkIsLoggedIn(_0x54e2a5,_0x54e2a5[_0x2154('0x53')]))[_0x2154('0xba')](checkIsActive(_0x54e2a5,_0x54e2a5[_0x2154('0x166')]))[_0x2154('0xba')](checkInterval(_0x54e2a5))[_0x2154('0xba')](_0x31895e[_0x2154('0x142')](_0x54e2a5))[_0x2154('0xba')](_0x31895e[_0x2154('0x146')](_0x54e2a5[_0x2154('0x167')],_0x54e2a5[_0x2154('0x168')],_0x54e2a5['name'],_0x54e2a5))[_0x2154('0xba')](_0x31895e[_0x2154('0x148')](_0x54e2a5[_0x2154('0x42')],_0x54e2a5[_0x2154('0x168')],_0x54e2a5['name'],_0x54e2a5))[_0x2154('0xba')](_0x31895e[_0x2154('0x169')](_0x54e2a5))[_0x2154('0xb7')](loggerCatchQueueSummary(_0x2154('0x16a'),_0x54e2a5));}else{notSendMessagesQueue(_0x54e2a5);}}else{freeVariablesPredictive(_0x54e2a5);}};Dialer[_0x2154('0x1c')][_0x2154('0x141')]=function(){var _0x2960b2=this;var _0x4b8761;for(var _0x4b3c81 in this[_0x2154('0x20')]){if(typeof this[_0x2154('0x20')][_0x4b3c81]!==_0x2154('0xaa')){_0x4b8761=this[_0x2154('0x20')][_0x4b3c81];if(isCampaignIvr(_0x4b8761['type'])&&isActive(_0x4b8761[_0x2154('0xdb')])){_0x4b8761[_0x2154('0x9c')]=!![];BPromise[_0x2154('0xb5')]()[_0x2154('0xba')](checkIsActive(_0x4b8761,_0x4b8761[_0x2154('0xdb')]))[_0x2154('0xba')](checkInterval(_0x4b8761))['then'](_0x2960b2['checkIsTrunkReachable'](_0x4b8761))[_0x2154('0xba')](_0x2960b2[_0x2154('0x146')](_0x4b8761[_0x2154('0x167')],_0x4b8761[_0x2154('0x168')],_0x4b8761[_0x2154('0x3f')],_0x4b8761))['then'](_0x2960b2['checkIfTimeIntervals'](_0x4b8761[_0x2154('0x42')],_0x4b8761['dialTimezone'],_0x4b8761[_0x2154('0x3f')],_0x4b8761))['then'](_0x2960b2[_0x2154('0x164')](_0x4b8761))[_0x2154('0xb7')](loggerCatchQueueSummary(_0x2154('0x16b'),_0x4b8761));}else{notSendMessagesCampaign(_0x4b8761);}}}};function getCallerIdRandom(_0x1541d3,_0x4f3c9a){var _0x78bdab;var _0x577dd9;var _0x2af4dd;if(_0x4f3c9a<=0x0){_0x4f3c9a=0x1;}_0x78bdab=new RegExp(_0x2154('0x16c')+_0x4f3c9a+'}$');_0x577dd9=Math[_0x2154('0x16d')](0xa,_0x4f3c9a-0x1);_0x2af4dd=Math[_0x2154('0x16d')](0xa,_0x4f3c9a)-0x1;return util[_0x2154('0x78')]('%s',_[_0x2154('0x16e')](_0x1541d3,_0x78bdab,_[_0x2154('0x16f')](_0x577dd9,_0x2af4dd)));}function extractCalleridName(_0x5b0049){var _0x2f2b97=_0x5b0049[_0x2154('0x170')](/"(.*?)"/);return _0x2f2b97?_0x2f2b97[0x1]:_0x5b0049;}function extractCalleridNumber(_0x425c0d){var _0x36ad23=_0x425c0d[_0x2154('0x170')](/<(.*?)>/);return _0x36ad23?_0x36ad23[0x1]:_0x425c0d;}Dialer[_0x2154('0x1c')][_0x2154('0x171')]=function(_0x26d687,_0x2afb63){var _0x3bff80=this;var _0x54ab1d=uuid['v4']();this[_0x2154('0x25')][_0x54ab1d]=new Action(_0x26d687,_0x2afb63,_0x54ab1d);return new BPromise(function(_0x55405f,_0x21e1b1){if(_[_0x2154('0x3d')](_0x26d687)&&typeof _0x26d687!=='object'){return _0x21e1b1(msgResponse(_0x2154('0x172'),_0x2154('0x14a'),_0x2154('0x173')));}if(_['isUndefined'](_0x2afb63['Contact'][_0x2154('0x174')])||_0x2afb63[_0x2154('0x175')][_0x2154('0x174')]===null){return _0x21e1b1(msgResponse('originate',_0x2154('0x14a'),'contact\x20is\x20undefine'));}var _0x55b027={'XMD-CALLERID':_0x3bff80[_0x2154('0x25')][_0x54ab1d][_0x2154('0x176')](),'XMD-AGI':_0x26d687['dialQueueProject']?util['format'](_0x2154('0x177'),ipAgi,_0x26d687[_0x2154('0x10d')]):_0x2154('0x178'),'XMD-AGIAFTER':_0x26d687[_0x2154('0x114')]?util[_0x2154('0x78')](_0x2154('0x177'),ipAgi,_0x26d687['dialQueueProject2']):_0x2154('0x178'),'XMD-QUEUE':_0x26d687[_0x2154('0x4e')]===_0x2154('0x4f')?util[_0x2154('0x78')](_0x2154('0x179'),_0x26d687[_0x2154('0x3f')],_0x26d687[_0x2154('0x17a')]||'',_0x26d687['dialAgiAfterHangupAgent']?'c':'',_0x26d687[_0x2154('0x11b')]||0x3):_0x2154('0x178'),'XMD-CONTACTID':_0x2afb63['ContactId'],'XMD-CDRTYPE':_0x2154('0x8'),'CALLERID(all)':_0x3bff80[_0x2154('0x25')][_0x54ab1d][_0x2154('0x176')](),'XMD-AMD':_0x26d687['dialAMDActive']?_0x2154('0x17b'):_0x2154('0x178'),'XMD-DESTINATION':_0x2154('0xe4')};if(_0x26d687['dialAMDActive']){_0x55b027[_0x2154('0x17c')]=_0x26d687[_0x2154('0x17d')]||0x9c4;_0x55b027['XMD-AMDGREETING']=_0x26d687['dialAMDGreeting']||0x5dc;_0x55b027[_0x2154('0x17e')]=_0x26d687[_0x2154('0x17f')]||0x320;_0x55b027[_0x2154('0x180')]=_0x26d687[_0x2154('0x181')]||0x1388;_0x55b027['XMD-AMDMINWORDLENGTH']=_0x26d687[_0x2154('0x182')]||0x64;_0x55b027[_0x2154('0x183')]=_0x26d687[_0x2154('0x184')]||0x32;_0x55b027[_0x2154('0x185')]=_0x26d687[_0x2154('0x186')]||0x3;_0x55b027[_0x2154('0x187')]=_0x26d687[_0x2154('0x188')]||0x100;_0x55b027['XMD-AMDMAXIMUMWORDLENGTH']=_0x26d687[_0x2154('0x189')]||0x1388;}if(_0x26d687[_0x2154('0x4e')]===_0x2154('0x4f')){_0x55b027['XMD-VOICEQUEUEID']=_0x2afb63[_0x2154('0x101')];}else{_0x55b027[_0x2154('0x18a')]=_0x2afb63[_0x2154('0xd5')];}for(var _0x591740 in _0x2afb63[_0x2154('0x175')]){if(typeof _0x2afb63[_0x2154('0x175')][_0x591740]!==_0x2154('0xaa')){if(isNotNull(_0x2afb63['Contact'][_0x591740])&&_0x591740!=='id'&&_0x591740!==_0x2154('0x18b')&&_0x591740!=='createdAt'&&_0x591740!==_0x2154('0x18c')){_0x55b027[util[_0x2154('0x78')](_0x2154('0x18d'),_0x2154('0x18e'),_[_0x2154('0x18f')](_0x591740))]=_0x2afb63[_0x2154('0x175')][_0x591740];}}}var _0x1f2777=_0x3bff80[_0x2154('0xda')](_0x26d687[_0x2154('0x75')])?getCallerId(_0x26d687[_0x2154('0x75')][_0x2154('0x76')],_0x26d687['dialOriginateCallerIdName'],_0x26d687[_0x2154('0x190')]>0x0?getCallerIdRandom(_0x26d687[_0x2154('0x5b')],_0x26d687[_0x2154('0x190')]):_0x26d687['dialOriginateCallerIdNumber']):getCallerId(_[_0x2154('0xac')](_0x26d687['TrunkBackup'])?_0x26d687[_0x2154('0x75')]['callerid']:_0x26d687[_0x2154('0x143')][_0x2154('0x76')],_0x26d687[_0x2154('0x5a')],_0x26d687[_0x2154('0x190')]>0x0?getCallerIdRandom(_0x26d687[_0x2154('0x5b')],_0x26d687[_0x2154('0x190')]):_0x26d687['dialOriginateCallerIdNumber']);if(_0x1f2777){_0x55b027[_0x2154('0x191')]=_0x3bff80[_0x2154('0x25')][_0x54ab1d]['originatecalleridname']=extractCalleridName(_0x1f2777);_0x55b027[_0x2154('0x192')]=_0x3bff80[_0x2154('0x25')][_0x54ab1d][_0x2154('0x193')]=extractCalleridNumber(_0x1f2777);}return ami[_0x2154('0xad')]({'actionid':_0x54ab1d,'action':_0x2154('0x172'),'channel':_0x3bff80['isTrunkReachable'](_0x26d687[_0x2154('0x75')])?util[_0x2154('0x78')](_0x2154('0x194'),_0x26d687[_0x2154('0x75')][_0x2154('0x3f')],isNotNull(_0x26d687[_0x2154('0x5d')])?_0x26d687[_0x2154('0x5d')][_0x2154('0x195')]()||'':'',_0x26d687[_0x2154('0x196')]>0x0?_0x2afb63['Contact']['phone'][_0x2154('0x197')](_0x26d687[_0x2154('0x196')]):_0x2afb63[_0x2154('0x175')][_0x2154('0x174')]):util[_0x2154('0x78')](_0x2154('0x194'),_[_0x2154('0xac')](_0x26d687[_0x2154('0x143')])?_0x26d687[_0x2154('0x75')][_0x2154('0x3f')]:_0x26d687[_0x2154('0x143')]['name'],isNotNull(_0x26d687[_0x2154('0x5d')])?_0x26d687[_0x2154('0x5d')][_0x2154('0x195')]()||'':'',_0x26d687['dialCutDigit']>0x0?_0x2afb63[_0x2154('0x175')][_0x2154('0x174')][_0x2154('0x197')](_0x26d687[_0x2154('0x196')]):_0x2afb63[_0x2154('0x175')][_0x2154('0x174')]),'callerid':_0x1f2777,'Exten':_0x2154('0xe4'),'Context':_0x2154('0x198'),'Priority':'1','variable':_0x55b027,'timeout':(_0x26d687[_0x2154('0x5c')]||0x1e)*0x3e8,'async':!![],'channelid':_0x54ab1d})['then'](function(_0x493323){return _0x55405f(_0x493323);})[_0x2154('0xb7')](function(_0x29ee62){_0x26d687[_0x2154('0x65')]+=0x1;var _0x31ea0d=new History(_0x3bff80[_0x2154('0x25')][_0x54ab1d]);logger[_0x2154('0x92')](util['format'](_0x2154('0x199'),JSON[_0x2154('0x49')](_0x29ee62)));_0x31ea0d[_0x2154('0xe8')]=0xe;_0x31ea0d['statedesc']='OriginateError';_0x31ea0d[_0x2154('0xa6')]=moment()[_0x2154('0x78')](_0x2154('0x100'));_0x31ea0d[_0x2154('0xa5')]=_0x31ea0d['starttime'];_0x3bff80[_0x2154('0xcb')](_0x31ea0d)[_0x2154('0xb7')](loggerCatch(_0x2154('0x19a')));_0x3bff80[_0x2154('0xc9')](_0x31ea0d)['catch'](loggerCatch('[originate][error]'))['finally'](function(){delete _0x3bff80[_0x2154('0x25')][_0x54ab1d];return _0x21e1b1(msgResponse(_0x2154('0x172'),_0x2154('0x48'),_0x2154('0x19b')));});});});};Dialer[_0x2154('0x1c')]['syncOriginateResponse']=function(_0x56e2be){var _0x4aa960=this[_0x2154('0x25')][_0x56e2be['actionid']];if(_0x4aa960){delete this['actions'][_0x56e2be['actionid']];_0x4aa960[_0x2154('0x19c')]=moment()[_0x2154('0x78')](_0x2154('0x100'));var _0x4d9549=_0x4aa960[_0x2154('0x4e')]===_0x2154('0x8e')?this[_0x2154('0x20')][_0x4aa960[_0x2154('0xb2')]]:this[_0x2154('0x1f')][_0x4aa960[_0x2154('0x19d')]()];if(!this[_0x2154('0xd8')](_0x56e2be[_0x2154('0x19e')])){this['updateOriginated'](_0x4d9549);return this['callProgressDetecting'](_0x4aa960,_0x4d9549,_0x56e2be)[_0x2154('0xb7')](loggerCatch(_0x2154('0x19f')));}this[_0x2154('0xa8')][_0x56e2be[_0x2154('0xe0')]]=_0x4aa960;}};Dialer[_0x2154('0x1c')]['checkRetriveMax']=function(_0xd5cc8c,_0x3de7db,_0x280fa6){var _0x275bd5=new History(_0x3de7db);if(_0x275bd5['countbusyretry']+_0x275bd5['countcongestionretry']+_0x275bd5[_0x2154('0xf4')]+_0x275bd5[_0x2154('0xf5')]+_0x275bd5[_0x2154('0x107')]+_0x275bd5[_0x2154('0xf6')]+_0x275bd5[_0x2154('0xf7')]+_0x275bd5[_0x2154('0xf8')]>=_0x280fa6[_0x2154('0xf9')]-0x1){return!![];}switch(_0xd5cc8c){case 0x3:if(_0x275bd5['countnoanswerretry']>=_0x280fa6['dialNoAnswerMaxRetry']-0x1){return!![];}this[_0x2154('0xbf')]({'active':![],'countnoanswerretry':_0x275bd5[_0x2154('0xf4')]+=0x1,'scheduledat':moment()[_0x2154('0xfe')](_0x280fa6['dialNoAnswerRetryFrequency'],_0x2154('0x109'))[_0x2154('0x78')](_0x2154('0x100')),'ContactId':_0x275bd5[_0x2154('0xd2')],'ListId':_0x275bd5['ListId'],'VoiceQueueId':_0x275bd5['VoiceQueueId']||undefined,'CampaignId':_0x275bd5[_0x2154('0xd5')]||undefined})['catch'](loggerCatch(_0x2154('0x1a0')));break;case 0x5:if(_0x275bd5[_0x2154('0xf2')]>=_0x280fa6[_0x2154('0x1a1')]-0x1){return!![];}this[_0x2154('0xbf')]({'active':![],'countbusyretry':_0x275bd5['countbusyretry']+=0x1,'scheduledat':moment()['add'](_0x280fa6[_0x2154('0x1a2')],'minutes')[_0x2154('0x78')](_0x2154('0x100')),'ContactId':_0x275bd5['ContactId'],'ListId':_0x275bd5[_0x2154('0xd3')],'VoiceQueueId':_0x275bd5['VoiceQueueId']||undefined,'CampaignId':_0x275bd5[_0x2154('0xd5')]||undefined})[_0x2154('0xb7')](loggerCatch(_0x2154('0x1a3')));break;case 0x8:if(_0x275bd5['countcongestionretry']>=_0x280fa6['dialCongestionMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0x275bd5['countcongestionretry']+=0x1,'scheduledat':moment()['add'](_0x280fa6[_0x2154('0x1a4')],_0x2154('0x109'))[_0x2154('0x78')](_0x2154('0x100')),'ContactId':_0x275bd5[_0x2154('0xd2')],'ListId':_0x275bd5[_0x2154('0xd3')],'VoiceQueueId':_0x275bd5[_0x2154('0x101')]||undefined,'CampaignId':_0x275bd5[_0x2154('0xd5')]||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x275bd5[_0x2154('0xf5')]>=_0x280fa6[_0x2154('0x1a5')]-0x1){return!![];}else{this[_0x2154('0xbf')]({'active':![],'countnosuchnumberretry':_0x275bd5[_0x2154('0xf5')]+=0x1,'scheduledat':moment()['add'](_0x280fa6['dialNoSuchNumberRetryFrequency'],_0x2154('0x109'))['format'](_0x2154('0x100')),'ContactId':_0x275bd5['ContactId'],'ListId':_0x275bd5['ListId'],'VoiceQueueId':_0x275bd5[_0x2154('0x101')]||undefined,'CampaignId':_0x275bd5['CampaignId']||undefined})[_0x2154('0xb7')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x275bd5[_0x2154('0x107')]>=_0x280fa6[_0x2154('0x120')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countdropretry':_0x275bd5[_0x2154('0x107')]+=0x1,'scheduledat':moment()[_0x2154('0xfe')](_0x280fa6[_0x2154('0x121')],_0x2154('0x109'))[_0x2154('0x78')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x275bd5[_0x2154('0xd2')],'ListId':_0x275bd5[_0x2154('0xd3')],'VoiceQueueId':_0x275bd5[_0x2154('0x101')]||undefined,'CampaignId':_0x275bd5[_0x2154('0xd5')]||undefined})[_0x2154('0xb7')](loggerCatch(_0x2154('0x1a6')));break;case 0xb:if(_0x275bd5[_0x2154('0xf6')]>=_0x280fa6[_0x2154('0x1a7')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0x275bd5['countabandonedretry']+=0x1,'scheduledat':moment()[_0x2154('0xfe')](_0x280fa6[_0x2154('0x126')],_0x2154('0x109'))[_0x2154('0x78')](_0x2154('0x100')),'ContactId':_0x275bd5[_0x2154('0xd2')],'ListId':_0x275bd5[_0x2154('0xd3')],'VoiceQueueId':_0x275bd5[_0x2154('0x101')]||undefined,'CampaignId':_0x275bd5[_0x2154('0xd5')]||undefined})[_0x2154('0xb7')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x275bd5[_0x2154('0xf7')]>=_0x280fa6[_0x2154('0xfc')]-0x1){return!![];}this[_0x2154('0xbf')]({'active':![],'countmachineretry':_0x275bd5[_0x2154('0xf7')]+=0x1,'scheduledat':moment()[_0x2154('0xfe')](_0x280fa6[_0x2154('0xff')],_0x2154('0x109'))[_0x2154('0x78')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x275bd5[_0x2154('0xd2')],'ListId':_0x275bd5[_0x2154('0xd3')],'VoiceQueueId':_0x275bd5[_0x2154('0x101')]||undefined,'CampaignId':_0x275bd5[_0x2154('0xd5')]||undefined})[_0x2154('0xb7')](loggerCatch(_0x2154('0x102')));break;case 0x14:if(_0x275bd5[_0x2154('0xf8')]>=_0x280fa6['dialAgentRejectMaxRetry']-0x1){return!![];}this[_0x2154('0xbf')]({'active':![],'countagentrejectretry':_0x275bd5['countagentrejectretry']+=0x1,'scheduledat':moment()['add'](_0x280fa6['dialAgentRejectRetryFrequency'],_0x2154('0x109'))[_0x2154('0x78')](_0x2154('0x100')),'ContactId':_0x275bd5[_0x2154('0xd2')],'ListId':_0x275bd5[_0x2154('0xd3')],'VoiceQueueId':_0x275bd5[_0x2154('0x101')]||undefined,'CampaignId':_0x275bd5[_0x2154('0xd5')]||undefined})[_0x2154('0xb7')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0x2154('0x1c')]['callProgressDetecting']=function(_0x345d8e,_0x4f2d69,_0x28ed0b){var _0x24a0a7=this;var _0x10060a=new History(_0x345d8e);return new BPromise(function(_0x26dbf4,_0x3641b3){if(_[_0x2154('0x3d')](_0x4f2d69)&&typeof _0x4f2d69!=='object'){return _0x3641b3(msgResponse('[callProgressDetecting]',_0x2154('0x14a'),'entity\x20is\x20undefine'));}if(_[_0x2154('0x3d')](_0x28ed0b)&&typeof _0x28ed0b!=='object'){return _0x3641b3(msgResponse(_0x2154('0x1a8'),_0x2154('0x14a'),_0x2154('0x1a9')));}switch(_0x28ed0b[_0x2154('0x111')]){case'0':_0x4f2d69[_0x2154('0x1aa')]+=0x1;_0x10060a[_0x2154('0xe8')]=0x0;_0x10060a[_0x2154('0xa4')]='NoSuchNumber';_0x10060a[_0x2154('0xf5')]+=0x1;_0x10060a[_0x2154('0xef')]+=0x1;ami[_0x2154('0x4d')](_0x2154('0x1ab'),ut[_0x2154('0xf0')](_0x345d8e,'nosuchnumber'));_0x24a0a7[_0x2154('0xcb')](_0x10060a)['catch'](loggerCatch(_0x2154('0xf1')));if(_0x24a0a7[_0x2154('0x1ac')](0x0,_0x345d8e,_0x4f2d69)){if(_0x10060a[_0x2154('0xf5')]>=_0x4f2d69[_0x2154('0x1a5')]){_0x24a0a7[_0x2154('0xfd')](_0x10060a,_0x26dbf4,_0x3641b3,_0x2154('0x1ad'));}else{_0x24a0a7[_0x2154('0xfa')](_0x10060a,_0x26dbf4,_0x3641b3,_0x2154('0x1ad'));}}break;case'3':_0x4f2d69[_0x2154('0x64')]+=0x1;_0x10060a[_0x2154('0xe8')]=0x3;_0x10060a[_0x2154('0xa4')]=_0x2154('0x1ae');_0x10060a[_0x2154('0xf4')]+=0x1;_0x10060a[_0x2154('0xef')]+=0x1;ami['emit'](_0x2154('0x1af'),ut[_0x2154('0xf0')](_0x345d8e,_0x2154('0x1b0')));_0x24a0a7[_0x2154('0xcb')](_0x10060a)['catch'](loggerCatch(_0x2154('0x1b1')));if(_0x24a0a7['checkRetriveMax'](0x3,_0x345d8e,_0x4f2d69)){if(_0x10060a['countnoanswerretry']>=_0x4f2d69[_0x2154('0x1b2')]){_0x24a0a7[_0x2154('0xfd')](_0x10060a,_0x26dbf4,_0x3641b3,_0x2154('0x1b3'));}else{_0x24a0a7[_0x2154('0xfa')](_0x10060a,_0x26dbf4,_0x3641b3,_0x2154('0x1b3'));}}break;case'5':_0x4f2d69[_0x2154('0x61')]+=0x1;_0x10060a[_0x2154('0xe8')]=0x5;_0x10060a[_0x2154('0xa4')]=_0x2154('0x1b4');_0x10060a[_0x2154('0xf2')]+=0x1;_0x10060a[_0x2154('0xef')]+=0x1;ami[_0x2154('0x4d')](_0x2154('0x1b5'),ut[_0x2154('0xf0')](_0x345d8e,'busy'));_0x24a0a7[_0x2154('0xcb')](_0x10060a)[_0x2154('0xb7')](loggerCatch(_0x2154('0x1b6')));if(_0x24a0a7[_0x2154('0x1ac')](0x5,_0x345d8e,_0x4f2d69)){if(_0x10060a[_0x2154('0xf2')]>=_0x4f2d69[_0x2154('0x1a1')]){_0x24a0a7[_0x2154('0xfd')](_0x10060a,_0x26dbf4,_0x3641b3,_0x2154('0x1b7'));}else{_0x24a0a7[_0x2154('0xfa')](_0x10060a,_0x26dbf4,_0x3641b3,'reason\x205\x20busy');}}break;case'8':_0x4f2d69[_0x2154('0x62')]+=0x1;_0x10060a[_0x2154('0xe8')]=0x8;_0x10060a['statedesc']=_0x2154('0x1b8');_0x10060a[_0x2154('0xf3')]+=0x1;_0x10060a[_0x2154('0xef')]+=0x1;ami[_0x2154('0x4d')](_0x2154('0x1b9'),ut[_0x2154('0xf0')](_0x345d8e,'congestion'));_0x24a0a7[_0x2154('0xcb')](_0x10060a)['catch'](loggerCatch(_0x2154('0x1ba')));if(_0x24a0a7['checkRetriveMax'](0x8,_0x345d8e,_0x4f2d69)){if(_0x10060a[_0x2154('0xf3')]>=_0x4f2d69['dialCongestionMaxRetry']){_0x24a0a7[_0x2154('0xfd')](_0x10060a,_0x26dbf4,_0x3641b3,_0x2154('0x1bb'));}else{_0x24a0a7['stateGlobal'](_0x10060a,_0x26dbf4,_0x3641b3,_0x2154('0x1bb'));}}break;case'11':_0x4f2d69[_0x2154('0x1bc')]+=0x1;_0x10060a[_0x2154('0xe8')]=0xb;_0x10060a['statedesc']=_0x2154('0x127');_0x10060a[_0x2154('0xf6')]+=0x1;_0x10060a[_0x2154('0xef')]+=0x1;_0x24a0a7['createHistory'](_0x10060a)[_0x2154('0xb7')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x24a0a7[_0x2154('0x1ac')](0xb,_0x345d8e,_0x4f2d69)){if(_0x10060a[_0x2154('0xf6')]>=_0x4f2d69['dialAbandonedMaxRetry']){_0x24a0a7['createStateFinal'](_0x10060a,_0x26dbf4,_0x3641b3,_0x2154('0x1bd'));}else{_0x24a0a7[_0x2154('0xfa')](_0x10060a,_0x26dbf4,_0x3641b3,'reason\x2011\x20abandoned');}}break;case'20':_0x4f2d69['outboundRejectCallsDay']+=0x1;_0x10060a[_0x2154('0xe8')]=0x14;_0x10060a[_0x2154('0xa4')]=_0x2154('0x1be');_0x10060a[_0x2154('0xf8')]+=0x1;_0x10060a[_0x2154('0xef')]+=0x1;ami[_0x2154('0x4d')](_0x2154('0x1bf'),ut['buildObj'](_0x345d8e,_0x2154('0x1c0')));_0x24a0a7[_0x2154('0xcb')](_0x10060a)[_0x2154('0xb7')](loggerCatch(_0x2154('0x1c1')));if(_0x24a0a7[_0x2154('0x1ac')](0x14,_0x345d8e,_0x4f2d69)){if(_0x10060a['countagentrejectretry']>=_0x4f2d69[_0x2154('0x1c2')]){_0x24a0a7['createStateFinal'](_0x10060a,_0x26dbf4,_0x3641b3,_0x2154('0x1c3'));}else{_0x24a0a7['stateGlobal'](_0x10060a,_0x26dbf4,_0x3641b3,_0x2154('0x1c3'));}}break;default:_0x4f2d69[_0x2154('0x68')]+=0x1;_0x10060a[_0x2154('0xe8')]=0xc;_0x10060a[_0x2154('0xa4')]=_0x28ed0b['reason'];_0x24a0a7[_0x2154('0xcb')](_0x10060a)[_0x2154('0xb7')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x24a0a7[_0x2154('0x1ac')](_0x28ed0b[_0x2154('0x111')],_0x345d8e,_0x4f2d69)){if(_0x10060a[_0x2154('0xf2')]+_0x10060a[_0x2154('0xf3')]+_0x10060a[_0x2154('0xf4')]+_0x10060a['countnosuchnumberretry']+_0x10060a[_0x2154('0x107')]+_0x10060a['countabandonedretry']+_0x10060a[_0x2154('0xf7')]+_0x10060a[_0x2154('0xf8')]>=_0x4f2d69[_0x2154('0xf9')]){_0x24a0a7[_0x2154('0xfa')](_0x10060a,_0x26dbf4,_0x3641b3,_0x28ed0b[_0x2154('0x111')]);}else{_0x24a0a7[_0x2154('0xfd')](_0x10060a,_0x26dbf4,_0x3641b3,_0x28ed0b['reason']);}}}});};Dialer[_0x2154('0x1c')][_0x2154('0xfa')]=function(_0x35a2bc,_0x272fc8,_0x550255,_0x566804){var _0x26f965=new Final(_0x35a2bc);_0x26f965[_0x2154('0xe8')]=0xf;_0x26f965[_0x2154('0xa4')]=_0x2154('0x1c4');this[_0x2154('0xfd')](_0x26f965,_0x272fc8,_0x550255,_0x566804);};Dialer[_0x2154('0x1c')][_0x2154('0xfd')]=function(_0xfabae8,_0x2ad539,_0x47ee7c,_0x298aa6){this[_0x2154('0xc9')](_0xfabae8)[_0x2154('0xba')](function(){return _0x2ad539(msgResponse(_0x2154('0x1a8'),_0x2154('0xd9'),_0x298aa6));})['catch'](function(){return _0x47ee7c(msgResponse(_0x2154('0x1c5'),'Failure',_0x2154('0x1c6')));});};Dialer[_0x2154('0x1c')][_0x2154('0xa')]=function(_0x468c02){var _0x1479b5=_0x468c02[_0x2154('0x1c7')]/0x64;var _0x42e96e=_0x468c02[_0x2154('0x11c')]/(_0x468c02[_0x2154('0x11c')]+_0x468c02[_0x2154('0x5f')]);var _0x4c02ec=Math['round'](_0x468c02[_0x2154('0x6f')]*(_0x468c02['predictiveIntervalMaxThreshold']/0x64));var _0x2f4e88=Math[_0x2154('0x1c8')](_0x468c02['predictiveIntervalAvailable']*(_0x468c02[_0x2154('0x1c9')]/0x64));var _0x40a009=_0x468c02['available']+_0x468c02[_0x2154('0x9d')];var _0x589e6d=Math[_0x2154('0x1ca')](_0x468c02[_0x2154('0x71')]*_0x468c02[_0x2154('0x73')]*_0x468c02[_0x2154('0x1cb')]*_0x468c02[_0x2154('0x1cc')]);if(_[_0x2154('0x3d')](_0x468c02[_0x2154('0x29')])){if(!_[_0x2154('0x3d')](_0x468c02[_0x2154('0x28')])){_0x468c02[_0x2154('0x28')]=undefined;loggerPredictive[_0x2154('0x92')](_0x2154('0x1cd'),_0x2154('0x1ce'));}if(!_['isUndefined'](_0x468c02['handlePredictive'])){loggerPredictive[_0x2154('0x92')](_0x2154('0x1cd'),_0x2154('0x1cf'));clearInterval(_0x468c02[_0x2154('0x8c')]);_0x468c02[_0x2154('0x8c')]=undefined;}_0x468c02['startProgressive']=moment()[_0x2154('0x78')](_0x2154('0x100'));loggerPredictive[_0x2154('0x7b')](_0x468c02[_0x2154('0x3f')],_0x2154('0x1d0'),_0x468c02[_0x2154('0x29')]);this[_0x2154('0x15f')](_0x468c02,0x1);}else if(ifInterval(_0x468c02[_0x2154('0x1d1')],_0x468c02[_0x2154('0x29')])){this[_0x2154('0x15f')](_0x468c02,0x1);loggerPredictiveCalls[_0x2154('0x7b')](_0x2154('0x1d2'),_0x468c02[_0x2154('0x29')],_0x468c02[_0x2154('0x3f')]);_0x468c02[_0x2154('0x71')]=0x0;_0x468c02['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x1479b5<_0x42e96e&&_0x468c02[_0x2154('0x1d3')]===_0x2154('0x1d4')){freeVariablesPredictive(_0x468c02);loggerPredictive[_0x2154('0x7b')](_0x2154('0x1d5'),'Dropped\x20calls\x20day',_0x42e96e,'startProgressive',_0x468c02['name']);}else if(_0x589e6d<_0x468c02[_0x2154('0x6e')]&&_0x468c02[_0x2154('0x1d3')]===_0x2154('0x1d4')){freeVariablesPredictive(_0x468c02);loggerPredictive[_0x2154('0x7b')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x2154('0x1d6'),_0x589e6d,'Drop\x20in\x20this\x20interval',_0x468c02[_0x2154('0x6e')],'startProgressive',_0x468c02['name']);}else if(!ifInterval(_0x468c02[_0x2154('0x1d1')],_0x468c02['startProgressive'])&&_[_0x2154('0x3d')](_0x468c02[_0x2154('0x28')])&&!_[_0x2154('0x3d')](_0x468c02['startProgressive'])){_0x468c02[_0x2154('0x28')]=moment()[_0x2154('0x78')](_0x2154('0x100'));loggerPredictive[_0x2154('0x7b')](_0x468c02[_0x2154('0x3f')],_0x2154('0x1d7'),_0x468c02[_0x2154('0x28')]);this[_0x2154('0xbd')](_0x468c02['dialPredictiveInterval'])[_0x2154('0xba')](this[_0x2154('0x1d8')](_0x468c02))[_0x2154('0xba')](mergeDataErlangB(_0x468c02))[_0x2154('0xba')](this[_0x2154('0x1d9')](_0x468c02))[_0x2154('0xb7')](loggerCatchPredictive(_0x2154('0x1da'),_0x468c02));}else if(!ifInterval(_0x468c02['dialPredictiveInterval'],_0x468c02[_0x2154('0x28')])){_0x468c02['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x468c02[_0x2154('0x28')]=moment()[_0x2154('0x78')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x468c02[_0x2154('0x3f')],_0x2154('0x1db'),_0x468c02['startPredictive']);clearInterval(_0x468c02[_0x2154('0x8c')]);_0x468c02[_0x2154('0x8c')]=undefined;this[_0x2154('0xbd')](_0x468c02[_0x2154('0x1d1')])[_0x2154('0xba')](this[_0x2154('0x1d8')](_0x468c02))[_0x2154('0xba')](mergeDataErlangB(_0x468c02))[_0x2154('0xba')](this[_0x2154('0x1d9')](_0x468c02))[_0x2154('0xb7')](loggerCatchPredictive(_0x2154('0x1dc'),_0x468c02));}else if(_0x468c02['predictiveIntervalAvailable']&&_0x40a009<_0x468c02[_0x2154('0x6f')]-_0x2f4e88){freeVariablesPredictive(_0x468c02);loggerPredictive['info'](_0x468c02['name'],_0x2154('0x1dd'),_0x40a009,_0x2154('0x1de'),_0x468c02[_0x2154('0x6f')],'-',_0x2f4e88,'=',_0x468c02[_0x2154('0x6f')]-_0x2f4e88,')');}else if(_0x468c02[_0x2154('0x6f')]&&_0x40a009>_0x468c02[_0x2154('0x6f')]+_0x4c02ec){freeVariablesPredictive(_0x468c02);loggerPredictive['info'](_0x468c02[_0x2154('0x3f')],_0x2154('0x1dd'),_0x40a009,_0x2154('0x1df'),_0x468c02['predictiveIntervalAvailable'],'+',_0x4c02ec,'=',_0x468c02[_0x2154('0x6f')]+_0x4c02ec,')');}};Dialer[_0x2154('0x1c')][_0x2154('0x1d8')]=function(_0x1fe1dc){var _0x20c795=this;return function(_0x3d471d){return new BPromise(function(_0x219471,_0x110482){_[_0x2154('0x8b')](_0x1fe1dc,_0x3d471d[0x0]);if(checkGetDataPredictive(_0x3d471d[0x0])){var _0x43a020=_0x1fe1dc['predictiveIntervalAvailable']=_0x1fe1dc[_0x2154('0x9d')]+_0x1fe1dc[_0x2154('0x52')];var _0x43b2d2=_0x1fe1dc[_0x2154('0x1d1')]*0x3c;var _0x2c60a2=_0x3d471d[0x0][_0x2154('0x6a')]+_0x3d471d[0x0][_0x2154('0x69')];var _0x58be3c=(_0x3d471d[0x0][_0x2154('0x1e0')]+_0x3d471d[0x0][_0x2154('0x6c')]+_0x3d471d[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x3d471d[0x0][_0x2154('0x7e')];_0x1fe1dc[_0x2154('0x1cb')]=_0x58be3c>0x0?_0x58be3c:0x1;switch(_0x1fe1dc[_0x2154('0x1d3')]){case _0x2154('0x1d4'):var _0xc4ea66=_0x1fe1dc[_0x2154('0x1c7')]/0x64;return _0x20c795[_0x2154('0x1e1')](_0x43a020,_0x43b2d2,_0x2c60a2,_0x58be3c,_0xc4ea66)[_0x2154('0xba')](function(_0x5233aa){return _0x219471(_0x5233aa);});case _0x2154('0x1e2'):var _0x5201dd=_0x1fe1dc[_0x2154('0x1c7')]/0x64;return _0x20c795[_0x2154('0x1e3')](_0x43a020,_0x43b2d2,_0x2c60a2,_0x58be3c,_0x5201dd)['then'](function(_0x13dc23){return _0x219471(_0x13dc23);});default:return _0x110482(msgResponse(_0x2154('0x1e4'),_0x2154('0x14a'),_0x2154('0x1e5')));}}else{return _0x110482(msgResponse('[getDataPredictive]','Failure',_0x2154('0x1e6')));}});};};Dialer[_0x2154('0x1c')][_0x2154('0x1e7')]=function(_0x4d8418){var _0x235a3d=this;return function(_0xbd81bb){return new BPromise(function(_0x2427e3,_0x1711e7){_[_0x2154('0x8b')](_0x4d8418,_0xbd81bb[0x0]);if(checkGetDataPredictive(_0xbd81bb[0x0])){loggerPredictive[_0x2154('0x7b')](JSON[_0x2154('0x49')](_0xbd81bb[0x0]));if(_0x4d8418['dialPredictiveOptimization']===_0x2154('0x1d4')){return _0x235a3d[_0x2154('0xc7')](_0x4d8418['id'])[_0x2154('0xba')](function(_0x1ef8c2){var _0x47304a=_0x4d8418['loggedIn']-_0x1ef8c2[0x0][_0x2154('0x1e8')];var _0x2cac33=_0x4d8418[_0x2154('0x1d1')]*0x3c;var _0x3d1df9=_0xbd81bb[0x0][_0x2154('0x6a')]+_0xbd81bb[0x0][_0x2154('0x69')];var _0x266316=(_0xbd81bb[0x0][_0x2154('0x1e0')]+_0xbd81bb[0x0][_0x2154('0x6c')]+_0xbd81bb[0x0][_0x2154('0x6b')])/_0xbd81bb[0x0]['predictiveIntervalTotalCalls'];var _0x515c2e=_0x4d8418['dialPredictiveOptimizationPercentage']/0x64;_0x4d8418[_0x2154('0x1e9')]=_0x1ef8c2[0x0][_0x2154('0x1e8')]||0x0;_0x4d8418[_0x2154('0x1cb')]=_0x266316>0x0?_0x266316:0x1;return _0x235a3d['abandonmentRate'](_0x47304a,_0x2cac33,_0x3d1df9,_0x266316,_0x515c2e);})[_0x2154('0xba')](function(_0x327933){return _0x2427e3(_0x327933);})[_0x2154('0xb7')](function(_0x19f0eb){return _0x1711e7(msgResponse(_0x2154('0x1ea'),'Failure',JSON[_0x2154('0x49')](_0x19f0eb)));});}if(_0x4d8418[_0x2154('0x1d3')]==='agentBusyFactor'){return _0x235a3d[_0x2154('0xc7')](_0x4d8418['id'])[_0x2154('0xba')](function(_0x5b799a){var _0x1b23f8=_0x4d8418['loggedIn']-_0x5b799a[0x0]['outboundQueuePauses'];var _0x2a1f18=_0x4d8418[_0x2154('0x1d1')]*0x3c;var _0x1afb47=_0xbd81bb[0x0][_0x2154('0x6a')]+_0xbd81bb[0x0]['predictiveIntervalAvgHoldtime'];var _0x3e9698=(_0xbd81bb[0x0][_0x2154('0x1e0')]+_0xbd81bb[0x0]['predictiveIntervalDroppedCallsTimeout']+_0xbd81bb[0x0][_0x2154('0x6b')])/_0xbd81bb[0x0]['predictiveIntervalTotalCalls'];var _0x10b528=_0x4d8418[_0x2154('0x1c7')]/0x64;_0x4d8418[_0x2154('0x1e9')]=_0x5b799a[0x0][_0x2154('0x1e8')]||0x0;_0x4d8418['predictiveIntervalHitRate']=_0x3e9698>0x0?_0x3e9698:0x1;return _0x235a3d['busyFactor'](_0x1b23f8,_0x2a1f18,_0x1afb47,_0x3e9698,_0x10b528);})[_0x2154('0xba')](function(_0xf71536){return _0x2427e3(_0xf71536);})[_0x2154('0xb7')](function(_0x3be3de){return _0x1711e7(msgResponse(_0x2154('0x1ea'),_0x2154('0x14a'),JSON[_0x2154('0x49')](_0x3be3de)));});}}else{return _0x1711e7(msgResponse('[getDataPredictive]',_0x2154('0x14a'),_0x2154('0x1e6')));}});};};Dialer[_0x2154('0x1c')]['startMethodPredictive']=function(_0x4b6b89){var _0x4c7ad6=this;return function(){var _0x2cde3d=0x0;var _0x130d81=Math[_0x2154('0x1ca')](_0x4b6b89['erlangCallToSecond']*0x3e8);if(_0x130d81>0x0){_0x130d81=_0x130d81<0x64?0x64:_0x130d81;loggerPredictive['info'](_0x4b6b89['name'],_0x2154('0x1eb'),_0x130d81,_0x2154('0x4a'));_0x4b6b89['handlePredictive']=setInterval(function(){_0x4c7ad6[_0x2154('0x8c')](_0x4b6b89);loggerPredictiveCalls['info'](_0x2154('0x1ec'),_0x2cde3d+=0x1);},_0x130d81);}else{loggerPredictive['info'](_0x4b6b89[_0x2154('0x3f')],_0x2154('0x1ed'));}};};Dialer[_0x2154('0x1c')]['checkContactBlack']=function(_0x3c392c,_0x2a2ebf){var _0xfd7688=this;return function(_0x351113){if(_[_0x2154('0x46')](_0x351113)){if(_[_0x2154('0xac')](_0x2a2ebf[_0x2154('0xd4')])||!_0x2a2ebf['recallme']){if(_0x3c392c[_0x2154('0x59')]===_0x2154('0x162')){_0x3c392c[_0x2154('0x130')]=_[_0x2154('0x3d')](_0x3c392c[_0x2154('0x130')])?!![]:_0x3c392c[_0x2154('0x130')];var _0x35eea5=uuid['v4']();_0xfd7688['actions'][_0x35eea5]=new Action(_0x3c392c,_0x2a2ebf,_0x35eea5);loggerBooked[_0x2154('0x7b')](_0x2154('0x1ee'),_0x35eea5,_0x2154('0x1ef'),JSON[_0x2154('0x49')](_0x3c392c[_0x2154('0x130')]),_0x2154('0x1f0'),_0x3c392c[_0x2154('0x3f')]);if(_0x3c392c[_0x2154('0x130')]){_0x3c392c['queueStatusComplete']=![];_0xfd7688[_0x2154('0x12e')][_0xfd7688['actions'][_0x35eea5]['queue']]=[];ami['Action']({'actionid':_0x35eea5,'action':'queuestatus','queue':_0x3c392c[_0x2154('0x3f')]})[_0x2154('0xb7')](function(){_0xfd7688['updateOriginated'](_0x3c392c);_0xfd7688[_0x2154('0xbf')]({'active':![],'ContactId':_0xfd7688['actions'][_0x35eea5]['ContactId'],'ListId':_0xfd7688['actions'][_0x35eea5][_0x2154('0xd3')],'VoiceQueueId':_0xfd7688[_0x2154('0x25')][_0x35eea5]['VoiceQueueId']||undefined,'CampaignId':_0xfd7688['actions'][_0x35eea5][_0x2154('0xd5')]||undefined})[_0x2154('0xb7')](loggerCatch(_0x2154('0x1f1')));delete _0xfd7688[_0x2154('0x25')][_0x35eea5];});}else{loggerBooked['info']('[booked][checkContactBlack][else]',JSON[_0x2154('0x49')](_0x3c392c[_0x2154('0x130')]),'Queue:\x20',_0x3c392c[_0x2154('0x3f')]);_0xfd7688[_0x2154('0xb1')](_0x3c392c);_0xfd7688['rescheduleContact']({'active':![],'ContactId':_0xfd7688['actions'][_0x35eea5][_0x2154('0xd2')],'ListId':_0xfd7688['actions'][_0x35eea5][_0x2154('0xd3')],'VoiceQueueId':_0xfd7688['actions'][_0x35eea5]['VoiceQueueId']||undefined,'CampaignId':_0xfd7688[_0x2154('0x25')][_0x35eea5][_0x2154('0xd5')]||undefined})['catch'](loggerCatch(_0x2154('0x1f1')));delete _0xfd7688[_0x2154('0x25')][_0x35eea5];}}else{return _0xfd7688['actionOriginate'](_0x3c392c,_0x2a2ebf);}}else{if(getDiff(_0x2a2ebf[_0x2154('0x1f2')])<_0x3c392c[_0x2154('0x1f3')]*0x3c){if(_0x2a2ebf[_0x2154('0x1f4')]&&!_0x2a2ebf[_0x2154('0x1f4')]['voicePause']){_0xfd7688[_0x2154('0x1e')]['run'](_0x2a2ebf['id'])['finally'](function(){_0xfd7688[_0x2154('0xb1')](_0x3c392c);});}else{_0xfd7688[_0x2154('0xc1')]({'active':![]},_0x2a2ebf['id'],0x1)['finally'](function(){_0xfd7688[_0x2154('0xb1')](_0x3c392c);});}}else{_0x3c392c[_0x2154('0x66')]+=0x1;_0xfd7688[_0x2154('0xb1')](_0x3c392c);if(_0x3c392c[_0x2154('0x1f5')]){_0xfd7688['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x2a2ebf[_0x2154('0xd2')],'ListId':_0x2a2ebf[_0x2154('0xd3')],'VoiceQueueId':_0x2a2ebf['VoiceQueueId']||undefined,'CampaignId':_0x2a2ebf[_0x2154('0xd5')]||undefined})[_0x2154('0xb7')](loggerCatch(_0x2154('0x1f6')));_0xfd7688[_0x2154('0xcb')](createObjHistory(_0x3c392c,_0x2a2ebf,_0x2154('0x1f7'),0x17,'RecallInQueue'))[_0x2154('0xb7')](loggerCatch(_0x2154('0x1f8')));}else{_0xfd7688['saveInDb'](createObjHistory(_0x3c392c,_0x2a2ebf,'RECALLFAILEDTIMEOUT',0x16,_0x2154('0x1f9')),_0x2154('0x1fa'),'[Originate][HistoryRecallClose]');}}}}else{_0x3c392c[_0x2154('0x60')]+=0x1;_0xfd7688[_0x2154('0xde')](createObjHistory(_0x3c392c,_0x2a2ebf,_0x2154('0x1fb'),0xd,'Blacklist'),'[Originate][historyBlacklist]','[Originate][MoveBlacklist]');throw _0x2154('0x1fc');}};};Dialer[_0x2154('0x1c')][_0x2154('0x165')]=function(_0x4db00b){var _0x10c6b5=this;var _0x54b10e=_0x4db00b[_0x2154('0x1fd')]-_0x4db00b['originated']-_0x4db00b['temp'];emitCampaignSummary(_0x4db00b);if(_0x54b10e>0x0){if(_0x54b10e>this[_0x2154('0x23')]){_0x54b10e=this['maxNumberOriginate'];}_0x4db00b['temp']+=_0x54b10e;this[_0x2154('0xc5')](_0x4db00b['id'],_0x54b10e,_0x4db00b[_0x2154('0x1fe')],_0x4db00b)[_0x2154('0xba')](function(_0x1f3169){_0x4db00b[_0x2154('0xc4')]-=_0x54b10e;_0x4db00b[_0x2154('0xc4')]=_0x4db00b[_0x2154('0xc4')]>0x0?_0x4db00b['temp']:0x0;if(!checkContactEmpty(_0x1f3169)){_0x4db00b['message']=_0x2154('0x9a');logger[_0x2154('0x7b')](_0x2154('0x1ff')+_0x4db00b[_0x2154('0x3f')]);}else{_0x4db00b['originated']+=_0x1f3169[_0x2154('0x150')];_0x4db00b[_0x2154('0x40')]='RUNNING';for(var _0x3ba0de=0x0;_0x3ba0de<_0x1f3169['length'];_0x3ba0de+=0x1){_0x4db00b[_0x2154('0x200')]+=0x1;if(_[_0x2154('0xac')](_0x1f3169[_0x3ba0de])||_[_0x2154('0xac')](_0x1f3169[_0x3ba0de][_0x2154('0x175')])||_['isNil'](_0x1f3169[_0x3ba0de][_0x2154('0x175')]['phone'])){_0x10c6b5['emptyContact'](_0x2154('0x201'),_0x4db00b,_0x1f3169[_0x3ba0de]);}else{_0x10c6b5[_0x2154('0xbb')](_['pick'](_0x1f3169[_0x3ba0de],[_0x2154('0xd5'),_0x2154('0x202')]))['then'](_0x10c6b5[_0x2154('0x203')](_0x4db00b,_0x1f3169[_0x3ba0de]))[_0x2154('0xb7')](_0x10c6b5[_0x2154('0xce')](_0x2154('0x204'),_0x4db00b));}}}})[_0x2154('0xb7')](loggerGetContactDialer('[getContactCampaign2]',_0x4db00b,_0x54b10e));}};Dialer['prototype'][_0x2154('0x15f')]=function(_0x3c7dc1,_0x562757){var _0x10e62a=this;var _0x4a2ebd=[];var _0x6a36dd=_0x562757>=0x1?_0x562757:0x1;if(_0x3c7dc1[_0x2154('0x59')]==='booked'){_0x6a36dd=0x1;}var _0x288f36=Math[_0x2154('0x1ca')](_0x3c7dc1[_0x2154('0x52')]*_0x6a36dd)-_0x3c7dc1[_0x2154('0x70')]-_0x3c7dc1[_0x2154('0xc4')];emitVoiceQueueSummary(_0x3c7dc1);if(_0x3c7dc1[_0x2154('0x205')]>0x0){var _0x53821c=_0x3c7dc1[_0x2154('0x205')]-_0x3c7dc1['originated']-_0x3c7dc1[_0x2154('0x9d')]-_0x3c7dc1[_0x2154('0xc4')]-_0x3c7dc1[_0x2154('0x9e')];if(_0x288f36>_0x53821c){_0x288f36=_0x53821c;}}if(_0x288f36>0x0){if(_0x3c7dc1['dialMethod']===_0x2154('0x162')){_0x288f36=0x1;}if(_0x288f36>this['maxNumberOriginate']){_0x288f36=this[_0x2154('0x23')];}_0x3c7dc1[_0x2154('0xc4')]+=_0x288f36;for(var _0x2568d1 in this['agents']){if(typeof this['agents'][_0x2568d1]!=='undefined'){if(this[_0x2154('0x21')][_0x2568d1][_0x2154('0xe8')]===_0x2154('0x206')&&this[_0x2154('0x21')][_0x2568d1]['status']==='reachable'){_0x4a2ebd[_0x2154('0x151')](this[_0x2154('0x21')][_0x2568d1]['id']);}}}this[_0x2154('0xc3')](_0x3c7dc1['id'],_0x4a2ebd,_0x288f36,_0x3c7dc1[_0x2154('0x1fe')],_0x3c7dc1)[_0x2154('0xba')](function(_0x12f13c){_0x3c7dc1[_0x2154('0xc4')]-=_0x288f36;_0x3c7dc1[_0x2154('0xc4')]=_0x3c7dc1['temp']>0x0?_0x3c7dc1[_0x2154('0xc4')]:0x0;if(!checkContactEmpty(_0x12f13c)){_0x10e62a[_0x2154('0xb6')](_0x3c7dc1)[_0x2154('0xba')](sendMessageReschedule(_0x3c7dc1))[_0x2154('0xb7')](loggerCatch('[countReScheduled]\x20'));}else{_0x3c7dc1[_0x2154('0x70')]+=_0x12f13c[_0x2154('0x150')];_0x3c7dc1[_0x2154('0x40')]=_0x3c7dc1[_0x2154('0x59')]===_0x2154('0x162')?_0x2154('0x17b'):_0x2154('0x207');for(var _0x181a18=0x0;_0x181a18<_0x12f13c[_0x2154('0x150')];_0x181a18+=0x1){if(_[_0x2154('0xac')](_0x12f13c[_0x181a18])||_['isNil'](_0x12f13c[_0x181a18][_0x2154('0x175')])||_[_0x2154('0xac')](_0x12f13c[_0x181a18][_0x2154('0x175')][_0x2154('0x174')])){_0x10e62a[_0x2154('0xcf')](_0x2154('0x201'),_0x3c7dc1,_0x12f13c[_0x181a18]);}else{_0x10e62a['checkIsBlackList'](_[_0x2154('0xd1')](_0x12f13c[_0x181a18],[_0x2154('0x101'),_0x2154('0x202')]))[_0x2154('0xba')](_0x10e62a[_0x2154('0x203')](_0x3c7dc1,_0x12f13c[_0x181a18]))[_0x2154('0xb7')](_0x10e62a['loggerHandler'](_0x2154('0x201'),_0x3c7dc1));}}}})[_0x2154('0xb7')](loggerGetContactDialer(_0x2154('0x208'),_0x3c7dc1,_0x288f36));}};Dialer['prototype'][_0x2154('0x8c')]=function(_0x342216){if(_0x342216['dialLimitQueue']>0x0){var _0x385315=_0x342216[_0x2154('0x205')]-_0x342216[_0x2154('0x70')]-_0x342216[_0x2154('0x9d')];if(_0x385315>0x0){this['tryOriginatePredictive'](_0x342216);}else{loggerPredictiveCalls[_0x2154('0x7b')](_0x2154('0x209'));}}else{this[_0x2154('0x20a')](_0x342216);}};Dialer['prototype'][_0x2154('0x20a')]=function(_0x369441){var _0x279adf=this;var _0x4cab7a=[];_0x369441['originated']+=0x1;for(var _0x143cba in this[_0x2154('0x21')]){if(typeof this[_0x2154('0x21')][_0x143cba]!==_0x2154('0xaa')){if(this[_0x2154('0x21')][_0x143cba][_0x2154('0xe8')]===_0x2154('0x206')&&this[_0x2154('0x21')][_0x143cba][_0x2154('0xae')]==='reachable'){_0x4cab7a[_0x2154('0x151')](this[_0x2154('0x21')][_0x143cba]['id']);}}}this[_0x2154('0xc3')](_0x369441['id'],_0x4cab7a,0x1,_0x369441[_0x2154('0x1fe')],_0x369441)[_0x2154('0xba')](function(_0x2c7c78){if(!checkContactEmpty(_0x2c7c78)){checkContactLowerLimitOriginate(_0x369441,0x1,0x0);_0x279adf[_0x2154('0xb6')](_0x369441)[_0x2154('0xba')](sendMessageReschedule(_0x369441))['catch'](loggerCatch(_0x2154('0xb8')));}else{_0x369441[_0x2154('0x40')]=_0x2154('0x207');if(_['isNil'](_0x2c7c78[0x0])||_[_0x2154('0xac')](_0x2c7c78[0x0][_0x2154('0x175')])||_[_0x2154('0xac')](_0x2c7c78[0x0][_0x2154('0x175')][_0x2154('0x174')])){_0x279adf['emptyContact'](_0x2154('0x201'),_0x369441,_0x2c7c78[0x0]);}else{_0x279adf[_0x2154('0xb9')](_['pick'](_0x2c7c78[0x0],[_0x2154('0x101'),_0x2154('0x202')]))[_0x2154('0xba')](_0x279adf[_0x2154('0x203')](_0x369441,_0x2c7c78[0x0]))[_0x2154('0xb7')](_0x279adf[_0x2154('0xce')](_0x2154('0x20b'),_0x369441));}}})['catch'](loggerGetContactDialer('[getContactDialerPredictive]',_0x369441,0x1));emitVoiceQueueSummary(_0x369441);};Dialer[_0x2154('0x1c')][_0x2154('0x1e1')]=function(_0x59a707,_0x264d1f,_0x3d1362,_0xd5fa23,_0x47efec,_0xd9452){loggerPredictive['info'](_0x2154('0x20c'));loggerPredictive[_0x2154('0x7b')]('M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x59a707);loggerPredictive['info']('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x264d1f);loggerPredictive[_0x2154('0x7b')](_0x2154('0x20d'),_0x3d1362);loggerPredictive[_0x2154('0x7b')]('P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xd5fa23);loggerPredictive[_0x2154('0x7b')](_0x2154('0x20e'),_0x47efec);loggerPredictive[_0x2154('0x7b')](_0x2154('0x83'));return new BPromise(function(_0x534541,_0x2dedce){if(_0x59a707<=0x0||isNaN(_0x59a707)){return _0x2dedce(msgResponse(_0x2154('0x20f'),_0x2154('0x48'),_0x2154('0x210')+_0x59a707));}if(_0x3d1362<=0x0||isNaN(_0x3d1362)){return _0x2dedce(msgResponse('[abandonmentRate]',_0x2154('0x48'),'Ts\x20=\x20'+_0x3d1362));}if(_0xd5fa23<=0x0||isNaN(_0xd5fa23)){return _0x2dedce(msgResponse('[abandonmentRate]','Error',_0x2154('0x211')+_0xd5fa23));}if(_0x264d1f<=0x0||isNaN(_0x264d1f)){return _0x2dedce(msgResponse('[abandonmentRate]','Error',_0x2154('0x212')+_0x264d1f));}if(_0x47efec<=0x0||isNaN(_0x47efec)){return _0x2dedce(msgResponse('[abandonmentRate]',_0x2154('0x48'),'Amax\x20=\x20'+_0x47efec));}_0xd9452=_0xd9452||0x0;var _0x249bc6=0x1/_0x3d1362;var _0x2e1fda=0x0;var _0x574c4e=0x0;var _0x3f8cb5=0x0;var _0xaaf5fe=0x0;for(var _0xe99792=0x0;_0x3f8cb5<_0x47efec;_0xe99792+=0x1){_0x574c4e=_0xe99792/_0x264d1f;_0x2e1fda=(_0xd5fa23*_0x574c4e+_0xd9452)/_0x249bc6;_0x3f8cb5=erlangb(_0x2e1fda,_0x59a707);_0xaaf5fe=_0x2e1fda/_0x59a707*(0x1-erlangb(_0x2e1fda,_0x59a707));}return _0x534541({'erlangCalls':_0xe99792,'erlangCallToSecond':_0x264d1f/_0xe99792,'erlangAbandonmentRate':_0x3f8cb5,'erlangBusyFactor':_0xaaf5fe});});};Dialer[_0x2154('0x1c')][_0x2154('0x1e3')]=function(_0x1e4ecb,_0x3d9a2a,_0x4d8d0e,_0x4fb400,_0x4ccb83,_0x23f0c0){loggerPredictive[_0x2154('0x7b')](_0x2154('0x213'));loggerPredictive[_0x2154('0x7b')](_0x2154('0x214'),_0x1e4ecb);loggerPredictive['info']('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3d9a2a);loggerPredictive[_0x2154('0x7b')](_0x2154('0x20d'),_0x4d8d0e);loggerPredictive[_0x2154('0x7b')](_0x2154('0x215'),_0x4fb400);loggerPredictive[_0x2154('0x7b')](_0x2154('0x216'),_0x4ccb83);loggerPredictive[_0x2154('0x7b')]('---------------------------');return new BPromise(function(_0x345d3b,_0x23aee4){if(_0x1e4ecb<=0x0||isNaN(_0x1e4ecb)){return _0x23aee4(msgResponse(_0x2154('0x217'),_0x2154('0x48'),_0x2154('0x210')+_0x1e4ecb));}if(_0x4d8d0e<=0x0||isNaN(_0x4d8d0e)){return _0x23aee4(msgResponse(_0x2154('0x217'),_0x2154('0x48'),_0x2154('0x218')+_0x4d8d0e));}if(_0x4fb400<=0x0||isNaN(_0x4fb400)){return _0x23aee4(msgResponse(_0x2154('0x217'),_0x2154('0x48'),_0x2154('0x211')+_0x4fb400));}if(_0x3d9a2a<=0x0||isNaN(_0x3d9a2a)){return _0x23aee4(msgResponse('[busyFactor]',_0x2154('0x48'),_0x2154('0x212')+_0x3d9a2a));}if(_0x4ccb83<=0x0||isNaN(_0x4ccb83)){return _0x23aee4(msgResponse('[busyFactor]',_0x2154('0x48'),'Umin\x20=\x20'+_0x4ccb83));}_0x23f0c0=_0x23f0c0||0x0;var _0x377e11=0x1/_0x4d8d0e;var _0x2bf8a0=0x0;var _0xadb053=0x0;var _0xd6218e=0x0;var _0x41b64b=0x0;for(var _0x1ce8d2=0x0;_0x41b64b<_0x4ccb83;_0x1ce8d2+=0x1){_0xadb053=_0x1ce8d2/_0x3d9a2a;_0x2bf8a0=(_0x4fb400*_0xadb053+_0x23f0c0)/_0x377e11;_0xd6218e=erlangb(_0x2bf8a0,_0x1e4ecb);_0x41b64b=_0x2bf8a0/_0x1e4ecb*(0x1-erlangb(_0x2bf8a0,_0x1e4ecb));}return _0x345d3b({'erlangCalls':_0x1ce8d2,'erlangCallToSecond':_0x3d9a2a/_0x1ce8d2,'erlangAbandonmentRate':_0xd6218e,'erlangBusyFactor':_0x41b64b});});};module[_0x2154('0x219')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 4141ba7..d795033 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 _0x8fa7=['name','starttime','responsetime','droptime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','lodash','milliseconds','diff','seconds','scheduledat','type','campaigntype','queue','countbusyretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname'];(function(_0x448f8,_0x2aa1d7){var _0xa73126=function(_0x1fcafa){while(--_0x1fcafa){_0x448f8['push'](_0x448f8['shift']());}};_0xa73126(++_0x2aa1d7);}(_0x8fa7,0x121));var _0x78fa=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x8fa7[_0x18ab2a];return _0x16dcee;};'use strict';var util=require('util');var _=require(_0x78fa('0x0'));var moment=require('moment');function getSeconds(_0x19e010,_0x8c5ea3){var _0x4be5ad=moment(_0x19e010)['milliseconds'](0x0);var _0x41de8f=moment(_0x8c5ea3)[_0x78fa('0x1')](0x0);return _0x4be5ad[_0x78fa('0x2')](_0x41de8f,_0x78fa('0x3'));}function QueueCallerAbandon(_0x253eae,_0x3dbddb){this[_0x78fa('0x4')]=_0x253eae[_0x78fa('0x4')];this[_0x78fa('0x5')]=_0x253eae[_0x78fa('0x5')];this[_0x78fa('0x6')]=_0x253eae['type']==='outbound'?_0x78fa('0x7'):_0x253eae[_0x78fa('0x5')];this[_0x78fa('0x8')]=_0x253eae[_0x78fa('0x8')];this['countcongestionretry']=_0x253eae['countcongestionretry'];this[_0x78fa('0x9')]=_0x253eae[_0x78fa('0x9')];this[_0x78fa('0xa')]=_0x253eae[_0x78fa('0x8')]+_0x253eae['countcongestionretry']+_0x253eae['countnoanswerretry']+_0x253eae[_0x78fa('0xb')]+_0x253eae[_0x78fa('0xc')]+_0x253eae[_0x78fa('0xd')]+_0x253eae[_0x78fa('0xe')]+_0x253eae[_0x78fa('0xf')];this[_0x78fa('0xb')]=_0x253eae[_0x78fa('0xb')];this[_0x78fa('0xc')]=_0x253eae[_0x78fa('0xc')];this[_0x78fa('0xd')]=_0x253eae[_0x78fa('0xd')];this[_0x78fa('0xe')]=_0x253eae['countmachineretry'];this[_0x78fa('0xf')]=_0x253eae[_0x78fa('0xf')];this['uniqueid']=_0x3dbddb['uniqueid'];this[_0x78fa('0x10')]=_0x253eae[_0x78fa('0x11')];this['calleridnum']=_0x253eae['number'];this[_0x78fa('0x12')]=_0x253eae[_0x78fa('0x12')];this['responsetime']=_0x253eae[_0x78fa('0x13')];this[_0x78fa('0x14')]=_0x253eae[_0x78fa('0x14')];this['endtime']=this[_0x78fa('0x14')];this['ringtime']=getSeconds(_0x253eae[_0x78fa('0x13')],_0x253eae[_0x78fa('0x12')]);this['holdtime']=getSeconds(this['droptime'],_0x253eae['responsetime']);this['talktime']=0x0;this['queue']=_0x3dbddb[_0x78fa('0x7')];this[_0x78fa('0x15')]=_0x3dbddb['connectedlinename'];this[_0x78fa('0x16')]=_0x3dbddb['reason'];this[_0x78fa('0x17')]=_0x253eae['callback'];this[_0x78fa('0x18')]=_0x253eae[_0x78fa('0x18')];this[_0x78fa('0x19')]=_0x253eae[_0x78fa('0x19')];this[_0x78fa('0x1a')]=_0x253eae['recallme'];this[_0x78fa('0x1b')]=_0x253eae[_0x78fa('0x1b')];this[_0x78fa('0x1c')]=_0x253eae[_0x78fa('0x1c')];this['UserId']=_0x253eae[_0x78fa('0x1d')];this[_0x78fa('0x1e')]=_0x253eae[_0x78fa('0x1e')];this['CampaignId']=_0x253eae[_0x78fa('0x1f')];this[_0x78fa('0x20')]=_0x253eae['originatecalleridnum']||'';this[_0x78fa('0x21')]=_0x253eae[_0x78fa('0x21')]||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file +var _0x3784=['endtime','ringtime','holdtime','membername','connectedlinename','reason','callback','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','scheduledat','type','queue','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','number','starttime','responsetime','droptime'];(function(_0xb06221,_0x3b47da){var _0x542c06=function(_0x5cd5ff){while(--_0x5cd5ff){_0xb06221['push'](_0xb06221['shift']());}};_0x542c06(++_0x3b47da);}(_0x3784,0x16f));var _0x4378=function(_0x444080,_0x8aaa0b){_0x444080=_0x444080-0x0;var _0x4f14ce=_0x3784[_0x444080];return _0x4f14ce;};'use strict';var util=require(_0x4378('0x0'));var _=require(_0x4378('0x1'));var moment=require(_0x4378('0x2'));function getSeconds(_0x145ab7,_0x4f21f2){var _0x5c8663=moment(_0x145ab7)[_0x4378('0x3')](0x0);var _0x2e4a13=moment(_0x4f21f2)[_0x4378('0x3')](0x0);return _0x5c8663[_0x4378('0x4')](_0x2e4a13,'seconds');}function QueueCallerAbandon(_0x5a3b4b,_0x5b2a53){this[_0x4378('0x5')]=_0x5a3b4b['scheduledat'];this[_0x4378('0x6')]=_0x5a3b4b[_0x4378('0x6')];this['campaigntype']=_0x5a3b4b[_0x4378('0x6')]==='outbound'?_0x4378('0x7'):_0x5a3b4b[_0x4378('0x6')];this['countbusyretry']=_0x5a3b4b[_0x4378('0x8')];this[_0x4378('0x9')]=_0x5a3b4b['countcongestionretry'];this['countnoanswerretry']=_0x5a3b4b['countnoanswerretry'];this[_0x4378('0xa')]=_0x5a3b4b[_0x4378('0x8')]+_0x5a3b4b[_0x4378('0x9')]+_0x5a3b4b[_0x4378('0xb')]+_0x5a3b4b[_0x4378('0xc')]+_0x5a3b4b[_0x4378('0xd')]+_0x5a3b4b[_0x4378('0xe')]+_0x5a3b4b[_0x4378('0xf')]+_0x5a3b4b[_0x4378('0x10')];this[_0x4378('0xc')]=_0x5a3b4b['countnosuchnumberretry'];this[_0x4378('0xd')]=_0x5a3b4b[_0x4378('0xd')];this[_0x4378('0xe')]=_0x5a3b4b[_0x4378('0xe')];this[_0x4378('0xf')]=_0x5a3b4b[_0x4378('0xf')];this[_0x4378('0x10')]=_0x5a3b4b['countagentrejectretry'];this['uniqueid']=_0x5b2a53['uniqueid'];this[_0x4378('0x11')]=_0x5a3b4b['name'];this[_0x4378('0x12')]=_0x5a3b4b[_0x4378('0x13')];this[_0x4378('0x14')]=_0x5a3b4b['starttime'];this[_0x4378('0x15')]=_0x5a3b4b[_0x4378('0x15')];this[_0x4378('0x16')]=_0x5a3b4b['droptime'];this[_0x4378('0x17')]=this[_0x4378('0x16')];this[_0x4378('0x18')]=getSeconds(_0x5a3b4b[_0x4378('0x15')],_0x5a3b4b['starttime']);this[_0x4378('0x19')]=getSeconds(this[_0x4378('0x16')],_0x5a3b4b[_0x4378('0x15')]);this['talktime']=0x0;this['queue']=_0x5b2a53[_0x4378('0x7')];this[_0x4378('0x1a')]=_0x5b2a53[_0x4378('0x1b')];this['reason']=_0x5b2a53[_0x4378('0x1c')];this['callback']=_0x5a3b4b[_0x4378('0x1d')];this['callbackuniqueid']=_0x5a3b4b['callbackuniqueid'];this[_0x4378('0x1e')]=_0x5a3b4b[_0x4378('0x1e')];this[_0x4378('0x1f')]=_0x5a3b4b[_0x4378('0x1f')];this['ContactId']=_0x5a3b4b['ContactId'];this[_0x4378('0x20')]=_0x5a3b4b[_0x4378('0x20')];this[_0x4378('0x21')]=_0x5a3b4b[_0x4378('0x21')];this['VoiceQueueId']=_0x5a3b4b[_0x4378('0x22')];this[_0x4378('0x23')]=_0x5a3b4b[_0x4378('0x23')];this[_0x4378('0x24')]=_0x5a3b4b[_0x4378('0x24')]||'';this[_0x4378('0x25')]=_0x5a3b4b[_0x4378('0x25')]||'';}module[_0x4378('0x26')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 576d8ba..529a682 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(_0x3f327e,_0x1881b9){var _0x236cfd=function(_0x703b73){while(--_0x703b73){_0x3f327e['push'](_0x3f327e['shift']());}};_0x236cfd(++_0x1881b9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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(_0x1b4888,_0x1debd6){var _0x532bf2=function(_0x570a17){while(--_0x570a17){_0x1b4888['push'](_0x1b4888['shift']());}};_0x532bf2(++_0x1debd6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function Action(_0x5dd881,_0x550fbc,_0x18d5c9){this['uniqueid']=_0x5dd881||undefined;this[_0x0a9e('0x3')]=util[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x550fbc[_0x0a9e('0x6')],_0x550fbc[_0x0a9e('0x7')]['name'],_0x18d5c9[_0x0a9e('0x8')]);this[_0x0a9e('0x9')]=_0x550fbc[_0x0a9e('0x9')];this['headerinfo']=_0x550fbc['headerinfo'];this[_0x0a9e('0xa')]=_0x18d5c9['path'];this['AttachmentId']=_0x18d5c9[_0x0a9e('0xb')];}module[_0x0a9e('0xc')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 8055179..66c1efb 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 _0xd750=['update','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatusstring','SENDING\x20FAILED','send','execOriginate','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','Trunk\x20Reachable','format','path','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','exports','bluebird','uuid','moment','tiff2pdf','./util/gs','../../../config/logger','../ami','./rpcDb','./channel','../rpc/faxAccount','faxAccounts','trunks','actions','newchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','syncReceiveFax','hangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','uniqueid','channels','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','operation','status','localstationid','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','parse','then','fax','.pdf','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','AttachmentId'];(function(_0x364af7,_0x3ac72b){var _0x3f5a1f=function(_0x2723b5){while(--_0x2723b5){_0x364af7['push'](_0x364af7['shift']());}};_0x3f5a1f(++_0x3ac72b);}(_0xd750,0x181));var _0x0d75=function(_0x201ed2,_0x1042cc){_0x201ed2=_0x201ed2-0x0;var _0x138582=_0xd750[_0x201ed2];return _0x138582;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0x0d75('0x0'));var uuid=require(_0x0d75('0x1'));var moment=require(_0x0d75('0x2'));var path=require('path');var tiff2pdf=require(_0x0d75('0x3'));var gs=require(_0x0d75('0x4'));var logger=require(_0x0d75('0x5'))('fax');var ami=require(_0x0d75('0x6'));var rpcDb=require(_0x0d75('0x7'));var Channel=require(_0x0d75('0x8'));var ut=require('./util/util');var Action=require('./action');var faxAccount=require(_0x0d75('0x9'));var attachment=require('../rpc/attachment');var faxMessage=require('../rpc/faxMessage');function Fax(_0x430490){this['channels']={};this[_0x0d75('0xa')]=_0x430490[_0x0d75('0xa')];this[_0x0d75('0xb')]=_0x430490[_0x0d75('0xb')];this[_0x0d75('0xc')]={};ami['on'](_0x0d75('0xd'),this['syncNewchannel'][_0x0d75('0xe')](this));ami['on'](_0x0d75('0xf'),this[_0x0d75('0x10')]['bind'](this));ami['on'](_0x0d75('0x11'),this[_0x0d75('0x12')]['bind'](this));ami['on'](_0x0d75('0x13'),this[_0x0d75('0x14')]['bind'](this));ami['on'](_0x0d75('0x15'),this[_0x0d75('0x16')][_0x0d75('0xe')](this));ami['on']('receivefax',this[_0x0d75('0x17')][_0x0d75('0xe')](this));ami['on'](_0x0d75('0x18'),this['syncHangup'][_0x0d75('0xe')](this));ami['on'](_0x0d75('0x19'),this[_0x0d75('0x1a')][_0x0d75('0xe')](this));}Fax[_0x0d75('0x1b')]['syncNewchannel']=function(_0x2ca035){if(_0x2ca035[_0x0d75('0x1c')]===_0x0d75('0x1d')){for(var _0x34e0ec in this[_0x0d75('0xa')]){if(this[_0x0d75('0xa')][_0x0d75('0x1e')](_0x34e0ec)){if(_0x2ca035[_0x0d75('0x1f')]===this[_0x0d75('0xa')][_0x34e0ec]['localstationid']){this['channels'][_0x2ca035[_0x0d75('0x20')]]={};this[_0x0d75('0x21')][_0x2ca035['uniqueid']][_0x0d75('0x22')]=_0x2ca035[_0x0d75('0x22')];this[_0x0d75('0x21')][_0x2ca035[_0x0d75('0x20')]]['id']=this[_0x0d75('0xa')][_0x34e0ec]['id'];this['channels'][_0x2ca035[_0x0d75('0x20')]][_0x0d75('0x23')]=this[_0x0d75('0xa')][_0x34e0ec][_0x0d75('0x23')];logger[_0x0d75('0x24')](_0x2ca035['uniqueid'],_0x0d75('0x25'));}}}}if(this[_0x0d75('0xc')][_0x2ca035[_0x0d75('0x20')]]){this[_0x0d75('0x21')][_0x2ca035['uniqueid']]={};this['channels'][_0x2ca035[_0x0d75('0x20')]][_0x0d75('0x22')]=_0x2ca035[_0x0d75('0x22')];logger['info'](_0x2ca035[_0x0d75('0x20')],_0x0d75('0x25'));}};Fax['prototype'][_0x0d75('0x10')]=function(_0x3a07b4){if(this[_0x0d75('0x21')][_0x3a07b4[_0x0d75('0x20')]]){for(var _0x3adcb8 in _0x3a07b4[_0x0d75('0x26')]){if(_0x3a07b4[_0x0d75('0x26')]['hasOwnProperty'](_0x3adcb8)){this[_0x0d75('0x21')][_0x3a07b4[_0x0d75('0x20')]][_0x3adcb8]=_0x3a07b4[_0x0d75('0x27')];}}}};Fax[_0x0d75('0x1b')][_0x0d75('0x12')]=function(_0x24e278){if(this[_0x0d75('0x21')][_0x24e278[_0x0d75('0x20')]]){this['channels'][_0x24e278['uniqueid']][_0x0d75('0x28')]=_0x24e278['channelstate'];this[_0x0d75('0x21')][_0x24e278[_0x0d75('0x20')]][_0x0d75('0x29')]=_0x24e278[_0x0d75('0x29')];}};Fax[_0x0d75('0x1b')][_0x0d75('0x14')]=function(_0x413a4c){if(this['channels'][_0x413a4c[_0x0d75('0x20')]]){for(var _0x8ffc8d in _0x413a4c[_0x0d75('0x26')]){if(_0x413a4c[_0x0d75('0x26')][_0x0d75('0x1e')](_0x8ffc8d)){this[_0x0d75('0x21')][_0x413a4c['uniqueid']][_0x8ffc8d]=_0x413a4c[_0x0d75('0x27')];}}}};Fax[_0x0d75('0x1b')][_0x0d75('0x16')]=function(_0x3ed3b3){if(this[_0x0d75('0x21')][_0x3ed3b3[_0x0d75('0x20')]]){this['channels'][_0x3ed3b3[_0x0d75('0x20')]]['operation']=_0x3ed3b3[_0x0d75('0x2a')];this[_0x0d75('0x21')][_0x3ed3b3['uniqueid']][_0x0d75('0x2b')]=_0x3ed3b3['status'];this[_0x0d75('0x21')][_0x3ed3b3[_0x0d75('0x20')]][_0x0d75('0x2c')]=_0x3ed3b3['localstationid'];this['channels'][_0x3ed3b3[_0x0d75('0x20')]][_0x0d75('0x2d')]=_0x3ed3b3['filename'];logger[_0x0d75('0x24')](_0x3ed3b3[_0x0d75('0x20')],_0x0d75('0x2e'));}};Fax[_0x0d75('0x1b')][_0x0d75('0x17')]=function(_0x41ce13){var _0x492531=this;if(this[_0x0d75('0x21')][_0x41ce13['uniqueid']]){var _0x591a73=this[_0x0d75('0x21')][_0x41ce13['uniqueid']]['id'];this['channels'][_0x41ce13[_0x0d75('0x20')]][_0x0d75('0x2f')]=_0x41ce13[_0x0d75('0x2f')];this[_0x0d75('0x21')][_0x41ce13[_0x0d75('0x20')]][_0x0d75('0x30')]=_0x41ce13[_0x0d75('0x30')];this[_0x0d75('0x21')][_0x41ce13['uniqueid']][_0x0d75('0x2c')]=_0x41ce13[_0x0d75('0x2c')];this[_0x0d75('0x21')][_0x41ce13['uniqueid']][_0x0d75('0x31')]=_0x41ce13[_0x0d75('0x31')];this[_0x0d75('0x21')][_0x41ce13[_0x0d75('0x20')]][_0x0d75('0x32')]=_0x41ce13[_0x0d75('0x32')];this[_0x0d75('0x21')][_0x41ce13[_0x0d75('0x20')]]['filename']=_0x41ce13[_0x0d75('0x2d')];this['channels'][_0x41ce13[_0x0d75('0x20')]][_0x0d75('0x33')]=_0x41ce13[_0x0d75('0x33')];if(this[_0x0d75('0x21')][_0x41ce13[_0x0d75('0x20')]][_0x0d75('0x30')]>0x0){tiff2pdf(_0x41ce13['filename'],'/var/opt/motion2/server/files/attachments/',function(_0x5c5011){logger[_0x0d75('0x24')](_0x41ce13[_0x0d75('0x20')],_0x0d75('0x34'),_0x5c5011[_0x0d75('0x35')]);attachment['create']({'name':path['parse'](_0x41ce13[_0x0d75('0x2d')])[_0x0d75('0x23')],'basename':path[_0x0d75('0x36')](_0x41ce13[_0x0d75('0x2d')])['name']+'.pdf','type':'application/pdf'})[_0x0d75('0x37')](function(_0x215f56){faxAccount['notify'](_0x591a73,{'from':_0x41ce13[_0x0d75('0x33')],'mapKey':_0x0d75('0x38'),'body':path[_0x0d75('0x36')](_0x41ce13[_0x0d75('0x2d')])['name']+_0x0d75('0x39'),'AttachmentId':_0x215f56['id']})[_0x0d75('0x3a')](function(_0x1afcc0){logger[_0x0d75('0x3b')](_0x41ce13['uniqueid'],_0x0d75('0x3c'),JSON[_0x0d75('0x3d')](_0x1afcc0));});})[_0x0d75('0x3a')](function(_0x4bbd6f){logger[_0x0d75('0x3b')](_0x41ce13[_0x0d75('0x20')],_0x0d75('0x3e'),JSON[_0x0d75('0x3d')](_0x4bbd6f));});});}logger['info'](_0x41ce13[_0x0d75('0x20')],'\x20receiveFax\x20');}};Fax[_0x0d75('0x1b')][_0x0d75('0x1a')]=function(_0x33e331){if(this['actions'][_0x33e331[_0x0d75('0x20')]]){_[_0x0d75('0x3f')](this['channels'][_0x33e331[_0x0d75('0x20')]],_[_0x0d75('0x40')](_0x33e331,[_0x0d75('0x41'),'reason']));}};function updateStatus(_0x31cfa0){if(_0x31cfa0[_0x0d75('0x42')]){faxMessage[_0x0d75('0x43')](_0x31cfa0[_0x0d75('0x42')],{'failMessage':'SENDING\x20FAILED\x20'})['then'](function(_0x6cb1b1){ut[_0x0d75('0x44')](_0x0d75('0x45'),_0x6cb1b1);})[_0x0d75('0x3a')](function(_0x177526){ut[_0x0d75('0x44')](_0x0d75('0x46'),_0x177526);});}else{ut['logger'](_0x0d75('0x47'));}}Fax[_0x0d75('0x1b')][_0x0d75('0x48')]=function(_0x40a20d,_0xaf7515,_0x2bf5a0){var _0x5556ac=this;var _0x1e5915={};if(_0xaf7515){_0x1e5915={'read':_0xaf7515};}else{_0x1e5915={'failMessage':_0x2bf5a0};}if(this['actions'][_0x40a20d][_0x0d75('0x42')]){faxMessage[_0x0d75('0x43')](this['actions'][_0x40a20d]['AttachmentId'],_0x1e5915)['then'](function(_0x10efc8){ut[_0x0d75('0x44')](_0x0d75('0x49'),_0x10efc8);})[_0x0d75('0x3a')](function(_0x12b6ee){ut[_0x0d75('0x44')](_0x0d75('0x4a'),_0x12b6ee);})['finally'](function(){delete _0x5556ac['channels'][_0x40a20d];delete _0x5556ac[_0x0d75('0xc')][_0x40a20d];});}else{ut['logger'](_0x0d75('0x4b'));delete this[_0x0d75('0x21')][_0x40a20d];delete this[_0x0d75('0xc')][_0x40a20d];}};Fax[_0x0d75('0x1b')]['syncHangup']=function(_0xf31b46){var _0x5a0fb7=this;if(this[_0x0d75('0x21')][_0xf31b46[_0x0d75('0x20')]]){if(this[_0x0d75('0xc')][_0xf31b46[_0x0d75('0x20')]]){this[_0x0d75('0x21')][_0xf31b46[_0x0d75('0x20')]]['id']=this[_0x0d75('0xc')][_0xf31b46[_0x0d75('0x20')]]['id'];this[_0x0d75('0x21')][_0xf31b46[_0x0d75('0x20')]][_0x0d75('0x23')]=this[_0x0d75('0xc')][_0xf31b46[_0x0d75('0x20')]][_0x0d75('0x23')];}logger[_0x0d75('0x24')](_0xf31b46[_0x0d75('0x20')],this['actions'][_0xf31b46[_0x0d75('0x20')]]?_0x0d75('0x4c'):_0x0d75('0x4d'),JSON[_0x0d75('0x3d')](this[_0x0d75('0x21')][_0xf31b46[_0x0d75('0x20')]]));if(this[_0x0d75('0xc')][_0xf31b46['uniqueid']]){if(this[_0x0d75('0x21')][_0xf31b46[_0x0d75('0x20')]][_0x0d75('0x4e')]>0x0&&this[_0x0d75('0x21')][_0xf31b46[_0x0d75('0x20')]][_0x0d75('0x15')]==='SUCCESS'){this[_0x0d75('0x48')](_0xf31b46[_0x0d75('0x20')],!![]);}else{this[_0x0d75('0x48')](_0xf31b46['uniqueid'],![],this[_0x0d75('0x21')][_0xf31b46['uniqueid']][_0x0d75('0x4f')]?'SENDING\x20FAILED:\x20'+this[_0x0d75('0x21')][_0xf31b46[_0x0d75('0x20')]]['faxstatusstring']:_0x0d75('0x50'));}}}};Fax[_0x0d75('0x1b')][_0x0d75('0x51')]=function(_0x1e1644){var _0x6e73cc=this;return new BPromise(function(_0xbdc5af,_0x37c8ea){_0x6e73cc[_0x0d75('0x52')](_0x1e1644,_0x6e73cc[_0x0d75('0xa')][_0x1e1644['FaxAccountId']])[_0x0d75('0x37')](function(_0x5badd6){ut['logger'](_0x0d75('0x53'),_0x5badd6);_0xbdc5af(ut[_0x0d75('0x35')](_0x0d75('0x54')));})[_0x0d75('0x3a')](function(_0x318e79){ut['logger'](_0x0d75('0x55'),_0x318e79);updateStatus(_0x1e1644);_0x37c8ea(ut[_0x0d75('0x35')](_0x0d75('0x56')));});});};Fax[_0x0d75('0x1b')][_0x0d75('0x57')]=function(_0x4d9f52){var _0x23c64c=this;return new BPromise(function(_0x372d67,_0x1d57b5){var _0x3b10ec=_0x23c64c[_0x0d75('0x58')](_0x23c64c['faxAccounts'][_0x4d9f52['FaxAccountId']][_0x0d75('0x59')],_0x4d9f52);if(_0x3b10ec['isValid']){_0x372d67(ut[_0x0d75('0x35')](_0x0d75('0x5a')));}else{_0x1d57b5(ut['message'](_0x3b10ec['message']));}});};function originate(_0x1b9d69,_0x10701c,_0x368707){return new BPromise(function(_0x2eb4b3,_0x49afb0){if(_0x368707){var _0x29b3b3=util[_0x0d75('0x5b')]('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[_0x0d75('0x36')](_0x1b9d69[_0x0d75('0x5c')])[_0x0d75('0x23')],_0x1b9d69[_0x0d75('0x5c')]);gs[_0x0d75('0x5d')](_0x29b3b3)['then'](function(){_0x1b9d69[_0x0d75('0x5c')]=util[_0x0d75('0x5b')](_0x0d75('0x5e'),path[_0x0d75('0x36')](_0x1b9d69['path'])[_0x0d75('0x5f')],path['parse'](_0x1b9d69['path'])[_0x0d75('0x23')]);_0x10701c[_0x0d75('0x60')]=_0x1b9d69[_0x0d75('0x5c')];ut[_0x0d75('0x44')](_0x0d75('0x61'),'');ami[_0x0d75('0x62')](ut[_0x0d75('0x63')](_0x1b9d69,_0x10701c))[_0x0d75('0x37')](function(_0x136ae7){_0x2eb4b3(_0x136ae7);})[_0x0d75('0x3a')](function(_0x312162){_0x49afb0(_0x312162);});})[_0x0d75('0x3a')](function(_0xebf3f8){_0x49afb0(_0xebf3f8);});}else{ami[_0x0d75('0x62')](ut['variablesAction'](_0x1b9d69,_0x10701c))['then'](function(_0x411210){_0x2eb4b3(_0x411210);})['catch'](function(_0x52317e){_0x49afb0(_0x52317e);});}});}Fax['prototype'][_0x0d75('0x52')]=function(_0x3e33d9,_0x167b24){var _0x495e6d=this;return new BPromise(function(_0x4fd0de,_0x511273){var _0x179f51=uuid['v4']();var _0x50a66e=ut[_0x0d75('0x64')](_0x3e33d9,_0x167b24);_0x495e6d['actions'][_0x179f51]=new Action(_0x179f51,_0x167b24,_0x3e33d9);var _0x37cea9=_0x495e6d['actions'][_0x179f51];if(path[_0x0d75('0x36')](_0x3e33d9[_0x0d75('0x5c')])[_0x0d75('0x65')]===_0x0d75('0x39')){originate(_0x37cea9,_0x50a66e,!![])['then'](function(_0x27460c){_0x4fd0de(_0x27460c);})[_0x0d75('0x3a')](function(_0x1241d5){_0x511273(_0x1241d5);});}else{originate(_0x37cea9,_0x50a66e,![])['then'](function(_0x308811){_0x4fd0de(_0x308811);})[_0x0d75('0x3a')](function(_0x2272e6){_0x511273(_0x2272e6);});}});};Fax[_0x0d75('0x1b')]['isTrunkReachable']=function(_0x2ad0c7){return!_['isNil'](_0x2ad0c7)&&!_[_0x0d75('0x66')](_0x2ad0c7[_0x0d75('0x23')])&&!_['isNil'](_0x2ad0c7[_0x0d75('0x67')])&&_0x2ad0c7[_0x0d75('0x67')]&&!_['isNil'](this['trunks'][util[_0x0d75('0x5b')](_0x0d75('0x68'),_0x2ad0c7[_0x0d75('0x23')])])&&!_[_0x0d75('0x66')](this['trunks'][util['format'](_0x0d75('0x68'),_0x2ad0c7['name'])]['status'])&&(this[_0x0d75('0xb')][util[_0x0d75('0x5b')](_0x0d75('0x68'),_0x2ad0c7[_0x0d75('0x23')])]['status']===_0x0d75('0x69')||this[_0x0d75('0xb')][util[_0x0d75('0x5b')]('SIP/%s',_0x2ad0c7[_0x0d75('0x23')])][_0x0d75('0x2b')]===_0x0d75('0x6a'));};Fax[_0x0d75('0x1b')][_0x0d75('0x58')]=function(_0x55ae97,_0x2fbcb3){if(!this['isTrunkReachable'](_0x55ae97)){ut[_0x0d75('0x44')](_0x0d75('0x6b'),_['isNil'](_0x55ae97)?'':_0x55ae97[_0x0d75('0x23')]+_0x0d75('0x6c'));return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_[_0x0d75('0x66')](_0x2fbcb3[_0x0d75('0x38')])){ut[_0x0d75('0x44')](_0x0d75('0x6d'),JSON[_0x0d75('0x3d')](_0x2fbcb3));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x0d75('0x66')](_0x2fbcb3['path'])){ut[_0x0d75('0x44')](_0x0d75('0x6e'),JSON[_0x0d75('0x3d')](_0x2fbcb3));return{'isValid':![],'message':_0x0d75('0x6f')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0x0d75('0x70')]=Fax; \ No newline at end of file +var _0x6d12=['faxpages','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','[Fax][execOriginate][failure]','checkAfterSend','checkTrunk','Trunk','isValid','message','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','variablesAction','ext','isNil','active','SIP/%s','reachable','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','util','uuid','moment','path','tiff2pdf','./util/gs','fax','./channel','./action','../rpc/faxAccount','../rpc/attachment','channels','faxAccounts','trunks','newchannel','bind','varset','syncVarSet','syncNewState','newexten','faxstatus','syncFaxStatus','receivefax','hangup','syncHangup','originateresponse','syncNewchannel','context','from-voip-provider','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','prototype','variable','hasOwnProperty','channelstate','channelstatedesc','syncNewExten','value','operation','status','filename','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','create','parse','.pdf','application/pdf','then','notify','error','\x20notify\x20','catch','\x20receiveFax\x20','actions','merge','pick','response','AttachmentId','update','SENDING\x20FAILED\x20','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','logger','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','stringify'];(function(_0x1dc254,_0x2ab043){var _0x549dc6=function(_0x550ddb){while(--_0x550ddb){_0x1dc254['push'](_0x1dc254['shift']());}};_0x549dc6(++_0x2ab043);}(_0x6d12,0x17d));var _0x26d1=function(_0x2540db,_0x9b7318){_0x2540db=_0x2540db-0x0;var _0xbf6e9f=_0x6d12[_0x2540db];return _0xbf6e9f;};'use strict';var util=require(_0x26d1('0x0'));var _=require('lodash');var BPromise=require('bluebird');var uuid=require(_0x26d1('0x1'));var moment=require(_0x26d1('0x2'));var path=require(_0x26d1('0x3'));var tiff2pdf=require(_0x26d1('0x4'));var gs=require(_0x26d1('0x5'));var logger=require('../../../config/logger')(_0x26d1('0x6'));var ami=require('../ami');var rpcDb=require('./rpcDb');var Channel=require(_0x26d1('0x7'));var ut=require('./util/util');var Action=require(_0x26d1('0x8'));var faxAccount=require(_0x26d1('0x9'));var attachment=require(_0x26d1('0xa'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x1ef8a6){this[_0x26d1('0xb')]={};this[_0x26d1('0xc')]=_0x1ef8a6['faxAccounts'];this[_0x26d1('0xd')]=_0x1ef8a6['trunks'];this['actions']={};ami['on'](_0x26d1('0xe'),this['syncNewchannel'][_0x26d1('0xf')](this));ami['on'](_0x26d1('0x10'),this[_0x26d1('0x11')]['bind'](this));ami['on']('newstate',this[_0x26d1('0x12')]['bind'](this));ami['on'](_0x26d1('0x13'),this['syncNewExten'][_0x26d1('0xf')](this));ami['on'](_0x26d1('0x14'),this[_0x26d1('0x15')][_0x26d1('0xf')](this));ami['on'](_0x26d1('0x16'),this['syncReceiveFax'][_0x26d1('0xf')](this));ami['on'](_0x26d1('0x17'),this[_0x26d1('0x18')][_0x26d1('0xf')](this));ami['on'](_0x26d1('0x19'),this['syncOriginateResponse']['bind'](this));}Fax['prototype'][_0x26d1('0x1a')]=function(_0x482040){if(_0x482040[_0x26d1('0x1b')]===_0x26d1('0x1c')){for(var _0x1da6b2 in this[_0x26d1('0xc')]){if(this[_0x26d1('0xc')]['hasOwnProperty'](_0x1da6b2)){if(_0x482040[_0x26d1('0x1d')]===this[_0x26d1('0xc')][_0x1da6b2][_0x26d1('0x1e')]){this['channels'][_0x482040['uniqueid']]={};this['channels'][_0x482040[_0x26d1('0x1f')]][_0x26d1('0x20')]=_0x482040[_0x26d1('0x20')];this[_0x26d1('0xb')][_0x482040[_0x26d1('0x1f')]]['id']=this[_0x26d1('0xc')][_0x1da6b2]['id'];this[_0x26d1('0xb')][_0x482040[_0x26d1('0x1f')]]['name']=this[_0x26d1('0xc')][_0x1da6b2][_0x26d1('0x21')];logger[_0x26d1('0x22')](_0x482040['uniqueid'],_0x26d1('0x23'));}}}}if(this['actions'][_0x482040['uniqueid']]){this['channels'][_0x482040[_0x26d1('0x1f')]]={};this[_0x26d1('0xb')][_0x482040[_0x26d1('0x1f')]][_0x26d1('0x20')]=_0x482040[_0x26d1('0x20')];logger[_0x26d1('0x22')](_0x482040[_0x26d1('0x1f')],'\x20syncNewchannel\x20');}};Fax[_0x26d1('0x24')][_0x26d1('0x11')]=function(_0x37cfde){if(this[_0x26d1('0xb')][_0x37cfde[_0x26d1('0x1f')]]){for(var _0xd86e9d in _0x37cfde[_0x26d1('0x25')]){if(_0x37cfde[_0x26d1('0x25')][_0x26d1('0x26')](_0xd86e9d)){this[_0x26d1('0xb')][_0x37cfde[_0x26d1('0x1f')]][_0xd86e9d]=_0x37cfde['value'];}}}};Fax[_0x26d1('0x24')][_0x26d1('0x12')]=function(_0x80cc9f){if(this['channels'][_0x80cc9f[_0x26d1('0x1f')]]){this[_0x26d1('0xb')][_0x80cc9f[_0x26d1('0x1f')]][_0x26d1('0x27')]=_0x80cc9f[_0x26d1('0x27')];this['channels'][_0x80cc9f[_0x26d1('0x1f')]][_0x26d1('0x28')]=_0x80cc9f[_0x26d1('0x28')];}};Fax[_0x26d1('0x24')][_0x26d1('0x29')]=function(_0x7f612){if(this[_0x26d1('0xb')][_0x7f612[_0x26d1('0x1f')]]){for(var _0x45d752 in _0x7f612[_0x26d1('0x25')]){if(_0x7f612[_0x26d1('0x25')]['hasOwnProperty'](_0x45d752)){this[_0x26d1('0xb')][_0x7f612['uniqueid']][_0x45d752]=_0x7f612[_0x26d1('0x2a')];}}}};Fax[_0x26d1('0x24')][_0x26d1('0x15')]=function(_0x540f18){if(this[_0x26d1('0xb')][_0x540f18[_0x26d1('0x1f')]]){this[_0x26d1('0xb')][_0x540f18[_0x26d1('0x1f')]][_0x26d1('0x2b')]=_0x540f18[_0x26d1('0x2b')];this[_0x26d1('0xb')][_0x540f18[_0x26d1('0x1f')]][_0x26d1('0x2c')]=_0x540f18[_0x26d1('0x2c')];this[_0x26d1('0xb')][_0x540f18['uniqueid']][_0x26d1('0x1e')]=_0x540f18['localstationid'];this['channels'][_0x540f18[_0x26d1('0x1f')]][_0x26d1('0x2d')]=_0x540f18[_0x26d1('0x2d')];logger['info'](_0x540f18[_0x26d1('0x1f')],_0x26d1('0x2e'));}};Fax['prototype'][_0x26d1('0x2f')]=function(_0x180ed1){var _0x1bd2a3=this;if(this[_0x26d1('0xb')][_0x180ed1[_0x26d1('0x1f')]]){var _0x5acb89=this[_0x26d1('0xb')][_0x180ed1[_0x26d1('0x1f')]]['id'];this[_0x26d1('0xb')][_0x180ed1[_0x26d1('0x1f')]][_0x26d1('0x30')]=_0x180ed1[_0x26d1('0x30')];this[_0x26d1('0xb')][_0x180ed1[_0x26d1('0x1f')]][_0x26d1('0x31')]=_0x180ed1['pagestransferred'];this[_0x26d1('0xb')][_0x180ed1['uniqueid']]['localstationid']=_0x180ed1['localstationid'];this[_0x26d1('0xb')][_0x180ed1[_0x26d1('0x1f')]][_0x26d1('0x32')]=_0x180ed1['resolution'];this[_0x26d1('0xb')][_0x180ed1['uniqueid']]['transferrate']=_0x180ed1[_0x26d1('0x33')];this[_0x26d1('0xb')][_0x180ed1['uniqueid']][_0x26d1('0x2d')]=_0x180ed1[_0x26d1('0x2d')];this[_0x26d1('0xb')][_0x180ed1[_0x26d1('0x1f')]][_0x26d1('0x34')]=_0x180ed1[_0x26d1('0x34')];if(this[_0x26d1('0xb')][_0x180ed1['uniqueid']][_0x26d1('0x31')]>0x0){tiff2pdf(_0x180ed1[_0x26d1('0x2d')],_0x26d1('0x35'),function(_0x59d13c){logger[_0x26d1('0x22')](_0x180ed1['uniqueid'],'\x20result\x20conversion\x20file\x20',_0x59d13c['message']);attachment[_0x26d1('0x36')]({'name':path['parse'](_0x180ed1[_0x26d1('0x2d')])[_0x26d1('0x21')],'basename':path[_0x26d1('0x37')](_0x180ed1[_0x26d1('0x2d')])[_0x26d1('0x21')]+_0x26d1('0x38'),'type':_0x26d1('0x39')})[_0x26d1('0x3a')](function(_0xb9a163){faxAccount[_0x26d1('0x3b')](_0x5acb89,{'from':_0x180ed1['calleridnum'],'mapKey':_0x26d1('0x6'),'body':path[_0x26d1('0x37')](_0x180ed1[_0x26d1('0x2d')])[_0x26d1('0x21')]+_0x26d1('0x38'),'AttachmentId':_0xb9a163['id']})['catch'](function(_0x43d245){logger[_0x26d1('0x3c')](_0x180ed1[_0x26d1('0x1f')],_0x26d1('0x3d'),JSON['stringify'](_0x43d245));});})[_0x26d1('0x3e')](function(_0x3b9ec5){logger['error'](_0x180ed1['uniqueid'],_0x26d1('0x3f'),JSON['stringify'](_0x3b9ec5));});});}logger[_0x26d1('0x22')](_0x180ed1[_0x26d1('0x1f')],_0x26d1('0x3f'));}};Fax[_0x26d1('0x24')]['syncOriginateResponse']=function(_0x5c50b9){if(this[_0x26d1('0x40')][_0x5c50b9[_0x26d1('0x1f')]]){_[_0x26d1('0x41')](this[_0x26d1('0xb')][_0x5c50b9[_0x26d1('0x1f')]],_[_0x26d1('0x42')](_0x5c50b9,[_0x26d1('0x43'),'reason']));}};function updateStatus(_0x51d8e4){if(_0x51d8e4[_0x26d1('0x44')]){faxMessage[_0x26d1('0x45')](_0x51d8e4[_0x26d1('0x44')],{'failMessage':_0x26d1('0x46')})['then'](function(_0x3ef09a){ut['logger'](_0x26d1('0x47'),_0x3ef09a);})[_0x26d1('0x3e')](function(_0x4b5fae){ut['logger'](_0x26d1('0x48'),_0x4b5fae);});}else{ut['logger'](_0x26d1('0x49'));}}Fax[_0x26d1('0x24')]['updateStatus']=function(_0x286d3d,_0x458a96,_0x4932b0){var _0x4bf9dd=this;var _0x4d3cc7={};if(_0x458a96){_0x4d3cc7={'read':_0x458a96};}else{_0x4d3cc7={'failMessage':_0x4932b0};}if(this[_0x26d1('0x40')][_0x286d3d]['AttachmentId']){faxMessage[_0x26d1('0x45')](this[_0x26d1('0x40')][_0x286d3d][_0x26d1('0x44')],_0x4d3cc7)[_0x26d1('0x3a')](function(_0x4fb78d){ut[_0x26d1('0x4a')]('[Fax][Message][Updated]',_0x4fb78d);})['catch'](function(_0x2c741d){ut[_0x26d1('0x4a')]('[Fax][Message][NoUpdate1]',_0x2c741d);})[_0x26d1('0x4b')](function(){delete _0x4bf9dd[_0x26d1('0xb')][_0x286d3d];delete _0x4bf9dd[_0x26d1('0x40')][_0x286d3d];});}else{ut[_0x26d1('0x4a')](_0x26d1('0x4c'));delete this[_0x26d1('0xb')][_0x286d3d];delete this[_0x26d1('0x40')][_0x286d3d];}};Fax[_0x26d1('0x24')][_0x26d1('0x18')]=function(_0x303b2e){var _0x5b0b3d=this;if(this['channels'][_0x303b2e[_0x26d1('0x1f')]]){if(this['actions'][_0x303b2e['uniqueid']]){this[_0x26d1('0xb')][_0x303b2e['uniqueid']]['id']=this['actions'][_0x303b2e[_0x26d1('0x1f')]]['id'];this[_0x26d1('0xb')][_0x303b2e[_0x26d1('0x1f')]][_0x26d1('0x21')]=this[_0x26d1('0x40')][_0x303b2e[_0x26d1('0x1f')]]['name'];}logger[_0x26d1('0x22')](_0x303b2e[_0x26d1('0x1f')],this[_0x26d1('0x40')][_0x303b2e[_0x26d1('0x1f')]]?_0x26d1('0x4d'):'\x20hangup\x20faxRiceive\x20',JSON[_0x26d1('0x4e')](this['channels'][_0x303b2e[_0x26d1('0x1f')]]));if(this['actions'][_0x303b2e[_0x26d1('0x1f')]]){if(this['channels'][_0x303b2e[_0x26d1('0x1f')]][_0x26d1('0x4f')]>0x0&&this[_0x26d1('0xb')][_0x303b2e[_0x26d1('0x1f')]]['faxstatus']===_0x26d1('0x50')){this[_0x26d1('0x51')](_0x303b2e[_0x26d1('0x1f')],!![]);}else{this[_0x26d1('0x51')](_0x303b2e['uniqueid'],![],this[_0x26d1('0xb')][_0x303b2e[_0x26d1('0x1f')]][_0x26d1('0x52')]?_0x26d1('0x53')+this['channels'][_0x303b2e[_0x26d1('0x1f')]][_0x26d1('0x52')]:_0x26d1('0x54'));}}}};Fax[_0x26d1('0x24')][_0x26d1('0x55')]=function(_0x1bb860){var _0x2a4ffa=this;return new BPromise(function(_0x50ccfc,_0x192943){_0x2a4ffa[_0x26d1('0x56')](_0x1bb860,_0x2a4ffa['faxAccounts'][_0x1bb860[_0x26d1('0x57')]])[_0x26d1('0x3a')](function(_0x106d1d){ut[_0x26d1('0x4a')](_0x26d1('0x58'),_0x106d1d);_0x50ccfc(ut['message']('Fax\x20received'));})[_0x26d1('0x3e')](function(_0x36a209){ut[_0x26d1('0x4a')](_0x26d1('0x59'),_0x36a209);updateStatus(_0x1bb860);_0x192943(ut['message']('Fax\x20failed'));});});};Fax['prototype'][_0x26d1('0x5a')]=function(_0x28a41b){var _0x5af17e=this;return new BPromise(function(_0x3df1f0,_0xb2c78c){var _0x29887e=_0x5af17e[_0x26d1('0x5b')](_0x5af17e[_0x26d1('0xc')][_0x28a41b[_0x26d1('0x57')]][_0x26d1('0x5c')],_0x28a41b);if(_0x29887e[_0x26d1('0x5d')]){_0x3df1f0(ut[_0x26d1('0x5e')](_0x26d1('0x5f')));}else{_0xb2c78c(ut['message'](_0x29887e['message']));}});};function originate(_0x4728c2,_0x1def9e,_0x5c89e9){return new BPromise(function(_0x402b87,_0x158564){if(_0x5c89e9){var _0x1068ca=util[_0x26d1('0x60')](_0x26d1('0x61'),path[_0x26d1('0x37')](_0x4728c2[_0x26d1('0x3')])[_0x26d1('0x21')],_0x4728c2[_0x26d1('0x3')]);gs[_0x26d1('0x62')](_0x1068ca)[_0x26d1('0x3a')](function(){_0x4728c2[_0x26d1('0x3')]=util['format'](_0x26d1('0x63'),path['parse'](_0x4728c2[_0x26d1('0x3')])['dir'],path[_0x26d1('0x37')](_0x4728c2['path'])[_0x26d1('0x21')]);_0x1def9e[_0x26d1('0x64')]=_0x4728c2[_0x26d1('0x3')];ut['logger'](_0x26d1('0x65'),'');ami['Action'](ut[_0x26d1('0x66')](_0x4728c2,_0x1def9e))[_0x26d1('0x3a')](function(_0x43c089){_0x402b87(_0x43c089);})['catch'](function(_0x2d3c6a){_0x158564(_0x2d3c6a);});})[_0x26d1('0x3e')](function(_0x1cd35b){_0x158564(_0x1cd35b);});}else{ami['Action'](ut[_0x26d1('0x66')](_0x4728c2,_0x1def9e))[_0x26d1('0x3a')](function(_0x4775fa){_0x402b87(_0x4775fa);})[_0x26d1('0x3e')](function(_0x2a6e37){_0x158564(_0x2a6e37);});}});}Fax['prototype'][_0x26d1('0x56')]=function(_0x4ac8af,_0x2067eb){var _0x15afcb=this;return new BPromise(function(_0x456399,_0x220b7e){var _0x4e1042=uuid['v4']();var _0x3da167=ut['addVariables'](_0x4ac8af,_0x2067eb);_0x15afcb[_0x26d1('0x40')][_0x4e1042]=new Action(_0x4e1042,_0x2067eb,_0x4ac8af);var _0x2a7610=_0x15afcb['actions'][_0x4e1042];if(path[_0x26d1('0x37')](_0x4ac8af[_0x26d1('0x3')])[_0x26d1('0x67')]===_0x26d1('0x38')){originate(_0x2a7610,_0x3da167,!![])[_0x26d1('0x3a')](function(_0x144e24){_0x456399(_0x144e24);})['catch'](function(_0x308b20){_0x220b7e(_0x308b20);});}else{originate(_0x2a7610,_0x3da167,![])['then'](function(_0x4d7036){_0x456399(_0x4d7036);})[_0x26d1('0x3e')](function(_0xbefa35){_0x220b7e(_0xbefa35);});}});};Fax[_0x26d1('0x24')]['isTrunkReachable']=function(_0x4e5d8c){return!_[_0x26d1('0x68')](_0x4e5d8c)&&!_['isNil'](_0x4e5d8c['name'])&&!_[_0x26d1('0x68')](_0x4e5d8c[_0x26d1('0x69')])&&_0x4e5d8c[_0x26d1('0x69')]&&!_[_0x26d1('0x68')](this[_0x26d1('0xd')][util[_0x26d1('0x60')](_0x26d1('0x6a'),_0x4e5d8c[_0x26d1('0x21')])])&&!_[_0x26d1('0x68')](this['trunks'][util[_0x26d1('0x60')]('SIP/%s',_0x4e5d8c['name'])][_0x26d1('0x2c')])&&(this['trunks'][util[_0x26d1('0x60')](_0x26d1('0x6a'),_0x4e5d8c[_0x26d1('0x21')])][_0x26d1('0x2c')]===_0x26d1('0x6b')||this['trunks'][util[_0x26d1('0x60')](_0x26d1('0x6a'),_0x4e5d8c['name'])][_0x26d1('0x2c')]==='unmonitored');};Fax[_0x26d1('0x24')][_0x26d1('0x5b')]=function(_0x1bc25e,_0x399b25){if(!this[_0x26d1('0x6c')](_0x1bc25e)){ut[_0x26d1('0x4a')](_0x26d1('0x6d'),_[_0x26d1('0x68')](_0x1bc25e)?'':_0x1bc25e[_0x26d1('0x21')]+_0x26d1('0x6e'));return{'isValid':![],'message':_0x26d1('0x6f')};}if(_['isNil'](_0x399b25[_0x26d1('0x6')])){ut['logger'](_0x26d1('0x70'),JSON[_0x26d1('0x4e')](_0x399b25));return{'isValid':![],'message':_0x26d1('0x71')};}if(_[_0x26d1('0x68')](_0x399b25[_0x26d1('0x3')])){ut[_0x26d1('0x4a')](_0x26d1('0x72'),JSON[_0x26d1('0x4e')](_0x399b25));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':'Is\x20Valid'};};module['exports']=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 8c4a994..8f22a42 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 _0x62b5=['notify','resolve','then','catch','[Notify]\x20','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','error'];(function(_0x2d2ca2,_0x51873f){var _0x48489d=function(_0x1a2cf7){while(--_0x1a2cf7){_0x2d2ca2['push'](_0x2d2ca2['shift']());}};_0x48489d(++_0x51873f);}(_0x62b5,0xf7));var _0x562b=function(_0xade4dd,_0x470d1d){_0xade4dd=_0xade4dd-0x0;var _0x3f0f83=_0x62b5[_0xade4dd];return _0x3f0f83;};'use strict';var util=require('util');var BPromise=require(_0x562b('0x0'));var logger=require(_0x562b('0x1'))(_0x562b('0x2'));var _=require(_0x562b('0x3'));var faxAccount=require(_0x562b('0x4'));function loggerCatch(_0x3a1fc8){return function(_0x5634ca){logger[_0x562b('0x5')](_0x3a1fc8,util['inspect'](_0x5634ca,{'showHidden':![],'depth':null}));};}exports[_0x562b('0x6')]=function(_0x4e2010,_0x548cfd){return BPromise[_0x562b('0x7')]()[_0x562b('0x8')](faxAccount[_0x562b('0x6')](_0x4e2010,_0x548cfd))[_0x562b('0x9')](loggerCatch(_0x562b('0xa')));}; \ No newline at end of file +var _0xe409=['[Notify]\x20','util','bluebird','preview','../rpc/faxAccount','error','inspect','notify','resolve','then'];(function(_0x3707a7,_0x52219f){var _0x315464=function(_0x258286){while(--_0x258286){_0x3707a7['push'](_0x3707a7['shift']());}};_0x315464(++_0x52219f);}(_0xe409,0x191));var _0x9e40=function(_0x26fa7d,_0x16ee27){_0x26fa7d=_0x26fa7d-0x0;var _0x4f2500=_0xe409[_0x26fa7d];return _0x4f2500;};'use strict';var util=require(_0x9e40('0x0'));var BPromise=require(_0x9e40('0x1'));var logger=require('../../../config/logger')(_0x9e40('0x2'));var _=require('lodash');var faxAccount=require(_0x9e40('0x3'));function loggerCatch(_0x192f00){return function(_0x26581d){logger[_0x9e40('0x4')](_0x192f00,util[_0x9e40('0x5')](_0x26581d,{'showHidden':![],'depth':null}));};}exports[_0x9e40('0x6')]=function(_0x3440aa,_0x2443f2){return BPromise[_0x9e40('0x7')]()[_0x9e40('0x8')](faxAccount[_0x9e40('0x6')](_0x3440aa,_0x2443f2))['catch'](loggerCatch(_0x9e40('0x9')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index ee2305b..0e25e57 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 _0x4774=['\x20Error\x20:','inspect','util','../../../../config/logger','fax','bluebird','child_process','exec','execute','info','Exec\x20gs'];(function(_0x3e15e7,_0x305f98){var _0x33cc4e=function(_0x51410e){while(--_0x51410e){_0x3e15e7['push'](_0x3e15e7['shift']());}};_0x33cc4e(++_0x305f98);}(_0x4774,0x141));var _0x4477=function(_0x4e5393,_0x26243e){_0x4e5393=_0x4e5393-0x0;var _0x4fa961=_0x4774[_0x4e5393];return _0x4fa961;};'use strict';var util=require(_0x4477('0x0'));var logger=require(_0x4477('0x1'))(_0x4477('0x2'));var BPromise=require(_0x4477('0x3'));var exec=require(_0x4477('0x4'))[_0x4477('0x5')];exports[_0x4477('0x6')]=function(_0x40ceeb){return new BPromise(function(_0x1f0a63,_0x57a738){exec(_0x40ceeb,function(_0x3bda2a,_0x1f6e43,_0x493bc9){logger[_0x4477('0x7')](_0x4477('0x8'),_0x1f6e43);if(_0x3bda2a){logger[_0x4477('0x7')]('Exec\x20gs',_0x4477('0x9'),util[_0x4477('0xa')](_0x3bda2a,{'showHidden':![],'depth':null}),_0x1f6e43,_0x493bc9);_0x57a738(_0x3bda2a);}_0x1f0a63(_0x1f6e43);});});}; \ No newline at end of file +var _0x5a87=['info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','child_process','exec','execute'];(function(_0x401b3e,_0xed8de5){var _0x4f290f=function(_0xa45f77){while(--_0xa45f77){_0x401b3e['push'](_0x401b3e['shift']());}};_0x4f290f(++_0xed8de5);}(_0x5a87,0x1d8));var _0x75a8=function(_0x199fd9,_0x55fe3e){_0x199fd9=_0x199fd9-0x0;var _0x1b11fa=_0x5a87[_0x199fd9];return _0x1b11fa;};'use strict';var util=require(_0x75a8('0x0'));var logger=require(_0x75a8('0x1'))('fax');var BPromise=require('bluebird');var exec=require(_0x75a8('0x2'))[_0x75a8('0x3')];exports[_0x75a8('0x4')]=function(_0x22a75f){return new BPromise(function(_0x3a15ab,_0x254820){exec(_0x22a75f,function(_0x1f30bc,_0x1467b1,_0x45f1ae){logger[_0x75a8('0x5')](_0x75a8('0x6'),_0x1467b1);if(_0x1f30bc){logger['info'](_0x75a8('0x6'),_0x75a8('0x7'),util[_0x75a8('0x8')](_0x1f30bc,{'showHidden':![],'depth':null}),_0x1467b1,_0x45f1ae);_0x254820(_0x1f30bc);}_0x3a15ab(_0x1467b1);});});}; \ No newline at end of file diff --git a/server/services/ami/fax/util/util.js b/server/services/ami/fax/util/util.js index 12a2b46..6b54084 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 _0xaae6=['variablesAction','\x22%s\x22\x20<%s>','util','lodash','moment','../../../../config/logger','fax','message','logger','inspect','headerinfo','minrate','maxrate','\x22%s\x22','modem','gateway','faxdetect','localstationid','path'];(function(_0x5774be,_0x2259d3){var _0x4914b4=function(_0x1eebc3){while(--_0x1eebc3){_0x5774be['push'](_0x5774be['shift']());}};_0x4914b4(++_0x2259d3);}(_0xaae6,0xd3));var _0x6aae=function(_0xa745e0,_0x54cf11){_0xa745e0=_0xa745e0-0x0;var _0x1b71d9=_0xaae6[_0xa745e0];return _0x1b71d9;};'use strict';var util=require(_0x6aae('0x0'));var _=require(_0x6aae('0x1'));var moment=require(_0x6aae('0x2'));var logger=require(_0x6aae('0x3'))(_0x6aae('0x4'));exports[_0x6aae('0x5')]=function(_0x305da6){return{'message':_0x305da6};};exports[_0x6aae('0x6')]=function(_0x563b50,_0x4aab34){logger['info'](_0x563b50,util[_0x6aae('0x7')](_0x4aab34,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x56bb82,_0x2d20e7){var _0x5c18e2={'XMF-ECM':_0x2d20e7['ecm'],'XMF-HEADERINFO':_0x2d20e7[_0x6aae('0x8')],'XMF-MINRATE':_0x2d20e7[_0x6aae('0x9')],'XMF-MAXRATE':_0x2d20e7[_0x6aae('0xa')],'XMF-MODEM':util['format'](_0x6aae('0xb'),_0x2d20e7[_0x6aae('0xc')]),'XMF-GATEWAY':_0x2d20e7[_0x6aae('0xd')],'XMF-FAXDETECT':_0x2d20e7[_0x6aae('0xe')],'XMF-T38TIMEOUT':_0x2d20e7['t38timeout'],'XMF-LOCALSTATIONID':_0x2d20e7[_0x6aae('0xf')],'XMF-PATH':_0x56bb82[_0x6aae('0x10')]};return _0x5c18e2;};exports[_0x6aae('0x11')]=function(_0x6cc9ce,_0x77a12a){return{'actionid':_0x6cc9ce['uniqueid'],'action':'originate','channel':_0x6cc9ce['channel'],'Exten':'xcally-motion-fax','Context':'from-sip','Priority':'1','callerid':util['format'](_0x6aae('0x12'),_0x6cc9ce['headerinfo']?_0x6cc9ce[_0x6aae('0x8')]:'',_0x6cc9ce[_0x6aae('0xf')]),'variable':_0x77a12a,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x6cc9ce['uniqueid']};}; \ No newline at end of file +var _0x9c99=['message','logger','info','inspect','addVariables','ecm','headerinfo','minrate','modem','gateway','faxdetect','t38timeout','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','format','util','moment','../../../../config/logger'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x9c99,0xd9));var _0x99c9=function(_0x9148ba,_0x2cb1b5){_0x9148ba=_0x9148ba-0x0;var _0x355e3b=_0x9c99[_0x9148ba];return _0x355e3b;};'use strict';var util=require(_0x99c9('0x0'));var _=require('lodash');var moment=require(_0x99c9('0x1'));var logger=require(_0x99c9('0x2'))('fax');exports[_0x99c9('0x3')]=function(_0x4836eb){return{'message':_0x4836eb};};exports[_0x99c9('0x4')]=function(_0x2119d7,_0xb1ab5c){logger[_0x99c9('0x5')](_0x2119d7,util[_0x99c9('0x6')](_0xb1ab5c,{'showHidden':![],'depth':null}));};exports[_0x99c9('0x7')]=function(_0x56a333,_0x1e9a19){var _0x6dbc58={'XMF-ECM':_0x1e9a19[_0x99c9('0x8')],'XMF-HEADERINFO':_0x1e9a19[_0x99c9('0x9')],'XMF-MINRATE':_0x1e9a19[_0x99c9('0xa')],'XMF-MAXRATE':_0x1e9a19['maxrate'],'XMF-MODEM':util['format']('\x22%s\x22',_0x1e9a19[_0x99c9('0xb')]),'XMF-GATEWAY':_0x1e9a19[_0x99c9('0xc')],'XMF-FAXDETECT':_0x1e9a19[_0x99c9('0xd')],'XMF-T38TIMEOUT':_0x1e9a19[_0x99c9('0xe')],'XMF-LOCALSTATIONID':_0x1e9a19['localstationid'],'XMF-PATH':_0x56a333[_0x99c9('0xf')]};return _0x6dbc58;};exports[_0x99c9('0x10')]=function(_0x36b875,_0x13198d){return{'actionid':_0x36b875[_0x99c9('0x11')],'action':_0x99c9('0x12'),'channel':_0x36b875[_0x99c9('0x13')],'Exten':_0x99c9('0x14'),'Context':'from-sip','Priority':'1','callerid':util[_0x99c9('0x15')]('\x22%s\x22\x20<%s>',_0x36b875[_0x99c9('0x9')]?_0x36b875[_0x99c9('0x9')]:'',_0x36b875['localstationid']),'variable':_0x13198d,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x36b875['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index b45b5df..6ec7876 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 _0x3670=['initDynamics365Accounts','getCampaigns','getVoiceExtensions','initVoiceExtensions','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initCampaignHopperHistory','initVoiceCallReports','catch','log','listen','sync','util','moment','./realtime','./report','./acw','./trigger','./dialer','./preview','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','hour','resolve','then','getAgents','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initServicenowAccounts'];(function(_0x52bb34,_0x2e46a1){var _0x2c328c=function(_0x30f939){while(--_0x30f939){_0x52bb34['push'](_0x52bb34['shift']());}};_0x2c328c(++_0x2e46a1);}(_0x3670,0x162));var _0x0367=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3670[_0x2dafbe];return _0x58a45a;};'use strict';var BPromise=require('bluebird');var util=require(_0x0367('0x0'));var moment=require(_0x0367('0x1'));var server=require('./server');var Realtime=require(_0x0367('0x2'));var Report=require(_0x0367('0x3'));var Acw=require(_0x0367('0x4'));var Trigger=require(_0x0367('0x5'));var Dialer=require(_0x0367('0x6'));var Preview=require(_0x0367('0x7'));var Fax=require('./fax');var user=require(_0x0367('0x8'));var voiceQueue=require(_0x0367('0x9'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x0367('0xa'));var trunk=require(_0x0367('0xb'));var trigger=require(_0x0367('0xc'));var template=require(_0x0367('0xd'));var cmHopperHistory=require(_0x0367('0xe'));var campaign=require(_0x0367('0xf'));var voiceExtension=require(_0x0367('0x10'));var faxAccount=require(_0x0367('0x11'));var zendesk=require(_0x0367('0x12'));var salesforce=require(_0x0367('0x13'));var sugarcrm=require(_0x0367('0x14'));var freshdesk=require(_0x0367('0x15'));var desk=require(_0x0367('0x16'));var zoho=require(_0x0367('0x17'));var vtiger=require(_0x0367('0x18'));var freshsales=require(_0x0367('0x19'));var servicenow=require(_0x0367('0x1a'));var dynamics365=require(_0x0367('0x1b'));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'](_0x0367('0x1c'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0x0367('0x1c'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x0367('0x1d')]()[_0x0367('0x1e')](user[_0x0367('0x1f')]())[_0x0367('0x1e')](realtime['initAgents']())[_0x0367('0x1e')](user['getTelephones']())[_0x0367('0x1e')](realtime[_0x0367('0x20')]())['then'](trunk[_0x0367('0x21')]())[_0x0367('0x1e')](realtime[_0x0367('0x22')]())[_0x0367('0x1e')](voiceQueue[_0x0367('0x23')]())[_0x0367('0x1e')](realtime[_0x0367('0x24')]())['then'](trigger[_0x0367('0x25')]())[_0x0367('0x1e')](realtime[_0x0367('0x26')]())['then'](template[_0x0367('0x27')]())['then'](realtime[_0x0367('0x28')]())[_0x0367('0x1e')](zendesk['getZendeskAccounts']())['then'](realtime['initZendeskAccounts']())[_0x0367('0x1e')](salesforce[_0x0367('0x29')]())[_0x0367('0x1e')](realtime['initSalesforceAccounts']())[_0x0367('0x1e')](sugarcrm[_0x0367('0x2a')]())[_0x0367('0x1e')](realtime[_0x0367('0x2b')]())[_0x0367('0x1e')](freshdesk[_0x0367('0x2c')]())[_0x0367('0x1e')](realtime[_0x0367('0x2d')]())[_0x0367('0x1e')](desk[_0x0367('0x2e')]())[_0x0367('0x1e')](realtime[_0x0367('0x2f')]())[_0x0367('0x1e')](zoho[_0x0367('0x30')]())['then'](realtime[_0x0367('0x31')]())[_0x0367('0x1e')](vtiger[_0x0367('0x32')]())[_0x0367('0x1e')](realtime[_0x0367('0x33')]())[_0x0367('0x1e')](freshsales[_0x0367('0x34')]())[_0x0367('0x1e')](realtime['initFreshsalesAccounts']())[_0x0367('0x1e')](servicenow['getServicenowAccounts']())[_0x0367('0x1e')](realtime[_0x0367('0x35')]())['then'](dynamics365['getDynamics365Accounts']())[_0x0367('0x1e')](realtime[_0x0367('0x36')]())[_0x0367('0x1e')](campaign[_0x0367('0x37')]())['then'](realtime['initCampaigns']())[_0x0367('0x1e')](voiceExtension[_0x0367('0x38')]())[_0x0367('0x1e')](realtime[_0x0367('0x39')]())['then'](faxAccount['getFaxAccounts']())['then'](realtime[_0x0367('0x3a')]())[_0x0367('0x1e')](function(){return realtime;});}function initParams(){return BPromise['resolve']()[_0x0367('0x1e')](voiceQueueReport[_0x0367('0x3b')]())['then'](realtime[_0x0367('0x3c')]())['then'](cmHopperHistory[_0x0367('0x3d')]())[_0x0367('0x1e')](realtime['initVoiceQueueHopperHistory']())[_0x0367('0x1e')](cmHopperHistory['getCampaignHopperHistory']())[_0x0367('0x1e')](realtime[_0x0367('0x3e')]())[_0x0367('0x1e')](voiceCallReport['getVoiceCallReports']())[_0x0367('0x1e')](realtime[_0x0367('0x3f')]())[_0x0367('0x1e')](function(_0x524dc8){})[_0x0367('0x40')](function(_0x4b6a12){console[_0x0367('0x41')](_0x4b6a12);});}function main(){return server[_0x0367('0x42')](realtime,preview,fax)[_0x0367('0x1e')](function(_0x2a865f){return initRealtime();})[_0x0367('0x1e')](function(){return initParams();})[_0x0367('0x1e')](function(){report[_0x0367('0x43')]();setInterval(initRealtime,0x1388);})[_0x0367('0x40')](function(_0x3516e8){console['log'](_0x3516e8);});}main(); \ No newline at end of file +var _0xbeb4=['moment','./report','./acw','./trigger','./fax','./rpc/user','./rpc/voiceCallReport','./rpc/trigger','./rpc/template','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','resolve','getAgents','initAgents','then','getTelephones','initTelephones','getTrunks','getVoiceQueues','initTriggers','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','log','listen','sync','catch','bluebird','util'];(function(_0xd1f854,_0x532346){var _0x548294=function(_0x4be823){while(--_0x4be823){_0xd1f854['push'](_0xd1f854['shift']());}};_0x548294(++_0x532346);}(_0xbeb4,0x10a));var _0x4beb=function(_0x519e89,_0x41ec0d){_0x519e89=_0x519e89-0x0;var _0x1a0f42=_0xbeb4[_0x519e89];return _0x1a0f42;};'use strict';var BPromise=require(_0x4beb('0x0'));var util=require(_0x4beb('0x1'));var moment=require(_0x4beb('0x2'));var server=require('./server');var Realtime=require('./realtime');var Report=require(_0x4beb('0x3'));var Acw=require(_0x4beb('0x4'));var Trigger=require(_0x4beb('0x5'));var Dialer=require('./dialer');var Preview=require('./preview');var Fax=require(_0x4beb('0x6'));var user=require(_0x4beb('0x7'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x4beb('0x8'));var trunk=require('./rpc/trunk');var trigger=require(_0x4beb('0x9'));var template=require(_0x4beb('0xa'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0x4beb('0xb'));var voiceExtension=require(_0x4beb('0xc'));var faxAccount=require(_0x4beb('0xd'));var zendesk=require(_0x4beb('0xe'));var salesforce=require(_0x4beb('0xf'));var sugarcrm=require(_0x4beb('0x10'));var freshdesk=require(_0x4beb('0x11'));var desk=require(_0x4beb('0x12'));var zoho=require(_0x4beb('0x13'));var vtiger=require(_0x4beb('0x14'));var freshsales=require(_0x4beb('0x15'));var servicenow=require(_0x4beb('0x16'));var dynamics365=require(_0x4beb('0x17'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x4beb('0x18')](_0x4beb('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x4beb('0x18')](_0x4beb('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x4beb('0x1a')]()['then'](user[_0x4beb('0x1b')]())['then'](realtime[_0x4beb('0x1c')]())[_0x4beb('0x1d')](user[_0x4beb('0x1e')]())['then'](realtime[_0x4beb('0x1f')]())[_0x4beb('0x1d')](trunk[_0x4beb('0x20')]())[_0x4beb('0x1d')](realtime['initTrunks']())[_0x4beb('0x1d')](voiceQueue[_0x4beb('0x21')]())['then'](realtime['initVoiceQueues']())[_0x4beb('0x1d')](trigger['getTriggers']())[_0x4beb('0x1d')](realtime[_0x4beb('0x22')]())[_0x4beb('0x1d')](template['getTemplates']())[_0x4beb('0x1d')](realtime[_0x4beb('0x23')]())[_0x4beb('0x1d')](zendesk[_0x4beb('0x24')]())[_0x4beb('0x1d')](realtime[_0x4beb('0x25')]())['then'](salesforce[_0x4beb('0x26')]())['then'](realtime['initSalesforceAccounts']())['then'](sugarcrm[_0x4beb('0x27')]())[_0x4beb('0x1d')](realtime[_0x4beb('0x28')]())[_0x4beb('0x1d')](freshdesk[_0x4beb('0x29')]())[_0x4beb('0x1d')](realtime[_0x4beb('0x2a')]())['then'](desk[_0x4beb('0x2b')]())[_0x4beb('0x1d')](realtime['initDeskAccounts']())[_0x4beb('0x1d')](zoho['getZohoAccounts']())[_0x4beb('0x1d')](realtime[_0x4beb('0x2c')]())[_0x4beb('0x1d')](vtiger[_0x4beb('0x2d')]())[_0x4beb('0x1d')](realtime[_0x4beb('0x2e')]())[_0x4beb('0x1d')](freshsales[_0x4beb('0x2f')]())[_0x4beb('0x1d')](realtime['initFreshsalesAccounts']())[_0x4beb('0x1d')](servicenow[_0x4beb('0x30')]())[_0x4beb('0x1d')](realtime[_0x4beb('0x31')]())[_0x4beb('0x1d')](dynamics365[_0x4beb('0x32')]())['then'](realtime['initDynamics365Accounts']())[_0x4beb('0x1d')](campaign[_0x4beb('0x33')]())['then'](realtime[_0x4beb('0x34')]())[_0x4beb('0x1d')](voiceExtension[_0x4beb('0x35')]())[_0x4beb('0x1d')](realtime[_0x4beb('0x36')]())[_0x4beb('0x1d')](faxAccount['getFaxAccounts']())[_0x4beb('0x1d')](realtime[_0x4beb('0x37')]())['then'](function(){return realtime;});}function initParams(){return BPromise[_0x4beb('0x1a')]()[_0x4beb('0x1d')](voiceQueueReport[_0x4beb('0x38')]())[_0x4beb('0x1d')](realtime[_0x4beb('0x39')]())['then'](cmHopperHistory[_0x4beb('0x3a')]())[_0x4beb('0x1d')](realtime[_0x4beb('0x3b')]())['then'](cmHopperHistory[_0x4beb('0x3c')]())[_0x4beb('0x1d')](realtime[_0x4beb('0x3d')]())[_0x4beb('0x1d')](voiceCallReport[_0x4beb('0x3e')]())[_0x4beb('0x1d')](realtime['initVoiceCallReports']())['then'](function(_0x19d7db){})['catch'](function(_0x5729bf){console[_0x4beb('0x3f')](_0x5729bf);});}function main(){return server[_0x4beb('0x40')](realtime,preview,fax)[_0x4beb('0x1d')](function(_0x2e3686){return initRealtime();})[_0x4beb('0x1d')](function(){return initParams();})[_0x4beb('0x1d')](function(){report[_0x4beb('0x41')]();setInterval(initRealtime,0x1388);})[_0x4beb('0x42')](function(_0x5dc069){console[_0x4beb('0x3f')](_0x5dc069);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index a52eaa7..87b36c2 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 _0xedd9=['phone','mobile','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','prototype','updateStatusRealtime','state','toLowerCase','idle','inuse','talking','statePause','toNumber','interface','format','user:%s','user:save','emit','user:presence','exports','util','moment','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','email','accountcode','fullname','unknown','status'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xedd9,0xfc));var _0x9edd=function(_0xc7089,_0x4768dd){_0xc7089=_0xc7089-0x0;var _0x1f9bf6=_0xedd9[_0xc7089];return _0x1f9bf6;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var md5=require(_0x9edd('0x2'));var Redis=require(_0x9edd('0x3'));var config=require(_0x9edd('0x4'));config[_0x9edd('0x5')]=_[_0x9edd('0x6')](config[_0x9edd('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x9edd('0x7'))(new Redis(config[_0x9edd('0x5')]));function Agent(_0x268f9e){this['id']=_0x268f9e['id']||0x0;this[_0x9edd('0x8')]=_0x268f9e['name']||'';this[_0x9edd('0x9')]=_0x268f9e['email']||'';this[_0x9edd('0xa')]=_0x268f9e[_0x9edd('0xa')]||'';this[_0x9edd('0xb')]=_0x268f9e[_0x9edd('0xb')]||'';this['state']=_0x9edd('0xc');this['stateTime']=0x0;this[_0x9edd('0xd')]=_0x9edd('0xc');this['address']='';this[_0x9edd('0xe')]='';this[_0x9edd('0xf')]='';this['interface']='';this[_0x9edd('0x10')]=_0x268f9e[_0x9edd('0x10')]||![];this[_0x9edd('0x11')]=_0x9edd('0xc');this[_0x9edd('0x12')]=0x0;this[_0x9edd('0x13')]='';this[_0x9edd('0x14')]='';this[_0x9edd('0x15')]=![];this['local']=![];this[_0x9edd('0x2')]='';}Agent[_0x9edd('0x16')][_0x9edd('0x17')]=function(_0x4d9a7){var _0x13b6b6;if(_0x4d9a7&&_0x4d9a7[_0x9edd('0x18')]){_0x13b6b6=_0x4d9a7[_0x9edd('0x18')][_0x9edd('0x19')]();switch(_0x13b6b6){case'not_inuse':_0x13b6b6=_0x9edd('0x1a');break;case _0x9edd('0x1b'):_0x13b6b6=_0x9edd('0x1c');break;}}if(_0x13b6b6&&this['voiceStatus']!==_0x13b6b6||_0x4d9a7[_0x9edd('0x1d')]){this[_0x9edd('0x12')]=_[_0x9edd('0x1e')](moment()['format']('x'));}if(_0x13b6b6){this[_0x9edd('0x11')]=_0x13b6b6;}var _0x5d879c={'id':this['id'],'name':this[_0x9edd('0x8')],'email':this[_0x9edd('0x9')],'accountcode':this['accountcode'],'fullname':this['fullname'],'state':this[_0x9edd('0x18')],'stateTime':this['stateTime'],'status':this[_0x9edd('0xd')],'address':this['address'],'online':this['online'],'voiceStatus':this[_0x9edd('0x11')],'voiceStatusTime':this[_0x9edd('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x9edd('0x1f')],'onhold':this[_0x9edd('0x15')]};var _0x477878=md5(JSON['stringify'](_0x5d879c));if(this[_0x9edd('0x2')]!==_0x477878){this[_0x9edd('0x2')]=_0x477878;io['to'](util[_0x9edd('0x20')](_0x9edd('0x21'),_0x5d879c[_0x9edd('0x8')]))['emit'](_0x9edd('0x22'),_0x5d879c);io[_0x9edd('0x23')](_0x9edd('0x24'),_0x5d879c);}};module[_0x9edd('0x25')]=Agent; \ No newline at end of file +var _0xe706=['address','phone','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','updateStatusRealtime','not_inuse','inuse','talking','format','interface','stringify','md5','user:%s','emit','user:presence','lodash','util','moment','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status'];(function(_0x3a7004,_0x2faf31){var _0x3b6f05=function(_0x572db5){while(--_0x572db5){_0x3a7004['push'](_0x3a7004['shift']());}};_0x3b6f05(++_0x2faf31);}(_0xe706,0xa3));var _0x6e70=function(_0x19a21c,_0x4e03f8){_0x19a21c=_0x19a21c-0x0;var _0x3e9b9f=_0xe706[_0x19a21c];return _0x3e9b9f;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var md5=require('md5');var Redis=require(_0x6e70('0x3'));var config=require(_0x6e70('0x4'));config[_0x6e70('0x5')]=_[_0x6e70('0x6')](config[_0x6e70('0x5')],{'host':_0x6e70('0x7'),'port':0x18eb});var io=require(_0x6e70('0x8'))(new Redis(config[_0x6e70('0x5')]));function Agent(_0x1b0389){this['id']=_0x1b0389['id']||0x0;this[_0x6e70('0x9')]=_0x1b0389[_0x6e70('0x9')]||'';this[_0x6e70('0xa')]=_0x1b0389[_0x6e70('0xa')]||'';this[_0x6e70('0xb')]=_0x1b0389[_0x6e70('0xb')]||'';this[_0x6e70('0xc')]=_0x1b0389[_0x6e70('0xc')]||'';this[_0x6e70('0xd')]=_0x6e70('0xe');this[_0x6e70('0xf')]=0x0;this[_0x6e70('0x10')]=_0x6e70('0xe');this[_0x6e70('0x11')]='';this[_0x6e70('0x12')]='';this['mobile']='';this['interface']='';this[_0x6e70('0x13')]=_0x1b0389[_0x6e70('0x13')]||![];this[_0x6e70('0x14')]=_0x6e70('0xe');this[_0x6e70('0x15')]=0x0;this[_0x6e70('0x16')]='';this[_0x6e70('0x17')]='';this[_0x6e70('0x18')]=![];this['local']=![];this['md5']='';}Agent['prototype'][_0x6e70('0x19')]=function(_0x5a37a6){var _0x53aed0;if(_0x5a37a6&&_0x5a37a6[_0x6e70('0xd')]){_0x53aed0=_0x5a37a6[_0x6e70('0xd')]['toLowerCase']();switch(_0x53aed0){case _0x6e70('0x1a'):_0x53aed0='idle';break;case _0x6e70('0x1b'):_0x53aed0=_0x6e70('0x1c');break;}}if(_0x53aed0&&this['voiceStatus']!==_0x53aed0||_0x5a37a6['statePause']){this[_0x6e70('0x15')]=_['toNumber'](moment()[_0x6e70('0x1d')]('x'));}if(_0x53aed0){this[_0x6e70('0x14')]=_0x53aed0;}var _0x53acdc={'id':this['id'],'name':this['name'],'email':this[_0x6e70('0xa')],'accountcode':this[_0x6e70('0xb')],'fullname':this[_0x6e70('0xc')],'state':this[_0x6e70('0xd')],'stateTime':this[_0x6e70('0xf')],'status':this[_0x6e70('0x10')],'address':this[_0x6e70('0x11')],'online':this[_0x6e70('0x13')],'voiceStatus':this[_0x6e70('0x14')],'voiceStatusTime':this[_0x6e70('0x15')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x6e70('0x17')],'interface':this[_0x6e70('0x1e')],'onhold':this[_0x6e70('0x18')]};var _0x502b2d=md5(JSON[_0x6e70('0x1f')](_0x53acdc));if(this[_0x6e70('0x20')]!==_0x502b2d){this[_0x6e70('0x20')]=_0x502b2d;io['to'](util['format'](_0x6e70('0x21'),_0x53acdc['name']))['emit']('user:save',_0x53acdc);io[_0x6e70('0x22')](_0x6e70('0x23'),_0x53acdc);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index f7db7da..4ebd2d5 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 _0xfc90=['TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','campaign','temp','ivrAnswerCallsDay','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit'];(function(_0x3c5f49,_0x2ca859){var _0xb0b1c6=function(_0x3dea19){while(--_0x3dea19){_0x3c5f49['push'](_0x3c5f49['shift']());}};_0xb0b1c6(++_0x2ca859);}(_0xfc90,0x134));var _0x0fc9=function(_0x83b64d,_0x4e70af){_0x83b64d=_0x83b64d-0x0;var _0x314adf=_0xfc90[_0x83b64d];return _0x314adf;};'use strict';function Campaign(_0x5f4152){this['id']=_0x5f4152['id']||0x0;this[_0x0fc9('0x0')]=_0x5f4152[_0x0fc9('0x0')]||'';this[_0x0fc9('0x1')]=_0x5f4152[_0x0fc9('0x1')]||_0x0fc9('0x2');this['originated']=0x0;this[_0x0fc9('0x3')]=0x0;this[_0x0fc9('0x4')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0x0fc9('0x5')]='';this[_0x0fc9('0x6')]=!![];this[_0x0fc9('0x7')]=_0x5f4152[_0x0fc9('0x7')];this[_0x0fc9('0x8')]=_0x5f4152['limitCalls'];this[_0x0fc9('0x9')]=_0x5f4152[_0x0fc9('0x9')]||null;this[_0x0fc9('0xa')]=_0x5f4152[_0x0fc9('0xa')]?_0x5f4152[_0x0fc9('0xa')]:null;this[_0x0fc9('0xb')]=_0x5f4152['dialOriginateCallerIdName'];this[_0x0fc9('0xc')]=_0x5f4152[_0x0fc9('0xc')];this[_0x0fc9('0xd')]=_0x5f4152[_0x0fc9('0xd')]||0x1e;this[_0x0fc9('0xe')]=_0x5f4152[_0x0fc9('0xe')];this[_0x0fc9('0xf')]=_0x5f4152[_0x0fc9('0xf')];this[_0x0fc9('0x10')]=_0x5f4152['dialBusyMaxRetry'];this[_0x0fc9('0x11')]=_0x5f4152[_0x0fc9('0x11')];this[_0x0fc9('0x12')]=_0x5f4152[_0x0fc9('0x12')];this[_0x0fc9('0x13')]=_0x5f4152['dialNoAnswerRetryFrequency'];this[_0x0fc9('0x14')]=_0x5f4152['dialGlobalMaxRetry'];this[_0x0fc9('0x15')]=_0x5f4152[_0x0fc9('0x15')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x5f4152[_0x0fc9('0x16')]||0x96;this['dialDropMaxRetry']=_0x5f4152[_0x0fc9('0x17')]||0x3;this[_0x0fc9('0x18')]=_0x5f4152[_0x0fc9('0x18')]||0x96;this[_0x0fc9('0x19')]=_0x5f4152['dialAbandonedMaxRetry']||0x3;this[_0x0fc9('0x1a')]=_0x5f4152[_0x0fc9('0x1a')]||0x96;this[_0x0fc9('0x1b')]=_0x5f4152[_0x0fc9('0x1b')]||0x3;this[_0x0fc9('0x1c')]=_0x5f4152[_0x0fc9('0x1c')]||0x96;this[_0x0fc9('0x1d')]=_0x5f4152[_0x0fc9('0x1d')]||0x3;this[_0x0fc9('0x1e')]=_0x5f4152['dialAgentRejectRetryFrequency']||0x96;this[_0x0fc9('0x1f')]=_0x5f4152[_0x0fc9('0x1f')]||'DESC';this['dialPrefix']=_0x5f4152[_0x0fc9('0x20')]||undefined;this[_0x0fc9('0x21')]=_0x5f4152[_0x0fc9('0x21')]||undefined;this[_0x0fc9('0x22')]=_0x5f4152['dialCutDigit']||undefined;this[_0x0fc9('0x23')]=_0x5f4152[_0x0fc9('0x23')]?_0x5f4152[_0x0fc9('0x23')]:undefined;this[_0x0fc9('0x24')]=_0x5f4152[_0x0fc9('0x24')]?_0x5f4152['Trunk']:undefined;this['Interval']=_0x5f4152[_0x0fc9('0x25')]?_0x5f4152['Interval']:undefined;this[_0x0fc9('0x26')]=_0x5f4152['SquareProject']?_0x5f4152[_0x0fc9('0x26')]:undefined;this[_0x0fc9('0x27')]=_0x5f4152[_0x0fc9('0x26')]?_0x5f4152['SquareProject'][_0x0fc9('0x0')]:undefined;this[_0x0fc9('0x28')]=_0x5f4152['dialAMDActive']||![];this[_0x0fc9('0x29')]=_0x5f4152['dialAMDInitialSilence'];this[_0x0fc9('0x2a')]=_0x5f4152[_0x0fc9('0x2a')];this[_0x0fc9('0x2b')]=_0x5f4152['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x5f4152['dialAMDTotalAnalysisTime'];this['dialAMDMinWordLength']=_0x5f4152[_0x0fc9('0x2c')];this[_0x0fc9('0x2d')]=_0x5f4152[_0x0fc9('0x2d')];this[_0x0fc9('0x2e')]=_0x5f4152['dialAMDMaximumNumberOfWords'];this['dialAMDSilenceThreshold']=_0x5f4152[_0x0fc9('0x2f')];this['dialAMDMaximumWordLength']=_0x5f4152[_0x0fc9('0x30')];}module['exports']=Campaign; \ No newline at end of file +var _0xeabb=['dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','campaign','originated','ivrAnswerCallsDay','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeabb,0xbb));var _0xbeab=function(_0x63500b,_0x508aa1){_0x63500b=_0x63500b-0x0;var _0x492332=_0xeabb[_0x63500b];return _0x492332;};'use strict';function Campaign(_0x4c7725){this['id']=_0x4c7725['id']||0x0;this[_0xbeab('0x0')]=_0x4c7725[_0xbeab('0x0')]||'';this['type']=_0x4c7725['type']||_0xbeab('0x1');this[_0xbeab('0x2')]=0x0;this['temp']=0x0;this[_0xbeab('0x3')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0xbeab('0x4')]='';this[_0xbeab('0x5')]=!![];this[_0xbeab('0x6')]=_0x4c7725[_0xbeab('0x6')];this['limitCalls']=_0x4c7725[_0xbeab('0x7')];this[_0xbeab('0x8')]=_0x4c7725[_0xbeab('0x8')]||null;this[_0xbeab('0x9')]=_0x4c7725['dialGlobalInterval']?_0x4c7725[_0xbeab('0x9')]:null;this[_0xbeab('0xa')]=_0x4c7725[_0xbeab('0xa')];this[_0xbeab('0xb')]=_0x4c7725[_0xbeab('0xb')];this[_0xbeab('0xc')]=_0x4c7725['dialOriginateTimeout']||0x1e;this[_0xbeab('0xd')]=_0x4c7725[_0xbeab('0xd')];this[_0xbeab('0xe')]=_0x4c7725[_0xbeab('0xe')];this[_0xbeab('0xf')]=_0x4c7725[_0xbeab('0xf')];this[_0xbeab('0x10')]=_0x4c7725[_0xbeab('0x10')];this['dialNoAnswerMaxRetry']=_0x4c7725[_0xbeab('0x11')];this[_0xbeab('0x12')]=_0x4c7725['dialNoAnswerRetryFrequency'];this[_0xbeab('0x13')]=_0x4c7725[_0xbeab('0x13')];this[_0xbeab('0x14')]=_0x4c7725[_0xbeab('0x14')]||0x3;this[_0xbeab('0x15')]=_0x4c7725[_0xbeab('0x15')]||0x96;this['dialDropMaxRetry']=_0x4c7725[_0xbeab('0x16')]||0x3;this[_0xbeab('0x17')]=_0x4c7725['dialDropRetryFrequency']||0x96;this[_0xbeab('0x18')]=_0x4c7725[_0xbeab('0x18')]||0x3;this[_0xbeab('0x19')]=_0x4c7725[_0xbeab('0x19')]||0x96;this[_0xbeab('0x1a')]=_0x4c7725['dialMachineMaxRetry']||0x3;this[_0xbeab('0x1b')]=_0x4c7725[_0xbeab('0x1b')]||0x96;this[_0xbeab('0x1c')]=_0x4c7725[_0xbeab('0x1c')]||0x3;this[_0xbeab('0x1d')]=_0x4c7725[_0xbeab('0x1d')]||0x96;this['dialOrderByScheduledAt']=_0x4c7725[_0xbeab('0x1e')]||_0xbeab('0x1f');this[_0xbeab('0x20')]=_0x4c7725[_0xbeab('0x20')]||undefined;this[_0xbeab('0x21')]=_0x4c7725['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xbeab('0x22')]=_0x4c7725[_0xbeab('0x22')]||undefined;this[_0xbeab('0x23')]=_0x4c7725['TrunkBackup']?_0x4c7725[_0xbeab('0x23')]:undefined;this[_0xbeab('0x24')]=_0x4c7725[_0xbeab('0x24')]?_0x4c7725['Trunk']:undefined;this['Interval']=_0x4c7725[_0xbeab('0x25')]?_0x4c7725[_0xbeab('0x25')]:undefined;this[_0xbeab('0x26')]=_0x4c7725[_0xbeab('0x26')]?_0x4c7725['SquareProject']:undefined;this[_0xbeab('0x27')]=_0x4c7725[_0xbeab('0x26')]?_0x4c7725[_0xbeab('0x26')]['name']:undefined;this[_0xbeab('0x28')]=_0x4c7725[_0xbeab('0x28')]||![];this[_0xbeab('0x29')]=_0x4c7725['dialAMDInitialSilence'];this[_0xbeab('0x2a')]=_0x4c7725[_0xbeab('0x2a')];this[_0xbeab('0x2b')]=_0x4c7725[_0xbeab('0x2b')];this['dialAMDTotalAnalysisTime']=_0x4c7725[_0xbeab('0x2c')];this['dialAMDMinWordLength']=_0x4c7725[_0xbeab('0x2d')];this[_0xbeab('0x2e')]=_0x4c7725[_0xbeab('0x2e')];this[_0xbeab('0x2f')]=_0x4c7725[_0xbeab('0x2f')];this['dialAMDSilenceThreshold']=_0x4c7725[_0xbeab('0x30')];this[_0xbeab('0x31')]=_0x4c7725[_0xbeab('0x31')];}module[_0xbeab('0x32')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 5d8c021..8044e79 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 _0x5a13=['abandoned','lastapplication','lastdata','billableseconds','holdtime','type','tag','disposition','monitor','monitorFilename','queue','monitors','transferconnectedlinenum','transferType','mohtime','exports','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','context','linkedid','endtime','unmanaged'];(function(_0x352ccd,_0x4e8451){var _0x2ea719=function(_0x3e6daf){while(--_0x3e6daf){_0x352ccd['push'](_0x352ccd['shift']());}};_0x2ea719(++_0x4e8451);}(_0x5a13,0x92));var _0x35a1=function(_0x1f600e,_0x4ca2bf){_0x1f600e=_0x1f600e-0x0;var _0x1d88b1=_0x5a13[_0x1f600e];return _0x1d88b1;};'use strict';function Channel(){this['starttime']=null;this[_0x35a1('0x0')]='';this[_0x35a1('0x1')]='';this[_0x35a1('0x2')]=0x0;this[_0x35a1('0x3')]='';this[_0x35a1('0x4')]=undefined;this[_0x35a1('0x5')]=undefined;this['accountcode']=0x0;this[_0x35a1('0x6')]='';this['uniqueid']=0x0;this[_0x35a1('0x7')]=0x0;this['exten']=0x0;this['answered']=![];this['answertime']=null;this[_0x35a1('0x8')]=null;this[_0x35a1('0x9')]=![];this[_0x35a1('0xa')]=![];this[_0x35a1('0xb')]='';this[_0x35a1('0xc')]='';this['duration']=0x0;this[_0x35a1('0xd')]=0x0;this[_0x35a1('0xe')]=0x0;this[_0x35a1('0xf')]=null;this[_0x35a1('0x10')]=null;this[_0x35a1('0x11')]=null;this[_0x35a1('0x12')]=![];this[_0x35a1('0x13')]=null;this[_0x35a1('0x14')]=null;this[_0x35a1('0x15')]=[];this['transfercalleridnum']=undefined;this[_0x35a1('0x16')]=undefined;this[_0x35a1('0x17')]=undefined;this[_0x35a1('0x18')]=0x0;}module[_0x35a1('0x19')]=Channel; \ No newline at end of file +var _0x02ce=['monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','destinationchannel','calleridname','connectedlinename','accountcode','context','uniqueid','linkedid','exten','answered','answertime','endtime','lastapplication','lastdata','duration','billableseconds','holdtime','type','tag','disposition','monitor'];(function(_0x15ba4b,_0x54147b){var _0x48cbf0=function(_0x5cec00){while(--_0x5cec00){_0x15ba4b['push'](_0x15ba4b['shift']());}};_0x48cbf0(++_0x54147b);}(_0x02ce,0x1ac));var _0xe02c=function(_0x2225d6,_0x33c654){_0x2225d6=_0x2225d6-0x0;var _0x2d5b20=_0x02ce[_0x2225d6];return _0x2d5b20;};'use strict';function Channel(){this[_0xe02c('0x0')]=null;this[_0xe02c('0x1')]='';this[_0xe02c('0x2')]='';this['calleridnum']=0x0;this[_0xe02c('0x3')]='';this['connectedlinenum']=undefined;this[_0xe02c('0x4')]=undefined;this[_0xe02c('0x5')]=0x0;this[_0xe02c('0x6')]='';this[_0xe02c('0x7')]=0x0;this[_0xe02c('0x8')]=0x0;this[_0xe02c('0x9')]=0x0;this[_0xe02c('0xa')]=![];this[_0xe02c('0xb')]=null;this[_0xe02c('0xc')]=null;this['unmanaged']=![];this['abandoned']=![];this[_0xe02c('0xd')]='';this[_0xe02c('0xe')]='';this[_0xe02c('0xf')]=0x0;this[_0xe02c('0x10')]=0x0;this[_0xe02c('0x11')]=0x0;this[_0xe02c('0x12')]=null;this[_0xe02c('0x13')]=null;this[_0xe02c('0x14')]=null;this[_0xe02c('0x15')]=![];this[_0xe02c('0x16')]=null;this[_0xe02c('0x17')]=null;this[_0xe02c('0x18')]=[];this[_0xe02c('0x19')]=undefined;this[_0xe02c('0x1a')]=undefined;this[_0xe02c('0x1b')]=undefined;this[_0xe02c('0x1c')]=0x0;}module[_0xe02c('0x1d')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index b17332b..a8ae4a8 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 _0x7bc8=['type','serverUrl','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret'];(function(_0x4a0f16,_0x21ba18){var _0x45d653=function(_0x137e2c){while(--_0x137e2c){_0x4a0f16['push'](_0x4a0f16['shift']());}};_0x45d653(++_0x21ba18);}(_0x7bc8,0x1cb));var _0x87bc=function(_0x371ad5,_0x18a448){_0x371ad5=_0x371ad5-0x0;var _0x5d201c=_0x7bc8[_0x371ad5];return _0x5d201c;};'use strict';function DeskAccount(_0x33ede2){this['id']=_0x33ede2['id']||0x0;this['name']=_0x33ede2[_0x87bc('0x0')]||'';this[_0x87bc('0x1')]=_0x33ede2[_0x87bc('0x1')]||'';this[_0x87bc('0x2')]=_0x33ede2['remoteUri']||'';this['authType']=_0x33ede2[_0x87bc('0x3')]||'';this[_0x87bc('0x4')]=_0x33ede2[_0x87bc('0x4')]||'';this[_0x87bc('0x5')]=_0x33ede2[_0x87bc('0x5')]||'';this[_0x87bc('0x6')]=_0x33ede2[_0x87bc('0x6')]||'';this[_0x87bc('0x7')]=_0x33ede2[_0x87bc('0x7')]||'';this[_0x87bc('0x8')]=_0x33ede2['tokenSecret']||'';this[_0x87bc('0x9')]=_0x33ede2[_0x87bc('0x9')]||'';this[_0x87bc('0xa')]=_0x33ede2[_0x87bc('0xa')]||'';this['Configurations']=_0x33ede2['Configurations']||{};}module[_0x87bc('0xb')]=DeskAccount; \ No newline at end of file +var _0x3f04=['serverUrl','Configurations','exports','name','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3f04,0x1d7));var _0x43f0=function(_0x111076,_0x5606e3){_0x111076=_0x111076-0x0;var _0x25b218=_0x3f04[_0x111076];return _0x25b218;};'use strict';function DeskAccount(_0x5e1f1b){this['id']=_0x5e1f1b['id']||0x0;this[_0x43f0('0x0')]=_0x5e1f1b[_0x43f0('0x0')]||'';this['username']=_0x5e1f1b['username']||'';this[_0x43f0('0x1')]=_0x5e1f1b[_0x43f0('0x1')]||'';this['authType']=_0x5e1f1b[_0x43f0('0x2')]||'';this[_0x43f0('0x3')]=_0x5e1f1b[_0x43f0('0x3')]||'';this[_0x43f0('0x4')]=_0x5e1f1b[_0x43f0('0x4')]||'';this[_0x43f0('0x5')]=_0x5e1f1b[_0x43f0('0x5')]||'';this[_0x43f0('0x6')]=_0x5e1f1b['token']||'';this[_0x43f0('0x7')]=_0x5e1f1b['tokenSecret']||'';this[_0x43f0('0x8')]=_0x5e1f1b[_0x43f0('0x8')]||'';this[_0x43f0('0x9')]=_0x5e1f1b[_0x43f0('0x9')]||'';this[_0x43f0('0xa')]=_0x5e1f1b[_0x43f0('0xa')]||{};}module[_0x43f0('0xb')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 865aca5..86599f6 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 _0x878f=['serverUrl','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret'];(function(_0x5a404f,_0x47d213){var _0x544c05=function(_0x433ac9){while(--_0x433ac9){_0x5a404f['push'](_0x5a404f['shift']());}};_0x544c05(++_0x47d213);}(_0x878f,0x173));var _0xf878=function(_0x490c24,_0x392794){_0x490c24=_0x490c24-0x0;var _0x51e25b=_0x878f[_0x490c24];return _0x51e25b;};'use strict';function Dynamics365Account(_0x51758f){this['id']=_0x51758f['id']||0x0;this[_0xf878('0x0')]=_0x51758f[_0xf878('0x0')]||'';this[_0xf878('0x1')]=_0x51758f[_0xf878('0x1')]||'';this[_0xf878('0x2')]=_0x51758f[_0xf878('0x2')]||'';this[_0xf878('0x3')]=_0x51758f[_0xf878('0x3')]||'';this[_0xf878('0x4')]=_0x51758f[_0xf878('0x4')]||'';this[_0xf878('0x5')]=_0x51758f['clientId']||'';this['clientSecret']=_0x51758f[_0xf878('0x6')]||{};this[_0xf878('0x7')]=_0x51758f['serverUrl']||'';this['Configurations']=_0x51758f['Configurations']||{};}module[_0xf878('0x8')]=Dynamics365Account; \ No newline at end of file +var _0x9ffd=['name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations','exports'];(function(_0x4a006b,_0x3acaec){var _0x39a775=function(_0x9436e9){while(--_0x9436e9){_0x4a006b['push'](_0x4a006b['shift']());}};_0x39a775(++_0x3acaec);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x259ad0,_0x58a797){_0x259ad0=_0x259ad0-0x0;var _0x32e5d1=_0x9ffd[_0x259ad0];return _0x32e5d1;};'use strict';function Dynamics365Account(_0x4c26a1){this['id']=_0x4c26a1['id']||0x0;this[_0xd9ff('0x0')]=_0x4c26a1[_0xd9ff('0x0')]||'';this['username']=_0x4c26a1[_0xd9ff('0x1')]||'';this[_0xd9ff('0x2')]=_0x4c26a1[_0xd9ff('0x2')]||'';this[_0xd9ff('0x3')]=_0x4c26a1['remoteUri']||'';this[_0xd9ff('0x4')]=_0x4c26a1[_0xd9ff('0x4')]||'';this['clientId']=_0x4c26a1[_0xd9ff('0x5')]||'';this[_0xd9ff('0x6')]=_0x4c26a1[_0xd9ff('0x6')]||{};this[_0xd9ff('0x7')]=_0x4c26a1[_0xd9ff('0x7')]||'';this[_0xd9ff('0x8')]=_0x4c26a1[_0xd9ff('0x8')]||{};}module[_0xd9ff('0x9')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 28177e4..5abc3ed 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 _0x8efb=['faxdetect','t38timeout','Trunk','ListId','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x8efb,0x154));var _0xb8ef=function(_0x4cbcb8,_0x2365eb){_0x4cbcb8=_0x4cbcb8-0x0;var _0x38b554=_0x8efb[_0x4cbcb8];return _0x38b554;};'use strict';function FaxAccount(_0x1fb75e){this['id']=_0x1fb75e['id']||0x0;this[_0xb8ef('0x0')]=_0x1fb75e[_0xb8ef('0x0')]||'';this[_0xb8ef('0x1')]=_0x1fb75e[_0xb8ef('0x1')];this['ecm']=_0x1fb75e[_0xb8ef('0x2')];this['headerinfo']=_0x1fb75e[_0xb8ef('0x3')];this[_0xb8ef('0x4')]=_0x1fb75e[_0xb8ef('0x4')];this[_0xb8ef('0x5')]=_0x1fb75e[_0xb8ef('0x5')]||0x960;this[_0xb8ef('0x6')]=_0x1fb75e[_0xb8ef('0x6')]||0x3840;this[_0xb8ef('0x7')]=_0x1fb75e[_0xb8ef('0x7')]||'v17,v27,v29';this['gateway']=_0x1fb75e['gateway']||'no';this[_0xb8ef('0x8')]=_0x1fb75e['faxdetect']||'no';this[_0xb8ef('0x9')]=_0x1fb75e[_0xb8ef('0x9')]||0x1388;this['tech']=_0x1fb75e['tech']||'SIP';this[_0xb8ef('0xa')]=_0x1fb75e[_0xb8ef('0xa')]?_0x1fb75e[_0xb8ef('0xa')]:undefined;this[_0xb8ef('0xb')]=_0x1fb75e['ListId'];this['key']=_0x1fb75e['key'];}module['exports']=FaxAccount; \ No newline at end of file +var _0x1bd0=['localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','Trunk','ListId','key','exports','name','description','ecm','headerinfo'];(function(_0x373dee,_0x1a8c45){var _0x46798f=function(_0xc389f0){while(--_0xc389f0){_0x373dee['push'](_0x373dee['shift']());}};_0x46798f(++_0x1a8c45);}(_0x1bd0,0x1d8));var _0x01bd=function(_0x1c7b72,_0x4e340a){_0x1c7b72=_0x1c7b72-0x0;var _0x16e645=_0x1bd0[_0x1c7b72];return _0x16e645;};'use strict';function FaxAccount(_0x323c62){this['id']=_0x323c62['id']||0x0;this[_0x01bd('0x0')]=_0x323c62[_0x01bd('0x0')]||'';this[_0x01bd('0x1')]=_0x323c62[_0x01bd('0x1')];this[_0x01bd('0x2')]=_0x323c62[_0x01bd('0x2')];this[_0x01bd('0x3')]=_0x323c62['headerinfo'];this[_0x01bd('0x4')]=_0x323c62[_0x01bd('0x4')];this[_0x01bd('0x5')]=_0x323c62[_0x01bd('0x5')]||0x960;this[_0x01bd('0x6')]=_0x323c62['maxrate']||0x3840;this[_0x01bd('0x7')]=_0x323c62['modem']||_0x01bd('0x8');this[_0x01bd('0x9')]=_0x323c62[_0x01bd('0x9')]||'no';this[_0x01bd('0xa')]=_0x323c62[_0x01bd('0xa')]||'no';this[_0x01bd('0xb')]=_0x323c62[_0x01bd('0xb')]||0x1388;this[_0x01bd('0xc')]=_0x323c62[_0x01bd('0xc')]||'SIP';this[_0x01bd('0xd')]=_0x323c62[_0x01bd('0xd')]?_0x323c62['Trunk']:undefined;this[_0x01bd('0xe')]=_0x323c62[_0x01bd('0xe')];this[_0x01bd('0xf')]=_0x323c62[_0x01bd('0xf')];}module[_0x01bd('0x10')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 7b97ef9..ca38c67 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 _0x0a8c=['username','token','remoteUri','serverUrl','Configurations','exports'];(function(_0x245d76,_0x1c2c6f){var _0x4516f7=function(_0x5e7c49){while(--_0x5e7c49){_0x245d76['push'](_0x245d76['shift']());}};_0x4516f7(++_0x1c2c6f);}(_0x0a8c,0x78));var _0xc0a8=function(_0x23de01,_0x4954da){_0x23de01=_0x23de01-0x0;var _0x126399=_0x0a8c[_0x23de01];return _0x126399;};'use strict';function FreshdeskAccount(_0x1e6704){this['id']=_0x1e6704['id']||0x0;this['name']=_0x1e6704['name']||'';this['username']=_0x1e6704[_0xc0a8('0x0')]||'';this['apiKey']=_0x1e6704[_0xc0a8('0x1')]||'';this[_0xc0a8('0x2')]=_0x1e6704[_0xc0a8('0x2')]||'';this[_0xc0a8('0x3')]=_0x1e6704[_0xc0a8('0x3')]||'';this[_0xc0a8('0x4')]=_0x1e6704['Configurations']||{};}module[_0xc0a8('0x5')]=FreshdeskAccount; \ No newline at end of file +var _0xf069=['name','username','apiKey','token','remoteUri','serverUrl','Configurations'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0xf069,0x77));var _0x9f06=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf069[_0x14add3];return _0x4a174f;};'use strict';function FreshdeskAccount(_0x3cb9c1){this['id']=_0x3cb9c1['id']||0x0;this[_0x9f06('0x0')]=_0x3cb9c1[_0x9f06('0x0')]||'';this[_0x9f06('0x1')]=_0x3cb9c1[_0x9f06('0x1')]||'';this[_0x9f06('0x2')]=_0x3cb9c1[_0x9f06('0x3')]||'';this['remoteUri']=_0x3cb9c1[_0x9f06('0x4')]||'';this['serverUrl']=_0x3cb9c1[_0x9f06('0x5')]||'';this[_0x9f06('0x6')]=_0x3cb9c1['Configurations']||{};}module['exports']=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index e764ebb..9b18397 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 _0xdefc=['serverUrl','Configurations','exports','name','apiKey','remoteUri'];(function(_0x5dbdef,_0x24ae1d){var _0xe97d42=function(_0x56631c){while(--_0x56631c){_0x5dbdef['push'](_0x5dbdef['shift']());}};_0xe97d42(++_0x24ae1d);}(_0xdefc,0x1b3));var _0xcdef=function(_0x5cc71f,_0x4f6f52){_0x5cc71f=_0x5cc71f-0x0;var _0x4e1b52=_0xdefc[_0x5cc71f];return _0x4e1b52;};'use strict';function FreshsalesAccount(_0x1a2db3){this['id']=_0x1a2db3['id']||0x0;this[_0xcdef('0x0')]=_0x1a2db3[_0xcdef('0x0')]||'';this['username']=_0x1a2db3['username']||'';this[_0xcdef('0x1')]=_0x1a2db3['token']||'';this[_0xcdef('0x2')]=_0x1a2db3[_0xcdef('0x2')]||'';this[_0xcdef('0x3')]=_0x1a2db3[_0xcdef('0x3')]||'';this[_0xcdef('0x4')]=_0x1a2db3[_0xcdef('0x4')]||{};}module[_0xcdef('0x5')]=FreshsalesAccount; \ No newline at end of file +var _0xbeff=['Configurations','exports','name','username','apiKey','remoteUri','serverUrl'];(function(_0x590f55,_0x314c3b){var _0x14142f=function(_0x543482){while(--_0x543482){_0x590f55['push'](_0x590f55['shift']());}};_0x14142f(++_0x314c3b);}(_0xbeff,0x8e));var _0xfbef=function(_0x3863d3,_0x1bd991){_0x3863d3=_0x3863d3-0x0;var _0x4861cb=_0xbeff[_0x3863d3];return _0x4861cb;};'use strict';function FreshsalesAccount(_0x4c3934){this['id']=_0x4c3934['id']||0x0;this[_0xfbef('0x0')]=_0x4c3934[_0xfbef('0x0')]||'';this[_0xfbef('0x1')]=_0x4c3934[_0xfbef('0x1')]||'';this[_0xfbef('0x2')]=_0x4c3934['token']||'';this['remoteUri']=_0x4c3934[_0xfbef('0x3')]||'';this[_0xfbef('0x4')]=_0x4c3934[_0xfbef('0x4')]||'';this[_0xfbef('0x5')]=_0x4c3934['Configurations']||{};}module[_0xfbef('0x6')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index a536128..a904168 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 _0x97a9=['count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','priority','holdtime','assigned','lastAssignedTo','voice','mohtime','variables','exports','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position'];(function(_0x1ed927,_0x8daaa3){var _0x49b220=function(_0x35d7e8){while(--_0x35d7e8){_0x1ed927['push'](_0x1ed927['shift']());}};_0x49b220(++_0x8daaa3);}(_0x97a9,0x7f));var _0x997a=function(_0x40c191,_0x144acf){_0x40c191=_0x40c191-0x0;var _0x53edb6=_0x97a9[_0x40c191];return _0x53edb6;};'use strict';function QueueReport(){this[_0x997a('0x0')]='inbound';this[_0x997a('0x1')]='';this[_0x997a('0x2')]='';this[_0x997a('0x3')]='';this[_0x997a('0x4')]='';this[_0x997a('0x5')]=null;this[_0x997a('0x6')]=null;this[_0x997a('0x7')]=0x1;this[_0x997a('0x8')]=0x1;this[_0x997a('0x9')]=![];this[_0x997a('0xa')]=null;this[_0x997a('0xb')]=![];this[_0x997a('0xc')]=null;this[_0x997a('0xd')]=![];this[_0x997a('0xe')]=null;this[_0x997a('0xf')]=0x1;this[_0x997a('0x10')]='';this[_0x997a('0x11')]='';this[_0x997a('0x12')]='';this['accountcode']='';this['context']='';this['exten']='';this[_0x997a('0x13')]='';this[_0x997a('0x14')]=0x0;this[_0x997a('0x15')]=![];this[_0x997a('0x16')]='';this['motionChannel']=_0x997a('0x17');this[_0x997a('0x18')]=0x0;this[_0x997a('0x19')]={};}module[_0x997a('0x1a')]=QueueReport; \ No newline at end of file +var _0xa4e2=['uniqueid','calleridnum','queue','queuecallerjoinAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','connectedlinename','accountcode','context','priority','holdtime','assigned','motionChannel','voice','mohtime','variables','exports','type'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0xa4e2,0x107));var _0x2a4e=function(_0x1cd6c2,_0x5c1747){_0x1cd6c2=_0x1cd6c2-0x0;var _0x119f22=_0xa4e2[_0x1cd6c2];return _0x119f22;};'use strict';function QueueReport(){this[_0x2a4e('0x0')]='inbound';this[_0x2a4e('0x1')]='';this[_0x2a4e('0x2')]='';this['calleridname']='';this[_0x2a4e('0x3')]='';this[_0x2a4e('0x4')]=null;this['queuecallerleaveAt']=null;this[_0x2a4e('0x5')]=0x1;this[_0x2a4e('0x6')]=0x1;this[_0x2a4e('0x7')]=![];this[_0x2a4e('0x8')]=null;this[_0x2a4e('0x9')]=![];this[_0x2a4e('0xa')]=null;this[_0x2a4e('0xb')]=![];this[_0x2a4e('0xc')]=null;this['originalposition']=0x1;this['channel']='';this['connectedlinenum']='';this[_0x2a4e('0xd')]='';this[_0x2a4e('0xe')]='';this[_0x2a4e('0xf')]='';this['exten']='';this[_0x2a4e('0x10')]='';this[_0x2a4e('0x11')]=0x0;this[_0x2a4e('0x12')]=![];this['lastAssignedTo']='';this[_0x2a4e('0x13')]=_0x2a4e('0x14');this[_0x2a4e('0x15')]=0x0;this[_0x2a4e('0x16')]={};}module[_0x2a4e('0x17')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 3ea0b6f..5eca0a6 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 _0xfdf2=['serverUrl','Configurations','exports','name','username','remoteUri','password','clientSecret','securityToken','type'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xfdf2,0xf3));var _0x2fdf=function(_0x5dfd46,_0x152dfc){_0x5dfd46=_0x5dfd46-0x0;var _0x1b5e8a=_0xfdf2[_0x5dfd46];return _0x1b5e8a;};'use strict';function SalesforceAccount(_0x1242f1){this['id']=_0x1242f1['id']||0x0;this[_0x2fdf('0x0')]=_0x1242f1[_0x2fdf('0x0')]||'';this[_0x2fdf('0x1')]=_0x1242f1[_0x2fdf('0x1')]||'';this[_0x2fdf('0x2')]=_0x1242f1['remoteUri']||'';this[_0x2fdf('0x3')]=_0x1242f1['password']||'';this['clientId']=_0x1242f1['clientId']||'';this[_0x2fdf('0x4')]=_0x1242f1[_0x2fdf('0x4')]||'';this[_0x2fdf('0x5')]=_0x1242f1['securityToken']||'';this[_0x2fdf('0x6')]=_0x1242f1[_0x2fdf('0x6')]||'integrationTab';this[_0x2fdf('0x7')]=_0x1242f1[_0x2fdf('0x7')]||'';this[_0x2fdf('0x8')]=_0x1242f1[_0x2fdf('0x8')]||{};}module[_0x2fdf('0x9')]=SalesforceAccount; \ No newline at end of file +var _0x8291=['Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','type','integrationTab','serverUrl'];(function(_0x416ad,_0x3797e5){var _0x160983=function(_0x1aa782){while(--_0x1aa782){_0x416ad['push'](_0x416ad['shift']());}};_0x160983(++_0x3797e5);}(_0x8291,0x1af));var _0x1829=function(_0x513194,_0x2f763b){_0x513194=_0x513194-0x0;var _0x33dffa=_0x8291[_0x513194];return _0x33dffa;};'use strict';function SalesforceAccount(_0x7c819e){this['id']=_0x7c819e['id']||0x0;this[_0x1829('0x0')]=_0x7c819e['name']||'';this['username']=_0x7c819e[_0x1829('0x1')]||'';this[_0x1829('0x2')]=_0x7c819e['remoteUri']||'';this['password']=_0x7c819e[_0x1829('0x3')]||'';this[_0x1829('0x4')]=_0x7c819e[_0x1829('0x4')]||'';this[_0x1829('0x5')]=_0x7c819e[_0x1829('0x5')]||'';this['securityToken']=_0x7c819e['securityToken']||'';this[_0x1829('0x6')]=_0x7c819e[_0x1829('0x6')]||_0x1829('0x7');this['serverUrl']=_0x7c819e[_0x1829('0x8')]||'';this[_0x1829('0x9')]=_0x7c819e['Configurations']||{};}module[_0x1829('0xa')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 5f8e4b1..30dc185 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 _0x77ec=['serverUrl','Configurations','name','username','password'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x77ec,0x1c4));var _0xc77e=function(_0x4e8f0b,_0x149bca){_0x4e8f0b=_0x4e8f0b-0x0;var _0x159a78=_0x77ec[_0x4e8f0b];return _0x159a78;};'use strict';function ServicenowAccount(_0x3f9890){this['id']=_0x3f9890['id']||0x0;this[_0xc77e('0x0')]=_0x3f9890[_0xc77e('0x0')]||'';this['username']=_0x3f9890[_0xc77e('0x1')]||'';this[_0xc77e('0x2')]=_0x3f9890[_0xc77e('0x2')]||'';this['remoteUri']=_0x3f9890['remoteUri']||'';this[_0xc77e('0x3')]=_0x3f9890[_0xc77e('0x3')]||'';this['Configurations']=_0x3f9890[_0xc77e('0x4')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0xb964=['remoteUri','Configurations','name','password'];(function(_0x17bb21,_0x369098){var _0x2956a6=function(_0x3e5ecf){while(--_0x3e5ecf){_0x17bb21['push'](_0x17bb21['shift']());}};_0x2956a6(++_0x369098);}(_0xb964,0x92));var _0x4b96=function(_0x5b419d,_0x5defda){_0x5b419d=_0x5b419d-0x0;var _0x46f451=_0xb964[_0x5b419d];return _0x46f451;};'use strict';function ServicenowAccount(_0x4223a3){this['id']=_0x4223a3['id']||0x0;this[_0x4b96('0x0')]=_0x4223a3[_0x4b96('0x0')]||'';this['username']=_0x4223a3['username']||'';this[_0x4b96('0x1')]=_0x4223a3[_0x4b96('0x1')]||'';this[_0x4b96('0x2')]=_0x4223a3[_0x4b96('0x2')]||'';this['serverUrl']=_0x4223a3['serverUrl']||'';this[_0x4b96('0x3')]=_0x4223a3[_0x4b96('0x3')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index d8c40ca..447e26a 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 _0x6176=['username','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6176,0x1c1));var _0x6617=function(_0x313f95,_0x332997){_0x313f95=_0x313f95-0x0;var _0x11941b=_0x6176[_0x313f95];return _0x11941b;};'use strict';function SugarcrmAccount(_0x1634a7){this['id']=_0x1634a7['id']||0x0;this[_0x6617('0x0')]=_0x1634a7[_0x6617('0x0')]||'';this[_0x6617('0x1')]=_0x1634a7['username']||'';this['password']=_0x1634a7['password']||'';this[_0x6617('0x2')]=_0x1634a7[_0x6617('0x2')]||'';this[_0x6617('0x3')]=_0x1634a7[_0x6617('0x3')]||'';this[_0x6617('0x4')]=_0x1634a7['Configurations']||{};}module[_0x6617('0x5')]=SugarcrmAccount; \ No newline at end of file +var _0x6293=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0xa462ee,_0x40d37f){var _0x526b06=function(_0x24250a){while(--_0x24250a){_0xa462ee['push'](_0xa462ee['shift']());}};_0x526b06(++_0x40d37f);}(_0x6293,0x64));var _0x3629=function(_0x1c1259,_0x2db8ee){_0x1c1259=_0x1c1259-0x0;var _0x1dab5c=_0x6293[_0x1c1259];return _0x1dab5c;};'use strict';function SugarcrmAccount(_0x1ca9a2){this['id']=_0x1ca9a2['id']||0x0;this[_0x3629('0x0')]=_0x1ca9a2[_0x3629('0x0')]||'';this[_0x3629('0x1')]=_0x1ca9a2[_0x3629('0x1')]||'';this[_0x3629('0x2')]=_0x1ca9a2[_0x3629('0x2')]||'';this[_0x3629('0x3')]=_0x1ca9a2[_0x3629('0x3')]||'';this[_0x3629('0x4')]=_0x1ca9a2[_0x3629('0x4')]||'';this[_0x3629('0x5')]=_0x1ca9a2[_0x3629('0x5')]||{};}module[_0x3629('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 1868eb9..631e269 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 _0x92a2=['status','exports','name','accountcode','state','stateTime'];(function(_0x4f55e9,_0x59cd9a){var _0x6f2d06=function(_0x1d2b22){while(--_0x1d2b22){_0x4f55e9['push'](_0x4f55e9['shift']());}};_0x6f2d06(++_0x59cd9a);}(_0x92a2,0x1ee));var _0x292a=function(_0x1a1195,_0x2b1b09){_0x1a1195=_0x1a1195-0x0;var _0x5eb4da=_0x92a2[_0x1a1195];return _0x5eb4da;};'use strict';function Telephone(_0x54b3f6){this['id']=_0x54b3f6['id']||0x0;this[_0x292a('0x0')]=_0x54b3f6[_0x292a('0x0')]||'';this[_0x292a('0x1')]=_0x54b3f6['accountcode']||'';this[_0x292a('0x2')]='unknown';this[_0x292a('0x3')]=0x0;this[_0x292a('0x4')]='unknown';this['address']='';}module[_0x292a('0x5')]=Telephone; \ No newline at end of file +var _0xf3aa=['unknown','address','exports','name','accountcode','state','status'];(function(_0x514030,_0x45aa55){var _0x5aab41=function(_0x4c255d){while(--_0x4c255d){_0x514030['push'](_0x514030['shift']());}};_0x5aab41(++_0x45aa55);}(_0xf3aa,0xf1));var _0xaf3a=function(_0x28a8c2,_0x494d5){_0x28a8c2=_0x28a8c2-0x0;var _0x37ac3c=_0xf3aa[_0x28a8c2];return _0x37ac3c;};'use strict';function Telephone(_0x41feef){this['id']=_0x41feef['id']||0x0;this[_0xaf3a('0x0')]=_0x41feef[_0xaf3a('0x0')]||'';this[_0xaf3a('0x1')]=_0x41feef['accountcode']||'';this[_0xaf3a('0x2')]='unknown';this['stateTime']=0x0;this[_0xaf3a('0x3')]=_0xaf3a('0x4');this[_0xaf3a('0x5')]='';}module[_0xaf3a('0x6')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index be6c3c3..8cd8dcb 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['exports','name'];(function(_0x56ca67,_0x58c910){var _0x4d5270=function(_0x5c1342){while(--_0x5c1342){_0x56ca67['push'](_0x56ca67['shift']());}};_0x4d5270(++_0x58c910);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x1a3e8f,_0x542bb8){var _0x32084b=function(_0xfc91d7){while(--_0xfc91d7){_0x1a3e8f['push'](_0x1a3e8f['shift']());}};_0x32084b(++_0x542bb8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 355f1d3..39a5be0 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 _0xb10b=['AllConditions','AnyConditions','Actions','exports','name','channel','status'];(function(_0x536d41,_0x24114b){var _0x2f20f0=function(_0xb58c2){while(--_0xb58c2){_0x536d41['push'](_0x536d41['shift']());}};_0x2f20f0(++_0x24114b);}(_0xb10b,0x12a));var _0xbb10=function(_0x5a8611,_0x515fba){_0x5a8611=_0x5a8611-0x0;var _0x325dcf=_0xb10b[_0x5a8611];return _0x325dcf;};'use strict';function Trigger(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'voice';this[_0xbb10('0x2')]=_0x13ce8d[_0xbb10('0x2')]||![];this[_0xbb10('0x3')]=_0x13ce8d[_0xbb10('0x3')]||[];this[_0xbb10('0x4')]=_0x13ce8d[_0xbb10('0x4')]||[];this['Actions']=_0x13ce8d[_0xbb10('0x5')]||[];}module[_0xbb10('0x6')]=Trigger; \ No newline at end of file +var _0x757a=['name','status','AllConditions','AnyConditions','Actions','exports'];(function(_0x2a0f10,_0x505475){var _0x20befe=function(_0x10fd2f){while(--_0x10fd2f){_0x2a0f10['push'](_0x2a0f10['shift']());}};_0x20befe(++_0x505475);}(_0x757a,0xde));var _0xa757=function(_0x2c620e,_0x444aca){_0x2c620e=_0x2c620e-0x0;var _0x36f354=_0x757a[_0x2c620e];return _0x36f354;};'use strict';function Trigger(_0x1acf7d){this['id']=_0x1acf7d['id']||0x0;this[_0xa757('0x0')]=_0x1acf7d[_0xa757('0x0')]||'';this['channel']=_0x1acf7d['channel']||'voice';this[_0xa757('0x1')]=_0x1acf7d[_0xa757('0x1')]||![];this[_0xa757('0x2')]=_0x1acf7d[_0xa757('0x2')]||[];this[_0xa757('0x3')]=_0x1acf7d[_0xa757('0x3')]||[];this['Actions']=_0x1acf7d[_0xa757('0x4')]||[];}module[_0xa757('0x5')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 80f0a1c..2623c2b 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 _0xb75e=['unknown','stateTime','status','registry','indexOf','split','host','port','domain','domainport','refresh','defaultuser','active','name','state'];(function(_0xda18e5,_0x8ba7a5){var _0x2ed6de=function(_0x56c74e){while(--_0x56c74e){_0xda18e5['push'](_0xda18e5['shift']());}};_0x2ed6de(++_0x8ba7a5);}(_0xb75e,0x165));var _0xeb75=function(_0x33f027,_0x102ffe){_0x33f027=_0x33f027-0x0;var _0x472402=_0xb75e[_0x33f027];return _0x472402;};'use strict';function Trunk(_0x52ac79){this['id']=_0x52ac79['id']||0x0;this['active']=_0x52ac79[_0xeb75('0x0')]||![];this[_0xeb75('0x1')]=_0x52ac79[_0xeb75('0x1')]||'';this[_0xeb75('0x2')]=_0xeb75('0x3');this[_0xeb75('0x4')]=0x0;this[_0xeb75('0x5')]=_0xeb75('0x3');this[_0xeb75('0x6')]=_0x52ac79[_0xeb75('0x6')]&&_0x52ac79[_0xeb75('0x6')][_0xeb75('0x7')](':')?_0x52ac79[_0xeb75('0x6')][_0xeb75('0x8')](':')[0x0]:'';this[_0xeb75('0x9')]='';this[_0xeb75('0xa')]='';this[_0xeb75('0xb')]='';this[_0xeb75('0xc')]='';this[_0xeb75('0xd')]='';this['stateRegistry']=_0xeb75('0x3');this['registrationtime']='';this['address']='';this['defaultuser']=_0x52ac79[_0xeb75('0xe')]||'';}module['exports']=Trunk; \ No newline at end of file +var _0x44d4=['port','domain','domainport','refresh','stateRegistry','address','defaultuser','active','name','state','unknown','status','registry','indexOf','split'];(function(_0x52cd66,_0x37dfc3){var _0x26fc62=function(_0x110933){while(--_0x110933){_0x52cd66['push'](_0x52cd66['shift']());}};_0x26fc62(++_0x37dfc3);}(_0x44d4,0xf7));var _0x444d=function(_0x47feb6,_0x246208){_0x47feb6=_0x47feb6-0x0;var _0x4c9734=_0x44d4[_0x47feb6];return _0x4c9734;};'use strict';function Trunk(_0x489a0e){this['id']=_0x489a0e['id']||0x0;this[_0x444d('0x0')]=_0x489a0e[_0x444d('0x0')]||![];this[_0x444d('0x1')]=_0x489a0e[_0x444d('0x1')]||'';this[_0x444d('0x2')]=_0x444d('0x3');this['stateTime']=0x0;this[_0x444d('0x4')]=_0x444d('0x3');this[_0x444d('0x5')]=_0x489a0e['registry']&&_0x489a0e[_0x444d('0x5')][_0x444d('0x6')](':')?_0x489a0e[_0x444d('0x5')][_0x444d('0x7')](':')[0x0]:'';this['host']='';this[_0x444d('0x8')]='';this[_0x444d('0x9')]='';this[_0x444d('0xa')]='';this[_0x444d('0xb')]='';this[_0x444d('0xc')]=_0x444d('0x3');this['registrationtime']='';this[_0x444d('0xd')]='';this[_0x444d('0xe')]=_0x489a0e[_0x444d('0xe')]||'';}module['exports']=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index d4bd3b2..c5142d7 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 _0x0938=['recordingFormat','mandatoryDisposition','exports','exten'];(function(_0x179e11,_0xf65436){var _0x549f04=function(_0x610545){while(--_0x610545){_0x179e11['push'](_0x179e11['shift']());}};_0x549f04(++_0xf65436);}(_0x0938,0x11b));var _0x8093=function(_0x3d2527,_0x308cf7){_0x3d2527=_0x3d2527-0x0;var _0x42e55a=_0x0938[_0x3d2527];return _0x42e55a;};'use strict';function voiceExtension(_0x5ea6d6){this['id']=_0x5ea6d6['id']||0x0;this[_0x8093('0x0')]=_0x5ea6d6[_0x8093('0x0')]||'';this[_0x8093('0x1')]=_0x5ea6d6[_0x8093('0x1')]||'none';this['mandatoryDisposition']=_0x5ea6d6[_0x8093('0x2')]||![];}module[_0x8093('0x3')]=voiceExtension; \ No newline at end of file +var _0x940c=['exports','recordingFormat','none','mandatoryDisposition'];(function(_0x1f9570,_0x37296f){var _0x196714=function(_0x163177){while(--_0x163177){_0x1f9570['push'](_0x1f9570['shift']());}};_0x196714(++_0x37296f);}(_0x940c,0x189));var _0xc940=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x940c[_0x3dd15e];return _0x231fd0;};'use strict';function voiceExtension(_0x6f1df2){this['id']=_0x6f1df2['id']||0x0;this['exten']=_0x6f1df2['exten']||'';this[_0xc940('0x0')]=_0x6f1df2[_0xc940('0x0')]||_0xc940('0x1');this[_0xc940('0x2')]=_0x6f1df2['mandatoryDisposition']||![];}module[_0xc940('0x3')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index e67bb66..ad54eed 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 _0xa875=['outboundDropCallsDayACS','outboundReCallsDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','exports','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','waiting','talking','total','answered','sumDuration','sumBillable','unmanaged','available','acw','acwTimeout','autopause','sendMessageOneNotActive','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit'];(function(_0xa6d02c,_0x1794ea){var _0x166b3f=function(_0x38511f){while(--_0x38511f){_0xa6d02c['push'](_0xa6d02c['shift']());}};_0x166b3f(++_0x1794ea);}(_0xa875,0x176));var _0x5a87=function(_0xca1f0e,_0x2713d5){_0xca1f0e=_0xca1f0e-0x0;var _0x35e4ef=_0xa875[_0xca1f0e];return _0x35e4ef;};'use strict';var statusDesc=['unknown',_0x5a87('0x0'),_0x5a87('0x1'),_0x5a87('0x2'),_0x5a87('0x3'),_0x5a87('0x4'),_0x5a87('0x5'),_0x5a87('0x6'),_0x5a87('0x7')];var monitorFormat={'wav':'wav','wav49':_0x5a87('0x8'),'gsm':_0x5a87('0x9')};var strategy={'rrmemory':_0x5a87('0xa'),'roundrobin':_0x5a87('0xb')};function VoiceQueue(_0x5042b5){this['id']=_0x5042b5['id']||0x0;this[_0x5a87('0xc')]=_0x5042b5['name']||'';this[_0x5a87('0xd')]=_0x5042b5[_0x5a87('0xd')]||'';this[_0x5a87('0xe')]=_0x5042b5['type']||'inbound';this[_0x5a87('0xf')]=0x0;this[_0x5a87('0x10')]=0x0;this[_0x5a87('0x11')]=0x0;this[_0x5a87('0x12')]=0x0;this[_0x5a87('0x13')]=0x0;this['sumHoldTime']=0x0;this[_0x5a87('0x14')]=0x0;this[_0x5a87('0x15')]=0x0;this['abandoned']=0x0;this['loggedIn']=0x0;this[_0x5a87('0x16')]=0x0;this[_0x5a87('0x17')]=_0x5042b5[_0x5a87('0x17')]||![];this['acwTimeout']=_0x5042b5[_0x5a87('0x18')]||0xa;this['autopause']=_0x5042b5[_0x5a87('0x19')]||'no';this[_0x5a87('0x1a')]=!![];this['message']='';this[_0x5a87('0x1b')]=0x0;this['temp']=0x0;this[_0x5a87('0x1c')]=_0x5042b5[_0x5a87('0x1c')]||null;this[_0x5a87('0x1d')]=_0x5042b5[_0x5a87('0x1d')]?_0x5042b5[_0x5a87('0x1d')]:null;this[_0x5a87('0x1e')]=_0x5042b5['dialActive'];this[_0x5a87('0x1f')]=_0x5042b5['dialMethod']||_0x5a87('0x20');this[_0x5a87('0x21')]=_0x5042b5[_0x5a87('0x21')]||0x0;this[_0x5a87('0x22')]=_0x5042b5[_0x5a87('0x22')]||0x0;this[_0x5a87('0x23')]=_0x5042b5[_0x5a87('0x23')]||0x1;this[_0x5a87('0x24')]=_0x5042b5[_0x5a87('0x24')]||_0x5a87('0x25');this[_0x5a87('0x26')]=_0x5042b5[_0x5a87('0x26')]||0.03;this[_0x5a87('0x27')]=_0x5042b5[_0x5a87('0x27')]||0x258;this[_0x5a87('0x28')]=_0x5042b5['dialOriginateCallerIdName']||_0x5a87('0x29');this[_0x5a87('0x2a')]=_0x5042b5[_0x5a87('0x2a')]||_0x5a87('0x29');this[_0x5a87('0x2b')]=_0x5042b5['dialOriginateTimeout']||0x1e;this['dialQueueOptions']=_0x5042b5[_0x5a87('0x2c')]||_0x5a87('0x2d');this[_0x5a87('0x2e')]=_0x5042b5[_0x5a87('0x2e')]||0x3;this[_0x5a87('0x2f')]=_0x5042b5[_0x5a87('0x2f')]||undefined;this[_0x5a87('0x30')]=_0x5042b5[_0x5a87('0x30')]||0x3;this['dialCongestionRetryFrequency']=_0x5042b5['dialCongestionRetryFrequency']||0x96;this[_0x5a87('0x31')]=_0x5042b5[_0x5a87('0x31')]||0x3;this[_0x5a87('0x32')]=_0x5042b5[_0x5a87('0x32')]||0x96;this['dialNoAnswerMaxRetry']=_0x5042b5[_0x5a87('0x33')]||0x3;this['dialNoAnswerRetryFrequency']=_0x5042b5[_0x5a87('0x34')]||0x96;this[_0x5a87('0x35')]=_0x5042b5['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x5042b5['dialNoSuchNumberRetryFrequency']||0x96;this[_0x5a87('0x36')]=_0x5042b5[_0x5a87('0x36')]||0x3;this[_0x5a87('0x37')]=_0x5042b5[_0x5a87('0x37')]||0x96;this[_0x5a87('0x38')]=_0x5042b5[_0x5a87('0x38')]||0x3;this[_0x5a87('0x39')]=_0x5042b5[_0x5a87('0x39')]||0x96;this['dialMachineMaxRetry']=_0x5042b5['dialMachineMaxRetry']||0x3;this[_0x5a87('0x3a')]=_0x5042b5['dialMachineRetryFrequency']||0x96;this[_0x5a87('0x3b')]=_0x5042b5['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0x5042b5['dialAgentRejectRetryFrequency']||0x96;this[_0x5a87('0x3c')]=_0x5042b5[_0x5a87('0x3c')]||0x4;this[_0x5a87('0x3d')]=_0x5042b5[_0x5a87('0x3d')]?_0x5042b5[_0x5a87('0x3d')]:undefined;this[_0x5a87('0x3e')]=_0x5042b5[_0x5a87('0x3e')]?_0x5042b5['TrunkBackup']:undefined;this[_0x5a87('0x3f')]=_0x5042b5[_0x5a87('0x3f')]||undefined;this['Interval']=_0x5042b5['Interval']?_0x5042b5[_0x5a87('0x40')]:undefined;this[_0x5a87('0x41')]=_0x5042b5[_0x5a87('0x41')]||_0x5a87('0x42');this[_0x5a87('0x43')]=_0x5042b5[_0x5a87('0x43')]||undefined;this['dialCutDigit']=_0x5042b5['dialCutDigit']||undefined;this[_0x5a87('0x44')]=strategy[_0x5042b5[_0x5a87('0x44')]]||_0x5a87('0xa');this['queueStatusComplete']=!![];this[_0x5a87('0x45')]=_0x5042b5[_0x5a87('0x45')]||![];this[_0x5a87('0x46')]=_0x5042b5[_0x5a87('0x46')];this[_0x5a87('0x47')]=_0x5042b5['dialAMDGreeting'];this[_0x5a87('0x48')]=_0x5042b5[_0x5a87('0x48')];this['dialAMDTotalAnalysisTime']=_0x5042b5[_0x5a87('0x49')];this[_0x5a87('0x4a')]=_0x5042b5[_0x5a87('0x4a')];this['dialAMDBetweenWordsSilence']=_0x5042b5[_0x5a87('0x4b')];this[_0x5a87('0x4c')]=_0x5042b5['dialAMDMaximumNumberOfWords'];this[_0x5a87('0x4d')]=_0x5042b5['dialAMDSilenceThreshold'];this[_0x5a87('0x4e')]=_0x5042b5['dialAMDMaximumWordLength'];this[_0x5a87('0x4f')]=0x0;this[_0x5a87('0x50')]=0x0;this[_0x5a87('0x51')]=_0x5042b5[_0x5a87('0x51')];this[_0x5a87('0x52')]=0x0;this[_0x5a87('0x53')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0x5a87('0x54')]=0x0;this[_0x5a87('0x55')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0x5a87('0x56')]=0x0;this[_0x5a87('0x57')]=0x0;this[_0x5a87('0x58')]=0x0;this[_0x5a87('0x59')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x5a87('0x5a')]=0x0;this[_0x5a87('0x5b')]=0x0;this['outboundAbandonedDay']=0x0;this[_0x5a87('0x5c')]=undefined;this[_0x5a87('0x5d')]=undefined;this[_0x5a87('0x5e')]=undefined;this[_0x5a87('0x5f')]=1.05;this[_0x5a87('0x60')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0x5a87('0x61')]=0x0;this[_0x5a87('0x62')]=0x0;this[_0x5a87('0x63')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0x5a87('0x64')]=0x0;this[_0x5a87('0x65')]=0x0;this[_0x5a87('0x66')]=_0x5042b5[_0x5a87('0x67')]||0x14;this[_0x5a87('0x68')]=_0x5042b5[_0x5a87('0x67')]||0xa;this[_0x5a87('0x69')]=0x0;this[_0x5a87('0x6a')]=0x0;this[_0x5a87('0x6b')]=0x1;this[_0x5a87('0x6c')]=0x0;this['erlangCallToSecond']=0x0;this[_0x5a87('0x6d')]=0x0;this['erlangBusyFactor']=0x0;this[_0x5a87('0x6e')]=_0x5042b5[_0x5a87('0x6e')]||0x1e;this[_0x5a87('0x6f')]=_0x5042b5['dialRecallInQueue']||![];this['dialQueueProject2']=_0x5042b5[_0x5a87('0x70')]||undefined;this[_0x5a87('0x71')]=_0x5042b5[_0x5a87('0x71')]||![];this[_0x5a87('0x72')]=_0x5042b5[_0x5a87('0x72')]||![];this['monitor_format']=monitorFormat[_0x5042b5[_0x5a87('0xd')]]?monitorFormat[_0x5042b5[_0x5a87('0xd')]]:undefined;this['mandatoryDisposition']=_0x5042b5['mandatoryDisposition']||![];this['mandatoryDispositionPause']=_0x5042b5['mandatoryDispositionPause']?_0x5042b5['mandatoryDispositionPause']:undefined;}module[_0x5a87('0x73')]=VoiceQueue; \ No newline at end of file +var _0x2fcb=['DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','startPredictive','handlePredictive','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupAgent','mandatoryDispositionPause','exports','inuse','unavailable','ringing','onhold','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','talking','total','answered','sumDuration','abandoned','available','acw','acwTimeout','autopause','sendMessageOneNotActive','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2fcb,0x98));var _0xb2fc=function(_0x20564a,_0x2812fe){_0x20564a=_0x20564a-0x0;var _0x9dad98=_0x2fcb[_0x20564a];return _0x9dad98;};'use strict';var statusDesc=['unknown','not_inuse',_0xb2fc('0x0'),'busy','invalid',_0xb2fc('0x1'),_0xb2fc('0x2'),'ringinuse',_0xb2fc('0x3')];var monitorFormat={'wav':'wav','wav49':_0xb2fc('0x4'),'gsm':_0xb2fc('0x5')};var strategy={'rrmemory':_0xb2fc('0x6'),'roundrobin':_0xb2fc('0x7')};function VoiceQueue(_0x36e952){this['id']=_0x36e952['id']||0x0;this[_0xb2fc('0x8')]=_0x36e952[_0xb2fc('0x8')]||'';this[_0xb2fc('0x9')]=_0x36e952[_0xb2fc('0x9')]||'';this[_0xb2fc('0xa')]=_0x36e952[_0xb2fc('0xa')]||_0xb2fc('0xb');this[_0xb2fc('0xc')]=0x0;this[_0xb2fc('0xd')]=0x0;this[_0xb2fc('0xe')]=0x0;this[_0xb2fc('0xf')]=0x0;this[_0xb2fc('0x10')]=0x0;this['sumHoldTime']=0x0;this['sumBillable']=0x0;this['unmanaged']=0x0;this[_0xb2fc('0x11')]=0x0;this['loggedIn']=0x0;this[_0xb2fc('0x12')]=0x0;this[_0xb2fc('0x13')]=_0x36e952[_0xb2fc('0x13')]||![];this[_0xb2fc('0x14')]=_0x36e952['acwTimeout']||0xa;this[_0xb2fc('0x15')]=_0x36e952[_0xb2fc('0x15')]||'no';this[_0xb2fc('0x16')]=!![];this['message']='';this[_0xb2fc('0x17')]=0x0;this[_0xb2fc('0x18')]=0x0;this[_0xb2fc('0x19')]=_0x36e952[_0xb2fc('0x19')]||null;this[_0xb2fc('0x1a')]=_0x36e952[_0xb2fc('0x1a')]?_0x36e952[_0xb2fc('0x1a')]:null;this[_0xb2fc('0x1b')]=_0x36e952[_0xb2fc('0x1b')];this[_0xb2fc('0x1c')]=_0x36e952['dialMethod']||_0xb2fc('0x1d');this[_0xb2fc('0x1e')]=_0x36e952[_0xb2fc('0x1e')]||0x0;this['dialLimitQueue']=_0x36e952['dialLimitQueue']||0x0;this[_0xb2fc('0x1f')]=_0x36e952[_0xb2fc('0x1f')]||0x1;this[_0xb2fc('0x20')]=_0x36e952[_0xb2fc('0x20')]||_0xb2fc('0x21');this[_0xb2fc('0x22')]=_0x36e952[_0xb2fc('0x22')]||0.03;this['dialPredictiveInterval']=_0x36e952[_0xb2fc('0x23')]||0x258;this['dialOriginateCallerIdName']=_0x36e952['dialOriginateCallerIdName']||_0xb2fc('0x24');this['dialOriginateCallerIdNumber']=_0x36e952[_0xb2fc('0x25')]||'anonymous';this[_0xb2fc('0x26')]=_0x36e952[_0xb2fc('0x26')]||0x1e;this[_0xb2fc('0x27')]=_0x36e952['dialQueueOptions']||_0xb2fc('0x28');this[_0xb2fc('0x29')]=_0x36e952[_0xb2fc('0x29')]||0x3;this[_0xb2fc('0x2a')]=_0x36e952['dialQueueProject']||undefined;this[_0xb2fc('0x2b')]=_0x36e952[_0xb2fc('0x2b')]||0x3;this[_0xb2fc('0x2c')]=_0x36e952[_0xb2fc('0x2c')]||0x96;this[_0xb2fc('0x2d')]=_0x36e952[_0xb2fc('0x2d')]||0x3;this[_0xb2fc('0x2e')]=_0x36e952['dialBusyRetryFrequency']||0x96;this['dialNoAnswerMaxRetry']=_0x36e952['dialNoAnswerMaxRetry']||0x3;this['dialNoAnswerRetryFrequency']=_0x36e952['dialNoAnswerRetryFrequency']||0x96;this[_0xb2fc('0x2f')]=_0x36e952['dialNoSuchNumberMaxRetry']||0x3;this[_0xb2fc('0x30')]=_0x36e952[_0xb2fc('0x30')]||0x96;this[_0xb2fc('0x31')]=_0x36e952[_0xb2fc('0x31')]||0x3;this['dialDropRetryFrequency']=_0x36e952['dialDropRetryFrequency']||0x96;this[_0xb2fc('0x32')]=_0x36e952['dialAbandonedMaxRetry']||0x3;this['dialAbandonedRetryFrequency']=_0x36e952[_0xb2fc('0x33')]||0x96;this[_0xb2fc('0x34')]=_0x36e952[_0xb2fc('0x34')]||0x3;this[_0xb2fc('0x35')]=_0x36e952[_0xb2fc('0x35')]||0x96;this[_0xb2fc('0x36')]=_0x36e952[_0xb2fc('0x36')]||0x3;this[_0xb2fc('0x37')]=_0x36e952['dialAgentRejectRetryFrequency']||0x96;this[_0xb2fc('0x38')]=_0x36e952[_0xb2fc('0x38')]||0x4;this['Trunk']=_0x36e952[_0xb2fc('0x39')]?_0x36e952[_0xb2fc('0x39')]:undefined;this[_0xb2fc('0x3a')]=_0x36e952['TrunkBackup']?_0x36e952['TrunkBackup']:undefined;this[_0xb2fc('0x3b')]=_0x36e952[_0xb2fc('0x3b')]||undefined;this['Interval']=_0x36e952[_0xb2fc('0x3c')]?_0x36e952[_0xb2fc('0x3c')]:undefined;this['dialOrderByScheduledAt']=_0x36e952[_0xb2fc('0x3d')]||_0xb2fc('0x3e');this[_0xb2fc('0x3f')]=_0x36e952['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xb2fc('0x40')]=_0x36e952[_0xb2fc('0x40')]||undefined;this['strategy']=strategy[_0x36e952[_0xb2fc('0x41')]]||_0xb2fc('0x6');this['queueStatusComplete']=!![];this[_0xb2fc('0x42')]=_0x36e952[_0xb2fc('0x42')]||![];this[_0xb2fc('0x43')]=_0x36e952[_0xb2fc('0x43')];this['dialAMDGreeting']=_0x36e952[_0xb2fc('0x44')];this[_0xb2fc('0x45')]=_0x36e952[_0xb2fc('0x45')];this[_0xb2fc('0x46')]=_0x36e952[_0xb2fc('0x46')];this[_0xb2fc('0x47')]=_0x36e952['dialAMDMinWordLength'];this[_0xb2fc('0x48')]=_0x36e952[_0xb2fc('0x48')];this[_0xb2fc('0x49')]=_0x36e952[_0xb2fc('0x49')];this[_0xb2fc('0x4a')]=_0x36e952[_0xb2fc('0x4a')];this[_0xb2fc('0x4b')]=_0x36e952[_0xb2fc('0x4b')];this[_0xb2fc('0x4c')]=0x0;this[_0xb2fc('0x4d')]=0x0;this[_0xb2fc('0x4e')]=_0x36e952['timeout'];this[_0xb2fc('0x4f')]=0x0;this[_0xb2fc('0x50')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this['outboundBusyCallsDay']=0x0;this[_0xb2fc('0x51')]=0x0;this[_0xb2fc('0x52')]=0x0;this[_0xb2fc('0x53')]=0x0;this[_0xb2fc('0x54')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0xb2fc('0x55')]=0x0;this[_0xb2fc('0x56')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0xb2fc('0x57')]=0x0;this[_0xb2fc('0x58')]=0x0;this['startProgressive']=undefined;this[_0xb2fc('0x59')]=undefined;this[_0xb2fc('0x5a')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this['predictiveIntervalTotalCalls']=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0xb2fc('0x5b')]=0x0;this[_0xb2fc('0x5c')]=0x0;this[_0xb2fc('0x5d')]=0x0;this[_0xb2fc('0x5e')]=0x0;this['predictiveIntervalPauses']=0x0;this['predictiveIntervalAvailable']=0x0;this[_0xb2fc('0x5f')]=_0x36e952['dialPredictiveIntervalMaxThreshold']||0x14;this['predictiveIntervalMinThreshold']=_0x36e952[_0xb2fc('0x60')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0xb2fc('0x61')]=0x0;this[_0xb2fc('0x62')]=0x1;this['erlangCalls']=0x0;this['erlangCallToSecond']=0x0;this[_0xb2fc('0x63')]=0x0;this[_0xb2fc('0x64')]=0x0;this[_0xb2fc('0x65')]=_0x36e952[_0xb2fc('0x65')]||0x1e;this[_0xb2fc('0x66')]=_0x36e952[_0xb2fc('0x66')]||![];this[_0xb2fc('0x67')]=_0x36e952[_0xb2fc('0x67')]||undefined;this['dialAgiAfterHangupClient']=_0x36e952['dialAgiAfterHangupClient']||![];this[_0xb2fc('0x68')]=_0x36e952[_0xb2fc('0x68')]||![];this[_0xb2fc('0x9')]=monitorFormat[_0x36e952[_0xb2fc('0x9')]]?monitorFormat[_0x36e952[_0xb2fc('0x9')]]:undefined;this['mandatoryDisposition']=_0x36e952['mandatoryDisposition']||![];this[_0xb2fc('0x69')]=_0x36e952[_0xb2fc('0x69')]?_0x36e952['mandatoryDispositionPause']:undefined;}module[_0xb2fc('0x6a')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 34faacf..ce56c15 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 _0x5cc7=['name','username','accessKey','remoteUri','serverUrl','Configurations','exports'];(function(_0x313dd1,_0x3c4b0d){var _0x1347f2=function(_0xb7a501){while(--_0xb7a501){_0x313dd1['push'](_0x313dd1['shift']());}};_0x1347f2(++_0x3c4b0d);}(_0x5cc7,0x18f));var _0x75cc=function(_0x41892f,_0x444837){_0x41892f=_0x41892f-0x0;var _0x49b412=_0x5cc7[_0x41892f];return _0x49b412;};'use strict';function VtigerAccount(_0x85fb42){this['id']=_0x85fb42['id']||0x0;this['name']=_0x85fb42[_0x75cc('0x0')]||'';this[_0x75cc('0x1')]=_0x85fb42[_0x75cc('0x1')]||'';this['accessKey']=_0x85fb42[_0x75cc('0x2')]||'';this[_0x75cc('0x3')]=_0x85fb42['remoteUri']||'';this[_0x75cc('0x4')]=_0x85fb42[_0x75cc('0x4')]||'';this[_0x75cc('0x5')]=_0x85fb42['Configurations']||{};}module[_0x75cc('0x6')]=VtigerAccount; \ No newline at end of file +var _0xc769=['accessKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0xc769,0x1ef));var _0x9c76=function(_0x52909f,_0x74cfdd){_0x52909f=_0x52909f-0x0;var _0x555148=_0xc769[_0x52909f];return _0x555148;};'use strict';function VtigerAccount(_0x40622){this['id']=_0x40622['id']||0x0;this[_0x9c76('0x0')]=_0x40622[_0x9c76('0x0')]||'';this[_0x9c76('0x1')]=_0x40622[_0x9c76('0x1')]||'';this[_0x9c76('0x2')]=_0x40622['accessKey']||'';this[_0x9c76('0x3')]=_0x40622[_0x9c76('0x3')]||'';this[_0x9c76('0x4')]=_0x40622[_0x9c76('0x4')]||'';this['Configurations']=_0x40622[_0x9c76('0x5')]||{};}module[_0x9c76('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 93ba210..8b206c2 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 _0x92d7=['Configurations','exports','name','password','token','authType','type','integrationTab','serverUrl'];(function(_0x5f3492,_0x988505){var _0x4ea13c=function(_0x334bb9){while(--_0x334bb9){_0x5f3492['push'](_0x5f3492['shift']());}};_0x4ea13c(++_0x988505);}(_0x92d7,0x1b2));var _0x792d=function(_0x3e4352,_0x4e3e90){_0x3e4352=_0x3e4352-0x0;var _0x4b4d85=_0x92d7[_0x3e4352];return _0x4b4d85;};'use strict';function ZendeskAccount(_0x3e383a){this['id']=_0x3e383a['id']||0x0;this['name']=_0x3e383a[_0x792d('0x0')]||'';this['username']=_0x3e383a['username']||'';this[_0x792d('0x1')]=_0x3e383a[_0x792d('0x1')]||'';this[_0x792d('0x2')]=_0x3e383a['token']||'';this['remoteUri']=_0x3e383a['remoteUri']||'';this[_0x792d('0x3')]=_0x3e383a[_0x792d('0x3')]||'';this['type']=_0x3e383a[_0x792d('0x4')]||_0x792d('0x5');this[_0x792d('0x6')]=_0x3e383a[_0x792d('0x6')]||'';this[_0x792d('0x7')]=_0x3e383a['Configurations']||{};}module[_0x792d('0x8')]=ZendeskAccount; \ No newline at end of file +var _0xaa87=['password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name','username'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0xaa87,0xb9));var _0x7aa8=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0xaa87[_0x2dadb9];return _0x2f0097;};'use strict';function ZendeskAccount(_0x251a7e){this['id']=_0x251a7e['id']||0x0;this[_0x7aa8('0x0')]=_0x251a7e[_0x7aa8('0x0')]||'';this['username']=_0x251a7e[_0x7aa8('0x1')]||'';this[_0x7aa8('0x2')]=_0x251a7e['password']||'';this[_0x7aa8('0x3')]=_0x251a7e[_0x7aa8('0x3')]||'';this[_0x7aa8('0x4')]=_0x251a7e[_0x7aa8('0x4')]||'';this[_0x7aa8('0x5')]=_0x251a7e[_0x7aa8('0x5')]||'';this[_0x7aa8('0x6')]=_0x251a7e[_0x7aa8('0x6')]||_0x7aa8('0x7');this['serverUrl']=_0x251a7e[_0x7aa8('0x8')]||'';this[_0x7aa8('0x9')]=_0x251a7e[_0x7aa8('0x9')]||{};}module[_0x7aa8('0xa')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 30a4ba0..594304b 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 _0xe12f=['name','description','host','zone','clientId','clientSecret','serverUrl','refreshToken','Configurations','exports'];(function(_0x259aab,_0x3c2b69){var _0x2824b1=function(_0x5663a6){while(--_0x5663a6){_0x259aab['push'](_0x259aab['shift']());}};_0x2824b1(++_0x3c2b69);}(_0xe12f,0x1ae));var _0xfe12=function(_0x872cae,_0x5f4696){_0x872cae=_0x872cae-0x0;var _0x74adf8=_0xe12f[_0x872cae];return _0x74adf8;};'use strict';function ZohoAccount(_0xc0ed05){this['id']=_0xc0ed05['id']||0x0;this[_0xfe12('0x0')]=_0xc0ed05['name']||'';this[_0xfe12('0x1')]=_0xc0ed05[_0xfe12('0x1')]||'';this[_0xfe12('0x2')]=_0xc0ed05[_0xfe12('0x2')]||'';this['zone']=_0xc0ed05[_0xfe12('0x3')]||'';this[_0xfe12('0x4')]=_0xc0ed05[_0xfe12('0x4')]||'';this[_0xfe12('0x5')]=_0xc0ed05['clientSecret']||'';this[_0xfe12('0x6')]=_0xc0ed05['serverUrl']||'';this['code']=_0xc0ed05['code']||'';this[_0xfe12('0x7')]=_0xc0ed05[_0xfe12('0x7')]||'';this[_0xfe12('0x8')]=_0xc0ed05[_0xfe12('0x8')]||{};}module[_0xfe12('0x9')]=ZohoAccount; \ No newline at end of file +var _0xc7a4=['clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone','clientId'];(function(_0x2f04d5,_0x5ea168){var _0x484590=function(_0x4640e7){while(--_0x4640e7){_0x2f04d5['push'](_0x2f04d5['shift']());}};_0x484590(++_0x5ea168);}(_0xc7a4,0xa0));var _0x4c7a=function(_0x3af967,_0x9e4b6d){_0x3af967=_0x3af967-0x0;var _0x5c105a=_0xc7a4[_0x3af967];return _0x5c105a;};'use strict';function ZohoAccount(_0x54de4f){this['id']=_0x54de4f['id']||0x0;this[_0x4c7a('0x0')]=_0x54de4f[_0x4c7a('0x0')]||'';this['description']=_0x54de4f[_0x4c7a('0x1')]||'';this[_0x4c7a('0x2')]=_0x54de4f[_0x4c7a('0x2')]||'';this[_0x4c7a('0x3')]=_0x54de4f[_0x4c7a('0x3')]||'';this['clientId']=_0x54de4f[_0x4c7a('0x4')]||'';this[_0x4c7a('0x5')]=_0x54de4f[_0x4c7a('0x5')]||'';this[_0x4c7a('0x6')]=_0x54de4f[_0x4c7a('0x6')]||'';this[_0x4c7a('0x7')]=_0x54de4f[_0x4c7a('0x7')]||'';this[_0x4c7a('0x8')]=_0x54de4f[_0x4c7a('0x8')]||'';this[_0x4c7a('0x9')]=_0x54de4f[_0x4c7a('0x9')]||{};}module[_0x4c7a('0xa')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 4d3157a..d4eda01 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 _0x3a1f=['callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','\x22%s\x22\x20<%s>','calleridname','number','exports','moment','string','isNil','queue','name','type','campaigntype','dialAnswer','Agent','channelAgent','membername','format','SIP/%s','Contact','phone','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry'];(function(_0x32ba5f,_0x9ec7a1){var _0x3954a7=function(_0x53213b){while(--_0x53213b){_0x32ba5f['push'](_0x32ba5f['shift']());}};_0x3954a7(++_0x9ec7a1);}(_0x3a1f,0x12d));var _0xf3a1=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x3a1f[_0x4e9628];return _0x27bc8c;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xf3a1('0x0'));function checkNameSurname(_0x467b8d,_0x359e91,_0x1369fa){var _0x7a45e5='';if(!_['isNil'](_0x359e91)&&_0xf3a1('0x1')===typeof _0x359e91){_0x7a45e5+=_0x359e91;}if(!_[_0xf3a1('0x2')](_0x1369fa)&&'string'===typeof _0x1369fa){_0x7a45e5+='\x20'+_0x1369fa;}if(_0x7a45e5!==''){return _0x7a45e5;}return _0x467b8d;}function Action(_0x507a11,_0x7b97a7,_0x173aff,_0x150750,_0x2379d5){this['uniqueid']=_0x173aff||undefined;this['idContact']=_0x507a11['id'];this[_0xf3a1('0x3')]=_0x7b97a7[_0xf3a1('0x4')];this[_0xf3a1('0x5')]=_0x7b97a7[_0xf3a1('0x5')];this[_0xf3a1('0x6')]=_0xf3a1('0x3');this[_0xf3a1('0x7')]=![];this['membername']=_[_0xf3a1('0x2')](_0x507a11[_0xf3a1('0x8')])?undefined:_0x507a11[_0xf3a1('0x8')][_0xf3a1('0x4')];this[_0xf3a1('0x9')]=this[_0xf3a1('0xa')]?util[_0xf3a1('0xb')](_0xf3a1('0xc'),this['membername']):_0x150750||undefined;this['calleridname']=checkNameSurname(_0x507a11[_0xf3a1('0xd')][_0xf3a1('0xe')],_0x507a11[_0xf3a1('0xd')]['firstName'],_0x507a11[_0xf3a1('0xd')][_0xf3a1('0xf')]);this[_0xf3a1('0x10')]=_0x507a11['active']||![];this[_0xf3a1('0x11')]=_0x507a11[_0xf3a1('0xd')][_0xf3a1('0xe')];this[_0xf3a1('0x12')]=_0x507a11[_0xf3a1('0x12')];this[_0xf3a1('0x13')]=_0x507a11[_0xf3a1('0x13')]||0x0;this[_0xf3a1('0x14')]=_0x507a11[_0xf3a1('0x14')]||0x0;this['countnoanswerretry']=_0x507a11['countnoanswerretry']||0x0;this['countglobal']=(_0x507a11[_0xf3a1('0x13')]||0x0)+(_0x507a11[_0xf3a1('0x14')]||0x0)+(_0x507a11[_0xf3a1('0x15')]||0x0)+(_0x507a11[_0xf3a1('0x16')]||0x0)+(_0x507a11[_0xf3a1('0x17')]||0x0)+(_0x507a11['countabandonedretry']||0x0)+(_0x507a11[_0xf3a1('0x18')]||0x0)+(_0x507a11[_0xf3a1('0x19')]||0x0);this[_0xf3a1('0x16')]=_0x507a11[_0xf3a1('0x16')]||0x0;this[_0xf3a1('0x17')]=_0x507a11['countdropretry']||0x0;this[_0xf3a1('0x1a')]=_0x507a11[_0xf3a1('0x1a')]||0x0;this[_0xf3a1('0x18')]=_0x507a11[_0xf3a1('0x18')]||0x0;this[_0xf3a1('0x19')]=_0x507a11[_0xf3a1('0x19')]||0x0;this[_0xf3a1('0x1b')]=_0x507a11[_0xf3a1('0x1b')];this[_0xf3a1('0x1c')]=_0x507a11[_0xf3a1('0x1c')];this[_0xf3a1('0x1d')]=_0x507a11[_0xf3a1('0x1d')];this[_0xf3a1('0x1e')]=_0x507a11[_0xf3a1('0x1e')];this[_0xf3a1('0x1f')]=_0x507a11[_0xf3a1('0x1f')];this[_0xf3a1('0x20')]=_0x507a11[_0xf3a1('0x20')];this['UserId']=_[_0xf3a1('0x2')](_0x507a11[_0xf3a1('0x8')])?_0x507a11[_0xf3a1('0x21')]:_0x507a11['Agent']['id'];this[_0xf3a1('0x22')]=_0x507a11['VoiceQueueId'];this[_0xf3a1('0x23')]='';this[_0xf3a1('0x24')]='';}Action['prototype']['getCaller']=function(){return util[_0xf3a1('0xb')](_0xf3a1('0x25'),this[_0xf3a1('0x26')],this[_0xf3a1('0x27')]);};module[_0xf3a1('0x28')]=Action; \ No newline at end of file +var _0x137b=['countabandonedretry','countagentrejectretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','exports','util','lodash','moment','isNil','uniqueid','idContact','name','type','campaigntype','queue','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','lastName','active','calleridnum','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry'];(function(_0x178f75,_0x52da1f){var _0x4925f0=function(_0x62fbab){while(--_0x62fbab){_0x178f75['push'](_0x178f75['shift']());}};_0x4925f0(++_0x52da1f);}(_0x137b,0xc9));var _0xb137=function(_0x42d7f4,_0x5e9ae8){_0x42d7f4=_0x42d7f4-0x0;var _0x49e630=_0x137b[_0x42d7f4];return _0x49e630;};'use strict';var util=require(_0xb137('0x0'));var _=require(_0xb137('0x1'));var moment=require(_0xb137('0x2'));function checkNameSurname(_0x517533,_0x2b8d7f,_0x422849){var _0x59eb94='';if(!_[_0xb137('0x3')](_0x2b8d7f)&&'string'===typeof _0x2b8d7f){_0x59eb94+=_0x2b8d7f;}if(!_[_0xb137('0x3')](_0x422849)&&'string'===typeof _0x422849){_0x59eb94+='\x20'+_0x422849;}if(_0x59eb94!==''){return _0x59eb94;}return _0x517533;}function Action(_0x2c9f40,_0x313818,_0x41858b,_0x315577,_0x3dbc0e){this[_0xb137('0x4')]=_0x41858b||undefined;this[_0xb137('0x5')]=_0x2c9f40['id'];this['queue']=_0x313818[_0xb137('0x6')];this[_0xb137('0x7')]=_0x313818[_0xb137('0x7')];this[_0xb137('0x8')]=_0xb137('0x9');this[_0xb137('0xa')]=![];this[_0xb137('0xb')]=_[_0xb137('0x3')](_0x2c9f40['Agent'])?undefined:_0x2c9f40[_0xb137('0xc')][_0xb137('0x6')];this[_0xb137('0xd')]=this[_0xb137('0xb')]?util[_0xb137('0xe')](_0xb137('0xf'),this[_0xb137('0xb')]):_0x315577||undefined;this[_0xb137('0x10')]=checkNameSurname(_0x2c9f40['Contact']['phone'],_0x2c9f40[_0xb137('0x11')]['firstName'],_0x2c9f40[_0xb137('0x11')][_0xb137('0x12')]);this[_0xb137('0x13')]=_0x2c9f40['active']||![];this[_0xb137('0x14')]=_0x2c9f40[_0xb137('0x11')][_0xb137('0x15')];this['scheduledat']=_0x2c9f40[_0xb137('0x16')];this[_0xb137('0x17')]=_0x2c9f40[_0xb137('0x17')]||0x0;this[_0xb137('0x18')]=_0x2c9f40[_0xb137('0x18')]||0x0;this[_0xb137('0x19')]=_0x2c9f40[_0xb137('0x19')]||0x0;this[_0xb137('0x1a')]=(_0x2c9f40[_0xb137('0x17')]||0x0)+(_0x2c9f40[_0xb137('0x18')]||0x0)+(_0x2c9f40[_0xb137('0x19')]||0x0)+(_0x2c9f40[_0xb137('0x1b')]||0x0)+(_0x2c9f40[_0xb137('0x1c')]||0x0)+(_0x2c9f40[_0xb137('0x1d')]||0x0)+(_0x2c9f40['countmachineretry']||0x0)+(_0x2c9f40[_0xb137('0x1e')]||0x0);this[_0xb137('0x1b')]=_0x2c9f40[_0xb137('0x1b')]||0x0;this[_0xb137('0x1c')]=_0x2c9f40[_0xb137('0x1c')]||0x0;this[_0xb137('0x1d')]=_0x2c9f40['countabandonedretry']||0x0;this[_0xb137('0x1f')]=_0x2c9f40[_0xb137('0x1f')]||0x0;this[_0xb137('0x1e')]=_0x2c9f40[_0xb137('0x1e')]||0x0;this[_0xb137('0x20')]=_0x2c9f40['callback'];this[_0xb137('0x21')]=_0x2c9f40[_0xb137('0x21')];this[_0xb137('0x22')]=_0x2c9f40[_0xb137('0x22')];this[_0xb137('0x23')]=_0x2c9f40[_0xb137('0x23')];this[_0xb137('0x24')]=_0x2c9f40[_0xb137('0x24')];this[_0xb137('0x25')]=_0x2c9f40['ListId'];this['UserId']=_[_0xb137('0x3')](_0x2c9f40['Agent'])?_0x2c9f40[_0xb137('0x26')]:_0x2c9f40[_0xb137('0xc')]['id'];this[_0xb137('0x27')]=_0x2c9f40['VoiceQueueId'];this[_0xb137('0x28')]='';this[_0xb137('0x29')]='';}Action[_0xb137('0x2a')][_0xb137('0x2b')]=function(){return util['format'](_0xb137('0x2c'),this[_0xb137('0x10')],this['number']);};module[_0xb137('0x2d')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 000f9bd..3a18b08 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 _0x8858=['originated:\x20','pTalking:\x20','dialAnswer','pick','contactId','ListId','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][Preview]','size','recallMe','agentReadyId','then','length','getDiff','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','starttime','logCustomer','RecallInQueue','dialRecallInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','AGENTS_NOT_LOGGED','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','custom:agentnosuchnumber','buildObj','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','YYYY-MM-DD\x20HH:mm:ss','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','outboundBusyCallsDay','countbusyretry','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','dialBusyRetryFrequency','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','countnoanswerretry','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerRetryFrequency','CONGESTION','Congestion','custom:agentcongestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','dialCongestionMaxRetry','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[callProgressDetectingCustomer][logAgentReject]','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','ANSWER','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','Calling','[Preview][execCall][failure]','outboundBlacklistCallsDay','createHistory','[Blacklist][error]','SIP/%s','unmonitored','execRun','unlock','unlockContact','disableContact','getContactPreview','recallme','validateContact','checkIsBlackList','VoiceQueueId','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','[Preview][validateContact][Trunk\x20not\x20work]','isActive','[Preview][validateContact][Campaign\x20Active]','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','callerid','extractCalleridName','extractCalleridNumber','merge','toLowerVariables','Action','variablesAction','destconnectedlinenum','user:%s','user:agentconnect','accountcode','calleridnum','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','isFailure','response','custom:agentringnoanswer','[callProgressDetectingAgent][logAnswer]','syncHangup','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','transfer','syncHangupRequest','addVariable','variables','filterKey','keys','variable','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','bluebird','uuid','md5','../../../config/environment','../../../config/logger','preview','../ami','./rpcDb','./action','redis','defaults','localhost','prototype','enqueue','tail','finally','sequence','campaignsPreview','trunks','actions','agents','clockClearZombieChannels','syncOriginateResponse','bind','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','syncAttendedTransfer','blindtransfer','syncBlindTransfer','emit','type','outbound','name','strategy','answered','available','loggedIn','pTalking','sumDuration','sumHoldTime','total','abandoned','waiting','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCallToSecond','erlangAbandonmentRate','startPredictive','startProgressive','Trunk','active','Interval','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20disactive','loopCampaigns','syncCampaigns','hasOwnProperty','dialMethod','booked','clearZombieChannels','setMessage','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue'];(function(_0x236572,_0x5eec3f){var _0x479a92=function(_0x3401d8){while(--_0x3401d8){_0x236572['push'](_0x236572['shift']());}};_0x479a92(++_0x5eec3f);}(_0x8858,0xdf));var _0x8885=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x8858[_0x2b4411];return _0x8e41ef;};'use strict';var util=require(_0x8885('0x0'));var _=require(_0x8885('0x1'));var BPromise=require(_0x8885('0x2'));var uuid=require(_0x8885('0x3'));var moment=require('moment');var md5=require(_0x8885('0x4'));var Redis=require('ioredis');var config=require(_0x8885('0x5'));var logger=require(_0x8885('0x6'))(_0x8885('0x7'));var loggerAction=require(_0x8885('0x6'))('actionPreview');var ami=require(_0x8885('0x8'));var rpcDb=require(_0x8885('0x9'));var Action=require(_0x8885('0xa'));var ut=require('./util/util');config[_0x8885('0xb')]=_[_0x8885('0xc')](config[_0x8885('0xb')],{'host':_0x8885('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8885('0xb')]));var Sequence=function(){};Sequence[_0x8885('0xe')][_0x8885('0xf')]=function(_0x5bd83d){this[_0x8885('0x10')]=this[_0x8885('0x10')]?this[_0x8885('0x10')][_0x8885('0x11')](_0x5bd83d):_0x5bd83d();};function Preview(_0x2736b7){this[_0x8885('0x12')]=new Sequence();this[_0x8885('0x13')]=_0x2736b7['voiceQueues'];this[_0x8885('0x14')]=_0x2736b7[_0x8885('0x14')];this[_0x8885('0x15')]={};this['agents']=_0x2736b7[_0x8885('0x16')];this[_0x8885('0x17')]=0x0;ami['on']('originateresponse',this[_0x8885('0x18')][_0x8885('0x19')](this));ami['on']('hangup',this['syncHangup'][_0x8885('0x19')](this));ami['on']('hanguprequest',this['syncHangupRequest'][_0x8885('0x19')](this));ami['on'](_0x8885('0x1a'),this[_0x8885('0x1b')][_0x8885('0x19')](this));ami['on'](_0x8885('0x1c'),this[_0x8885('0x1d')]['bind'](this));ami['on'](_0x8885('0x1e'),this[_0x8885('0x1f')][_0x8885('0x19')](this));ami['on']('attendedtransfer',this[_0x8885('0x20')][_0x8885('0x19')](this));ami['on'](_0x8885('0x21'),this[_0x8885('0x22')][_0x8885('0x19')](this));this['loopCampaigns'](this[_0x8885('0x13')]);}function emit(_0x159684,_0x203f64,_0x414d7d){io['to'](_0x159684)[_0x8885('0x23')](_0x203f64,_0x414d7d);}function emitCampaignPreview(_0x2c1fce){if(_0x2c1fce[_0x8885('0x24')]===_0x8885('0x25')){var _0x2a56a9={'id':_0x2c1fce['id'],'name':_0x2c1fce[_0x8885('0x26')],'strategy':_0x2c1fce[_0x8885('0x27')],'answered':_0x2c1fce[_0x8885('0x28')],'available':_0x2c1fce[_0x8885('0x29')],'loggedIn':_0x2c1fce[_0x8885('0x2a')],'pTalking':_0x2c1fce[_0x8885('0x2b')],'sumBillable':_0x2c1fce['sumBillable'],'sumDuration':_0x2c1fce[_0x8885('0x2c')],'sumHoldTime':_0x2c1fce[_0x8885('0x2d')]||0x0,'talking':_0x2c1fce['talking'],'total':_0x2c1fce[_0x8885('0x2e')],'type':_0x2c1fce[_0x8885('0x24')],'unmanaged':_0x2c1fce['unmanaged'],'abandoned':_0x2c1fce[_0x8885('0x2f')],'waiting':_0x2c1fce[_0x8885('0x30')],'loggedInDb':_0x2c1fce[_0x8885('0x31')],'dialActive':_0x2c1fce[_0x8885('0x32')],'dialMethod':_0x2c1fce['dialMethod'],'dialOriginateCallerIdName':_0x2c1fce[_0x8885('0x33')],'dialOriginateCallerIdNumber':_0x2c1fce[_0x8885('0x34')],'dialOriginateTimeout':_0x2c1fce[_0x8885('0x35')],'dialPrefix':_0x2c1fce[_0x8885('0x36')],'outboundAnswerAgiCallsDay':_0x2c1fce['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x2c1fce[_0x8885('0x37')],'outboundBlacklistCallsDay':_0x2c1fce['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x2c1fce['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x2c1fce[_0x8885('0x38')],'outboundDropCallsDayACS':_0x2c1fce[_0x8885('0x39')],'outboundDropCallsDayCallersExit':_0x2c1fce[_0x8885('0x3a')],'outboundDropCallsDayTimeout':_0x2c1fce[_0x8885('0x3b')],'outboundNoAnswerCallsDay':_0x2c1fce['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x2c1fce[_0x8885('0x3c')],'outboundOriginateFailureCallsDay':_0x2c1fce['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x2c1fce[_0x8885('0x3d')],'outboundRejectCallsDay':_0x2c1fce[_0x8885('0x3e')],'outboundUnknownCallsDay':_0x2c1fce[_0x8885('0x3f')],'outboundAbandonedCallsDay':_0x2c1fce[_0x8885('0x40')],'predictiveIntervalAnsweredCalls':_0x2c1fce[_0x8885('0x41')],'predictiveIntervalAvgHoldtime':_0x2c1fce[_0x8885('0x42')],'predictiveIntervalAvgTalktime':_0x2c1fce[_0x8885('0x43')],'predictiveIntervalDroppedCallsCallersExit':_0x2c1fce[_0x8885('0x44')],'predictiveIntervalDroppedCallsTimeout':_0x2c1fce['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x2c1fce['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x2c1fce[_0x8885('0x45')],'predictiveIntervalHitRate':_0x2c1fce[_0x8885('0x46')],'predictiveIntervalMultiplicativeFactor':_0x2c1fce[_0x8885('0x47')],'predictiveIntervalPauses':_0x2c1fce['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x2c1fce[_0x8885('0x48')],'predictiveIntervalTotalCalls':_0x2c1fce[_0x8885('0x49')],'message':_0x2c1fce[_0x8885('0x4a')],'originated':_0x2c1fce[_0x8885('0x4b')],'erlangCalls':_0x2c1fce['erlangCalls'],'erlangCallToSecond':_0x2c1fce[_0x8885('0x4c')],'erlangAbandonmentRate':_0x2c1fce[_0x8885('0x4d')],'erlangBusyFactor':_0x2c1fce['erlangBusyFactor'],'startPredictive':_0x2c1fce[_0x8885('0x4e')],'startProgressive':_0x2c1fce[_0x8885('0x4f')]};if(_0x2c1fce['Trunk']){_0x2a56a9['Trunk']={'id':_0x2c1fce[_0x8885('0x50')]['id'],'name':_0x2c1fce[_0x8885('0x50')]['name'],'active':_0x2c1fce[_0x8885('0x50')][_0x8885('0x51')],'callerid':_0x2c1fce[_0x8885('0x50')]['callerid']};}if(_0x2c1fce['Interval']){_0x2a56a9[_0x8885('0x52')]={'id':_0x2c1fce[_0x8885('0x52')]['id'],'name':_0x2c1fce[_0x8885('0x52')][_0x8885('0x26')]};}var _0x1ed574=md5(JSON['stringify'](_0x2a56a9));if(_0x2c1fce[_0x8885('0x4')]!==_0x1ed574){_0x2c1fce[_0x8885('0x4')]=_0x1ed574;emit(util[_0x8885('0x53')](_0x8885('0x54'),_0x2a56a9[_0x8885('0x26')]),_0x8885('0x55'),_0x2a56a9);}}}function emitVoiceQueueChannelRemove(_0x2b0e38){logger[_0x8885('0x56')](_0x8885('0x57'),JSON[_0x8885('0x58')](_0x2b0e38));emit(util[_0x8885('0x53')](_0x8885('0x54'),_0x2b0e38['name']),_0x8885('0x59'),_0x2b0e38);io['emit'](_0x8885('0x5a'),_0x2b0e38);}function notSendMessagesQueue(_0x143cb6){if(_0x143cb6[_0x8885('0x5b')]){if(_0x143cb6[_0x8885('0x4b')]===0x0&&_0x143cb6[_0x8885('0x2b')]===0x0){_0x143cb6[_0x8885('0x5b')]=![];_0x143cb6[_0x8885('0x29')]=0x0;_0x143cb6[_0x8885('0x5c')]=0x0;_0x143cb6[_0x8885('0x4a')]=_0x8885('0x5d');ut[_0x8885('0x5e')](_0x8885('0x5f'),_0x143cb6[_0x8885('0x26')]+_0x8885('0x60'));}else{_0x143cb6[_0x8885('0x4a')]='IS_DISACTIVED';ut[_0x8885('0x5e')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x143cb6[_0x8885('0x26')]+_0x8885('0x61'));}emitCampaignPreview(_0x143cb6);}}Preview['prototype'][_0x8885('0x62')]=function(){var _0x5ef8dd=this;setInterval(function(){_0x5ef8dd[_0x8885('0x63')]();},0x7cf);};Preview[_0x8885('0xe')][_0x8885('0x63')]=function(){var _0x568b06=this[_0x8885('0x13')];this[_0x8885('0x17')]+=0x1;for(var _0xade83a in _0x568b06){if(_0x568b06[_0x8885('0x64')](_0xade83a)&&(_0x568b06[_0xade83a][_0x8885('0x65')]===_0x8885('0x7')||_0x568b06[_0xade83a]['dialMethod']===_0x8885('0x66'))&&_0x568b06[_0xade83a][_0x8885('0x24')]==='outbound'){if(this['clockClearZombieChannels']>0x7){this[_0x8885('0x17')]=0x0;this[_0x8885('0x67')]();}}if(_0x568b06['hasOwnProperty'](_0xade83a)&&_0x568b06[_0xade83a][_0x8885('0x65')]===_0x8885('0x7')&&_0x568b06[_0xade83a]['type']===_0x8885('0x25')){if(_0x568b06[_0xade83a][_0x8885('0x32')]){this[_0x8885('0x68')](_0x568b06[_0xade83a]);this['recallMe'](_0x568b06[_0xade83a]);}else{notSendMessagesQueue(_0x568b06[_0xade83a]);}}}};Preview['prototype'][_0x8885('0x69')]=function(_0x221405){var _0xce8e30=this;this[_0x8885('0x12')][_0x8885('0xf')](function(){if(!_[_0x8885('0x6a')](_0xce8e30[_0x8885('0x15')][_0x221405])){loggerAction[_0x8885('0x56')](_0x8885('0x6b'),_0x221405,_0x8885('0x6c'),_0xce8e30[_0x8885('0x15')][_0x221405][_0x8885('0x6d')],_0x8885('0x6e'),JSON[_0x8885('0x58')](_0xce8e30[_0x8885('0x13')][_0xce8e30[_0x8885('0x15')][_0x221405][_0x8885('0x6d')]][_0x8885('0x4b')]),_0x8885('0x6f'),JSON[_0x8885('0x58')](_0xce8e30[_0x8885('0x13')][_0xce8e30[_0x8885('0x15')][_0x221405]['queue']]['pTalking']),JSON[_0x8885('0x58')](_0xce8e30[_0x8885('0x15')][_0x221405][_0x8885('0x70')]),JSON[_0x8885('0x58')](_[_0x8885('0x71')](_0xce8e30[_0x8885('0x15')][_0x221405],[_0x8885('0x72'),'UserId','VoiceQueueId',_0x8885('0x73')])));return ami['Action']({'action':_0x8885('0x74'),'channel':_0xce8e30['actions'][_0x221405][_0x8885('0x75')]})[_0x8885('0x76')](function(_0x529445){if(_0x529445[_0x8885('0x4a')]===_0x8885('0x77')){setTimeout(function(){if(_0xce8e30[_0x8885('0x15')][_0x221405]){ut[_0x8885('0x78')](_0xce8e30[_0x8885('0x13')][_0xce8e30['actions'][_0x221405][_0x8885('0x6d')]],_0x8885('0x79'));if(_0xce8e30[_0x8885('0x15')][_0x221405][_0x8885('0x70')]===!![]){ut[_0x8885('0x7a')](_0xce8e30[_0x8885('0x13')][_0xce8e30[_0x8885('0x15')][_0x221405][_0x8885('0x6d')]],_0x8885('0x79'));ut['loggerError']('[Dialer][checkChannel][pTalking][Preview]'+_0x221405,_0xce8e30[_0x8885('0x15')][_0x221405][_0x8885('0x6d')]);}ut[_0x8885('0x7b')](_0x8885('0x7c')+_0x221405,_0xce8e30[_0x8885('0x15')][_0x221405][_0x8885('0x6d')]);delete _0xce8e30[_0x8885('0x15')][_0x221405];}},0x2328);}});}});};Preview[_0x8885('0xe')]['clearZombieChannels']=function(){var _0x46392f=this;loggerAction[_0x8885('0x56')]('[action]',_[_0x8885('0x7d')](this[_0x8885('0x15')]));for(var _0x20cf2b in this[_0x8885('0x15')]){if(_0x46392f[_0x8885('0x15')][_0x8885('0x64')](_0x20cf2b)){_0x46392f['clearZombieChannel'](_0x20cf2b);}}};Preview['prototype'][_0x8885('0x7e')]=function(_0x1f5a16){var _0x40f7fe=this;rpcDb['getContactRecallMe'](_0x1f5a16['id'],ut[_0x8885('0x7f')](this[_0x8885('0x16')]))[_0x8885('0x80')](function(_0x151cf7){if(!_[_0x8885('0x6a')](_0x151cf7)){for(var _0x28cdff=0x0;_0x28cdff<_0x151cf7[_0x8885('0x81')];_0x28cdff+=0x1){if(ut[_0x8885('0x82')](_0x151cf7[_0x28cdff]['scheduledat'])<_0x1f5a16[_0x8885('0x83')]*0x3c){if(_0x151cf7[_0x28cdff]['Agent']&&!_0x151cf7[_0x28cdff][_0x8885('0x84')][_0x8885('0x85')]){_0x40f7fe[_0x8885('0x86')](_0x151cf7[_0x28cdff]['id'])['then'](ut[_0x8885('0x87')](_0x8885('0x88')))[_0x8885('0x76')](ut[_0x8885('0x87')]('[RecallMe]'));}else{rpcDb['disableContact'](_0x151cf7[_0x28cdff]['id']);}}else{var _0x46d9aa=new Action(_0x151cf7[_0x28cdff],_0x1f5a16);_0x46d9aa[_0x8885('0x89')]=moment()[_0x8885('0x53')]('YYYY-MM-DD\x20HH:mm:ss');_0x1f5a16[_0x8885('0x3d')]+=0x1;ut[_0x8885('0x8a')](_0x46d9aa,0x17,_0x8885('0x8b'));if(_0x1f5a16[_0x8885('0x8c')]){rpcDb['rescheduleContactInQueue'](ut[_0x8885('0x8d')](_0x151cf7[_0x28cdff]));rpcDb[_0x8885('0x8e')](_0x46d9aa,_0x8885('0x8f'));}else{ut['logCustomer'](_0x46d9aa,0x16,_0x8885('0x90'));rpcDb[_0x8885('0x8e')](_0x46d9aa,_0x8885('0x91'));rpcDb[_0x8885('0x92')](_0x46d9aa,'[HistoryRecallClose]');}}}}})[_0x8885('0x76')](ut[_0x8885('0x87')](_0x8885('0x93')));};Preview['prototype'][_0x8885('0x68')]=function(_0x13f49f){_0x13f49f[_0x8885('0x5b')]=!![];if(ut['IsNotLoggedIn'](_0x13f49f[_0x8885('0x2a')])){_0x13f49f['message']=_0x8885('0x94');}else if(!ut['isActive'](_0x13f49f[_0x8885('0x32')])){_0x13f49f[_0x8885('0x4a')]='NOT_ACTIVE';}else if(!this[_0x8885('0x95')](_0x13f49f['Trunk'])){if(!this[_0x8885('0x95')](_0x13f49f['TrunkBackup'])){_0x13f49f[_0x8885('0x4a')]=_0x8885('0x96');}else{_0x13f49f[_0x8885('0x4a')]=_0x8885('0x97');}}else{_0x13f49f[_0x8885('0x4a')]='ACTIVE';}emitCampaignPreview(_0x13f49f);};Preview[_0x8885('0xe')][_0x8885('0x98')]=function(_0x5e82e6,_0x477919,_0x484e1a){var _0x4b1a9b=this;var _0x3f7879=this['actions'][_0x477919];var _0x24cd19=this['campaignsPreview'][_0x3f7879[_0x8885('0x6d')]];var _0x623162;if(_0x24cd19){switch(_0x484e1a){case'1':_0x24cd19[_0x8885('0x3c')]+=0x1;_0x3f7879[_0x8885('0x99')]+=0x1;_0x3f7879[_0x8885('0x9a')]=ut[_0x8885('0x9b')](_0x3f7879);ut[_0x8885('0x8a')](_0x3f7879,0x0,'NoSuchNumber');ami[_0x8885('0x23')](_0x8885('0x9c'),ut[_0x8885('0x9d')](_0x3f7879,'nosuchnumber'));rpcDb[_0x8885('0x8e')](_0x3f7879,_0x8885('0x9e'));if(ut[_0x8885('0x9b')](_0x3f7879)>=_0x24cd19[_0x8885('0x9f')]){_0x623162=ut[_0x8885('0xa0')](_0x3f7879,0xf,_0x8885('0xa1'));rpcDb[_0x8885('0x92')](_0x623162,_0x8885('0xa2'));}else{if(_0x3f7879[_0x8885('0x99')]>=_0x24cd19[_0x8885('0xa3')]){rpcDb[_0x8885('0x92')](_0x3f7879,_0x8885('0xa2'));}else{rpcDb[_0x8885('0xa4')](ut[_0x8885('0xa5')](_0x3f7879,_0x8885('0x99'),_0x24cd19[_0x8885('0xa6')]),_0x3f7879[_0x8885('0xa7')],_0x3f7879[_0x8885('0xa8')]);}}delete this[_0x8885('0x15')][_0x5e82e6[_0x8885('0xa9')]];break;case'ANSWER':var _0x2f96cb=moment()['format'](_0x8885('0xaa'));_0x3f7879['responsetime']=_0x2f96cb;_0x3f7879[_0x8885('0xab')]=_0x2f96cb;_0x3f7879[_0x8885('0x70')]=!![];_0x24cd19[_0x8885('0x2b')]+=0x1;logger[_0x8885('0x56')](_0x8885('0xac'),_0x3f7879[_0x8885('0xad')],_0x8885('0xae'),_0x24cd19[_0x8885('0x26')],_0x8885('0x6f'),_0x24cd19[_0x8885('0x2b')]);ami[_0x8885('0x23')](_0x8885('0xaf'),ut['buildObj'](_0x3f7879,_0x8885('0xb0'),this[_0x8885('0x13')][_0x3f7879['queue']]));if(_0x24cd19[_0x8885('0xb1')]){ami['emit'](_0x8885('0xb2'),ut[_0x8885('0xb3')](_0x3f7879));}break;case'16':ami['emit'](_0x8885('0xb4'),ut['buildObj'](_0x3f7879,'complete',this[_0x8885('0x13')][_0x3f7879[_0x8885('0x6d')]]));emitVoiceQueueChannelRemove(ut[_0x8885('0x9d')](_0x3f7879,_0x8885('0xb5')));_0x24cd19[_0x8885('0x37')]+=0x1;_0x24cd19[_0x8885('0x2e')]+=0x1;_0x24cd19[_0x8885('0x28')]+=0x1;ut['decrementTalkink'](_0x24cd19,_0x8885('0xb6'));_0x3f7879[_0x8885('0x9a')]=ut['totalGlobal'](_0x3f7879);ut['logCustomer'](_0x3f7879,0x4,_0x8885('0xb7'));rpcDb['createCustomerHistory'](_0x3f7879,_0x8885('0xb8'));rpcDb[_0x8885('0x92')](_0x3f7879,_0x8885('0xb9'));rpcDb[_0x8885('0xba')](_0x3f7879);_0x24cd19['sumDuration']+=_0x3f7879[_0x8885('0xbb')];_0x24cd19['sumBillable']+=_0x3f7879[_0x8885('0xbb')];logger[_0x8885('0x56')](_0x8885('0xbc'),_0x3f7879[_0x8885('0xad')],_0x8885('0xae'),_0x24cd19['name'],'pTalking:\x20',_0x24cd19[_0x8885('0x2b')]);delete this[_0x8885('0x15')][_0x5e82e6[_0x8885('0xa9')]];break;case'BUSY':_0x24cd19[_0x8885('0xbd')]+=0x1;_0x3f7879[_0x8885('0xbe')]+=0x1;_0x3f7879[_0x8885('0x9a')]=ut[_0x8885('0x9b')](_0x3f7879);ut[_0x8885('0x8a')](_0x3f7879,0x5,'Busy');ami[_0x8885('0x23')](_0x8885('0xbf'),ut[_0x8885('0x9d')](_0x3f7879,_0x8885('0xc0')));rpcDb[_0x8885('0x8e')](_0x3f7879,'[callProgressDetectingCustomer][logBusy]');if(ut[_0x8885('0x9b')](_0x3f7879)>=_0x24cd19[_0x8885('0x9f')]){_0x623162=ut[_0x8885('0xa0')](_0x3f7879,0xf,'Global');rpcDb['createCustomerFinal'](_0x623162,_0x8885('0xc1'));}else{if(_0x3f7879[_0x8885('0xbe')]>=_0x24cd19[_0x8885('0xc2')]){rpcDb[_0x8885('0x92')](_0x3f7879,_0x8885('0xc3'));}else{rpcDb[_0x8885('0xa4')](ut['scheduledAt'](_0x3f7879,_0x8885('0xbe'),_0x24cd19[_0x8885('0xc4')]),_0x3f7879[_0x8885('0xa7')],_0x3f7879['activeContact']);}}break;case'NOANSWER':_0x24cd19[_0x8885('0xc5')]+=0x1;_0x3f7879['countnoanswerretry']+=0x1;_0x3f7879[_0x8885('0x9a')]=ut['totalGlobal'](_0x3f7879);ut[_0x8885('0x8a')](_0x3f7879,0x3,_0x8885('0xc6'));ami[_0x8885('0x23')](_0x8885('0xc7'),ut[_0x8885('0x9d')](_0x3f7879,'noanswer'));rpcDb[_0x8885('0x8e')](_0x3f7879,'[callProgressDetectingCustomer][logNoAnswer]');if(ut[_0x8885('0x9b')](_0x3f7879)>=_0x24cd19[_0x8885('0x9f')]){_0x623162=ut[_0x8885('0xa0')](_0x3f7879,0xf,_0x8885('0xa1'));rpcDb[_0x8885('0x92')](_0x623162,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x3f7879[_0x8885('0xc8')]>=_0x24cd19[_0x8885('0xc9')]){rpcDb[_0x8885('0x92')](_0x3f7879,_0x8885('0xca'));}else{rpcDb[_0x8885('0xa4')](ut[_0x8885('0xa5')](_0x3f7879,_0x8885('0xc8'),_0x24cd19[_0x8885('0xcb')]),_0x3f7879[_0x8885('0xa7')],_0x3f7879[_0x8885('0xa8')]);}}break;case _0x8885('0xcc'):_0x24cd19[_0x8885('0x38')]+=0x1;_0x3f7879['countcongestionretry']+=0x1;_0x3f7879[_0x8885('0x9a')]=ut[_0x8885('0x9b')](_0x3f7879);ut[_0x8885('0x8a')](_0x3f7879,0x8,_0x8885('0xcd'));ami[_0x8885('0x23')](_0x8885('0xce'),ut[_0x8885('0x9d')](_0x3f7879,'congestion'));rpcDb[_0x8885('0x8e')](_0x3f7879,_0x8885('0xcf'));if(ut['totalGlobal'](_0x3f7879)>=_0x24cd19['dialGlobalMaxRetry']){_0x623162=ut[_0x8885('0xa0')](_0x3f7879,0xf,'Global');rpcDb[_0x8885('0x92')](_0x623162,_0x8885('0xd0'));}else{if(_0x3f7879[_0x8885('0xd1')]>=_0x24cd19[_0x8885('0xd2')]){rpcDb[_0x8885('0x92')](_0x3f7879,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x8885('0xa4')](ut[_0x8885('0xa5')](_0x3f7879,'countcongestionretry',_0x24cd19[_0x8885('0xc4')]),_0x3f7879[_0x8885('0xa7')],_0x3f7879[_0x8885('0xa8')]);}}break;case'CANCEL':_0x24cd19['outboundRejectCallsDay']+=0x1;_0x3f7879[_0x8885('0xd3')]+=0x1;_0x3f7879[_0x8885('0x9a')]=ut[_0x8885('0x9b')](_0x3f7879);ut[_0x8885('0x8a')](_0x3f7879,0x14,_0x8885('0xd4'));ami[_0x8885('0x23')](_0x8885('0xd5'),ut[_0x8885('0x9d')](_0x3f7879,_0x8885('0xd6')));rpcDb[_0x8885('0x8e')](_0x3f7879,'[syncHangupRequest][logAgentReject]');if(ut[_0x8885('0x9b')](_0x3f7879)>=_0x24cd19[_0x8885('0x9f')]){_0x623162=ut[_0x8885('0xa0')](_0x3f7879,0x14,'AgentReject');rpcDb[_0x8885('0x92')](_0x623162,_0x8885('0xd7'));}else{if(_0x3f7879['countagentrejectretry']>=_0x24cd19['dialAgentRejectMaxRetry']){rpcDb['createCustomerFinal'](_0x3f7879,_0x8885('0xd7'));}else{rpcDb['rescheduleContact'](ut[_0x8885('0xa5')](_0x3f7879,_0x8885('0xd3'),_0x24cd19['dialAgentRejectRetryFrequency']),_0x3f7879[_0x8885('0xa7')],_0x3f7879[_0x8885('0xa8')]);}}break;case _0x8885('0xd8'):_0x24cd19[_0x8885('0x40')]+=0x1;_0x3f7879[_0x8885('0xd9')]+=0x1;_0x3f7879[_0x8885('0x9a')]=ut[_0x8885('0x9b')](_0x3f7879);ut[_0x8885('0x8a')](_0x3f7879,0xb,_0x8885('0xda'));rpcDb[_0x8885('0x8e')](_0x3f7879,_0x8885('0xdb'));if(ut[_0x8885('0x9b')](_0x3f7879)>=_0x24cd19[_0x8885('0x9f')]){_0x623162=ut[_0x8885('0xa0')](_0x3f7879,0xf,_0x8885('0xa1'));rpcDb[_0x8885('0x92')](_0x623162,_0x8885('0xdb'));}else{if(_0x3f7879[_0x8885('0xdc')]>=_0x24cd19['dialAbandonedMaxRety']){rpcDb[_0x8885('0x92')](_0x3f7879,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0x8885('0xa4')](ut['scheduledAt'](_0x3f7879,_0x8885('0xd9'),_0x24cd19[_0x8885('0xdd')]),_0x3f7879[_0x8885('0xa7')],_0x3f7879[_0x8885('0xa8')]);}}break;case'18':_0x24cd19[_0x8885('0x3f')]+=0x1;_0x3f7879[_0x8885('0xde')]+=0x1;_0x3f7879[_0x8885('0x9a')]=ut[_0x8885('0x9b')](_0x3f7879);ut[_0x8885('0x8a')](_0x3f7879,0x12,_0x5e82e6[_0x8885('0xdf')]||_0x5e82e6[_0x8885('0xe0')]);ami['emit'](_0x8885('0xe1'),ut[_0x8885('0x9d')](_0x3f7879,_0x8885('0xe2')));rpcDb[_0x8885('0x8e')](_0x3f7879,'[callProgressDetectingCustomer][hangupInAMD]');if(ut[_0x8885('0x9b')](_0x3f7879)>=_0x24cd19[_0x8885('0x9f')]){_0x623162=ut[_0x8885('0xa0')](_0x3f7879,0xf,_0x8885('0xa1'));rpcDb['createCustomerFinal'](_0x623162,_0x8885('0xe3'));}else{rpcDb[_0x8885('0x92')](_0x3f7879,_0x8885('0xe3'));}delete this[_0x8885('0x15')][_0x5e82e6[_0x8885('0xa9')]];break;case'19':_0x24cd19[_0x8885('0x3f')]+=0x1;_0x3f7879[_0x8885('0x9a')]=ut[_0x8885('0x9b')](_0x3f7879);ut[_0x8885('0x8a')](_0x3f7879,0x13,_0x5e82e6['cause-txt']||_0x5e82e6[_0x8885('0xe0')]);ami[_0x8885('0x23')](_0x8885('0xe1'),ut[_0x8885('0x9d')](_0x3f7879,_0x8885('0xe2')));rpcDb[_0x8885('0x8e')](_0x3f7879,'[callProgressDetectingCustomer][machine]');if(ut[_0x8885('0x9b')](_0x3f7879)>=_0x24cd19[_0x8885('0x9f')]){_0x623162=ut['cloneAction'](_0x3f7879,0xf,_0x8885('0xa1'));rpcDb[_0x8885('0x92')](_0x623162,_0x8885('0xe4'));}else{rpcDb[_0x8885('0x92')](_0x3f7879,'[callProgressDetectingCustomer][machine]');}delete this[_0x8885('0x15')][_0x5e82e6[_0x8885('0xa9')]];break;default:if(_0x3f7879[_0x8885('0x70')]){ut['decrementTalkink'](_0x24cd19,'[default]');ut['loggerError'](_0x8885('0xe5')+_0x24cd19[_0x8885('0x26')],_0x5e82e6);}_0x24cd19['outboundUnknownCallsDay']+=0x1;_0x3f7879[_0x8885('0x9a')]=ut[_0x8885('0x9b')](_0x3f7879);ut[_0x8885('0x8a')](_0x3f7879,0xc,_0x5e82e6[_0x8885('0xdf')]||_0x5e82e6[_0x8885('0xe0')]);rpcDb[_0x8885('0x8e')](_0x3f7879,_0x8885('0xe6'));if(ut[_0x8885('0x9b')](_0x3f7879)>=_0x24cd19[_0x8885('0x9f')]){_0x623162=ut[_0x8885('0xa0')](_0x3f7879,0xf,'Global');rpcDb[_0x8885('0x92')](_0x623162,_0x8885('0xe7'));}else{rpcDb[_0x8885('0x92')](_0x3f7879,_0x8885('0xe7'));}delete this[_0x8885('0x15')][_0x5e82e6['linkedid']];}if(!(_0x3f7879[_0x8885('0x70')]&&_0x484e1a==='16')){ut['updateOriginated'](_0x24cd19,_0x8885('0xe8'));logger[_0x8885('0x56')](_0x8885('0xe9'),_0x3f7879['uniqueid'],_0x8885('0xae'),_0x24cd19[_0x8885('0x26')],'originated:\x20',_0x24cd19['originated']);}if(_0x484e1a!==_0x8885('0xea')){delete this['actions'][_0x5e82e6['linkedid']];delete this[_0x8885('0x15')][_0x5e82e6[_0x8885('0xeb')]];}}};Preview[_0x8885('0xe')][_0x8885('0xec')]=function(_0x3000ba,_0x2d65e1,_0x8290ee){if(_[_0x8885('0xed')](_0x2d65e1)&&_0x8885('0xee')!==typeof _0x2d65e1){return;}if(_[_0x8885('0xed')](_0x8290ee)&&_0x8885('0xee')!==typeof _0x8290ee){return;}switch(_0x8290ee[_0x8885('0xef')]){case'0':ut[_0x8885('0xf0')](_0x3000ba,0x0,_0x8885('0xf1'));rpcDb[_0x8885('0xf2')](_0x3000ba,_0x8885('0xf3'));break;case'3':ut[_0x8885('0xf0')](_0x3000ba,0x3,'NoAnswer');rpcDb['createAgentHistory'](_0x3000ba,_0x8885('0xf4'));break;case'5':ut['logAgent'](_0x3000ba,0x5,'Busy');rpcDb[_0x8885('0xf2')](_0x3000ba,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0x8885('0xf0')](_0x3000ba,0x8,_0x8885('0xcd'));rpcDb[_0x8885('0xf2')](_0x3000ba,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x8885('0xf0')](_0x3000ba,0x16,_0x8885('0xf5'));rpcDb['createAgentHistory'](_0x3000ba,_0x8885('0xf6'));break;default:ut[_0x8885('0xf0')](_0x3000ba,0xc,_0x8290ee[_0x8885('0xef')]);rpcDb[_0x8885('0xf2')](_0x3000ba,'[callProgressDetectingAgent][logCongestion]');}ut['updateOriginated'](_0x2d65e1,'[callProgressDetectingAgent]');logger[_0x8885('0x56')](_0x8885('0xf7'),_0x3000ba[_0x8885('0xad')],_0x8885('0xae'),_0x2d65e1['name'],_0x8885('0x6e'),_0x2d65e1['originated']);delete this[_0x8885('0x15')][_0x3000ba[_0x8885('0xad')]];};Preview['prototype'][_0x8885('0xf8')]=function(_0x1165c2,_0x11d3bb,_0x1ef734,_0x53474f,_0xa9f34a){var _0x50b54f=this;return new BPromise(function(_0x37b397,_0x42893a){if(_[_0x8885('0x6a')](_0x11d3bb)||_[_0x8885('0x6a')](_0x11d3bb[_0x8885('0xf9')])||_[_0x8885('0x6a')](_0x11d3bb[_0x8885('0xf9')][_0x8885('0xfa')])||_[_0x8885('0x6a')](_0x11d3bb['VoiceQueueId'])){_0x42893a(ut[_0x8885('0x4a')]('Contact\x20is\x20undefined',_0x53474f,_0xa9f34a));return;}var _0x21329f=uuid['v4']();var _0x59d8c4=_0x50b54f[_0x8885('0x13')][_0x11d3bb['Queue'][_0x8885('0x26')]];var _0x2103cc=_0x1ef734?_0x50b54f[_0x8885('0x16')][_0x1ef734]['id']:undefined;_0x50b54f[_0x8885('0x15')][_0x21329f]=new Action(_0x11d3bb,_0x59d8c4,_0x21329f,_0x1ef734,_0x2103cc);var _0x3330f1=_0x50b54f['actions'][_0x21329f];_0x3330f1[_0x8885('0xa7')]=_0x53474f;_0x3330f1[_0x8885('0xa8')]=_0xa9f34a;_0x3330f1[_0x8885('0xfb')]=_0x1ef734;if(_[_0x8885('0xfc')](_0x1165c2)){_0x50b54f[_0x8885('0xfd')](_0x3330f1,_0x59d8c4,_0x11d3bb,_0x1ef734)[_0x8885('0x80')](function(_0x1fc67f){logger[_0x8885('0x56')](_0x8885('0xfe'),_0x8885('0xff')+_0x3330f1[_0x8885('0x6d')]+_0x8885('0x100')+_0x3330f1[_0x8885('0x101')],JSON[_0x8885('0x58')](_0x1fc67f));ami['emit'](_0x8885('0x102'),ut[_0x8885('0x9d')](_0x3330f1,'called',_0x50b54f[_0x8885('0x13')][_0x3330f1['queue']]));_0x37b397(ut[_0x8885('0x4a')](_0x8885('0x103')));})[_0x8885('0x76')](function(_0x383b5f){ut[_0x8885('0x5e')](_0x8885('0x104'),_0x383b5f);_0x42893a(ut[_0x8885('0x4a')]('Call\x20failed',_0x53474f,_0xa9f34a));});}else{_0x59d8c4[_0x8885('0x105')]+=0x1;ut['logBlacklist'](_0x3330f1);rpcDb[_0x8885('0x106')](_0x3330f1,_0x8885('0x107'));delete _0x50b54f['actions'][_0x21329f];_0x42893a(ut[_0x8885('0x4a')]('Contact\x20in\x20black\x20List',_0x53474f,_0xa9f34a));}});};Preview['prototype']['isTrunkReachable']=function(_0x17ba68){return!_[_0x8885('0x6a')](_0x17ba68)&&!_[_0x8885('0x6a')](_0x17ba68[_0x8885('0x26')])&&!_['isNil'](_0x17ba68[_0x8885('0x51')])&&_0x17ba68['active']&&!_['isNil'](this[_0x8885('0x14')][util[_0x8885('0x53')](_0x8885('0x108'),_0x17ba68[_0x8885('0x26')])])&&!_[_0x8885('0x6a')](this['trunks'][util[_0x8885('0x53')](_0x8885('0x108'),_0x17ba68[_0x8885('0x26')])][_0x8885('0x74')])&&(this[_0x8885('0x14')][util[_0x8885('0x53')]('SIP/%s',_0x17ba68[_0x8885('0x26')])][_0x8885('0x74')]==='reachable'||this[_0x8885('0x14')][util['format'](_0x8885('0x108'),_0x17ba68[_0x8885('0x26')])][_0x8885('0x74')]===_0x8885('0x109'));};Preview[_0x8885('0xe')][_0x8885('0x86')]=function(_0x230f56,_0x48f25c){var _0x255d37=this;return new BPromise(function(_0x8eafbc,_0x2a3a0b){_0x255d37[_0x8885('0x10a')](_0x230f56,_0x48f25c)[_0x8885('0x80')](function(_0x7a0310){_0x8eafbc(_[_0x8885('0x71')](_0x7a0310,[_0x8885('0x4a')]));})[_0x8885('0x76')](function(_0x1d2566){if(_0x1d2566[_0x8885('0x10b')]){rpcDb[_0x8885('0x10c')](_0x230f56);}if(_0x1d2566['active']){rpcDb[_0x8885('0x10d')](_0x230f56);}_0x2a3a0b(_[_0x8885('0x71')](_0x1d2566,['message']));});});};Preview['prototype'][_0x8885('0x10a')]=function(_0x1e4d9f,_0x481e6c){var _0x16ff49=this;return new BPromise(function(_0x372ae0,_0x534557){var _0x27176d,_0x19972a;rpcDb[_0x8885('0x10e')](_0x1e4d9f)[_0x8885('0x80')](function(_0x51c667){if(!_[_0x8885('0x6a')](_0x51c667[0x0])){_0x19972a=_0x51c667[0x0]['recallme']?![]:!![];_0x27176d=_0x51c667[0x0][_0x8885('0x10f')]?!![]:![];_0x27176d=_0x481e6c?!![]:_0x27176d;}var _0x37ff4c=_0x16ff49[_0x8885('0x110')](_0x51c667);if(_0x37ff4c['isValid']){rpcDb[_0x8885('0x111')](_[_0x8885('0x71')](_0x51c667[0x0],[_0x8885('0x112'),'Contact.phone']))['then'](function(_0x365414){_0x16ff49[_0x8885('0xf8')](_0x365414,_0x51c667[0x0],_0x481e6c,_0x19972a,_0x27176d)['then'](function(_0x3e6f01){_0x372ae0(_0x3e6f01);})[_0x8885('0x76')](function(_0xc6d82e){_0x534557(_0xc6d82e);});})[_0x8885('0x76')](function(_0x2ac30a){ut[_0x8885('0x5e')](_0x8885('0x113'),_0x2ac30a);_0x534557(ut['message'](_0x8885('0x114'),_0x19972a,_0x27176d));});}else{_0x534557(ut[_0x8885('0x4a')](_0x37ff4c[_0x8885('0x4a')],_0x19972a,_0x27176d));}})['catch'](function(_0x2a324a){ut['logger']('[Preview][getContactPreview]',_0x2a324a);_0x534557(ut[_0x8885('0x4a')](_0x8885('0x114'),![],!![]));});});};Preview[_0x8885('0xe')][_0x8885('0x110')]=function(_0x526c65){if(_['isNil'](_0x526c65)||_[_0x8885('0xfc')](_0x526c65)||!_[_0x8885('0x6a')](_0x526c65[0x0][_0x8885('0x84')])&&_[_0x8885('0x6a')](_0x526c65[0x0][_0x8885('0x84')][_0x8885('0x26')])){ut[_0x8885('0x5e')](_0x8885('0x115'),_0x526c65);return{'isValid':![],'message':_0x8885('0x116')};}var _0x53f36a=this[_0x8885('0x13')][_0x526c65[0x0][_0x8885('0x6c')][_0x8885('0x26')]];_0x53f36a['message']='ACTIVE';if(_[_0x8885('0x6a')](_0x53f36a)){ut[_0x8885('0x5e')](_0x8885('0x117'),_0x53f36a);return{'isValid':![],'message':_0x8885('0x118')};}if(!this['isTrunkReachable'](_0x53f36a[_0x8885('0x50')])){ut[_0x8885('0x5e')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x8885('0x119')+_0x53f36a['name']+_0x8885('0x11a'));if(!this[_0x8885('0x95')](_0x53f36a[_0x8885('0x11b')])){ut[_0x8885('0x5e')](_0x8885('0x11c'),_0x53f36a[_0x8885('0x26')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20work'};}}if(!ut[_0x8885('0x11d')](_0x53f36a[_0x8885('0x32')])){ut[_0x8885('0x5e')](_0x8885('0x11e'),_0x53f36a[_0x8885('0x26')]+'\x20Not\x20Active');return{'isValid':![],'message':_0x8885('0x119')+_0x53f36a[_0x8885('0x26')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x8885('0xe')][_0x8885('0xfd')]=function(_0xae642d,_0x581506,_0x264135,_0x1aab6d){var _0x1e290c=this;return new BPromise(function(_0x261041,_0x1863d9){var _0x5c02df=_0xae642d['uniqueid'];var _0x569d54=_0x1e290c[_0x8885('0x95')](_0x581506['Trunk'])?util[_0x8885('0x53')](_0x8885('0x11f'),_0x581506['Trunk'][_0x8885('0x26')],_[_0x8885('0x6a')](_0x581506[_0x8885('0x36')])?'':_0x581506['dialPrefix'][_0x8885('0x120')]()||'',_0x581506[_0x8885('0x121')]>0x0?_0x264135['Contact'][_0x8885('0xfa')][_0x8885('0x122')](_0x581506[_0x8885('0x121')]):_0x264135[_0x8885('0xf9')][_0x8885('0xfa')]):util['format'](_0x8885('0x11f'),_[_0x8885('0x6a')](_0x581506[_0x8885('0x11b')])?_0x581506[_0x8885('0x50')][_0x8885('0x26')]:_0x581506[_0x8885('0x11b')]['name'],_[_0x8885('0x6a')](_0x581506[_0x8885('0x36')])?'':_0x581506[_0x8885('0x36')][_0x8885('0x120')]()||'',_0x581506[_0x8885('0x121')]>0x0?_0x264135[_0x8885('0xf9')][_0x8885('0xfa')][_0x8885('0x122')](_0x581506['dialCutDigit']):_0x264135[_0x8885('0xf9')][_0x8885('0xfa')]);var _0x3c4049=_0x1e290c[_0x8885('0x95')](_0x581506[_0x8885('0x50')])?ut[_0x8885('0x123')](_0x581506[_0x8885('0x50')]['callerid'],_0x581506['dialOriginateCallerIdName'],_0x581506[_0x8885('0x124')]>0x0?ut[_0x8885('0x125')](_0x581506[_0x8885('0x34')],_0x581506[_0x8885('0x124')]):_0x581506['dialOriginateCallerIdNumber']):ut[_0x8885('0x123')](_[_0x8885('0x6a')](_0x581506[_0x8885('0x11b')])?_0x581506['Trunk'][_0x8885('0x126')]:_0x581506[_0x8885('0x11b')][_0x8885('0x126')],_0x581506[_0x8885('0x33')],_0x581506['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x581506[_0x8885('0x34')],_0x581506['dialRandomLastDigitCallerIdNumber']):_0x581506[_0x8885('0x34')]);if(_0x3c4049){_0xae642d['originatecalleridname']=ut[_0x8885('0x127')](_0x3c4049);_0xae642d['originatecalleridnum']=ut[_0x8885('0x128')](_0x3c4049);}var _0x162274=ut['addVariables'](_0x581506,_0x264135,_0x569d54,_0x3c4049,_0x5c02df,_0xae642d);_[_0x8885('0x129')](_0xae642d,ut[_0x8885('0x12a')](_0x162274));_0xae642d['starttime']=moment()[_0x8885('0x53')]('YYYY-MM-DD\x20HH:mm:ss');ami[_0x8885('0x12b')](ut[_0x8885('0x12c')](_0xae642d,_0x581506,_0x162274,_0xae642d[_0x8885('0xa8')],_0x1aab6d))['then'](function(_0x18de23){var _0xf8d504=_0xae642d['channelAgent'];if(!_[_0x8885('0x6a')](_0xf8d504)){if(!_['isNil'](_0x1e290c['agents'][_0xf8d504])){_0x1e290c[_0x8885('0x16')][_0xf8d504][_0x8885('0x12d')]=_0xae642d['calleridnum'];emit(util[_0x8885('0x53')](_0x8885('0x12e'),_0x1e290c[_0x8885('0x16')][_0xf8d504][_0x8885('0x26')]),_0x8885('0x12f'),{'destaccountcode':_0x1e290c[_0x8885('0x16')][_0xf8d504][_0x8885('0x130')],'destconnectedlinenum':_0xae642d[_0x8885('0x131')]});}}_0x581506['originated']+=0x1;logger[_0x8885('0x56')]('[originated][increment]',_0x5c02df,_0x8885('0xae'),_0x581506[_0x8885('0x26')],_0x8885('0x6e'),_0x581506[_0x8885('0x4b')]);_0x261041(_0x18de23);})[_0x8885('0x76')](function(_0xb86627){ut[_0x8885('0xf0')](_0xae642d,0xe,_0x8885('0x132'));rpcDb['createAgentHistory'](_0xae642d,_0x8885('0x133'));_0x1863d9(_0xb86627);});});};Preview['prototype'][_0x8885('0x1d')]=function(_0x8f892d){if(this[_0x8885('0x15')][_0x8f892d[_0x8885('0xa9')]]){this[_0x8885('0x15')][_0x8f892d[_0x8885('0xa9')]][_0x8885('0x75')]=_0x8f892d[_0x8885('0x75')];}};Preview[_0x8885('0xe')][_0x8885('0x18')]=function(_0x4fb592){var _0x2a870c=this;var _0x2a67f1=this[_0x8885('0x15')][_0x4fb592[_0x8885('0x134')]];if(_0x2a67f1){if(_0x2a67f1[_0x8885('0xfb')]&&this['agents'][_0x2a67f1[_0x8885('0xfb')]]){ut[_0x8885('0x135')](_0x2a67f1,this[_0x8885('0x16')][_0x2a67f1[_0x8885('0xfb')]]['name'],this[_0x8885('0x16')][_0x2a67f1[_0x8885('0xfb')]]['id']);}var _0x28e764=_[_0x8885('0x136')](_0x2a67f1);_0x28e764[_0x8885('0x137')]=moment()[_0x8885('0x53')](_0x8885('0xaa'));var _0x56e6c5=_0x2a870c[_0x8885('0x13')][_0x2a67f1[_0x8885('0x6d')]];if(ut[_0x8885('0x138')](_0x4fb592[_0x8885('0x139')])){if(_0x2a67f1[_0x8885('0xa7')]){rpcDb[_0x8885('0x10c')](_0x2a67f1[_0x8885('0x101')]);}if(_0x2a67f1['activeContact']){rpcDb['disableContact'](_0x2a67f1['idContact']);}ami[_0x8885('0x23')](_0x8885('0x13a'),ut[_0x8885('0x9d')](_0x2a67f1,'rejected',this[_0x8885('0x13')][_0x2a67f1[_0x8885('0x6d')]]));this[_0x8885('0xec')](_0x28e764,_0x56e6c5,_0x4fb592);}else{_0x2a67f1[_0x8885('0x89')]=moment()[_0x8885('0x53')](_0x8885('0xaa'));ut[_0x8885('0xf0')](_0x28e764,0x4,_0x8885('0xb7'));rpcDb[_0x8885('0xf2')](_0x28e764,_0x8885('0x13b'));}}};Preview['prototype'][_0x8885('0x13c')]=function(_0x310454){var _0x2737d5=this;var _0x3a8dac=this[_0x8885('0x15')][_0x310454[_0x8885('0xa9')]];var _0x3b6c8b;if(_0x3a8dac){_0x3b6c8b=this[_0x8885('0x13')][_0x3a8dac[_0x8885('0x6d')]];logger[_0x8885('0x56')](_0x8885('0x13d'),_0x310454[_0x8885('0xa9')],_0x8885('0xae'),_0x3b6c8b[_0x8885('0x26')],_0x8885('0x6f'),_0x3b6c8b[_0x8885('0x2b')]);}if(this[_0x8885('0x15')][_0x310454[_0x8885('0xa9')]]&&_0x310454['linkedid']!==_0x310454['uniqueid']){if(_0x310454['cause']==='16'&&this[_0x8885('0x15')][_0x310454[_0x8885('0xa9')]][_0x8885('0x70')]){this[_0x8885('0x98')](_0x310454,_0x310454[_0x8885('0xa9')],_0x310454[_0x8885('0x13e')]);}else if(this[_0x8885('0x15')][_0x310454[_0x8885('0xa9')]][_0x8885('0x70')]){logger['info'](_0x8885('0x13f'),_0x310454['linkedid'],_0x310454[_0x8885('0x13e')],'\x20Queue',_0x3b6c8b[_0x8885('0x26')],_0x8885('0x6f'),_0x3b6c8b['pTalking']);this['callProgressDetectingCustomer'](_0x310454,_0x310454[_0x8885('0xa9')],_0x310454['cause']);}}else if(_0x3a8dac&&_[_0x8885('0x6a')](_0x3a8dac[_0x8885('0x140')])&&_0x3b6c8b[_0x8885('0x141')]&&_0x310454[_0x8885('0xa9')]===_0x310454['uniqueid']&&_[_0x8885('0x6a')](_0x310454[_0x8885('0xef')])&&_0x310454[_0x8885('0x13e')]==='16'&&_0x310454['channelstate']==='6'&&_[_0x8885('0xed')](_0x3a8dac['transfer'])){if(_0x3a8dac[_0x8885('0xa7')]){rpcDb[_0x8885('0x10c')](_0x3a8dac[_0x8885('0x101')]);}if(_0x3a8dac[_0x8885('0xa8')]){rpcDb['disableContact'](_0x3a8dac[_0x8885('0x101')]);}_0x310454[_0x8885('0xef')]='22';this[_0x8885('0xec')](_0x3a8dac,_0x3b6c8b,_0x310454);}else if(_0x3a8dac&&_0x3a8dac[_0x8885('0x142')]){if(_0x310454[_0x8885('0x13e')]==='16'&&this[_0x8885('0x15')][_0x310454[_0x8885('0xa9')]][_0x8885('0x70')]){logger[_0x8885('0x56')]('[syncHangup][talking][transfer]',_0x310454[_0x8885('0xa9')],_0x310454[_0x8885('0x13e')],_0x8885('0xae'),_0x3b6c8b[_0x8885('0x26')],_0x8885('0x6f'),_0x3b6c8b[_0x8885('0x2b')]);this[_0x8885('0x98')](_0x310454,_0x310454[_0x8885('0xa9')],_0x310454['cause']);}else if(this[_0x8885('0x15')][_0x310454['linkedid']]['dialAnswer']){logger[_0x8885('0x56')](_0x8885('0x13f'),_0x310454[_0x8885('0xa9')],_0x310454[_0x8885('0x13e')],_0x8885('0xae'),_0x3b6c8b['name'],'pTalking:\x20',_0x3b6c8b[_0x8885('0x2b')]);this['callProgressDetectingCustomer'](_0x310454,_0x310454[_0x8885('0xa9')],_0x310454[_0x8885('0x13e')]);}}};Preview['prototype'][_0x8885('0x1b')]=function(_0x2b71c4){if(this[_0x8885('0x15')][_0x2b71c4[_0x8885('0xeb')]]&&_0x2b71c4[_0x8885('0xeb')]!==_0x2b71c4['destuniqueid']){this[_0x8885('0x98')](_0x2b71c4,_0x2b71c4[_0x8885('0xeb')],_0x2b71c4['dialstatus']);}};Preview[_0x8885('0xe')][_0x8885('0x143')]=function(_0x4935ea){if(this[_0x8885('0x15')][_0x4935ea[_0x8885('0xa9')]]&&_0x4935ea[_0x8885('0xa9')]!==_0x4935ea[_0x8885('0xad')]&&!this['actions'][_0x4935ea[_0x8885('0xa9')]]['dialAnswer']){if(_0x4935ea[_0x8885('0x13e')]==='1'){this[_0x8885('0x98')](_0x4935ea,_0x4935ea['linkedid'],_0x4935ea[_0x8885('0x13e')]);}}};Preview[_0x8885('0xe')][_0x8885('0x144')]=function(_0x2e6587,_0x3675e1,_0x2abf91){if(this[_0x8885('0x15')][_0x2e6587]){if(_[_0x8885('0x6a')](this[_0x8885('0x15')][_0x2e6587][_0x8885('0x145')])){this[_0x8885('0x15')][_0x2e6587][_0x8885('0x145')]={};}this['actions'][_0x2e6587][_0x8885('0x145')][_0x3675e1]=_0x2abf91;}};Preview[_0x8885('0xe')][_0x8885('0x1f')]=function(_0x737316){try{if(!_[_0x8885('0x6a')](_0x737316)){if(ut[_0x8885('0x146')](_['keys'](_0x737316['variable'])[0x0])){this[_0x8885('0x144')](_0x737316[_0x8885('0xad')],_[_0x8885('0x147')](_0x737316[_0x8885('0x148')])[0x0],_0x737316['value']);}}}catch(_0x3a440b){logger['error']('[syncVarSet][Preview]',util[_0x8885('0x149')](_0x3a440b,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0x8885('0x20')]=function(_0x118d16){if(_0x118d16){if(this[_0x8885('0x15')][_0x118d16[_0x8885('0x14a')]]){this[_0x8885('0x15')][_0x118d16[_0x8885('0x14a')]][_0x8885('0x142')]=!![];}}};Preview['prototype'][_0x8885('0x22')]=function(_0x3160c8){if(_0x3160c8){if(this[_0x8885('0x15')][_0x3160c8[_0x8885('0x14b')]]){this[_0x8885('0x15')][_0x3160c8[_0x8885('0x14b')]][_0x8885('0x142')]=!![];}}};module[_0x8885('0x14c')]=Preview; \ No newline at end of file +var _0xa6ed=['substring','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','originatecalleridnum','addVariables','merge','variablesAction','channelAgent','destconnectedlinenum','user:%s','accountcode','calleridnum','[originated][increment]','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','isFailure','response','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','unlockContact','[syncHangup][talking][transfer]','destuniqueid','variables','filterKey','keys','addVariable','value','error','[syncVarSet][Preview]','syncAttendedTransfer','transfertargetlinkedid','transfererlinkedid','exports','util','bluebird','uuid','moment','ioredis','../../../config/logger','preview','../ami','./rpcDb','redis','localhost','socket.io-emitter','prototype','enqueue','tail','sequence','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncBlindTransfer','loopCampaigns','campaignsPreview','emit','name','strategy','answered','available','sumBillable','talking','type','unmanaged','abandoned','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','stringify','md5','format','voice:queue:%s','voice_queue:save','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_presence:remove','pTalking','sendMessageOneNotActive','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','syncCampaigns','outbound','clearZombieChannels','hasOwnProperty','setMessage','recallMe','isNil','info','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','ListId','Action','status','channel','catch','No\x20such\x20channel','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','size','clearZombieChannel','agentReadyId','then','length','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','disableContact','starttime','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','[getContactRecallMe]','loggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','totalGlobal','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','ANSWER','YYYY-MM-DD\x20HH:mm:ss','responsetime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect','custom:agentConnectPreview','custom:agentcomplete','complete','total','[16]','countglobal','Answer','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','cloneAction','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','scheduledAt','NOANSWER','countnoanswerretry','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','cause-txt','dialstatus','amd','[callProgressDetectingCustomer][hangupInAMD]','custom:amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[originated][decrement][callProgressDetectingAgent]','phone','VoiceQueueId','Contact\x20is\x20undefined','lookAgent','isEmpty','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','unlock','execRun','validateContact','isValid','checkIsBlackList','Contact.phone','checkInBlack','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','execCall','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','Contact'];(function(_0xa51977,_0x2ec8ed){var _0x566fa6=function(_0x53497a){while(--_0x53497a){_0xa51977['push'](_0xa51977['shift']());}};_0x566fa6(++_0x2ec8ed);}(_0xa6ed,0x17c));var _0xda6e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa6ed[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0xda6e('0x0'));var _=require('lodash');var BPromise=require(_0xda6e('0x1'));var uuid=require(_0xda6e('0x2'));var moment=require(_0xda6e('0x3'));var md5=require('md5');var Redis=require(_0xda6e('0x4'));var config=require('../../../config/environment');var logger=require(_0xda6e('0x5'))(_0xda6e('0x6'));var loggerAction=require(_0xda6e('0x5'))('actionPreview');var ami=require(_0xda6e('0x7'));var rpcDb=require(_0xda6e('0x8'));var Action=require('./action');var ut=require('./util/util');config[_0xda6e('0x9')]=_['defaults'](config['redis'],{'host':_0xda6e('0xa'),'port':0x18eb});var io=require(_0xda6e('0xb'))(new Redis(config[_0xda6e('0x9')]));var Sequence=function(){};Sequence[_0xda6e('0xc')][_0xda6e('0xd')]=function(_0x25281b){this[_0xda6e('0xe')]=this[_0xda6e('0xe')]?this[_0xda6e('0xe')]['finally'](_0x25281b):_0x25281b();};function Preview(_0x28217f){this[_0xda6e('0xf')]=new Sequence();this['campaignsPreview']=_0x28217f[_0xda6e('0x10')];this[_0xda6e('0x11')]=_0x28217f[_0xda6e('0x11')];this[_0xda6e('0x12')]={};this[_0xda6e('0x13')]=_0x28217f[_0xda6e('0x13')];this[_0xda6e('0x14')]=0x0;ami['on'](_0xda6e('0x15'),this[_0xda6e('0x16')][_0xda6e('0x17')](this));ami['on'](_0xda6e('0x18'),this[_0xda6e('0x19')][_0xda6e('0x17')](this));ami['on'](_0xda6e('0x1a'),this[_0xda6e('0x1b')][_0xda6e('0x17')](this));ami['on'](_0xda6e('0x1c'),this['syncDialEnd']['bind'](this));ami['on'](_0xda6e('0x1d'),this[_0xda6e('0x1e')][_0xda6e('0x17')](this));ami['on'](_0xda6e('0x1f'),this[_0xda6e('0x20')][_0xda6e('0x17')](this));ami['on'](_0xda6e('0x21'),this['syncAttendedTransfer'][_0xda6e('0x17')](this));ami['on']('blindtransfer',this[_0xda6e('0x22')][_0xda6e('0x17')](this));this[_0xda6e('0x23')](this[_0xda6e('0x24')]);}function emit(_0x446112,_0x51b900,_0x83b6df){io['to'](_0x446112)[_0xda6e('0x25')](_0x51b900,_0x83b6df);}function emitCampaignPreview(_0x141dee){if(_0x141dee['type']==='outbound'){var _0x4e1139={'id':_0x141dee['id'],'name':_0x141dee[_0xda6e('0x26')],'strategy':_0x141dee[_0xda6e('0x27')],'answered':_0x141dee[_0xda6e('0x28')],'available':_0x141dee[_0xda6e('0x29')],'loggedIn':_0x141dee['loggedIn'],'pTalking':_0x141dee['pTalking'],'sumBillable':_0x141dee[_0xda6e('0x2a')],'sumDuration':_0x141dee['sumDuration'],'sumHoldTime':_0x141dee['sumHoldTime']||0x0,'talking':_0x141dee[_0xda6e('0x2b')],'total':_0x141dee['total'],'type':_0x141dee[_0xda6e('0x2c')],'unmanaged':_0x141dee[_0xda6e('0x2d')],'abandoned':_0x141dee[_0xda6e('0x2e')],'waiting':_0x141dee['waiting'],'loggedInDb':_0x141dee[_0xda6e('0x2f')],'dialActive':_0x141dee[_0xda6e('0x30')],'dialMethod':_0x141dee[_0xda6e('0x31')],'dialOriginateCallerIdName':_0x141dee[_0xda6e('0x32')],'dialOriginateCallerIdNumber':_0x141dee['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x141dee['dialOriginateTimeout'],'dialPrefix':_0x141dee['dialPrefix'],'outboundAnswerAgiCallsDay':_0x141dee[_0xda6e('0x33')],'outboundAnswerCallsDay':_0x141dee[_0xda6e('0x34')],'outboundBlacklistCallsDay':_0x141dee[_0xda6e('0x35')],'outboundBusyCallsDay':_0x141dee['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x141dee[_0xda6e('0x36')],'outboundDropCallsDayACS':_0x141dee[_0xda6e('0x37')],'outboundDropCallsDayCallersExit':_0x141dee[_0xda6e('0x38')],'outboundDropCallsDayTimeout':_0x141dee[_0xda6e('0x39')],'outboundNoAnswerCallsDay':_0x141dee[_0xda6e('0x3a')],'outboundNoSuchCallsDay':_0x141dee[_0xda6e('0x3b')],'outboundOriginateFailureCallsDay':_0x141dee['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x141dee[_0xda6e('0x3c')],'outboundRejectCallsDay':_0x141dee[_0xda6e('0x3d')],'outboundUnknownCallsDay':_0x141dee[_0xda6e('0x3e')],'outboundAbandonedCallsDay':_0x141dee['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x141dee[_0xda6e('0x3f')],'predictiveIntervalAvgHoldtime':_0x141dee['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x141dee[_0xda6e('0x40')],'predictiveIntervalDroppedCallsCallersExit':_0x141dee['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x141dee[_0xda6e('0x41')],'predictiveIntervalErlangCalls':_0x141dee['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x141dee[_0xda6e('0x42')],'predictiveIntervalHitRate':_0x141dee[_0xda6e('0x43')],'predictiveIntervalMultiplicativeFactor':_0x141dee['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x141dee['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x141dee[_0xda6e('0x44')],'predictiveIntervalTotalCalls':_0x141dee[_0xda6e('0x45')],'message':_0x141dee[_0xda6e('0x46')],'originated':_0x141dee[_0xda6e('0x47')],'erlangCalls':_0x141dee[_0xda6e('0x48')],'erlangCallToSecond':_0x141dee['erlangCallToSecond'],'erlangAbandonmentRate':_0x141dee[_0xda6e('0x49')],'erlangBusyFactor':_0x141dee[_0xda6e('0x4a')],'startPredictive':_0x141dee[_0xda6e('0x4b')],'startProgressive':_0x141dee[_0xda6e('0x4c')]};if(_0x141dee[_0xda6e('0x4d')]){_0x4e1139[_0xda6e('0x4d')]={'id':_0x141dee[_0xda6e('0x4d')]['id'],'name':_0x141dee[_0xda6e('0x4d')]['name'],'active':_0x141dee['Trunk'][_0xda6e('0x4e')],'callerid':_0x141dee[_0xda6e('0x4d')][_0xda6e('0x4f')]};}if(_0x141dee['Interval']){_0x4e1139[_0xda6e('0x50')]={'id':_0x141dee[_0xda6e('0x50')]['id'],'name':_0x141dee[_0xda6e('0x50')][_0xda6e('0x26')]};}var _0x4c45be=md5(JSON[_0xda6e('0x51')](_0x4e1139));if(_0x141dee[_0xda6e('0x52')]!==_0x4c45be){_0x141dee[_0xda6e('0x52')]=_0x4c45be;emit(util[_0xda6e('0x53')](_0xda6e('0x54'),_0x4e1139[_0xda6e('0x26')]),_0xda6e('0x55'),_0x4e1139);}}}function emitVoiceQueueChannelRemove(_0x345eae){logger['info'](_0xda6e('0x56'),JSON[_0xda6e('0x51')](_0x345eae));emit(util[_0xda6e('0x53')](_0xda6e('0x54'),_0x345eae[_0xda6e('0x26')]),'voice_queue_channel:remove',_0x345eae);io[_0xda6e('0x25')](_0xda6e('0x57'),_0x345eae);}function notSendMessagesQueue(_0x10a8e4){if(_0x10a8e4['sendMessageOneNotActive']){if(_0x10a8e4[_0xda6e('0x47')]===0x0&&_0x10a8e4[_0xda6e('0x58')]===0x0){_0x10a8e4[_0xda6e('0x59')]=![];_0x10a8e4['available']=0x0;_0x10a8e4['paused']=0x0;_0x10a8e4['message']=_0xda6e('0x5a');ut[_0xda6e('0x5b')](_0xda6e('0x5c'),_0x10a8e4[_0xda6e('0x26')]+_0xda6e('0x5d'));}else{_0x10a8e4['message']=_0xda6e('0x5e');ut[_0xda6e('0x5b')](_0xda6e('0x5c'),_0x10a8e4[_0xda6e('0x26')]+_0xda6e('0x5f'));}emitCampaignPreview(_0x10a8e4);}}Preview[_0xda6e('0xc')][_0xda6e('0x23')]=function(){var _0x413baf=this;setInterval(function(){_0x413baf[_0xda6e('0x60')]();},0x7cf);};Preview[_0xda6e('0xc')][_0xda6e('0x60')]=function(){var _0x39ff96=this[_0xda6e('0x24')];this['clockClearZombieChannels']+=0x1;for(var _0x57066f in _0x39ff96){if(_0x39ff96['hasOwnProperty'](_0x57066f)&&(_0x39ff96[_0x57066f][_0xda6e('0x31')]===_0xda6e('0x6')||_0x39ff96[_0x57066f][_0xda6e('0x31')]==='booked')&&_0x39ff96[_0x57066f][_0xda6e('0x2c')]===_0xda6e('0x61')){if(this[_0xda6e('0x14')]>0x7){this[_0xda6e('0x14')]=0x0;this[_0xda6e('0x62')]();}}if(_0x39ff96[_0xda6e('0x63')](_0x57066f)&&_0x39ff96[_0x57066f][_0xda6e('0x31')]===_0xda6e('0x6')&&_0x39ff96[_0x57066f][_0xda6e('0x2c')]===_0xda6e('0x61')){if(_0x39ff96[_0x57066f][_0xda6e('0x30')]){this[_0xda6e('0x64')](_0x39ff96[_0x57066f]);this[_0xda6e('0x65')](_0x39ff96[_0x57066f]);}else{notSendMessagesQueue(_0x39ff96[_0x57066f]);}}}};Preview['prototype']['clearZombieChannel']=function(_0x793a2c){var _0xafcdc2=this;this['sequence'][_0xda6e('0xd')](function(){if(!_[_0xda6e('0x66')](_0xafcdc2[_0xda6e('0x12')][_0x793a2c])){loggerAction[_0xda6e('0x67')](_0xda6e('0x68'),_0x793a2c,_0xda6e('0x69'),_0xafcdc2[_0xda6e('0x12')][_0x793a2c][_0xda6e('0x6a')],_0xda6e('0x6b'),JSON[_0xda6e('0x51')](_0xafcdc2['campaignsPreview'][_0xafcdc2[_0xda6e('0x12')][_0x793a2c][_0xda6e('0x6a')]]['originated']),_0xda6e('0x6c'),JSON['stringify'](_0xafcdc2[_0xda6e('0x24')][_0xafcdc2[_0xda6e('0x12')][_0x793a2c][_0xda6e('0x6a')]][_0xda6e('0x58')]),JSON['stringify'](_0xafcdc2[_0xda6e('0x12')][_0x793a2c][_0xda6e('0x6d')]),JSON[_0xda6e('0x51')](_[_0xda6e('0x6e')](_0xafcdc2[_0xda6e('0x12')][_0x793a2c],['contactId','UserId','VoiceQueueId',_0xda6e('0x6f')])));return ami[_0xda6e('0x70')]({'action':_0xda6e('0x71'),'channel':_0xafcdc2[_0xda6e('0x12')][_0x793a2c][_0xda6e('0x72')]})[_0xda6e('0x73')](function(_0x3b75bd){if(_0x3b75bd[_0xda6e('0x46')]===_0xda6e('0x74')){setTimeout(function(){if(_0xafcdc2['actions'][_0x793a2c]){ut['updateOriginated'](_0xafcdc2[_0xda6e('0x24')][_0xafcdc2[_0xda6e('0x12')][_0x793a2c][_0xda6e('0x6a')]],_0xda6e('0x75'));if(_0xafcdc2[_0xda6e('0x12')][_0x793a2c][_0xda6e('0x6d')]===!![]){ut[_0xda6e('0x76')](_0xafcdc2['campaignsPreview'][_0xafcdc2[_0xda6e('0x12')][_0x793a2c][_0xda6e('0x6a')]],_0xda6e('0x75'));ut[_0xda6e('0x77')](_0xda6e('0x78')+_0x793a2c,_0xafcdc2[_0xda6e('0x12')][_0x793a2c][_0xda6e('0x6a')]);}ut[_0xda6e('0x77')]('[Dialer][checkChannel][Preview]'+_0x793a2c,_0xafcdc2[_0xda6e('0x12')][_0x793a2c]['queue']);delete _0xafcdc2['actions'][_0x793a2c];}},0x2328);}});}});};Preview[_0xda6e('0xc')][_0xda6e('0x62')]=function(){var _0xfd814b=this;loggerAction[_0xda6e('0x67')]('[action]',_[_0xda6e('0x79')](this[_0xda6e('0x12')]));for(var _0x4b8d26 in this[_0xda6e('0x12')]){if(_0xfd814b[_0xda6e('0x12')]['hasOwnProperty'](_0x4b8d26)){_0xfd814b[_0xda6e('0x7a')](_0x4b8d26);}}};Preview[_0xda6e('0xc')][_0xda6e('0x65')]=function(_0x2eff53){var _0x100c74=this;rpcDb['getContactRecallMe'](_0x2eff53['id'],ut[_0xda6e('0x7b')](this[_0xda6e('0x13')]))[_0xda6e('0x7c')](function(_0x2e6321){if(!_[_0xda6e('0x66')](_0x2e6321)){for(var _0xad9f3d=0x0;_0xad9f3d<_0x2e6321[_0xda6e('0x7d')];_0xad9f3d+=0x1){if(ut['getDiff'](_0x2e6321[_0xad9f3d][_0xda6e('0x7e')])<_0x2eff53[_0xda6e('0x7f')]*0x3c){if(_0x2e6321[_0xad9f3d]['Agent']&&!_0x2e6321[_0xad9f3d][_0xda6e('0x80')][_0xda6e('0x81')]){_0x100c74[_0xda6e('0x82')](_0x2e6321[_0xad9f3d]['id'])['then'](ut[_0xda6e('0x83')](_0xda6e('0x84')))[_0xda6e('0x73')](ut[_0xda6e('0x83')](_0xda6e('0x84')));}else{rpcDb[_0xda6e('0x85')](_0x2e6321[_0xad9f3d]['id']);}}else{var _0xba30e5=new Action(_0x2e6321[_0xad9f3d],_0x2eff53);_0xba30e5[_0xda6e('0x86')]=moment()[_0xda6e('0x53')]('YYYY-MM-DD\x20HH:mm:ss');_0x2eff53[_0xda6e('0x3c')]+=0x1;ut[_0xda6e('0x87')](_0xba30e5,0x17,_0xda6e('0x88'));if(_0x2eff53[_0xda6e('0x89')]){rpcDb[_0xda6e('0x8a')](ut[_0xda6e('0x8b')](_0x2e6321[_0xad9f3d]));rpcDb['createCustomerHistory'](_0xba30e5,_0xda6e('0x8c'));}else{ut[_0xda6e('0x87')](_0xba30e5,0x16,_0xda6e('0x8d'));rpcDb[_0xda6e('0x8e')](_0xba30e5,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0xba30e5,_0xda6e('0x8f'));}}}}})['catch'](ut[_0xda6e('0x83')](_0xda6e('0x90')));};Preview[_0xda6e('0xc')][_0xda6e('0x64')]=function(_0x5a0891){_0x5a0891[_0xda6e('0x59')]=!![];if(ut['IsNotLoggedIn'](_0x5a0891[_0xda6e('0x91')])){_0x5a0891['message']=_0xda6e('0x92');}else if(!ut[_0xda6e('0x93')](_0x5a0891[_0xda6e('0x30')])){_0x5a0891['message']=_0xda6e('0x5a');}else if(!this[_0xda6e('0x94')](_0x5a0891[_0xda6e('0x4d')])){if(!this['isTrunkReachable'](_0x5a0891[_0xda6e('0x95')])){_0x5a0891['message']='TRUNK_IS_NOT_REACHABLE';}else{_0x5a0891[_0xda6e('0x46')]='ACTIVE';}}else{_0x5a0891[_0xda6e('0x46')]=_0xda6e('0x96');}emitCampaignPreview(_0x5a0891);};Preview[_0xda6e('0xc')][_0xda6e('0x97')]=function(_0x155530,_0x300aaa,_0x444d43){var _0x3b0eb5=this;var _0x1a0c89=this[_0xda6e('0x12')][_0x300aaa];var _0x4923f0=this['campaignsPreview'][_0x1a0c89['queue']];var _0x26f1c4;if(_0x4923f0){switch(_0x444d43){case'1':_0x4923f0[_0xda6e('0x3b')]+=0x1;_0x1a0c89[_0xda6e('0x98')]+=0x1;_0x1a0c89['countglobal']=ut[_0xda6e('0x99')](_0x1a0c89);ut['logCustomer'](_0x1a0c89,0x0,'NoSuchNumber');ami[_0xda6e('0x25')](_0xda6e('0x9a'),ut[_0xda6e('0x9b')](_0x1a0c89,_0xda6e('0x9c')));rpcDb['createCustomerHistory'](_0x1a0c89,_0xda6e('0x9d'));if(ut[_0xda6e('0x99')](_0x1a0c89)>=_0x4923f0[_0xda6e('0x9e')]){_0x26f1c4=ut['cloneAction'](_0x1a0c89,0xf,_0xda6e('0x9f'));rpcDb[_0xda6e('0xa0')](_0x26f1c4,_0xda6e('0xa1'));}else{if(_0x1a0c89[_0xda6e('0x98')]>=_0x4923f0[_0xda6e('0xa2')]){rpcDb['createCustomerFinal'](_0x1a0c89,_0xda6e('0xa1'));}else{rpcDb[_0xda6e('0xa3')](ut['scheduledAt'](_0x1a0c89,_0xda6e('0x98'),_0x4923f0[_0xda6e('0xa4')]),_0x1a0c89[_0xda6e('0xa5')],_0x1a0c89[_0xda6e('0xa6')]);}}delete this['actions'][_0x155530[_0xda6e('0xa7')]];break;case _0xda6e('0xa8'):var _0x5b1109=moment()['format'](_0xda6e('0xa9'));_0x1a0c89[_0xda6e('0xaa')]=_0x5b1109;_0x1a0c89['answertime']=_0x5b1109;_0x1a0c89[_0xda6e('0x6d')]=!![];_0x4923f0[_0xda6e('0x58')]+=0x1;logger[_0xda6e('0x67')](_0xda6e('0xab'),_0x1a0c89[_0xda6e('0xac')],_0xda6e('0xad'),_0x4923f0['name'],_0xda6e('0x6c'),_0x4923f0[_0xda6e('0x58')]);ami[_0xda6e('0x25')](_0xda6e('0xae'),ut[_0xda6e('0x9b')](_0x1a0c89,_0xda6e('0xaf'),this[_0xda6e('0x24')][_0x1a0c89['queue']]));if(_0x4923f0['acw']){ami[_0xda6e('0x25')](_0xda6e('0xb0'),ut['buildAcw'](_0x1a0c89));}break;case'16':ami[_0xda6e('0x25')](_0xda6e('0xb1'),ut['buildObj'](_0x1a0c89,_0xda6e('0xb2'),this[_0xda6e('0x24')][_0x1a0c89[_0xda6e('0x6a')]]));emitVoiceQueueChannelRemove(ut[_0xda6e('0x9b')](_0x1a0c89,_0xda6e('0xb2')));_0x4923f0['outboundAnswerCallsDay']+=0x1;_0x4923f0[_0xda6e('0xb3')]+=0x1;_0x4923f0[_0xda6e('0x28')]+=0x1;ut[_0xda6e('0x76')](_0x4923f0,_0xda6e('0xb4'));_0x1a0c89[_0xda6e('0xb5')]=ut[_0xda6e('0x99')](_0x1a0c89);ut[_0xda6e('0x87')](_0x1a0c89,0x4,_0xda6e('0xb6'));rpcDb[_0xda6e('0x8e')](_0x1a0c89,'[callProgressDetectingCustomer][logAnswer]');rpcDb['createCustomerFinal'](_0x1a0c89,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0xda6e('0xb7')](_0x1a0c89);_0x4923f0['sumDuration']+=_0x1a0c89[_0xda6e('0xb8')];_0x4923f0[_0xda6e('0x2a')]+=_0x1a0c89[_0xda6e('0xb8')];logger['info'](_0xda6e('0xb9'),_0x1a0c89[_0xda6e('0xac')],_0xda6e('0xad'),_0x4923f0[_0xda6e('0x26')],_0xda6e('0x6c'),_0x4923f0[_0xda6e('0x58')]);delete this[_0xda6e('0x12')][_0x155530[_0xda6e('0xa7')]];break;case'BUSY':_0x4923f0['outboundBusyCallsDay']+=0x1;_0x1a0c89[_0xda6e('0xba')]+=0x1;_0x1a0c89['countglobal']=ut[_0xda6e('0x99')](_0x1a0c89);ut[_0xda6e('0x87')](_0x1a0c89,0x5,_0xda6e('0xbb'));ami[_0xda6e('0x25')](_0xda6e('0xbc'),ut[_0xda6e('0x9b')](_0x1a0c89,_0xda6e('0xbd')));rpcDb[_0xda6e('0x8e')](_0x1a0c89,_0xda6e('0xbe'));if(ut[_0xda6e('0x99')](_0x1a0c89)>=_0x4923f0['dialGlobalMaxRetry']){_0x26f1c4=ut[_0xda6e('0xbf')](_0x1a0c89,0xf,_0xda6e('0x9f'));rpcDb[_0xda6e('0xa0')](_0x26f1c4,_0xda6e('0xc0'));}else{if(_0x1a0c89['countbusyretry']>=_0x4923f0[_0xda6e('0xc1')]){rpcDb[_0xda6e('0xa0')](_0x1a0c89,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0xda6e('0xa3')](ut[_0xda6e('0xc2')](_0x1a0c89,_0xda6e('0xba'),_0x4923f0['dialBusyRetryFrequency']),_0x1a0c89[_0xda6e('0xa5')],_0x1a0c89[_0xda6e('0xa6')]);}}break;case _0xda6e('0xc3'):_0x4923f0['outboundNoAnswerCallsDay']+=0x1;_0x1a0c89[_0xda6e('0xc4')]+=0x1;_0x1a0c89[_0xda6e('0xb5')]=ut[_0xda6e('0x99')](_0x1a0c89);ut[_0xda6e('0x87')](_0x1a0c89,0x3,_0xda6e('0xc5'));ami['emit'](_0xda6e('0xc6'),ut[_0xda6e('0x9b')](_0x1a0c89,_0xda6e('0xc7')));rpcDb[_0xda6e('0x8e')](_0x1a0c89,_0xda6e('0xc8'));if(ut[_0xda6e('0x99')](_0x1a0c89)>=_0x4923f0[_0xda6e('0x9e')]){_0x26f1c4=ut[_0xda6e('0xbf')](_0x1a0c89,0xf,_0xda6e('0x9f'));rpcDb[_0xda6e('0xa0')](_0x26f1c4,_0xda6e('0xc9'));}else{if(_0x1a0c89[_0xda6e('0xc4')]>=_0x4923f0[_0xda6e('0xca')]){rpcDb['createCustomerFinal'](_0x1a0c89,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0xda6e('0xa3')](ut['scheduledAt'](_0x1a0c89,'countnoanswerretry',_0x4923f0[_0xda6e('0xcb')]),_0x1a0c89[_0xda6e('0xa5')],_0x1a0c89[_0xda6e('0xa6')]);}}break;case _0xda6e('0xcc'):_0x4923f0[_0xda6e('0x36')]+=0x1;_0x1a0c89[_0xda6e('0xcd')]+=0x1;_0x1a0c89[_0xda6e('0xb5')]=ut[_0xda6e('0x99')](_0x1a0c89);ut['logCustomer'](_0x1a0c89,0x8,_0xda6e('0xce'));ami[_0xda6e('0x25')](_0xda6e('0xcf'),ut['buildObj'](_0x1a0c89,_0xda6e('0xd0')));rpcDb[_0xda6e('0x8e')](_0x1a0c89,_0xda6e('0xd1'));if(ut['totalGlobal'](_0x1a0c89)>=_0x4923f0[_0xda6e('0x9e')]){_0x26f1c4=ut[_0xda6e('0xbf')](_0x1a0c89,0xf,_0xda6e('0x9f'));rpcDb[_0xda6e('0xa0')](_0x26f1c4,_0xda6e('0xd2'));}else{if(_0x1a0c89[_0xda6e('0xcd')]>=_0x4923f0['dialCongestionMaxRetry']){rpcDb[_0xda6e('0xa0')](_0x1a0c89,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x1a0c89,_0xda6e('0xcd'),_0x4923f0['dialBusyRetryFrequency']),_0x1a0c89[_0xda6e('0xa5')],_0x1a0c89[_0xda6e('0xa6')]);}}break;case _0xda6e('0xd3'):_0x4923f0[_0xda6e('0x3d')]+=0x1;_0x1a0c89[_0xda6e('0xd4')]+=0x1;_0x1a0c89['countglobal']=ut['totalGlobal'](_0x1a0c89);ut[_0xda6e('0x87')](_0x1a0c89,0x14,_0xda6e('0xd5'));ami[_0xda6e('0x25')](_0xda6e('0xd6'),ut['buildObj'](_0x1a0c89,_0xda6e('0xd7')));rpcDb[_0xda6e('0x8e')](_0x1a0c89,'[syncHangupRequest][logAgentReject]');if(ut[_0xda6e('0x99')](_0x1a0c89)>=_0x4923f0[_0xda6e('0x9e')]){_0x26f1c4=ut[_0xda6e('0xbf')](_0x1a0c89,0x14,'AgentReject');rpcDb['createCustomerFinal'](_0x26f1c4,_0xda6e('0xd8'));}else{if(_0x1a0c89[_0xda6e('0xd4')]>=_0x4923f0[_0xda6e('0xd9')]){rpcDb[_0xda6e('0xa0')](_0x1a0c89,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0xda6e('0xa3')](ut[_0xda6e('0xc2')](_0x1a0c89,'countagentrejectretry',_0x4923f0[_0xda6e('0xda')]),_0x1a0c89[_0xda6e('0xa5')],_0x1a0c89[_0xda6e('0xa6')]);}}break;case _0xda6e('0xdb'):_0x4923f0[_0xda6e('0xdc')]+=0x1;_0x1a0c89[_0xda6e('0xdd')]+=0x1;_0x1a0c89[_0xda6e('0xb5')]=ut['totalGlobal'](_0x1a0c89);ut[_0xda6e('0x87')](_0x1a0c89,0xb,'Abandoned');rpcDb[_0xda6e('0x8e')](_0x1a0c89,_0xda6e('0xde'));if(ut['totalGlobal'](_0x1a0c89)>=_0x4923f0[_0xda6e('0x9e')]){_0x26f1c4=ut['cloneAction'](_0x1a0c89,0xf,_0xda6e('0x9f'));rpcDb[_0xda6e('0xa0')](_0x26f1c4,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x1a0c89[_0xda6e('0xdf')]>=_0x4923f0['dialAbandonedMaxRety']){rpcDb[_0xda6e('0xa0')](_0x1a0c89,_0xda6e('0xde'));}else{rpcDb['rescheduleContact'](ut[_0xda6e('0xc2')](_0x1a0c89,_0xda6e('0xdd'),_0x4923f0['dialAbandonedRetryFrequency']),_0x1a0c89[_0xda6e('0xa5')],_0x1a0c89[_0xda6e('0xa6')]);}}break;case'18':_0x4923f0[_0xda6e('0x3e')]+=0x1;_0x1a0c89['countmachineretry']+=0x1;_0x1a0c89[_0xda6e('0xb5')]=ut[_0xda6e('0x99')](_0x1a0c89);ut[_0xda6e('0x87')](_0x1a0c89,0x12,_0x155530[_0xda6e('0xe0')]||_0x155530[_0xda6e('0xe1')]);ami[_0xda6e('0x25')]('custom:amd',ut['buildObj'](_0x1a0c89,_0xda6e('0xe2')));rpcDb[_0xda6e('0x8e')](_0x1a0c89,_0xda6e('0xe3'));if(ut[_0xda6e('0x99')](_0x1a0c89)>=_0x4923f0['dialGlobalMaxRetry']){_0x26f1c4=ut['cloneAction'](_0x1a0c89,0xf,_0xda6e('0x9f'));rpcDb[_0xda6e('0xa0')](_0x26f1c4,_0xda6e('0xe3'));}else{rpcDb[_0xda6e('0xa0')](_0x1a0c89,'[callProgressDetectingCustomer][hangupInAMD]');}delete this[_0xda6e('0x12')][_0x155530['linkedid']];break;case'19':_0x4923f0[_0xda6e('0x3e')]+=0x1;_0x1a0c89['countglobal']=ut['totalGlobal'](_0x1a0c89);ut[_0xda6e('0x87')](_0x1a0c89,0x13,_0x155530[_0xda6e('0xe0')]||_0x155530['dialstatus']);ami[_0xda6e('0x25')](_0xda6e('0xe4'),ut['buildObj'](_0x1a0c89,_0xda6e('0xe2')));rpcDb[_0xda6e('0x8e')](_0x1a0c89,_0xda6e('0xe5'));if(ut['totalGlobal'](_0x1a0c89)>=_0x4923f0[_0xda6e('0x9e')]){_0x26f1c4=ut[_0xda6e('0xbf')](_0x1a0c89,0xf,_0xda6e('0x9f'));rpcDb[_0xda6e('0xa0')](_0x26f1c4,_0xda6e('0xe5'));}else{rpcDb[_0xda6e('0xa0')](_0x1a0c89,_0xda6e('0xe5'));}delete this[_0xda6e('0x12')][_0x155530['linkedid']];break;default:if(_0x1a0c89[_0xda6e('0x6d')]){ut[_0xda6e('0x76')](_0x4923f0,_0xda6e('0xe6'));ut[_0xda6e('0x77')](_0xda6e('0xe7')+_0x4923f0[_0xda6e('0x26')],_0x155530);}_0x4923f0[_0xda6e('0x3e')]+=0x1;_0x1a0c89[_0xda6e('0xb5')]=ut[_0xda6e('0x99')](_0x1a0c89);ut[_0xda6e('0x87')](_0x1a0c89,0xc,_0x155530[_0xda6e('0xe0')]||_0x155530[_0xda6e('0xe1')]);rpcDb[_0xda6e('0x8e')](_0x1a0c89,'[callProgressDetectingCustomer][logUnknown]');if(ut[_0xda6e('0x99')](_0x1a0c89)>=_0x4923f0[_0xda6e('0x9e')]){_0x26f1c4=ut[_0xda6e('0xbf')](_0x1a0c89,0xf,_0xda6e('0x9f'));rpcDb[_0xda6e('0xa0')](_0x26f1c4,_0xda6e('0xe8'));}else{rpcDb[_0xda6e('0xa0')](_0x1a0c89,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0xda6e('0x12')][_0x155530[_0xda6e('0xa7')]];}if(!(_0x1a0c89['dialAnswer']&&_0x444d43==='16')){ut[_0xda6e('0xe9')](_0x4923f0,'[callProgressDetectingCustomer]');logger[_0xda6e('0x67')](_0xda6e('0xea'),_0x1a0c89[_0xda6e('0xac')],_0xda6e('0xad'),_0x4923f0[_0xda6e('0x26')],_0xda6e('0x6b'),_0x4923f0[_0xda6e('0x47')]);}if(_0x444d43!==_0xda6e('0xa8')){delete this[_0xda6e('0x12')][_0x155530[_0xda6e('0xa7')]];delete this['actions'][_0x155530[_0xda6e('0xeb')]];}}};Preview[_0xda6e('0xc')][_0xda6e('0xec')]=function(_0x21dd8f,_0x71c2b8,_0x16e2c2){if(_[_0xda6e('0xed')](_0x71c2b8)&&_0xda6e('0xee')!==typeof _0x71c2b8){return;}if(_[_0xda6e('0xed')](_0x16e2c2)&&'object'!==typeof _0x16e2c2){return;}switch(_0x16e2c2[_0xda6e('0xef')]){case'0':ut[_0xda6e('0xf0')](_0x21dd8f,0x0,_0xda6e('0xf1'));rpcDb[_0xda6e('0xf2')](_0x21dd8f,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut['logAgent'](_0x21dd8f,0x3,_0xda6e('0xc5'));rpcDb[_0xda6e('0xf2')](_0x21dd8f,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0xda6e('0xf0')](_0x21dd8f,0x5,_0xda6e('0xbb'));rpcDb[_0xda6e('0xf2')](_0x21dd8f,_0xda6e('0xf3'));break;case'8':ut[_0xda6e('0xf0')](_0x21dd8f,0x8,_0xda6e('0xce'));rpcDb[_0xda6e('0xf2')](_0x21dd8f,_0xda6e('0xf4'));break;case'22':ut[_0xda6e('0xf0')](_0x21dd8f,0x16,_0xda6e('0xf5'));rpcDb[_0xda6e('0xf2')](_0x21dd8f,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0xda6e('0xf0')](_0x21dd8f,0xc,_0x16e2c2[_0xda6e('0xef')]);rpcDb[_0xda6e('0xf2')](_0x21dd8f,_0xda6e('0xf4'));}ut['updateOriginated'](_0x71c2b8,'[callProgressDetectingAgent]');logger[_0xda6e('0x67')](_0xda6e('0xf6'),_0x21dd8f['uniqueid'],_0xda6e('0xad'),_0x71c2b8[_0xda6e('0x26')],'originated:\x20',_0x71c2b8['originated']);delete this['actions'][_0x21dd8f['uniqueid']];};Preview[_0xda6e('0xc')]['checkInBlack']=function(_0x1c1e68,_0x318304,_0x264c17,_0x1498bd,_0x339432){var _0xc41004=this;return new BPromise(function(_0x3dc408,_0x582981){if(_[_0xda6e('0x66')](_0x318304)||_[_0xda6e('0x66')](_0x318304['Contact'])||_['isNil'](_0x318304['Contact'][_0xda6e('0xf7')])||_[_0xda6e('0x66')](_0x318304[_0xda6e('0xf8')])){_0x582981(ut[_0xda6e('0x46')](_0xda6e('0xf9'),_0x1498bd,_0x339432));return;}var _0x51650b=uuid['v4']();var _0xccf1de=_0xc41004[_0xda6e('0x24')][_0x318304[_0xda6e('0x69')]['name']];var _0xf0be12=_0x264c17?_0xc41004[_0xda6e('0x13')][_0x264c17]['id']:undefined;_0xc41004[_0xda6e('0x12')][_0x51650b]=new Action(_0x318304,_0xccf1de,_0x51650b,_0x264c17,_0xf0be12);var _0x51d548=_0xc41004[_0xda6e('0x12')][_0x51650b];_0x51d548['unlockAgent']=_0x1498bd;_0x51d548['activeContact']=_0x339432;_0x51d548[_0xda6e('0xfa')]=_0x264c17;if(_[_0xda6e('0xfb')](_0x1c1e68)){_0xc41004['execCall'](_0x51d548,_0xccf1de,_0x318304,_0x264c17)[_0xda6e('0x7c')](function(_0xf1ddcd){logger['info']('[Preview][execCall][success]',_0xda6e('0xfc')+_0x51d548[_0xda6e('0x6a')]+_0xda6e('0xfd')+_0x51d548[_0xda6e('0xfe')],JSON['stringify'](_0xf1ddcd));ami[_0xda6e('0x25')](_0xda6e('0xff'),ut[_0xda6e('0x9b')](_0x51d548,_0xda6e('0x100'),_0xc41004[_0xda6e('0x24')][_0x51d548[_0xda6e('0x6a')]]));_0x3dc408(ut[_0xda6e('0x46')](_0xda6e('0x101')));})[_0xda6e('0x73')](function(_0x16cc6d){ut['logger'](_0xda6e('0x102'),_0x16cc6d);_0x582981(ut['message']('Call\x20failed',_0x1498bd,_0x339432));});}else{_0xccf1de[_0xda6e('0x35')]+=0x1;ut[_0xda6e('0x103')](_0x51d548);rpcDb['createHistory'](_0x51d548,_0xda6e('0x104'));delete _0xc41004['actions'][_0x51650b];_0x582981(ut['message'](_0xda6e('0x105'),_0x1498bd,_0x339432));}});};Preview[_0xda6e('0xc')][_0xda6e('0x94')]=function(_0x11620e){return!_[_0xda6e('0x66')](_0x11620e)&&!_[_0xda6e('0x66')](_0x11620e[_0xda6e('0x26')])&&!_[_0xda6e('0x66')](_0x11620e[_0xda6e('0x4e')])&&_0x11620e[_0xda6e('0x4e')]&&!_[_0xda6e('0x66')](this[_0xda6e('0x11')][util[_0xda6e('0x53')](_0xda6e('0x106'),_0x11620e[_0xda6e('0x26')])])&&!_[_0xda6e('0x66')](this[_0xda6e('0x11')][util[_0xda6e('0x53')](_0xda6e('0x106'),_0x11620e[_0xda6e('0x26')])]['status'])&&(this[_0xda6e('0x11')][util[_0xda6e('0x53')](_0xda6e('0x106'),_0x11620e['name'])][_0xda6e('0x71')]===_0xda6e('0x107')||this[_0xda6e('0x11')][util['format'](_0xda6e('0x106'),_0x11620e[_0xda6e('0x26')])][_0xda6e('0x71')]==='unmonitored');};Preview[_0xda6e('0xc')][_0xda6e('0x82')]=function(_0x5ac1bd,_0x2905f3){var _0x2fd19f=this;return new BPromise(function(_0x13f60e,_0x586eb1){_0x2fd19f['execRun'](_0x5ac1bd,_0x2905f3)[_0xda6e('0x7c')](function(_0x5c5a37){_0x13f60e(_[_0xda6e('0x6e')](_0x5c5a37,[_0xda6e('0x46')]));})[_0xda6e('0x73')](function(_0x1ed7c2){if(_0x1ed7c2[_0xda6e('0x108')]){rpcDb['unlockContact'](_0x5ac1bd);}if(_0x1ed7c2[_0xda6e('0x4e')]){rpcDb['disableContact'](_0x5ac1bd);}_0x586eb1(_['pick'](_0x1ed7c2,['message']));});});};Preview[_0xda6e('0xc')][_0xda6e('0x109')]=function(_0x45116f,_0x53bc05){var _0x54eee3=this;return new BPromise(function(_0x9c0ee3,_0x33b110){var _0x2a2161,_0x3ba9f5;rpcDb['getContactPreview'](_0x45116f)[_0xda6e('0x7c')](function(_0x344648){if(!_[_0xda6e('0x66')](_0x344648[0x0])){_0x3ba9f5=_0x344648[0x0]['recallme']?![]:!![];_0x2a2161=_0x344648[0x0]['recallme']?!![]:![];_0x2a2161=_0x53bc05?!![]:_0x2a2161;}var _0xc6ecea=_0x54eee3[_0xda6e('0x10a')](_0x344648);if(_0xc6ecea[_0xda6e('0x10b')]){rpcDb[_0xda6e('0x10c')](_['pick'](_0x344648[0x0],[_0xda6e('0xf8'),_0xda6e('0x10d')]))[_0xda6e('0x7c')](function(_0x1bb153){_0x54eee3[_0xda6e('0x10e')](_0x1bb153,_0x344648[0x0],_0x53bc05,_0x3ba9f5,_0x2a2161)[_0xda6e('0x7c')](function(_0x2829c){_0x9c0ee3(_0x2829c);})['catch'](function(_0xba8ccf){_0x33b110(_0xba8ccf);});})[_0xda6e('0x73')](function(_0x4356a2){ut[_0xda6e('0x5b')](_0xda6e('0x10f'),_0x4356a2);_0x33b110(ut[_0xda6e('0x46')](_0xda6e('0x110'),_0x3ba9f5,_0x2a2161));});}else{_0x33b110(ut[_0xda6e('0x46')](_0xc6ecea[_0xda6e('0x46')],_0x3ba9f5,_0x2a2161));}})[_0xda6e('0x73')](function(_0x15a04d){ut[_0xda6e('0x5b')]('[Preview][getContactPreview]',_0x15a04d);_0x33b110(ut[_0xda6e('0x46')]('Call\x20unsuccessful',![],!![]));});});};Preview[_0xda6e('0xc')][_0xda6e('0x10a')]=function(_0x4b4d34){if(_['isNil'](_0x4b4d34)||_[_0xda6e('0xfb')](_0x4b4d34)||!_[_0xda6e('0x66')](_0x4b4d34[0x0][_0xda6e('0x80')])&&_[_0xda6e('0x66')](_0x4b4d34[0x0][_0xda6e('0x80')][_0xda6e('0x26')])){ut[_0xda6e('0x5b')](_0xda6e('0x111'),_0x4b4d34);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x10472b=this[_0xda6e('0x24')][_0x4b4d34[0x0]['Queue'][_0xda6e('0x26')]];_0x10472b[_0xda6e('0x46')]=_0xda6e('0x96');if(_['isNil'](_0x10472b)){ut[_0xda6e('0x5b')](_0xda6e('0x112'),_0x10472b);return{'isValid':![],'message':_0xda6e('0x113')};}if(!this[_0xda6e('0x94')](_0x10472b['Trunk'])){ut[_0xda6e('0x5b')](_0xda6e('0x114'),_0xda6e('0x115')+_0x10472b[_0xda6e('0x26')]+_0xda6e('0x116'));if(!this[_0xda6e('0x94')](_0x10472b[_0xda6e('0x95')])){ut[_0xda6e('0x5b')](_0xda6e('0x114'),_0x10472b[_0xda6e('0x26')]+_0xda6e('0x117'));return{'isValid':![],'message':'Trunk\x20not\x20work'};}}if(!ut[_0xda6e('0x93')](_0x10472b[_0xda6e('0x30')])){ut[_0xda6e('0x5b')](_0xda6e('0x118'),_0x10472b[_0xda6e('0x26')]+_0xda6e('0x119'));return{'isValid':![],'message':_0xda6e('0x115')+_0x10472b[_0xda6e('0x26')]+_0xda6e('0x119')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0xda6e('0xc')][_0xda6e('0x11a')]=function(_0x483d0a,_0x382b92,_0x726733,_0x426719){var _0x12a9e8=this;return new BPromise(function(_0x1f5a88,_0x561419){var _0x31d04c=_0x483d0a[_0xda6e('0xac')];var _0x518719=_0x12a9e8[_0xda6e('0x94')](_0x382b92[_0xda6e('0x4d')])?util[_0xda6e('0x53')](_0xda6e('0x11b'),_0x382b92[_0xda6e('0x4d')]['name'],_[_0xda6e('0x66')](_0x382b92[_0xda6e('0x11c')])?'':_0x382b92[_0xda6e('0x11c')][_0xda6e('0x11d')]()||'',_0x382b92[_0xda6e('0x11e')]>0x0?_0x726733[_0xda6e('0x11f')][_0xda6e('0xf7')][_0xda6e('0x120')](_0x382b92[_0xda6e('0x11e')]):_0x726733[_0xda6e('0x11f')]['phone']):util[_0xda6e('0x53')]('SIP/%s/%s%s',_[_0xda6e('0x66')](_0x382b92[_0xda6e('0x95')])?_0x382b92[_0xda6e('0x4d')][_0xda6e('0x26')]:_0x382b92[_0xda6e('0x95')][_0xda6e('0x26')],_[_0xda6e('0x66')](_0x382b92[_0xda6e('0x11c')])?'':_0x382b92['dialPrefix'][_0xda6e('0x11d')]()||'',_0x382b92['dialCutDigit']>0x0?_0x726733['Contact'][_0xda6e('0xf7')][_0xda6e('0x120')](_0x382b92[_0xda6e('0x11e')]):_0x726733[_0xda6e('0x11f')][_0xda6e('0xf7')]);var _0x35eefd=_0x12a9e8[_0xda6e('0x94')](_0x382b92[_0xda6e('0x4d')])?ut[_0xda6e('0x121')](_0x382b92[_0xda6e('0x4d')]['callerid'],_0x382b92[_0xda6e('0x32')],_0x382b92[_0xda6e('0x122')]>0x0?ut[_0xda6e('0x123')](_0x382b92[_0xda6e('0x124')],_0x382b92[_0xda6e('0x122')]):_0x382b92[_0xda6e('0x124')]):ut[_0xda6e('0x121')](_[_0xda6e('0x66')](_0x382b92[_0xda6e('0x95')])?_0x382b92[_0xda6e('0x4d')][_0xda6e('0x4f')]:_0x382b92[_0xda6e('0x95')][_0xda6e('0x4f')],_0x382b92[_0xda6e('0x32')],_0x382b92[_0xda6e('0x122')]>0x0?ut[_0xda6e('0x123')](_0x382b92[_0xda6e('0x124')],_0x382b92[_0xda6e('0x122')]):_0x382b92[_0xda6e('0x124')]);if(_0x35eefd){_0x483d0a[_0xda6e('0x125')]=ut['extractCalleridName'](_0x35eefd);_0x483d0a[_0xda6e('0x126')]=ut['extractCalleridNumber'](_0x35eefd);}var _0x5a1a27=ut[_0xda6e('0x127')](_0x382b92,_0x726733,_0x518719,_0x35eefd,_0x31d04c,_0x483d0a);_[_0xda6e('0x128')](_0x483d0a,ut['toLowerVariables'](_0x5a1a27));_0x483d0a[_0xda6e('0x86')]=moment()[_0xda6e('0x53')](_0xda6e('0xa9'));ami[_0xda6e('0x70')](ut[_0xda6e('0x129')](_0x483d0a,_0x382b92,_0x5a1a27,_0x483d0a['activeContact'],_0x426719))[_0xda6e('0x7c')](function(_0x26d071){var _0x5f2606=_0x483d0a[_0xda6e('0x12a')];if(!_[_0xda6e('0x66')](_0x5f2606)){if(!_['isNil'](_0x12a9e8['agents'][_0x5f2606])){_0x12a9e8[_0xda6e('0x13')][_0x5f2606][_0xda6e('0x12b')]=_0x483d0a['calleridnum'];emit(util[_0xda6e('0x53')](_0xda6e('0x12c'),_0x12a9e8[_0xda6e('0x13')][_0x5f2606][_0xda6e('0x26')]),'user:agentconnect',{'destaccountcode':_0x12a9e8[_0xda6e('0x13')][_0x5f2606][_0xda6e('0x12d')],'destconnectedlinenum':_0x483d0a[_0xda6e('0x12e')]});}}_0x382b92[_0xda6e('0x47')]+=0x1;logger[_0xda6e('0x67')](_0xda6e('0x12f'),_0x31d04c,_0xda6e('0xad'),_0x382b92[_0xda6e('0x26')],_0xda6e('0x6b'),_0x382b92['originated']);_0x1f5a88(_0x26d071);})['catch'](function(_0x2e2aa8){ut['logAgent'](_0x483d0a,0xe,'OriginateError');rpcDb[_0xda6e('0xf2')](_0x483d0a,_0xda6e('0x130'));_0x561419(_0x2e2aa8);});});};Preview[_0xda6e('0xc')][_0xda6e('0x1e')]=function(_0x6ecf0f){if(this[_0xda6e('0x12')][_0x6ecf0f[_0xda6e('0xa7')]]){this[_0xda6e('0x12')][_0x6ecf0f['linkedid']]['channel']=_0x6ecf0f[_0xda6e('0x72')];}};Preview[_0xda6e('0xc')][_0xda6e('0x16')]=function(_0x50dfd6){var _0x5a3a05=this;var _0x26464e=this[_0xda6e('0x12')][_0x50dfd6[_0xda6e('0x131')]];if(_0x26464e){if(_0x26464e[_0xda6e('0xfa')]&&this[_0xda6e('0x13')][_0x26464e[_0xda6e('0xfa')]]){ut[_0xda6e('0x132')](_0x26464e,this['agents'][_0x26464e[_0xda6e('0xfa')]]['name'],this['agents'][_0x26464e[_0xda6e('0xfa')]]['id']);}var _0x1da43d=_[_0xda6e('0x133')](_0x26464e);_0x1da43d[_0xda6e('0xaa')]=moment()['format'](_0xda6e('0xa9'));var _0x1cc931=_0x5a3a05[_0xda6e('0x24')][_0x26464e[_0xda6e('0x6a')]];if(ut[_0xda6e('0x134')](_0x50dfd6[_0xda6e('0x135')])){if(_0x26464e[_0xda6e('0xa5')]){rpcDb['unlockContact'](_0x26464e[_0xda6e('0xfe')]);}if(_0x26464e[_0xda6e('0xa6')]){rpcDb[_0xda6e('0x85')](_0x26464e[_0xda6e('0xfe')]);}ami[_0xda6e('0x25')](_0xda6e('0x136'),ut[_0xda6e('0x9b')](_0x26464e,_0xda6e('0x137'),this[_0xda6e('0x24')][_0x26464e['queue']]));this[_0xda6e('0xec')](_0x1da43d,_0x1cc931,_0x50dfd6);}else{_0x26464e['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');ut[_0xda6e('0xf0')](_0x1da43d,0x4,_0xda6e('0xb6'));rpcDb[_0xda6e('0xf2')](_0x1da43d,_0xda6e('0x138'));}}};Preview['prototype'][_0xda6e('0x19')]=function(_0x3e801a){var _0x244136=this;var _0x353d88=this['actions'][_0x3e801a[_0xda6e('0xa7')]];var _0x2fcc32;if(_0x353d88){_0x2fcc32=this[_0xda6e('0x24')][_0x353d88[_0xda6e('0x6a')]];logger[_0xda6e('0x67')](_0xda6e('0x139'),_0x3e801a[_0xda6e('0xa7')],'\x20Queue',_0x2fcc32[_0xda6e('0x26')],_0xda6e('0x6c'),_0x2fcc32[_0xda6e('0x58')]);}if(this[_0xda6e('0x12')][_0x3e801a[_0xda6e('0xa7')]]&&_0x3e801a['linkedid']!==_0x3e801a[_0xda6e('0xac')]){if(_0x3e801a[_0xda6e('0x13a')]==='16'&&this['actions'][_0x3e801a[_0xda6e('0xa7')]][_0xda6e('0x6d')]){this[_0xda6e('0x97')](_0x3e801a,_0x3e801a[_0xda6e('0xa7')],_0x3e801a[_0xda6e('0x13a')]);}else if(this[_0xda6e('0x12')][_0x3e801a[_0xda6e('0xa7')]][_0xda6e('0x6d')]){logger[_0xda6e('0x67')](_0xda6e('0x13b'),_0x3e801a[_0xda6e('0xa7')],_0x3e801a[_0xda6e('0x13a')],'\x20Queue',_0x2fcc32[_0xda6e('0x26')],_0xda6e('0x6c'),_0x2fcc32[_0xda6e('0x58')]);this[_0xda6e('0x97')](_0x3e801a,_0x3e801a['linkedid'],_0x3e801a['cause']);}}else if(_0x353d88&&_['isNil'](_0x353d88[_0xda6e('0x13c')])&&_0x2fcc32[_0xda6e('0x13d')]&&_0x3e801a['linkedid']===_0x3e801a['uniqueid']&&_[_0xda6e('0x66')](_0x3e801a[_0xda6e('0xef')])&&_0x3e801a['cause']==='16'&&_0x3e801a[_0xda6e('0x13e')]==='6'&&_[_0xda6e('0xed')](_0x353d88[_0xda6e('0x13f')])){if(_0x353d88[_0xda6e('0xa5')]){rpcDb[_0xda6e('0x140')](_0x353d88[_0xda6e('0xfe')]);}if(_0x353d88['activeContact']){rpcDb['disableContact'](_0x353d88['idContact']);}_0x3e801a['reason']='22';this[_0xda6e('0xec')](_0x353d88,_0x2fcc32,_0x3e801a);}else if(_0x353d88&&_0x353d88[_0xda6e('0x13f')]){if(_0x3e801a['cause']==='16'&&this['actions'][_0x3e801a[_0xda6e('0xa7')]][_0xda6e('0x6d')]){logger['info'](_0xda6e('0x141'),_0x3e801a[_0xda6e('0xa7')],_0x3e801a[_0xda6e('0x13a')],'\x20Queue',_0x2fcc32[_0xda6e('0x26')],_0xda6e('0x6c'),_0x2fcc32[_0xda6e('0x58')]);this[_0xda6e('0x97')](_0x3e801a,_0x3e801a[_0xda6e('0xa7')],_0x3e801a[_0xda6e('0x13a')]);}else if(this[_0xda6e('0x12')][_0x3e801a[_0xda6e('0xa7')]][_0xda6e('0x6d')]){logger[_0xda6e('0x67')](_0xda6e('0x13b'),_0x3e801a[_0xda6e('0xa7')],_0x3e801a['cause'],_0xda6e('0xad'),_0x2fcc32['name'],_0xda6e('0x6c'),_0x2fcc32[_0xda6e('0x58')]);this[_0xda6e('0x97')](_0x3e801a,_0x3e801a[_0xda6e('0xa7')],_0x3e801a['cause']);}}};Preview[_0xda6e('0xc')]['syncDialEnd']=function(_0x12174f){if(this['actions'][_0x12174f[_0xda6e('0xeb')]]&&_0x12174f[_0xda6e('0xeb')]!==_0x12174f[_0xda6e('0x142')]){this['callProgressDetectingCustomer'](_0x12174f,_0x12174f['destlinkedid'],_0x12174f[_0xda6e('0xe1')]);}};Preview[_0xda6e('0xc')][_0xda6e('0x1b')]=function(_0x159687){if(this[_0xda6e('0x12')][_0x159687[_0xda6e('0xa7')]]&&_0x159687['linkedid']!==_0x159687[_0xda6e('0xac')]&&!this[_0xda6e('0x12')][_0x159687[_0xda6e('0xa7')]]['dialAnswer']){if(_0x159687['cause']==='1'){this[_0xda6e('0x97')](_0x159687,_0x159687[_0xda6e('0xa7')],_0x159687[_0xda6e('0x13a')]);}}};Preview[_0xda6e('0xc')]['addVariable']=function(_0x479f79,_0x4aaf0c,_0x360abd){if(this['actions'][_0x479f79]){if(_[_0xda6e('0x66')](this[_0xda6e('0x12')][_0x479f79][_0xda6e('0x143')])){this[_0xda6e('0x12')][_0x479f79][_0xda6e('0x143')]={};}this[_0xda6e('0x12')][_0x479f79][_0xda6e('0x143')][_0x4aaf0c]=_0x360abd;}};Preview[_0xda6e('0xc')]['syncVarSet']=function(_0x80bf2b){try{if(!_[_0xda6e('0x66')](_0x80bf2b)){if(ut[_0xda6e('0x144')](_[_0xda6e('0x145')](_0x80bf2b['variable'])[0x0])){this[_0xda6e('0x146')](_0x80bf2b[_0xda6e('0xac')],_[_0xda6e('0x145')](_0x80bf2b['variable'])[0x0],_0x80bf2b[_0xda6e('0x147')]);}}}catch(_0x471ebf){logger[_0xda6e('0x148')](_0xda6e('0x149'),util['inspect'](_0x471ebf,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0xda6e('0x14a')]=function(_0x22ab8e){if(_0x22ab8e){if(this['actions'][_0x22ab8e[_0xda6e('0x14b')]]){this[_0xda6e('0x12')][_0x22ab8e['transfertargetlinkedid']][_0xda6e('0x13f')]=!![];}}};Preview[_0xda6e('0xc')][_0xda6e('0x22')]=function(_0x36a981){if(_0x36a981){if(this['actions'][_0x36a981[_0xda6e('0x14c')]]){this[_0xda6e('0x12')][_0x36a981[_0xda6e('0x14c')]]['transfer']=!![];}}};module[_0xda6e('0x14d')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 49151b5..4d747ed 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 _0x9950=['[createHistory]\x20','resolve','createHistory','catch','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','createAgentHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','context','from-sip','exten','holdtime','assigned','lastAssignedTo','membername','queuecallerexitreason','COMPLETED','create','getContactRecallMe','util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','then'];(function(_0x1849b2,_0x55d03c){var _0x595990=function(_0x3616f4){while(--_0x3616f4){_0x1849b2['push'](_0x1849b2['shift']());}};_0x595990(++_0x55d03c);}(_0x9950,0xc8));var _0x0995=function(_0x2eb6f8,_0x284c92){_0x2eb6f8=_0x2eb6f8-0x0;var _0x3962c6=_0x9950[_0x2eb6f8];return _0x3962c6;};'use strict';var util=require(_0x0995('0x0'));var BPromise=require(_0x0995('0x1'));var logger=require(_0x0995('0x2'))(_0x0995('0x3'));var _=require('lodash');var cmHopper=require(_0x0995('0x4'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x0995('0x5'));var voiceQueueRt=require(_0x0995('0x6'));var agentReportPreview=require(_0x0995('0x7'));var voiceQueueReport=require(_0x0995('0x8'));function loggerCatch(_0xb6ce77){return function(_0x1f2f61){logger[_0x0995('0x9')](_0xb6ce77,util[_0x0995('0xa')](_0x1f2f61,{'showHidden':![],'depth':null}));};}function create(_0x579455){return BPromise['resolve']()[_0x0995('0xb')](cmHopperHistory['createHistory'](_0x579455))['catch'](loggerCatch(_0x0995('0xc')));}function createAgent(_0x196ed9){return BPromise[_0x0995('0xd')]()[_0x0995('0xb')](agentReportPreview[_0x0995('0xe')](_0x196ed9))[_0x0995('0xf')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x34e8d9){return BPromise[_0x0995('0xd')]()[_0x0995('0xb')](cmHopper[_0x0995('0x10')](_0x34e8d9,!![]))['catch'](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x0995('0x11')]=function(_0x22fdbc){return BPromise[_0x0995('0xd')]()['then'](cmHopperBlack['checkIsBlackList'](_0x22fdbc))[_0x0995('0xf')](loggerCatch(_0x0995('0x12')));};exports['getContactPreview']=function(_0x4496d8){return BPromise['resolve']()[_0x0995('0xb')](cmHopper['getContactPreview'](_0x4496d8))[_0x0995('0xf')](loggerCatch('[getContactPreview]\x20'));};exports[_0x0995('0xe')]=function(_0x36e29b,_0x1648ba){create(_0x36e29b)['catch'](loggerCatch(_0x1648ba));moveContact(_0x36e29b)[_0x0995('0xf')](loggerCatch(_0x1648ba));};exports[_0x0995('0x13')]=function(_0x121dc3,_0x208af5){createAgent(_0x121dc3)['catch'](loggerCatch(_0x208af5));};exports['createCustomerHistory']=function(_0x2e3b78,_0x173774){create(_0x2e3b78)[_0x0995('0xf')](loggerCatch(_0x173774));};exports[_0x0995('0x14')]=function(_0x35dc69,_0x4f87cd){moveContact(_0x35dc69)[_0x0995('0xf')](loggerCatch(_0x4f87cd));};exports[_0x0995('0x15')]=function(_0x1518f3,_0x316bb5,_0x5722c2){if(_0x316bb5){_0x1518f3[_0x0995('0x16')]=null;}if(_0x5722c2){_0x1518f3[_0x0995('0x17')]=![];}return BPromise['resolve']()[_0x0995('0xb')](cmHopper[_0x0995('0x15')](_0x1518f3))['catch'](loggerCatch(_0x0995('0x18')));};exports['countReScheduled']=function(_0x519784){return BPromise[_0x0995('0xd')]()[_0x0995('0xb')](cmHopper[_0x0995('0x19')](_0x519784))[_0x0995('0xf')](loggerCatch(_0x0995('0x1a')));};exports['unlockContact']=function(_0x2b40fb){return BPromise[_0x0995('0xd')]()['then'](cmHopper[_0x0995('0x1b')]({'UserId':null},_0x2b40fb,0x1))[_0x0995('0xf')](loggerCatch('[unlockContact]\x20'));};exports[_0x0995('0x1c')]=function(_0x2353b1){return BPromise[_0x0995('0xd')]()['then'](cmHopper[_0x0995('0x1b')]({'active':![]},_0x2353b1,0x1))[_0x0995('0xf')](loggerCatch(_0x0995('0x1d')));};exports[_0x0995('0x1e')]=function(_0x40b268){var _0x293d11={};_0x293d11[_0x0995('0x1f')]=_0x40b268[_0x0995('0x1f')];_0x293d11[_0x0995('0x20')]=_0x40b268[_0x0995('0x20')];_0x293d11[_0x0995('0x21')]=_0x40b268[_0x0995('0x21')];_0x293d11[_0x0995('0x22')]=_0x40b268[_0x0995('0x22')];_0x293d11[_0x0995('0x23')]=_0x40b268['queue'];_0x293d11[_0x0995('0x24')]=_0x40b268['answertime'];_0x293d11[_0x0995('0x25')]=_0x40b268[_0x0995('0x26')];_0x293d11[_0x0995('0x27')]=0x1;_0x293d11[_0x0995('0x28')]=_0x40b268[_0x0995('0x29')];_0x293d11['connectedlinename']=_0x40b268['membername'];_0x293d11[_0x0995('0x2a')]=_0x0995('0x2b');_0x293d11[_0x0995('0x2c')]='xcally-motion-preview';_0x293d11[_0x0995('0x2d')]=0x0;_0x293d11[_0x0995('0x2e')]=0x1;_0x293d11[_0x0995('0x2f')]=_0x40b268[_0x0995('0x30')];_0x293d11[_0x0995('0x31')]=_0x0995('0x32');return BPromise['resolve']()[_0x0995('0xb')](voiceQueueReport[_0x0995('0x33')](_0x293d11))[_0x0995('0xf')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x0995('0x34')]=function(_0x2a5a5b,_0x1df2f2){return BPromise[_0x0995('0xd')]()['then'](cmHopper['getContactRecallMe'](_0x2a5a5b,_0x1df2f2))[_0x0995('0xf')](loggerCatch('[GetContactRecallMe]\x20'));};exports['rescheduleContactInQueue']=function(_0x13cf16){return BPromise['resolve']()[_0x0995('0xb')](cmHopper['rescheduleContact'](_0x13cf16,!![],!![]))[_0x0995('0xf')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file +var _0x8ac7=['membername','context','from-sip','exten','holdtime','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[rescheduleContactInQueue]\x20','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','rescheduleContact','active','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','endtime','connectedlinename'];(function(_0x46a30d,_0x34b9ad){var _0x3d1914=function(_0x363d20){while(--_0x363d20){_0x46a30d['push'](_0x46a30d['shift']());}};_0x3d1914(++_0x34b9ad);}(_0x8ac7,0x115));var _0x78ac=function(_0x4e81ec,_0x432bd4){_0x4e81ec=_0x4e81ec-0x0;var _0x2ea1ba=_0x8ac7[_0x4e81ec];return _0x2ea1ba;};'use strict';var util=require('util');var BPromise=require(_0x78ac('0x0'));var logger=require(_0x78ac('0x1'))(_0x78ac('0x2'));var _=require(_0x78ac('0x3'));var cmHopper=require(_0x78ac('0x4'));var cmHopperFinal=require(_0x78ac('0x5'));var cmHopperHistory=require(_0x78ac('0x6'));var cmHopperBlack=require(_0x78ac('0x7'));var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0x78ac('0x8'));var voiceQueueReport=require(_0x78ac('0x9'));function loggerCatch(_0x68555a){return function(_0x1d2bc2){logger[_0x78ac('0xa')](_0x68555a,util[_0x78ac('0xb')](_0x1d2bc2,{'showHidden':![],'depth':null}));};}function create(_0x18e512){return BPromise[_0x78ac('0xc')]()[_0x78ac('0xd')](cmHopperHistory[_0x78ac('0xe')](_0x18e512))[_0x78ac('0xf')](loggerCatch(_0x78ac('0x10')));}function createAgent(_0x2b318f){return BPromise[_0x78ac('0xc')]()['then'](agentReportPreview[_0x78ac('0xe')](_0x2b318f))[_0x78ac('0xf')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x66f222){return BPromise[_0x78ac('0xc')]()[_0x78ac('0xd')](cmHopper[_0x78ac('0x11')](_0x66f222,!![]))[_0x78ac('0xf')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x78ac('0x12')]=function(_0x323590){return BPromise[_0x78ac('0xc')]()[_0x78ac('0xd')](cmHopperBlack[_0x78ac('0x12')](_0x323590))[_0x78ac('0xf')](loggerCatch(_0x78ac('0x13')));};exports['getContactPreview']=function(_0x1a5752){return BPromise[_0x78ac('0xc')]()[_0x78ac('0xd')](cmHopper[_0x78ac('0x14')](_0x1a5752))['catch'](loggerCatch(_0x78ac('0x15')));};exports[_0x78ac('0xe')]=function(_0x4a30e6,_0x2f15a2){create(_0x4a30e6)[_0x78ac('0xf')](loggerCatch(_0x2f15a2));moveContact(_0x4a30e6)[_0x78ac('0xf')](loggerCatch(_0x2f15a2));};exports['createAgentHistory']=function(_0x289a0f,_0x3b6bf7){createAgent(_0x289a0f)[_0x78ac('0xf')](loggerCatch(_0x3b6bf7));};exports['createCustomerHistory']=function(_0x2d94f5,_0x3c8333){create(_0x2d94f5)['catch'](loggerCatch(_0x3c8333));};exports['createCustomerFinal']=function(_0x18b81c,_0xdec172){moveContact(_0x18b81c)[_0x78ac('0xf')](loggerCatch(_0xdec172));};exports[_0x78ac('0x16')]=function(_0x2b43db,_0x2d0560,_0x4e2d83){if(_0x2d0560){_0x2b43db['UserId']=null;}if(_0x4e2d83){_0x2b43db[_0x78ac('0x17')]=![];}return BPromise[_0x78ac('0xc')]()[_0x78ac('0xd')](cmHopper[_0x78ac('0x16')](_0x2b43db))['catch'](loggerCatch('[rescheduleContact]\x20'));};exports[_0x78ac('0x18')]=function(_0x59834c){return BPromise[_0x78ac('0xc')]()[_0x78ac('0xd')](cmHopper[_0x78ac('0x18')](_0x59834c))[_0x78ac('0xf')](loggerCatch(_0x78ac('0x19')));};exports['unlockContact']=function(_0x421546){return BPromise[_0x78ac('0xc')]()[_0x78ac('0xd')](cmHopper[_0x78ac('0x1a')]({'UserId':null},_0x421546,0x1))['catch'](loggerCatch(_0x78ac('0x1b')));};exports[_0x78ac('0x1c')]=function(_0x3ae8cd){return BPromise['resolve']()['then'](cmHopper['unlockContact']({'active':![]},_0x3ae8cd,0x1))['catch'](loggerCatch(_0x78ac('0x1d')));};exports[_0x78ac('0x1e')]=function(_0x55ea37){var _0x353ba0={};_0x353ba0[_0x78ac('0x1f')]=_0x55ea37[_0x78ac('0x1f')];_0x353ba0[_0x78ac('0x20')]=_0x55ea37[_0x78ac('0x20')];_0x353ba0[_0x78ac('0x21')]=_0x55ea37[_0x78ac('0x21')];_0x353ba0['calleridname']=_0x55ea37['calleridname'];_0x353ba0[_0x78ac('0x22')]=_0x55ea37[_0x78ac('0x22')];_0x353ba0[_0x78ac('0x23')]=_0x55ea37[_0x78ac('0x24')];_0x353ba0[_0x78ac('0x25')]=_0x55ea37['answertime'];_0x353ba0[_0x78ac('0x26')]=0x1;_0x353ba0['queuecallercompleteAt']=_0x55ea37[_0x78ac('0x27')];_0x353ba0[_0x78ac('0x28')]=_0x55ea37[_0x78ac('0x29')];_0x353ba0[_0x78ac('0x2a')]=_0x78ac('0x2b');_0x353ba0[_0x78ac('0x2c')]='xcally-motion-preview';_0x353ba0[_0x78ac('0x2d')]=0x0;_0x353ba0['assigned']=0x1;_0x353ba0[_0x78ac('0x2e')]=_0x55ea37['membername'];_0x353ba0[_0x78ac('0x2f')]=_0x78ac('0x30');return BPromise[_0x78ac('0xc')]()[_0x78ac('0xd')](voiceQueueReport[_0x78ac('0x31')](_0x353ba0))[_0x78ac('0xf')](loggerCatch(_0x78ac('0x32')));};exports[_0x78ac('0x33')]=function(_0x30cdb9,_0x104e98){return BPromise['resolve']()['then'](cmHopper[_0x78ac('0x33')](_0x30cdb9,_0x104e98))[_0x78ac('0xf')](loggerCatch('[GetContactRecallMe]\x20'));};exports['rescheduleContactInQueue']=function(_0x5815d3){return BPromise[_0x78ac('0xc')]()[_0x78ac('0xd')](cmHopper[_0x78ac('0x16')](_0x5815d3,!![],!![]))['catch'](loggerCatch(_0x78ac('0x34')));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index 421f671..2d42937 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 _0xa7ae=['mandatoryDisposition','buildAcw','agentReadyId','not_inuse','status','reachable','push','createBody','CampaignId','type','campaigntype','dialAnswer','membername','countnoanswerretry','countglobal','callback','callbackuniqueid','callbackat','recallme','UserId','sipcallid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrttbridged','rtpaudioqosjitter','rtpaudioqosrtt','bridgepeer','bridgepvtcallid','getCallerIdRandom','random','extractCalleridName','extractCalleridNumber','util','lodash','moment','preview','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','inspect','logger2','info','message','getCallerId','isUndefined','isEmpty','string','format','isActive','isNil','name','\x22%s\x22\x20<%s>','calleridname','calleridnum','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridnum','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','statedesc','state','responsetime','ringtime','starttime','logLookAgent','logCustomer','endtime','talktime','answertime','isFailure','Failure','variablesAction','BOOKED','uniqueid','originate','timeout','countbusyretry','countcongestionretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','ContactId','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','interface','channelAgent','voice'];(function(_0x3c3195,_0x595377){var _0x2ee24e=function(_0x1e9457){while(--_0x1e9457){_0x3c3195['push'](_0x3c3195['shift']());}};_0x2ee24e(++_0x595377);}(_0xa7ae,0x14a));var _0xea7a=function(_0x4201af,_0x4629c4){_0x4201af=_0x4201af-0x0;var _0x42629d=_0xa7ae[_0x4201af];return _0x42629d;};'use strict';var util=require(_0xea7a('0x0'));var _=require(_0xea7a('0x1'));var moment=require(_0xea7a('0x2'));var logger=require('../../../../config/logger')(_0xea7a('0x3'));var ipAgi=process['env'][_0xea7a('0x4')]||_0xea7a('0x5');function getSeconds(_0x400da9,_0x3142d4){var _0x4641c5=moment(_0x400da9)[_0xea7a('0x6')](0x0);var _0x2e5d04=moment(_0x3142d4)[_0xea7a('0x6')](0x0);return _0x4641c5[_0xea7a('0x7')](_0x2e5d04,_0xea7a('0x8'));}exports[_0xea7a('0x9')]=function(_0x58809a){return function(_0x39a24c){logger[_0xea7a('0xa')](_0x58809a,util['inspect'](_0x39a24c,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x1e29e8,_0x373a9a){logger['info'](_0x1e29e8,util['inspect'](_0x373a9a,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x205aad,_0x1187cb){logger[_0xea7a('0xa')](_0x205aad,util[_0xea7a('0xb')](_0x1187cb,{'showHidden':![],'depth':null}));};exports[_0xea7a('0xc')]=function(_0x5d4011){return function(_0x488b37){logger[_0xea7a('0xd')](_0x5d4011,util[_0xea7a('0xb')](_0x488b37,{'showHidden':![],'depth':null}));};};exports[_0xea7a('0xe')]=function(_0x252a46,_0x415ecf,_0x3967cb){return{'message':_0x252a46,'unlock':_0x415ecf,'active':_0x3967cb};};exports[_0xea7a('0xf')]=function(_0x1b6811,_0x5a7f51,_0x3c1c86){if(!_[_0xea7a('0x10')](_0x3c1c86)&&'string'===typeof _0x3c1c86&&!_[_0xea7a('0x11')](_0x3c1c86)){if(!_['isUndefined'](_0x5a7f51)&&_0xea7a('0x12')===typeof _0x5a7f51&&!_[_0xea7a('0x11')](_0x5a7f51)){return util[_0xea7a('0x13')]('\x22%s\x22\x20<%s>',_0x5a7f51,_0x3c1c86);}return util[_0xea7a('0x13')]('\x22%s\x22\x20<%s>',_0x3c1c86,_0x3c1c86);}if(!_[_0xea7a('0x10')](_0x1b6811)&&'string'===typeof _0x1b6811&&!_['isEmpty'](_0x1b6811)){return _0x1b6811;}return'\x22\x22\x20<>';};exports[_0xea7a('0x14')]=function(_0x5f4d41){if(_[_0xea7a('0x15')](_0x5f4d41)){return![];}return _0x5f4d41;};exports['addVariables']=function(_0x4ef697,_0x1129f3,_0x3c3fb1,_0x3b3f7d,_0x290c4c,_0x30c8a4){var _0x4720cc={'XMD-QUEUE':_0x1129f3['Queue']?_0x1129f3['Queue'][_0xea7a('0x16')]:'','XMD-CALLERID':_0x3b3f7d,'XMD-CALLERID-PREVIEW':_0x30c8a4?util[_0xea7a('0x13')](_0xea7a('0x17'),_0x30c8a4[_0xea7a('0x18')],_0x30c8a4[_0xea7a('0x19')]):_0x3b3f7d,'XMD-DIALID':_0x290c4c,'XMD-CONTACTID':_0x1129f3['ContactId'],'XMD-CDRTYPE':_0xea7a('0x1a'),'CALLERID(all)':_0x3b3f7d,'XMD-VOICEQUEUEID':_0x1129f3[_0xea7a('0x1b')],'XMD-DIALCHANNEL':_0x3c3fb1,'XMD-DIALTIMEOUT':_0x4ef697[_0xea7a('0x1c')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0xea7a('0x1d'),_0x4ef697[_0xea7a('0x1e')]?'g':'',_[_0xea7a('0x11')](_0x4ef697[_0xea7a('0x1f')])?'':_0xea7a('0x20')),'XMD-DIALURL':_0x4ef697[_0xea7a('0x21')]||'','XMD-AGI':_0x4ef697['dialQueueProject']?util[_0xea7a('0x13')](_0xea7a('0x22'),ipAgi,_0x4ef697[_0xea7a('0x23')]):_0xea7a('0x24'),'XMD-AGIAFTER':_0x4ef697[_0xea7a('0x1e')]?util['format'](_0xea7a('0x22'),ipAgi,_0x4ef697[_0xea7a('0x1e')]):_0xea7a('0x24'),'XMD-ORIGINATECALLERIDNUM':_0x30c8a4?_0x30c8a4[_0xea7a('0x25')]:'','XMD-ORIGINATECALLERIDNAME':_0x30c8a4?_0x30c8a4['originatecalleridname']:'','XMD-DESTINATION':_0xea7a('0x26')};if(!_['isEmpty'](_0x4ef697[_0xea7a('0x1f')])){_0x4720cc[util[_0xea7a('0x13')]('%s',_0xea7a('0x27'))]=_0x4ef697[_0xea7a('0x1f')];_0x4720cc[util[_0xea7a('0x13')]('%s',_0xea7a('0x28'))]=_0x290c4c;}if(_0x1129f3&&_0x1129f3['Contact']){for(var _0x81423 in _0x1129f3[_0xea7a('0x29')]){if(_0x1129f3[_0xea7a('0x29')][_0xea7a('0x2a')](_0x81423)){if(!_[_0xea7a('0x15')](_0x1129f3[_0xea7a('0x29')][_0x81423])&&_0x81423!=='id'&&_0x81423!==_0xea7a('0x2b')&&_0x81423!==_0xea7a('0x2c')&&_0x81423!==_0xea7a('0x2d')){_0x4720cc[util[_0xea7a('0x13')](_0xea7a('0x2e'),_0xea7a('0x2f'),_[_0xea7a('0x30')](_0x81423))]=_0x1129f3[_0xea7a('0x29')][_0x81423];}}}}return _0x4720cc;};exports[_0xea7a('0x31')]=function(_0x2a93bf){var _0x577edd={};for(var _0x459bfb in _0x2a93bf){if(_0x2a93bf[_0xea7a('0x2a')](_0x459bfb)){_0x577edd[util[_0xea7a('0x13')]('%s',_[_0xea7a('0x32')](_0x459bfb))]=_0x2a93bf[_0x459bfb];}}return{'variables':_0x577edd};};exports[_0xea7a('0x33')]=function(_0x4df2fd,_0x46731c){if(!_[_0xea7a('0x15')](_0x4df2fd)){if(_0x4df2fd[_0xea7a('0x2a')]('originated')){if(_0x4df2fd[_0xea7a('0x34')]>0x0){_0x4df2fd[_0xea7a('0x34')]-=0x1;}else{logger[_0xea7a('0xa')](_0xea7a('0x35'),_0x46731c);}}}else{logger[_0xea7a('0xa')](_0xea7a('0x36'),_0x46731c);}};exports['logBlacklist']=function(_0x5e6e){var _0x4dd00e=moment()['format'](_0xea7a('0x37'));_0x5e6e['state']=0xd;_0x5e6e[_0xea7a('0x38')]='Blacklist';_0x5e6e['starttime']=_0x4dd00e;_0x5e6e['responsetime']=_0x4dd00e;_0x5e6e['endtime']=_0x4dd00e;};exports['logAgent']=function(_0x1ef90e,_0x4dab3f,_0x72c958){var _0x353b11=moment()['format'](_0xea7a('0x37'));_0x1ef90e[_0xea7a('0x39')]=_0x4dab3f;_0x1ef90e['statedesc']=_0x72c958;_0x1ef90e[_0xea7a('0x3a')]=_0x353b11;_0x1ef90e[_0xea7a('0x3b')]=getSeconds(_0x1ef90e[_0xea7a('0x3a')],_0x1ef90e[_0xea7a('0x3c')]);};exports[_0xea7a('0x3d')]=function(_0x2634dc,_0x53d7e4,_0x24df5a){_0x2634dc['membername']=_0x53d7e4;_0x2634dc['UserId']=_0x24df5a;};exports[_0xea7a('0x3e')]=function(_0x1382a1,_0x113fc6,_0x4838a9){var _0x10806d=moment()[_0xea7a('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x1382a1[_0xea7a('0x39')]=_0x113fc6;_0x1382a1['statedesc']=_0x4838a9;_0x1382a1[_0xea7a('0x3a')]=_0x1382a1['responsetime']?_0x1382a1['responsetime']:_0x10806d;_0x1382a1[_0xea7a('0x3f')]=_0x1382a1[_0xea7a('0x3f')]?_0x1382a1[_0xea7a('0x3f')]:_0x10806d;_0x1382a1['ringtime']=getSeconds(_0x1382a1['responsetime']||0x0,_0x1382a1['starttime']||0x0);_0x1382a1[_0xea7a('0x40')]=_0x1382a1[_0xea7a('0x41')]?getSeconds(_0x1382a1[_0xea7a('0x3f')],_0x1382a1[_0xea7a('0x41')]):0x0;};exports[_0xea7a('0x42')]=function(_0x5be506){return _0x5be506===_0xea7a('0x43');};exports[_0xea7a('0x44')]=function(_0x1a7073,_0x999664,_0x1e0ce8,_0x28305b,_0x41a47a){var _0x563bf1=_0x28305b?'RECALL':_0x1a7073[_0xea7a('0x18')];_0x563bf1=_0x41a47a?_0xea7a('0x45'):_0x563bf1;return{'actionid':_0x1a7073[_0xea7a('0x46')],'action':_0xea7a('0x47'),'channel':_0x1a7073['channelAgent'],'callerid':util[_0xea7a('0x13')](_0xea7a('0x17'),_0x563bf1,_0x1a7073[_0xea7a('0x19')]),'Exten':_0xea7a('0x26'),'Context':'from-sip','Priority':'1','variable':_0x1e0ce8,'timeout':(_0x999664[_0xea7a('0x48')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1a7073[_0xea7a('0x46')]};};exports['totalGlobal']=function(_0x2f8550){return _0x2f8550[_0xea7a('0x49')]+_0x2f8550[_0xea7a('0x4a')]+_0x2f8550['countnoanswerretry']+_0x2f8550[_0xea7a('0x4b')]+_0x2f8550[_0xea7a('0x4c')];};exports[_0xea7a('0x4d')]=function(_0x46d10d){var _0x21131b=_[_0xea7a('0x4e')](_0x46d10d);_0x21131b[_0xea7a('0x39')]=0xf;_0x21131b[_0xea7a('0x38')]=_0xea7a('0x4f');return _0x21131b;};exports[_0xea7a('0x50')]=function(_0x4be3d4,_0x2b9f66,_0x5b8555){var _0xa8e52b={};_0xa8e52b[_0x2b9f66]=_0x4be3d4[_0x2b9f66];_0xa8e52b[_0xea7a('0x51')]=![];_0xa8e52b[_0xea7a('0x52')]=moment()[_0xea7a('0x53')](_0x5b8555,'minutes')['format'](_0xea7a('0x37'));_0xa8e52b[_0xea7a('0x54')]=_0x4be3d4[_0xea7a('0x54')];_0xa8e52b[_0xea7a('0x55')]=_0x4be3d4['ListId'];_0xa8e52b[_0xea7a('0x1b')]=_0x4be3d4['VoiceQueueId']||undefined;return _0xa8e52b;};exports[_0xea7a('0x56')]=function(_0x45e962,_0xf90b35){if(!_[_0xea7a('0x15')](_0x45e962)){if(_0x45e962[_0xea7a('0x57')]>0x0){_0x45e962['pTalking']-=0x1;}else{logger[_0xea7a('0xa')](_0xf90b35,_0xea7a('0x58'));}}else{logger[_0xea7a('0xa')](_0xf90b35,_0xea7a('0x59'));}};exports[_0xea7a('0x5a')]=function(_0x23e955){if(_0x23e955<=0x0){return!![];}return![];};exports['buildObj']=function(_0x3038e7,_0x3dcf83,_0x20f5ff){_0x3038e7[_0xea7a('0x5b')]=_0x3dcf83;_0x3038e7['name']=_0x3038e7[_0xea7a('0x5c')];_0x3038e7[_0xea7a('0x5d')]=_0x3038e7[_0xea7a('0x5e')];_0x3038e7['motionChannel']=_0xea7a('0x5f');if(_0x20f5ff){_0x3038e7[_0xea7a('0x60')]=_0x20f5ff[_0xea7a('0x60')];}return _0x3038e7;};exports[_0xea7a('0x61')]=function(_0x16a7ce){var _0x398a01={};_0x398a01[_0xea7a('0x5c')]=_0x16a7ce[_0xea7a('0x5c')];_0x398a01[_0xea7a('0x5d')]=_0x16a7ce[_0xea7a('0x5e')];_0x398a01[_0xea7a('0x46')]=_0x16a7ce[_0xea7a('0x46')];return _0x398a01;};exports[_0xea7a('0x62')]=function(_0x562da9){var _0x36d54c=[];for(var _0x18d82c in _0x562da9){if(_0x562da9[_0xea7a('0x2a')](_0x18d82c)){if(!_[_0xea7a('0x15')](_0x562da9[_0x18d82c])&&_0x562da9[_0x18d82c][_0xea7a('0x39')]===_0xea7a('0x63')&&_0x562da9[_0x18d82c][_0xea7a('0x64')]===_0xea7a('0x65')){_0x36d54c[_0xea7a('0x66')](_0x562da9[_0x18d82c]['id']);}}}return _0x36d54c;};exports['getDiff']=function(_0x3585b3){var _0x20e5f6=moment()[_0xea7a('0x6')](0x0);var _0x612341=moment(_0x3585b3)[_0xea7a('0x6')](0x0);return _0x20e5f6[_0xea7a('0x7')](_0x612341,_0xea7a('0x8'));};exports[_0xea7a('0x67')]=function(_0x328e13){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x328e13[_0xea7a('0x54')],'ListId':_0x328e13[_0xea7a('0x55')],'VoiceQueueId':_0x328e13[_0xea7a('0x1b')]||undefined,'CampaignId':_0x328e13[_0xea7a('0x68')]||undefined};};exports['filterKey']=function(_0x7a1fc4){if(_0x7a1fc4===_0xea7a('0x46')||_0x7a1fc4==='idContact'||_0x7a1fc4===_0xea7a('0x5c')||_0x7a1fc4===_0xea7a('0x69')||_0x7a1fc4===_0xea7a('0x6a')||_0x7a1fc4===_0xea7a('0x6b')||_0x7a1fc4===_0xea7a('0x6c')||_0x7a1fc4==='channelAgent'||_0x7a1fc4===_0xea7a('0x18')||_0x7a1fc4===_0xea7a('0x51')||_0x7a1fc4==='calleridnum'||_0x7a1fc4===_0xea7a('0x52')||_0x7a1fc4==='countbusyretry'||_0x7a1fc4===_0xea7a('0x4a')||_0x7a1fc4===_0xea7a('0x6d')||_0x7a1fc4===_0xea7a('0x6e')||_0x7a1fc4===_0xea7a('0x6f')||_0x7a1fc4===_0xea7a('0x70')||_0x7a1fc4===_0xea7a('0x71')||_0x7a1fc4===_0xea7a('0x72')||_0x7a1fc4===_0xea7a('0x54')||_0x7a1fc4===_0xea7a('0x55')||_0x7a1fc4===_0xea7a('0x73')||_0x7a1fc4===_0xea7a('0x1b')||_0x7a1fc4===_0xea7a('0x74')||_0x7a1fc4==='xmd-voicequeueid'||_0x7a1fc4===_0xea7a('0x75')||_0x7a1fc4===_0xea7a('0x76')||_0x7a1fc4===_0xea7a('0x77')||_0x7a1fc4===_0xea7a('0x78')||_0x7a1fc4===_0xea7a('0x79')||_0x7a1fc4==='xmd-dialoptions'||_0x7a1fc4===_0xea7a('0x7a')||_0x7a1fc4===_0xea7a('0x7b')||_0x7a1fc4===_0xea7a('0x7c')||_0x7a1fc4===_0xea7a('0x7d')||_0x7a1fc4===_0xea7a('0x7e')||_0x7a1fc4===_0xea7a('0x7f')||_0x7a1fc4===_0xea7a('0x80')||_0x7a1fc4===_0xea7a('0x81')||_0x7a1fc4===_0xea7a('0x82')||_0x7a1fc4==='rtpaudioqosjitter'||_0x7a1fc4===_0xea7a('0x83')||_0x7a1fc4===_0xea7a('0x84')||_0x7a1fc4==='rtpaudioqoslossbridged'||_0x7a1fc4==='rtpaudioqosrtt'||_0x7a1fc4===_0xea7a('0x85')||_0x7a1fc4===_0xea7a('0x81')||_0x7a1fc4===_0xea7a('0x82')||_0x7a1fc4===_0xea7a('0x86')||_0x7a1fc4==='rtpaudioqosjitterbridged'||_0x7a1fc4===_0xea7a('0x84')||_0x7a1fc4==='rtpaudioqoslossbridged'||_0x7a1fc4===_0xea7a('0x87')||_0x7a1fc4===_0xea7a('0x85')||_0x7a1fc4===_0xea7a('0x88')||_0x7a1fc4===_0xea7a('0x89')||_0x7a1fc4===_0xea7a('0x39')||_0x7a1fc4===_0xea7a('0x38')){return![];}return!![];};exports[_0xea7a('0x8a')]=function(_0x4f6bac,_0x3ae256){var _0x2bba45,_0x275cd9,_0x3e5c49;if(_0x3ae256<=0x0){_0x3ae256=0x1;}_0x2bba45=new RegExp('\x5cw{0,'+_0x3ae256+'}$');_0x275cd9=Math['pow'](0xa,_0x3ae256-0x1);_0x3e5c49=Math['pow'](0xa,_0x3ae256)-0x1;return util[_0xea7a('0x13')]('%s',_['replace'](_0x4f6bac,_0x2bba45,_[_0xea7a('0x8b')](_0x275cd9,_0x3e5c49)));};exports[_0xea7a('0x8c')]=function(_0x1e9ed2){var _0x11e849=_0x1e9ed2['match'](/"(.*?)"/);return _0x11e849?_0x11e849[0x1]:_0x1e9ed2;};exports[_0xea7a('0x8d')]=function(_0x30fce1){var _0x15f9ee=_0x30fce1['match'](/<(.*?)>/);return _0x15f9ee?_0x15f9ee[0x1]:_0x30fce1;}; \ No newline at end of file +var _0xb4bd=['add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','interface','motionChannel','voice','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','status','reachable','filterKey','idContact','type','campaigntype','dialAnswer','membername','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitterbridged','\x5cw{0,','pow','replace','random','extractCalleridNumber','match','util','lodash','moment','../../../../config/logger','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','error','inspect','logger','info','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_UNIQUEID','Contact','tags','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','hasOwnProperty','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','starttime','responsetime','endtime','ringtime','UserId','logCustomer','talktime','answertime','isFailure','Failure','RECALL','BOOKED','uniqueid','originate','channelAgent','from-sip','totalGlobal','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','clone','Global','active','scheduledat'];(function(_0x31e7cb,_0x240132){var _0x1109c3=function(_0x24561d){while(--_0x24561d){_0x31e7cb['push'](_0x31e7cb['shift']());}};_0x1109c3(++_0x240132);}(_0xb4bd,0xbf));var _0xdb4b=function(_0x5ac1e5,_0x4b5012){_0x5ac1e5=_0x5ac1e5-0x0;var _0x1bccc6=_0xb4bd[_0x5ac1e5];return _0x1bccc6;};'use strict';var util=require(_0xdb4b('0x0'));var _=require(_0xdb4b('0x1'));var moment=require(_0xdb4b('0x2'));var logger=require(_0xdb4b('0x3'))('preview');var ipAgi=process['env'][_0xdb4b('0x4')]||_0xdb4b('0x5');function getSeconds(_0x52df0a,_0x47235d){var _0x5203ee=moment(_0x52df0a)['milliseconds'](0x0);var _0x22baa8=moment(_0x47235d)[_0xdb4b('0x6')](0x0);return _0x5203ee[_0xdb4b('0x7')](_0x22baa8,_0xdb4b('0x8'));}exports['loggerCatch']=function(_0x3f5182){return function(_0x1010ac){logger[_0xdb4b('0x9')](_0x3f5182,util[_0xdb4b('0xa')](_0x1010ac,{'showHidden':![],'depth':null}));};};exports[_0xdb4b('0xb')]=function(_0x4e2f7a,_0xd2e699){logger[_0xdb4b('0xc')](_0x4e2f7a,util[_0xdb4b('0xa')](_0xd2e699,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x5b909d,_0x5f079c){logger[_0xdb4b('0x9')](_0x5b909d,util[_0xdb4b('0xa')](_0x5f079c,{'showHidden':![],'depth':null}));};exports[_0xdb4b('0xd')]=function(_0x2f37fb){return function(_0x2253da){logger[_0xdb4b('0xc')](_0x2f37fb,util[_0xdb4b('0xa')](_0x2253da,{'showHidden':![],'depth':null}));};};exports[_0xdb4b('0xe')]=function(_0x27d36d,_0x559bd1,_0x44ac15){return{'message':_0x27d36d,'unlock':_0x559bd1,'active':_0x44ac15};};exports[_0xdb4b('0xf')]=function(_0x4e7850,_0x5a3964,_0x2f4b0e){if(!_[_0xdb4b('0x10')](_0x2f4b0e)&&_0xdb4b('0x11')===typeof _0x2f4b0e&&!_[_0xdb4b('0x12')](_0x2f4b0e)){if(!_['isUndefined'](_0x5a3964)&&'string'===typeof _0x5a3964&&!_['isEmpty'](_0x5a3964)){return util[_0xdb4b('0x13')](_0xdb4b('0x14'),_0x5a3964,_0x2f4b0e);}return util[_0xdb4b('0x13')](_0xdb4b('0x14'),_0x2f4b0e,_0x2f4b0e);}if(!_[_0xdb4b('0x10')](_0x4e7850)&&'string'===typeof _0x4e7850&&!_[_0xdb4b('0x12')](_0x4e7850)){return _0x4e7850;}return _0xdb4b('0x15');};exports[_0xdb4b('0x16')]=function(_0x9f2a87){if(_[_0xdb4b('0x17')](_0x9f2a87)){return![];}return _0x9f2a87;};exports['addVariables']=function(_0x9c7a73,_0x5793dc,_0x17632f,_0x59a1d4,_0x4284aa,_0x2d70b1){var _0x1f9b2c={'XMD-QUEUE':_0x5793dc['Queue']?_0x5793dc['Queue'][_0xdb4b('0x18')]:'','XMD-CALLERID':_0x59a1d4,'XMD-CALLERID-PREVIEW':_0x2d70b1?util[_0xdb4b('0x13')]('\x22%s\x22\x20<%s>',_0x2d70b1[_0xdb4b('0x19')],_0x2d70b1[_0xdb4b('0x1a')]):_0x59a1d4,'XMD-DIALID':_0x4284aa,'XMD-CONTACTID':_0x5793dc[_0xdb4b('0x1b')],'XMD-CDRTYPE':_0xdb4b('0x1c'),'CALLERID(all)':_0x59a1d4,'XMD-VOICEQUEUEID':_0x5793dc[_0xdb4b('0x1d')],'XMD-DIALCHANNEL':_0x17632f,'XMD-DIALTIMEOUT':_0x9c7a73['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util['format'](_0xdb4b('0x1e'),_0x9c7a73[_0xdb4b('0x1f')]?'g':'',_[_0xdb4b('0x12')](_0x9c7a73[_0xdb4b('0x20')])?'':_0xdb4b('0x21')),'XMD-DIALURL':_0x9c7a73[_0xdb4b('0x22')]||'','XMD-AGI':_0x9c7a73['dialQueueProject']?util['format'](_0xdb4b('0x23'),ipAgi,_0x9c7a73[_0xdb4b('0x24')]):'NONE','XMD-AGIAFTER':_0x9c7a73[_0xdb4b('0x1f')]?util[_0xdb4b('0x13')]('\x22agi://%s/square,%s\x22',ipAgi,_0x9c7a73[_0xdb4b('0x1f')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x2d70b1?_0x2d70b1['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x2d70b1?_0x2d70b1[_0xdb4b('0x25')]:'','XMD-DESTINATION':_0xdb4b('0x26')};if(!_[_0xdb4b('0x12')](_0x9c7a73[_0xdb4b('0x20')])){_0x1f9b2c[util['format']('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x9c7a73[_0xdb4b('0x20')];_0x1f9b2c[util[_0xdb4b('0x13')]('%s',_0xdb4b('0x27'))]=_0x4284aa;}if(_0x5793dc&&_0x5793dc[_0xdb4b('0x28')]){for(var _0x44da09 in _0x5793dc['Contact']){if(_0x5793dc[_0xdb4b('0x28')]['hasOwnProperty'](_0x44da09)){if(!_[_0xdb4b('0x17')](_0x5793dc[_0xdb4b('0x28')][_0x44da09])&&_0x44da09!=='id'&&_0x44da09!==_0xdb4b('0x29')&&_0x44da09!=='createdAt'&&_0x44da09!==_0xdb4b('0x2a')){_0x1f9b2c[util['format'](_0xdb4b('0x2b'),_0xdb4b('0x2c'),_[_0xdb4b('0x2d')](_0x44da09))]=_0x5793dc[_0xdb4b('0x28')][_0x44da09];}}}}return _0x1f9b2c;};exports[_0xdb4b('0x2e')]=function(_0x52f6e7){var _0x48a4af={};for(var _0x5f132a in _0x52f6e7){if(_0x52f6e7[_0xdb4b('0x2f')](_0x5f132a)){_0x48a4af[util['format']('%s',_[_0xdb4b('0x30')](_0x5f132a))]=_0x52f6e7[_0x5f132a];}}return{'variables':_0x48a4af};};exports[_0xdb4b('0x31')]=function(_0x7906f,_0x29e576){if(!_[_0xdb4b('0x17')](_0x7906f)){if(_0x7906f['hasOwnProperty'](_0xdb4b('0x32'))){if(_0x7906f[_0xdb4b('0x32')]>0x0){_0x7906f['originated']-=0x1;}else{logger[_0xdb4b('0x9')](_0xdb4b('0x33'),_0x29e576);}}}else{logger[_0xdb4b('0x9')](_0xdb4b('0x34'),_0x29e576);}};exports[_0xdb4b('0x35')]=function(_0x27e6ff){var _0x5f2438=moment()['format'](_0xdb4b('0x36'));_0x27e6ff[_0xdb4b('0x37')]=0xd;_0x27e6ff[_0xdb4b('0x38')]='Blacklist';_0x27e6ff[_0xdb4b('0x39')]=_0x5f2438;_0x27e6ff[_0xdb4b('0x3a')]=_0x5f2438;_0x27e6ff[_0xdb4b('0x3b')]=_0x5f2438;};exports['logAgent']=function(_0xb68843,_0x466271,_0x2bd506){var _0xc96c59=moment()[_0xdb4b('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0xb68843[_0xdb4b('0x37')]=_0x466271;_0xb68843[_0xdb4b('0x38')]=_0x2bd506;_0xb68843['responsetime']=_0xc96c59;_0xb68843[_0xdb4b('0x3c')]=getSeconds(_0xb68843[_0xdb4b('0x3a')],_0xb68843['starttime']);};exports['logLookAgent']=function(_0x284550,_0x3d3c29,_0x3dcfd){_0x284550['membername']=_0x3d3c29;_0x284550[_0xdb4b('0x3d')]=_0x3dcfd;};exports[_0xdb4b('0x3e')]=function(_0x3feec2,_0x34989a,_0x3f8495){var _0x156ff3=moment()[_0xdb4b('0x13')](_0xdb4b('0x36'));_0x3feec2[_0xdb4b('0x37')]=_0x34989a;_0x3feec2[_0xdb4b('0x38')]=_0x3f8495;_0x3feec2[_0xdb4b('0x3a')]=_0x3feec2[_0xdb4b('0x3a')]?_0x3feec2[_0xdb4b('0x3a')]:_0x156ff3;_0x3feec2[_0xdb4b('0x3b')]=_0x3feec2['endtime']?_0x3feec2[_0xdb4b('0x3b')]:_0x156ff3;_0x3feec2['ringtime']=getSeconds(_0x3feec2['responsetime']||0x0,_0x3feec2['starttime']||0x0);_0x3feec2[_0xdb4b('0x3f')]=_0x3feec2[_0xdb4b('0x40')]?getSeconds(_0x3feec2[_0xdb4b('0x3b')],_0x3feec2[_0xdb4b('0x40')]):0x0;};exports[_0xdb4b('0x41')]=function(_0x3f5f34){return _0x3f5f34===_0xdb4b('0x42');};exports['variablesAction']=function(_0x1e2416,_0x1e7138,_0x37b2ed,_0x4d2286,_0x11ee4e){var _0x4b82c2=_0x4d2286?_0xdb4b('0x43'):_0x1e2416[_0xdb4b('0x19')];_0x4b82c2=_0x11ee4e?_0xdb4b('0x44'):_0x4b82c2;return{'actionid':_0x1e2416[_0xdb4b('0x45')],'action':_0xdb4b('0x46'),'channel':_0x1e2416[_0xdb4b('0x47')],'callerid':util[_0xdb4b('0x13')]('\x22%s\x22\x20<%s>',_0x4b82c2,_0x1e2416[_0xdb4b('0x1a')]),'Exten':_0xdb4b('0x26'),'Context':_0xdb4b('0x48'),'Priority':'1','variable':_0x37b2ed,'timeout':(_0x1e7138['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x1e2416[_0xdb4b('0x45')]};};exports[_0xdb4b('0x49')]=function(_0x169979){return _0x169979['countbusyretry']+_0x169979['countcongestionretry']+_0x169979[_0xdb4b('0x4a')]+_0x169979[_0xdb4b('0x4b')]+_0x169979[_0xdb4b('0x4c')];};exports['cloneAction']=function(_0x39f53c){var _0x1eea88=_[_0xdb4b('0x4d')](_0x39f53c);_0x1eea88['state']=0xf;_0x1eea88[_0xdb4b('0x38')]=_0xdb4b('0x4e');return _0x1eea88;};exports['scheduledAt']=function(_0x4e1ddf,_0x538b33,_0x27ab87){var _0x22cc6e={};_0x22cc6e[_0x538b33]=_0x4e1ddf[_0x538b33];_0x22cc6e[_0xdb4b('0x4f')]=![];_0x22cc6e[_0xdb4b('0x50')]=moment()[_0xdb4b('0x51')](_0x27ab87,_0xdb4b('0x52'))['format'](_0xdb4b('0x36'));_0x22cc6e[_0xdb4b('0x1b')]=_0x4e1ddf[_0xdb4b('0x1b')];_0x22cc6e[_0xdb4b('0x53')]=_0x4e1ddf[_0xdb4b('0x53')];_0x22cc6e[_0xdb4b('0x1d')]=_0x4e1ddf[_0xdb4b('0x1d')]||undefined;return _0x22cc6e;};exports[_0xdb4b('0x54')]=function(_0x1df500,_0x2e6931){if(!_[_0xdb4b('0x17')](_0x1df500)){if(_0x1df500['pTalking']>0x0){_0x1df500[_0xdb4b('0x55')]-=0x1;}else{logger['error'](_0x2e6931,_0xdb4b('0x56'));}}else{logger[_0xdb4b('0x9')](_0x2e6931,_0xdb4b('0x57'));}};exports[_0xdb4b('0x58')]=function(_0x54a5a3){if(_0x54a5a3<=0x0){return!![];}return![];};exports['buildObj']=function(_0x406576,_0x2cf41e,_0x1eeffd){_0x406576[_0xdb4b('0x59')]=_0x2cf41e;_0x406576[_0xdb4b('0x18')]=_0x406576[_0xdb4b('0x5a')];_0x406576[_0xdb4b('0x5b')]=_0x406576['channelAgent'];_0x406576[_0xdb4b('0x5c')]=_0xdb4b('0x5d');if(_0x1eeffd){_0x406576[_0xdb4b('0x5e')]=_0x1eeffd[_0xdb4b('0x5e')];}return _0x406576;};exports[_0xdb4b('0x5f')]=function(_0x14714d){var _0xe4f72f={};_0xe4f72f[_0xdb4b('0x5a')]=_0x14714d['queue'];_0xe4f72f[_0xdb4b('0x5b')]=_0x14714d[_0xdb4b('0x47')];_0xe4f72f[_0xdb4b('0x45')]=_0x14714d[_0xdb4b('0x45')];return _0xe4f72f;};exports[_0xdb4b('0x60')]=function(_0x6a5360){var _0x39db3c=[];for(var _0x489f79 in _0x6a5360){if(_0x6a5360[_0xdb4b('0x2f')](_0x489f79)){if(!_[_0xdb4b('0x17')](_0x6a5360[_0x489f79])&&_0x6a5360[_0x489f79][_0xdb4b('0x37')]===_0xdb4b('0x61')&&_0x6a5360[_0x489f79][_0xdb4b('0x62')]===_0xdb4b('0x63')){_0x39db3c['push'](_0x6a5360[_0x489f79]['id']);}}}return _0x39db3c;};exports['getDiff']=function(_0x251e08){var _0x44aac4=moment()[_0xdb4b('0x6')](0x0);var _0x210eb4=moment(_0x251e08)[_0xdb4b('0x6')](0x0);return _0x44aac4[_0xdb4b('0x7')](_0x210eb4,'seconds');};exports['createBody']=function(_0x156946){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x156946[_0xdb4b('0x1b')],'ListId':_0x156946[_0xdb4b('0x53')],'VoiceQueueId':_0x156946['VoiceQueueId']||undefined,'CampaignId':_0x156946['CampaignId']||undefined};};exports[_0xdb4b('0x64')]=function(_0x4c680e){if(_0x4c680e===_0xdb4b('0x45')||_0x4c680e===_0xdb4b('0x65')||_0x4c680e==='queue'||_0x4c680e===_0xdb4b('0x66')||_0x4c680e===_0xdb4b('0x67')||_0x4c680e===_0xdb4b('0x68')||_0x4c680e===_0xdb4b('0x69')||_0x4c680e===_0xdb4b('0x47')||_0x4c680e===_0xdb4b('0x19')||_0x4c680e==='active'||_0x4c680e===_0xdb4b('0x1a')||_0x4c680e==='scheduledat'||_0x4c680e==='countbusyretry'||_0x4c680e==='countcongestionretry'||_0x4c680e===_0xdb4b('0x4a')||_0x4c680e==='countglobal'||_0x4c680e==='callback'||_0x4c680e===_0xdb4b('0x6a')||_0x4c680e===_0xdb4b('0x6b')||_0x4c680e===_0xdb4b('0x6c')||_0x4c680e==='ContactId'||_0x4c680e===_0xdb4b('0x53')||_0x4c680e==='UserId'||_0x4c680e===_0xdb4b('0x1d')||_0x4c680e===_0xdb4b('0x6d')||_0x4c680e===_0xdb4b('0x6e')||_0x4c680e===_0xdb4b('0x6f')||_0x4c680e===_0xdb4b('0x70')||_0x4c680e===_0xdb4b('0x71')||_0x4c680e===_0xdb4b('0x72')||_0x4c680e===_0xdb4b('0x73')||_0x4c680e===_0xdb4b('0x74')||_0x4c680e===_0xdb4b('0x75')||_0x4c680e==='xmd-dialchannel'||_0x4c680e===_0xdb4b('0x76')||_0x4c680e==='xmd-cdrtype'||_0x4c680e===_0xdb4b('0x77')||_0x4c680e===_0xdb4b('0x78')||_0x4c680e===_0xdb4b('0x79')||_0x4c680e===_0xdb4b('0x7a')||_0x4c680e===_0xdb4b('0x7b')||_0x4c680e===_0xdb4b('0x7c')||_0x4c680e==='rtpaudioqosjitterbridged'||_0x4c680e===_0xdb4b('0x7d')||_0x4c680e===_0xdb4b('0x7e')||_0x4c680e===_0xdb4b('0x7f')||_0x4c680e===_0xdb4b('0x80')||_0x4c680e==='rtpaudioqos'||_0x4c680e==='rtpaudioqosbridged'||_0x4c680e==='rtpaudioqosjitter'||_0x4c680e===_0xdb4b('0x81')||_0x4c680e===_0xdb4b('0x7d')||_0x4c680e===_0xdb4b('0x7e')||_0x4c680e===_0xdb4b('0x7f')||_0x4c680e===_0xdb4b('0x80')||_0x4c680e==='bridgepeer'||_0x4c680e==='bridgepvtcallid'||_0x4c680e===_0xdb4b('0x37')||_0x4c680e==='statedesc'){return![];}return!![];};exports['getCallerIdRandom']=function(_0x5dc8e4,_0x7e0335){var _0x5df402,_0x5d1fb4,_0x58efe5;if(_0x7e0335<=0x0){_0x7e0335=0x1;}_0x5df402=new RegExp(_0xdb4b('0x82')+_0x7e0335+'}$');_0x5d1fb4=Math[_0xdb4b('0x83')](0xa,_0x7e0335-0x1);_0x58efe5=Math[_0xdb4b('0x83')](0xa,_0x7e0335)-0x1;return util[_0xdb4b('0x13')]('%s',_[_0xdb4b('0x84')](_0x5dc8e4,_0x5df402,_[_0xdb4b('0x85')](_0x5d1fb4,_0x58efe5)));};exports['extractCalleridName']=function(_0x3956d7){var _0x21810a=_0x3956d7['match'](/"(.*?)"/);return _0x21810a?_0x21810a[0x1]:_0x3956d7;};exports[_0xdb4b('0x86')]=function(_0x2e5c63){var _0x5698e2=_0x2e5c63[_0xdb4b('0x87')](/<(.*?)>/);return _0x5698e2?_0x5698e2[0x1]:_0x2e5c63;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 6ee2461..7e7012a 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 _0xff12=['boolean','voicequeuechannelhangup','voicequeuechannelredirect','string','number','queuepause'];(function(_0x1d5afc,_0x50cbd1){var _0x3b072c=function(_0x406a07){while(--_0x406a07){_0x1d5afc['push'](_0x1d5afc['shift']());}};_0x3b072c(++_0x50cbd1);}(_0xff12,0x135));var _0x2ff1=function(_0x4b86b3,_0x450248){_0x4b86b3=_0x4b86b3-0x0;var _0x2fe7f2=_0xff12[_0x4b86b3];return _0x2fe7f2;};'use strict';exports['queueadd']={'queue':{'type':_0x2ff1('0x0'),'required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0x2ff1('0x0'),'required':!![]},'penalty':{'type':_0x2ff1('0x1'),'required':![]},'paused':{'type':'boolean','required':![]}};exports['queueremove']={'queue':{'type':_0x2ff1('0x0'),'required':!![]},'interface':{'type':_0x2ff1('0x0'),'required':!![]}};exports[_0x2ff1('0x2')]={'interface':{'type':_0x2ff1('0x0'),'required':!![]},'paused':{'type':_0x2ff1('0x3')},'reason':{'type':_0x2ff1('0x0'),'required':![]}};exports['reload']={'module':{'type':_0x2ff1('0x0'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0x2ff1('0x0'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0x2ff1('0x0')},'format':{'type':_0x2ff1('0x0')},'mixmonitorid':{'type':'string'}};exports[_0x2ff1('0x4')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x2ff1('0x5')]={'uniqueid':{'type':_0x2ff1('0x0'),'required':!![]},'exten':{'type':_0x2ff1('0x0'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0xbb9a=['reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','boolean','queueremove'];(function(_0x2bd2e0,_0x2a8e4e){var _0x4bb63b=function(_0x3e19ec){while(--_0x3e19ec){_0x2bd2e0['push'](_0x2bd2e0['shift']());}};_0x4bb63b(++_0x2a8e4e);}(_0xbb9a,0x13b));var _0xabb9=function(_0x209bee,_0x298502){_0x209bee=_0x209bee-0x0;var _0x137ac1=_0xbb9a[_0x209bee];return _0x137ac1;};'use strict';exports[_0xabb9('0x0')]={'queue':{'type':_0xabb9('0x1'),'required':!![]},'interface':{'type':_0xabb9('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0xabb9('0x2'),'required':![]},'paused':{'type':_0xabb9('0x3'),'required':![]}};exports[_0xabb9('0x4')]={'queue':{'type':_0xabb9('0x1'),'required':!![]},'interface':{'type':_0xabb9('0x1'),'required':!![]}};exports['queuepause']={'interface':{'type':'string','required':!![]},'paused':{'type':_0xabb9('0x3')},'reason':{'type':_0xabb9('0x1'),'required':![]}};exports[_0xabb9('0x5')]={'module':{'type':_0xabb9('0x1'),'required':![]}};exports[_0xabb9('0x6')]={'uniqueid':{'type':_0xabb9('0x1'),'required':!![]}};exports[_0xabb9('0x7')]={'uniqueid':{'type':_0xabb9('0x1'),'required':!![]},'filename':{'type':_0xabb9('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':'string'}};exports[_0xabb9('0x8')]={'uniqueid':{'type':_0xabb9('0x1'),'required':!![]}};exports[_0xabb9('0x9')]={'uniqueid':{'type':_0xabb9('0x1'),'required':!![]},'exten':{'type':_0xabb9('0x1'),'required':!![]},'context':{'type':_0xabb9('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 14532f4..3076d1d 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 _0xa69c=['../model/faxAccount','agents','voiceQueues','triggers','templates','outbound','voiceExtensions','channels','queueChannels','outboundChannels','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','mapKeys','hasOwnProperty','format','name','isNil','interface','SIP/%s','answered','sumDuration','ivrTotalCallsDays','ivrAnswerCallsDay','total','unmanaged','abandoned','sumBillable','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','prototype','mergeFromDatabase','initAgents','isUndefined','initTelephones','telephones','length','initTrunks','trunks','initVoiceQueues','initTemplates','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','uniqueid','queue','queuecallerexit','queuecallerabandon','sumHoldTime','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','diff','queuecallerleaveAt','initVoiceCallReports','disposition','ANSWERED','duration','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initCampaignHopperHistory','initFaxAccounts','faxAccounts','exports','bluebird','util','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/trigger','../model/template','../model/voiceExtension','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/dynamics365Account','../model/freshsalesAccount'];(function(_0x240711,_0xe5b088){var _0x517053=function(_0x731214){while(--_0x731214){_0x240711['push'](_0x240711['shift']());}};_0x517053(++_0xe5b088);}(_0xa69c,0x13a));var _0xca69=function(_0x34b87f,_0x28aef2){_0x34b87f=_0x34b87f-0x0;var _0x449805=_0xa69c[_0x34b87f];return _0x449805;};'use strict';var BPromise=require(_0xca69('0x0'));var util=require(_0xca69('0x1'));var _=require(_0xca69('0x2'));var moment=require(_0xca69('0x3'));var Agent=require(_0xca69('0x4'));var Telephone=require(_0xca69('0x5'));var Trunk=require(_0xca69('0x6'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0xca69('0x7'));var Template=require(_0xca69('0x8'));var Campaign=require('../model/campaign');var VoiceExtension=require(_0xca69('0x9'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0xca69('0xa'));var FreshdeskAccount=require(_0xca69('0xb'));var SugarcrmAccount=require(_0xca69('0xc'));var ZohoAccount=require(_0xca69('0xd'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require(_0xca69('0xe'));var FreshsalesAccount=require(_0xca69('0xf'));var FaxAccount=require(_0xca69('0x10'));var Realtime=function(){this[_0xca69('0x11')]={};this['telephones']={};this['trunks']={};this[_0xca69('0x12')]={};this[_0xca69('0x13')]={};this['campaigns']={};this[_0xca69('0x14')]={};this[_0xca69('0x15')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xca69('0x16')]={};this[_0xca69('0x17')]={};this[_0xca69('0x18')]={};this[_0xca69('0x19')]={};this['timers']={};this['settings']={};this['zendeskAccounts']={};this[_0xca69('0x1a')]={};this[_0xca69('0x1b')]={};this[_0xca69('0x1c')]={};this[_0xca69('0x1d')]={};this[_0xca69('0x1e')]={};this[_0xca69('0x1f')]={};this[_0xca69('0x20')]={};this[_0xca69('0x21')]={};this[_0xca69('0x22')]={};this['faxAccounts']={};};function freeIsNotKey(_0x57924a,_0x4669f6,_0x22462a){var _0x482c1b=_[_0xca69('0x23')](_0x57924a,function(_0x4c91a6,_0x59c012){return _0x4c91a6[_0x22462a];});for(var _0x2471f2 in _0x4669f6){if(_0x4669f6[_0xca69('0x24')](_0x2471f2)){if(!_0x482c1b[_0x2471f2]){delete _0x4669f6[_0x2471f2];}}}}function freeIsNotKeySip(_0x2511e8,_0x510311){var _0x34d3aa=_[_0xca69('0x23')](_0x2511e8,function(_0x38568a,_0x49b58d){return util[_0xca69('0x25')]('SIP/%s',_0x38568a[_0xca69('0x26')]);});for(var _0x4a1a59 in _0x510311){if(_0x510311[_0xca69('0x24')](_0x4a1a59)){if(!_0x34d3aa[_0x4a1a59]){delete _0x510311[_0x4a1a59];}}}}function freeIsNotKeyAgent(_0x27740c,_0x717714){var _0xcbfc4e=_['mapKeys'](_0x27740c,function(_0x520496,_0x50af29){var _0x1761bd=_[_0xca69('0x27')](_0x520496[_0xca69('0x28')])?util[_0xca69('0x25')](_0xca69('0x29'),_0x520496['name']):_0x520496[_0xca69('0x28')];return _0x1761bd;});for(var _0x13cd92 in _0x717714){if(_0x717714[_0xca69('0x24')](_0x13cd92)){if(!_0xcbfc4e[_0x13cd92]){delete _0x717714[_0x13cd92];}}}}function clearVoiceCallReports(_0x5da775){_0x5da775['total']=0x0;_0x5da775[_0xca69('0x2a')]=0x0;_0x5da775['sumHoldTime']=0x0;_0x5da775[_0xca69('0x2b')]=0x0;_0x5da775['sumBillable']=0x0;}function clearCampaigns(_0x49036b){if(!_['isEmpty'](_0x49036b)){for(var _0xbf4c2c in _0x49036b){if(_0x49036b[_0xca69('0x24')](_0xbf4c2c)){_0x49036b[_0xbf4c2c][_0xca69('0x2c')]=0x0;_0x49036b[_0xbf4c2c][_0xca69('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x190d4b){if(!_['isEmpty'](_0x190d4b)){for(var _0x5dfc74 in _0x190d4b){if(_0x190d4b['hasOwnProperty'](_0x5dfc74)){_0x190d4b[_0x5dfc74][_0xca69('0x2e')]=0x0;_0x190d4b[_0x5dfc74][_0xca69('0x2a')]=0x0;_0x190d4b[_0x5dfc74][_0xca69('0x2f')]=0x0;_0x190d4b[_0x5dfc74][_0xca69('0x30')]=0x0;_0x190d4b[_0x5dfc74]['sumHoldTime']=0x0;_0x190d4b[_0x5dfc74]['sumDuration']=0x0;_0x190d4b[_0x5dfc74][_0xca69('0x31')]=0x0;_0x190d4b[_0x5dfc74]['outboundAnswerAgiCallsDay']=0x0;_0x190d4b[_0x5dfc74][_0xca69('0x32')]=0x0;_0x190d4b[_0x5dfc74]['outboundBusyCallsDay']=0x0;_0x190d4b[_0x5dfc74]['outboundCongestionCallsDay']=0x0;_0x190d4b[_0x5dfc74][_0xca69('0x33')]=0x0;_0x190d4b[_0x5dfc74]['outboundUnknownCallsDay']=0x0;_0x190d4b[_0x5dfc74][_0xca69('0x34')]=0x0;_0x190d4b[_0x5dfc74][_0xca69('0x35')]=0x0;_0x190d4b[_0x5dfc74][_0xca69('0x36')]=0x0;_0x190d4b[_0x5dfc74][_0xca69('0x37')]=0x0;_0x190d4b[_0x5dfc74][_0xca69('0x38')]=0x0;_0x190d4b[_0x5dfc74][_0xca69('0x39')]=0x0;_0x190d4b[_0x5dfc74][_0xca69('0x3a')]=0x0;_0x190d4b[_0x5dfc74][_0xca69('0x3b')]=0x0;_0x190d4b[_0x5dfc74]['queueStatusComplete']=!![];}}}}Realtime[_0xca69('0x3c')][_0xca69('0x3d')]=function(_0x4d3c06,_0xf14217){for(var _0xe21bee in _0xf14217){if(_0x4d3c06['hasOwnProperty'](_0xe21bee)){_0x4d3c06[_0xe21bee]=_0xf14217[_0xe21bee];}}};Realtime[_0xca69('0x3c')][_0xca69('0x3e')]=function(){var _0x175560=this;return function(_0x3a7a77){if(_0x3a7a77){freeIsNotKeyAgent(_0x3a7a77,_0x175560[_0xca69('0x11')]);for(var _0x5d0fb2=0x0,_0x550d14={},_0x445ed5={};_0x5d0fb2<_0x3a7a77['length'];_0x5d0fb2+=0x1){_0x550d14=_0x3a7a77[_0x5d0fb2];var _0x777abd=_[_0xca69('0x27')](_0x550d14['interface'])?util[_0xca69('0x25')](_0xca69('0x29'),_0x550d14['name']):_0x550d14[_0xca69('0x28')];if(_[_0xca69('0x3f')](_0x175560[_0xca69('0x11')][_0x777abd])){_0x175560[_0xca69('0x11')][_0x777abd]=new Agent(_0x550d14);}else{_0x175560[_0xca69('0x3d')](_0x175560['agents'][_0x777abd],_0x550d14);}}}return _0x175560[_0xca69('0x11')];};};Realtime[_0xca69('0x3c')][_0xca69('0x40')]=function(){var _0x23ad91=this;return function(_0x15948d){if(_0x15948d){freeIsNotKeySip(_0x15948d,_0x23ad91[_0xca69('0x41')]);for(var _0x1e7a74=0x0,_0x29b75b={},_0x414248={};_0x1e7a74<_0x15948d[_0xca69('0x42')];_0x1e7a74+=0x1){_0x29b75b=_0x15948d[_0x1e7a74];if(_[_0xca69('0x3f')](_0x23ad91[_0xca69('0x41')][util['format'](_0xca69('0x29'),_0x29b75b[_0xca69('0x26')])])){_0x23ad91[_0xca69('0x41')][util[_0xca69('0x25')]('SIP/%s',_0x29b75b[_0xca69('0x26')])]=new Telephone(_0x29b75b);}else{_0x23ad91['mergeFromDatabase'](_0x23ad91[_0xca69('0x41')][util[_0xca69('0x25')](_0xca69('0x29'),_0x29b75b[_0xca69('0x26')])],_0x29b75b);}}}return _0x23ad91[_0xca69('0x41')];};};Realtime[_0xca69('0x3c')][_0xca69('0x43')]=function(){var _0x3ccc47=this;return function(_0x1bfbd8){if(_0x1bfbd8){freeIsNotKeySip(_0x1bfbd8,_0x3ccc47[_0xca69('0x44')]);for(var _0x5a1eeb=0x0,_0x53f5f8={},_0x50117e={};_0x5a1eeb<_0x1bfbd8[_0xca69('0x42')];_0x5a1eeb+=0x1){_0x53f5f8=_0x1bfbd8[_0x5a1eeb];if(_['isUndefined'](_0x3ccc47[_0xca69('0x44')][util[_0xca69('0x25')](_0xca69('0x29'),_0x53f5f8[_0xca69('0x26')])])){_0x3ccc47[_0xca69('0x44')][util[_0xca69('0x25')](_0xca69('0x29'),_0x53f5f8[_0xca69('0x26')])]=new Trunk(_0x53f5f8);}else{_0x3ccc47[_0xca69('0x3d')](_0x3ccc47[_0xca69('0x44')][util[_0xca69('0x25')](_0xca69('0x29'),_0x53f5f8['name'])],_0x53f5f8);}}}return _0x3ccc47[_0xca69('0x44')];};};Realtime[_0xca69('0x3c')][_0xca69('0x45')]=function(){var _0x37b1ba=this;return function(_0x5e0e4f){if(_0x5e0e4f){freeIsNotKey(_0x5e0e4f,_0x37b1ba['voiceQueues'],_0xca69('0x26'));for(var _0x52670d=0x0,_0x5fe979={},_0x493f92={};_0x52670d<_0x5e0e4f[_0xca69('0x42')];_0x52670d+=0x1){_0x5fe979=_0x5e0e4f[_0x52670d];if(_['isUndefined'](_0x37b1ba['voiceQueues'][_0x5fe979[_0xca69('0x26')]])){_0x37b1ba['voiceQueues'][_0x5fe979[_0xca69('0x26')]]=new VoiceQueue(_0x5fe979);}else{_0x37b1ba[_0xca69('0x3d')](_0x37b1ba[_0xca69('0x12')][_0x5fe979[_0xca69('0x26')]],_0x5fe979);}}}return _0x37b1ba[_0xca69('0x12')];};};Realtime[_0xca69('0x3c')]['initTriggers']=function(){var _0xcc42b0=this;return function(_0x3a8538){if(_0x3a8538){freeIsNotKey(_0x3a8538,_0xcc42b0['triggers'],'id');for(var _0xe4817f=0x0,_0xb893d0={},_0x3e2064={};_0xe4817f<_0x3a8538[_0xca69('0x42')];_0xe4817f+=0x1){_0xb893d0=_0x3a8538[_0xe4817f];if(_[_0xca69('0x3f')](_0xcc42b0[_0xca69('0x13')][_0xb893d0['id']])){_0xcc42b0['triggers'][_0xb893d0['id']]=new Trigger(_0xb893d0);}else{_0xcc42b0[_0xca69('0x3d')](_0xcc42b0[_0xca69('0x13')][_0xb893d0['id']],_0xb893d0);}}}return _0xcc42b0[_0xca69('0x13')];};};Realtime[_0xca69('0x3c')][_0xca69('0x46')]=function(){var _0x5be20c=this;return function(_0x3fa3cb){if(_0x3fa3cb){freeIsNotKey(_0x3fa3cb,_0x5be20c[_0xca69('0x14')],'id');for(var _0x4b929f=0x0,_0x5cfe78={},_0x26fd83={};_0x4b929f<_0x3fa3cb['length'];_0x4b929f+=0x1){_0x5cfe78=_0x3fa3cb[_0x4b929f];if(_[_0xca69('0x3f')](_0x5be20c[_0xca69('0x14')][_0x5cfe78['id']])){_0x5be20c[_0xca69('0x14')][_0x5cfe78['id']]=new Template(_0x5cfe78);}else{_0x5be20c[_0xca69('0x3d')](_0x5be20c[_0xca69('0x14')][_0x5cfe78['id']],_0x5cfe78);}}}return _0x5be20c['templates'];};};Realtime[_0xca69('0x3c')][_0xca69('0x47')]=function(){var _0x3f7396=this;return function(_0x392ada){if(_0x392ada){freeIsNotKey(_0x392ada,_0x3f7396[_0xca69('0x48')],'id');for(var _0xbe21e=0x0,_0x5b6295={},_0x3250e1={};_0xbe21e<_0x392ada[_0xca69('0x42')];_0xbe21e+=0x1){_0x5b6295=_0x392ada[_0xbe21e];if(_[_0xca69('0x3f')](_0x3f7396[_0xca69('0x48')][_0x5b6295['id']])){_0x3f7396[_0xca69('0x48')][_0x5b6295['id']]=new ZendeskAccount(_0x5b6295);}else{_0x3f7396['mergeFromDatabase'](_0x3f7396[_0xca69('0x48')][_0x5b6295['id']],_0x5b6295);}}}return _0x3f7396[_0xca69('0x48')];};};Realtime[_0xca69('0x3c')][_0xca69('0x49')]=function(){var _0x152e0e=this;return function(_0xbf2566){if(_0xbf2566){freeIsNotKey(_0xbf2566,_0x152e0e['salesforceAccounts'],'id');for(var _0x3d2484=0x0,_0x45f479={},_0x126a87={};_0x3d2484<_0xbf2566[_0xca69('0x42')];_0x3d2484+=0x1){_0x45f479=_0xbf2566[_0x3d2484];if(_[_0xca69('0x3f')](_0x152e0e[_0xca69('0x1a')][_0x45f479['id']])){_0x152e0e[_0xca69('0x1a')][_0x45f479['id']]=new SalesforceAccount(_0x45f479);}else{_0x152e0e[_0xca69('0x3d')](_0x152e0e['salesforceAccounts'][_0x45f479['id']],_0x45f479);}}}return _0x152e0e['salesforceAccounts'];};};Realtime[_0xca69('0x3c')][_0xca69('0x4a')]=function(){var _0x4629dd=this;return function(_0xd2fc7d){if(_0xd2fc7d){freeIsNotKey(_0xd2fc7d,_0x4629dd['freshdeskAccounts'],'id');for(var _0x44e8f7=0x0,_0x29e9fc={},_0x40b2d8={};_0x44e8f7<_0xd2fc7d[_0xca69('0x42')];_0x44e8f7+=0x1){_0x29e9fc=_0xd2fc7d[_0x44e8f7];if(_[_0xca69('0x3f')](_0x4629dd[_0xca69('0x1c')][_0x29e9fc['id']])){_0x4629dd[_0xca69('0x1c')][_0x29e9fc['id']]=new FreshdeskAccount(_0x29e9fc);}else{_0x4629dd['mergeFromDatabase'](_0x4629dd[_0xca69('0x1c')][_0x29e9fc['id']],_0x29e9fc);}}}return _0x4629dd[_0xca69('0x1c')];};};Realtime['prototype'][_0xca69('0x4b')]=function(){var _0x52b96e=this;return function(_0x2cb2c2){if(_0x2cb2c2){freeIsNotKey(_0x2cb2c2,_0x52b96e[_0xca69('0x1d')],'id');for(var _0x31f7f4=0x0,_0xf5333d={},_0x4ef34c={};_0x31f7f4<_0x2cb2c2[_0xca69('0x42')];_0x31f7f4+=0x1){_0xf5333d=_0x2cb2c2[_0x31f7f4];if(_['isUndefined'](_0x52b96e['zohoAccounts'][_0xf5333d['id']])){_0x52b96e[_0xca69('0x1d')][_0xf5333d['id']]=new ZohoAccount(_0xf5333d);}else{_0x52b96e[_0xca69('0x3d')](_0x52b96e[_0xca69('0x1d')][_0xf5333d['id']],_0xf5333d);}}}return _0x52b96e[_0xca69('0x1d')];};};Realtime['prototype'][_0xca69('0x4c')]=function(){var _0x56559a=this;return function(_0x3de7a6){if(_0x3de7a6){freeIsNotKey(_0x3de7a6,_0x56559a[_0xca69('0x1e')],'id');for(var _0x41a26f=0x0,_0x4fd6ca={},_0x1129ab={};_0x41a26f<_0x3de7a6[_0xca69('0x42')];_0x41a26f+=0x1){_0x4fd6ca=_0x3de7a6[_0x41a26f];if(_['isUndefined'](_0x56559a[_0xca69('0x1e')][_0x4fd6ca['id']])){_0x56559a[_0xca69('0x1e')][_0x4fd6ca['id']]=new DeskAccount(_0x4fd6ca);}else{_0x56559a[_0xca69('0x3d')](_0x56559a['deskAccounts'][_0x4fd6ca['id']],_0x4fd6ca);}}}return _0x56559a[_0xca69('0x1e')];};};Realtime[_0xca69('0x3c')][_0xca69('0x4d')]=function(){var _0x1b9179=this;return function(_0xac599e){if(_0xac599e){freeIsNotKey(_0xac599e,_0x1b9179['sugarcrmAccounts'],'id');for(var _0x25a2e8=0x0,_0x728b0={},_0x1dad01={};_0x25a2e8<_0xac599e[_0xca69('0x42')];_0x25a2e8+=0x1){_0x728b0=_0xac599e[_0x25a2e8];if(_[_0xca69('0x3f')](_0x1b9179[_0xca69('0x1b')][_0x728b0['id']])){_0x1b9179['sugarcrmAccounts'][_0x728b0['id']]=new SugarcrmAccount(_0x728b0);}else{_0x1b9179[_0xca69('0x3d')](_0x1b9179[_0xca69('0x1b')][_0x728b0['id']],_0x728b0);}}}return _0x1b9179[_0xca69('0x1b')];};};Realtime[_0xca69('0x3c')][_0xca69('0x4e')]=function(){var _0x23174c=this;return function(_0x350a28){if(_0x350a28){freeIsNotKey(_0x350a28,_0x23174c[_0xca69('0x1f')],'id');for(var _0x16c08d=0x0,_0xf2b300={},_0x4da2da={};_0x16c08d<_0x350a28[_0xca69('0x42')];_0x16c08d+=0x1){_0xf2b300=_0x350a28[_0x16c08d];if(_['isUndefined'](_0x23174c['vtigerAccounts'][_0xf2b300['id']])){_0x23174c[_0xca69('0x1f')][_0xf2b300['id']]=new VtigerAccount(_0xf2b300);}else{_0x23174c[_0xca69('0x3d')](_0x23174c[_0xca69('0x1f')][_0xf2b300['id']],_0xf2b300);}}}return _0x23174c['vtigerAccounts'];};};Realtime[_0xca69('0x3c')][_0xca69('0x4f')]=function(){var _0x34b8a7=this;return function(_0x2b2142){if(_0x2b2142){freeIsNotKey(_0x2b2142,_0x34b8a7['servicenowAccounts'],'id');for(var _0x3fab08=0x0,_0x2e8318={},_0x20491c={};_0x3fab08<_0x2b2142[_0xca69('0x42')];_0x3fab08+=0x1){_0x2e8318=_0x2b2142[_0x3fab08];if(_['isUndefined'](_0x34b8a7[_0xca69('0x20')][_0x2e8318['id']])){_0x34b8a7[_0xca69('0x20')][_0x2e8318['id']]=new ServicenowAccount(_0x2e8318);}else{_0x34b8a7[_0xca69('0x3d')](_0x34b8a7['servicenowAccounts'][_0x2e8318['id']],_0x2e8318);}}}return _0x34b8a7[_0xca69('0x20')];};};Realtime['prototype'][_0xca69('0x50')]=function(){var _0x1de8c0=this;return function(_0x5daa24){if(_0x5daa24){freeIsNotKey(_0x5daa24,_0x1de8c0[_0xca69('0x21')],'id');for(var _0x19f6c0=0x0,_0x5c96a1={},_0x217a55={};_0x19f6c0<_0x5daa24['length'];_0x19f6c0+=0x1){_0x5c96a1=_0x5daa24[_0x19f6c0];if(_[_0xca69('0x3f')](_0x1de8c0['dynamics365Accounts'][_0x5c96a1['id']])){_0x1de8c0[_0xca69('0x21')][_0x5c96a1['id']]=new Dynamics365Account(_0x5c96a1);}else{_0x1de8c0[_0xca69('0x3d')](_0x1de8c0[_0xca69('0x21')][_0x5c96a1['id']],_0x5c96a1);}}}return _0x1de8c0[_0xca69('0x21')];};};Realtime[_0xca69('0x3c')][_0xca69('0x51')]=function(){var _0x5e8daf=this;return function(_0x562155){if(_0x562155){freeIsNotKey(_0x562155,_0x5e8daf[_0xca69('0x22')],'id');for(var _0x87e767=0x0,_0x12f827={},_0x41c3f7={};_0x87e767<_0x562155[_0xca69('0x42')];_0x87e767+=0x1){_0x12f827=_0x562155[_0x87e767];if(_['isUndefined'](_0x5e8daf['freshsalesAccounts'][_0x12f827['id']])){_0x5e8daf[_0xca69('0x22')][_0x12f827['id']]=new FreshsalesAccount(_0x12f827);}else{_0x5e8daf[_0xca69('0x3d')](_0x5e8daf[_0xca69('0x22')][_0x12f827['id']],_0x12f827);}}}return _0x5e8daf['freshsalesAccounts'];};};Realtime['prototype'][_0xca69('0x52')]=function(){var _0x4e2e51=this;return function(_0x340bce){for(var _0x472671=0x0;_0x472671<_0x340bce['length'];_0x472671+=0x1){_['merge'](_0x4e2e51['voiceQueues'][_0x340bce[_0x472671]['name']],_0x340bce[_0x472671]);}return _0x4e2e51[_0xca69('0x12')];};};Realtime[_0xca69('0x3c')][_0xca69('0x53')]=function(){var _0xe4183a=this;return function(_0x4d22f8){clearVoiceQueues(_0xe4183a[_0xca69('0x12')]);if(_0x4d22f8){_0x4d22f8=_['groupBy'](_0x4d22f8,_0xca69('0x54'));for(var _0x371620 in _0x4d22f8){if(_0x4d22f8['hasOwnProperty'](_0x371620)){var _0x2ed262={};for(var _0x573d76=0x0;_0x573d76<_0x4d22f8[_0x371620][_0xca69('0x42')];_0x573d76+=0x1){var _0x58e238=_0x4d22f8[_0x371620][_0x573d76][_0xca69('0x55')];if(_0xe4183a[_0xca69('0x12')][_0x58e238]){if(_0x4d22f8[_0x371620][_0x573d76][_0xca69('0x56')]){_0xe4183a[_0xca69('0x12')][_0x58e238][_0xca69('0x2f')]+=0x1;}if(_0x4d22f8[_0x371620][_0x573d76][_0xca69('0x57')]){_0xe4183a['voiceQueues'][_0x58e238]['abandoned']+=0x1;}_0xe4183a[_0xca69('0x12')][_0x58e238][_0xca69('0x58')]+=moment(_0x4d22f8[_0x371620][_0x573d76]['queuecallerleaveAt'])['diff'](moment(_0x4d22f8[_0x371620][_0x573d76][_0xca69('0x59')]),_0xca69('0x5a'))||0x0;if(_0x573d76===_0x4d22f8[_0x371620][_0xca69('0x42')]-0x1){_0xe4183a[_0xca69('0x12')][_0x58e238][_0xca69('0x2b')]+=moment(_0x4d22f8[_0x371620][_0x573d76][_0xca69('0x5b')]||_0x4d22f8[_0x371620][_0x573d76][_0xca69('0x5c')]||_0x4d22f8[_0x371620][_0x573d76][_0xca69('0x5d')])['diff'](moment(_0x4d22f8[_0x371620][_0x573d76][_0xca69('0x59')]),_0xca69('0x5a'))||0x0;_0xe4183a[_0xca69('0x12')][_0x58e238][_0xca69('0x2e')]+=0x1;if(_0x4d22f8[_0x371620][_0x573d76][_0xca69('0x5e')]){_0xe4183a[_0xca69('0x12')][_0x58e238]['answered']+=0x1;_0xe4183a[_0xca69('0x12')][_0x58e238][_0xca69('0x31')]+=moment(_0x4d22f8[_0x371620][_0x573d76][_0xca69('0x5b')])[_0xca69('0x5f')](moment(_0x4d22f8[_0x371620][_0x573d76][_0xca69('0x60')]),'seconds')||0x0;}}else{_0xe4183a[_0xca69('0x12')][_0x58e238]['sumDuration']+=_0xe4183a[_0xca69('0x12')][_0x58e238][_0xca69('0x58')]||0x0;}}}}}}return _0xe4183a[_0xca69('0x12')];};};Realtime[_0xca69('0x3c')][_0xca69('0x61')]=function(){var _0x121ecd=this;return function(_0x2b6575){clearVoiceCallReports(_0x121ecd[_0xca69('0x15')]);if(_0x2b6575){for(var _0x274730=0x0;_0x274730<_0x2b6575['length'];_0x274730+=0x1){_0x121ecd[_0xca69('0x15')]['total']+=0x1;_0x121ecd['outbound'][_0xca69('0x2b')]+=_0x2b6575[_0x274730]['duration'];if(_0x2b6575[_0x274730][_0xca69('0x62')]===_0xca69('0x63')){_0x121ecd[_0xca69('0x15')][_0xca69('0x2a')]+=0x1;_0x121ecd['outbound'][_0xca69('0x58')]+=_0x2b6575[_0x274730][_0xca69('0x64')]-_0x2b6575[_0x274730]['billableseconds']||0x0;_0x121ecd[_0xca69('0x15')][_0xca69('0x31')]+=_0x2b6575[_0x274730][_0xca69('0x65')];}}}return _0x121ecd[_0xca69('0x15')];};};Realtime[_0xca69('0x3c')][_0xca69('0x66')]=function(){var _0x181959=this;return function(_0x583c83){if(_0x583c83){freeIsNotKey(_0x583c83,_0x181959['campaigns'],_0xca69('0x26'));for(var _0x5c6e01=0x0,_0x52f535={};_0x5c6e01<_0x583c83[_0xca69('0x42')];_0x5c6e01+=0x1){_0x52f535=_0x583c83[_0x5c6e01];if(_[_0xca69('0x3f')](_0x181959[_0xca69('0x67')][_0x52f535['name']])){_0x181959[_0xca69('0x67')][_0x52f535[_0xca69('0x26')]]=new Campaign(_0x52f535);}else{_0x181959[_0xca69('0x3d')](_0x181959['campaigns'][_0x52f535[_0xca69('0x26')]],_0x52f535);_0x181959[_0xca69('0x67')][_0x52f535[_0xca69('0x26')]][_0xca69('0x68')]=_0x52f535[_0xca69('0x69')]?_0x52f535[_0xca69('0x69')]['name']:undefined;}}}return _0x181959['campaigns'];};};Realtime[_0xca69('0x3c')]['initVoiceExtensions']=function(){var _0x2a8c69=this;return function(_0xc518d6){if(_0xc518d6){freeIsNotKey(_0xc518d6,_0x2a8c69[_0xca69('0x16')],'id');for(var _0x4a9acf=0x0,_0x5975e9={};_0x4a9acf<_0xc518d6[_0xca69('0x42')];_0x4a9acf+=0x1){_0x5975e9=_0xc518d6[_0x4a9acf];if(_['isUndefined'](_0x2a8c69[_0xca69('0x16')][_0x5975e9['id']])){_0x2a8c69['voiceExtensions'][_0x5975e9['id']]=new VoiceExtension(_0x5975e9);}else{_0x2a8c69[_0xca69('0x3d')](_0x2a8c69[_0xca69('0x16')][_0x5975e9['id']],_0x5975e9);}}}return _0x2a8c69[_0xca69('0x16')];};};Realtime[_0xca69('0x3c')][_0xca69('0x6a')]=function(){var _0x2deb90=this;return function(_0x3ac3d8){clearCampaigns(_0x2deb90[_0xca69('0x67')]);for(var _0x231286=0x0;_0x231286<_0x3ac3d8[_0xca69('0x42')];_0x231286+=0x1){_['merge'](_0x2deb90[_0xca69('0x67')][_0x3ac3d8[_0x231286][_0xca69('0x26')]],_0x3ac3d8[_0x231286]);}return _0x2deb90[_0xca69('0x67')];};};Realtime[_0xca69('0x3c')][_0xca69('0x6b')]=function(){var _0x29c7a2=this;return function(_0x2bdedd){if(_0x2bdedd){freeIsNotKey(_0x2bdedd,_0x29c7a2[_0xca69('0x6c')],'id');for(var _0x4be935=0x0,_0x3e5de3={},_0x20cf57={};_0x4be935<_0x2bdedd['length'];_0x4be935+=0x1){_0x3e5de3=_0x2bdedd[_0x4be935];if(_[_0xca69('0x3f')](_0x29c7a2[_0xca69('0x6c')][_0x3e5de3['id']])){_0x29c7a2[_0xca69('0x6c')][_0x3e5de3['id']]=new FaxAccount(_0x3e5de3);}else{_0x29c7a2['mergeFromDatabase'](_0x29c7a2[_0xca69('0x6c')][_0x3e5de3['id']],_0x3e5de3);}}}return _0x29c7a2['faxAccounts'];};};module[_0xca69('0x6d')]=Realtime; \ No newline at end of file +var _0x6056=['../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/freshsalesAccount','../model/faxAccount','telephones','triggers','campaigns','templates','outbound','voiceExtensions','channels','outboundChannels','timers','zendeskAccounts','salesforceAccounts','freshdeskAccounts','vtigerAccounts','servicenowAccounts','freshsalesAccounts','hasOwnProperty','mapKeys','format','SIP/%s','isNil','interface','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','agents','isUndefined','mergeFromDatabase','length','name','initTrunks','trunks','voiceQueues','initTriggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','deskAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','groupBy','queuecallerexit','queuecallerleaveAt','seconds','queuecallercompleteAt','queuecallerexitAt','diff','initVoiceCallReports','ANSWERED','duration','billableseconds','initVoiceExtensions','initCampaignHopperHistory','merge','faxAccounts','util','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension'];(function(_0x80ace2,_0x567fd3){var _0x293164=function(_0x4105c7){while(--_0x4105c7){_0x80ace2['push'](_0x80ace2['shift']());}};_0x293164(++_0x567fd3);}(_0x6056,0x1f3));var _0x6605=function(_0x130319,_0x5722d8){_0x130319=_0x130319-0x0;var _0x235ae3=_0x6056[_0x130319];return _0x235ae3;};'use strict';var BPromise=require('bluebird');var util=require(_0x6605('0x0'));var _=require(_0x6605('0x1'));var moment=require(_0x6605('0x2'));var Agent=require(_0x6605('0x3'));var Telephone=require(_0x6605('0x4'));var Trunk=require(_0x6605('0x5'));var VoiceQueue=require(_0x6605('0x6'));var Trigger=require(_0x6605('0x7'));var Template=require(_0x6605('0x8'));var Campaign=require(_0x6605('0x9'));var VoiceExtension=require(_0x6605('0xa'));var ZendeskAccount=require(_0x6605('0xb'));var SalesforceAccount=require(_0x6605('0xc'));var FreshdeskAccount=require(_0x6605('0xd'));var SugarcrmAccount=require(_0x6605('0xe'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0x6605('0xf'));var VtigerAccount=require(_0x6605('0x10'));var ServicenowAccount=require(_0x6605('0x11'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require(_0x6605('0x12'));var FaxAccount=require(_0x6605('0x13'));var Realtime=function(){this['agents']={};this[_0x6605('0x14')]={};this['trunks']={};this['voiceQueues']={};this[_0x6605('0x15')]={};this[_0x6605('0x16')]={};this[_0x6605('0x17')]={};this[_0x6605('0x18')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x6605('0x19')]={};this[_0x6605('0x1a')]={};this['queueChannels']={};this[_0x6605('0x1b')]={};this[_0x6605('0x1c')]={};this['settings']={};this[_0x6605('0x1d')]={};this[_0x6605('0x1e')]={};this['sugarcrmAccounts']={};this[_0x6605('0x1f')]={};this['zohoAccounts']={};this['deskAccounts']={};this[_0x6605('0x20')]={};this[_0x6605('0x21')]={};this['dynamics365Accounts']={};this[_0x6605('0x22')]={};this['faxAccounts']={};};function freeIsNotKey(_0xffc322,_0x146898,_0xa93bf0){var _0x2e05d3=_['mapKeys'](_0xffc322,function(_0x4addbf,_0x2215e6){return _0x4addbf[_0xa93bf0];});for(var _0x5ab0b4 in _0x146898){if(_0x146898[_0x6605('0x23')](_0x5ab0b4)){if(!_0x2e05d3[_0x5ab0b4]){delete _0x146898[_0x5ab0b4];}}}}function freeIsNotKeySip(_0x5787a2,_0x232a3e){var _0x443278=_[_0x6605('0x24')](_0x5787a2,function(_0x17f5d7,_0x226bc3){return util[_0x6605('0x25')](_0x6605('0x26'),_0x17f5d7['name']);});for(var _0x4f7bf7 in _0x232a3e){if(_0x232a3e['hasOwnProperty'](_0x4f7bf7)){if(!_0x443278[_0x4f7bf7]){delete _0x232a3e[_0x4f7bf7];}}}}function freeIsNotKeyAgent(_0x253aa3,_0x54dea1){var _0x5e77b9=_[_0x6605('0x24')](_0x253aa3,function(_0x3eed66,_0x3b6b64){var _0x3ab98f=_[_0x6605('0x27')](_0x3eed66[_0x6605('0x28')])?util[_0x6605('0x25')](_0x6605('0x26'),_0x3eed66['name']):_0x3eed66[_0x6605('0x28')];return _0x3ab98f;});for(var _0x315e79 in _0x54dea1){if(_0x54dea1[_0x6605('0x23')](_0x315e79)){if(!_0x5e77b9[_0x315e79]){delete _0x54dea1[_0x315e79];}}}}function clearVoiceCallReports(_0x313af0){_0x313af0[_0x6605('0x29')]=0x0;_0x313af0[_0x6605('0x2a')]=0x0;_0x313af0[_0x6605('0x2b')]=0x0;_0x313af0[_0x6605('0x2c')]=0x0;_0x313af0[_0x6605('0x2d')]=0x0;}function clearCampaigns(_0x40fe69){if(!_[_0x6605('0x2e')](_0x40fe69)){for(var _0x4dee44 in _0x40fe69){if(_0x40fe69[_0x6605('0x23')](_0x4dee44)){_0x40fe69[_0x4dee44]['ivrTotalCallsDays']=0x0;_0x40fe69[_0x4dee44][_0x6605('0x2f')]=0x0;}}}}function clearVoiceQueues(_0x4390e0){if(!_[_0x6605('0x2e')](_0x4390e0)){for(var _0x431178 in _0x4390e0){if(_0x4390e0[_0x6605('0x23')](_0x431178)){_0x4390e0[_0x431178][_0x6605('0x29')]=0x0;_0x4390e0[_0x431178][_0x6605('0x2a')]=0x0;_0x4390e0[_0x431178][_0x6605('0x30')]=0x0;_0x4390e0[_0x431178][_0x6605('0x31')]=0x0;_0x4390e0[_0x431178][_0x6605('0x2b')]=0x0;_0x4390e0[_0x431178][_0x6605('0x2c')]=0x0;_0x4390e0[_0x431178][_0x6605('0x2d')]=0x0;_0x4390e0[_0x431178][_0x6605('0x32')]=0x0;_0x4390e0[_0x431178][_0x6605('0x33')]=0x0;_0x4390e0[_0x431178]['outboundBusyCallsDay']=0x0;_0x4390e0[_0x431178][_0x6605('0x34')]=0x0;_0x4390e0[_0x431178]['outboundNoSuchCallsDay']=0x0;_0x4390e0[_0x431178][_0x6605('0x35')]=0x0;_0x4390e0[_0x431178][_0x6605('0x36')]=0x0;_0x4390e0[_0x431178][_0x6605('0x37')]=0x0;_0x4390e0[_0x431178][_0x6605('0x38')]=0x0;_0x4390e0[_0x431178][_0x6605('0x39')]=0x0;_0x4390e0[_0x431178][_0x6605('0x3a')]=0x0;_0x4390e0[_0x431178][_0x6605('0x3b')]=0x0;_0x4390e0[_0x431178][_0x6605('0x32')]=0x0;_0x4390e0[_0x431178][_0x6605('0x3c')]=0x0;_0x4390e0[_0x431178][_0x6605('0x3d')]=!![];}}}}Realtime[_0x6605('0x3e')]['mergeFromDatabase']=function(_0x3a79cb,_0x2cdeaa){for(var _0x592ea1 in _0x2cdeaa){if(_0x3a79cb['hasOwnProperty'](_0x592ea1)){_0x3a79cb[_0x592ea1]=_0x2cdeaa[_0x592ea1];}}};Realtime[_0x6605('0x3e')]['initAgents']=function(){var _0x5c06f3=this;return function(_0x4e45ef){if(_0x4e45ef){freeIsNotKeyAgent(_0x4e45ef,_0x5c06f3[_0x6605('0x3f')]);for(var _0xab43f1=0x0,_0xc04236={},_0x5c9763={};_0xab43f1<_0x4e45ef['length'];_0xab43f1+=0x1){_0xc04236=_0x4e45ef[_0xab43f1];var _0x2c2fd0=_[_0x6605('0x27')](_0xc04236[_0x6605('0x28')])?util[_0x6605('0x25')]('SIP/%s',_0xc04236['name']):_0xc04236['interface'];if(_[_0x6605('0x40')](_0x5c06f3[_0x6605('0x3f')][_0x2c2fd0])){_0x5c06f3[_0x6605('0x3f')][_0x2c2fd0]=new Agent(_0xc04236);}else{_0x5c06f3[_0x6605('0x41')](_0x5c06f3['agents'][_0x2c2fd0],_0xc04236);}}}return _0x5c06f3['agents'];};};Realtime[_0x6605('0x3e')]['initTelephones']=function(){var _0x3b5e8f=this;return function(_0x442b54){if(_0x442b54){freeIsNotKeySip(_0x442b54,_0x3b5e8f[_0x6605('0x14')]);for(var _0x19edcf=0x0,_0x11f473={},_0x47024c={};_0x19edcf<_0x442b54[_0x6605('0x42')];_0x19edcf+=0x1){_0x11f473=_0x442b54[_0x19edcf];if(_[_0x6605('0x40')](_0x3b5e8f[_0x6605('0x14')][util[_0x6605('0x25')](_0x6605('0x26'),_0x11f473[_0x6605('0x43')])])){_0x3b5e8f[_0x6605('0x14')][util['format'](_0x6605('0x26'),_0x11f473['name'])]=new Telephone(_0x11f473);}else{_0x3b5e8f['mergeFromDatabase'](_0x3b5e8f[_0x6605('0x14')][util[_0x6605('0x25')]('SIP/%s',_0x11f473['name'])],_0x11f473);}}}return _0x3b5e8f[_0x6605('0x14')];};};Realtime[_0x6605('0x3e')][_0x6605('0x44')]=function(){var _0x149617=this;return function(_0x1d184c){if(_0x1d184c){freeIsNotKeySip(_0x1d184c,_0x149617[_0x6605('0x45')]);for(var _0xb9e83c=0x0,_0x444a94={},_0x5802da={};_0xb9e83c<_0x1d184c['length'];_0xb9e83c+=0x1){_0x444a94=_0x1d184c[_0xb9e83c];if(_['isUndefined'](_0x149617[_0x6605('0x45')][util['format'](_0x6605('0x26'),_0x444a94[_0x6605('0x43')])])){_0x149617[_0x6605('0x45')][util['format'](_0x6605('0x26'),_0x444a94[_0x6605('0x43')])]=new Trunk(_0x444a94);}else{_0x149617[_0x6605('0x41')](_0x149617[_0x6605('0x45')][util[_0x6605('0x25')]('SIP/%s',_0x444a94[_0x6605('0x43')])],_0x444a94);}}}return _0x149617['trunks'];};};Realtime[_0x6605('0x3e')]['initVoiceQueues']=function(){var _0x5bbdee=this;return function(_0x2c1b65){if(_0x2c1b65){freeIsNotKey(_0x2c1b65,_0x5bbdee[_0x6605('0x46')],_0x6605('0x43'));for(var _0x251388=0x0,_0x432e10={},_0x571ce6={};_0x251388<_0x2c1b65[_0x6605('0x42')];_0x251388+=0x1){_0x432e10=_0x2c1b65[_0x251388];if(_[_0x6605('0x40')](_0x5bbdee[_0x6605('0x46')][_0x432e10[_0x6605('0x43')]])){_0x5bbdee[_0x6605('0x46')][_0x432e10['name']]=new VoiceQueue(_0x432e10);}else{_0x5bbdee['mergeFromDatabase'](_0x5bbdee[_0x6605('0x46')][_0x432e10[_0x6605('0x43')]],_0x432e10);}}}return _0x5bbdee[_0x6605('0x46')];};};Realtime[_0x6605('0x3e')][_0x6605('0x47')]=function(){var _0x1bd8c5=this;return function(_0x3df038){if(_0x3df038){freeIsNotKey(_0x3df038,_0x1bd8c5[_0x6605('0x15')],'id');for(var _0x54d9b1=0x0,_0x319d01={},_0x421404={};_0x54d9b1<_0x3df038[_0x6605('0x42')];_0x54d9b1+=0x1){_0x319d01=_0x3df038[_0x54d9b1];if(_[_0x6605('0x40')](_0x1bd8c5[_0x6605('0x15')][_0x319d01['id']])){_0x1bd8c5[_0x6605('0x15')][_0x319d01['id']]=new Trigger(_0x319d01);}else{_0x1bd8c5[_0x6605('0x41')](_0x1bd8c5['triggers'][_0x319d01['id']],_0x319d01);}}}return _0x1bd8c5['triggers'];};};Realtime[_0x6605('0x3e')][_0x6605('0x48')]=function(){var _0x33866a=this;return function(_0x5ba137){if(_0x5ba137){freeIsNotKey(_0x5ba137,_0x33866a[_0x6605('0x17')],'id');for(var _0x25a1ec=0x0,_0x29b2fb={},_0x5843a8={};_0x25a1ec<_0x5ba137[_0x6605('0x42')];_0x25a1ec+=0x1){_0x29b2fb=_0x5ba137[_0x25a1ec];if(_[_0x6605('0x40')](_0x33866a[_0x6605('0x17')][_0x29b2fb['id']])){_0x33866a[_0x6605('0x17')][_0x29b2fb['id']]=new Template(_0x29b2fb);}else{_0x33866a[_0x6605('0x41')](_0x33866a['templates'][_0x29b2fb['id']],_0x29b2fb);}}}return _0x33866a[_0x6605('0x17')];};};Realtime[_0x6605('0x3e')][_0x6605('0x49')]=function(){var _0x32b4b2=this;return function(_0x4084da){if(_0x4084da){freeIsNotKey(_0x4084da,_0x32b4b2[_0x6605('0x1d')],'id');for(var _0x24e1b7=0x0,_0x50f856={},_0x679faf={};_0x24e1b7<_0x4084da[_0x6605('0x42')];_0x24e1b7+=0x1){_0x50f856=_0x4084da[_0x24e1b7];if(_[_0x6605('0x40')](_0x32b4b2[_0x6605('0x1d')][_0x50f856['id']])){_0x32b4b2[_0x6605('0x1d')][_0x50f856['id']]=new ZendeskAccount(_0x50f856);}else{_0x32b4b2[_0x6605('0x41')](_0x32b4b2['zendeskAccounts'][_0x50f856['id']],_0x50f856);}}}return _0x32b4b2['zendeskAccounts'];};};Realtime['prototype'][_0x6605('0x4a')]=function(){var _0x4c8461=this;return function(_0xce4d1b){if(_0xce4d1b){freeIsNotKey(_0xce4d1b,_0x4c8461['salesforceAccounts'],'id');for(var _0x587494=0x0,_0x4a4e19={},_0x20d63d={};_0x587494<_0xce4d1b[_0x6605('0x42')];_0x587494+=0x1){_0x4a4e19=_0xce4d1b[_0x587494];if(_[_0x6605('0x40')](_0x4c8461[_0x6605('0x1e')][_0x4a4e19['id']])){_0x4c8461[_0x6605('0x1e')][_0x4a4e19['id']]=new SalesforceAccount(_0x4a4e19);}else{_0x4c8461[_0x6605('0x41')](_0x4c8461[_0x6605('0x1e')][_0x4a4e19['id']],_0x4a4e19);}}}return _0x4c8461[_0x6605('0x1e')];};};Realtime[_0x6605('0x3e')][_0x6605('0x4b')]=function(){var _0x11497f=this;return function(_0x524351){if(_0x524351){freeIsNotKey(_0x524351,_0x11497f['freshdeskAccounts'],'id');for(var _0x38a2ef=0x0,_0x462022={},_0x4dd70b={};_0x38a2ef<_0x524351[_0x6605('0x42')];_0x38a2ef+=0x1){_0x462022=_0x524351[_0x38a2ef];if(_[_0x6605('0x40')](_0x11497f['freshdeskAccounts'][_0x462022['id']])){_0x11497f['freshdeskAccounts'][_0x462022['id']]=new FreshdeskAccount(_0x462022);}else{_0x11497f[_0x6605('0x41')](_0x11497f[_0x6605('0x1f')][_0x462022['id']],_0x462022);}}}return _0x11497f[_0x6605('0x1f')];};};Realtime[_0x6605('0x3e')][_0x6605('0x4c')]=function(){var _0x3f431c=this;return function(_0x5b0acc){if(_0x5b0acc){freeIsNotKey(_0x5b0acc,_0x3f431c[_0x6605('0x4d')],'id');for(var _0x4e12c7=0x0,_0x3c2b54={},_0xaddb21={};_0x4e12c7<_0x5b0acc['length'];_0x4e12c7+=0x1){_0x3c2b54=_0x5b0acc[_0x4e12c7];if(_[_0x6605('0x40')](_0x3f431c['zohoAccounts'][_0x3c2b54['id']])){_0x3f431c[_0x6605('0x4d')][_0x3c2b54['id']]=new ZohoAccount(_0x3c2b54);}else{_0x3f431c[_0x6605('0x41')](_0x3f431c['zohoAccounts'][_0x3c2b54['id']],_0x3c2b54);}}}return _0x3f431c[_0x6605('0x4d')];};};Realtime[_0x6605('0x3e')][_0x6605('0x4e')]=function(){var _0x59428d=this;return function(_0x592eb8){if(_0x592eb8){freeIsNotKey(_0x592eb8,_0x59428d[_0x6605('0x4f')],'id');for(var _0x240869=0x0,_0x1f8757={},_0x5bf55a={};_0x240869<_0x592eb8['length'];_0x240869+=0x1){_0x1f8757=_0x592eb8[_0x240869];if(_[_0x6605('0x40')](_0x59428d['deskAccounts'][_0x1f8757['id']])){_0x59428d[_0x6605('0x4f')][_0x1f8757['id']]=new DeskAccount(_0x1f8757);}else{_0x59428d[_0x6605('0x41')](_0x59428d[_0x6605('0x4f')][_0x1f8757['id']],_0x1f8757);}}}return _0x59428d[_0x6605('0x4f')];};};Realtime['prototype']['initSugarcrmAccounts']=function(){var _0x2a5984=this;return function(_0x4a24ce){if(_0x4a24ce){freeIsNotKey(_0x4a24ce,_0x2a5984['sugarcrmAccounts'],'id');for(var _0xda1aa5=0x0,_0x246452={},_0x52f816={};_0xda1aa5<_0x4a24ce[_0x6605('0x42')];_0xda1aa5+=0x1){_0x246452=_0x4a24ce[_0xda1aa5];if(_[_0x6605('0x40')](_0x2a5984[_0x6605('0x50')][_0x246452['id']])){_0x2a5984[_0x6605('0x50')][_0x246452['id']]=new SugarcrmAccount(_0x246452);}else{_0x2a5984[_0x6605('0x41')](_0x2a5984[_0x6605('0x50')][_0x246452['id']],_0x246452);}}}return _0x2a5984[_0x6605('0x50')];};};Realtime[_0x6605('0x3e')][_0x6605('0x51')]=function(){var _0x154a20=this;return function(_0x1243cd){if(_0x1243cd){freeIsNotKey(_0x1243cd,_0x154a20['vtigerAccounts'],'id');for(var _0x1dd160=0x0,_0x4d901b={},_0x540996={};_0x1dd160<_0x1243cd[_0x6605('0x42')];_0x1dd160+=0x1){_0x4d901b=_0x1243cd[_0x1dd160];if(_[_0x6605('0x40')](_0x154a20[_0x6605('0x20')][_0x4d901b['id']])){_0x154a20['vtigerAccounts'][_0x4d901b['id']]=new VtigerAccount(_0x4d901b);}else{_0x154a20[_0x6605('0x41')](_0x154a20[_0x6605('0x20')][_0x4d901b['id']],_0x4d901b);}}}return _0x154a20[_0x6605('0x20')];};};Realtime[_0x6605('0x3e')][_0x6605('0x52')]=function(){var _0xcdc4c6=this;return function(_0x1d1a0a){if(_0x1d1a0a){freeIsNotKey(_0x1d1a0a,_0xcdc4c6[_0x6605('0x21')],'id');for(var _0x42b18f=0x0,_0x3ea5c8={},_0x17b3ca={};_0x42b18f<_0x1d1a0a['length'];_0x42b18f+=0x1){_0x3ea5c8=_0x1d1a0a[_0x42b18f];if(_[_0x6605('0x40')](_0xcdc4c6[_0x6605('0x21')][_0x3ea5c8['id']])){_0xcdc4c6[_0x6605('0x21')][_0x3ea5c8['id']]=new ServicenowAccount(_0x3ea5c8);}else{_0xcdc4c6[_0x6605('0x41')](_0xcdc4c6[_0x6605('0x21')][_0x3ea5c8['id']],_0x3ea5c8);}}}return _0xcdc4c6[_0x6605('0x21')];};};Realtime[_0x6605('0x3e')][_0x6605('0x53')]=function(){var _0x37c173=this;return function(_0x54b62b){if(_0x54b62b){freeIsNotKey(_0x54b62b,_0x37c173['dynamics365Accounts'],'id');for(var _0x20fedc=0x0,_0x35604f={},_0x5108b3={};_0x20fedc<_0x54b62b[_0x6605('0x42')];_0x20fedc+=0x1){_0x35604f=_0x54b62b[_0x20fedc];if(_[_0x6605('0x40')](_0x37c173[_0x6605('0x54')][_0x35604f['id']])){_0x37c173['dynamics365Accounts'][_0x35604f['id']]=new Dynamics365Account(_0x35604f);}else{_0x37c173[_0x6605('0x41')](_0x37c173['dynamics365Accounts'][_0x35604f['id']],_0x35604f);}}}return _0x37c173[_0x6605('0x54')];};};Realtime['prototype'][_0x6605('0x55')]=function(){var _0x2eb1a5=this;return function(_0x17723b){if(_0x17723b){freeIsNotKey(_0x17723b,_0x2eb1a5[_0x6605('0x22')],'id');for(var _0x50e07b=0x0,_0x39860b={},_0x2cd253={};_0x50e07b<_0x17723b[_0x6605('0x42')];_0x50e07b+=0x1){_0x39860b=_0x17723b[_0x50e07b];if(_['isUndefined'](_0x2eb1a5[_0x6605('0x22')][_0x39860b['id']])){_0x2eb1a5[_0x6605('0x22')][_0x39860b['id']]=new FreshsalesAccount(_0x39860b);}else{_0x2eb1a5['mergeFromDatabase'](_0x2eb1a5[_0x6605('0x22')][_0x39860b['id']],_0x39860b);}}}return _0x2eb1a5[_0x6605('0x22')];};};Realtime[_0x6605('0x3e')][_0x6605('0x56')]=function(){var _0x358566=this;return function(_0x472091){for(var _0x15f34f=0x0;_0x15f34f<_0x472091[_0x6605('0x42')];_0x15f34f+=0x1){_['merge'](_0x358566['voiceQueues'][_0x472091[_0x15f34f]['name']],_0x472091[_0x15f34f]);}return _0x358566[_0x6605('0x46')];};};Realtime[_0x6605('0x3e')]['initVoiceQueueReports']=function(){var _0x1215de=this;return function(_0xc8a76b){clearVoiceQueues(_0x1215de[_0x6605('0x46')]);if(_0xc8a76b){_0xc8a76b=_[_0x6605('0x57')](_0xc8a76b,'uniqueid');for(var _0x5385a2 in _0xc8a76b){if(_0xc8a76b['hasOwnProperty'](_0x5385a2)){var _0x5b39bb={};for(var _0x36c3ef=0x0;_0x36c3ef<_0xc8a76b[_0x5385a2]['length'];_0x36c3ef+=0x1){var _0x1a2611=_0xc8a76b[_0x5385a2][_0x36c3ef]['queue'];if(_0x1215de[_0x6605('0x46')][_0x1a2611]){if(_0xc8a76b[_0x5385a2][_0x36c3ef][_0x6605('0x58')]){_0x1215de[_0x6605('0x46')][_0x1a2611][_0x6605('0x30')]+=0x1;}if(_0xc8a76b[_0x5385a2][_0x36c3ef]['queuecallerabandon']){_0x1215de['voiceQueues'][_0x1a2611][_0x6605('0x31')]+=0x1;}_0x1215de[_0x6605('0x46')][_0x1a2611]['sumHoldTime']+=moment(_0xc8a76b[_0x5385a2][_0x36c3ef][_0x6605('0x59')])['diff'](moment(_0xc8a76b[_0x5385a2][_0x36c3ef]['queuecallerjoinAt']),_0x6605('0x5a'))||0x0;if(_0x36c3ef===_0xc8a76b[_0x5385a2][_0x6605('0x42')]-0x1){_0x1215de['voiceQueues'][_0x1a2611][_0x6605('0x2c')]+=moment(_0xc8a76b[_0x5385a2][_0x36c3ef][_0x6605('0x5b')]||_0xc8a76b[_0x5385a2][_0x36c3ef]['queuecallerabandonAt']||_0xc8a76b[_0x5385a2][_0x36c3ef][_0x6605('0x5c')])[_0x6605('0x5d')](moment(_0xc8a76b[_0x5385a2][_0x36c3ef]['queuecallerjoinAt']),'seconds')||0x0;_0x1215de[_0x6605('0x46')][_0x1a2611][_0x6605('0x29')]+=0x1;if(_0xc8a76b[_0x5385a2][_0x36c3ef]['queuecallercomplete']){_0x1215de['voiceQueues'][_0x1a2611][_0x6605('0x2a')]+=0x1;_0x1215de['voiceQueues'][_0x1a2611][_0x6605('0x2d')]+=moment(_0xc8a76b[_0x5385a2][_0x36c3ef]['queuecallercompleteAt'])[_0x6605('0x5d')](moment(_0xc8a76b[_0x5385a2][_0x36c3ef][_0x6605('0x59')]),_0x6605('0x5a'))||0x0;}}else{_0x1215de[_0x6605('0x46')][_0x1a2611]['sumDuration']+=_0x1215de[_0x6605('0x46')][_0x1a2611]['sumHoldTime']||0x0;}}}}}}return _0x1215de[_0x6605('0x46')];};};Realtime[_0x6605('0x3e')][_0x6605('0x5e')]=function(){var _0x1a1b05=this;return function(_0x9520a8){clearVoiceCallReports(_0x1a1b05[_0x6605('0x18')]);if(_0x9520a8){for(var _0x2d6936=0x0;_0x2d6936<_0x9520a8[_0x6605('0x42')];_0x2d6936+=0x1){_0x1a1b05[_0x6605('0x18')][_0x6605('0x29')]+=0x1;_0x1a1b05[_0x6605('0x18')][_0x6605('0x2c')]+=_0x9520a8[_0x2d6936]['duration'];if(_0x9520a8[_0x2d6936]['disposition']===_0x6605('0x5f')){_0x1a1b05[_0x6605('0x18')][_0x6605('0x2a')]+=0x1;_0x1a1b05['outbound']['sumHoldTime']+=_0x9520a8[_0x2d6936][_0x6605('0x60')]-_0x9520a8[_0x2d6936][_0x6605('0x61')]||0x0;_0x1a1b05[_0x6605('0x18')][_0x6605('0x2d')]+=_0x9520a8[_0x2d6936][_0x6605('0x61')];}}}return _0x1a1b05[_0x6605('0x18')];};};Realtime[_0x6605('0x3e')]['initCampaigns']=function(){var _0x5b66c9=this;return function(_0x92b25f){if(_0x92b25f){freeIsNotKey(_0x92b25f,_0x5b66c9[_0x6605('0x16')],'name');for(var _0x1ad2a7=0x0,_0x85ef65={};_0x1ad2a7<_0x92b25f['length'];_0x1ad2a7+=0x1){_0x85ef65=_0x92b25f[_0x1ad2a7];if(_[_0x6605('0x40')](_0x5b66c9['campaigns'][_0x85ef65['name']])){_0x5b66c9['campaigns'][_0x85ef65[_0x6605('0x43')]]=new Campaign(_0x85ef65);}else{_0x5b66c9[_0x6605('0x41')](_0x5b66c9['campaigns'][_0x85ef65[_0x6605('0x43')]],_0x85ef65);_0x5b66c9[_0x6605('0x16')][_0x85ef65[_0x6605('0x43')]]['dialQueueProject']=_0x85ef65['SquareProject']?_0x85ef65['SquareProject']['name']:undefined;}}}return _0x5b66c9[_0x6605('0x16')];};};Realtime['prototype'][_0x6605('0x62')]=function(){var _0xf20c67=this;return function(_0x533f41){if(_0x533f41){freeIsNotKey(_0x533f41,_0xf20c67['voiceExtensions'],'id');for(var _0x386675=0x0,_0x528e50={};_0x386675<_0x533f41[_0x6605('0x42')];_0x386675+=0x1){_0x528e50=_0x533f41[_0x386675];if(_[_0x6605('0x40')](_0xf20c67['voiceExtensions'][_0x528e50['id']])){_0xf20c67[_0x6605('0x19')][_0x528e50['id']]=new VoiceExtension(_0x528e50);}else{_0xf20c67['mergeFromDatabase'](_0xf20c67[_0x6605('0x19')][_0x528e50['id']],_0x528e50);}}}return _0xf20c67[_0x6605('0x19')];};};Realtime[_0x6605('0x3e')][_0x6605('0x63')]=function(){var _0x212312=this;return function(_0x36985a){clearCampaigns(_0x212312['campaigns']);for(var _0x1131da=0x0;_0x1131da<_0x36985a[_0x6605('0x42')];_0x1131da+=0x1){_[_0x6605('0x64')](_0x212312[_0x6605('0x16')][_0x36985a[_0x1131da][_0x6605('0x43')]],_0x36985a[_0x1131da]);}return _0x212312[_0x6605('0x16')];};};Realtime[_0x6605('0x3e')]['initFaxAccounts']=function(){var _0x1a0cf0=this;return function(_0x5eac0b){if(_0x5eac0b){freeIsNotKey(_0x5eac0b,_0x1a0cf0['faxAccounts'],'id');for(var _0x500732=0x0,_0x18defb={},_0x25863b={};_0x500732<_0x5eac0b[_0x6605('0x42')];_0x500732+=0x1){_0x18defb=_0x5eac0b[_0x500732];if(_[_0x6605('0x40')](_0x1a0cf0['faxAccounts'][_0x18defb['id']])){_0x1a0cf0[_0x6605('0x65')][_0x18defb['id']]=new FaxAccount(_0x18defb);}else{_0x1a0cf0[_0x6605('0x41')](_0x1a0cf0[_0x6605('0x65')][_0x18defb['id']],_0x18defb);}}}return _0x1a0cf0['faxAccounts'];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index e9ffc63..7a5564f 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 _0x20ba=['disabled','custom:voiceQueueReport','bind','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','blindtransfer','blindTransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','interface','format','SIP/%s','prototype','voiceQueueReport','length','connectedlinenum','assigned','lastAssignedTo','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','YYYY-MM-DD\x20HH:mm:ss','match','destination','exten','type','lastapplication','queue','lastdata','context','from-voip-provider','calleridnum','originatecalleridnum','destinationchannel','channel','callerid','calleridpreview','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','linkedid','transfereelinkedid','uniqueid','transfers','create','monitor','monitors','monitorFilename','createdAt','xcally-motion-preview','connectedlinename','membername','xcally-motion-dialer','isArray','forEach','voiceDialReport','startsWith','Local','indexOf','phone','substring','lastIndexOf','transfererlinkedid','exports','lodash','moment','../../../config/environment','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceQueueReport','./voiceAgentReport','realtime','agents','telephones','sync','xdr'];(function(_0x44af5a,_0x31abc){var _0x275f59=function(_0x2f845c){while(--_0x2f845c){_0x44af5a['push'](_0x44af5a['shift']());}};_0x275f59(++_0x31abc);}(_0x20ba,0x1a4));var _0xa20b=function(_0xee5d2a,_0x534134){_0xee5d2a=_0xee5d2a-0x0;var _0x346948=_0x20ba[_0xee5d2a];return _0x346948;};'use strict';var _=require(_0xa20b('0x0'));var moment=require(_0xa20b('0x1'));var util=require('util');var config=require(_0xa20b('0x2'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0xa20b('0x3'));var RpcVoiceCallReport=require(_0xa20b('0x4'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0xa20b('0x5'));var RpcVoiceQueueReport=require(_0xa20b('0x6'));var RpcVoiceRecording=require(_0xa20b('0x7'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0xa20b('0x8'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0xa20b('0x9'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require('./userReport');function Report(_0x5dd733){this[_0xa20b('0xa')]=_0x5dd733;this[_0xa20b('0xb')]=_0x5dd733[_0xa20b('0xb')];this['telephones']=_0x5dd733[_0xa20b('0xc')];}Report['prototype'][_0xa20b('0xd')]=function(_0x4a7210){var _0x83b088=new VoiceQueueReport(this[_0xa20b('0xa')]);var _0x24ec37=new VoiceAgentReport(this[_0xa20b('0xa')]);var _0x2d5f60=new VoiceDialReport(this[_0xa20b('0xa')]);var _0x199b6e=new VoiceCallReport(this['realtime']);var _0x1004d8=new UserReport(this[_0xa20b('0xa')]);if(config[_0xa20b('0xe')]&&config[_0xa20b('0xe')][_0xa20b('0xf')]){ami['on'](_0xa20b('0x10'),this['voiceQueueReport'][_0xa20b('0x11')](this));ami['on']('custom:voiceCallReport',this[_0xa20b('0x12')][_0xa20b('0x11')](this));ami['on'](_0xa20b('0x13'),this[_0xa20b('0x14')][_0xa20b('0x11')](this));ami['on'](_0xa20b('0x15'),this['voiceDialReport'][_0xa20b('0x11')](this));ami['on'](_0xa20b('0x16'),this[_0xa20b('0x17')][_0xa20b('0x11')](this));ami['on']('attendedtransfer',this[_0xa20b('0x18')][_0xa20b('0x11')](this));}};Report['prototype'][_0xa20b('0x19')]=function(_0x18ef32){var _0x460052;_0x460052=_[_0xa20b('0x1a')](this[_0xa20b('0xb')],function(_0x53fc3d){return _0x53fc3d[_0xa20b('0x1b')]==_0x18ef32||_0x53fc3d[_0xa20b('0x1c')]==_0x18ef32;});if(_[_0xa20b('0x1d')](_0x460052)){var _0x38ae6f=_['find'](this[_0xa20b('0xc')],function(_0x26f89a){return _0x26f89a[_0xa20b('0x1b')]==_0x18ef32||_0x26f89a[_0xa20b('0x1c')]==_0x18ef32;});if(_0x38ae6f){_0x460052=_[_0xa20b('0x1a')](this[_0xa20b('0xb')],function(_0x409e5d){return _0x409e5d[_0xa20b('0x1e')]==util[_0xa20b('0x1f')](_0xa20b('0x20'),_0x38ae6f[_0xa20b('0x1c')]);});}}return _0x460052;};Report[_0xa20b('0x21')][_0xa20b('0x22')]=function(_0x4b6c57){for(var _0x2cc653=0x0;_0x2cc653<_0x4b6c57[_0xa20b('0x23')];_0x2cc653+=0x1){var _0x4a7c3f=this[_0xa20b('0x19')](_0x4b6c57[_0x2cc653][_0xa20b('0x24')]);if(_0x4a7c3f){_0x4b6c57[_0x2cc653]['accountcode']=_0x4a7c3f['accountcode'];_0x4b6c57[_0x2cc653][_0xa20b('0x25')]=!![];_0x4b6c57[_0x2cc653][_0xa20b('0x26')]=_0x4a7c3f[_0xa20b('0x1c')];_0x4b6c57[_0x2cc653][_0xa20b('0x1e')]=_[_0xa20b('0x1d')](_0x4a7c3f[_0xa20b('0x1e')])?util[_0xa20b('0x1f')]('SIP/%s',_0x4a7c3f[_0xa20b('0x1c')]):_0x4a7c3f[_0xa20b('0x1e')];if(_0x4b6c57[_0x2cc653][_0xa20b('0x27')]){_0x4b6c57[_0x2cc653][_0xa20b('0x28')]=moment()[_0xa20b('0x1f')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x4b6c57[_0x2cc653][_0xa20b('0x29')]){_0x4b6c57[_0x2cc653][_0xa20b('0x2a')]=moment()[_0xa20b('0x1f')](_0xa20b('0x2b'));}RpcMemberReport['voiceQueueReport'](_0x4b6c57[_0x2cc653]);}RpcVoiceQueueReport['create'](_0x4b6c57[_0x2cc653]);}};function extractCalleridNumber(_0x2e44f6){var _0xc7ffd6=_0x2e44f6[_0xa20b('0x2c')](/<(.*?)>/);return _0xc7ffd6?_0xc7ffd6[0x1]:_0x2e44f6;}Report[_0xa20b('0x21')][_0xa20b('0x12')]=function(_0xce2ccd){_0xce2ccd[_0xa20b('0x2d')]=_0xce2ccd[_0xa20b('0x2d')]||_0xce2ccd[_0xa20b('0x2e')];if(_0xce2ccd[_0xa20b('0x2f')]=='dialer'){_0xce2ccd[_0xa20b('0x30')]=_0xa20b('0x31');_0xce2ccd[_0xa20b('0x32')]=_0xce2ccd[_0xa20b('0x31')];if(_0xce2ccd[_0xa20b('0x33')]==_0xa20b('0x34')){_0xce2ccd['accountcode']='';_0xce2ccd['destination']=extractCalleridNumber(_0xce2ccd['callerid']);}else if(_0xce2ccd['context']=='from-sip'){if(_0xce2ccd[_0xa20b('0x2d')]=='xcally-motion-preview'){_0xce2ccd['destination']=extractCalleridNumber(_0xce2ccd['calleridpreview']);_0xce2ccd[_0xa20b('0x35')]=_0xce2ccd[_0xa20b('0x36')];_0xce2ccd[_0xa20b('0x37')]=[_0xce2ccd[_0xa20b('0x38')],_0xce2ccd[_0xa20b('0x38')]=_0xce2ccd[_0xa20b('0x37')]][0x0];_0xce2ccd[_0xa20b('0x39')]=_0xce2ccd[_0xa20b('0x3a')];}else{_0xce2ccd[_0xa20b('0x2d')]=_0xce2ccd[_0xa20b('0x35')];_0xce2ccd['calleridnum']=_0xce2ccd[_0xa20b('0x36')];if(_0xce2ccd[_0xa20b('0x3b')]==_0xa20b('0x3c')){_0xce2ccd[_0xa20b('0x1b')]=_0xce2ccd[_0xa20b('0x24')];}else{_0xce2ccd[_0xa20b('0x1b')]='';}}}}else{_0xce2ccd[_0xa20b('0x39')]=util[_0xa20b('0x1f')](_0xa20b('0x3d'),_0xce2ccd[_0xa20b('0x3e')],_0xce2ccd['calleridnum']);}if(RpcVoiceTransferReport['transfers'][_0xce2ccd[_0xa20b('0x3f')]]){var _0x455081=RpcVoiceTransferReport['transfers'][_0xce2ccd[_0xa20b('0x3f')]];_0x455081[_0xa20b('0x40')]=_0xce2ccd[_0xa20b('0x41')];RpcVoiceTransferReport[_0xa20b('0x17')](_0x455081);delete RpcVoiceTransferReport[_0xa20b('0x42')][_0xce2ccd[_0xa20b('0x3f')]];}RpcVoiceCallReport[_0xa20b('0x43')](_0xce2ccd);if(_0xce2ccd[_0xa20b('0x44')]){for(var _0x2a7860=0x0;_0x2a7860<_0xce2ccd[_0xa20b('0x45')][_0xa20b('0x23')];_0x2a7860+=0x1){_0xce2ccd[_0xa20b('0x46')]=_0xce2ccd['monitors'][_0x2a7860]['filename'];_0xce2ccd[_0xa20b('0x47')]=_0xce2ccd[_0xa20b('0x45')][_0x2a7860][_0xa20b('0x47')];if(_0xce2ccd[_0xa20b('0x2e')]==_0xa20b('0x48')){_0xce2ccd[_0xa20b('0x35')]=_0xce2ccd[_0xa20b('0x24')];_0xce2ccd['calleridname']=_0xce2ccd[_0xa20b('0x49')];_0xce2ccd[_0xa20b('0x24')]=_0xce2ccd[_0xa20b('0x1b')];_0xce2ccd[_0xa20b('0x49')]=_0xce2ccd[_0xa20b('0x4a')];_0xce2ccd['exten']=_0xce2ccd[_0xa20b('0x36')];}else if(_0xce2ccd[_0xa20b('0x2e')]==_0xa20b('0x4b')){_0xce2ccd['calleridnum']=_0xce2ccd[_0xa20b('0x2d')];_0xce2ccd[_0xa20b('0x2e')]=_0xce2ccd['originatecalleridnum'];}RpcVoiceRecording['create'](_0xce2ccd);}}};Report[_0xa20b('0x21')]['voiceAgentReport']=function(_0x5f4f35){if(_[_0xa20b('0x4c')](_0x5f4f35)){_0x5f4f35[_0xa20b('0x4d')](function(_0x5c090a){RpcVoiceAgentReport['create'](_0x5c090a);});}else{RpcVoiceAgentReport[_0xa20b('0x43')](_0x5f4f35);}};Report[_0xa20b('0x21')][_0xa20b('0x4e')]=function(_0x12fa83){RpcVoiceDialReport[_0xa20b('0x43')](_0x12fa83);var _0x5b8f22;var _0x4331c4;var _0x4d04f8=_0x12fa83[_0xa20b('0x38')];if(_[_0xa20b('0x4f')](_0x4d04f8,_0xa20b('0x50'))){_0x4331c4=_0x4d04f8['substring'](_0x4d04f8[_0xa20b('0x51')]('/')+0x1,_0x4d04f8[_0xa20b('0x51')]('@'));_0x5b8f22=_[_0xa20b('0x1a')](this[_0xa20b('0xb')],function(_0x249e12){return _0x249e12['mobile']==_0x4331c4||_0x249e12[_0xa20b('0x52')]==_0x4331c4||_0x249e12[_0xa20b('0x1b')]==_0x4331c4;});}else{_0x4331c4=_0x4d04f8[_0xa20b('0x53')](_0x4d04f8[_0xa20b('0x51')]('/')+0x1,_0x4d04f8[_0xa20b('0x54')]('-'));_0x5b8f22=this[_0xa20b('0x19')](_0x4331c4);}if(_0x5b8f22){_0x12fa83[_0xa20b('0x1e')]=_[_0xa20b('0x1d')](_0x5b8f22['interface'])?util[_0xa20b('0x1f')](_0xa20b('0x20'),_0x5b8f22['name']):_0x5b8f22[_0xa20b('0x1e')];_0x12fa83[_0xa20b('0x4a')]=_0x5b8f22[_0xa20b('0x1c')];_0x12fa83[_0xa20b('0x1b')]=_0x5b8f22['accountcode'];RpcMemberReport[_0xa20b('0x4e')](_0x12fa83);}};Report['prototype']['blindTransfer']=function(_0x38476e){RpcVoiceTransferReport[_0xa20b('0x42')][_0x38476e[_0xa20b('0x55')]]=_0x38476e;};Report['prototype'][_0xa20b('0x18')]=function(_0x216ebf){RpcVoiceTransferReport[_0xa20b('0x18')](_0x216ebf);};module[_0xa20b('0x56')]=Report; \ No newline at end of file +var _0x3847=['connectedlinenum','originatecalleridnum','xcally-motion-dialer','startsWith','substring','indexOf','mobile','phone','membername','transfererlinkedid','attendedTransfer','exports','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceTransferReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','prototype','sync','xdr','custom:voiceQueueReport','custom:voiceCallReport','voiceCallReport','voiceAgentReport','bind','voiceDialReport','blindtransfer','attendedtransfer','findAgent','accountcode','name','isNil','telephones','find','interface','format','SIP/%s','voiceQueueReport','assigned','lastAssignedTo','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','create','match','destination','type','dialer','lastapplication','queue','lastdata','from-voip-provider','callerid','context','from-sip','xcally-motion-preview','calleridpreview','calleridnum','destinationchannel','channel','ANSWERED','\x22%s\x22\x20<%s>','transfers','linkedid','transfereelinkedid','uniqueid','blindTransfer','monitors','monitorFilename','filename','createdAt','exten','calleridname'];(function(_0x4b7976,_0x55e10b){var _0x422298=function(_0x531d4b){while(--_0x531d4b){_0x4b7976['push'](_0x4b7976['shift']());}};_0x422298(++_0x55e10b);}(_0x3847,0x160));var _0x7384=function(_0x574285,_0x1980fe){_0x574285=_0x574285-0x0;var _0x5157cc=_0x3847[_0x574285];return _0x5157cc;};'use strict';var _=require(_0x7384('0x0'));var moment=require(_0x7384('0x1'));var util=require(_0x7384('0x2'));var config=require(_0x7384('0x3'));var ami=require(_0x7384('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x7384('0x5'));var RpcVoiceDialReport=require(_0x7384('0x6'));var RpcMemberReport=require(_0x7384('0x7'));var RpcVoiceQueueReport=require(_0x7384('0x8'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0x7384('0x9'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0x7384('0xa'));var VoiceAgentReport=require(_0x7384('0xb'));var VoiceDialReport=require(_0x7384('0xc'));var UserReport=require(_0x7384('0xd'));function Report(_0x3aefa4){this[_0x7384('0xe')]=_0x3aefa4;this[_0x7384('0xf')]=_0x3aefa4['agents'];this['telephones']=_0x3aefa4['telephones'];}Report[_0x7384('0x10')][_0x7384('0x11')]=function(_0xb47aa0){var _0x598a98=new VoiceQueueReport(this['realtime']);var _0x1abc8f=new VoiceAgentReport(this['realtime']);var _0x2ebb78=new VoiceDialReport(this[_0x7384('0xe')]);var _0x12a68f=new VoiceCallReport(this['realtime']);var _0x2d9a5f=new UserReport(this[_0x7384('0xe')]);if(config[_0x7384('0x12')]&&config['xdr']['disabled']){ami['on'](_0x7384('0x13'),this['voiceQueueReport']['bind'](this));ami['on'](_0x7384('0x14'),this[_0x7384('0x15')]['bind'](this));ami['on']('custom:voiceAgentReport',this[_0x7384('0x16')][_0x7384('0x17')](this));ami['on']('custom:voiceDialReport',this[_0x7384('0x18')]['bind'](this));ami['on'](_0x7384('0x19'),this['blindTransfer'][_0x7384('0x17')](this));ami['on'](_0x7384('0x1a'),this['attendedTransfer'][_0x7384('0x17')](this));}};Report['prototype'][_0x7384('0x1b')]=function(_0x49663c){var _0xc792de;_0xc792de=_['find'](this[_0x7384('0xf')],function(_0x41660f){return _0x41660f[_0x7384('0x1c')]==_0x49663c||_0x41660f[_0x7384('0x1d')]==_0x49663c;});if(_[_0x7384('0x1e')](_0xc792de)){var _0x93eb30=_['find'](this[_0x7384('0x1f')],function(_0x28b266){return _0x28b266[_0x7384('0x1c')]==_0x49663c||_0x28b266['name']==_0x49663c;});if(_0x93eb30){_0xc792de=_[_0x7384('0x20')](this[_0x7384('0xf')],function(_0x286047){return _0x286047[_0x7384('0x21')]==util[_0x7384('0x22')](_0x7384('0x23'),_0x93eb30[_0x7384('0x1d')]);});}}return _0xc792de;};Report['prototype'][_0x7384('0x24')]=function(_0x20b187){for(var _0x45f266=0x0;_0x45f266<_0x20b187['length'];_0x45f266+=0x1){var _0x121b4c=this[_0x7384('0x1b')](_0x20b187[_0x45f266]['connectedlinenum']);if(_0x121b4c){_0x20b187[_0x45f266][_0x7384('0x1c')]=_0x121b4c['accountcode'];_0x20b187[_0x45f266][_0x7384('0x25')]=!![];_0x20b187[_0x45f266][_0x7384('0x26')]=_0x121b4c[_0x7384('0x1d')];_0x20b187[_0x45f266]['interface']=_[_0x7384('0x1e')](_0x121b4c[_0x7384('0x21')])?util[_0x7384('0x22')](_0x7384('0x23'),_0x121b4c[_0x7384('0x1d')]):_0x121b4c[_0x7384('0x21')];if(_0x20b187[_0x45f266][_0x7384('0x27')]){_0x20b187[_0x45f266][_0x7384('0x28')]=moment()[_0x7384('0x22')](_0x7384('0x29'));}if(_0x20b187[_0x45f266]['queuecallerexit']){_0x20b187[_0x45f266][_0x7384('0x2a')]=moment()['format'](_0x7384('0x29'));}RpcMemberReport['voiceQueueReport'](_0x20b187[_0x45f266]);}RpcVoiceQueueReport[_0x7384('0x2b')](_0x20b187[_0x45f266]);}};function extractCalleridNumber(_0x396884){var _0x1c2387=_0x396884[_0x7384('0x2c')](/<(.*?)>/);return _0x1c2387?_0x1c2387[0x1]:_0x396884;}Report[_0x7384('0x10')][_0x7384('0x15')]=function(_0x4fdb67){_0x4fdb67['destination']=_0x4fdb67[_0x7384('0x2d')]||_0x4fdb67['exten'];if(_0x4fdb67[_0x7384('0x2e')]==_0x7384('0x2f')){_0x4fdb67[_0x7384('0x30')]=_0x7384('0x31');_0x4fdb67[_0x7384('0x32')]=_0x4fdb67[_0x7384('0x31')];if(_0x4fdb67['context']==_0x7384('0x33')){_0x4fdb67[_0x7384('0x1c')]='';_0x4fdb67['destination']=extractCalleridNumber(_0x4fdb67[_0x7384('0x34')]);}else if(_0x4fdb67[_0x7384('0x35')]==_0x7384('0x36')){if(_0x4fdb67[_0x7384('0x2d')]==_0x7384('0x37')){_0x4fdb67[_0x7384('0x2d')]=extractCalleridNumber(_0x4fdb67[_0x7384('0x38')]);_0x4fdb67[_0x7384('0x39')]=_0x4fdb67['originatecalleridnum'];_0x4fdb67[_0x7384('0x3a')]=[_0x4fdb67[_0x7384('0x3b')],_0x4fdb67[_0x7384('0x3b')]=_0x4fdb67[_0x7384('0x3a')]][0x0];_0x4fdb67[_0x7384('0x34')]=_0x4fdb67[_0x7384('0x38')];}else{_0x4fdb67[_0x7384('0x2d')]=_0x4fdb67[_0x7384('0x39')];_0x4fdb67['calleridnum']=_0x4fdb67['originatecalleridnum'];if(_0x4fdb67['disposition']==_0x7384('0x3c')){_0x4fdb67['accountcode']=_0x4fdb67['connectedlinenum'];}else{_0x4fdb67['accountcode']='';}}}}else{_0x4fdb67['callerid']=util[_0x7384('0x22')](_0x7384('0x3d'),_0x4fdb67['calleridname'],_0x4fdb67[_0x7384('0x39')]);}if(RpcVoiceTransferReport['transfers'][_0x4fdb67['linkedid']]){var _0xb5c3b7=RpcVoiceTransferReport[_0x7384('0x3e')][_0x4fdb67[_0x7384('0x3f')]];_0xb5c3b7[_0x7384('0x40')]=_0x4fdb67[_0x7384('0x41')];RpcVoiceTransferReport[_0x7384('0x42')](_0xb5c3b7);delete RpcVoiceTransferReport['transfers'][_0x4fdb67[_0x7384('0x3f')]];}RpcVoiceCallReport[_0x7384('0x2b')](_0x4fdb67);if(_0x4fdb67['monitor']){for(var _0x45e741=0x0;_0x45e741<_0x4fdb67[_0x7384('0x43')]['length'];_0x45e741+=0x1){_0x4fdb67[_0x7384('0x44')]=_0x4fdb67[_0x7384('0x43')][_0x45e741][_0x7384('0x45')];_0x4fdb67[_0x7384('0x46')]=_0x4fdb67['monitors'][_0x45e741]['createdAt'];if(_0x4fdb67[_0x7384('0x47')]==_0x7384('0x37')){_0x4fdb67[_0x7384('0x39')]=_0x4fdb67['connectedlinenum'];_0x4fdb67[_0x7384('0x48')]=_0x4fdb67['connectedlinename'];_0x4fdb67[_0x7384('0x49')]=_0x4fdb67['accountcode'];_0x4fdb67['connectedlinename']=_0x4fdb67['membername'];_0x4fdb67['exten']=_0x4fdb67[_0x7384('0x4a')];}else if(_0x4fdb67[_0x7384('0x47')]==_0x7384('0x4b')){_0x4fdb67['calleridnum']=_0x4fdb67[_0x7384('0x2d')];_0x4fdb67[_0x7384('0x47')]=_0x4fdb67[_0x7384('0x4a')];}RpcVoiceRecording['create'](_0x4fdb67);}}};Report['prototype']['voiceAgentReport']=function(_0x36f0f0){if(_['isArray'](_0x36f0f0)){_0x36f0f0['forEach'](function(_0x4a9d77){RpcVoiceAgentReport[_0x7384('0x2b')](_0x4a9d77);});}else{RpcVoiceAgentReport[_0x7384('0x2b')](_0x36f0f0);}};Report[_0x7384('0x10')]['voiceDialReport']=function(_0x47ea61){RpcVoiceDialReport[_0x7384('0x2b')](_0x47ea61);var _0x29d3da;var _0x1541d4;var _0x5bf686=_0x47ea61[_0x7384('0x3b')];if(_[_0x7384('0x4c')](_0x5bf686,'Local')){_0x1541d4=_0x5bf686[_0x7384('0x4d')](_0x5bf686[_0x7384('0x4e')]('/')+0x1,_0x5bf686[_0x7384('0x4e')]('@'));_0x29d3da=_['find'](this[_0x7384('0xf')],function(_0x21a907){return _0x21a907[_0x7384('0x4f')]==_0x1541d4||_0x21a907[_0x7384('0x50')]==_0x1541d4||_0x21a907[_0x7384('0x1c')]==_0x1541d4;});}else{_0x1541d4=_0x5bf686[_0x7384('0x4d')](_0x5bf686[_0x7384('0x4e')]('/')+0x1,_0x5bf686['lastIndexOf']('-'));_0x29d3da=this['findAgent'](_0x1541d4);}if(_0x29d3da){_0x47ea61[_0x7384('0x21')]=_[_0x7384('0x1e')](_0x29d3da[_0x7384('0x21')])?util[_0x7384('0x22')](_0x7384('0x23'),_0x29d3da[_0x7384('0x1d')]):_0x29d3da[_0x7384('0x21')];_0x47ea61[_0x7384('0x51')]=_0x29d3da[_0x7384('0x1d')];_0x47ea61[_0x7384('0x1c')]=_0x29d3da[_0x7384('0x1c')];RpcMemberReport['voiceDialReport'](_0x47ea61);}};Report[_0x7384('0x10')][_0x7384('0x42')]=function(_0x4426fe){RpcVoiceTransferReport[_0x7384('0x3e')][_0x4426fe[_0x7384('0x52')]]=_0x4426fe;};Report[_0x7384('0x10')][_0x7384('0x53')]=function(_0x3867d2){RpcVoiceTransferReport['attendedTransfer'](_0x3867d2);};module[_0x7384('0x54')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 59008fa..86a0d69 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 _0x4eb0=['registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','moment','util','bluebird','../../../config/environment','ami','../ami','redis','defaults','socket.io-emitter','trunks','agents','telephones','bind','syncRegistry','syncDeviceState','peerstatus','syncRealtimeShow','resolve','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','inspect','actionDeviceStateList','[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','then','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','debug','[userReport][registry]','find','stateRegistry','merge','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','name','trunk:save','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','local','toLowerCase','stateTime','toNumber','format','updateStatusRealtime','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','trunk:%s','startsWith','Local','substring','indexOf','mobile','phone','accountcode','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]'];(function(_0x3e67e5,_0x502748){var _0x3b0a3c=function(_0xbc7b67){while(--_0xbc7b67){_0x3e67e5['push'](_0x3e67e5['shift']());}};_0x3b0a3c(++_0x502748);}(_0x4eb0,0x94));var _0x04eb=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x4eb0[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require('lodash');var moment=require(_0x04eb('0x0'));var util=require(_0x04eb('0x1'));var Redis=require('ioredis');var BPromise=require(_0x04eb('0x2'));var config=require(_0x04eb('0x3'));var logger=require('../../../config/logger')(_0x04eb('0x4'));var ami=require(_0x04eb('0x5'));config[_0x04eb('0x6')]=_[_0x04eb('0x7')](config[_0x04eb('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x04eb('0x8'))(new Redis(config['redis']));function UserReport(_0x3bd9fc){this[_0x04eb('0x9')]=_0x3bd9fc[_0x04eb('0x9')];this[_0x04eb('0xa')]=_0x3bd9fc[_0x04eb('0xa')];this[_0x04eb('0xb')]=_0x3bd9fc['telephones'];ami['on']('registryentry',this['syncRegistry'][_0x04eb('0xc')](this));ami['on']('registry',this[_0x04eb('0xd')][_0x04eb('0xc')](this));ami['on']('devicestatechange',this[_0x04eb('0xe')][_0x04eb('0xc')](this));ami['on'](_0x04eb('0xf'),this['syncPeerStatus'][_0x04eb('0xc')](this));return this[_0x04eb('0x10')]();}function showSipRegistrations(){Promise[_0x04eb('0x11')]()['then'](ami[_0x04eb('0x12')]())[_0x04eb('0x13')](function(_0x1dcbe4){logger[_0x04eb('0x14')](_0x04eb('0x15'),util[_0x04eb('0x16')](_0x1dcbe4,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x04eb('0x11')]()['then'](ami[_0x04eb('0x17')]())[_0x04eb('0x13')](function(_0x14aee9){logger['error'](_0x04eb('0x18'),util[_0x04eb('0x16')](_0x14aee9,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x04eb('0x11')]()['then'](ami[_0x04eb('0x19')]())[_0x04eb('0x13')](function(_0x1f09c4){logger[_0x04eb('0x14')](_0x04eb('0x1a'),util[_0x04eb('0x16')](_0x1f09c4,{'showHidden':![],'depth':null}));});}UserReport[_0x04eb('0x1b')]['syncRealtimeShow']=function(){setInterval(function(){BPromise[_0x04eb('0x11')]()['then'](showSipRegistrations())['then'](listDeviceStates())[_0x04eb('0x1c')](showPeersStatus());},0x32c8);};UserReport[_0x04eb('0x1b')][_0x04eb('0x1d')]=function(_0x430e8f){return _0x430e8f!==null&&!_[_0x04eb('0x1e')](_0x430e8f);};UserReport[_0x04eb('0x1b')]['emit']=function(_0x4887b5,_0x1eb031,_0x4f327a){io['to'](_0x4887b5)[_0x04eb('0x1f')](_0x1eb031,_0x4f327a);};UserReport[_0x04eb('0x1b')][_0x04eb('0xd')]=function(_0x54495a){try{if(this['isNotNull'](_0x54495a)){logger[_0x04eb('0x20')](_0x04eb('0x21'),_0x54495a[_0x04eb('0x22')],_0x54495a[_0x04eb('0x23')]);logger[_0x04eb('0x24')](_0x04eb('0x25'),util[_0x04eb('0x16')](_0x54495a,{'showHidden':![],'depth':null}));var _0x939c5f=_[_0x04eb('0x26')](this[_0x04eb('0x9')],{'defaultuser':_0x54495a[_0x04eb('0x22')]});if(_0x939c5f){_0x54495a[_0x04eb('0x27')]=_0x54495a[_0x04eb('0x23')];_[_0x04eb('0x28')](_0x939c5f,_['omit'](_0x54495a,['event',_0x04eb('0x29'),_0x04eb('0x22'),_0x04eb('0x23')]));logger['debug'](_0x04eb('0x2a'),util[_0x04eb('0x16')](_0x939c5f,{'showHidden':![],'depth':null}));this[_0x04eb('0x1f')](util['format']('trunk:%s',_0x939c5f[_0x04eb('0x2b')]),_0x04eb('0x2c'),_0x939c5f);}}}catch(_0xc5ba1e){logger[_0x04eb('0x14')](_0x04eb('0x25'),util[_0x04eb('0x16')](_0xc5ba1e,{'showHidden':![],'depth':null}));}};UserReport[_0x04eb('0x1b')][_0x04eb('0xe')]=function(_0x5c302a){try{if(this[_0x04eb('0x1d')](_0x5c302a)){logger['info'](_0x04eb('0x2d'),_0x5c302a[_0x04eb('0x2e')],_0x5c302a['state']);logger[_0x04eb('0x24')]('[userReport][devicestatechange]',util[_0x04eb('0x16')](_0x5c302a,{'showHidden':![],'depth':null}));if(this[_0x04eb('0xa')][_0x5c302a['device']]){if(!this[_0x04eb('0xa')][_0x5c302a[_0x04eb('0x2e')]][_0x04eb('0x2f')]||_0x5c302a[_0x04eb('0x23')][_0x04eb('0x30')]()=='inuse'){this['agents'][_0x5c302a[_0x04eb('0x2e')]][_0x04eb('0x2f')]=![];if(this[_0x04eb('0xa')][_0x5c302a['device']]['state']!==_0x5c302a[_0x04eb('0x23')][_0x04eb('0x30')]()){this[_0x04eb('0xa')][_0x5c302a[_0x04eb('0x2e')]][_0x04eb('0x31')]=_[_0x04eb('0x32')](moment()[_0x04eb('0x33')]('x'));}this[_0x04eb('0xa')][_0x5c302a[_0x04eb('0x2e')]][_0x04eb('0x23')]=_0x5c302a[_0x04eb('0x23')][_0x04eb('0x30')]();this[_0x04eb('0xa')][_0x5c302a[_0x04eb('0x2e')]][_0x04eb('0x34')](_0x5c302a);}}else if(this['telephones'][_0x5c302a[_0x04eb('0x2e')]]){if(this[_0x04eb('0xb')][_0x5c302a['device']][_0x04eb('0x23')]!==_0x5c302a[_0x04eb('0x23')][_0x04eb('0x30')]()){this[_0x04eb('0xb')][_0x5c302a[_0x04eb('0x2e')]][_0x04eb('0x31')]=_[_0x04eb('0x32')](moment()[_0x04eb('0x33')]('x'));}this[_0x04eb('0xb')][_0x5c302a[_0x04eb('0x2e')]]['state']=_0x5c302a[_0x04eb('0x23')][_0x04eb('0x30')]();logger[_0x04eb('0x24')]('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util[_0x04eb('0x16')](this[_0x04eb('0xb')][_0x5c302a[_0x04eb('0x2e')]],{'showHidden':![],'depth':null}));this[_0x04eb('0x1f')](util[_0x04eb('0x33')](_0x04eb('0x35'),this[_0x04eb('0xb')][_0x5c302a[_0x04eb('0x2e')]][_0x04eb('0x2b')]),_0x04eb('0x36'),this[_0x04eb('0xb')][_0x5c302a[_0x04eb('0x2e')]]);}else if(this[_0x04eb('0x9')][_0x5c302a[_0x04eb('0x2e')]]){if(this[_0x04eb('0x9')][_0x5c302a[_0x04eb('0x2e')]]['state']!==_0x5c302a[_0x04eb('0x23')][_0x04eb('0x30')]()){this[_0x04eb('0x9')][_0x5c302a['device']][_0x04eb('0x31')]=_['toNumber'](moment()[_0x04eb('0x33')]('x'));}this[_0x04eb('0x9')][_0x5c302a['device']]['state']=_0x5c302a[_0x04eb('0x23')][_0x04eb('0x30')]();logger[_0x04eb('0x24')](_0x04eb('0x37'),util[_0x04eb('0x16')](this[_0x04eb('0x9')][_0x5c302a[_0x04eb('0x2e')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x04eb('0x33')](_0x04eb('0x38'),this[_0x04eb('0x9')][_0x5c302a[_0x04eb('0x2e')]][_0x04eb('0x2b')]),_0x04eb('0x2c'),this[_0x04eb('0x9')][_0x5c302a[_0x04eb('0x2e')]]);}else if(_[_0x04eb('0x39')](_0x5c302a[_0x04eb('0x2e')],_0x04eb('0x3a'))){var _0x523e73=_0x5c302a['device'];var _0x58da5a=_0x523e73[_0x04eb('0x3b')](_0x523e73[_0x04eb('0x3c')]('/')+0x1,_0x523e73['indexOf']('@'));var _0x1c5878=_[_0x04eb('0x26')](this[_0x04eb('0xa')],function(_0x16282e){return _0x16282e[_0x04eb('0x3d')]==_0x58da5a||_0x16282e[_0x04eb('0x3e')]==_0x58da5a||_0x16282e[_0x04eb('0x3f')]==_0x58da5a;});if(_0x1c5878){if(_0x1c5878[_0x04eb('0x23')]!==_0x5c302a[_0x04eb('0x23')][_0x04eb('0x30')]()){_0x1c5878['stateTime']=_[_0x04eb('0x32')](moment()[_0x04eb('0x33')]('x'));}_0x1c5878[_0x04eb('0x23')]=_0x5c302a[_0x04eb('0x23')][_0x04eb('0x30')]();_0x1c5878['local']=!![];_0x1c5878['updateStatusRealtime'](_0x5c302a);}}}}catch(_0x42cc76){logger[_0x04eb('0x14')]('[userReport][devicestatechange]',util[_0x04eb('0x16')](_0x42cc76,{'showHidden':![],'depth':null}));}};UserReport['prototype']['syncPeerStatus']=function(_0x30b97a){try{if(this[_0x04eb('0x1d')](_0x30b97a)&&this[_0x04eb('0x1d')](_0x30b97a['peerstatus'])){logger[_0x04eb('0x20')](_0x04eb('0x40'),_0x30b97a[_0x04eb('0x41')],_0x30b97a[_0x04eb('0x42')],_0x30b97a[_0x04eb('0xf')]);logger[_0x04eb('0x24')](_0x04eb('0x43'),util[_0x04eb('0x16')](_0x30b97a,{'showHidden':![],'depth':null}));if(this['agents'][_0x30b97a[_0x04eb('0x41')]]){if(!this[_0x04eb('0xa')][_0x30b97a[_0x04eb('0x41')]][_0x04eb('0x2f')]||_0x30b97a[_0x04eb('0xf')][_0x04eb('0x30')]()==_0x04eb('0x44')){this[_0x04eb('0xa')][_0x30b97a[_0x04eb('0x41')]][_0x04eb('0x2f')]=![];this['agents'][_0x30b97a['peer']][_0x04eb('0x45')]=_0x30b97a[_0x04eb('0xf')]['toLowerCase']();this[_0x04eb('0xa')][_0x30b97a['peer']][_0x04eb('0x42')]=_0x30b97a[_0x04eb('0x42')];this[_0x04eb('0xa')][_0x30b97a[_0x04eb('0x41')]][_0x04eb('0x34')](_0x30b97a);}}else if(this['telephones'][_0x30b97a[_0x04eb('0x41')]]){this[_0x04eb('0xb')][_0x30b97a[_0x04eb('0x41')]][_0x04eb('0x45')]=_0x30b97a[_0x04eb('0xf')][_0x04eb('0x30')]();this['telephones'][_0x30b97a[_0x04eb('0x41')]][_0x04eb('0x42')]=_0x30b97a['address'];logger[_0x04eb('0x24')](_0x04eb('0x46'),util[_0x04eb('0x16')](this['telephones'][_0x30b97a[_0x04eb('0x41')]],{'showHidden':![],'depth':null}));this[_0x04eb('0x1f')](util['format'](_0x04eb('0x35'),this['telephones'][_0x30b97a[_0x04eb('0x41')]][_0x04eb('0x2b')]),_0x04eb('0x36'),this[_0x04eb('0xb')][_0x30b97a[_0x04eb('0x41')]]);}else if(this[_0x04eb('0x9')][_0x30b97a[_0x04eb('0x41')]]){this[_0x04eb('0x9')][_0x30b97a[_0x04eb('0x41')]][_0x04eb('0x45')]=_0x30b97a[_0x04eb('0xf')][_0x04eb('0x30')]();this['trunks'][_0x30b97a[_0x04eb('0x41')]]['address']=_0x30b97a[_0x04eb('0x42')];logger[_0x04eb('0x24')](_0x04eb('0x47'),util[_0x04eb('0x16')](this['trunks'][_0x30b97a[_0x04eb('0x41')]],{'showHidden':![],'depth':null}));this[_0x04eb('0x1f')](util[_0x04eb('0x33')](_0x04eb('0x38'),this['trunks'][_0x30b97a[_0x04eb('0x41')]][_0x04eb('0x2b')]),_0x04eb('0x2c'),this[_0x04eb('0x9')][_0x30b97a[_0x04eb('0x41')]]);}}}catch(_0x1111d8){logger[_0x04eb('0x14')](_0x04eb('0x43'),util[_0x04eb('0x16')](_0x1111d8,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file +var _0xb4d9=['trunk:save','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','local','inuse','toLowerCase','stateTime','toNumber','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','Local','substring','indexOf','mobile','phone','accountcode','updateStatusRealtime','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','trunk:%s','exports','lodash','moment','util','ioredis','bluebird','../../../config/environment','../../../config/logger','ami','defaults','redis','localhost','socket.io-emitter','trunks','agents','telephones','syncRegistry','bind','registry','syncDeviceState','peerstatus','syncPeerStatus','syncRealtimeShow','resolve','then','actionSipShowRegistry','catch','error','actionDeviceStateList','[userReport][devicestatelist]','inspect','actionSipPeerStatus','prototype','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','state','debug','[userReport][registry]','find','username','stateRegistry','merge','omit','event','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','name'];(function(_0x186818,_0x25d02f){var _0x14ab0d=function(_0x311c0c){while(--_0x311c0c){_0x186818['push'](_0x186818['shift']());}};_0x14ab0d(++_0x25d02f);}(_0xb4d9,0x159));var _0x9b4d=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xb4d9[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x9b4d('0x0'));var moment=require(_0x9b4d('0x1'));var util=require(_0x9b4d('0x2'));var Redis=require(_0x9b4d('0x3'));var BPromise=require(_0x9b4d('0x4'));var config=require(_0x9b4d('0x5'));var logger=require(_0x9b4d('0x6'))(_0x9b4d('0x7'));var ami=require('../ami');config['redis']=_[_0x9b4d('0x8')](config[_0x9b4d('0x9')],{'host':_0x9b4d('0xa'),'port':0x18eb});var io=require(_0x9b4d('0xb'))(new Redis(config[_0x9b4d('0x9')]));function UserReport(_0x21d879){this[_0x9b4d('0xc')]=_0x21d879[_0x9b4d('0xc')];this['agents']=_0x21d879[_0x9b4d('0xd')];this['telephones']=_0x21d879[_0x9b4d('0xe')];ami['on']('registryentry',this[_0x9b4d('0xf')][_0x9b4d('0x10')](this));ami['on'](_0x9b4d('0x11'),this['syncRegistry'][_0x9b4d('0x10')](this));ami['on']('devicestatechange',this[_0x9b4d('0x12')][_0x9b4d('0x10')](this));ami['on'](_0x9b4d('0x13'),this[_0x9b4d('0x14')]['bind'](this));return this[_0x9b4d('0x15')]();}function showSipRegistrations(){Promise[_0x9b4d('0x16')]()[_0x9b4d('0x17')](ami[_0x9b4d('0x18')]())[_0x9b4d('0x19')](function(_0x49ad72){logger[_0x9b4d('0x1a')]('[userReport][sipshowregistry]',util['inspect'](_0x49ad72,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x9b4d('0x16')]()[_0x9b4d('0x17')](ami[_0x9b4d('0x1b')]())[_0x9b4d('0x19')](function(_0x56f7b0){logger[_0x9b4d('0x1a')](_0x9b4d('0x1c'),util[_0x9b4d('0x1d')](_0x56f7b0,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x9b4d('0x16')]()[_0x9b4d('0x17')](ami[_0x9b4d('0x1e')]())[_0x9b4d('0x19')](function(_0x30857a){logger[_0x9b4d('0x1a')]('[userReport][sippeerstatus]',util[_0x9b4d('0x1d')](_0x30857a,{'showHidden':![],'depth':null}));});}UserReport[_0x9b4d('0x1f')][_0x9b4d('0x15')]=function(){setInterval(function(){BPromise[_0x9b4d('0x16')]()[_0x9b4d('0x17')](showSipRegistrations())[_0x9b4d('0x17')](listDeviceStates())[_0x9b4d('0x17')](showPeersStatus());},0x32c8);};UserReport[_0x9b4d('0x1f')][_0x9b4d('0x20')]=function(_0x51eff7){return _0x51eff7!==null&&!_[_0x9b4d('0x21')](_0x51eff7);};UserReport['prototype'][_0x9b4d('0x22')]=function(_0x6380b8,_0x21811f,_0x799e7d){io['to'](_0x6380b8)[_0x9b4d('0x22')](_0x21811f,_0x799e7d);};UserReport['prototype'][_0x9b4d('0xf')]=function(_0x274ec6){try{if(this[_0x9b4d('0x20')](_0x274ec6)){logger[_0x9b4d('0x23')](_0x9b4d('0x24'),_0x274ec6['username'],_0x274ec6[_0x9b4d('0x25')]);logger[_0x9b4d('0x26')](_0x9b4d('0x27'),util[_0x9b4d('0x1d')](_0x274ec6,{'showHidden':![],'depth':null}));var _0x52c073=_[_0x9b4d('0x28')](this['trunks'],{'defaultuser':_0x274ec6[_0x9b4d('0x29')]});if(_0x52c073){_0x274ec6[_0x9b4d('0x2a')]=_0x274ec6[_0x9b4d('0x25')];_[_0x9b4d('0x2b')](_0x52c073,_[_0x9b4d('0x2c')](_0x274ec6,[_0x9b4d('0x2d'),_0x9b4d('0x2e'),_0x9b4d('0x29'),_0x9b4d('0x25')]));logger[_0x9b4d('0x26')](_0x9b4d('0x2f'),util['inspect'](_0x52c073,{'showHidden':![],'depth':null}));this[_0x9b4d('0x22')](util[_0x9b4d('0x30')]('trunk:%s',_0x52c073[_0x9b4d('0x31')]),_0x9b4d('0x32'),_0x52c073);}}}catch(_0x537b99){logger['error'](_0x9b4d('0x27'),util[_0x9b4d('0x1d')](_0x537b99,{'showHidden':![],'depth':null}));}};UserReport[_0x9b4d('0x1f')]['syncDeviceState']=function(_0x55dcba){try{if(this[_0x9b4d('0x20')](_0x55dcba)){logger[_0x9b4d('0x23')](_0x9b4d('0x33'),_0x55dcba[_0x9b4d('0x34')],_0x55dcba[_0x9b4d('0x25')]);logger[_0x9b4d('0x26')](_0x9b4d('0x35'),util[_0x9b4d('0x1d')](_0x55dcba,{'showHidden':![],'depth':null}));if(this[_0x9b4d('0xd')][_0x55dcba[_0x9b4d('0x34')]]){if(!this['agents'][_0x55dcba[_0x9b4d('0x34')]][_0x9b4d('0x36')]||_0x55dcba['state']['toLowerCase']()==_0x9b4d('0x37')){this[_0x9b4d('0xd')][_0x55dcba[_0x9b4d('0x34')]][_0x9b4d('0x36')]=![];if(this['agents'][_0x55dcba['device']][_0x9b4d('0x25')]!==_0x55dcba[_0x9b4d('0x25')][_0x9b4d('0x38')]()){this['agents'][_0x55dcba[_0x9b4d('0x34')]][_0x9b4d('0x39')]=_[_0x9b4d('0x3a')](moment()[_0x9b4d('0x30')]('x'));}this['agents'][_0x55dcba[_0x9b4d('0x34')]][_0x9b4d('0x25')]=_0x55dcba[_0x9b4d('0x25')][_0x9b4d('0x38')]();this[_0x9b4d('0xd')][_0x55dcba['device']]['updateStatusRealtime'](_0x55dcba);}}else if(this[_0x9b4d('0xe')][_0x55dcba[_0x9b4d('0x34')]]){if(this[_0x9b4d('0xe')][_0x55dcba['device']][_0x9b4d('0x25')]!==_0x55dcba['state']['toLowerCase']()){this[_0x9b4d('0xe')][_0x55dcba['device']][_0x9b4d('0x39')]=_['toNumber'](moment()[_0x9b4d('0x30')]('x'));}this[_0x9b4d('0xe')][_0x55dcba[_0x9b4d('0x34')]]['state']=_0x55dcba[_0x9b4d('0x25')][_0x9b4d('0x38')]();logger[_0x9b4d('0x26')](_0x9b4d('0x3b'),util['inspect'](this[_0x9b4d('0xe')][_0x55dcba[_0x9b4d('0x34')]],{'showHidden':![],'depth':null}));this[_0x9b4d('0x22')](util[_0x9b4d('0x30')](_0x9b4d('0x3c'),this[_0x9b4d('0xe')][_0x55dcba[_0x9b4d('0x34')]]['name']),_0x9b4d('0x3d'),this[_0x9b4d('0xe')][_0x55dcba[_0x9b4d('0x34')]]);}else if(this['trunks'][_0x55dcba[_0x9b4d('0x34')]]){if(this['trunks'][_0x55dcba[_0x9b4d('0x34')]]['state']!==_0x55dcba[_0x9b4d('0x25')][_0x9b4d('0x38')]()){this[_0x9b4d('0xc')][_0x55dcba[_0x9b4d('0x34')]]['stateTime']=_[_0x9b4d('0x3a')](moment()['format']('x'));}this[_0x9b4d('0xc')][_0x55dcba['device']][_0x9b4d('0x25')]=_0x55dcba[_0x9b4d('0x25')]['toLowerCase']();logger[_0x9b4d('0x26')](_0x9b4d('0x3e'),util[_0x9b4d('0x1d')](this[_0x9b4d('0xc')][_0x55dcba[_0x9b4d('0x34')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x9b4d('0x30')]('trunk:%s',this[_0x9b4d('0xc')][_0x55dcba['device']][_0x9b4d('0x31')]),'trunk:save',this[_0x9b4d('0xc')][_0x55dcba[_0x9b4d('0x34')]]);}else if(_[_0x9b4d('0x3f')](_0x55dcba[_0x9b4d('0x34')],_0x9b4d('0x40'))){var _0x1ec046=_0x55dcba[_0x9b4d('0x34')];var _0x147fd7=_0x1ec046[_0x9b4d('0x41')](_0x1ec046[_0x9b4d('0x42')]('/')+0x1,_0x1ec046['indexOf']('@'));var _0x4c9e46=_[_0x9b4d('0x28')](this[_0x9b4d('0xd')],function(_0x859e9c){return _0x859e9c[_0x9b4d('0x43')]==_0x147fd7||_0x859e9c[_0x9b4d('0x44')]==_0x147fd7||_0x859e9c[_0x9b4d('0x45')]==_0x147fd7;});if(_0x4c9e46){if(_0x4c9e46[_0x9b4d('0x25')]!==_0x55dcba[_0x9b4d('0x25')][_0x9b4d('0x38')]()){_0x4c9e46[_0x9b4d('0x39')]=_[_0x9b4d('0x3a')](moment()['format']('x'));}_0x4c9e46[_0x9b4d('0x25')]=_0x55dcba[_0x9b4d('0x25')][_0x9b4d('0x38')]();_0x4c9e46[_0x9b4d('0x36')]=!![];_0x4c9e46[_0x9b4d('0x46')](_0x55dcba);}}}}catch(_0x41f83d){logger[_0x9b4d('0x1a')](_0x9b4d('0x35'),util[_0x9b4d('0x1d')](_0x41f83d,{'showHidden':![],'depth':null}));}};UserReport[_0x9b4d('0x1f')][_0x9b4d('0x14')]=function(_0x423c02){try{if(this['isNotNull'](_0x423c02)&&this[_0x9b4d('0x20')](_0x423c02['peerstatus'])){logger[_0x9b4d('0x23')](_0x9b4d('0x47'),_0x423c02[_0x9b4d('0x48')],_0x423c02[_0x9b4d('0x49')],_0x423c02[_0x9b4d('0x13')]);logger['debug'](_0x9b4d('0x4a'),util[_0x9b4d('0x1d')](_0x423c02,{'showHidden':![],'depth':null}));if(this[_0x9b4d('0xd')][_0x423c02[_0x9b4d('0x48')]]){if(!this['agents'][_0x423c02[_0x9b4d('0x48')]]['local']||_0x423c02[_0x9b4d('0x13')]['toLowerCase']()=='registered'){this[_0x9b4d('0xd')][_0x423c02[_0x9b4d('0x48')]][_0x9b4d('0x36')]=![];this[_0x9b4d('0xd')][_0x423c02[_0x9b4d('0x48')]]['status']=_0x423c02[_0x9b4d('0x13')][_0x9b4d('0x38')]();this[_0x9b4d('0xd')][_0x423c02[_0x9b4d('0x48')]][_0x9b4d('0x49')]=_0x423c02['address'];this[_0x9b4d('0xd')][_0x423c02['peer']][_0x9b4d('0x46')](_0x423c02);}}else if(this[_0x9b4d('0xe')][_0x423c02['peer']]){this[_0x9b4d('0xe')][_0x423c02['peer']][_0x9b4d('0x4b')]=_0x423c02[_0x9b4d('0x13')][_0x9b4d('0x38')]();this[_0x9b4d('0xe')][_0x423c02[_0x9b4d('0x48')]][_0x9b4d('0x49')]=_0x423c02['address'];logger[_0x9b4d('0x26')](_0x9b4d('0x4c'),util['inspect'](this['telephones'][_0x423c02['peer']],{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x9b4d('0x3c'),this[_0x9b4d('0xe')][_0x423c02['peer']][_0x9b4d('0x31')]),_0x9b4d('0x3d'),this['telephones'][_0x423c02[_0x9b4d('0x48')]]);}else if(this[_0x9b4d('0xc')][_0x423c02['peer']]){this[_0x9b4d('0xc')][_0x423c02[_0x9b4d('0x48')]]['status']=_0x423c02[_0x9b4d('0x13')][_0x9b4d('0x38')]();this['trunks'][_0x423c02[_0x9b4d('0x48')]][_0x9b4d('0x49')]=_0x423c02[_0x9b4d('0x49')];logger[_0x9b4d('0x26')]('[userReport][peerstatus]\x20sending\x20trunk:save\x20event:',util[_0x9b4d('0x1d')](this['trunks'][_0x423c02['peer']],{'showHidden':![],'depth':null}));this[_0x9b4d('0x22')](util[_0x9b4d('0x30')](_0x9b4d('0x4d'),this['trunks'][_0x423c02[_0x9b4d('0x48')]][_0x9b4d('0x31')]),'trunk:save',this['trunks'][_0x423c02[_0x9b4d('0x48')]]);}}}catch(_0x511be4){logger[_0x9b4d('0x1a')](_0x9b4d('0x4a'),util[_0x9b4d('0x1d')](_0x511be4,{'showHidden':![],'depth':null}));}};module[_0x9b4d('0x4e')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 40913b5..d7b5577 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 _0x2568=['syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','complete','transfer','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','onhold','[%s][voiceAgentReport][musiconholdstop]','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','defaults','redis','localhost','socket.io-emitter','channels','voiceChannels','voiceQueues','agents','agentcalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','varset','syncVarSet','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','type','inbound','variables','voice','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:called','error','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','routealias','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:%s','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','answeredelsewheremembername','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','agentringnoanswerAt','rejected','reason','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','[%s][voiceAgentReport][queuecallerabandon]\x20event:','hasOwnProperty','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]','syncAgentComplete','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','talktime','acwTimeout','agentacw','interface','destconnectedlinenum','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','values','[%s][voiceAgentReport][hangup]'];(function(_0x40d5cc,_0xf9d2c7){var _0x6950af=function(_0x295221){while(--_0x295221){_0x40d5cc['push'](_0x40d5cc['shift']());}};_0x6950af(++_0xf9d2c7);}(_0x2568,0x148));var _0x8256=function(_0x4f6804,_0x4e3f5a){_0x4f6804=_0x4f6804-0x0;var _0x3093fc=_0x2568[_0x4f6804];return _0x3093fc;};'use strict';var _=require('lodash');var moment=require(_0x8256('0x0'));var util=require(_0x8256('0x1'));var Redis=require(_0x8256('0x2'));var config=require(_0x8256('0x3'));var logger=require(_0x8256('0x4'))(_0x8256('0x5'));var ami=require(_0x8256('0x6'));config['redis']=_[_0x8256('0x7')](config[_0x8256('0x8')],{'host':_0x8256('0x9'),'port':0x18eb});var io=require(_0x8256('0xa'))(new Redis(config[_0x8256('0x8')]));function VoiceAgentReport(_0x2ed1d7){this[_0x8256('0xb')]={};this[_0x8256('0xc')]=_0x2ed1d7['channels'];this[_0x8256('0xd')]=_0x2ed1d7['voiceQueues'];this[_0x8256('0xe')]=_0x2ed1d7[_0x8256('0xe')];this['variables']={};ami['on'](_0x8256('0xf'),this['syncAgentCalled'][_0x8256('0x10')](this));ami['on'](_0x8256('0x11'),this[_0x8256('0x12')]['bind'](this));ami['on'](_0x8256('0x13'),this[_0x8256('0x14')][_0x8256('0x10')](this));ami['on'](_0x8256('0x15'),this[_0x8256('0x16')][_0x8256('0x10')](this));ami['on'](_0x8256('0x17'),this['syncAgentComplete'][_0x8256('0x10')](this));ami['on'](_0x8256('0x18'),this[_0x8256('0x19')][_0x8256('0x10')](this));ami['on']('hangup',this[_0x8256('0x1a')]['bind'](this));ami['on'](_0x8256('0x1b'),this[_0x8256('0x1c')][_0x8256('0x10')](this));ami['on'](_0x8256('0x1d'),this[_0x8256('0x1e')]['bind'](this));ami['on'](_0x8256('0x1f'),this['syncAttendedTransfer']['bind'](this));ami['on']('blindtransfer',this[_0x8256('0x20')]['bind'](this));}VoiceAgentReport[_0x8256('0x21')][_0x8256('0x22')]=function(_0x5f161f,_0x351f52,_0x39aa2a){io['to'](_0x5f161f)[_0x8256('0x22')](_0x351f52,_0x39aa2a);};VoiceAgentReport['prototype'][_0x8256('0x23')]=function(_0x3ad74d){return _0x3ad74d!==null&&!_[_0x8256('0x24')](_0x3ad74d);};VoiceAgentReport[_0x8256('0x21')]['syncAgentCalled']=function(_0x4e25e3){try{if(this[_0x8256('0x23')](_0x4e25e3)){logger[_0x8256('0x25')](_0x8256('0x26'),_0x4e25e3[_0x8256('0x27')],_0x4e25e3[_0x8256('0x28')],_0x4e25e3[_0x8256('0x29')]);logger[_0x8256('0x2a')](_0x8256('0x2b'),_0x4e25e3[_0x8256('0x27')],util[_0x8256('0x2c')](_0x4e25e3,{'showHidden':![],'depth':null}));if(_[_0x8256('0x24')](this[_0x8256('0xb')][_0x4e25e3[_0x8256('0x27')]])){this[_0x8256('0xb')][_0x4e25e3[_0x8256('0x27')]]={};}if(_['isUndefined'](this[_0x8256('0xb')][_0x4e25e3[_0x8256('0x27')]][_0x4e25e3['destuniqueid']])){this[_0x8256('0xb')][_0x4e25e3['uniqueid']][_0x4e25e3[_0x8256('0x29')]]={'agentcalledAt':moment()[_0x8256('0x2d')](_0x8256('0x2e')),'lastevent':_0x8256('0x2f'),'mandatoryDisposition':this[_0x8256('0xd')][_0x4e25e3[_0x8256('0x30')]]?this[_0x8256('0xd')][_0x4e25e3[_0x8256('0x30')]]['mandatoryDisposition']||![]:![],'type':this[_0x8256('0xd')][_0x4e25e3[_0x8256('0x30')]]?this[_0x8256('0xd')][_0x4e25e3[_0x8256('0x30')]][_0x8256('0x31')]||_0x8256('0x32'):_0x8256('0x32'),'variables':this[_0x8256('0x33')][_0x4e25e3['uniqueid']],'motionChannel':_0x8256('0x34')};}_['merge'](this[_0x8256('0xb')][_0x4e25e3[_0x8256('0x27')]][_0x4e25e3[_0x8256('0x29')]],_[_0x8256('0x35')](_0x4e25e3,[_0x8256('0x36'),_0x8256('0x37')]));logger[_0x8256('0x2a')](_0x8256('0x38'),_0x4e25e3[_0x8256('0x27')],util[_0x8256('0x2c')](this['channels'][_0x4e25e3[_0x8256('0x27')]][_0x4e25e3[_0x8256('0x29')]],{'showHidden':![],'depth':null}));ami['emit'](_0x8256('0x39'),this[_0x8256('0xb')][_0x4e25e3[_0x8256('0x27')]][_0x4e25e3[_0x8256('0x29')]]);logger[_0x8256('0x2a')](_0x8256('0x3a'),_0x4e25e3[_0x8256('0x27')],util[_0x8256('0x2c')](this['channels'][_0x4e25e3[_0x8256('0x27')]][_0x4e25e3[_0x8256('0x29')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x8256('0x2d')]('user:%s',_0x4e25e3[_0x8256('0x28')]),_0x8256('0x3b'),this[_0x8256('0xb')][_0x4e25e3['uniqueid']][_0x4e25e3[_0x8256('0x29')]]);}}catch(_0xaf00bf){logger[_0x8256('0x3c')](_0x8256('0x3d'),_0x4e25e3[_0x8256('0x27')],util['inspect'](_0xaf00bf,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x8256('0x12')]=function(_0x495232){try{if(this[_0x8256('0x23')](_0x495232)){if(this[_0x8256('0xb')][_0x495232[_0x8256('0x27')]]){logger[_0x8256('0x2a')](_0x8256('0x3e'),_0x495232[_0x8256('0x27')],util[_0x8256('0x2c')](_0x495232,{'showHidden':![],'depth':null}));for(var _0x2a4293 in this[_0x8256('0xb')][_0x495232[_0x8256('0x27')]]){if(this['channels'][_0x495232[_0x8256('0x27')]]['hasOwnProperty'](_0x2a4293)){if(_0x495232[_0x8256('0x29')]===_0x2a4293){logger[_0x8256('0x25')](_0x8256('0x3f'),_0x495232[_0x8256('0x27')],_0x495232[_0x8256('0x28')],_0x495232['destuniqueid']);this[_0x8256('0xb')][_0x495232[_0x8256('0x27')]][_0x2a4293][_0x8256('0x40')]=moment()[_0x8256('0x2d')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x495232[_0x8256('0x27')]][_0x2a4293]['connectedlinename']=_0x495232[_0x8256('0x41')];this['channels'][_0x495232[_0x8256('0x27')]][_0x2a4293][_0x8256('0x42')]=_0x495232['connectedlinenum'];this[_0x8256('0xb')][_0x495232['uniqueid']][_0x2a4293][_0x8256('0x43')]=_0x495232[_0x8256('0x43')];this[_0x8256('0xb')][_0x495232[_0x8256('0x27')]][_0x2a4293][_0x8256('0x44')]=_0x495232['destchannelstatedesc'];this['channels'][_0x495232[_0x8256('0x27')]][_0x2a4293][_0x8256('0x45')]=_0x495232[_0x8256('0x45')];this[_0x8256('0xb')][_0x495232[_0x8256('0x27')]][_0x2a4293][_0x8256('0x46')]=_0x8256('0x47');if(this[_0x8256('0xc')][this[_0x8256('0xb')][_0x495232[_0x8256('0x27')]][_0x2a4293][_0x8256('0x27')]]){var _0x5040bd=this['voiceChannels'][this[_0x8256('0xb')][_0x495232['uniqueid']][_0x2a4293]['uniqueid']][_0x8256('0x48')];this['channels'][_0x495232[_0x8256('0x27')]][_0x2a4293]['routealias']=_0x5040bd;_0x495232['routealias']=_0x5040bd;}_['merge'](this['agents'][_0x495232['interface']],_['pick'](_0x495232,['queue','destconnectedlinenum',_0x8256('0x48')]));logger[_0x8256('0x2a')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:',_0x495232[_0x8256('0x27')],util[_0x8256('0x2c')](this[_0x8256('0xb')][_0x495232[_0x8256('0x27')]][_0x495232['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x8256('0x22')](_0x8256('0x49'),this['channels'][_0x495232[_0x8256('0x27')]][_0x495232[_0x8256('0x29')]]);logger[_0x8256('0x2a')](_0x8256('0x4a'),_0x495232[_0x8256('0x27')],util[_0x8256('0x2c')](this['channels'][_0x495232[_0x8256('0x27')]][_0x495232[_0x8256('0x29')]],{'showHidden':![],'depth':null}));this[_0x8256('0x22')](util[_0x8256('0x2d')](_0x8256('0x4b'),_0x495232[_0x8256('0x28')]),'user:agentconnect',this[_0x8256('0xb')][_0x495232[_0x8256('0x27')]][_0x495232[_0x8256('0x29')]]);}else if(!this[_0x8256('0xb')][_0x495232[_0x8256('0x27')]][_0x2a4293]['agentringnoanswer']&&!this[_0x8256('0xb')][_0x495232[_0x8256('0x27')]][_0x2a4293]['agentcomplete']){logger['info'](_0x8256('0x4c'),_0x495232[_0x8256('0x27')],this[_0x8256('0xb')][_0x495232[_0x8256('0x27')]][_0x2a4293][_0x8256('0x28')],_0x2a4293);this[_0x8256('0xb')][_0x495232['uniqueid']][_0x2a4293][_0x8256('0x13')]=!![];this[_0x8256('0xb')][_0x495232[_0x8256('0x27')]][_0x2a4293]['agentringnoanswerAt']=moment()[_0x8256('0x2d')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x8256('0xb')][_0x495232[_0x8256('0x27')]][_0x2a4293]['answeredelsewheredestinationuniqueid']=_0x495232[_0x8256('0x29')];this[_0x8256('0xb')][_0x495232[_0x8256('0x27')]][_0x2a4293][_0x8256('0x4d')]=_0x495232[_0x8256('0x28')];this[_0x8256('0xb')][_0x495232[_0x8256('0x27')]][_0x2a4293][_0x8256('0x46')]='answered_elsewhere';this[_0x8256('0xb')][_0x495232[_0x8256('0x27')]][_0x2a4293]['reason']=_0x8256('0x4e');logger[_0x8256('0x2a')](_0x8256('0x4f'),_0x495232['uniqueid'],util['inspect'](this[_0x8256('0xb')][_0x495232[_0x8256('0x27')]][_0x2a4293],{'showHidden':![],'depth':null}));ami['emit'](_0x8256('0x50'),this[_0x8256('0xb')][_0x495232[_0x8256('0x27')]][_0x2a4293]);}}}}}}catch(_0x590e6d){logger['error'](_0x8256('0x51'),_0x495232['uniqueid'],util['inspect'](_0x590e6d,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncAgentRingNoAnswer']=function(_0x3eec81){try{if(this[_0x8256('0x23')](_0x3eec81)){logger[_0x8256('0x2a')](_0x8256('0x52'),_0x3eec81[_0x8256('0x27')],util[_0x8256('0x2c')](_0x3eec81,{'showHidden':![],'depth':null}));if(this['channels'][_0x3eec81[_0x8256('0x27')]]&&this[_0x8256('0xb')][_0x3eec81['uniqueid']][_0x3eec81[_0x8256('0x29')]]){logger['info'](_0x8256('0x53'),_0x3eec81[_0x8256('0x27')],_0x3eec81[_0x8256('0x28')],_0x3eec81['destuniqueid']);this[_0x8256('0xb')][_0x3eec81[_0x8256('0x27')]][_0x3eec81['destuniqueid']]['agentringnoanswer']=!![];this[_0x8256('0xb')][_0x3eec81[_0x8256('0x27')]][_0x3eec81[_0x8256('0x29')]][_0x8256('0x54')]=moment()['format'](_0x8256('0x2e'));this[_0x8256('0xb')][_0x3eec81['uniqueid']][_0x3eec81[_0x8256('0x29')]][_0x8256('0x46')]=_0x8256('0x55');this[_0x8256('0xb')][_0x3eec81[_0x8256('0x27')]][_0x3eec81[_0x8256('0x29')]][_0x8256('0x56')]=_0x8256('0x55');logger['debug'](_0x8256('0x57'),_0x3eec81['uniqueid'],util['inspect'](this[_0x8256('0xb')][_0x3eec81[_0x8256('0x27')]][_0x3eec81[_0x8256('0x29')]],{'showHidden':![],'depth':null}));ami[_0x8256('0x22')](_0x8256('0x58'),this[_0x8256('0xb')][_0x3eec81['uniqueid']][_0x3eec81[_0x8256('0x29')]]);}}}catch(_0x3d50cf){logger['error']('[%s][voiceAgentReport][agentringnoanswer]',_0x3eec81[_0x8256('0x27')],util[_0x8256('0x2c')](_0x3d50cf,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x8256('0x16')]=function(_0x165032){try{if(this[_0x8256('0x23')](_0x165032)){logger[_0x8256('0x2a')](_0x8256('0x59'),_0x165032['uniqueid'],util[_0x8256('0x2c')](_0x165032,{'showHidden':![],'depth':null}));if(this[_0x8256('0xb')][_0x165032[_0x8256('0x27')]]){for(var _0x41afa2 in this[_0x8256('0xb')][_0x165032[_0x8256('0x27')]]){if(this['channels'][_0x165032[_0x8256('0x27')]][_0x8256('0x5a')](_0x41afa2)&&!this[_0x8256('0xb')][_0x165032[_0x8256('0x27')]][_0x41afa2][_0x8256('0x13')]&&!this['channels'][_0x165032[_0x8256('0x27')]][_0x41afa2][_0x8256('0x17')]){logger['info'](_0x8256('0x5b'),_0x165032[_0x8256('0x27')],this['channels'][_0x165032[_0x8256('0x27')]][_0x41afa2][_0x8256('0x28')],_0x41afa2);this[_0x8256('0xb')][_0x165032[_0x8256('0x27')]][_0x41afa2][_0x8256('0x13')]=!![];this['channels'][_0x165032[_0x8256('0x27')]][_0x41afa2][_0x8256('0x54')]=moment()[_0x8256('0x2d')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x8256('0xb')][_0x165032[_0x8256('0x27')]][_0x41afa2][_0x8256('0x46')]=_0x8256('0x5c');this[_0x8256('0xb')][_0x165032['uniqueid']][_0x41afa2][_0x8256('0x56')]=_0x8256('0x5c');logger[_0x8256('0x2a')]('[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:',_0x165032[_0x8256('0x27')],util[_0x8256('0x2c')](this['channels'][_0x165032[_0x8256('0x27')]][_0x41afa2],{'showHidden':![],'depth':null}));ami[_0x8256('0x22')]('custom:agentqueuecallerabandon',this[_0x8256('0xb')][_0x165032[_0x8256('0x27')]][_0x41afa2]);}}}}}catch(_0x346ac0){logger['error'](_0x8256('0x5d'),_0x165032[_0x8256('0x27')],util[_0x8256('0x2c')](_0x346ac0,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8256('0x21')][_0x8256('0x5e')]=function(_0x424000){try{if(this[_0x8256('0x23')](_0x424000)){logger['debug']('[%s][voiceAgentReport][agentcomplete]\x20event:',_0x424000[_0x8256('0x27')],util[_0x8256('0x2c')](_0x424000,{'showHidden':![],'depth':null}));if(this[_0x8256('0xb')][_0x424000[_0x8256('0x27')]]){for(var _0x468899 in this[_0x8256('0xb')][_0x424000[_0x8256('0x27')]]){if(this[_0x8256('0xb')][_0x424000[_0x8256('0x27')]][_0x8256('0x5a')](_0x468899)){if(this[_0x8256('0xb')][_0x424000[_0x8256('0x27')]][_0x468899][_0x8256('0x40')]&&!this['channels'][_0x424000[_0x8256('0x27')]][_0x468899][_0x8256('0x17')]){logger['info'](_0x8256('0x5f'),_0x424000[_0x8256('0x27')],this[_0x8256('0xb')][_0x424000[_0x8256('0x27')]][_0x468899][_0x8256('0x28')],_0x468899);this['channels'][_0x424000[_0x8256('0x27')]][_0x468899]['agentcomplete']=!![];this['channels'][_0x424000[_0x8256('0x27')]][_0x468899][_0x8256('0x60')]=moment()['format'](_0x8256('0x2e'));this['channels'][_0x424000['uniqueid']][_0x468899]['lastevent']='complete';this[_0x8256('0xb')][_0x424000[_0x8256('0x27')]][_0x468899]['reason']=_0x424000[_0x8256('0x56')]=='transfer'?'agent':_0x424000[_0x8256('0x56')];this['channels'][_0x424000[_0x8256('0x27')]][_0x468899][_0x8256('0x61')]=_0x424000[_0x8256('0x61')];if(this['voiceQueues'][_0x424000[_0x8256('0x30')]]&&this['voiceQueues'][_0x424000[_0x8256('0x30')]]['acw']){this[_0x8256('0xb')][_0x424000[_0x8256('0x27')]][_0x468899]['acwtime']=this[_0x8256('0xd')][_0x424000[_0x8256('0x30')]][_0x8256('0x62')];this[_0x8256('0xb')][_0x424000[_0x8256('0x27')]][_0x468899][_0x8256('0x63')]=!![];}this[_0x8256('0xe')][_0x424000[_0x8256('0x64')]]=_[_0x8256('0x35')](this[_0x8256('0xe')][_0x424000[_0x8256('0x64')]],['queue',_0x8256('0x65')]);logger[_0x8256('0x2a')](_0x8256('0x66'),_0x424000['uniqueid'],util['inspect'](this[_0x8256('0xb')][_0x424000[_0x8256('0x27')]][_0x468899],{'showHidden':![],'depth':null}));ami[_0x8256('0x22')]('custom:agentcomplete',this['channels'][_0x424000[_0x8256('0x27')]][_0x468899]);logger['debug']('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x424000['uniqueid'],util[_0x8256('0x2c')](this[_0x8256('0xb')][_0x424000[_0x8256('0x27')]][_0x468899],{'showHidden':![],'depth':null}));this[_0x8256('0x22')](util['format'](_0x8256('0x4b'),_0x424000[_0x8256('0x28')]),_0x8256('0x67'),this[_0x8256('0xb')][_0x424000[_0x8256('0x27')]][_0x468899]);}}}}}}catch(_0x52d712){logger[_0x8256('0x3c')]('[%s][voiceAgentReport][agentcomplete]',_0x424000[_0x8256('0x27')],util[_0x8256('0x2c')](_0x52d712,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8256('0x21')][_0x8256('0x19')]=function(_0x163e2f){try{if(this[_0x8256('0x23')](_0x163e2f)){logger[_0x8256('0x2a')](_0x8256('0x68'),_0x163e2f['uniqueid'],util[_0x8256('0x2c')](_0x163e2f,{'showHidden':![],'depth':null}));this[_0x8256('0x69')](_0x163e2f['uniqueid'],_[_0x8256('0x6a')](_0x163e2f[_0x8256('0x6b')])[0x0],_0x163e2f[_0x8256('0x6c')]);if(this[_0x8256('0xb')][_0x163e2f['uniqueid']]){for(var _0x5c7e95 in this['channels'][_0x163e2f['uniqueid']]){if(this[_0x8256('0xb')][_0x163e2f[_0x8256('0x27')]][_0x8256('0x5a')](_0x5c7e95)){logger[_0x8256('0x25')](_0x8256('0x6d'),_0x163e2f[_0x8256('0x27')],_0x5c7e95,_[_0x8256('0x6a')](_0x163e2f[_0x8256('0x6b')])[0x0],_0x163e2f[_0x8256('0x6c')]);if(_[_0x8256('0x24')](this[_0x8256('0xb')][_0x163e2f[_0x8256('0x27')]][_0x5c7e95][_0x8256('0x33')])){this[_0x8256('0xb')][_0x163e2f[_0x8256('0x27')]][_0x5c7e95][_0x8256('0x33')]={};}this[_0x8256('0xb')][_0x163e2f[_0x8256('0x27')]][_0x5c7e95]['variables']=this[_0x8256('0x33')][_0x163e2f[_0x8256('0x27')]];}}}}}catch(_0xe91511){logger[_0x8256('0x3c')](_0x8256('0x6e'),_0x163e2f[_0x8256('0x27')],util[_0x8256('0x2c')](_0xe91511,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['addVariable']=function(_0x3af497,_0x272161,_0x1f73da){var _0xe88266=[_0x8256('0x6f'),_0x8256('0x70'),_0x8256('0x71'),_0x8256('0x72'),_0x8256('0x73'),'rtpaudioqoslossbridged',_0x8256('0x74'),'rtpaudioqosrttbridged','sipcallid','sipuri',_0x8256('0x75'),_0x8256('0x76'),_0x8256('0x77'),_0x8256('0x78'),_0x8256('0x79'),_0x8256('0x7a'),_0x8256('0x28'),_0x8256('0x7b'),_0x8256('0x7c')];if(!_[_0x8256('0x7d')](_0x272161)&&!_[_0x8256('0x7e')](_0xe88266,_0x272161)){if(_['isUndefined'](this['variables'][_0x3af497])){this[_0x8256('0x33')][_0x3af497]={};}this[_0x8256('0x33')][_0x3af497][_0x272161]=_0x1f73da;}};VoiceAgentReport[_0x8256('0x21')][_0x8256('0x1a')]=function(_0x4eff5b){try{if(this['isNotNull'](_0x4eff5b)){logger[_0x8256('0x2a')](_0x8256('0x7f'),_0x4eff5b[_0x8256('0x27')],util[_0x8256('0x2c')](_0x4eff5b,{'showHidden':![],'depth':null}));if(this[_0x8256('0xb')][_0x4eff5b['uniqueid']]){for(var _0xf68660 in this[_0x8256('0xb')][_0x4eff5b[_0x8256('0x27')]]){if(this[_0x8256('0xb')][_0x4eff5b['uniqueid']][_0x8256('0x5a')](_0xf68660)){if(this[_0x8256('0xb')][_0x4eff5b[_0x8256('0x27')]][_0xf68660][_0x8256('0x56')]=='transfer'&&this[_0x8256('0xb')][_0x4eff5b[_0x8256('0x27')]][_0xf68660][_0x8256('0x17')]){logger[_0x8256('0x25')](_0x8256('0x80'),_0x4eff5b[_0x8256('0x27')],_0xf68660);this[_0x8256('0xb')][_0x4eff5b[_0x8256('0x27')]][_0xf68660][_0x8256('0x60')]=moment()[_0x8256('0x2d')](_0x8256('0x2e'));}}}logger[_0x8256('0x2a')]('[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:',_0x4eff5b['uniqueid'],util[_0x8256('0x2c')](_[_0x8256('0x81')](this['channels'][_0x4eff5b[_0x8256('0x27')]]),{'showHidden':![],'depth':null}));ami['emit']('custom:voiceAgentReport',_[_0x8256('0x81')](this[_0x8256('0xb')][_0x4eff5b[_0x8256('0x27')]]));delete this[_0x8256('0xb')][_0x4eff5b['uniqueid']];}if(this['variables'][_0x4eff5b['uniqueid']]){delete this[_0x8256('0x33')][_0x4eff5b[_0x8256('0x27')]];}}}catch(_0x382480){logger[_0x8256('0x3c')](_0x8256('0x82'),_0x4eff5b[_0x8256('0x27')],util['inspect'](_0x382480,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x8256('0x83')]=function(_0x3e62d9){try{if(this['isNotNull'](_0x3e62d9)){logger[_0x8256('0x2a')](_0x8256('0x84'),_0x3e62d9[_0x8256('0x27')],util['inspect'](_0x3e62d9,{'showHidden':![],'depth':null}));if(this['channels'][_0x3e62d9['transfereeuniqueid']]){for(var _0x5b093e in this[_0x8256('0xb')][_0x3e62d9[_0x8256('0x85')]]){if(this['channels'][_0x3e62d9['transfereeuniqueid']]['hasOwnProperty'](_0x5b093e)){if(_0x3e62d9[_0x8256('0x86')]===_0x5b093e){logger['info'](_0x8256('0x87'),_0x3e62d9['uniqueid'],this[_0x8256('0xb')][_0x3e62d9[_0x8256('0x85')]][_0x5b093e][_0x8256('0x28')],_0x5b093e);var _0xb892ac=moment();this['channels'][_0x3e62d9[_0x8256('0x85')]][_0x5b093e][_0x8256('0x17')]=!![];this[_0x8256('0xb')][_0x3e62d9[_0x8256('0x85')]][_0x5b093e][_0x8256('0x60')]=moment()[_0x8256('0x2d')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x3e62d9[_0x8256('0x85')]][_0x5b093e]['lastevent']=_0x8256('0x88');this[_0x8256('0xb')][_0x3e62d9[_0x8256('0x85')]][_0x5b093e][_0x8256('0x56')]=_0x8256('0x89');this[_0x8256('0xb')][_0x3e62d9[_0x8256('0x85')]][_0x5b093e][_0x8256('0x61')]=_0xb892ac['diff'](this[_0x8256('0xb')][_0x3e62d9[_0x8256('0x85')]][_0x5b093e][_0x8256('0x40')],_0x8256('0x8a'));}}}}if(this[_0x8256('0xb')][_0x3e62d9['secondtransfereruniqueid']]){var _0x3488da=this[_0x8256('0xb')][_0x3e62d9[_0x8256('0x8b')]];this[_0x8256('0xb')][_0x3e62d9[_0x8256('0x8b')]]=this[_0x8256('0xb')][_0x3e62d9[_0x8256('0x85')]];this[_0x8256('0xb')][_0x3e62d9[_0x8256('0x85')]]=_0x3488da;}}}catch(_0x1ff981){logger[_0x8256('0x3c')](_0x8256('0x8c'),_0x3e62d9['uniqueid'],util['inspect'](_0x1ff981,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x8256('0x20')]=function(_0x2fc708){try{if(this['isNotNull'](_0x2fc708)){logger[_0x8256('0x2a')](_0x8256('0x8d'),_0x2fc708[_0x8256('0x27')],util[_0x8256('0x2c')](_0x2fc708,{'showHidden':![],'depth':null}));if(this[_0x8256('0xb')][_0x2fc708[_0x8256('0x85')]]){for(var _0x482eb9 in this[_0x8256('0xb')][_0x2fc708['transfereeuniqueid']]){if(this[_0x8256('0xb')][_0x2fc708[_0x8256('0x85')]][_0x8256('0x5a')](_0x482eb9)){if(_0x2fc708[_0x8256('0x8e')]===_0x482eb9){logger[_0x8256('0x25')](_0x8256('0x8f'),_0x2fc708['uniqueid'],this[_0x8256('0xb')][_0x2fc708['transfereeuniqueid']][_0x482eb9]['membername'],_0x482eb9);var _0xbc4302=moment();this['channels'][_0x2fc708['transfereeuniqueid']][_0x482eb9][_0x8256('0x17')]=!![];this[_0x8256('0xb')][_0x2fc708[_0x8256('0x85')]][_0x482eb9][_0x8256('0x60')]=_0xbc4302;this[_0x8256('0xb')][_0x2fc708[_0x8256('0x85')]][_0x482eb9][_0x8256('0x46')]=_0x8256('0x88');this[_0x8256('0xb')][_0x2fc708['transfereeuniqueid']][_0x482eb9][_0x8256('0x56')]=_0x8256('0x89');this[_0x8256('0xb')][_0x2fc708[_0x8256('0x85')]][_0x482eb9]['talktime']=_0xbc4302[_0x8256('0x90')](this[_0x8256('0xb')][_0x2fc708[_0x8256('0x85')]][_0x482eb9][_0x8256('0x40')],'seconds');}}}}}}catch(_0x3f2e2f){logger[_0x8256('0x3c')](_0x8256('0x91'),_0x2fc708[_0x8256('0x27')],util[_0x8256('0x2c')](_0x3f2e2f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8256('0x21')][_0x8256('0x1c')]=function(_0x2e49fe){var _0x5e4ba3='';try{if(this[_0x8256('0x23')](_0x2e49fe)){logger[_0x8256('0x2a')](_0x8256('0x92'),_0x2e49fe['uniqueid'],util[_0x8256('0x2c')](_0x2e49fe,{'showHidden':![],'depth':null}));if(_0x2e49fe[_0x8256('0x93')]){_0x5e4ba3=_0x2e49fe['channel']['substring'](0x0,_0x2e49fe[_0x8256('0x93')][_0x8256('0x94')]('-'));if(this['agents'][_0x5e4ba3]){logger[_0x8256('0x25')]('[%s][voiceAgentReport][musiconholdstart]\x20interface:%s',_0x2e49fe[_0x8256('0x27')],_0x5e4ba3);this['agents'][_0x5e4ba3]['onhold']=!![];}}}}catch(_0xcb048e){logger['error'](_0x8256('0x95'),_0x2e49fe[_0x8256('0x27')],util[_0x8256('0x2c')](_0xcb048e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x8256('0x21')][_0x8256('0x1e')]=function(_0x2e0d67){var _0x396906='';try{if(this[_0x8256('0x23')](_0x2e0d67)){logger['debug'](_0x8256('0x96'),_0x2e0d67['uniqueid'],util[_0x8256('0x2c')](_0x2e0d67,{'showHidden':![],'depth':null}));if(_0x2e0d67[_0x8256('0x93')]){_0x396906=_0x2e0d67[_0x8256('0x93')]['substring'](0x0,_0x2e0d67[_0x8256('0x93')][_0x8256('0x94')]('-'));if(this['agents'][_0x396906]){logger[_0x8256('0x25')]('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0x2e0d67[_0x8256('0x27')],_0x396906);this[_0x8256('0xe')][_0x396906][_0x8256('0x97')]=![];}}}}catch(_0x38998e){logger[_0x8256('0x3c')](_0x8256('0x98'),_0x2e0d67[_0x8256('0x27')],util[_0x8256('0x2c')](_0x38998e,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file +var _0x13f5=['rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','values','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','moment','util','ioredis','../../../config/logger','redis','defaults','localhost','socket.io-emitter','channels','voiceChannels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','syncAgentConnect','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','mandatoryDisposition','type','inbound','voice','merge','omit','event','privilege','inspect','custom:agentcalled','user:%s','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','routealias','interface','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','agentringnoanswer','info','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','error','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','transfer','agent','talktime','acw','destconnectedlinenum','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]','addVariable','keys','value','variable','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged'];(function(_0x320120,_0x51ae7e){var _0x228e37=function(_0x299921){while(--_0x299921){_0x320120['push'](_0x320120['shift']());}};_0x228e37(++_0x51ae7e);}(_0x13f5,0xc3));var _0x513f=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x13f5[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x513f('0x0'));var moment=require(_0x513f('0x1'));var util=require(_0x513f('0x2'));var Redis=require(_0x513f('0x3'));var config=require('../../../config/environment');var logger=require(_0x513f('0x4'))('ami');var ami=require('../ami');config[_0x513f('0x5')]=_[_0x513f('0x6')](config[_0x513f('0x5')],{'host':_0x513f('0x7'),'port':0x18eb});var io=require(_0x513f('0x8'))(new Redis(config[_0x513f('0x5')]));function VoiceAgentReport(_0x2be368){this[_0x513f('0x9')]={};this[_0x513f('0xa')]=_0x2be368[_0x513f('0x9')];this[_0x513f('0xb')]=_0x2be368[_0x513f('0xb')];this['agents']=_0x2be368[_0x513f('0xc')];this[_0x513f('0xd')]={};ami['on'](_0x513f('0xe'),this[_0x513f('0xf')][_0x513f('0x10')](this));ami['on']('agentconnect',this[_0x513f('0x11')][_0x513f('0x10')](this));ami['on']('agentringnoanswer',this[_0x513f('0x12')][_0x513f('0x10')](this));ami['on'](_0x513f('0x13'),this[_0x513f('0x14')][_0x513f('0x10')](this));ami['on'](_0x513f('0x15'),this[_0x513f('0x16')][_0x513f('0x10')](this));ami['on'](_0x513f('0x17'),this[_0x513f('0x18')][_0x513f('0x10')](this));ami['on'](_0x513f('0x19'),this[_0x513f('0x1a')][_0x513f('0x10')](this));ami['on']('musiconholdstart',this[_0x513f('0x1b')]['bind'](this));ami['on'](_0x513f('0x1c'),this[_0x513f('0x1d')][_0x513f('0x10')](this));ami['on'](_0x513f('0x1e'),this[_0x513f('0x1f')]['bind'](this));ami['on'](_0x513f('0x20'),this[_0x513f('0x21')]['bind'](this));}VoiceAgentReport[_0x513f('0x22')]['emit']=function(_0x2c13d6,_0x1d4462,_0x511ae0){io['to'](_0x2c13d6)[_0x513f('0x23')](_0x1d4462,_0x511ae0);};VoiceAgentReport[_0x513f('0x22')][_0x513f('0x24')]=function(_0x2201c2){return _0x2201c2!==null&&!_[_0x513f('0x25')](_0x2201c2);};VoiceAgentReport[_0x513f('0x22')]['syncAgentCalled']=function(_0x350f07){try{if(this[_0x513f('0x24')](_0x350f07)){logger['info'](_0x513f('0x26'),_0x350f07[_0x513f('0x27')],_0x350f07[_0x513f('0x28')],_0x350f07[_0x513f('0x29')]);logger[_0x513f('0x2a')](_0x513f('0x2b'),_0x350f07['uniqueid'],util['inspect'](_0x350f07,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x513f('0x9')][_0x350f07[_0x513f('0x27')]])){this[_0x513f('0x9')][_0x350f07[_0x513f('0x27')]]={};}if(_[_0x513f('0x25')](this[_0x513f('0x9')][_0x350f07[_0x513f('0x27')]][_0x350f07[_0x513f('0x29')]])){this[_0x513f('0x9')][_0x350f07['uniqueid']][_0x350f07[_0x513f('0x29')]]={'agentcalledAt':moment()[_0x513f('0x2c')](_0x513f('0x2d')),'lastevent':_0x513f('0x2e'),'mandatoryDisposition':this['voiceQueues'][_0x350f07[_0x513f('0x2f')]]?this[_0x513f('0xb')][_0x350f07['queue']][_0x513f('0x30')]||![]:![],'type':this['voiceQueues'][_0x350f07['queue']]?this[_0x513f('0xb')][_0x350f07[_0x513f('0x2f')]][_0x513f('0x31')]||_0x513f('0x32'):'inbound','variables':this[_0x513f('0xd')][_0x350f07[_0x513f('0x27')]],'motionChannel':_0x513f('0x33')};}_[_0x513f('0x34')](this['channels'][_0x350f07[_0x513f('0x27')]][_0x350f07[_0x513f('0x29')]],_[_0x513f('0x35')](_0x350f07,[_0x513f('0x36'),_0x513f('0x37')]));logger[_0x513f('0x2a')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:',_0x350f07['uniqueid'],util[_0x513f('0x38')](this[_0x513f('0x9')][_0x350f07['uniqueid']][_0x350f07['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x513f('0x23')](_0x513f('0x39'),this[_0x513f('0x9')][_0x350f07['uniqueid']][_0x350f07[_0x513f('0x29')]]);logger[_0x513f('0x2a')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x350f07[_0x513f('0x27')],util[_0x513f('0x38')](this[_0x513f('0x9')][_0x350f07[_0x513f('0x27')]][_0x350f07[_0x513f('0x29')]],{'showHidden':![],'depth':null}));this[_0x513f('0x23')](util[_0x513f('0x2c')](_0x513f('0x3a'),_0x350f07[_0x513f('0x28')]),'user:called',this[_0x513f('0x9')][_0x350f07['uniqueid']][_0x350f07['destuniqueid']]);}}catch(_0x1c2285){logger['error'](_0x513f('0x3b'),_0x350f07[_0x513f('0x27')],util['inspect'](_0x1c2285,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x513f('0x22')]['syncAgentConnect']=function(_0x59e71e){try{if(this[_0x513f('0x24')](_0x59e71e)){if(this[_0x513f('0x9')][_0x59e71e[_0x513f('0x27')]]){logger[_0x513f('0x2a')](_0x513f('0x3c'),_0x59e71e['uniqueid'],util[_0x513f('0x38')](_0x59e71e,{'showHidden':![],'depth':null}));for(var _0x1612ca in this['channels'][_0x59e71e[_0x513f('0x27')]]){if(this[_0x513f('0x9')][_0x59e71e[_0x513f('0x27')]][_0x513f('0x3d')](_0x1612ca)){if(_0x59e71e[_0x513f('0x29')]===_0x1612ca){logger['info'](_0x513f('0x3e'),_0x59e71e[_0x513f('0x27')],_0x59e71e[_0x513f('0x28')],_0x59e71e[_0x513f('0x29')]);this['channels'][_0x59e71e['uniqueid']][_0x1612ca][_0x513f('0x3f')]=moment()[_0x513f('0x2c')](_0x513f('0x2d'));this[_0x513f('0x9')][_0x59e71e['uniqueid']][_0x1612ca]['connectedlinename']=_0x59e71e[_0x513f('0x40')];this[_0x513f('0x9')][_0x59e71e[_0x513f('0x27')]][_0x1612ca][_0x513f('0x41')]=_0x59e71e[_0x513f('0x41')];this['channels'][_0x59e71e[_0x513f('0x27')]][_0x1612ca][_0x513f('0x42')]=_0x59e71e[_0x513f('0x42')];this['channels'][_0x59e71e[_0x513f('0x27')]][_0x1612ca][_0x513f('0x43')]=_0x59e71e['destchannelstatedesc'];this[_0x513f('0x9')][_0x59e71e[_0x513f('0x27')]][_0x1612ca][_0x513f('0x44')]=_0x59e71e[_0x513f('0x44')];this[_0x513f('0x9')][_0x59e71e['uniqueid']][_0x1612ca][_0x513f('0x45')]=_0x513f('0x46');if(this[_0x513f('0xa')][this[_0x513f('0x9')][_0x59e71e['uniqueid']][_0x1612ca]['uniqueid']]){var _0x60ea27=this[_0x513f('0xa')][this[_0x513f('0x9')][_0x59e71e[_0x513f('0x27')]][_0x1612ca][_0x513f('0x27')]][_0x513f('0x47')];this[_0x513f('0x9')][_0x59e71e['uniqueid']][_0x1612ca][_0x513f('0x47')]=_0x60ea27;_0x59e71e[_0x513f('0x47')]=_0x60ea27;}_[_0x513f('0x34')](this['agents'][_0x59e71e[_0x513f('0x48')]],_['pick'](_0x59e71e,[_0x513f('0x2f'),'destconnectedlinenum',_0x513f('0x47')]));logger['debug'](_0x513f('0x49'),_0x59e71e[_0x513f('0x27')],util[_0x513f('0x38')](this['channels'][_0x59e71e[_0x513f('0x27')]][_0x59e71e['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x513f('0x23')](_0x513f('0x4a'),this['channels'][_0x59e71e[_0x513f('0x27')]][_0x59e71e[_0x513f('0x29')]]);logger['debug'](_0x513f('0x4b'),_0x59e71e[_0x513f('0x27')],util['inspect'](this[_0x513f('0x9')][_0x59e71e['uniqueid']][_0x59e71e[_0x513f('0x29')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x513f('0x2c')]('user:%s',_0x59e71e[_0x513f('0x28')]),'user:agentconnect',this[_0x513f('0x9')][_0x59e71e['uniqueid']][_0x59e71e[_0x513f('0x29')]]);}else if(!this['channels'][_0x59e71e['uniqueid']][_0x1612ca][_0x513f('0x4c')]&&!this[_0x513f('0x9')][_0x59e71e['uniqueid']][_0x1612ca][_0x513f('0x15')]){logger[_0x513f('0x4d')](_0x513f('0x4e'),_0x59e71e['uniqueid'],this[_0x513f('0x9')][_0x59e71e[_0x513f('0x27')]][_0x1612ca][_0x513f('0x28')],_0x1612ca);this[_0x513f('0x9')][_0x59e71e['uniqueid']][_0x1612ca][_0x513f('0x4c')]=!![];this[_0x513f('0x9')][_0x59e71e['uniqueid']][_0x1612ca][_0x513f('0x4f')]=moment()[_0x513f('0x2c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x513f('0x9')][_0x59e71e[_0x513f('0x27')]][_0x1612ca]['answeredelsewheredestinationuniqueid']=_0x59e71e['destuniqueid'];this['channels'][_0x59e71e[_0x513f('0x27')]][_0x1612ca]['answeredelsewheremembername']=_0x59e71e['membername'];this[_0x513f('0x9')][_0x59e71e[_0x513f('0x27')]][_0x1612ca][_0x513f('0x45')]=_0x513f('0x50');this[_0x513f('0x9')][_0x59e71e[_0x513f('0x27')]][_0x1612ca][_0x513f('0x51')]='answered_elsewhere';logger[_0x513f('0x2a')](_0x513f('0x52'),_0x59e71e[_0x513f('0x27')],util['inspect'](this['channels'][_0x59e71e[_0x513f('0x27')]][_0x1612ca],{'showHidden':![],'depth':null}));ami[_0x513f('0x23')](_0x513f('0x53'),this[_0x513f('0x9')][_0x59e71e[_0x513f('0x27')]][_0x1612ca]);}}}}}}catch(_0x4902f2){logger[_0x513f('0x54')](_0x513f('0x55'),_0x59e71e[_0x513f('0x27')],util[_0x513f('0x38')](_0x4902f2,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x513f('0x22')]['syncAgentRingNoAnswer']=function(_0x5a70a0){try{if(this[_0x513f('0x24')](_0x5a70a0)){logger[_0x513f('0x2a')](_0x513f('0x56'),_0x5a70a0[_0x513f('0x27')],util[_0x513f('0x38')](_0x5a70a0,{'showHidden':![],'depth':null}));if(this['channels'][_0x5a70a0[_0x513f('0x27')]]&&this[_0x513f('0x9')][_0x5a70a0['uniqueid']][_0x5a70a0[_0x513f('0x29')]]){logger[_0x513f('0x4d')](_0x513f('0x57'),_0x5a70a0[_0x513f('0x27')],_0x5a70a0[_0x513f('0x28')],_0x5a70a0['destuniqueid']);this['channels'][_0x5a70a0[_0x513f('0x27')]][_0x5a70a0[_0x513f('0x29')]][_0x513f('0x4c')]=!![];this[_0x513f('0x9')][_0x5a70a0[_0x513f('0x27')]][_0x5a70a0[_0x513f('0x29')]][_0x513f('0x4f')]=moment()[_0x513f('0x2c')](_0x513f('0x2d'));this[_0x513f('0x9')][_0x5a70a0[_0x513f('0x27')]][_0x5a70a0[_0x513f('0x29')]][_0x513f('0x45')]=_0x513f('0x58');this[_0x513f('0x9')][_0x5a70a0[_0x513f('0x27')]][_0x5a70a0[_0x513f('0x29')]][_0x513f('0x51')]='rejected';logger[_0x513f('0x2a')](_0x513f('0x59'),_0x5a70a0[_0x513f('0x27')],util[_0x513f('0x38')](this['channels'][_0x5a70a0[_0x513f('0x27')]][_0x5a70a0[_0x513f('0x29')]],{'showHidden':![],'depth':null}));ami['emit'](_0x513f('0x5a'),this[_0x513f('0x9')][_0x5a70a0['uniqueid']][_0x5a70a0['destuniqueid']]);}}}catch(_0x3c9154){logger['error'](_0x513f('0x5b'),_0x5a70a0['uniqueid'],util[_0x513f('0x38')](_0x3c9154,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x513f('0x22')][_0x513f('0x14')]=function(_0x11b2c5){try{if(this[_0x513f('0x24')](_0x11b2c5)){logger['debug'](_0x513f('0x5c'),_0x11b2c5['uniqueid'],util[_0x513f('0x38')](_0x11b2c5,{'showHidden':![],'depth':null}));if(this[_0x513f('0x9')][_0x11b2c5['uniqueid']]){for(var _0x349abf in this[_0x513f('0x9')][_0x11b2c5[_0x513f('0x27')]]){if(this[_0x513f('0x9')][_0x11b2c5['uniqueid']]['hasOwnProperty'](_0x349abf)&&!this[_0x513f('0x9')][_0x11b2c5['uniqueid']][_0x349abf]['agentringnoanswer']&&!this[_0x513f('0x9')][_0x11b2c5['uniqueid']][_0x349abf][_0x513f('0x15')]){logger[_0x513f('0x4d')](_0x513f('0x5d'),_0x11b2c5[_0x513f('0x27')],this[_0x513f('0x9')][_0x11b2c5[_0x513f('0x27')]][_0x349abf][_0x513f('0x28')],_0x349abf);this[_0x513f('0x9')][_0x11b2c5['uniqueid']][_0x349abf][_0x513f('0x4c')]=!![];this[_0x513f('0x9')][_0x11b2c5[_0x513f('0x27')]][_0x349abf][_0x513f('0x4f')]=moment()['format'](_0x513f('0x2d'));this[_0x513f('0x9')][_0x11b2c5[_0x513f('0x27')]][_0x349abf][_0x513f('0x45')]=_0x513f('0x5e');this[_0x513f('0x9')][_0x11b2c5[_0x513f('0x27')]][_0x349abf][_0x513f('0x51')]='abandoned';logger[_0x513f('0x2a')](_0x513f('0x5f'),_0x11b2c5[_0x513f('0x27')],util[_0x513f('0x38')](this['channels'][_0x11b2c5[_0x513f('0x27')]][_0x349abf],{'showHidden':![],'depth':null}));ami[_0x513f('0x23')](_0x513f('0x60'),this[_0x513f('0x9')][_0x11b2c5[_0x513f('0x27')]][_0x349abf]);}}}}}catch(_0x444f10){logger[_0x513f('0x54')]('[%s][voiceAgentReport][queuecallerabandon]',_0x11b2c5['uniqueid'],util[_0x513f('0x38')](_0x444f10,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x513f('0x16')]=function(_0x41e999){try{if(this[_0x513f('0x24')](_0x41e999)){logger[_0x513f('0x2a')](_0x513f('0x61'),_0x41e999[_0x513f('0x27')],util[_0x513f('0x38')](_0x41e999,{'showHidden':![],'depth':null}));if(this[_0x513f('0x9')][_0x41e999[_0x513f('0x27')]]){for(var _0x4b3ce0 in this[_0x513f('0x9')][_0x41e999[_0x513f('0x27')]]){if(this[_0x513f('0x9')][_0x41e999[_0x513f('0x27')]][_0x513f('0x3d')](_0x4b3ce0)){if(this[_0x513f('0x9')][_0x41e999[_0x513f('0x27')]][_0x4b3ce0]['agentconnectAt']&&!this[_0x513f('0x9')][_0x41e999[_0x513f('0x27')]][_0x4b3ce0][_0x513f('0x15')]){logger[_0x513f('0x4d')](_0x513f('0x62'),_0x41e999[_0x513f('0x27')],this[_0x513f('0x9')][_0x41e999['uniqueid']][_0x4b3ce0]['membername'],_0x4b3ce0);this[_0x513f('0x9')][_0x41e999[_0x513f('0x27')]][_0x4b3ce0][_0x513f('0x15')]=!![];this['channels'][_0x41e999['uniqueid']][_0x4b3ce0][_0x513f('0x63')]=moment()[_0x513f('0x2c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x513f('0x9')][_0x41e999[_0x513f('0x27')]][_0x4b3ce0]['lastevent']='complete';this[_0x513f('0x9')][_0x41e999['uniqueid']][_0x4b3ce0][_0x513f('0x51')]=_0x41e999[_0x513f('0x51')]==_0x513f('0x64')?_0x513f('0x65'):_0x41e999[_0x513f('0x51')];this[_0x513f('0x9')][_0x41e999[_0x513f('0x27')]][_0x4b3ce0][_0x513f('0x66')]=_0x41e999[_0x513f('0x66')];if(this[_0x513f('0xb')][_0x41e999['queue']]&&this['voiceQueues'][_0x41e999[_0x513f('0x2f')]][_0x513f('0x67')]){this[_0x513f('0x9')][_0x41e999[_0x513f('0x27')]][_0x4b3ce0]['acwtime']=this[_0x513f('0xb')][_0x41e999['queue']]['acwTimeout'];this[_0x513f('0x9')][_0x41e999[_0x513f('0x27')]][_0x4b3ce0]['agentacw']=!![];}this[_0x513f('0xc')][_0x41e999[_0x513f('0x48')]]=_[_0x513f('0x35')](this[_0x513f('0xc')][_0x41e999[_0x513f('0x48')]],[_0x513f('0x2f'),_0x513f('0x68')]);logger[_0x513f('0x2a')](_0x513f('0x69'),_0x41e999[_0x513f('0x27')],util[_0x513f('0x38')](this['channels'][_0x41e999[_0x513f('0x27')]][_0x4b3ce0],{'showHidden':![],'depth':null}));ami[_0x513f('0x23')](_0x513f('0x6a'),this['channels'][_0x41e999['uniqueid']][_0x4b3ce0]);logger[_0x513f('0x2a')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x41e999[_0x513f('0x27')],util['inspect'](this[_0x513f('0x9')][_0x41e999['uniqueid']][_0x4b3ce0],{'showHidden':![],'depth':null}));this['emit'](util[_0x513f('0x2c')]('user:%s',_0x41e999['membername']),'user:agentcomplete',this['channels'][_0x41e999[_0x513f('0x27')]][_0x4b3ce0]);}}}}}}catch(_0x1788cc){logger['error'](_0x513f('0x6b'),_0x41e999['uniqueid'],util['inspect'](_0x1788cc,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x513f('0x18')]=function(_0x4b7351){try{if(this[_0x513f('0x24')](_0x4b7351)){logger[_0x513f('0x2a')]('[%s][voiceAgentReport][varset]\x20event:',_0x4b7351[_0x513f('0x27')],util[_0x513f('0x38')](_0x4b7351,{'showHidden':![],'depth':null}));this[_0x513f('0x6c')](_0x4b7351[_0x513f('0x27')],_[_0x513f('0x6d')](_0x4b7351['variable'])[0x0],_0x4b7351[_0x513f('0x6e')]);if(this['channels'][_0x4b7351['uniqueid']]){for(var _0x1e8b8c in this[_0x513f('0x9')][_0x4b7351[_0x513f('0x27')]]){if(this[_0x513f('0x9')][_0x4b7351['uniqueid']][_0x513f('0x3d')](_0x1e8b8c)){logger[_0x513f('0x4d')]('[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s',_0x4b7351[_0x513f('0x27')],_0x1e8b8c,_[_0x513f('0x6d')](_0x4b7351[_0x513f('0x6f')])[0x0],_0x4b7351[_0x513f('0x6e')]);if(_['isUndefined'](this[_0x513f('0x9')][_0x4b7351['uniqueid']][_0x1e8b8c][_0x513f('0xd')])){this['channels'][_0x4b7351[_0x513f('0x27')]][_0x1e8b8c][_0x513f('0xd')]={};}this[_0x513f('0x9')][_0x4b7351[_0x513f('0x27')]][_0x1e8b8c][_0x513f('0xd')]=this[_0x513f('0xd')][_0x4b7351[_0x513f('0x27')]];}}}}}catch(_0x1cc12b){logger[_0x513f('0x54')](_0x513f('0x70'),_0x4b7351[_0x513f('0x27')],util[_0x513f('0x38')](_0x1cc12b,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x513f('0x6c')]=function(_0x110f19,_0x4efad6,_0x262620){var _0x3498d3=[_0x513f('0x71'),_0x513f('0x72'),_0x513f('0x73'),_0x513f('0x74'),_0x513f('0x75'),_0x513f('0x76'),_0x513f('0x77'),_0x513f('0x78'),_0x513f('0x79'),_0x513f('0x7a'),_0x513f('0x7b'),_0x513f('0x7c'),_0x513f('0x7d'),_0x513f('0x7e'),_0x513f('0x7f'),_0x513f('0x80'),_0x513f('0x28'),_0x513f('0x81'),_0x513f('0x82')];if(!_[_0x513f('0x83')](_0x4efad6)&&!_[_0x513f('0x84')](_0x3498d3,_0x4efad6)){if(_[_0x513f('0x25')](this[_0x513f('0xd')][_0x110f19])){this[_0x513f('0xd')][_0x110f19]={};}this[_0x513f('0xd')][_0x110f19][_0x4efad6]=_0x262620;}};VoiceAgentReport[_0x513f('0x22')][_0x513f('0x1a')]=function(_0x473f9b){try{if(this[_0x513f('0x24')](_0x473f9b)){logger[_0x513f('0x2a')]('[%s][voiceAgentReport][hangup]\x20event:',_0x473f9b[_0x513f('0x27')],util['inspect'](_0x473f9b,{'showHidden':![],'depth':null}));if(this[_0x513f('0x9')][_0x473f9b['uniqueid']]){for(var _0x5de09e in this[_0x513f('0x9')][_0x473f9b[_0x513f('0x27')]]){if(this['channels'][_0x473f9b[_0x513f('0x27')]][_0x513f('0x3d')](_0x5de09e)){if(this[_0x513f('0x9')][_0x473f9b[_0x513f('0x27')]][_0x5de09e][_0x513f('0x51')]==_0x513f('0x64')&&this[_0x513f('0x9')][_0x473f9b[_0x513f('0x27')]][_0x5de09e][_0x513f('0x15')]){logger[_0x513f('0x4d')](_0x513f('0x85'),_0x473f9b[_0x513f('0x27')],_0x5de09e);this[_0x513f('0x9')][_0x473f9b['uniqueid']][_0x5de09e]['agentcompleteAt']=moment()[_0x513f('0x2c')](_0x513f('0x2d'));}}}logger[_0x513f('0x2a')]('[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:',_0x473f9b[_0x513f('0x27')],util['inspect'](_[_0x513f('0x86')](this[_0x513f('0x9')][_0x473f9b['uniqueid']]),{'showHidden':![],'depth':null}));ami[_0x513f('0x23')]('custom:voiceAgentReport',_[_0x513f('0x86')](this[_0x513f('0x9')][_0x473f9b['uniqueid']]));delete this[_0x513f('0x9')][_0x473f9b[_0x513f('0x27')]];}if(this[_0x513f('0xd')][_0x473f9b[_0x513f('0x27')]]){delete this[_0x513f('0xd')][_0x473f9b[_0x513f('0x27')]];}}}catch(_0x1b2a4e){logger['error'](_0x513f('0x87'),_0x473f9b['uniqueid'],util['inspect'](_0x1b2a4e,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x513f('0x1f')]=function(_0x4660d1){try{if(this[_0x513f('0x24')](_0x4660d1)){logger[_0x513f('0x2a')](_0x513f('0x88'),_0x4660d1[_0x513f('0x27')],util[_0x513f('0x38')](_0x4660d1,{'showHidden':![],'depth':null}));if(this['channels'][_0x4660d1[_0x513f('0x89')]]){for(var _0x2f46e7 in this[_0x513f('0x9')][_0x4660d1['transfereeuniqueid']]){if(this[_0x513f('0x9')][_0x4660d1['transfereeuniqueid']][_0x513f('0x3d')](_0x2f46e7)){if(_0x4660d1['origtransfereruniqueid']===_0x2f46e7){logger[_0x513f('0x4d')]('[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x4660d1['uniqueid'],this['channels'][_0x4660d1[_0x513f('0x89')]][_0x2f46e7][_0x513f('0x28')],_0x2f46e7);var _0x56d7e0=moment();this[_0x513f('0x9')][_0x4660d1['transfereeuniqueid']][_0x2f46e7][_0x513f('0x15')]=!![];this[_0x513f('0x9')][_0x4660d1[_0x513f('0x89')]][_0x2f46e7][_0x513f('0x63')]=moment()[_0x513f('0x2c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x513f('0x9')][_0x4660d1[_0x513f('0x89')]][_0x2f46e7][_0x513f('0x45')]=_0x513f('0x8a');this[_0x513f('0x9')][_0x4660d1[_0x513f('0x89')]][_0x2f46e7][_0x513f('0x51')]=_0x513f('0x64');this[_0x513f('0x9')][_0x4660d1[_0x513f('0x89')]][_0x2f46e7][_0x513f('0x66')]=_0x56d7e0[_0x513f('0x8b')](this[_0x513f('0x9')][_0x4660d1[_0x513f('0x89')]][_0x2f46e7][_0x513f('0x3f')],_0x513f('0x8c'));}}}}if(this[_0x513f('0x9')][_0x4660d1[_0x513f('0x8d')]]){var _0x5db05f=this['channels'][_0x4660d1[_0x513f('0x8d')]];this[_0x513f('0x9')][_0x4660d1[_0x513f('0x8d')]]=this[_0x513f('0x9')][_0x4660d1['transfereeuniqueid']];this[_0x513f('0x9')][_0x4660d1[_0x513f('0x89')]]=_0x5db05f;}}}catch(_0x2b925a){logger[_0x513f('0x54')](_0x513f('0x8e'),_0x4660d1[_0x513f('0x27')],util[_0x513f('0x38')](_0x2b925a,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x513f('0x21')]=function(_0x20e14b){try{if(this[_0x513f('0x24')](_0x20e14b)){logger[_0x513f('0x2a')](_0x513f('0x8f'),_0x20e14b[_0x513f('0x27')],util[_0x513f('0x38')](_0x20e14b,{'showHidden':![],'depth':null}));if(this[_0x513f('0x9')][_0x20e14b['transfereeuniqueid']]){for(var _0x152588 in this[_0x513f('0x9')][_0x20e14b[_0x513f('0x89')]]){if(this[_0x513f('0x9')][_0x20e14b['transfereeuniqueid']]['hasOwnProperty'](_0x152588)){if(_0x20e14b[_0x513f('0x90')]===_0x152588){logger['info'](_0x513f('0x91'),_0x20e14b[_0x513f('0x27')],this['channels'][_0x20e14b[_0x513f('0x89')]][_0x152588]['membername'],_0x152588);var _0x43a7e4=moment();this[_0x513f('0x9')][_0x20e14b['transfereeuniqueid']][_0x152588][_0x513f('0x15')]=!![];this[_0x513f('0x9')][_0x20e14b[_0x513f('0x89')]][_0x152588][_0x513f('0x63')]=_0x43a7e4;this[_0x513f('0x9')][_0x20e14b[_0x513f('0x89')]][_0x152588][_0x513f('0x45')]=_0x513f('0x8a');this[_0x513f('0x9')][_0x20e14b[_0x513f('0x89')]][_0x152588][_0x513f('0x51')]=_0x513f('0x64');this[_0x513f('0x9')][_0x20e14b[_0x513f('0x89')]][_0x152588][_0x513f('0x66')]=_0x43a7e4[_0x513f('0x8b')](this[_0x513f('0x9')][_0x20e14b[_0x513f('0x89')]][_0x152588][_0x513f('0x3f')],_0x513f('0x8c'));}}}}}}catch(_0x27fcaa){logger[_0x513f('0x54')]('[%s][voiceAgentReport][blindtransfer]',_0x20e14b[_0x513f('0x27')],util[_0x513f('0x38')](_0x27fcaa,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncMusicOnHoldStart']=function(_0x23cdb8){var _0x1047e0='';try{if(this[_0x513f('0x24')](_0x23cdb8)){logger['debug'](_0x513f('0x92'),_0x23cdb8[_0x513f('0x27')],util['inspect'](_0x23cdb8,{'showHidden':![],'depth':null}));if(_0x23cdb8[_0x513f('0x93')]){_0x1047e0=_0x23cdb8['channel']['substring'](0x0,_0x23cdb8['channel'][_0x513f('0x94')]('-'));if(this[_0x513f('0xc')][_0x1047e0]){logger['info'](_0x513f('0x95'),_0x23cdb8[_0x513f('0x27')],_0x1047e0);this[_0x513f('0xc')][_0x1047e0]['onhold']=!![];}}}}catch(_0x422c33){logger[_0x513f('0x54')](_0x513f('0x96'),_0x23cdb8[_0x513f('0x27')],util[_0x513f('0x38')](_0x422c33,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x513f('0x22')][_0x513f('0x1d')]=function(_0x37080d){var _0x32242f='';try{if(this['isNotNull'](_0x37080d)){logger['debug'](_0x513f('0x97'),_0x37080d['uniqueid'],util[_0x513f('0x38')](_0x37080d,{'showHidden':![],'depth':null}));if(_0x37080d[_0x513f('0x93')]){_0x32242f=_0x37080d[_0x513f('0x93')]['substring'](0x0,_0x37080d['channel'][_0x513f('0x94')]('-'));if(this[_0x513f('0xc')][_0x32242f]){logger[_0x513f('0x4d')](_0x513f('0x98'),_0x37080d['uniqueid'],_0x32242f);this[_0x513f('0xc')][_0x32242f]['onhold']=![];}}}}catch(_0x3b6820){logger['error'](_0x513f('0x99'),_0x37080d[_0x513f('0x27')],util[_0x513f('0x38')](_0x3b6820,{'showHidden':![],'depth':null}));}};module[_0x513f('0x9a')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index faffa86..fcb8984 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 _0x78f5=['connectedlinename','destinationchannel','toNumber','UserId','membername','routealias','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','monitor','endsWith','replace','.wav49','.WAV','monitorFilename','monitors','isNil','push','rec','[%s][voiceCallReport][mixMonitorFilename]','syncVarSet','variable','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','originatecalleridnum','xmd-destination','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','mixmonitor_filename','parse','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','then','transferType','isEmpty','getSettings','stopRecordingOnTransfer','resolve','Action','StopMixMonitor','catch','finally','webbar:stopmonitors','event','BlindTransfer','blindTransfers','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','origtransfererlinkedid','some','routeid','ATTENDED','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BLIND','transfereruniqueid','syncMusicOnHoldStart','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','bluebird','lodash','moment','util','path','ioredis','../../../config/logger','ami','../ami','../model/channel','../rpc/setting','unknown','not_inuse','unavailable','ringing','ringinuse','onhold','set','agi','dial','playback','NO\x20ANSWER','BUSY','FAILED','redis','defaults','localhost','channels','agents','coreshowchannel','syncNewExten','bind','newexten','newchannel','newstate','syncNewState','varset','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isUndefined','emit','isNotNull','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','pick','keys','from-sip','channel','split','exten','destconnectedlinenum','connectedlinenum','format','user:%s','name','user:agentconnect','accountcode','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','starttime','disposition','channelstate','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','CDR(routeAlias)','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','subtract','seconds','YYYY-MM-DD\x20HH:mm:ss','merge','includes','lastapplication','lastdata','startsWith','match','queue','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','answered','answertime','holdtime','diff','xcally-motion-preview'];(function(_0x43e19a,_0x3127f2){var _0x35099e=function(_0x3bbc47){while(--_0x3bbc47){_0x43e19a['push'](_0x43e19a['shift']());}};_0x35099e(++_0x3127f2);}(_0x78f5,0x66));var _0x578f=function(_0xc14a52,_0x5b84b9){_0xc14a52=_0xc14a52-0x0;var _0x2e5227=_0x78f5[_0xc14a52];return _0x2e5227;};'use strict';var BPromise=require(_0x578f('0x0'));var _=require(_0x578f('0x1'));var moment=require(_0x578f('0x2'));var util=require(_0x578f('0x3'));var path=require(_0x578f('0x4'));var Redis=require(_0x578f('0x5'));var config=require('../../../config/environment');var logger=require(_0x578f('0x6'))(_0x578f('0x7'));var ami=require(_0x578f('0x8'));var Channel=require(_0x578f('0x9'));var RpcSetting=require(_0x578f('0xa'));var statusDesc=[_0x578f('0xb'),_0x578f('0xc'),'inuse','busy','invalid',_0x578f('0xd'),_0x578f('0xe'),_0x578f('0xf'),_0x578f('0x10')];var applications=[_0x578f('0x11'),'queue',_0x578f('0x12'),_0x578f('0x13'),_0x578f('0x14'),'voicemail'];var dispositions=['NO\x20ANSWER','FAILED','FAILED',_0x578f('0x15'),_0x578f('0x15'),_0x578f('0x15'),'ANSWERED',_0x578f('0x16'),_0x578f('0x17'),_0x578f('0x17'),'FAILED'];var actions={};config[_0x578f('0x18')]=_[_0x578f('0x19')](config['redis'],{'host':_0x578f('0x1a'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x578f('0x18')]));function VoiceCallReport(_0x4e44cd){this[_0x578f('0x1b')]=_0x4e44cd[_0x578f('0x1b')];this['agents']=_0x4e44cd[_0x578f('0x1c')];this['blindTransfers']={};ami['on'](_0x578f('0x1d'),this[_0x578f('0x1e')][_0x578f('0x1f')](this));ami['on'](_0x578f('0x20'),this[_0x578f('0x1e')][_0x578f('0x1f')](this));ami['on'](_0x578f('0x21'),this['syncNewChannel'][_0x578f('0x1f')](this));ami['on'](_0x578f('0x22'),this[_0x578f('0x23')][_0x578f('0x1f')](this));ami['on'](_0x578f('0x24'),this['syncVarSet'][_0x578f('0x1f')](this));ami['on'](_0x578f('0x25'),this[_0x578f('0x26')][_0x578f('0x1f')](this));ami['on'](_0x578f('0x27'),this[_0x578f('0x28')][_0x578f('0x1f')](this));ami['on'](_0x578f('0x29'),this[_0x578f('0x2a')][_0x578f('0x1f')](this));ami['on'](_0x578f('0x2b'),this[_0x578f('0x2c')][_0x578f('0x1f')](this));ami['on']('musiconholdstart',this['syncMusicOnHoldStart'][_0x578f('0x1f')](this));ami['on']('musiconholdstop',this[_0x578f('0x2d')]['bind'](this));try{logger[_0x578f('0x2e')](_0x578f('0x2f'));ami[_0x578f('0x30')]();}catch(_0x598f70){logger[_0x578f('0x31')](_0x578f('0x32'),util[_0x578f('0x33')](_0x598f70,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x578f('0x34')]['isNotNull']=function(_0x28f1c3){return _0x28f1c3!==null&&!_[_0x578f('0x35')](_0x28f1c3);};VoiceCallReport[_0x578f('0x34')][_0x578f('0x36')]=function(_0x310cfa,_0x26ac4d,_0x1f32df){io['to'](_0x310cfa)[_0x578f('0x36')](_0x26ac4d,_0x1f32df);};VoiceCallReport[_0x578f('0x34')][_0x578f('0x28')]=function(_0x9ddefe){try{if(this[_0x578f('0x37')](_0x9ddefe)){logger['info'](_0x578f('0x38'),_0x9ddefe[_0x578f('0x39')],_0x9ddefe[_0x578f('0x3a')],_0x9ddefe[_0x578f('0x3b')]);logger[_0x578f('0x3c')](_0x578f('0x3d'),_0x9ddefe['uniqueid'],util[_0x578f('0x33')](_0x9ddefe,{'showHidden':![],'depth':null}));if(_0x9ddefe[_0x578f('0x39')]===_0x9ddefe[_0x578f('0x3e')]){if(!_[_0x578f('0x35')](this[_0x578f('0x1b')][_0x9ddefe['uniqueid']])){_['merge'](this['channels'][_0x9ddefe[_0x578f('0x39')]],_[_0x578f('0x3f')](_0x9ddefe,_[_0x578f('0x40')](this['channels'][_0x9ddefe[_0x578f('0x39')]])));}}if(_0x9ddefe['context']===_0x578f('0x41')){if(this['agents'][_0x9ddefe[_0x578f('0x42')][_0x578f('0x43')]('-')[0x0]]){if(_0x9ddefe[_0x578f('0x44')]=='xcally-motion-preview'){this[_0x578f('0x1c')][_0x9ddefe[_0x578f('0x42')][_0x578f('0x43')]('-')[0x0]][_0x578f('0x45')]=_0x9ddefe[_0x578f('0x46')];this[_0x578f('0x36')](util[_0x578f('0x47')](_0x578f('0x48'),this[_0x578f('0x1c')][_0x9ddefe[_0x578f('0x42')][_0x578f('0x43')]('-')[0x0]][_0x578f('0x49')]),_0x578f('0x4a'),{'destaccountcode':this[_0x578f('0x1c')][_0x9ddefe[_0x578f('0x42')][_0x578f('0x43')]('-')[0x0]][_0x578f('0x4b')],'destconnectedlinenum':_0x9ddefe[_0x578f('0x46')]});}}}}}catch(_0x32a0b0){logger[_0x578f('0x31')](_0x578f('0x4c'),_0x9ddefe[_0x578f('0x39')],util['inspect'](_0x32a0b0,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x578f('0x34')]['syncNewChannel']=function(_0x5b9d93){try{if(this[_0x578f('0x37')](_0x5b9d93)){logger[_0x578f('0x3c')](_0x578f('0x4d'),_0x5b9d93['uniqueid'],util[_0x578f('0x33')](_0x5b9d93,{'showHidden':![],'depth':null}));if(_0x5b9d93[_0x578f('0x39')]===_0x5b9d93[_0x578f('0x3e')]&&_0x5b9d93[_0x578f('0x42')]!=_0x578f('0x4e')){if(_[_0x578f('0x35')](this['channels'][_0x5b9d93['uniqueid']])){logger['info'](_0x578f('0x4f'),_0x5b9d93['uniqueid'],_0x5b9d93[_0x578f('0x50')],_0x5b9d93['exten']);this[_0x578f('0x1b')][_0x5b9d93['uniqueid']]=new Channel();this[_0x578f('0x1b')][_0x5b9d93[_0x578f('0x39')]][_0x578f('0x51')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x5b9d93['uniqueid']][_0x578f('0x52')]=dispositions[_['toNumber'](_0x5b9d93[_0x578f('0x53')])];_['merge'](this[_0x578f('0x1b')][_0x5b9d93[_0x578f('0x39')]],_[_0x578f('0x3f')](_0x5b9d93,_[_0x578f('0x40')](this[_0x578f('0x1b')][_0x5b9d93[_0x578f('0x39')]])));if(_0x5b9d93[_0x578f('0x50')]==='from-sip'){if(this[_0x578f('0x1c')][_0x5b9d93['channel'][_0x578f('0x43')]('-')[0x0]]){if(_[_0x578f('0x35')](this[_0x578f('0x1c')][_0x5b9d93[_0x578f('0x42')][_0x578f('0x43')]('-')[0x0]]['destconnectedlinenum'])){this[_0x578f('0x1c')][_0x5b9d93[_0x578f('0x42')]['split']('-')[0x0]][_0x578f('0x45')]=_0x5b9d93['exten'];logger[_0x578f('0x3c')](_0x578f('0x54'),_0x5b9d93[_0x578f('0x39')],util[_0x578f('0x33')]({'destaccountcode':this[_0x578f('0x1c')][_0x5b9d93[_0x578f('0x42')][_0x578f('0x43')]('-')[0x0]][_0x578f('0x4b')],'destconnectedlinenum':_0x5b9d93[_0x578f('0x44')]},{'showHidden':![],'depth':null}));this[_0x578f('0x36')](util[_0x578f('0x47')]('user:%s',this[_0x578f('0x1c')][_0x5b9d93[_0x578f('0x42')]['split']('-')[0x0]][_0x578f('0x49')]),_0x578f('0x4a'),{'destaccountcode':this[_0x578f('0x1c')][_0x5b9d93[_0x578f('0x42')][_0x578f('0x43')]('-')[0x0]][_0x578f('0x4b')],'destconnectedlinenum':_0x5b9d93[_0x578f('0x44')]});}}}}}}}catch(_0x1994f0){logger[_0x578f('0x31')](_0x578f('0x55'),_0x5b9d93['uniqueid'],util['inspect'](_0x1994f0,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncNewExten']=function(_0x7e8f15){try{if(this[_0x578f('0x37')](_0x7e8f15)){logger['debug'](_0x578f('0x56'),_0x7e8f15[_0x578f('0x39')],util['inspect'](_0x7e8f15,{'showHidden':![],'depth':null}));if(_0x7e8f15[_0x578f('0x39')]===_0x7e8f15['linkedid']&&_0x7e8f15[_0x578f('0x44')]!='h'&&_0x7e8f15[_0x578f('0x42')]!='OutgoingSpoolFailed'){_0x7e8f15[_0x578f('0x57')]=_0x7e8f15[_0x578f('0x57')][_0x578f('0x58')]();_0x7e8f15[_0x578f('0x59')]=_0x7e8f15[_0x578f('0x5a')]&&_0x7e8f15[_0x578f('0x5a')]['startsWith'](_0x578f('0x5b'))?_0x7e8f15['appdata']:(_0x7e8f15['appdata']||_0x7e8f15[_0x578f('0x59')])['toLowerCase']();logger['info'](_0x578f('0x5c'),_0x7e8f15[_0x578f('0x39')],_0x7e8f15['application'],_0x7e8f15[_0x578f('0x59')]);if(_[_0x578f('0x35')](this[_0x578f('0x1b')][_0x7e8f15[_0x578f('0x39')]])){this['channels'][_0x7e8f15[_0x578f('0x39')]]=new Channel();this[_0x578f('0x1b')][_0x7e8f15['uniqueid']][_0x578f('0x51')]=_0x7e8f15[_0x578f('0x5d')]?moment()[_0x578f('0x5e')](moment[_0x578f('0x5d')](_0x7e8f15['duration'])[_0x578f('0x5f')](),_0x578f('0x5f'))[_0x578f('0x47')](_0x578f('0x60')):moment()[_0x578f('0x47')](_0x578f('0x60'));this[_0x578f('0x1b')][_0x7e8f15[_0x578f('0x39')]][_0x578f('0x52')]=_0x578f('0x15');}_[_0x578f('0x61')](this[_0x578f('0x1b')][_0x7e8f15[_0x578f('0x39')]],_['pick'](_0x7e8f15,_[_0x578f('0x40')](this[_0x578f('0x1b')][_0x7e8f15['uniqueid']])));if(_[_0x578f('0x62')](applications,_0x7e8f15[_0x578f('0x57')])){this['channels'][_0x7e8f15[_0x578f('0x39')]][_0x578f('0x63')]=_0x7e8f15[_0x578f('0x57')];this[_0x578f('0x1b')][_0x7e8f15[_0x578f('0x39')]][_0x578f('0x64')]=_0x7e8f15[_0x578f('0x59')];if(_0x7e8f15[_0x578f('0x57')]==='set'&&_[_0x578f('0x65')](_0x7e8f15[_0x578f('0x59')]['toLowerCase'](),'cdr(')){var _0x2dc565=_0x7e8f15[_0x578f('0x59')][_0x578f('0x43')]('=');var _0x5eff64=_0x2dc565[0x0][_0x578f('0x58')]()[_0x578f('0x66')](/cdr\((.*)\)/);if(_0x5eff64){this[_0x578f('0x1b')][_0x7e8f15[_0x578f('0x39')]][_0x5eff64[0x1]]=_0x2dc565[0x1];}}else if(_0x7e8f15[_0x578f('0x57')]===_0x578f('0x67')){this[_0x578f('0x1b')][_0x7e8f15[_0x578f('0x39')]][_0x578f('0x67')]=_0x7e8f15[_0x578f('0x59')]['split'](',')[0x0];}}}}}catch(_0x11d557){logger[_0x578f('0x31')](_0x578f('0x68'),_0x7e8f15['uniqueid'],util[_0x578f('0x33')](_0x11d557,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x578f('0x34')][_0x578f('0x23')]=function(_0x5240ed){try{if(this[_0x578f('0x37')](_0x5240ed)){logger[_0x578f('0x2e')](_0x578f('0x69'),_0x5240ed[_0x578f('0x39')],_0x5240ed[_0x578f('0x3e')],_0x5240ed['calleridname'],_0x5240ed[_0x578f('0x3b')]);logger[_0x578f('0x3c')]('[%s][voiceCallReport][newstate]\x20event:',_0x5240ed[_0x578f('0x39')],util[_0x578f('0x33')](_0x5240ed,{'showHidden':![],'depth':null}));if(_0x5240ed[_0x578f('0x39')]!==_0x5240ed['linkedid']){if(this[_0x578f('0x1b')][_0x5240ed[_0x578f('0x3e')]]){if(_0x5240ed[_0x578f('0x53')]==='6'){if(!this[_0x578f('0x1b')][_0x5240ed[_0x578f('0x3e')]][_0x578f('0x6a')]){var _0x11a7f7=moment();this[_0x578f('0x1b')][_0x5240ed[_0x578f('0x3e')]][_0x578f('0x6a')]=!![];this['channels'][_0x5240ed[_0x578f('0x3e')]][_0x578f('0x6b')]=_0x11a7f7[_0x578f('0x47')](_0x578f('0x60'));if(this['channels'][_0x5240ed[_0x578f('0x3e')]][_0x578f('0x51')]){this[_0x578f('0x1b')][_0x5240ed['linkedid']][_0x578f('0x6c')]=_0x11a7f7[_0x578f('0x6d')](this[_0x578f('0x1b')][_0x5240ed[_0x578f('0x3e')]][_0x578f('0x51')],_0x578f('0x5f'));}}this['channels'][_0x5240ed['linkedid']]['linkedid']=_0x5240ed['uniqueid'];if(_0x5240ed[_0x578f('0x3b')]!==_0x578f('0x6e')){this[_0x578f('0x1b')][_0x5240ed[_0x578f('0x3e')]]['connectedlinenum']=_0x5240ed[_0x578f('0x3b')];}this[_0x578f('0x1b')][_0x5240ed[_0x578f('0x3e')]][_0x578f('0x6f')]=_0x5240ed[_0x578f('0x3a')];this[_0x578f('0x1b')][_0x5240ed[_0x578f('0x3e')]][_0x578f('0x70')]=_0x5240ed[_0x578f('0x42')];this[_0x578f('0x1b')][_0x5240ed['linkedid']][_0x578f('0x52')]=dispositions[_[_0x578f('0x71')](_0x5240ed['channelstate'])];if(this[_0x578f('0x1c')][_0x5240ed[_0x578f('0x42')][_0x578f('0x43')]('-')[0x0]]){this[_0x578f('0x1b')][_0x5240ed[_0x578f('0x3e')]][_0x578f('0x72')]=this[_0x578f('0x1c')][_0x5240ed[_0x578f('0x42')][_0x578f('0x43')]('-')[0x0]]['id'];this[_0x578f('0x1b')][_0x5240ed[_0x578f('0x3e')]][_0x578f('0x73')]=this[_0x578f('0x1c')][_0x5240ed[_0x578f('0x42')]['split']('-')[0x0]]['name'];}}}}else{if(this[_0x578f('0x1b')][_0x5240ed[_0x578f('0x39')]]){if(_0x5240ed[_0x578f('0x53')]==='6'){if(this[_0x578f('0x1c')][_0x5240ed['channel'][_0x578f('0x43')]('-')[0x0]]){this[_0x578f('0x1b')][_0x5240ed['uniqueid']][_0x578f('0x72')]=this[_0x578f('0x1c')][_0x5240ed[_0x578f('0x42')]['split']('-')[0x0]]['id'];this[_0x578f('0x1b')][_0x5240ed[_0x578f('0x39')]][_0x578f('0x73')]=this['agents'][_0x5240ed[_0x578f('0x42')][_0x578f('0x43')]('-')[0x0]][_0x578f('0x49')];}}}}if(_0x5240ed[_0x578f('0x53')]==='6'&&_0x5240ed[_0x578f('0x50')]==='from-sip'){if(this[_0x578f('0x1c')][_0x5240ed[_0x578f('0x42')]['split']('-')[0x0]]){this[_0x578f('0x1c')][_0x5240ed[_0x578f('0x42')][_0x578f('0x43')]('-')[0x0]][_0x578f('0x45')]=_0x5240ed[_0x578f('0x44')];var _0x410f6f;if(this[_0x578f('0x1b')][_0x5240ed[_0x578f('0x39')]])_0x410f6f=this['channels'][_0x5240ed[_0x578f('0x39')]][_0x578f('0x74')];else if(this['channels'][_0x5240ed[_0x578f('0x3e')]])_0x410f6f=this[_0x578f('0x1b')][_0x5240ed[_0x578f('0x3e')]][_0x578f('0x74')];logger['debug'](_0x578f('0x75'),_0x5240ed[_0x578f('0x39')],util[_0x578f('0x33')]({'destaccountcode':this['agents'][_0x5240ed[_0x578f('0x42')]['split']('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x5240ed['exten'],'routealias':_0x410f6f},{'showHidden':![],'depth':null}));this[_0x578f('0x36')](util[_0x578f('0x47')](_0x578f('0x48'),this[_0x578f('0x1c')][_0x5240ed[_0x578f('0x42')][_0x578f('0x43')]('-')[0x0]][_0x578f('0x49')]),'user:agentconnect',{'destaccountcode':this[_0x578f('0x1c')][_0x5240ed[_0x578f('0x42')]['split']('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x5240ed[_0x578f('0x44')],'routealias':_0x410f6f});}}}}catch(_0x25c8b6){logger[_0x578f('0x31')](_0x578f('0x76'),_0x5240ed[_0x578f('0x39')],util['inspect'](_0x25c8b6,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x578f('0x34')][_0x578f('0x77')]=function(_0x2d1e56,_0xddcd88){try{if(this[_0x578f('0x1b')][_0x2d1e56]){logger['info']('[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s',_0x2d1e56,_0xddcd88);this['channels'][_0x2d1e56][_0x578f('0x78')]=!![];if(_[_0x578f('0x79')](_0xddcd88,'.wav49')){_0xddcd88=_0xddcd88[_0x578f('0x7a')](_0x578f('0x7b'),_0x578f('0x7c'));}this[_0x578f('0x1b')][_0x2d1e56][_0x578f('0x7d')]=_0xddcd88;var _0x3b73c5=_['find'](this['channels'][_0x2d1e56][_0x578f('0x7e')],{'filename':_0xddcd88});if(_[_0x578f('0x7f')](_0x3b73c5)){this[_0x578f('0x1b')][_0x2d1e56][_0x578f('0x7e')][_0x578f('0x80')]({'filename':_0xddcd88,'createdAt':moment()[_0x578f('0x47')](_0x578f('0x60')),'mixmonitorid':'','status':_0x578f('0x81')});}}}catch(_0x11bb97){logger[_0x578f('0x31')](_0x578f('0x82'),_0x2d1e56,util[_0x578f('0x33')](_0x11bb97,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x578f('0x34')][_0x578f('0x83')]=function(_0x110b0a){try{if(this[_0x578f('0x37')](_0x110b0a)){logger[_0x578f('0x3c')]('[%s][voiceCallReport][varset]\x20event:',_0x110b0a[_0x578f('0x39')],util[_0x578f('0x33')](_0x110b0a,{'showHidden':![],'depth':null}));if(this[_0x578f('0x1b')][_0x110b0a[_0x578f('0x39')]]&&_0x110b0a[_0x578f('0x42')]!=_0x578f('0x4e')){if(this[_0x578f('0x37')](_0x110b0a[_0x578f('0x84')])){if(this[_0x578f('0x37')](_0x110b0a['variable']['mixmonitor_filename'])){logger[_0x578f('0x2e')](_0x578f('0x85'),_0x110b0a[_0x578f('0x39')],_0x110b0a[_0x578f('0x86')]);this[_0x578f('0x77')](_0x110b0a[_0x578f('0x39')],_0x110b0a[_0x578f('0x86')]);}else if(this[_0x578f('0x37')](_0x110b0a[_0x578f('0x84')][_0x578f('0x87')])){logger[_0x578f('0x2e')](_0x578f('0x88'),_0x110b0a[_0x578f('0x39')],_0x110b0a['value']);this[_0x578f('0x1b')][_0x110b0a['uniqueid']]['calleridnum']=_0x110b0a[_0x578f('0x86')];}else if(this[_0x578f('0x37')](_0x110b0a[_0x578f('0x84')][_0x578f('0x89')])){logger[_0x578f('0x2e')](_0x578f('0x8a'),_0x110b0a[_0x578f('0x39')],_0x110b0a[_0x578f('0x86')]);this['channels'][_0x110b0a[_0x578f('0x39')]][_0x578f('0x8b')]=_0x110b0a[_0x578f('0x86')];}else if(this['isNotNull'](_0x110b0a[_0x578f('0x84')][_0x578f('0x8c')])){logger[_0x578f('0x2e')](_0x578f('0x8d'),_0x110b0a[_0x578f('0x39')],_0x110b0a[_0x578f('0x86')]);this[_0x578f('0x1b')][_0x110b0a['uniqueid']][_0x578f('0x8e')]=_0x110b0a[_0x578f('0x86')];}else if(this[_0x578f('0x37')](_0x110b0a[_0x578f('0x84')][_0x578f('0x8f')])){logger[_0x578f('0x2e')](_0x578f('0x90'),_0x110b0a[_0x578f('0x39')],_0x110b0a[_0x578f('0x86')]['split'](',')[0x0]);this['channels'][_0x110b0a[_0x578f('0x39')]]['queue']=_0x110b0a['value'][_0x578f('0x43')](',')[0x0];}else if(this['isNotNull'](_0x110b0a[_0x578f('0x84')][_0x578f('0x91')])){logger[_0x578f('0x2e')]('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x110b0a[_0x578f('0x39')],_0x110b0a[_0x578f('0x86')]);this[_0x578f('0x1b')][_0x110b0a['uniqueid']][_0x578f('0x92')]=_0x110b0a[_0x578f('0x86')];}else if(this[_0x578f('0x37')](_0x110b0a[_0x578f('0x84')][_0x578f('0x93')])){logger[_0x578f('0x2e')]('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0x110b0a['uniqueid'],_0x110b0a[_0x578f('0x86')]);this['channels'][_0x110b0a[_0x578f('0x39')]]['destination']=_0x110b0a[_0x578f('0x86')];}else if(this[_0x578f('0x37')](_0x110b0a[_0x578f('0x84')]['xmd-callerid-preview'])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0x110b0a[_0x578f('0x39')],_0x110b0a[_0x578f('0x86')]);this[_0x578f('0x1b')][_0x110b0a[_0x578f('0x39')]][_0x578f('0x94')]=_0x110b0a[_0x578f('0x86')];}else if(this[_0x578f('0x37')](_0x110b0a['variable'][_0x578f('0x95')])){logger['info'](_0x578f('0x96'),_0x110b0a['uniqueid'],_0x110b0a['value']);this['channels'][_0x110b0a[_0x578f('0x39')]][_0x578f('0x67')]=_0x110b0a[_0x578f('0x86')];}else if(this['isNotNull'](_0x110b0a['variable']['sipcallid'])){logger[_0x578f('0x2e')](_0x578f('0x97'),_0x110b0a['uniqueid'],_0x110b0a['value']);this[_0x578f('0x1b')][_0x110b0a['uniqueid']][_0x578f('0x98')]=_0x110b0a['value'];}}}else if(this[_0x578f('0x37')](_0x110b0a[_0x578f('0x84')][_0x578f('0x99')])){if(_0x110b0a[_0x578f('0x86')]){var _0x27dc9a=path[_0x578f('0x9a')](_0x110b0a[_0x578f('0x86')])[_0x578f('0x49')];logger[_0x578f('0x2e')](_0x578f('0x85'),_0x27dc9a,_0x110b0a[_0x578f('0x86')]);this[_0x578f('0x77')](_0x27dc9a,_0x110b0a[_0x578f('0x86')]);}}else if(this[_0x578f('0x1b')][_0x110b0a[_0x578f('0x3e')]]){if(this[_0x578f('0x37')](_0x110b0a[_0x578f('0x84')])){if(this[_0x578f('0x37')](_0x110b0a[_0x578f('0x84')]['sipcallid'])){logger[_0x578f('0x2e')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x110b0a[_0x578f('0x3e')],_0x110b0a[_0x578f('0x86')]);this[_0x578f('0x1b')][_0x110b0a[_0x578f('0x3e')]][_0x578f('0x9b')]=_0x110b0a[_0x578f('0x86')];}}}}}catch(_0x1401f1){logger['error'](_0x578f('0x9c'),_0x110b0a[_0x578f('0x39')],util[_0x578f('0x33')](_0x1401f1,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x578f('0x34')][_0x578f('0x26')]=function(_0x3d07a3){try{if(this[_0x578f('0x37')](_0x3d07a3)){logger['debug'](_0x578f('0x9d'),_0x3d07a3[_0x578f('0x39')],util[_0x578f('0x33')](_0x3d07a3,{'showHidden':![],'depth':null}));if(this[_0x578f('0x1b')][_0x3d07a3['uniqueid']]){logger[_0x578f('0x2e')](_0x578f('0x9e'),_0x3d07a3[_0x578f('0x39')],_0x3d07a3[_0x578f('0x9f')]);var _0x4845c3=moment();this[_0x578f('0x1b')][_0x3d07a3[_0x578f('0x39')]][_0x578f('0xa0')]=_0x4845c3[_0x578f('0x47')](_0x578f('0x60'));this[_0x578f('0x1b')][_0x3d07a3['uniqueid']][_0x578f('0x5d')]=_0x4845c3[_0x578f('0x6d')](this[_0x578f('0x1b')][_0x3d07a3[_0x578f('0x39')]][_0x578f('0x51')],_0x578f('0x5f'));if(this['channels'][_0x3d07a3[_0x578f('0x39')]]['answered']){this[_0x578f('0x1b')][_0x3d07a3[_0x578f('0x39')]][_0x578f('0xa1')]=_0x4845c3['diff'](this['channels'][_0x3d07a3[_0x578f('0x39')]][_0x578f('0x6b')],_0x578f('0x5f'));this[_0x578f('0x1b')][_0x3d07a3['uniqueid']]['holdtime']=this[_0x578f('0x1b')][_0x3d07a3[_0x578f('0x39')]][_0x578f('0x5d')]-this['channels'][_0x3d07a3[_0x578f('0x39')]][_0x578f('0xa1')];}if(_0x3d07a3[_0x578f('0x50')]===_0x578f('0x41')){if(this['agents'][_0x3d07a3[_0x578f('0x42')][_0x578f('0x43')]('-')[0x0]]){this[_0x578f('0x1c')][_0x3d07a3[_0x578f('0x42')][_0x578f('0x43')]('-')[0x0]]=_[_0x578f('0xa2')](this[_0x578f('0x1c')][_0x3d07a3[_0x578f('0x42')][_0x578f('0x43')]('-')[0x0]],[_0x578f('0x45')]);logger['debug'](_0x578f('0xa3'),_0x3d07a3[_0x578f('0x39')],util[_0x578f('0x33')]({'id':this['agents'][_0x3d07a3[_0x578f('0x42')][_0x578f('0x43')]('-')[0x0]]['id'],'destaccountcode':this[_0x578f('0x1c')][_0x3d07a3[_0x578f('0x42')][_0x578f('0x43')]('-')[0x0]][_0x578f('0x4b')]},{'showHidden':![],'depth':null}));this[_0x578f('0x36')](util['format']('user:%s',this[_0x578f('0x1c')][_0x3d07a3['channel'][_0x578f('0x43')]('-')[0x0]][_0x578f('0x49')]),_0x578f('0xa4'),{'id':this[_0x578f('0x1c')][_0x3d07a3[_0x578f('0x42')][_0x578f('0x43')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x3d07a3[_0x578f('0x42')][_0x578f('0x43')]('-')[0x0]][_0x578f('0x4b')]});}}var _0x16f757=this;Promise['resolve']()[_0x578f('0xa5')](function(){var _0x529dd0=_0x16f757[_0x578f('0x1b')][_0x3d07a3[_0x578f('0x39')]];if(typeof _0x529dd0[_0x578f('0xa6')]==='undefined')return;if(_[_0x578f('0xa7')](_0x529dd0['monitors']))return;return RpcSetting[_0x578f('0xa8')]()['then'](function(_0x4bc050){if(!_0x4bc050[_0x578f('0xa9')])return;return Promise[_0x578f('0xaa')]()[_0x578f('0xa5')](function(){return ami[_0x578f('0xab')]({'action':_0x578f('0xac'),'channel':_0x529dd0[_0x578f('0x42')]})[_0x578f('0xad')](function(){});})[_0x578f('0xa5')](function(){return ami[_0x578f('0xab')]({'action':_0x578f('0xac'),'channel':_0x529dd0['destinationchannel']})[_0x578f('0xad')](function(){})[_0x578f('0xae')](function(){var _0x1c7dfa=_0x16f757[_0x578f('0x1c')][_0x529dd0[_0x578f('0x70')][_0x578f('0x43')]('-')[0x0]];if(!_0x1c7dfa)return;io[_0x578f('0x36')](_0x578f('0xaf'),{'agentId':_0x1c7dfa['id'],'uniqueid':_0x529dd0[_0x578f('0x39')]});});});});})['then'](function(){if(_0x3d07a3[_0x578f('0xb0')]===_0x578f('0xb1')){_0x16f757[_0x578f('0xb2')][_0x3d07a3[_0x578f('0x39')]]=_0x16f757[_0x578f('0x1b')][_0x3d07a3['uniqueid']];}else{if(_0x16f757[_0x578f('0x1b')][_0x3d07a3['uniqueid']]['type']===_0x578f('0xb3')&&_0x16f757[_0x578f('0xb2')][_0x3d07a3[_0x578f('0x39')]]){_0x16f757[_0x578f('0x1b')][_0x3d07a3[_0x578f('0x39')]]['uniqueid']=[_0x16f757['channels'][_0x3d07a3[_0x578f('0x39')]]['linkedid'],_0x16f757[_0x578f('0x1b')][_0x3d07a3[_0x578f('0x39')]][_0x578f('0x3e')]=_0x16f757[_0x578f('0x1b')][_0x3d07a3[_0x578f('0x39')]][_0x578f('0x39')]][0x0];delete _0x16f757[_0x578f('0xb2')][_0x3d07a3[_0x578f('0x39')]];}}logger[_0x578f('0x3c')](_0x578f('0xb4'),_0x3d07a3[_0x578f('0x39')],util['inspect'](_0x16f757[_0x578f('0x1b')][_0x3d07a3[_0x578f('0x39')]],{'showHidden':![],'depth':null}));ami[_0x578f('0x36')](_0x578f('0xb5'),_0x16f757[_0x578f('0x1b')][_0x3d07a3[_0x578f('0x39')]]);delete _0x16f757[_0x578f('0x1b')][_0x3d07a3['uniqueid']];});}}}catch(_0x26a02d){logger[_0x578f('0x31')](_0x578f('0xb6'),_0x3d07a3[_0x578f('0x39')],util['inspect'](_0x26a02d,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x578f('0x2a')]=function(_0x56773b){try{if(this['isNotNull'](_0x56773b)){logger[_0x578f('0x2e')]('[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x56773b['uniqueid'],_0x56773b[_0x578f('0xb7')],_0x56773b[_0x578f('0xb8')]);logger[_0x578f('0x3c')](_0x578f('0xb9'),_0x56773b['uniqueid'],util['inspect'](_0x56773b,{'showHidden':![],'depth':null}));if(this[_0x578f('0x1b')][_0x56773b[_0x578f('0xba')]]){this[_0x578f('0x1b')][_0x56773b['transfereeuniqueid']][_0x578f('0xbb')]=_0x56773b[_0x578f('0xb7')];this[_0x578f('0x1b')][_0x56773b[_0x578f('0xba')]][_0x578f('0xbc')]=_0x56773b['transfertargetcalleridnum'];if(this['channels'][_0x56773b[_0x578f('0xbd')]]){var _0x23f549=this[_0x578f('0x1b')][_0x56773b[_0x578f('0xbd')]];this[_0x578f('0x1b')][_0x56773b[_0x578f('0xbd')]]=this[_0x578f('0x1b')][_0x56773b[_0x578f('0xba')]];this[_0x578f('0x1b')][_0x56773b[_0x578f('0xba')]]=_0x23f549;}}else if(this[_0x578f('0x1b')][_0x56773b[_0x578f('0xbe')]]){this[_0x578f('0x1b')][_0x56773b[_0x578f('0xbe')]][_0x578f('0xbb')]=_0x56773b[_0x578f('0xb7')];this[_0x578f('0x1b')][_0x56773b[_0x578f('0xbe')]]['transferconnectedlinenum']=_0x56773b[_0x578f('0xb8')];if(this[_0x578f('0x1b')][_0x56773b[_0x578f('0xbf')]]){var _0x23f549=this[_0x578f('0x1b')][_0x56773b[_0x578f('0xbf')]];this['channels'][_0x56773b[_0x578f('0xbf')]]=this[_0x578f('0x1b')][_0x56773b['transfertargetuniqueid']];this['channels'][_0x56773b[_0x578f('0xbe')]]=_0x23f549;}}if((this[_0x578f('0x1b')][_0x56773b[_0x578f('0xbf')]]||this['channels'][_0x56773b[_0x578f('0xc0')]])&&this['channels'][_0x56773b[_0x578f('0xbd')]]){var _0x5e84d9=_[_0x578f('0xc1')]([this[_0x578f('0x1b')][_0x56773b[_0x578f('0xbf')]],this[_0x578f('0x1b')][_0x56773b[_0x578f('0xc0')]],this[_0x578f('0x1b')][_0x56773b[_0x578f('0xbd')]]],function(_0x53fc5b){return _0x53fc5b&&_0x53fc5b[_0x578f('0x8e')]==='outbound'&&_0x53fc5b[_0x578f('0xc2')];});if(_0x5e84d9){if(this[_0x578f('0x1b')][_0x56773b[_0x578f('0xbf')]])this[_0x578f('0x1b')][_0x56773b['origtransfereruniqueid']]['transferType']=_0x578f('0xc3');if(this[_0x578f('0x1b')][_0x56773b['origtransfererlinkedid']])this[_0x578f('0x1b')][_0x56773b[_0x578f('0xc0')]][_0x578f('0xa6')]=_0x578f('0xc3');this[_0x578f('0x1b')][_0x56773b['secondtransfereruniqueid']][_0x578f('0xa6')]='ATTENDED';}}}}catch(_0x145c14){logger['error'](_0x578f('0xc4'),_0x56773b['uniqueid'],util[_0x578f('0x33')](_0x145c14,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x578f('0x34')]['syncBlindTransfer']=function(_0x15ca8b){try{if(this[_0x578f('0x37')](_0x15ca8b)){logger[_0x578f('0x2e')](_0x578f('0xc5'),_0x15ca8b[_0x578f('0x39')],_0x15ca8b[_0x578f('0xc6')],_0x15ca8b[_0x578f('0xc7')]);logger['debug'](_0x578f('0xc8'),_0x15ca8b[_0x578f('0x39')],util[_0x578f('0x33')](_0x15ca8b,{'showHidden':![],'depth':null}));if(this[_0x578f('0x1b')][_0x15ca8b[_0x578f('0xba')]]){this[_0x578f('0x1b')][_0x15ca8b[_0x578f('0xba')]]['transfercalleridnum']=_0x15ca8b[_0x578f('0xc6')];this[_0x578f('0x1b')][_0x15ca8b[_0x578f('0xba')]][_0x578f('0xbc')]=_0x15ca8b['extension'];this['channels'][_0x15ca8b[_0x578f('0xba')]][_0x578f('0xa6')]=_0x578f('0xc9');this['syncHangup']({'event':'BlindTransfer','uniqueid':_0x15ca8b['transfereeuniqueid'],'context':_0x15ca8b[_0x578f('0x50')],'channel':_0x15ca8b['transfererchannel']});}else{this['channels'][_0x15ca8b[_0x578f('0xca')]]['transferType']=_0x578f('0xc9');}}}catch(_0x5ec3ef){logger[_0x578f('0x31')]('[%s][voiceCallReport][blindtransfer]',_0x15ca8b[_0x578f('0x39')],util[_0x578f('0x33')](_0x5ec3ef,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x578f('0x34')][_0x578f('0xcb')]=function(_0x3afb71){try{if(this[_0x578f('0x37')](_0x3afb71)){logger[_0x578f('0x3c')](_0x578f('0xcc'),_0x3afb71[_0x578f('0x39')],util['inspect'](_0x3afb71,{'showHidden':![],'depth':null}));if(this[_0x578f('0x1b')][_0x3afb71['uniqueid']]){if(!_[_0x578f('0x7f')](this[_0x578f('0x1b')][_0x3afb71[_0x578f('0x39')]][_0x578f('0x6b')])){this[_0x578f('0x1b')][_0x3afb71['uniqueid']][_0x578f('0xcd')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');logger[_0x578f('0x2e')](_0x578f('0xce'),_0x3afb71['uniqueid'],this[_0x578f('0x1b')][_0x3afb71[_0x578f('0x39')]][_0x578f('0xcd')]);}}}}catch(_0x3c23e5){logger[_0x578f('0x31')](_0x578f('0xcf'),_0x3afb71['uniqueid'],util[_0x578f('0x33')](_0x3c23e5,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x578f('0x34')][_0x578f('0x2d')]=function(_0x36add6){try{if(this[_0x578f('0x37')](_0x36add6)){logger[_0x578f('0x3c')](_0x578f('0xd0'),_0x36add6[_0x578f('0x39')],util['inspect'](_0x36add6,{'showHidden':![],'depth':null}));if(this['channels'][_0x36add6[_0x578f('0x39')]]){if(!_[_0x578f('0x7f')](this[_0x578f('0x1b')][_0x36add6[_0x578f('0x39')]][_0x578f('0xcd')])){this[_0x578f('0x1b')][_0x36add6[_0x578f('0x39')]][_0x578f('0xd1')]+=moment()['milliseconds'](0x0)[_0x578f('0x6d')](this[_0x578f('0x1b')][_0x36add6[_0x578f('0x39')]][_0x578f('0xcd')],_0x578f('0x5f'));logger[_0x578f('0x2e')](_0x578f('0xd2'),_0x36add6[_0x578f('0x39')],this[_0x578f('0x1b')][_0x36add6[_0x578f('0x39')]][_0x578f('0xd1')]);delete this[_0x578f('0x1b')][_0x36add6['uniqueid']][_0x578f('0xcd')];}}}}catch(_0x58d2ab){logger[_0x578f('0x31')](_0x578f('0xd3'),_0x36add6[_0x578f('0x39')],util[_0x578f('0x33')](_0x58d2ab,{'showHidden':![],'depth':null}));}};module[_0x578f('0xd4')]=VoiceCallReport; \ No newline at end of file +var _0xf632=['ioredis','../../../config/environment','../../../config/logger','ami','../model/channel','unknown','not_inuse','inuse','busy','invalid','ringing','ringinuse','onhold','set','queue','agi','dial','voicemail','NO\x20ANSWER','FAILED','BUSY','redis','defaults','localhost','socket.io-emitter','channels','agents','blindTransfers','coreshowchannel','syncNewExten','bind','newexten','newchannel','syncNewChannel','newstate','syncNewState','syncVarSet','hangup','syncHangup','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','isUndefined','emit','syncNewCallerId','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','merge','pick','keys','context','channel','split','exten','xcally-motion-preview','destconnectedlinenum','connectedlinenum','format','user:%s','name','user:agentconnect','accountcode','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','starttime','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','application','appdata','startsWith','CDR(routeAlias)','applicationdata','toLowerCase','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','subtract','seconds','includes','lastapplication','lastdata','cdr(','match','[%s][voiceCallReport][newexten]','answered','answertime','holdtime','connectedlinename','UserId','membername','routealias','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','replace','.WAV','monitorFilename','find','isNil','monitors','push','rec','OutgoingSpoolFailed','variable','value','xmd-phone','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','xmd-destination','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','mixmonitor_filename','sipcalllinkedid','[%s][voiceCallReport][varset]','cause-txt','endtime','billableseconds','diff','from-sip','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','resolve','then','transferType','undefined','isEmpty','getSettings','stopRecordingOnTransfer','Action','StopMixMonitor','destinationchannel','catch','finally','webbar:stopmonitors','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','secondtransfereruniqueid','transferconnectedlinenum','origtransfereruniqueid','transfertargetuniqueid','origtransfererlinkedid','some','routeid','ATTENDED','[%s][voiceCallReport][attendedtransfer]','transfereecalleridnum','extension','BLIND','transfererchannel','transfereruniqueid','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','mohstarttime','[%s][voiceCallReport][musiconholdstart]','mohtime','[%s][voiceCallReport][musiconholdstop]','exports','bluebird','lodash','moment','path'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xf632,0xcc));var _0x2f63=function(_0x1a33a3,_0x4683b5){_0x1a33a3=_0x1a33a3-0x0;var _0x4b9c41=_0xf632[_0x1a33a3];return _0x4b9c41;};'use strict';var BPromise=require(_0x2f63('0x0'));var _=require(_0x2f63('0x1'));var moment=require(_0x2f63('0x2'));var util=require('util');var path=require(_0x2f63('0x3'));var Redis=require(_0x2f63('0x4'));var config=require(_0x2f63('0x5'));var logger=require(_0x2f63('0x6'))(_0x2f63('0x7'));var ami=require('../ami');var Channel=require(_0x2f63('0x8'));var RpcSetting=require('../rpc/setting');var statusDesc=[_0x2f63('0x9'),_0x2f63('0xa'),_0x2f63('0xb'),_0x2f63('0xc'),_0x2f63('0xd'),'unavailable',_0x2f63('0xe'),_0x2f63('0xf'),_0x2f63('0x10')];var applications=[_0x2f63('0x11'),_0x2f63('0x12'),_0x2f63('0x13'),_0x2f63('0x14'),'playback',_0x2f63('0x15')];var dispositions=[_0x2f63('0x16'),_0x2f63('0x17'),_0x2f63('0x17'),'NO\x20ANSWER',_0x2f63('0x16'),'NO\x20ANSWER','ANSWERED',_0x2f63('0x18'),_0x2f63('0x17'),_0x2f63('0x17'),'FAILED'];var actions={};config[_0x2f63('0x19')]=_[_0x2f63('0x1a')](config[_0x2f63('0x19')],{'host':_0x2f63('0x1b'),'port':0x18eb});var io=require(_0x2f63('0x1c'))(new Redis(config['redis']));function VoiceCallReport(_0x3cae42){this[_0x2f63('0x1d')]=_0x3cae42['channels'];this[_0x2f63('0x1e')]=_0x3cae42[_0x2f63('0x1e')];this[_0x2f63('0x1f')]={};ami['on'](_0x2f63('0x20'),this[_0x2f63('0x21')][_0x2f63('0x22')](this));ami['on'](_0x2f63('0x23'),this[_0x2f63('0x21')]['bind'](this));ami['on'](_0x2f63('0x24'),this[_0x2f63('0x25')]['bind'](this));ami['on'](_0x2f63('0x26'),this[_0x2f63('0x27')][_0x2f63('0x22')](this));ami['on']('varset',this[_0x2f63('0x28')]['bind'](this));ami['on'](_0x2f63('0x29'),this[_0x2f63('0x2a')][_0x2f63('0x22')](this));ami['on']('newcallerid',this['syncNewCallerId'][_0x2f63('0x22')](this));ami['on'](_0x2f63('0x2b'),this[_0x2f63('0x2c')]['bind'](this));ami['on'](_0x2f63('0x2d'),this[_0x2f63('0x2e')][_0x2f63('0x22')](this));ami['on'](_0x2f63('0x2f'),this[_0x2f63('0x30')][_0x2f63('0x22')](this));ami['on'](_0x2f63('0x31'),this[_0x2f63('0x32')][_0x2f63('0x22')](this));try{logger[_0x2f63('0x33')]('[voiceCallReport][coreshowchannels]\x20started');ami[_0x2f63('0x34')]();}catch(_0x2985e6){logger[_0x2f63('0x35')](_0x2f63('0x36'),util[_0x2f63('0x37')](_0x2985e6,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x2f63('0x38')][_0x2f63('0x39')]=function(_0x5217b1){return _0x5217b1!==null&&!_[_0x2f63('0x3a')](_0x5217b1);};VoiceCallReport[_0x2f63('0x38')][_0x2f63('0x3b')]=function(_0x5db20b,_0x1b55aa,_0x5c53bb){io['to'](_0x5db20b)[_0x2f63('0x3b')](_0x1b55aa,_0x5c53bb);};VoiceCallReport['prototype'][_0x2f63('0x3c')]=function(_0x13979a){try{if(this[_0x2f63('0x39')](_0x13979a)){logger['info'](_0x2f63('0x3d'),_0x13979a[_0x2f63('0x3e')],_0x13979a[_0x2f63('0x3f')],_0x13979a[_0x2f63('0x40')]);logger[_0x2f63('0x41')](_0x2f63('0x42'),_0x13979a[_0x2f63('0x3e')],util[_0x2f63('0x37')](_0x13979a,{'showHidden':![],'depth':null}));if(_0x13979a[_0x2f63('0x3e')]===_0x13979a[_0x2f63('0x43')]){if(!_[_0x2f63('0x3a')](this[_0x2f63('0x1d')][_0x13979a[_0x2f63('0x3e')]])){_[_0x2f63('0x44')](this[_0x2f63('0x1d')][_0x13979a['uniqueid']],_[_0x2f63('0x45')](_0x13979a,_[_0x2f63('0x46')](this['channels'][_0x13979a['uniqueid']])));}}if(_0x13979a[_0x2f63('0x47')]==='from-sip'){if(this[_0x2f63('0x1e')][_0x13979a[_0x2f63('0x48')][_0x2f63('0x49')]('-')[0x0]]){if(_0x13979a[_0x2f63('0x4a')]==_0x2f63('0x4b')){this[_0x2f63('0x1e')][_0x13979a[_0x2f63('0x48')][_0x2f63('0x49')]('-')[0x0]][_0x2f63('0x4c')]=_0x13979a[_0x2f63('0x4d')];this[_0x2f63('0x3b')](util[_0x2f63('0x4e')](_0x2f63('0x4f'),this['agents'][_0x13979a[_0x2f63('0x48')][_0x2f63('0x49')]('-')[0x0]][_0x2f63('0x50')]),_0x2f63('0x51'),{'destaccountcode':this['agents'][_0x13979a['channel'][_0x2f63('0x49')]('-')[0x0]][_0x2f63('0x52')],'destconnectedlinenum':_0x13979a[_0x2f63('0x4d')]});}}}}}catch(_0x13cb90){logger[_0x2f63('0x35')](_0x2f63('0x53'),_0x13979a[_0x2f63('0x3e')],util[_0x2f63('0x37')](_0x13cb90,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x2f63('0x25')]=function(_0x4ff49e){try{if(this[_0x2f63('0x39')](_0x4ff49e)){logger[_0x2f63('0x41')](_0x2f63('0x54'),_0x4ff49e[_0x2f63('0x3e')],util[_0x2f63('0x37')](_0x4ff49e,{'showHidden':![],'depth':null}));if(_0x4ff49e[_0x2f63('0x3e')]===_0x4ff49e[_0x2f63('0x43')]&&_0x4ff49e[_0x2f63('0x48')]!='OutgoingSpoolFailed'){if(_['isUndefined'](this[_0x2f63('0x1d')][_0x4ff49e[_0x2f63('0x3e')]])){logger['info'](_0x2f63('0x55'),_0x4ff49e['uniqueid'],_0x4ff49e[_0x2f63('0x47')],_0x4ff49e['exten']);this[_0x2f63('0x1d')][_0x4ff49e['uniqueid']]=new Channel();this[_0x2f63('0x1d')][_0x4ff49e[_0x2f63('0x3e')]][_0x2f63('0x56')]=moment()[_0x2f63('0x4e')](_0x2f63('0x57'));this[_0x2f63('0x1d')][_0x4ff49e[_0x2f63('0x3e')]][_0x2f63('0x58')]=dispositions[_[_0x2f63('0x59')](_0x4ff49e[_0x2f63('0x5a')])];_['merge'](this['channels'][_0x4ff49e['uniqueid']],_[_0x2f63('0x45')](_0x4ff49e,_['keys'](this[_0x2f63('0x1d')][_0x4ff49e['uniqueid']])));if(_0x4ff49e[_0x2f63('0x47')]==='from-sip'){if(this[_0x2f63('0x1e')][_0x4ff49e[_0x2f63('0x48')][_0x2f63('0x49')]('-')[0x0]]){if(_[_0x2f63('0x3a')](this[_0x2f63('0x1e')][_0x4ff49e[_0x2f63('0x48')][_0x2f63('0x49')]('-')[0x0]]['destconnectedlinenum'])){this['agents'][_0x4ff49e['channel'][_0x2f63('0x49')]('-')[0x0]]['destconnectedlinenum']=_0x4ff49e[_0x2f63('0x4a')];logger['debug'](_0x2f63('0x5b'),_0x4ff49e[_0x2f63('0x3e')],util['inspect']({'destaccountcode':this['agents'][_0x4ff49e[_0x2f63('0x48')][_0x2f63('0x49')]('-')[0x0]][_0x2f63('0x52')],'destconnectedlinenum':_0x4ff49e[_0x2f63('0x4a')]},{'showHidden':![],'depth':null}));this[_0x2f63('0x3b')](util[_0x2f63('0x4e')]('user:%s',this['agents'][_0x4ff49e[_0x2f63('0x48')][_0x2f63('0x49')]('-')[0x0]][_0x2f63('0x50')]),_0x2f63('0x51'),{'destaccountcode':this[_0x2f63('0x1e')][_0x4ff49e[_0x2f63('0x48')][_0x2f63('0x49')]('-')[0x0]][_0x2f63('0x52')],'destconnectedlinenum':_0x4ff49e[_0x2f63('0x4a')]});}}}}}}}catch(_0x4afecf){logger[_0x2f63('0x35')]('[%s][voiceCallReport][newchannel]',_0x4ff49e[_0x2f63('0x3e')],util['inspect'](_0x4afecf,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2f63('0x38')]['syncNewExten']=function(_0x5a0412){try{if(this[_0x2f63('0x39')](_0x5a0412)){logger['debug']('[%s][voiceCallReport][newexten]\x20event:',_0x5a0412['uniqueid'],util[_0x2f63('0x37')](_0x5a0412,{'showHidden':![],'depth':null}));if(_0x5a0412[_0x2f63('0x3e')]===_0x5a0412[_0x2f63('0x43')]&&_0x5a0412[_0x2f63('0x4a')]!='h'&&_0x5a0412[_0x2f63('0x48')]!='OutgoingSpoolFailed'){_0x5a0412['application']=_0x5a0412[_0x2f63('0x5c')]['toLowerCase']();_0x5a0412['applicationdata']=_0x5a0412[_0x2f63('0x5d')]&&_0x5a0412['appdata'][_0x2f63('0x5e')](_0x2f63('0x5f'))?_0x5a0412[_0x2f63('0x5d')]:(_0x5a0412[_0x2f63('0x5d')]||_0x5a0412[_0x2f63('0x60')])[_0x2f63('0x61')]();logger['info'](_0x2f63('0x62'),_0x5a0412[_0x2f63('0x3e')],_0x5a0412[_0x2f63('0x5c')],_0x5a0412['applicationdata']);if(_['isUndefined'](this[_0x2f63('0x1d')][_0x5a0412['uniqueid']])){this[_0x2f63('0x1d')][_0x5a0412[_0x2f63('0x3e')]]=new Channel();this[_0x2f63('0x1d')][_0x5a0412[_0x2f63('0x3e')]][_0x2f63('0x56')]=_0x5a0412[_0x2f63('0x63')]?moment()[_0x2f63('0x64')](moment['duration'](_0x5a0412[_0x2f63('0x63')])[_0x2f63('0x65')](),'seconds')[_0x2f63('0x4e')](_0x2f63('0x57')):moment()[_0x2f63('0x4e')](_0x2f63('0x57'));this[_0x2f63('0x1d')][_0x5a0412[_0x2f63('0x3e')]][_0x2f63('0x58')]=_0x2f63('0x16');}_['merge'](this[_0x2f63('0x1d')][_0x5a0412[_0x2f63('0x3e')]],_[_0x2f63('0x45')](_0x5a0412,_[_0x2f63('0x46')](this[_0x2f63('0x1d')][_0x5a0412[_0x2f63('0x3e')]])));if(_[_0x2f63('0x66')](applications,_0x5a0412[_0x2f63('0x5c')])){this[_0x2f63('0x1d')][_0x5a0412[_0x2f63('0x3e')]][_0x2f63('0x67')]=_0x5a0412['application'];this['channels'][_0x5a0412[_0x2f63('0x3e')]][_0x2f63('0x68')]=_0x5a0412['applicationdata'];if(_0x5a0412[_0x2f63('0x5c')]==='set'&&_['startsWith'](_0x5a0412[_0x2f63('0x60')][_0x2f63('0x61')](),_0x2f63('0x69'))){var _0x255fbf=_0x5a0412[_0x2f63('0x60')][_0x2f63('0x49')]('=');var _0x57b483=_0x255fbf[0x0][_0x2f63('0x61')]()[_0x2f63('0x6a')](/cdr\((.*)\)/);if(_0x57b483){this['channels'][_0x5a0412[_0x2f63('0x3e')]][_0x57b483[0x1]]=_0x255fbf[0x1];}}else if(_0x5a0412[_0x2f63('0x5c')]===_0x2f63('0x12')){this['channels'][_0x5a0412[_0x2f63('0x3e')]][_0x2f63('0x12')]=_0x5a0412[_0x2f63('0x60')][_0x2f63('0x49')](',')[0x0];}}}}}catch(_0x53596f){logger[_0x2f63('0x35')](_0x2f63('0x6b'),_0x5a0412[_0x2f63('0x3e')],util[_0x2f63('0x37')](_0x53596f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2f63('0x38')]['syncNewState']=function(_0x312c63){try{if(this[_0x2f63('0x39')](_0x312c63)){logger[_0x2f63('0x33')]('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x312c63['uniqueid'],_0x312c63[_0x2f63('0x43')],_0x312c63[_0x2f63('0x3f')],_0x312c63['calleridnum']);logger[_0x2f63('0x41')]('[%s][voiceCallReport][newstate]\x20event:',_0x312c63[_0x2f63('0x3e')],util[_0x2f63('0x37')](_0x312c63,{'showHidden':![],'depth':null}));if(_0x312c63[_0x2f63('0x3e')]!==_0x312c63['linkedid']){if(this['channels'][_0x312c63[_0x2f63('0x43')]]){if(_0x312c63[_0x2f63('0x5a')]==='6'){if(!this[_0x2f63('0x1d')][_0x312c63['linkedid']][_0x2f63('0x6c')]){var _0xedae0b=moment();this[_0x2f63('0x1d')][_0x312c63[_0x2f63('0x43')]][_0x2f63('0x6c')]=!![];this[_0x2f63('0x1d')][_0x312c63[_0x2f63('0x43')]][_0x2f63('0x6d')]=_0xedae0b[_0x2f63('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');if(this[_0x2f63('0x1d')][_0x312c63['linkedid']]['starttime']){this['channels'][_0x312c63['linkedid']][_0x2f63('0x6e')]=_0xedae0b['diff'](this['channels'][_0x312c63[_0x2f63('0x43')]]['starttime'],'seconds');}}this['channels'][_0x312c63[_0x2f63('0x43')]][_0x2f63('0x43')]=_0x312c63[_0x2f63('0x3e')];if(_0x312c63[_0x2f63('0x40')]!==_0x2f63('0x4b')){this[_0x2f63('0x1d')][_0x312c63[_0x2f63('0x43')]][_0x2f63('0x4d')]=_0x312c63['calleridnum'];}this[_0x2f63('0x1d')][_0x312c63[_0x2f63('0x43')]][_0x2f63('0x6f')]=_0x312c63['calleridname'];this[_0x2f63('0x1d')][_0x312c63[_0x2f63('0x43')]]['destinationchannel']=_0x312c63[_0x2f63('0x48')];this[_0x2f63('0x1d')][_0x312c63[_0x2f63('0x43')]]['disposition']=dispositions[_[_0x2f63('0x59')](_0x312c63['channelstate'])];if(this[_0x2f63('0x1e')][_0x312c63[_0x2f63('0x48')][_0x2f63('0x49')]('-')[0x0]]){this[_0x2f63('0x1d')][_0x312c63['linkedid']][_0x2f63('0x70')]=this[_0x2f63('0x1e')][_0x312c63[_0x2f63('0x48')][_0x2f63('0x49')]('-')[0x0]]['id'];this[_0x2f63('0x1d')][_0x312c63[_0x2f63('0x43')]][_0x2f63('0x71')]=this[_0x2f63('0x1e')][_0x312c63[_0x2f63('0x48')][_0x2f63('0x49')]('-')[0x0]][_0x2f63('0x50')];}}}}else{if(this['channels'][_0x312c63[_0x2f63('0x3e')]]){if(_0x312c63[_0x2f63('0x5a')]==='6'){if(this[_0x2f63('0x1e')][_0x312c63[_0x2f63('0x48')][_0x2f63('0x49')]('-')[0x0]]){this[_0x2f63('0x1d')][_0x312c63['uniqueid']][_0x2f63('0x70')]=this[_0x2f63('0x1e')][_0x312c63[_0x2f63('0x48')]['split']('-')[0x0]]['id'];this[_0x2f63('0x1d')][_0x312c63[_0x2f63('0x3e')]][_0x2f63('0x71')]=this[_0x2f63('0x1e')][_0x312c63[_0x2f63('0x48')][_0x2f63('0x49')]('-')[0x0]][_0x2f63('0x50')];}}}}if(_0x312c63[_0x2f63('0x5a')]==='6'&&_0x312c63[_0x2f63('0x47')]==='from-sip'){if(this[_0x2f63('0x1e')][_0x312c63[_0x2f63('0x48')]['split']('-')[0x0]]){this[_0x2f63('0x1e')][_0x312c63[_0x2f63('0x48')]['split']('-')[0x0]][_0x2f63('0x4c')]=_0x312c63['exten'];var _0xc9fede;if(this[_0x2f63('0x1d')][_0x312c63['uniqueid']])_0xc9fede=this[_0x2f63('0x1d')][_0x312c63[_0x2f63('0x3e')]][_0x2f63('0x72')];else if(this[_0x2f63('0x1d')][_0x312c63[_0x2f63('0x43')]])_0xc9fede=this[_0x2f63('0x1d')][_0x312c63[_0x2f63('0x43')]]['routealias'];logger[_0x2f63('0x41')](_0x2f63('0x73'),_0x312c63[_0x2f63('0x3e')],util[_0x2f63('0x37')]({'destaccountcode':this['agents'][_0x312c63[_0x2f63('0x48')]['split']('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x312c63[_0x2f63('0x4a')],'routealias':_0xc9fede},{'showHidden':![],'depth':null}));this[_0x2f63('0x3b')](util[_0x2f63('0x4e')](_0x2f63('0x4f'),this[_0x2f63('0x1e')][_0x312c63[_0x2f63('0x48')]['split']('-')[0x0]][_0x2f63('0x50')]),_0x2f63('0x51'),{'destaccountcode':this['agents'][_0x312c63[_0x2f63('0x48')][_0x2f63('0x49')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x312c63[_0x2f63('0x4a')],'routealias':_0xc9fede});}}}}catch(_0x5ae558){logger[_0x2f63('0x35')](_0x2f63('0x74'),_0x312c63[_0x2f63('0x3e')],util[_0x2f63('0x37')](_0x5ae558,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x2f63('0x75')]=function(_0x17f007,_0x4994af){try{if(this['channels'][_0x17f007]){logger[_0x2f63('0x33')](_0x2f63('0x76'),_0x17f007,_0x4994af);this[_0x2f63('0x1d')][_0x17f007][_0x2f63('0x77')]=!![];if(_[_0x2f63('0x78')](_0x4994af,'.wav49')){_0x4994af=_0x4994af[_0x2f63('0x79')]('.wav49',_0x2f63('0x7a'));}this[_0x2f63('0x1d')][_0x17f007][_0x2f63('0x7b')]=_0x4994af;var _0x5dbf4d=_[_0x2f63('0x7c')](this[_0x2f63('0x1d')][_0x17f007]['monitors'],{'filename':_0x4994af});if(_[_0x2f63('0x7d')](_0x5dbf4d)){this[_0x2f63('0x1d')][_0x17f007][_0x2f63('0x7e')][_0x2f63('0x7f')]({'filename':_0x4994af,'createdAt':moment()[_0x2f63('0x4e')](_0x2f63('0x57')),'mixmonitorid':'','status':_0x2f63('0x80')});}}}catch(_0x9883b2){logger[_0x2f63('0x35')]('[%s][voiceCallReport][mixMonitorFilename]',_0x17f007,util[_0x2f63('0x37')](_0x9883b2,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2f63('0x38')][_0x2f63('0x28')]=function(_0x5d99d0){try{if(this['isNotNull'](_0x5d99d0)){logger[_0x2f63('0x41')]('[%s][voiceCallReport][varset]\x20event:',_0x5d99d0[_0x2f63('0x3e')],util[_0x2f63('0x37')](_0x5d99d0,{'showHidden':![],'depth':null}));if(this['channels'][_0x5d99d0['uniqueid']]&&_0x5d99d0[_0x2f63('0x48')]!=_0x2f63('0x81')){if(this[_0x2f63('0x39')](_0x5d99d0[_0x2f63('0x82')])){if(this['isNotNull'](_0x5d99d0[_0x2f63('0x82')]['mixmonitor_filename'])){logger['info']('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x5d99d0[_0x2f63('0x3e')],_0x5d99d0[_0x2f63('0x83')]);this[_0x2f63('0x75')](_0x5d99d0[_0x2f63('0x3e')],_0x5d99d0[_0x2f63('0x83')]);}else if(this[_0x2f63('0x39')](_0x5d99d0[_0x2f63('0x82')][_0x2f63('0x84')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s',_0x5d99d0[_0x2f63('0x3e')],_0x5d99d0[_0x2f63('0x83')]);this[_0x2f63('0x1d')][_0x5d99d0[_0x2f63('0x3e')]][_0x2f63('0x40')]=_0x5d99d0[_0x2f63('0x83')];}else if(this[_0x2f63('0x39')](_0x5d99d0[_0x2f63('0x82')][_0x2f63('0x85')])){logger[_0x2f63('0x33')](_0x2f63('0x86'),_0x5d99d0[_0x2f63('0x3e')],_0x5d99d0['value']);this[_0x2f63('0x1d')][_0x5d99d0[_0x2f63('0x3e')]][_0x2f63('0x87')]=_0x5d99d0[_0x2f63('0x83')];}else if(this[_0x2f63('0x39')](_0x5d99d0[_0x2f63('0x82')][_0x2f63('0x88')])){logger[_0x2f63('0x33')](_0x2f63('0x89'),_0x5d99d0[_0x2f63('0x3e')],_0x5d99d0[_0x2f63('0x83')]);this[_0x2f63('0x1d')][_0x5d99d0[_0x2f63('0x3e')]][_0x2f63('0x8a')]=_0x5d99d0[_0x2f63('0x83')];}else if(this[_0x2f63('0x39')](_0x5d99d0[_0x2f63('0x82')]['xmd-queue'])){logger[_0x2f63('0x33')](_0x2f63('0x8b'),_0x5d99d0[_0x2f63('0x3e')],_0x5d99d0['value'][_0x2f63('0x49')](',')[0x0]);this[_0x2f63('0x1d')][_0x5d99d0[_0x2f63('0x3e')]][_0x2f63('0x12')]=_0x5d99d0['value']['split'](',')[0x0];}else if(this['isNotNull'](_0x5d99d0[_0x2f63('0x82')][_0x2f63('0x8c')])){logger[_0x2f63('0x33')](_0x2f63('0x8d'),_0x5d99d0[_0x2f63('0x3e')],_0x5d99d0['value']);this[_0x2f63('0x1d')][_0x5d99d0[_0x2f63('0x3e')]]['originatecalleridnum']=_0x5d99d0[_0x2f63('0x83')];}else if(this[_0x2f63('0x39')](_0x5d99d0[_0x2f63('0x82')][_0x2f63('0x8e')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0x5d99d0[_0x2f63('0x3e')],_0x5d99d0[_0x2f63('0x83')]);this[_0x2f63('0x1d')][_0x5d99d0[_0x2f63('0x3e')]][_0x2f63('0x8f')]=_0x5d99d0[_0x2f63('0x83')];}else if(this[_0x2f63('0x39')](_0x5d99d0['variable'][_0x2f63('0x90')])){logger[_0x2f63('0x33')](_0x2f63('0x91'),_0x5d99d0[_0x2f63('0x3e')],_0x5d99d0[_0x2f63('0x83')]);this[_0x2f63('0x1d')][_0x5d99d0[_0x2f63('0x3e')]][_0x2f63('0x92')]=_0x5d99d0[_0x2f63('0x83')];}else if(this[_0x2f63('0x39')](_0x5d99d0['variable'][_0x2f63('0x93')])){logger['info'](_0x2f63('0x94'),_0x5d99d0[_0x2f63('0x3e')],_0x5d99d0[_0x2f63('0x83')]);this[_0x2f63('0x1d')][_0x5d99d0['uniqueid']]['queue']=_0x5d99d0[_0x2f63('0x83')];}else if(this[_0x2f63('0x39')](_0x5d99d0[_0x2f63('0x82')][_0x2f63('0x95')])){logger['info'](_0x2f63('0x96'),_0x5d99d0[_0x2f63('0x3e')],_0x5d99d0[_0x2f63('0x83')]);this[_0x2f63('0x1d')][_0x5d99d0[_0x2f63('0x3e')]][_0x2f63('0x97')]=_0x5d99d0['value'];}}}else if(this[_0x2f63('0x39')](_0x5d99d0[_0x2f63('0x82')][_0x2f63('0x98')])){if(_0x5d99d0[_0x2f63('0x83')]){var _0x311079=path['parse'](_0x5d99d0[_0x2f63('0x83')])[_0x2f63('0x50')];logger[_0x2f63('0x33')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x311079,_0x5d99d0[_0x2f63('0x83')]);this[_0x2f63('0x75')](_0x311079,_0x5d99d0[_0x2f63('0x83')]);}}else if(this[_0x2f63('0x1d')][_0x5d99d0[_0x2f63('0x43')]]){if(this['isNotNull'](_0x5d99d0['variable'])){if(this[_0x2f63('0x39')](_0x5d99d0[_0x2f63('0x82')]['sipcallid'])){logger[_0x2f63('0x33')](_0x2f63('0x96'),_0x5d99d0['linkedid'],_0x5d99d0[_0x2f63('0x83')]);this[_0x2f63('0x1d')][_0x5d99d0[_0x2f63('0x43')]][_0x2f63('0x99')]=_0x5d99d0[_0x2f63('0x83')];}}}}}catch(_0x29abec){logger['error'](_0x2f63('0x9a'),_0x5d99d0['uniqueid'],util[_0x2f63('0x37')](_0x29abec,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2f63('0x38')][_0x2f63('0x2a')]=function(_0x36fbf7){try{if(this[_0x2f63('0x39')](_0x36fbf7)){logger[_0x2f63('0x41')]('[%s][voiceCallReport][hangup]\x20event:',_0x36fbf7[_0x2f63('0x3e')],util[_0x2f63('0x37')](_0x36fbf7,{'showHidden':![],'depth':null}));if(this[_0x2f63('0x1d')][_0x36fbf7[_0x2f63('0x3e')]]){logger['info']('[%s][voiceCallReport][hangup]\x20reason:%s',_0x36fbf7[_0x2f63('0x3e')],_0x36fbf7[_0x2f63('0x9b')]);var _0x19bb9d=moment();this[_0x2f63('0x1d')][_0x36fbf7['uniqueid']][_0x2f63('0x9c')]=_0x19bb9d[_0x2f63('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x2f63('0x1d')][_0x36fbf7[_0x2f63('0x3e')]][_0x2f63('0x63')]=_0x19bb9d['diff'](this[_0x2f63('0x1d')][_0x36fbf7[_0x2f63('0x3e')]][_0x2f63('0x56')],_0x2f63('0x65'));if(this[_0x2f63('0x1d')][_0x36fbf7[_0x2f63('0x3e')]][_0x2f63('0x6c')]){this[_0x2f63('0x1d')][_0x36fbf7[_0x2f63('0x3e')]][_0x2f63('0x9d')]=_0x19bb9d[_0x2f63('0x9e')](this[_0x2f63('0x1d')][_0x36fbf7['uniqueid']][_0x2f63('0x6d')],_0x2f63('0x65'));this[_0x2f63('0x1d')][_0x36fbf7['uniqueid']]['holdtime']=this[_0x2f63('0x1d')][_0x36fbf7['uniqueid']][_0x2f63('0x63')]-this[_0x2f63('0x1d')][_0x36fbf7[_0x2f63('0x3e')]][_0x2f63('0x9d')];}if(_0x36fbf7['context']===_0x2f63('0x9f')){if(this[_0x2f63('0x1e')][_0x36fbf7[_0x2f63('0x48')][_0x2f63('0x49')]('-')[0x0]]){this[_0x2f63('0x1e')][_0x36fbf7[_0x2f63('0x48')][_0x2f63('0x49')]('-')[0x0]]=_[_0x2f63('0xa0')](this['agents'][_0x36fbf7[_0x2f63('0x48')]['split']('-')[0x0]],[_0x2f63('0x4c')]);logger['debug'](_0x2f63('0xa1'),_0x36fbf7[_0x2f63('0x3e')],util[_0x2f63('0x37')]({'id':this[_0x2f63('0x1e')][_0x36fbf7[_0x2f63('0x48')][_0x2f63('0x49')]('-')[0x0]]['id'],'destaccountcode':this[_0x2f63('0x1e')][_0x36fbf7[_0x2f63('0x48')]['split']('-')[0x0]][_0x2f63('0x52')]},{'showHidden':![],'depth':null}));this[_0x2f63('0x3b')](util[_0x2f63('0x4e')]('user:%s',this[_0x2f63('0x1e')][_0x36fbf7[_0x2f63('0x48')][_0x2f63('0x49')]('-')[0x0]][_0x2f63('0x50')]),'user:agentcomplete',{'id':this[_0x2f63('0x1e')][_0x36fbf7['channel'][_0x2f63('0x49')]('-')[0x0]]['id'],'destaccountcode':this[_0x2f63('0x1e')][_0x36fbf7[_0x2f63('0x48')][_0x2f63('0x49')]('-')[0x0]][_0x2f63('0x52')]});}}var _0x2e84b0=this;Promise[_0x2f63('0xa2')]()[_0x2f63('0xa3')](function(){var _0x22ebb9=_0x2e84b0['channels'][_0x36fbf7[_0x2f63('0x3e')]];if(typeof _0x22ebb9[_0x2f63('0xa4')]===_0x2f63('0xa5'))return;if(_[_0x2f63('0xa6')](_0x22ebb9[_0x2f63('0x7e')]))return;return RpcSetting[_0x2f63('0xa7')]()['then'](function(_0x432124){if(!_0x432124[_0x2f63('0xa8')])return;return Promise[_0x2f63('0xa2')]()['then'](function(){return ami[_0x2f63('0xa9')]({'action':_0x2f63('0xaa'),'channel':_0x22ebb9['channel']})['catch'](function(){});})['then'](function(){return ami[_0x2f63('0xa9')]({'action':_0x2f63('0xaa'),'channel':_0x22ebb9[_0x2f63('0xab')]})[_0x2f63('0xac')](function(){})[_0x2f63('0xad')](function(){var _0x5d95c7=_0x2e84b0[_0x2f63('0x1e')][_0x22ebb9[_0x2f63('0xab')][_0x2f63('0x49')]('-')[0x0]];if(!_0x5d95c7)return;io[_0x2f63('0x3b')](_0x2f63('0xae'),{'agentId':_0x5d95c7['id'],'uniqueid':_0x22ebb9[_0x2f63('0x3e')]});});});});})[_0x2f63('0xa3')](function(){if(_0x36fbf7[_0x2f63('0xaf')]===_0x2f63('0xb0')){_0x2e84b0['blindTransfers'][_0x36fbf7[_0x2f63('0x3e')]]=_0x2e84b0[_0x2f63('0x1d')][_0x36fbf7[_0x2f63('0x3e')]];}else{if(_0x2e84b0['channels'][_0x36fbf7['uniqueid']][_0x2f63('0x8a')]===_0x2f63('0xb1')&&_0x2e84b0[_0x2f63('0x1f')][_0x36fbf7[_0x2f63('0x3e')]]){_0x2e84b0[_0x2f63('0x1d')][_0x36fbf7[_0x2f63('0x3e')]][_0x2f63('0x3e')]=[_0x2e84b0['channels'][_0x36fbf7[_0x2f63('0x3e')]][_0x2f63('0x43')],_0x2e84b0[_0x2f63('0x1d')][_0x36fbf7[_0x2f63('0x3e')]]['linkedid']=_0x2e84b0[_0x2f63('0x1d')][_0x36fbf7[_0x2f63('0x3e')]][_0x2f63('0x3e')]][0x0];delete _0x2e84b0[_0x2f63('0x1f')][_0x36fbf7[_0x2f63('0x3e')]];}}logger[_0x2f63('0x41')](_0x2f63('0xb2'),_0x36fbf7[_0x2f63('0x3e')],util[_0x2f63('0x37')](_0x2e84b0[_0x2f63('0x1d')][_0x36fbf7['uniqueid']],{'showHidden':![],'depth':null}));ami['emit'](_0x2f63('0xb3'),_0x2e84b0[_0x2f63('0x1d')][_0x36fbf7[_0x2f63('0x3e')]]);delete _0x2e84b0['channels'][_0x36fbf7[_0x2f63('0x3e')]];});}}}catch(_0x35e4af){logger[_0x2f63('0x35')]('[%s][voiceCallReport][hangup]',_0x36fbf7[_0x2f63('0x3e')],util[_0x2f63('0x37')](_0x35e4af,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2f63('0x38')][_0x2f63('0x2c')]=function(_0x4a2426){try{if(this[_0x2f63('0x39')](_0x4a2426)){logger[_0x2f63('0x33')](_0x2f63('0xb4'),_0x4a2426[_0x2f63('0x3e')],_0x4a2426['origtransferercalleridnum'],_0x4a2426[_0x2f63('0xb5')]);logger['debug'](_0x2f63('0xb6'),_0x4a2426[_0x2f63('0x3e')],util[_0x2f63('0x37')](_0x4a2426,{'showHidden':![],'depth':null}));if(this[_0x2f63('0x1d')][_0x4a2426[_0x2f63('0xb7')]]){this['channels'][_0x4a2426[_0x2f63('0xb7')]][_0x2f63('0xb8')]=_0x4a2426[_0x2f63('0xb9')];this[_0x2f63('0x1d')][_0x4a2426[_0x2f63('0xb7')]]['transferconnectedlinenum']=_0x4a2426[_0x2f63('0xb5')];if(this['channels'][_0x4a2426[_0x2f63('0xba')]]){var _0x475717=this['channels'][_0x4a2426['secondtransfereruniqueid']];this[_0x2f63('0x1d')][_0x4a2426[_0x2f63('0xba')]]=this[_0x2f63('0x1d')][_0x4a2426[_0x2f63('0xb7')]];this[_0x2f63('0x1d')][_0x4a2426[_0x2f63('0xb7')]]=_0x475717;}}else if(this[_0x2f63('0x1d')][_0x4a2426['transfertargetuniqueid']]){this[_0x2f63('0x1d')][_0x4a2426['transfertargetuniqueid']]['transfercalleridnum']=_0x4a2426[_0x2f63('0xb9')];this[_0x2f63('0x1d')][_0x4a2426['transfertargetuniqueid']][_0x2f63('0xbb')]=_0x4a2426['transfertargetcalleridnum'];if(this[_0x2f63('0x1d')][_0x4a2426[_0x2f63('0xbc')]]){var _0x475717=this[_0x2f63('0x1d')][_0x4a2426[_0x2f63('0xbc')]];this[_0x2f63('0x1d')][_0x4a2426[_0x2f63('0xbc')]]=this[_0x2f63('0x1d')][_0x4a2426[_0x2f63('0xbd')]];this[_0x2f63('0x1d')][_0x4a2426[_0x2f63('0xbd')]]=_0x475717;}}if((this[_0x2f63('0x1d')][_0x4a2426[_0x2f63('0xbc')]]||this[_0x2f63('0x1d')][_0x4a2426[_0x2f63('0xbe')]])&&this[_0x2f63('0x1d')][_0x4a2426['secondtransfereruniqueid']]){var _0x770b8d=_[_0x2f63('0xbf')]([this[_0x2f63('0x1d')][_0x4a2426['origtransfereruniqueid']],this[_0x2f63('0x1d')][_0x4a2426[_0x2f63('0xbe')]],this[_0x2f63('0x1d')][_0x4a2426[_0x2f63('0xba')]]],function(_0xc298c){return _0xc298c&&_0xc298c['type']===_0x2f63('0xb1')&&_0xc298c[_0x2f63('0xc0')];});if(_0x770b8d){if(this[_0x2f63('0x1d')][_0x4a2426[_0x2f63('0xbc')]])this[_0x2f63('0x1d')][_0x4a2426[_0x2f63('0xbc')]][_0x2f63('0xa4')]=_0x2f63('0xc1');if(this[_0x2f63('0x1d')][_0x4a2426[_0x2f63('0xbe')]])this['channels'][_0x4a2426[_0x2f63('0xbe')]][_0x2f63('0xa4')]=_0x2f63('0xc1');this[_0x2f63('0x1d')][_0x4a2426['secondtransfereruniqueid']][_0x2f63('0xa4')]=_0x2f63('0xc1');}}}}catch(_0x44fe5f){logger[_0x2f63('0x35')](_0x2f63('0xc2'),_0x4a2426[_0x2f63('0x3e')],util[_0x2f63('0x37')](_0x44fe5f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2f63('0x38')]['syncBlindTransfer']=function(_0x1b7bcd){try{if(this[_0x2f63('0x39')](_0x1b7bcd)){logger['info']('[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x1b7bcd[_0x2f63('0x3e')],_0x1b7bcd[_0x2f63('0xc3')],_0x1b7bcd[_0x2f63('0xc4')]);logger[_0x2f63('0x41')]('[%s][voiceCallReport][blindtransfer]\x20event:',_0x1b7bcd[_0x2f63('0x3e')],util['inspect'](_0x1b7bcd,{'showHidden':![],'depth':null}));if(this['channels'][_0x1b7bcd[_0x2f63('0xb7')]]){this['channels'][_0x1b7bcd[_0x2f63('0xb7')]]['transfercalleridnum']=_0x1b7bcd[_0x2f63('0xc3')];this['channels'][_0x1b7bcd[_0x2f63('0xb7')]][_0x2f63('0xbb')]=_0x1b7bcd[_0x2f63('0xc4')];this['channels'][_0x1b7bcd[_0x2f63('0xb7')]][_0x2f63('0xa4')]=_0x2f63('0xc5');this[_0x2f63('0x2a')]({'event':'BlindTransfer','uniqueid':_0x1b7bcd[_0x2f63('0xb7')],'context':_0x1b7bcd[_0x2f63('0x47')],'channel':_0x1b7bcd[_0x2f63('0xc6')]});}else{this[_0x2f63('0x1d')][_0x1b7bcd[_0x2f63('0xc7')]][_0x2f63('0xa4')]=_0x2f63('0xc5');}}}catch(_0x2d0589){logger['error'](_0x2f63('0xc8'),_0x1b7bcd[_0x2f63('0x3e')],util[_0x2f63('0x37')](_0x2d0589,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2f63('0x38')][_0x2f63('0x30')]=function(_0x3c15fb){try{if(this[_0x2f63('0x39')](_0x3c15fb)){logger[_0x2f63('0x41')](_0x2f63('0xc9'),_0x3c15fb[_0x2f63('0x3e')],util[_0x2f63('0x37')](_0x3c15fb,{'showHidden':![],'depth':null}));if(this[_0x2f63('0x1d')][_0x3c15fb[_0x2f63('0x3e')]]){if(!_[_0x2f63('0x7d')](this[_0x2f63('0x1d')][_0x3c15fb[_0x2f63('0x3e')]][_0x2f63('0x6d')])){this[_0x2f63('0x1d')][_0x3c15fb[_0x2f63('0x3e')]]['mohstarttime']=moment()[_0x2f63('0x4e')](_0x2f63('0x57'));logger['info'](_0x2f63('0xca'),_0x3c15fb[_0x2f63('0x3e')],this[_0x2f63('0x1d')][_0x3c15fb[_0x2f63('0x3e')]][_0x2f63('0xcb')]);}}}}catch(_0x2a1071){logger[_0x2f63('0x35')](_0x2f63('0xcc'),_0x3c15fb[_0x2f63('0x3e')],util[_0x2f63('0x37')](_0x2a1071,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x2f63('0x38')][_0x2f63('0x32')]=function(_0x36dd82){try{if(this[_0x2f63('0x39')](_0x36dd82)){logger['debug']('[%s][voiceCallReport][musiconholdstop]\x20event:',_0x36dd82[_0x2f63('0x3e')],util['inspect'](_0x36dd82,{'showHidden':![],'depth':null}));if(this[_0x2f63('0x1d')][_0x36dd82[_0x2f63('0x3e')]]){if(!_[_0x2f63('0x7d')](this[_0x2f63('0x1d')][_0x36dd82['uniqueid']][_0x2f63('0xcb')])){this['channels'][_0x36dd82['uniqueid']][_0x2f63('0xcd')]+=moment()['milliseconds'](0x0)[_0x2f63('0x9e')](this['channels'][_0x36dd82[_0x2f63('0x3e')]][_0x2f63('0xcb')],_0x2f63('0x65'));logger[_0x2f63('0x33')]('[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s',_0x36dd82[_0x2f63('0x3e')],this[_0x2f63('0x1d')][_0x36dd82[_0x2f63('0x3e')]][_0x2f63('0xcd')]);delete this['channels'][_0x36dd82[_0x2f63('0x3e')]]['mohstarttime'];}}}}catch(_0x5aefe4){logger['error'](_0x2f63('0xce'),_0x36dd82['uniqueid'],util[_0x2f63('0x37')](_0x5aefe4,{'showHidden':![],'depth':null}));}};module[_0x2f63('0xcf')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index def2f61..ca0eeb5 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 _0x2ff3=['cause-txt','endtime','starttime','complete','answertime','answered','holdtime','diff','seconds','billableseconds','sumHoldTime','sumBillable','sumDuration','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','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','linkedid','[%s][voiceDialReport][hangup]','[%s][voiceDialReport][newexten]\x20event:','application','toLowerCase','set','applicationdata','appdata','startsWith','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','split','match','[%s][voiceDialReport][newexten]','lodash','ioredis','redis','defaults','outboundChannels','outbound','applications','syncDialBegin','syncDialEnd','bind','varset','syncVarSet','newexten','syncNewExten','hangup','syncHangup','prototype','isUndefined','emit','isNotNull','debug','uniqueid','inspect','channels','called','channel','lastIndexOf','substring','omit','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','merge','voice:outbound','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','[%s][voiceDialReport][dialbegin]','dialstatus','ANSWER','connectedlinenum','connectedlinename','format','lastevent','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','voice_outbound_channel:save','error','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','keys','variable','value','variables','voice','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','outboundrouteid','[%s][voiceDialReport][varset]','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberrealtime','isNil','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete'];(function(_0x506d2f,_0x5ab76e){var _0x101255=function(_0x1596b1){while(--_0x1596b1){_0x506d2f['push'](_0x506d2f['shift']());}};_0x101255(++_0x5ab76e);}(_0x2ff3,0x96));var _0x32ff=function(_0x4c5b27,_0x11d5bd){_0x4c5b27=_0x4c5b27-0x0;var _0x5ed1ee=_0x2ff3[_0x4c5b27];return _0x5ed1ee;};'use strict';var _=require(_0x32ff('0x0'));var moment=require('moment');var util=require('util');var Redis=require(_0x32ff('0x1'));var config=require('../../../config/environment');var logger=require('../../../config/logger')('ami');var ami=require('../ami');config[_0x32ff('0x2')]=_[_0x32ff('0x3')](config[_0x32ff('0x2')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x32ff('0x2')]));function VoiceDialReport(_0x3ee1ce){this['channels']=_0x3ee1ce[_0x32ff('0x4')];this[_0x32ff('0x5')]=_0x3ee1ce[_0x32ff('0x5')];this[_0x32ff('0x6')]={};this['variables']={};ami['on']('dialbegin',this[_0x32ff('0x7')]['bind'](this));ami['on']('dialend',this[_0x32ff('0x8')][_0x32ff('0x9')](this));ami['on'](_0x32ff('0xa'),this[_0x32ff('0xb')][_0x32ff('0x9')](this));ami['on'](_0x32ff('0xc'),this[_0x32ff('0xd')][_0x32ff('0x9')](this));ami['on'](_0x32ff('0xe'),this[_0x32ff('0xf')][_0x32ff('0x9')](this));}VoiceDialReport[_0x32ff('0x10')]['isNotNull']=function(_0x9a364d){return _0x9a364d!==null&&!_[_0x32ff('0x11')](_0x9a364d);};VoiceDialReport[_0x32ff('0x10')]['emit']=function(_0x3b9b87,_0x273572,_0x587b7a){io['to'](_0x3b9b87)[_0x32ff('0x12')](_0x273572,_0x587b7a);};VoiceDialReport['prototype'][_0x32ff('0x7')]=function(_0x2eb9f3){try{if(this[_0x32ff('0x13')](_0x2eb9f3)){logger[_0x32ff('0x14')]('[%s][voiceDialReport][dialbegin]\x20event:',_0x2eb9f3[_0x32ff('0x15')],util[_0x32ff('0x16')](_0x2eb9f3,{'showHidden':![],'depth':null}));if(this[_0x32ff('0x17')][_0x2eb9f3[_0x32ff('0x15')]]){_['merge'](this['channels'][_0x2eb9f3[_0x32ff('0x15')]],{'starttime':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0x32ff('0x18'),'interface':_0x2eb9f3[_0x32ff('0x19')]['substring'](0x0,_0x2eb9f3[_0x32ff('0x19')][_0x32ff('0x1a')]('-')),'membername':_0x2eb9f3[_0x32ff('0x19')][_0x32ff('0x1b')](_0x2eb9f3[_0x32ff('0x19')][_0x32ff('0x1a')]('/')+0x1,_0x2eb9f3[_0x32ff('0x19')][_0x32ff('0x1a')]('-'))},_[_0x32ff('0x1c')](_0x2eb9f3,['event',_0x32ff('0x1d')]));logger[_0x32ff('0x1e')](_0x32ff('0x1f'),_0x2eb9f3[_0x32ff('0x15')],this['channels'][_0x2eb9f3['uniqueid']][_0x32ff('0x20')],this[_0x32ff('0x17')][_0x2eb9f3[_0x32ff('0x15')]][_0x32ff('0x21')]);logger[_0x32ff('0x14')]('[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:',_0x2eb9f3[_0x32ff('0x15')],util[_0x32ff('0x16')](this['channels'][_0x2eb9f3[_0x32ff('0x15')]],{'showHidden':![],'depth':null}));if(this['applications'][_0x2eb9f3['uniqueid']])_[_0x32ff('0x22')](this['channels'][_0x2eb9f3[_0x32ff('0x15')]],this[_0x32ff('0x6')][_0x2eb9f3['uniqueid']]);this[_0x32ff('0x12')](_0x32ff('0x23'),'voice_outbound_channel:save',this['channels'][_0x2eb9f3['uniqueid']]);logger[_0x32ff('0x14')](_0x32ff('0x24'),_0x2eb9f3['uniqueid'],util[_0x32ff('0x16')](this[_0x32ff('0x17')][_0x2eb9f3[_0x32ff('0x15')]],{'showHidden':![],'depth':null}));ami[_0x32ff('0x12')]('custom:dialbegin',this[_0x32ff('0x17')][_0x2eb9f3[_0x32ff('0x15')]]);}}}catch(_0x52409c){logger['error'](_0x32ff('0x25'),_0x2eb9f3['uniqueid'],util[_0x32ff('0x16')](_0x52409c,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['syncDialEnd']=function(_0x4cb949){try{if(this[_0x32ff('0x13')](_0x4cb949)){logger[_0x32ff('0x14')]('[%s][voiceDialReport][dialend]\x20event:',_0x4cb949['uniqueid'],util['inspect'](_0x4cb949,{'showHidden':![],'depth':null}));if(this[_0x32ff('0x17')][_0x4cb949[_0x32ff('0x15')]]){this['channels'][_0x4cb949[_0x32ff('0x15')]][_0x32ff('0x26')]=_0x4cb949[_0x32ff('0x26')];if(_0x4cb949[_0x32ff('0x26')]===_0x32ff('0x27')){this[_0x32ff('0x17')][_0x4cb949[_0x32ff('0x15')]]['connectedlinenum']=_0x4cb949[_0x32ff('0x28')];this[_0x32ff('0x17')][_0x4cb949[_0x32ff('0x15')]]['connectedlinename']=_0x4cb949[_0x32ff('0x29')];this['channels'][_0x4cb949[_0x32ff('0x15')]]['answertime']=moment()[_0x32ff('0x2a')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x4cb949[_0x32ff('0x15')]][_0x32ff('0x2b')]=_0x32ff('0x2c');logger[_0x32ff('0x1e')](_0x32ff('0x2d'),_0x4cb949[_0x32ff('0x15')],_0x4cb949[_0x32ff('0x19')]['substring'](_0x4cb949[_0x32ff('0x19')][_0x32ff('0x1a')]('/')+0x1,_0x4cb949['channel'][_0x32ff('0x1a')]('-')));logger[_0x32ff('0x14')](_0x32ff('0x2e'),_0x4cb949[_0x32ff('0x15')],util[_0x32ff('0x16')](this[_0x32ff('0x17')][_0x4cb949[_0x32ff('0x15')]],{'showHidden':![],'depth':null}));ami[_0x32ff('0x12')]('custom:dialconnect',this[_0x32ff('0x17')][_0x4cb949[_0x32ff('0x15')]]);}logger[_0x32ff('0x14')]('[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:',_0x4cb949[_0x32ff('0x15')],util[_0x32ff('0x16')](this[_0x32ff('0x17')][_0x4cb949[_0x32ff('0x15')]],{'showHidden':![],'depth':null}));this[_0x32ff('0x12')](_0x32ff('0x23'),_0x32ff('0x2f'),this[_0x32ff('0x17')][_0x4cb949[_0x32ff('0x15')]]);}}}catch(_0x2f474f){logger[_0x32ff('0x30')](_0x32ff('0x31'),_0x4cb949[_0x32ff('0x15')],util['inspect'](_0x2f474f,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x32ff('0x10')][_0x32ff('0xb')]=function(_0x267784){try{if(this[_0x32ff('0x13')](_0x267784)){logger[_0x32ff('0x14')](_0x32ff('0x32'),_0x267784[_0x32ff('0x15')],util['inspect'](_0x267784,{'showHidden':![],'depth':null}));this['addVariable'](_0x267784['uniqueid'],_[_0x32ff('0x33')](_0x267784[_0x32ff('0x34')])[0x0],_0x267784[_0x32ff('0x35')]);if(this[_0x32ff('0x13')](_0x267784['variable'])&&this[_0x32ff('0x13')](_0x267784['variable']['outboundrouteid'])){if(_['isUndefined'](this[_0x32ff('0x17')][_0x267784[_0x32ff('0x15')]])){this[_0x32ff('0x17')][_0x267784['uniqueid']]={'routeId':_0x267784[_0x32ff('0x35')],'variables':this[_0x32ff('0x36')][_0x267784[_0x32ff('0x15')]],'motionChannel':_0x32ff('0x37')};logger[_0x32ff('0x1e')](_0x32ff('0x38'),_0x267784[_0x32ff('0x15')],_0x267784[_0x32ff('0x34')][_0x32ff('0x39')],_[_0x32ff('0x33')](_0x267784['variable'])[0x0],_0x267784['value']);logger[_0x32ff('0x14')]('[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:',_0x267784['uniqueid'],util['inspect'](this[_0x32ff('0x17')][_0x267784['uniqueid']],{'showHidden':![],'depth':null}));this[_0x32ff('0x12')](_0x32ff('0x23'),_0x32ff('0x2f'),this[_0x32ff('0x17')][_0x267784[_0x32ff('0x15')]]);}}}}catch(_0x4551b9){logger['error'](_0x32ff('0x3a'),_0x267784['uniqueid'],util[_0x32ff('0x16')](_0x4551b9,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x32ff('0x10')][_0x32ff('0x3b')]=function(_0x4c3eea,_0x165999,_0x561264){var _0x312079=[_0x32ff('0x3c'),_0x32ff('0x3d'),_0x32ff('0x3e'),'rtpaudioqosjitterbridged',_0x32ff('0x3f'),_0x32ff('0x40'),_0x32ff('0x41'),_0x32ff('0x42'),_0x32ff('0x43'),_0x32ff('0x44'),_0x32ff('0x45'),_0x32ff('0x46'),_0x32ff('0x47'),'memberdynamic','memberinterface','memberlastcall',_0x32ff('0x20'),'memberpenalty',_0x32ff('0x48')];if(!_[_0x32ff('0x49')](_0x165999)&&!_['includes'](_0x312079,_0x165999)){if(_[_0x32ff('0x11')](this[_0x32ff('0x36')][_0x4c3eea])){this['variables'][_0x4c3eea]={};}this[_0x32ff('0x36')][_0x4c3eea][_0x165999]=_0x561264;}};VoiceDialReport[_0x32ff('0x10')][_0x32ff('0xf')]=function(_0x429d18){try{if(this['isNotNull'](_0x429d18)){logger[_0x32ff('0x14')](_0x32ff('0x4a'),_0x429d18[_0x32ff('0x15')],util[_0x32ff('0x16')](_0x429d18,{'showHidden':![],'depth':null}));if(this[_0x32ff('0x17')][_0x429d18[_0x32ff('0x15')]]){logger[_0x32ff('0x1e')](_0x32ff('0x4b'),_0x429d18[_0x32ff('0x15')],_0x429d18[_0x32ff('0x4c')]);this['channels'][_0x429d18[_0x32ff('0x15')]][_0x32ff('0x4d')]=moment()[_0x32ff('0x2a')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x429d18[_0x32ff('0x15')]]['duration']=moment(this[_0x32ff('0x17')][_0x429d18[_0x32ff('0x15')]][_0x32ff('0x4d')])['diff'](this['channels'][_0x429d18[_0x32ff('0x15')]][_0x32ff('0x4e')],'seconds');this['channels'][_0x429d18['uniqueid']][_0x32ff('0x2b')]=_0x32ff('0x4f');this[_0x32ff('0x5')]['total']+=0x1;if(this[_0x32ff('0x17')][_0x429d18[_0x32ff('0x15')]][_0x32ff('0x50')]){this[_0x32ff('0x5')][_0x32ff('0x51')]+=0x1;this[_0x32ff('0x17')][_0x429d18[_0x32ff('0x15')]][_0x32ff('0x52')]=moment(this['channels'][_0x429d18[_0x32ff('0x15')]]['answertime'])[_0x32ff('0x53')](this['channels'][_0x429d18['uniqueid']][_0x32ff('0x4e')],_0x32ff('0x54'));this[_0x32ff('0x17')][_0x429d18['uniqueid']][_0x32ff('0x55')]=moment(this[_0x32ff('0x17')][_0x429d18[_0x32ff('0x15')]][_0x32ff('0x4d')])[_0x32ff('0x53')](this[_0x32ff('0x17')][_0x429d18[_0x32ff('0x15')]][_0x32ff('0x50')],_0x32ff('0x54'));this[_0x32ff('0x5')][_0x32ff('0x56')]+=this[_0x32ff('0x17')][_0x429d18[_0x32ff('0x15')]][_0x32ff('0x52')]||0x0;this[_0x32ff('0x5')][_0x32ff('0x57')]+=this[_0x32ff('0x17')][_0x429d18['uniqueid']][_0x32ff('0x55')];}this[_0x32ff('0x5')][_0x32ff('0x58')]+=this[_0x32ff('0x17')][_0x429d18['uniqueid']][_0x32ff('0x59')];logger['debug'](_0x32ff('0x5a'),_0x429d18[_0x32ff('0x15')],util['inspect'](this[_0x32ff('0x17')][_0x429d18[_0x32ff('0x15')]],{'showHidden':![],'depth':null}));ami[_0x32ff('0x12')](_0x32ff('0x5b'),this['channels'][_0x429d18[_0x32ff('0x15')]]);logger[_0x32ff('0x14')](_0x32ff('0x5c'),_0x429d18[_0x32ff('0x15')],util[_0x32ff('0x16')](this[_0x32ff('0x17')][_0x429d18[_0x32ff('0x15')]],{'showHidden':![],'depth':null}));ami[_0x32ff('0x12')](_0x32ff('0x5d'),this[_0x32ff('0x17')][_0x429d18[_0x32ff('0x15')]]);logger[_0x32ff('0x14')](_0x32ff('0x5e'),_0x429d18[_0x32ff('0x15')],util['inspect'](this[_0x32ff('0x17')][_0x429d18[_0x32ff('0x15')]],{'showHidden':![],'depth':null}));this['emit']('voice:outbound',_0x32ff('0x5f'),this[_0x32ff('0x5')]);logger[_0x32ff('0x1e')](_0x32ff('0x60'),JSON[_0x32ff('0x61')](this[_0x32ff('0x17')][_0x429d18[_0x32ff('0x15')]]));logger[_0x32ff('0x14')](_0x32ff('0x62'),_0x429d18[_0x32ff('0x15')],util[_0x32ff('0x16')](this[_0x32ff('0x17')][_0x429d18[_0x32ff('0x15')]],{'showHidden':![],'depth':null}));this['emit'](_0x32ff('0x23'),'voice_outbound_channel:remove',this[_0x32ff('0x17')][_0x429d18['uniqueid']]);delete this[_0x32ff('0x17')][_0x429d18[_0x32ff('0x15')]];}else if(this[_0x32ff('0x17')][_0x429d18[_0x32ff('0x63')]]){this[_0x32ff('0x17')][_0x429d18[_0x32ff('0x63')]][_0x32ff('0x15')]=this[_0x32ff('0x17')][_0x429d18[_0x32ff('0x63')]]['destuniqueid'];}if(this[_0x32ff('0x36')][_0x429d18[_0x32ff('0x15')]]){delete this['variables'][_0x429d18[_0x32ff('0x15')]];}}}catch(_0x4d56f7){logger['error'](_0x32ff('0x64'),_0x429d18['uniqueid'],util['inspect'](_0x4d56f7,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x32ff('0x10')][_0x32ff('0xd')]=function(_0x1e1087){try{if(this[_0x32ff('0x13')](_0x1e1087)){logger[_0x32ff('0x14')](_0x32ff('0x65'),_0x1e1087['uniqueid'],util['inspect'](_0x1e1087,{'showHidden':![],'depth':null}));if(_0x1e1087[_0x32ff('0x66')][_0x32ff('0x67')]()===_0x32ff('0x68')){_0x1e1087[_0x32ff('0x69')]=(_0x1e1087[_0x32ff('0x6a')]||_0x1e1087[_0x32ff('0x69')])[_0x32ff('0x67')]();if(_[_0x32ff('0x6b')](_0x1e1087[_0x32ff('0x69')],_0x32ff('0x6c'))){if(_['isUndefined'](this[_0x32ff('0x6')][_0x1e1087[_0x32ff('0x15')]]))this['applications'][_0x1e1087[_0x32ff('0x15')]]={};logger['info'](_0x32ff('0x6d'),_0x1e1087[_0x32ff('0x15')],_0x1e1087[_0x32ff('0x66')],_0x1e1087[_0x32ff('0x69')]);var _0x1251ec=_0x1e1087[_0x32ff('0x69')][_0x32ff('0x6e')]('=');var _0x5ee454=_0x1251ec[0x0][_0x32ff('0x6f')](/cdr\((.*)\)/);if(_0x5ee454)this[_0x32ff('0x6')][_0x1e1087['uniqueid']][_0x5ee454[0x1]]=_0x1251ec[0x1];}}}}catch(_0x38987a){logger[_0x32ff('0x30')](_0x32ff('0x70'),_0x1e1087[_0x32ff('0x15')],util[_0x32ff('0x16')](_0x38987a,{'showHidden':![],'depth':null}));}};module['exports']=VoiceDialReport; \ No newline at end of file +var _0x9287=['syncHangup','prototype','isNotNull','isUndefined','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','merge','called','channel','substring','lastIndexOf','event','privilege','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','applications','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','format','YYYY-MM-DD\x20HH:mm:ss','lastevent','connect','info','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable','value','outboundrouteid','variables','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','[%s][voiceDialReport][varset]','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberpenalty','isNil','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','diff','seconds','complete','total','answered','holdtime','billableseconds','sumHoldTime','sumBillable','sumDuration','duration','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','syncNewExten','[%s][voiceDialReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','split','match','[%s][voiceDialReport][newexten]','exports','lodash','moment','util','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','outbound','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','varset','syncVarSet','newexten','hangup'];(function(_0x5c6994,_0x19ad9a){var _0x1d5c84=function(_0x4a385a){while(--_0x4a385a){_0x5c6994['push'](_0x5c6994['shift']());}};_0x1d5c84(++_0x19ad9a);}(_0x9287,0x1ca));var _0x7928=function(_0x123ff8,_0x2b9a42){_0x123ff8=_0x123ff8-0x0;var _0x2d8b5e=_0x9287[_0x123ff8];return _0x2d8b5e;};'use strict';var _=require(_0x7928('0x0'));var moment=require(_0x7928('0x1'));var util=require(_0x7928('0x2'));var Redis=require('ioredis');var config=require(_0x7928('0x3'));var logger=require(_0x7928('0x4'))(_0x7928('0x5'));var ami=require(_0x7928('0x6'));config[_0x7928('0x7')]=_[_0x7928('0x8')](config['redis'],{'host':_0x7928('0x9'),'port':0x18eb});var io=require(_0x7928('0xa'))(new Redis(config[_0x7928('0x7')]));function VoiceDialReport(_0x56220b){this[_0x7928('0xb')]=_0x56220b['outboundChannels'];this[_0x7928('0xc')]=_0x56220b[_0x7928('0xc')];this['applications']={};this['variables']={};ami['on'](_0x7928('0xd'),this[_0x7928('0xe')][_0x7928('0xf')](this));ami['on'](_0x7928('0x10'),this[_0x7928('0x11')][_0x7928('0xf')](this));ami['on'](_0x7928('0x12'),this[_0x7928('0x13')][_0x7928('0xf')](this));ami['on'](_0x7928('0x14'),this['syncNewExten'][_0x7928('0xf')](this));ami['on'](_0x7928('0x15'),this[_0x7928('0x16')][_0x7928('0xf')](this));}VoiceDialReport[_0x7928('0x17')][_0x7928('0x18')]=function(_0x4404df){return _0x4404df!==null&&!_[_0x7928('0x19')](_0x4404df);};VoiceDialReport[_0x7928('0x17')][_0x7928('0x1a')]=function(_0x36c8f6,_0xa36d54,_0x328bbd){io['to'](_0x36c8f6)['emit'](_0xa36d54,_0x328bbd);};VoiceDialReport[_0x7928('0x17')][_0x7928('0xe')]=function(_0x618206){try{if(this[_0x7928('0x18')](_0x618206)){logger[_0x7928('0x1b')](_0x7928('0x1c'),_0x618206[_0x7928('0x1d')],util[_0x7928('0x1e')](_0x618206,{'showHidden':![],'depth':null}));if(this[_0x7928('0xb')][_0x618206[_0x7928('0x1d')]]){_[_0x7928('0x1f')](this[_0x7928('0xb')][_0x618206[_0x7928('0x1d')]],{'starttime':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0x7928('0x20'),'interface':_0x618206[_0x7928('0x21')][_0x7928('0x22')](0x0,_0x618206[_0x7928('0x21')]['lastIndexOf']('-')),'membername':_0x618206['channel']['substring'](_0x618206[_0x7928('0x21')][_0x7928('0x23')]('/')+0x1,_0x618206[_0x7928('0x21')]['lastIndexOf']('-'))},_['omit'](_0x618206,[_0x7928('0x24'),_0x7928('0x25')]));logger['info'](_0x7928('0x26'),_0x618206[_0x7928('0x1d')],this['channels'][_0x618206[_0x7928('0x1d')]]['membername'],this[_0x7928('0xb')][_0x618206[_0x7928('0x1d')]]['interface']);logger['debug'](_0x7928('0x27'),_0x618206[_0x7928('0x1d')],util[_0x7928('0x1e')](this[_0x7928('0xb')][_0x618206['uniqueid']],{'showHidden':![],'depth':null}));if(this[_0x7928('0x28')][_0x618206[_0x7928('0x1d')]])_[_0x7928('0x1f')](this[_0x7928('0xb')][_0x618206[_0x7928('0x1d')]],this[_0x7928('0x28')][_0x618206[_0x7928('0x1d')]]);this[_0x7928('0x1a')]('voice:outbound',_0x7928('0x29'),this['channels'][_0x618206[_0x7928('0x1d')]]);logger[_0x7928('0x1b')](_0x7928('0x2a'),_0x618206[_0x7928('0x1d')],util[_0x7928('0x1e')](this[_0x7928('0xb')][_0x618206[_0x7928('0x1d')]],{'showHidden':![],'depth':null}));ami[_0x7928('0x1a')](_0x7928('0x2b'),this[_0x7928('0xb')][_0x618206[_0x7928('0x1d')]]);}}}catch(_0x2f6771){logger[_0x7928('0x2c')](_0x7928('0x2d'),_0x618206['uniqueid'],util[_0x7928('0x1e')](_0x2f6771,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x7928('0x11')]=function(_0x90896c){try{if(this['isNotNull'](_0x90896c)){logger['debug'](_0x7928('0x2e'),_0x90896c[_0x7928('0x1d')],util[_0x7928('0x1e')](_0x90896c,{'showHidden':![],'depth':null}));if(this[_0x7928('0xb')][_0x90896c[_0x7928('0x1d')]]){this[_0x7928('0xb')][_0x90896c[_0x7928('0x1d')]][_0x7928('0x2f')]=_0x90896c[_0x7928('0x2f')];if(_0x90896c[_0x7928('0x2f')]===_0x7928('0x30')){this[_0x7928('0xb')][_0x90896c['uniqueid']][_0x7928('0x31')]=_0x90896c['connectedlinenum'];this[_0x7928('0xb')][_0x90896c[_0x7928('0x1d')]][_0x7928('0x32')]=_0x90896c[_0x7928('0x32')];this[_0x7928('0xb')][_0x90896c[_0x7928('0x1d')]][_0x7928('0x33')]=moment()[_0x7928('0x34')](_0x7928('0x35'));this['channels'][_0x90896c[_0x7928('0x1d')]][_0x7928('0x36')]=_0x7928('0x37');logger[_0x7928('0x38')](_0x7928('0x39'),_0x90896c[_0x7928('0x1d')],_0x90896c[_0x7928('0x21')][_0x7928('0x22')](_0x90896c[_0x7928('0x21')]['lastIndexOf']('/')+0x1,_0x90896c[_0x7928('0x21')][_0x7928('0x23')]('-')));logger[_0x7928('0x1b')](_0x7928('0x3a'),_0x90896c[_0x7928('0x1d')],util[_0x7928('0x1e')](this['channels'][_0x90896c[_0x7928('0x1d')]],{'showHidden':![],'depth':null}));ami['emit'](_0x7928('0x3b'),this['channels'][_0x90896c[_0x7928('0x1d')]]);}logger[_0x7928('0x1b')]('[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:',_0x90896c[_0x7928('0x1d')],util[_0x7928('0x1e')](this['channels'][_0x90896c['uniqueid']],{'showHidden':![],'depth':null}));this[_0x7928('0x1a')]('voice:outbound',_0x7928('0x29'),this['channels'][_0x90896c[_0x7928('0x1d')]]);}}}catch(_0x5a97fd){logger[_0x7928('0x2c')](_0x7928('0x3c'),_0x90896c[_0x7928('0x1d')],util[_0x7928('0x1e')](_0x5a97fd,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x7928('0x17')][_0x7928('0x13')]=function(_0x5ccab8){try{if(this[_0x7928('0x18')](_0x5ccab8)){logger[_0x7928('0x1b')](_0x7928('0x3d'),_0x5ccab8[_0x7928('0x1d')],util[_0x7928('0x1e')](_0x5ccab8,{'showHidden':![],'depth':null}));this[_0x7928('0x3e')](_0x5ccab8[_0x7928('0x1d')],_[_0x7928('0x3f')](_0x5ccab8[_0x7928('0x40')])[0x0],_0x5ccab8[_0x7928('0x41')]);if(this[_0x7928('0x18')](_0x5ccab8[_0x7928('0x40')])&&this[_0x7928('0x18')](_0x5ccab8[_0x7928('0x40')][_0x7928('0x42')])){if(_[_0x7928('0x19')](this[_0x7928('0xb')][_0x5ccab8[_0x7928('0x1d')]])){this[_0x7928('0xb')][_0x5ccab8['uniqueid']]={'routeId':_0x5ccab8[_0x7928('0x41')],'variables':this[_0x7928('0x43')][_0x5ccab8['uniqueid']],'motionChannel':'voice'};logger['info'](_0x7928('0x44'),_0x5ccab8[_0x7928('0x1d')],_0x5ccab8[_0x7928('0x40')][_0x7928('0x42')],_[_0x7928('0x3f')](_0x5ccab8[_0x7928('0x40')])[0x0],_0x5ccab8[_0x7928('0x41')]);logger['debug'](_0x7928('0x45'),_0x5ccab8[_0x7928('0x1d')],util[_0x7928('0x1e')](this[_0x7928('0xb')][_0x5ccab8[_0x7928('0x1d')]],{'showHidden':![],'depth':null}));this[_0x7928('0x1a')](_0x7928('0x46'),_0x7928('0x29'),this[_0x7928('0xb')][_0x5ccab8['uniqueid']]);}}}}catch(_0x24c9ba){logger[_0x7928('0x2c')](_0x7928('0x47'),_0x5ccab8[_0x7928('0x1d')],util[_0x7928('0x1e')](_0x24c9ba,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x7928('0x3e')]=function(_0x177c38,_0x216cea,_0x4befed){var _0x3820ed=['rtpaudioqos',_0x7928('0x48'),_0x7928('0x49'),_0x7928('0x4a'),_0x7928('0x4b'),'rtpaudioqoslossbridged',_0x7928('0x4c'),_0x7928('0x4d'),_0x7928('0x4e'),_0x7928('0x4f'),_0x7928('0x50'),_0x7928('0x51'),_0x7928('0x52'),'memberdynamic','memberinterface','memberlastcall','membername',_0x7928('0x53'),'memberrealtime'];if(!_[_0x7928('0x54')](_0x216cea)&&!_['includes'](_0x3820ed,_0x216cea)){if(_[_0x7928('0x19')](this[_0x7928('0x43')][_0x177c38])){this[_0x7928('0x43')][_0x177c38]={};}this[_0x7928('0x43')][_0x177c38][_0x216cea]=_0x4befed;}};VoiceDialReport[_0x7928('0x17')][_0x7928('0x16')]=function(_0x39d8fe){try{if(this['isNotNull'](_0x39d8fe)){logger[_0x7928('0x1b')]('[%s][voiceDialReport][hangup]\x20event:',_0x39d8fe[_0x7928('0x1d')],util[_0x7928('0x1e')](_0x39d8fe,{'showHidden':![],'depth':null}));if(this[_0x7928('0xb')][_0x39d8fe[_0x7928('0x1d')]]){logger[_0x7928('0x38')](_0x7928('0x55'),_0x39d8fe[_0x7928('0x1d')],_0x39d8fe[_0x7928('0x56')]);this['channels'][_0x39d8fe[_0x7928('0x1d')]][_0x7928('0x57')]=moment()[_0x7928('0x34')](_0x7928('0x35'));this[_0x7928('0xb')][_0x39d8fe[_0x7928('0x1d')]]['duration']=moment(this[_0x7928('0xb')][_0x39d8fe[_0x7928('0x1d')]][_0x7928('0x57')])[_0x7928('0x58')](this[_0x7928('0xb')][_0x39d8fe[_0x7928('0x1d')]]['starttime'],_0x7928('0x59'));this[_0x7928('0xb')][_0x39d8fe[_0x7928('0x1d')]][_0x7928('0x36')]=_0x7928('0x5a');this[_0x7928('0xc')][_0x7928('0x5b')]+=0x1;if(this[_0x7928('0xb')][_0x39d8fe['uniqueid']][_0x7928('0x33')]){this[_0x7928('0xc')][_0x7928('0x5c')]+=0x1;this['channels'][_0x39d8fe[_0x7928('0x1d')]][_0x7928('0x5d')]=moment(this[_0x7928('0xb')][_0x39d8fe[_0x7928('0x1d')]][_0x7928('0x33')])['diff'](this[_0x7928('0xb')][_0x39d8fe[_0x7928('0x1d')]]['starttime'],'seconds');this[_0x7928('0xb')][_0x39d8fe['uniqueid']][_0x7928('0x5e')]=moment(this[_0x7928('0xb')][_0x39d8fe['uniqueid']][_0x7928('0x57')])[_0x7928('0x58')](this[_0x7928('0xb')][_0x39d8fe[_0x7928('0x1d')]]['answertime'],'seconds');this['outbound'][_0x7928('0x5f')]+=this[_0x7928('0xb')][_0x39d8fe[_0x7928('0x1d')]][_0x7928('0x5d')]||0x0;this[_0x7928('0xc')][_0x7928('0x60')]+=this[_0x7928('0xb')][_0x39d8fe[_0x7928('0x1d')]][_0x7928('0x5e')];}this[_0x7928('0xc')][_0x7928('0x61')]+=this[_0x7928('0xb')][_0x39d8fe[_0x7928('0x1d')]][_0x7928('0x62')];logger['debug']('[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:',_0x39d8fe[_0x7928('0x1d')],util[_0x7928('0x1e')](this[_0x7928('0xb')][_0x39d8fe[_0x7928('0x1d')]],{'showHidden':![],'depth':null}));ami[_0x7928('0x1a')]('custom:voiceDialReport',this[_0x7928('0xb')][_0x39d8fe[_0x7928('0x1d')]]);logger[_0x7928('0x1b')]('[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:',_0x39d8fe[_0x7928('0x1d')],util[_0x7928('0x1e')](this[_0x7928('0xb')][_0x39d8fe['uniqueid']],{'showHidden':![],'depth':null}));ami['emit'](_0x7928('0x63'),this[_0x7928('0xb')][_0x39d8fe[_0x7928('0x1d')]]);logger[_0x7928('0x1b')](_0x7928('0x64'),_0x39d8fe['uniqueid'],util[_0x7928('0x1e')](this[_0x7928('0xb')][_0x39d8fe[_0x7928('0x1d')]],{'showHidden':![],'depth':null}));this[_0x7928('0x1a')](_0x7928('0x46'),_0x7928('0x65'),this[_0x7928('0xc')]);logger['info'](_0x7928('0x66'),JSON[_0x7928('0x67')](this[_0x7928('0xb')][_0x39d8fe[_0x7928('0x1d')]]));logger[_0x7928('0x1b')](_0x7928('0x68'),_0x39d8fe[_0x7928('0x1d')],util[_0x7928('0x1e')](this[_0x7928('0xb')][_0x39d8fe[_0x7928('0x1d')]],{'showHidden':![],'depth':null}));this[_0x7928('0x1a')](_0x7928('0x46'),'voice_outbound_channel:remove',this[_0x7928('0xb')][_0x39d8fe[_0x7928('0x1d')]]);delete this[_0x7928('0xb')][_0x39d8fe['uniqueid']];}else if(this[_0x7928('0xb')][_0x39d8fe[_0x7928('0x69')]]){this[_0x7928('0xb')][_0x39d8fe[_0x7928('0x69')]][_0x7928('0x1d')]=this['channels'][_0x39d8fe['linkedid']][_0x7928('0x6a')];}if(this[_0x7928('0x43')][_0x39d8fe['uniqueid']]){delete this['variables'][_0x39d8fe[_0x7928('0x1d')]];}}}catch(_0x5ca055){logger[_0x7928('0x2c')](_0x7928('0x6b'),_0x39d8fe[_0x7928('0x1d')],util[_0x7928('0x1e')](_0x5ca055,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x7928('0x17')][_0x7928('0x6c')]=function(_0x18e535){try{if(this[_0x7928('0x18')](_0x18e535)){logger[_0x7928('0x1b')](_0x7928('0x6d'),_0x18e535[_0x7928('0x1d')],util['inspect'](_0x18e535,{'showHidden':![],'depth':null}));if(_0x18e535[_0x7928('0x6e')][_0x7928('0x6f')]()==='set'){_0x18e535[_0x7928('0x70')]=(_0x18e535[_0x7928('0x71')]||_0x18e535[_0x7928('0x70')])['toLowerCase']();if(_['startsWith'](_0x18e535[_0x7928('0x70')],_0x7928('0x72'))){if(_[_0x7928('0x19')](this['applications'][_0x18e535[_0x7928('0x1d')]]))this['applications'][_0x18e535[_0x7928('0x1d')]]={};logger['info'](_0x7928('0x73'),_0x18e535['uniqueid'],_0x18e535[_0x7928('0x6e')],_0x18e535[_0x7928('0x70')]);var _0x44225d=_0x18e535[_0x7928('0x70')][_0x7928('0x74')]('=');var _0x4ceeb0=_0x44225d[0x0][_0x7928('0x75')](/cdr\((.*)\)/);if(_0x4ceeb0)this[_0x7928('0x28')][_0x18e535[_0x7928('0x1d')]][_0x4ceeb0[0x1]]=_0x44225d[0x1];}}}}catch(_0x871635){logger[_0x7928('0x2c')](_0x7928('0x76'),_0x18e535[_0x7928('0x1d')],util[_0x7928('0x1e')](_0x871635,{'showHidden':![],'depth':null}));}};module[_0x7928('0x77')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 7c9f432..208119e 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 _0xe3db=['fullybooted','syncFullyBooted','newexten','syncNewExten','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','attendedtransfer','syncBlindTransfer','loopQueueShow','isEmpty','hasOwnProperty','originated','pTalking','waiting','queueStatusComplete','clearZombieChannels','switch','isNil','Action','status','channel','catch','No\x20such\x20channel','[%s][voiceQueueReport][checkChannel]','inspect','error','[%s][voiceQueueReport][checkQueueReport]','[%s][voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','clearqueuereport','emit','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','format','name','voice_queue_channel:save','voice_queue_presence:save','voice:queue:%s','voice_queue_channel:remove','voice_queue_presence:remove','emitVoiceQueueSummary','type','inbound','strategy','answered','available','loggedIn','sumBillable','sumDuration','sumHoldTime','total','unmanaged','Trunk','Interval','[voiceQueueReport][','voice_queue:save','isNotNull','isUndefined','[voiceQueueReport][queues]','loopQueueSummary','queuesummary','then','[voiceQueueReport][queuesummary]','[voiceQueueReport][queuesummary]\x20event:','queue','info','countBy','callers','loggedin','toNumber','talking','[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:','custom:queuesummary','[voiceQueueReport][queuesummarycomplete]\x20event:','[%s][voiceQueueReport][queuecallerjoin]','YYYY-MM-DD\x20HH:mm:ss','position','count','routealias','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','keys','push','emitVoiceQueueChannelSave','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercomplete','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','lastAssignedTo','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','queuecallerleaveAt','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','[%s][voiceQueueReport][queuecallerleave]','[%s][voiceQueueReport][agentconnect]','queuecallerexitreason','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','assigned','membername','queuecallerexit','queuecallerexitAt','transfer','reason','COMPLETED','toLowerCase','local/','linkedid','queuecallerjoinAt','add','seconds','FORWARDTRANSFER','FORWARD','transferexten','destexten','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','[%s][voiceQueueReport][agentcomplete]','[%s][voiceQueueReport][varset]','addVariable','variable','value','queuestatus','CONTINUE','TIMEOUT','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','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepvtcallid','memberinterface','memberlastcall','memberpenalty','[%s][voiceQueueReport][hangup]','length','diff','milliseconds','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','custom:voiceQueueReport','syncAttendedTransfer','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','ATTENDEDTRANSFER','transfertype','ATTENDED','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','BLINDTRANSFER','BLIND','extension','syncHangup','BlindTransfer','context','transfererchannel','[%s][voiceQueueReport][blindtransfer]','[%s][voiceQueueReport][musiconholdstart]','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','mohstarttime','syncMusicOnHoldStop','[%s][voiceQueueReport][musiconholdstop]','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','[%s][voiceQueueReport][newexten]\x20event:','set','appdata','startsWith','CDR(routeAlias)','applicationdata','cdr(','application','match','[%s][voiceQueueReport][newexten]','exports','lodash','moment','md5','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/queueReport','redis','defaults','localhost','prototype','enqueue','tail','sequence','queueReports','agents','channels','queueChannels','voiceQueues','flagQueueSummary','campaigns','variables','syncQueueSummary','bind','queuesummarycomplete','syncQueueSummaryComplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','syncAgentComplete','agentconnect','syncAgentConnect','varset','syncVarSet','hangup'];(function(_0x2c0b53,_0x397454){var _0x5e711c=function(_0x27816b){while(--_0x27816b){_0x2c0b53['push'](_0x2c0b53['shift']());}};_0x5e711c(++_0x397454);}(_0xe3db,0xc8));var _0xbe3d=function(_0x1f26d2,_0x2fcb27){_0x1f26d2=_0x1f26d2-0x0;var _0x357d20=_0xe3db[_0x1f26d2];return _0x357d20;};'use strict';var _=require(_0xbe3d('0x0'));var moment=require(_0xbe3d('0x1'));var util=require('util');var md5=require(_0xbe3d('0x2'));var Redis=require(_0xbe3d('0x3'));var config=require(_0xbe3d('0x4'));var logger=require(_0xbe3d('0x5'))(_0xbe3d('0x6'));var ami=require(_0xbe3d('0x7'));var QueueReport=require(_0xbe3d('0x8'));config[_0xbe3d('0x9')]=_[_0xbe3d('0xa')](config[_0xbe3d('0x9')],{'host':_0xbe3d('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbe3d('0x9')]));var Sequence=function(){};Sequence[_0xbe3d('0xc')][_0xbe3d('0xd')]=function(_0x37e7c0){this['tail']=this[_0xbe3d('0xe')]?this[_0xbe3d('0xe')]['finally'](_0x37e7c0):_0x37e7c0();};function VoiceQueueReport(_0x5eddd8){this[_0xbe3d('0xf')]=new Sequence();this[_0xbe3d('0x10')]={};this[_0xbe3d('0x11')]=_0x5eddd8[_0xbe3d('0x11')];this[_0xbe3d('0x12')]=_0x5eddd8[_0xbe3d('0x13')];this[_0xbe3d('0x14')]=_0x5eddd8[_0xbe3d('0x14')];this[_0xbe3d('0x15')]=!![];this[_0xbe3d('0x16')]=_0x5eddd8[_0xbe3d('0x16')];this[_0xbe3d('0x17')]={};ami['on']('queuesummary',this[_0xbe3d('0x18')][_0xbe3d('0x19')](this));ami['on'](_0xbe3d('0x1a'),this[_0xbe3d('0x1b')][_0xbe3d('0x19')](this));ami['on'](_0xbe3d('0x1c'),this[_0xbe3d('0x1d')][_0xbe3d('0x19')](this));ami['on'](_0xbe3d('0x1e'),this[_0xbe3d('0x1f')][_0xbe3d('0x19')](this));ami['on'](_0xbe3d('0x20'),this[_0xbe3d('0x21')][_0xbe3d('0x19')](this));ami['on']('agentcomplete',this[_0xbe3d('0x22')][_0xbe3d('0x19')](this));ami['on'](_0xbe3d('0x23'),this[_0xbe3d('0x24')][_0xbe3d('0x19')](this));ami['on'](_0xbe3d('0x25'),this[_0xbe3d('0x26')][_0xbe3d('0x19')](this));ami['on'](_0xbe3d('0x27'),this['syncHangup'][_0xbe3d('0x19')](this));ami['on'](_0xbe3d('0x28'),this[_0xbe3d('0x29')][_0xbe3d('0x19')](this));ami['on'](_0xbe3d('0x2a'),this[_0xbe3d('0x2b')][_0xbe3d('0x19')](this));ami['on'](_0xbe3d('0x2c'),this[_0xbe3d('0x2d')][_0xbe3d('0x19')](this));ami['on'](_0xbe3d('0x2e'),this['syncMusicOnHoldStop'][_0xbe3d('0x19')](this));ami['on'](_0xbe3d('0x2f'),this['syncAttendedTransfer'][_0xbe3d('0x19')](this));ami['on']('blindtransfer',this[_0xbe3d('0x30')][_0xbe3d('0x19')](this));this['loopQueueSummary']();this[_0xbe3d('0x31')]();}function clearChannels(_0x297595){if(!_[_0xbe3d('0x32')](_0x297595)){for(var _0x14c93a in _0x297595){if(_0x297595[_0xbe3d('0x33')](_0x14c93a)){delete _0x297595[_0x14c93a];}}}}function clearCampaigns(_0x29b928){if(!_[_0xbe3d('0x32')](_0x29b928)){for(var _0x6198e2 in _0x29b928){if(_0x29b928[_0xbe3d('0x33')](_0x6198e2)){_0x29b928[_0x6198e2]['originated']=0x0;}}}}function clearVoiceQueues(_0x14a7f1){if(!_['isEmpty'](_0x14a7f1)){for(var _0x2738c7 in _0x14a7f1){if(_0x14a7f1['hasOwnProperty'](_0x2738c7)){_0x14a7f1[_0x2738c7][_0xbe3d('0x34')]=0x0;_0x14a7f1[_0x2738c7]['talking']=0x0;_0x14a7f1[_0x2738c7][_0xbe3d('0x35')]=0x0;_0x14a7f1[_0x2738c7][_0xbe3d('0x36')]=0x0;_0x14a7f1[_0x2738c7][_0xbe3d('0x37')]=!![];}}}}function clearAgentBooked(_0xd349f1){if(!_[_0xbe3d('0x32')](_0xd349f1)){for(var _0x1921de in _0xd349f1){if(_0xd349f1[_0xbe3d('0x33')](_0x1921de)){_0xd349f1[_0x1921de]['unlockRR']=!![];}}}}VoiceQueueReport[_0xbe3d('0xc')][_0xbe3d('0x38')]=function(){var _0x4dd8be=this;for(var _0x5c2c24 in this[_0xbe3d('0x12')]){if(this[_0xbe3d('0x12')][_0xbe3d('0x33')](_0x5c2c24)&&!this[_0xbe3d('0x12')][_0x5c2c24][_0xbe3d('0x39')]){this[_0xbe3d('0xf')][_0xbe3d('0xd')](function(){if(!_[_0xbe3d('0x3a')](_0x4dd8be['channels'][_0x5c2c24])){return ami[_0xbe3d('0x3b')]({'action':_0xbe3d('0x3c'),'channel':_0x4dd8be[_0xbe3d('0x12')][_0x5c2c24][_0xbe3d('0x3d')]})[_0xbe3d('0x3e')](function(_0x569785){if(_0x569785['message']===_0xbe3d('0x3f')){setTimeout(function(){if(_0x4dd8be['channels'][_0x5c2c24]){delete _0x4dd8be['channels'][_0x5c2c24];logger['error'](_0xbe3d('0x40'),_0x5c2c24,util[_0xbe3d('0x41')](_0x569785,{'showHidden':![],'depth':null}));}if(_0x4dd8be[_0xbe3d('0x10')][_0x5c2c24]){delete _0x4dd8be['queueReports'][_0x5c2c24];logger[_0xbe3d('0x42')](_0xbe3d('0x43'),_0x5c2c24,util[_0xbe3d('0x41')](_0x569785,{'showHidden':![],'depth':null}));}if(_0x4dd8be['variables'][_0x5c2c24]){delete _0x4dd8be[_0xbe3d('0x17')][_0x5c2c24];logger[_0xbe3d('0x42')](_0xbe3d('0x44'),_0x5c2c24,util[_0xbe3d('0x41')](_0x569785,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0xbe3d('0xc')][_0xbe3d('0x29')]=function(){logger[_0xbe3d('0x42')](_0xbe3d('0x45'));clearChannels(this[_0xbe3d('0x12')]);this[_0xbe3d('0x46')](this[_0xbe3d('0x10')]);clearAgentBooked(this[_0xbe3d('0x11')]);clearVoiceQueues(this['voiceQueues']);clearCampaigns(this[_0xbe3d('0x16')]);};VoiceQueueReport[_0xbe3d('0xc')][_0xbe3d('0x46')]=function(_0x112f94){var _0x2f10fb=this;if(!_[_0xbe3d('0x32')](_0x112f94)){for(var _0x7427b2 in _0x112f94){if(_0x112f94[_0xbe3d('0x33')](_0x7427b2)){_0x2f10fb[_0xbe3d('0x47')](_0x112f94[_0x7427b2],_0xbe3d('0x48'));delete _0x112f94[_0x7427b2];}}}};VoiceQueueReport[_0xbe3d('0xc')][_0xbe3d('0x49')]=function(_0x26ff42,_0x548f4b,_0x21242a){io['to'](_0x26ff42)[_0xbe3d('0x49')](_0x548f4b,_0x21242a);};VoiceQueueReport[_0xbe3d('0xc')]['emitVoiceQueueChannelSave']=function(_0x913c9d,_0x2f6fe2){logger[_0xbe3d('0x4a')](_0xbe3d('0x4b')+_0x2f6fe2+_0xbe3d('0x4c'),_0x913c9d[_0xbe3d('0x4d')],util[_0xbe3d('0x41')](_0x913c9d,{'showHidden':![],'depth':null}));this[_0xbe3d('0x49')](util[_0xbe3d('0x4e')]('voice:queue:%s',_0x913c9d[_0xbe3d('0x4f')]),_0xbe3d('0x50'),_0x913c9d);io[_0xbe3d('0x49')](_0xbe3d('0x51'),_0x913c9d);};VoiceQueueReport[_0xbe3d('0xc')]['emitVoiceQueueChannelRemove']=function(_0x42ffbf,_0x49a663){logger[_0xbe3d('0x4a')]('[%s][voiceQueueReport]['+_0x49a663+']\x20sending\x20voice_queue_channel:remove\x20event:',_0x42ffbf[_0xbe3d('0x4d')],util[_0xbe3d('0x41')](_0x42ffbf,{'showHidden':![],'depth':null}));this[_0xbe3d('0x49')](util[_0xbe3d('0x4e')](_0xbe3d('0x52'),_0x42ffbf[_0xbe3d('0x4f')]),_0xbe3d('0x53'),_0x42ffbf);io['emit'](_0xbe3d('0x54'),_0x42ffbf);};VoiceQueueReport[_0xbe3d('0xc')][_0xbe3d('0x55')]=function(_0xad5c96,_0x59693d){if(_0xad5c96[_0xbe3d('0x56')]===_0xbe3d('0x57')){var _0x29453b={'id':_0xad5c96['id'],'name':_0xad5c96[_0xbe3d('0x4f')],'strategy':_0xad5c96[_0xbe3d('0x58')],'answered':_0xad5c96[_0xbe3d('0x59')],'available':_0xad5c96[_0xbe3d('0x5a')],'loggedIn':_0xad5c96[_0xbe3d('0x5b')],'pTalking':_0xad5c96[_0xbe3d('0x35')],'sumBillable':_0xad5c96[_0xbe3d('0x5c')],'sumDuration':_0xad5c96[_0xbe3d('0x5d')],'sumHoldTime':_0xad5c96[_0xbe3d('0x5e')]||0x0,'talking':_0xad5c96['talking'],'total':_0xad5c96[_0xbe3d('0x5f')],'type':_0xad5c96[_0xbe3d('0x56')],'unmanaged':_0xad5c96[_0xbe3d('0x60')],'abandoned':_0xad5c96['abandoned'],'waiting':_0xad5c96[_0xbe3d('0x36')]};if(_0xad5c96[_0xbe3d('0x61')]){_0x29453b[_0xbe3d('0x61')]={'id':_0xad5c96['Trunk']['id'],'name':_0xad5c96[_0xbe3d('0x61')][_0xbe3d('0x4f')],'active':_0xad5c96[_0xbe3d('0x61')]['active'],'callerid':_0xad5c96[_0xbe3d('0x61')]['callerid']};}if(_0xad5c96['Interval']){_0x29453b[_0xbe3d('0x62')]={'id':_0xad5c96[_0xbe3d('0x62')]['id'],'name':_0xad5c96[_0xbe3d('0x62')][_0xbe3d('0x4f')]};}var _0x1267c1=md5(JSON['stringify'](_0x29453b));if(_0xad5c96[_0xbe3d('0x2')]!==_0x1267c1){_0xad5c96[_0xbe3d('0x2')]=_0x1267c1;logger['debug'](_0xbe3d('0x63')+_0x59693d+']\x20sending\x20voice_queue:save\x20event:',util[_0xbe3d('0x41')](_0x29453b,{'showHidden':![],'depth':null}));this[_0xbe3d('0x49')](util['format'](_0xbe3d('0x52'),_0x29453b[_0xbe3d('0x4f')]),_0xbe3d('0x64'),_0x29453b);}}};VoiceQueueReport[_0xbe3d('0xc')][_0xbe3d('0x65')]=function(_0x22cea4){return _0x22cea4!==null&&!_[_0xbe3d('0x66')](_0x22cea4);};VoiceQueueReport['prototype'][_0xbe3d('0x31')]=function(){var _0x37b4ab=this;setInterval(function(){_0x37b4ab[_0xbe3d('0x38')]();ami[_0xbe3d('0x3b')]({'action':'queues'})[_0xbe3d('0x3e')](function(_0x36f4b3){logger[_0xbe3d('0x42')](_0xbe3d('0x67'),util['inspect'](_0x36f4b3,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0xbe3d('0xc')][_0xbe3d('0x68')]=function(){var _0x5f3a33=this;setInterval(function(){if(_0x5f3a33[_0xbe3d('0x15')]){return ami[_0xbe3d('0x3b')]({'action':_0xbe3d('0x69')})[_0xbe3d('0x6a')](function(_0x3ed7cb){_0x5f3a33['flagQueueSummary']=![];})[_0xbe3d('0x3e')](function(_0x4ac3ed){logger['error'](_0xbe3d('0x6b'),util[_0xbe3d('0x41')](_0x4ac3ed,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0xbe3d('0xc')][_0xbe3d('0x18')]=function(_0x566c61){try{if(this['isNotNull'](_0x566c61)&&this[_0xbe3d('0x65')](_0x566c61['queue'])){logger[_0xbe3d('0x4a')](_0xbe3d('0x6c'),util[_0xbe3d('0x41')](_0x566c61,{'showHidden':![],'depth':null}));if(this[_0xbe3d('0x14')][_0x566c61[_0xbe3d('0x6d')]]){logger[_0xbe3d('0x6e')]('[voiceQueueReport][queuesummary]\x20name:%s',_0x566c61['queue']);var _0xe81271=_[_0xbe3d('0x6f')](this[_0xbe3d('0x12')],_0xbe3d('0x6d'))[_0x566c61['queue']]||0x0;var _0x3a8f18=_0xe81271-_0x566c61[_0xbe3d('0x70')];if(this['voiceQueues'][_0x566c61[_0xbe3d('0x6d')]][_0xbe3d('0x36')]!==_['toNumber'](_0x566c61[_0xbe3d('0x70')])||this[_0xbe3d('0x14')][_0x566c61['queue']][_0xbe3d('0x5b')]!==_['toNumber'](_0x566c61[_0xbe3d('0x71')])||this['voiceQueues'][_0x566c61[_0xbe3d('0x6d')]][_0xbe3d('0x5a')]!==_[_0xbe3d('0x72')](_0x566c61['available'])||this['voiceQueues'][_0x566c61[_0xbe3d('0x6d')]][_0xbe3d('0x73')]!==_0x3a8f18){this[_0xbe3d('0x14')][_0x566c61[_0xbe3d('0x6d')]]['waiting']=_[_0xbe3d('0x72')](_0x566c61[_0xbe3d('0x70')]);this['voiceQueues'][_0x566c61[_0xbe3d('0x6d')]][_0xbe3d('0x5b')]=_[_0xbe3d('0x72')](_0x566c61['loggedin']);this[_0xbe3d('0x14')][_0x566c61['queue']][_0xbe3d('0x5a')]=_[_0xbe3d('0x72')](_0x566c61[_0xbe3d('0x5a')]);this[_0xbe3d('0x14')][_0x566c61[_0xbe3d('0x6d')]][_0xbe3d('0x73')]=_0x3a8f18>0x0?_0x3a8f18:0x0;this['voiceQueues'][_0x566c61[_0xbe3d('0x6d')]]['talking']=this[_0xbe3d('0x14')][_0x566c61[_0xbe3d('0x6d')]]['talking']>_['toNumber'](_0x566c61['loggedin'])?_[_0xbe3d('0x72')](_0x566c61['loggedin']):this[_0xbe3d('0x14')][_0x566c61[_0xbe3d('0x6d')]][_0xbe3d('0x73')];this[_0xbe3d('0x55')](this[_0xbe3d('0x14')][_0x566c61[_0xbe3d('0x6d')]],_0xbe3d('0x69'));}logger[_0xbe3d('0x4a')](_0xbe3d('0x74'),util['inspect'](this[_0xbe3d('0x14')][_0x566c61['queue']],{'showHidden':![],'depth':null}));ami[_0xbe3d('0x49')](_0xbe3d('0x75'),this[_0xbe3d('0x14')][_0x566c61[_0xbe3d('0x6d')]]);}}}catch(_0x315820){logger[_0xbe3d('0x42')](_0xbe3d('0x6b'),util[_0xbe3d('0x41')](_0x315820,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbe3d('0xc')]['syncQueueSummaryComplete']=function(_0x578185){logger[_0xbe3d('0x4a')](_0xbe3d('0x76'),util[_0xbe3d('0x41')](_0x578185,{'showHidden':![],'depth':null}));this[_0xbe3d('0x15')]=!![];};VoiceQueueReport[_0xbe3d('0xc')]['syncQueueCallerJoin']=function(_0x2bbb28){try{if(this[_0xbe3d('0x65')](_0x2bbb28)){logger[_0xbe3d('0x4a')](_0xbe3d('0x77'),_0x2bbb28['uniqueid'],util['inspect'](_0x2bbb28,{'showHidden':![],'depth':null}));if(_[_0xbe3d('0x66')](this[_0xbe3d('0x10')][_0x2bbb28['uniqueid']]))this[_0xbe3d('0x10')][_0x2bbb28[_0xbe3d('0x4d')]]=[];if(_[_0xbe3d('0x66')](this[_0xbe3d('0x12')][_0x2bbb28[_0xbe3d('0x4d')]]))this[_0xbe3d('0x12')][_0x2bbb28[_0xbe3d('0x4d')]]={};var _0xf227e=new QueueReport();_0xf227e['name']=_0x2bbb28[_0xbe3d('0x6d')];_0xf227e[_0xbe3d('0x56')]=this['voiceQueues'][_0xf227e['name']]&&this[_0xbe3d('0x14')][_0xf227e[_0xbe3d('0x4f')]][_0xbe3d('0x56')]?this[_0xbe3d('0x14')][_0xf227e[_0xbe3d('0x4f')]][_0xbe3d('0x56')]||_0xbe3d('0x57'):_0xbe3d('0x57');_0xf227e[_0xbe3d('0x6d')]=_0x2bbb28[_0xbe3d('0x6d')];_0xf227e['queuecallerjoinAt']=moment()[_0xbe3d('0x4e')](_0xbe3d('0x78'));_0xf227e[_0xbe3d('0x79')]=_0x2bbb28['position'];_0xf227e[_0xbe3d('0x7a')]=_0x2bbb28['count'];_0xf227e['uniqueid']=_0x2bbb28['uniqueid'];_0xf227e[_0xbe3d('0x7b')]=this[_0xbe3d('0x12')][_0x2bbb28[_0xbe3d('0x4d')]][_0xbe3d('0x7b')];logger[_0xbe3d('0x6e')](_0xbe3d('0x7c'),_0xf227e[_0xbe3d('0x4f')],_0xf227e[_0xbe3d('0x56')]);_['merge'](_0xf227e,_['pick'](_0x2bbb28,_[_0xbe3d('0x7d')](_0xf227e)));this[_0xbe3d('0x10')][_0x2bbb28['uniqueid']][_0xbe3d('0x7e')](_0xf227e);this['channels'][_0x2bbb28[_0xbe3d('0x4d')]]=_0xf227e;this[_0xbe3d('0x7f')](_0xf227e,_0xbe3d('0x1c'));}}catch(_0x3051c0){logger[_0xbe3d('0x42')](_0xbe3d('0x77'),_0x2bbb28[_0xbe3d('0x4d')],util[_0xbe3d('0x41')](_0x3051c0,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xbe3d('0x1f')]=function(_0x6e9b61){try{if(this[_0xbe3d('0x65')](_0x6e9b61)){logger[_0xbe3d('0x4a')](_0xbe3d('0x80'),_0x6e9b61[_0xbe3d('0x4d')],util[_0xbe3d('0x41')](_0x6e9b61,{'showHidden':![],'depth':null}));if(this[_0xbe3d('0x10')][_0x6e9b61['uniqueid']]){var _0x380b00=_[_0xbe3d('0x81')](this[_0xbe3d('0x10')][_0x6e9b61[_0xbe3d('0x4d')]]);_0x380b00[_0xbe3d('0x82')]=![];_0x380b00[_0xbe3d('0x83')]=null;_0x380b00['holdtime']=_0x6e9b61[_0xbe3d('0x84')];_0x380b00[_0xbe3d('0x85')]=_0x6e9b61[_0xbe3d('0x85')];_0x380b00[_0xbe3d('0x1e')]=!![];_0x380b00[_0xbe3d('0x86')]=moment()[_0xbe3d('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');_0x380b00['queuecallerexitreason']='ABANDONED';_0x380b00[_0xbe3d('0x87')]=null;logger[_0xbe3d('0x6e')](_0xbe3d('0x88'),_0x380b00['name'],_0x380b00[_0xbe3d('0x56')]);this[_0xbe3d('0x12')][_0x6e9b61[_0xbe3d('0x4d')]]=_0x380b00;this['emitVoiceQueueChannelRemove'](_0x380b00,_0xbe3d('0x1e'));}}}catch(_0x200b11){logger[_0xbe3d('0x42')]('[%s][voiceQueueReport][queuecallerabandon]',_0x6e9b61['uniqueid'],util[_0xbe3d('0x41')](_0x200b11,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbe3d('0xc')][_0xbe3d('0x21')]=function(_0x1faa11){try{if(this[_0xbe3d('0x65')](_0x1faa11)){logger[_0xbe3d('0x4a')]('[%s][voiceQueueReport][queuecallerleave]',_0x1faa11['uniqueid'],util[_0xbe3d('0x41')](_0x1faa11,{'showHidden':![],'depth':null}));if(this[_0xbe3d('0x10')][_0x1faa11[_0xbe3d('0x4d')]]){var _0x30f4da=_[_0xbe3d('0x81')](this[_0xbe3d('0x10')][_0x1faa11[_0xbe3d('0x4d')]]);_0x30f4da[_0xbe3d('0x89')]=moment()[_0xbe3d('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');_0x30f4da['connectedlinenum']=_0x1faa11[_0xbe3d('0x8a')];_0x30f4da[_0xbe3d('0x8b')]=_0x1faa11[_0xbe3d('0x8b')];logger['info'](_0xbe3d('0x8c'),_0x30f4da['name'],_0x30f4da[_0xbe3d('0x56')],_0x1faa11[_0xbe3d('0x8a')],_0x1faa11['connectedlinename']);this[_0xbe3d('0x12')][_0x1faa11[_0xbe3d('0x4d')]]=_0x30f4da;this[_0xbe3d('0x7f')](_0x30f4da,_0xbe3d('0x20'));}}}catch(_0x3ee086){logger[_0xbe3d('0x42')](_0xbe3d('0x8d'),_0x1faa11[_0xbe3d('0x4d')],util[_0xbe3d('0x41')](_0x3ee086,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbe3d('0xc')]['syncAgentConnect']=function(_0x554c87){try{if(this[_0xbe3d('0x65')](_0x554c87)){logger['debug'](_0xbe3d('0x8e'),_0x554c87['uniqueid'],util[_0xbe3d('0x41')](_0x554c87,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x554c87['uniqueid']]){var _0xb37eda=_['last'](this[_0xbe3d('0x10')][_0x554c87[_0xbe3d('0x4d')]]);_0xb37eda['queuecallercomplete']=!![];_0xb37eda[_0xbe3d('0x8f')]=_0xbe3d('0x90');logger[_0xbe3d('0x6e')](_0xbe3d('0x91'),_0xb37eda['name'],_0xb37eda[_0xbe3d('0x56')]);}}}catch(_0x3ecd8d){logger['error'](_0xbe3d('0x8e'),_0x554c87[_0xbe3d('0x4d')],util['inspect'](_0x3ecd8d,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xbe3d('0x22')]=function(_0x5be14e){try{if(this[_0xbe3d('0x65')](_0x5be14e)){logger['debug']('[%s][voiceQueueReport][agentcomplete]',_0x5be14e[_0xbe3d('0x4d')],util[_0xbe3d('0x41')](_0x5be14e,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x5be14e[_0xbe3d('0x4d')]]){var _0x4dcc8d=_[_0xbe3d('0x81')](this[_0xbe3d('0x10')][_0x5be14e[_0xbe3d('0x4d')]]);_0x4dcc8d[_0xbe3d('0x1e')]=![];_0x4dcc8d[_0xbe3d('0x86')]=null;_0x4dcc8d[_0xbe3d('0x92')]=!![];_0x4dcc8d[_0xbe3d('0x87')]=_0x5be14e[_0xbe3d('0x93')];_0x4dcc8d[_0xbe3d('0x84')]=_0x5be14e[_0xbe3d('0x84')];_0x4dcc8d['queuecallercomplete']=!![];_0x4dcc8d[_0xbe3d('0x94')]=![];_0x4dcc8d[_0xbe3d('0x95')]=null;if(!_0x4dcc8d[_0xbe3d('0x96')]){if(_0x5be14e[_0xbe3d('0x97')]=='transfer'){_0x4dcc8d[_0xbe3d('0x8f')]=_0xbe3d('0x98');logger[_0xbe3d('0x6e')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x4dcc8d[_0xbe3d('0x4f')],_0x4dcc8d[_0xbe3d('0x56')]);}else{if(_['startsWith'](_0x5be14e['channel'][_0xbe3d('0x99')](),_0xbe3d('0x9a'))){if(this['queueReports'][_0x5be14e[_0xbe3d('0x9b')]]){var _0x4efa04=_['last'](this[_0xbe3d('0x10')][_0x5be14e[_0xbe3d('0x9b')]]);_0x4efa04[_0xbe3d('0x82')]=![];_0x4efa04['queuecallerexit']=!![];_0x4efa04['queuecallerexitAt']=moment(_0x4dcc8d[_0xbe3d('0x9c')])[_0xbe3d('0x9d')](_0x5be14e[_0xbe3d('0x84')],_0xbe3d('0x9e'))[_0xbe3d('0x4e')](_0xbe3d('0x78'));_0x4efa04['queuecallerexitreason']=_0xbe3d('0x9f');_0x4efa04['transfer']=!![];_0x4efa04['transfertype']=_0xbe3d('0xa0');_0x4efa04[_0xbe3d('0xa1')]=_0x5be14e[_0xbe3d('0xa2')];_0x4efa04[_0xbe3d('0xa3')]=_0x5be14e[_0xbe3d('0x4d')];logger[_0xbe3d('0x6e')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x4efa04['name'],_0x4efa04['type']);var _0x2280d1=this['queueReports'][_0x5be14e[_0xbe3d('0x9b')]];this['queueReports'][_0x5be14e[_0xbe3d('0x9b')]]=this['queueReports'][_0x5be14e[_0xbe3d('0x4d')]];this[_0xbe3d('0x10')][_0x5be14e[_0xbe3d('0x4d')]]=_0x2280d1;}}else{_0x4dcc8d['queuecallerexitreason']='COMPLETEDBY'+_0x5be14e['reason']['toUpperCase']();logger[_0xbe3d('0x6e')](_0xbe3d('0xa4'),_0x4dcc8d[_0xbe3d('0x4f')],_0x4dcc8d[_0xbe3d('0x56')],_0x4dcc8d[_0xbe3d('0x8f')]);}}}this[_0xbe3d('0x12')][_0x5be14e['uniqueid']]=_0x4dcc8d;this[_0xbe3d('0x47')](_0x4dcc8d,'agentcomplete');}}}catch(_0x501ab2){logger[_0xbe3d('0x42')](_0xbe3d('0xa5'),_0x5be14e[_0xbe3d('0x4d')],util['inspect'](_0x501ab2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbe3d('0xc')][_0xbe3d('0x26')]=function(_0x5625d8){try{if(this[_0xbe3d('0x65')](_0x5625d8)){logger[_0xbe3d('0x4a')](_0xbe3d('0xa6'),_0x5625d8['uniqueid'],util['inspect'](_0x5625d8,{'showHidden':![],'depth':null}));this[_0xbe3d('0xa7')](_0x5625d8[_0xbe3d('0x4d')],_[_0xbe3d('0x7d')](_0x5625d8[_0xbe3d('0xa8')])[0x0],_0x5625d8[_0xbe3d('0xa9')]);if(this[_0xbe3d('0x10')][_0x5625d8[_0xbe3d('0x4d')]]){var _0x4b6d05=_[_0xbe3d('0x81')](this[_0xbe3d('0x10')][_0x5625d8[_0xbe3d('0x4d')]]);if(_0x4b6d05){if(this[_0xbe3d('0x65')](_0x5625d8['variable'])&&this[_0xbe3d('0x65')](_0x5625d8[_0xbe3d('0xa8')][_0xbe3d('0xaa')])){switch(_0x5625d8[_0xbe3d('0xa9')]){case _0xbe3d('0xab'):_0x4b6d05[_0xbe3d('0x94')]=![];_0x4b6d05[_0xbe3d('0x95')]=null;break;case _0xbe3d('0xac'):_0x4b6d05[_0xbe3d('0xad')]=_0xbe3d('0xae');_0x4b6d05[_0xbe3d('0x94')]=!![];_0x4b6d05['queuecallerexitAt']=moment()[_0xbe3d('0x4e')](_0xbe3d('0x78'));_0x4b6d05['queuecallerleaveAt']=moment()[_0xbe3d('0x4e')](_0xbe3d('0x78'));logger[_0xbe3d('0x4a')](_0xbe3d('0xaf'),_0x5625d8['uniqueid'],util[_0xbe3d('0x41')](_0x4b6d05,{'showHidden':![],'depth':null}));ami[_0xbe3d('0x49')](_0xbe3d('0xb0'),_0x4b6d05);break;default:_0x4b6d05['queuecallerexit']=!![];_0x4b6d05[_0xbe3d('0x95')]=moment()[_0xbe3d('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');_0x4b6d05[_0xbe3d('0x89')]=moment()[_0xbe3d('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4b6d05[_0xbe3d('0x1e')]=![];_0x4b6d05[_0xbe3d('0x86')]=null;_0x4b6d05[_0xbe3d('0x8f')]=_0x5625d8['value'];this[_0xbe3d('0x12')][_0x5625d8[_0xbe3d('0x4d')]]=_0x4b6d05;this[_0xbe3d('0x47')](_0x4b6d05,_0xbe3d('0x25'));}else if(this[_0xbe3d('0x65')](_0x5625d8[_0xbe3d('0xa8')])&&this[_0xbe3d('0x65')](_0x5625d8[_0xbe3d('0xa8')][_0xbe3d('0xb1')])){if(!_0x4b6d05[_0xbe3d('0x1e')]){_0x4b6d05[_0xbe3d('0x94')]=!![];_0x4b6d05['queuecallerexitAt']=moment()['format'](_0xbe3d('0x78'));_0x4b6d05[_0xbe3d('0x8f')]=_0xbe3d('0xb2');_0x4b6d05['queuecallerleaveAt']=moment()[_0xbe3d('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xbe3d('0x12')][_0x5625d8[_0xbe3d('0x4d')]]=_0x4b6d05;}}logger[_0xbe3d('0x6e')](_0xbe3d('0xb3'),_0x5625d8[_0xbe3d('0x4d')],_0x4b6d05[_0xbe3d('0x4f')],_0x4b6d05[_0xbe3d('0x56')],_[_0xbe3d('0x7d')](_0x5625d8[_0xbe3d('0xa8')])[0x0],_0x5625d8['value']);_0x4b6d05[_0xbe3d('0x17')]=this['variables'][_0x5625d8[_0xbe3d('0x4d')]];}}}}catch(_0x54ed09){logger[_0xbe3d('0x42')](_0xbe3d('0xa6'),_0x5625d8[_0xbe3d('0x4d')],util[_0xbe3d('0x41')](_0x54ed09,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbe3d('0xc')]['addVariable']=function(_0x394743,_0x5a9fe5,_0x1355c6){var _0x22b12d=[_0xbe3d('0xb4'),_0xbe3d('0xb5'),_0xbe3d('0xb6'),'rtpaudioqosjitterbridged',_0xbe3d('0xb7'),'rtpaudioqoslossbridged',_0xbe3d('0xb8'),_0xbe3d('0xb9'),_0xbe3d('0xba'),_0xbe3d('0xbb'),'bridgepeer',_0xbe3d('0xbc'),'membercalls','memberdynamic',_0xbe3d('0xbd'),_0xbe3d('0xbe'),_0xbe3d('0x93'),_0xbe3d('0xbf'),'memberrealtime'];if(!_[_0xbe3d('0x3a')](_0x5a9fe5)&&!_['includes'](_0x22b12d,_0x5a9fe5)){if(_[_0xbe3d('0x66')](this[_0xbe3d('0x17')][_0x394743])){this['variables'][_0x394743]={};}this['variables'][_0x394743][_0x5a9fe5]=_0x1355c6;}};VoiceQueueReport[_0xbe3d('0xc')]['syncHangup']=function(_0x3b77f1){try{if(this[_0xbe3d('0x65')](_0x3b77f1)){logger[_0xbe3d('0x4a')](_0xbe3d('0xc0'),_0x3b77f1[_0xbe3d('0x4d')],util['inspect'](_0x3b77f1,{'showHidden':![],'depth':null}));if(this[_0xbe3d('0x10')][_0x3b77f1[_0xbe3d('0x4d')]]){for(var _0xa30276=0x0,_0x2fea5f={};_0xa302760x0?_0xd61cfc:0x0;this[_0x7512('0x12')][_0x46dc47[_0x7512('0x65')]]['talking']=this[_0x7512('0x12')][_0x46dc47[_0x7512('0x65')]]['talking']>_['toNumber'](_0x46dc47['loggedin'])?_[_0x7512('0x69')](_0x46dc47[_0x7512('0x6a')]):this['voiceQueues'][_0x46dc47[_0x7512('0x65')]][_0x7512('0x6c')];this[_0x7512('0x4f')](this[_0x7512('0x12')][_0x46dc47[_0x7512('0x65')]],_0x7512('0x16'));}logger['debug'](_0x7512('0x6d'),util['inspect'](this[_0x7512('0x12')][_0x46dc47['queue']],{'showHidden':![],'depth':null}));ami[_0x7512('0x44')](_0x7512('0x6e'),this[_0x7512('0x12')][_0x46dc47[_0x7512('0x65')]]);}}}catch(_0x5e9d19){logger[_0x7512('0x3c')](_0x7512('0x6f'),util[_0x7512('0x3d')](_0x5e9d19,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7512('0xa')][_0x7512('0x18')]=function(_0x34fc55){logger[_0x7512('0x45')](_0x7512('0x70'),util[_0x7512('0x3d')](_0x34fc55,{'showHidden':![],'depth':null}));this[_0x7512('0x13')]=!![];};VoiceQueueReport[_0x7512('0xa')]['syncQueueCallerJoin']=function(_0x5b901b){try{if(this[_0x7512('0x5d')](_0x5b901b)){logger['debug'](_0x7512('0x71'),_0x5b901b['uniqueid'],util[_0x7512('0x3d')](_0x5b901b,{'showHidden':![],'depth':null}));if(_['isUndefined'](this['queueReports'][_0x5b901b[_0x7512('0x48')]]))this['queueReports'][_0x5b901b[_0x7512('0x48')]]=[];if(_[_0x7512('0x5e')](this[_0x7512('0x10')][_0x5b901b[_0x7512('0x48')]]))this[_0x7512('0x10')][_0x5b901b[_0x7512('0x48')]]={};var _0x3a2a68=new QueueReport();_0x3a2a68[_0x7512('0x4a')]=_0x5b901b[_0x7512('0x65')];_0x3a2a68[_0x7512('0x50')]=this['voiceQueues'][_0x3a2a68[_0x7512('0x4a')]]&&this[_0x7512('0x12')][_0x3a2a68[_0x7512('0x4a')]][_0x7512('0x50')]?this[_0x7512('0x12')][_0x3a2a68['name']][_0x7512('0x50')]||_0x7512('0x51'):'inbound';_0x3a2a68[_0x7512('0x65')]=_0x5b901b[_0x7512('0x65')];_0x3a2a68[_0x7512('0x72')]=moment()[_0x7512('0x49')](_0x7512('0x73'));_0x3a2a68[_0x7512('0x74')]=_0x5b901b[_0x7512('0x74')];_0x3a2a68[_0x7512('0x75')]=_0x5b901b['count'];_0x3a2a68[_0x7512('0x48')]=_0x5b901b[_0x7512('0x48')];_0x3a2a68[_0x7512('0x76')]=this[_0x7512('0x10')][_0x5b901b[_0x7512('0x48')]][_0x7512('0x76')];logger['info'](_0x7512('0x77'),_0x3a2a68[_0x7512('0x4a')],_0x3a2a68[_0x7512('0x50')]);_[_0x7512('0x78')](_0x3a2a68,_[_0x7512('0x79')](_0x5b901b,_[_0x7512('0x7a')](_0x3a2a68)));this[_0x7512('0xe')][_0x5b901b[_0x7512('0x48')]][_0x7512('0x7b')](_0x3a2a68);this[_0x7512('0x10')][_0x5b901b[_0x7512('0x48')]]=_0x3a2a68;this['emitVoiceQueueChannelSave'](_0x3a2a68,_0x7512('0x19'));}}catch(_0x31317d){logger['error'](_0x7512('0x71'),_0x5b901b['uniqueid'],util[_0x7512('0x3d')](_0x31317d,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x7512('0x7c')]=function(_0x8bfa15){try{if(this[_0x7512('0x5d')](_0x8bfa15)){logger[_0x7512('0x45')]('[%s][voiceQueueReport][queuecallerabandon]',_0x8bfa15[_0x7512('0x48')],util['inspect'](_0x8bfa15,{'showHidden':![],'depth':null}));if(this[_0x7512('0xe')][_0x8bfa15[_0x7512('0x48')]]){var _0x193aa2=_['last'](this[_0x7512('0xe')][_0x8bfa15[_0x7512('0x48')]]);_0x193aa2[_0x7512('0x7d')]=![];_0x193aa2['queuecallercompleteAt']=null;_0x193aa2[_0x7512('0x7e')]=_0x8bfa15['holdtime'];_0x193aa2['originalposition']=_0x8bfa15['originalposition'];_0x193aa2['queuecallerabandon']=!![];_0x193aa2[_0x7512('0x7f')]=moment()[_0x7512('0x49')](_0x7512('0x73'));_0x193aa2['queuecallerexitreason']=_0x7512('0x80');_0x193aa2[_0x7512('0x81')]=null;logger[_0x7512('0x66')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x193aa2[_0x7512('0x4a')],_0x193aa2[_0x7512('0x50')]);this[_0x7512('0x10')][_0x8bfa15[_0x7512('0x48')]]=_0x193aa2;this['emitVoiceQueueChannelRemove'](_0x193aa2,_0x7512('0x82'));}}}catch(_0x2bbe8a){logger['error'](_0x7512('0x83'),_0x8bfa15[_0x7512('0x48')],util[_0x7512('0x3d')](_0x2bbe8a,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x7512('0x1c')]=function(_0x4d550f){try{if(this['isNotNull'](_0x4d550f)){logger[_0x7512('0x45')](_0x7512('0x84'),_0x4d550f['uniqueid'],util[_0x7512('0x3d')](_0x4d550f,{'showHidden':![],'depth':null}));if(this[_0x7512('0xe')][_0x4d550f[_0x7512('0x48')]]){var _0x1930d3=_[_0x7512('0x85')](this[_0x7512('0xe')][_0x4d550f['uniqueid']]);_0x1930d3[_0x7512('0x86')]=moment()['format'](_0x7512('0x73'));_0x1930d3[_0x7512('0x87')]=_0x4d550f[_0x7512('0x87')];_0x1930d3[_0x7512('0x88')]=_0x4d550f['connectedlinename'];logger[_0x7512('0x66')](_0x7512('0x89'),_0x1930d3['name'],_0x1930d3['type'],_0x4d550f[_0x7512('0x87')],_0x4d550f['connectedlinename']);this[_0x7512('0x10')][_0x4d550f[_0x7512('0x48')]]=_0x1930d3;this['emitVoiceQueueChannelSave'](_0x1930d3,'queuecallerleave');}}}catch(_0x3f20c7){logger[_0x7512('0x3c')](_0x7512('0x84'),_0x4d550f[_0x7512('0x48')],util['inspect'](_0x3f20c7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7512('0xa')][_0x7512('0x1f')]=function(_0x2f8992){try{if(this['isNotNull'](_0x2f8992)){logger['debug'](_0x7512('0x8a'),_0x2f8992[_0x7512('0x48')],util[_0x7512('0x3d')](_0x2f8992,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x2f8992['uniqueid']]){var _0x4b1db0=_[_0x7512('0x85')](this[_0x7512('0xe')][_0x2f8992['uniqueid']]);_0x4b1db0[_0x7512('0x7d')]=!![];_0x4b1db0['queuecallerexitreason']=_0x7512('0x8b');logger['info']('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x4b1db0[_0x7512('0x4a')],_0x4b1db0[_0x7512('0x50')]);}}}catch(_0x1da28d){logger[_0x7512('0x3c')](_0x7512('0x8a'),_0x2f8992[_0x7512('0x48')],util[_0x7512('0x3d')](_0x1da28d,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentComplete']=function(_0x2452b2){try{if(this[_0x7512('0x5d')](_0x2452b2)){logger[_0x7512('0x45')](_0x7512('0x8c'),_0x2452b2[_0x7512('0x48')],util[_0x7512('0x3d')](_0x2452b2,{'showHidden':![],'depth':null}));if(this[_0x7512('0xe')][_0x2452b2[_0x7512('0x48')]]){var _0x1c340e=_[_0x7512('0x85')](this[_0x7512('0xe')][_0x2452b2[_0x7512('0x48')]]);_0x1c340e[_0x7512('0x82')]=![];_0x1c340e[_0x7512('0x7f')]=null;_0x1c340e[_0x7512('0x8d')]=!![];_0x1c340e['lastAssignedTo']=_0x2452b2[_0x7512('0x8e')];_0x1c340e['holdtime']=_0x2452b2[_0x7512('0x7e')];_0x1c340e[_0x7512('0x7d')]=!![];_0x1c340e[_0x7512('0x8f')]=![];_0x1c340e[_0x7512('0x90')]=null;if(!_0x1c340e['transfer']){if(_0x2452b2[_0x7512('0x91')]==_0x7512('0x92')){_0x1c340e['queuecallerexitreason']='COMPLETED';logger[_0x7512('0x66')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x1c340e['name'],_0x1c340e[_0x7512('0x50')]);}else{if(_[_0x7512('0x93')](_0x2452b2[_0x7512('0x3a')][_0x7512('0x94')](),_0x7512('0x95'))){if(this[_0x7512('0xe')][_0x2452b2[_0x7512('0x96')]]){var _0x51e770=_[_0x7512('0x85')](this[_0x7512('0xe')][_0x2452b2['linkedid']]);_0x51e770[_0x7512('0x7d')]=![];_0x51e770[_0x7512('0x8f')]=!![];_0x51e770['queuecallerexitAt']=moment(_0x1c340e[_0x7512('0x72')])[_0x7512('0x97')](_0x2452b2[_0x7512('0x7e')],_0x7512('0x98'))[_0x7512('0x49')](_0x7512('0x73'));_0x51e770['queuecallerexitreason']=_0x7512('0x99');_0x51e770['transfer']=!![];_0x51e770[_0x7512('0x9a')]='FORWARD';_0x51e770['transferexten']=_0x2452b2[_0x7512('0x9b')];_0x51e770[_0x7512('0x9c')]=_0x2452b2[_0x7512('0x48')];logger[_0x7512('0x66')](_0x7512('0x9d'),_0x51e770[_0x7512('0x4a')],_0x51e770[_0x7512('0x50')]);var _0x494251=this[_0x7512('0xe')][_0x2452b2[_0x7512('0x96')]];this[_0x7512('0xe')][_0x2452b2[_0x7512('0x96')]]=this['queueReports'][_0x2452b2[_0x7512('0x48')]];this[_0x7512('0xe')][_0x2452b2[_0x7512('0x48')]]=_0x494251;}}else{_0x1c340e[_0x7512('0x9e')]='COMPLETEDBY'+_0x2452b2['reason'][_0x7512('0x9f')]();logger[_0x7512('0x66')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x1c340e[_0x7512('0x4a')],_0x1c340e[_0x7512('0x50')],_0x1c340e[_0x7512('0x9e')]);}}}this[_0x7512('0x10')][_0x2452b2[_0x7512('0x48')]]=_0x1c340e;this[_0x7512('0x43')](_0x1c340e,_0x7512('0xa0'));}}}catch(_0x4d7b9b){logger[_0x7512('0x3c')](_0x7512('0x8c'),_0x2452b2[_0x7512('0x48')],util['inspect'](_0x4d7b9b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7512('0xa')]['syncVarSet']=function(_0x3fab1d){try{if(this[_0x7512('0x5d')](_0x3fab1d)){logger[_0x7512('0x45')](_0x7512('0xa1'),_0x3fab1d[_0x7512('0x48')],util['inspect'](_0x3fab1d,{'showHidden':![],'depth':null}));this[_0x7512('0xa2')](_0x3fab1d[_0x7512('0x48')],_[_0x7512('0x7a')](_0x3fab1d[_0x7512('0xa3')])[0x0],_0x3fab1d[_0x7512('0xa4')]);if(this[_0x7512('0xe')][_0x3fab1d[_0x7512('0x48')]]){var _0xfd874e=_['last'](this[_0x7512('0xe')][_0x3fab1d['uniqueid']]);if(_0xfd874e){if(this[_0x7512('0x5d')](_0x3fab1d[_0x7512('0xa3')])&&this[_0x7512('0x5d')](_0x3fab1d[_0x7512('0xa3')][_0x7512('0xa5')])){switch(_0x3fab1d[_0x7512('0xa4')]){case _0x7512('0xa6'):_0xfd874e[_0x7512('0x8f')]=![];_0xfd874e[_0x7512('0x90')]=null;break;case _0x7512('0xa7'):_0xfd874e[_0x7512('0xa8')]='timeout';_0xfd874e['queuecallerexit']=!![];_0xfd874e['queuecallerexitAt']=moment()[_0x7512('0x49')]('YYYY-MM-DD\x20HH:mm:ss');_0xfd874e[_0x7512('0x86')]=moment()[_0x7512('0x49')](_0x7512('0x73'));logger[_0x7512('0x45')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x3fab1d[_0x7512('0x48')],util[_0x7512('0x3d')](_0xfd874e,{'showHidden':![],'depth':null}));ami['emit']('custom:timeout',_0xfd874e);break;default:_0xfd874e[_0x7512('0x8f')]=!![];_0xfd874e[_0x7512('0x90')]=moment()[_0x7512('0x49')](_0x7512('0x73'));_0xfd874e[_0x7512('0x86')]=moment()[_0x7512('0x49')](_0x7512('0x73'));}_0xfd874e[_0x7512('0x82')]=![];_0xfd874e[_0x7512('0x7f')]=null;_0xfd874e[_0x7512('0x9e')]=_0x3fab1d[_0x7512('0xa4')];this['channels'][_0x3fab1d['uniqueid']]=_0xfd874e;this[_0x7512('0x43')](_0xfd874e,_0x7512('0x20'));}else if(this[_0x7512('0x5d')](_0x3fab1d[_0x7512('0xa3')])&&this['isNotNull'](_0x3fab1d[_0x7512('0xa3')][_0x7512('0xa9')])){if(!_0xfd874e[_0x7512('0x82')]){_0xfd874e['queuecallerexit']=!![];_0xfd874e[_0x7512('0x90')]=moment()[_0x7512('0x49')](_0x7512('0x73'));_0xfd874e[_0x7512('0x9e')]='EXITWITHKEY';_0xfd874e['queuecallerleaveAt']=moment()[_0x7512('0x49')](_0x7512('0x73'));this[_0x7512('0x10')][_0x3fab1d[_0x7512('0x48')]]=_0xfd874e;}}logger[_0x7512('0x66')](_0x7512('0xaa'),_0x3fab1d['uniqueid'],_0xfd874e['name'],_0xfd874e[_0x7512('0x50')],_[_0x7512('0x7a')](_0x3fab1d['variable'])[0x0],_0x3fab1d[_0x7512('0xa4')]);_0xfd874e[_0x7512('0x15')]=this[_0x7512('0x15')][_0x3fab1d[_0x7512('0x48')]];}}}}catch(_0x57b4c1){logger[_0x7512('0x3c')](_0x7512('0xa1'),_0x3fab1d[_0x7512('0x48')],util[_0x7512('0x3d')](_0x57b4c1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7512('0xa')][_0x7512('0xa2')]=function(_0x186ebc,_0xe59376,_0x28aed7){var _0x473776=['rtpaudioqos',_0x7512('0xab'),_0x7512('0xac'),_0x7512('0xad'),_0x7512('0xae'),'rtpaudioqoslossbridged','rtpaudioqosrtt',_0x7512('0xaf'),_0x7512('0xb0'),_0x7512('0xb1'),_0x7512('0xb2'),_0x7512('0xb3'),_0x7512('0xb4'),_0x7512('0xb5'),'memberinterface','memberlastcall',_0x7512('0x8e'),_0x7512('0xb6'),'memberrealtime'];if(!_[_0x7512('0x37')](_0xe59376)&&!_[_0x7512('0xb7')](_0x473776,_0xe59376)){if(_[_0x7512('0x5e')](this[_0x7512('0x15')][_0x186ebc])){this[_0x7512('0x15')][_0x186ebc]={};}this['variables'][_0x186ebc][_0xe59376]=_0x28aed7;}};VoiceQueueReport[_0x7512('0xa')][_0x7512('0x23')]=function(_0x48ab53){try{if(this[_0x7512('0x5d')](_0x48ab53)){logger[_0x7512('0x45')]('[%s][voiceQueueReport][hangup]',_0x48ab53[_0x7512('0x48')],util['inspect'](_0x48ab53,{'showHidden':![],'depth':null}));if(this[_0x7512('0xe')][_0x48ab53[_0x7512('0x48')]]){for(var _0x36d977=0x0,_0x5dc861={};_0x36d977=0x0?moment(_0x5ab58b[_0x8937('0x19')])['diff'](_0x5ab58b[_0x8937('0x1a')],_0x8937('0xe')):null,'data1':_0x8937('0x1b'),'data2':_0x5ab58b[_0x8937('0x15')],'data3':_0x5ab58b[_0x8937('0x11')],'data4':_0x5ab58b[_0x8937('0x1c')]||null,'role':_0x8937('0x13'),'internal':_0x5ab58b[_0x8937('0x15')]?_[_0x8937('0x14')](_0x5ab58b[_0x8937('0x15')]):undefined,'uniqueid':_0x5ab58b[_0x8937('0x16')]},'log':_0x8937('0x6')});}; \ No newline at end of file +var _0x7e9a=['agent','accountcode','toNumber','uniqueid','voiceDialReport','membername','endtime','starttime','exten','dialstring','moment','lodash','util','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','voice','lastAssignedTo','isNil','interface','format','TALKING','queuecallerleaveAt','diff','seconds','inbound','calleridnum'];(function(_0x285bc9,_0x5194e6){var _0x185992=function(_0xe941f4){while(--_0xe941f4){_0x285bc9['push'](_0x285bc9['shift']());}};_0x185992(++_0x5194e6);}(_0x7e9a,0xdc));var _0xa7e9=function(_0x27b11d,_0x281d7c){_0x27b11d=_0x27b11d-0x0;var _0xf01a8c=_0x7e9a[_0x27b11d];return _0xf01a8c;};'use strict';var moment=require(_0xa7e9('0x0'));var _=require(_0xa7e9('0x1'));var util=require(_0xa7e9('0x2'));var client=require(_0xa7e9('0x3'));exports[_0xa7e9('0x4')]=function(_0x56160c){var _0x3e02fc=_0x56160c[_0xa7e9('0x5')]||_0x56160c[_0xa7e9('0x6')];return client[_0xa7e9('0x7')](_0xa7e9('0x8'),{'body':{'channel':_0xa7e9('0x9'),'membername':_0x56160c[_0xa7e9('0xa')],'interface':_[_0xa7e9('0xb')](_0x56160c[_0xa7e9('0xc')])?util[_0xa7e9('0xd')]('SIP/%s',_0x56160c[_0xa7e9('0xa')]):_0x56160c[_0xa7e9('0xc')],'type':_0xa7e9('0xe'),'enterAt':_0x56160c[_0xa7e9('0xf')],'exitAt':_0x3e02fc,'duration':moment(_0x3e02fc)[_0xa7e9('0x10')](_0x56160c[_0xa7e9('0xf')],_0xa7e9('0x11')),'data1':_0xa7e9('0x12'),'data2':_0x56160c[_0xa7e9('0x13')],'data3':_0x56160c['exten'],'data4':null,'data5':_0x56160c['queue'],'role':_0xa7e9('0x14'),'internal':_0x56160c[_0xa7e9('0x15')]?_[_0xa7e9('0x16')](_0x56160c['accountcode']):undefined,'uniqueid':_0x56160c[_0xa7e9('0x17')]},'log':'CreateMemberReport'});};exports[_0xa7e9('0x18')]=function(_0x36a410){return client['Request']('CreateMemberReport',{'body':{'channel':_0xa7e9('0x9'),'membername':_0x36a410[_0xa7e9('0x19')],'interface':_0x36a410[_0xa7e9('0xc')],'type':_0xa7e9('0xe'),'enterAt':_0x36a410['starttime'],'exitAt':_0x36a410[_0xa7e9('0x1a')],'duration':moment(_0x36a410[_0xa7e9('0x1a')])[_0xa7e9('0x10')](_0x36a410[_0xa7e9('0x1b')],_0xa7e9('0x11'))>=0x0?moment(_0x36a410[_0xa7e9('0x1a')])[_0xa7e9('0x10')](_0x36a410[_0xa7e9('0x1b')],'seconds'):null,'data1':'outbound','data2':_0x36a410[_0xa7e9('0x15')],'data3':_0x36a410[_0xa7e9('0x1c')],'data4':_0x36a410[_0xa7e9('0x1d')]||null,'role':_0xa7e9('0x14'),'internal':_0x36a410[_0xa7e9('0x15')]?_[_0xa7e9('0x16')](_0x36a410[_0xa7e9('0x15')]):undefined,'uniqueid':_0x36a410['uniqueid']},'log':_0xa7e9('0x8')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index a502cdd..31ffcc8 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 _0xa446=['ShowSetting','GetSettings','../client','getSettings'];(function(_0x429f34,_0xcc4f25){var _0x4b0b95=function(_0x5f597c){while(--_0x5f597c){_0x429f34['push'](_0x429f34['shift']());}};_0x4b0b95(++_0xcc4f25);}(_0xa446,0xc6));var _0x6a44=function(_0x2a3c11,_0x1813e7){_0x2a3c11=_0x2a3c11-0x0;var _0x475f14=_0xa446[_0x2a3c11];return _0x475f14;};'use strict';var client=require(_0x6a44('0x0'));exports[_0x6a44('0x1')]=function(){return client['Request'](_0x6a44('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer']},'log':_0x6a44('0x3')});}; \ No newline at end of file +var _0x8128=['stopRecordingOnTransfer','../client','ShowSetting'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8128,0x1b1));var _0x8812=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x8128[_0x3bf83f];return _0x22c4a9;};'use strict';var client=require(_0x8812('0x0'));exports['getSettings']=function(){return client['Request'](_0x8812('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x8812('0x2')]},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 2031ff2..cf09bd8 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 _0xbc6f=['GetTemplate','getTemplates','name'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbc6f,0x166));var _0xfbc6=function(_0x409b87,_0x5ef488){_0x409b87=_0x409b87-0x0;var _0x46fa68=_0xbc6f[_0x409b87];return _0x46fa68;};'use strict';var client=require('../client');exports[_0xfbc6('0x0')]=function(_0x5e563d){return function(_0xc07226){return client['Request']('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0xfbc6('0x1'),'html']},'log':_0xfbc6('0x2')});};}; \ No newline at end of file +var _0x025e=['name','html','../client','GetTemplate'];(function(_0x119e18,_0x315f50){var _0x4255c7=function(_0x42a5f3){while(--_0x42a5f3){_0x119e18['push'](_0x119e18['shift']());}};_0x4255c7(++_0x315f50);}(_0x025e,0x116));var _0xe025=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0x025e[_0x1ccdf7];return _0x52a0ae;};'use strict';var client=require(_0xe025('0x0'));exports['getTemplates']=function(_0x73e587){return function(_0x107102){return client['Request'](_0xe025('0x1'),{'options':{'raw':!![],'attributes':['id',_0xe025('0x2'),_0xe025('0x3')]},'log':_0xe025('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 974da3f..474705c 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 _0xdf3e=['field','operator','value','Action','Actions','action','data1','data2','data3','data4','data7','getTriggers','Request','GetTrigger','name','channel','status','Condition','AllConditions'];(function(_0x5970b4,_0x3e811f){var _0x6dcd71=function(_0x16e92a){while(--_0x16e92a){_0x5970b4['push'](_0x5970b4['shift']());}};_0x6dcd71(++_0x3e811f);}(_0xdf3e,0x14e));var _0xedf3=function(_0x19d151,_0x1083ef){_0x19d151=_0x19d151-0x0;var _0x6fed3c=_0xdf3e[_0x19d151];return _0x6fed3c;};'use strict';var client=require('../client');exports[_0xedf3('0x0')]=function(_0x14b7b9){return function(_0x264d77){return client[_0xedf3('0x1')](_0xedf3('0x2'),{'options':{'raw':![],'attributes':['id',_0xedf3('0x3'),_0xedf3('0x4'),_0xedf3('0x5')],'include':[{'model':_0xedf3('0x6'),'as':_0xedf3('0x7'),'attributes':['id',_0xedf3('0x8'),_0xedf3('0x9'),_0xedf3('0xa')]},{'model':_0xedf3('0x6'),'as':'AnyConditions','attributes':['id',_0xedf3('0x8'),_0xedf3('0x9'),'value']},{'model':_0xedf3('0xb'),'as':_0xedf3('0xc'),'attributes':['id',_0xedf3('0xd'),_0xedf3('0xe'),_0xedf3('0xf'),_0xedf3('0x10'),_0xedf3('0x11'),'data5','data6',_0xedf3('0x12')]}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0x4cc3=['name','Condition','AllConditions','operator','value','AnyConditions','field','Action','Actions','action','data1','data4','data5','data6','data7','getTriggers','Request'];(function(_0x422abe,_0x7dafa4){var _0x358262=function(_0x2fe112){while(--_0x2fe112){_0x422abe['push'](_0x422abe['shift']());}};_0x358262(++_0x7dafa4);}(_0x4cc3,0x1c9));var _0x34cc=function(_0x6aa778,_0x1af314){_0x6aa778=_0x6aa778-0x0;var _0x3b4979=_0x4cc3[_0x6aa778];return _0x3b4979;};'use strict';var client=require('../client');exports[_0x34cc('0x0')]=function(_0x212426){return function(_0xf2ab9a){return client[_0x34cc('0x1')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x34cc('0x2'),'channel','status'],'include':[{'model':_0x34cc('0x3'),'as':_0x34cc('0x4'),'attributes':['id','field',_0x34cc('0x5'),_0x34cc('0x6')]},{'model':_0x34cc('0x3'),'as':_0x34cc('0x7'),'attributes':['id',_0x34cc('0x8'),_0x34cc('0x5'),_0x34cc('0x6')]},{'model':_0x34cc('0x9'),'as':_0x34cc('0xa'),'attributes':['id',_0x34cc('0xb'),_0x34cc('0xc'),'data2','data3',_0x34cc('0xd'),_0x34cc('0xe'),_0x34cc('0xf'),_0x34cc('0x10')]}]},'log':'GetTrigger'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 6f0b736..5550777 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 _0x5e67=['../client','getTrunks','Request','GetTrunk','name','registry','defaultuser'];(function(_0x484c03,_0x13c1d2){var _0x294127=function(_0x45a834){while(--_0x45a834){_0x484c03['push'](_0x484c03['shift']());}};_0x294127(++_0x13c1d2);}(_0x5e67,0x70));var _0x75e6=function(_0x4a76a5,_0x57f05f){_0x4a76a5=_0x4a76a5-0x0;var _0x5f504f=_0x5e67[_0x4a76a5];return _0x5f504f;};'use strict';var client=require(_0x75e6('0x0'));exports[_0x75e6('0x1')]=function(_0x39975f){return function(_0x307d03){return client[_0x75e6('0x2')](_0x75e6('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x75e6('0x4'),_0x75e6('0x5'),_0x75e6('0x6')]},'log':_0x75e6('0x3')});};}; \ No newline at end of file +var _0xcd7c=['name','defaultuser','../client','getTrunks','Request','GetTrunk'];(function(_0x3665dd,_0x4b86e0){var _0x35e9e9=function(_0xac9cca){while(--_0xac9cca){_0x3665dd['push'](_0x3665dd['shift']());}};_0x35e9e9(++_0x4b86e0);}(_0xcd7c,0x104));var _0xccd7=function(_0x24d06f,_0x4ccefd){_0x24d06f=_0x24d06f-0x0;var _0x5e062a=_0xcd7c[_0x24d06f];return _0x5e062a;};'use strict';var client=require(_0xccd7('0x0'));exports[_0xccd7('0x1')]=function(_0x582c86){return function(_0x2a1bc5){return client[_0xccd7('0x2')](_0xccd7('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xccd7('0x4'),'registry',_0xccd7('0x5')]},'log':_0xccd7('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 27aa493..7595888 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(_0x15cec8,_0xe1e48){var _0x4d276c=function(_0x56b360){while(--_0x56b360){_0x15cec8['push'](_0x15cec8['shift']());}};_0x4d276c(++_0xe1e48);}(_0xedd9,0xfc));var _0x9edd=function(_0x4d3c73,_0xddab49){_0x4d3c73=_0x4d3c73-0x0;var _0x1d5745=_0xedd9[_0x4d3c73];return _0x1d5745;};'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 _0x70e0=['getAgents','Request','name','email','accountcode','fullname','lastLoginAt','lastPauseAt','interface','getTelephones','GetUser','telephone','savePause','PauseUser','saveUnpause','getAgent','agent','online','pauseType','../client'];(function(_0x327f4a,_0x3176a4){var _0x546bf2=function(_0x5467ea){while(--_0x5467ea){_0x327f4a['push'](_0x327f4a['shift']());}};_0x546bf2(++_0x3176a4);}(_0x70e0,0x17b));var _0x070e=function(_0x1abcc6,_0x96ae49){_0x1abcc6=_0x1abcc6-0x0;var _0x36872f=_0x70e0[_0x1abcc6];return _0x36872f;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5'),_0x070e('0x6'),'online',_0x070e('0x7'),'pauseType',_0x070e('0x8'),'voicePause','phone','mobile',_0x070e('0x9')]},'log':_0x070e('0x1')});};};exports[_0x070e('0xa')]=function(){return function(){return client[_0x070e('0x2')](_0x070e('0xb'),{'options':{'raw':!![],'where':{'role':_0x070e('0xc')},'attributes':['id',_0x070e('0x3'),'accountcode','internal']},'log':_0x070e('0xa')});};};exports[_0x070e('0xd')]=function(_0x12bb37,_0xb8d819,_0xa927a2){return client[_0x070e('0x2')](_0x070e('0xe'),{'body':{'type':_0xb8d819,'uniqueid':_0xa927a2},'options':{'where':{'id':_0x12bb37['id']}},'log':_0x070e('0xd')});};exports[_0x070e('0xf')]=function(_0x5bf079){return client[_0x070e('0x2')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5bf079['id']}},'log':'savePause'});};exports[_0x070e('0x10')]=function(_0x56c7ba){return client['Request']('ShowUser',{'options':{'raw':![],'where':{'role':_0x070e('0x11'),'id':_0x56c7ba},'attributes':['id',_0x070e('0x3'),'email','accountcode',_0x070e('0x6'),_0x070e('0x12'),_0x070e('0x7'),_0x070e('0x13'),'lastPauseAt','voicePause',_0x070e('0x9')]},'log':_0x070e('0x10')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index a3c960d..bc5a9e7 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 _0x8ecd=['UpdateVoiceAgentReport','../client','Request','CreateVoiceAgentReport','update'];(function(_0x5e8981,_0x5ad60b){var _0x5a65ab=function(_0x328645){while(--_0x328645){_0x5e8981['push'](_0x5e8981['shift']());}};_0x5a65ab(++_0x5ad60b);}(_0x8ecd,0x123));var _0xd8ec=function(_0x1bd822,_0x1c8078){_0x1bd822=_0x1bd822-0x0;var _0x3c3a69=_0x8ecd[_0x1bd822];return _0x3c3a69;};'use strict';var client=require(_0xd8ec('0x0'));exports['create']=function(_0x5ce2c0){return client[_0xd8ec('0x1')](_0xd8ec('0x2'),{'body':_0x5ce2c0,'log':_0xd8ec('0x2')});};exports[_0xd8ec('0x3')]=function(_0x266c38,_0x292cab,_0x546fd0){return client['Request'](_0xd8ec('0x4'),{'body':_0x266c38,'options':{'where':{'uniqueid':_0x292cab,'interface':_0x546fd0,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file +var _0xec83=['../client','create','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport'];(function(_0x11ce46,_0x177a85){var _0x368a1e=function(_0x425454){while(--_0x425454){_0x11ce46['push'](_0x11ce46['shift']());}};_0x368a1e(++_0x177a85);}(_0xec83,0x10e));var _0x3ec8=function(_0x5d1044,_0x18f656){_0x5d1044=_0x5d1044-0x0;var _0x3cd90e=_0xec83[_0x5d1044];return _0x3cd90e;};'use strict';var client=require(_0x3ec8('0x0'));exports[_0x3ec8('0x1')]=function(_0x870458){return client[_0x3ec8('0x2')](_0x3ec8('0x3'),{'body':_0x870458,'log':_0x3ec8('0x3')});};exports[_0x3ec8('0x4')]=function(_0x5895f5,_0x2726e3,_0x26603a){return client[_0x3ec8('0x2')]('UpdateVoiceAgentReport',{'body':_0x5895f5,'options':{'where':{'uniqueid':_0x2726e3,'interface':_0x26603a,'agentcomplete':!![]}},'log':_0x3ec8('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 822164d..44afb47 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 _0xa8a0=['startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','day','type','disposition','duration','GetVoiceCallReports','moment','lodash','../client','create','merge','calleridnum','context','DOCUMENTATION','CreateVoiceCallReport','getVoiceCallReports','Request','outbound'];(function(_0x2095e7,_0x11d0f3){var _0x2b4d1a=function(_0x15da37){while(--_0x15da37){_0x2095e7['push'](_0x2095e7['shift']());}};_0x2b4d1a(++_0x11d0f3);}(_0xa8a0,0x105));var _0x0a8a=function(_0x57bfae,_0x49c707){_0x57bfae=_0x57bfae-0x0;var _0x181f04=_0xa8a0[_0x57bfae];return _0x181f04;};'use strict';var moment=require(_0x0a8a('0x0'));var util=require('util');var _=require(_0x0a8a('0x1'));var client=require(_0x0a8a('0x2'));exports[_0x0a8a('0x3')]=function(_0x2dd191){return client['Request']('CreateVoiceCallReport',{'body':_[_0x0a8a('0x4')](_0x2dd191,{'source':_0x2dd191[_0x0a8a('0x5')],'destinationcontext':_0x2dd191[_0x0a8a('0x6')],'callerid':_0x2dd191['callerid'],'amaflags':_0x0a8a('0x7')}),'log':_0x0a8a('0x8')});};exports[_0x0a8a('0x9')]=function(){return function(){return client[_0x0a8a('0xa')]('GetVoiceCallReport',{'options':{'where':{'type':[_0x0a8a('0xb')],'createdAt':{'$between':[moment()[_0x0a8a('0xc')]('day')[_0x0a8a('0xd')](_0x0a8a('0xe')),moment()[_0x0a8a('0xf')](_0x0a8a('0x10'))['format']('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x0a8a('0x11'),_0x0a8a('0x12'),_0x0a8a('0x13'),'billableseconds']},'log':_0x0a8a('0x14')});};}; \ No newline at end of file +var _0x26e3=['CreateVoiceCallReport','merge','calleridnum','callerid','getVoiceCallReports','Request','GetVoiceCallReport','outbound','startOf','day','format','endOf','YYYY-MM-DD\x20HH:mm:ss','type','disposition','GetVoiceCallReports','../client','create'];(function(_0x2b74de,_0x195eb1){var _0x162415=function(_0x4f7004){while(--_0x4f7004){_0x2b74de['push'](_0x2b74de['shift']());}};_0x162415(++_0x195eb1);}(_0x26e3,0x6a));var _0x326e=function(_0x221b8c,_0x2c7afc){_0x221b8c=_0x221b8c-0x0;var _0x3fab9f=_0x26e3[_0x221b8c];return _0x3fab9f;};'use strict';var moment=require('moment');var util=require('util');var _=require('lodash');var client=require(_0x326e('0x0'));exports[_0x326e('0x1')]=function(_0x31408e){return client['Request'](_0x326e('0x2'),{'body':_[_0x326e('0x3')](_0x31408e,{'source':_0x31408e[_0x326e('0x4')],'destinationcontext':_0x31408e['context'],'callerid':_0x31408e[_0x326e('0x5')],'amaflags':'DOCUMENTATION'}),'log':'CreateVoiceCallReport'});};exports[_0x326e('0x6')]=function(){return function(){return client[_0x326e('0x7')](_0x326e('0x8'),{'options':{'where':{'type':[_0x326e('0x9')],'createdAt':{'$between':[moment()[_0x326e('0xa')](_0x326e('0xb'))[_0x326e('0xc')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x326e('0xd')](_0x326e('0xb'))[_0x326e('0xc')](_0x326e('0xe'))]}},'attributes':[_0x326e('0xf'),_0x326e('0x10'),'duration','billableseconds']},'log':_0x326e('0x11')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index acdcea7..9064e16 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 _0x9346=['Request','create'];(function(_0x24696b,_0x12de19){var _0x3f86b0=function(_0x11f2eb){while(--_0x11f2eb){_0x24696b['push'](_0x24696b['shift']());}};_0x3f86b0(++_0x12de19);}(_0x9346,0xd1));var _0x6934=function(_0x18498c,_0x25c3fd){_0x18498c=_0x18498c-0x0;var _0x23f9d5=_0x9346[_0x18498c];return _0x23f9d5;};'use strict';var client=require('../client');exports[_0x6934('0x0')]=function(_0x18d97b){return client[_0x6934('0x1')]('CreateVoiceDialReport',{'body':_0x18d97b,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0x2c1e=['Request','CreateVoiceDialReport','create'];(function(_0x59c1c3,_0x1de385){var _0x293608=function(_0x3b2a1d){while(--_0x3b2a1d){_0x59c1c3['push'](_0x59c1c3['shift']());}};_0x293608(++_0x1de385);}(_0x2c1e,0x1c4));var _0xe2c1=function(_0x2c57a4,_0x168ff4){_0x2c57a4=_0x2c57a4-0x0;var _0x189879=_0x2c1e[_0x2c57a4];return _0x189879;};'use strict';var client=require('../client');exports[_0xe2c1('0x0')]=function(_0x4ee34){return client[_0xe2c1('0x1')](_0xe2c1('0x2'),{'body':_0x4ee34,'log':_0xe2c1('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 4094774..a8a71e6 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 _0xac55=['recordingFormat','../client','getVoiceExtensions','Request','GetVoiceExtension'];(function(_0x5b7a18,_0x314b62){var _0x5b982c=function(_0x556edf){while(--_0x556edf){_0x5b7a18['push'](_0x5b7a18['shift']());}};_0x5b982c(++_0x314b62);}(_0xac55,0x1c8));var _0x5ac5=function(_0x450aa5,_0x1c26b9){_0x450aa5=_0x450aa5-0x0;var _0x15557b=_0xac55[_0x450aa5];return _0x15557b;};'use strict';var client=require(_0x5ac5('0x0'));exports[_0x5ac5('0x1')]=function(){return function(){return client[_0x5ac5('0x2')](_0x5ac5('0x3'),{'options':{'raw':!![],'attributes':['id','exten',_0x5ac5('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x5ac5('0x1')});};}; \ No newline at end of file +var _0x8c38=['recordingFormat','../client','getVoiceExtensions','GetVoiceExtension','exten'];(function(_0x199edc,_0x3d8798){var _0x31c828=function(_0x1dcf55){while(--_0x1dcf55){_0x199edc['push'](_0x199edc['shift']());}};_0x31c828(++_0x3d8798);}(_0x8c38,0x83));var _0x88c3=function(_0x357845,_0x2f1576){_0x357845=_0x357845-0x0;var _0x54cdca=_0x8c38[_0x357845];return _0x54cdca;};'use strict';var client=require(_0x88c3('0x0'));exports[_0x88c3('0x1')]=function(){return function(){return client['Request'](_0x88c3('0x2'),{'options':{'raw':!![],'attributes':['id',_0x88c3('0x3'),_0x88c3('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x88c3('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 3cdec37..9dfa166 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 _0xc05b=['dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','Pause','TrunkBackup','Interval','Intervals','getVoiceQueues','Request','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords'];(function(_0x2f3ec1,_0x4b5e03){var _0x329dec=function(_0x3e2cb6){while(--_0x3e2cb6){_0x2f3ec1['push'](_0x2f3ec1['shift']());}};_0x329dec(++_0x4b5e03);}(_0xc05b,0xd3));var _0xbc05=function(_0x1911ed,_0x4e8c73){_0x1911ed=_0x1911ed-0x0;var _0x11edaa=_0xc05b[_0x1911ed];return _0x11edaa;};'use strict';var client=require('../client');exports[_0xbc05('0x0')]=function(){return function(){return client[_0xbc05('0x1')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0xbc05('0x2'),_0xbc05('0x3'),_0xbc05('0x4'),_0xbc05('0x5'),_0xbc05('0x6'),_0xbc05('0x7'),_0xbc05('0x8'),_0xbc05('0x9'),'dialLimitChannel',_0xbc05('0xa'),_0xbc05('0xb'),_0xbc05('0xc'),'dialPredictiveOptimizationPercentage',_0xbc05('0xd'),_0xbc05('0xe'),_0xbc05('0xf'),_0xbc05('0x10'),'dialQueueOptions','dialQueueTimeout',_0xbc05('0x11'),'dialCongestionMaxRetry',_0xbc05('0x12'),_0xbc05('0x13'),_0xbc05('0x14'),'dialNoAnswerMaxRetry',_0xbc05('0x15'),_0xbc05('0x16'),_0xbc05('0x17'),_0xbc05('0x18'),_0xbc05('0x19'),_0xbc05('0x1a'),_0xbc05('0x1b'),'dialAMDInitialSilence',_0xbc05('0x1c'),_0xbc05('0x1d'),_0xbc05('0x1e'),'dialAMDMinWordLength',_0xbc05('0x1f'),_0xbc05('0x20'),_0xbc05('0x21'),_0xbc05('0x22'),_0xbc05('0x23'),_0xbc05('0x24'),_0xbc05('0x25'),_0xbc05('0x26'),_0xbc05('0x27'),'dialAgiAfterHangupClient',_0xbc05('0x28'),'monitor_format','strategy',_0xbc05('0x29'),'dialCutDigit',_0xbc05('0x2a'),_0xbc05('0x2b'),_0xbc05('0x2c'),_0xbc05('0x2d'),_0xbc05('0x2e'),_0xbc05('0x2f'),'dialMachineMaxRetry',_0xbc05('0x30'),_0xbc05('0x31'),_0xbc05('0x32'),_0xbc05('0x33'),_0xbc05('0x34'),_0xbc05('0x35')],'include':[{'model':_0xbc05('0x36'),'as':_0xbc05('0x36'),'attributes':['id',_0xbc05('0x2'),_0xbc05('0x37'),_0xbc05('0x38')]},{'model':_0xbc05('0x39'),'as':'mandatoryDispositionPause','attributes':['id',_0xbc05('0x2')]},{'model':_0xbc05('0x36'),'as':_0xbc05('0x3a'),'attributes':['id',_0xbc05('0x2'),'callerid',_0xbc05('0x38')]},{'model':'Interval','as':'Interval','attributes':['id',_0xbc05('0x2')],'include':[{'model':_0xbc05('0x3b'),'as':_0xbc05('0x3c'),'attributes':['id',_0xbc05('0x2'),'interval']}]}]},'log':_0xbc05('0x0')});};}; \ No newline at end of file +var _0x69bd=['dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','monitor_format','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','Trunk','callerid','active','Pause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','dialMethod','dialLimitChannel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialTimezone','dialGlobalInterval','dialCheckDuplicateType','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout'];(function(_0x37c8ef,_0x334449){var _0x5eaee9=function(_0x4b1b98){while(--_0x4b1b98){_0x37c8ef['push'](_0x37c8ef['shift']());}};_0x5eaee9(++_0x334449);}(_0x69bd,0xc9));var _0xd69b=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x69bd[_0x422905];return _0x33dc6c;};'use strict';var client=require(_0xd69b('0x0'));exports[_0xd69b('0x1')]=function(){return function(){return client[_0xd69b('0x2')](_0xd69b('0x3'),{'options':{'raw':![],'attributes':['id',_0xd69b('0x4'),_0xd69b('0x5'),'acwTimeout','autopause','monitor_format','type','dialActive',_0xd69b('0x6'),_0xd69b('0x7'),'dialLimitQueue','dialPowerLevel',_0xd69b('0x8'),'dialPredictiveOptimizationPercentage',_0xd69b('0x9'),_0xd69b('0xa'),_0xd69b('0xb'),_0xd69b('0xc'),_0xd69b('0xd'),_0xd69b('0xe'),_0xd69b('0xf'),_0xd69b('0x10'),'dialCongestionRetryFrequency',_0xd69b('0x11'),_0xd69b('0x12'),'dialNoAnswerMaxRetry',_0xd69b('0x13'),'dialGlobalMaxRetry',_0xd69b('0x14'),_0xd69b('0x15'),'dialPrefix',_0xd69b('0x16'),_0xd69b('0x17'),'dialAMDInitialSilence',_0xd69b('0x18'),_0xd69b('0x19'),'dialAMDTotalAnalysisTime','dialAMDMinWordLength',_0xd69b('0x1a'),_0xd69b('0x1b'),_0xd69b('0x1c'),_0xd69b('0x1d'),_0xd69b('0x1e'),_0xd69b('0x1f'),_0xd69b('0x20'),_0xd69b('0x21'),_0xd69b('0x22'),_0xd69b('0x23'),_0xd69b('0x24'),_0xd69b('0x25'),_0xd69b('0x26'),_0xd69b('0x27'),_0xd69b('0x28'),_0xd69b('0x29'),_0xd69b('0x2a'),'dialDropMaxRetry',_0xd69b('0x2b'),_0xd69b('0x2c'),'dialAbandonedRetryFrequency','dialMachineMaxRetry',_0xd69b('0x2d'),_0xd69b('0x2e'),_0xd69b('0x2f'),_0xd69b('0x30'),_0xd69b('0x31'),'dialPredictiveIntervalMinThreshold'],'include':[{'model':_0xd69b('0x32'),'as':'Trunk','attributes':['id',_0xd69b('0x4'),_0xd69b('0x33'),_0xd69b('0x34')]},{'model':_0xd69b('0x35'),'as':'mandatoryDispositionPause','attributes':['id',_0xd69b('0x4')]},{'model':_0xd69b('0x32'),'as':_0xd69b('0x36'),'attributes':['id','name','callerid',_0xd69b('0x34')]},{'model':'Interval','as':'Interval','attributes':['id','name'],'include':[{'model':_0xd69b('0x37'),'as':_0xd69b('0x38'),'attributes':['id',_0xd69b('0x4'),_0xd69b('0x39')]}]}]},'log':_0xd69b('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index b58e133..b4132e1 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(_0x5dd665,_0x4c785c){var _0x1da969=function(_0x1a3159){while(--_0x1a3159){_0x5dd665['push'](_0x5dd665['shift']());}};_0x1da969(++_0x4c785c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'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(_0x427de6,_0x76fbe5){var _0x263970=function(_0x1d69fd){while(--_0x1d69fd){_0x427de6['push'](_0x427de6['shift']());}};_0x263970(++_0x76fbe5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'use strict';var moment=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var client=require(_0x0a9e('0x2'));exports['create']=function(_0x550fbc){return client[_0x0a9e('0x3')]('CreateVoiceQueueReport',{'body':_0x550fbc,'log':_0x0a9e('0x4')});};exports[_0x0a9e('0x5')]=function(){return function(){return client[_0x0a9e('0x3')](_0x0a9e('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x0a9e('0x7')]('day')[_0x0a9e('0x8')](_0x0a9e('0x9')),moment()[_0x0a9e('0xa')]('day')['format'](_0x0a9e('0x9'))]}},'attributes':['uniqueid','queue',_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),_0x0a9e('0x10'),'queuecallerabandon','queuecallerabandonAt']},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index 15dd9b7..86ba9eb 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 _0xda61=['../client','GetVoiceQueueRtPauses','getVoiceQueueRtPauses'];(function(_0x1ced86,_0x4ae677){var _0x4f82f8=function(_0x4e5fb6){while(--_0x4e5fb6){_0x1ced86['push'](_0x1ced86['shift']());}};_0x4f82f8(++_0x4ae677);}(_0xda61,0x16b));var _0x1da6=function(_0x29f181,_0x1b3f8a){_0x29f181=_0x29f181-0x0;var _0x1f5580=_0xda61[_0x29f181];return _0x1f5580;};'use strict';var client=require(_0x1da6('0x0'));exports['getVoiceQueueRtPauses']=function(_0x22f2d9){return function(){return client['Request'](_0x1da6('0x1'),{'options':{'where':{'VoiceQueueId':_0x22f2d9,'paused':!![]},'raw':!![]},'log':_0x1da6('0x2')});};}; \ No newline at end of file +var _0xe9a3=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses','Request'];(function(_0x57c1de,_0x3ee720){var _0x33f233=function(_0x5345e0){while(--_0x5345e0){_0x57c1de['push'](_0x57c1de['shift']());}};_0x33f233(++_0x3ee720);}(_0xe9a3,0x1e9));var _0x3e9a=function(_0x181151,_0x1fab2a){_0x181151=_0x181151-0x0;var _0x363870=_0xe9a3[_0x181151];return _0x363870;};'use strict';var client=require(_0x3e9a('0x0'));exports[_0x3e9a('0x1')]=function(_0x5beb2e){return function(){return client[_0x3e9a('0x2')](_0x3e9a('0x3'),{'options':{'where':{'VoiceQueueId':_0x5beb2e,'paused':!![]},'raw':!![]},'log':_0x3e9a('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 6ad1cc4..51d605c 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 _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x2ff4b5,_0x25802b){var _0x4dfd3e=function(_0x2e0302){while(--_0x2e0302){_0x2ff4b5['push'](_0x2ff4b5['shift']());}};_0x4dfd3e(++_0x25802b);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x383c19,_0x1c7208){var _0x2498d3=function(_0x41bbc3){while(--_0x41bbc3){_0x383c19['push'](_0x383c19['shift']());}};_0x2498d3(++_0x1c7208);}(_0x7a54,0x106));var _0x47a5=function(_0x4b9e9c,_0x31c23f){_0x4b9e9c=_0x4b9e9c-0x0;var _0x18197c=_0x7a54[_0x4b9e9c];return _0x18197c;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 6a567c0..e452f45 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 _0x559e=['origtransferercontext','attended','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transfererlinkedid','transfereecalleridnum','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','context','blind','attendedTransfer','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetcalleridnum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','isexternal'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0x559e,0xac));var _0xe559=function(_0x53630a,_0x397751){_0x53630a=_0x53630a-0x0;var _0x5c5606=_0x559e[_0x53630a];return _0x5c5606;};'use strict';var client=require('../client');exports['transfers']={};exports[_0xe559('0x0')]=function(_0x1b7d6d){return client[_0xe559('0x1')](_0xe559('0x2'),{'body':{'result':_0x1b7d6d[_0xe559('0x3')],'transfererchannel':_0x1b7d6d[_0xe559('0x4')],'transferercalleridnum':_0x1b7d6d['transferercalleridnum'],'transferercalleridname':_0x1b7d6d[_0xe559('0x5')],'transfererconnectedlinenum':_0x1b7d6d[_0xe559('0x6')],'transfererconnectedlinename':_0x1b7d6d[_0xe559('0x7')],'transfereraccountcode':_0x1b7d6d[_0xe559('0x8')],'transferercontext':_0x1b7d6d['transferercontext'],'transfererexten':_0x1b7d6d['transfererexten'],'transfererlinkedid':_0x1b7d6d[_0xe559('0x9')],'transfereechannel':_0x1b7d6d['transfereechannel'],'transfereecalleridnum':_0x1b7d6d[_0xe559('0xa')],'transfereecalleridname':_0x1b7d6d['transfereecalleridname'],'transfereeconnectedlinenum':_0x1b7d6d[_0xe559('0xb')],'transfereeconnectedlinename':_0x1b7d6d[_0xe559('0xc')],'transfereeaccountcode':_0x1b7d6d[_0xe559('0xd')],'transfereecontext':_0x1b7d6d[_0xe559('0xe')],'transfereeexten':_0x1b7d6d[_0xe559('0xf')],'transfereelinkedid':_0x1b7d6d['transfereelinkedid'],'isexternal':_0x1b7d6d['isexternal'],'context':_0x1b7d6d[_0xe559('0x10')],'extension':_0x1b7d6d['extension'],'type':_0xe559('0x11')},'log':_0xe559('0x2')});};exports[_0xe559('0x12')]=function(_0x2ac2f9){return client['Request'](_0xe559('0x2'),{'body':{'result':_0x2ac2f9[_0xe559('0x3')],'transfererchannel':_0x2ac2f9[_0xe559('0x13')],'transferercalleridnum':_0x2ac2f9['origtransferercalleridnum'],'transferercalleridname':_0x2ac2f9[_0xe559('0x14')],'transfererconnectedlinenum':_0x2ac2f9[_0xe559('0x15')],'transfererconnectedlinename':_0x2ac2f9['secondtransfererconnectedlinename'],'transfereraccountcode':_0x2ac2f9[_0xe559('0x16')],'transferercontext':_0x2ac2f9[_0xe559('0x17')],'transfererexten':_0x2ac2f9[_0xe559('0x18')],'transfererlinkedid':_0x2ac2f9[_0xe559('0x19')],'transfereechannel':_0x2ac2f9['transfertargetchannel'],'transfereecalleridnum':_0x2ac2f9[_0xe559('0x1a')],'transfereecalleridname':_0x2ac2f9['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x2ac2f9['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x2ac2f9[_0xe559('0x1b')],'transfereeaccountcode':_0x2ac2f9[_0xe559('0x1c')],'transfereecontext':_0x2ac2f9[_0xe559('0x1d')],'transfereeexten':_0x2ac2f9['transfertargetexten'],'transfereelinkedid':_0x2ac2f9[_0xe559('0x1e')],'isexternal':_0x2ac2f9[_0xe559('0x1f')],'context':_0x2ac2f9[_0xe559('0x20')],'extension':_0x2ac2f9['origtransfererexten'],'type':_0xe559('0x21')},'log':_0xe559('0x2')});}; \ No newline at end of file +var _0x90f4=['transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','origtransferercontext','attended','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereecalleridname','transfereeconnectedlinename','transfereeaccountcode','transfereelinkedid','isexternal','context','extension','blind','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','transfertargetchannel'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x90f4,0xb0));var _0x490f=function(_0x18d9bb,_0x46e4ab){_0x18d9bb=_0x18d9bb-0x0;var _0x2dd06f=_0x90f4[_0x18d9bb];return _0x2dd06f;};'use strict';var client=require('../client');exports['transfers']={};exports[_0x490f('0x0')]=function(_0x42b7e2){return client[_0x490f('0x1')](_0x490f('0x2'),{'body':{'result':_0x42b7e2[_0x490f('0x3')],'transfererchannel':_0x42b7e2[_0x490f('0x4')],'transferercalleridnum':_0x42b7e2[_0x490f('0x5')],'transferercalleridname':_0x42b7e2[_0x490f('0x6')],'transfererconnectedlinenum':_0x42b7e2[_0x490f('0x7')],'transfererconnectedlinename':_0x42b7e2[_0x490f('0x8')],'transfereraccountcode':_0x42b7e2[_0x490f('0x9')],'transferercontext':_0x42b7e2[_0x490f('0xa')],'transfererexten':_0x42b7e2[_0x490f('0xb')],'transfererlinkedid':_0x42b7e2[_0x490f('0xc')],'transfereechannel':_0x42b7e2['transfereechannel'],'transfereecalleridnum':_0x42b7e2['transfereecalleridnum'],'transfereecalleridname':_0x42b7e2[_0x490f('0xd')],'transfereeconnectedlinenum':_0x42b7e2['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x42b7e2[_0x490f('0xe')],'transfereeaccountcode':_0x42b7e2[_0x490f('0xf')],'transfereecontext':_0x42b7e2['transfereecontext'],'transfereeexten':_0x42b7e2['transfereeexten'],'transfereelinkedid':_0x42b7e2[_0x490f('0x10')],'isexternal':_0x42b7e2[_0x490f('0x11')],'context':_0x42b7e2[_0x490f('0x12')],'extension':_0x42b7e2[_0x490f('0x13')],'type':_0x490f('0x14')},'log':_0x490f('0x2')});};exports['attendedTransfer']=function(_0xeb7e48){return client[_0x490f('0x1')](_0x490f('0x2'),{'body':{'result':_0xeb7e48[_0x490f('0x3')],'transfererchannel':_0xeb7e48[_0x490f('0x15')],'transferercalleridnum':_0xeb7e48[_0x490f('0x16')],'transferercalleridname':_0xeb7e48[_0x490f('0x17')],'transfererconnectedlinenum':_0xeb7e48['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0xeb7e48[_0x490f('0x18')],'transfereraccountcode':_0xeb7e48[_0x490f('0x19')],'transferercontext':_0xeb7e48[_0x490f('0x1a')],'transfererexten':_0xeb7e48['secondtransfererexten'],'transfererlinkedid':_0xeb7e48['origtransfererlinkedid'],'transfereechannel':_0xeb7e48[_0x490f('0x1b')],'transfereecalleridnum':_0xeb7e48['transfertargetcalleridnum'],'transfereecalleridname':_0xeb7e48['transfertargetcalleridname'],'transfereeconnectedlinenum':_0xeb7e48[_0x490f('0x1c')],'transfereeconnectedlinename':_0xeb7e48[_0x490f('0x1d')],'transfereeaccountcode':_0xeb7e48[_0x490f('0x1e')],'transfereecontext':_0xeb7e48[_0x490f('0x1f')],'transfereeexten':_0xeb7e48['transfertargetexten'],'transfereelinkedid':_0xeb7e48['transfertargetlinkedid'],'isexternal':_0xeb7e48[_0x490f('0x11')],'context':_0xeb7e48[_0x490f('0x20')],'extension':_0xeb7e48['origtransfererexten'],'type':_0x490f('0x21')},'log':_0x490f('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 387ae29..8b413cb 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 _0x2581=['predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','find','undefined','channels','voicechannel','uniqueid','channel','%s.%s','filename','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','rec','mixmonitorid','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','map','resolve','StopMixMonitor','destinationchannel','stop','wav','StopMixMonitor\x20Success','values','queueChannels','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','exten','context','telephones','trunks','outboundChannels','campaigns','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','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','timers','timer','updateAcw','agents','updateStatusRealtime','QueuePause','isConnected','error','asterisk','ami\x20disconnected','join','pick','keys','module','Reload','Action','then','message','catch','username','command','Command','content','voiceQueues','hasOwnProperty','name','strategy','answered','available','sumBillable','sumHoldTime','talking','type','unmanaged','abandoned','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout'];(function(_0xe624e8,_0x22e809){var _0x12127b=function(_0x5a14df){while(--_0x5a14df){_0xe624e8['push'](_0xe624e8['shift']());}};_0x12127b(++_0x22e809);}(_0x2581,0xcb));var _0x1258=function(_0x2e3da3,_0x5c1e2f){_0x2e3da3=_0x2e3da3-0x0;var _0x20ac77=_0x2581[_0x2e3da3];return _0x20ac77;};'use strict';var _=require(_0x1258('0x0'));var util=require(_0x1258('0x1'));var jayson=require(_0x1258('0x2'));var schema=require(_0x1258('0x3'));var BPromise=require(_0x1258('0x4'));var moment=require('moment');var config=require(_0x1258('0x5'));var properties=require(_0x1258('0x6'));var ami=require(_0x1258('0x7'));exports[_0x1258('0x8')]=function(_0x3ad6b0,_0x1a5749,_0x16c926){return new BPromise(function(_0x2aeafc,_0x582ed7){var _0x3e1044={'QueuePause':function(_0x21cd98){return new Promise(function(_0x468494,_0x18bbac){var _0x44be2b=util[_0x1258('0x9')](_0x1258('0xa'),'SIP',_0x21cd98['name']);if(_0x3ad6b0[_0x1258('0xb')]&&_0x3ad6b0[_0x1258('0xb')][_0x44be2b]&&_0x3ad6b0[_0x1258('0xb')][_0x44be2b][_0x1258('0xc')]){_0x3ad6b0['timers'][_0x44be2b][_0x1258('0xd')]();}if(_0x3ad6b0[_0x1258('0xe')][_0x44be2b]){_0x3ad6b0[_0x1258('0xe')][_0x44be2b][_0x1258('0xf')]({'statePause':_0x21cd98['pause']?!![]:![]});}_0x468494({'code':0xc8,'message':_0x1258('0x10')});});},'Reload':function(_0x3429d8){var _0x37fee3=this;return new Promise(function(_0x41b891,_0x2f9cd6){if(ami[_0x1258('0x11')]()==![]){return _0x2f9cd6(_0x37fee3[_0x1258('0x12')](0x1f4,[config['asterisk']['ip'],config[_0x1258('0x13')]['username'],_0x1258('0x14')][_0x1258('0x15')]('\x20')));}_0x3429d8=_[_0x1258('0x16')](_0x3429d8,_[_0x1258('0x17')](properties[_0x1258('0x18')]));_0x3429d8['action']=_0x1258('0x19');return ami[_0x1258('0x1a')](_0x3429d8)[_0x1258('0x1b')](function(_0x55f1dc){_0x41b891({'code':0xc8,'message':_0x55f1dc[_0x1258('0x1c')]});})[_0x1258('0x1d')](function(_0x55c458){_0x2f9cd6(_0x37fee3[_0x1258('0x12')](0x1f5,_0x55c458[_0x1258('0x1c')]));});});},'Command':function(_0x2d3327){var _0xb0b379=this;return new Promise(function(_0x24074b,_0xa06403){if(ami[_0x1258('0x11')]()==![]){return _0xa06403(_0xb0b379[_0x1258('0x12')](0x1f4,[config[_0x1258('0x13')]['ip'],config[_0x1258('0x13')][_0x1258('0x1e')],_0x1258('0x14')][_0x1258('0x15')]('\x20')));}_0x2d3327=_[_0x1258('0x16')](_0x2d3327,_0x1258('0x1f'));_0x2d3327['action']=_0x1258('0x20');return ami['Action'](_0x2d3327)['then'](function(_0x4bdf96){_0x24074b({'code':0xc8,'message':_0x4bdf96[_0x1258('0x21')]});})[_0x1258('0x1d')](function(_0x2a61f2){_0xa06403(_0xb0b379[_0x1258('0x12')](0x1f5,_0x2a61f2[_0x1258('0x1c')]));});});},'VoiceQueues':function(_0x385acb){return new Promise(function(_0x5927bc,_0x3ec562){var _0xe30e8d=[];for(var _0x1cbfd1 in _0x3ad6b0[_0x1258('0x22')]){if(_0x3ad6b0[_0x1258('0x22')][_0x1258('0x23')](_0x1cbfd1)){var _0x428c21=_0x3ad6b0[_0x1258('0x22')][_0x1cbfd1];var _0xa578ad={'id':_0x428c21['id'],'name':_0x428c21[_0x1258('0x24')],'strategy':_0x428c21[_0x1258('0x25')],'answered':_0x428c21[_0x1258('0x26')],'available':_0x428c21[_0x1258('0x27')],'loggedIn':_0x428c21['loggedIn'],'pTalking':_0x428c21['pTalking'],'sumBillable':_0x428c21[_0x1258('0x28')],'sumDuration':_0x428c21['sumDuration'],'sumHoldTime':_0x428c21[_0x1258('0x29')]||0x0,'talking':_0x428c21[_0x1258('0x2a')],'total':_0x428c21['total'],'type':_0x428c21[_0x1258('0x2b')],'unmanaged':_0x428c21[_0x1258('0x2c')],'abandoned':_0x428c21[_0x1258('0x2d')],'waiting':_0x428c21['waiting'],'loggedInDb':_0x428c21['loggedInDb']};if(_0x428c21[_0x1258('0x2b')]===_0x1258('0x2e')){_0xa578ad['dialActive']=_0x428c21[_0x1258('0x2f')];_0xa578ad['dialMethod']=_0x428c21[_0x1258('0x30')];_0xa578ad[_0x1258('0x31')]=_0x428c21[_0x1258('0x31')];_0xa578ad[_0x1258('0x32')]=_0x428c21[_0x1258('0x32')];_0xa578ad['dialOriginateTimeout']=_0x428c21['dialOriginateTimeout'];_0xa578ad[_0x1258('0x33')]=_0x428c21[_0x1258('0x33')];_0xa578ad[_0x1258('0x34')]=_0x428c21[_0x1258('0x34')];_0xa578ad[_0x1258('0x35')]=_0x428c21[_0x1258('0x35')];_0xa578ad['outboundAnswerCallsDay']=_0x428c21['outboundAnswerCallsDay'];_0xa578ad[_0x1258('0x36')]=_0x428c21[_0x1258('0x36')];_0xa578ad['outboundBusyCallsDay']=_0x428c21['outboundBusyCallsDay'];_0xa578ad['outboundCongestionCallsDay']=_0x428c21['outboundCongestionCallsDay'];_0xa578ad[_0x1258('0x37')]=_0x428c21[_0x1258('0x37')];_0xa578ad[_0x1258('0x38')]=_0x428c21[_0x1258('0x38')];_0xa578ad[_0x1258('0x39')]=_0x428c21[_0x1258('0x39')];_0xa578ad[_0x1258('0x3a')]=_0x428c21[_0x1258('0x3a')];_0xa578ad[_0x1258('0x3b')]=_0x428c21['outboundNoSuchCallsDay'];_0xa578ad['outboundOriginateFailureCallsDay']=_0x428c21[_0x1258('0x3c')];_0xa578ad['outboundReCallsDay']=_0x428c21[_0x1258('0x3d')];_0xa578ad['outboundRejectCallsDay']=_0x428c21[_0x1258('0x3e')];_0xa578ad[_0x1258('0x3f')]=_0x428c21[_0x1258('0x3f')];_0xa578ad[_0x1258('0x40')]=_0x428c21[_0x1258('0x40')];_0xa578ad[_0x1258('0x41')]=_0x428c21[_0x1258('0x41')];_0xa578ad[_0x1258('0x42')]=_0x428c21['predictiveIntervalAvgTalktime'];_0xa578ad[_0x1258('0x43')]=_0x428c21[_0x1258('0x43')];_0xa578ad[_0x1258('0x44')]=_0x428c21[_0x1258('0x44')];_0xa578ad[_0x1258('0x45')]=_0x428c21[_0x1258('0x45')];_0xa578ad['predictiveIntervalErlangCallsDroppedCalls']=_0x428c21['predictiveIntervalErlangCallsDroppedCalls'];_0xa578ad[_0x1258('0x46')]=_0x428c21[_0x1258('0x46')];_0xa578ad[_0x1258('0x47')]=_0x428c21['predictiveIntervalMultiplicativeFactor'];_0xa578ad[_0x1258('0x48')]=_0x428c21['predictiveIntervalPauses'];_0xa578ad['predictiveIntervalAvailable']=_0x428c21[_0x1258('0x49')];_0xa578ad[_0x1258('0x4a')]=_0x428c21[_0x1258('0x4a')];_0xa578ad[_0x1258('0x1c')]=_0x428c21[_0x1258('0x1c')];_0xa578ad[_0x1258('0x4b')]=_0x428c21[_0x1258('0x4b')];_0xa578ad[_0x1258('0x4c')]=_0x428c21[_0x1258('0x4c')];_0xa578ad[_0x1258('0x4d')]=_0x428c21[_0x1258('0x4d')];_0xa578ad[_0x1258('0x4e')]=_0x428c21[_0x1258('0x4e')];_0xa578ad[_0x1258('0x4f')]=_0x428c21['erlangBusyFactor'];_0xa578ad[_0x1258('0x50')]=_0x428c21[_0x1258('0x50')];_0xa578ad[_0x1258('0x51')]=_0x428c21[_0x1258('0x51')];}if(_0x428c21[_0x1258('0x52')]){_0xa578ad[_0x1258('0x52')]={'id':_0x428c21[_0x1258('0x52')]['id'],'name':_0x428c21['Trunk'][_0x1258('0x24')],'active':_0x428c21[_0x1258('0x52')][_0x1258('0x53')],'callerid':_0x428c21[_0x1258('0x52')][_0x1258('0x54')]};}if(_0x428c21[_0x1258('0x55')]){_0xa578ad[_0x1258('0x55')]={'id':_0x428c21[_0x1258('0x55')]['id'],'name':_0x428c21[_0x1258('0x55')][_0x1258('0x24')]};}_0xe30e8d[_0x1258('0x56')](_0xa578ad);}}_0x5927bc({'count':_0xe30e8d[_0x1258('0x57')],'rows':_0xe30e8d});});},'UpdateVoiceQueue':function(_0x119fca){return new Promise(function(_0x3020ec,_0x1cc448){var _0x3446c0=_[_0x1258('0x58')](_0x3ad6b0[_0x1258('0x22')],{'id':parseInt(_0x119fca['id'])});var _0x455415=_['omit'](_0x119fca,['id']);if(_0x3446c0){for(var _0x4086fe in _0x455415){if(typeof _0x455415[_0x4086fe]!==_0x1258('0x59')&&typeof _0x3446c0[_0x4086fe]!=='undefined'){_0x3446c0[_0x4086fe]=_0x455415[_0x4086fe];}}_0x3020ec(_0x3446c0);}else{_0x1cc448();}});},'VoiceChannels':function(_0x4ad587){return new Promise(function(_0x9f3021,_0xdc31d2){var _0x2e7eb0=_['values'](_0x3ad6b0[_0x1258('0x5a')]);_0x9f3021({'count':_0x2e7eb0[_0x1258('0x57')],'rows':_0x2e7eb0});});},'VoiceChannelMixMonitor':function(_0x4631a2){var _0x55d6f7=this;return new Promise(function(_0x3ca592,_0x140a78){if(ami[_0x1258('0x11')]()==![]){return _0x140a78(_0x55d6f7[_0x1258('0x12')](0x1f4,[config['asterisk']['ip'],config['asterisk']['username'],_0x1258('0x14')][_0x1258('0x15')]('\x20')));}var _0x4c9929=schema(properties[_0x1258('0x5b')])[_0x1258('0x3')](_0x4631a2);if(_0x4c9929[_0x1258('0x57')]>0x0){return _0x140a78(_0x55d6f7[_0x1258('0x12')](0x1f4,_['map'](_0x4c9929,_0x1258('0x1c'))[_0x1258('0x15')](',\x20')));}var _0x2bdc64=_[_0x1258('0x58')](_0x3ad6b0['channels'],{'uniqueid':_0x4631a2[_0x1258('0x5c')]});if(_0x2bdc64&&_0x2bdc64[_0x1258('0x5d')]){var _0x29f588=util[_0x1258('0x9')](_0x1258('0x5e'),_0x4631a2[_0x1258('0x5f')]||_0x4631a2[_0x1258('0x5c')],_0x4631a2[_0x1258('0x9')]||'wav');return ami['Action']({'action':_0x1258('0x60'),'channel':_0x2bdc64[_0x1258('0x5d')],'file':_0x29f588,'options':_0x1258('0x61')})[_0x1258('0x1b')](function(_0x1a93c2){var _0x481ef4=_[_0x1258('0x58')](_0x2bdc64[_0x1258('0x62')],{'filename':_0x1258('0x63')+_0x29f588['toLowerCase']()});if(_['isNil'](_0x481ef4)){_0x2bdc64['monitors'][_0x1258('0x56')]({'filename':_0x1258('0x63')+_0x29f588[_0x1258('0x64')](),'createdAt':moment()[_0x1258('0x9')](_0x1258('0x65')),'mixmonitorid':_0x1a93c2['mixmonitorid'],'status':_0x1258('0x66')});}else{_0x481ef4[_0x1258('0x67')]=_0x1a93c2[_0x1258('0x67')];_0x481ef4[_0x1258('0x68')]=_0x1258('0x66');}_0x3ca592({'code':0xc8,'message':[_0x4631a2[_0x1258('0x5c')],_0x1258('0x69'),_0x1a93c2[_0x1258('0x67')]][_0x1258('0x15')]('\x20'),'mixmonitorid':_0x1a93c2['mixmonitorid']});})[_0x1258('0x1d')](function(_0x1de2da){_0x140a78(_0x55d6f7[_0x1258('0x12')](0x1f5,[_0x4631a2['uniqueid'],_0x1de2da[_0x1258('0x1c')][_0x1258('0x64')]()][_0x1258('0x15')]('\x20')));});}else{return _0x140a78(_0x55d6f7[_0x1258('0x12')](0x1f5,_0x1258('0x6a')));}});},'VoiceChannelStopMixMonitor':function(_0xf7f959){var _0x7ab93c=this;return new Promise(function(_0x16866b,_0x3e9b50){if(ami[_0x1258('0x11')]()==![]){return _0x3e9b50(_0x7ab93c[_0x1258('0x12')](0x1f4,[config[_0x1258('0x13')]['ip'],config[_0x1258('0x13')]['username'],_0x1258('0x14')][_0x1258('0x15')]('\x20')));}var _0x41be7d=schema(properties[_0x1258('0x5b')])[_0x1258('0x3')](_0xf7f959);if(_0x41be7d[_0x1258('0x57')]>0x0){return _0x3e9b50(_0x7ab93c['error'](0x1f4,_[_0x1258('0x6b')](_0x41be7d,_0x1258('0x1c'))[_0x1258('0x15')](',\x20')));}var _0x3955d2=_[_0x1258('0x58')](_0x3ad6b0[_0x1258('0x5a')],{'uniqueid':_0xf7f959['uniqueid']});if(_0x3955d2){return BPromise[_0x1258('0x6c')]()['then'](function(){if(_0x3955d2[_0x1258('0x5d')]){return ami[_0x1258('0x1a')]({'action':_0x1258('0x6d'),'channel':_0x3955d2[_0x1258('0x5d')],'mixmonitorid':_0xf7f959[_0x1258('0x67')]})[_0x1258('0x1d')](function(_0xe952e3){});}})[_0x1258('0x1b')](function(){if(_0x3955d2[_0x1258('0x6e')]){return ami[_0x1258('0x1a')]({'action':'StopMixMonitor','channel':_0x3955d2[_0x1258('0x6e')],'mixmonitorid':_0xf7f959[_0x1258('0x67')]})['catch'](function(_0x146522){});}})['then'](function(_0x3fc8a4){var _0x5059c5=_[_0x1258('0x58')](_0x3955d2[_0x1258('0x62')],{'mixmonitorid':_0xf7f959[_0x1258('0x67')]});if(_0x5059c5){_0x5059c5[_0x1258('0x68')]=_0x1258('0x6f');}})[_0x1258('0x1b')](function(){var _0x260a65=util[_0x1258('0x9')](_0x1258('0x5e'),_0xf7f959[_0x1258('0x5f')]||_0xf7f959[_0x1258('0x5c')],_0xf7f959[_0x1258('0x9')]||_0x1258('0x70'));var _0x268eb6=_[_0x1258('0x58')](_0x3955d2[_0x1258('0x62')],{'filename':_0x1258('0x63')+_0x260a65[_0x1258('0x64')]()});if(_0x268eb6){_0x268eb6['status']='stop';}})[_0x1258('0x1b')](function(){_0x16866b({'code':0xc8,'message':[_0xf7f959[_0x1258('0x5c')],_0x1258('0x71')][_0x1258('0x15')]('\x20')});})[_0x1258('0x1d')](function(_0x485120){_0x3e9b50(_0x7ab93c[_0x1258('0x12')](0x1f5,[_0xf7f959[_0x1258('0x5c')],_0x485120[_0x1258('0x1c')][_0x1258('0x64')]()][_0x1258('0x15')]('\x20')));});}else{return _0x3e9b50(_0x7ab93c[_0x1258('0x12')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x301892){return new Promise(function(_0x4dc2bd,_0xe51e78){var _0x16ae31=_[_0x1258('0x72')](_0x3ad6b0[_0x1258('0x73')]);_0x4dc2bd({'count':_0x16ae31[_0x1258('0x57')],'rows':_0x16ae31});});},'VoiceQueuesChannel':function(_0x2e4624){var _0x1feb01=this;return new Promise(function(_0x332ea7,_0x50fed0){var _0xd2ae7=schema(properties['voicequeuechannel'])[_0x1258('0x3')](_0x2e4624);if(_0xd2ae7[_0x1258('0x57')]>0x0){return _0x50fed0(_0x1feb01['error'](0x1f4,_['map'](_0xd2ae7,_0x1258('0x1c'))[_0x1258('0x15')](',\x20')));}var _0x1234dd=_[_0x1258('0x58')](_0x3ad6b0[_0x1258('0x73')],{'uniqueid':_0x2e4624[_0x1258('0x5c')]});if(_0x1234dd){_0x332ea7(_0x1234dd);}else{return _0x50fed0(_0x1feb01[_0x1258('0x12')](0x1f5,_0x1258('0x6a')));}});},'VoiceQueuesChannelHangup':function(_0x30510b){var _0x46ca59=this;return new Promise(function(_0xb94d9a,_0x949e25){if(ami['isConnected']()==![]){return _0x949e25(_0x46ca59[_0x1258('0x12')](0x1f4,[config[_0x1258('0x13')]['ip'],config[_0x1258('0x13')][_0x1258('0x1e')],_0x1258('0x14')][_0x1258('0x15')]('\x20')));}var _0x5622f4=schema(properties[_0x1258('0x74')])['validate'](_0x30510b);if(_0x5622f4[_0x1258('0x57')]>0x0){return _0x949e25(_0x46ca59[_0x1258('0x12')](0x1f4,_['map'](_0x5622f4,_0x1258('0x1c'))[_0x1258('0x15')](',\x20')));}var _0xf18028=_[_0x1258('0x58')](_0x3ad6b0[_0x1258('0x73')],{'uniqueid':_0x30510b[_0x1258('0x5c')]});if(_0xf18028&&_0xf18028['channel']){return ami['Action']({'action':_0x1258('0x75'),'channel':_0xf18028[_0x1258('0x5d')]})[_0x1258('0x1b')](function(_0x51a77e){_0xb94d9a({'code':0xc8,'message':[_0x30510b[_0x1258('0x5c')],_0x51a77e['message'][_0x1258('0x64')]()]['join']('\x20')});})[_0x1258('0x1d')](function(_0x2a0a75){_0x949e25(_0x46ca59[_0x1258('0x12')](0x1f5,[_0x30510b['uniqueid'],_0x2a0a75['message'][_0x1258('0x64')]()][_0x1258('0x15')]('\x20')));});}else{return _0x949e25(_0x46ca59[_0x1258('0x12')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x3424ae){var _0x4d2e3a=this;return new Promise(function(_0x50ca3d,_0x319681){if(ami['isConnected']()==![]){return _0x319681(_0x4d2e3a[_0x1258('0x12')](0x1f4,[config[_0x1258('0x13')]['ip'],config['asterisk'][_0x1258('0x1e')],_0x1258('0x14')][_0x1258('0x15')]('\x20')));}var _0xfb164d=schema(properties[_0x1258('0x76')])[_0x1258('0x3')](_0x3424ae);if(_0xfb164d[_0x1258('0x57')]>0x0){return _0x319681(_0x4d2e3a['error'](0x1f4,_[_0x1258('0x6b')](_0xfb164d,_0x1258('0x1c'))[_0x1258('0x15')](',\x20')));}var _0xc8a3c8=_[_0x1258('0x58')](_0x3ad6b0[_0x1258('0x73')],{'uniqueid':_0x3424ae[_0x1258('0x5c')]});if(_0xc8a3c8&&_0xc8a3c8[_0x1258('0x5d')]){return ami['Action']({'action':'Redirect','channel':_0xc8a3c8[_0x1258('0x5d')],'exten':_0x3424ae[_0x1258('0x77')],'context':_0x3424ae[_0x1258('0x78')]||_0xc8a3c8['context'],'priority':0x1})['then'](function(_0x13a3f2){_0x50ca3d({'code':0xc8,'message':[_0x3424ae[_0x1258('0x5c')],_0x13a3f2['message']['toLowerCase']()]['join']('\x20')});})[_0x1258('0x1d')](function(_0x540749){_0x319681(_0x4d2e3a[_0x1258('0x12')](0x1f5,[_0x3424ae[_0x1258('0x5c')],_0x540749[_0x1258('0x1c')][_0x1258('0x64')]()][_0x1258('0x15')]('\x20')));});}else{return _0x319681(_0x4d2e3a[_0x1258('0x12')](0x1f5,_0x1258('0x6a')));}});},'Agents':function(_0x2a960d){return new Promise(function(_0x1de6d8,_0x4a6dcf){var _0x22d403=_[_0x1258('0x72')](_0x3ad6b0[_0x1258('0xe')]);_0x1de6d8({'count':_0x22d403[_0x1258('0x57')],'rows':_0x22d403});});},'Telephones':function(_0x42a68e){return new Promise(function(_0x4f7c3e,_0x590933){var _0x405e5c=_[_0x1258('0x72')](_0x3ad6b0[_0x1258('0x79')]);_0x4f7c3e({'count':_0x405e5c[_0x1258('0x57')],'rows':_0x405e5c});});},'Trunks':function(_0x2eaed3){return new Promise(function(_0x51402a,_0x1a2848){var _0xbb54c1=_['values'](_0x3ad6b0[_0x1258('0x7a')]);_0x51402a({'count':_0xbb54c1[_0x1258('0x57')],'rows':_0xbb54c1});});},'OutboundChannels':function(_0x4524c0){return new Promise(function(_0x581231,_0x5ac5c5){var _0x4bf3b9=_[_0x1258('0x72')](_0x3ad6b0[_0x1258('0x7b')]);_0x581231({'count':_0x4bf3b9[_0x1258('0x57')],'rows':_0x4bf3b9});});},'Outbound':function(_0x37e446){return new Promise(function(_0x46c140,_0x326ffa){_0x46c140(_0x3ad6b0[_0x1258('0x2e')]);});},'Campaigns':function(_0x9669dd){return new Promise(function(_0x4506ef,_0x328c81){var _0x160c10=_[_0x1258('0x72')](_0x3ad6b0[_0x1258('0x7c')]);_0x4506ef({'count':_0x160c10[_0x1258('0x57')],'rows':_0x160c10});});},'VoiceQueuesPreview':function(_0x1e1443){var _0x235d30=this;return new Promise(function(_0x3eb98c,_0x1f9be0){_0x1a5749['run'](_0x1e1443['id'])[_0x1258('0x1b')](function(_0xf3ede5){_0x3eb98c({'code':0xc8,'message':_0xf3ede5[_0x1258('0x1c')]});})[_0x1258('0x1d')](function(_0x192abe){_0x1f9be0(_0x235d30[_0x1258('0x12')](0x1f4,_0x192abe[_0x1258('0x1c')]));});});},'EventManager':function(_0x125c1e){var _0x51aa66=this;return new Promise(function(_0x5913e9,_0x379865){if(!_0x125c1e[_0x1258('0x7d')]){return _0x379865(_0x51aa66[_0x1258('0x12')](0x1f4,_0x1258('0x7e')));}ami[_0x1258('0x7f')](_0x1258('0x80')+_0x125c1e[_0x1258('0x7d')],_0x125c1e['message']);_0x5913e9({'code':0xc8,'message':_0x125c1e});});},'FaxAccounts':function(_0x3cac85){return new Promise(function(_0x2b83d0,_0xc947d3){var _0x111b4a=_['values'](_0x3ad6b0[_0x1258('0x81')]);_0x2b83d0({'count':_0x111b4a[_0x1258('0x57')],'rows':_0x111b4a});});},'SendFax':function(_0x213e28){var _0x430cd9=this;return new Promise(function(_0x89974b,_0x4c994c){_0x16c926[_0x1258('0x82')](_0x213e28)[_0x1258('0x1b')](function(_0x3d8cec){_0x89974b({'code':0xc8,'message':_0x3d8cec[_0x1258('0x1c')]});})[_0x1258('0x1d')](function(_0x54ed69){_0x4c994c(_0x430cd9['error'](0x1f4,_0x54ed69[_0x1258('0x1c')]));});});},'CheckAfterSend':function(_0x121e53){var _0x4793f4=this;return new Promise(function(_0x32d91c,_0x34ad2a){_0x16c926[_0x1258('0x83')](_0x121e53)['then'](function(_0x10d28c){_0x32d91c({'code':0xc8,'message':_0x10d28c['message']});})[_0x1258('0x1d')](function(_0xee5b49){_0x34ad2a(_0x4793f4[_0x1258('0x12')](0x1f4,_0xee5b49['message']));});});}};var _0xdbe280=jayson['server'](_0x3e1044)['http']();_0xdbe280['on'](_0x1258('0x12'),function(_0x3fa46b){return _0x582ed7(_0x3fa46b);});_0xdbe280[_0x1258('0x8')](0x232a,_0x1258('0x84'),function(){console[_0x1258('0x85')](_0x1258('0x86'),0x232a);return _0x2aeafc(_0x1258('0x87')+0x232a);});});}; \ No newline at end of file +var _0xc9c3=['exten','context','trunks','outboundChannels','run','event','Event\x20name\x20mandatory','custom:','faxAccounts','send','checkAfterSend','http','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','moment','../../../config/environment','../properties','../ami','listen','format','%s/%s','SIP','name','timers','agents','updateStatusRealtime','pause','asterisk','username','ami\x20disconnected','join','pick','module','then','message','catch','error','command','action','Command','Action','content','voiceQueues','hasOwnProperty','strategy','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','total','unmanaged','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','find','omit','undefined','values','channels','length','isConnected','voicechannel','validate','map','uniqueid','channel','wav','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','push','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','destinationchannel','StopMixMonitor','status','stop','%s.%s','filename','StopMixMonitor\x20Success','voicequeuechannel','voicequeuechannelhangup','queueChannels','Redirect'];(function(_0x4c1db4,_0x5548b7){var _0x3b463b=function(_0x335136){while(--_0x335136){_0x4c1db4['push'](_0x4c1db4['shift']());}};_0x3b463b(++_0x5548b7);}(_0xc9c3,0x96));var _0x3c9c=function(_0x2a2b9a,_0x51f9b3){_0x2a2b9a=_0x2a2b9a-0x0;var _0x2ea8e8=_0xc9c3[_0x2a2b9a];return _0x2ea8e8;};'use strict';var _=require('lodash');var util=require('util');var jayson=require(_0x3c9c('0x0'));var schema=require('validate');var BPromise=require(_0x3c9c('0x1'));var moment=require(_0x3c9c('0x2'));var config=require(_0x3c9c('0x3'));var properties=require(_0x3c9c('0x4'));var ami=require(_0x3c9c('0x5'));exports[_0x3c9c('0x6')]=function(_0x143bfe,_0x512e80,_0x48b219){return new BPromise(function(_0x5c86bd,_0x5a2836){var _0x3ca0ce={'QueuePause':function(_0xc35e75){return new Promise(function(_0x2eb946,_0x3e5ccb){var _0x355ef3=util[_0x3c9c('0x7')](_0x3c9c('0x8'),_0x3c9c('0x9'),_0xc35e75[_0x3c9c('0xa')]);if(_0x143bfe['timers']&&_0x143bfe[_0x3c9c('0xb')][_0x355ef3]&&_0x143bfe[_0x3c9c('0xb')][_0x355ef3]['timer']){_0x143bfe[_0x3c9c('0xb')][_0x355ef3]['updateAcw']();}if(_0x143bfe[_0x3c9c('0xc')][_0x355ef3]){_0x143bfe[_0x3c9c('0xc')][_0x355ef3][_0x3c9c('0xd')]({'statePause':_0xc35e75[_0x3c9c('0xe')]?!![]:![]});}_0x2eb946({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x50cf96){var _0x4a60d9=this;return new Promise(function(_0x857b1f,_0x59bbc6){if(ami['isConnected']()==![]){return _0x59bbc6(_0x4a60d9['error'](0x1f4,[config[_0x3c9c('0xf')]['ip'],config['asterisk'][_0x3c9c('0x10')],_0x3c9c('0x11')][_0x3c9c('0x12')]('\x20')));}_0x50cf96=_[_0x3c9c('0x13')](_0x50cf96,_['keys'](properties[_0x3c9c('0x14')]));_0x50cf96['action']='Reload';return ami['Action'](_0x50cf96)[_0x3c9c('0x15')](function(_0x32d94a){_0x857b1f({'code':0xc8,'message':_0x32d94a[_0x3c9c('0x16')]});})[_0x3c9c('0x17')](function(_0x3e63e0){_0x59bbc6(_0x4a60d9[_0x3c9c('0x18')](0x1f5,_0x3e63e0[_0x3c9c('0x16')]));});});},'Command':function(_0x56fa79){var _0x15a90a=this;return new Promise(function(_0x4c7122,_0x461711){if(ami['isConnected']()==![]){return _0x461711(_0x15a90a[_0x3c9c('0x18')](0x1f4,[config[_0x3c9c('0xf')]['ip'],config['asterisk'][_0x3c9c('0x10')],_0x3c9c('0x11')][_0x3c9c('0x12')]('\x20')));}_0x56fa79=_['pick'](_0x56fa79,_0x3c9c('0x19'));_0x56fa79[_0x3c9c('0x1a')]=_0x3c9c('0x1b');return ami[_0x3c9c('0x1c')](_0x56fa79)[_0x3c9c('0x15')](function(_0x3bc5c4){_0x4c7122({'code':0xc8,'message':_0x3bc5c4[_0x3c9c('0x1d')]});})[_0x3c9c('0x17')](function(_0x509bf7){_0x461711(_0x15a90a[_0x3c9c('0x18')](0x1f5,_0x509bf7['message']));});});},'VoiceQueues':function(_0x497145){return new Promise(function(_0xe04fca,_0x4ca078){var _0x527bb9=[];for(var _0x379880 in _0x143bfe[_0x3c9c('0x1e')]){if(_0x143bfe[_0x3c9c('0x1e')][_0x3c9c('0x1f')](_0x379880)){var _0x4c283d=_0x143bfe[_0x3c9c('0x1e')][_0x379880];var _0x65b831={'id':_0x4c283d['id'],'name':_0x4c283d['name'],'strategy':_0x4c283d[_0x3c9c('0x20')],'answered':_0x4c283d['answered'],'available':_0x4c283d['available'],'loggedIn':_0x4c283d[_0x3c9c('0x21')],'pTalking':_0x4c283d[_0x3c9c('0x22')],'sumBillable':_0x4c283d[_0x3c9c('0x23')],'sumDuration':_0x4c283d[_0x3c9c('0x24')],'sumHoldTime':_0x4c283d[_0x3c9c('0x25')]||0x0,'talking':_0x4c283d['talking'],'total':_0x4c283d[_0x3c9c('0x26')],'type':_0x4c283d['type'],'unmanaged':_0x4c283d[_0x3c9c('0x27')],'abandoned':_0x4c283d[_0x3c9c('0x28')],'waiting':_0x4c283d[_0x3c9c('0x29')],'loggedInDb':_0x4c283d[_0x3c9c('0x2a')]};if(_0x4c283d['type']===_0x3c9c('0x2b')){_0x65b831[_0x3c9c('0x2c')]=_0x4c283d[_0x3c9c('0x2c')];_0x65b831[_0x3c9c('0x2d')]=_0x4c283d[_0x3c9c('0x2d')];_0x65b831[_0x3c9c('0x2e')]=_0x4c283d[_0x3c9c('0x2e')];_0x65b831[_0x3c9c('0x2f')]=_0x4c283d['dialOriginateCallerIdNumber'];_0x65b831[_0x3c9c('0x30')]=_0x4c283d[_0x3c9c('0x30')];_0x65b831[_0x3c9c('0x31')]=_0x4c283d[_0x3c9c('0x31')];_0x65b831[_0x3c9c('0x32')]=_0x4c283d[_0x3c9c('0x32')];_0x65b831[_0x3c9c('0x33')]=_0x4c283d[_0x3c9c('0x33')];_0x65b831[_0x3c9c('0x34')]=_0x4c283d[_0x3c9c('0x34')];_0x65b831[_0x3c9c('0x35')]=_0x4c283d[_0x3c9c('0x35')];_0x65b831[_0x3c9c('0x36')]=_0x4c283d[_0x3c9c('0x36')];_0x65b831['outboundCongestionCallsDay']=_0x4c283d[_0x3c9c('0x37')];_0x65b831[_0x3c9c('0x38')]=_0x4c283d[_0x3c9c('0x38')];_0x65b831['outboundDropCallsDayCallersExit']=_0x4c283d[_0x3c9c('0x39')];_0x65b831[_0x3c9c('0x3a')]=_0x4c283d[_0x3c9c('0x3a')];_0x65b831[_0x3c9c('0x3b')]=_0x4c283d['outboundNoAnswerCallsDay'];_0x65b831['outboundNoSuchCallsDay']=_0x4c283d[_0x3c9c('0x3c')];_0x65b831[_0x3c9c('0x3d')]=_0x4c283d[_0x3c9c('0x3d')];_0x65b831['outboundReCallsDay']=_0x4c283d['outboundReCallsDay'];_0x65b831[_0x3c9c('0x3e')]=_0x4c283d['outboundRejectCallsDay'];_0x65b831['outboundUnknownCallsDay']=_0x4c283d[_0x3c9c('0x3f')];_0x65b831[_0x3c9c('0x40')]=_0x4c283d[_0x3c9c('0x40')];_0x65b831['predictiveIntervalAvgHoldtime']=_0x4c283d[_0x3c9c('0x41')];_0x65b831[_0x3c9c('0x42')]=_0x4c283d[_0x3c9c('0x42')];_0x65b831['predictiveIntervalDroppedCallsCallersExit']=_0x4c283d['predictiveIntervalDroppedCallsCallersExit'];_0x65b831['predictiveIntervalDroppedCallsTimeout']=_0x4c283d[_0x3c9c('0x43')];_0x65b831[_0x3c9c('0x44')]=_0x4c283d[_0x3c9c('0x44')];_0x65b831[_0x3c9c('0x45')]=_0x4c283d[_0x3c9c('0x45')];_0x65b831[_0x3c9c('0x46')]=_0x4c283d['predictiveIntervalHitRate'];_0x65b831['predictiveIntervalMultiplicativeFactor']=_0x4c283d[_0x3c9c('0x47')];_0x65b831[_0x3c9c('0x48')]=_0x4c283d[_0x3c9c('0x48')];_0x65b831['predictiveIntervalAvailable']=_0x4c283d[_0x3c9c('0x49')];_0x65b831[_0x3c9c('0x4a')]=_0x4c283d[_0x3c9c('0x4a')];_0x65b831['message']=_0x4c283d['message'];_0x65b831[_0x3c9c('0x4b')]=_0x4c283d[_0x3c9c('0x4b')];_0x65b831[_0x3c9c('0x4c')]=_0x4c283d['erlangCalls'];_0x65b831[_0x3c9c('0x4d')]=_0x4c283d[_0x3c9c('0x4d')];_0x65b831[_0x3c9c('0x4e')]=_0x4c283d[_0x3c9c('0x4e')];_0x65b831['erlangBusyFactor']=_0x4c283d[_0x3c9c('0x4f')];_0x65b831[_0x3c9c('0x50')]=_0x4c283d['startPredictive'];_0x65b831['startProgressive']=_0x4c283d[_0x3c9c('0x51')];}if(_0x4c283d[_0x3c9c('0x52')]){_0x65b831['Trunk']={'id':_0x4c283d[_0x3c9c('0x52')]['id'],'name':_0x4c283d[_0x3c9c('0x52')][_0x3c9c('0xa')],'active':_0x4c283d[_0x3c9c('0x52')][_0x3c9c('0x53')],'callerid':_0x4c283d[_0x3c9c('0x52')]['callerid']};}if(_0x4c283d[_0x3c9c('0x54')]){_0x65b831[_0x3c9c('0x54')]={'id':_0x4c283d[_0x3c9c('0x54')]['id'],'name':_0x4c283d[_0x3c9c('0x54')][_0x3c9c('0xa')]};}_0x527bb9['push'](_0x65b831);}}_0xe04fca({'count':_0x527bb9['length'],'rows':_0x527bb9});});},'UpdateVoiceQueue':function(_0x55a6ba){return new Promise(function(_0x3ff47a,_0x1da3e7){var _0x25285d=_[_0x3c9c('0x55')](_0x143bfe['voiceQueues'],{'id':parseInt(_0x55a6ba['id'])});var _0x798651=_[_0x3c9c('0x56')](_0x55a6ba,['id']);if(_0x25285d){for(var _0x27a013 in _0x798651){if(typeof _0x798651[_0x27a013]!==_0x3c9c('0x57')&&typeof _0x25285d[_0x27a013]!==_0x3c9c('0x57')){_0x25285d[_0x27a013]=_0x798651[_0x27a013];}}_0x3ff47a(_0x25285d);}else{_0x1da3e7();}});},'VoiceChannels':function(_0x58f6b7){return new Promise(function(_0x184c22,_0x1177b3){var _0x1804e3=_[_0x3c9c('0x58')](_0x143bfe[_0x3c9c('0x59')]);_0x184c22({'count':_0x1804e3[_0x3c9c('0x5a')],'rows':_0x1804e3});});},'VoiceChannelMixMonitor':function(_0x475fd6){var _0x5a74ce=this;return new Promise(function(_0x260d3b,_0x3a59f9){if(ami[_0x3c9c('0x5b')]()==![]){return _0x3a59f9(_0x5a74ce[_0x3c9c('0x18')](0x1f4,[config[_0x3c9c('0xf')]['ip'],config[_0x3c9c('0xf')]['username'],_0x3c9c('0x11')][_0x3c9c('0x12')]('\x20')));}var _0x2b0691=schema(properties[_0x3c9c('0x5c')])[_0x3c9c('0x5d')](_0x475fd6);if(_0x2b0691[_0x3c9c('0x5a')]>0x0){return _0x3a59f9(_0x5a74ce[_0x3c9c('0x18')](0x1f4,_[_0x3c9c('0x5e')](_0x2b0691,_0x3c9c('0x16'))[_0x3c9c('0x12')](',\x20')));}var _0x39b9d8=_[_0x3c9c('0x55')](_0x143bfe[_0x3c9c('0x59')],{'uniqueid':_0x475fd6[_0x3c9c('0x5f')]});if(_0x39b9d8&&_0x39b9d8[_0x3c9c('0x60')]){var _0x2b022f=util['format']('%s.%s',_0x475fd6['filename']||_0x475fd6[_0x3c9c('0x5f')],_0x475fd6[_0x3c9c('0x7')]||_0x3c9c('0x61'));return ami[_0x3c9c('0x1c')]({'action':'MixMonitor','channel':_0x39b9d8[_0x3c9c('0x60')],'file':_0x2b022f,'options':'ai(mixmonitorid)'})['then'](function(_0x34cd84){var _0x2849c6=_[_0x3c9c('0x55')](_0x39b9d8[_0x3c9c('0x62')],{'filename':_0x3c9c('0x63')+_0x2b022f[_0x3c9c('0x64')]()});if(_[_0x3c9c('0x65')](_0x2849c6)){_0x39b9d8[_0x3c9c('0x62')][_0x3c9c('0x66')]({'filename':'/var/spool/asterisk/monitor/'+_0x2b022f[_0x3c9c('0x64')](),'createdAt':moment()[_0x3c9c('0x7')](_0x3c9c('0x67')),'mixmonitorid':_0x34cd84[_0x3c9c('0x68')],'status':_0x3c9c('0x69')});}else{_0x2849c6[_0x3c9c('0x68')]=_0x34cd84[_0x3c9c('0x68')];_0x2849c6['status']='rec';}_0x260d3b({'code':0xc8,'message':[_0x475fd6[_0x3c9c('0x5f')],_0x3c9c('0x6a'),_0x34cd84[_0x3c9c('0x68')]][_0x3c9c('0x12')]('\x20'),'mixmonitorid':_0x34cd84[_0x3c9c('0x68')]});})[_0x3c9c('0x17')](function(_0x287ca1){_0x3a59f9(_0x5a74ce[_0x3c9c('0x18')](0x1f5,[_0x475fd6[_0x3c9c('0x5f')],_0x287ca1[_0x3c9c('0x16')][_0x3c9c('0x64')]()][_0x3c9c('0x12')]('\x20')));});}else{return _0x3a59f9(_0x5a74ce[_0x3c9c('0x18')](0x1f5,_0x3c9c('0x6b')));}});},'VoiceChannelStopMixMonitor':function(_0x581523){var _0x423891=this;return new Promise(function(_0x4306fe,_0x1b6f0a){if(ami[_0x3c9c('0x5b')]()==![]){return _0x1b6f0a(_0x423891[_0x3c9c('0x18')](0x1f4,[config['asterisk']['ip'],config[_0x3c9c('0xf')][_0x3c9c('0x10')],'ami\x20disconnected']['join']('\x20')));}var _0x1d810d=schema(properties[_0x3c9c('0x5c')])['validate'](_0x581523);if(_0x1d810d[_0x3c9c('0x5a')]>0x0){return _0x1b6f0a(_0x423891[_0x3c9c('0x18')](0x1f4,_[_0x3c9c('0x5e')](_0x1d810d,_0x3c9c('0x16'))[_0x3c9c('0x12')](',\x20')));}var _0x2264b7=_[_0x3c9c('0x55')](_0x143bfe[_0x3c9c('0x59')],{'uniqueid':_0x581523[_0x3c9c('0x5f')]});if(_0x2264b7){return BPromise[_0x3c9c('0x6c')]()[_0x3c9c('0x15')](function(){if(_0x2264b7['channel']){return ami[_0x3c9c('0x1c')]({'action':'StopMixMonitor','channel':_0x2264b7['channel'],'mixmonitorid':_0x581523[_0x3c9c('0x68')]})[_0x3c9c('0x17')](function(_0x1a1485){});}})[_0x3c9c('0x15')](function(){if(_0x2264b7[_0x3c9c('0x6d')]){return ami[_0x3c9c('0x1c')]({'action':_0x3c9c('0x6e'),'channel':_0x2264b7['destinationchannel'],'mixmonitorid':_0x581523[_0x3c9c('0x68')]})[_0x3c9c('0x17')](function(_0x31fb57){});}})[_0x3c9c('0x15')](function(_0x1cfaea){var _0x4fb887=_['find'](_0x2264b7[_0x3c9c('0x62')],{'mixmonitorid':_0x581523[_0x3c9c('0x68')]});if(_0x4fb887){_0x4fb887[_0x3c9c('0x6f')]=_0x3c9c('0x70');}})[_0x3c9c('0x15')](function(){var _0x990934=util[_0x3c9c('0x7')](_0x3c9c('0x71'),_0x581523[_0x3c9c('0x72')]||_0x581523[_0x3c9c('0x5f')],_0x581523[_0x3c9c('0x7')]||_0x3c9c('0x61'));var _0x4311c0=_[_0x3c9c('0x55')](_0x2264b7[_0x3c9c('0x62')],{'filename':_0x3c9c('0x63')+_0x990934[_0x3c9c('0x64')]()});if(_0x4311c0){_0x4311c0['status']=_0x3c9c('0x70');}})['then'](function(){_0x4306fe({'code':0xc8,'message':[_0x581523['uniqueid'],_0x3c9c('0x73')][_0x3c9c('0x12')]('\x20')});})[_0x3c9c('0x17')](function(_0x4b1b16){_0x1b6f0a(_0x423891[_0x3c9c('0x18')](0x1f5,[_0x581523[_0x3c9c('0x5f')],_0x4b1b16['message'][_0x3c9c('0x64')]()][_0x3c9c('0x12')]('\x20')));});}else{return _0x1b6f0a(_0x423891['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x5e4146){return new Promise(function(_0x1e93d7,_0x2fc65b){var _0xbc5b78=_[_0x3c9c('0x58')](_0x143bfe['queueChannels']);_0x1e93d7({'count':_0xbc5b78['length'],'rows':_0xbc5b78});});},'VoiceQueuesChannel':function(_0x2f2628){var _0x2dc609=this;return new Promise(function(_0x260a90,_0x94bc44){var _0x4342a9=schema(properties[_0x3c9c('0x74')])[_0x3c9c('0x5d')](_0x2f2628);if(_0x4342a9[_0x3c9c('0x5a')]>0x0){return _0x94bc44(_0x2dc609[_0x3c9c('0x18')](0x1f4,_['map'](_0x4342a9,'message')[_0x3c9c('0x12')](',\x20')));}var _0x5cf82a=_['find'](_0x143bfe['queueChannels'],{'uniqueid':_0x2f2628[_0x3c9c('0x5f')]});if(_0x5cf82a){_0x260a90(_0x5cf82a);}else{return _0x94bc44(_0x2dc609[_0x3c9c('0x18')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x56effa){var _0x53ccaf=this;return new Promise(function(_0x482612,_0x77afb5){if(ami['isConnected']()==![]){return _0x77afb5(_0x53ccaf[_0x3c9c('0x18')](0x1f4,[config[_0x3c9c('0xf')]['ip'],config[_0x3c9c('0xf')]['username'],'ami\x20disconnected'][_0x3c9c('0x12')]('\x20')));}var _0x5ca292=schema(properties[_0x3c9c('0x75')])[_0x3c9c('0x5d')](_0x56effa);if(_0x5ca292[_0x3c9c('0x5a')]>0x0){return _0x77afb5(_0x53ccaf[_0x3c9c('0x18')](0x1f4,_['map'](_0x5ca292,_0x3c9c('0x16'))[_0x3c9c('0x12')](',\x20')));}var _0x5c1a13=_[_0x3c9c('0x55')](_0x143bfe[_0x3c9c('0x76')],{'uniqueid':_0x56effa['uniqueid']});if(_0x5c1a13&&_0x5c1a13[_0x3c9c('0x60')]){return ami[_0x3c9c('0x1c')]({'action':'Hangup','channel':_0x5c1a13[_0x3c9c('0x60')]})[_0x3c9c('0x15')](function(_0xab562a){_0x482612({'code':0xc8,'message':[_0x56effa['uniqueid'],_0xab562a['message'][_0x3c9c('0x64')]()][_0x3c9c('0x12')]('\x20')});})['catch'](function(_0x386197){_0x77afb5(_0x53ccaf[_0x3c9c('0x18')](0x1f5,[_0x56effa[_0x3c9c('0x5f')],_0x386197['message'][_0x3c9c('0x64')]()][_0x3c9c('0x12')]('\x20')));});}else{return _0x77afb5(_0x53ccaf['error'](0x1f5,_0x3c9c('0x6b')));}});},'VoiceQueuesChannelRedirect':function(_0x2cb21d){var _0xc4b7c9=this;return new Promise(function(_0x3caddb,_0x1ecabd){if(ami[_0x3c9c('0x5b')]()==![]){return _0x1ecabd(_0xc4b7c9[_0x3c9c('0x18')](0x1f4,[config[_0x3c9c('0xf')]['ip'],config[_0x3c9c('0xf')][_0x3c9c('0x10')],'ami\x20disconnected'][_0x3c9c('0x12')]('\x20')));}var _0x150a27=schema(properties['voicequeuechannelredirect'])[_0x3c9c('0x5d')](_0x2cb21d);if(_0x150a27[_0x3c9c('0x5a')]>0x0){return _0x1ecabd(_0xc4b7c9['error'](0x1f4,_[_0x3c9c('0x5e')](_0x150a27,_0x3c9c('0x16'))[_0x3c9c('0x12')](',\x20')));}var _0x17d23e=_[_0x3c9c('0x55')](_0x143bfe['queueChannels'],{'uniqueid':_0x2cb21d[_0x3c9c('0x5f')]});if(_0x17d23e&&_0x17d23e[_0x3c9c('0x60')]){return ami[_0x3c9c('0x1c')]({'action':_0x3c9c('0x77'),'channel':_0x17d23e[_0x3c9c('0x60')],'exten':_0x2cb21d[_0x3c9c('0x78')],'context':_0x2cb21d[_0x3c9c('0x79')]||_0x17d23e[_0x3c9c('0x79')],'priority':0x1})[_0x3c9c('0x15')](function(_0x36018f){_0x3caddb({'code':0xc8,'message':[_0x2cb21d[_0x3c9c('0x5f')],_0x36018f[_0x3c9c('0x16')][_0x3c9c('0x64')]()]['join']('\x20')});})[_0x3c9c('0x17')](function(_0x296e46){_0x1ecabd(_0xc4b7c9['error'](0x1f5,[_0x2cb21d[_0x3c9c('0x5f')],_0x296e46[_0x3c9c('0x16')][_0x3c9c('0x64')]()]['join']('\x20')));});}else{return _0x1ecabd(_0xc4b7c9[_0x3c9c('0x18')](0x1f5,_0x3c9c('0x6b')));}});},'Agents':function(_0x21c7c3){return new Promise(function(_0x285ebc,_0x478572){var _0x773eea=_['values'](_0x143bfe[_0x3c9c('0xc')]);_0x285ebc({'count':_0x773eea['length'],'rows':_0x773eea});});},'Telephones':function(_0x2265e8){return new Promise(function(_0x48a57f,_0x4950c3){var _0x263270=_['values'](_0x143bfe['telephones']);_0x48a57f({'count':_0x263270[_0x3c9c('0x5a')],'rows':_0x263270});});},'Trunks':function(_0x2f3a98){return new Promise(function(_0x14ccbc,_0x9b3118){var _0x2f4e79=_[_0x3c9c('0x58')](_0x143bfe[_0x3c9c('0x7a')]);_0x14ccbc({'count':_0x2f4e79[_0x3c9c('0x5a')],'rows':_0x2f4e79});});},'OutboundChannels':function(_0x2e6b96){return new Promise(function(_0x13e236,_0x1528a6){var _0x570ae6=_['values'](_0x143bfe[_0x3c9c('0x7b')]);_0x13e236({'count':_0x570ae6['length'],'rows':_0x570ae6});});},'Outbound':function(_0x552ec1){return new Promise(function(_0x3bb0c1,_0x1838d7){_0x3bb0c1(_0x143bfe[_0x3c9c('0x2b')]);});},'Campaigns':function(_0x1748c7){return new Promise(function(_0x2dec50,_0x57746d){var _0x105e67=_[_0x3c9c('0x58')](_0x143bfe['campaigns']);_0x2dec50({'count':_0x105e67['length'],'rows':_0x105e67});});},'VoiceQueuesPreview':function(_0x308a24){var _0x5f42c1=this;return new Promise(function(_0x2e3cab,_0x1ceaa3){_0x512e80[_0x3c9c('0x7c')](_0x308a24['id'])[_0x3c9c('0x15')](function(_0x327e63){_0x2e3cab({'code':0xc8,'message':_0x327e63[_0x3c9c('0x16')]});})[_0x3c9c('0x17')](function(_0x18012e){_0x1ceaa3(_0x5f42c1[_0x3c9c('0x18')](0x1f4,_0x18012e[_0x3c9c('0x16')]));});});},'EventManager':function(_0x52af3a){var _0x32690f=this;return new Promise(function(_0x2f5738,_0xf6f1ea){if(!_0x52af3a[_0x3c9c('0x7d')]){return _0xf6f1ea(_0x32690f['error'](0x1f4,_0x3c9c('0x7e')));}ami['emit'](_0x3c9c('0x7f')+_0x52af3a[_0x3c9c('0x7d')],_0x52af3a['message']);_0x2f5738({'code':0xc8,'message':_0x52af3a});});},'FaxAccounts':function(_0x22d2bd){return new Promise(function(_0x4cd7b9,_0x49559f){var _0x3d34e3=_[_0x3c9c('0x58')](_0x143bfe[_0x3c9c('0x80')]);_0x4cd7b9({'count':_0x3d34e3[_0x3c9c('0x5a')],'rows':_0x3d34e3});});},'SendFax':function(_0x17e5ce){var _0x5c96ad=this;return new Promise(function(_0x3e2f73,_0x48c11d){_0x48b219[_0x3c9c('0x81')](_0x17e5ce)['then'](function(_0x12bb7b){_0x3e2f73({'code':0xc8,'message':_0x12bb7b[_0x3c9c('0x16')]});})[_0x3c9c('0x17')](function(_0x19db8a){_0x48c11d(_0x5c96ad[_0x3c9c('0x18')](0x1f4,_0x19db8a[_0x3c9c('0x16')]));});});},'CheckAfterSend':function(_0x1fe080){var _0x41c07b=this;return new Promise(function(_0x557dc6,_0xa1de30){_0x48b219[_0x3c9c('0x82')](_0x1fe080)[_0x3c9c('0x15')](function(_0x5614df){_0x557dc6({'code':0xc8,'message':_0x5614df[_0x3c9c('0x16')]});})[_0x3c9c('0x17')](function(_0x37d2b6){_0xa1de30(_0x41c07b[_0x3c9c('0x18')](0x1f4,_0x37d2b6[_0x3c9c('0x16')]));});});}};var _0xdfe4f7=jayson['server'](_0x3ca0ce)[_0x3c9c('0x83')]();_0xdfe4f7['on'](_0x3c9c('0x18'),function(_0x2e158c){return _0x5a2836(_0x2e158c);});_0xdfe4f7[_0x3c9c('0x6')](0x232a,'127.0.0.1',function(){console[_0x3c9c('0x84')](_0x3c9c('0x85'),0x232a);return _0x5c86bd(_0x3c9c('0x86')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index e060333..75ef17a 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 _0xe015=['xmd-contactid','ListId','data3','split','$or','routeId','destcalleridnum','firstName','lastName','mobile','fax','createdAt','union','resolve','then','isEmpty','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridnum','isNil','calleridname','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','','user:%s','name','format','trigger:%s','toLowerCase','merge','length','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','../../rpc/cmContact','defaults','redis','socket.io-emitter','info','[CM][%s][%s]','emit','data2'];(function(_0x59f500,_0x59e8cb){var _0x41824d=function(_0x24a8f3){while(--_0x24a8f3){_0x59f500['push'](_0x59f500['shift']());}};_0x41824d(++_0x59e8cb);}(_0xe015,0xc2));var _0x5e01=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xe015[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x5e01('0x0'));var BPromise=require(_0x5e01('0x1'));var Redis=require(_0x5e01('0x2'));var util=require(_0x5e01('0x3'));var config=require(_0x5e01('0x4'));var logger=require(_0x5e01('0x5'))('trigger');var cmContactRpc=require(_0x5e01('0x6'));config['redis']=_[_0x5e01('0x7')](config[_0x5e01('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x5e01('0x9'))(new Redis(config[_0x5e01('0x8')]));function emit(_0x9e555e,_0x5cad57,_0x41085e,_0x41a85c,_0x22dbf9){logger[_0x5e01('0xa')](_0x5e01('0xb'),_0x9e555e,_0x5cad57['id'],_0x41085e,_0x41a85c,JSON['stringify'](_0x22dbf9));io['to'](_0x41085e)[_0x5e01('0xc')](_0x41a85c,_0x22dbf9);}exports['exec']=function(_0x2b8220,_0x3b4198,_0x4c0fcf,_0x4f125a){var _0x2c876e,_0x11a14d;var _0x1666fd={};var _0x2623ab=Number(_0x4c0fcf['data1']);var _0x203517=_0x4c0fcf[_0x5e01('0xd')]?Boolean(Number(_0x4c0fcf['data2'])):![];var _0xbf8c4b;if(_0x4f125a['xmd-contactid']){_0x1666fd['id']=_0x4f125a[_0x5e01('0xe')];}if(!_0x1666fd['id']){_0x1666fd[_0x5e01('0xf')]=_0x2623ab;_0xbf8c4b=_0x4c0fcf[_0x5e01('0x10')]&&_0x4c0fcf[_0x5e01('0x10')]!=='0'?_0x4c0fcf['data3'][_0x5e01('0x11')](','):['phone'];_0x1666fd[_0x5e01('0x12')]=_['map'](_0xbf8c4b,function(_0x13291d){var _0xce4053={};_0xce4053[_0x13291d]=_0x4f125a[_0x5e01('0x13')]?_0x4f125a[_0x5e01('0x14')]:_0x4f125a['calleridnum'];return _0xce4053;});}var _0x3957eb=['id',_0x5e01('0x15'),_0x5e01('0x16'),'phone',_0x5e01('0x17'),_0x5e01('0x18'),'ListId',_0x5e01('0x19'),'scheduledAt','updatedAt'];var _0x6195bd=_[_0x5e01('0x1a')](_0x3957eb,_0xbf8c4b);BPromise[_0x5e01('0x1b')]()[_0x5e01('0x1c')](cmContactRpc['getContacts']({'attributes':_0x6195bd,'where':_0x1666fd}))['then'](function(_0xe70bc4){_0x11a14d=_0xe70bc4;if(!_[_0x5e01('0x1d')](_0x11a14d)){if(_0x11a14d['length']===0x1){_0x2c876e=_0x11a14d[0x0];logger[_0x5e01('0xa')](_0x5e01('0x1e'),_0x4f125a[_0x5e01('0x1f')],_0x3b4198['id'],_0x2c876e['id']);}else{logger[_0x5e01('0xa')](_0x5e01('0x20'),_0x4f125a['uniqueid'],_0x3b4198['id'],_['map'](_0x11a14d,'id')[_0x5e01('0x21')](','));}return;}else{logger[_0x5e01('0xa')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x4f125a['uniqueid'],_0x3b4198['id']);var _0x21ed82={'ListId':_0x2623ab};var _0x23830b=_0x4c0fcf[_0x5e01('0x22')]&&_0x4c0fcf['data4']!=='0'?_0x4c0fcf[_0x5e01('0x22')]:'phone';if(_0x203517){logger[_0x5e01('0xa')](_0x5e01('0x23'),_0x4f125a[_0x5e01('0x1f')],_0x3b4198['id']);_0x21ed82[_0x23830b]=_['isNil'](_0x4f125a[_0x5e01('0x13')])?_0x4f125a[_0x5e01('0x24')]:_0x4f125a[_0x5e01('0x14')];if(_[_0x5e01('0x25')](_0x4f125a[_0x5e01('0x13')])){_0x21ed82[_0x5e01('0x15')]=_0x4f125a[_0x5e01('0x26')]&&_0x4f125a[_0x5e01('0x26')]!==''?_0x4f125a[_0x5e01('0x26')]:_0x5e01('0x27');}else{_0x21ed82[_0x5e01('0x15')]=_0x4f125a['destcalleridname']&&_0x4f125a[_0x5e01('0x28')]!==''?_0x4f125a['destcalleridname']:_0x5e01('0x27');}return BPromise[_0x5e01('0x1b')]()[_0x5e01('0x1c')](cmContactRpc[_0x5e01('0x29')](_0x21ed82))[_0x5e01('0x1c')](function(_0x8078ee){_0x2c876e=_0x8078ee;_0x11a14d[_0x5e01('0x2a')](_0x8078ee);if(_0x2c876e){logger[_0x5e01('0xa')](_0x5e01('0x2b'),_0x4f125a[_0x5e01('0x1f')],_0x3b4198['id'],_0x2c876e['id']);}return;});}else{logger[_0x5e01('0xa')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0x4f125a[_0x5e01('0x1f')],_0x3b4198['id']);_0x21ed82[_0x23830b]=_[_0x5e01('0x25')](_0x4f125a[_0x5e01('0x13')])?_0x4f125a[_0x5e01('0x24')]:_0x4f125a[_0x5e01('0x14')];if(_[_0x5e01('0x25')](_0x4f125a['routeId'])){_0x21ed82[_0x5e01('0x15')]=_0x4f125a[_0x5e01('0x26')]&&_0x4f125a[_0x5e01('0x26')]!==_0x5e01('0x2c')?_0x4f125a[_0x5e01('0x26')]:_0x5e01('0x27');}else{_0x21ed82['firstName']=_0x4f125a[_0x5e01('0x28')]&&_0x4f125a[_0x5e01('0x28')]!==_0x5e01('0x2c')?_0x4f125a[_0x5e01('0x28')]:_0x5e01('0x27');}_0x2c876e=_0x21ed82;_0x11a14d['push'](_0x21ed82);return;}}})[_0x5e01('0x1c')](function(){if(_0x2b8220){emit(_0x4f125a[_0x5e01('0x1f')],_0x3b4198,util['format'](_0x5e01('0x2d'),_0x2b8220[_0x5e01('0x2e')]),util[_0x5e01('0x2f')](_0x5e01('0x30'),_0x4c0fcf['action'][_0x5e01('0x31')]()),{'evt':_[_0x5e01('0x32')](_0x4f125a,{'autoCreate':_0x203517}),'contact':_0x2c876e===undefined?{}:_0x2c876e,'contacts':_0x11a14d[_0x5e01('0x33')]===0x0?undefined:_0x11a14d});}});}; \ No newline at end of file +var _0x5943=['length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','data4','isNil','calleridname','Unknown','destcalleridname','','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','name','trigger:%s','toLowerCase','lodash','bluebird','util','../../../../config/environment','../../../../config/logger','redis','defaults','socket.io-emitter','info','stringify','exec','data2','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','mobile','fax','createdAt','scheduledAt','union','resolve','getContacts','then'];(function(_0x3899ec,_0x36caf){var _0x40d544=function(_0x1ad0f9){while(--_0x1ad0f9){_0x3899ec['push'](_0x3899ec['shift']());}};_0x40d544(++_0x36caf);}(_0x5943,0x77));var _0x3594=function(_0x27a8d7,_0x1c0842){_0x27a8d7=_0x27a8d7-0x0;var _0x106b72=_0x5943[_0x27a8d7];return _0x106b72;};'use strict';var _=require(_0x3594('0x0'));var BPromise=require(_0x3594('0x1'));var Redis=require('ioredis');var util=require(_0x3594('0x2'));var config=require(_0x3594('0x3'));var logger=require(_0x3594('0x4'))('trigger');var cmContactRpc=require('../../rpc/cmContact');config[_0x3594('0x5')]=_[_0x3594('0x6')](config[_0x3594('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x3594('0x7'))(new Redis(config['redis']));function emit(_0x4db81c,_0x346520,_0x370cb4,_0x326094,_0x209070){logger[_0x3594('0x8')]('[CM][%s][%s]',_0x4db81c,_0x346520['id'],_0x370cb4,_0x326094,JSON[_0x3594('0x9')](_0x209070));io['to'](_0x370cb4)['emit'](_0x326094,_0x209070);}exports[_0x3594('0xa')]=function(_0x16e6c7,_0x22a0b5,_0x2f5ba1,_0x4cd4be){var _0x2d2cbc,_0xbca33;var _0x1fd4f4={};var _0x4eee25=Number(_0x2f5ba1['data1']);var _0x5cf63b=_0x2f5ba1[_0x3594('0xb')]?Boolean(Number(_0x2f5ba1[_0x3594('0xb')])):![];var _0x3eebfb;if(_0x4cd4be['xmd-contactid']){_0x1fd4f4['id']=_0x4cd4be[_0x3594('0xc')];}if(!_0x1fd4f4['id']){_0x1fd4f4[_0x3594('0xd')]=_0x4eee25;_0x3eebfb=_0x2f5ba1[_0x3594('0xe')]&&_0x2f5ba1[_0x3594('0xe')]!=='0'?_0x2f5ba1[_0x3594('0xe')][_0x3594('0xf')](','):[_0x3594('0x10')];_0x1fd4f4[_0x3594('0x11')]=_[_0x3594('0x12')](_0x3eebfb,function(_0x3958ad){var _0x392467={};_0x392467[_0x3958ad]=_0x4cd4be[_0x3594('0x13')]?_0x4cd4be[_0x3594('0x14')]:_0x4cd4be[_0x3594('0x15')];return _0x392467;});}var _0x3467de=['id',_0x3594('0x16'),'lastName','phone',_0x3594('0x17'),_0x3594('0x18'),_0x3594('0xd'),_0x3594('0x19'),_0x3594('0x1a'),'updatedAt'];var _0x3d1c26=_[_0x3594('0x1b')](_0x3467de,_0x3eebfb);BPromise[_0x3594('0x1c')]()['then'](cmContactRpc[_0x3594('0x1d')]({'attributes':_0x3d1c26,'where':_0x1fd4f4}))[_0x3594('0x1e')](function(_0xfb4000){_0xbca33=_0xfb4000;if(!_['isEmpty'](_0xbca33)){if(_0xbca33[_0x3594('0x1f')]===0x1){_0x2d2cbc=_0xbca33[0x0];logger['info'](_0x3594('0x20'),_0x4cd4be[_0x3594('0x21')],_0x22a0b5['id'],_0x2d2cbc['id']);}else{logger[_0x3594('0x8')](_0x3594('0x22'),_0x4cd4be[_0x3594('0x21')],_0x22a0b5['id'],_[_0x3594('0x12')](_0xbca33,'id')[_0x3594('0x23')](','));}return;}else{logger[_0x3594('0x8')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x4cd4be[_0x3594('0x21')],_0x22a0b5['id']);var _0x45c227={'ListId':_0x4eee25};var _0x462da0=_0x2f5ba1['data4']&&_0x2f5ba1['data4']!=='0'?_0x2f5ba1[_0x3594('0x24')]:_0x3594('0x10');if(_0x5cf63b){logger['info']('[CM][%s][%s]\x20Autocreate\x20enabled',_0x4cd4be['uniqueid'],_0x22a0b5['id']);_0x45c227[_0x462da0]=_[_0x3594('0x25')](_0x4cd4be[_0x3594('0x13')])?_0x4cd4be[_0x3594('0x15')]:_0x4cd4be[_0x3594('0x14')];if(_['isNil'](_0x4cd4be[_0x3594('0x13')])){_0x45c227[_0x3594('0x16')]=_0x4cd4be['calleridname']&&_0x4cd4be[_0x3594('0x26')]!==''?_0x4cd4be[_0x3594('0x26')]:_0x3594('0x27');}else{_0x45c227['firstName']=_0x4cd4be[_0x3594('0x28')]&&_0x4cd4be[_0x3594('0x28')]!==_0x3594('0x29')?_0x4cd4be[_0x3594('0x28')]:_0x3594('0x27');}return BPromise[_0x3594('0x1c')]()['then'](cmContactRpc[_0x3594('0x2a')](_0x45c227))[_0x3594('0x1e')](function(_0x27be7f){_0x2d2cbc=_0x27be7f;_0xbca33[_0x3594('0x2b')](_0x27be7f);if(_0x2d2cbc){logger[_0x3594('0x8')](_0x3594('0x2c'),_0x4cd4be[_0x3594('0x21')],_0x22a0b5['id'],_0x2d2cbc['id']);}return;});}else{logger['info'](_0x3594('0x2d'),_0x4cd4be[_0x3594('0x21')],_0x22a0b5['id']);_0x45c227[_0x462da0]=_[_0x3594('0x25')](_0x4cd4be['routeId'])?_0x4cd4be[_0x3594('0x15')]:_0x4cd4be[_0x3594('0x14')];if(_[_0x3594('0x25')](_0x4cd4be[_0x3594('0x13')])){_0x45c227[_0x3594('0x16')]=_0x4cd4be['calleridname']&&_0x4cd4be[_0x3594('0x26')]!==_0x3594('0x29')?_0x4cd4be[_0x3594('0x26')]:_0x3594('0x27');}else{_0x45c227[_0x3594('0x16')]=_0x4cd4be['destcalleridname']&&_0x4cd4be['destcalleridname']!==''?_0x4cd4be[_0x3594('0x28')]:_0x3594('0x27');}_0x2d2cbc=_0x45c227;_0xbca33[_0x3594('0x2b')](_0x45c227);return;}}})[_0x3594('0x1e')](function(){if(_0x16e6c7){emit(_0x4cd4be['uniqueid'],_0x22a0b5,util[_0x3594('0x2e')]('user:%s',_0x16e6c7[_0x3594('0x2f')]),util[_0x3594('0x2e')](_0x3594('0x30'),_0x2f5ba1['action'][_0x3594('0x31')]()),{'evt':_['merge'](_0x4cd4be,{'autoCreate':_0x5cf63b}),'contact':_0x2d2cbc===undefined?{}:_0x2d2cbc,'contacts':_0xbca33['length']===0x0?undefined:_0xbca33});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index f7b5f03..ae89b2f 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 _0xf938=['zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:rejectmessage','prototype','emit','info','stringify','clone','motionChannel','undefined','checkTriggers','status','checkTrigger','merge','variables','Actions','length','toLowerCase','contactmanager','motionbar','data1','TemplateId','data2','html','render','template\x20not\x20found','isNil','data3','location','uriLocation','data4','windowWidth','data5','800','windowHeight','600','data6','winApplication','winArguments','format','user:%s','interface','trigger:%s:%s','action','jscripty','name','trigger:%s','exec','queue','routeId','urlforward','parse','query','search','channel','AllConditions','every','checkConditions','account','chat','ChatWebsiteId','operator','value','upperFirst','AccountId','interaction','message','event','agent','membername','lastevent','exports','util','lodash','mustache','ioredis','./urlforward','./integration','./cmContact','./script','../../../config/environment','../ami','redis','socket.io-emitter','popup','url','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts'];(function(_0x5458b0,_0x1db8d5){var _0x5fcbee=function(_0x3c4910){while(--_0x3c4910){_0x5458b0['push'](_0x5458b0['shift']());}};_0x5fcbee(++_0x1db8d5);}(_0xf938,0xd0));var _0x8f93=function(_0x3388d8,_0x256024){_0x3388d8=_0x3388d8-0x0;var _0x2bbe73=_0xf938[_0x3388d8];return _0x2bbe73;};'use strict';var util=require(_0x8f93('0x0'));var _=require(_0x8f93('0x1'));var url=require('url');var Mustache=require(_0x8f93('0x2'));var Redis=require(_0x8f93('0x3'));var urlforward=require(_0x8f93('0x4'));var integration=require(_0x8f93('0x5'));var cmContact=require(_0x8f93('0x6'));var script=require(_0x8f93('0x7'));var config=require(_0x8f93('0x8'));var logger=require('../../../config/logger')('trigger');var ami=require(_0x8f93('0x9'));config['redis']=_['defaults'](config[_0x8f93('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x8f93('0xb'))(new Redis(config[_0x8f93('0xa')]));var operators={'equals':function(_0x2dd472,_0x293975){return _0x2dd472==_0x293975;},'not_equals':function(_0x1f049e,_0x670970){return _0x1f049e!=_0x670970;}};var barAndWebActions=[_0x8f93('0xc'),_0x8f93('0xd'),_0x8f93('0xe')];function Trigger(_0x3aff29){this[_0x8f93('0xf')]=_0x3aff29[_0x8f93('0xf')];this[_0x8f93('0x10')]=_0x3aff29[_0x8f93('0x10')];this[_0x8f93('0x11')]=_0x3aff29[_0x8f93('0x11')];this[_0x8f93('0x12')]=_0x3aff29['templates'];this[_0x8f93('0x13')]=_0x3aff29[_0x8f93('0x13')];this['zendeskAccounts']=_0x3aff29[_0x8f93('0x14')];this[_0x8f93('0x15')]=_0x3aff29[_0x8f93('0x15')];this['salesforceAccounts']=_0x3aff29[_0x8f93('0x16')];this['sugarcrmAccounts']=_0x3aff29[_0x8f93('0x17')];this[_0x8f93('0x18')]=_0x3aff29[_0x8f93('0x18')];this[_0x8f93('0x19')]=_0x3aff29['deskAccounts'];this[_0x8f93('0x1a')]=_0x3aff29[_0x8f93('0x1a')];this[_0x8f93('0x1b')]=_0x3aff29[_0x8f93('0x1b')];this[_0x8f93('0x1c')]=_0x3aff29[_0x8f93('0x1c')];this[_0x8f93('0x1d')]=_0x3aff29['freshsalesAccounts'];this[_0x8f93('0x1e')]={'zendesk':this['zendeskAccounts'],'salesforce':this[_0x8f93('0x16')],'freshdesk':this[_0x8f93('0x15')],'sugarcrm':this[_0x8f93('0x17')],'zoho':this[_0x8f93('0x18')],'desk':this['deskAccounts'],'vtiger':this['vtigerAccounts'],'dynamics365':this['dynamics365Accounts'],'freshsales':this[_0x8f93('0x1d')],'servicenow':this[_0x8f93('0x1b')]};ami['on']('custom:agentcalled',this[_0x8f93('0x1f')][_0x8f93('0x20')](this));ami['on'](_0x8f93('0x21'),this[_0x8f93('0x1f')][_0x8f93('0x20')](this));ami['on'](_0x8f93('0x22'),this['syncCustomEvent'][_0x8f93('0x20')](this));ami['on']('custom:agentcomplete',this[_0x8f93('0x1f')][_0x8f93('0x20')](this));ami['on']('custom:agentnosuchnumber',this[_0x8f93('0x1f')]['bind'](this));ami['on'](_0x8f93('0x23'),this[_0x8f93('0x1f')]['bind'](this));ami['on'](_0x8f93('0x24'),this['syncCustomEvent'][_0x8f93('0x20')](this));ami['on'](_0x8f93('0x25'),this['syncCustomEvent'][_0x8f93('0x20')](this));ami['on'](_0x8f93('0x26'),this[_0x8f93('0x1f')][_0x8f93('0x20')](this));ami['on']('custom:amd',this[_0x8f93('0x1f')]['bind'](this));ami['on']('custom:queuecallerabandon',this[_0x8f93('0x1f')][_0x8f93('0x20')](this));ami['on']('custom:timeout',this[_0x8f93('0x1f')][_0x8f93('0x20')](this));ami['on'](_0x8f93('0x27'),this[_0x8f93('0x28')][_0x8f93('0x20')](this));ami['on'](_0x8f93('0x29'),this['syncAgentDial'][_0x8f93('0x20')](this));ami['on'](_0x8f93('0x2a'),this[_0x8f93('0x28')][_0x8f93('0x20')](this));ami['on']('custom:newinteraction',this[_0x8f93('0x1f')]['bind'](this));ami['on'](_0x8f93('0x2b'),this['syncCustomEvent'][_0x8f93('0x20')](this));ami['on'](_0x8f93('0x2c'),this[_0x8f93('0x1f')][_0x8f93('0x20')](this));ami['on'](_0x8f93('0x2d'),this['syncCustomEvent'][_0x8f93('0x20')](this));ami['on']('custom:acceptmessage',this[_0x8f93('0x1f')][_0x8f93('0x20')](this));ami['on'](_0x8f93('0x2e'),this['syncCustomEvent'][_0x8f93('0x20')](this));}Trigger[_0x8f93('0x2f')][_0x8f93('0x30')]=function(_0x200952,_0x19730b,_0x88fcce){logger[_0x8f93('0x31')](_0x200952,_0x19730b,JSON[_0x8f93('0x32')](_0x88fcce));io['to'](_0x200952)[_0x8f93('0x30')](_0x19730b,_0x88fcce);};Trigger['prototype'][_0x8f93('0x1f')]=function(_0x1bf8c7){var _0x106595=_[_0x8f93('0x33')](_0x1bf8c7);if(typeof _0x106595[_0x8f93('0x34')]===_0x8f93('0x35')){_0x106595[_0x8f93('0x34')]='voice';}this[_0x8f93('0x36')](_0x106595);};Trigger[_0x8f93('0x2f')]['syncAgentDial']=function(_0x29171b){if(this['agents'][_0x29171b['interface']]){this[_0x8f93('0x1f')](_0x29171b);}};Trigger[_0x8f93('0x2f')][_0x8f93('0x36')]=function(_0xd41556){var _0x453c70;for(var _0x3d3f65 in this[_0x8f93('0xf')]){if(this[_0x8f93('0xf')]['hasOwnProperty'](_0x3d3f65)){if(this['triggers'][_0x3d3f65][_0x8f93('0x37')]){_0x453c70=this[_0x8f93('0x38')](this[_0x8f93('0xf')][_0x3d3f65],_0xd41556);if(_0x453c70){_[_0x8f93('0x39')](_0xd41556,_0xd41556[_0x8f93('0x3a')]);for(var _0x2cef83=0x0,_0x446aaf,_0x3d62b8,_0x8d47da;_0x2cef830x0){_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 +var _0x7217=['format','%s/users','remoteUri','then','total_entries','find','entries','info','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','debug','stringify','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','_embedded','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','length','map','forEach','string','picklist','nameField','customField','content','toString','includes','idField','custom_fields','variable','variableName','type','customVariable','Variable','name','toLowerCase','priority','Creating\x20new\x20ticket...','merge','getString','new','xCALLY','Motion','CTI','Tags','Descriptions','user','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','integrationTab','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','catch','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','The\x20Ticket\x20ID\x20is:','%s/agent/tickets/%s','unmanaged','lastevent','toUpperCase','calleridname','lodash','md5','util','ioredis','./util','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','emit','application/json','validateEmail','Getting\x20agent\x20with\x20email'];(function(_0x35bf33,_0x3be84f){var _0x1c3514=function(_0x52fc8d){while(--_0x52fc8d){_0x35bf33['push'](_0x35bf33['shift']());}};_0x1c3514(++_0x3be84f);}(_0x7217,0x19e));var _0x7721=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0x7217[_0x38a7ac];return _0x53061a;};'use strict';var _=require(_0x7721('0x0'));var rp=require('request-promise');var md5=require(_0x7721('0x1'));var util=require(_0x7721('0x2'));var Redis=require(_0x7721('0x3'));var intUtil=require(_0x7721('0x4'));var config=require(_0x7721('0x5'));var logger=require('../../../../config/logger')('desk');config[_0x7721('0x6')]=_[_0x7721('0x7')](config[_0x7721('0x6')],{'host':_0x7721('0x8'),'port':0x18eb});var io=require(_0x7721('0x9'))(new Redis(config[_0x7721('0x6')]));function emit(_0x18ab6b,_0x21f680,_0x225610){io['to'](_0x18ab6b)[_0x7721('0xa')](_0x21f680,_0x225610);}var headers={'Content-Type':_0x7721('0xb'),'Accept':_0x7721('0xb')};function getUser(_0xfa8835,_0x138740){if(intUtil[_0x7721('0xc')](_0x138740)===!![]){logger['info'](_0x7721('0xd'),_0x138740);return request({'uri':util[_0x7721('0xe')](_0x7721('0xf'),_0xfa8835[_0x7721('0x10')])})[_0x7721('0x11')](function(_0x409b37){if(_0x409b37[_0x7721('0x12')]){return _[_0x7721('0x13')](_0x409b37['_embedded'][_0x7721('0x14')],{'email':_0x138740});}})[_0x7721('0x11')](function(_0x57ff6d){if(_0x57ff6d){logger[_0x7721('0x15')](_0x7721('0x16'));return _0x57ff6d;}else{logger[_0x7721('0x15')](_0x7721('0x17'));return request({'uri':util['format'](_0x7721('0x18'),_0xfa8835[_0x7721('0x10')])});}});}else{logger['info']('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x7721('0x18'),_0xfa8835[_0x7721('0x10')])});}}function request(_0x3cc909){logger[_0x7721('0x19')]('[HTTP]',JSON[_0x7721('0x1a')](_0x3cc909));return rp(_['defaults'](_0x3cc909,{'method':_0x7721('0x1b'),'headers':headers,'json':!![]}));}function getAuth(_0x5cb0e6){var _0xfec626;if(_0x5cb0e6[_0x7721('0x1c')]===_0x7721('0x1d')){_0xfec626=util[_0x7721('0xe')](_0x7721('0x1e'),_0x5cb0e6[_0x7721('0x1f')],_0x5cb0e6[_0x7721('0x20')]);}else if(_0x5cb0e6[_0x7721('0x1c')]===_0x7721('0x21')){_0xfec626=util[_0x7721('0xe')]('%s/token:%s',_0x5cb0e6[_0x7721('0x1f')],_0x5cb0e6[_0x7721('0x21')]);}return util[_0x7721('0xe')](_0x7721('0x22'),new Buffer(_0xfec626)['toString'](_0x7721('0x23')));}function getEndUser(_0x512f31,_0xb9e9dd,_0x288e3a){logger[_0x7721('0x15')](_0x7721('0x24'),_0x288e3a);return request({'uri':util[_0x7721('0xe')](_0x7721('0x25'),_0x512f31[_0x7721('0x10')]),'qs':{'phone':_0x288e3a}})['then'](function(_0x216f20){if(_0x216f20[_0x7721('0x12')]){logger[_0x7721('0x15')](_0x7721('0x26'));return _0x216f20[_0x7721('0x27')][_0x7721('0x14')][0x0];}else{logger[_0x7721('0x15')](_0x7721('0x28'));return request({'uri':util[_0x7721('0xe')]('%s/customers',_0x512f31[_0x7721('0x10')]),'method':'POST','body':{'first_name':_0xb9e9dd,'title':_0xb9e9dd,'phone_numbers':[{'type':'work','value':_0x288e3a}]}});}});}function getTags(_0x315202,_0x343c19){var _0x53c904=[];if(_0x315202&&_0x315202[_0x7721('0x29')]>0x0){_0x53c904=_[_0x7721('0x2a')](_0x315202,_0x343c19);}return _0x53c904;}function getCustomFields(_0x37b9f0,_0xd7d703){var _0x1da2d8=[];var _0x5c54f0={'custom_fields':{}};if(_0x37b9f0[_0x7721('0x29')]>0x0){_[_0x7721('0x2b')](_0x37b9f0,function(_0x497f9f){if(_['includes']([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x2e')]&&!_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x497f9f[_0x7721('0x2e')]['toLowerCase']()]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_[_0x7721('0x32')]([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x7721('0x34')][_0x497f9f['idField']]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_0x497f9f['type']===_0x7721('0x35')&&_0x497f9f['variableName']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0xd7d703[_0x497f9f[_0x7721('0x36')]]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x36')]][_0x7721('0x31')]());}else if(_0x497f9f[_0x7721('0x37')]===_0x7721('0x38')&&_0x497f9f[_0x7721('0x39')]&&_0x497f9f[_0x7721('0x39')]['name']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f['customField']){_0xd7d703[_0x497f9f[_0x7721('0x39')][_0x7721('0x3a')][_0x7721('0x3b')]()]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x39')]['name']['toLowerCase']()]['toString']());}});}if(_0x5c54f0['priority']){_0x5c54f0[_0x7721('0x3c')]=Number(_0x5c54f0[_0x7721('0x3c')]);}return _0x5c54f0;}function getTicket(_0x1acc72,_0x22ef35,_0x4a90ce,_0xa389fa,_0x4cf659){logger[_0x7721('0x15')](_0x7721('0x3d'));var _0x5a278e=_[_0x7721('0x3e')]({'subject':intUtil[_0x7721('0x3f')](_0xa389fa['Subjects'],_0x4cf659,'\x20'),'type':'phone','status':_0x7721('0x40'),'labels':[_0x7721('0x41'),_0x7721('0x42'),_0x7721('0x43')]['concat'](getTags(_0xa389fa[_0x7721('0x44')],_0x7721('0x3a'))),'description':intUtil[_0x7721('0x3f')](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7721('0xe')]('/api/v2/users/%d',_0x22ef35['id']),'class':_0x7721('0x46')}},'message':{'direction':'in','body':intUtil['getString'](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a')}},getCustomFields(_0xa389fa['Fields'],_0x4cf659));return request({'uri':util[_0x7721('0xe')](_0x7721('0x47'),_0x1acc72[_0x7721('0x10')],_0x4a90ce['id']),'method':'POST','body':_0x5a278e});}exports[_0x7721('0x48')]=function(_0x11d853,_0x1ad315,_0x481fa8,_0x9f7b1d,_0x754071,_0xdb3033){var _0x2d5f35,_0x135dbc;_0xdb3033[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0xdb3033['remoteUri']);_0xdb3033['serverUrl']=intUtil[_0x7721('0x49')](_0xdb3033[_0x7721('0x4a')]);if(_0x754071&&_0x754071[_0x7721('0x4b')]){logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x4d'));_0x1ad315[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0xdb3033[_0x7721('0x4a')],_0x1ad315['uniqueid'],md5(_0x1ad315['uniqueid']));}else{_0x1ad315[_0x7721('0x4e')]='';}headers[_0x7721('0x50')]=getAuth(_0xdb3033);return getUser(_0xdb3033,_0x9f7b1d[_0x7721('0x51')])[_0x7721('0x11')](function(_0x589e95){_0x2d5f35=_0x589e95;logger[_0x7721('0x15')](_0x7721('0x52'),_0x2d5f35['id']);return getEndUser(_0xdb3033,_0x1ad315['calleridname'],_0x1ad315[_0x7721('0x53')]);})['then'](function(_0x2682b1){_0x135dbc=_0x2682b1;logger['info'](_0x7721('0x54'),_0x135dbc['id']);return getTicket(_0xdb3033,_0x2d5f35,_0x135dbc,_0x481fa8,_0x1ad315);})[_0x7721('0x11')](function(_0xf17c40){if(_0xf17c40){logger['info'](_0x7721('0x55'));logger[_0x7721('0x15')]('The\x20Ticket\x20ID\x20is:',_0xf17c40['id']);switch(_0xdb3033[_0x7721('0x37')]){case _0x7721('0x56'):logger[_0x7721('0x15')]('[QUEUE]',_0x7721('0x57'));emit(util['format'](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0xf17c40['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x5d'),_0xf17c40['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x4c'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2f6f30){console[_0x7721('0x5e')](_0x2f6f30);logger[_0x7721('0x5e')](_0x7721('0x4c'),JSON[_0x7721('0x1a')](_0x2f6f30));});};exports[_0x7721('0x60')]=function(_0x57484c,_0x234bee,_0x17036e,_0x134908,_0x3b7382,_0x1f1e84,_0x9c0d4){var _0x7fbd6c,_0x33287d;_0x1f1e84[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x10')]);_0x1f1e84['serverUrl']=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x4a')]);if(_0x9c0d4&&_0x9c0d4[_0x7721('0x61')]&&_0x9c0d4[_0x7721('0x61')]!==_0x7721('0x62')){logger[_0x7721('0x15')](_0x7721('0x63'),_0x7721('0x4d'));_0x234bee[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0x1f1e84[_0x7721('0x4a')],_0x234bee[_0x7721('0x64')],md5(_0x234bee[_0x7721('0x64')]));}headers[_0x7721('0x50')]=getAuth(_0x1f1e84);return getUser(_0x1f1e84,_0x134908['email'])['then'](function(_0x4e112e){_0x7fbd6c=_0x4e112e;logger[_0x7721('0x15')]('The\x20User\x20ID\x20is:',_0x7fbd6c['id']);return getEndUser(_0x1f1e84,_0x234bee['destcalleridname'],_0x234bee['destcalleridnum']);})['then'](function(_0x47925a){_0x33287d=_0x47925a;logger[_0x7721('0x15')](_0x7721('0x54'),_0x33287d['id']);return getTicket(_0x1f1e84,_0x7fbd6c,_0x33287d,_0x17036e,_0x234bee);})['then'](function(_0x5181d7){if(_0x5181d7){logger['info']('Ticket\x20created!');logger['info'](_0x7721('0x65'),_0x5181d7['id']);switch(_0x1f1e84['type']){case'integrationTab':logger['info'](_0x7721('0x4c'),_0x7721('0x57'));emit(util[_0x7721('0xe')]('user:%s',_0x134908[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0x5181d7['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x134908[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x66'),_0x1f1e84[_0x7721('0x10')],_0x5181d7['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x63'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2c93b0){logger[_0x7721('0x5e')](_0x7721('0x63'),JSON['stringify'](_0x2c93b0));});};exports[_0x7721('0x67')]=function(_0x104f05,_0x4c8284,_0x3e7df3,_0x5d37ad,_0x1f508d,_0x4bfb48){var _0x36a3a6,_0x3f9eaa;_0x4bfb48[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x4bfb48[_0x7721('0x10')]);_0x4bfb48[_0x7721('0x4a')]=intUtil[_0x7721('0x49')](_0x4bfb48['serverUrl']);if(_0x1f508d&&_0x1f508d[_0x7721('0x4b')]){logger[_0x7721('0x15')]('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',_0x7721('0x4d'));_0x4c8284[_0x7721('0x4e')]=util[_0x7721('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4bfb48[_0x7721('0x4a')],_0x4c8284[_0x7721('0x64')],md5(_0x4c8284['uniqueid']));}else{_0x4c8284[_0x7721('0x4e')]='';}headers['Authorization']=getAuth(_0x4bfb48);return getUser(_0x4bfb48)[_0x7721('0x11')](function(_0x382800){_0x36a3a6=_0x382800;logger[_0x7721('0x15')](_0x7721('0x52'),_0x36a3a6['id']);return getEndUser(_0x4bfb48,_0x4c8284[_0x7721('0x6a')],_0x4c8284[_0x7721('0x53')]);})[_0x7721('0x11')](function(_0x5dca04){_0x3f9eaa=_0x5dca04;logger[_0x7721('0x15')](_0x7721('0x54'),_0x3f9eaa['id']);return getTicket(_0x4bfb48,_0x36a3a6,_0x3f9eaa,_0x3e7df3,_0x4c8284);})[_0x7721('0x11')](function(_0x5f08cc){if(_0x5f08cc){logger['info']('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x5f08cc['id']);}})[_0x7721('0x5f')](function(_0x2645dd){logger['error']('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',JSON[_0x7721('0x1a')](_0x2645dd));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 5bd1a91..c139db8 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 _0xf3bb=['forEach','includes','picklist','customField','idField','indexOf','incident','incidents','assign','getString','Subjects','Descriptions','ticketType','phonecall','phonecalls','/contacts(','queue','callDirection','Fields','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','remoteUri','stripTrailingSlash','serverUrl','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','request-promise','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','POST','clientId','username','password','clientSecret','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','userEmail','length','internalemailaddress','email','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','odata-entityid','substring','lastIndexOf','enduserId','GET','%2b','telephone1','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!'];(function(_0x45f165,_0x14a9fd){var _0x1b9f2f=function(_0x551db0){while(--_0x551db0){_0x45f165['push'](_0x45f165['shift']());}};_0x1b9f2f(++_0x14a9fd);}(_0xf3bb,0x15a));var _0xbf3b=function(_0x176f93,_0x3e9034){_0x176f93=_0x176f93-0x0;var _0x490057=_0xf3bb[_0x176f93];return _0x490057;};'use strict';var _=require(_0xbf3b('0x0'));var BPromise=require(_0xbf3b('0x1'));var rp=require(_0xbf3b('0x2'));var util=require('util');var intUtil=require('./util');var md5=require('md5');var Redis=require(_0xbf3b('0x3'));var logger=require(_0xbf3b('0x4'))(_0xbf3b('0x5'));var config=require(_0xbf3b('0x6'));config[_0xbf3b('0x7')]=_[_0xbf3b('0x8')](config['redis'],{'host':_0xbf3b('0x9'),'port':0x18eb});var io=require(_0xbf3b('0xa'))(new Redis(config[_0xbf3b('0x7')]));function getAuthToken(_0x45ca4c,_0x1808d7,_0x243d4b){var _0xb84842={'method':_0xbf3b('0xb'),'uri':_0x1808d7,'form':{'client_id':_0x45ca4c[_0xbf3b('0xc')],'resource':_0x45ca4c['remoteUri'],'username':_0x45ca4c[_0xbf3b('0xd')],'password':_0x45ca4c[_0xbf3b('0xe')],'grant_type':_0xbf3b('0xe'),'client_secret':_0x45ca4c[_0xbf3b('0xf')]},'json':!![]};return rp(_0xb84842)[_0xbf3b('0x10')](function(_0x47dbf6){return _0x47dbf6[_0xbf3b('0x11')];})[_0xbf3b('0x12')](function(_0xc4882e){logger[_0xbf3b('0x13')]('['+[_0x243d4b[_0xbf3b('0x14')]()]+_0xbf3b('0x15'));return _0xc4882e[_0xbf3b('0x16')];});}function getUser(_0x4d7aa3,_0x84e0d3,_0x4ba103,_0x5bbea2,_0x5082b,_0x2ff998){return new BPromise(function(_0x894076,_0x4d362d){return getAuthToken(_0x84e0d3,_0x5bbea2,_0x2ff998)[_0xbf3b('0x10')](function(_0x3f6ea9){var _0x59b3f5={'method':'GET','uri':_0x5082b+_0xbf3b('0x17'),'headers':{'Authorization':_0xbf3b('0x18')+_0x3f6ea9,'OData-Version':_0xbf3b('0x19')},'json':!![]};return rp(_0x59b3f5);})[_0xbf3b('0x10')](function(_0x29f702){var _0x47fef3=_0x29f702[_0xbf3b('0x1a')];var _0x589064=![];var _0x3467eb=null;if(!_[_0xbf3b('0x1b')](_0x4ba103)){if(intUtil[_0xbf3b('0x1c')](_0x4ba103['email'])){_0x4d7aa3[_0xbf3b('0x1d')]=_0x4ba103['email'];for(_0x3467eb=0x0;_0x3467eb<_0x47fef3[_0xbf3b('0x1e')];_0x3467eb++){if(_0x47fef3[_0x3467eb][_0xbf3b('0x1f')]===_0x4ba103[_0xbf3b('0x20')]&&!_0x47fef3[_0x3467eb][_0xbf3b('0x21')]){_0x589064=!![];logger[_0xbf3b('0x22')]('['+[_0x2ff998['toUpperCase']()]+_0xbf3b('0x23')+_0x47fef3[_0x3467eb][_0xbf3b('0x24')]+'!');_0x4d7aa3['userId']=_0x47fef3[_0x3467eb]['systemuserid'];}}}}if(!_0x589064){logger[_0xbf3b('0x22')]('['+[_0x2ff998[_0xbf3b('0x14')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x4d7aa3[_0xbf3b('0x1d')]=_0x84e0d3[_0xbf3b('0xd')];for(_0x3467eb=0x0;_0x3467eb<_0x47fef3['length'];_0x3467eb++){if(_0x47fef3[_0x3467eb][_0xbf3b('0x1f')]===_0x84e0d3[_0xbf3b('0xd')]){_0x4d7aa3[_0xbf3b('0x25')]=_0x47fef3[_0x3467eb][_0xbf3b('0x24')];}}}_0x894076(_0x4d7aa3);})[_0xbf3b('0x12')](function(_0x206758){_0x4d362d(_0x206758['message']);});});}function createEndUser(_0x271708,_0x3747c5,_0x3c7ad4,_0x195857,_0x51dac2,_0x1e584e){return new BPromise(function(_0x4d9166,_0x218445){return getAuthToken(_0x3747c5,_0x3c7ad4,_0x1e584e)[_0xbf3b('0x10')](function(_0xe026aa){var _0x3f4d96=_0x1e584e[_0xbf3b('0x26')]()===_0xbf3b('0x27')?_0x51dac2[_0xbf3b('0x28')]:_0x51dac2[_0xbf3b('0x29')];var _0x23d054={'method':'POST','uri':_0x195857+_0xbf3b('0x2a'),'body':{'telephone1':_0x3f4d96,'fullname':_0x3f4d96,'firstname':_0x3f4d96,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xbf3b('0x2b')+_0x271708[_0xbf3b('0x25')]+')'},'headers':{'Authorization':'Bearer\x20'+_0xe026aa,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x23d054);})['then'](function(_0x50d5c9){var _0x385f4f=_0x50d5c9['headers'][_0xbf3b('0x2c')];var _0x245fb1=_0x385f4f[_0xbf3b('0x2d')](_0x385f4f[_0xbf3b('0x2e')]('(')+0x1,_0x385f4f['lastIndexOf'](')'));_0x271708[_0xbf3b('0x2f')]=_0x245fb1;_0x4d9166(_0x271708);})[_0xbf3b('0x12')](function(_0x4d9dd4){_0x218445(_0x4d9dd4[_0xbf3b('0x16')]);});});}function getEndUser(_0x52e50a,_0x2b7a50,_0x375c59,_0x5e226f,_0x3485f3,_0x475c00){return new BPromise(function(_0x57872b,_0x562eb2){var _0x29c2aa=_0x475c00[_0xbf3b('0x26')]()===_0xbf3b('0x27')?_0x3485f3[_0xbf3b('0x28')]:_0x3485f3[_0xbf3b('0x29')];return getAuthToken(_0x2b7a50,_0x375c59,_0x475c00)[_0xbf3b('0x10')](function(_0x451f64){var _0x240a13={'method':_0xbf3b('0x30'),'uri':_0x5e226f+'contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27'+_0x29c2aa['replace']('+',_0xbf3b('0x31'))+'\x27','headers':{'Authorization':_0xbf3b('0x18')+_0x451f64,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x240a13);})['then'](function(_0x4457d4){var _0x6304b7=null;if(_0x4457d4){var _0x3f0f2c=_0x4457d4[_0xbf3b('0x1a')];var _0xe13660=![];for(_0x6304b7=0x0;_0x6304b7<_0x3f0f2c[_0xbf3b('0x1e')];_0x6304b7++){if(_0x3f0f2c[_0x6304b7][_0xbf3b('0x32')]===_0x29c2aa){_0xe13660=!![];_0x52e50a[_0xbf3b('0x2f')]=_0x3f0f2c[_0x6304b7][_0xbf3b('0x33')];}}if(_0xe13660){_0x57872b(_0x52e50a);}else{return createEndUser(_0x52e50a,_0x2b7a50,_0x375c59,_0x5e226f,_0x3485f3,_0x475c00)[_0xbf3b('0x10')](function(_0x33445f){logger['info']('['+[_0x475c00[_0xbf3b('0x14')]()]+_0xbf3b('0x34'),_0x33445f['enduserId']);_0x57872b(_0x33445f);});}}else{return createEndUser(_0x52e50a,_0x2b7a50,_0x375c59,_0x5e226f,_0x3485f3,_0x475c00)[_0xbf3b('0x10')](function(_0xe554e0){logger[_0xbf3b('0x22')]('['+[_0x475c00['toUpperCase']()]+_0xbf3b('0x35'),_0xe554e0['enduserId']);_0x57872b(_0xe554e0);});}});});}function getCustomFields(_0x3fece7,_0x2aa22a,_0x545389){var _0xd1904b={};if(_0x3fece7[_0xbf3b('0x1e')]>0x0){_[_0xbf3b('0x36')](_0x3fece7,function(_0x5b78e9){if(_[_0xbf3b('0x37')](['string',_0xbf3b('0x38')],_0x5b78e9['type'])&&_0x5b78e9['nameField']&&!_0x5b78e9[_0xbf3b('0x39')]){var _0x49cc96=_0x5b78e9[_0xbf3b('0x3a')][_0xbf3b('0x26')]();var _0x2ca092=_0x49cc96[_0xbf3b('0x2d')](0x0,_0x49cc96[_0xbf3b('0x3b')]('_'));var _0x138c6f=_0x49cc96[_0xbf3b('0x2d')](_0x49cc96[_0xbf3b('0x3b')]('_')+0x1);if(_0x2ca092===_0x545389){_0xd1904b[_0x138c6f]=_0x5b78e9['content'];}}});}return _0xd1904b;}function getTicket(_0x2093d1,_0x31986b,_0x209cb3,_0x3f6380,_0x55c9b6,_0xc01333,_0x3258f7){return new BPromise(function(_0xd0a8e3,_0x1791a9){var _0x7b31d7;return getAuthToken(_0x31986b,_0x209cb3,_0x3258f7)['then'](function(_0x539942){if(_0xc01333['ticketType']===_0xbf3b('0x3c')){_0x7b31d7={'method':_0xbf3b('0xb'),'uri':_0x3f6380+_0xbf3b('0x3d'),'body':Object[_0xbf3b('0x3e')]({},{'title':intUtil[_0xbf3b('0x3f')](_0xc01333[_0xbf3b('0x40')],_0x55c9b6,'\x20'),'description':intUtil['getString'](_0xc01333[_0xbf3b('0x41')],_0x55c9b6,'\x0a'),'customerid_contact@odata.bind':'/contacts('+_0x2093d1[_0xbf3b('0x2f')]+')','ownerid@odata.bind':_0xbf3b('0x2b')+_0x2093d1['userId']+')','caseorigincode':'1'},getCustomFields(_0xc01333['Fields'],_0x55c9b6,_0xc01333[_0xbf3b('0x42')])),'headers':{'Authorization':_0xbf3b('0x18')+_0x539942,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0xc01333['ticketType']===_0xbf3b('0x43')){_0x7b31d7={'method':_0xbf3b('0xb'),'uri':_0x3f6380+_0xbf3b('0x44'),'body':Object[_0xbf3b('0x3e')]({},{'subject':intUtil[_0xbf3b('0x3f')](_0xc01333[_0xbf3b('0x40')],_0x55c9b6,'\x20'),'phonenumber':String(_0x55c9b6[_0xbf3b('0x29')]),'description':intUtil[_0xbf3b('0x3f')](_0xc01333[_0xbf3b('0x41')],_0x55c9b6,'\x0a'),'regardingobjectid_contact@odata.bind':_0xbf3b('0x45')+_0x2093d1[_0xbf3b('0x2f')]+')','ownerid@odata.bind':_0xbf3b('0x2b')+_0x2093d1[_0xbf3b('0x25')]+')','directioncode':_0x2093d1['callDirection']===_0xbf3b('0x46')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0xbf3b('0x2b')+_0x2093d1[_0xbf3b('0x25')]+')','participationtypemask':_0x2093d1[_0xbf3b('0x47')]===_0xbf3b('0x46')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x2093d1[_0xbf3b('0x2f')]+')','participationtypemask':_0x2093d1['callDirection']===_0xbf3b('0x46')?0x1:0x2}]},getCustomFields(_0xc01333[_0xbf3b('0x48')],_0x55c9b6,_0xc01333[_0xbf3b('0x42')])),'headers':{'Authorization':_0xbf3b('0x18')+_0x539942,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x7b31d7);})[_0xbf3b('0x10')](function(_0x28b141){var _0x2e2686=_0x28b141['headers'][_0xbf3b('0x2c')];var _0x2cb38a=_0x2e2686[_0xbf3b('0x2d')](_0x2e2686['lastIndexOf']('(')+0x1,_0x2e2686[_0xbf3b('0x2e')](')'));_0x2093d1[_0xbf3b('0x49')]=_0x2cb38a;_0xd0a8e3(_0x2093d1);})[_0xbf3b('0x12')](function(_0x20e4d9){_0x1791a9(_0x20e4d9['message']);});});}function emit(_0x42999d,_0x4d7933,_0x4b0825,_0x3a1148){var _0xc0ac9a={'uri':util[_0xbf3b('0x4a')](_0xbf3b('0x4b'),_0x42999d,_0x4b0825,_0x3a1148)};io['to'](util['format'](_0xbf3b('0x4c'),_0x4d7933))[_0xbf3b('0x4d')](_0xbf3b('0x4e'),_0xc0ac9a);}exports['cs']=function(_0x5cf901,_0x4606ef,_0x2166c1,_0x26adc7,_0x5ba463,_0x247e96,_0x17dca8,_0x1cd6ee){var _0x163fc3={};_0x247e96[_0xbf3b('0x4f')]=intUtil[_0xbf3b('0x50')](_0x247e96[_0xbf3b('0x4f')]);_0x247e96[_0xbf3b('0x51')]=intUtil[_0xbf3b('0x50')](_0x247e96['serverUrl']);_0x163fc3[_0xbf3b('0x47')]=_0x1cd6ee===_0xbf3b('0x46')||_0x1cd6ee==='unmanaged'?_0xbf3b('0x46'):_0xbf3b('0x27');var _0x58e94a=util[_0xbf3b('0x4a')]('%s/api/data/v9.0/',_0x247e96[_0xbf3b('0x4f')]);var _0xcd60d6=util[_0xbf3b('0x4a')](_0xbf3b('0x52'),_0x247e96[_0xbf3b('0x53')]);var _0x23fe43=util[_0xbf3b('0x4a')](_0xbf3b('0x54'),_0x247e96[_0xbf3b('0x51')],_0x4606ef[_0xbf3b('0x55')],md5(_0x4606ef[_0xbf3b('0x55')]));if(_0x5ba463&&_0x5ba463[_0xbf3b('0x56')]){logger[_0xbf3b('0x22')]('[QUEUE]',_0xbf3b('0x57'));_0x4606ef[_0xbf3b('0x58')]=_0x23fe43;}else if(_0x17dca8&&_0x17dca8[_0xbf3b('0x59')]&&_0x17dca8[_0xbf3b('0x59')]!==_0xbf3b('0x5a')){logger[_0xbf3b('0x22')](_0xbf3b('0x5b'),_0xbf3b('0x57'));_0x4606ef[_0xbf3b('0x58')]=_0x23fe43;}else{_0x4606ef[_0xbf3b('0x58')]='';}return getUser(_0x163fc3,_0x247e96,_0x26adc7,_0xcd60d6,_0x58e94a,_0x1cd6ee)[_0xbf3b('0x10')](function(_0x20bd60){logger[_0xbf3b('0x22')]('['+_0x1cd6ee[_0xbf3b('0x14')]()+_0xbf3b('0x5c'),_0x20bd60[_0xbf3b('0x25')]);logger[_0xbf3b('0x22')]('['+_0x1cd6ee[_0xbf3b('0x14')]()+']\x20The\x20User\x20email\x20is:',_0x20bd60[_0xbf3b('0x1d')]);return getEndUser(_0x20bd60,_0x247e96,_0xcd60d6,_0x58e94a,_0x4606ef,_0x1cd6ee);})['then'](function(_0x2f9483){logger[_0xbf3b('0x22')]('['+_0x1cd6ee[_0xbf3b('0x14')]()+_0xbf3b('0x5d'),_0x2f9483[_0xbf3b('0x2f')]);logger[_0xbf3b('0x22')]('['+_0x1cd6ee[_0xbf3b('0x14')]()+_0xbf3b('0x5e'),_0x4606ef[_0xbf3b('0x29')]);return getTicket(_0x2f9483,_0x247e96,_0xcd60d6,_0x58e94a,_0x4606ef,_0x2166c1,_0x1cd6ee);})[_0xbf3b('0x10')](function(_0x4c4bb1){logger[_0xbf3b('0x22')](util['format']('['+_0x1cd6ee['toUpperCase']()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x2166c1[_0xbf3b('0x42')],_0x4c4bb1[_0xbf3b('0x49')]));logger[_0xbf3b('0x22')](util['format']('['+_0x1cd6ee[_0xbf3b('0x14')]()+_0xbf3b('0x5f'),_0x1cd6ee));if(_0x1cd6ee!=='unmanaged'){logger[_0xbf3b('0x22')]('['+_0x1cd6ee[_0xbf3b('0x14')]()+']',_0xbf3b('0x60'));emit(_0x247e96[_0xbf3b('0x4f')],_0x26adc7[_0xbf3b('0x61')],_0x2166c1[_0xbf3b('0x42')],_0x4c4bb1[_0xbf3b('0x49')]);}})[_0xbf3b('0x12')](function(_0x70cb5a){logger[_0xbf3b('0x13')]('['+_0x1cd6ee['toUpperCase']()+_0xbf3b('0x62'),util[_0xbf3b('0x63')](_0x70cb5a,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x0749=['odata-entityid','substring','calleridnum','replace','telephone1','contactid',']\x20Enduser\x20Created!','enduserId','forEach','includes','picklist','nameField','customField','idField','indexOf','content','ticketType','assign','getString','Subjects','Fields','phonecall','phonecalls','Descriptions','callDirection','queue','/contacts(','lastIndexOf','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','error',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','bluebird','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','socket.io-emitter','POST','remoteUri','username','password','then','catch','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail','length','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','toLowerCase','outbound','destcalleridnum','contacts','/systemusers(','headers'];(function(_0x4d210a,_0x26357c){var _0x39ae0f=function(_0x1941fd){while(--_0x1941fd){_0x4d210a['push'](_0x4d210a['shift']());}};_0x39ae0f(++_0x26357c);}(_0x0749,0x9a));var _0x9074=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x0749[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require('lodash');var BPromise=require(_0x9074('0x0'));var rp=require(_0x9074('0x1'));var util=require(_0x9074('0x2'));var intUtil=require(_0x9074('0x3'));var md5=require(_0x9074('0x4'));var Redis=require(_0x9074('0x5'));var logger=require(_0x9074('0x6'))(_0x9074('0x7'));var config=require(_0x9074('0x8'));config[_0x9074('0x9')]=_['defaults'](config[_0x9074('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x9074('0xa'))(new Redis(config[_0x9074('0x9')]));function getAuthToken(_0x175e06,_0x307b2c,_0x2c06a8){var _0xe4d5be={'method':_0x9074('0xb'),'uri':_0x307b2c,'form':{'client_id':_0x175e06['clientId'],'resource':_0x175e06[_0x9074('0xc')],'username':_0x175e06[_0x9074('0xd')],'password':_0x175e06[_0x9074('0xe')],'grant_type':_0x9074('0xe'),'client_secret':_0x175e06['clientSecret']},'json':!![]};return rp(_0xe4d5be)[_0x9074('0xf')](function(_0x483383){return _0x483383['access_token'];})[_0x9074('0x10')](function(_0x567585){logger['error']('['+[_0x2c06a8[_0x9074('0x11')]()]+_0x9074('0x12'));return _0x567585[_0x9074('0x13')];});}function getUser(_0x20c1e8,_0x4aaa06,_0x11111c,_0x28382b,_0x792577,_0x6b1c20){return new BPromise(function(_0x100882,_0x52f2c9){return getAuthToken(_0x4aaa06,_0x28382b,_0x6b1c20)[_0x9074('0xf')](function(_0x51d3e6){var _0x332828={'method':_0x9074('0x14'),'uri':_0x792577+_0x9074('0x15'),'headers':{'Authorization':_0x9074('0x16')+_0x51d3e6,'OData-Version':_0x9074('0x17')},'json':!![]};return rp(_0x332828);})[_0x9074('0xf')](function(_0x583d55){var _0x210c36=_0x583d55[_0x9074('0x18')];var _0x166d46=![];var _0x24245b=null;if(!_[_0x9074('0x19')](_0x11111c)){if(intUtil[_0x9074('0x1a')](_0x11111c[_0x9074('0x1b')])){_0x20c1e8[_0x9074('0x1c')]=_0x11111c[_0x9074('0x1b')];for(_0x24245b=0x0;_0x24245b<_0x210c36[_0x9074('0x1d')];_0x24245b++){if(_0x210c36[_0x24245b]['internalemailaddress']===_0x11111c[_0x9074('0x1b')]&&!_0x210c36[_0x24245b][_0x9074('0x1e')]){_0x166d46=!![];logger[_0x9074('0x1f')]('['+[_0x6b1c20['toUpperCase']()]+_0x9074('0x20')+_0x210c36[_0x24245b][_0x9074('0x21')]+'!');_0x20c1e8[_0x9074('0x22')]=_0x210c36[_0x24245b][_0x9074('0x21')];}}}}if(!_0x166d46){logger[_0x9074('0x1f')]('['+[_0x6b1c20[_0x9074('0x11')]()]+_0x9074('0x23'));_0x20c1e8[_0x9074('0x1c')]=_0x4aaa06[_0x9074('0xd')];for(_0x24245b=0x0;_0x24245b<_0x210c36[_0x9074('0x1d')];_0x24245b++){if(_0x210c36[_0x24245b]['internalemailaddress']===_0x4aaa06[_0x9074('0xd')]){_0x20c1e8['userId']=_0x210c36[_0x24245b][_0x9074('0x21')];}}}_0x100882(_0x20c1e8);})[_0x9074('0x10')](function(_0x3060ee){_0x52f2c9(_0x3060ee['message']);});});}function createEndUser(_0x582dc3,_0x2e6146,_0x54545d,_0x1d6765,_0x1fa669,_0x10a902){return new BPromise(function(_0x5340a3,_0x3518c5){return getAuthToken(_0x2e6146,_0x54545d,_0x10a902)[_0x9074('0xf')](function(_0x17b6ad){var _0xb86afe=_0x10a902[_0x9074('0x24')]()===_0x9074('0x25')?_0x1fa669[_0x9074('0x26')]:_0x1fa669['calleridnum'];var _0x390ca4={'method':'POST','uri':_0x1d6765+_0x9074('0x27'),'body':{'telephone1':_0xb86afe,'fullname':_0xb86afe,'firstname':_0xb86afe,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x9074('0x28')+_0x582dc3['userId']+')'},'headers':{'Authorization':_0x9074('0x16')+_0x17b6ad,'OData-Version':_0x9074('0x17')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x390ca4);})[_0x9074('0xf')](function(_0x3eb800){var _0x5eb6dc=_0x3eb800[_0x9074('0x29')][_0x9074('0x2a')];var _0x337655=_0x5eb6dc[_0x9074('0x2b')](_0x5eb6dc['lastIndexOf']('(')+0x1,_0x5eb6dc['lastIndexOf'](')'));_0x582dc3['enduserId']=_0x337655;_0x5340a3(_0x582dc3);})[_0x9074('0x10')](function(_0x24e668){_0x3518c5(_0x24e668['message']);});});}function getEndUser(_0x4cc1ff,_0xf45db3,_0xfc8f90,_0x420fe1,_0x2920a4,_0x270b64){return new BPromise(function(_0x19442c,_0x381158){var _0x108009=_0x270b64[_0x9074('0x24')]()==='outbound'?_0x2920a4[_0x9074('0x26')]:_0x2920a4[_0x9074('0x2c')];return getAuthToken(_0xf45db3,_0xfc8f90,_0x270b64)[_0x9074('0xf')](function(_0x1a66dc){var _0x421e7f={'method':_0x9074('0x14'),'uri':_0x420fe1+'contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27'+_0x108009[_0x9074('0x2d')]('+','%2b')+'\x27','headers':{'Authorization':_0x9074('0x16')+_0x1a66dc,'If-None-Match':null,'OData-Version':_0x9074('0x17')},'json':!![]};return rp(_0x421e7f);})['then'](function(_0x3e526d){var _0x22e359=null;if(_0x3e526d){var _0x2295a0=_0x3e526d['value'];var _0x134a1b=![];for(_0x22e359=0x0;_0x22e359<_0x2295a0[_0x9074('0x1d')];_0x22e359++){if(_0x2295a0[_0x22e359][_0x9074('0x2e')]===_0x108009){_0x134a1b=!![];_0x4cc1ff['enduserId']=_0x2295a0[_0x22e359][_0x9074('0x2f')];}}if(_0x134a1b){_0x19442c(_0x4cc1ff);}else{return createEndUser(_0x4cc1ff,_0xf45db3,_0xfc8f90,_0x420fe1,_0x2920a4,_0x270b64)['then'](function(_0x2ba459){logger[_0x9074('0x1f')]('['+[_0x270b64[_0x9074('0x11')]()]+']\x20Enduser\x20created!',_0x2ba459['enduserId']);_0x19442c(_0x2ba459);});}}else{return createEndUser(_0x4cc1ff,_0xf45db3,_0xfc8f90,_0x420fe1,_0x2920a4,_0x270b64)[_0x9074('0xf')](function(_0x44c813){logger[_0x9074('0x1f')]('['+[_0x270b64[_0x9074('0x11')]()]+_0x9074('0x30'),_0x44c813[_0x9074('0x31')]);_0x19442c(_0x44c813);});}});});}function getCustomFields(_0x16584e,_0x4076b5,_0x31d89c){var _0x454b51={};if(_0x16584e[_0x9074('0x1d')]>0x0){_[_0x9074('0x32')](_0x16584e,function(_0x2e6621){if(_[_0x9074('0x33')](['string',_0x9074('0x34')],_0x2e6621['type'])&&_0x2e6621[_0x9074('0x35')]&&!_0x2e6621[_0x9074('0x36')]){var _0x30833d=_0x2e6621[_0x9074('0x37')][_0x9074('0x24')]();var _0xa95b14=_0x30833d[_0x9074('0x2b')](0x0,_0x30833d[_0x9074('0x38')]('_'));var _0x2e8a55=_0x30833d[_0x9074('0x2b')](_0x30833d[_0x9074('0x38')]('_')+0x1);if(_0xa95b14===_0x31d89c){_0x454b51[_0x2e8a55]=_0x2e6621[_0x9074('0x39')];}}});}return _0x454b51;}function getTicket(_0x56c0e6,_0x2a21d8,_0x353f7b,_0x941320,_0x501ad7,_0x54cfe4,_0x59d161){return new BPromise(function(_0x3c0d9d,_0xa083){var _0xd88154;return getAuthToken(_0x2a21d8,_0x353f7b,_0x59d161)[_0x9074('0xf')](function(_0x1f8ca5){if(_0x54cfe4[_0x9074('0x3a')]==='incident'){_0xd88154={'method':_0x9074('0xb'),'uri':_0x941320+'incidents','body':Object[_0x9074('0x3b')]({},{'title':intUtil[_0x9074('0x3c')](_0x54cfe4[_0x9074('0x3d')],_0x501ad7,'\x20'),'description':intUtil[_0x9074('0x3c')](_0x54cfe4['Descriptions'],_0x501ad7,'\x0a'),'customerid_contact@odata.bind':'/contacts('+_0x56c0e6[_0x9074('0x31')]+')','ownerid@odata.bind':_0x9074('0x28')+_0x56c0e6[_0x9074('0x22')]+')','caseorigincode':'1'},getCustomFields(_0x54cfe4[_0x9074('0x3e')],_0x501ad7,_0x54cfe4['ticketType'])),'headers':{'Authorization':_0x9074('0x16')+_0x1f8ca5,'OData-Version':_0x9074('0x17')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x54cfe4[_0x9074('0x3a')]===_0x9074('0x3f')){_0xd88154={'method':_0x9074('0xb'),'uri':_0x941320+_0x9074('0x40'),'body':Object[_0x9074('0x3b')]({},{'subject':intUtil[_0x9074('0x3c')](_0x54cfe4[_0x9074('0x3d')],_0x501ad7,'\x20'),'phonenumber':String(_0x501ad7[_0x9074('0x2c')]),'description':intUtil[_0x9074('0x3c')](_0x54cfe4[_0x9074('0x41')],_0x501ad7,'\x0a'),'regardingobjectid_contact@odata.bind':'/contacts('+_0x56c0e6[_0x9074('0x31')]+')','ownerid@odata.bind':_0x9074('0x28')+_0x56c0e6[_0x9074('0x22')]+')','directioncode':_0x56c0e6[_0x9074('0x42')]===_0x9074('0x43')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x9074('0x28')+_0x56c0e6[_0x9074('0x22')]+')','participationtypemask':_0x56c0e6[_0x9074('0x42')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x9074('0x44')+_0x56c0e6['enduserId']+')','participationtypemask':_0x56c0e6['callDirection']===_0x9074('0x43')?0x1:0x2}]},getCustomFields(_0x54cfe4[_0x9074('0x3e')],_0x501ad7,_0x54cfe4[_0x9074('0x3a')])),'headers':{'Authorization':_0x9074('0x16')+_0x1f8ca5,'OData-Version':_0x9074('0x17')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0xd88154);})[_0x9074('0xf')](function(_0x1048df){var _0x4be2da=_0x1048df[_0x9074('0x29')][_0x9074('0x2a')];var _0x5750f8=_0x4be2da[_0x9074('0x2b')](_0x4be2da[_0x9074('0x45')]('(')+0x1,_0x4be2da[_0x9074('0x45')](')'));_0x56c0e6[_0x9074('0x46')]=_0x5750f8;_0x3c0d9d(_0x56c0e6);})[_0x9074('0x10')](function(_0x49c7a3){_0xa083(_0x49c7a3[_0x9074('0x13')]);});});}function emit(_0xe91c62,_0x553910,_0x45cf7f,_0x2a7f50){var _0x10254b={'uri':util[_0x9074('0x47')](_0x9074('0x48'),_0xe91c62,_0x45cf7f,_0x2a7f50)};io['to'](util[_0x9074('0x47')]('user:%s',_0x553910))[_0x9074('0x49')](_0x9074('0x4a'),_0x10254b);}exports['cs']=function(_0x1d9764,_0x5a20d0,_0x4a8cf2,_0x4b2bea,_0x5b7b1f,_0x24c12b,_0x1ab7af,_0x31b4ab){var _0x29bfcf={};_0x24c12b[_0x9074('0xc')]=intUtil['stripTrailingSlash'](_0x24c12b['remoteUri']);_0x24c12b['serverUrl']=intUtil[_0x9074('0x4b')](_0x24c12b[_0x9074('0x4c')]);_0x29bfcf[_0x9074('0x42')]=_0x31b4ab===_0x9074('0x43')||_0x31b4ab===_0x9074('0x4d')?_0x9074('0x43'):'outbound';var _0x42e634=util['format']('%s/api/data/v9.0/',_0x24c12b[_0x9074('0xc')]);var _0x5c802b=util['format'](_0x9074('0x4e'),_0x24c12b[_0x9074('0x4f')]);var _0x4035a0=util['format'](_0x9074('0x50'),_0x24c12b[_0x9074('0x4c')],_0x5a20d0[_0x9074('0x51')],md5(_0x5a20d0[_0x9074('0x51')]));if(_0x5b7b1f&&_0x5b7b1f[_0x9074('0x52')]){logger['info'](_0x9074('0x53'),_0x9074('0x54'));_0x5a20d0['recordingURL']=_0x4035a0;}else if(_0x1ab7af&&_0x1ab7af[_0x9074('0x55')]&&_0x1ab7af[_0x9074('0x55')]!==_0x9074('0x56')){logger[_0x9074('0x1f')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x5a20d0['recordingURL']=_0x4035a0;}else{_0x5a20d0[_0x9074('0x57')]='';}return getUser(_0x29bfcf,_0x24c12b,_0x4b2bea,_0x5c802b,_0x42e634,_0x31b4ab)['then'](function(_0x4c6cd2){logger[_0x9074('0x1f')]('['+_0x31b4ab['toUpperCase']()+_0x9074('0x58'),_0x4c6cd2[_0x9074('0x22')]);logger[_0x9074('0x1f')]('['+_0x31b4ab[_0x9074('0x11')]()+_0x9074('0x59'),_0x4c6cd2[_0x9074('0x1c')]);return getEndUser(_0x4c6cd2,_0x24c12b,_0x5c802b,_0x42e634,_0x5a20d0,_0x31b4ab);})[_0x9074('0xf')](function(_0x1837b3){logger['info']('['+_0x31b4ab[_0x9074('0x11')]()+_0x9074('0x5a'),_0x1837b3[_0x9074('0x31')]);logger[_0x9074('0x1f')]('['+_0x31b4ab[_0x9074('0x11')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x5a20d0[_0x9074('0x2c')]);return getTicket(_0x1837b3,_0x24c12b,_0x5c802b,_0x42e634,_0x5a20d0,_0x4a8cf2,_0x31b4ab);})[_0x9074('0xf')](function(_0x353d48){logger['info'](util['format']('['+_0x31b4ab[_0x9074('0x11')]()+_0x9074('0x5b'),_0x4a8cf2[_0x9074('0x3a')],_0x353d48[_0x9074('0x46')]));logger[_0x9074('0x1f')](util['format']('['+_0x31b4ab[_0x9074('0x11')]()+_0x9074('0x5c'),_0x31b4ab));if(_0x31b4ab!==_0x9074('0x4d')){logger[_0x9074('0x1f')]('['+_0x31b4ab[_0x9074('0x11')]()+']',_0x9074('0x5d'));emit(_0x24c12b['remoteUri'],_0x4b2bea[_0x9074('0x5e')],_0x4a8cf2[_0x9074('0x3a')],_0x353d48[_0x9074('0x46')]);}})[_0x9074('0x10')](function(_0x2de864){logger[_0x9074('0x5f')]('['+_0x31b4ab[_0x9074('0x11')]()+_0x9074('0x60'),util[_0x9074('0x61')](_0x2de864,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/freshdesk.js b/server/services/ami/trigger/integration/freshdesk.js index 2037682..92fc0b1 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 _0xd225=['../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','merge','format','calleridname','calleridnum','getString','Descriptions','
','Tags','name','Fields','custom_fields','keyBy','value','%s/api/v2/tickets','info','Ticket\x20created!','validateEmail','%s/api/v2/agents','remoteUri','then','length','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','%s/api/v2/contacts','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Enduser\x20created.','Basic\x20%s','base64','debug','stringify','GET','map','includes','string','picklist','type','nameField','toLowerCase','content','idField','customField','push','variableName','toString','customVariable','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','unmanaged','monitor_format','lastevent','toUpperCase','lodash','request-promise','util','./util'];(function(_0xb16585,_0x3337a6){var _0x189ca1=function(_0x188431){while(--_0x188431){_0xb16585['push'](_0xb16585['shift']());}};_0x189ca1(++_0x3337a6);}(_0xd225,0x168));var _0x5d22=function(_0x23a517,_0x31d29f){_0x23a517=_0x23a517-0x0;var _0x41ca03=_0xd225[_0x23a517];return _0x41ca03;};'use strict';var _=require(_0x5d22('0x0'));var rp=require(_0x5d22('0x1'));var md5=require('md5');var util=require(_0x5d22('0x2'));var Redis=require('ioredis');var intUtil=require(_0x5d22('0x3'));var config=require(_0x5d22('0x4'));var logger=require(_0x5d22('0x5'))(_0x5d22('0x6'));config[_0x5d22('0x7')]=_[_0x5d22('0x8')](config[_0x5d22('0x7')],{'host':_0x5d22('0x9'),'port':0x18eb});var io=require(_0x5d22('0xa'))(new Redis(config[_0x5d22('0x7')]));var headers={'Content-Type':_0x5d22('0xb'),'Accept':_0x5d22('0xb')};function emit(_0x4f0c55,_0x1e1926,_0x4449a7){io['to'](_0x4f0c55)['emit'](_0x1e1926,_0x4449a7);}function getTicket(_0x3a8738,_0x3996b2,_0x3f6ee8,_0x2d5c2c,_0x196b79){logger['info']('Creating\x20new\x20ticket...');var _0x4a8315=_[_0x5d22('0xc')]({'responder_id':_0x3996b2['id'],'requester_id':_0x3f6ee8['id'],'name':util[_0x5d22('0xd')]('Caller\x20-\x20%s',_0x196b79[_0x5d22('0xe')]),'phone':_0x196b79[_0x5d22('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x2d5c2c['Subjects'],_0x196b79,'\x20'),'description':intUtil[_0x5d22('0x10')](_0x2d5c2c[_0x5d22('0x11')],_0x196b79,_0x5d22('0x12')),'tags':getTags(_0x2d5c2c[_0x5d22('0x13')],_0x5d22('0x14'))},getCustomFields(_0x2d5c2c[_0x5d22('0x15')],_0x196b79));_0x4a8315[_0x5d22('0x16')]=_['mapValues'](_[_0x5d22('0x17')](_0x4a8315['custom_fields'],'id'),_0x5d22('0x18'));return request({'uri':util['format'](_0x5d22('0x19'),_0x3a8738['remoteUri']),'method':'POST','body':_0x4a8315})['then'](function(_0x821f8e){logger[_0x5d22('0x1a')](_0x5d22('0x1b'));return _0x821f8e;});}function getUser(_0x1574ec,_0x2772cd){if(intUtil[_0x5d22('0x1c')](_0x2772cd)){return request({'uri':util[_0x5d22('0xd')](_0x5d22('0x1d'),_0x1574ec[_0x5d22('0x1e')]),'qs':{'email':_0x2772cd}})[_0x5d22('0x1f')](function(_0x53de98){if(_0x53de98[_0x5d22('0x20')]){logger[_0x5d22('0x1a')]('Agent\x20found!');return _[_0x5d22('0x21')](_0x53de98,function(_0x21501){return _0x21501[_0x5d22('0x22')][_0x5d22('0x23')]===_0x2772cd;});}else{logger['info'](_0x5d22('0x24'));return request({'uri':util['format'](_0x5d22('0x25'),_0x1574ec[_0x5d22('0x1e')])})[_0x5d22('0x1f')](function(_0x181116){logger['info']('Admin\x20account\x20selected.');return _0x181116;});}});}else{logger[_0x5d22('0x1a')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format']('%s/api/v2/agents/me',_0x1574ec[_0x5d22('0x1e')])})[_0x5d22('0x1f')](function(_0x52c3c2){logger[_0x5d22('0x1a')](_0x5d22('0x26'));return _0x52c3c2;});}}function getEndUser(_0x453373,_0x143375,_0x676dfe){logger['info']('Searching\x20enduser\x20with\x20phone',_0x676dfe);return request({'uri':util[_0x5d22('0xd')](_0x5d22('0x27'),_0x453373[_0x5d22('0x1e')]),'qs':{'phone':_0x676dfe}})[_0x5d22('0x1f')](function(_0x8ce11f){if(_0x8ce11f[_0x5d22('0x20')]){logger[_0x5d22('0x1a')]('Enduser\x20found!');return _['find'](_0x8ce11f,{'phone':_0x676dfe});}else{logger['info'](_0x5d22('0x28'));return request({'uri':util[_0x5d22('0xd')](_0x5d22('0x27'),_0x453373[_0x5d22('0x1e')]),'method':_0x5d22('0x29'),'body':{'name':_0x143375,'phone':_0x676dfe}})[_0x5d22('0x1f')](function(_0x1cbc36){logger[_0x5d22('0x1a')](_0x5d22('0x2a'));return _0x1cbc36;});}});}function getAuth(_0x5a8e16){return util['format'](_0x5d22('0x2b'),new Buffer(_0x5a8e16['apiKey']+':X')['toString'](_0x5d22('0x2c')));}function request(_0xcee34c){logger[_0x5d22('0x2d')]('[HTTP]',JSON[_0x5d22('0x2e')](_0xcee34c));return rp(_[_0x5d22('0x8')](_0xcee34c,{'method':_0x5d22('0x2f'),'headers':headers,'json':!![]}));}function getTags(_0x55da93,_0x147877){var _0x21e9a3=[];if(_0x55da93&&_0x55da93[_0x5d22('0x20')]>0x0){_0x21e9a3=_[_0x5d22('0x30')](_0x55da93,_0x147877);}return _0x21e9a3;}function getCustomFields(_0x5b7ac2,_0xc44c2c){var _0x9b18ca=[];var _0x1ad03a={'custom_fields':[]};if(_0x5b7ac2[_0x5d22('0x20')]>0x0){_['forEach'](_0x5b7ac2,function(_0x3478c5){if(_[_0x5d22('0x31')]([_0x5d22('0x32'),_0x5d22('0x33')],_0x3478c5[_0x5d22('0x34')])&&_0x3478c5[_0x5d22('0x35')]&&!_0x3478c5['customField']){_0x1ad03a[_0x3478c5[_0x5d22('0x35')][_0x5d22('0x36')]()]=_0x3478c5[_0x5d22('0x37')]['toString']();}else if(_[_0x5d22('0x31')]([_0x5d22('0x32'),_0x5d22('0x33')],_0x3478c5[_0x5d22('0x34')])&&_0x3478c5[_0x5d22('0x38')]&&_0x3478c5[_0x5d22('0x39')]){_0x1ad03a[_0x5d22('0x16')][_0x5d22('0x3a')]({'id':_0x3478c5[_0x5d22('0x38')],'value':_0x3478c5[_0x5d22('0x37')]['toString']()});}else if(_0x3478c5['type']==='variable'&&_0x3478c5[_0x5d22('0x3b')]&&_0x3478c5[_0x5d22('0x38')]&&_0x3478c5[_0x5d22('0x39')]){_0xc44c2c[_0x3478c5[_0x5d22('0x3b')]]&&_0x1ad03a['custom_fields'][_0x5d22('0x3a')]({'id':_0x3478c5['idField'],'value':_0xc44c2c[_0x3478c5[_0x5d22('0x3b')]][_0x5d22('0x3c')]()});}else if(_0x3478c5[_0x5d22('0x34')]===_0x5d22('0x3d')&&_0x3478c5[_0x5d22('0x3e')]&&_0x3478c5[_0x5d22('0x3e')][_0x5d22('0x14')]&&_0x3478c5['idField']&&_0x3478c5['customField']){_0xc44c2c[_0x3478c5[_0x5d22('0x3e')][_0x5d22('0x14')][_0x5d22('0x36')]()]&&_0x1ad03a['custom_fields'][_0x5d22('0x3a')]({'id':_0x3478c5[_0x5d22('0x38')],'value':_0xc44c2c[_0x3478c5['Variable'][_0x5d22('0x14')][_0x5d22('0x36')]()][_0x5d22('0x3c')]()});}});}return _0x1ad03a;}exports[_0x5d22('0x3f')]=function(_0x4562a8,_0x9388da,_0x267834,_0x4669a6,_0x5d9efc,_0x53a8aa){var _0x271e8b,_0x55abbe;_0x53a8aa['remoteUri']=intUtil[_0x5d22('0x40')](_0x53a8aa[_0x5d22('0x1e')]);_0x53a8aa[_0x5d22('0x41')]=intUtil[_0x5d22('0x40')](_0x53a8aa[_0x5d22('0x41')]);if(_0x5d9efc&&_0x5d9efc['monitor_format']){logger['info'](_0x5d22('0x42'),'Recording\x20is\x20enabled!');_0x9388da[_0x5d22('0x43')]=util[_0x5d22('0xd')](_0x5d22('0x44'),_0x53a8aa[_0x5d22('0x41')],_0x9388da[_0x5d22('0x45')],md5(_0x9388da[_0x5d22('0x45')]));}else{_0x9388da['recordingURL']='';}headers[_0x5d22('0x46')]=getAuth(_0x53a8aa);return getUser(_0x53a8aa,_0x4669a6[_0x5d22('0x23')])['then'](function(_0x1bf59d){_0x271e8b=_0x1bf59d;logger[_0x5d22('0x1a')](_0x5d22('0x47'),_0x271e8b['id']);return getEndUser(_0x53a8aa,_0x9388da[_0x5d22('0xe')],_0x9388da[_0x5d22('0xf')]);})['then'](function(_0x47c83a){_0x55abbe=_0x47c83a;logger[_0x5d22('0x1a')](_0x5d22('0x48'),_0x55abbe['id']);return getTicket(_0x53a8aa,_0x271e8b,_0x55abbe,_0x267834,_0x9388da);})[_0x5d22('0x1f')](function(_0x4589a1){if(_0x4589a1&&_0x4589a1['id']){logger[_0x5d22('0x1a')](_0x5d22('0x1b'));logger[_0x5d22('0x1a')](_0x5d22('0x49'),_0x4589a1['id']);logger[_0x5d22('0x1a')](_0x5d22('0x42'),_0x5d22('0x4a'));emit(util['format'](_0x5d22('0x4b'),_0x4669a6[_0x5d22('0x14')]),_0x5d22('0x4c'),{'uri':util[_0x5d22('0xd')](_0x5d22('0x4d'),_0x53a8aa[_0x5d22('0x1e')],_0x4589a1['id'])});}})[_0x5d22('0x4e')](function(_0x82295a){logger[_0x5d22('0x4f')](_0x5d22('0x42'),JSON[_0x5d22('0x2e')](_0x82295a));});};exports[_0x5d22('0x50')]=function(_0x1b07f8,_0x304422,_0x4e1991,_0x3e8c30,_0x63c613,_0x2a551a,_0x2a73a3){var _0x4a3b2b,_0x3d6e1b;_0x2a551a['remoteUri']=intUtil['stripTrailingSlash'](_0x2a551a[_0x5d22('0x1e')]);_0x2a551a[_0x5d22('0x41')]=intUtil[_0x5d22('0x40')](_0x2a551a[_0x5d22('0x41')]);if(_0x2a73a3&&_0x2a73a3[_0x5d22('0x51')]&&_0x2a73a3[_0x5d22('0x51')]!==_0x5d22('0x52')){logger[_0x5d22('0x1a')](_0x5d22('0x53'),_0x5d22('0x54'));_0x304422[_0x5d22('0x43')]=util[_0x5d22('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2a551a['serverUrl'],_0x304422[_0x5d22('0x45')],md5(_0x304422[_0x5d22('0x45')]));}headers[_0x5d22('0x46')]=getAuth(_0x2a551a);return getUser(_0x2a551a,_0x3e8c30[_0x5d22('0x23')])[_0x5d22('0x1f')](function(_0x4b6efd){_0x4a3b2b=_0x4b6efd;logger['info'](_0x5d22('0x47'),_0x4a3b2b['id']);return getEndUser(_0x2a551a,_0x304422[_0x5d22('0x55')],_0x304422[_0x5d22('0x56')]);})[_0x5d22('0x1f')](function(_0x360896){_0x3d6e1b=_0x360896;logger[_0x5d22('0x1a')](_0x5d22('0x48'),_0x3d6e1b['id']);return getTicket(_0x2a551a,_0x4a3b2b,_0x3d6e1b,_0x4e1991,_0x304422);})[_0x5d22('0x1f')](function(_0x31d203){if(_0x31d203&&_0x31d203['id']){logger[_0x5d22('0x1a')]('Ticket\x20created!');logger['info'](_0x5d22('0x49'),_0x31d203['id']);logger[_0x5d22('0x1a')](_0x5d22('0x53'),_0x5d22('0x4a'));emit(util['format'](_0x5d22('0x4b'),_0x3e8c30[_0x5d22('0x14')]),_0x5d22('0x4c'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x2a551a[_0x5d22('0x1e')],_0x31d203['id'])});}})[_0x5d22('0x4e')](function(_0x7e7995){logger[_0x5d22('0x4f')](_0x5d22('0x53'),JSON[_0x5d22('0x2e')](_0x7e7995));});};exports[_0x5d22('0x57')]=function(_0x2693b9,_0x4b5100,_0x413eff,_0x3cb0f3,_0x2b5341,_0x58fc00){var _0x4f083a,_0x4bdc7c;_0x58fc00[_0x5d22('0x1e')]=intUtil[_0x5d22('0x40')](_0x58fc00[_0x5d22('0x1e')]);_0x58fc00[_0x5d22('0x41')]=intUtil[_0x5d22('0x40')](_0x58fc00[_0x5d22('0x41')]);if(_0x2b5341&&_0x2b5341[_0x5d22('0x58')]){logger[_0x5d22('0x1a')]('['+_0x4b5100[_0x5d22('0x59')][_0x5d22('0x5a')]()+']',_0x5d22('0x54'));_0x4b5100['recordingURL']=util[_0x5d22('0xd')](_0x5d22('0x44'),_0x58fc00[_0x5d22('0x41')],_0x4b5100[_0x5d22('0x45')],md5(_0x4b5100['uniqueid']));}else{_0x4b5100[_0x5d22('0x43')]='';}headers['Authorization']=getAuth(_0x58fc00);return getUser(_0x58fc00,'')['then'](function(_0x15650f){_0x4f083a=_0x15650f;logger['info'](_0x5d22('0x47'),_0x4f083a['id']);return getEndUser(_0x58fc00,_0x4b5100[_0x5d22('0xe')],_0x4b5100[_0x5d22('0xf')]);})[_0x5d22('0x1f')](function(_0x2d96c0){_0x4bdc7c=_0x2d96c0;logger[_0x5d22('0x1a')](_0x5d22('0x48'),_0x4bdc7c['id']);return getTicket(_0x58fc00,_0x4f083a,_0x4bdc7c,_0x413eff,_0x4b5100);})[_0x5d22('0x1f')](function(_0x16fac1){if(_0x16fac1){logger[_0x5d22('0x1a')](_0x5d22('0x1b'));logger[_0x5d22('0x1a')](_0x5d22('0x49'),_0x16fac1['id']);}})['catch'](function(_0x53a0e8){logger[_0x5d22('0x4f')]('['+_0x4b5100['lastevent'][_0x5d22('0x5a')]()+']',JSON[_0x5d22('0x2e')](_0x53a0e8));});}; \ No newline at end of file +var _0x55e6=['nameField','toLowerCase','content','type','idField','customField','push','toString','variable','variableName','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','recordingFormat','none','Authorization','destcalleridname','destcalleridnum','unmanaged','lastevent','lodash','request-promise','md5','util','ioredis','./util','freshdesk','defaults','redis','application/json','emit','info','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','value','remoteUri','POST','then','validateEmail','%s/api/v2/agents','length','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','format','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Enduser\x20found!','%s/api/v2/contacts','Basic\x20%s','apiKey','debug','[HTTP]','stringify','GET','map','forEach','includes','string','picklist'];(function(_0x25025f,_0x502516){var _0x1661f2=function(_0x4c2951){while(--_0x4c2951){_0x25025f['push'](_0x25025f['shift']());}};_0x1661f2(++_0x502516);}(_0x55e6,0xd9));var _0x655e=function(_0x3c1360,_0x4724c3){_0x3c1360=_0x3c1360-0x0;var _0x4d1bc8=_0x55e6[_0x3c1360];return _0x4d1bc8;};'use strict';var _=require(_0x655e('0x0'));var rp=require(_0x655e('0x1'));var md5=require(_0x655e('0x2'));var util=require(_0x655e('0x3'));var Redis=require(_0x655e('0x4'));var intUtil=require(_0x655e('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x655e('0x6'));config['redis']=_[_0x655e('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x655e('0x8')]));var headers={'Content-Type':_0x655e('0x9'),'Accept':_0x655e('0x9')};function emit(_0x1c39ed,_0x4c0bd7,_0x2e413b){io['to'](_0x1c39ed)[_0x655e('0xa')](_0x4c0bd7,_0x2e413b);}function getTicket(_0x539237,_0x5d1696,_0x88b4fc,_0x2c32f4,_0x9f76d3){logger[_0x655e('0xb')](_0x655e('0xc'));var _0x12fdbd=_[_0x655e('0xd')]({'responder_id':_0x5d1696['id'],'requester_id':_0x88b4fc['id'],'name':util['format'](_0x655e('0xe'),_0x9f76d3[_0x655e('0xf')]),'phone':_0x9f76d3[_0x655e('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x655e('0x11')](_0x2c32f4[_0x655e('0x12')],_0x9f76d3,'\x20'),'description':intUtil[_0x655e('0x11')](_0x2c32f4[_0x655e('0x13')],_0x9f76d3,_0x655e('0x14')),'tags':getTags(_0x2c32f4[_0x655e('0x15')],_0x655e('0x16'))},getCustomFields(_0x2c32f4[_0x655e('0x17')],_0x9f76d3));_0x12fdbd[_0x655e('0x18')]=_[_0x655e('0x19')](_['keyBy'](_0x12fdbd['custom_fields'],'id'),_0x655e('0x1a'));return request({'uri':util['format']('%s/api/v2/tickets',_0x539237[_0x655e('0x1b')]),'method':_0x655e('0x1c'),'body':_0x12fdbd})[_0x655e('0x1d')](function(_0x421251){logger[_0x655e('0xb')]('Ticket\x20created!');return _0x421251;});}function getUser(_0xde5837,_0x2a12e5){if(intUtil[_0x655e('0x1e')](_0x2a12e5)){return request({'uri':util['format'](_0x655e('0x1f'),_0xde5837[_0x655e('0x1b')]),'qs':{'email':_0x2a12e5}})[_0x655e('0x1d')](function(_0x49951b){if(_0x49951b[_0x655e('0x20')]){logger['info']('Agent\x20found!');return _[_0x655e('0x21')](_0x49951b,function(_0x80a892){return _0x80a892[_0x655e('0x22')][_0x655e('0x23')]===_0x2a12e5;});}else{logger['info'](_0x655e('0x24'));return request({'uri':util[_0x655e('0x25')]('%s/api/v2/agents/me',_0xde5837[_0x655e('0x1b')])})['then'](function(_0x2835ae){logger[_0x655e('0xb')](_0x655e('0x26'));return _0x2835ae;});}});}else{logger[_0x655e('0xb')](_0x655e('0x27'));return request({'uri':util[_0x655e('0x25')]('%s/api/v2/agents/me',_0xde5837[_0x655e('0x1b')])})[_0x655e('0x1d')](function(_0x4c4ce4){logger[_0x655e('0xb')](_0x655e('0x26'));return _0x4c4ce4;});}}function getEndUser(_0x25cec3,_0x169bfe,_0x146627){logger['info']('Searching\x20enduser\x20with\x20phone',_0x146627);return request({'uri':util[_0x655e('0x25')]('%s/api/v2/contacts',_0x25cec3[_0x655e('0x1b')]),'qs':{'phone':_0x146627}})[_0x655e('0x1d')](function(_0x2b42e0){if(_0x2b42e0[_0x655e('0x20')]){logger[_0x655e('0xb')](_0x655e('0x28'));return _[_0x655e('0x21')](_0x2b42e0,{'phone':_0x146627});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x655e('0x25')](_0x655e('0x29'),_0x25cec3['remoteUri']),'method':_0x655e('0x1c'),'body':{'name':_0x169bfe,'phone':_0x146627}})[_0x655e('0x1d')](function(_0x2af735){logger[_0x655e('0xb')]('Enduser\x20created.');return _0x2af735;});}});}function getAuth(_0x72e0ef){return util[_0x655e('0x25')](_0x655e('0x2a'),new Buffer(_0x72e0ef[_0x655e('0x2b')]+':X')['toString']('base64'));}function request(_0x576f0e){logger[_0x655e('0x2c')](_0x655e('0x2d'),JSON[_0x655e('0x2e')](_0x576f0e));return rp(_[_0x655e('0x7')](_0x576f0e,{'method':_0x655e('0x2f'),'headers':headers,'json':!![]}));}function getTags(_0x2ccdf4,_0x22c1ff){var _0x597a14=[];if(_0x2ccdf4&&_0x2ccdf4['length']>0x0){_0x597a14=_[_0x655e('0x30')](_0x2ccdf4,_0x22c1ff);}return _0x597a14;}function getCustomFields(_0x2a6bc3,_0x4067ae){var _0x3f80ad=[];var _0x3ca80c={'custom_fields':[]};if(_0x2a6bc3[_0x655e('0x20')]>0x0){_[_0x655e('0x31')](_0x2a6bc3,function(_0x51c023){if(_[_0x655e('0x32')]([_0x655e('0x33'),_0x655e('0x34')],_0x51c023['type'])&&_0x51c023[_0x655e('0x35')]&&!_0x51c023['customField']){_0x3ca80c[_0x51c023['nameField'][_0x655e('0x36')]()]=_0x51c023[_0x655e('0x37')]['toString']();}else if(_[_0x655e('0x32')]([_0x655e('0x33'),_0x655e('0x34')],_0x51c023[_0x655e('0x38')])&&_0x51c023[_0x655e('0x39')]&&_0x51c023[_0x655e('0x3a')]){_0x3ca80c[_0x655e('0x18')][_0x655e('0x3b')]({'id':_0x51c023[_0x655e('0x39')],'value':_0x51c023[_0x655e('0x37')][_0x655e('0x3c')]()});}else if(_0x51c023['type']===_0x655e('0x3d')&&_0x51c023[_0x655e('0x3e')]&&_0x51c023[_0x655e('0x39')]&&_0x51c023[_0x655e('0x3a')]){_0x4067ae[_0x51c023[_0x655e('0x3e')]]&&_0x3ca80c['custom_fields']['push']({'id':_0x51c023['idField'],'value':_0x4067ae[_0x51c023[_0x655e('0x3e')]]['toString']()});}else if(_0x51c023[_0x655e('0x38')]==='customVariable'&&_0x51c023[_0x655e('0x3f')]&&_0x51c023['Variable'][_0x655e('0x16')]&&_0x51c023[_0x655e('0x39')]&&_0x51c023[_0x655e('0x3a')]){_0x4067ae[_0x51c023[_0x655e('0x3f')][_0x655e('0x16')][_0x655e('0x36')]()]&&_0x3ca80c['custom_fields'][_0x655e('0x3b')]({'id':_0x51c023[_0x655e('0x39')],'value':_0x4067ae[_0x51c023[_0x655e('0x3f')][_0x655e('0x16')][_0x655e('0x36')]()][_0x655e('0x3c')]()});}});}return _0x3ca80c;}exports[_0x655e('0x40')]=function(_0x4a3b8d,_0x368ff1,_0x4ff288,_0x30a3da,_0x1aaa3f,_0x38587d){var _0x5bd8ac,_0x1e829b;_0x38587d[_0x655e('0x1b')]=intUtil[_0x655e('0x41')](_0x38587d['remoteUri']);_0x38587d['serverUrl']=intUtil['stripTrailingSlash'](_0x38587d[_0x655e('0x42')]);if(_0x1aaa3f&&_0x1aaa3f[_0x655e('0x43')]){logger[_0x655e('0xb')]('[QUEUE]',_0x655e('0x44'));_0x368ff1['recordingURL']=util[_0x655e('0x25')](_0x655e('0x45'),_0x38587d[_0x655e('0x42')],_0x368ff1[_0x655e('0x46')],md5(_0x368ff1[_0x655e('0x46')]));}else{_0x368ff1[_0x655e('0x47')]='';}headers['Authorization']=getAuth(_0x38587d);return getUser(_0x38587d,_0x30a3da[_0x655e('0x23')])[_0x655e('0x1d')](function(_0x14be1d){_0x5bd8ac=_0x14be1d;logger[_0x655e('0xb')](_0x655e('0x48'),_0x5bd8ac['id']);return getEndUser(_0x38587d,_0x368ff1['calleridname'],_0x368ff1[_0x655e('0x10')]);})[_0x655e('0x1d')](function(_0xfea6b8){_0x1e829b=_0xfea6b8;logger[_0x655e('0xb')](_0x655e('0x49'),_0x1e829b['id']);return getTicket(_0x38587d,_0x5bd8ac,_0x1e829b,_0x4ff288,_0x368ff1);})[_0x655e('0x1d')](function(_0x59d525){if(_0x59d525&&_0x59d525['id']){logger[_0x655e('0xb')](_0x655e('0x4a'));logger['info'](_0x655e('0x4b'),_0x59d525['id']);logger[_0x655e('0xb')](_0x655e('0x4c'),_0x655e('0x4d'));emit(util[_0x655e('0x25')](_0x655e('0x4e'),_0x30a3da['name']),_0x655e('0x4f'),{'uri':util[_0x655e('0x25')](_0x655e('0x50'),_0x38587d[_0x655e('0x1b')],_0x59d525['id'])});}})[_0x655e('0x51')](function(_0x5b693c){logger[_0x655e('0x52')](_0x655e('0x4c'),JSON[_0x655e('0x2e')](_0x5b693c));});};exports['outbound']=function(_0x5168ab,_0x5a59b8,_0x5715c3,_0x392bbb,_0x5250d9,_0x241c55,_0x2fa34c){var _0x50a6e5,_0x32465e;_0x241c55['remoteUri']=intUtil['stripTrailingSlash'](_0x241c55[_0x655e('0x1b')]);_0x241c55[_0x655e('0x42')]=intUtil[_0x655e('0x41')](_0x241c55['serverUrl']);if(_0x2fa34c&&_0x2fa34c[_0x655e('0x53')]&&_0x2fa34c[_0x655e('0x53')]!==_0x655e('0x54')){logger['info']('[OUTBOUND]',_0x655e('0x44'));_0x5a59b8['recordingURL']=util[_0x655e('0x25')](_0x655e('0x45'),_0x241c55['serverUrl'],_0x5a59b8[_0x655e('0x46')],md5(_0x5a59b8[_0x655e('0x46')]));}headers[_0x655e('0x55')]=getAuth(_0x241c55);return getUser(_0x241c55,_0x392bbb['email'])[_0x655e('0x1d')](function(_0x2f39f1){_0x50a6e5=_0x2f39f1;logger['info'](_0x655e('0x48'),_0x50a6e5['id']);return getEndUser(_0x241c55,_0x5a59b8[_0x655e('0x56')],_0x5a59b8[_0x655e('0x57')]);})[_0x655e('0x1d')](function(_0x3be03a){_0x32465e=_0x3be03a;logger[_0x655e('0xb')](_0x655e('0x49'),_0x32465e['id']);return getTicket(_0x241c55,_0x50a6e5,_0x32465e,_0x5715c3,_0x5a59b8);})['then'](function(_0x2c61b8){if(_0x2c61b8&&_0x2c61b8['id']){logger[_0x655e('0xb')](_0x655e('0x4a'));logger[_0x655e('0xb')](_0x655e('0x4b'),_0x2c61b8['id']);logger[_0x655e('0xb')]('[OUTBOUND]',_0x655e('0x4d'));emit(util[_0x655e('0x25')](_0x655e('0x4e'),_0x392bbb['name']),'trigger:browser:url',{'uri':util[_0x655e('0x25')](_0x655e('0x50'),_0x241c55['remoteUri'],_0x2c61b8['id'])});}})['catch'](function(_0x21aa9c){logger[_0x655e('0x52')]('[OUTBOUND]',JSON['stringify'](_0x21aa9c));});};exports[_0x655e('0x58')]=function(_0x4d108d,_0x3eaeae,_0x4ed767,_0x5ce44a,_0x4a902d,_0x3a7d0a){var _0x39a633,_0xc5005a;_0x3a7d0a[_0x655e('0x1b')]=intUtil[_0x655e('0x41')](_0x3a7d0a[_0x655e('0x1b')]);_0x3a7d0a['serverUrl']=intUtil['stripTrailingSlash'](_0x3a7d0a[_0x655e('0x42')]);if(_0x4a902d&&_0x4a902d[_0x655e('0x43')]){logger['info']('['+_0x3eaeae[_0x655e('0x59')]['toUpperCase']()+']',_0x655e('0x44'));_0x3eaeae[_0x655e('0x47')]=util[_0x655e('0x25')](_0x655e('0x45'),_0x3a7d0a['serverUrl'],_0x3eaeae['uniqueid'],md5(_0x3eaeae[_0x655e('0x46')]));}else{_0x3eaeae['recordingURL']='';}headers['Authorization']=getAuth(_0x3a7d0a);return getUser(_0x3a7d0a,'')[_0x655e('0x1d')](function(_0x3f0e8f){_0x39a633=_0x3f0e8f;logger[_0x655e('0xb')](_0x655e('0x48'),_0x39a633['id']);return getEndUser(_0x3a7d0a,_0x3eaeae[_0x655e('0xf')],_0x3eaeae[_0x655e('0x10')]);})[_0x655e('0x1d')](function(_0x1a54ed){_0xc5005a=_0x1a54ed;logger[_0x655e('0xb')]('The\x20Enduser\x20ID\x20is:',_0xc5005a['id']);return getTicket(_0x3a7d0a,_0x39a633,_0xc5005a,_0x4ed767,_0x3eaeae);})[_0x655e('0x1d')](function(_0x47f5d5){if(_0x47f5d5){logger[_0x655e('0xb')](_0x655e('0x4a'));logger['info'](_0x655e('0x4b'),_0x47f5d5['id']);}})[_0x655e('0x51')](function(_0x23da2a){logger[_0x655e('0x52')]('['+_0x3eaeae[_0x655e('0x59')]['toUpperCase']()+']',JSON[_0x655e('0x2e')](_0x23da2a));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/freshsales.js b/server/services/ami/trigger/integration/freshsales.js index 488e8fa..43cad5e 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 _0x851e=['contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','Contact\x20found\x20mobile_number:','endUserId','Contact\x20found\x20work_number:','Contact\x20created:','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','POST','getString','Subjects','Descriptions','Contact','add','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','stripTrailingSlash','remoteUri','serverUrl','username','toLowerCase','destcalleridnum','callDirection','queue','outbound','%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','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...','inspect','lodash','request-promise','md5','util','moment','bluebird','ioredis','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','socket.io-emitter','GET','/api/selector/owners','headers','info','then','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','message','Getting\x20user\x20list','users','agentEmail','userEmail','userId','User\x20found:','Admin\x20selected','toUpperCase','/api/lookup?q=','&entities=contact','find'];(function(_0x1f6fe9,_0x350e16){var _0x5de4cc=function(_0x3733eb){while(--_0x3733eb){_0x1f6fe9['push'](_0x1f6fe9['shift']());}};_0x5de4cc(++_0x350e16);}(_0x851e,0x13a));var _0xe851=function(_0x1b7dfc,_0x50210c){_0x1b7dfc=_0x1b7dfc-0x0;var _0x134c30=_0x851e[_0x1b7dfc];return _0x134c30;};'use strict';var _=require(_0xe851('0x0'));var rp=require(_0xe851('0x1'));var md5=require(_0xe851('0x2'));var util=require(_0xe851('0x3'));var moment=require(_0xe851('0x4'));var Promise=require(_0xe851('0x5'));var Redis=require(_0xe851('0x6'));var intUtil=require('./util');var config=require(_0xe851('0x7'));var logger=require(_0xe851('0x8'))(_0xe851('0x9'));config[_0xe851('0xa')]=_[_0xe851('0xb')](config[_0xe851('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0xe851('0xc'))(new Redis(config['redis']));function getAdminId(_0x4c3e82,_0x32cb95,_0x11de77,_0x49726a){return new Promise(function(_0x37a5fd,_0x4979f3){var _0x1a8f91=![];var _0xe29d7a={'method':_0xe851('0xd'),'uri':_0x49726a+_0xe851('0xe'),'json':!![]};_0xe29d7a[_0xe851('0xf')]=_0x11de77;logger[_0xe851('0x10')]('Getting\x20admin\x20information');return rp(_0xe29d7a)[_0xe851('0x11')](function(_0x43794b){if(_0x43794b){var _0x107539=_0x43794b['users'];var _0x3df072=null;for(_0x3df072=0x0;_0x3df072<_0x107539[_0xe851('0x12')];_0x3df072++){if(_0x107539[_0x3df072][_0xe851('0x13')]===_0x4c3e82[_0xe851('0x14')]){_0x4c3e82[_0xe851('0x15')]=_0x107539[_0x3df072]['id'];_0x1a8f91=!![];}}if(_0x1a8f91){logger[_0xe851('0x10')](_0xe851('0x16'),_0x4c3e82[_0xe851('0x15')]);_0x37a5fd(_0x4c3e82);}else{_0x4979f3({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x4979f3({'statusCode':0x194,'message':_0xe851('0x17')});}})[_0xe851('0x18')](function(_0x2ce86d){logger[_0xe851('0x19')]('['+[_0x32cb95['toUpperCase']()]+']',_0x2ce86d[_0xe851('0x1a')]);_0x4979f3(_0x2ce86d);});});}function getUser(_0x616bc7,_0x5779e7,_0x695872){return function(_0x4fb940){return new Promise(function(_0x496041,_0x4b96c9){var _0x1f2f2b={'method':_0xe851('0xd'),'uri':_0x695872+_0xe851('0xe'),'json':!![]};_0x1f2f2b[_0xe851('0xf')]=_0x5779e7;logger[_0xe851('0x10')](_0xe851('0x1b'));return rp(_0x1f2f2b)[_0xe851('0x11')](function(_0x6a7c85){if(_0x6a7c85){var _0xdd4195=_0x6a7c85[_0xe851('0x1c')];var _0x59ced2=![];var _0x5e7c4c=null;if(_0x4fb940[_0xe851('0x1d')]!==null){logger[_0xe851('0x10')]('Getting\x20user\x20with\x20email',_0x4fb940[_0xe851('0x1d')]);_0x4fb940[_0xe851('0x1e')]=_0x4fb940[_0xe851('0x1d')];for(_0x5e7c4c=0x0;_0x5e7c4c<_0xdd4195[_0xe851('0x12')];_0x5e7c4c++){if(_0xdd4195[_0x5e7c4c][_0xe851('0x13')]===_0x4fb940[_0xe851('0x1d')]){_0x59ced2=!![];_0x4fb940[_0xe851('0x1f')]=_0xdd4195[_0x5e7c4c]['id'];logger[_0xe851('0x10')](_0xe851('0x20'),_0x4fb940[_0xe851('0x1f')]);}}}if(!_0x59ced2){logger[_0xe851('0x10')](_0xe851('0x21'));_0x4fb940[_0xe851('0x1e')]=_0x4fb940[_0xe851('0x14')];_0x4fb940[_0xe851('0x1f')]=_0x4fb940['adminId'];_0x59ced2=!![];}if(_0x59ced2){_0x496041(_0x4fb940);}else{_0x4b96c9({'statusCode':0x194,'message':_0xe851('0x17')});}}else{_0x4b96c9({'statusCode':0x194,'message':_0xe851('0x17')});}})[_0xe851('0x18')](function(_0x87da61){logger[_0xe851('0x19')]('['+[_0x616bc7[_0xe851('0x22')]()]+']',_0x87da61[_0xe851('0x1a')]);_0x4b96c9(_0x87da61);});});};}function searchContact(_0x428a7d,_0x404103,_0x1a23ee,_0xe07f63){return new Promise(function(_0x517c10,_0x39d93a){var _0x2679fb={'method':_0xe851('0xd'),'headers':_0x404103,'uri':_0x428a7d+_0xe851('0x23')+_0xe07f63+'&f='+_0x1a23ee+_0xe851('0x24'),'json':!![]};rp(_0x2679fb)[_0xe851('0x11')](function(_0x5978ac){var _0x3c603e=_[_0xe851('0x25')](_0x5978ac[_0xe851('0x26')][_0xe851('0x26')],[_0x1a23ee,_0xe07f63]);_0x517c10(_0x3c603e);})[_0xe851('0x18')](function(_0x1814ac){_0x39d93a(_0x1814ac);});});}function getEndUser(_0x59d227,_0x3b52ed,_0x44e534){return function(_0x4ff815){return new Promise(function(_0x5046d9,_0x57b671){logger[_0xe851('0x10')](util[_0xe851('0x27')](_0xe851('0x28'),_0x4ff815[_0xe851('0x29')]));searchContact(_0x44e534,_0x3b52ed,'mobile_number',_0x4ff815[_0xe851('0x29')])['then'](function(_0x20b171){if(_0x20b171){_0x4ff815['endUserId']=_0x20b171['id'];logger[_0xe851('0x10')](_0xe851('0x2a'),_0x4ff815[_0xe851('0x2b')]);return _0x5046d9(_0x4ff815);}searchContact(_0x44e534,_0x3b52ed,'work_number',_0x4ff815['contactNumber'])[_0xe851('0x11')](function(_0x2c9bdb){if(_0x2c9bdb){_0x4ff815[_0xe851('0x2b')]=_0x2c9bdb['id'];logger[_0xe851('0x10')](_0xe851('0x2c'),_0x4ff815[_0xe851('0x2b')]);return _0x5046d9(_0x4ff815);}createEndUser(_0x4ff815,_0x59d227,_0x3b52ed,_0x44e534)[_0xe851('0x11')](function(_0x41c94){logger[_0xe851('0x10')](_0xe851('0x2d'),_0x41c94[_0xe851('0x2b')]);return _0x5046d9(_0x41c94);});});})[_0xe851('0x18')](function(_0x312a00){_0x57b671(_0x312a00);});});};}function createEndUser(_0x26c749,_0xd6e968,_0x5b9015,_0x348416){return new Promise(function(_0x4af1d7,_0x43be9d){var _0x1e14cb=moment();var _0x207de9={'method':'POST','uri':_0x348416+_0xe851('0x2e'),'body':{'contact':{'last_name':_0x26c749[_0xe851('0x29')],'work_number':_0x26c749[_0xe851('0x29')],'mobile_number':_0x26c749[_0xe851('0x29')],'owner_id':_0x26c749[_0xe851('0x1f')],'created_at':_0x1e14cb[_0xe851('0x27')](_0xe851('0x2f'))}},'json':!![]};_0x207de9[_0xe851('0xf')]=_0x5b9015;logger[_0xe851('0x10')](_0xe851('0x30'));return rp(_0x207de9)['then'](function(_0x35e58d){_0x26c749['endUserId']=_0x35e58d[_0xe851('0x31')]['id'];_0x4af1d7(_0x26c749);})[_0xe851('0x18')](function(_0x433812){logger[_0xe851('0x19')]('['+[_0xd6e968[_0xe851('0x22')]()]+']',_0x433812['message']);_0x43be9d(_0x433812['message']);});});}function getTicket(_0x1d993f,_0x44b035,_0x4d16ec,_0x188741,_0x255350){return function(_0x2e98ba){logger[_0xe851('0x10')](_0xe851('0x32'));return new Promise(function(_0x1bad0a,_0x5f0106){var _0x529101=moment();var _0x2efce0={'method':_0xe851('0x33'),'uri':_0x4d16ec+'/api/tasks','body':{'title':intUtil[_0xe851('0x34')](_0x188741[_0xe851('0x35')],_0x255350,'\x20'),'description':intUtil[_0xe851('0x34')](_0x188741[_0xe851('0x36')],_0x255350,'\x0a'),'owner_id':_0x2e98ba[_0xe851('0x1f')],'creater_id':_0x2e98ba['adminId'],'targetable_id':_0x2e98ba['endUserId'],'targetable_type':_0xe851('0x37'),'created_at':_0x529101['format'](_0xe851('0x2f')),'due_date':_0x529101[_0xe851('0x38')](0x1e,'m')[_0xe851('0x27')](_0xe851('0x2f'))},'json':!![]};_0x2efce0[_0xe851('0xf')]=_0x44b035;return rp(_0x2efce0)[_0xe851('0x11')](function(_0x554e5e){_0x2e98ba[_0xe851('0x39')]=_0x554e5e[_0xe851('0x3a')]['id'];logger[_0xe851('0x10')](_0xe851('0x3b'),_0x2e98ba['ticketId']);_0x1bad0a(_0x2e98ba);})[_0xe851('0x18')](function(_0x1887ba){logger[_0xe851('0x19')]('['+[_0x1d993f[_0xe851('0x22')]()]+']',_0x1887ba[_0xe851('0x1a')]);_0x5f0106(_0x1887ba[_0xe851('0x1a')]);});});};}function emit(_0x2ff84a,_0x650797,_0xbba189){var _0x3e2b8a={'uri':_0x2ff84a+_0xe851('0x3c')+_0xbba189};io['to'](util['format'](_0xe851('0x3d'),_0x650797))[_0xe851('0x3e')](_0xe851('0x3f'),_0x3e2b8a);}exports['cs']=function(_0x33df61,_0xd79cfe,_0x1e4335,_0x1dd12d,_0x5b0019,_0x22e2b9,_0x41b8ff,_0x1c5326){var _0x392688={};var _0x527f81={'Authorization':_0xe851('0x40')+_0x22e2b9[_0xe851('0x41')]};_0x22e2b9['remoteUri']=intUtil[_0xe851('0x42')](_0x22e2b9[_0xe851('0x43')]);_0x22e2b9['serverUrl']=intUtil[_0xe851('0x42')](_0x22e2b9[_0xe851('0x44')]);var _0xd70bc7=_0x22e2b9[_0xe851('0x43')];_0x392688[_0xe851('0x14')]=_0x22e2b9[_0xe851('0x45')];_0x392688['contactNumber']=_0x1c5326[_0xe851('0x46')]()==='outbound'?_0xd79cfe[_0xe851('0x47')]:_0xd79cfe['calleridnum'];_0x392688[_0xe851('0x48')]=_0x1c5326===_0xe851('0x49')||_0x1c5326==='unmanaged'?'queue':_0xe851('0x4a');if(_0x1dd12d){_0x392688[_0xe851('0x1d')]=_0x1dd12d[_0xe851('0x13')];}var _0x394f9c=util['format'](_0xe851('0x4b'),_0x22e2b9[_0xe851('0x44')],_0xd79cfe['uniqueid'],md5(_0xd79cfe[_0xe851('0x4c')]));if(_0x5b0019&&_0x5b0019[_0xe851('0x4d')]){logger[_0xe851('0x10')](_0xe851('0x4e'),'Recording\x20is\x20enabled!');_0xd79cfe[_0xe851('0x4f')]=_0x394f9c;}else if(_0x41b8ff&&_0x41b8ff[_0xe851('0x50')]&&_0x41b8ff[_0xe851('0x50')]!==_0xe851('0x51')){logger[_0xe851('0x10')](_0xe851('0x52'),_0xe851('0x53'));_0xd79cfe[_0xe851('0x4f')]=_0x394f9c;}else{_0xd79cfe[_0xe851('0x4f')]='';}return getAdminId(_0x392688,_0x1c5326,_0x527f81,_0xd70bc7)[_0xe851('0x11')](getUser(_0x1c5326,_0x527f81,_0xd70bc7))[_0xe851('0x11')](getEndUser(_0x1c5326,_0x527f81,_0xd70bc7))[_0xe851('0x11')](getTicket(_0x1c5326,_0x527f81,_0xd70bc7,_0x1e4335,_0xd79cfe))[_0xe851('0x11')](function(_0x2f55d7){logger['info'](util[_0xe851('0x27')](_0xe851('0x54'),_0x2f55d7[_0xe851('0x39')]));if(_0x1c5326!==_0xe851('0x55')){logger[_0xe851('0x10')]('['+[_0x1c5326['toUpperCase']()]+']',_0xe851('0x56'));emit(_0xd70bc7,_0x1dd12d['name'],_0x2f55d7[_0xe851('0x2b')]);}})['catch'](function(_0x537fdf){logger['error']('['+[_0x1c5326[_0xe851('0x22')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0xe851('0x57')](_0x537fdf,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xda5e=['userEmail','User\x20found:','userId','catch','&f=','&entities=contact','find','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','Subjects','Contact','ticketId','task','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','unmanaged','queue','agentEmail','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect','md5','util','moment','bluebird','./util','../../../../config/environment','../../../../config/logger','freshsales','defaults','redis','localhost','socket.io-emitter','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','error','toUpperCase','message','GET','Getting\x20user\x20list','Getting\x20user\x20with\x20email'];(function(_0x372f8f,_0x3827e4){var _0x127950=function(_0x57d307){while(--_0x57d307){_0x372f8f['push'](_0x372f8f['shift']());}};_0x127950(++_0x3827e4);}(_0xda5e,0xe4));var _0xeda5=function(_0x167307,_0x5a60ae){_0x167307=_0x167307-0x0;var _0x550140=_0xda5e[_0x167307];return _0x550140;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0xeda5('0x0'));var util=require(_0xeda5('0x1'));var moment=require(_0xeda5('0x2'));var Promise=require(_0xeda5('0x3'));var Redis=require('ioredis');var intUtil=require(_0xeda5('0x4'));var config=require(_0xeda5('0x5'));var logger=require(_0xeda5('0x6'))(_0xeda5('0x7'));config['redis']=_[_0xeda5('0x8')](config[_0xeda5('0x9')],{'host':_0xeda5('0xa'),'port':0x18eb});var io=require(_0xeda5('0xb'))(new Redis(config[_0xeda5('0x9')]));function getAdminId(_0x2d3886,_0x8d369c,_0x35dd7a,_0x46a65e){return new Promise(function(_0x404b28,_0x452869){var _0x3e2f4a=![];var _0x526a03={'method':'GET','uri':_0x46a65e+_0xeda5('0xc'),'json':!![]};_0x526a03[_0xeda5('0xd')]=_0x35dd7a;logger[_0xeda5('0xe')](_0xeda5('0xf'));return rp(_0x526a03)[_0xeda5('0x10')](function(_0x4e519c){if(_0x4e519c){var _0x3f131d=_0x4e519c[_0xeda5('0x11')];var _0x1c3f0e=null;for(_0x1c3f0e=0x0;_0x1c3f0e<_0x3f131d[_0xeda5('0x12')];_0x1c3f0e++){if(_0x3f131d[_0x1c3f0e][_0xeda5('0x13')]===_0x2d3886[_0xeda5('0x14')]){_0x2d3886[_0xeda5('0x15')]=_0x3f131d[_0x1c3f0e]['id'];_0x3e2f4a=!![];}}if(_0x3e2f4a){logger[_0xeda5('0xe')](_0xeda5('0x16'),_0x2d3886[_0xeda5('0x15')]);_0x404b28(_0x2d3886);}else{_0x452869({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x452869({'statusCode':0x194,'message':_0xeda5('0x17')});}})['catch'](function(_0x29062a){logger[_0xeda5('0x18')]('['+[_0x8d369c[_0xeda5('0x19')]()]+']',_0x29062a[_0xeda5('0x1a')]);_0x452869(_0x29062a);});});}function getUser(_0x322fa8,_0x5b2aa5,_0xb68b0d){return function(_0x834c61){return new Promise(function(_0x24cf5b,_0x475055){var _0xfb4c2={'method':_0xeda5('0x1b'),'uri':_0xb68b0d+'/api/selector/owners','json':!![]};_0xfb4c2[_0xeda5('0xd')]=_0x5b2aa5;logger[_0xeda5('0xe')](_0xeda5('0x1c'));return rp(_0xfb4c2)['then'](function(_0x4b8d49){if(_0x4b8d49){var _0x581746=_0x4b8d49[_0xeda5('0x11')];var _0x4d084e=![];var _0x424737=null;if(_0x834c61['agentEmail']!==null){logger[_0xeda5('0xe')](_0xeda5('0x1d'),_0x834c61['agentEmail']);_0x834c61[_0xeda5('0x1e')]=_0x834c61['agentEmail'];for(_0x424737=0x0;_0x424737<_0x581746[_0xeda5('0x12')];_0x424737++){if(_0x581746[_0x424737]['email']===_0x834c61['agentEmail']){_0x4d084e=!![];_0x834c61['userId']=_0x581746[_0x424737]['id'];logger[_0xeda5('0xe')](_0xeda5('0x1f'),_0x834c61[_0xeda5('0x20')]);}}}if(!_0x4d084e){logger[_0xeda5('0xe')]('Admin\x20selected');_0x834c61[_0xeda5('0x1e')]=_0x834c61[_0xeda5('0x14')];_0x834c61['userId']=_0x834c61['adminId'];_0x4d084e=!![];}if(_0x4d084e){_0x24cf5b(_0x834c61);}else{_0x475055({'statusCode':0x194,'message':_0xeda5('0x17')});}}else{_0x475055({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xeda5('0x21')](function(_0x56249f){logger['error']('['+[_0x322fa8['toUpperCase']()]+']',_0x56249f[_0xeda5('0x1a')]);_0x475055(_0x56249f);});});};}function searchContact(_0x20907b,_0x559079,_0x4c8345,_0x5b9f28){return new Promise(function(_0x25e6ba,_0x344d7b){var _0x11e296={'method':_0xeda5('0x1b'),'headers':_0x559079,'uri':_0x20907b+'/api/lookup?q='+_0x5b9f28+_0xeda5('0x22')+_0x4c8345+_0xeda5('0x23'),'json':!![]};rp(_0x11e296)['then'](function(_0x4841f2){var _0x307724=_[_0xeda5('0x24')](_0x4841f2['contacts']['contacts'],[_0x4c8345,_0x5b9f28]);_0x25e6ba(_0x307724);})[_0xeda5('0x21')](function(_0x48a578){_0x344d7b(_0x48a578);});});}function getEndUser(_0x37ef95,_0x3f8d48,_0x377ec1){return function(_0x105535){return new Promise(function(_0x1b24f5,_0x35aba4){logger[_0xeda5('0xe')](util[_0xeda5('0x25')](_0xeda5('0x26'),_0x105535[_0xeda5('0x27')]));searchContact(_0x377ec1,_0x3f8d48,_0xeda5('0x28'),_0x105535[_0xeda5('0x27')])['then'](function(_0x4bfffa){if(_0x4bfffa){_0x105535[_0xeda5('0x29')]=_0x4bfffa['id'];logger['info'](_0xeda5('0x2a'),_0x105535[_0xeda5('0x29')]);return _0x1b24f5(_0x105535);}searchContact(_0x377ec1,_0x3f8d48,_0xeda5('0x2b'),_0x105535['contactNumber'])['then'](function(_0x1a9efa){if(_0x1a9efa){_0x105535[_0xeda5('0x29')]=_0x1a9efa['id'];logger[_0xeda5('0xe')](_0xeda5('0x2c'),_0x105535['endUserId']);return _0x1b24f5(_0x105535);}createEndUser(_0x105535,_0x37ef95,_0x3f8d48,_0x377ec1)[_0xeda5('0x10')](function(_0x592459){logger['info'](_0xeda5('0x2d'),_0x592459[_0xeda5('0x29')]);return _0x1b24f5(_0x592459);});});})[_0xeda5('0x21')](function(_0x29b50c){_0x35aba4(_0x29b50c);});});};}function createEndUser(_0x6daf89,_0x2c50c6,_0x15cd4c,_0x3b7ea5){return new Promise(function(_0x125d05,_0x2209f5){var _0x5bea0b=moment();var _0x25a293={'method':_0xeda5('0x2e'),'uri':_0x3b7ea5+_0xeda5('0x2f'),'body':{'contact':{'last_name':_0x6daf89[_0xeda5('0x27')],'work_number':_0x6daf89['contactNumber'],'mobile_number':_0x6daf89[_0xeda5('0x27')],'owner_id':_0x6daf89[_0xeda5('0x20')],'created_at':_0x5bea0b['format'](_0xeda5('0x30'))}},'json':!![]};_0x25a293[_0xeda5('0xd')]=_0x15cd4c;logger[_0xeda5('0xe')](_0xeda5('0x31'));return rp(_0x25a293)[_0xeda5('0x10')](function(_0x1491d0){_0x6daf89[_0xeda5('0x29')]=_0x1491d0[_0xeda5('0x32')]['id'];_0x125d05(_0x6daf89);})[_0xeda5('0x21')](function(_0x3de961){logger[_0xeda5('0x18')]('['+[_0x2c50c6[_0xeda5('0x19')]()]+']',_0x3de961[_0xeda5('0x1a')]);_0x2209f5(_0x3de961[_0xeda5('0x1a')]);});});}function getTicket(_0x2cb10f,_0x95c4b8,_0x3205c5,_0x1c2267,_0x827a84){return function(_0x50beed){logger[_0xeda5('0xe')](_0xeda5('0x33'));return new Promise(function(_0x2db185,_0x4f59f6){var _0xbec6b1=moment();var _0x345ed2={'method':_0xeda5('0x2e'),'uri':_0x3205c5+_0xeda5('0x34'),'body':{'title':intUtil['getString'](_0x1c2267[_0xeda5('0x35')],_0x827a84,'\x20'),'description':intUtil['getString'](_0x1c2267['Descriptions'],_0x827a84,'\x0a'),'owner_id':_0x50beed[_0xeda5('0x20')],'creater_id':_0x50beed[_0xeda5('0x15')],'targetable_id':_0x50beed['endUserId'],'targetable_type':_0xeda5('0x36'),'created_at':_0xbec6b1[_0xeda5('0x25')](_0xeda5('0x30')),'due_date':_0xbec6b1['add'](0x1e,'m')[_0xeda5('0x25')](_0xeda5('0x30'))},'json':!![]};_0x345ed2[_0xeda5('0xd')]=_0x95c4b8;return rp(_0x345ed2)[_0xeda5('0x10')](function(_0xa80e36){_0x50beed[_0xeda5('0x37')]=_0xa80e36[_0xeda5('0x38')]['id'];logger[_0xeda5('0xe')]('Task\x20created:',_0x50beed[_0xeda5('0x37')]);_0x2db185(_0x50beed);})['catch'](function(_0x2606fb){logger['error']('['+[_0x2cb10f['toUpperCase']()]+']',_0x2606fb[_0xeda5('0x1a')]);_0x4f59f6(_0x2606fb[_0xeda5('0x1a')]);});});};}function emit(_0xb5b0fa,_0x49beb0,_0xc49bba){var _0x7d0434={'uri':_0xb5b0fa+_0xeda5('0x39')+_0xc49bba};io['to'](util['format'](_0xeda5('0x3a'),_0x49beb0))[_0xeda5('0x3b')](_0xeda5('0x3c'),_0x7d0434);}exports['cs']=function(_0xbe11c1,_0x15c198,_0x312f28,_0x596cd4,_0x2bbfc4,_0x4a9c8b,_0x259eb3,_0x58ef1c){var _0x56b766={};var _0xcf509a={'Authorization':_0xeda5('0x3d')+_0x4a9c8b[_0xeda5('0x3e')]};_0x4a9c8b[_0xeda5('0x3f')]=intUtil[_0xeda5('0x40')](_0x4a9c8b[_0xeda5('0x3f')]);_0x4a9c8b[_0xeda5('0x41')]=intUtil[_0xeda5('0x40')](_0x4a9c8b[_0xeda5('0x41')]);var _0x393bf5=_0x4a9c8b['remoteUri'];_0x56b766['adminEmail']=_0x4a9c8b[_0xeda5('0x42')];_0x56b766[_0xeda5('0x27')]=_0x58ef1c[_0xeda5('0x43')]()===_0xeda5('0x44')?_0x15c198[_0xeda5('0x45')]:_0x15c198[_0xeda5('0x46')];_0x56b766[_0xeda5('0x47')]=_0x58ef1c==='queue'||_0x58ef1c===_0xeda5('0x48')?_0xeda5('0x49'):_0xeda5('0x44');if(_0x596cd4){_0x56b766[_0xeda5('0x4a')]=_0x596cd4[_0xeda5('0x13')];}var _0x139eb2=util[_0xeda5('0x25')](_0xeda5('0x4b'),_0x4a9c8b['serverUrl'],_0x15c198[_0xeda5('0x4c')],md5(_0x15c198['uniqueid']));if(_0x2bbfc4&&_0x2bbfc4['monitor_format']){logger[_0xeda5('0xe')](_0xeda5('0x4d'),_0xeda5('0x4e'));_0x15c198[_0xeda5('0x4f')]=_0x139eb2;}else if(_0x259eb3&&_0x259eb3[_0xeda5('0x50')]&&_0x259eb3[_0xeda5('0x50')]!=='none'){logger[_0xeda5('0xe')](_0xeda5('0x51'),'Recording\x20is\x20enabled!');_0x15c198[_0xeda5('0x4f')]=_0x139eb2;}else{_0x15c198['recordingURL']='';}return getAdminId(_0x56b766,_0x58ef1c,_0xcf509a,_0x393bf5)['then'](getUser(_0x58ef1c,_0xcf509a,_0x393bf5))[_0xeda5('0x10')](getEndUser(_0x58ef1c,_0xcf509a,_0x393bf5))[_0xeda5('0x10')](getTicket(_0x58ef1c,_0xcf509a,_0x393bf5,_0x312f28,_0x15c198))['then'](function(_0x548555){logger[_0xeda5('0xe')](util['format'](_0xeda5('0x52'),_0x548555['ticketId']));if(_0x58ef1c!==_0xeda5('0x48')){logger[_0xeda5('0xe')]('['+[_0x58ef1c[_0xeda5('0x19')]()]+']',_0xeda5('0x53'));emit(_0x393bf5,_0x596cd4['name'],_0x548555[_0xeda5('0x29')]);}})[_0xeda5('0x21')](function(_0x24222c){logger[_0xeda5('0x18')]('['+[_0x58ef1c[_0xeda5('0x19')]()]+_0xeda5('0x54'),util[_0xeda5('0x55')](_0x24222c,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/index.js b/server/services/ami/trigger/integration/index.js index 89cf591..704d506 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 _0x8ebe=['freshsales','unknown\x20integration','../../../../config/logger','error','format','%s\x20configuration\x20#%s\x20not\x20found','data3','[EXEC]','%s\x20account\x20#%s\x20not\x20found','util','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','desk','servicenow','exec','includes','data1','toLowerCase','find','Configurations','queue','outbound','log','EVENT\x20UNKNOWN','zoho'];(function(_0x32c9fe,_0x45e277){var _0x4ccec7=function(_0x367ebd){while(--_0x367ebd){_0x32c9fe['push'](_0x32c9fe['shift']());}};_0x4ccec7(++_0x45e277);}(_0x8ebe,0x1b9));var _0xe8eb=function(_0x4207a6,_0x3a3110){_0x4207a6=_0x4207a6-0x0;var _0x42b37a=_0x8ebe[_0x4207a6];return _0x42b37a;};'use strict';var _=require('lodash');var util=require(_0xe8eb('0x0'));var zendesk=require('./zendesk');var salesforce=require(_0xe8eb('0x1'));var sugarcrm=require(_0xe8eb('0x2'));var freshdesk=require(_0xe8eb('0x3'));var zoho=require(_0xe8eb('0x4'));var desk=require(_0xe8eb('0x5'));var vtiger=require(_0xe8eb('0x6'));var servicenow=require(_0xe8eb('0x7'));var dynamics365=require(_0xe8eb('0x8'));var freshsales=require(_0xe8eb('0x9'));var integrations=[_0xe8eb('0xa'),_0xe8eb('0xb'),_0xe8eb('0xc'),_0xe8eb('0xd'),'zoho',_0xe8eb('0xe'),'vtiger','dynamics365','freshsales',_0xe8eb('0xf')];exports[_0xe8eb('0x10')]=function(_0x347eb9,_0x5c2bde,_0x7407ea,_0x452c79,_0x2b5f5c,_0x3196ed){if(_0x7407ea){if(_[_0xe8eb('0x11')](integrations,_0x347eb9[_0xe8eb('0x12')][_0xe8eb('0x13')]())){try{var _0x3dbfb1=null;var _0x50b969='';var _0x35ed04=_0x7407ea[_0x347eb9['data1'][_0xe8eb('0x13')]()];if(_0x35ed04){var _0xd8c018=_0x35ed04[_0x347eb9['data2']];if(_0xd8c018){var _0x69fc85=_[_0xe8eb('0x14')](_0xd8c018[_0xe8eb('0x15')],{'id':parseInt(_0x347eb9['data3'],0xa)});if(_0x69fc85){if(_0x452c79){if(_0x2b5f5c&&_0x5c2bde[_0xe8eb('0x16')]){_0x50b969=_0xe8eb('0x16');}else if(_0x5c2bde['routeId']){_0x50b969=_0xe8eb('0x17');}else{console[_0xe8eb('0x18')](_0xe8eb('0x19'),_0x5c2bde);}}else{_0x50b969='unmanaged';}switch(_0x347eb9[_0xe8eb('0x12')][_0xe8eb('0x13')]()){case _0xe8eb('0xa'):zendesk[_0x50b969](_0x347eb9,_0x5c2bde,_0x69fc85,_0x452c79,_0x2b5f5c,_0xd8c018,_0x3196ed);break;case _0xe8eb('0xb'):salesforce[_0x50b969](_0x347eb9,_0x5c2bde,_0x69fc85,_0x452c79,_0x2b5f5c,_0xd8c018,_0x3196ed);break;case _0xe8eb('0xc'):sugarcrm[_0x50b969](_0x347eb9,_0x5c2bde,_0x69fc85,_0x452c79,_0x2b5f5c,_0xd8c018,_0x3196ed);break;case'freshdesk':freshdesk[_0x50b969](_0x347eb9,_0x5c2bde,_0x69fc85,_0x452c79,_0x2b5f5c,_0xd8c018,_0x3196ed);break;case _0xe8eb('0x1a'):zoho[_0x50b969](_0x347eb9,_0x5c2bde,_0x69fc85,_0x452c79,_0x2b5f5c,_0xd8c018,_0x3196ed);break;case _0xe8eb('0xe'):desk[_0x50b969](_0x347eb9,_0x5c2bde,_0x69fc85,_0x452c79,_0x2b5f5c,_0xd8c018,_0x3196ed);break;case'vtiger':vtiger[_0x50b969](_0x347eb9,_0x5c2bde,_0x69fc85,_0x452c79,_0x2b5f5c,_0xd8c018,_0x3196ed);break;case _0xe8eb('0x1b'):freshsales['cs'](_0x347eb9,_0x5c2bde,_0x69fc85,_0x452c79,_0x2b5f5c,_0xd8c018,_0x3196ed,_0x50b969);break;case _0xe8eb('0xf'):servicenow['cs'](_0x347eb9,_0x5c2bde,_0x69fc85,_0x452c79,_0x2b5f5c,_0xd8c018,_0x3196ed,_0x50b969);break;case'dynamics365':dynamics365['cs'](_0x347eb9,_0x5c2bde,_0x69fc85,_0x452c79,_0x2b5f5c,_0xd8c018,_0x3196ed,_0x50b969);break;default:console['log'](_0xe8eb('0x1c'));}}else{_0x3dbfb1=require(_0xe8eb('0x1d'))(_0x347eb9['data1'][_0xe8eb('0x13')]());_0x3dbfb1[_0xe8eb('0x1e')]('[EXEC]',util[_0xe8eb('0x1f')](_0xe8eb('0x20'),_0x347eb9['data1'][_0xe8eb('0x13')](),_0x347eb9[_0xe8eb('0x21')]));}}else{_0x3dbfb1=require('../../../../config/logger')(_0x347eb9[_0xe8eb('0x12')][_0xe8eb('0x13')]());_0x3dbfb1[_0xe8eb('0x1e')](_0xe8eb('0x22'),util[_0xe8eb('0x1f')](_0xe8eb('0x23'),_0x347eb9['data1'][_0xe8eb('0x13')](),_0x347eb9['data2']));}}else{}}catch(_0x19578b){console[_0xe8eb('0x1e')](_0x19578b);}}}}; \ No newline at end of file +var _0x3529=['./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','vtiger','dynamics365','freshsales','servicenow','toLowerCase','data1','find','Configurations','queue','routeId','outbound','log','EVENT\x20UNKNOWN','zoho','desk','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','data3','%s\x20account\x20#%s\x20not\x20found','data2','lodash','util','./zendesk','./freshdesk','./zoho','./desk','./vtiger','./servicenow'];(function(_0x1ff7b5,_0x49cdf5){var _0x4cf0ad=function(_0x2ba23e){while(--_0x2ba23e){_0x1ff7b5['push'](_0x1ff7b5['shift']());}};_0x4cf0ad(++_0x49cdf5);}(_0x3529,0xd6));var _0x9352=function(_0x527824,_0xc824a9){_0x527824=_0x527824-0x0;var _0xc8b8ed=_0x3529[_0x527824];return _0xc8b8ed;};'use strict';var _=require(_0x9352('0x0'));var util=require(_0x9352('0x1'));var zendesk=require(_0x9352('0x2'));var salesforce=require('./salesforce');var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x9352('0x3'));var zoho=require(_0x9352('0x4'));var desk=require(_0x9352('0x5'));var vtiger=require(_0x9352('0x6'));var servicenow=require(_0x9352('0x7'));var dynamics365=require(_0x9352('0x8'));var freshsales=require(_0x9352('0x9'));var integrations=[_0x9352('0xa'),_0x9352('0xb'),_0x9352('0xc'),_0x9352('0xd'),'zoho','desk',_0x9352('0xe'),_0x9352('0xf'),_0x9352('0x10'),_0x9352('0x11')];exports['exec']=function(_0x5a17e2,_0x15c9a9,_0xd3510,_0x57b54b,_0x21e383,_0x4cbea3){if(_0xd3510){if(_['includes'](integrations,_0x5a17e2['data1'][_0x9352('0x12')]())){try{var _0x4c4477=null;var _0x3ed22a='';var _0x51a186=_0xd3510[_0x5a17e2[_0x9352('0x13')][_0x9352('0x12')]()];if(_0x51a186){var _0x1011b1=_0x51a186[_0x5a17e2['data2']];if(_0x1011b1){var _0x1c4b91=_[_0x9352('0x14')](_0x1011b1[_0x9352('0x15')],{'id':parseInt(_0x5a17e2['data3'],0xa)});if(_0x1c4b91){if(_0x57b54b){if(_0x21e383&&_0x15c9a9[_0x9352('0x16')]){_0x3ed22a=_0x9352('0x16');}else if(_0x15c9a9[_0x9352('0x17')]){_0x3ed22a=_0x9352('0x18');}else{console[_0x9352('0x19')](_0x9352('0x1a'),_0x15c9a9);}}else{_0x3ed22a='unmanaged';}switch(_0x5a17e2['data1']['toLowerCase']()){case _0x9352('0xa'):zendesk[_0x3ed22a](_0x5a17e2,_0x15c9a9,_0x1c4b91,_0x57b54b,_0x21e383,_0x1011b1,_0x4cbea3);break;case _0x9352('0xb'):salesforce[_0x3ed22a](_0x5a17e2,_0x15c9a9,_0x1c4b91,_0x57b54b,_0x21e383,_0x1011b1,_0x4cbea3);break;case _0x9352('0xc'):sugarcrm[_0x3ed22a](_0x5a17e2,_0x15c9a9,_0x1c4b91,_0x57b54b,_0x21e383,_0x1011b1,_0x4cbea3);break;case _0x9352('0xd'):freshdesk[_0x3ed22a](_0x5a17e2,_0x15c9a9,_0x1c4b91,_0x57b54b,_0x21e383,_0x1011b1,_0x4cbea3);break;case _0x9352('0x1b'):zoho[_0x3ed22a](_0x5a17e2,_0x15c9a9,_0x1c4b91,_0x57b54b,_0x21e383,_0x1011b1,_0x4cbea3);break;case _0x9352('0x1c'):desk[_0x3ed22a](_0x5a17e2,_0x15c9a9,_0x1c4b91,_0x57b54b,_0x21e383,_0x1011b1,_0x4cbea3);break;case _0x9352('0xe'):vtiger[_0x3ed22a](_0x5a17e2,_0x15c9a9,_0x1c4b91,_0x57b54b,_0x21e383,_0x1011b1,_0x4cbea3);break;case'freshsales':freshsales['cs'](_0x5a17e2,_0x15c9a9,_0x1c4b91,_0x57b54b,_0x21e383,_0x1011b1,_0x4cbea3,_0x3ed22a);break;case _0x9352('0x11'):servicenow['cs'](_0x5a17e2,_0x15c9a9,_0x1c4b91,_0x57b54b,_0x21e383,_0x1011b1,_0x4cbea3,_0x3ed22a);break;case _0x9352('0xf'):dynamics365['cs'](_0x5a17e2,_0x15c9a9,_0x1c4b91,_0x57b54b,_0x21e383,_0x1011b1,_0x4cbea3,_0x3ed22a);break;default:console[_0x9352('0x19')](_0x9352('0x1d'));}}else{_0x4c4477=require(_0x9352('0x1e'))(_0x5a17e2[_0x9352('0x13')][_0x9352('0x12')]());_0x4c4477[_0x9352('0x1f')](_0x9352('0x20'),util[_0x9352('0x21')]('%s\x20configuration\x20#%s\x20not\x20found',_0x5a17e2[_0x9352('0x13')]['toLowerCase'](),_0x5a17e2[_0x9352('0x22')]));}}else{_0x4c4477=require(_0x9352('0x1e'))(_0x5a17e2[_0x9352('0x13')][_0x9352('0x12')]());_0x4c4477['error']('[EXEC]',util[_0x9352('0x21')](_0x9352('0x23'),_0x5a17e2[_0x9352('0x13')][_0x9352('0x12')](),_0x5a17e2[_0x9352('0x24')]));}}else{}}catch(_0x521754){console[_0x9352('0x1f')](_0x521754);}}}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/salesforce.js b/server/services/ami/trigger/integration/salesforce.js index 2516c93..62c732f 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 _0x3b2f=['forEach','includes','string','idField','content','toString','variableName','customVariable','Variable','name','password','concat','securityToken','Connection','https://login.salesforce.com','clientId','login','username','queue','remoteUri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','integrationTab','user:%s','newTab','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','outbound','serverUrl','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','trigger:browser:url','Salesforce\x20account\x20type\x20not\x20recognized','catch','unmanaged','lastevent','toUpperCase','lodash','request-promise','moment','bluebird','md5','jsforce','ioredis','./util','../../../../config/environment','salesforce','redis','defaults','localhost','socket.io-emitter','emit','assign','getString','Descriptions','ticketType','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','Case','ContactId','account','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','find','execute','then','length','Email','Agent\x20%s\x20found.','resolve','identity','user_id','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','moduleSearch','cloneDeep','additionalSearchContact','merge','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','$or','Contact','Account','first','Name','Phone','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','','format','Caller\x20-\x20%s','LastName','Company','No\x20Company','upperFirst'];(function(_0x89edf7,_0x4ffa4f){var _0x2ea65c=function(_0x5708a4){while(--_0x5708a4){_0x89edf7['push'](_0x89edf7['shift']());}};_0x2ea65c(++_0x4ffa4f);}(_0x3b2f,0xb8));var _0xf3b2=function(_0x578b73,_0x1dc7e4){_0x578b73=_0x578b73-0x0;var _0x2e711b=_0x3b2f[_0x578b73];return _0x2e711b;};'use strict';var _=require(_0xf3b2('0x0'));var rp=require(_0xf3b2('0x1'));var moment=require(_0xf3b2('0x2'));var BPromise=require(_0xf3b2('0x3'));var md5=require(_0xf3b2('0x4'));var jsforce=require(_0xf3b2('0x5'));var util=require('util');var Redis=require(_0xf3b2('0x6'));var intUtil=require(_0xf3b2('0x7'));var config=require(_0xf3b2('0x8'));var logger=require('../../../../config/logger')(_0xf3b2('0x9'));config[_0xf3b2('0xa')]=_[_0xf3b2('0xb')](config[_0xf3b2('0xa')],{'host':_0xf3b2('0xc'),'port':0x18eb});var io=require(_0xf3b2('0xd'))(new Redis(config[_0xf3b2('0xa')]));function emit(_0x1a2e35,_0x5be699,_0x4338d0){io['to'](_0x1a2e35)[_0xf3b2('0xe')](_0x5be699,_0x4338d0);}function getTicket(_0x2d573f,_0x58c51f,_0x57b2c7,_0x30daa1,_0x57c4fd,_0x5f59cf,_0x19295e,_0x1631ab){var _0x583946=Object[_0xf3b2('0xf')]({},{'OwnerId':_0x58c51f['id'],'Subject':intUtil[_0xf3b2('0x10')](_0x30daa1['Subjects'],_0x57c4fd,'\x20'),'Description':intUtil[_0xf3b2('0x10')](_0x30daa1[_0xf3b2('0x11')],_0x57c4fd,'\x0a')},getCustomFields(_0x5f59cf,_0x57c4fd));if(_0x57b2c7){if(_0x30daa1[_0xf3b2('0x12')]===_0xf3b2('0x13')){_0x583946[_0xf3b2('0x14')]=moment[_0xf3b2('0x15')]();_0x583946[_0xf3b2('0x16')]=![];_0x583946[_0xf3b2('0x17')]=![];if(_0x57b2c7[_0xf3b2('0x18')]===_0xf3b2('0x19')||_0x57b2c7[_0xf3b2('0x18')]===_0xf3b2('0x1a')){_0x583946[_0xf3b2('0x1b')]=_0x57b2c7['id'];}else if(_0x57b2c7['endUserType']==='account'){_0x583946['WhatId']=_0x57b2c7['id'];}}else if(_0x30daa1[_0xf3b2('0x12')]===_0xf3b2('0x1c')){if(_0x57b2c7['endUserType']==='contact'){_0x583946[_0xf3b2('0x1d')]=_0x57b2c7['id'];}else if(_0x57b2c7[_0xf3b2('0x18')]===_0xf3b2('0x1e')){_0x583946[_0xf3b2('0x1f')]=_0x57b2c7['id'];}else if(_0x57b2c7['endUserType']==='lead'&&_0x30daa1[_0xf3b2('0x20')]){_0x583946[_0x30daa1['leadId']]=_0x57b2c7['id'];}else{logger[_0xf3b2('0x21')](_0xf3b2('0x22'));}}}return _0x19295e[_0xf3b2('0x23')](_0x30daa1[_0xf3b2('0x12')])[_0xf3b2('0x24')](_0x583946);}function getUser(_0x394dba,_0x35e8f6,_0x4dbb0d){if(!_[_0xf3b2('0x25')](_0x35e8f6)&&intUtil[_0xf3b2('0x26')](_0x35e8f6)){var _0xf0318f={'Email':_0x35e8f6};var _0x189a98={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x4dbb0d['sobject'](_0xf3b2('0x27'))[_0xf3b2('0x28')](_0xf0318f,_0x189a98)[_0xf3b2('0x29')]()[_0xf3b2('0x2a')](function(_0x2b762d){if(_0x2b762d[_0xf3b2('0x2b')]){var _0x4c16d7=_[_0xf3b2('0x28')](_0x2b762d,function(_0x43c902){return _0x43c902[_0xf3b2('0x2c')]===_0x35e8f6;});if(_0x4c16d7){logger['info'](_0xf3b2('0x2d'),_0x35e8f6);return BPromise[_0xf3b2('0x2e')]({'id':_0x4c16d7['Id'],'name':_0x4c16d7['Name']});}}else{logger[_0xf3b2('0x21')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x35e8f6);return _0x4dbb0d[_0xf3b2('0x2f')]()['then'](function(_0x3ab72b){return BPromise['resolve']({'id':_0x3ab72b[_0xf3b2('0x30')],'name':_0x3ab72b[_0xf3b2('0x31')]});});}});}else{logger[_0xf3b2('0x21')](_0xf3b2('0x32'),_0x35e8f6);return _0x4dbb0d[_0xf3b2('0x2f')]()[_0xf3b2('0x2a')](function(_0x4e834f){return BPromise['resolve']({'id':_0x4e834f[_0xf3b2('0x30')],'name':_0x4e834f['display_name']});});}}function getEndUser(_0x4a6f8a,_0x14c6fa,_0x567d00,_0x318a95,_0x502131){var _0x28785c={'$or':{'Phone':_0x318a95}};var _0x3eadfa={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xf3b2('0x2e')]()[_0xf3b2('0x2a')](function(){logger[_0xf3b2('0x21')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x318a95,_0x14c6fa[_0xf3b2('0x33')]);switch(_0x14c6fa[_0xf3b2('0x33')]){case'contact_lead':var _0x3a120a=_[_0xf3b2('0x34')](_0x28785c);if(_0x14c6fa[_0xf3b2('0x35')]){var _0x50223c={};_0x50223c[_0x14c6fa['additionalSearchContact']]=_0x318a95;_[_0xf3b2('0x36')](_0x3a120a['$or'],_0x50223c);}return _0x502131[_0xf3b2('0x23')]('Contact')[_0xf3b2('0x28')](_0x3a120a,_0x3eadfa)[_0xf3b2('0x29')]()[_0xf3b2('0x2a')](function(_0x1babd4){if(_0x1babd4&&_0x1babd4['length']){return _0x1babd4;}else{var _0x801815=_[_0xf3b2('0x34')](_0x28785c);if(_0x14c6fa[_0xf3b2('0x37')]){var _0x398c9e={};_0x398c9e[_0x14c6fa[_0xf3b2('0x37')]]=_0x318a95;_[_0xf3b2('0x36')](_0x801815['$or'],_0x398c9e);}return _0x502131[_0xf3b2('0x23')](_0xf3b2('0x38'))['find'](_0x801815,_0x3eadfa);}});case _0xf3b2('0x39'):var _0x5cb5a5=_[_0xf3b2('0x34')](_0x28785c);if(_0x14c6fa[_0xf3b2('0x3a')]){var _0x50223c={};_0x50223c[_0x14c6fa[_0xf3b2('0x3a')]]=_0x318a95;_[_0xf3b2('0x36')](_0x5cb5a5[_0xf3b2('0x3b')],_0x50223c);}return _0x502131[_0xf3b2('0x23')]('Account')['find'](_0x5cb5a5,_0x3eadfa)[_0xf3b2('0x29')]()['then'](function(_0x3e0539){if(_0x3e0539&&_0x3e0539[_0xf3b2('0x2b')]){return _0x3e0539;}else{var _0x387daa=_['cloneDeep'](_0x28785c);if(_0x14c6fa[_0xf3b2('0x35')]){var _0x41458f={};_0x41458f[_0x14c6fa[_0xf3b2('0x35')]]=_0x318a95;_[_0xf3b2('0x36')](_0x387daa[_0xf3b2('0x3b')],_0x41458f);}return _0x502131[_0xf3b2('0x23')]('Contact')[_0xf3b2('0x28')](_0x387daa,_0x3eadfa)[_0xf3b2('0x2a')](function(_0x32e163){if(_0x32e163&&_0x32e163[_0xf3b2('0x2b')]){return _0x32e163;}else{var _0x1f125e=_[_0xf3b2('0x34')](_0x28785c);if(_0x14c6fa[_0xf3b2('0x37')]){var _0x20e8ff={};_0x20e8ff[_0x14c6fa[_0xf3b2('0x37')]]=_0x318a95;_[_0xf3b2('0x36')](_0x1f125e[_0xf3b2('0x3b')],_0x20e8ff);}return _0x502131[_0xf3b2('0x23')]('Lead')[_0xf3b2('0x28')](_0x1f125e,_0x3eadfa);}});}});case _0xf3b2('0x19'):var _0x3a120a=_[_0xf3b2('0x34')](_0x28785c);if(_0x14c6fa[_0xf3b2('0x35')]){var _0x50223c={};_0x50223c[_0x14c6fa[_0xf3b2('0x35')]]=_0x318a95;_[_0xf3b2('0x36')](_0x3a120a[_0xf3b2('0x3b')],_0x50223c);}return _0x502131[_0xf3b2('0x23')](_0xf3b2('0x3c'))[_0xf3b2('0x28')](_0x3a120a,_0x3eadfa)[_0xf3b2('0x29')]();case _0xf3b2('0x1a'):var _0x5a6e55=_['cloneDeep'](_0x28785c);if(_0x14c6fa['additionalSearchLead']){var _0x50223c={};_0x50223c[_0x14c6fa[_0xf3b2('0x37')]]=_0x318a95;_[_0xf3b2('0x36')](_0x5a6e55[_0xf3b2('0x3b')],_0x50223c);}return _0x502131[_0xf3b2('0x23')](_0xf3b2('0x38'))[_0xf3b2('0x28')](_0x5a6e55,_0x3eadfa);case _0xf3b2('0x1e'):var _0x5cb5a5=_[_0xf3b2('0x34')](_0x28785c);if(_0x14c6fa[_0xf3b2('0x3a')]){var _0x50223c={};_0x50223c[_0x14c6fa[_0xf3b2('0x3a')]]=_0x318a95;_['merge'](_0x5cb5a5[_0xf3b2('0x3b')],_0x50223c);}return _0x502131[_0xf3b2('0x23')](_0xf3b2('0x3d'))[_0xf3b2('0x28')](_0x5cb5a5,_0x3eadfa);default:return null;}})[_0xf3b2('0x2a')](function(_0x2fd46e){if(_0x2fd46e&&_0x2fd46e[_0xf3b2('0x2b')]){var _0x531f74=_[_0xf3b2('0x3e')](_0x2fd46e);if(_0x531f74){return BPromise['resolve']({'id':_0x531f74['Id'],'name':_0x531f74[_0xf3b2('0x3f')],'phone':_0x531f74[_0xf3b2('0x40')],'endUserType':_0x531f74['attributes'][_0xf3b2('0x41')][_0xf3b2('0x42')]()});}}})[_0xf3b2('0x2a')](function(_0x44fd62){if(_0x44fd62){logger['info'](_0xf3b2('0x43'),_0x44fd62[_0xf3b2('0x18')],_0x318a95);return BPromise[_0xf3b2('0x2e')](_0x44fd62);}else{logger['info'](_0xf3b2('0x44'),_0x318a95);var _0x519851={'Phone':_0x318a95};if(_0x14c6fa[_0xf3b2('0x45')]){if(_0x14c6fa[_0xf3b2('0x45')]===_0xf3b2('0x19')){logger[_0xf3b2('0x21')](_0xf3b2('0x46'),_0x318a95,_0x14c6fa['moduleCreate']);_0x519851['LastName']=_0x567d00!==_0xf3b2('0x47')?_0x567d00:util[_0xf3b2('0x48')](_0xf3b2('0x49'),_0x318a95);}else if(_0x14c6fa[_0xf3b2('0x45')]===_0xf3b2('0x1a')){logger[_0xf3b2('0x21')](_0xf3b2('0x46'),_0x318a95,_0x14c6fa[_0xf3b2('0x45')]);_0x519851[_0xf3b2('0x4a')]=_0x567d00!==_0xf3b2('0x47')?_0x567d00:util[_0xf3b2('0x48')](_0xf3b2('0x49'),_0x318a95);_0x519851[_0xf3b2('0x4b')]=_0xf3b2('0x4c');}else if(_0x14c6fa[_0xf3b2('0x45')]===_0xf3b2('0x1e')){logger['info'](_0xf3b2('0x46'),_0x318a95,_0x14c6fa[_0xf3b2('0x45')]);_0x519851[_0xf3b2('0x3f')]=_0x567d00!==_0xf3b2('0x47')?_0x567d00:util[_0xf3b2('0x48')](_0xf3b2('0x49'),_0x318a95);}else{return null;}}return _0x502131['sobject'](_[_0xf3b2('0x4d')](_0x14c6fa[_0xf3b2('0x45')]))['create'](_0x519851)[_0xf3b2('0x2a')](function(_0x3fcd75){return BPromise['resolve']({'id':_0x3fcd75['id'],'endUserType':_0x14c6fa[_0xf3b2('0x45')]});});}});}function getCustomFields(_0x93aab6,_0x498659){var _0x43260d={};if(_0x93aab6['length']>0x0){_[_0xf3b2('0x4e')](_0x93aab6,function(_0x30cb0b){if(_[_0xf3b2('0x4f')]([_0xf3b2('0x50'),'picklist'],_0x30cb0b[_0xf3b2('0x41')])&&_0x30cb0b[_0xf3b2('0x51')]){_0x43260d[_0x30cb0b[_0xf3b2('0x51')]]=_0x30cb0b[_0xf3b2('0x52')][_0xf3b2('0x53')]();}else if(_0x30cb0b[_0xf3b2('0x41')]==='variable'&&_0x30cb0b[_0xf3b2('0x54')]&&_0x30cb0b[_0xf3b2('0x51')]){_0x498659[_0x30cb0b[_0xf3b2('0x54')]]&&(_0x43260d[_0x30cb0b['idField']]=_0x498659[_0x30cb0b[_0xf3b2('0x54')]][_0xf3b2('0x53')]());}else if(_0x30cb0b['type']===_0xf3b2('0x55')&&_0x30cb0b[_0xf3b2('0x56')]&&_0x30cb0b['Variable'][_0xf3b2('0x57')]&&_0x30cb0b['idField']){_0x498659[_0x30cb0b['Variable'][_0xf3b2('0x57')]['toLowerCase']()]&&(_0x43260d[_0x30cb0b[_0xf3b2('0x51')]]=_0x498659[_0x30cb0b[_0xf3b2('0x56')][_0xf3b2('0x57')][_0xf3b2('0x42')]()][_0xf3b2('0x53')]());}});}return _0x43260d;}function getConnection(_0x5312f3){var _0x36b2b8=_0x5312f3[_0xf3b2('0x58')][_0xf3b2('0x59')](_0x5312f3[_0xf3b2('0x5a')]);var _0x362fa0=new jsforce[(_0xf3b2('0x5b'))]({'oauth2':{'loginUrl':_0x5312f3['remoteUri']||_0xf3b2('0x5c'),'clientId':_0x5312f3[_0xf3b2('0x5d')],'clientSecret':_0x5312f3['clientSecret']}});return _0x362fa0[_0xf3b2('0x5e')](_0x5312f3[_0xf3b2('0x5f')],_0x36b2b8)[_0xf3b2('0x2a')](function(){logger[_0xf3b2('0x21')]('Connection\x20established.');return _0x362fa0;});}exports[_0xf3b2('0x60')]=function(_0x537789,_0x4e2e9f,_0xfb06f4,_0x1f432a,_0xebcbd0,_0x4c1430){var _0x4aff,_0x4f1805,_0x346b14,_0x2f2f2c;_0x4c1430['serverUrl']=intUtil['stripTrailingSlash'](_0x4c1430['serverUrl']);_0x4c1430[_0xf3b2('0x61')]=intUtil['stripTrailingSlash'](_0x4c1430[_0xf3b2('0x61')]);if(_0xebcbd0&&_0xebcbd0[_0xf3b2('0x62')]){logger['info'](_0xf3b2('0x63'),_0xf3b2('0x64'));_0x4e2e9f['recordingURL']=util[_0xf3b2('0x48')](_0xf3b2('0x65'),_0x4c1430['serverUrl'],_0x4e2e9f[_0xf3b2('0x66')],md5(_0x4e2e9f[_0xf3b2('0x66')]));}else{_0x4e2e9f[_0xf3b2('0x67')]='';}return getConnection(_0x4c1430)[_0xf3b2('0x2a')](function(_0x456a71){_0x2f2f2c=_0x456a71;return getUser(_0x4c1430,_0x1f432a[_0xf3b2('0x68')],_0x2f2f2c);})[_0xf3b2('0x2a')](function(_0x236b19){_0x4aff=_0x236b19;return getEndUser(_0x4c1430,_0xfb06f4,_0x4e2e9f[_0xf3b2('0x69')],_0x4e2e9f[_0xf3b2('0x6a')],_0x2f2f2c);})[_0xf3b2('0x2a')](function(_0x47008a){_0x4f1805=_0x47008a;return getTicket(_0x4c1430,_0x4aff,_0x4f1805,_0xfb06f4,_0x4e2e9f,_0xfb06f4[_0xf3b2('0x6b')],_0x2f2f2c,_0xf3b2('0x60'));})[_0xf3b2('0x2a')](function(_0x4e078a){_0x346b14=_0x4e078a;logger[_0xf3b2('0x21')](_0xf3b2('0x6c'),_0x346b14['id']);logger[_0xf3b2('0x21')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x346b14['id'],_0x1f432a[_0xf3b2('0x57')],_0x4c1430[_0xf3b2('0x41')]);switch(_0x4c1430['type']){case _0xf3b2('0x6d'):emit(util[_0xf3b2('0x48')](_0xf3b2('0x6e'),_0x1f432a['name']),'trigger:salesforce:display',{'recordId':_0x346b14['id']});break;case _0xf3b2('0x6f'):emit(util[_0xf3b2('0x48')]('user:%s',_0x1f432a[_0xf3b2('0x57')]),'trigger:browser:url',{'uri':util['format'](_0xf3b2('0x70'),_0x2f2f2c[_0xf3b2('0x71')],_0x346b14['id'])});break;default:logger[_0xf3b2('0x72')](_0xf3b2('0x73'));}})['catch'](function(_0x54e780){logger[_0xf3b2('0x72')](_0xf3b2('0x63'),_0x54e780);});};exports[_0xf3b2('0x74')]=function(_0x7e0a4d,_0x3c14e8,_0x39578e,_0x19674e,_0x5a5922,_0xd39954,_0x49bb30){var _0x49aeba,_0x23356f,_0x18dd73,_0x2e5d46;_0xd39954[_0xf3b2('0x75')]=intUtil[_0xf3b2('0x76')](_0xd39954['serverUrl']);_0xd39954['remoteUri']=intUtil['stripTrailingSlash'](_0xd39954[_0xf3b2('0x61')]);if(_0x49bb30&&_0x49bb30[_0xf3b2('0x77')]&&_0x49bb30[_0xf3b2('0x77')]!==_0xf3b2('0x78')){logger[_0xf3b2('0x21')](_0xf3b2('0x79'),_0xf3b2('0x64'));_0x3c14e8[_0xf3b2('0x67')]=util[_0xf3b2('0x48')](_0xf3b2('0x65'),_0xd39954[_0xf3b2('0x75')],_0x3c14e8[_0xf3b2('0x66')],md5(_0x3c14e8[_0xf3b2('0x66')]));}return getConnection(_0xd39954)[_0xf3b2('0x2a')](function(_0x2449ca){_0x2e5d46=_0x2449ca;return getUser(_0xd39954,_0x19674e[_0xf3b2('0x68')],_0x2e5d46);})[_0xf3b2('0x2a')](function(_0x1c2f95){_0x49aeba=_0x1c2f95;return getEndUser(_0xd39954,_0x39578e,_0x3c14e8['destcalleridname'],_0x3c14e8['destcalleridnum'],_0x2e5d46);})[_0xf3b2('0x2a')](function(_0x5f04f8){_0x23356f=_0x5f04f8;return getTicket(_0xd39954,_0x49aeba,_0x23356f,_0x39578e,_0x3c14e8,_0x39578e[_0xf3b2('0x6b')],_0x2e5d46,_0xf3b2('0x74'));})[_0xf3b2('0x2a')](function(_0x1b754a){_0x18dd73=_0x1b754a;logger['info'](_0xf3b2('0x7a'),_0x18dd73['id']);logger['info'](_0xf3b2('0x7b'),_0x18dd73['id'],_0x19674e[_0xf3b2('0x57')],_0xd39954['type']);switch(_0xd39954[_0xf3b2('0x41')]){case _0xf3b2('0x6d'):emit(util['format'](_0xf3b2('0x6e'),_0x19674e[_0xf3b2('0x57')]),_0xf3b2('0x7c'),{'recordId':_0x18dd73['id']});break;case _0xf3b2('0x6f'):emit(util[_0xf3b2('0x48')](_0xf3b2('0x6e'),_0x19674e['name']),_0xf3b2('0x7d'),{'uri':util[_0xf3b2('0x48')](_0xf3b2('0x70'),_0x2e5d46[_0xf3b2('0x71')],_0x18dd73['id'])});break;default:logger[_0xf3b2('0x72')](_0xf3b2('0x79'),_0xf3b2('0x7e'));}})[_0xf3b2('0x7f')](function(_0x12c904){logger['error'](_0xf3b2('0x79'),_0x12c904);});};exports[_0xf3b2('0x80')]=function(_0x4cf37b,_0x161c7d,_0x48b254,_0x3827c9,_0x5d08e6,_0x2423f8){var _0x30d354,_0x1a150c,_0x4bb79a,_0x4f2743;_0x2423f8[_0xf3b2('0x75')]=intUtil[_0xf3b2('0x76')](_0x2423f8[_0xf3b2('0x75')]);_0x2423f8[_0xf3b2('0x61')]=intUtil[_0xf3b2('0x76')](_0x2423f8[_0xf3b2('0x61')]);if(_0x5d08e6&&_0x5d08e6[_0xf3b2('0x62')]){logger[_0xf3b2('0x21')]('['+_0x161c7d[_0xf3b2('0x81')][_0xf3b2('0x82')]()+']','Recording\x20is\x20enabled!');_0x161c7d[_0xf3b2('0x67')]=util[_0xf3b2('0x48')](_0xf3b2('0x65'),_0x2423f8[_0xf3b2('0x75')],_0x161c7d[_0xf3b2('0x66')],md5(_0x161c7d[_0xf3b2('0x66')]));}else{_0x161c7d[_0xf3b2('0x67')]='';}return getConnection(_0x2423f8)[_0xf3b2('0x2a')](function(_0x129f27){_0x4f2743=_0x129f27;if(!_[_0xf3b2('0x25')](_0x3827c9)){return getUser(_0x2423f8,_0x3827c9['name'],_0x4f2743);}else{return getUser(_0x2423f8,null,_0x4f2743);}})[_0xf3b2('0x2a')](function(_0x2ca615){_0x30d354=_0x2ca615;return getEndUser(_0x2423f8,_0x48b254,_0x161c7d[_0xf3b2('0x69')],_0x161c7d[_0xf3b2('0x6a')],_0x4f2743);})['then'](function(_0x26f6a3){_0x1a150c=_0x26f6a3;return getTicket(_0x2423f8,_0x30d354,_0x1a150c,_0x48b254,_0x161c7d,_0x48b254[_0xf3b2('0x6b')],_0x4f2743);})[_0xf3b2('0x2a')](function(_0x2aed75){_0x4bb79a=_0x2aed75;logger['info']('['+_0x161c7d[_0xf3b2('0x81')][_0xf3b2('0x82')]()+']\x20Ticket\x20%s\x20created.',_0x4bb79a['id']);logger[_0xf3b2('0x21')]('['+_0x161c7d[_0xf3b2('0x81')]['toUpperCase']()+']\x20Integration\x20account\x20type\x20%s.',_0x2423f8[_0xf3b2('0x41')]);})['catch'](function(_0x3d99b0){logger[_0xf3b2('0x72')]('['+_0x161c7d[_0xf3b2('0x81')][_0xf3b2('0x82')]()+']',_0x3d99b0);});}; \ No newline at end of file +var _0x28cb=['socket.io-emitter','emit','Subjects','Descriptions','Task','ActivityDate','utc','IsRecurrence','endUserType','lead','account','WhatId','ticketType','Case','ContactId','AccountId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','find','length','Email','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','then','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','$or','Contact','execute','additionalSearchLead','merge','Lead','additionalSearchAccount','Account','contact','first','attributes','type','toLowerCase','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','format','Caller\x20-\x20%s','LastName','','Company','No\x20Company','upperFirst','forEach','includes','string','picklist','idField','content','toString','variable','variableName','Variable','name','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','calleridname','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname','destcalleridnum','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','monitor_format','lastevent','calleridnum',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','toUpperCase','lodash','moment','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost'];(function(_0x28125e,_0x1124f9){var _0x25fb7b=function(_0x5d170c){while(--_0x5d170c){_0x28125e['push'](_0x28125e['shift']());}};_0x25fb7b(++_0x1124f9);}(_0x28cb,0x17e));var _0xb28c=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x28cb[_0x1d9aa0];return _0x226868;};'use strict';var _=require(_0xb28c('0x0'));var rp=require('request-promise');var moment=require(_0xb28c('0x1'));var BPromise=require('bluebird');var md5=require('md5');var jsforce=require('jsforce');var util=require(_0xb28c('0x2'));var Redis=require(_0xb28c('0x3'));var intUtil=require(_0xb28c('0x4'));var config=require(_0xb28c('0x5'));var logger=require(_0xb28c('0x6'))(_0xb28c('0x7'));config[_0xb28c('0x8')]=_[_0xb28c('0x9')](config[_0xb28c('0x8')],{'host':_0xb28c('0xa'),'port':0x18eb});var io=require(_0xb28c('0xb'))(new Redis(config['redis']));function emit(_0x5eabe2,_0x4eb4ea,_0x4b048c){io['to'](_0x5eabe2)[_0xb28c('0xc')](_0x4eb4ea,_0x4b048c);}function getTicket(_0x329cc0,_0x46b240,_0x15e39a,_0x519de5,_0x31bc9f,_0xb23943,_0x2d385f,_0x61f6eb){var _0x527a0b=Object['assign']({},{'OwnerId':_0x46b240['id'],'Subject':intUtil['getString'](_0x519de5[_0xb28c('0xd')],_0x31bc9f,'\x20'),'Description':intUtil['getString'](_0x519de5[_0xb28c('0xe')],_0x31bc9f,'\x0a')},getCustomFields(_0xb23943,_0x31bc9f));if(_0x15e39a){if(_0x519de5['ticketType']===_0xb28c('0xf')){_0x527a0b[_0xb28c('0x10')]=moment[_0xb28c('0x11')]();_0x527a0b['IsReminderSet']=![];_0x527a0b[_0xb28c('0x12')]=![];if(_0x15e39a[_0xb28c('0x13')]==='contact'||_0x15e39a[_0xb28c('0x13')]===_0xb28c('0x14')){_0x527a0b['WhoId']=_0x15e39a['id'];}else if(_0x15e39a[_0xb28c('0x13')]===_0xb28c('0x15')){_0x527a0b[_0xb28c('0x16')]=_0x15e39a['id'];}}else if(_0x519de5[_0xb28c('0x17')]===_0xb28c('0x18')){if(_0x15e39a[_0xb28c('0x13')]==='contact'){_0x527a0b[_0xb28c('0x19')]=_0x15e39a['id'];}else if(_0x15e39a[_0xb28c('0x13')]===_0xb28c('0x15')){_0x527a0b[_0xb28c('0x1a')]=_0x15e39a['id'];}else if(_0x15e39a[_0xb28c('0x13')]===_0xb28c('0x14')&&_0x519de5['leadId']){_0x527a0b[_0x519de5['leadId']]=_0x15e39a['id'];}else{logger[_0xb28c('0x1b')](_0xb28c('0x1c'));}}}return _0x2d385f[_0xb28c('0x1d')](_0x519de5['ticketType'])[_0xb28c('0x1e')](_0x527a0b);}function getUser(_0x33690e,_0x252563,_0x4aac9f){if(!_[_0xb28c('0x1f')](_0x252563)&&intUtil[_0xb28c('0x20')](_0x252563)){var _0x5d8015={'Email':_0x252563};var _0x4567b7={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x4aac9f[_0xb28c('0x1d')](_0xb28c('0x21'))[_0xb28c('0x22')](_0x5d8015,_0x4567b7)['execute']()['then'](function(_0x20519c){if(_0x20519c[_0xb28c('0x23')]){var _0x35f788=_[_0xb28c('0x22')](_0x20519c,function(_0x31e54f){return _0x31e54f[_0xb28c('0x24')]===_0x252563;});if(_0x35f788){logger[_0xb28c('0x1b')](_0xb28c('0x25'),_0x252563);return BPromise[_0xb28c('0x26')]({'id':_0x35f788['Id'],'name':_0x35f788[_0xb28c('0x27')]});}}else{logger[_0xb28c('0x1b')](_0xb28c('0x28'),_0x252563);return _0x4aac9f[_0xb28c('0x29')]()[_0xb28c('0x2a')](function(_0x3f941d){return BPromise[_0xb28c('0x26')]({'id':_0x3f941d[_0xb28c('0x2b')],'name':_0x3f941d[_0xb28c('0x2c')]});});}});}else{logger[_0xb28c('0x1b')](_0xb28c('0x28'),_0x252563);return _0x4aac9f['identity']()[_0xb28c('0x2a')](function(_0x1f9d9f){return BPromise[_0xb28c('0x26')]({'id':_0x1f9d9f['user_id'],'name':_0x1f9d9f[_0xb28c('0x2c')]});});}}function getEndUser(_0x104106,_0xbe748b,_0x53f6de,_0x2b019e,_0x371624){var _0xd4f0bc={'$or':{'Phone':_0x2b019e}};var _0x4db699={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xb28c('0x26')]()[_0xb28c('0x2a')](function(){logger[_0xb28c('0x1b')](_0xb28c('0x2d'),_0x2b019e,_0xbe748b[_0xb28c('0x2e')]);switch(_0xbe748b[_0xb28c('0x2e')]){case _0xb28c('0x2f'):var _0x14d38f=_[_0xb28c('0x30')](_0xd4f0bc);if(_0xbe748b[_0xb28c('0x31')]){var _0x50e22d={};_0x50e22d[_0xbe748b['additionalSearchContact']]=_0x2b019e;_['merge'](_0x14d38f[_0xb28c('0x32')],_0x50e22d);}return _0x371624[_0xb28c('0x1d')](_0xb28c('0x33'))[_0xb28c('0x22')](_0x14d38f,_0x4db699)[_0xb28c('0x34')]()[_0xb28c('0x2a')](function(_0x4a2207){if(_0x4a2207&&_0x4a2207[_0xb28c('0x23')]){return _0x4a2207;}else{var _0x2e6f9f=_['cloneDeep'](_0xd4f0bc);if(_0xbe748b[_0xb28c('0x35')]){var _0x19abd3={};_0x19abd3[_0xbe748b[_0xb28c('0x35')]]=_0x2b019e;_[_0xb28c('0x36')](_0x2e6f9f[_0xb28c('0x32')],_0x19abd3);}return _0x371624[_0xb28c('0x1d')](_0xb28c('0x37'))[_0xb28c('0x22')](_0x2e6f9f,_0x4db699);}});case'account_contact_lead':var _0x23912c=_[_0xb28c('0x30')](_0xd4f0bc);if(_0xbe748b[_0xb28c('0x38')]){var _0x50e22d={};_0x50e22d[_0xbe748b[_0xb28c('0x38')]]=_0x2b019e;_[_0xb28c('0x36')](_0x23912c[_0xb28c('0x32')],_0x50e22d);}return _0x371624[_0xb28c('0x1d')](_0xb28c('0x39'))[_0xb28c('0x22')](_0x23912c,_0x4db699)[_0xb28c('0x34')]()[_0xb28c('0x2a')](function(_0x2becf2){if(_0x2becf2&&_0x2becf2[_0xb28c('0x23')]){return _0x2becf2;}else{var _0x897d33=_[_0xb28c('0x30')](_0xd4f0bc);if(_0xbe748b[_0xb28c('0x31')]){var _0x231738={};_0x231738[_0xbe748b[_0xb28c('0x31')]]=_0x2b019e;_['merge'](_0x897d33[_0xb28c('0x32')],_0x231738);}return _0x371624[_0xb28c('0x1d')](_0xb28c('0x33'))[_0xb28c('0x22')](_0x897d33,_0x4db699)[_0xb28c('0x2a')](function(_0x547406){if(_0x547406&&_0x547406[_0xb28c('0x23')]){return _0x547406;}else{var _0x5e9aac=_[_0xb28c('0x30')](_0xd4f0bc);if(_0xbe748b[_0xb28c('0x35')]){var _0x5ae91f={};_0x5ae91f[_0xbe748b[_0xb28c('0x35')]]=_0x2b019e;_['merge'](_0x5e9aac[_0xb28c('0x32')],_0x5ae91f);}return _0x371624[_0xb28c('0x1d')]('Lead')[_0xb28c('0x22')](_0x5e9aac,_0x4db699);}});}});case _0xb28c('0x3a'):var _0x14d38f=_['cloneDeep'](_0xd4f0bc);if(_0xbe748b['additionalSearchContact']){var _0x50e22d={};_0x50e22d[_0xbe748b['additionalSearchContact']]=_0x2b019e;_[_0xb28c('0x36')](_0x14d38f[_0xb28c('0x32')],_0x50e22d);}return _0x371624[_0xb28c('0x1d')](_0xb28c('0x33'))[_0xb28c('0x22')](_0x14d38f,_0x4db699)['execute']();case _0xb28c('0x14'):var _0x267c14=_['cloneDeep'](_0xd4f0bc);if(_0xbe748b[_0xb28c('0x35')]){var _0x50e22d={};_0x50e22d[_0xbe748b['additionalSearchLead']]=_0x2b019e;_[_0xb28c('0x36')](_0x267c14[_0xb28c('0x32')],_0x50e22d);}return _0x371624[_0xb28c('0x1d')](_0xb28c('0x37'))[_0xb28c('0x22')](_0x267c14,_0x4db699);case _0xb28c('0x15'):var _0x23912c=_['cloneDeep'](_0xd4f0bc);if(_0xbe748b[_0xb28c('0x38')]){var _0x50e22d={};_0x50e22d[_0xbe748b[_0xb28c('0x38')]]=_0x2b019e;_[_0xb28c('0x36')](_0x23912c['$or'],_0x50e22d);}return _0x371624[_0xb28c('0x1d')]('Account')[_0xb28c('0x22')](_0x23912c,_0x4db699);default:return null;}})[_0xb28c('0x2a')](function(_0x4ab39c){if(_0x4ab39c&&_0x4ab39c[_0xb28c('0x23')]){var _0x5c199f=_[_0xb28c('0x3b')](_0x4ab39c);if(_0x5c199f){return BPromise['resolve']({'id':_0x5c199f['Id'],'name':_0x5c199f[_0xb28c('0x27')],'phone':_0x5c199f['Phone'],'endUserType':_0x5c199f[_0xb28c('0x3c')][_0xb28c('0x3d')][_0xb28c('0x3e')]()});}}})[_0xb28c('0x2a')](function(_0x43f211){if(_0x43f211){logger[_0xb28c('0x1b')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x43f211[_0xb28c('0x13')],_0x2b019e);return BPromise['resolve'](_0x43f211);}else{logger[_0xb28c('0x1b')](_0xb28c('0x3f'),_0x2b019e);var _0x410f2d={'Phone':_0x2b019e};if(_0xbe748b['moduleCreate']){if(_0xbe748b[_0xb28c('0x40')]===_0xb28c('0x3a')){logger[_0xb28c('0x1b')](_0xb28c('0x41'),_0x2b019e,_0xbe748b[_0xb28c('0x40')]);_0x410f2d['LastName']=_0x53f6de!==''?_0x53f6de:util[_0xb28c('0x42')](_0xb28c('0x43'),_0x2b019e);}else if(_0xbe748b[_0xb28c('0x40')]===_0xb28c('0x14')){logger[_0xb28c('0x1b')](_0xb28c('0x41'),_0x2b019e,_0xbe748b[_0xb28c('0x40')]);_0x410f2d[_0xb28c('0x44')]=_0x53f6de!==_0xb28c('0x45')?_0x53f6de:util[_0xb28c('0x42')](_0xb28c('0x43'),_0x2b019e);_0x410f2d[_0xb28c('0x46')]=_0xb28c('0x47');}else if(_0xbe748b[_0xb28c('0x40')]===_0xb28c('0x15')){logger[_0xb28c('0x1b')](_0xb28c('0x41'),_0x2b019e,_0xbe748b[_0xb28c('0x40')]);_0x410f2d[_0xb28c('0x27')]=_0x53f6de!==_0xb28c('0x45')?_0x53f6de:util[_0xb28c('0x42')](_0xb28c('0x43'),_0x2b019e);}else{return null;}}return _0x371624['sobject'](_[_0xb28c('0x48')](_0xbe748b['moduleCreate']))[_0xb28c('0x1e')](_0x410f2d)[_0xb28c('0x2a')](function(_0x35cc0){return BPromise[_0xb28c('0x26')]({'id':_0x35cc0['id'],'endUserType':_0xbe748b[_0xb28c('0x40')]});});}});}function getCustomFields(_0x47c0c7,_0x35f98d){var _0x3beee4={};if(_0x47c0c7[_0xb28c('0x23')]>0x0){_[_0xb28c('0x49')](_0x47c0c7,function(_0x22f749){if(_[_0xb28c('0x4a')]([_0xb28c('0x4b'),_0xb28c('0x4c')],_0x22f749['type'])&&_0x22f749[_0xb28c('0x4d')]){_0x3beee4[_0x22f749[_0xb28c('0x4d')]]=_0x22f749[_0xb28c('0x4e')][_0xb28c('0x4f')]();}else if(_0x22f749[_0xb28c('0x3d')]===_0xb28c('0x50')&&_0x22f749[_0xb28c('0x51')]&&_0x22f749[_0xb28c('0x4d')]){_0x35f98d[_0x22f749[_0xb28c('0x51')]]&&(_0x3beee4[_0x22f749['idField']]=_0x35f98d[_0x22f749[_0xb28c('0x51')]][_0xb28c('0x4f')]());}else if(_0x22f749[_0xb28c('0x3d')]==='customVariable'&&_0x22f749[_0xb28c('0x52')]&&_0x22f749[_0xb28c('0x52')][_0xb28c('0x53')]&&_0x22f749[_0xb28c('0x4d')]){_0x35f98d[_0x22f749[_0xb28c('0x52')][_0xb28c('0x53')][_0xb28c('0x3e')]()]&&(_0x3beee4[_0x22f749[_0xb28c('0x4d')]]=_0x35f98d[_0x22f749[_0xb28c('0x52')][_0xb28c('0x53')][_0xb28c('0x3e')]()][_0xb28c('0x4f')]());}});}return _0x3beee4;}function getConnection(_0xec0ce1){var _0x29e7f2=_0xec0ce1['password'][_0xb28c('0x54')](_0xec0ce1[_0xb28c('0x55')]);var _0x1b881a=new jsforce[(_0xb28c('0x56'))]({'oauth2':{'loginUrl':_0xec0ce1[_0xb28c('0x57')]||_0xb28c('0x58'),'clientId':_0xec0ce1[_0xb28c('0x59')],'clientSecret':_0xec0ce1['clientSecret']}});return _0x1b881a[_0xb28c('0x5a')](_0xec0ce1[_0xb28c('0x5b')],_0x29e7f2)[_0xb28c('0x2a')](function(){logger[_0xb28c('0x1b')](_0xb28c('0x5c'));return _0x1b881a;});}exports[_0xb28c('0x5d')]=function(_0x202fe7,_0x528043,_0x33b6aa,_0x57ff9c,_0x8dc54d,_0x4899fb){var _0x17ecf8,_0x36023c,_0xa0ef9c,_0x53599d;_0x4899fb[_0xb28c('0x5e')]=intUtil[_0xb28c('0x5f')](_0x4899fb[_0xb28c('0x5e')]);_0x4899fb[_0xb28c('0x57')]=intUtil[_0xb28c('0x5f')](_0x4899fb[_0xb28c('0x57')]);if(_0x8dc54d&&_0x8dc54d['monitor_format']){logger[_0xb28c('0x1b')](_0xb28c('0x60'),_0xb28c('0x61'));_0x528043[_0xb28c('0x62')]=util[_0xb28c('0x42')](_0xb28c('0x63'),_0x4899fb[_0xb28c('0x5e')],_0x528043['uniqueid'],md5(_0x528043['uniqueid']));}else{_0x528043['recordingURL']='';}return getConnection(_0x4899fb)[_0xb28c('0x2a')](function(_0x3170dc){_0x53599d=_0x3170dc;return getUser(_0x4899fb,_0x57ff9c[_0xb28c('0x64')],_0x53599d);})['then'](function(_0x325d52){_0x17ecf8=_0x325d52;return getEndUser(_0x4899fb,_0x33b6aa,_0x528043[_0xb28c('0x65')],_0x528043['calleridnum'],_0x53599d);})['then'](function(_0x35db50){_0x36023c=_0x35db50;return getTicket(_0x4899fb,_0x17ecf8,_0x36023c,_0x33b6aa,_0x528043,_0x33b6aa[_0xb28c('0x66')],_0x53599d,_0xb28c('0x5d'));})[_0xb28c('0x2a')](function(_0x517804){_0xa0ef9c=_0x517804;logger[_0xb28c('0x1b')](_0xb28c('0x67'),_0xa0ef9c['id']);logger[_0xb28c('0x1b')](_0xb28c('0x68'),_0xa0ef9c['id'],_0x57ff9c['name'],_0x4899fb[_0xb28c('0x3d')]);switch(_0x4899fb[_0xb28c('0x3d')]){case _0xb28c('0x69'):emit(util[_0xb28c('0x42')](_0xb28c('0x6a'),_0x57ff9c[_0xb28c('0x53')]),_0xb28c('0x6b'),{'recordId':_0xa0ef9c['id']});break;case _0xb28c('0x6c'):emit(util[_0xb28c('0x42')](_0xb28c('0x6a'),_0x57ff9c[_0xb28c('0x53')]),_0xb28c('0x6d'),{'uri':util[_0xb28c('0x42')](_0xb28c('0x6e'),_0x53599d[_0xb28c('0x6f')],_0xa0ef9c['id'])});break;default:logger[_0xb28c('0x70')](_0xb28c('0x71'));}})[_0xb28c('0x72')](function(_0x1eaec6){logger[_0xb28c('0x70')]('[QUEUE]',_0x1eaec6);});};exports[_0xb28c('0x73')]=function(_0xdc9143,_0x4ea1db,_0x18edf6,_0x1d1a95,_0x534f23,_0x270ee7,_0x50140e){var _0x16062b,_0x226c5f,_0x25a568,_0x194f69;_0x270ee7[_0xb28c('0x5e')]=intUtil[_0xb28c('0x5f')](_0x270ee7[_0xb28c('0x5e')]);_0x270ee7[_0xb28c('0x57')]=intUtil[_0xb28c('0x5f')](_0x270ee7[_0xb28c('0x57')]);if(_0x50140e&&_0x50140e['recordingFormat']&&_0x50140e[_0xb28c('0x74')]!==_0xb28c('0x75')){logger[_0xb28c('0x1b')](_0xb28c('0x76'),'Recording\x20is\x20enabled!');_0x4ea1db[_0xb28c('0x62')]=util[_0xb28c('0x42')](_0xb28c('0x63'),_0x270ee7[_0xb28c('0x5e')],_0x4ea1db['uniqueid'],md5(_0x4ea1db[_0xb28c('0x77')]));}return getConnection(_0x270ee7)[_0xb28c('0x2a')](function(_0xdad214){_0x194f69=_0xdad214;return getUser(_0x270ee7,_0x1d1a95[_0xb28c('0x64')],_0x194f69);})[_0xb28c('0x2a')](function(_0x2efee7){_0x16062b=_0x2efee7;return getEndUser(_0x270ee7,_0x18edf6,_0x4ea1db[_0xb28c('0x78')],_0x4ea1db[_0xb28c('0x79')],_0x194f69);})[_0xb28c('0x2a')](function(_0x55b514){_0x226c5f=_0x55b514;return getTicket(_0x270ee7,_0x16062b,_0x226c5f,_0x18edf6,_0x4ea1db,_0x18edf6[_0xb28c('0x66')],_0x194f69,_0xb28c('0x73'));})['then'](function(_0x508fba){_0x25a568=_0x508fba;logger[_0xb28c('0x1b')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x25a568['id']);logger['info'](_0xb28c('0x7a'),_0x25a568['id'],_0x1d1a95[_0xb28c('0x53')],_0x270ee7[_0xb28c('0x3d')]);switch(_0x270ee7[_0xb28c('0x3d')]){case'integrationTab':emit(util[_0xb28c('0x42')]('user:%s',_0x1d1a95[_0xb28c('0x53')]),_0xb28c('0x6b'),{'recordId':_0x25a568['id']});break;case _0xb28c('0x6c'):emit(util[_0xb28c('0x42')](_0xb28c('0x6a'),_0x1d1a95[_0xb28c('0x53')]),_0xb28c('0x6d'),{'uri':util[_0xb28c('0x42')]('%s/%s/e',_0x194f69[_0xb28c('0x6f')],_0x25a568['id'])});break;default:logger[_0xb28c('0x70')]('[OUTBOUND]',_0xb28c('0x7b'));}})[_0xb28c('0x72')](function(_0x3cb9cd){logger[_0xb28c('0x70')](_0xb28c('0x76'),_0x3cb9cd);});};exports[_0xb28c('0x7c')]=function(_0x393726,_0x306daa,_0x55c81d,_0xdb7422,_0x23be46,_0x4046dc){var _0x446a35,_0x382c30,_0x18052e,_0x1c4d95;_0x4046dc[_0xb28c('0x5e')]=intUtil[_0xb28c('0x5f')](_0x4046dc[_0xb28c('0x5e')]);_0x4046dc['remoteUri']=intUtil['stripTrailingSlash'](_0x4046dc[_0xb28c('0x57')]);if(_0x23be46&&_0x23be46[_0xb28c('0x7d')]){logger[_0xb28c('0x1b')]('['+_0x306daa[_0xb28c('0x7e')]['toUpperCase']()+']',_0xb28c('0x61'));_0x306daa[_0xb28c('0x62')]=util[_0xb28c('0x42')](_0xb28c('0x63'),_0x4046dc[_0xb28c('0x5e')],_0x306daa['uniqueid'],md5(_0x306daa[_0xb28c('0x77')]));}else{_0x306daa[_0xb28c('0x62')]='';}return getConnection(_0x4046dc)[_0xb28c('0x2a')](function(_0x2df308){_0x1c4d95=_0x2df308;if(!_[_0xb28c('0x1f')](_0xdb7422)){return getUser(_0x4046dc,_0xdb7422[_0xb28c('0x53')],_0x1c4d95);}else{return getUser(_0x4046dc,null,_0x1c4d95);}})[_0xb28c('0x2a')](function(_0x5503a0){_0x446a35=_0x5503a0;return getEndUser(_0x4046dc,_0x55c81d,_0x306daa[_0xb28c('0x65')],_0x306daa[_0xb28c('0x7f')],_0x1c4d95);})[_0xb28c('0x2a')](function(_0x4e7e73){_0x382c30=_0x4e7e73;return getTicket(_0x4046dc,_0x446a35,_0x382c30,_0x55c81d,_0x306daa,_0x55c81d[_0xb28c('0x66')],_0x1c4d95);})['then'](function(_0x3799b7){_0x18052e=_0x3799b7;logger[_0xb28c('0x1b')]('['+_0x306daa[_0xb28c('0x7e')]['toUpperCase']()+_0xb28c('0x80'),_0x18052e['id']);logger['info']('['+_0x306daa[_0xb28c('0x7e')]['toUpperCase']()+_0xb28c('0x81'),_0x4046dc[_0xb28c('0x3d')]);})['catch'](function(_0x13f97b){logger['error']('['+_0x306daa['lastevent'][_0xb28c('0x82')]()+']',_0x13f97b);});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/servicenow.js b/server/services/ami/trigger/integration/servicenow.js index 1a01bb5..541b5f5 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 _0x47dd=['emit','trigger:browser:url','password','sysparm_limit=1','sysparm_display_value=true','stripTrailingSlash','serverUrl','%s/api/now/table/','remoteUri','isNil','email','calleridnum','callDirection','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','bluebird','util','md5','ioredis','../../../../config/environment','../../../../config/logger','redis','localhost','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','GET','sys_user?sysparm_query=email%3D','true','userId',']\x20using\x20admin\x20profile','adminEmail','endUserNumber','user','endUserId','sys_id','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','picklist','type','nameField','toLowerCase','toString','customField','variable','variableName','customVariable','Variable','idField','name','outbound','assign','getString','Subjects','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','POST','label','?sysparm_query=name%3D','label_entry','Incident\x20-\x20','all','push','Tags','%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','user:%s'];(function(_0x498bd5,_0x26880d){var _0x2d586c=function(_0x4cdacb){while(--_0x4cdacb){_0x498bd5['push'](_0x498bd5['shift']());}};_0x2d586c(++_0x26880d);}(_0x47dd,0x1b2));var _0xd47d=function(_0x10d34b,_0x4fef76){_0x10d34b=_0x10d34b-0x0;var _0x92b0bf=_0x47dd[_0x10d34b];return _0x92b0bf;};'use strict';var _=require(_0xd47d('0x0'));var Promise=require(_0xd47d('0x1'));var rp=require('request-promise');var util=require(_0xd47d('0x2'));var md5=require(_0xd47d('0x3'));var Redis=require(_0xd47d('0x4'));var intUtil=require('./util');var config=require(_0xd47d('0x5'));var logger=require(_0xd47d('0x6'))('servicenow');config[_0xd47d('0x7')]=_['defaults'](config[_0xd47d('0x7')],{'host':_0xd47d('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAdminUser(_0x593b25,_0x1a52e1,_0x46d419,_0x37c2c6,_0x2e8d68,_0x353a72){return new Promise(function(_0x505c31,_0xec2b42){var _0x1b6499={'method':'GET','uri':_0x37c2c6+_0xd47d('0x9')+'&'+_0x2e8d68+'&'+_0x353a72,'auth':_0x1a52e1,'json':!![]};return rp(_0x1b6499)[_0xd47d('0xa')](function(_0x574082){if(_0x574082[_0xd47d('0xb')][_0xd47d('0xc')]>0x0){_0x46d419[_0xd47d('0xd')]=_0x574082[_0xd47d('0xb')][0x0]['sys_id'];}logger[_0xd47d('0xe')]('['+[_0x593b25[_0xd47d('0xf')]()]+_0xd47d('0x10'),_0x46d419);_0x505c31(_0x46d419);})[_0xd47d('0x11')](function(_0x2fccc1){logger[_0xd47d('0x12')]('['+[_0x593b25['toUpperCase']()]+']',_0x2fccc1[_0xd47d('0x13')]);_0xec2b42(_0x2fccc1['message']);});});}function getUser(_0x2f70dd,_0x163205,_0xe1f926,_0x5974b8,_0x5dcefd){return function(_0x5c688e){logger[_0xd47d('0xe')]('['+[_0x2f70dd['toUpperCase']()]+_0xd47d('0x14'),_0x5c688e);return new Promise(function(_0x8760b7,_0x2823fd){if(intUtil[_0xd47d('0x15')](_0x5c688e[_0xd47d('0x16')])){var _0x243255={'method':_0xd47d('0x17'),'uri':_0xe1f926+_0xd47d('0x18')+_0x5c688e[_0xd47d('0x16')]+'&'+_0x5974b8+'&'+_0x5dcefd,'auth':_0x163205,'json':!![]};logger[_0xd47d('0xe')]('['+[_0x2f70dd[_0xd47d('0xf')]()]+'],\x20getUser\x20rp\x20obj',_0x243255);return rp(_0x243255)['then'](function(_0x198b67){logger['info']('['+[_0x2f70dd[_0xd47d('0xf')]()]+'],\x20getUser\x20entity',_0x198b67);if(_0x198b67[_0xd47d('0xb')][_0xd47d('0xc')]>0x0&&String(_0x198b67[_0xd47d('0xb')][0x0]['active'])===_0xd47d('0x19')){_0x5c688e[_0xd47d('0x1a')]=_0x198b67['result'][0x0]['sys_id'];}else{_0x5c688e['userId']=_0x5c688e['adminId'];_0x5c688e[_0xd47d('0x16')]=_0x5c688e['adminEmail'];}logger[_0xd47d('0xe')]('['+[_0x2f70dd['toUpperCase']()]+'],\x20getUser\x20crm',_0x5c688e);_0x8760b7(_0x5c688e);})['catch'](function(_0x22ce1b){logger[_0xd47d('0x12')]('['+[_0x2f70dd[_0xd47d('0xf')]()]+']',_0x22ce1b[_0xd47d('0x13')]);_0x2823fd(_0x22ce1b[_0xd47d('0x13')]);});}else{logger['info']('['+[_0x2f70dd[_0xd47d('0xf')]()]+_0xd47d('0x1b'));_0x5c688e[_0xd47d('0x1a')]=_0x5c688e[_0xd47d('0xd')];_0x5c688e['userEmail']=_0x5c688e[_0xd47d('0x1c')];_0x8760b7(_0x5c688e);}});};}function createEndUser(_0x1ddcd8,_0x27afd9,_0x5eef77,_0x4b5a00,_0x4a73d7){logger['info']('['+[_0x1ddcd8[_0xd47d('0xf')]()]+'],\x20createEndUser\x20input\x20crm',_0x5eef77);return new Promise(function(_0x2a57ff,_0x25f4a0){var _0x4ae91c={'method':'POST','uri':_0x4b5a00+'sys_user?'+_0x4a73d7,'body':{'user_name':_0x5eef77[_0xd47d('0x1d')],'roles':_0xd47d('0x1e'),'first_name':_0x5eef77[_0xd47d('0x1d')],'active':_0xd47d('0x19'),'date_format':'System','phone':_0x5eef77[_0xd47d('0x1d')]},'auth':_0x27afd9,'json':!![]};return rp(_0x4ae91c)[_0xd47d('0xa')](function(_0x5988d2){logger[_0xd47d('0xe')]('['+[_0x1ddcd8['toUpperCase']()]+'],\x20EndUser\x20schema',_0x5988d2[_0xd47d('0xb')]);_0x5eef77[_0xd47d('0x1f')]=_0x5988d2[_0xd47d('0xb')][_0xd47d('0x20')];_0x2a57ff(_0x5eef77);})[_0xd47d('0x11')](function(_0x515e9a){logger['error']('['+[_0x1ddcd8['toUpperCase']()]+']',_0x515e9a[_0xd47d('0x13')]);_0x25f4a0(_0x515e9a['message']);});});}function getEndUser(_0x1ad516,_0x2377db,_0x1971df,_0x1d081c,_0x49a381){return function(_0x2d673f){logger[_0xd47d('0xe')]('['+[_0x1ad516[_0xd47d('0xf')]()]+_0xd47d('0x21'),_0x2d673f);return new Promise(function(_0x1a112a,_0x45e494){var _0x527342={'method':_0xd47d('0x17'),'uri':_0x1971df+_0xd47d('0x22')+_0x2d673f[_0xd47d('0x1d')]+'&'+_0x1d081c+'&'+_0x49a381,'auth':_0x2377db,'json':!![]};return rp(_0x527342)['then'](function(_0x277a1b){if(_0x277a1b[_0xd47d('0xb')][_0xd47d('0xc')]>0x0){_0x2d673f['endUserId']=_0x277a1b[_0xd47d('0xb')][0x0]['sys_id'];logger['info']('['+[_0x1ad516[_0xd47d('0xf')]()]+_0xd47d('0x23'),_0x2d673f);_0x1a112a(_0x2d673f);}else{return createEndUser(_0x1ad516,_0x2377db,_0x2d673f,_0x1971df,_0x1d081c)[_0xd47d('0xa')](function(_0x10d2af){logger[_0xd47d('0xe')]('['+[_0x1ad516['toUpperCase']()]+_0xd47d('0x24'),_0x10d2af);_0x1a112a(_0x10d2af);});}})['catch'](function(_0x47b347){logger[_0xd47d('0x12')]('['+[_0x1ad516[_0xd47d('0xf')]()]+']',_0x47b347[_0xd47d('0x13')]);_0x45e494(_0x47b347['message']);});});};}function getCustomFields(_0x2bcf8b,_0x59ccce){var _0x749c75={};if(_0x2bcf8b[_0xd47d('0xc')]>0x0){_[_0xd47d('0x25')](_0x2bcf8b,function(_0x2aa3f7){if(_[_0xd47d('0x26')](['string',_0xd47d('0x27')],_0x2aa3f7[_0xd47d('0x28')])&&_0x2aa3f7[_0xd47d('0x29')]&&!_0x2aa3f7['customField']){_0x749c75[_0x2aa3f7[_0xd47d('0x29')][_0xd47d('0x2a')]()]=_0x2aa3f7['content'][_0xd47d('0x2b')]();}else if(_[_0xd47d('0x26')](['string',_0xd47d('0x27')],_0x2aa3f7[_0xd47d('0x28')])&&_0x2aa3f7['idField']&&_0x2aa3f7[_0xd47d('0x2c')]){_0x749c75[_0x2aa3f7['idField']['toLowerCase']()]=_0x2aa3f7['content'][_0xd47d('0x2b')]();}else if(_0x2aa3f7[_0xd47d('0x28')]===_0xd47d('0x2d')&&_0x2aa3f7[_0xd47d('0x2e')]&&_0x2aa3f7['idField']&&_0x2aa3f7[_0xd47d('0x2c')]){_0x749c75[_0x2aa3f7['idField']['toLowerCase']()]=_0x59ccce[_0x2aa3f7[_0xd47d('0x2e')]][_0xd47d('0x2b')]();}else if(_0x2aa3f7[_0xd47d('0x28')]===_0xd47d('0x2f')&&_0x2aa3f7[_0xd47d('0x30')]&&_0x2aa3f7[_0xd47d('0x30')]['name']&&_0x2aa3f7['idField']&&_0x2aa3f7['customField']){_0x749c75[_0x2aa3f7[_0xd47d('0x31')][_0xd47d('0x2a')]()]=_0x59ccce[_0x2aa3f7[_0xd47d('0x30')][_0xd47d('0x32')][_0xd47d('0x2a')]()][_0xd47d('0x2b')]();}});}return _0x749c75;}function getTicket(_0x1aa436,_0x5f4d46,_0xbd1d51,_0x3a39a5,_0x5926a9,_0x1e6a8c){return function(_0x19d6ac){logger[_0xd47d('0xe')]('['+[_0x1aa436[_0xd47d('0xf')]()]+']\x20getTicket\x20input\x20crm',_0x19d6ac);return new Promise(function(_0x123e70,_0x84aa64){var _0x5e9b63=_0x1aa436[_0xd47d('0x2a')]()===_0xd47d('0x33')?_0x19d6ac[_0xd47d('0x1a')]:_0x19d6ac[_0xd47d('0x1f')];var _0x4fbd5a={'method':'POST','uri':_0xbd1d51+'incident'+'?'+_0x1e6a8c,'body':Object[_0xd47d('0x34')]({},{'active':_0xd47d('0x19'),'caller_id':_0x5e9b63,'assigned_to':_0x19d6ac[_0xd47d('0x1a')],'short_description':intUtil[_0xd47d('0x35')](_0x3a39a5[_0xd47d('0x36')],_0x5926a9,'\x20'),'description':intUtil[_0xd47d('0x35')](_0x3a39a5[_0xd47d('0x37')],_0x5926a9,'\x0a')},getCustomFields(_0x3a39a5['Fields'],_0x5926a9)),'auth':_0x5f4d46,'json':!![]};return rp(_0x4fbd5a)[_0xd47d('0xa')](function(_0x15eaf0){logger[_0xd47d('0xe')]('['+[_0x1aa436[_0xd47d('0xf')]()]+_0xd47d('0x38'),_0x15eaf0[_0xd47d('0xb')]);_0x19d6ac[_0xd47d('0x39')]=_0x15eaf0['result'][_0xd47d('0x20')];_0x19d6ac[_0xd47d('0x3a')]=_0x15eaf0[_0xd47d('0xb')][_0xd47d('0x3b')];logger[_0xd47d('0xe')]('['+[_0x1aa436[_0xd47d('0xf')]()]+_0xd47d('0x3c'),_0x19d6ac);_0x123e70(_0x19d6ac);})['catch'](function(_0x43521d){logger[_0xd47d('0x12')]('['+[_0x1aa436[_0xd47d('0xf')]()]+']',_0x43521d[_0xd47d('0x13')]);_0x84aa64(_0x43521d[_0xd47d('0x13')]);});});};}function createRemoteTag(_0x9b4989,_0x2e21bd,_0x44e157,_0x237500){return new Promise(function(_0xa32c1f,_0x1ed8d5){var _0x3d7af4={'method':_0xd47d('0x3d'),'uri':_0x44e157+_0xd47d('0x3e')+'?'+_0x237500,'body':{'short_description':_0x9b4989,'global':!![],'active':!![],'name':_0x9b4989},'auth':_0x2e21bd,'json':!![]};return rp(_0x3d7af4)[_0xd47d('0xa')](function(_0x58c911){var _0x14e2ab=_0x58c911[_0xd47d('0xb')][_0xd47d('0x20')];_0xa32c1f(_0x14e2ab);});});}function getRemoteTag(_0x1fd2c7,_0x3e94a0,_0x247a2e,_0x2d4a24,_0x364170){return new Promise(function(_0x13dd51,_0x4c21a8){var _0x23cffc={'method':_0xd47d('0x17'),'uri':_0x247a2e+'label'+_0xd47d('0x3f')+_0x1fd2c7+'&'+_0x2d4a24,'auth':_0x3e94a0,'json':!![]};return rp(_0x23cffc)[_0xd47d('0xa')](function(_0x23ce06){if(_0x23ce06[_0xd47d('0xb')][_0xd47d('0xc')]>0x0){var _0x51a2be=_0x23ce06[_0xd47d('0xb')][0x0][_0xd47d('0x20')];_0x13dd51(_0x51a2be);}else{return createRemoteTag(_0x1fd2c7,_0x3e94a0,_0x247a2e,_0x2d4a24)[_0xd47d('0xa')](function(_0x2de14a){_0x13dd51(_0x2de14a);});}});});}function assignTagToIncident(_0x56d00a,_0x538851,_0x50a1c3,_0x340f98,_0x43bc9a){return new Promise(function(_0x5367e5,_0x4bfe4b){var _0xcfc49b={'method':_0xd47d('0x3d'),'uri':_0x50a1c3+_0xd47d('0x40')+'?'+_0x43bc9a,'body':{'label':_0x56d00a,'table':'incident','id_type':'Incident','table_key':_0x340f98[_0xd47d('0x39')],'title':_0xd47d('0x41')+_0x340f98[_0xd47d('0x3a')],'id_display':_0x340f98[_0xd47d('0x3a')]},'auth':_0x538851,'json':!![]};return rp(_0xcfc49b)[_0xd47d('0xa')](function(_0x429260){_0x5367e5();})['catch'](function(){_0x5367e5();});});}function manageTags(_0xbf54ae,_0x5be035,_0x2cd55c,_0x27d26c,_0xec1bdb,_0x46fba2,_0x6b8a49){return new Promise(function(_0x4fec8a,_0x3d7b01){var _0x1fabde=[];_0x5be035[_0xd47d('0x25')](function(_0x17b1ad){_0x1fabde['push'](getRemoteTag(_0x17b1ad,_0x2cd55c,_0x27d26c,_0x46fba2,_0x6b8a49));});return Promise[_0xd47d('0x42')](_0x1fabde)[_0xd47d('0xa')](function(_0x3d427a){if(_0x3d427a[_0xd47d('0xc')]){logger[_0xd47d('0xe')]('['+[_0xbf54ae[_0xd47d('0xf')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x3d427a);var _0xb8285=[];_0x3d427a[_0xd47d('0x25')](function(_0x548bc4){_0xb8285[_0xd47d('0x43')](assignTagToIncident(_0x548bc4,_0x2cd55c,_0x27d26c,_0xec1bdb,_0x46fba2));});return Promise[_0xd47d('0x42')](_0xb8285)[_0xd47d('0xa')](function(){_0x4fec8a();})['catch'](function(){_0x4fec8a();});}else{_0x4fec8a();}});});}function getTags(_0x11af30,_0x3a8dde,_0x1e103d,_0x445d86,_0x20cf07,_0x451c94){return function(_0x35cccc){return new Promise(function(_0x53b461,_0x39c93e){var _0x464c02=[];var _0x375acb=_0x445d86[_0xd47d('0x44')];if(_0x375acb&&_0x375acb['length']>0x0){_0x464c02=_['map'](_0x375acb,_0xd47d('0x32'));}if(_0x464c02['length']>0x0){return manageTags(_0x11af30,_0x464c02,_0x3a8dde,_0x1e103d,_0x35cccc,_0x20cf07,_0x451c94)[_0xd47d('0xa')](function(){_0x53b461(_0x35cccc);});}else{_0x53b461(_0x35cccc);}});};}function emit(_0x3f6c2e,_0x59d9a5,_0x4c0530){var _0x357f37=_0xd47d('0x45')+_0xd47d('0x46')+_0xd47d('0x47')+_0xd47d('0x48');var _0x48d715={'uri':_0x3f6c2e+_0xd47d('0x49')+_0x4c0530+_0x357f37};io['to'](util[_0xd47d('0x4a')](_0xd47d('0x4b'),_0x59d9a5))[_0xd47d('0x4c')](_0xd47d('0x4d'),_0x48d715);}exports['cs']=function(_0x6b113,_0x5bf7ae,_0x4404e7,_0x4c0aa6,_0x2a15d5,_0x2c1967,_0x442ada,_0x142933){var _0xf54825={};var _0x2479af={'user':_0x2c1967['username'],'pass':_0x2c1967[_0xd47d('0x4e')]};var _0x258294=_0xd47d('0x4f');var _0x5308a0=_0xd47d('0x50');_0x2c1967['remoteUri']=intUtil[_0xd47d('0x51')](_0x2c1967['remoteUri']);_0x2c1967[_0xd47d('0x52')]=intUtil[_0xd47d('0x51')](_0x2c1967[_0xd47d('0x52')]);var _0x5ce784=util['format'](_0xd47d('0x53'),_0x2c1967[_0xd47d('0x54')]);_0xf54825[_0xd47d('0x16')]=!_[_0xd47d('0x55')](_0x4c0aa6)?_0x4c0aa6['email']:null;_0xf54825['adminEmail']=_0x2c1967[_0xd47d('0x56')];_0xf54825['endUserNumber']=_0x142933[_0xd47d('0x2a')]()==='outbound'?_0x5bf7ae['destcalleridnum']:_0x5bf7ae[_0xd47d('0x57')];_0xf54825[_0xd47d('0x58')]=_0x142933==='queue'||_0x142933===_0xd47d('0x59')?'queue':_0xd47d('0x33');var _0x2aca4f=util[_0xd47d('0x4a')](_0xd47d('0x5a'),_0x2c1967['serverUrl'],_0x5bf7ae['uniqueid'],md5(_0x5bf7ae[_0xd47d('0x5b')]));if(_0x2a15d5&&_0x2a15d5[_0xd47d('0x5c')]){logger['info'](_0xd47d('0x5d'),_0xd47d('0x5e'));_0x5bf7ae[_0xd47d('0x5f')]=_0x2aca4f;}else if(_0x442ada&&_0x442ada[_0xd47d('0x60')]&&_0x442ada[_0xd47d('0x60')]!==_0xd47d('0x61')){logger[_0xd47d('0xe')](_0xd47d('0x62'),'Recording\x20is\x20enabled!');_0x5bf7ae[_0xd47d('0x5f')]=_0x2aca4f;}else{_0x5bf7ae[_0xd47d('0x5f')]='';}return getAdminUser(_0x142933,_0x2479af,_0xf54825,_0x5ce784,_0x5308a0,_0x258294)[_0xd47d('0xa')](getUser(_0x142933,_0x2479af,_0x5ce784,_0x5308a0,_0x258294))[_0xd47d('0xa')](getEndUser(_0x142933,_0x2479af,_0x5ce784,_0x5308a0,_0x258294))[_0xd47d('0xa')](getTicket(_0x142933,_0x2479af,_0x5ce784,_0x4404e7,_0x5bf7ae,_0x5308a0))[_0xd47d('0xa')](function(_0x21083a){logger[_0xd47d('0xe')](util[_0xd47d('0x4a')](_0xd47d('0x63'),_0x21083a['ticketId']));logger[_0xd47d('0xe')](util[_0xd47d('0x4a')]('call\x20direction:\x20%s',_0x142933));if(_0x142933!==_0xd47d('0x59')){logger['info']('['+[_0x142933[_0xd47d('0xf')]()]+']',_0xd47d('0x64'));emit(_0x2c1967[_0xd47d('0x54')],_0x4c0aa6[_0xd47d('0x32')],_0x21083a[_0xd47d('0x39')]);}})[_0xd47d('0x11')](function(_0x24717e){logger[_0xd47d('0x12')]('['+[_0x142933[_0xd47d('0xf')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0xd47d('0x65')](_0x24717e,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xeb56=['variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','ticketNumber','forEach','push',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','destcalleridnum','calleridnum','queue','unmanaged','uniqueid','monitor_format','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','localhost','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','],\x20getAdminUser\x20crm','catch','error','message','info','toUpperCase','validateEmail','userEmail','GET','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','user','true','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','includes','string','picklist','customField','nameField','content','type','idField','toLowerCase','toString'];(function(_0x22d3eb,_0x4f872b){var _0x1867b8=function(_0x295bcc){while(--_0x295bcc){_0x22d3eb['push'](_0x22d3eb['shift']());}};_0x1867b8(++_0x4f872b);}(_0xeb56,0x17d));var _0x6eb5=function(_0x456bd2,_0x156c79){_0x456bd2=_0x456bd2-0x0;var _0x2218c1=_0xeb56[_0x456bd2];return _0x2218c1;};'use strict';var _=require(_0x6eb5('0x0'));var Promise=require(_0x6eb5('0x1'));var rp=require(_0x6eb5('0x2'));var util=require(_0x6eb5('0x3'));var md5=require(_0x6eb5('0x4'));var Redis=require(_0x6eb5('0x5'));var intUtil=require(_0x6eb5('0x6'));var config=require(_0x6eb5('0x7'));var logger=require(_0x6eb5('0x8'))(_0x6eb5('0x9'));config[_0x6eb5('0xa')]=_['defaults'](config[_0x6eb5('0xa')],{'host':_0x6eb5('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6eb5('0xa')]));function getAdminUser(_0x1ffacb,_0x5f3ff2,_0xeb580a,_0x1e5ad6,_0x3fc826,_0x4bd230){return new Promise(function(_0x2d9b80,_0x53da45){var _0x51a29a={'method':'GET','uri':_0x1e5ad6+_0x6eb5('0xc')+'&'+_0x3fc826+'&'+_0x4bd230,'auth':_0x5f3ff2,'json':!![]};return rp(_0x51a29a)[_0x6eb5('0xd')](function(_0x74bef8){if(_0x74bef8[_0x6eb5('0xe')][_0x6eb5('0xf')]>0x0){_0xeb580a[_0x6eb5('0x10')]=_0x74bef8[_0x6eb5('0xe')][0x0][_0x6eb5('0x11')];}logger['info']('['+[_0x1ffacb['toUpperCase']()]+_0x6eb5('0x12'),_0xeb580a);_0x2d9b80(_0xeb580a);})[_0x6eb5('0x13')](function(_0x371f76){logger[_0x6eb5('0x14')]('['+[_0x1ffacb['toUpperCase']()]+']',_0x371f76[_0x6eb5('0x15')]);_0x53da45(_0x371f76[_0x6eb5('0x15')]);});});}function getUser(_0x5498df,_0x3d27c0,_0x54d0f7,_0x13b993,_0x100222){return function(_0xed059d){logger[_0x6eb5('0x16')]('['+[_0x5498df[_0x6eb5('0x17')]()]+'],\x20getUser\x20input\x20crm',_0xed059d);return new Promise(function(_0x333585,_0x2c6a78){if(intUtil[_0x6eb5('0x18')](_0xed059d[_0x6eb5('0x19')])){var _0x41739a={'method':_0x6eb5('0x1a'),'uri':_0x54d0f7+'sys_user?sysparm_query=email%3D'+_0xed059d[_0x6eb5('0x19')]+'&'+_0x13b993+'&'+_0x100222,'auth':_0x3d27c0,'json':!![]};logger[_0x6eb5('0x16')]('['+[_0x5498df[_0x6eb5('0x17')]()]+_0x6eb5('0x1b'),_0x41739a);return rp(_0x41739a)[_0x6eb5('0xd')](function(_0x3f40bb){logger['info']('['+[_0x5498df[_0x6eb5('0x17')]()]+_0x6eb5('0x1c'),_0x3f40bb);if(_0x3f40bb[_0x6eb5('0xe')][_0x6eb5('0xf')]>0x0&&String(_0x3f40bb['result'][0x0][_0x6eb5('0x1d')])==='true'){_0xed059d[_0x6eb5('0x1e')]=_0x3f40bb[_0x6eb5('0xe')][0x0][_0x6eb5('0x11')];}else{_0xed059d[_0x6eb5('0x1e')]=_0xed059d[_0x6eb5('0x10')];_0xed059d[_0x6eb5('0x19')]=_0xed059d[_0x6eb5('0x1f')];}logger[_0x6eb5('0x16')]('['+[_0x5498df[_0x6eb5('0x17')]()]+_0x6eb5('0x20'),_0xed059d);_0x333585(_0xed059d);})[_0x6eb5('0x13')](function(_0x1a7dfb){logger['error']('['+[_0x5498df[_0x6eb5('0x17')]()]+']',_0x1a7dfb[_0x6eb5('0x15')]);_0x2c6a78(_0x1a7dfb['message']);});}else{logger[_0x6eb5('0x16')]('['+[_0x5498df[_0x6eb5('0x17')]()]+_0x6eb5('0x21'));_0xed059d['userId']=_0xed059d[_0x6eb5('0x10')];_0xed059d[_0x6eb5('0x19')]=_0xed059d[_0x6eb5('0x1f')];_0x333585(_0xed059d);}});};}function createEndUser(_0x1e8f4e,_0x47f123,_0x2c5548,_0xb4dac5,_0x26a524){logger[_0x6eb5('0x16')]('['+[_0x1e8f4e[_0x6eb5('0x17')]()]+_0x6eb5('0x22'),_0x2c5548);return new Promise(function(_0xa6f5d8,_0x18fc88){var _0x579322={'method':_0x6eb5('0x23'),'uri':_0xb4dac5+'sys_user?'+_0x26a524,'body':{'user_name':_0x2c5548[_0x6eb5('0x24')],'roles':_0x6eb5('0x25'),'first_name':_0x2c5548[_0x6eb5('0x24')],'active':_0x6eb5('0x26'),'date_format':_0x6eb5('0x27'),'phone':_0x2c5548['endUserNumber']},'auth':_0x47f123,'json':!![]};return rp(_0x579322)[_0x6eb5('0xd')](function(_0x34d8a9){logger[_0x6eb5('0x16')]('['+[_0x1e8f4e[_0x6eb5('0x17')]()]+_0x6eb5('0x28'),_0x34d8a9[_0x6eb5('0xe')]);_0x2c5548[_0x6eb5('0x29')]=_0x34d8a9[_0x6eb5('0xe')][_0x6eb5('0x11')];_0xa6f5d8(_0x2c5548);})['catch'](function(_0x1cd97f){logger['error']('['+[_0x1e8f4e[_0x6eb5('0x17')]()]+']',_0x1cd97f[_0x6eb5('0x15')]);_0x18fc88(_0x1cd97f[_0x6eb5('0x15')]);});});}function getEndUser(_0x1f302b,_0x1bfcb1,_0x18c4a2,_0x2519d7,_0x47bb72){return function(_0x2cd0f7){logger[_0x6eb5('0x16')]('['+[_0x1f302b[_0x6eb5('0x17')]()]+_0x6eb5('0x2a'),_0x2cd0f7);return new Promise(function(_0x21d883,_0x950079){var _0xd9813c={'method':_0x6eb5('0x1a'),'uri':_0x18c4a2+_0x6eb5('0x2b')+_0x2cd0f7[_0x6eb5('0x24')]+'&'+_0x2519d7+'&'+_0x47bb72,'auth':_0x1bfcb1,'json':!![]};return rp(_0xd9813c)['then'](function(_0x5cfcd1){if(_0x5cfcd1[_0x6eb5('0xe')][_0x6eb5('0xf')]>0x0){_0x2cd0f7[_0x6eb5('0x29')]=_0x5cfcd1['result'][0x0][_0x6eb5('0x11')];logger[_0x6eb5('0x16')]('['+[_0x1f302b[_0x6eb5('0x17')]()]+_0x6eb5('0x2c'),_0x2cd0f7);_0x21d883(_0x2cd0f7);}else{return createEndUser(_0x1f302b,_0x1bfcb1,_0x2cd0f7,_0x18c4a2,_0x2519d7)['then'](function(_0x556ae6){logger[_0x6eb5('0x16')]('['+[_0x1f302b[_0x6eb5('0x17')]()]+'],\x20createEndUser\x20crm',_0x556ae6);_0x21d883(_0x556ae6);});}})[_0x6eb5('0x13')](function(_0x3cfd67){logger[_0x6eb5('0x14')]('['+[_0x1f302b['toUpperCase']()]+']',_0x3cfd67[_0x6eb5('0x15')]);_0x950079(_0x3cfd67[_0x6eb5('0x15')]);});});};}function getCustomFields(_0x11d329,_0x2b86ef){var _0x676042={};if(_0x11d329['length']>0x0){_['forEach'](_0x11d329,function(_0x18cde1){if(_[_0x6eb5('0x2d')]([_0x6eb5('0x2e'),_0x6eb5('0x2f')],_0x18cde1['type'])&&_0x18cde1['nameField']&&!_0x18cde1[_0x6eb5('0x30')]){_0x676042[_0x18cde1[_0x6eb5('0x31')]['toLowerCase']()]=_0x18cde1[_0x6eb5('0x32')]['toString']();}else if(_['includes']([_0x6eb5('0x2e'),'picklist'],_0x18cde1[_0x6eb5('0x33')])&&_0x18cde1[_0x6eb5('0x34')]&&_0x18cde1['customField']){_0x676042[_0x18cde1[_0x6eb5('0x34')][_0x6eb5('0x35')]()]=_0x18cde1['content'][_0x6eb5('0x36')]();}else if(_0x18cde1[_0x6eb5('0x33')]==='variable'&&_0x18cde1['variableName']&&_0x18cde1[_0x6eb5('0x34')]&&_0x18cde1['customField']){_0x676042[_0x18cde1[_0x6eb5('0x34')][_0x6eb5('0x35')]()]=_0x2b86ef[_0x18cde1[_0x6eb5('0x37')]][_0x6eb5('0x36')]();}else if(_0x18cde1['type']===_0x6eb5('0x38')&&_0x18cde1['Variable']&&_0x18cde1[_0x6eb5('0x39')][_0x6eb5('0x3a')]&&_0x18cde1['idField']&&_0x18cde1[_0x6eb5('0x30')]){_0x676042[_0x18cde1['idField'][_0x6eb5('0x35')]()]=_0x2b86ef[_0x18cde1['Variable'][_0x6eb5('0x3a')][_0x6eb5('0x35')]()][_0x6eb5('0x36')]();}});}return _0x676042;}function getTicket(_0xcc8945,_0x27aef7,_0x44b73c,_0xb958e7,_0x171938,_0x3f3d64){return function(_0x1c2c60){logger[_0x6eb5('0x16')]('['+[_0xcc8945[_0x6eb5('0x17')]()]+_0x6eb5('0x3b'),_0x1c2c60);return new Promise(function(_0x38e14d,_0x4ad83d){var _0x5121d2=_0xcc8945[_0x6eb5('0x35')]()===_0x6eb5('0x3c')?_0x1c2c60['userId']:_0x1c2c60[_0x6eb5('0x29')];var _0x364d58={'method':_0x6eb5('0x23'),'uri':_0x44b73c+_0x6eb5('0x3d')+'?'+_0x3f3d64,'body':Object[_0x6eb5('0x3e')]({},{'active':_0x6eb5('0x26'),'caller_id':_0x5121d2,'assigned_to':_0x1c2c60[_0x6eb5('0x1e')],'short_description':intUtil[_0x6eb5('0x3f')](_0xb958e7[_0x6eb5('0x40')],_0x171938,'\x20'),'description':intUtil['getString'](_0xb958e7[_0x6eb5('0x41')],_0x171938,'\x0a')},getCustomFields(_0xb958e7[_0x6eb5('0x42')],_0x171938)),'auth':_0x27aef7,'json':!![]};return rp(_0x364d58)[_0x6eb5('0xd')](function(_0x20cf3e){logger['info']('['+[_0xcc8945[_0x6eb5('0x17')]()]+_0x6eb5('0x43'),_0x20cf3e[_0x6eb5('0xe')]);_0x1c2c60[_0x6eb5('0x44')]=_0x20cf3e[_0x6eb5('0xe')][_0x6eb5('0x11')];_0x1c2c60['ticketNumber']=_0x20cf3e[_0x6eb5('0xe')][_0x6eb5('0x45')];logger[_0x6eb5('0x16')]('['+[_0xcc8945[_0x6eb5('0x17')]()]+_0x6eb5('0x46'),_0x1c2c60);_0x38e14d(_0x1c2c60);})['catch'](function(_0x1769d3){logger[_0x6eb5('0x14')]('['+[_0xcc8945[_0x6eb5('0x17')]()]+']',_0x1769d3[_0x6eb5('0x15')]);_0x4ad83d(_0x1769d3['message']);});});};}function createRemoteTag(_0x28b45f,_0x59bf08,_0x30db84,_0x298e89){return new Promise(function(_0x2a7f96,_0x1a4344){var _0x3028d2={'method':_0x6eb5('0x23'),'uri':_0x30db84+_0x6eb5('0x47')+'?'+_0x298e89,'body':{'short_description':_0x28b45f,'global':!![],'active':!![],'name':_0x28b45f},'auth':_0x59bf08,'json':!![]};return rp(_0x3028d2)[_0x6eb5('0xd')](function(_0x15f771){var _0x55b97c=_0x15f771[_0x6eb5('0xe')][_0x6eb5('0x11')];_0x2a7f96(_0x55b97c);});});}function getRemoteTag(_0x34dd5a,_0xb601fa,_0x31ddbb,_0x318eb5,_0x5acfd9){return new Promise(function(_0x296286,_0x318846){var _0x517abd={'method':_0x6eb5('0x1a'),'uri':_0x31ddbb+_0x6eb5('0x47')+_0x6eb5('0x48')+_0x34dd5a+'&'+_0x318eb5,'auth':_0xb601fa,'json':!![]};return rp(_0x517abd)[_0x6eb5('0xd')](function(_0x2e1e57){if(_0x2e1e57[_0x6eb5('0xe')][_0x6eb5('0xf')]>0x0){var _0x157d32=_0x2e1e57[_0x6eb5('0xe')][0x0][_0x6eb5('0x11')];_0x296286(_0x157d32);}else{return createRemoteTag(_0x34dd5a,_0xb601fa,_0x31ddbb,_0x318eb5)[_0x6eb5('0xd')](function(_0x3b91ea){_0x296286(_0x3b91ea);});}});});}function assignTagToIncident(_0x58ed69,_0x50ba20,_0x2e36ab,_0x3e45fb,_0x2d6641){return new Promise(function(_0xfa261b,_0xebd5f3){var _0x433c70={'method':_0x6eb5('0x23'),'uri':_0x2e36ab+_0x6eb5('0x49')+'?'+_0x2d6641,'body':{'label':_0x58ed69,'table':_0x6eb5('0x3d'),'id_type':_0x6eb5('0x4a'),'table_key':_0x3e45fb[_0x6eb5('0x44')],'title':'Incident\x20-\x20'+_0x3e45fb[_0x6eb5('0x4b')],'id_display':_0x3e45fb['ticketNumber']},'auth':_0x50ba20,'json':!![]};return rp(_0x433c70)[_0x6eb5('0xd')](function(_0xbc9e78){_0xfa261b();})['catch'](function(){_0xfa261b();});});}function manageTags(_0x27530f,_0xc6eb58,_0x496064,_0x5af5da,_0x3cc5a9,_0x3e3d22,_0x2de84d){return new Promise(function(_0x46f3be,_0x42328b){var _0x2f2f64=[];_0xc6eb58[_0x6eb5('0x4c')](function(_0x56f4f4){_0x2f2f64[_0x6eb5('0x4d')](getRemoteTag(_0x56f4f4,_0x496064,_0x5af5da,_0x3e3d22,_0x2de84d));});return Promise['all'](_0x2f2f64)[_0x6eb5('0xd')](function(_0x4238a4){if(_0x4238a4[_0x6eb5('0xf')]){logger[_0x6eb5('0x16')]('['+[_0x27530f[_0x6eb5('0x17')]()]+_0x6eb5('0x4e'),_0x4238a4);var _0x57cf01=[];_0x4238a4[_0x6eb5('0x4c')](function(_0xb4cb30){_0x57cf01[_0x6eb5('0x4d')](assignTagToIncident(_0xb4cb30,_0x496064,_0x5af5da,_0x3cc5a9,_0x3e3d22));});return Promise[_0x6eb5('0x4f')](_0x57cf01)[_0x6eb5('0xd')](function(){_0x46f3be();})[_0x6eb5('0x13')](function(){_0x46f3be();});}else{_0x46f3be();}});});}function getTags(_0xec9d4f,_0x408fdb,_0x3bc0d8,_0x559e38,_0x3b58cf,_0x5b3a8f){return function(_0x2290bd){return new Promise(function(_0x3e4ac9,_0x4068b8){var _0x256fad=[];var _0x2ae6d5=_0x559e38[_0x6eb5('0x50')];if(_0x2ae6d5&&_0x2ae6d5[_0x6eb5('0xf')]>0x0){_0x256fad=_[_0x6eb5('0x51')](_0x2ae6d5,'name');}if(_0x256fad['length']>0x0){return manageTags(_0xec9d4f,_0x256fad,_0x408fdb,_0x3bc0d8,_0x2290bd,_0x3b58cf,_0x5b3a8f)['then'](function(){_0x3e4ac9(_0x2290bd);});}else{_0x3e4ac9(_0x2290bd);}});};}function emit(_0x6862c7,_0x4837a5,_0x389c0f){var _0x15b84f=_0x6eb5('0x52')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0x6eb5('0x53')+_0x6eb5('0x54');var _0x4f95e4={'uri':_0x6862c7+_0x6eb5('0x55')+_0x389c0f+_0x15b84f};io['to'](util[_0x6eb5('0x56')]('user:%s',_0x4837a5))['emit'](_0x6eb5('0x57'),_0x4f95e4);}exports['cs']=function(_0x3f7cb2,_0x162d92,_0xc6d832,_0x35a697,_0x323470,_0xa223d5,_0x174f0d,_0xae5eca){var _0x2b9c8f={};var _0x3e4350={'user':_0xa223d5[_0x6eb5('0x58')],'pass':_0xa223d5[_0x6eb5('0x59')]};var _0x2e6f31=_0x6eb5('0x5a');var _0x4ef827=_0x6eb5('0x5b');_0xa223d5[_0x6eb5('0x5c')]=intUtil[_0x6eb5('0x5d')](_0xa223d5['remoteUri']);_0xa223d5['serverUrl']=intUtil[_0x6eb5('0x5d')](_0xa223d5[_0x6eb5('0x5e')]);var _0xa611e3=util['format'](_0x6eb5('0x5f'),_0xa223d5['remoteUri']);_0x2b9c8f[_0x6eb5('0x19')]=!_['isNil'](_0x35a697)?_0x35a697['email']:null;_0x2b9c8f[_0x6eb5('0x1f')]=_0xa223d5['email'];_0x2b9c8f['endUserNumber']=_0xae5eca['toLowerCase']()===_0x6eb5('0x3c')?_0x162d92[_0x6eb5('0x60')]:_0x162d92[_0x6eb5('0x61')];_0x2b9c8f['callDirection']=_0xae5eca===_0x6eb5('0x62')||_0xae5eca===_0x6eb5('0x63')?_0x6eb5('0x62'):_0x6eb5('0x3c');var _0xa453ad=util[_0x6eb5('0x56')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xa223d5[_0x6eb5('0x5e')],_0x162d92['uniqueid'],md5(_0x162d92[_0x6eb5('0x64')]));if(_0x323470&&_0x323470[_0x6eb5('0x65')]){logger[_0x6eb5('0x16')]('[QUEUE]','Recording\x20is\x20enabled!');_0x162d92[_0x6eb5('0x66')]=_0xa453ad;}else if(_0x174f0d&&_0x174f0d[_0x6eb5('0x67')]&&_0x174f0d[_0x6eb5('0x67')]!==_0x6eb5('0x68')){logger[_0x6eb5('0x16')](_0x6eb5('0x69'),_0x6eb5('0x6a'));_0x162d92[_0x6eb5('0x66')]=_0xa453ad;}else{_0x162d92[_0x6eb5('0x66')]='';}return getAdminUser(_0xae5eca,_0x3e4350,_0x2b9c8f,_0xa611e3,_0x4ef827,_0x2e6f31)[_0x6eb5('0xd')](getUser(_0xae5eca,_0x3e4350,_0xa611e3,_0x4ef827,_0x2e6f31))['then'](getEndUser(_0xae5eca,_0x3e4350,_0xa611e3,_0x4ef827,_0x2e6f31))[_0x6eb5('0xd')](getTicket(_0xae5eca,_0x3e4350,_0xa611e3,_0xc6d832,_0x162d92,_0x4ef827))[_0x6eb5('0xd')](function(_0x5588a3){logger[_0x6eb5('0x16')](util[_0x6eb5('0x56')]('The\x20ticket\x20ID\x20is:\x20%s',_0x5588a3[_0x6eb5('0x44')]));logger[_0x6eb5('0x16')](util['format']('call\x20direction:\x20%s',_0xae5eca));if(_0xae5eca!==_0x6eb5('0x63')){logger['info']('['+[_0xae5eca[_0x6eb5('0x17')]()]+']',_0x6eb5('0x6b'));emit(_0xa223d5['remoteUri'],_0x35a697[_0x6eb5('0x3a')],_0x5588a3[_0x6eb5('0x44')]);}})['catch'](function(_0x116297){logger[_0x6eb5('0x14')]('['+[_0xae5eca['toUpperCase']()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x6eb5('0x6c')](_0x116297,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/sugarcrm.js b/server/services/ami/trigger/integration/sugarcrm.js index b2da184..8b28321 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 _0x79bf=['error','outbound','recordingFormat','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','Outbound','%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','[OUTBOUND]','trigger:browser:url','catch','unmanaged','lastevent','toUpperCase','isNil','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','localhost','POST','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','length','forEach','push','idField','variableName','JSON','stringify','Calls','format','apiKey','toString','base64','get_server_info','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','name_value_list','value','Agent\x20found!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','set_entry','first_name','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','type','string','nameField','customField','custom_fields','content','variable','customVariable','Variable','toLowerCase','login','username','password','PLAIN','sessionID','Account\x20%d\x20is\x20not\x20valid','queue','stripTrailingSlash','remoteUri','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','version','charAt','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s'];(function(_0x2b0ab1,_0x3c4b0c){var _0x1cf48c=function(_0x86b64b){while(--_0x86b64b){_0x2b0ab1['push'](_0x2b0ab1['shift']());}};_0x1cf48c(++_0x3c4b0c);}(_0x79bf,0x1f4));var _0xf79b=function(_0x4db537,_0x53a37b){_0x4db537=_0x4db537-0x0;var _0x25d062=_0x79bf[_0x4db537];return _0x25d062;};'use strict';var _=require(_0xf79b('0x0'));var rp=require(_0xf79b('0x1'));var BPromise=require(_0xf79b('0x2'));var md5=require('md5');var util=require(_0xf79b('0x3'));var Redis=require(_0xf79b('0x4'));var intUtil=require(_0xf79b('0x5'));var config=require(_0xf79b('0x6'));var logger=require(_0xf79b('0x7'))('sugarcrm');config[_0xf79b('0x8')]=_['defaults'](config['redis'],{'host':_0xf79b('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf79b('0x8')]));var def={'method':_0xf79b('0xa'),'json':!![]};function emit(_0xb5ea25,_0x5e359d,_0x505b7e){io['to'](_0xb5ea25)['emit'](_0x5e359d,_0x505b7e);}function getTicket(_0x1ee5d6,_0xb14f18,_0x5db722,_0x5c71e4,_0x561d72,_0x4d3299,_0x15c2cb,_0x3cdc1a){logger[_0xf79b('0xb')](_0xf79b('0xc'));var _0x4c774c=new Date();var _0x8e4a80=[{'name':_0xf79b('0xd'),'value':intUtil[_0xf79b('0xe')](_0x5c71e4[_0xf79b('0xf')],_0x561d72,'\x20')},{'name':_0xf79b('0x10'),'value':_0xb14f18['id']},{'name':_0xf79b('0x11'),'value':_0xb14f18['id']},{'name':_0xf79b('0x12'),'value':intUtil[_0xf79b('0xe')](_0x5c71e4[_0xf79b('0x13')],_0x561d72,'\x0a')},{'name':_0xf79b('0x14'),'value':_0x4c774c[_0xf79b('0x15')]()['slice'](0x0,0x13)[_0xf79b('0x16')]('T','\x20')},{'name':_0xf79b('0x17'),'value':'0'},{'name':_0xf79b('0x18'),'value':'15'},{'name':_0xf79b('0x19'),'value':_0x5db722['id']},{'name':_0xf79b('0x1a'),'value':_0xf79b('0x1b')},{'name':_0xf79b('0x1c'),'value':_0x5db722['name']},{'name':_0xf79b('0x1d'),'value':_0x3cdc1a}];if(_0x4d3299[_0xf79b('0x1e')]){_[_0xf79b('0x1f')](_0x4d3299,function(_0x214b38){if(_0x561d72[_0x214b38['variableName']]){_0x8e4a80[_0xf79b('0x20')]({'name':_0x214b38[_0xf79b('0x21')],'value':_0x561d72[_0x214b38[_0xf79b('0x22')]]});}});}return request({'form':{'method':'set_entry','input_type':_0xf79b('0x23'),'response_type':_0xf79b('0x23'),'rest_data':JSON[_0xf79b('0x24')]({'session':_0x15c2cb['id'],'module_name':_0xf79b('0x25'),'name_value_list':_0x8e4a80})}});}function getAuth(_0xe527ea){return util[_0xf79b('0x26')]('Basic\x20%s',new Buffer(_0xe527ea[_0xf79b('0x27')]+':X')[_0xf79b('0x28')](_0xf79b('0x29')));}function getServerInfo(_0x15ac65){return request({'form':{'method':_0xf79b('0x2a'),'input_type':_0xf79b('0x23'),'response_type':_0xf79b('0x23'),'rest_data':JSON[_0xf79b('0x24')]({'session':_0x15ac65['id']})}});}function getUser(_0x79547,_0xa4f50f,_0x43c14b){if(!_['isNil'](_0xa4f50f)){logger[_0xf79b('0xb')](_0xf79b('0x2b'),_0xa4f50f);return request({'form':{'method':_0xf79b('0x2c'),'input_type':'JSON','response_type':_0xf79b('0x23'),'rest_data':JSON[_0xf79b('0x24')]({'session':_0x43c14b['id'],'module_name':_0xf79b('0x2d'),'query':util[_0xf79b('0x26')](_0xf79b('0x2e'),_0xa4f50f),'order_by':'','offset':'0','select_fields':['id','name',_0xf79b('0x2f')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xf79b('0x30')](function(_0x3ec9d3){if(_0x3ec9d3[_0xf79b('0x31')][_0xf79b('0x1e')]){var _0x432deb=_[_0xf79b('0x32')](_0x3ec9d3[_0xf79b('0x31')],function(_0xa4f46f){return _0xa4f46f[_0xf79b('0x33')][_0xf79b('0x2f')][_0xf79b('0x34')]===_0xa4f50f;});if(_0x432deb){logger[_0xf79b('0xb')](_0xf79b('0x35'));return BPromise['resolve']({'id':_0x432deb[_0xf79b('0x33')]['id'][_0xf79b('0x34')],'name':_0x432deb[_0xf79b('0x33')]['name']['value']});}}logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xf79b('0x36')]({'id':_0x43c14b[_0xf79b('0x33')][_0xf79b('0x37')][_0xf79b('0x34')],'name':_0x43c14b[_0xf79b('0x33')]['user_name'][_0xf79b('0x34')]});});}else{logger[_0xf79b('0xb')](_0xf79b('0x38'));return BPromise[_0xf79b('0x36')]({'id':_0x43c14b[_0xf79b('0x33')][_0xf79b('0x37')][_0xf79b('0x34')],'name':_0x43c14b[_0xf79b('0x33')]['user_name'][_0xf79b('0x34')]});}}function getEndUser(_0xc1b800,_0x465bda,_0x301913,_0x17e5a5){logger[_0xf79b('0xb')](_0xf79b('0x39'),_0x301913);return request({'form':{'method':_0xf79b('0x2c'),'input_type':_0xf79b('0x23'),'response_type':_0xf79b('0x23'),'rest_data':JSON['stringify']({'session':_0x17e5a5['id'],'module_name':_0xf79b('0x1b'),'query':util['format'](_0xf79b('0x3a'),_0x301913),'order_by':'','offset':'0','select_fields':['id',_0xf79b('0xd'),_0xf79b('0x3b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xf79b('0x30')](function(_0x17f2b8){if(_0x17f2b8[_0xf79b('0x31')][_0xf79b('0x1e')]){var _0x48f3e7=_[_0xf79b('0x32')](_0x17f2b8[_0xf79b('0x31')],function(_0x3cb7c0){return _0x3cb7c0['name_value_list'][_0xf79b('0x3b')][_0xf79b('0x34')]===_0x301913;});if(_0x48f3e7){logger[_0xf79b('0xb')](_0xf79b('0x3c'));return BPromise[_0xf79b('0x36')]({'id':_0x48f3e7[_0xf79b('0x33')]['id']['value'],'name':_0x48f3e7[_0xf79b('0x33')][_0xf79b('0xd')][_0xf79b('0x34')],'phone':_0x48f3e7[_0xf79b('0x33')][_0xf79b('0x3b')][_0xf79b('0x34')]});}}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0xf79b('0x3d'),'input_type':_0xf79b('0x23'),'response_type':_0xf79b('0x23'),'rest_data':JSON[_0xf79b('0x24')]({'session':_0x17e5a5['id'],'module_name':_0xf79b('0x1b'),'name_value_list':[{'name':_0xf79b('0x3e'),'value':_0x465bda!==''?_0x465bda:util['format'](_0xf79b('0x3f'),_0x301913)},{'name':'phone_home','value':_0x301913}]})}})['then'](function(_0x2ec83c){logger[_0xf79b('0xb')](_0xf79b('0x40'));return BPromise[_0xf79b('0x36')]({'id':_0x2ec83c['id'],'name':_0x2ec83c[_0xf79b('0x31')][_0xf79b('0x3e')][_0xf79b('0x34')],'phone':_0x2ec83c[_0xf79b('0x31')][_0xf79b('0x3b')]['value']});});}});}function request(_0x1a519a){logger[_0xf79b('0x41')](_0xf79b('0x42'),JSON[_0xf79b('0x24')](_0x1a519a));return rp(_[_0xf79b('0x43')](def,_0x1a519a));}function getTags(_0x43b16e,_0x4364a7){var _0x51592a=[];if(_0x43b16e&&_0x43b16e['length']>0x0){_0x51592a=_[_0xf79b('0x44')](_0x43b16e,_0x4364a7);}return _0x51592a;}function getCustomFields(_0x346ca8,_0x14c60e){var _0x4202c5=[];var _0x250c38={'custom_fields':[]};if(_0x346ca8[_0xf79b('0x1e')]>0x0){_[_0xf79b('0x1f')](_0x346ca8,function(_0x10d2d5){if(_0x10d2d5[_0xf79b('0x45')]===_0xf79b('0x46')&&_0x10d2d5[_0xf79b('0x47')]&&!_0x10d2d5[_0xf79b('0x48')]){_0x250c38[_0x10d2d5[_0xf79b('0x47')]['toLowerCase']()]=_0x10d2d5['content']['toString']();}else if(_0x10d2d5['type']===_0xf79b('0x46')&&_0x10d2d5['idField']&&_0x10d2d5[_0xf79b('0x48')]){_0x250c38[_0xf79b('0x49')][_0xf79b('0x20')]({'id':_0x10d2d5[_0xf79b('0x21')],'value':_0x10d2d5[_0xf79b('0x4a')]['toString']()});}else if(_0x10d2d5[_0xf79b('0x45')]===_0xf79b('0x4b')&&_0x10d2d5[_0xf79b('0x22')]&&_0x10d2d5[_0xf79b('0x21')]&&_0x10d2d5['customField']){_0x14c60e[_0x10d2d5[_0xf79b('0x22')]]&&_0x250c38['custom_fields'][_0xf79b('0x20')]({'id':_0x10d2d5['idField'],'value':_0x14c60e[_0x10d2d5[_0xf79b('0x22')]][_0xf79b('0x28')]()});}else if(_0x10d2d5[_0xf79b('0x45')]===_0xf79b('0x4c')&&_0x10d2d5[_0xf79b('0x4d')]&&_0x10d2d5[_0xf79b('0x4d')][_0xf79b('0xd')]&&_0x10d2d5['idField']&&_0x10d2d5[_0xf79b('0x48')]){_0x14c60e[_0x10d2d5[_0xf79b('0x4d')][_0xf79b('0xd')][_0xf79b('0x4e')]()]&&_0x250c38[_0xf79b('0x49')][_0xf79b('0x20')]({'id':_0x10d2d5['idField'],'value':_0x14c60e[_0x10d2d5[_0xf79b('0x4d')]['name']['toLowerCase']()]['toString']()});}});}return _0x250c38;}function getConnection(_0x525b07){return request({'method':_0xf79b('0xa'),'form':{'method':_0xf79b('0x4f'),'input_type':_0xf79b('0x23'),'response_type':_0xf79b('0x23'),'rest_data':JSON[_0xf79b('0x24')]({'user_auth':{'user_name':_0x525b07[_0xf79b('0x50')],'password':_0x525b07[_0xf79b('0x51')],'encryption':_0xf79b('0x52')},'application':'xCALLY\x20Motion\x20integration'})}})['then'](function(_0x3cc532){var _0xe60bf7=_0x3cc532;if(_0xe60bf7['id']){def[_0xf79b('0x53')]=_0xe60bf7['id'];return BPromise[_0xf79b('0x36')](_0xe60bf7);}else{throw new Error(util[_0xf79b('0x26')](_0xf79b('0x54'),_0x525b07['id']));}});}function setRelationship(_0x32814e,_0x2465ed,_0x4035a0,_0x205305){return request({'form':{'method':'set_relationship','input_type':_0xf79b('0x23'),'response_type':_0xf79b('0x23'),'rest_data':JSON[_0xf79b('0x24')]({'session':_0x32814e['id'],'module_name':'Calls','module_id':_0x4035a0['id'],'link_field_name':_0x205305,'related_ids':[_0x2465ed['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xf79b('0x55')]=function(_0x331cce,_0x14cbf8,_0x4c481f,_0x2e7de9,_0x8bedf8,_0x180df2){var _0x359049,_0x29828a,_0x26e3f8,_0x20718b;_0x180df2['remoteUri']=intUtil[_0xf79b('0x56')](_0x180df2[_0xf79b('0x57')]);_0x180df2[_0xf79b('0x58')]=intUtil[_0xf79b('0x56')](_0x180df2['serverUrl']);def[_0xf79b('0x59')]=util[_0xf79b('0x26')](_0xf79b('0x5a'),_0x180df2[_0xf79b('0x57')]);if(_0x8bedf8&&_0x8bedf8[_0xf79b('0x5b')]){logger[_0xf79b('0xb')]('[QUEUE]','Recording\x20is\x20enabled!');_0x14cbf8['recordingURL']=util[_0xf79b('0x26')](_0xf79b('0x5c'),_0x180df2['serverUrl'],_0x14cbf8['uniqueid'],md5(_0x14cbf8[_0xf79b('0x5d')]));}else{_0x14cbf8[_0xf79b('0x5e')]='';}return getConnection(_0x180df2)['then'](function(_0x2a49f1){_0x20718b=_0x2a49f1;return getUser(_0x180df2,_0x2e7de9[_0xf79b('0xd')],_0x20718b);})[_0xf79b('0x30')](function(_0x422ebf){_0x359049=_0x422ebf;logger[_0xf79b('0xb')](_0xf79b('0x5f'),_0x359049['id']);return getEndUser(_0x180df2,_0x14cbf8['calleridname'],_0x14cbf8['calleridnum'],_0x20718b);})[_0xf79b('0x30')](function(_0x29b3ea){_0x29828a=_0x29b3ea;logger[_0xf79b('0xb')]('The\x20Enduser\x20ID\x20is:',_0x29828a['id']);return getTicket(_0x180df2,_0x359049,_0x29828a,_0x4c481f,_0x14cbf8,_0x4c481f['Fields'],_0x20718b,_0xf79b('0x60'));})[_0xf79b('0x30')](function(_0x1e9c7c){_0x26e3f8=_0x1e9c7c;logger[_0xf79b('0xb')](_0xf79b('0x61'));logger[_0xf79b('0xb')](_0xf79b('0x62'),_0x26e3f8['id']);return setRelationship(_0x20718b,_0x359049,_0x26e3f8,_0xf79b('0x63'));})[_0xf79b('0x30')](function(){return setRelationship(_0x20718b,_0x29828a,_0x26e3f8,'contacts');})[_0xf79b('0x30')](function(){return getServerInfo(_0x20718b);})['then'](function(_0x4f8fb1){var _0x118f27=parseInt(_0x4f8fb1[_0xf79b('0x64')][_0xf79b('0x65')](0x0));var _0x9e2e80=util[_0xf79b('0x26')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x180df2['remoteUri'],_0x26e3f8['id']);if(_0x118f27>0x6){_0x9e2e80=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x180df2['remoteUri'],_0x26e3f8['id']);}logger[_0xf79b('0xb')](_0xf79b('0x66'),_0xf79b('0x67'));emit(util[_0xf79b('0x26')](_0xf79b('0x68'),_0x2e7de9[_0xf79b('0xd')]),'trigger:browser:url',{'uri':_0x9e2e80});})['catch'](function(_0x1bc055){logger[_0xf79b('0x69')]('[QUEUE]',JSON[_0xf79b('0x24')](_0x1bc055));});};exports[_0xf79b('0x6a')]=function(_0x42519c,_0x2c0c44,_0x3c2928,_0x372a52,_0x2ce52c,_0x444fb8,_0x59ddad){var _0x5239ac,_0x23b9af,_0x393681,_0x1076a6;_0x444fb8['remoteUri']=intUtil[_0xf79b('0x56')](_0x444fb8[_0xf79b('0x57')]);_0x444fb8['serverUrl']=intUtil[_0xf79b('0x56')](_0x444fb8['serverUrl']);def[_0xf79b('0x59')]=util[_0xf79b('0x26')](_0xf79b('0x5a'),_0x444fb8['remoteUri']);if(_0x59ddad&&_0x59ddad[_0xf79b('0x6b')]&&_0x59ddad[_0xf79b('0x6b')]!=='none'){logger[_0xf79b('0xb')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x2c0c44['recordingURL']=util[_0xf79b('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x444fb8['serverUrl'],_0x2c0c44[_0xf79b('0x5d')],md5(_0x2c0c44['uniqueid']));}return getConnection(_0x444fb8)[_0xf79b('0x30')](function(_0x3435f5){_0x1076a6=_0x3435f5;return getUser(_0x444fb8,_0x372a52[_0xf79b('0xd')],_0x1076a6);})[_0xf79b('0x30')](function(_0x501b9e){_0x5239ac=_0x501b9e;logger['info'](_0xf79b('0x5f'),_0x5239ac['id']);return getEndUser(_0x444fb8,_0x2c0c44[_0xf79b('0x6c')],_0x2c0c44['destcalleridnum'],_0x1076a6);})[_0xf79b('0x30')](function(_0x1e9e05){_0x23b9af=_0x1e9e05;logger['info'](_0xf79b('0x6d'),_0x23b9af['id']);return getTicket(_0x444fb8,_0x5239ac,_0x23b9af,_0x3c2928,_0x2c0c44,_0x3c2928[_0xf79b('0x6e')],_0x1076a6,_0xf79b('0x6f'));})[_0xf79b('0x30')](function(_0x44f00d){_0x393681=_0x44f00d;logger[_0xf79b('0xb')](_0xf79b('0x61'));logger['info'](_0xf79b('0x62'),_0x393681['id']);return setRelationship(_0x1076a6,_0x5239ac,_0x393681,_0xf79b('0x63'));})[_0xf79b('0x30')](function(){return setRelationship(_0x1076a6,_0x23b9af,_0x393681,'contacts');})[_0xf79b('0x30')](function(){return getServerInfo(_0x1076a6);})[_0xf79b('0x30')](function(_0x21b187){var _0x1d2379=parseInt(_0x21b187[_0xf79b('0x64')][_0xf79b('0x65')](0x0));var _0xcb4384=util[_0xf79b('0x26')](_0xf79b('0x70'),_0x444fb8[_0xf79b('0x57')],_0x393681['id']);if(_0x1d2379>0x6){_0xcb4384=util[_0xf79b('0x26')](_0xf79b('0x71'),_0x444fb8[_0xf79b('0x57')],_0x393681['id']);}logger[_0xf79b('0xb')](_0xf79b('0x72'),_0xf79b('0x67'));emit(util[_0xf79b('0x26')]('user:%s',_0x372a52[_0xf79b('0xd')]),_0xf79b('0x73'),{'uri':_0xcb4384});})[_0xf79b('0x74')](function(_0x30e3cf){logger['error'](_0xf79b('0x72'),JSON[_0xf79b('0x24')](_0x30e3cf));});};exports[_0xf79b('0x75')]=function(_0x238247,_0x2891e7,_0x1dd3fb,_0x386249,_0x5d3f5d,_0x100e70){var _0x23660f,_0x508128,_0x2004f1,_0x1c0f8c;_0x100e70['remoteUri']=intUtil[_0xf79b('0x56')](_0x100e70[_0xf79b('0x57')]);_0x100e70[_0xf79b('0x58')]=intUtil[_0xf79b('0x56')](_0x100e70[_0xf79b('0x58')]);def['uri']=util[_0xf79b('0x26')](_0xf79b('0x5a'),_0x100e70[_0xf79b('0x57')]);if(_0x5d3f5d&&_0x5d3f5d[_0xf79b('0x5b')]){logger['info']('['+_0x2891e7[_0xf79b('0x76')][_0xf79b('0x77')]()+']','Recording\x20is\x20enabled!');_0x2891e7[_0xf79b('0x5e')]=util[_0xf79b('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x100e70[_0xf79b('0x58')],_0x2891e7[_0xf79b('0x5d')],md5(_0x2891e7['uniqueid']));}else{_0x2891e7['recordingURL']='';}return getConnection(_0x100e70)[_0xf79b('0x30')](function(_0x51482e){_0x1c0f8c=_0x51482e;if(!_[_0xf79b('0x78')](_0x386249)){return getUser(_0x100e70,_0x386249['name'],_0x1c0f8c);}else{return getUser(_0x100e70,null,_0x1c0f8c);}})[_0xf79b('0x30')](function(_0x4803fe){_0x23660f=_0x4803fe;logger[_0xf79b('0xb')](_0xf79b('0x5f'),_0x23660f['id']);return getEndUser(_0x100e70,_0x2891e7['calleridname'],_0x2891e7['calleridnum'],_0x1c0f8c);})['then'](function(_0x56e941){_0x508128=_0x56e941;logger['info']('The\x20Enduser\x20ID\x20is:',_0x508128['id']);return getTicket(_0x100e70,_0x23660f,_0x508128,_0x1dd3fb,_0x2891e7,_0x1dd3fb[_0xf79b('0x6e')],_0x1c0f8c,'Inbound');})[_0xf79b('0x30')](function(_0x335741){_0x2004f1=_0x335741;logger[_0xf79b('0xb')](_0xf79b('0x61'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x2004f1['id']);return setRelationship(_0x1c0f8c,_0x23660f,_0x2004f1,_0xf79b('0x63'));})[_0xf79b('0x30')](function(){return setRelationship(_0x1c0f8c,_0x508128,_0x2004f1,'contacts');})[_0xf79b('0x30')](function(){return getServerInfo(_0x1c0f8c);})[_0xf79b('0x74')](function(_0x3184c0){logger[_0xf79b('0x69')]('['+_0x2891e7[_0xf79b('0x76')][_0xf79b('0x77')]()+']',JSON['stringify'](_0x3184c0));});}; \ No newline at end of file +var _0x164c=['string','customField','nameField','toLowerCase','custom_fields','idField','content','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','queue','remoteUri','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','uri','[OUTBOUND]','destcalleridname','destcalleridnum','error','unmanaged','lastevent','contacts','lodash','bluebird','md5','util','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','slice','replace','duration_minutes','parent_id','parent_type','Contacts','direction','length','forEach','variableName','push','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','Employees','user_name','then','entry_list','Agent\x20found!','resolve','name_value_list','value','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','get_entry_list','phone_home','find','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','debug','merge','map','type'];(function(_0x20384a,_0x3ffe25){var _0x5b783b=function(_0x3b2ad1){while(--_0x3b2ad1){_0x20384a['push'](_0x20384a['shift']());}};_0x5b783b(++_0x3ffe25);}(_0x164c,0x192));var _0xc164=function(_0x565d96,_0x42aae6){_0x565d96=_0x565d96-0x0;var _0xd058e6=_0x164c[_0x565d96];return _0xd058e6;};'use strict';var _=require(_0xc164('0x0'));var rp=require('request-promise');var BPromise=require(_0xc164('0x1'));var md5=require(_0xc164('0x2'));var util=require(_0xc164('0x3'));var Redis=require('ioredis');var intUtil=require(_0xc164('0x4'));var config=require(_0xc164('0x5'));var logger=require(_0xc164('0x6'))(_0xc164('0x7'));config['redis']=_['defaults'](config[_0xc164('0x8')],{'host':_0xc164('0x9'),'port':0x18eb});var io=require(_0xc164('0xa'))(new Redis(config[_0xc164('0x8')]));var def={'method':_0xc164('0xb'),'json':!![]};function emit(_0x40746e,_0x226340,_0x34cf66){io['to'](_0x40746e)[_0xc164('0xc')](_0x226340,_0x34cf66);}function getTicket(_0x2b7712,_0x265f78,_0x53b381,_0x2da2e4,_0x5a7890,_0x1c4157,_0x2392a7,_0x1d62fc){logger[_0xc164('0xd')](_0xc164('0xe'));var _0x4b93e2=new Date();var _0x20bf5c=[{'name':_0xc164('0xf'),'value':intUtil[_0xc164('0x10')](_0x2da2e4[_0xc164('0x11')],_0x5a7890,'\x20')},{'name':_0xc164('0x12'),'value':_0x265f78['id']},{'name':_0xc164('0x13'),'value':_0x265f78['id']},{'name':'description','value':intUtil[_0xc164('0x10')](_0x2da2e4['Descriptions'],_0x5a7890,'\x0a')},{'name':'date_start','value':_0x4b93e2['toISOString']()[_0xc164('0x14')](0x0,0x13)[_0xc164('0x15')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0xc164('0x16'),'value':'15'},{'name':_0xc164('0x17'),'value':_0x53b381['id']},{'name':_0xc164('0x18'),'value':_0xc164('0x19')},{'name':'parent_name','value':_0x53b381[_0xc164('0xf')]},{'name':_0xc164('0x1a'),'value':_0x1d62fc}];if(_0x1c4157[_0xc164('0x1b')]){_[_0xc164('0x1c')](_0x1c4157,function(_0x22299e){if(_0x5a7890[_0x22299e[_0xc164('0x1d')]]){_0x20bf5c[_0xc164('0x1e')]({'name':_0x22299e['idField'],'value':_0x5a7890[_0x22299e['variableName']]});}});}return request({'form':{'method':_0xc164('0x1f'),'input_type':_0xc164('0x20'),'response_type':_0xc164('0x20'),'rest_data':JSON[_0xc164('0x21')]({'session':_0x2392a7['id'],'module_name':_0xc164('0x22'),'name_value_list':_0x20bf5c})}});}function getAuth(_0x437f27){return util[_0xc164('0x23')](_0xc164('0x24'),new Buffer(_0x437f27[_0xc164('0x25')]+':X')[_0xc164('0x26')](_0xc164('0x27')));}function getServerInfo(_0x43329a){return request({'form':{'method':_0xc164('0x28'),'input_type':_0xc164('0x20'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x43329a['id']})}});}function getUser(_0x64509b,_0xe08c83,_0x3977ff){if(!_[_0xc164('0x29')](_0xe08c83)){logger[_0xc164('0xd')](_0xc164('0x2a'),_0xe08c83);return request({'form':{'method':'get_entry_list','input_type':_0xc164('0x20'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x3977ff['id'],'module_name':_0xc164('0x2b'),'query':util[_0xc164('0x23')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0xe08c83),'order_by':'','offset':'0','select_fields':['id',_0xc164('0xf'),_0xc164('0x2c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xc164('0x2d')](function(_0x4d1dfb){if(_0x4d1dfb[_0xc164('0x2e')][_0xc164('0x1b')]){var _0x4383f5=_['find'](_0x4d1dfb[_0xc164('0x2e')],function(_0x565e85){return _0x565e85['name_value_list'][_0xc164('0x2c')]['value']===_0xe08c83;});if(_0x4383f5){logger[_0xc164('0xd')](_0xc164('0x2f'));return BPromise[_0xc164('0x30')]({'id':_0x4383f5[_0xc164('0x31')]['id']['value'],'name':_0x4383f5[_0xc164('0x31')][_0xc164('0xf')][_0xc164('0x32')]});}}logger[_0xc164('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xc164('0x30')]({'id':_0x3977ff[_0xc164('0x31')][_0xc164('0x33')]['value'],'name':_0x3977ff['name_value_list'][_0xc164('0x2c')][_0xc164('0x32')]});});}else{logger[_0xc164('0xd')](_0xc164('0x34'));return BPromise[_0xc164('0x30')]({'id':_0x3977ff['name_value_list'][_0xc164('0x33')][_0xc164('0x32')],'name':_0x3977ff[_0xc164('0x31')]['user_name'][_0xc164('0x32')]});}}function getEndUser(_0xa51551,_0x229559,_0x30e79d,_0xf8b7e6){logger[_0xc164('0xd')](_0xc164('0x35'),_0x30e79d);return request({'form':{'method':_0xc164('0x36'),'input_type':'JSON','response_type':_0xc164('0x20'),'rest_data':JSON['stringify']({'session':_0xf8b7e6['id'],'module_name':_0xc164('0x19'),'query':util[_0xc164('0x23')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x30e79d),'order_by':'','offset':'0','select_fields':['id','name',_0xc164('0x37')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xc164('0x2d')](function(_0x32a09f){if(_0x32a09f[_0xc164('0x2e')][_0xc164('0x1b')]){var _0x544781=_[_0xc164('0x38')](_0x32a09f[_0xc164('0x2e')],function(_0x4f33a9){return _0x4f33a9[_0xc164('0x31')]['phone_home']['value']===_0x30e79d;});if(_0x544781){logger['info'](_0xc164('0x39'));return BPromise[_0xc164('0x30')]({'id':_0x544781[_0xc164('0x31')]['id']['value'],'name':_0x544781[_0xc164('0x31')]['name'][_0xc164('0x32')],'phone':_0x544781[_0xc164('0x31')]['phone_home'][_0xc164('0x32')]});}}else{logger[_0xc164('0xd')](_0xc164('0x3a'));return request({'form':{'method':_0xc164('0x1f'),'input_type':_0xc164('0x20'),'response_type':_0xc164('0x20'),'rest_data':JSON[_0xc164('0x21')]({'session':_0xf8b7e6['id'],'module_name':_0xc164('0x19'),'name_value_list':[{'name':_0xc164('0x3b'),'value':_0x229559!==_0xc164('0x3c')?_0x229559:util[_0xc164('0x23')](_0xc164('0x3d'),_0x30e79d)},{'name':'phone_home','value':_0x30e79d}]})}})[_0xc164('0x2d')](function(_0x61cb24){logger['info']('Enduser\x20created.');return BPromise[_0xc164('0x30')]({'id':_0x61cb24['id'],'name':_0x61cb24[_0xc164('0x2e')]['first_name'][_0xc164('0x32')],'phone':_0x61cb24[_0xc164('0x2e')][_0xc164('0x37')]['value']});});}});}function request(_0x5c55cd){logger[_0xc164('0x3e')]('[HTTP]',JSON[_0xc164('0x21')](_0x5c55cd));return rp(_[_0xc164('0x3f')](def,_0x5c55cd));}function getTags(_0x499d9e,_0x4f2689){var _0x2996a6=[];if(_0x499d9e&&_0x499d9e['length']>0x0){_0x2996a6=_[_0xc164('0x40')](_0x499d9e,_0x4f2689);}return _0x2996a6;}function getCustomFields(_0x113a4c,_0x3c2314){var _0x3a652b=[];var _0x5753fa={'custom_fields':[]};if(_0x113a4c[_0xc164('0x1b')]>0x0){_['forEach'](_0x113a4c,function(_0x2831f1){if(_0x2831f1[_0xc164('0x41')]===_0xc164('0x42')&&_0x2831f1['nameField']&&!_0x2831f1[_0xc164('0x43')]){_0x5753fa[_0x2831f1[_0xc164('0x44')][_0xc164('0x45')]()]=_0x2831f1['content'][_0xc164('0x26')]();}else if(_0x2831f1[_0xc164('0x41')]==='string'&&_0x2831f1['idField']&&_0x2831f1[_0xc164('0x43')]){_0x5753fa[_0xc164('0x46')]['push']({'id':_0x2831f1[_0xc164('0x47')],'value':_0x2831f1[_0xc164('0x48')]['toString']()});}else if(_0x2831f1['type']==='variable'&&_0x2831f1['variableName']&&_0x2831f1[_0xc164('0x47')]&&_0x2831f1[_0xc164('0x43')]){_0x3c2314[_0x2831f1[_0xc164('0x1d')]]&&_0x5753fa[_0xc164('0x46')][_0xc164('0x1e')]({'id':_0x2831f1['idField'],'value':_0x3c2314[_0x2831f1[_0xc164('0x1d')]][_0xc164('0x26')]()});}else if(_0x2831f1[_0xc164('0x41')]===_0xc164('0x49')&&_0x2831f1[_0xc164('0x4a')]&&_0x2831f1['Variable']['name']&&_0x2831f1['idField']&&_0x2831f1[_0xc164('0x43')]){_0x3c2314[_0x2831f1['Variable'][_0xc164('0xf')][_0xc164('0x45')]()]&&_0x5753fa[_0xc164('0x46')][_0xc164('0x1e')]({'id':_0x2831f1[_0xc164('0x47')],'value':_0x3c2314[_0x2831f1[_0xc164('0x4a')]['name']['toLowerCase']()][_0xc164('0x26')]()});}});}return _0x5753fa;}function getConnection(_0x4e0614){return request({'method':_0xc164('0xb'),'form':{'method':_0xc164('0x4b'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xc164('0x21')]({'user_auth':{'user_name':_0x4e0614[_0xc164('0x4c')],'password':_0x4e0614[_0xc164('0x4d')],'encryption':_0xc164('0x4e')},'application':_0xc164('0x4f')})}})['then'](function(_0x39fce7){var _0x1528d8=_0x39fce7;if(_0x1528d8['id']){def[_0xc164('0x50')]=_0x1528d8['id'];return BPromise['resolve'](_0x1528d8);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x4e0614['id']));}});}function setRelationship(_0x4fe6ed,_0x3f5500,_0x104c43,_0x3b51da){return request({'form':{'method':'set_relationship','input_type':_0xc164('0x20'),'response_type':_0xc164('0x20'),'rest_data':JSON[_0xc164('0x21')]({'session':_0x4fe6ed['id'],'module_name':_0xc164('0x22'),'module_id':_0x104c43['id'],'link_field_name':_0x3b51da,'related_ids':[_0x3f5500['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xc164('0x51')]=function(_0x444686,_0x598d04,_0x3f7711,_0x5813e0,_0x57cf34,_0x7b3c48){var _0x3b8db2,_0x6e73e,_0x51714d,_0x340818;_0x7b3c48[_0xc164('0x52')]=intUtil[_0xc164('0x53')](_0x7b3c48[_0xc164('0x52')]);_0x7b3c48['serverUrl']=intUtil[_0xc164('0x53')](_0x7b3c48[_0xc164('0x54')]);def['uri']=util[_0xc164('0x23')](_0xc164('0x55'),_0x7b3c48[_0xc164('0x52')]);if(_0x57cf34&&_0x57cf34[_0xc164('0x56')]){logger['info'](_0xc164('0x57'),_0xc164('0x58'));_0x598d04[_0xc164('0x59')]=util['format'](_0xc164('0x5a'),_0x7b3c48[_0xc164('0x54')],_0x598d04['uniqueid'],md5(_0x598d04[_0xc164('0x5b')]));}else{_0x598d04[_0xc164('0x59')]='';}return getConnection(_0x7b3c48)[_0xc164('0x2d')](function(_0x81d552){_0x340818=_0x81d552;return getUser(_0x7b3c48,_0x5813e0['name'],_0x340818);})[_0xc164('0x2d')](function(_0x41465e){_0x3b8db2=_0x41465e;logger[_0xc164('0xd')](_0xc164('0x5c'),_0x3b8db2['id']);return getEndUser(_0x7b3c48,_0x598d04[_0xc164('0x5d')],_0x598d04[_0xc164('0x5e')],_0x340818);})[_0xc164('0x2d')](function(_0x437c01){_0x6e73e=_0x437c01;logger[_0xc164('0xd')](_0xc164('0x5f'),_0x6e73e['id']);return getTicket(_0x7b3c48,_0x3b8db2,_0x6e73e,_0x3f7711,_0x598d04,_0x3f7711[_0xc164('0x60')],_0x340818,_0xc164('0x61'));})[_0xc164('0x2d')](function(_0x1c45e4){_0x51714d=_0x1c45e4;logger[_0xc164('0xd')](_0xc164('0x62'));logger[_0xc164('0xd')](_0xc164('0x63'),_0x51714d['id']);return setRelationship(_0x340818,_0x3b8db2,_0x51714d,_0xc164('0x64'));})[_0xc164('0x2d')](function(){return setRelationship(_0x340818,_0x6e73e,_0x51714d,'contacts');})[_0xc164('0x2d')](function(){return getServerInfo(_0x340818);})[_0xc164('0x2d')](function(_0x5da864){var _0x5bfb4c=parseInt(_0x5da864[_0xc164('0x65')][_0xc164('0x66')](0x0));var _0x59bffc=util[_0xc164('0x23')](_0xc164('0x67'),_0x7b3c48['remoteUri'],_0x51714d['id']);if(_0x5bfb4c>0x6){_0x59bffc=util['format'](_0xc164('0x68'),_0x7b3c48['remoteUri'],_0x51714d['id']);}logger['info'](_0xc164('0x57'),_0xc164('0x69'));emit(util[_0xc164('0x23')](_0xc164('0x6a'),_0x5813e0[_0xc164('0xf')]),_0xc164('0x6b'),{'uri':_0x59bffc});})[_0xc164('0x6c')](function(_0x4e0216){logger['error'](_0xc164('0x57'),JSON['stringify'](_0x4e0216));});};exports['outbound']=function(_0x5f2c17,_0x4701ea,_0x2e2189,_0x3cc6f5,_0x3204d5,_0x52057d,_0x40c1bb){var _0x5e7c84,_0x5989db,_0x5d24b8,_0x18bef8;_0x52057d['remoteUri']=intUtil[_0xc164('0x53')](_0x52057d[_0xc164('0x52')]);_0x52057d[_0xc164('0x54')]=intUtil[_0xc164('0x53')](_0x52057d[_0xc164('0x54')]);def[_0xc164('0x6d')]=util[_0xc164('0x23')](_0xc164('0x55'),_0x52057d[_0xc164('0x52')]);if(_0x40c1bb&&_0x40c1bb['recordingFormat']&&_0x40c1bb['recordingFormat']!=='none'){logger[_0xc164('0xd')](_0xc164('0x6e'),_0xc164('0x58'));_0x4701ea[_0xc164('0x59')]=util[_0xc164('0x23')](_0xc164('0x5a'),_0x52057d[_0xc164('0x54')],_0x4701ea['uniqueid'],md5(_0x4701ea[_0xc164('0x5b')]));}return getConnection(_0x52057d)[_0xc164('0x2d')](function(_0x4d0de7){_0x18bef8=_0x4d0de7;return getUser(_0x52057d,_0x3cc6f5[_0xc164('0xf')],_0x18bef8);})[_0xc164('0x2d')](function(_0x2bb2c3){_0x5e7c84=_0x2bb2c3;logger[_0xc164('0xd')]('The\x20User\x20ID\x20is:',_0x5e7c84['id']);return getEndUser(_0x52057d,_0x4701ea[_0xc164('0x6f')],_0x4701ea[_0xc164('0x70')],_0x18bef8);})['then'](function(_0x3f243b){_0x5989db=_0x3f243b;logger[_0xc164('0xd')](_0xc164('0x5f'),_0x5989db['id']);return getTicket(_0x52057d,_0x5e7c84,_0x5989db,_0x2e2189,_0x4701ea,_0x2e2189[_0xc164('0x60')],_0x18bef8,'Outbound');})['then'](function(_0x1d58cd){_0x5d24b8=_0x1d58cd;logger[_0xc164('0xd')](_0xc164('0x62'));logger['info'](_0xc164('0x63'),_0x5d24b8['id']);return setRelationship(_0x18bef8,_0x5e7c84,_0x5d24b8,'users');})['then'](function(){return setRelationship(_0x18bef8,_0x5989db,_0x5d24b8,'contacts');})[_0xc164('0x2d')](function(){return getServerInfo(_0x18bef8);})[_0xc164('0x2d')](function(_0x14fd96){var _0x58d251=parseInt(_0x14fd96[_0xc164('0x65')]['charAt'](0x0));var _0xe86ee9=util['format'](_0xc164('0x67'),_0x52057d[_0xc164('0x52')],_0x5d24b8['id']);if(_0x58d251>0x6){_0xe86ee9=util[_0xc164('0x23')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x52057d[_0xc164('0x52')],_0x5d24b8['id']);}logger['info'](_0xc164('0x6e'),_0xc164('0x69'));emit(util[_0xc164('0x23')](_0xc164('0x6a'),_0x3cc6f5[_0xc164('0xf')]),'trigger:browser:url',{'uri':_0xe86ee9});})['catch'](function(_0x5be9d7){logger[_0xc164('0x71')](_0xc164('0x6e'),JSON['stringify'](_0x5be9d7));});};exports[_0xc164('0x72')]=function(_0x1c0928,_0x4ad7d1,_0x8e95f1,_0x41ed24,_0x3c0aba,_0x549081){var _0xf0f04e,_0x472d4a,_0x3d8d1b,_0x23e4fe;_0x549081[_0xc164('0x52')]=intUtil['stripTrailingSlash'](_0x549081['remoteUri']);_0x549081[_0xc164('0x54')]=intUtil['stripTrailingSlash'](_0x549081[_0xc164('0x54')]);def['uri']=util['format'](_0xc164('0x55'),_0x549081['remoteUri']);if(_0x3c0aba&&_0x3c0aba['monitor_format']){logger[_0xc164('0xd')]('['+_0x4ad7d1[_0xc164('0x73')]['toUpperCase']()+']',_0xc164('0x58'));_0x4ad7d1['recordingURL']=util[_0xc164('0x23')](_0xc164('0x5a'),_0x549081[_0xc164('0x54')],_0x4ad7d1[_0xc164('0x5b')],md5(_0x4ad7d1[_0xc164('0x5b')]));}else{_0x4ad7d1[_0xc164('0x59')]='';}return getConnection(_0x549081)[_0xc164('0x2d')](function(_0x433d71){_0x23e4fe=_0x433d71;if(!_[_0xc164('0x29')](_0x41ed24)){return getUser(_0x549081,_0x41ed24[_0xc164('0xf')],_0x23e4fe);}else{return getUser(_0x549081,null,_0x23e4fe);}})[_0xc164('0x2d')](function(_0x5f2550){_0xf0f04e=_0x5f2550;logger[_0xc164('0xd')](_0xc164('0x5c'),_0xf0f04e['id']);return getEndUser(_0x549081,_0x4ad7d1[_0xc164('0x5d')],_0x4ad7d1[_0xc164('0x5e')],_0x23e4fe);})[_0xc164('0x2d')](function(_0x226e89){_0x472d4a=_0x226e89;logger['info']('The\x20Enduser\x20ID\x20is:',_0x472d4a['id']);return getTicket(_0x549081,_0xf0f04e,_0x472d4a,_0x8e95f1,_0x4ad7d1,_0x8e95f1[_0xc164('0x60')],_0x23e4fe,_0xc164('0x61'));})[_0xc164('0x2d')](function(_0x9e3346){_0x3d8d1b=_0x9e3346;logger[_0xc164('0xd')](_0xc164('0x62'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x3d8d1b['id']);return setRelationship(_0x23e4fe,_0xf0f04e,_0x3d8d1b,_0xc164('0x64'));})[_0xc164('0x2d')](function(){return setRelationship(_0x23e4fe,_0x472d4a,_0x3d8d1b,_0xc164('0x74'));})[_0xc164('0x2d')](function(){return getServerInfo(_0x23e4fe);})[_0xc164('0x6c')](function(_0x3c5c9b){logger[_0xc164('0x71')]('['+_0x4ad7d1['lastevent']['toUpperCase']()+']',JSON[_0xc164('0x21')](_0x3c5c9b));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/util.js b/server/services/ami/trigger/integration/util.js index fc23ff6..4745c31 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 _0x9789=['push','content','variable','variableName','toString','type','Variable','name','toLowerCase','keyValue','keyType','format','key','keyContent','%s:\x20%s','customVariable','join','slice','substring','lastIndexOf','validateEmail','isNil','test','lodash','util','length','string'];(function(_0x188917,_0x1ec7cf){var _0x4ff346=function(_0x1ee5b2){while(--_0x1ee5b2){_0x188917['push'](_0x188917['shift']());}};_0x4ff346(++_0x1ec7cf);}(_0x9789,0xd4));var _0x9978=function(_0x53a325,_0x53bb14){_0x53a325=_0x53a325-0x0;var _0x4b5fdc=_0x9789[_0x53a325];return _0x4b5fdc;};'use strict';var _=require(_0x9978('0x0'));var util=require(_0x9978('0x1'));exports['getString']=function(_0x1827a3,_0x2c9dff,_0x474c7b){var _0x51a0ad=[];if(_0x1827a3[_0x9978('0x2')]>0x0){var _0x36dbf2=_['sortBy'](_0x1827a3,['id']);for(var _0x54a0d5=0x0;_0x54a0d5<_0x36dbf2[_0x9978('0x2')];_0x54a0d5++){var _0x560c0e=_0x36dbf2[_0x54a0d5];if(_0x560c0e['type']===_0x9978('0x3')){_0x51a0ad[_0x9978('0x4')](_0x560c0e[_0x9978('0x5')]);}else if(_0x560c0e['type']===_0x9978('0x6')&&_0x560c0e[_0x9978('0x7')]){_0x2c9dff[_0x560c0e[_0x9978('0x7')]]&&_0x51a0ad[_0x9978('0x4')](_0x2c9dff[_0x560c0e[_0x9978('0x7')]][_0x9978('0x8')]());}else if(_0x560c0e[_0x9978('0x9')]==='customVariable'&&_0x560c0e[_0x9978('0xa')]&&_0x560c0e[_0x9978('0xa')][_0x9978('0xb')]){_0x2c9dff[_0x560c0e['Variable']['name'][_0x9978('0xc')]()]&&_0x51a0ad[_0x9978('0x4')](_0x2c9dff[_0x560c0e[_0x9978('0xa')][_0x9978('0xb')][_0x9978('0xc')]()][_0x9978('0x8')]());}else if(_0x560c0e[_0x9978('0x9')]===_0x9978('0xd')){if(_0x560c0e[_0x9978('0xe')]===_0x9978('0x3')&&_0x560c0e['key']){_0x51a0ad[_0x9978('0x4')](util[_0x9978('0xf')]('%s:\x20%s',_0x560c0e[_0x9978('0x10')],_0x560c0e[_0x9978('0x11')]));}else if(_0x560c0e[_0x9978('0xe')]===_0x9978('0x6')&&_0x560c0e[_0x9978('0x7')]&&_0x560c0e[_0x9978('0x10')]){_0x2c9dff[_0x560c0e[_0x9978('0x7')]]&&_0x51a0ad[_0x9978('0x4')](util[_0x9978('0xf')](_0x9978('0x12'),_0x560c0e['key'],_0x2c9dff[_0x560c0e[_0x9978('0x7')]]));}else if(_0x560c0e[_0x9978('0xe')]===_0x9978('0x13')&&_0x560c0e[_0x9978('0xa')]&&_0x560c0e['Variable'][_0x9978('0xb')]&&_0x560c0e[_0x9978('0x10')]){_0x2c9dff[_0x560c0e['Variable'][_0x9978('0xb')]['toLowerCase']()]&&_0x51a0ad['push'](util[_0x9978('0xf')](_0x9978('0x12'),_0x560c0e[_0x9978('0x10')],_0x2c9dff[_0x560c0e[_0x9978('0xa')][_0x9978('0xb')][_0x9978('0xc')]()]));}}}}return _0x51a0ad[_0x9978('0x14')](_0x474c7b);};exports['stripTrailingSlash']=function(_0x5f19ad){var _0x10b2e9=_0x5f19ad[_0x9978('0x15')](-0x1);if(_0x10b2e9==='/'){_0x5f19ad=_0x5f19ad[_0x9978('0x16')](0x0,_0x5f19ad[_0x9978('0x17')](_0x10b2e9));}return _0x5f19ad;};exports[_0x9978('0x18')]=function(_0x4d3e79){if(!_[_0x9978('0x19')](_0x4d3e79)&&_0x4d3e79!==''){var _0x306ba4=/^(([^<>()\[\]\\.,;:\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 _0x306ba4[_0x9978('0x1a')](String(_0x4d3e79)['toLowerCase']());}else{return![];}}; \ No newline at end of file +var _0x4fe7=['key','stripTrailingSlash','slice','lastIndexOf','validateEmail','isNil','test','lodash','util','getString','length','type','push','content','variableName','toString','customVariable','Variable','name','toLowerCase','keyType','string','format','%s:\x20%s','keyContent','variable'];(function(_0xf44d98,_0x12a472){var _0x5ebb04=function(_0x930c33){while(--_0x930c33){_0xf44d98['push'](_0xf44d98['shift']());}};_0x5ebb04(++_0x12a472);}(_0x4fe7,0x13f));var _0x74fe=function(_0x30dbf1,_0x3601d0){_0x30dbf1=_0x30dbf1-0x0;var _0x285b90=_0x4fe7[_0x30dbf1];return _0x285b90;};'use strict';var _=require(_0x74fe('0x0'));var util=require(_0x74fe('0x1'));exports[_0x74fe('0x2')]=function(_0x4a710e,_0x4b0d4b,_0x365354){var _0x300748=[];if(_0x4a710e[_0x74fe('0x3')]>0x0){var _0x33ec87=_['sortBy'](_0x4a710e,['id']);for(var _0x1a8887=0x0;_0x1a8887<_0x33ec87[_0x74fe('0x3')];_0x1a8887++){var _0x417643=_0x33ec87[_0x1a8887];if(_0x417643[_0x74fe('0x4')]==='string'){_0x300748[_0x74fe('0x5')](_0x417643[_0x74fe('0x6')]);}else if(_0x417643['type']==='variable'&&_0x417643[_0x74fe('0x7')]){_0x4b0d4b[_0x417643['variableName']]&&_0x300748[_0x74fe('0x5')](_0x4b0d4b[_0x417643[_0x74fe('0x7')]][_0x74fe('0x8')]());}else if(_0x417643[_0x74fe('0x4')]===_0x74fe('0x9')&&_0x417643[_0x74fe('0xa')]&&_0x417643[_0x74fe('0xa')]['name']){_0x4b0d4b[_0x417643[_0x74fe('0xa')][_0x74fe('0xb')][_0x74fe('0xc')]()]&&_0x300748[_0x74fe('0x5')](_0x4b0d4b[_0x417643[_0x74fe('0xa')][_0x74fe('0xb')][_0x74fe('0xc')]()][_0x74fe('0x8')]());}else if(_0x417643[_0x74fe('0x4')]==='keyValue'){if(_0x417643[_0x74fe('0xd')]===_0x74fe('0xe')&&_0x417643['key']){_0x300748[_0x74fe('0x5')](util[_0x74fe('0xf')](_0x74fe('0x10'),_0x417643['key'],_0x417643[_0x74fe('0x11')]));}else if(_0x417643[_0x74fe('0xd')]===_0x74fe('0x12')&&_0x417643['variableName']&&_0x417643[_0x74fe('0x13')]){_0x4b0d4b[_0x417643[_0x74fe('0x7')]]&&_0x300748[_0x74fe('0x5')](util[_0x74fe('0xf')](_0x74fe('0x10'),_0x417643['key'],_0x4b0d4b[_0x417643['variableName']]));}else if(_0x417643['keyType']==='customVariable'&&_0x417643[_0x74fe('0xa')]&&_0x417643[_0x74fe('0xa')][_0x74fe('0xb')]&&_0x417643['key']){_0x4b0d4b[_0x417643[_0x74fe('0xa')][_0x74fe('0xb')][_0x74fe('0xc')]()]&&_0x300748[_0x74fe('0x5')](util[_0x74fe('0xf')](_0x74fe('0x10'),_0x417643['key'],_0x4b0d4b[_0x417643[_0x74fe('0xa')][_0x74fe('0xb')][_0x74fe('0xc')]()]));}}}}return _0x300748['join'](_0x365354);};exports[_0x74fe('0x14')]=function(_0x26c398){var _0x706edf=_0x26c398[_0x74fe('0x15')](-0x1);if(_0x706edf==='/'){_0x26c398=_0x26c398['substring'](0x0,_0x26c398[_0x74fe('0x16')](_0x706edf));}return _0x26c398;};exports[_0x74fe('0x17')]=function(_0x4a138c){if(!_[_0x74fe('0x18')](_0x4a138c)&&_0x4a138c!==''){var _0x2b44dd=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return _0x2b44dd[_0x74fe('0x19')](String(_0x4a138c)[_0x74fe('0xc')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 78d1fdf..9eb7fa5 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(_0x586106,_0x23eba5){var _0x6be57f=function(_0x35e7a9){while(--_0x35e7a9){_0x586106['push'](_0x586106['shift']());}};_0x6be57f(++_0x23eba5);}(_0xe706,0xa3));var _0x6e70=function(_0x4667bd,_0xec80ab){_0x4667bd=_0x4667bd-0x0;var _0x4ce09b=_0xe706[_0x4667bd];return _0x4ce09b;};'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 _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x47c329,_0x31dcda){var _0x3a4356=function(_0x16884d){while(--_0x16884d){_0x47c329['push'](_0x47c329['shift']());}};_0x3a4356(++_0x31dcda);}(_0xe706,0xa3));var _0x6e70=function(_0x96f54d,_0x5e5d21){_0x96f54d=_0x96f54d-0x0;var _0xdb885c=_0xe706[_0x96f54d];return _0xdb885c;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index e112dcb..03bacee 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 _0x6d01=['password','%s:%s','username','Basic\x20%s','toString','debug','[HTTP]','stringify','GET','includes','string','type','nameField','toLowerCase','content','picklist','idField','customField','custom_fields','push','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','uniqueid','The\x20User\x20ID\x20is:','destcalleridnum','newTab','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','request-promise','md5','../../../../config/environment','../../../../config/logger','zendesk','defaults','redis','localhost','socket.io-emitter','emit','application/json','info','format','%s/tickets.json','Tags','name','getString','Subjects','Descriptions','Fields','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','remoteUri','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','agent','%s/users/me.json','then','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','type:user\x20role:end-user\x20phone:%s','results','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','POST','Caller\x20-\x20%s','Enduser\x20created.'];(function(_0x2c697e,_0x5849e0){var _0x38e432=function(_0xd41cd3){while(--_0xd41cd3){_0x2c697e['push'](_0x2c697e['shift']());}};_0x38e432(++_0x5849e0);}(_0x6d01,0x115));var _0x16d0=function(_0x470f19,_0x3faa05){_0x470f19=_0x470f19-0x0;var _0x448606=_0x6d01[_0x470f19];return _0x448606;};'use strict';var _=require('lodash');var rp=require(_0x16d0('0x0'));var md5=require(_0x16d0('0x1'));var util=require('util');var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x16d0('0x2'));var logger=require(_0x16d0('0x3'))(_0x16d0('0x4'));config['redis']=_[_0x16d0('0x5')](config[_0x16d0('0x6')],{'host':_0x16d0('0x7'),'port':0x18eb});var io=require(_0x16d0('0x8'))(new Redis(config[_0x16d0('0x6')]));function emit(_0x48a624,_0x581ce3,_0x5fa44b){io['to'](_0x48a624)[_0x16d0('0x9')](_0x581ce3,_0x5fa44b);}var headers={'Content-Type':_0x16d0('0xa'),'Accept':_0x16d0('0xa')};function getTicket(_0x39db7a,_0x18a8b6,_0x2bc839,_0x55738e,_0x15d529){logger[_0x16d0('0xb')]('Creating\x20new\x20ticket...');return request({'uri':util[_0x16d0('0xc')](_0x16d0('0xd'),_0x39db7a['remoteUri']),'method':'POST','body':{'ticket':_['merge']({'requester_id':_0x2bc839['id'],'submitter_id':_0x18a8b6?_0x18a8b6['id']:undefined,'assignee_id':_0x18a8b6?_0x18a8b6['id']:undefined,'tags':getTags(_0x55738e[_0x16d0('0xe')],_0x16d0('0xf')),'subject':intUtil[_0x16d0('0x10')](_0x55738e[_0x16d0('0x11')],_0x15d529,'\x20'),'description':intUtil['getString'](_0x55738e['Descriptions'],_0x15d529,'\x0a'),'comment':{'public':![],'body':intUtil[_0x16d0('0x10')](_0x55738e[_0x16d0('0x12')],_0x15d529,'\x0a')}},getCustomFields(_0x55738e[_0x16d0('0x13')],_0x15d529))}})['then'](function(_0x19a152){logger[_0x16d0('0xb')](_0x16d0('0x14'));return _0x19a152[_0x16d0('0x15')];});}function getUser(_0x3019e0,_0x2ab72f){if(intUtil[_0x16d0('0x16')](_0x2ab72f)){logger[_0x16d0('0xb')](_0x16d0('0x17'),_0x2ab72f);return request({'uri':util[_0x16d0('0xc')](_0x16d0('0x18'),_0x3019e0[_0x16d0('0x19')]),'qs':{'query':util[_0x16d0('0xc')](_0x16d0('0x1a'),_0x2ab72f)}})['then'](function(_0x13731b){if(_0x13731b[_0x16d0('0x1b')]){logger[_0x16d0('0xb')](_0x16d0('0x1c'));return _['find'](_0x13731b['results'],{'email':_0x2ab72f,'role':_0x16d0('0x1d')});}else{logger[_0x16d0('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x16d0('0x1e'),_0x3019e0[_0x16d0('0x19')])})[_0x16d0('0x1f')](function(_0x36b466){logger[_0x16d0('0xb')](_0x16d0('0x20'));return _0x36b466[_0x16d0('0x21')];});}});}else{logger[_0x16d0('0xb')](_0x16d0('0x22'));return request({'uri':util['format'](_0x16d0('0x1e'),_0x3019e0[_0x16d0('0x19')])})[_0x16d0('0x1f')](function(_0x6e2305){logger[_0x16d0('0xb')]('Admin\x20account\x20selected.');return _0x6e2305[_0x16d0('0x21')];});}}function getEndUser(_0x46b1a9,_0x36ae01,_0xb17bf5){logger[_0x16d0('0xb')]('Searching\x20enduser\x20with\x20phone',_0xb17bf5);return request({'uri':util[_0x16d0('0xc')](_0x16d0('0x18'),_0x46b1a9[_0x16d0('0x19')]),'qs':{'query':util[_0x16d0('0xc')](_0x16d0('0x23'),_0xb17bf5)}})['then'](function(_0x14f340){var _0x36f131;if(_0x14f340[_0x16d0('0x24')][_0x16d0('0x25')]){_0x14f340[_0x16d0('0x24')]=_[_0x16d0('0x26')](_0x14f340[_0x16d0('0x24')],{'suspended':![],'role':_0x16d0('0x27')});if(_0x14f340[_0x16d0('0x24')][_0x16d0('0x25')]){_0x36f131=_[_0x16d0('0x28')](_0x14f340[_0x16d0('0x24')]);}}if(_0x36f131){logger[_0x16d0('0xb')](_0x16d0('0x29'));return _0x36f131;}else{logger[_0x16d0('0xb')](_0x16d0('0x2a'));return request({'uri':util['format'](_0x16d0('0x2b'),_0x46b1a9[_0x16d0('0x19')]),'method':_0x16d0('0x2c'),'body':{'user':{'role':_0x16d0('0x27'),'name':util[_0x16d0('0xc')](_0x16d0('0x2d'),_0x36ae01||_0xb17bf5),'phone':_0xb17bf5}}})[_0x16d0('0x1f')](function(_0x25ea3e){logger[_0x16d0('0xb')](_0x16d0('0x2e'));return _0x25ea3e['user'];});}});}function getAuth(_0x152cd4){var _0x38ef0d;if(_0x152cd4['authType']===_0x16d0('0x2f')){_0x38ef0d=util['format'](_0x16d0('0x30'),_0x152cd4[_0x16d0('0x31')],_0x152cd4[_0x16d0('0x2f')]);}else if(_0x152cd4['authType']==='token'){_0x38ef0d=util['format']('%s/token:%s',_0x152cd4[_0x16d0('0x31')],_0x152cd4['token']);}return util[_0x16d0('0xc')](_0x16d0('0x32'),new Buffer(_0x38ef0d)[_0x16d0('0x33')]('base64'));}function request(_0x17c510){logger[_0x16d0('0x34')](_0x16d0('0x35'),JSON[_0x16d0('0x36')](_0x17c510));return rp(_[_0x16d0('0x5')](_0x17c510,{'method':_0x16d0('0x37'),'headers':headers,'json':!![]}));}function getTags(_0x234a75,_0x486a37){var _0x25629f=[];if(_0x234a75&&_0x234a75['length']>0x0){_0x25629f=_['map'](_0x234a75,_0x486a37);}return _0x25629f;}function getCustomFields(_0x201327,_0x27606a){var _0x2a376e=[];var _0x5e1feb={'custom_fields':[]};if(_0x201327[_0x16d0('0x25')]>0x0){_['forEach'](_0x201327,function(_0x1bd2c5){if(_[_0x16d0('0x38')]([_0x16d0('0x39'),'picklist'],_0x1bd2c5[_0x16d0('0x3a')])&&_0x1bd2c5['nameField']&&!_0x1bd2c5['customField']){_0x5e1feb[_0x1bd2c5[_0x16d0('0x3b')][_0x16d0('0x3c')]()]=_0x1bd2c5[_0x16d0('0x3d')][_0x16d0('0x33')]();}else if(_[_0x16d0('0x38')](['string',_0x16d0('0x3e')],_0x1bd2c5[_0x16d0('0x3a')])&&_0x1bd2c5[_0x16d0('0x3f')]&&_0x1bd2c5[_0x16d0('0x40')]){_0x5e1feb[_0x16d0('0x41')][_0x16d0('0x42')]({'id':_0x1bd2c5[_0x16d0('0x3f')],'value':_0x1bd2c5[_0x16d0('0x3d')][_0x16d0('0x33')]()});}else if(_0x1bd2c5['type']===_0x16d0('0x43')&&_0x1bd2c5[_0x16d0('0x44')]&&_0x1bd2c5[_0x16d0('0x3f')]&&_0x1bd2c5[_0x16d0('0x40')]){_0x27606a[_0x1bd2c5['variableName']]&&_0x5e1feb[_0x16d0('0x41')][_0x16d0('0x42')]({'id':_0x1bd2c5[_0x16d0('0x3f')],'value':_0x27606a[_0x1bd2c5['variableName']][_0x16d0('0x33')]()});}else if(_0x1bd2c5[_0x16d0('0x3a')]===_0x16d0('0x45')&&_0x1bd2c5[_0x16d0('0x46')]&&_0x1bd2c5[_0x16d0('0x46')][_0x16d0('0xf')]&&_0x1bd2c5[_0x16d0('0x3f')]&&_0x1bd2c5['customField']){_0x27606a[_0x1bd2c5[_0x16d0('0x46')][_0x16d0('0xf')][_0x16d0('0x3c')]()]&&_0x5e1feb[_0x16d0('0x41')][_0x16d0('0x42')]({'id':_0x1bd2c5['idField'],'value':_0x27606a[_0x1bd2c5[_0x16d0('0x46')][_0x16d0('0xf')][_0x16d0('0x3c')]()][_0x16d0('0x33')]()});}});}return _0x5e1feb;}exports[_0x16d0('0x47')]=function(_0x3f33f7,_0x3c7feb,_0x320acd,_0x3374e9,_0x3f6d10,_0x3d2193){var _0x3d5054,_0x168d82;_0x3d2193[_0x16d0('0x19')]=intUtil[_0x16d0('0x48')](_0x3d2193[_0x16d0('0x19')]);_0x3d2193[_0x16d0('0x49')]=intUtil[_0x16d0('0x48')](_0x3d2193[_0x16d0('0x49')]);if(_0x3f6d10&&_0x3f6d10[_0x16d0('0x4a')]){logger['info'](_0x16d0('0x4b'),'Recording\x20is\x20enabled!');_0x3c7feb[_0x16d0('0x4c')]=util['format'](_0x16d0('0x4d'),_0x3d2193[_0x16d0('0x49')],_0x3c7feb['uniqueid'],md5(_0x3c7feb['uniqueid']));}else{_0x3c7feb[_0x16d0('0x4c')]='';}headers['Authorization']=getAuth(_0x3d2193);return getUser(_0x3d2193,_0x3374e9[_0x16d0('0x4e')])[_0x16d0('0x1f')](function(_0x22135e){_0x3d5054=_0x22135e;logger['info']('The\x20User\x20ID\x20is:',_0x3d5054['id']);return getEndUser(_0x3d2193,_0x3c7feb[_0x16d0('0x4f')],_0x3c7feb['calleridnum']);})[_0x16d0('0x1f')](function(_0x44bdee){_0x168d82=_0x44bdee;logger[_0x16d0('0xb')](_0x16d0('0x50'),_0x168d82['id']);return getTicket(_0x3d2193,_0x3d5054,_0x168d82,_0x320acd,_0x3c7feb);})[_0x16d0('0x1f')](function(_0xbd16bb){if(_0xbd16bb){logger[_0x16d0('0xb')](_0x16d0('0x51'),_0xbd16bb['id']);switch(_0x3d2193[_0x16d0('0x3a')]){case _0x16d0('0x52'):logger[_0x16d0('0xb')](_0x16d0('0x4b'),_0x16d0('0x53'));return request({'uri':util[_0x16d0('0xc')](_0x16d0('0x54'),_0x3d2193['remoteUri'],_0x3d5054['id'],_0xbd16bb['id']),'method':_0x16d0('0x2c')});case'newTab':logger[_0x16d0('0xb')](_0x16d0('0x4b'),_0x16d0('0x55'));emit(util[_0x16d0('0xc')](_0x16d0('0x56'),_0x3374e9[_0x16d0('0xf')]),_0x16d0('0x57'),{'uri':util['format']('%s/agent/tickets/%s',_0x3d2193['remoteUri'][_0x16d0('0x58')](_0x16d0('0x59'),''),_0xbd16bb['id'])});break;default:logger[_0x16d0('0x5a')]('[QUEUE]',_0x16d0('0x5b'));}}})[_0x16d0('0x5c')](function(_0x415e01){logger[_0x16d0('0x5a')](_0x16d0('0x5d'),util[_0x16d0('0x5e')](_0x415e01,{'showHidden':!![],'depth':null}));});};exports[_0x16d0('0x5f')]=function(_0x4eab29,_0x5ae16a,_0x40d893,_0x461655,_0x30d6eb,_0x147df5,_0x244d0e){var _0x41d20c,_0x235d6f;_0x147df5['remoteUri']=intUtil['stripTrailingSlash'](_0x147df5[_0x16d0('0x19')]);_0x147df5[_0x16d0('0x49')]=intUtil[_0x16d0('0x48')](_0x147df5['serverUrl']);if(_0x244d0e&&_0x244d0e[_0x16d0('0x60')]&&_0x244d0e[_0x16d0('0x60')]!=='none'){logger[_0x16d0('0xb')](_0x16d0('0x61'),_0x16d0('0x62'));_0x5ae16a[_0x16d0('0x4c')]=util[_0x16d0('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x147df5[_0x16d0('0x49')],_0x5ae16a[_0x16d0('0x63')],md5(_0x5ae16a['uniqueid']));}headers['Authorization']=getAuth(_0x147df5);return getUser(_0x147df5,_0x461655[_0x16d0('0x4e')])[_0x16d0('0x1f')](function(_0x43b62d){_0x41d20c=_0x43b62d;logger[_0x16d0('0xb')](_0x16d0('0x64'),_0x41d20c['id']);return getEndUser(_0x147df5,_0x5ae16a['destcalleridname'],_0x5ae16a[_0x16d0('0x65')]);})[_0x16d0('0x1f')](function(_0xd4bbac){_0x235d6f=_0xd4bbac;logger['info'](_0x16d0('0x50'),_0x235d6f['id']);return getTicket(_0x147df5,_0x41d20c,_0x235d6f,_0x40d893,_0x5ae16a);})[_0x16d0('0x1f')](function(_0x2600e4){if(_0x2600e4){logger['info'](_0x16d0('0x51'),_0x2600e4['id']);switch(_0x147df5[_0x16d0('0x3a')]){case _0x16d0('0x52'):logger['info']('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x16d0('0xc')](_0x16d0('0x54'),_0x147df5[_0x16d0('0x19')],_0x41d20c['id'],_0x2600e4['id']),'method':_0x16d0('0x2c')});case _0x16d0('0x66'):logger[_0x16d0('0xb')](_0x16d0('0x61'),_0x16d0('0x55'));emit(util[_0x16d0('0xc')]('user:%s',_0x461655[_0x16d0('0xf')]),_0x16d0('0x57'),{'uri':util[_0x16d0('0xc')]('%s/agent/tickets/%s',_0x147df5['remoteUri'][_0x16d0('0x58')](_0x16d0('0x59'),''),_0x2600e4['id'])});break;default:logger[_0x16d0('0x5a')](_0x16d0('0x61'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x4a9cb3){logger[_0x16d0('0x5a')](_0x16d0('0x67'),util['inspect'](_0x4a9cb3,{'showHidden':!![],'depth':null}));});};exports[_0x16d0('0x68')]=function(_0x2183c0,_0xfc58bf,_0x51eb54,_0x4ee1bb,_0x4ee97a,_0xcc428f){var _0x5859bc,_0x2653d3;_0xcc428f['remoteUri']=intUtil['stripTrailingSlash'](_0xcc428f['remoteUri']);_0xcc428f['serverUrl']=intUtil[_0x16d0('0x48')](_0xcc428f['serverUrl']);if(_0x4ee97a&&_0x4ee97a[_0x16d0('0x4a')]){logger[_0x16d0('0xb')]('['+_0xfc58bf[_0x16d0('0x69')][_0x16d0('0x6a')]()+']',_0x16d0('0x62'));_0xfc58bf[_0x16d0('0x4c')]=util[_0x16d0('0xc')](_0x16d0('0x4d'),_0xcc428f[_0x16d0('0x49')],_0xfc58bf[_0x16d0('0x63')],md5(_0xfc58bf[_0x16d0('0x63')]));}else{_0xfc58bf[_0x16d0('0x4c')]='';}headers['Authorization']=getAuth(_0xcc428f);return getUser(_0xcc428f)[_0x16d0('0x1f')](function(_0x260ac4){_0x5859bc=_0x260ac4;logger[_0x16d0('0xb')](_0x16d0('0x64'),_0x5859bc['id']);return getEndUser(_0xcc428f,_0xfc58bf[_0x16d0('0x4f')],_0xfc58bf['calleridnum']);})[_0x16d0('0x1f')](function(_0x2c8c6f){_0x2653d3=_0x2c8c6f;logger[_0x16d0('0xb')](_0x16d0('0x50'),_0x2653d3['id']);return getTicket(_0xcc428f,_0x5859bc,_0x2653d3,_0x51eb54,_0xfc58bf);})['then'](function(_0x5232de){if(_0x5232de){logger['info'](_0x16d0('0x51'),_0x5232de['id']);}})[_0x16d0('0x5c')](function(_0x3ee8ea){logger['error']('['+_0xfc58bf[_0x16d0('0x69')][_0x16d0('0x6a')]()+']'+_0x16d0('0x6b'),util[_0x16d0('0x5e')](_0x3ee8ea,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x328b=['%s/agent/tickets/%s','replace','Zendesk\x20account\x20type\x20not\x20recognized','catch','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','[OUTBOUND]','recordingURL','destcalleridname','destcalleridnum','/api/v2','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','The\x20User\x20ID\x20is:','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','application/json','info','Creating\x20new\x20ticket...','format','merge','Tags','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','%s/search.json','remoteUri','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','user','%s/users/me.json','Searching\x20enduser\x20with\x20phone','length','filter','end-user','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Enduser\x20created.','authType','password','username','token','Basic\x20%s','toString','debug','forEach','includes','picklist','type','nameField','customField','string','custom_fields','push','idField','content','variable','variableName','customVariable','Variable','toLowerCase','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url'];(function(_0x49b489,_0x1068e5){var _0x5994cd=function(_0x3765a2){while(--_0x3765a2){_0x49b489['push'](_0x49b489['shift']());}};_0x5994cd(++_0x1068e5);}(_0x328b,0x152));var _0xb328=function(_0x5c1449,_0x2af4b4){_0x5c1449=_0x5c1449-0x0;var _0x270473=_0x328b[_0x5c1449];return _0x270473;};'use strict';var _=require('lodash');var rp=require(_0xb328('0x0'));var md5=require(_0xb328('0x1'));var util=require(_0xb328('0x2'));var Redis=require(_0xb328('0x3'));var intUtil=require(_0xb328('0x4'));var config=require(_0xb328('0x5'));var logger=require(_0xb328('0x6'))('zendesk');config[_0xb328('0x7')]=_[_0xb328('0x8')](config[_0xb328('0x7')],{'host':_0xb328('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb328('0x7')]));function emit(_0x10074d,_0x1b0992,_0x11d989){io['to'](_0x10074d)['emit'](_0x1b0992,_0x11d989);}var headers={'Content-Type':_0xb328('0xa'),'Accept':'application/json'};function getTicket(_0x2bc156,_0x318730,_0x4e1eff,_0x54d1ab,_0x2e3e69){logger[_0xb328('0xb')](_0xb328('0xc'));return request({'uri':util[_0xb328('0xd')]('%s/tickets.json',_0x2bc156['remoteUri']),'method':'POST','body':{'ticket':_[_0xb328('0xe')]({'requester_id':_0x4e1eff['id'],'submitter_id':_0x318730?_0x318730['id']:undefined,'assignee_id':_0x318730?_0x318730['id']:undefined,'tags':getTags(_0x54d1ab[_0xb328('0xf')],_0xb328('0x10')),'subject':intUtil[_0xb328('0x11')](_0x54d1ab[_0xb328('0x12')],_0x2e3e69,'\x20'),'description':intUtil[_0xb328('0x11')](_0x54d1ab[_0xb328('0x13')],_0x2e3e69,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x54d1ab[_0xb328('0x13')],_0x2e3e69,'\x0a')}},getCustomFields(_0x54d1ab[_0xb328('0x14')],_0x2e3e69))}})[_0xb328('0x15')](function(_0xe7df8d){logger[_0xb328('0xb')](_0xb328('0x16'));return _0xe7df8d[_0xb328('0x17')];});}function getUser(_0x2913e7,_0x4a2911){if(intUtil[_0xb328('0x18')](_0x4a2911)){logger[_0xb328('0xb')]('Getting\x20agent\x20with\x20email',_0x4a2911);return request({'uri':util['format'](_0xb328('0x19'),_0x2913e7[_0xb328('0x1a')]),'qs':{'query':util[_0xb328('0xd')](_0xb328('0x1b'),_0x4a2911)}})['then'](function(_0x462679){if(_0x462679[_0xb328('0x1c')]){logger[_0xb328('0xb')](_0xb328('0x1d'));return _[_0xb328('0x1e')](_0x462679[_0xb328('0x1f')],{'email':_0x4a2911,'role':'agent'});}else{logger[_0xb328('0xb')](_0xb328('0x20'));return request({'uri':util[_0xb328('0xd')]('%s/users/me.json',_0x2913e7['remoteUri'])})[_0xb328('0x15')](function(_0x25750d){logger[_0xb328('0xb')](_0xb328('0x21'));return _0x25750d[_0xb328('0x22')];});}});}else{logger[_0xb328('0xb')](_0xb328('0x20'));return request({'uri':util[_0xb328('0xd')](_0xb328('0x23'),_0x2913e7['remoteUri'])})[_0xb328('0x15')](function(_0x306efa){logger[_0xb328('0xb')](_0xb328('0x21'));return _0x306efa[_0xb328('0x22')];});}}function getEndUser(_0x513255,_0x51fbe8,_0xad3e6b){logger[_0xb328('0xb')](_0xb328('0x24'),_0xad3e6b);return request({'uri':util['format'](_0xb328('0x19'),_0x513255['remoteUri']),'qs':{'query':util[_0xb328('0xd')]('type:user\x20role:end-user\x20phone:%s',_0xad3e6b)}})[_0xb328('0x15')](function(_0x3e6a50){var _0x34f3f4;if(_0x3e6a50[_0xb328('0x1f')][_0xb328('0x25')]){_0x3e6a50[_0xb328('0x1f')]=_[_0xb328('0x26')](_0x3e6a50[_0xb328('0x1f')],{'suspended':![],'role':_0xb328('0x27')});if(_0x3e6a50[_0xb328('0x1f')]['length']){_0x34f3f4=_['first'](_0x3e6a50[_0xb328('0x1f')]);}}if(_0x34f3f4){logger[_0xb328('0xb')](_0xb328('0x28'));return _0x34f3f4;}else{logger['info'](_0xb328('0x29'));return request({'uri':util['format']('%s/users.json',_0x513255['remoteUri']),'method':_0xb328('0x2a'),'body':{'user':{'role':_0xb328('0x27'),'name':util['format']('Caller\x20-\x20%s',_0x51fbe8||_0xad3e6b),'phone':_0xad3e6b}}})[_0xb328('0x15')](function(_0xda3e4a){logger[_0xb328('0xb')](_0xb328('0x2b'));return _0xda3e4a[_0xb328('0x22')];});}});}function getAuth(_0x37dba1){var _0x28827f;if(_0x37dba1[_0xb328('0x2c')]===_0xb328('0x2d')){_0x28827f=util['format']('%s:%s',_0x37dba1[_0xb328('0x2e')],_0x37dba1[_0xb328('0x2d')]);}else if(_0x37dba1[_0xb328('0x2c')]==='token'){_0x28827f=util[_0xb328('0xd')]('%s/token:%s',_0x37dba1[_0xb328('0x2e')],_0x37dba1[_0xb328('0x2f')]);}return util[_0xb328('0xd')](_0xb328('0x30'),new Buffer(_0x28827f)[_0xb328('0x31')]('base64'));}function request(_0x11ceb7){logger[_0xb328('0x32')]('[HTTP]',JSON['stringify'](_0x11ceb7));return rp(_[_0xb328('0x8')](_0x11ceb7,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x2eea48,_0x33ec22){var _0x34d39f=[];if(_0x2eea48&&_0x2eea48[_0xb328('0x25')]>0x0){_0x34d39f=_['map'](_0x2eea48,_0x33ec22);}return _0x34d39f;}function getCustomFields(_0x364ed5,_0x33771c){var _0x3173a1=[];var _0x22b301={'custom_fields':[]};if(_0x364ed5['length']>0x0){_[_0xb328('0x33')](_0x364ed5,function(_0x2dcbbc){if(_[_0xb328('0x34')](['string',_0xb328('0x35')],_0x2dcbbc[_0xb328('0x36')])&&_0x2dcbbc[_0xb328('0x37')]&&!_0x2dcbbc[_0xb328('0x38')]){_0x22b301[_0x2dcbbc[_0xb328('0x37')]['toLowerCase']()]=_0x2dcbbc['content'][_0xb328('0x31')]();}else if(_[_0xb328('0x34')]([_0xb328('0x39'),_0xb328('0x35')],_0x2dcbbc[_0xb328('0x36')])&&_0x2dcbbc['idField']&&_0x2dcbbc[_0xb328('0x38')]){_0x22b301[_0xb328('0x3a')][_0xb328('0x3b')]({'id':_0x2dcbbc[_0xb328('0x3c')],'value':_0x2dcbbc[_0xb328('0x3d')][_0xb328('0x31')]()});}else if(_0x2dcbbc[_0xb328('0x36')]===_0xb328('0x3e')&&_0x2dcbbc['variableName']&&_0x2dcbbc[_0xb328('0x3c')]&&_0x2dcbbc[_0xb328('0x38')]){_0x33771c[_0x2dcbbc[_0xb328('0x3f')]]&&_0x22b301[_0xb328('0x3a')][_0xb328('0x3b')]({'id':_0x2dcbbc[_0xb328('0x3c')],'value':_0x33771c[_0x2dcbbc[_0xb328('0x3f')]][_0xb328('0x31')]()});}else if(_0x2dcbbc[_0xb328('0x36')]===_0xb328('0x40')&&_0x2dcbbc[_0xb328('0x41')]&&_0x2dcbbc[_0xb328('0x41')][_0xb328('0x10')]&&_0x2dcbbc[_0xb328('0x3c')]&&_0x2dcbbc[_0xb328('0x38')]){_0x33771c[_0x2dcbbc[_0xb328('0x41')][_0xb328('0x10')][_0xb328('0x42')]()]&&_0x22b301[_0xb328('0x3a')][_0xb328('0x3b')]({'id':_0x2dcbbc[_0xb328('0x3c')],'value':_0x33771c[_0x2dcbbc[_0xb328('0x41')][_0xb328('0x10')]['toLowerCase']()][_0xb328('0x31')]()});}});}return _0x22b301;}exports['queue']=function(_0x372b3c,_0x116baa,_0x34fbe8,_0x2d4ce7,_0x445359,_0x99f12a){var _0x184284,_0x48c5a2;_0x99f12a[_0xb328('0x1a')]=intUtil[_0xb328('0x43')](_0x99f12a['remoteUri']);_0x99f12a[_0xb328('0x44')]=intUtil[_0xb328('0x43')](_0x99f12a['serverUrl']);if(_0x445359&&_0x445359[_0xb328('0x45')]){logger[_0xb328('0xb')](_0xb328('0x46'),_0xb328('0x47'));_0x116baa['recordingURL']=util[_0xb328('0xd')](_0xb328('0x48'),_0x99f12a[_0xb328('0x44')],_0x116baa['uniqueid'],md5(_0x116baa[_0xb328('0x49')]));}else{_0x116baa['recordingURL']='';}headers[_0xb328('0x4a')]=getAuth(_0x99f12a);return getUser(_0x99f12a,_0x2d4ce7[_0xb328('0x4b')])[_0xb328('0x15')](function(_0x38aebe){_0x184284=_0x38aebe;logger['info']('The\x20User\x20ID\x20is:',_0x184284['id']);return getEndUser(_0x99f12a,_0x116baa[_0xb328('0x4c')],_0x116baa[_0xb328('0x4d')]);})[_0xb328('0x15')](function(_0x5d3197){_0x48c5a2=_0x5d3197;logger['info'](_0xb328('0x4e'),_0x48c5a2['id']);return getTicket(_0x99f12a,_0x184284,_0x48c5a2,_0x34fbe8,_0x116baa);})[_0xb328('0x15')](function(_0x2e7bc6){if(_0x2e7bc6){logger[_0xb328('0xb')](_0xb328('0x4f'),_0x2e7bc6['id']);switch(_0x99f12a[_0xb328('0x36')]){case'integrationTab':logger[_0xb328('0xb')](_0xb328('0x46'),_0xb328('0x50'));return request({'uri':util['format'](_0xb328('0x51'),_0x99f12a[_0xb328('0x1a')],_0x184284['id'],_0x2e7bc6['id']),'method':_0xb328('0x2a')});case _0xb328('0x52'):logger[_0xb328('0xb')](_0xb328('0x46'),_0xb328('0x53'));emit(util[_0xb328('0xd')](_0xb328('0x54'),_0x2d4ce7[_0xb328('0x10')]),_0xb328('0x55'),{'uri':util[_0xb328('0xd')](_0xb328('0x56'),_0x99f12a[_0xb328('0x1a')][_0xb328('0x57')]('/api/v2',''),_0x2e7bc6['id'])});break;default:logger['error'](_0xb328('0x46'),_0xb328('0x58'));}}})[_0xb328('0x59')](function(_0x206368){logger[_0xb328('0x5a')](_0xb328('0x5b'),util[_0xb328('0x5c')](_0x206368,{'showHidden':!![],'depth':null}));});};exports[_0xb328('0x5d')]=function(_0x553d98,_0x1b5370,_0x4a6a70,_0x2d7436,_0x14c14e,_0x724b57,_0x41902a){var _0x179218,_0x3c6142;_0x724b57[_0xb328('0x1a')]=intUtil['stripTrailingSlash'](_0x724b57[_0xb328('0x1a')]);_0x724b57[_0xb328('0x44')]=intUtil['stripTrailingSlash'](_0x724b57[_0xb328('0x44')]);if(_0x41902a&&_0x41902a[_0xb328('0x5e')]&&_0x41902a[_0xb328('0x5e')]!=='none'){logger['info'](_0xb328('0x5f'),_0xb328('0x47'));_0x1b5370[_0xb328('0x60')]=util[_0xb328('0xd')](_0xb328('0x48'),_0x724b57[_0xb328('0x44')],_0x1b5370[_0xb328('0x49')],md5(_0x1b5370[_0xb328('0x49')]));}headers[_0xb328('0x4a')]=getAuth(_0x724b57);return getUser(_0x724b57,_0x2d7436[_0xb328('0x4b')])['then'](function(_0x1ae433){_0x179218=_0x1ae433;logger[_0xb328('0xb')]('The\x20User\x20ID\x20is:',_0x179218['id']);return getEndUser(_0x724b57,_0x1b5370[_0xb328('0x61')],_0x1b5370[_0xb328('0x62')]);})['then'](function(_0x374e1f){_0x3c6142=_0x374e1f;logger['info'](_0xb328('0x4e'),_0x3c6142['id']);return getTicket(_0x724b57,_0x179218,_0x3c6142,_0x4a6a70,_0x1b5370);})[_0xb328('0x15')](function(_0x5c24a9){if(_0x5c24a9){logger[_0xb328('0xb')](_0xb328('0x4f'),_0x5c24a9['id']);switch(_0x724b57['type']){case'integrationTab':logger[_0xb328('0xb')]('[OUTBOUND]',_0xb328('0x50'));return request({'uri':util['format'](_0xb328('0x51'),_0x724b57['remoteUri'],_0x179218['id'],_0x5c24a9['id']),'method':'POST'});case _0xb328('0x52'):logger['info'](_0xb328('0x5f'),_0xb328('0x53'));emit(util['format'](_0xb328('0x54'),_0x2d7436[_0xb328('0x10')]),_0xb328('0x55'),{'uri':util[_0xb328('0xd')](_0xb328('0x56'),_0x724b57[_0xb328('0x1a')]['replace'](_0xb328('0x63'),''),_0x5c24a9['id'])});break;default:logger[_0xb328('0x5a')](_0xb328('0x5f'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xb328('0x59')](function(_0x232142){logger[_0xb328('0x5a')](_0xb328('0x64'),util[_0xb328('0x5c')](_0x232142,{'showHidden':!![],'depth':null}));});};exports[_0xb328('0x65')]=function(_0x5250d7,_0x348042,_0x1cf7f8,_0x35c78d,_0x5939a3,_0x1d84be){var _0x467349,_0x27e2f8;_0x1d84be[_0xb328('0x1a')]=intUtil[_0xb328('0x43')](_0x1d84be[_0xb328('0x1a')]);_0x1d84be['serverUrl']=intUtil['stripTrailingSlash'](_0x1d84be[_0xb328('0x44')]);if(_0x5939a3&&_0x5939a3[_0xb328('0x45')]){logger['info']('['+_0x348042[_0xb328('0x66')]['toUpperCase']()+']',_0xb328('0x47'));_0x348042[_0xb328('0x60')]=util[_0xb328('0xd')](_0xb328('0x48'),_0x1d84be['serverUrl'],_0x348042[_0xb328('0x49')],md5(_0x348042['uniqueid']));}else{_0x348042['recordingURL']='';}headers[_0xb328('0x4a')]=getAuth(_0x1d84be);return getUser(_0x1d84be)['then'](function(_0x356bc8){_0x467349=_0x356bc8;logger[_0xb328('0xb')](_0xb328('0x67'),_0x467349['id']);return getEndUser(_0x1d84be,_0x348042[_0xb328('0x4c')],_0x348042[_0xb328('0x4d')]);})[_0xb328('0x15')](function(_0x1e5989){_0x27e2f8=_0x1e5989;logger['info'](_0xb328('0x4e'),_0x27e2f8['id']);return getTicket(_0x1d84be,_0x467349,_0x27e2f8,_0x1cf7f8,_0x348042);})[_0xb328('0x15')](function(_0x389c2f){if(_0x389c2f){logger['info'](_0xb328('0x4f'),_0x389c2f['id']);}})[_0xb328('0x59')](function(_0x4a9b98){logger[_0xb328('0x5a')]('['+_0x348042[_0xb328('0x66')][_0xb328('0x68')]()+']'+_0xb328('0x69'),util[_0xb328('0x5c')](_0x4a9b98,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zoho.js b/server/services/ami/trigger/integration/zoho.js index bbbfdd1..f635102 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 _0x1667=['Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','stringify','data','enduserType','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','Error:\x20','log','moduleSearch','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','https://www.zohoapis.','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','format','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','abandoned','Abandoned','Timeout','Call_Start_Time','outbound','agentcalledAt','Inbound','POST','/crm/v2/Calls','Call\x20created!','details','err','stack','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','/api/voice/recordings/','/downloads?type=uniqueid&token=','destcalleridname','destcalleridnum','user:%s','lastevent','toUpperCase','lodash','request-promise','md5','moment','ioredis','bluebird','../../../../config/environment','zoho','redis','defaults','socket.io-emitter','emit','debug','[HTTP]','length','includes','picklist','type','idField','content','toString','variable','variableName','Variable','name','toLowerCase','split','isNil','access_token','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','refreshToken','clientId','then','add','catch','error','Failing\x20creating\x20the\x20access_token','info','Search\x20user','GET','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile'];(function(_0x1eba92,_0x25fdd0){var _0x5a01d7=function(_0x4dc6ee){while(--_0x4dc6ee){_0x1eba92['push'](_0x1eba92['shift']());}};_0x5a01d7(++_0x25fdd0);}(_0x1667,0xfd));var _0x7166=function(_0x3e7804,_0x121853){_0x3e7804=_0x3e7804-0x0;var _0x56efda=_0x1667[_0x3e7804];return _0x56efda;};'use strict';var _=require(_0x7166('0x0'));var rp=require(_0x7166('0x1'));var md5=require(_0x7166('0x2'));var util=require('util');var intUtil=require('./util');var moment=require(_0x7166('0x3'));var Redis=require(_0x7166('0x4'));var BPromise=require(_0x7166('0x5'));var config=require(_0x7166('0x6'));var logger=require('../../../../config/logger')(_0x7166('0x7'));config[_0x7166('0x8')]=_[_0x7166('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x7166('0xa'))(new Redis(config[_0x7166('0x8')]));function emit(_0x2f43be,_0x43ed93,_0x3cc4c9){io['to'](_0x2f43be)[_0x7166('0xb')](_0x43ed93,_0x3cc4c9);}function request(_0x59ac5c){logger[_0x7166('0xc')](_0x7166('0xd'),JSON['stringify'](_0x59ac5c));return rp(_0x59ac5c);}function getCustomFields(_0x4edf3f,_0x2120f6){var _0x286d2c={};if(_0x4edf3f[_0x7166('0xe')]>0x0){_['forEach'](_0x4edf3f,function(_0x3926f4){if(_[_0x7166('0xf')](['string',_0x7166('0x10')],_0x3926f4[_0x7166('0x11')])&&_0x3926f4[_0x7166('0x12')]){_0x286d2c[_0x3926f4['idField']]=_0x3926f4[_0x7166('0x13')][_0x7166('0x14')]();}else if(_0x3926f4[_0x7166('0x11')]===_0x7166('0x15')&&_0x3926f4[_0x7166('0x16')]&&_0x3926f4['idField']&&_0x2120f6[_0x3926f4[_0x7166('0x16')]]){_0x286d2c[_0x3926f4[_0x7166('0x12')]]=_0x2120f6[_0x3926f4[_0x7166('0x16')]][_0x7166('0x14')]();}else if(_0x3926f4[_0x7166('0x11')]==='customVariable'&&_0x3926f4[_0x7166('0x17')]&&_0x3926f4['Variable'][_0x7166('0x18')]&&_0x3926f4[_0x7166('0x12')]&&_0x2120f6[_0x3926f4[_0x7166('0x17')]['name'][_0x7166('0x19')]()]){_0x286d2c[_0x3926f4[_0x7166('0x12')]]=_0x2120f6[_0x3926f4['Variable'][_0x7166('0x18')][_0x7166('0x19')]()][_0x7166('0x14')]();}});}return _0x286d2c;}function getName(_0x3fc78f){if(_0x3fc78f['indexOf']('\x20')>0x0){var _0x86b7e7=_0x3fc78f[_0x7166('0x1a')](/ (.+)/);if(_0x86b7e7[0x1]){return _0x86b7e7;}}return[_0x3fc78f,_0x3fc78f];}var accountsTokens={};function getAccessToken(_0x2e88bb){return new Promise(function(_0x5d5f60,_0x1678b3){if(!_[_0x7166('0x1b')](accountsTokens[_0x2e88bb['id']])&&!_[_0x7166('0x1b')](accountsTokens[_0x2e88bb['id']][_0x7166('0x1c')])){if(moment()['isBefore'](accountsTokens[_0x2e88bb['id']][_0x7166('0x1d')])){_0x5d5f60(accountsTokens[_0x2e88bb['id']][_0x7166('0x1c')]);}}var _0x1d11b5;switch(_0x2e88bb[_0x7166('0x1e')]){case'US':_0x1d11b5=_0x7166('0x1f');break;case'AU':_0x1d11b5='https://accounts.zoho.com.au';break;case'EU':_0x1d11b5=_0x7166('0x20');break;case'IN':_0x1d11b5=_0x7166('0x21');break;case'CN':_0x1d11b5=_0x7166('0x22');break;default:_0x1d11b5=_0x7166('0x20');break;}var _0x484382={'method':'POST','uri':_0x1d11b5+'/oauth/v2/token','qs':{'refresh_token':_0x2e88bb[_0x7166('0x23')],'client_id':_0x2e88bb[_0x7166('0x24')],'client_secret':_0x2e88bb['clientSecret'],'grant_type':'refresh_token'},'json':!![]};return rp(_0x484382)[_0x7166('0x25')](function(_0x504a58){accountsTokens[_0x2e88bb['id']]={'access_token':_0x504a58['access_token'],'expires_in':moment()[_0x7166('0x26')](_0x504a58[_0x7166('0x1d')],'seconds')};_0x5d5f60(_0x504a58['access_token']);})[_0x7166('0x27')](function(_0x1f6194){logger[_0x7166('0x28')](_0x7166('0x29'),_0x1f6194['stack']);_0x1678b3(_0x1f6194);});});}function getUser(_0x282664,_0x2077cc,_0x59b0c5,_0x209f9d){logger[_0x7166('0x2a')](_0x7166('0x2b'));return request({'method':_0x7166('0x2c'),'uri':util['format'](_0x7166('0x2d'),_0x2077cc),'qs':{'type':_0x7166('0x2e')},'headers':{'Authorization':_0x7166('0x2f')+_0x282664},'json':!![]})['then'](function(_0x1c329a){if(_0x1c329a[_0x7166('0x30')]){var _0x5cc736=-0x1;if(_[_0x7166('0x31')](_0x1c329a[_0x7166('0x30')])){if(!_[_0x7166('0x1b')](_0x209f9d)){_0x5cc736=_[_0x7166('0x32')](_0x1c329a['users'],function(_0x176f4f){return _0x176f4f[_0x7166('0x33')]===_0x209f9d;});}if(_0x5cc736>=0x0){logger[_0x7166('0x2a')](_0x7166('0x34'));}else{logger[_0x7166('0x2a')](_0x7166('0x35'));_0x5cc736=_[_0x7166('0x32')](_0x1c329a[_0x7166('0x30')],function(_0xee29f4){return _0xee29f4[_0x7166('0x36')][_0x7166('0x18')]===_0x7166('0x37');});}return _0x1c329a[_0x7166('0x30')][_0x5cc736];}else{if(_0x1c329a[_0x7166('0x38')][_0x7166('0x36')]['name']===_0x7166('0x37')){logger['info']('Using\x20the\x20admin\x20account!');user=_0x1c329a['user'];return user;}else{logger[_0x7166('0x28')](_0x7166('0x39'),JSON['stringify'](_0x1c329a));throw new Error(_0x7166('0x3a')+JSON[_0x7166('0x3b')](_0x1c329a));}}}else{logger['error'](_0x7166('0x39'),JSON[_0x7166('0x3b')](_0x1c329a));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x7166('0x3b')](_0x1c329a));}})[_0x7166('0x27')](function(_0x1cc751){console['error'](_0x1cc751);});}function getZohoUser(_0x134fc5,_0x49b010){return new BPromise(function(_0x5097f5,_0x3e3d5d){request(_0x134fc5)['then'](function(_0xbbde1c){var _0x36e22b=null;if(_0xbbde1c){_0x36e22b=_0xbbde1c[_0x7166('0x3c')][0x0];_0x36e22b[_0x7166('0x3d')]=_0x49b010;}_0x5097f5(_0x36e22b);})[_0x7166('0x27')](function(_0x3ea80f){_0x3e3d5d(_0x3ea80f);});});}function createEndUser(_0x439414,_0x40a1db,_0x5052cf,_0x1c63ef,_0x4bf748,_0x598e2f){var _0x5052cf=getName(_0x5052cf);return request({'method':'POST','uri':'https://www.zohoapis.'+_0x40a1db+_0x7166('0x3e')+_[_0x7166('0x3f')](_0x598e2f[_0x7166('0x40')])+'s','body':{'data':[{'Last_Name':_0x5052cf[0x1],'First_Name':_0x5052cf[0x0],'Phone':_0x1c63ef,'Owner':{'name':!_[_0x7166('0x1b')](_0x4bf748['role'][_0x7166('0x18')])?_0x4bf748[_0x7166('0x41')][_0x7166('0x18')]:!_[_0x7166('0x1b')](_0x4bf748[_0x7166('0x42')])?_0x4bf748['first_name']+'\x20'+_0x4bf748[_0x7166('0x43')]:_0x4bf748[_0x7166('0x43')],'id':_0x4bf748['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x439414},'json':!![]})[_0x7166('0x25')](function(_0x25b54f){if(_0x25b54f&&_0x25b54f[_0x7166('0x3c')][0x0][_0x7166('0x44')]===_0x7166('0x45')){var _0x1a3faa=_0x25b54f[_0x7166('0x3c')][0x0]['details'];_0x1a3faa['enduserType']=_[_0x7166('0x3f')](_0x598e2f[_0x7166('0x40')])+'s';return _0x1a3faa;}logger['error'](_0x7166('0x39'),JSON['stringify'](data));throw new Error(_0x7166('0x46')+JSON['stringify'](data));})[_0x7166('0x27')](function(_0x22b16c){console[_0x7166('0x47')]('CREATE\x20ERROR',_0x22b16c);});}function getEndUser(_0x1efc82,_0x2c2ad0,_0x2289f6,_0x442911,_0x4add80,_0x4158a1,_0x129caf){var _0x3bb592={'method':'GET','uri':'','headers':{'Authorization':_0x7166('0x2f')+_0x1efc82},'json':!![]};switch(_0x129caf[_0x7166('0x48')]){case'contact_lead':_0x3bb592['uri']='https://www.zohoapis.'+_0x2c2ad0+_0x7166('0x49')+_0x4add80+'))';return getZohoUser(_0x3bb592,_0x7166('0x4a'))[_0x7166('0x25')](function(_0x32df2b){if(_0x32df2b)return _0x32df2b;_0x3bb592[_0x7166('0x4b')]=_0x7166('0x4c')+_0x2c2ad0+_0x7166('0x4d')+_0x4add80+'))';return getZohoUser(_0x3bb592,_0x7166('0x4e'))[_0x7166('0x25')](function(_0x3ed3e2){if(_0x3ed3e2)return _0x3ed3e2;if(_0x129caf[_0x7166('0x40')]!=_0x7166('0x4f')){return createEndUser(_0x1efc82,_0x2c2ad0,_0x442911,_0x4add80,_0x4158a1,_0x129caf);}else{return{};}});});break;case _0x7166('0x50'):_0x3bb592['uri']='https://www.zohoapis.'+_0x2c2ad0+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x4add80+'))';return getZohoUser(_0x3bb592,_0x7166('0x4a'))[_0x7166('0x25')](function(_0x26c01b){if(_0x26c01b)return _0x26c01b;if(_0x129caf[_0x7166('0x40')]!=_0x7166('0x4f')){return createEndUser(_0x1efc82,_0x2c2ad0,_0x442911,_0x4add80,_0x4158a1,_0x129caf);}else{return{};}});break;case'lead':_0x3bb592['uri']=_0x7166('0x4c')+_0x2c2ad0+_0x7166('0x4d')+_0x4add80+'))';return getZohoUser(_0x3bb592,_0x7166('0x4e'))[_0x7166('0x25')](function(_0x5192b1){if(_0x5192b1)return _0x5192b1;if(_0x129caf[_0x7166('0x40')]!=_0x7166('0x4f')){return createEndUser(_0x1efc82,_0x2c2ad0,_0x442911,_0x4add80,_0x4158a1,_0x129caf);}else{return{};}});break;}}function getCall(_0x2e92e3,_0x37b984,_0x72aa89,_0xa5ee6f,_0x19b640,_0x30ab86,_0x4e97c3,_0xee4e5e){logger[_0x7166('0x2a')](_0x7166('0x51'));var _0xec44d9={};_0xec44d9[_0x7166('0x52')]={'name':!_['isNil'](_0xa5ee6f[_0x7166('0x41')][_0x7166('0x18')])&&!_[_0x7166('0x1b')](_0xa5ee6f['profile']['name'])&&_0xa5ee6f[_0x7166('0x36')]['name']===_0x7166('0x53')?_0xa5ee6f[_0x7166('0x41')][_0x7166('0x18')]:!_['isNil'](_0xa5ee6f['first_name'])?_0xa5ee6f[_0x7166('0x42')]+'\x20'+_0xa5ee6f[_0x7166('0x43')]:_0xa5ee6f['last_name'],'id':_0xa5ee6f['id']};_0xec44d9[_0x7166('0x54')]=intUtil[_0x7166('0x55')](_0x30ab86['Subjects'],_0x4e97c3,'\x20');_0xec44d9[_0x7166('0x56')]=intUtil[_0x7166('0x55')](_0x30ab86[_0x7166('0x57')],_0x4e97c3,'\x0a');if(_0x19b640[_0x7166('0x3d')]===_0x7166('0x4a')){_0xec44d9[_0x7166('0x58')]={'name':!_[_0x7166('0x1b')](_0x19b640[_0x7166('0x59')])?_0x19b640[_0x7166('0x59')]:!_[_0x7166('0x1b')](_0x19b640[_0x7166('0x5a')])?_0x19b640[_0x7166('0x5a')]+'\x20'+_0x19b640[_0x7166('0x5b')]:_0x19b640[_0x7166('0x5b')],'id':_0x19b640['id']};}if(_0x19b640[_0x7166('0x3d')]===_0x7166('0x4e')){_0xec44d9[_0x7166('0x5c')]={'name':!_['isNil'](_0x19b640[_0x7166('0x59')])?_0x19b640['Full_Name']:!_[_0x7166('0x1b')](_0x19b640[_0x7166('0x5a')])?_0x19b640[_0x7166('0x5a')]+'\x20'+_0x19b640['Last_Name']:_0x19b640['Last_Name'],'id':_0x19b640['id']};_0xec44d9[_0x7166('0x5d')]=_[_0x7166('0x3f')](_0x19b640[_0x7166('0x3d')]);}if(_0x4e97c3[_0x7166('0x5e')]){_0xec44d9[_0x7166('0x5f')]=moment[_0x7166('0x60')](parseInt(_0x4e97c3['talktime'])*0x3e8)['format'](_0x7166('0x61'));}else if(_0x4e97c3[_0x7166('0x62')]&&_0x4e97c3[_0x7166('0x63')]){_0xec44d9[_0x7166('0x5f')]=moment[_0x7166('0x60')](moment(_0x4e97c3[_0x7166('0x63')],_0x7166('0x64'))[_0x7166('0x65')](moment(_0x4e97c3[_0x7166('0x66')],'YYYY-MM-DDTHH:mm:ss')))[_0x7166('0x67')](_0x7166('0x61'));}switch(_0x4e97c3['lastevent']){case _0x7166('0x68'):_0xec44d9[_0x7166('0x69')]=_0x7166('0x6a');break;case _0x7166('0x6b'):case _0x7166('0x6c'):_0xec44d9[_0x7166('0x69')]=_0x7166('0x6d');break;case _0x7166('0x6e'):_0xec44d9[_0x7166('0x69')]=_0x7166('0x6f');break;case _0x7166('0x70'):_0xec44d9[_0x7166('0x69')]=_0x7166('0x71');break;case'timeout':_0xec44d9[_0x7166('0x69')]=_0x7166('0x72');default:}_0xec44d9[_0x7166('0x73')]=(_0xee4e5e===_0x7166('0x74')?moment(_0x4e97c3[_0x7166('0x66')])['format'](_0x7166('0x64')):moment(_0x4e97c3[_0x7166('0x75')])[_0x7166('0x67')](_0x7166('0x64')))||moment()[_0x7166('0x67')](_0x7166('0x64'));_0xec44d9['Call_Type']=_0xee4e5e||_0x7166('0x76');_0xec44d9=_['merge'](_0xec44d9,getCustomFields(_0x30ab86['Fields'],_0x4e97c3));return request({'method':_0x7166('0x77'),'uri':_0x7166('0x4c')+_0x37b984+_0x7166('0x78'),'headers':{'Authorization':_0x7166('0x2f')+_0x2e92e3},'body':{'data':[_0xec44d9]},'json':!![]})[_0x7166('0x25')](function(_0x590198){if(_0x590198&&_0x590198['data'][0x0][_0x7166('0x44')]==='SUCCESS'){logger[_0x7166('0x2a')](_0x7166('0x79'));return{'id':_0x590198[_0x7166('0x3c')][0x0][_0x7166('0x7a')]['id']};}})[_0x7166('0x27')](function(_0x3c81c6){logger['info'](_0x7166('0x7b'),_0x3c81c6[_0x7166('0x7c')]);console[_0x7166('0x47')](_0x7166('0x7b'),_0x3c81c6);});}exports[_0x7166('0x7d')]=function(_0xfed3c6,_0x48b7f5,_0x9d87cd,_0x2d6f8e,_0x4a3bc5,_0x28c674){var _0x518c0f,_0x21ab60,_0x9abc5c;_0x28c674[_0x7166('0x7e')]=intUtil[_0x7166('0x7f')](_0x28c674[_0x7166('0x7e')]);_0x28c674[_0x7166('0x80')]=intUtil['stripTrailingSlash'](_0x28c674[_0x7166('0x80')]);if(_0x4a3bc5&&_0x4a3bc5[_0x7166('0x81')]){logger[_0x7166('0x2a')](_0x7166('0x82'),_0x7166('0x83'));_0x48b7f5[_0x7166('0x84')]=_0x28c674[_0x7166('0x80')]+'/api/voice/recordings/'+_0x48b7f5['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x48b7f5[_0x7166('0x85')]);}else{_0x48b7f5[_0x7166('0x84')]='';}var _0x28d418=_0x28c674[_0x7166('0x7e')]===_0x7166('0x86')?'eu':_0x7166('0x87');return getAccessToken(_0x28c674)[_0x7166('0x25')](function(_0x45ef14){_0x9abc5c=_0x45ef14;return getUser(_0x9abc5c,_0x28d418,_0x28c674,_0x2d6f8e[_0x7166('0x33')]);})[_0x7166('0x25')](function(_0xebb266){_0x518c0f=_0xebb266;logger[_0x7166('0x2a')](_0x7166('0x88'),_0x518c0f['id']);return getEndUser(_0x9abc5c,_0x28d418,_0x28c674,_0x48b7f5[_0x7166('0x89')],_0x48b7f5[_0x7166('0x8a')],_0x518c0f,_0x9d87cd);})[_0x7166('0x25')](function(_0x434cda){_0x21ab60=_0x434cda;return getCall(_0x9abc5c,_0x28d418,_0x28c674,_0x518c0f,_0x21ab60,_0x9d87cd,_0x48b7f5,_0x7166('0x76'));})[_0x7166('0x25')](function(_0x31390){if(_0x31390){logger[_0x7166('0x2a')](_0x7166('0x8b'),_0x31390['id']);logger[_0x7166('0x2a')]('[QUEUE]',_0x7166('0x8c'));emit(util[_0x7166('0x67')]('user:%s',_0x2d6f8e[_0x7166('0x18')]),_0x7166('0x8d'),{'uri':_0x7166('0x8e')+_0x28c674['host']+_0x7166('0x8f')+_0x31390['id']});}})[_0x7166('0x27')](function(_0x5f093d){logger[_0x7166('0x28')](_0x7166('0x82'),JSON['stringify'](_0x5f093d));});};exports[_0x7166('0x74')]=function(_0x183b2b,_0x169019,_0x368c8b,_0x1650b1,_0x2c1fe8,_0x49dfd3,_0x6de321){var _0x2cc0e4,_0x4b4ae1,_0x4b8fdd;_0x49dfd3[_0x7166('0x7e')]=intUtil['stripTrailingSlash'](_0x49dfd3[_0x7166('0x7e')]);_0x49dfd3['serverUrl']=intUtil['stripTrailingSlash'](_0x49dfd3['serverUrl']);if(_0x6de321&&_0x6de321[_0x7166('0x90')]&&_0x6de321[_0x7166('0x90')]!==_0x7166('0x91')){logger['info'](_0x7166('0x92'),'Recording\x20is\x20enabled!');_0x169019['recordingURL']=_0x49dfd3['serverUrl']+_0x7166('0x93')+_0x169019[_0x7166('0x85')]+_0x7166('0x94')+md5(_0x169019[_0x7166('0x85')]);}var _0x4f01a0=_0x49dfd3['host']===_0x7166('0x86')?'eu':_0x7166('0x87');return getAccessToken(_0x49dfd3)[_0x7166('0x25')](function(_0x342c2b){_0x4b8fdd=_0x342c2b;return getUser(_0x4b8fdd,_0x4f01a0,_0x49dfd3,_0x1650b1[_0x7166('0x33')]);})[_0x7166('0x25')](function(_0x32b03a){_0x2cc0e4=_0x32b03a;logger[_0x7166('0x2a')](_0x7166('0x88'),_0x2cc0e4['id']);return getEndUser(_0x4b8fdd,_0x4f01a0,_0x49dfd3,_0x169019[_0x7166('0x95')],_0x169019[_0x7166('0x96')],_0x2cc0e4,_0x368c8b);})['then'](function(_0x864fff){_0x4b4ae1=_0x864fff;return getCall(_0x4b8fdd,_0x4f01a0,_0x49dfd3,_0x2cc0e4,_0x4b4ae1,_0x368c8b,_0x169019,'Outbound');})[_0x7166('0x25')](function(_0x256709){if(_0x256709){logger[_0x7166('0x2a')]('The\x20Call\x20ID\x20is:',_0x256709['id']);logger['info'](_0x7166('0x92'),_0x7166('0x8c'));emit(util[_0x7166('0x67')](_0x7166('0x97'),_0x1650b1['name']),'trigger:browser:url',{'uri':'https://crm.'+_0x49dfd3[_0x7166('0x7e')]+'/crm/EntityInfo.do?module=Calls&id='+_0x256709['id']});}})[_0x7166('0x27')](function(_0x351921){logger['error'](_0x7166('0x92'),JSON['stringify'](_0x351921));});};exports['unmanaged']=function(_0x57efc1,_0x55f66e,_0x5569de,_0x251dbf,_0x3bbcda,_0x34b936){var _0x3e92cc,_0x1f56f3,_0x403b9e;_0x34b936['host']=intUtil[_0x7166('0x7f')](_0x34b936[_0x7166('0x7e')]);_0x34b936[_0x7166('0x80')]=intUtil['stripTrailingSlash'](_0x34b936[_0x7166('0x80')]);if(_0x3bbcda&&_0x3bbcda[_0x7166('0x81')]){logger[_0x7166('0x2a')]('['+_0x55f66e[_0x7166('0x98')]['toUpperCase']()+']',_0x7166('0x83'));_0x55f66e['recordingURL']=_0x34b936['serverUrl']+'/api/voice/recordings/'+_0x55f66e[_0x7166('0x85')]+_0x7166('0x94')+md5(_0x55f66e[_0x7166('0x85')]);}else{_0x55f66e[_0x7166('0x84')]='';}var _0x3b88cc=_0x34b936[_0x7166('0x7e')]==='zoho.eu'?'eu':'com';return getAccessToken(_0x34b936)[_0x7166('0x25')](function(_0x57af47){_0x403b9e=_0x57af47;return getUser(_0x403b9e,_0x3b88cc,_0x34b936);})[_0x7166('0x25')](function(_0x5eb38e){_0x3e92cc=_0x5eb38e;logger[_0x7166('0x2a')](_0x7166('0x88'),_0x3e92cc['id']);return getEndUser(_0x403b9e,_0x3b88cc,_0x34b936,_0x55f66e['calleridname'],_0x55f66e[_0x7166('0x8a')],_0x3e92cc,_0x5569de);})[_0x7166('0x25')](function(_0x3ac62e){_0x1f56f3=_0x3ac62e;return getCall(_0x403b9e,_0x3b88cc,_0x34b936,_0x3e92cc,_0x1f56f3,_0x5569de,_0x55f66e,_0x7166('0x76'));})[_0x7166('0x25')](function(_0x120185){if(_0x120185){logger[_0x7166('0x2a')](_0x7166('0x8b'),_0x120185['id']);}})[_0x7166('0x27')](function(_0x139646){logger[_0x7166('0x28')]('['+_0x55f66e[_0x7166('0x98')][_0x7166('0x99')]()+']',JSON[_0x7166('0x3b')](_0x139646));});}; \ No newline at end of file +var _0x3d1f=['administrator','Subjects','Description','getString','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','starttime','YYYY-MM-DDTHH:mm:ss','lastevent','called','Called','connect','Call_Result','Answered','rejected','Rejected','abandoned','timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','Fields','/crm/v2/Calls','err','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','recordingURL','zoho.eu','calleridname','calleridnum','The\x20Call\x20ID\x20is:','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','Recording\x20is\x20enabled!','com','The\x20User\x20ID\x20is:','Outbound','[OUTBOUND]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','toUpperCase','md5','util','moment','ioredis','../../../../config/environment','../../../../config/logger','zoho','defaults','redis','localhost','socket.io-emitter','emit','[HTTP]','length','includes','string','idField','content','toString','variable','variableName','type','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','https://accounts.zoho.com','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','refresh_token','seconds','catch','error','stack','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','then','users','isArrayLikeObject','findIndex','email','info','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','Leads','nothing','contact','Creating\x20new\x20call...','Owner'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x3d1f,0x163));var _0xf3d1=function(_0x37f776,_0x3ff27c){_0x37f776=_0x37f776-0x0;var _0x2eb266=_0x3d1f[_0x37f776];return _0x2eb266;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0xf3d1('0x0'));var util=require(_0xf3d1('0x1'));var intUtil=require('./util');var moment=require(_0xf3d1('0x2'));var Redis=require(_0xf3d1('0x3'));var BPromise=require('bluebird');var config=require(_0xf3d1('0x4'));var logger=require(_0xf3d1('0x5'))(_0xf3d1('0x6'));config['redis']=_[_0xf3d1('0x7')](config[_0xf3d1('0x8')],{'host':_0xf3d1('0x9'),'port':0x18eb});var io=require(_0xf3d1('0xa'))(new Redis(config[_0xf3d1('0x8')]));function emit(_0x409665,_0x3a9452,_0x1a7b68){io['to'](_0x409665)[_0xf3d1('0xb')](_0x3a9452,_0x1a7b68);}function request(_0x4e2522){logger['debug'](_0xf3d1('0xc'),JSON['stringify'](_0x4e2522));return rp(_0x4e2522);}function getCustomFields(_0x5ca285,_0x23046e){var _0x120f95={};if(_0x5ca285[_0xf3d1('0xd')]>0x0){_['forEach'](_0x5ca285,function(_0x48f29a){if(_[_0xf3d1('0xe')]([_0xf3d1('0xf'),'picklist'],_0x48f29a['type'])&&_0x48f29a[_0xf3d1('0x10')]){_0x120f95[_0x48f29a[_0xf3d1('0x10')]]=_0x48f29a[_0xf3d1('0x11')][_0xf3d1('0x12')]();}else if(_0x48f29a['type']===_0xf3d1('0x13')&&_0x48f29a[_0xf3d1('0x14')]&&_0x48f29a[_0xf3d1('0x10')]&&_0x23046e[_0x48f29a['variableName']]){_0x120f95[_0x48f29a[_0xf3d1('0x10')]]=_0x23046e[_0x48f29a[_0xf3d1('0x14')]][_0xf3d1('0x12')]();}else if(_0x48f29a[_0xf3d1('0x15')]==='customVariable'&&_0x48f29a[_0xf3d1('0x16')]&&_0x48f29a['Variable']['name']&&_0x48f29a['idField']&&_0x23046e[_0x48f29a['Variable'][_0xf3d1('0x17')][_0xf3d1('0x18')]()]){_0x120f95[_0x48f29a['idField']]=_0x23046e[_0x48f29a[_0xf3d1('0x16')][_0xf3d1('0x17')]['toLowerCase']()][_0xf3d1('0x12')]();}});}return _0x120f95;}function getName(_0x5697fc){if(_0x5697fc[_0xf3d1('0x19')]('\x20')>0x0){var _0x1a1214=_0x5697fc[_0xf3d1('0x1a')](/ (.+)/);if(_0x1a1214[0x1]){return _0x1a1214;}}return[_0x5697fc,_0x5697fc];}var accountsTokens={};function getAccessToken(_0x813f44){return new Promise(function(_0x5e661f,_0x58e8c4){if(!_[_0xf3d1('0x1b')](accountsTokens[_0x813f44['id']])&&!_[_0xf3d1('0x1b')](accountsTokens[_0x813f44['id']][_0xf3d1('0x1c')])){if(moment()[_0xf3d1('0x1d')](accountsTokens[_0x813f44['id']][_0xf3d1('0x1e')])){_0x5e661f(accountsTokens[_0x813f44['id']]['access_token']);}}var _0x2bc86b;switch(_0x813f44['zone']){case'US':_0x2bc86b=_0xf3d1('0x1f');break;case'AU':_0x2bc86b='https://accounts.zoho.com.au';break;case'EU':_0x2bc86b=_0xf3d1('0x20');break;case'IN':_0x2bc86b='https://accounts.zoho.in';break;case'CN':_0x2bc86b='https://accounts.zoho.com.cn';break;default:_0x2bc86b=_0xf3d1('0x20');break;}var _0x3bb718={'method':_0xf3d1('0x21'),'uri':_0x2bc86b+_0xf3d1('0x22'),'qs':{'refresh_token':_0x813f44[_0xf3d1('0x23')],'client_id':_0x813f44[_0xf3d1('0x24')],'client_secret':_0x813f44['clientSecret'],'grant_type':_0xf3d1('0x25')},'json':!![]};return rp(_0x3bb718)['then'](function(_0xe60d25){accountsTokens[_0x813f44['id']]={'access_token':_0xe60d25[_0xf3d1('0x1c')],'expires_in':moment()['add'](_0xe60d25[_0xf3d1('0x1e')],_0xf3d1('0x26'))};_0x5e661f(_0xe60d25['access_token']);})[_0xf3d1('0x27')](function(_0x4a99e8){logger[_0xf3d1('0x28')]('Failing\x20creating\x20the\x20access_token',_0x4a99e8[_0xf3d1('0x29')]);_0x58e8c4(_0x4a99e8);});});}function getUser(_0x193c99,_0x57c2ba,_0x374153,_0x46b84d){logger['info'](_0xf3d1('0x2a'));return request({'method':_0xf3d1('0x2b'),'uri':util[_0xf3d1('0x2c')](_0xf3d1('0x2d'),_0x57c2ba),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0xf3d1('0x2e')+_0x193c99},'json':!![]})[_0xf3d1('0x2f')](function(_0xfe2262){if(_0xfe2262[_0xf3d1('0x30')]){var _0x56b327=-0x1;if(_[_0xf3d1('0x31')](_0xfe2262[_0xf3d1('0x30')])){if(!_[_0xf3d1('0x1b')](_0x46b84d)){_0x56b327=_[_0xf3d1('0x32')](_0xfe2262[_0xf3d1('0x30')],function(_0x177d81){return _0x177d81[_0xf3d1('0x33')]===_0x46b84d;});}if(_0x56b327>=0x0){logger[_0xf3d1('0x34')](_0xf3d1('0x35'));}else{logger[_0xf3d1('0x34')](_0xf3d1('0x36'));_0x56b327=_[_0xf3d1('0x32')](_0xfe2262[_0xf3d1('0x30')],function(_0x54654e){return _0x54654e[_0xf3d1('0x37')]['name']===_0xf3d1('0x38');});}return _0xfe2262[_0xf3d1('0x30')][_0x56b327];}else{if(_0xfe2262[_0xf3d1('0x39')][_0xf3d1('0x37')][_0xf3d1('0x17')]==='Administrator'){logger[_0xf3d1('0x34')](_0xf3d1('0x36'));user=_0xfe2262[_0xf3d1('0x39')];return user;}else{logger[_0xf3d1('0x28')](_0xf3d1('0x3a'),JSON[_0xf3d1('0x3b')](_0xfe2262));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0xfe2262));}}}else{logger[_0xf3d1('0x28')](_0xf3d1('0x3a'),JSON[_0xf3d1('0x3b')](_0xfe2262));throw new Error(_0xf3d1('0x3c')+JSON[_0xf3d1('0x3b')](_0xfe2262));}})['catch'](function(_0x13fe27){console[_0xf3d1('0x28')](_0x13fe27);});}function getZohoUser(_0x215b43,_0x4dcb12){return new BPromise(function(_0x19213b,_0x42bd71){request(_0x215b43)['then'](function(_0x57d47b){var _0x13e8f7=null;if(_0x57d47b){_0x13e8f7=_0x57d47b[_0xf3d1('0x3d')][0x0];_0x13e8f7[_0xf3d1('0x3e')]=_0x4dcb12;}_0x19213b(_0x13e8f7);})[_0xf3d1('0x27')](function(_0x202cf4){_0x42bd71(_0x202cf4);});});}function createEndUser(_0x4eb9b9,_0x5d0766,_0x560119,_0x4bdeb2,_0x2e642e,_0x445f4b){var _0x560119=getName(_0x560119);return request({'method':_0xf3d1('0x21'),'uri':_0xf3d1('0x3f')+_0x5d0766+_0xf3d1('0x40')+_[_0xf3d1('0x41')](_0x445f4b[_0xf3d1('0x42')])+'s','body':{'data':[{'Last_Name':_0x560119[0x1],'First_Name':_0x560119[0x0],'Phone':_0x4bdeb2,'Owner':{'name':!_[_0xf3d1('0x1b')](_0x2e642e['role'][_0xf3d1('0x17')])?_0x2e642e[_0xf3d1('0x43')][_0xf3d1('0x17')]:!_[_0xf3d1('0x1b')](_0x2e642e['first_name'])?_0x2e642e[_0xf3d1('0x44')]+'\x20'+_0x2e642e[_0xf3d1('0x45')]:_0x2e642e[_0xf3d1('0x45')],'id':_0x2e642e['id']}}]},'headers':{'Authorization':_0xf3d1('0x2e')+_0x4eb9b9},'json':!![]})[_0xf3d1('0x2f')](function(_0x22a154){if(_0x22a154&&_0x22a154['data'][0x0][_0xf3d1('0x46')]===_0xf3d1('0x47')){var _0x1972a5=_0x22a154[_0xf3d1('0x3d')][0x0][_0xf3d1('0x48')];_0x1972a5[_0xf3d1('0x3e')]=_['startCase'](_0x445f4b['moduleCreate'])+'s';return _0x1972a5;}logger[_0xf3d1('0x28')]('The\x20failing\x20result\x20is',JSON[_0xf3d1('0x3b')](data));throw new Error(_0xf3d1('0x49')+JSON[_0xf3d1('0x3b')](data));})[_0xf3d1('0x27')](function(_0x5044e5){console[_0xf3d1('0x4a')](_0xf3d1('0x4b'),_0x5044e5);});}function getEndUser(_0x73f9ed,_0x5386ea,_0x35a014,_0x2f23ca,_0x1020ef,_0x542518,_0x2aa5ae){var _0x1ab033={'method':'GET','uri':'','headers':{'Authorization':_0xf3d1('0x2e')+_0x73f9ed},'json':!![]};switch(_0x2aa5ae[_0xf3d1('0x4c')]){case _0xf3d1('0x4d'):_0x1ab033[_0xf3d1('0x4e')]=_0xf3d1('0x3f')+_0x5386ea+_0xf3d1('0x4f')+_0x1020ef+'))';return getZohoUser(_0x1ab033,_0xf3d1('0x50'))[_0xf3d1('0x2f')](function(_0x185974){if(_0x185974)return _0x185974;_0x1ab033[_0xf3d1('0x4e')]=_0xf3d1('0x3f')+_0x5386ea+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x1020ef+'))';return getZohoUser(_0x1ab033,_0xf3d1('0x51'))[_0xf3d1('0x2f')](function(_0x37019f){if(_0x37019f)return _0x37019f;if(_0x2aa5ae[_0xf3d1('0x42')]!=_0xf3d1('0x52')){return createEndUser(_0x73f9ed,_0x5386ea,_0x2f23ca,_0x1020ef,_0x542518,_0x2aa5ae);}else{return{};}});});break;case _0xf3d1('0x53'):_0x1ab033[_0xf3d1('0x4e')]=_0xf3d1('0x3f')+_0x5386ea+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x1020ef+'))';return getZohoUser(_0x1ab033,_0xf3d1('0x50'))[_0xf3d1('0x2f')](function(_0x417b6a){if(_0x417b6a)return _0x417b6a;if(_0x2aa5ae[_0xf3d1('0x42')]!=_0xf3d1('0x52')){return createEndUser(_0x73f9ed,_0x5386ea,_0x2f23ca,_0x1020ef,_0x542518,_0x2aa5ae);}else{return{};}});break;case'lead':_0x1ab033[_0xf3d1('0x4e')]='https://www.zohoapis.'+_0x5386ea+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x1020ef+'))';return getZohoUser(_0x1ab033,'Leads')[_0xf3d1('0x2f')](function(_0x3fc508){if(_0x3fc508)return _0x3fc508;if(_0x2aa5ae[_0xf3d1('0x42')]!='nothing'){return createEndUser(_0x73f9ed,_0x5386ea,_0x2f23ca,_0x1020ef,_0x542518,_0x2aa5ae);}else{return{};}});break;}}function getCall(_0xcfc791,_0x5728ae,_0x4c4be5,_0x5aba7d,_0x2a18ee,_0x896143,_0x5c4775,_0x98d1b9){logger['info'](_0xf3d1('0x54'));var _0x1cecb1={};_0x1cecb1[_0xf3d1('0x55')]={'name':!_[_0xf3d1('0x1b')](_0x5aba7d['role'][_0xf3d1('0x17')])&&!_[_0xf3d1('0x1b')](_0x5aba7d[_0xf3d1('0x37')]['name'])&&_0x5aba7d['profile'][_0xf3d1('0x17')]===_0xf3d1('0x56')?_0x5aba7d[_0xf3d1('0x43')]['name']:!_[_0xf3d1('0x1b')](_0x5aba7d[_0xf3d1('0x44')])?_0x5aba7d[_0xf3d1('0x44')]+'\x20'+_0x5aba7d[_0xf3d1('0x45')]:_0x5aba7d['last_name'],'id':_0x5aba7d['id']};_0x1cecb1['Subject']=intUtil['getString'](_0x896143[_0xf3d1('0x57')],_0x5c4775,'\x20');_0x1cecb1[_0xf3d1('0x58')]=intUtil[_0xf3d1('0x59')](_0x896143['Descriptions'],_0x5c4775,'\x0a');if(_0x2a18ee['enduserType']===_0xf3d1('0x50')){_0x1cecb1[_0xf3d1('0x5a')]={'name':!_[_0xf3d1('0x1b')](_0x2a18ee['Full_Name'])?_0x2a18ee[_0xf3d1('0x5b')]:!_[_0xf3d1('0x1b')](_0x2a18ee[_0xf3d1('0x5c')])?_0x2a18ee[_0xf3d1('0x5c')]+'\x20'+_0x2a18ee[_0xf3d1('0x5d')]:_0x2a18ee[_0xf3d1('0x5d')],'id':_0x2a18ee['id']};}if(_0x2a18ee[_0xf3d1('0x3e')]===_0xf3d1('0x51')){_0x1cecb1[_0xf3d1('0x5e')]={'name':!_[_0xf3d1('0x1b')](_0x2a18ee[_0xf3d1('0x5b')])?_0x2a18ee[_0xf3d1('0x5b')]:!_[_0xf3d1('0x1b')](_0x2a18ee[_0xf3d1('0x5c')])?_0x2a18ee['First_Name']+'\x20'+_0x2a18ee[_0xf3d1('0x5d')]:_0x2a18ee[_0xf3d1('0x5d')],'id':_0x2a18ee['id']};_0x1cecb1[_0xf3d1('0x5f')]=_[_0xf3d1('0x41')](_0x2a18ee[_0xf3d1('0x3e')]);}if(_0x5c4775[_0xf3d1('0x60')]){_0x1cecb1[_0xf3d1('0x61')]=moment[_0xf3d1('0x62')](parseInt(_0x5c4775[_0xf3d1('0x60')])*0x3e8)['format'](_0xf3d1('0x63'));}else if(_0x5c4775[_0xf3d1('0x64')]&&_0x5c4775[_0xf3d1('0x65')]){_0x1cecb1[_0xf3d1('0x61')]=moment['utc'](moment(_0x5c4775[_0xf3d1('0x65')],'YYYY-MM-DDTHH:mm:ss')['diff'](moment(_0x5c4775[_0xf3d1('0x66')],_0xf3d1('0x67'))))['format']('mm:ss');}switch(_0x5c4775[_0xf3d1('0x68')]){case _0xf3d1('0x69'):_0x1cecb1['Call_Result']=_0xf3d1('0x6a');break;case'complete':case _0xf3d1('0x6b'):_0x1cecb1[_0xf3d1('0x6c')]=_0xf3d1('0x6d');break;case _0xf3d1('0x6e'):_0x1cecb1[_0xf3d1('0x6c')]=_0xf3d1('0x6f');break;case _0xf3d1('0x70'):_0x1cecb1['Call_Result']='Abandoned';break;case _0xf3d1('0x71'):_0x1cecb1[_0xf3d1('0x6c')]='Timeout';default:}_0x1cecb1[_0xf3d1('0x72')]=(_0x98d1b9===_0xf3d1('0x73')?moment(_0x5c4775[_0xf3d1('0x66')])[_0xf3d1('0x2c')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x5c4775[_0xf3d1('0x74')])[_0xf3d1('0x2c')](_0xf3d1('0x67')))||moment()[_0xf3d1('0x2c')](_0xf3d1('0x67'));_0x1cecb1[_0xf3d1('0x75')]=_0x98d1b9||_0xf3d1('0x76');_0x1cecb1=_['merge'](_0x1cecb1,getCustomFields(_0x896143[_0xf3d1('0x77')],_0x5c4775));return request({'method':_0xf3d1('0x21'),'uri':_0xf3d1('0x3f')+_0x5728ae+_0xf3d1('0x78'),'headers':{'Authorization':_0xf3d1('0x2e')+_0xcfc791},'body':{'data':[_0x1cecb1]},'json':!![]})[_0xf3d1('0x2f')](function(_0x971b25){if(_0x971b25&&_0x971b25[_0xf3d1('0x3d')][0x0][_0xf3d1('0x46')]===_0xf3d1('0x47')){logger[_0xf3d1('0x34')]('Call\x20created!');return{'id':_0x971b25[_0xf3d1('0x3d')][0x0][_0xf3d1('0x48')]['id']};}})[_0xf3d1('0x27')](function(_0x1e0be0){logger[_0xf3d1('0x34')]('err',_0x1e0be0[_0xf3d1('0x29')]);console[_0xf3d1('0x4a')](_0xf3d1('0x79'),_0x1e0be0);});}exports['queue']=function(_0xd63132,_0x435156,_0x57586c,_0x280b09,_0x31ed60,_0x4dfc07){var _0x16ed3b,_0x27670a,_0x378a08;_0x4dfc07[_0xf3d1('0x7a')]=intUtil[_0xf3d1('0x7b')](_0x4dfc07[_0xf3d1('0x7a')]);_0x4dfc07[_0xf3d1('0x7c')]=intUtil['stripTrailingSlash'](_0x4dfc07[_0xf3d1('0x7c')]);if(_0x31ed60&&_0x31ed60[_0xf3d1('0x7d')]){logger[_0xf3d1('0x34')](_0xf3d1('0x7e'),'Recording\x20is\x20enabled!');_0x435156['recordingURL']=_0x4dfc07['serverUrl']+_0xf3d1('0x7f')+_0x435156[_0xf3d1('0x80')]+_0xf3d1('0x81')+md5(_0x435156['uniqueid']);}else{_0x435156[_0xf3d1('0x82')]='';}var _0x598b4e=_0x4dfc07[_0xf3d1('0x7a')]===_0xf3d1('0x83')?'eu':'com';return getAccessToken(_0x4dfc07)[_0xf3d1('0x2f')](function(_0x182096){_0x378a08=_0x182096;return getUser(_0x378a08,_0x598b4e,_0x4dfc07,_0x280b09['email']);})[_0xf3d1('0x2f')](function(_0x4bb118){_0x16ed3b=_0x4bb118;logger[_0xf3d1('0x34')]('The\x20User\x20ID\x20is:',_0x16ed3b['id']);return getEndUser(_0x378a08,_0x598b4e,_0x4dfc07,_0x435156[_0xf3d1('0x84')],_0x435156[_0xf3d1('0x85')],_0x16ed3b,_0x57586c);})[_0xf3d1('0x2f')](function(_0x35d7b0){_0x27670a=_0x35d7b0;return getCall(_0x378a08,_0x598b4e,_0x4dfc07,_0x16ed3b,_0x27670a,_0x57586c,_0x435156,_0xf3d1('0x76'));})[_0xf3d1('0x2f')](function(_0x2ae07d){if(_0x2ae07d){logger[_0xf3d1('0x34')](_0xf3d1('0x86'),_0x2ae07d['id']);logger['info'](_0xf3d1('0x7e'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xf3d1('0x2c')](_0xf3d1('0x87'),_0x280b09[_0xf3d1('0x17')]),_0xf3d1('0x88'),{'uri':_0xf3d1('0x89')+_0x4dfc07['host']+_0xf3d1('0x8a')+_0x2ae07d['id']});}})[_0xf3d1('0x27')](function(_0x3ad073){logger['error'](_0xf3d1('0x7e'),JSON[_0xf3d1('0x3b')](_0x3ad073));});};exports[_0xf3d1('0x73')]=function(_0x3af327,_0x40445f,_0x494714,_0x49ac93,_0x1723b5,_0x557531,_0x2a4c34){var _0x514379,_0x22b269,_0x2f485e;_0x557531[_0xf3d1('0x7a')]=intUtil[_0xf3d1('0x7b')](_0x557531[_0xf3d1('0x7a')]);_0x557531[_0xf3d1('0x7c')]=intUtil[_0xf3d1('0x7b')](_0x557531[_0xf3d1('0x7c')]);if(_0x2a4c34&&_0x2a4c34['recordingFormat']&&_0x2a4c34['recordingFormat']!=='none'){logger['info']('[OUTBOUND]',_0xf3d1('0x8b'));_0x40445f['recordingURL']=_0x557531[_0xf3d1('0x7c')]+_0xf3d1('0x7f')+_0x40445f[_0xf3d1('0x80')]+_0xf3d1('0x81')+md5(_0x40445f[_0xf3d1('0x80')]);}var _0x3c322a=_0x557531[_0xf3d1('0x7a')]===_0xf3d1('0x83')?'eu':_0xf3d1('0x8c');return getAccessToken(_0x557531)[_0xf3d1('0x2f')](function(_0x2559a1){_0x2f485e=_0x2559a1;return getUser(_0x2f485e,_0x3c322a,_0x557531,_0x49ac93[_0xf3d1('0x33')]);})[_0xf3d1('0x2f')](function(_0x443850){_0x514379=_0x443850;logger[_0xf3d1('0x34')](_0xf3d1('0x8d'),_0x514379['id']);return getEndUser(_0x2f485e,_0x3c322a,_0x557531,_0x40445f['destcalleridname'],_0x40445f['destcalleridnum'],_0x514379,_0x494714);})[_0xf3d1('0x2f')](function(_0x31b622){_0x22b269=_0x31b622;return getCall(_0x2f485e,_0x3c322a,_0x557531,_0x514379,_0x22b269,_0x494714,_0x40445f,_0xf3d1('0x8e'));})[_0xf3d1('0x2f')](function(_0x3ce3b1){if(_0x3ce3b1){logger[_0xf3d1('0x34')]('The\x20Call\x20ID\x20is:',_0x3ce3b1['id']);logger['info'](_0xf3d1('0x8f'),_0xf3d1('0x90'));emit(util[_0xf3d1('0x2c')](_0xf3d1('0x87'),_0x49ac93[_0xf3d1('0x17')]),'trigger:browser:url',{'uri':'https://crm.'+_0x557531[_0xf3d1('0x7a')]+_0xf3d1('0x8a')+_0x3ce3b1['id']});}})[_0xf3d1('0x27')](function(_0x35869e){logger[_0xf3d1('0x28')](_0xf3d1('0x8f'),JSON[_0xf3d1('0x3b')](_0x35869e));});};exports[_0xf3d1('0x91')]=function(_0x2c7cad,_0x8ad9e,_0x1d8099,_0x4b0905,_0x3f3301,_0x3f260c){var _0x5703fc,_0x38b682,_0x16298a;_0x3f260c['host']=intUtil['stripTrailingSlash'](_0x3f260c['host']);_0x3f260c[_0xf3d1('0x7c')]=intUtil[_0xf3d1('0x7b')](_0x3f260c[_0xf3d1('0x7c')]);if(_0x3f3301&&_0x3f3301['monitor_format']){logger[_0xf3d1('0x34')]('['+_0x8ad9e[_0xf3d1('0x68')][_0xf3d1('0x92')]()+']',_0xf3d1('0x8b'));_0x8ad9e['recordingURL']=_0x3f260c['serverUrl']+_0xf3d1('0x7f')+_0x8ad9e['uniqueid']+_0xf3d1('0x81')+md5(_0x8ad9e[_0xf3d1('0x80')]);}else{_0x8ad9e['recordingURL']='';}var _0x52e573=_0x3f260c[_0xf3d1('0x7a')]===_0xf3d1('0x83')?'eu':_0xf3d1('0x8c');return getAccessToken(_0x3f260c)[_0xf3d1('0x2f')](function(_0x2ebabc){_0x16298a=_0x2ebabc;return getUser(_0x16298a,_0x52e573,_0x3f260c);})[_0xf3d1('0x2f')](function(_0x1792f9){_0x5703fc=_0x1792f9;logger[_0xf3d1('0x34')](_0xf3d1('0x8d'),_0x5703fc['id']);return getEndUser(_0x16298a,_0x52e573,_0x3f260c,_0x8ad9e['calleridname'],_0x8ad9e[_0xf3d1('0x85')],_0x5703fc,_0x1d8099);})[_0xf3d1('0x2f')](function(_0x584fbe){_0x38b682=_0x584fbe;return getCall(_0x16298a,_0x52e573,_0x3f260c,_0x5703fc,_0x38b682,_0x1d8099,_0x8ad9e,'Inbound');})['then'](function(_0x408985){if(_0x408985){logger['info']('The\x20Call\x20ID\x20is:',_0x408985['id']);}})['catch'](function(_0x26e92f){logger['error']('['+_0x8ad9e[_0xf3d1('0x68')][_0xf3d1('0x92')]()+']',JSON['stringify'](_0x26e92f));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/script/index.js b/server/services/ami/trigger/script/index.js index 8b88090..be7415b 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 _0x0ee4=['util','shelljs','mustache','../../../../config/logger','trigger','exec','Script','render','data3','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s'];(function(_0xb65e77,_0x238c3d){var _0x38134b=function(_0x39da21){while(--_0x39da21){_0xb65e77['push'](_0xb65e77['shift']());}};_0x38134b(++_0x238c3d);}(_0x0ee4,0x126));var _0x40ee=function(_0x1e922a,_0x2980dc){_0x1e922a=_0x1e922a-0x0;var _0x190f3e=_0x0ee4[_0x1e922a];return _0x190f3e;};'use strict';var util=require(_0x40ee('0x0'));var sh=require(_0x40ee('0x1'));var Mustache=require(_0x40ee('0x2'));var logger=require(_0x40ee('0x3'))(_0x40ee('0x4'));exports[_0x40ee('0x5')]=function(_0x2314ad,_0x4d7d91){var _0x130f15=_0x2314ad['data2']?_0x2314ad['data2']:_0x40ee('0x6');var _0x5bc939=_0x2314ad['data3']?Mustache[_0x40ee('0x7')](_0x2314ad[_0x40ee('0x8')],_0x4d7d91):_0x4d7d91;sh[_0x40ee('0x5')](_0x5bc939,function(_0xc286ae,_0x1cbbcb,_0x5eacde){if(_0xc286ae!==0x0){logger[_0x40ee('0x9')](util[_0x40ee('0xa')](_0x40ee('0xb'),_0x130f15,_0x5bc939,_0xc286ae,_0x5eacde));}else{logger[_0x40ee('0xc')](util[_0x40ee('0xa')](_0x40ee('0xd'),_0x130f15,_0x5bc939,_0x1cbbcb));}});}; \ No newline at end of file +var _0x9fbb=['format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','shelljs','mustache','trigger','exec','data2','Script','render','data3','error'];(function(_0x21e0af,_0x176e49){var _0x57d906=function(_0x5f5949){while(--_0x5f5949){_0x21e0af['push'](_0x21e0af['shift']());}};_0x57d906(++_0x176e49);}(_0x9fbb,0xe1));var _0xb9fb=function(_0x4a8868,_0x40ca31){_0x4a8868=_0x4a8868-0x0;var _0x4d00c3=_0x9fbb[_0x4a8868];return _0x4d00c3;};'use strict';var util=require('util');var sh=require(_0xb9fb('0x0'));var Mustache=require(_0xb9fb('0x1'));var logger=require('../../../../config/logger')(_0xb9fb('0x2'));exports[_0xb9fb('0x3')]=function(_0x22a989,_0x49c67d){var _0x497059=_0x22a989[_0xb9fb('0x4')]?_0x22a989[_0xb9fb('0x4')]:_0xb9fb('0x5');var _0x1bf364=_0x22a989['data3']?Mustache[_0xb9fb('0x6')](_0x22a989[_0xb9fb('0x7')],_0x49c67d):_0x49c67d;sh['exec'](_0x1bf364,function(_0x3843c8,_0x22e595,_0x3a1d93){if(_0x3843c8!==0x0){logger[_0xb9fb('0x8')](util[_0xb9fb('0x9')](_0xb9fb('0xa'),_0x497059,_0x1bf364,_0x3843c8,_0x3a1d93));}else{logger[_0xb9fb('0xb')](util[_0xb9fb('0x9')](_0xb9fb('0xc'),_0x497059,_0x1bf364,_0x22e595));}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/urlforward/index.js b/server/services/ami/trigger/urlforward/index.js index 2fd879f..2cfd7bc 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 _0xb135=['info','stringify','then','isNil','object','format','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','statusCode','name','request-promise','util','lodash','mustache','trigger','exec','data1','toUpperCase','render','data2','number','data5','data6','parse','stack','DELETE','PUT','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0xb135,0x16b));var _0x5b13=function(_0x2c69b4,_0x40fe2a){_0x2c69b4=_0x2c69b4-0x0;var _0x6253dd=_0xb135[_0x2c69b4];return _0x6253dd;};'use strict';var rp=require(_0x5b13('0x0'));var util=require(_0x5b13('0x1'));var _=require(_0x5b13('0x2'));var Mustache=require(_0x5b13('0x3'));var logger=require('../../../../config/logger')(_0x5b13('0x4'));exports[_0x5b13('0x5')]=function(_0x21697f,_0x47f18e){var _0x3febc9,_0x41fef3;var _0x313890={'method':_0x21697f[_0x5b13('0x6')][_0x5b13('0x7')](),'uri':Mustache[_0x5b13('0x8')](_0x21697f[_0x5b13('0x9')],_0x47f18e),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x21697f['data5'])===_0x5b13('0xa')&&parseInt(_0x21697f[_0x5b13('0xb')])>=0x1&&parseInt(_0x21697f[_0x5b13('0xb')])<=0xa?parseInt(_0x21697f[_0x5b13('0xb')])*0x3e8:0x5*0x3e8};try{_0x313890['headers']=_0x21697f[_0x5b13('0xc')]?JSON[_0x5b13('0xd')](Mustache[_0x5b13('0x8')](_0x21697f[_0x5b13('0xc')],_0x47f18e)):{};}catch(_0x5d2602){logger['error'](_0x5d2602[_0x5b13('0xe')]);}switch(_0x21697f[_0x5b13('0x6')][_0x5b13('0x7')]()){case'GET':case _0x5b13('0xf'):_0x3febc9=null;_0x313890['qs']=_0x47f18e;break;case'POST':case _0x5b13('0x10'):if(_0x21697f[_0x5b13('0x11')]){try{_0x3febc9=JSON[_0x5b13('0xd')](Mustache[_0x5b13('0x8')](_0x21697f['data7'],_0x47f18e));_0x313890[_0x5b13('0x12')]=_0x3febc9;}catch(_0x562edc){logger[_0x5b13('0x13')](_0x562edc[_0x5b13('0xe')]);logger['error'](_0x5b13('0x14'));}}else{_0x3febc9=_0x47f18e;_0x313890[_0x5b13('0x12')]=_0x3febc9;}break;}logger[_0x5b13('0x15')](util['format']('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x21697f[_0x5b13('0x6')],_0x21697f['data2'],JSON[_0x5b13('0x16')](_0x313890)));rp(_0x313890)[_0x5b13('0x17')](function(_0x3da00d){_0x3febc9=!_[_0x5b13('0x18')](_0x3febc9)?',\x20request\x20body:\x20'+_0x3febc9:'';_0x41fef3=typeof _0x3da00d['body']===_0x5b13('0x19')?JSON[_0x5b13('0x16')](_0x3da00d[_0x5b13('0x12')]):_0x3da00d['body'];logger[_0x5b13('0x15')](util[_0x5b13('0x1a')](_0x5b13('0x1b'),_0x21697f[_0x5b13('0x6')],_0x21697f[_0x5b13('0x9')],_0x3da00d['statusCode'],_0x41fef3));})[_0x5b13('0x1c')](function(_0x5f5a36){logger[_0x5b13('0x13')](util[_0x5b13('0x1a')](_0x5b13('0x1d'),_0x21697f[_0x5b13('0x6')],_0x21697f['data2'],_0x5f5a36[_0x5b13('0x1e')],_0x5f5a36[_0x5b13('0x1f')],_0x5f5a36['message']));});}; \ No newline at end of file +var _0x0e57=['data7','parse','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','body','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then',',\x20request\x20body:\x20','object','info','format','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','mustache','trigger','exec','data1','toUpperCase','render','data2','data5','number','data6','error','stack','GET','DELETE','POST','PUT'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0x0e57,0xba));var _0x70e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0e57[_0x3dd15e];return _0x231fd0;};'use strict';var rp=require(_0x70e5('0x0'));var util=require(_0x70e5('0x1'));var _=require('lodash');var Mustache=require(_0x70e5('0x2'));var logger=require('../../../../config/logger')(_0x70e5('0x3'));exports[_0x70e5('0x4')]=function(_0x27089a,_0x450cc7){var _0x1c436a,_0x1bd320;var _0x2ba915={'method':_0x27089a[_0x70e5('0x5')][_0x70e5('0x6')](),'uri':Mustache[_0x70e5('0x7')](_0x27089a[_0x70e5('0x8')],_0x450cc7),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x27089a[_0x70e5('0x9')])===_0x70e5('0xa')&&parseInt(_0x27089a[_0x70e5('0x9')])>=0x1&&parseInt(_0x27089a[_0x70e5('0x9')])<=0xa?parseInt(_0x27089a[_0x70e5('0x9')])*0x3e8:0x5*0x3e8};try{_0x2ba915['headers']=_0x27089a['data6']?JSON['parse'](Mustache[_0x70e5('0x7')](_0x27089a[_0x70e5('0xb')],_0x450cc7)):{};}catch(_0xacf144){logger[_0x70e5('0xc')](_0xacf144[_0x70e5('0xd')]);}switch(_0x27089a['data1']['toUpperCase']()){case _0x70e5('0xe'):case _0x70e5('0xf'):_0x1c436a=null;_0x2ba915['qs']=_0x450cc7;break;case _0x70e5('0x10'):case _0x70e5('0x11'):if(_0x27089a[_0x70e5('0x12')]){try{_0x1c436a=JSON[_0x70e5('0x13')](Mustache['render'](_0x27089a[_0x70e5('0x12')],_0x450cc7));_0x2ba915['body']=_0x1c436a;}catch(_0x53ece9){logger[_0x70e5('0xc')](_0x53ece9[_0x70e5('0xd')]);logger[_0x70e5('0xc')](_0x70e5('0x14'));}}else{_0x1c436a=_0x450cc7;_0x2ba915[_0x70e5('0x15')]=_0x1c436a;}break;}logger['info'](util['format'](_0x70e5('0x16'),_0x27089a[_0x70e5('0x5')],_0x27089a[_0x70e5('0x8')],JSON[_0x70e5('0x17')](_0x2ba915)));rp(_0x2ba915)[_0x70e5('0x18')](function(_0xb6f023){_0x1c436a=!_['isNil'](_0x1c436a)?_0x70e5('0x19')+_0x1c436a:'';_0x1bd320=typeof _0xb6f023['body']===_0x70e5('0x1a')?JSON['stringify'](_0xb6f023[_0x70e5('0x15')]):_0xb6f023['body'];logger[_0x70e5('0x1b')](util[_0x70e5('0x1c')](_0x70e5('0x1d'),_0x27089a[_0x70e5('0x5')],_0x27089a[_0x70e5('0x8')],_0xb6f023[_0x70e5('0x1e')],_0x1bd320));})['catch'](function(_0x3a051c){logger[_0x70e5('0xc')](util['format'](_0x70e5('0x1f'),_0x27089a[_0x70e5('0x5')],_0x27089a[_0x70e5('0x8')],_0x3a051c[_0x70e5('0x1e')],_0x3a051c[_0x70e5('0x20')],_0x3a051c[_0x70e5('0x21')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 7737d86..eb63fe5 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 _0x9f5e=['client','http','request','then','debug','rpc','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing'];(function(_0x276ff9,_0x378650){var _0x975945=function(_0x371f1c){while(--_0x371f1c){_0x276ff9['push'](_0x276ff9['shift']());}};_0x975945(++_0x378650);}(_0x9f5e,0x65));var _0xe9f5=function(_0x46af71,_0x44da60){_0x46af71=_0x46af71-0x0;var _0x161a67=_0x9f5e[_0x46af71];return _0x161a67;};'use strict';var jayson=require(_0xe9f5('0x0'));var BPromise=require(_0xe9f5('0x1'));var logger=require(_0xe9f5('0x2'))(_0xe9f5('0x3'));var client=jayson[_0xe9f5('0x4')][_0xe9f5('0x5')]({'port':0x2329});client['Request']=function(_0x51e1f8,_0x31aa3b){return new BPromise(function(_0x14bdb7,_0x3f14b6){return client[_0xe9f5('0x6')](_0x51e1f8,_0x31aa3b)[_0xe9f5('0x7')](function(_0x4c453e){logger[_0xe9f5('0x8')](_0xe9f5('0x9'),_0xe9f5('0x3'),_0x51e1f8,_0x31aa3b,_0x4c453e);if(_0x4c453e[_0xe9f5('0xa')]){logger[_0xe9f5('0xa')](_0xe9f5('0x9'),'routing',_0x51e1f8,_0x4c453e['error'][_0xe9f5('0xb')],_0x31aa3b);return _0x3f14b6(_0x4c453e[_0xe9f5('0xa')][_0xe9f5('0xb')]);}else{return _0x14bdb7(_0x4c453e[_0xe9f5('0xc')]);}})[_0xe9f5('0xd')](function(_0xad6287){logger[_0xe9f5('0xa')](_0xe9f5('0x9'),_0xe9f5('0x3'),_0x51e1f8,_0xad6287,_0x31aa3b);return _0x3f14b6(_0xad6287);});});};module[_0xe9f5('0xe')]=client; \ No newline at end of file +var _0xcda3=['http','Request','request','then','debug','rpc','error','message','result','jayson/promise','bluebird','../../config/logger','routing','client'];(function(_0xb742d8,_0x251713){var _0x34a4dc=function(_0xbc073){while(--_0xbc073){_0xb742d8['push'](_0xb742d8['shift']());}};_0x34a4dc(++_0x251713);}(_0xcda3,0x87));var _0x3cda=function(_0x184759,_0x1cc38a){_0x184759=_0x184759-0x0;var _0xf26d5f=_0xcda3[_0x184759];return _0xf26d5f;};'use strict';var jayson=require(_0x3cda('0x0'));var BPromise=require(_0x3cda('0x1'));var logger=require(_0x3cda('0x2'))(_0x3cda('0x3'));var client=jayson[_0x3cda('0x4')][_0x3cda('0x5')]({'port':0x2329});client[_0x3cda('0x6')]=function(_0x2704ef,_0x2e5e0d){return new BPromise(function(_0x48571f,_0xad796d){return client[_0x3cda('0x7')](_0x2704ef,_0x2e5e0d)[_0x3cda('0x8')](function(_0x1b8675){logger[_0x3cda('0x9')](_0x3cda('0xa'),_0x3cda('0x3'),_0x2704ef,_0x2e5e0d,_0x1b8675);if(_0x1b8675[_0x3cda('0xb')]){logger[_0x3cda('0xb')]('rpc','routing',_0x2704ef,_0x1b8675[_0x3cda('0xb')][_0x3cda('0xc')],_0x2e5e0d);return _0xad796d(_0x1b8675['error'][_0x3cda('0xc')]);}else{return _0x48571f(_0x1b8675[_0x3cda('0xd')]);}})['catch'](function(_0x221fab){logger[_0x3cda('0xb')](_0x3cda('0xa'),'routing',_0x2704ef,_0x221fab,_0x2e5e0d);return _0xad796d(_0x221fab);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index d942408..6f3358b 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 _0xcea1=['mailAccounts','listen','getSettings','loginMailFrequency','catch','log','./server','./lib/email','./rpc/mailAccount','./rpc/setting','resolve','getMailAccounts','then','initMailAccounts','refresh'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0xcea1,0x17d));var _0x1cea=function(_0x52fb3c,_0x2cf66e){_0x52fb3c=_0x52fb3c-0x0;var _0x5c9223=_0xcea1[_0x52fb3c];return _0x5c9223;};'use strict';var BPromise=require('bluebird');var server=require(_0x1cea('0x0'));var Realtime=require('./realtime');var EmailChannel=require(_0x1cea('0x1'));var mailAccount=require(_0x1cea('0x2'));var setting=require(_0x1cea('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0x1cea('0x4')]()['then'](mailAccount[_0x1cea('0x5')]())[_0x1cea('0x6')](realtime[_0x1cea('0x7')]())[_0x1cea('0x6')](function(){email[_0x1cea('0x8')](realtime[_0x1cea('0x9')]);return realtime;});}function main(){return server[_0x1cea('0xa')](realtime,email)[_0x1cea('0x6')](function(){return initRealtime();})[_0x1cea('0x6')](function(){return setting[_0x1cea('0xb')]();})[_0x1cea('0x6')](function(_0x5ef8c3){return setInterval(initRealtime,_0x5ef8c3[_0x1cea('0xc')]*0x3e8);})[_0x1cea('0xd')](function(_0x19314b){console[_0x1cea('0xe')](_0x19314b);});}main(); \ No newline at end of file +var _0x283b=['bluebird','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','resolve','then','mailAccounts','listen','getSettings','loginMailFrequency','catch','log'];(function(_0x540231,_0x117b98){var _0x31334b=function(_0xd90d86){while(--_0xd90d86){_0x540231['push'](_0x540231['shift']());}};_0x31334b(++_0x117b98);}(_0x283b,0x188));var _0xb283=function(_0x2c5f88,_0x1eb54b){_0x2c5f88=_0x2c5f88-0x0;var _0x2cad9d=_0x283b[_0x2c5f88];return _0x2cad9d;};'use strict';var BPromise=require(_0xb283('0x0'));var server=require(_0xb283('0x1'));var Realtime=require(_0xb283('0x2'));var EmailChannel=require(_0xb283('0x3'));var mailAccount=require(_0xb283('0x4'));var setting=require(_0xb283('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0xb283('0x6')]()[_0xb283('0x7')](mailAccount['getMailAccounts']())['then'](realtime['initMailAccounts']())['then'](function(){email['refresh'](realtime[_0xb283('0x8')]);return realtime;});}function main(){return server[_0xb283('0x9')](realtime,email)['then'](function(){return initRealtime();})['then'](function(){return setting[_0xb283('0xa')]();})[_0xb283('0x7')](function(_0x3338b5){return setInterval(initRealtime,_0x3338b5[_0xb283('0xb')]*0x3e8);})[_0xb283('0xc')](function(_0x4043ea){console[_0xb283('0xd')](_0x4043ea);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 6ad5f90..593f64c 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 _0x028a=['smtp','Smtp','lastSync','verify','verified','lodash','../../../config/environment','../../../config/logger','email','redis','./imap','./smtp','../rpc/mailAccount','info','mailAccounts','imapAccounts','prototype','name','key','Imap','status','messageStatus','total','isNil','stringify','md5','emit','mailAccount:update','refresh','hasOwnProperty','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','disabled','connected','messages','firstName','lastName','from','then','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','sendMail'];(function(_0x2354f1,_0xabfc06){var _0x2274ca=function(_0x94e694){while(--_0x94e694){_0x2354f1['push'](_0x2354f1['shift']());}};_0x2274ca(++_0xabfc06);}(_0x028a,0x1ac));var _0xa028=function(_0x4b6d16,_0x1a3db3){_0x4b6d16=_0x4b6d16-0x0;var _0x3e9510=_0x028a[_0x4b6d16];return _0x3e9510;};'use strict';var _=require(_0xa028('0x0'));var moment=require('moment');var BPromise=require('bluebird');var md5=require('md5');var Redis=require('ioredis');var config=require(_0xa028('0x1'));var logger=require(_0xa028('0x2'))(_0xa028('0x3'));config[_0xa028('0x4')]=_['defaults'](config[_0xa028('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa028('0x4')]));var EmailImap=require(_0xa028('0x5'));var EmailSmtp=require(_0xa028('0x6'));var mailAccount=require(_0xa028('0x7'));var md5Accounts={};function EmailChannel(_0xf6eec4){logger[_0xa028('0x8')]('start\x20email\x20channel');this[_0xa028('0x9')]=_0xf6eec4[_0xa028('0x9')];this[_0xa028('0xa')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0xa028('0xb')]['emit']=function(_0x168448){var _0xa3846a=this['mailAccounts'][_0x168448];var _0x3b7312={'id':_0xa3846a['id'],'name':_0xa3846a[_0xa028('0xc')],'key':_0xa3846a[_0xa028('0xd')],'active':_0xa3846a['active'],'Imap':{'status':_0xa3846a[_0xa028('0xe')][_0xa028('0xf')],'messageStatus':_0xa3846a[_0xa028('0xe')][_0xa028('0x10')],'total':_0xa3846a['Imap'][_0xa028('0x11')]}};if(_[_0xa028('0x12')](md5Accounts[_0x168448])){md5Accounts[_0x168448]={};}var _0x30408b=md5(JSON[_0xa028('0x13')](_0x3b7312));if(md5Accounts[_0x168448][_0xa028('0x14')]!==_0x30408b){md5Accounts[_0x168448][_0xa028('0x14')]=_0x30408b;io[_0xa028('0x15')](_0xa028('0x16'),_0x3b7312);}};EmailChannel[_0xa028('0xb')][_0xa028('0x17')]=function(_0x13c8ce){for(var _0x4ea1b6 in _0x13c8ce){if(_0x13c8ce['hasOwnProperty'](_0x4ea1b6)){if(_0x13c8ce[_0x4ea1b6][_0xa028('0xe')]&&_0x13c8ce[_0x4ea1b6]['active']){var _0x5d7562=_0x13c8ce[_0x4ea1b6]['Imap'];if(!this[_0xa028('0xa')][_0xa028('0x18')](_0x5d7562['id'])){this[_0xa028('0xa')][_0x5d7562['id']]=new EmailImap(_0x5d7562,_0x13c8ce[_0x4ea1b6]['email']);this[_0xa028('0xa')][_0x5d7562['id']]['on']('box',this[_0xa028('0x19')][_0xa028('0x1a')](this,_0x4ea1b6));this[_0xa028('0xa')][_0x5d7562['id']]['on'](_0xa028('0x3'),this[_0xa028('0x1b')][_0xa028('0x1a')](this,_0x4ea1b6));this[_0xa028('0xa')][_0x5d7562['id']]['on'](_0xa028('0x1c'),this[_0xa028('0x1d')]['bind'](this,_0x4ea1b6));this[_0xa028('0xa')][_0x5d7562['id']]['on'](_0xa028('0x1e'),this[_0xa028('0x1f')]['bind'](this,_0x4ea1b6));}}else{if(_[_0xa028('0x12')](this['mailAccounts'][_0x4ea1b6][_0xa028('0xe')])){this['mailAccounts'][_0x4ea1b6][_0xa028('0xe')]={};}this[_0xa028('0x9')][_0x4ea1b6][_0xa028('0xe')][_0xa028('0xf')]=_0xa028('0x20');this[_0xa028('0x9')][_0x4ea1b6][_0xa028('0xe')]['messageStatus']='';this[_0xa028('0x15')](_0x4ea1b6);}}}};EmailChannel['prototype'][_0xa028('0x19')]=function(_0x511d31,_0x44b151){if(this[_0xa028('0x9')][_0x511d31]){this[_0xa028('0x9')][_0x511d31][_0xa028('0xe')][_0xa028('0xf')]=_0xa028('0x21');this[_0xa028('0x9')][_0x511d31]['Imap'][_0xa028('0x10')]=_0x44b151['name'];if(_0x44b151[_0xa028('0x22')]){this[_0xa028('0x9')][_0x511d31][_0xa028('0xe')]['total']=_0x44b151[_0xa028('0x22')][_0xa028('0x11')];}return this[_0xa028('0x15')](_0x511d31);}};EmailChannel[_0xa028('0xb')]['handleImapEmail']=function(_0x2497a1,_0x4cb57c){logger[_0xa028('0x8')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x4cb57c[_0xa028('0x23')],_0x4cb57c[_0xa028('0x24')],_0x4cb57c[_0xa028('0x25')],_0x2497a1);if(this['mailAccounts'][_0x2497a1]){return mailAccount['notify'](_0x2497a1,_0x4cb57c)[_0xa028('0x26')](function(_0x13b67c){if(_0x13b67c){logger[_0xa028('0x8')]('Mail\x20accepted\x20from\x20routing');}})[_0xa028('0x27')](function(_0x4e55f1){logger[_0xa028('0x1e')](_0xa028('0x28'),JSON['stringify'](_0x4e55f1));});}};EmailChannel[_0xa028('0xb')][_0xa028('0x1d')]=function(_0x62401c){if(this[_0xa028('0x9')][_0x62401c]&&this['mailAccounts'][_0x62401c][_0xa028('0xe')]){if(this[_0xa028('0xa')][this['mailAccounts'][_0x62401c]['Imap']['id']]){delete this['imapAccounts'][this[_0xa028('0x9')][_0x62401c][_0xa028('0xe')]['id']];}this[_0xa028('0x9')][_0x62401c][_0xa028('0xe')]['lastSync']=moment();this[_0xa028('0x15')](_0x62401c);}};EmailChannel['prototype'][_0xa028('0x1f')]=function(_0x24185c,_0x5daec9){if(this[_0xa028('0x9')][_0x24185c]){this[_0xa028('0x9')][_0x24185c]['Imap'][_0xa028('0xf')]=_0xa028('0x1e');this[_0xa028('0x9')][_0x24185c][_0xa028('0xe')][_0xa028('0x10')]=_0x5daec9;return this[_0xa028('0x15')](_0x24185c);}};EmailChannel['prototype'][_0xa028('0x29')]=function(_0x13e8af,_0x8fa503){return this[_0xa028('0x2a')]['send'](_0x13e8af,_0x8fa503);};EmailChannel[_0xa028('0xb')]['verifySmtp']=function(_0x25b0be){var _0x29048d=this;if(this[_0xa028('0x9')][_0x25b0be['id']]){if(_[_0xa028('0x12')](this['mailAccounts'][_0x25b0be['id']]['Smtp'])){this[_0xa028('0x9')][_0x25b0be['id']][_0xa028('0x2b')]={};}this['mailAccounts'][_0x25b0be['id']][_0xa028('0x2b')][_0xa028('0x2c')]=moment();return new BPromise(function(_0x20425b,_0x87f9dc){return _0x29048d[_0xa028('0x2a')][_0xa028('0x2d')](_0x25b0be)[_0xa028('0x26')](function(_0x2906fd){_0x29048d['mailAccounts'][_0x25b0be['id']][_0xa028('0x2b')][_0xa028('0xf')]=_0xa028('0x2e');_0x29048d['mailAccounts'][_0x25b0be['id']][_0xa028('0x2b')]['messageStatus']='';_0x29048d[_0xa028('0x15')](_0x25b0be['id']);_0x20425b(_0x2906fd);})[_0xa028('0x27')](function(_0x164c9e){_0x29048d['mailAccounts'][_0x25b0be['id']][_0xa028('0x2b')]['status']=_0xa028('0x1e');_0x29048d[_0xa028('0x9')][_0x25b0be['id']][_0xa028('0x2b')][_0xa028('0x10')]=_0x164c9e;_0x29048d[_0xa028('0x15')](_0x25b0be['id']);_0x87f9dc(_0x164c9e);});});}return this[_0xa028('0x2a')][_0xa028('0x2d')](_0x25b0be);};module['exports']=EmailChannel; \ No newline at end of file +var _0x482b=['smtp','prototype','emit','key','active','Imap','messageStatus','total','stringify','refresh','hasOwnProperty','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','status','disabled','connected','name','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','sendMail','verifySmtp','isNil','Smtp','verify','verified','lodash','moment','bluebird','md5','ioredis','../../../config/environment','email','redis','defaults','localhost','socket.io-emitter','info','start\x20email\x20channel','mailAccounts','imapAccounts'];(function(_0x1a19e8,_0x3f733a){var _0x17f9a8=function(_0x34b843){while(--_0x34b843){_0x1a19e8['push'](_0x1a19e8['shift']());}};_0x17f9a8(++_0x3f733a);}(_0x482b,0x164));var _0xb482=function(_0x3de39a,_0x28e424){_0x3de39a=_0x3de39a-0x0;var _0x410ab2=_0x482b[_0x3de39a];return _0x410ab2;};'use strict';var _=require(_0xb482('0x0'));var moment=require(_0xb482('0x1'));var BPromise=require(_0xb482('0x2'));var md5=require(_0xb482('0x3'));var Redis=require(_0xb482('0x4'));var config=require(_0xb482('0x5'));var logger=require('../../../config/logger')(_0xb482('0x6'));config[_0xb482('0x7')]=_[_0xb482('0x8')](config[_0xb482('0x7')],{'host':_0xb482('0x9'),'port':0x18eb});var io=require(_0xb482('0xa'))(new Redis(config['redis']));var EmailImap=require('./imap');var EmailSmtp=require('./smtp');var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x10798a){logger[_0xb482('0xb')](_0xb482('0xc'));this[_0xb482('0xd')]=_0x10798a[_0xb482('0xd')];this[_0xb482('0xe')]={};this[_0xb482('0xf')]=new EmailSmtp();}EmailChannel[_0xb482('0x10')][_0xb482('0x11')]=function(_0x36d800){var _0x36ffed=this[_0xb482('0xd')][_0x36d800];var _0x1419ec={'id':_0x36ffed['id'],'name':_0x36ffed['name'],'key':_0x36ffed[_0xb482('0x12')],'active':_0x36ffed[_0xb482('0x13')],'Imap':{'status':_0x36ffed[_0xb482('0x14')]['status'],'messageStatus':_0x36ffed[_0xb482('0x14')][_0xb482('0x15')],'total':_0x36ffed[_0xb482('0x14')][_0xb482('0x16')]}};if(_['isNil'](md5Accounts[_0x36d800])){md5Accounts[_0x36d800]={};}var _0x2aa4a0=md5(JSON[_0xb482('0x17')](_0x1419ec));if(md5Accounts[_0x36d800][_0xb482('0x3')]!==_0x2aa4a0){md5Accounts[_0x36d800][_0xb482('0x3')]=_0x2aa4a0;io[_0xb482('0x11')]('mailAccount:update',_0x1419ec);}};EmailChannel[_0xb482('0x10')][_0xb482('0x18')]=function(_0x34c304){for(var _0x29a0b4 in _0x34c304){if(_0x34c304[_0xb482('0x19')](_0x29a0b4)){if(_0x34c304[_0x29a0b4][_0xb482('0x14')]&&_0x34c304[_0x29a0b4][_0xb482('0x13')]){var _0x1fa6a0=_0x34c304[_0x29a0b4][_0xb482('0x14')];if(!this[_0xb482('0xe')][_0xb482('0x19')](_0x1fa6a0['id'])){this[_0xb482('0xe')][_0x1fa6a0['id']]=new EmailImap(_0x1fa6a0,_0x34c304[_0x29a0b4][_0xb482('0x6')]);this['imapAccounts'][_0x1fa6a0['id']]['on']('box',this[_0xb482('0x1a')][_0xb482('0x1b')](this,_0x29a0b4));this[_0xb482('0xe')][_0x1fa6a0['id']]['on'](_0xb482('0x6'),this[_0xb482('0x1c')][_0xb482('0x1b')](this,_0x29a0b4));this[_0xb482('0xe')][_0x1fa6a0['id']]['on'](_0xb482('0x1d'),this[_0xb482('0x1e')][_0xb482('0x1b')](this,_0x29a0b4));this['imapAccounts'][_0x1fa6a0['id']]['on'](_0xb482('0x1f'),this[_0xb482('0x20')][_0xb482('0x1b')](this,_0x29a0b4));}}else{if(_['isNil'](this[_0xb482('0xd')][_0x29a0b4]['Imap'])){this['mailAccounts'][_0x29a0b4][_0xb482('0x14')]={};}this[_0xb482('0xd')][_0x29a0b4][_0xb482('0x14')][_0xb482('0x21')]=_0xb482('0x22');this[_0xb482('0xd')][_0x29a0b4][_0xb482('0x14')][_0xb482('0x15')]='';this['emit'](_0x29a0b4);}}}};EmailChannel['prototype'][_0xb482('0x1a')]=function(_0x3a524f,_0xc29999){if(this['mailAccounts'][_0x3a524f]){this['mailAccounts'][_0x3a524f][_0xb482('0x14')][_0xb482('0x21')]=_0xb482('0x23');this[_0xb482('0xd')][_0x3a524f][_0xb482('0x14')][_0xb482('0x15')]=_0xc29999[_0xb482('0x24')];if(_0xc29999[_0xb482('0x25')]){this[_0xb482('0xd')][_0x3a524f][_0xb482('0x14')][_0xb482('0x16')]=_0xc29999[_0xb482('0x25')][_0xb482('0x16')];}return this[_0xb482('0x11')](_0x3a524f);}};EmailChannel[_0xb482('0x10')][_0xb482('0x1c')]=function(_0x3217d1,_0x37d3b9){logger[_0xb482('0xb')](_0xb482('0x26'),_0x37d3b9[_0xb482('0x27')],_0x37d3b9[_0xb482('0x28')],_0x37d3b9[_0xb482('0x29')],_0x3217d1);if(this['mailAccounts'][_0x3217d1]){return mailAccount[_0xb482('0x2a')](_0x3217d1,_0x37d3b9)[_0xb482('0x2b')](function(_0x3de999){if(_0x3de999){logger[_0xb482('0xb')](_0xb482('0x2c'));}})[_0xb482('0x2d')](function(_0x454caa){logger[_0xb482('0x1f')](_0xb482('0x2e'),JSON[_0xb482('0x17')](_0x454caa));});}};EmailChannel[_0xb482('0x10')][_0xb482('0x1e')]=function(_0x12f435){if(this['mailAccounts'][_0x12f435]&&this[_0xb482('0xd')][_0x12f435][_0xb482('0x14')]){if(this[_0xb482('0xe')][this['mailAccounts'][_0x12f435]['Imap']['id']]){delete this['imapAccounts'][this[_0xb482('0xd')][_0x12f435][_0xb482('0x14')]['id']];}this['mailAccounts'][_0x12f435][_0xb482('0x14')]['lastSync']=moment();this[_0xb482('0x11')](_0x12f435);}};EmailChannel[_0xb482('0x10')][_0xb482('0x20')]=function(_0x53eb10,_0x307da2){if(this[_0xb482('0xd')][_0x53eb10]){this[_0xb482('0xd')][_0x53eb10][_0xb482('0x14')][_0xb482('0x21')]='error';this['mailAccounts'][_0x53eb10][_0xb482('0x14')][_0xb482('0x15')]=_0x307da2;return this[_0xb482('0x11')](_0x53eb10);}};EmailChannel[_0xb482('0x10')][_0xb482('0x2f')]=function(_0x2c01db,_0x2906d8){return this['smtp']['send'](_0x2c01db,_0x2906d8);};EmailChannel[_0xb482('0x10')][_0xb482('0x30')]=function(_0x2b9156){var _0x137762=this;if(this['mailAccounts'][_0x2b9156['id']]){if(_[_0xb482('0x31')](this['mailAccounts'][_0x2b9156['id']][_0xb482('0x32')])){this['mailAccounts'][_0x2b9156['id']]['Smtp']={};}this[_0xb482('0xd')][_0x2b9156['id']][_0xb482('0x32')]['lastSync']=moment();return new BPromise(function(_0x466e36,_0x14844a){return _0x137762[_0xb482('0xf')][_0xb482('0x33')](_0x2b9156)['then'](function(_0x3d3eaa){_0x137762[_0xb482('0xd')][_0x2b9156['id']][_0xb482('0x32')][_0xb482('0x21')]=_0xb482('0x34');_0x137762[_0xb482('0xd')][_0x2b9156['id']][_0xb482('0x32')][_0xb482('0x15')]='';_0x137762[_0xb482('0x11')](_0x2b9156['id']);_0x466e36(_0x3d3eaa);})[_0xb482('0x2d')](function(_0x196421){_0x137762[_0xb482('0xd')][_0x2b9156['id']][_0xb482('0x32')][_0xb482('0x21')]=_0xb482('0x1f');_0x137762['mailAccounts'][_0x2b9156['id']][_0xb482('0x32')]['messageStatus']=_0x196421;_0x137762['emit'](_0x2b9156['id']);_0x14844a(_0x196421);});});}return this[_0xb482('0xf')]['verify'](_0x2b9156);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 02dab2b..1bf239b 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 _0x00f0=['EventEmitter','./utils','INBOX','account','once','ready','bind','handleEnd','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','isNil','service','authentication','user','password','host','port','tls','autotls','required','anonymous@xcally.com','handleReady','openBox','mailbox','handleOpenBox','emit','box','handleCloseBox','readUnseen','search','handleReadUnseen','fetch','message','handleFetchMessage','handleFetchError','end','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','email','textCode','upperFirst','exports','path','util','imap','lodash','simpleParser','iconv','Iconv','events'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x00f0,0xf0));var _0x000f=function(_0x3ee44a,_0x3f3e65){_0x3ee44a=_0x3ee44a-0x0;var _0x1fa508=_0x00f0[_0x3ee44a];return _0x1fa508;};'use strict';var fs=require('fs');var path=require(_0x000f('0x0'));var util=require(_0x000f('0x1'));var Imap=require(_0x000f('0x2'));var _=require(_0x000f('0x3'));var rs=require('randomstring');var simpleParser=require('mailparser')[_0x000f('0x4')];var Iconv=require(_0x000f('0x5'))[_0x000f('0x6')];var EventEmitter=require(_0x000f('0x7'))[_0x000f('0x8')];var utils=require(_0x000f('0x9'));var logger=require('../../../config/logger')('email');function EmailImap(_0x2d00c4,_0x1c0831){this['mailbox']=_0x000f('0xa');this[_0x000f('0xb')]=this['getAccount'](_0x2d00c4,_0x1c0831);this[_0x000f('0x2')]=new Imap(this[_0x000f('0xb')]);this['imap'][_0x000f('0xc')](_0x000f('0xd'),this['handleReady'][_0x000f('0xe')](this));this[_0x000f('0x2')][_0x000f('0xc')]('end',this[_0x000f('0xf')][_0x000f('0xe')](this));this[_0x000f('0x2')]['on'](_0x000f('0x10'),this[_0x000f('0x11')][_0x000f('0xe')](this));this['imap'][_0x000f('0x12')]();}util[_0x000f('0x13')](EmailImap,EventEmitter);EmailImap[_0x000f('0x14')]['getAccount']=function(_0x1685cc,_0x302c28){var _0x561de7={'connTimeout':_0x1685cc['connTimeout']?_0x1685cc[_0x000f('0x15')]*0x3e8:0x2710,'authTimeout':_0x1685cc['authTimeout']?_0x1685cc[_0x000f('0x16')]*0x3e8:0x1388};if(_[_0x000f('0x17')](_0x1685cc[_0x000f('0x18')])){if(_0x1685cc[_0x000f('0x19')]){_0x561de7[_0x000f('0x1a')]=_0x1685cc['user'];_0x561de7[_0x000f('0x1b')]=_0x1685cc[_0x000f('0x1b')];}_0x561de7[_0x000f('0x1c')]=_0x1685cc[_0x000f('0x1c')];_0x561de7[_0x000f('0x1d')]=_0x1685cc[_0x000f('0x1d')]||0x3e1;if(_0x1685cc[_0x000f('0x1e')]){_0x561de7['tls']=!![];}else{_0x561de7[_0x000f('0x1e')]=![];_0x561de7[_0x000f('0x1f')]=_0x000f('0x20');}}else{_0x561de7[_0x000f('0x1a')]=_0x1685cc[_0x000f('0x1a')];_0x561de7[_0x000f('0x1b')]=_0x1685cc['password'];_0x561de7['host']=utils['getHost'](_0x1685cc[_0x000f('0x18')]);_0x561de7[_0x000f('0x1d')]=0x3e1;_0x561de7[_0x000f('0x1e')]=!![];}_0x561de7['email']=_0x302c28||_0x1685cc[_0x000f('0x1a')]||_0x000f('0x21');return _0x561de7;};EmailImap[_0x000f('0x14')][_0x000f('0x22')]=function(){this[_0x000f('0x2')][_0x000f('0x23')](this[_0x000f('0x24')],![],this[_0x000f('0x25')][_0x000f('0xe')](this));};EmailImap[_0x000f('0x14')][_0x000f('0x25')]=function(_0x1596fc,_0x122e22){if(_0x1596fc){this[_0x000f('0x11')](_0x1596fc,!![]);}else{this[_0x000f('0x26')](_0x000f('0x27'),_0x122e22);this['readUnseen']();}};EmailImap['prototype'][_0x000f('0x28')]=function(_0x1680aa){if(_0x1680aa){this[_0x000f('0x11')](_0x1680aa,!![]);}else{this['imap']['end']();}};EmailImap[_0x000f('0x14')][_0x000f('0x29')]=function(){this[_0x000f('0x2')][_0x000f('0x2a')](['UNSEEN'],this[_0x000f('0x2b')][_0x000f('0xe')](this));};EmailImap[_0x000f('0x14')]['handleReadUnseen']=function(_0x36a947,_0x45a152){if(_0x36a947){this[_0x000f('0x11')](_0x36a947,!![]);}else{if(_0x45a152['length']){try{var _0x2738b2=this[_0x000f('0x2')][_0x000f('0x2c')](_0x45a152,{'bodies':'','markSeen':!![]});_0x2738b2['on'](_0x000f('0x2d'),this[_0x000f('0x2e')][_0x000f('0xe')](this));_0x2738b2[_0x000f('0xc')](_0x000f('0x10'),this[_0x000f('0x2f')][_0x000f('0xe')](this));_0x2738b2[_0x000f('0xc')](_0x000f('0x30'),this[_0x000f('0x31')][_0x000f('0xe')](this));}catch(_0x5859b9){logger[_0x000f('0x10')](_0x5859b9);}}else{this['imap'][_0x000f('0x32')](!![],this[_0x000f('0x28')][_0x000f('0xe')](this));}}};EmailImap['prototype'][_0x000f('0x2e')]=function(_0x236aec,_0x66065){_0x236aec['on'](_0x000f('0x33'),this[_0x000f('0x34')]['bind'](this));_0x236aec[_0x000f('0xc')](_0x000f('0x35'),this[_0x000f('0x36')]['bind'](this));_0x236aec[_0x000f('0xc')](_0x000f('0x30'),this[_0x000f('0x37')][_0x000f('0xe')](this));};EmailImap[_0x000f('0x14')][_0x000f('0x34')]=function(_0x4fd0e4,_0x2c5e9b){simpleParser(_0x4fd0e4,{'Iconv':Iconv},this[_0x000f('0x38')][_0x000f('0xe')](this));};EmailImap[_0x000f('0x14')][_0x000f('0x36')]=function(_0x17586a){};EmailImap[_0x000f('0x14')]['handleMessageEnd']=function(){};EmailImap[_0x000f('0x14')][_0x000f('0x38')]=function(_0x3f6d5c,_0x2a0c92){if(_0x3f6d5c){logger['error'](_0x3f6d5c);}else{var _0x62ebf2=this;utils[_0x000f('0x39')](this[_0x000f('0xb')],_0x2a0c92,function(_0x8578bc){_0x62ebf2['emit'](_0x000f('0x3a'),_0x8578bc);});}};EmailImap['prototype'][_0x000f('0x31')]=function(){this[_0x000f('0x2')][_0x000f('0x32')](!![],this[_0x000f('0x28')][_0x000f('0xe')](this));};EmailImap[_0x000f('0x14')][_0x000f('0x2f')]=function(_0x49a960){this['handleError'](_0x49a960);this[_0x000f('0x2')]['closeBox'](!![],this['handleCloseBox']['bind'](this));};EmailImap[_0x000f('0x14')][_0x000f('0xf')]=function(){this[_0x000f('0x26')](_0x000f('0x30'));};EmailImap[_0x000f('0x14')][_0x000f('0x11')]=function(_0x42cb77,_0x1d48c3){logger['error']('handleError',this[_0x000f('0xb')][_0x000f('0x3a')],JSON['stringify'](_0x42cb77));var _0x239b31='';if(_0x42cb77){if(_0x42cb77['textCode']){_0x239b31=_0x42cb77[_0x000f('0x3b')];}else{for(var _0x5aa836 in _0x42cb77){if(_0x42cb77['hasOwnProperty'](_0x5aa836)){_0x239b31+=_[_0x000f('0x3c')](_0x5aa836)+':\x20'+_0x42cb77[_0x5aa836]+'\x0a';}}}}if(_0x1d48c3){this['imap'][_0x000f('0x30')]();}else{this[_0x000f('0x26')](_0x000f('0x10'),_0x239b31);this[_0x000f('0x26')](_0x000f('0x30'));}};module[_0x000f('0x3d')]=EmailImap; \ No newline at end of file +var _0x0439=['handleError','inherits','prototype','connTimeout','authTimeout','isNil','service','authentication','user','password','port','tls','autotls','host','getHost','anonymous@xcally.com','openBox','handleOpenBox','emit','box','readUnseen','search','UNSEEN','handleReadUnseen','length','fetch','handleFetchMessage','closeBox','handleCloseBox','body','handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','email','handleFetchError','stringify','textCode','upperFirst','exports','path','util','imap','lodash','randomstring','mailparser','simpleParser','Iconv','events','EventEmitter','../../../config/logger','mailbox','account','once','ready','handleReady','end','bind','error'];(function(_0x3fd06c,_0x110ec5){var _0x48942a=function(_0x543d75){while(--_0x543d75){_0x3fd06c['push'](_0x3fd06c['shift']());}};_0x48942a(++_0x110ec5);}(_0x0439,0xdd));var _0x9043=function(_0x4607e1,_0x596f78){_0x4607e1=_0x4607e1-0x0;var _0x22f1b2=_0x0439[_0x4607e1];return _0x22f1b2;};'use strict';var fs=require('fs');var path=require(_0x9043('0x0'));var util=require(_0x9043('0x1'));var Imap=require(_0x9043('0x2'));var _=require(_0x9043('0x3'));var rs=require(_0x9043('0x4'));var simpleParser=require(_0x9043('0x5'))[_0x9043('0x6')];var Iconv=require('iconv')[_0x9043('0x7')];var EventEmitter=require(_0x9043('0x8'))[_0x9043('0x9')];var utils=require('./utils');var logger=require(_0x9043('0xa'))('email');function EmailImap(_0x4f79c2,_0x2fe4da){this[_0x9043('0xb')]='INBOX';this[_0x9043('0xc')]=this['getAccount'](_0x4f79c2,_0x2fe4da);this[_0x9043('0x2')]=new Imap(this[_0x9043('0xc')]);this['imap'][_0x9043('0xd')](_0x9043('0xe'),this[_0x9043('0xf')]['bind'](this));this['imap'][_0x9043('0xd')](_0x9043('0x10'),this['handleEnd'][_0x9043('0x11')](this));this[_0x9043('0x2')]['on'](_0x9043('0x12'),this[_0x9043('0x13')][_0x9043('0x11')](this));this[_0x9043('0x2')]['connect']();}util[_0x9043('0x14')](EmailImap,EventEmitter);EmailImap[_0x9043('0x15')]['getAccount']=function(_0x18f916,_0xe65772){var _0x5249d9={'connTimeout':_0x18f916[_0x9043('0x16')]?_0x18f916[_0x9043('0x16')]*0x3e8:0x2710,'authTimeout':_0x18f916[_0x9043('0x17')]?_0x18f916[_0x9043('0x17')]*0x3e8:0x1388};if(_[_0x9043('0x18')](_0x18f916[_0x9043('0x19')])){if(_0x18f916[_0x9043('0x1a')]){_0x5249d9[_0x9043('0x1b')]=_0x18f916[_0x9043('0x1b')];_0x5249d9[_0x9043('0x1c')]=_0x18f916['password'];}_0x5249d9['host']=_0x18f916['host'];_0x5249d9[_0x9043('0x1d')]=_0x18f916[_0x9043('0x1d')]||0x3e1;if(_0x18f916[_0x9043('0x1e')]){_0x5249d9[_0x9043('0x1e')]=!![];}else{_0x5249d9['tls']=![];_0x5249d9[_0x9043('0x1f')]='required';}}else{_0x5249d9['user']=_0x18f916[_0x9043('0x1b')];_0x5249d9[_0x9043('0x1c')]=_0x18f916[_0x9043('0x1c')];_0x5249d9[_0x9043('0x20')]=utils[_0x9043('0x21')](_0x18f916[_0x9043('0x19')]);_0x5249d9[_0x9043('0x1d')]=0x3e1;_0x5249d9[_0x9043('0x1e')]=!![];}_0x5249d9['email']=_0xe65772||_0x18f916[_0x9043('0x1b')]||_0x9043('0x22');return _0x5249d9;};EmailImap[_0x9043('0x15')]['handleReady']=function(){this[_0x9043('0x2')][_0x9043('0x23')](this[_0x9043('0xb')],![],this[_0x9043('0x24')][_0x9043('0x11')](this));};EmailImap['prototype'][_0x9043('0x24')]=function(_0xca0bb1,_0x6d23af){if(_0xca0bb1){this[_0x9043('0x13')](_0xca0bb1,!![]);}else{this[_0x9043('0x25')](_0x9043('0x26'),_0x6d23af);this['readUnseen']();}};EmailImap[_0x9043('0x15')]['handleCloseBox']=function(_0x45bec7){if(_0x45bec7){this[_0x9043('0x13')](_0x45bec7,!![]);}else{this[_0x9043('0x2')][_0x9043('0x10')]();}};EmailImap['prototype'][_0x9043('0x27')]=function(){this[_0x9043('0x2')][_0x9043('0x28')]([_0x9043('0x29')],this[_0x9043('0x2a')]['bind'](this));};EmailImap[_0x9043('0x15')][_0x9043('0x2a')]=function(_0xeaca86,_0x4e4363){if(_0xeaca86){this[_0x9043('0x13')](_0xeaca86,!![]);}else{if(_0x4e4363[_0x9043('0x2b')]){try{var _0x485b2c=this[_0x9043('0x2')][_0x9043('0x2c')](_0x4e4363,{'bodies':'','markSeen':!![]});_0x485b2c['on']('message',this[_0x9043('0x2d')][_0x9043('0x11')](this));_0x485b2c[_0x9043('0xd')](_0x9043('0x12'),this['handleFetchError'][_0x9043('0x11')](this));_0x485b2c[_0x9043('0xd')]('end',this['handleFetchEnd'][_0x9043('0x11')](this));}catch(_0x579277){logger[_0x9043('0x12')](_0x579277);}}else{this[_0x9043('0x2')][_0x9043('0x2e')](!![],this[_0x9043('0x2f')]['bind'](this));}}};EmailImap['prototype'][_0x9043('0x2d')]=function(_0x446956,_0x391a82){_0x446956['on'](_0x9043('0x30'),this[_0x9043('0x31')][_0x9043('0x11')](this));_0x446956[_0x9043('0xd')]('attributes',this[_0x9043('0x32')]['bind'](this));_0x446956[_0x9043('0xd')]('end',this[_0x9043('0x33')][_0x9043('0x11')](this));};EmailImap['prototype']['handleMessageBody']=function(_0x20e145,_0x2c8697){simpleParser(_0x20e145,{'Iconv':Iconv},this[_0x9043('0x34')][_0x9043('0x11')](this));};EmailImap[_0x9043('0x15')][_0x9043('0x32')]=function(_0x3a9fe2){};EmailImap[_0x9043('0x15')][_0x9043('0x33')]=function(){};EmailImap[_0x9043('0x15')][_0x9043('0x34')]=function(_0x19b858,_0x4a0f7b){if(_0x19b858){logger[_0x9043('0x12')](_0x19b858);}else{var _0x5187bf=this;utils[_0x9043('0x35')](this[_0x9043('0xc')],_0x4a0f7b,function(_0x5844a9){_0x5187bf[_0x9043('0x25')](_0x9043('0x36'),_0x5844a9);});}};EmailImap[_0x9043('0x15')]['handleFetchEnd']=function(){this[_0x9043('0x2')][_0x9043('0x2e')](!![],this[_0x9043('0x2f')][_0x9043('0x11')](this));};EmailImap[_0x9043('0x15')][_0x9043('0x37')]=function(_0x6d19b7){this[_0x9043('0x13')](_0x6d19b7);this['imap'][_0x9043('0x2e')](!![],this['handleCloseBox']['bind'](this));};EmailImap[_0x9043('0x15')]['handleEnd']=function(){this[_0x9043('0x25')]('end');};EmailImap[_0x9043('0x15')][_0x9043('0x13')]=function(_0x2c479d,_0x38028b){logger[_0x9043('0x12')](_0x9043('0x13'),this['account'][_0x9043('0x36')],JSON[_0x9043('0x38')](_0x2c479d));var _0x241f7e='';if(_0x2c479d){if(_0x2c479d['textCode']){_0x241f7e=_0x2c479d[_0x9043('0x39')];}else{for(var _0x570b46 in _0x2c479d){if(_0x2c479d['hasOwnProperty'](_0x570b46)){_0x241f7e+=_[_0x9043('0x3a')](_0x570b46)+':\x20'+_0x2c479d[_0x570b46]+'\x0a';}}}}if(_0x38028b){this['imap'][_0x9043('0x10')]();}else{this[_0x9043('0x25')]('error',_0x241f7e);this['emit'](_0x9043('0x10'));}};module[_0x9043('0x3b')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 361f788..8142800 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 _0x861c=['createTransport','use','sendMail','toString','verify','nodemailer','bluebird','nodemailer-plugin-inline-base64','prototype','send'];(function(_0x2402c9,_0x14157f){var _0x44d76a=function(_0x24d810){while(--_0x24d810){_0x2402c9['push'](_0x2402c9['shift']());}};_0x44d76a(++_0x14157f);}(_0x861c,0x1d1));var _0xc861=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x861c[_0x20a584];return _0x4b41a8;};'use strict';var nodemailer=require(_0xc861('0x0'));var BPromise=require(_0xc861('0x1'));var inlineBase64=require(_0xc861('0x2'));function EmailSmtp(){}EmailSmtp[_0xc861('0x3')][_0xc861('0x4')]=function(_0x441d24,_0x1855f2){return new BPromise(function(_0x1de7a6,_0x135211){var _0x2e587e=nodemailer[_0xc861('0x5')](_0x441d24);_0x2e587e[_0xc861('0x6')]('compile',inlineBase64());_0x2e587e[_0xc861('0x7')](_0x1855f2,function(_0x54749e,_0x266e33){if(_0x54749e){_0x135211(_0x54749e[_0xc861('0x8')]());}else{_0x1de7a6(_0x266e33);}});});};EmailSmtp[_0xc861('0x3')]['verify']=function(_0xfc41b6){return new BPromise(function(_0x27c112,_0x3a25e7){var _0x4d066b=nodemailer[_0xc861('0x5')](_0xfc41b6);_0x4d066b[_0xc861('0x9')](function(_0x648f2a,_0x46be1c){if(_0x648f2a){_0x3a25e7(_0x648f2a[_0xc861('0x8')]());}else{if(_0x46be1c){_0x27c112(_0x46be1c);}else{_0x3a25e7('Not\x20verifired');}}});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0xcd58=['createTransport','use','compile','toString','prototype','verify','exports','nodemailer','bluebird','nodemailer-plugin-inline-base64','send'];(function(_0x318807,_0x51678f){var _0x33ea7e=function(_0x41b62d){while(--_0x41b62d){_0x318807['push'](_0x318807['shift']());}};_0x33ea7e(++_0x51678f);}(_0xcd58,0x125));var _0x8cd5=function(_0x17784a,_0x42fe44){_0x17784a=_0x17784a-0x0;var _0x41aded=_0xcd58[_0x17784a];return _0x41aded;};'use strict';var nodemailer=require(_0x8cd5('0x0'));var BPromise=require(_0x8cd5('0x1'));var inlineBase64=require(_0x8cd5('0x2'));function EmailSmtp(){}EmailSmtp['prototype'][_0x8cd5('0x3')]=function(_0x5b2fbb,_0x4f0735){return new BPromise(function(_0x5aebeb,_0x2f6f08){var _0x3b4ff8=nodemailer[_0x8cd5('0x4')](_0x5b2fbb);_0x3b4ff8[_0x8cd5('0x5')](_0x8cd5('0x6'),inlineBase64());_0x3b4ff8['sendMail'](_0x4f0735,function(_0x24a8f6,_0x1c43a1){if(_0x24a8f6){_0x2f6f08(_0x24a8f6[_0x8cd5('0x7')]());}else{_0x5aebeb(_0x1c43a1);}});});};EmailSmtp[_0x8cd5('0x8')][_0x8cd5('0x9')]=function(_0x249bf6){return new BPromise(function(_0x16c14b,_0x5b22a3){var _0x3b42c4=nodemailer[_0x8cd5('0x4')](_0x249bf6);_0x3b42c4[_0x8cd5('0x9')](function(_0x4199a9,_0x9c440f){if(_0x4199a9){_0x5b22a3(_0x4199a9[_0x8cd5('0x7')]());}else{if(_0x9c440f){_0x16c14b(_0x9c440f);}else{_0x5b22a3('Not\x20verifired');}}});});};module[_0x8cd5('0xa')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 8234140..9c77850 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 _0x9aac=['Data','getHost','gmail','yahoo','imap.mail.yahoo.com','hotmail','outlook365','outlook.office365.com','127.0.0.1','lodash','randomstring','path','node-tnef','email','value','address','generate','@xcally.com','head','name','indexOf','split','length','slice','join','Anonymous','isEmpty','anonymous','html','test','replace','includes','','body','textAsHtml','Empty\x20message

','Attachments','Title'];(function(_0x2714ce,_0x4214b3){var _0x1d5cba=function(_0x321964){while(--_0x321964){_0x2714ce['push'](_0x2714ce['shift']());}};_0x1d5cba(++_0x4214b3);}(_0x9aac,0x135));var _0xc9aa=function(_0x55799d,_0x5c6242){_0x55799d=_0x55799d-0x0;var _0x10425a=_0x9aac[_0x55799d];return _0x10425a;};'use strict';var _=require(_0xc9aa('0x0'));var moment=require('moment');var random=require(_0xc9aa('0x1'));var fs=require('fs');var path=require(_0xc9aa('0x2'));var util=require('util');var tnef=require(_0xc9aa('0x3'));var logger=require('../../../config/logger')(_0xc9aa('0x4'));var config=require('../../../config/environment');function getAddress(_0x28c49c){var _0x267772=_['head'](_0x28c49c[_0xc9aa('0x5')]);return _0x267772&&_0x267772[_0xc9aa('0x6')]?_0x267772[_0xc9aa('0x6')]:'anonymous'+random[_0xc9aa('0x7')](0x6)+_0xc9aa('0x8');}function getFirstName(_0x2acfd4){var _0x4d8071=_[_0xc9aa('0x9')](_0x2acfd4[_0xc9aa('0x5')]);if(_0x4d8071&&_0x4d8071[_0xc9aa('0xa')]){if(_0x4d8071['name']==_0x4d8071['address']){return _0x4d8071[_0xc9aa('0xa')]['substring'](0x0,_0x4d8071[_0xc9aa('0xa')][_0xc9aa('0xb')]('@'));}var _0x248d4e=_0x4d8071[_0xc9aa('0xa')][_0xc9aa('0xc')](/\s+/);return _0x248d4e[_0xc9aa('0xd')]>0x1?_0x248d4e[_0xc9aa('0xe')](0x0,-0x1)[_0xc9aa('0xf')]('\x20'):_0x4d8071[_0xc9aa('0xa')];}return _0xc9aa('0x10');}function getLastName(_0x441ef7){var _0x884c9d=_[_0xc9aa('0x9')](_0x441ef7[_0xc9aa('0x5')]);if(_0x884c9d&&_0x884c9d[_0xc9aa('0xa')]){var _0x340243=_0x884c9d[_0xc9aa('0xa')]['split'](/\s+/);return _0x340243[_0xc9aa('0xd')]>0x1?_0x340243['pop']():'';}return'';}function getMails(_0x5b351f,_0x477ca5){var _0x553805='';for(var _0x13ed6c=0x0;_0x13ed6c<_0x477ca5[_0xc9aa('0x5')]['length'];_0x13ed6c+=0x1){if(_0x477ca5[_0xc9aa('0x5')][_0x13ed6c][_0xc9aa('0x6')]!==_0x5b351f){if(!_[_0xc9aa('0x11')](_0x553805)){_0x553805+=',';}_0x553805+=_0x477ca5['value'][_0x13ed6c][_0xc9aa('0xa')]||_0x477ca5[_0xc9aa('0x5')][_0x13ed6c][_0xc9aa('0x6')]||'';_0x553805+='\x20<';_0x553805+=_0x477ca5[_0xc9aa('0x5')][_0x13ed6c][_0xc9aa('0x6')]?_0x477ca5[_0xc9aa('0x5')][_0x13ed6c]['address']:_0xc9aa('0x12')+random['generate'](0x6)+_0xc9aa('0x8');_0x553805+='>';}}return _0x553805;}function parseEmail(_0x5b5ffc,_0x7c837f,_0x5e51e9){if(_0x7c837f[_0xc9aa('0x13')]){var _0x3f8bfd=/)<[^<]*)*<\/script>/gi;while(_0x3f8bfd[_0xc9aa('0x14')](_0x7c837f[_0xc9aa('0x13')])){_0x7c837f['html']=_0x7c837f[_0xc9aa('0x13')][_0xc9aa('0x15')](_0x3f8bfd,'');}if(_0x7c837f[_0xc9aa('0x13')][_0xc9aa('0x16')](_0xc9aa('0x17'))){var _0x4fdeef=[];_0x7c837f[_0xc9aa('0x18')][_0xc9aa('0x19')](_0x69a963=>{_0x4fdeef[_0xc9aa('0x1a')](_0x69a963[_0xc9aa('0x1b')]);});var _0x13cb3f=/]+>/g;var _0xee06f1=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x4dab46=_0x7c837f[_0xc9aa('0x13')][_0xc9aa('0x15')](_0xee06f1,'_SRC');var _0x48c5df=_0x4dab46[_0xc9aa('0x15')](_0x13cb3f,_0xc9aa('0x1c'));for(let _0x24d2bc=0x0;_0x24d2bc<_0x4fdeef[_0xc9aa('0xd')];_0x24d2bc++){var _0xcf0db8=_0x48c5df[_0xc9aa('0x15')](_0xc9aa('0x1c'),'\x20[Attachment:\x20'+_0x4fdeef[_0x24d2bc]+_0xc9aa('0x1d'));_0x48c5df=_0xcf0db8;}_0x7c837f[_0xc9aa('0x13')]=_0x48c5df;}_0x5e51e9[_0xc9aa('0x1e')]=_0x7c837f[_0xc9aa('0x13')];}else{_0x5e51e9[_0xc9aa('0x1e')]=_0x7c837f[_0xc9aa('0x1f')];}if(_0x5e51e9[_0xc9aa('0x1e')]){_0x5e51e9['body']=_0x5e51e9[_0xc9aa('0x1e')][_0xc9aa('0x15')](/0x0){var _0x2bf707=[_0xc9aa('0x2f'),_0xc9aa('0x30'),'Precedence:\x20auto_reply'];for(var _0x5ba45d=0x0;_0x5ba45d<_0x7c837f[_0xc9aa('0x2e')]['length'];_0x5ba45d++){var _0x20f1ca=_[_0xc9aa('0xb')](_0x2bf707,_0x7c837f[_0xc9aa('0x2e')][_0x5ba45d][_0xc9aa('0x31')]);if(_0x20f1ca>=0x0){_0x5e51e9['isAutoreply']=!![];}}}return _0x5e51e9;}exports[_0xc9aa('0x32')]=function(_0x59006b,_0x2990f0,_0x4692e3){var _0x407d74={'from':getAddress(_0x2990f0[_0xc9aa('0x33')]),'firstName':getFirstName(_0x2990f0[_0xc9aa('0x33')]),'lastName':getLastName(_0x2990f0['from']),'mapKey':_0xc9aa('0x4'),'message':{'from':getMails(_0x59006b['email'],_0x2990f0[_0xc9aa('0x33')]),'to':_0x59006b[_0xc9aa('0x4')],'cc':'','subject':_0x2990f0[_0xc9aa('0x34')]||'','messageId':_0x2990f0[_0xc9aa('0x35')],'inReplyTo':_0x2990f0[_0xc9aa('0x36')],'sentAt':moment(_0x2990f0[_0xc9aa('0x37')])[_0xc9aa('0x38')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x2990f0['html']&&!_0x2990f0[_0xc9aa('0x1f')]){var _0x4f4b0c=_[_0xc9aa('0x39')](_0x2990f0['attachments'],{'contentType':_0xc9aa('0x3a')});if(_0x4f4b0c[_0xc9aa('0xd')]){logger[_0xc9aa('0x3b')](util[_0xc9aa('0x38')](_0xc9aa('0x3c'),_0x2990f0[_0xc9aa('0x35')]));tnef[_0xc9aa('0x3d')](_[_0xc9aa('0x3e')](_0x4f4b0c)[_0xc9aa('0x2c')],function(_0x40da91,_0xcc14b7){if(_0xcc14b7){_0x2990f0[_0xc9aa('0x13')]=_0xcc14b7['BodyHTML']||_0xc9aa('0x3f');if(_0xcc14b7[_0xc9aa('0x40')]){for(var _0x575c7b=0x0;_0x575c7b<_0xcc14b7['Attachments']['length'];_0x575c7b++){var _0x490e91=_0xcc14b7['Attachments'][_0x575c7b];_0x407d74['message']['attachments']['push']({'filename':_0x490e91[_0xc9aa('0x41')],'content':Buffer[_0xc9aa('0x33')](_0x490e91[_0xc9aa('0x42')])});}}}_0x4692e3(parseEmail(_0x59006b,_0x2990f0,_0x407d74));});}else{_0x2990f0[_0xc9aa('0x13')]=_0xc9aa('0x3f');_0x4692e3(parseEmail(_0x59006b,_0x2990f0,_0x407d74));}}else{_0x4692e3(parseEmail(_0x59006b,_0x2990f0,_0x407d74));}};exports[_0xc9aa('0x43')]=function(_0x4324d2){switch(_0x4324d2){case _0xc9aa('0x44'):return'imap.gmail.com';case _0xc9aa('0x45'):return _0xc9aa('0x46');case _0xc9aa('0x47'):return'imap-mail.outlook.com';case _0xc9aa('0x48'):return _0xc9aa('0x49');}return _0xc9aa('0x4a');}; \ No newline at end of file +var _0xb7ac=['gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','lodash','moment','randomstring','path','util','../../../config/logger','../../../config/environment','head','value','address','generate','@xcally.com','name','substring','indexOf','split','slice','join','Anonymous','length','pop','isEmpty','html','test','replace','attachments','forEach','push','_SRC','_IMG','\x20[Attachment:\x20','body','textAsHtml','Empty\x20message

','Attachments','Title','Data','getHost'];(function(_0x17f389,_0x47acc2){var _0x5b129f=function(_0xfba30a){while(--_0xfba30a){_0x17f389['push'](_0x17f389['shift']());}};_0x5b129f(++_0x47acc2);}(_0xb7ac,0x18a));var _0xcb7a=function(_0x8d6df9,_0x467f7d){_0x8d6df9=_0x8d6df9-0x0;var _0x3ee34d=_0xb7ac[_0x8d6df9];return _0x3ee34d;};'use strict';var _=require(_0xcb7a('0x0'));var moment=require(_0xcb7a('0x1'));var random=require(_0xcb7a('0x2'));var fs=require('fs');var path=require(_0xcb7a('0x3'));var util=require(_0xcb7a('0x4'));var tnef=require('node-tnef');var logger=require(_0xcb7a('0x5'))('email');var config=require(_0xcb7a('0x6'));function getAddress(_0xaa5a21){var _0x50be72=_[_0xcb7a('0x7')](_0xaa5a21[_0xcb7a('0x8')]);return _0x50be72&&_0x50be72[_0xcb7a('0x9')]?_0x50be72['address']:'anonymous'+random[_0xcb7a('0xa')](0x6)+_0xcb7a('0xb');}function getFirstName(_0x555ea7){var _0x2655b5=_[_0xcb7a('0x7')](_0x555ea7[_0xcb7a('0x8')]);if(_0x2655b5&&_0x2655b5[_0xcb7a('0xc')]){if(_0x2655b5[_0xcb7a('0xc')]==_0x2655b5[_0xcb7a('0x9')]){return _0x2655b5['name'][_0xcb7a('0xd')](0x0,_0x2655b5[_0xcb7a('0xc')][_0xcb7a('0xe')]('@'));}var _0x5d84a9=_0x2655b5[_0xcb7a('0xc')][_0xcb7a('0xf')](/\s+/);return _0x5d84a9['length']>0x1?_0x5d84a9[_0xcb7a('0x10')](0x0,-0x1)[_0xcb7a('0x11')]('\x20'):_0x2655b5[_0xcb7a('0xc')];}return _0xcb7a('0x12');}function getLastName(_0x3ec54d){var _0xb8b4f6=_[_0xcb7a('0x7')](_0x3ec54d[_0xcb7a('0x8')]);if(_0xb8b4f6&&_0xb8b4f6[_0xcb7a('0xc')]){var _0x578f9c=_0xb8b4f6[_0xcb7a('0xc')]['split'](/\s+/);return _0x578f9c[_0xcb7a('0x13')]>0x1?_0x578f9c[_0xcb7a('0x14')]():'';}return'';}function getMails(_0x7f1071,_0x37ea19){var _0x53721a='';for(var _0x2bb2e9=0x0;_0x2bb2e9<_0x37ea19[_0xcb7a('0x8')][_0xcb7a('0x13')];_0x2bb2e9+=0x1){if(_0x37ea19[_0xcb7a('0x8')][_0x2bb2e9][_0xcb7a('0x9')]!==_0x7f1071){if(!_[_0xcb7a('0x15')](_0x53721a)){_0x53721a+=',';}_0x53721a+=_0x37ea19[_0xcb7a('0x8')][_0x2bb2e9]['name']||_0x37ea19[_0xcb7a('0x8')][_0x2bb2e9][_0xcb7a('0x9')]||'';_0x53721a+='\x20<';_0x53721a+=_0x37ea19[_0xcb7a('0x8')][_0x2bb2e9][_0xcb7a('0x9')]?_0x37ea19['value'][_0x2bb2e9]['address']:'anonymous'+random[_0xcb7a('0xa')](0x6)+'@xcally.com';_0x53721a+='>';}}return _0x53721a;}function parseEmail(_0x273bbb,_0x112d6e,_0x30c745){if(_0x112d6e[_0xcb7a('0x16')]){var _0x45e54b=/)<[^<]*)*<\/script>/gi;while(_0x45e54b[_0xcb7a('0x17')](_0x112d6e[_0xcb7a('0x16')])){_0x112d6e[_0xcb7a('0x16')]=_0x112d6e[_0xcb7a('0x16')][_0xcb7a('0x18')](_0x45e54b,'');}if(_0x112d6e[_0xcb7a('0x16')]['includes']('{_0x4aabe1[_0xcb7a('0x1b')](_0x371d33['filename']);});var _0x527ae8=/]+>/g;var _0xe20b78=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x282350=_0x112d6e[_0xcb7a('0x16')]['replace'](_0xe20b78,_0xcb7a('0x1c'));var _0x2fef04=_0x282350['replace'](_0x527ae8,_0xcb7a('0x1d'));for(let _0x1f3a3d=0x0;_0x1f3a3d<_0x4aabe1[_0xcb7a('0x13')];_0x1f3a3d++){var _0x36e2dd=_0x2fef04[_0xcb7a('0x18')]('_IMG',_0xcb7a('0x1e')+_0x4aabe1[_0x1f3a3d]+'\x20]');_0x2fef04=_0x36e2dd;}_0x112d6e[_0xcb7a('0x16')]=_0x2fef04;}_0x30c745['body']=_0x112d6e['html'];}else{_0x30c745[_0xcb7a('0x1f')]=_0x112d6e[_0xcb7a('0x20')];}if(_0x30c745[_0xcb7a('0x1f')]){_0x30c745[_0xcb7a('0x1f')]=_0x30c745[_0xcb7a('0x1f')]['replace'](/0x0){var _0x49ccb5=['Auto-Submitted:\x20auto-replied',_0xcb7a('0x34'),'Precedence:\x20auto_reply'];for(var _0x1bc01c=0x0;_0x1bc01c<_0x112d6e[_0xcb7a('0x33')][_0xcb7a('0x13')];_0x1bc01c++){var _0x5c8e1b=_[_0xcb7a('0xe')](_0x49ccb5,_0x112d6e[_0xcb7a('0x33')][_0x1bc01c][_0xcb7a('0x35')]);if(_0x5c8e1b>=0x0){_0x30c745[_0xcb7a('0x36')]=!![];}}}return _0x30c745;}exports['parser']=function(_0x11e73d,_0x318147,_0x2838d1){var _0x2fcbd5={'from':getAddress(_0x318147['from']),'firstName':getFirstName(_0x318147[_0xcb7a('0x37')]),'lastName':getLastName(_0x318147[_0xcb7a('0x37')]),'mapKey':'email','message':{'from':getMails(_0x11e73d[_0xcb7a('0x24')],_0x318147['from']),'to':_0x11e73d[_0xcb7a('0x24')],'cc':'','subject':_0x318147['subject']||'','messageId':_0x318147[_0xcb7a('0x38')],'inReplyTo':_0x318147['inReplyTo'],'sentAt':moment(_0x318147['date'])[_0xcb7a('0x2c')](_0xcb7a('0x39')),'attach':![],'attachments':[]}};if(!_0x318147[_0xcb7a('0x16')]&&!_0x318147['textAsHtml']){var _0x156d32=_[_0xcb7a('0x3a')](_0x318147[_0xcb7a('0x19')],{'contentType':_0xcb7a('0x3b')});if(_0x156d32[_0xcb7a('0x13')]){logger['info'](util[_0xcb7a('0x2c')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x318147[_0xcb7a('0x38')]));tnef[_0xcb7a('0x3c')](_[_0xcb7a('0x3d')](_0x156d32)[_0xcb7a('0x31')],function(_0xb710f3,_0x446cd2){if(_0x446cd2){_0x318147[_0xcb7a('0x16')]=_0x446cd2[_0xcb7a('0x3e')]||_0xcb7a('0x3f');if(_0x446cd2[_0xcb7a('0x40')]){for(var _0x3c1f9a=0x0;_0x3c1f9a<_0x446cd2[_0xcb7a('0x40')][_0xcb7a('0x13')];_0x3c1f9a++){var _0x401524=_0x446cd2[_0xcb7a('0x40')][_0x3c1f9a];_0x2fcbd5[_0xcb7a('0x22')]['attachments'][_0xcb7a('0x1b')]({'filename':_0x401524[_0xcb7a('0x41')],'content':Buffer[_0xcb7a('0x37')](_0x401524[_0xcb7a('0x42')])});}}}_0x2838d1(parseEmail(_0x11e73d,_0x318147,_0x2fcbd5));});}else{_0x318147[_0xcb7a('0x16')]=_0xcb7a('0x3f');_0x2838d1(parseEmail(_0x11e73d,_0x318147,_0x2fcbd5));}}else{_0x2838d1(parseEmail(_0x11e73d,_0x318147,_0x2fcbd5));}};exports[_0xcb7a('0x43')]=function(_0x5ec3f0){switch(_0x5ec3f0){case _0xcb7a('0x44'):return _0xcb7a('0x45');case _0xcb7a('0x46'):return _0xcb7a('0x47');case _0xcb7a('0x48'):return _0xcb7a('0x49');case _0xcb7a('0x4a'):return _0xcb7a('0x4b');}return _0xcb7a('0x4c');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index b532e67..2e6a94c 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 _0x7af0=['Service','key','SERV','active','Imap','Smtp','exports','name'];(function(_0xc49ee1,_0xa4b91a){var _0x30c1e8=function(_0xdff70e){while(--_0xdff70e){_0xc49ee1['push'](_0xc49ee1['shift']());}};_0x30c1e8(++_0xa4b91a);}(_0x7af0,0x1a7));var _0x07af=function(_0x3b9d5f,_0x2e9039){_0x3b9d5f=_0x3b9d5f-0x0;var _0x39924e=_0x7af0[_0x3b9d5f];return _0x39924e;};'use strict';var _=require('lodash');function MailAccount(_0x129a0d){this['id']=_0x129a0d['id']||0x0;this['name']=_0x129a0d[_0x07af('0x0')]||_0x07af('0x1');this['key']=_0x129a0d[_0x07af('0x2')]||_0x07af('0x3');this[_0x07af('0x4')]=_0x129a0d[_0x07af('0x4')]||![];this[_0x07af('0x5')]=_0x129a0d[_0x07af('0x5')]||[];this[_0x07af('0x6')]=_0x129a0d[_0x07af('0x6')]||[];}module[_0x07af('0x7')]=MailAccount; \ No newline at end of file +var _0x0e0a=['lodash','name','Service','key','active','Imap','Smtp','exports'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x0e0a,0x100));var _0xa0e0=function(_0x3ce8ca,_0x4bf3f5){_0x3ce8ca=_0x3ce8ca-0x0;var _0x2e96b3=_0x0e0a[_0x3ce8ca];return _0x2e96b3;};'use strict';var _=require(_0xa0e0('0x0'));function MailAccount(_0x5cd4c6){this['id']=_0x5cd4c6['id']||0x0;this[_0xa0e0('0x1')]=_0x5cd4c6[_0xa0e0('0x1')]||_0xa0e0('0x2');this[_0xa0e0('0x3')]=_0x5cd4c6[_0xa0e0('0x3')]||'SERV';this[_0xa0e0('0x4')]=_0x5cd4c6[_0xa0e0('0x4')]||![];this[_0xa0e0('0x5')]=_0x5cd4c6[_0xa0e0('0x5')]||[];this[_0xa0e0('0x6')]=_0x5cd4c6[_0xa0e0('0x6')]||[];}module[_0xa0e0('0x7')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 6cac081..fcb11f2 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 _0x7933=['prototype','initMailAccounts','mailAccounts','exports','lodash','../model/mailAccount','mapKeys','hasOwnProperty','mergeFromDatabase'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x7933,0xa6));var _0x3793=function(_0x152eb1,_0x5cb83b){_0x152eb1=_0x152eb1-0x0;var _0x6fccd0=_0x7933[_0x152eb1];return _0x6fccd0;};'use strict';var _=require(_0x3793('0x0'));var MailAccount=require(_0x3793('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x369449,_0x4c2b85,_0x1f9830){var _0x1ae2e8=_[_0x3793('0x2')](_0x369449,function(_0x2be9bd,_0x597bc2){return _0x2be9bd[_0x1f9830];});for(var _0x317a6a in _0x4c2b85){if(_0x4c2b85[_0x3793('0x3')](_0x317a6a)){if(!_0x1ae2e8[_0x317a6a]){delete _0x4c2b85[_0x317a6a];}}}}Realtime['prototype'][_0x3793('0x4')]=function(_0x2cdb6a,_0x3c84d7){for(var _0x5817d4 in _0x3c84d7){if(_0x2cdb6a[_0x3793('0x3')](_0x5817d4)){_0x2cdb6a[_0x5817d4]=_0x3c84d7[_0x5817d4];}}};Realtime[_0x3793('0x5')][_0x3793('0x6')]=function(){var _0x1932a1=this;return function(_0x3d174a){if(_0x3d174a){freeIsNotKey(_0x3d174a,_0x1932a1[_0x3793('0x7')],'id');for(var _0x3a6f18=0x0,_0x1ad58b={},_0x4d72c9={};_0x3a6f18<_0x3d174a['length'];_0x3a6f18+=0x1){_0x1ad58b=_0x3d174a[_0x3a6f18];if(_['isUndefined'](_0x1932a1[_0x3793('0x7')][_0x1ad58b['id']])){_0x1932a1[_0x3793('0x7')][_0x1ad58b['id']]=new MailAccount(_0x1ad58b);}else{_['merge'](_0x1932a1[_0x3793('0x7')][_0x1ad58b['id']],_0x1ad58b);}}}return _0x1932a1[_0x3793('0x7')];};};module[_0x3793('0x8')]=Realtime; \ No newline at end of file +var _0x0a39=['length','exports','lodash','mailAccounts','mapKeys','hasOwnProperty','prototype'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0a39,0x79));var _0x90a3=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x0a39[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x90a3('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0x90a3('0x1')]={};};function freeIsNotKey(_0x5cc98d,_0x2c0796,_0x359bba){var _0x398557=_[_0x90a3('0x2')](_0x5cc98d,function(_0x425ce5,_0x22f6b2){return _0x425ce5[_0x359bba];});for(var _0x54070f in _0x2c0796){if(_0x2c0796['hasOwnProperty'](_0x54070f)){if(!_0x398557[_0x54070f]){delete _0x2c0796[_0x54070f];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x1926cf,_0x5b1224){for(var _0x4caecd in _0x5b1224){if(_0x1926cf[_0x90a3('0x3')](_0x4caecd)){_0x1926cf[_0x4caecd]=_0x5b1224[_0x4caecd];}}};Realtime[_0x90a3('0x4')]['initMailAccounts']=function(){var _0x25c834=this;return function(_0x302dae){if(_0x302dae){freeIsNotKey(_0x302dae,_0x25c834[_0x90a3('0x1')],'id');for(var _0x1abce9=0x0,_0xa20435={},_0x336e58={};_0x1abce9<_0x302dae[_0x90a3('0x5')];_0x1abce9+=0x1){_0xa20435=_0x302dae[_0x1abce9];if(_['isUndefined'](_0x25c834[_0x90a3('0x1')][_0xa20435['id']])){_0x25c834[_0x90a3('0x1')][_0xa20435['id']]=new MailAccount(_0xa20435);}else{_['merge'](_0x25c834['mailAccounts'][_0xa20435['id']],_0xa20435);}}}return _0x25c834['mailAccounts'];};};module[_0x90a3('0x6')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index c576d83..8148837 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 _0xca93=['Imap','MailServerOut','Smtp','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','name','service','email','active','key','ListId','TemplateId'];(function(_0x4569fd,_0x4f2e82){var _0x10fca7=function(_0x3a969d){while(--_0x3a969d){_0x4569fd['push'](_0x4569fd['shift']());}};_0x10fca7(++_0x4f2e82);}(_0xca93,0x123));var _0x3ca9=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xca93[_0x5c3c0b];return _0x52ecd2;};'use strict';var client=require(_0x3ca9('0x0'));exports[_0x3ca9('0x1')]=function(){return function(){return client['Request']('GetMailAccount',{'options':{'attributes':['id',_0x3ca9('0x2'),_0x3ca9('0x3'),_0x3ca9('0x4'),_0x3ca9('0x5'),_0x3ca9('0x6'),_0x3ca9('0x7'),_0x3ca9('0x8')],'raw':![],'include':[{'model':'MailServerIn','as':_0x3ca9('0x9')},{'model':_0x3ca9('0xa'),'as':_0x3ca9('0xb')}]},'log':_0x3ca9('0xc')});};};exports[_0x3ca9('0xd')]=function(_0x4cb4c3,_0x33f1fc){return client['Request'](_0x3ca9('0xe'),{'account':{'id':_0x4cb4c3},'body':_0x33f1fc,'log':_0x3ca9('0xe')});}; \ No newline at end of file +var _0x58e6=['TemplateId','MailServerIn','Imap','MailServerOut','notify','NotifyMailAccount','../client','getMailAccounts','service','active','key','ListId'];(function(_0x9f34dd,_0x2ccde2){var _0x47ed47=function(_0x3296f9){while(--_0x3296f9){_0x9f34dd['push'](_0x9f34dd['shift']());}};_0x47ed47(++_0x2ccde2);}(_0x58e6,0x1c2));var _0x658e=function(_0x1266ee,_0x2715cb){_0x1266ee=_0x1266ee-0x0;var _0x457d92=_0x58e6[_0x1266ee];return _0x457d92;};'use strict';var client=require(_0x658e('0x0'));exports[_0x658e('0x1')]=function(){return function(){return client['Request']('GetMailAccount',{'options':{'attributes':['id','name',_0x658e('0x2'),'email',_0x658e('0x3'),_0x658e('0x4'),_0x658e('0x5'),_0x658e('0x6')],'raw':![],'include':[{'model':_0x658e('0x7'),'as':_0x658e('0x8')},{'model':_0x658e('0x9'),'as':'Smtp'}]},'log':'getMailAccount'});};};exports[_0x658e('0xa')]=function(_0xa73acf,_0x1e2c26){return client['Request'](_0x658e('0xb'),{'account':{'id':_0xa73acf},'body':_0x1e2c26,'log':_0x658e('0xb')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 5612dd8..bdbfb04 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 _0x0e2d=['Request','ShowSetting','loginMailFrequency','GetSettings','../client','getSettings'];(function(_0x17bb31,_0x2fc6f8){var _0x505c71=function(_0x5013cf){while(--_0x5013cf){_0x17bb31['push'](_0x17bb31['shift']());}};_0x505c71(++_0x2fc6f8);}(_0x0e2d,0x154));var _0xd0e2=function(_0x5a09d2,_0x251bc2){_0x5a09d2=_0x5a09d2-0x0;var _0x397503=_0x0e2d[_0x5a09d2];return _0x397503;};'use strict';var client=require(_0xd0e2('0x0'));exports[_0xd0e2('0x1')]=function(){return client[_0xd0e2('0x2')](_0xd0e2('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xd0e2('0x4')]},'log':_0xd0e2('0x5')});}; \ No newline at end of file +var _0x730e=['getSettings','Request','ShowSetting','loginMailFrequency','GetSettings','../client'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x730e,0xd7));var _0xe730=function(_0x11452e,_0x109555){_0x11452e=_0x11452e-0x0;var _0x3e8260=_0x730e[_0x11452e];return _0x3e8260;};'use strict';var client=require(_0xe730('0x0'));exports[_0xe730('0x1')]=function(){return client[_0xe730('0x2')](_0xe730('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xe730('0x4')]},'log':_0xe730('0x5')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 4191b08..c36524a 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(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file diff --git a/server/services/express/index.js b/server/services/express/index.js index 70d2aef..fb64fae 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 _0x2b52=['listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','sticky-session','ioredis','createServer','timeout','listen','port','socket.io','websocket','polling','redis','defaults','localhost','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','once'];(function(_0xca0e,_0x453a74){var _0xc71e53=function(_0x609ccf){while(--_0x609ccf){_0xca0e['push'](_0xca0e['shift']());}};_0xc71e53(++_0x453a74);}(_0x2b52,0x117));var _0x22b5=function(_0x1fcaf1,_0x21c3c2){_0x1fcaf1=_0x1fcaf1-0x0;var _0x55f464=_0x2b52[_0x1fcaf1];return _0x55f464;};'use strict';var _=require(_0x22b5('0x0'));var http=require(_0x22b5('0x1'));var express=require(_0x22b5('0x2'));var sticky=require(_0x22b5('0x3'));var Redis=require(_0x22b5('0x4'));var config=require('../../config/environment');var app=express();var server=http[_0x22b5('0x5')](app);server[_0x22b5('0x6')]=0xdbba0;if(sticky[_0x22b5('0x7')](server,config[_0x22b5('0x8')])){var socketio=require(_0x22b5('0x9'))(server,{'transports':[_0x22b5('0xa'),_0x22b5('0xb')]});config[_0x22b5('0xc')]=_[_0x22b5('0xd')](config[_0x22b5('0xc')],{'host':_0x22b5('0xe'),'port':0x18eb});socketio['adapter'](require(_0x22b5('0xf'))({'pubClient':new Redis(config[_0x22b5('0xc')]),'subClient':new Redis(config[_0x22b5('0xc')])}));require(_0x22b5('0x10'))[_0x22b5('0x11')]();require(_0x22b5('0x12'))[_0x22b5('0x11')](socketio);require(_0x22b5('0x13'))['default'](app);require('../../routes')[_0x22b5('0x11')](app);}else{server[_0x22b5('0x14')](_0x22b5('0x15'),function(){console[_0x22b5('0x16')](_0x22b5('0x17'),config[_0x22b5('0x8')]);});}exports=module[_0x22b5('0x18')]=app; \ No newline at end of file +var _0xa429=['../../config/socketio','default','../../routes','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','http','sticky-session','../../config/environment','timeout','listen','port','socket.io','websocket','polling','redis','defaults','adapter','socket.io-redis','../../config/triggers'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa429,0xaf));var _0x9a42=function(_0x2ffa30,_0x4c41eb){_0x2ffa30=_0x2ffa30-0x0;var _0x142513=_0xa429[_0x2ffa30];return _0x142513;};'use strict';var _=require('lodash');var http=require(_0x9a42('0x0'));var express=require('express');var sticky=require(_0x9a42('0x1'));var Redis=require('ioredis');var config=require(_0x9a42('0x2'));var app=express();var server=http['createServer'](app);server[_0x9a42('0x3')]=0xdbba0;if(sticky[_0x9a42('0x4')](server,config[_0x9a42('0x5')])){var socketio=require(_0x9a42('0x6'))(server,{'transports':[_0x9a42('0x7'),_0x9a42('0x8')]});config[_0x9a42('0x9')]=_[_0x9a42('0xa')](config[_0x9a42('0x9')],{'host':'localhost','port':0x18eb});socketio[_0x9a42('0xb')](require(_0x9a42('0xc'))({'pubClient':new Redis(config[_0x9a42('0x9')]),'subClient':new Redis(config[_0x9a42('0x9')])}));require(_0x9a42('0xd'))['default']();require(_0x9a42('0xe'))[_0x9a42('0xf')](socketio);require('../../config/express')[_0x9a42('0xf')](app);require(_0x9a42('0x10'))[_0x9a42('0xf')](app);}else{server['once'](_0x9a42('0x11'),function(){console[_0x9a42('0x12')](_0x9a42('0x13'),config[_0x9a42('0x5')]);});}exports=module[_0x9a42('0x14')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 53a60ea..b3b5ba8 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 _0xef55=['../../config/logger','client','Request','request','debug','routing','error','message','catch','rpc','exports','jayson/promise'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0xef55,0x173));var _0x5ef5=function(_0x35383c,_0x5e83e3){_0x35383c=_0x35383c-0x0;var _0x5c6366=_0xef55[_0x35383c];return _0x5c6366;};'use strict';var jayson=require(_0x5ef5('0x0'));var BPromise=require('bluebird');var logger=require(_0x5ef5('0x1'))('routing');var client=jayson[_0x5ef5('0x2')]['http']({'port':0x2329});client[_0x5ef5('0x3')]=function(_0x581840,_0x553456){return new BPromise(function(_0x30dd89,_0x137b32){return client[_0x5ef5('0x4')](_0x581840,_0x553456)['then'](function(_0x3b185b){logger[_0x5ef5('0x5')]('rpc',_0x5ef5('0x6'),_0x581840,_0x553456,_0x3b185b);if(_0x3b185b[_0x5ef5('0x7')]){logger[_0x5ef5('0x7')]('rpc','routing',_0x581840,_0x3b185b[_0x5ef5('0x7')]['message'],_0x553456);return _0x137b32(_0x3b185b['error'][_0x5ef5('0x8')]);}else{return _0x30dd89(_0x3b185b['result']);}})[_0x5ef5('0x9')](function(_0x1c1c09){logger[_0x5ef5('0x7')](_0x5ef5('0xa'),_0x5ef5('0x6'),_0x581840,_0x1c1c09,_0x553456);return _0x137b32(_0x1c1c09);});});};module[_0x5ef5('0xb')]=client; \ No newline at end of file +var _0xee7b=['catch','exports','jayson/promise','bluebird','../../config/logger','routing','http','Request','debug','error','rpc','message'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xee7b,0x1d6));var _0xbee7=function(_0x41c04c,_0x1aef4b){_0x41c04c=_0x41c04c-0x0;var _0x47eb30=_0xee7b[_0x41c04c];return _0x47eb30;};'use strict';var jayson=require(_0xbee7('0x0'));var BPromise=require(_0xbee7('0x1'));var logger=require(_0xbee7('0x2'))(_0xbee7('0x3'));var client=jayson['client'][_0xbee7('0x4')]({'port':0x2329});client[_0xbee7('0x5')]=function(_0x391071,_0x38ddfb){return new BPromise(function(_0x4092bb,_0xa3e50b){return client['request'](_0x391071,_0x38ddfb)['then'](function(_0x531c3d){logger[_0xbee7('0x6')]('rpc',_0xbee7('0x3'),_0x391071,_0x38ddfb,_0x531c3d);if(_0x531c3d[_0xbee7('0x7')]){logger[_0xbee7('0x7')](_0xbee7('0x8'),'routing',_0x391071,_0x531c3d[_0xbee7('0x7')][_0xbee7('0x9')],_0x38ddfb);return _0xa3e50b(_0x531c3d[_0xbee7('0x7')][_0xbee7('0x9')]);}else{return _0x4092bb(_0x531c3d['result']);}})[_0xbee7('0xa')](function(_0x6cc75d){logger['error'](_0xbee7('0x8'),_0xbee7('0x3'),_0x391071,_0x6cc75d,_0x38ddfb);return _0xa3e50b(_0x6cc75d);});});};module[_0xbee7('0xb')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index dc3aac2..4e94403 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 _0x7a15=['./rpc/whatsappQueue','resolve','getAgents','then','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','listen','catch','log','bluebird','./server','./realtime','./rpc/user','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/faxQueue'];(function(_0x1bbe37,_0x241834){var _0x46394c=function(_0x5a76fb){while(--_0x5a76fb){_0x1bbe37['push'](_0x1bbe37['shift']());}};_0x46394c(++_0x241834);}(_0x7a15,0x107));var _0x57a1=function(_0x3f1129,_0x1f0b7d){_0x3f1129=_0x3f1129-0x0;var _0x2ea49f=_0x7a15[_0x3f1129];return _0x2ea49f;};'use strict';var BPromise=require(_0x57a1('0x0'));var server=require(_0x57a1('0x1'));var Realtime=require(_0x57a1('0x2'));var user=require(_0x57a1('0x3'));var interval=require('./rpc/interval');var openchannelQueue=require(_0x57a1('0x4'));var chatQueue=require(_0x57a1('0x5'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0x57a1('0x6'));var whatsappQueue=require(_0x57a1('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x57a1('0x8')]()['then'](user[_0x57a1('0x9')]())[_0x57a1('0xa')](realtime[_0x57a1('0xb')]())[_0x57a1('0xa')](interval[_0x57a1('0xc')]())['then'](realtime[_0x57a1('0xd')]())[_0x57a1('0xa')](openchannelQueue[_0x57a1('0xe')]())['then'](realtime[_0x57a1('0xf')]())['then'](chatQueue[_0x57a1('0x10')]())[_0x57a1('0xa')](realtime['initChatQueues']())[_0x57a1('0xa')](smsQueue[_0x57a1('0x11')]())[_0x57a1('0xa')](realtime[_0x57a1('0x12')]())[_0x57a1('0xa')](mailQueue[_0x57a1('0x13')]())[_0x57a1('0xa')](realtime[_0x57a1('0x14')]())[_0x57a1('0xa')](faxQueue[_0x57a1('0x15')]())[_0x57a1('0xa')](realtime[_0x57a1('0x16')]())[_0x57a1('0xa')](whatsappQueue[_0x57a1('0x17')]())[_0x57a1('0xa')](realtime['initWhatsappQueues']())['then'](function(){return realtime;});}function main(){return server[_0x57a1('0x18')](realtime)[_0x57a1('0xa')](function(_0x3468a0){return initRealtime();})[_0x57a1('0xa')](function(_0x37ca33){return setInterval(initRealtime,0x1388);})[_0x57a1('0x19')](function(_0xc67af1){console[_0x57a1('0x1a')](_0xc67af1);});}main(); \ No newline at end of file +var _0x62c4=['./rpc/user','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','initChatQueues','getSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','initWhatsappQueues','catch','log','bluebird','./server','./realtime'];(function(_0xf20e30,_0x188279){var _0x296340=function(_0x206602){while(--_0x206602){_0xf20e30['push'](_0xf20e30['shift']());}};_0x296340(++_0x188279);}(_0x62c4,0x93));var _0x462c=function(_0x37ac01,_0x506745){_0x37ac01=_0x37ac01-0x0;var _0x217b4e=_0x62c4[_0x37ac01];return _0x217b4e;};'use strict';var BPromise=require(_0x462c('0x0'));var server=require(_0x462c('0x1'));var Realtime=require(_0x462c('0x2'));var user=require(_0x462c('0x3'));var interval=require('./rpc/interval');var openchannelQueue=require(_0x462c('0x4'));var chatQueue=require(_0x462c('0x5'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0x462c('0x6'));var whatsappQueue=require(_0x462c('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x462c('0x8')]()[_0x462c('0x9')](user[_0x462c('0xa')]())[_0x462c('0x9')](realtime[_0x462c('0xb')]())[_0x462c('0x9')](interval[_0x462c('0xc')]())[_0x462c('0x9')](realtime[_0x462c('0xd')]())[_0x462c('0x9')](openchannelQueue[_0x462c('0xe')]())[_0x462c('0x9')](realtime[_0x462c('0xf')]())[_0x462c('0x9')](chatQueue['getChatQueues']())['then'](realtime[_0x462c('0x10')]())['then'](smsQueue[_0x462c('0x11')]())[_0x462c('0x9')](realtime['initSmsQueues']())[_0x462c('0x9')](mailQueue[_0x462c('0x12')]())[_0x462c('0x9')](realtime[_0x462c('0x13')]())['then'](faxQueue[_0x462c('0x14')]())[_0x462c('0x9')](realtime[_0x462c('0x15')]())[_0x462c('0x9')](whatsappQueue['getWhatsappQueues']())['then'](realtime[_0x462c('0x16')]())[_0x462c('0x9')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0x462c('0x9')](function(_0x30c04d){return initRealtime();})['then'](function(_0x2f98b2){return setInterval(initRealtime,0x1388);})[_0x462c('0x17')](function(_0x4cf413){console[_0x462c('0x18')](_0x4cf413);});}main(); \ No newline at end of file diff --git a/server/services/routing/lib/rule-engine.js b/server/services/routing/lib/rule-engine.js index 75cca7d..772fd30 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(_0x397646,_0x5e7068){var _0x71a098=function(_0x134342){while(--_0x134342){_0x397646['push'](_0x397646['shift']());}};_0x71a098(++_0x5e7068);}(_0xe14b,0x93));var _0xbe14=function(_0x1b239c,_0x4d45c0){_0x1b239c=_0x1b239c-0x0;var _0x102128=_0xe14b[_0x1b239c];return _0x102128;};'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 _0x5fc3=['lodash','util','EventEmitter','init','isNil','ignoreFactChanges','inherits','activeRules','prototype','register','isArray','rules','isObject','sync','orderBy','asc','execute','clone','ruleRef','name','index_','push','call','nextTick','next','isEqual','restart','length','condition','matchPath','noop','findRules','filter','prioritize','priority','toJSON','map','consequence','toString','fromJSON','isString','parse'];(function(_0x3cc651,_0x55e349){var _0x2b0f17=function(_0x5731e6){while(--_0x5731e6){_0x3cc651['push'](_0x3cc651['shift']());}};_0x2b0f17(++_0x55e349);}(_0x5fc3,0xa8));var _0x35fc=function(_0x1a8f86,_0x5ed9c4){_0x1a8f86=_0x1a8f86-0x0;var _0x20d876=_0x5fc3[_0x1a8f86];return _0x20d876;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var EventEmitter=require('events')[_0x35fc('0x2')];function RuleEngine(_0x2ac6da,_0x196bc2){this[_0x35fc('0x3')]();if(!_[_0x35fc('0x4')](_0x2ac6da)){this['register'](_0x2ac6da);}if(_0x196bc2){this[_0x35fc('0x5')]=_0x196bc2[_0x35fc('0x5')];}return this;}util[_0x35fc('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x19a0d1){this['rules']=[];this[_0x35fc('0x7')]=[];};RuleEngine[_0x35fc('0x8')][_0x35fc('0x9')]=function(_0x1e5f90){if(Array[_0x35fc('0xa')](_0x1e5f90)){this[_0x35fc('0xb')]=this[_0x35fc('0xb')]['concat'](_0x1e5f90);}else if(_0x1e5f90!==null&&_[_0x35fc('0xc')](_0x1e5f90)){this[_0x35fc('0xb')]['push'](_0x1e5f90);}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')]['sync']=function(){this[_0x35fc('0x7')]=this[_0x35fc('0xb')]['filter'](function(_0x4cbe74){if(_[_0x35fc('0x4')](_0x4cbe74['on'])){_0x4cbe74['on']=!![];}if(_0x4cbe74['on']===!![]){return _0x4cbe74;}});this['activeRules']=_[_0x35fc('0xe')](this[_0x35fc('0x7')],['p'],[_0x35fc('0xf')]);};RuleEngine[_0x35fc('0x8')][_0x35fc('0x10')]=function(_0x5cfe94,_0x59507a){var _0x5eac0f=![];_0x5cfe94['result']=!![];var _0x398b67=_[_0x35fc('0x11')](_0x5cfe94);var _0x53b898=_[_0x35fc('0x11')](_0x5cfe94);var _0x227a49=this[_0x35fc('0x7')];var _0x480851=[];var _0x26ba54=this[_0x35fc('0x5')];(function FnRuleLoop(_0x553677){var _0x41e165={'rules':function(){return _0x227a49;},'rule':function(){return _0x227a49[_0x553677];},'when':function(_0x363e47){if(_0x363e47){var _0x2e513b=_0x227a49[_0x553677]['consequence'];_0x2e513b[_0x35fc('0x12')]=_0x227a49[_0x553677]['id']||_0x227a49[_0x553677][_0x35fc('0x13')]||_0x35fc('0x14')+_0x553677;process['nextTick'](function(){_0x480851[_0x35fc('0x15')](_0x2e513b[_0x35fc('0x12')]);_0x2e513b[_0x35fc('0x16')](_0x398b67,_0x41e165);});}else{process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x5eac0f=!![];return FnRuleLoop(0x0);},'next':function(_0x21f1a9){if(!_0x26ba54&&!_[_0x35fc('0x19')](_0x53b898,_0x398b67)){_0x53b898=_[_0x35fc('0x11')](_0x398b67);process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x1a')]();});}else{process['nextTick'](function(){if(_[_0x35fc('0x4')](_0x21f1a9)){return FnRuleLoop(_0x553677+0x1);}else{return FnRuleLoop(_0x21f1a9);}});}}};if(_0x553677<_0x227a49[_0x35fc('0x1b')]&&_0x5eac0f===![]){var _0x257719=_0x227a49[_0x553677][_0x35fc('0x1c')];_0x257719[_0x35fc('0x16')](_0x398b67,_0x41e165);}else{process['nextTick'](function(){_0x398b67[_0x35fc('0x1d')]=_0x480851;return _0x59507a?_0x59507a(_0x398b67):_[_0x35fc('0x1e')]();});}}(0x0));};RuleEngine['prototype'][_0x35fc('0x1f')]=function(_0x5a93df){if(_[_0x35fc('0x4')](_0x5a93df)){return this['rules'];}else{var _0x4086e9=_['matches'](_0x5a93df);return _[_0x35fc('0x20')](this[_0x35fc('0xb')],_0x4086e9);}};RuleEngine['prototype']['turn']=function(_0x47774c,_0x58edb6){var _0x274208=_0x47774c==='on'||_0x47774c==='ON'?!![]:![];var _0x1a5d92=this['findRules'](_0x58edb6);for(var _0x26b7cb=0x0,_0x645eac=_0x1a5d92[_0x35fc('0x1b')];_0x26b7cb<_0x645eac;_0x26b7cb+=0x1){_0x1a5d92[_0x26b7cb]['on']=_0x274208;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x21')]=function(_0x11ccdb,_0x451f0c){_0x11ccdb=parseInt(_0x11ccdb,0xa);var _0x54aedc=this[_0x35fc('0x1f')](_0x451f0c);for(var _0x220931=0x0,_0x22af18=_0x54aedc['length'];_0x220931<_0x22af18;_0x220931+=0x1){_0x54aedc[_0x220931][_0x35fc('0x22')]=_0x11ccdb;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x23')]=function(){var _0xd8a4ca=this[_0x35fc('0xb')];if(_0xd8a4ca instanceof Array){_0xd8a4ca=_0xd8a4ca[_0x35fc('0x24')](function(_0x37b435){_0x37b435[_0x35fc('0x1c')]=_0x37b435[_0x35fc('0x1c')]['toString']();_0x37b435['consequence']=_0x37b435[_0x35fc('0x25')]['toString']();return _0x37b435;});}else if(!_[_0x35fc('0x4')](_0xd8a4ca)){_0xd8a4ca[_0x35fc('0x1c')]=_0xd8a4ca[_0x35fc('0x1c')][_0x35fc('0x26')]();_0xd8a4ca[_0x35fc('0x25')]=_0xd8a4ca[_0x35fc('0x25')]['toString']();}return _0xd8a4ca;};RuleEngine[_0x35fc('0x8')][_0x35fc('0x27')]=function(_0x46b9ef){this[_0x35fc('0x3')]();if(_[_0x35fc('0x28')](_0x46b9ef)){_0x46b9ef=JSON[_0x35fc('0x29')](_0x46b9ef);}if(_0x46b9ef instanceof Array){_0x46b9ef=_0x46b9ef['map'](function(_0x2483be){_0x2483be[_0x35fc('0x1c')]=eval('('+_0x2483be[_0x35fc('0x1c')]+')');_0x2483be['consequence']=eval('('+_0x2483be[_0x35fc('0x25')]+')');return _0x2483be;});}else if(_0x46b9ef!==null&&typeof _0x46b9ef=='object'){_0x46b9ef[_0x35fc('0x1c')]=eval('('+_0x46b9ef[_0x35fc('0x1c')]+')');_0x46b9ef[_0x35fc('0x25')]=eval('('+_0x46b9ef[_0x35fc('0x25')]+')');}this['register'](_0x46b9ef);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 35eaad2..dd88a5b 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 _0xf077=['request','error','message','result','catch','SendMail','bluebird','client','http'];(function(_0x1fbdad,_0xf9c730){var _0x42fd40=function(_0xaa1913){while(--_0xaa1913){_0x1fbdad['push'](_0x1fbdad['shift']());}};_0x42fd40(++_0xf9c730);}(_0xf077,0xf9));var _0x7f07=function(_0x4dfdad,_0x2ae75d){_0x4dfdad=_0x4dfdad-0x0;var _0x52f4b2=_0xf077[_0x4dfdad];return _0x52f4b2;};'use strict';var BPromise=require(_0x7f07('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x7f07('0x1')][_0x7f07('0x2')]({'port':0x232b});function request(_0x351d42,_0x3e80af){return new BPromise(function(_0x1f3385,_0x4d1be1){return client[_0x7f07('0x3')](_0x351d42,_0x3e80af)['then'](function(_0x4e7d82){if(_0x4e7d82[_0x7f07('0x4')]){return _0x4d1be1(_0x4e7d82[_0x7f07('0x4')][_0x7f07('0x5')]);}else{return _0x1f3385(_0x4e7d82[_0x7f07('0x6')]);}})[_0x7f07('0x7')](function(_0x19a72e){return _0x4d1be1(_0x19a72e);});});}exports['sendMailMessage']=function(_0x4b36ac,_0x30ef08){return request(_0x7f07('0x8'),{'account':_0x4b36ac,'message':_0x30ef08});}; \ No newline at end of file +var _0xc187=['request','then','catch','sendMailMessage','SendMail','jayson/promise','client','http'];(function(_0x9d1e6b,_0x3bdc22){var _0x2b3070=function(_0x4c4ced){while(--_0x4c4ced){_0x9d1e6b['push'](_0x9d1e6b['shift']());}};_0x2b3070(++_0x3bdc22);}(_0xc187,0x155));var _0x7c18=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xc187[_0x2f3848];return _0x102668;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x7c18('0x0'));var client=jayson[_0x7c18('0x1')][_0x7c18('0x2')]({'port':0x232b});function request(_0x7a0f29,_0x1f2ae8){return new BPromise(function(_0x121817,_0xc65b99){return client[_0x7c18('0x3')](_0x7a0f29,_0x1f2ae8)[_0x7c18('0x4')](function(_0x4d6628){if(_0x4d6628['error']){return _0xc65b99(_0x4d6628['error']['message']);}else{return _0x121817(_0x4d6628['result']);}})[_0x7c18('0x5')](function(_0x2c5fda){return _0xc65b99(_0x2c5fda);});});}exports[_0x7c18('0x6')]=function(_0xb05dc1,_0x54fa92){return request(_0x7c18('0x7'),{'account':_0xb05dc1,'message':_0x54fa92});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 34e784b..1066ffe 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 _0x0131=['length','Status','StatusTime','toNumber','smsStatusTime','stringify','exports','lodash','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','name','online','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatCapacity','chatCurrentCapacity','mailStatus','unknown','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busyQueue','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','chat','openchannel','fax','sms','whatsapp'];(function(_0xe02688,_0x582051){var _0x4f77c4=function(_0x3ce3be){while(--_0x3ce3be){_0xe02688['push'](_0xe02688['shift']());}};_0x4f77c4(++_0x582051);}(_0x0131,0x1a4));var _0x1013=function(_0x328bd3,_0x9cf5a5){_0x328bd3=_0x328bd3-0x0;var _0x458149=_0x0131[_0x328bd3];return _0x458149;};'use strict';var _=require(_0x1013('0x0'));var moment=require(_0x1013('0x1'));var md5=require(_0x1013('0x2'));var Redis=require(_0x1013('0x3'));var config=require(_0x1013('0x4'));config[_0x1013('0x5')]=_[_0x1013('0x6')](config[_0x1013('0x5')],{'host':_0x1013('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function Agent(_0x544d36){this['id']=_0x544d36['id']||0x0;this['name']=_0x544d36[_0x1013('0x8')]||'';this[_0x1013('0x9')]=_0x544d36[_0x1013('0x9')]||!![];this['voicePause']=_0x544d36['voicePause']||![];this[_0x1013('0xa')]=_0x544d36[_0x1013('0xa')]||![];this[_0x1013('0xb')]=_0x544d36[_0x1013('0xb')]||![];this['faxPause']=_0x544d36[_0x1013('0xc')]||![];this[_0x1013('0xd')]=_0x544d36[_0x1013('0xd')]||![];this[_0x1013('0xe')]=_0x544d36['openchannelPause']||![];this[_0x1013('0xf')]='unknown';this['chatStatusTime']=0x0;this[_0x1013('0x10')]=_0x544d36[_0x1013('0x10')]||0x0;this[_0x1013('0x11')]=0x0;this[_0x1013('0x12')]=_0x1013('0x13');this[_0x1013('0x14')]=0x0;this['mailCapacity']=_0x544d36[_0x1013('0x15')]||0x0;this[_0x1013('0x16')]=0x0;this[_0x1013('0x17')]=_0x1013('0x13');this[_0x1013('0x18')]=0x0;this[_0x1013('0x19')]=_0x544d36['faxCapacity']||0x0;this[_0x1013('0x1a')]=0x0;this[_0x1013('0x1b')]=_0x1013('0x13');this['smsStatusTime']=0x0;this[_0x1013('0x1c')]=_0x544d36['smsCapacity']||0x0;this['smsCurrentCapacity']=0x0;this[_0x1013('0x1d')]=_0x1013('0x13');this[_0x1013('0x1e')]=0x0;this['whatsappCapacity']=_0x544d36[_0x1013('0x1f')]||0x0;this[_0x1013('0x20')]=0x0;this[_0x1013('0x21')]=_0x1013('0x13');this[_0x1013('0x22')]=0x0;this[_0x1013('0x23')]=_0x544d36[_0x1013('0x23')]||0x0;this[_0x1013('0x24')]=0x0;this['busy']=![];this[_0x1013('0x25')]=undefined;this['md5']='';this[_0x1013('0x26')]();}Agent[_0x1013('0x27')][_0x1013('0x28')]=function(_0x1151fe){if(this[_0x1151fe+_0x1013('0x29')]>0x0){if(this[_0x1151fe+_0x1013('0x2a')]>0x0&&this[_0x1151fe+'CurrentCapacity']>=this[_0x1151fe+_0x1013('0x2a')]){return _0x1013('0x2b');}else{return _0x1013('0x2c');}}else{return _0x1013('0x2d');}};Agent[_0x1013('0x27')][_0x1013('0x26')]=function(){var _0x26f24d=[_0x1013('0x2e'),_0x1013('0x2f'),_0x1013('0x30'),_0x1013('0x31'),_0x1013('0x32'),_0x1013('0x33')];for(var _0xc2fc29=0x0;_0xc2fc29<_0x26f24d[_0x1013('0x34')];_0xc2fc29+=0x1){var _0x41d1fb=this['getChannelStatus'](_0x26f24d[_0xc2fc29]);if(this[_0x26f24d[_0xc2fc29]+_0x1013('0x35')]!==_0x41d1fb){this[_0x26f24d[_0xc2fc29]+_0x1013('0x36')]=_[_0x1013('0x37')](moment()['format']('x'));}this[_0x26f24d[_0xc2fc29]+_0x1013('0x35')]=_0x41d1fb;}var _0x1e2ee7={'id':this['id'],'name':this[_0x1013('0x8')],'online':this['online'],'voicePause':this['voicePause'],'chatPause':this['chatPause'],'mailPause':this['mailPause'],'smsPause':this[_0x1013('0xd')],'faxPause':this[_0x1013('0xc')],'openchannelPause':this[_0x1013('0xe')],'chatStatus':this[_0x1013('0xf')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0x1013('0x10')],'chatCurrentCapacity':this[_0x1013('0x11')],'mailStatus':this[_0x1013('0x12')],'mailStatusTime':this[_0x1013('0x14')],'mailCapacity':this[_0x1013('0x15')],'mailCurrentCapacity':this[_0x1013('0x16')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x1013('0x18')],'faxCapacity':this[_0x1013('0x19')],'faxCurrentCapacity':this[_0x1013('0x1a')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x1013('0x38')],'smsCapacity':this[_0x1013('0x1c')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x1013('0x1d')],'whatsappStatusTime':this[_0x1013('0x1e')],'whatsappCapacity':this[_0x1013('0x1f')],'whatsappCurrentCapacity':this[_0x1013('0x20')],'openchannelStatus':this[_0x1013('0x21')],'openchannelStatusTime':this[_0x1013('0x22')],'openchannelCapacity':this[_0x1013('0x23')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this['busy'],'busyQueue':this[_0x1013('0x25')]};var _0x46599e=md5(JSON[_0x1013('0x39')](_0x1e2ee7));if(this[_0x1013('0x2')]!==_0x46599e){this['md5']=_0x46599e;io['emit']('user:save',_0x1e2ee7);}};module[_0x1013('0x3a')]=Agent; \ No newline at end of file +var _0x1e91=['voicePause','chatPause','mailPause','faxPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','prototype','updateRealtime','mail','openchannel','fax','sms','whatsapp','length','Status','toNumber','format','mailCurrentCapacity','faxStatusTime','smsStatus','whatsappStatus','busyQueue','user:save','exports','moment','md5','../../../config/environment','redis','defaults','socket.io-emitter','name','online'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0x1e91,0x1d0));var _0x11e9=function(_0x1fe508,_0x2bad26){_0x1fe508=_0x1fe508-0x0;var _0x58ebdb=_0x1e91[_0x1fe508];return _0x58ebdb;};'use strict';var _=require('lodash');var moment=require(_0x11e9('0x0'));var md5=require(_0x11e9('0x1'));var Redis=require('ioredis');var config=require(_0x11e9('0x2'));config[_0x11e9('0x3')]=_[_0x11e9('0x4')](config[_0x11e9('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x11e9('0x5'))(new Redis(config[_0x11e9('0x3')]));function Agent(_0x122b7c){this['id']=_0x122b7c['id']||0x0;this[_0x11e9('0x6')]=_0x122b7c[_0x11e9('0x6')]||'';this['online']=_0x122b7c[_0x11e9('0x7')]||!![];this[_0x11e9('0x8')]=_0x122b7c[_0x11e9('0x8')]||![];this[_0x11e9('0x9')]=_0x122b7c[_0x11e9('0x9')]||![];this['mailPause']=_0x122b7c[_0x11e9('0xa')]||![];this[_0x11e9('0xb')]=_0x122b7c[_0x11e9('0xb')]||![];this['smsPause']=_0x122b7c['smsPause']||![];this[_0x11e9('0xc')]=_0x122b7c[_0x11e9('0xc')]||![];this[_0x11e9('0xd')]=_0x11e9('0xe');this[_0x11e9('0xf')]=0x0;this[_0x11e9('0x10')]=_0x122b7c[_0x11e9('0x10')]||0x0;this[_0x11e9('0x11')]=0x0;this[_0x11e9('0x12')]=_0x11e9('0xe');this[_0x11e9('0x13')]=0x0;this[_0x11e9('0x14')]=_0x122b7c['mailCapacity']||0x0;this['mailCurrentCapacity']=0x0;this[_0x11e9('0x15')]=_0x11e9('0xe');this['faxStatusTime']=0x0;this[_0x11e9('0x16')]=_0x122b7c[_0x11e9('0x16')]||0x0;this[_0x11e9('0x17')]=0x0;this['smsStatus']=_0x11e9('0xe');this[_0x11e9('0x18')]=0x0;this[_0x11e9('0x19')]=_0x122b7c[_0x11e9('0x19')]||0x0;this[_0x11e9('0x1a')]=0x0;this['whatsappStatus']=_0x11e9('0xe');this[_0x11e9('0x1b')]=0x0;this[_0x11e9('0x1c')]=_0x122b7c[_0x11e9('0x1c')]||0x0;this[_0x11e9('0x1d')]=0x0;this[_0x11e9('0x1e')]=_0x11e9('0xe');this[_0x11e9('0x1f')]=0x0;this[_0x11e9('0x20')]=_0x122b7c[_0x11e9('0x20')]||0x0;this[_0x11e9('0x21')]=0x0;this[_0x11e9('0x22')]=![];this['busyQueue']=undefined;this[_0x11e9('0x1')]='';this['updateRealtime']();}Agent['prototype'][_0x11e9('0x23')]=function(_0x57eebe){if(this[_0x57eebe+_0x11e9('0x24')]>0x0){if(this[_0x57eebe+_0x11e9('0x25')]>0x0&&this[_0x57eebe+'CurrentCapacity']>=this[_0x57eebe+'Capacity']){return _0x11e9('0x26');}else{return _0x11e9('0x27');}}else{return _0x11e9('0x28');}};Agent[_0x11e9('0x29')][_0x11e9('0x2a')]=function(){var _0xccaa9b=[_0x11e9('0x2b'),'chat',_0x11e9('0x2c'),_0x11e9('0x2d'),_0x11e9('0x2e'),_0x11e9('0x2f')];for(var _0x4f0821=0x0;_0x4f0821<_0xccaa9b[_0x11e9('0x30')];_0x4f0821+=0x1){var _0x541d5d=this[_0x11e9('0x23')](_0xccaa9b[_0x4f0821]);if(this[_0xccaa9b[_0x4f0821]+_0x11e9('0x31')]!==_0x541d5d){this[_0xccaa9b[_0x4f0821]+'StatusTime']=_[_0x11e9('0x32')](moment()[_0x11e9('0x33')]('x'));}this[_0xccaa9b[_0x4f0821]+_0x11e9('0x31')]=_0x541d5d;}var _0x44ebd5={'id':this['id'],'name':this['name'],'online':this[_0x11e9('0x7')],'voicePause':this['voicePause'],'chatPause':this[_0x11e9('0x9')],'mailPause':this[_0x11e9('0xa')],'smsPause':this['smsPause'],'faxPause':this['faxPause'],'openchannelPause':this[_0x11e9('0xc')],'chatStatus':this[_0x11e9('0xd')],'chatStatusTime':this[_0x11e9('0xf')],'chatCapacity':this[_0x11e9('0x10')],'chatCurrentCapacity':this[_0x11e9('0x11')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x11e9('0x13')],'mailCapacity':this[_0x11e9('0x14')],'mailCurrentCapacity':this[_0x11e9('0x34')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x11e9('0x35')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x11e9('0x36')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x11e9('0x19')],'smsCurrentCapacity':this[_0x11e9('0x1a')],'whatsappStatus':this[_0x11e9('0x37')],'whatsappStatusTime':this[_0x11e9('0x1b')],'whatsappCapacity':this[_0x11e9('0x1c')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x11e9('0x1e')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x11e9('0x21')],'busy':this[_0x11e9('0x22')],'busyQueue':this[_0x11e9('0x38')]};var _0x104134=md5(JSON['stringify'](_0x44ebd5));if(this['md5']!==_0x104134){this[_0x11e9('0x1')]=_0x104134;io['emit'](_0x11e9('0x39'),_0x44ebd5);}};module[_0x11e9('0x3a')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index d87ddac..bec0208 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 _0xbbbf=['name','timeout','strategy','beepall','Agents','waiting','updateRealtime','prototype','updateRouting','mapAgentsId','_rr','map','loggedIn','online','chatPause','paused','available','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','util','ioredis','redis','defaults','localhost','socket.io-emitter'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbbbf,0x8e));var _0xfbbb=function(_0x4ffc0a,_0x5799e9){_0x4ffc0a=_0x4ffc0a-0x0;var _0x1f5beb=_0xbbbf[_0x4ffc0a];return _0x1f5beb;};'use strict';var _=require(_0xfbbb('0x0'));var md5=require(_0xfbbb('0x1'));var util=require(_0xfbbb('0x2'));var Redis=require(_0xfbbb('0x3'));var config=require('../../../config/environment');config[_0xfbbb('0x4')]=_[_0xfbbb('0x5')](config['redis'],{'host':_0xfbbb('0x6'),'port':0x18eb});var io=require(_0xfbbb('0x7'))(new Redis(config['redis']));function ChatQueue(_0x1de669){this['id']=_0x1de669['id']||0x0;this['name']=_0x1de669[_0xfbbb('0x8')]||'';this[_0xfbbb('0x9')]=_0x1de669['timeout']||0xa;this['strategy']=_0x1de669[_0xfbbb('0xa')]||_0xfbbb('0xb');this[_0xfbbb('0xc')]=_0x1de669['Agents'];this['mapAgentsId']={};this[_0xfbbb('0xd')]=0x0;this[_0xfbbb('0x1')]='';this['updateRouting']();this[_0xfbbb('0xe')]();}ChatQueue[_0xfbbb('0xf')][_0xfbbb('0x10')]=function(){var _0x4cf0c7=this[_0xfbbb('0x11')][_0xfbbb('0x12')];this[_0xfbbb('0x11')]=_[_0xfbbb('0x13')](this['Agents'],'id');this[_0xfbbb('0x11')][_0xfbbb('0x12')]=_0x4cf0c7;};ChatQueue['prototype'][_0xfbbb('0xe')]=function(){this[_0xfbbb('0x14')]=0x0;this['paused']=0x0;for(var _0x734b11=0x0;_0x734b11=0x0?this[_0xfbbb('0x18')]:0x0;var _0x11397c={'id':this['id'],'available':this[_0xfbbb('0x18')],'loggedIn':this[_0xfbbb('0x14')],'name':this[_0xfbbb('0x8')],'paused':this[_0xfbbb('0x17')],'waiting':this[_0xfbbb('0xd')]};var _0x244865=md5(JSON['stringify'](_0x11397c));if(this[_0xfbbb('0x1')]!==_0x244865){this[_0xfbbb('0x1')]=_0x244865;io['to'](util[_0xfbbb('0x19')](_0xfbbb('0x1a'),_0x11397c['name']))[_0xfbbb('0x1b')](_0xfbbb('0x1c'),_0x11397c);}};module[_0xfbbb('0x1d')]=ChatQueue; \ No newline at end of file +var _0xc051=['paused','online','chatPause','available','stringify','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','loggedIn'];(function(_0x37cd16,_0x490cec){var _0x46804e=function(_0x585261){while(--_0x585261){_0x37cd16['push'](_0x37cd16['shift']());}};_0x46804e(++_0x490cec);}(_0xc051,0x191));var _0x1c05=function(_0x4a7d06,_0x4cbb90){_0x4a7d06=_0x4a7d06-0x0;var _0x283136=_0xc051[_0x4a7d06];return _0x283136;};'use strict';var _=require(_0x1c05('0x0'));var md5=require(_0x1c05('0x1'));var util=require('util');var Redis=require(_0x1c05('0x2'));var config=require(_0x1c05('0x3'));config[_0x1c05('0x4')]=_[_0x1c05('0x5')](config[_0x1c05('0x4')],{'host':_0x1c05('0x6'),'port':0x18eb});var io=require(_0x1c05('0x7'))(new Redis(config[_0x1c05('0x4')]));function ChatQueue(_0x519833){this['id']=_0x519833['id']||0x0;this[_0x1c05('0x8')]=_0x519833[_0x1c05('0x8')]||'';this['timeout']=_0x519833[_0x1c05('0x9')]||0xa;this[_0x1c05('0xa')]=_0x519833[_0x1c05('0xa')]||_0x1c05('0xb');this[_0x1c05('0xc')]=_0x519833[_0x1c05('0xc')];this[_0x1c05('0xd')]={};this[_0x1c05('0xe')]=0x0;this[_0x1c05('0x1')]='';this[_0x1c05('0xf')]();this['updateRealtime']();}ChatQueue[_0x1c05('0x10')][_0x1c05('0xf')]=function(){var _0x5f1963=this['mapAgentsId']['_rr'];this[_0x1c05('0xd')]=_['map'](this[_0x1c05('0xc')],'id');this[_0x1c05('0xd')][_0x1c05('0x11')]=_0x5f1963;};ChatQueue['prototype']['updateRealtime']=function(){this[_0x1c05('0x12')]=0x0;this[_0x1c05('0x13')]=0x0;for(var _0x2badbe=0x0;_0x2badbe=0x0?this[_0x1c05('0x16')]:0x0;var _0x11c6d7={'id':this['id'],'available':this['available'],'loggedIn':this[_0x1c05('0x12')],'name':this[_0x1c05('0x8')],'paused':this['paused'],'waiting':this['waiting']};var _0x27dd67=md5(JSON[_0x1c05('0x17')](_0x11c6d7));if(this[_0x1c05('0x1')]!==_0x27dd67){this[_0x1c05('0x1')]=_0x27dd67;io['to'](util['format'](_0x1c05('0x18'),_0x11c6d7['name']))[_0x1c05('0x19')](_0x1c05('0x1a'),_0x11c6d7);}};module[_0x1c05('0x1b')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 55108ff..e6424cf 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 _0x8310=['Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','paused','online','available','stringify','format','fax:queue:%s','emit','exports','lodash','md5','util','../../../config/environment','redis','localhost','name','timeout','strategy','beepall'];(function(_0x14fa4a,_0xe61f95){var _0x1b37c5=function(_0x3a136e){while(--_0x3a136e){_0x14fa4a['push'](_0x14fa4a['shift']());}};_0x1b37c5(++_0xe61f95);}(_0x8310,0x98));var _0x0831=function(_0x56740a,_0x568894){_0x56740a=_0x56740a-0x0;var _0x257144=_0x8310[_0x56740a];return _0x257144;};'use strict';var _=require(_0x0831('0x0'));var md5=require(_0x0831('0x1'));var util=require(_0x0831('0x2'));var Redis=require('ioredis');var config=require(_0x0831('0x3'));config[_0x0831('0x4')]=_['defaults'](config[_0x0831('0x4')],{'host':_0x0831('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0831('0x4')]));function FaxQueue(_0xead306){this['id']=_0xead306['id']||0x0;this[_0x0831('0x6')]=_0xead306[_0x0831('0x6')]||'';this[_0x0831('0x7')]=_0xead306[_0x0831('0x7')]||0xa;this['strategy']=_0xead306[_0x0831('0x8')]||_0x0831('0x9');this[_0x0831('0xa')]=_0xead306[_0x0831('0xa')];this['mapAgentsId']={};this[_0x0831('0xb')]=0x0;this[_0x0831('0x1')]='';this[_0x0831('0xc')]();this[_0x0831('0xd')]();}FaxQueue[_0x0831('0xe')]['updateRouting']=function(){var _0x329bc4=this[_0x0831('0xf')][_0x0831('0x10')];this[_0x0831('0xf')]=_[_0x0831('0x11')](this[_0x0831('0xa')],'id');this[_0x0831('0xf')][_0x0831('0x10')]=_0x329bc4;};FaxQueue[_0x0831('0xe')][_0x0831('0xd')]=function(){this[_0x0831('0x12')]=0x0;this[_0x0831('0x13')]=0x0;for(var _0x1d04b4=0x0;_0x1d04b4=0x0?this[_0x0831('0x15')]:0x0;var _0x347fe6={'id':this['id'],'available':this[_0x0831('0x15')],'loggedIn':this[_0x0831('0x12')],'name':this[_0x0831('0x6')],'paused':this[_0x0831('0x13')],'waiting':this[_0x0831('0xb')]};var _0x4cee43=md5(JSON[_0x0831('0x16')](_0x347fe6));if(this[_0x0831('0x1')]!==_0x4cee43){this[_0x0831('0x1')]=_0x4cee43;io['to'](util[_0x0831('0x17')](_0x0831('0x18'),_0x347fe6[_0x0831('0x6')]))[_0x0831('0x19')]('fax_queue:save',_0x347fe6);}};module[_0x0831('0x1a')]=FaxQueue; \ No newline at end of file +var _0x89d0=['strategy','beepall','waiting','md5','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','Agents','loggedIn','paused','length','online','faxPause','available','stringify','fax:queue:%s','fax_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout'];(function(_0x222741,_0x2adbad){var _0xcee5a9=function(_0x158f0d){while(--_0x158f0d){_0x222741['push'](_0x222741['shift']());}};_0xcee5a9(++_0x2adbad);}(_0x89d0,0x1e6));var _0x089d=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x89d0[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x089d('0x0'));var md5=require('md5');var util=require(_0x089d('0x1'));var Redis=require(_0x089d('0x2'));var config=require(_0x089d('0x3'));config[_0x089d('0x4')]=_[_0x089d('0x5')](config[_0x089d('0x4')],{'host':_0x089d('0x6'),'port':0x18eb});var io=require(_0x089d('0x7'))(new Redis(config['redis']));function FaxQueue(_0x2231de){this['id']=_0x2231de['id']||0x0;this[_0x089d('0x8')]=_0x2231de[_0x089d('0x8')]||'';this[_0x089d('0x9')]=_0x2231de[_0x089d('0x9')]||0xa;this[_0x089d('0xa')]=_0x2231de['strategy']||_0x089d('0xb');this['Agents']=_0x2231de['Agents'];this['mapAgentsId']={};this[_0x089d('0xc')]=0x0;this[_0x089d('0xd')]='';this[_0x089d('0xe')]();this[_0x089d('0xf')]();}FaxQueue[_0x089d('0x10')][_0x089d('0xe')]=function(){var _0x2ad22c=this[_0x089d('0x11')][_0x089d('0x12')];this['mapAgentsId']=_[_0x089d('0x13')](this[_0x089d('0x14')],'id');this[_0x089d('0x11')][_0x089d('0x12')]=_0x2ad22c;};FaxQueue[_0x089d('0x10')]['updateRealtime']=function(){this[_0x089d('0x15')]=0x0;this[_0x089d('0x16')]=0x0;for(var _0x28e4dd=0x0;_0x28e4dd=0x0?this[_0x089d('0x1a')]:0x0;var _0x2bce85={'id':this['id'],'available':this['available'],'loggedIn':this[_0x089d('0x15')],'name':this[_0x089d('0x8')],'paused':this[_0x089d('0x16')],'waiting':this['waiting']};var _0x12d9b6=md5(JSON[_0x089d('0x1b')](_0x2bce85));if(this[_0x089d('0xd')]!==_0x12d9b6){this[_0x089d('0xd')]=_0x12d9b6;io['to'](util['format'](_0x089d('0x1c'),_0x2bce85['name']))['emit'](_0x089d('0x1d'),_0x2bce85);}};module[_0x089d('0x1e')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 9039603..7d6f25f 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 _0x57dd=['name','Intervals','exports'];(function(_0x4f2a5e,_0x546e72){var _0x43704f=function(_0x2d5ecd){while(--_0x2d5ecd){_0x4f2a5e['push'](_0x4f2a5e['shift']());}};_0x43704f(++_0x546e72);}(_0x57dd,0x96));var _0xd57d=function(_0x225838,_0x29b914){_0x225838=_0x225838-0x0;var _0x1da96b=_0x57dd[_0x225838];return _0x1da96b;};'use strict';function Interval(_0x29104f){this['id']=_0x29104f['id']||0x0;this['name']=_0x29104f[_0xd57d('0x0')]||'';this[_0xd57d('0x1')]=_0x29104f[_0xd57d('0x1')]||{};}module[_0xd57d('0x2')]=Interval; \ No newline at end of file +var _0x917e=['name','Intervals','exports'];(function(_0x278015,_0x33e825){var _0x41e7f7=function(_0x28be19){while(--_0x28be19){_0x278015['push'](_0x278015['shift']());}};_0x41e7f7(++_0x33e825);}(_0x917e,0xa5));var _0xe917=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x917e[_0x3dd15e];return _0x231fd0;};'use strict';function Interval(_0x1a9b8b){this['id']=_0x1a9b8b['id']||0x0;this['name']=_0x1a9b8b[_0xe917('0x0')]||'';this[_0xe917('0x1')]=_0x1a9b8b[_0xe917('0x1')]||{};}module[_0xe917('0x2')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 156b5bf..1406fcb 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 _0x26c5=['prototype','_rr','map','loggedIn','paused','length','online','mailPause','available','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime'];(function(_0x46b8c4,_0x5b9124){var _0x4e0e0d=function(_0x4103c0){while(--_0x4103c0){_0x46b8c4['push'](_0x46b8c4['shift']());}};_0x4e0e0d(++_0x5b9124);}(_0x26c5,0x6c));var _0x526c=function(_0x347976,_0x62965){_0x347976=_0x347976-0x0;var _0x2db84d=_0x26c5[_0x347976];return _0x2db84d;};'use strict';var _=require('lodash');var md5=require('md5');var util=require('util');var Redis=require(_0x526c('0x0'));var config=require(_0x526c('0x1'));config[_0x526c('0x2')]=_[_0x526c('0x3')](config[_0x526c('0x2')],{'host':_0x526c('0x4'),'port':0x18eb});var io=require(_0x526c('0x5'))(new Redis(config['redis']));function MailQueue(_0x376e1a){this['id']=_0x376e1a['id']||0x0;this['name']=_0x376e1a[_0x526c('0x6')]||'';this['timeout']=_0x376e1a[_0x526c('0x7')]||0xa;this[_0x526c('0x8')]=_0x376e1a[_0x526c('0x8')]||_0x526c('0x9');this[_0x526c('0xa')]=_0x376e1a[_0x526c('0xa')];this[_0x526c('0xb')]={};this[_0x526c('0xc')]=0x0;this[_0x526c('0xd')]='';this[_0x526c('0xe')]();this[_0x526c('0xf')]();}MailQueue[_0x526c('0x10')][_0x526c('0xe')]=function(){var _0x55118d=this['mapAgentsId'][_0x526c('0x11')];this[_0x526c('0xb')]=_[_0x526c('0x12')](this[_0x526c('0xa')],'id');this[_0x526c('0xb')][_0x526c('0x11')]=_0x55118d;};MailQueue['prototype'][_0x526c('0xf')]=function(){this[_0x526c('0x13')]=0x0;this[_0x526c('0x14')]=0x0;for(var _0x68de15=0x0;_0x68de15=0x0?this['available']:0x0;var _0x58fdee={'id':this['id'],'available':this[_0x526c('0x18')],'loggedIn':this[_0x526c('0x13')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x526c('0xc')]};var _0x509609=md5(JSON[_0x526c('0x19')](_0x58fdee));if(this[_0x526c('0xd')]!==_0x509609){this['md5']=_0x509609;io['to'](util[_0x526c('0x1a')](_0x526c('0x1b'),_0x58fdee[_0x526c('0x6')]))[_0x526c('0x1c')](_0x526c('0x1d'),_0x58fdee);}};module[_0x526c('0x1e')]=MailQueue; \ No newline at end of file +var _0xf3d1=['mail:queue:%s','emit','mail_queue:save','exports','lodash','util','redis','defaults','localhost','name','timeout','strategy','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','length','online','mailPause','paused','available','stringify','format'];(function(_0xffe34d,_0x17d49b){var _0x360736=function(_0xca72b5){while(--_0xca72b5){_0xffe34d['push'](_0xffe34d['shift']());}};_0x360736(++_0x17d49b);}(_0xf3d1,0xec));var _0x1f3d=function(_0x286fcd,_0x46781e){_0x286fcd=_0x286fcd-0x0;var _0x2a8de8=_0xf3d1[_0x286fcd];return _0x2a8de8;};'use strict';var _=require(_0x1f3d('0x0'));var md5=require('md5');var util=require(_0x1f3d('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x1f3d('0x2')]=_[_0x1f3d('0x3')](config['redis'],{'host':_0x1f3d('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1f3d('0x2')]));function MailQueue(_0xa7d427){this['id']=_0xa7d427['id']||0x0;this['name']=_0xa7d427[_0x1f3d('0x5')]||'';this[_0x1f3d('0x6')]=_0xa7d427[_0x1f3d('0x6')]||0xa;this['strategy']=_0xa7d427[_0x1f3d('0x7')]||'beepall';this[_0x1f3d('0x8')]=_0xa7d427['Agents'];this[_0x1f3d('0x9')]={};this[_0x1f3d('0xa')]=0x0;this[_0x1f3d('0xb')]='';this[_0x1f3d('0xc')]();this[_0x1f3d('0xd')]();}MailQueue[_0x1f3d('0xe')]['updateRouting']=function(){var _0x3d1016=this[_0x1f3d('0x9')]['_rr'];this[_0x1f3d('0x9')]=_[_0x1f3d('0xf')](this[_0x1f3d('0x8')],'id');this['mapAgentsId'][_0x1f3d('0x10')]=_0x3d1016;};MailQueue[_0x1f3d('0xe')][_0x1f3d('0xd')]=function(){this[_0x1f3d('0x11')]=0x0;this['paused']=0x0;for(var _0x1b8761=0x0;_0x1b8761=0x0?this[_0x1f3d('0x16')]:0x0;var _0x3e3012={'id':this['id'],'available':this[_0x1f3d('0x16')],'loggedIn':this[_0x1f3d('0x11')],'name':this[_0x1f3d('0x5')],'paused':this[_0x1f3d('0x15')],'waiting':this[_0x1f3d('0xa')]};var _0x4ed86c=md5(JSON[_0x1f3d('0x17')](_0x3e3012));if(this[_0x1f3d('0xb')]!==_0x4ed86c){this[_0x1f3d('0xb')]=_0x4ed86c;io['to'](util[_0x1f3d('0x18')](_0x1f3d('0x19'),_0x3e3012[_0x1f3d('0x5')]))[_0x1f3d('0x1a')](_0x1f3d('0x1b'),_0x3e3012);}};module[_0x1f3d('0x1c')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 726d59e..9b1a85b 100644 --- a/server/services/routing/model/openchannelQueue.js +++ b/server/services/routing/model/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['exports','lodash','md5','util','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','waiting','updateRealtime','mapAgentsId','_rr','map','Agents','prototype','loggedIn','paused','length','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0x7a54,0x106));var _0x47a5=function(_0x47b4fd,_0x44bde5){_0x47b4fd=_0x47b4fd-0x0;var _0x1d6ec7=_0x7a54[_0x47b4fd];return _0x1d6ec7;};'use strict';var _=require(_0x47a5('0x0'));var md5=require(_0x47a5('0x1'));var util=require(_0x47a5('0x2'));var Redis=require('ioredis');var config=require(_0x47a5('0x3'));config[_0x47a5('0x4')]=_['defaults'](config[_0x47a5('0x4')],{'host':_0x47a5('0x5'),'port':0x18eb});var io=require(_0x47a5('0x6'))(new Redis(config[_0x47a5('0x4')]));function OpenchannelQueue(_0xfdf934){this['id']=_0xfdf934['id']||0x0;this['name']=_0xfdf934[_0x47a5('0x7')]||'';this['timeout']=_0xfdf934[_0x47a5('0x8')]||0xa;this[_0x47a5('0x9')]=_0xfdf934['strategy']||_0x47a5('0xa');this['Agents']=_0xfdf934['Agents'];this['mapAgentsId']={};this[_0x47a5('0xb')]=0x0;this[_0x47a5('0x1')]='';this['updateRouting']();this[_0x47a5('0xc')]();}OpenchannelQueue['prototype']['updateRouting']=function(){var _0x1f47f4=this[_0x47a5('0xd')][_0x47a5('0xe')];this[_0x47a5('0xd')]=_[_0x47a5('0xf')](this[_0x47a5('0x10')],'id');this[_0x47a5('0xd')]['_rr']=_0x1f47f4;};OpenchannelQueue[_0x47a5('0x11')][_0x47a5('0xc')]=function(){this[_0x47a5('0x12')]=0x0;this[_0x47a5('0x13')]=0x0;for(var _0x139f25=0x0;_0x139f25=0x0?this['available']:0x0;var _0x423a81={'id':this['id'],'available':this[_0x47a5('0x16')],'loggedIn':this[_0x47a5('0x12')],'name':this[_0x47a5('0x7')],'paused':this[_0x47a5('0x13')],'waiting':this[_0x47a5('0xb')]};var _0x2763d6=md5(JSON[_0x47a5('0x17')](_0x423a81));if(this[_0x47a5('0x1')]!==_0x2763d6){this['md5']=_0x2763d6;io['to'](util[_0x47a5('0x18')](_0x47a5('0x19'),_0x423a81['name']))[_0x47a5('0x1a')](_0x47a5('0x1b'),_0x423a81);}};module[_0x47a5('0x1c')]=OpenchannelQueue; \ No newline at end of file +var _0x7a54=['exports','lodash','md5','util','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','waiting','updateRealtime','mapAgentsId','_rr','map','Agents','prototype','loggedIn','paused','length','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save'];(function(_0x710815,_0x520da8){var _0x5b3b89=function(_0x2e1a8e){while(--_0x2e1a8e){_0x710815['push'](_0x710815['shift']());}};_0x5b3b89(++_0x520da8);}(_0x7a54,0x106));var _0x47a5=function(_0x329ea3,_0x497f35){_0x329ea3=_0x329ea3-0x0;var _0x29478b=_0x7a54[_0x329ea3];return _0x29478b;};'use strict';var _=require(_0x47a5('0x0'));var md5=require(_0x47a5('0x1'));var util=require(_0x47a5('0x2'));var Redis=require('ioredis');var config=require(_0x47a5('0x3'));config[_0x47a5('0x4')]=_['defaults'](config[_0x47a5('0x4')],{'host':_0x47a5('0x5'),'port':0x18eb});var io=require(_0x47a5('0x6'))(new Redis(config[_0x47a5('0x4')]));function OpenchannelQueue(_0xfdf934){this['id']=_0xfdf934['id']||0x0;this['name']=_0xfdf934[_0x47a5('0x7')]||'';this['timeout']=_0xfdf934[_0x47a5('0x8')]||0xa;this[_0x47a5('0x9')]=_0xfdf934['strategy']||_0x47a5('0xa');this['Agents']=_0xfdf934['Agents'];this['mapAgentsId']={};this[_0x47a5('0xb')]=0x0;this[_0x47a5('0x1')]='';this['updateRouting']();this[_0x47a5('0xc')]();}OpenchannelQueue['prototype']['updateRouting']=function(){var _0x1f47f4=this[_0x47a5('0xd')][_0x47a5('0xe')];this[_0x47a5('0xd')]=_[_0x47a5('0xf')](this[_0x47a5('0x10')],'id');this[_0x47a5('0xd')]['_rr']=_0x1f47f4;};OpenchannelQueue[_0x47a5('0x11')][_0x47a5('0xc')]=function(){this[_0x47a5('0x12')]=0x0;this[_0x47a5('0x13')]=0x0;for(var _0x139f25=0x0;_0x139f25=0x0?this['available']:0x0;var _0x423a81={'id':this['id'],'available':this[_0x47a5('0x16')],'loggedIn':this[_0x47a5('0x12')],'name':this[_0x47a5('0x7')],'paused':this[_0x47a5('0x13')],'waiting':this[_0x47a5('0xb')]};var _0x2763d6=md5(JSON[_0x47a5('0x17')](_0x423a81));if(this[_0x47a5('0x1')]!==_0x2763d6){this['md5']=_0x2763d6;io['to'](util[_0x47a5('0x18')](_0x47a5('0x19'),_0x423a81['name']))[_0x47a5('0x1a')](_0x47a5('0x1b'),_0x423a81);}};module[_0x47a5('0x1c')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index b61416f..052f431 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 _0x2821=['waiting','updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','online','smsPause','available','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId'];(function(_0x3549de,_0x31f7aa){var _0x1b4d86=function(_0x3f749d){while(--_0x3f749d){_0x3549de['push'](_0x3549de['shift']());}};_0x1b4d86(++_0x31f7aa);}(_0x2821,0x87));var _0x1282=function(_0x4c821a,_0x49a7ec){_0x4c821a=_0x4c821a-0x0;var _0x3848cf=_0x2821[_0x4c821a];return _0x3848cf;};'use strict';var _=require(_0x1282('0x0'));var md5=require(_0x1282('0x1'));var util=require(_0x1282('0x2'));var Redis=require(_0x1282('0x3'));var config=require(_0x1282('0x4'));config[_0x1282('0x5')]=_[_0x1282('0x6')](config[_0x1282('0x5')],{'host':_0x1282('0x7'),'port':0x18eb});var io=require(_0x1282('0x8'))(new Redis(config[_0x1282('0x5')]));function SmsQueue(_0x5c15c0){this['id']=_0x5c15c0['id']||0x0;this[_0x1282('0x9')]=_0x5c15c0[_0x1282('0x9')]||'';this[_0x1282('0xa')]=_0x5c15c0[_0x1282('0xa')]||0xa;this[_0x1282('0xb')]=_0x5c15c0[_0x1282('0xb')]||_0x1282('0xc');this[_0x1282('0xd')]=_0x5c15c0['Agents'];this[_0x1282('0xe')]={};this[_0x1282('0xf')]=0x0;this[_0x1282('0x1')]='';this[_0x1282('0x10')]();this[_0x1282('0x11')]();}SmsQueue['prototype'][_0x1282('0x10')]=function(){var _0x3452aa=this['mapAgentsId'][_0x1282('0x12')];this[_0x1282('0xe')]=_['map'](this[_0x1282('0xd')],'id');this['mapAgentsId']['_rr']=_0x3452aa;};SmsQueue[_0x1282('0x13')][_0x1282('0x11')]=function(){this[_0x1282('0x14')]=0x0;this[_0x1282('0x15')]=0x0;for(var _0x4dfd14=0x0;_0x4dfd14=0x0?this['available']:0x0;var _0x48c857={'id':this['id'],'available':this[_0x1282('0x18')],'loggedIn':this['loggedIn'],'name':this[_0x1282('0x9')],'paused':this[_0x1282('0x15')],'waiting':this['waiting']};var _0x5ea75d=md5(JSON['stringify'](_0x48c857));if(this['md5']!==_0x5ea75d){this[_0x1282('0x1')]=_0x5ea75d;io['to'](util[_0x1282('0x19')](_0x1282('0x1a'),_0x48c857[_0x1282('0x9')]))[_0x1282('0x1b')](_0x1282('0x1c'),_0x48c857);}};module[_0x1282('0x1d')]=SmsQueue; \ No newline at end of file +var _0xc831=['ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','map','_rr','loggedIn','length','online','smsPause','paused','available','stringify','format','emit','md5','util'];(function(_0x5a187b,_0x1f64fe){var _0x14d601=function(_0x45fd29){while(--_0x45fd29){_0x5a187b['push'](_0x5a187b['shift']());}};_0x14d601(++_0x1f64fe);}(_0xc831,0x103));var _0x1c83=function(_0x11d11c,_0x505414){_0x11d11c=_0x11d11c-0x0;var _0x23f135=_0xc831[_0x11d11c];return _0x23f135;};'use strict';var _=require('lodash');var md5=require(_0x1c83('0x0'));var util=require(_0x1c83('0x1'));var Redis=require(_0x1c83('0x2'));var config=require(_0x1c83('0x3'));config[_0x1c83('0x4')]=_[_0x1c83('0x5')](config[_0x1c83('0x4')],{'host':_0x1c83('0x6'),'port':0x18eb});var io=require(_0x1c83('0x7'))(new Redis(config[_0x1c83('0x4')]));function SmsQueue(_0x4fb4c3){this['id']=_0x4fb4c3['id']||0x0;this['name']=_0x4fb4c3[_0x1c83('0x8')]||'';this['timeout']=_0x4fb4c3[_0x1c83('0x9')]||0xa;this[_0x1c83('0xa')]=_0x4fb4c3[_0x1c83('0xa')]||_0x1c83('0xb');this[_0x1c83('0xc')]=_0x4fb4c3['Agents'];this[_0x1c83('0xd')]={};this[_0x1c83('0xe')]=0x0;this['md5']='';this['updateRouting']();this[_0x1c83('0xf')]();}SmsQueue[_0x1c83('0x10')][_0x1c83('0x11')]=function(){var _0x5db682=this[_0x1c83('0xd')]['_rr'];this['mapAgentsId']=_[_0x1c83('0x12')](this[_0x1c83('0xc')],'id');this[_0x1c83('0xd')][_0x1c83('0x13')]=_0x5db682;};SmsQueue[_0x1c83('0x10')][_0x1c83('0xf')]=function(){this[_0x1c83('0x14')]=0x0;this['paused']=0x0;for(var _0x43f74e=0x0;_0x43f74e=0x0?this[_0x1c83('0x19')]:0x0;var _0x1d6027={'id':this['id'],'available':this[_0x1c83('0x19')],'loggedIn':this[_0x1c83('0x14')],'name':this['name'],'paused':this[_0x1c83('0x18')],'waiting':this['waiting']};var _0x2d387d=md5(JSON[_0x1c83('0x1a')](_0x1d6027));if(this['md5']!==_0x2d387d){this[_0x1c83('0x0')]=_0x2d387d;io['to'](util[_0x1c83('0x1b')]('sms:queue:%s',_0x1d6027['name']))[_0x1c83('0x1c')]('sms_queue:save',_0x1d6027);}};module['exports']=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 3d107c3..59a77f4 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 _0xe253=['redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','map','paused','online','loggedIn','available','format','emit','whatsapp_queue:save','exports','md5','util','ioredis','../../../config/environment'];(function(_0x268fde,_0x417640){var _0x130dfd=function(_0x3f945f){while(--_0x3f945f){_0x268fde['push'](_0x268fde['shift']());}};_0x130dfd(++_0x417640);}(_0xe253,0xb2));var _0x3e25=function(_0x38869d,_0x3d486d){_0x38869d=_0x38869d-0x0;var _0x11b2c2=_0xe253[_0x38869d];return _0x11b2c2;};'use strict';var _=require('lodash');var md5=require(_0x3e25('0x0'));var util=require(_0x3e25('0x1'));var Redis=require(_0x3e25('0x2'));var config=require(_0x3e25('0x3'));config[_0x3e25('0x4')]=_['defaults'](config[_0x3e25('0x4')],{'host':_0x3e25('0x5'),'port':0x18eb});var io=require(_0x3e25('0x6'))(new Redis(config[_0x3e25('0x4')]));function WhatsappQueue(_0x31b1f8){this['id']=_0x31b1f8['id']||0x0;this[_0x3e25('0x7')]=_0x31b1f8['name']||'';this['timeout']=_0x31b1f8[_0x3e25('0x8')]||0xa;this['strategy']=_0x31b1f8[_0x3e25('0x9')]||_0x3e25('0xa');this[_0x3e25('0xb')]=_0x31b1f8[_0x3e25('0xb')];this['mapAgentsId']={};this[_0x3e25('0xc')]=0x0;this[_0x3e25('0x0')]='';this[_0x3e25('0xd')]();this[_0x3e25('0xe')]();}WhatsappQueue[_0x3e25('0xf')][_0x3e25('0xd')]=function(){var _0x110e3f=this[_0x3e25('0x10')]['_rr'];this[_0x3e25('0x10')]=_[_0x3e25('0x11')](this[_0x3e25('0xb')],'id');this[_0x3e25('0x10')]['_rr']=_0x110e3f;};WhatsappQueue[_0x3e25('0xf')][_0x3e25('0xe')]=function(){this['loggedIn']=0x0;this[_0x3e25('0x12')]=0x0;for(var _0x845b66=0x0;_0x845b66=0x0?this['available']:0x0;var _0x52ea62={'id':this['id'],'available':this[_0x3e25('0x15')],'loggedIn':this[_0x3e25('0x14')],'name':this[_0x3e25('0x7')],'paused':this['paused'],'waiting':this[_0x3e25('0xc')]};var _0x504125=md5(JSON['stringify'](_0x52ea62));if(this[_0x3e25('0x0')]!==_0x504125){this[_0x3e25('0x0')]=_0x504125;io['to'](util[_0x3e25('0x16')]('whatsapp:queue:%s',_0x52ea62['name']))[_0x3e25('0x17')](_0x3e25('0x18'),_0x52ea62);}};module[_0x3e25('0x19')]=WhatsappQueue; \ No newline at end of file +var _0x5040=['redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','updateRealtime','paused','length','loggedIn','whatsappPause','available','format','whatsapp_queue:save','lodash','md5','ioredis','../../../config/environment','defaults'];(function(_0x49b6fa,_0x1213b8){var _0x134f4b=function(_0x288eae){while(--_0x288eae){_0x49b6fa['push'](_0x49b6fa['shift']());}};_0x134f4b(++_0x1213b8);}(_0x5040,0xc3));var _0x0504=function(_0x5f5c45,_0x1371d9){_0x5f5c45=_0x5f5c45-0x0;var _0x365424=_0x5040[_0x5f5c45];return _0x365424;};'use strict';var _=require(_0x0504('0x0'));var md5=require(_0x0504('0x1'));var util=require('util');var Redis=require(_0x0504('0x2'));var config=require(_0x0504('0x3'));config['redis']=_[_0x0504('0x4')](config[_0x0504('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x0504('0x6'))(new Redis(config[_0x0504('0x5')]));function WhatsappQueue(_0x26167c){this['id']=_0x26167c['id']||0x0;this['name']=_0x26167c[_0x0504('0x7')]||'';this[_0x0504('0x8')]=_0x26167c['timeout']||0xa;this[_0x0504('0x9')]=_0x26167c['strategy']||_0x0504('0xa');this['Agents']=_0x26167c[_0x0504('0xb')];this[_0x0504('0xc')]={};this[_0x0504('0xd')]=0x0;this[_0x0504('0x1')]='';this[_0x0504('0xe')]();this['updateRealtime']();}WhatsappQueue[_0x0504('0xf')][_0x0504('0xe')]=function(){var _0x1e8cfd=this[_0x0504('0xc')][_0x0504('0x10')];this[_0x0504('0xc')]=_['map'](this[_0x0504('0xb')],'id');this['mapAgentsId'][_0x0504('0x10')]=_0x1e8cfd;};WhatsappQueue['prototype'][_0x0504('0x11')]=function(){this['loggedIn']=0x0;this[_0x0504('0x12')]=0x0;for(var _0x2f19a3=0x0;_0x2f19a3=0x0?this[_0x0504('0x16')]:0x0;var _0x5791ac={'id':this['id'],'available':this[_0x0504('0x16')],'loggedIn':this[_0x0504('0x14')],'name':this[_0x0504('0x7')],'paused':this[_0x0504('0x12')],'waiting':this['waiting']};var _0x48453c=md5(JSON['stringify'](_0x5791ac));if(this[_0x0504('0x1')]!==_0x48453c){this[_0x0504('0x1')]=_0x48453c;io['to'](util[_0x0504('0x17')]('whatsapp:queue:%s',_0x5791ac['name']))['emit'](_0x0504('0x18'),_0x5791ac);}};module['exports']=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 8bd1758..cc4538f 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(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'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 _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 452e317..409862e 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 _0x852d=['addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','Request','UpdateChatInteraction','updateChatInteraction'];(function(_0x48d5b9,_0x309233){var _0x427e06=function(_0x5ca39f){while(--_0x5ca39f){_0x48d5b9['push'](_0x48d5b9['shift']());}};_0x427e06(++_0x309233);}(_0x852d,0x183));var _0xd852=function(_0x2cea4a,_0x23831c){_0x2cea4a=_0x2cea4a-0x0;var _0x4caa14=_0x852d[_0x2cea4a];return _0x4caa14;};'use strict';var client=require(_0xd852('0x0'));exports[_0xd852('0x1')]=function(_0xc17a32,_0x2f53b9){return client[_0xd852('0x2')](_0xd852('0x3'),{'body':_0x2f53b9,'options':{'where':{'id':_0xc17a32}},'log':_0xd852('0x4')});};exports[_0xd852('0x5')]=function(_0x565ae1,_0x449877){return client[_0xd852('0x2')](_0xd852('0x6'),{'body':_0x449877,'options':{'where':{'id':_0x565ae1}},'log':_0xd852('0x7')});}; \ No newline at end of file +var _0xf69e=['update','UpdateChatInteraction','updateChatInteraction','addTags','Request','AddTagsToChatInteraction','addTagsToChatInteraction','../client'];(function(_0x1d69ba,_0x4090c9){var _0x8bab8c=function(_0x33ce38){while(--_0x33ce38){_0x1d69ba['push'](_0x1d69ba['shift']());}};_0x8bab8c(++_0x4090c9);}(_0xf69e,0x1c7));var _0xef69=function(_0x48dc64,_0x5198cf){_0x48dc64=_0x48dc64-0x0;var _0x1a7194=_0xf69e[_0x48dc64];return _0x1a7194;};'use strict';var client=require(_0xef69('0x0'));exports[_0xef69('0x1')]=function(_0x27449a,_0xc12176){return client['Request'](_0xef69('0x2'),{'body':_0xc12176,'options':{'where':{'id':_0x27449a}},'log':_0xef69('0x3')});};exports[_0xef69('0x4')]=function(_0x1d1a93,_0x49133f){return client[_0xef69('0x5')](_0xef69('0x6'),{'body':_0x49133f,'options':{'where':{'id':_0x1d1a93}},'log':_0xef69('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 7dc43ea..698b60d 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 _0xa55a=['create','../client'];(function(_0x599939,_0x49392d){var _0x545cc0=function(_0x498ab9){while(--_0x498ab9){_0x599939['push'](_0x599939['shift']());}};_0x545cc0(++_0x49392d);}(_0xa55a,0x115));var _0xaa55=function(_0x721f46,_0x51a1e8){_0x721f46=_0x721f46-0x0;var _0x5524e6=_0xa55a[_0x721f46];return _0x5524e6;};'use strict';var client=require(_0xaa55('0x0'));exports[_0xaa55('0x1')]=function(_0x36dd67){return client['Request']('CreateChatMessage',{'body':_0x36dd67,'log':'createChatMessage'});}; \ No newline at end of file +var _0xd29e=['CreateChatMessage','createChatMessage','../client','create'];(function(_0xe6b045,_0xdc398){var _0x274563=function(_0x46715a){while(--_0x46715a){_0xe6b045['push'](_0xe6b045['shift']());}};_0x274563(++_0xdc398);}(_0xd29e,0x8e));var _0xed29=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd29e[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xed29('0x0'));exports[_0xed29('0x1')]=function(_0x203e0f){return client['Request'](_0xed29('0x2'),{'body':_0x203e0f,'log':_0xed29('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index cb88c0e..8c1d544 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 _0x7a08=['name','timeout','strategy','User','Agents','online','chatPause','../client','getChatQueues'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x7a08,0x11e));var _0x87a0=function(_0xe4936,_0x3cd5c0){_0xe4936=_0xe4936-0x0;var _0x254fee=_0x7a08[_0xe4936];return _0x254fee;};'use strict';var client=require(_0x87a0('0x0'));exports[_0x87a0('0x1')]=function(){return function(){return client['Request']('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0x87a0('0x2'),_0x87a0('0x3'),_0x87a0('0x4')],'include':[{'model':_0x87a0('0x5'),'as':_0x87a0('0x6'),'attributes':['id',_0x87a0('0x2'),_0x87a0('0x7'),_0x87a0('0x8')]}]},'log':_0x87a0('0x1')});};}; \ No newline at end of file +var _0xbd3c=['Request','name','timeout','strategy','chatPause','../client','getChatQueues'];(function(_0x1bf080,_0x42b9e9){var _0x536f8c=function(_0x2b495a){while(--_0x2b495a){_0x1bf080['push'](_0x1bf080['shift']());}};_0x536f8c(++_0x42b9e9);}(_0xbd3c,0xc2));var _0xcbd3=function(_0x2d436d,_0x3586a6){_0x2d436d=_0x2d436d-0x0;var _0x19e2b6=_0xbd3c[_0x2d436d];return _0x19e2b6;};'use strict';var client=require(_0xcbd3('0x0'));exports[_0xcbd3('0x1')]=function(){return function(){return client[_0xcbd3('0x2')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0xcbd3('0x3'),_0xcbd3('0x4'),_0xcbd3('0x5')],'include':[{'model':'User','as':'Agents','attributes':['id',_0xcbd3('0x3'),'online',_0xcbd3('0x6')]}]},'log':_0xcbd3('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index b6fb623..9d43c0c 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 _0xf109=['UpdateChatQueueReport','DESC','../client','create','update','Request'];(function(_0x4b8be4,_0x586e85){var _0x498b9d=function(_0x41e8bb){while(--_0x41e8bb){_0x4b8be4['push'](_0x4b8be4['shift']());}};_0x498b9d(++_0x586e85);}(_0xf109,0xce));var _0x9f10=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0xf109[_0x42bdad];return _0x122626;};'use strict';var client=require(_0x9f10('0x0'));exports[_0x9f10('0x1')]=function(_0x44c4f2){return client['Request']('CreateChatQueueReport',{'body':_0x44c4f2,'log':'CreateChatQueueReport'});};exports[_0x9f10('0x2')]=function(_0x74f517,_0x74d0ee){return client[_0x9f10('0x3')](_0x9f10('0x4'),{'body':_0x74d0ee,'options':{'where':{'uniqueid':_0x74f517},'order':[['id',_0x9f10('0x5')]],'limit':0x1},'log':_0x9f10('0x4')});}; \ No newline at end of file +var _0xc2cc=['create','Request','CreateChatQueueReport','DESC'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc2cc,0x70));var _0xcc2c=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xc2cc[_0x59ee6f];return _0x4c0979;};'use strict';var client=require('../client');exports[_0xcc2c('0x0')]=function(_0x1a1db8){return client[_0xcc2c('0x1')]('CreateChatQueueReport',{'body':_0x1a1db8,'log':_0xcc2c('0x2')});};exports['update']=function(_0x23bd62,_0x47c883){return client[_0xcc2c('0x1')]('UpdateChatQueueReport',{'body':_0x47c883,'options':{'where':{'uniqueid':_0x23bd62},'order':[['id',_0xcc2c('0x3')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 30835cf..a006530 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0xb24fad,_0xd58756){var _0x173226=function(_0x33b4d6){while(--_0x33b4d6){_0xb24fad['push'](_0xb24fad['shift']());}};_0x173226(++_0xd58756);}(_0x7a54,0x106));var _0x47a5=function(_0xae7da0,_0x9bbf91){_0xae7da0=_0xae7da0-0x0;var _0xcd60a2=_0x7a54[_0xae7da0];return _0xcd60a2;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x28e4ea,_0x4856fd){var _0x545c63=function(_0x1a6471){while(--_0x1a6471){_0x28e4ea['push'](_0x28e4ea['shift']());}};_0x545c63(++_0x4856fd);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 235c42b..d68b368 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 _0x022e=['create','Request','CreateFaxMessage','../client'];(function(_0x455565,_0x407730){var _0x5119a4=function(_0x1157df){while(--_0x1157df){_0x455565['push'](_0x455565['shift']());}};_0x5119a4(++_0x407730);}(_0x022e,0x15f));var _0xe022=function(_0x4c440b,_0x3ea627){_0x4c440b=_0x4c440b-0x0;var _0x2d48cf=_0x022e[_0x4c440b];return _0x2d48cf;};'use strict';var client=require(_0xe022('0x0'));exports[_0xe022('0x1')]=function(_0x2fb20d){return client[_0xe022('0x2')](_0xe022('0x3'),{'body':_0x2fb20d,'log':'createFaxMessage'});}; \ No newline at end of file +var _0x4983=['Request','createFaxMessage','../client'];(function(_0xa0b432,_0x55f6c9){var _0x4a35ed=function(_0x2f6aa4){while(--_0x2f6aa4){_0xa0b432['push'](_0xa0b432['shift']());}};_0x4a35ed(++_0x55f6c9);}(_0x4983,0x158));var _0x3498=function(_0x4e18f5,_0x3538fd){_0x4e18f5=_0x4e18f5-0x0;var _0x3f0d78=_0x4983[_0x4e18f5];return _0x3f0d78;};'use strict';var client=require(_0x3498('0x0'));exports['create']=function(_0x1b19c1){return client[_0x3498('0x1')]('CreateFaxMessage',{'body':_0x1b19c1,'log':_0x3498('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 5f57a0f..2547a28 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 _0xa7da=['User','Agents','online','faxPause','../client','getFaxQueues','Request','GetFaxQueue','name','timeout','strategy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa7da,0x1f3));var _0xaa7d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa7da[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0xaa7d('0x0'));exports[_0xaa7d('0x1')]=function(){return function(){return client[_0xaa7d('0x2')](_0xaa7d('0x3'),{'options':{'raw':![],'attributes':['id',_0xaa7d('0x4'),_0xaa7d('0x5'),_0xaa7d('0x6')],'include':[{'model':_0xaa7d('0x7'),'as':_0xaa7d('0x8'),'attributes':['id',_0xaa7d('0x4'),_0xaa7d('0x9'),_0xaa7d('0xa')]}]},'log':_0xaa7d('0x1')});};}; \ No newline at end of file +var _0x7e47=['timeout','strategy','User','Agents','online','../client','getFaxQueues','Request','name'];(function(_0x1a2757,_0x52d178){var _0x2ba7a5=function(_0xccde63){while(--_0xccde63){_0x1a2757['push'](_0x1a2757['shift']());}};_0x2ba7a5(++_0x52d178);}(_0x7e47,0xd4));var _0x77e4=function(_0x45b0e3,_0x1eb267){_0x45b0e3=_0x45b0e3-0x0;var _0x4dd1d9=_0x7e47[_0x45b0e3];return _0x4dd1d9;};'use strict';var client=require(_0x77e4('0x0'));exports[_0x77e4('0x1')]=function(){return function(){return client[_0x77e4('0x2')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x77e4('0x3'),_0x77e4('0x4'),_0x77e4('0x5')],'include':[{'model':_0x77e4('0x6'),'as':_0x77e4('0x7'),'attributes':['id',_0x77e4('0x3'),_0x77e4('0x8'),'faxPause']}]},'log':_0x77e4('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 058e250..f202779 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 _0x46d9=['create','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','../client'];(function(_0x3468da,_0xa30955){var _0x581820=function(_0x52a4d1){while(--_0x52a4d1){_0x3468da['push'](_0x3468da['shift']());}};_0x581820(++_0xa30955);}(_0x46d9,0x18e));var _0x946d=function(_0x3e0bc2,_0x3a31db){_0x3e0bc2=_0x3e0bc2-0x0;var _0x1450bd=_0x46d9[_0x3e0bc2];return _0x1450bd;};'use strict';var client=require(_0x946d('0x0'));exports[_0x946d('0x1')]=function(_0x4752eb){return client[_0x946d('0x2')](_0x946d('0x3'),{'body':_0x4752eb,'log':_0x946d('0x3')});};exports[_0x946d('0x4')]=function(_0xffa9f8,_0xbf7ad7){return client['Request'](_0x946d('0x5'),{'body':_0xbf7ad7,'options':{'where':{'uniqueid':_0xffa9f8},'order':[['id',_0x946d('0x6')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0x0043=['../client','create','Request','CreateFaxQueueReport','update','DESC','UpdateFaxQueueReport'];(function(_0x7f205b,_0x1535dc){var _0xf0df84=function(_0x502874){while(--_0x502874){_0x7f205b['push'](_0x7f205b['shift']());}};_0xf0df84(++_0x1535dc);}(_0x0043,0xe7));var _0x3004=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x0043[_0x1969a7];return _0x3d665f;};'use strict';var client=require(_0x3004('0x0'));exports[_0x3004('0x1')]=function(_0x15d85e){return client[_0x3004('0x2')]('CreateFaxQueueReport',{'body':_0x15d85e,'log':_0x3004('0x3')});};exports[_0x3004('0x4')]=function(_0x49a00b,_0x3b2c5f){return client[_0x3004('0x2')]('UpdateFaxQueueReport',{'body':_0x3b2c5f,'options':{'where':{'uniqueid':_0x49a00b},'order':[['id',_0x3004('0x5')]],'limit':0x1},'log':_0x3004('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index bedc87b..fae675e 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 _0x32dc=['name','interval','../client','getIntervals','Request','GetInterval','Interval','Intervals'];(function(_0x56987a,_0x443152){var _0x4f1c4c=function(_0xd569e){while(--_0xd569e){_0x56987a['push'](_0x56987a['shift']());}};_0x4f1c4c(++_0x443152);}(_0x32dc,0xba));var _0xc32d=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x32dc[_0x167cc1];return _0x10bc4b;};'use strict';var client=require(_0xc32d('0x0'));exports[_0xc32d('0x1')]=function(){return function(){return client[_0xc32d('0x2')](_0xc32d('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0xc32d('0x4'),'as':_0xc32d('0x5'),'attributes':['id',_0xc32d('0x6'),_0xc32d('0x7')]}]},'log':_0xc32d('0x1')});};}; \ No newline at end of file +var _0x7240=['../client','getIntervals','Request','Intervals','name','interval'];(function(_0x5dbb84,_0x1bbce9){var _0x1d6eae=function(_0xd93967){while(--_0xd93967){_0x5dbb84['push'](_0x5dbb84['shift']());}};_0x1d6eae(++_0x1bbce9);}(_0x7240,0xc0));var _0x0724=function(_0x3305de,_0x16582f){_0x3305de=_0x3305de-0x0;var _0x3b5a84=_0x7240[_0x3305de];return _0x3b5a84;};'use strict';var client=require(_0x0724('0x0'));exports[_0x0724('0x1')]=function(){return function(){return client[_0x0724('0x2')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':'Interval','as':_0x0724('0x3'),'attributes':['id',_0x0724('0x4'),_0x0724('0x5')]}]},'log':'getIntervals'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index b0f81fb..2d3535b 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 _0xe5af=['update','Request','UpdateMailInteraction','updateMailInteraction','AddTagsToMailInteraction','addTagsToChatInteraction'];(function(_0x23ae4d,_0x2eb6d3){var _0x45ed9e=function(_0x48ed39){while(--_0x48ed39){_0x23ae4d['push'](_0x23ae4d['shift']());}};_0x45ed9e(++_0x2eb6d3);}(_0xe5af,0x9c));var _0xfe5a=function(_0x375fab,_0x49af77){_0x375fab=_0x375fab-0x0;var _0x1e8e34=_0xe5af[_0x375fab];return _0x1e8e34;};'use strict';var client=require('../client');exports[_0xfe5a('0x0')]=function(_0x189c37,_0x4b1845){return client[_0xfe5a('0x1')](_0xfe5a('0x2'),{'body':_0x4b1845,'options':{'where':{'id':_0x189c37}},'log':_0xfe5a('0x3')});};exports['addTags']=function(_0x1165e3,_0x48e3a7){return client['Request'](_0xfe5a('0x4'),{'body':_0x48e3a7,'options':{'where':{'id':_0x1165e3}},'log':_0xfe5a('0x5')});}; \ No newline at end of file +var _0x3de3=['../client','UpdateMailInteraction','updateMailInteraction','addTags','Request','AddTagsToMailInteraction'];(function(_0x586baa,_0x1cfa01){var _0x1ff9a7=function(_0x2dbce0){while(--_0x2dbce0){_0x586baa['push'](_0x586baa['shift']());}};_0x1ff9a7(++_0x1cfa01);}(_0x3de3,0x1ce));var _0x33de=function(_0x3691a1,_0x47dc15){_0x3691a1=_0x3691a1-0x0;var _0x5bb392=_0x3de3[_0x3691a1];return _0x5bb392;};'use strict';var client=require(_0x33de('0x0'));exports['update']=function(_0x19d1ba,_0x100783){return client['Request'](_0x33de('0x1'),{'body':_0x100783,'options':{'where':{'id':_0x19d1ba}},'log':_0x33de('0x2')});};exports[_0x33de('0x3')]=function(_0xbdd404,_0x56b413){return client[_0x33de('0x4')](_0x33de('0x5'),{'body':_0x56b413,'options':{'where':{'id':_0xbdd404}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 896a31d..366b478 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 _0x3c97=['CreateMailMessage','createMailMessage','create'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x3c97,0x16d));var _0x73c9=function(_0x4bd57e,_0x1a9e65){_0x4bd57e=_0x4bd57e-0x0;var _0x326b03=_0x3c97[_0x4bd57e];return _0x326b03;};'use strict';var client=require('../client');exports[_0x73c9('0x0')]=function(_0xbcd2df){return client['Request'](_0x73c9('0x1'),{'body':_0xbcd2df,'log':_0x73c9('0x2')});}; \ No newline at end of file +var _0xcd60=['CreateMailMessage','createMailMessage','create'];(function(_0x197e8e,_0x31af8c){var _0x31cff4=function(_0xb0e84d){while(--_0xb0e84d){_0x197e8e['push'](_0x197e8e['shift']());}};_0x31cff4(++_0x31af8c);}(_0xcd60,0x15b));var _0x0cd6=function(_0xf9ae3d,_0x48e369){_0xf9ae3d=_0xf9ae3d-0x0;var _0x53adaa=_0xcd60[_0xf9ae3d];return _0x53adaa;};'use strict';var client=require('../client');exports[_0x0cd6('0x0')]=function(_0x5d9b38){return client['Request'](_0x0cd6('0x1'),{'body':_0x5d9b38,'log':_0x0cd6('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index c008dc3..8c27990 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 _0xd6c8=['online','getMailQueues','Request','GetMailQueue','name','timeout','strategy','User','Agents'];(function(_0x37f89c,_0x49a16c){var _0x4ebeac=function(_0x3147a7){while(--_0x3147a7){_0x37f89c['push'](_0x37f89c['shift']());}};_0x4ebeac(++_0x49a16c);}(_0xd6c8,0xbe));var _0x8d6c=function(_0x419550,_0x15cdf1){_0x419550=_0x419550-0x0;var _0x55f9ef=_0xd6c8[_0x419550];return _0x55f9ef;};'use strict';var client=require('../client');exports[_0x8d6c('0x0')]=function(){return function(){return client[_0x8d6c('0x1')](_0x8d6c('0x2'),{'options':{'raw':![],'attributes':['id',_0x8d6c('0x3'),_0x8d6c('0x4'),_0x8d6c('0x5')],'include':[{'model':_0x8d6c('0x6'),'as':_0x8d6c('0x7'),'attributes':['id',_0x8d6c('0x3'),_0x8d6c('0x8'),'mailPause']}]},'log':_0x8d6c('0x0')});};}; \ No newline at end of file +var _0xf6c9=['getMailQueues','Request','name','timeout','strategy','User','Agents','online','mailPause','../client'];(function(_0x358fd3,_0x4a9c44){var _0x1ad0f3=function(_0x3c098d){while(--_0x3c098d){_0x358fd3['push'](_0x358fd3['shift']());}};_0x1ad0f3(++_0x4a9c44);}(_0xf6c9,0x10d));var _0x9f6c=function(_0x338ca2,_0x5ccdc2){_0x338ca2=_0x338ca2-0x0;var _0x46e84d=_0xf6c9[_0x338ca2];return _0x46e84d;};'use strict';var client=require(_0x9f6c('0x0'));exports[_0x9f6c('0x1')]=function(){return function(){return client[_0x9f6c('0x2')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x9f6c('0x3'),_0x9f6c('0x4'),_0x9f6c('0x5')],'include':[{'model':_0x9f6c('0x6'),'as':_0x9f6c('0x7'),'attributes':['id',_0x9f6c('0x3'),_0x9f6c('0x8'),_0x9f6c('0x9')]}]},'log':_0x9f6c('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 01d7d8e..5670221 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 _0x16ce=['create','Request','CreateMailQueueReport','update','UpdateMailQueueReport','DESC','../client'];(function(_0x121aa9,_0x467de2){var _0x3caa06=function(_0x2f48df){while(--_0x2f48df){_0x121aa9['push'](_0x121aa9['shift']());}};_0x3caa06(++_0x467de2);}(_0x16ce,0x1a3));var _0xe16c=function(_0x189195,_0x3a8510){_0x189195=_0x189195-0x0;var _0x327e5d=_0x16ce[_0x189195];return _0x327e5d;};'use strict';var client=require(_0xe16c('0x0'));exports[_0xe16c('0x1')]=function(_0x2099f8){return client[_0xe16c('0x2')]('CreateMailQueueReport',{'body':_0x2099f8,'log':_0xe16c('0x3')});};exports[_0xe16c('0x4')]=function(_0x3460f4,_0x2fb6f7){return client[_0xe16c('0x2')](_0xe16c('0x5'),{'body':_0x2fb6f7,'options':{'where':{'uniqueid':_0x3460f4},'order':[['id',_0xe16c('0x6')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file +var _0xa729=['UpdateMailQueueReport','../client','create','CreateMailQueueReport','DESC'];(function(_0x4576c9,_0x43e213){var _0x2c8bd5=function(_0x243736){while(--_0x243736){_0x4576c9['push'](_0x4576c9['shift']());}};_0x2c8bd5(++_0x43e213);}(_0xa729,0x119));var _0x9a72=function(_0x101383,_0x5bd543){_0x101383=_0x101383-0x0;var _0x46cfe9=_0xa729[_0x101383];return _0x46cfe9;};'use strict';var client=require(_0x9a72('0x0'));exports[_0x9a72('0x1')]=function(_0x5b1aa8){return client['Request'](_0x9a72('0x2'),{'body':_0x5b1aa8,'log':_0x9a72('0x2')});};exports['update']=function(_0x1c926e,_0x5779e6){return client['Request']('UpdateMailQueueReport',{'body':_0x5779e6,'options':{'where':{'uniqueid':_0x1c926e},'order':[['id',_0x9a72('0x3')]],'limit':0x1},'log':_0x9a72('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 81ffbf4..86ed11c 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 _0x3f0a=['addTags','Request','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','UpdateOpenchannelInteraction','updateOpenchannelInteraction'];(function(_0x179775,_0x403b57){var _0x17ee82=function(_0xea75ea){while(--_0xea75ea){_0x179775['push'](_0x179775['shift']());}};_0x17ee82(++_0x403b57);}(_0x3f0a,0x12a));var _0xa3f0=function(_0x54058f,_0x4f44a6){_0x54058f=_0x54058f-0x0;var _0x5ccab4=_0x3f0a[_0x54058f];return _0x5ccab4;};'use strict';var client=require('../client');exports['update']=function(_0x2d82c5,_0x1094ae){return client['Request'](_0xa3f0('0x0'),{'body':_0x1094ae,'options':{'where':{'id':_0x2d82c5}},'log':_0xa3f0('0x1')});};exports[_0xa3f0('0x2')]=function(_0x508c55,_0x463f59){return client[_0xa3f0('0x3')](_0xa3f0('0x4'),{'body':_0x463f59,'options':{'where':{'id':_0x508c55}},'log':_0xa3f0('0x5')});}; \ No newline at end of file +var _0xe127=['update','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','Request','AddTagsToOpenchannelInteraction','../client'];(function(_0x279c27,_0x23ac03){var _0x11048a=function(_0x12a2e6){while(--_0x12a2e6){_0x279c27['push'](_0x279c27['shift']());}};_0x11048a(++_0x23ac03);}(_0xe127,0x1e9));var _0x7e12=function(_0x332e76,_0x1c4011){_0x332e76=_0x332e76-0x0;var _0x290949=_0xe127[_0x332e76];return _0x290949;};'use strict';var client=require(_0x7e12('0x0'));exports[_0x7e12('0x1')]=function(_0x5763c0,_0x2c3494){return client['Request'](_0x7e12('0x2'),{'body':_0x2c3494,'options':{'where':{'id':_0x5763c0}},'log':_0x7e12('0x3')});};exports[_0x7e12('0x4')]=function(_0x20b4ba,_0x351482){return client[_0x7e12('0x5')](_0x7e12('0x6'),{'body':_0x351482,'options':{'where':{'id':_0x20b4ba}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 529a622..f4482df 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 _0x695a=['../client','create','Request','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x1e79d8,_0x3f2aa7){var _0x3c2e1c=function(_0xd2ccd4){while(--_0xd2ccd4){_0x1e79d8['push'](_0x1e79d8['shift']());}};_0x3c2e1c(++_0x3f2aa7);}(_0x695a,0x1ef));var _0xa695=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x695a[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xa695('0x0'));exports[_0xa695('0x1')]=function(_0x1a253b){return client[_0xa695('0x2')](_0xa695('0x3'),{'body':_0x1a253b,'log':_0xa695('0x4')});}; \ No newline at end of file +var _0xcfe0=['Request','createOpenchannelMessage','../client','create'];(function(_0x122c49,_0x452163){var _0x543888=function(_0x2b9d38){while(--_0x2b9d38){_0x122c49['push'](_0x122c49['shift']());}};_0x543888(++_0x452163);}(_0xcfe0,0x156));var _0x0cfe=function(_0x417bcc,_0x238d22){_0x417bcc=_0x417bcc-0x0;var _0x2e7fb3=_0xcfe0[_0x417bcc];return _0x2e7fb3;};'use strict';var client=require(_0x0cfe('0x0'));exports[_0x0cfe('0x1')]=function(_0x11590a){return client[_0x0cfe('0x2')]('CreateOpenchannelMessage',{'body':_0x11590a,'log':_0x0cfe('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 8aefc12..d72f8db 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 _0x02c0=['getOpenchannelQueues','Request','GetOpenchannelQueue','name','strategy','User','Agents','online'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0x02c0,0x71));var _0x002c=function(_0x23cc98,_0x46c9ad){_0x23cc98=_0x23cc98-0x0;var _0x2b3a55=_0x02c0[_0x23cc98];return _0x2b3a55;};'use strict';var client=require('../client');exports['getOpenchannelQueues']=function(){return function(){return client[_0x002c('0x0')](_0x002c('0x1'),{'options':{'raw':![],'attributes':['id',_0x002c('0x2'),'timeout',_0x002c('0x3')],'include':[{'model':_0x002c('0x4'),'as':_0x002c('0x5'),'attributes':['id',_0x002c('0x2'),_0x002c('0x6'),'openchannelPause']}]},'log':_0x002c('0x7')});};}; \ No newline at end of file +var _0x3662=['openchannelPause','../client','getOpenchannelQueues','Request','name','timeout','strategy','User','Agents','online'];(function(_0x183cd6,_0xe4ece8){var _0x500cb9=function(_0x290b84){while(--_0x290b84){_0x183cd6['push'](_0x183cd6['shift']());}};_0x500cb9(++_0xe4ece8);}(_0x3662,0xfb));var _0x2366=function(_0x59dbc6,_0x1dd9c3){_0x59dbc6=_0x59dbc6-0x0;var _0xe15a6d=_0x3662[_0x59dbc6];return _0xe15a6d;};'use strict';var client=require(_0x2366('0x0'));exports[_0x2366('0x1')]=function(){return function(){return client[_0x2366('0x2')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0x2366('0x3'),_0x2366('0x4'),_0x2366('0x5')],'include':[{'model':_0x2366('0x6'),'as':_0x2366('0x7'),'attributes':['id',_0x2366('0x3'),_0x2366('0x8'),_0x2366('0x9')]}]},'log':_0x2366('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index e17d246..d0ffd06 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 _0xcadc=['UpdateOpenchannelQueueReport','DESC','create','Request','CreateOpenchannelQueueReport','update'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xcadc,0x1a6));var _0xccad=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xcadc[_0x20a584];return _0x4b41a8;};'use strict';var client=require('../client');exports[_0xccad('0x0')]=function(_0x1b8402){return client[_0xccad('0x1')](_0xccad('0x2'),{'body':_0x1b8402,'log':'CreateOpenchannelQueueReport'});};exports[_0xccad('0x3')]=function(_0xf9887b,_0x1c36d){return client[_0xccad('0x1')](_0xccad('0x4'),{'body':_0x1c36d,'options':{'where':{'uniqueid':_0xf9887b},'order':[['id',_0xccad('0x5')]],'limit':0x1},'log':_0xccad('0x4')});}; \ No newline at end of file +var _0x403c=['DESC','../client','create','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport'];(function(_0x3bd401,_0x59f206){var _0xd5f52f=function(_0x12d248){while(--_0x12d248){_0x3bd401['push'](_0x3bd401['shift']());}};_0xd5f52f(++_0x59f206);}(_0x403c,0x112));var _0xc403=function(_0x31bbd9,_0x1db86f){_0x31bbd9=_0x31bbd9-0x0;var _0x680822=_0x403c[_0x31bbd9];return _0x680822;};'use strict';var client=require(_0xc403('0x0'));exports[_0xc403('0x1')]=function(_0x6fdfd7){return client[_0xc403('0x2')](_0xc403('0x3'),{'body':_0x6fdfd7,'log':_0xc403('0x3')});};exports[_0xc403('0x4')]=function(_0x4d8141,_0xab42e4){return client[_0xc403('0x2')](_0xc403('0x5'),{'body':_0xab42e4,'options':{'where':{'uniqueid':_0x4d8141},'order':[['id',_0xc403('0x6')]],'limit':0x1},'log':_0xc403('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index d414014..1d9aab7 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 _0xba33=['addTagsToSmsInteraction','../client','update','UpdateSmsInteraction','updateSmsInteraction','addTags','Request','AddTagsToSmsInteraction'];(function(_0x90e3d5,_0x3eea2b){var _0x5c2252=function(_0x3c7a2e){while(--_0x3c7a2e){_0x90e3d5['push'](_0x90e3d5['shift']());}};_0x5c2252(++_0x3eea2b);}(_0xba33,0xf1));var _0x3ba3=function(_0xeb7de0,_0x9522a6){_0xeb7de0=_0xeb7de0-0x0;var _0x27390a=_0xba33[_0xeb7de0];return _0x27390a;};'use strict';var client=require(_0x3ba3('0x0'));exports[_0x3ba3('0x1')]=function(_0x385c61,_0x45f974){return client['Request'](_0x3ba3('0x2'),{'body':_0x45f974,'options':{'where':{'id':_0x385c61}},'log':_0x3ba3('0x3')});};exports[_0x3ba3('0x4')]=function(_0x77ca36,_0x2658bf){return client[_0x3ba3('0x5')](_0x3ba3('0x6'),{'body':_0x2658bf,'options':{'where':{'id':_0x77ca36}},'log':_0x3ba3('0x7')});}; \ No newline at end of file +var _0x6fad=['../client','update','UpdateSmsInteraction','addTags','Request','addTagsToSmsInteraction'];(function(_0x205562,_0x1695a5){var _0x32e766=function(_0x38aa4e){while(--_0x38aa4e){_0x205562['push'](_0x205562['shift']());}};_0x32e766(++_0x1695a5);}(_0x6fad,0x174));var _0xd6fa=function(_0xb113d7,_0x2fc306){_0xb113d7=_0xb113d7-0x0;var _0xd5a08d=_0x6fad[_0xb113d7];return _0xd5a08d;};'use strict';var client=require(_0xd6fa('0x0'));exports[_0xd6fa('0x1')]=function(_0x20c9f5,_0x44c709){return client['Request'](_0xd6fa('0x2'),{'body':_0x44c709,'options':{'where':{'id':_0x20c9f5}},'log':'updateSmsInteraction'});};exports[_0xd6fa('0x3')]=function(_0x48f433,_0x3e76d0){return client[_0xd6fa('0x4')]('AddTagsToSmsInteraction',{'body':_0x3e76d0,'options':{'where':{'id':_0x48f433}},'log':_0xd6fa('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index d202ed5..148a2e0 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 _0x2321=['CreateSmsMessage','createSmsMessage','create'];(function(_0x3ec9ca,_0xacfb9){var _0x2ceef5=function(_0x29c8f3){while(--_0x29c8f3){_0x3ec9ca['push'](_0x3ec9ca['shift']());}};_0x2ceef5(++_0xacfb9);}(_0x2321,0x12e));var _0x1232=function(_0x5f0501,_0x19196e){_0x5f0501=_0x5f0501-0x0;var _0x3c2c45=_0x2321[_0x5f0501];return _0x3c2c45;};'use strict';var client=require('../client');exports[_0x1232('0x0')]=function(_0x49fee9){return client['Request'](_0x1232('0x1'),{'body':_0x49fee9,'log':_0x1232('0x2')});}; \ No newline at end of file +var _0x26c4=['create'];(function(_0x3959da,_0x598a6b){var _0x4a1db9=function(_0x262716){while(--_0x262716){_0x3959da['push'](_0x3959da['shift']());}};_0x4a1db9(++_0x598a6b);}(_0x26c4,0x1eb));var _0x426c=function(_0x602ee5,_0x42c947){_0x602ee5=_0x602ee5-0x0;var _0x2892a9=_0x26c4[_0x602ee5];return _0x2892a9;};'use strict';var client=require('../client');exports[_0x426c('0x0')]=function(_0x44ccbf){return client['Request']('CreateSmsMessage',{'body':_0x44ccbf,'log':'createSmsMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 2d9be81..44e8de7 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','Agents','online','smsPause'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'attributes':['id',_0x3071('0x2'),_0x3071('0x3'),_0x3071('0x4')],'include':[{'model':'User','as':_0x3071('0x5'),'attributes':['id',_0x3071('0x2'),_0x3071('0x6'),_0x3071('0x7')]}]},'log':_0x3071('0x8')});};}; \ No newline at end of file +var _0xb7e7=['online','../client','Request','name','strategy','Agents'];(function(_0x4ff0df,_0xcf9417){var _0x236925=function(_0x3d12c1){while(--_0x3d12c1){_0x4ff0df['push'](_0x4ff0df['shift']());}};_0x236925(++_0xcf9417);}(_0xb7e7,0x121));var _0x7b7e=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0xb7e7[_0x278e3c];return _0x3e2d9b;};'use strict';var client=require(_0x7b7e('0x0'));exports['getSmsQueues']=function(){return function(){return client[_0x7b7e('0x1')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x7b7e('0x2'),'timeout',_0x7b7e('0x3')],'include':[{'model':'User','as':_0x7b7e('0x4'),'attributes':['id',_0x7b7e('0x2'),_0x7b7e('0x5'),'smsPause']}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 380d286..f184fa4 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 _0x55ca=['../client','create','CreateSmsQueueReport','update','Request','UpdateSmsQueueReport','DESC'];(function(_0x172709,_0x4baec7){var _0x38d9b9=function(_0x205bae){while(--_0x205bae){_0x172709['push'](_0x172709['shift']());}};_0x38d9b9(++_0x4baec7);}(_0x55ca,0x126));var _0xa55c=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0x55ca[_0x47fd36];return _0x21a0fc;};'use strict';var client=require(_0xa55c('0x0'));exports[_0xa55c('0x1')]=function(_0x4e78b4){return client['Request']('CreateSmsQueueReport',{'body':_0x4e78b4,'log':_0xa55c('0x2')});};exports[_0xa55c('0x3')]=function(_0x5dc716,_0x3b478a){return client[_0xa55c('0x4')](_0xa55c('0x5'),{'body':_0x3b478a,'options':{'where':{'uniqueid':_0x5dc716},'order':[['id',_0xa55c('0x6')]],'limit':0x1},'log':_0xa55c('0x5')});}; \ No newline at end of file +var _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x33fcbb,_0x291d0f){var _0x2efe40=function(_0x2e9442){while(--_0x2e9442){_0x33fcbb['push'](_0x33fcbb['shift']());}};_0x2efe40(++_0x291d0f);}(_0x70e0,0x17b));var _0x070e=function(_0x1b1b3b,_0x5ad512){_0x1b1b3b=_0x1b1b3b-0x0;var _0x381dce=_0x70e0[_0x1b1b3b];return _0x381dce;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(_0x198c2e){return client['Request']('CreateSmsQueueReport',{'body':_0x198c2e,'log':_0x070e('0x2')});};exports[_0x070e('0x3')]=function(_0x277d32,_0x2593e5){return client['Request'](_0x070e('0x4'),{'body':_0x2593e5,'options':{'where':{'uniqueid':_0x277d32},'order':[['id','DESC']],'limit':0x1},'log':_0x070e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 0274cf0..af025dc 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(_0x5f4265,_0x17bc28){var _0x5aff20=function(_0x26b65a){while(--_0x26b65a){_0x5f4265['push'](_0x5f4265['shift']());}};_0x5aff20(++_0x17bc28);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'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(_0x22639e,_0xcbfcc){var _0x43f1ca=function(_0x223ebe){while(--_0x223ebe){_0x22639e['push'](_0x22639e['shift']());}};_0x43f1ca(++_0xcbfcc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index b279a0a..cc28352 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 _0xadb5=['Request','UpdateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','update'];(function(_0x46f5b,_0x2b5c71){var _0xde8e82=function(_0x51fd9b){while(--_0x51fd9b){_0x46f5b['push'](_0x46f5b['shift']());}};_0xde8e82(++_0x2b5c71);}(_0xadb5,0xad));var _0x5adb=function(_0x1133ca,_0x503f84){_0x1133ca=_0x1133ca-0x0;var _0x3839f3=_0xadb5[_0x1133ca];return _0x3839f3;};'use strict';var client=require('../client');exports[_0x5adb('0x0')]=function(_0x49fc17,_0x3d6340){return client[_0x5adb('0x1')](_0x5adb('0x2'),{'body':_0x3d6340,'options':{'where':{'id':_0x49fc17}},'log':'updateWhatsappInteraction'});};exports[_0x5adb('0x3')]=function(_0x31457,_0x2e3ef4){return client['Request'](_0x5adb('0x4'),{'body':_0x2e3ef4,'options':{'where':{'id':_0x31457}},'log':_0x5adb('0x5')});}; \ No newline at end of file +var _0x565f=['update','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags'];(function(_0x9b6521,_0x3f09eb){var _0x13fdce=function(_0x2552a8){while(--_0x2552a8){_0x9b6521['push'](_0x9b6521['shift']());}};_0x13fdce(++_0x3f09eb);}(_0x565f,0x68));var _0xf565=function(_0x135ea6,_0x539e9e){_0x135ea6=_0x135ea6-0x0;var _0x53f2a4=_0x565f[_0x135ea6];return _0x53f2a4;};'use strict';var client=require('../client');exports[_0xf565('0x0')]=function(_0x645987,_0x1d8f31){return client['Request'](_0xf565('0x1'),{'body':_0x1d8f31,'options':{'where':{'id':_0x645987}},'log':_0xf565('0x2')});};exports[_0xf565('0x3')]=function(_0x44400f,_0x35e885){return client['Request']('AddTagsToWhatsappInteraction',{'body':_0x35e885,'options':{'where':{'id':_0x44400f}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 86eb863..0156397 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 _0xc33d=['createWhatsappMessage','../client','create','Request','CreateWhatsappMessage'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xc33d,0x1b4));var _0xdc33=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc33d[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xdc33('0x0'));exports[_0xdc33('0x1')]=function(_0x4f7390){return client[_0xdc33('0x2')](_0xdc33('0x3'),{'body':_0x4f7390,'log':_0xdc33('0x4')});}; \ No newline at end of file +var _0x8840=['create','CreateWhatsappMessage','createWhatsappMessage','../client'];(function(_0x4854d4,_0x5b00aa){var _0x3b209c=function(_0x384570){while(--_0x384570){_0x4854d4['push'](_0x4854d4['shift']());}};_0x3b209c(++_0x5b00aa);}(_0x8840,0x1b3));var _0x0884=function(_0x317cc5,_0x3b6179){_0x317cc5=_0x317cc5-0x0;var _0x44fe81=_0x8840[_0x317cc5];return _0x44fe81;};'use strict';var client=require(_0x0884('0x0'));exports[_0x0884('0x1')]=function(_0x3f2fcc){return client['Request'](_0x0884('0x2'),{'body':_0x3f2fcc,'log':_0x0884('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index cd2fc1a..ca85fd2 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 _0x8a0a=['GetWhatsappQueue','name','strategy','User','Agents','whatsappPause','getWhatsappQueues','Request'];(function(_0x23b655,_0x4feb2b){var _0x364b32=function(_0x4e41ac){while(--_0x4e41ac){_0x23b655['push'](_0x23b655['shift']());}};_0x364b32(++_0x4feb2b);}(_0x8a0a,0xd7));var _0xa8a0=function(_0x18568b,_0x3a7112){_0x18568b=_0x18568b-0x0;var _0x330a24=_0x8a0a[_0x18568b];return _0x330a24;};'use strict';var client=require('../client');exports['getWhatsappQueues']=function(){return function(){return client[_0xa8a0('0x0')](_0xa8a0('0x1'),{'options':{'raw':![],'attributes':['id',_0xa8a0('0x2'),'timeout',_0xa8a0('0x3')],'include':[{'model':_0xa8a0('0x4'),'as':_0xa8a0('0x5'),'attributes':['id',_0xa8a0('0x2'),'online',_0xa8a0('0x6')]}]},'log':_0xa8a0('0x7')});};}; \ No newline at end of file +var _0xa5bf=['whatsappPause','../client','getWhatsappQueues','GetWhatsappQueue','name','timeout','User','Agents','online'];(function(_0x30a5cb,_0x34b705){var _0x202e1b=function(_0x63cec8){while(--_0x63cec8){_0x30a5cb['push'](_0x30a5cb['shift']());}};_0x202e1b(++_0x34b705);}(_0xa5bf,0xa3));var _0xfa5b=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xa5bf[_0x1035c1];return _0x308d67;};'use strict';var client=require(_0xfa5b('0x0'));exports[_0xfa5b('0x1')]=function(){return function(){return client['Request'](_0xfa5b('0x2'),{'options':{'raw':![],'attributes':['id',_0xfa5b('0x3'),_0xfa5b('0x4'),'strategy'],'include':[{'model':_0xfa5b('0x5'),'as':_0xfa5b('0x6'),'attributes':['id','name',_0xfa5b('0x7'),_0xfa5b('0x8')]}]},'log':_0xfa5b('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 64ace92..e2d47fa 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 _0x5feb=['update','UpdateWhatsappQueueReport','DESC','../client','create','Request','CreateWhatsappQueueReport'];(function(_0x136a13,_0x37770c){var _0x39e015=function(_0x137763){while(--_0x137763){_0x136a13['push'](_0x136a13['shift']());}};_0x39e015(++_0x37770c);}(_0x5feb,0xc0));var _0xb5fe=function(_0x5effcf,_0x47af59){_0x5effcf=_0x5effcf-0x0;var _0x4d123c=_0x5feb[_0x5effcf];return _0x4d123c;};'use strict';var client=require(_0xb5fe('0x0'));exports[_0xb5fe('0x1')]=function(_0x4201d9){return client[_0xb5fe('0x2')](_0xb5fe('0x3'),{'body':_0x4201d9,'log':'CreateWhatsappQueueReport'});};exports[_0xb5fe('0x4')]=function(_0x46d526,_0x593cea){return client[_0xb5fe('0x2')](_0xb5fe('0x5'),{'body':_0x593cea,'options':{'where':{'uniqueid':_0x46d526},'order':[['id',_0xb5fe('0x6')]],'limit':0x1},'log':_0xb5fe('0x5')});}; \ No newline at end of file +var _0x50e3=['UpdateWhatsappQueueReport','DESC','../client','create','Request','CreateWhatsappQueueReport'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x50e3,0x68));var _0x350e=function(_0x264b35,_0x45de4c){_0x264b35=_0x264b35-0x0;var _0x3ff9ca=_0x50e3[_0x264b35];return _0x3ff9ca;};'use strict';var client=require(_0x350e('0x0'));exports[_0x350e('0x1')]=function(_0x52ee7f){return client[_0x350e('0x2')]('CreateWhatsappQueueReport',{'body':_0x52ee7f,'log':_0x350e('0x3')});};exports['update']=function(_0x5da4b5,_0x48d393){return client[_0x350e('0x2')](_0x350e('0x4'),{'body':_0x48d393,'options':{'where':{'uniqueid':_0x5da4b5},'order':[['id',_0x350e('0x5')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index e28feec..d15ba40 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 _0x5e3a=['close','info','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','routing','./strategy','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','length','error','[%s][AGENT]\x20%s','map','message','join','stop','agents','timeout','createQueue','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x5e3a,0x105));var _0xa5e3=function(_0x5a225e,_0x425382){_0x5a225e=_0x5a225e-0x0;var _0x21c708=_0x5e3a[_0x5a225e];return _0x21c708;};'use strict';var schema=require(_0xa5e3('0x0'));var _=require(_0xa5e3('0x1'));var util=require(_0xa5e3('0x2'));var seqqueue=require(_0xa5e3('0x3'));var logger=require('../../../../config/logger')(_0xa5e3('0x4'));var strategy=require(_0xa5e3('0x5'));var queue=schema({'name':{'type':'string','required':!![],'message':_0xa5e3('0x6')},'timeout':{'type':'number','message':_0xa5e3('0x7')}});function writeLog(_0xba2e94,_0x1827d4,_0x2548ff){return logger['info'](util[_0xa5e3('0x8')](_0xa5e3('0x9'),_0xba2e94,_0x1827d4[_0xa5e3('0xa')],_0x2548ff));}function handleFindAgent(_0x445b6f){return function(_0x191f57){return _0x191f57['name'][_0xa5e3('0xb')]()===_0x445b6f[_0xa5e3('0xb')]();};}exports['consequence']=function(_0x45e7ee,_0x2c439f,_0x5632b7,_0x4b7f2e){return function(_0xaf4c49){try{var _0x3187bd={'name':_0x2c439f[0x0],'timeout':_0x2c439f[0x1]};var _0x2a7ca9=queue[_0xa5e3('0x0')](_0x3187bd,{'typecast':!![]});if(_0x2a7ca9[_0xa5e3('0xc')]){logger[_0xa5e3('0xd')](_0xa5e3('0xe'),_0x45e7ee,_[_0xa5e3('0xf')](_0x2a7ca9,_0xa5e3('0x10'))[_0xa5e3('0x11')](',\x20'));_0xaf4c49[_0xa5e3('0x12')]();}else{var _0x4883ad=_['find'](_0x5632b7[_0xa5e3('0x13')],handleFindAgent(_0x3187bd[_0xa5e3('0xa')]));if(_0x4883ad){var _0x4156c2=(_0x3187bd[_0xa5e3('0x14')]||0xa)*0x3e8;var _0x1c7b5c,_0x5b4c4d;var _0x427455=seqqueue[_0xa5e3('0x15')](_0x4156c2);_0x427455['id']=_0x45e7ee;_0x427455['atimeout']=_0x4156c2;_0x427455[_0xa5e3('0x16')]=_0x4b7f2e[_0xa5e3('0x16')];writeLog(_0x45e7ee,_0x4883ad,util['format'](_0xa5e3('0x17'),_0x4156c2));_0x5632b7[_0xa5e3('0x18')][_0x45e7ee]['on'](_0xa5e3('0x19'),function(){logger['info'](_0xa5e3('0x1a'),_0x45e7ee);clearTimeout(_0x5b4c4d);_0x5b4c4d=undefined;_0x427455[_0xa5e3('0x1b')]();if(_0x5632b7[_0xa5e3('0x18')][_0x45e7ee]){delete _0x5632b7[_0xa5e3('0x18')][_0x45e7ee];}_0xaf4c49[_0xa5e3('0x12')]();});_0x5632b7[_0xa5e3('0x18')][_0x45e7ee]['on']('complete',function(){if(_0x5632b7['rules'][_0x45e7ee]){delete _0x5632b7[_0xa5e3('0x18')][_0x45e7ee];}});_0x5b4c4d=setTimeout(function(){logger[_0xa5e3('0x1c')](_0xa5e3('0x1d'),_0x45e7ee);clearTimeout(_0x5b4c4d);_0x427455[_0xa5e3('0x1b')]();_0xaf4c49[_0xa5e3('0x1e')]();},_0x4156c2);strategy[_0xa5e3('0x1f')](_0x427455,_0x4883ad,_0x5632b7,_0x4b7f2e);}else{logger[_0xa5e3('0xd')](_0xa5e3('0x20'),_0x45e7ee,_0x3187bd[_0xa5e3('0xa')]);_0xaf4c49[_0xa5e3('0x12')]();}}}catch(_0x22d3f0){console[_0xa5e3('0x21')](_0x22d3f0);logger[_0xa5e3('0xd')](_0xa5e3('0x22'),_0x45e7ee,_0x22d3f0[_0xa5e3('0x23')]);_0xaf4c49[_0xa5e3('0x12')]();}};}; \ No newline at end of file +var _0xea33=['next','error','log','validate','util','seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','info','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','[%s][AGENT]\x20%s','map','find','agents','timeout','atimeout','channel','format','START:%s','rules','end','close','stop','complete'];(function(_0x1ee2f8,_0x51c949){var _0x60a464=function(_0x48137f){while(--_0x48137f){_0x1ee2f8['push'](_0x1ee2f8['shift']());}};_0x60a464(++_0x51c949);}(_0xea33,0x1c3));var _0x3ea3=function(_0x146837,_0x2aa6a2){_0x146837=_0x146837-0x0;var _0x3d7e60=_0xea33[_0x146837];return _0x3d7e60;};'use strict';var schema=require(_0x3ea3('0x0'));var _=require('lodash');var util=require(_0x3ea3('0x1'));var seqqueue=require(_0x3ea3('0x2'));var logger=require(_0x3ea3('0x3'))(_0x3ea3('0x4'));var strategy=require(_0x3ea3('0x5'));var queue=schema({'name':{'type':_0x3ea3('0x6'),'required':!![],'message':_0x3ea3('0x7')},'timeout':{'type':_0x3ea3('0x8'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x60d543,_0x57be73,_0x4a4783){return logger[_0x3ea3('0x9')](util['format'](_0x3ea3('0xa'),_0x60d543,_0x57be73[_0x3ea3('0xb')],_0x4a4783));}function handleFindAgent(_0x236b91){return function(_0x142238){return _0x142238[_0x3ea3('0xb')][_0x3ea3('0xc')]()===_0x236b91[_0x3ea3('0xc')]();};}exports[_0x3ea3('0xd')]=function(_0x3cc40a,_0x54e46d,_0x5b1129,_0x341645){return function(_0x1afb1f){try{var _0x3e35a1={'name':_0x54e46d[0x0],'timeout':_0x54e46d[0x1]};var _0x47b30a=queue[_0x3ea3('0x0')](_0x3e35a1,{'typecast':!![]});if(_0x47b30a[_0x3ea3('0xe')]){logger['error'](_0x3ea3('0xf'),_0x3cc40a,_[_0x3ea3('0x10')](_0x47b30a,'message')['join'](',\x20'));_0x1afb1f['stop']();}else{var _0x2025e2=_[_0x3ea3('0x11')](_0x5b1129[_0x3ea3('0x12')],handleFindAgent(_0x3e35a1[_0x3ea3('0xb')]));if(_0x2025e2){var _0x1c0f24=(_0x3e35a1[_0x3ea3('0x13')]||0xa)*0x3e8;var _0x1dab2a,_0xa93939;var _0x5684f4=seqqueue['createQueue'](_0x1c0f24);_0x5684f4['id']=_0x3cc40a;_0x5684f4[_0x3ea3('0x14')]=_0x1c0f24;_0x5684f4[_0x3ea3('0x15')]=_0x341645[_0x3ea3('0x15')];writeLog(_0x3cc40a,_0x2025e2,util[_0x3ea3('0x16')](_0x3ea3('0x17'),_0x1c0f24));_0x5b1129[_0x3ea3('0x18')][_0x3cc40a]['on'](_0x3ea3('0x19'),function(){logger['info']('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x3cc40a);clearTimeout(_0xa93939);_0xa93939=undefined;_0x5684f4[_0x3ea3('0x1a')]();if(_0x5b1129['rules'][_0x3cc40a]){delete _0x5b1129[_0x3ea3('0x18')][_0x3cc40a];}_0x1afb1f[_0x3ea3('0x1b')]();});_0x5b1129[_0x3ea3('0x18')][_0x3cc40a]['on'](_0x3ea3('0x1c'),function(){if(_0x5b1129[_0x3ea3('0x18')][_0x3cc40a]){delete _0x5b1129['rules'][_0x3cc40a];}});_0xa93939=setTimeout(function(){logger[_0x3ea3('0x9')]('[%s][AGENT]\x20ROUTING\x20END',_0x3cc40a);clearTimeout(_0xa93939);_0x5684f4['close']();_0x1afb1f[_0x3ea3('0x1d')]();},_0x1c0f24);strategy['agent'](_0x5684f4,_0x2025e2,_0x5b1129,_0x341645);}else{logger[_0x3ea3('0x1e')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x3cc40a,_0x3e35a1[_0x3ea3('0xb')]);_0x1afb1f[_0x3ea3('0x1b')]();}}}catch(_0x49d5f6){console[_0x3ea3('0x1f')](_0x49d5f6);logger[_0x3ea3('0x1e')]('[%s][QUEUE]\x20%s',_0x3cc40a,_0x49d5f6['stack']);_0x1afb1f[_0x3ea3('0x1b')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index b9b0896..670a1d2 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 _0x0bff=['isEmpty','body','getMustacheRender','Message','create','info','catch','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','$LATEST','toString','postText','message','amazonlex','providerName','providerResponse','then','dialogState','error','moment','aws-sdk','./utils','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','whatsapp','phone','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x0bff,0x12f));var _0xf0bf=function(_0x3f0694,_0x541e77){_0x3f0694=_0x3f0694-0x0;var _0x3e9642=_0x0bff[_0x3f0694];return _0x3e9642;};'use strict';var _=require('lodash');var moment=require(_0xf0bf('0x0'));var AWS=require(_0xf0bf('0x1'));var utils=require(_0xf0bf('0x2'));var logger=require(_0xf0bf('0x3'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xf0bf('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xf0bf('0x5')),'faxMessage':require(_0xf0bf('0x6')),'whatsappMessage':require(_0xf0bf('0x7'))};exports[_0xf0bf('0x8')]=function(_0x3cd1d6,_0x1a5b6){return function(_0x15ffad){try{if(!_[_0xf0bf('0x9')](this[_0xf0bf('0xa')]['UserId'])){logger['info'](_0xf0bf('0xb'),_0x3cd1d6,_0xf0bf('0xc'));return _0x15ffad[_0xf0bf('0xd')]();}var _0x332f16={'ContactId':this['contact']['id'],'sentAt':moment()[_0xf0bf('0xe')](_0xf0bf('0xf')),'direction':'out'};if(this[_0xf0bf('0x10')]===_0xf0bf('0x11')||this[_0xf0bf('0x10')]===_0xf0bf('0x12')){_0x332f16[_0xf0bf('0x13')]=this[_0xf0bf('0xa')][_0xf0bf('0x13')];}var _0x1ba3c9=this['channel'];if(_0x1ba3c9==='chat'){_0x332f16[_0xf0bf('0x14')]=this[_0xf0bf('0x15')]['id'];}else{_0x332f16[_[_0xf0bf('0x16')](_0x1ba3c9)+_0xf0bf('0x17')]=this[_0xf0bf('0x15')]['id'];}_0x332f16[_['upperFirst'](_0x1ba3c9)+_0xf0bf('0x18')]=this[_0xf0bf('0xa')]['id'];if(this[_0xf0bf('0xa')][_0xf0bf('0x19')]){var _0x4678a0=_0x1a5b6[0x4];if(!_[_0xf0bf('0x1a')](_0x4678a0)){_0x332f16[_0xf0bf('0x1b')]=utils[_0xf0bf('0x1c')](_0x4678a0,this);return rpc[_0x1ba3c9+_0xf0bf('0x1d')][_0xf0bf('0x1e')](_0x332f16)['then'](function(_0xd520b0){logger[_0xf0bf('0x1f')](_0xf0bf('0xb'),_0x3cd1d6,_0x332f16[_0xf0bf('0x1b')]);})[_0xf0bf('0x20')](function(_0x34e1ce){logger['error']('[%s][AMAZONLEX]\x20%s',_0x3cd1d6,JSON[_0xf0bf('0x21')](_0x34e1ce));})['finally'](function(){logger[_0xf0bf('0x1f')](_0xf0bf('0x22'),_0x3cd1d6);_0x15ffad[_0xf0bf('0x23')]();});}else{logger['info'](_0xf0bf('0x24'),_0x3cd1d6);_0x15ffad['stop']();}}else{var _0x170d29=this;var _0x5a3ab7=new AWS['LexRuntime']({'accessKeyId':_0x1a5b6[0x0],'secretAccessKey':_0x1a5b6[0x1],'region':_0x1a5b6[0x2]});var _0x34da5c={'botAlias':_0xf0bf('0x25'),'botName':_0x1a5b6[0x3],'inputText':this['message'][_0xf0bf('0x1b')],'userId':this[_0xf0bf('0x10')]+':'+this['interaction']['id'][_0xf0bf('0x26')]()};_0x5a3ab7[_0xf0bf('0x27')](_0x34da5c,function(_0xcbd1b9,_0x482ede){if(_0xcbd1b9){logger['error'](_0xf0bf('0xb'),_0x3cd1d6,_0xcbd1b9[_0xf0bf('0x28')]);_0x15ffad[_0xf0bf('0xd')]();}else if(_0x482ede&&_0x482ede[_0xf0bf('0x28')]){_0x170d29['body'][_0xf0bf('0x29')]=_0x482ede;_0x332f16[_0xf0bf('0x1b')]=_0x482ede[_0xf0bf('0x28')];_0x332f16[_0xf0bf('0x2a')]=_0xf0bf('0x29');_0x332f16[_0xf0bf('0x2b')]=JSON[_0xf0bf('0x21')](_0x482ede);return rpc[_0x1ba3c9+_0xf0bf('0x1d')][_0xf0bf('0x1e')](_0x332f16)[_0xf0bf('0x2c')](function(_0xb9b01){logger[_0xf0bf('0x1f')](_0xf0bf('0xb'),_0x3cd1d6,_0x332f16[_0xf0bf('0x1b')]);if(_0x482ede[_0xf0bf('0x2d')]=='Failed'){_0x15ffad[_0xf0bf('0xd')]();}else{_0x15ffad[_0xf0bf('0x23')]();}})[_0xf0bf('0x20')](function(_0x303474){logger[_0xf0bf('0x2e')](_0xf0bf('0xb'),_0x3cd1d6,JSON[_0xf0bf('0x21')](_0x303474));_0x15ffad['next']();});}else{_0x15ffad[_0xf0bf('0xd')]();}});}}catch(_0x73d2f){logger[_0xf0bf('0x2e')](_0xf0bf('0xb'),_0x3cd1d6,JSON['stringify'](_0x73d2f));_0x15ffad['stop']();}};}; \ No newline at end of file +var _0x316c=['message','body','amazonlex','providerName','providerResponse','stringify','then','Failed','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','channel','phone','chat','ChatWebsiteId','account','InteractionId','created','isEmpty','Message','create','catch','error','info','stop','$LATEST','postText'];(function(_0x4cf0b7,_0x560029){var _0x545f10=function(_0x993533){while(--_0x993533){_0x4cf0b7['push'](_0x4cf0b7['shift']());}};_0x545f10(++_0x560029);}(_0x316c,0x1a2));var _0xc316=function(_0x340eb2,_0x3184c6){_0x340eb2=_0x340eb2-0x0;var _0x1c0a6b=_0x316c[_0x340eb2];return _0x1c0a6b;};'use strict';var _=require('lodash');var moment=require(_0xc316('0x0'));var AWS=require(_0xc316('0x1'));var utils=require(_0xc316('0x2'));var logger=require(_0xc316('0x3'))(_0xc316('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xc316('0x5')),'mailMessage':require(_0xc316('0x6')),'smsMessage':require(_0xc316('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xc316('0x8'))};exports[_0xc316('0x9')]=function(_0x3a93b2,_0xf65cc9){return function(_0xf60c5a){try{if(!_[_0xc316('0xa')](this[_0xc316('0xb')]['UserId'])){logger['info'](_0xc316('0xc'),_0x3a93b2,_0xc316('0xd'));return _0xf60c5a[_0xc316('0xe')]();}var _0x1ad9d8={'ContactId':this['contact']['id'],'sentAt':moment()[_0xc316('0xf')](_0xc316('0x10')),'direction':'out'};if(this[_0xc316('0x11')]==='sms'||this['channel']==='whatsapp'){_0x1ad9d8['phone']=this['interaction'][_0xc316('0x12')];}var _0x5a0cc8=this[_0xc316('0x11')];if(_0x5a0cc8===_0xc316('0x13')){_0x1ad9d8[_0xc316('0x14')]=this[_0xc316('0x15')]['id'];}else{_0x1ad9d8[_['upperFirst'](_0x5a0cc8)+'AccountId']=this['account']['id'];}_0x1ad9d8[_['upperFirst'](_0x5a0cc8)+_0xc316('0x16')]=this[_0xc316('0xb')]['id'];if(this[_0xc316('0xb')][_0xc316('0x17')]){var _0x471021=_0xf65cc9[0x4];if(!_[_0xc316('0x18')](_0x471021)){_0x1ad9d8['body']=utils['getMustacheRender'](_0x471021,this);return rpc[_0x5a0cc8+_0xc316('0x19')][_0xc316('0x1a')](_0x1ad9d8)['then'](function(_0x283549){logger['info'](_0xc316('0xc'),_0x3a93b2,_0x1ad9d8['body']);})[_0xc316('0x1b')](function(_0x5b6e47){logger[_0xc316('0x1c')](_0xc316('0xc'),_0x3a93b2,JSON['stringify'](_0x5b6e47));})['finally'](function(){logger[_0xc316('0x1d')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x3a93b2);_0xf60c5a[_0xc316('0x1e')]();});}else{logger[_0xc316('0x1d')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x3a93b2);_0xf60c5a['stop']();}}else{var _0x3c8ebc=this;var _0x5da1d7=new AWS['LexRuntime']({'accessKeyId':_0xf65cc9[0x0],'secretAccessKey':_0xf65cc9[0x1],'region':_0xf65cc9[0x2]});var _0x4abd4={'botAlias':_0xc316('0x1f'),'botName':_0xf65cc9[0x3],'inputText':this['message']['body'],'userId':this[_0xc316('0x11')]+':'+this['interaction']['id']['toString']()};_0x5da1d7[_0xc316('0x20')](_0x4abd4,function(_0x138a5c,_0x5abfde){if(_0x138a5c){logger[_0xc316('0x1c')](_0xc316('0xc'),_0x3a93b2,_0x138a5c[_0xc316('0x21')]);_0xf60c5a[_0xc316('0xe')]();}else if(_0x5abfde&&_0x5abfde[_0xc316('0x21')]){_0x3c8ebc[_0xc316('0x22')][_0xc316('0x23')]=_0x5abfde;_0x1ad9d8[_0xc316('0x22')]=_0x5abfde[_0xc316('0x21')];_0x1ad9d8[_0xc316('0x24')]=_0xc316('0x23');_0x1ad9d8[_0xc316('0x25')]=JSON[_0xc316('0x26')](_0x5abfde);return rpc[_0x5a0cc8+_0xc316('0x19')][_0xc316('0x1a')](_0x1ad9d8)[_0xc316('0x27')](function(_0x28ddc3){logger[_0xc316('0x1d')](_0xc316('0xc'),_0x3a93b2,_0x1ad9d8[_0xc316('0x22')]);if(_0x5abfde['dialogState']==_0xc316('0x28')){_0xf60c5a[_0xc316('0xe')]();}else{_0xf60c5a[_0xc316('0x1e')]();}})[_0xc316('0x1b')](function(_0x10ccf0){logger['error'](_0xc316('0xc'),_0x3a93b2,JSON[_0xc316('0x26')](_0x10ccf0));_0xf60c5a['next']();});}else{_0xf60c5a[_0xc316('0xe')]();}});}}catch(_0x1309aa){logger[_0xc316('0x1c')](_0xc316('0xc'),_0x3a93b2,JSON['stringify'](_0x1309aa));_0xf60c5a['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index ef6beba..8e122b0 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 _0x18a3=['Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','Message','Smtp','service','host','port','secure','authentication','auth','pass','messageId','','headers','auto-replied','All','auto_reply','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','catch','error','finally','Interaction','update','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','stringify','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','moment','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','channel','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','interaction','created','Autoreply\x20already\x20sent','autoreplyExecuted','One\x20Time\x20already\x20sent','contact','format','mail','getMustacheRender','message','from','phone','read','subject'];(function(_0x475a83,_0x44135e){var _0x1a866b=function(_0x20eb6c){while(--_0x20eb6c){_0x475a83['push'](_0x475a83['shift']());}};_0x1a866b(++_0x44135e);}(_0x18a3,0x187));var _0x318a=function(_0x128812,_0x3af744){_0x128812=_0x128812-0x0;var _0x441114=_0x18a3[_0x128812];return _0x441114;};'use strict';var _=require(_0x318a('0x0'));var moment=require(_0x318a('0x1'));var utils=require(_0x318a('0x2'));var logger=require(_0x318a('0x3'))('routing');var rpc={'chatMessage':require(_0x318a('0x4')),'openchannelMessage':require(_0x318a('0x5')),'mailMessage':require(_0x318a('0x6')),'smsMessage':require(_0x318a('0x7')),'faxMessage':require(_0x318a('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0x318a('0x9')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0x318a('0xa')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require(_0x318a('0xb')),'whatsappInteraction':require(_0x318a('0xc'))};var mailRpc=require(_0x318a('0xd'));exports['consequence']=function(_0x59e135,_0xd4cdfb,_0x34228e,_0x2f128b){return function(_0x13aed7){try{var _0x21d4e0=this[_0x318a('0xe')];if(_0x21d4e0==='mail'&&_0x2f128b[_0x318a('0xf')][_0x318a('0x10')]){logger[_0x318a('0x11')](_0x318a('0x12'),_0x59e135,_0x318a('0x13'));return _0x13aed7[_0x318a('0x14')]();}if(_0xd4cdfb[0x0]==='1'&&(_['isNil'](this[_0x318a('0x15')][_0x318a('0x16')])||!this[_0x318a('0x15')]['created'])){logger[_0x318a('0x11')](_0x318a('0x12'),_0x59e135,_0x318a('0x17'));return _0x13aed7[_0x318a('0x14')]();}if(_0xd4cdfb[0x0]==='2'&&this[_0x318a('0x15')][_0x318a('0x18')]){logger['info']('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x59e135,_0x318a('0x19'));return _0x13aed7[_0x318a('0x14')]();}var _0x4f4473={'ContactId':this[_0x318a('0x1a')]['id'],'sentAt':moment()[_0x318a('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this[_0x318a('0xe')]===_0x318a('0x1c')){_0x4f4473['body']=utils['getMustacheRender'](_0xd4cdfb[0x2],this);}else{_0x4f4473[_0x318a('0xf')]=utils[_0x318a('0x1d')](_0xd4cdfb[0x1],this);}if(this['message']){_0x4f4473['to']=this[_0x318a('0x1e')][_0x318a('0x1f')]||'';if(this[_0x318a('0xe')]===_0x318a('0x1c')&&_0xd4cdfb[0x1]==='1'){_0x4f4473['cc']=this['message']['cc']||'';}_0x4f4473[_0x318a('0x1f')]=this['message']['to']||'';_0x4f4473[_0x318a('0x20')]=this[_0x318a('0x1e')]['phone']||'';_0x4f4473[_0x318a('0x21')]=!![];if(this[_0x318a('0x1e')][_0x318a('0x22')]){_0x4f4473['subject']='';_0x4f4473[_0x318a('0x22')]+=_['startsWith'](this[_0x318a('0x1e')]['subject'],_0x318a('0x23'))?'':_0x318a('0x24');_0x4f4473[_0x318a('0x22')]+=this['message']['subject'];}}if(this['channel']===_0x318a('0x25')){_0x4f4473[_0x318a('0x26')]=this[_0x318a('0x27')]['id'];}else{_0x4f4473[_[_0x318a('0x28')](this[_0x318a('0xe')])+_0x318a('0x29')]=this[_0x318a('0x27')]['id'];}_0x4f4473[_[_0x318a('0x28')](this['channel'])+'InteractionId']=this[_0x318a('0x15')]['id'];var _0x864f45=this[_0x318a('0x15')];if(rpc[this['channel']+_0x318a('0x2a')]){if(this[_0x318a('0xe')]===_0x318a('0x1c')){var _0x34fa38={'tls':{'rejectUnauthorized':![]}};if(this[_0x318a('0x27')][_0x318a('0x2b')][_0x318a('0x2c')]){_0x34fa38[_0x318a('0x2c')]=this['account']['Smtp']['service'];}else{_0x34fa38[_0x318a('0x2d')]=this[_0x318a('0x27')][_0x318a('0x2b')][_0x318a('0x2d')];_0x34fa38['port']=this['account']['Smtp'][_0x318a('0x2e')];_0x34fa38['secure']=this[_0x318a('0x27')][_0x318a('0x2b')][_0x318a('0x2f')];}if(this[_0x318a('0x27')][_0x318a('0x2b')][_0x318a('0x30')]){_0x34fa38[_0x318a('0x31')]={'user':this[_0x318a('0x27')]['Smtp']['user'],'pass':this[_0x318a('0x27')][_0x318a('0x2b')][_0x318a('0x32')]};}_0x4f4473['inReplyTo']=this[_0x318a('0x1e')][_0x318a('0x33')];_0x4f4473['html']=''+_['replace'](_0x4f4473['body'],_0x318a('0x34'),_0x318a('0x35'))+_0x318a('0x36');_0x4f4473[_0x318a('0x37')]={'Auto-Submitted':_0x318a('0x38'),'X-Auto-Response-Suppress':_0x318a('0x39'),'Precedence':_0x318a('0x3a')};return mailRpc['sendMailMessage'](_0x34fa38,_0x4f4473)[_0x318a('0x3b')](function(_0xb3646e){logger[_0x318a('0x11')](_0x318a('0x3c'),_0x59e135);_0x4f4473['messageId']=_0xb3646e[_0x318a('0x1e')][_0x318a('0x33')];return rpc[_0x21d4e0+_0x318a('0x2a')][_0x318a('0x3d')](_0x4f4473);})['then'](function(_0x315c85){logger[_0x318a('0x11')]('[%s][AUTOREPLY]\x20%s',_0x59e135,JSON['stringify'](_0x315c85));})[_0x318a('0x3e')](function(_0x1f53e4){logger[_0x318a('0x3f')]('[RPC][%s][AUTOREPLY]\x20%s',_0x59e135,JSON['stringify'](_0x1f53e4));})[_0x318a('0x40')](function(){Promise['resolve']()[_0x318a('0x3b')](function(){if(_0xd4cdfb[0x0]!=='2'||_0x864f45[_0x318a('0x18')])return;return rpc[_0x21d4e0+_0x318a('0x41')][_0x318a('0x42')](_0x864f45['id'],{'autoreplyExecuted':!![]})[_0x318a('0x3b')](function(_0x4fa946){logger[_0x318a('0x11')](_0x318a('0x43'),_0x59e135,JSON[_0x318a('0x44')](_0x4fa946));})[_0x318a('0x3e')](function(_0x297d27){logger[_0x318a('0x3f')](_0x318a('0x45'),_0x59e135,JSON['stringify'](_0x297d27));});})[_0x318a('0x3b')](function(){_0x13aed7[_0x318a('0x14')]();});});}else{return rpc[this[_0x318a('0xe')]+'Message'][_0x318a('0x3d')](_0x4f4473)[_0x318a('0x3b')](function(_0x1cb3d0){logger[_0x318a('0x11')](_0x318a('0x12'),_0x59e135,_0x4f4473[_0x318a('0xf')]);})[_0x318a('0x3e')](function(_0xf617ce){logger[_0x318a('0x3f')]('[%s][AUTOREPLY]\x20%s',_0x59e135,JSON[_0x318a('0x44')](_0xf617ce));})[_0x318a('0x40')](function(){Promise['resolve']()[_0x318a('0x3b')](function(){if(_0xd4cdfb[0x0]!=='2'||_0x864f45['autoreplyExecuted'])return;return rpc[_0x21d4e0+_0x318a('0x41')][_0x318a('0x42')](_0x864f45['id'],{'autoreplyExecuted':!![]})[_0x318a('0x3b')](function(_0x1b0c33){logger['info'](_0x318a('0x43'),_0x59e135,JSON[_0x318a('0x44')](_0x1b0c33));})['catch'](function(_0x1d6222){logger[_0x318a('0x3f')](_0x318a('0x45'),_0x59e135,JSON[_0x318a('0x44')](_0x1d6222));});})[_0x318a('0x3b')](function(){_0x13aed7['next']();});});}}}catch(_0x2e00cf){logger['error'](_0x318a('0x12'),_0x59e135,JSON[_0x318a('0x44')](_0x2e00cf));_0x13aed7[_0x318a('0x46')]();}};}; \ No newline at end of file +var _0xbf92=['','headers','auto-replied','All','auto_reply','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','Message','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','resolve','Interaction','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','create','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','body','isAutoreply','info','next','isNil','created','interaction','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','message','from','read','subject','startsWith','Re:','Re:\x20','chat','account','upperFirst','AccountId','mail','service','Smtp','host','port','secure','authentication','auth','pass','inReplyTo','messageId','html','','replace',']+(>|$)/g,''),'priorityTrue':_0x5776a8[0x1],'priorityFalse':_0x5776a8[0x2]};var _0x22741b=gotoif['validate'](_0x1d10e1,{'typecast':!![]});if(_0x22741b['length']){logger[_0x670a('0xc')](_0x670a('0xd'),_0x3f86fe,_[_0x670a('0xe')](_0x22741b,_0x670a('0xf'))[_0x670a('0x10')](',\x20'));_0x504be0[_0x670a('0x11')]();}else{try{var _0x41512c=eval('('+_0x1d10e1[_0x670a('0x12')]+')');var _0x149940=_0x41512c?_0x1d10e1[_0x670a('0x13')]:_0x1d10e1['priorityFalse'];logger[_0x670a('0x14')](_0x670a('0x15'),_0x3f86fe,_0x1d10e1[_0x670a('0x12')],_0x41512c,_0x149940||_0x670a('0x16'));if(_0x149940){var _0x161bd2=_['findIndex'](_0x504be0[_0x670a('0x17')](),{'p':_0x149940});if(_0x161bd2>=0x0){logger[_0x670a('0x14')](_0x670a('0x18'),_0x3f86fe,_0x149940||_0x670a('0x16'),_0x161bd2);_0x504be0['next'](_0x161bd2);}else{logger[_0x670a('0x14')](_0x670a('0x19'),_0x3f86fe,_0x149940||_0x670a('0x16'));_0x504be0[_0x670a('0x11')]();}}else{_0x504be0[_0x670a('0x16')]();}}catch(_0x261a09){logger[_0x670a('0xc')](_0x670a('0x1a'),_0x3f86fe,_0x261a09[_0x670a('0xf')]);_0x504be0['stop']();}}}catch(_0x23c517){logger[_0x670a('0xc')](_0x670a('0xd'),_0x3f86fe,JSON[_0x670a('0x1b')](_0x23c517));_0x504be0[_0x670a('0x11')]();}};}; \ No newline at end of file +var _0x236c=['consequence','fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','map','message','join','condition','priorityTrue','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stop','validate','lodash','html-to-text','./utils','../../../../config/logger','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','priority\x20true\x20is\x20a\x20number','number','priority\x20false\x20is\x20a\x20number'];(function(_0x738d67,_0x53868d){var _0x4270d0=function(_0x1fad6e){while(--_0x1fad6e){_0x738d67['push'](_0x738d67['shift']());}};_0x4270d0(++_0x53868d);}(_0x236c,0x1c7));var _0xc236=function(_0x15f109,_0x36798a){_0x15f109=_0x15f109-0x0;var _0x13732e=_0x236c[_0x15f109];return _0x13732e;};'use strict';var schema=require(_0xc236('0x0'));var _=require(_0xc236('0x1'));var htmlToText=require(_0xc236('0x2'));var utils=require(_0xc236('0x3'));var logger=require(_0xc236('0x4'))('routing');var gotoif=schema({'condition':{'type':_0xc236('0x5'),'required':!![],'message':_0xc236('0x6')},'priorityTrue':{'type':'number','message':_0xc236('0x7')},'priorityFalse':{'type':_0xc236('0x8'),'message':_0xc236('0x9')}});exports[_0xc236('0xa')]=function(_0xb1738f,_0x4e9428){return function(_0x573567){try{var _0x30de0b={'condition':htmlToText[_0xc236('0xb')](utils[_0xc236('0xc')](_0x4e9428[0x0],this),{'wordwrap':![]})[_0xc236('0xd')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x4e9428[0x1],'priorityFalse':_0x4e9428[0x2]};var _0x51dbe4=gotoif[_0xc236('0x0')](_0x30de0b,{'typecast':!![]});if(_0x51dbe4[_0xc236('0xe')]){logger[_0xc236('0xf')](_0xc236('0x10'),_0xb1738f,_[_0xc236('0x11')](_0x51dbe4,_0xc236('0x12'))[_0xc236('0x13')](',\x20'));_0x573567['stop']();}else{try{var _0x1f3451=eval('('+_0x30de0b[_0xc236('0x14')]+')');var _0x5c8a29=_0x1f3451?_0x30de0b[_0xc236('0x15')]:_0x30de0b[_0xc236('0x16')];logger['info'](_0xc236('0x17'),_0xb1738f,_0x30de0b[_0xc236('0x14')],_0x1f3451,_0x5c8a29||_0xc236('0x18'));if(_0x5c8a29){var _0x37138f=_[_0xc236('0x19')](_0x573567[_0xc236('0x1a')](),{'p':_0x5c8a29});if(_0x37138f>=0x0){logger[_0xc236('0x1b')](_0xc236('0x1c'),_0xb1738f,_0x5c8a29||_0xc236('0x18'),_0x37138f);_0x573567[_0xc236('0x18')](_0x37138f);}else{logger['info'](_0xc236('0x1d'),_0xb1738f,_0x5c8a29||_0xc236('0x18'));_0x573567[_0xc236('0x1e')]();}}else{_0x573567[_0xc236('0x18')]();}}catch(_0x5cb14f){logger[_0xc236('0xf')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0xb1738f,_0x5cb14f[_0xc236('0x12')]);_0x573567[_0xc236('0x1e')]();}}}catch(_0x27e564){logger[_0xc236('0xf')]('[%s][GOTOIF]\x20%s',_0xb1738f,JSON['stringify'](_0x27e564));_0x573567[_0xc236('0x1e')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index 8968111..673d64b 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 _0xd7e2=['priority','findIndex','rules','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','error','stringify','validate','lodash','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','[%s][GOTOP]\x20%s','map','message','stop','info','[%s][GOTOP]\x20priority\x20%s'];(function(_0x2abec6,_0x4718b9){var _0x134e7d=function(_0x8fa754){while(--_0x8fa754){_0x2abec6['push'](_0x2abec6['shift']());}};_0x134e7d(++_0x4718b9);}(_0xd7e2,0x9f));var _0x2d7e=function(_0x384811,_0x127f54){_0x384811=_0x384811-0x0;var _0x4f4961=_0xd7e2[_0x384811];return _0x4f4961;};'use strict';var schema=require(_0x2d7e('0x0'));var _=require(_0x2d7e('0x1'));var logger=require('../../../../config/logger')(_0x2d7e('0x2'));var gotop=schema({'priority':{'type':_0x2d7e('0x3'),'required':!![],'message':_0x2d7e('0x4')}});exports['consequence']=function(_0x6b49ac,_0x3e7cb3){return function(_0x58614a){try{var _0x2615c3={'priority':_0x3e7cb3[0x0]};var _0x4358a6=gotop['validate'](_0x2615c3,{'typecast':!![]});if(_0x4358a6[_0x2d7e('0x5')]){logger['error'](_0x2d7e('0x6'),_0x6b49ac,_[_0x2d7e('0x7')](_0x4358a6,_0x2d7e('0x8'))['join'](',\x20'));_0x58614a[_0x2d7e('0x9')]();}else{logger[_0x2d7e('0xa')](_0x2d7e('0xb'),_0x6b49ac,_0x2615c3[_0x2d7e('0xc')]);if(_0x2615c3[_0x2d7e('0xc')]){var _0x516bc5=_[_0x2d7e('0xd')](_0x58614a[_0x2d7e('0xe')](),{'p':_0x2615c3['priority']});if(_0x516bc5>=0x0){logger['info']('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x6b49ac,_0x2615c3[_0x2d7e('0xc')]||'next',_0x516bc5);_0x58614a[_0x2d7e('0xf')](_0x516bc5);}else{logger[_0x2d7e('0xa')](_0x2d7e('0x10'),_0x6b49ac,_0x2615c3[_0x2d7e('0xc')]||_0x2d7e('0xf'));_0x58614a[_0x2d7e('0x9')]();}}else{_0x58614a[_0x2d7e('0xf')]();}}}catch(_0xfea7d1){logger[_0x2d7e('0x11')](_0x2d7e('0x6'),_0x6b49ac,JSON[_0x2d7e('0x12')](_0xfea7d1));_0x58614a['stop']();}};}; \ No newline at end of file +var _0xfc67=['routing','consequence','length','[%s][GOTOP]\x20%s','map','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','validate','lodash','../../../../config/logger'];(function(_0x15eb35,_0x3510ff){var _0x20e5da=function(_0x3d9498){while(--_0x3d9498){_0x15eb35['push'](_0x15eb35['shift']());}};_0x20e5da(++_0x3510ff);}(_0xfc67,0x82));var _0x7fc6=function(_0x2bdf29,_0x40cab0){_0x2bdf29=_0x2bdf29-0x0;var _0x60cb83=_0xfc67[_0x2bdf29];return _0x60cb83;};'use strict';var schema=require(_0x7fc6('0x0'));var _=require(_0x7fc6('0x1'));var logger=require(_0x7fc6('0x2'))(_0x7fc6('0x3'));var gotop=schema({'priority':{'type':'number','required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0x7fc6('0x4')]=function(_0x26b0d8,_0x1cdbf0){return function(_0x1f38fd){try{var _0x4b9d5c={'priority':_0x1cdbf0[0x0]};var _0x50a77f=gotop['validate'](_0x4b9d5c,{'typecast':!![]});if(_0x50a77f[_0x7fc6('0x5')]){logger['error'](_0x7fc6('0x6'),_0x26b0d8,_[_0x7fc6('0x7')](_0x50a77f,_0x7fc6('0x8'))[_0x7fc6('0x9')](',\x20'));_0x1f38fd[_0x7fc6('0xa')]();}else{logger[_0x7fc6('0xb')](_0x7fc6('0xc'),_0x26b0d8,_0x4b9d5c['priority']);if(_0x4b9d5c[_0x7fc6('0xd')]){var _0x46c80a=_[_0x7fc6('0xe')](_0x1f38fd[_0x7fc6('0xf')](),{'p':_0x4b9d5c[_0x7fc6('0xd')]});if(_0x46c80a>=0x0){logger['info'](_0x7fc6('0x10'),_0x26b0d8,_0x4b9d5c[_0x7fc6('0xd')]||'next',_0x46c80a);_0x1f38fd[_0x7fc6('0x11')](_0x46c80a);}else{logger[_0x7fc6('0xb')](_0x7fc6('0x12'),_0x26b0d8,_0x4b9d5c[_0x7fc6('0xd')]||_0x7fc6('0x11'));_0x1f38fd['stop']();}}else{_0x1f38fd[_0x7fc6('0x11')]();}}}catch(_0x3ac0e5){logger['error'](_0x7fc6('0x6'),_0x26b0d8,JSON['stringify'](_0x3ac0e5));_0x1f38fd[_0x7fc6('0xa')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index 888baee..4234e82 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 _0x80cd=['[%s][MESSAGE]\x20%s','body','next','catch','stringify','stop','error','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','getMustacheRender','contact','channel','chat','account','AccountId','upperFirst','InteractionId','interaction','Message','create','then','info'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0x80cd,0x146));var _0xd80c=function(_0xb6e43,_0x1568fc){_0xb6e43=_0xb6e43-0x0;var _0x47c40f=_0x80cd[_0xb6e43];return _0x47c40f;};'use strict';var _=require('lodash');var utils=require(_0xd80c('0x0'));var logger=require(_0xd80c('0x1'))(_0xd80c('0x2'));var rpc={'chatMessage':require(_0xd80c('0x3')),'openchannelMessage':require(_0xd80c('0x4')),'mailMessage':require(_0xd80c('0x5')),'smsMessage':require(_0xd80c('0x6')),'faxMessage':require(_0xd80c('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xd80c('0x8')]=function(_0x12b604,_0x21149c){return function(_0x46dfa0){try{var _0x508e19={'body':utils[_0xd80c('0x9')](_0x21149c[0x0],this),'ContactId':this[_0xd80c('0xa')]['id']};if(this[_0xd80c('0xb')]===_0xd80c('0xc')){_0x508e19['ChatWebsiteId']=this[_0xd80c('0xd')]['id'];}else{_0x508e19[_['upperFirst'](this['channel'])+_0xd80c('0xe')]=this['account']['id'];}_0x508e19[_[_0xd80c('0xf')](this[_0xd80c('0xb')])+_0xd80c('0x10')]=this[_0xd80c('0x11')]['id'];if(rpc[this[_0xd80c('0xb')]+_0xd80c('0x12')]){return rpc[this[_0xd80c('0xb')]+'Message'][_0xd80c('0x13')](_0x508e19)[_0xd80c('0x14')](function(_0x40f3c3){logger[_0xd80c('0x15')](_0xd80c('0x16'),_0x12b604,_0x508e19[_0xd80c('0x17')]);_0x46dfa0[_0xd80c('0x18')]();})[_0xd80c('0x19')](function(_0x67c0d1){logger['error'](_0xd80c('0x16'),_0x12b604,JSON[_0xd80c('0x1a')](_0x67c0d1));_0x46dfa0[_0xd80c('0x1b')]();});}}catch(_0x315efb){logger[_0xd80c('0x1c')]('[%s][MESSAGE]\x20%s',_0x12b604,JSON[_0xd80c('0x1a')](_0x315efb));_0x46dfa0[_0xd80c('0x1b')]();}};}; \ No newline at end of file +var _0x0c19=['stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','AccountId','upperFirst','interaction','Message','create','info','[%s][MESSAGE]\x20%s','body','next','error'];(function(_0x479d7d,_0x15a32b){var _0x446ae8=function(_0x8d3667){while(--_0x8d3667){_0x479d7d['push'](_0x479d7d['shift']());}};_0x446ae8(++_0x15a32b);}(_0x0c19,0xf5));var _0x90c1=function(_0x3fb2cf,_0x418468){_0x3fb2cf=_0x3fb2cf-0x0;var _0x415821=_0x0c19[_0x3fb2cf];return _0x415821;};'use strict';var _=require(_0x90c1('0x0'));var utils=require(_0x90c1('0x1'));var logger=require(_0x90c1('0x2'))(_0x90c1('0x3'));var rpc={'chatMessage':require(_0x90c1('0x4')),'openchannelMessage':require(_0x90c1('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x90c1('0x6')),'faxMessage':require(_0x90c1('0x7')),'whatsappMessage':require(_0x90c1('0x8'))};exports['consequence']=function(_0x13fd68,_0xb605b6){return function(_0x5434a1){try{var _0x440f7a={'body':utils[_0x90c1('0x9')](_0xb605b6[0x0],this),'ContactId':this[_0x90c1('0xa')]['id']};if(this[_0x90c1('0xb')]===_0x90c1('0xc')){_0x440f7a[_0x90c1('0xd')]=this[_0x90c1('0xe')]['id'];}else{_0x440f7a[_['upperFirst'](this[_0x90c1('0xb')])+_0x90c1('0xf')]=this['account']['id'];}_0x440f7a[_[_0x90c1('0x10')](this['channel'])+'InteractionId']=this[_0x90c1('0x11')]['id'];if(rpc[this['channel']+_0x90c1('0x12')]){return rpc[this[_0x90c1('0xb')]+_0x90c1('0x12')][_0x90c1('0x13')](_0x440f7a)['then'](function(_0x59a0ca){logger[_0x90c1('0x14')](_0x90c1('0x15'),_0x13fd68,_0x440f7a[_0x90c1('0x16')]);_0x5434a1[_0x90c1('0x17')]();})['catch'](function(_0xaaab35){logger[_0x90c1('0x18')](_0x90c1('0x15'),_0x13fd68,JSON[_0x90c1('0x19')](_0xaaab35));_0x5434a1[_0x90c1('0x1a')]();});}}catch(_0x1cfb86){logger['error'](_0x90c1('0x15'),_0x13fd68,JSON[_0x90c1('0x19')](_0x1cfb86));_0x5434a1[_0x90c1('0x1a')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index e379a72..f43130f 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 _0x8be2=['consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','stop','../../../../config/logger','routing'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0x8be2,0x1e8));var _0x28be=function(_0x1fcaf1,_0x21c3c2){_0x1fcaf1=_0x1fcaf1-0x0;var _0x55f464=_0x8be2[_0x1fcaf1];return _0x55f464;};'use strict';var utils=require('./utils');var logger=require(_0x28be('0x0'))(_0x28be('0x1'));exports[_0x28be('0x2')]=function(_0x597da9,_0x42bac4){return function(_0x3a3210){try{logger[_0x28be('0x3')](_0x28be('0x4'),_0x597da9,utils[_0x28be('0x5')](_0x42bac4[0x0],this));_0x3a3210[_0x28be('0x6')]();}catch(_0x2c6447){logger[_0x28be('0x7')]('[%s][NOOP]\x20%s',_0x597da9,JSON[_0x28be('0x8')](_0x2c6447));_0x3a3210[_0x28be('0x9')]();}};}; \ No newline at end of file +var _0x3d33=['routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','stop','./utils','../../../../config/logger'];(function(_0x587fb5,_0x59cb3b){var _0x551105=function(_0x5bbef4){while(--_0x5bbef4){_0x587fb5['push'](_0x587fb5['shift']());}};_0x551105(++_0x59cb3b);}(_0x3d33,0x1b6));var _0x33d3=function(_0x2e7aa8,_0x2c6c40){_0x2e7aa8=_0x2e7aa8-0x0;var _0x13ec84=_0x3d33[_0x2e7aa8];return _0x13ec84;};'use strict';var utils=require(_0x33d3('0x0'));var logger=require(_0x33d3('0x1'))(_0x33d3('0x2'));exports[_0x33d3('0x3')]=function(_0x467e21,_0x5d0587){return function(_0x319497){try{logger[_0x33d3('0x4')](_0x33d3('0x5'),_0x467e21,utils[_0x33d3('0x6')](_0x5d0587[0x0],this));_0x319497[_0x33d3('0x7')]();}catch(_0x394d18){logger[_0x33d3('0x8')](_0x33d3('0x5'),_0x467e21,JSON[_0x33d3('0x9')](_0x394d18));_0x319497[_0x33d3('0xa')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index e501f5e..4299f8d 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 _0x9ead=['QueueId','InteractionId','interaction','MessageId','message','AccountId','WebsiteId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','waiting','YYYY-MM-DD\x20HH:mm:ss','accepted','[%s][STOP:QUEUE][NAME:%s]','info','update','update\x20queue\x20report','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','join','find','Queues','createQueue','atimeout','qtimeout','[%s][QUEUE]\x20ROUTING\x20STOPPED','rules','stop','complete','[%s][QUEUE]\x20APPLICATION\x20END','close','next','strategy','rrmemory','validate','lodash','util','seq-queue','ioredis','../../../../config/environment','../../../../config/logger','./strategy','redis','localhost','socket.io-emitter','account','queue','emit','clone','format','%sQueuesWaitingInteractions','%s_queue_waiting_interaction:%s','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','body','from','contact','list','upperFirst','channel'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9ead,0x70));var _0xd9ea=function(_0x4a258d,_0x30f281){_0x4a258d=_0x4a258d-0x0;var _0x104963=_0x9ead[_0x4a258d];return _0x104963;};'use strict';var schema=require(_0xd9ea('0x0'));var _=require(_0xd9ea('0x1'));var util=require(_0xd9ea('0x2'));var seqqueue=require(_0xd9ea('0x3'));var moment=require('moment');var Redis=require(_0xd9ea('0x4'));var config=require(_0xd9ea('0x5'));var logger=require(_0xd9ea('0x6'))('routing');var strategy=require(_0xd9ea('0x7'));config['redis']=_['defaults'](config[_0xd9ea('0x8')],{'host':_0xd9ea('0x9'),'port':0x18eb});var io=require(_0xd9ea('0xa'))(new Redis(config[_0xd9ea('0x8')]));var attributes=['id','queue_id',_0xd9ea('0xb'),_0xd9ea('0xc'),'from','joinAt'];function emit(_0x4a9551,_0x5a22c7,_0x45d5d6){io['to'](_0x4a9551)[_0xd9ea('0xd')](_0x5a22c7,_0x45d5d6);}function emitChannelQueueInteraction(_0x3ef91e,_0x237342,_0x5af4d2,_0x26834c,_0x28dfc4,_0xa690c8,_0x199fa6,_0x5a4e83){var _0x23f68d=_[_0xd9ea('0xe')](_0x5af4d2);_0x23f68d['queue_id']=_0x5a4e83;_0x23f68d[_0xd9ea('0xc')]=_0x237342;_0x23f68d[_0xd9ea('0xb')]=_0x26834c;_0x23f68d['id']=_0x28dfc4;if(_0xa690c8){_0x199fa6[util[_0xd9ea('0xf')](_0xd9ea('0x10'),_0x3ef91e)][_0x28dfc4]=_['pick'](_0x23f68d,attributes);}else{delete _0x199fa6[util['format'](_0xd9ea('0x10'),_0x3ef91e)][_0x28dfc4];}emit(util[_0xd9ea('0xf')]('%s:queue:%s',_0x3ef91e,_0x237342),util[_0xd9ea('0xf')](_0xd9ea('0x11'),_0x3ef91e,_0xa690c8?'save':_0xd9ea('0x12')),_['pick'](_0x23f68d,attributes));}var rpc={'openchannelQueueReport':require(_0xd9ea('0x13')),'mailQueueReport':require(_0xd9ea('0x14')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0xd9ea('0x15')),'whatsappQueueReport':require(_0xd9ea('0x16'))};var queue=schema({'name':{'type':'string','required':!![],'message':_0xd9ea('0x17')},'timeout':{'type':_0xd9ea('0x18'),'message':_0xd9ea('0x19')}});function startRouting(_0x5a068a,_0x5002ba,_0x5f4b98,_0x43d514){if(_0x5a068a&&_0x5002ba&&_0x5f4b98){_0x5002ba['waiting']+=0x1;var _0x13748f={'uniqueid':_0x5a068a,'from':_0x5f4b98['body']?_0x5f4b98[_0xd9ea('0x1a')][_0xd9ea('0x1b')]:'','joinAt':moment()[_0xd9ea('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5f4b98[_0xd9ea('0x1c')]?_0x5f4b98['contact']['id']:null,'ListId':_0x5f4b98[_0xd9ea('0x1d')]?_0x5f4b98[_0xd9ea('0x1d')]['id']:null};_0x13748f[_[_0xd9ea('0x1e')](_0x5f4b98[_0xd9ea('0x1f')])+_0xd9ea('0x20')]=_0x5002ba['id']||null;_0x13748f[_[_0xd9ea('0x1e')](_0x5f4b98['channel'])+_0xd9ea('0x21')]=_0x5f4b98[_0xd9ea('0x22')]?_0x5f4b98[_0xd9ea('0x22')]['id']:null;_0x13748f[_[_0xd9ea('0x1e')](_0x5f4b98['channel'])+_0xd9ea('0x23')]=_0x5f4b98[_0xd9ea('0x24')]?_0x5f4b98['message']['id']:null;_0x13748f[_[_0xd9ea('0x1e')](_0x5f4b98['channel'])+(_0x5f4b98[_0xd9ea('0x1f')]!=='chat'?_0xd9ea('0x25'):_0xd9ea('0x26'))]=_0x5f4b98[_0xd9ea('0xb')]?_0x5f4b98[_0xd9ea('0xb')]['id']:null;logger['info'](util['format'](_0xd9ea('0x27'),_0x5a068a,_0x5002ba[_0xd9ea('0x28')]));emitChannelQueueInteraction(_0x5f4b98['channel'],_0x5002ba['name'],_0x13748f,_0x5f4b98[_0xd9ea('0xb')][_0xd9ea('0x28')],_0x5f4b98[_0xd9ea('0x24')]['id'],!![],_0x43d514,_0x5002ba['id']);if(rpc[_0x5f4b98[_0xd9ea('0x1f')]+_0xd9ea('0x29')]){return rpc[_0x5f4b98[_0xd9ea('0x1f')]+_0xd9ea('0x29')][_0xd9ea('0x2a')](_0x13748f)[_0xd9ea('0x2b')](function(_0x49a6c5){logger[_0xd9ea('0x2c')](_0xd9ea('0x2d'));});}}}function stopRouting(_0x517105,_0x25c61b,_0x26eb56,_0x7db836){if(_0x517105&&_0x25c61b){_0x25c61b[_0xd9ea('0x2e')]-=0x1;var _0x4ccb81={'leaveAt':moment()[_0xd9ea('0xf')](_0xd9ea('0x2f')),'acceptAt':moment()[_0xd9ea('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xd9ea('0x30')};logger['info'](util[_0xd9ea('0xf')](_0xd9ea('0x31'),_0x517105,_0x25c61b[_0xd9ea('0x28')]));emitChannelQueueInteraction(_0x26eb56['channel'],_0x25c61b[_0xd9ea('0x28')],_0x26eb56[_0xd9ea('0x1a')],_0x26eb56[_0xd9ea('0xb')][_0xd9ea('0x28')],_0x26eb56[_0xd9ea('0x24')]['id'],![],_0x7db836,_0x25c61b['id']);if(rpc[_0x26eb56[_0xd9ea('0x1f')]+_0xd9ea('0x29')]){return rpc[_0x26eb56[_0xd9ea('0x1f')]+'QueueReport']['update'](_0x517105,_0x4ccb81)[_0xd9ea('0x2b')](function(_0x2980af){logger[_0xd9ea('0x2c')]('update\x20queue\x20report');});}}}function endRouting(_0x341783,_0x49dd8a,_0x1d2788,_0x1a7b4a){if(_0x341783&&_0x49dd8a){_0x49dd8a[_0xd9ea('0x2e')]-=0x1;var _0x2087d9={'leaveAt':moment()[_0xd9ea('0xf')](_0xd9ea('0x2f')),'exitAt':moment()['format'](_0xd9ea('0x2f')),'reason':'timeout'};logger[_0xd9ea('0x32')](util[_0xd9ea('0xf')]('[%s][END:QUEUE][NAME:%s]',_0x341783,_0x49dd8a['name']));emitChannelQueueInteraction(_0x1d2788['channel'],_0x49dd8a['name'],_0x1d2788[_0xd9ea('0x1a')],_0x1d2788[_0xd9ea('0xb')][_0xd9ea('0x28')],_0x1d2788[_0xd9ea('0x24')]['id'],![],_0x1a7b4a);if(rpc[_0x1d2788[_0xd9ea('0x1f')]+'QueueReport']){return rpc[_0x1d2788[_0xd9ea('0x1f')]+_0xd9ea('0x29')][_0xd9ea('0x33')](_0x341783,_0x2087d9)[_0xd9ea('0x2b')](function(_0x23e15f){logger[_0xd9ea('0x2c')](_0xd9ea('0x34'));});}}}function handleFindQueue(_0x1571c6){return function(_0x2b4a7b){return _0x2b4a7b['name'][_0xd9ea('0x35')]()===_0x1571c6['toLowerCase']();};}exports[_0xd9ea('0x36')]=function(_0x523b0e,_0x349484,_0xadc4aa,_0x516311){return function(_0x5d418a){try{var _0x50f7cb={'name':_0x349484[0x0],'timeout':_0x349484[0x1]};var _0x292c30=queue[_0xd9ea('0x0')](_0x50f7cb,{'typecast':!![]});if(_0x292c30[_0xd9ea('0x37')]){logger[_0xd9ea('0x2c')](_0xd9ea('0x38'),_0x523b0e,_['map'](_0x292c30,_0xd9ea('0x24'))[_0xd9ea('0x39')](',\x20'));_0x5d418a['stop']();}else{var _0x5f019b=_[_0xd9ea('0x3a')](_0xadc4aa[_0x516311[_0xd9ea('0x1f')]+_0xd9ea('0x3b')],handleFindQueue(_0x50f7cb[_0xd9ea('0x28')]));if(_0x5f019b){startRouting(_0x523b0e,_0x5f019b,_0x516311,_0xadc4aa);var _0x2793c8=(_0x5f019b['timeout']||0xa)*0x3e8;var _0x30b757=(_0x50f7cb['timeout']||0x14)*0x3e8;var _0x100dd3,_0x403a77;if(_0x2793c8>_0x30b757){_0x30b757=_0x2793c8;}var _0x31229e=seqqueue[_0xd9ea('0x3c')](_0x2793c8);_0x31229e['id']=_0x523b0e;_0x31229e[_0xd9ea('0x3d')]=_0x2793c8;_0x31229e[_0xd9ea('0x3e')]=_0x30b757;_0x31229e[_0xd9ea('0x1f')]=_0x516311[_0xd9ea('0x1f')];_0xadc4aa['rules'][_0x523b0e]['on']('end',function(){logger[_0xd9ea('0x32')](_0xd9ea('0x3f'),_0x523b0e);stopRouting(_0x523b0e,_0x5f019b,_0x516311,_0xadc4aa);clearTimeout(_0x100dd3);_0x100dd3=undefined;_0x31229e['close'](!![]);if(_0xadc4aa['rules'][_0x523b0e]){delete _0xadc4aa[_0xd9ea('0x40')][_0x523b0e];}_0x5d418a[_0xd9ea('0x41')]();});_0xadc4aa[_0xd9ea('0x40')][_0x523b0e]['on'](_0xd9ea('0x42'),function(){if(_0xadc4aa[_0xd9ea('0x40')][_0x523b0e]){delete _0xadc4aa['rules'][_0x523b0e];}});_0x100dd3=setTimeout(function(){logger[_0xd9ea('0x32')](_0xd9ea('0x43'),_0x523b0e);endRouting(_0x523b0e,_0x5f019b,_0x516311,_0xadc4aa);clearTimeout(_0x100dd3);_0x31229e[_0xd9ea('0x44')](!![]);_0x5d418a[_0xd9ea('0x45')]();},_0x30b757);switch(_0x5f019b[_0xd9ea('0x46')]){case _0xd9ea('0x47'):strategy[_0xd9ea('0x47')](_0x31229e,_0x5f019b,_0xadc4aa,_0x516311);break;default:strategy['beepall'](_0x31229e,_0x5f019b,_0xadc4aa,_0x516311);}}else{logger[_0xd9ea('0x2c')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x523b0e,_0x50f7cb[_0xd9ea('0x28')]);_0x5d418a[_0xd9ea('0x41')]();}}}catch(_0x1fb1d3){console['log'](_0x1fb1d3);logger[_0xd9ea('0x2c')](_0xd9ea('0x38'),_0x523b0e,_0x1fb1d3['stack']);_0x5d418a[_0xd9ea('0x41')]();}};}; \ No newline at end of file +var _0x3233=['account','queue','from','joinAt','emit','format','%sQueuesWaitingInteractions','pick','%s_queue_waiting_interaction:%s','save','remove','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/whatsappQueueReport','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','body','YYYY-MM-DD\x20HH:mm:ss','contact','QueueId','upperFirst','channel','interaction','MessageId','message','chat','WebsiteId','info','name','QueueReport','create','catch','error','create\x20queue\x20report','update','update\x20queue\x20report','waiting','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','join','stop','createQueue','qtimeout','rules','end','close','next','strategy','rrmemory','beepall','stack','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','routing','./strategy','defaults','localhost','socket.io-emitter','queue_id'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x3233,0xc5));var _0x3323=function(_0x546644,_0x24fe66){_0x546644=_0x546644-0x0;var _0x517cbe=_0x3233[_0x546644];return _0x517cbe;};'use strict';var schema=require(_0x3323('0x0'));var _=require(_0x3323('0x1'));var util=require(_0x3323('0x2'));var seqqueue=require(_0x3323('0x3'));var moment=require(_0x3323('0x4'));var Redis=require(_0x3323('0x5'));var config=require(_0x3323('0x6'));var logger=require('../../../../config/logger')(_0x3323('0x7'));var strategy=require(_0x3323('0x8'));config['redis']=_[_0x3323('0x9')](config['redis'],{'host':_0x3323('0xa'),'port':0x18eb});var io=require(_0x3323('0xb'))(new Redis(config['redis']));var attributes=['id',_0x3323('0xc'),_0x3323('0xd'),_0x3323('0xe'),_0x3323('0xf'),_0x3323('0x10')];function emit(_0xdaf9c,_0x5aaa3b,_0x398038){io['to'](_0xdaf9c)[_0x3323('0x11')](_0x5aaa3b,_0x398038);}function emitChannelQueueInteraction(_0x4e724c,_0x5e208e,_0x7e02fd,_0x2468e6,_0x44aec4,_0x3b29e4,_0x37e250,_0x139583){var _0x282894=_['clone'](_0x7e02fd);_0x282894[_0x3323('0xc')]=_0x139583;_0x282894[_0x3323('0xe')]=_0x5e208e;_0x282894[_0x3323('0xd')]=_0x2468e6;_0x282894['id']=_0x44aec4;if(_0x3b29e4){_0x37e250[util[_0x3323('0x12')](_0x3323('0x13'),_0x4e724c)][_0x44aec4]=_[_0x3323('0x14')](_0x282894,attributes);}else{delete _0x37e250[util[_0x3323('0x12')](_0x3323('0x13'),_0x4e724c)][_0x44aec4];}emit(util[_0x3323('0x12')]('%s:queue:%s',_0x4e724c,_0x5e208e),util[_0x3323('0x12')](_0x3323('0x15'),_0x4e724c,_0x3b29e4?_0x3323('0x16'):_0x3323('0x17')),_[_0x3323('0x14')](_0x282894,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x3323('0x18')),'chatQueueReport':require(_0x3323('0x19')),'smsQueueReport':require(_0x3323('0x1a')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x3323('0x1b'))};var queue=schema({'name':{'type':'string','required':!![],'message':_0x3323('0x1c')},'timeout':{'type':_0x3323('0x1d'),'message':_0x3323('0x1e')}});function startRouting(_0xd5fb2e,_0x161a87,_0x133bed,_0x4320cc){if(_0xd5fb2e&&_0x161a87&&_0x133bed){_0x161a87['waiting']+=0x1;var _0x1778a0={'uniqueid':_0xd5fb2e,'from':_0x133bed[_0x3323('0x1f')]?_0x133bed['body'][_0x3323('0xf')]:'','joinAt':moment()[_0x3323('0x12')](_0x3323('0x20')),'ContactId':_0x133bed[_0x3323('0x21')]?_0x133bed[_0x3323('0x21')]['id']:null,'ListId':_0x133bed['list']?_0x133bed['list']['id']:null};_0x1778a0[_['upperFirst'](_0x133bed['channel'])+_0x3323('0x22')]=_0x161a87['id']||null;_0x1778a0[_[_0x3323('0x23')](_0x133bed[_0x3323('0x24')])+'InteractionId']=_0x133bed[_0x3323('0x25')]?_0x133bed[_0x3323('0x25')]['id']:null;_0x1778a0[_[_0x3323('0x23')](_0x133bed[_0x3323('0x24')])+_0x3323('0x26')]=_0x133bed[_0x3323('0x27')]?_0x133bed['message']['id']:null;_0x1778a0[_[_0x3323('0x23')](_0x133bed[_0x3323('0x24')])+(_0x133bed['channel']!==_0x3323('0x28')?'AccountId':_0x3323('0x29'))]=_0x133bed[_0x3323('0xd')]?_0x133bed[_0x3323('0xd')]['id']:null;logger[_0x3323('0x2a')](util['format']('[%s][START:QUEUE][NAME:%s]',_0xd5fb2e,_0x161a87[_0x3323('0x2b')]));emitChannelQueueInteraction(_0x133bed[_0x3323('0x24')],_0x161a87['name'],_0x1778a0,_0x133bed[_0x3323('0xd')]['name'],_0x133bed['message']['id'],!![],_0x4320cc,_0x161a87['id']);if(rpc[_0x133bed[_0x3323('0x24')]+'QueueReport']){return rpc[_0x133bed[_0x3323('0x24')]+_0x3323('0x2c')][_0x3323('0x2d')](_0x1778a0)[_0x3323('0x2e')](function(_0x2322ce){logger[_0x3323('0x2f')](_0x3323('0x30'));});}}}function stopRouting(_0x5c4b35,_0x29bc81,_0x2d31bd,_0x2f483b){if(_0x5c4b35&&_0x29bc81){_0x29bc81['waiting']-=0x1;var _0x457e4c={'leaveAt':moment()[_0x3323('0x12')](_0x3323('0x20')),'acceptAt':moment()['format'](_0x3323('0x20')),'reason':'accepted'};logger[_0x3323('0x2a')](util[_0x3323('0x12')]('[%s][STOP:QUEUE][NAME:%s]',_0x5c4b35,_0x29bc81[_0x3323('0x2b')]));emitChannelQueueInteraction(_0x2d31bd[_0x3323('0x24')],_0x29bc81['name'],_0x2d31bd[_0x3323('0x1f')],_0x2d31bd[_0x3323('0xd')][_0x3323('0x2b')],_0x2d31bd['message']['id'],![],_0x2f483b,_0x29bc81['id']);if(rpc[_0x2d31bd[_0x3323('0x24')]+'QueueReport']){return rpc[_0x2d31bd[_0x3323('0x24')]+'QueueReport'][_0x3323('0x31')](_0x5c4b35,_0x457e4c)[_0x3323('0x2e')](function(_0x353b2f){logger[_0x3323('0x2f')](_0x3323('0x32'));});}}}function endRouting(_0x18f77c,_0x3e8e7f,_0x4f4762,_0x2a7bdb){if(_0x18f77c&&_0x3e8e7f){_0x3e8e7f[_0x3323('0x33')]-=0x1;var _0x1785f6={'leaveAt':moment()[_0x3323('0x12')](_0x3323('0x20')),'exitAt':moment()[_0x3323('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x3323('0x34')};logger['info'](util[_0x3323('0x12')](_0x3323('0x35'),_0x18f77c,_0x3e8e7f[_0x3323('0x2b')]));emitChannelQueueInteraction(_0x4f4762[_0x3323('0x24')],_0x3e8e7f[_0x3323('0x2b')],_0x4f4762[_0x3323('0x1f')],_0x4f4762[_0x3323('0xd')][_0x3323('0x2b')],_0x4f4762[_0x3323('0x27')]['id'],![],_0x2a7bdb);if(rpc[_0x4f4762[_0x3323('0x24')]+_0x3323('0x2c')]){return rpc[_0x4f4762[_0x3323('0x24')]+_0x3323('0x2c')][_0x3323('0x31')](_0x18f77c,_0x1785f6)['catch'](function(_0x1c1f5b){logger[_0x3323('0x2f')](_0x3323('0x32'));});}}}function handleFindQueue(_0x3b5057){return function(_0x922c72){return _0x922c72[_0x3323('0x2b')]['toLowerCase']()===_0x3b5057[_0x3323('0x36')]();};}exports[_0x3323('0x37')]=function(_0x4ce5cd,_0x5dc7f0,_0x48623b,_0x228f54){return function(_0x5a862c){try{var _0x10448d={'name':_0x5dc7f0[0x0],'timeout':_0x5dc7f0[0x1]};var _0x5d9863=queue[_0x3323('0x0')](_0x10448d,{'typecast':!![]});if(_0x5d9863[_0x3323('0x38')]){logger['error'](_0x3323('0x39'),_0x4ce5cd,_['map'](_0x5d9863,_0x3323('0x27'))[_0x3323('0x3a')](',\x20'));_0x5a862c[_0x3323('0x3b')]();}else{var _0x12e3eb=_['find'](_0x48623b[_0x228f54[_0x3323('0x24')]+'Queues'],handleFindQueue(_0x10448d[_0x3323('0x2b')]));if(_0x12e3eb){startRouting(_0x4ce5cd,_0x12e3eb,_0x228f54,_0x48623b);var _0xcee4a5=(_0x12e3eb[_0x3323('0x34')]||0xa)*0x3e8;var _0xf25f80=(_0x10448d['timeout']||0x14)*0x3e8;var _0x5626c1,_0x185c8d;if(_0xcee4a5>_0xf25f80){_0xf25f80=_0xcee4a5;}var _0x5bffe9=seqqueue[_0x3323('0x3c')](_0xcee4a5);_0x5bffe9['id']=_0x4ce5cd;_0x5bffe9['atimeout']=_0xcee4a5;_0x5bffe9[_0x3323('0x3d')]=_0xf25f80;_0x5bffe9[_0x3323('0x24')]=_0x228f54[_0x3323('0x24')];_0x48623b[_0x3323('0x3e')][_0x4ce5cd]['on'](_0x3323('0x3f'),function(){logger[_0x3323('0x2a')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x4ce5cd);stopRouting(_0x4ce5cd,_0x12e3eb,_0x228f54,_0x48623b);clearTimeout(_0x5626c1);_0x5626c1=undefined;_0x5bffe9[_0x3323('0x40')](!![]);if(_0x48623b[_0x3323('0x3e')][_0x4ce5cd]){delete _0x48623b['rules'][_0x4ce5cd];}_0x5a862c['stop']();});_0x48623b[_0x3323('0x3e')][_0x4ce5cd]['on']('complete',function(){if(_0x48623b['rules'][_0x4ce5cd]){delete _0x48623b[_0x3323('0x3e')][_0x4ce5cd];}});_0x5626c1=setTimeout(function(){logger[_0x3323('0x2a')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x4ce5cd);endRouting(_0x4ce5cd,_0x12e3eb,_0x228f54,_0x48623b);clearTimeout(_0x5626c1);_0x5bffe9['close'](!![]);_0x5a862c[_0x3323('0x41')]();},_0xf25f80);switch(_0x12e3eb[_0x3323('0x42')]){case'rrmemory':strategy[_0x3323('0x43')](_0x5bffe9,_0x12e3eb,_0x48623b,_0x228f54);break;default:strategy[_0x3323('0x44')](_0x5bffe9,_0x12e3eb,_0x48623b,_0x228f54);}}else{logger[_0x3323('0x2f')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x4ce5cd,_0x10448d['name']);_0x5a862c[_0x3323('0x3b')]();}}}catch(_0x345b55){console['log'](_0x345b55);logger[_0x3323('0x2f')](_0x3323('0x39'),_0x4ce5cd,_0x345b55[_0x3323('0x45')]);_0x5a862c[_0x3323('0x3b')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index 115e030..2f4c654 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 _0x5b69=['push','bind','handleTimeout','timeout','handleDrained','prototype','handleRun','info','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','realtime','channel','busyQueue','showNotification','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busy','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','notificationId','squeue','agent','routing'];(function(_0x19e404,_0x2e6973){var _0x17728f=function(_0x54323f){while(--_0x54323f){_0x19e404['push'](_0x19e404['shift']());}};_0x17728f(++_0x2e6973);}(_0x5b69,0xd1));var _0x95b6=function(_0x16851c,_0x2f22fc){_0x16851c=_0x16851c-0x0;var _0x4cd143=_0x5b69[_0x16851c];return _0x4cd143;};'use strict';var _=require(_0x95b6('0x0'));var uuid=require(_0x95b6('0x1'));var util=require(_0x95b6('0x2'));var logger=require(_0x95b6('0x3'))('routing');var Agent=function(_0x3e1d0e,_0x1bb366,_0x59e42c,_0x3aa2a9){this[_0x95b6('0x4')]=uuid['v4']();this[_0x95b6('0x5')]=_0x3e1d0e;this[_0x95b6('0x6')]=_0x1bb366;this['realtime']=_0x59e42c;this[_0x95b6('0x7')]=_0x3aa2a9;this[_0x95b6('0x5')][_0x95b6('0x8')](this['handleRun'][_0x95b6('0x9')](this),this[_0x95b6('0xa')]['bind'](this));this[_0x95b6('0x5')]['on'](_0x95b6('0xb'),this[_0x95b6('0xa')][_0x95b6('0x9')](this));this['squeue']['on']('drained',this[_0x95b6('0xc')][_0x95b6('0x9')](this));};Agent[_0x95b6('0xd')][_0x95b6('0x8')]=function(){this[_0x95b6('0x5')]['push'](this[_0x95b6('0xe')][_0x95b6('0x9')](this),this['handleTimeout'][_0x95b6('0x9')](this));};Agent[_0x95b6('0xd')][_0x95b6('0xc')]=function(){this[_0x95b6('0xa')](!![]);};Agent[_0x95b6('0xd')][_0x95b6('0xe')]=function(_0x2241e8){logger[_0x95b6('0xf')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0x95b6('0x5')]['id'],this[_0x95b6('0x6')]['id']);if(_['isNil'](this['realtime'][_0x95b6('0x10')][this[_0x95b6('0x6')]['id']])){logger['info'](_0x95b6('0x11'),this[_0x95b6('0x5')]['id'],this[_0x95b6('0x6')]['id']);setTimeout(this[_0x95b6('0x8')][_0x95b6('0x9')](this),0x3e8);}else{if(this[_0x95b6('0x7')]['forcedOwnership']||util['isAgentAvailable'](this[_0x95b6('0x5')]['id'],this[_0x95b6('0x12')][_0x95b6('0x10')][this[_0x95b6('0x6')]['id']],this[_0x95b6('0x5')][_0x95b6('0x13')],![])){this['realtime']['agents'][this[_0x95b6('0x6')]['id']]['busy']=!![];this[_0x95b6('0x12')][_0x95b6('0x10')][this['agent']['id']][_0x95b6('0x14')]=undefined;util[_0x95b6('0x15')](this[_0x95b6('0x4')],this['squeue']['id'],this[_0x95b6('0x12')][_0x95b6('0x10')][this[_0x95b6('0x6')]['id']],null,this[_0x95b6('0x7')]);util['writeLog'](this[_0x95b6('0x5')]['id'],this[_0x95b6('0x12')]['agents'][this['agent']['id']],_0x95b6('0x16')+(this['routing']['forcedOwnership']?':FORCED':''));}else{logger[_0x95b6('0xf')](_0x95b6('0x17'),this[_0x95b6('0x5')]['id'],this['agent']['id']);setTimeout(this[_0x95b6('0x8')][_0x95b6('0x9')](this),0x3e8);}}};Agent[_0x95b6('0xd')][_0x95b6('0xa')]=function(_0x4371a7){if(_[_0x95b6('0x18')](this['realtime'][_0x95b6('0x10')][this[_0x95b6('0x6')]['id']])){return logger[_0x95b6('0xf')](_0x95b6('0x11'),this[_0x95b6('0x5')]['id'],this['agent']['id']);}else{logger[_0x95b6('0xf')](_0x95b6('0x19'),this[_0x95b6('0x5')]['id'],this[_0x95b6('0x6')]['id']);util[_0x95b6('0x1a')](this[_0x95b6('0x4')],this[_0x95b6('0x5')]['id'],this[_0x95b6('0x12')][_0x95b6('0x10')][this['agent']['id']],null,this[_0x95b6('0x7')]);this[_0x95b6('0x12')]['agents'][this['agent']['id']][_0x95b6('0x1b')]=![];this['realtime'][_0x95b6('0x10')][this['agent']['id']][_0x95b6('0x14')]=undefined;util['writeLog'](this[_0x95b6('0x5')]['id'],this[_0x95b6('0x12')]['agents'][this['agent']['id']],_0x4371a7?_0x95b6('0x1c'):_0x95b6('0x1d'));}if(!_0x4371a7){setTimeout(this[_0x95b6('0x8')][_0x95b6('0x9')](this),0x3e8);}};function agent(_0x227b18,_0x12e2be,_0x2fdf1d,_0xd0ecc8){return new Agent(_0x227b18,_0x12e2be,_0x2fdf1d,_0xd0ecc8);}module[_0x95b6('0x1e')]=agent; \ No newline at end of file +var _0x355d=['routing','push','bind','timeout','handleDrained','prototype','handleRun','handleTimeout','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busy','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busyQueue','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','notificationId','squeue','agent','realtime'];(function(_0x43a62d,_0x44367f){var _0x31e1f9=function(_0x35e322){while(--_0x35e322){_0x43a62d['push'](_0x43a62d['shift']());}};_0x31e1f9(++_0x44367f);}(_0x355d,0xa7));var _0xd355=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x355d[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xd355('0x0'));var uuid=require(_0xd355('0x1'));var util=require(_0xd355('0x2'));var logger=require(_0xd355('0x3'))('routing');var Agent=function(_0x2f9abe,_0x360c94,_0x455fe2,_0x16fcc7){this[_0xd355('0x4')]=uuid['v4']();this[_0xd355('0x5')]=_0x2f9abe;this[_0xd355('0x6')]=_0x360c94;this[_0xd355('0x7')]=_0x455fe2;this[_0xd355('0x8')]=_0x16fcc7;this[_0xd355('0x5')][_0xd355('0x9')](this['handleRun']['bind'](this),this['handleTimeout'][_0xd355('0xa')](this));this['squeue']['on'](_0xd355('0xb'),this['handleTimeout'][_0xd355('0xa')](this));this[_0xd355('0x5')]['on']('drained',this[_0xd355('0xc')][_0xd355('0xa')](this));};Agent[_0xd355('0xd')]['push']=function(){this[_0xd355('0x5')][_0xd355('0x9')](this[_0xd355('0xe')][_0xd355('0xa')](this),this[_0xd355('0xf')]['bind'](this));};Agent[_0xd355('0xd')][_0xd355('0xc')]=function(){this[_0xd355('0xf')](!![]);};Agent[_0xd355('0xd')][_0xd355('0xe')]=function(_0x22250c){logger[_0xd355('0x10')](_0xd355('0x11'),this['squeue']['id'],this[_0xd355('0x6')]['id']);if(_[_0xd355('0x12')](this['realtime'][_0xd355('0x13')][this[_0xd355('0x6')]['id']])){logger['info'](_0xd355('0x14'),this['squeue']['id'],this[_0xd355('0x6')]['id']);setTimeout(this[_0xd355('0x9')]['bind'](this),0x3e8);}else{if(this['routing'][_0xd355('0x15')]||util[_0xd355('0x16')](this[_0xd355('0x5')]['id'],this[_0xd355('0x7')][_0xd355('0x13')][this['agent']['id']],this[_0xd355('0x5')][_0xd355('0x17')],![])){this[_0xd355('0x7')][_0xd355('0x13')][this[_0xd355('0x6')]['id']][_0xd355('0x18')]=!![];this[_0xd355('0x7')]['agents'][this[_0xd355('0x6')]['id']]['busyQueue']=undefined;util[_0xd355('0x19')](this[_0xd355('0x4')],this[_0xd355('0x5')]['id'],this[_0xd355('0x7')][_0xd355('0x13')][this[_0xd355('0x6')]['id']],null,this[_0xd355('0x8')]);util[_0xd355('0x1a')](this[_0xd355('0x5')]['id'],this['realtime'][_0xd355('0x13')][this[_0xd355('0x6')]['id']],_0xd355('0x1b')+(this['routing'][_0xd355('0x15')]?_0xd355('0x1c'):''));}else{logger[_0xd355('0x10')](_0xd355('0x1d'),this[_0xd355('0x5')]['id'],this[_0xd355('0x6')]['id']);setTimeout(this['push'][_0xd355('0xa')](this),0x3e8);}}};Agent[_0xd355('0xd')]['handleTimeout']=function(_0x280aee){if(_[_0xd355('0x12')](this['realtime'][_0xd355('0x13')][this[_0xd355('0x6')]['id']])){return logger[_0xd355('0x10')](_0xd355('0x14'),this[_0xd355('0x5')]['id'],this[_0xd355('0x6')]['id']);}else{logger[_0xd355('0x10')](_0xd355('0x1e'),this[_0xd355('0x5')]['id'],this[_0xd355('0x6')]['id']);util[_0xd355('0x1f')](this['notificationId'],this[_0xd355('0x5')]['id'],this[_0xd355('0x7')][_0xd355('0x13')][this[_0xd355('0x6')]['id']],null,this['routing']);this['realtime']['agents'][this['agent']['id']][_0xd355('0x18')]=![];this['realtime']['agents'][this[_0xd355('0x6')]['id']][_0xd355('0x20')]=undefined;util[_0xd355('0x1a')](this[_0xd355('0x5')]['id'],this[_0xd355('0x7')][_0xd355('0x13')][this[_0xd355('0x6')]['id']],_0x280aee?'STOP':_0xd355('0x21'));}if(!_0x280aee){setTimeout(this['push'][_0xd355('0xa')](this),0x3e8);}};function agent(_0x221656,_0x4aacfd,_0x9933ec,_0x363fe6){return new Agent(_0x221656,_0x4aacfd,_0x9933ec,_0x363fe6);}module[_0xd355('0x22')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index cb8d37e..5b53e53 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 _0xeedf=['[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','channel','writeLog','RINGING','busy','busyQueue','name','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','TIMEOUT','exports','lodash','uuid','./util','routing','notificationId','queue','realtime','squeue','handleRun','handleTimeout','bind','drained','prototype','push','handleDrained','isNil','Agents','length','agents','info'];(function(_0x284506,_0x191316){var _0x1e9ee5=function(_0xe7eaa){while(--_0xe7eaa){_0x284506['push'](_0x284506['shift']());}};_0x1e9ee5(++_0x191316);}(_0xeedf,0x12c));var _0xfeed=function(_0x2121dd,_0x57dd90){_0x2121dd=_0x2121dd-0x0;var _0x1bc6da=_0xeedf[_0x2121dd];return _0x1bc6da;};'use strict';var _=require(_0xfeed('0x0'));var uuid=require(_0xfeed('0x1'));var util=require(_0xfeed('0x2'));var logger=require('../../../../../config/logger')(_0xfeed('0x3'));var Beepall=function(_0x522c8e,_0x426cf2,_0x1cdbd0,_0x2b78f1){this[_0xfeed('0x4')]=uuid['v4']();this['squeue']=_0x522c8e;this[_0xfeed('0x5')]=_0x426cf2;this[_0xfeed('0x6')]=_0x1cdbd0;this['routing']=_0x2b78f1;this[_0xfeed('0x7')]['push'](this[_0xfeed('0x8')]['bind'](this),this[_0xfeed('0x9')]['bind'](this));this['squeue']['on']('timeout',this[_0xfeed('0x9')][_0xfeed('0xa')](this));this[_0xfeed('0x7')]['on'](_0xfeed('0xb'),this['handleDrained'][_0xfeed('0xa')](this));};Beepall[_0xfeed('0xc')][_0xfeed('0xd')]=function(){this[_0xfeed('0x7')]['push'](this['handleRun'][_0xfeed('0xa')](this),this[_0xfeed('0x9')][_0xfeed('0xa')](this));};Beepall[_0xfeed('0xc')][_0xfeed('0xe')]=function(_0x36a842){this['handleTimeout'](!![]);};Beepall[_0xfeed('0xc')][_0xfeed('0x8')]=function(_0x44cc75){var _0x2d05d4=!![];if(!_[_0xfeed('0xf')](this[_0xfeed('0x5')])&&!_[_0xfeed('0xf')](this[_0xfeed('0x5')][_0xfeed('0x10')])&&this[_0xfeed('0x5')][_0xfeed('0x10')][_0xfeed('0x11')]>0x0){for(var _0x17c1e5=0x0,_0x129a24;_0x17c1e50x0){for(var _0x11c759=0x0,_0x4357e3;_0x11c7590x0&&_0x491623[_0xa95e91+_0xb687('0x26')]>=_0x491623[_0xa95e91+_0xb687('0x25')]){writeLog(_0x1dc06b,_0x491623,_0xa95e91[_0xb687('0x27')]()+_0xb687('0x28'));return![];}}return!![];};exports['showNotification']=function(_0x3712cf,_0x192966,_0x392721,_0x265a4b,_0x2e5c8d){return sendNotification(!![],_0x3712cf,_0x192966,_0x392721,_0x265a4b,_0x2e5c8d);};exports[_0xb687('0x29')]=function(_0x4e9a06,_0x28b69a,_0x5143af,_0x360429,_0x40f35c){return sendNotification(![],_0x4e9a06,_0x28b69a,_0x5143af,_0x360429,_0x40f35c);};exports[_0xb687('0x2a')]=writeLog; \ No newline at end of file +var _0x5d58=['Pause','PAUSE','hasOwnProperty','Capacity','toUpperCase','\x20MAXCAPACITY','../../../../../config/environment','../../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','user:save','split','\x20interaction','account','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','format','[%s][QUEUE]\x20%s','message','user:%s','name','save','remove','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','OFFLINE'];(function(_0x4f3350,_0x1d42c6){var _0x5051f7=function(_0xa56ea4){while(--_0xa56ea4){_0x4f3350['push'](_0x4f3350['shift']());}};_0x5051f7(++_0x1d42c6);}(_0x5d58,0x187));var _0x85d5=function(_0x2b36ec,_0x3056f2){_0x2b36ec=_0x2b36ec-0x0;var _0x38d85c=_0x5d58[_0x2b36ec];return _0x38d85c;};'use strict';var _=require('lodash');var util=require('util');var utils=require('../utils');var Mustache=require('mustache');var Redis=require('ioredis');var config=require(_0x85d5('0x0'));var logger=require(_0x85d5('0x1'))('routing');config[_0x85d5('0x2')]=_[_0x85d5('0x3')](config['redis'],{'host':_0x85d5('0x4'),'port':0x18eb});var io=require(_0x85d5('0x5'))(new Redis(config[_0x85d5('0x2')]));function emit(_0x46e7b4,_0x5f47ec,_0x98c963){io['to'](_0x46e7b4)[_0x85d5('0x6')](_0x5f47ec,_0x98c963);}function sendNotification(_0x4ca293,_0x4326a8,_0x4eb3ae,_0x1098be,_0x2ce6b9,_0x258f0c){io['to'](util['format']('user:%s',_0x1098be['name']))[_0x85d5('0x6')](_0x85d5('0x7'),_0x1098be);var _0xde1063=_0x258f0c||{};var _0x25369e=_0x4eb3ae[_0x85d5('0x8')]('.');var _0x18331f={'uniqueid':_0x4326a8,'channel':_0x25369e[0x0],'id':_0x25369e[0x1],'title':_0x25369e[0x0]+_0x85d5('0x9'),'interactionId':_0x25369e[0x2],'queue':_0x2ce6b9?_0x2ce6b9['name']:null,'sound':_0xde1063['account']['notificationSound'],'shake':_0xde1063[_0x85d5('0xa')][_0x85d5('0xb')]};try{if(!_0xde1063[_0x85d5('0xc')]){_0xde1063[_0x85d5('0xc')]={};}if(_0x2ce6b9){_0xde1063[_0x85d5('0xc')][_0x85d5('0xd')]=_0x2ce6b9;}else if(_0xde1063[_0x85d5('0xc')]['queue']){delete _0xde1063[_0x85d5('0xc')][_0x85d5('0xd')];}_0x18331f[_0x85d5('0xe')]=utils[_0x85d5('0xf')](_0xde1063[_0x85d5('0xa')][_0x85d5('0x10')],_0xde1063);}catch(_0x2dbf13){_0x18331f[_0x85d5('0xe')]=_0x85d5('0x11');logger[_0x85d5('0x12')](util[_0x85d5('0x13')](_0x85d5('0x14'),_0x4326a8,_0x2dbf13[_0x85d5('0x15')]));}io['to'](util[_0x85d5('0x13')](_0x85d5('0x16'),_0x1098be[_0x85d5('0x17')]))[_0x85d5('0x6')](util[_0x85d5('0x13')]('notification:%s',_0x4ca293?_0x85d5('0x18'):_0x85d5('0x19')),_0x18331f);}function writeLog(_0x5f5755,_0x231b57,_0x1264ca){return logger['info'](util['format'](_0x85d5('0x1a'),_0x5f5755,_0x231b57['name'],_0x1264ca));}exports[_0x85d5('0x1b')]=function(_0x5ce96e,_0x240000,_0x1f8d27,_0x560b3a){if(_0x240000['busy']){writeLog(_0x5ce96e,_0x240000,'BUSY');return![];}if(!_0x240000['online']){writeLog(_0x5ce96e,_0x240000,_0x85d5('0x1c'));return![];}if(_0x240000[_0x1f8d27+_0x85d5('0x1d')]){writeLog(_0x5ce96e,_0x240000,_0x85d5('0x1e'));return![];}if(_0x560b3a&&_0x240000[_0x85d5('0x1f')](_0x1f8d27+_0x85d5('0x20'))&&_0x240000[_0x85d5('0x1f')](_0x1f8d27+'CurrentCapacity')){if(_0x240000[_0x1f8d27+_0x85d5('0x20')]>0x0&&_0x240000[_0x1f8d27+'CurrentCapacity']>=_0x240000[_0x1f8d27+_0x85d5('0x20')]){writeLog(_0x5ce96e,_0x240000,_0x1f8d27[_0x85d5('0x21')]()+_0x85d5('0x22'));return![];}}return!![];};exports['showNotification']=function(_0x2d0497,_0x367704,_0x815808,_0x370c97,_0x4605c5){return sendNotification(!![],_0x2d0497,_0x367704,_0x815808,_0x370c97,_0x4605c5);};exports['hideNotification']=function(_0x1cbef1,_0x476c8b,_0x330f8a,_0x22a961,_0x43ac91){return sendNotification(![],_0x1cbef1,_0x476c8b,_0x330f8a,_0x22a961,_0x43ac91);};exports['writeLog']=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index 073ba97..74d4a18 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 _0xb05c=['lodash','./utils','../../../../config/logger','string','consequence','error','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','trim','replace','isNil','isEmpty','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify'];(function(_0x2101a3,_0x15a747){var _0x16038b=function(_0x502957){while(--_0x502957){_0x2101a3['push'](_0x2101a3['shift']());}};_0x16038b(++_0x15a747);}(_0xb05c,0x1cc));var _0xcb05=function(_0x5d4510,_0x5aa2c8){_0x5d4510=_0x5d4510-0x0;var _0x3dfae0=_0xb05c[_0x5d4510];return _0x3dfae0;};'use strict';var schema=require('validate');var sh=require('shelljs');var _=require(_0xcb05('0x0'));var utils=require(_0xcb05('0x1'));var logger=require(_0xcb05('0x2'))('routing');var system=schema({'command':{'type':_0xcb05('0x3'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xcb05('0x4')]=function(_0x184025,_0x25f434){return function(_0x3dba3a){try{var _0x6fe3b6={'command':_0x25f434[0x0]};var _0x4c71ec=system['validate'](_0x6fe3b6,{'typecast':!![]});if(_0x4c71ec['length']){logger[_0xcb05('0x5')](_0xcb05('0x6'),_0x184025,_[_0xcb05('0x7')](_0x4c71ec,_0xcb05('0x8'))[_0xcb05('0x9')](',\x20'));logger[_0xcb05('0xa')](_0xcb05('0xb'),_0x184025);_0x3dba3a[_0xcb05('0xc')]();}else{var _0x2df631=this;var _0x34e61f=utils[_0xcb05('0xd')](_0x25f434[0x0],this);logger[_0xcb05('0xa')](_0xcb05('0xe'),_0x184025,_0x34e61f);sh['exec'](_[_0xcb05('0xf')](_0x34e61f),function(_0x243112,_0x528a6d){logger[_0xcb05('0xa')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x184025,_0x243112);if(_0x243112==0x0){var _0x30b4c9=_0x528a6d[_0xcb05('0x10')](/(\r\n|\n|\r)/gm,'');if(_[_0xcb05('0x11')](_0x25f434[0x1])||_[_0xcb05('0x12')](_0x25f434[0x1])){logger['info']('[%s][SYSTEM]\x20no\x20variable',_0x184025);_0x2df631[_0xcb05('0x13')][_0x25f434[0x1]]=_0x30b4c9;}else{logger[_0xcb05('0xa')](_0xcb05('0x14'),_0x184025,_0x25f434[0x1],_0x30b4c9);_0x2df631[_0xcb05('0x13')][_0x25f434[0x1]]=_0x30b4c9;}}_0x3dba3a['next']();});}}catch(_0x281299){logger['error'](_0xcb05('0x6'),_0x184025,_[_0xcb05('0x15')](_0x281299)?JSON[_0xcb05('0x16')](_0x281299):_0x281299);logger[_0xcb05('0xa')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x184025);_0x3dba3a['next']();}};}; \ No newline at end of file +var _0x014e=['isEmpty','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','error','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s'];(function(_0x1eb97a,_0x1227d2){var _0x204f4f=function(_0x14d022){while(--_0x14d022){_0x1eb97a['push'](_0x1eb97a['shift']());}};_0x204f4f(++_0x1227d2);}(_0x014e,0x16d));var _0xe014=function(_0x248658,_0x31f531){_0x248658=_0x248658-0x0;var _0x476768=_0x014e[_0x248658];return _0x476768;};'use strict';var schema=require('validate');var sh=require(_0xe014('0x0'));var _=require(_0xe014('0x1'));var utils=require(_0xe014('0x2'));var logger=require(_0xe014('0x3'))(_0xe014('0x4'));var system=schema({'command':{'type':_0xe014('0x5'),'required':!![],'message':_0xe014('0x6')}});exports[_0xe014('0x7')]=function(_0x31c63b,_0x595525){return function(_0x1e04b5){try{var _0x22ff25={'command':_0x595525[0x0]};var _0x16f81f=system[_0xe014('0x8')](_0x22ff25,{'typecast':!![]});if(_0x16f81f[_0xe014('0x9')]){logger[_0xe014('0xa')]('[%s][SYSTEM]\x20%s',_0x31c63b,_[_0xe014('0xb')](_0x16f81f,_0xe014('0xc'))[_0xe014('0xd')](',\x20'));logger[_0xe014('0xe')](_0xe014('0xf'),_0x31c63b);_0x1e04b5[_0xe014('0x10')]();}else{var _0x29d98d=this;var _0x121a6e=utils[_0xe014('0x11')](_0x595525[0x0],this);logger[_0xe014('0xe')](_0xe014('0x12'),_0x31c63b,_0x121a6e);sh['exec'](_['trim'](_0x121a6e),function(_0x380adc,_0x217a6e){logger[_0xe014('0xe')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x31c63b,_0x380adc);if(_0x380adc==0x0){var _0x2033d6=_0x217a6e['replace'](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x595525[0x1])||_[_0xe014('0x13')](_0x595525[0x1])){logger[_0xe014('0xe')]('[%s][SYSTEM]\x20no\x20variable',_0x31c63b);_0x29d98d[_0xe014('0x14')][_0x595525[0x1]]=_0x2033d6;}else{logger[_0xe014('0xe')](_0xe014('0x15'),_0x31c63b,_0x595525[0x1],_0x2033d6);_0x29d98d[_0xe014('0x14')][_0x595525[0x1]]=_0x2033d6;}}_0x1e04b5[_0xe014('0x10')]();});}}catch(_0x3ba210){logger['error']('[%s][SYSTEM]\x20%s',_0x31c63b,_[_0xe014('0x16')](_0x3ba210)?JSON[_0xe014('0x17')](_0x3ba210):_0x3ba210);logger[_0xe014('0xe')](_0xe014('0xf'),_0x31c63b);_0x1e04b5[_0xe014('0x10')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index d9a4b45..a1e788f 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 _0x9047=['message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','interaction','then','catch','error','[%s][TAG]\x20%s','stringify','finally','validate','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length'];(function(_0x3b2d81,_0x3a5ee8){var _0x1ac262=function(_0xb01f3c){while(--_0xb01f3c){_0x3b2d81['push'](_0x3b2d81['shift']());}};_0x1ac262(++_0x3a5ee8);}(_0x9047,0xde));var _0x7904=function(_0x564613,_0x2f32bc){_0x564613=_0x564613-0x0;var _0x5651bb=_0x9047[_0x564613];return _0x5651bb;};'use strict';var schema=require(_0x7904('0x0'));var _=require(_0x7904('0x1'));var rpc={'chatInteraction':require(_0x7904('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x7904('0x3')),'mailInteraction':require(_0x7904('0x4')),'faxInteraction':require(_0x7904('0x5')),'whatsappInteraction':require(_0x7904('0x6'))};var logger=require('../../../../config/logger')(_0x7904('0x7'));var tag=schema({'tag':{'type':_0x7904('0x8'),'required':!![],'message':_0x7904('0x9')}});exports[_0x7904('0xa')]=function(_0x2dd491,_0x388816,_0x1a02b2,_0x67f44a){return function(_0x36a820){try{var _0x92fb6e={'tag':_0x388816[0x0]};var _0x179eab=tag[_0x7904('0x0')](_0x92fb6e,{'typecast':!![]});if(_0x179eab[_0x7904('0xb')]){logger['error']('[%s][TAG]\x20%s',_0x2dd491,_['map'](_0x179eab,_0x7904('0xc'))[_0x7904('0xd')](',\x20'));logger[_0x7904('0xe')](_0x7904('0xf'),_0x2dd491);_0x36a820[_0x7904('0x10')]();}else{var _0x28d78e={'ids':[_0x388816[0x0]]};if(rpc[_0x67f44a['channel']+'Interaction']){rpc[_0x67f44a[_0x7904('0x11')]+_0x7904('0x12')]['addTags'](_0x67f44a[_0x7904('0x13')]['id'],_0x28d78e)[_0x7904('0x14')](function(_0x1bfdcc){logger[_0x7904('0xe')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x2dd491,_0x388816[0x1],_0x67f44a[_0x7904('0x11')],_0x67f44a['interaction']['id']);})[_0x7904('0x15')](function(_0x10614e){logger[_0x7904('0x16')](_0x7904('0x17'),_0x2dd491,JSON[_0x7904('0x18')](_0x10614e));logger['info'](_0x7904('0xf'),_0x2dd491);})[_0x7904('0x19')](function(){_0x36a820[_0x7904('0x10')]();});}}}catch(_0x399225){logger[_0x7904('0x16')](_0x7904('0x17'),_0x2dd491,_['isObject'](_0x399225)?JSON[_0x7904('0x18')](_0x399225):_0x399225);logger[_0x7904('0xe')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x2dd491);_0x36a820[_0x7904('0x10')]();}};}; \ No newline at end of file +var _0x9cc5=['../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','[%s][TAG]\x20%s','map','message','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','Interaction','addTags','then','interaction','catch','error','stringify','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction'];(function(_0x46de0a,_0x21c0d3){var _0x244f92=function(_0x5edb09){while(--_0x5edb09){_0x46de0a['push'](_0x46de0a['shift']());}};_0x244f92(++_0x21c0d3);}(_0x9cc5,0xd4));var _0x59cc=function(_0x4c0695,_0x1f9dc0){_0x4c0695=_0x4c0695-0x0;var _0x5cecc3=_0x9cc5[_0x4c0695];return _0x5cecc3;};'use strict';var schema=require(_0x59cc('0x0'));var _=require(_0x59cc('0x1'));var rpc={'chatInteraction':require(_0x59cc('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x59cc('0x3')),'mailInteraction':require(_0x59cc('0x4')),'faxInteraction':require(_0x59cc('0x5')),'whatsappInteraction':require(_0x59cc('0x6'))};var logger=require(_0x59cc('0x7'))(_0x59cc('0x8'));var tag=schema({'tag':{'type':_0x59cc('0x9'),'required':!![],'message':_0x59cc('0xa')}});exports[_0x59cc('0xb')]=function(_0x46cf90,_0x4f5c74,_0x49fa62,_0x107934){return function(_0x35d6f4){try{var _0x4e2f80={'tag':_0x4f5c74[0x0]};var _0x1023bc=tag[_0x59cc('0x0')](_0x4e2f80,{'typecast':!![]});if(_0x1023bc[_0x59cc('0xc')]){logger['error'](_0x59cc('0xd'),_0x46cf90,_[_0x59cc('0xe')](_0x1023bc,_0x59cc('0xf'))['join'](',\x20'));logger[_0x59cc('0x10')](_0x59cc('0x11'),_0x46cf90);_0x35d6f4[_0x59cc('0x12')]();}else{var _0x3b0677={'ids':[_0x4f5c74[0x0]]};if(rpc[_0x107934['channel']+_0x59cc('0x13')]){rpc[_0x107934['channel']+_0x59cc('0x13')][_0x59cc('0x14')](_0x107934['interaction']['id'],_0x3b0677)[_0x59cc('0x15')](function(_0x5e62c2){logger['info']('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x46cf90,_0x4f5c74[0x1],_0x107934['channel'],_0x107934[_0x59cc('0x16')]['id']);})[_0x59cc('0x17')](function(_0x3ed0e3){logger[_0x59cc('0x18')]('[%s][TAG]\x20%s',_0x46cf90,JSON[_0x59cc('0x19')](_0x3ed0e3));logger['info'](_0x59cc('0x11'),_0x46cf90);})['finally'](function(){_0x35d6f4[_0x59cc('0x12')]();});}}}catch(_0x3e04ec){logger[_0x59cc('0x18')](_0x59cc('0xd'),_0x46cf90,_[_0x59cc('0x1a')](_0x3e04ec)?JSON[_0x59cc('0x19')](_0x3e04ec):_0x3e04ec);logger[_0x59cc('0x10')](_0x59cc('0x11'),_0x46cf90);_0x35d6f4[_0x59cc('0x12')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index efd635d..e3097f1 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['merge','body','account','list','exports','render'];(function(_0x1cdc60,_0x355449){var _0x10efe1=function(_0x2bb5d3){while(--_0x2bb5d3){_0x1cdc60['push'](_0x1cdc60['shift']());}};_0x10efe1(++_0x355449);}(_0x9c44,0x178));var _0x49c4=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x9c44[_0x209941];return _0x1e8729;};'use strict';var Mustache=require('mustache');var _=require('lodash');module[_0x49c4('0x0')]={'getMustacheRender':function(_0x18bf2d,_0x26844b){return Mustache[_0x49c4('0x1')](_0x18bf2d,_[_0x49c4('0x2')](_0x26844b[_0x49c4('0x3')],{'contact':_0x26844b['contact'],'message':_0x26844b['message'],'account':_0x26844b[_0x49c4('0x4')],'interaction':_0x26844b['interaction'],'list':_0x26844b[_0x49c4('0x5')]}))||'';}}; \ No newline at end of file +var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x6665e1,_0x31907e){var _0x4faea0=function(_0x34aa4b){while(--_0x34aa4b){_0x6665e1['push'](_0x6665e1['shift']());}};_0x4faea0(++_0x31907e);}(_0xe706,0xa3));var _0x6e70=function(_0x9edfd5,_0x286486){_0x9edfd5=_0x9edfd5-0x0;var _0x330738=_0xe706[_0x9edfd5];return _0x330738;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 39f3e4e..8483e13 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 _0x4113=['values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','uuid','../../../config/environment','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/whatsappQueueReport','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','applications','length','existsSync','join','app','.js','toLowerCase','split','mail','push','dialogflow','appdata','slice','dialogflowv2','amazonlex','tag','TagId','%s:%s:%s','./interval','condition','intervals','priority','info','Push\x20new\x20rule','on\x20interval','Please\x20create\x20a\x20new\x20file\x20under','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','error','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','QueueReport','catch','message\x20is\x20empty','end','hasOwnProperty','capacity','updateRealtime'];(function(_0x17f3f7,_0x42b5f4){var _0x15b9ec=function(_0x54f7fa){while(--_0x54f7fa){_0x17f3f7['push'](_0x17f3f7['shift']());}};_0x15b9ec(++_0x42b5f4);}(_0x4113,0x18a));var _0x3411=function(_0x3db978,_0x8f23c9){_0x3db978=_0x3db978-0x0;var _0x397749=_0x4113[_0x3db978];return _0x397749;};'use strict';var _=require(_0x3411('0x0'));var util=require(_0x3411('0x1'));var path=require(_0x3411('0x2'));var fs=require('fs');var jayson=require(_0x3411('0x3'));var BPromise=require(_0x3411('0x4'));var uuid=require(_0x3411('0x5'));var config=require(_0x3411('0x6'));var logger=require(_0x3411('0x7'))(_0x3411('0x8'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x3411('0x9')),'chatQueueReport':require(_0x3411('0xa')),'smsQueueReport':require(_0x3411('0xb')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x3411('0xc'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x158aea,_0x359d29,_0x2c8445){return util[_0x3411('0xd')](_0x3411('0xe'),_0x158aea,_0x359d29||0x0,_0x2c8445||0x0);}function getIntervals(_0x52715f,_0x32bb64){var _0x460546=[];if(!_[_0x3411('0xf')](_0x32bb64[_0x3411('0x10')])&&!_[_0x3411('0xf')](_0x52715f[_0x32bb64[_0x3411('0x10')]])&&!_[_0x3411('0xf')](_0x52715f[_0x32bb64[_0x3411('0x10')]][_0x3411('0x11')])){_0x460546=_[_0x3411('0x12')](_0x52715f[_0x32bb64[_0x3411('0x10')]][_0x3411('0x11')],_0x3411('0x13'));}else if(!_[_0x3411('0xf')](_0x32bb64[_0x3411('0x13')])){_0x460546=[_0x32bb64[_0x3411('0x13')]];}return _0x460546;}exports[_0x3411('0x14')]=function(_0x44275f){_0x44275f[_0x3411('0x15')]={};return new BPromise(function(_0x607f07,_0x4ab0d0){var _0x191b73={'Start':function(_0x49c38c){var _0x1b7015=this;return new Promise(function(_0x28007d,_0x566167){if(_0x49c38c){try{var _0x305b34=[];var _0x22c09c=getId(_0x49c38c[_0x3411('0x16')],_0x49c38c['message']?_0x49c38c[_0x3411('0x17')]['id']:0x0,_0x49c38c[_0x3411('0x18')]?_0x49c38c['interaction']['id']:0x0);if(_0x49c38c[_0x3411('0x19')]&&_['isArray'](_0x49c38c[_0x3411('0x19')])&&_0x49c38c[_0x3411('0x19')][_0x3411('0x1a')]){for(var _0x4ce57c=0x0;_0x4ce57c<_0x49c38c[_0x3411('0x19')][_0x3411('0x1a')];_0x4ce57c+=0x1){var _0x1fe956=_0x49c38c[_0x3411('0x19')][_0x4ce57c];if(fs[_0x3411('0x1b')](path[_0x3411('0x1c')](__dirname,_0x3411('0x19'),_0x1fe956[_0x3411('0x1d')]+_0x3411('0x1e')))){var _0xa07c7b=[];switch(_0x1fe956['app'][_0x3411('0x1f')]()){case'autoreply':var _0x25ea12=_0x1fe956['appdata'][_0x3411('0x20')](',');if(_0x49c38c[_0x3411('0x16')]===_0x3411('0x21')){_0xa07c7b[_0x3411('0x22')](_0x25ea12[0x0]);_0xa07c7b[_0x3411('0x22')](_0x25ea12[0x1]);_0xa07c7b['push'](_0x25ea12['slice'](0x2,_0x25ea12['length'])[_0x3411('0x1c')](','));}else{_0xa07c7b[_0x3411('0x22')](_0x25ea12[0x0]);_0xa07c7b[_0x3411('0x22')](_0x25ea12['slice'](0x1,_0x25ea12[_0x3411('0x1a')])['join'](','));}break;case _0x3411('0x23'):var _0x541bbe=_0x1fe956[_0x3411('0x24')][_0x3411('0x20')](',');_0xa07c7b[_0x3411('0x22')](_0x541bbe[0x0]);_0xa07c7b[_0x3411('0x22')](_0x541bbe[0x1]);_0xa07c7b['push'](_0x541bbe[_0x3411('0x25')](0x2,_0x541bbe['length'])['join'](','));break;case _0x3411('0x26'):var _0x1ef582=_0x1fe956[_0x3411('0x24')]['split'](',');_0xa07c7b[_0x3411('0x22')](_0x1ef582[0x0]);_0xa07c7b[_0x3411('0x22')](_0x1ef582[0x1]);_0xa07c7b[_0x3411('0x22')](_0x1ef582[0x2]);_0xa07c7b[_0x3411('0x22')](_0x1ef582[0x3]);_0xa07c7b[_0x3411('0x22')](_0x1ef582[_0x3411('0x25')](0x4,_0x1ef582[_0x3411('0x1a')])[_0x3411('0x1c')](','));break;case _0x3411('0x27'):var _0x448b1c=_0x1fe956[_0x3411('0x24')][_0x3411('0x20')](',');_0xa07c7b[_0x3411('0x22')](_0x448b1c[0x0]);_0xa07c7b[_0x3411('0x22')](_0x448b1c[0x1]);_0xa07c7b[_0x3411('0x22')](_0x448b1c[0x2]);_0xa07c7b[_0x3411('0x22')](_0x448b1c[0x3]);_0xa07c7b['push'](_0x448b1c[_0x3411('0x25')](0x4,_0x448b1c[_0x3411('0x1a')])[_0x3411('0x1c')](','));break;case _0x3411('0x17'):_0xa07c7b[_0x3411('0x22')](_0x1fe956['appdata']);break;case _0x3411('0x28'):_0xa07c7b[_0x3411('0x22')](_0x1fe956[_0x3411('0x29')]);_0xa07c7b[_0x3411('0x22')](_0x1fe956[_0x3411('0x24')]);break;default:_0xa07c7b=_['isNil'](_0x1fe956[_0x3411('0x24')])?[]:_0x1fe956['appdata'][_0x3411('0x20')](',');}var _0x52ee22={'id':util['format'](_0x3411('0x2a'),_0x22c09c,_0x1fe956['id'],_0x1fe956[_0x3411('0x1d')]),'condition':require(_0x3411('0x2b'))[_0x3411('0x2c')](_0x22c09c,getIntervals(_0x44275f[_0x3411('0x2d')],_0x1fe956),_0x44275f),'consequence':require('./applications/'+_0x1fe956[_0x3411('0x1d')])['consequence'](_0x22c09c,_0xa07c7b,_0x44275f,_0x49c38c),'p':_0x1fe956[_0x3411('0x2e')]||0x0};logger[_0x3411('0x2f')](_0x3411('0x30'),_0x52ee22['id'],_0x3411('0x31'),getIntervals(_0x44275f[_0x3411('0x2d')],_0x1fe956)[_0x3411('0x1c')]('\x20|\x20'));_0x305b34[_0x3411('0x22')](_0x52ee22);}else{logger['error'](_0x3411('0x32'),path[_0x3411('0x1c')](__dirname,_0x3411('0x19'),_0x1fe956[_0x3411('0x1d')]+_0x3411('0x1e')));}}_0x44275f[_0x3411('0x15')][_0x22c09c]=new RuleEngine(_0x305b34);_0x44275f[_0x3411('0x15')][_0x22c09c]['execute'](_0x49c38c,function(_0x5b4760){logger[_0x3411('0x2f')](_0x3411('0x33'),JSON[_0x3411('0x34')](_0x5b4760[_0x3411('0x35')]));if(_0x44275f[_0x3411('0x15')][_0x22c09c]){_0x44275f[_0x3411('0x15')][_0x22c09c][_0x3411('0x36')](_0x3411('0x37'));}});return _0x28007d({'code':0xc8,'message':_0x49c38c});}else{logger[_0x3411('0x2f')](_0x3411('0x38'));return _0x28007d({'code':0xc8,'message':_0x49c38c});}}catch(_0x469f0e){logger[_0x3411('0x39')](_0x469f0e[_0x3411('0x3a')]);return _0x566167(_0x1b7015['error'](0x1f4,_0x469f0e));}}return _0x566167(_0x3411('0x3b'));});},'AcceptMessage':function(_0x859b00){var _0x3a93dc=this;return new Promise(function(_0x5540b9,_0x2d8920){if(_0x859b00[_0x3411('0x3c')]&&_0x859b00[_0x3411('0x3c')]['id']){if(_0x44275f['agents'][_0x859b00['agent']['id']]){_0x44275f[_0x3411('0x3d')][_0x859b00[_0x3411('0x3c')]['id']][_0x3411('0x3e')]=![];_0x44275f[_0x3411('0x3d')][_0x859b00[_0x3411('0x3c')]['id']][_0x3411('0x3f')]=undefined;}}if(_0x859b00[_0x3411('0x17')]&&_0x859b00['message']['id']){try{var _0x179734=getId(_0x859b00[_0x3411('0x16')],_0x859b00['message']?_0x859b00[_0x3411('0x17')]['id']:0x0,_0x859b00['interaction']?_0x859b00['interaction']['id']:0x0);if(_0x44275f[_0x3411('0x15')][_0x179734]){_0x44275f[_0x3411('0x15')][_0x179734][_0x3411('0x36')]('end');if(rpc[_0x859b00[_0x3411('0x16')]+_0x3411('0x40')]){rpc[_0x859b00['channel']+'QueueReport']['update'](_0x179734,{'UserId':_0x859b00[_0x3411('0x17')]['UserId']})[_0x3411('0x41')](function(_0x3dc651){logger[_0x3411('0x39')]('error\x20update\x20queue\x20report');});}}return _0x5540b9({'code':0xc8,'message':_0x859b00});}catch(_0x3bd21a){logger[_0x3411('0x39')](_0x3bd21a[_0x3411('0x3a')]);return _0x2d8920(_0x3a93dc['error'](0x1f4,_0x3bd21a));}}logger['error'](_0x3411('0x42'));return _0x2d8920(_0x3a93dc[_0x3411('0x39')](0x1f4,_0x3411('0x42')));});},'RejectMessage':function(_0x201cf5){var _0x2d71b2=this;return new Promise(function(_0x4b3620,_0x2aabbb){if(_0x201cf5['agent']&&_0x201cf5[_0x3411('0x3c')]['id']){try{if(_0x44275f[_0x3411('0x3d')][_0x201cf5[_0x3411('0x3c')]['id']]){_0x44275f['agents'][_0x201cf5[_0x3411('0x3c')]['id']][_0x3411('0x3e')]=![];_0x44275f[_0x3411('0x3d')][_0x201cf5[_0x3411('0x3c')]['id']][_0x3411('0x3f')]=undefined;}return _0x4b3620({'code':0xc8,'message':_0x201cf5});}catch(_0x48d245){logger['error'](_0x48d245[_0x3411('0x3a')]);return _0x2aabbb(_0x2d71b2[_0x3411('0x39')](0x1f4,_0x48d245));}}logger[_0x3411('0x39')](_0x3411('0x42'));return _0x2aabbb(_0x2d71b2[_0x3411('0x39')](0x1f4,_0x3411('0x42')));});},'AbandonInteraction':function(_0x969d75){var _0x5f4067=this;return new Promise(function(_0x3b0a6b,_0x5d192d){if(_0x969d75['channel']&&_0x969d75[_0x3411('0x18')]&&_0x969d75[_0x3411('0x18')]['id']){try{var _0x4b878b=getId(_0x969d75[_0x3411('0x16')],_0x969d75['message']?_0x969d75[_0x3411('0x17')]['id']:0x0,_0x969d75[_0x3411('0x18')]?_0x969d75[_0x3411('0x18')]['id']:0x0);if(_0x44275f[_0x3411('0x15')][_0x4b878b]){_0x44275f[_0x3411('0x15')][_0x4b878b][_0x3411('0x36')](_0x3411('0x43'));}return _0x3b0a6b({'code':0xc8,'message':_0x969d75});}catch(_0x248ac1){logger['error'](_0x248ac1[_0x3411('0x3a')]);return _0x5d192d(_0x5f4067[_0x3411('0x39')](0x1f4,_0x248ac1));}}logger[_0x3411('0x39')](_0x3411('0x42'));return _0x5d192d(_0x5f4067[_0x3411('0x39')](0x1f4,_0x3411('0x42')));});},'AgentCapacity':function(_0x15328e){var _0x10dd74=this;return new Promise(function(_0x5da134,_0x5979f3){if(_0x44275f['agents'][_0x3411('0x44')](_0x15328e['id'])){for(var _0x29dc59 in _0x15328e[_0x3411('0x45')]){if(_0x15328e[_0x3411('0x45')][_0x3411('0x44')](_0x29dc59)){if(_0x44275f['agents'][_0x15328e['id']][_0x3411('0x44')](_0x29dc59+'CurrentCapacity')){_0x44275f['agents'][_0x15328e['id']][_0x29dc59+'CurrentCapacity']=parseInt(_0x15328e[_0x3411('0x45')][_0x29dc59],0xa);}}}_0x44275f[_0x3411('0x3d')][_0x15328e['id']][_0x3411('0x46')]();return _0x5da134({'code':0xc8,'message':_0x44275f[_0x3411('0x3d')][_0x15328e['id']]});}else{return _0x5979f3(_0x10dd74['error'](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x555fd4){return new Promise(function(_0x35d6b2,_0x305b10){var _0x45c1d6=_[_0x3411('0x47')](_0x44275f['agents']);_0x35d6b2({'count':_0x45c1d6[_0x3411('0x1a')],'rows':_0x45c1d6});});},'ChatQueues':function(_0x339c7b){return new Promise(function(_0x376666,_0x2898e0){var _0x4acbb8=[];for(var _0x4e6b79 in _0x44275f[_0x3411('0x48')]){if(_0x44275f[_0x3411('0x48')]['hasOwnProperty'](_0x4e6b79)){var _0x239ac8=_0x44275f['chatQueues'][_0x4e6b79];var _0x2f0337={'id':_0x239ac8['id'],'available':_0x239ac8[_0x3411('0x49')],'loggedIn':_0x239ac8[_0x3411('0x4a')],'name':_0x239ac8[_0x3411('0x4b')],'paused':_0x239ac8[_0x3411('0x4c')],'waiting':_0x239ac8[_0x3411('0x4d')]};_0x4acbb8[_0x3411('0x22')](_0x2f0337);}}_0x376666({'count':_0x4acbb8['length'],'rows':_0x4acbb8});});},'MailQueues':function(_0x3b6ffd){return new Promise(function(_0x26d230,_0x24aeec){var _0x93d61c=[];for(var _0x13ddf3 in _0x44275f[_0x3411('0x4e')]){if(_0x44275f[_0x3411('0x4e')]['hasOwnProperty'](_0x13ddf3)){var _0x2ca328=_0x44275f[_0x3411('0x4e')][_0x13ddf3];var _0x6cc07b={'id':_0x2ca328['id'],'available':_0x2ca328[_0x3411('0x49')],'loggedIn':_0x2ca328[_0x3411('0x4a')],'name':_0x2ca328[_0x3411('0x4b')],'paused':_0x2ca328[_0x3411('0x4c')],'waiting':_0x2ca328['waiting']};_0x93d61c[_0x3411('0x22')](_0x6cc07b);}}_0x26d230({'count':_0x93d61c[_0x3411('0x1a')],'rows':_0x93d61c});});},'OpenchannelQueues':function(_0x320010){return new Promise(function(_0x3b55d8,_0x6e62f2){var _0x4b37d9=[];for(var _0x44362a in _0x44275f[_0x3411('0x4f')]){if(_0x44275f[_0x3411('0x4f')][_0x3411('0x44')](_0x44362a)){var _0x246eb4=_0x44275f[_0x3411('0x4f')][_0x44362a];var _0x68006={'id':_0x246eb4['id'],'available':_0x246eb4[_0x3411('0x49')],'loggedIn':_0x246eb4['loggedIn'],'name':_0x246eb4['name'],'paused':_0x246eb4['paused'],'waiting':_0x246eb4[_0x3411('0x4d')]};_0x4b37d9[_0x3411('0x22')](_0x68006);}}_0x3b55d8({'count':_0x4b37d9['length'],'rows':_0x4b37d9});});},'SmsQueues':function(_0x183979){return new Promise(function(_0x281b5d,_0x3758b3){var _0x3f7c17=[];for(var _0x4e806a in _0x44275f[_0x3411('0x50')]){if(_0x44275f['smsQueues'][_0x3411('0x44')](_0x4e806a)){var _0x229bde=_0x44275f['smsQueues'][_0x4e806a];var _0x4ced90={'id':_0x229bde['id'],'available':_0x229bde[_0x3411('0x49')],'loggedIn':_0x229bde[_0x3411('0x4a')],'name':_0x229bde[_0x3411('0x4b')],'paused':_0x229bde['paused'],'waiting':_0x229bde[_0x3411('0x4d')]};_0x3f7c17['push'](_0x4ced90);}}_0x281b5d({'count':_0x3f7c17[_0x3411('0x1a')],'rows':_0x3f7c17});});},'FaxQueues':function(_0x35185d){return new Promise(function(_0x5613df,_0x174f83){var _0x3d6741=[];for(var _0x16a653 in _0x44275f[_0x3411('0x51')]){if(_0x44275f[_0x3411('0x51')][_0x3411('0x44')](_0x16a653)){var _0x1b8875=_0x44275f[_0x3411('0x51')][_0x16a653];var _0x4b7758={'id':_0x1b8875['id'],'available':_0x1b8875[_0x3411('0x49')],'loggedIn':_0x1b8875[_0x3411('0x4a')],'name':_0x1b8875[_0x3411('0x4b')],'paused':_0x1b8875[_0x3411('0x4c')],'waiting':_0x1b8875[_0x3411('0x4d')]};_0x3d6741[_0x3411('0x22')](_0x4b7758);}}_0x5613df({'count':_0x3d6741[_0x3411('0x1a')],'rows':_0x3d6741});});},'WhatsappQueues':function(_0x22df6f){return new Promise(function(_0x1232c7,_0x2292e0){var _0x164997=[];for(var _0x499176 in _0x44275f['whatsappQueues']){if(_0x44275f[_0x3411('0x52')][_0x3411('0x44')](_0x499176)){var _0x4433da=_0x44275f['whatsappQueues'][_0x499176];var _0x1f503c={'id':_0x4433da['id'],'available':_0x4433da[_0x3411('0x49')],'loggedIn':_0x4433da[_0x3411('0x4a')],'name':_0x4433da[_0x3411('0x4b')],'paused':_0x4433da['paused'],'waiting':_0x4433da[_0x3411('0x4d')]};_0x164997[_0x3411('0x22')](_0x1f503c);}}_0x1232c7({'count':_0x164997[_0x3411('0x1a')],'rows':_0x164997});});},'ChatQueuesWaitingInteractions':function(_0xd0347){return new Promise(function(_0x5a3e0c,_0x3ec036){var _0x3e003a=_['values'](_0x44275f[_0x3411('0x53')]);_0x5a3e0c({'count':_0x3e003a[_0x3411('0x1a')],'rows':_0x3e003a});});},'MailQueuesWaitingInteractions':function(_0x30c9ad){return new Promise(function(_0x1db6b7,_0x1f31b6){var _0x21f225=_[_0x3411('0x47')](_0x44275f[_0x3411('0x54')]);_0x1db6b7({'count':_0x21f225[_0x3411('0x1a')],'rows':_0x21f225});});},'OpenchannelQueuesWaitingInteractions':function(_0x26114a){return new Promise(function(_0x52cde9,_0x5b6aa5){var _0x40f5e0=_[_0x3411('0x47')](_0x44275f[_0x3411('0x55')]);_0x52cde9({'count':_0x40f5e0['length'],'rows':_0x40f5e0});});},'SmsQueuesWaitingInteractions':function(_0x49f721){return new Promise(function(_0x5bb79b,_0x3efe43){var _0x1d7c09=_[_0x3411('0x47')](_0x44275f[_0x3411('0x56')]);_0x5bb79b({'count':_0x1d7c09[_0x3411('0x1a')],'rows':_0x1d7c09});});},'FaxQueuesWaitingInteractions':function(_0x431547){return new Promise(function(_0x51500b,_0x3fe017){var _0x58f336=_[_0x3411('0x47')](_0x44275f[_0x3411('0x57')]);_0x51500b({'count':_0x58f336[_0x3411('0x1a')],'rows':_0x58f336});});},'WhatsappQueuesWaitingInteractions':function(_0x28be66){return new Promise(function(_0x585c0d,_0x488e3f){var _0x207bb5=_['values'](_0x44275f[_0x3411('0x58')]);_0x585c0d({'count':_0x207bb5[_0x3411('0x1a')],'rows':_0x207bb5});});}};var _0x52ab4b=jayson['server'](_0x191b73)['http']();_0x52ab4b['on'](_0x3411('0x39'),function(_0x2b7418){logger['error'](JSON[_0x3411('0x34')](_0x2b7418));return _0x4ab0d0(_0x2b7418);});_0x52ab4b[_0x3411('0x14')](0x232c,_0x3411('0x59'),function(){console[_0x3411('0x5a')](_0x3411('0x5b'),0x232c);return _0x607f07(_0x3411('0x5c')+0x232c);});});}; \ No newline at end of file +var _0x7799=['127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','path','jayson/promise','bluebird','uuid','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/smsQueueReport','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','applications','isArray','length','existsSync','app','autoreply','appdata','push','slice','join','dialogflow','split','amazonlex','TagId','%s:%s:%s','./interval','intervals','./applications/','priority','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','info','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','agent','agents','busy','busyQueue','end','QueueReport','update','UserId','error\x20update\x20queue\x20report','message\x20is\x20empty','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','agent\x20not\x20found','chatQueues','loggedIn','name','paused','waiting','mailQueues','available','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http'];(function(_0x411457,_0x4fbd5a){var _0x52b91a=function(_0x338ea5){while(--_0x338ea5){_0x411457['push'](_0x411457['shift']());}};_0x52b91a(++_0x4fbd5a);}(_0x7799,0xbc));var _0x9779=function(_0x4aa4e6,_0x278c45){_0x4aa4e6=_0x4aa4e6-0x0;var _0x322588=_0x7799[_0x4aa4e6];return _0x322588;};'use strict';var _=require(_0x9779('0x0'));var util=require('util');var path=require(_0x9779('0x1'));var fs=require('fs');var jayson=require(_0x9779('0x2'));var BPromise=require(_0x9779('0x3'));var uuid=require(_0x9779('0x4'));var config=require('../../../config/environment');var logger=require(_0x9779('0x5'))(_0x9779('0x6'));var rpc={'openchannelQueueReport':require(_0x9779('0x7')),'mailQueueReport':require(_0x9779('0x8')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0x9779('0x9')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require('../lib/rule-engine');function getId(_0x1e83d0,_0x338c7c,_0x5e7187){return util[_0x9779('0xa')](_0x9779('0xb'),_0x1e83d0,_0x338c7c||0x0,_0x5e7187||0x0);}function getIntervals(_0x244f28,_0x2ab8c8){var _0x2bed54=[];if(!_[_0x9779('0xc')](_0x2ab8c8[_0x9779('0xd')])&&!_[_0x9779('0xc')](_0x244f28[_0x2ab8c8[_0x9779('0xd')]])&&!_[_0x9779('0xc')](_0x244f28[_0x2ab8c8[_0x9779('0xd')]][_0x9779('0xe')])){_0x2bed54=_[_0x9779('0xf')](_0x244f28[_0x2ab8c8[_0x9779('0xd')]][_0x9779('0xe')],_0x9779('0x10'));}else if(!_[_0x9779('0xc')](_0x2ab8c8[_0x9779('0x10')])){_0x2bed54=[_0x2ab8c8[_0x9779('0x10')]];}return _0x2bed54;}exports[_0x9779('0x11')]=function(_0x252ceb){_0x252ceb[_0x9779('0x12')]={};return new BPromise(function(_0x3cfa54,_0x1ddc6a){var _0x524f71={'Start':function(_0x542d6d){var _0x40862f=this;return new Promise(function(_0x47a55a,_0xe076e8){if(_0x542d6d){try{var _0xb179d9=[];var _0x34c6fe=getId(_0x542d6d[_0x9779('0x13')],_0x542d6d[_0x9779('0x14')]?_0x542d6d['message']['id']:0x0,_0x542d6d[_0x9779('0x15')]?_0x542d6d[_0x9779('0x15')]['id']:0x0);if(_0x542d6d[_0x9779('0x16')]&&_[_0x9779('0x17')](_0x542d6d['applications'])&&_0x542d6d[_0x9779('0x16')]['length']){for(var _0x50557b=0x0;_0x50557b<_0x542d6d[_0x9779('0x16')][_0x9779('0x18')];_0x50557b+=0x1){var _0x1caba2=_0x542d6d[_0x9779('0x16')][_0x50557b];if(fs[_0x9779('0x19')](path['join'](__dirname,'applications',_0x1caba2[_0x9779('0x1a')]+'.js'))){var _0x5e411f=[];switch(_0x1caba2[_0x9779('0x1a')]['toLowerCase']()){case _0x9779('0x1b'):var _0x2d11a8=_0x1caba2[_0x9779('0x1c')]['split'](',');if(_0x542d6d[_0x9779('0x13')]==='mail'){_0x5e411f[_0x9779('0x1d')](_0x2d11a8[0x0]);_0x5e411f[_0x9779('0x1d')](_0x2d11a8[0x1]);_0x5e411f[_0x9779('0x1d')](_0x2d11a8[_0x9779('0x1e')](0x2,_0x2d11a8[_0x9779('0x18')])['join'](','));}else{_0x5e411f[_0x9779('0x1d')](_0x2d11a8[0x0]);_0x5e411f[_0x9779('0x1d')](_0x2d11a8[_0x9779('0x1e')](0x1,_0x2d11a8[_0x9779('0x18')])[_0x9779('0x1f')](','));}break;case _0x9779('0x20'):var _0x2bba00=_0x1caba2[_0x9779('0x1c')][_0x9779('0x21')](',');_0x5e411f[_0x9779('0x1d')](_0x2bba00[0x0]);_0x5e411f[_0x9779('0x1d')](_0x2bba00[0x1]);_0x5e411f[_0x9779('0x1d')](_0x2bba00[_0x9779('0x1e')](0x2,_0x2bba00['length'])[_0x9779('0x1f')](','));break;case'dialogflowv2':var _0x1bff71=_0x1caba2[_0x9779('0x1c')][_0x9779('0x21')](',');_0x5e411f[_0x9779('0x1d')](_0x1bff71[0x0]);_0x5e411f[_0x9779('0x1d')](_0x1bff71[0x1]);_0x5e411f[_0x9779('0x1d')](_0x1bff71[0x2]);_0x5e411f['push'](_0x1bff71[0x3]);_0x5e411f[_0x9779('0x1d')](_0x1bff71[_0x9779('0x1e')](0x4,_0x1bff71[_0x9779('0x18')])[_0x9779('0x1f')](','));break;case _0x9779('0x22'):var _0x6c442a=_0x1caba2[_0x9779('0x1c')][_0x9779('0x21')](',');_0x5e411f[_0x9779('0x1d')](_0x6c442a[0x0]);_0x5e411f['push'](_0x6c442a[0x1]);_0x5e411f[_0x9779('0x1d')](_0x6c442a[0x2]);_0x5e411f[_0x9779('0x1d')](_0x6c442a[0x3]);_0x5e411f['push'](_0x6c442a[_0x9779('0x1e')](0x4,_0x6c442a[_0x9779('0x18')])[_0x9779('0x1f')](','));break;case _0x9779('0x14'):_0x5e411f[_0x9779('0x1d')](_0x1caba2[_0x9779('0x1c')]);break;case'tag':_0x5e411f['push'](_0x1caba2[_0x9779('0x23')]);_0x5e411f[_0x9779('0x1d')](_0x1caba2[_0x9779('0x1c')]);break;default:_0x5e411f=_[_0x9779('0xc')](_0x1caba2[_0x9779('0x1c')])?[]:_0x1caba2[_0x9779('0x1c')]['split'](',');}var _0x558855={'id':util[_0x9779('0xa')](_0x9779('0x24'),_0x34c6fe,_0x1caba2['id'],_0x1caba2[_0x9779('0x1a')]),'condition':require(_0x9779('0x25'))['condition'](_0x34c6fe,getIntervals(_0x252ceb[_0x9779('0x26')],_0x1caba2),_0x252ceb),'consequence':require(_0x9779('0x27')+_0x1caba2[_0x9779('0x1a')])['consequence'](_0x34c6fe,_0x5e411f,_0x252ceb,_0x542d6d),'p':_0x1caba2[_0x9779('0x28')]||0x0};logger['info']('Push\x20new\x20rule',_0x558855['id'],_0x9779('0x29'),getIntervals(_0x252ceb['intervals'],_0x1caba2)[_0x9779('0x1f')](_0x9779('0x2a')));_0xb179d9[_0x9779('0x1d')](_0x558855);}else{logger[_0x9779('0x2b')](_0x9779('0x2c'),path[_0x9779('0x1f')](__dirname,_0x9779('0x16'),_0x1caba2[_0x9779('0x1a')]+'.js'));}}_0x252ceb['rules'][_0x34c6fe]=new RuleEngine(_0xb179d9);_0x252ceb['rules'][_0x34c6fe][_0x9779('0x2d')](_0x542d6d,function(_0x4b0643){logger[_0x9779('0x2e')](_0x9779('0x2f'),JSON[_0x9779('0x30')](_0x4b0643[_0x9779('0x31')]));if(_0x252ceb[_0x9779('0x12')][_0x34c6fe]){_0x252ceb[_0x9779('0x12')][_0x34c6fe][_0x9779('0x32')](_0x9779('0x33'));}});return _0x47a55a({'code':0xc8,'message':_0x542d6d});}else{logger[_0x9779('0x2e')](_0x9779('0x34'));return _0x47a55a({'code':0xc8,'message':_0x542d6d});}}catch(_0x2b7fe1){logger[_0x9779('0x2b')](_0x2b7fe1[_0x9779('0x35')]);return _0xe076e8(_0x40862f[_0x9779('0x2b')](0x1f4,_0x2b7fe1));}}return _0xe076e8('routing\x20is\x20empty');});},'AcceptMessage':function(_0xd9728b){var _0x1e6061=this;return new Promise(function(_0xdbbc68,_0x581771){if(_0xd9728b[_0x9779('0x36')]&&_0xd9728b['agent']['id']){if(_0x252ceb[_0x9779('0x37')][_0xd9728b[_0x9779('0x36')]['id']]){_0x252ceb[_0x9779('0x37')][_0xd9728b['agent']['id']][_0x9779('0x38')]=![];_0x252ceb[_0x9779('0x37')][_0xd9728b['agent']['id']][_0x9779('0x39')]=undefined;}}if(_0xd9728b['message']&&_0xd9728b[_0x9779('0x14')]['id']){try{var _0x2f12e7=getId(_0xd9728b[_0x9779('0x13')],_0xd9728b[_0x9779('0x14')]?_0xd9728b[_0x9779('0x14')]['id']:0x0,_0xd9728b['interaction']?_0xd9728b[_0x9779('0x15')]['id']:0x0);if(_0x252ceb['rules'][_0x2f12e7]){_0x252ceb[_0x9779('0x12')][_0x2f12e7][_0x9779('0x32')](_0x9779('0x3a'));if(rpc[_0xd9728b['channel']+_0x9779('0x3b')]){rpc[_0xd9728b[_0x9779('0x13')]+'QueueReport'][_0x9779('0x3c')](_0x2f12e7,{'UserId':_0xd9728b[_0x9779('0x14')][_0x9779('0x3d')]})['catch'](function(_0x347765){logger[_0x9779('0x2b')](_0x9779('0x3e'));});}}return _0xdbbc68({'code':0xc8,'message':_0xd9728b});}catch(_0x2bc839){logger[_0x9779('0x2b')](_0x2bc839[_0x9779('0x35')]);return _0x581771(_0x1e6061['error'](0x1f4,_0x2bc839));}}logger[_0x9779('0x2b')](_0x9779('0x3f'));return _0x581771(_0x1e6061[_0x9779('0x2b')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x9f5af4){var _0x4fd9c3=this;return new Promise(function(_0x5055c0,_0x42fbed){if(_0x9f5af4[_0x9779('0x36')]&&_0x9f5af4[_0x9779('0x36')]['id']){try{if(_0x252ceb[_0x9779('0x37')][_0x9f5af4[_0x9779('0x36')]['id']]){_0x252ceb['agents'][_0x9f5af4[_0x9779('0x36')]['id']][_0x9779('0x38')]=![];_0x252ceb[_0x9779('0x37')][_0x9f5af4['agent']['id']][_0x9779('0x39')]=undefined;}return _0x5055c0({'code':0xc8,'message':_0x9f5af4});}catch(_0x4f2cfc){logger[_0x9779('0x2b')](_0x4f2cfc[_0x9779('0x35')]);return _0x42fbed(_0x4fd9c3[_0x9779('0x2b')](0x1f4,_0x4f2cfc));}}logger[_0x9779('0x2b')](_0x9779('0x3f'));return _0x42fbed(_0x4fd9c3[_0x9779('0x2b')](0x1f4,_0x9779('0x3f')));});},'AbandonInteraction':function(_0x2b205b){var _0x225dc3=this;return new Promise(function(_0x46ae47,_0x3b977b){if(_0x2b205b[_0x9779('0x13')]&&_0x2b205b['interaction']&&_0x2b205b[_0x9779('0x15')]['id']){try{var _0x47dd79=getId(_0x2b205b[_0x9779('0x13')],_0x2b205b['message']?_0x2b205b[_0x9779('0x14')]['id']:0x0,_0x2b205b[_0x9779('0x15')]?_0x2b205b[_0x9779('0x15')]['id']:0x0);if(_0x252ceb[_0x9779('0x12')][_0x47dd79]){_0x252ceb[_0x9779('0x12')][_0x47dd79]['emit']('end');}return _0x46ae47({'code':0xc8,'message':_0x2b205b});}catch(_0xc15ccf){logger['error'](_0xc15ccf[_0x9779('0x35')]);return _0x3b977b(_0x225dc3['error'](0x1f4,_0xc15ccf));}}logger[_0x9779('0x2b')](_0x9779('0x3f'));return _0x3b977b(_0x225dc3[_0x9779('0x2b')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x3627ba){var _0x37d84a=this;return new Promise(function(_0xc0e6e2,_0x3c7855){if(_0x252ceb['agents']['hasOwnProperty'](_0x3627ba['id'])){for(var _0x4c4d50 in _0x3627ba['capacity']){if(_0x3627ba[_0x9779('0x40')][_0x9779('0x41')](_0x4c4d50)){if(_0x252ceb[_0x9779('0x37')][_0x3627ba['id']][_0x9779('0x41')](_0x4c4d50+_0x9779('0x42'))){_0x252ceb[_0x9779('0x37')][_0x3627ba['id']][_0x4c4d50+_0x9779('0x42')]=parseInt(_0x3627ba[_0x9779('0x40')][_0x4c4d50],0xa);}}}_0x252ceb[_0x9779('0x37')][_0x3627ba['id']][_0x9779('0x43')]();return _0xc0e6e2({'code':0xc8,'message':_0x252ceb[_0x9779('0x37')][_0x3627ba['id']]});}else{return _0x3c7855(_0x37d84a[_0x9779('0x2b')](0x1f4,_0x9779('0x44')));}});},'Agents':function(_0x139b3a){return new Promise(function(_0x5b3b83,_0x256e68){var _0x4431d6=_['values'](_0x252ceb[_0x9779('0x37')]);_0x5b3b83({'count':_0x4431d6[_0x9779('0x18')],'rows':_0x4431d6});});},'ChatQueues':function(_0x1678e8){return new Promise(function(_0x274c97,_0xc0212c){var _0x489ee4=[];for(var _0x1c80de in _0x252ceb[_0x9779('0x45')]){if(_0x252ceb[_0x9779('0x45')][_0x9779('0x41')](_0x1c80de)){var _0x2a65c0=_0x252ceb[_0x9779('0x45')][_0x1c80de];var _0x53efd3={'id':_0x2a65c0['id'],'available':_0x2a65c0['available'],'loggedIn':_0x2a65c0[_0x9779('0x46')],'name':_0x2a65c0[_0x9779('0x47')],'paused':_0x2a65c0[_0x9779('0x48')],'waiting':_0x2a65c0[_0x9779('0x49')]};_0x489ee4[_0x9779('0x1d')](_0x53efd3);}}_0x274c97({'count':_0x489ee4[_0x9779('0x18')],'rows':_0x489ee4});});},'MailQueues':function(_0x125ea9){return new Promise(function(_0x580ddc,_0x5475e7){var _0x5c7719=[];for(var _0x17a68c in _0x252ceb[_0x9779('0x4a')]){if(_0x252ceb[_0x9779('0x4a')][_0x9779('0x41')](_0x17a68c)){var _0x5b6f9a=_0x252ceb[_0x9779('0x4a')][_0x17a68c];var _0x5ecc69={'id':_0x5b6f9a['id'],'available':_0x5b6f9a[_0x9779('0x4b')],'loggedIn':_0x5b6f9a[_0x9779('0x46')],'name':_0x5b6f9a[_0x9779('0x47')],'paused':_0x5b6f9a[_0x9779('0x48')],'waiting':_0x5b6f9a[_0x9779('0x49')]};_0x5c7719['push'](_0x5ecc69);}}_0x580ddc({'count':_0x5c7719['length'],'rows':_0x5c7719});});},'OpenchannelQueues':function(_0x22aad8){return new Promise(function(_0x5b3649,_0x6a74f1){var _0x1efc13=[];for(var _0x4a97a3 in _0x252ceb[_0x9779('0x4c')]){if(_0x252ceb[_0x9779('0x4c')]['hasOwnProperty'](_0x4a97a3)){var _0x4567b6=_0x252ceb[_0x9779('0x4c')][_0x4a97a3];var _0x59329a={'id':_0x4567b6['id'],'available':_0x4567b6[_0x9779('0x4b')],'loggedIn':_0x4567b6[_0x9779('0x46')],'name':_0x4567b6['name'],'paused':_0x4567b6[_0x9779('0x48')],'waiting':_0x4567b6['waiting']};_0x1efc13[_0x9779('0x1d')](_0x59329a);}}_0x5b3649({'count':_0x1efc13[_0x9779('0x18')],'rows':_0x1efc13});});},'SmsQueues':function(_0x4a0a97){return new Promise(function(_0x5ee915,_0x452889){var _0x12b4a8=[];for(var _0x1d2aa6 in _0x252ceb[_0x9779('0x4d')]){if(_0x252ceb['smsQueues']['hasOwnProperty'](_0x1d2aa6)){var _0x2e248d=_0x252ceb['smsQueues'][_0x1d2aa6];var _0x309b5f={'id':_0x2e248d['id'],'available':_0x2e248d[_0x9779('0x4b')],'loggedIn':_0x2e248d[_0x9779('0x46')],'name':_0x2e248d['name'],'paused':_0x2e248d[_0x9779('0x48')],'waiting':_0x2e248d['waiting']};_0x12b4a8[_0x9779('0x1d')](_0x309b5f);}}_0x5ee915({'count':_0x12b4a8['length'],'rows':_0x12b4a8});});},'FaxQueues':function(_0x598d4a){return new Promise(function(_0x43cb0e,_0x4f6678){var _0x28ef80=[];for(var _0x2c136d in _0x252ceb[_0x9779('0x4e')]){if(_0x252ceb['faxQueues'][_0x9779('0x41')](_0x2c136d)){var _0x517f2b=_0x252ceb['faxQueues'][_0x2c136d];var _0x10486f={'id':_0x517f2b['id'],'available':_0x517f2b['available'],'loggedIn':_0x517f2b['loggedIn'],'name':_0x517f2b[_0x9779('0x47')],'paused':_0x517f2b[_0x9779('0x48')],'waiting':_0x517f2b[_0x9779('0x49')]};_0x28ef80[_0x9779('0x1d')](_0x10486f);}}_0x43cb0e({'count':_0x28ef80['length'],'rows':_0x28ef80});});},'WhatsappQueues':function(_0x48096b){return new Promise(function(_0x41d9e2,_0x1b0739){var _0x289954=[];for(var _0x1da211 in _0x252ceb[_0x9779('0x4f')]){if(_0x252ceb['whatsappQueues'][_0x9779('0x41')](_0x1da211)){var _0x598aa7=_0x252ceb[_0x9779('0x4f')][_0x1da211];var _0x301c91={'id':_0x598aa7['id'],'available':_0x598aa7[_0x9779('0x4b')],'loggedIn':_0x598aa7[_0x9779('0x46')],'name':_0x598aa7['name'],'paused':_0x598aa7[_0x9779('0x48')],'waiting':_0x598aa7['waiting']};_0x289954['push'](_0x301c91);}}_0x41d9e2({'count':_0x289954[_0x9779('0x18')],'rows':_0x289954});});},'ChatQueuesWaitingInteractions':function(_0x5029e3){return new Promise(function(_0x15b436,_0x579e04){var _0x975d17=_[_0x9779('0x50')](_0x252ceb[_0x9779('0x51')]);_0x15b436({'count':_0x975d17[_0x9779('0x18')],'rows':_0x975d17});});},'MailQueuesWaitingInteractions':function(_0x2db20e){return new Promise(function(_0x1d160e,_0x346037){var _0x5f5d5b=_[_0x9779('0x50')](_0x252ceb[_0x9779('0x52')]);_0x1d160e({'count':_0x5f5d5b[_0x9779('0x18')],'rows':_0x5f5d5b});});},'OpenchannelQueuesWaitingInteractions':function(_0x2ed9a2){return new Promise(function(_0x4faba0,_0x3a41e0){var _0xc446f9=_[_0x9779('0x50')](_0x252ceb['openchannelQueuesWaitingInteractions']);_0x4faba0({'count':_0xc446f9[_0x9779('0x18')],'rows':_0xc446f9});});},'SmsQueuesWaitingInteractions':function(_0x5b20e3){return new Promise(function(_0x3ac9de,_0x5e8d6a){var _0xadfe2b=_['values'](_0x252ceb[_0x9779('0x53')]);_0x3ac9de({'count':_0xadfe2b[_0x9779('0x18')],'rows':_0xadfe2b});});},'FaxQueuesWaitingInteractions':function(_0x57968d){return new Promise(function(_0x435ffc,_0x3d481e){var _0x14bd8e=_[_0x9779('0x50')](_0x252ceb[_0x9779('0x54')]);_0x435ffc({'count':_0x14bd8e[_0x9779('0x18')],'rows':_0x14bd8e});});},'WhatsappQueuesWaitingInteractions':function(_0x4bfaa4){return new Promise(function(_0x2ea63e,_0x498d6b){var _0x4d1b11=_[_0x9779('0x50')](_0x252ceb[_0x9779('0x55')]);_0x2ea63e({'count':_0x4d1b11[_0x9779('0x18')],'rows':_0x4d1b11});});}};var _0x350b3a=jayson[_0x9779('0x56')](_0x524f71)[_0x9779('0x57')]();_0x350b3a['on']('error',function(_0xec4b9f){logger[_0x9779('0x2b')](JSON[_0x9779('0x30')](_0xec4b9f));return _0x1ddc6a(_0xec4b9f);});_0x350b3a['listen'](0x232c,_0x9779('0x58'),function(){console[_0x9779('0x59')](_0x9779('0x5a'),0x232c);return _0x3cfa54(_0x9779('0x5b')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 1485d85..d799901 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 _0xa08c=['[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','stack','util','client','http','then','error','result','catch','condition','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','message','indexOf','true','all','some','info'];(function(_0x40b574,_0xd82bd5){var _0x44f6b1=function(_0x4972db){while(--_0x4972db){_0x40b574['push'](_0x40b574['shift']());}};_0x44f6b1(++_0xd82bd5);}(_0xa08c,0x130));var _0xca08=function(_0xfb8a2,_0x386234){_0xfb8a2=_0xfb8a2-0x0;var _0x194051=_0xa08c[_0xfb8a2];return _0x194051;};'use strict';var util=require(_0xca08('0x0'));var BPromise=require('bluebird');var jayson=require('jayson/promise');var _=require('lodash');var logger=require('../../../config/logger')('routing');var client=jayson[_0xca08('0x1')][_0xca08('0x2')]({'port':0x232a});function request(_0x2a6c2f,_0x2bcef4){return new BPromise(function(_0x173fa1,_0x1f178a){return client['request'](_0x2a6c2f,_0x2bcef4)[_0xca08('0x3')](function(_0x30ec47){if(_0x30ec47[_0xca08('0x4')]){return _0x1f178a(_0x30ec47[_0xca08('0x4')]['message']);}else{return _0x173fa1(_0x30ec47[_0xca08('0x5')]);}})[_0xca08('0x6')](function(_0x2535f1){return _0x1f178a(_0x2535f1);});});}exports[_0xca08('0x7')]=function(_0x3ebd3b,_0x11d92d,_0x20c9dd){return function(_0x5d5955){if(_0x20c9dd[_0xca08('0x8')]&&!_0x20c9dd['rules'][_0x3ebd3b]){logger['info'](_0xca08('0x9'),_0x3ebd3b);return _0x5d5955[_0xca08('0xa')]();}var _0x299977=[];for(var _0xbc03a8=0x0;_0xbc03a8<_0x11d92d[_0xca08('0xb')];_0xbc03a8+=0x1){_0x299977[_0xca08('0xc')](request(_0xca08('0xd'),{'command':util[_0xca08('0xe')]('iftime\x20%s',_0x11d92d[_0xbc03a8])})['then'](function(_0x3fdd26){return _0x3fdd26&&_0x3fdd26[_0xca08('0xf')]&&_0x3fdd26[_0xca08('0xf')][_0xca08('0x10')](_0xca08('0x11'))>=0x0?!![]:![];})['catch'](function(_0x4dee9b){logger[_0xca08('0x4')]('[%s][INTERVAL]\x20%s',_0x3ebd3b,_0x11d92d[_0xbc03a8]);}));}BPromise[_0xca08('0x12')](_0x299977)[_0xca08('0x3')](function(_0x434500){var _0x2509a1=_[_0xca08('0x13')](_0x434500);logger[_0xca08('0x14')]('[%s][INTERVAL]\x20%s\x20%s',_0x3ebd3b,_0x11d92d['join']('\x20|\x20'),_0x2509a1);_0x5d5955['when'](_0x2509a1);})[_0xca08('0x6')](function(_0x370fca){console['log'](_0x370fca);logger[_0xca08('0x4')](_0xca08('0x15'),_0x3ebd3b,_0x11d92d[_0xca08('0x16')](_0xca08('0x17')),_0x370fca[_0xca08('0x18')]);_0x5d5955[_0xca08('0xa')]();});};}; \ No newline at end of file +var _0x2a4f=['length','push','format','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','all','[%s][INTERVAL]\x20%s\x20%s','join','when','log','\x20|\x20','stack','bluebird','jayson/promise','../../../config/logger','client','http','then','error','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop'];(function(_0x40b92a,_0x3ae37f){var _0x3aee1d=function(_0x1e6e52){while(--_0x1e6e52){_0x40b92a['push'](_0x40b92a['shift']());}};_0x3aee1d(++_0x3ae37f);}(_0x2a4f,0x14d));var _0xf2a4=function(_0x94f760,_0x4f1b70){_0x94f760=_0x94f760-0x0;var _0x3aec01=_0x2a4f[_0x94f760];return _0x3aec01;};'use strict';var util=require('util');var BPromise=require(_0xf2a4('0x0'));var jayson=require(_0xf2a4('0x1'));var _=require('lodash');var logger=require(_0xf2a4('0x2'))('routing');var client=jayson[_0xf2a4('0x3')][_0xf2a4('0x4')]({'port':0x232a});function request(_0x61790e,_0x2b323f){return new BPromise(function(_0x5c8d7f,_0x4e68a1){return client['request'](_0x61790e,_0x2b323f)[_0xf2a4('0x5')](function(_0x38c908){if(_0x38c908[_0xf2a4('0x6')]){return _0x4e68a1(_0x38c908[_0xf2a4('0x6')][_0xf2a4('0x7')]);}else{return _0x5c8d7f(_0x38c908[_0xf2a4('0x8')]);}})[_0xf2a4('0x9')](function(_0x3784af){return _0x4e68a1(_0x3784af);});});}exports[_0xf2a4('0xa')]=function(_0x1d8f96,_0x2bf786,_0x38bc25){return function(_0x559d61){if(_0x38bc25[_0xf2a4('0xb')]&&!_0x38bc25[_0xf2a4('0xb')][_0x1d8f96]){logger[_0xf2a4('0xc')](_0xf2a4('0xd'),_0x1d8f96);return _0x559d61[_0xf2a4('0xe')]();}var _0x33db65=[];for(var _0x54e6be=0x0;_0x54e6be<_0x2bf786[_0xf2a4('0xf')];_0x54e6be+=0x1){_0x33db65[_0xf2a4('0x10')](request('Command',{'command':util[_0xf2a4('0x11')](_0xf2a4('0x12'),_0x2bf786[_0x54e6be])})[_0xf2a4('0x5')](function(_0x35f6dc){return _0x35f6dc&&_0x35f6dc['message']&&_0x35f6dc[_0xf2a4('0x7')][_0xf2a4('0x13')](_0xf2a4('0x14'))>=0x0?!![]:![];})[_0xf2a4('0x9')](function(_0xed1fbf){logger[_0xf2a4('0x6')](_0xf2a4('0x15'),_0x1d8f96,_0x2bf786[_0x54e6be]);}));}BPromise[_0xf2a4('0x16')](_0x33db65)[_0xf2a4('0x5')](function(_0xc79050){var _0x542895=_['some'](_0xc79050);logger[_0xf2a4('0xc')](_0xf2a4('0x17'),_0x1d8f96,_0x2bf786[_0xf2a4('0x18')]('\x20|\x20'),_0x542895);_0x559d61[_0xf2a4('0x19')](_0x542895);})[_0xf2a4('0x9')](function(_0x8a4e8){console[_0xf2a4('0x1a')](_0x8a4e8);logger[_0xf2a4('0x6')](_0xf2a4('0x17'),_0x1d8f96,_0x2bf786['join'](_0xf2a4('0x1b')),_0x8a4e8[_0xf2a4('0x1c')]);_0x559d61[_0xf2a4('0xe')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 5dcb836..9fa67a4 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 _0xb469=['agentringnoanswerAt','timeout','holdtime','ringtime','talktime','[%s][agents][agentringnoanswer]','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','reason','abandoned','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','agentringnoanswer','answeredelsewheredestinationuniqueid','answeredelsewheremembername','agentcomplete','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfertype','blind','transferexten','transferuniqueid','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfer','ATTENDED','transfereeuniqueid','agententerreason','calleridnum','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','clone','hangup','[%s][agents][hangup]','cause','rejected','splice','diffTime','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','lodash','util','./utils','info','format','uniqueid','channel','membername','interface','connectedlinenum','getVoiceQueueByName','then','type','agentacw','acw','request','CreateVoiceAgentReport','agentcalled','debug','[%s][agents][agentcalled]','destuniqueid','agentcalledAt','now','lastevent','called','connectedlinename','error','isNil','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout'];(function(_0x40e36b,_0xa8762f){var _0x5c5ebd=function(_0x5c7c88){while(--_0x5c7c88){_0x40e36b['push'](_0x40e36b['shift']());}};_0x5c5ebd(++_0xa8762f);}(_0xb469,0x13b));var _0x9b46=function(_0x19658a,_0x585edd){_0x19658a=_0x19658a-0x0;var _0x297f14=_0xb469[_0x19658a];return _0x297f14;};'use strict';var _=require(_0x9b46('0x0'));var util=require(_0x9b46('0x1'));var utils=require(_0x9b46('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x34f477,_0x1a41e8){utils[_0x9b46('0x3')](util[_0x9b46('0x4')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x34f477[_0x9b46('0x5')],_0x34f477[_0x9b46('0x6')],_0x34f477['queue'],_0x34f477[_0x9b46('0x7')],_0x34f477[_0x9b46('0x8')],_0x34f477['calleridnum'],_0x34f477[_0x9b46('0x9')],_0x34f477['lastevent']));if(_0x34f477['queue']){utils[_0x9b46('0xa')](_0x34f477['queue'])[_0x9b46('0xb')](function(_0xb9d1b5){if(_0xb9d1b5){_0x34f477[_0x9b46('0xc')]=_0xb9d1b5['type'];_0x34f477[_0x9b46('0xd')]=_0x34f477['agentcomplete']?_0xb9d1b5[_0x9b46('0xe')]:![];_0x34f477['acwtime']=_0x34f477[_0x9b46('0xd')]?_0xb9d1b5['acwTimeout']:0x0;}utils[_0x9b46('0xf')](_0x9b46('0x10'),_0x34f477);});}else{utils['request'](_0x9b46('0x10'),_0x34f477);}if(_0x1a41e8){delete transfers[_0x34f477[_0x9b46('0x5')]];}else{delete agents[_0x34f477['destuniqueid']];}}exports[_0x9b46('0x11')]=function(_0x2cfb35){try{utils[_0x9b46('0x12')](util[_0x9b46('0x4')](_0x9b46('0x13'),_0x2cfb35[_0x9b46('0x5')]),_0x2cfb35);agents[_0x2cfb35[_0x9b46('0x14')]]=_0x2cfb35;agents[_0x2cfb35[_0x9b46('0x14')]][_0x9b46('0x15')]=utils[_0x9b46('0x16')]();agents[_0x2cfb35[_0x9b46('0x14')]][_0x9b46('0x17')]=_0x9b46('0x18');agents[_0x2cfb35['destuniqueid']]['connectedlinenum']=null;agents[_0x2cfb35['destuniqueid']][_0x9b46('0x19')]=null;utils[_0x9b46('0x3')](util[_0x9b46('0x4')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x2cfb35['uniqueid'],agents[_0x2cfb35[_0x9b46('0x14')]]['membername'],_0x2cfb35['destuniqueid']));}catch(_0xfeb1b9){utils[_0x9b46('0x1a')](util['format'](_0x9b46('0x13'),_0x2cfb35[_0x9b46('0x5')]),_0xfeb1b9);}};exports['agentringnoanswer']=function(_0x55aece){try{if(!_[_0x9b46('0x1b')](agents[_0x55aece[_0x9b46('0x14')]])){utils[_0x9b46('0x12')](util['format']('[%s][agents][agentringnoanswer]',_0x55aece[_0x9b46('0x5')]),_0x55aece);utils['info'](util[_0x9b46('0x4')](_0x9b46('0x1c'),_0x55aece['uniqueid'],agents[_0x55aece[_0x9b46('0x14')]]['membername'],_0x55aece[_0x9b46('0x14')]));agents[_0x55aece[_0x9b46('0x14')]]['agentringnoanswer']=!![];agents[_0x55aece[_0x9b46('0x14')]][_0x9b46('0x1d')]=utils[_0x9b46('0x16')]();agents[_0x55aece[_0x9b46('0x14')]][_0x9b46('0x17')]=_0x9b46('0x1e');agents[_0x55aece[_0x9b46('0x14')]]['reason']=_0x9b46('0x1e');agents[_0x55aece[_0x9b46('0x14')]][_0x9b46('0x1f')]=_0x55aece[_0x9b46('0x20')]?parseInt(_0x55aece[_0x9b46('0x20')])/0x3e8:0x0;agents[_0x55aece[_0x9b46('0x14')]][_0x9b46('0x21')]=0x0;unanswered['push'](_0x55aece[_0x9b46('0x14')]);}}catch(_0xee519e){utils[_0x9b46('0x1a')](util[_0x9b46('0x4')](_0x9b46('0x22'),_0x55aece[_0x9b46('0x5')]),_0xee519e);}};exports[_0x9b46('0x23')]=function(_0x17ba3d){try{_[_0x9b46('0x24')](agents,function(_0x20090a,_0x2e1c51){if(_0x20090a['uniqueid']==_0x17ba3d[_0x9b46('0x5')]&&!_[_0x9b46('0x25')](unanswered,_0x20090a[_0x9b46('0x14')])){utils[_0x9b46('0x12')](util[_0x9b46('0x4')](_0x9b46('0x26'),_0x17ba3d[_0x9b46('0x5')]),_0x17ba3d);utils[_0x9b46('0x3')](util[_0x9b46('0x4')](_0x9b46('0x27'),_0x17ba3d[_0x9b46('0x5')],_0x20090a['membername'],_0x20090a[_0x9b46('0x14')]));_0x20090a['agentringnoanswer']=!![];_0x20090a[_0x9b46('0x1d')]=utils[_0x9b46('0x16')]();_0x20090a[_0x9b46('0x17')]='abandoned';_0x20090a[_0x9b46('0x28')]=_0x9b46('0x29');_0x20090a[_0x9b46('0x1f')]=_0x17ba3d[_0x9b46('0x1f')];_0x20090a[_0x9b46('0x21')]=0x0;writeDB(_0x20090a);}});}catch(_0x5cb73f){utils['error'](util[_0x9b46('0x4')](_0x9b46('0x26'),_0x17ba3d[_0x9b46('0x5')]),_0x5cb73f);}};exports[_0x9b46('0x2a')]=function(_0x4fa731){try{if(agents[_0x4fa731[_0x9b46('0x14')]]){utils['debug'](util[_0x9b46('0x4')](_0x9b46('0x2b'),_0x4fa731[_0x9b46('0x5')]),_0x4fa731);utils[_0x9b46('0x3')](util['format'](_0x9b46('0x2c'),_0x4fa731['uniqueid'],agents[_0x4fa731[_0x9b46('0x14')]][_0x9b46('0x7')],_0x4fa731[_0x9b46('0x14')]));agents[_0x4fa731[_0x9b46('0x14')]][_0x9b46('0x2d')]=utils[_0x9b46('0x16')]();agents[_0x4fa731[_0x9b46('0x14')]][_0x9b46('0x9')]=_0x4fa731[_0x9b46('0x9')];agents[_0x4fa731[_0x9b46('0x14')]][_0x9b46('0x19')]=_0x4fa731['connectedlinename'];agents[_0x4fa731[_0x9b46('0x14')]]['holdtime']=_0x4fa731[_0x9b46('0x20')];agents[_0x4fa731[_0x9b46('0x14')]]['lastevent']=_0x9b46('0x2e');_['forIn'](agents,function(_0x416538,_0x493b0f){if(_0x416538[_0x9b46('0x14')]!=_0x4fa731[_0x9b46('0x14')]&&_0x416538[_0x9b46('0x5')]==_0x4fa731[_0x9b46('0x5')]){_0x416538[_0x9b46('0x21')]=0x0;_0x416538['holdtime']=_0x4fa731['ringtime'];_0x416538[_0x9b46('0x2f')]=!![];_0x416538['agentringnoanswerAt']=utils['now']();_0x416538['lastevent']='answered_elsewhere';_0x416538[_0x9b46('0x28')]='answered_elsewhere';_0x416538[_0x9b46('0x30')]=_0x4fa731['destuniqueid'];_0x416538[_0x9b46('0x31')]=_0x4fa731[_0x9b46('0x7')];writeDB(_0x416538);}});}}catch(_0x2e92aa){utils[_0x9b46('0x1a')](util[_0x9b46('0x4')](_0x9b46('0x2b'),_0x4fa731[_0x9b46('0x5')]),_0x2e92aa);}};exports[_0x9b46('0x32')]=function(_0x148d86){try{if(!_['isNil'](agents[_0x148d86[_0x9b46('0x14')]])){utils[_0x9b46('0x12')](util[_0x9b46('0x4')](_0x9b46('0x33'),_0x148d86[_0x9b46('0x5')]),_0x148d86);utils[_0x9b46('0x3')](util[_0x9b46('0x4')](_0x9b46('0x34'),_0x148d86[_0x9b46('0x5')],agents[_0x148d86[_0x9b46('0x14')]][_0x9b46('0x7')],_0x148d86[_0x9b46('0x14')]));agents[_0x148d86[_0x9b46('0x14')]][_0x9b46('0x32')]=!![];agents[_0x148d86['destuniqueid']]['agentcompleteAt']=utils[_0x9b46('0x16')]();agents[_0x148d86[_0x9b46('0x14')]][_0x9b46('0x21')]=utils['diffTime'](agents[_0x148d86['destuniqueid']][_0x9b46('0x35')],agents[_0x148d86[_0x9b46('0x14')]][_0x9b46('0x2d')]);agents[_0x148d86[_0x9b46('0x14')]][_0x9b46('0x28')]=_0x148d86[_0x9b46('0x28')];agents[_0x148d86['destuniqueid']][_0x9b46('0x17')]=_0x9b46('0x36');writeDB(agents[_0x148d86[_0x9b46('0x14')]]);}}catch(_0x47a938){utils[_0x9b46('0x1a')](util['format'](_0x9b46('0x33'),_0x148d86[_0x9b46('0x5')]),_0x47a938);}};exports[_0x9b46('0x37')]=function(_0x566bad){try{if(!_[_0x9b46('0x1b')](agents[_0x566bad[_0x9b46('0x38')]])){utils[_0x9b46('0x12')](util[_0x9b46('0x4')](_0x9b46('0x39'),_0x566bad[_0x9b46('0x5')]),_0x566bad);utils['info'](util[_0x9b46('0x4')](_0x9b46('0x3a'),_0x566bad[_0x9b46('0x5')],agents[_0x566bad[_0x9b46('0x38')]][_0x9b46('0x7')],agents[_0x566bad[_0x9b46('0x38')]]['uniqueid']));agents[_0x566bad[_0x9b46('0x38')]]['transfer']=!![];agents[_0x566bad[_0x9b46('0x38')]][_0x9b46('0x3b')]=_0x9b46('0x3c');agents[_0x566bad[_0x9b46('0x38')]][_0x9b46('0x3d')]=_0x566bad['extension'];agents[_0x566bad[_0x9b46('0x38')]][_0x9b46('0x3e')]=agents[_0x566bad[_0x9b46('0x38')]][_0x9b46('0x5')];}}catch(_0x3f6b2f){utils[_0x9b46('0x1a')](util[_0x9b46('0x4')](_0x9b46('0x39'),_0x566bad[_0x9b46('0x5')]),_0x3f6b2f);}};exports[_0x9b46('0x3f')]=function(_0x2f411f){try{utils['debug'](util['format']('[%s][agents][attendedtransfer]',_0x2f411f[_0x9b46('0x40')]),_0x2f411f);if(_0x2f411f['origtransfereruniqueid']==_0x2f411f[_0x9b46('0x41')]){if(!_['isNil'](agents[_0x2f411f[_0x9b46('0x42')]])){utils['info'](util[_0x9b46('0x4')](_0x9b46('0x43'),_0x2f411f[_0x9b46('0x40')],agents[_0x2f411f[_0x9b46('0x42')]][_0x9b46('0x7')]));agents[_0x2f411f['secondtransfereruniqueid']][_0x9b46('0x44')]=!![];agents[_0x2f411f[_0x9b46('0x42')]][_0x9b46('0x3b')]=_0x9b46('0x45');agents[_0x2f411f[_0x9b46('0x42')]]['transferexten']=_0x2f411f['origtransfererexten'];agents[_0x2f411f[_0x9b46('0x42')]][_0x9b46('0x3e')]=_0x2f411f[_0x9b46('0x40')];}if(_0x2f411f[_0x9b46('0x46')]&&agents[_0x2f411f[_0x9b46('0x46')]]){agents[_0x2f411f[_0x9b46('0x46')]][_0x9b46('0x47')]=0x1;transfers[_0x2f411f[_0x9b46('0x46')]]=_['clone'](agents[_0x2f411f[_0x9b46('0x46')]]);transfers[_0x2f411f[_0x9b46('0x46')]][_0x9b46('0x48')]=agents[_0x2f411f['secondtransfereruniqueid']][_0x9b46('0x48')];transfers[_0x2f411f[_0x9b46('0x46')]][_0x9b46('0x49')]=agents[_0x2f411f[_0x9b46('0x42')]][_0x9b46('0x49')];transfers[_0x2f411f[_0x9b46('0x46')]]['agentcalledAt']=utils[_0x9b46('0x16')]();transfers[_0x2f411f[_0x9b46('0x46')]][_0x9b46('0x2d')]=utils[_0x9b46('0x16')]();transfers[_0x2f411f[_0x9b46('0x46')]][_0x9b46('0x1f')]=0x0;transfers[_0x2f411f['transfereeuniqueid']][_0x9b46('0x47')]=0x2;}}else if(_0x2f411f['secondtransfereruniqueid']==_0x2f411f[_0x9b46('0x4a')]){if(!_['isNil'](agents[_0x2f411f[_0x9b46('0x40')]])){utils[_0x9b46('0x3')](util['format'](_0x9b46('0x43'),_0x2f411f[_0x9b46('0x40')],agents[_0x2f411f[_0x9b46('0x40')]][_0x9b46('0x7')]));agents[_0x2f411f[_0x9b46('0x40')]]['transfer']=!![];agents[_0x2f411f[_0x9b46('0x40')]][_0x9b46('0x3b')]='ATTENDED';agents[_0x2f411f['origtransfereruniqueid']][_0x9b46('0x3d')]=_0x2f411f[_0x9b46('0x4b')];agents[_0x2f411f[_0x9b46('0x40')]][_0x9b46('0x3e')]=_0x2f411f[_0x9b46('0x42')];}if(_0x2f411f[_0x9b46('0x4c')]&&agents[_0x2f411f[_0x9b46('0x4c')]]){agents[_0x2f411f[_0x9b46('0x4c')]]['agententerreason']=0x1;transfers[_0x2f411f['transfertargetuniqueid']]=_[_0x9b46('0x4d')](agents[_0x2f411f[_0x9b46('0x4c')]]);transfers[_0x2f411f['transfertargetuniqueid']][_0x9b46('0x48')]=agents[_0x2f411f['origtransfereruniqueid']][_0x9b46('0x48')];transfers[_0x2f411f['transfertargetuniqueid']][_0x9b46('0x49')]=agents[_0x2f411f[_0x9b46('0x40')]][_0x9b46('0x49')];transfers[_0x2f411f['transfertargetuniqueid']][_0x9b46('0x15')]=utils[_0x9b46('0x16')]();transfers[_0x2f411f[_0x9b46('0x4c')]]['agentconnectAt']=utils[_0x9b46('0x16')]();transfers[_0x2f411f[_0x9b46('0x4c')]][_0x9b46('0x1f')]=0x0;transfers[_0x2f411f[_0x9b46('0x4c')]][_0x9b46('0x47')]=0x2;}}}catch(_0x4e8756){utils['error'](util['format']('[%s][agents][attendedtransfer]',_0x2f411f['origtransfereruniqueid']),_0x4e8756);}};exports[_0x9b46('0x4e')]=function(_0x200607){try{utils[_0x9b46('0x12')](util[_0x9b46('0x4')](_0x9b46('0x4f'),_0x200607[_0x9b46('0x5')]),_0x200607);if(agents[_0x200607[_0x9b46('0x5')]]&&agents[_0x200607[_0x9b46('0x5')]]['reason']===_0x9b46('0x1e')){if(_0x200607[_0x9b46('0x50')]==='21'){agents[_0x200607['uniqueid']][_0x9b46('0x28')]='rejected';agents[_0x200607[_0x9b46('0x5')]][_0x9b46('0x17')]=_0x9b46('0x51');}utils[_0x9b46('0x3')](util[_0x9b46('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x200607['uniqueid'],agents[_0x200607[_0x9b46('0x5')]]['membername'],agents[_0x200607[_0x9b46('0x5')]][_0x9b46('0x28')],agents[_0x200607['uniqueid']]['lastevent']));writeDB(agents[_0x200607['uniqueid']]);var _0x2978aa=unanswered['indexOf'](_0x200607['uniqueid']);if(_0x2978aa>-0x1){unanswered[_0x9b46('0x52')](_0x2978aa,0x1);}}if(transfers[_0x200607[_0x9b46('0x5')]]){transfers[_0x200607[_0x9b46('0x5')]][_0x9b46('0x32')]=!![];transfers[_0x200607['uniqueid']][_0x9b46('0x35')]=utils[_0x9b46('0x16')]();transfers[_0x200607[_0x9b46('0x5')]]['talktime']=utils['diffTime'](transfers[_0x200607[_0x9b46('0x5')]][_0x9b46('0x35')],transfers[_0x200607[_0x9b46('0x5')]]['agentconnectAt']);transfers[_0x200607[_0x9b46('0x5')]][_0x9b46('0x28')]='agent';transfers[_0x200607[_0x9b46('0x5')]][_0x9b46('0x17')]=_0x9b46('0x36');utils[_0x9b46('0x3')](util['format']('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x200607[_0x9b46('0x5')],transfers[_0x200607['uniqueid']][_0x9b46('0x7')],transfers[_0x200607[_0x9b46('0x5')]]['reason'],transfers[_0x200607['uniqueid']]['lastevent']));writeDB(transfers[_0x200607[_0x9b46('0x5')]],!![]);}if(agents[_0x200607['uniqueid']]&&agents[_0x200607[_0x9b46('0x5')]][_0x9b46('0x2d')]){agents[_0x200607[_0x9b46('0x5')]][_0x9b46('0x32')]=!![];agents[_0x200607['uniqueid']][_0x9b46('0x35')]=utils[_0x9b46('0x16')]();agents[_0x200607[_0x9b46('0x5')]][_0x9b46('0x21')]=utils[_0x9b46('0x53')](agents[_0x200607['uniqueid']][_0x9b46('0x35')],agents[_0x200607['uniqueid']][_0x9b46('0x2d')]);agents[_0x200607[_0x9b46('0x5')]]['reason']=agents[_0x200607[_0x9b46('0x5')]][_0x9b46('0x44')]?_0x9b46('0x44'):_0x9b46('0x54');agents[_0x200607['uniqueid']][_0x9b46('0x17')]='complete';utils[_0x9b46('0x3')](util[_0x9b46('0x4')](_0x9b46('0x55'),_0x200607['uniqueid'],agents[_0x200607[_0x9b46('0x5')]][_0x9b46('0x7')],agents[_0x200607[_0x9b46('0x5')]][_0x9b46('0x28')],agents[_0x200607['uniqueid']][_0x9b46('0x17')]));writeDB(agents[_0x200607['uniqueid']]);}}catch(_0x420d61){utils[_0x9b46('0x1a')](util[_0x9b46('0x4')](_0x9b46('0x4f'),_0x200607[_0x9b46('0x5')]),_0x420d61);}}; \ No newline at end of file +var _0x5c00=['queuecallerabandon','forIn','includes','agentringnoanswer','now','abandoned','[%s][agents][queuecallerabandon]','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','agentringnoanswerAt','answered_elsewhere','answeredelsewheremembername','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','agentcompleteAt','complete','[%s][agents][agentcomplete]','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','blind','transferexten','extension','transferuniqueid','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfer','transfertype','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','agent','lodash','util','./utils','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','membername','interface','calleridnum','connectedlinenum','queue','getVoiceQueueByName','type','agentacw','agentcomplete','acw','acwTimeout','CreateVoiceAgentReport','request','destuniqueid','debug','[%s][agents][agentcalled]','agentcalledAt','lastevent','called','connectedlinename','info','error','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','timeout','reason','holdtime','ringtime','talktime','push'];(function(_0x4b8968,_0x5c9b44){var _0x3a0ab7=function(_0x4dade2){while(--_0x4dade2){_0x4b8968['push'](_0x4b8968['shift']());}};_0x3a0ab7(++_0x5c9b44);}(_0x5c00,0x17e));var _0x05c0=function(_0x3d4ef1,_0x5a957c){_0x3d4ef1=_0x3d4ef1-0x0;var _0x409423=_0x5c00[_0x3d4ef1];return _0x409423;};'use strict';var _=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var utils=require(_0x05c0('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x4e54ec,_0x1e76da){utils['info'](util[_0x05c0('0x3')](_0x05c0('0x4'),_0x4e54ec[_0x05c0('0x5')],_0x4e54ec[_0x05c0('0x6')],_0x4e54ec['queue'],_0x4e54ec[_0x05c0('0x7')],_0x4e54ec[_0x05c0('0x8')],_0x4e54ec[_0x05c0('0x9')],_0x4e54ec[_0x05c0('0xa')],_0x4e54ec['lastevent']));if(_0x4e54ec[_0x05c0('0xb')]){utils[_0x05c0('0xc')](_0x4e54ec[_0x05c0('0xb')])['then'](function(_0x32a795){if(_0x32a795){_0x4e54ec[_0x05c0('0xd')]=_0x32a795[_0x05c0('0xd')];_0x4e54ec[_0x05c0('0xe')]=_0x4e54ec[_0x05c0('0xf')]?_0x32a795[_0x05c0('0x10')]:![];_0x4e54ec['acwtime']=_0x4e54ec['agentacw']?_0x32a795[_0x05c0('0x11')]:0x0;}utils['request'](_0x05c0('0x12'),_0x4e54ec);});}else{utils[_0x05c0('0x13')](_0x05c0('0x12'),_0x4e54ec);}if(_0x1e76da){delete transfers[_0x4e54ec['uniqueid']];}else{delete agents[_0x4e54ec[_0x05c0('0x14')]];}}exports['agentcalled']=function(_0x16a290){try{utils[_0x05c0('0x15')](util[_0x05c0('0x3')](_0x05c0('0x16'),_0x16a290[_0x05c0('0x5')]),_0x16a290);agents[_0x16a290[_0x05c0('0x14')]]=_0x16a290;agents[_0x16a290[_0x05c0('0x14')]][_0x05c0('0x17')]=utils['now']();agents[_0x16a290[_0x05c0('0x14')]][_0x05c0('0x18')]=_0x05c0('0x19');agents[_0x16a290[_0x05c0('0x14')]][_0x05c0('0xa')]=null;agents[_0x16a290[_0x05c0('0x14')]][_0x05c0('0x1a')]=null;utils[_0x05c0('0x1b')](util[_0x05c0('0x3')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x16a290[_0x05c0('0x5')],agents[_0x16a290[_0x05c0('0x14')]][_0x05c0('0x7')],_0x16a290['destuniqueid']));}catch(_0x40d905){utils[_0x05c0('0x1c')](util[_0x05c0('0x3')](_0x05c0('0x16'),_0x16a290[_0x05c0('0x5')]),_0x40d905);}};exports['agentringnoanswer']=function(_0x407c1f){try{if(!_[_0x05c0('0x1d')](agents[_0x407c1f['destuniqueid']])){utils['debug'](util['format'](_0x05c0('0x1e'),_0x407c1f[_0x05c0('0x5')]),_0x407c1f);utils[_0x05c0('0x1b')](util[_0x05c0('0x3')](_0x05c0('0x1f'),_0x407c1f[_0x05c0('0x5')],agents[_0x407c1f[_0x05c0('0x14')]]['membername'],_0x407c1f[_0x05c0('0x14')]));agents[_0x407c1f[_0x05c0('0x14')]]['agentringnoanswer']=!![];agents[_0x407c1f['destuniqueid']]['agentringnoanswerAt']=utils['now']();agents[_0x407c1f['destuniqueid']][_0x05c0('0x18')]=_0x05c0('0x20');agents[_0x407c1f['destuniqueid']][_0x05c0('0x21')]=_0x05c0('0x20');agents[_0x407c1f[_0x05c0('0x14')]][_0x05c0('0x22')]=_0x407c1f['ringtime']?parseInt(_0x407c1f[_0x05c0('0x23')])/0x3e8:0x0;agents[_0x407c1f[_0x05c0('0x14')]][_0x05c0('0x24')]=0x0;unanswered[_0x05c0('0x25')](_0x407c1f[_0x05c0('0x14')]);}}catch(_0x5d12e0){utils['error'](util['format'](_0x05c0('0x1e'),_0x407c1f[_0x05c0('0x5')]),_0x5d12e0);}};exports[_0x05c0('0x26')]=function(_0xd6574e){try{_[_0x05c0('0x27')](agents,function(_0x1e00c5,_0x1c4c8f){if(_0x1e00c5[_0x05c0('0x5')]==_0xd6574e[_0x05c0('0x5')]&&!_[_0x05c0('0x28')](unanswered,_0x1e00c5[_0x05c0('0x14')])){utils[_0x05c0('0x15')](util['format']('[%s][agents][queuecallerabandon]',_0xd6574e[_0x05c0('0x5')]),_0xd6574e);utils[_0x05c0('0x1b')](util[_0x05c0('0x3')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0xd6574e[_0x05c0('0x5')],_0x1e00c5[_0x05c0('0x7')],_0x1e00c5['destuniqueid']));_0x1e00c5[_0x05c0('0x29')]=!![];_0x1e00c5['agentringnoanswerAt']=utils[_0x05c0('0x2a')]();_0x1e00c5[_0x05c0('0x18')]=_0x05c0('0x2b');_0x1e00c5[_0x05c0('0x21')]=_0x05c0('0x2b');_0x1e00c5[_0x05c0('0x22')]=_0xd6574e[_0x05c0('0x22')];_0x1e00c5[_0x05c0('0x24')]=0x0;writeDB(_0x1e00c5);}});}catch(_0x3d8d76){utils[_0x05c0('0x1c')](util[_0x05c0('0x3')](_0x05c0('0x2c'),_0xd6574e[_0x05c0('0x5')]),_0x3d8d76);}};exports[_0x05c0('0x2d')]=function(_0x185d05){try{if(agents[_0x185d05[_0x05c0('0x14')]]){utils[_0x05c0('0x15')](util[_0x05c0('0x3')](_0x05c0('0x2e'),_0x185d05[_0x05c0('0x5')]),_0x185d05);utils[_0x05c0('0x1b')](util[_0x05c0('0x3')](_0x05c0('0x2f'),_0x185d05[_0x05c0('0x5')],agents[_0x185d05[_0x05c0('0x14')]][_0x05c0('0x7')],_0x185d05[_0x05c0('0x14')]));agents[_0x185d05[_0x05c0('0x14')]][_0x05c0('0x30')]=utils[_0x05c0('0x2a')]();agents[_0x185d05[_0x05c0('0x14')]][_0x05c0('0xa')]=_0x185d05[_0x05c0('0xa')];agents[_0x185d05['destuniqueid']][_0x05c0('0x1a')]=_0x185d05[_0x05c0('0x1a')];agents[_0x185d05[_0x05c0('0x14')]][_0x05c0('0x22')]=_0x185d05['ringtime'];agents[_0x185d05['destuniqueid']][_0x05c0('0x18')]=_0x05c0('0x31');_[_0x05c0('0x27')](agents,function(_0x4ced8e,_0x29dc87){if(_0x4ced8e[_0x05c0('0x14')]!=_0x185d05[_0x05c0('0x14')]&&_0x4ced8e[_0x05c0('0x5')]==_0x185d05['uniqueid']){_0x4ced8e[_0x05c0('0x24')]=0x0;_0x4ced8e[_0x05c0('0x22')]=_0x185d05['ringtime'];_0x4ced8e[_0x05c0('0x29')]=!![];_0x4ced8e[_0x05c0('0x32')]=utils[_0x05c0('0x2a')]();_0x4ced8e[_0x05c0('0x18')]=_0x05c0('0x33');_0x4ced8e[_0x05c0('0x21')]=_0x05c0('0x33');_0x4ced8e['answeredelsewheredestinationuniqueid']=_0x185d05['destuniqueid'];_0x4ced8e[_0x05c0('0x34')]=_0x185d05[_0x05c0('0x7')];writeDB(_0x4ced8e);}});}}catch(_0xaa5d53){utils[_0x05c0('0x1c')](util[_0x05c0('0x3')]('[%s][agents][agentconnect]',_0x185d05[_0x05c0('0x5')]),_0xaa5d53);}};exports[_0x05c0('0xf')]=function(_0x2fdfe8){try{if(!_[_0x05c0('0x1d')](agents[_0x2fdfe8[_0x05c0('0x14')]])){utils[_0x05c0('0x15')](util[_0x05c0('0x3')]('[%s][agents][agentcomplete]',_0x2fdfe8[_0x05c0('0x5')]),_0x2fdfe8);utils[_0x05c0('0x1b')](util[_0x05c0('0x3')](_0x05c0('0x35'),_0x2fdfe8[_0x05c0('0x5')],agents[_0x2fdfe8[_0x05c0('0x14')]][_0x05c0('0x7')],_0x2fdfe8[_0x05c0('0x14')]));agents[_0x2fdfe8[_0x05c0('0x14')]][_0x05c0('0xf')]=!![];agents[_0x2fdfe8[_0x05c0('0x14')]]['agentcompleteAt']=utils['now']();agents[_0x2fdfe8[_0x05c0('0x14')]][_0x05c0('0x24')]=utils[_0x05c0('0x36')](agents[_0x2fdfe8[_0x05c0('0x14')]][_0x05c0('0x37')],agents[_0x2fdfe8[_0x05c0('0x14')]]['agentconnectAt']);agents[_0x2fdfe8[_0x05c0('0x14')]][_0x05c0('0x21')]=_0x2fdfe8[_0x05c0('0x21')];agents[_0x2fdfe8[_0x05c0('0x14')]]['lastevent']=_0x05c0('0x38');writeDB(agents[_0x2fdfe8[_0x05c0('0x14')]]);}}catch(_0x3ec0bf){utils[_0x05c0('0x1c')](util['format'](_0x05c0('0x39'),_0x2fdfe8[_0x05c0('0x5')]),_0x3ec0bf);}};exports[_0x05c0('0x3a')]=function(_0x9b521b){try{if(!_['isNil'](agents[_0x9b521b[_0x05c0('0x3b')]])){utils[_0x05c0('0x15')](util['format'](_0x05c0('0x3c'),_0x9b521b['uniqueid']),_0x9b521b);utils['info'](util[_0x05c0('0x3')]('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x9b521b[_0x05c0('0x5')],agents[_0x9b521b[_0x05c0('0x3b')]][_0x05c0('0x7')],agents[_0x9b521b[_0x05c0('0x3b')]][_0x05c0('0x5')]));agents[_0x9b521b[_0x05c0('0x3b')]]['transfer']=!![];agents[_0x9b521b[_0x05c0('0x3b')]]['transfertype']=_0x05c0('0x3d');agents[_0x9b521b[_0x05c0('0x3b')]][_0x05c0('0x3e')]=_0x9b521b[_0x05c0('0x3f')];agents[_0x9b521b[_0x05c0('0x3b')]][_0x05c0('0x40')]=agents[_0x9b521b[_0x05c0('0x3b')]]['uniqueid'];}}catch(_0x5215b4){utils['error'](util[_0x05c0('0x3')](_0x05c0('0x3c'),_0x9b521b['uniqueid']),_0x5215b4);}};exports['attendedtransfer']=function(_0xbfb9cb){try{utils[_0x05c0('0x15')](util[_0x05c0('0x3')](_0x05c0('0x41'),_0xbfb9cb[_0x05c0('0x42')]),_0xbfb9cb);if(_0xbfb9cb[_0x05c0('0x42')]==_0xbfb9cb[_0x05c0('0x43')]){if(!_['isNil'](agents[_0xbfb9cb[_0x05c0('0x44')]])){utils[_0x05c0('0x1b')](util[_0x05c0('0x3')](_0x05c0('0x45'),_0xbfb9cb['origtransfereruniqueid'],agents[_0xbfb9cb[_0x05c0('0x44')]]['membername']));agents[_0xbfb9cb[_0x05c0('0x44')]][_0x05c0('0x46')]=!![];agents[_0xbfb9cb['secondtransfereruniqueid']][_0x05c0('0x47')]='ATTENDED';agents[_0xbfb9cb[_0x05c0('0x44')]][_0x05c0('0x3e')]=_0xbfb9cb[_0x05c0('0x48')];agents[_0xbfb9cb[_0x05c0('0x44')]][_0x05c0('0x40')]=_0xbfb9cb[_0x05c0('0x42')];}if(_0xbfb9cb['transfereeuniqueid']&&agents[_0xbfb9cb[_0x05c0('0x49')]]){agents[_0xbfb9cb[_0x05c0('0x49')]][_0x05c0('0x4a')]=0x1;transfers[_0xbfb9cb[_0x05c0('0x49')]]=_[_0x05c0('0x4b')](agents[_0xbfb9cb[_0x05c0('0x49')]]);transfers[_0xbfb9cb['transfereeuniqueid']][_0x05c0('0x9')]=agents[_0xbfb9cb[_0x05c0('0x44')]][_0x05c0('0x9')];transfers[_0xbfb9cb[_0x05c0('0x49')]][_0x05c0('0x4c')]=agents[_0xbfb9cb[_0x05c0('0x44')]][_0x05c0('0x4c')];transfers[_0xbfb9cb[_0x05c0('0x49')]][_0x05c0('0x17')]=utils[_0x05c0('0x2a')]();transfers[_0xbfb9cb[_0x05c0('0x49')]][_0x05c0('0x30')]=utils['now']();transfers[_0xbfb9cb['transfereeuniqueid']]['holdtime']=0x0;transfers[_0xbfb9cb[_0x05c0('0x49')]][_0x05c0('0x4a')]=0x2;}}else if(_0xbfb9cb[_0x05c0('0x44')]==_0xbfb9cb['secondtransfererlinkedid']){if(!_[_0x05c0('0x1d')](agents[_0xbfb9cb[_0x05c0('0x42')]])){utils[_0x05c0('0x1b')](util[_0x05c0('0x3')](_0x05c0('0x45'),_0xbfb9cb[_0x05c0('0x42')],agents[_0xbfb9cb[_0x05c0('0x42')]]['membername']));agents[_0xbfb9cb[_0x05c0('0x42')]][_0x05c0('0x46')]=!![];agents[_0xbfb9cb[_0x05c0('0x42')]][_0x05c0('0x47')]='ATTENDED';agents[_0xbfb9cb['origtransfereruniqueid']]['transferexten']=_0xbfb9cb[_0x05c0('0x4d')];agents[_0xbfb9cb[_0x05c0('0x42')]][_0x05c0('0x40')]=_0xbfb9cb[_0x05c0('0x44')];}if(_0xbfb9cb[_0x05c0('0x4e')]&&agents[_0xbfb9cb[_0x05c0('0x4e')]]){agents[_0xbfb9cb[_0x05c0('0x4e')]]['agententerreason']=0x1;transfers[_0xbfb9cb[_0x05c0('0x4e')]]=_[_0x05c0('0x4b')](agents[_0xbfb9cb[_0x05c0('0x4e')]]);transfers[_0xbfb9cb[_0x05c0('0x4e')]][_0x05c0('0x9')]=agents[_0xbfb9cb['origtransfereruniqueid']]['calleridnum'];transfers[_0xbfb9cb[_0x05c0('0x4e')]][_0x05c0('0x4c')]=agents[_0xbfb9cb['origtransfereruniqueid']][_0x05c0('0x4c')];transfers[_0xbfb9cb['transfertargetuniqueid']]['agentcalledAt']=utils[_0x05c0('0x2a')]();transfers[_0xbfb9cb[_0x05c0('0x4e')]][_0x05c0('0x30')]=utils['now']();transfers[_0xbfb9cb['transfertargetuniqueid']][_0x05c0('0x22')]=0x0;transfers[_0xbfb9cb[_0x05c0('0x4e')]][_0x05c0('0x4a')]=0x2;}}}catch(_0x5b39cb){utils['error'](util['format']('[%s][agents][attendedtransfer]',_0xbfb9cb['origtransfereruniqueid']),_0x5b39cb);}};exports[_0x05c0('0x4f')]=function(_0x4f43ae){try{utils['debug'](util['format'](_0x05c0('0x50'),_0x4f43ae[_0x05c0('0x5')]),_0x4f43ae);if(agents[_0x4f43ae[_0x05c0('0x5')]]&&agents[_0x4f43ae['uniqueid']][_0x05c0('0x21')]===_0x05c0('0x20')){if(_0x4f43ae['cause']==='21'){agents[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0x21')]=_0x05c0('0x51');agents[_0x4f43ae[_0x05c0('0x5')]]['lastevent']=_0x05c0('0x51');}utils[_0x05c0('0x1b')](util[_0x05c0('0x3')](_0x05c0('0x52'),_0x4f43ae[_0x05c0('0x5')],agents[_0x4f43ae['uniqueid']]['membername'],agents[_0x4f43ae[_0x05c0('0x5')]]['reason'],agents[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0x18')]));writeDB(agents[_0x4f43ae['uniqueid']]);var _0x3135bd=unanswered['indexOf'](_0x4f43ae['uniqueid']);if(_0x3135bd>-0x1){unanswered['splice'](_0x3135bd,0x1);}}if(transfers[_0x4f43ae['uniqueid']]){transfers[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0xf')]=!![];transfers[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0x37')]=utils['now']();transfers[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0x24')]=utils[_0x05c0('0x36')](transfers[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0x37')],transfers[_0x4f43ae['uniqueid']][_0x05c0('0x30')]);transfers[_0x4f43ae['uniqueid']]['reason']=_0x05c0('0x53');transfers[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0x18')]=_0x05c0('0x38');utils[_0x05c0('0x1b')](util[_0x05c0('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x4f43ae['uniqueid'],transfers[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0x7')],transfers[_0x4f43ae[_0x05c0('0x5')]]['reason'],transfers[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0x18')]));writeDB(transfers[_0x4f43ae[_0x05c0('0x5')]],!![]);}if(agents[_0x4f43ae[_0x05c0('0x5')]]&&agents[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0x30')]){agents[_0x4f43ae['uniqueid']][_0x05c0('0xf')]=!![];agents[_0x4f43ae[_0x05c0('0x5')]]['agentcompleteAt']=utils[_0x05c0('0x2a')]();agents[_0x4f43ae[_0x05c0('0x5')]]['talktime']=utils[_0x05c0('0x36')](agents[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0x37')],agents[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0x30')]);agents[_0x4f43ae[_0x05c0('0x5')]]['reason']=agents[_0x4f43ae[_0x05c0('0x5')]]['transfer']?_0x05c0('0x46'):_0x05c0('0x53');agents[_0x4f43ae[_0x05c0('0x5')]][_0x05c0('0x18')]=_0x05c0('0x38');utils[_0x05c0('0x1b')](util[_0x05c0('0x3')](_0x05c0('0x52'),_0x4f43ae[_0x05c0('0x5')],agents[_0x4f43ae[_0x05c0('0x5')]]['membername'],agents[_0x4f43ae[_0x05c0('0x5')]]['reason'],agents[_0x4f43ae[_0x05c0('0x5')]]['lastevent']));writeDB(agents[_0x4f43ae[_0x05c0('0x5')]]);}}catch(_0x36f82a){utils[_0x05c0('0x1c')](util[_0x05c0('0x3')](_0x05c0('0x50'),_0x4f43ae[_0x05c0('0x5')]),_0x36f82a);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 0d88732..fd241f6 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 _0x8dcf=['lodash','util','./utils','FAILED','NO\x20ANSWER','BUSY','uniqueid','transfereeuniqueid','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','newchannel','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','channelstate','ANSWERED','debug','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','billableseconds','attendedtransfer','localtwolinkedid','origtransfereruniqueid','transfereechannel','secondtransfererchannel','destinationchannel','userfield','_attended','transfertargetchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','[%s][calls][attendedtransfer]','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstop]','mohtime','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','includes','hangup','noop','gotoif','lastdata'];(function(_0xd50f10,_0x1078bf){var _0x4b5b26=function(_0x4d7014){while(--_0x4d7014){_0xd50f10['push'](_0xd50f10['shift']());}};_0x4b5b26(++_0x1078bf);}(_0x8dcf,0xe2));var _0xf8dc=function(_0x5d7fc6,_0x29bd32){_0x5d7fc6=_0x5d7fc6-0x0;var _0x86f410=_0x8dcf[_0x5d7fc6];return _0x86f410;};'use strict';var _=require(_0xf8dc('0x0'));var util=require(_0xf8dc('0x1'));var utils=require(_0xf8dc('0x2'));var transfers=require('./transfers.controller');var dispositions=['NO\x20ANSWER',_0xf8dc('0x3'),_0xf8dc('0x3'),'NO\x20ANSWER',_0xf8dc('0x4'),_0xf8dc('0x4'),'ANSWERED',_0xf8dc('0x5'),'FAILED',_0xf8dc('0x3'),'FAILED'];var channels={};function writeDB(_0x18465d){var _0x5b1e28;if(transfers['blinds'][_0x18465d[_0xf8dc('0x6')]]){_0x5b1e28=_0x18465d[_0xf8dc('0x6')];_0x18465d[_0xf8dc('0x6')]=transfers['blinds'][_0x18465d[_0xf8dc('0x6')]][_0xf8dc('0x7')];}utils['info'](util[_0xf8dc('0x8')](_0xf8dc('0x9'),_0x18465d[_0xf8dc('0x6')],_0x18465d[_0xf8dc('0xa')],_0x18465d[_0xf8dc('0xb')],_0x18465d[_0xf8dc('0xc')],_0x18465d[_0xf8dc('0xd')],_0x18465d[_0xf8dc('0xe')],_0x18465d[_0xf8dc('0xf')],_0x18465d[_0xf8dc('0x10')]));if(_0x18465d[_0xf8dc('0x11')]){utils[_0xf8dc('0x12')](_0x18465d[_0xf8dc('0x11')])[_0xf8dc('0x13')](function(_0x5317cc){if(_0x5317cc){_0x18465d[_0xf8dc('0x14')]=_0x5317cc['id'];}utils[_0xf8dc('0x15')](_0xf8dc('0x16'),_0x18465d);});}else{utils['request'](_0xf8dc('0x16'),_0x18465d);}if(channels[_0x18465d['uniqueid']]){delete channels[_0x18465d[_0xf8dc('0x6')]];}else if(_0x5b1e28&&channels[_0x5b1e28]){delete transfers['blinds'][_0x5b1e28];delete channels[_0x5b1e28];}}exports[_0xf8dc('0x17')]=function(_0x22f023){try{utils['debug'](util[_0xf8dc('0x8')](_0xf8dc('0x18'),_0x22f023['uniqueid']),_0x22f023);if(_0x22f023[_0xf8dc('0x6')]==_0x22f023[_0xf8dc('0x19')]&&_0x22f023['channel']!=_0xf8dc('0x1a')){utils[_0xf8dc('0x1b')](util[_0xf8dc('0x8')](_0xf8dc('0x1c'),_0x22f023[_0xf8dc('0x6')],_0x22f023[_0xf8dc('0x1d')],_0x22f023[_0xf8dc('0x1e')]));channels[_0x22f023[_0xf8dc('0x6')]]={'uniqueid':_0x22f023['uniqueid'],'accountcode':_0x22f023[_0xf8dc('0x11')],'source':_0x22f023[_0xf8dc('0xe')],'destination':_0x22f023[_0xf8dc('0x1e')],'destinationcontext':_0x22f023[_0xf8dc('0x1d')],'channel':_0x22f023[_0xf8dc('0xa')],'starttime':utils[_0xf8dc('0x1f')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xf8dc('0x4'),'amaflags':_0xf8dc('0x20')};}}catch(_0x565532){utils[_0xf8dc('0x21')](util[_0xf8dc('0x8')](_0xf8dc('0x18'),_0x22f023[_0xf8dc('0x6')]),_0x565532);}};exports[_0xf8dc('0x22')]=function(_0x423600){try{utils['debug'](util['format'](_0xf8dc('0x23'),_0x423600[_0xf8dc('0x6')]),_0x423600);if(!_[_0xf8dc('0x24')](channels[_0x423600[_0xf8dc('0x6')]])&&_0x423600['channelstate']==0x6){utils['info'](util['format'](_0xf8dc('0x25'),_0x423600[_0xf8dc('0x6')],_0x423600['context'],_0x423600[_0xf8dc('0xa')]));if(_['isNil'](channels[_0x423600['uniqueid']][_0xf8dc('0x26')])){channels[_0x423600[_0xf8dc('0x6')]][_0xf8dc('0x26')]=utils[_0xf8dc('0x1f')]();}}else if(!_[_0xf8dc('0x24')](channels[_0x423600[_0xf8dc('0x19')]])&&_0x423600['channelstate']==0x6&&_0x423600['context']!=_0xf8dc('0x27')){utils[_0xf8dc('0x1b')](util[_0xf8dc('0x8')](_0xf8dc('0x28'),_0x423600[_0xf8dc('0x6')],_0x423600[_0xf8dc('0x19')],_0x423600['context'],_0x423600['channel']));channels[_0x423600[_0xf8dc('0x19')]][_0xf8dc('0x11')]=_0x423600[_0xf8dc('0x11')];channels[_0x423600[_0xf8dc('0x19')]]['destinationchannel']=_0x423600[_0xf8dc('0xa')];if(_[_0xf8dc('0x24')](channels[_0x423600[_0xf8dc('0x19')]]['answertime'])){channels[_0x423600[_0xf8dc('0x19')]][_0xf8dc('0x29')]=utils[_0xf8dc('0x1f')]();}channels[_0x423600[_0xf8dc('0x19')]]['disposition']=dispositions[_['toNumber'](_0x423600[_0xf8dc('0x2a')])]||_0xf8dc('0x2b');}}catch(_0x1f11b5){utils[_0xf8dc('0x21')](util[_0xf8dc('0x8')](_0xf8dc('0x23'),_0x423600[_0xf8dc('0x6')]),_0x1f11b5);}};exports['hangup']=function(_0x4637dd){try{if(!_[_0xf8dc('0x24')](channels[_0x4637dd[_0xf8dc('0x6')]])){utils[_0xf8dc('0x2c')](util[_0xf8dc('0x8')](_0xf8dc('0x2d'),_0x4637dd[_0xf8dc('0x6')]),_0x4637dd);if(_['isNil'](channels[_0x4637dd[_0xf8dc('0x6')]][_0xf8dc('0x2e')])){channels[_0x4637dd[_0xf8dc('0x6')]]['callerid']=_0x4637dd[_0xf8dc('0x2f')]+'\x20<'+_0x4637dd[_0xf8dc('0xe')]+'>';}utils[_0xf8dc('0x1b')](util[_0xf8dc('0x8')](_0xf8dc('0x30'),_0x4637dd['uniqueid'],channels[_0x4637dd['uniqueid']]['callerid'],_0x4637dd[_0xf8dc('0x31')]));channels[_0x4637dd[_0xf8dc('0x6')]][_0xf8dc('0x32')]=utils[_0xf8dc('0x1f')]();channels[_0x4637dd[_0xf8dc('0x6')]][_0xf8dc('0x33')]=utils[_0xf8dc('0x34')](channels[_0x4637dd['uniqueid']]['endtime'],channels[_0x4637dd[_0xf8dc('0x6')]][_0xf8dc('0x35')]);channels[_0x4637dd[_0xf8dc('0x6')]][_0xf8dc('0x36')]=channels[_0x4637dd['uniqueid']][_0xf8dc('0x29')]?utils[_0xf8dc('0x34')](channels[_0x4637dd[_0xf8dc('0x6')]]['endtime'],channels[_0x4637dd[_0xf8dc('0x6')]][_0xf8dc('0x29')]):0x0;writeDB(channels[_0x4637dd[_0xf8dc('0x6')]]);}}catch(_0x352c76){utils[_0xf8dc('0x21')](util[_0xf8dc('0x8')](_0xf8dc('0x2d'),_0x4637dd[_0xf8dc('0x6')]),_0x352c76);}};exports[_0xf8dc('0x37')]=function(_0x71453b){try{if(!_[_0xf8dc('0x24')](channels[_0x71453b[_0xf8dc('0x38')]])){utils[_0xf8dc('0x2c')](util[_0xf8dc('0x8')]('[%s][calls][attendedtransfer]',_0x71453b[_0xf8dc('0x39')]),_0x71453b);if(channels[_0x71453b[_0xf8dc('0x38')]]['channel']==_0x71453b[_0xf8dc('0x3a')]){utils[_0xf8dc('0x1b')](util[_0xf8dc('0x8')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x71453b[_0xf8dc('0x39')],_0x71453b[_0xf8dc('0x38')],_0x71453b[_0xf8dc('0x3b')]));channels[_0x71453b[_0xf8dc('0x38')]][_0xf8dc('0x3c')]=_0x71453b[_0xf8dc('0x3b')];channels[_0x71453b['localtwolinkedid']][_0xf8dc('0x3d')]=_0xf8dc('0x3e');}else if(channels[_0x71453b[_0xf8dc('0x38')]][_0xf8dc('0xa')]=_0x71453b[_0xf8dc('0x3f')]){utils['info'](util[_0xf8dc('0x8')](_0xf8dc('0x40'),_0x71453b['origtransfereruniqueid'],_0x71453b[_0xf8dc('0x38')],_0x71453b[_0xf8dc('0x41')]));channels[_0x71453b['localtwolinkedid']][_0xf8dc('0x3c')]=_0x71453b[_0xf8dc('0x41')];channels[_0x71453b[_0xf8dc('0x38')]][_0xf8dc('0x3d')]='_attended';}}}catch(_0x14a871){utils[_0xf8dc('0x21')](util['format'](_0xf8dc('0x42'),_0x71453b['origtransfereruniqueid']),_0x14a871);}};exports[_0xf8dc('0x43')]=function(_0x3cc0e9){try{if(!_[_0xf8dc('0x24')](channels[_0x3cc0e9['uniqueid']])){utils[_0xf8dc('0x2c')](util[_0xf8dc('0x8')](_0xf8dc('0x44'),_0x3cc0e9[_0xf8dc('0x6')]),_0x3cc0e9);channels[_0x3cc0e9['uniqueid']]['musiconholdstartAt']=utils[_0xf8dc('0x1f')]();utils[_0xf8dc('0x1b')](util[_0xf8dc('0x8')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x3cc0e9[_0xf8dc('0x6')],channels[_0x3cc0e9[_0xf8dc('0x6')]][_0xf8dc('0x45')]));}}catch(_0x1f2b9e){utils[_0xf8dc('0x21')](util[_0xf8dc('0x8')](_0xf8dc('0x44'),_0x3cc0e9['uniqueid']),_0x1f2b9e);}};exports['musiconholdstop']=function(_0x5f350a){try{if(!_[_0xf8dc('0x24')](channels[_0x5f350a[_0xf8dc('0x6')]])){utils[_0xf8dc('0x2c')](util[_0xf8dc('0x8')](_0xf8dc('0x46'),_0x5f350a['uniqueid']),_0x5f350a);if(!_['isNil'](channels[_0x5f350a['uniqueid']][_0xf8dc('0x45')])){channels[_0x5f350a[_0xf8dc('0x6')]][_0xf8dc('0x47')]+=utils['diffTime'](utils['now'](),channels[_0x5f350a[_0xf8dc('0x6')]]['musiconholdstartAt']);utils['info'](util['format']('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x5f350a[_0xf8dc('0x6')],channels[_0x5f350a[_0xf8dc('0x6')]]['mohtime']));delete channels[_0x5f350a[_0xf8dc('0x6')]][_0xf8dc('0x45')];}}}catch(_0x330e92){utils[_0xf8dc('0x21')](util['format']('[%s][calls][musiconholdstop]',_0x5f350a[_0xf8dc('0x6')]),_0x330e92);}};exports['varset']=function(_0x23dea3){try{if(!_[_0xf8dc('0x24')](channels[_0x23dea3[_0xf8dc('0x6')]])){utils[_0xf8dc('0x2c')](util['format'](_0xf8dc('0x48'),_0x23dea3[_0xf8dc('0x6')]),_0x23dea3);if(!_['isNil'](_0x23dea3[_0xf8dc('0x49')][_0xf8dc('0x4a')])){utils[_0xf8dc('0x1b')](util[_0xf8dc('0x8')](_0xf8dc('0x4b'),_0x23dea3[_0xf8dc('0x6')],_0x23dea3[_0xf8dc('0x4c')]));channels[_0x23dea3[_0xf8dc('0x6')]][_0xf8dc('0x4d')]=_0x23dea3[_0xf8dc('0x4c')];}if(!_[_0xf8dc('0x24')](_0x23dea3[_0xf8dc('0x49')]['xmd-phone'])){utils[_0xf8dc('0x1b')](util[_0xf8dc('0x8')](_0xf8dc('0x4e'),_0x23dea3['uniqueid'],_0x23dea3['value']));channels[_0x23dea3[_0xf8dc('0x6')]][_0xf8dc('0x4f')]=_0x23dea3[_0xf8dc('0x4c')];channels[_0x23dea3[_0xf8dc('0x6')]][_0xf8dc('0x2e')]='\x22'+_0x23dea3[_0xf8dc('0x4c')]+'\x22\x20<'+_0x23dea3[_0xf8dc('0x4c')]+'>';}if(!_['isNil'](_0x23dea3[_0xf8dc('0x49')][_0xf8dc('0x50')])||!_[_0xf8dc('0x24')](_0x23dea3['variable'][_0xf8dc('0x51')])){utils['info'](util[_0xf8dc('0x8')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x23dea3[_0xf8dc('0x6')],!_[_0xf8dc('0x24')](_0x23dea3[_0xf8dc('0x49')]['xmd-callerid-preview'])?_0xf8dc('0x50'):_0xf8dc('0x51'),_0x23dea3[_0xf8dc('0x4c')]));channels[_0x23dea3[_0xf8dc('0x6')]][_0xf8dc('0x2e')]=_0x23dea3[_0xf8dc('0x4c')];}if(!_[_0xf8dc('0x24')](_0x23dea3['variable']['xmd-queue'])||!_[_0xf8dc('0x24')](_0x23dea3['variable']['xmcs-queue'])){utils[_0xf8dc('0x1b')](util['format'](_0xf8dc('0x52'),_0x23dea3[_0xf8dc('0x6')],!_[_0xf8dc('0x24')](_0x23dea3[_0xf8dc('0x49')][_0xf8dc('0x53')])?_0xf8dc('0x53'):_0xf8dc('0x54'),_0x23dea3['value']));channels[_0x23dea3[_0xf8dc('0x6')]][_0xf8dc('0x55')]=_0xf8dc('0x56');channels[_0x23dea3[_0xf8dc('0x6')]]['lastdata']=_0x23dea3[_0xf8dc('0x4c')];channels[_0x23dea3[_0xf8dc('0x6')]][_0xf8dc('0xb')]=!![];}if(!_[_0xf8dc('0x24')](_0x23dea3['variable']['xmd-contactid'])){utils['info'](util[_0xf8dc('0x8')](_0xf8dc('0x57'),_0x23dea3[_0xf8dc('0x6')],_0x23dea3[_0xf8dc('0x4c')]));channels[_0x23dea3[_0xf8dc('0x6')]][_0xf8dc('0x58')]=_0x23dea3[_0xf8dc('0x4c')];}if(!_['isNil'](_0x23dea3[_0xf8dc('0x49')][_0xf8dc('0x59')])){utils[_0xf8dc('0x1b')](util[_0xf8dc('0x8')](_0xf8dc('0x5a'),_0x23dea3[_0xf8dc('0x6')],_0x23dea3[_0xf8dc('0x4c')]));channels[_0x23dea3[_0xf8dc('0x6')]][_0xf8dc('0x5b')]=_0x23dea3['value'];}if(!_[_0xf8dc('0x24')](_0x23dea3['variable'][_0xf8dc('0x5c')])){utils[_0xf8dc('0x1b')](util[_0xf8dc('0x8')](_0xf8dc('0x5d'),_0x23dea3[_0xf8dc('0x6')],_0x23dea3[_0xf8dc('0x4c')]));channels[_0x23dea3[_0xf8dc('0x6')]][_0xf8dc('0x5e')]=_0x23dea3[_0xf8dc('0x4c')];}if(!_['isNil'](_0x23dea3['variable'][_0xf8dc('0x5f')])){utils[_0xf8dc('0x1b')](util[_0xf8dc('0x8')](_0xf8dc('0x60'),_0x23dea3[_0xf8dc('0x6')],_0x23dea3[_0xf8dc('0x4c')]));channels[_0x23dea3[_0xf8dc('0x6')]][_0xf8dc('0x5f')]=_0x23dea3['value'];}}}catch(_0x434de7){utils[_0xf8dc('0x21')](util[_0xf8dc('0x8')](_0xf8dc('0x48'),_0x23dea3[_0xf8dc('0x6')]),_0x434de7);}};exports[_0xf8dc('0x61')]=function(_0x96dab3){try{if(!_[_0xf8dc('0x24')](channels[_0x96dab3[_0xf8dc('0x6')]])){utils[_0xf8dc('0x2c')](util['format'](_0xf8dc('0x62'),_0x96dab3[_0xf8dc('0x6')]),_0x96dab3);utils[_0xf8dc('0x1b')](util['format'](_0xf8dc('0x63'),_0x96dab3[_0xf8dc('0x6')],_0x96dab3[_0xf8dc('0x64')],_0x96dab3[_0xf8dc('0x65')]));if(_0x96dab3['application'][_0xf8dc('0x66')]()==_0xf8dc('0x67')&&_[_0xf8dc('0x68')](_0x96dab3[_0xf8dc('0x65')][_0xf8dc('0x66')](),_0xf8dc('0x69'))){var _0x6f83f1=_0x96dab3[_0xf8dc('0x65')][_0xf8dc('0x6a')]('=');var _0x59f177=_0x6f83f1[0x0][_0xf8dc('0x6b')](_0x6f83f1[0x0]['lastIndexOf']('(')+0x1,_0x6f83f1[0x0]['lastIndexOf'](')'));var _0x5353fd=_0x6f83f1[0x1];channels[_0x96dab3[_0xf8dc('0x6')]][_0x59f177]=_0x5353fd;}if(!_[_0xf8dc('0x6c')]([_0xf8dc('0x6d'),_0xf8dc('0x6e'),'execif',_0xf8dc('0x67'),_0xf8dc('0x6f')],_0x96dab3[_0xf8dc('0x64')][_0xf8dc('0x66')]())){channels[_0x96dab3[_0xf8dc('0x6')]]['lastapplication']=_0x96dab3[_0xf8dc('0x64')];channels[_0x96dab3[_0xf8dc('0x6')]][_0xf8dc('0x70')]=_0x96dab3[_0xf8dc('0x65')];}}}catch(_0x1b317e){utils[_0xf8dc('0x21')](util[_0xf8dc('0x8')](_0xf8dc('0x62'),_0x96dab3['uniqueid']),_0x1b317e);}}; \ No newline at end of file +var _0xd78c=['disposition','toNumber','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','diffTime','starttime','billableseconds','answertime','[%s][calls][hangup]','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','_attended','transfertargetchannel','origtransfererchannel','userfield','musiconholdstart','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstart]','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','source','value','xmd-phone','destination','\x22\x20<','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','type','outboundrouteid','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','toLowerCase','cdr','split','substring','lastIndexOf','includes','hangup','noop','execif','[%s][calls][newexten]','lodash','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','queue','membername','interface','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','newchannel','debug','linkedid','channel','OutgoingSpoolFailed','context','calleridnum','exten','now','DOCUMENTATION','error','[%s][calls][newchannel]','newstate','[%s][calls][newstate]','isNil','channelstate','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel'];(function(_0x548062,_0x172078){var _0x39fefc=function(_0x1e8733){while(--_0x1e8733){_0x548062['push'](_0x548062['shift']());}};_0x39fefc(++_0x172078);}(_0xd78c,0x198));var _0xcd78=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xd78c[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xcd78('0x0'));var util=require('util');var utils=require(_0xcd78('0x1'));var transfers=require(_0xcd78('0x2'));var dispositions=[_0xcd78('0x3'),_0xcd78('0x4'),_0xcd78('0x4'),_0xcd78('0x3'),_0xcd78('0x3'),_0xcd78('0x3'),_0xcd78('0x5'),_0xcd78('0x6'),_0xcd78('0x4'),_0xcd78('0x4'),_0xcd78('0x4')];var channels={};function writeDB(_0x41be5a){var _0x14b403;if(transfers[_0xcd78('0x7')][_0x41be5a[_0xcd78('0x8')]]){_0x14b403=_0x41be5a['uniqueid'];_0x41be5a[_0xcd78('0x8')]=transfers[_0xcd78('0x7')][_0x41be5a[_0xcd78('0x8')]][_0xcd78('0x9')];}utils[_0xcd78('0xa')](util[_0xcd78('0xb')](_0xcd78('0xc'),_0x41be5a[_0xcd78('0x8')],_0x41be5a['channel'],_0x41be5a[_0xcd78('0xd')],_0x41be5a[_0xcd78('0xe')],_0x41be5a[_0xcd78('0xf')],_0x41be5a['calleridnum'],_0x41be5a[_0xcd78('0x10')],_0x41be5a[_0xcd78('0x11')]));if(_0x41be5a[_0xcd78('0x12')]){utils[_0xcd78('0x13')](_0x41be5a['accountcode'])[_0xcd78('0x14')](function(_0x206227){if(_0x206227){_0x41be5a[_0xcd78('0x15')]=_0x206227['id'];}utils[_0xcd78('0x16')](_0xcd78('0x17'),_0x41be5a);});}else{utils[_0xcd78('0x16')](_0xcd78('0x17'),_0x41be5a);}if(channels[_0x41be5a[_0xcd78('0x8')]]){delete channels[_0x41be5a[_0xcd78('0x8')]];}else if(_0x14b403&&channels[_0x14b403]){delete transfers[_0xcd78('0x7')][_0x14b403];delete channels[_0x14b403];}}exports[_0xcd78('0x18')]=function(_0x21a01d){try{utils[_0xcd78('0x19')](util[_0xcd78('0xb')]('[%s][calls][newchannel]',_0x21a01d[_0xcd78('0x8')]),_0x21a01d);if(_0x21a01d[_0xcd78('0x8')]==_0x21a01d[_0xcd78('0x1a')]&&_0x21a01d[_0xcd78('0x1b')]!=_0xcd78('0x1c')){utils[_0xcd78('0xa')](util[_0xcd78('0xb')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x21a01d[_0xcd78('0x8')],_0x21a01d[_0xcd78('0x1d')],_0x21a01d['exten']));channels[_0x21a01d[_0xcd78('0x8')]]={'uniqueid':_0x21a01d[_0xcd78('0x8')],'accountcode':_0x21a01d[_0xcd78('0x12')],'source':_0x21a01d[_0xcd78('0x1e')],'destination':_0x21a01d[_0xcd78('0x1f')],'destinationcontext':_0x21a01d[_0xcd78('0x1d')],'channel':_0x21a01d[_0xcd78('0x1b')],'starttime':utils[_0xcd78('0x20')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xcd78('0x3'),'amaflags':_0xcd78('0x21')};}}catch(_0x15b8cb){utils[_0xcd78('0x22')](util[_0xcd78('0xb')](_0xcd78('0x23'),_0x21a01d[_0xcd78('0x8')]),_0x15b8cb);}};exports[_0xcd78('0x24')]=function(_0x3504bf){try{utils[_0xcd78('0x19')](util['format'](_0xcd78('0x25'),_0x3504bf[_0xcd78('0x8')]),_0x3504bf);if(!_[_0xcd78('0x26')](channels[_0x3504bf[_0xcd78('0x8')]])&&_0x3504bf[_0xcd78('0x27')]==0x6){utils[_0xcd78('0xa')](util['format']('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x3504bf[_0xcd78('0x8')],_0x3504bf['context'],_0x3504bf[_0xcd78('0x1b')]));if(_['isNil'](channels[_0x3504bf[_0xcd78('0x8')]][_0xcd78('0x28')])){channels[_0x3504bf['uniqueid']]['systemanswertime']=utils[_0xcd78('0x20')]();}}else if(!_['isNil'](channels[_0x3504bf[_0xcd78('0x1a')]])&&_0x3504bf[_0xcd78('0x27')]==0x6&&_0x3504bf['context']!=_0xcd78('0x29')){utils[_0xcd78('0xa')](util[_0xcd78('0xb')](_0xcd78('0x2a'),_0x3504bf[_0xcd78('0x8')],_0x3504bf[_0xcd78('0x1a')],_0x3504bf[_0xcd78('0x1d')],_0x3504bf[_0xcd78('0x1b')]));channels[_0x3504bf['linkedid']][_0xcd78('0x12')]=_0x3504bf[_0xcd78('0x12')];channels[_0x3504bf[_0xcd78('0x1a')]][_0xcd78('0x2b')]=_0x3504bf[_0xcd78('0x1b')];if(_[_0xcd78('0x26')](channels[_0x3504bf[_0xcd78('0x1a')]]['answertime'])){channels[_0x3504bf[_0xcd78('0x1a')]]['answertime']=utils[_0xcd78('0x20')]();}channels[_0x3504bf['linkedid']][_0xcd78('0x2c')]=dispositions[_[_0xcd78('0x2d')](_0x3504bf[_0xcd78('0x27')])]||_0xcd78('0x5');}}catch(_0x151632){utils[_0xcd78('0x22')](util['format'](_0xcd78('0x25'),_0x3504bf[_0xcd78('0x8')]),_0x151632);}};exports['hangup']=function(_0x4ac9f0){try{if(!_[_0xcd78('0x26')](channels[_0x4ac9f0[_0xcd78('0x8')]])){utils[_0xcd78('0x19')](util['format']('[%s][calls][hangup]',_0x4ac9f0[_0xcd78('0x8')]),_0x4ac9f0);if(_[_0xcd78('0x26')](channels[_0x4ac9f0[_0xcd78('0x8')]][_0xcd78('0x2e')])){channels[_0x4ac9f0[_0xcd78('0x8')]][_0xcd78('0x2e')]=_0x4ac9f0[_0xcd78('0x2f')]+'\x20<'+_0x4ac9f0[_0xcd78('0x1e')]+'>';}utils[_0xcd78('0xa')](util[_0xcd78('0xb')](_0xcd78('0x30'),_0x4ac9f0[_0xcd78('0x8')],channels[_0x4ac9f0[_0xcd78('0x8')]][_0xcd78('0x2e')],_0x4ac9f0[_0xcd78('0x31')]));channels[_0x4ac9f0['uniqueid']][_0xcd78('0x32')]=utils[_0xcd78('0x20')]();channels[_0x4ac9f0[_0xcd78('0x8')]]['duration']=utils[_0xcd78('0x33')](channels[_0x4ac9f0['uniqueid']][_0xcd78('0x32')],channels[_0x4ac9f0[_0xcd78('0x8')]][_0xcd78('0x34')]);channels[_0x4ac9f0[_0xcd78('0x8')]][_0xcd78('0x35')]=channels[_0x4ac9f0['uniqueid']]['answertime']?utils[_0xcd78('0x33')](channels[_0x4ac9f0['uniqueid']]['endtime'],channels[_0x4ac9f0['uniqueid']][_0xcd78('0x36')]):0x0;writeDB(channels[_0x4ac9f0['uniqueid']]);}}catch(_0x38688d){utils[_0xcd78('0x22')](util[_0xcd78('0xb')](_0xcd78('0x37'),_0x4ac9f0[_0xcd78('0x8')]),_0x38688d);}};exports['attendedtransfer']=function(_0x5b8ae7){try{if(!_[_0xcd78('0x26')](channels[_0x5b8ae7[_0xcd78('0x38')]])){utils['debug'](util[_0xcd78('0xb')](_0xcd78('0x39'),_0x5b8ae7[_0xcd78('0x3a')]),_0x5b8ae7);if(channels[_0x5b8ae7['localtwolinkedid']][_0xcd78('0x1b')]==_0x5b8ae7['transfereechannel']){utils[_0xcd78('0xa')](util[_0xcd78('0xb')](_0xcd78('0x3b'),_0x5b8ae7[_0xcd78('0x3a')],_0x5b8ae7[_0xcd78('0x38')],_0x5b8ae7[_0xcd78('0x3c')]));channels[_0x5b8ae7[_0xcd78('0x38')]]['destinationchannel']=_0x5b8ae7['secondtransfererchannel'];channels[_0x5b8ae7[_0xcd78('0x38')]]['userfield']=_0xcd78('0x3d');}else if(channels[_0x5b8ae7[_0xcd78('0x38')]][_0xcd78('0x1b')]=_0x5b8ae7[_0xcd78('0x3e')]){utils[_0xcd78('0xa')](util[_0xcd78('0xb')](_0xcd78('0x3b'),_0x5b8ae7[_0xcd78('0x3a')],_0x5b8ae7[_0xcd78('0x38')],_0x5b8ae7[_0xcd78('0x3f')]));channels[_0x5b8ae7['localtwolinkedid']][_0xcd78('0x2b')]=_0x5b8ae7[_0xcd78('0x3f')];channels[_0x5b8ae7[_0xcd78('0x38')]][_0xcd78('0x40')]=_0xcd78('0x3d');}}}catch(_0x86c492){utils[_0xcd78('0x22')](util[_0xcd78('0xb')]('[%s][calls][attendedtransfer]',_0x5b8ae7[_0xcd78('0x3a')]),_0x86c492);}};exports[_0xcd78('0x41')]=function(_0x186c1f){try{if(!_[_0xcd78('0x26')](channels[_0x186c1f['uniqueid']])){utils[_0xcd78('0x19')](util[_0xcd78('0xb')]('[%s][calls][musiconholdstart]',_0x186c1f[_0xcd78('0x8')]),_0x186c1f);channels[_0x186c1f[_0xcd78('0x8')]][_0xcd78('0x42')]=utils[_0xcd78('0x20')]();utils[_0xcd78('0xa')](util[_0xcd78('0xb')](_0xcd78('0x43'),_0x186c1f['uniqueid'],channels[_0x186c1f['uniqueid']]['musiconholdstartAt']));}}catch(_0x4ab8ec){utils[_0xcd78('0x22')](util[_0xcd78('0xb')](_0xcd78('0x44'),_0x186c1f[_0xcd78('0x8')]),_0x4ab8ec);}};exports[_0xcd78('0x45')]=function(_0x215a9b){try{if(!_[_0xcd78('0x26')](channels[_0x215a9b[_0xcd78('0x8')]])){utils[_0xcd78('0x19')](util[_0xcd78('0xb')](_0xcd78('0x46'),_0x215a9b[_0xcd78('0x8')]),_0x215a9b);if(!_[_0xcd78('0x26')](channels[_0x215a9b['uniqueid']][_0xcd78('0x42')])){channels[_0x215a9b['uniqueid']][_0xcd78('0x47')]+=utils[_0xcd78('0x33')](utils[_0xcd78('0x20')](),channels[_0x215a9b[_0xcd78('0x8')]][_0xcd78('0x42')]);utils[_0xcd78('0xa')](util[_0xcd78('0xb')](_0xcd78('0x48'),_0x215a9b['uniqueid'],channels[_0x215a9b[_0xcd78('0x8')]][_0xcd78('0x47')]));delete channels[_0x215a9b['uniqueid']][_0xcd78('0x42')];}}}catch(_0x39e392){utils[_0xcd78('0x22')](util[_0xcd78('0xb')](_0xcd78('0x46'),_0x215a9b[_0xcd78('0x8')]),_0x39e392);}};exports['varset']=function(_0x2a8af0){try{if(!_['isNil'](channels[_0x2a8af0['uniqueid']])){utils['debug'](util[_0xcd78('0xb')](_0xcd78('0x49'),_0x2a8af0[_0xcd78('0x8')]),_0x2a8af0);if(!_[_0xcd78('0x26')](_0x2a8af0[_0xcd78('0x4a')][_0xcd78('0x4b')])){utils['info'](util['format'](_0xcd78('0x4c'),_0x2a8af0[_0xcd78('0x8')],_0x2a8af0['value']));channels[_0x2a8af0[_0xcd78('0x8')]][_0xcd78('0x4d')]=_0x2a8af0[_0xcd78('0x4e')];}if(!_['isNil'](_0x2a8af0[_0xcd78('0x4a')][_0xcd78('0x4f')])){utils[_0xcd78('0xa')](util[_0xcd78('0xb')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x2a8af0[_0xcd78('0x8')],_0x2a8af0[_0xcd78('0x4e')]));channels[_0x2a8af0[_0xcd78('0x8')]][_0xcd78('0x50')]=_0x2a8af0[_0xcd78('0x4e')];channels[_0x2a8af0['uniqueid']][_0xcd78('0x2e')]='\x22'+_0x2a8af0['value']+_0xcd78('0x51')+_0x2a8af0['value']+'>';}if(!_[_0xcd78('0x26')](_0x2a8af0[_0xcd78('0x4a')]['xmd-callerid-preview'])||!_['isNil'](_0x2a8af0[_0xcd78('0x4a')][_0xcd78('0x52')])){utils[_0xcd78('0xa')](util[_0xcd78('0xb')](_0xcd78('0x53'),_0x2a8af0[_0xcd78('0x8')],!_[_0xcd78('0x26')](_0x2a8af0[_0xcd78('0x4a')][_0xcd78('0x54')])?'xmd-callerid-preview':_0xcd78('0x52'),_0x2a8af0['value']));channels[_0x2a8af0[_0xcd78('0x8')]][_0xcd78('0x2e')]=_0x2a8af0['value'];}if(!_[_0xcd78('0x26')](_0x2a8af0[_0xcd78('0x4a')][_0xcd78('0x55')])||!_[_0xcd78('0x26')](_0x2a8af0[_0xcd78('0x4a')][_0xcd78('0x56')])){utils[_0xcd78('0xa')](util[_0xcd78('0xb')](_0xcd78('0x53'),_0x2a8af0[_0xcd78('0x8')],!_[_0xcd78('0x26')](_0x2a8af0[_0xcd78('0x4a')][_0xcd78('0x55')])?'xmd-queue':_0xcd78('0x56'),_0x2a8af0[_0xcd78('0x4e')]));channels[_0x2a8af0[_0xcd78('0x8')]][_0xcd78('0x57')]=_0xcd78('0x58');channels[_0x2a8af0[_0xcd78('0x8')]][_0xcd78('0x59')]=_0x2a8af0[_0xcd78('0x4e')];channels[_0x2a8af0[_0xcd78('0x8')]][_0xcd78('0xd')]=!![];}if(!_[_0xcd78('0x26')](_0x2a8af0[_0xcd78('0x4a')][_0xcd78('0x5a')])){utils[_0xcd78('0xa')](util[_0xcd78('0xb')](_0xcd78('0x5b'),_0x2a8af0['uniqueid'],_0x2a8af0[_0xcd78('0x4e')]));channels[_0x2a8af0[_0xcd78('0x8')]]['ContactId']=_0x2a8af0[_0xcd78('0x4e')];}if(!_[_0xcd78('0x26')](_0x2a8af0['variable'][_0xcd78('0x5c')])){utils['info'](util[_0xcd78('0xb')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x2a8af0[_0xcd78('0x8')],_0x2a8af0[_0xcd78('0x4e')]));channels[_0x2a8af0[_0xcd78('0x8')]][_0xcd78('0x5d')]=_0x2a8af0[_0xcd78('0x4e')];}if(!_[_0xcd78('0x26')](_0x2a8af0['variable'][_0xcd78('0x5e')])){utils['info'](util[_0xcd78('0xb')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x2a8af0[_0xcd78('0x8')],_0x2a8af0['value']));channels[_0x2a8af0[_0xcd78('0x8')]][_0xcd78('0x5f')]=_0x2a8af0['value'];}if(!_[_0xcd78('0x26')](_0x2a8af0[_0xcd78('0x4a')][_0xcd78('0x60')])){utils[_0xcd78('0xa')](util[_0xcd78('0xb')](_0xcd78('0x61'),_0x2a8af0['uniqueid'],_0x2a8af0[_0xcd78('0x4e')]));channels[_0x2a8af0[_0xcd78('0x8')]][_0xcd78('0x60')]=_0x2a8af0['value'];}}}catch(_0x5f1909){utils[_0xcd78('0x22')](util[_0xcd78('0xb')](_0xcd78('0x49'),_0x2a8af0['uniqueid']),_0x5f1909);}};exports[_0xcd78('0x62')]=function(_0x3ba23b){try{if(!_[_0xcd78('0x26')](channels[_0x3ba23b[_0xcd78('0x8')]])){utils[_0xcd78('0x19')](util[_0xcd78('0xb')]('[%s][calls][newexten]',_0x3ba23b[_0xcd78('0x8')]),_0x3ba23b);utils['info'](util[_0xcd78('0xb')](_0xcd78('0x63'),_0x3ba23b[_0xcd78('0x8')],_0x3ba23b[_0xcd78('0x64')],_0x3ba23b[_0xcd78('0x65')]));if(_0x3ba23b[_0xcd78('0x64')]['toLowerCase']()==_0xcd78('0x66')&&_['startsWith'](_0x3ba23b['appdata'][_0xcd78('0x67')](),_0xcd78('0x68'))){var _0x57ce9f=_0x3ba23b['appdata'][_0xcd78('0x69')]('=');var _0x42b2f7=_0x57ce9f[0x0][_0xcd78('0x6a')](_0x57ce9f[0x0][_0xcd78('0x6b')]('(')+0x1,_0x57ce9f[0x0][_0xcd78('0x6b')](')'));var _0x5b5a0f=_0x57ce9f[0x1];channels[_0x3ba23b['uniqueid']][_0x42b2f7]=_0x5b5a0f;}if(!_[_0xcd78('0x6c')]([_0xcd78('0x6d'),_0xcd78('0x6e'),_0xcd78('0x6f'),_0xcd78('0x66'),'gotoif'],_0x3ba23b[_0xcd78('0x64')][_0xcd78('0x67')]())){channels[_0x3ba23b[_0xcd78('0x8')]]['lastapplication']=_0x3ba23b['application'];channels[_0x3ba23b[_0xcd78('0x8')]][_0xcd78('0x59')]=_0x3ba23b['appdata'];}}}catch(_0x1a3120){utils[_0xcd78('0x22')](util[_0xcd78('0xb')](_0xcd78('0x70'),_0x3ba23b[_0xcd78('0x8')]),_0x1a3120);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index cae89dc..fea4e66 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 _0xd03c=['shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','./utils','info'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0xd03c,0x106));var _0xcd03=function(_0x1c7527,_0x581360){_0x1c7527=_0x1c7527-0x0;var _0x43d047=_0xd03c[_0x1c7527];return _0x43d047;};'use strict';var utils=require(_0xcd03('0x0'));exports['connect']=function(){utils[_0xcd03('0x1')]('[core]\x20connected');};exports[_0xcd03('0x2')]=function(){utils[_0xcd03('0x1')](_0xcd03('0x3'));};exports[_0xcd03('0x4')]=function(){utils[_0xcd03('0x1')](_0xcd03('0x5'));};exports[_0xcd03('0x6')]=function(_0x59733a){utils[_0xcd03('0x6')](_0xcd03('0x7'),_0x59733a);};exports[_0xcd03('0x8')]=function(){utils[_0xcd03('0x1')](_0xcd03('0x9'));};exports[_0xcd03('0xa')]=function(_0x3a87ef){}; \ No newline at end of file +var _0x95d9=['./utils','connect','info','[core]\x20connected','shutdown','[core]\x20shutdown','error','close'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x95d9,0x138));var _0x995d=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0x95d9[_0x4a3898];return _0x25ceb0;};'use strict';var utils=require(_0x995d('0x0'));exports[_0x995d('0x1')]=function(){utils[_0x995d('0x2')](_0x995d('0x3'));};exports[_0x995d('0x4')]=function(){utils[_0x995d('0x2')](_0x995d('0x5'));};exports['fullybooted']=function(){utils[_0x995d('0x2')]('[core]\x20fullybooted');};exports[_0x995d('0x6')]=function(_0x6be715){utils[_0x995d('0x6')]('[core]\x20error',_0x6be715);};exports[_0x995d('0x7')]=function(){utils[_0x995d('0x2')]('[core]\x20close');};exports['managerevent']=function(_0x373e78){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index dd18933..e33fd18 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 _0x7d49=['channel','calleridnum','connectedlinenum','request','newexten','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr(routeid)','split','error','[%s][dials][newexten]','varset','debug','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][dialbegin]','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','dialstatus','assign','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','complete','duration','diffTime','holdtime','endtime','billableseconds','lodash','util','./utils','info','format','uniqueid'];(function(_0x24f326,_0x616a7){var _0x488e2d=function(_0x293d9a){while(--_0x293d9a){_0x24f326['push'](_0x24f326['shift']());}};_0x488e2d(++_0x616a7);}(_0x7d49,0x1c5));var _0x97d4=function(_0x42a23e,_0x1e62a9){_0x42a23e=_0x42a23e-0x0;var _0x33d3f3=_0x7d49[_0x42a23e];return _0x33d3f3;};'use strict';var _=require(_0x97d4('0x0'));var util=require(_0x97d4('0x1'));var utils=require(_0x97d4('0x2'));var dials={};function writeDB(_0x379401){utils[_0x97d4('0x3')](util[_0x97d4('0x4')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x379401[_0x97d4('0x5')],_0x379401[_0x97d4('0x6')],_0x379401['dialstring'],_0x379401[_0x97d4('0x7')],_0x379401[_0x97d4('0x8')],_0x379401['dialstatus']));utils[_0x97d4('0x9')]('CreateVoiceDialReport',_0x379401);delete dials[_0x379401[_0x97d4('0x5')]];}exports[_0x97d4('0xa')]=function(_0x15f11c){try{utils['debug'](util[_0x97d4('0x4')]('[%s][dials][newexten]',_0x15f11c[_0x97d4('0x5')]),_0x15f11c);utils[_0x97d4('0x3')](util[_0x97d4('0x4')](_0x97d4('0xb'),_0x15f11c[_0x97d4('0x5')],_0x15f11c[_0x97d4('0xc')],_0x15f11c[_0x97d4('0xd')]));if(_0x15f11c[_0x97d4('0xc')][_0x97d4('0xe')]()==_0x97d4('0xf')&&_[_0x97d4('0x10')](_0x15f11c['appdata'][_0x97d4('0xe')](),_0x97d4('0x11'))){var _0x2ab09d=_0x15f11c['appdata'][_0x97d4('0x12')]('=');dials[_0x15f11c[_0x97d4('0x5')]]={'routeId':_0x2ab09d[0x1]};}}catch(_0x559c67){utils[_0x97d4('0x13')](util[_0x97d4('0x4')](_0x97d4('0x14'),_0x15f11c[_0x97d4('0x5')]),_0x559c67);}};exports[_0x97d4('0x15')]=function(_0x35c344){try{utils[_0x97d4('0x16')](util[_0x97d4('0x4')](_0x97d4('0x17'),_0x35c344[_0x97d4('0x5')]),_0x35c344);if(!_[_0x97d4('0x18')](_0x35c344[_0x97d4('0x19')][_0x97d4('0x1a')])){utils[_0x97d4('0x3')](util['format'](_0x97d4('0x1b'),_0x35c344[_0x97d4('0x5')],_0x35c344[_0x97d4('0x1c')]));dials[_0x35c344[_0x97d4('0x5')]]={'routeId':_0x35c344[_0x97d4('0x1c')]};}}catch(_0x486f5c){utils['error'](util['format'](_0x97d4('0x17'),_0x35c344[_0x97d4('0x5')]),_0x486f5c);}};exports['dialbegin']=function(_0x147d82){try{if(!_[_0x97d4('0x18')](dials[_0x147d82['uniqueid']])){utils[_0x97d4('0x16')](util[_0x97d4('0x4')](_0x97d4('0x1d'),_0x147d82[_0x97d4('0x5')]),_0x147d82);dials[_0x147d82[_0x97d4('0x5')]]=_['assign'](dials[_0x147d82['uniqueid']],_0x147d82);dials[_0x147d82[_0x97d4('0x5')]][_0x97d4('0x1e')]=utils[_0x97d4('0x1f')]();dials[_0x147d82[_0x97d4('0x5')]][_0x97d4('0x20')]=_0x97d4('0x21');utils[_0x97d4('0x3')](util[_0x97d4('0x4')](_0x97d4('0x22'),_0x147d82['uniqueid'],dials[_0x147d82['uniqueid']][_0x97d4('0x1e')]));}}catch(_0x11ac8d){utils['error'](util[_0x97d4('0x4')](_0x97d4('0x1d'),_0x147d82[_0x97d4('0x5')]),_0x11ac8d);}};exports[_0x97d4('0x23')]=function(_0xcc014d){try{if(!_[_0x97d4('0x18')](dials[_0xcc014d[_0x97d4('0x5')]])){utils[_0x97d4('0x16')](util[_0x97d4('0x4')](_0x97d4('0x24'),_0xcc014d[_0x97d4('0x5')]),_0xcc014d);dials[_0xcc014d['uniqueid']]['dialstatus']=_0xcc014d[_0x97d4('0x25')];if(_0xcc014d[_0x97d4('0x25')]=='ANSWER'){dials[_0xcc014d['uniqueid']]=_[_0x97d4('0x26')](dials[_0xcc014d[_0x97d4('0x5')]],_0xcc014d);dials[_0xcc014d[_0x97d4('0x5')]][_0x97d4('0x27')]=utils['now']();dials[_0xcc014d[_0x97d4('0x5')]][_0x97d4('0x20')]=_0x97d4('0x28');utils[_0x97d4('0x3')](util[_0x97d4('0x4')](_0x97d4('0x29'),_0xcc014d[_0x97d4('0x5')],_0xcc014d[_0x97d4('0x25')],dials[_0xcc014d['uniqueid']][_0x97d4('0x27')]));}else{utils[_0x97d4('0x3')](util[_0x97d4('0x4')](_0x97d4('0x2a'),_0xcc014d['uniqueid'],_0xcc014d[_0x97d4('0x25')]));}}}catch(_0x4340ac){utils[_0x97d4('0x13')](util['format'](_0x97d4('0x24'),_0xcc014d[_0x97d4('0x5')]),_0x4340ac);}};exports['hangup']=function(_0x502225){try{if(!_['isNil'](dials[_0x502225[_0x97d4('0x5')]])){utils['debug'](util['format'](_0x97d4('0x2b'),_0x502225['uniqueid']),_0x502225);utils[_0x97d4('0x3')](util[_0x97d4('0x4')](_0x97d4('0x2c'),_0x502225[_0x97d4('0x5')],_0x502225['calleridnum'],_0x502225['calleridname'],_0x502225['cause-txt']));dials[_0x502225[_0x97d4('0x5')]]=_[_0x97d4('0x26')](dials[_0x502225[_0x97d4('0x5')]],{'endtime':utils[_0x97d4('0x1f')](),'lastevent':_0x97d4('0x2d')});dials[_0x502225[_0x97d4('0x5')]][_0x97d4('0x2e')]=utils[_0x97d4('0x2f')](dials[_0x502225[_0x97d4('0x5')]]['endtime'],dials[_0x502225[_0x97d4('0x5')]]['starttime']);dials[_0x502225[_0x97d4('0x5')]][_0x97d4('0x30')]=utils[_0x97d4('0x2f')](dials[_0x502225[_0x97d4('0x5')]][_0x97d4('0x27')]||dials[_0x502225[_0x97d4('0x5')]][_0x97d4('0x31')],dials[_0x502225['uniqueid']][_0x97d4('0x1e')]);dials[_0x502225[_0x97d4('0x5')]][_0x97d4('0x32')]=dials[_0x502225['uniqueid']][_0x97d4('0x27')]?utils['diffTime'](dials[_0x502225[_0x97d4('0x5')]]['endtime'],dials[_0x502225['uniqueid']][_0x97d4('0x27')]):0x0;writeDB(dials[_0x502225[_0x97d4('0x5')]]);}}catch(_0xc78e74){utils[_0x97d4('0x13')](util[_0x97d4('0x4')](_0x97d4('0x2b'),_0x502225['uniqueid']),_0xc78e74);}}; \ No newline at end of file +var _0x15d4=['format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','cdr(routeid)','split','error','[%s][dials][newexten]','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','value','[%s][dials][dialbegin]','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','dialstatus','assign','answertime','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','diffTime','endtime','lodash','./utils','info'];(function(_0x3c22e0,_0x1dc6ea){var _0x215811=function(_0x1b453c){while(--_0x1b453c){_0x3c22e0['push'](_0x3c22e0['shift']());}};_0x215811(++_0x1dc6ea);}(_0x15d4,0xc1));var _0x415d=function(_0x8f6d2c,_0x4aa009){_0x8f6d2c=_0x8f6d2c-0x0;var _0x1634e6=_0x15d4[_0x8f6d2c];return _0x1634e6;};'use strict';var _=require(_0x415d('0x0'));var util=require('util');var utils=require(_0x415d('0x1'));var dials={};function writeDB(_0x4d04f1){utils[_0x415d('0x2')](util[_0x415d('0x3')](_0x415d('0x4'),_0x4d04f1[_0x415d('0x5')],_0x4d04f1[_0x415d('0x6')],_0x4d04f1[_0x415d('0x7')],_0x4d04f1[_0x415d('0x8')],_0x4d04f1['connectedlinenum'],_0x4d04f1['dialstatus']));utils[_0x415d('0x9')](_0x415d('0xa'),_0x4d04f1);delete dials[_0x4d04f1['uniqueid']];}exports[_0x415d('0xb')]=function(_0x1b518c){try{utils[_0x415d('0xc')](util['format']('[%s][dials][newexten]',_0x1b518c[_0x415d('0x5')]),_0x1b518c);utils[_0x415d('0x2')](util[_0x415d('0x3')](_0x415d('0xd'),_0x1b518c[_0x415d('0x5')],_0x1b518c[_0x415d('0xe')],_0x1b518c['appdata']));if(_0x1b518c[_0x415d('0xe')][_0x415d('0xf')]()==_0x415d('0x10')&&_[_0x415d('0x11')](_0x1b518c[_0x415d('0x12')][_0x415d('0xf')](),_0x415d('0x13'))){var _0x3972f3=_0x1b518c[_0x415d('0x12')][_0x415d('0x14')]('=');dials[_0x1b518c[_0x415d('0x5')]]={'routeId':_0x3972f3[0x1]};}}catch(_0xaf5ed3){utils[_0x415d('0x15')](util[_0x415d('0x3')](_0x415d('0x16'),_0x1b518c[_0x415d('0x5')]),_0xaf5ed3);}};exports[_0x415d('0x17')]=function(_0x422def){try{utils[_0x415d('0xc')](util[_0x415d('0x3')](_0x415d('0x18'),_0x422def['uniqueid']),_0x422def);if(!_[_0x415d('0x19')](_0x422def[_0x415d('0x1a')][_0x415d('0x1b')])){utils['info'](util[_0x415d('0x3')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x422def[_0x415d('0x5')],_0x422def[_0x415d('0x1c')]));dials[_0x422def['uniqueid']]={'routeId':_0x422def[_0x415d('0x1c')]};}}catch(_0x3d544e){utils[_0x415d('0x15')](util[_0x415d('0x3')](_0x415d('0x18'),_0x422def[_0x415d('0x5')]),_0x3d544e);}};exports['dialbegin']=function(_0x30abdd){try{if(!_[_0x415d('0x19')](dials[_0x30abdd[_0x415d('0x5')]])){utils[_0x415d('0xc')](util[_0x415d('0x3')](_0x415d('0x1d'),_0x30abdd[_0x415d('0x5')]),_0x30abdd);dials[_0x30abdd[_0x415d('0x5')]]=_['assign'](dials[_0x30abdd[_0x415d('0x5')]],_0x30abdd);dials[_0x30abdd[_0x415d('0x5')]][_0x415d('0x1e')]=utils[_0x415d('0x1f')]();dials[_0x30abdd[_0x415d('0x5')]][_0x415d('0x20')]=_0x415d('0x21');utils['info'](util[_0x415d('0x3')](_0x415d('0x22'),_0x30abdd[_0x415d('0x5')],dials[_0x30abdd[_0x415d('0x5')]][_0x415d('0x1e')]));}}catch(_0x344f98){utils[_0x415d('0x15')](util[_0x415d('0x3')]('[%s][dials][dialbegin]',_0x30abdd[_0x415d('0x5')]),_0x344f98);}};exports[_0x415d('0x23')]=function(_0x4b335e){try{if(!_[_0x415d('0x19')](dials[_0x4b335e[_0x415d('0x5')]])){utils[_0x415d('0xc')](util['format'](_0x415d('0x24'),_0x4b335e[_0x415d('0x5')]),_0x4b335e);dials[_0x4b335e[_0x415d('0x5')]][_0x415d('0x25')]=_0x4b335e[_0x415d('0x25')];if(_0x4b335e['dialstatus']=='ANSWER'){dials[_0x4b335e['uniqueid']]=_[_0x415d('0x26')](dials[_0x4b335e[_0x415d('0x5')]],_0x4b335e);dials[_0x4b335e['uniqueid']][_0x415d('0x27')]=utils[_0x415d('0x1f')]();dials[_0x4b335e['uniqueid']][_0x415d('0x20')]='connect';utils[_0x415d('0x2')](util[_0x415d('0x3')](_0x415d('0x28'),_0x4b335e['uniqueid'],_0x4b335e['dialstatus'],dials[_0x4b335e[_0x415d('0x5')]][_0x415d('0x27')]));}else{utils[_0x415d('0x2')](util[_0x415d('0x3')]('[%s][dials][dialend]\x20dialstatus:%s',_0x4b335e[_0x415d('0x5')],_0x4b335e['dialstatus']));}}}catch(_0x4a0779){utils[_0x415d('0x15')](util[_0x415d('0x3')](_0x415d('0x24'),_0x4b335e[_0x415d('0x5')]),_0x4a0779);}};exports[_0x415d('0x29')]=function(_0x449d54){try{if(!_['isNil'](dials[_0x449d54['uniqueid']])){utils[_0x415d('0xc')](util[_0x415d('0x3')](_0x415d('0x2a'),_0x449d54[_0x415d('0x5')]),_0x449d54);utils[_0x415d('0x2')](util[_0x415d('0x3')](_0x415d('0x2b'),_0x449d54[_0x415d('0x5')],_0x449d54[_0x415d('0x8')],_0x449d54[_0x415d('0x2c')],_0x449d54[_0x415d('0x2d')]));dials[_0x449d54[_0x415d('0x5')]]=_[_0x415d('0x26')](dials[_0x449d54[_0x415d('0x5')]],{'endtime':utils[_0x415d('0x1f')](),'lastevent':_0x415d('0x2e')});dials[_0x449d54['uniqueid']]['duration']=utils[_0x415d('0x2f')](dials[_0x449d54[_0x415d('0x5')]]['endtime'],dials[_0x449d54[_0x415d('0x5')]][_0x415d('0x1e')]);dials[_0x449d54[_0x415d('0x5')]]['holdtime']=utils[_0x415d('0x2f')](dials[_0x449d54[_0x415d('0x5')]][_0x415d('0x27')]||dials[_0x449d54[_0x415d('0x5')]][_0x415d('0x30')],dials[_0x449d54[_0x415d('0x5')]][_0x415d('0x1e')]);dials[_0x449d54[_0x415d('0x5')]]['billableseconds']=dials[_0x449d54[_0x415d('0x5')]]['answertime']?utils[_0x415d('0x2f')](dials[_0x449d54[_0x415d('0x5')]][_0x415d('0x30')],dials[_0x449d54[_0x415d('0x5')]][_0x415d('0x27')]):0x0;writeDB(dials[_0x449d54[_0x415d('0x5')]]);}}catch(_0x315a11){utils[_0x415d('0x15')](util[_0x415d('0x3')](_0x415d('0x2a'),_0x449d54[_0x415d('0x5')]),_0x315a11);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 4bdbc7e..f45d045 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 _0x6b9e=['asterisk-manager','../../config/environment','util','asterisk','username','password','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./recordings.controller','./dials.controller','./transfers.controller','connect','shutdown','fullybooted','error','close','managerevent','debug','format','[%s][index][devicestatechange]','device','agentcalled','uniqueid','[%s][index][agentcalled]','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','[%s][index][queuecallerjoin]','queuecallerjoin','[%s][index][queuecallerleave]','queuecallerleave','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','origtransfereruniqueid','varset','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','dialend','[%s][index][dialend]'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0x6b9e,0x1c0));var _0xe6b9=function(_0x3ed8db,_0x5c03a4){_0x3ed8db=_0x3ed8db-0x0;var _0x1a25a3=_0x6b9e[_0x3ed8db];return _0x1a25a3;};var AsteriskManager=require(_0xe6b9('0x0'));var config=require(_0xe6b9('0x1'));var utils=require('./utils');var util=require(_0xe6b9('0x2'));var ami=new AsteriskManager(config[_0xe6b9('0x3')]['port'],config[_0xe6b9('0x3')]['ip'],config[_0xe6b9('0x3')][_0xe6b9('0x4')],config[_0xe6b9('0x3')][_0xe6b9('0x5')],!![]);ami[_0xe6b9('0x6')]();if(config[_0xe6b9('0x7')]&&config[_0xe6b9('0x7')][_0xe6b9('0x8')]){utils[_0xe6b9('0x9')](_0xe6b9('0xa'));}else{var agents=require(_0xe6b9('0xb'));var calls=require(_0xe6b9('0xc'));var queues=require('./queues.controller');var recordings=require(_0xe6b9('0xd'));var members=require('./members.controller');var dials=require(_0xe6b9('0xe'));var transfers=require(_0xe6b9('0xf'));var core=require('./core.controller');ami['on'](_0xe6b9('0x10'),core[_0xe6b9('0x10')]);ami['on']('shutdown',core[_0xe6b9('0x11')]);ami['on']('fullybooted',core[_0xe6b9('0x12')]);ami['on'](_0xe6b9('0x13'),core['error']);ami['on'](_0xe6b9('0x14'),core[_0xe6b9('0x14')]);ami['on'](_0xe6b9('0x15'),core[_0xe6b9('0x15')]);ami['on']('devicestatechange',function(_0x2254c9){try{utils[_0xe6b9('0x16')](util[_0xe6b9('0x17')](_0xe6b9('0x18'),_0x2254c9[_0xe6b9('0x19')]),_0x2254c9);members['devicestatechange'](_0x2254c9);}catch(_0x502b94){utils[_0xe6b9('0x13')](util['format'](_0xe6b9('0x18'),_0x2254c9[_0xe6b9('0x19')]),_0x502b94);}});ami['on'](_0xe6b9('0x1a'),function(_0xe5de2b){try{utils['debug'](util[_0xe6b9('0x17')]('[%s][index][agentcalled]',_0xe5de2b[_0xe6b9('0x1b')]),_0xe5de2b);agents[_0xe6b9('0x1a')](_0xe5de2b);}catch(_0x5f4aa5){utils[_0xe6b9('0x13')](util[_0xe6b9('0x17')](_0xe6b9('0x1c'),_0xe5de2b['uniqueid']),_0x5f4aa5);}});ami['on'](_0xe6b9('0x1d'),function(_0x365c4e){try{utils['debug'](util['format'](_0xe6b9('0x1e'),_0x365c4e['uniqueid']),_0x365c4e);agents['agentringnoanswer'](_0x365c4e);}catch(_0x5759af){utils['error'](util[_0xe6b9('0x17')](_0xe6b9('0x1e'),_0x365c4e[_0xe6b9('0x1b')]),_0x5759af);}});ami['on'](_0xe6b9('0x1f'),function(_0x5e7a90){try{utils[_0xe6b9('0x16')](util[_0xe6b9('0x17')]('[%s][index][agentconnect]',_0x5e7a90['uniqueid']),_0x5e7a90);agents['agentconnect'](_0x5e7a90);queues[_0xe6b9('0x1f')](_0x5e7a90);}catch(_0xb3555f){utils[_0xe6b9('0x13')](util[_0xe6b9('0x17')](_0xe6b9('0x20'),_0x5e7a90[_0xe6b9('0x1b')]),_0xb3555f);}});ami['on'](_0xe6b9('0x21'),function(_0x33b4d1){try{utils[_0xe6b9('0x16')](util['format'](_0xe6b9('0x22'),_0x33b4d1[_0xe6b9('0x1b')]),_0x33b4d1);agents[_0xe6b9('0x21')](_0x33b4d1);queues[_0xe6b9('0x21')](_0x33b4d1);members[_0xe6b9('0x21')](_0x33b4d1);}catch(_0x48fea5){utils['error'](util[_0xe6b9('0x17')](_0xe6b9('0x22'),_0x33b4d1[_0xe6b9('0x1b')]),_0x48fea5);}});ami['on'](_0xe6b9('0x23'),function(_0x1a1708){try{utils[_0xe6b9('0x16')](util[_0xe6b9('0x17')]('[%s][index][queuecallerabandon]',_0x1a1708['uniqueid']),_0x1a1708);agents[_0xe6b9('0x23')](_0x1a1708);queues[_0xe6b9('0x23')](_0x1a1708);}catch(_0x29bb56){utils[_0xe6b9('0x13')](util[_0xe6b9('0x17')](_0xe6b9('0x24'),_0x1a1708['uniqueid']),_0x29bb56);}});ami['on']('queuecallerjoin',function(_0x272706){try{utils[_0xe6b9('0x16')](util[_0xe6b9('0x17')](_0xe6b9('0x25'),_0x272706['uniqueid']),_0x272706);queues[_0xe6b9('0x26')](_0x272706);recordings['queuecallerjoin'](_0x272706);}catch(_0xb684d6){utils['error'](util[_0xe6b9('0x17')](_0xe6b9('0x25'),_0x272706[_0xe6b9('0x1b')]),_0xb684d6);}});ami['on']('queuecallerleave',function(_0x2f1eb2){try{utils['debug'](util[_0xe6b9('0x17')](_0xe6b9('0x27'),_0x2f1eb2[_0xe6b9('0x1b')]),_0x2f1eb2);queues[_0xe6b9('0x28')](_0x2f1eb2);}catch(_0x52ee1a){utils[_0xe6b9('0x13')](util[_0xe6b9('0x17')]('[%s][index][queuecallerleave]',_0x2f1eb2[_0xe6b9('0x1b')]),_0x52ee1a);}});ami['on'](_0xe6b9('0x29'),function(_0x383853){try{utils[_0xe6b9('0x16')](util[_0xe6b9('0x17')](_0xe6b9('0x2a'),_0x383853['uniqueid']),_0x383853);queues['musiconholdstart'](_0x383853);calls[_0xe6b9('0x29')](_0x383853);}catch(_0x23b8fd){utils[_0xe6b9('0x13')](util['format'](_0xe6b9('0x2a'),_0x383853[_0xe6b9('0x1b')]),_0x23b8fd);}});ami['on'](_0xe6b9('0x2b'),function(_0x13fb2c){try{utils['debug'](util['format'](_0xe6b9('0x2c'),_0x13fb2c['uniqueid']),_0x13fb2c);queues[_0xe6b9('0x2b')](_0x13fb2c);calls[_0xe6b9('0x2b')](_0x13fb2c);}catch(_0x17f330){utils[_0xe6b9('0x13')](util[_0xe6b9('0x17')]('[%s][index][musiconholdstop]',_0x13fb2c[_0xe6b9('0x1b')]),_0x17f330);}});ami['on'](_0xe6b9('0x2d'),function(_0x2692ee){try{utils[_0xe6b9('0x16')](util[_0xe6b9('0x17')]('[%s][index][newstate]',_0x2692ee[_0xe6b9('0x1b')]),_0x2692ee);calls['newstate'](_0x2692ee);recordings['newstate'](_0x2692ee);}catch(_0x36b2a9){utils['error'](util['format'](_0xe6b9('0x2e'),_0x2692ee[_0xe6b9('0x1b')]),_0x36b2a9);}});ami['on'](_0xe6b9('0x2f'),function(_0x1763ff){try{utils[_0xe6b9('0x16')](util[_0xe6b9('0x17')](_0xe6b9('0x30'),_0x1763ff['uniqueid']),_0x1763ff);calls['hangup'](_0x1763ff);recordings['hangup'](_0x1763ff);dials['hangup'](_0x1763ff);agents[_0xe6b9('0x2f')](_0x1763ff);queues['hangup'](_0x1763ff);}catch(_0x4bc9b4){utils['error'](util[_0xe6b9('0x17')](_0xe6b9('0x30'),_0x1763ff[_0xe6b9('0x1b')]),_0x4bc9b4);}});ami['on'](_0xe6b9('0x31'),function(_0x43d346){try{utils[_0xe6b9('0x16')](util[_0xe6b9('0x17')](_0xe6b9('0x32'),_0x43d346[_0xe6b9('0x1b')]),_0x43d346);members[_0xe6b9('0x31')](_0x43d346);}catch(_0x4867c5){utils[_0xe6b9('0x13')](util[_0xe6b9('0x17')]('[%s][index][cdr]',_0x43d346[_0xe6b9('0x1b')]),_0x4867c5);}});ami['on'](_0xe6b9('0x33'),function(_0x47a7bb){try{utils[_0xe6b9('0x16')](util[_0xe6b9('0x17')](_0xe6b9('0x34'),_0x47a7bb[_0xe6b9('0x1b')]),_0x47a7bb);queues['blindtransfer'](_0x47a7bb);agents[_0xe6b9('0x33')](_0x47a7bb);transfers['blindtransfer'](_0x47a7bb);}catch(_0x341898){utils[_0xe6b9('0x13')](util[_0xe6b9('0x17')]('[%s][index][blindtransfer]',_0x47a7bb[_0xe6b9('0x1b')]),_0x341898);}});ami['on'](_0xe6b9('0x35'),function(_0x3b679a){try{utils['debug'](util[_0xe6b9('0x17')]('[%s][index][attendedtransfer]',_0x3b679a[_0xe6b9('0x36')]),_0x3b679a);queues[_0xe6b9('0x35')](_0x3b679a);transfers[_0xe6b9('0x35')](_0x3b679a);agents[_0xe6b9('0x35')](_0x3b679a);calls[_0xe6b9('0x35')](_0x3b679a);}catch(_0xa42d8b){utils['error'](util[_0xe6b9('0x17')]('[%s][index][attendedtransfer]',_0x3b679a['origtransfereruniqueid']),_0xa42d8b);}});ami['on'](_0xe6b9('0x37'),function(_0x253261){try{utils[_0xe6b9('0x16')](util[_0xe6b9('0x17')]('[%s][index][varset]',_0x253261[_0xe6b9('0x1b')]),_0x253261);queues[_0xe6b9('0x37')](_0x253261);recordings[_0xe6b9('0x37')](_0x253261);calls[_0xe6b9('0x37')](_0x253261);dials[_0xe6b9('0x37')](_0x253261);}catch(_0x23bec){utils[_0xe6b9('0x13')](util[_0xe6b9('0x17')]('[%s][index][varset]',_0x253261['uniqueid']),_0x23bec);}});ami['on']('newexten',function(_0x4e325d){try{utils[_0xe6b9('0x16')](util[_0xe6b9('0x17')]('[%s][index][newexten]',_0x4e325d[_0xe6b9('0x1b')]),_0x4e325d);calls[_0xe6b9('0x38')](_0x4e325d);recordings[_0xe6b9('0x38')](_0x4e325d);dials[_0xe6b9('0x38')](_0x4e325d);}catch(_0x5aba9f){utils[_0xe6b9('0x13')](util[_0xe6b9('0x17')](_0xe6b9('0x39'),_0x4e325d[_0xe6b9('0x1b')]),_0x5aba9f);}});ami['on'](_0xe6b9('0x3a'),function(_0x3a8b92){try{utils['debug'](util['format'](_0xe6b9('0x3b'),_0x3a8b92[_0xe6b9('0x1b')]),_0x3a8b92);calls[_0xe6b9('0x3a')](_0x3a8b92);recordings['newchannel'](_0x3a8b92);}catch(_0x5b2945){utils[_0xe6b9('0x13')](util['format'](_0xe6b9('0x3b'),_0x3a8b92[_0xe6b9('0x1b')]),_0x5b2945);}});ami['on'](_0xe6b9('0x3c'),function(_0x3bdc7d){try{utils[_0xe6b9('0x16')](util[_0xe6b9('0x17')](_0xe6b9('0x3d'),_0x3bdc7d[_0xe6b9('0x1b')]),_0x3bdc7d);dials[_0xe6b9('0x3c')](_0x3bdc7d);}catch(_0x23910c){utils['error'](util[_0xe6b9('0x17')]('[%s]dialbegin',_0x3bdc7d[_0xe6b9('0x1b')]),_0x23910c);}});ami['on'](_0xe6b9('0x3e'),function(_0x4748e0){try{utils[_0xe6b9('0x16')](util[_0xe6b9('0x17')]('[%s][index][dialend]',_0x4748e0[_0xe6b9('0x1b')]),_0x4748e0);dials['dialend'](_0x4748e0);}catch(_0x1d9690){utils['error'](util[_0xe6b9('0x17')](_0xe6b9('0x3f'),_0x4748e0[_0xe6b9('0x1b')]),_0x1d9690);}});} \ No newline at end of file +var _0xa001=['./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','[%s][index][agentcalled]','uniqueid','agentcalled','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','[%s][index][queuecallerjoin]','queuecallerjoin','[%s][index][queuecallerleave]','queuecallerleave','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','[%s][index][blindtransfer]','blindtransfer','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','./utils','util','username','asterisk','password','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa001,0xbe));var _0x1a00=function(_0x2e73e1,_0x2a6991){_0x2e73e1=_0x2e73e1-0x0;var _0x42af98=_0xa001[_0x2e73e1];return _0x42af98;};var AsteriskManager=require(_0x1a00('0x0'));var config=require('../../config/environment');var utils=require(_0x1a00('0x1'));var util=require(_0x1a00('0x2'));var ami=new AsteriskManager(config['asterisk']['port'],config['asterisk']['ip'],config['asterisk'][_0x1a00('0x3')],config[_0x1a00('0x4')][_0x1a00('0x5')],!![]);ami['keepConnected']();if(config[_0x1a00('0x6')]&&config[_0x1a00('0x6')][_0x1a00('0x7')]){utils[_0x1a00('0x8')](_0x1a00('0x9'));}else{var agents=require(_0x1a00('0xa'));var calls=require(_0x1a00('0xb'));var queues=require(_0x1a00('0xc'));var recordings=require(_0x1a00('0xd'));var members=require(_0x1a00('0xe'));var dials=require(_0x1a00('0xf'));var transfers=require(_0x1a00('0x10'));var core=require(_0x1a00('0x11'));ami['on'](_0x1a00('0x12'),core[_0x1a00('0x12')]);ami['on'](_0x1a00('0x13'),core[_0x1a00('0x13')]);ami['on'](_0x1a00('0x14'),core[_0x1a00('0x14')]);ami['on'](_0x1a00('0x15'),core[_0x1a00('0x15')]);ami['on'](_0x1a00('0x16'),core[_0x1a00('0x16')]);ami['on']('managerevent',core[_0x1a00('0x17')]);ami['on'](_0x1a00('0x18'),function(_0x1182a0){try{utils[_0x1a00('0x19')](util[_0x1a00('0x1a')](_0x1a00('0x1b'),_0x1182a0[_0x1a00('0x1c')]),_0x1182a0);members['devicestatechange'](_0x1182a0);}catch(_0x143fa2){utils['error'](util[_0x1a00('0x1a')](_0x1a00('0x1b'),_0x1182a0[_0x1a00('0x1c')]),_0x143fa2);}});ami['on']('agentcalled',function(_0x1c27dc){try{utils[_0x1a00('0x19')](util[_0x1a00('0x1a')](_0x1a00('0x1d'),_0x1c27dc[_0x1a00('0x1e')]),_0x1c27dc);agents[_0x1a00('0x1f')](_0x1c27dc);}catch(_0x2f52b9){utils[_0x1a00('0x15')](util[_0x1a00('0x1a')](_0x1a00('0x1d'),_0x1c27dc[_0x1a00('0x1e')]),_0x2f52b9);}});ami['on'](_0x1a00('0x20'),function(_0x2ac24c){try{utils[_0x1a00('0x19')](util[_0x1a00('0x1a')](_0x1a00('0x21'),_0x2ac24c[_0x1a00('0x1e')]),_0x2ac24c);agents[_0x1a00('0x20')](_0x2ac24c);}catch(_0x2b55b2){utils[_0x1a00('0x15')](util[_0x1a00('0x1a')]('[%s][index][agentringnoanswer]',_0x2ac24c[_0x1a00('0x1e')]),_0x2b55b2);}});ami['on'](_0x1a00('0x22'),function(_0x579221){try{utils[_0x1a00('0x19')](util[_0x1a00('0x1a')](_0x1a00('0x23'),_0x579221[_0x1a00('0x1e')]),_0x579221);agents[_0x1a00('0x22')](_0x579221);queues['agentconnect'](_0x579221);}catch(_0x58c612){utils[_0x1a00('0x15')](util[_0x1a00('0x1a')]('[%s][index][agentconnect]',_0x579221[_0x1a00('0x1e')]),_0x58c612);}});ami['on'](_0x1a00('0x24'),function(_0x1336e6){try{utils[_0x1a00('0x19')](util[_0x1a00('0x1a')]('[%s][index][agentcomplete]',_0x1336e6[_0x1a00('0x1e')]),_0x1336e6);agents[_0x1a00('0x24')](_0x1336e6);queues[_0x1a00('0x24')](_0x1336e6);members[_0x1a00('0x24')](_0x1336e6);}catch(_0x2e33d0){utils['error'](util[_0x1a00('0x1a')](_0x1a00('0x25'),_0x1336e6[_0x1a00('0x1e')]),_0x2e33d0);}});ami['on'](_0x1a00('0x26'),function(_0x5aaa64){try{utils['debug'](util[_0x1a00('0x1a')](_0x1a00('0x27'),_0x5aaa64[_0x1a00('0x1e')]),_0x5aaa64);agents['queuecallerabandon'](_0x5aaa64);queues['queuecallerabandon'](_0x5aaa64);}catch(_0x4eb319){utils[_0x1a00('0x15')](util[_0x1a00('0x1a')]('[%s][index][queuecallerabandon]',_0x5aaa64[_0x1a00('0x1e')]),_0x4eb319);}});ami['on']('queuecallerjoin',function(_0x4478ec){try{utils['debug'](util[_0x1a00('0x1a')](_0x1a00('0x28'),_0x4478ec['uniqueid']),_0x4478ec);queues[_0x1a00('0x29')](_0x4478ec);recordings[_0x1a00('0x29')](_0x4478ec);}catch(_0x4b965f){utils[_0x1a00('0x15')](util['format'](_0x1a00('0x28'),_0x4478ec[_0x1a00('0x1e')]),_0x4b965f);}});ami['on']('queuecallerleave',function(_0x227237){try{utils[_0x1a00('0x19')](util[_0x1a00('0x1a')](_0x1a00('0x2a'),_0x227237['uniqueid']),_0x227237);queues[_0x1a00('0x2b')](_0x227237);}catch(_0x435f0b){utils[_0x1a00('0x15')](util[_0x1a00('0x1a')](_0x1a00('0x2a'),_0x227237[_0x1a00('0x1e')]),_0x435f0b);}});ami['on'](_0x1a00('0x2c'),function(_0x14c2ea){try{utils[_0x1a00('0x19')](util[_0x1a00('0x1a')](_0x1a00('0x2d'),_0x14c2ea[_0x1a00('0x1e')]),_0x14c2ea);queues[_0x1a00('0x2c')](_0x14c2ea);calls[_0x1a00('0x2c')](_0x14c2ea);}catch(_0x23687d){utils['error'](util[_0x1a00('0x1a')](_0x1a00('0x2d'),_0x14c2ea[_0x1a00('0x1e')]),_0x23687d);}});ami['on'](_0x1a00('0x2e'),function(_0x5c1319){try{utils[_0x1a00('0x19')](util['format'](_0x1a00('0x2f'),_0x5c1319[_0x1a00('0x1e')]),_0x5c1319);queues[_0x1a00('0x2e')](_0x5c1319);calls[_0x1a00('0x2e')](_0x5c1319);}catch(_0x393b79){utils[_0x1a00('0x15')](util[_0x1a00('0x1a')]('[%s][index][musiconholdstop]',_0x5c1319[_0x1a00('0x1e')]),_0x393b79);}});ami['on']('newstate',function(_0x113416){try{utils[_0x1a00('0x19')](util[_0x1a00('0x1a')]('[%s][index][newstate]',_0x113416[_0x1a00('0x1e')]),_0x113416);calls[_0x1a00('0x30')](_0x113416);recordings[_0x1a00('0x30')](_0x113416);}catch(_0x41fa63){utils[_0x1a00('0x15')](util['format'](_0x1a00('0x31'),_0x113416['uniqueid']),_0x41fa63);}});ami['on'](_0x1a00('0x32'),function(_0x51c761){try{utils[_0x1a00('0x19')](util['format'](_0x1a00('0x33'),_0x51c761['uniqueid']),_0x51c761);calls[_0x1a00('0x32')](_0x51c761);recordings[_0x1a00('0x32')](_0x51c761);dials[_0x1a00('0x32')](_0x51c761);agents[_0x1a00('0x32')](_0x51c761);queues['hangup'](_0x51c761);}catch(_0x3ef649){utils[_0x1a00('0x15')](util['format'](_0x1a00('0x33'),_0x51c761['uniqueid']),_0x3ef649);}});ami['on'](_0x1a00('0x34'),function(_0xe3cd9d){try{utils[_0x1a00('0x19')](util[_0x1a00('0x1a')](_0x1a00('0x35'),_0xe3cd9d['uniqueid']),_0xe3cd9d);members['cdr'](_0xe3cd9d);}catch(_0x11b2c4){utils[_0x1a00('0x15')](util[_0x1a00('0x1a')]('[%s][index][cdr]',_0xe3cd9d[_0x1a00('0x1e')]),_0x11b2c4);}});ami['on']('blindtransfer',function(_0x2a281a){try{utils[_0x1a00('0x19')](util['format'](_0x1a00('0x36'),_0x2a281a[_0x1a00('0x1e')]),_0x2a281a);queues['blindtransfer'](_0x2a281a);agents[_0x1a00('0x37')](_0x2a281a);transfers[_0x1a00('0x37')](_0x2a281a);}catch(_0x268bf9){utils[_0x1a00('0x15')](util[_0x1a00('0x1a')](_0x1a00('0x36'),_0x2a281a[_0x1a00('0x1e')]),_0x268bf9);}});ami['on'](_0x1a00('0x38'),function(_0x23e1b2){try{utils['debug'](util[_0x1a00('0x1a')](_0x1a00('0x39'),_0x23e1b2[_0x1a00('0x3a')]),_0x23e1b2);queues[_0x1a00('0x38')](_0x23e1b2);transfers['attendedtransfer'](_0x23e1b2);agents['attendedtransfer'](_0x23e1b2);calls[_0x1a00('0x38')](_0x23e1b2);}catch(_0x51f7f5){utils[_0x1a00('0x15')](util[_0x1a00('0x1a')]('[%s][index][attendedtransfer]',_0x23e1b2[_0x1a00('0x3a')]),_0x51f7f5);}});ami['on'](_0x1a00('0x3b'),function(_0xcbccd0){try{utils[_0x1a00('0x19')](util['format'](_0x1a00('0x3c'),_0xcbccd0[_0x1a00('0x1e')]),_0xcbccd0);queues[_0x1a00('0x3b')](_0xcbccd0);recordings['varset'](_0xcbccd0);calls[_0x1a00('0x3b')](_0xcbccd0);dials['varset'](_0xcbccd0);}catch(_0x41ee95){utils[_0x1a00('0x15')](util[_0x1a00('0x1a')](_0x1a00('0x3c'),_0xcbccd0[_0x1a00('0x1e')]),_0x41ee95);}});ami['on'](_0x1a00('0x3d'),function(_0x3e1141){try{utils[_0x1a00('0x19')](util['format']('[%s][index][newexten]',_0x3e1141[_0x1a00('0x1e')]),_0x3e1141);calls[_0x1a00('0x3d')](_0x3e1141);recordings['newexten'](_0x3e1141);dials['newexten'](_0x3e1141);}catch(_0x5e1c19){utils[_0x1a00('0x15')](util[_0x1a00('0x1a')]('[%s][index][newexten]',_0x3e1141['uniqueid']),_0x5e1c19);}});ami['on'](_0x1a00('0x3e'),function(_0x4f7d6d){try{utils['debug'](util[_0x1a00('0x1a')](_0x1a00('0x3f'),_0x4f7d6d[_0x1a00('0x1e')]),_0x4f7d6d);calls[_0x1a00('0x3e')](_0x4f7d6d);recordings[_0x1a00('0x3e')](_0x4f7d6d);}catch(_0x39d7d8){utils[_0x1a00('0x15')](util[_0x1a00('0x1a')](_0x1a00('0x3f'),_0x4f7d6d[_0x1a00('0x1e')]),_0x39d7d8);}});ami['on'](_0x1a00('0x40'),function(_0x576640){try{utils[_0x1a00('0x19')](util[_0x1a00('0x1a')](_0x1a00('0x41'),_0x576640[_0x1a00('0x1e')]),_0x576640);dials[_0x1a00('0x40')](_0x576640);}catch(_0x280e22){utils[_0x1a00('0x15')](util[_0x1a00('0x1a')](_0x1a00('0x42'),_0x576640[_0x1a00('0x1e')]),_0x280e22);}});ami['on'](_0x1a00('0x43'),function(_0x15311c){try{utils['debug'](util[_0x1a00('0x1a')](_0x1a00('0x44'),_0x15311c['uniqueid']),_0x15311c);dials[_0x1a00('0x43')](_0x15311c);}catch(_0x349091){utils[_0x1a00('0x15')](util['format']('[%s][index][dialend]',_0x15311c[_0x1a00('0x1e')]),_0x349091);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 0e1d183..75b5dee 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 _0x3dd5=['duration','diffTime','enterAt','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','channel','data1','data3','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','source','destination','error','lodash','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','data2','membername','type','then','name','internal','request','getUserByName','split','CreateMemberReport','catch','[%s][members][writeDB]','startsWith','devicestatechange','debug','device','state','INUSE','BUSY','now','agent','isNil','exitAt'];(function(_0x57b7f6,_0x5d6061){var _0x135fed=function(_0x14f057){while(--_0x14f057){_0x57b7f6['push'](_0x57b7f6['shift']());}};_0x135fed(++_0x5d6061);}(_0x3dd5,0x73));var _0x53dd=function(_0x5c4978,_0x217852){_0x5c4978=_0x5c4978-0x0;var _0x22cf5b=_0x3dd5[_0x5c4978];return _0x22cf5b;};'use strict';var _=require(_0x53dd('0x0'));var util=require('util');var utils=require(_0x53dd('0x1'));var members={};var exclude=[_0x53dd('0x2'),_0x53dd('0x3')];function writeDB(_0x3b6401){utils[_0x53dd('0x4')](util[_0x53dd('0x5')](_0x53dd('0x6'),_0x3b6401[_0x53dd('0x7')],_0x3b6401[_0x53dd('0x8')],_0x3b6401['channel'],_0x3b6401[_0x53dd('0x9')],_0x3b6401[_0x53dd('0xa')],_0x3b6401[_0x53dd('0xb')]));if(_0x3b6401[_0x53dd('0x8')]){utils['getUserByInterface'](_0x3b6401['interface'])[_0x53dd('0xc')](function(_0x47b7a4){if(_0x47b7a4){_0x3b6401[_0x53dd('0xa')]=_0x47b7a4[_0x53dd('0xd')];_0x3b6401[_0x53dd('0xe')]=_0x47b7a4[_0x53dd('0xe')];utils[_0x53dd('0xf')]('CreateMemberReport',_0x3b6401);}else{utils[_0x53dd('0x10')](_0x3b6401[_0x53dd('0x8')][_0x53dd('0x11')]('/')[0x1])[_0x53dd('0xc')](function(_0x57515c){if(_0x57515c){_0x3b6401['membername']=_0x57515c[_0x53dd('0xd')];_0x3b6401[_0x53dd('0xe')]=_0x57515c[_0x53dd('0xe')];utils['request'](_0x53dd('0x12'),_0x3b6401);}});}})[_0x53dd('0x13')](function(_0x416c6f){utils['error'](util[_0x53dd('0x5')](_0x53dd('0x14'),_0x3b6401[_0x53dd('0x7')]),_0x416c6f);});}delete members[_0x3b6401['interface']];}function startsWith(_0x593a36,_0x5364be){return _['some'](_0x593a36,function(_0x1d8ecf){return _[_0x53dd('0x15')](_0x5364be,_0x1d8ecf);});}exports[_0x53dd('0x16')]=function(_0x30052e){try{utils[_0x53dd('0x17')](util['format']('[%s][members][devicestatechange]',members[_0x30052e[_0x53dd('0x18')]]?members[_0x30052e[_0x53dd('0x18')]][_0x53dd('0x7')]:_0x30052e[_0x53dd('0x18')]),_0x30052e);utils[_0x53dd('0x4')](util['format']('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x30052e['device']]?members[_0x30052e['device']]['uniqueid']:_0x30052e[_0x53dd('0x18')],_0x30052e['state'],_0x30052e['device']));switch(_0x30052e[_0x53dd('0x19')]){case _0x53dd('0x1a'):case _0x53dd('0x1b'):if(!startsWith(exclude,_0x30052e[_0x53dd('0x18')])){members[_0x30052e[_0x53dd('0x18')]]={'channel':'voice','interface':_0x30052e[_0x53dd('0x18')],'type':'TALKING','enterAt':utils[_0x53dd('0x1c')](),'role':_0x53dd('0x1d')};}break;case'NOT_INUSE':if(!_[_0x53dd('0x1e')](members[_0x30052e[_0x53dd('0x18')]])){members[_0x30052e['device']][_0x53dd('0x1f')]=utils['now']();members[_0x30052e[_0x53dd('0x18')]][_0x53dd('0x20')]=utils[_0x53dd('0x21')](members[_0x30052e[_0x53dd('0x18')]][_0x53dd('0x1f')],members[_0x30052e[_0x53dd('0x18')]][_0x53dd('0x22')]);if(members[_0x30052e[_0x53dd('0x18')]][_0x53dd('0x7')]){writeDB(members[_0x30052e[_0x53dd('0x18')]]);}}break;default:break;}}catch(_0x3cfbcd){utils['error'](util[_0x53dd('0x5')]('[%s][members][devicestatechange]',members[_0x30052e['device']]?members[_0x30052e[_0x53dd('0x18')]][_0x53dd('0x7')]:_0x30052e['device']),_0x3cfbcd);}};exports[_0x53dd('0x23')]=function(_0x55443d){try{if(!_[_0x53dd('0x1e')](members[_0x55443d[_0x53dd('0x8')]])){utils['debug'](util[_0x53dd('0x5')](_0x53dd('0x24'),_0x55443d['uniqueid']),_0x55443d);utils[_0x53dd('0x4')](util['format'](_0x53dd('0x25'),_0x55443d[_0x53dd('0x7')],_0x55443d['interface'],_0x55443d[_0x53dd('0x26')]));members[_0x55443d[_0x53dd('0x8')]]=_[_0x53dd('0x27')](members[_0x55443d[_0x53dd('0x8')]],{'data4':_0x55443d[_0x53dd('0x26')],'uniqueid':_0x55443d[_0x53dd('0x7')]});}}catch(_0x487aca){utils['error'](util[_0x53dd('0x5')](_0x53dd('0x24'),_0x55443d[_0x53dd('0x7')]),_0x487aca);}};exports[_0x53dd('0x28')]=function(_0x5760f9){try{utils[_0x53dd('0x17')](util[_0x53dd('0x5')](_0x53dd('0x29'),_0x5760f9[_0x53dd('0x7')]),_0x5760f9);if(_0x5760f9[_0x53dd('0x2a')]){var _0x369daa=_0x5760f9[_0x53dd('0x2a')]['split']('-')[0x0];if(!_[_0x53dd('0x1e')](members[_0x369daa])){members[_0x369daa]=_['assign'](members[_0x369daa],{'data1':members[_0x369daa][_0x53dd('0x2b')]||_0x5760f9[_0x53dd('0xb')],'data2':members[_0x369daa][_0x53dd('0x9')]||_0x5760f9['source'],'data3':members[_0x369daa][_0x53dd('0x2c')]||_0x5760f9['destination'],'uniqueid':members[_0x369daa][_0x53dd('0x7')]||_0x5760f9[_0x53dd('0x7')]});utils[_0x53dd('0x4')](util[_0x53dd('0x5')](_0x53dd('0x2d'),_0x5760f9[_0x53dd('0x7')],members[_0x369daa][_0x53dd('0x2b')],members[_0x369daa][_0x53dd('0x9')],members[_0x369daa][_0x53dd('0x2c')]));if(members[_0x369daa][_0x53dd('0x1f')]){writeDB(members[_0x369daa]);}}}if(_0x5760f9['destinationchannel']){var _0x2af0a3=_0x5760f9['destinationchannel'][_0x53dd('0x11')]('-')[0x0];if(!_[_0x53dd('0x1e')](members[_0x2af0a3])){members[_0x2af0a3]=_[_0x53dd('0x27')](members[_0x2af0a3],{'data1':members[_0x2af0a3][_0x53dd('0x2b')]||_0x5760f9['type'],'data2':members[_0x2af0a3][_0x53dd('0x9')]||_0x5760f9[_0x53dd('0x2e')],'data3':members[_0x2af0a3][_0x53dd('0x2c')]||_0x5760f9[_0x53dd('0x2f')],'uniqueid':members[_0x2af0a3][_0x53dd('0x7')]||_0x5760f9[_0x53dd('0x7')]});utils[_0x53dd('0x4')](util[_0x53dd('0x5')](_0x53dd('0x2d'),_0x5760f9['uniqueid'],members[_0x2af0a3][_0x53dd('0x2b')],members[_0x2af0a3]['data2'],members[_0x2af0a3][_0x53dd('0x2c')]));if(members[_0x2af0a3][_0x53dd('0x1f')]){writeDB(members[_0x2af0a3]);}}}}catch(_0x1e44b0){utils[_0x53dd('0x30')](util['format']('[%s][members][cdr]',_0x5760f9[_0x53dd('0x7')]),_0x1e44b0);}}; \ No newline at end of file +var _0x5044=['now','NOT_INUSE','isNil','exitAt','agentcomplete','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','cdr','[%s][members][cdr]','assign','data1','source','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data3','destinationchannel','util','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','data2','membername','type','getUserByInterface','then','internal','request','CreateMemberReport','getUserByName','split','name','error','[%s][members][writeDB]','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','voice','TALKING'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0x5044,0xc8));var _0x4504=function(_0x418ef7,_0x1d2ab9){_0x418ef7=_0x418ef7-0x0;var _0x34d357=_0x5044[_0x418ef7];return _0x34d357;};'use strict';var _=require('lodash');var util=require(_0x4504('0x0'));var utils=require('./utils');var members={};var exclude=[_0x4504('0x1'),_0x4504('0x2')];function writeDB(_0x2e8da7){utils[_0x4504('0x3')](util[_0x4504('0x4')](_0x4504('0x5'),_0x2e8da7[_0x4504('0x6')],_0x2e8da7[_0x4504('0x7')],_0x2e8da7['channel'],_0x2e8da7[_0x4504('0x8')],_0x2e8da7[_0x4504('0x9')],_0x2e8da7[_0x4504('0xa')]));if(_0x2e8da7[_0x4504('0x7')]){utils[_0x4504('0xb')](_0x2e8da7[_0x4504('0x7')])[_0x4504('0xc')](function(_0x43b304){if(_0x43b304){_0x2e8da7[_0x4504('0x9')]=_0x43b304['name'];_0x2e8da7[_0x4504('0xd')]=_0x43b304['internal'];utils[_0x4504('0xe')](_0x4504('0xf'),_0x2e8da7);}else{utils[_0x4504('0x10')](_0x2e8da7[_0x4504('0x7')][_0x4504('0x11')]('/')[0x1])[_0x4504('0xc')](function(_0x33d6da){if(_0x33d6da){_0x2e8da7[_0x4504('0x9')]=_0x33d6da[_0x4504('0x12')];_0x2e8da7[_0x4504('0xd')]=_0x33d6da[_0x4504('0xd')];utils[_0x4504('0xe')](_0x4504('0xf'),_0x2e8da7);}});}})['catch'](function(_0xa9b827){utils[_0x4504('0x13')](util['format'](_0x4504('0x14'),_0x2e8da7[_0x4504('0x6')]),_0xa9b827);});}delete members[_0x2e8da7[_0x4504('0x7')]];}function startsWith(_0x3e992b,_0x4c773a){return _['some'](_0x3e992b,function(_0x1b2698){return _['startsWith'](_0x4c773a,_0x1b2698);});}exports[_0x4504('0x15')]=function(_0x5ede87){try{utils[_0x4504('0x16')](util[_0x4504('0x4')](_0x4504('0x17'),members[_0x5ede87['device']]?members[_0x5ede87[_0x4504('0x18')]][_0x4504('0x6')]:_0x5ede87[_0x4504('0x18')]),_0x5ede87);utils[_0x4504('0x3')](util[_0x4504('0x4')](_0x4504('0x19'),members[_0x5ede87['device']]?members[_0x5ede87['device']]['uniqueid']:_0x5ede87[_0x4504('0x18')],_0x5ede87[_0x4504('0x1a')],_0x5ede87[_0x4504('0x18')]));switch(_0x5ede87[_0x4504('0x1a')]){case _0x4504('0x1b'):case'BUSY':if(!startsWith(exclude,_0x5ede87[_0x4504('0x18')])){members[_0x5ede87[_0x4504('0x18')]]={'channel':_0x4504('0x1c'),'interface':_0x5ede87[_0x4504('0x18')],'type':_0x4504('0x1d'),'enterAt':utils[_0x4504('0x1e')](),'role':'agent'};}break;case _0x4504('0x1f'):if(!_[_0x4504('0x20')](members[_0x5ede87['device']])){members[_0x5ede87[_0x4504('0x18')]][_0x4504('0x21')]=utils['now']();members[_0x5ede87[_0x4504('0x18')]]['duration']=utils['diffTime'](members[_0x5ede87[_0x4504('0x18')]][_0x4504('0x21')],members[_0x5ede87[_0x4504('0x18')]]['enterAt']);if(members[_0x5ede87[_0x4504('0x18')]][_0x4504('0x6')]){writeDB(members[_0x5ede87[_0x4504('0x18')]]);}}break;default:break;}}catch(_0x2a46de){utils[_0x4504('0x13')](util['format'](_0x4504('0x17'),members[_0x5ede87['device']]?members[_0x5ede87[_0x4504('0x18')]][_0x4504('0x6')]:_0x5ede87[_0x4504('0x18')]),_0x2a46de);}};exports[_0x4504('0x22')]=function(_0x3de7b0){try{if(!_[_0x4504('0x20')](members[_0x3de7b0[_0x4504('0x7')]])){utils['debug'](util[_0x4504('0x4')]('[%s][members][agentcomplete]',_0x3de7b0['uniqueid']),_0x3de7b0);utils[_0x4504('0x3')](util[_0x4504('0x4')](_0x4504('0x23'),_0x3de7b0[_0x4504('0x6')],_0x3de7b0[_0x4504('0x7')],_0x3de7b0['queue']));members[_0x3de7b0['interface']]=_['assign'](members[_0x3de7b0[_0x4504('0x7')]],{'data4':_0x3de7b0[_0x4504('0x24')],'uniqueid':_0x3de7b0[_0x4504('0x6')]});}}catch(_0x5cbee1){utils['error'](util[_0x4504('0x4')]('[%s][members][agentcomplete]',_0x3de7b0[_0x4504('0x6')]),_0x5cbee1);}};exports[_0x4504('0x25')]=function(_0x4fa20b){try{utils[_0x4504('0x16')](util[_0x4504('0x4')](_0x4504('0x26'),_0x4fa20b['uniqueid']),_0x4fa20b);if(_0x4fa20b['channel']){var _0x216e1e=_0x4fa20b['channel']['split']('-')[0x0];if(!_[_0x4504('0x20')](members[_0x216e1e])){members[_0x216e1e]=_[_0x4504('0x27')](members[_0x216e1e],{'data1':members[_0x216e1e][_0x4504('0x28')]||_0x4fa20b['type'],'data2':members[_0x216e1e][_0x4504('0x8')]||_0x4fa20b[_0x4504('0x29')],'data3':members[_0x216e1e]['data3']||_0x4fa20b[_0x4504('0x2a')],'uniqueid':members[_0x216e1e][_0x4504('0x6')]||_0x4fa20b[_0x4504('0x6')]});utils['info'](util[_0x4504('0x4')](_0x4504('0x2b'),_0x4fa20b[_0x4504('0x6')],members[_0x216e1e][_0x4504('0x28')],members[_0x216e1e][_0x4504('0x8')],members[_0x216e1e][_0x4504('0x2c')]));if(members[_0x216e1e]['exitAt']){writeDB(members[_0x216e1e]);}}}if(_0x4fa20b[_0x4504('0x2d')]){var _0xac1d96=_0x4fa20b[_0x4504('0x2d')][_0x4504('0x11')]('-')[0x0];if(!_['isNil'](members[_0xac1d96])){members[_0xac1d96]=_[_0x4504('0x27')](members[_0xac1d96],{'data1':members[_0xac1d96][_0x4504('0x28')]||_0x4fa20b['type'],'data2':members[_0xac1d96][_0x4504('0x8')]||_0x4fa20b[_0x4504('0x29')],'data3':members[_0xac1d96][_0x4504('0x2c')]||_0x4fa20b[_0x4504('0x2a')],'uniqueid':members[_0xac1d96]['uniqueid']||_0x4fa20b[_0x4504('0x6')]});utils['info'](util[_0x4504('0x4')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x4fa20b[_0x4504('0x6')],members[_0xac1d96][_0x4504('0x28')],members[_0xac1d96][_0x4504('0x8')],members[_0xac1d96][_0x4504('0x2c')]));if(members[_0xac1d96]['exitAt']){writeDB(members[_0xac1d96]);}}}}catch(_0x48cfb3){utils[_0x4504('0x13')](util[_0x4504('0x4')](_0x4504('0x26'),_0x4fa20b['uniqueid']),_0x48cfb3);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 10375d0..3aec506 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 _0x5f82=['[%s][queues][varset]','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','membername','destaccountcode','assigned','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfereruniqueid','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridnum','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','mohtime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','format','uniqueid','channel','lastAssignedTo','accountcode','queue','getVoiceQueueByName','then','type','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','position','now','error','hangup','isNil','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','queuecallerexitreason','COMPLETEDBYAGENT','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','[%s][queues][hangup]','debug'];(function(_0x5d850c,_0x349ef5){var _0x11de78=function(_0x2e8783){while(--_0x2e8783){_0x5d850c['push'](_0x5d850c['shift']());}};_0x11de78(++_0x349ef5);}(_0x5f82,0x114));var _0x25f8=function(_0x3305de,_0x16582f){_0x3305de=_0x3305de-0x0;var _0x3b5a84=_0x5f82[_0x3305de];return _0x3b5a84;};'use strict';var _=require(_0x25f8('0x0'));var util=require(_0x25f8('0x1'));var utils=require(_0x25f8('0x2'));var queues={};function writeDB(_0x348572){utils[_0x25f8('0x3')](util[_0x25f8('0x4')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x348572[_0x25f8('0x5')],_0x348572[_0x25f8('0x6')],_0x348572['queue'],_0x348572[_0x25f8('0x7')],_0x348572['calleridnum'],_0x348572[_0x25f8('0x8')],_0x348572['queuecallerexitreason']));if(_0x348572[_0x25f8('0x9')]){utils[_0x25f8('0xa')](_0x348572[_0x25f8('0x9')])[_0x25f8('0xb')](function(_0x8bdb47){if(_0x8bdb47){_0x348572['type']=_0x8bdb47[_0x25f8('0xc')];}utils['request'](_0x25f8('0xd'),_0x348572);});}else{utils['request']('CreateVoiceQueueReport',_0x348572);}if(_0x348572[_0x25f8('0xe')]){delete queues[_0x348572['transfereduniqueid']];}else{delete queues[_0x348572[_0x25f8('0x5')]];}}exports[_0x25f8('0xf')]=function(_0x504eff){try{utils['debug'](util[_0x25f8('0x4')](_0x25f8('0x10'),_0x504eff[_0x25f8('0x5')]),_0x504eff);utils['info'](util[_0x25f8('0x4')](_0x25f8('0x11'),_0x504eff[_0x25f8('0x5')],_0x504eff['queue'],_0x504eff['position']));queues[_0x504eff[_0x25f8('0x5')]]=_[_0x25f8('0x12')](_0x504eff,{'originalposition':_0x504eff[_0x25f8('0x13')],'queuecallerjoinAt':utils[_0x25f8('0x14')](),'mohtime':0x0});}catch(_0x3d1bba){utils[_0x25f8('0x15')](util[_0x25f8('0x4')](_0x25f8('0x10'),_0x504eff[_0x25f8('0x5')]),_0x3d1bba);}};exports[_0x25f8('0x16')]=function(_0x277dc0){try{if(!_[_0x25f8('0x17')](queues[_0x277dc0[_0x25f8('0x5')]])){utils['debug'](util[_0x25f8('0x4')]('[%s][queues][hangup]',_0x277dc0[_0x25f8('0x5')]),_0x277dc0);if(queues[_0x277dc0['uniqueid']][_0x25f8('0x18')]){if(!queues[_0x277dc0[_0x25f8('0x5')]][_0x25f8('0x19')]&&!queues[_0x277dc0[_0x25f8('0x5')]][_0x25f8('0x1a')]){queues[_0x277dc0['uniqueid']][_0x25f8('0x1b')]=!![];queues[_0x277dc0[_0x25f8('0x5')]][_0x25f8('0x1c')]=utils[_0x25f8('0x14')]();queues[_0x277dc0[_0x25f8('0x5')]][_0x25f8('0x1d')]=_0x25f8('0x1e');}utils['info'](util[_0x25f8('0x4')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x277dc0[_0x25f8('0x5')],queues[_0x277dc0[_0x25f8('0x5')]][_0x25f8('0x1f')],queues[_0x277dc0['uniqueid']][_0x25f8('0x1d')]));writeDB(queues[_0x277dc0[_0x25f8('0x5')]]);}else if(queues[_0x277dc0['uniqueid']][_0x25f8('0xe')]){utils[_0x25f8('0x3')](util[_0x25f8('0x4')](_0x25f8('0x20'),_0x277dc0[_0x25f8('0x5')],queues[_0x277dc0[_0x25f8('0x5')]][_0x25f8('0x1f')],queues[_0x277dc0['uniqueid']][_0x25f8('0xe')]));queues[queues[_0x277dc0[_0x25f8('0x5')]][_0x25f8('0xe')]]=queues[_0x277dc0[_0x25f8('0x5')]];queues[queues[_0x277dc0[_0x25f8('0x5')]][_0x25f8('0xe')]][_0x25f8('0x21')]=0x2;delete queues[_0x277dc0[_0x25f8('0x5')]];}}}catch(_0x49076c){utils[_0x25f8('0x15')](util[_0x25f8('0x4')](_0x25f8('0x22'),_0x277dc0[_0x25f8('0x5')]),_0x49076c);}};exports['varset']=function(_0x2e0995){try{utils[_0x25f8('0x23')](util[_0x25f8('0x4')](_0x25f8('0x24'),_0x2e0995[_0x25f8('0x5')]),_0x2e0995);if(!_['isNil'](_0x2e0995['variable'][_0x25f8('0x25')])&&_0x2e0995[_0x25f8('0x26')][_0x25f8('0x27')]()!==_0x25f8('0x28')){if(!_[_0x25f8('0x17')](queues[_0x2e0995['uniqueid']])){queues[_0x2e0995[_0x25f8('0x5')]]['queuecallerabandon']=![];queues[_0x2e0995[_0x25f8('0x5')]][_0x25f8('0x29')]=null;queues[_0x2e0995[_0x25f8('0x5')]]['queuecallerexit']=!![];queues[_0x2e0995[_0x25f8('0x5')]][_0x25f8('0x2a')]=utils[_0x25f8('0x14')]();queues[_0x2e0995['uniqueid']]['queuecallerexitreason']=_0x2e0995[_0x25f8('0x26')][_0x25f8('0x27')]();utils[_0x25f8('0x3')](util[_0x25f8('0x4')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x2e0995['uniqueid'],queues[_0x2e0995[_0x25f8('0x5')]][_0x25f8('0x1f')],_0x2e0995[_0x25f8('0x26')],queues[_0x2e0995[_0x25f8('0x5')]][_0x25f8('0x1d')]));writeDB(queues[_0x2e0995[_0x25f8('0x5')]]);}}else if(!_[_0x25f8('0x17')](_0x2e0995['variable'][_0x25f8('0x2b')])){if(!_['isNil'](queues[_0x2e0995[_0x25f8('0x5')]])&&!queues[_0x2e0995[_0x25f8('0x5')]][_0x25f8('0x19')]){queues[_0x2e0995[_0x25f8('0x5')]]['queuecallerabandon']=![];queues[_0x2e0995['uniqueid']][_0x25f8('0x29')]=null;queues[_0x2e0995['uniqueid']][_0x25f8('0x1a')]=!![];queues[_0x2e0995[_0x25f8('0x5')]][_0x25f8('0x2a')]=utils[_0x25f8('0x14')]();queues[_0x2e0995[_0x25f8('0x5')]][_0x25f8('0x1d')]=_0x25f8('0x2c');utils[_0x25f8('0x3')](util[_0x25f8('0x4')](_0x25f8('0x2d'),_0x2e0995[_0x25f8('0x5')],queues[_0x2e0995['uniqueid']][_0x25f8('0x1f')],_0x2e0995[_0x25f8('0x26')],queues[_0x2e0995['uniqueid']][_0x25f8('0x1d')]));}}}catch(_0x8f32bd){utils['error'](util['format'](_0x25f8('0x24'),_0x2e0995[_0x25f8('0x5')]),_0x8f32bd);}};exports[_0x25f8('0x19')]=function(_0x24066d){try{if(!_[_0x25f8('0x17')](queues[_0x24066d[_0x25f8('0x5')]])){utils[_0x25f8('0x23')](util[_0x25f8('0x4')](_0x25f8('0x2e'),_0x24066d[_0x25f8('0x5')]),_0x24066d);queues[_0x24066d[_0x25f8('0x5')]][_0x25f8('0x1a')]=![];queues[_0x24066d[_0x25f8('0x5')]][_0x25f8('0x2a')]=null;queues[_0x24066d[_0x25f8('0x5')]][_0x25f8('0x19')]=!![];queues[_0x24066d[_0x25f8('0x5')]][_0x25f8('0x29')]=utils['now']();queues[_0x24066d['uniqueid']]['queuecallerexitreason']=_0x25f8('0x2f');utils['info'](util[_0x25f8('0x4')](_0x25f8('0x30'),_0x24066d['uniqueid'],queues[_0x24066d[_0x25f8('0x5')]]['name'],queues[_0x24066d[_0x25f8('0x5')]]['queuecallerexitreason']));}}catch(_0x30197e){utils[_0x25f8('0x15')](util['format'](_0x25f8('0x2e'),_0x24066d[_0x25f8('0x5')]),_0x30197e);}};exports['queuecallerleave']=function(_0x1b425c){try{if(!_[_0x25f8('0x17')](queues[_0x1b425c[_0x25f8('0x5')]])){utils['debug'](util[_0x25f8('0x4')]('[%s][queues][queuecallerleave]',_0x1b425c['uniqueid']),_0x1b425c);utils[_0x25f8('0x3')](util[_0x25f8('0x4')](_0x25f8('0x31'),_0x1b425c['uniqueid'],queues[_0x1b425c[_0x25f8('0x5')]][_0x25f8('0x1f')],_0x1b425c[_0x25f8('0x32')],_0x1b425c[_0x25f8('0x33')]));queues[_0x1b425c[_0x25f8('0x5')]]['queuecallerleave']=!![];queues[_0x1b425c[_0x25f8('0x5')]][_0x25f8('0x18')]=utils[_0x25f8('0x14')]();queues[_0x1b425c['uniqueid']][_0x25f8('0x34')]=utils['diffTime'](queues[_0x1b425c['uniqueid']][_0x25f8('0x18')],queues[_0x1b425c[_0x25f8('0x5')]][_0x25f8('0x35')]);queues[_0x1b425c[_0x25f8('0x5')]][_0x25f8('0x13')]=_0x1b425c[_0x25f8('0x13')];queues[_0x1b425c[_0x25f8('0x5')]][_0x25f8('0x36')]=_0x1b425c[_0x25f8('0x36')];queues[_0x1b425c[_0x25f8('0x5')]][_0x25f8('0x32')]=_0x1b425c['connectedlinenum'];queues[_0x1b425c[_0x25f8('0x5')]][_0x25f8('0x33')]=_0x1b425c['connectedlinename'];}}catch(_0x21e3e8){utils[_0x25f8('0x15')](util['format']('[%s][queues][queuecallerleave]',_0x1b425c[_0x25f8('0x5')]),_0x21e3e8);}};exports[_0x25f8('0x37')]=function(_0x5d2cb8){try{if(!_[_0x25f8('0x17')](queues[_0x5d2cb8[_0x25f8('0x5')]])){utils[_0x25f8('0x23')](util[_0x25f8('0x4')](_0x25f8('0x38'),_0x5d2cb8[_0x25f8('0x5')]),_0x5d2cb8);utils['info'](util['format']('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x5d2cb8[_0x25f8('0x5')],queues[_0x5d2cb8[_0x25f8('0x5')]]['name'],_0x5d2cb8[_0x25f8('0x39')],_0x5d2cb8[_0x25f8('0x3a')]));queues[_0x5d2cb8['uniqueid']][_0x25f8('0x19')]=![];queues[_0x5d2cb8['uniqueid']]['queuecallerabandon']=![];queues[_0x5d2cb8['uniqueid']][_0x25f8('0x29')]=null;queues[_0x5d2cb8[_0x25f8('0x5')]][_0x25f8('0x1a')]=![];queues[_0x5d2cb8[_0x25f8('0x5')]][_0x25f8('0x1d')]=null;queues[_0x5d2cb8['uniqueid']]['queuecallerexitAt']=null;queues[_0x5d2cb8[_0x25f8('0x5')]][_0x25f8('0x3b')]=!![];queues[_0x5d2cb8[_0x25f8('0x5')]][_0x25f8('0x8')]=_0x5d2cb8[_0x25f8('0x3a')];queues[_0x5d2cb8[_0x25f8('0x5')]]['lastAssignedTo']=_0x5d2cb8[_0x25f8('0x39')];}}catch(_0xc06210){utils[_0x25f8('0x15')](util[_0x25f8('0x4')](_0x25f8('0x38'),_0x5d2cb8[_0x25f8('0x5')]),_0xc06210);}};exports['agentcomplete']=function(_0x53bfb8){try{if(!_[_0x25f8('0x17')](queues[_0x53bfb8[_0x25f8('0x5')]])){if(queues[_0x53bfb8['uniqueid']][_0x25f8('0x18')]){utils[_0x25f8('0x23')](util['format'](_0x25f8('0x3c'),_0x53bfb8[_0x25f8('0x5')]),_0x53bfb8);queues[_0x53bfb8[_0x25f8('0x5')]]['queuecallerabandon']=![];queues[_0x53bfb8[_0x25f8('0x5')]][_0x25f8('0x19')]=![];queues[_0x53bfb8[_0x25f8('0x5')]][_0x25f8('0x29')]=null;queues[_0x53bfb8['uniqueid']][_0x25f8('0x1a')]=![];queues[_0x53bfb8[_0x25f8('0x5')]][_0x25f8('0x2a')]=null;queues[_0x53bfb8['uniqueid']][_0x25f8('0x3b')]=!![];queues[_0x53bfb8[_0x25f8('0x5')]]['lastAssignedTo']=_0x53bfb8[_0x25f8('0x39')];queues[_0x53bfb8['uniqueid']]['queuecallercomplete']=!![];queues[_0x53bfb8[_0x25f8('0x5')]][_0x25f8('0x1c')]=utils[_0x25f8('0x14')]();if(_0x53bfb8[_0x25f8('0x3d')]==_0x25f8('0x3e')){if(!queues[_0x53bfb8[_0x25f8('0x5')]][_0x25f8('0x3e')]){queues[_0x53bfb8[_0x25f8('0x5')]]['queuecallerexitreason']=_0x25f8('0x3f');}}else{queues[_0x53bfb8[_0x25f8('0x5')]][_0x25f8('0x1d')]=_0x25f8('0x40')+_0x53bfb8[_0x25f8('0x3d')][_0x25f8('0x27')]();}utils[_0x25f8('0x3')](util[_0x25f8('0x4')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x53bfb8[_0x25f8('0x5')],queues[_0x53bfb8[_0x25f8('0x5')]]['name'],_0x53bfb8[_0x25f8('0x39')],queues[_0x53bfb8[_0x25f8('0x5')]][_0x25f8('0x1d')]));writeDB(queues[_0x53bfb8[_0x25f8('0x5')]]);}}}catch(_0x343385){utils[_0x25f8('0x15')](util[_0x25f8('0x4')](_0x25f8('0x3c'),_0x53bfb8[_0x25f8('0x5')]),_0x343385);}};exports[_0x25f8('0x41')]=function(_0x5c2291){try{if(!_[_0x25f8('0x17')](queues[_0x5c2291[_0x25f8('0x42')]])){utils[_0x25f8('0x23')](util['format'](_0x25f8('0x43'),_0x5c2291[_0x25f8('0x5')]),_0x5c2291);queues[_0x5c2291['transfereeuniqueid']]['transfer']=!![];queues[_0x5c2291[_0x25f8('0x42')]][_0x25f8('0x44')]=_0x25f8('0x45');queues[_0x5c2291[_0x25f8('0x42')]][_0x25f8('0x46')]=_0x5c2291[_0x25f8('0x47')];queues[_0x5c2291['transfereeuniqueid']][_0x25f8('0x48')]=_0x5c2291[_0x25f8('0x42')];queues[_0x5c2291[_0x25f8('0x42')]][_0x25f8('0x1d')]=_0x25f8('0x49');utils[_0x25f8('0x3')](util[_0x25f8('0x4')](_0x25f8('0x4a'),_0x5c2291[_0x25f8('0x5')],queues[_0x5c2291[_0x25f8('0x42')]][_0x25f8('0x1f')],_0x5c2291[_0x25f8('0x42')],_0x5c2291[_0x25f8('0x47')]));}}catch(_0x58b328){utils[_0x25f8('0x15')](util[_0x25f8('0x4')](_0x25f8('0x43'),_0x5c2291[_0x25f8('0x5')]),_0x58b328);}};exports[_0x25f8('0x4b')]=function(_0x4e6e57){try{utils['debug'](util[_0x25f8('0x4')](_0x25f8('0x4c'),_0x4e6e57['origtransfereruniqueid']),_0x4e6e57);if(_0x4e6e57['origtransfereruniqueid']==_0x4e6e57[_0x25f8('0x4d')]){if(!_[_0x25f8('0x17')](queues[_0x4e6e57[_0x25f8('0x4e')]])){utils['info'](util['format'](_0x25f8('0x4f'),_0x4e6e57[_0x25f8('0x50')],queues[_0x4e6e57[_0x25f8('0x4e')]]['name'],_0x4e6e57[_0x25f8('0x51')]));queues[_0x4e6e57[_0x25f8('0x4e')]]['transfer']=!![];queues[_0x4e6e57['secondtransfererlinkedid']]['transfertype']=_0x25f8('0x52');queues[_0x4e6e57[_0x25f8('0x4e')]][_0x25f8('0x46')]=_0x4e6e57[_0x25f8('0x51')];queues[_0x4e6e57[_0x25f8('0x4e')]]['transferuniqueid']=_0x4e6e57[_0x25f8('0x50')];queues[_0x4e6e57[_0x25f8('0x4e')]][_0x25f8('0x1d')]=_0x25f8('0x53');}if(!_[_0x25f8('0x17')](queues[_0x4e6e57[_0x25f8('0x4d')]])){if(_0x4e6e57[_0x25f8('0x54')]&&queues[_0x4e6e57[_0x25f8('0x54')]]){queues[_0x4e6e57[_0x25f8('0x54')]][_0x25f8('0x21')]=0x1;queues[_0x4e6e57['transfereeuniqueid']]=_[_0x25f8('0x55')](queues[_0x4e6e57[_0x25f8('0x54')]]);queues[_0x4e6e57[_0x25f8('0x42')]][_0x25f8('0xe')]=_0x4e6e57[_0x25f8('0x56')];queues[_0x4e6e57['transfereeuniqueid']][_0x25f8('0x21')]=0x2;queues[_0x4e6e57[_0x25f8('0x42')]]['calleridnum']=queues[_0x4e6e57['secondtransfererlinkedid']][_0x25f8('0x57')];queues[_0x4e6e57[_0x25f8('0x42')]][_0x25f8('0x58')]=queues[_0x4e6e57[_0x25f8('0x4e')]][_0x25f8('0x58')];queues[_0x4e6e57['transfereeuniqueid']][_0x25f8('0x35')]=utils['now']();queues[_0x4e6e57[_0x25f8('0x42')]]['queuecallerleaveAt']=utils[_0x25f8('0x14')]();queues[_0x4e6e57[_0x25f8('0x42')]][_0x25f8('0x34')]=0x0;queues[_0x4e6e57[_0x25f8('0x42')]]['mohtime']=0x0;utils[_0x25f8('0x3')](util[_0x25f8('0x4')](_0x25f8('0x59'),_0x4e6e57[_0x25f8('0x50')],queues[_0x4e6e57['transfereeuniqueid']][_0x25f8('0x1f')],queues[_0x4e6e57[_0x25f8('0x42')]][_0x25f8('0x57')],queues[_0x4e6e57[_0x25f8('0x42')]][_0x25f8('0x58')]));}else{utils['info'](util['format'](_0x25f8('0x5a'),_0x4e6e57[_0x25f8('0x50')],queues[_0x4e6e57[_0x25f8('0x4d')]][_0x25f8('0x1f')],_0x4e6e57[_0x25f8('0x4e')]));queues[_0x4e6e57[_0x25f8('0x4d')]][_0x25f8('0xe')]=_0x4e6e57[_0x25f8('0x4e')];}}}else if(_0x4e6e57[_0x25f8('0x5b')]==_0x4e6e57[_0x25f8('0x4e')]){if(!_[_0x25f8('0x17')](queues[_0x4e6e57[_0x25f8('0x4d')]])){utils[_0x25f8('0x3')](util['format'](_0x25f8('0x5c'),_0x4e6e57['origtransfereruniqueid'],queues[_0x4e6e57[_0x25f8('0x4d')]][_0x25f8('0x1f')],_0x4e6e57['secondtransfereruniqueid'],_0x4e6e57['secondtransfererexten']));queues[_0x4e6e57['origtransfererlinkedid']][_0x25f8('0x3e')]=!![];queues[_0x4e6e57[_0x25f8('0x4d')]]['transfertype']=_0x25f8('0x52');queues[_0x4e6e57[_0x25f8('0x4d')]][_0x25f8('0x46')]=_0x4e6e57[_0x25f8('0x5d')];queues[_0x4e6e57[_0x25f8('0x4d')]][_0x25f8('0x48')]=_0x4e6e57[_0x25f8('0x5b')];queues[_0x4e6e57[_0x25f8('0x4d')]][_0x25f8('0x1d')]=_0x25f8('0x53');}if(!_[_0x25f8('0x17')](queues[_0x4e6e57[_0x25f8('0x4e')]])){if(_0x4e6e57[_0x25f8('0x5e')]&&queues[_0x4e6e57[_0x25f8('0x5e')]]){queues[_0x4e6e57[_0x25f8('0x5e')]][_0x25f8('0x21')]=0x1;queues[_0x4e6e57[_0x25f8('0x56')]]=_[_0x25f8('0x55')](queues[_0x4e6e57[_0x25f8('0x5e')]]);queues[_0x4e6e57['transfertargetuniqueid']][_0x25f8('0xe')]=_0x4e6e57['transfertargetuniqueid'];queues[_0x4e6e57[_0x25f8('0x56')]][_0x25f8('0x21')]=0x2;queues[_0x4e6e57[_0x25f8('0x56')]][_0x25f8('0x57')]=queues[_0x4e6e57[_0x25f8('0x4d')]][_0x25f8('0x57')];queues[_0x4e6e57[_0x25f8('0x56')]][_0x25f8('0x58')]=queues[_0x4e6e57[_0x25f8('0x4d')]]['calleridname'];queues[_0x4e6e57[_0x25f8('0x56')]][_0x25f8('0x35')]=utils[_0x25f8('0x14')]();queues[_0x4e6e57['transfertargetuniqueid']][_0x25f8('0x18')]=utils[_0x25f8('0x14')]();queues[_0x4e6e57[_0x25f8('0x56')]]['holdtime']=0x0;queues[_0x4e6e57[_0x25f8('0x56')]]['mohtime']=0x0;utils[_0x25f8('0x3')](util[_0x25f8('0x4')](_0x25f8('0x5f'),_0x4e6e57[_0x25f8('0x50')],queues[_0x4e6e57['transfertargetuniqueid']]['name'],queues[_0x4e6e57[_0x25f8('0x56')]][_0x25f8('0xe')],queues[_0x4e6e57[_0x25f8('0x56')]]['calleridnum'],queues[_0x4e6e57[_0x25f8('0x56')]][_0x25f8('0x58')]));}else{utils[_0x25f8('0x3')](util[_0x25f8('0x4')](_0x25f8('0x5a'),_0x4e6e57[_0x25f8('0x50')],queues[_0x4e6e57[_0x25f8('0x4e')]]['name'],_0x4e6e57[_0x25f8('0x4d')]));queues[_0x4e6e57[_0x25f8('0x4e')]][_0x25f8('0xe')]=_0x4e6e57[_0x25f8('0x4d')];}}}}catch(_0x2a4f7e){utils[_0x25f8('0x15')](util[_0x25f8('0x4')]('[%s][queues][attendedtransfer]',_0x4e6e57[_0x25f8('0x50')]),_0x2a4f7e);}};exports[_0x25f8('0x60')]=function(_0x14ad5d){try{if(!_[_0x25f8('0x17')](queues[_0x14ad5d[_0x25f8('0x5')]])){utils[_0x25f8('0x23')](util['format'](_0x25f8('0x61'),_0x14ad5d[_0x25f8('0x5')]),_0x14ad5d);queues[_0x14ad5d['uniqueid']][_0x25f8('0x62')]=utils['now']();utils[_0x25f8('0x3')](util[_0x25f8('0x4')](_0x25f8('0x63'),_0x14ad5d['uniqueid'],queues[_0x14ad5d[_0x25f8('0x5')]][_0x25f8('0x1f')],queues[_0x14ad5d['uniqueid']][_0x25f8('0x62')]));}}catch(_0x1a30ba){utils[_0x25f8('0x15')](util[_0x25f8('0x4')]('[%s][queues][musiconholdstart]',_0x14ad5d[_0x25f8('0x5')]),_0x1a30ba);}};exports[_0x25f8('0x64')]=function(_0x146812){try{if(!_[_0x25f8('0x17')](queues[_0x146812['uniqueid']])){if(!_[_0x25f8('0x17')](queues[_0x146812[_0x25f8('0x5')]][_0x25f8('0x62')])){utils[_0x25f8('0x23')](util[_0x25f8('0x4')](_0x25f8('0x65'),_0x146812[_0x25f8('0x5')]),_0x146812);queues[_0x146812[_0x25f8('0x5')]][_0x25f8('0x66')]+=utils['diffTime'](utils['now'](),queues[_0x146812['uniqueid']]['musiconholdstartAt']);utils[_0x25f8('0x3')](util[_0x25f8('0x4')](_0x25f8('0x67'),_0x146812['uniqueid'],queues[_0x146812['uniqueid']]['name'],queues[_0x146812['uniqueid']][_0x25f8('0x66')]));delete queues[_0x146812['uniqueid']][_0x25f8('0x62')];}}}catch(_0x298e0e){utils[_0x25f8('0x15')](util[_0x25f8('0x4')](_0x25f8('0x65'),_0x146812[_0x25f8('0x5')]),_0x298e0e);}}; \ No newline at end of file +var _0x8501=['[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','./utils','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','queue','then','type','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','format','[%s][queues][queuecallerjoin]','position','assign','now','error','hangup','isNil','[%s][queues][hangup]','queuecallerexit','queuecallercomplete','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','[%s][queues][varset]','variable','queuestatus','value','CONTINUE','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt','toUpperCase','queueposition','EXITWITHKEY','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','queuecallerleave','holdtime','diffTime','queuecallerleaveAt','queuecallerjoinAt','count','connectedlinenum','agentconnect','[%s][queues][agentconnect]','membername','destaccountcode','assigned','agentcomplete','queuecallercompleteAt','reason','transfer','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','BLIND','transferexten','extension','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','transfertype','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','mohtime','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfererexten','secondtransfereruniqueid','transfertargetlinkedid','transfertargetuniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][musiconholdstart]','musiconholdstartAt'];(function(_0x394579,_0x144e6d){var _0x111e75=function(_0x29a77b){while(--_0x29a77b){_0x394579['push'](_0x394579['shift']());}};_0x111e75(++_0x144e6d);}(_0x8501,0x67));var _0x1850=function(_0x4bf5f2,_0x48040d){_0x4bf5f2=_0x4bf5f2-0x0;var _0x9d49ee=_0x8501[_0x4bf5f2];return _0x9d49ee;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x1850('0x0'));var queues={};function writeDB(_0x577171){utils[_0x1850('0x1')](util['format'](_0x1850('0x2'),_0x577171[_0x1850('0x3')],_0x577171['channel'],_0x577171['queue'],_0x577171[_0x1850('0x4')],_0x577171[_0x1850('0x5')],_0x577171[_0x1850('0x6')],_0x577171[_0x1850('0x7')]));if(_0x577171['queue']){utils[_0x1850('0x8')](_0x577171[_0x1850('0x9')])[_0x1850('0xa')](function(_0x2bfea2){if(_0x2bfea2){_0x577171[_0x1850('0xb')]=_0x2bfea2[_0x1850('0xb')];}utils['request'](_0x1850('0xc'),_0x577171);});}else{utils['request'](_0x1850('0xc'),_0x577171);}if(_0x577171[_0x1850('0xd')]){delete queues[_0x577171['transfereduniqueid']];}else{delete queues[_0x577171[_0x1850('0x3')]];}}exports[_0x1850('0xe')]=function(_0x8598f0){try{utils[_0x1850('0xf')](util[_0x1850('0x10')](_0x1850('0x11'),_0x8598f0[_0x1850('0x3')]),_0x8598f0);utils[_0x1850('0x1')](util['format']('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x8598f0[_0x1850('0x3')],_0x8598f0['queue'],_0x8598f0[_0x1850('0x12')]));queues[_0x8598f0['uniqueid']]=_[_0x1850('0x13')](_0x8598f0,{'originalposition':_0x8598f0['position'],'queuecallerjoinAt':utils[_0x1850('0x14')](),'mohtime':0x0});}catch(_0x26f149){utils[_0x1850('0x15')](util[_0x1850('0x10')](_0x1850('0x11'),_0x8598f0[_0x1850('0x3')]),_0x26f149);}};exports[_0x1850('0x16')]=function(_0x3501d5){try{if(!_[_0x1850('0x17')](queues[_0x3501d5[_0x1850('0x3')]])){utils[_0x1850('0xf')](util[_0x1850('0x10')](_0x1850('0x18'),_0x3501d5['uniqueid']),_0x3501d5);if(queues[_0x3501d5['uniqueid']]['queuecallerleaveAt']){if(!queues[_0x3501d5['uniqueid']]['queuecallerabandon']&&!queues[_0x3501d5[_0x1850('0x3')]][_0x1850('0x19')]){queues[_0x3501d5['uniqueid']][_0x1850('0x1a')]=!![];queues[_0x3501d5['uniqueid']]['queuecallercompleteAt']=utils[_0x1850('0x14')]();queues[_0x3501d5[_0x1850('0x3')]]['queuecallerexitreason']=_0x1850('0x1b');}utils[_0x1850('0x1')](util[_0x1850('0x10')](_0x1850('0x1c'),_0x3501d5[_0x1850('0x3')],queues[_0x3501d5[_0x1850('0x3')]][_0x1850('0x1d')],queues[_0x3501d5[_0x1850('0x3')]][_0x1850('0x7')]));writeDB(queues[_0x3501d5[_0x1850('0x3')]]);}else if(queues[_0x3501d5[_0x1850('0x3')]][_0x1850('0xd')]){utils[_0x1850('0x1')](util[_0x1850('0x10')](_0x1850('0x1e'),_0x3501d5[_0x1850('0x3')],queues[_0x3501d5[_0x1850('0x3')]][_0x1850('0x1d')],queues[_0x3501d5[_0x1850('0x3')]][_0x1850('0xd')]));queues[queues[_0x3501d5[_0x1850('0x3')]][_0x1850('0xd')]]=queues[_0x3501d5['uniqueid']];queues[queues[_0x3501d5[_0x1850('0x3')]][_0x1850('0xd')]][_0x1850('0x1f')]=0x2;delete queues[_0x3501d5[_0x1850('0x3')]];}}}catch(_0x4c2d02){utils[_0x1850('0x15')](util[_0x1850('0x10')](_0x1850('0x18'),_0x3501d5[_0x1850('0x3')]),_0x4c2d02);}};exports[_0x1850('0x20')]=function(_0x3137f9){try{utils[_0x1850('0xf')](util[_0x1850('0x10')](_0x1850('0x21'),_0x3137f9[_0x1850('0x3')]),_0x3137f9);if(!_[_0x1850('0x17')](_0x3137f9[_0x1850('0x22')][_0x1850('0x23')])&&_0x3137f9[_0x1850('0x24')]['toUpperCase']()!==_0x1850('0x25')){if(!_['isNil'](queues[_0x3137f9[_0x1850('0x3')]])){queues[_0x3137f9['uniqueid']][_0x1850('0x26')]=![];queues[_0x3137f9[_0x1850('0x3')]][_0x1850('0x27')]=null;queues[_0x3137f9[_0x1850('0x3')]]['queuecallerexit']=!![];queues[_0x3137f9[_0x1850('0x3')]][_0x1850('0x28')]=utils[_0x1850('0x14')]();queues[_0x3137f9[_0x1850('0x3')]][_0x1850('0x7')]=_0x3137f9[_0x1850('0x24')][_0x1850('0x29')]();utils['info'](util['format']('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x3137f9[_0x1850('0x3')],queues[_0x3137f9[_0x1850('0x3')]]['name'],_0x3137f9['value'],queues[_0x3137f9[_0x1850('0x3')]][_0x1850('0x7')]));writeDB(queues[_0x3137f9[_0x1850('0x3')]]);}}else if(!_[_0x1850('0x17')](_0x3137f9['variable'][_0x1850('0x2a')])){if(!_[_0x1850('0x17')](queues[_0x3137f9[_0x1850('0x3')]])&&!queues[_0x3137f9[_0x1850('0x3')]][_0x1850('0x26')]){queues[_0x3137f9[_0x1850('0x3')]][_0x1850('0x26')]=![];queues[_0x3137f9[_0x1850('0x3')]][_0x1850('0x27')]=null;queues[_0x3137f9[_0x1850('0x3')]][_0x1850('0x19')]=!![];queues[_0x3137f9[_0x1850('0x3')]][_0x1850('0x28')]=utils['now']();queues[_0x3137f9[_0x1850('0x3')]]['queuecallerexitreason']=_0x1850('0x2b');utils['info'](util[_0x1850('0x10')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x3137f9[_0x1850('0x3')],queues[_0x3137f9['uniqueid']][_0x1850('0x1d')],_0x3137f9[_0x1850('0x24')],queues[_0x3137f9[_0x1850('0x3')]][_0x1850('0x7')]));}}}catch(_0x263185){utils['error'](util[_0x1850('0x10')](_0x1850('0x21'),_0x3137f9[_0x1850('0x3')]),_0x263185);}};exports[_0x1850('0x26')]=function(_0x22c1ee){try{if(!_['isNil'](queues[_0x22c1ee[_0x1850('0x3')]])){utils[_0x1850('0xf')](util[_0x1850('0x10')](_0x1850('0x2c'),_0x22c1ee[_0x1850('0x3')]),_0x22c1ee);queues[_0x22c1ee[_0x1850('0x3')]]['queuecallerexit']=![];queues[_0x22c1ee[_0x1850('0x3')]][_0x1850('0x28')]=null;queues[_0x22c1ee[_0x1850('0x3')]][_0x1850('0x26')]=!![];queues[_0x22c1ee[_0x1850('0x3')]][_0x1850('0x27')]=utils['now']();queues[_0x22c1ee[_0x1850('0x3')]][_0x1850('0x7')]=_0x1850('0x2d');utils[_0x1850('0x1')](util['format'](_0x1850('0x2e'),_0x22c1ee[_0x1850('0x3')],queues[_0x22c1ee[_0x1850('0x3')]][_0x1850('0x1d')],queues[_0x22c1ee[_0x1850('0x3')]][_0x1850('0x7')]));}}catch(_0xf3af3e){utils[_0x1850('0x15')](util[_0x1850('0x10')](_0x1850('0x2c'),_0x22c1ee[_0x1850('0x3')]),_0xf3af3e);}};exports['queuecallerleave']=function(_0x175a9b){try{if(!_[_0x1850('0x17')](queues[_0x175a9b[_0x1850('0x3')]])){utils[_0x1850('0xf')](util[_0x1850('0x10')](_0x1850('0x2f'),_0x175a9b[_0x1850('0x3')]),_0x175a9b);utils[_0x1850('0x1')](util[_0x1850('0x10')](_0x1850('0x30'),_0x175a9b['uniqueid'],queues[_0x175a9b['uniqueid']]['name'],_0x175a9b['connectedlinenum'],_0x175a9b['connectedlinename']));queues[_0x175a9b[_0x1850('0x3')]][_0x1850('0x31')]=!![];queues[_0x175a9b['uniqueid']]['queuecallerleaveAt']=utils[_0x1850('0x14')]();queues[_0x175a9b[_0x1850('0x3')]][_0x1850('0x32')]=utils[_0x1850('0x33')](queues[_0x175a9b['uniqueid']][_0x1850('0x34')],queues[_0x175a9b['uniqueid']][_0x1850('0x35')]);queues[_0x175a9b[_0x1850('0x3')]]['position']=_0x175a9b[_0x1850('0x12')];queues[_0x175a9b[_0x1850('0x3')]][_0x1850('0x36')]=_0x175a9b['count'];queues[_0x175a9b[_0x1850('0x3')]][_0x1850('0x37')]=_0x175a9b[_0x1850('0x37')];queues[_0x175a9b[_0x1850('0x3')]]['connectedlinename']=_0x175a9b['connectedlinename'];}}catch(_0x4efc26){utils['error'](util[_0x1850('0x10')](_0x1850('0x2f'),_0x175a9b[_0x1850('0x3')]),_0x4efc26);}};exports[_0x1850('0x38')]=function(_0x5e7068){try{if(!_['isNil'](queues[_0x5e7068[_0x1850('0x3')]])){utils[_0x1850('0xf')](util[_0x1850('0x10')](_0x1850('0x39'),_0x5e7068[_0x1850('0x3')]),_0x5e7068);utils['info'](util[_0x1850('0x10')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x5e7068[_0x1850('0x3')],queues[_0x5e7068[_0x1850('0x3')]][_0x1850('0x1d')],_0x5e7068[_0x1850('0x3a')],_0x5e7068[_0x1850('0x3b')]));queues[_0x5e7068[_0x1850('0x3')]][_0x1850('0x26')]=![];queues[_0x5e7068[_0x1850('0x3')]][_0x1850('0x26')]=![];queues[_0x5e7068[_0x1850('0x3')]][_0x1850('0x27')]=null;queues[_0x5e7068[_0x1850('0x3')]][_0x1850('0x19')]=![];queues[_0x5e7068[_0x1850('0x3')]]['queuecallerexitreason']=null;queues[_0x5e7068['uniqueid']]['queuecallerexitAt']=null;queues[_0x5e7068[_0x1850('0x3')]][_0x1850('0x3c')]=!![];queues[_0x5e7068[_0x1850('0x3')]][_0x1850('0x6')]=_0x5e7068[_0x1850('0x3b')];queues[_0x5e7068[_0x1850('0x3')]][_0x1850('0x4')]=_0x5e7068[_0x1850('0x3a')];}}catch(_0xed16e8){utils[_0x1850('0x15')](util[_0x1850('0x10')]('[%s][queues][agentconnect]',_0x5e7068[_0x1850('0x3')]),_0xed16e8);}};exports[_0x1850('0x3d')]=function(_0x7194fe){try{if(!_['isNil'](queues[_0x7194fe[_0x1850('0x3')]])){if(queues[_0x7194fe['uniqueid']][_0x1850('0x34')]){utils['debug'](util[_0x1850('0x10')]('[%s][queues][agentcomplete]',_0x7194fe[_0x1850('0x3')]),_0x7194fe);queues[_0x7194fe[_0x1850('0x3')]][_0x1850('0x26')]=![];queues[_0x7194fe[_0x1850('0x3')]]['queuecallerabandon']=![];queues[_0x7194fe[_0x1850('0x3')]][_0x1850('0x27')]=null;queues[_0x7194fe[_0x1850('0x3')]][_0x1850('0x19')]=![];queues[_0x7194fe[_0x1850('0x3')]][_0x1850('0x28')]=null;queues[_0x7194fe[_0x1850('0x3')]][_0x1850('0x3c')]=!![];queues[_0x7194fe['uniqueid']][_0x1850('0x4')]=_0x7194fe[_0x1850('0x3a')];queues[_0x7194fe[_0x1850('0x3')]][_0x1850('0x1a')]=!![];queues[_0x7194fe['uniqueid']][_0x1850('0x3e')]=utils[_0x1850('0x14')]();if(_0x7194fe[_0x1850('0x3f')]==_0x1850('0x40')){if(!queues[_0x7194fe[_0x1850('0x3')]][_0x1850('0x40')]){queues[_0x7194fe[_0x1850('0x3')]][_0x1850('0x7')]='TRANSFER';}}else{queues[_0x7194fe['uniqueid']]['queuecallerexitreason']=_0x1850('0x41')+_0x7194fe['reason'][_0x1850('0x29')]();}utils[_0x1850('0x1')](util[_0x1850('0x10')](_0x1850('0x42'),_0x7194fe[_0x1850('0x3')],queues[_0x7194fe[_0x1850('0x3')]]['name'],_0x7194fe[_0x1850('0x3a')],queues[_0x7194fe[_0x1850('0x3')]][_0x1850('0x7')]));writeDB(queues[_0x7194fe[_0x1850('0x3')]]);}}}catch(_0x20546d){utils[_0x1850('0x15')](util[_0x1850('0x10')]('[%s][queues][agentcomplete]',_0x7194fe[_0x1850('0x3')]),_0x20546d);}};exports[_0x1850('0x43')]=function(_0x314f99){try{if(!_['isNil'](queues[_0x314f99[_0x1850('0x44')]])){utils[_0x1850('0xf')](util[_0x1850('0x10')](_0x1850('0x45'),_0x314f99['uniqueid']),_0x314f99);queues[_0x314f99[_0x1850('0x44')]]['transfer']=!![];queues[_0x314f99[_0x1850('0x44')]]['transfertype']=_0x1850('0x46');queues[_0x314f99[_0x1850('0x44')]][_0x1850('0x47')]=_0x314f99[_0x1850('0x48')];queues[_0x314f99[_0x1850('0x44')]][_0x1850('0x49')]=_0x314f99[_0x1850('0x44')];queues[_0x314f99[_0x1850('0x44')]][_0x1850('0x7')]='BLINDTRANSFER';utils[_0x1850('0x1')](util[_0x1850('0x10')](_0x1850('0x4a'),_0x314f99[_0x1850('0x3')],queues[_0x314f99[_0x1850('0x44')]][_0x1850('0x1d')],_0x314f99[_0x1850('0x44')],_0x314f99['extension']));}}catch(_0x3a038b){utils['error'](util[_0x1850('0x10')](_0x1850('0x45'),_0x314f99[_0x1850('0x3')]),_0x3a038b);}};exports[_0x1850('0x4b')]=function(_0x4a1b12){try{utils[_0x1850('0xf')](util[_0x1850('0x10')](_0x1850('0x4c'),_0x4a1b12[_0x1850('0x4d')]),_0x4a1b12);if(_0x4a1b12[_0x1850('0x4d')]==_0x4a1b12[_0x1850('0x4e')]){if(!_[_0x1850('0x17')](queues[_0x4a1b12[_0x1850('0x4f')]])){utils[_0x1850('0x1')](util[_0x1850('0x10')](_0x1850('0x50'),_0x4a1b12[_0x1850('0x4d')],queues[_0x4a1b12[_0x1850('0x4f')]][_0x1850('0x1d')],_0x4a1b12[_0x1850('0x51')]));queues[_0x4a1b12[_0x1850('0x4f')]][_0x1850('0x40')]=!![];queues[_0x4a1b12[_0x1850('0x4f')]][_0x1850('0x52')]=_0x1850('0x53');queues[_0x4a1b12[_0x1850('0x4f')]]['transferexten']=_0x4a1b12[_0x1850('0x51')];queues[_0x4a1b12['secondtransfererlinkedid']]['transferuniqueid']=_0x4a1b12[_0x1850('0x4d')];queues[_0x4a1b12[_0x1850('0x4f')]]['queuecallerexitreason']=_0x1850('0x54');}if(!_['isNil'](queues[_0x4a1b12[_0x1850('0x4e')]])){if(_0x4a1b12[_0x1850('0x55')]&&queues[_0x4a1b12[_0x1850('0x55')]]){queues[_0x4a1b12[_0x1850('0x55')]][_0x1850('0x1f')]=0x1;queues[_0x4a1b12[_0x1850('0x44')]]=_[_0x1850('0x56')](queues[_0x4a1b12[_0x1850('0x55')]]);queues[_0x4a1b12[_0x1850('0x44')]][_0x1850('0xd')]=_0x4a1b12['transfertargetuniqueid'];queues[_0x4a1b12[_0x1850('0x44')]][_0x1850('0x1f')]=0x2;queues[_0x4a1b12[_0x1850('0x44')]][_0x1850('0x5')]=queues[_0x4a1b12[_0x1850('0x4f')]]['calleridnum'];queues[_0x4a1b12[_0x1850('0x44')]]['calleridname']=queues[_0x4a1b12[_0x1850('0x4f')]]['calleridname'];queues[_0x4a1b12[_0x1850('0x44')]][_0x1850('0x35')]=utils[_0x1850('0x14')]();queues[_0x4a1b12[_0x1850('0x44')]][_0x1850('0x34')]=utils[_0x1850('0x14')]();queues[_0x4a1b12['transfereeuniqueid']][_0x1850('0x32')]=0x0;queues[_0x4a1b12[_0x1850('0x44')]][_0x1850('0x57')]=0x0;utils['info'](util[_0x1850('0x10')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x4a1b12[_0x1850('0x4d')],queues[_0x4a1b12['transfereeuniqueid']][_0x1850('0x1d')],queues[_0x4a1b12[_0x1850('0x44')]][_0x1850('0x5')],queues[_0x4a1b12[_0x1850('0x44')]][_0x1850('0x58')]));}else{utils['info'](util[_0x1850('0x10')](_0x1850('0x59'),_0x4a1b12[_0x1850('0x4d')],queues[_0x4a1b12['origtransfererlinkedid']][_0x1850('0x1d')],_0x4a1b12[_0x1850('0x4f')]));queues[_0x4a1b12['origtransfererlinkedid']]['transfereduniqueid']=_0x4a1b12['secondtransfererlinkedid'];}}}else if(_0x4a1b12['secondtransfereruniqueid']==_0x4a1b12[_0x1850('0x4f')]){if(!_['isNil'](queues[_0x4a1b12[_0x1850('0x4e')]])){utils[_0x1850('0x1')](util[_0x1850('0x10')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x4a1b12[_0x1850('0x4d')],queues[_0x4a1b12[_0x1850('0x4e')]]['name'],_0x4a1b12['secondtransfereruniqueid'],_0x4a1b12[_0x1850('0x5a')]));queues[_0x4a1b12[_0x1850('0x4e')]][_0x1850('0x40')]=!![];queues[_0x4a1b12[_0x1850('0x4e')]][_0x1850('0x52')]='ATTENDED';queues[_0x4a1b12[_0x1850('0x4e')]][_0x1850('0x47')]=_0x4a1b12[_0x1850('0x5a')];queues[_0x4a1b12[_0x1850('0x4e')]][_0x1850('0x49')]=_0x4a1b12[_0x1850('0x5b')];queues[_0x4a1b12['origtransfererlinkedid']]['queuecallerexitreason']=_0x1850('0x54');}if(!_[_0x1850('0x17')](queues[_0x4a1b12[_0x1850('0x4f')]])){if(_0x4a1b12[_0x1850('0x5c')]&&queues[_0x4a1b12[_0x1850('0x5c')]]){queues[_0x4a1b12[_0x1850('0x5c')]]['queuecallerenterreason']=0x1;queues[_0x4a1b12[_0x1850('0x5d')]]=_[_0x1850('0x56')](queues[_0x4a1b12[_0x1850('0x5c')]]);queues[_0x4a1b12[_0x1850('0x5d')]][_0x1850('0xd')]=_0x4a1b12['transfertargetuniqueid'];queues[_0x4a1b12[_0x1850('0x5d')]]['queuecallerenterreason']=0x2;queues[_0x4a1b12['transfertargetuniqueid']]['calleridnum']=queues[_0x4a1b12[_0x1850('0x4e')]][_0x1850('0x5')];queues[_0x4a1b12[_0x1850('0x5d')]][_0x1850('0x58')]=queues[_0x4a1b12[_0x1850('0x4e')]]['calleridname'];queues[_0x4a1b12[_0x1850('0x5d')]][_0x1850('0x35')]=utils[_0x1850('0x14')]();queues[_0x4a1b12[_0x1850('0x5d')]][_0x1850('0x34')]=utils[_0x1850('0x14')]();queues[_0x4a1b12[_0x1850('0x5d')]][_0x1850('0x32')]=0x0;queues[_0x4a1b12['transfertargetuniqueid']][_0x1850('0x57')]=0x0;utils[_0x1850('0x1')](util['format'](_0x1850('0x5e'),_0x4a1b12[_0x1850('0x4d')],queues[_0x4a1b12[_0x1850('0x5d')]]['name'],queues[_0x4a1b12[_0x1850('0x5d')]][_0x1850('0xd')],queues[_0x4a1b12[_0x1850('0x5d')]]['calleridnum'],queues[_0x4a1b12['transfertargetuniqueid']][_0x1850('0x58')]));}else{utils['info'](util[_0x1850('0x10')](_0x1850('0x59'),_0x4a1b12[_0x1850('0x4d')],queues[_0x4a1b12[_0x1850('0x4f')]][_0x1850('0x1d')],_0x4a1b12[_0x1850('0x4e')]));queues[_0x4a1b12[_0x1850('0x4f')]][_0x1850('0xd')]=_0x4a1b12[_0x1850('0x4e')];}}}}catch(_0x4cc67e){utils[_0x1850('0x15')](util['format'](_0x1850('0x4c'),_0x4a1b12[_0x1850('0x4d')]),_0x4cc67e);}};exports['musiconholdstart']=function(_0x5baf01){try{if(!_[_0x1850('0x17')](queues[_0x5baf01[_0x1850('0x3')]])){utils['debug'](util['format'](_0x1850('0x5f'),_0x5baf01[_0x1850('0x3')]),_0x5baf01);queues[_0x5baf01['uniqueid']][_0x1850('0x60')]=utils['now']();utils[_0x1850('0x1')](util[_0x1850('0x10')](_0x1850('0x61'),_0x5baf01[_0x1850('0x3')],queues[_0x5baf01[_0x1850('0x3')]][_0x1850('0x1d')],queues[_0x5baf01[_0x1850('0x3')]][_0x1850('0x60')]));}}catch(_0xd185d1){utils['error'](util[_0x1850('0x10')]('[%s][queues][musiconholdstart]',_0x5baf01[_0x1850('0x3')]),_0xd185d1);}};exports[_0x1850('0x62')]=function(_0x54cae3){try{if(!_[_0x1850('0x17')](queues[_0x54cae3['uniqueid']])){if(!_[_0x1850('0x17')](queues[_0x54cae3[_0x1850('0x3')]]['musiconholdstartAt'])){utils[_0x1850('0xf')](util['format'](_0x1850('0x63'),_0x54cae3[_0x1850('0x3')]),_0x54cae3);queues[_0x54cae3[_0x1850('0x3')]][_0x1850('0x57')]+=utils[_0x1850('0x33')](utils[_0x1850('0x14')](),queues[_0x54cae3[_0x1850('0x3')]][_0x1850('0x60')]);utils[_0x1850('0x1')](util[_0x1850('0x10')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x54cae3[_0x1850('0x3')],queues[_0x54cae3[_0x1850('0x3')]][_0x1850('0x1d')],queues[_0x54cae3[_0x1850('0x3')]][_0x1850('0x57')]));delete queues[_0x54cae3[_0x1850('0x3')]][_0x1850('0x60')];}}}catch(_0x2077f3){utils[_0x1850('0x15')](util[_0x1850('0x10')](_0x1850('0x63'),_0x54cae3[_0x1850('0x3')]),_0x2077f3);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 195a4a8..4de8fe5 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 _0xbd9f=['newexten','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','substring','lastIndexOf','[%s][recordings][newexten]','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','lodash','util','./utils','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','then','membername','name','request','CreateVoiceRecording','debug','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','error','[%s][recordings][newchannel]','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channelstate','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','channel','[%s][recordings][newstate]','varset','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','find','monitors','push','[%s][recordings][varset]','hangup','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','clone','[%s][recordings][hangup]'];(function(_0x3c9f77,_0x37b29d){var _0x476324=function(_0x291aa0){while(--_0x291aa0){_0x3c9f77['push'](_0x3c9f77['shift']());}};_0x476324(++_0x37b29d);}(_0xbd9f,0x87));var _0xfbd9=function(_0x364689,_0x1e2121){_0x364689=_0x364689-0x0;var _0x340ad2=_0xbd9f[_0x364689];return _0x340ad2;};'use strict';var _=require(_0xfbd9('0x0'));var util=require(_0xfbd9('0x1'));var utils=require(_0xfbd9('0x2'));var recordings={};function writeDB(_0x52354f){utils[_0xfbd9('0x3')](util[_0xfbd9('0x4')](_0xfbd9('0x5'),_0x52354f[_0xfbd9('0x6')]));if(_0x52354f[_0xfbd9('0x7')]){utils[_0xfbd9('0x8')](_0x52354f[_0xfbd9('0x7')])[_0xfbd9('0x9')](function(_0x1d8723){if(_0x1d8723){_0x52354f[_0xfbd9('0xa')]=_0x1d8723[_0xfbd9('0xb')];_0x52354f['UserId']=_0x1d8723['id'];}utils[_0xfbd9('0xc')](_0xfbd9('0xd'),_0x52354f);});}else{utils['request'](_0xfbd9('0xd'),_0x52354f);}}exports['newchannel']=function(_0x15ddcd){try{utils[_0xfbd9('0xe')](util[_0xfbd9('0x4')]('[%s][recordings][newchannel]',_0x15ddcd['uniqueid']),_0x15ddcd);if(_0x15ddcd[_0xfbd9('0x6')]==_0x15ddcd[_0xfbd9('0xf')]){utils['info'](util[_0xfbd9('0x4')](_0xfbd9('0x10'),_0x15ddcd['uniqueid'],_0x15ddcd[_0xfbd9('0x11')],_0x15ddcd[_0xfbd9('0x12')]));recordings[_0x15ddcd['uniqueid']]={'uniqueid':_0x15ddcd[_0xfbd9('0x6')],'accountcode':_0x15ddcd[_0xfbd9('0x7')],'exten':_0x15ddcd[_0xfbd9('0x12')],'context':_0x15ddcd[_0xfbd9('0x11')],'channel':_0x15ddcd['channel'],'monitors':[]};}}catch(_0x282f57){utils[_0xfbd9('0x13')](util['format'](_0xfbd9('0x14'),_0x15ddcd[_0xfbd9('0x6')]),_0x282f57);}};exports['newstate']=function(_0x1061e5){try{utils['debug'](util['format']('[%s][recordings][newstate]',_0x1061e5['uniqueid']),_0x1061e5);if(!_[_0xfbd9('0x15')](recordings[_0x1061e5[_0xfbd9('0x6')]])&&_0x1061e5['channelstate']==0x6){utils[_0xfbd9('0x3')](util[_0xfbd9('0x4')](_0xfbd9('0x16'),_0x1061e5[_0xfbd9('0x6')],_0x1061e5[_0xfbd9('0x11')],_0x1061e5['channel']));}else if(!_[_0xfbd9('0x15')](recordings[_0x1061e5[_0xfbd9('0xf')]])&&_0x1061e5[_0xfbd9('0x17')]==0x6&&_0x1061e5[_0xfbd9('0x11')]!='transfer'){utils[_0xfbd9('0x3')](util[_0xfbd9('0x4')](_0xfbd9('0x18'),_0x1061e5['uniqueid'],_0x1061e5[_0xfbd9('0xf')],_0x1061e5[_0xfbd9('0x11')],_0x1061e5[_0xfbd9('0x19')]));recordings[_0x1061e5[_0xfbd9('0xf')]]['accountcode']=_0x1061e5[_0xfbd9('0x7')];}}catch(_0x11cf68){utils[_0xfbd9('0x13')](util[_0xfbd9('0x4')](_0xfbd9('0x1a'),_0x1061e5['uniqueid']),_0x11cf68);}};exports[_0xfbd9('0x1b')]=function(_0x48b4c8){try{if(!_[_0xfbd9('0x15')](_0x48b4c8[_0xfbd9('0x1c')])&&!_[_0xfbd9('0x15')](_0x48b4c8['variable'][_0xfbd9('0x1d')])){utils[_0xfbd9('0xe')](util['format']('[%s][recordings][varset]',_0x48b4c8['uniqueid']),_0x48b4c8);utils[_0xfbd9('0x3')](util[_0xfbd9('0x4')](_0xfbd9('0x1e'),_0x48b4c8[_0xfbd9('0x6')],_0x48b4c8[_0xfbd9('0x1c')],_0x48b4c8[_0xfbd9('0x1f')]));if(_[_0xfbd9('0x20')](_0x48b4c8[_0xfbd9('0x1f')],_0xfbd9('0x21'))){_0x48b4c8['value']=_0x48b4c8[_0xfbd9('0x1f')][_0xfbd9('0x22')](_0xfbd9('0x21'),_0xfbd9('0x23'));}if(recordings[_0x48b4c8[_0xfbd9('0xf')]]){var _0x2b3841=_[_0xfbd9('0x24')](recordings[_0x48b4c8['linkedid']][_0xfbd9('0x25')],{'value':_0x48b4c8[_0xfbd9('0x1f')]});if(_[_0xfbd9('0x15')](_0x2b3841)){recordings[_0x48b4c8[_0xfbd9('0xf')]][_0xfbd9('0x25')][_0xfbd9('0x26')]({'value':_0x48b4c8[_0xfbd9('0x1f')]});}}}}catch(_0x452e19){utils[_0xfbd9('0x13')](util['format'](_0xfbd9('0x27'),_0x48b4c8[_0xfbd9('0x6')]),_0x452e19);}};exports[_0xfbd9('0x28')]=function(_0x1d3e1b){try{if(!_[_0xfbd9('0x15')](recordings[_0x1d3e1b['uniqueid']])){utils[_0xfbd9('0xe')](util[_0xfbd9('0x4')]('[%s][recordings][hangup]',_0x1d3e1b[_0xfbd9('0x6')]),_0x1d3e1b);utils['info'](util[_0xfbd9('0x4')](_0xfbd9('0x29'),_0x1d3e1b['uniqueid'],_0x1d3e1b[_0xfbd9('0x2a')],_0x1d3e1b[_0xfbd9('0x2b')],_0x1d3e1b[_0xfbd9('0x2c')]));recordings[_0x1d3e1b['uniqueid']]['calleridnum']=_0x1d3e1b[_0xfbd9('0x2a')];recordings[_0x1d3e1b[_0xfbd9('0x6')]][_0xfbd9('0x2b')]=_0x1d3e1b['calleridname'];recordings[_0x1d3e1b[_0xfbd9('0x6')]][_0xfbd9('0x2d')]=_0x1d3e1b['connectedlinenum'];recordings[_0x1d3e1b[_0xfbd9('0x6')]][_0xfbd9('0x2e')]=_0x1d3e1b[_0xfbd9('0x2e')];if(recordings[_0x1d3e1b['uniqueid']][_0xfbd9('0x2f')]==_0xfbd9('0x30')&&recordings[_0x1d3e1b[_0xfbd9('0x6')]]['accountcode']){recordings[_0x1d3e1b['uniqueid']][_0xfbd9('0x2d')]=recordings[_0x1d3e1b[_0xfbd9('0x6')]]['accountcode'];recordings[_0x1d3e1b['uniqueid']][_0xfbd9('0x2e')]='';}recordings[_0x1d3e1b[_0xfbd9('0x6')]]['monitors']['forEach'](function(_0x54a348){var _0x55cf82=_[_0xfbd9('0x31')](recordings[_0x1d3e1b[_0xfbd9('0x6')]]);_0x55cf82[_0xfbd9('0x1f')]=_0x54a348[_0xfbd9('0x1f')];writeDB(_0x55cf82);});delete recordings[_0x1d3e1b[_0xfbd9('0x6')]];}}catch(_0x2393eb){utils['error'](util[_0xfbd9('0x4')](_0xfbd9('0x32'),_0x1d3e1b[_0xfbd9('0x6')]),_0x2393eb);}};exports[_0xfbd9('0x33')]=function(_0x147492){try{if(!_['isNil'](recordings[_0x147492[_0xfbd9('0x6')]])){utils[_0xfbd9('0xe')](util['format']('[%s][recordings][newexten]',_0x147492[_0xfbd9('0x6')]),_0x147492);utils['info'](util[_0xfbd9('0x4')](_0xfbd9('0x34'),_0x147492['uniqueid'],_0x147492[_0xfbd9('0x35')],_0x147492[_0xfbd9('0x36')]));if(_0x147492[_0xfbd9('0x35')][_0xfbd9('0x37')]()=='set'&&_[_0xfbd9('0x38')](_0x147492[_0xfbd9('0x36')][_0xfbd9('0x37')](),'cdr')){var _0x80a52=_0x147492['appdata']['split']('=');var _0x2aaaa1=_0x80a52[0x0][_0xfbd9('0x39')](_0x80a52[0x0][_0xfbd9('0x3a')]('(')+0x1,_0x80a52[0x0][_0xfbd9('0x3a')](')'));var _0x526148=_0x80a52[0x1];recordings[_0x147492['uniqueid']][_0x2aaaa1]=_0x526148;}}}catch(_0x37eaf1){utils['error'](util[_0xfbd9('0x4')](_0xfbd9('0x3b'),_0x147492[_0xfbd9('0x6')]),_0x37eaf1);}};exports['queuecallerjoin']=function(_0x2b00a0){try{if(!_[_0xfbd9('0x15')](recordings[_0x2b00a0[_0xfbd9('0x6')]])){utils[_0xfbd9('0xe')](util[_0xfbd9('0x4')](_0xfbd9('0x3c'),_0x2b00a0[_0xfbd9('0x6')]),_0x2b00a0);utils[_0xfbd9('0x3')](util[_0xfbd9('0x4')](_0xfbd9('0x3d'),_0x2b00a0[_0xfbd9('0x6')],_0x2b00a0['queue']));recordings[_0x2b00a0['uniqueid']]['queue']=_0x2b00a0['queue'];}}catch(_0x4973de){utils[_0xfbd9('0x13')](util['format'](_0xfbd9('0x3c'),_0x2b00a0['uniqueid']),_0x4973de);}}; \ No newline at end of file +var _0x2f60=['context','exten','channel','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','linkedid','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','error','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','replace','.wav49','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','queue','lodash','info','format','accountcode','membername','name','CreateVoiceRecording','request','debug','[%s][recordings][newchannel]','uniqueid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s'];(function(_0x20aae1,_0x51efd4){var _0x510601=function(_0x20895f){while(--_0x20895f){_0x20aae1['push'](_0x20aae1['shift']());}};_0x510601(++_0x51efd4);}(_0x2f60,0xab));var _0x02f6=function(_0x2e2ddc,_0x4ae655){_0x2e2ddc=_0x2e2ddc-0x0;var _0x41ea93=_0x2f60[_0x2e2ddc];return _0x41ea93;};'use strict';var _=require(_0x02f6('0x0'));var util=require('util');var utils=require('./utils');var recordings={};function writeDB(_0x2e025a){utils[_0x02f6('0x1')](util[_0x02f6('0x2')]('[%s][recordings][writeDB]',_0x2e025a['uniqueid']));if(_0x2e025a[_0x02f6('0x3')]){utils['getUserByInternal'](_0x2e025a[_0x02f6('0x3')])['then'](function(_0x32aa31){if(_0x32aa31){_0x2e025a[_0x02f6('0x4')]=_0x32aa31[_0x02f6('0x5')];_0x2e025a['UserId']=_0x32aa31['id'];}utils['request'](_0x02f6('0x6'),_0x2e025a);});}else{utils[_0x02f6('0x7')](_0x02f6('0x6'),_0x2e025a);}}exports['newchannel']=function(_0x1252ec){try{utils[_0x02f6('0x8')](util[_0x02f6('0x2')](_0x02f6('0x9'),_0x1252ec[_0x02f6('0xa')]),_0x1252ec);if(_0x1252ec[_0x02f6('0xa')]==_0x1252ec['linkedid']){utils[_0x02f6('0x1')](util[_0x02f6('0x2')](_0x02f6('0xb'),_0x1252ec[_0x02f6('0xa')],_0x1252ec[_0x02f6('0xc')],_0x1252ec['exten']));recordings[_0x1252ec[_0x02f6('0xa')]]={'uniqueid':_0x1252ec[_0x02f6('0xa')],'accountcode':_0x1252ec[_0x02f6('0x3')],'exten':_0x1252ec[_0x02f6('0xd')],'context':_0x1252ec['context'],'channel':_0x1252ec[_0x02f6('0xe')],'monitors':[]};}}catch(_0x9d98af){utils['error'](util['format'](_0x02f6('0x9'),_0x1252ec[_0x02f6('0xa')]),_0x9d98af);}};exports[_0x02f6('0xf')]=function(_0x549aee){try{utils[_0x02f6('0x8')](util['format'](_0x02f6('0x10'),_0x549aee['uniqueid']),_0x549aee);if(!_[_0x02f6('0x11')](recordings[_0x549aee['uniqueid']])&&_0x549aee[_0x02f6('0x12')]==0x6){utils[_0x02f6('0x1')](util[_0x02f6('0x2')](_0x02f6('0x13'),_0x549aee[_0x02f6('0xa')],_0x549aee[_0x02f6('0xc')],_0x549aee[_0x02f6('0xe')]));}else if(!_['isNil'](recordings[_0x549aee[_0x02f6('0x14')]])&&_0x549aee[_0x02f6('0x12')]==0x6&&_0x549aee[_0x02f6('0xc')]!=_0x02f6('0x15')){utils[_0x02f6('0x1')](util[_0x02f6('0x2')](_0x02f6('0x16'),_0x549aee[_0x02f6('0xa')],_0x549aee['linkedid'],_0x549aee[_0x02f6('0xc')],_0x549aee['channel']));recordings[_0x549aee[_0x02f6('0x14')]][_0x02f6('0x3')]=_0x549aee[_0x02f6('0x3')];}}catch(_0x4df489){utils[_0x02f6('0x17')](util[_0x02f6('0x2')](_0x02f6('0x10'),_0x549aee[_0x02f6('0xa')]),_0x4df489);}};exports['varset']=function(_0x33d35b){try{if(!_[_0x02f6('0x11')](_0x33d35b['variable'])&&!_[_0x02f6('0x11')](_0x33d35b[_0x02f6('0x18')][_0x02f6('0x19')])){utils[_0x02f6('0x8')](util[_0x02f6('0x2')](_0x02f6('0x1a'),_0x33d35b[_0x02f6('0xa')]),_0x33d35b);utils[_0x02f6('0x1')](util[_0x02f6('0x2')](_0x02f6('0x1b'),_0x33d35b[_0x02f6('0xa')],_0x33d35b[_0x02f6('0x18')],_0x33d35b['value']));if(_['endsWith'](_0x33d35b['value'],'.wav49')){_0x33d35b[_0x02f6('0x1c')]=_0x33d35b[_0x02f6('0x1c')][_0x02f6('0x1d')](_0x02f6('0x1e'),_0x02f6('0x1f'));}if(recordings[_0x33d35b[_0x02f6('0x14')]]){var _0x1ef92b=_[_0x02f6('0x20')](recordings[_0x33d35b[_0x02f6('0x14')]]['monitors'],{'value':_0x33d35b[_0x02f6('0x1c')]});if(_[_0x02f6('0x11')](_0x1ef92b)){recordings[_0x33d35b[_0x02f6('0x14')]][_0x02f6('0x21')][_0x02f6('0x22')]({'value':_0x33d35b[_0x02f6('0x1c')]});}}}}catch(_0x44bc60){utils[_0x02f6('0x17')](util[_0x02f6('0x2')]('[%s][recordings][varset]',_0x33d35b[_0x02f6('0xa')]),_0x44bc60);}};exports[_0x02f6('0x23')]=function(_0x303e5a){try{if(!_[_0x02f6('0x11')](recordings[_0x303e5a[_0x02f6('0xa')]])){utils[_0x02f6('0x8')](util[_0x02f6('0x2')](_0x02f6('0x24'),_0x303e5a[_0x02f6('0xa')]),_0x303e5a);utils[_0x02f6('0x1')](util[_0x02f6('0x2')](_0x02f6('0x25'),_0x303e5a['uniqueid'],_0x303e5a[_0x02f6('0x26')],_0x303e5a[_0x02f6('0x27')],_0x303e5a[_0x02f6('0x28')]));recordings[_0x303e5a['uniqueid']]['calleridnum']=_0x303e5a['calleridnum'];recordings[_0x303e5a[_0x02f6('0xa')]][_0x02f6('0x27')]=_0x303e5a['calleridname'];recordings[_0x303e5a['uniqueid']][_0x02f6('0x29')]=_0x303e5a[_0x02f6('0x29')];recordings[_0x303e5a[_0x02f6('0xa')]][_0x02f6('0x2a')]=_0x303e5a[_0x02f6('0x2a')];if(recordings[_0x303e5a[_0x02f6('0xa')]][_0x02f6('0x2b')]==_0x02f6('0x2c')&&recordings[_0x303e5a[_0x02f6('0xa')]][_0x02f6('0x3')]){recordings[_0x303e5a['uniqueid']][_0x02f6('0x29')]=recordings[_0x303e5a[_0x02f6('0xa')]][_0x02f6('0x3')];recordings[_0x303e5a['uniqueid']][_0x02f6('0x2a')]='';}recordings[_0x303e5a[_0x02f6('0xa')]][_0x02f6('0x21')][_0x02f6('0x2d')](function(_0x227b0d){var _0x3f592a=_[_0x02f6('0x2e')](recordings[_0x303e5a[_0x02f6('0xa')]]);_0x3f592a['value']=_0x227b0d[_0x02f6('0x1c')];writeDB(_0x3f592a);});delete recordings[_0x303e5a[_0x02f6('0xa')]];}}catch(_0x25511a){utils[_0x02f6('0x17')](util['format'](_0x02f6('0x24'),_0x303e5a[_0x02f6('0xa')]),_0x25511a);}};exports[_0x02f6('0x2f')]=function(_0x2dff17){try{if(!_[_0x02f6('0x11')](recordings[_0x2dff17[_0x02f6('0xa')]])){utils[_0x02f6('0x8')](util[_0x02f6('0x2')](_0x02f6('0x30'),_0x2dff17[_0x02f6('0xa')]),_0x2dff17);utils[_0x02f6('0x1')](util['format'](_0x02f6('0x31'),_0x2dff17[_0x02f6('0xa')],_0x2dff17[_0x02f6('0x32')],_0x2dff17[_0x02f6('0x33')]));if(_0x2dff17[_0x02f6('0x32')][_0x02f6('0x34')]()=='set'&&_[_0x02f6('0x35')](_0x2dff17[_0x02f6('0x33')][_0x02f6('0x34')](),_0x02f6('0x36'))){var _0x53275c=_0x2dff17[_0x02f6('0x33')][_0x02f6('0x37')]('=');var _0x1a46f8=_0x53275c[0x0][_0x02f6('0x38')](_0x53275c[0x0][_0x02f6('0x39')]('(')+0x1,_0x53275c[0x0]['lastIndexOf'](')'));var _0x50e236=_0x53275c[0x1];recordings[_0x2dff17[_0x02f6('0xa')]][_0x1a46f8]=_0x50e236;}}}catch(_0x4bde8c){utils[_0x02f6('0x17')](util[_0x02f6('0x2')]('[%s][recordings][newexten]',_0x2dff17['uniqueid']),_0x4bde8c);}};exports[_0x02f6('0x3a')]=function(_0x15ad98){try{if(!_['isNil'](recordings[_0x15ad98[_0x02f6('0xa')]])){utils[_0x02f6('0x8')](util['format'](_0x02f6('0x3b'),_0x15ad98[_0x02f6('0xa')]),_0x15ad98);utils[_0x02f6('0x1')](util[_0x02f6('0x2')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x15ad98[_0x02f6('0xa')],_0x15ad98['queue']));recordings[_0x15ad98[_0x02f6('0xa')]][_0x02f6('0x3c')]=_0x15ad98[_0x02f6('0x3c')];}}catch(_0x85cf94){utils[_0x02f6('0x17')](util[_0x02f6('0x2')](_0x02f6('0x3b'),_0x15ad98[_0x02f6('0xa')]),_0x85cf94);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index ec17d5c..8a8004d 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 _0x007f=['debug','[%s][transfers][blindtransfer]','uniqueid','transferercalleridnum','transfereecalleridnum','transfereecalleridname','blind','error','attendedtransfer','origtransfereruniqueid','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','attended','type','request','CreateVoiceTransferReport','blinds','blindtransfer'];(function(_0x529c2d,_0x27d5d6){var _0x483c4f=function(_0x872448){while(--_0x872448){_0x529c2d['push'](_0x529c2d['shift']());}};_0x483c4f(++_0x27d5d6);}(_0x007f,0x113));var _0xf007=function(_0x443547,_0x21d7a8){_0x443547=_0x443547-0x0;var _0x1423a8=_0x007f[_0x443547];return _0x1423a8;};'use strict';var _=require(_0xf007('0x0'));var util=require(_0xf007('0x1'));var utils=require(_0xf007('0x2'));function writeDB(_0x5f3b58){utils[_0xf007('0x3')](util[_0xf007('0x4')](_0xf007('0x5'),_0x5f3b58['type']===_0xf007('0x6')?_0x5f3b58['origtransfereruniqueid']:_0x5f3b58['uniqueid'],_0x5f3b58[_0xf007('0x7')]));utils[_0xf007('0x8')](_0xf007('0x9'),_0x5f3b58);}exports[_0xf007('0xa')]={};exports[_0xf007('0xb')]=function(_0x40ff80){try{utils[_0xf007('0xc')](util[_0xf007('0x4')](_0xf007('0xd'),_0x40ff80[_0xf007('0xe')]),_0x40ff80);utils['info'](util[_0xf007('0x4')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x40ff80[_0xf007('0xe')],_0x40ff80[_0xf007('0xf')],_0x40ff80['transferercalleridname'],_0x40ff80[_0xf007('0x10')],_0x40ff80[_0xf007('0x11')]));_0x40ff80[_0xf007('0x7')]=_0xf007('0x12');exports[_0xf007('0xa')][_0x40ff80['transfereruniqueid']]=_0x40ff80;writeDB(_0x40ff80);}catch(_0x4850ff){utils[_0xf007('0x13')](util[_0xf007('0x4')]('[%s][transfers][blindtransfer]',_0x40ff80[_0xf007('0xe')]),_0x4850ff);}};exports[_0xf007('0x14')]=function(_0x38d649){try{utils[_0xf007('0xc')](util['format']('[%s][transfers][attendedtransfer]',_0x38d649[_0xf007('0x15')]),_0x38d649);utils[_0xf007('0x3')](util[_0xf007('0x4')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x38d649[_0xf007('0x15')],_0x38d649[_0xf007('0x16')],_0x38d649[_0xf007('0x17')],_0x38d649[_0xf007('0x18')],_0x38d649['transfertargetcalleridname']));_0x38d649=_[_0xf007('0x19')](_0x38d649,{'transfererchannel':_0x38d649[_0xf007('0x1a')],'transferercalleridnum':_0x38d649[_0xf007('0x16')],'transferercalleridname':_0x38d649[_0xf007('0x17')],'transfererconnectedlinenum':_0x38d649[_0xf007('0x1b')],'transfererconnectedlinename':_0x38d649[_0xf007('0x1c')],'transfereraccountcode':_0x38d649[_0xf007('0x1d')],'transferercontext':_0x38d649[_0xf007('0x1e')],'transfererexten':_0x38d649[_0xf007('0x1f')],'transfererlinkedid':_0x38d649[_0xf007('0x20')],'context':_0x38d649[_0xf007('0x21')],'extension':_0x38d649[_0xf007('0x22')],'type':_0xf007('0x6')});if(_[_0xf007('0x23')](_0x38d649['transfereechannel'])){_0x38d649=_[_0xf007('0x19')](_0x38d649,{'transfereechannel':_0x38d649[_0xf007('0x24')],'transfereecalleridnum':_0x38d649[_0xf007('0x18')],'transfereecalleridname':_0x38d649['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x38d649[_0xf007('0x25')],'transfereeconnectedlinename':_0x38d649[_0xf007('0x26')],'transfereeaccountcode':_0x38d649[_0xf007('0x27')],'transfereecontext':_0x38d649[_0xf007('0x28')],'transfereeexten':_0x38d649['transfertargetexten'],'transfereelinkedid':_0x38d649['transfertargetlinkedid']});}writeDB(_0x38d649);}catch(_0x571759){utils[_0xf007('0x13')](util[_0xf007('0x4')]('[%s][transfers][attendedtransfer]',_0x38d649[_0xf007('0x15')]),_0x571759);}}; \ No newline at end of file +var _0x2eb2=['transfereruniqueid','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransferercontext','attended','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','./utils','info','format','type','origtransfereruniqueid','uniqueid','CreateVoiceTransferReport','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind'];(function(_0x5c31b8,_0x2f56a3){var _0xc90b3d=function(_0x15f0bb){while(--_0x15f0bb){_0x5c31b8['push'](_0x5c31b8['shift']());}};_0xc90b3d(++_0x2f56a3);}(_0x2eb2,0x16b));var _0x22eb=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x2eb2[_0x411add];return _0x238242;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x22eb('0x0'));function writeDB(_0x3f7461){utils[_0x22eb('0x1')](util[_0x22eb('0x2')]('[%s][transfers][writeDB]\x20type:%s',_0x3f7461[_0x22eb('0x3')]==='attended'?_0x3f7461[_0x22eb('0x4')]:_0x3f7461[_0x22eb('0x5')],_0x3f7461['type']));utils['request'](_0x22eb('0x6'),_0x3f7461);}exports[_0x22eb('0x7')]={};exports[_0x22eb('0x8')]=function(_0x1f42f0){try{utils[_0x22eb('0x9')](util['format'](_0x22eb('0xa'),_0x1f42f0[_0x22eb('0x5')]),_0x1f42f0);utils[_0x22eb('0x1')](util['format'](_0x22eb('0xb'),_0x1f42f0[_0x22eb('0x5')],_0x1f42f0[_0x22eb('0xc')],_0x1f42f0[_0x22eb('0xd')],_0x1f42f0[_0x22eb('0xe')],_0x1f42f0[_0x22eb('0xf')]));_0x1f42f0[_0x22eb('0x3')]=_0x22eb('0x10');exports[_0x22eb('0x7')][_0x1f42f0[_0x22eb('0x11')]]=_0x1f42f0;writeDB(_0x1f42f0);}catch(_0x5eefd4){utils['error'](util[_0x22eb('0x2')](_0x22eb('0xa'),_0x1f42f0[_0x22eb('0x5')]),_0x5eefd4);}};exports['attendedtransfer']=function(_0xb64bb1){try{utils[_0x22eb('0x9')](util[_0x22eb('0x2')](_0x22eb('0x12'),_0xb64bb1[_0x22eb('0x4')]),_0xb64bb1);utils[_0x22eb('0x1')](util[_0x22eb('0x2')](_0x22eb('0x13'),_0xb64bb1[_0x22eb('0x4')],_0xb64bb1[_0x22eb('0x14')],_0xb64bb1[_0x22eb('0x15')],_0xb64bb1[_0x22eb('0x16')],_0xb64bb1[_0x22eb('0x17')]));_0xb64bb1=_['assign'](_0xb64bb1,{'transfererchannel':_0xb64bb1['origtransfererchannel'],'transferercalleridnum':_0xb64bb1['origtransferercalleridnum'],'transferercalleridname':_0xb64bb1[_0x22eb('0x15')],'transfererconnectedlinenum':_0xb64bb1[_0x22eb('0x18')],'transfererconnectedlinename':_0xb64bb1[_0x22eb('0x19')],'transfereraccountcode':_0xb64bb1[_0x22eb('0x1a')],'transferercontext':_0xb64bb1[_0x22eb('0x1b')],'transfererexten':_0xb64bb1['secondtransfererexten'],'transfererlinkedid':_0xb64bb1['origtransfererlinkedid'],'context':_0xb64bb1[_0x22eb('0x1c')],'extension':_0xb64bb1['origtransfererexten'],'type':_0x22eb('0x1d')});if(_[_0x22eb('0x1e')](_0xb64bb1[_0x22eb('0x1f')])){_0xb64bb1=_['assign'](_0xb64bb1,{'transfereechannel':_0xb64bb1[_0x22eb('0x20')],'transfereecalleridnum':_0xb64bb1[_0x22eb('0x16')],'transfereecalleridname':_0xb64bb1['transfertargetcalleridname'],'transfereeconnectedlinenum':_0xb64bb1[_0x22eb('0x21')],'transfereeconnectedlinename':_0xb64bb1[_0x22eb('0x22')],'transfereeaccountcode':_0xb64bb1[_0x22eb('0x23')],'transfereecontext':_0xb64bb1[_0x22eb('0x24')],'transfereeexten':_0xb64bb1['transfertargetexten'],'transfereelinkedid':_0xb64bb1[_0x22eb('0x25')]});}writeDB(_0xb64bb1);}catch(_0x1dd698){utils['error'](util['format'](_0x22eb('0x12'),_0xb64bb1[_0x22eb('0x4')]),_0x1dd698);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index d000976..4b150ea 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 _0x3588=['moment','util','client','../../config/logger','xdr','info','inspect','debug','error','request','then','catch','[utils][request]\x20name:%s','internal','interface','[utils][getUser]\x20where:%s','result','length','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','found','notfound','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','name','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','sumTime','isAfter','isBefore','bluebird','jayson/promise'];(function(_0x12369a,_0x4824f4){var _0x212d0d=function(_0x11fd6b){while(--_0x11fd6b){_0x12369a['push'](_0x12369a['shift']());}};_0x212d0d(++_0x4824f4);}(_0x3588,0x1d4));var _0x8358=function(_0x855e25,_0x5cc86d){_0x855e25=_0x855e25-0x0;var _0x4c2b86=_0x3588[_0x855e25];return _0x4c2b86;};'use strict';var BPromise=require(_0x8358('0x0'));var jayson=require(_0x8358('0x1'));var moment=require(_0x8358('0x2'));var util=require(_0x8358('0x3'));var client=jayson[_0x8358('0x4')]['http']({'port':0x2329});var logger=require(_0x8358('0x5'))(_0x8358('0x6'));exports['info']=function(_0x1a3cbc,_0x137b98){logger[_0x8358('0x7')](_0x1a3cbc,_0x137b98?util[_0x8358('0x8')](_0x137b98,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0xde89d3,_0x151ec7){logger[_0x8358('0x9')](_0xde89d3,_0x151ec7?util['inspect'](_0x151ec7,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x14468b,_0x166d11){logger[_0x8358('0xa')](_0x14468b,_0x166d11?util[_0x8358('0x8')](_0x166d11,{'showHidden':![],'depth':null}):'');};exports[_0x8358('0xb')]=function(_0x31c1e6,_0x55640e){return client[_0x8358('0xb')](_0x31c1e6,{'body':_0x55640e})[_0x8358('0xc')](function(_0x15044a){logger[_0x8358('0x9')]('[utils][request]\x20name:%s',_0x31c1e6,_0x15044a?util[_0x8358('0x8')](_0x15044a,{'showHidden':![],'depth':null}):'');})[_0x8358('0xd')](function(_0x34b0df){logger[_0x8358('0xa')](_0x8358('0xe'),_0x31c1e6,_0x34b0df?util[_0x8358('0x8')](_0x34b0df,{'showHidden':![],'depth':null}):'');});};function getUser(_0x5850c2){return client[_0x8358('0xb')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0x8358('0xf'),'name',_0x8358('0x10')],'where':_0x5850c2,'limit':0x1}})[_0x8358('0xc')](function(_0x4a2d86){logger[_0x8358('0x9')](_0x8358('0x11'),JSON['stringify'](_0x5850c2),_0x4a2d86?util[_0x8358('0x8')](_0x4a2d86,{'showHidden':![],'depth':null}):'');return _0x4a2d86[_0x8358('0x12')][_0x8358('0x13')]?_0x4a2d86[_0x8358('0x12')][0x0]:null;});}exports['getUserByInternal']=function(_0x3a98e6){return new BPromise(function(_0x2b17cd,_0x252b20){if(_0x3a98e6){return getUser({'internal':_0x3a98e6})[_0x8358('0xc')](function(_0x3f8260){logger['info']('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x3a98e6,_0x3f8260?'found':'notfound');return _0x2b17cd(_0x3f8260);})[_0x8358('0xd')](function(_0x50390f){logger['error'](_0x8358('0x14'),_0x50390f?util[_0x8358('0x8')](_0x50390f,{'showHidden':![],'depth':null}):'');return _0x2b17cd(null);});}return _0x2b17cd(null);});};exports[_0x8358('0x15')]=function(_0x5a4f22){return new BPromise(function(_0x384fb6,_0x435a99){if(_0x5a4f22){return getUser({'interface':_0x5a4f22})[_0x8358('0xc')](function(_0x4611b9){logger[_0x8358('0x7')](_0x8358('0x16'),_0x5a4f22,_0x4611b9?_0x8358('0x17'):_0x8358('0x18'));return _0x384fb6(_0x4611b9);})[_0x8358('0xd')](function(_0x423a86){logger['error']('[utils][getUserByInterface]',_0x423a86?util[_0x8358('0x8')](_0x423a86,{'showHidden':![],'depth':null}):'');return _0x384fb6(null);});}return _0x384fb6(null);});};exports['getUserByName']=function(_0x18ab13){return new BPromise(function(_0x346be6,_0x159968){if(_0x18ab13){return getUser({'name':_0x18ab13})[_0x8358('0xc')](function(_0x584b53){logger['info'](_0x8358('0x19'),_0x18ab13,_0x584b53?_0x8358('0x17'):'notfound');return _0x346be6(_0x584b53);})['catch'](function(_0xe81b35){logger['error'](_0x8358('0x1a'),_0xe81b35?util[_0x8358('0x8')](_0xe81b35,{'showHidden':![],'depth':null}):'');return _0x346be6(null);});}return _0x346be6(null);});};exports[_0x8358('0x1b')]=function(_0x34362b){return new BPromise(function(_0x276311,_0x5b67d1){if(_0x34362b){return client[_0x8358('0xb')](_0x8358('0x1c'),{'options':{'raw':!![],'attributes':['id',_0x8358('0x1d'),_0x8358('0x1e'),_0x8358('0x1f'),_0x8358('0x20')],'where':{'name':_0x34362b},'limit':0x1}})[_0x8358('0xc')](function(_0x5b61e6){logger[_0x8358('0x9')]('[utils][getVoiceQueueByName]\x20name:%s',_0x34362b,_0x5b61e6?util[_0x8358('0x8')](_0x5b61e6,{'showHidden':![],'depth':null}):'');logger[_0x8358('0x7')](_0x8358('0x21'),_0x34362b,_0x5b61e6?_0x8358('0x17'):'notfound');return _0x276311(_0x5b61e6[_0x8358('0x12')][_0x8358('0x13')]?_0x5b61e6['result'][0x0]:null);})[_0x8358('0xd')](function(_0x393d68){logger['error'](_0x8358('0x22'),_0x393d68?util[_0x8358('0x8')](_0x393d68,{'showHidden':![],'depth':null}):'');return _0x276311(null);});}return _0x276311(null);});};exports[_0x8358('0x23')]=function(_0x5ad79e,_0x4a2e9d){return moment(_0x5ad79e)[_0x8358('0x24')](_0x4a2e9d,_0x8358('0x25'))[_0x8358('0x26')](_0x8358('0x27'));};exports[_0x8358('0x28')]=function(_0x58b772,_0x36b4dc){return moment(_0x58b772)[_0x8358('0x29')](_0x36b4dc,_0x8358('0x25'))[_0x8358('0x26')](_0x8358('0x27'));};exports[_0x8358('0x2a')]=function(_0x5e3792,_0x452fff){return moment(_0x5e3792)[_0x8358('0x2b')](moment(_0x452fff),'seconds');};exports[_0x8358('0x2c')]=function(_0x933ca,_0x43c1de){return parseInt(_0x933ca,0xa)+parseInt(_0x43c1de,0xa);};exports['now']=function(){return moment()[_0x8358('0x26')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x8358('0x2d')]=function(_0x154e8a,_0x2eb487){if(_0x2eb487){return moment(_0x154e8a)['isAfter'](_0x2eb487);}return!![];};exports[_0x8358('0x2e')]=function(_0x4b8395,_0x1b6f91){if(_0x1b6f91){return moment(_0x4b8395)[_0x8358('0x2e')](_0x1b6f91);}else if(_0x4b8395){return!![];}return![];}; \ No newline at end of file +var _0xe1c0=['YYYY-MM-DD\x20HH:mm:ss','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','info','inspect','debug','error','request','[utils][request]\x20name:%s','catch','GetUser','internal','interface','then','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','found','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','name','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','notfound','[utils][getVoiceQueueByName]','addTime','add','seconds','format'];(function(_0x3bbd6b,_0x498df1){var _0x1d27fc=function(_0x2d7be7){while(--_0x2d7be7){_0x3bbd6b['push'](_0x3bbd6b['shift']());}};_0x1d27fc(++_0x498df1);}(_0xe1c0,0x120));var _0x0e1c=function(_0x176647,_0x4bffd0){_0x176647=_0x176647-0x0;var _0x356bae=_0xe1c0[_0x176647];return _0x356bae;};'use strict';var BPromise=require(_0x0e1c('0x0'));var jayson=require(_0x0e1c('0x1'));var moment=require(_0x0e1c('0x2'));var util=require(_0x0e1c('0x3'));var client=jayson[_0x0e1c('0x4')]['http']({'port':0x2329});var logger=require('../../config/logger')('xdr');exports[_0x0e1c('0x5')]=function(_0x32db88,_0x297684){logger[_0x0e1c('0x5')](_0x32db88,_0x297684?util[_0x0e1c('0x6')](_0x297684,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x5bdd62,_0x321532){logger[_0x0e1c('0x7')](_0x5bdd62,_0x321532?util[_0x0e1c('0x6')](_0x321532,{'showHidden':![],'depth':null}):'');};exports[_0x0e1c('0x8')]=function(_0x125f80,_0x416bc6){logger[_0x0e1c('0x8')](_0x125f80,_0x416bc6?util['inspect'](_0x416bc6,{'showHidden':![],'depth':null}):'');};exports[_0x0e1c('0x9')]=function(_0xf84a52,_0x2e8ce1){return client['request'](_0xf84a52,{'body':_0x2e8ce1})['then'](function(_0x46e1a7){logger[_0x0e1c('0x7')](_0x0e1c('0xa'),_0xf84a52,_0x46e1a7?util[_0x0e1c('0x6')](_0x46e1a7,{'showHidden':![],'depth':null}):'');})[_0x0e1c('0xb')](function(_0x3a258e){logger[_0x0e1c('0x8')](_0x0e1c('0xa'),_0xf84a52,_0x3a258e?util[_0x0e1c('0x6')](_0x3a258e,{'showHidden':![],'depth':null}):'');});};function getUser(_0x429aa4){return client['request'](_0x0e1c('0xc'),{'options':{'raw':!![],'attributes':['id',_0x0e1c('0xd'),'name',_0x0e1c('0xe')],'where':_0x429aa4,'limit':0x1}})[_0x0e1c('0xf')](function(_0x71c864){logger[_0x0e1c('0x7')](_0x0e1c('0x10'),JSON[_0x0e1c('0x11')](_0x429aa4),_0x71c864?util[_0x0e1c('0x6')](_0x71c864,{'showHidden':![],'depth':null}):'');return _0x71c864[_0x0e1c('0x12')][_0x0e1c('0x13')]?_0x71c864['result'][0x0]:null;});}exports[_0x0e1c('0x14')]=function(_0x20de90){return new BPromise(function(_0x3213d8,_0x15485e){if(_0x20de90){return getUser({'internal':_0x20de90})[_0x0e1c('0xf')](function(_0x5aecf9){logger[_0x0e1c('0x5')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x20de90,_0x5aecf9?_0x0e1c('0x15'):'notfound');return _0x3213d8(_0x5aecf9);})[_0x0e1c('0xb')](function(_0x591ec7){logger[_0x0e1c('0x8')](_0x0e1c('0x16'),_0x591ec7?util[_0x0e1c('0x6')](_0x591ec7,{'showHidden':![],'depth':null}):'');return _0x3213d8(null);});}return _0x3213d8(null);});};exports[_0x0e1c('0x17')]=function(_0xeba0e2){return new BPromise(function(_0x7fe913,_0x3957c5){if(_0xeba0e2){return getUser({'interface':_0xeba0e2})['then'](function(_0x1ad80b){logger[_0x0e1c('0x5')](_0x0e1c('0x18'),_0xeba0e2,_0x1ad80b?'found':'notfound');return _0x7fe913(_0x1ad80b);})[_0x0e1c('0xb')](function(_0x2393bb){logger['error'](_0x0e1c('0x19'),_0x2393bb?util[_0x0e1c('0x6')](_0x2393bb,{'showHidden':![],'depth':null}):'');return _0x7fe913(null);});}return _0x7fe913(null);});};exports['getUserByName']=function(_0x5abda0){return new BPromise(function(_0x27c8f4,_0x1cff58){if(_0x5abda0){return getUser({'name':_0x5abda0})['then'](function(_0x416ee8){logger[_0x0e1c('0x5')]('[utils][getUserByName]\x20name:%s\x20%s',_0x5abda0,_0x416ee8?_0x0e1c('0x15'):'notfound');return _0x27c8f4(_0x416ee8);})[_0x0e1c('0xb')](function(_0x100089){logger['error'](_0x0e1c('0x1a'),_0x100089?util[_0x0e1c('0x6')](_0x100089,{'showHidden':![],'depth':null}):'');return _0x27c8f4(null);});}return _0x27c8f4(null);});};exports[_0x0e1c('0x1b')]=function(_0x2f450f){return new BPromise(function(_0x1d3013,_0x5f6bdc){if(_0x2f450f){return client[_0x0e1c('0x9')](_0x0e1c('0x1c'),{'options':{'raw':!![],'attributes':['id',_0x0e1c('0x1d'),_0x0e1c('0x1e'),_0x0e1c('0x1f'),_0x0e1c('0x20')],'where':{'name':_0x2f450f},'limit':0x1}})[_0x0e1c('0xf')](function(_0x54f5bc){logger[_0x0e1c('0x7')](_0x0e1c('0x21'),_0x2f450f,_0x54f5bc?util['inspect'](_0x54f5bc,{'showHidden':![],'depth':null}):'');logger['info'](_0x0e1c('0x22'),_0x2f450f,_0x54f5bc?'found':_0x0e1c('0x23'));return _0x1d3013(_0x54f5bc['result'][_0x0e1c('0x13')]?_0x54f5bc[_0x0e1c('0x12')][0x0]:null);})[_0x0e1c('0xb')](function(_0x4eb328){logger[_0x0e1c('0x8')](_0x0e1c('0x24'),_0x4eb328?util[_0x0e1c('0x6')](_0x4eb328,{'showHidden':![],'depth':null}):'');return _0x1d3013(null);});}return _0x1d3013(null);});};exports[_0x0e1c('0x25')]=function(_0x258350,_0x142e01){return moment(_0x258350)[_0x0e1c('0x26')](_0x142e01,_0x0e1c('0x27'))[_0x0e1c('0x28')](_0x0e1c('0x29'));};exports['subtractTime']=function(_0x23a80f,_0x234991){return moment(_0x23a80f)['subtract'](_0x234991,_0x0e1c('0x27'))['format'](_0x0e1c('0x29'));};exports['diffTime']=function(_0x494122,_0x1b2233){return moment(_0x494122)[_0x0e1c('0x2a')](moment(_0x1b2233),'seconds');};exports[_0x0e1c('0x2b')]=function(_0x2c9336,_0x51fa69){return parseInt(_0x2c9336,0xa)+parseInt(_0x51fa69,0xa);};exports[_0x0e1c('0x2c')]=function(){return moment()[_0x0e1c('0x28')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x0e1c('0x2d')]=function(_0x210cf4,_0x4fcf4b){if(_0x4fcf4b){return moment(_0x210cf4)[_0x0e1c('0x2d')](_0x4fcf4b);}return!![];};exports[_0x0e1c('0x2e')]=function(_0x2d2dd6,_0x20f100){if(_0x20f100){return moment(_0x2d2dd6)['isBefore'](_0x20f100);}else if(_0x2d2dd6){return!![];}return![];}; \ No newline at end of file -- 1.7.1